4 // SWIG file for a simple Guile interpreter
 
   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.
 
  18  * Revision 1.1.1.1  1999/02/28 02:00:54  beazley
 
  21  * Revision 1.1  1996/05/22 20:02:10  beazley
 
  29 GSCM_status guile_init();
 
  31 int main(int argc, char **argv) {
 
  33   GSCM_top_level toplev;
 
  35   char input_str[16384];
 
  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);
 
  43     printf("Error in startup.\n");
 
  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);
 
  55   /* now sit in a scheme eval loop: I input the expressions, have guile
 
  56    * evaluate them, and then get another expression.
 
  59   fprintf(stdout,"Guile > ");
 
  61     if (fgets(input_str,16384,stdin) == NULL) {
 
  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 > ");
 
  71   /* now clean up and quit */
 
  72   gscm_destroy_top_level(toplev);