From: janneke <janneke>
Date: Sun, 14 Mar 2004 22:37:19 +0000 (+0000)
Subject: * lily/parse-scm.cc (internal_ly_parse_scm)[PAGE_LAYOUT]: Import
X-Git-Tag: release/2.1.36~110
X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=ec026aff7784e38f00ed7c37967268e50c97abd1;p=lilypond.git

* lily/parse-scm.cc (internal_ly_parse_scm)[PAGE_LAYOUT]: Import
lily functions in safe mode.

* lily/paper-outputter.cc (Paper_outputter): Eval output-ps in
safe mode.
---

diff --git a/ChangeLog b/ChangeLog
index dbef003a20..509fa53e1b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2004-03-14  Jan Nieuwenhuizen  <janneke@gnu.org>
 
+	* lily/parse-scm.cc (internal_ly_parse_scm)[PAGE_LAYOUT]: Import
+	lily functions in safe mode.
+
 	* scripts/lilypond-book.py (Lilypond_snippet.output_texinfo):
 	Print filename for HTML, LATEX, before texidoc.
 
@@ -8,8 +11,8 @@
 
 	* scm/lily.scm: Do not load output-ps module.
 
-	* lily/paper-outputter.cc (Paper_outputter): Attempt to eval
-	output-ps in safe mode.
+	* lily/paper-outputter.cc (Paper_outputter): Eval output-ps in
+	safe mode.
 
 2004-03-14  Han-Wen Nienhuys   <hanwen@xs4all.nl>
 
diff --git a/lily/lily-guile.cc b/lily/lily-guile.cc
index 4b2584fc3c..ecde4495f2 100644
--- a/lily/lily-guile.cc
+++ b/lily/lily-guile.cc
@@ -102,10 +102,10 @@ gulp_file_to_string (String fn)
   return result;
 }
 
-LY_DEFINE (ly_gulp_file, "ly:gulp-file", 1,0, 0,
-	  (SCM name),
-	  "Read the file @var{name}, and return its contents in a string. The "
-" file is looked up using the search path.")
+LY_DEFINE (ly_gulp_file, "ly:gulp-file",
+	   1, 0, 0, (SCM name),
+	  "Read the file @var{name}, and return its contents in a string.  "
+	   "The file is looked up using the search path.")
 {
   return scm_makfrom0str (gulp_file_to_string (ly_scm2string (name)).to_str0 ());
 }
diff --git a/lily/paper-outputter.cc b/lily/paper-outputter.cc
index 134b19bc4c..0f88314df8 100644
--- a/lily/paper-outputter.cc
+++ b/lily/paper-outputter.cc
@@ -53,6 +53,7 @@ Paper_outputter::Paper_outputter (String name)
       else
 	output_module_ = scm_c_resolve_module (name.to_str0 ());
 
+      /* FIXME: output-lib should be module, that can be imported.  */
 #define IMPORT_LESS 1 // only import the list of IMPORTS
 #if IMPORT_LESS
       scm_c_use_module ("lily");
@@ -64,10 +65,12 @@ Paper_outputter::Paper_outputter (String name)
 	"ly:output-def-scope",
 	"ly:gulp-file",
 	"ly:number->string",
-	"assoc-get",
-	"number-pair->string",
-	"inexact->string",
+	
+	"number-pair->string",       /* output-lib.scm */
 	"numbers->string",
+	
+	"assoc-get",
+	"inexact->string",           /* insecure guile? */
 #if IMPORT_LESS	
 	"string-index",              /* from srfi srfi-13 */
 	"regexp-substitute/global",  /* from (ice9 regex) */
diff --git a/lily/parse-scm.cc b/lily/parse-scm.cc
index a5de3e9866..255d5c03f9 100644
--- a/lily/parse-scm.cc
+++ b/lily/parse-scm.cc
@@ -1,5 +1,6 @@
 #include <stdio.h>
 
+#include "ly-module.hh"
 #include "lily-guile.hh"
 #include "parse-scm.hh"
 #include "string.hh"
@@ -30,7 +31,11 @@ internal_ly_parse_scm (Parse_start * ps, bool safe)
 	{
 	  static SCM safe_module;
 	  if (!safe_module)
-	    safe_module = scm_primitive_eval (ly_symbol2scm ("safe-module"));
+	    {
+	      safe_module = scm_primitive_eval (ly_symbol2scm ("safe-module"));
+	      if (output_format_global == PAGE_LAYOUT)
+		ly_import_module (safe_module, scm_c_resolve_module ("lily"));
+	    }
 	  answer = scm_eval (form, safe_module);
 	}
       else