diff -Naur freehoo-3.5.3.20100314cvs.orig/src/compat.c freehoo-3.5.3.20100314cvs/src/compat.c --- freehoo-3.5.3.20100314cvs.orig/src/compat.c 2008-02-20 17:19:10.000000000 +0100 +++ freehoo-3.5.3.20100314cvs/src/compat.c 2013-02-25 19:16:23.279000000 +0100 @@ -168,3 +168,115 @@ } } #endif + +#if SCM_MAJOR_VERSION == 2 + +SCM gh_define (const char *name, SCM val) +{ + scm_c_define (name, val); + return SCM_UNSPECIFIED; +} + +SCM +gh_append2 (SCM l1, SCM l2) +{ + return scm_append (scm_list_2 (l1, l2)); +} + +SCM +gh_standard_handler (void *data SCM_UNUSED, SCM tag, SCM throw_args SCM_UNUSED) +{ + fprintf (stderr, "\nJust got an error; tag is\n "); + scm_display (tag, scm_current_output_port ()); + scm_newline (scm_current_output_port ()); + scm_newline (scm_current_output_port ()); + + return SCM_BOOL_F; +} + +SCM +gh_catch (SCM tag, scm_t_catch_body body, void *body_data, + scm_t_catch_handler handler, void *handler_data) +{ + return scm_internal_catch (tag, body, body_data, handler, handler_data); +} + +SCM +gh_str02scm (const char *s) +{ + return scm_from_locale_string (s); +} + +/* evaluate the file by passing it to the lower level scm_primitive_load() */ +SCM +gh_eval_file (const char *fname) +{ + return scm_primitive_load (gh_str02scm (fname)); +} + +static SCM +eval_file_wrapper (void *data) +{ +/* gh_eval_t real_eval_proc = (gh_eval_t) (* ((gh_eval_t *) data)); */ + + char *scheme_code = (char *) data; + return gh_eval_file (scheme_code); +} + +SCM +gh_eval_file_with_catch (const char *scheme_code, scm_t_catch_handler handler) +{ + /* FIXME: not there yet */ + return gh_catch (SCM_BOOL_T, (scm_t_catch_body) eval_file_wrapper, + (void *) scheme_code, (scm_t_catch_handler) handler, + (void *) scheme_code); +} + +SCM +gh_eval_file_with_standard_handler (const char *scheme_code) +{ + return gh_eval_file_with_catch (scheme_code, gh_standard_handler); +} + +/* Evaluate the string; toss the value. */ +SCM +gh_eval_str (const char *scheme_code) +{ + return scm_c_eval_string (scheme_code); +} + +static SCM +eval_str_wrapper (void *data) +{ +/* gh_eval_t real_eval_proc = (gh_eval_t) (* ((gh_eval_t *) data)); */ + + char *scheme_code = (char *) data; + return gh_eval_str (scheme_code); +} + +SCM +gh_eval_str_with_catch (const char *scheme_code, scm_t_catch_handler handler) +{ + /* FIXME: not there yet */ + return gh_catch (SCM_BOOL_T, (scm_t_catch_body) eval_str_wrapper, (void *) scheme_code, + (scm_t_catch_handler) handler, (void *) scheme_code); +} + +SCM +gh_eval_str_with_standard_handler (const char *scheme_code) +{ + return gh_eval_str_with_catch (scheme_code, gh_standard_handler); +} + +SCM +gh_eval_str_with_stack_saving_handler (const char *scheme_code) +{ + return scm_internal_stack_catch (SCM_BOOL_T, + (scm_t_catch_body) eval_str_wrapper, + (void *) scheme_code, + (scm_t_catch_handler) + gh_standard_handler, + (void *) scheme_code); +} + +#endif /* SCM_MAJOR_VERSION == 2 */ diff -Naur freehoo-3.5.3.20100314cvs.orig/src/compat.h freehoo-3.5.3.20100314cvs/src/compat.h --- freehoo-3.5.3.20100314cvs.orig/src/compat.h 2008-02-20 17:19:11.000000000 +0100 +++ freehoo-3.5.3.20100314cvs/src/compat.h 2013-02-25 19:16:23.287000000 +0100 @@ -144,4 +144,21 @@ #endif +#if SCM_MAJOR_VERSION == 2 + +SCM gh_define (const char *name, SCM val); +SCM gh_append2 (SCM l1, SCM l2); +SCM gh_standard_handler (void *data SCM_UNUSED, SCM tag, SCM throw_args SCM_UNUSED); +SCM gh_catch (SCM tag, scm_t_catch_body body, void *body_data, scm_t_catch_handler handler, void *handler_data); +SCM gh_str02scm (const char *s); +SCM gh_eval_file (const char *fname); +SCM gh_eval_file_with_catch (const char *scheme_code, scm_t_catch_handler handler); +SCM gh_eval_file_with_standard_handler (const char *scheme_code); +SCM gh_eval_str (const char *scheme_code); +SCM gh_eval_str_with_catch (const char *scheme_code, scm_t_catch_handler handler); +SCM gh_eval_str_with_standard_handler (const char *scheme_code); +SCM gh_eval_str_with_stack_saving_handler (const char *scheme_code); + +#endif /* SCM_MAJOR_VERSION == 2 */ + #endif /* __COMPAT_H__ */ diff -Naur freehoo-3.5.3.20100314cvs.orig/src/extension.c freehoo-3.5.3.20100314cvs/src/extension.c --- freehoo-3.5.3.20100314cvs.orig/src/extension.c 2008-05-04 11:40:01.000000000 +0200 +++ freehoo-3.5.3.20100314cvs/src/extension.c 2013-02-25 19:18:41.515000000 +0100 @@ -16,7 +16,11 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +#include +#if SCM_MAJOR_VERSION == 1 #include +#endif + #include "extension.h" #include "freehoo.h" #include "scm-procedures.h" diff -Naur freehoo-3.5.3.20100314cvs.orig/src/fh-utils.c freehoo-3.5.3.20100314cvs/src/fh-utils.c --- freehoo-3.5.3.20100314cvs.orig/src/fh-utils.c 2008-04-30 22:16:26.000000000 +0200 +++ freehoo-3.5.3.20100314cvs/src/fh-utils.c 2013-02-25 19:18:36.830000000 +0100 @@ -25,7 +25,12 @@ #include #include #include + +#include +#if SCM_MAJOR_VERSION == 1 #include +#endif + #include #include diff -Naur freehoo-3.5.3.20100314cvs.orig/src/freehoo.c freehoo-3.5.3.20100314cvs/src/freehoo.c --- freehoo-3.5.3.20100314cvs.orig/src/freehoo.c 2008-05-02 21:46:06.000000000 +0200 +++ freehoo-3.5.3.20100314cvs/src/freehoo.c 2013-02-25 19:19:54.554000000 +0100 @@ -23,7 +23,12 @@ #include #include #include + +#include +#if SCM_MAJOR_VERSION == 1 #include +#endif + #include #include #include diff -Naur freehoo-3.5.3.20100314cvs.orig/src/interpreter.c freehoo-3.5.3.20100314cvs/src/interpreter.c --- freehoo-3.5.3.20100314cvs.orig/src/interpreter.c 2010-03-15 03:37:56.000000000 +0100 +++ freehoo-3.5.3.20100314cvs/src/interpreter.c 2013-02-25 19:19:49.535000000 +0100 @@ -21,7 +21,12 @@ #include #include #include + +#include +#if SCM_MAJOR_VERSION == 1 #include +#endif + #include #include #include diff -Naur freehoo-3.5.3.20100314cvs.orig/src/yahoo-adapter.c freehoo-3.5.3.20100314cvs/src/yahoo-adapter.c --- freehoo-3.5.3.20100314cvs.orig/src/yahoo-adapter.c 2008-04-30 22:16:27.000000000 +0200 +++ freehoo-3.5.3.20100314cvs/src/yahoo-adapter.c 2013-02-25 19:19:43.674000000 +0100 @@ -29,7 +29,12 @@ #include #include #include + +#include +#if SCM_MAJOR_VERSION == 1 #include +#endif + #include #include "freehoo.h" diff -Naur freehoo-3.5.3.20100314cvs.orig/src/yahoo-backend.c freehoo-3.5.3.20100314cvs/src/yahoo-backend.c --- freehoo-3.5.3.20100314cvs.orig/src/yahoo-backend.c 2013-02-25 19:15:53.000000000 +0100 +++ freehoo-3.5.3.20100314cvs/src/yahoo-backend.c 2013-02-25 19:20:20.147000000 +0100 @@ -56,7 +56,11 @@ #include #include + +#include +#if SCM_MAJOR_VERSION == 1 #include +#endif #include #include "yahoo-backend.h"