* lily/my-lily-parser.cc (distill_inname): Remove.
* flower/include/file-name.hh:
* flower/file-name.cc: New file. Change users.
* flower/file-path.cc [CYGWIN]: Junk testing code. Remove Path.
(find): New method of same name.
* lily/scm-option.cc (ly:set-option, ly:get-option): Bugfix:
constant error message.
+2004-04-27 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * lily/paper-outputter.cc (output_stencil): New method.
+
+ * lily/my-lily-parser.cc (distill_inname): Remove.
+
+ * flower/include/file-name.hh:
+ * flower/file-name.cc: New file. Change users.
+
+ * flower/file-path.cc [CYGWIN]: Junk testing code. Remove Path.
+ (find): New method of same name.
+
+ * lily/scm-option.cc (ly:set-option, ly:get-option): Bugfix:
+ constant error message.
+
2004-04-27 Heikki Junes <hjunes@cc.hut.fi>
* input/test/{blank-notes.ly,staff-container.ly}: typos.
--- /dev/null
+/*
+ file-name.cc - implement File_name
+
+ source file of the Flower Library
+
+ (c) 1997--2004 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+ Jan Nieuwenhuizen <janneke@gnu.org>
+*/
+
+#include "config.h"
+#include <stdio.h>
+#include <errno.h>
+#include <limits.h>
+
+#if HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
+
+#ifdef __CYGWIN__
+#include <sys/cygwin.h>
+#endif
+
+#include "file-name.hh"
+
+/* We don't have multiple roots, set this to '\0'? */
+#ifndef ROOTSEP
+#define ROOTSEP ':'
+#endif
+
+#ifndef DIRSEP
+#define DIRSEP '/'
+#endif
+
+#ifndef EXTSEP
+#define EXTSEP '.'
+#endif
+
+#ifdef __CYGWIN__
+static String
+dos_to_posix (String file_name)
+{
+ char buf[PATH_MAX];
+ char *s = file_name.get_copy_str0 ();
+ /* urg, wtf? char const* argument gets modified! */
+ cygwin_conv_to_posix_path (s, buf);
+ delete s;
+ return buf;
+}
+#endif /* __CYGWIN__ */
+
+/* Join components to full file_name. */
+String
+File_name::to_string () const
+{
+ String s;
+ if (!root_.is_empty ())
+ s = root_ + ::to_string (ROOTSEP);
+ if (!dir_.is_empty ())
+ s += dir_ + ::to_string (DIRSEP);
+ s += base_;
+ if (!ext_.is_empty ())
+ s += ::to_string (EXTSEP) + ext_;
+ return s;
+}
+
+char const*
+File_name::to_str0 () const
+{
+ return to_string ().to_str0 ();
+}
+
+File_name::File_name (String file_name)
+{
+#ifdef __CYGWIN__
+ /* All system functions would work, even if we don't convert to
+ posix file_name, but we'd think that \foe\bar\baz.ly is in the cwd.
+ On by default. */
+ file_name = dos_to_posix (file_name);
+#endif
+
+ int i = file_name.index (ROOTSEP);
+ if (i >= 0)
+ {
+ root_ = file_name.left_string (i);
+ file_name = file_name.right_string (file_name.length () - i - 1);
+ }
+
+ i = file_name.index_last (DIRSEP);
+ if (i >= 0)
+ {
+ dir_ = file_name.left_string (i);
+ file_name = file_name.right_string (file_name.length () - i - 1);
+ }
+
+ i = file_name.index_last ('.');
+ if (i >= 0)
+ {
+ base_ = file_name.left_string (i);
+ ext_ = file_name.right_string (file_name.length () - i - 1);
+ }
+ else
+ base_ = file_name;
+}
/*
- path.cc - manipulation of paths and filenames.
+ file-path.cc - implement File_path
+
+ source file of the Flower Library
+
+ (c) 1997--2004 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+ Jan Nieuwenhuizen <janneke@gnu.org>
*/
#include "config.h"
#ifdef __CYGWIN__
#include <sys/cygwin.h>
-
-// URGURG
-#include "../lily/include/scm-option.hh"
#endif
+#include "file-name.hh"
#include "file-path.hh"
-
#ifndef PATHSEP
#define PATHSEP ':'
#endif
-/* We don't have multiple roots, set this to '\0'? */
-#ifndef ROOTSEP
-#define ROOTSEP ':'
-#endif
-
-#ifndef DIRSEP
-#define DIRSEP '/'
-#endif
-
-#ifndef EXTSEP
-#define EXTSEP '.'
-#endif
-
-
-
-#ifdef __CYGWIN__
-static String
-dos_to_posix (String path)
-{
- char buf[PATH_MAX];
- char *filename = path.get_copy_str0 ();
- /* urg, wtf? char const* argument gets modified! */
- cygwin_conv_to_posix_path (filename, buf);
- delete filename;
- return buf;
-}
-
-static String
-dos_to_posix_list (String path)
-{
- char *filename = path.get_copy_str0 ();
- int len = cygwin_win32_to_posix_path_list_buf_size (filename);
- if (len < PATH_MAX)
- len = PATH_MAX;
- char *buf = new char[len];
- /* urg, wtf? char const* argument gets modified! */
- cygwin_win32_to_posix_path_list (filename, buf);
- delete filename;
-
- String ret = buf;
- delete buf;
- return ret;
-}
-#endif /* __CYGWIN__ */
-
-/* Join components to full path. */
-String
-Path::to_string () const
-{
- String s;
- if (!root.is_empty ())
- s = root + ::to_string (ROOTSEP);
- if (!dir.is_empty ())
- s += dir + ::to_string (DIRSEP);
- s += base;
- if (!ext.is_empty ())
- s += ::to_string (EXTSEP) + ext;
- return s;
-}
-
-/**
- @param path the original full filename
- @return 4 components of the path. They can be empty
-*/
-Path
-split_path (String path)
-{
-#ifdef __CYGWIN__
- /* All system functions would work, even if we don't convert to
- posix path, but we'd think that \foe\bar\baz.ly is in the cwd.
- On by default. */
- if (!(testing_level_global & 1))
- path = dos_to_posix (path);
-#endif
-
- Path p;
- int i = path.index (ROOTSEP);
- if (i >= 0)
- {
- p.root = path.left_string (i);
- path = path.right_string (path.length () - i - 1);
- }
-
- i = path.index_last (DIRSEP);
- if (i >= 0)
- {
- p.dir = path.left_string (i);
- path = path.right_string (path.length () - i - 1);
- }
-
- i = path.index_last ('.');
- if (i >= 0)
- {
- p.base = path.left_string (i);
- p.ext = path.right_string (path.length () - i - 1);
- }
- else
- p.base = path;
- return p;
-}
-
void
File_path::parse_path (String p)
{
-#ifdef __CYGWIN__
- if (testing_level_global & 4)
- p = dos_to_posix_list (p);
-#endif
-
- int l;
-
- while ((l = p.length ()) )
+ int len;
+ while ((len = p.length ()) )
{
int i = p.index (PATHSEP);
if (i <0)
- i = l;
- add (p.left_string (i));
- p = p.right_string (l- i - 1);
+ i = len;
+ append (p.left_string (i));
+ p = p.right_string (len - i - 1);
}
}
-
-
-
/** Find a file.
- It will search in the current dir, in the construction-arg, and
- in any other added path, in this order.
+
+ Seach in the current dir (DUH! FIXME?), in the construction-arg
+ (what's that?, and in any other appended directory, in this order.
@return
- The full path if found, or empty string if not found
- */
+ The file name if found, or empty string if not found. */
+
String
-File_path::find (String nm) const
+File_path::find (String name) const
{
- if (!nm.length () || (nm == "-") )
- return nm;
- for (int i=0; i < size (); i++)
+ if (!name.length () || (name == "-") )
+ return name;
+ int n = size ();
+ for (int i = 0; i < n; i++)
{
- String path = elem (i);
+ String file_name = elem (i);
String sep = ::to_string (DIRSEP);
- String right (path.right_string (1));
- if (path.length () && right != sep)
- path += ::to_string (DIRSEP);
-
- path += nm;
+ String right (file_name.right_string (1));
+ if (file_name.length () && right != sep)
+ file_name += ::to_string (DIRSEP);
+ file_name += name;
-#if 0
- /*
- Check if directory. TODO: encapsulate for autoconf
- */
+#if 0 /* Check if directory. TODO: encapsulate for autoconf */
struct stat sbuf;
- if (stat (path.to_str0 (), &sbuf) != 0)
+ if (stat (file_name.to_str0 (), &sbuf) != 0)
continue;
if (! (sbuf.st_mode & __S_IFREG))
#if !STAT_MACROS_BROKEN
struct stat sbuf;
- if (stat (path.to_str0 (), &sbuf) != 0)
+ if (stat (file_name.to_str0 (), &sbuf) != 0)
continue;
if (S_ISDIR (sbuf.st_mode))
continue;
#endif
- FILE *f = fopen (path.to_str0 (), "r"); // ugh!
+ /* ugh */
+ FILE *f = fopen (file_name.to_str0 (), "r");
if (f)
{
fclose (f);
- return path;
+ return file_name;
}
}
return "";
}
-/**
- Add a directory, return false if failed
- */
-bool
-File_path::try_add (String s)
-{
- if (s == "")
- s = ".";
- FILE * f = fopen (s.to_str0 (), "r");
- if (!f)
- return false;
- fclose (f);
+/** Find a file.
- add (s);
- return true;
-}
+ Seach in the current dir (DUH! FIXME?), in the construction-arg
+ (what's that?, and in any other appended directory, in this order.
-void
-File_path::add (String s)
+ Search for NAME, or name without extension, or name with any of
+ EXTENSIONS, in that order.
+
+ @return
+ The file name if found, or empty string if not found. */
+String
+File_path::find (String name, char const *extensions[])
{
-#ifdef __CYGWIN__
- if (testing_level_global & 2)
- s = dos_to_posix (s);
-#endif
+ File_name file_name (name);
+ if (name.is_empty () || name == "-")
+ file_name.base_ = "-";
+ else
+ {
+ String orig_ext = file_name.ext_;
+ for (int i = 0; extensions[i]; i++)
+ {
+ file_name.ext_ = orig_ext;
+ if (*extensions[i] && !file_name.ext_.is_empty ())
+ file_name.ext_ += ".";
+ file_name.ext_ += extensions[i];
+ if (!find (file_name.to_string ()).is_empty ())
+ break;
+ }
+ /* Reshuffle extension */
+ file_name = File_name (file_name.to_string ());
+ }
+ return file_name.to_string ();
+}
- push (s);
+/** Append a directory, return false if failed. */
+bool
+File_path::try_append (String s)
+{
+ if (s == "")
+ s = ".";
+ if (FILE *f = fopen (s.to_str0 (), "r"))
+ {
+ fclose (f);
+ append (s);
+ return true;
+ }
+ return false;
}
String
File_path::to_string () const
{
String s;
- for (int i=0; i< size (); i++)
+ int n = size ();
+ for (int i = 0; i < n; i++)
{
s = s + elem (i);
- if (i < size () -1 )
+ if (i < n - 1)
s += ":";
}
return s;
--- /dev/null
+/*
+ file-name.hh -- declare File_name
+
+ source file of the Flower Library
+
+ (c) 1997--2004 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+*/
+
+#ifndef FILE_NAME_HH
+#define FILE_NAME_HH
+
+#include "array.hh"
+#include "string.hh"
+
+class File_name
+{
+public:
+ String root_;
+ String dir_;
+ String base_;
+ String ext_;
+
+ File_name (String);
+
+ String to_string () const;
+ char const *to_str0 () const;
+};
+
+#endif /* FILE_NAME */
/*
- file-path.hh -- declare Path and File_path
+ file-path.hh -- declare File_name and File_path
source file of the Flower Library
#ifndef FILE_PATH_HH
#define FILE_PATH_HH
-#include "string.hh"
#include "array.hh"
-
+#include "string.hh"
/**
search in directories for a file.
TODO: add a unix style PATH interface
*/
-class Path
-{
-public:
- String root;
- String dir;
- String base;
- String ext;
-
- String to_string () const;
-};
-
class File_path : private Array<String>
{
public:
- String find (String nm) const;
-
- Array<String>::push;
- void prepend (String str) { Array<String>::insert (str, 0); }
- String to_string ()const;
- bool try_add (String str);
- void add (String);
+ String find (String name) const;
+ String find (String name, char const *extensions[]);
+ String to_string () const;
+ bool try_append (String str);
+ void append (String str) { Array<String>::push (str); }
void parse_path (String);
+ void prepend (String str) { Array<String>::insert (str, 0); }
};
-Path split_path (String path);
-
#endif /* FILE_PATH */
struct Offset;
struct Long_option_init;
struct Rational;
-struct File_path;
+class File_name;
+class File_path;
struct Getopt_long;
struct String_data;
struct String_handle;
-\version "2.2.0"
+\version "2.3.0"
\header {
texidoc="@cindex Blank Paper
@code{Bar_number_engraver}.
" }
-\score {
- \notes {
- % \clef violin
+
+
+\score \with {
+ \override TimeSignature #'transparent = ##t
+ \override NoteHead #'transparent = ##t
+ defaultBarType = #""
+ \remove Bar_number_engraver
+}
+
+{
+ %% \clef treble
\clef bass
\repeat unfold 3 { c1 \break }
- }
- \paper {
- \context {
- \ScoreContext
- \override TimeSignature #'transparent = ##t
- \override NoteHead #'transparent = ##t
- defaultBarType = #""
- \remove Bar_number_engraver
- }
- }
}
+
class Paper_outputter
{
bool verbatim_scheme_b_;
-
-public:
SCM output_module_;
Protected_scm file_;
- String basename_;
+ String filename_;
+
+ void output_expr (SCM expr, Offset o);
+ void output_metadata (Paper_def*, SCM);
+ void output_music_output_def (Music_output_def* odef);
+public:
Paper_outputter (String nm);
~Paper_outputter ();
-
+
void dump_scheme (SCM);
- void output_metadata (Paper_def*, SCM);
- void output_music_output_def (Music_output_def* odef);
void output_scheme (SCM scm);
- void output_expr (SCM expr, Offset o);
+ void output_stencil (Stencil*);
void output_header (Paper_def*, SCM, int, bool);
void output_line (SCM, Offset*, bool);
};
#include <libintl.h>
#endif
-#include "lily-guile.hh"
-#include "lily-version.hh"
#include "all-font-metrics.hh"
+#include "file-name.hh"
+#include "file-path.hh"
#include "getopt-long.hh"
+#include "global-ctor.hh"
+#include "kpath.hh"
+#include "lily-guile.hh"
+#include "lily-version.hh"
+#include "main.hh"
+#include "midi-def.hh"
#include "misc.hh"
+#include "paper-def.hh"
#include "string.hh"
-#include "main.hh"
-#include "file-path.hh"
#include "warn.hh"
-#include "lily-guile.hh"
-#include "paper-def.hh"
-#include "midi-def.hh"
-#include "global-ctor.hh"
-#include "kpath.hh"
/*
* Global options that can be overridden through command line.
if (char const *lilypond_prefix = getenv ("LILYPONDPREFIX"))
prefix_directory[1] = lilypond_prefix;
- global_path.add ("");
+ global_path.append ("");
/* Adding mf/out make lilypond unchanged source directory, when setting
LILYPONDPREFIX to lilypond-x.y.z */
{
bool help_b = false;
option_parser = new Getopt_long (argc, argv, options_static);
- while (Long_option_init const * opt = (*option_parser) ())
+ while (Long_option_init const *opt = (*option_parser) ())
{
switch (opt->shortname_char_)
{
case 'o':
{
String s = option_parser->optional_argument_str0_;
- Path p = split_path (s);
- if (s != "-" && p.ext.is_empty ())
- p.ext = output_format_global;
- output_name_global = p.to_string ();
+ File_name file_name (s);
+ if (s != "-" && file_name.ext_.is_empty ())
+ file_name.ext_ = output_format_global;
+ output_name_global = file_name.to_string ();
}
break;
case 'e':
.push (option_parser->optional_argument_str0_);
break;
case 'I':
- global_path.push (option_parser->optional_argument_str0_);
+ global_path.append (option_parser->optional_argument_str0_);
break;
case 'i':
init_name_global = option_parser->optional_argument_str0_;
*/
#include "book.hh"
+#include "file-name.hh"
#include "file-path.hh"
#include "lily-version.hh"
#include "ly-module.hh"
return SCM_UNSPECIFIED;
}
-
-/* Distill full input file name from command argument. PATH describes
- file name with added default extension, ".ly" if none. "-" is
- STDIN. */
-Path
-distill_inname (String str)
-{
- Path p = split_path (str);
- if (str.is_empty () || str == "-")
- p.base = "-";
- else
- {
- String orig_ext = p.ext;
- char const *extensions[] = {"ly", "", 0};
- for (int i = 0; extensions[i]; i++)
- {
- p.ext = orig_ext;
- if (*extensions[i] && !p.ext.is_empty ())
- p.ext += ".";
- p.ext += extensions[i];
- if (!global_path.find (p.to_string ()).is_empty ())
- break;
- }
- /* Reshuffle extension */
- p = split_path (p.to_string ());
- }
- return p;
-}
-
LY_DEFINE (ly_parse_file, "ly:parse-file",
1, 0, 0,
(SCM name),
{
SCM_ASSERT_TYPE (ly_c_string_p (name), name, SCM_ARG1, __FUNCTION__, "string");
char const *file = SCM_STRING_CHARS (name);
-
- String infile (file);
- Path inpath = distill_inname (infile);
+ char const *extensions[] = {"ly", "", 0};
+ String file_name = global_path.find (file, extensions);
/* By default, use base name of input file for output file name */
- Path outpath = inpath;
- if (inpath.to_string () != "-")
- outpath.ext = output_format_global;
+ File_name out_file_name (file_name);
+ if (file_name != "-")
+ out_file_name.ext_ = output_format_global;
/* By default, write output to cwd; do not copy directory part
of input file name */
- outpath.root = "";
- outpath.dir = "";
+ out_file_name.root_ = "";
+ out_file_name.dir_ = "";
if (!output_name_global.is_empty ())
- outpath = split_path (output_name_global);
+ out_file_name = File_name (output_name_global);
String init;
if (!init_name_global.is_empty ())
else
init = "init.ly";
- String in_file = inpath.to_string ();
- String out_file = outpath.to_string ();
-
+ String out_file = out_file_name.to_string ();
if (init.length () && global_path.find (init).is_empty ())
{
exit (2);
}
- if ((in_file != "-") && global_path.find (in_file).is_empty ())
+ if ((file_name != "-") && global_path.find (file_name).is_empty ())
{
- warning (_f ("can't find file: `%s'", in_file));
- scm_throw (ly_symbol2scm ("ly-file-failed"), scm_list_1 (scm_makfrom0str (in_file.to_str0 ())));
+ warning (_f ("can't find file: `%s'", file_name));
+ scm_throw (ly_symbol2scm ("ly-file-failed"),
+ scm_list_1 (scm_makfrom0str (file_name.to_str0 ())));
}
else
{
Sources sources;
sources.set_path (&global_path);
- progress_indication (_f ("Now processing `%s'", in_file.to_str0 ()));
+ progress_indication (_f ("Now processing `%s'", file_name.to_str0 ()));
progress_indication ("\n");
My_lily_parser *parser = new My_lily_parser (&sources);
scm_module_define (global_lily_module, ly_symbol2scm ("parser"),
parser->self_scm ());
- parser->parse_file (init, in_file, out_file);
+ parser->parse_file (init, file_name, out_file);
bool error = parser->error_level_;
parser = 0;
if (error)
/* TODO: pass renamed input file too. */
scm_throw (ly_symbol2scm ("ly-file-failed"),
- scm_list_1 (scm_makfrom0str (in_file.to_str0 ())));
+ scm_list_1 (scm_makfrom0str (file_name.to_str0 ())));
}
return SCM_UNSPECIFIED;
}
SCM header = is_module (score->header_) ? score->header_
: parser->header_.to_SCM ();
- Path outname = split_path (parser->output_basename_);
+ File_name outname (parser->output_basename_);
int *c = &parser->book_count_;
if (*c)
- outname.base += "-" + to_string (*c);
+ outname.base_ += "-" + to_string (*c);
(*c)++;
SCM os = scm_makfrom0str (outname.to_string ().to_str0 ());
Book *book = unsmob_book (book_smob);
SCM header = parser->header_;
- Path outname = split_path (parser->output_basename_);
+ File_name outname (parser->output_basename_);
int *c = &parser->book_count_;
if (*c)
- outname.base += "-" + to_string (*c);
+ outname.base_ += "-" + to_string (*c);
(*c)++;
Music_output_def *paper = get_paper (parser);
book->process (outname.to_string (), paper, header);
{
progress_indication (_f ("paper output to `%s'...",
outname == "-" ? String ("<stdout>") : outname));
-
- Paper_outputter * po = new Paper_outputter (outname);
- Path p = split_path (outname);
- p.ext = "";
- po->basename_ = p.to_string ();
- return po;
+ return new Paper_outputter (outname);
}
Font_metric*
#include "paper-def.hh"
#include "paper-line.hh"
#include "paper-outputter.hh"
+#include "file-name.hh"
#include "scm-hash.hh"
#include "stencil.hh"
#include "string-convert.hh"
Paper_outputter::Paper_outputter (String filename)
{
- if (safe_global_b)
- scm_define (ly_symbol2scm ("safe-mode?"), SCM_BOOL_T);
-
+ filename_ = filename;
file_ = scm_open_file (scm_makfrom0str (filename.to_str0 ()),
scm_makfrom0str ("w"));
+ if (safe_global_b)
+ scm_define (ly_symbol2scm ("safe-mode?"), SCM_BOOL_T);
+
String module_name = "scm output-" + output_format_global;
if (safe_global_b)
{
fields
= scm_cons (ly_symbol2scm (dump_header_fieldnames_global[i].to_str0 ()),
fields);
+
+ File_name file_name (filename_);
+ file_name.ext_ = "";
+ String basename = file_name.to_string ();
output_scheme (scm_list_n (ly_symbol2scm ("output-scopes"),
paper->self_scm (),
ly_quote_scm (scopes),
ly_quote_scm (fields),
- scm_makfrom0str (basename_.to_str0 ()),
+ scm_makfrom0str (basename.to_str0 ()),
SCM_UNDEFINED));
}
(*origin)[Y_AXIS] += dim[Y_AXIS];
}
+void
+Paper_outputter::output_music_output_def (Music_output_def *odef)
+{
+ output_scheme (scm_list_2 (ly_symbol2scm ("output-paper-def"),
+ odef->self_scm ()));
+}
void
-Paper_outputter::output_music_output_def (Music_output_def* odef)
+Paper_outputter::output_stencil (Stencil *stil)
{
- output_scheme (scm_list_n (ly_symbol2scm ("output-paper-def"),
- odef->self_scm (), SCM_UNDEFINED));
+ output_expr (stil->get_expr (), stil->origin ());
}
/* TODO: replaceme/rewriteme, see output-ps.scm: output-stencil */
SCM head =ly_car (expr);
if (unsmob_input (head))
{
- Input * ip = unsmob_input (head);
-
- output_scheme (scm_list_n (ly_symbol2scm ("define-origin"),
- scm_makfrom0str (ip->file_string ().to_str0 ()),
- scm_int2num (ip->line_number ()),
- scm_int2num (ip->column_number ()),
- SCM_UNDEFINED));
+ Input *ip = unsmob_input (head);
+ output_scheme (scm_list_4 (ly_symbol2scm ("define-origin"),
+ scm_makfrom0str (ip->file_string ()
+ .to_str0 ()),
+ scm_int2num (ip->line_number ()),
+ scm_int2num (ip->column_number ())));
expr = ly_cadr (expr);
}
else if (head == ly_symbol2scm ("no-origin"))
{
- output_scheme (scm_list_n (head, SCM_UNDEFINED));
+ output_scheme (scm_list_1 (head));
expr = ly_cadr (expr);
}
else if (head == ly_symbol2scm ("translate-stencil"))
}
else
{
- output_scheme (scm_list_n (ly_symbol2scm ("placebox"),
+ output_scheme (scm_list_4 (ly_symbol2scm ("placebox"),
scm_make_real (o[X_AXIS]),
scm_make_real (o[Y_AXIS]),
- expr,
- SCM_UNDEFINED));
+ expr));
return;
}
}
}
-
*/
#include <time.h>
-#include "warn.hh"
-#include "string.hh"
-#include "string-convert.hh"
+
+#include "audio-column.hh"
+#include "audio-item.hh"
+#include "audio-staff.hh"
+#include "file-name.hh"
+#include "lily-version.hh"
#include "main.hh"
#include "midi-def.hh"
#include "midi-item.hh"
#include "midi-stream.hh"
-#include "audio-column.hh"
-#include "audio-item.hh"
-#include "audio-staff.hh"
#include "performance.hh"
#include "score.hh"
-#include "file-path.hh"
-#include "lily-version.hh"
+#include "string-convert.hh"
+#include "string.hh"
+#include "warn.hh"
#include "killing-cons.tcc"
out = "lelie.midi";
/* Maybe a bit crude, but we had this before */
- Path p = split_path (out);
- p.ext = "midi";
- out = p.to_string ();
+ File_name file_name (out);
+ file_name.ext_ = "midi";
+ out = file_name.to_string ();
Midi_stream midi_stream (out);
progress_indication (_f ("MIDI output to `%s'...", out));
-/*
+/*
scm-option.cc -- implement option setting from Scheme
-
+
source file of the GNU LilyPond music typesetter
-
+
(c) 2001--2004 Han-Wen Nienhuys <hanwen@cs.uu.nl>
-
+
*/
#include <stdio.h>
preferably, also dont use TESTING_LEVEL_GLOBAL, since it defeats
another purpose of this very versatile interface, which is to
support multiple debug/testing options concurrently.
-
+
*/
LY_DEFINE (ly_option_usage, "ly:option-usage", 0, 0, 0, (SCM),
"Print ly-set-option usage")
-{
+{
printf ( _("lilypond -e EXPR means:").to_str0 ());
puts ("");
printf (_ (" Evalute the Scheme EXPR before parsing any .ly files.").to_str0 ());
" midi-debug BOOLEAN\n"
" parse-protect BOOLEAN\n"
" testing-level INTEGER\n");
-
+
exit (0);
return SCM_UNSPECIFIED;
}
val = SCM_BOOL_T;
if (var == ly_symbol2scm ("help"))
- {
- /* lilypond -e "(ly-set-option 'help #t)" */
- ly_option_usage (SCM_EOL);
- }
+ /* lilypond -e "(ly-set-option 'help #t)" */
+ ly_option_usage (SCM_EOL);
else if (var == ly_symbol2scm ("midi-debug"))
- {
- midi_debug_global_b = to_boolean (val);
- }
+ midi_debug_global_b = to_boolean (val);
else if (var == ly_symbol2scm ("testing-level"))
- {
- testing_level_global = ly_scm2int (val);
- }
+ testing_level_global = ly_scm2int (val);
else if (var == ly_symbol2scm ("parse-protect" ))
- {
- parse_protect_global = to_boolean (val);
- }
+ parse_protect_global = to_boolean (val);
else if (var == ly_symbol2scm ("internal-type-checking"))
- {
- internal_type_checking_global_b = to_boolean (val);
- }
+ internal_type_checking_global_b = to_boolean (val);
else if (var == ly_symbol2scm ("old-relative"))
{
lily_1_8_relative = true;
- lily_1_8_compatibility_used = false;
+ /* Needs to be reset for each file that uses this option. */
+ lily_1_8_compatibility_used = false;
}
else if (var == ly_symbol2scm ("new-relative"))
- {
- lily_1_8_relative = false;
- }
+ lily_1_8_relative = false;
else if (var == ly_symbol2scm ("debug-beam"))
{
extern bool debug_beam_quanting_flag;
debug_beam_quanting_flag = true;
}
else
- {
- warning (_("Unknown internal option!"));
- }
+ warning (_f ("No such internal option: %s", ly_scm2string (var)));
return SCM_UNSPECIFIED;
}
-
LY_DEFINE (ly_get_option, "ly:get-option", 1, 0, 0, (SCM var),
"Get a global option setting. Supported options include\n"
"@table @code\n"
"@end table\n"
"\n")
{
+ SCM o = SCM_UNSPECIFIED;
if (var == ly_symbol2scm ("old-relative-used"))
- {
- return ly_bool2scm (lily_1_8_compatibility_used);
- }
- if (var == ly_symbol2scm ("old-relative"))
- {
- return ly_bool2scm (lily_1_8_relative);
- }
- if (var == ly_symbol2scm ("verbose"))
- {
- return ly_bool2scm (verbose_global_b);
- }
+ o = ly_bool2scm (lily_1_8_compatibility_used);
+ else if (var == ly_symbol2scm ("old-relative"))
+ o = ly_bool2scm (lily_1_8_relative);
+ else if (var == ly_symbol2scm ("verbose"))
+ o = ly_bool2scm (verbose_global_b);
else
- {
- warning (_("Unknown internal option!"));
- }
-
- return SCM_UNSPECIFIED;
+ warning (_f ("No such internal option: %s", ly_scm2string (var)));
+ return o;
}
(define-public default-toplevel-music-handler print-music-as-book)
(define-public default-toplevel-book-handler ly:parser-print-book)
(define-public default-toplevel-score-handler print-score-as-book)
-;;(define-public toplevel-music-handler print-music-as-book)
-;;(define-public toplevel-music-handler toplevel-music-functions)
-;;(define-public toplevel-music-handler
-;; (lambda (x y) (print-music-as-book x y)))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;