return ly_string2scm (_ (scm_i_string_chars (string)));
}
-LY_DEFINE (ly_output_backend, "ly:output-backend",
- 0, 0, 0, (),
- "Return name of output backend.")
-{
- return ly_string2scm (output_backend_global);
-}
-
LY_DEFINE (ly_output_formats, "ly:output-formats",
0, 0, 0, (),
"Formats passed to --format as a list of strings, "
#include "lily-guile.hh"
/* options */
-extern bool do_midi_debugging_global;
-extern int testing_level_global;
extern bool lily_1_8_relative;
extern bool lily_1_8_compatibility_used;
SCM ly_set_option (SCM, SCM);
bool get_program_option (const char *);
+string get_output_backend_name ();
#endif /* SCM_OPTION_HH */
#include "sources.hh"
#include "text-metrics.hh"
#include "warn.hh"
+#include "program-option.hh"
#include "ly-smobs.icc"
void
Lily_parser::parse_file (string init, string name, string out_name)
{
- if (output_backend_global == "tex")
+ if (get_output_backend_name () == "tex")
try_load_text_metrics (out_name);
// TODO: use $parser
/* Name of initialisation file. */
string init_name_global;
-/* Selected output backend
- One of (gnome, ps [default], eps, scm, svg, tex, texstr)") */
-string output_backend_global = "ps";
/* Output formats to generate. */
string output_format_global = "";
static Long_option_init options_static[]
= {
- {_i ("BACK"), "backend", 'b', _i ("use backend BACK (eps, gnome, ps [default],\nscm, svg, tex, texstr)")},
-
{_i ("SYM[=VAL]"), "define-default", 'd',
_i ("set Scheme option SYM to VAL (default: #t).\n"
"Use -dhelp for help.")},
if (be_verbose_global)
dir_info (stderr);
- is_TeX_format_global = (output_backend_global == "tex"
- || output_backend_global == "texstr");
is_pango_format_global = !is_TeX_format_global;
init_scheme_variables_global = "(list " + init_scheme_variables_global + ")";
init_freetype ();
ly_reset_all_fonts ();
+ is_TeX_format_global = (get_output_backend_name () == "tex"
+ || get_output_backend_name () == "texstr");
+
/* We accept multiple independent music files on the command line to
reduce compile time when processing lots of small files.
}
init_scheme_variables_global
- += "(cons \'" + key + " " + val + ")\n";
+ += "(cons \'" + key + " '" + val + ")\n";
}
break;
exit (0);
break;
- case 'b':
- output_backend_global = option_parser->optional_argument_str0_;
- break;
-
case 'f':
{
vector<string> components
#include "warn.hh"
#include "stencil.hh"
#include "main.hh"
+#include "program-option.hh"
Modified_font_metric::Modified_font_metric (Font_metric *fm,
Real magnification)
SCM stext = ly_string2scm (text);
Box b;
- if (output_backend_global == "tex")
+ if (get_output_backend_name () == "tex")
{
b = lookup_tex_text_dimension (orig_, stext);
#include "string-convert.hh"
#include "warn.hh"
#include "all-font-metrics.hh"
+#include "program-option.hh"
#if HAVE_PANGO_FT2
#include "stencil.hh"
UGH. Should have flags per output format signifying supported
options.
*/
- if (output_backend_global != "ps"
- && output_backend_global != "eps")
+ string name = get_output_backend_name ();
+ if (name != "ps" && name != "eps")
{
/*
For Pango based backends, we take a shortcut.
#include "paper-system.hh"
#include "text-interface.hh"
#include "warn.hh"
+#include "program-option.hh"
#include "ly-smobs.icc"
if (ly_is_module (header_))
scopes = scm_cons (header_, scopes);
- string mod_nm = "scm framework-" + output_backend_global;
+ string mod_nm = "scm framework-" + get_output_backend_name ();
SCM mod = scm_c_resolve_module (mod_nm.c_str ());
if (make_print)
if (ly_is_module (header_0_))
scopes = scm_cons (header_0_, scopes);
- string format = output_backend_global;
+ string format = get_output_backend_name ();
string mod_nm = "scm framework-" + format;
SCM mod = scm_c_resolve_module (mod_nm.c_str ());
-
-bool
-get_program_option (const char *s)
-{
- SCM sym = ly_symbol2scm (s);
-
- return to_boolean (ly_get_option (sym));
-}
-
-
ssize const HELP_INDENT = 30;
ssize const INDENT = 2;
ssize const SEPARATION = 5;
LY_ASSERT_TYPE (ly_is_symbol, var, 1);
return scm_hashq_ref (option_hash, var, SCM_BOOL_F);
}
+
+
+/*
+ program-option.cc -- program options, non-scheme.
+
+ source file of the GNU LilyPond music typesetter
+
+ (c) 2007 Han-Wen Nienhuys <hanwen@lilypond.org>
+
+*/
+
+#include "program-option.hh"
+
+string
+get_output_backend_name ()
+{
+ return ly_symbol2string (ly_get_option (ly_symbol2scm ("backend")));
+}
+
+bool
+get_program_option (const char *s)
+{
+ SCM sym = ly_symbol2scm (s);
+
+ return to_boolean (ly_get_option (sym));
+}
+
## override from cmd line to speed up.
ANTI_ALIAS_FACTOR=2
LILYPOND_JOBS=$(if $(CPU_COUNT),-djob-count=$(CPU_COUNT),)
-LILYPOND_BOOK_LILYPOND_FLAGS=--backend=eps --formats=ps,png,pdf $(LILYPOND_JOBS) -dinclude-eps-fonts -dgs-load-fonts --header=texidoc -I $(top-src-dir)/input/manual -dcheck-internal-types -ddump-signatures -danti-alias-factor=$(ANTI_ALIAS_FACTOR)
+LILYPOND_BOOK_LILYPOND_FLAGS=-dbackend=eps --formats=ps,png,pdf $(LILYPOND_JOBS) -dinclude-eps-fonts -dgs-load-fonts --header=texidoc -I $(top-src-dir)/input/manual -dcheck-internal-types -ddump-signatures -danti-alias-factor=$(ANTI_ALIAS_FACTOR)
LILYPOND_BOOK_VERBOSE = --verbose
LILYPOND_BOOK_FLAGS = --process="$(LILYPOND_BINARY) $(LILYPOND_BOOK_LILYPOND_FLAGS)" $(LILYPOND_BOOK_VERBOSE)
TEXINPUTS=$(top-src-dir)/tex/::
(define-public (output-framework basename book scopes fields)
(let* ((filename (format "~a.svg" basename))
(outputter (ly:make-paper-outputter (open-file filename "wb")
- (ly:output-backend)))
+ (ly:get-option 'backend)))
(dump (lambda (str) (display str (ly:outputter-port outputter))))
(paper (ly:paper-book-paper book))
(unit-length (ly:output-def-lookup paper 'output-scale))
(let* ((filename (format "~a.texstr" basename))
(outputter (ly:make-paper-outputter
(open-file filename "wb")
- (ly:output-backend)))
+ (ly:get-option 'backend)))
(paper (ly:paper-book-paper book))
(lines (ly:paper-book-systems book)))
(ly:outputter-dump-string outputter (header basename))
(outputter
(ly:make-paper-outputter
(open-file filename "wb")
- (ly:output-backend)))
+ (ly:get-option 'backend)))
(paper (ly:paper-book-paper book))
(pages (ly:paper-book-pages book)))
(ly:outputter-dump-string outputter (header basename))
;; - [subject-]-verb-object-object
(anti-alias-factor 1 "render at higher resolution and scale down result\nto prevent jaggies in PNG")
+ (backend ps "which backend to use by default; Options: eps, ps [default], scm, svg, tex, texstr)")
(check-internal-types #f "check every property assignment for types")
(clip-systems #f "Generate cut-out snippets of a score")
(debug-gc #f "dump memory debugging statistics")
(coverage:enable))
(define-public tex-backend?
- (member (ly:output-backend) '("texstr" "tex")))
+ (member (ly:get-option 'backend) '(texstr tex)))
(define-public parser #f)
p.add_option ('-P', '--process', metavar=_ ("COMMAND"),
help = _ ("process ly_files using COMMAND FILE..."),
action='store',
- dest='process_cmd', default='lilypond -b eps')
+ dest='process_cmd', default='lilypond -dbackend=eps')
p.add_option ('--pdf',
action="store_true",
dest="create_pdf",