From: Han-Wen Nienhuys Date: Sun, 6 Mar 2005 16:24:32 +0000 (+0000) Subject: * lily/pango-select.cc (select_pango_font): use ::find_pango_font, X-Git-Tag: release/2.5.14~17 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=c18cea8a2b1259583097fa0dec00fbbe6c4fff39;p=lilypond.git * lily/pango-select.cc (select_pango_font): use ::find_pango_font, so as to register the pango font. * lily/main.cc: only look at one prefix directory, LILYPONDPREFIX overrides all. --- diff --git a/ChangeLog b/ChangeLog index d93628d5b6..f1437d9839 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2005-03-06 Han-Wen Nienhuys + * kpath-guile/kpath.c: new file. Put kpath bindings in lib. + + * kpath-guile/GNUmakefile: new file + * buildscripts/gen-emmentaler-scripts.py (i): generate emmentaler-X.fontname as well. diff --git a/flower/include/guile-compatibility.hh b/flower/include/guile-compatibility.hh new file mode 100644 index 0000000000..78ec55575b --- /dev/null +++ b/flower/include/guile-compatibility.hh @@ -0,0 +1,73 @@ +/* + guile-compatibility.hh -- declare compat functions for GUILE 1.6 + + source file of the GNU LilyPond music typesetter + + (c) 2004--2005 Han-Wen Nienhuys + +*/ + +#ifndef GUILE_COMPATIBILITY_HH +#define GUILE_COMPATIBILITY_HH + +#if SCM_MINOR_VERSION < 7 +/* guile-1.6.x compatibility */ + +inline SCM scm_cdr (SCM x) +{ + if (SCM_NCONSP (x)) + abort (); + return SCM_CDR (x); +} +inline SCM scm_car (SCM x) +{ + if (SCM_NCONSP (x)) + abort (); + return SCM_CAR (x); +} +inline SCM scm_caar (SCM x) { return SCM_CAAR (x); } +inline SCM scm_cdar (SCM x) { return SCM_CDAR (x); } +inline SCM scm_cadr (SCM x) { return SCM_CADR (x); } +inline SCM scm_cddr (SCM x) { return SCM_CDDR (x); } +inline SCM scm_caddr (SCM x) { return SCM_CADDR (x); } +inline SCM scm_cdadr (SCM x) { return SCM_CDADR (x); } +inline SCM scm_caadr (SCM x) { return SCM_CAADR (x); } +inline SCM scm_cadar (SCM x) { return SCM_CADAR (x); } +#define scm_gc_unregister_collectable_memory(a, b, c) scm_done_free (b) +#define scm_gc_register_collectable_memory(a, b, c) scm_done_malloc (b) +#define scm_is_vector(x) (SCM_VECTORP ((SCM) x)) +#define SCM_HASHTABLE_P(x) (SCM_VECTORP ((SCM) x)) +#define SCM_VECTOR_REF(v, i) (SCM_VELTS ((v))[(i)]) +#define scm_from_bool(x) (x ? SCM_BOOL_T : SCM_BOOL_F) +#define scm_from_int(x) SCM_MAKINUM (x) +#define scm_from_unsigned_integer(x) scm_uint2num (x) +#define scm_is_integer(x) SCM_INUMP (x) +#define scm_is_string(x) SCM_STRINGP (x) +#define scm_hash_table_p scm_vector_p +#define scm_from_locale_stringn(s, n) scm_mem2string (s, n) +#define scm_i_string_chars(x) SCM_STRING_CHARS (x) +#define scm_i_string_length(x) SCM_STRING_LENGTH (x) +inline int ly_c_number_p (SCM x) { return SCM_NUMBERP (x); } +#define scm_is_number(x) (scm_number_p (x) == SCM_BOOL_T) +inline int ly_scm2int (SCM x) { return scm_num2int (x, 0, "ly_scm2int"); } +#define scm_to_int(x) (ly_scm2int (x)) +inline int ly_c_symbol_p (SCM x) { return SCM_SYMBOLP (x); } +#define scm_is_symbol(x) ly_c_symbol_p (x) +inline int ly_c_boolean_p (SCM x) { return SCM_BOOLP (x); } +#define scm_is_bool(x) ly_c_boolean_p(x) +inline int ly_c_eq_p (SCM x, SCM y) { return SCM_EQ_P (x, y); } +#define scm_is_eq(x, y) (SCM_EQ_P ((x), (y))) + +#define scm_c_string_length(x) SCM_STRING_LENGTH (x) +#define scm_is_pair(x) (SCM_CONSP (x)) + +#define scm_c_vector_length(x) SCM_VECTOR_LENGTH (x) +#define scm_c_vector_ref(x, y) SCM_VECTOR_REF(x, y) + +inline double ly_scm2double (SCM x) { return scm_num2dbl (x, "ly_scm2double"); } +#define scm_to_double(x) (ly_scm2double (x)) +#define scm_from_double(x) (scm_make_real (x)) + +#endif /* SCM_MINOR_VERSION < 7 */ + +#endif /* GUILE_COMPATIBILITY_HH */ diff --git a/lily/include/guile-compatibility.hh b/lily/include/guile-compatibility.hh deleted file mode 100644 index d61d50e351..0000000000 --- a/lily/include/guile-compatibility.hh +++ /dev/null @@ -1,73 +0,0 @@ -/* - guile-compatibility.hh -- declare compat functions for GUILE 1.6 - - source file of the GNU LilyPond music typesetter - - (c) 2004--2005 Han-Wen Nienhuys - -*/ - -#ifndef GUILE_COMPATIBILITY_HH -#define GUILE_COMPATIBILITY_HH - -#if SCM_MINOR_VERSION < 7 -/* guile-1.6.x compatibility */ - -inline SCM scm_cdr (SCM x) -{ - if (SCM_NCONSP (x)) - abort (); - return SCM_CDR (x); -} -inline SCM scm_car (SCM x) -{ - if (SCM_NCONSP (x)) - abort (); - return SCM_CAR (x); -} -inline SCM scm_caar (SCM x) { return SCM_CAAR (x); } -inline SCM scm_cdar (SCM x) { return SCM_CDAR (x); } -inline SCM scm_cadr (SCM x) { return SCM_CADR (x); } -inline SCM scm_cddr (SCM x) { return SCM_CDDR (x); } -inline SCM scm_caddr (SCM x) { return SCM_CADDR (x); } -inline SCM scm_cdadr (SCM x) { return SCM_CDADR (x); } -inline SCM scm_caadr (SCM x) { return SCM_CAADR (x); } -inline SCM scm_cadar (SCM x) { return SCM_CADAR (x); } -#define scm_gc_unregister_collectable_memory(a, b, c) scm_done_free (b) -#define scm_gc_register_collectable_memory(a, b, c) scm_done_malloc (b) -#define scm_is_vector(x) (SCM_VECTORP ((SCM) x)) -#define SCM_HASHTABLE_P(x) (SCM_VECTORP ((SCM) x)) -#define SCM_VECTOR_REF(v, i) (SCM_VELTS ((v))[(i)]) -#define scm_from_bool(x) (x ? SCM_BOOL_T : SCM_BOOL_F) -#define scm_from_int(x) SCM_MAKINUM (x) -#define scm_from_unsigned_integer(x) scm_uint2num (x) -#define scm_is_integer(x) SCM_INUMP (x) -#define scm_is_string(x) SCM_STRINGP (x) -#define scm_hash_table_p scm_vector_p -#define scm_from_locale_stringn(s, n) scm_mem2string (s, n) -#define scm_i_string_chars(x) SCM_STRING_CHARS (x) -#define scm_i_string_length(x) SCM_STRING_LENGTH (x) -inline bool ly_c_number_p (SCM x) { return SCM_NUMBERP (x); } -#define scm_is_number(x) (scm_number_p (x) == SCM_BOOL_T) -inline int ly_scm2int (SCM x) { return scm_num2int (x, 0, "ly_scm2int"); } -#define scm_to_int(x) (ly_scm2int (x)) -inline bool ly_c_symbol_p (SCM x) { return SCM_SYMBOLP (x); } -#define scm_is_symbol(x) ly_c_symbol_p (x) -inline bool ly_c_boolean_p (SCM x) { return SCM_BOOLP (x); } -#define scm_is_bool(x) ly_c_boolean_p(x) -inline bool ly_c_eq_p (SCM x, SCM y) { return SCM_EQ_P (x, y); } -#define scm_is_eq(x, y) (SCM_EQ_P ((x), (y))) - -#define scm_c_string_length(x) SCM_STRING_LENGTH (x) -#define scm_is_pair(x) (SCM_CONSP (x)) - -#define scm_c_vector_length(x) SCM_VECTOR_LENGTH (x) -#define scm_c_vector_ref(x, y) SCM_VECTOR_REF(x, y) - -inline double ly_scm2double (SCM x) { return scm_num2dbl (x, "ly_scm2double"); } -#define scm_to_double(x) (ly_scm2double (x)) -#define scm_from_double(x) (scm_make_real (x)) - -#endif /* SCM_MINOR_VERSION < 7 */ - -#endif /* GUILE_COMPATIBILITY_HH */ diff --git a/lily/kpath-scheme.cc b/lily/kpath-scheme.cc index 0c6ab232fc..e69de29bb2 100644 --- a/lily/kpath-scheme.cc +++ b/lily/kpath-scheme.cc @@ -1,80 +0,0 @@ -/* - kpath-scheme.cc -- implement kpathsea bindings - - source file of the GNU LilyPond music typesetter - - (c) 2005 Han-Wen Nienhuys - -*/ - -#include "kpath.hh" - -#include -#include - -/* - -The problem, as far as I can tell, is that MacOS X has its getopt -prototype in , while I think other operating systems have it -in other places. is included by kpathsea.h, so you end up -renaming both conflicting prototypes to YAKLUDGE. - -I found a somewhat more elegant patch for this: Just #include - before defining YAKLUDGE. - -*/ - -#include - -#include "config.hh" - -#define popen REALLYUGLYKLUDGE -#define pclose ANOTHERREALLYUGLYKLUDGE -#define getopt YAKLUDGE - -#if HAVE_KPATHSEA_KPATHSEA_H -extern "C" { -#include -#include -} -#endif - -#include "file-path.hh" -#include "main.hh" -#include "source-file.hh" -#include "warn.hh" -#include "kpath-private.hh" - - -LY_DEFINE (ly_kpathsea_find_file, "ly:kpathsea-find-file", - 1, 0, 0, (SCM name), - "Return the absolute file name of @var{name}, " - "or @code{#f} if not found.") -{ - SCM_ASSERT_TYPE (scm_is_string (name), name, SCM_ARG1, __FUNCTION__, "string"); - - String nm = ly_scm2string (name); - String file_name = global_path.find (nm); - if (file_name.is_empty ()) - { - if (char *p = kpse_find_file (nm.to_str0 (), kpathsea_find_format (nm), - true)) - return scm_makfrom0str (p); - return SCM_BOOL_F; - } - return scm_makfrom0str (file_name.to_str0 ()); -} - -LY_DEFINE (ly_kpathsea_expand_variable, "ly:kpathsea-expand-variable", - 1, 0, 0, (SCM var), - "Return the expanded version @var{var}.") -{ - SCM_ASSERT_TYPE (scm_is_string (var), var, SCM_ARG1, __FUNCTION__, "string"); - - String nm = ly_scm2string (var); - char *result = kpse_var_expand (nm.to_str0 ()); - SCM ret = scm_makfrom0str (result); - delete[] result; - - return ret; -} diff --git a/lily/kpath.cc b/lily/kpath.cc index fed266f797..e69de29bb2 100644 --- a/lily/kpath.cc +++ b/lily/kpath.cc @@ -1,121 +0,0 @@ -/* - kpath.cc -- glue kpathsea to lily. Need some ugly kludges for gcc 2.96 - - source file of the GNU LilyPond music typesetter - - (c) 2000--2005 Han-Wen Nienhuys -*/ - -#include "kpath.hh" - -#include -#include - -/* - -The problem, as far as I can tell, is that MacOS X has its getopt -prototype in , while I think other operating systems have it -in other places. is included by kpathsea.h, so you end up -renaming both conflicting prototypes to YAKLUDGE. - -I found a somewhat more elegant patch for this: Just #include - before defining YAKLUDGE. - -*/ - -#include - -#include "config.hh" - -#define popen REALLYUGLYKLUDGE -#define pclose ANOTHERREALLYUGLYKLUDGE -#define getopt YAKLUDGE - -#if HAVE_KPATHSEA_KPATHSEA_H -extern "C" { -#include -#include -} -#endif - -#include "file-path.hh" -#include "main.hh" -#include "source-file.hh" -#include "warn.hh" -#include "kpath-private.hh" - -String -kpathsea_find_afm (char const *name) -{ -#if (KPATHSEA && HAVE_KPSE_FIND_FILE) - - if (char *afm = kpse_find_file (name, kpse_afm_format, false)) - return afm; - -#endif - return ""; -} - -String -kpathsea_find_tfm (char const *name) -{ - String file_name = global_path.find (String (name) + ".tfm"); -#if (KPATHSEA && HAVE_KPSE_FIND_FILE) - if (file_name.is_empty ()) - { - /* If invoked for a TeX font, we could do TRUE (must exist). - We could also do: - p = kpse_find_file (name, kpse_mf_format, false); - if (p) - p = kpse_find_file (name, kpse_mf_format, true); - - but we assume that if there is a .PFA, there is also a .TFM, - and it's no use generating TFMs on the fly, because PFAs cannot - be generated on the fly. */ - if (char *tfm = kpse_find_file (name, kpse_tfm_format, false)) - return tfm; - warning (_f ("kpathsea can't find %s file: `%s'", "TFM", name)); - } -#endif - return file_name; -} - -#if KPATHSEA -/* FIXME: this should be part of kpathsea */ - -kpse_file_format_type -kpathsea_find_format (String name) -{ - for (int i = 0; i < kpse_last_format; i++) - { - if (!kpse_format_info[i].type) - kpse_init_format ((kpse_file_format_type) i); - - char const **suffixes[] = { kpse_format_info[i].suffix, - kpse_format_info[i].alt_suffix }; - for (int j = 0; j < 2; j++) - for (char const **p = suffixes[j]; p && *p; p++) - { - String suffix = *p; - if (name.right_string (suffix.length ()) == suffix) - return (kpse_file_format_type) i; - } - } - return kpse_last_format; -} -#endif - - - -void -initialize_kpathsea (char *av0) -{ -#if KPATHSEA && HAVE_KPATHSEA_KPATHSEA_H - - /* - initialize kpathsea - */ - kpse_set_program_name (av0, NULL); - kpse_maketex_option ("tfm", TRUE); -#endif -} diff --git a/lily/lily-guile.cc b/lily/lily-guile.cc index c335fd1e2d..12035d6501 100644 --- a/lily/lily-guile.cc +++ b/lily/lily-guile.cc @@ -185,6 +185,12 @@ void add_scm_init_func (void (*f) ()) scm_init_funcs_->push (f); } +#if KPATHSEA +extern "C" { + void initialize_kpathsea (); +} +#endif + void ly_init_ly_module (void *) { @@ -193,6 +199,10 @@ ly_init_ly_module (void *) if (be_verbose_global) progress_indication ("\n"); + +#if KPATHSEA + initialize_kpathsea (); +#endif scm_primitive_load_path (scm_makfrom0str ("lily.scm")); }