From ead51a096fb478fecb867cf119d3555886872db9 Mon Sep 17 00:00:00 2001 From: fred Date: Sun, 24 Mar 2002 19:34:38 +0000 Subject: [PATCH] lilypond-0.0.40 --- flower/lib/Makefile | 31 ++++---- lib/Makefile | 27 ++++--- lily/Makefile | 25 +++--- make/Initial.make | 12 +-- make/Rules.make | 54 +++++++++++-- make/Template.make | 30 +++++--- mi2mu/Makefile | 106 ++++++++++++++++++++++++++ mi2mu/main.cc | 180 ++++++++++++++++++++++++++++++++++++++++++++ mi2mu/template.cc | 26 +++++++ mi2mu/version.cc | 18 +++++ 10 files changed, 444 insertions(+), 65 deletions(-) create mode 100644 mi2mu/Makefile create mode 100644 mi2mu/main.cc create mode 100644 mi2mu/template.cc create mode 100644 mi2mu/version.cc diff --git a/flower/lib/Makefile b/flower/lib/Makefile index 0eccc67beb..9bb2cfff69 100644 --- a/flower/lib/Makefile +++ b/flower/lib/Makefile @@ -13,6 +13,11 @@ depth = ../.. # +# generic variables: +# +include ./$(depth)/make/Variables.make +# + # identify module: # NAME = flower @@ -21,14 +26,9 @@ include ./$(depth)/flower/.version build = ./$(depth)/flower/lib/.build # -# generic variables: -# -include ./$(depth)/make/Variables.make -# - # descent order into subdirectories: # -SUBDIRS = include +SUBDIRS = include # # to be remade each build: @@ -38,17 +38,17 @@ VERSION_DEPENDENCY =# # list of c++ header files: # -HHFILES = # $(shell ls include/*.hh) +HHFILES = $(shell ls *.hh $(ERROR_LOG)) # # list of c++ source files: # -CCFILES = $(shell ls *.cc) +CCFILES = $(shell ls *.cc $(ERROR_LOG)) # # list of other source files: # -EXTRA_SOURCE_FILES =# $(shell ls *.y *.l) +EXTRA_SOURCE_FILES = $(shell ls *.y *.l $(ERROR_LOG)) # # list of distribution files: @@ -75,9 +75,9 @@ MAINTARGET = $(libdir)/$(LIBRARY)# huh? default: $(MAINTARGET) # -# sic. -$(include-flower)/flower-config.hh: - touch $@ +# # sic. +# $(include-flower)/flower-config.hh: +# touch $@ # generic targets and rules: # @@ -85,8 +85,13 @@ include ./$(depth)/make/Targets.make include ./$(depth)/make/Rules.make # +# list of depend files: +# +DEPFILES = $(shell ls $(depdir)/*.dep $(ERROR_LOG)) +# + # auto dependencies: # --include ./$(outdir)/*.dep +-include $(DEPFILES) # diff --git a/lib/Makefile b/lib/Makefile index 7da9879256..7609ecaa8b 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -13,6 +13,11 @@ depth = .. # +# generic variables: +# +include ./$(depth)/make/Variables.make +# + # identify module: # NAME = lily @@ -21,12 +26,7 @@ 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/.build -# - -# generic variables: -# -include ./$(depth)/make/Variables.make +build = $(lily-dir)/.build # # descent order into subdirectories: @@ -36,22 +36,22 @@ SUBDIRS = include # to be remade each build: # -VERSION_DEPENDENCY = $(lily-version) +VERSION_DEPENDENCY =# # # list of c++ header files: # -HHFILES = # $(shell ls include/*.hh) +HHFILES = $(shell ls *.hh $(ERROR_LOG)) # # list of c++ source files: # -CCFILES = $(shell ls *.cc) +CCFILES = $(shell ls *.cc $(ERROR_LOG)) # # list of other source files: # -EXTRA_SOURCE_FILES = # $(shell ls *.y *.l) +EXTRA_SOURCE_FILES = # $(shell ls *.y *.l $(ERROR_LOG)) # # list of distribution files: @@ -84,8 +84,13 @@ include ./$(depth)/make/Targets.make include ./$(depth)/make/Rules.make # +# list of depend files: +# +DEPFILES = $(shell ls $(depdir)/*.dep $(ERROR_LOG)) +# + # auto dependencies: # --include ./$(outdir)/*.dep +-include $(DEPFILES) # diff --git a/lily/Makefile b/lily/Makefile index f31a93426a..2302cf627c 100644 --- a/lily/Makefile +++ b/lily/Makefile @@ -13,6 +13,11 @@ depth = .. # +# generic variables: +# +include ./$(depth)/make/Variables.make +# + # identify module: # NAME = lilypond @@ -21,12 +26,7 @@ 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/.build -# - -# generic variables: -# -include ./$(depth)/make/Variables.make +build = $(lily-dir)/.build # # descent order into subdirectories: @@ -41,17 +41,17 @@ VERSION_DEPENDENCY = $(lily-version) # list of c++ header files: # -HHFILES = # $(shell ls include/*.hh) +HHFILES = $(shell ls *.hh $(ERROR_LOG)) # # list of c++ source files: # -CCFILES = $(shell ls *.cc) +CCFILES = $(shell ls *.cc $(ERROR_LOG)) # # list of other source files: # -EXTRA_SOURCE_FILES = $(shell ls *.y *.l) +EXTRA_SOURCE_FILES = $(shell ls *.y *.l $(ERROR_LOG)) # # list of distribution files: @@ -92,8 +92,13 @@ mylexer.cc: $(outdir)/parser.hh # sic lexer.l: $(outdir)/parser.hh # +# list of depend files: +# +DEPFILES = $(shell ls $(depdir)/*.dep $(ERROR_LOG)) +# + # auto dependencies: # --include ./$(outdir)/*.dep +-include $(DEPFILES) # diff --git a/make/Initial.make b/make/Initial.make index 24c5cecc3a..444eb661ca 100644 --- a/make/Initial.make +++ b/make/Initial.make @@ -31,19 +31,9 @@ include ./$(depth)/make/Variables.make # ugh # initdefault: $(CCDIR)/parser.cc $(CCDIR)/lexer.cc hdr/version.hh alldeps -initdefault: check-flower-version $(lily-version) dummydep +initdefault: check-flower-version $(lily-version) check-mi2mu-version dummydep # $(MAKE) -C ./$(depth)/lily $(outdir)/parser.cc -# ugh! -dummydep: - touch ./$(depth)/flower/lib/$(depdir)/dummy.dep - touch ./$(depth)/lib/$(depdir)/dummy.dep - touch ./$(depth)/lily/$(depdir)/dummy.dep - touch ./$(depth)/m2m/$(depdir)/dummy.dep - -#$(DEPDIR)/%.dep: $(CCDIR)/%.cc -# $(DODEP) $(CXX) -E $(CXXFLAGS) $^ > /dev/null - # generic targets and rules: # include ./$(depth)/make/Targets.make diff --git a/make/Rules.make b/make/Rules.make index 0c2a5493b2..6cea96f4eb 100644 --- a/make/Rules.make +++ b/make/Rules.make @@ -7,46 +7,84 @@ # Jan Nieuwenhuizen # Han-Wen Nienhuys +# this is supposed to clear all suffixes: .SUFFIXES: +# so why does make still consider xx.y : RCS/xx.y,v ? +# there is no suffix ,v anymore! .SUFFIXES: .cc .o .hh .y .l .pod .txt .1 .dep +# cancel implicit rules: +# +# shit, how to get rid of these stupid built-in rules? +# include ./$(depth)/make/Builtin-rules.make +# + # compile rules: # -$(outdir)/%.o: %.cc +$(outdir)/%.o: %.cc $(genout) $(DODEP)\ $(CXX) -c $(CXXFLAGS) $(CXX_OUTPUT_OPTION) -$(outdir)/%.cc: %.y +$(outdir)/%.cc: %.y $(genout) # $(BISON) -d $< $(BISON) $< # mv $(shell basename $@ .cc ).tab.h $(include-lib)/$(shell basename $@ .cc).hh # mv $(shell basename $@ .cc ).tab.h $(outdir)/$(shell basename $@ .cc).hh mv $(shell basename $@ .cc ).tab.c $@ -$(outdir)/%.hh: %.y +$(outdir)/%.hh: %.y $(genout) $(BISON) -d $< mv $(shell basename $@ .hh ).tab.h $@ mv $(shell basename $@ .hh ).tab.c $(outdir)/$(shell basename $@ .hh).cc -$(outdir)/%.cc: %.l +$(outdir)/%.cc: %.l $(genout) $(FLEX) -t $< > $@ $(outdir)/%.text: $(outdir)/%.1 groff -man -Tascii $< > $@ -$(outdir)/%.1: %.pod +$(outdir)/%.1: %.pod $(genout) pod2man --center="LilyPond documentation" --section="0"\ --release="LilyPond $(MAJVER).$(MINVER).$(PATCHLEVEL)" $< > $@ # +# outdirs: +# +# ?$(outdir)/%.dep: +%.dep: + touch $@ +$(outdir): + mkdir $(outdir) + @touch $(genout) +%/$(outdir):y + mkdir $@ + @touch $(@D)/$(genout) +$(genout): + mkdir $(outdir) + @touch $@ +%/$(genout): + mkdir $(@D)/$(outdir) + @touch $@ +# + +# build and config stuff: (could make this generic default rule...) +# +%/.build: + @echo 0 >$@ +$(flower-config): $(flower-dir)/$(genout) + touch $@ +$(lily-config): $(lib-dir)/$(genout) + @echo "#define LIBDIR \"./\"" >$@ +%.hh: + touch $@ +# + # specific stuff: # $(LIBFLOWER): check-flower-version -# $(MAKE) -C ./$(depth)/flower/lib $(MAKE) ./$(outdir)/$(@F) -C $(depth)/flower/lib # -$(LIBLILY): check-flower-version $(lily-version) -# $(MAKE) -C ./$(depth)/lib +$(LIBLILY): $(MAKE) ./$(outdir)/$(@F) -C $(depth)/lib # diff --git a/make/Template.make b/make/Template.make index 016ebf008f..d40318e37e 100644 --- a/make/Template.make +++ b/make/Template.make @@ -1,6 +1,6 @@ # THIS IS A TEMPLATE FOR SUB-PROJECT MAKEFILES # should we make Include-dir and Stuff-dir templates too? - +# # project LilyPond -- the musical typesetter # title makefile for ... # file ../Makefile @@ -15,21 +15,22 @@ depth = .. # +# generic variables: +# +include ./$(depth)/make/Variables.make +# + # identify module: # 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 = ./$(depth)/lily/.build -# - -# generic variables: -# -include ./$(depth)/make/Variables.make +build = $(lily-dir)/.build # # descent order into subdirectories: @@ -51,22 +52,22 @@ EXTRA_LDFLAGS = # list of c++ header files: # -HHFILES = $(shell ls *.hh) +HHFILES = $(shell ls *.hh $(ERROR_LOG)) # # list of c++ source files: # -CCFILES = $(shell ls *.cc) +CCFILES = $(shell ls *.cc $(ERROR_LOG)) # # list of other source files: # -EXTRA_SOURCE_FILES = $(shell ls *.y *.l) +EXTRA_SOURCE_FILES = $(shell ls *.y *.l $(ERROR_LOG)) # # list of distribution files: # -DISTFILES = $(HHFILES) $(CCFILES) $(EXTRA_SOURCE_FILES) +DISTFILES = Makefile $(HHFILES) $(CCFILES) $(EXTRA_SOURCE_FILES) # # list of custom libraries: @@ -90,8 +91,13 @@ include ./$(depth)/make/Targets.make include ./$(depth)/make/Rules.make # +# list of depend files: +# +DEPFILES = $(shell ls $(depdir)/*.dep $(ERROR_LOG)) +# + # auto dependencies: # -include ./$(outdir)/*.dep +-include $(DEPFILES) # diff --git a/mi2mu/Makefile b/mi2mu/Makefile new file mode 100644 index 0000000000..372695f7bd --- /dev/null +++ b/mi2mu/Makefile @@ -0,0 +1,106 @@ +# +# project LilyPond -- the musical typesetter +# title makefile for mi2mu +# file mi2mu/Makefile +# +# Copyright (c) 1997 by +# Jan Nieuwenhuizen +# Han-Wen Nienhuys +# + +# subdir level: +# +depth = .. +# + +# generic variables: +# +include ./$(depth)/make/Variables.make +# + +# identify module: +# +NAME = mi2mu +MODULE_NAME = mi2mu +include $(mi2mu-dir)/.version +build = $(mi2mu-dir)/.build +# + +# descent order into subdirectories: +# +SUBDIRS = include +# + +# to be remade each build: +# +VERSION_DEPENDENCY = $(mi2mu-version) +# + +# 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 .version $(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 = $(LIBLILY) $(LIBFLOWER) + +LOADLIBES += +# + +# main target of this module: +# +# MAINTARGET = $(EXECUTABLE) +# MAINTARGET = $(LIBRARY) +MAINTARGET = $(bindir)/$(EXECUTABLE)# huh? +# MAINTARGET = $(libdir)/$(LIBRARY)# huh? + +default: $(MAINTARGET) +# + +# generic targets and rules: +# +include ./$(depth)/make/Targets.make +include ./$(depth)/make/Rules.make +# + +# explicit dependencies: (how to do auto?) +# +midi-lexer.l: $(outdir)/midi-parser.hh +version.cc: check-flower-version $(mi2mu-version) +# + +# version: +# +mi2mu-version: $(mi2mu-dir)/$(genout) $(mi2mu-version) +$(mi2mu-version): $(mi2mu-dir)/$(genout) $(mi2mu-dir)/.version ./$(bindir)/make_version $(build) + ./$(bindir)/make_version "$(MAJOR_VERSION)" "$(MINOR_VERSION)" "$(PATCH_LEVEL)" "$(MY_PATCH_LEVEL)" "$(BUILD)" "$(CXX) $(CXXVER)" > $@ +# + +# list of depend files: +# +DEPFILES = $(shell ls $(depdir)/*.dep $(ERROR_LOG)) +# + +# auto dependencies: +# +-include $(DEPFILES) +# + diff --git a/mi2mu/main.cc b/mi2mu/main.cc new file mode 100644 index 0000000000..4971f451b2 --- /dev/null +++ b/mi2mu/main.cc @@ -0,0 +1,180 @@ +// +// main.cc -- implement silly main() entry point +// should have Root class. +// +// copyright 1997 Jan Nieuwenhuizen + +#include "mi2mu.hh" + +Source source; +Source* source_l_g = &source; + +Verbose level_ver = NORMAL_ver; + +// ugh +bool no_triplets_bo_g = false; + +//ugh +char const* defined_ch_c_l = 0; + +// ugh, another global +String +find_file( String str ) +{ + return str; +} + +// ugh, copied from warn.cc, cannot use +void +message( String message_str, char const* context_ch_c_l ) +{ + String str = "mi2mu: "; + 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(": "); + } + str += message_str; + if ( sourcefile_l ) { + str += ":\n"; + str += sourcefile_l->error_str( context_ch_c_l ); + } +// if ( busy_parsing() ) + cerr << endl; // until we have fine output manager... + cerr << str << endl; +} + +void +warning( String message_str, char const* context_ch_c_l ) +{ + message( "warning: " + message_str, context_ch_c_l ); +} + +void +error( String message_str, char const* context_ch_c_l ) +{ + message( message_str, context_ch_c_l ); + // since when exits error again? + // i-d say: error: errorlevel |= 1; -> no output upon error + // warning: recovery -> output (possibly wrong) + if ( midi_lexer_l_g ) + midi_lexer_l_g->errorlevel_i_ |= 1; +} + +void +help() +{ + btor << + "--debug, -d be really verbose\n" + "--help, -h this help\n" + "--include=DIR, -I DIR add DIR to search path\n" + "--no-triplets, -n assume no triplets\n" + "--output=FILE, -o FILE set FILE as default output\n" + "--quiet, -q be quiet\n" + "--verbose, -v be verbose\n" + "--warranty, -w show warranty & copyright\n" + ; +} + +void +identify() +{ + mtor << version_str() << endl; +} + +void +notice() +{ + mtor << + "\n" + "Mi2mu, translate midi to mudela.\n" + "Copyright (C) 1997 by\n" + " Han-Wen Nienhuys \n" +// "Contributors\n" + " Jan Nieuwenhuizen \n" +// " Mats Bengtsson \n" + "\n" + " 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" + "\n" + " This program is distributed in the hope that it will be useful,\n" + "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" + "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n" + "General Public License for more details.\n" + "\n" + " You should have received a copy (refer to the file COPYING) of the\n" + "GNU General Public License along with this program; if not, write to\n" + "the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139,\n" + "USA.\n"; +} + +int +main( int argc_i, char* argv_sz_a[] ) +{ + Long_option_init long_option_init_a[] = { + 0, "debug", 'd', + 0, "help", 'h', +// 1, "include", 'I', + 0, "no-triplets", 'n', + 1, "output", 'o', + 0, "quiet", 'q', + 0, "verbose", 'v', + 0, "warranty", 'w', + 0,0,0 + }; + Getopt_long getopt_long( argc_i, argv_sz_a, long_option_init_a ); + identify(); + + String output_str; + while ( Long_option_init* long_option_init_p = getopt_long() ) + switch ( long_option_init_p->shortname ) { + case 'd': + level_ver = DEBUG_ver; + break; + case 'h': + help(); + exit( 0 ); + break; +// case 'I': +// path->push( getopt_long.optarg ); +// break; + case 'n': + no_triplets_bo_g = true; + break; + case 'o': + output_str = getopt_long.optarg; + break; + case 'q': + level_ver = QUIET_ver; + break; + case 'v': + level_ver = VERBOSE_ver; + break; + case 'w': + notice(); + exit( 0 ); + break; + default: + assert( 0 ); + break; + } + + char* arg_sz = 0; + while ( ( arg_sz = getopt_long.get_next_arg() ) ) { + My_midi_parser midi_parser( arg_sz ); + int error_i = midi_parser.parse(); + if ( error_i ) + return error_i; + if ( !output_str.length_i() ) { + output_str = String( arg_sz ) + ".ly"; + // i-m sure there-s already some routine for this + int name_i; // too bad we can-t declare local to if + if ( ( name_i = output_str.index_last_i( '/' ) ) != -1 ) + output_str = output_str.mid_str( name_i + 1, INT_MAX ); + } + error_i = midi_parser.output_mudela( output_str ); + if ( error_i ) + return error_i; + } + return 0; +} diff --git a/mi2mu/template.cc b/mi2mu/template.cc new file mode 100644 index 0000000000..be7a2a2352 --- /dev/null +++ b/mi2mu/template.cc @@ -0,0 +1,26 @@ +// +// template.cc -- implementemplate +// +// copyright 1997 Jan Nieuwenhuizen + +#include "proto.hh" +#include "list.hh" +#include "list.tcc" +#include "cursor.tcc" + +L_instantiate(void *); + +class istream; +class ostream; + +#include "mi2mu.hh" +#include "plist.hh" +#include "plist.tcc" + +IPL_instantiate(Midi_event); +IPL_instantiate(Midi_track); +PL_instantiate(Midi_voice); +IPL_instantiate(Midi_voice); +IPL_instantiate(Source_file); +IPL_instantiate(Track_column); + diff --git a/mi2mu/version.cc b/mi2mu/version.cc new file mode 100644 index 0000000000..cb58c6b5b2 --- /dev/null +++ b/mi2mu/version.cc @@ -0,0 +1,18 @@ +// +// version.cc -- implement inexpensive versioning +// +// copyright 1997 Jan Nieuwenhuizen + +#include "mi2mu.hh" +#include "fversion.hh" +#include "version.hh" + +// should simply have Root class... +String +version_str() +{ + return String ( "This is mi2mu " ) + VERSIONSTR + + "/FlowerLib " + FVERSIONSTR + + " of " + __DATE__ + " " + __TIME__; +} + -- 2.39.5