/[guile]/guile/guile-core/libguile/strports.c
ViewVC logotype

Diff of /guile/guile-core/libguile/strports.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.92 by hanwen, Thu Aug 8 23:02:28 2002 UTC revision 1.93 by mvo, Tue Aug 13 20:54:12 2002 UTC
# Line 440  scm_c_eval_string (const char *expr) Line 440  scm_c_eval_string (const char *expr)
440    return scm_eval_string (scm_makfrom0str (expr));    return scm_eval_string (scm_makfrom0str (expr));
441  }  }
442    
443    SCM
444    scm_c_eval_string_in_module (const char *expr, SCM module)
445    {
446      return scm_eval_string_in_module (scm_makfrom0str (expr), module);
447    }
448    
449    
450  static SCM  static SCM
451  inner_eval_string (void *data)  inner_eval_string (void *data)
452  {  {
# Line 459  inner_eval_string (void *data) Line 466  inner_eval_string (void *data)
466    return ans;    return ans;
467  }  }
468    
469  SCM_DEFINE (scm_eval_string, "eval-string", 1, 0, 0,  SCM_DEFINE (scm_eval_string_in_module, "eval-string", 1, 1, 0,
470              (SCM string),              (SCM string, SCM module),
471              "Evaluate @var{string} as the text representation of a Scheme\n"              "Evaluate @var{string} as the text representation of a Scheme\n"
472              "form or forms, and return whatever value they produce.\n"              "form or forms, and return whatever value they produce.\n"
473              "Evaluation takes place in the environment returned by the\n"              "Evaluation takes place in the given module, or the current\n"
474              "procedure @code{interaction-environment}.")              "module when no module is given.\n"
475  #define FUNC_NAME s_scm_eval_string              "While the code is evaluated, the given module is made the\n"
476                "current one.  The current module is restored when this\n"
477                "procedure returns.")
478    #define FUNC_NAME s_scm_eval_string_in_module
479  {  {
480    SCM port = scm_mkstrport (SCM_INUM0, string, SCM_OPN | SCM_RDNG,    SCM port = scm_mkstrport (SCM_INUM0, string, SCM_OPN | SCM_RDNG,
481                              "eval-string");                              FUNC_NAME);
482    return scm_c_call_with_current_module (scm_interaction_environment (),    if (SCM_UNBNDP (module))
483        module = scm_current_module ();
484      return scm_c_call_with_current_module (module,
485                                           inner_eval_string, (void *)port);                                           inner_eval_string, (void *)port);
486  }  }
487  #undef FUNC_NAME  #undef FUNC_NAME
488    
489    SCM
490    scm_eval_string (SCM string)
491    {
492      return scm_eval_string_in_module (string, SCM_UNDEFINED);
493    }
494    
495  static scm_t_bits  static scm_t_bits
496  scm_make_stptob ()  scm_make_stptob ()
497  {  {

Legend:
Removed from v.1.92  
changed lines
  Added in v.1.93

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26