4 #include <st-compiler.h>
9 #include <st-universe.h>
10 #include <st-object.h>
17 #define BUF_SIZE 10000
20 main (int argc
, char *argv
[])
22 st_compiler_error error
;
23 char buffer
[BUF_SIZE
];
30 st_bootstrap_universe ();
32 while ((c
= getchar ()) != EOF
&& i
< (BUF_SIZE
- 1))
36 string
= st_strconcat ("doIt ^ [", buffer
, "] value", NULL
);
38 bool result
= st_compile_string (ST_UNDEFINED_OBJECT_CLASS
, string
, &error
);
40 fprintf (stderr
, "test-processor:%i: %s\n",
41 error
.line
, error
.message
);
47 struct timeval before
, after
;
50 gettimeofday (&before
, NULL
);
54 gettimeofday (&after
, NULL
);
56 elapsed
= after
.tv_sec
- before
.tv_sec
+
57 (after
.tv_usec
- before
.tv_usec
) / 1.e6
;
59 /* inspect the returned value on top of the stack */
60 value
= ST_STACK_PEEK ((&__cpu
));
62 printf ("result: %s\n", st_object_printString (value
));
63 printf ("time %.9f seconds\n", elapsed
);