]> git.donarmstrong.com Git - lilypond.git/commitdiff
small cleanups.
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Fri, 20 Sep 2002 23:45:14 +0000 (23:45 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Fri, 20 Sep 2002 23:45:14 +0000 (23:45 +0000)
ChangeLog
lily/include/ly-modules.hh
lily/lily-guile.cc
lily/ly-module.cc
lily/main.cc
lily/paper-outputter.cc
scm/lily.scm
scripts/ly2dvi.py

index f84ff1a77a4bed4581db6b39c12fa08768063c73..91929ecc0f45c5bdb95151005d354665a7a0e788 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,10 @@
+2002-09-21  Han-Wen Nienhuys  <hanwen@cs.uu.nl>
+
+       * lily/main.cc: small cleanups.
+
 2002-09-20  Han-Wen Nienhuys  <hanwen@cs.uu.nl>
 
-       * lily/ly-module.cc: new file.
+       * lily/ly-module.{cc,hh}: new file.
 
 2002-09-17  Rune Zedeler  <rune@zedeler.dk>
 
index a96d0a13b0f49ae890e0abd948e73e7c447bcc5c..30a501b5bc5f3f68021f96d4548ab8b8eb5b37b6 100644 (file)
 #ifndef LY_MODULES_HH
 #define LY_MODULES_HH
 
+#include "lily-guile.hh"
+
 SCM ly_make_anonymous_module ();
 void ly_copy_module_variables (SCM dest, SCM src);
 SCM ly_module_to_alist (SCM mod);
 SCM ly_module_lookup (SCM module, SCM sym);
 SCM ly_module_symbols (SCM mod);
 void  ly_reexport_module (SCM mod);
+inline bool ly_module_p (SCM x) { return SCM_MODULEP(x); }
 
 #endif /* LY_MODULES_HH */
 
index 5f483c4fc737f195cc9ac19bcf7f6d63d70e6a52..4c1836df82c46f9cbd37ef897b95273ef98bdb65 100644 (file)
@@ -210,6 +210,7 @@ void
 ly_init_guile ()
 {
   lily_module = scm_c_define_module ("lily", ly_init_ly_module, 0);
+  scm_c_use_module ("lily");
 }
 
 unsigned int ly_scm_hash (SCM s)
index 632ea229f403c41864d11dc4a49caa269fc530b9..e6610e28be26319952be01497dec72a12440f26a 100644 (file)
@@ -10,6 +10,7 @@ source file of the GNU LilyPond music typesetter
 #include "string.hh"
 #include "lily-guile.hh"
 #include "ly-modules.hh"
+#define FUNC_NAME __FUNCTION__
 
 static int module_count;
 
@@ -30,6 +31,9 @@ ly_make_anonymous_module ()
 void
 ly_copy_module_variables (SCM dest, SCM src)
 {
+ #define FUNC_NAME __FUNCTION__
+  SCM_VALIDATE_MODULE (1, src);
+
   SCM obarr= SCM_MODULE_OBARRAY(src);
   SCM syms = SCM_EOL;
 
@@ -46,6 +50,8 @@ ly_copy_module_variables (SCM dest, SCM src)
 SCM
 ly_module_symbols (SCM mod)
 {
+  SCM_VALIDATE_MODULE (1, mod);
+  
   SCM obarr= SCM_MODULE_OBARRAY(mod);
   SCM syms = SCM_EOL;
 
@@ -65,6 +71,9 @@ ly_module_symbols (SCM mod)
 SCM
 ly_module_to_alist (SCM mod)
 {
+  SCM_VALIDATE_MODULE (1, mod);
+  
+  
   SCM obarr= SCM_MODULE_OBARRAY(mod);
   SCM alist = SCM_EOL;
 
@@ -86,12 +95,10 @@ ly_module_to_alist (SCM mod)
 SCM
 ly_module_lookup (SCM module, SCM sym)
 {
-  SCM var;
 #define FUNC_NAME __FUNCTION__
   SCM_VALIDATE_MODULE (1, module);
 
-  var = scm_sym2var (sym, scm_module_lookup_closure (module), SCM_BOOL_F);
-  return var;
+  return scm_sym2var (sym, scm_module_lookup_closure (module), SCM_BOOL_F);
 }
 
 SCM export_function ;
index dd856b5a810d78b748a851e8fde2f1374409c208..573409e831c6883bed669034d85281d71b440a68 100644 (file)
@@ -222,7 +222,7 @@ notice ()
 /* Where LilyPond's init files live.  Typically:
    LILYPOND_DATADIR = /usr/local/share/lilypond
    LOCAL_LILYPOND_DATADIR = /usr/local/share/lilypond/1.5.68 */
-char const *prefix_directory[2] = {LILYPOND_DATADIR, LOCAL_LILYPOND_DATADIR};
+char const *prefix_directory[] = {LILYPOND_DATADIR, LOCAL_LILYPOND_DATADIR, 0};
 
 void
 setup_paths ()
@@ -258,8 +258,7 @@ setup_paths ()
      LILYPONDPREFIX to lilypond-x.y.z */
   char *suffixes[] = {"ly", "afm", "mf/out", "scm", "tfm", "ps", 0};
 
-  for (unsigned i = 0; i < sizeof (prefix_directory)
-        / sizeof (*prefix_directory); i++)
+  for (unsigned i = 0; prefix_directory[i]; i++)
     for (char **s = suffixes; *s; s++)
       {
        String p = prefix_directory[i] + to_string ('/') + String (*s);
@@ -329,10 +328,10 @@ main_prog (void *, int, char **)
   /* Engravers use lily.scm contents, need to make Guile find it.
      Prepend onto GUILE %load-path, very ugh. */
      
-  for (unsigned i = 0; i < sizeof (prefix_directory)
-        / sizeof (*prefix_directory); i++)
+  for (unsigned i = 0; prefix_directory[i]; i++)
     {
       prepend_load_path (prefix_directory[i]);
+
       /* Junk this.  We should make real modules iso. just loading files. */
       prepend_load_path (String (prefix_directory[i]) + "/scm");
     }
index e914793377f41f66f38123d3a76938d8aec8baf1..76c21ce2ae2d89cef8d85b62ad42417166df1b48 100644 (file)
@@ -177,8 +177,8 @@ Paper_outputter::write_header_field_to_file (String filename, SCM key, SCM value
 void
 Paper_outputter::write_header_fields_to_file (SCM mod)
 {
-  
-  if (dump_header_fieldnames_global.size ())
+  if (ly_module_p (mod)&&
+      dump_header_fieldnames_global.size ())
     {
       SCM fields = ly_module_to_alist (mod);
       for (int i = 0; i < dump_header_fieldnames_global.size (); i++)
index c5e67c2e2002ceeffde59e60d738ef712973d4b8..8c53b13cceca776ed18841ae9afe9dc0ebafe3bb 100644 (file)
 
 (define-public security-paranoia #f)
 
-(define (line-column-location line col file)
+(define-public (line-column-location line col file)
   "Print an input location, including column number ."
   (string-append (number->string line) ":"
                 (number->string col) " " file)
   )
 
-(define (line-location line col file)
+(define-public (line-location line col file)
   "Print an input location, without column number ."
   (string-append (number->string line) " " file)
   )
index 1dfae0331396132ae7dca6d51b624bc4a29bcc59..de3f99cd1f811d31b8289d3d7277b93ad26e6864 100644 (file)
@@ -334,6 +334,8 @@ pseudo_filter_p = 0
 latex_cmd = 'latex'
 tex_extension = '.tex'
 pdftex_p = 0
+binary = 'lilypond'
+#binary = 'valgrind --suppressions=%(home)s/usr/src/guile-1.6.supp --num-callers=10 %(home)s/usr/src/lilypond/lily/out/lilypond '% { 'home' : '/home/hanwen' }
 
 help_summary = _ ("Run LilyPond using LaTeX for titling")
 
@@ -503,7 +505,7 @@ def run_lilypond (files, dep_prefix):
                # for better debugging!
                print_environment ()
 
-       cmd = 'lilypond %s %s ' % (opts, fs)
+       cmd = '%s %s %s ' % (binary, opts, fs)
        if  verbose_p:
                progress ("Invoking `%s'"% cmd)
        status = os.system (cmd)