]> git.saurik.com Git - wxWidgets.git/blob - wxPython/wxSWIG/swig_lib/guile/interpreter.i
Updates for building wxSWIG on Linux
[wxWidgets.git] / wxPython / wxSWIG / swig_lib / guile / interpreter.i
1 //
2 // $Header$
3 //
4 // SWIG file for a simple Guile interpreter
5 //
6 /* Revision History
7 * $Log$
8 * Revision 1.1 2002/04/29 19:56:52 RD
9 * Since I have made several changes to SWIG over the years to accomodate
10 * special cases and other things in wxPython, and since I plan on making
11 * several more, I've decided to put the SWIG sources in wxPython's CVS
12 * instead of relying on maintaining patches. This effectivly becomes a
13 * fork of an obsolete version of SWIG, :-( but since SWIG 1.3 still
14 * doesn't have some things I rely on in 1.1, not to mention that my
15 * custom patches would all have to be redone, I felt that this is the
16 * easier road to take.
17 *
18 * Revision 1.1.1.1 1999/02/28 02:00:54 beazley
19 * Swig1.1
20 *
21 * Revision 1.1 1996/05/22 20:02:10 beazley
22 * Initial revision
23 *
24 */
25
26 %{
27
28 #include <stdio.h>
29 GSCM_status guile_init();
30
31 int main(int argc, char **argv) {
32 GSCM_status status;
33 GSCM_top_level toplev;
34 char *eval_answer;
35 char input_str[16384];
36 int done;
37
38 /* start a scheme interpreter */
39 status = gscm_run_scm(argc, argv, 0, stdout, stderr, guile_init, 0, "#t");
40 if (status != GSCM_OK) {
41 fputs(gscm_error_msg(status), stderr);
42 fputc('\n', stderr);
43 printf("Error in startup.\n");
44 exit(1);
45 }
46
47 /* create the top level environment */
48 status = gscm_create_top_level(&toplev);
49 if (status != GSCM_OK) {
50 fputs(gscm_error_msg(status), stderr);
51 fputc('\n', stderr);
52 exit(1);
53 }
54
55 /* now sit in a scheme eval loop: I input the expressions, have guile
56 * evaluate them, and then get another expression.
57 */
58 done = 0;
59 fprintf(stdout,"Guile > ");
60 while (!done) {
61 if (fgets(input_str,16384,stdin) == NULL) {
62 exit(1);
63 } else {
64 if (strncmp(input_str,"quit",4) == 0) exit(1);
65 status = gscm_eval_str(&eval_answer, toplev, input_str);
66 fprintf(stdout,"%s\n", eval_answer);
67 fprintf(stdout,"Guile > ");
68 }
69 }
70
71 /* now clean up and quit */
72 gscm_destroy_top_level(toplev);
73 }
74
75 %}
76
77
78