
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#+   
#+     Mumps Compiler 
#+     Copyright (C) A.D. 2004, 2006 by Kevin C. O'Kane  
#+
#+     Kevin C. O'Kane
#+     Department of Computer Science
#+     University of Northern Iowa
#+     Cedar Falls, IA 50613-0507 USA
#+
#+     okane@cs.uni.edu
#+     http://www.cs.uni.edu/~okane
#+
#+
#+ 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
#+
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

May 11, 2009

The MicroSoft Visual C++ version of Mumps/MDH 
installs to c:\mumpsc when you unzip the distribution.
This version contains both the compiler and MDH toolkit.  
It also contains PCRE routines and header files.

You must install a command line version of the MicroSoft
Visual C/C++ Express Edition compiler.  A free version 
of this compiler is available at Microsoft.com

Download and install this compiler.

Next download and unzip the distribution to your C:\ drive.
The distribution will build a directory tree whose root
node is named "mumpsc".  In this directory tree are 
libraries, executables, source files and documentation.

You must do all you compilations of Mumps/MDH programs in
a command prompt window in which the appropriate environement
variables to run the MS VC++ compiler have been set. After 
installation of the MS VC++ compiler, go to your "Start" menu,
select "Programs" then "Visual C++ 2005 Express Edition" then 
"Visual Studio Tools" then "Visual Studio Command Prompt".
Be certain to open the command prompt, not Visual Studio.

Once the command prompt window s open and you will be in the
directory:

  C:\Program Files\Microsoft Visual Studio 9.0\VC>

Note, the version number, 9.0 in the above, may be higher.

When you open this command prompt window, several environment
variables necessary to use the MS VC++ compiler are automatically
set. These are not set if you open a normal command prompt
window. You may not do this from an ordinary command prompt.

In addition to the environment variables set my Microsoft,
you need to add the Mumps Compiler binary directory to your
search path.  Type:

        path=%path%;c:\mumpsc\bin;

You can also change your system settings so that this is
automatically done.  See: 

  Start | Settings | Control Panel | System | Advanced | Environment Variables

where you can permanently add this command.

Now move to a directory where you will write Mumps programs.
You may use Notepad or some other suitable editor to create
the ASCII text of a Mumps program.  Be sure that you save
the program without embedded format control characters that
many word processors invisibly insert.  This generally means
saving the file as type "txt" or ASCII.  Also, be certain to
save the file with the ".mps" extension.  This is important.

You may start the mumps interpreter with the command mumps.
It will give a prompt and will execute mumps commands.

An example Mumps program:

	zmain
	write "Hello World!",!
	for i=1:1:10 write i," "
	write !

To compile a Mumps program type:

	mumpsc hello.mps

where "hello.mps" contains the mumps program. The excutable will 
be "hello.exe"

In the directory: c:\mumpsc\doc\examples are two checkout files
named checkout.mps and checkout1.mps.  You may try these
by copying both to your directory and compiling the first
(compile checkout.mps, not checkout1.mps - the second one
is a test fro the interpreter only):

	mumpsc checkout.mps

When you run it (checkout.exe) it will pefform an number
of tests and invoke checkout1.mps in interpretive mode.
It will query you for some text - type and short string of 
letters.

-----

To compile a C++ program that uses the MDH Toolkit:

      mumpsc zzz.cpp

--------------------------------------------

Build details.

This details how to compile and build the compiler
itself.  It is not necessary if you only want to use
the compiler.  Se the above.

To rebuild the compiler, you need Linux as well as the 
MS VC++ compiler.

The build routine is "MSVCbuild.bat".  This
routine is included in the source distribution:

mumpscompiler-x.xx.src.tar.gz

which untars/ungzips to the directory mumpsc.
You should untar/unzip this file under Linux
in your Linux home directory.

The build bat file should be run from this
directory in a MS VC++ WinXP command prompt.

As configure does not work under WinXP in
native mode, you must run configure under
Linux. This will configure the source 
C and C++ files for the MSVC environment.

To configure for MSVC, under Linux, type:

configure --with-msvc 

This will properly configure the source 
files so they can be compiled with MS VC++.

The batch MSVCBuild.bat compiles the software, builds 
mumpslib.lib, and copies the relevant files to
"c:\mumpsc\".  

The Mumps Compiler (mumps2c.exe) and the
bat files to compile and run programs are
copied to "c:\mumpsc\bin".  This directory
must be added to your PATH variable as 
shown above.  The bat files in the directory
"mdh.bat" and "mumpsc.bat" are hardcoded
to look for libraries and include files
in "c:\mumpsc\".  If you move or rename
this directory, you must modify these files
as well as mumpsc/MSVCbuild.bat.

The c:\mumpsc directory contains:

c:\mumpsc\bin            executables and scripts
c:\mumpsc\lib            object libraries
c:\mumpsc\include	header files
c:\mumpsc\doc            documentation
c:\mumpsc\src            source code

Do not enable the optimization switch /O2 or other
values that optimize for speed as they have caused
problems with pattern matching.

