summaryrefslogtreecommitdiff
path: root/Build/source/texk/musixtnt/musixtnt-src
diff options
context:
space:
mode:
authorAkira Kakuto <kakuto@fuk.kindai.ac.jp>2016-02-10 16:33:02 +0000
committerAkira Kakuto <kakuto@fuk.kindai.ac.jp>2016-02-10 16:33:02 +0000
commit85a12660c810339230543aa4d8975c3e578ea1ce (patch)
tree24f9639ba9f678306e792b6906da765e2b61e8d9 /Build/source/texk/musixtnt/musixtnt-src
parentac4e58eccab2dbf0b957d99edbd05ae1a6053dcd (diff)
musixtnt 2016-01-30
git-svn-id: svn://tug.org/texlive/trunk@39658 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/musixtnt/musixtnt-src')
-rw-r--r--Build/source/texk/musixtnt/musixtnt-src/AUTHORS5
-rw-r--r--Build/source/texk/musixtnt/musixtnt-src/ChangeLog68
-rw-r--r--Build/source/texk/musixtnt/musixtnt-src/Makefile.am16
-rw-r--r--Build/source/texk/musixtnt/musixtnt-src/README54
-rw-r--r--Build/source/texk/musixtnt/musixtnt-src/acinclude.m485
-rw-r--r--Build/source/texk/musixtnt/musixtnt-src/configure.ac24
-rw-r--r--Build/source/texk/musixtnt/musixtnt-src/msxlint.136
-rw-r--r--Build/source/texk/musixtnt/musixtnt-src/msxlint.c422
-rwxr-xr-xBuild/source/texk/musixtnt/musixtnt-src/msxlint.test28
-rw-r--r--Build/source/texk/musixtnt/musixtnt-src/tests/badtest.tex10
-rw-r--r--Build/source/texk/musixtnt/musixtnt-src/tests/linttest.out7
-rw-r--r--Build/source/texk/musixtnt/musixtnt-src/tests/linttest.tex10
-rw-r--r--Build/source/texk/musixtnt/musixtnt-src/utils.c103
-rw-r--r--Build/source/texk/musixtnt/musixtnt-src/utils.h66
14 files changed, 934 insertions, 0 deletions
diff --git a/Build/source/texk/musixtnt/musixtnt-src/AUTHORS b/Build/source/texk/musixtnt/musixtnt-src/AUTHORS
new file mode 100644
index 00000000000..2684f199c52
--- /dev/null
+++ b/Build/source/texk/musixtnt/musixtnt-src/AUTHORS
@@ -0,0 +1,5 @@
+Bob Tennent
+School of Computing
+Queen's University
+Kingston, Canada
+rdt@cs.queensu.ca
diff --git a/Build/source/texk/musixtnt/musixtnt-src/ChangeLog b/Build/source/texk/musixtnt/musixtnt-src/ChangeLog
new file mode 100644
index 00000000000..4cba0e1cc43
--- /dev/null
+++ b/Build/source/texk/musixtnt/musixtnt-src/ChangeLog
@@ -0,0 +1,68 @@
+2015-05-07
+
+ Re-implement to deal with autosp output
+ Replace -d option by a log file
+ Introduce -a option to allow user choice of \qb{n}{.p} treatment
+ Don't replace \alaligne and \alapage by \bar
+ (might change context)
+ output_rests for \znotes ...
+
+2015-02-23
+
+ Allow for \zcn, \lcn, \ccn abbreviations for \zcharnote, etc.
+
+2015-02-09 RDT
+
+ Check for EOF and missing EOL.
+
+2015-02-06 RDT
+
+ Minor patches from Peter B.
+ Added test files and test scripts from Peter B.
+
+2015-02-04 RDT
+
+ Re-named fixmsxpart to satisfy Karl Berry.
+
+ Initial messages go to stderr if there is only one file
+ argument but to stdout for -v or -h.
+
+ Moved common utilities from msxlint and fixmsxpart
+ to utils.c.
+
+2015-01-29 RDT
+
+ Re-organized beams to allow ovelapping beams.
+
+ General code clean-up.
+
+2015-01-23 RDT
+
+ Re-organized synthesize_notes.
+
+ Don't assume \vnotes is for an appoggiatura without
+ \tinynotesize.
+
+ Discard \sk and \hsk commands but keep
+ \qsk, \hqsk and \off{...}.
+
+ Comment out \eject commands.
+
+ Deal with \{z|c|l}char[note] commands (which may have
+ embedded commands).
+
+2015-01-16 RDT
+
+ Added '%' to comment out \mulooseness etc. lines.
+
+2015-01-06 RDT
+
+ Avoid analyzing \def lines.
+
+2015-01-03 RDT
+
+ Workaround confusion between \bar and \barno.
+
+2015-01-02 RDT
+
+ First release.
diff --git a/Build/source/texk/musixtnt/musixtnt-src/Makefile.am b/Build/source/texk/musixtnt/musixtnt-src/Makefile.am
new file mode 100644
index 00000000000..cdc28185321
--- /dev/null
+++ b/Build/source/texk/musixtnt/musixtnt-src/Makefile.am
@@ -0,0 +1,16 @@
+bin_PROGRAMS = msxlint
+msxlint_SOURCES = utils.h utils.c msxlint.c
+AM_CFLAGS = -O4 -ansi -Wall -Wextra -pedantic-errors
+dist_man_MANS = msxlint.1
+## Tests
+##
+TESTS = msxlint.test
+
+EXTRA_DIST =
+EXTRA_DIST += $(TESTS)
+DISTCLEANFILES =
+
+## msxlint.test
+EXTRA_DIST += tests/badtest.tex tests/linttest.tex tests/linttest.out
+DISTCLEANFILES += linttest.*
+
diff --git a/Build/source/texk/musixtnt/musixtnt-src/README b/Build/source/texk/musixtnt/musixtnt-src/README
new file mode 100644
index 00000000000..3d29bf8c317
--- /dev/null
+++ b/Build/source/texk/musixtnt/musixtnt-src/README
@@ -0,0 +1,54 @@
+This archive contains a MusiXTeX extension library musixtnt
+and C source code, binaries for Windows (32 bit and 64 bit)
+and MacOSX, and documentation for two programs: fixmsxpart
+and msxlint.
+
+musixtnt.tex provides a macro \TransformNotes that
+enables transformations of the effect of notes
+commands such as \notes. In general, the effect of
+\TransformNotes{input}{output} is that notes commands in
+the source will expect their arguments to match the input
+pattern, but the notes will be typeset according to the
+output pattern. An example is extracting single-instrument
+parts from a multi-instrument score.
+
+fixmsxpart corrects note spacing in a single-part MusiXTeX
+source (possibly derived from a multi-instrument score and
+as a result having irregular note spacing).
+
+msxlint detects incorrectly formatted notes lines in a
+MusiXTeX source file. This should be used before using
+\TransformNotes.
+
+To install:
+
+Create texmf/tex/generic/musixtnt in a local or personal
+texmf tree and move musixtnt.tex into it.
+
+Create texmf/doc/generic/musixtnt and move there the files
+in the doc directory.
+
+Update the file-name database as required by your TeX
+installation.
+
+If your platform is UNIX-like, process the
+musixtnt-<version>.tar.gz file as usual (tar zxvf ...,
+./configure, make, make install).
+
+If your platform is Windows, move the executables
+msxlint.exe and fixmsxpart.exe in either the 32bit or the
+64bit folders to a folder on the executable PATH.
+
+If your platform is Mac OS-X, install the executables
+in the macosx directory.
+
+musixtnt.tex, fixmsxpart.c, utils.c and msxlint.c are
+licensed under the GPL version 2 or (at your option) any
+later version.
+
+Please report bugs and experience (good or bad) using these
+programs to me.
+
+Bob Tennent
+rdt(at)cs(dot)queensu(dot)ca
+2015-05-07
diff --git a/Build/source/texk/musixtnt/musixtnt-src/acinclude.m4 b/Build/source/texk/musixtnt/musixtnt-src/acinclude.m4
new file mode 100644
index 00000000000..4a581894bc7
--- /dev/null
+++ b/Build/source/texk/musixtnt/musixtnt-src/acinclude.m4
@@ -0,0 +1,85 @@
+
+dnl
+dnl read lib version from file (and trim trailing newline)
+dnl
+define([EL_RELEASE], [patsubst(esyscmd([. src/shlib_version; echo $major.$minor]), [
+])])
+
+dnl
+dnl read cvsexport timestamp from file (and trim trailing newline)
+dnl
+define([EL_TIMESTAMP], [patsubst(esyscmd([date +"%Y%m%d"]), [
+])])
+
+
+dnl
+dnl NetBSD use the -mdoc macro package for manpages, but e.g.
+dnl AIX and Solaris only support the -man package.
+dnl
+AC_DEFUN([EL_MANTYPE],
+[
+ MANTYPE=
+ TestPath="/usr/bin${PATH_SEPARATOR}/usr/ucb"
+ AC_PATH_PROGS(NROFF, nroff awf, /bin/false, $TestPath)
+ if ${NROFF} -mdoc ${srcdir}/doc/editrc.5.roff >/dev/null 2>&1; then
+ MANTYPE=mdoc
+ fi
+ AC_SUBST(MANTYPE)
+])
+
+
+dnl
+dnl Check if getpwnam_r and getpwuid_r are POSIX.1 compatible
+dnl POSIX draft version returns 'struct passwd *' (used on Solaris)
+dnl NOTE: getpwent_r is not POSIX so we always use getpwent
+dnl
+AC_DEFUN([EL_GETPW_R_POSIX],
+[
+ AC_MSG_CHECKING([whether getpwnam_r and getpwuid_r are posix like])
+ # The prototype for the POSIX version is:
+ # int getpwnam_r(char *, struct passwd *, char *, size_t, struct passwd **)
+ # int getpwuid_r(uid_t, struct passwd *, char *, size_t, struct passwd **);
+ AC_TRY_LINK([#include <stdlib.h>
+ #include <sys/types.h>
+ #include <pwd.h>],
+ [getpwnam_r(NULL, NULL, NULL, (size_t)0, NULL);
+ getpwuid_r((uid_t)0, NULL, NULL, (size_t)0, NULL);],
+ [AC_DEFINE([HAVE_GETPW_R_POSIX], 1, [Define to 1 if you have getpwnam_r and getpwuid_r that are POSIX.1 compatible.])
+ AC_MSG_RESULT(yes)],
+ [AC_MSG_RESULT(no)])
+])
+
+AC_DEFUN([EL_GETPW_R_DRAFT],
+[
+ AC_MSG_CHECKING([whether getpwnam_r and getpwuid_r are posix _draft_ like])
+ # The prototype for the POSIX draft version is:
+ # struct passwd *getpwuid_r(uid_t, struct passwd *, char *, int);
+ # struct passwd *getpwnam_r(char *, struct passwd *, char *, int);
+ AC_TRY_LINK([#include <stdlib.h>
+ #include <sys/types.h>
+ #include <pwd.h>],
+ [getpwnam_r(NULL, NULL, NULL, (size_t)0);
+ getpwuid_r((uid_t)0, NULL, NULL, (size_t)0);],
+ [AC_DEFINE([HAVE_GETPW_R_DRAFT], 1, [Define to 1 if you have getpwnam_r and getpwuid_r that are draft POSIX.1 versions.])
+ AC_MSG_RESULT(yes)],
+ [AC_MSG_RESULT(no)])
+])
+
+
+dnl
+dnl use option --enable-widec to turn on use of wide-character support
+dnl
+AC_DEFUN([EL_ENABLE_WIDEC],
+[
+ AC_MSG_CHECKING(if you want wide-character code)
+ AC_ARG_ENABLE(widec,
+ [ --enable-widec compile with wide-char/UTF-8 code],
+ [with_widec=$enableval],
+ [with_widec=no])
+ AC_MSG_RESULT($with_widec)
+ if test "$with_widec" = yes ; then
+ AC_DEFINE(WIDECHAR, 1, [Define to 1 if you want wide-character code])
+ fi
+ AM_CONDITIONAL([WIDECHAR], [test "$with_widec" = yes])
+])
+
diff --git a/Build/source/texk/musixtnt/musixtnt-src/configure.ac b/Build/source/texk/musixtnt/musixtnt-src/configure.ac
new file mode 100644
index 00000000000..843a504be18
--- /dev/null
+++ b/Build/source/texk/musixtnt/musixtnt-src/configure.ac
@@ -0,0 +1,24 @@
+AC_PREREQ(2.63)
+AC_INIT([musixtnt],[2016-01-30],[rdt@cs.queensu.ca])
+AC_CONFIG_AUX_DIR([.])
+AM_INIT_AUTOMAKE
+AC_CONFIG_HEADERS([config.h])
+
+m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
+
+# Checks for programs.
+AC_PROG_CC
+AM_PROG_CC_C_O
+
+# Checks for header files.
+AC_CHECK_HEADERS([stdlib.h string.h stdio.h time.h getopt.h])
+
+# Checks for typedefs, structures, and compiler characteristics.
+AC_HEADER_STDBOOL
+AC_TYPE_SIZE_T
+
+# Checks for library functions.
+AC_CHECK_FUNCS([strstr])
+
+AC_CONFIG_FILES([Makefile])
+AC_OUTPUT
diff --git a/Build/source/texk/musixtnt/musixtnt-src/msxlint.1 b/Build/source/texk/musixtnt/musixtnt-src/msxlint.1
new file mode 100644
index 00000000000..d0a3f695ae7
--- /dev/null
+++ b/Build/source/texk/musixtnt/musixtnt-src/msxlint.1
@@ -0,0 +1,36 @@
+.\" This manpage is licensed under the GNU Public License
+.TH MSXLINT 1 2015-02-05 "" ""
+
+.SH NAME
+msxlint \- detects incorrectly formatted notes lines in a MusiXTeX source file.
+
+.SH SYNOPSIS
+.B msxlint
+.RB [ \-v\ |\ \-\-version\ |\ \-h\ |\ \-\-help ]
+
+.B msxlint
+.RB [ \-d\ | \ \-\-debug ]...
+.RI [ infile [ \fB.tex\fP ]...]
+
+If no
+.IR infiles
+are specifed, standard input is used.
+
+.SH USAGE
+
+The format that notes commands are expected to match is
+determined by \\instrumentnumber and \\setstaffs commands, or
+uses of the \\TransformNotes macro defined in musixtnt.tex (see musixdoc.pdf), or re-definitions of the \\vnotes macro.
+Output consists of messages about format errors,
+with listings of the ill-formatted lines.
+
+.SH LIMITATIONS
+User-defined macros are not processed or expanded. Notes commands (\\notes, \\Notes, etc.)
+can have line breaks, but other commands must fit on one line.
+.SH SEE ALSO
+.BR fixmsxpart (1)
+.PP
+musixdoc.pdf
+
+.SH AUTHOR
+This program and manual page were written by Bob Tennent <rdt@cs.queensu.ca>.
diff --git a/Build/source/texk/musixtnt/musixtnt-src/msxlint.c b/Build/source/texk/musixtnt/musixtnt-src/msxlint.c
new file mode 100644
index 00000000000..86a5d1f2317
--- /dev/null
+++ b/Build/source/texk/musixtnt/musixtnt-src/msxlint.c
@@ -0,0 +1,422 @@
+char version[12] = "2016-01-30";
+
+/* Copyright (C) 2014-16 R. D. Tennent School of Computing,
+ * Queen's University, rdt@cs.queensu.ca
+ *
+ * This program is free software; you can redistribute it
+ * and/or modify it under the terms of the GNU General
+ * Public License as published by the Free Software
+ * Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will
+ * be useful, but WITHOUT ANY WARRANTY; without even the
+ * implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General
+ * Public License along with this program; if not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+/* msxlint - detects incorrectly formatted notes lines
+ * in a MusiXTeX source file.
+ *
+ * Usage: msxlint [-v | --version | -h | --help]
+ * msxlint [-d | --debug] { infile[.tex] } ...
+ *
+ */
+
+
+# include "utils.h"
+
+PRIVATE int debug = 0;
+PRIVATE char infilename[LINE_LEN];
+PRIVATE char *infilename_n = infilename;
+
+PRIVATE FILE *infile;
+
+PRIVATE char line[LINE_LEN]; /* line of input */
+PRIVATE int lineno; /* line number */
+PRIVATE int ninstr; /* number of instruments */
+PRIVATE int staffs[12]; /* staffs[i] is the number of staffs
+ for instrument i */
+PRIVATE char terminator[8]; /* "\en" or "\enotes" or "" (either) */
+PRIVATE int nerrors; /* number of error messages */
+# define NERRORSMAX 10
+
+PRIVATE void
+checkc (char *s, char c)
+{ if (*s != c)
+ printf ("Expected %c but found %c in line %d:\n%s\n", c, *s, lineno, line);
+}
+
+PRIVATE void
+checkn (char *s)
+{ if (strpbrk (s, "0123456789") != s)
+ printf ("Expected digit but found %c in line %d:\n%s\n", *s, lineno, line);
+}
+
+PRIVATE void
+usage (void)
+{
+ puts ("Usage: msxlint [-v | --version | -h | --help]");
+ puts (" msxlint [-d | --debug] ... { infile[.tex] } ...");
+}
+
+PRIVATE void
+analyze_notes ( char **ln) {
+ int i,j;
+ int newlines = 0;
+ char *s; char *t;
+ s = strpbrk (*ln+1, "|&\\\n"); /* skip initial command */
+ while (true)
+ { /* look for \en */
+ t = strstr(s, "\\en");
+ if (t != NULL) break;
+ else
+ /* replace EOL by a blank and append another line of input */
+ { char new_line[LINE_LEN];
+ if (debug > 2) printf (" Reading additional line of input:\n");
+ if ( fgets (new_line, LINE_LEN, infile) == NULL)
+ error("Unexpected EOF.");
+ if ( (t = strchr (s, '\n')) == NULL )
+ error("Missing EOL.");
+ *t = ' ';
+ t++;
+ *t = '\0';
+ if (append (line, &t, new_line, LINE_LEN) >= LINE_LEN)
+ error ("Line too Long.");
+ if (debug > 2) printf (" %s\n", t+1);
+ newlines++;
+ }
+ }
+ for (i=1; i <= ninstr; i++)
+ {
+ for (j=1; j < staffs[i]; j++)
+ { s = strpbrk (s, "|&");
+ if (s == NULL || *s == '&' || s > t)
+ {
+ printf ("Too few staffs for instrument %d in notes on line %d:\n%s", i, lineno, line);
+ nerrors++;
+ *ln = t+3;
+ return;
+ }
+ checkc (s, '|'); s++;
+ }
+ if (i == ninstr) break;
+ s = strpbrk (s, "&|");
+ if (s == NULL || s > t)
+ {
+ printf ("Too few instruments in notes on line %d:\n%s", lineno, line);
+ nerrors++;
+ *ln = t+3;
+ return;
+ }
+ if (*s == '|')
+ {
+ printf ("Too many staffs for instrument %d in notes on line %d:\n%s", i, lineno, line);
+ nerrors++;
+ *ln = t+3;
+ return;
+ }
+ checkc (s, '&'); s++;
+ }
+ s = strpbrk (s, "|&");
+ if (s != NULL && s < t)
+ {
+ printf ("Too many fields in notes on line %d:\n%s", lineno, line);
+ nerrors++;
+ *ln = t+3;
+ return;
+ }
+ s = t; /* \en */
+ if (terminator[0] != '\0')
+ { if (!prefix (terminator, s) )
+ {
+ printf ("Expected %s at end of notes on line %d:\n%s", terminator, lineno, line);
+ nerrors++;
+ t = strchr(s, '\\');
+ if (t == NULL) t = *ln + strlen (*ln);
+ *ln = t;
+ return;
+ }
+ if ( terminator[3] == '\0' && prefix ("otes", s+3) )
+ {
+ printf ("Expected %s at end of notes on line %d:\n%s", terminator, lineno, line);
+ nerrors++;
+ t = strchr(s, '\\');
+ if (t == NULL) t = *ln + strlen (*ln);
+ *ln = t;
+ return;
+ }
+ }
+ lineno = lineno + newlines;
+ t = strchr(s+1, '\\');
+ if (t == NULL) t = *ln + strlen (*ln);
+ *ln = t;
+ return;
+}
+
+PRIVATE void
+process_command (char **ln)
+{ char *s, *t;
+ if ( prefix("\\instrumentnumber", *ln) )
+ {
+ if (debug > 1) printf ("%s\n", " Processing \\instrumentnumber");
+ s = strpbrk (*ln, "123456789");
+ if ( s == NULL ) error ("\\instrumentnumber command unreadable.");
+ ninstr = atoi (s);
+ t = strpbrk (*ln+1, "\\");
+ if (t == NULL)
+ { *ln = *ln + strlen (*ln); return; }
+ *ln = t;
+ }
+
+ if ( prefix("\\def\\nbinstrument", *ln) )
+ {
+ if (debug > 1) printf ("%s\n", " Processing \\def\\nbinstrument");
+ s = strpbrk (*ln, "123456789");
+ if ( s == NULL ) error ("\\def\\nbinstrument command unreadable.");
+ ninstr = atoi (s);
+ t = strpbrk (*ln+1, "\\");
+ if (t == NULL)
+ { *ln = *ln + strlen (*ln); return; }
+ *ln = t;
+ }
+
+ else if ( prefix("\\setstaffs", *ln) )
+ {
+ int n, p;
+ if (debug > 1) printf ("%s\n", " Processing \\setstaffs");
+ s = strpbrk (*ln, "123456789");
+ if ( s == NULL ) error ("\\setstaffs command unreadable.");
+ n = (int)(*s) - (int)('0'); /* instrument number */
+ s = strpbrk (s+1, "123456789");
+ if ( s == NULL ) error ("\\setstaffs command unreadable.");
+ p = (int)(*s) - (int)('0'); /* number of staffs */
+ staffs[n] = p;
+ t = strpbrk (*ln+1, "\\");
+ if (t == NULL)
+ { *ln = *ln + strlen (*ln); return; }
+ *ln = t;
+ }
+
+ else if ( prefix("\\def\\vnotes#1\\elemskip", *ln) )
+ {
+ if (debug > 1) printf ("%s\n", " Processing \\def\\vnotes");
+ s = *ln + 22; /* first parameter */
+ ninstr = 0;
+ while (true)
+ { ninstr++;
+ staffs[ninstr] = 1;
+ checkc (s, '#'); s++;
+ checkn (s); s++;
+ while (*s == '|')
+ { staffs[ninstr]++;
+ checkc (s, '|'); s++;
+ checkc (s, '#'); s++;
+ checkn (s); s++;
+ }
+ if (*s != '&') break;
+ checkc (s, '&'); s++;
+ }
+ t = &terminator[0];
+ while (*s != '{')
+ { *t = *s; s++; t++; }
+ *t = '\0';
+ *ln = strchr (*ln, '}') ;
+ (*ln)++;
+ }
+
+ else if ( prefix("\\TransformNotes", *ln) )
+ {
+ if (debug > 1) printf ("%s\n", " Processing \\TransformNotes");
+ s = *ln + 16; /* first parameter */
+ ninstr = 0;
+ while (true)
+ { ninstr++;
+ staffs[ninstr] = 1;
+ checkc (s, '#'); s++;
+ checkn (s); s++;
+ while (*s == '|')
+ { staffs[ninstr]++;
+ checkc (s, '|'); s++;
+ checkc (s, '#'); s++;
+ checkn (s); s++;
+ }
+ if (*s != '&') break;
+ checkc (s, '&'); s++;
+ }
+ t = &terminator[0];
+ terminator[0] = '\0';
+ append ( t, &t, "\\en", sizeof (terminator) );
+ do s++; while (*s != '{');
+ *ln = strchr (s, '}') ;
+ if (*ln == NULL) error ("Can't find '}' after \\TransformNotes.");
+ (*ln)++;
+ }
+
+ else if ( prefix("\\notes", *ln) ||
+ prefix("\\Notes", *ln) ||
+ prefix("\\NOtes", *ln) ||
+ prefix("\\NOTes", *ln) ||
+ prefix("\\NOTEs", *ln) ||
+ prefix("\\nnotes", *ln) ||
+ prefix("\\vnotes", *ln) ||
+ prefix("\\znotes", *ln)
+ )
+ {
+ if (debug > 1) printf ("%s\n", " Processing notes");
+ analyze_notes (ln);
+ t = strpbrk (*ln, "\\\n");
+ if (t == NULL)
+ { *ln = *ln + strlen (*ln); return; }
+ *ln = t;
+ }
+
+ else if ( prefix("\\def\\atnextbar", *ln))
+ {
+ if (debug > 1) printf ("%s\n", " Processing \\def\\atnextbar");
+ s = strstr (*ln, "\\znotes");
+ if (s != NULL)
+ {
+ *ln = s;
+ analyze_notes (ln);
+ }
+ t = strpbrk (*ln, "\\");
+ if (t == NULL)
+ { *ln = *ln + strlen (*ln); return; }
+ *ln = t;
+ }
+
+ else if ( prefix("\\def", *ln) )
+ *ln = *ln + strlen (*ln);
+
+ else /* anything else */
+ {
+ if (debug > 1) printf (" Processing ");
+ t = strpbrk (*ln+1, "\\\n");
+ if (t == NULL) t = *ln + strlen (*ln);
+ if (debug > 1)
+ { char *s = *ln; do {putchar (*s); s++;} while (s != t); puts ("");}
+ *ln = t;
+ }
+}
+
+PRIVATE void
+process_line (void)
+{
+ char *ln;
+ ln = &line[0];
+ while ( *ln != '\0')
+ {
+ while (*ln == ' ') { ln++;}
+ if (*ln == '%' || *ln == '\n') return;
+ process_command (&ln);
+ } /* *ln == '\0' */
+}
+
+PRIVATE void
+process_score (void)
+/* process .tex file */
+{
+ int c; int i;
+ lineno = 0;
+ ninstr = 1;
+ nerrors = 0;
+ staffs[0] = 0;
+ for (i = 1; i<12; i++) staffs[i] = 1;
+ terminator[0] = '\0'; /* either \en or \enotes */
+ while ( (c = getc (infile)) != EOF )
+ {
+ ungetc (c, infile);
+ if (fgets(line, LINE_LEN, infile) == NULL) error("IO error");
+ if (strlen (line) == LINE_LEN-1) error("Line too long.");
+ lineno++;
+ if (debug > 0) printf ("Processing line %d.\n", lineno);
+ process_line ();
+ if (nerrors > NERRORSMAX) {
+ puts ("\nToo many errors; processing of this file aborted.");
+ return;
+ }
+ } /* c == EOF */
+}
+
+
+int
+main (int argc, char *argv[])
+{
+ int c;
+ char today[12];
+ time_t mytime;
+# define NOPTS 4
+ struct option longopts[NOPTS] =
+ { { "help", 0, NULL, 'h'},
+ { "version", 0, NULL, 'v'},
+ { "debug", 0, NULL, 'd'},
+ { NULL, 0, NULL, 0}
+ };
+
+ time (&mytime);
+ strftime (today, 11, "%Y-%m-%d", localtime (&mytime) );
+ printf ("This is msxlint, version %s.\n", version);
+ c = getopt_long (argc, argv, "hvd", longopts, NULL);
+ while (c != -1)
+ {
+ switch (c)
+ {
+ case 'h':
+ usage ();
+ puts ( "Please report bugs to rdt@cs.queensu.ca." );
+ exit (0);
+ case 'v':
+ exit (0);
+ case 'd':
+ debug++;
+ break;
+ case '?':
+ exit (EXIT_FAILURE);
+ default:
+ fprintf (stderr,"Function getopt returned character code 0%o.\n",
+ (unsigned int) c);
+ exit (EXIT_FAILURE);
+ }
+ c = getopt_long (argc, argv, "hvd", longopts, NULL);
+ }
+ puts ( "Copyright (C) 2014-16 R. D. Tennent" );
+ puts ( "School of Computing, Queen's University, rdt@cs.queensu.ca" );
+ puts ( "License GNU GPL version 2 or later <http://gnu.org/licences/gpl.html>." );
+ puts ( "There is NO WARRANTY, to the extent permitted by law." );
+
+ if (optind == argc)
+ {
+ infile = stdin;
+ printf ("\nProcessing stdin.\n\n");
+ process_score ();
+ }
+ else
+ do
+ {
+ infilename[0] = '\0';
+ infilename_n = infilename;
+ append (infilename, &infilename_n, argv[optind], sizeof (infilename));
+ if (!suffix (".tex", infilename))
+ append (infilename, &infilename_n, ".tex", sizeof (infilename));
+ infile = fopen (infilename, "r");
+ if (infile == NULL)
+ {
+ fprintf (stderr,"Can't open %s\n", infilename);
+ optind++;
+ continue;
+ }
+ printf ("\nProcessing %s.\n\n", infilename);
+ process_score ();
+ optind++;
+ }
+ while (optind < argc);
+
+ return 0;
+}
diff --git a/Build/source/texk/musixtnt/musixtnt-src/msxlint.test b/Build/source/texk/musixtnt/musixtnt-src/msxlint.test
new file mode 100755
index 00000000000..efdf3620005
--- /dev/null
+++ b/Build/source/texk/musixtnt/musixtnt-src/msxlint.test
@@ -0,0 +1,28 @@
+#! /bin/sh
+
+# Copyright (C) 2015 Peter Breitenlohner <tex-live@tug.org>
+# You may freely use, modify and/or distribute this file.
+
+echo && echo "*** msxlint --help"
+./msxlint --help || exit 1
+
+echo && echo "*** msxlint --version"
+./msxlint --version || exit 1
+
+: ${testsrc:=$srcdir/tests}
+
+echo && echo "*** msxlint -d tests/badtest"
+./msxlint -d $testsrc/badtest && exit 1
+
+echo && echo "*** msxlint tests/linttest >linttest.out1"
+./msxlint $testsrc/linttest | sed '/^This/,/^Processing/d' >linttest.out1 || exit 1
+
+echo && echo "*** diff tests/linttest.out linttest.out1"
+diff $testsrc/linttest.out linttest.out1 || exit 1
+
+echo && echo "*** cat tests/linttest.tex | msxlint >linttest.out2"
+cat $testsrc/linttest.tex | ./msxlint | sed '/^This/,/^Processing/d' >linttest.out2 || exit 1
+
+echo && echo "*** diff tests/linttest.out linttest.out2"
+diff $testsrc/linttest.out linttest.out2 || exit 1
+
diff --git a/Build/source/texk/musixtnt/musixtnt-src/tests/badtest.tex b/Build/source/texk/musixtnt/musixtnt-src/tests/badtest.tex
new file mode 100644
index 00000000000..ed85d76374e
--- /dev/null
+++ b/Build/source/texk/musixtnt/musixtnt-src/tests/badtest.tex
@@ -0,0 +1,10 @@
+\input musixtex
+\instrumentnumber2
+\setclef1{\bass}
+\setstaffs12
+\startpiece\addspace\afterruleskip%
+\Notes\qa
+J|\qa
+l&\qa
+n\en
+\Notes\qa J|\qa l
diff --git a/Build/source/texk/musixtnt/musixtnt-src/tests/linttest.out b/Build/source/texk/musixtnt/musixtnt-src/tests/linttest.out
new file mode 100644
index 00000000000..db86b2d9938
--- /dev/null
+++ b/Build/source/texk/musixtnt/musixtnt-src/tests/linttest.out
@@ -0,0 +1,7 @@
+
+Too few instruments in notes on line 7:
+\Notes\qa J|\qa l\en
+Too few staffs for instrument 1 in notes on line 8:
+\Notes\qa J&\qa n\en
+Too many fields in notes on line 9:
+\Notes\qa J|\qa l&\qa n&\qa q\en
diff --git a/Build/source/texk/musixtnt/musixtnt-src/tests/linttest.tex b/Build/source/texk/musixtnt/musixtnt-src/tests/linttest.tex
new file mode 100644
index 00000000000..588582b4e89
--- /dev/null
+++ b/Build/source/texk/musixtnt/musixtnt-src/tests/linttest.tex
@@ -0,0 +1,10 @@
+\input musixtex
+\instrumentnumber2
+\setclef1{\bass}
+\setstaffs12
+\startpiece\addspace\afterruleskip%
+\Notes\qa J|\qa l&\qa n\en
+\Notes\qa J|\qa l\en
+\Notes\qa J&\qa n\en
+\Notes\qa J|\qa l&\qa n&\qa q\en
+\zstoppiece\end
diff --git a/Build/source/texk/musixtnt/musixtnt-src/utils.c b/Build/source/texk/musixtnt/musixtnt-src/utils.c
new file mode 100644
index 00000000000..808f43ac3a8
--- /dev/null
+++ b/Build/source/texk/musixtnt/musixtnt-src/utils.c
@@ -0,0 +1,103 @@
+/* Copyright (C) 2014-15 R. D. Tennent School of Computing,
+ * Queen's University, rdt@cs.queensu.ca
+ *
+ * This program is free software; you can redistribute it
+ * and/or modify it under the terms of the GNU General
+ * Public License as published by the Free Software
+ * Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will
+ * be useful, but WITHOUT ANY WARRANTY; without even the
+ * implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General
+ * Public License along with this program; if not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street,
+ * Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+/* utils.c - utilities for fixmsxpart.c and msxlint.c
+ */
+
+# include "utils.h"
+
+void
+warning (const char msg[]) /* output warning message msg to stderr */
+{
+ fprintf (stderr, "Warning: %s\n", msg);
+ return;
+}
+
+void
+error (const char msg[]) /* abort with stderr message msg */
+{
+ fprintf (stderr, "Error: %s\n", msg);
+ exit (EXIT_FAILURE);
+}
+
+bool
+prefix (const char *cs, const char *ct)
+/*
+ is string cs[] a prefix of ct[]?
+*/
+{
+ const char *pcs = cs;
+ const char *pct = ct;
+ while (*pcs != '\0')
+ {
+ if (*pcs != *pct) return false;
+ pcs++; pct++;
+ }
+ return true;
+}
+
+bool
+suffix (const char *cs, const char *ct)
+/* is string cs[] a suffix of ct[]? */
+{
+ const char *pcs = cs;
+ const char *pct = ct + strlen (ct) - strlen (cs);
+ while (*pcs != '\0')
+ {
+ if (*pct != *pcs) return false;
+ pcs++; pct++;
+ }
+ return true;
+}
+
+size_t
+append (char *dst, char **offset, const char *src, size_t n)
+/* Copies src to *offset and updates *offset accordingly (if possible).
+ * Assumes *offset is dst if offset == NULL.
+ * Execution aborts if **offset != '\0'. The src string must be null-terminated.
+ * Returns (original offset - dst) + strlen(src); if >= n, the string was truncated.
+ */
+{
+ const char *s = src;
+ char *d;
+ char *off_orig = ( offset != NULL ? *offset : dst );
+ d = off_orig;
+ if (*d != '\0')
+ {
+ char msg[LINE_LEN + 24] = {'\0'};
+ char *msg_n = msg;
+ append (msg, &msg_n, "\nNull character expected at offset specified for string ", sizeof (msg));
+ append (msg, &msg_n, src, sizeof (msg));
+ error (msg);
+ }
+ n = n - 1 - (off_orig - dst); /* number of available slots (leaving room for \0) */
+ while (n > 0 && *s != '\0')
+ {
+ *d = *s; /* copy non-null character */
+ d++; s++; n--;
+ }
+ *d = '\0'; /* null-terminate */
+ if (offset != NULL)
+ *offset = d; /* update *offset (if possible) */
+ while (*s != '\0') /* traverse rest of src */
+ s++;
+ return (off_orig - dst) + (s - src); /* length of the untruncated string */
+}
diff --git a/Build/source/texk/musixtnt/musixtnt-src/utils.h b/Build/source/texk/musixtnt/musixtnt-src/utils.h
new file mode 100644
index 00000000000..34fc3a83f82
--- /dev/null
+++ b/Build/source/texk/musixtnt/musixtnt-src/utils.h
@@ -0,0 +1,66 @@
+
+/*
+ utils.h -- header file for msxlint.c
+
+ Copyright (c) 2005-16 R. D. Tennent
+ School of Computing, Queen's University, rdt@cs.queensu.ca
+
+This program is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 2 of the License, or (at your
+option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+Public License for more details.
+
+You should have received a copy of the GNU General Public License along
+with this program; if not, write to the Free Software Foundation, Inc.,
+51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+*/
+
+#ifdef HAVE_CONFIG_H /* for TeXLive */
+#include <config.h>
+#endif
+
+# define PRIVATE static
+# include <stdlib.h>
+# include <string.h>
+# include <stdio.h>
+# include <ctype.h>
+
+# ifdef KPATHSEA
+# include <kpathsea/getopt.h>
+# else
+# include <getopt.h>
+# endif
+# include <time.h>
+
+# define LINE_LEN 1024
+
+# ifdef HAVE_STDBOOL_H
+# include <stdbool.h>
+# else
+# ifndef HAVE__BOOL
+# define _Bool signed char
+# endif
+# define bool _Bool
+# define true 1
+# define false 0
+# endif
+
+
+extern size_t append (char *dst, char **offset, const char *src, size_t n);
+/* Copies src to *offset and updates *offset accordingly (if possible).
+ * Assumes *offset is dst if offset == NULL.
+ * The src string must be null-terminated.
+ * Execution aborts unless **offset == '\0'.
+ * Returns (original offset - dst) + strlen(src); if >= n, the string was truncated.
+ */
+
+extern bool prefix (const char *cs, const char *ct); /* is string cs[] a prefix of ct[]? */
+extern bool suffix (const char *cs, const char *ct); /* is string cs[] a suffix of ct[]? */
+
+extern void error (const char msg[]); /* abort with stderr message msg */
+extern void warning (const char msg[]); /* output warning message msg to stderr */