The R Project SVN R

Rev

Rev 38840 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
14948 duncan 1
/*
88200 smeyer 2
  Tests using the postscript device from within 
14948 duncan 3
  an application that embeds the R interpreter.
4
  Equivalent of evaluating the expressions:
5
    postscript()
6
    plot(1:100)
7
    q()
8
 */
9
#include "embeddedRCall.h"
10
 
11
int
12
main(int argc, char *argv[])
13
{
14
    SEXP e, e1;
34062 ripley 15
    /* char *localArgs[] = {"R", "--no-save", "--silent"}; */
14948 duncan 16
    init_R(argc, argv);
17
 
38673 ripley 18
    /* postscript() */
19
    PROTECT(e = lang1(install("postscript")));
14948 duncan 20
    eval(e, R_GlobalEnv);
38673 ripley 21
    UNPROTECT(1);
14948 duncan 22
 
23
    /* expression 1:100 */
24
 
38673 ripley 25
    /*  1:100 */
26
    PROTECT(e1 = lang3(install(":"), ScalarInteger(1), ScalarInteger(100)));
27
    PROTECT(e = lang2(install("plot"), e1));
28
    /* plot( 1:100 )*/
14948 duncan 29
    eval(e, R_GlobalEnv);
30
    UNPROTECT(2);
31
 
32
    /* q() */
38673 ripley 33
    PROTECT(e = lang2(install("q"), mkString("no")));
14948 duncan 34
    eval(e, R_GlobalEnv);
38673 ripley 35
    UNPROTECT(1);
14948 duncan 36
 
38840 ripley 37
    end_R();
14948 duncan 38
    return(0);
39
}