From: Han-Wen Nienhuys Date: Thu, 19 Sep 2002 21:12:44 +0000 (+0000) Subject: *** empty log message *** X-Git-Tag: release/1.7.0~7 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=fd8ed70c80d71a3bc6e0e62cc86a3659e23eb0a2;p=lilypond.git *** empty log message *** --- diff --git a/lily/include/lily-guile.hh b/lily/include/lily-guile.hh index 056ca65d6e..f311dd250a 100644 --- a/lily/include/lily-guile.hh +++ b/lily/include/lily-guile.hh @@ -262,6 +262,7 @@ TYPE ## _ ## FUNC ## _init_functions () \ { \ TYPE :: FUNC ## _proc = gh_new_procedure ## ARGCOUNT ## _0 (#TYPE "::" #FUNC, \ ((Scheme_function_ ## ARGCOUNT)TYPE :: FUNC)); \ + scm_c_export (#TYPE "::" #FUNC, NULL);\ } \ \ ADD_SCM_INIT_FUNC (TYPE ## _ ## FUNC ## _callback, TYPE ## _ ## FUNC ## _init_functions); \ @@ -289,6 +290,7 @@ INITPREFIX ## init ()\ FNAME ## _proc \ = scm_c_define_gsubr (PRIMNAME,REQ, OPT, VAR, (Scheme_function_unknown) FNAME);\ ly_add_function_documentation (PRIMNAME, #ARGLIST, DOCSTRING);\ + scm_c_export (PRIMNAME,NULL);\ }\ ADD_SCM_INIT_FUNC (INITPREFIX ## init_unique_prefix, INITPREFIX ## init);\ SCM \ diff --git a/lily/input-file-results.cc b/lily/input-file-results.cc index 7ceb7b2cfc..718bdcd308 100644 --- a/lily/input-file-results.cc +++ b/lily/input-file-results.cc @@ -47,13 +47,8 @@ argument is a symbol. Possible options are @code{none} (no source specials), else if (what == ly_symbol2scm ("line")) val = gh_eval_str ("line-location"); - /* - UGH. - - How do you do set! from C ? - */ - scm_primitive_eval (scm_list_n (ly_symbol2scm ("set!"), - ly_symbol2scm ("point-and-click"), val, SCM_UNDEFINED)); + extern SCM lily_module; + scm_module_define (lily_module, ly_symbol2scm ("point-and-click"), val); return SCM_UNSPECIFIED; } diff --git a/lily/lily-guile.cc b/lily/lily-guile.cc index 680696c938..d7b7bbebac 100644 --- a/lily/lily-guile.cc +++ b/lily/lily-guile.cc @@ -193,25 +193,33 @@ void add_scm_init_func (void (*f) ()) scm_init_funcs_->push (f); } +#if 0 +SCM +ly_use_module (SCM module) +{ + scm_call_1 (SCM_VARIABLE_REF (process_use_modules_var), + scm_list_1 (scm_list_1 (convert_module_name (name)))); + return SCM_UNSPECIFIED; +} +#endif void -ly_init_guile () +ly_init_ly_module (void *data) { - SCM last_mod = scm_current_module (); - scm_set_current_module (scm_c_resolve_module ("lily")); - - scm_c_use_module ("guile"); - for (int i=scm_init_funcs_->size () ; i--;) (scm_init_funcs_->elem (i)) (); if (verbose_global_b) progress_indication ("\n"); - - scm_primitive_load_path (scm_makfrom0str ("lily.scm")); +} + +SCM lily_module ; - scm_set_current_module (last_mod); +void +ly_init_guile () +{ + lily_module = scm_c_define_module ("lily", ly_init_ly_module, 0); } unsigned int ly_scm_hash (SCM s) @@ -708,12 +716,17 @@ robust_list_ref(int i, SCM l) static int module_count; +void +ly_init_anonymous_module (void * data) +{ + scm_c_use_module ("lily"); +} + SCM ly_make_anonymous_module () { String s = "*anonymous-ly-" + to_string (module_count++) + "*"; - SCM mod = scm_c_resolve_module (s.to_str0()); - + SCM mod = scm_c_define_module (s.to_str0(), ly_init_anonymous_module, 0); scm_module_define (mod, ly_symbol2scm ("symbols-defined-here"), SCM_EOL); return mod; } diff --git a/lily/my-lily-lexer.cc b/lily/my-lily-lexer.cc index ebe0302cf8..5dcab4430b 100644 --- a/lily/my-lily-lexer.cc +++ b/lily/my-lily-lexer.cc @@ -109,7 +109,18 @@ void My_lily_lexer::add_scope (SCM module) { scm_set_current_module (module); + for (SCM s = scopes_; gh_pair_p (s); s = gh_cdr (s)) + { + SCM expr = scm_list_n (ly_symbol2scm ("module-use!"), + module, scm_list_n (ly_symbol2scm ("module-public-interface"), + gh_car (s), SCM_UNDEFINED), + SCM_UNDEFINED); + + scm_primitive_eval(expr); + } + scopes_ = scm_cons (module, scopes_); + scm_display (scm_current_module(), scm_current_output_port()); } SCM @@ -168,6 +179,7 @@ My_lily_lexer::set_identifier (SCM name, SCM s) scm_variable_set_x (var, gh_cons (sym, scm_variable_ref (var))); scm_module_define (mod, sym, s); + scm_c_export (ly_symbol2string(sym).to_str0(), NULL); } My_lily_lexer::~My_lily_lexer () diff --git a/ly/init.ly b/ly/init.ly index 6bb973c6c9..67a55d1bc9 100644 --- a/ly/init.ly +++ b/ly/init.ly @@ -1,5 +1,5 @@ % Toplevel initialisation file. - +#(use-modules (lily)) \version "1.5.68" diff --git a/scm/auto-beam.scm b/scm/auto-beam.scm index 88992926cf..0b526a0273 100644 --- a/scm/auto-beam.scm +++ b/scm/auto-beam.scm @@ -28,7 +28,7 @@ ;;; end beams with 16th notes each 1 4 note ;;; end beams with 32th notes each 1 8 note -(define auto-beam-settings +(define-public auto-beam-settings `( ((end * * 3 2) . ,(make-moment 1 2)) ((end 1 16 3 2) . ,(make-moment 1 4)) diff --git a/scm/basic-properties.scm b/scm/basic-properties.scm index b9f2683e46..f70fb195c2 100644 --- a/scm/basic-properties.scm +++ b/scm/basic-properties.scm @@ -1,13 +1,14 @@ ; Definition of backend properties (aka. element properties). ;; See documentation of Item::visibility_lambda_ -(define (begin-of-line-visible d) (if (= d 1) '(#f . #f) '(#t . #t))) -(define (end-of-line-visible d) (if (= d -1) '(#f . #f) '(#t . #t))) -(define (spanbar-begin-of-line-invisible d) (if (= d -1) '(#t . #t) '(#f . #f))) -(define (all-visible d) '(#f . #f)) -(define (all-invisible d) '(#t . #t)) -(define (begin-of-line-invisible d) (if (= d 1) '(#t . #t) '(#f . #f))) -(define (end-of-line-invisible d) (if (= d -1) '(#t . #t) '(#f . #f))) +(define-public (begin-of-line-visible d) (if (= d 1) '(#f . #f) '(#t . #t))) +(define-public (end-of-line-visible d) (if (= d -1) '(#f . #f) '(#t . #t))) +(define-public (spanbar-begin-of-line-invisible d) (if (= d -1) '(#t . #t) '(#f . #f))) + +(define-public (all-visible d) '(#f . #f)) +(define-public (all-invisible d) '(#t . #t)) +(define-public (begin-of-line-invisible d) (if (= d 1) '(#t . #t) '(#f . #f))) +(define-public (end-of-line-invisible d) (if (= d -1) '(#t . #t) '(#f . #f))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -18,7 +19,7 @@ ; How should a bar line behave at a break? ; ;; Why prepend `default-' to every scm identifier? -(define (default-break-barline glyph dir) +(define-public (default-break-barline glyph dir) (let ((result (assoc glyph '((":|:" . (":|" . "|:")) ("||:" . ("||" . "|:")) diff --git a/scm/grob-description.scm b/scm/grob-description.scm index d3f8f6149f..169118c832 100644 --- a/scm/grob-description.scm +++ b/scm/grob-description.scm @@ -12,7 +12,7 @@ ;;;; WARNING: don't use anonymous functions for initialization. ;; TODO: junk the meta field in favor of something more compact? -(define all-grob-descriptions +(define-public all-grob-descriptions `( (Accidental . ( diff --git a/scm/lily.scm b/scm/lily.scm index 795536e68f..e96acb9dcc 100644 --- a/scm/lily.scm +++ b/scm/lily.scm @@ -7,8 +7,13 @@ ;;; Library functions +; (top-repl) + (use-modules (ice-9 regex)) +; (use-modules (lily)) +(display "hallo\n") +;;(display (make-duration 1 2)) ;;(write standalone (current-error-port)) @@ -40,7 +45,7 @@ (define ifdef "First run this through cpp.") (define ifndef "First run this through cpp.") -(define default-script-alist '()) +(define-public default-script-alist '()) (define font-name-alist '()) (if (not (defined? 'standalone)) diff --git a/scm/music-functions.scm b/scm/music-functions.scm index 72f3635608..f9d0d9da1f 100644 --- a/scm/music-functions.scm +++ b/scm/music-functions.scm @@ -1,8 +1,8 @@ -(define (denominator-tuplet-formatter mus) +(define-public (denominator-tuplet-formatter mus) (number->string (ly-get-mus-property mus 'denominator))) -(define (fraction-tuplet-formatter mus) +(define-public (fraction-tuplet-formatter mus) (string-append (number->string (ly-get-mus-property mus 'numerator)) ":" (number->string (ly-get-mus-property mus 'denominator)) @@ -10,7 +10,7 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -(define (shift-duration-log music shift dot) +(define-public (shift-duration-log music shift dot) "Recurse through music, adding SHIFT to duration-log and optionally a dot to any note encountered. This scales the music up by a factor 2^shift * (2 - (1/2)^dot)" @@ -47,7 +47,7 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -(define (unfold-repeats music) +(define-public (unfold-repeats music) " This function replaces all repeats with unfold repeats. It was written by Rune Zedeler. " @@ -188,11 +188,13 @@ this is not an override (ly-set-mus-property! m 'elements elts) m )) + (define (make-simultaneous-music elts) (let* ((m (ly-make-music "Simultaneous_music"))) (ly-set-mus-property! m 'elements elts) m )) + (define (music-separator? m) "Is M a separator." (let* ((n (ly-get-mus-property m 'name ))) diff --git a/scm/output-lib.scm b/scm/output-lib.scm index 9267948f69..8db3a6f1f6 100644 --- a/scm/output-lib.scm +++ b/scm/output-lib.scm @@ -14,7 +14,7 @@ ; The TabNoteHead molecule callback. ; Create a text molecule -(define (tablature-molecule-callback grob) +(define-public (tablature-molecule-callback grob) (let ((molecule (fontify-text (ly-get-default-font grob) (ly-get-grob-property grob 'text) @@ -25,7 +25,7 @@ ; The TabNoteHead tablatureFormat callback. ; Compute the text grob-property -(define (fret-number-tablature-format string tuning pitch) +(define-public (fret-number-tablature-format string tuning pitch) (number->string (- (pitch-semitones pitch) (list-ref tuning @@ -35,7 +35,7 @@ ) ) -(define (hammer-molecule-callback grob) +(define-public (hammer-molecule-callback grob) (let* ((note-collums (ly-get-grob-property grob 'note-columns)) (note-column1 (cadr note-collums)) (note-column2 (car note-collums)) @@ -66,12 +66,12 @@ -(define guitar-tunings '(4 -1 -5 -10 -15 -20)) +(define-public guitar-tunings '(4 -1 -5 -10 -15 -20)) ; end of tablature functions -(define (make-molecule-boxer line-thick x-padding y-padding callback) +(define-public (make-molecule-boxer line-thick x-padding y-padding callback) "Makes a routine that adds a box around the grob parsed as argument" (define (molecule-boxer grob) (let* @@ -224,4 +224,4 @@ centered, X==1 is at the right, X == -1 is at the left." (define ((every-nth-bar-number-visible n) barnum) (= 0 (modulo barnum n))) -(define (default-bar-number-visibility barnum) (> barnum 1)) +(define-public (default-bar-number-visibility barnum) (> barnum 1))