[gambit-list] Embed gambit in c main loop, try to get 'compile-*' and 'load-*' working

Gmail thewhimer at gmail.com
Sat Feb 14 23:12:53 EST 2015


Hi, I had gambit embedded in a c main loop, setup and started ##repl-debug-main, and I got a working repl with ‘load’ function. But have yet to find a way to get ‘compile-*’ working, so I cannot do compile and load like in gsc.

Would someone point me to the right direction? Linked with -lgambc -lgambcgsc, static libraries, os x.

Thanks for your time. Here follows the code snippets that might be relevant.

— Code snippet  1:
; Start a repl in my init.scm. By the way, I was trying to start gambit from a separate thread, so there’s a loop at the end of init.scm.

(thread-start!
  (make-thread
    (lambda () (##repl-debug-main))))

(let loop ()
 (thread-sleep! 1)
 (loop))


— Code snippet 2:
// Just a normal setup.

void gambit_setup()
{
   /*
    * Setup the Scheme library by calling "___setup" with appropriate
    * parameters.  The call to "___setup_params_reset" sets all
    * parameters to their default setting.
    */

    // Taken from gambit, lib/main.c. 
    int debug_settings = ___DEBUG_SETTINGS_INITIAL;

    // -:d- (force repl io to be stdin/stdout since terminal isn't
    // -attached)
    debug_settings =
        (debug_settings
         & ~___DEBUG_SETTINGS_REPL_MASK)
        | (___DEBUG_SETTINGS_REPL_STDIO
                << ___DEBUG_SETTINGS_REPL_SHIFT);
    // -:da
    debug_settings =
        (debug_settings
         & ~___DEBUG_SETTINGS_UNCAUGHT_MASK)
        | (___DEBUG_SETTINGS_UNCAUGHT_ALL
                << ___DEBUG_SETTINGS_UNCAUGHT_SHIFT);
    // -:dr
    debug_settings =
        (debug_settings
         & ~___DEBUG_SETTINGS_ERROR_MASK)
        | (___DEBUG_SETTINGS_ERROR_REPL
                << ___DEBUG_SETTINGS_ERROR_SHIFT);
    // -:d2
    // debug_settings =
    //     (debug_settings & ~___DEBUG_SETTINGS_LEVEL_MASK)
    //     | (2 << ___DEBUG_SETTINGS_LEVEL_SHIFT);

   ___setup_params_struct setup_params;

   ___setup_params_reset (&setup_params);

   setup_params.version        = ___VERSION;
   setup_params.linker         = SCHEME_LIBRARY_LINKER;
   setup_params.debug_settings = debug_settings;

   ___setup (&setup_params);
}




More information about the Gambit-list mailing list