File: Rpostscript.c

package info (click to toggle)
r-base 3.1.1-1%2Bdeb8u1
  • links: PTS
  • area: main
  • in suites: jessie
  • size: 85,436 kB
  • ctags: 35,389
  • sloc: ansic: 306,779; fortran: 91,908; sh: 11,216; makefile: 5,311; yacc: 4,994; tcl: 4,562; objc: 746; perl: 655; asm: 553; java: 31; sed: 6
file content (39 lines) | stat: -rw-r--r-- 847 bytes parent folder | download | duplicates (15)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/*
  Tests using the postcript device from within 
  an application that embeds the R interpreter.
  Equivalent of evaluating the expressions:
    postscript()
    plot(1:100)
    q()
 */
#include "embeddedRCall.h"

int
main(int argc, char *argv[])
{
    SEXP e, e1;
    /* char *localArgs[] = {"R", "--no-save", "--silent"}; */
    init_R(argc, argv);

    /* postscript() */
    PROTECT(e = lang1(install("postscript")));
    eval(e, R_GlobalEnv);
    UNPROTECT(1);

    /* expression 1:100 */

    /*  1:100 */
    PROTECT(e1 = lang3(install(":"), ScalarInteger(1), ScalarInteger(100)));
    PROTECT(e = lang2(install("plot"), e1));
    /* plot( 1:100 )*/
    eval(e, R_GlobalEnv);
    UNPROTECT(2);

    /* q() */
    PROTECT(e = lang2(install("q"), mkString("no")));
    eval(e, R_GlobalEnv);
    UNPROTECT(1);

    end_R();
    return(0);
}