The R Project SVN R

Rev

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

Rev 63096 Rev 63181
Line 150... Line 150...
150
}
150
}
151
 
151
 
152
attribute_hidden
152
attribute_hidden
153
const char *EncodeEnvironment(SEXP x)
153
const char *EncodeEnvironment(SEXP x)
154
{
154
{
-
 
155
    const void *vmax = vmaxget();
155
    static char ch[1000];
156
    static char ch[1000];
156
    if (x == R_GlobalEnv)
157
    if (x == R_GlobalEnv)
157
	sprintf(ch, "<environment: R_GlobalEnv>");
158
	sprintf(ch, "<environment: R_GlobalEnv>");
158
    else if (x == R_BaseEnv)
159
    else if (x == R_BaseEnv)
159
	sprintf(ch, "<environment: base>");
160
	sprintf(ch, "<environment: base>");
Line 165... Line 166...
165
    else if (R_IsNamespaceEnv(x))
166
    else if (R_IsNamespaceEnv(x))
166
	snprintf(ch, 1000, "<environment: namespace:%s>",
167
	snprintf(ch, 1000, "<environment: namespace:%s>",
167
		translateChar(STRING_ELT(R_NamespaceEnvSpec(x), 0)));
168
		translateChar(STRING_ELT(R_NamespaceEnvSpec(x), 0)));
168
    else snprintf(ch, 1000, "<environment: %p>", (void *)x);
169
    else snprintf(ch, 1000, "<environment: %p>", (void *)x);
169
 
170
 
-
 
171
    vmaxset(vmax);
170
    return ch;
172
    return ch;
171
}
173
}
172
 
174
 
173
const char *EncodeReal(double x, int w, int d, int e, char cdec)
175
const char *EncodeReal(double x, int w, int d, int e, char cdec)
174
{
176
{
Line 427... Line 429...
427
{
429
{
428
    int b, b0, i, j, cnt;
430
    int b, b0, i, j, cnt;
429
    const char *p; char *q, buf[11];
431
    const char *p; char *q, buf[11];
430
    cetype_t ienc = getCharCE(s);
432
    cetype_t ienc = getCharCE(s);
431
    Rboolean useUTF8 = w < 0;
433
    Rboolean useUTF8 = w < 0;
-
 
434
    const void *vmax = vmaxget();
-
 
435
 
432
    if (w < 0) w = w + 1000000;
436
    if (w < 0) w = w + 1000000;
433
 
437
 
434
    /* We have to do something like this as the result is returned, and
438
    /* We have to do something like this as the result is returned, and
435
       passed on by EncodeElement -- so no way could be end user be
439
       passed on by EncodeElement -- so no way could be end user be
436
       responsible for freeing it.  However, this is not thread-safe. */
440
       responsible for freeing it.  However, this is not thread-safe. */
Line 657... Line 661...
657
    if(quote) *q++ = (char) quote;
661
    if(quote) *q++ = (char) quote;
658
    if(b > 0 && justify != Rprt_adj_right) {
662
    if(b > 0 && justify != Rprt_adj_right) {
659
	for(i = 0 ; i < b ; i++) *q++ = ' ';
663
	for(i = 0 ; i < b ; i++) *q++ = ' ';
660
    }
664
    }
661
    *q = '\0';
665
    *q = '\0';
-
 
666
 
-
 
667
    vmaxset(vmax);
662
    return buffer->data;
668
    return buffer->data;
663
}
669
}
664
 
670
 
665
/* EncodeElement is called by cat(), write.table() and deparsing. */
671
/* EncodeElement is called by cat(), write.table() and deparsing. */
666
 
672