From: Han-Wen Nienhuys Date: Fri, 20 Sep 2002 23:45:14 +0000 (+0000) Subject: small cleanups. X-Git-Tag: release/1.7.0~5 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=ba78ea60faa3ab5228ec2dffbc3807b0e47ab8cf;p=lilypond.git small cleanups. --- diff --git a/ChangeLog b/ChangeLog index f84ff1a77a..91929ecc0f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,10 @@ +2002-09-21 Han-Wen Nienhuys + + * lily/main.cc: small cleanups. + 2002-09-20 Han-Wen Nienhuys - * lily/ly-module.cc: new file. + * lily/ly-module.{cc,hh}: new file. 2002-09-17 Rune Zedeler diff --git a/lily/include/ly-modules.hh b/lily/include/ly-modules.hh index a96d0a13b0..30a501b5bc 100644 --- a/lily/include/ly-modules.hh +++ b/lily/include/ly-modules.hh @@ -10,12 +10,15 @@ #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 */ diff --git a/lily/lily-guile.cc b/lily/lily-guile.cc index 5f483c4fc7..4c1836df82 100644 --- a/lily/lily-guile.cc +++ b/lily/lily-guile.cc @@ -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) diff --git a/lily/ly-module.cc b/lily/ly-module.cc index 632ea229f4..e6610e28be 100644 --- a/lily/ly-module.cc +++ b/lily/ly-module.cc @@ -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 ; diff --git a/lily/main.cc b/lily/main.cc index dd856b5a81..573409e831 100644 --- a/lily/main.cc +++ b/lily/main.cc @@ -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"); } diff --git a/lily/paper-outputter.cc b/lily/paper-outputter.cc index e914793377..76c21ce2ae 100644 --- a/lily/paper-outputter.cc +++ b/lily/paper-outputter.cc @@ -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++) diff --git a/scm/lily.scm b/scm/lily.scm index c5e67c2e20..8c53b13cce 100644 --- a/scm/lily.scm +++ b/scm/lily.scm @@ -27,13 +27,13 @@ (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) ) diff --git a/scripts/ly2dvi.py b/scripts/ly2dvi.py index 1dfae03313..de3f99cd1f 100644 --- a/scripts/ly2dvi.py +++ b/scripts/ly2dvi.py @@ -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)