The R Project SVN R

Rev

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

Rev 19500 Rev 25961
Line 1... Line 1...
1
#include <R.h>
1
#include <R.h>
2
#include <Rinternals.h>
2
#include <Rinternals.h>
3
#include <Rdefines.h>
3
#include <Rdefines.h>
-
 
4
#include <R_ext/Parse.h>
4
 
5
 
5
#include "embeddedRCall.h"
6
#include "embeddedRCall.h"
6
 
7
 
7
/* See the no-exported header file ${R_HOME}/src/include/Parse.h */
-
 
8
 
-
 
9
SEXP R_ParseVector(SEXP, int, int *);     
-
 
10
 
-
 
11
int
8
int
12
main(int argc, char *argv[])
9
main(int argc, char *argv[])
13
{
10
{
14
  SEXP fun, arg, seq, pch, tmp;
11
    SEXP fun, arg, seq, pch, tmp;
15
  SEXP e, e1;
12
    SEXP e, e1;
16
  int i, n;
13
    int i, n, hadError;
17
  int status, hadError;
14
    ParseStatus status;
18
 
15
 
19
  init_R(argc, argv);
16
    init_R(argc, argv);
20
 
17
 
21
  PROTECT(tmp = NEW_CHARACTER(1));
18
    PROTECT(tmp = NEW_CHARACTER(1));
-
 
19
    SET_STRING_ELT(tmp, 0, 
22
  SET_STRING_ELT(tmp, 0, COPY_TO_USER_STRING("{plot(1:10, pch=\"+\");print(1:10)}"));
20
		   COPY_TO_USER_STRING("{plot(1:10, pch=\"+\");print(1:10)}"));
23
  e = R_ParseVector(tmp, 1, &status);
21
    e = R_ParseVector(tmp, 1, &status);
24
 
22
 
25
  PROTECT(e);
23
    PROTECT(e);
26
  Rf_PrintValue(e);
24
    Rf_PrintValue(e);
27
  n = GET_LENGTH(e);
25
    n = GET_LENGTH(e);
28
 
26
 
29
  Test_tryEval(VECTOR_ELT(e,0), &hadError);  
27
    Test_tryEval(VECTOR_ELT(e,0), &hadError);  
30
 
28
 
31
  UNPROTECT(2);
29
    UNPROTECT(2);
32
 
30
 
33
 return(0);
31
    return(0);
34
}
32
}