                   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: find the latest available
mtxD????.zip and read the Corrections file.  There are no examples: find
the latest available mtxX????.zip.  Or stay with the most recent stable
release for those.

The development version is provided for those 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 Dirk Laurie <dlaurie@na-net.ornl.gov>.

You will have found this README in a file called something like mtxP054f.zip
(which containes Pascal code) or mtxC054f.zip (which contains C code).  
I will refer to that file as mtxP????.zip or mtxC????.zip.

You need one of the following compilers.  A later version than specified
should also work, but an earlier one probably will not.
  1. Free Pascal 1.0.10 (for mtxP????.zip)
  2. Borland Pascal 7.0 (for mtxP????.zip)
  3. Any ANSI-compliant C compiler (for mtxC????.zip)
  4. The p2c package plus any ANSI-compliant C compiler (for mtxP????.zip)
The first of these is recommended, since that is the compiler I use.
I try to stay compatible with the other three, but this may not always
be possible.

"GNU System" means any system on which standard GNU utilities such as "bash"
and "make" is available.  Typical GNU systems are (a) Linux (b) Windows with
the Cygwin package installed (c) other systems on which an appropriate
package has been installed.  You do not need a GNU system to use M-Tx,
but it is easier to make the executable on a GNU system.
 
Read Section 1 below, and, depending on which compiler you have,
one of the other sections.  If you have no appropriate compiler,
visit http://www.freepascal.org/ to see whether there is a Free Pascal
compiler for your system (at present, MacOS is the only popular operating
system not available); if not, get an ANSI compliant C compiler and read
Section 6.


   Contents

1. Text file format and unzipping
2. Compiling with Free Pascal
3. Compiling with Borland Pascal 7.0 
4. Compiling with p2c
5. Compiling with a C compiler on a GNU system
6. Compiling with a C compiler on a non-GNU system
7. For experts only

                   1. Text file format and unzipping

Change to some empty directory and unzip the distribution file.  YOU MUST
UNZIP THE FILES USING AN UNZIPPER THAT CAN CONVERT TEXT FILES TO YOUR
SYSTEM'S FORMAT.  Some things may work even if you don't (maybe even
everything, if your system happens to use the same text format as the
system on which the zipfile was made) but then any later errors will
only be more mysterious because of that.  It may be necessary to set
special options in your unzipper to achieve this.  On a GNU system,
the command is 
   unzip -a mtxP????.zip


                   2. Compiling with Free Pascal

Free Pascal is available from for most current operating systems, including 
Linux, SunOS and Windows. 

If your system has GNU Make, simply type

  make

Otherwise, type 

  fpc -B -So prepmx

to make the executable. 


                   3. Compiling with Borland Pascal 7.0

This compiler is a 16-bit compiler specific to MSDOS, even though it
runs under Windows and under DOS emulators on other 32-bit systems.
It cannot handle very large code and data segments, and unfortunately
it is necessary to cripple M-Tx somewhat to make it fit in, as follows:

3.1 Edit the file "globals.pas" and change the lines

          lines_in_paragraph = 100; 
	  max_words = 128;
	  max_notes = 128;

    to

          lines_in_paragraph = 50; 
	  max_words = 64;
	  max_notes = 64;

3.2 Type 

        bpc -b prepmx

    to make prepmx.exe.


                   4. Compiling with p2c 

This route is only available if you have a GNU system with a C compiler
and the package p2c (on old Red Hat systems, both p2c and p2c-devel).  Type
  
  make prepmxc

to make prepmx.  On this system only, you can make the mtxC????.zip file
that corresponds to your mtxP????.zip file with

  make Czip


                   5. Compiling with a C compiler on a GNU system  

Just type
  
  make prepmxc

to make prepmx.


                   6. Compiling with a C compiler on a non-GNU system

Your C compiler must be ANSI compliant (sorry, Visual C++ 6.0 is not
such, but Turbo C++ is).  Then issue a command that will compile and
link all the .c files to produce an appropriately named executable.
The command line will depend on your system; for example

  cc *.c -o prepmx

should work on non-GNU Un?x systems.


                   7. For experts only

You can modify the source code as you wish -- this is open source software
and the copyright is GPL.  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.

The primary source is the Pascal version; the C version is made with p2c as
described in Section 4.  Therefore, any change made to the C code is volatile;
only changes made to the Pascal version become permanent.

If you make both Pascal and C executables, it is your responsibilty to
move or rename the first executable, otherwise it will be overwritten.
Moreover, it is possible to confuse the Makefile, since object files
from Pascal and C compilations may well have the same name; you will
then get numerous error messages.  The safe thing is to "make clean"
before switching languages.
