]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/parse-scm.cc
* lily/modified-font-metric.cc (text_dimension): try
[lilypond.git] / lily / parse-scm.cc
index 5189f3247915697961a6f5a22e61fabbc8c59180..2f55783edf46ddfdf70a6bd372b1b6ce364b9d21 100644 (file)
@@ -6,15 +6,13 @@
   (c) 2004 Han-Wen Nienhuys <hanwen@cs.uu.nl>
 */
 
+#include "parse-scm.hh"
 
-#include <stdio.h>
+#include <cstdio>
 
 #include "ly-module.hh"
-#include "lily-guile.hh"
 #include "main.hh"
 #include "paper-book.hh"
-#include "parse-scm.hh"
-#include "string.hh"
 #include "source-file.hh"
 
 /* Pass string to scm parser, evaluate one expression.
@@ -24,7 +22,7 @@
 SCM
 internal_ly_parse_scm (Parse_start * ps)
 {
-  Source_file *sf =ps->start_location_.source_file_;
+  Source_file *sf = ps->start_location_.source_file_;
   SCM port = sf->get_port ();
 
   int off = ps->start_location_.defined_str0_ - sf->to_str0 ();
@@ -38,9 +36,16 @@ internal_ly_parse_scm (Parse_start * ps)
   /* Read expression from port.  */
   if (!SCM_EOF_OBJECT_P (form = scm_read (port)))
     {
-      SCM function = ly_scheme_function ("make-safe-lilypond-module");
       if (ps->safe_)
-       answer = scm_eval (form, function);
+       {
+         static SCM module = SCM_BOOL_F;
+         if (module == SCM_BOOL_F)
+           {
+             SCM function = ly_lily_module_constant ("make-safe-lilypond-module");
+             module = scm_call_0 (function);
+           }
+         answer = scm_eval (form, module);
+       }
       else
        answer = scm_primitive_eval (form);
     }
@@ -77,7 +82,7 @@ parse_handler (void *data, SCM tag, SCM args)
   ps->start_location_.error (_("GUILE signaled an error for the expression beginning here"));
 
   if (scm_ilength (args) > 2)
-    scm_display_error_message (ly_cadr (args), ly_caddr (args), scm_current_error_port ());
+    scm_display_error_message (scm_cadr (args), scm_caddr (args), scm_current_error_port ());
 
   /*
     The following is a kludge; we should probably search for