CVSROOT: /cvsroot/lilypond Module name: lilypond Branch: Changes by: Han-Wen Nienhuys <[EMAIL PROTECTED]> 05/08/01 20:15:10
Modified files: . : ChangeLog lily : GNUmakefile ly-module.cc spacing-spanner.cc lily/include : ly-module.hh Added files: lily : module-scheme.cc Log message: (LY_DEFINE): new file. CVSWeb URLs: http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/ChangeLog.diff?tr1=1.3939&tr2=1.3940&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/lily/module-scheme.cc?rev=1.1 http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/lily/GNUmakefile.diff?tr1=1.56&tr2=1.57&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/lily/ly-module.cc.diff?tr1=1.45&tr2=1.46&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/lily/spacing-spanner.cc.diff?tr1=1.143&tr2=1.144&r1=text&r2=text http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/lily/include/ly-module.hh.diff?tr1=1.13&tr2=1.14&r1=text&r2=text Patches: Index: lilypond/ChangeLog diff -u lilypond/ChangeLog:1.3939 lilypond/ChangeLog:1.3940 --- lilypond/ChangeLog:1.3939 Mon Aug 1 11:31:09 2005 +++ lilypond/ChangeLog Mon Aug 1 20:15:09 2005 @@ -1,5 +1,7 @@ 2005-08-01 Han-Wen Nienhuys <[EMAIL PROTECTED]> + * lily/module-scheme.cc (LY_DEFINE): new file. + * Documentation/user/advanced-notation.itely (Font selection): add doco for make-pango-font-tree. Index: lilypond/lily/GNUmakefile diff -u lilypond/lily/GNUmakefile:1.56 lilypond/lily/GNUmakefile:1.57 --- lilypond/lily/GNUmakefile:1.56 Tue Jul 19 12:57:33 2005 +++ lilypond/lily/GNUmakefile Mon Aug 1 20:15:09 2005 @@ -54,7 +54,8 @@ default: -$(outdir)/libstdc++.a: +$(outdir)/libstdc++.a: + rm -f $@ ln -s `$(CXX) -print-file-name=libstdc++.a` $(outdir)/ ifeq ($(LINK_GXX_STATICALLY),yes) Index: lilypond/lily/include/ly-module.hh diff -u lilypond/lily/include/ly-module.hh:1.13 lilypond/lily/include/ly-module.hh:1.14 --- lilypond/lily/include/ly-module.hh:1.13 Mon Jul 25 11:21:55 2005 +++ lilypond/lily/include/ly-module.hh Mon Aug 1 20:15:09 2005 @@ -21,5 +21,8 @@ SCM ly_clear_anonymous_modules (); SCM ly_use_module (SCM mod, SCM used); +/* Ugh signature of scm_internal_hash_fold () is inaccurate. */ +typedef SCM (*Hash_closure_function) (); + #endif /* LY_MODULE_HH */ Index: lilypond/lily/ly-module.cc diff -u lilypond/lily/ly-module.cc:1.45 lilypond/lily/ly-module.cc:1.46 --- lilypond/lily/ly-module.cc:1.45 Mon Jul 25 13:24:05 2005 +++ lilypond/lily/ly-module.cc Mon Aug 1 20:15:09 2005 @@ -18,16 +18,10 @@ Protected_scm anonymous_modules = SCM_EOL; #endif -#define FUNC_NAME __FUNCTION__ - -LY_DEFINE(ly_clear_anonymous_modules, "ly:clear-anonymous-modules", - 0, 0, 0, (), - "Plug a GUILE 1.6 and 1.7 memory leak by breaking a weak reference " - "pointer cycle explicitly." - ) +void +clear_anonymous_modules () { -#ifdef MODULE_GC_KLUDGE for (SCM s = anonymous_modules; scm_is_pair (s); s = scm_cdr (s)) @@ -44,9 +38,6 @@ } anonymous_modules = SCM_EOL; -#endif - - return SCM_UNSPECIFIED; } SCM @@ -93,33 +84,7 @@ #define FUNC_NAME __FUNCTION__ -static SCM -module_define_closure_func (void *closure, SCM key, SCM val, SCM result) -{ - (void) result; - SCM module = (SCM) closure; - if (scm_variable_bound_p (val) == SCM_BOOL_T) - scm_module_define (module, key, scm_variable_ref (val)); - return SCM_EOL; -} -/* Ugh signature of scm_internal_hash_fold () is inaccurate. */ -typedef SCM (*Hash_cl_func) (); - -/* - If a variable in changed in SRC, we DEST doesn't see the - definitions. -*/ -LY_DEFINE (ly_module_copy, "ly:module-copy", - 2, 0, 0, (SCM dest, SCM src), - "Copy all bindings from module SRC into DEST.") -{ - SCM_VALIDATE_MODULE (1, src); - scm_internal_hash_fold ((Hash_cl_func) & module_define_closure_func, - (void *) dest, - SCM_EOL, SCM_MODULE_OBARRAY (src)); - return SCM_UNSPECIFIED; -} static SCM accumulate_symbol (void *closure, SCM key, SCM val, SCM result) @@ -135,7 +100,7 @@ SCM_VALIDATE_MODULE (1, mod); SCM obarr = SCM_MODULE_OBARRAY (mod); - return scm_internal_hash_fold ((Hash_cl_func) & accumulate_symbol, + return scm_internal_hash_fold ((Hash_closure_function) & accumulate_symbol, NULL, SCM_EOL, obarr); } @@ -156,40 +121,7 @@ SCM_VALIDATE_MODULE (1, mod); SCM obarr = SCM_MODULE_OBARRAY (mod); - return scm_internal_hash_fold ((Hash_cl_func) & entry_to_alist, NULL, SCM_EOL, obarr); -} - -/* Lookup SYM, but don't give error when it is not defined. */ -SCM -ly_module_lookup (SCM module, SCM sym) -{ -#define FUNC_NAME __FUNCTION__ - SCM_VALIDATE_MODULE (1, module); - - return scm_sym2var (sym, scm_module_lookup_closure (module), SCM_BOOL_F); -#undef FUNC_NAME -} - -/* Lookup SYM in a list of modules, which do not have to be related. - Return the first instance. */ -LY_DEFINE (ly_modules_lookup, "ly:modules-lookup", - 2, 1, 0, - (SCM modules, SCM sym, SCM def), - "Lookup @var{sym} in the list @var{modules}, " - "returning the first occurence. " - "If not found, return @var{default}, or @code{#f}.") -{ - for (SCM s = modules; scm_is_pair (s); s = scm_cdr (s)) - { - SCM mod = scm_car (s); - SCM v = ly_module_lookup (mod, sym); - if (SCM_VARIABLEP (v) && SCM_VARIABLE_REF (v) != SCM_UNDEFINED) - return scm_variable_ref (v); - } - - if (def != SCM_UNDEFINED) - return def; - return SCM_BOOL_F; + return scm_internal_hash_fold ((Hash_closure_function) & entry_to_alist, NULL, SCM_EOL, obarr); } void @@ -207,3 +139,35 @@ { ly_export (mod, ly_module_symbols (mod)); } + + + +#ifdef MODULE_GC_KLUDGE +static SCM +redefine_keyval (void *closure, SCM key, SCM val, SCM result) +{ + (void)closure; + SCM new_tab = result; + scm_hashq_set_x (new_tab, key, val); + return new_tab; +} + +/* + UGH UGH. + Kludge for older GUILE 1.6 versions. + */ +void +make_stand_in_procs_weak () +{ + SCM old_tab = scm_stand_in_procs; + SCM new_tab = scm_make_weak_key_hash_table (scm_from_int (257)); + + new_tab = scm_internal_hash_fold ((Hash_closure_function) & redefine_keyval, + NULL, + new_tab, old_tab); + + scm_stand_in_procs = new_tab; +} + +ADD_SCM_INIT_FUNC(make_stand_in_procs_weak, make_stand_in_procs_weak); +#endif Index: lilypond/lily/spacing-spanner.cc diff -u lilypond/lily/spacing-spanner.cc:1.143 lilypond/lily/spacing-spanner.cc:1.144 --- lilypond/lily/spacing-spanner.cc:1.143 Tue Jul 26 22:24:30 2005 +++ lilypond/lily/spacing-spanner.cc Mon Aug 1 20:15:09 2005 @@ -895,8 +895,9 @@ shortest_playing_len = max (shortest_playing_len, delta_t); if (delta_t.main_part_ && !lwhen.grace_part_) { - dist = get_duration_space (me, shortest_playing_len, shortest.main_part_, expand_only); - dist *= (double) (delta_t.main_part_ / shortest_playing_len.main_part_); + dist = get_duration_space (me, shortest_playing_len, + shortest.main_part_, expand_only); + dist *= double (delta_t.main_part_ / shortest_playing_len.main_part_); } else if (delta_t.grace_part_) { @@ -925,9 +926,14 @@ "gets 2 note heads width (i.e. the space following a note is 1 note\n" "head width) A 16th note is followed by 0.5 note head width. The\n" "quarter note is followed by 3 NHW, the half by 4 NHW, etc.\n", - "grace-space-factor spacing-increment base-shortest-duration shortest-duration-space common-shortest-duration"); + + "grace-space-factor spacing-increment base-shortest-duration " + "shortest-duration-space common-shortest-duration" + + ); ADD_INTERFACE (Spacing_interface, "spacing-interface", - "Something to do with line breaking and spacing. Kill this one after determining line breaks.", + "Something to do with line breaking and spacing. " + "Kill this one after determining line breaks.", ""); _______________________________________________ Lilypond-cvs mailing list Lilypond-cvs@gnu.org http://lists.gnu.org/mailman/listinfo/lilypond-cvs