]> git.donarmstrong.com Git - lilypond.git/commitdiff
Tracker 2025 - move safe utility to separate module to aid Guile V2 migration
authorIan Hulin <ian@hulin.org.uk>
Tue, 8 Nov 2011 12:29:23 +0000 (12:29 +0000)
committerIan Hulin <ian@hulin.org.uk>
Fri, 11 Nov 2011 23:34:23 +0000 (23:34 +0000)
lily.scm (define safe-objects) and (define-macro define-safe-public)
 moved to new scm/safe-utility-defs.scm
new file scm/safe-utility-defs.scm
All other scm files using define-safe-public now have
 (use-modules (scm safe-utility-defs)) call added.
  scm/chord-entry.scm
  scm/define-music-types.scm
  scm/lily-library.scm
  scm/music-functions.scm
  scm/paper.scm

scm/chord-entry.scm
scm/define-music-types.scm
scm/lily-library.scm
scm/lily.scm
scm/music-functions.scm
scm/paper.scm
scm/safe-utility-defs.scm [new file with mode: 0644]

index 06cc077ce4a1395e206f664c3d3406ea48d9f94e..dc0bb85a8c930cce8742407994764e188cea8668 100644 (file)
@@ -15,6 +15,9 @@
 ;;;; You should have received a copy of the GNU General Public License
 ;;;; along with LilyPond.  If not, see <http://www.gnu.org/licenses/>.
 
+; for define-safe-public when byte-compiling using Guile V2
+(use-modules (scm safe-utility-defs))
+
 (define-public (construct-chord-elements root duration modifications)
   "Build a chord on root using modifiers in @var{modifications}.
 @code{NoteEvents} have duration @var{duration}.
index 4085957e032d29178d8b4ccb8bef402d8e843b8c..015a628c535dc6ef4562adc5665435cc9e72f978 100644 (file)
@@ -16,6 +16,9 @@
 ;;;; You should have received a copy of the GNU General Public License
 ;;;; along with LilyPond.  If not, see <http://www.gnu.org/licenses/>.
 
+; for define-safe-public when byte-compiling using Guile V2
+(use-modules (scm safe-utility-defs))
+
 ;; TODO: should link back into user manual.
 
 (define-public music-descriptions
index 5b990e76040d762841280c36d041e6e2c7361b22..97a96d1d3ecfb6b4a5463ba669cccfc0a1a8bc6b 100644 (file)
@@ -19,6 +19,9 @@
 ; for take, drop, take-while, list-index, and find-tail:
 (use-modules (srfi srfi-1))
 
+; for define-safe-public when byte-compiling using Guile V2
+(use-modules (scm safe-utility-defs))
+
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; constants.
 
index 4ab0164850ded4ab48134798b265ba724370c66c..78a7197fcd05295aa64384d29ffa52f6d5cd04e1 100644 (file)
@@ -219,7 +219,8 @@ messages into errors.")
              (srfi srfi-14)
              (scm clip-region)
              (scm memory-trace)
-             (scm coverage))
+             (scm coverage)
+            (scm safe-utility-defs))
 
 (define-public _ gettext)
 ;;; There are new modules defined in Guile V2.0 which we need to use.
@@ -344,27 +345,6 @@ messages into errors.")
                      (fresh-interface!))))
       (set-module-obarray! iface (module-obarray mod))))))
 
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;; Safe definitions utility
-
-(define safe-objects
-  (list))
-
-(define-macro (define-safe-public arglist . body)
-  "Define a variable, export it, and mark it as safe, i.e. usable in
-LilyPond safe mode.  The syntax is the same as `define*-public'."
-  (define (get-symbol arg)
-    (if (pair? arg)
-        (get-symbol (car arg))
-        arg))
-
-  (let ((safe-symbol (get-symbol arglist)))
-    `(begin
-       (define*-public ,arglist
-         ,@body)
-       (set! safe-objects (cons (cons ',safe-symbol ,safe-symbol)
-                                safe-objects))
-       ,safe-symbol)))
 
 (define-safe-public (lilypond-version)
   (string-join
index 5f73038d9118f5554cc1b08156bbf973c5612bea..f18a6507fda396ab1dd34b558e2f7b4328381e51 100644 (file)
@@ -16,6 +16,9 @@
 ;;;; You should have received a copy of the GNU General Public License
 ;;;; along with LilyPond.  If not, see <http://www.gnu.org/licenses/>.
 
+; for define-safe-public when byte-compiling using Guile V2
+(use-modules (scm safe-utility-defs))
+
 ;; (use-modules (ice-9 optargs))
 
 ;;; ly:music-property with setter
index 3208f4b82a90654b9fc5e1a55d0df0366303aa0a..3230c650870830de1d8492dfcc17ab3e1ebbf35f 100644 (file)
@@ -15,6 +15,9 @@
 ;;;; You should have received a copy of the GNU General Public License
 ;;;; along with LilyPond.  If not, see <http://www.gnu.org/licenses/>.
 
+; for define-safe-public when byte-compiling using Guile V2
+(use-modules (scm safe-utility-defs))
+
 (define-public (set-paper-dimension-variables mod)
   (module-define! mod 'dimension-variables
                  '(blot-diameter
diff --git a/scm/safe-utility-defs.scm b/scm/safe-utility-defs.scm
new file mode 100644 (file)
index 0000000..7600c39
--- /dev/null
@@ -0,0 +1,51 @@
+;;;; This file is part of LilyPond, the GNU music typesetter.
+;;;;
+;;;; Copyright (C) 1998--2011 Jan Nieuwenhuizen <janneke@gnu.org>
+;;;; Han-Wen Nienhuys <hanwen@xs4all.nl>
+;;;;
+;;;; LilyPond is free software: you can redistribute it and/or modify
+;;;; it under the terms of the GNU General Public License as published by
+;;;; the Free Software Foundation, either version 3 of the License, or
+;;;; (at your option) any later version.
+;;;;
+;;;; LilyPond is distributed in the hope that it will be useful,
+;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;;;; GNU General Public License for more details.
+;;;;
+;;;; You should have received a copy of the GNU General Public License
+;;;; along with LilyPond.  If not, see <http://www.gnu.org/licenses/>.
+;;;
+;;;      Author Ian Hulin
+;;;      Date   16 October 2011
+;;;
+(define-module (scm safe-utility-defs)
+#:use-module (ice-9 optargs)
+#:export (safe-objects)
+#:export-syntax (define-safe-public)
+#:re-export-syntax (define*-public))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; Safe definitions utility
+
+(define safe-objects
+  (list))
+
+(define (get-symbol arg)
+  (if (pair? arg)
+      (get-symbol (car arg))
+      arg))
+
+
+(define-macro (define-safe-public arglist . body)
+  "Define a variable, export it, and mark it as safe, i.e. usable in
+LilyPond safe mode.  The syntax is the same as `define*-public'."
+
+  (let ((safe-symbol (get-symbol arglist)))
+    `(begin
+       (define*-public ,arglist
+         ,@body)
+       (set! safe-objects (cons (cons ',safe-symbol ,safe-symbol)
+                                safe-objects))
+       ,safe-symbol)))