The R Project SVN R

Rev

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

Rev 49773 Rev 50894
Line 23... Line 23...
23
#include <config.h>
23
#include <config.h>
24
#endif
24
#endif
25
 
25
 
26
#include <Defn.h>
26
#include <Defn.h>
27
#include "RBufferUtils.h"
27
#include "RBufferUtils.h"
-
 
28
#include <R_ext/RS.h> /* for Calloc/Free */
28
 
29
 
29
#define MAXLINE MAXELTSIZE
30
#define MAXLINE MAXELTSIZE
30
#define MAXNARGS 100
31
#define MAXNARGS 100
31
/*               ^^^ not entirely arbitrary, but strongly linked to allowing %$1 to %$99 !*/
32
/*               ^^^ not entirely arbitrary, but strongly linked to allowing %$1 to %$99 !*/
32
 
33
 
Line 307... Line 308...
307
				    COERCE_THIS_TO_A
308
				    COERCE_THIS_TO_A
308
				}
309
				}
309
				break;
310
				break;
310
			    case 's':
311
			    case 's':
311
				if(TYPEOF(_this) != STRSXP) {
312
				if(TYPEOF(_this) != STRSXP) {
-
 
313
				    /* as.character method might call sprintf() */
-
 
314
				    int nc = strlen(outputString);
-
 
315
				    char *z = Calloc(nc+1, char);
-
 
316
				    strcpy(z, outputString);
312
				    PROTECT(tmp = lang2(install("as.character"), _this));
317
				    PROTECT(tmp = lang2(install("as.character"), _this));
313
 
318
 
314
				    COERCE_THIS_TO_A
319
				    COERCE_THIS_TO_A
-
 
320
				    strcpy(outputString, z);
-
 
321
				    Free(z);
315
				}
322
				}
316
				break;
323
				break;
317
			    default:
324
			    default:
318
				break;
325
				break;
319
			    }
326
			    }