+2002-07-05 Jan Nieuwenhuizen <janneke@gnu.org>
+
+ * lily/include/stream.hh:
+ * lily/include/moment.hh:
+ * lily/include/midi-stream.hh:
+ * lily/streams.cc:
+ * lily/scm-option.cc:
+ * lily/parser.yy:
+ * lily/my-lily-lexer.cc:
+ * lily/moment.cc:
+ * lily/midi-stream.cc:
+ * lily/main.cc:
+ * lily/lexer.ll:
+ * lily/includable-lexer.cc:
+ * flower/include/source-file.hh:
+ * flower/include/parray.hh:
+ * flower/include/dictionary.hh:
+ * flower/include/array.icc:
+ * flower/string.cc:
+ * flower/source-file.cc:
+ * flower/getopt-long.cc: gcc-3.1 fixes.
+
+ * stepmake/stepmake/generic-targets.make: Add comment about warning.
+
+ * lexer-gcc-3.0.patch: Add comment, and a fix for installations
+ that have an unpatched flex and gcc-3.1.x.
+
+ * Documentation/topdocs/INSTALL.texi: Add comments and
+ instructions on gcc-3.1.x.
+
+ * lexer-gcc-3.1.sh: New file.
+
+ * aclocal.m4: regenerate.
+
+ * stepmake/aclocal.m4: Version compare fix.
+
2002-07-05 Han-Wen <hanwen@cs.uu.nl>
* ly/engraver-init.ly (RhythmicStaffContext): stems up by default.
Check out @uref{ftp://ftp.gnu.org/gnu/gcc/, the gcc site}.
WARNING: if you choose to upgrade to GCC 3.x, enquire if your
-distribution supports g++ 3.x and flex.
+distribution supports g++ 3.x and flex. At the time of writing (Fri
+Jul 5 2002), @strong{no} distribution that we know of ships a flex
+that generates gcc-3.1.x compliant C++ code.
@item Python (version 1.5 or newer).
Check out @uref{http://www.python.org, the python website}.
WARNING: plain Flex 2.5.4(a) generates invalid C++ code. GCC 3.x
chokes on this. If you wish to use GCC 3.x, make sure that your
-distribution supports g++ 3.x and flex. For a workaround, see
-lexer-gcc-3.0 below.
+distribution supports g++ 3.x and flex. For workarounds, see
+lexer-gcc-3.0.patch and lexer-gcc-3.1.sh in the source directory.
@item Bison (version 1.25 or newer).
Check out @uref{http://www.gnu.org/software/bison/,the bison webpage}
Bugs that are not fault of LilyPond are documented here.
-@unnumberedsubsec FLex-2.5.4a and gcc-3.0
+@unnumberedsubsec Flex-2.5.4a and gcc-3.x
Flex 2.5.4a does not produce g++-3.0 compliant C++ code. To compile
LilyPond with gcc-3.0 you may do:
Note that this is fixed in Debian/unstable for flex >= 2.5.4a-13.
+@unnumberedsubsec Flex-2.5.4a and gcc-3.1.x
+
+Flex 2.5.4a does not produce g++-3.1.1 compliant C++ code. To compile
+LilyPond with gcc-3.1.1 you may do:
+
+@example
+ CONF=gcc-3.1 ./lexer-gcc-3.1.sh
+ CPPFLAGS=$(pwd)/lily/out-gcc-3.1 CC=gcc-3.1 CXX=g++-3.1 \
+ ./configure --enable-config=gcc-3.1
+ CONF=gcc-3.1 ./lexer-gcc-3.1.sh
+ make conf=gcc-3.1
+@end example
+
+Note that this is @strong{not} fixed in Debian/unstable for flex <=
+2.5.4a-26.
+
@unnumberedsubsec Linux-2.4.0, Guile-1.4 --with-threads
There's a bug in certain kernels around version 2.4.0, that is
if ([$]3) {three = [$]3}
else {three = 0}
}
- {printf "%s%s%s\n", [$]1*100, [$]2*10, three}'
+ {printf "%d\n", [$]1*1000000 + [$]2*1000 + three}'
])
#include <string.h>
#include <stdio.h>
-#include <iostream.h>
#include <assert.h>
#include <stdlib.h>
+#include <iostream>
+
#include "config.h"
#include "getopt-long.hh"
#include "international.hh"
}
template<class T> INLINE void
-Array<T>::sort (int (*compare) (T const&,T const&),
- int lower = -1, int upper = -1)
+Array<T>::sort (int (*compare) (T const&,T const&), int lower, int upper)
{
if (lower < 0)
{
}
bool elem_b (String s)
{
- std::map<String,V>::const_iterator ki (find (s));
+ typename std::map<String,V>::const_iterator ki (find (s));
return ki != end ();
}
template<class T> inline void
-Link_array<T>::sort (int (*compare) (T *const&,T *const&),
- int lower = -1, int upper = -1)
+Link_array<T>::sort (int (*compare)(T *const&,T *const&), int lower, int upper)
{
if (lower < 0)
{
#ifndef SOURCE_FILE_HH
#define SOURCE_FILE_HH
-#include <iostream.h>
+#include <iostream>
#include "flower-proto.hh"
#include "string.hh"
char const* ch_C () const;
virtual String error_str (char const* pos_ch_C ) const;
- istream * istream_l ();
+ std::istream * istream_l ();
bool in_b (char const* pos_ch_C ) const;
int length_i () const;
virtual int line_i (char const* pos_ch_C ) const;
private:
String name_str_;
- istream* istream_p_;
+ std::istream* istream_p_;
File_storage * storage_p_;
};
#include <assert.h>
-#include <strstream.h>
+#include <sstream>
#include "string.hh"
#include "flower-proto.hh"
pos_ch_C_ = ch_C ();
}
-istream*
+std::istream*
Source_file::istream_l ()
{
/*
if (!istream_p_)
{
if (length_i ()) // can-t this be done without such a hack?
- istream_p_ = new istrstream (ch_C (), length_i ());
+ istream_p_ = new std::stringstream (ch_C ());
else
{
- istream_p_ = new istrstream ("", 0);
- istream_p_->setstate (ios::eofbit);
+ istream_p_ = new std::istringstream ("");
+ istream_p_->setstate (std::ios::eofbit);
// istream_p_->set (ios::eofbit);
}
}
#include <stdlib.h>
#include <stdio.h>
-#include <iostream.h>
#include <assert.h>
#include <string.h>
#include <stdarg.h>
+#include <iostream>
+
#include "string.hh"
#include "libc-extension.hh"
#include "string-convert.hh"
+# Patch file documenting fix for flex-2.5.4 and gcc-3.x
+#
+# For usage of this patch, see INSTALL.txt
+
--- ./lily/out-gcc-3.0/lexer.cc~ Tue Jun 26 13:12:26 2001
+++ ./lily/out-gcc-3.0/lexer.cc Tue Jun 26 13:11:56 2001
@@ -21,7 +21,7 @@
#include <stdlib.h>
-class istream;
-+#include <iostream.h>
++#include <iostream>
#include <unistd.h>
/* Use prototypes in function declarations. */
--- /dev/null
+#!/bin/sh
+#
+# script documenting fixes for flex-2.5.4 and gcc-3.1
+
+includes="$HOME/usr/include /usr/local/include /usr/include"
+
+for i in $includes; do
+ file=$i/FlexLexer.h
+ if [ -f "$file" ]; then
+ break
+ else
+ file=
+ fi
+done
+
+if [ -z "$file" ]; then
+ cat <<EOF
+FlexLexer.h not found in $includes
+
+Please install flex, or find and fix FlexLexer.h by hand.
+EOF
+ exit 1
+fi
+
+
+if [ -n "$CONF" ]; then
+ CONFIGSUFFIX=-$CONF
+ ENABLECONFIG="--enable-config=$CONF"
+fi
+outdir=out$CONFIGSUFFIX
+
+echo -n "Copying and fixing $file... "
+mkdir -p lily/$outdir
+rm -f lily/$outdir/FlexLexer.h
+sed -e 's/iostream.h/iostream/' \
+ -e 's/\<istream\>/std::istream/' \
+ -e 's/\<ostream\>/std::ostream/' \
+ $file > lily/$outdir/FlexLexer.h
+echo "done"
+
+file=lily/$outdir/lexer.cc
+rm -f $file
+make conf=$CONF -C lily $outdir/lexer.cc || exit 0
+
+if [ -f "$file" ]; then
+ echo -n "Generating and fixing $file... "
+
+ mv $file $file.orig
+ sed -e 's/\<cin\>/std::cin/g' \
+ -e 's/\<cout\>/std::cout/g' \
+ -e 's/\<cerr\>/std::cerr/g' \
+ $file.orig > $file
+ echo "done"
+fi
+
+cat <<EOF
+
+Remove config.cache before rerunning ./configure
+
+Reconfigure doing something like:
+
+ CPPFLAGS=-I$(pwd)/lily/$outdir ./configure $ENABLECONFIG
+EOF
(c) 1997--2002 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
-#include <strstream.h>
+#include <sstream>
#include "file-path.hh"
#ifndef MIDI_STREAM_HH
#define MIDI_STREAM_HH
-#include <iostream.h>
+#include <iostream>
#include "string.hh"
/// Midi outputfile
void open ();
- ostream* os_p_;
+ std::ostream* os_p_;
String filename_str_;
};
#ifdef STREAM_SUPPORT
-ostream & operator << ( ostream &,Moment const &);
+std::ostream & operator << (std::ostream &, Moment const &);
#endif
#endif /* MOMENT_HH */
#ifndef STREAM_HH
#define STREAM_HH
-#include "string.hh"
+#include <iostream>
+#include <sstream>
+
+#include "string.hh"
-#include <iostream.h> /* gcc 3.0 */
#if __GNUC__ > 2
-ostream *open_file_stream (String filename,
- std::ios_base::openmode mode=std::ios::out);
+std::ostream *open_file_stream (String filename,
+ std::ios_base::openmode mode=std::ios::out);
#else
-ostream *open_file_stream (String filename, int mode=ios::out);
+std::ostream *open_file_stream (String filename, int mode=ios::out);
#endif
-void close_file_stream (ostream *os);
-
-
+void close_file_stream (std::ostream *os);
#endif /* STREAM_HH */
#include <stdio.h>
#include <ctype.h>
-#include <iostream.h> /* gcc 3.0 */
#include <errno.h>
+#include <iostream>
#include "score.hh"
#include "lily-guile.hh"
#include <stdlib.h>
#include <stdio.h>
-#include <iostream.h>
#include <assert.h>
#include <locale.h>
#include <stdio.h>
+#include <iostream>
+
#include "config.h"
#if HAVE_GETTEXT
/*
No version number or newline here. It confuses help2man
*/
- cout << _f ("Usage: %s [OPTION]... FILE...", "lilypond").ch_C();
- cout << "\n\n";
- cout << _ ("Typeset music and or play MIDI from FILE").ch_C();
- cout << "\n\n";
- cout <<
+ std::cout << _f ("Usage: %s [OPTION]... FILE...", "lilypond").ch_C();
+ std::cout << "\n\n";
+ std::cout << _ ("Typeset music and or play MIDI from FILE").ch_C();
+ std::cout << "\n\n";
+ std::cout <<
_ (
"LilyPond is a music typesetter. It produces beautiful sheet music\n"
"using a high level description file as input. LilyPond is part of \n"
"the GNU Project.\n"
).ch_C();
- cout << '\n';
- cout << _ ("Options:").ch_C();
- cout << '\n';
- cout << Long_option_init::table_str (options_static).ch_C();
- cout << '\n';
- cout << _ ("This binary was compiled with the following options:") .ch_C()
+ std::cout << '\n';
+ std::cout << _ ("Options:").ch_C();
+ std::cout << '\n';
+ std::cout << Long_option_init::table_str (options_static).ch_C();
+ std::cout << '\n';
+ std::cout << _ ("This binary was compiled with the following options:") .ch_C()
<< " " <<
#ifdef NDEBUG
"NDEBUG "
"\n";
- cout << endl;
+ std::cout << std::endl;
- cout << _f ("Report bugs to %s", "bug-lilypond@gnu.org").ch_C() << endl;
+ std::cout << _f ("Report bugs to %s", "bug-lilypond@gnu.org").ch_C() << std::endl;
}
void
version ()
{
identify (stdout);
- cout << '\n';
- cout << _f (""
+ std::cout << '\n';
+ std::cout << _f (""
"This is free software. It is covered by the GNU General Public License,\n"
"and you are welcome to change it and/or distribute copies of it under\n"
"certain conditions. Invoke as `%s --warranty' for more information.\n",
"lilypond").ch_C();
- cout << endl;
+ std::cout << std::endl;
- cout << _f ("Copyright (c) %s by", "1996--2002").ch_C();
- cout << '\n';
- cout << " Han-Wen Nienhuys <hanwen@cs.uu.nl>\n";
- cout << " Jan Nieuwenhuizen <janneke@gnu.org>\n";
+ std::cout << _f ("Copyright (c) %s by", "1996--2002").ch_C();
+ std::cout << '\n';
+ std::cout << " Han-Wen Nienhuys <hanwen@cs.uu.nl>\n";
+ std::cout << " Jan Nieuwenhuizen <janneke@gnu.org>\n";
}
void
notice ()
{
- cout << '\n';
- cout << _ ("GNU LilyPond -- The music typesetter").ch_C();
- cout << '\n';
- cout << _f ("Copyright (c) %s by", "1996--2002").ch_C();
- cout << '\n';
- cout << " Han-Wen Nienhuys <hanwen@cs.uu.nl>\n";
- cout << " Jan Nieuwenhuizen <janneke@gnu.org>\n";
- cout << '\n';
- cout << _ (
+ std::cout << '\n';
+ std::cout << _ ("GNU LilyPond -- The music typesetter").ch_C();
+ std::cout << '\n';
+ std::cout << _f ("Copyright (c) %s by", "1996--2002").ch_C();
+ std::cout << '\n';
+ std::cout << " Han-Wen Nienhuys <hanwen@cs.uu.nl>\n";
+ std::cout << " Jan Nieuwenhuizen <janneke@gnu.org>\n";
+ std::cout << '\n';
+ std::cout << _ (
" This program is free software; you can redistribute it and/or\n"
"modify it under the terms of the GNU General Public License version 2\n"
"as published by the Free Software Foundation.\n"
*/
init_lily_guile (prefix_directory);
- cout << endl;
+ std::cout << std::endl;
call_constructors ();
all_fonts_global_p = new All_font_metrics (global_path.str ());
Midi_stream::Midi_stream (String filename)
{
filename_str_ = filename;
-#if __GCC__ > 2
- os_p_ = open_file_stream (filename, ios::out|ios::bin);
-#else
- os_p_ = open_file_stream (filename, ios::out|ios::binary);
-#endif
+ os_p_ = open_file_stream (filename, std::ios::out|std::ios::binary);
}
Midi_stream::~Midi_stream ()
#ifdef STREAM_SUPPORT
-ostream &
-operator << (ostream &os, Moment const &m)
+std::ostream &
+operator << (std::ostream &os, Moment const &m)
{
os << m.str ();
return os;
(c) 1997--2002 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
-#include <strstream.h>
#include <ctype.h>
+#include <sstream>
+
#include "lily-proto.hh"
#include "scm-hash.hh"
#include "interval.hh"
*/
#include <ctype.h>
-#include <iostream.h>
+
+//#include <iostream>
#include "translator-def.hh"
#include "lily-guile.hh"
*/
-#include <iostream.h>
+#include <iostream>
#include "string.hh"
#include "lily-guile.hh"
*/
if (var == ly_symbol2scm ("help"))
{
- cout << _("lilypond -e EXPR means
+ std::cout << _("lilypond -e EXPR means
evalute EXPR as Scheme after init.scm has been read. In particular,
the function set-lily-option allows for access to some internal
(set-lily-option SYMBOL VAL)
possible options for SYMBOL are :
-").ch_C()<<endl;
+").ch_C()<< std::endl;
- cout << " help (any-symbol)"<<endl;
- cout << " internal-type-checking (boolean)"<<endl;
- cout << " midi-debug (boolean)"<<endl;
- cout << " testing-level (int)"<<endl;
+ std::cout << " help (any-symbol)"<< std::endl;
+ std::cout << " internal-type-checking (boolean)"<< std::endl;
+ std::cout << " midi-debug (boolean)"<< std::endl;
+ std::cout << " testing-level (int)"<< std::endl;
exit (0);
}
#if HAVE_SYS_STAT_H
#include <sys/stat.h>
#endif
-#include <iostream.h>
-#include <fstream.h>
+
+#include <iostream>
+#include <fstream>
#include "stream.hh"
#include "file-path.hh"
#include "main.hh"
#if __GNUC__ > 2
-ostream *
+std::ostream *
open_file_stream (String filename, std::ios_base::openmode mode)
#else
-ostream *
+std::ostream *
open_file_stream (String filename, int mode)
#endif
{
- ostream *os;
+ std::ostream *os;
if ((filename == "-"))
- os = &cout;
+ os = &std::cout;
else
{
Path p = split_path (filename);
if (!p.dir.empty_b ())
if (mkdir (p.dir.ch_C (), 0777) == -1 && errno != EEXIST)
error (_f ("can't create directory: `%s'", p.dir));
- os = new ofstream (filename.ch_C (), mode);
+ os = new std::ofstream (filename.ch_C (), mode);
}
if (!*os)
error (_f ("can't open file: `%s'", filename));
}
void
-close_file_stream (ostream *os)
+close_file_stream (std::ostream *os)
{
- *os << flush;
+ *os << std::flush;
if (!*os)
{
warning (_ ("Error syncing file (disk full?)"));
exit_status_global = 1;
}
- if (os != &cout)
+ if (os != &std::cout)
delete os;
os = 0;
}
if ([$]3) {three = [$]3}
else {three = 0}
}
- {printf "%s%s%s\n", [$]1*100, [$]2*10, three}'
+ {printf "%d\n", [$]1*1000000 + [$]2*1000 + three}'
])
$(foreach i, $(EXTRA_DOC_FILES),\
cp -r $(i) $(prefix)/doc/$(package) &&) true
-include $(outdir)/dummy.dep $(DEP_FILES)
+include $(outdir)/dummy.dep $(DEP_FILES) # expect a warning here
$(outdir)/dummy.dep:
-mkdir -p $(outdir)