This is the mail archive of the guile@cygnus.com mailing list for the guile project.
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
unfortunately, it looks like `gh_eval_file()' uses
`scm_primitive_load()', guts excerpted:
: {
: SCM form, port;
: port = scm_open_file (filename,
: scm_makfromstr ("r", (scm_sizet) sizeof (char), 0));
: while (1)
: {
: form = scm_read (port);
: if (SCM_EOF_OBJECT_P (form))
: break;
: scm_eval_x (form); /* <-- return value lost */
: }
: scm_close_port (port);
: }
: return SCM_UNSPECIFIED;
the value of the evaluated form is lost. you can probably save that
value and return it. i wonder why this is not the default? (is this
related to the "strong differences in opinion among implementors"
alluded to in the guile-ref Info-page?
anyway, in case anyone is interested, a patch to libguile/load.c
follows.
regards,
thi
------------------------------------------------------------------------------
*** load.c~ Fri Oct 24 23:53:10 1997
--- load.c Thu Feb 12 16:01:23 1998
***************
*** 74,79 ****
--- 74,80 ----
scm_primitive_load (filename)
SCM filename;
{
+ SCM retval = SCM_UNSPECIFIED;
SCM hook = *scm_loc_load_hook;
SCM_ASSERT (SCM_NIMP (filename) && SCM_ROSTRINGP (filename), filename,
SCM_ARG1, s_primitive_load);
***************
*** 94,104 ****
form = scm_read (port);
if (SCM_EOF_OBJECT_P (form))
break;
! scm_eval_x (form);
}
scm_close_port (port);
}
! return SCM_UNSPECIFIED;
}
--- 95,105 ----
form = scm_read (port);
if (SCM_EOF_OBJECT_P (form))
break;
! retval = scm_eval_x (form);
}
scm_close_port (port);
}
! return retval;
}