--- /dev/null
+/*
+ international.cc -- implement stuff for internationalisation
+
+ source file of the GNU LilyPond music typesetter
+
+ (c) 1997--1998 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ */
+
+#include <stdarg.h>
+#include "config.hh"
+#include "string-convert.hh"
+#include "international.hh"
+
+#if !HAVE_GETTEXT
+inline char*
+gettext (char const* s)
+{
+ return s;
+}
+#else
+#include <libintl.h>
+#endif
+
+String
+_ (char const *ch)
+{
+ return String (gettext (ch));
+}
+
+String
+_f (char const* format, ...)
+{
+ va_list args;
+ va_start (args, format);
+ String str = String_convert::vform_str (gettext (format), args);
+ va_end (args);
+ return str;
+}
+
+String
+_f (char const* format, String s, String s2, String s3)
+{
+ return String_convert::form_str (gettext (format), s.ch_C (), s2.ch_C (),
+ s3.ch_C ());
+}
--- /dev/null
+/*
+ string-storage.hh -- declare String_storage
+
+ source file of the GNU LilyPond music typesetter
+
+ (c) 1998 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ */
+
+#ifndef STRING_STORAGE_HH
+#define STRING_STORAGE_HH
+
+#include "string.hh"
+#include "file-storage.hh"
+
+/**
+ Urg, let String act as file storage.
+ */
+class String_storage : public File_storage, protected String
+{
+public:
+ String_storage (String s) : String (s) { }
+
+protected:
+ virtual char const* ch_C () const { return String::ch_C (); }
+ virtual int length_i () const { return String::length_i (); }
+};
+
+#endif /* STRING_STORAGE_HH */
+
--- /dev/null
+/*
+ mark-engraver.hh -- declare Mark_engraver
+
+ source file of the GNU LilyPond music typesetter
+
+ (c) 1998 Jan Nieuwenhuizen <janneke@gnu.org>
+*/
+
+
+#ifndef MARK_ENGRAVER_HH
+#define MARK_ENGRAVER_HH
+
+#include "engraver.hh"
+
+/**
+ */
+class Mark_engraver : public Engraver
+{
+public:
+ Mark_engraver ();
+
+ TRANSLATOR_CLONE(Mark_engraver);
+ DECLARE_MY_RUNTIME_TYPEINFO;
+
+protected:
+ virtual bool do_try_request (Request *req_l);
+ virtual void do_process_requests ();
+ virtual void do_pre_move_processing ();
+
+private:
+ Mark_req * mark_req_l_;
+ Script* script_p_;
+};
+
+#endif // MARK_ENGRAVER_HH
--- /dev/null
+/*
+ staff-margin-engraver.hh -- declare Staff_margin_engraver
+
+ source file of the GNU LilyPond music typesetter
+
+ (c) 1998 Jan Nieuwenhuizen <janneke@gnu.org>
+*/
+
+
+#ifndef STAFF_MARGIN_ENGRAVER_HH
+#define STAFF_MARGIN_ENGRAVER_HH
+
+#include "engraver.hh"
+
+/**
+ put (instrument) text to left of line
+ */
+class Staff_margin_engraver : public Engraver
+{
+public:
+ TRANSLATOR_CLONE(Staff_margin_engraver);
+ DECLARE_MY_RUNTIME_TYPEINFO;
+
+ Staff_margin_engraver ();
+
+protected:
+ void acknowledge_element (Score_element_info);
+ void do_pre_move_processing ();
+
+private:
+ Script * script_p_;
+};
+
+#endif // STAFF_MARGIN_ENGRAVER_HH
--- /dev/null
+/*
+ time_signature-performer.hh -- declare Time_signature_performer
+
+ source file of the GNU LilyPond music typesetter
+
+ (c) 1997--1998 Jan Nieuwenhuizen <janneke@gnu.org>
+*/
+
+#ifndef METER_PERFOMER_HH
+#define METER_PERFOMER_HH
+
+#include "lily-proto.hh"
+#include "performer.hh"
+
+class Time_signature_performer : public Performer {
+public:
+ TRANSLATOR_CLONE(Time_signature_performer);
+ DECLARE_MY_RUNTIME_TYPEINFO;
+ Time_signature_performer();
+ ~Time_signature_performer();
+
+protected:
+ void do_print() const;
+ virtual bool do_try_request (Request* req_l);
+ virtual void do_process_requests();
+
+private:
+ Time_signature_change_req* time_signature_req_l_;
+};
+
+#endif // METER_PERFOMER_HH
--- /dev/null
+/*
+ mark-engraver.cc -- implement Mark_engraver
+
+ source file of the GNU LilyPond music typesetter
+
+ (c) 1998 Jan Nieuwenhuizen <janneke@gnu.org>
+*/
+
+#include "mark-engraver.hh"
+#include "text-def.hh"
+#include "script.hh"
+#include "paper-def.hh"
+#include "command-request.hh"
+#include "time-description.hh"
+#include "engraver-group.hh"
+
+IMPLEMENT_IS_TYPE_B1 (Mark_engraver, Engraver);
+ADD_THIS_TRANSLATOR (Mark_engraver);
+
+Mark_engraver::Mark_engraver ()
+{
+ mark_req_l_ = 0;
+ script_p_ = 0;
+}
+
+bool
+Mark_engraver::do_try_request (Request* r_l)
+{
+ Command_req* c_l = r_l->access_Command_req ();
+ if (!c_l || !c_l->access_Mark_req () || mark_req_l_)
+ return false;
+
+ mark_req_l_ = c_l->access_Mark_req ();
+
+ return true;
+}
+
+void
+Mark_engraver::do_process_requests ()
+{
+ if (!mark_req_l_ || script_p_)
+ return;
+
+ script_p_ = new Script;
+ script_p_->breakable_b_ = true;
+
+ Text_def *td_p = new Text_def;
+
+ td_p->text_str_ = mark_req_l_->str_;
+ td_p->align_dir_ = CENTER;
+
+ td_p->style_str_ = td_p->text_str_.index_any_i ("0123456789") >= 0
+ ? "mark" : "Large";
+
+ script_p_->dir_ = UP;
+ script_p_->specs_p_ = td_p->clone ();
+ script_p_->postbreak_only_b_ = true;
+
+ Scalar padding = get_property ("markScriptPadding");
+ if (padding.length_i() && padding.isnum_b ())
+ {
+ script_p_->padding_f_ = Real(padding);
+ }
+ Scalar break_priority = get_property ("markBreakPriority");
+ if (break_priority.length_i() && break_priority.isnum_b ())
+ {
+ script_p_->break_priority_i_ = int(break_priority);
+ }
+
+ announce_element (Score_element_info (script_p_, mark_req_l_));
+}
+
+void
+Mark_engraver::do_pre_move_processing ()
+{
+ if (script_p_)
+ {
+ typeset_element (script_p_);
+ script_p_ = 0;
+ mark_req_l_ = 0;
+ }
+}
+
--- /dev/null
+/*
+ staff-margin-engraver.cc -- implement Staff_margin_engraver
+
+ source file of the GNU LilyPond music typesetter
+
+ (c) 1998 Jan Nieuwenhuizen <janneke@gnu.org>
+*/
+
+#include "staff-margin-engraver.hh"
+#include "script.hh"
+#include "text-def.hh"
+#include "paper-def.hh"
+#include "command-request.hh"
+#include "bar.hh"
+#include "stem.hh"
+#include "time-description.hh"
+
+IMPLEMENT_IS_TYPE_B1 (Staff_margin_engraver, Engraver);
+ADD_THIS_TRANSLATOR (Staff_margin_engraver);
+
+Staff_margin_engraver::Staff_margin_engraver ()
+{
+ script_p_ = 0;
+}
+
+
+
+/*
+ TODO
+ fix alignment/support
+
+ should be able to set whole paragraph (multiple lines, centre) to
+ left (right?) of staff, e.g.:
+ ______
+ |_______
+ 2 Clarinetti |________
+ (Bb) |___________
+ |______________
+*/
+void
+Staff_margin_engraver::acknowledge_element (Score_element_info i)
+{
+ Item * it = i.elem_l_->access_Item ();
+
+ if (!it
+ || script_p_
+ || !it->is_type_b (Bar::static_name())
+ || (i.origin_grav_l_arr_.size() != 1))
+ return;
+
+ String string = get_property ("instrument");
+ String str = get_property ("instr");
+ if (now_moment () > Moment (0))
+ string = str;
+
+ if (!string.length_i ())
+ return;
+
+ script_p_ = new Script;
+ script_p_->axis_ = X_AXIS;
+
+ Text_def *td_p =new Text_def;
+ td_p->align_dir_ = LEFT;
+ td_p->text_str_ = string;
+ // huh?
+ script_p_->dir_ = RIGHT;
+ script_p_->specs_p_ = td_p;
+ script_p_->breakable_b_ = true;
+
+
+ Scalar pri = get_property ("marginBreakPriority");
+ if (pri.length_i () && pri.isnum_b ())
+ {
+ script_p_->break_priority_i_ = int (pri);
+ }
+ else
+ script_p_ ->break_priority_i_ = it->break_priority_i_;
+
+ announce_element (Score_element_info (script_p_, 0));
+}
+
+void
+Staff_margin_engraver::do_pre_move_processing ()
+{
+ if (script_p_)
+ {
+ typeset_element (script_p_);
+ script_p_ =0;
+ }
+}
+
--- /dev/null
+/*
+ time_signature-performer.cc -- implement Time_signature_performer
+
+ source file of the GNU LilyPond music typesetter
+
+ (c) 1997--1998 Jan Nieuwenhuizen <janneke@gnu.org>
+*/
+
+#include "time-signature-performer.hh"
+#include "command-request.hh"
+#include "audio-item.hh"
+
+IMPLEMENT_IS_TYPE_B1(Time_signature_performer,Performer);
+ADD_THIS_TRANSLATOR(Time_signature_performer);
+
+Time_signature_performer::Time_signature_performer()
+{
+ time_signature_req_l_ = 0;
+}
+
+Time_signature_performer::~Time_signature_performer()
+{
+}
+
+void
+Time_signature_performer::do_print() const
+{
+#ifndef NPRINT
+ if (time_signature_req_l_)
+ time_signature_req_l_->print();
+#endif
+}
+
+void
+Time_signature_performer::do_process_requests()
+{
+ if (time_signature_req_l_)
+ play (new Audio_time_signature (time_signature_req_l_));
+ time_signature_req_l_ = 0;
+}
+
+bool
+Time_signature_performer::do_try_request (Request* req_l)
+{
+ if (time_signature_req_l_)
+ return false;
+
+ if (req_l->access_Command_req ())
+ time_signature_req_l_ = req_l->access_Command_req ()->access_Time_signature_change_req ();
+
+ if (time_signature_req_l_)
+ return true;
+
+ return false;
+}
+
--- /dev/null
+#!@PYTHON@
+
+# table-to-html.py -- convert char-separated table to html table
+#
+# source file of the GNU LilyPond music typesetter
+#
+# (c) 1998 Jan Nieuwenhuizen <janneke@gnu.org>
+
+version = '0.1'
+name = 'table-to-html'
+
+import os
+import sys
+
+import getopt
+from string import *
+import regex
+import regsub
+import time
+
+def program_id ():
+ return name + ' version ' + version;
+
+def identify ():
+ sys.stdout.write (program_id () + '\n')
+
+def help ():
+ sys.stdout.write ("Usage: table-to-html [OPTION]... TABLE-FILE HTML-FILENAME\n"
+ + "Generate pretty table from char separated table\n\n"
+ + "Options:\n"
+ + " -h, --help print this help\n"
+ + " -p, --package=DIR specify package\n"
+ + " -s, --separator=SEP specify separator [:]\n"
+ + " -t, --latex do latex output instead\n"
+ )
+
+ sys.exit (0)
+
+
+def header (html):
+ html.write ('<body bgcolor=white><table cellspacing=10>')
+
+def footer (html):
+ html.write ('</table></body>')
+
+def convert_html (inname, outname, separator):
+ # urg, again?
+ from flower import *
+ table = File (inname)
+ # ugh
+ html = File (outname, 'w')
+
+ header (html)
+ i = 0
+ while not table.eof ():
+ line = table.readline ()
+ i = i + 1
+ if not len(line):
+ continue
+ columns = split (line, separator)
+ html_line = '<tr><td>' + join (columns, '</td><td>') + '</td></tr>'
+ html.write (html_line)
+ if len (columns) < 7:
+ print inname + ': ' + str(i) + ':warning: not enough cols\n'
+ continue
+ if len (columns) > 7:
+ print inname + ': ' + str(i) + ':warning: too many cols\n'
+ continue
+
+ table.close ()
+ footer (html)
+ html.close ()
+
+def convert_tex (inname, outname, separator):
+ # urg, again?
+ from flower import *
+ table = File (inname)
+ # ugh
+ html = File (outname, 'w')
+
+ i = 0
+ while not table.eof ():
+ line = table.readline ()
+ i = i + 1
+ if not len(line):
+ continue
+ columns = split (line, separator)
+ if len (columns) < 7:
+ print inname + ': ' + str(i) + ':warning: not enough cols\n'
+ continue
+ if len (columns) > 7:
+ print inname + ': ' + str(i) + ':warning: too many cols\n'
+ continue
+
+ html_line = '\\tableentry{' + join (columns, '}{') + '}\n'
+ html.write (html_line)
+ table.close ()
+ html.close ()
+
+def main ():
+ identify ()
+ (options, files) = getopt.getopt (
+ sys.argv[1:], 'to:hp:s:', ['help', 'latex', 'output=', 'package=', 'separator='])
+ latex = 0
+ separator = ':'
+ output = ''
+ for opt in options:
+ o = opt[0]
+ a = opt[1]
+ if o == '--separator' or o == '-s':
+ separator = a
+ elif o== '--help' or o == '-h':
+ help ()
+ elif o=='--latex' or o == '-t':
+ latex = 1
+ elif o == '--output' or o == '-o':
+ output = a
+ elif o == '--package' or o == '-p':
+ topdir=a
+ else:
+ print o
+ raise getopt.error
+
+ sys.path.append (topdir + '/stepmake/bin')
+ from packagepython import *
+ package = Package (topdir)
+ packager = Packager ()
+
+ from flower import *
+
+ if latex:
+ convert_tex (files[0], output, separator)
+ else:
+ convert_html (files[0], output, separator)
+
+main ()
+
--- /dev/null
+#!@PYTHON@
+
+# update.py -- update current source tree
+#
+# source file of the GNU LilyPond music typesetter
+#
+# (c) 1998 Jan Nieuwenhuizen <janneke@gnu.org>
+
+program_name = 'update'
+version = '0.1'
+
+import os
+import sys
+
+sys.path.append ('@abs-step-bindir@')
+sys.path.append (os.environ['HOME'] + '/usr/src/lilypond/stepmake/bin')
+
+import getopt
+from string import *
+import regex
+import regsub
+import time
+
+def program_id ():
+ return program_name + ' version ' + version;
+
+def identify ():
+ sys.stdout.write (program_id () + '\n')
+
+def help ():
+ sys.stdout.write ("Usage: %s [OPTION]...\n"
+ "Update sourcetree\n\n"
+ + "Options:\n"
+ + " -f, --file=FILE specify patch file\n"
+ + " -h, --help print this help\n"
+ + " -p, --package=DIR specify package\n"
+ + " -v, --version=VER specify patch version\n"
+ % (program_name)
+ )
+ sys.exit (0)
+
+identify ()
+(options, files) = getopt.getopt (
+ sys.argv[1:], 'f:hp:v:', ['file=', 'help', 'package=', 'version='])
+patch=''
+ver=''
+for opt in options:
+ o = opt[0]
+ a = opt[1]
+ if o == '--help' or o == '-h':
+ help ()
+ elif o == '-f' or o == '--file':
+ patch = a
+ elif o == '-p' or o == '--package':
+ topdir = a
+ elif o == '-v' or o == '--version':
+ ver = a
+ else:
+ print o
+ raise getopt.error
+
+sys.path.append (topdir + '/stepmake/bin')
+from packagepython import *
+package = Package (topdir)
+packager = Packager ()
+
+from flower import *
+
+def read_patch_vector (patch):
+ vec = []
+ pipe = os.popen ('gzip -dc ' + patch)
+ line = pipe.readline ()
+ while line and line != '--state\n':
+ line = pipe.readline ()
+ line = pipe.readline ()
+ while line and line != '++state\n':
+ vec.append (line[:len (line)-1])
+ line = pipe.readline ()
+ pipe.close ()
+ return vec
+
+def read_state_vector (states):
+ vec = []
+ file = File (states)
+ while not file.eof ():
+ line = file.readline ()
+ if line:
+ vec.append (line[:len (line)-1])
+ return vec
+
+def read_relevant_state_vector (states, from_str):
+ vec = read_state_vector (states)
+ for i in range (len (vec)):
+ if vec[i] == from_str:
+ return vec[i:]
+ return []
+
+def find_revert (states, patch):
+ for i in range (len (state_vector)):
+ for j in doubles:
+ if j in state_vector[:i+1]:
+ return state_vector[i:]
+ return []
+
+if patch == '' and ver != '':
+ patch = package.patch_dir + '/' + package.name + '-%s.diff.gz' % ver
+if patch == '':
+ if 0:
+ files = os.listdir (package.patch_dir)
+ patches = []
+ for i in files:
+ if regex.search (package.name + '-.*.diff.gz', i) == 0:
+ patches.append (i)
+ # urg: sort
+ patch = package.patch_dir + '/' + patches[len (patches) -1]
+ else:
+ os.chdir (package.patch_dir)
+ pipe = os.popen ('/bin/ls -t1 ' + package.name
+ + '-*.diff.gz 2> /dev/null')
+ patch = pipe.readline ()
+ patch = patch[:len (patch) -1]
+ pipe.close ()
+ if not patch:
+ raise 'patch not found'
+ patch = package.patch_dir + '/' + patch
+ print patch
+
+os.chdir (package.topdir)
+patch_vector = read_patch_vector (patch)
+print 'patch vector: ' + str (patch_vector)
+from_str = patch_vector[0]
+state_vector = read_relevant_state_vector ('make/STATE-VECTOR', from_str)
+print 'relevant state vector: ' + str (state_vector)
+
+doubles = []
+for i in patch_vector[1:]:
+ if i in state_vector:
+ doubles.append (i)
+print 'doubles: ' + str (doubles)
+
+revert = find_revert (state_vector, patch_vector)
+redo = []
+for i in revert:
+ redo.append (i)
+revert.reverse ()
+
+for i in doubles:
+ redo.remove (i)
+
+if revert or redo or doubles:
+ print 'not smart enough; please do:'
+ print ' * revert: ' + str (revert)
+ print ' * apply: ' + os.path.basename (patch)
+ print ' * redo: ' + str (redo)
+ sys.exit (1)
+
+status = os.system ('echo "gzip -dc %s | patch -p1 -E --force"' % patch)
+if status:
+ raise 'apply patch failed'
+
+sys.stdout.write ('checking...')
+rejects = my_find (['*.rej'], '.')
+if len (rejects):
+ print 'rejects found:'
+ for i in rejects:
+ print i
+ sys.exit (1)
+print 'ok'
+sys.stdout.write ('cleaning...')
+origs = my_find (['*.orig'], '.')
+for i in origs:
+ os.remove (i)
+print 'ok'