From ccd804efe5c4238032546ae7f8d261792d381cf5 Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Sat, 17 Dec 2005 23:13:33 +0000 Subject: [PATCH] * GNUmakefile.in: add dir argument for find command. * lily/parser.yy (bass_figure): set_spot() for bass figures. This fixes weird line numbers for point & click. * lily/source-file.cc (get_counts): init line/column/char counts. --- ChangeLog | 13 ++++++ GNUmakefile.in | 2 +- lily/main.cc | 100 +++++++++++++++++++++++++------------------- lily/parser.yy | 2 + lily/source-file.cc | 4 ++ 5 files changed, 77 insertions(+), 44 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0b1ff6bee3..9f4575b8dd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2005-12-18 Han-Wen Nienhuys + + * GNUmakefile.in: add dir argument for find command. + + * lily/parser.yy (bass_figure): set_spot() for bass figures. This + fixes weird line numbers for point & click. + + * lily/source-file.cc (get_counts): init line/column/char counts. + +2005-12-16 Han-Wen Nienhuys + + * lily/main.cc: remove ARGV0_RELOCATION, instead use --relocate. + 2005-12-16 Graham Percival * Documentation/user/basic-notation.itely, advanced-notation.itely: diff --git a/GNUmakefile.in b/GNUmakefile.in index 33c9afb210..3548dc04a5 100644 --- a/GNUmakefile.in +++ b/GNUmakefile.in @@ -81,7 +81,7 @@ local-WWW-post: cat $(outdir)/weblist | (cd $(top-build-dir); tar -cf- -T- ) | \ tar -C $(outdir)/web-root/ -xf - cd $(outdir)/web-root/ && \ - for a in `find -name out-www`; do \ + for a in `find . -name out-www`; do \ mv $$a/* $$a/.. ; \ rmdir $$a ; \ done diff --git a/lily/main.cc b/lily/main.cc index 6fcca99ddf..0a967aa11d 100644 --- a/lily/main.cc +++ b/lily/main.cc @@ -86,6 +86,16 @@ bool make_preview = false; /* Generate printed output. */ bool make_print = true; + +bool relocate_binary = +#ifdef __MINGW32__ + false +#else + true; +#endif + ; + + /* * Miscellaneous global stuff. */ @@ -151,6 +161,7 @@ static Long_option_init options_static[] for --output-format. */ {_i ("FORMATs"), "formats", 'f', _i ("dump FORMAT,... Also as separate options:")}, {0, "dvi", 0, _i ("generate DVI (tex backend only)")}, + {0, "relocate", 0, _i("relocate using path to binary")}, {0, "pdf", 0, _i ("generate PDF (default)")}, {0, "png", 0, _i ("generate PNG")}, {0, "ps", 0, _i ("generate PostScript")}, @@ -192,15 +203,16 @@ dir_info (FILE *out) fprintf (out, "\nEffective prefix: \"%s\"\n", prefix_directory.to_str0 ()); -#if ARGV0_RELOCATION - env_var_info (out, "FONTCONFIG_FILE"); - env_var_info (out, "FONTCONFIG_PATH"); - env_var_info (out, "GS_FONTPATH"); - env_var_info (out, "GS_LIB"); - env_var_info (out, "GUILE_LOAD_PATH"); - env_var_info (out, "PANGO_RC_FILE"); - env_var_info (out, "PATH"); -#endif + if (relocate_binary) + { + env_var_info (out, "FONTCONFIG_FILE"); + env_var_info (out, "FONTCONFIG_PATH"); + env_var_info (out, "GS_FONTPATH"); + env_var_info (out, "GS_LIB"); + env_var_info (out, "GUILE_LOAD_PATH"); + env_var_info (out, "PANGO_RC_FILE"); + env_var_info (out, "PATH"); + } } static void @@ -363,50 +375,50 @@ setup_paths (char const *argv0) { prefix_directory = LILYPOND_DATADIR; -#if ARGV0_RELOCATION - - if (getenv ("LILYPOND_VERBOSE")) - be_verbose_global = true; + if (relocate_binary) + { + if (getenv ("LILYPOND_VERBOSE")) + be_verbose_global = true; - /* Find absolute ARGV0 name, using PATH. */ - File_path path; - path.parse_path (getenv ("PATH")); + /* Find absolute ARGV0 name, using PATH. */ + File_path path; + path.parse_path (getenv ("PATH")); #if defined (__CYGWIN__) || defined (__MINGW32__) - String s = argv0; - s.substitute ('\\', '/'); - argv0 = s.to_str0 (); + String s = argv0; + s.substitute ('\\', '/'); + argv0 = s.to_str0 (); #endif /* __CYGWIN__ || __MINGW32__ */ #ifndef __MINGW32__ - String argv0_abs = path.find (argv0); + String argv0_abs = path.find (argv0); #else /* __MINGW32__ */ - char const *ext[] = {"exe", "", 0 }; - String argv0_abs = path.find (argv0, ext); + char const *ext[] = {"exe", "", 0 }; + String argv0_abs = path.find (argv0, ext); #endif /* __MINGW32__ */ - if (argv0_abs.is_empty ()) - { - File_name name (argv0); - /* If NAME contains slashes and its DIR is not absolute, it can - only be referenced from CWD. */ - if (name.to_string ().index ('/') >= 0 && name.dir_[0] != '/') + if (argv0_abs.is_empty ()) { - char cwd[PATH_MAX]; - getcwd (cwd, PATH_MAX); - argv0_abs = String (cwd) + "/" + argv0; + File_name name (argv0); + /* If NAME contains slashes and its DIR is not absolute, it can + only be referenced from CWD. */ + if (name.to_string ().index ('/') >= 0 && name.dir_[0] != '/') + { + char cwd[PATH_MAX]; + getcwd (cwd, PATH_MAX); + argv0_abs = String (cwd) + "/" + argv0; + } + else + programming_error ("can't find absolute argv0"); } - else - programming_error ("can't find absolute argv0"); - } - String bindir = dir_name (argv0_abs); - String argv0_prefix = dir_name (bindir); - if (argv0_prefix != dir_name (dir_name (dir_name (prefix_directory)))) - set_relocation (bindir, argv0_prefix); -#else - (void) argv0; -#endif /* ARGV0_RELOCATION */ + String bindir = dir_name (argv0_abs); + String argv0_prefix = dir_name (bindir); + if (argv0_prefix != dir_name (dir_name (dir_name (prefix_directory)))) + set_relocation (bindir, argv0_prefix); + } + else + (void) argv0; /* FIXME: use LILYPOND_DATADIR. */ if (char const *env = getenv ("LILYPONDPREFIX")) @@ -674,6 +686,8 @@ parse_argv (int argc, char **argv) make_preview = true; else if (String (opt->longname_str0_) == "no-pages") make_print = false; + else if (String (opt->longname_str0_) == "relocate") + relocate_binary = true; break; case 'd': @@ -788,12 +802,12 @@ int main (int argc, char **argv) { setup_localisation (); - setup_paths (argv[0]); - setup_guile_env (); parse_argv (argc, argv); if (isatty (STDIN_FILENO)) identify (stderr); + setup_paths (argv[0]); + setup_guile_env (); scm_boot_guile (argc, argv, main_with_guile, 0); /* Only reachable if GUILE exits. That is an error. */ diff --git a/lily/parser.yy b/lily/parser.yy index 81a8f81082..a34c8a0778 100644 --- a/lily/parser.yy +++ b/lily/parser.yy @@ -2062,6 +2062,7 @@ bass_figure: Music *bfr = MY_MAKE_MUSIC ("BassFigureEvent"); $$ = bfr->self_scm (); bfr->unprotect (); + bfr->set_spot (@1); } | bass_number { Music *bfr = MY_MAKE_MUSIC ("BassFigureEvent"); @@ -2073,6 +2074,7 @@ bass_figure: bfr->set_property ("text", $1); bfr->unprotect (); + bfr->set_spot (@1); } | bass_figure ']' { $$ = $1; diff --git a/lily/source-file.cc b/lily/source-file.cc index 65fe47c064..2fdeb9fd28 100644 --- a/lily/source-file.cc +++ b/lily/source-file.cc @@ -237,6 +237,10 @@ Source_file::get_counts (char const *pos_str0, int *line_char, int *column) const { + *line_number = 0; + *line_char = 0; + *column = 0; + if (!contains (pos_str0)) return; -- 2.39.5