]> git.donarmstrong.com Git - lilypond.git/commitdiff
*** empty log message ***
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Thu, 19 Sep 2002 21:12:44 +0000 (21:12 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Thu, 19 Sep 2002 21:12:44 +0000 (21:12 +0000)
lily/include/lily-guile.hh
lily/input-file-results.cc
lily/lily-guile.cc
lily/my-lily-lexer.cc
ly/init.ly
scm/auto-beam.scm
scm/basic-properties.scm
scm/grob-description.scm
scm/lily.scm
scm/music-functions.scm
scm/output-lib.scm

index 056ca65d6eadc7a075fc9456f3736eeadfddccf2..f311dd250a1e80fe43f606940922bfd3cf7acea4 100644 (file)
@@ -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 \
index 7ceb7b2cfc2ad30660caa75df1fe928dc673858d..718bdcd308acb8c59c7eb06835d0eb0f76c6d47b 100644 (file)
@@ -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;
 }
 
index 680696c938142b0f4f507c590f3949a410b5a589..d7b7bbebace7b29492851438514377a7bfce213e 100644 (file)
@@ -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;
 }
index ebe0302cf8739cd43c434b28d7ded26e67657244..5dcab4430bb88f34893a46cfcbc1cd6c3340c4a0 100644 (file)
@@ -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 ()
index 6bb973c6c95be9b33b74f2f75edb5c33272a43c1..67a55d1bc9875ee8178f2b2b43cb0336ae89afff 100644 (file)
@@ -1,5 +1,5 @@
 % Toplevel initialisation file. 
-
+#(use-modules (lily))
 
 \version "1.5.68"
 
index 88992926cfb0fe56c90b43e3887f020fa7f5b756..0b526a0273210d615ef7a281aa910fa65d2e37b5 100644 (file)
@@ -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))
index b9f2683e46ab8b4ceb06c6998c08f2ec09055241..f70fb195c2afbc2a91becb4b7a1a5273293966da 100644 (file)
@@ -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 
                        '((":|:" . (":|" . "|:"))
                          ("||:" . ("||" . "|:"))
index d3f8f6149f79f5fb8a7d61591336ee20877c9fd4..169118c83214b1580d39cc90ded53c84dcf46e01 100644 (file)
@@ -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
      . (
index 795536e68f48ea9679a8a8de331e109e93735035..e96acb9dccad7e08d67ea942279363562fea2f65 100644 (file)
@@ -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))
index 72f3635608a29caaf610fcc018aa144b930d4e80..f9d0d9da1f8221d2bc66e5ffd40d5e279279d961 100644 (file)
@@ -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 )))
index 9267948f695e853fba46c22898fbf89b329fb27a..8db3a6f1f6ac689a7e20f0ef15f63fa002982ce9 100644 (file)
@@ -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))
 
 
 
-(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))