The R Project SVN R

Rev

Rev 40705 | Rev 41807 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 40705 Rev 41781
Line 616... Line 616...
616
    int code;
616
    int code;
617
} SymTab;
617
} SymTab;
618
 
618
 
619
/* Determine a match between symbol name and string. */
619
/* Determine a match between symbol name and string. */
620
 
620
 
621
static int NameMatch(SEXP expr, char *aString)
621
static int NameMatch(SEXP expr, const char *aString)
622
{
622
{
623
    if (!isSymbol(expr)) return 0;
623
    if (!isSymbol(expr)) return 0;
624
    return !strcmp(CHAR(PRINTNAME(expr)), aString);
624
    return !strcmp(CHAR(PRINTNAME(expr)), aString);
625
}
625
}
626
 
626
 
627
static int StringMatch(SEXP expr, char *aString)
627
static int StringMatch(SEXP expr, const char *aString)
628
{
628
{
629
    return !strcmp(translateChar(STRING_ELT(expr, 0)), aString);
629
    return !strcmp(translateChar(STRING_ELT(expr, 0)), aString);
630
}
630
}
631
/* Code to determine the ascii code corresponding */
631
/* Code to determine the ascii code corresponding */
632
/* to an element of a mathematical expression. */
632
/* to an element of a mathematical expression. */
Line 1029... Line 1029...
1029
 
1029
 
1030
/* Draw a Symbol String in "Math Mode" */
1030
/* Draw a Symbol String in "Math Mode" */
1031
/* This code inserts italic corrections after */
1031
/* This code inserts italic corrections after */
1032
/* every character. */
1032
/* every character. */
1033
 
1033
 
1034
static BBOX RenderSymbolStr(char *str, int draw, mathContext *mc,
1034
static BBOX RenderSymbolStr(const char *str, int draw, mathContext *mc,
1035
			    R_GE_gcontext *gc, GEDevDesc *dd)
1035
			    R_GE_gcontext *gc, GEDevDesc *dd)
1036
{
1036
{
1037
    char chr[7] = "", *s = str;
1037
    char chr[7] = "";
-
 
1038
    const char *s = str;
1038
    BBOX glyphBBox;
1039
    BBOX glyphBBox;
1039
    BBOX resultBBox = NullBBox();
1040
    BBOX resultBBox = NullBBox();
1040
    double lastItalicCorr = 0;
1041
    double lastItalicCorr = 0;
1041
    FontType prevfont = GetFont(gc);
1042
    FontType prevfont = GetFont(gc);
1042
    FontType font = prevfont;
1043
    FontType font = prevfont;
Line 1148... Line 1149...
1148
    }
1149
    }
1149
    return bbox;
1150
    return bbox;
1150
}
1151
}
1151
 
1152
 
1152
/* This gets called on strings and PRINTNAMES */
1153
/* This gets called on strings and PRINTNAMES */
1153
static BBOX RenderStr(char *str, int draw, mathContext *mc,
1154
static BBOX RenderStr(const char *str, int draw, mathContext *mc,
1154
		      R_GE_gcontext *gc, GEDevDesc *dd)
1155
		      R_GE_gcontext *gc, GEDevDesc *dd)
1155
{
1156
{
1156
    BBOX glyphBBox;
1157
    BBOX glyphBBox;
1157
    BBOX resultBBox = NullBBox();
1158
    BBOX resultBBox = NullBBox();
1158
    if (str) {
1159
    if (str) {
1159
#ifdef SUPPORT_MBCS
1160
#ifdef SUPPORT_MBCS
1160
	int n = strlen(str), used;
1161
	int n = strlen(str), used;
1161
	wchar_t wc;
1162
	wchar_t wc;
1162
	char *p = str;
1163
	const char *p = str;
1163
	mbstate_t mb_st;
1164
	mbstate_t mb_st;
1164
	mbs_init(&mb_st);
1165
	mbs_init(&mb_st);
1165
	while ((used = Mbrtowc(&wc, p, n, &mb_st)) > 0) {
1166
	while ((used = Mbrtowc(&wc, p, n, &mb_st)) > 0) {
1166
	    glyphBBox = GlyphBBox(wc, gc, dd);
1167
	    glyphBBox = GlyphBBox(wc, gc, dd);
1167
	    resultBBox = CombineBBoxes(resultBBox, glyphBBox);
1168
	    resultBBox = CombineBBoxes(resultBBox, glyphBBox);