RPA Toolkit
renamed rpa2 to rpa
[rpatk.git] / tests / testrjs / rjs-simple.c
1 #include <stdio.h>
2 #include <stdlib.h>
3 #include <sys/types.h>
4 #include <sys/stat.h>
5 #include <sys/types.h>
6 #include <fcntl.h>
7 #include <unistd.h>
8 #include <sys/mman.h>
9
10 #include "rstring.h"
11 #include "rjs.h"
12
13
14 int main(int argc, char *argv[])
15 {
16         rjs_engine_t *jse = rjs_engine_create();
17         rchar test_script1[] = "(2+3)*3;";
18         rchar test_script2[] = "var person = new Object(); person.name = 'Martin'; person.age = 25; person.job = 'slacker';";
19
20 //      jse->debugexec = 1;
21         r_printf("script: %s, result: %ld\n", test_script1, rvm_reg_long(rjs_engine_exec_s(jse, test_script1)));
22         rjs_engine_exec_s(jse, test_script2);
23         r_printf("Name: %s\n", r_string_ansi(rvm_reg_string(rjs_engine_exec_s(jse, "person.name;"))));
24         r_printf("Job: %s\n", r_string_ansi(rvm_reg_string(rjs_engine_exec_s(jse, "person.job;"))));
25
26         rjs_engine_destroy(jse);
27         return 0;
28 }