diff options
Diffstat (limited to 'Build/source/utils')
36 files changed, 767 insertions, 261 deletions
diff --git a/Build/source/utils/README b/Build/source/utils/README index ac77c5346d5..bdfd3b6d080 100644 --- a/Build/source/utils/README +++ b/Build/source/utils/README @@ -15,7 +15,7 @@ devnag - from devanagari package installed in texmf-dist. lacheck - maintained here, by us -m-tx 0.61 - checked 17dec15 +m-tx 0.62 - checked 10feb16 http://mirror.ctan.org/support/m-tx/ pmx 2.7.3 - checked 10feb16 diff --git a/Build/source/utils/m-tx/ChangeLog b/Build/source/utils/m-tx/ChangeLog index 6fe66362fa0..b278d7b4285 100644 --- a/Build/source/utils/m-tx/ChangeLog +++ b/Build/source/utils/m-tx/ChangeLog @@ -1,3 +1,7 @@ +2016-02-10 Akira Kakuto <kakuto@fuk.kindai.ac.jp> + + * Import m-tx 0.62. + 2015-12-18 Akira Kakuto <kakuto@fuk.kindai.ac.jp> * tests/mozart.pmx: Fix for the version 0.61. Thanks to Luigi. diff --git a/Build/source/utils/m-tx/configure b/Build/source/utils/m-tx/configure index b3a5ce9df9d..86c5ac4d354 100755 --- a/Build/source/utils/m-tx/configure +++ b/Build/source/utils/m-tx/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for m-tx (TeX Live) 0.61. +# Generated by GNU Autoconf 2.69 for m-tx (TeX Live) 0.62. # # Report bugs to <tex-k@tug.org>. # @@ -580,8 +580,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='m-tx (TeX Live)' PACKAGE_TARNAME='m-tx--tex-live-' -PACKAGE_VERSION='0.61' -PACKAGE_STRING='m-tx (TeX Live) 0.61' +PACKAGE_VERSION='0.62' +PACKAGE_STRING='m-tx (TeX Live) 0.62' PACKAGE_BUGREPORT='tex-k@tug.org' PACKAGE_URL='' @@ -1275,7 +1275,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures m-tx (TeX Live) 0.61 to adapt to many kinds of systems. +\`configure' configures m-tx (TeX Live) 0.62 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1341,7 +1341,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of m-tx (TeX Live) 0.61:";; + short | recursive ) echo "Configuration of m-tx (TeX Live) 0.62:";; esac cat <<\_ACEOF @@ -1438,7 +1438,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -m-tx (TeX Live) configure 0.61 +m-tx (TeX Live) configure 0.62 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -1861,7 +1861,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by m-tx (TeX Live) $as_me 0.61, which was +It was created by m-tx (TeX Live) $as_me 0.62, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -3784,7 +3784,7 @@ fi # Define the identity of the package. PACKAGE='m-tx--tex-live-' - VERSION='0.61' + VERSION='0.62' cat >>confdefs.h <<_ACEOF @@ -5868,7 +5868,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by m-tx (TeX Live) $as_me 0.61, which was +This file was extended by m-tx (TeX Live) $as_me 0.62, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -5925,7 +5925,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -m-tx (TeX Live) config.status 0.61 +m-tx (TeX Live) config.status 0.62 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff --git a/Build/source/utils/m-tx/mtx-src-PATCHES/ChangeLog b/Build/source/utils/m-tx/mtx-src-PATCHES/ChangeLog index c5d615389e2..0f2b678a6c1 100644 --- a/Build/source/utils/m-tx/mtx-src-PATCHES/ChangeLog +++ b/Build/source/utils/m-tx/mtx-src-PATCHES/ChangeLog @@ -1,3 +1,8 @@ +2016-02-10 Akira Kakuto <kakuto@fuk.kindai.ac.jp> + + * patch-01-write-bin, patch-02-malloc, patch-03-different-size: + Update for 0.62. + 2015-12-17 Akira Kakuto <kakuto@fuk.kindai.ac.jp> * patch-01-write-bin, patch-02-malloc, patch-03-different-size: diff --git a/Build/source/utils/m-tx/mtx-src-PATCHES/TL-Changes b/Build/source/utils/m-tx/mtx-src-PATCHES/TL-Changes index 5c42af1ad01..49723579796 100644 --- a/Build/source/utils/m-tx/mtx-src-PATCHES/TL-Changes +++ b/Build/source/utils/m-tx/mtx-src-PATCHES/TL-Changes @@ -1,4 +1,4 @@ -Changes applied to the mtx-0.61 tree as obtained from: +Changes applied to the mtx-0.62 tree as obtained from: http://www.ctan.org/tex-archive/support/m-tx/ Remove: diff --git a/Build/source/utils/m-tx/mtx-src-PATCHES/patch-01-write-bin b/Build/source/utils/m-tx/mtx-src-PATCHES/patch-01-write-bin index 150ebbd6caf..0c85cedf4f8 100644 --- a/Build/source/utils/m-tx/mtx-src-PATCHES/patch-01-write-bin +++ b/Build/source/utils/m-tx/mtx-src-PATCHES/patch-01-write-bin @@ -1,5 +1,6 @@ ---- mtx-0.61.orig/globals.c Thu Dec 17 04:15:57 2015 -+++ mtx-0.61/globals.c Thu Dec 17 08:57:13 2015 +diff -ur mtx-0.62.orig/globals.c mtx-0.62/globals.c +--- mtx-0.62.orig/globals.c Tue Feb 09 05:51:40 2016 ++++ mtx-0.62/globals.c Thu Feb 11 01:50:54 2016 @@ -223,7 +223,7 @@ if (outfile != NULL) fclose(outfile); diff --git a/Build/source/utils/m-tx/mtx-src-PATCHES/patch-02-malloc b/Build/source/utils/m-tx/mtx-src-PATCHES/patch-02-malloc index d1ba9181f0f..178d04ee483 100644 --- a/Build/source/utils/m-tx/mtx-src-PATCHES/patch-02-malloc +++ b/Build/source/utils/m-tx/mtx-src-PATCHES/patch-02-malloc @@ -1,6 +1,7 @@ ---- mtx-0.61.orig/multfile.c Thu Dec 17 04:17:40 2015 -+++ mtx-0.61/multfile.c Thu Dec 17 09:03:39 2015 -@@ -60,7 +60,7 @@ +diff -ur mtx-0.62.orig/multfile.c mtx-0.62/multfile.c +--- mtx-0.62.orig/multfile.c Tue Feb 09 05:52:29 2016 ++++ mtx-0.62/multfile.c Thu Feb 11 01:52:08 2016 +@@ -61,7 +61,7 @@ printf("===! Ignoring recursive include of file %s\n", filename); return; } diff --git a/Build/source/utils/m-tx/mtx-src-PATCHES/patch-03-different-size b/Build/source/utils/m-tx/mtx-src-PATCHES/patch-03-different-size index 0eb96f3c8e2..d51fd15b774 100644 --- a/Build/source/utils/m-tx/mtx-src-PATCHES/patch-03-different-size +++ b/Build/source/utils/m-tx/mtx-src-PATCHES/patch-03-different-size @@ -1,5 +1,6 @@ ---- mtx-0.61.orig/libp2c/p2c.h Wed Mar 17 00:28:20 1999 -+++ mtx-0.61/libp2c/p2c.h Thu Dec 17 09:00:24 2015 +diff -ur mtx-0.62.orig/libp2c/p2c.h mtx-0.62/libp2c/p2c.h +--- mtx-0.62.orig/libp2c/p2c.h Tue Feb 09 05:23:09 2016 ++++ mtx-0.62/libp2c/p2c.h Thu Feb 11 01:54:30 2016 @@ -428,10 +428,10 @@ /* Memory allocation */ diff --git a/Build/source/utils/m-tx/mtx-src/ChangeLog b/Build/source/utils/m-tx/mtx-src/ChangeLog index 6169851f3aa..de5c759a9ad 100644 --- a/Build/source/utils/m-tx/mtx-src/ChangeLog +++ b/Build/source/utils/m-tx/mtx-src/ChangeLog @@ -1,12 +1,57 @@ - Corrections and enhancements to M-Tx starting from 0.53 - Newest items at top +Corrections and enhancements to M-Tx starting from 0.53 +======================================================= + +Newest items at top. You might also want to look at file `MAINTENANCE`. + +Version 0.62a +------------- + +1. Fonts bigtype and BIgtype, needed because PMX header font sizes +were made smaller in July 2015, added to \mtxPalatino. Also, for +completeness, \mtxbigsf and \mtxBIGsf. This version tagged on GitHub +as 0.62. + +Version 0.62 +------------ + +1. `\mtxlatex` command no longer needed. +2. Various subtleties in the code have been commented. + +Version 0.61a +------------- + +1. Special code for multi-bar rests removed, taking advantage of +upstream improvements. +2. MusiXTeX 1.21 and PMX 2.71 required in `mtx.tex`. +3. When the last line of a file does not have an end-of-line, +its line number in comments and error messages was 0. Corrected now. +(This bug was almost 11 years old.) Version 0.61 - `TeX` preamble command for Type 2 TeX strings. - Assertions: Range, Bars. - User's Manual thoroughly revised. - Misnamed procedure `tex3` is now `TeXtype2`. - Page and font macros are included in `mtx.tex`. +------------ + +Mainly aids to the programmer. + +1. `TeX` preamble command for Type 2 TeX strings. +2. Assertions: Range, Bars. +3. User's Manual thoroughly revised. +4. Misnamed procedure `tex3` is now `TeXtype2`. +5. Page and font macros are included in `mtx.tex`. +6. The part of this file above the horizontal line is in Markdown. + + +---------------------------------------------------------------------- + +Version 0.60f + notes.pas: {$V-} inserted since otherwise Pascal 2.6.2 regards it as an + error to pass a var argument of type `string[16]` to a procedure that + expects type `string`. + lyrics.pas: tests for empty lyrics paragraph + +Version 0.60e (RETRACTED) + Any bar word starting with `|` terminates a pickup, not only `|`. + Actually the manual was clear on this point, so the current version + has reverted to 0.60d. Version 0.60d Replaced space character tie label by no label, @@ -185,3 +230,11 @@ Version 0.53a preamble.pas: added trailing backslash to \mtxTenorClef mtx.tex: changed \mtxmtxNormalSize to \mtxNormalSize +Changes since 0.52b, undated. + Uses mtx.tex file + More than one # or % per word treated correctly in uptext + Better way of handling line numbers in lyrics + +For earlier history, see comments in prepmx.pas of 0.52b. + + diff --git a/Build/source/utils/m-tx/mtx-src/ChangeLog.C b/Build/source/utils/m-tx/mtx-src/ChangeLog.C deleted file mode 100644 index 34a54157f8c..00000000000 --- a/Build/source/utils/m-tx/mtx-src/ChangeLog.C +++ /dev/null @@ -1,4 +0,0 @@ -2012-05-16 Peter Breitenlohner <peb@mppmu.mpg.de> - - * patch-01-write-bin (new): Use binary mode for output files. - From Akira Kakuto <kakuto@fuk.kindai.ac.jp> (W32TeX). diff --git a/Build/source/utils/m-tx/mtx-src/MAINTENANCE b/Build/source/utils/m-tx/mtx-src/MAINTENANCE new file mode 100644 index 00000000000..3fa6459e86c --- /dev/null +++ b/Build/source/utils/m-tx/mtx-src/MAINTENANCE @@ -0,0 +1,278 @@ +Notes for maintainers of M-Tx +============================= + +This file is for someone who wishes to fix a bug, without actually being +willing to master the whole program of well over 4000 lines spread over +16 files. + +1. Quick start +-------------- + +The main program is `prepmx.pas`. The other files are units. + +There are three places in each file that give a lot of useful information. +When you have a spare moment, look at those. It will save time later. + +1. Immediately after the first line, there should be a comment + containing a short description of what is in the file. +2. After the keyword `interface`, there may be a `uses` statement + listing the units needed in order that the interface (the Pascal + equivalent of a C header file) can be defined. +3. After the keyword `implementation`, there may be a `uses` statement + listing the further units needed in order that the implementation + (the equivalent of a C code file) can be defined. + +Instead of some dull generalities, here is a blow-by-blow account of how an +actual bug reported by Wojtek Chemijewski on the Werner Icking Music Archive +mailing list `<tex-music@tug.org>` on 2014-01-29 was found and "corrected". + +2. Case study +------------- + +I'm doing this from a command line in Ubuntu Linux, so I use `grep`. +Any other tool that can search for text in the Pascal source files +will do equally well. + +In M-Tx 0.60, the following behaviour was considered to be a bug: + +> If the piece starts with a pickup, then the bar separator at the end +of the pickup is only recognized as terminating a pickup when it is +a plain bar line `|`, not when it is a left repeat `|:`. + +There are workarounds for this, the best one being to not use plain bar +lines but to use the PMX command `Rl` in the lowest voice (which becomes +the first voice in PMX). That is not the point. We want M-Tx to do this +right. + +We start by looking for the string `|:` in all the source files. + + $ grep '|:' *.pas + prepmx.pas: else if bar='|:' then repcode:='Rl' + prepmx.pas: else if bar=':|:' then repcode:='Rlr' + +(BTW, although I continue using `grep`, I won't again insult your +intelligence by quoting the exact invocation.) + +On reading the source, we note that both references are inside +a procedure called `writeRepeat`. + + procedure writeRepeat(var bar: string); + var repcode: string; + begin if bar='' then exit; + repcode:=''; + if bar='||' then repcode:='Rd' + else if (bar='|]') then repcode:='RD' + else if bar='|:' then repcode:='Rl' + else if bar=':|:' then repcode:='Rlr' + else if bar=':|' then repcode:='Rr' + else if last_bar and (bar='|') then repcode:='Rb'; + if repcode<>'' then putLine(' '+repcode); + bar:=''; + end; + +This clearly writes to the PMX file the PMX code to which the M-Tx +bar symbol translates. It can't be the cause of the bug. + +Where is `writeRepeat` used? Another `grep` says: only in `prepmx.pas` +itself, four times. + +The first one is in the following context: + + barword: begin + if voice=nvoices then + if endOfBar(voice,bar_no) then repeat_sign := note + else writeRepeat(note); + if note<>barsym then note:=''; + no_chords:=false; + end; + +This code tests whether we are at the end of a bar; if so, the bar +word is remembered as `repeat_sign`, otherwise it is written +immediately. We are following a breadth-first strategy, so we don't +yet look at `endOfBar`, but continue with examining the references +to `writeRepeat`. + +The second reference in context: + + if bar_of_line>1 then putLine(comment+'Bar '+toString(bar_no)); + last_bar := (bar_of_line=nbars) and final_paragraph; + if last_bar and (repeat_sign='|') then repeat_sign:=''; + writeRepeat(repeat_sign); new_meter := ''; + +This occurs in a procedure called `processOneBar`. The first thing is +to write out the `repeat_sign` previously saved. It also does not +seem to be the cause of the bug. + +The third reference is inside a loop over all voices. If that is the +problem, we may have to dig very deeply, so we postpone looking at it. + +The last reference is inside the procedure `doMusic`. + + if startsWithBracedWord(P[1]) then lyricsParagraph else + begin musicParagraph; first_paragraph:=false; + writeRepeat(repeat_sign); + end + +That boolean `first_paragraph` sticks out like a sore thumb. The +program is doing something differently, depending on whether we are +doing the first paragraph or a later one! That cannot be unrelated +to the question of a pickup. + +Let's look for where `first_paragraph` is used. In `files.pas` there +is something that appears to be handling inline TeX, the others are +in `prepmx.pas`. It appears in this conditional: + + if first_paragraph then includeStartString; + +Let's find that procedure. It's in `analyze.pas`. The procedure itself +is clearly blameless, but also near the top of `analyze.pas` our eye +alights on `pickup:=0;`. The statement appears twice, the second time +probably needlessly, but that's beside the point. We now know there is +a variable named `pickup` and unless the author of the program is +deliberately misleading us, it must be relevant to the pickup. + +Further on in `analyze.pas`, we find: + + scanMusic(voice,l); + if multi_bar_rest and (nv>1) then error( + 'Multi-bar rest allows only one voice',print); + if not pmx_preamble_done then + if voice=top then pickup:=l + else if pickup<>l then + error3(voice,'The same pickup must appear in all voices'); + +I.e. the procedure `scanMusic` sets a value `l` that will be assigned +to `pickup`. We're getting warm! + +That procedure is in `mtx.pas`. It is a very long procedure, but the +argument `l` is now the parameter `left_over`, easy to search for. +The only place where it seems to be used after being initialized is +in the following compound statement: + + if (note=barsym) then + if meternum=0 then + error3(voice,'You may not use bar lines in barless music') + else if bar_length=0 then markBar(voice) + else if (numberOfBars(voice)=0) and (bar_length<bar) then + begin if has_next then + has_next:=false {Should check whether pickups are equal} + else if left_over>0 then error3(voice,'Bar is too short'); + left_over:=bar_length; bar_length := 0; + end; + +What is `barsym`? These are the places where the name appears. + + analyze.pas: is_labelled := (w[l]=colon) and (w[l-1]<>barsym); + globals.pas: barsym = '|'; + mtxline.pas: if chord>0 then if P[chord]=barsym then predelete(P[chord],1); + mtx.pas: if (note=barsym) then + prepmx.pas: if (w=barsym) or (w='') then no_chords:=true; + prepmx.pas: if note<>barsym then note:=''; + uptext.pas: if (w=barsym) or (w='') then no_uptext:=true; + +Our quest is over! This is the bug. The whole code starts with +`if (note=barsym) then`. The parentheses indicate that at some +previous stage of the code, the programmer thought that there may +have been extra clauses, such as testing for left repeat, but forgot +to put them in. We also note further evidence of not-quite-completed +code in the comment `{Should check whether pickups are equal}`. + +How will we fix this? Should we have `if isBarSym(note) then` and supply +a function `isBarSym`, or merely add a clause? It appears as if the +other cases do not require the same fixing, so the function will only be +called this once. Let's try: + + if note[1]=barsym then + +That will cover `|`, `|:` and `||` but not `:|`, which seems fair +enough. It will also cover illegal cases like `|-`, but let's hope +those are caught elsewhere. + +The change is enough to cure the reported bug, so we document it at the +top of `prepmx.pas` and in `Corrections`, changing the version number to +`0.60e`. + +### It was not a bug + +After carrying out the above exercise, I carefully reread the M-Tx +manual and found: + +> If your piece starts with a pickup, it is defined by a bar line at the +> end of “bar 0”, i.e. the incomplete bar containing the pickup. Even +> when there is a repeat sign after the pickup, so that you don’t +> actually see a bar line in the printed music, you still need a bar +> line before the repeat sign, otherwise M-Tx cannot know where the +> pickup stops. The bar line defining the pickup is compulsory in the +> first voice found, and optional but recommended in the others. + +Be warned, therefore, that M-Tx 0.60e is a dead end. The next version +of M-Tx will branch from 0.60d again. + +3. Adding a preamble command +---------------------------- + +In M-Tx 0.61, the `TeX` preamble command was added. Obviously we start +in `preamble.pas`. There are some pretty obvious lists contained in +`type` and `const` statements. + +The name lower-case name `tex` is inserted in the list of names +`command_type`, the upper case version `TEX` in the corresponding +position in `commands`, a default empty value in `cline` and an +extra `false` in `redefined`. This is enough to get the `TeX` command +recognized, to save the value given, and to record the fact that there +was a change. + +We want the TeX string to appear immediately after `readmod`. If you +examine a `.tex` file made by PMX from source coded by M-Tx, you will +see that `\mtxInterInstrument` is there. The only line containing that +word is in `preamble.pas`: + + if nspace[j]<>unspec then TeXtype2('\mtxInterInstrument{'+toString(i-1)+ + +I.e. it was inserted as a "Type 2 TeX string". The line in question is +inside the function `respace`, which we see is executed immediately +after the statement `pmx_preamble_done:=true;`. We need to squeeze +in between, adding a call + + insertTeX; + +At some respectable point before that, we define this procedure. + + procedure insertTeX; + begin + if redefined[tex] then TeXtype2(cline[tex]); + end; + +Test it; it works. However, if we issue more than one `TeX` command, +only the last one takes effect, whereas the user will want all. +Looking for assignments into `cline`, we find in procedure `doCommand` +the statement: + + cline[last_command]:=line; + +The entire loop containing that statement needs a bit of reorganization, +since we must not only allow for appending new text but also bypass the +test for redefinition warnings. First we supply a function + + function mustAppend(command: command_type): boolean; + begin mustAppend := command=tex end; + +which allows for possible future preamble commands that also append +rather than redefine. The new code of the loop starting with + + if mustAppend(last_command) and redefined[last_command] then + +is straightforward, almost. Do we put in `LineEnding` when we append? +If we don't, we may run into problems with `PMXlinelength` which is +only 128. If we do, `TeXtype2` needs to be made a little smarter, +i.e. able to re-split the lines. Actually, in that case an explicit +`#10` is better, since on some systems `LineEnding` has two characters. + +`TeXtype2` is in `files.pas`. There is a line + + else if first_paragraph then putLine('\'+s+'\') + +that we replace by a call to a routine `putTeXlines` which does +the necessary. + + diff --git a/Build/source/utils/m-tx/mtx-src/Makefile.am b/Build/source/utils/m-tx/mtx-src/Makefile.am index 02d74dd4527..9c7f033a1e9 100644 --- a/Build/source/utils/m-tx/mtx-src/Makefile.am +++ b/Build/source/utils/m-tx/mtx-src/Makefile.am @@ -72,7 +72,9 @@ TESTS = mtx.test EXTRA_DIST += $(TESTS) ## mtx.test -EXTRA_DIST += tests/mozart.mtx tests/mozart.pmx Makefile.orig Bugs Corrections ChangeLog.C +EXTRA_DIST += tests/mozart.mtx tests/mozart.pmx + +EXTRA_DIST += Makefile.orig Bugs Corrections MAINTENANCE Makefile.p2c EXTRA_DIST += configure.ac Makefile.am DISTCLEANFILES = mozart* diff --git a/Build/source/utils/m-tx/mtx-src/Makefile.orig b/Build/source/utils/m-tx/mtx-src/Makefile.orig index d3d96e4877b..14118ffe3db 100644 --- a/Build/source/utils/m-tx/mtx-src/Makefile.orig +++ b/Build/source/utils/m-tx/mtx-src/Makefile.orig @@ -1,37 +1,18 @@ pasfiles = globals.pas mtx.pas preamble.pas lyrics.pas analyze.pas mtxline.pas\ status.pas uptext.pas prepmx.pas files.pas notes.pas multfile.pas \ strings.pas utility.pas control.pas -sfiles = mtx.tex mtxdoc.tex mtxdoc.pdf Makefile Corrections Bugs MAINTENANCE - -cfiles = globals.c mtx.c preamble.c lyrics.c analyze.c mtxline.c\ - status.c uptext.c prepmx.c files.c notes.c multfile.c utility.c control.c -native = cfuncs.c cfuncs.h -hfiles = globals.h mtx.h preamble.h lyrics.h analyze.h mtxline.h \ - status.h uptext.h files.h notes.h multfile.h utility.h control.h -ofiles = globals.o mtx.o preamble.o lyrics.o analyze.o mtxline.o \ - status.o uptext.o cfuncs.o files.o notes.o prepmx.o multfile.o utility.o \ - control.o - +sfiles = mtx.tex mtxdoc.pdf Makefile Corrections Bugs MAINTENANCE SYSTEM=LINUX prepmx: $(pasfiles) fpc -g -B -vn -So prepmx -T$(SYSTEM) -prepmxc: $(cfiles) $(ofiles) - gcc $(ofiles) -o prepmx - -multfile.c: multfile.pas - p2c -a -LTurbo multfile.pas -o temp.c - sed -e "s/Malloc/malloc/" < temp.c > multfile.c - rm temp.c - - -%.c: %.pas - p2c -a -LTurbo $*.pas - +README.md: README.txt + pandoc -s -t markdown_githum README.txt -commit: $(pasfiles) $(sfiles) +commit: $(pasfiles) $(sfiles) README.txt README.md + make -C doc commit git add $(pasfiles) $(sfiles) echo Now type: git commit -m \"DESCRIPTION OF_CHANGES\" @@ -39,7 +20,7 @@ clean: - rm *.o *~ *~ core *.pmx *.pml *.log *.dvi bare: clean - - rm prepmx *.ppu + - rm prepmx *.ppu Pzip: zip -ju mtxP`./version` version $(pasfiles) $(sfiles) README.* diff --git a/Build/source/utils/m-tx/mtx-src/Makefile.p2c b/Build/source/utils/m-tx/mtx-src/Makefile.p2c new file mode 100644 index 00000000000..ba75e632b00 --- /dev/null +++ b/Build/source/utils/m-tx/mtx-src/Makefile.p2c @@ -0,0 +1,12 @@ +all: globals.c mtx.c preamble.c lyrics.c analyze.c mtxline.c\ + status.c uptext.c prepmx.c files.c notes.c multfile.c utility.c control.c + +multfile.c: multfile.pas + p2c -a -LTurbo multfile.pas -o temp.c + sed -e "s/Malloc/malloc/" < temp.c > multfile.c + rm temp.c + +%.c: %.pas + p2c -a -LTurbo $*.pas + cp $*.c $*.c.orig + diff --git a/Build/source/utils/m-tx/mtx-src/NEWS b/Build/source/utils/m-tx/mtx-src/NEWS index 351792d7e10..de5c759a9ad 100644 --- a/Build/source/utils/m-tx/mtx-src/NEWS +++ b/Build/source/utils/m-tx/mtx-src/NEWS @@ -1,15 +1,240 @@ -Lyrics lines when not from same paragraph don't join neatly. -Problem has been discussed on mailing list and Rainer gave -a solution. +Corrections and enhancements to M-Tx starting from 0.53 +======================================================= + +Newest items at top. You might also want to look at file `MAINTENANCE`. -Rest in dot and comma shortcuts gives error at PMX stage. +Version 0.62a +------------- +1. Fonts bigtype and BIgtype, needed because PMX header font sizes +were made smaller in July 2015, added to \mtxPalatino. Also, for +completeness, \mtxbigsf and \mtxBIGsf. This version tagged on GitHub +as 0.62. -M-Tx 0.60d is a test version of M-Tx 0.60. Please try it out and report any -error observations to Christian Mondrup, reccmo@daimi.au.dk and -Dirk Laurie, dpl@sun.ac.za +Version 0.62 +------------ + +1. `\mtxlatex` command no longer needed. +2. Various subtleties in the code have been commented. + +Version 0.61a +------------- + +1. Special code for multi-bar rests removed, taking advantage of +upstream improvements. +2. MusiXTeX 1.21 and PMX 2.71 required in `mtx.tex`. +3. When the last line of a file does not have an end-of-line, +its line number in comments and error messages was 0. Corrected now. +(This bug was almost 11 years old.) + +Version 0.61 +------------ + +Mainly aids to the programmer. + +1. `TeX` preamble command for Type 2 TeX strings. +2. Assertions: Range, Bars. +3. User's Manual thoroughly revised. +4. Misnamed procedure `tex3` is now `TeXtype2`. +5. Page and font macros are included in `mtx.tex`. +6. The part of this file above the horizontal line is in Markdown. + + +---------------------------------------------------------------------- + +Version 0.60f + notes.pas: {$V-} inserted since otherwise Pascal 2.6.2 regards it as an + error to pass a var argument of type `string[16]` to a procedure that + expects type `string`. + lyrics.pas: tests for empty lyrics paragraph + +Version 0.60e (RETRACTED) + Any bar word starting with `|` terminates a pickup, not only `|`. + Actually the manual was clear on this point, so the current version + has reverted to 0.60d. + +Version 0.60d + Replaced space character tie label by no label, + status.pas: procedure labelSlur, call procedure insertchar only for slurs. + +Version 0.60c + Added facility for prefixing music words with '_' for handling in PMX. + Prefix is stripped in output file. + mtxline.pas: type music_word, const bind_left, array name, + procedure GetNextMusWord. + +Version 0.60b + Fixed bug in doPMXpreamble causing errors with printed meters. + +Version 0.60a + Fix for music size 13 in preamble.pas. + Convert M-Tx denominators '1', '16', '32' and '64' + to PMX meter denominator syntax '0', '1', '3' and '6'. + {} ties don't get PMX label T attached in order to support MIDI ties. + +Planned for the near future + Accepts detached shortcut. + +Version 0.55h (not released) + Traces pitch including z-words; warns if unreal. Disable checkPitch + to bypass this. + +Version 0.55g (not released) + Corrects another bug in notes.pas, introduced at 0.55d. + Features: countMacro, expandMacro. + +Version 0.55f (not released) + Corrects bugs, mainly in notes.pas, introduced at 0.55d. + Help via command line. + +Version 0.55e (not released) + Chord ties. E.g. C: {ce cf ties the c. No close-tie symbol. + +Version 0.55d (not released) + Mainly code cleanup. Should be transparent to most users. + +Version 0.55c + Corrects continuation slur bug. + +Version 0.55b + Bug correction, but including a substantial rewrite of the lyrics melisma handling. + +Version 0.55 + Basically the same as 0.54k. + +Version 0.54k (not released) + DPL: Slurs are no longer translated to s and t, but to ( and {. This requires + PMX 2.502. Labels are inserted into slurs. + +Version 0.54j (not released) + DPL: "Enable" and "Disable" directives for more flexible handling of optional + features. No further development of "Options:" will be made. + +Version 0.54h (not released) + Certain parts of the unwieldy "globals" unit moved to a new "utility" unit. + Affects programming, not functionality. + +Version 0.54g (released only to beta testers) + DPL: Corrected bug in multfile.pas (end-of-input not properly recognized). + +Version 0.54f (released only to beta testers) + DPL: Cleaning up of files.pas to take full advantage of the new + multifile.pas unit. Corrected some obscure bugs. + +Version 0.54e (not released) + +2004-03-07 + DPL: Added the "Include: filename" directive. This may appear anywhere, + and diverts the input stream to the new filename. This may in turn + include other files, etc. A file may be included more than once, but + do not try recursive includes! When the end of an included file is + reached, the stream reverts to the previous file. End-of-file is + treated seamlessly and does not act as a paragraph separator. + +Version 0.54d (not released) + +2004-02-15 + DPL: {...} gives st slurs, }{ works, -t option to retain old behaviour, + some cleaning up of unused pieces of code. + Affects files.pas, globals.pas, mtxline.pas, preamble.pas, prepmx.pas, + status.pas + +Version 0.54c + +2003-08-14 + Hiroaki Morimoto: + mtx.pas: allow PMX style absolute octave assignment + +Version 0.54b + +2003-08-05 + Christian Mondrup: + mtx.tex: changed \def\mtxLyrlink{\lowlyrlink} to \def\mtxLowLyrlink{\lowlyrlink} + +2003-06-03 + Christian Mondrup: + Correct bug in procedure respace: test on 'nspace[ninstr]' rather than on + nspace[nstaves] in concluding if statement. + +Version 0.54a + +2002-01-29 + Recognizes PMX words D s t as binding to the left. + Uptext also on multi-bar rests. + +Version 0.53j + +2001-12-06 + mtx.tex tuning improvements only + +Version 0.53i + +2001-11-27 + Correct bug in verse numbers when bar starts with rests + (reported by Christian Mondrup) + +Version 0.53h + +2001-11-20 + Correct bug in decrescendo (reported by Christian Mondrup) + -- involves mtx.tex and uptext.* + 100 lines per paragraph + +Version 0.53g + +2001-10-30 + Restore midi accidental capability (lost by mistake from 0.53c to + 0.53f) + +Version 0.53f + +2001-08-29 + xtuplet may start with rest + +Version 0.53e + +2001-06-22 + Recognizes 'D' in xtuplet notes. + +Version 0.53d + +2001-06-21 + Always uses full instrument/stave format, even if there is just + one stave per instrument. + +Version 0.53c + +2001-06-18 + Improved handling of Composer, Poet and Title lines. + procedure selectVoices added (maybe one day we'll support + movement changes) + Braces around \mtxFlat and \mtxSharp + Does not translate '_' in lyrics if + (1) at end of word + (2) followed by another '_' + (3) followed by a digit + +Version 0.53b + +2001-06-02 + Improvements to mtx.tex, including nicer sharps and flats in uptext + +Version 0.53a + +2001-05-29 + Looks for 'i' anywhere in note (except in shortcut and xtuplet parts) + and moves it to follow accidental. + +2001-05-28 + From Christian Mondrup + preamble.pas: added trailing backslash to \mtxTenorClef + mtx.tex: changed \mtxmtxNormalSize to \mtxNormalSize + +Changes since 0.52b, undated. + Uses mtx.tex file + More than one # or % per word treated correctly in uptext + Better way of handling line numbers in lyrics + +For earlier history, see comments in prepmx.pas of 0.52b. -Changes: -======== -- Fixed a bug with non-labeled ties diff --git a/Build/source/utils/m-tx/mtx-src/README b/Build/source/utils/m-tx/mtx-src/README index f57555c8a27..47e67d8bfc8 100644 --- a/Build/source/utils/m-tx/mtx-src/README +++ b/Build/source/utils/m-tx/mtx-src/README @@ -1,35 +1,67 @@ M-Tx Preprocessor Source Code ============================= -This is a development version of `prepmx`, the M-Tx Preprocessor. It contains the file `mtx.tex` and all the sources for generating the binary executable file (`prepmx`, `prepmx.exe`, etc., depending on your operating system). There is no documentation and there are no examples. These are included with the stable release available in the TeXLive and MikTeX distributions of TeX. (If you have not installed one of those, you will be unable to do any useful work with `prepmx`.) - -You probably got it from <https://github.com/dlaurie/M-Tx>. If not, you should; that may well contain newer code by now. - -The development version is provided for people who need more recent features than the most recent stable release has, in the hope that they will be willing to report bugs and maybe even suggest how those can be fixed. Send e-mail to the Werner Icking Music Archive mailing list <tex-music@tug.org> or directly to Dirk Laurie <dirk.laurie@gmail.com>. - -You need the Free Pascal compiler. Any version from 1.0.10 onwards should work; 2.4.4 certainly did on 2014-02-01 and 2.6.2 on 2015-04-24. You may get away with other Pascal compilers, including Borland Pascal 7.0 and the Pascal-to-C translator `p2c`, but no effort has been made to retain compliance. Older versions of this README included details, all probably obsolete by now. - -"GNU System" means any system on which standard GNU utilities such as "bash" and "make" is available. Typical GNU systems are - -- Linux -- Windows with the Cygwin package installed - -You do not need a GNU system to use M-Tx, but it is easier to make the executable on a GNU system. - +This repository contains the development code of `prepmx`, the M-Tx +Preprocessor. Points in the development thought to be stable enough +to be called "releases" have been tagged. Distributors that include +M-Tx in the TeXLive and MikTeX distributions of TeX are asked not +to package any other states of the repository. + +It contains the file `mtx.tex` and all the sources for generating the +binary executable file (`prepmx`, `prepmx.exe`, etc., depending on your +operating system). + +The development files for the documentation and examples are in the `doc` +subdirectory. + +You probably got it from <https://github.com/dlaurie/M-Tx>. If not, +you probably should; that may well contain newer code by now. + +The development version is provided for people who need more recent features +than the most recent stable release has, in the hope that they will be +willing to report bugs and maybe even suggest how those can be fixed. +Use the GitHub `Issue` mechanism and for good measure also send e-mail +to the Werner Icking Music Archive mailing list <tex-music@tug.org> +and directly to Dirk Laurie <dirk.laurie@gmail.com>. + +You need the Free Pascal compiler. Any version from 1.0.10 onwards +should work; 2.4.4 certainly did on 2014-02-01 and 2.6.2 on 2015-04-24. +You may get away with other Pascal compilers, including Borland Pascal 7.0 +and the Pascal-to-C translator `p2c`, but no effort has been made to retain +compliance. Older versions of this README included details, all probably +obsolete by now. + +"GNU System" means any system on which standard GNU utilities such as "bash" +and "make" is available. Typical GNU systems are + +- Linux +- Windows with the Cygwin package installed + +You do not need a GNU system to use M-Tx, but it is easier to make the +executable on a GNU system. + If your system has GNU Make, simply type make -Otherwise, find the line in the Makefile starting with `fpc` and type that into your terminal. +Otherwise, find the line in the Makefile starting with `fpc` and type +that into your terminal. For experts only ---------------- -You can modify the source code as you wish -- this is open source software and the license is MIT. If you wish to redistribute your modified version, please augment the name so that there is no risk of confusion: e.g. if you are Johannes Brahms and you have made changes to mtxC054f.zip, call it mtxC054f-brahms.zip. +You can modify the source code as you wish -- this is open source software +and the license is MIT. If you wish to redistribute your modified version, +please augment the name so that there is no risk of confusion: e.g. if you +are Johannes Brahms and you have made changes to mtxC054f.zip, call it +mtxC054f-brahms.zip. -Even better, send me an e-mail with your changes so that I can insert them into the current development version. +Even better, use the GitHub "Pull Request" mechanism or send me an e-mail +with your changes so that I can insert them into the current development +version. Or fork the repository. -The Makefile can make various other things. I don't want to document those, since then I would be constrained to maintain them. Use at your peril. - +The Makefile can make various other things. I don't want to document +those, since then I would be constrained to maintain them. Use at your +peril. diff --git a/Build/source/utils/m-tx/mtx-src/files.c b/Build/source/utils/m-tx/mtx-src/files.c index 972d34ac573..bd080211a97 100644 --- a/Build/source/utils/m-tx/mtx-src/files.c +++ b/Build/source/utils/m-tx/mtx-src/files.c @@ -2,9 +2,9 @@ /* From input file "files.pas" */ - #include "p2c.h" + #define FILES_G #include "files.h" @@ -289,9 +289,9 @@ void OpenFiles(void) pushFile(infilename); strcpy(outfile_NAME, outfilename); if (outfile != NULL) - outfile = freopen(outfile_NAME, "wb", outfile); + outfile = freopen(outfile_NAME, "w", outfile); else - outfile = fopen(outfile_NAME, "wb"); + outfile = fopen(outfile_NAME, "w"); _SETIO(outfile != NULL, FileNotFound); strcpy(stylefile_NAME, stylefilename); if (stylefile != NULL) diff --git a/Build/source/utils/m-tx/mtx-src/globals.c b/Build/source/utils/m-tx/mtx-src/globals.c index 1e5a27d93c6..82709dc4651 100644 --- a/Build/source/utils/m-tx/mtx-src/globals.c +++ b/Build/source/utils/m-tx/mtx-src/globals.c @@ -2,9 +2,9 @@ /* From input file "globals.pas" */ - #include "p2c.h" + #define GLOBALS_G #include "globals.h" diff --git a/Build/source/utils/m-tx/mtx-src/lyrics.c b/Build/source/utils/m-tx/mtx-src/lyrics.c index 4c56ea18a3d..634afc061ba 100644 --- a/Build/source/utils/m-tx/mtx-src/lyrics.c +++ b/Build/source/utils/m-tx/mtx-src/lyrics.c @@ -2,9 +2,9 @@ /* From input file "lyrics.pas" */ - #include "p2c.h" + #define LYRICS_G #include "lyrics.h" diff --git a/Build/source/utils/m-tx/mtx-src/mtx.c b/Build/source/utils/m-tx/mtx-src/mtx.c index 12d9c089e5d..fbdf8b8d87b 100644 --- a/Build/source/utils/m-tx/mtx-src/mtx.c +++ b/Build/source/utils/m-tx/mtx-src/mtx.c @@ -2,9 +2,9 @@ /* From input file "mtx.pas" */ - #include "p2c.h" + #define MTX_G #include "mtx.h" diff --git a/Build/source/utils/m-tx/mtx-src/mtxline.c b/Build/source/utils/m-tx/mtx-src/mtxline.c index b08eef73777..26c05b0247e 100644 --- a/Build/source/utils/m-tx/mtx-src/mtxline.c +++ b/Build/source/utils/m-tx/mtx-src/mtxline.c @@ -4,6 +4,7 @@ #include "p2c.h" + #define MTXLINE_G #include "mtxline.h" diff --git a/Build/source/utils/m-tx/mtx-src/multfile.c b/Build/source/utils/m-tx/mtx-src/multfile.c index c61eea649ac..31b9c204f8a 100644 --- a/Build/source/utils/m-tx/mtx-src/multfile.c +++ b/Build/source/utils/m-tx/mtx-src/multfile.c @@ -2,9 +2,9 @@ /* From input file "multfile.pas" */ - #include "p2c.h" + #define MULTFILE_G #include "multfile.h" @@ -22,6 +22,7 @@ typedef struct filenode { Static filenode *current = NULL; +Static short last_valid_line_no = 0; Static boolean inputerror = false; Static short reportitem = reportnewfile + reportoldfile + reporterror + reportrecursive; @@ -140,8 +141,10 @@ Char *readLine(Char *Result) *TEMP = 0; strcpy(Result, s); inputerror = (P_ioresult != 0); - if (!inputerror) + if (!inputerror) { current->lineno++; + last_valid_line_no = current->lineno; + } if (inputerror && (reportitem & reporterror) > 0) printf("==!! Could not read from file %s\n", currentFilename(STR2)); return Result; @@ -208,10 +211,7 @@ boolean eofAll(void) short currentLineNo(void) { - if (current == NULL) - return 0; - else - return (current->lineno); + return last_valid_line_no; } diff --git a/Build/source/utils/m-tx/mtx-src/multfile.h b/Build/source/utils/m-tx/mtx-src/multfile.h index aaa094cdae7..01c8a06e0b7 100644 --- a/Build/source/utils/m-tx/mtx-src/multfile.h +++ b/Build/source/utils/m-tx/mtx-src/multfile.h @@ -8,7 +8,7 @@ #else # define vextern extern #endif -/* DPL 2004-03-06 +/* DPL 2004-03-06, 2015-01-16 (* Support for including files into an input stream. (* Intended for an application that does not require Pascal formatting, (* but reads complete lines one at a time. diff --git a/Build/source/utils/m-tx/mtx-src/multfile.pas b/Build/source/utils/m-tx/mtx-src/multfile.pas index 6c272992a3f..fb89cca89e0 100644 --- a/Build/source/utils/m-tx/mtx-src/multfile.pas +++ b/Build/source/utils/m-tx/mtx-src/multfile.pas @@ -1,4 +1,4 @@ -unit multfile; (* DPL 2004-03-06 +unit multfile; (* DPL 2004-03-06, 2015-01-16 (* Support for including files into an input stream. (* Intended for an application that does not require Pascal formatting, (* but reads complete lines one at a time. @@ -80,6 +80,7 @@ implementation end; const current: pfilenode = NIL; + last_valid_line_no: integer = 0; inputerror: boolean = false; reportitem: integer = reportnewfile + reportoldfile + reporterror + reportrecursive; @@ -144,7 +145,10 @@ implementation readln(current^.actualfile,s); readLine:=s; {$I+} inputerror := ioresult<>0; - if not inputerror then inc(current^.lineno); + if not inputerror then + begin inc(current^.lineno); + last_valid_line_no := current^.lineno + end; if inputerror and ((reportitem and reporterror)>0) then writeln ('==!! Could not read from file ',currentFilename); end; @@ -182,8 +186,7 @@ implementation end; function currentLineNo: integer; - begin if current = NIL then currentLineNo := 0 - else currentLineNo := current^.lineno; + begin currentLineNo := last_valid_line_no end; function currentFilename: string; diff --git a/Build/source/utils/m-tx/mtx-src/notes.c b/Build/source/utils/m-tx/mtx-src/notes.c index 88d85791bdb..3d4c445ba13 100644 --- a/Build/source/utils/m-tx/mtx-src/notes.c +++ b/Build/source/utils/m-tx/mtx-src/notes.c @@ -2,9 +2,9 @@ /* From input file "notes.pas" */ - #include "p2c.h" + #define NOTES_G #include "notes.h" diff --git a/Build/source/utils/m-tx/mtx-src/preamble.c b/Build/source/utils/m-tx/mtx-src/preamble.c index 15b84b4ee02..4ec599ee39b 100644 --- a/Build/source/utils/m-tx/mtx-src/preamble.c +++ b/Build/source/utils/m-tx/mtx-src/preamble.c @@ -4,6 +4,7 @@ #include "p2c.h" + #define PREAMBLE_G #include "preamble.h" diff --git a/Build/source/utils/m-tx/mtx-src/prepmx.c b/Build/source/utils/m-tx/mtx-src/prepmx.c index 715d4c1ca37..6f5bf37bf69 100644 --- a/Build/source/utils/m-tx/mtx-src/prepmx.c +++ b/Build/source/utils/m-tx/mtx-src/prepmx.c @@ -2,9 +2,9 @@ /* From input file "prepmx.pas" */ - #include "p2c.h" + #ifndef CONTROL_H #include "control.h" #endif @@ -66,18 +66,12 @@ /** M-Tx preprocessor to PMX Dirk Laurie */ -#define version "0.61" -#define version_date "<16 December 2015>" +#define version "0.62" +#define version_date "<08 February 2016>" /** See file "Corrections" for updates later than those listed below */ -/** Changes since 0.52b - Uses mtx.tex file - More than one # or % per word treated correctly in uptext - Better way of handling line numbers in lyrics -*/ - /** To do next: Take notice of recent improvements in musixtex, pmx and musixlyr {* Current bugs: @@ -98,9 +92,9 @@ Static boolean last_bar; -Static Char multibar[256]; Static Char repeat_sign[256]; -Static short bar_of_line, bars_of_rest, rest_spacing; +/*, bars_of_rest*/ +Static short bar_of_line; /* --------------- Bars and rests --------------- */ @@ -138,10 +132,6 @@ Static void supplyRests(voice_index voice) Char STR2[4]; Char STR3[256]; - if (multi_bar_rest) { - put(multibar, putspace); - return; - } if (bar_of_line == 1 && pedanticWarnings()) { printf("Bar %d Voice %d", bar_no, voice); warning(" Filling missing voice with rests", !print); @@ -153,60 +143,6 @@ Static void supplyRests(voice_index voice) } -Static void countBars(Char *note_) -{ - Char note[256]; - short k, adjust; - short sign = 1; - - strcpy(note, note_); - predelete(note, 2); - k = pos1('+', note); - if (k == 0) { - k = pos1('-', note); - if (k > 0) - sign = -1; - } - if (k > 0) { - note[k-1] = '/'; - getTwoNums(note, &bars_of_rest, &adjust); - } else { - getNum(note, &bars_of_rest); - adjust = 0; - } - rest_spacing = adjust * sign + 14; -} - - -/* FIXME This procedure had a serious bug. It now has a smaller bug. - Basically there should be a test on whether a break between staves - is a break between instruments, in which case the procedure is (now) - right; or a break between staves of the same instrument, in which - case a '|' instead of a '&' should be output (as it was). If the Space - feature is not used, the bug does not show up. */ -Static void putMBRest(void) -{ - stave_index i, FORLIM; - Char STR1[256]; - Char STR2[256], STR3[256]; - - put("\\\\\\def\\atnextbar{\\znotes", nospace); - FORLIM = nstaves; - for (i = 1; i <= FORLIM; i++) { - sprintf(STR3, "\\mbrest{%s}{%s}0", - toString(STR1, bars_of_rest), toString(STR2, rest_spacing)); - put(STR3, nospace); - if (i < nstaves) - put("&", nospace); - else - putLine("\\en}\\"); - } - sprintf(STR3, "\\\\\\advance\\barno%s\\", toString(STR1, bars_of_rest - 1)); - putLine(STR3); - bar_no += bars_of_rest - 1; -} - - /* Local variables for processLine: */ struct LOC_processLine { voice_index voice; @@ -483,8 +419,6 @@ Static void processLine(voice_index voice_, short bar_no) case rword: if (multi_bar_rest) { - countBars(V.note); - strcpy(V.note, multibar); if (uptextOnRests()) addUptext(V.voice, &V.no_uptext, V.pretex); } else { @@ -579,7 +513,6 @@ Local void putPMXlines(struct LOC_musicParagraph *LINK) Local void processOneBar(struct LOC_musicParagraph *LINK) { paragraph_index0 m, cm; - short n1, n2; voice_index voice, cvoice; boolean ignore_voice; boolean wrote_repeat = false; @@ -606,12 +539,6 @@ Local void processOneBar(struct LOC_musicParagraph *LINK) meterChange(LINK->new_meter, nleft, 64, true); if (*LINK->new_meter != '\0') putLine(LINK->new_meter); - if (multi_bar_rest) { - n1 = meternum * 64; - n2 = meterdenom; - cancel(&n1, &n2, 1); - rests(multibar, n1, n2, blind); - } for (voice = nvoices; voice >= 1; voice--) { ignore_voice = !selected[voice-1]; cvoice = companion(voice); @@ -638,8 +565,6 @@ Local void processOneBar(struct LOC_musicParagraph *LINK) } } } - if (multi_bar_rest) - putMBRest(); bar_no++; pickup = 0; putLine(""); @@ -652,6 +577,22 @@ Local void putMeter(Char *new_meter_word, struct LOC_musicParagraph *LINK) strcpy(old_meter_word, new_meter_word); } +Local void processMBR(struct LOC_musicParagraph *LINK) +{ + short bars_of_rest; + Char mbr[256]; + Char STR1[256]; + Char STR3[256]; + + strcpy(mbr, P[0]); + predelete(mbr, 2); + getNum(mbr, &bars_of_rest); + bar_no += bars_of_rest; + sprintf(STR3, "rm%s /", toString(STR1, bars_of_rest)); + putLine(STR3); + putLine(""); +} + Static void musicParagraph(void) { @@ -721,10 +662,12 @@ Static void musicParagraph(void) if (nleft > 0) nbars++; if (nbars == 0 && multi_bar_rest) - nbars = 1; - FORLIM1 = nbars; - for (bar_of_line = 1; bar_of_line <= FORLIM1; bar_of_line++) - processOneBar(&V); + processMBR(&V); + else { + FORLIM1 = nbars; + for (bar_of_line = 1; bar_of_line <= FORLIM1; bar_of_line++) + processOneBar(&V); + } restoreDurations(); } diff --git a/Build/source/utils/m-tx/mtx-src/prepmx.pas b/Build/source/utils/m-tx/mtx-src/prepmx.pas index 08661beba6b..139d4e1911d 100644 --- a/Build/source/utils/m-tx/mtx-src/prepmx.pas +++ b/Build/source/utils/m-tx/mtx-src/prepmx.pas @@ -5,18 +5,12 @@ uses control, strings, globals, preamble, lyrics, mtx, analyze, { CMO: addition/change by Christian Mondrup } {* M-Tx preprocessor to PMX Dirk Laurie } -const version = '0.61'; - version_date = '<11 December 2015>'; +const version = '0.62'; + version_date = '<08 February 2016>'; {* See file "Corrections" for updates later than those listed below } -{* Changes since 0.52b - Uses mtx.tex file - More than one # or % per word treated correctly in uptext - Better way of handling line numbers in lyrics -} - {* To do next: Take notice of recent improvements in musixtex, pmx and musixlyr {* Current bugs: @@ -35,9 +29,8 @@ const version = '0.61'; var last_bar: boolean; - multibar: string; repeat_sign: string; - bar_of_line, bars_of_rest, rest_spacing: integer; + bar_of_line{, bars_of_rest}: integer; { --------------- Bars and rests --------------- } @@ -57,8 +50,6 @@ procedure writeRepeat(var bar: string); procedure supplyRests(voice: voice_index); begin - if multi_bar_rest then - begin put(multibar,putspace); exit; end; if (bar_of_line=1) and pedanticWarnings then begin write('Bar ', bar_no, ' Voice ', voice); warning(' Filling missing voice with rests',not print); @@ -68,36 +59,6 @@ begin put(pause+' ',putspace); end; -procedure countBars(note: string); - var k, adjust, sign: integer; -begin predelete(note,2); k:=pos1('+',note); sign:=1; - if k=0 then - begin k:=pos1('-',note); if k>0 then sign:=-1; end; - if k>0 then - begin note[k]:='/'; getTwoNums(note,bars_of_rest,adjust); end - else begin getNum(note,bars_of_rest); adjust:=0; end; - rest_spacing := 14 + adjust*sign; -end; - -(* FIXME This procedure had a serious bug. It now has a smaller bug. - Basically there should be a test on whether a break between staves - is a break between instruments, in which case the procedure is (now) - right; or a break between staves of the same instrument, in which - case a '|' instead of a '&' should be output (as it was). If the Space - feature is not used, the bug does not show up. *) -procedure putMBRest; - var i: stave_index; -begin - put('\\\def\atnextbar{\znotes',nospace); - for i:=1 to nstaves do - begin put('\mbrest{'+toString(bars_of_rest)+'}{'+toString(rest_spacing) - +'}0',nospace); - if i<nstaves then put('&',nospace) else putLine('\en}\'); - end; - putline('\\\advance\barno'+toString(bars_of_rest-1)+'\'); - inc(bar_no,bars_of_rest-1); -end; - { ---------------------------------------------------------------- } procedure processLine(voice: voice_index; bar_no: integer); @@ -227,9 +188,8 @@ begin repeat note:=getMusicWord(voice); if note='' then exit; { if debugMode then writeln(voice,' ',note); } case thisNote(voice) of - rword: begin if multi_bar_rest then - begin countBars(note); note:=multibar; - if uptextOnRests then + rword: begin if multi_bar_rest then + begin if uptextOnRests then addUptext(voice, no_uptext, pretex); end else begin @@ -287,7 +247,6 @@ procedure musicParagraph; procedure processOneBar; var m, cm: paragraph_index0; - n1, n2: integer; voice, cvoice: voice_index; ignore_voice, wrote_repeat, alone: boolean; begin @@ -302,10 +261,7 @@ procedure musicParagraph; if last_bar and (new_meter='') and (nleft>pickup) and (meternum>0) then new_meter := meterChange(nleft,64,true); if new_meter<>'' then putLine(new_meter); - wrote_repeat := false; if multi_bar_rest then - begin n1:=64*meternum; n2:=meterdenom; cancel(n1,n2,1); - multibar:=rests(n1,n2,blind); - end; + wrote_repeat := false; for voice:=nvoices downto 1 do begin ignore_voice:=not selected[voice]; cvoice:=companion(voice); m:=musicLineNo(voice); cm:=musicLineNo(cvoice); @@ -322,7 +278,6 @@ procedure musicParagraph; else putLine(' //'); end; end; - if multi_bar_rest then putMBRest; inc(bar_no); pickup:=0; putLine(''); end; @@ -331,6 +286,16 @@ procedure musicParagraph; old_meter_word := new_meter_word; end; + procedure processMBR; + var bars_of_rest: integer; + mbr: string; + begin + mbr := P[1]; + predelete(mbr,2); getNum(mbr,bars_of_rest); + bar_no := bar_no + bars_of_rest; + putLine('rm' + toString(bars_of_rest) + ' /'); putLine('') + end; + begin paragraphSetup(nvoice); if nvoice=0 then begin nonMusic; exit end @@ -363,8 +328,9 @@ begin if must_respace then respace; if (meternum=0) then putMeter(meterChange(beatsPerLine,meterdenom,true)); if nleft > 0 then inc(nbars); - if (nbars=0) and multi_bar_rest then nbars:=1; - for bar_of_line:=1 to nbars do + if (nbars=0) and multi_bar_rest then + processMBR + else for bar_of_line:=1 to nbars do processOneBar; restoreDurations; end; diff --git a/Build/source/utils/m-tx/mtx-src/status.c b/Build/source/utils/m-tx/mtx-src/status.c index 08845f156e3..da0ce7bd2a6 100644 --- a/Build/source/utils/m-tx/mtx-src/status.c +++ b/Build/source/utils/m-tx/mtx-src/status.c @@ -2,9 +2,9 @@ /* From input file "status.pas" */ - #include "p2c.h" + #define STATUS_G #include "status.h" diff --git a/Build/source/utils/m-tx/mtx-src/strings.h b/Build/source/utils/m-tx/mtx-src/strings.h index 3b8e7f4a539..0a0530062d8 100644 --- a/Build/source/utils/m-tx/mtx-src/strings.h +++ b/Build/source/utils/m-tx/mtx-src/strings.h @@ -12,20 +12,20 @@ /* These should be recoded in C instead of using the p2c code. */ -extern void scan1(Char *s, short p, short *n); +extern Void scan1 PP((Char *s, int p, short *n)); /* Read an integer at position p of s */ -extern boolean startsWith(Char *s1, Char *s2); -extern short pos1(Char c, Char *s); -extern short posNot(Char c, Char *s); -extern void insertChar(Char c, Char *s, short p); -extern Char *substr_(Char *Result, Char *s, short start, short count); -extern void getNum(Char *line, short *k); -extern void getTwoNums(Char *line, short *k1, short *k2); -extern void toUpper(Char *s); -extern void delete1(Char *s, short p); -extern void predelete(Char *s, short l); -extern void shorten(Char *s, short new_length); -extern short nextWordBound(Char *s, Char trigger, short p); +extern boolean startsWith PP((Char *s1, Char *s2)); +extern short pos1 PP((int c, Char *s)); +extern short posNot PP((int c, Char *s)); +extern Void insertChar PP((int c, Char *s, int p)); +extern Char *substr_ PP((Char *Result, Char *s, int start, int count)); +extern Void getNum PP((Char *line, short *k)); +extern Void getTwoNums PP((Char *line, short *k1, short *k2)); +extern Void toUpper PP((Char *s)); +extern Void delete1 PP((Char *s, int p)); +extern Void predelete PP((Char *s, int l)); +extern Void shorten PP((Char *s, int new_length)); +extern short nextWordBound PP((Char *s, int trigger, int p)); /* find end of first word starting with trigger after s[p] */ diff --git a/Build/source/utils/m-tx/mtx-src/uptext.c b/Build/source/utils/m-tx/mtx-src/uptext.c index de3f2f6d182..19a222ddb6a 100644 --- a/Build/source/utils/m-tx/mtx-src/uptext.c +++ b/Build/source/utils/m-tx/mtx-src/uptext.c @@ -2,9 +2,9 @@ /* From input file "uptext.pas" */ - #include "p2c.h" + #define UPTEXT_G #include "uptext.h" diff --git a/Build/source/utils/m-tx/mtx-src/utility.c b/Build/source/utils/m-tx/mtx-src/utility.c index b44c07b5555..079bfdda116 100644 --- a/Build/source/utils/m-tx/mtx-src/utility.c +++ b/Build/source/utils/m-tx/mtx-src/utility.c @@ -4,6 +4,7 @@ #include "p2c.h" + #define UTILITY_G #include "utility.h" diff --git a/Build/source/utils/m-tx/mtx-src/version.ac b/Build/source/utils/m-tx/mtx-src/version.ac index 84d5d2ed6be..3873ea93dd5 100644 --- a/Build/source/utils/m-tx/mtx-src/version.ac +++ b/Build/source/utils/m-tx/mtx-src/version.ac @@ -8,4 +8,4 @@ dnl dnl -------------------------------------------------------- dnl dnl m4-include this file to define the current mtx version -m4_define([mtx_version], [0.61]) +m4_define([mtx_version], [0.62]) diff --git a/Build/source/utils/m-tx/prepmx.1 b/Build/source/utils/m-tx/prepmx.1 index 226457c532e..f03d6e6210d 100644 --- a/Build/source/utils/m-tx/prepmx.1 +++ b/Build/source/utils/m-tx/prepmx.1 @@ -1,4 +1,4 @@ -.TH prepmx 1 "15 December 2015" "M-Tx Version 0.61" "prepmx Manual Page" +.TH prepmx 1 "08 February 2016" "M-Tx Version 0.62" "prepmx Manual Page" .SH NAME prepmx \- preprocessor for PMX, easy music typesetting program .SH SYNOPSIS diff --git a/Build/source/utils/m-tx/tests/mozart.pmx b/Build/source/utils/m-tx/tests/mozart.pmx index bedfc8232be..ad7876c801a 100644 --- a/Build/source/utils/m-tx/tests/mozart.pmx +++ b/Build/source/utils/m-tx/tests/mozart.pmx @@ -1,6 +1,6 @@ --- -\def\mtxversion{0.61} -\def\mtxdate{<16 December 2015>} +\def\mtxversion{0.62} +\def\mtxdate{<08 February 2016>} \input mtx \mtxComposerLine{}{W. A. Mozart (1756--1791)} \mtxTitleLine{Riff in C} diff --git a/Build/source/utils/m-tx/version.ac b/Build/source/utils/m-tx/version.ac index 84d5d2ed6be..3873ea93dd5 100644 --- a/Build/source/utils/m-tx/version.ac +++ b/Build/source/utils/m-tx/version.ac @@ -8,4 +8,4 @@ dnl dnl -------------------------------------------------------- dnl dnl m4-include this file to define the current mtx version -m4_define([mtx_version], [0.61]) +m4_define([mtx_version], [0.62]) |