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] |
Aubrey> You can put both into one file. Put Scheme code into a Aubrey> string and call scm_ldstr(). Here is a code fragment: Aubrey, since Guile diverged from SCM before you introduced scm_ldstr(), we hacked in a way of doing this. The functions gh_eval_str() (if you use the gh_ interface) or scm_eval_0str() (if you use the scm_ interface) will do the same thing in Guile (manual entries below). This once again raises the interesting issue of Guile/SCM divergence for the Guile team. Since Aubrey continues to enhance SCM, it seems like a pity to lose the new features he introduces [for example, his implementation of scm_ldstr() might be more efficient, or whatever]. On the other hand, Guile's goals are different, so there is no current effort to keep the two in synch. ----- File: guile-ref.info, Node: Executing Scheme code, Next: Defining new Scheme procedures in C, Prev: Error messages, Up: Top Executing Scheme code ********************* Once you have an interpreter running, you can ask it to evaluate Scheme code. There are two calls that implement this: - Function: SCM gh_eval_str (char *SCHEME_CODE) This asks the interpreter to evaluate a single string of Scheme code, and returns the result of the last expression evaluated. Note that the line of code in SCHEME_CODE must be a well formed Scheme expression. If you have many lines of code before you balance parentheses, you must either concatenate them into one string, or use `gh_eval_file()'. - Function: SCM gh_eval_file (char *FNAME) Completely analogous to `gh_eval_str()', except that a whole file is evaluated instead of a string. Returns the result of the last expression evaluated.