# class name silence?
Dstream 1
-My_flex_lexer 1
-yyFlexLexer 1
+My_flex_lexer 0
PCol 1
Score_column 1
Ineq_constrained_qp 1
# yydebug
InitParser 1
-Parser 1
+Parser 0
InitDeclarations 1
# FlexLexer debug
# use to send patches, always empty for released version:
# include separator: ".postfix", "-pl" makes rpm barf
-TOPLEVEL_MY_PATCH_LEVEL =
+TOPLEVEL_MY_PATCH_LEVEL =.3
#
-[Draft version]
+
[Draft version]
CALL FOR HACKERS: LilyPond, the Music Typesetter
Functions and methods do not return errorcodes, but use assert for
checking status.
- A program should be light and agile, its subroutines
- connected like a strings of pearls. The spirit and intent of
- the program should be retained throughout. There should be
- neither too little nor too much, neither needless loops nor
- useless variables, neither lack of structure nor overwhelming
- rigidity.
-
- A program should follow the 'Law of Least
- Astonishment'. What is this law? It is simply that the
- program should always respond to the user in the way that
- astonishes him least.
-
- A program, no matter how complex, should act as a
- single unit. The program should be directed by the logic
- within rather than by outward appearances.
-
- If the program fails in these requirements, it will be
- in a state of disorder and confusion. The only way to correct
- this is to rewrite the program.
- -- Geoffrey James, "The Tao of Programming"
+=head2 Quote:
+
+A program should be light and agile, its subroutines
+connected like a strings of pearls. The spirit and intent of
+the program should be retained throughout. There should be
+neither too little nor too much, neither needless loops nor
+useless variables, neither lack of structure nor overwhelming
+rigidity.
+
+A program should follow the 'Law of Least
+Astonishment'. What is this law? It is simply that the
+program should always respond to the user in the way that
+astonishes him least.
+
+A program, no matter how complex, should act as a
+single unit. The program should be directed by the logic
+within rather than by outward appearances.
+
+If the program fails in these requirements, it will be
+in a state of disorder and confusion. The only way to correct
+this is to rewrite the program.
+
+-- Geoffrey James, "The Tao of Programming"
=head2 INDENTATION
NB: in PCursor (which is part of the library) P stands for PointerCursor
-=head2 MEMBERS(2)
+=head2 MEMBERS (2)
Standard methods:
=over 5
=item *
+
more keystrokes (disk space!)
=item *
+
it looks silly C<get_slu_p()>
=item *
+
it looks like code from micro suckers
=item *
+
(which) might scare away some (otherwise good?)
progammers, or make you a paria in the free
software community
=item *
+
it has ambiguities
=item *
+
not very useful if not used consistently
=item *
+
usefullness in I<very large>
(but how many classes is very large?)
remains an issue.
=over 5
=item *
+
learn about cut and paste / use emacs or vi
or lean to type using ten fingers
=item *
+
Use emacs dabbrev-expand, with dabbrev-case-fold-search set to nil.
=item *
+
use no, or pick less silly, abbrvs.
=item *
+
use non-ambiguous postfixes C<identifier_name_type_modifier[_modifier]>
=back
=over 5
=item C<byte>
+
+
unsigned char. (The postfix _by is ambiguous)
=item C<b>
+
+
bool
=item C<bi>
+
bit
=item C<ch>
+
char
=item C<f>
+
float
=item C<i>
+
signed integer
=item C<str>
+
string class
=item C<sz>
+
Zero terminated c string
=item C<u>
+
unsigned integer
=back
=over 5
=item C<a>
+
array
=item C<array>
+
user built array.
=item C<c>
-const
+
+const. Note that the proper order C<Type const> i.s.o. C<const Type>
=item C<l>
+
temporary pointer to object (link)
=item C<p>
+
pointer to newed object
=item C<r>
+
reference
=back
=over 5
=item C<loop_i>
+
Variable loop: an integer
=item C<u>
+
Temporary variable: an unsigned integer
=item C<test_ch>
+
Variable test: a character
=item C<first_name_str>
+
Variable first_name: a String class object
=item C<last_name_ch_a>
+
Variable last_name: a C<char> array
=item C<foo_i_p>
+
Variable foo: an C<Int*> that you must delete
=item C<bar_i_l>
+
Variable bar: an C<Int*> that you must not delete
=back
# identify module:
#
NAME = Documentation
-MAJOR_VERSION = $(TOPLEVEL_MAJOR_VERSION)
-MINOR_VERSION = $(TOPLEVEL_MINOR_VERSION)
-PATCH_LEVEL = $(TOPLEVEL_PATCH_LEVEL)
-# use to send patches, always empty for released version:
-MY_PATCH_LEVEL = $(TOPLEVEL_MY_PATCH_LEVEL)
-build = ./$(depth)/lily/$(outdir)/.build
+
#
# generic variables:
#
include ./$(depth)/make/Variables.make
+include ./$(depth)/make/Version.make
+include ./$(depth)/make/Files.make
#
-# list of source files:
#
-PODFILES = $(shell ls *.pod)
+
OUTPODFILES = $(patsubst %,$(outdir)/%,$(PODFILES))
TEXTFILES = $(OUTPODFILES:.pod=.text)
GROFFFILES = $(OUTPODFILES:.pod=.1)
# list of distribution files:
#
-DISTFILES = $(PODFILES) Makefile lelie_logo.gif
+EXTRA_DISTFILES = lelie_icon.gif lelie_logo.gif
#
default: do-doc
Some questions that have been answered before.
+Q: I can type
+
+ <a c> <e g>
+
+to make a few chords, but why do I have to type
+
+
+ < { a() e } { c () g } >
+
+in stead of
+
+ <a( c(> <)e )g>
+
+to generate slurs between the chords?
+
+A: When you type
+
+ <a c> <e g>
+
+this is shorthand for
+
+ < { a } { c } > < { e } { g } >
+
+Slurs have to be confined to `voices', and the a and the e are in
+different {} blocks, so they are in different voices. You should view
+the desired construct as a "generalised chord" (two voices stacked
+vertically). It might help you visualise this by using the following
+formatting:
+
+ < { a () e }
+ { c () g }
+ >
+
+
Q: Why are [] around the notes, and () inbetween?
A: [] designate beams, a note can only be in one beam at the same
registers. There are a few groups:
=item *
+
Staff wide, contains
+
Local_key_register
Bar_register
Key_register
Clef_register
=item *
+
Voice group, contains
+
Stem_beam_register
Script_register
Text_register
=item *
+
Voice, contains
+
Slur_register
Notehead_register
Miami, FL 33139
(305) 532-5461
-[This is about *engraving* i.e. professional music typesetting, and includes
+[This is about I<engraving> i.e. professional music typesetting, and includes
some good spacing tables]
Read, Gardner. ``Modern Rhythmic Notation.'' Indiana University Press, 1978.
--- /dev/null
+=head1 NAME
+
+LilyInput - LilyPond input format
+
+=head1 DESCRIPTION
+
+This page globally documents the the LilyPond input format, mudela.
+To get a better impression, please study some examples.
+
+=head2 Overview
+
+General format of a construct:
+
+ BLOCKNAME { <info to go with this block> }
+
+Some types allow declarations:
+
+ IDENTIFIER = BLOCKNAME {
+ <info to go with this block>
+ }
+
+ ..
+
+ BLOCKNAME {
+ IDENTIFIER
+ ...
+ }
+
+
+In musicmode, eg,
+
+ ''!c8.-"text"_v
+
+and in lyricmode, eg,
+
+ Twin- kle, twin- kle lit- tle star,2
+
+a lot of characters parse differently
+than in "command" mode, eg,
+
+ identifier = score { .. }
+
+So you have to signal this to the tokenizer. This is done with
+'$'. '$' is a delimiter, which used by the tokenizer only. The same
+goes for lyrics, it has a '@' delimiter.
+
+=item *
+musicmode: The brace still is used to group grammatical groups.
+
+=item *
+musicmode: "word" are preceded by a '\' (backslash)
+
+This means you can write some stuff in a zillion ways:
+
+=item 1.
+ $\var = \blockname { ... } $
+
+=item 2.
+ var = blockname { $ ... $ }
+
+=item 3.
+ var = $ $ $\blockname { ... $ }
+
+=head2 Comments
+
+Not really crystallized; you can use '#' or '%' as line comment
+
+=head2 other
+
+LilyPond first reads 'symbol.ini', which contains declarations crucial
+to proper operation of LilyPond (symbol tables, note names).
+
+This language looks a lot like Rayce's (Rayce is a raytracer that I've
+written as a hobby project. I used as a practice program for writing
+(among others) C++ and Yacc. It also gave me RSI :-( ) which in turn
+owes a lot to the POVRay raytracer. Now, I know, musictypesetting and
+Raytracing do not necessarily require the same input format, but I was
+just to lazy to make up a new and/or better input format. Suggestions
+appreciated.
=head1 NAME
-LilyInput - LilyPond input format
+LilyInput - LilyPond input format -- Mudela 0.1
+
+B<NOTICE:> this doc describes the I<new> input format, S<Mudela 0.1>.
=head1 DESCRIPTION
-This page globally documents the the LilyPond input format, mudela.
-To get a better impression, please study some examples.
+This document describes the the LilyPond input format, which is an
+effective language for definining music. We call this language
+(rather arrogantly) The Musical Definition Language (S<Mudela 0.1>).
-=head2 Overview
+The first aim of Mudela is to define a piece of music,
+being complete from both from a musical typesetting,
+as from a musical performing point of view.
-General format of a construct:
+The design of Mudela has been (perfect past tense, hopefully)
+an ongoing process,
+the most important criteria being:
- BLOCKNAME { <info to go with this block> }
+=over 4
-Some types allow declarations:
+=item *
- IDENTIFIER = BLOCKNAME {
- <info to go with this block>
- }
+define the (musical) message of the composer as unambiguously as possible,
- ..
+=item *
- BLOCKNAME {
- IDENTIFIER
- ...
- }
+be intuitive, and easily readable
+(compared to, say, Musi*TeX input, or MIDI :-),
+
+=item *
+
+be writable in ASCII with a simple texteditor, yfte(TM).
+
+=back
+
+Other considerations were (and will be):
+
+=over 4
+
+=item *
+
+be able to edit the layout
+without danger of changing the original music (Urtekst),
+
+=item *
+
+allow for adding different interpretations, again,
+without danger of changing the original,
+
+=item *
+
+easy to create a conductor's score,
+as well as the scores for all individual instruments,
+=item *
+
+provide simple musical manipulations, such as
+S<(i) extracting> a slice of music from a previously defined piece,
+S<(ii) extracting> only the rhythm from a piece of music,
+S<(iii) transposing>, etc.,
+
+=item *
+
+easy to comprehend to both programmers and others.
+
+=back
+
+Musical pieces could be
+
+=over 5
+
+=item *
-In musicmode, eg,
+Mahlerian orchestral scores,
- ''!c8.-"text"_v
+=item *
-and in lyricmode, eg,
+piano pieces (Schubertian, Rachmaninovian),
- Twin- kle, twin- kle lit- tle star,2
+=item *
-a lot of characters parse differently
-than in "command" mode, eg,
+pop songs (lyrics and chords),
- identifier = score { .. }
+=item *
-So you have to signal this to the tokenizer. This is done with
-'$'. '$' is a delimiter, which used by the tokenizer only. The same
-goes for lyrics, it has a '@' delimiter.
+gregorian chants,
=item *
-musicmode: The brace still is used to group grammatical groups.
+
+Bach multivoice organ pieces,
=item *
-musicmode: "word" are preceded by a '\' (backslash)
-This means you can write some stuff in a zillion ways:
+short excerpts to be used in musicological publications.
+
+=back
-=item 1.
- $\var = \blockname { ... } $
-=item 2.
- var = blockname { $ ... $ }
+=head1 Overview
-=item 3.
- var = $ $ $\blockname { ... $ }
+The Musical Definition Language (Mudela) S<version 0.1>,
+has a logical structure,
+making use of typing and naming (using identifiers),
+that allows for flexible input, and definition reuse.
=head2 Comments
-Not really crystallized; you can use '#' or '%' as line comment
+Line comments are introduced by a C<%>
+
+=head2 Keywords
+
+Keywords are preceded by a backslash "\".
+
+The actual musical part of Mudela that defines a melody, is known as
+I<simple mudela>.
+
+Mudela uses the brace (C<{> and C<}>) for hierarchical structures. To
+aid the eye in reading, for chords we have used the C<<> and the C<>>
+as nesting braces.
+
+
+The general structure consists of declarations:
+
+ IDENTIFIER = \TYPE{
+ <type specific data>
+ }
+
+and instantiations:
+
+ \TYPE{ <type specific data> }
+
+(Currently, C<\score> is the only type that can be instantiated
+at top level. Currently declarations can only be done at top level)
+
+Most instantiations that use an IDENTIFIER are specified as follows:
+
+ \TYPE { IDENTIFIER [...] }
+
+Some exceptions on this rule have been made to prevent inputting
+Mudela becoming tedious
+
+=head1 Music
+
+=head2 Simple mudela
+
+Simple mudela is the most common type of music. It consists of a list
+of notes, chords, and commands. The below included for explanatory
+purposes only (i.e., for a complete and up-to-date definition, see
+F<lily/parser.y> and F<lily/lexer.l>):
+
+Simple mudela basically is a sequence of the notes you want to
+enter.
+
+ a'4 % dutch names
+
+is a A-1 pitched quaver. The ' signifies an octave change.
+A-1 is 440 Hz concert-pitch. C<c'> is also known as the central
+c. More examples:
+
+ a` % 110
+ a % 220
+ a' % 440
+ a'' % 880
+
+another example:
+
+ as`4.*2/3
+
+This is an A flat, (just below 110 Hz concert-pitch). The C<*2/3>
+signifies that this note is part of a triplet (3 in stead of 2). The
+duration is one and a half quaver times 2/3.
+
+The default language for notenames is defined to be dutch,
+
+ % double sharp
+ cisis disis eisis fisis gisis aisis bisis
+ % sharps
+ cis dis eis fis gis ais bis
+ % naturals
+ c d e f g a b
+ % flats
+ ces des es fes ges as bes
+ % double flats
+ ceses deses eses feses geses ases beses
+
+The standard notenames also have uppercase versions, which octavate
+down:
+
+ a % 220
+ A % 110
+ 'A % 55
+ A' % 220
+
+These notenames along with duration is enough material to construct
+simple melodies:
+
+ c4 c4 g4 g4 a4 a4 g2
+ f4 f4 e4 e4 d4 d4 c2
+
+Music is able to express more. generally speaking, the other
+'features' are either connected between notes (slurs, beams: spanning
+requests) or attached to notes (eg. accents). The former are
+implemented as START and STOP stop features and then attached to the note.
+
+ [] START/STOP a beam
+ () START/STOP a slur
+
+
+example:
+
+ [c8 () d8 () e8 ]
+
+Please note that these two parentheses do I<not> necesarrily nest, eg:
+
+ [c8 e8(] [)g8 c'8]
+
+
+Symbols which can be put at either side of a staff are entered as follows:
+
+ a-^ % marcato, direction: default
+ a^- % portato, direction: above note
+ a_. % staccato, direction: below note
+ a^\script { "symbolindex" . . . } % see script.ini for details.
+
+Dynamics can be put after the notename:
+
+ a4 \dynamic { 0 } % 0 = fff, 7 = ppp
+
+Mudela defines the following dynamic identifiers:
+
+ ppp pp p mp mf df ff fff % df iso f, f is a notename.
-=head2 other
+The general form of a note is:
-LilyPond first reads 'symbol.ini', which contains declarations crucial
+ post-requests de-octavate notename octavate duration pre-requests
+
+Notenames are just identifiers, and can be declared for any
+language appropriate (see F<dutch.ini>).
+
+
+=head2 Lyrics
+
+Lyrics in Mudela resemble Simple mudela a lot,
+with notes substituted by text.
+All syllables are entered separately, separated by whitespace
+("Twin-4 kle4 twin-4 kle4 ... ").
+Two syllables or words that compose a single duration entry
+are bound together using an underscore ("He_could4 not4").
+
+=head2 Rhythms
+
+Rhythms in Mudela are entered identical to Simple mudela.
+The melodic part of the information is ignored.
+
+=head1 STRUCTURE
+
+In concrete, a piece of Mudela has the following structure:
+
+ % declare pieces of music:
+ melody = \music{ <simple mudela> }
+ accompany = \music{ <simple mudela> }
+
+ % instantiate (=create tex, midi output) the score:
+ \score{
+ \staff{ melody }
+ \staff{ accompany }
+ \commands{ <score global commands> }
+ \midi{ <midi definitions> }
+ \paper{ <paper and layout definitions }
+ }
+
+=head2 Examples
+
+Examples are included with the LilyPond distribution. For the sake of
+maintenance no long examples are included in this document.
+
+
+=head2 Other
+
+LilyPond first reads F<symbol.ini>, which contains declarations crucial
to proper operation of LilyPond (symbol tables, note names).
-This language looks a lot like Rayce's (Rayce is a raytracer that I've
-written as a hobby project. I used as a practice program for writing
-(among others) C++ and Yacc. It also gave me RSI :-( ) which in turn
-owes a lot to the POVRay raytracer. Now, I know, musictypesetting and
-Raytracing do not necessarily require the same input format, but I was
-just to lazy to make up a new and/or better input format. Suggestions
-appreciated.
+=head1 Decisions (Sat 1997-3-15, dommelpijpje no21)
+
+=over 4
+
+=item *
+
+\keyword, bo difference notes vs. notenames,
+
+=item *
+
+{} hierachical, nest.,
+
+=item *
+
+<> chords,
+
+=item *
+
+drop staff (NOT)?,
+
+=item *
+
+melody = \melodic{ } vs. \melodic melody = { }
+
+=item *
+
+lexer mode switch by types: \lyric{ }, \melodic{ }, etc.,
+
+=item *
+
+octaves: low 'C C c c' c'' high; 'c' == c === "c-klein", comment: a '
+' a . Which ' for which a? Now using a!'`.
+
+=over 4
+
+=item *
+
+\meter{ 2/4 },
+
+=item *
+
+\grouping{ 2*8 3*8 },
+
+=item *
+
+\skip{ 2: 2*8 3*32 },
+
+=item *
+
+abbrev: [c2 c2]\noplet{1/2} (wat bout [c2 c2]1/2\noplet?),
+
+=item *
+
+abbrev: c4=16 (heu, =?),
+
+=item *
+
+plet === midi-note: c4*2/3; c4*385/384,
+
+=back
+
+=item *
+
+drop \music,
+
+=item *
+
+\meter compulsory in Simple mudela,
+
+=item *
+
+++ concat
+
+=item *
+
+C<+> is merge
+
+=item *
+
+ \transpose{ \from c \to g \melodic{ c d e } }
+ \transpose{ \from c \to g melody } %!?
+
+=item *
+
+ \extract{ \from 2:3*4 \to 5 oboe }
+
+=back
+
=over 5
=item *
+
ASCII script input, with identifiers (for music reuse),
customizable notenames, customizable fontset
=item *
+
MIDI output lets you check if you have entered the correct notes.
=item *
+
MIDI to Mudela conversion through the mi2mu program.
=item *
+
Multiple staffs in one score. Each staff can have a different meters.
=item *
+
multiple stafftypes (melodic, rhythmic) [broken from pl28 on]
=item *
+
beams, slurs, chords, super/subscripts (accents and text),
triplets, general n-plet (triplet, quadruplets, etc.), lyrics
=item *
+
multiple voices within one staff; beams optionally shared
between voices. (well, more than 2 voices won't look pretty --yet.)
=item *
+
multiple scores within one input file. Each score is output to
a different file.
=item *
+
clef changes, meter changes, cadenza-mode, key changes, repeat bars
=back
=over 5
=item *
+
Describing a well-defined language for defining music. We call
this language (rather arrogantly) The Musical Definition Language
(mudela for short). LilyPond reads a mudela sourcefile and outputs a
-TeX file. This musical definition language should:
-
-=over 5
-
-=item 1.
-define the musical message of the writer as unambigiously as
-possible.
-
-=item 2.
-be easily readable. (as compared to, say, MusixTeX input)
-
-=item 3.
-be writable in ASCII (with a simple texteditor).
-
-=back
-
-At this time, the language isn't yet defined precisely. It is evolving as
-LilyPond is getting more complex.
+TeX file.
=item *
+
We want to provide an easy-to-use interface for typesetting music in
its broadest sense. This interface should be intuitive from a musical
point of view. By broadest sense we mean: it is designed for music
pitch.
=item *
+
LilyPond uses MusiXTeX fonts and TeX for its output. This is not a key
issue: in a future version, LilyPond might bypass TeX, but at the moment
TeX is very convenient for producing output.
=item *
+
Generate high-quality output. Ideally it should be of a professional
quality. We'd like to render Herbert Chlapiks words, "Fine music
setting is not possible without a knowledgeable printer," untrue.
=item *
+
LilyPond does not display notes directly, nor will it be rehacked to be
used interactively. LilyPond writes output to a file. It will not be
extended to play music, or to recognize music.
=item *
+
LilyPond is intended to run on Unix platforms, but it should
be portable to any platform which can run TeX and the GNU tools
=item *
+
LilyPond is free. Commercial windows packages for setting music are
abundant. Free musicprinting software is scarce.
=item *
+
LilyPond is written in GNU C++. It will not be downgraded/ported to fit
broken systems.
=back
-=head1
+=head1
DISCLAIMER & COPYING POLICY
LilyPond is copyright 1996,97 by its authors. LilyPond is
=over 5
=item *
+
Han-Wen Nienhuys <hanwen@stack.nl>, Main author
=item *
+
Jan Nieuwenhuizen <jan@digicash.com>, Context errors, Lyrics,
mi2mu, MIDI stuff, make structure, bits of FlowerLib, general
comments.
=item *
+
Mats Bengtsson <matsb@s3.kth.se>, bugfixes, testing, general comments.
=back
LilyPond 0.0.40 #0/FlowerLib 1.1.7 #2. Compile: Mar 11 1997, 22:58:47 (g++ 2.7.2)
Parsing ... [./init//symbol.ini[./init//dynamic.ini][./init//dutch.ini][./init//script.ini][./init//table_sixteen.ini]][./input/wohltemperirt.ly]
Setting up music ...Processing music ............
- Preprocessing ...
+ Preprocessing ...
Calculating column positions ... [3][6][9]
Postprocessing ...
TeX output to lelie.out ...
and patches to me (see AUTHORS section)
LilyPond is updated very frequently, the latest version is always available at:
-ftp://pcnov095.win.tue.nl/pub/lilypond.
+ftp://pcnov095.win.tue.nl/pub/lilypond.
=head1 FILES
=head1 SEE ALSO
There are some documentation files in the subdirectory F<Documentation/>,
-among others: lilygut, lilyinput, error, faq,
+among others: lilygut, lilyinput, error, faq,
=head1 REMARKS
-14/Mar/97 LilyPond 0.0.41 1
+14/Mar/97 LilyPond 0.0.42 1
-14/Mar/97 LilyPond 0.0.41 2
+14/Mar/97 LilyPond 0.0.42 2
-14/Mar/97 LilyPond 0.0.41 3
+14/Mar/97 LilyPond 0.0.42 3
# identify module:
#
NAME = lilypond
-
-# edit in .version only!
-MAJOR_VERSION = $(TOPLEVEL_MAJOR_VERSION)
-MINOR_VERSION = $(TOPLEVEL_MINOR_VERSION)
-PATCH_LEVEL = $(TOPLEVEL_PATCH_LEVEL)
-# use to send patches, always empty for released version:
-MY_PATCH_LEVEL = $(TOPLEVEL_MY_PATCH_LEVEL)
-build = ./$(depth)/lily/$(outdir)/.build
-#
+include .version
+include ./$(depth)/make/Version.make
# generic variables:
#
# SYMLINKS = # naah, configure
SCRIPTS = configure configure.in install-sh
README_FILES = ANNOUNCE COPYING NEWS README TODO INSTALL.text
-DISTFILES= Makefile .dstreamrc .version $(README_FILES) $(SCRIPTS) $(SYMLINKS)
+EXTRA_DISTFILES= .dstreamrc .version $(README_FILES) $(SCRIPTS) $(SYMLINKS)
#
localdist: configure
# ugh. I know dep is not quite what is really needed.
-INSTALL.text: Documentation
+INSTALL.text: check-doc-deps
rm -f INSTALL.text
- $(MAKE) -C Documentation
ln `find -name INSTALL.text|head -1` .
localclean:
+pl 42.3
+ - const naming change (T const <-> const T)
+ - Mudela 0.1
+
+pl 42.2
+ - new lilyinput (Mudela 0.1) doc.
+Examples
+ - new-twinkle.ly (in Mudela 0.1, hopefully)
+
+pl 42.1
+ - further Makefile revamping.
+ - moved flowerlib
+
+*******
+pl 42
+
+
pl 41.hwn3
- struct Lexer_prefs
- parser bug
- * remove notename.* README.pod LilyPond.pod
-
before 0.1
+ * fix Lyric mode
* remove spurious/outdated comments in .ly, debug .ly
-
+
* pushgroup, popgroup.
* basic dynamics
* basic syntax & parser/lexer cleanup.
* decent TeX page layout
-
- * clean split for m2m of sources.
-
- * caching of Register_group_register hierarchies.
+
+ * avoid unnecessary confusing constructs from .ly
This is an assorted collection of stuff that will be done, might be
done, or is an idea that I want to think about
MAKE-STUFF
- * fix increase build ( libflower rebuilt when making lilypond. )
-
* sort out headers, see m2m
* do platform stuff: configure, header(s), targets, build (out?)
-
- * make install.
BUGS
- * plet bugs: scales.ly
* key at clef change.
SEVERELY LACKING:
+ * hairpins
+
* grace notes
+FURTHER FOR ORCHESTRAL SCORE:
+
+ * multibar rests
+
+ * barnumbers, markers
+
+ * abbreviations c4=16
+
INPUTLANGUAGE
* read ENV for include path
- * lose the $ and @ ?
-
* figured bass?
* transposition
* rest name configurable
- * < .. > vs. { .. } syntax? !
+SMALLISH PROJECTS
- * '*' vs. '/'
+ * use dstream feature in mi2mu
-SMALLISH PROJECTS
+ * qtor, btor, mtor-> tor( QUIET_ver ), tor( DEBUG_ver ), etc.
+ * use tors feature in lily
* midi esp.: use I32 iso int where 32 bits are needed (or assumed...)
* Brackets
* space rest.
+
+ * caching of Register_group_register hierarchies.
+
* use (char *) iso. String for communication between lexer and
parser.
* piano staff
- * abbreviations a4*8
-
IDEAS
* integrate Register/Midi stuff
depth = ..
#
-build = ./$(depth)/lily/$(outdir)/.build
-
+include ./$(depth)/make/Include.make
# generic stuff/Makefile
#
-include ./$(depth)/make/Stuff.make
#
# list of distribution files:
#
-SCRIPTS = clearlily cpgento genheader make_patch make_version make_website
-DISTFILES = Makefile $(SCRIPTS)
+SCRIPTS = clearlily cpgento genheader make_patch make_version make_website release
+EXTRA_DISTFILES = $(SCRIPTS)
#
--- /dev/null
+#!/bin/sh
+
+
+function setversion() {
+eval `sed -n 's/^\([A-Z_]*\) *= *\(.*\)$/\1=\2/p' .version`
+MJ=$TOPLEVEL_MAJOR_VERSION
+MI=$TOPLEVEL_MINOR_VERSION
+PA=$TOPLEVEL_PATCH_LEVEL
+MP=$TOPLEVEL_MY_PATCH_LEVEL
+NEWVER=$MJ.$MI.$PA$MP
+if [ -z $MP ]
+then
+ LASTVER=$MJ.$MI.`expr $PA - 1`
+else
+ LASTVER=$MJ.$MI.$PA
+fi
+
+echo
+echo "Current version ("`pwd`") is $NEWVER, Last version: $LASTVER"
+echo
+}
+heredir=`pwd`
+ make dist;
+ setversion
+ LILYVER=$NEWVER
+ cp lilypond-$LILYVER.tar.gz ../releases
+ $heredir/bin/make_patch $LASTVER $NEWVER lilypond
+ gzip -f9 patch-$NEWVER
+ mv {lilypond-,patch-}*.gz ../
+cd ..
+tar cf updeet {lily,patch-}*.gz
+
+mv patch-*gz patches/
+mv lilypond*tar.gz releases/
+
+#time make
ac_default_prefix=/usr/local
# Any additions from configure.in:
ac_help="$ac_help
- printing set debug printing"
+ enable-printing set debug printing"
ac_help="$ac_help
- checking set runtime checks"
+ disable-checking set runtime checks"
ac_help="$ac_help
- debug set debug info"
+ disable-debug set debug info"
ac_help="$ac_help
- optimise use maximal speed optimisations"
+ enable-optimise use maximal speed optimisations"
ac_help="$ac_help
- profiling compile with gprof support"
+ enable-profiling compile with gprof support"
ac_help="$ac_help
texprefix=DIR set the tex-directory to put the lilypond subdir in."
# A filename unique to this package, relative to the directory that
# configure is in, which we can look for to find out if srcdir is correct.
-ac_unique_file=flower/lib/choleski.cc
+ac_unique_file=flower/choleski.cc
# Find the source files, if location was not specified.
if test -z "$srcdir"; then
fi
+
+
ac_ext=C
# CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
ac_cpp='$CXXCPP $CPPFLAGS'
# Check whether --enable-checking or --disable-checking was given.
if test "${enable_checking+set}" = set; then
enableval="$enable_checking"
- :
-else
DEFINES="$DEFINES -DNDEBUG=1"
fi
# Check whether --enable-debug or --disable-debug was given.
if test "${enable_debug+set}" = set; then
enableval="$enable_debug"
+ :
+else
DEFINES="$DEFINES -g"
fi
yes;
#endif
EOF
-if { ac_try='${CXX-g++} -E conftest.C'; { (eval echo configure:623: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+if { ac_try='${CXX-g++} -E conftest.C'; { (eval echo configure:625: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
ac_cv_prog_gxx=yes
else
ac_cv_prog_gxx=no
ac_link='${CXX-g++} -o conftest $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
CXXCPP="${CXX-g++} -E"
cat > conftest.$ac_ext <<EOF
-#line 1025 "configure"
+#line 1027 "configure"
#include "confdefs.h"
#include <stdlib.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1030: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1032: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out`
if test -z "$ac_err"; then
:
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1052 "configure"
+#line 1054 "configure"
#include "confdefs.h"
#include <FlexLexer.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1057: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1059: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out`
if test -z "$ac_err"; then
rm -rf conftest*
# ugr
(cd mi2mu; CXX="$ac_cv_prog_CXX" ../bin/make_version > out/version.hh
)
+# rgu
+sed 's/TOPLEVEL_//g' < .version > lily/.version
(cd lily; CXX="$ac_cv_prog_CXX" ../bin/make_version > out/version.hh
)
(cd flower;
AC_MSG_RESULT($$1)
])
+AC_INIT(flower/choleski.cc)
+
-AC_INIT(flower/lib/choleski.cc)
AC_LANG_CPLUSPLUS
AC_ARG_ENABLE(printing,
- [ printing set debug printing],
+ [ enable-printing set debug printing],
[],
[DEFINES="$DEFINES -DNPRINT=1"])
AC_ARG_ENABLE(checking,
- [ checking set runtime checks],
- [],
- [DEFINES="$DEFINES -DNDEBUG=1"])
+ [ disable-checking set runtime checks],
+ [DEFINES="$DEFINES -DNDEBUG=1"],
+ [])
AC_ARG_ENABLE(debug,
- [ debug set debug info],
+ [ disable-debug set debug info],
+ [],
[DEFINES="$DEFINES -g"])
AC_ARG_ENABLE(optimise,
- [ optimise use maximal speed optimisations],
+ [ enable-optimise use maximal speed optimisations],
[DEFINES="$DEFINES -O2 -DSTRING_UTILS_INLINED"])
AC_ARG_ENABLE(profiling,
- [ profiling compile with gprof support],
+ [ enable-profiling compile with gprof support],
[DEFINES="$DEFINES -pg"])
AC_ARG_ENABLE(texprefix,
[ texprefix=DIR set the tex-directory to put the lilypond subdir in.],
(cd mi2mu; CXX="$ac_cv_prog_CXX" ../bin/make_version > out/version.hh
dnl echo 0 > out/.build
)
+# rgu
+sed 's/TOPLEVEL_//g' < .version > lily/.version
(cd lily; CXX="$ac_cv_prog_CXX" ../bin/make_version > out/version.hh
dnl echo 0 > out/.build
)
MAJOR_VERSION = 1
MINOR_VERSION = 1
-PATCH_LEVEL = 7
+PATCH_LEVEL = 8
# use to send patches, always empty for released version:
MY_PATCH_LEVEL = # include separator: "-1" or ".a"
#
MODULE_NAME = flower
#
# edit .version only
-include ./$(depth)/flower/.version
include ./$(depth)/.version
-build = ./$(depth)/flower/$(outdir)/.build
-#
+include ./$(depth)/flower/.version
# generic variables:
#
-include ./$(depth)/make/Variables.make
-#
+include ./$(depth)/make/Variables.make
+include ./$(depth)/make/Files.make
+#
+CXXFLAGS+=-O2
# descent order into subdirectories:
#
-SUBDIRS = lib test
+SUBDIRS = test include
#
# list of distribution files:
#
SCRIPTS =
README_FILES = NEWS README TODO
-DISTFILES= configure config.hh.in configure.in Makefile .version $(README_FILES) $(SCRIPTS)
+EXTRA_DISTFILES= configure config.hh.in configure.in .version $(README_FILES) $(SCRIPTS)
#
+
# generic targets and rules:
#
include ./$(depth)/make/Targets.make
+pl 1.1.8
+
+
pl 1.1.7
- PQueue blondification.
- String_convert::i2hex_str fix, unsigned eqvs introduced
--- /dev/null
+#include "choleski.hh"
+const Real EPS = 1e-7; // so sue me. Hard coded
+
+Vector
+Choleski_decomposition::solve(Vector rhs)const
+{
+ int n= rhs.dim();
+ assert(n == L.dim());
+ Vector y(n);
+
+ // forward substitution
+ for (int i=0; i < n; i++) {
+ Real sum(0.0);
+ for (int j=0; j < i; j++)
+ sum += y(j) * L(i,j);
+ y(i) = (rhs(i) - sum)/L(i,i);
+ }
+ for (int i=0; i < n; i++)
+ y(i) /= D(i);
+
+ // backward subst
+ Vector &x(rhs); // using input as return val.
+ for (int i=n-1; i >= 0; i--) {
+ Real sum(0.0);
+ for (int j=i+1; j < n; j++)
+ sum += L(j,i)*x(j);
+ x(i) = (y(i) - sum)/L(i,i);
+ }
+ return x;
+}
+
+/*
+ Standard matrix algorithm.
+ */
+
+Choleski_decomposition::Choleski_decomposition(Matrix P)
+ : L(P.dim()), D(P.dim())
+{
+ int n = P.dim();
+ assert((P-P.transposed()).norm()/P.norm() < EPS);
+
+ L.unit();
+ for (int k= 0; k < n; k++) {
+ for (int j = 0; j < k; j++){
+ Real sum(0.0);
+ for (int l=0; l < j; l++)
+ sum += L(k,l)*L(j,l)*D(l);
+ L(k,j) = (P(k,j) - sum)/D(j);
+ }
+ Real sum=0.0;
+
+ for (int l=0; l < k; l++)
+ sum += sqr(L(k,l))*D(l);
+ Real d = P(k,k) - sum;
+ D(k) = d;
+ }
+
+#ifdef NDEBUG
+ assert((original()-P).norm() / P.norm() < EPS);
+#endif
+}
+
+Matrix
+Choleski_decomposition::original() const
+{
+ Matrix T(L.dim());
+ T.set_diag(D);
+ return L*T*L.transposed();
+}
+
+Matrix
+Choleski_decomposition::inverse() const
+{
+ int n=L.dim();
+ Matrix invm(n);
+ Vector e_i(n);
+ for (int i = 0; i < n; i++) {
+ e_i.set_unit(i);
+ Vector inv(solve(e_i));
+ for (int j = 0 ; j<n; j++)
+ invm(i,j) = inv(j);
+ }
+
+#ifdef NDEBUG
+ Matrix I1(n), I2(original());
+ I1.unit();
+ assert((I1-original()*invm).norm()/original.norm() < EPS);
+#endif
+
+ return invm;
+}
# A filename unique to this package, relative to the directory that
# configure is in, which we can look for to find out if srcdir is correct.
-ac_unique_file=lib/choleski.cc
+ac_unique_file=choleski.cc
# Find the source files, if location was not specified.
if test -z "$srcdir"; then
ac_given_srcdir=$srcdir
-trap 'rm -fr `echo " lib/out/config.hh:config.hh.in" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
+trap 'rm -fr `echo " out/config.hh:config.hh.in" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
EOF
cat >> $CONFIG_STATUS <<EOF
ac_eC=' '
ac_eD='%g'
-CONFIG_HEADERS=${CONFIG_HEADERS-"lib/out/config.hh:config.hh.in"}
+CONFIG_HEADERS=${CONFIG_HEADERS-"out/config.hh:config.hh.in"}
for ac_file in .. $CONFIG_HEADERS; do if test "x$ac_file" != x..; then
# Support "outfile[:infile]", defaulting infile="outfile.in".
case "$ac_file" in
dnl Process this file with autoconf to produce a configure script.
-AC_INIT(lib/choleski.cc)
+AC_INIT(choleski.cc)
AC_LANG_CPLUSPLUS
dnl should enable flower specific compile flags.
AC_FUNC_MEMCMP
AC_FUNC_VPRINTF
AC_CHECK_FUNCS(memmem snprintf foobar)
-AC_CONFIG_HEADER(lib/out/config.hh:config.hh.in)
+AC_CONFIG_HEADER(out/config.hh:config.hh.in)
CXX="$ac_cv_prog_CXX" ../bin/make_version > out/version.hh
--- /dev/null
+#include <fstream.h>
+#include <ctype.h>
+
+#include "data-file.hh"
+
+void
+Data_file::gobble_white()
+{
+ char c;
+
+ while ((c=data_get()) == ' ' ||c == '\t')
+ if (eof())
+ break;
+
+ data_unget(c);
+}
+
+String
+Data_file::get_word()
+{// should handle escape seq's
+ String s;
+
+ while (1)
+ {
+ char c = data_get();
+
+ if (isspace(c) || eof())
+ {
+ data_unget(c);
+ break;
+ }
+
+
+ if (c == '\"')
+ {
+ rawmode= true;
+
+ while ((c = data_get()) != '\"')
+ if (eof())
+ error("EOF in a string");
+ else
+ s += c;
+
+
+ rawmode= false;
+ }
+ else
+ s += c;
+ }
+
+ return s;
+}
+
+/** get a char
+ Only class member who uses text_file::get
+ */
+char
+Data_file::data_get() {
+ char c = get();
+ if (!rawmode && c == '#') // gobble comment
+ {
+ while ((c = get()) != '\n' && !eof())
+ ;
+ return '\n';
+ }
+
+ return c;
+}
+
+/// read line, gobble '\n'
+String Data_file::get_line()
+{
+ char c;
+ String s;
+
+ while ((c = data_get()) != '\n' && !eof())
+ s += c;
+ return s;
+}
+
+/// gobble stuff before first entry on a line.
+void
+Data_file::gobble_leading_white()
+{
+ // eat blank lines.
+ while (!eof()) {
+ char c = data_get();
+ if (!isspace(c)) {
+ data_unget(c);
+ break;
+ }
+ }
+}
+
+
--- /dev/null
+
+
+#include <fstream.h>
+#include "assoc.hh"
+#include "dstream.hh"
+#include "scalar.hh"
+#include "text-db.hh"
+#include "string-convert.hh"
+
+/// indent of each level
+const INDTAB = 2;
+
+/*
+ should use Regexp library.
+ */
+static String
+strip_pretty(String pretty_str)
+{
+ int i = pretty_str.index_i('(');
+ if (i>=0)
+ pretty_str = pretty_str.left_str(i);
+
+ int l = pretty_str.index_last_i(' '); // strip until last ' '
+ if (l>=0)
+ pretty_str = pretty_str.nomid_str(0,l+1);
+ return pretty_str;
+}
+
+static String
+strip_member(String pret)
+{
+ int l=pret.index_last_i(':')-1;
+ if (l>=0)
+ pret = pret.left_str(l );
+ return pret;
+}
+
+Dstream&
+Dstream::identify_as(String name)
+{
+ if (!os)
+ return *this;
+
+ String mem(strip_pretty(name));
+ String cl(strip_member(mem));
+ String idx = cl;
+
+ if (silent->elt_query(mem))
+ idx = mem;
+ else if (silent->elt_query(cl))
+ idx = cl;
+ else {
+ (*silent)[idx] = false;
+ }
+ local_silence = (*silent)[idx];
+ if (classname != idx && !local_silence) {
+ classname=idx;
+ if (!(*silent)["Dstream"])
+ *os << "[" << classname << ":]"; // messy.
+ }
+ return *this;
+}
+
+bool
+Dstream::silence(String s)
+{
+ if (!silent->elt_query(s))
+ return false;
+ return (*silent)[s];
+}
+
+/** Output a string via the Dstream. This is the only output
+ interface. It delegates all conversion to String class. */
+Dstream &
+Dstream::operator<<(String s)
+{
+ output(s);
+ return *this;
+}
+
+Dstream &
+Dstream::operator<<(void const *v_l)
+{
+ output(String_convert::pointer_str(v_l));
+ return *this;
+}
+
+Dstream &
+Dstream::operator<<(char const *ch_l)
+{
+ output(ch_l);
+ return *this;
+}
+
+void
+Dstream::output(String s)
+{
+ if (local_silence|| !os)
+ return ;
+
+ for (char const *cp = s ; *cp; cp++)
+ switch(*cp) {
+ case '{':
+ case '[':
+ case '(': indentlvl += INDTAB;
+ *os << *cp;
+ break;
+
+ case ')':
+ case ']':
+ case '}':
+ indentlvl -= INDTAB;
+ *os << *cp ;
+
+ assert (indentlvl>=0) ;
+ break;
+
+ case '\n':
+ *os << '\n' << String (' ', indentlvl) << flush;
+ break;
+ default:
+ *os << *cp;
+ break;
+ }
+ return ;
+}
+
+
+Dstream::Dstream(ostream *r, char const * cfg_nm )
+{
+ os = r;
+ silent = new Assoc<String,bool>;
+ indentlvl = 0;
+ if (!os)
+ return;
+
+ char const * fn =cfg_nm ? cfg_nm : ".dstreamrc";
+ {
+ ifstream ifs(fn); // can't open
+ if (!ifs)
+ return;
+ }
+
+ Text_db cfg(fn);
+ while (! cfg.eof()){
+ Text_record r( cfg++);
+ if (r.size() != 2) {
+ r.message("not enough fields in Dstream init.");
+ continue;
+ }
+ (*silent)[r[0]] = (bool)(int)(Scalar(r[1]));
+ }
+
+}
+
+
+Dstream::~Dstream()
+{
+ delete silent;
+ assert(!indentlvl) ;
+}
--- /dev/null
+#include "version.hh" // urg
+#include <stdio.h>
+
+static char *s = "FlowerLib " MAJOR_VERSION "." MINOR_VERSION "." PATCH_LEVEL MY_PATCH_LEVEL " #%d";
+
+static const int build=
+#include ".build"
+;
+
+char const *
+flower_version_sz()
+{
+ static char v[1024];
+ sprintf(v, s, build);
+ return v;
+}
--- /dev/null
+# flower/lib/include/Makefile
+
+# subdir level:
+#
+depth = ../..
+#
+
+# generic stuff/Makefile
+#
+include ./$(depth)/make/Include.make
+include ./$(depth)/flower/.version
+
+# identify module:
+#
+MODULE_NAME = flower
+
+#
+
--- /dev/null
+/*
+ associter.hh -- part of flowerlib
+
+ (c) 1996 Han-Wen Nienhuys
+*/
+
+#ifndef ASSOCITER_HH
+#define ASSOCITER_HH
+
+#include "assoc.hh"
+
+/// an iterator for the #Assoc# class
+template<class K, class V>
+struct Assoc_iter {
+ int i;
+ Assoc<K,V> &assoc_;
+ /// we don't want to be bothered by const correctness
+ Assoc_iter(const Assoc<K,V> &a) :
+ assoc_((Assoc<K,V> &)a)
+ {
+ i= next(0);
+ }
+ int next(int j) {
+ while (j < assoc_.arr.size() && assoc_.arr[j].free)
+ j++;
+ return j;
+ }
+ bool ok() const {
+ return i < assoc_.arr.size();
+ }
+ void OK()const {
+ assert(!ok() || !assoc_.arr[i].free);
+ }
+ void operator++(int) { i++; i = next(i); }
+ K key() { return assoc_.arr[i].key; }
+ V &val() { return assoc_.arr[i].val; }
+};
+
+#endif
--- /dev/null
+#ifndef ASSOC_HH
+#define ASSOC_HH
+
+#include "varray.hh"
+#include <assert.h>
+
+/**
+ A helper for Assoc
+ */
+template<class K, class V>
+struct Assoc_ent_ {
+ bool free;
+ K key;
+ V val;
+};
+
+
+/** mindblowingly stupid Associative array implementation.
+ Hungarian: map
+ */
+template<class K, class V>
+struct Assoc {
+ Array< Assoc_ent_<K,V> > arr;
+
+ /* ************** */
+
+ int find(K key) const {
+ for (int i = 0; i < arr.size(); i++) {
+ if (!arr[i].free && key == arr[i].key)
+ return i;
+ }
+ return -1;
+ }
+ int find_creat(K key) {
+ int free = -1;
+ for (int i = 0; i < arr.size(); i++) {
+ if (key == arr[i].key) {
+ return i;
+ } else if (arr[i].free ) {
+ free = i;
+ }
+ }
+ if (free >= 0){
+ arr[free].free = false;
+ arr[free].key = key;
+ return free;
+ }
+
+ Assoc_ent_<K,V> ae;
+ ae.free = false;
+ ae.key = key;
+ arr.push(ae);
+ return arr.size() -1;
+ }
+public:
+ bool elt_query(K key) const {
+ return find(key) >= 0;
+ }
+ void del(K key) {
+ assert(elt_query(key));
+ int i= find(key);
+ arr[i].free = true;
+ }
+ void
+ add(K key, V val) {
+ int i = find_creat(key);
+ arr[i].val = val;
+ }
+ V& operator[](K key) {
+ return arr[find_creat(key)].val;
+ }
+ V const & operator[](K key) const {
+ assert(elt_query(key));
+ return arr[find(key)].val;
+ }
+};
+
+#endif
--- /dev/null
+#ifndef CHOLESKI_HH
+#define CHOLESKI_HH
+
+#include "matrix.hh"
+
+/**
+ Choleski decomposition of a matrix
+ structure for using the LU decomposition of a positive definite matrix.
+
+ #P# is split into
+
+ LD transpose(L)
+ */
+struct Choleski_decomposition {
+
+ /// lower triangle of Choleski decomposition
+ Matrix L;
+
+ /// diagonal
+ Vector D;
+
+ /** Create decomposition of P.
+ PRE
+ P needs to be symmetric positive definite
+ */
+
+ Choleski_decomposition(Matrix P);
+
+ /**
+ solve Px = rhs
+ */
+ Vector solve(Vector rhs) const;
+
+ Vector operator * (Vector rhs) const { return solve (rhs); }
+ /**
+ return the inverse of the matrix P.
+ */
+ Matrix inverse() const;
+ /**
+ return P, calc'ed from L and D
+ */
+ Matrix original() const;
+
+
+};
+#endif
--- /dev/null
+/*
+ flowerlib
+
+ (c) 1996 Han-Wen Nienhuys
+ */
+#ifndef COMPARE_HH
+#define COMPARE_HH
+
+#define one_operator(type, function, op) \
+inline bool \
+operator op (type t1, type t2) {\
+ return function(t1, t2) op 0;\
+}\
+
+#define gpp_minmax_operator(type, op, opp) \
+inline type \
+operator op(type t1, type t2)\
+{\
+ return (t1 opp t2) ? t1 : t2;\
+}\
+
+
+#if defined (__GNUG__) && ! defined (__STRICT_ANSI__)
+#define gpp_minmax(type, prefix)\
+ prefix gpp_minmax_operator(type, <?, <)\
+ prefix gpp_minmax_operator(type, >?, >)
+#else
+#define gpp_minmax(type, prefix)
+#endif
+
+/** handy notations for a signed comparison.
+ make the operators{<,<=,==,>=,>} and the MAX and MIN of two.
+ Please fill a & in the type argument if necessary.
+ */
+#define template_instantiate_compare(type, function, prefix) \
+prefix one_operator(type, function, >)\
+prefix one_operator(type, function, >=)\
+prefix one_operator(type, function, ==)\
+prefix one_operator(type, function, !=)\
+prefix one_operator(type, function, <)\
+prefix one_operator(type, function, <=)\
+gpp_minmax(type, prefix)\
+prefix inline type max(type t1, type t2) { return (t1 > t2 )? t1 : t2; }\
+prefix inline type min(type t1, type t2) { return (t1 < t2 )? t1 : t2; }\
+ \
+prefix bool operator<(type t1, type t2) /* stupid fix to allow ; */
+
+
+
+#define instantiate_compare(type, func) template_instantiate_compare(type,func, )
+
+
+
+#endif
+
--- /dev/null
+// cursor.hh
+
+#ifndef __CURSOR_HH
+#define __CURSOR_HH
+
+#include "link.hh"
+template<class T> class List;
+
+/** iterator to List.
+ add and insert extend the list
+ items are always stored as copies in List, but:
+ List<String> : copies of String stored
+ List<String*> : copies of String* stored!
+
+ the operations add and insert actually delegate the work to List class.
+ */
+template<class T>
+class Cursor
+{
+ public:
+ /** create cursor, set at top. The const part isn't true, actually, #list#
+ surely isn't const, but I get tired of the warning messages. */
+ Cursor( const List<T>& list, Link<T>* pointer = 0 );
+
+ Cursor( const Cursor<T>& cursor );
+
+ T& thing();
+
+ /// return current T
+ T& operator *() { return thing(); }
+ operator T() { return thing(); }
+ Cursor<T> operator =( const Cursor<T>& c );
+
+ /// make cursor with #no# items back
+ Cursor<T> operator -( int no) const;
+
+ /// make cursor with #no# items further
+ Cursor<T> operator +( int no) const;
+ int operator -(Cursor<T> op) const;
+ Cursor<T> operator -=(int);
+ Cursor<T> operator +=(int);
+
+ /// return current and move one down
+ Cursor<T> operator ++( int );
+
+ /// return current and move one up
+ Cursor<T> operator --( int );
+
+ /// point to link?
+ bool ok();
+
+ /// ++ items left?
+ bool forward();
+
+ /// -- items left?
+ bool backward();
+
+ /** put (copy) after me in List.
+ analogously to editor. ok() interpreted as at end
+ of line.
+
+ PRE: !ok, POST: added to bottom()
+
+ PRE: ok, POST: added after me
+
+ cursor points to same object, cursor.next() is newly added
+ object.
+ */
+ void add( T const & thing );
+
+ /** put (copy) before me in List.
+ analogously to editor. ok() interpreted as at begin of
+ line.
+
+ PRE: !ok, POST: add to top()
+
+ PRE: ok, POST: add before me
+
+ cursor points to same object, cursor.previous()
+ is newly inserted object.
+ */
+
+ void insert( T const & thing );
+ ///
+ void backspace();
+
+ ///
+ void del();
+
+ /// access the list this came from
+ List<T>& list() const ;
+ Link<T>* pointer();
+ static int compare(Cursor<T> a,Cursor<T>b) { return a-b; }
+private:
+ List<T>& list_;
+ Link<T>* pointer_;
+};
+
+
+/*
+ comparisons.
+ */
+#include "compare.hh"
+
+
+template_instantiate_compare(Cursor<T>, Cursor<T>::compare, template<class T>);
+
+#include "pcursor.hh"
+#include "list.hh"
+#include "cursor.inl"
+#include "iterate.hh"
+
+#endif // CURSOR_HH
--- /dev/null
+ // cursor.inl -*-c++-*-
+#ifndef CURSOR_INL
+#define CURSOR_INL
+#include <assert.h>
+
+
+template<class T>
+inline
+Cursor<T>::Cursor( const List<T>& list, Link<T>* pointer ) :
+ list_((List<T>&) list )
+{
+ if ( list.size() )
+ pointer_ = pointer ? pointer : list.top_;
+ else
+ pointer_ = pointer;
+}
+
+template<class T>
+inline
+Cursor<T>::Cursor( const Cursor<T>& cursor ) :
+ list_( cursor.list_ )
+{
+ pointer_ = cursor.pointer_;
+}
+
+template<class T>
+inline T&
+Cursor<T>::thing()
+{
+ assert( pointer_ );
+ return pointer_->thing();
+}
+
+template<class T>
+Cursor<T>
+Cursor<T>::operator =( const Cursor<T>& c )
+{
+ assert( &list_ == &c.list_ );
+ pointer_ = c.pointer_;
+ return *this;
+}
+
+template<class T>
+inline void
+Cursor<T>::add( const T& th )
+{
+ list_.add( th, *this );
+}
+
+template<class T>
+inline void
+Cursor<T>::insert( const T& th )
+{
+ list_.insert( th, *this );
+}
+
+template<class T>
+inline List<T>&
+Cursor<T>::list() const
+{
+ return list_;
+}
+
+template<class T>
+inline Link<T>*
+Cursor<T>::pointer()
+{
+ return pointer_;
+}
+
+template<class T>
+inline bool
+Cursor<T>::backward()
+{
+ return ( pointer_ != 0 );
+}
+
+template<class T>
+inline bool
+Cursor<T>::forward()
+{
+ return ( pointer_ != 0 );
+}
+
+template<class T>
+inline bool
+Cursor<T>::ok()
+{
+ return ( pointer_ != 0 );
+}
+
+
+template<class T>
+inline Cursor<T>
+Cursor<T>::operator ++( int )
+{
+ Cursor<T> r (*this);
+ assert( pointer_ );
+ pointer_ = pointer_->next();
+ return r;
+}
+
+template<class T>
+inline Cursor<T>
+Cursor<T>::operator --( int )
+{
+ Cursor<T> r (*this);
+ assert( pointer_ );
+ pointer_ = pointer_->previous();
+ return r;
+}
+
+#endif
--- /dev/null
+#ifndef CURSOR_CC
+#define CURSOR_CC
+
+#include "cursor.hh"
+#include <assert.h>
+
+template<class T>
+ void
+Cursor<T>::backspace()
+{
+ Cursor<T> c(*this);
+ if ( c.ok() )
+ c--;
+ list_.remove( *this );
+}
+
+template<class T>
+ void
+Cursor<T>::del()
+{
+ Cursor<T> c(*this);
+ if ( c.ok() )
+ c++;
+ list_.remove( *this );
+ *this = c;
+}
+
+
+template<class T>
+Cursor<T>
+Cursor<T>::operator -=( int j )
+{
+ while (j--)
+ (*this)--;
+ return *this;
+}
+template<class T>
+Cursor<T>
+Cursor<T>::operator +=( int j )
+{
+ while (j++)
+ (*this)++;
+ return *this;
+}
+
+template<class T>
+Cursor<T>
+Cursor<T>::operator +( int i ) const
+{
+ Cursor<T> r = *this;
+
+ if (i<0)
+ return r -(-i);
+
+ while (i--)
+ r++;
+
+ return r;
+}
+
+template<class T>
+Cursor<T>
+Cursor<T>::operator -( int i ) const
+{
+ Cursor<T> r = *this;
+ if (i<0)
+ return r +(-i);
+
+ while (i--)
+ r--;
+
+ return r;
+}
+/*
+ warning: can't use Cursor::operator == (Cursor),
+ since it uses Cursor::operator-(Cursor)
+ */
+template<class T>
+int
+Cursor<T>::operator-(Cursor<T> rhs) const
+{
+ assert(rhs.list == list);
+ int dif = 0;
+
+ // search from *this on further up (positive difference)
+ Cursor<T> c(*this);
+ while (c.ok() && c.pointer_ != rhs.pointer_) {
+ c--;
+ dif++;
+ }
+
+ if (c.ok())
+ goto gotcha; // so, sue me.
+
+ // search in direction of bottom. (negative diff)
+ dif =0;
+ c=*this;
+ while (c.ok() && c.pointer_ !=rhs.pointer_) {
+ dif --;
+ c++;
+ }
+ assert(c.ok());
+
+gotcha:
+ assert((*this - dif).pointer_ == c.pointer_);
+ return dif;
+}
+
+#endif
--- /dev/null
+/*
+ data-file.hh -- declare Data_file
+
+ source file of the LilyPond music typesetter
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+
+#ifndef DATAFILE_HH
+#define DATAFILE_HH
+
+#include "text-stream.hh"
+
+/// read a data file
+class Data_file : private Text_stream
+{
+
+ public:
+ bool rawmode;
+
+ Text_stream::line;
+ Text_stream::eof;
+ Text_stream::get_name;
+
+ char data_get();
+ void data_unget(char c) {
+ unget(c);
+ }
+
+ /// read line, eat #\n#
+ String get_line();
+
+ /// read a word till next space, leave space. Also does quotes
+ String get_word();
+
+ /// gobble horizontal white stuff.
+ void gobble_white();
+
+ /// gobble empty stuff before first field.
+ void gobble_leading_white();
+ Data_file(String s) : Text_stream(s) {
+ //*mlog << "(" << s << flush;
+ rawmode= false;
+ }
+
+ ~Data_file() {
+ // *mlog << ")"<<flush;
+ }
+
+ warning(String s) {
+ message("warning: " + s);
+ }
+ error(String s){
+ message(s);
+ exit(1);
+ }
+};
+#endif // DATAFILE_HH
--- /dev/null
+
+#ifndef DSTREAM_HH
+#define DSTREAM_HH
+
+#include "string.hh"
+
+const char eol= '\n';
+
+template<class K,class V>
+struct Assoc;
+
+/** debug stream.
+ a class for providing debug output of nested structures,
+ with indents according to \{\}()[].
+
+ One can turn on and off specific messages using the Assoc silent.
+ This can be done automatically:
+
+ #define DEBUG dstream_.identify_as(__PRETTY_FUNCTION__)
+
+ DEBUG << "a message\n";
+
+ Init for the class names which should be silent can be given in a rc file.
+
+ */
+class Dstream
+{
+ ostream *os;
+ int indentlvl;
+ bool local_silence;
+ String classname;
+ void output(String s);
+ Assoc<String, bool> *silent;
+public:
+
+ bool silence(String);
+
+ /**
+ if rcfile == 0, then do not read any rc file.
+ */
+
+ Dstream(ostream *r, char const * rcfile);
+ virtual ~Dstream();
+ Dstream &identify_as(String s);
+
+ Dstream &operator << (String s);
+ /**
+ Output memory locations.
+ */
+ Dstream &operator << (void const *);
+ Dstream &operator << (char const *);
+};
+#endif
+
--- /dev/null
+/*
+ fproto.hh -- typenames in flowerlib
+
+ (c) 1996 Han-Wen Nienhuys
+*/
+
+#ifndef FPROTO_HH
+#define FPROTO_HH
+
+
+char const * flower_version_sz();
+
+// what the F*** is "int" ?
+// depreciate int, long, etc., use i32, i64, remember: linux-16/linux-64 ?
+/// (i32)
+typedef int i32;
+/// (i64)
+typedef long long I64;
+
+template<class T> struct Array;
+template<class T> struct sstack;
+template<class T,class K> struct Assoc;
+template<class T> struct List;
+template<class T> struct PointerList;
+template<class T> struct IPointerList;
+template<class T> struct Cursor;
+template<class T> struct PCursor;
+template<class T> struct Link;
+template<class T> struct Handle;
+template<class T> struct Interval_t;
+template<class T,class Q> struct PQueue;
+
+#include "real.hh"
+
+typedef Interval_t<Real> Interval;
+
+struct Choleski_decomposition;
+
+struct Long_option_init;
+struct Getopt_long;
+struct Matrix;
+struct String_data;
+struct String_handle;
+struct String_convert;
+struct String;
+struct virtual_smat;
+struct Vector ;
+struct Text_stream;
+struct Data_file;
+struct Text_db;
+struct Scalar;
+typedef unsigned char Byte;
+#endif // FPROTO_HH
+
--- /dev/null
+#ifndef HANDLE_HH
+#define HANDLE_HH
+
+/// reference counting handle
+template<class T>
+class Handle {
+ T *obj;
+ int *refs;
+
+ /// let go of ref. Delete if necessary
+ void down() {
+ if (!(*refs--)) {
+ delete obj;
+ delete refs;
+ }
+ obj = 0;
+ refs = 0;
+ }
+ /// point to new object.
+ void up(T *t, int *r) {
+ if (!r) {
+ refs = new int;
+ *refs = 1;
+ } else {
+ refs =r;
+ *refs++;
+ }
+ obj = t;
+ }
+ /// POST: *refs == 1
+ void copy() {
+ if(*refs != 1){
+ T * newobj = new T(*obj );
+ down();
+ up(newobj);
+ }
+ }
+ Handle(Handle const &src) {
+ up(src.obj, src.refs);
+ }
+ Handle(T & o) {
+ up (&o);
+ }
+ void operator=(Handle const& src) {
+ if (this == &src)
+ return;
+ down();
+ up(src.o, src.refs);
+ }
+ operator T const &() {
+ return *obj;
+ }
+ operator T&() {
+ copy();
+ return *obj;
+ }
+}
+#endif
--- /dev/null
+/*
+ interval.hh -- part of flowerlib
+
+ (c) 1996 Han-Wen Nienhuys
+*/
+
+#ifndef INTERVAL_HH
+#define INTERVAL_HH
+
+#include <assert.h>
+#include "fproto.hh"
+#include "real.hh"
+
+
+/** a T interval.
+ this represents the closed interval [left,right].
+ No invariants. T must be a totally ordered ring
+ */
+template<class T>
+struct Interval_t {
+ T left, right;
+
+ /* ************** */
+
+ T center() { return (left + right) / T(2);}
+ void translate(T t) {
+ left += t;
+ right += t;
+ }
+ T& idx(int j) {
+ if (j==-1)
+ return left;
+ else if (j==1)
+ return right;
+ else
+ assert(false);
+ return left;
+ }
+ T& operator[](int j) {
+ return idx(j);
+ }
+ T operator[](int j) const {
+ return ((Interval_t<T> *)this)->idx(j);
+ }
+ T &max() { return right;}
+ T max()const { return right;}
+ T min()const{ return left; }
+ T &min(){ return left; }
+ /**
+ PRE
+ *this and h are comparable
+ */
+ void unite(Interval_t<T> h);
+ void intersect(Interval_t<T> h);
+
+ T length() const;
+ void set_empty() ;
+ bool empty() const { return left > right; }
+ Interval_t() {
+ set_empty();
+ }
+ Interval_t(T m, T M) {
+ left =m;
+ right = M;
+ }
+ Interval_t<T> &operator += (T r) {
+ left += r;
+ right +=r;
+ return *this;
+ }
+ String str() const;
+ bool elt_q(T r);
+};
+
+
+/**
+ inclusion ordering. Crash if not comparable.
+ */
+template<class T>
+int Interval__compare(const Interval_t<T>&,Interval_t<T> const&);
+
+/*
+ INLINE
+ */
+
+#include "compare.hh"
+
+template_instantiate_compare(Interval_t<T>&, Interval__compare, template<class T>);
+
+
+template<class T>
+inline Interval_t<T>
+intersection(Interval_t<T> a, Interval_t<T> const&b)
+{
+ a.intersect(b);
+ return a;
+
+}
+
+
+template<class T>
+inline
+Interval_t<T> operator +(T a,Interval_t<T> i )
+{
+ i += a;
+ return i;
+}
+
+template<class T>
+inline
+Interval_t<T> operator +(Interval_t<T> i,T a ){
+ return a+i;
+}
+
+typedef Interval_t<Real> Interval;
+
+
+#define Interval__instantiate(T) template struct Interval_t<T>;\
+ template int Interval__compare(const Interval_t<T>&,Interval_t<T> const&)
+
+
+#endif // INTERVAL_HH
+
+
+
--- /dev/null
+#include <assert.h>
+#include <math.h>
+#include "interval.hh"
+#include "string.hh"
+
+
+template<class T>
+int
+_Interval__compare(const Interval_t<T>&a,Interval_t<T> const&b)
+{
+ if (a.left == b.left && a.right == b.right)
+ return 0;
+
+ if (a.left <= b.left && a.right >= b.right)
+ return 1;
+
+ if (a.left >= b.left && a.right <= b.right)
+ return -1;
+
+ return -2;
+}
+
+
+template<class T>
+int
+Interval__compare(const Interval_t<T>&a,Interval_t<T> const&b)
+{
+ int i = _Interval__compare(a,b);
+ if (i < -1)
+ assert(false);
+ return i;
+}
+
+#ifdef AIX
+const Real INFTY = 1e8; // ARGh. AIX sucks
+#else
+const Real INFTY = HUGE_VAL;
+#endif
+
+template<class T>
+void
+Interval_t<T>::set_empty()
+{
+ left = INFTY;
+ right = -INFTY;
+}
+
+template<class T>
+T
+Interval_t<T>::length() const {
+ assert(right >= left);
+ return right-left;
+}
+
+template<class T>
+void
+Interval_t<T>::unite(Interval_t<T> h)
+{
+ if (h.left<left)
+ left = h.left;
+ if (h.right>right)
+ right = h.right;
+}
+
+/**
+ smallest Interval which includes *this and #h#
+ */
+
+template<class T>
+void
+Interval_t<T>::intersect(Interval_t<T> h)
+{
+#if defined (__GNUG__) && ! defined (__STRICT_ANSI__)
+ left = h.left >? left;
+ right = h.right <?right;
+#else
+ left = max(h.left, left);
+ right = min(h.right, right);
+#endif
+}
+
+template<class T>
+Interval_t<T>
+intersect(Interval_t<T> x, Interval_t<T> const &y)
+{
+ x.intersect(y);
+ return x;
+}
+
+template<class T>
+String
+Interval_t<T>::str() const
+{
+ if (empty())
+ return "[empty]";
+ String s("[");
+
+ return s + left + "," + right +"]";
+}
+
+template<class T>
+bool
+Interval_t<T>::elt_q(T r)
+{
+ return r >= left && r <= right;
+}
--- /dev/null
+/*
+ iterate.hh -- define some list macros
+
+ source file of the flowerlib
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+
+#ifndef ITERATE_HH
+#define ITERATE_HH
+
+
+
+#define iterator(set) typeof((set).top())
+#define iterator_bot(set) typeof((set).bottom())
+
+// should use top()
+#define iter_top(set,var) iterator(set) var(set)
+#define iter_bot(set,var) iterator(set) var(set.bottom())
+
+#endif // ITERATE_HH
--- /dev/null
+#ifndef LGETOPT_HH
+#define LGETOPT_HH
+
+#include <string.h>
+
+
+class ostream;
+
+/**
+ a struct this for initialising the commandline options.
+ */
+struct Long_option_init {
+ bool take_arg;
+ char const * longname;
+ char shortname;
+
+ ostream &printon(ostream &errorout);
+};
+
+
+/** C++ for version of long_getopt. For processing GNU style command
+ line arguments. No pointer (return values, arguments) contents are
+ copied. */
+class Getopt_long {
+public:
+ /** errorcodes: no error, argument expected, no argument expected,
+ unknown option, illegal argument (eg. int expected). */
+ enum Errorcod { E_NOERROR = 0, E_ARGEXPECT, E_NOARGEXPECT, E_UNKNOWNOPTION,
+ E_ILLEGALARG } ;
+
+
+private:
+
+ /// the option info.
+ Long_option_init *the_opts;
+ int table_len;
+
+ /// if doing short option, argv[optind][optindind] is processed next.
+ int optindind;
+
+ /// the option found
+ Long_option_init *beet;
+
+ /// get ready for processing next error.
+ bool next();
+ Long_option_init *parselong();
+ Long_option_init *parseshort();
+
+ ostream *errorout;
+
+ /// report an error and abort
+ void report(Errorcod c);
+public:
+
+ /// argument. Set to 0 if not present
+ char* optarg;
+
+ /// current error status
+ Errorcod error;
+
+ /// return an integer (with err. detect)
+ long intarg();
+ /// argv[optind] will be processed next.
+ int optind;
+
+ /// the arguments
+ char **argv;
+
+ /// the arg. count
+ int argc;
+
+ /* *************** */
+
+ /**
+ What to do with errors.
+ report messages on #*os#, and abort.
+ if #os# is null, then do not report nor abort, just set #error#
+ */
+
+ void seterror(ostream *os);
+
+ /// construct: pass arguments and option info.
+ Getopt_long(int c, char **v, Long_option_init *lo);
+
+ /** get the next option.
+ @return pointer to next option found.
+ 0 if error occurred, or next argument is no option.
+ */
+ Long_option_init *operator()();
+
+ char *current_arg();
+ char * get_next_arg();
+};
+#endif
--- /dev/null
+/*
+ libc-extension.hh -- declare some string.h extensions
+
+ source file of the flowerlib
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+
+#ifndef LIBC_EXTENSION_HH
+#define LIBC_EXTENSION_HH
+#include "fproto.hh"
+#include "config.hh"
+
+char* strnlwr( char* start_l ,int n);
+char* strnupr( char* start_l, int n);
+
+#if !HAVE_MEMMEM // GNU extension.
+char *memmem(Byte const * haystack, int haystack_len,
+ Byte const *needle, int needle_len);
+#endif HAVE_MEMMEM
+
+#if !HAVE_SNPRINTF // GNU extension.
+int snprintf (char *str, size_t n,
+ char const *format, ... );
+#endif
+
+
+Byte *memrchr(Byte const * p, int n, char c);
+Byte *strrev( Byte* byte_l, int length_i );
+
+
+#endif // LIBC_EXTENSION_HH
--- /dev/null
+// link.hh
+
+#ifndef __LINK_HH
+#define __LINK_HH
+template<class T>
+class List;
+
+
+/// class for List
+template<class T>
+class Link
+{
+// friend class Cursor<T>;
+public:
+ Link( T const & thing );
+
+ Link<T>* previous();
+ Link<T>* next();
+
+ /// put new Link item after me in list
+ void add( T const & thing );
+ /// put new Link item before me in list
+ void insert( T const & thing );
+ void remove(List<T> &l);
+
+ T& thing();
+ void OK() const;
+private:
+ Link( Link<T>* previous, Link<T>* next, T const & thing );
+
+ T thing_;
+ Link<T>* previous_;
+ Link<T>* next_;
+};
+
+#include "link.inl"
+
+#endif // __LINK_HH //
--- /dev/null
+// link.inl -*-c++-*-
+#ifndef LINK_INL
+#define LINK_INL
+#include <assert.h>
+template<class T>
+inline
+void
+Link<T>::OK() const
+{
+#ifndef NDEBUG
+ if (previous_) {
+ assert(previous_->next_ == this);
+ }
+ if (next_) {
+ assert(next_->previous_ == this);
+ }
+#endif
+}
+
+template<class T>
+inline
+Link<T>::Link( const T& thing ) :
+ thing_( thing )
+{
+ previous_ = next_ = 0;
+}
+
+template<class T>
+inline
+Link<T>::Link( Link<T>* previous, Link<T>* next, const T& thing ) :
+ thing_( thing )
+{
+ previous_ = previous;
+ next_ = next;
+}
+
+template<class T>
+inline
+Link<T>*
+Link<T>::next()
+{
+ return next_;
+}
+
+template<class T>
+inline
+Link<T>*
+Link<T>::previous()
+{
+ return previous_;
+}
+
+template<class T>
+inline
+void
+Link<T>::add( const T& thing )
+{
+
+ Link<T>* l = new Link<T>( this, next_, thing );
+ if ( next_ )
+ next_->previous_ = l;
+ next_ = l;
+}
+
+template<class T>
+inline void
+Link<T>::insert( const T& thing )
+{
+ // Link<T>* l = new Link<T>( next_, this, thing );
+ // bugfix hwn 16/9/96
+ Link<T>* l = new Link<T>( previous_, this, thing );
+ if ( previous_ )
+ previous_->next_ = l;
+ previous_ = l;
+}
+
+/*
+ don't forget to adjust #l#'s top_ and bottom_.
+ */
+template<class T>
+inline void
+Link<T>::remove(List<T> &l)
+{
+ if ( previous_ )
+ previous_->next_ = next_;
+ else
+ l.top_ = next_;
+
+ if ( next_ )
+ next_->previous_ = previous_;
+ else
+ l.bottom_ = previous_;
+}
+
+template<class T>
+inline
+T&
+Link<T>::thing()
+{
+ return thing_;
+}
+#endif
--- /dev/null
+#ifndef __LIST_HH
+#define __LIST_HH
+
+class ostream;
+template<class T> class Cursor;
+template<class T> class Link;
+
+/** all-purpose doubly linked list.
+
+ List can be seen as all items written down on paper,
+ from top to bottom
+
+ class Cursor is used to extend List
+
+ items are always stored as copies in List, but:
+ #List<String># : copies of #String# stored
+ #List<String*># : copies of #String*# stored!
+ (do not use, use \Ref{PointerList} #<String*># instead.)
+
+ {\bf note:}
+ retrieving "invalid" cursors, i.e.
+ #top()/bottom()# from empty list, #find()# without success,
+ results in a nonvalid Cursor ( #!ok()# )
+
+
+ INVARIANTEN!
+*/
+
+template<class T>
+class List
+{
+ public:
+ List(List const&src);
+
+ /// construct empty list
+ List();
+ virtual ~List();
+
+ int size() const;
+
+ Cursor<T> bottom() const; // const sucks.
+ Cursor<T> top() const;
+
+ void OK() const; // check list
+
+ protected:
+ friend class Cursor<T>;
+ friend class Link<T>;
+
+ void concatenate(List<T> const &s);
+
+ /** make *this empty.
+
+ POST:
+ size == 0
+
+ WARNING:
+ contents lost, and not deleted.
+ */
+ void set_empty();
+
+ void add( T const & thing, Cursor<T> &after_me );
+
+ /// put thing before #before_me#
+ void insert( T const & thing, Cursor<T> &before_me );
+
+ /** Remove link pointed to by me. Destructor of contents called
+ (nop for pointers)
+
+ POST
+ none;
+
+
+ WARNING: do not use #me# after calling
+ */
+ void remove( Cursor<T> me );
+
+
+ /* ************** */
+
+ int size_;
+ Link<T>* top_;
+ Link<T>* bottom_;
+};
+
+#include "list.inl"
+#include "cursor.hh"
+
+// instantiate a template: explicit instantiation.
+#define L_instantiate(a) template class List<a>; template class Cursor<a>; \
+ template class Link<a>
+
+
+#endif // __LIST_HH //
+
+
+
+
--- /dev/null
+// -*-c++-*-
+
+#ifndef LIST_INL
+#define LIST_INL
+
+template<class T>
+inline
+List<T>::List()
+{
+ set_empty();
+}
+
+template<class T>
+inline void
+List<T>::set_empty()
+{
+ top_ = bottom_ = 0;
+ size_ = 0;
+}
+
+template<class T>
+inline void
+List<T>::remove( Cursor<T> me )
+{
+ if ( me.ok() ){
+ Link<T> *lp = me.pointer();
+ lp->remove(*this);
+ delete lp;
+ size_--;
+ }
+}
+
+template<class T>
+inline int
+List<T>::size() const
+{
+ return size_;
+}
+
+template<class T>
+inline Cursor<T>
+List<T>::top()const
+{
+ return Cursor<T>( *this, top_ );
+}
+
+
+template<class T>
+inline Cursor<T>
+List<T>::bottom()const
+{
+ return Cursor<T>( *this, bottom_ );
+}
+
+
+#endif
--- /dev/null
+#ifndef LIST_CC
+#define LIST_CC
+
+#include "list.hh"
+
+template<class T>
+List<T>::List(List const&src)
+{
+ set_empty();
+ // probably el stupido
+ for (Cursor<T> c(src); c.ok(); c++)
+ bottom().add(c);
+}
+
+template<class T>
+void
+List<T>::OK() const
+{
+ int i = size_;
+ Link<T> *lp = top_;
+ while (i--) {
+ assert(lp);
+ lp->OK();
+ lp = lp->next();
+ }
+ assert(!lp);
+ i = size_;
+ lp = bottom_;
+ while (i--) {
+ assert(lp);
+ lp->OK();
+ lp = lp->previous();
+ }
+ assert(!lp);
+}
+
+
+template<class T>
+List<T>::~List()
+{
+ Cursor<T> c(*this);
+ while (c.ok())
+ c.del();
+}
+
+/**
+
+ add after after_me.
+
+ Procedure:
+ \begin{itemize}
+ \item if #after_me# is #ok()#, add after #after_me#, else
+ \item if list !empty simply add to bottom, else
+ \item list is empty: create first \Ref{Link} and initialize
+ #bottom_# and #top_#.
+ \end{itemize}
+*/
+template<class T>
+void
+List<T>::add( T const & thing, Cursor<T> &after_me )
+{
+ if (!size_) { // not much choice if list is empty
+ bottom_ = top_ = new Link<T>( thing );
+ if (!after_me.ok())
+ after_me = bottom();
+ } else { // add at aprioprate place
+ if (!after_me.ok())
+ after_me = bottom();
+ Link<T> *p =after_me.pointer();
+ p->add(thing);
+ if (p == bottom_) // adjust bottom_ if necessary.
+ bottom_ = p->next();
+ }
+
+ size_++;
+}
+
+template<class T>
+void
+List<T>::insert( T const & thing, Cursor<T> &before_me )
+{
+ if (!size_) {
+ bottom_ = top_ = new Link<T>( thing );
+ if (!before_me.ok())
+ before_me = top();
+
+ } else {
+ if (!before_me.ok())
+ before_me = top();
+
+ Link<T> *p = before_me.pointer() ;
+
+ p->insert(thing);
+ if (p == top_)
+ top_ = p->previous();
+ }
+
+ size_++;
+}
+
+
+template<class T>
+void
+List<T>::concatenate(List<T> const&s)
+{
+ Cursor<T> b(bottom());
+ for (Cursor<T> c(s); c.ok(); c++) {
+ b.add(c);
+ b++;
+ }
+}
+#endif
--- /dev/null
+#ifndef MATRIX_HH
+#define MATRIX_HH
+
+
+#include "vsmat.hh"
+#include "vector.hh"
+
+/** a Real matrix. This is a class for a nonsquare block of #Real#s. The
+ implementation of sparse matrices is done in the appropriate #smat#
+ class. Matrix only does the mathematical actions (adding,
+ multiplying, etc.)
+
+
+ TODO
+ implement ref counting? */
+
+
+class Matrix {
+ virtual_smat *dat;
+
+public:
+ void OK() const { dat->OK(); }
+ int cols() const { return dat->cols(); }
+ int rows() const { return dat->rows(); }
+
+ /** return the size of a matrix.
+ PRE
+ the matrix needs to be square.
+ */
+ int dim() const;
+
+ // Matrix() { dat = 0; }
+ ~Matrix() { delete dat; }
+
+ /// set entries to r
+ void fill(Real r);
+
+ /// set diagonal to d
+ void set_diag(Real d);
+
+ void set_diag(Vector d);
+ /// set unit matrix
+ void unit() { set_diag(1.0); }
+
+ void operator+=(Matrix const &m);
+ void operator-=(Matrix const &m);
+ void operator*=(Real a);
+ void operator/=(Real a) { (*this) *= 1/a; }
+
+ /** add a row.
+ add a row to the matrix before row k
+
+ PRE
+ v.dim() == cols()
+ 0 <= k <= rows()
+ */
+ void insert_row(Vector v,int k);
+ /** .
+ delete a row from this matrix.
+
+ PRE
+ 0 <= k < rows();
+ */
+ void delete_row(int k) { dat->delete_row(k); }
+ void delete_column(int k) { dat->delete_column(k); }
+
+ /**
+ square n matrix, initialised to null
+ */
+ Matrix(int n);
+
+ /**
+ n x m matrix, init to 0
+ */
+ Matrix(int n, int m);
+ Matrix(Matrix const &m);
+
+ /// dyadic product: v * w.transpose
+ Matrix(Vector v, Vector w);
+ void operator=(Matrix const &m);
+
+ /// access an element
+ Real operator()(int i,int j) const { return dat->elem(i,j); }
+
+ /// access an element
+ Real &operator()(int i, int j) { return dat->elem(i,j); }
+
+ /// Matrix multiply with vec (from right)
+ Vector operator *(Vector const &v) const;
+
+ /// set this to m1*m2.
+ void set_product(Matrix const &m1, Matrix const &m2);
+
+
+ Vector left_multiply(Vector const &) const;
+
+ Matrix operator-() const;
+
+ /// transpose this.
+ void transpose();
+
+ /// return a transposed copy.
+ Matrix transposed() const ;
+
+ Real norm() const;
+ /** swap.
+ PRE
+ 0 <= c1,c2 < cols()
+ */
+ void swap_columns(int c1, int c2);
+
+ /** swap.
+ PRE
+ 0 <= c1,c2 < rows()
+ */
+ void swap_rows(int c1, int c2);
+
+
+ Vector row(int ) const;
+ Vector col(int) const;
+
+ operator String() const;
+ void print() const;
+};
+
+inline Vector
+operator *(Vector &v, Matrix const & m) { return m.left_multiply(v); }
+Matrix operator *(Matrix const & m1,Matrix const &m2);
+Matrix operator /(Matrix const &m1,Real a);
+inline Matrix operator -(Matrix m1,const Matrix m2)
+{
+ m1 -= m2;
+ return m1;
+}
+#endif
--- /dev/null
+#ifndef PATH_HH
+#define PATH_HH
+#include "string.hh"
+#include "varray.hh"
+
+
+/** searching directory for file.
+
+ Abstraction of PATH variable. An interface for searching input files.
+ Search a number of dirs for a file.
+
+ Should use kpathsea?
+
+*/
+
+class File_path : private Array<String>
+{
+public:
+ /// locate a file in the search path
+ String find(String nm);
+
+ /// construct using prefix. Normally argv[0].
+ File_path(String);
+
+ /// add to end of path.
+ Array<String>::push;
+ void add(String str) { push(str); }
+};
+/// split path into its components
+void split_path(String path, String &drive, String &dirs, String &filebase, String &extension);
+
+#endif
--- /dev/null
+#include "pcursor.hh"
+
+template<class T>
+void
+PCursor<T>::junk()
+{
+#if !defined(NDEBUG) && defined(PARANOID)
+ list().OK();
+#endif
+
+ delete ptr();
+#if !defined(NDEBUG)&&defined(PARANOID)
+ thing() = 0;
+ list().OK();
+#endif
+}
--- /dev/null
+#include "plist.hh"
+
+template<class T>
+IPointerList<T>::~IPointerList()
+{
+ PCursor<T> c( *this );
+ while (c.ok()) {
+ delete c.remove_p();
+ }
+}
+
+template<class T>
+PCursor<T>
+PointerList<T>::find(T what ) const
+{
+ PCursor<T> i(*this);
+ for (; i.ok(); i++)
+ if (i.ptr() == what)
+ break;
+ return i;
+}
--- /dev/null
+/*
+ pqueue.hh -- declare
+
+ source file of the LilyPond music typesetter
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+
+#ifndef PQUEUE_HH
+#define PQUEUE_HH
+
+#include "varray.hh"
+
+/**
+ Stupid Prioq. Should use Lists and STL.
+ Smallest is put at the front.
+
+Actually, this sux. Should use a template struct PQuee_ent<V,I>
+ */
+
+template<class V, class I>
+struct PQueue
+{
+ Array<V> value_arr_;
+ Array<I> indices_arr_;
+ void OK() const
+ {
+
+ assert(value_arr_.size() == indices_arr_.size());
+ }
+
+ void enter(V v, I idx) {
+ int j=0;
+ for (; j < value_arr_.size(); j++)
+ if (indices_arr_[j] > idx)
+ break;
+
+ insert(j,v,idx);
+
+ }
+ int size() { return value_arr_.size(); }
+ V front_val() { return value_arr_[0]; }
+ I front_idx() { return indices_arr_[0]; }
+ void del(int i)
+ {
+ value_arr_.del(i);
+ indices_arr_.del(i);
+ }
+ int size() const
+ {
+ OK();
+ return value_arr_.size();
+ }
+
+
+ void insert(int j, V v, I idx)
+ {
+ value_arr_.insert(v, j);
+ indices_arr_.insert(idx, j);
+ }
+
+
+
+ V get() {
+ V retval = front_val();
+ del(0);
+ return retval;
+ }
+
+};
+#endif // PQUEUE_HH
--- /dev/null
+#include <Rational.h>
--- /dev/null
+#ifndef REAL_HH
+#define REAL_HH
+
+
+#include <builtin.h>
+#include <minmax.h>
+#include <math.h>
+
+typedef double Real;
+
+inline Real
+distance(Real x,Real y)
+{
+ return abs(x-y);
+}
+#endif
--- /dev/null
+/*
+ scalar.hh -- part of LilyPond
+
+ (c) 1996 Han-Wen Nienhuys
+*/
+
+#ifndef SCALAR_HH
+#define SCALAR_HH
+#include "string.hh"
+#include "real.hh"
+
+/// Perl -like scalar type.
+struct Scalar : public String {
+
+ Scalar(Real r) : String(r) {}
+ Scalar(int i) : String(i) {}
+ Scalar(char c) : String(c) {}
+ Scalar(char const *c) : String(c) {}
+ Scalar(String s ):String(s) {}
+ Scalar(Rational );
+ operator Rational();
+ Scalar() {}
+ bool isnum();
+ operator Real();
+ operator int();
+
+ /** perl -like string to bool conversion.
+ */
+ operator bool() const;
+
+};
+
+#endif // SCALAR_HH
+
--- /dev/null
+#ifndef SMAT_HH
+#define SMAT_HH
+#include "varray.hh"
+#include "vsmat.hh"
+#include "real.hh"
+/// simplest matrix storage. refer to its baseclass for the doco.
+class Full_storage : public virtual_smat
+{
+ /// height, width
+ int h,w;
+ /// maxima.
+ int maxh, maxw;
+
+ /// the storage
+ Real** els;
+ void
+ init() {
+ els=0;
+ h=w=maxh=maxw=0;
+
+ }
+
+ bool valid(int i, int j) const {
+ return (i>=0 && i < h)
+ && (j < w && j >=0);
+ }
+
+
+ void resize_rows(int);
+ void resize_cols(int);
+
+public:
+ virtual int rows() const {
+ return h;
+ }
+ virtual int cols() const {
+ return w;
+ }
+
+
+ virtual void set_size(int i, int j)
+ {
+ resize(i,j); //this could be more efficient.
+ }
+
+ virtual void set_size(int i) {
+ set_size(i,i);
+ }
+ virtual void resize(int i, int j);
+ virtual void resize(int i) {
+ resize(i,i);
+ }
+
+ virtual Real& elem(int i,int j) {
+ assert(valid(i,j));
+ return els[i][j];
+ }
+ virtual Real const & elem(int i, int j) const {
+ assert(valid(i,j));
+ return els[i][j];
+ }
+ virtual Array<Real> row(int i) const;
+ virtual Array<Real> column(int j) const;
+
+ Full_storage() {
+ init();
+ }
+ Full_storage(int i, int j) {
+ init();
+ set_size(i,j);
+ }
+ Full_storage(Full_storage&);
+ Full_storage(int i) {
+ init();
+ set_size(i);
+ }
+ void OK() const;
+ void operator=(Full_storage const &);
+
+ virtual void insert_row(int k);
+ virtual void delete_row(int k);
+ virtual void delete_column(int k);
+
+
+ ~Full_storage();
+ virtual bool mult_ok(int i, int j)const;
+ virtual void mult_next(int &i, int &j) const ;
+ virtual bool trans_ok(int i, int j) const;
+ virtual void trans_next(int &i, int &j) const;
+ virtual virtual_smat * clone();
+};
+
+#endif
--- /dev/null
+/*
+ PROJECT: FlowerSoft C++ library
+ FILE : string-convert.hh
+
+*/
+
+#ifndef STRING_CONVERT_HH
+#define STRING_CONVERT_HH
+
+/*
+ ///a class which only has functions.
+//#define functor class // cute. docxx fucks up
+*/
+
+/**
+ The functor String_convert handles all conversions to/from String (some
+ time, anyway).
+ The class is quite empty from data view.
+ */
+class String_convert {
+ static int hex2bin_i( String hex_str, String& bin_str_r );
+ static int hex2nibble_i( Byte byte );
+ static Byte nibble2hex_byte( Byte byte );
+public:
+ static String bin2dec_str( String bin_str );
+ static String bin2hex_str( String bin_str );
+ static String dec2bin_str( String str );
+ static int bin2_i( String str );
+ static String char_str(char c, int n);
+ static int dec2_i( String dec_str );
+ static double dec2_f( String dec_str );
+ static String double_str(double f, char const* fmt=0);
+ static int hex2_i( String str );
+ static unsigned hex2_u( String str );
+ static String hex2bin_str( String str );
+ static String int_str(int i, char const *fmt=0 );
+ static String i2hex_str( int i, int length_i, char ch );
+ static String u2hex_str( unsigned u, int length_i, char ch );
+ static String i2dec_str( int i, int length_i, char ch );
+ static String rational_str(Rational);
+ static String pointer_str(void const *);
+ static String i64_str(I64, char const * fmt = 0);
+};
+
+#endif // __STRING_CONVERT_HH //
--- /dev/null
+/*
+ string-data.hh -- declare String_data
+
+ source file of the LilyPond music typesetter
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+
+#ifndef STRINGDATA_HH
+#define STRINGDATA_HH
+
+
+/**Internal String struct.
+ the data itself. Handles simple tasks (resizing, resetting)
+ */
+class String_data {
+ // GNU malloc: storage overhead is 8 bytes anyway.
+
+friend class String_handle;
+ int maxlen; // maxlen is arraysize-1
+
+ int length_i_;
+ Byte* data_byte_p_;
+ int references;
+
+ /// init to ""
+ String_data();
+
+ /// init from src. Conservative allocation.
+ String_data(String_data const &src);
+
+ ~String_data();
+
+ /** POST: maxlen >= j.
+ @param j, maximum stringlength_i_.
+ contents thrown away.
+ */
+ void setmax(int j);
+
+ /** POST: maxlen >= j.
+ @param j, maximum stringlength_i_.
+ contents are kept if it grows.
+ */
+ void remax(int j);
+
+ /// check if writeable.
+ void OKW();
+
+ /// check state.
+ void OK();
+
+ /// reduce memory usage.
+ void tighten();
+
+ // assignment.
+ void set( Byte const* byte_c_l, int length_i );
+
+ void set( char const* ch_c_l );
+
+ /// concatenation.
+ void append( Byte const* byte_c_l, int length_i );
+
+ void operator += ( char const* ch_c_l );
+
+ char const* ch_c_l() const;
+
+ char* ch_l();
+
+ Byte const* byte_c_l() const;
+
+ // idem, non const
+ Byte* byte_l();
+
+ void trunc(int j);
+
+ /** access element. not really safe. Can alter length_i_ without
+ #String_data# knowing it. */
+ Byte &operator [](int j);
+ Byte operator [](int j) const;
+ bool is_binary_bo()const;
+};
+
+
+
+#ifdef STRING_UTILS_INLINED
+#ifndef INLINE
+#define INLINE inline
+#endif
+#include "string-data.inl"
+
+#endif
+
+
+#endif // STRING_DATA_HH
--- /dev/null
+/* -*-C++-*-
+ String_data.inl -- implement String_data
+
+ source file of Flower lib
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+#ifndef STRINGDATA_INL
+#define STRINGDATA_INL
+
+#include <assert.h>
+#include <memory.h>
+
+#include "string-data.hh"
+const int INITIALMAX=8;
+
+#include <sys/types.h>
+
+INLINE void
+String_data::OKW()
+{
+ assert (references == 1);
+}
+
+INLINE void
+String_data::OK()
+{
+ assert(maxlen >= length_i_);
+ assert(bool(data_byte_p_));
+ assert(references >= 1);
+}
+
+
+INLINE
+String_data::String_data()
+{
+ references=0;
+ maxlen = INITIALMAX;
+ data_byte_p_ = new Byte[maxlen + 1];
+ data_byte_p_[0] = 0;
+ length_i_ = 0;
+}
+
+INLINE
+String_data::String_data(String_data const &src)
+{
+ references=0;
+ maxlen = length_i_ = src.length_i_;
+ data_byte_p_ = new Byte[maxlen+1]; // should calc GNU 8byte overhead.
+ memcpy( data_byte_p_, src.data_byte_p_, length_i_ + 1 );
+}
+
+INLINE
+String_data::~String_data()
+{
+ assert(references == 0);
+ delete[] data_byte_p_;
+}
+
+INLINE void
+String_data::setmax(int j)
+{
+ OKW();
+ if (j > maxlen) {
+ delete data_byte_p_;
+ maxlen = j;
+ data_byte_p_ = new Byte[maxlen + 1];
+
+ data_byte_p_[0] = 0;
+ length_i_ = 0;
+ }
+}
+
+/* this is all quite hairy:
+ update of length_i_
+ update of maxlen
+ alloc of buffer
+ copying of buffer
+ needs blondification:
+ split tasks
+ define change authority
+*/
+INLINE void
+String_data::remax(int j)
+{
+ OKW();
+ if (j > maxlen) {
+ Byte *p = new Byte[j + 1];
+ memcpy( p, data_byte_p_, ( maxlen <? length_i_ ) + 1 );
+ maxlen = j;
+ delete[] data_byte_p_;
+ data_byte_p_ = p;
+ }
+}
+
+INLINE void
+String_data::tighten()
+{ // should be dec'd const
+ maxlen = length_i_;
+ Byte *p = new Byte[maxlen + 1];
+ memcpy( p, data_byte_p_, length_i_ + 1 );
+ delete[] data_byte_p_;
+ data_byte_p_ = p;
+}
+// assignment.
+INLINE void
+String_data::set( Byte const* byte_c_l, int length_i )
+{
+ OKW();
+
+ assert( byte_c_l && byte_c_l != data_byte_p_);
+
+ length_i_ = length_i;
+ remax( length_i_ ); // copies too
+ memcpy( data_byte_p_, byte_c_l, length_i_ );
+ data_byte_p_[ length_i_ ] = 0;
+}
+
+INLINE
+void
+String_data::set( char const* ch_c_l )
+{
+ set( (Byte const*)ch_c_l, strlen( ch_c_l ) );
+}
+
+
+/// concatenation.
+INLINE void
+String_data::append( Byte const* byte_c_l, int length_i )
+{
+ OK();
+ OKW();
+ int old_i = length_i_;
+
+ length_i_ += length_i;
+ remax( length_i_ );
+ memcpy( data_byte_p_ + old_i, byte_c_l, length_i );
+ data_byte_p_[ length_i_ ] = 0;
+}
+
+INLINE
+void
+String_data::operator += ( char const* ch_c_l )
+{
+ append( (Byte const*)ch_c_l, strlen( ch_c_l ) );
+}
+
+
+
+INLINE
+char const*
+String_data::ch_c_l() const
+{
+ return (char const*)data_byte_p_;
+}
+INLINE char*
+String_data::ch_l()
+{
+ return (char*)data_byte_p_;
+}
+
+INLINE Byte const*
+String_data::byte_c_l() const
+{
+ return data_byte_p_;
+}
+
+INLINE Byte*
+String_data::byte_l()
+{
+ OKW();
+ return data_byte_p_;
+}
+
+INLINE
+void
+String_data::trunc(int j)
+{
+ OKW();
+ assert(j >= 0 && j <= length_i_);
+ data_byte_p_[j] = 0;
+ length_i_ = j;
+}
+
+INLINE bool
+String_data::is_binary_bo()const
+{
+// return !memchr(data_byte_p_, length_i_, 0);
+ return ( (int)strlen( (char const*)data_byte_p_ ) != length_i_ );
+}
+
+INLINE Byte&
+String_data::operator [](int j)
+{
+ assert(j >= 0 && j <= length_i_);
+ return data_byte_p_[j] ;
+}
+
+INLINE Byte
+String_data::operator [](int j) const
+{
+ assert(j >= 0 && j <= length_i_);
+ return data_byte_p_[j];
+}
+
+
+
+
+#endif // __STRING_UTIL_CC //
--- /dev/null
+/*
+ string-handle.hh -- declare String_handle
+
+ source file of the LilyPond music typesetter
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+
+#ifndef STRINGHANDLE_HH
+#define STRINGHANDLE_HH
+#include "fproto.hh"
+
+
+/**
+ Reference counting for strings.
+
+ handles ref. counting, and provides a very thin interface using
+ Byte *
+
+ */
+class String_handle {
+ String_data* data;
+
+ /// decrease ref count. Named kind of like a Tanenbaum semafore
+ void down();
+
+ /// increase ref count
+ void up(String_data *d);
+
+ /** make sure data has only one reference.
+ POST: data->references == 1
+ */
+ void copy();
+
+public:
+ String_handle();
+ ~String_handle();
+ String_handle(String_handle const & src);
+
+ Byte const* byte_c_l() const;
+ char const* ch_c_l() const;
+ Byte* byte_l();
+ char* ch_l();
+ bool is_binary_bo()const;
+ void operator =(String_handle const &src);
+ void operator += (char const *s);
+ Byte operator[](int j) const;
+
+ /** Access elements. WARNING: NOT SAFE
+ don't use this for loops. Use byte_c_l()
+ */
+ Byte &operator[](int j);
+ void append( Byte const* byte_c_l, int length_i );
+ void set( Byte const* byte_c_l, int length_i );
+ void operator = (char const *p);
+ void trunc(int j);
+ int length_i() const;
+};
+
+#ifdef STRING_UTILS_INLINED
+#ifndef INLINE
+#define INLINE inline
+#endif
+#include "string-handle.inl"
+/* we should be resetting INLINE. oh well. */
+#endif
+
+
+#endif // STRINGHANDLE_HH
--- /dev/null
+/* -*-c++-*-
+
+ stringhandle.inl -- implement String_handle
+
+ source file of Flower lib
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+#ifndef STRINGHANDLE_INL
+#define STRINGHANDLE_INL
+
+#include <assert.h>
+#include <memory.h>
+
+#include "string-data.hh"
+#include "string-handle.hh"
+
+INLINE void
+String_handle::down()
+{
+ if (!(--data->references)) delete data; data = 0;
+}
+
+/// increase ref count
+INLINE void
+String_handle::up(String_data *d)
+{
+ data=d; data->references ++;
+}
+
+INLINE void
+String_handle::copy()
+{
+ if (data->references !=1){
+ String_data *newdata = new String_data(*data);
+ down();
+ up(newdata);
+ }
+}
+
+INLINE
+String_handle::String_handle()
+{
+ up(new String_data);
+}
+
+INLINE
+String_handle::~String_handle()
+{
+ down();
+}
+
+INLINE
+String_handle::String_handle(String_handle const & src)
+{
+ up(src.data);
+}
+
+INLINE Byte*
+String_handle::byte_l()
+{
+ copy();
+ return data->byte_l();
+}
+
+INLINE char*
+String_handle::ch_l()
+{
+ copy();
+ return (char*)data->byte_l();
+}
+
+INLINE Byte
+const* String_handle::byte_c_l() const
+{
+ return data->byte_c_l();
+}
+
+INLINE char const*
+String_handle::ch_c_l() const
+{
+ return (char const*)data->byte_c_l();
+}
+
+INLINE void
+String_handle::operator =(String_handle const &src)
+{
+ if (this == &src)
+ return;
+ down();
+ up(src.data);
+}
+
+INLINE void
+String_handle::operator += (char const *s)
+{
+ copy();
+ *data += s;
+}
+
+
+INLINE Byte
+String_handle::operator[](int j) const
+{
+ return (*data)[j];
+}
+
+// !NOT SAFE!
+// don't use this for loops. Use byte_c_l()
+INLINE Byte &
+String_handle::operator[](int j)
+{
+ copy(); // hmm. Not efficient
+ return data->byte_l()[j];
+}
+
+INLINE void
+String_handle::append( Byte const* byte_c_l, int length_i )
+{
+ copy();
+ data->append( byte_c_l, length_i );
+}
+
+INLINE void
+String_handle::set( Byte const* byte_c_l, int length_i )
+{
+ copy();
+ data->set( byte_c_l, length_i );
+}
+
+INLINE void
+String_handle::operator = (char const *p)
+{
+ copy();
+ data->set( p );
+}
+
+INLINE void
+String_handle::trunc(int j)
+{
+ copy(); data->trunc(j);
+}
+
+INLINE int
+String_handle::length_i() const
+{
+ return data->length_i_;
+}
+
+INLINE bool
+String_handle::is_binary_bo() const {
+ return data->is_binary_bo();
+}
+
+#endif
--- /dev/null
+/*
+
+ FILE : string.hh -- declare String
+
+ Rehacked by HWN 3/nov/95
+ removed String & 's
+ introduced Class String_handle
+ */
+
+#ifndef STRING_HH
+#define STRING_HH
+
+
+#include <string.h>
+#include <iostream.h>
+#include <Rational.h>
+
+#include "string-handle.hh"
+
+/**
+
+ Intuitive string class. provides
+\begin{itemize}
+\item
+ ref counting through #String_handle#
+\item
+ conversion from bool, int, double, char* , char.
+\item
+ to be moved to String_convert:
+ conversion to int, upcase, downcase
+
+\item
+ printable.
+
+\item
+ indexing (index_i, index_any_i, last_index_i)
+
+\item
+ cutting (left_str, right_str, mid_str)
+
+\item
+ concat (+=, +)
+
+\item
+ signed comparison (<, >, ==, etc)
+
+\item
+ No operator[] is provided, since this would be enormously slow. If needed,
+ convert to char const* .
+\end{itemize}
+
+*/
+class String
+{
+protected:
+ String_handle strh_;
+
+ bool null_terminated();
+
+public:
+
+ /** init to empty string. This is needed because other
+ constructors are provided.*/
+ String() { }
+ String(Rational);
+
+ /// String s = "abc";
+ String( char const* source );
+ String( Byte const* byte_c_l, int length_i );
+
+ /// "ccccc"
+ String( char c, int n = 1 );
+
+ String( int i , char const *fmt=0);
+ String ( double f , char const* fmt =0);
+ /// 'true' or 'false'
+ String(bool );
+
+ /// return a "new"-ed copy of contents
+ Byte* copy_byte_p() const; // return a "new"-ed copy of contents
+
+ char const* ch_c_l() const;
+ Byte const* byte_c_l() const;
+ char* ch_l();
+ Byte* byte_l();
+
+ /// deprecated; use ch_c_l()
+ operator char const* () const { return ch_c_l(); }
+
+ String &operator =( String const & source );
+
+ /// concatenate s
+ void operator += (char const* s) { strh_ += s; }
+ void operator += (String s);
+
+ void append(String);
+ void prepend(String);
+
+ char operator []( int n ) const { return strh_[n]; }
+
+ /// return n leftmost chars
+ String left_str( int n ) const;
+
+ /// return n rightmost chars
+ String right_str( int n ) const;
+
+ /// return uppercase of *this
+ String upper_str() const;
+
+ /// return lowercase of *this
+ String lower_str() const;
+
+ /// return the "esrever" of *this
+ String reversed_str() const;
+
+
+ /// return a piece starting at index_i (first char = index_i 0), length n
+ String mid_str(int index_i, int n ) const;
+
+ /// cut out a middle piece, return remainder
+ String nomid_str(int index_i, int n ) const;
+
+ /// signed comparison, analogous to memcmp;
+ static int compare_i(String const & s1,const String& s2);
+
+ /// index of rightmost c
+ int index_last_i( char c) const;
+
+ /// index of rightmost element of string
+ int index_last_i( char const* string ) const;
+
+ int index_i(char c ) const;
+ int index_i(String ) const;
+ int index_any_i(String ) const;
+
+ void to_upper();
+ void to_lower();
+ /// provide Stream output
+ void print_on(ostream& os) const;
+
+ /// the length of the string
+ int length_i() const;
+
+ // ***** depreciated
+ int len() const {
+ return length_i();
+ }
+
+ /// convert to an integer
+ int value_i() const;
+
+ /// convert to a double
+ double value_f() const;
+};
+
+#include "compare.hh"
+
+instantiate_compare(String const &, String::compare_i);
+
+// because char const* also has an operator ==, this is for safety:
+inline bool operator==(String s1, char const* s2){
+ return s1 == String(s2);
+}
+inline bool operator==(char const* s1, String s2)
+{
+ return String(s1)==s2;
+}
+inline bool operator!=(String s1, char const* s2 ) {
+ return s1!=String(s2);
+}
+inline bool operator!=(char const* s1,String s2) {
+ return String(s2) !=s1;
+}
+
+
+inline String
+operator + (String s1, String s2)
+{
+ s1 += s2;
+ return s1;
+}
+
+inline ostream &
+operator << ( ostream& os, String d )
+{
+ d.print_on(os);
+ return os;
+}
+
+
+// String quoteString(String message, String quote);
+
+#endif
--- /dev/null
+#ifndef TEXTDB_HH
+#define TEXTDB_HH
+
+#include "data-file.hh"
+
+/**a "const" Array. Contents can't be changed. do "#" comments, read quote enclosed fields */
+
+class Text_record : Array<String>
+{
+ int line_no;
+ String filename;
+
+public:
+ Text_record() { } // needed because of other ctor
+
+ /// report an error in this line.
+ message(String s) {
+ cerr << '\n'<< filename << ": "<< line_no << s << "\n";
+ }
+ String operator[](int j) {
+ return Array<String>::operator[](j);
+ }
+
+ Text_record(Array<String> s, String fn, int j) : Array<String>(s) {
+ filename = fn; line_no = j;
+ }
+ Array<String>::size;
+};
+
+/** abstraction for a datafile.
+ add a subrec/fieldsep/record separator
+ */
+
+class Text_db : private Data_file
+{
+ void gobble_leading_white();
+public:
+ /// get a line with records
+ Text_record get_record();
+
+ Text_db(String fn):Data_file(fn) { }
+ Data_file::error;
+ bool eof();
+
+ /// get next line.
+ Text_record operator++(int) {
+ return get_record();
+ }
+ /// are we done yet?
+ operator bool() {
+ return !eof();
+ }
+};
+
+#endif
--- /dev/null
+
+#ifndef TEXTSTR_HH
+#define TEXTSTR_HH
+
+#include <stdio.h>
+#include <ctype.h>
+#include "string.hh"
+#include "varray.hh"
+
+/**
+ line counting input stream.
+ a stream for textfiles. linecounting. Thin interface getchar and
+ ungetchar. (ungetc is unlimited)
+
+ should protect get and unget against improper use
+*/
+
+
+class Text_stream
+{
+ int line_no;
+
+ // could just have used streams.
+ FILE *f;
+ Array<char> pushback;
+ String name;
+
+ public:
+ Text_stream(String fn);
+ String get_name() { return name; }
+ bool eof() {
+ return feof(f);
+ }
+ bool eol() {
+ return (peek() == '\n');
+ }
+ char peek() {
+ char c = get();
+ unget(c);
+ return c;
+ }
+ int line(){
+ return line_no;
+ }
+
+ char get() {
+ char c;
+
+ if (pushback.empty())
+ c = getc(f);
+ else
+ c = pushback.pop();
+
+ if (c =='\n')
+ line_no++;
+ return c;
+ }
+ void unget(char c) {
+ if (c =='\n')
+ line_no--;
+ pushback.push(c);
+ }
+ ~Text_stream (){
+ if (!eof())
+ cerr <<__FUNCTION__<< ": closing unended file";
+
+ fclose(f);
+ }
+
+ /// GNU format message.
+ void message(String s);
+};
+
+#endif
--- /dev/null
+#ifndef UNIONFIND_HH
+#define UNIONFIND_HH
+#include "varray.hh"
+
+/*
+ which points of a graph are connected?.
+ Union find, a standard algorithm:
+
+ Union_find represents an undirected graph of N points. You can
+ connect two points using #connect()#. #find(i)# finds a uniquely
+ determined representant of the equivalence class of points
+ connected to #i#.
+
+ */
+struct Union_find {
+ void connect(int i, int j);
+ int find(int i);
+ bool equiv(int i, int j) { return find(i) == find(j); }
+ Union_find(int sz);
+
+private:
+ Array<int> classes;
+
+};
+#endif
--- /dev/null
+/*
+ (c) Han-Wen Nienhuys 1995,96
+
+ Distributed under GNU GPL
+*/
+
+#ifndef ARRAY_H
+#define ARRAY_H
+#include <assert.h>
+
+/// copy a bare (C-)array from #src# to #dest# sized #count#
+template<class T>
+inline void arrcpy(T*dest, T*src, int count) {
+ for (int i=0; i < count ; i++)
+ *dest++ = *src++;
+}
+
+
+/**
+ Scaleable array/stack template, for a type T with default constructor.
+
+
+ This template implements a scaleable vector. With (or without) range
+ checking. It may be flaky for objects with complicated con- and
+ destructors. The type T should have a default constructor. It is
+ best suited for simple types, such as int, double or String, it
+ provides a paranoidly safe replacement for the new T[int] construct.
+
+ It uses stack terminology, (push, pop, top), and can be used as a stack.
+
+
+ */
+template<class T>
+class Array {
+protected:
+ /// maximum length of array.
+ int max;
+
+ /// the data itself
+ T *thearray;
+
+ /// stretch or shrink array.
+ void remax(int newmax) {
+ T* newarr = new T[newmax];
+ size_ = (newmax < size_) ? newmax : size_;
+ arrcpy(newarr, thearray, size_);
+
+ delete[] thearray;
+ thearray = newarr;
+ max = newmax;
+ }
+ int size_;
+
+public:
+ /// check invariants
+ void OK() const {
+ assert(max >= size_ && size_ >=0);
+ if (max) assert(thearray);
+ }
+ /** report the size_.
+ @see {setsize_}
+ */
+ int size() const { return size_; }
+
+ /// POST: size() == 0
+ void clear() { size_ = 0; }
+
+ Array() { thearray = 0; max =0; size_ =0; }
+
+
+ /** set the size_ to #s#.
+ POST: size() == s.
+ Warning: contents are unspecified */
+ void set_size(int s) {
+ if (s >= max) remax(s);
+ size_ = s;
+ }
+
+ ~Array() { delete[] thearray; }
+
+ /// return a "new"ed copy of array
+ T* copy_array() const {
+ T* Tarray = new T[size_];
+ arrcpy(Tarray, thearray, size_);
+ return Tarray;
+ }
+ // depracated
+ operator T* () const {
+ return copy_array();
+ }
+ void operator=(Array const & src) {
+ set_size (src.size_);
+ arrcpy(thearray,src.thearray, size_);
+ }
+ Array(Array const & src) {
+ thearray = src.copy_array();
+ max = size_ = src.size_;
+ }
+
+ /// tighten array size_.
+ void precompute () { remax(size_); }
+
+ /// this makes Array behave like an array
+ T &operator[] (const int i) const {
+ assert(i >=0&&i<size_);
+ return ((T*)thearray)[i];
+ }
+
+ /// add to the end of array
+ void push(T x) {
+ if (size_ == max)
+ remax(2*max + 1);
+
+ // T::operator=(T &) is called here. Safe to use with automatic
+ // vars
+ thearray[size_++] = x;
+ }
+ /// remove and return last entry
+ T pop() {
+ assert(!empty());
+ T l = top(0);
+ set_size(size()-1);
+ return l;
+ }
+ /// access last entry
+ T& top(int j=0) {
+ return (*this)[size_-j-1];
+ }
+ /// return last entry
+ T top (int j=0) const {
+ return (*this)[size_-j-1];
+ }
+
+
+ void swap (int i,int j) {
+ T t((*this)[i]);
+ (*this)[i]=(*this)[j];
+ (*this)[j]=t;
+ }
+ bool empty() { return !size_; }
+ void insert(T k, int j) {
+ assert(j >=0 && j<= size_);
+ set_size(size_+1);
+ for (int i=size_-1; i > j; i--)
+ thearray[i] = thearray[i-1];
+ thearray[j] = k;
+ }
+ void del(int i) {
+ assert(i >=0&& i < size_);
+ arrcpy(thearray+i, thearray+i+1, size_-i-1);
+ size_--;
+ }
+ // quicksort.
+ void sort (int (*compare)( T const&,T const&),
+ int lower = -1, int upper = -1 ) {
+ if (lower < 0) {
+ lower = 0 ;
+ upper = size()-1;
+ }
+ if (lower >= upper)
+ return;
+ swap(lower, (lower+upper)/2);
+ int last = lower;
+ for (int i= lower +1; i <= upper; i++)
+ if (compare(thearray[i], thearray[lower]) < 0 )
+ swap( ++last,i);
+ swap(lower, last);
+ sort(compare, lower, last-1);
+ sort(compare, last+1, upper);
+ }
+ void concat(Array<T> const &src) {
+ int s = size_;
+ set_size(size_ + src.size_);
+ arrcpy(thearray+s,src.thearray, src.size_);
+ }
+ Array<T> subvec(int lower, int upper) {
+ assert(lower >= 0 && lower <=upper&& upper <= size_);
+ Array<T> r;
+ int s =upper-lower;
+ r.set_size(s);
+ arrcpy(r.thearray, thearray + lower, s);
+ return r;
+ }
+};
+
+#endif
--- /dev/null
+#ifndef VECTOR_HH
+#define VECTOR_HH
+
+#include <math.h>
+#include "real.hh"
+#include "varray.hh"
+
+class Dstream;
+class String;
+void set_matrix_debug(Dstream&ds);
+
+/** a row of numbers.
+ a vector. Storage is handled in Array, Vector only does the mathematics.
+ */
+class Vector {
+ Array<Real> dat;
+public:
+ void OK() const { dat.OK();}
+ int dim() const { return dat.size(); }
+ Vector() { }
+ Vector(Array<Real> d );
+ Vector(Vector const &n);
+ Vector(int n) {
+ dat.set_size(n);
+ fill(0);
+ }
+ void insert(Real v, int i) {
+ dat.insert(v,i);
+ }
+ void del(int i) { dat.del(i); }
+ operator String() const;
+ void fill(Real r) {
+ for (int i=0; i < dim(); i++)
+ dat[i] =r;
+ }
+
+ void operator +=(Vector v) {
+ assert(v.dim() == dim());
+ for (int i=0; i < dim(); i++)
+ dat[i] += v.dat[i];
+ }
+
+ void operator /=(Real a) {
+ (*this) *= 1/a;
+ }
+
+ void operator *=(Real a) {
+ for (int i=0; i < dim(); i++)
+ dat[i] *= a;
+ }
+
+ void operator -=(Vector v) {
+ assert(v.dim() == dim());
+ for (int i=0; i < dim(); i++)
+ dat[i] -= v(i);
+ }
+
+ Real &operator()(int i) { return dat[i]; }
+ Real operator()(int i) const { return dat[i]; }
+ Real elem(int i) { return dat[i]; }
+ Real operator *(Vector v) const {
+ Real ip=0;
+ assert(v.dim() == dim());
+ for (int i=0; i < dim(); i++)
+ ip += dat[i] *v(i);
+ return ip;
+ }
+ Vector operator-() const;
+ Real norm() {
+ return sqrt(norm_sq() );
+ }
+ Real norm_sq() {
+ return ((*this) * (*this));
+ }
+ operator Array<Real> () { return dat; }
+ void print() const;
+ /// set to j-th element of unit-base
+ void set_unit(int j) ;
+};
+
+inline Vector
+operator+(Vector a, Vector const &b) {
+ a += b;
+ return a;
+}
+
+inline Vector
+operator-(Vector a, Vector const &b) {
+ a -= b;
+ return a;
+}
+
+inline Vector
+operator*(Vector v, Real a) {
+ v *= a;
+ return v;
+}
+
+inline Vector
+operator*( Real a,Vector v) {
+ v *= a;
+ return v;
+}
+
+inline Vector
+operator/(Vector v,Real a) {
+ v *= 1/a;
+ return v;
+}
+
+#endif
--- /dev/null
+#ifndef VSMAT_HH
+#define VSMAT_HH
+#include "varray.hh"
+#include "real.hh"
+/** base class for interface with matrix storageclasses. There are no
+ iterators for matrixclasses, since matrices are (like arrays)
+ explicitly int-indexed.
+
+ Iteration is provided by *_next, *_ok, which update and check both
+ index variables simultaneously.
+
+ TODO
+ determine type of product matrix.
+
+*/
+class virtual_smat {
+
+
+public:
+ /// check invariants
+ virtual void OK() const=0;
+
+ /// height of matrix
+ virtual int rows() const = 0;
+
+ /// width of matrix
+ virtual int cols() const = 0;
+
+
+ /** set the size. contents lost.
+ PRE
+ i >=0, j>=0
+ */
+ virtual void set_size(int i, int j) = 0;
+
+ /**set the size to square dimen. contents lost
+ PRE
+ i>=0
+ */
+ virtual void set_size(int i) = 0;
+ /**set the size to i.
+
+ keep contents. If enlarged contents unspecified
+
+ PRE
+ i>=0, j>=0
+
+ */
+ virtual void resize(int i, int j) = 0;
+
+ /**
+ set the size to square dimen. contents kept
+ Keep contents. If enlarged contents are unspecified
+
+ PRE
+ i>=0
+ */
+ virtual void resize(int i) = 0;
+
+
+ /**
+ access an element.
+
+ Generate an errormessage, if this happens
+ in the 0-part of a sparse matrix.
+ */
+
+ virtual Real& elem(int i,int j) = 0;
+
+ /// access a element, no modify
+ virtual Real const & elem(int i, int j) const = 0;
+
+#if 1
+ virtual Array<Real> row(int i) const = 0;
+ virtual Array<Real> column(int j) const = 0;
+#endif
+
+
+ /**
+ add a row to the matrix before row k. Contents
+ of added row are unspecified
+
+ 0 <= k <= rows()
+ */
+ virtual void insert_row(int k)=0;
+
+
+ /**
+ delete a row from this matrix.
+
+ PRE
+ 0 <= k < rows();
+ */
+ virtual void delete_row(int k)=0;
+ virtual void delete_column(int k)=0;
+ virtual ~virtual_smat() { }
+ virtual virtual_smat *clone()=0;
+
+
+
+ /**
+ at end of matrix?. when doing loop
+
+ for(i=0; i<h; i++)
+ for(j=0; j<w; j++)
+ ..
+
+ */
+ virtual bool mult_ok(int i, int j) const=0;
+
+ /**
+ walk through matrix (regular multiply).
+ get next j for row i, or get next row i and reset j.
+ this will make sparse matrix implementation easy.
+
+ PRE
+ mult_ok(i,j)
+ */
+ virtual void mult_next(int &i, int &j) const = 0;
+
+/**
+ valid matrix entry. return false if at end of row
+ */
+ virtual bool trans_ok(int i, int j) const=0;
+
+ /**
+ walk through matrix (transposed multiply).
+ Get next i (for column j)
+
+ PRE
+ ver_ok(i,j)
+ */
+
+ virtual void trans_next(int &i, int &j) const = 0;
+ /// generate a "Full_storage" matrix
+ static virtual_smat *get_full(int n, int m);
+
+};
+
+
+#endif
--- /dev/null
+/*
+ process command line, GNU style.
+
+ this is (Copyleft) 1996, Han-Wen Nienhuys, <hanwen@stack.nl>
+ */
+#include <stdio.h>
+#include <iostream.h>
+#include <assert.h>
+#include "lgetopt.hh"
+
+long
+Getopt_long::intarg()
+{
+ long l;
+ if (sscanf(optarg, "%ld", &l) != 1)
+ report(E_ILLEGALARG);
+
+ return l;
+}
+
+Long_option_init *
+Getopt_long::parselong()
+{
+ char const *optnm = argv[optind] + 2 ;
+ assert(*optnm);
+
+ char *endopt = strchr(optnm, '=');
+ int searchlen = (endopt) ? endopt - optnm : strlen(optnm);
+
+ beet=0;
+ for (int i=0; i< table_len; i++) {
+ char const *ln = the_opts[i].longname;
+
+ if (ln && !strncmp(ln, optnm, searchlen)) {
+ beet = the_opts+i;
+ break;
+ }
+ }
+
+ if (!beet) {
+ report(E_UNKNOWNOPTION);
+ return 0;
+ }
+ optind++;
+ optindind = 0;
+
+
+ if (beet->take_arg) {
+ if (endopt)
+ optarg = endopt +1; // a '='
+ else {
+ optarg = argv[optind];
+ optind++;
+ }
+ if (!optarg)
+ report(E_ARGEXPECT);
+
+ } else {
+ optarg = 0;
+ if (endopt)
+ report(E_NOARGEXPECT);
+ }
+
+ return beet;
+}
+
+
+ostream &
+Long_option_init::printon(ostream &errorout)
+{
+ if (shortname)
+ errorout <<"-" << shortname;
+ if (shortname && longname)
+ errorout << ", ";
+ if (longname)
+ errorout << "`--" << longname << "'";
+ return errorout;
+}
+
+// report an error, GNU style.
+void
+Getopt_long::report(Errorcod c)
+{
+ error = c;
+ if (!errorout)
+ return;
+
+ *errorout << argv[0] << ": ";
+ switch (c) {
+ case E_ARGEXPECT:
+ *errorout<< "option ";
+ beet->printon(*errorout);
+ *errorout << "requires an argument"<<endl;
+ break;
+ case E_NOARGEXPECT:
+ *errorout << "option `--" <<
+ beet->longname << "' does not allow an argument"<<endl;
+ break;
+
+ case E_UNKNOWNOPTION:
+ *errorout << "unrecognized option ";
+ if (optindind)
+ *errorout << "-" << argv[optind][optindind] << endl;
+ else
+ *errorout << argv[optind] << endl;
+
+ break;
+ case E_ILLEGALARG:
+ *errorout << "illegal argument `" << optarg << "\'to option ";
+ beet->printon(*errorout);
+ *errorout << '\n';
+ default:
+ assert(false);
+ }
+ exit(2);
+}
+
+Long_option_init *
+Getopt_long::parseshort()
+{
+ char c=argv[optind][optindind];
+ beet=0;
+ assert(c);
+
+ for (int i=0; i < table_len; i++)
+ if (the_opts[i].shortname == c) {
+ beet = the_opts+i;
+ break;
+ }
+
+ if (!beet){
+ report(E_UNKNOWNOPTION);
+ return 0;
+ }
+
+ optindind++;
+ if (!beet->take_arg){
+ optarg = 0;
+ return beet;
+ }
+ optarg = argv[optind] + optindind;
+
+ optind ++;
+ optindind = 0;
+
+ if (!optarg[0]) {
+ optarg = argv[optind];
+ optind ++;
+ }
+ if (!optarg) {
+ report(E_ARGEXPECT);
+ }
+
+ return beet;
+}
+
+Long_option_init *
+Getopt_long::operator()() {
+ if (!next())
+ return 0;
+
+ if (optindind)
+ return parseshort();
+
+ if (argv[optind][0] != '-')
+ return 0;
+
+ if (argv[optind][1] == '-') {// what to do with "command -- bla"
+ return parselong();
+ } else {
+ optindind = 1;
+ return parseshort();
+ }
+}
+
+Getopt_long::Getopt_long(int c, char **v, Long_option_init *lo)
+{
+ the_opts = lo;
+ errorout = &cerr;
+ argv = v;
+ argc = c;
+ optind = 1;
+ optindind = 0;
+
+ // reached end of option table?
+ int i;
+ for (i = 0; the_opts[i].longname ||the_opts[i].shortname; i++)
+ ;
+ table_len = i;
+}
+
+bool
+Getopt_long::next()
+{
+
+ error = E_NOERROR;
+ while (optind < argc && !argv[optind][optindind]) {
+ optind++;
+ optindind = 0;
+ }
+ return (optind < argc);
+}
+
+char *
+Getopt_long::current_arg()
+{
+ if (optind >= argc)
+ return 0;
+ char * a = argv[optind];
+ return a + optindind;
+}
+
+char *
+Getopt_long::get_next_arg()
+{
+ char * a = current_arg();
+ if ( a) {
+ optind ++;
+ optindind = 0;
+ }
+ return a;
+}
+++ /dev/null
-#
-# project LilyPond -- the musical typesetter
-# title makefile for micro-lily-lib
-# file lib/Makefile
-#
-# Copyright (c) 1997 by
-# Jan Nieuwenhuizen <jan@digicash.com>
-# Han-Wen Nienhuys <hanwen@stack.nl>
-#
-
-# subdir level:
-#
-depth = ../..
-#
-
-# generic variables:
-#
-include ./$(depth)/make/Variables.make
-#
-
-# identify module:
-#
-NAME = flower
-MODULE_NAME = flower
-include ./$(depth)/flower/.version
-build = ./$(depth)/flower/$(outdir)/.build
-#
-
-# descent order into subdirectories:
-#
-SUBDIRS = include
-#
-
-# to be remade each build:
-#
-VERSION_DEPENDENCY =#
-#
-
-# list of c++ header files:
-#
-HHFILES = $(shell ls *.hh $(ERROR_LOG))
-#
-
-# list of c++ source files:
-#
-CCFILES = $(shell ls *.cc $(ERROR_LOG))
-#
-
-# list of other source files:
-#
-EXTRA_SOURCE_FILES = $(shell ls *.y *.l $(ERROR_LOG))
-#
-
-# list of distribution files:
-#
-DISTFILES = Makefile $(HHFILES) $(CCFILES) $(EXTRA_SOURCE_FILES)
-#
-
-# list of custom libraries:
-#
-# yes, i know about the -L and -l options,
-# but these libraries get rebuild when needed.
-CUSTOMLIBES = \
-
-LOADLIBES +=
-#
-
-# main target of this module:
-#
-# MAINTARGET = $(EXECUTABLE)
-# MAINTARGET = $(LIBRARY)
-# MAINTARGET = $(bindir)/$(EXECUTABLE)# huh?
-MAINTARGET = $(libdir)/$(LIBRARY)# huh?
-
-default: $(MAINTARGET)
-#
-
-# # sic.
-# $(include-flower)/flower-config.hh:
-# touch $@
-
-# generic targets and rules:
-#
-include ./$(depth)/make/Targets.make
-include ./$(depth)/make/Rules.make
-#
-
-# list of depend files:
-#
-DEPFILES = $(shell ls $(depdir)/*.dep $(ERROR_LOG))
-#
-
-# auto dependencies:
-#
--include /dev/null $(DEPFILES)
-#
-
+++ /dev/null
-#include "choleski.hh"
-const Real EPS = 1e-7; // so sue me. Hard coded
-
-Vector
-Choleski_decomposition::solve(Vector rhs)const
-{
- int n= rhs.dim();
- assert(n == L.dim());
- Vector y(n);
-
- // forward substitution
- for (int i=0; i < n; i++) {
- Real sum(0.0);
- for (int j=0; j < i; j++)
- sum += y(j) * L(i,j);
- y(i) = (rhs(i) - sum)/L(i,i);
- }
- for (int i=0; i < n; i++)
- y(i) /= D(i);
-
- // backward subst
- Vector &x(rhs); // using input as return val.
- for (int i=n-1; i >= 0; i--) {
- Real sum(0.0);
- for (int j=i+1; j < n; j++)
- sum += L(j,i)*x(j);
- x(i) = (y(i) - sum)/L(i,i);
- }
- return x;
-}
-
-/*
- Standard matrix algorithm.
- */
-
-Choleski_decomposition::Choleski_decomposition(Matrix P)
- : L(P.dim()), D(P.dim())
-{
- int n = P.dim();
- assert((P-P.transposed()).norm()/P.norm() < EPS);
-
- L.unit();
- for (int k= 0; k < n; k++) {
- for (int j = 0; j < k; j++){
- Real sum(0.0);
- for (int l=0; l < j; l++)
- sum += L(k,l)*L(j,l)*D(l);
- L(k,j) = (P(k,j) - sum)/D(j);
- }
- Real sum=0.0;
-
- for (int l=0; l < k; l++)
- sum += sqr(L(k,l))*D(l);
- Real d = P(k,k) - sum;
- D(k) = d;
- }
-
-#ifdef NDEBUG
- assert((original()-P).norm() / P.norm() < EPS);
-#endif
-}
-
-Matrix
-Choleski_decomposition::original() const
-{
- Matrix T(L.dim());
- T.set_diag(D);
- return L*T*L.transposed();
-}
-
-Matrix
-Choleski_decomposition::inverse() const
-{
- int n=L.dim();
- Matrix invm(n);
- Vector e_i(n);
- for (int i = 0; i < n; i++) {
- e_i.set_unit(i);
- Vector inv(solve(e_i));
- for (int j = 0 ; j<n; j++)
- invm(i,j) = inv(j);
- }
-
-#ifdef NDEBUG
- Matrix I1(n), I2(original());
- I1.unit();
- assert((I1-original()*invm).norm()/original.norm() < EPS);
-#endif
-
- return invm;
-}
+++ /dev/null
-#include <fstream.h>
-#include <ctype.h>
-
-#include "data-file.hh"
-
-void
-Data_file::gobble_white()
-{
- char c;
-
- while ((c=data_get()) == ' ' ||c == '\t')
- if (eof())
- break;
-
- data_unget(c);
-}
-
-String
-Data_file::get_word()
-{// should handle escape seq's
- String s;
-
- while (1)
- {
- char c = data_get();
-
- if (isspace(c) || eof())
- {
- data_unget(c);
- break;
- }
-
-
- if (c == '\"')
- {
- rawmode= true;
-
- while ((c = data_get()) != '\"')
- if (eof())
- error("EOF in a string");
- else
- s += c;
-
-
- rawmode= false;
- }
- else
- s += c;
- }
-
- return s;
-}
-
-/** get a char
- Only class member who uses text_file::get
- */
-char
-Data_file::data_get() {
- char c = get();
- if (!rawmode && c == '#') // gobble comment
- {
- while ((c = get()) != '\n' && !eof())
- ;
- return '\n';
- }
-
- return c;
-}
-
-/// read line, gobble '\n'
-String Data_file::get_line()
-{
- char c;
- String s;
-
- while ((c = data_get()) != '\n' && !eof())
- s += c;
- return s;
-}
-
-/// gobble stuff before first entry on a line.
-void
-Data_file::gobble_leading_white()
-{
- // eat blank lines.
- while (!eof()) {
- char c = data_get();
- if (!isspace(c)) {
- data_unget(c);
- break;
- }
- }
-}
-
-
+++ /dev/null
-
-
-#include <fstream.h>
-#include "assoc.hh"
-#include "dstream.hh"
-#include "scalar.hh"
-#include "text-db.hh"
-#include "string-convert.hh"
-
-/// indent of each level
-const INDTAB = 2;
-
-/*
- should use Regexp library.
- */
-static String
-strip_pretty(String pretty_str)
-{
- int i = pretty_str.index_i('(');
- if (i>=0)
- pretty_str = pretty_str.left_str(i);
-
- int l = pretty_str.index_last_i(' '); // strip until last ' '
- if (l>=0)
- pretty_str = pretty_str.nomid_str(0,l+1);
- return pretty_str;
-}
-
-static String
-strip_member(String pret)
-{
- int l=pret.index_last_i(':')-1;
- if (l>=0)
- pret = pret.left_str(l );
- return pret;
-}
-
-Dstream&
-Dstream::identify_as(String name)
-{
- if (!os)
- return *this;
-
- String mem(strip_pretty(name));
- String cl(strip_member(mem));
- String idx = cl;
-
- if (silent->elt_query(mem))
- idx = mem;
- else if (silent->elt_query(cl))
- idx = cl;
- else {
- (*silent)[idx] = false;
- }
- local_silence = (*silent)[idx];
- if (classname != idx && !local_silence) {
- classname=idx;
- if (!(*silent)["Dstream"])
- *os << "[" << classname << ":]"; // messy.
- }
- return *this;
-}
-
-bool
-Dstream::silence(String s)
-{
- if (!silent->elt_query(s))
- return false;
- return (*silent)[s];
-}
-
-/** Output a string via the Dstream. This is the only output
- interface. It delegates all conversion to String class. */
-Dstream &
-Dstream::operator<<(String s)
-{
- output(s);
- return *this;
-}
-
-Dstream &
-Dstream::operator<<(const void *v_l)
-{
- output(String_convert::pointer_str(v_l));
- return *this;
-}
-
-Dstream &
-Dstream::operator<<(const char *ch_l)
-{
- output(ch_l);
- return *this;
-}
-
-void
-Dstream::output(String s)
-{
- if (local_silence|| !os)
- return ;
-
- for (const char *cp = s ; *cp; cp++)
- switch(*cp) {
- case '{':
- case '[':
- case '(': indentlvl += INDTAB;
- *os << *cp;
- break;
-
- case ')':
- case ']':
- case '}':
- indentlvl -= INDTAB;
- *os << *cp ;
-
- assert (indentlvl>=0) ;
- break;
-
- case '\n':
- *os << '\n' << String (' ', indentlvl) << flush;
- break;
- default:
- *os << *cp;
- break;
- }
- return ;
-}
-
-
-Dstream::Dstream(ostream *r, const char * cfg_nm )
-{
- os = r;
- silent = new Assoc<String,bool>;
- indentlvl = 0;
- if (!os)
- return;
-
- const char * fn =cfg_nm ? cfg_nm : ".dstreamrc";
- {
- ifstream ifs(fn); // can't open
- if (!ifs)
- return;
- }
-
- Text_db cfg(fn);
- while (! cfg.eof()){
- Text_record r( cfg++);
- if (r.size() != 2) {
- r.message("not enough fields in Dstream init.");
- continue;
- }
- (*silent)[r[0]] = (bool)(int)(Scalar(r[1]));
- }
-
-}
-
-
-Dstream::~Dstream()
-{
- delete silent;
- assert(!indentlvl) ;
-}
+++ /dev/null
-#include "../out/version.hh" // urg
-#include <stdio.h>
-
-static char *s = "FlowerLib " MAJOR_VERSION "." MINOR_VERSION "." PATCH_LEVEL MY_PATCH_LEVEL " #%d";
-
-static const int build=
-#include "../out/.build"
-;
-
-const char *
-flower_version_sz()
-{
- static char v[1024];
- sprintf(v, s, build);
- return v;
-}
+++ /dev/null
-# flower/lib/include/Makefile
-
-# subdir level:
-#
-depth = ../../..
-#
-
-# generic stuff/Makefile
-#
-include ./$(depth)/make/Include.make
-#
-
-# identify module:
-#
-MODULE_NAME = flower
-include ./$(depth)/flower/.version
-build = ./$(depth)/flower/$(outdir)/.build
-#
-
+++ /dev/null
-/*
- associter.hh -- part of flowerlib
-
- (c) 1996 Han-Wen Nienhuys
-*/
-
-#ifndef ASSOCITER_HH
-#define ASSOCITER_HH
-
-#include "assoc.hh"
-
-/// an iterator for the #Assoc# class
-template<class K, class V>
-struct Assoc_iter {
- int i;
- Assoc<K,V> &assoc_;
- /// we don't want to be bothered by const correctness
- Assoc_iter(const Assoc<K,V> &a) :
- assoc_((Assoc<K,V> &)a)
- {
- i= next(0);
- }
- int next(int j) {
- while (j < assoc_.arr.size() && assoc_.arr[j].free)
- j++;
- return j;
- }
- bool ok() const {
- return i < assoc_.arr.size();
- }
- void OK()const {
- assert(!ok() || !assoc_.arr[i].free);
- }
- void operator++(int) { i++; i = next(i); }
- K key() { return assoc_.arr[i].key; }
- V &val() { return assoc_.arr[i].val; }
-};
-
-#endif
+++ /dev/null
-#ifndef ASSOC_HH
-#define ASSOC_HH
-
-#include "varray.hh"
-#include <assert.h>
-
-/**
- A helper for Assoc
- */
-template<class K, class V>
-struct Assoc_ent_ {
- bool free;
- K key;
- V val;
-};
-
-
-/** mindblowingly stupid Associative array implementation.
- Hungarian: map
- */
-template<class K, class V>
-struct Assoc {
- Array< Assoc_ent_<K,V> > arr;
-
- /* ************** */
-
- int find(K key) const {
- for (int i = 0; i < arr.size(); i++) {
- if (!arr[i].free && key == arr[i].key)
- return i;
- }
- return -1;
- }
- int find_creat(K key) {
- int free = -1;
- for (int i = 0; i < arr.size(); i++) {
- if (key == arr[i].key) {
- return i;
- } else if (arr[i].free ) {
- free = i;
- }
- }
- if (free >= 0){
- arr[free].free = false;
- arr[free].key = key;
- return free;
- }
-
- Assoc_ent_<K,V> ae;
- ae.free = false;
- ae.key = key;
- arr.push(ae);
- return arr.size() -1;
- }
-public:
- bool elt_query(K key) const {
- return find(key) >= 0;
- }
- void del(K key) {
- assert(elt_query(key));
- int i= find(key);
- arr[i].free = true;
- }
- void
- add(K key, V val) {
- int i = find_creat(key);
- arr[i].val = val;
- }
- V& operator[](K key) {
- return arr[find_creat(key)].val;
- }
- const V& operator[](K key) const {
- assert(elt_query(key));
- return arr[find(key)].val;
- }
-};
-
-#endif
+++ /dev/null
-#ifndef CHOLESKI_HH
-#define CHOLESKI_HH
-
-#include "matrix.hh"
-
-/**
- Choleski decomposition of a matrix
- structure for using the LU decomposition of a positive definite matrix.
-
- #P# is split into
-
- LD transpose(L)
- */
-struct Choleski_decomposition {
-
- /// lower triangle of Choleski decomposition
- Matrix L;
-
- /// diagonal
- Vector D;
-
- /** Create decomposition of P.
- PRE
- P needs to be symmetric positive definite
- */
-
- Choleski_decomposition(Matrix P);
-
- /**
- solve Px = rhs
- */
- Vector solve(Vector rhs) const;
-
- Vector operator * (Vector rhs) const { return solve (rhs); }
- /**
- return the inverse of the matrix P.
- */
- Matrix inverse() const;
- /**
- return P, calc'ed from L and D
- */
- Matrix original() const;
-
-
-};
-#endif
+++ /dev/null
-/*
- flowerlib
-
- (c) 1996 Han-Wen Nienhuys
- */
-#ifndef COMPARE_HH
-#define COMPARE_HH
-
-#define one_operator(type, function, op) \
-inline bool \
-operator op (type t1, type t2) {\
- return function(t1, t2) op 0;\
-}\
-
-#define gpp_minmax_operator(type, op, opp) \
-inline type \
-operator op(type t1, type t2)\
-{\
- return (t1 opp t2) ? t1 : t2;\
-}\
-
-
-#if defined (__GNUG__) && ! defined (__STRICT_ANSI__)
-#define gpp_minmax(type, prefix)\
- prefix gpp_minmax_operator(type, <?, <)\
- prefix gpp_minmax_operator(type, >?, >)
-#else
-#define gpp_minmax(type, prefix)
-#endif
-
-/** handy notations for a signed comparison.
- make the operators{<,<=,==,>=,>} and the MAX and MIN of two.
- Please fill a & in the type argument if necessary.
- */
-#define template_instantiate_compare(type, function, prefix) \
-prefix one_operator(type, function, >)\
-prefix one_operator(type, function, >=)\
-prefix one_operator(type, function, ==)\
-prefix one_operator(type, function, !=)\
-prefix one_operator(type, function, <)\
-prefix one_operator(type, function, <=)\
-gpp_minmax(type, prefix)\
-prefix inline type max(type t1, type t2) { return (t1 > t2 )? t1 : t2; }\
-prefix inline type min(type t1, type t2) { return (t1 < t2 )? t1 : t2; }\
- \
-prefix bool operator<(type t1, type t2) /* stupid fix to allow ; */
-
-
-
-#define instantiate_compare(type, func) template_instantiate_compare(type,func, )
-
-
-
-#endif
-
+++ /dev/null
-// cursor.hh
-
-#ifndef __CURSOR_HH
-#define __CURSOR_HH
-
-#include "link.hh"
-template<class T> class List;
-
-/** iterator to List.
- add and insert extend the list
- items are always stored as copies in List, but:
- List<String> : copies of String stored
- List<String*> : copies of String* stored!
-
- the operations add and insert actually delegate the work to List class.
- */
-template<class T>
-class Cursor
-{
- public:
- /** create cursor, set at top. The const part isn't true, actually, #list#
- surely isn't const, but I get tired of the warning messages. */
- Cursor( const List<T>& list, Link<T>* pointer = 0 );
-
- Cursor( const Cursor<T>& cursor );
-
- T& thing();
-
- /// return current T
- T& operator *() { return thing(); }
- operator T() { return thing(); }
- Cursor<T> operator =( const Cursor<T>& c );
-
- /// make cursor with #no# items back
- Cursor<T> operator -( int no) const;
-
- /// make cursor with #no# items further
- Cursor<T> operator +( int no) const;
- int operator -(Cursor<T> op) const;
- Cursor<T> operator -=(int);
- Cursor<T> operator +=(int);
-
- /// return current and move one down
- Cursor<T> operator ++( int );
-
- /// return current and move one up
- Cursor<T> operator --( int );
-
- /// point to link?
- bool ok();
-
- /// ++ items left?
- bool forward();
-
- /// -- items left?
- bool backward();
-
- /** put (copy) after me in List.
- analogously to editor. ok() interpreted as at end
- of line.
-
- PRE: !ok, POST: added to bottom()
-
- PRE: ok, POST: added after me
-
- cursor points to same object, cursor.next() is newly added
- object.
- */
- void add( const T& thing );
-
- /** put (copy) before me in List.
- analogously to editor. ok() interpreted as at begin of
- line.
-
- PRE: !ok, POST: add to top()
-
- PRE: ok, POST: add before me
-
- cursor points to same object, cursor.previous()
- is newly inserted object.
- */
-
- void insert( const T& thing );
- ///
- void backspace();
-
- ///
- void del();
-
- /// access the list this came from
- List<T>& list() const ;
- Link<T>* pointer();
- static int compare(Cursor<T> a,Cursor<T>b) { return a-b; }
-private:
- List<T>& list_;
- Link<T>* pointer_;
-};
-
-
-/*
- comparisons.
- */
-#include "compare.hh"
-
-
-template_instantiate_compare(Cursor<T>, Cursor<T>::compare, template<class T>);
-
-#include "pcursor.hh"
-#include "list.hh"
-#include "cursor.inl"
-#include "iterate.hh"
-
-#endif // CURSOR_HH
+++ /dev/null
- // cursor.inl -*-c++-*-
-#ifndef CURSOR_INL
-#define CURSOR_INL
-#include <assert.h>
-
-
-template<class T>
-inline
-Cursor<T>::Cursor( const List<T>& list, Link<T>* pointer ) :
- list_((List<T>&) list )
-{
- if ( list.size() )
- pointer_ = pointer ? pointer : list.top_;
- else
- pointer_ = pointer;
-}
-
-template<class T>
-inline
-Cursor<T>::Cursor( const Cursor<T>& cursor ) :
- list_( cursor.list_ )
-{
- pointer_ = cursor.pointer_;
-}
-
-template<class T>
-inline T&
-Cursor<T>::thing()
-{
- assert( pointer_ );
- return pointer_->thing();
-}
-
-template<class T>
-Cursor<T>
-Cursor<T>::operator =( const Cursor<T>& c )
-{
- assert( &list_ == &c.list_ );
- pointer_ = c.pointer_;
- return *this;
-}
-
-template<class T>
-inline void
-Cursor<T>::add( const T& th )
-{
- list_.add( th, *this );
-}
-
-template<class T>
-inline void
-Cursor<T>::insert( const T& th )
-{
- list_.insert( th, *this );
-}
-
-template<class T>
-inline List<T>&
-Cursor<T>::list() const
-{
- return list_;
-}
-
-template<class T>
-inline Link<T>*
-Cursor<T>::pointer()
-{
- return pointer_;
-}
-
-template<class T>
-inline bool
-Cursor<T>::backward()
-{
- return ( pointer_ != 0 );
-}
-
-template<class T>
-inline bool
-Cursor<T>::forward()
-{
- return ( pointer_ != 0 );
-}
-
-template<class T>
-inline bool
-Cursor<T>::ok()
-{
- return ( pointer_ != 0 );
-}
-
-
-template<class T>
-inline Cursor<T>
-Cursor<T>::operator ++( int )
-{
- Cursor<T> r (*this);
- assert( pointer_ );
- pointer_ = pointer_->next();
- return r;
-}
-
-template<class T>
-inline Cursor<T>
-Cursor<T>::operator --( int )
-{
- Cursor<T> r (*this);
- assert( pointer_ );
- pointer_ = pointer_->previous();
- return r;
-}
-
-#endif
+++ /dev/null
-#ifndef CURSOR_CC
-#define CURSOR_CC
-
-#include "cursor.hh"
-#include <assert.h>
-
-template<class T>
- void
-Cursor<T>::backspace()
-{
- Cursor<T> c(*this);
- if ( c.ok() )
- c--;
- list_.remove( *this );
-}
-
-template<class T>
- void
-Cursor<T>::del()
-{
- Cursor<T> c(*this);
- if ( c.ok() )
- c++;
- list_.remove( *this );
- *this = c;
-}
-
-
-template<class T>
-Cursor<T>
-Cursor<T>::operator -=( int j )
-{
- while (j--)
- (*this)--;
- return *this;
-}
-template<class T>
-Cursor<T>
-Cursor<T>::operator +=( int j )
-{
- while (j++)
- (*this)++;
- return *this;
-}
-
-template<class T>
-Cursor<T>
-Cursor<T>::operator +( int i ) const
-{
- Cursor<T> r = *this;
-
- if (i<0)
- return r -(-i);
-
- while (i--)
- r++;
-
- return r;
-}
-
-template<class T>
-Cursor<T>
-Cursor<T>::operator -( int i ) const
-{
- Cursor<T> r = *this;
- if (i<0)
- return r +(-i);
-
- while (i--)
- r--;
-
- return r;
-}
-/*
- warning: can't use Cursor::operator == (Cursor),
- since it uses Cursor::operator-(Cursor)
- */
-template<class T>
-int
-Cursor<T>::operator-(Cursor<T> rhs) const
-{
- assert(rhs.list == list);
- int dif = 0;
-
- // search from *this on further up (positive difference)
- Cursor<T> c(*this);
- while (c.ok() && c.pointer_ != rhs.pointer_) {
- c--;
- dif++;
- }
-
- if (c.ok())
- goto gotcha; // so, sue me.
-
- // search in direction of bottom. (negative diff)
- dif =0;
- c=*this;
- while (c.ok() && c.pointer_ !=rhs.pointer_) {
- dif --;
- c++;
- }
- assert(c.ok());
-
-gotcha:
- assert((*this - dif).pointer_ == c.pointer_);
- return dif;
-}
-
-#endif
+++ /dev/null
-/*
- data-file.hh -- declare Data_file
-
- source file of the LilyPond music typesetter
-
- (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
-*/
-
-
-#ifndef DATAFILE_HH
-#define DATAFILE_HH
-
-#include "text-stream.hh"
-
-/// read a data file
-class Data_file : private Text_stream
-{
-
- public:
- bool rawmode;
-
- Text_stream::line;
- Text_stream::eof;
- Text_stream::get_name;
-
- char data_get();
- void data_unget(char c) {
- unget(c);
- }
-
- /// read line, eat #\n#
- String get_line();
-
- /// read a word till next space, leave space. Also does quotes
- String get_word();
-
- /// gobble horizontal white stuff.
- void gobble_white();
-
- /// gobble empty stuff before first field.
- void gobble_leading_white();
- Data_file(String s) : Text_stream(s) {
- //*mlog << "(" << s << flush;
- rawmode= false;
- }
-
- ~Data_file() {
- // *mlog << ")"<<flush;
- }
-
- warning(String s) {
- message("warning: " + s);
- }
- error(String s){
- message(s);
- exit(1);
- }
-};
-#endif // DATAFILE_HH
+++ /dev/null
-
-#ifndef DSTREAM_HH
-#define DSTREAM_HH
-
-#include "string.hh"
-
-const char eol= '\n';
-
-template<class K,class V>
-struct Assoc;
-
-/** debug stream.
- a class for providing debug output of nested structures,
- with indents according to \{\}()[].
-
- One can turn on and off specific messages using the Assoc silent.
- This can be done automatically:
-
- #define DEBUG dstream_.identify_as(__PRETTY_FUNCTION__)
-
- DEBUG << "a message\n";
-
- Init for the class names which should be silent can be given in a rc file.
-
- */
-class Dstream
-{
- ostream *os;
- int indentlvl;
- bool local_silence;
- String classname;
- void output(String s);
- Assoc<String, bool> *silent;
-public:
-
- bool silence(String);
-
- /**
- if rcfile == 0, then do not read any rc file.
- */
-
- Dstream(ostream *r, const char * rcfile);
- virtual ~Dstream();
- Dstream &identify_as(String s);
-
- Dstream &operator << (String s);
- /**
- Output memory locations.
- */
- Dstream &operator << (void const *);
- Dstream &operator << (char const *);
-};
-#endif
-
+++ /dev/null
-/*
- fproto.hh -- typenames in flowerlib
-
- (c) 1996 Han-Wen Nienhuys
-*/
-
-#ifndef FPROTO_HH
-#define FPROTO_HH
-
-
-const char * flower_version_sz();
-
-// what the F*** is "int" ?
-// depreciate int, long, etc., use i32, i64, remember: linux-16/linux-64 ?
-/// (i32)
-typedef int i32;
-/// (i64)
-typedef long long I64;
-
-template<class T> struct Array;
-template<class T> struct sstack;
-template<class T,class K> struct Assoc;
-template<class T> struct List;
-template<class T> struct PointerList;
-template<class T> struct IPointerList;
-template<class T> struct Cursor;
-template<class T> struct PCursor;
-template<class T> struct Link;
-template<class T> struct Handle;
-template<class T> struct Interval_t;
-template<class T,class Q> struct PQueue;
-
-#include "real.hh"
-
-typedef Interval_t<Real> Interval;
-
-struct Choleski_decomposition;
-
-struct Long_option_init;
-struct Getopt_long;
-struct Matrix;
-struct String_data;
-struct String_handle;
-struct String_convert;
-struct String;
-struct virtual_smat;
-struct Vector ;
-struct Text_stream;
-struct Data_file;
-struct Text_db;
-struct Scalar;
-typedef unsigned char Byte;
-#endif // FPROTO_HH
-
+++ /dev/null
-#ifndef HANDLE_HH
-#define HANDLE_HH
-
-/// reference counting handle
-template<class T>
-class Handle {
- T *obj;
- int *refs;
-
- /// let go of ref. Delete if necessary
- void down() {
- if (!(*refs--)) {
- delete obj;
- delete refs;
- }
- obj = 0;
- refs = 0;
- }
- /// point to new object.
- void up(T *t, int *r) {
- if (!r) {
- refs = new int;
- *refs = 1;
- } else {
- refs =r;
- *refs++;
- }
- obj = t;
- }
- /// POST: *refs == 1
- void copy() {
- if(*refs != 1){
- T * newobj = new T(*obj );
- down();
- up(newobj);
- }
- }
- Handle(Handle const &src) {
- up(src.obj, src.refs);
- }
- Handle(T & o) {
- up (&o);
- }
- void operator=(Handle const& src) {
- if (this == &src)
- return;
- down();
- up(src.o, src.refs);
- }
- operator const T&() {
- return *obj;
- }
- operator T&() {
- copy();
- return *obj;
- }
-}
-#endif
+++ /dev/null
-/*
- interval.hh -- part of flowerlib
-
- (c) 1996 Han-Wen Nienhuys
-*/
-
-#ifndef INTERVAL_HH
-#define INTERVAL_HH
-
-#include <assert.h>
-#include "fproto.hh"
-#include "real.hh"
-
-
-/** a T interval.
- this represents the closed interval [left,right].
- No invariants. T must be a totally ordered ring
- */
-template<class T>
-struct Interval_t {
- T left, right;
-
- /* ************** */
-
- T center() { return (left + right) / T(2);}
- void translate(T t) {
- left += t;
- right += t;
- }
- T& idx(int j) {
- if (j==-1)
- return left;
- else if (j==1)
- return right;
- else
- assert(false);
- return left;
- }
- T& operator[](int j) {
- return idx(j);
- }
- T operator[](int j) const {
- return ((Interval_t<T> *)this)->idx(j);
- }
- T &max() { return right;}
- T max()const { return right;}
- T min()const{ return left; }
- T &min(){ return left; }
- /**
- PRE
- *this and h are comparable
- */
- void unite(Interval_t<T> h);
- void intersect(Interval_t<T> h);
-
- T length() const;
- void set_empty() ;
- bool empty() const { return left > right; }
- Interval_t() {
- set_empty();
- }
- Interval_t(T m, T M) {
- left =m;
- right = M;
- }
- Interval_t<T> &operator += (T r) {
- left += r;
- right +=r;
- return *this;
- }
- String str() const;
- bool elt_q(T r);
-};
-
-
-/**
- inclusion ordering. Crash if not comparable.
- */
-template<class T>
-int Interval__compare(const Interval_t<T>&,Interval_t<T> const&);
-
-/*
- INLINE
- */
-
-#include "compare.hh"
-
-template_instantiate_compare(Interval_t<T>&, Interval__compare, template<class T>);
-
-
-template<class T>
-inline Interval_t<T>
-intersection(Interval_t<T> a, Interval_t<T> const&b)
-{
- a.intersect(b);
- return a;
-
-}
-
-
-template<class T>
-inline
-Interval_t<T> operator +(T a,Interval_t<T> i )
-{
- i += a;
- return i;
-}
-
-template<class T>
-inline
-Interval_t<T> operator +(Interval_t<T> i,T a ){
- return a+i;
-}
-
-typedef Interval_t<Real> Interval;
-
-
-#define Interval__instantiate(T) template struct Interval_t<T>;\
- template int Interval__compare(const Interval_t<T>&,Interval_t<T> const&)
-
-
-#endif // INTERVAL_HH
-
-
-
+++ /dev/null
-#include <assert.h>
-#include <math.h>
-#include "interval.hh"
-#include "string.hh"
-
-
-template<class T>
-int
-_Interval__compare(const Interval_t<T>&a,Interval_t<T> const&b)
-{
- if (a.left == b.left && a.right == b.right)
- return 0;
-
- if (a.left <= b.left && a.right >= b.right)
- return 1;
-
- if (a.left >= b.left && a.right <= b.right)
- return -1;
-
- return -2;
-}
-
-
-template<class T>
-int
-Interval__compare(const Interval_t<T>&a,Interval_t<T> const&b)
-{
- int i = _Interval__compare(a,b);
- if (i < -1)
- assert(false);
- return i;
-}
-
-#ifdef AIX
-const Real INFTY = 1e8; // ARGh. AIX sucks
-#else
-const Real INFTY = HUGE_VAL;
-#endif
-
-template<class T>
-void
-Interval_t<T>::set_empty()
-{
- left = INFTY;
- right = -INFTY;
-}
-
-template<class T>
-T
-Interval_t<T>::length() const {
- assert(right >= left);
- return right-left;
-}
-
-template<class T>
-void
-Interval_t<T>::unite(Interval_t<T> h)
-{
- if (h.left<left)
- left = h.left;
- if (h.right>right)
- right = h.right;
-}
-
-/**
- smallest Interval which includes *this and #h#
- */
-
-template<class T>
-void
-Interval_t<T>::intersect(Interval_t<T> h)
-{
-#if defined (__GNUG__) && ! defined (__STRICT_ANSI__)
- left = h.left >? left;
- right = h.right <?right;
-#else
- left = max(h.left, left);
- right = min(h.right, right);
-#endif
-}
-
-template<class T>
-Interval_t<T>
-intersect(Interval_t<T> x, Interval_t<T> const &y)
-{
- x.intersect(y);
- return x;
-}
-
-template<class T>
-String
-Interval_t<T>::str() const
-{
- if (empty())
- return "[empty]";
- String s("[");
-
- return s + left + "," + right +"]";
-}
-
-template<class T>
-bool
-Interval_t<T>::elt_q(T r)
-{
- return r >= left && r <= right;
-}
+++ /dev/null
-/*
- iterate.hh -- define some list macros
-
- source file of the flowerlib
-
- (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
-*/
-
-
-#ifndef ITERATE_HH
-#define ITERATE_HH
-
-
-
-#define iterator(set) typeof((set).top())
-#define iterator_bot(set) typeof((set).bottom())
-
-// should use top()
-#define iter_top(set,var) iterator(set) var(set)
-#define iter_bot(set,var) iterator(set) var(set.bottom())
-
-#endif // ITERATE_HH
+++ /dev/null
-#ifndef LGETOPT_HH
-#define LGETOPT_HH
-
-#include <string.h>
-
-
-class ostream;
-
-/**
- a struct this for initialising the commandline options.
- */
-struct Long_option_init {
- bool take_arg;
- const char* longname;
- char shortname;
-
- ostream &printon(ostream &errorout);
-};
-
-
-/** C++ for version of long_getopt. For processing GNU style command
- line arguments. No pointer (return values, arguments) contents are
- copied. */
-class Getopt_long {
-public:
- /** errorcodes: no error, argument expected, no argument expected,
- unknown option, illegal argument (eg. int expected). */
- enum Errorcod { E_NOERROR = 0, E_ARGEXPECT, E_NOARGEXPECT, E_UNKNOWNOPTION,
- E_ILLEGALARG } ;
-
-
-private:
-
- /// the option info.
- Long_option_init *the_opts;
- int table_len;
-
- /// if doing short option, argv[optind][optindind] is processed next.
- int optindind;
-
- /// the option found
- Long_option_init *beet;
-
- /// get ready for processing next error.
- bool next();
- Long_option_init *parselong();
- Long_option_init *parseshort();
-
- ostream *errorout;
-
- /// report an error and abort
- void report(Errorcod c);
-public:
-
- /// argument. Set to 0 if not present
- char* optarg;
-
- /// current error status
- Errorcod error;
-
- /// return an integer (with err. detect)
- long intarg();
- /// argv[optind] will be processed next.
- int optind;
-
- /// the arguments
- char **argv;
-
- /// the arg. count
- int argc;
-
- /* *************** */
-
- /**
- What to do with errors.
- report messages on #*os#, and abort.
- if #os# is null, then do not report nor abort, just set #error#
- */
-
- void seterror(ostream *os);
-
- /// construct: pass arguments and option info.
- Getopt_long(int c, char **v, Long_option_init *lo);
-
- /** get the next option.
- @return pointer to next option found.
- 0 if error occurred, or next argument is no option.
- */
- Long_option_init *operator()();
-
- char *current_arg();
- char * get_next_arg();
-};
-#endif
+++ /dev/null
-/*
- libc-extension.hh -- declare some string.h extensions
-
- source file of the flowerlib
-
- (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
-*/
-
-
-#ifndef LIBC_EXTENSION_HH
-#define LIBC_EXTENSION_HH
-#include "fproto.hh"
-#include "config.hh"
-
-char* strnlwr( char* start_l ,int n);
-char* strnupr( char* start_l, int n);
-
-#ifndef HAVE_MEMMEM // GNU extension.
-char *memmem(const Byte * haystack, int haystack_len,
- const Byte *needle, int needle_len);
-#endif HAVE_MEMMEM
-
-#ifndef HAVE_SNPRINTF // GNU extension.
-int snprintf (char *str, size_t n,
- const char *format, ... );
-#endif
-
-
-Byte *memrchr(const Byte * p, int n, char c);
-Byte *strrev( Byte* byte_l, int length_i );
-
-
-#endif // LIBC_EXTENSION_HH
+++ /dev/null
-// link.hh
-
-#ifndef __LINK_HH
-#define __LINK_HH
-template<class T>
-class List;
-
-
-/// class for List
-template<class T>
-class Link
-{
-// friend class Cursor<T>;
-public:
- Link( const T& thing );
-
- Link<T>* previous();
- Link<T>* next();
-
- /// put new Link item after me in list
- void add( const T& thing );
- /// put new Link item before me in list
- void insert( const T& thing );
- void remove(List<T> &l);
-
- T& thing();
- void OK() const;
-private:
- Link( Link<T>* previous, Link<T>* next, const T& thing );
-
- T thing_;
- Link<T>* previous_;
- Link<T>* next_;
-};
-
-#include "link.inl"
-
-#endif // __LINK_HH //
+++ /dev/null
-// link.inl -*-c++-*-
-#ifndef LINK_INL
-#define LINK_INL
-#include <assert.h>
-template<class T>
-inline
-void
-Link<T>::OK() const
-{
-#ifndef NDEBUG
- if (previous_) {
- assert(previous_->next_ == this);
- }
- if (next_) {
- assert(next_->previous_ == this);
- }
-#endif
-}
-
-template<class T>
-inline
-Link<T>::Link( const T& thing ) :
- thing_( thing )
-{
- previous_ = next_ = 0;
-}
-
-template<class T>
-inline
-Link<T>::Link( Link<T>* previous, Link<T>* next, const T& thing ) :
- thing_( thing )
-{
- previous_ = previous;
- next_ = next;
-}
-
-template<class T>
-inline
-Link<T>*
-Link<T>::next()
-{
- return next_;
-}
-
-template<class T>
-inline
-Link<T>*
-Link<T>::previous()
-{
- return previous_;
-}
-
-template<class T>
-inline
-void
-Link<T>::add( const T& thing )
-{
-
- Link<T>* l = new Link<T>( this, next_, thing );
- if ( next_ )
- next_->previous_ = l;
- next_ = l;
-}
-
-template<class T>
-inline void
-Link<T>::insert( const T& thing )
-{
- // Link<T>* l = new Link<T>( next_, this, thing );
- // bugfix hwn 16/9/96
- Link<T>* l = new Link<T>( previous_, this, thing );
- if ( previous_ )
- previous_->next_ = l;
- previous_ = l;
-}
-
-/*
- don't forget to adjust #l#'s top_ and bottom_.
- */
-template<class T>
-inline void
-Link<T>::remove(List<T> &l)
-{
- if ( previous_ )
- previous_->next_ = next_;
- else
- l.top_ = next_;
-
- if ( next_ )
- next_->previous_ = previous_;
- else
- l.bottom_ = previous_;
-}
-
-template<class T>
-inline
-T&
-Link<T>::thing()
-{
- return thing_;
-}
-#endif
+++ /dev/null
-#ifndef __LIST_HH
-#define __LIST_HH
-
-class ostream;
-template<class T> class Cursor;
-template<class T> class Link;
-
-/** all-purpose doubly linked list.
-
- List can be seen as all items written down on paper,
- from top to bottom
-
- class Cursor is used to extend List
-
- items are always stored as copies in List, but:
- #List<String># : copies of #String# stored
- #List<String*># : copies of #String*# stored!
- (do not use, use \Ref{PointerList} #<String*># instead.)
-
- {\bf note:}
- retrieving "invalid" cursors, i.e.
- #top()/bottom()# from empty list, #find()# without success,
- results in a nonvalid Cursor ( #!ok()# )
-
-
- INVARIANTEN!
-*/
-
-template<class T>
-class List
-{
- public:
- List(List const&src);
-
- /// construct empty list
- List();
- virtual ~List();
-
- int size() const;
-
- Cursor<T> bottom() const; // const sucks.
- Cursor<T> top() const;
-
- void OK() const; // check list
-
- protected:
- friend class Cursor<T>;
- friend class Link<T>;
-
- void concatenate(List<T> const &s);
-
- /** make *this empty.
-
- POST:
- size == 0
-
- WARNING:
- contents lost, and not deleted.
- */
- void set_empty();
-
- void add( const T& thing, Cursor<T> &after_me );
-
- /// put thing before #before_me#
- void insert( const T& thing, Cursor<T> &before_me );
-
- /** Remove link pointed to by me. Destructor of contents called
- (nop for pointers)
-
- POST
- none;
-
-
- WARNING: do not use #me# after calling
- */
- void remove( Cursor<T> me );
-
-
- /* ************** */
-
- int size_;
- Link<T>* top_;
- Link<T>* bottom_;
-};
-
-#include "list.inl"
-#include "cursor.hh"
-
-// instantiate a template: explicit instantiation.
-#define L_instantiate(a) template class List<a>; template class Cursor<a>; \
- template class Link<a>
-
-
-#endif // __LIST_HH //
-
-
-
-
+++ /dev/null
-// -*-c++-*-
-
-#ifndef LIST_INL
-#define LIST_INL
-
-template<class T>
-inline
-List<T>::List()
-{
- set_empty();
-}
-
-template<class T>
-inline void
-List<T>::set_empty()
-{
- top_ = bottom_ = 0;
- size_ = 0;
-}
-
-template<class T>
-inline void
-List<T>::remove( Cursor<T> me )
-{
- if ( me.ok() ){
- Link<T> *lp = me.pointer();
- lp->remove(*this);
- delete lp;
- size_--;
- }
-}
-
-template<class T>
-inline int
-List<T>::size() const
-{
- return size_;
-}
-
-template<class T>
-inline Cursor<T>
-List<T>::top()const
-{
- return Cursor<T>( *this, top_ );
-}
-
-
-template<class T>
-inline Cursor<T>
-List<T>::bottom()const
-{
- return Cursor<T>( *this, bottom_ );
-}
-
-
-#endif
+++ /dev/null
-#ifndef LIST_CC
-#define LIST_CC
-
-#include "list.hh"
-
-template<class T>
-List<T>::List(List const&src)
-{
- set_empty();
- // probably el stupido
- for (Cursor<T> c(src); c.ok(); c++)
- bottom().add(c);
-}
-
-template<class T>
-void
-List<T>::OK() const
-{
- int i = size_;
- Link<T> *lp = top_;
- while (i--) {
- assert(lp);
- lp->OK();
- lp = lp->next();
- }
- assert(!lp);
- i = size_;
- lp = bottom_;
- while (i--) {
- assert(lp);
- lp->OK();
- lp = lp->previous();
- }
- assert(!lp);
-}
-
-
-template<class T>
-List<T>::~List()
-{
- Cursor<T> c(*this);
- while (c.ok())
- c.del();
-}
-
-/**
-
- add after after_me.
-
- Procedure:
- \begin{itemize}
- \item if #after_me# is #ok()#, add after #after_me#, else
- \item if list !empty simply add to bottom, else
- \item list is empty: create first \Ref{Link} and initialize
- #bottom_# and #top_#.
- \end{itemize}
-*/
-template<class T>
-void
-List<T>::add( const T& thing, Cursor<T> &after_me )
-{
- if (!size_) { // not much choice if list is empty
- bottom_ = top_ = new Link<T>( thing );
- if (!after_me.ok())
- after_me = bottom();
- } else { // add at aprioprate place
- if (!after_me.ok())
- after_me = bottom();
- Link<T> *p =after_me.pointer();
- p->add(thing);
- if (p == bottom_) // adjust bottom_ if necessary.
- bottom_ = p->next();
- }
-
- size_++;
-}
-
-template<class T>
-void
-List<T>::insert( const T& thing, Cursor<T> &before_me )
-{
- if (!size_) {
- bottom_ = top_ = new Link<T>( thing );
- if (!before_me.ok())
- before_me = top();
-
- } else {
- if (!before_me.ok())
- before_me = top();
-
- Link<T> *p = before_me.pointer() ;
-
- p->insert(thing);
- if (p == top_)
- top_ = p->previous();
- }
-
- size_++;
-}
-
-
-template<class T>
-void
-List<T>::concatenate(List<T> const&s)
-{
- Cursor<T> b(bottom());
- for (Cursor<T> c(s); c.ok(); c++) {
- b.add(c);
- b++;
- }
-}
-#endif
+++ /dev/null
-#ifndef MATRIX_HH
-#define MATRIX_HH
-
-
-#include "vsmat.hh"
-#include "vector.hh"
-
-/** a Real matrix. This is a class for a nonsquare block of #Real#s. The
- implementation of sparse matrices is done in the appropriate #smat#
- class. Matrix only does the mathematical actions (adding,
- multiplying, etc.)
-
-
- TODO
- implement ref counting? */
-
-
-class Matrix {
- virtual_smat *dat;
-
-public:
- void OK() const { dat->OK(); }
- int cols() const { return dat->cols(); }
- int rows() const { return dat->rows(); }
-
- /** return the size of a matrix.
- PRE
- the matrix needs to be square.
- */
- int dim() const;
-
- // Matrix() { dat = 0; }
- ~Matrix() { delete dat; }
-
- /// set entries to r
- void fill(Real r);
-
- /// set diagonal to d
- void set_diag(Real d);
-
- void set_diag(Vector d);
- /// set unit matrix
- void unit() { set_diag(1.0); }
-
- void operator+=(const Matrix&m);
- void operator-=(const Matrix&m);
- void operator*=(Real a);
- void operator/=(Real a) { (*this) *= 1/a; }
-
- /** add a row.
- add a row to the matrix before row k
-
- PRE
- v.dim() == cols()
- 0 <= k <= rows()
- */
- void insert_row(Vector v,int k);
- /** .
- delete a row from this matrix.
-
- PRE
- 0 <= k < rows();
- */
- void delete_row(int k) { dat->delete_row(k); }
- void delete_column(int k) { dat->delete_column(k); }
-
- /**
- square n matrix, initialised to null
- */
- Matrix(int n);
-
- /**
- n x m matrix, init to 0
- */
- Matrix(int n, int m);
- Matrix(const Matrix &m);
-
- /// dyadic product: v * w.transpose
- Matrix(Vector v, Vector w);
- void operator=(const Matrix&m);
-
- /// access an element
- Real operator()(int i,int j) const { return dat->elem(i,j); }
-
- /// access an element
- Real &operator()(int i, int j) { return dat->elem(i,j); }
-
- /// Matrix multiply with vec (from right)
- Vector operator *(const Vector &v) const;
-
- /// set this to m1*m2.
- void set_product(const Matrix &m1, const Matrix &m2);
-
-
- Vector left_multiply(Vector const &) const;
-
- Matrix operator-() const;
-
- /// transpose this.
- void transpose();
-
- /// return a transposed copy.
- Matrix transposed() const ;
-
- Real norm() const;
- /** swap.
- PRE
- 0 <= c1,c2 < cols()
- */
- void swap_columns(int c1, int c2);
-
- /** swap.
- PRE
- 0 <= c1,c2 < rows()
- */
- void swap_rows(int c1, int c2);
-
-
- Vector row(int ) const;
- Vector col(int) const;
-
- operator String() const;
- void print() const;
-};
-
-inline Vector
-operator *(Vector &v, const Matrix& m) { return m.left_multiply(v); }
-Matrix operator *(const Matrix& m1,const Matrix &m2);
-Matrix operator /(const Matrix &m1,Real a);
-inline Matrix operator -(Matrix m1,const Matrix m2)
-{
- m1 -= m2;
- return m1;
-}
-#endif
+++ /dev/null
-#ifndef PATH_HH
-#define PATH_HH
-#include "string.hh"
-#include "varray.hh"
-
-
-/** searching directory for file.
-
- Abstraction of PATH variable. An interface for searching input files.
- Search a number of dirs for a file.
-
- Should use kpathsea?
-
-*/
-
-class File_path : private Array<String>
-{
-public:
- /// locate a file in the search path
- String find(String nm);
-
- /// construct using prefix. Normally argv[0].
- File_path(String);
-
- /// add to end of path.
- Array<String>::push;
- void add(String str) { push(str); }
-};
-/// split path into its components
-void split_path(String path, String &drive, String &dirs, String &filebase, String &extension);
-
-#endif
+++ /dev/null
-#include "pcursor.hh"
-
-template<class T>
-void
-PCursor<T>::junk()
-{
-#if !defined(NDEBUG) && defined(PARANOID)
- list().OK();
-#endif
-
- delete ptr();
-#if !defined(NDEBUG)&&defined(PARANOID)
- thing() = 0;
- list().OK();
-#endif
-}
+++ /dev/null
-#include "plist.hh"
-
-template<class T>
-IPointerList<T>::~IPointerList()
-{
- PCursor<T> c( *this );
- while (c.ok()) {
- delete c.remove_p();
- }
-}
-
-template<class T>
-PCursor<T>
-PointerList<T>::find(T what ) const
-{
- PCursor<T> i(*this);
- for (; i.ok(); i++)
- if (i.ptr() == what)
- break;
- return i;
-}
+++ /dev/null
-/*
- pqueue.hh -- declare
-
- source file of the LilyPond music typesetter
-
- (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
-*/
-
-
-#ifndef PQUEUE_HH
-#define PQUEUE_HH
-
-#include "varray.hh"
-
-/**
- Stupid Prioq. Should use Lists and STL.
- Smallest is put at the front.
-
-Actually, this sux. Should use a template struct PQuee_ent<V,I>
- */
-
-template<class V, class I>
-struct PQueue
-{
- Array<V> value_arr_;
- Array<I> indices_arr_;
- void OK() const
- {
-
- assert(value_arr_.size() == indices_arr_.size());
- }
-
- void enter(V v, I idx) {
- int j=0;
- for (; j < value_arr_.size(); j++)
- if (indices_arr_[j] > idx)
- break;
-
- insert(j,v,idx);
-
- }
- int size() { return value_arr_.size(); }
- V front_val() { return value_arr_[0]; }
- I front_idx() { return indices_arr_[0]; }
- void del(int i)
- {
- value_arr_.del(i);
- indices_arr_.del(i);
- }
- int size() const
- {
- OK();
- return value_arr_.size();
- }
-
-
- void insert(int j, V v, I idx)
- {
- value_arr_.insert(v, j);
- indices_arr_.insert(idx, j);
- }
-
-
-
- V get() {
- V retval = front_val();
- del(0);
- return retval;
- }
-
-};
-#endif // PQUEUE_HH
+++ /dev/null
-#include <Rational.h>
+++ /dev/null
-#ifndef REAL_HH
-#define REAL_HH
-
-
-#include <builtin.h>
-#include <minmax.h>
-#include <math.h>
-
-typedef double Real;
-
-inline Real
-distance(Real x,Real y)
-{
- return abs(x-y);
-}
-#endif
+++ /dev/null
-/*
- scalar.hh -- part of LilyPond
-
- (c) 1996 Han-Wen Nienhuys
-*/
-
-#ifndef SCALAR_HH
-#define SCALAR_HH
-#include "string.hh"
-#include "real.hh"
-
-/// Perl -like scalar type.
-struct Scalar : public String {
-
- Scalar(Real r) : String(r) {}
- Scalar(int i) : String(i) {}
- Scalar(char c) : String(c) {}
- Scalar(const char *c) : String(c) {}
- Scalar(String s ):String(s) {}
- Scalar(Rational );
- operator Rational();
- Scalar() {}
- bool isnum();
- operator Real();
- operator int();
-
- /** perl -like string to bool conversion.
- */
- operator bool() const;
-
-};
-
-#endif // SCALAR_HH
-
+++ /dev/null
-#ifndef SMAT_HH
-#define SMAT_HH
-#include "varray.hh"
-#include "vsmat.hh"
-#include "real.hh"
-/// simplest matrix storage. refer to its baseclass for the doco.
-class Full_storage : public virtual_smat
-{
- /// height, width
- int h,w;
- /// maxima.
- int maxh, maxw;
-
- /// the storage
- Real** els;
- void
- init() {
- els=0;
- h=w=maxh=maxw=0;
-
- }
-
- bool valid(int i, int j) const {
- return (i>=0 && i < h)
- && (j < w && j >=0);
- }
-
-
- void resize_rows(int);
- void resize_cols(int);
-
-public:
- virtual int rows() const {
- return h;
- }
- virtual int cols() const {
- return w;
- }
-
-
- virtual void set_size(int i, int j)
- {
- resize(i,j); //this could be more efficient.
- }
-
- virtual void set_size(int i) {
- set_size(i,i);
- }
- virtual void resize(int i, int j);
- virtual void resize(int i) {
- resize(i,i);
- }
-
- virtual Real& elem(int i,int j) {
- assert(valid(i,j));
- return els[i][j];
- }
- virtual const Real& elem(int i, int j) const {
- assert(valid(i,j));
- return els[i][j];
- }
- virtual Array<Real> row(int i) const;
- virtual Array<Real> column(int j) const;
-
- Full_storage() {
- init();
- }
- Full_storage(int i, int j) {
- init();
- set_size(i,j);
- }
- Full_storage(Full_storage&);
- Full_storage(int i) {
- init();
- set_size(i);
- }
- void OK() const;
- void operator=(Full_storage const &);
-
- virtual void insert_row(int k);
- virtual void delete_row(int k);
- virtual void delete_column(int k);
-
-
- ~Full_storage();
- virtual bool mult_ok(int i, int j)const;
- virtual void mult_next(int &i, int &j) const ;
- virtual bool trans_ok(int i, int j) const;
- virtual void trans_next(int &i, int &j) const;
- virtual virtual_smat * clone();
-};
-
-#endif
+++ /dev/null
-/*
- PROJECT: FlowerSoft C++ library
- FILE : string-convert.hh
-
-*/
-
-#ifndef STRING_CONVERT_HH
-#define STRING_CONVERT_HH
-
-/*
- ///a class which only has functions.
-//#define functor class // cute. docxx fucks up
-*/
-
-/**
- The functor String_convert handles all conversions to/from String (some
- time, anyway).
- The class is quite empty from data view.
- */
-class String_convert {
- static int hex2bin_i( String hex_str, String& bin_str_r );
- static int hex2nibble_i( Byte byte );
- static Byte nibble2hex_byte( Byte byte );
-public:
- static String bin2dec_str( String bin_str );
- static String bin2hex_str( String bin_str );
- static String dec2bin_str( String str );
- static int bin2_i( String str );
- static String char_str(char c, int n);
- static int dec2_i( String dec_str );
- static double dec2_f( String dec_str );
- static String double_str(double f, char const* fmt=0);
- static int hex2_i( String str );
- static unsigned hex2_u( String str );
- static String hex2bin_str( String str );
- static String int_str(int i, char const *fmt=0 );
- static String i2hex_str( int i, int length_i, char ch );
- static String u2hex_str( unsigned u, int length_i, char ch );
- static String i2dec_str( int i, int length_i, char ch );
- static String rational_str(Rational);
- static String pointer_str(const void *);
- static String i64_str(I64, char const * fmt = 0);
-};
-
-#endif // __STRING_CONVERT_HH //
+++ /dev/null
-/*
- string-data.hh -- declare String_data
-
- source file of the LilyPond music typesetter
-
- (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
-*/
-
-
-#ifndef STRINGDATA_HH
-#define STRINGDATA_HH
-
-
-/**Internal String struct.
- the data itself. Handles simple tasks (resizing, resetting)
- */
-class String_data {
- // GNU malloc: storage overhead is 8 bytes anyway.
-
-friend class String_handle;
- int maxlen; // maxlen is arraysize-1
-
- int length_i_;
- Byte* data_byte_p_;
- int references;
-
- /// init to ""
- String_data();
-
- /// init from src. Conservative allocation.
- String_data(String_data const &src);
-
- ~String_data();
-
- /** POST: maxlen >= j.
- @param j, maximum stringlength_i_.
- contents thrown away.
- */
- void setmax(int j);
-
- /** POST: maxlen >= j.
- @param j, maximum stringlength_i_.
- contents are kept if it grows.
- */
- void remax(int j);
-
- /// check if writeable.
- void OKW();
-
- /// check state.
- void OK();
-
- /// reduce memory usage.
- void tighten();
-
- // assignment.
- void set( Byte const* byte_c_l, int length_i );
-
- void set( char const* ch_c_l );
-
- /// concatenation.
- void append( Byte const* byte_c_l, int length_i );
-
- void operator += ( char const* ch_c_l );
-
- char const* ch_c_l() const;
-
- char* ch_l();
-
- Byte const* byte_c_l() const;
-
- // idem, non const
- Byte* byte_l();
-
- void trunc(int j);
-
- /** access element. not really safe. Can alter length_i_ without
- #String_data# knowing it. */
- Byte &operator [](int j);
- Byte operator [](int j) const;
- bool is_binary_bo()const;
-};
-
-
-
-#ifdef STRING_UTILS_INLINED
-#ifndef INLINE
-#define INLINE inline
-#endif
-#include "string-data.inl"
-
-#endif
-
-
-#endif // STRING_DATA_HH
+++ /dev/null
-/* -*-C++-*-
- String_data.inl -- implement String_data
-
- source file of Flower lib
-
- (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
-*/
-
-#ifndef STRINGDATA_INL
-#define STRINGDATA_INL
-
-#include <assert.h>
-#include <memory.h>
-
-#include "string-data.hh"
-const int INITIALMAX=8;
-
-#include <sys/types.h>
-
-INLINE void
-String_data::OKW()
-{
- assert (references == 1);
-}
-
-INLINE void
-String_data::OK()
-{
- assert(maxlen >= length_i_);
- assert(bool(data_byte_p_));
- assert(references >= 1);
-}
-
-
-INLINE
-String_data::String_data()
-{
- references=0;
- maxlen = INITIALMAX;
- data_byte_p_ = new Byte[maxlen + 1];
- data_byte_p_[0] = 0;
- length_i_ = 0;
-}
-
-INLINE
-String_data::String_data(String_data const &src)
-{
- references=0;
- maxlen = length_i_ = src.length_i_;
- data_byte_p_ = new Byte[maxlen+1]; // should calc GNU 8byte overhead.
- memcpy( data_byte_p_, src.data_byte_p_, length_i_ + 1 );
-}
-
-INLINE
-String_data::~String_data()
-{
- assert(references == 0);
- delete[] data_byte_p_;
-}
-
-INLINE void
-String_data::setmax(int j)
-{
- OKW();
- if (j > maxlen) {
- delete data_byte_p_;
- maxlen = j;
- data_byte_p_ = new Byte[maxlen + 1];
-
- data_byte_p_[0] = 0;
- length_i_ = 0;
- }
-}
-
-/* this is all quite hairy:
- update of length_i_
- update of maxlen
- alloc of buffer
- copying of buffer
- needs blondification:
- split tasks
- define change authority
-*/
-INLINE void
-String_data::remax(int j)
-{
- OKW();
- if (j > maxlen) {
- Byte *p = new Byte[j + 1];
- memcpy( p, data_byte_p_, ( maxlen <? length_i_ ) + 1 );
- maxlen = j;
- delete[] data_byte_p_;
- data_byte_p_ = p;
- }
-}
-
-INLINE void
-String_data::tighten()
-{ // should be dec'd const
- maxlen = length_i_;
- Byte *p = new Byte[maxlen + 1];
- memcpy( p, data_byte_p_, length_i_ + 1 );
- delete[] data_byte_p_;
- data_byte_p_ = p;
-}
-// assignment.
-INLINE void
-String_data::set( Byte const* byte_c_l, int length_i )
-{
- OKW();
-
- assert( byte_c_l && byte_c_l != data_byte_p_);
-
- length_i_ = length_i;
- remax( length_i_ ); // copies too
- memcpy( data_byte_p_, byte_c_l, length_i_ );
- data_byte_p_[ length_i_ ] = 0;
-}
-
-INLINE
-void
-String_data::set( char const* ch_c_l )
-{
- set( (Byte const*)ch_c_l, strlen( ch_c_l ) );
-}
-
-
-/// concatenation.
-INLINE void
-String_data::append( Byte const* byte_c_l, int length_i )
-{
- OK();
- OKW();
- int old_i = length_i_;
-
- length_i_ += length_i;
- remax( length_i_ );
- memcpy( data_byte_p_ + old_i, byte_c_l, length_i );
- data_byte_p_[ length_i_ ] = 0;
-}
-
-INLINE
-void
-String_data::operator += ( char const* ch_c_l )
-{
- append( (Byte const*)ch_c_l, strlen( ch_c_l ) );
-}
-
-
-
-INLINE
-char const*
-String_data::ch_c_l() const
-{
- return (char const*)data_byte_p_;
-}
-INLINE char*
-String_data::ch_l()
-{
- return (char*)data_byte_p_;
-}
-
-INLINE Byte const*
-String_data::byte_c_l() const
-{
- return data_byte_p_;
-}
-
-INLINE Byte*
-String_data::byte_l()
-{
- OKW();
- return data_byte_p_;
-}
-
-INLINE
-void
-String_data::trunc(int j)
-{
- OKW();
- assert(j >= 0 && j <= length_i_);
- data_byte_p_[j] = 0;
- length_i_ = j;
-}
-
-INLINE bool
-String_data::is_binary_bo()const
-{
-// return !memchr(data_byte_p_, length_i_, 0);
- return ( (int)strlen( (char const*)data_byte_p_ ) != length_i_ );
-}
-
-INLINE Byte&
-String_data::operator [](int j)
-{
- assert(j >= 0 && j <= length_i_);
- return data_byte_p_[j] ;
-}
-
-INLINE Byte
-String_data::operator [](int j) const
-{
- assert(j >= 0 && j <= length_i_);
- return data_byte_p_[j];
-}
-
-
-
-
-#endif // __STRING_UTIL_CC //
+++ /dev/null
-/*
- string-handle.hh -- declare String_handle
-
- source file of the LilyPond music typesetter
-
- (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
-*/
-
-
-#ifndef STRINGHANDLE_HH
-#define STRINGHANDLE_HH
-#include "fproto.hh"
-
-
-/**
- Reference counting for strings.
-
- handles ref. counting, and provides a very thin interface using
- Byte *
-
- */
-class String_handle {
- String_data* data;
-
- /// decrease ref count. Named kind of like a Tanenbaum semafore
- void down();
-
- /// increase ref count
- void up(String_data *d);
-
- /** make sure data has only one reference.
- POST: data->references == 1
- */
- void copy();
-
-public:
- String_handle();
- ~String_handle();
- String_handle(String_handle const & src);
-
- Byte const* byte_c_l() const;
- char const* ch_c_l() const;
- Byte* byte_l();
- char* ch_l();
- bool is_binary_bo()const;
- void operator =(String_handle const &src);
- void operator += (char const *s);
- Byte operator[](int j) const;
-
- /** Access elements. WARNING: NOT SAFE
- don't use this for loops. Use byte_c_l()
- */
- Byte &operator[](int j);
- void append( Byte const* byte_c_l, int length_i );
- void set( Byte const* byte_c_l, int length_i );
- void operator = (char const *p);
- void trunc(int j);
- int length_i() const;
-};
-
-#ifdef STRING_UTILS_INLINED
-#ifndef INLINE
-#define INLINE inline
-#endif
-#include "string-handle.inl"
-/* we should be resetting INLINE. oh well. */
-#endif
-
-
-#endif // STRINGHANDLE_HH
+++ /dev/null
-/* -*-c++-*-
-
- stringhandle.inl -- implement String_handle
-
- source file of Flower lib
-
- (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
-*/
-
-#ifndef STRINGHANDLE_INL
-#define STRINGHANDLE_INL
-
-#include <assert.h>
-#include <memory.h>
-
-#include "string-data.hh"
-#include "string-handle.hh"
-
-INLINE void
-String_handle::down()
-{
- if (!(--data->references)) delete data; data = 0;
-}
-
-/// increase ref count
-INLINE void
-String_handle::up(String_data *d)
-{
- data=d; data->references ++;
-}
-
-INLINE void
-String_handle::copy()
-{
- if (data->references !=1){
- String_data *newdata = new String_data(*data);
- down();
- up(newdata);
- }
-}
-
-INLINE
-String_handle::String_handle()
-{
- up(new String_data);
-}
-
-INLINE
-String_handle::~String_handle()
-{
- down();
-}
-
-INLINE
-String_handle::String_handle(String_handle const & src)
-{
- up(src.data);
-}
-
-INLINE Byte*
-String_handle::byte_l()
-{
- copy();
- return data->byte_l();
-}
-
-INLINE char*
-String_handle::ch_l()
-{
- copy();
- return (char*)data->byte_l();
-}
-
-INLINE Byte
-const* String_handle::byte_c_l() const
-{
- return data->byte_c_l();
-}
-
-INLINE char const*
-String_handle::ch_c_l() const
-{
- return (char const*)data->byte_c_l();
-}
-
-INLINE void
-String_handle::operator =(String_handle const &src)
-{
- if (this == &src)
- return;
- down();
- up(src.data);
-}
-
-INLINE void
-String_handle::operator += (char const *s)
-{
- copy();
- *data += s;
-}
-
-
-INLINE Byte
-String_handle::operator[](int j) const
-{
- return (*data)[j];
-}
-
-// !NOT SAFE!
-// don't use this for loops. Use byte_c_l()
-INLINE Byte &
-String_handle::operator[](int j)
-{
- copy(); // hmm. Not efficient
- return data->byte_l()[j];
-}
-
-INLINE void
-String_handle::append( Byte const* byte_c_l, int length_i )
-{
- copy();
- data->append( byte_c_l, length_i );
-}
-
-INLINE void
-String_handle::set( Byte const* byte_c_l, int length_i )
-{
- copy();
- data->set( byte_c_l, length_i );
-}
-
-INLINE void
-String_handle::operator = (char const *p)
-{
- copy();
- data->set( p );
-}
-
-INLINE void
-String_handle::trunc(int j)
-{
- copy(); data->trunc(j);
-}
-
-INLINE int
-String_handle::length_i() const
-{
- return data->length_i_;
-}
-
-INLINE bool
-String_handle::is_binary_bo() const {
- return data->is_binary_bo();
-}
-
-#endif
+++ /dev/null
-/*
-
- FILE : string.hh -- declare String
-
- Rehacked by HWN 3/nov/95
- removed String & 's
- introduced Class String_handle
- */
-
-#ifndef STRING_HH
-#define STRING_HH
-
-
-#include <string.h>
-#include <iostream.h>
-#include <Rational.h>
-
-#include "string-handle.hh"
-
-/**
-
- Intuitive string class. provides
-\begin{itemize}
-\item
- ref counting through #String_handle#
-\item
- conversion from bool, int, double, char* , char.
-\item
- to be moved to String_convert:
- conversion to int, upcase, downcase
-
-\item
- printable.
-
-\item
- indexing (index_i, index_any_i, last_index_i)
-
-\item
- cutting (left_str, right_str, mid_str)
-
-\item
- concat (+=, +)
-
-\item
- signed comparison (<, >, ==, etc)
-
-\item
- No operator[] is provided, since this would be enormously slow. If needed,
- convert to char const* .
-\end{itemize}
-
-*/
-class String
-{
-protected:
- String_handle strh_;
-
- bool null_terminated();
-
-public:
-
- /** init to empty string. This is needed because other
- constructors are provided.*/
- String() { }
- String(Rational);
-
- /// String s = "abc";
- String( char const* source );
- String( Byte const* byte_c_l, int length_i );
-
- /// "ccccc"
- String( char c, int n = 1 );
-
- String( int i , char const *fmt=0);
- String ( double f , char const* fmt =0);
- /// 'true' or 'false'
- String(bool );
-
- /// return a "new"-ed copy of contents
- Byte* copy_byte_p() const; // return a "new"-ed copy of contents
-
- char const* ch_c_l() const;
- Byte const* byte_c_l() const;
- char* ch_l();
- Byte* byte_l();
-
- /// deprecated; use ch_c_l()
- operator char const* () const { return ch_c_l(); }
-
- String &operator =( const String & source );
-
- /// concatenate s
- void operator += (char const* s) { strh_ += s; }
- void operator += (String s);
-
- void append(String);
- void prepend(String);
-
- char operator []( int n ) const { return strh_[n]; }
-
- /// return n leftmost chars
- String left_str( int n ) const;
-
- /// return n rightmost chars
- String right_str( int n ) const;
-
- /// return uppercase of *this
- String upper_str() const;
-
- /// return lowercase of *this
- String lower_str() const;
-
- /// return the "esrever" of *this
- String reversed_str() const;
-
-
- /// return a piece starting at index_i (first char = index_i 0), length n
- String mid_str(int index_i, int n ) const;
-
- /// cut out a middle piece, return remainder
- String nomid_str(int index_i, int n ) const;
-
- /// signed comparison, analogous to memcmp;
- static int compare_i(const String& s1,const String& s2);
-
- /// index of rightmost c
- int index_last_i( char c) const;
-
- /// index of rightmost element of string
- int index_last_i( char const* string ) const;
-
- int index_i(char c ) const;
- int index_i(String ) const;
- int index_any_i(String ) const;
-
- void to_upper();
- void to_lower();
- /// provide Stream output
- void print_on(ostream& os) const;
-
- /// the length of the string
- int length_i() const;
-
- // ***** depreciated
- int len() const {
- return length_i();
- }
-
- /// convert to an integer
- int value_i() const;
-
- /// convert to a double
- double value_f() const;
-};
-
-#include "compare.hh"
-
-instantiate_compare(const String &, String::compare_i);
-
-// because char const* also has an operator ==, this is for safety:
-inline bool operator==(String s1, char const* s2){
- return s1 == String(s2);
-}
-inline bool operator==(char const* s1, String s2)
-{
- return String(s1)==s2;
-}
-inline bool operator!=(String s1, char const* s2 ) {
- return s1!=String(s2);
-}
-inline bool operator!=(char const* s1,String s2) {
- return String(s2) !=s1;
-}
-
-
-inline String
-operator + (String s1, String s2)
-{
- s1 += s2;
- return s1;
-}
-
-inline ostream &
-operator << ( ostream& os, String d )
-{
- d.print_on(os);
- return os;
-}
-
-
-// String quoteString(String message, String quote);
-
-#endif
+++ /dev/null
-#ifndef TEXTDB_HH
-#define TEXTDB_HH
-
-#include "data-file.hh"
-
-/**a "const" Array. Contents can't be changed. do "#" comments, read quote enclosed fields */
-
-class Text_record : Array<String>
-{
- int line_no;
- String filename;
-
-public:
- Text_record() { } // needed because of other ctor
-
- /// report an error in this line.
- message(String s) {
- cerr << '\n'<< filename << ": "<< line_no << s << "\n";
- }
- String operator[](int j) {
- return Array<String>::operator[](j);
- }
-
- Text_record(Array<String> s, String fn, int j) : Array<String>(s) {
- filename = fn; line_no = j;
- }
- Array<String>::size;
-};
-
-/** abstraction for a datafile.
- add a subrec/fieldsep/record separator
- */
-
-class Text_db : private Data_file
-{
- void gobble_leading_white();
-public:
- /// get a line with records
- Text_record get_record();
-
- Text_db(String fn):Data_file(fn) { }
- Data_file::error;
- bool eof();
-
- /// get next line.
- Text_record operator++(int) {
- return get_record();
- }
- /// are we done yet?
- operator bool() {
- return !eof();
- }
-};
-
-#endif
+++ /dev/null
-
-#ifndef TEXTSTR_HH
-#define TEXTSTR_HH
-
-#include <stdio.h>
-#include <ctype.h>
-#include "string.hh"
-#include "varray.hh"
-
-/**
- line counting input stream.
- a stream for textfiles. linecounting. Thin interface getchar and
- ungetchar. (ungetc is unlimited)
-
- should protect get and unget against improper use
-*/
-
-
-class Text_stream
-{
- int line_no;
-
- // could just have used streams.
- FILE *f;
- Array<char> pushback;
- String name;
-
- public:
- Text_stream(String fn);
- String get_name() { return name; }
- bool eof() {
- return feof(f);
- }
- bool eol() {
- return (peek() == '\n');
- }
- char peek() {
- char c = get();
- unget(c);
- return c;
- }
- int line(){
- return line_no;
- }
-
- char get() {
- char c;
-
- if (pushback.empty())
- c = getc(f);
- else
- c = pushback.pop();
-
- if (c =='\n')
- line_no++;
- return c;
- }
- void unget(char c) {
- if (c =='\n')
- line_no--;
- pushback.push(c);
- }
- ~Text_stream (){
- if (!eof())
- cerr <<__FUNCTION__<< ": closing unended file";
-
- fclose(f);
- }
-
- /// GNU format message.
- void message(String s);
-};
-
-#endif
+++ /dev/null
-#ifndef UNIONFIND_HH
-#define UNIONFIND_HH
-#include "varray.hh"
-
-/*
- which points of a graph are connected?.
- Union find, a standard algorithm:
-
- Union_find represents an undirected graph of N points. You can
- connect two points using #connect()#. #find(i)# finds a uniquely
- determined representant of the equivalence class of points
- connected to #i#.
-
- */
-struct Union_find {
- void connect(int i, int j);
- int find(int i);
- bool equiv(int i, int j) { return find(i) == find(j); }
- Union_find(int sz);
-
-private:
- Array<int> classes;
-
-};
-#endif
+++ /dev/null
-/*
- (c) Han-Wen Nienhuys 1995,96
-
- Distributed under GNU GPL
-*/
-
-#ifndef ARRAY_H
-#define ARRAY_H
-#include <assert.h>
-
-/// copy a bare (C-)array from #src# to #dest# sized #count#
-template<class T>
-inline void arrcpy(T*dest, T*src, int count) {
- for (int i=0; i < count ; i++)
- *dest++ = *src++;
-}
-
-
-/**
- Scaleable array/stack template, for a type T with default constructor.
-
-
- This template implements a scaleable vector. With (or without) range
- checking. It may be flaky for objects with complicated con- and
- destructors. The type T should have a default constructor. It is
- best suited for simple types, such as int, double or String, it
- provides a paranoidly safe replacement for the new T[int] construct.
-
- It uses stack terminology, (push, pop, top), and can be used as a stack.
-
-
- */
-template<class T>
-class Array {
-protected:
- /// maximum length of array.
- int max;
-
- /// the data itself
- T *thearray;
-
- /// stretch or shrink array.
- void remax(int newmax) {
- T* newarr = new T[newmax];
- size_ = (newmax < size_) ? newmax : size_;
- arrcpy(newarr, thearray, size_);
-
- delete[] thearray;
- thearray = newarr;
- max = newmax;
- }
- int size_;
-
-public:
- /// check invariants
- void OK() const {
- assert(max >= size_ && size_ >=0);
- if (max) assert(thearray);
- }
- /** report the size_.
- @see {setsize_}
- */
- int size() const { return size_; }
-
- /// POST: size() == 0
- void clear() { size_ = 0; }
-
- Array() { thearray = 0; max =0; size_ =0; }
-
-
- /** set the size_ to #s#.
- POST: size() == s.
- Warning: contents are unspecified */
- void set_size(int s) {
- if (s >= max) remax(s);
- size_ = s;
- }
-
- ~Array() { delete[] thearray; }
-
- /// return a "new"ed copy of array
- T* copy_array() const {
- T* Tarray = new T[size_];
- arrcpy(Tarray, thearray, size_);
- return Tarray;
- }
- // depracated
- operator T* () const {
- return copy_array();
- }
- void operator=(Array const & src) {
- set_size (src.size_);
- arrcpy(thearray,src.thearray, size_);
- }
- Array(const Array & src) {
- thearray = src.copy_array();
- max = size_ = src.size_;
- }
-
- /// tighten array size_.
- void precompute () { remax(size_); }
-
- /// this makes Array behave like an array
- T &operator[] (const int i) const {
- assert(i >=0&&i<size_);
- return ((T*)thearray)[i];
- }
-
- /// add to the end of array
- void push(T x) {
- if (size_ == max)
- remax(2*max + 1);
-
- // T::operator=(T &) is called here. Safe to use with automatic
- // vars
- thearray[size_++] = x;
- }
- /// remove and return last entry
- T pop() {
- assert(!empty());
- T l = top(0);
- set_size(size()-1);
- return l;
- }
- /// access last entry
- T& top(int j=0) {
- return (*this)[size_-j-1];
- }
- /// return last entry
- T top (int j=0) const {
- return (*this)[size_-j-1];
- }
-
-
- void swap (int i,int j) {
- T t((*this)[i]);
- (*this)[i]=(*this)[j];
- (*this)[j]=t;
- }
- bool empty() { return !size_; }
- void insert(T k, int j) {
- assert(j >=0 && j<= size_);
- set_size(size_+1);
- for (int i=size_-1; i > j; i--)
- thearray[i] = thearray[i-1];
- thearray[j] = k;
- }
- void del(int i) {
- assert(i >=0&& i < size_);
- arrcpy(thearray+i, thearray+i+1, size_-i-1);
- size_--;
- }
- // quicksort.
- void sort (int (*compare)( T const&,T const&),
- int lower = -1, int upper = -1 ) {
- if (lower < 0) {
- lower = 0 ;
- upper = size()-1;
- }
- if (lower >= upper)
- return;
- swap(lower, (lower+upper)/2);
- int last = lower;
- for (int i= lower +1; i <= upper; i++)
- if (compare(thearray[i], thearray[lower]) < 0 )
- swap( ++last,i);
- swap(lower, last);
- sort(compare, lower, last-1);
- sort(compare, last+1, upper);
- }
- void concat(Array<T> const &src) {
- int s = size_;
- set_size(size_ + src.size_);
- arrcpy(thearray+s,src.thearray, src.size_);
- }
- Array<T> subvec(int lower, int upper) {
- assert(lower >= 0 && lower <=upper&& upper <= size_);
- Array<T> r;
- int s =upper-lower;
- r.set_size(s);
- arrcpy(r.thearray, thearray + lower, s);
- return r;
- }
-};
-
-#endif
+++ /dev/null
-#ifndef VECTOR_HH
-#define VECTOR_HH
-
-#include <math.h>
-#include "real.hh"
-#include "varray.hh"
-
-class Dstream;
-class String;
-void set_matrix_debug(Dstream&ds);
-
-/** a row of numbers.
- a vector. Storage is handled in Array, Vector only does the mathematics.
- */
-class Vector {
- Array<Real> dat;
-public:
- void OK() const { dat.OK();}
- int dim() const { return dat.size(); }
- Vector() { }
- Vector(Array<Real> d );
- Vector(const Vector&n);
- Vector(int n) {
- dat.set_size(n);
- fill(0);
- }
- void insert(Real v, int i) {
- dat.insert(v,i);
- }
- void del(int i) { dat.del(i); }
- operator String() const;
- void fill(Real r) {
- for (int i=0; i < dim(); i++)
- dat[i] =r;
- }
-
- void operator +=(Vector v) {
- assert(v.dim() == dim());
- for (int i=0; i < dim(); i++)
- dat[i] += v.dat[i];
- }
-
- void operator /=(Real a) {
- (*this) *= 1/a;
- }
-
- void operator *=(Real a) {
- for (int i=0; i < dim(); i++)
- dat[i] *= a;
- }
-
- void operator -=(Vector v) {
- assert(v.dim() == dim());
- for (int i=0; i < dim(); i++)
- dat[i] -= v(i);
- }
-
- Real &operator()(int i) { return dat[i]; }
- Real operator()(int i) const { return dat[i]; }
- Real elem(int i) { return dat[i]; }
- Real operator *(Vector v) const {
- Real ip=0;
- assert(v.dim() == dim());
- for (int i=0; i < dim(); i++)
- ip += dat[i] *v(i);
- return ip;
- }
- Vector operator-() const;
- Real norm() {
- return sqrt(norm_sq() );
- }
- Real norm_sq() {
- return ((*this) * (*this));
- }
- operator Array<Real> () { return dat; }
- void print() const;
- /// set to j-th element of unit-base
- void set_unit(int j) ;
-};
-
-inline Vector
-operator+(Vector a, Vector const &b) {
- a += b;
- return a;
-}
-
-inline Vector
-operator-(Vector a, Vector const &b) {
- a -= b;
- return a;
-}
-
-inline Vector
-operator*(Vector v, Real a) {
- v *= a;
- return v;
-}
-
-inline Vector
-operator*( Real a,Vector v) {
- v *= a;
- return v;
-}
-
-inline Vector
-operator/(Vector v,Real a) {
- v *= 1/a;
- return v;
-}
-
-#endif
+++ /dev/null
-#ifndef VSMAT_HH
-#define VSMAT_HH
-#include "varray.hh"
-#include "real.hh"
-/** base class for interface with matrix storageclasses. There are no
- iterators for matrixclasses, since matrices are (like arrays)
- explicitly int-indexed.
-
- Iteration is provided by *_next, *_ok, which update and check both
- index variables simultaneously.
-
- TODO
- determine type of product matrix.
-
-*/
-class virtual_smat {
-
-
-public:
- /// check invariants
- virtual void OK() const=0;
-
- /// height of matrix
- virtual int rows() const = 0;
-
- /// width of matrix
- virtual int cols() const = 0;
-
-
- /** set the size. contents lost.
- PRE
- i >=0, j>=0
- */
- virtual void set_size(int i, int j) = 0;
-
- /**set the size to square dimen. contents lost
- PRE
- i>=0
- */
- virtual void set_size(int i) = 0;
- /**set the size to i.
-
- keep contents. If enlarged contents unspecified
-
- PRE
- i>=0, j>=0
-
- */
- virtual void resize(int i, int j) = 0;
-
- /**
- set the size to square dimen. contents kept
- Keep contents. If enlarged contents are unspecified
-
- PRE
- i>=0
- */
- virtual void resize(int i) = 0;
-
-
- /**
- access an element.
-
- Generate an errormessage, if this happens
- in the 0-part of a sparse matrix.
- */
-
- virtual Real& elem(int i,int j) = 0;
-
- /// access a element, no modify
- virtual const Real& elem(int i, int j) const = 0;
-
-#if 1
- virtual Array<Real> row(int i) const = 0;
- virtual Array<Real> column(int j) const = 0;
-#endif
-
-
- /**
- add a row to the matrix before row k. Contents
- of added row are unspecified
-
- 0 <= k <= rows()
- */
- virtual void insert_row(int k)=0;
-
-
- /**
- delete a row from this matrix.
-
- PRE
- 0 <= k < rows();
- */
- virtual void delete_row(int k)=0;
- virtual void delete_column(int k)=0;
- virtual ~virtual_smat() { }
- virtual virtual_smat *clone()=0;
-
-
-
- /**
- at end of matrix?. when doing loop
-
- for(i=0; i<h; i++)
- for(j=0; j<w; j++)
- ..
-
- */
- virtual bool mult_ok(int i, int j) const=0;
-
- /**
- walk through matrix (regular multiply).
- get next j for row i, or get next row i and reset j.
- this will make sparse matrix implementation easy.
-
- PRE
- mult_ok(i,j)
- */
- virtual void mult_next(int &i, int &j) const = 0;
-
-/**
- valid matrix entry. return false if at end of row
- */
- virtual bool trans_ok(int i, int j) const=0;
-
- /**
- walk through matrix (transposed multiply).
- Get next i (for column j)
-
- PRE
- ver_ok(i,j)
- */
-
- virtual void trans_next(int &i, int &j) const = 0;
- /// generate a "Full_storage" matrix
- static virtual_smat *get_full(int n, int m);
-
-};
-
-
-#endif
+++ /dev/null
-/*
- process command line, GNU style.
-
- this is (Copyleft) 1996, Han-Wen Nienhuys, <hanwen@stack.nl>
- */
-#include <stdio.h>
-#include <iostream.h>
-#include <assert.h>
-#include "lgetopt.hh"
-
-long
-Getopt_long::intarg()
-{
- long l;
- if (sscanf(optarg, "%ld", &l) != 1)
- report(E_ILLEGALARG);
-
- return l;
-}
-
-Long_option_init *
-Getopt_long::parselong()
-{
- const char *optnm = argv[optind] + 2 ;
- assert(*optnm);
-
- char *endopt = strchr(optnm, '=');
- int searchlen = (endopt) ? endopt - optnm : strlen(optnm);
-
- beet=0;
- for (int i=0; i< table_len; i++) {
- const char *ln = the_opts[i].longname;
-
- if (ln && !strncmp(ln, optnm, searchlen)) {
- beet = the_opts+i;
- break;
- }
- }
-
- if (!beet) {
- report(E_UNKNOWNOPTION);
- return 0;
- }
- optind++;
- optindind = 0;
-
-
- if (beet->take_arg) {
- if (endopt)
- optarg = endopt +1; // a '='
- else {
- optarg = argv[optind];
- optind++;
- }
- if (!optarg)
- report(E_ARGEXPECT);
-
- } else {
- optarg = 0;
- if (endopt)
- report(E_NOARGEXPECT);
- }
-
- return beet;
-}
-
-
-ostream &
-Long_option_init::printon(ostream &errorout)
-{
- if (shortname)
- errorout <<"-" << shortname;
- if (shortname && longname)
- errorout << ", ";
- if (longname)
- errorout << "`--" << longname << "'";
- return errorout;
-}
-
-// report an error, GNU style.
-void
-Getopt_long::report(Errorcod c)
-{
- error = c;
- if (!errorout)
- return;
-
- *errorout << argv[0] << ": ";
- switch (c) {
- case E_ARGEXPECT:
- *errorout<< "option ";
- beet->printon(*errorout);
- *errorout << "requires an argument"<<endl;
- break;
- case E_NOARGEXPECT:
- *errorout << "option `--" <<
- beet->longname << "' does not allow an argument"<<endl;
- break;
-
- case E_UNKNOWNOPTION:
- *errorout << "unrecognized option ";
- if (optindind)
- *errorout << "-" << argv[optind][optindind] << endl;
- else
- *errorout << argv[optind] << endl;
-
- break;
- case E_ILLEGALARG:
- *errorout << "illegal argument `" << optarg << "\'to option ";
- beet->printon(*errorout);
- *errorout << '\n';
- default:
- assert(false);
- }
- exit(2);
-}
-
-Long_option_init *
-Getopt_long::parseshort()
-{
- char c=argv[optind][optindind];
- beet=0;
- assert(c);
-
- for (int i=0; i < table_len; i++)
- if (the_opts[i].shortname == c) {
- beet = the_opts+i;
- break;
- }
-
- if (!beet){
- report(E_UNKNOWNOPTION);
- return 0;
- }
-
- optindind++;
- if (!beet->take_arg){
- optarg = 0;
- return beet;
- }
- optarg = argv[optind] + optindind;
-
- optind ++;
- optindind = 0;
-
- if (!optarg[0]) {
- optarg = argv[optind];
- optind ++;
- }
- if (!optarg) {
- report(E_ARGEXPECT);
- }
-
- return beet;
-}
-
-Long_option_init *
-Getopt_long::operator()() {
- if (!next())
- return 0;
-
- if (optindind)
- return parseshort();
-
- if (argv[optind][0] != '-')
- return 0;
-
- if (argv[optind][1] == '-') {// what to do with "command -- bla"
- return parselong();
- } else {
- optindind = 1;
- return parseshort();
- }
-}
-
-Getopt_long::Getopt_long(int c, char **v, Long_option_init *lo)
-{
- the_opts = lo;
- errorout = &cerr;
- argv = v;
- argc = c;
- optind = 1;
- optindind = 0;
-
- // reached end of option table?
- int i;
- for (i = 0; the_opts[i].longname ||the_opts[i].shortname; i++)
- ;
- table_len = i;
-}
-
-bool
-Getopt_long::next()
-{
-
- error = E_NOERROR;
- while (optind < argc && !argv[optind][optindind]) {
- optind++;
- optindind = 0;
- }
- return (optind < argc);
-}
-
-char *
-Getopt_long::current_arg()
-{
- if (optind >= argc)
- return 0;
- char * a = argv[optind];
- return a + optindind;
-}
-
-char *
-Getopt_long::get_next_arg()
-{
- char * a = current_arg();
- if ( a) {
- optind ++;
- optindind = 0;
- }
- return a;
-}
+++ /dev/null
-/*
- libc-extension.cc -- implement some string.h extensions
-
- source file of the flowerlib
-
- (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
-*/
-#include <stdarg.h>
-#include <string.h>
-#include <ctype.h>
-#include "libc-extension.hh"
-
-/*
- compensate for lacking libc functions.
- */
-char*
-strnlwr( char* start_l ,int n)
-{
- char * p = start_l + n;
- while ( --p >= start_l) {
- *p = tolower( *p ); /* a macro on some compilers */
- }
- return start_l;
-}
-
-char*
-strnupr( char* start_l, int n)
-{
- char * p = start_l + n;
- while ( --p >= start_l) {
- *p = toupper( *p ); /* a macro on some compilers */
- }
- return start_l;
-}
-
-#ifndef HAVE_MEMMEM
-
-/** locate a substring. #memmem# finds the first occurrence of
- #needle# in #haystack#
- */
-
-char *
-memmem(const Byte * haystack, int haystack_len,
- const Byte *needle,int needle_len)
-{
- const Byte * end_haystack = haystack + haystack_len - needle_len;
- const Byte * end_needle = needle + needle_len ;
-
- /* Ahhh ... Some minimal lowlevel stuff. This *is* nice; Varation
- is the spice of life */
- while (haystack < end_haystack) {
- const Byte *subneedle_l = needle;
- const Byte *subhaystack_l = haystack;
- while (subneedle_l < end_needle) {
- if (*subneedle_l++ != *subhaystack_l++)
- goto next; // yeah. I should be prosecuted.
- }
-
- // completed the needle. Gotcha.
- return (char*) haystack;
- next:
- haystack++;
- }
- return 0;
-}
-#endif
-
-Byte *
-memrchr(const Byte * p, int n, char c)
-{
- const Byte * q = p+n;
- while (q > p) {
- if (*--q == c)
- return (Byte*)q;
- }
- return 0;
-}
-
-
-template<class T>
-inline void
-my_swap(T &t1, T &t2, T &tmp)
-{
- tmp = t1;
- t1 = t2;
- t2 = tmp;
-}
-
-Byte*
-strrev( Byte* byte_l, int length_i )
-{
- Byte tmp_byte;
-
- Byte* left_l = byte_l;
- Byte* right_l = byte_l + length_i;
-
- while ( right_l > left_l ) {
- my_swap(*right_l-- , *left_l++ , tmp_byte);
- }
- return byte_l;
-}
-
-#ifndef HAVE_SNPRINTF
-int snprintf ( char *str, size_t,
- const char *format, ... )
-{
- va_list ap;
- va_start(ap, format);
- int i = vsprintf(str, format, ap);
- va_end(ap);
- return i;
-}
-#endif
+++ /dev/null
-#include "dstream.hh"
-#include "matrix.hh"
-
-static Dstream *dout = 0;
-
-/**
- Set the debugging output. Will not delete/swallow argument.
- */
-void set_matrix_debug(Dstream&ds)
-{
- dout = &ds;
-}
-
-Matrix::operator String() const
-{
- String s;
-#ifndef NPRINT
- s="matrix {\n";
- for (int i=0; i< rows(); i++){
- for (int j = 0; j < cols(); j++) {
- s+= String(dat->elem(i,j), "%6f ");
- }
- s+="\n";
- }
- s+="}\n";
-#endif
- return s;
-}
-
-
-void
-Matrix::print() const
-{
-#ifndef NPRINT
- if (!dout)
- return;
- *dout << *this;
-#endif
-}
-
-Vector::operator String() const
-{
- String s;
-#ifndef NPRINT
- s="vector [";
- for (int i=0; i < dim(); i++) {
- s += String(dat[i], "%6f") + String(' ');
- }
- s+="]";
-#endif
- return s;
-}
-
-
-void
-Vector::print() const
-{
-#ifndef NDEBUG
- if (!dout)
- return;
- *dout << *this<<'\n';
-#endif
-}
+++ /dev/null
-#include "matrix.hh"
-
-Real
-Matrix::norm() const
-{
- Real r =0.0;
- for (int i=0, j=0; dat->mult_ok(i,j); dat->mult_next(i,j))
- r += sqr(dat->elem(i,j));
- return sqrt(r);
-}
-
-void
-Matrix::fill(Real r)
-{
- for (int i=0, j=0; dat->mult_ok(i,j); dat->mult_next(i,j))
- dat->elem(i,j)=r;
-}
-
-void
-Matrix::set_diag(Real r)
-{
- for (int i=0, j=0; dat->mult_ok(i,j); dat->mult_next(i,j))
- dat->elem(i,j)=(i==j) ? r: 0.0;
-}
-
-void
-Matrix::set_diag(Vector d)
-{
- for (int i=0, j=0; dat->mult_ok(i,j); dat->mult_next(i,j))
- dat->elem(i,j)=(i==j) ? d(i): 0.0;
-}
-
-void
-Matrix::operator+=(const Matrix&m)
-{
- assert(m.cols() == cols());
- assert(m.rows() == rows());
- for (int i=0, j=0; dat->mult_ok(i,j); dat->mult_next(i,j))
- dat->elem(i,j) += m(i,j);
-}
-
-void
-Matrix::operator-=(const Matrix&m)
-{
- assert(m.cols() == cols());
- assert(m.rows() == rows());
- for (int i=0, j=0; dat->mult_ok(i,j); dat->mult_next(i,j))
- dat->elem(i,j) -= m(i,j);
-}
-
-
-void
-Matrix::operator*=(Real a)
-{
- for (int i=0, j=0; dat->mult_ok(i,j); dat->mult_next(i,j))
- dat->elem(i,j) *= a;
-}
-
-void
-Matrix::operator=(const Matrix&m)
-{
- if (&m == this)
- return ;
- delete dat;
- dat = m.dat->clone();
-}
-
-Matrix::Matrix(const Matrix &m)
-{
- m.OK();
-
- dat = m.dat->clone();
-}
-
-
-Matrix::Matrix(int n, int m)
-{
- dat = virtual_smat::get_full(n,m);
- fill(0);
-}
-
-Matrix::Matrix(int n)
-{
- dat = virtual_smat::get_full(n,n);
- fill(0);
-}
-
-Matrix::Matrix(Vector v, Vector w)
-{
- dat = virtual_smat::get_full(v.dim(), w.dim());
- for (int i=0, j=0; dat->mult_ok(i,j); dat->mult_next(i,j))
- dat->elem(i,j)=v(i)*w(j);
-}
-
-
-Vector
-Matrix::row(int k) const
-{
- int n=cols();
-
-
- Vector v(n);
- for(int i=0; i < n; i++)
- v(i)=dat->elem(k,i);
-
- return v;
-}
-
-Vector
-Matrix::col(int k) const
-{
- int n=rows();
- Vector v(n);
- for(int i=0; i < n; i++)
- v(i)=dat->elem(i,k);
- return v;
-}
-
-Vector
-Matrix::left_multiply(const Vector& v) const
-{
- Vector dest(v.dim());
- assert(dat->cols()==v.dim());
- for (int i=0, j=0; dat->mult_ok(i,j); dat->mult_next(i,j))
- dest(i)+= dat->elem(j,i)*v(j);
- return dest;
-}
-
-Vector
-Matrix::operator *(const Vector& v) const
-{
- Vector dest(rows());
- assert(dat->cols()==v.dim());
- for (int i=0, j=0; dat->mult_ok(i,j); dat->mult_next(i,j))
- dest(i)+= dat->elem(i,j)*v(j);
- return dest;
-}
-
-Matrix
-operator /(Matrix const& m1,Real a)
-{
- Matrix m(m1);
- m /= a;
- return m;
-}
-
-void
-Matrix::transpose() // delegate to storage?
-{
- for (int i=0, j=0; dat->mult_ok(i,j); dat->mult_next(i,j)) {
- if (i >= j)
- continue;
- Real r=dat->elem(i,j);
- dat->elem(i,j) = dat->elem(j,i);
- dat->elem(j,i)=r;
- }
-}
-
-Matrix
-Matrix::operator-() const
-{
- OK();
- Matrix m(*this);
- m*=-1.0;
- return m;
-}
-
-Matrix
-Matrix::transposed() const
-{
- Matrix m(*this);
- m.transpose();
- return m;
-}
-
-
-/* should do something smarter: bandmatrix * bandmatrix is also banded matrix. */
-Matrix
-operator *(const Matrix &m1, const Matrix &m2)
-{
- Matrix result(m1.rows(), m2.cols());
- result.set_product(m1,m2);
- return result;
-}
-
-void
-Matrix::set_product(const Matrix &m1, const Matrix &m2)
-{
- assert(m1.cols()==m2.rows());
- assert(cols()==m2.cols() && rows()==m1.rows());
-
- for (int i=0, j=0; dat->mult_ok(i,j);
- dat->mult_next(i,j)) {
- Real r=0.0;
- for (int k = 0; k < m1.cols(); k++)
- r += m1(i,k)*m2(k,j);
- dat->elem(i,j)=r;
- }
-}
-
-void
-Matrix::insert_row(Vector v, int k)
-{
- assert(v.dim()==cols());
- dat->insert_row(k);
- for (int j=0; j < cols(); j++)
- dat->elem(k,j)=v(j);
-}
-
-
-void
-Matrix::swap_columns(int c1, int c2)
-{
- assert(c1>=0&& c1 < cols()&&c2 < cols() && c2 >=0);
- for (int i=0; i< rows(); i++) {
- Real r=dat->elem(i,c1);
- dat->elem(i,c1) = dat->elem(i,c2);
- dat->elem(i,c2)=r;
- }
-}
-
-void
-Matrix::swap_rows(int c1, int c2)
-{
- assert(c1>=0&& c1 < rows()&&c2 < rows() && c2 >=0);
- for (int i=0; i< cols(); i++) {
- Real r=dat->elem(c1,i);
- dat->elem(c1,i) = dat->elem(c2,i);
- dat->elem(c2,i)=r;
- }
-}
-
-
-int
-Matrix::dim() const
-{
- assert(cols() == rows());
- return rows();
-}
-
+++ /dev/null
-/*
- path.cc - manipulation of paths and filenames.
-*/
-#include <stdio.h>
-#include "path.hh"
-
-#ifndef PATHSEP
-#define PATHSEP '/'
-#endif
-
-/**
- @param path the original full filename
- @return 4 components of the path. They can be empty
-*/
-void
-split_path(String path,
- String &drive, String &dirs, String &filebase, String &extension)
-{
- // peel off components, one by one.
- int di = path.index_i(':');
- if (di >= 0)
- {
- drive = path.left_str(di + 1);
- path = path.right_str(path.len() - di -1);
- }
- else
- drive = "";
-
- di = path.index_last_i(PATHSEP);
- if (di >=0)
- {
- dirs = path.left_str(di + 1);
- path = path.right_str(path.len()-di -1);
- }
- else
- dirs = "";
-
- di = path.index_last_i('.');
- if (di >= 0)
- {
- filebase = path.left_str(di);
- extension =path.right_str(path.len()-di);
- }
- else
- {
- extension = "";
- filebase = path;
- }
-}
-
-File_path::File_path(String pref)
-{
- add(".");
- add(pref);
-}
-
-
-/** find a file.
- It will search in the current dir, in the construction-arg, and
- in any other added path, in this order.
- */
-String
-File_path::find(String nm)
-{
- for (int i=0; i < size(); i++) {
- String path = (*this)[i];
- path+= "/"+nm;
-
-
- FILE *f = fopen(path, "r"); // ugh!
- if (f) {
- fclose(f);
- return path;
- }
- }
- return "";
-}
+++ /dev/null
-#include <assert.h>
-#include <stdio.h>
-#include "scalar.hh"
-
-Scalar::Scalar(Rational r)
- :String(r)
-{
-
-}
-
-Scalar::operator Rational()
-{
- int p = index_i('/');
- if (p == -1)
- return int(*this);
-
- String s2 = right_str(len()-p-1);
- String s1 = left_str(p);
-
- return Rational(s1.value_i(), s2.value_i());
-}
-
-bool
-Scalar::isnum()
-{
- int conv = false;
- if (len()) {
- long l =0;
- conv = sscanf(strh_.ch_c_l(), "%ld", &l);
- }
- return len() && conv;
-}
-
-Scalar::operator Real()
-{
- assert (isnum());
- return value_f();
-}
-
-Scalar::operator int()
-{
- assert (isnum());
- return value_i();
-}
-
-
-Scalar::operator bool() const
-{
- if (!len())
- return false;
- if (*this == "0")
- return false;
- String u (*this);
- if ( u.upper_str() == "FALSE")
- return false;
- return true;
-}
+++ /dev/null
-#include "smat.hh"
-
-void
-Full_storage::operator=(Full_storage const &fs)
-{
- resize(fs.h, fs.w);
- OK();
- fs.OK();
- for (int i=0; i<h; i++)
- for (int j=0; j<w; j++)
- els[i][j]= fs.els[i][j];
-}
-
-void
-Full_storage::OK() const
-{
-#ifndef NDEBUG
- // static Real dummy;
- assert(maxh >= h && maxw >= w);
- assert(h >= 0 && w >= 0);
- assert(els||!maxh);
-#endif
-}
-void
-Full_storage::resize_cols(int newh)
-{
- if (newh <= maxh) {
- h=newh;
- return;
- }
-
- Real ** newa=new Real*[newh];
- int j=0;
- for (; j < h; j++)
- newa[j] = els[j];
- for (; j < newh; j++)
- newa[j] = new Real[maxw];
- delete[] els;
- els=newa;
-
- h = maxh = newh;
-}
-
-void
-Full_storage::resize_rows(int neww)
-{
- if (neww <= maxw) {
- w=neww;
- return;
- }
- for (int i=0; i < maxh ; i++) {
- Real* newa = new Real[neww];
- for (int k=0; k < w; k++)
- newa[k] = els[i][k];
-
- delete[] els[i];
- els[i] = newa;
- }
- w = maxw = neww;
-}
-
-Full_storage::~Full_storage() {
- for (int i=0; i < maxh; i++)
- delete [] els[i];
- delete[] els;
-}
-
-void
-Full_storage::resize(int rows, int cols)
-{
- OK();
- resize_cols(rows);
- resize_rows(cols);
-
-}
-
-
-bool
-Full_storage::mult_ok(int i, int j) const
-{
- return valid(i,j);
-}
-
-bool
-Full_storage::trans_ok(int i, int j) const
-{
- return valid(i,j);
-}
-
-
-void
-Full_storage::trans_next(int &i, int &j) const
-{
- assert(trans_ok(i,j));
- i++;
- if (i >= h) {
- i=0;
- j ++;
- }
-}
-
-void
-Full_storage::mult_next(int &i, int &j) const
-{
- assert(mult_ok(i,j));
- j++;
- if (j >= w) {
- j=0;
- i++;
- }
-}
-
-void
-Full_storage::delete_column(int k)
-{
- assert(0 <= k &&k<w);
- for (int i=0; i< h ; i++)
- for (int j=k+1; j <w; j++)
- els[i][j-1]=els[i][j];
- w--;
-}
-void
-Full_storage::delete_row(int k)
-{
- assert(0 <= k &&k<h);
- for (int i=k+1; i < h ; i++)
- for (int j=0; j < w; j++)
- els[i-1][j]=els[i][j];
- h--;
-}
-
-
-void
-Full_storage::insert_row(int k)
-{
- assert(0 <= k&& k <=h);
- resize_cols(h+1);
- for (int i=h-1; i > k ; i--)
- for (int j=0; j <w; j++)
- els[i][j]=els[i-1][j];
-
-}
-
-
-Array<Real>
-Full_storage::row(int n) const
-{
- Array<Real> r;
- for (int j = 0; j < w; j++)
- r.push(els[n][j]);
- return r;
-}
-
-Array<Real>
-Full_storage::column(int n) const
-{
-
- Array<Real> r;
- for (int i = 0; i<h; i++)
- r.push(els[i][n]);
- return r;
-}
-
-
-Full_storage::Full_storage(Full_storage&s)
-{
- init();
- (*this) = s;
-}
-virtual_smat*
-Full_storage::clone()
-{
- return new Full_storage(*this);
-}
-
-
-virtual_smat *
-virtual_smat::get_full(int n, int m)
-{
- return new Full_storage(n,m);
-}
+++ /dev/null
-/*
- PROJECT: FlowerSoft C++ library
- FILE : string-convert.cc
-
---*/
-
-
-#include <assert.h>
-#include <limits.h>
-#include "libc-extension.hh"
-#include "string.hh"
-#include "string-convert.hh"
-
-/**
- a safe length for stringconversion buffers
-
- worst case would be %f printing HUGE (or 1/HUGE), which is approx
- 2e318, this number would have approx 318 zero's in its string.
-
- Should enlarge buff dynamically.
- @see
- man 3 snprintf
- */
-static const int STRING_BUFFER_LEN=1024;
-
-String
-String_convert::bin2hex_str( String bin_str )
-{
- String str;
- Byte const* byte_c_l = bin_str.byte_c_l();
- for ( int i = 0; i < bin_str.length_i(); i++ ) {
- str += (char)nibble2hex_byte( *byte_c_l >> 4 );
- str += (char)nibble2hex_byte( *byte_c_l++ );
- }
- return str;
-}
-
-int
-String_convert::bin2_i( String bin_str )
-{
- assert( bin_str.length_i() <= 4 );
-
- int result_i = 0;
- for ( int i = 0; i < bin_str.length_i(); i++ ) {
- result_i <<= 8;
- result_i += (Byte)bin_str[ i ];
- }
- return result_i;
-}
-
-// breendet imp from String
-int
-String_convert::dec2_i( String dec_str )
-{
- if ( !dec_str.length_i() )
- return 0;
-
- long l = 0;
- int conv = sscanf( dec_str.ch_c_l(), "%ld", &l );
- assert( conv );
-
- return (int)l;
-}
-
-String
-String_convert::i64_str( I64 i64, char const* fmt)
-{
- char buffer[STRING_BUFFER_LEN];
- snprintf(buffer, STRING_BUFFER_LEN,
- (fmt ? fmt : "%Ld"), i64 ); // assume radix 10
- return String(buffer);
-
-}
-// breendet imp from String
-double
-String_convert::dec2_f( String dec_str )
-{
- if ( !dec_str.length_i() )
- return 0;
- double d = 0;
- int conv = sscanf( dec_str.ch_c_l(), "%lf", &d );
- assert( conv );
- return d;
-}
-
-int
-String_convert::hex2bin_i( String hex_str, String& bin_str_r )
-{
- if ( hex_str.length_i() % 2 )
- hex_str = "0" + hex_str;
-
- bin_str_r = "";
- Byte const* byte_c_l= hex_str.byte_c_l();
- int i = 0;
- while ( i < hex_str.length_i() ) {
- int high_i = hex2nibble_i( *byte_c_l++ );
- int low_i = hex2nibble_i( *byte_c_l++ );
- if ( high_i < 0 || low_i < 0 )
- return 1; // illegal char
- bin_str_r += String( (char)( high_i << 4 | low_i ), 1 );
- i += 2;
- }
- return 0;
-}
-
-String
-String_convert::hex2bin_str( String hex_str )
-{
- String str;
-// silly, asserts should alway be "on"!
-// assert( !hex2bin_i( hex_str, str ) );
- int error_i = hex2bin_i( hex_str, str );
- assert( !error_i );
- return str;
-}
-
-int
-String_convert::hex2nibble_i( Byte byte )
-{
- if ( byte >= '0' && byte <= '9' )
- return byte - '0';
- if ( byte >= 'A' && byte <= 'F' )
- return byte - 'A' + 10;
- if ( byte >= 'a' && byte <= 'f')
- return byte - 'a' + 10;
- return -1;
-}
-
-// stupido. Should use int_str()
-String
-String_convert::i2dec_str( int i, int length_i, char ch )
-{
- char fill_ch = ch;
- if ( fill_ch)
- fill_ch = '0';
-
- // ugh
- String dec_str( i );
-
- // ugh
- return String( fill_ch, length_i - dec_str.length_i() ) + dec_str;
-}
-
-
-// stupido. Should use int_str()
-String
-String_convert::u2hex_str( unsigned u, int length_i, char fill_ch )
-{
- String str;
- if ( !u )
- str = "0";
-
-#if 1 // both go...
- while ( u ) {
- str = String( (char)( ( u % 16 )["0123456789abcdef"] ) ) + str;
- u /= 16;
- }
-#else
- str += int_str( u, "%x" );
-#endif
-
- str = String( fill_ch, length_i - str.length_i() ) + str;
- while ( ( str.length_i() > length_i ) && ( str[ 0 ] == 'f' ) )
- str = str.mid_str( 2, INT_MAX );
-
- return str;
-}
-
-String
-String_convert::i2hex_str( int i, int length_i, char fill_ch )
-{
- return u2hex_str( (unsigned)i, length_i, fill_ch );
-}
-
-Byte
-String_convert::nibble2hex_byte( Byte byte )
-{
- if ( ( byte & 0x0f ) <= 9 )
- return ( byte & 0x0f ) + '0';
- else
- return ( byte & 0x0f ) - 10 + 'a';
-}
-/**
- Convert an integer to a string
-
- @param
- #fmt# is a printf style format, default assumes "%d" as format.
- */
-String
-String_convert::int_str(int i, char const* fmt)
-{
- char buffer[STRING_BUFFER_LEN];
- snprintf(buffer, STRING_BUFFER_LEN,
- (fmt ? fmt : "%d"), i ); // assume radix 10
- return String(buffer);
-}
-
-/**
- Convert a double to a string.
-
- @param #fmt# is a printf style format, default assumes "%lf" as format
- */
-String
-String_convert::double_str(double f, char const* fmt)
-{
- char buf[STRING_BUFFER_LEN];
-
- snprintf(buf, STRING_BUFFER_LEN, fmt ? fmt : "%f", f);
- return buf;
-}
-
-/**
- Make a string from a single character.
-
- @param
- #n# is a repetition count, default value is 1
- */
-String
-String_convert::char_str(char c, int n)
-{
- n = n >= 0 ? n : 0;
- char* ch_p = new char[ n ];
- memset( ch_p, c, n );
- String s((Byte*)ch_p, n);
- delete ch_p;
- return s;
-}
-
-String
-String_convert::rational_str(Rational r)
-{
- char * n = Itoa(r.numerator()); // LEAK????
-
- String s = n;
- if (r.denominator() != 1) {
- char * d = Itoa(r.denominator());
- s += String( '/' ) + String(d);
- //delete d;
- }
-/* delete n;
- */
- return s;
-}
-
-String
-String_convert::pointer_str(const void *l)
-{
- I64 i64 = (I64)l;
- return String_convert::i64_str(i64, "0x%0Lx");
-}
+++ /dev/null
-#ifdef STRING_TEST
-/*
- stupid test program to verify stringlib
- stringtest.cc
- */
-#include <iostream.h>
-#include "string.hh"
-#include "varray.hh"
-#include "string-convert.hh"
-
-void
-ctors()
-{
- cout << "constructors"<<endl;
-
- String str( "hai" );
- String def;
- String fromi(10);
- String fromc('c');
- String fromf(1.32e-2, "%g");
-
- cout << str << endl;
- cout << def << endl;
- cout << fromi<< endl;
- cout << fromc<< endl;
- cout << fromf<< endl;
-}
-
-void
-cmp()
-{
- Array<String> a;
- a.push("abcd");
- a.push("zxy");
- a.push("abc");
- a.push("");
- a.sort(String::compare_i);
- cout << "compares: "<<endl;
- for (int i=0; i < a.size(); i++)
- cout << a[i] << endl;
-}
-
-
-void
-searching()
-{
- String hay = "foobarbazblub";
-
- char c = 'b';
- String cstr =c;
- String set = "bar";
- cout << "hay = \"" << hay << "\" len="<< hay.length_i()<<endl;
- cout << "index_i('"<< c<<"') " << c << "= " << hay.index_i(c) <<endl;
- cout << "last_index_i('"<< c<<"') " << c << "= " << hay.index_last_i(c) <<endl;
-// cout << "last index of cstr " << c << ": " << hay.index_last_i(cstr) <<endl;
-// cout << "index_last_i(\""<<set<<"\"): " << hay.index_last_i(set) <<endl;
- cout << "index_i(\""<<set<<"\"): " << hay.index_i(set) <<endl;
- cout << "index_any(\"" << set << "\"): " << cstr << ": " << hay.index_any_i(cstr) <<endl;
-
-
-
-}
-
-
-void
-kutenpeer()
-{
- String str( "hai" );
- for (int i=-1; i < str.length_i()+2; i++) {
- cout<<" left_str(" << i<<"): " << str.left_str( i ) << endl;
- cout<<" right_str( "<<i<<"): " << str.right_str( i ) << endl;
- }
- str = "blonde haren";
- cout << str<<endl;
- cout << "mid(2,6)="<<str.mid_str(2,3)<<endl;
- cout << "nomid(2,6)="<<str.nomid_str(2,3)<<endl;
-}
-
-int
-main()
-{
- ctors();
- cmp();
- searching();
- kutenpeer();
- String str( "hai" );
- cout << str << endl;
- cout << "left" << endl;
- str += " daar";
- cout << str << endl;
-
- str = String( "Hallo" ) + " daaR" + '!';
- cout << str << endl;
-
- cout << "up: " << str.upper_str() << " down: " << str.lower_str()<<endl;
-
- if ( str == String( "" ) )
- cout << str << " is empty" << endl;
- else
- cout << str << " is not empty"<<endl;
-
-
- String fn = "";
- if ( fn == "" )
- cout << fn << " is empty" << endl;
- else
- assert(false);
-
- fn = "";
- fn += "";
- delete fn.copy_byte_p();
- delete str.copy_byte_p();
-
- cout << String_convert::bin2hex_str( String( (char)0xff ) ) << endl;
-}
-
-#endif STRING_TEST
-
+++ /dev/null
-/*
- stringutil.cc -- generate non-inline members.
-
- source file of the LilyPond music typesetter
-
- (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
-*/
-
-#ifdef STRING_DEBUG
-#include <sys/types.h>
-#include <memory.h>
-void*
-mymemmove( void* dest, void const* src, size_t n )
-{
- return memcpy( dest, src, n ); // wohltempererit: 69006
-}
-#define memmove mymemmove
-#endif
-
-#ifdef STRING_UTILS_INLINED
-#undef STRING_UTILS_INLINED
-#endif
-
-#ifdef INLINE
-#undef INLINE
-#endif
-
-#define INLINE
-
-#include "string-handle.hh"
-#include "string-data.hh"
-#include "string-data.inl"
-#include "string-handle.inl"
+++ /dev/null
-#include "text-db.hh"
-bool
-Text_db::eof()
-{
- Data_file::gobble_leading_white();
- return Data_file::eof();
-}
-
-void
-Text_db::gobble_leading_white()
-{
- while (1) {
- Data_file::gobble_leading_white();
- if (eof())
- return ;
- char c;
- if ((c = data_get()) !='\n'){
- data_unget (c);
- return ;
- }
- }
-}
-
-
-Text_record
-Text_db::get_record()
-{
- while (1) {
- String s;
- Array<String> fields;
- assert(!eof());
-
- while ((s = get_word()) != "")
- {
- fields.push(s);
- gobble_white();
- }
-
-
- if (get_line() != "")
- assert(false);
-
- assert (fields.size());
- return Text_record(fields, get_name(), line());
- }
-}
-
-
+++ /dev/null
-#include "text-stream.hh"
-
-Text_stream::Text_stream(String fn)
-{
- ios::sync_with_stdio();
- if (fn == "")
- {
- name = "<STDIN>";
- f = stdin;
- }
-
- else
- {
- name = fn;
- f = fopen(fn, "r");
- }
-
- if (!f) {
- cerr <<__FUNCTION__<< ": can't open `" << fn << "'\n";
- exit(1);
- }
-
- line_no = 1;
- }
-
-void
-Text_stream::message(String s)
-{
- cerr << "\n"<<get_name() << ": " << line()<<": "<<s<<endl;
-}
-
+++ /dev/null
-#include "unionfind.hh"
-/*
- see a book on data structures
- */
-
-Union_find::Union_find(int n)
-{
- classes.set_size(n);
-
- for (int i=0; i < n; i++) {
- classes[i] = i;
- }
-}
-
-int
-Union_find::find(int i)
-{
- int rep = i;
- while (classes[rep] != rep)
- rep = classes[rep];
- while (classes[i] != rep) {
- int next =classes[i];
- classes[i] = rep;
- i = next;
- }
- return rep;
-}
-
-void
-Union_find::connect(int i, int j)
-{
- i = find(i);
- j = find(j);
- classes[i] = j;
-}
+++ /dev/null
-#include "vector.hh"
-Vector::Vector(Array<Real> d)
- : dat(d)
-{
-
-}
-Vector::Vector(const Vector&n)
- : dat(n.dat)
-{
-}
-
-Vector
-Vector::operator-() const
-{
- Vector v(*this);
- v*=-1;
- return v;
-}
-
-void
-Vector::set_unit(int j)
-{
- fill(0.0);
- dat[j] = 1.0;
-}
--- /dev/null
+/*
+ libc-extension.cc -- compensate for lacking libc functions.
+
+
+ source file of the flowerlib
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+#include <stdarg.h>
+#include <string.h>
+#include <ctype.h>
+#include "libc-extension.hh"
+
+
+char*
+strnlwr( char* start_l ,int n)
+{
+ char * p = start_l + n;
+ while ( --p >= start_l) {
+ *p = tolower( *p ); /* a macro on some compilers */
+ }
+ return start_l;
+}
+
+char*
+strnupr( char* start_l, int n)
+{
+ char * p = start_l + n;
+ while ( --p >= start_l) {
+ *p = toupper( *p ); /* a macro on some compilers */
+ }
+ return start_l;
+}
+
+#if !HAVE_MEMMEM
+
+/** locate a substring. #memmem# finds the first occurrence of
+ #needle# in #haystack#
+ */
+
+char *
+memmem(Byte const * haystack, int haystack_len,
+ Byte const *needle,int needle_len)
+{
+ Byte const * end_haystack = haystack + haystack_len - needle_len;
+ Byte const * end_needle = needle + needle_len ;
+
+ /* Ahhh ... Some minimal lowlevel stuff. This *is* nice; Varation
+ is the spice of life */
+ while (haystack < end_haystack) {
+ Byte const *subneedle_l = needle;
+ Byte const *subhaystack_l = haystack;
+ while (subneedle_l < end_needle) {
+ if (*subneedle_l++ != *subhaystack_l++)
+ goto next; // yeah. I should be prosecuted.
+ }
+
+ // completed the needle. Gotcha.
+ return (char*) haystack;
+ next:
+ haystack++;
+ }
+ return 0;
+}
+#endif
+
+Byte *
+memrchr(Byte const * p, int n, char c)
+{
+ const Byte * q = p+n;
+ while (q > p) {
+ if (*--q == c)
+ return (Byte*)q;
+ }
+ return 0;
+}
+
+
+template<class T>
+inline void
+my_swap(T &t1, T &t2, T &tmp)
+{
+ tmp = t1;
+ t1 = t2;
+ t2 = tmp;
+}
+
+Byte*
+strrev( Byte* byte_l, int length_i )
+{
+ Byte tmp_byte;
+
+ Byte* left_l = byte_l;
+ Byte* right_l = byte_l + length_i;
+
+ while ( right_l > left_l ) {
+ my_swap(*right_l-- , *left_l++ , tmp_byte);
+ }
+ return byte_l;
+}
+
+#if ! HAVE_SNPRINTF
+int snprintf ( char *str, size_t,
+ char const *format, ... )
+{
+ va_list ap;
+ va_start(ap, format);
+ int i = vsprintf(str, format, ap);
+ va_end(ap);
+ return i;
+}
+#endif
--- /dev/null
+#include "dstream.hh"
+#include "matrix.hh"
+
+static Dstream *dout = 0;
+
+/**
+ Set the debugging output. Will not delete/swallow argument.
+ */
+void set_matrix_debug(Dstream&ds)
+{
+ dout = &ds;
+}
+
+Matrix::operator String() const
+{
+ String s;
+#ifndef NPRINT
+ s="matrix {\n";
+ for (int i=0; i< rows(); i++){
+ for (int j = 0; j < cols(); j++) {
+ s+= String(dat->elem(i,j), "%6f ");
+ }
+ s+="\n";
+ }
+ s+="}\n";
+#endif
+ return s;
+}
+
+
+void
+Matrix::print() const
+{
+#ifndef NPRINT
+ if (!dout)
+ return;
+ *dout << *this;
+#endif
+}
+
+Vector::operator String() const
+{
+ String s;
+#ifndef NPRINT
+ s="vector [";
+ for (int i=0; i < dim(); i++) {
+ s += String(dat[i], "%6f") + String(' ');
+ }
+ s+="]";
+#endif
+ return s;
+}
+
+
+void
+Vector::print() const
+{
+#ifndef NDEBUG
+ if (!dout)
+ return;
+ *dout << *this<<'\n';
+#endif
+}
--- /dev/null
+#include "matrix.hh"
+
+Real
+Matrix::norm() const
+{
+ Real r =0.0;
+ for (int i=0, j=0; dat->mult_ok(i,j); dat->mult_next(i,j))
+ r += sqr(dat->elem(i,j));
+ return sqrt(r);
+}
+
+void
+Matrix::fill(Real r)
+{
+ for (int i=0, j=0; dat->mult_ok(i,j); dat->mult_next(i,j))
+ dat->elem(i,j)=r;
+}
+
+void
+Matrix::set_diag(Real r)
+{
+ for (int i=0, j=0; dat->mult_ok(i,j); dat->mult_next(i,j))
+ dat->elem(i,j)=(i==j) ? r: 0.0;
+}
+
+void
+Matrix::set_diag(Vector d)
+{
+ for (int i=0, j=0; dat->mult_ok(i,j); dat->mult_next(i,j))
+ dat->elem(i,j)=(i==j) ? d(i): 0.0;
+}
+
+void
+Matrix::operator+=(Matrix const &m)
+{
+ assert(m.cols() == cols());
+ assert(m.rows() == rows());
+ for (int i=0, j=0; dat->mult_ok(i,j); dat->mult_next(i,j))
+ dat->elem(i,j) += m(i,j);
+}
+
+void
+Matrix::operator-=(Matrix const &m)
+{
+ assert(m.cols() == cols());
+ assert(m.rows() == rows());
+ for (int i=0, j=0; dat->mult_ok(i,j); dat->mult_next(i,j))
+ dat->elem(i,j) -= m(i,j);
+}
+
+
+void
+Matrix::operator*=(Real a)
+{
+ for (int i=0, j=0; dat->mult_ok(i,j); dat->mult_next(i,j))
+ dat->elem(i,j) *= a;
+}
+
+void
+Matrix::operator=(Matrix const &m)
+{
+ if (&m == this)
+ return ;
+ delete dat;
+ dat = m.dat->clone();
+}
+
+Matrix::Matrix(Matrix const &m)
+{
+ m.OK();
+
+ dat = m.dat->clone();
+}
+
+
+Matrix::Matrix(int n, int m)
+{
+ dat = virtual_smat::get_full(n,m);
+ fill(0);
+}
+
+Matrix::Matrix(int n)
+{
+ dat = virtual_smat::get_full(n,n);
+ fill(0);
+}
+
+Matrix::Matrix(Vector v, Vector w)
+{
+ dat = virtual_smat::get_full(v.dim(), w.dim());
+ for (int i=0, j=0; dat->mult_ok(i,j); dat->mult_next(i,j))
+ dat->elem(i,j)=v(i)*w(j);
+}
+
+
+Vector
+Matrix::row(int k) const
+{
+ int n=cols();
+
+
+ Vector v(n);
+ for(int i=0; i < n; i++)
+ v(i)=dat->elem(k,i);
+
+ return v;
+}
+
+Vector
+Matrix::col(int k) const
+{
+ int n=rows();
+ Vector v(n);
+ for(int i=0; i < n; i++)
+ v(i)=dat->elem(i,k);
+ return v;
+}
+
+Vector
+Matrix::left_multiply(Vector const & v) const
+{
+ Vector dest(v.dim());
+ assert(dat->cols()==v.dim());
+ for (int i=0, j=0; dat->mult_ok(i,j); dat->mult_next(i,j))
+ dest(i)+= dat->elem(j,i)*v(j);
+ return dest;
+}
+
+Vector
+Matrix::operator *(Vector const & v) const
+{
+ Vector dest(rows());
+ assert(dat->cols()==v.dim());
+ for (int i=0, j=0; dat->mult_ok(i,j); dat->mult_next(i,j))
+ dest(i)+= dat->elem(i,j)*v(j);
+ return dest;
+}
+
+Matrix
+operator /(Matrix const& m1,Real a)
+{
+ Matrix m(m1);
+ m /= a;
+ return m;
+}
+
+void
+Matrix::transpose() // delegate to storage?
+{
+ for (int i=0, j=0; dat->mult_ok(i,j); dat->mult_next(i,j)) {
+ if (i >= j)
+ continue;
+ Real r=dat->elem(i,j);
+ dat->elem(i,j) = dat->elem(j,i);
+ dat->elem(j,i)=r;
+ }
+}
+
+Matrix
+Matrix::operator-() const
+{
+ OK();
+ Matrix m(*this);
+ m*=-1.0;
+ return m;
+}
+
+Matrix
+Matrix::transposed() const
+{
+ Matrix m(*this);
+ m.transpose();
+ return m;
+}
+
+
+/* should do something smarter: bandmatrix * bandmatrix is also banded matrix. */
+Matrix
+operator *(Matrix const &m1, Matrix const &m2)
+{
+ Matrix result(m1.rows(), m2.cols());
+ result.set_product(m1,m2);
+ return result;
+}
+
+void
+Matrix::set_product(Matrix const &m1, Matrix const &m2)
+{
+ assert(m1.cols()==m2.rows());
+ assert(cols()==m2.cols() && rows()==m1.rows());
+
+ for (int i=0, j=0; dat->mult_ok(i,j);
+ dat->mult_next(i,j)) {
+ Real r=0.0;
+ for (int k = 0; k < m1.cols(); k++)
+ r += m1(i,k)*m2(k,j);
+ dat->elem(i,j)=r;
+ }
+}
+
+void
+Matrix::insert_row(Vector v, int k)
+{
+ assert(v.dim()==cols());
+ dat->insert_row(k);
+ for (int j=0; j < cols(); j++)
+ dat->elem(k,j)=v(j);
+}
+
+
+void
+Matrix::swap_columns(int c1, int c2)
+{
+ assert(c1>=0&& c1 < cols()&&c2 < cols() && c2 >=0);
+ for (int i=0; i< rows(); i++) {
+ Real r=dat->elem(i,c1);
+ dat->elem(i,c1) = dat->elem(i,c2);
+ dat->elem(i,c2)=r;
+ }
+}
+
+void
+Matrix::swap_rows(int c1, int c2)
+{
+ assert(c1>=0&& c1 < rows()&&c2 < rows() && c2 >=0);
+ for (int i=0; i< cols(); i++) {
+ Real r=dat->elem(c1,i);
+ dat->elem(c1,i) = dat->elem(c2,i);
+ dat->elem(c2,i)=r;
+ }
+}
+
+
+int
+Matrix::dim() const
+{
+ assert(cols() == rows());
+ return rows();
+}
+
--- /dev/null
+/*
+ path.cc - manipulation of paths and filenames.
+*/
+#include <stdio.h>
+#include "path.hh"
+
+#ifndef PATHSEP
+#define PATHSEP '/'
+#endif
+
+/**
+ @param path the original full filename
+ @return 4 components of the path. They can be empty
+*/
+void
+split_path(String path,
+ String &drive, String &dirs, String &filebase, String &extension)
+{
+ // peel off components, one by one.
+ int di = path.index_i(':');
+ if (di >= 0)
+ {
+ drive = path.left_str(di + 1);
+ path = path.right_str(path.len() - di -1);
+ }
+ else
+ drive = "";
+
+ di = path.index_last_i(PATHSEP);
+ if (di >=0)
+ {
+ dirs = path.left_str(di + 1);
+ path = path.right_str(path.len()-di -1);
+ }
+ else
+ dirs = "";
+
+ di = path.index_last_i('.');
+ if (di >= 0)
+ {
+ filebase = path.left_str(di);
+ extension =path.right_str(path.len()-di);
+ }
+ else
+ {
+ extension = "";
+ filebase = path;
+ }
+}
+
+File_path::File_path(String pref)
+{
+ add(".");
+ add(pref);
+}
+
+
+/** find a file.
+ It will search in the current dir, in the construction-arg, and
+ in any other added path, in this order.
+ */
+String
+File_path::find(String nm)
+{
+ for (int i=0; i < size(); i++) {
+ String path = (*this)[i];
+ path+= "/"+nm;
+
+
+ FILE *f = fopen(path, "r"); // ugh!
+ if (f) {
+ fclose(f);
+ return path;
+ }
+ }
+ return "";
+}
--- /dev/null
+#include <assert.h>
+#include <stdio.h>
+#include "scalar.hh"
+
+Scalar::Scalar(Rational r)
+ :String(r)
+{
+
+}
+
+Scalar::operator Rational()
+{
+ int p = index_i('/');
+ if (p == -1)
+ return int(*this);
+
+ String s2 = right_str(len()-p-1);
+ String s1 = left_str(p);
+
+ return Rational(s1.value_i(), s2.value_i());
+}
+
+bool
+Scalar::isnum()
+{
+ int conv = false;
+ if (len()) {
+ long l =0;
+ conv = sscanf(strh_.ch_c_l(), "%ld", &l);
+ }
+ return len() && conv;
+}
+
+Scalar::operator Real()
+{
+ assert (isnum());
+ return value_f();
+}
+
+Scalar::operator int()
+{
+ assert (isnum());
+ return value_i();
+}
+
+
+Scalar::operator bool() const
+{
+ if (!len())
+ return false;
+ if (*this == "0")
+ return false;
+ String u (*this);
+ if ( u.upper_str() == "FALSE")
+ return false;
+ return true;
+}
--- /dev/null
+#include "smat.hh"
+
+void
+Full_storage::operator=(Full_storage const &fs)
+{
+ resize(fs.h, fs.w);
+ OK();
+ fs.OK();
+ for (int i=0; i<h; i++)
+ for (int j=0; j<w; j++)
+ els[i][j]= fs.els[i][j];
+}
+
+void
+Full_storage::OK() const
+{
+#ifndef NDEBUG
+ // static Real dummy;
+ assert(maxh >= h && maxw >= w);
+ assert(h >= 0 && w >= 0);
+ assert(els||!maxh);
+#endif
+}
+void
+Full_storage::resize_cols(int newh)
+{
+ if (newh <= maxh) {
+ h=newh;
+ return;
+ }
+
+ Real ** newa=new Real*[newh];
+ int j=0;
+ for (; j < h; j++)
+ newa[j] = els[j];
+ for (; j < newh; j++)
+ newa[j] = new Real[maxw];
+ delete[] els;
+ els=newa;
+
+ h = maxh = newh;
+}
+
+void
+Full_storage::resize_rows(int neww)
+{
+ if (neww <= maxw) {
+ w=neww;
+ return;
+ }
+ for (int i=0; i < maxh ; i++) {
+ Real* newa = new Real[neww];
+ for (int k=0; k < w; k++)
+ newa[k] = els[i][k];
+
+ delete[] els[i];
+ els[i] = newa;
+ }
+ w = maxw = neww;
+}
+
+Full_storage::~Full_storage() {
+ for (int i=0; i < maxh; i++)
+ delete [] els[i];
+ delete[] els;
+}
+
+void
+Full_storage::resize(int rows, int cols)
+{
+ OK();
+ resize_cols(rows);
+ resize_rows(cols);
+
+}
+
+
+bool
+Full_storage::mult_ok(int i, int j) const
+{
+ return valid(i,j);
+}
+
+bool
+Full_storage::trans_ok(int i, int j) const
+{
+ return valid(i,j);
+}
+
+
+void
+Full_storage::trans_next(int &i, int &j) const
+{
+ assert(trans_ok(i,j));
+ i++;
+ if (i >= h) {
+ i=0;
+ j ++;
+ }
+}
+
+void
+Full_storage::mult_next(int &i, int &j) const
+{
+ assert(mult_ok(i,j));
+ j++;
+ if (j >= w) {
+ j=0;
+ i++;
+ }
+}
+
+void
+Full_storage::delete_column(int k)
+{
+ assert(0 <= k &&k<w);
+ for (int i=0; i< h ; i++)
+ for (int j=k+1; j <w; j++)
+ els[i][j-1]=els[i][j];
+ w--;
+}
+void
+Full_storage::delete_row(int k)
+{
+ assert(0 <= k &&k<h);
+ for (int i=k+1; i < h ; i++)
+ for (int j=0; j < w; j++)
+ els[i-1][j]=els[i][j];
+ h--;
+}
+
+
+void
+Full_storage::insert_row(int k)
+{
+ assert(0 <= k&& k <=h);
+ resize_cols(h+1);
+ for (int i=h-1; i > k ; i--)
+ for (int j=0; j <w; j++)
+ els[i][j]=els[i-1][j];
+
+}
+
+
+Array<Real>
+Full_storage::row(int n) const
+{
+ Array<Real> r;
+ for (int j = 0; j < w; j++)
+ r.push(els[n][j]);
+ return r;
+}
+
+Array<Real>
+Full_storage::column(int n) const
+{
+
+ Array<Real> r;
+ for (int i = 0; i<h; i++)
+ r.push(els[i][n]);
+ return r;
+}
+
+
+Full_storage::Full_storage(Full_storage&s)
+{
+ init();
+ (*this) = s;
+}
+virtual_smat*
+Full_storage::clone()
+{
+ return new Full_storage(*this);
+}
+
+
+virtual_smat *
+virtual_smat::get_full(int n, int m)
+{
+ return new Full_storage(n,m);
+}
--- /dev/null
+/*
+ PROJECT: FlowerSoft C++ library
+ FILE : string-convert.cc
+
+--*/
+
+
+#include <assert.h>
+#include <limits.h>
+#include "libc-extension.hh"
+#include "string.hh"
+#include "string-convert.hh"
+
+/**
+ a safe length for stringconversion buffers
+
+ worst case would be %f printing HUGE (or 1/HUGE), which is approx
+ 2e318, this number would have approx 318 zero's in its string.
+
+ Should enlarge buff dynamically.
+ @see
+ man 3 snprintf
+ */
+static const int STRING_BUFFER_LEN=1024;
+
+String
+String_convert::bin2hex_str( String bin_str )
+{
+ String str;
+ Byte const* byte_c_l = bin_str.byte_c_l();
+ for ( int i = 0; i < bin_str.length_i(); i++ ) {
+ str += (char)nibble2hex_byte( *byte_c_l >> 4 );
+ str += (char)nibble2hex_byte( *byte_c_l++ );
+ }
+ return str;
+}
+
+int
+String_convert::bin2_i( String bin_str )
+{
+ assert( bin_str.length_i() <= 4 );
+
+ int result_i = 0;
+ for ( int i = 0; i < bin_str.length_i(); i++ ) {
+ result_i <<= 8;
+ result_i += (Byte)bin_str[ i ];
+ }
+ return result_i;
+}
+
+// breendet imp from String
+int
+String_convert::dec2_i( String dec_str )
+{
+ if ( !dec_str.length_i() )
+ return 0;
+
+ long l = 0;
+ int conv = sscanf( dec_str.ch_c_l(), "%ld", &l );
+ assert( conv );
+
+ return (int)l;
+}
+
+String
+String_convert::i64_str( I64 i64, char const* fmt)
+{
+ char buffer[STRING_BUFFER_LEN];
+ snprintf(buffer, STRING_BUFFER_LEN,
+ (fmt ? fmt : "%Ld"), i64 ); // assume radix 10
+ return String(buffer);
+
+}
+// breendet imp from String
+double
+String_convert::dec2_f( String dec_str )
+{
+ if ( !dec_str.length_i() )
+ return 0;
+ double d = 0;
+ int conv = sscanf( dec_str.ch_c_l(), "%lf", &d );
+ assert( conv );
+ return d;
+}
+
+int
+String_convert::hex2bin_i( String hex_str, String& bin_str_r )
+{
+ if ( hex_str.length_i() % 2 )
+ hex_str = "0" + hex_str;
+
+ bin_str_r = "";
+ Byte const* byte_c_l= hex_str.byte_c_l();
+ int i = 0;
+ while ( i < hex_str.length_i() ) {
+ int high_i = hex2nibble_i( *byte_c_l++ );
+ int low_i = hex2nibble_i( *byte_c_l++ );
+ if ( high_i < 0 || low_i < 0 )
+ return 1; // illegal char
+ bin_str_r += String( (char)( high_i << 4 | low_i ), 1 );
+ i += 2;
+ }
+ return 0;
+}
+
+String
+String_convert::hex2bin_str( String hex_str )
+{
+ String str;
+// silly, asserts should alway be "on"!
+// assert( !hex2bin_i( hex_str, str ) );
+ int error_i = hex2bin_i( hex_str, str );
+ assert( !error_i );
+ return str;
+}
+
+int
+String_convert::hex2nibble_i( Byte byte )
+{
+ if ( byte >= '0' && byte <= '9' )
+ return byte - '0';
+ if ( byte >= 'A' && byte <= 'F' )
+ return byte - 'A' + 10;
+ if ( byte >= 'a' && byte <= 'f')
+ return byte - 'a' + 10;
+ return -1;
+}
+
+// stupido. Should use int_str()
+String
+String_convert::i2dec_str( int i, int length_i, char ch )
+{
+ char fill_ch = ch;
+ if ( fill_ch)
+ fill_ch = '0';
+
+ // ugh
+ String dec_str( i );
+
+ // ugh
+ return String( fill_ch, length_i - dec_str.length_i() ) + dec_str;
+}
+
+
+// stupido. Should use int_str()
+String
+String_convert::u2hex_str( unsigned u, int length_i, char fill_ch )
+{
+ String str;
+ if ( !u )
+ str = "0";
+
+#if 1 // both go...
+ while ( u ) {
+ str = String( (char)( ( u % 16 )["0123456789abcdef"] ) ) + str;
+ u /= 16;
+ }
+#else
+ str += int_str( u, "%x" );
+#endif
+
+ str = String( fill_ch, length_i - str.length_i() ) + str;
+ while ( ( str.length_i() > length_i ) && ( str[ 0 ] == 'f' ) )
+ str = str.mid_str( 2, INT_MAX );
+
+ return str;
+}
+
+String
+String_convert::i2hex_str( int i, int length_i, char fill_ch )
+{
+ return u2hex_str( (unsigned)i, length_i, fill_ch );
+}
+
+Byte
+String_convert::nibble2hex_byte( Byte byte )
+{
+ if ( ( byte & 0x0f ) <= 9 )
+ return ( byte & 0x0f ) + '0';
+ else
+ return ( byte & 0x0f ) - 10 + 'a';
+}
+/**
+ Convert an integer to a string
+
+ @param
+ #fmt# is a printf style format, default assumes "%d" as format.
+ */
+String
+String_convert::int_str(int i, char const* fmt)
+{
+ char buffer[STRING_BUFFER_LEN];
+ snprintf(buffer, STRING_BUFFER_LEN,
+ (fmt ? fmt : "%d"), i ); // assume radix 10
+ return String(buffer);
+}
+
+/**
+ Convert a double to a string.
+
+ @param #fmt# is a printf style format, default assumes "%lf" as format
+ */
+String
+String_convert::double_str(double f, char const* fmt)
+{
+ char buf[STRING_BUFFER_LEN];
+
+ snprintf(buf, STRING_BUFFER_LEN, fmt ? fmt : "%f", f);
+ return buf;
+}
+
+/**
+ Make a string from a single character.
+
+ @param
+ #n# is a repetition count, default value is 1
+ */
+String
+String_convert::char_str(char c, int n)
+{
+ n = n >= 0 ? n : 0;
+ char* ch_p = new char[ n ];
+ memset( ch_p, c, n );
+ String s((Byte*)ch_p, n);
+ delete ch_p;
+ return s;
+}
+
+String
+String_convert::rational_str(Rational r)
+{
+ char * n = Itoa(r.numerator()); // LEAK????
+
+ String s = n;
+ if (r.denominator() != 1) {
+ char * d = Itoa(r.denominator());
+ s += String( '/' ) + String(d);
+ //delete d;
+ }
+/* delete n;
+ */
+ return s;
+}
+
+String
+String_convert::pointer_str(void const *l)
+{
+ I64 i64 = (I64)l;
+ return String_convert::i64_str(i64, "0x%0Lx");
+}
--- /dev/null
+#ifdef STRING_TEST
+/*
+ stupid test program to verify stringlib
+ stringtest.cc
+ */
+#include <iostream.h>
+#include "string.hh"
+#include "varray.hh"
+#include "string-convert.hh"
+
+void
+ctors()
+{
+ cout << "constructors"<<endl;
+
+ String str( "hai" );
+ String def;
+ String fromi(10);
+ String fromc('c');
+ String fromf(1.32e-2, "%g");
+
+ cout << str << endl;
+ cout << def << endl;
+ cout << fromi<< endl;
+ cout << fromc<< endl;
+ cout << fromf<< endl;
+}
+
+void
+cmp()
+{
+ Array<String> a;
+ a.push("abcd");
+ a.push("zxy");
+ a.push("abc");
+ a.push("");
+ a.sort(String::compare_i);
+ cout << "compares: "<<endl;
+ for (int i=0; i < a.size(); i++)
+ cout << a[i] << endl;
+}
+
+
+void
+searching()
+{
+ String hay = "foobarbazblub";
+
+ char c = 'b';
+ String cstr =c;
+ String set = "bar";
+ cout << "hay = \"" << hay << "\" len="<< hay.length_i()<<endl;
+ cout << "index_i('"<< c<<"') " << c << "= " << hay.index_i(c) <<endl;
+ cout << "last_index_i('"<< c<<"') " << c << "= " << hay.index_last_i(c) <<endl;
+// cout << "last index of cstr " << c << ": " << hay.index_last_i(cstr) <<endl;
+// cout << "index_last_i(\""<<set<<"\"): " << hay.index_last_i(set) <<endl;
+ cout << "index_i(\""<<set<<"\"): " << hay.index_i(set) <<endl;
+ cout << "index_any(\"" << set << "\"): " << cstr << ": " << hay.index_any_i(cstr) <<endl;
+
+
+
+}
+
+
+void
+kutenpeer()
+{
+ String str( "hai" );
+ for (int i=-1; i < str.length_i()+2; i++) {
+ cout<<" left_str(" << i<<"): " << str.left_str( i ) << endl;
+ cout<<" right_str( "<<i<<"): " << str.right_str( i ) << endl;
+ }
+ str = "blonde haren";
+ cout << str<<endl;
+ cout << "mid(2,6)="<<str.mid_str(2,3)<<endl;
+ cout << "nomid(2,6)="<<str.nomid_str(2,3)<<endl;
+}
+
+int
+main()
+{
+ ctors();
+ cmp();
+ searching();
+ kutenpeer();
+ String str( "hai" );
+ cout << str << endl;
+ cout << "left" << endl;
+ str += " daar";
+ cout << str << endl;
+
+ str = String( "Hallo" ) + " daaR" + '!';
+ cout << str << endl;
+
+ cout << "up: " << str.upper_str() << " down: " << str.lower_str()<<endl;
+
+ if ( str == String( "" ) )
+ cout << str << " is empty" << endl;
+ else
+ cout << str << " is not empty"<<endl;
+
+
+ String fn = "";
+ if ( fn == "" )
+ cout << fn << " is empty" << endl;
+ else
+ assert(false);
+
+ fn = "";
+ fn += "";
+ delete fn.copy_byte_p();
+ delete str.copy_byte_p();
+
+ cout << String_convert::bin2hex_str( String( (char)0xff ) ) << endl;
+}
+
+#endif STRING_TEST
+
--- /dev/null
+/*
+ stringutil.cc -- generate non-inline members.
+
+ source file of the LilyPond music typesetter
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
+#ifdef STRING_DEBUG
+#include <sys/types.h>
+#include <memory.h>
+void*
+mymemmove( void* dest, void const* src, size_t n )
+{
+ return memcpy( dest, src, n ); // wohltempererit: 69006
+}
+#define memmove mymemmove
+#endif
+
+#ifdef STRING_UTILS_INLINED
+#undef STRING_UTILS_INLINED
+#endif
+
+#ifdef INLINE
+#undef INLINE
+#endif
+
+#define INLINE
+
+#include "string-handle.hh"
+#include "string-data.hh"
+#include "string-data.inl"
+#include "string-handle.inl"
# include ./$(depth)/$(NAME)/.version
MODULE_NAME = flower
include ./$(depth)/flower/.version
-build = ./$(depth)/flower/test/$(outdir)/.build
+
#
# generic variables:
#
-include ./$(depth)/make/Variables.make
+include ./$(depth)/make/Variables.make
+include ./$(depth)/make/Files.make
#
# descent order into subdirectories:
# module compile settings: (not generally needed!
#
EXTRA_CFLAGS = -DSTRING_TEST
-EXTRA_CXXFLAGS =
-EXTRA_LDFLAGS =
-#
-
-# list of c++ header files:
-#
-# HHFILES = $(shell ls *.hh $(ERROR_LOG))
-#
-
-# list of c++ source files:
-#
-CCFILES = $(shell ls *.cc $(ERROR_LOG))
#
-# list of other source files:
-#
-EXTRA_SOURCE_FILES = $(shell ls *.y *.l $(ERROR_LOG))
-#
# list of distribution files:
#
-DISTFILES = Makefile $(HHFILES) $(CCFILES) $(EXTRA_SOURCE_FILES)
-#
+EXTRA_DISTFILES = result
# list of custom libraries:
#
#default: $(MAINTARGET)
BUILDSTRINGTEST=$(MAINTARGET)
EXECSTRINGTEST=$(EXECUTABLE)
+
default: $(BUILDSTRINGTEST) do-stringtest
do-stringtest:
- $(EXECSTRINGTEST) # should cmp with a 'standard result'
+ $(EXECSTRINGTEST) > $(outdir)/result # should cmp with a 'standard result'
+ cmp $(outdir)/result result
dummy:
# list of depend files:
#
-DEPFILES = $(shell ls $(depdir)/*.dep $(ERROR_LOG))
+DEPFILES = $(wildcard $(depdir)/*.dep )
#
# auto dependencies:
--- /dev/null
+constructors
+hai
+
+10
+c
+0.0132
+compares:
+
+abc
+abcd
+zxy
+hay = "foobarbazblub" len=13
+index_i('b') b= 3
+last_index_i('b') b= 12
+index_i("bar"): 3
+index_any("bar"): b: 3
+ left_str(-1):
+ right_str( -1):
+ left_str(0):
+ right_str( 0):
+ left_str(1): h
+ right_str( 1): i
+ left_str(2): ha
+ right_str( 2): ai
+ left_str(3): hai
+ right_str( 3): hai
+ left_str(4): hai
+ right_str( 4): hai
+blonde haren
+mid(2,6)=onde h
+nomid(2,6)=blaren
+hai
+left
+hai daar
+Hallo daaR!
+up: HALLO DAAR! down: hallo daar!
+`Hallo daaR!' is not empty
+`' is empty
+ff
+-1:ff
--- /dev/null
+#include "text-db.hh"
+bool
+Text_db::eof()
+{
+ Data_file::gobble_leading_white();
+ return Data_file::eof();
+}
+
+void
+Text_db::gobble_leading_white()
+{
+ while (1) {
+ Data_file::gobble_leading_white();
+ if (eof())
+ return ;
+ char c;
+ if ((c = data_get()) !='\n'){
+ data_unget (c);
+ return ;
+ }
+ }
+}
+
+
+Text_record
+Text_db::get_record()
+{
+ while (1) {
+ String s;
+ Array<String> fields;
+ assert(!eof());
+
+ while ((s = get_word()) != "")
+ {
+ fields.push(s);
+ gobble_white();
+ }
+
+
+ if (get_line() != "")
+ assert(false);
+
+ assert (fields.size());
+ return Text_record(fields, get_name(), line());
+ }
+}
+
+
--- /dev/null
+#include "text-stream.hh"
+
+Text_stream::Text_stream(String fn)
+{
+ ios::sync_with_stdio();
+ if (fn == "")
+ {
+ name = "<STDIN>";
+ f = stdin;
+ }
+
+ else
+ {
+ name = fn;
+ f = fopen(fn, "r");
+ }
+
+ if (!f) {
+ cerr <<__FUNCTION__<< ": can't open `" << fn << "'\n";
+ exit(1);
+ }
+
+ line_no = 1;
+ }
+
+void
+Text_stream::message(String s)
+{
+ cerr << "\n"<<get_name() << ": " << line()<<": "<<s<<endl;
+}
+
--- /dev/null
+#include "unionfind.hh"
+/*
+ see a book on data structures
+ */
+
+Union_find::Union_find(int n)
+{
+ classes.set_size(n);
+
+ for (int i=0; i < n; i++) {
+ classes[i] = i;
+ }
+}
+
+int
+Union_find::find(int i)
+{
+ int rep = i;
+ while (classes[rep] != rep)
+ rep = classes[rep];
+ while (classes[i] != rep) {
+ int next =classes[i];
+ classes[i] = rep;
+ i = next;
+ }
+ return rep;
+}
+
+void
+Union_find::connect(int i, int j)
+{
+ i = find(i);
+ j = find(j);
+ classes[i] = j;
+}
--- /dev/null
+#include "vector.hh"
+Vector::Vector(Array<Real> d)
+ : dat(d)
+{
+
+}
+Vector::Vector(Vector const &n)
+ : dat(n.dat)
+{
+}
+
+Vector
+Vector::operator-() const
+{
+ Vector v(*this);
+ v*=-1;
+ return v;
+}
+
+void
+Vector::set_unit(int j)
+{
+ fill(0.0);
+ dat[j] = 1.0;
+}
# init/Makefile
+
# subdir level:
#
depth = ..
# generic stuff/Makefile
#
-include ./$(depth)/make/Stuff.make
+include ./$(depth)/make/Include.make
#
# list of distribution files:
#
-INIFILES = $(shell ls *.ini)
+INIFILES = $(wildcard *.ini)
DISTFILES = Makefile $(INIFILES)
#
% common dutch names for notes. "es" means flat, "is" means sharp
%
-ceses = melodic { 0 0 -2 0 }
-ces = melodic { 0 0 -1 0 }
-c = melodic { 0 0 0 0 }
-cis = melodic { 0 0 1 0 }
-cisis = melodic { 0 0 2 0 }
-deses = melodic { 0 1 -2 0 }
-des = melodic { 0 1 -1 0 }
-d = melodic { 0 1 0 0 }
-dis = melodic { 0 1 1 0 }
-disis = melodic { 0 1 2 0 }
-eses = melodic { 0 2 -2 0 }
-es = melodic { 0 2 -1 0 }
-e = melodic { 0 2 0 0 }
-eis = melodic { 0 2 1 0 }
-eisis = melodic { 0 2 2 0 }
-feses = melodic { 0 3 -2 0 }
-fes = melodic { 0 3 -1 0 }
-f = melodic { 0 3 0 0 }
-fis = melodic { 0 3 1 0 }
-fisis = melodic { 0 3 2 0 }
-geses = melodic { 0 4 -2 0 }
-ges = melodic { 0 4 -1 0 }
-g = melodic { 0 4 0 0 }
-gis = melodic { 0 4 1 0 }
-gisis = melodic { 0 4 2 0 }
-ases = melodic { 0 5 -2 0 }
-as = melodic { 0 5 -1 0 }
-a = melodic { 0 5 0 0 }
-ais = melodic { 0 5 1 0 }
-aisis = melodic { 0 5 2 0 }
-beses = melodic { 0 6 -2 0 }
-bes = melodic { 0 6 -1 0 }
-b = melodic { 0 6 0 0 }
-bis = melodic { 0 6 1 0 }
-bisis = melodic { 0 6 2 0 }
+ceses = \melodic { 0 0 -2 }
+ces = \melodic { 0 0 -1 }
+c = \melodic { 0 0 0 }
+cis = \melodic { 0 0 1 }
+cisis = \melodic { 0 0 2 }
+deses = \melodic { 0 1 -2 }
+des = \melodic { 0 1 -1 }
+d = \melodic { 0 1 0 }
+dis = \melodic { 0 1 1 }
+disis = \melodic { 0 1 2 }
+eses = \melodic { 0 2 -2 }
+es = \melodic { 0 2 -1 }
+e = \melodic { 0 2 0 }
+eis = \melodic { 0 2 1 }
+eisis = \melodic { 0 2 2 }
+feses = \melodic { 0 3 -2 }
+fes = \melodic { 0 3 -1 }
+f = \melodic { 0 3 0 }
+fis = \melodic { 0 3 1 }
+fisis = \melodic { 0 3 2 }
+geses = \melodic { 0 4 -2 }
+ges = \melodic { 0 4 -1 }
+g = \melodic { 0 4 0 }
+gis = \melodic { 0 4 1 }
+gisis = \melodic { 0 4 2 }
+ases = \melodic { 0 5 -2 }
+as = \melodic { 0 5 -1 }
+a = \melodic { 0 5 0 }
+ais = \melodic { 0 5 1 }
+aisis = \melodic { 0 5 2 }
+beses = \melodic { 0 6 -2 }
+bes = \melodic { 0 6 -1 }
+b = \melodic { 0 6 0 }
+bis = \melodic { 0 6 1 }
+bisis = \melodic { 0 6 2 }
%
%
-Ceses = melodic { -1 0 -2 0 }
-Ces = melodic { -1 0 -1 0 }
-C = melodic { -1 0 0 0 }
-Cis = melodic { -1 0 1 0 }
-Cisis = melodic { -1 0 2 0 }
-Deses = melodic { -1 1 -2 0 }
-Des = melodic { -1 1 -1 0 }
-D = melodic { -1 1 0 0 }
-Dis = melodic { -1 1 1 0 }
-Disis = melodic { -1 1 2 0 }
-Eses = melodic { -1 2 -2 0 }
-Es = melodic { -1 2 -1 0 }
-E = melodic { -1 2 0 0 }
-Eis = melodic { -1 2 1 0 }
-Eisis = melodic { -1 2 2 0 }
-Feses = melodic { -1 3 -2 0 }
-Fes = melodic { -1 3 -1 0 }
-F = melodic { -1 3 0 0 }
-Fis = melodic { -1 3 1 0 }
-Fisis = melodic { -1 3 2 0 }
-Geses = melodic { -1 4 -2 0 }
-Ges = melodic { -1 4 -1 0 }
-G = melodic { -1 4 0 0 }
-Gis = melodic { -1 4 1 0 }
-Gisis = melodic { -1 4 2 0 }
-Ases = melodic { -1 5 -2 0 }
-As = melodic { -1 5 -1 0 }
-A = melodic { -1 5 0 0 }
-Ais = melodic { -1 5 1 0 }
-Aisis = melodic { -1 5 2 0 }
-Beses = melodic { -1 6 -2 0 }
-Bes = melodic { -1 6 -1 0 }
-B = melodic { -1 6 0 0 }
-Bis = melodic { -1 6 1 0 }
-Bisis = melodic { -1 6 2 0 }
+Ceses = \melodic { -1 0 -2 }
+Ces = \melodic { -1 0 -1 }
+C = \melodic { -1 0 0 }
+Cis = \melodic { -1 0 1 }
+Cisis = \melodic { -1 0 2 }
+Deses = \melodic { -1 1 -2 }
+Des = \melodic { -1 1 -1 }
+D = \melodic { -1 1 0 }
+Dis = \melodic { -1 1 1 }
+Disis = \melodic { -1 1 2 }
+Eses = \melodic { -1 2 -2 }
+Es = \melodic { -1 2 -1 }
+E = \melodic { -1 2 0 }
+Eis = \melodic { -1 2 1 }
+Eisis = \melodic { -1 2 2 }
+Feses = \melodic { -1 3 -2 }
+Fes = \melodic { -1 3 -1 }
+F = \melodic { -1 3 0 }
+Fis = \melodic { -1 3 1 }
+Fisis = \melodic { -1 3 2 }
+Geses = \melodic { -1 4 -2 }
+Ges = \melodic { -1 4 -1 }
+G = \melodic { -1 4 0 }
+Gis = \melodic { -1 4 1 }
+Gisis = \melodic { -1 4 2 }
+Ases = \melodic { -1 5 -2 }
+As = \melodic { -1 5 -1 }
+A = \melodic { -1 5 0 }
+Ais = \melodic { -1 5 1 }
+Aisis = \melodic { -1 5 2 }
+Beses = \melodic { -1 6 -2 }
+Bes = \melodic { -1 6 -1 }
+B = \melodic { -1 6 0 }
+Bis = \melodic { -1 6 1 }
+Bisis = \melodic { -1 6 2 }
-ppp = dynamic {7 }
-pp = dynamic { 6 }
-p = dynamic { 5 }
-mp = dynamic { 4 }
-mf = dynamic { 3 }
-df = dynamic { 2 } % f is a notename too.
-ff = dynamic { 1 }
-fff = dynamic { 0 }
+ppp = \dynamic {7 }
+pp = \dynamic { 6 }
+p = \dynamic { 5 }
+mp = \dynamic { 4 }
+mf = \dynamic { 3 }
+df = \dynamic { 2 } % f is a notename too.
+ff = \dynamic { 1 }
+fff = \dynamic { 0 }
-% name = script {
+% name = \script {
% indexstring same_dir_as_stem above_below_staff symbol_can_beinverted }
%
-accent = script { "sforzato" -1 0 0 }
-marcato = script { "marcato" -1 0 1 }
-staccatissimo = script { "staccatissimo" -1 0 1 }
-portato= script { "portato" -1 0 1 }
-fermata = script { "fermata" 1 0 1 }
-stopped = script { "stopped" 0 1 0 }
-staccato = script { "staccato" -1 0 0 }
-tenuto = script {"tenuto" -1 0 0 }
-portato = script { "portato" -1 0 0 }
-upbow = script { "upbow" 0 1 0 }
-downbow = script { "downbow" 0 1 0 }
+accent = \script { "sforzato" -1 0 0 }
+marcato = \script { "marcato" -1 0 1 }
+staccatissimo = \script { "staccatissimo" -1 0 1 }
+portato= \script { "portato" -1 0 1 }
+fermata = \script { "fermata" 1 0 1 }
+stopped = \script { "stopped" 0 1 0 }
+staccato = \script { "staccato" -1 0 0 }
+tenuto = \script {"tenuto" -1 0 0 }
+upbow = \script { "upbow" 0 1 0 }
+downbow = \script { "downbow" 0 1 0 }
% by Mats Bengtsson.
-cessess = melodic { 0 0 -2 0 }
-cess = melodic { 0 0 -1 0 }
-c = melodic { 0 0 0 0 }
-ciss = melodic { 0 0 1 0 }
-cississ = melodic { 0 0 2 0 }
-dessess = melodic { 0 1 -2 0 }
-dess = melodic { 0 1 -1 0 }
-d = melodic { 0 1 0 0 }
-diss = melodic { 0 1 1 0 }
-dississ = melodic { 0 1 2 0 }
-essess = melodic { 0 2 -2 0 }
-ess = melodic { 0 2 -1 0 }
-e = melodic { 0 2 0 0 }
-eiss = melodic { 0 2 1 0 }
-eississ = melodic { 0 2 2 0 }
-fessess = melodic { 0 3 -2 0 }
-fess = melodic { 0 3 -1 0 }
-f = melodic { 0 3 0 0 }
-fiss = melodic { 0 3 1 0 }
-fississ = melodic { 0 3 2 0 }
-gessess = melodic { 0 4 -2 0 }
-gess = melodic { 0 4 -1 0 }
-g = melodic { 0 4 0 0 }
-giss = melodic { 0 4 1 0 }
-gississ = melodic { 0 4 2 0 }
-assess = melodic { 0 5 -2 0 }
-ass = melodic { 0 5 -1 0 }
-a = melodic { 0 5 0 0 }
-aiss = melodic { 0 5 1 0 }
-aississ = melodic { 0 5 2 0 }
-hessess = melodic { 0 6 -2 0 }
-b = melodic { 0 6 -1 0 }
-h = melodic { 0 6 0 0 }
-hiss = melodic { 0 6 1 0 }
-hississ = melodic { 0 6 2 0 }
+cessess = \melodic { 0 0 -2 }
+cess = \melodic { 0 0 -1 }
+c = \melodic { 0 0 0 }
+ciss = \melodic { 0 0 1 }
+cississ = \melodic { 0 0 2 }
+dessess = \melodic { 0 1 -2 }
+dess = \melodic { 0 1 -1 }
+d = \melodic { 0 1 0 }
+diss = \melodic { 0 1 1 }
+dississ = \melodic { 0 1 2 }
+essess = \melodic { 0 2 -2 }
+ess = \melodic { 0 2 -1 }
+e = \melodic { 0 2 0 }
+eiss = \melodic { 0 2 1 }
+eississ = \melodic { 0 2 2 }
+fessess = \melodic { 0 3 -2 }
+fess = \melodic { 0 3 -1 }
+f = \melodic { 0 3 0 }
+fiss = \melodic { 0 3 1 }
+fississ = \melodic { 0 3 2 }
+gessess = \melodic { 0 4 -2 }
+gess = \melodic { 0 4 -1 }
+g = \melodic { 0 4 0 }
+giss = \melodic { 0 4 1 }
+gississ = \melodic { 0 4 2 }
+assess = \melodic { 0 5 -2 }
+ass = \melodic { 0 5 -1 }
+a = \melodic { 0 5 0 }
+aiss = \melodic { 0 5 1 }
+aississ = \melodic { 0 5 2 }
+hessess = \melodic { 0 6 -2 }
+b = \melodic { 0 6 -1 }
+h = \melodic { 0 6 0 }
+hiss = \melodic { 0 6 1 }
+hississ = \melodic { 0 6 2 }
include "dynamic.ini"
-include "dutch.ini" # do not include init/ path
+include "dutch.ini" % do not include init/ path
include "script.ini"
include "table_sixteen.ini"
% It has a lot of hard-wired stringconstants
%
-table_sixteen=
-symboltables {
+tablesixteen=
+\symboltables {
- texid "\musixsixteendefs"
+ \texid "\musixsixteendefs"
% index TeXstring, xmin xmax ymin ymax
- "scripts" = table {
- "fermata" "\fermata" 0pt 0pt 0pt 6pt
- "-fermata" "\ifermata" 0pt 0pt -6pt 0pt
+ "scripts" = \table {
+ "fermata" "\fermata" 0\pt 0\pt 0\pt 6\pt
+ "-fermata" "\ifermata" 0\pt 0\pt -6\pt 0\pt
"portato" "\portato"
"-portato" "\iportato"
"tenuto" "\tenuto"
"-tenuto" "\itenuto"
- "sforzato" "\sforzato" -0.8pt 4.8pt -1.92pt 1.92pt
- "marcato" "\marcato" 0pt 4.8pt 0pt 4pt
- "-marcato" "\imarcato" 0pt 4.8pt -4pt 0pt
- "staccato" "\staccato" 0pt 0pt 0pt 5pt
- "staccatissimo" "\staccatissimo" 0pt 0pt 0pt 7.5pt
- "-staccatissimo" "\istaccatissimo" 0pt 0pt -7.5pt 0pt
- "upbow" "\upbow" -1pt 6pt 0pt 5pt
- "downbow" "\downbow" 0pt 5pt 0pt 7.5pt
+ "sforzato" "\sforzato" -0.8\pt 4.8\pt -1.92\pt 1.92\pt
+ "marcato" "\marcato" 0\pt 4.8\pt 0\pt 4\pt
+ "-marcato" "\imarcato" 0\pt 4.8\pt -4\pt 0\pt
+ "staccato" "\staccato" 0\pt 0\pt 0\pt 5\pt
+ "staccatissimo" "\staccatissimo" 0\pt 0\pt 0\pt 7.5\pt
+ "-staccatissimo" "\istaccatissimo" 0\pt 0\pt -7.5\pt 0\pt
+ "upbow" "\upbow" -1\pt 6\pt 0\pt 5\pt
+ "downbow" "\downbow" 0\pt 5\pt 0\pt 7.5\pt
}
- "style" = table {
- "roman" "\settext{%}" 0pt 0pt 0pt 8pt
- "italic" "\setitalic{%}" 0pt 0pt 0pt 8pt
- "dynamic" "\setdynamic{%}" 0pt 0pt 0pt 8pt
+ "style" = \table {
+ "roman" "\settext{%}" 0\pt 0\pt 0\pt 8\pt
+ "italic" "\setitalic{%}" 0\pt 0\pt 0\pt 8\pt
+ "dynamic" "\setdynamic{%}" 0\pt 0\pt 0\pt 8\pt
}
- "dynamics" = table {
+ "dynamics" = \table {
"mf" "\dynmf"
"fff" "\dynfff"
"ppp" "\dynppp"
}
- "align" = table {
+ "align" = \table {
"-1" "\leftalign{%}"
"0" "\centeralign{%}"
"1" "\rightalign{%}"
}
- "clefs" = table {
- "violin" "\violinclef" 0pt 12.8pt -10pt 18pt
- "bass" "\bassclef" 0pt 12.8pt 0pt 16pt
- "alto" "\altoclef" 0pt 12.8pt 0pt 16pt
- "tenor" "\altoclef" 0pt 12.8pt 0pt 16pt
- "violin_change" "\cviolinclef" 0pt 11.2pt -12pt 12pt
- "bass_change" "\cbassclef" 0pt 11.2pt 0pt 16pt
- "alto_change" "\caltoclef" 0pt 11.2pt 0pt 16pt
- "tenor_change" "\caltoclef" 0pt 11.2pt 0pt 16pt
+ "clefs" = \table {
+ "violin" "\violinclef" 0\pt 12.8\pt -10\pt 18\pt
+ "bass" "\bassclef" 0\pt 12.8\pt 0\pt 16\pt
+ "alto" "\altoclef" 0\pt 12.8\pt 0\pt 16\pt
+ "tenor" "\altoclef" 0\pt 12.8\pt 0\pt 16\pt
+ "violin_change" "\cviolinclef" 0\pt 11.2\pt -12\pt 12\pt
+ "bass_change" "\cbassclef" 0\pt 11.2\pt 0\pt 16\pt
+ "alto_change" "\caltoclef" 0\pt 11.2\pt 0\pt 16\pt
+ "tenor_change" "\caltoclef" 0\pt 11.2\pt 0\pt 16\pt
}
- "balls" = table {
- "1" "\wholeball" 0pt 6pt -2 pt 2pt
- "2" "\halfball" 0pt 5pt -2 pt 2pt
- "4" "\quartball" 0pt 5pt -2 pt 2pt
+ "balls" = \table {
+ "1" "\wholeball" 0\pt 6\pt -2 \pt 2\pt
+ "2" "\halfball" 0\pt 5\pt -2 \pt 2\pt
+ "4" "\quartball" 0\pt 5\pt -2 \pt 2\pt
}
- "slur" = table {
+ "slur" = \table {
"whole" "\slurchar%{%}"
"half" "\hslurchar%{%}"
}
- "accidentals" = table {
- "-2" "\flatflat" 0pt 10.2pt -2.5pt 7.5pt
- "-1" "\flat" 0pt 6pt -2.5pt 7.5pt
- "0" "\natural" 0pt 6pt -7.5pt 7.5pt
- "1" "\sharp" 0pt 6pt -7.5pt 7.5pt
- "2" "\sharpsharp" 0pt 6pt -2.5pt 7.5pt
+ "accidentals" = \table {
+ "-2" "\flatflat" 0\pt 10.2\pt -2.5\pt 7.5\pt
+ "-1" "\flat" 0\pt 6\pt -2.5\pt 7.5\pt
+ "0" "\natural" 0\pt 6\pt -7.5\pt 7.5\pt
+ "1" "\sharp" 0\pt 6\pt -7.5\pt 7.5\pt
+ "2" "\sharpsharp" 0\pt 6\pt -2.5\pt 7.5\pt
}
- "streepjes" = table {
- "toplines" "\toplines{%}" -3pt 9pt 0pt 0pt
- "botlines" "\botlines{%}" -3pt 9pt 0pt 0pt
+ "streepjes" = \table {
+ "toplines" "\toplines{%}" -3\pt 9\pt 0\pt 0\pt
+ "botlines" "\botlines{%}" -3\pt 9\pt 0\pt 0\pt
}
- "bars" = table {
+ "bars" = \table {
"empty" "\emptybar"
- "|" "\maatstreep" 0pt 0.4pt -8pt 8pt
- "||" "\finishbar" 0pt 2pt -8pt 8pt
- ":|" "\repeatbar" -4pt 0pt -8pt 8pt
- "|:" "\startrepeat" 0pt 4pt -8pt 8pt
- ":|:" "\repeatbarstartrepeat" 0pt 16pt -8pt 8pt
+ "|" "\maatstreep" 0\pt 0.4\pt -8\pt 8\pt
+ "||" "\finishbar" 0\pt 2\pt -8\pt 8\pt
+ ":|" "\repeatbar" -4\pt 0\pt -8\pt 8\pt
+ "|:" "\startrepeat" 0\pt 4\pt -8\pt 8\pt
+ ":|:" "\repeatbarstartrepeat" 0\pt 16\pt -8\pt 8\pt
}
- "rests" = table {
- "1" "\wholerest" -5pt 1pt -1pt 1pt
- "2" "\halfrest" -5pt 1pt -1pt 1pt
- "4" "\quartrest" -5pt 2pt -5pt 5pt
- "8" "\eighthrest" 0pt 5pt 0pt 8pt
- "16" "\sixteenthrest" 0pt 6pt 0pt 12pt
- "32" "\thirtysecondrest" 0pt 6pt 0pt 16pt
+ "rests" = \table {
+ "1" "\wholerest" -5\pt 1\pt -1\pt 1\pt
+ "2" "\halfrest" -5\pt 1\pt -1\pt 1\pt
+ "4" "\quartrest" -5\pt 2\pt -5\pt 5\pt
+ "8" "\eighthrest" 0\pt 5\pt 0\pt 8\pt
+ "16" "\sixteenthrest" 0\pt 6\pt 0\pt 12\pt
+ "32" "\thirtysecondrest" 0\pt 6\pt 0\pt 16\pt
}
- "meters" = table {
- "C" "\fourfourmeter" 0pt 10pt -5pt 5pt
- "C2" "\allabreve" 0pt 10pt -5pt 5pt
+ "meters" = \table {
+ "C" "\fourfourmeter" 0\pt 10\pt -5\pt 5\pt
+ "C2" "\allabreve" 0\pt 10\pt -5\pt 5\pt
}
% dims ignored for this table
- "param" = table {
- "meter" "\generalmeter{%}{%}" 0pt 10pt -5pt 5pt
+ "param" = \table {
+ "meter" "\generalmeter{%}{%}" 0\pt 10\pt -5\pt 5\pt
"linestaf" "\linestafsym{%}{%}"
"stem" "\stem{%}{%}"
"fill" "\hbox{}"
- "crescendo" "\crescendosym{%}" 0pt 0pt -3pt 3pt
- "decrescendo" "\decrescendosym{%}" 0pt 0pt -3pt 3pt
+ "crescendo" "\crescendosym{%}" 0\pt 0\pt -3\pt 3\pt
+ "decrescendo" "\decrescendosym{%}" 0\pt 0\pt -3\pt 3\pt
}
- "dots" = table {
- "1" "\lsingledot" 0pt 2pt -1pt 1pt
- "2" "\ldoubledot" 0pt 5pt -1pt 1pt
- "3" "\ltripledot" 0pt 8pt -1pt 1pt
+ "dots" = \table {
+ "1" "\lsingledot" 0\pt 2\pt -1\pt 1\pt
+ "2" "\ldoubledot" 0\pt 5\pt -1\pt 1\pt
+ "3" "\ltripledot" 0\pt 8\pt -1\pt 1\pt
}
- "flags" = table {
- "8" "\eigthflag" 0pt 4pt 0pt 0pt
- "16" "\sixteenthflag" 0pt 4pt 0pt 0pt
- "32" "\thirtysecondflag" 0pt 4pt 0pt 0pt
- "-8" "\deigthflag" 0pt 4pt 0pt 0pt
- "-16" "\dsixteenthflag" 0pt 4pt 0pt 0pt
- "-32" "\dthirtysecondflag" 0pt 4pt 0pt 0pt
+ "flags" = \table {
+ "8" "\eigthflag" 0\pt 4\pt 0\pt 0\pt
+ "16" "\sixteenthflag" 0\pt 4\pt 0\pt 0\pt
+ "32" "\thirtysecondflag" 0\pt 4\pt 0\pt 0\pt
+ "-8" "\deigthflag" 0\pt 4\pt 0\pt 0\pt
+ "-16" "\dsixteenthflag" 0\pt 4\pt 0\pt 0\pt
+ "-32" "\dthirtysecondflag" 0\pt 4\pt 0\pt 0\pt
}
- "beamslopes" = table {
+ "beamslopes" = \table {
"slope" "\beamslope{%}{%}"
"horizontal" "\rulesym{%}{%}"
}
}
-default_table = symboltables { table_sixteen }
+defaulttable = \symboltables { tablesixteen }
% It has a lot of hard-wired stringconstants
%
-table_twenty = symboltables {
+table_twenty = \symboltables {
texid "\musixtwentydefs"
- "style" = table {
+ "style" = \table {
"roman" "\settext{%}" 0pt 0pt 0pt 0pt
"italic" "\setitalic{%}" 0pt 0pt 0pt 0pt
}
- "align" = table {
+ "align" = \table {
"-1" "\leftalign{%}" 0pt 0pt 0pt 0pt
"0" "\centeralign{%}" 0pt 0pt 0pt 0pt
"1" "\rightalign{%}" 0pt 0pt 0pt 0pt
% be careful with editing this:
% the "index" entry is hardwired into lilypond.
- "clefs" = table {
+ "clefs" = \table {
"violin" "\violinclef" 0pt 16pt -12.5pt 22.5pt
"bass" "\bassclef" 0pt 16pt 0pt 20pt
"alto" "\altoclef" 0pt 16pt 0pt 20pt
"tenor_change" "\caltoclef" 0pt 16pt 0pt 20pt
}
- "balls" = table {
+ "balls" = \table {
"1" "\wholeball" 0pt 7.5pt -2.5pt 2.5pt
"2" "\halfball" 0pt 6pt -2.5pt 2.5pt
"4" "\quartball" 0pt 6pt -2.5pt 2.5pt
}
- "slur" = table {
+ "slur" = \table {
"whole" "\slurchar%{%}" 0pt 0pt 0pt 0pt
"half" "\hslurchar%{%}" 0pt 0pt 0pt 0pt
}
- "accidentals" = table {
+ "accidentals" = \table {
"-2" "\flatflat" 0pt 10.2pt -2.5pt 7.5pt
"-1" "\flat" 0pt 6pt -2.5pt 7.5pt
"0" "\natural" 0pt 6pt -7.5pt 7.5pt
"2" "\sharpsharp" 0pt 6pt -2.5pt 7.5pt
}
- "streepjes" = table {
+ "streepjes" = \table {
"toplines" "\toplines{%}" -3pt 9pt 0pt 0pt
"botlines" "\botlines{%}" -3pt 9pt 0pt 0pt
}
- "bars" = table {
+ "bars" = \table {
"empty" "\emptybar" 0pt 0pt 0pt 0pt
"|" "\maatstreep" 0pt 5pt -12pt 12pt
"||" "\finishbar" 0pt 2pt -12pt 12pt
}
- "rests" = table {
+ "rests" = \table {
"1" "\wholerest" -5pt 1pt -1pt 1pt
"2" "\halfrest" -5pt 1pt -1pt 1pt
"4" "\quartrest" -5pt 2pt -5pt 5pt
"32" "\thirtysecondrest" 0pt 6pt 0pt 16pt
}
- "meters" = table {
+ "meters" = \table {
"C" "\fourfourmeter" 0pt 10pt -5pt 5pt
"C2" "\allabreve" 0pt 10pt -5pt 5pt
}
% dims ignored for this table
- "param" = table {
+ "param" = \table {
"meter" "\generalmeter{%}{%}" -3pt 10pt -5pt 5pt
"linestaf" "\linestafsym{%}{%}"
"stem" "\stem{%}{%}"
"fill" "\hbox{}"
}
- "dots" = table {
+ "dots" = \table {
"1" "\lsingledot" 0pt 8pt -1pt 1pt
"2" "\ldoubledot" 0pt 12pt -1pt 1pt
"3" "\ltripledot" 0pt 16pt -1pt 1pt
}
- "flags" = table {
+ "flags" = \table {
"8" "\eigthflag" 0pt 5pt 0pt 0pt
"16" "\sixteenthflag" 0pt 5pt 0pt 0pt
"32" "\thirtysecondflag" 0pt 5pt 0pt 0pt
"-32" "\dthirtysecondflag" 0pt 5pt 0pt 0pt
}
- "beamslopes" = table {
+ "beamslopes" = \table {
"slope" "\beamslope{%}{%}"
"horizontal" "\rulesym{%}{%}"
}
}
-default_table = symboltables { table_twenty }
+default_table = \symboltables { table_twenty }
# generic stuff/Makefile
#
-include ./$(depth)/make/Stuff.make
+include ./$(depth)/make/Include.make
#
# list of distribution files:
% author: unknown. Copyright: none
%
-cad = music { $
+cad = \music {
\duration { 8}
\textstyle "italic"
\clef \violin
- 'c4.\mf g8
+ c'4.\mf g8
\textstyle "roman"
- ['e^"accel" ()'d 'c b]
- [b()'c] g-\fermata
+ [e'^"accel" ()d' c' b]
+ [b()c'] g-\fermata
\bar \empty
- c [c_"rubato" e g 'c]
+ c [c_"rubato" e g c']
\octave{'}
e4. e [g ()f_"rit" e d]
\duration{16} [d cis d e]
f4()[f e d c]
`b4
- \octave{} ['d8 'c8 a8]2/3
+ \octave{} [d'8 c'8 a8]2/3
g2
\bar \empty
- [g c e g] ['c e g 'c]\octave{'}
+ [g c e g] [c' e g c']\octave{'}
[e `g c e] g4^\fermata %()% BUG!
\bar \empty
- [g8.(_"a tempo" e g8. )e]
+ [g8.(_"a \tempo" e g8. )e]
a4. g8 [f8 e8 d8 c8]
`g2 d2^"tr"
c4
- $}
+ }
score {
- staff { melodic
- music { cad }
+ \staff { \melodic
+ \music { cad }
}
- commands {
- cadenza {1}
+ \co\mmands {
+ \cadenza {1}
grouping{1*4}
}
- paper {}
- midi { tempo 4:80 }
+ \paper {}
+ \midi { \tempo 4:80 }
}
% Opus 62
% Ouverture zu Collins Trauerspiel "Coriolan"
%
-% a 5 bar fragment of the alto part
+% a 5 \bar fragment of the alto part
%
% Copyright (c) 1997 Jan Nieuwenhuizen <jan@digicash.com>
%
-% when lily can handle this, i-ll type the other 304 bars
+% when lily can handle this, i-ll type the other 304 \bars
% (maybe even sooner :-)
%
-alto = music {
- $
+alto = \music {
+
+ \meter {4/4} \grouping {4*4}
\duration{ 8 }
\key {bes es as}
% that-s why i-d rather type chords,
% but how to type slurs?
%30
- {
- \music{
+ <
+ {
[ c c-. ] c2.( |
%31
[ ) c c-. ] c2.( |
[ ) c c-. ] c4. c-. c4
}
%30:2
- \music{
+ {
\octave{ ` }
\textstyle "italic"
- % this should be a dynamic, rather than text
+ % this should be a \dynamic, rather than text
[ c c_"cresc. \ \ - \ \ \ \ - \ \ \ \ - \ \ \ \
- \ \ \ \ - \ \ \ \ - \ \ \ \ - \ \ \ \
- \ \ \ \ - \ \ \ \ - \ \ \ \ - \ \ \ \
[ ) c c-. ] c4. c-. c4 |
\octave{ }
}
- }
%34
- % these are two voices (i.e. divisi)
+ >
+ % these are two \voices (i.e. divisi)
% the c4 and c2, however are really 16th...
% e.g.: c16*4 and c16*8 or
% [ c4 c2 ]*16 ?
% we-ll say "simile" for now...
%
- { \multivoice
- \music{ \stem{ 1 }[ c16^"div." c16 c16 c16 ] c4 c2 }
- \music {
+ < \multivoice
+ { \stem{ 1 }[ c16^"div." c16 c16 c16 ] c4 c2 }
+ {
\octave{ ` }
\textstyle "italic"
\stem{ -1 } [ as16_"\ff" as16 as16 as16 ] as4_"simile" as2
\textstyle "roman"
}
- }
- $
+ >
+
}
score {
- staff { melodic music { alto }}
+ \staff { \melodic \music { alto }}
- commands {
- meter {4*4} grouping {4*4}
}
- paper {
- unitspace 14mm
- geometric 1.4
+ \paper {
+ \unitspace 14\mm
+ \geometric 1.4
}
}
include "this-is-hopefully-a-nonexisting-file"
-mwa = music {
- $
+mwa = \music {
+
[ a8 a8 a8 a8 a8 ] %
[ a8 ] %
% segfault
- { \music{ [ bes^"1"( )a bes-. g-. ] a4-.^"4" } \music{ [ e ] } \music{ [ c ] } } |
+ { \\music{ [ bes^"1"( )a bes-. g-. ] a4-.^"4" } \\music{ [ e ] } \\music{ [ c ] } } |
a ) b ] c % warning
& % ok; error
a b ) ] % ok; error
% a......... % fatal error -- assert
a b c
||| %
- abc % ok; print error, no output
+ abc % ok; print error, no \output
\bla % no warning-> this STRING, reduced to lyric_elt.
- a [ b % warning, still output
- { a( b } % warning, still output
+ a [ b % warning, still \output
+ { a( b } % warning, still \output
a b ,c
a b c-*
a b c&
{ a-. b-. }
- $
+
}
-bla = music {
+bla = \music {
@
These Gates will open just like windows. % ok; warning
@
include "this-is-hopefully-a-nonexisting-file"
score {
- staff {
- lyric music { bla }
+ \staff {
+ lyric \music { bla }
}
- staff {
- melodic music { mwa }
+ \staff {
+ \melodic \music { mwa }
}
- commands {
- meter {3*4}
+ \co\mmands {
+ \meter {3/4}
}
}
% Creator: This is mi2mu 0.0.11.2 #14/FlowerLib 1.1.7 #1 of Mar 12 1997 02:11:21
% Automatically generated, at Wed Mar 12 02:22:22 1997
-% from input file: fugue1.midi
+% from input file: fugue1.\midi
-track0 = music { $
- % midi copyright:
+track0 = \music {
+ % \midi copyright:
% instrument:
-$} % track0
+} % track0
-track1 = music { $
- % midi copyright:
+track1 = \music {
+ % \midi copyright:
% instrument:
- g8 a8 b8 'c8. { \music{ 'd16 } } { \music{ 'c16 } }
- { \music{ b8 } } 'e8 a8 { \music{ 'd8. } } 'e16
- 'd16 'c16 b16 g16 a16 b16 'c16 b16 'c16 'd16 'e16
- 'd16 'e16 'fis16 'g8 b8 'c8 a8 'd16 'c16 b16 a16 {
- \music{ g8. } } g16 f16 e16 f16 g16 a16 g16 a16 b16
- 'c2 b4 'c8 'd8 'e8 'f8. { \music{ 'f16 } \music{
- 'g16 } } 'e8 'a8 'd8 'g8. 'a16 'g16 'f16 'e8 'a8.
- 'b16 'a16 'g16 'f2 'e8. 'fis16 'g2 'fis4 'g16 'f16
- 'e16 'd16 'c16 'd16 'c16 b16 a16 'c16 b16 a16 'c16
- a16 gis8 'e8 'd8 'c16 b16 a16 gis16 a16 b16 'c16
- fis16 gis16 a16 b8 a16 b16 'c8 'f8 'e8 'd4 'c16 b16
- { \music{ 'c16 } } { \music{ b16 } } { \music{ b16
- b16 } \music{ 'c16 'c16 } \music{ b16 } \music{
- 'c16 'c16 } } { } { \music{ b16 } } { \music{ a16 }
- } a4 g8 a8 b8 'c8. { \music{ 'd16 } } { \music{
- 'c16 } } { \music{ b8 } } 'c8 'd8 'e8 'f8. { \music{
- 'g16 } } { \music{ 'f16 } } { \music{ 'e8 } } 'a8
- 'd8 'g8. 'a16 'g16 'f16 'e8 'a8 'd8 'ais8 'a8 'g16
- 'f16 'g16 'f16 'g16 'e16 'f16 { \music{ 'g16 } } {
- \music{ 'g16 } } { \music{ 'a16 } } { \music{ 'g16 }
- } { } { } { \music{ 'f16 } } { \music{ 'g16 } } {
- \music{ 'a16 } } 'cis16 'd16 'g16 { \music{ 'f16 }
- } { \music{ 'e16 } } { \music{ 'f16 } } { \music{
- 'e16 } } { } { \music{ 'f16 } } { } { } { } {
- \music{ 'e8 } } { } 'd16 'd8 g8 a8 b8 'c8 'd16 {
- \music{ 'c16 } } { \music{ b8 } } 'e8 a8 { \music{
- 'd8. } } 'e16 'd16 'c16 b16 'c16 'd16 'e16 'f16
- 'g16 'a16 'g16 'f16 'e16 'd16 'c16 { \music{ 'c16 }
- } { \music{ b16 } } { \music{ 'c16 } } { } { } {
- \music{ b8. } } 'c8 'd8 g8 { \music{ 'c4 } } b8 'c4
- b8 ais8 a8 { \music{ 'd4 } } 'c8 'd8 'e8 'f4 'a16 {
- \music{ 'g16 } } 'f16 'e16 { \music{ 'f16 } } {
- \music{ 'e16 } } 'd16 'c2 g16 { \music{ a16 } } b16
- 'c16 'd16 'e16 { \music{ 'f8. } } { \music{ 'd16 }
- \music{ 'c16 'e16 } } 'f16 { \music{ 'g16 } } {
- \music{ 'a8. } } 'b16 ''c2
-$} % track1
+ g8 a8 b8 c'8. { \\music{ d'16 } } { \\music{ c'16 } }
+ { \\music{ b8 } } e'8 a8 { \\music{ d'8. } } e'16
+ d'16 c'16 b16 g16 a16 b16 c'16 b16 c'16 d'16 e'16
+ d'16 e'16 fis'16 g'8 b8 c'8 a8 d'16 c'16 b16 a16 {
+ \\music{ g8. } } g16 f16 e16 f16 g16 a16 g16 a16 b16
+ c'2 b4 c'8 d'8 e'8 f'8. { \\music{ f'16 } \\music{
+ g'16 } } e'8 a'8 d'8 g'8. a'16 g'16 f'16 e'8 a'8.
+ b'16 a'16 g'16 f'2 e'8. fis'16 g'2 fis'4 g'16 f'16
+ e'16 d'16 c'16 d'16 c'16 b16 a16 c'16 b16 a16 c'16
+ a16 gis8 e'8 d'8 c'16 b16 a16 gis16 a16 b16 c'16
+ fis16 gis16 a16 b8 a16 b16 c'8 f'8 e'8 d'4 c'16 b16
+ { \\music{ c'16 } } { \\music{ b16 } } { \\music{ b16
+ b16 } \\music{ c'16 c'16 } \\music{ b16 } \\music{
+ c'16 c'16 } } { } { \\music{ b16 } } { \\music{ a16 }
+ } a4 g8 a8 b8 c'8. { \\music{ d'16 } } { \\music{
+ c'16 } } { \\music{ b8 } } c'8 d'8 e'8 f'8. { \\music{
+ g'16 } } { \\music{ f'16 } } { \\music{ e'8 } } a'8
+ d'8 g'8. a'16 g'16 f'16 e'8 a'8 d'8 ais'8 a'8 g'16
+ f'16 g'16 f'16 g'16 e'16 f'16 { \\music{ g'16 } } {
+ \\music{ g'16 } } { \\music{ a'16 } } { \\music{ g'16 }
+ } { } { } { \\music{ f'16 } } { \\music{ g'16 } } {
+ \\music{ a'16 } } cis'16 d'16 g'16 { \\music{ f'16 }
+ } { \\music{ e'16 } } { \\music{ f'16 } } { \\music{
+ e'16 } } { } { \\music{ f'16 } } { } { } { } {
+ \\music{ e'8 } } { } d'16 d'8 g8 a8 b8 c'8 d'16 {
+ \\music{ c'16 } } { \\music{ b8 } } e'8 a8 { \\music{
+ d'8. } } e'16 d'16 c'16 b16 c'16 d'16 e'16 f'16
+ g'16 a'16 g'16 f'16 e'16 d'16 c'16 { \\music{ c'16 }
+ } { \\music{ b16 } } { \\music{ c'16 } } { } { } {
+ \\music{ b8. } } c'8 d'8 g8 { \\music{ c'4 } } b8 c'4
+ b8 ais8 a8 { \\music{ d'4 } } c'8 d'8 e'8 f'4 a'16 {
+ \\music{ g'16 } } f'16 e'16 { \\music{ f'16 } } {
+ \\music{ e'16 } } d'16 c'2 g16 { \\music{ a16 } } b16
+ c'16 d'16 e'16 { \\music{ f'8. } } { \\music{ d'16 }
+ \\music{ c'16 e'16 } } f'16 { \\music{ g'16 } } {
+ \\music{ a'8. } } b'16 c''2
+} % track1
-track2 = music { $
- % midi copyright:
+track2 = \music {
+ % \midi copyright:
% instrument:
- c8 d8 e8 f8. { \music{ g16 } } { \music{ f16 } } {
- \music{ e8 } } a8 d8 { \music{ g8. } } a16 g16 f16
- e16 f16 e16 d16 c16 d16 c16 `b16 `a8 fis8 { \music{
+ c8 d8 e8 f8. { \\music{ g16 } } { \\music{ f16 } } {
+ \\music{ e8 } } a8 d8 { \\music{ g8. } } a16 g16 f16
+ e16 f16 e16 d16 c16 d16 c16 `b16 `a8 fis8 { \\music{
g4. } } f16 e16 f8 d8 g8 f8 e8 d8 g4 f16 e16 f4 f16
e8 d4 c8 f8 g16 f16 e16 f8 d8 g4.. g8 a8 b8 {
- \music{ 'c8. } } { \music{ 'd16 } } { \music{ 'c16 }
- } { \music{ b8 } } 'e8 a8 { \music{ 'd8. } } 'e16
- 'd16 'c16 b8 d8 e8 fis8 { \music{ g8. } } { \music{
- a16 } } { \music{ g16 } } { \music{ f8 } } b8 e8
+ \\music{ c'8. } } { \\music{ d'16 } } { \\music{ c'16 }
+ } { \\music{ b8 } } e'8 a8 { \\music{ d'8. } } e'16
+ d'16 c'16 b8 d8 e8 fis8 { \\music{ g8. } } { \\music{
+ a16 } } { \\music{ g16 } } { \\music{ f8 } } b8 e8
a8. b16 a16 gis16 fis8 f8 e8 d8. e16 fis16 gis16
a16 gis16 a16 b16 gis16 fis16 gis16 a16 b8 c8 d8 e8
- { \music{ f8. } } { \music{ g16 } } { \music{ f16 }
- } { \music{ e8 } } a8 d8 g8. a16 g16 f16 e16 e16
- fis16 g4 fis8 gis8 { \music{ a4 } } g8 a8 b8 {
- \music{ 'c8. } } { \music{ 'd16 } } { \music{ 'c16 }
- } { \music{ b8 } } 'e8 a8 'd8. 'e16 'd16 'c16 b8
- 'g8 'cis8 'd8 'e8 'cis8 'd8 'e8 a8 e8 fis8 g8 {
- \music{ a8. } } { \music{ b16 } } { \music{ a16 } }
- { \music{ g8 } } 'c8 fis8 { \music{ b8. } } 'c16
+ { \\music{ f8. } } { \\music{ g16 } } { \\music{ f16 }
+ } { \\music{ e8 } } a8 d8 g8. a16 g16 f16 e16 e16
+ fis16 g4 fis8 gis8 { \\music{ a4 } } g8 a8 b8 {
+ \\music{ c'8. } } { \\music{ d'16 } } { \\music{ c'16 }
+ } { \\music{ b8 } } e'8 a8 d'8. e'16 d'16 c'16 b8
+ g'8 cis'8 d'8 e'8 cis'8 d'8 e'8 a8 e8 fis8 g8 {
+ \\music{ a8. } } { \\music{ b16 } } { \\music{ a16 } }
+ { \\music{ g8 } } c'8 fis8 { \\music{ b8. } } c'16
b16 a16 g16 fis16 e16 d16 e4 d4 a16 g16 f16 e16 g16
- f16 a16 g4 a16 ais8 { \music{ 'c4 } } 'd8 g8 {
- \music{ g4. } } f4 e8 d4 e16 a4 g4 f8 g8 a8 {
- \music{ ais8. } } { \music{ 'c16 } } { \music{
- ais16 } } { \music{ a8 } } 'd8 g8 { \music{ 'c8. }
- } 'd16 'c16 ais16 a16 ais16 a16 g16 f16 g16 f16 e16
- g16 a4 'f16 'd8 { \music{ 'e2 } \music{ 'g2 } }
-$} % track2
+ f16 a16 g4 a16 ais8 { \\music{ c'4 } } d'8 g8 {
+ \\music{ g4. } } f4 e8 d4 e16 a4 g4 f8 g8 a8 {
+ \\music{ ais8. } } { \\music{ c'16 } } { \\music{
+ ais16 } } { \\music{ a8 } } d'8 g8 { \\music{ c'8. }
+ } d'16 c'16 ais16 a16 ais16 a16 g16 f16 g16 f16 e16
+ g16 a4 f'16 d'8 { \\music{ e'2 } \\music{ g'2 } }
+} % track2
-track3 = music { $
- % midi copyright:
+track3 = \music {
+ % \midi copyright:
% instrument:
- `g8 `a8 `b8 c8. { \music{ d16 } } { \music{ c16 } }
- { \music{ `b8 } } e8 `a8 { \music{ d8. } } e16 d16
+ `g8 `a8 `b8 c8. { \\music{ d16 } } { \\music{ c16 } }
+ { \\music{ `b8 } } e8 `a8 { \\music{ d8. } } e16 d16
c16 `b8 c4 `ais8 `a8 d8 `g8 c8 `a16 `b16 c16 d4 `g4
- `g8 `a8 `b8 c8. { \music{ d16 } } { \music{ c16 } }
+ `g8 `a8 `b8 c8. { \\music{ d16 } } { \\music{ c16 } }
{ } `b8 e8 `a8 d8. e16 d16 c16 `b8 e4. d4 `b16 c16
`a16 e16 d16 c16 `b16 c16 `a16 `b16 c16 d16 c16
- `b16 `a16 `g4 `e8 `fis8 `gis8 `a8. { \music{ `b16 }
- } { \music{ `a16 } } { \music{ `g8 } } c8 `fis8
- `b8. c16 `b16 `a16 `gis8 { \music{ `a4 } } `gis8
- `a4 `g8 `a8 `b8 c8. { \music{ d16 } } { \music{ c16
- } } { \music{ `b8 } } e8 `a8 d4 `g8 d4 c8 `a8 e4 d8
- `a8 `b8 cis8 d8. { \music{ e16 } } { \music{ d16 }
- } { \music{ c8 } } f8 `b8 e8. f16 e16 d16 cis8 `a8
- `b8 cis8 d8. { \music{ e16 } } { \music{ d16 } } {
- \music{ c8 } } fis8 `b8 e8. fis16 e16 d16 c4.. d16
- c16 `b16 `a16 `g16 `a16 `fis16 `g8 `b8 c8 { \music{
- d8 } } e8. { \music{ f16 } } { \music{ e16 } } {
- \music{ d8 } } g8 c8 f8. g16 f16 e16 d4 e8 d4 {
- \music{ `g8 } } `g4. `c8 `d8 `e8 `f8. { \music{
- `g16 } } { \music{ `f16 } } { \music{ `e8 } } `a8
- `d8 { \music{ `g8. } } `a16 `g16 `f16 `e16 `d16
+ `b16 `a16 `g4 `e8 `fis8 `gis8 `a8. { \\music{ `b16 }
+ } { \\music{ `a16 } } { \\music{ `g8 } } c8 `fis8
+ `b8. c16 `b16 `a16 `gis8 { \\music{ `a4 } } `gis8
+ `a4 `g8 `a8 `b8 c8. { \\music{ d16 } } { \\music{ c16
+ } } { \\music{ `b8 } } e8 `a8 d4 `g8 d4 c8 `a8 e4 d8
+ `a8 `b8 cis8 d8. { \\music{ e16 } } { \\music{ d16 }
+ } { \\music{ c8 } } f8 `b8 e8. f16 e16 d16 cis8 `a8
+ `b8 cis8 d8. { \\music{ e16 } } { \\music{ d16 } } {
+ \\music{ c8 } } fis8 `b8 e8. fis16 e16 d16 c4.. d16
+ c16 `b16 `a16 `g16 `a16 `fis16 `g8 `b8 c8 { \\music{
+ d8 } } e8. { \\music{ f16 } } { \\music{ e16 } } {
+ \\music{ d8 } } g8 c8 f8. g16 f16 e16 d4 e8 d4 {
+ \\music{ `g8 } } `g4. `c8 `d8 `e8 `f8. { \\music{
+ `g16 } } { \\music{ `f16 } } { \\music{ `e8 } } `a8
+ `d8 { \\music{ `g8. } } `a16 `g16 `f16 `e16 `d16
`e16 `f16 `g16 `a16 `ais16 `g16 `a16 `e16 `f16 `g16
- `a16 `b16 c16 { \music{ `a16 } \music{ d2 } } c1
-$} % track3
+ `a16 `b16 c16 { \\music{ `a16 } \\music{ d2 } } c1
+} % track3
-track4 = music { $
- % midi copyright:
+track4 = \music {
+ % \midi copyright:
% instrument:
- `c8 `d8 `e8 `f8. { \music{ `g16 } } { \music{ `f16 }
- } { \music{ `e8 } } `a8 `d8 { \music{ `g8. } }
+ `c8 `d8 `e8 `f8. { \\music{ `g16 } } { \\music{ `f16 }
+ } { \\music{ `e8 } } `a8 `d8 { \\music{ `g8. } }
`a16 `g16 `f16 `e16 `f16 `e16 `d16 `c16 `d16 `c16
``b16 ``a8 `d8 `a8 `fis8 `g16 `a16 `ais16 `g16
`cis8 `d8 `a4 `e4 `a16 `b16 c16 d16 c16 `b16 `a16
- `g16 c8 ``g8 ``a8 ``b8 `c8. { \music{ `d16 } } {
- \music{ `c16 } } { \music{ ``b8 } } `e8 ``a8 `d8.
- `e16 `d16 `c16 { \music{ ``b8 } } `e4 `d8 `c8 `f4
+ `g16 c8 ``g8 ``a8 ``b8 `c8. { \\music{ `d16 } } {
+ \\music{ `c16 } } { \\music{ ``b8 } } `e8 ``a8 `d8.
+ `e16 `d16 `c16 { \\music{ ``b8 } } `e4 `d8 `c8 `f4
`e4 `d4 `e8 `f8 `e16 `d16 `e4 ``a4 ``g8 ``a8 ``b8
- `c8. { \music{ `d16 } } { \music{ `c16 } } { \music{
- ``b8 } } `e8 ``a8 `d8. `e16 `d16 `c16 ``b8 ``ais8
+ `c8. { \\music{ `d16 } } { \\music{ `c16 } } { \\music{
+ ``b8 } } `e8 ``a8 `d8. `e16 `d16 `c16 ``b8 ai``s8
``a8 ``g8 ``a8 `fis8 `g8 `e8 `d4 `e8 `f8 `g8. {
- \music{ `a16 } } { \music{ `g16 } } { \music{ `f8 }
- } `ais8 `e8 `a8. `b16 { \music{ `a16 } } `g16 `f16
+ \\music{ `a16 } } { \\music{ `g16 } } { \\music{ `f8 }
+ } `ais8 `e8 `a8. `b16 { \\music{ `a16 } } `g16 `f16
`e16 `f16 `d16 `g8 `a8 `d4.. `e16 `d16 `c16 ``b16
- ``a16 ``g16 ``fis16 ``e8 `e8 `fis8 `g4 `a16 `g16
+ ``a16 ``g16 fi``s16 ``e8 `e8 `fis8 `g4 `a16 `g16
`fis8 `d8 `g1 `a4 `b8 c8 `f16 `a16 `g16 `f16 `e16
`d16 `c16 ``b16 `c16 `d16 `e16 `f16 `g8 ``g8 `b2
-$} % track4
+} % track4
score {
- staff { melodic music { track0 } }
- staff { melodic music { track1 } }
- staff { melodic music { track2 } }
- staff { melodic music { track3 } }
- staff { melodic music { track4 } }
+ \staff { \melodic \music { track0 } }
+ \staff { \melodic \music { track1 } }
+ \staff { \melodic \music { track2 } }
+ \staff { \melodic \music { track3 } }
+ \staff { \melodic \music { track4 } }
- commands {
- meter { 4*4 }
- }
- midi {
- tempo 4:60
+ \midi {
+ \tempo 4:60
}
}
% "Ah, vous dirais-je, maman" (Mozart, KV 265)
%
-% bare bones version. (written down from memory :-)
+% \bare bones version. (written down from memory :-)
% for lyrics, see twinkle.ly
-% the % is a comment.
+% the % is a co\mment.
%
% copyright: None
%
-% declare music (which will be in *one* staff ) for the lead voice
+% declare \music (which will be in *one* \staff ) for the lead \voice
-melodie = music {
- $ % switch Lilypond in note-mode
+melodie = \music {
+ % switch Lilypond in note-mode
\clef\violin
- \octave {} % set the default octave
+ \octave {} % set the default \octave
% the default note duratino is 4
%%% theme
c c | % the '|' checks if there is a new measure here.
g g| f f| e e| d d| g g| f f| e e| d d|
%%% var 1
c r8 c8 % r8 means an 8th rest.
- (| % start a slur
- % NOTE: the slurstart should be directly after the note
+ (| % \start a slur
+ % NOTE: the slur\start should be directly after the note
) % end a slur.
g r8 g8 (| ) a r8 a8 (| ) g r4
f r8 f8 (| ) e4 r8 e8 ( |) d4 r8 d8 (| ) c4 r4
-$}
+}
% more of this.
begeleiding =
-% $\clef bass % bass-clef
-% \music { % as you can see, the $ sign obliges
- % you to precede keyword by a backslash: \
- music { $
+% \clef bass % bass-\clef
+% \\music { % as you can see, the sign obliges
+ % you to precede \keyword by a backslash: \
+ \music {
\clef "bass"
- \octave { ` } % default octave: 1 below the first octave.
+ \octave { ` } % default \octave: 1 below the first \octave.
%%% theme
- `c % ` means one octave lower.
+ `c % ` means one \octave lower.
% Similarly: ' means one higher.
c e c f c e c d `b c `a `f `g `c2
\octave { ` }
%%%% var 1
r8 e8() c r8 e8() c r8 f8()c r8 e8()c
r8 d8()`b r8 c8()`a r8 `a8()`f r8 `e8()`c
-}$
+}
-% create a staff named bstaf
-bstaf = staff {
- melodic
- music { begeleiding } % use the declared music
+% create a \staff named bstaf
+bstaf = \staff {
+ \melodic
+ \music { begeleiding } % use the declared \music
+ \music { \meter {2/4 } }
}
% another one
-vstaf = staff {
- melodic
- music { melodie }
- % default clef is violin clef
+vstaf = \staff {
+ \melodic
+ \music { melodie }
+ % default \clef is violin \clef
+ \music { \meter {2/4 } }
}
-score {
- staff { vstaf }
- staff { bstaf }
- paper {
- unitspace 2.5cm % a whole note takes 2.5 cm ideally.
- }
- commands {
- meter {2* 4} % a 2/4 meter.
+\score {
+ \staff { vstaf }
+ \staff { bstaf }
+ \paper {
+ \unitspace 2.5\cm % a whole note takes 2.5 \cm ideally.
}
}
%
%
-ritme = staff {
+ritme = \staff {
rhythmic
- music {$
+ \music {
c8
|[a8() a8. a8 a16 a16 a16] c4.
- %[c8( )'a8() c8 c8]% BUG!
+ %[c8( )a'8() c8 c8]% BUG!
|c2 c2
- |[fis16 'dis16( fis16 'dis16 ][fis16) 'dis16 fis16 'dis16]
+ |[fis16 dis'16( fis16 dis'16 ][fis16) dis'16 fis16 dis'16]
| r32 r32 r16 r8 r4 r2
|[c8. c16] [c16 c8.] [c16 c16 c8] [c16 c8 c16]
c2 c2 c2 c2 c2 c2 c2 c2 c2 c2
- $}
+ }
}
melody=
-staff {
- melodic
- music{$
+\staff {
+ \melodic
+ \music{
c8\key{fis cis gis}
|r4 r4 r4 r4
- |'cis2.. r8
+ |cis'2.. r8
| r4 r8 r16 r32 r32
\duration {4}
{
- \music { c () `bes [c8 c8] }
- \music { 'fis ()'gisis fis8 fis8 }
- \music { d () d dis8 dis8 }
- \music { a () bes eis8 eis8 }
- \music { fis () g gis8 gis8 }
+ \\music { c () `bes [c8 c8] }
+ \\music { fis' ()gisis' fis8 fis8 }
+ \\music { d () d dis8 dis8 }
+ \\music { a () bes eis8 eis8 }
+ \\music { fis () g gis8 gis8 }
}
\clef\tenor
- { c4 'c4 }
+ { c4 c'4 }
- [d8 e8 'f8 g8] d8 e8 f8 g8
- |''fis2
- | a8 b8 'c8 'd8 |''c8 ```c8 c4 |c4 c4 |c4
+ [d8 e8 f'8 g8] d8 e8 f8 g8
+ |fis''2
+ | a8 b8 c'8 d'8 |c''8 ```c8 c4 |c4 c4 |c4
\duration{ 16 } `b `a `g `f \duration{ 4}
\clef\bass
|c `b `a `g `f `e `d `c ``b ``a ``g ``f ``e ``d ``c
- $}
+ }
}
score {
- paper {
- geometric 1.4
- unitspace 3.0 cm
+ \paper {
+ \geometric 1.4
+ \unitspace 3.0 \cm
}
-% staff { ritme } % broken for now
- staff { melody }
- commands {
- meter {4* 4}
- partial {8}
- skip {1*8}
- skip {3*2 }
- bar ":|:"
- skip {1*2}
- meter {2*4}
+% \staff { ritme } % broken for now
+ \staff { melody }
+ \co\mmands {
+ \meter {4* 4}
+ \partial {8}
+ \skip {1*8}
+ \skip {3*2 }
+ \bar ":|:"
+ \skip {1*2}
+ \meter {2*4}
}
}
% quite alive at the time of writing;
% copyright by ml
%
-% lilypond: src/stem.cc:42: void Stem::set_stemend(double): Assertion `(dir > 0 && se >= maxnote) || (se <= minnote && dir <0)' failed.
+% lilypond: src/\stem.cc:42: void Stem::set_\stemend(double): Assertion `(dir > 0 && se >= maxnote) || (se <= minnote && dir <0)' failed.
%
% The purpose of this file is to demonstrate features of LilyPond;
% respect the copyright.
% \barnumbering5
% \barnumberstyle\boxed
+globalmusic= \music {
+ \meter {2/4}
+% \key fis
+ \skip {56*2}
+% \key bes es as
+ \skip {8*2}
+ \meter {6/8}
+ \skip{ 48*8}
+ \meter {2/4}
+ \skip {16*2}
+% \key fis
+}
+
include "mlalt.ly"
include "mlvio1.ly"
include "mlvio2.ly"
include "mlcello.ly"
-score {
- staff {
- melodic
- music { alto }
+\score {
+ \staff {
+ \melodic
+ \music { alto }
+ \music { globalmusic }
}
- staff {
- melodic
- music { violin1 }
+ \staff {
+ \melodic
+ \music { violinI }
+ \music { globalmusic }
}
- staff {
- melodic
- music { violin2 }
+ \staff {
+ \melodic
+ \music { violinII }
+ \music { globalmusic }
}
- staff {
- melodic
- music { cello }
+ \staff {
+ \melodic
+ \music { cello }
+ \music { globalmusic }
}
- commands {
- meter {2*4}
-% key $fis$
- skip {56*2}
-% key $bes es as$
- skip {8*2}
- meter {6*8}
- skip{ 48*8}
- meter {2*4}
- skip {16*2}
-% key $fis$
- }
- paper {
- unitspace 24mm
- width 195mm
- output "martien.out"
+ \paper {
+ \unitspace 24\mm
+ \width 195\mm
+ \output "martien.out"
}
- midi {
- tempo 4:80
+ \midi {
+ \tempo 4:80
}
}
-% midi.ly
-% test source for lilypond-s midi output
+% \midi.ly
+% test source for lilypond-s \midi \output
-melodie = music {
- $\clef\violin
+melodie = \music {
+ \clef\violin
c c | g g | a a | g2
f f | e e | d d8.( e16 | )c2 | % :|
- $
+
}
-begeleiding = music {
- $
+begeleiding = \music {
+
\clef \bass
\octave{`}
- c 'c | 'e 'c | 'f 'c | 'e 'c
- 'd b | 'c a | f g | c2 |
- $
+ c c' | e' c' | f' c' | e' c'
+ d' b | c' a | f g | c2 |
+
}
-mstaf = staff {
- melodic
- music { melodie }
+mstaf = \staff {
+ \melodic
+ \music { melodie }
}
-bass_staf = staff {
- melodic
- music { begeleiding }
+bass_staf = \staff {
+ \melodic
+ \music { begeleiding }
}
score {
- staff { mstaf }
- staff { bass_staf }
- commands {
- meter { 2 * 4}
+ \staff { mstaf }
+ \staff { bass_staf }
+ \co\mmands {
+ \meter { 2 * 4}
}
- midi {
- tempo 4:120
+ \midi {
+ \tempo 4:120
}
}
% The purpose of this file is to demonstrate features of LilyPond;
% respect the copyright.
%
-alto = music {
- $
+alto = \music {
+
\duration{16}
\clef\alto
\octave{}
%30
[ a8 `a8 ] a4 |
%31
- [ b8 'cis8 ] [ 'd8 a8 ] |
+ [ b8 cis'8 ] [ d'8 a8 ] |
%32
[ g e cis `a ] d4 |
%variant a
\textstyle "roman"
%\scoreverb{\mulooseness=1}
% \key\G ||
- $
+
}
% The purpose of this file is to demonstrate features of LilyPond;
% respect the copyright.
%
-cello = music {
- $
+cello = \music {
+
\clef"bass" \octave{`}
\duration{4}
\key{fis}
%%12
) d g |
%%13
- [ d8 'd8 ] g |
+ [ d8 d'8 ] g |
%%14=10
- [ d8 'd8 ] g |
+ [ d8 d'8 ] g |
%%15
[ c8 e8 ] [ g8 `g8 ] |
%%16
\textstyle "italic"
- [ d8 'c8 ] b_"fine"
+ [ d8 c'8 ] b_"fine"
\textstyle "roman" |
% \newline
%%17=1
%%34
[ `g8 `g `g ] g4 |
%%35
- [ c8 c c ] [ c8 'c 'c ] |
+ [ c8 c c ] [ c8 c' c' ] |
%%36
g4 b4 |
%%37
%%71
g2. |
%%72
- 'c r4 r4. |
+ c' r4 r4. |
%%73
% \meter{2/4} ||
g r g r |
d_"dacapo" \key{fis} |
\textstyle "roman"
% \key\`g ||
- $
+
}
% The purpose of this file is to demonstrate features of LilyPond;
% respect the copyright.
%
-violin1 = music {
- $
+violinI = \music {
+
\clef "violin"
\octave{}
\duration{4}
%2
g2 |
%3
- g [ a16 b16 'c16 a16 ] |
+ g [ a16 b16 c'16 a16 ] |
%4
g2 |
%5=1
%11=4
e d |
%12
- [ fis8 a8 ] [ g8 'd8 ] |
+ [ fis8 a8 ] [ g8 d'8 ] |
%13
- [ 'd8 a8 ] [ 'd8 b8 ] |
+ [ d'8 a8 ] [ d'8 b8 ] |
%14=10
a b |
%15
- 'c b |
+ c' b |
%16
\textstyle "italic"
a g_"fine"
%18=2
g2 |
%19=3
- g [ a16 b16 'c16 a16 ] |
+ g [ a16 b16 c'16 a16 ] |
%20=4
g2 |
%21=5
%23=4
e [ d16 c16 `b16 c16 ] |
%24
- cis 'cis |
+ cis cis' |
%25
- 'd [ 'fis8. 'e16 ] |
+ d' [ fis'8. e'16 ] |
%first modulation
%26
- 'd 'c |
+ d' c' |
%27
b a |
%28
- [ a8 b16 'cis16 ] 'd |
+ [ a8 b16 cis'16 ] d' |
%29
- 'cis 'd |
+ cis' d' |
%30
- 'cis a |
+ cis' a |
%31
- [ g8 'd8( ] ) 'd |
+ [ g8 d'8( ] ) d' |
%32
- 'cis 'c |
-%variant 'a
+ cis' c' |
+%variant a'
%33
- \duration{16} [ b8 'd 'd ] [ 'd8 'd 'd ] |
+ \duration{16} [ b8 d' d' ] [ d'8 d' d' ] |
%34
- [ 'g8 'd 'd ] b4 |
+ [ g'8 d' d' ] b4 |
%35
- [ 'c8 'c 'c ] [ 'c8 'c 'c ] |
+ [ c'8 c' c' ] [ c'8 c' c' ] |
%36
b2 |
%37
- [ 'c8 'e 'e ] [ 'e8 'd 'c ] |
+ [ c'8 e' e' ] [ e'8 d' c' ] |
%38
- [ b8 'd 'd ] [ 'd8 'd 'd ] |
+ [ b8 d' d' ] [ d'8 d' d' ] |
%39
- [ 'e8 'c 'c ] [ 'c8 'd 'c ] |
+ [ e'8 c' c' ] [ c'8 d' c' ] |
%40
- 'c4 { b4 'd4 } |
+ c'4 { b4 d'4 } |
%41
\textstyle "italic"
\duration{8}
%42
r d e4 |
%43
- r b r 'd |
+ r b r d' |
%44
- r 'e 'c4 |
+ r e' c'4 |
%45
r b r b |
%46
r b [ a b ] |
%47
- r b r 'c |
+ r b r c' |
%48
- r 'd [ 'd b ] |
+ r d' [ d' b ] |
%theme 2
%49
\textstyle "italic"
%51
b2 |
%52
- 'c2 |
+ c'2 |
%53
r4 [ b b b ]2/3 |
%54
%57
f r f r |
%58
- es r 'c r |
+ es r c' r |
%59
b r b r |
%60
- 'c r 'c4 |
+ c' r c'4 |
%61
\duration{16}
- [ as f d f as 'd ]4/6 [ as f d `as d f ]4/6 |
+ [ as f d f as d' ]4/6 [ as f d `as d f ]4/6 |
%62
- [ g es c `g c es ]4/6 [ g 'c 'es 'c g es ]4/6 |
+ [ g es c `g c es ]4/6 [ g c' es' c' g es ]4/6 |
%63
- [ g d g bes 'd 'g ]4/6 [ 'f 'd bes g f d ]4/6 |
+ [ g d g bes d' g' ]4/6 [ f' d' bes g f d ]4/6 |
%64
\duration{8}
[ c g ] g4 |
%68
[ b8 b b ] b4. |
%69
- [ 'c g es ] 'c4. |
+ [ c' g es ] c'4. |
%70
- 'c4. 'es4. |
+ c'4. es'4. |
%71
- [ 'f 'd b ] [ g a8 b ] |
+ [ f' d' b ] [ g a8 b ] |
%72
- 'c r4 r4. |
+ c' r4 r4. |
% \meter{2/4} ||
%73
f r f r |
%74
- es r 'c r |
+ es r c' r |
%75
b r b r |
%76
- 'c r 'c4 |
+ c' r c'4 |
%77
\duration{16}
- [ as f d f as 'd ]4/6 [ as f d `as d f ]4/6 |
+ [ as f d f as d' ]4/6 [ as f d `as d f ]4/6 |
%78
- [ g es c `g c es ]4/6 [ f 'c 'es 'c g es ]4/6 |
+ [ g es c `g c es ]4/6 [ f c' es' c' g es ]4/6 |
%79
- [ g d f b 'd 'g ]4/6 [ 'f 'd b g f d ]4/6 |
+ [ g d f b d' g' ]4/6 [ f' d' b g f d ]4/6 |
%80
[ c8 g8 ] g4 |
%81
\duration{2}
- 'c |
+ c' |
%82
- 'c |
+ c' |
%83
- 'des |
+ des' |
%84
- 'c |
+ c' |
%85
- 'c |
+ c' |
%86
es |
%87
\textstyle "roman"
\key{fis} |
% \key\G ||
- $
+
}
% The purpose of this file is to demonstrate features of LilyPond;
% respect the copyright.
%
-violin2 = music {
- $
+violinII = \music {
+
\clef "violin" \octave{}
\duration{4}
\key{fis}
%69
es2. |
%70
- [ c es g ] 'c4. |
+ [ c es g ] c'4. |
%71
b4 g4 d4 |
%72
fis_"dacapo" \key{fis}|
\textstyle "roman"
% \key\G ||
- $
+
}
--- /dev/null
+% "Ah, vous dirais-je, maman"
+% "Altijd is Kortjakje ziek"
+% "Twinkle twinkle little star"
+%
+% Copyright: none
+
+melody = \melodic{
+ \clef\violin
+ c c | g g | a a | g g |
+ f f | e e | d [ d8.( e16 ] | )c2 \bar ":|"
+
+ g g | f f | e e | d d |
+% g g | f f | e( [f0*32 e0*32 d0*32] [ e8. f16 ] | e )d | c c |
+ g g | f f | e( [ e8. f16 ] | e )d |
+
+ c c | g g | a a | g g |
+ f f | e e | d [ d8.( e16 ] | )c2 \bar ":|"
+}
+
+accompany = \melodic{
+ \clef\bass
+ \octave{ c' }
+ c c' | e' c' | f' c' | e' c' |
+ d' b | c' a | f g | c2 \bar ":|"
+
+ e' g | d g | c' g | b g |
+% e' g | d' g | c' [ c'8.( d'16 ] | \voice{ c' )b } \voice{ g2 } |
+ e' g | d' g | c' [ c'8.( d'16 ] | c' )b |
+
+ c c' | e' c' | f' c' | e' c' |
+ d' b | c' a | f g | c2 \bar ":|"
+}
+
+original_text = \lyric{
+ \textstyle "italic"
+ Ah! vous dir- ai_- je ma man2
+ Ce qui cau- se mon tour- ment2
+ Pa- pa veut que je rai- sonne2
+ Co\mme un- e grand- e per- sonne2
+ Moi je dis que les bon- bons2
+ Val- ent mieu que la rai- son2
+}
+
+tekst = \lyric{
+ Al- tijd is Kort- jak- je ziek,2
+ midden in_de week maar s'_zon- dags niet.2
+ s'_Zon- dags gaat ze naar de kerk,2
+ met een boek vol zil- ver werk.2
+ Al- tijd is Kort- jak- je ziek,2
+ midden in_de week maar s'_zon- dags niet.2
+}
+
+he_gedraagje_tekst = \lyric{
+ Al- tijd zuigt Bill Gates mijn piek,2
+ "\TeX" is slecht- ser dan mu- ziek.2
+ s''_Zon- dags gaat het door een raam,2
+ Weet dat ik me er- voor schaam.2
+ Al- tijd zuigt Bill Gates mijn piek,2
+ "\TeX" is slecht- ser dan mu- ziek.2
+}
+
+text1 = \lyric{
+ \textstyle "roman"
+ Twin- kle, twin- kle, lit- tle star,2
+ How I won- der what you are.2
+ Up a- bove the world so high,2
+ Like a dia- mond in the sky.2
+ Twin- kle, twin- kle, lit- tle star,2
+ How I won- der what you are!2
+}
+
+text2 = \lyric{
+ \textstyle "roman"
+ When the bla- zing sun is gone,2
+ When he no- thing shines up- on,2
+ Then you show your lit- tle light,2
+ Twin- kle, twin- kle, all the night.2
+ Twin- kle, twin- kle, lit- tle star,2
+ How I won- der what you are!2
+}
+
+text3 = \lyric{
+ \textstyle "roman"
+ Then the tra- veler in the dark2
+ Thanks you for your ti- ny spark;2
+ He_could not see which way to go,2
+ If you did not twin- kle so.2
+ Twin- kle, twin- kle, lit- tle star,2
+ How I won- der what you are!2
+}
+
+\score{
+ \\staff{ melody }
+ \\staff{ tekst }
+ \\staff{ original_text }
+ \\staff{ text1 text2 text3 }
+ \\staff{ accompany }
+ \co\mmands{
+ \meter{ 2/4 }
+ \skip{ 24 }
+ }
+ \midi{
+ \tempo 4:120
+ }
+ \paper{
+ \unitspace 2.5\cm
+ }
+}
+
-melanie = music {
- $
+melanie = \music {
+
\duration{8}
- [ c d ] { [ d 'd } { c 'c ] } |
+ [ c d ] { [ d d' } { c c' ] } |
[ c d ] [ e { d g } c ]2/3 |
- [ c d ] [ c16 d16 'e16 'e16 d16 c16 ]4/6 |
+ [ c d ] [ c16 d16 e'16 e'16 d16 c16 ]4/6 |
[ c d e e d c ]4/6 |
- [c d ] { \music{ [ c d e ]2/3 } \music{ [ f g a ]2/3 } } |
+ [c d ] { \\music{ [ c d e ]2/3 } \\music{ [ f g a ]2/3 } } |
[ c d ] [ d c ] |
- $
+
}
-michelle = music {
- $
+michelle = \music {
+
\duration{8}
[ c c c c ] |
[ c c c c ] |
[ c c c c ] |
[ c c c c ] |
[ c c c c ] |
- $
+
}
-mireille = music {
+mireille = \music {
@
\duration{8}
o o o o |
}
score {
- staff { lyric music { mireille } }
- staff { melodic music { melanie } }
- staff { melodic music { michelle } }
- commands{
- meter {2*4}
+ \staff { lyric \music { mireille } }
+ \staff { \melodic \music { melanie } }
+ \staff { \melodic \music { michelle } }
+ \co\mmands{
+ \meter {2*4}
}
}
% Creator: This is mi2mu 0.0.11.2 #14/FlowerLib 1.1.7 #1 of Mar 12 1997 02:05:36
% Automatically generated, at Wed Mar 12 02:09:07 1997
-% from input file: pre1.midi
+% from input file: pre1.\midi
% jcn: using option -n
-track0 = music { $
- % midi copyright:
+track0 = \music {
+ % \midi copyright:
% instrument:
{ } { } { } { } { } { } { } { }
-$} % track0
+} % track0
-track1 = music { $
- % midi copyright:
+track1 = \music {
+ % \midi copyright:
% instrument:
- { \music{ g16 'c16 'e16 g16 'c16 'e16 } } { \music{
- g16 'c16 'e16 g16 'c16 'e16 } } { \music{ a16 'd16
- 'f16 a16 'd16 'f16 } } { \music{ a16 'd16 'f16 a16
- 'd16 'f16 } } { \music{ g16 'd16 'f16 g16 'd16 'f16
- } } { \music{ g16 'd16 'f16 g16 'd16 'f16 } } {
- \music{ g16 'c16 'e16 g16 'c16 'e16 } } { \music{
- g16 'c16 'e16 g16 'c16 'e16 } } { \music{ a16 'e16
- 'a16 a16 'e16 'a16 } } { \music{ a16 'e16 'a16 a16
- 'e16 'a16 } } { \music{ fis16 a16 'd16 fis16 a16
- 'd16 } } { \music{ fis16 a16 'd16 fis16 a16 'd16 }
- } { \music{ g16 'd16 'g16 g16 'd16 'g16 } } {
- \music{ g16 'd16 'g16 g16 'd16 'g16 } } { \music{
- e16 g16 'c16 e16 g16 'c16 } } { \music{ e16 g16
- 'c16 e16 g16 'c16 } } { \music{ e16 g16 'c16 e16
- g16 'c16 } } { \music{ e16 g16 'c16 e16 g16 'c16 }
- } { \music{ d16 fis16 'c16 d16 fis16 'c16 } } {
- \music{ d16 fis16 'c16 d16 fis16 'c16 } } { \music{
- d16 g16 b16 d16 g16 b16 } } { \music{ d16 g16 b16
- d16 g16 b16 } } { \music{ e16 g16 'cis16 e16 g16
- 'cis16 } } { \music{ e16 g16 'cis16 e16 g16 'cis16 }
- } { \music{ d16 a16 'd16 d16 a16 'd16 } } { \music{
- d16 a16 'd16 d16 a16 'd16 } } { \music{ d16 f16
- b16 d16 f16 b16 } } { \music{ d16 f16 b16 d16 f16
- b16 } } { \music{ c16 g16 'c16 c16 g16 'c16 } } {
- \music{ c16 g16 'c16 c16 g16 'c16 } } { \music{
- `a16 c16 f16 `a16 c16 f16 } } { \music{ `a16 c16
- f16 `a16 c16 f16 } } { \music{ `a16 c16 f16 `a16
- c16 f16 } } { \music{ `a16 c16 f16 `a16 c16 f16 } }
- { \music{ `g16 `b16 f16 `g16 `b16 f16 } } { \music{
- `g16 `b16 f16 `g16 `b16 f16 } } { \music{ `g16 c16
- e16 `g16 c16 e16 } } { \music{ `g16 c16 e16 `g16
- c16 e16 } } { \music{ `ais16 c16 e16 `ais16 c16 e16
- } } { \music{ `ais16 c16 e16 `ais16 c16 e16 } } {
- \music{ `a16 c16 e16 `a16 c16 e16 } } { \music{
- `a16 c16 e16 `a16 c16 e16 } } { \music{ `a16 c16
- dis16 `a16 c16 dis16 } } { \music{ `a16 c16 dis16
- `a16 c16 dis16 } } { \music{ `b16 c16 d16 `b16 c16
- d16 } } { \music{ `b16 c16 d16 `b16 c16 d16 } } {
- \music{ `g16 `b16 d16 `g16 `b16 d16 } } { \music{
- `g16 `b16 d16 `g16 `b16 d16 } } { \music{ `g16 c16
- e16 `g16 c16 e16 } } { \music{ `g16 c16 e16 `g16
- c16 e16 } } { \music{ `g16 c16 f16 `g16 c16 f16 } }
- { \music{ `g16 c16 f16 `g16 c16 f16 } } { \music{
- `g16 `b16 f16 `g16 `b16 f16 } } { \music{ `g16 `b16
- f16 `g16 `b16 f16 } } { \music{ `a16 c16 fis16 `a16
- c16 fis16 } } { \music{ `a16 c16 fis16 `a16 c16
- fis16 } } { \music{ `g16 c16 g16 `g16 c16 g16 } } {
- \music{ `g16 c16 g16 `g16 c16 g16 } } { \music{
- `g16 c16 f16 `g16 c16 f16 } } { \music{ `g16 c16
- f16 `g16 c16 f16 } } { \music{ `g16 `b16 f16 `g16
- `b16 f16 } } { \music{ `g16 `b16 f16 `g16 `b16 f16 }
- } { \music{ `g16 `ais16 e16 `g16 `ais16 e16 } } {
- \music{ `g16 `ais16 e16 `g16 `ais16 e16 } } {
- \music{ `f16 `a16 c16 f16 c16 `a16 c16 `a16 `f16
- `a16 `f16 `d16 `f16 `d16 } } { \music{ g16 b16 'd16
- 'f16 'd16 b16 'd16 b16 g16 b16 d16 f16 e64 } } {
- \music{ f64 } } { } { \music{ e32 } } { \music{ d16
- } } { \music{ 'c1 } \music{ g1 } \music{ e1 } }
-$} % track1
+ { \\music{ g16 c'16 e'16 g16 c'16 e'16 } } { \\music{
+ g16 c'16 e'16 g16 c'16 e'16 } } { \\music{ a16 d'16
+ f'16 a16 d'16 f'16 } } { \\music{ a16 d'16 f'16 a16
+ d'16 f'16 } } { \\music{ g16 d'16 f'16 g16 d'16 f'16
+ } } { \\music{ g16 d'16 f'16 g16 d'16 f'16 } } {
+ \\music{ g16 c'16 e'16 g16 c'16 e'16 } } { \\music{
+ g16 c'16 e'16 g16 c'16 e'16 } } { \\music{ a16 e'16
+ a'16 a16 e'16 a'16 } } { \\music{ a16 e'16 a'16 a16
+ e'16 a'16 } } { \\music{ fis16 a16 d'16 fis16 a16
+ d'16 } } { \\music{ fis16 a16 d'16 fis16 a16 d'16 }
+ } { \\music{ g16 d'16 g'16 g16 d'16 g'16 } } {
+ \\music{ g16 d'16 g'16 g16 d'16 g'16 } } { \\music{
+ e16 g16 c'16 e16 g16 c'16 } } { \\music{ e16 g16
+ c'16 e16 g16 c'16 } } { \\music{ e16 g16 c'16 e16
+ g16 c'16 } } { \\music{ e16 g16 c'16 e16 g16 c'16 }
+ } { \\music{ d16 fis16 c'16 d16 fis16 c'16 } } {
+ \\music{ d16 fis16 c'16 d16 fis16 c'16 } } { \\music{
+ d16 g16 b16 d16 g16 b16 } } { \\music{ d16 g16 b16
+ d16 g16 b16 } } { \\music{ e16 g16 cis'16 e16 g16
+ cis'16 } } { \\music{ e16 g16 cis'16 e16 g16 cis'16 }
+ } { \\music{ d16 a16 d'16 d16 a16 d'16 } } { \\music{
+ d16 a16 d'16 d16 a16 d'16 } } { \\music{ d16 f16
+ b16 d16 f16 b16 } } { \\music{ d16 f16 b16 d16 f16
+ b16 } } { \\music{ c16 g16 c'16 c16 g16 c'16 } } {
+ \\music{ c16 g16 c'16 c16 g16 c'16 } } { \\music{
+ `a16 c16 f16 `a16 c16 f16 } } { \\music{ `a16 c16
+ f16 `a16 c16 f16 } } { \\music{ `a16 c16 f16 `a16
+ c16 f16 } } { \\music{ `a16 c16 f16 `a16 c16 f16 } }
+ { \\music{ `g16 `b16 f16 `g16 `b16 f16 } } { \\music{
+ `g16 `b16 f16 `g16 `b16 f16 } } { \\music{ `g16 c16
+ e16 `g16 c16 e16 } } { \\music{ `g16 c16 e16 `g16
+ c16 e16 } } { \\music{ `ais16 c16 e16 `ais16 c16 e16
+ } } { \\music{ `ais16 c16 e16 `ais16 c16 e16 } } {
+ \\music{ `a16 c16 e16 `a16 c16 e16 } } { \\music{
+ `a16 c16 e16 `a16 c16 e16 } } { \\music{ `a16 c16
+ dis16 `a16 c16 dis16 } } { \\music{ `a16 c16 dis16
+ `a16 c16 dis16 } } { \\music{ `b16 c16 d16 `b16 c16
+ d16 } } { \\music{ `b16 c16 d16 `b16 c16 d16 } } {
+ \\music{ `g16 `b16 d16 `g16 `b16 d16 } } { \\music{
+ `g16 `b16 d16 `g16 `b16 d16 } } { \\music{ `g16 c16
+ e16 `g16 c16 e16 } } { \\music{ `g16 c16 e16 `g16
+ c16 e16 } } { \\music{ `g16 c16 f16 `g16 c16 f16 } }
+ { \\music{ `g16 c16 f16 `g16 c16 f16 } } { \\music{
+ `g16 `b16 f16 `g16 `b16 f16 } } { \\music{ `g16 `b16
+ f16 `g16 `b16 f16 } } { \\music{ `a16 c16 fis16 `a16
+ c16 fis16 } } { \\music{ `a16 c16 fis16 `a16 c16
+ fis16 } } { \\music{ `g16 c16 g16 `g16 c16 g16 } } {
+ \\music{ `g16 c16 g16 `g16 c16 g16 } } { \\music{
+ `g16 c16 f16 `g16 c16 f16 } } { \\music{ `g16 c16
+ f16 `g16 c16 f16 } } { \\music{ `g16 `b16 f16 `g16
+ `b16 f16 } } { \\music{ `g16 `b16 f16 `g16 `b16 f16 }
+ } { \\music{ `g16 `ais16 e16 `g16 `ais16 e16 } } {
+ \\music{ `g16 `ais16 e16 `g16 `ais16 e16 } } {
+ \\music{ `f16 `a16 c16 f16 c16 `a16 c16 `a16 `f16
+ `a16 `f16 `d16 `f16 `d16 } } { \\music{ g16 b16 d'16
+ f'16 d'16 b16 d'16 b16 g16 b16 d16 f16 e64 } } {
+ \\music{ f64 } } { } { \\music{ e32 } } { \\music{ d16
+ } } { \\music{ c'1 } \\music{ g1 } \\music{ e1 } }
+} % track1
-% jcn: substituted some "2" durations to "4."
-track2 = music { $
- % midi copyright:
+% jcn: substituted some "2" \durations to "4."
+track2 = \music {
+ % \midi copyright:
% instrument:
- { \music{ e4. } } { \music{ e4. } } { \music{ d4. }
- } { \music{ d4. } } { \music{ d4. } } { \music{ d4.
- } } { \music{ e4. } } { \music{ e4. } } { \music{
- e4. } } { \music{ e4. } } { \music{ d4. } } {
- \music{ d4. } } { \music{ d4. } } { \music{ d4. } }
- { \music{ c4. } } { \music{ c4. } } { \music{ c4. }
- } { \music{ c4. } } { \music{ `a4. } } { \music{
- `a4. } } { \music{ `b4. } } { \music{ `b4. } } {
- \music{ `ais4. } } { \music{ `ais4. } } { \music{
- `a4. } } { \music{ `a4. } } { \music{ `gis4. } } {
- \music{ `gis4. } } { \music{ `g4. } } { \music{
- `g4. } } { \music{ `f4. } } { \music{ `f4. } } {
- \music{ `f4. } } { \music{ `f4. } } { \music{ `d4. }
- } { \music{ `d4. } } { \music{ `e4. } } { \music{
- `e4. } } { \music{ `g4. } } { \music{ `c4. } } { } {
- } { \music{ `g4. } } { } { \music{ ``f4. } } {
- \music{ `f4. } } { \music{ ``f4. } } { \music{ `f4. }
- } { \music{ ``fis4. } } { \music{ ``fis4. } \music{
- `c4. } } { } { \music{ `c4. } } { \music{ ``gis4. } }
- { \music{ ``gis4. } \music{ `f4. } } { } { \music{
- `f4. } } { \music{ ``g4. } } { \music{ ``g4. } \music{
- `f4. } } { } { \music{ `f4. } } { \music{ ``g4. } }
- { \music{ ``g4. } \music{ `e4. } } { } { \music{ ``g4.
- } \music{ `e4. } } { } { \music{ ``g4. } \music{
- `d4. } } { } { \music{ ``g4. } \music{ `d4. } } { } {
- \music{ `d4. } } { \music{ ``g4. } } { \music{ ``g4. }
- \music{ `d4. } } { } { \music{ `dis4. } } { \music{
- ``g4. } } { \music{ `dis4. } } { \music{ ``g4. } } {
- \music{ `e4. } } { \music{ ``g4. } } { \music{ `e4. }
- } { \music{ ``g4. } } { \music{ `d4. } } { \music{
- ``g4. } } { \music{ `d4. } } { \music{ ``g4. } } {
- \music{ `d4. } } { \music{ ``g4. } } { \music{ `d4. }
- } { \music{ ``c4. } } { \music{ `c4. } } { \music{
- ``c4. } } { \music{ `c4. } } { \music{ ``c1 } } {
- \music{ `c1 } } { \music{ ``c1 } \music{ ``b1 } } {
- } { } { } { \music{ ``c1 } \music{ `c1 } }
-$} % track4.
+ { \\music{ e4. } } { \\music{ e4. } } { \\music{ d4. }
+ } { \\music{ d4. } } { \\music{ d4. } } { \\music{ d4.
+ } } { \\music{ e4. } } { \\music{ e4. } } { \\music{
+ e4. } } { \\music{ e4. } } { \\music{ d4. } } {
+ \\music{ d4. } } { \\music{ d4. } } { \\music{ d4. } }
+ { \\music{ c4. } } { \\music{ c4. } } { \\music{ c4. }
+ } { \\music{ c4. } } { \\music{ `a4. } } { \\music{
+ `a4. } } { \\music{ `b4. } } { \\music{ `b4. } } {
+ \\music{ `ais4. } } { \\music{ `ais4. } } { \\music{
+ `a4. } } { \\music{ `a4. } } { \\music{ `gis4. } } {
+ \\music{ `gis4. } } { \\music{ `g4. } } { \\music{
+ `g4. } } { \\music{ `f4. } } { \\music{ `f4. } } {
+ \\music{ `f4. } } { \\music{ `f4. } } { \\music{ `d4. }
+ } { \\music{ `d4. } } { \\music{ `e4. } } { \\music{
+ `e4. } } { \\music{ `g4. } } { \\music{ `c4. } } { } {
+ } { \\music{ `g4. } } { } { \\music{ ``f4. } } {
+ \\music{ `f4. } } { \\music{ ``f4. } } { \\music{ `f4. }
+ } { \\music{ fi``s4. } } { \\music{ fi``s4. } \\music{
+ `c4. } } { } { \\music{ `c4. } } { \\music{ gi``s4. } }
+ { \\music{ gi``s4. } \\music{ `f4. } } { } { \\music{
+ `f4. } } { \\music{ ``g4. } } { \\music{ ``g4. } \\music{
+ `f4. } } { } { \\music{ `f4. } } { \\music{ ``g4. } }
+ { \\music{ ``g4. } \\music{ `e4. } } { } { \\music{ ``g4.
+ } \\music{ `e4. } } { } { \\music{ ``g4. } \\music{
+ `d4. } } { } { \\music{ ``g4. } \\music{ `d4. } } { } {
+ \\music{ `d4. } } { \\music{ ``g4. } } { \\music{ ``g4. }
+ \\music{ `d4. } } { } { \\music{ `dis4. } } { \\music{
+ ``g4. } } { \\music{ `dis4. } } { \\music{ ``g4. } } {
+ \\music{ `e4. } } { \\music{ ``g4. } } { \\music{ `e4. }
+ } { \\music{ ``g4. } } { \\music{ `d4. } } { \\music{
+ ``g4. } } { \\music{ `d4. } } { \\music{ ``g4. } } {
+ \\music{ `d4. } } { \\music{ ``g4. } } { \\music{ `d4. }
+ } { \\music{ ``c4. } } { \\music{ `c4. } } { \\music{
+ ``c4. } } { \\music{ `c4. } } { \\music{ ``c1 } } {
+ \\music{ `c1 } } { \\music{ ``c1 } \\music{ ``b1 } } {
+ } { } { } { \\music{ ``c1 } \\music{ `c1 } }
+} % track4.
score {
- staff { melodic music { track0 } }
- staff { melodic music { track1 } }
- staff { melodic music { track2 } }
+ \staff { \melodic \music { track0 } }
+ \staff { \melodic \music { track1 } }
+ \staff { \melodic \music { track2 } }
- commands {
- meter { 4*4 }
+ \co\mmands {
+ \meter { 4*4 }
}
- midi {
- tempo 4:60
+ \midi {
+ \tempo 4:60
}
}
%
-% I've got rhythm!
+% Ive' got rhythm!
%
% add any impressive examples here, please
-ritme = staff {
- melodic
+ritme = \staff {
+ \melodic
- music { $
+ \music {
c8 |
[a8() a8. a8 a16 a16 a16] c4. | % watch the beams!
% [c16 c16 c16 c16 c16 ] |
% [c16 c16 c16 c16 c16 ] |
- $ }
+ }
%
- % The commands section takes the same stuff that music { } takes;
- % the commands issued below could have been issued inside the above
- % music block;
+ % The \co\mmands section takes the same stuff that \music { } takes;
+ % the \co\mmands issued below could have been issued inside the above
+ % \music block;
%
- commands { % override "commands" section of Score.
- partial {1*8} % doesn't have to be here.
- meter{ 4*4}
+ \co\mmands { % override "\co\mmands" section of Score.
+ \partial {1*8} % doesnt' have to be here.
+ \meter{ 4*4}
}
}
-another = staff {
- melodic
- music { $
+another = \staff {
+ \melodic
+ \music {
c1 c1 c1 c4 c4 c4 c4 \meter{ 4*4} c1 c1 c1
- $ }
+ }
}
-yanother = staff {
- melodic
- music { $
+yanother = \staff {
+ \melodic
+ \music {
c1 c1 c1 c4 c4 c4 c4 c1 c1 c1
- $ }
+ }
}
score {
- staff{ritme}
- staff { another }
- staff { yanother }
- commands { meter {4*4 }}
- paper {
- unitspace 2cm
- geometric 1.3
+ \staff{ritme}
+ \staff { another }
+ \staff { yanother }
+ \co\mmands { \meter {4*4 }}
+ \paper {
+ \unitspace 2\cm
+ \geometric 1.3
}
}
blah =
-staff {melodic
- music{ $
+\staff {\melodic
+ \music{
\duration { 8 }
\octave{ }
- |[ a a a a a a a a a ]
+ |[ a a a a a a a a a ]6/9
\octave{ ' }
- |[ a a a a a a a a a ]
+ |[ a a a a a a a a a ]6/9
\octave { ` }
- [ `c `g d a 'e 'b ''f '''c '''g ]
- [ '''g '''c ''f 'b 'e a d `g `c ]
+ [ `c `g d a e' b' f'' c''' g''' ]6/9
+ [ g''' c''' f'' b' e' a d `g `c ]6/9
\octave{ ' }
- [ `c `g d a 'e 'b ''f '''c '''g ]
- [ '''g '''c ''f 'b 'e a d `g `c ]
+ [ `c `g d a e' b' f'' c''' g''' ]6/9
+ [ g''' c''' f'' b' e' a d `g `c ]6/9
\octave { }
- [ c g 'd ]2/3
- [ 'd g c ]2/3
- [ f 'c 'g ]2/3
- [ 'g 'c f ]2/3
+ [ c g d' ]2/3
+ [ d' g c ]2/3
+ [ f c' g' ]2/3
+ [ g' c' f ]2/3
\octave{ ' }
- [ c g 'd ]2/3
- [ 'd g c ]2/3
- [ f 'c 'g ]2/3
- [ 'g 'c f ]2/3
+ [ c g d' ]2/3
+ [ d' g c ]2/3
+ [ f c' g' ]2/3
+ [ g' c' f ]2/3
c1
\duration { 8}
- [c-> d-> e-> f->][g-> a-> b-> 'c->] % 1
-\octave{'} ['c-^ b-^ a-^ g-^][f-^ e-^ d-^ c-^]
-\octave{} ['c-^ b-^ a-^ g-^][f-^ e-^ d-^ c-^]
- [c-. d-. e-. f-.][g-. a-. b-. 'c-.]
- ['c-- b-- a-- g][f-- e-- d c--] % 5
+ [c-> d-> e-> f->][g-> a-> b-> c'->] % 1
+\octave{'} [c'-^ b-^ a-^ g-^][f-^ e-^ d-^ c-^]
+\octave{} [c'-^ b-^ a-^ g-^][f-^ e-^ d-^ c-^]
+ [c-. d-. e-. f-.][g-. a-. b-. c'-.]
+ [c'-- b-- a-- g][f-- e-- d c--] % 5
[c-\portato d-\portato e-\portato f-\portato]
- [g-\portato a-\portato b-\portato 'c-\portato]
- ['c-\upbow b-\upbow a-\downbow g-\downbow]
+ [g-\portato a-\portato b-\portato c'-\portato]
+ [c'-\upbow b-\upbow a-\downbow g-\downbow]
[f-\downbow e-\downbow d-\upbow c-\upbow]
- [c-| d-| e-| f-|][g-| a-| b-| 'c-|]
- ['c b a g][f e d c]
- [c d e f][g a b 'c] % 10
- |['c b a g][f e d c]
+ [c-| d-| e-| f-|][g-| a-| b-| c'-|]
+ [c' b a g][f e d c]
+ [c d e f][g a b c'] % 10
+ |[c' b a g][f e d c]
- $}
+ }
}
score {
- staff {
+ \staff {
blah
}
- paper {
- symboltables { table_sixteen}
- unitspace 1.5 cm
- geometric 1.4
+ \paper {
+ symbol\tables { \table_sixteen}
+ \unitspace 1.5 \cm
+ \geometric 1.4
}
- commands {
- meter {6*8}
- skip 36*8
- meter {4*4}
+ \co\mmands {
+ \meter {6*8}
+ \skip {36*8}
+ \meter {4*4}
}
}
% \metron{4=120}
%
% \meter{3/4}
-% \key\F % key is F ( f-major )
-% \clef\alto % use alto clef
-% \duration8 % default duration is 'eight note
+% \key\F % \key is F ( f-major )
+% \clef\alto % use alto \clef
+% \duration8 % default \duration is eight' note
%
-% \verb{\nobarnumbers} % issue MusiXTeX command
+% \verb{\no\barnumbers} % issue MusiXTeX \co\mmand
% \barnumbering0
% \slope{30} % Fool MusiXTeX into 30 / 10 steeper beam
-% \stemlength3 % shorter stemlength
+% \stemlength3 % shorter \stemlength
% % because piece is set very tightly
-%%1 % double comments are included in .tex file
-ii_menuetto = music {
- $\clef"alto"
+%%1 % double co\mments are included in .tex file
+ii_menuetto = \music {
+ \clef"alto"
\key {bes}
\octave{}
\duration{8}
% (^ )
a bes-. g-. ] a4-.^"4" |
%%3
-% { d4 `bes4-.\stemup } stemup: 2 voices?
+% { d4 `bes4-.\stemup } \stemup: 2 \voices?
{ d4 `bes4-. } g4-. [ f-. e-. ] |
%%4
% { f `a } (^ e ) d cis-. `b-. `a-. ]
%%6
% { bes( e } ) a
{ [ bes e } a bes-. g-. ]
- 'c4-. | % ='c4-. |
+ c'4-. | % =c'4-. |
%%7
{ a4-. f4}
-% { 'd4-.-\upbow f4 `bes4\stemdown }
- { 'd4-.-\upbow f4 `bes4 }
-% { 'e4-.-\downbow g4 `g4\stemdown } |
- { 'e4-.-\downbow g4 `g4 } |
+% { d'4-.-\upbow f4 `bes4\stemdown }
+ { d'4-.-\upbow f4 `bes4 }
+% { e'4-.-\downbow g4 `g4\stemdown } |
+ { e'4-.-\downbow g4 `g4 } |
%%8
-% { 'cis2.-\upbow e2. `a2.\stemdown } :|:%%sorry!!
- { 'cis2.-\upbow e2. `a2. } \bar ":|:"%%!! sorry!
+% { cis'2.-\upbow e2. `a2.\stemdown } :|:%%sorry!!
+ { cis'2.-\upbow e2. `a2. } \bar ":|:"%%!! sorry!
%%9
\clef "violin"
-% { 'e2 a2_f\stemdown }
- { 'e2 a2_"\f" }
- [ 'd( 'e16 )'f16 ] |
+% { e'2 a2_f\stemdown }
+ { e'2 a2_"\f" }
+ [ d'( e'16 )f'16 ] |
%%10
-% [ { 'e( g } ) 'd 'cis_{ }_{ }_2 'e
- { [ 'e g } 'd 'cis_"2" 'e a( )g ] |
+% [ { e'( g } ) d' cis'_{ }_{ }_2 e'
+ { [ e' g } d' cis'_"2" e' a( )g ] |
%%11
-% { a4\stemup( f2\stemdown } ) 'd4\stemup
-% { 'cis4\stemup-. e4\stemdown }
- { \multivoice \music {\stem{1} a4(\stem{1}) 'd4 'cis4-. } \music { \stem{-1} f2 e4 } } |
+% { a4\stemup( f2\stemdown } ) d'4\stemup
+% { cis'4\stemup-. e4\stemdown }
+ { \multi\voice \\music {\stem{1} a4(\stem{1}) d'4 cis'4-. } \\music { \stem{-1} f2 e4 } } |
%%12
-% { 'g^4 d\stemdown } (^ 'f 'e ) 'f 'd^3(^ ) ='c ] |
- { [ 'g^"4" d } 'f 'e 'f 'd^"3"( ) 'c ] |
+% { g'^4 d\stemdown } (^ f' e' ) f' d'^3(^ ) =c' ] |
+ { [ g'^"4" d } f' e' f' d'^"3"( ) c' ] |
% %13
% { bes2\stemup g4\stemdown } ( ) f4
-% { 'c4\stemup e4\stemdown }
-% { bes2 g4 } f4 { 'c4 e4 } |
+% { c'4\stemup e4\stemdown }
+% { bes2 g4 } f4 { c'4 e4 } |
\clef "alto"%
- { \multivoice
- \music { \stem{1} bes2 'c4 }
- \music { \stem{-1} g4(\stem{-1}) f4 e4 }% ugh
+ { \multi\voice
+ \\music { \stem{1} bes2 c'4 }
+ \\music { \stem{-1} g4(\stem{-1}) f4 e4 }% ugh
} |
%%%14
-%% [ { a( f } ) g a f ] { 'd4-\upbow e4 `bes4\stemdown } |
- { [ a f } g a f ] { 'd4-\upbow e4 `bes4 } |
+%% [ { a( f } ) g a f ] { d'4-\upbow e4 `bes4\stemdown } |
+ { [ a f } g a f ] { d'4-\upbow e4 `bes4 } |
%%%15
-%% { 'c4-\downbow f4 `a4\stemdown } [ bes( )a g a ] |
-% { 'c4-\downbow f4 `a4 } [ bes( )a g a ] |
+%% { c'4-\downbow f4 `a4\stemdown } [ bes( )a g a ] |
+% { c'4-\downbow f4 `a4 } [ bes( )a g a ] |
%%%16
[ f( e )f a-. g-. bes-. ] |
%% \tighten % use one line less
-%% \newline % start new line
+%% \newline % \start new line
%% |
%%%17
%% { a2^0^\tr fis2_3 } bes4 |
{ a2^"0" fis2_"3" } bes4 |
%%%18
-%% [ { 'c( es } ) bes 'c a ] fis4^\tr |
- { \music{ [ 'c( )bes 'c a ] } \music{ [ es ] } } fis4 |
+%% [ { c'( es } ) bes c' a ] fis4^\tr |
+ { \\music{ [ c'( )bes c' a ] } \\music{ [ es ] } } fis4 |
%%%19
- { 'd4-\downbow g4 `bes4 } { 'c4-\upbow g4 c4 } { [ bes d } a ] |
+ { d'4-\downbow g4 `bes4 } { c'4-\upbow g4 c4 } { [ bes d } a ] |
%%%20
-%% [ { 'c( d `g } bes a ) bes g ( ) bes ] |
- { \music{ [ 'c( bes a )bes g( )bes ] } \music{ [ d ] } \music{ [ g ] } } |
+%% [ { c'( d `g } bes a ) bes g ( ) bes ] |
+ { \\music{ [ c'( bes a )bes g( )bes ] } \\music{ [ d ] } \\music{ [ g ] } } |
%%%21
-%% { 'd4\stemup g2\stemdown } (^ ) 'cis4\stemup { 'd4\stemup =f4\stemdown } |
- { \multivoice \music {\stem{1} 'd4(\stem{1} ) 'cis4 'd4 } \music { \stem{-1} g2 f4 } } |
+%% { d'4\stemup g2\stemdown } (^ ) cis'4\stemup { d'4\stemup =f4\stemdown } |
+ { \multi\voice \\music {\stem{1} d'4(\stem{1} ) cis'4 d'4 } \\music { \stem{-1} g2 f4 } } |
%%%22
%% [ { g( cis } )f g e ] { f4 d4 } |
- { \music{ [ g( )f g e ] } \music{ [ cis ] } } { f4 d4 } |
+ { \\music{ [ g( )f g e ] } \\music{ [ cis ] } } { f4 d4 } |
%%%23
%% [ `g g ] { e4.\stemup^\tr `a4.\stemdown } d\stemup-\upbow |
[ `g g ] { e4. `a4. } d-\upbow |
%% { \textstyle "italic" d2.^"fine" `a2. \textstyle "roman" `d2._"3 mins."} | % :||
{ d2.^"fine" `a2. `d2._"3 mins."} \bar ":|" % \bar ":||"
%% \tighten % use one line less
- $
+
}
score {
- staff {
- melodic music { ii_menuetto }
+ \staff {
+ \melodic \music { ii_menuetto }
}
- commands {
- meter {3 * 4}
+ \co\mmands {
+ \meter {3 * 4}
}
- paper {
- symboltables { table_sixteen }
- width 195mm
- unitspace 9mm % to get lily to use only three lines
- geometric 1.4
- output "scsii-menuetto.out"
+ \paper {
+ symbol\tables { \table_sixteen }
+ \width 195\mm
+ \unitspace 9\mm % to get lily to use only three lines
+ \geometric 1.4
+ \output "scsii-menuetto.out"
}
- midi {
- tempo 4:120
- output "scsii-menuetto.midi"
+ \midi {
+ \tempo 4:120
+ \output "scsii-menuetto.\midi"
}
}
% Franz Schubert (1797-1828)
% Text by Ludwig Rellstab (1799-1860)
%
-% Copyright (c) 1995,1996,1997 Jan Nieuwenhuizen <jan@digicash.com>
+% Copyright (c) 1995,1996,1997 Jan Nieuwenhuizen <jandigicash.com>
%
% The purpose of this file is to demonstrate features of LilyPond.
% (there is an accompanying LaTeX file, standchen.tex)
%
-% comments with # note missing stuff
-% heu, make that %#%
-%
% thanks to \music group changing, all notes
% (except for grace notes) are printed
%
-
-%#%%
-%#%\title{St\"andchen}
-%#%\subtitle{Serenade}
-%#%%
-%#%\composer{Franz Schubert}
-%#%\tempo{M\"a\ss ig}
-%#%%
-%#%\meter{3/4}
-%#%\key\F
-%#%\clef\treble
-%#%%
-%#%\barnumbering5
-%#%%\staffnumbers
-%#%\barnumberstyle\boxed
-%#%%
-%#%\staffseparation{12}
-%#%%
-%#%\duration8
%%1
-melodie = music { $ \clef\violin
+melodie = \music { \clef\violin
\key{bes}
- \duration{ 8 }
- r\pp { [ d `a-| } f-| { d `a-| } f-| { d `a-| ] } |
+ \meter{3/4}\duration{ 8 }
+ r\pp < [ d `a-| > f-| < d `a-| > f-| < d `a-| ] > |
%%2
- r { [ d `bes-| } f-| { d `bes-| } f-| { d `bes-| ] } |
+ r < [ d `bes-| > f-| < d `bes-| > f-| < d `bes-| ] > |
%%3
\textstyle "italic"
- r_"simile" { [ d `bes } e { d `bes } e { d `bes ] }
+ r_"simile" < [ d `bes > e < d `bes > e < d `bes ] >
\textstyle "roman" |
%%4
- r { [ `a cis } e { `a cis } e { `a cis ] } |
+ r < [ `a cis > e < `a cis > e < `a cis ] > |
%#%:|
%%5
- [ a()bes a ]2/3 'd4. a |
+ [ a()bes a ]2/3 d'4. a |
%%6
- [ g()a g ]2/3 'd4 g r |
-%#%\tighten
-%#%\newline
+ [ g()a g ]2/3 d'4 g r |
+
%%7
a4.^> g [ g()f e ]2/3 |
%%8
f2 r4 |
%%9
-% { \music{ 'a4.( )'g [ 'g( 'f )'e ]2/3 } \music{ 'cis4. 'e_"dolce" [ 'e ] 2/3 } } |
- { \music{ 'a4.( )'g [ 'g( 'f )'e ]2/3 } \music{ 'cis4. 'e_"dolce" \plet{ 2/3 } 'e \plet{ 1/1 } } } |
+
+ < { a'4.( )g' [ g'( f' )e' ]2/3 } { cis'4. e'_"dolce" \plet{ 2/3 } e' \plet{ 1/1 } } > |
%%10
- { 'f2. 'd2. } |
+ < f'2. d'2. > |
%%11
- [ a\pp( )bes a ]2/3 'f4. a |
+ [ a\pp( )bes a ]2/3 f'4. a |
%%12
- [ g( ) a g ]2/3 'e4. 'd |
+ [ g( ) a g ]2/3 e'4. d' |
%%13
- 'c4. bes [ bes( ) a g ]2/3 |
+ c'4. bes [ bes( ) a g ]2/3 |
%%14
a2 r
-% { \music{ 'd( | )'c4. g [ bes a g ]2/3 } \music{ f\p( | )e4._"dolce" bes [ g ]2/3 } } |
- { \music{ 'd( | )'c4. g [ bes a g ]2/3 } \music{ f\p( | )e4._"dolce" bes \plet{ 2/3 } g \plet{ 1/1 } } } |
+% < { d'( | )c'4. g [ bes a g ]2/3 } { f\p( | )e4._"dolce" bes [ g ]2/3 } > |
+ < { d'( | )c'4. g [ bes a g ]2/3 } { f\p( | )e4._"dolce" bes \plet{ 2/3 } g \plet{ 1/1 } } > |
%%16
- { a2. f2. } |
+ < a2. f2. > |
%%17
\textstyle "italic"
- [ a8._"cresc." 'cis16 ] 'f4. 'e
+ [ a8._"cresc." cis'16 ] f'4. e'
\textstyle "roman" |
%%18
- [ 'd8. a16 ] f4. d |
+ [ d'8. a16 ] f4. d |
%%19
-%#% 'c\grace\stemup
- [ bes\pp( ) a bes ]2/3 'd4. bes |
+%#% c'\grace\stemup
+ [ bes\pp( ) a bes ]2/3 d'4. bes |
%%20
a2. |
%%21
%#% =f2. |
f2. |
%%23
- [ a8.\mf 'cis16 ] 'f4. 'e |
+ [ a8.\mf cis'16 ] f'4. e' |
%%24
- [ 'd8. a16 ] fis4. d |
+ [ d'8. a16 ] fis4. d |
%%25
-%#% 'cis\grace\stemup
- [ b\mf( ) ais b ]2/3 'd4. b |
+ [ b\mf( ) ais b ]2/3 d'4. b |
%%26
- { a2. fis2. } |
-%#%\tighten\newline
+ < a2. fis2. > |
%%27
- [ 'e\df( )'dis 'e ]2/3 'g4. 'cis |
+ [ e'\df( )dis' e' ]2/3 g'4. cis' |
%%28
- { 'd2. fis2. } |
+ < d'2. fis2. > |
%#%\volta1
%%29
- { \music { bes2( [ 'd8.( ))g16 ] } \music{ g2\mf [ bes8. bes16 ] } } |
+ < { bes2( [ d'8.( ))g16 ] } { g2\mf [ bes8. bes16 ] } > |
%%30
- { \music{ a4. [ a-. a-. a-. ] } \music{ fis4. [ fis-.( fis-. )fis-. ] } } |
+ < { a4. [ a-. a-. a-. ] } { fis4. [ fis-.( fis-. )fis-. ] } > |
%%31
- { \music{ a4. [ a-. a-. a-. ] } \music{ g4. [ cis-.( e-. )g-. ] } } |
+ < { a4. [ a-. a-. a-. ] } { g4. [ cis-.( e-. )g-. ] } > |
%%32
- { a2 fis2\pp } { a4 fis4 } |
+ < a2 fis2\pp > < a4 fis4 > |
%%33
-%#% { b2(^ g2 } [v { 'd8.( b8. } { b16 ) ) g16 } ] |
- { \music{ b2( [ 'd8.( ) )g16 ] } \music{ g2 [ b8. b16 ] } } |
+ < { b2( [ d'8.( ) )g16 ] } { g2 [ b8. b16 ] } > |
%%34
-%#% { a4. fis4. } [ { a-. fis-.( } { a-. fis-. } { a-. ) fis-. } ] |
-% { a4. fis4. } { [ a-. fis-. } { a-. fis-. } { a-. fis-. ] } |
- { \music{ a4. [ a-. a-. a-. ] } \music{ fis4. [ fis-.( fis-. )fis-. ] } } |
+ < { a4. [ a-. a-. a-. ] } { fis4. [ fis-.( fis-. )fis-. ] } > |
%%35
-%#% { a4. g4. } [ { a cis-.( } { a e-. } { a )- g-. } ] |
-% { a4. g4. } { [ a cis-. } { a e-. } { a g-. ] } |
- { \music{ a4. [ a-. a-. a-. ] } \music{ g4. [ cis-.( e-. )g-. ] } } |
+ < { a4. [ a-. a-. a-. ] } { g4. [ cis-.( e-. )g-. ] } > |
%%36
- { a2. fis2. } |
+ < a2. fis2. > |
%#%\volta2
%#%:|
%%37
- [ a8. a16 ] [ 'cis8. 'cis16 ] [ 'e8. 'e16 ] |
+ [ a8. a16 ] [ cis'8. cis'16 ] [ e'8. e'16 ] |
%%38
- 'd4( )'cis4 r4 |
+ d'4( )cis'4 r4 |
%%39
-%#% > a4. [ 'cis 'e8. >! 'd16 ] |
- a4. [ 'cis 'e8. 'd16 ] |
+%#% > a4. [ cis' e'8. >! d'16 ] |
+ a4. [ cis' e'8. d'16 ] |
%%40
- 'cis2 r4 |
+ cis'2 r4 |
%%41
-%#% { > 'fis4. 'cis4._f } 'e [ 'e( ) 'd >! 'cis ] |
- { 'fis4. 'cis4.\df } 'e [ 'e( )'d 'cis ]2/3 |
+ < fis'4. cis'4.\df > e' [ e'( )d' cis' ]2/3 |
%%42
- [ b8. 'cis16 ] 'd4^> b r |
+ [ b8. cis'16 ] d'4^> b r |
%%43
-%#% [^ { b8._{ }_{ }_{ }_{ }_{ }_f g2. } 'cis16 ] 'd4^> b r |
- [ b8.\df 'cis16 ] 'd4^> b r |
+
+ [ b8.\df cis'16 ] d'4^> b r |
%%44
-%#% [^ { > b8. fis2 } 'cis16 ] 'd4^> b >! r |
- [ b8. 'cis16 ] 'd4^> b r |
+ [ b8. cis'16 ] d'4^> b r |
%%45
-%#% 'cis\grace\stemup
- [ b\p( )ais b ]2/3 'd4. b |
+ [ b\p( )ais b ]2/3 d'4. b |
%%46
%#% { =a2. fis2. } |
- { a2. fis2. } |
+ < a2. fis2. > |
%%47
- [ 'e\df( )'dis 'e ]2/3 'g4.^> 'cis |
+ [ e'\df( )dis' e' ]2/3 g'4.^> cis' |
%%48
-%#% { fis2.(v ='d2.\stemup(^ }
-% { fis2. 'd2. } |
-%%49
-%#% { ) 'd4 ) =f2._> } { r4 s4_{decr} } 'd4\stemup
\textstyle "italic"
- { \multivoice \music{ \stem{ 1 } fis2.( | \stem{ -1 } )f2. } \music { \stem{ 1 } 'd2.( | \stem{ 1 } )'d4 r4_"decresc." 'd4 } }
+ < \multivoice { \stem{ 1 } fis2.( | \stem{ -1 } )f2. } { \stem{ 1 } d'2.( | \stem{ 1 } )d'4 r4_"decresc." d'4 } >
\textstyle "roman" |
%%50
- { bes2. e2. } |
+ < bes2. e2. > |
%%51
- { a2. cis2. } |
+ < a2. cis2. > |
%%52
- { fis2 d2 } { a4 fis4\pp } |
+ < fis2 d2 > < a4 fis4\pp > |
%%53
-%#% { bes2 g2 } [ { 'd8.^>( bes8. } { ) bes16 g16 } ] |
- { bes2 g2 } { [ 'd8.^> bes8. } { bes16 g16 ] } |
+
+ < bes2 g2 > < [ d'8.^> bes8. > < bes16 g16 ] > |
%%54
-%#% { a4. fis4. } [ { a-. fis-.( } { a-. fis-. } { a-. ) fis-. } ] |
-% { a4. fis4. } { [ a-. fis-. } { a-. fis-. } { a-. fis-. ] } |
- { \music{ a4. [ a-. a-. a-. ] } \music{ fis4. [ fis-.( fis-. )fis-.] } } |
+ < { a4. [ a-. a-. a-. ] } { fis4. [ fis-.( fis-. )fis-.] } > |
%%55
-%#% { a4. g4. } [ { a cis-.( } { a e-. } { a )- g-. } ] |
-% { a4. g4. } { [ a cis-. } { a e-. } { a g-. ] } |
- { \music{ a4. [ a-. a-. a-. ] } \music{ g4. [ cis-.( e-. )g-. ] } } |
+ < { a4. [ a-. a-. a-. ] } { g4. [ cis-.( e-. )g-. ] } > |
%%56
\textstyle "italic"
- { a2. fis2._"dim." }
+ < a2. fis2._"dim." >
\textstyle "roman" |
%%57
- { a2. fis2. } |
+ < a2. fis2. > |
%%58
- { a2.^\fermata fis2. } |
+ < a2.^\fermata fis2. > |
%#%\tighten
-$ }
+ }
-begeleiding = music { $
- \key{bes}
+begeleiding = \music {
+ \key{bes}\meter{3/4}
\clef\bass
\duration{2}
`d r4 |
``a r4 |
%#%:|
%%5
-%#%\stemlength2
\duration{ 8 }
-%#% { =`f `d2 } `a d `a { d r4 } `a
- { \multivoice \music{ \stem{ 1 } [ `f `a d `a d `a ] } \music { \stem{ -1 } `d2 r4 } } |
+ < \multivoice { \stem{ 1 } [ `f `a d `a d `a ] } { \stem{ -1 } `d2 r4 } > |
%%6
- { \multivoice \music{ \stem{ 1 } [ `d `e `g `e `g `e ] } \music { \stem{ -1 } ``bes2 r4 } } |
+ < \multivoice { \stem{ 1 } [ `d `e `g `e `g `e ] } { \stem{ -1 } ``bes2 r4 } > |
%%7
- { \multivoice \music{ \stem{ 1 } [ `cis `e `g `e `g e ] } \music { \stem{ -1 } ``a2 r4 } } |
+ < \multivoice { \stem{ 1 } [ `cis `e `g `e `g e ] } { \stem{ -1 } ``a2 r4 } > |
%%8
- { \multivoice \music{ \stem{ 1 } [ `d `a d `a d `a ] } \music { \stem{ -1 } `d2 r4 } } |
+ < \multivoice { \stem{ 1 } [ `d `a d `a d `a ] } { \stem{ -1 } `d2 r4 } > |
%%9
[ `a e g e g e ] |
%%10
[ `d `a d `a d `a ] |
%%11
- { \multivoice \music{ \stem{ 1 } [ `f `a d `a d `a ] } \music { \stem{ -1 } `d2 r4 } } |
+ < \multivoice { \stem{ 1 } [ `f `a d `a d `a ] } { \stem{ -1 } `d2 r4 } > |
%%12 == 6
- { \multivoice \music{ \stem{ 1 } [ `d `e `g `e `g `e ] } \music { \stem{ -1 } ``bes2 r4 } } |
+ < \multivoice { \stem{ 1 } [ `d `e `g `e `g `e ] } { \stem{ -1 } ``bes2 r4 } > |
%13
- { \multivoice \music{ [ `e `g `bes `g `bes `g ] } \music { \stem{ -1 } `c2 r4 } } |
+ < \multivoice { [ `e `g `bes `g `bes `g ] } { \stem{ -1 } `c2 r4 } > |
%%14
- { \multivoice \music{ \stem{ 1 } [ `a c f c f c ] } \music { \stem{ -1 } `f2 r4 } } |
+ < \multivoice { \stem{ 1 } [ `a c f c f c ] } { \stem{ -1 } `f2 r4 } > |
%%15
[ `c `g `bes `g `bes `g ] |
%%16
[ ``f `c `f `c `f `c ] |
%%17
- { \multivoice \music{ \stem{ 1 } [ ``a `e `g `e `g `e ] } \music { \stem{ -1 } ``a2 r4 } } |
+ < \multivoice { \stem{ 1 } [ ``a `e `g `e `g `e ] } { \stem{ -1 } ``a2 r4 } > |
%%18
- { \multivoice \music{ \stem{ 1 } [ `d `a d `a d `a ] } \music { \stem{ -1 } `d2 r4 } } |
+ < \multivoice { \stem{ 1 } [ `d `a d `a d `a ] } { \stem{ -1 } `d2 r4 } > |
%%19
- { \multivoice \music{ \stem{ 1 } [ ``bes `f `bes `f `bes `f ] } \music { \stem{ -1 } ``bes2 r4 } } |
+ < \multivoice { \stem{ 1 } [ ``bes `f `bes `f `bes `f ] } { \stem{ -1 } ``bes2 r4 } > |
%%20
- { \multivoice \music{ \stem{ 1 } [ ``f `c `f `c `f `c ] } \music { \stem{ -1 } ``f2 r4 } } |
+ < \multivoice { \stem{ 1 } [ ``f `c `f `c `f `c ] } { \stem{ -1 } ``f2 r4 } > |
%%21
-%#% s8 % skip space of grace note
- { [ `e `c } `g c `g c `g ] |
+ < [ `e `c > `g c `g c `g ] |
%%22
[ `f `a c `a `f `c ] |
%%23
- { \multivoice \music{ \stem{ 1 } [ ``a `e `g `e `g `e ] } \music { \stem{ -1 } ``a2 r4 } } |
+ < \multivoice { \stem{ 1 } [ ``a `e `g `e `g `e ] } { \stem{ -1 } ``a2 r4 } > |
%%24
- { \multivoice \music{ \stem{ 1 } [ `d `fis `a `fis `a `fis ] } \music { \stem{ -1 } `d2 r4 } } |
+ < \multivoice { \stem{ 1 } [ `d `fis `a `fis `a `fis ] } { \stem{ -1 } `d2 r4 } > |
%%25
-%#% s8 % skip space of grace note
- { \multivoice \music{ \stem{ 1 } [ ``g `d `b `d `b `d ] } \music { \stem{ -1 } ``g2 r4 } } |
+ < \multivoice { \stem{ 1 } [ ``g `d `b `d `b `d ] } { \stem{ -1 } ``g2 r4 } > |
%%26
- { \multivoice \music{ \stem{ 1 } [ `d `a d `a d `a ] } \music { \stem{ -1 } `d2 r4 } } |
+ < \multivoice { \stem{ 1 } [ `d `a d `a d `a ] } { \stem{ -1 } `d2 r4 } > |
%%27
- { [ `cis ``a } `e `a `e `a `e ] |
+ < [ `cis ``a > `e `a `e `a `e ] |
%%28
[ `d `a d `a d `a ] |
%%29
-%#% [ `d `g @ `bes `g `bes `g ] |
[ `d `g `bes `g `bes `g ] |
%#%\volta1
%%30
%%37
[ ``a `e `g `e ``bes^> `e ] |
%%38
- [ ``a { e cis `a } { e cis `a } { e cis `a } { e cis `a } { e cis `a ] } |
+ [ ``a < e cis `a > < e cis `a > < e cis `a > < e cis `a > < e cis `a ] > |
%%39
[ ``a `e `g `e ``bes^> `e ] |
%%40
- [ ``a { e cis `a } { e cis `a } { e cis `a } { e cis `a } { e cis `a ] } |
+ [ ``a < e cis `a > < e cis `a > < e cis `a > < e cis `a > < e cis `a ] > |
%%41
[ ``ais `e `fis `e `fis `e ] |
%%42
- { [ `d ``b } `fis `b `fis `b `fis ] |
+ < [ `d ``b > `fis `b `fis `b `fis ] |
%%43
- { [ `e ``b } `g `b `g `b `g ] |
+ < [ `e ``b > `g `b `g `b `g ] |
%%44
- { [ `d ``b } `fis `b `fis `b `fis ] |
+ < [ `d ``b > `fis `b `fis `b `fis ] |
%%45
-%#% s8 % skip space of grace note
- { \multivoice \music{ \stem{ 1 } [ ``g `d `b `d `b `d ] } \music { \stem{ -1 } ``g2 r4 } } |
+ < \multivoice { \stem{ 1 } [ ``g `d `b `d `b `d ] } { \stem{ -1 } ``g2 r4 } > |
%%46
- { \multivoice \music{ \stem{ 1 } [ `d `a d `a d `a ] } \music { \stem{ -1 } `d2 r4 } } |
+ < \multivoice { \stem{ 1 } [ `d `a d `a d `a ] } { \stem{ -1 } `d2 r4 } > |
%%47
- { [ `cis ``a } `e `a `e `a `e ] |
+ < [ `cis ``a > `e `a `e `a `e ] |
%%48
[ `d `fis `a `fis `a `fis ] |
%%49
%%57
[ ``d ``a `d ``a `d ``a ]
%%58
- { `d2.^\fermata ``d2. } |
-$ }
+ < `d2.^\fermata ``d2. > |
+ }
-tekst1 = music {
- @
+tekstI = \lyrics {
+ \meter{3/4}
\duration{4}
_ _ _
_ _ _
_ _ _ _ _ _
% 57
_ _ _ _ _ _
- @
+
}
-tekst2 = music {
- @
+tekstII= \lyrics {
+ \meter{3/4}
\duration{4}
_ _ _
_ _ _
% _ _ _ _ _ _
% 57
% _ _ _ _ _ _
- @
+
}
-score {
- staff {
+\score {
+ \staff {
lyric
- music { tekst1 }
- music { tekst2 }
- }
- staff {
- melodic
- music { melodie }
- }
- staff {
- melodic
- music { begeleiding }
+ \music { tekstI }
+ \music { tekstII }
}
- commands {
- meter {3*4}
+% Setting up music ...lilypond: ../flower/include/cursor.inl:98: class Cursor<void *> Cursor<void *>::operator ++(int): Assertion `pointer_' failed.
+%IOT trap/Abort
+% \music { melodie }
+ \staff {
+ \melodic
+ \music { begeleiding }
+ }
+ \staff {
+ \melodic
+ \music { begeleiding }
}
- paper {
- symboltables { table_sixteen }
- width 195mm
+ \paper {
+ \width 195\mm
% on two pages...
- unitspace 9mm
- geometric 1.2
- output "standchen.out"
+ \unitspace 9\mm
+ \geometric 1.2
+ \output "standchen.out"
}
- midi {
- tempo 4:54
+ \midi {
+ \tempo 4:54
}
}
%
% Copyright: none
-melodie = music {
- $\clef\violin
+melodie = \music {
+ \clef\violin
c c | g g | a a | g g |
f f | e e | d d8.( e16 | )c2 | % :|
g g | f f | e e | d d |
-% g g | f f | e( [f0*32 e0*32 d0*32] e8. f16 | e )d | c c |
g g | f f | e( e8. f16 | e )d |
c c | g g | a a | g g |
f f | e e | d d8.( e16 | )c2 % :|
\bar ":|"
- $
+
}
-begeleiding = music {
- $\clef \bass
+begeleiding = \music {
+ \clef \bass
\octave{`}
- c 'c | 'e 'c | 'f 'c | 'e 'c |
- 'd b | 'c a | f g | c2 |
+ c c' | e' c' | f' c' | e' c' |
+ d' b | c' a | f g | c2 |
- 'e g | d g | 'c g | b g |
-% 'e g | 'd g | 'c 'c8.( 'd16 | \voice{ 'c )b } \voice{ g2 } |
- 'e g | 'd g | 'c 'c8.( 'd16 | 'c )b |
+ e' g | d g | c' g | b g |
+ e' g | d' g | c' c'8.( d'16 | c' )b |
- c 'c | 'e 'c | 'f 'c | 'e 'c |
- 'd b | 'c a | f g | c2
+ c c' | e' c' | f' c' | e' c' |
+ d' b | c' a | f g | c2
\bar ":|"
- $
+
}
-
-tekst = music {
- @
+globalmusic=\music{
+ \meter {2 / 4}
+ \skip {24*2}
+ \bar "||"
+ }
+tekst = \lyrics {
Al- tijd is Kort- jak- je ziek,2
- midden in_de week maar 's_zon- dags niet.2
- 's_Zon- dags gaat ze naar de kerk,2
+ midden in_de week maar s'_zon- dags niet.2
+ s'_Zon- dags gaat ze naar de kerk,2
met een boek vol zil- ver werk.2
Al- tijd is Kort- jak- je ziek,2
- midden in_de week maar 's_zon- dags niet.2
- @
+ midden in_de week maar s'_zon- dags niet.2
}
-he_gedraagje_tekst = music {
- @
+hegedraagjetekst = \lyrics {
Al- tijd zuigt Bill Gates mijn piek,2
"\TeX" is slecht- ser dan mu- ziek.2
- 's_Zon- dags gaat het door een raam,2
+ s'_Zon- dags gaat het door een raam,2
Weet dat ik me er- voor schaam.2
Al- tijd zuigt Bill Gates mijn piek,2
"\TeX" is slecht- ser dan mu- ziek.2
- @
}
-texte = music {
- @
+texte = \lyrics {
+
\textstyle "italic"
Ah! vous dir- ai_- je ma man2
Ce qui cau- se mon tour- ment2
Pa- pa veut que je rai- sonne2
- Comme un- e grand- e per- sonne2
+ Co\mme un- e grand- e per- sonne2
Moi je dis que les bon- bons2
Val- ent mieux que la rai- son2
- @
+
}
-text1 = music {
- @
+textI = \lyrics {
+
\textstyle "roman"
Twin- kle, twin- kle, lit- tle star,2
How I won- der what you are.2
Like a dia- mond in the sky.2
Twin- kle, twin- kle, lit- tle star,2
How I won- der what you are!2
- @
+
}
-text2 = music {
- @
+textII = \music {
+
\textstyle "roman"
When the bla- zing sun is gone,2
When he no- thing shines up- on,2
Twin- kle, twin- kle, all the night.2
Twin- kle, twin- kle, lit- tle star,2
How I won- der what you are!2
- @
+
}
-text3 = music {
- @
+textIII = \lyrics{
+
\textstyle "roman"
Then the tra- veler in the dark2
Thanks you for your ti- ny spark;2
If you did not twin- kle so.2
Twin- kle, twin- kle, lit- tle star,2
How I won- der what you are!2
- @
+
}
-mstaf = staff {
- melodic
- music { melodie }
+mstaf = \staff {
+ \melodic
+ \music { melodie }
+ \music { globalmusic }
}
-bass_staf = staff {
- melodic
- music { begeleiding }
+bassstaf = \staff {
+ \melodic
+ \music { begeleiding }
+ \music { globalmusic }
}
-dutch_staf = staff {
+dutchstaf = \staff {
lyric
- music { tekst }
- music {he_gedraagje_tekst}
+ \music { tekst }
+ \music {hegedraagjetekst}
+ \music { globalmusic }
}
-french_staf = staff {
+frenchstaf = \staff {
lyric
- music { texte }
+ \music { texte }
+ \music { globalmusic }
}
-english_staf = staff {
+englishstaf = \staff {
lyric
- music { text1 }
- music { text2 }
- music { text3 }
+ \music { textI }
+ \music { textII }
+ \music { textIII }
+ \music { globalmusic }
}
-tstaf = staff {
+tstaf = \staff {
lyric
- music { tekst }
- music { texte }
+ \music { tekst }
+ \music { texte }
+ \music { globalmusic }
}
-score {
- staff { mstaf }
- staff { dutch_staf }
- staff { french_staf }
- staff { english_staf }
- staff { bass_staf }
- paper {
- unitspace 2.5cm
- }
- commands {
- meter {2 * 4}
- skip {24*2}
-% bar "||"
+\score {
+ \staff { mstaf }
+ \staff { dutchstaf }
+ \staff { frenchstaf }
+ \staff { englishstaf }
+ \staff { bassstaf }
+ \paper {
+ \unitspace 2.5\cm
}
- midi {
- tempo 4:120
+
+ \midi {
+ \tempo 4:120
}
}
% JS Bach, Das Wohltemperirtes Clavier I, Fuga II (c-minor)
%
-% a 7 bar fragment
+% a 7 \bar fragment
%
% Public Domain -- typed by by HWN
%
+global=\music{\meter {4/4}
+ \grouping {2*2}
+ \key {bes es as}}
-dux = music { $
+dux = \music {
\clef \violin
\duration { \last }
r8-"dux" \stem{-1}
- ['c16 b] ['c8 g] [as 'c16 b] ['c8 'd] |
- [g 'c16 b] ['c8 'd] [f16 g] as4 [g16 f] |
- [es 'c b a] [ g f es d] [c8 'es 'd 'c] |
- [bes a bes 'c] [fis g a fis] |
+ [c'16 b] [c'8 g] [as c'16 b] [c'8 d'] |
+ [g c'16 b] [c'8 d'] [f16 g] as4 [g16 f] |
+ [es c' b a] [ g f es d] [c8 es' d' c'] |
+ [bes a bes c'] [fis g a fis] |
g4 r16 [c d es] [f g as8(] [)as16 d es f ]|
- [g a bes8(] [)bes16 es f g ] [as g f es] [d8 'c16 b]|
- 'c4 r4 r8 ['f 'es 'd]
+ [g a bes8(] [)bes16 es f g ] [as g f es] [d8 c'16 b]|
+ c'4 r4 r8 [f' es' d']
r8 [as g f] [g f16 es] [f8 d] |
-$}
+}
-comes = music { $
+comes = \music {
\octave {'}
r1 \stem{1}
|
[) f8 es16 d] [c16 `bes `as `g] [`f8 as g f]
[es d es f] [`b c d `b] |
-$}
+}
-bassdux = music { $
+bassdux = \music {
\clef \bass
\octave { }
r1 |
r1 |
r8 [c16 B] [c8 G] [As c16 B] [c8 d] |
[G c16 B] [c8 d] [F16 G] As4 [G16 F] |
-$}
+}
-trebstaf = staff { melodic
- % every "music {} " in a staff has its own "voicegroup"
- music { dux }
- music { comes }
-
+trebstaf = \staff { \melodic
+ % every "\music {} " in a \staff has its own "\voicegroup"
+ \music { dux }
+ \music { comes }
+ \music{global}
}
-basstaf = staff { melodic
- music { bassdux }
+basstaf = \staff { \melodic
+ \music { bassdux }
+ \music{global}
}
-
-score {
- staff { trebstaf }
- staff { basstaf }
+\score {
+ \staff { trebstaf }
+ \staff { basstaf }
- commands {
- meter {4*4}
- grouping {2*2}
- key {$bes es as$}
- }
- paper {}
- midi {
- tempo 4:90
+ \paper {}
+ \midi {
+ \tempo 4:90
}
}
# generic variables:
#
include ./$(depth)/make/Variables.make
+include ./$(depth)/make/Files.make
+include ./$(depth)/make/Version.make
#
# identify module:
#
NAME = lily
-MAJOR_VERSION = $(TOPLEVEL_MAJOR_VERSION)
-MINOR_VERSION = $(TOPLEVEL_MINOR_VERSION)
-PATCH_LEVEL = $(TOPLEVEL_PATCH_LEVEL)
-# use to send patches, always empty for released version:
-MY_PATCH_LEVEL = $(TOPLEVEL_MY_PATCH_LEVEL)
-build = $(lily-dir)/$(outdir)/.build
#
# descent order into subdirectories:
VERSION_DEPENDENCY =#
#
-# list of c++ header files:
-#
-HHFILES = $(shell ls *.hh $(ERROR_LOG))
-#
-
-# list of c++ source files:
-#
-CCFILES = $(shell ls *.cc $(ERROR_LOG))
-#
-
-# list of other source files:
-#
-EXTRA_SOURCE_FILES = # $(shell ls *.y *.l $(ERROR_LOG))
-#
-
# list of distribution files:
#
-DISTFILES = Makefile $(HHFILES) $(CCFILES) $(EXTRA_SOURCE_FILES)
+DISTFILES = Makefile $(ALL_SOURCES)
#
# list of custom libraries:
# list of depend files:
#
-DEPFILES = $(shell ls $(depdir)/*.dep $(ERROR_LOG))
+
#
# auto dependencies:
# identify module:
#
MODULE_NAME = lilypond
-MAJOR_VERSION = $(TOPLEVEL_MAJOR_VERSION)
-MINOR_VERSION = $(TOPLEVEL_MINOR_VERSION)
-PATCH_LEVEL = $(TOPLEVEL_PATCH_LEVEL)
-# use to send patches, always empty for released version:
-MY_PATCH_LEVEL = $(TOPLEVEL_MY_PATCH_LEVEL)
-build = ./$(depth)/lily/$(outdir)/.build
-#
# generic stuff/Makefile
#
+
include ./$(depth)/make/Include.make
-#
+
MAJOR_VERSION = 0
MINOR_VERSION = 0
-PATCH_LEVEL = 41
-MY_PATCH_LEVEL=
\ No newline at end of file
+PATCH_LEVEL = 42
+# use to send patches, always empty for released version:
+# include separator: ".postfix", "-pl" makes rpm barf
+
+MY_PATCH_LEVEL =.2
+#
-#
# project LilyPond -- the musical typesetter
# title makefile for lilypond
# file lily/Makefile
# generic variables:
#
-include ./$(depth)/make/Variables.make
+include ./$(depth)/make/Variables.make
+include ./$(depth)/make/Files.make
+include .version
+
#
# identify module:
#
NAME = lilypond
-MAJOR_VERSION = $(TOPLEVEL_MAJOR_VERSION)
-MINOR_VERSION = $(TOPLEVEL_MINOR_VERSION)
-PATCH_LEVEL = $(TOPLEVEL_PATCH_LEVEL)
-# use to send patches, always empty for released version:
-MY_PATCH_LEVEL = $(TOPLEVEL_MY_PATCH_LEVEL)
-build = $(lily-dir)/$(outdir)/.build
+
#
# descent order into subdirectories:
VERSION_DEPENDENCY = $(lily-version)
#
-# list of c++ header files:
-#
-HHFILES := $(wildcard *.hh) #$(shell ls *.hh $(ERROR_LOG))
-#
-
-# list of c++ source files:
-#
-CCFILES := $(wildcard *.cc) #$(shell ls *.cc $(ERROR_LOG))
-#
-
-# list of other source files:
-#
-EXTRA_SOURCE_FILES = $(shell ls *.y *.l $(ERROR_LOG))
-#
# list of distribution files:
#
-DISTFILES = .version Makefile $(HHFILES) $(CCFILES) $(EXTRA_SOURCE_FILES)
+DISTFILES = .version Makefile $(ALL_SOURCES)
#
# list of custom libraries:
#
# yes, i know about the -L and -l options,
-# but these libraries get rebuild when needed.
+# but these libraries get rebuilt when needed.
CUSTOMLIBES = $(LIBLILY) $(LIBFLOWER)
LOADLIBES +=
include ./$(depth)/make/Rules.make
#
-# explicit dependencies: (how to do auto?)
-#
-# ugh
-#$(outdir)/version.cc: check-flower-version $(lily-version)
-
-
-mylexer.cc: $(outdir)/parser.hh # sic
+# force these: Make can't know these have to be generated in advance
+mylexer.cc: $(outdir)/parser.hh
lexer.l: $(outdir)/parser.hh
+
#
# list of depend files:
#
-DEPFILES = $(shell ls $(depdir)/*.dep $(ERROR_LOG))
+DEPFILES = $(wildcard $(depdir)/*.dep)
#
# auto dependencies:
Stem_info(){}
- Stem_info(const Stem*);
+ Stem_info(Stem const *);
};
-Stem_info::Stem_info(const Stem*s)
+Stem_info::Stem_info(Stem const *s)
{
x = s->hindex();
int dir = s->dir;
void
Clef_register::process_requests()
{
- const Time_description *time_l = get_staff_info().time_c_l_;
+ Time_description const *time_l = get_staff_info().time_c_l_;
if (!clef_req_l_ && (!time_l->whole_in_measure_|| !time_l->when_)) {
clef_p_ = new Clef_item;
clef_p_->change = false;
int
-Bar_req::compare(const Bar_req &c1)const
+Bar_req::compare(Bar_req const &c1)const
{
return type_str_ == c1.type_str_;
}
parse_dimen(String dim)
{
int i=dim.length_i()-1;
- const char *s = dim;
+ char const *s = dim;
while (i > 0 && (isspace(s[i]) || isalpha(s[i])) ){
i--;
}
#endif
}
-Idealspacing::Idealspacing(const PCol * l,const PCol * r)
+Idealspacing::Idealspacing(PCol const * l,PCol const * r)
{
space = 0.0;
hooke = 0.0;
#include "lexer.hh"
#include "debug.hh"
+#include "input-score.hh"
+#include "symtable.hh"
+#include "input-staff.hh"
+#include "input-music.hh"
+#include "lookup.hh"
+#include "script-def.hh"
+#include "request.hh"
+
void
Identifier::error(String expect)
{
DEFAULT_PRINT(M_chord_id, Music_general_chord, mchord);
DEFAULT_PRINT(M_voice_id, Music_voice, mvoice);
DEFAULT_PRINT(Request_id, Request, request);
+DEFAULT_PRINT(Score_id, Input_score, score);
void
Real_id::do_print() const
{
mtor << *((Real_id*)this)->real(false)<< "\n";
}
+#define implement_id_class(Idclass, Class, accessor) \
+char const * Idclass::classname() const\
+{\
+ return #Class;\
+}\
+Class*\
+Idclass::accessor(bool copy) {\
+ if (copy)\
+ return new Class(* (Class*) data);\
+ else\
+ return (Class*) data;\
+ }\
+Idclass::~Idclass() { delete accessor(false); }\
+Idclass::Idclass(String s, Class*st, int code):Identifier(s,code) { data = st; }\
+
+
+implement_id_class(Real_id, Real, real)
+implement_id_class(Script_id, Script_def, script)
+implement_id_class(Lookup_id, Lookup, lookup)
+implement_id_class(Symtables_id, Symtables, symtables)
+implement_id_class(Staff_id, Input_staff, staff)
+implement_id_class(M_chord_id, Music_general_chord, mchord)
+implement_id_class(M_voice_id, Music_voice, mvoice)
+implement_id_class(Score_id, Input_score, score)
+implement_id_class(Request_id, Request, request)
# identify module:
#
MODULE_NAME = lilypond
-MAJOR_VERSION = $(TOPLEVEL_MAJOR_VERSION)
-MINOR_VERSION = $(TOPLEVEL_MINOR_VERSION)
-PATCH_LEVEL = $(TOPLEVEL_PATCH_LEVEL)
-# use to send patches, always empty for released version:
-MY_PATCH_LEVEL = $(TOPLEVEL_MY_PATCH_LEVEL)
-build = ./$(depth)/lily/$(outdir)/.build
-#
-
-# generic stuff/Makefile
-#
include ./$(depth)/make/Include.make
-#
/// a macro to declare the classes name as a static and virtual function.
#define NAME_MEMBERS(c) \
-static const char *static_name(){ return #c; }\
-virtual const char *name() const{ return c::static_name(); } \
+static char const *static_name(){ return #c; }\
+virtual char const *name() const{ return c::static_name(); } \
int a_stupid_nonexistent_function_to_allow_the_semicolon_come_out()
#endif // CLASS-NAME_HH
Real hooke;
/// the two columns
- const PCol *left, *right;
+ PCol const *left, *right;
void print()const;
void OK() const ;
- Idealspacing(const PCol *left,const PCol *right);
+ Idealspacing(PCol const *left,PCol const *right);
};
-
/*
identifier.hh -- part of LilyPond
#ifndef IDENTIFIER_HH
#define IDENTIFIER_HH
-#include "identparent.hh"
-#include "symtable.hh"
-#include "input-staff.hh"
-#include "input-music.hh"
-#include "lookup.hh"
-#include "script-def.hh"
-#include "request.hh"
+#include "proto.hh"
+#include "string.hh"
+
+/* boolean argument to accesor is copy_b..*/
+#define IDACCESSOR( Input_staff, staff)\
+ virtual Input_staff * staff(bool) { error(#Input_staff); return 0; }
+
+
+struct Identifier {
+ void *data;
+ String name;
+ int token_code_i_;
-#define make_id_class(Idclass, Class, accessor) \
+ Identifier(String n, int code) : name(n) { token_code_i_ = code; }
+ virtual ~Identifier() {}
+
+ void print()const;
+ virtual char const *classname() const{ return "new Identifier"; }
+ void error(String);
+ IDACCESSOR(Input_staff, staff)
+ IDACCESSOR(Input_music, music)
+ IDACCESSOR(Music_voice, mvoice)
+ IDACCESSOR(Script_def, script)
+ IDACCESSOR(Symtables, symtables)
+ IDACCESSOR(Music_general_chord, mchord)
+ IDACCESSOR(Lookup,lookup)
+ IDACCESSOR(Real,real)
+ IDACCESSOR(Request, request)
+ IDACCESSOR(Input_score, score)
+
+protected:
+ virtual void do_print()const=0;
+private:
+ Identifier(Identifier const&){}
+};
+
+#define declare_id_class(Idclass, Class, accessor) \
struct Idclass : Identifier {\
- virtual const char *classname() { return #Class; }\
- Idclass(String s, Class*st, int code):Identifier(s,code) { data = st; }\
- virtual Class* accessor(bool copy) {\
- if (copy)\
- return new Class(* (Class*) data);\
- else\
- return (Class*) data;\
- }\
- ~Idclass() { delete accessor(false); }\
- virtual void do_print()const; \
+ virtual char const *classname()const;\
+ Idclass(String s, Class*st, int code);\
+ virtual Class* accessor(bool copy);\
+ ~Idclass();\
+ virtual void do_print()const; \
}\
-make_id_class(Real_id, Real, real);
-make_id_class(Script_id, Script_def, script);
-make_id_class(Lookup_id, Lookup, lookup);
-make_id_class(Symtables_id, Symtables, symtables);
-make_id_class(Staff_id, Input_staff, staff);
-make_id_class(M_chord_id, Music_general_chord, mchord);
-make_id_class(M_voice_id, Music_voice, mvoice);
-make_id_class(Request_id, Request, request);
-#endif // IDENTIFIER_HH
+declare_id_class(Real_id, Real, real);
+declare_id_class(Script_id, Script_def, script);
+declare_id_class(Lookup_id, Lookup, lookup);
+declare_id_class(Symtables_id, Symtables, symtables);
+declare_id_class(Staff_id, Input_staff, staff);
+declare_id_class(M_chord_id, Music_general_chord, mchord);
+declare_id_class(M_voice_id, Music_voice, mvoice);
+declare_id_class(Score_id, Input_score, score);
+declare_id_class(Request_id, Request, request);
+
+#endif // IDENTIFIER_
-/*
- identparent.hh -- part of LilyPond
-
- (c) 1996,97 Han-Wen Nienhuys
-*/
-
-#ifndef IDENTPARENT_HH
-#define IDENTPARENT_HH
-
-#include "proto.hh"
-#include "string.hh"
-
-/* boolean argument to accesor is copy_b..*/
-#define IDACCESSOR( Input_staff, staff)\
- virtual Input_staff * staff(bool) { error(#Input_staff); return 0; }
-
-
-struct Identifier {
- void *data;
- String name;
- int token_code_i_;
-
- Identifier(String n, int code) : name(n) { token_code_i_ = code; }
- virtual ~Identifier() {}
-
- void print()const;
- virtual const char*classname() { return "new Identifier"; }
- void error(String);
- IDACCESSOR(Input_staff, staff)
- IDACCESSOR(Input_music, music)
- IDACCESSOR(Music_voice, mvoice)
- IDACCESSOR(Script_def, script)
- IDACCESSOR(Symtables, symtables)
- IDACCESSOR(Music_general_chord, mchord)
- IDACCESSOR(Lookup,lookup)
- IDACCESSOR(Real,real)
- IDACCESSOR(Request, request)
-
-protected:
- virtual void do_print()const=0;
-private:
- Identifier(Identifier const&){}
-
-};
-#endif // IDENTPARENT_HH
-
-
-
+#error
/// the total music def of one movement
struct Input_score {
/// defined where?
- const char* defined_ch_c_l_;
+ char const * defined_ch_c_l_;
int errorlevel_i_;
/// paper_, staffs_ and commands_ form the problem definition.
Midi_def* midi_p_;
IPointerList<Input_staff*> staffs_;
- Input_music * score_wide_music_p_;
/* *************************************************************** */
Input_score();
void set(Midi_def* midi_p);
void print() const;
Score*parse();
- void set(Input_music*);
};
#endif
struct Input_staff {
- const char * defined_ch_c_l_;
+ char const * defined_ch_c_l_;
String type;
IPointerList<Input_music*> music_;
- Input_music * score_wide_music_p_;
/* *************** */
~Input_staff();
void add(Input_music*m);
Input_staff(Input_staff const&);
Input_staff(String);
- void set_score_wide(Input_music*m);
- Staff* parse(Score*, Input_music *score_wide);
+ Staff* parse(Score*);
void print() const;
};
/* for the keyword table */
struct Keyword_ent
{
- const char *name;
+ char const *name;
int tokcode;
};
Keyword_ent *table;
int maxkey;
Keyword_table(Keyword_ent *);
- int lookup(const char *s) const;
+ int lookup(char const *s) const;
};
#include "string.hh"
int yylex();
-void yyerror(const char *s);
+void yyerror(char const *s);
bool busy_parsing();
void kill_lexer();
void set_lexer();
char const* here_ch_c_l();
int lookup_keyword(String);
void lookup_notename(int &large, int &small, String s);
- void LexerError(const char *);
+
+ void push_note_state();
+ void push_lyric_state();
+ void pop_state();
+ void LexerError(char const *);
String spot() const;
Identifier*lookup_identifier(String s);
My_flex_lexer();
/// helper struct for #Spacing_problem#
struct Colinfo {
- const PCol *pcol_;
- const Real* fixpos;
+ PCol const *pcol_;
+ Real const * fixpos;
Interval width;
/* *************** */
void operator=(Colinfo const&);
Colinfo(Colinfo const&);
~Colinfo();
- Colinfo(const PCol*,const Real*);
+ Colinfo(PCol const *,Real const *);
void print() const;
bool fixed() const { return fixpos;}
Real fixed_position()const { return *fixpos; }
springs. The lower the energy, the better the configuration.
*/
class Spacing_problem {
- Array<const Idealspacing*> ideals;
+ Array<Idealspacing const *> ideals;
Array<Colinfo> cols;
/// the index of #c# in #cols#
- int col_id(const PCol *c) const;
+ int col_id(PCol const *c) const;
/// generate an (nonoptimal) solution
Vector find_initial_solution() const;
bool check_feasible() const;
/// does #this# contain the column #w#?
- bool contains(const PCol *w);
+ bool contains(PCol const *w);
/// make the energy function
void make_matrices(Matrix &quad, Vector &lin,Real&) const;
since they can be "summed" if the columns to which #i# refers are
not in this problem, the spacing is ignored.
*/
- void add_ideal(const Idealspacing *i);
+ void add_ideal(Idealspacing const *i);
/** add a col to the problem. columns have to be added left to right. The column contains
info on it's minimum width.
*/
- void add_column(const PCol *, bool fixed=false, Real fixpos=0.0);
+ void add_column(PCol const *, bool fixed=false, Real fixpos=0.0);
Vector try_initial_solution() const;
void OK() const;
void print() const;
- void print_ideal(const Idealspacing*)const;
+ void print_ideal(Idealspacing const *)const;
};
struct Local_key_register : Request_register {
Local_key local_key_;
Local_key_item* key_item_p_;
- const Key *key_c_l_;
+ Key const *key_c_l_;
/* *************** */
virtual void process_requests();
virtual void acknowledge_element(Staff_elem_info);
/// 0 natural, 1 sharp, etc
int accidental_i_;
- /// force/supress printing of accidental.
- bool forceacc_b_;
/// return height from central c (in halflines)
int height()const;
/// Put a note of specified type, height, and with accidental on the staff.
struct Note_req : Rhythmic_req, virtual Melodic_req {
-
+ /// force/supress printing of accidental.
+ bool forceacc_b_;
+ Note_req();
Rhythmic_req* rhythmic() { return Rhythmic_req::rhythmic(); }
REQUESTMETHODS(Note_req, note);
};
struct Dynamic_req : Subtle_req {
/// for absolute dynamics
enum Loudness {
- FFF, FF, F, MF, MP, P, PP, PPP
+ FFF, FF, F, MF, MP, P, PP, PPP
};
static String loudness_str(Loudness);
REQUESTMETHODS(Dynamic_req, dynamic);
*/
struct PCol {
- PointerList<const Item*> its;
- PointerList<const Spanner*> stoppers, starters;
+ PointerList<Item const *> its;
+ PointerList<Spanner const *> stoppers, starters;
PCol *daddy_l_;
/// if lines are broken then this column is in #line#
- const Line_of_score *line_l_;
+ Line_of_score const *line_l_;
/// if lines are broken then this column x-coord #hpos#
Real hpos;
/**
@return argument as a cursor of the list
*/
- PCursor<PCol *> find_col(const PCol *)const;
+ PCursor<PCol *> find_col(PCol const *)const;
/* MAIN ROUTINES */
void process();
PScore * pscore_l_;
- PointerList<const Spanner*> spans;
+ PointerList<Spanner const *> spans;
PointerList<Item*> its;
/* *************** */
Real standard_height()const;
Real note_width() const;
void print() const;
- const Lookup* lookup_l(); // TODO naming
+ Lookup const * lookup_l(); // TODO naming
Real duration_to_dist(Moment);
};
Matrix A,H;
Array<int> active;
Array<int> inactive; // actually this is a set, not an array.
- const Ineq_constrained_qp *opt;
+ Ineq_constrained_qp const *opt;
public:
String status()const;
IPointerList<Score_column*> cols_;
PScore *pscore_p_;
- const char *defined_ch_c_l_;
+ char const *defined_ch_c_l_;
int errorlevel_i_;
/* *************************************************************** */
String TeXstring() const;
// is #c# contained in #*this#?
- bool element(const PCol *c);
+ bool element(PCol const *c);
};
#endif
struct Staff_elem_info {
Staff_elem * elem_p_;
Request*req_l_;
- const Voice * voice_l_;
+ Voice const * voice_l_;
Array<Request_register*> origin_reg_l_arr_;
/* *** */
struct Staff_info {
int *c0_position_i_;
Staff_walker *walk_l_;
- const Time_description *time_c_l_;
- const Rhythmic_grouping *rhythmic_c_l_;
+ Time_description const *time_c_l_;
+ Rhythmic_grouping const *rhythmic_c_l_;
bool break_allowed_b_;
};
+++ /dev/null
-/*
- staffelem.hh -- part of LilyPond
-
- (c) 1996,97 Han-Wen Nienhuys
-*/
-
-#ifndef STAFFELEM_HH
-#define STAFFELEM_HH
-#include "varray.hh"
-#include "proto.hh"
-#include "offset.hh"
-#include "molecule.hh"
-
-/** Both Spanner and Item are Staff_elem's. Most Staff_elem's depend
- on other Staff_elem's, eg, Beam needs to know and set direction of
- Stem. So the Beam has to be calculated *before* Stem. This is
- accomplished with the dependencies field of struct Staff_elem.
-
- */
-struct Staff_elem {
- enum Status {
- ORPHAN, // not yet added to pstaff
- VIRGIN, // added to pstaff
- PRECALCING,
- PRECALCED, // calcs before spacing done
- POSTCALCING,
- POSTCALCED, // after spacing calcs done
- OUTPUT, // molecule has been output
- } status;
-
- /// the pstaff it is in
- PStaff *pstaff_l_;
-
- /* *************** */
- Staff_elem(Staff_elem const&);
- String TeXstring () const ;
- virtual void print() const;
- virtual Interval width() const;
- virtual Interval height() const;
- Paperdef *paper() const;
- virtual ~Staff_elem();
- Staff_elem();
-
- void translate(Offset);
- void add_processing();
- void pre_processing();
- void post_processing();
- void molecule_processing();
- virtual const char *name() const; // to find out derived classes.
- virtual Spanner* spanner() { return 0; }
- virtual Item * item() { return 0; }
- void add_depedency(Staff_elem* );
- void substitute_dependency(Staff_elem* old, Staff_elem * newdep);
-protected:
-
- /// do printing of derived info.
- virtual void do_print() const=0;
- /// generate the molecule
- virtual Molecule* brew_molecule_p()const=0;
- ///executed directly after the item is added to the PScore
- virtual void do_add_processing();
- /// do calculations before determining horizontal spacing
- virtual void do_pre_processing();
-
- /// do calculations after determining horizontal spacing
- virtual void do_post_processing();
-
- Array<Staff_elem*> dependants;
-
-private:
- /// member: the symbols
- Molecule *output; // should scrap, and use temp var?
-
-
- /**
- This is needed, because #output# may still be
- NULL.
- */
- Offset offset_;
- Array<Staff_elem*> dependencies;
-};
-#define NAME_METHOD(c) const char *c::name()const{ return #c; } struct c
-#endif // STAFFELEM_HH
-
struct Staff_elem_info {
Staff_elem * elem_p_;
Request*req_l_;
- const Voice * voice_l_;
+ Voice const * voice_l_;
Voice_group_registers * group_regs_l_;
Request_register * origin_reg_l_;
struct Voice_element {
Moment duration;
char const* defined_ch_c_l_;
- const Voice *voice_l_;
+ Voice const *voice_l_;
IPointerList<Request*> reqs;
/* *************** */
Voice();
Voice(Voice const&);
- Moment when(const Voice_element*)const;
+ Moment when(Voice_element const *)const;
Moment last() const;
void add(Voice_element*);
midi_p_ = (s.midi_p_)? new Midi_def(*s.midi_p_) : 0;
defined_ch_c_l_ = s.defined_ch_c_l_;
errorlevel_i_ = s.errorlevel_i_;
- score_wide_music_p_ = (s.score_wide_music_p_) ?
- s.score_wide_music_p_->clone():0;
}
Score*
if (midi_p_)
s_p->set(new Midi_def(*midi_p_));
if (paper_p_)
- s_p->set( new Paper_def(*paper_p_));
+ s_p->set(new Paper_def(*paper_p_));
for (iter_top(staffs_,i); i.ok(); i++) {
- Staff* staf_p=i->parse(s_p, score_wide_music_p_);
+ Staff* staf_p=i->parse(s_p);
s_p->add(staf_p);
}
return s_p;
}
-void
-Input_score::set(Input_music *m_p)
-{
- delete score_wide_music_p_;
- score_wide_music_p_ =m_p;
-}
-
Input_score::~Input_score()
{
delete paper_p_;
- delete score_wide_music_p_;
delete midi_p_;
}
Input_score::Input_score()
{
- score_wide_music_p_ =0;
defined_ch_c_l_=0;
paper_p_= 0;
midi_p_ = 0;
Input_staff::Input_staff(String s)
{
- score_wide_music_p_ =0;
type= s;
defined_ch_c_l_ = 0;
}
}
Staff*
-Input_staff::parse(Score*score_l, Input_music *default_score_wide)
+Input_staff::parse(Score*score_l)
{
Staff *p=0;
if (type == "melodic")
Voice_list vl = i->convert();
p->add(vl);
}
- Voice_list vl = (score_wide_music_p_) ? score_wide_music_p_->convert()
- : default_score_wide->convert();
- p->add(vl);
return p;
}
add(i->clone());
defined_ch_c_l_ = s.defined_ch_c_l_;
type = s.type;
- score_wide_music_p_ = (s.score_wide_music_p_) ?
- s.score_wide_music_p_->clone() : 0;
}
void
mtor << "}\n";
#endif
}
-void
-Input_staff::set_score_wide(Input_music *m_p)
-{
- delete score_wide_music_p_;
- score_wide_music_p_ = m_p;
-}
-
Input_staff::~Input_staff()
{
- delete score_wide_music_p_;
}
}
void
-Key_item::read(const Key_register& key_reg_r)
+Key_item::read(Key_register const & key_reg_r)
{
const Array<int> &idx_arr =key_reg_r.accidental_idx_arr_;
for (int i = 0 ; i< idx_arr.size(); i++) {
void
Key_register::process_requests()
{
- const Time_description *time_l = get_staff_info().time_c_l_;
+ Time_description const *time_l = get_staff_info().time_c_l_;
if (!keyreq_l_ &&
(!time_l->whole_in_measure_|| !time_l->when_)) {
/* for the keyword table */
struct Keyword_ent
{
- const char *name;
+ char const *name;
int tokcode;
};
Keyword_ent *table;
int maxkey;
Keyword_table(Keyword_ent *);
- int lookup(const char *s) const;
+ int lookup(char const *s) const;
};
/* for qsort */
int
- tabcmp(const void * p1, const void * p2)
+ tabcmp(void const * p1, void const * p2)
{
- return strcmp(((const Keyword_ent *) p1)->name,
- ((const Keyword_ent *) p2)->name);
+ return strcmp(((Keyword_ent const *) p1)->name,
+ ((Keyword_ent const *) p2)->name);
}
Keyword_table::Keyword_table(Keyword_ent *tab)
lookup with binsearch, return tokencode.
*/
int
-Keyword_table::lookup(const char *s)const
+Keyword_table::lookup(char const *s)const
{
int lo,
hi,
#include "input-score.hh"
#include "parseconstruct.hh"
#include "main.hh"
-#include "identparent.hh"
+#include "identifier.hh"
#define start_quote() \
yy_push_state(quote);\
INT -?{N}+
REAL {INT}?(\.{N}*)?
-OPTSIGN !?
-PITCHMOD ['`]*{OPTSIGN}
RESTNAME r|s|p
NOTECOMMAND \\{WORD}
DOTS \.+
LYRICS {TEX}+
-COMMENT [%#].*\n
+COMMENT %.*\n
%%
-\$ {
- yy_push_state(notes);
-}
-\@ {
- yy_push_state(lyrics);
+
+
+include {
+ yy_push_state(incl);
+}
+<incl>[ \t]* { /* eat the whitespace */ }
+<incl>\"[^"]*\"+ { /* got the include file name */
+ String s (YYText()+1);
+ s = s.left_str(s.length_i()-1);
+ defined_ch_c_l = here_ch_c_l() - String( YYText() ).length_i() - 1;
+ new_input(s);
+ yy_pop_state();
}
<notes>{RESTNAME} {
mtor << "rest:"<< yylval.string;
return RESTNAME;
}
-<notes>{ALPHAWORD} {
+<notes,INITIAL>{ALPHAWORD} {
String str = YYText();
- mtor << "word: " << str<< eol;
+ mtor << "word: `" << str<< "'\n";
Identifier * id = lookup_identifier(str);
if (id) {
yylval.id = id;
yylval.string=new String( str );
return STRING;
}
-<notes>{NOTECOMMAND} {
+<notes,INITIAL>{NOTECOMMAND} {
String c = YYText() +1;
- mtor << "\\word: " << YYText()+1<<eol;
+ mtor << "\\word: `" << YYText()+1<<"'\n";
int l = lookup_keyword(c);
if (l != -1)
return l;
- Identifier * id = lookup_identifier(c);
- if (id) {
- yylval.id = id;
- return id->token_code_i_;
- }
+
String *sp = new String( c);
yylval.string=sp;
return STRING;
<notes>[ \t\n]+ {
}
-<notes>\$ {
- yy_pop_state();
+<notes>\+\+ {
+ return CONCAT;
}
<notes>\" {
start_quote();
}
<lyrics>{NOTECOMMAND} {
String c = YYText() +1;
- mtor << "\\word: " << YYText()+1<<eol;
+ mtor << "\\word: `" << YYText()+1<<"'\n";
int l = lookup_keyword(c);
if (l != -1)
return l;
}
<lyrics>[ \t\n]+ {
}
-<lyrics>@ {
- yy_pop_state();
-}
<<EOF>> {
mtor << "<<EOF>>";
if (! close_input())
yyterminate(); // can't move this, since it actually rets a YY_NULL
}
-
-
-include {
- yy_push_state(incl);
-}
-<incl>[ \t]* { /* eat the whitespace */ }
-<incl>\"[^"]*\"+ { /* got the include file name */
- String s (YYText()+1);
- s = s.left_str(s.length_i()-1);
- defined_ch_c_l = here_ch_c_l() - String( YYText() ).length_i() - 1;
- new_input(s);
- yy_pop_state();
-}
-
-
-{WORD} {
- mtor << "word: " << YYText()<<eol;
- String c = YYText();
- int l = lookup_keyword(c);
- if (l != -1)
- return l;
- Identifier * id = lookup_identifier(c);
- if (id) {
- yylval.id = id;
- return IDENTIFIER;
- }
- String *sp = new String( c);
- mtor << "new id: " << *sp << eol;
- yylval.string=sp;
- return STRING;
-}
-
{REAL} {
Real r;
int cnv=sscanf (YYText(), "%lf", &r);
%%
+void
+My_flex_lexer::push_note_state()
+{
+ yy_push_state(notes);
+}
+
+void
+My_flex_lexer::push_lyric_state()
+{
+ yy_push_state(lyrics);
+}
+void
+My_flex_lexer::pop_state()
+{
+ yy_pop_state();
+}
#include ".build"
;
-const char *
+char const *
lily_version_sz()
{
static char v[1024];
bool
-Spacing_problem::contains(const PCol *w)
+Spacing_problem::contains(PCol const *w)
{
for (int i=0; i< cols.size(); i++)
if (cols[i].pcol_ == w)
}
int
-Spacing_problem::col_id(const PCol *w)const
+Spacing_problem::col_id(PCol const *w)const
{
for (int i=0; i< cols.size(); i++)
if (cols[i].pcol_ == w)
add one column to the problem.
*/
void
-Spacing_problem::add_column(const PCol *col, bool fixed, Real fixpos)
+Spacing_problem::add_column(PCol const *col, bool fixed, Real fixpos)
{
Colinfo c(col,(fixed)? &fixpos : 0);
cols.push(c);
}
void
-Spacing_problem::add_ideal(const Idealspacing *i)
+Spacing_problem::add_ideal(Idealspacing const *i)
{
- const PCol *l =i->left;
- const PCol *r= i->right;
+ PCol const *l =i->left;
+ PCol const *r= i->right;
if (!contains(l) || !contains(r)) {
return;
}
void
-Spacing_problem::print_ideal(const Idealspacing*id)const
+Spacing_problem::print_ideal(Idealspacing const *id)const
{
#ifndef NPRINT
int l = col_id(id->left);
width = c.width;
}
-Colinfo::Colinfo(const PCol*col_p, const Real*fixed_r_p )
+Colinfo::Colinfo(PCol const *col_p, Real const *fixed_r_p )
{
fixpos = (fixed_r_p)? new Real(*fixed_r_p) : 0;
pcol_ = col_p;
void
Local_key_register::acknowledge_element(Staff_elem_info info)
{
- if (info.req_l_->melodic()) {
- Melodic_req * melodic_l_ = info.req_l_->melodic();
+ if (info.req_l_->note()) {
+ Note_req * note_l_ = info.req_l_->note();
- if( melodic_l_->forceacc_b_ ||
- local_key_.oct(melodic_l_->octave_i_).acc(melodic_l_->notename_i_)
- != melodic_l_->accidental_i_) {
+ if( note_l_->forceacc_b_ ||
+ local_key_.oct(note_l_->octave_i_).acc(note_l_->notename_i_)
+ != note_l_->accidental_i_) {
Item * support_l_ = info.elem_p_->item();
key_item_p_ = new Local_key_item(*get_staff_info().c0_position_i_);
}
- key_item_p_->add(melodic_l_);
+ key_item_p_->add(note_l_);
key_item_p_->add(support_l_);
- local_key_.oct(melodic_l_->octave_i_)
- .set(melodic_l_->notename_i_, melodic_l_->accidental_i_);
+ local_key_.oct(note_l_->octave_i_)
+ .set(note_l_->notename_i_, note_l_->accidental_i_);
}
} else if (info.elem_p_->name()==Key_item::static_name()) {
Key_register * key_reg_l =
void
Local_key_register::process_requests()
{
- const Time_description * time_c_l_ = get_staff_info().time_c_l_;
+ Time_description const * time_c_l_ = get_staff_info().time_c_l_;
if (! time_c_l_->whole_in_measure_){
if (key_c_l_)
local_key_.reset(*key_c_l_);
}
void
-Molecule::add(const Molecule &m)
+Molecule::add(Molecule const &m)
{
for (iter_top(m.ats,c); c.ok(); c++) {
add(**c);
}
void
-Molecule::add_right(const Molecule &m)
+Molecule::add_right(Molecule const &m)
{
if (!ats.size()) {
add(m);
}
void
-Molecule::add_left(const Molecule &m)
+Molecule::add_left(Molecule const &m)
{
if (!ats.size()) {
add(m);
void
-Molecule::add_top(const Molecule &m)
+Molecule::add_top(Molecule const &m)
{
if (!ats.size()) {
add(m);
}
void
-Molecule::add_bottom(const Molecule &m)
+Molecule::add_bottom(Molecule const &m)
{
if (!ats.size()) {
add(m);
}
void
-Molecule::operator = (const Molecule&)
+Molecule::operator = (Molecule const &)
{
assert(false);
}
-Molecule::Molecule(const Molecule&s)
+Molecule::Molecule(Molecule const &s)
{
add(s);
}
void
Request::print() const
{
+#ifndef NPRINT
mtor << name() << " {";
do_print();
mtor << "}\n";
+#endif
}
notename_i_ = 0;
octave_i_ = 0;
accidental_i_ = 0;
- forceacc_b_ = false;
}
void
Melodic_req::do_print() const
{
- mtor << "notename: " << notename_i_ << " acc: " <<accidental_i_<<" oct: "<< octave_i_;
+#ifndef NPRINT
+ mtor << "notename: " << notename_i_ << " acc: " <<accidental_i_<<" oct: "<< octave_i_;
+#endif
}
int
void
Plet_req::do_print() const
{
+#ifndef NPRINT
mtor << "plet: " << type_c_ << ": " << dur_i_ << "/" << type_i_;
+#endif
}
/* *************** */
int
-Rhythmic_req::compare(const Rhythmic_req &r1, const Rhythmic_req &r2)
+Rhythmic_req::compare(Rhythmic_req const &r1, Rhythmic_req const &r2)
{
return sign(r1.duration() - r2.duration());
}
void
Rhythmic_req::do_print() const
{
+#ifndef NPRINT
mtor << "ball: " << balltype ;
int d =dots;
while (d--)
mtor << '.';
mtor<<", plet factor"<<plet_factor<<"\n";
+#endif
}
Rhythmic_req::do_print();
Text_req::do_print();
}
+
/* *************** */
+Note_req::Note_req()
+{
+ forceacc_b_ = false;
+}
void
Note_req::do_print() const
{
+#ifndef NPRINT
+ mtor << " forceacc_b_ " << forceacc_b_ << '\n';
Melodic_req::do_print();
Rhythmic_req::do_print();
+#endif
}
/* *************** */
void
void Slur_req::do_print()const{}
/* *************** */
int
-Span_req:: compare(const Span_req &r1, const Span_req &r2)
+Span_req:: compare(Span_req const &r1, Span_req const &r2)
{
return r1.spantype - r2.spantype;
}
}
int
-Script_req::compare(const Script_req &d1, const Script_req &d2)
+Script_req::compare(Script_req const &d1, Script_req const &d2)
{
return d1.dir_i_ == d2.dir_i_ &&
d1.scriptdef_p_->compare(*d2.scriptdef_p_);
}
/* *************** */
int
-Text_req:: compare(const Text_req &r1, const Text_req &r2)
+Text_req:: compare(Text_req const &r1, Text_req const &r2)
{
bool b1 = (r1.dir_i_ == r2.dir_i_);
bool b2 = (r1.tdef_p_ ->compare(*r2.tdef_p_));
void
Text_req::do_print() const
{
+#ifndef NPRINT
+
mtor << " dir " << dir_i_ ;
tdef_p_->print();
+#endif
}
/* *************** */
void
Skip_req::do_print() const
{
+#ifndef NPRINT
+
mtor << "duration: " << duration();
+#endif
}
Voice *
void
Subtle_req::do_print() const
{
- mtor << " subtime " << subtime_;
+#ifndef NPRINT
+ mtor << " subtime " << subtime_;
+#endif
}
void
#include <strstream.h>
#include "interval.hh"
-#include "identparent.hh"
+#include "identifier.hh"
#include "assoc-iter.hh"
#include "lexer.hh"
#include "input-file.hh"
"geometric", GEOMETRIC,
"goto", GOTO,
"in", IN_T,
+ "lyrics", LYRICS,
"key", KEY,
"melodic" , MELODIC,
"meter", METER,
}
void
-My_flex_lexer::LexerError(const char *s)
+My_flex_lexer::LexerError(char const *s)
{
if (lexer->include_stack_.empty()) {
*mlog << "error at EOF" << s << '\n';
#include "command-request.hh"
#include "voice.hh"
-#include "identparent.hh"
+#include "identifier.hh"
#include "varray.hh"
#include "text-def.hh"
#include "parseconstruct.hh"
}
int
-PCol::compare(const PCol &c1, const PCol &c2)
+PCol::compare(PCol const &c1, PCol const &c2)
{
PScore*ps_l = c1.pscore_l_;
PCursor<PCol*> ac(ps_l->find_col(&c1));
assert(ps && pc);
for (iter_top(pc->its,i); i.ok(); i++){
if (i->pstaff_l_ == ps)
- ret.push((Item*)(const Item*)i);
+ ret.push((Item*)(Item const *)i);
}
return ret;
}
}
PCursor<PCol *>
-PScore::find_col(const PCol *c)const
+PScore::find_col(PCol const *c)const
{
- const PCol*what = c;
+ PCol const *what = c;
if (what->daddy_l_ )
what = what->daddy_l_;
mtor << "}\n";
#endif
}
-const Lookup*
+Lookup const *
Paper_def::lookup_l()
{
return lookup_p_;
%{ // -*-Fundamental-*-
#include <iostream.h>
-
+#include "script-def.hh"
+#include "symtable.hh"
#include "lookup.hh"
#include "misc.hh"
#include "lexer.hh"
#include "paper-def.hh"
#include "midi-def.hh"
-#include "input-score.hh"
#include "main.hh"
+#include "input-score.hh"
+#include "input-staff.hh"
+#include "input-music.hh"
#include "keyword.hh"
#include "debug.hh"
#include "parseconstruct.hh"
%token CM_T
%token COMMAND
%token COMMANDS
+%token CONCAT
%token DURATIONCOMMAND
%token DYNAMIC
%token END
%token GOTO
%token GROUPING
%token IN_T
+%token LYRICS
%token KEY
%token MELODIC
%token METER
%token <i> INT
%token <id> IDENTIFIER
%token <id> MELODIC_REQUEST_IDENTIFIER
+%token <id> CHORD_IDENTIFIER
+%token <id> VOICE_IDENTIFIER
%token <id> POST_REQUEST_IDENTIFIER
+%token <id> SCRIPT_IDENTIFIER
+%token <id> STAFF_IDENTIFIER
%token <id> REAL_IDENTIFIER
+%token <id> SCORE_IDENTIFIER
%token <id> REQUEST_IDENTIFIER
%token <real> REAL
%token <string> DURATION RESTNAME
%type <box> box
%type <c> open_request_parens close_request_parens close_plet_parens
-%type <chord> music_chord music_chord_body
+%type <chord> music_chord music_chord_body init_music_chord
%type <el> voice_elt full_element lyrics_elt command_elt
%type <i> int
%type <i> octave_quotes octave_quote
%type <melreqvec> pitch_list
%type <midi> midi_block midi_body
%type <moment> duration_length
-%type <music> music
-%type <mvoice> music_voice_body music_voice
+%type <music> music init_music
+%type <mvoice> music_voice_body music_voice init_music_voice init_lyrics_voice
%type <paper> paper_block paper_body
%type <real> dim real
%type <symtable> symtable symtable_body
%type <textdef> mudela_text
+
+%left PRIORITY
+
+%expect 2 /* have to fix this. */
+
%%
mudela: /* empty */
;
declaration:
- declarable_identifier '=' staff_block {
- $$ = new Staff_id(*$1, $3, IDENTIFIER);
+ declarable_identifier '=' score_block {
+ $$ = new Score_id(*$1, $3, SCORE_IDENTIFIER);
+ delete $1;
+ }
+ | declarable_identifier '=' staff_block {
+ $$ = new Staff_id(*$1, $3, STAFF_IDENTIFIER);
delete $1;
}
- | declarable_identifier '=' music_voice {
- $$ = new M_voice_id(*$1, $3, IDENTIFIER);
+ | declarable_identifier '=' init_music_voice {
+ $$ = new M_voice_id(*$1, $3, VOICE_IDENTIFIER);
+ delete $1;
+ }
+ | declarable_identifier '=' init_lyrics_voice {
+ $$ = new M_voice_id(*$1, $3, VOICE_IDENTIFIER);
delete $1;
}
| declarable_identifier '=' script_definition {
- $$ = new Script_id(*$1, $3, IDENTIFIER);
+ $$ = new Script_id(*$1, $3, SCRIPT_IDENTIFIER);
delete $1;
}
- | declarable_identifier '=' music_chord {
- $$ = new M_chord_id(*$1, $3, IDENTIFIER);
+ | declarable_identifier '=' init_music_chord {
+ $$ = new M_chord_id(*$1, $3, CHORD_IDENTIFIER);
delete $1;
}
| declarable_identifier '=' symtables {
$$->errorlevel_i_ = lexer->errorlevel_i_;
lexer->errorlevel_i_ = 0;
- /* unbarf score without global music. */
- if (!$$-> score_wide_music_p_) {
- $$-> score_wide_music_p_ = new Music_voice;
- }
}
;
score_body: {
$$ = new Input_score;
}
- | score_body staff_block { $$->add($2); }
- | score_body COMMANDS '{' music_voice_body '}' {
- $$->set($4);
+ | SCORE_IDENTIFIER {
+ $$ = $1->score(true);
}
+ | score_body staff_block { $$->add($2); }
| score_body paper_block { $$->set($2); }
| score_body midi_block { $$->set($2); }
| score_body error {
*/
paper_block:
PAPER
-
'{' paper_body '}' { $$ = $3; }
;
staff_init:
- IDENTIFIER { $$ = $1->staff(true); }
+ STAFF_IDENTIFIER { $$ = $1->staff(true); }
| STRING {
$$ = new Input_staff(*$1);
delete $1;
staff_body:
staff_init
- | staff_body COMMANDS '{' music_voice_body '}' {
- $$->set_score_wide($4);
- }
- | staff_body music {
+ | staff_body init_music {
$2->set_default_group( "staff_music" + String($$->music_.size()));
$$->add($2);
}
}
;
+/*
+ let the lexer switch mode.
+*/
+init_music:
+ init_music_voice { $$ = $1; }
+ | init_music_chord { $$ = $1; }
+ | init_lyrics_voice { $$ = $1; }
+ ;
+
+init_lyrics_voice:
+ LYRICS { lexer->push_lyric_state(); }
+ music_voice { $$ = $3; lexer->pop_state(); }
+ ;
+
+init_music_voice:
+ MUSIC { lexer->push_note_state(); }
+ /* cont*/ music_voice
+ { $$=$3; lexer->pop_state(); }
+ ;
+init_music_chord:
+ MUSIC { lexer->push_note_state(); }
+ /* cont*/ music_chord
+ { $$=$3; lexer->pop_state(); }
+ ;
/*
MUSIC
*/
| music_chord { $$ = $1; }
;
-music_voice: MUSIC '{' music_voice_body '}' { $$ = $3; }
+music_voice: '{' music_voice_body '}' { $$ = $2; }
;
music_voice_body:
- IDENTIFIER {
+ VOICE_IDENTIFIER {
$$ = $1->mvoice(true);
}
| /* */ {
$$ = new Music_voice;
}
- | music_voice_body '+' IDENTIFIER {
- $$->concatenate($3->mvoice(true));
- }
| music_voice_body full_element {
$$->add_elt($2);
}
}
| music_voice_body error {
}
- ;
+ | music_voice_body '>' {
+ error("Confused by earlier errors: bailing out");
+ };
-music_chord: '{' music_chord_body '}' { $$ = $2; }
+music_chord: '<' music_chord_body '>' { $$ = $2; }
;
music_chord_body:
- IDENTIFIER {
+ CHORD_IDENTIFIER {
$$=$1->mchord(true);
}
| /* */ {
| MULTIVOICE {
$$ = new Multi_voice_chord;
}
- | music_chord_body '+' IDENTIFIER {
- $$->concatenate($3->mchord(true));
- }
| music_chord_body music {
$$->add($2);
}
| music_chord_body full_element {
$$ ->add_elt($2);
}
+ | music_chord_body '}' {
+ error("Confused by earlier errors: bailing out");
+ }
| music_chord_body error {
}
;
$$ = new Bar_req(*$2);
delete $2;
}
- | METER '{' int '*' int '}' {
+ | METER '{' int '/' int '}' {
Meter_change_req *m = new Meter_change_req;
m->set($3,$5);
// sorry hw, i need meter at output of track,
// but don-t know where to get it... statics should go.
+ // HW : default: 4/4, meterchange reqs may change it.
+
Midi_def::num_i_s = $3;
Midi_def::den_i_s = $5;
$$ = m;
octave_quote:
'\'' { $$ = 1; }
- | '`' { $$ = -1; }
+ | '`' { $$ = -1 ; }
;
octave_quotes:
* (Melodic_req *) $$ = *$1->request(false)->melodic();
$$->octave_i_ += lexer->prefs.default_octave_i_;
}
- | octave_quote steno_note_req {
- $2-> octave_i_ += $1;
- $$ = $2; //ugh!!
+ | steno_note_req '\'' {
+ $$-> octave_i_ ++;
}
- | '!' steno_note_req {
+ | '`' steno_note_req {
$$ = $2;
- $2->forceacc_b_ = ! $2->forceacc_b_;
+ $2-> octave_i_ --;
+ }
+
+ | steno_note_req '!' {
+ $$->forceacc_b_ = ! $$->forceacc_b_;
}
;
melodic_request:
- MELODIC '{' int int int int '}' {/* ugh */
+ MELODIC '{' int int int '}' {/* ugh */
$$ = new Melodic_req;
$$->octave_i_ = $3;
$$->notename_i_ = $4;
$$->accidental_i_ = $5;
- $$->forceacc_b_ = $6;
}
;
dynamic_req:
DYNAMIC '{' int '}' {
Absolute_dynamic_req *ad_p = new Absolute_dynamic_req;
- ad_p ->loudness_ = $3;
+ ad_p ->loudness_ = (Dynamic_req::Loudness)$3;
$$ =ad_p;
}
;
;
mudela_script:
- IDENTIFIER { $$ = $1->script(true); }
+ SCRIPT_IDENTIFIER { $$ = $1->script(true); }
| script_definition { $$ = $1; }
| '^' { $$ = get_scriptdef('^'); }
| '+' { $$ = get_scriptdef('+'); }
default_paper()
{
return new Paper_def(
- lexer->lookup_identifier("default_table")->lookup(true));
+ lexer->lookup_identifier("defaulttable")->lookup(true));
}
stem_p_ = 0;
}
if (beam_p_ && end_beam_b_) {
- const Rhythmic_grouping * rg_c_l = get_staff_info().rhythmic_c_l_;
+ Rhythmic_grouping const * rg_c_l = get_staff_info().rhythmic_c_l_;
rg_c_l->extend(current_grouping->interval());
beam_p_->set_grouping(*rg_c_l, *current_grouping);
typeset_element(beam_p_);
Tex_stream::operator<<(String s)
{
- for (const char *cp = s; *cp; cp++) {
+ for (char const *cp = s; *cp; cp++) {
if (outputting_comment) {
*os << *cp;
if (*cp == '\n') {
defined_ch_c_l_ = 0;
}
bool
-Text_def::compare(const Text_def&def)
+Text_def::compare(Text_def const &def)
{
return align_i_ == def.align_i_ && text_str_ == def.text_str_
&& style_str_ == def.style_str_;
#include "string.hh"
-extern const char* lily_version_sz();
+extern char const * lily_version_sz();
String
get_version_str()
}
void
-error_t(const String& s, const Moment& r)
+error_t(String const & s, Moment const & r)
{
String t_mom = String(trunc(r)) + String(r - Moment(trunc(r)));
String e=s+ " (t = " + t_mom + ")";
}
void
-error_t(const String& s, Time_description const &t_tdes)
+error_t(String const & s, Time_description const &t_tdes)
{
String e=s+ " (at t=" + String(t_tdes.bars_i_) + ": " + String(t_tdes.whole_in_measure_) + ")\n";
error(e);
void
message( String message_str, char const* context_ch_c_l )
{
- String str = "lilypond: ";
+ String str = ""; //"lilypond: ";// GNU format messages!
Source_file* sourcefile_l = source_l_g->sourcefile_l( context_ch_c_l );
if ( sourcefile_l ) {
str += sourcefile_l->file_line_no_str(context_ch_c_l) + String(": ");
+++ /dev/null
-#
-# project LilyPond -- the musical typesetter
-# title cancel all built-in rules
-# file make/Builtin-rules.make
-#
-# Copyright (c) 1997 by
-# Jan Nieuwenhuizen <jan@digicash.com>
-# Han-Wen Nienhuys <hanwen@stack.nl>
-
-# no assembly sources
-%.o : %.s
-
-# no c sources
-%.o : %.c
-
-# not using RCS
-% :: RCS/%,v
-$(outdir)/% :: $(outdir)/RCS/%,v
-% : RCS/%,v
-$(outdir)/% : $(outdir)/RCS/%,v
-%.c : RCS/%,v
-%.cc : RCS/%,v
-%.hh : RCS/%,v
-%.make : RCS/%,v
-$(outdir)/%.dep : $(outdir)/RCS/%,v
-%.dep : RCS/%.dep,v
-$(outdir)/%.dep : $(outdir)/RCS/%.dep,v
-
-# lily knows better
-%.tab.c %.tab.h : %.y
-
-# fine suffixes:
-Makefile :
-%.cc :
-%.dep :
-$(outdir)/%.dep:
-%.hh :
-%.make :
-%.p :
-
-
# @configure_input@
INSTALL = @INSTALL@
-CXXFLAGS = @CXXFLAGS@
+USER_CXXFLAGS = @CXXFLAGS@
#CXX = @CXX@
prefix = @prefix@
--- /dev/null
+# list of c++ header files:
+#
+HHFILES = $(wildcard *.hh)
+#
+
+# list of c++ inline files:
+#
+INLFILES = $(wildcard *.inl)
+#
+
+# list of c++ template files:
+#
+
+TCCFILES = $(wildcard *.tcc)
+
+#
+# list of other source files:
+#
+
+EXTRA_SOURCE_FILES = $(wildcard *.y *.l)
+
+#
+PODFILES = $(wildcard *.pod)
+
+CCFILES = $(wildcard *.cc)
+MAKEFILES = $(wildcard *.make)
+
+ALL_SOURCES=$(HHFILES) $(CCFILES) $(EXTRA_SOURCE_FILES) $(INLFILES) \
+ $(TCCFILES) $(PODFILES) $(MAKEFILES)
+
+DEPFILES = $(wildcard $(depdir)/*.dep)
+
+build = $(outdir)/.build
+
+all-tag-sources=$(CCFILES) $(HHFILES)
-#
+
# project LilyPond -- the musical typesetter
# title generic red tape for include/Makefile
# file make/Include.make
# identify module:
#
-NAME = generic-include
-MAJOR_VERSION = $(TOPLEVEL_MAJOR_VERSION)
-MINOR_VERSION = $(TOPLEVEL_MINOR_VERSION)
-PATCH_LEVEL = $(TOPLEVEL_PATCH_LEVEL)
-# use to send patches, always empty for released version:
-MY_PATCH_LEVEL = $(TOPLEVEL_MY_PATCH_LEVEL)
-build = ./$(depth)/lily/$(outdir)/.build
-#
-# generic variables:
-#
-include ./$(depth)/make/Variables.make
-#
-
-# list of c++ header files:
-#
-HHFILES = $(shell ls *.hh $(ERROR_LOG))
-#
-
-# list of c++ inline files:
-#
-INLFILES = $(shell ls *.inl $(ERROR_LOG))
-#
-# list of c++ template files:
-#
-TCCFILES = $(shell ls *.tcc $(ERROR_LOG))
-#
-
-# list of distribution files:
-#
-DISTFILES = Makefile $(HHFILES) $(INLFILES) $(TCCFILES)
-#
-
-# generic targets and rules:
-#
+include ./$(depth)/make/Variables.make
+include ./$(depth)/make/Version.make
+include ./$(depth)/make/Files.make
include ./$(depth)/make/Targets.make
include ./$(depth)/make/Rules.make
-#
-
# identify module:
#
NAME = make
-MAJOR_VERSION = $(TOPLEVEL_MAJOR_VERSION)
-MINOR_VERSION = $(TOPLEVEL_MINOR_VERSION)
-PATCH_LEVEL = $(TOPLEVEL_PATCH_LEVEL)
-# use to send patches, always empty for released version:
-MY_PATCH_LEVEL = $(TOPLEVEL_MY_PATCH_LEVEL)
-build = ./$(depth)/lily/$(outdir)/.build
-#
-# list of generic make files:
-#
-MAKEFILES = $(shell ls *.make)
-#
# list of distribution files:
#
-DISTFILES = Configure_variables.make.in Makefile lilypond.spec.in $(MAKEFILES)
+EXTRA_DISTFILES = Configure_variables.make.in lilypond.spec.in
#
# generic variables:
#
-include ./$(depth)/make/Variables.make
+include ./$(depth)/make/Variables.make
+include ./$(depth)/make/Files.make
#
# generic targets and rules:
include ./$(depth)/make/Rules.make
#
-lilypond.spec: lilypond.spec.in
- sed 's/@TOPLEVEL_VERSION@/${TOPLEVEL_VERSION}/g'< $< > $@
\ No newline at end of file
+lilypond.spec: lilypond.spec.in $(depth)/.version
+ sed 's/@TOPLEVEL_VERSION@/${TOPLEVEL_VERSION}/g'< $< > $@
# compile rules:
#
$(outdir)/%.o: %.cc
- $(DODEP)\
- $(CXX) -c $(CXXFLAGS) $(CXX_OUTPUT_OPTION)
+ $(DO_CXX_COMPILE)
+
+$(outdir)/%.o: $(outdir)/%.cc
+ $(DO_CXX_COMPILE)
$(outdir)/%.cc: %.y
# $(BISON) -d $<
# specific stuff:
#
$(LIBFLOWER): check-flower-deps
- $(MAKE) ./$(outdir)/$(@F) -C $(depth)/flower/lib
check-flower-deps:
- $(MAKE) -C $(depth)/flower/lib
+ $(MAKE) -C $(depth)/flower/ $(outdir)/$(notdir $(LIBFLOWER))
check-lily-deps: check-flower-deps
$(MAKE) -C $(depth)/lib
+check-doc-deps:
+ $(MAKE) -C $(depth)/Documentation
+
$(LIBLILY): dummy
$(MAKE) ./$(outdir)/$(@F) -C $(depth)/lib
#
+++ /dev/null
-#
-# project LilyPond -- the musical typesetter
-# title generic red tape for stuff/Makefile
-# file make/Stuff.make
-#
-# Copyright (c) 1997 by
-# Jan Nieuwenhuizen <jan@digicash.com>
-# Han-Wen Nienhuys <hanwen@stack.nl>
-# identify module:
-#
-
-NAME = generic-stuff
-MAJOR_VERSION = $(TOPLEVEL_MAJOR_VERSION)
-MINOR_VERSION = $(TOPLEVEL_MINOR_VERSION)
-PATCH_LEVEL = $(TOPLEVEL_PATCH_LEVEL)
-# use to send patches, always empty for released version:
-MY_PATCH_LEVEL = $(TOPLEVEL_MY_PATCH_LEVEL)
-#
-
-# generic variables:
-#
-include ./$(depth)/make/Variables.make
-#
-
-# generic targets and rules:
-#
-include ./$(depth)/make/Targets.make
-include ./$(depth)/make/Rules.make
-#
-
exe: $(EXECUTABLE)
#
-$(build):
+$(build): $(depth)/.version
echo 0 > $@
# dependency list of library:
dist:
-mkdir $(distdir)
$(MAKE) localdist
+ chmod -Rf a+rX $(distdir)
+
(cd ./$(depth); tar cfz $(DIST_NAME).tar.gz $(DIST_NAME))
rm -rf $(distdir)/ # should be trapped
if [ -d out ]; then mkdir $(distdir)/$(localdir)/out; fi
ln $(DISTFILES) $(distdir)/$(localdir)
ifdef SUBDIRS
- set -e; for i in $(SUBDIRS); do mkdir $(distdir)/$(localdir)/$$i; done
- set -e; for i in $(SUBDIRS); do $(MAKE) localdir=$(localdir)/$$i -C $$i localdist; done
+ set -e; for i in $(SUBDIRS); do mkdir $(distdir)/$(localdir)/$$i; \
+ $(MAKE) localdir=$(localdir)/$$i -C $$i localdist; done
endif
moduledist:
set -e; for i in $(SUBDIRS); do $(MAKE) -C $$i all-tags; done
endif
-TAGS: $(allcc)
- etags -CT $(allcc)
-
+TAGS: $(all-tag-sources)
+ifdef all-tag-sources
+ -etags -CT $(all-tag-sources) /dev/null
+endif
# version stuff:
#
#
NAME = ...
MODULE_NAME =
-# include ./$(depth)/$(NAME)/.version
-MAJOR_VERSION = 0
-MINOR_VERSION = 0
-PATCH_LEVEL = 0
-# use to send patches, always empty for released version:
-MY_PATCH_LEVEL = # include separator: "-1" or ".a"
-build = $(lily-dir)/$(outdir)/.build #????!
+include ./$(depth)/$(NAME)/.version
+
+build = $(outdir)/.build #????!
#
# descent order into subdirectories:
SUBDIRS =
#
-# to be remade each build:
-#
-VERSION_DEPENDENCY = $(lily-version)
-#
-
-# module compile settings: (not generally needed!
+# module compile settings: (not generally needed!)
#
EXTRA_CFLAGS =
EXTRA_CXXFLAGS =
EXTRA_LDFLAGS =
#
+include ./$(depth)/make/Files.make
-# list of c++ header files:
-#
-HHFILES = $(shell ls *.hh $(ERROR_LOG))
-#
-
-# list of c++ source files:
-#
-CCFILES = $(shell ls *.cc $(ERROR_LOG))
-#
-
-# list of other source files:
-#
-EXTRA_SOURCE_FILES = $(shell ls *.y *.l $(ERROR_LOG))
-#
-
-# list of distribution files:
-#
-DISTFILES = Makefile $(HHFILES) $(CCFILES) $(EXTRA_SOURCE_FILES)
-#
+# list of extra distribution files:
+# Makefile, C++ and pod are dist'ed automatically
+EXTRA_DISTFILES =
# list of custom libraries:
#
include ./$(depth)/make/Rules.make
#
-# list of depend files:
-#
-DEPFILES = $(shell ls $(depdir)/*.dep $(ERROR_LOG))
-#
-
# auto dependencies:
#
-include $(DEPFILES)
distdir = ./$(depth)/$(DIST_NAME)
module-distdir = ./$(depth)/$(MODULE_DIST_NAME)
depdir = $(outdir)
-flowerout = ./$(depth)/flower/lib/$(outdir)
+flowerout = ./$(depth)/flower/$(outdir)
libout = ./$(depth)/lib/$(outdir)
libdir = $(outdir)
lilyout = ./$(depth)/lily/$(outdir)
mi2muout = ./$(depth)/mi2mu/$(outdir)
makeout = ./$(depth)/make/$(outdir)
-flower-dir = ./$(depth)/flower/lib
+flower-dir = ./$(depth)/flower
lib-dir = ./$(depth)/lib
lily-dir = ./$(depth)/lily
mi2mu-dir = ./$(depth)/mi2mu
make-dir = ./$(depth)/make
include-lib = ./$(depth)/lib/include
-include-flower = ./$(depth)/flower/lib/include
+include-flower = ./$(depth)/flower/include
#
# user settings:
# custom libraries:
#
-LIBFLOWER = $(depth)/flower/lib/$(outdir)/$(LIB_PREFIX)flower$(LIB_SUFFIX)
+LIBFLOWER = $(depth)/flower/$(outdir)/$(LIB_PREFIX)flower$(LIB_SUFFIX)
LIBLILY = $(depth)/lib/$(outdir)/$(LIB_PREFIX)lily$(LIB_SUFFIX)
#
RANLIB_COMMAND=$(RANLIB) $@
# compiler:
#
+
+DO_CXX_COMPILE=$(DODEP)\
+ $(CXX) -c $(CXXFLAGS) $(CXX_OUTPUT_OPTION)
# "CC = $(CC)"
# "CXX = $(CXX)"
#
STRIPDEBUG=true #replace to do stripping of certain objects
+DISTFILES=$(EXTRA_DISTFILES) Makefile $(ALL_SOURCES)
--- /dev/null
+
+MAJOR_VERSION = $(TOPLEVEL_MAJOR_VERSION)
+MINOR_VERSION = $(TOPLEVEL_MINOR_VERSION)
+PATCH_LEVEL = $(TOPLEVEL_PATCH_LEVEL)
+# use to send patches, always empty for released version:
+MY_PATCH_LEVEL = $(TOPLEVEL_MY_PATCH_LEVEL)
+build = $(outdir)/.build
make all
%install
make install
-
+strip /usr/bin/lilypond /usr/bin/mi2mu
%files
%doc Documentation/out/index.text Documentation/out/CodingStyle.text
%doc Documentation/out/lilygut.text Documentation/out/lilyinput.text
%doc Documentation/out/error.text Documentation/out/faq.text
%doc Documentation/out/INSTALL.text
-%doc Documentation/out/language.text Documentation/out/lelie_logo.png
+%doc Documentation/out/language.text Documentation/lelie_logo.gif
/usr/bin/lilypond
/usr/bin/mi2mu
/usr/man/man1/lilypond.1
-/usr/lib/texmf/texmf/tex/lilypond/*
-/usr/share/lilypond/*
+/usr/lib/texmf/texmf/tex/lilypond/
+/usr/share/lilypond/
%post
texhash
# generic variables:
#
-include ./$(depth)/make/Variables.make
+include ./$(depth)/make/Variables.make
+include ./$(depth)/make/Files.make
#
# identify module:
VERSION_DEPENDENCY = $(mi2mu-version)
#
-# list of c++ header files:
-#
-HHFILES := $(wildcard *.hh )
-#
-
-# list of c++ source files:
-#
-CCFILES := $(wildcard *.cc )
-#
-
-# list of other source files:
-#
-EXTRA_SOURCE_FILES := $(wildcard *.y *.l )
-#
# list of distribution files:
#
-DISTFILES = Makefile .version $(HHFILES) $(CCFILES) $(EXTRA_SOURCE_FILES)
+DISTFILES = Makefile .version $(ALL_SOURCES)
+
#
# list of custom libraries:
# list of depend files:
#
-DEPFILES = $(shell ls $(depdir)/*.dep $(ERROR_LOG))
+DEPFILES = $(wildcard $(depdir)/*.dep)
#
# auto dependencies:
# identify module:
#
MODULE_NAME = lilypond
-MAJOR_VERSION = $(TOPLEVEL_MAJOR_VERSION)
-MINOR_VERSION = $(TOPLEVEL_MINOR_VERSION)
-PATCH_LEVEL = $(TOPLEVEL_PATCH_LEVEL)
-# use to send patches, always empty for released version:
-MY_PATCH_LEVEL = $(TOPLEVEL_MY_PATCH_LEVEL)
-build = ./$(depth)/mi2mu/$(outdir)/.build
#
# generic stuff/Makefile
#
depth = ..
#
-
-build = ./$(depth)/lily/$(outdir)/.build
-
-# generic stuff/Makefile
#
-include ./$(depth)/make/Stuff.make
+include ./$(depth)/make/Include.make
#
# list of distribution files:
#
-TEXFILES = $(shell ls *.tex)
+TEXFILES = $(wildcard *.tex)
DISTFILES = Makefile $(TEXFILES)
#
localuninstall:
for i in $(TEXFILES) ; do rm -f $(TEXPREFIX)/lilypond/$$i; done
- -rmdir $(TEXPREFIX)/lilypond/
\ No newline at end of file
+ -rmdir $(TEXPREFIX)/lilypond/