----------------------------------------- M2P Version 1.00 ----------------------------------------- Modula-2 Preprocessor Finished Tool List Category Text Processing Programming utility Keywords portability, preprocessing Location ab20.larc.nasa.gov, /incoming/amiga/languages/modula2/M2P.lzh Author Dennis Brueni, brueni@csgrad.cs.vt.edu Dependencies Currently only available for AmigaDOS Compilers under either TDI or M2Sprint Modula-2 Requires usual Amiga include modules for the WorkBench Startup code, fetching Command line parameters, Accessing AmigaDOS... Works under WB 1.3, not yet tested under 2.0, but I don't anticipate any problems. QC Status 5 weeks in development, maybe has a few minor obscure bugs. I have been using it to maintain its own source and several other modules for the past three weeks, and it has worked well. Runs reasonably fast, a lot of time was spent on optimization. Requires about 40K statically at run-time, but will allocate memory dynamically in 4K segments for the symbol table and to record macros. The size of the executable file is under 30K. Full Description Refer to the documentation included in the archive. (both LaTeX and postscript sources available) To be brief, M2P accepts the following major preprocessor command forms: @IF THEN @ELSIF @ELSE /* structured just like M2's IF */ @END @DEFINE @UNDEF @MACRO @ENDM @INCLUDE @ @LINE, @SPACE, @STRIP, @NOSTRIP, @@ always refers to any M2P source code. The above statements can be combined and nested in a very regular, rather unrestricted fashion. That is, you may nest IF statements, or define macros within macros, ... It is also free format. A (perhaps) typical example of M2P's use would the following debugging code. @MACRO Aloha(procname,greeting,indent) @IF DEBUG THEN /* assumes that 'i' is available */ @IF indent THEN FOR i:=1 TO @indent DO InOut.Write(' '); END; @END InOut.WriteString(@greeting); InOut.WriteString(@procname); @END @ENDM @MACRO Enter(procname,indent) Aloha(@procname,'Entering: ' @IF indent THEN ,@indent @END ) @ENDM @MACRO Leave(procname,indent) Aloha(@procname,'Leave: ' @IF indent THEN ,@indent @END ) @ENDM PROCEDURE totrace; BEGIN @Enter('totrace') . . @Leave('totrace') END totrace; Other Notes I have made every attempt to make the code for M2P portable. Porting it to another platform should not take more than two or three days. The source code to M2P also includes some perhaps useful modules for managing symbol tables, linked lists of symbols, Input and Output, Strings (a M2 implementation of the 4th draft standard Modula-2 strings library), lexical analysis, Resource tracking Storage, Parsing command line parameters, Workbench tool types, and Managing Environment variables. This source code also exemplifies how to put M2P to use. The distribution M2P.lzh includes the following: M2P - AmigaDOS executable compiled w/ M2Sprint M2P.tex - LaTeX documentation for M2P M2P.ps - postscript documentation (source) - source directory (mods) - preprocessed source (for porting)