Merge modula-2 front end onto gcc.

This commit merges the devel/modula2 into master.
The libraries reside in libgm2, the compiler in gcc/m2
and the testsuite in gcc/testsuite/gm2.

ChangeLog:

	* configure.ac (target_libraries): Add target-libgm2.
	Add NCN_STRICT_CHECK_TARGET_TOOLS entry for gm2.
	Add GCC_TARGET_TOOL entry for gm2.  (compare_exclusions)
	add gcc/m2/gm2-compiler/M2Version,
	gcc/m2/gm2-compiler-boot/SYSTEM and gcc/m2/gm2version.
	* Makefile.def (target_modules): Add libgm2.  (flags_to_pass)
	Add GM2_FOR_TARGET, GM2FLAGS_FOR_TARGET.  (dependencies) Add
	all-target-libgm2 and on=all-target-libatomic.  (languages)
	Add entry for language=m2 with gcc-check-target=check-m2
	and lib-check-target=check-target-libgm2.
	* Makefile.tpl (BUILD_EXPORTS): Add definition for GM2
	and GM2FLAGS.  (HOST_EXPORTS) Add definition for GM2.
	(BASE_TARGET_EXPORTS) Add definition for GM2.
	(GM2_FOR_BUILD) Defined.  (GM2FLAGS) Defined.
	(GM2_FOR_TARGET) Defined.  (GM2FLAGS_FOR_TARGET) Defined.
	(EXTRA_HOST_FLAGS) Defined.  (POSTSTAGE1_FLAGS_TO_PASS)
	Add GM2 and GM2_FOR_BUILD.  (EXTRA_TARGET_FLAGS) Add
	GM2 and GM2FLAGS.  (EXTRA_GCC_FLAGS) Add GM2_FOR_TARGET.
	* configure: (Rebuilt).
	* Makefile.in: (Rebuilt).

libgm2/ChangeLog:

	* Makefile.am: (New file).
	* autogen.sh: (New file).
	* config.h.in: (New file).
	* configure.ac: (New file).
	* libm2cor/KeyBoardLEDs.cc: (New file).
	* libm2cor/Makefile.am: (New file).
	* libm2iso/ChanConsts.h: (New file).
	* libm2iso/ErrnoCategory.cc: (New file).
	* libm2iso/Makefile.am: (New file).
	* libm2iso/RTco.cc: (New file).
	* libm2iso/m2rts.h: (New file).
	* libm2iso/wrapsock.c: (New file).
	* libm2iso/wraptime.c: (New file).
	* libm2log/Break.c: (New file).
	* libm2log/Makefile.am: (New file).
	* libm2min/Makefile.am: (New file).
	* libm2min/libc.c: (New file).
	* libm2pim/Makefile.am: (New file).
	* libm2pim/Selective.cc: (New file).
	* libm2pim/SysExceptions.cc: (New file).
	* libm2pim/UnixArgs.cc: (New file).
	* libm2pim/cgetopt.cc: (New file).
	* libm2pim/dtoa.cc: (New file).
	* libm2pim/errno.cc: (New file).
	* libm2pim/ldtoa.cc: (New file).
	* libm2pim/sckt.cc: (New file).
	* libm2pim/target.c: (New file).
	* libm2pim/termios.cc: (New file).
	* libm2pim/wrapc.c: (New file).
	* configure: (Rebuilt).
	* libm2log/Makefile.in: (Rebuilt).
	* libm2min/Makefile.in: (Rebuilt).
	* libm2cor/Makefile.in: (Rebuilt).
	* libm2pim/Makefile.in: (Rebuilt).
	* libm2iso/Makefile.in: (Rebuilt).

gcc/ChangeLog:

	* configure.ac (HAVE_PYTHON): Test for Python3 added.
	* dwarf2out.cc (gen_compile_unit_die): Check language_string
	and language to DW_LANG_Modula2.
	* doc/install.texi: Add m2 as a language.  (--disable-libgm2)
	Documented.  Add make check-m2 to testing selected tests.
	* doc/sourcebuild.texi (GM2): New prerequisite item.
	(Python3 modules) New item.  (libgm2) Added.
	(gcc/m2) Added.
	* configure: (Rebuilt).
	* config.in: (Rebuilt).

gcc/m2/ChangeLog:

	* COPYING.FDL: (New file).
	* COPYING.RUNTIME: (New file).
	* COPYING3: (New file).
	* COPYING3.LIB: (New file).
	* Make-lang.in: (New file).
	* Make-maintainer.in: (New file).
	* NEWS: (New file).
	* README: (New file).
	* config-lang.in: (New file).
	* config-make.in: (New file).
	* configure.ac: (New file).
	* gm2-compiler/CLexBuf.def: (New file).
	* gm2-compiler/CLexBuf.mod: (New file).
	* gm2-compiler/FifoQueue.def: (New file).
	* gm2-compiler/FifoQueue.mod: (New file).
	* gm2-compiler/Lists.def: (New file).
	* gm2-compiler/Lists.mod: (New file).
	* gm2-compiler/M2ALU.def: (New file).
	* gm2-compiler/M2ALU.mod: (New file).
	* gm2-compiler/M2AsmUtil.def: (New file).
	* gm2-compiler/M2AsmUtil.mod: (New file).
	* gm2-compiler/M2Base.def: (New file).
	* gm2-compiler/M2Base.mod: (New file).
	* gm2-compiler/M2BasicBlock.def: (New file).
	* gm2-compiler/M2BasicBlock.mod: (New file).
	* gm2-compiler/M2Batch.def: (New file).
	* gm2-compiler/M2Batch.mod: (New file).
	* gm2-compiler/M2Bitset.def: (New file).
	* gm2-compiler/M2Bitset.mod: (New file).
	* gm2-compiler/M2CaseList.def: (New file).
	* gm2-compiler/M2CaseList.mod: (New file).
	* gm2-compiler/M2Check.def: (New file).
	* gm2-compiler/M2Check.mod: (New file).
	* gm2-compiler/M2Code.def: (New file).
	* gm2-compiler/M2Code.mod: (New file).
	* gm2-compiler/M2ColorString.def: (New file).
	* gm2-compiler/M2ColorString.mod: (New file).
	* gm2-compiler/M2Comp.def: (New file).
	* gm2-compiler/M2Comp.mod: (New file).
	* gm2-compiler/M2Const.def: (New file).
	* gm2-compiler/M2Const.mod: (New file).
	* gm2-compiler/M2Debug.def: (New file).
	* gm2-compiler/M2Debug.mod: (New file).
	* gm2-compiler/M2DebugStack.def: (New file).
	* gm2-compiler/M2DebugStack.mod: (New file).
	* gm2-compiler/M2Defaults.def: (New file).
	* gm2-compiler/M2Defaults.mod: (New file).
	* gm2-compiler/M2DriverOptions.def: (New file).
	* gm2-compiler/M2DriverOptions.mod: (New file).
	* gm2-compiler/M2Emit.def: (New file).
	* gm2-compiler/M2Emit.mod: (New file).
	* gm2-compiler/M2Error.def: (New file).
	* gm2-compiler/M2Error.mod: (New file).
	* gm2-compiler/M2EvalSym.def: (New file).
	* gm2-compiler/M2FileName.def: (New file).
	* gm2-compiler/M2FileName.mod: (New file).
	* gm2-compiler/M2GCCDeclare.def: (New file).
	* gm2-compiler/M2GCCDeclare.mod: (New file).
	* gm2-compiler/M2GenGCC.def: (New file).
	* gm2-compiler/M2GenGCC.mod: (New file).
	* gm2-compiler/M2Graph.def: (New file).
	* gm2-compiler/M2Graph.mod: (New file).
	* gm2-compiler/M2Lex.def: (New file).
	* gm2-compiler/M2Lex.mod: (New file).
	* gm2-compiler/M2LexBuf.def: (New file).
	* gm2-compiler/M2LexBuf.mod: (New file).
	* gm2-compiler/M2MetaError.def: (New file).
	* gm2-compiler/M2MetaError.mod: (New file).
	* gm2-compiler/M2Optimize.def: (New file).
	* gm2-compiler/M2Optimize.mod: (New file).
	* gm2-compiler/M2Options.def: (New file).
	* gm2-compiler/M2Options.mod: (New file).
	* gm2-compiler/M2Pass.def: (New file).
	* gm2-compiler/M2Pass.mod: (New file).
	* gm2-compiler/M2Preprocess.def: (New file).
	* gm2-compiler/M2Preprocess.mod: (New file).
	* gm2-compiler/M2Printf.def: (New file).
	* gm2-compiler/M2Printf.mod: (New file).
	* gm2-compiler/M2Quads.def: (New file).
	* gm2-compiler/M2Quads.mod: (New file).
	* gm2-compiler/M2Quiet.def: (New file).
	* gm2-compiler/M2Quiet.mod: (New file).
	* gm2-compiler/M2Range.def: (New file).
	* gm2-compiler/M2Range.mod: (New file).
	* gm2-compiler/M2Reserved.def: (New file).
	* gm2-compiler/M2Reserved.mod: (New file).
	* gm2-compiler/M2SSA.def: (New file).
	* gm2-compiler/M2SSA.mod: (New file).
	* gm2-compiler/M2Scaffold.def: (New file).
	* gm2-compiler/M2Scaffold.mod: (New file).
	* gm2-compiler/M2Scope.def: (New file).
	* gm2-compiler/M2Scope.mod: (New file).
	* gm2-compiler/M2Search.def: (New file).
	* gm2-compiler/M2Search.mod: (New file).
	* gm2-compiler/M2Size.def: (New file).
	* gm2-compiler/M2Size.mod: (New file).
	* gm2-compiler/M2StackAddress.def: (New file).
	* gm2-compiler/M2StackAddress.mod: (New file).
	* gm2-compiler/M2StackWord.def: (New file).
	* gm2-compiler/M2StackWord.mod: (New file).
	* gm2-compiler/M2Students.def: (New file).
	* gm2-compiler/M2Students.mod: (New file).
	* gm2-compiler/M2Swig.def: (New file).
	* gm2-compiler/M2Swig.mod: (New file).
	* gm2-compiler/M2System.def: (New file).
	* gm2-compiler/M2System.mod: (New file).
	* gm2-compiler/M2Version.def: (New file).
	* gm2-compiler/NameKey.def: (New file).
	* gm2-compiler/NameKey.mod: (New file).
	* gm2-compiler/ObjectFiles.def: (New file).
	* gm2-compiler/ObjectFiles.mod: (New file).
	* gm2-compiler/Output.def: (New file).
	* gm2-compiler/Output.mod: (New file).
	* gm2-compiler/P0SymBuild.def: (New file).
	* gm2-compiler/P0SymBuild.mod: (New file).
	* gm2-compiler/P0SyntaxCheck.bnf: (New file).
	* gm2-compiler/P0SyntaxCheck.def: (New file).
	* gm2-compiler/P1Build.bnf: (New file).
	* gm2-compiler/P1Build.def: (New file).
	* gm2-compiler/P1SymBuild.def: (New file).
	* gm2-compiler/P1SymBuild.mod: (New file).
	* gm2-compiler/P2Build.bnf: (New file).
	* gm2-compiler/P2Build.def: (New file).
	* gm2-compiler/P2SymBuild.def: (New file).
	* gm2-compiler/P2SymBuild.mod: (New file).
	* gm2-compiler/P3Build.bnf: (New file).
	* gm2-compiler/P3Build.def: (New file).
	* gm2-compiler/P3SymBuild.def: (New file).
	* gm2-compiler/P3SymBuild.mod: (New file).
	* gm2-compiler/PCBuild.bnf: (New file).
	* gm2-compiler/PCBuild.def: (New file).
	* gm2-compiler/PCSymBuild.def: (New file).
	* gm2-compiler/PCSymBuild.mod: (New file).
	* gm2-compiler/PHBuild.bnf: (New file).
	* gm2-compiler/PHBuild.def: (New file).
	* gm2-compiler/README: (New file).
	* gm2-compiler/Sets.def: (New file).
	* gm2-compiler/Sets.mod: (New file).
	* gm2-compiler/SymbolConversion.def: (New file).
	* gm2-compiler/SymbolConversion.mod: (New file).
	* gm2-compiler/SymbolKey.def: (New file).
	* gm2-compiler/SymbolKey.mod: (New file).
	* gm2-compiler/SymbolTable.def: (New file).
	* gm2-compiler/SymbolTable.mod: (New file).
	* gm2-compiler/bnflex.def: (New file).
	* gm2-compiler/bnflex.mod: (New file).
	* gm2-compiler/cflex.def: (New file).
	* gm2-compiler/gm2.mod: (New file).
	* gm2-compiler/gm2lcc.mod: (New file).
	* gm2-compiler/gm2lgen.mod: (New file).
	* gm2-compiler/gm2lorder.mod: (New file).
	* gm2-compiler/m2flex.def: (New file).
	* gm2-compiler/ppg.mod: (New file).
	* gm2-gcc/README: (New file).
	* gm2-gcc/dynamicstrings.h: (New file).
	* gm2-gcc/gcc-consolidation.h: (New file).
	* gm2-gcc/init.cc: (New file).
	* gm2-gcc/init.def: (New file).
	* gm2-gcc/init.h: (New file).
	* gm2-gcc/m2assert.cc: (New file).
	* gm2-gcc/m2assert.h: (New file).
	* gm2-gcc/m2block.cc: (New file).
	* gm2-gcc/m2block.def: (New file).
	* gm2-gcc/m2block.h: (New file).
	* gm2-gcc/m2builtins.cc: (New file).
	* gm2-gcc/m2builtins.def: (New file).
	* gm2-gcc/m2builtins.h: (New file).
	* gm2-gcc/m2color.cc: (New file).
	* gm2-gcc/m2color.def: (New file).
	* gm2-gcc/m2color.h: (New file).
	* gm2-gcc/m2configure.cc: (New file).
	* gm2-gcc/m2configure.def: (New file).
	* gm2-gcc/m2configure.h: (New file).
	* gm2-gcc/m2convert.cc: (New file).
	* gm2-gcc/m2convert.def: (New file).
	* gm2-gcc/m2convert.h: (New file).
	* gm2-gcc/m2decl.cc: (New file).
	* gm2-gcc/m2decl.def: (New file).
	* gm2-gcc/m2decl.h: (New file).
	* gm2-gcc/m2except.cc: (New file).
	* gm2-gcc/m2except.def: (New file).
	* gm2-gcc/m2except.h: (New file).
	* gm2-gcc/m2expr.cc: (New file).
	* gm2-gcc/m2expr.def: (New file).
	* gm2-gcc/m2expr.h: (New file).
	* gm2-gcc/m2linemap.cc: (New file).
	* gm2-gcc/m2linemap.def: (New file).
	* gm2-gcc/m2linemap.h: (New file).
	* gm2-gcc/m2misc.cc: (New file).
	* gm2-gcc/m2misc.def: (New file).
	* gm2-gcc/m2misc.h: (New file).
	* gm2-gcc/m2options.h: (New file).
	* gm2-gcc/m2range.h: (New file).
	* gm2-gcc/m2search.h: (New file).
	* gm2-gcc/m2statement.cc: (New file).
	* gm2-gcc/m2statement.def: (New file).
	* gm2-gcc/m2statement.h: (New file).
	* gm2-gcc/m2top.cc: (New file).
	* gm2-gcc/m2top.def: (New file).
	* gm2-gcc/m2top.h: (New file).
	* gm2-gcc/m2tree.cc: (New file).
	* gm2-gcc/m2tree.def: (New file).
	* gm2-gcc/m2tree.h: (New file).
	* gm2-gcc/m2treelib.cc: (New file).
	* gm2-gcc/m2treelib.def: (New file).
	* gm2-gcc/m2treelib.h: (New file).
	* gm2-gcc/m2type.cc: (New file).
	* gm2-gcc/m2type.def: (New file).
	* gm2-gcc/m2type.h: (New file).
	* gm2-gcc/rtegraph.cc: (New file).
	* gm2-gcc/rtegraph.h: (New file).
	* gm2-ici/M2Emit.mod: (New file).
	* gm2-ici/README: (New file).
	* gm2-ici/m2linemap.c: (New file).
	* gm2-internals.texi: (New file).
	* gm2-lang.cc: (New file).
	* gm2-lang.h: (New file).
	* gm2-libiberty/README: (New file).
	* gm2-libiberty/choosetemp.def: (New file).
	* gm2-libiberty/pexecute.def: (New file).
	* gm2-libs-ch/M2LINK.c: (New file).
	* gm2-libs-ch/README: (New file).
	* gm2-libs-ch/RTcodummy.c: (New file).
	* gm2-libs-ch/RTintdummy.c: (New file).
	* gm2-libs-ch/Selective.c: (New file).
	* gm2-libs-ch/SysExceptions.c: (New file).
	* gm2-libs-ch/UnixArgs.cc: (New file).
	* gm2-libs-ch/cgetopt.c: (New file).
	* gm2-libs-ch/choosetemp.c: (New file).
	* gm2-libs-ch/dtoa.cc: (New file).
	* gm2-libs-ch/errno.c: (New file).
	* gm2-libs-ch/host.c: (New file).
	* gm2-libs-ch/ldtoa.cc: (New file).
	* gm2-libs-ch/m2rts.h: (New file).
	* gm2-libs-ch/termios.c: (New file).
	* gm2-libs-ch/tools.c: (New file).
	* gm2-libs-ch/wrapc.c: (New file).
	* gm2-libs-ch/xlibc.c: (New file).
	* gm2-libs-coroutines/Debug.def: (New file).
	* gm2-libs-coroutines/Debug.mod: (New file).
	* gm2-libs-coroutines/Executive.def: (New file).
	* gm2-libs-coroutines/Executive.mod: (New file).
	* gm2-libs-coroutines/KeyBoardLEDs.def: (New file).
	* gm2-libs-coroutines/README.texi: (New file).
	* gm2-libs-coroutines/SYSTEM.def: (New file).
	* gm2-libs-coroutines/SYSTEM.mod: (New file).
	* gm2-libs-coroutines/TimerHandler.def: (New file).
	* gm2-libs-coroutines/TimerHandler.mod: (New file).
	* gm2-libs-iso/COROUTINES.def: (New file).
	* gm2-libs-iso/COROUTINES.mod: (New file).
	* gm2-libs-iso/ChanConsts.def: (New file).
	* gm2-libs-iso/ChanConsts.h: (New file).
	* gm2-libs-iso/ChanConsts.mod: (New file).
	* gm2-libs-iso/CharClass.def: (New file).
	* gm2-libs-iso/CharClass.mod: (New file).
	* gm2-libs-iso/ClientSocket.def: (New file).
	* gm2-libs-iso/ClientSocket.mod: (New file).
	* gm2-libs-iso/ComplexMath.def: (New file).
	* gm2-libs-iso/ComplexMath.mod: (New file).
	* gm2-libs-iso/ConvStringLong.def: (New file).
	* gm2-libs-iso/ConvStringLong.mod: (New file).
	* gm2-libs-iso/ConvStringReal.def: (New file).
	* gm2-libs-iso/ConvStringReal.mod: (New file).
	* gm2-libs-iso/ConvTypes.def: (New file).
	* gm2-libs-iso/ConvTypes.mod: (New file).
	* gm2-libs-iso/EXCEPTIONS.def: (New file).
	* gm2-libs-iso/EXCEPTIONS.mod: (New file).
	* gm2-libs-iso/ErrnoCategory.def: (New file).
	* gm2-libs-iso/GeneralUserExceptions.def: (New file).
	* gm2-libs-iso/GeneralUserExceptions.mod: (New file).
	* gm2-libs-iso/IOChan.def: (New file).
	* gm2-libs-iso/IOChan.mod: (New file).
	* gm2-libs-iso/IOConsts.def: (New file).
	* gm2-libs-iso/IOConsts.mod: (New file).
	* gm2-libs-iso/IOLink.def: (New file).
	* gm2-libs-iso/IOLink.mod: (New file).
	* gm2-libs-iso/IOResult.def: (New file).
	* gm2-libs-iso/IOResult.mod: (New file).
	* gm2-libs-iso/LongComplexMath.def: (New file).
	* gm2-libs-iso/LongComplexMath.mod: (New file).
	* gm2-libs-iso/LongConv.def: (New file).
	* gm2-libs-iso/LongConv.mod: (New file).
	* gm2-libs-iso/LongIO.def: (New file).
	* gm2-libs-iso/LongIO.mod: (New file).
	* gm2-libs-iso/LongMath.def: (New file).
	* gm2-libs-iso/LongMath.mod: (New file).
	* gm2-libs-iso/LongStr.def: (New file).
	* gm2-libs-iso/LongStr.mod: (New file).
	* gm2-libs-iso/LongWholeIO.def: (New file).
	* gm2-libs-iso/LongWholeIO.mod: (New file).
	* gm2-libs-iso/LowLong.def: (New file).
	* gm2-libs-iso/LowLong.mod: (New file).
	* gm2-libs-iso/LowReal.def: (New file).
	* gm2-libs-iso/LowReal.mod: (New file).
	* gm2-libs-iso/LowShort.def: (New file).
	* gm2-libs-iso/LowShort.mod: (New file).
	* gm2-libs-iso/M2EXCEPTION.def: (New file).
	* gm2-libs-iso/M2EXCEPTION.mod: (New file).
	* gm2-libs-iso/M2RTS.def: (New file).
	* gm2-libs-iso/M2RTS.mod: (New file).
	* gm2-libs-iso/MemStream.def: (New file).
	* gm2-libs-iso/MemStream.mod: (New file).
	* gm2-libs-iso/Preemptive.def: (New file).
	* gm2-libs-iso/Preemptive.mod: (New file).
	* gm2-libs-iso/Processes.def: (New file).
	* gm2-libs-iso/Processes.mod: (New file).
	* gm2-libs-iso/ProgramArgs.def: (New file).
	* gm2-libs-iso/ProgramArgs.mod: (New file).
	* gm2-libs-iso/README.texi: (New file).
	* gm2-libs-iso/RTco.def: (New file).
	* gm2-libs-iso/RTdata.def: (New file).
	* gm2-libs-iso/RTdata.mod: (New file).
	* gm2-libs-iso/RTentity.def: (New file).
	* gm2-libs-iso/RTentity.mod: (New file).
	* gm2-libs-iso/RTfio.def: (New file).
	* gm2-libs-iso/RTfio.mod: (New file).
	* gm2-libs-iso/RTgen.def: (New file).
	* gm2-libs-iso/RTgen.mod: (New file).
	* gm2-libs-iso/RTgenif.def: (New file).
	* gm2-libs-iso/RTgenif.mod: (New file).
	* gm2-libs-iso/RTio.def: (New file).
	* gm2-libs-iso/RTio.mod: (New file).
	* gm2-libs-iso/RandomNumber.def: (New file).
	* gm2-libs-iso/RandomNumber.mod: (New file).
	* gm2-libs-iso/RawIO.def: (New file).
	* gm2-libs-iso/RawIO.mod: (New file).
	* gm2-libs-iso/RealConv.def: (New file).
	* gm2-libs-iso/RealConv.mod: (New file).
	* gm2-libs-iso/RealIO.def: (New file).
	* gm2-libs-iso/RealIO.mod: (New file).
	* gm2-libs-iso/RealMath.def: (New file).
	* gm2-libs-iso/RealMath.mod: (New file).
	* gm2-libs-iso/RealStr.def: (New file).
	* gm2-libs-iso/RealStr.mod: (New file).
	* gm2-libs-iso/RndFile.def: (New file).
	* gm2-libs-iso/RndFile.mod: (New file).
	* gm2-libs-iso/SIOResult.def: (New file).
	* gm2-libs-iso/SIOResult.mod: (New file).
	* gm2-libs-iso/SLongIO.def: (New file).
	* gm2-libs-iso/SLongIO.mod: (New file).
	* gm2-libs-iso/SLongWholeIO.def: (New file).
	* gm2-libs-iso/SLongWholeIO.mod: (New file).
	* gm2-libs-iso/SRawIO.def: (New file).
	* gm2-libs-iso/SRawIO.mod: (New file).
	* gm2-libs-iso/SRealIO.def: (New file).
	* gm2-libs-iso/SRealIO.mod: (New file).
	* gm2-libs-iso/SShortIO.def: (New file).
	* gm2-libs-iso/SShortIO.mod: (New file).
	* gm2-libs-iso/SShortWholeIO.def: (New file).
	* gm2-libs-iso/SShortWholeIO.mod: (New file).
	* gm2-libs-iso/STextIO.def: (New file).
	* gm2-libs-iso/STextIO.mod: (New file).
	* gm2-libs-iso/SWholeIO.def: (New file).
	* gm2-libs-iso/SWholeIO.mod: (New file).
	* gm2-libs-iso/SYSTEM.def: (New file).
	* gm2-libs-iso/SYSTEM.mod: (New file).
	* gm2-libs-iso/Semaphores.def: (New file).
	* gm2-libs-iso/Semaphores.mod: (New file).
	* gm2-libs-iso/SeqFile.def: (New file).
	* gm2-libs-iso/SeqFile.mod: (New file).
	* gm2-libs-iso/ShortComplexMath.def: (New file).
	* gm2-libs-iso/ShortComplexMath.mod: (New file).
	* gm2-libs-iso/ShortIO.def: (New file).
	* gm2-libs-iso/ShortIO.mod: (New file).
	* gm2-libs-iso/ShortWholeIO.def: (New file).
	* gm2-libs-iso/ShortWholeIO.mod: (New file).
	* gm2-libs-iso/SimpleCipher.def: (New file).
	* gm2-libs-iso/SimpleCipher.mod: (New file).
	* gm2-libs-iso/StdChans.def: (New file).
	* gm2-libs-iso/StdChans.mod: (New file).
	* gm2-libs-iso/Storage.def: (New file).
	* gm2-libs-iso/Storage.mod: (New file).
	* gm2-libs-iso/StreamFile.def: (New file).
	* gm2-libs-iso/StreamFile.mod: (New file).
	* gm2-libs-iso/StringChan.def: (New file).
	* gm2-libs-iso/StringChan.mod: (New file).
	* gm2-libs-iso/Strings.def: (New file).
	* gm2-libs-iso/Strings.mod: (New file).
	* gm2-libs-iso/SysClock.def: (New file).
	* gm2-libs-iso/SysClock.mod: (New file).
	* gm2-libs-iso/TERMINATION.def: (New file).
	* gm2-libs-iso/TERMINATION.mod: (New file).
	* gm2-libs-iso/TermFile.def: (New file).
	* gm2-libs-iso/TermFile.mod: (New file).
	* gm2-libs-iso/TextIO.def: (New file).
	* gm2-libs-iso/TextIO.mod: (New file).
	* gm2-libs-iso/WholeConv.def: (New file).
	* gm2-libs-iso/WholeConv.mod: (New file).
	* gm2-libs-iso/WholeIO.def: (New file).
	* gm2-libs-iso/WholeIO.mod: (New file).
	* gm2-libs-iso/WholeStr.def: (New file).
	* gm2-libs-iso/WholeStr.mod: (New file).
	* gm2-libs-iso/wrapsock.c: (New file).
	* gm2-libs-iso/wrapsock.def: (New file).
	* gm2-libs-iso/wraptime.c: (New file).
	* gm2-libs-iso/wraptime.def: (New file).
	* gm2-libs-min/M2RTS.def: (New file).
	* gm2-libs-min/M2RTS.mod: (New file).
	* gm2-libs-min/SYSTEM.def: (New file).
	* gm2-libs-min/SYSTEM.mod: (New file).
	* gm2-libs-min/libc.c: (New file).
	* gm2-libs-min/libc.def: (New file).
	* gm2-libs-pim/BitBlockOps.def: (New file).
	* gm2-libs-pim/BitBlockOps.mod: (New file).
	* gm2-libs-pim/BitByteOps.def: (New file).
	* gm2-libs-pim/BitByteOps.mod: (New file).
	* gm2-libs-pim/BitWordOps.def: (New file).
	* gm2-libs-pim/BitWordOps.mod: (New file).
	* gm2-libs-pim/BlockOps.def: (New file).
	* gm2-libs-pim/BlockOps.mod: (New file).
	* gm2-libs-pim/Break.c: (New file).
	* gm2-libs-pim/Break.def: (New file).
	* gm2-libs-pim/CardinalIO.def: (New file).
	* gm2-libs-pim/CardinalIO.mod: (New file).
	* gm2-libs-pim/Conversions.def: (New file).
	* gm2-libs-pim/Conversions.mod: (New file).
	* gm2-libs-pim/DebugPMD.def: (New file).
	* gm2-libs-pim/DebugPMD.mod: (New file).
	* gm2-libs-pim/DebugTrace.def: (New file).
	* gm2-libs-pim/DebugTrace.mod: (New file).
	* gm2-libs-pim/Delay.def: (New file).
	* gm2-libs-pim/Delay.mod: (New file).
	* gm2-libs-pim/Display.def: (New file).
	* gm2-libs-pim/Display.mod: (New file).
	* gm2-libs-pim/ErrorCode.def: (New file).
	* gm2-libs-pim/ErrorCode.mod: (New file).
	* gm2-libs-pim/FileSystem.def: (New file).
	* gm2-libs-pim/FileSystem.mod: (New file).
	* gm2-libs-pim/FloatingUtilities.def: (New file).
	* gm2-libs-pim/FloatingUtilities.mod: (New file).
	* gm2-libs-pim/InOut.def: (New file).
	* gm2-libs-pim/InOut.mod: (New file).
	* gm2-libs-pim/Keyboard.def: (New file).
	* gm2-libs-pim/Keyboard.mod: (New file).
	* gm2-libs-pim/LongIO.def: (New file).
	* gm2-libs-pim/LongIO.mod: (New file).
	* gm2-libs-pim/NumberConversion.def: (New file).
	* gm2-libs-pim/NumberConversion.mod: (New file).
	* gm2-libs-pim/README.texi: (New file).
	* gm2-libs-pim/Random.def: (New file).
	* gm2-libs-pim/Random.mod: (New file).
	* gm2-libs-pim/RealConversions.def: (New file).
	* gm2-libs-pim/RealConversions.mod: (New file).
	* gm2-libs-pim/RealInOut.def: (New file).
	* gm2-libs-pim/RealInOut.mod: (New file).
	* gm2-libs-pim/Strings.def: (New file).
	* gm2-libs-pim/Strings.mod: (New file).
	* gm2-libs-pim/Termbase.def: (New file).
	* gm2-libs-pim/Termbase.mod: (New file).
	* gm2-libs-pim/Terminal.def: (New file).
	* gm2-libs-pim/Terminal.mod: (New file).
	* gm2-libs-pim/TimeDate.def: (New file).
	* gm2-libs-pim/TimeDate.mod: (New file).
	* gm2-libs/ASCII.def: (New file).
	* gm2-libs/ASCII.mod: (New file).
	* gm2-libs/Args.def: (New file).
	* gm2-libs/Args.mod: (New file).
	* gm2-libs/Assertion.def: (New file).
	* gm2-libs/Assertion.mod: (New file).
	* gm2-libs/Break.def: (New file).
	* gm2-libs/Break.mod: (New file).
	* gm2-libs/Builtins.def: (New file).
	* gm2-libs/Builtins.mod: (New file).
	* gm2-libs/COROUTINES.def: (New file).
	* gm2-libs/COROUTINES.mod: (New file).
	* gm2-libs/CmdArgs.def: (New file).
	* gm2-libs/CmdArgs.mod: (New file).
	* gm2-libs/Debug.def: (New file).
	* gm2-libs/Debug.mod: (New file).
	* gm2-libs/DynamicStrings.def: (New file).
	* gm2-libs/DynamicStrings.mod: (New file).
	* gm2-libs/Environment.def: (New file).
	* gm2-libs/Environment.mod: (New file).
	* gm2-libs/FIO.def: (New file).
	* gm2-libs/FIO.mod: (New file).
	* gm2-libs/FormatStrings.def: (New file).
	* gm2-libs/FormatStrings.mod: (New file).
	* gm2-libs/FpuIO.def: (New file).
	* gm2-libs/FpuIO.mod: (New file).
	* gm2-libs/GetOpt.def: (New file).
	* gm2-libs/GetOpt.mod: (New file).
	* gm2-libs/IO.def: (New file).
	* gm2-libs/IO.mod: (New file).
	* gm2-libs/Indexing.def: (New file).
	* gm2-libs/Indexing.mod: (New file).
	* gm2-libs/LMathLib0.def: (New file).
	* gm2-libs/LMathLib0.mod: (New file).
	* gm2-libs/LegacyReal.def: (New file).
	* gm2-libs/LegacyReal.mod: (New file).
	* gm2-libs/M2Dependent.def: (New file).
	* gm2-libs/M2Dependent.mod: (New file).
	* gm2-libs/M2EXCEPTION.def: (New file).
	* gm2-libs/M2EXCEPTION.mod: (New file).
	* gm2-libs/M2LINK.def: (New file).
	* gm2-libs/M2RTS.def: (New file).
	* gm2-libs/M2RTS.mod: (New file).
	* gm2-libs/MathLib0.def: (New file).
	* gm2-libs/MathLib0.mod: (New file).
	* gm2-libs/MemUtils.def: (New file).
	* gm2-libs/MemUtils.mod: (New file).
	* gm2-libs/NumberIO.def: (New file).
	* gm2-libs/NumberIO.mod: (New file).
	* gm2-libs/OptLib.def: (New file).
	* gm2-libs/OptLib.mod: (New file).
	* gm2-libs/PushBackInput.def: (New file).
	* gm2-libs/PushBackInput.mod: (New file).
	* gm2-libs/README.texi: (New file).
	* gm2-libs/RTExceptions.def: (New file).
	* gm2-libs/RTExceptions.mod: (New file).
	* gm2-libs/RTint.def: (New file).
	* gm2-libs/RTint.mod: (New file).
	* gm2-libs/SArgs.def: (New file).
	* gm2-libs/SArgs.mod: (New file).
	* gm2-libs/SCmdArgs.def: (New file).
	* gm2-libs/SCmdArgs.mod: (New file).
	* gm2-libs/SEnvironment.def: (New file).
	* gm2-libs/SEnvironment.mod: (New file).
	* gm2-libs/SFIO.def: (New file).
	* gm2-libs/SFIO.mod: (New file).
	* gm2-libs/SMathLib0.def: (New file).
	* gm2-libs/SMathLib0.mod: (New file).
	* gm2-libs/SYSTEM.def: (New file).
	* gm2-libs/SYSTEM.mod: (New file).
	* gm2-libs/Scan.def: (New file).
	* gm2-libs/Scan.mod: (New file).
	* gm2-libs/Selective.def: (New file).
	* gm2-libs/StdIO.def: (New file).
	* gm2-libs/StdIO.mod: (New file).
	* gm2-libs/Storage.def: (New file).
	* gm2-libs/Storage.mod: (New file).
	* gm2-libs/StrCase.def: (New file).
	* gm2-libs/StrCase.mod: (New file).
	* gm2-libs/StrIO.def: (New file).
	* gm2-libs/StrIO.mod: (New file).
	* gm2-libs/StrLib.def: (New file).
	* gm2-libs/StrLib.mod: (New file).
	* gm2-libs/StringConvert.def: (New file).
	* gm2-libs/StringConvert.mod: (New file).
	* gm2-libs/SysExceptions.def: (New file).
	* gm2-libs/SysStorage.def: (New file).
	* gm2-libs/SysStorage.mod: (New file).
	* gm2-libs/TimeString.def: (New file).
	* gm2-libs/TimeString.mod: (New file).
	* gm2-libs/UnixArgs.def: (New file).
	* gm2-libs/cbuiltin.def: (New file).
	* gm2-libs/cgetopt.def: (New file).
	* gm2-libs/config-host: (New file).
	* gm2-libs/config-host.in: (New file).
	* gm2-libs/cxxabi.def: (New file).
	* gm2-libs/dtoa.def: (New file).
	* gm2-libs/errno.def: (New file).
	* gm2-libs/gdbif.def: (New file).
	* gm2-libs/gdbif.mod: (New file).
	* gm2-libs/gm2-libs-host.h.in: (New file).
	* gm2-libs/ldtoa.def: (New file).
	* gm2-libs/libc.def: (New file).
	* gm2-libs/libm.def: (New file).
	* gm2-libs/sckt.def: (New file).
	* gm2-libs/termios.def: (New file).
	* gm2-libs/wrapc.def: (New file).
	* gm2config.h.in: (New file).
	* gm2spec.cc: (New file).
	* gm2version.h: (New file).
	* init/README: (New file).
	* init/mcinit: (New file).
	* init/ppginit: (New file).
	* lang-specs.h: (New file).
	* lang.opt: (New file).
	* m2-tree.def: (New file).
	* m2-tree.h: (New file).
	* m2.flex: (New file).
	* m2pp.cc: (New file).
	* m2pp.h: (New file).
	* mc-boot-ch/GBuiltins.c: (New file).
	* mc-boot-ch/GM2LINK.c: (New file).
	* mc-boot-ch/GRTco.c: (New file).
	* mc-boot-ch/GSYSTEM.c: (New file).
	* mc-boot-ch/GSelective.c: (New file).
	* mc-boot-ch/GSysExceptions.c: (New file).
	* mc-boot-ch/GUnixArgs.cc: (New file).
	* mc-boot-ch/Gabort.c: (New file).
	* mc-boot-ch/Gcbuiltin.c: (New file).
	* mc-boot-ch/Gdtoa.c: (New file).
	* mc-boot-ch/Gerrno.c: (New file).
	* mc-boot-ch/Gldtoa.c: (New file).
	* mc-boot-ch/Glibc.c: (New file).
	* mc-boot-ch/Glibm.c: (New file).
	* mc-boot-ch/Gmcrts.c: (New file).
	* mc-boot-ch/Gmcrts.h: (New file).
	* mc-boot-ch/Gnetwork.h: (New file).
	* mc-boot-ch/Gtermios.cc: (New file).
	* mc-boot-ch/Gwrapc.c: (New file).
	* mc-boot-ch/README: (New file).
	* mc-boot-ch/m2rts.h: (New file).
	* mc-boot-ch/network.c: (New file).
	* mc-boot/GASCII.c: (New file).
	* mc-boot/GASCII.h: (New file).
	* mc-boot/GArgs.c: (New file).
	* mc-boot/GArgs.h: (New file).
	* mc-boot/GAssertion.c: (New file).
	* mc-boot/GAssertion.h: (New file).
	* mc-boot/GBreak.c: (New file).
	* mc-boot/GBreak.h: (New file).
	* mc-boot/GCOROUTINES.h: (New file).
	* mc-boot/GCmdArgs.c: (New file).
	* mc-boot/GCmdArgs.h: (New file).
	* mc-boot/GDebug.c: (New file).
	* mc-boot/GDebug.h: (New file).
	* mc-boot/GDynamicStrings.c: (New file).
	* mc-boot/GDynamicStrings.h: (New file).
	* mc-boot/GEnvironment.c: (New file).
	* mc-boot/GEnvironment.h: (New file).
	* mc-boot/GFIO.c: (New file).
	* mc-boot/GFIO.h: (New file).
	* mc-boot/GFormatStrings.c: (New file).
	* mc-boot/GFormatStrings.h: (New file).
	* mc-boot/GFpuIO.c: (New file).
	* mc-boot/GFpuIO.h: (New file).
	* mc-boot/GIO.c: (New file).
	* mc-boot/GIO.h: (New file).
	* mc-boot/GIndexing.c: (New file).
	* mc-boot/GIndexing.h: (New file).
	* mc-boot/GM2Dependent.c: (New file).
	* mc-boot/GM2Dependent.h: (New file).
	* mc-boot/GM2EXCEPTION.c: (New file).
	* mc-boot/GM2EXCEPTION.h: (New file).
	* mc-boot/GM2LINK.h: (New file).
	* mc-boot/GM2RTS.c: (New file).
	* mc-boot/GM2RTS.h: (New file).
	* mc-boot/GMemUtils.c: (New file).
	* mc-boot/GMemUtils.h: (New file).
	* mc-boot/GNumberIO.c: (New file).
	* mc-boot/GNumberIO.h: (New file).
	* mc-boot/GPushBackInput.c: (New file).
	* mc-boot/GPushBackInput.h: (New file).
	* mc-boot/GRTExceptions.c: (New file).
	* mc-boot/GRTExceptions.h: (New file).
	* mc-boot/GRTco.h: (New file).
	* mc-boot/GRTint.c: (New file).
	* mc-boot/GRTint.h: (New file).
	* mc-boot/GSArgs.c: (New file).
	* mc-boot/GSArgs.h: (New file).
	* mc-boot/GSFIO.c: (New file).
	* mc-boot/GSFIO.h: (New file).
	* mc-boot/GSYSTEM.h: (New file).
	* mc-boot/GSelective.h: (New file).
	* mc-boot/GStdIO.c: (New file).
	* mc-boot/GStdIO.h: (New file).
	* mc-boot/GStorage.c: (New file).
	* mc-boot/GStorage.h: (New file).
	* mc-boot/GStrCase.c: (New file).
	* mc-boot/GStrCase.h: (New file).
	* mc-boot/GStrIO.c: (New file).
	* mc-boot/GStrIO.h: (New file).
	* mc-boot/GStrLib.c: (New file).
	* mc-boot/GStrLib.h: (New file).
	* mc-boot/GStringConvert.c: (New file).
	* mc-boot/GStringConvert.h: (New file).
	* mc-boot/GSysExceptions.h: (New file).
	* mc-boot/GSysStorage.c: (New file).
	* mc-boot/GSysStorage.h: (New file).
	* mc-boot/GTimeString.c: (New file).
	* mc-boot/GTimeString.h: (New file).
	* mc-boot/GUnixArgs.h: (New file).
	* mc-boot/Galists.c: (New file).
	* mc-boot/Galists.h: (New file).
	* mc-boot/Gdecl.c: (New file).
	* mc-boot/Gdecl.h: (New file).
	* mc-boot/Gdtoa.h: (New file).
	* mc-boot/Gerrno.h: (New file).
	* mc-boot/Gkeyc.c: (New file).
	* mc-boot/Gkeyc.h: (New file).
	* mc-boot/Gldtoa.h: (New file).
	* mc-boot/Glibc.h: (New file).
	* mc-boot/Glibm.h: (New file).
	* mc-boot/Glists.c: (New file).
	* mc-boot/Glists.h: (New file).
	* mc-boot/GmcComment.c: (New file).
	* mc-boot/GmcComment.h: (New file).
	* mc-boot/GmcComp.c: (New file).
	* mc-boot/GmcComp.h: (New file).
	* mc-boot/GmcDebug.c: (New file).
	* mc-boot/GmcDebug.h: (New file).
	* mc-boot/GmcError.c: (New file).
	* mc-boot/GmcError.h: (New file).
	* mc-boot/GmcFileName.c: (New file).
	* mc-boot/GmcFileName.h: (New file).
	* mc-boot/GmcLexBuf.c: (New file).
	* mc-boot/GmcLexBuf.h: (New file).
	* mc-boot/GmcMetaError.c: (New file).
	* mc-boot/GmcMetaError.h: (New file).
	* mc-boot/GmcOptions.c: (New file).
	* mc-boot/GmcOptions.h: (New file).
	* mc-boot/GmcPreprocess.c: (New file).
	* mc-boot/GmcPreprocess.h: (New file).
	* mc-boot/GmcPretty.c: (New file).
	* mc-boot/GmcPretty.h: (New file).
	* mc-boot/GmcPrintf.c: (New file).
	* mc-boot/GmcPrintf.h: (New file).
	* mc-boot/GmcQuiet.c: (New file).
	* mc-boot/GmcQuiet.h: (New file).
	* mc-boot/GmcReserved.c: (New file).
	* mc-boot/GmcReserved.h: (New file).
	* mc-boot/GmcSearch.c: (New file).
	* mc-boot/GmcSearch.h: (New file).
	* mc-boot/GmcStack.c: (New file).
	* mc-boot/GmcStack.h: (New file).
	* mc-boot/GmcStream.c: (New file).
	* mc-boot/GmcStream.h: (New file).
	* mc-boot/Gmcflex.h: (New file).
	* mc-boot/Gmcp1.c: (New file).
	* mc-boot/Gmcp1.h: (New file).
	* mc-boot/Gmcp2.c: (New file).
	* mc-boot/Gmcp2.h: (New file).
	* mc-boot/Gmcp3.c: (New file).
	* mc-boot/Gmcp3.h: (New file).
	* mc-boot/Gmcp4.c: (New file).
	* mc-boot/Gmcp4.h: (New file).
	* mc-boot/Gmcp5.c: (New file).
	* mc-boot/Gmcp5.h: (New file).
	* mc-boot/GnameKey.c: (New file).
	* mc-boot/GnameKey.h: (New file).
	* mc-boot/Gpth.h: (New file).
	* mc-boot/GsymbolKey.c: (New file).
	* mc-boot/GsymbolKey.h: (New file).
	* mc-boot/Gtermios.h: (New file).
	* mc-boot/Gtop.c: (New file).
	* mc-boot/Gvarargs.c: (New file).
	* mc-boot/Gvarargs.h: (New file).
	* mc-boot/Gwlists.c: (New file).
	* mc-boot/Gwlists.h: (New file).
	* mc-boot/Gwrapc.h: (New file).
	* mc-boot/README: (New file).
	* mc/Indexing.def: (New file).
	* mc/Indexing.mod: (New file).
	* mc/README: (New file).
	* mc/alists.def: (New file).
	* mc/alists.mod: (New file).
	* mc/decl.def: (New file).
	* mc/decl.mod: (New file).
	* mc/decl.mod-extra: (New file).
	* mc/keyc.def: (New file).
	* mc/keyc.mod: (New file).
	* mc/lists.def: (New file).
	* mc/lists.mod: (New file).
	* mc/m2flex.def: (New file).
	* mc/mc.flex: (New file).
	* mc/mcComment.def: (New file).
	* mc/mcComment.h: (New file).
	* mc/mcComment.mod: (New file).
	* mc/mcComp.def: (New file).
	* mc/mcComp.mod: (New file).
	* mc/mcDebug.def: (New file).
	* mc/mcDebug.mod: (New file).
	* mc/mcError.def: (New file).
	* mc/mcError.mod: (New file).
	* mc/mcFileName.def: (New file).
	* mc/mcFileName.mod: (New file).
	* mc/mcLexBuf.def: (New file).
	* mc/mcLexBuf.h: (New file).
	* mc/mcLexBuf.mod: (New file).
	* mc/mcMetaError.def: (New file).
	* mc/mcMetaError.mod: (New file).
	* mc/mcOptions.def: (New file).
	* mc/mcOptions.mod: (New file).
	* mc/mcPreprocess.def: (New file).
	* mc/mcPreprocess.mod: (New file).
	* mc/mcPretty.def: (New file).
	* mc/mcPretty.mod: (New file).
	* mc/mcPrintf.def: (New file).
	* mc/mcPrintf.mod: (New file).
	* mc/mcQuiet.def: (New file).
	* mc/mcQuiet.mod: (New file).
	* mc/mcReserved.def: (New file).
	* mc/mcReserved.h: (New file).
	* mc/mcReserved.mod: (New file).
	* mc/mcSearch.def: (New file).
	* mc/mcSearch.mod: (New file).
	* mc/mcStack.def: (New file).
	* mc/mcStack.mod: (New file).
	* mc/mcStream.def: (New file).
	* mc/mcStream.mod: (New file).
	* mc/mcflex.def: (New file).
	* mc/mcp1.bnf: (New file).
	* mc/mcp1.def: (New file).
	* mc/mcp2.bnf: (New file).
	* mc/mcp2.def: (New file).
	* mc/mcp3.bnf: (New file).
	* mc/mcp3.def: (New file).
	* mc/mcp4.bnf: (New file).
	* mc/mcp4.def: (New file).
	* mc/mcp5.bnf: (New file).
	* mc/mcp5.def: (New file).
	* mc/nameKey.def: (New file).
	* mc/nameKey.mod: (New file).
	* mc/symbolKey.def: (New file).
	* mc/symbolKey.mod: (New file).
	* mc/top.mod: (New file).
	* mc/varargs.def: (New file).
	* mc/varargs.mod: (New file).
	* mc/wlists.def: (New file).
	* mc/wlists.mod: (New file).
	* pge-boot/GASCII.c: (New file).
	* pge-boot/GASCII.h: (New file).
	* pge-boot/GArgs.c: (New file).
	* pge-boot/GArgs.h: (New file).
	* pge-boot/GAssertion.c: (New file).
	* pge-boot/GAssertion.h: (New file).
	* pge-boot/GBreak.h: (New file).
	* pge-boot/GBuiltins.c: (New file).
	* pge-boot/GCmdArgs.h: (New file).
	* pge-boot/GDebug.c: (New file).
	* pge-boot/GDebug.h: (New file).
	* pge-boot/GDynamicStrings.c: (New file).
	* pge-boot/GDynamicStrings.h: (New file).
	* pge-boot/GEnvironment.h: (New file).
	* pge-boot/GFIO.c: (New file).
	* pge-boot/GFIO.h: (New file).
	* pge-boot/GFormatStrings.h: (New file).
	* pge-boot/GFpuIO.h: (New file).
	* pge-boot/GIO.c: (New file).
	* pge-boot/GIO.h: (New file).
	* pge-boot/GIndexing.c: (New file).
	* pge-boot/GIndexing.h: (New file).
	* pge-boot/GLists.c: (New file).
	* pge-boot/GLists.h: (New file).
	* pge-boot/GM2Dependent.c: (New file).
	* pge-boot/GM2Dependent.h: (New file).
	* pge-boot/GM2EXCEPTION.c: (New file).
	* pge-boot/GM2EXCEPTION.h: (New file).
	* pge-boot/GM2LINK.c: (New file).
	* pge-boot/GM2LINK.h: (New file).
	* pge-boot/GM2RTS.c: (New file).
	* pge-boot/GM2RTS.h: (New file).
	* pge-boot/GNameKey.c: (New file).
	* pge-boot/GNameKey.h: (New file).
	* pge-boot/GNumberIO.c: (New file).
	* pge-boot/GNumberIO.h: (New file).
	* pge-boot/GOutput.c: (New file).
	* pge-boot/GOutput.h: (New file).
	* pge-boot/GPushBackInput.c: (New file).
	* pge-boot/GPushBackInput.h: (New file).
	* pge-boot/GRTExceptions.c: (New file).
	* pge-boot/GRTExceptions.h: (New file).
	* pge-boot/GRTco.c: (New file).
	* pge-boot/GSArgs.h: (New file).
	* pge-boot/GSEnvironment.h: (New file).
	* pge-boot/GSFIO.c: (New file).
	* pge-boot/GSFIO.h: (New file).
	* pge-boot/GSYSTEM.c: (New file).
	* pge-boot/GSYSTEM.h: (New file).
	* pge-boot/GScan.h: (New file).
	* pge-boot/GSelective.c: (New file).
	* pge-boot/GStdIO.c: (New file).
	* pge-boot/GStdIO.h: (New file).
	* pge-boot/GStorage.c: (New file).
	* pge-boot/GStorage.h: (New file).
	* pge-boot/GStrCase.c: (New file).
	* pge-boot/GStrCase.h: (New file).
	* pge-boot/GStrIO.c: (New file).
	* pge-boot/GStrIO.h: (New file).
	* pge-boot/GStrLib.c: (New file).
	* pge-boot/GStrLib.h: (New file).
	* pge-boot/GStringConvert.h: (New file).
	* pge-boot/GSymbolKey.c: (New file).
	* pge-boot/GSymbolKey.h: (New file).
	* pge-boot/GSysExceptions.c: (New file).
	* pge-boot/GSysExceptions.h: (New file).
	* pge-boot/GSysStorage.c: (New file).
	* pge-boot/GSysStorage.h: (New file).
	* pge-boot/GTimeString.h: (New file).
	* pge-boot/GUnixArgs.cc: (New file).
	* pge-boot/GUnixArgs.h: (New file).
	* pge-boot/Gabort.c: (New file).
	* pge-boot/Gbnflex.c: (New file).
	* pge-boot/Gbnflex.h: (New file).
	* pge-boot/Gcbuiltin.c: (New file).
	* pge-boot/Gdtoa.c: (New file).
	* pge-boot/Gdtoa.h: (New file).
	* pge-boot/Gerrno.c: (New file).
	* pge-boot/Gerrno.h: (New file).
	* pge-boot/Gldtoa.c: (New file).
	* pge-boot/Gldtoa.h: (New file).
	* pge-boot/Glibc.c: (New file).
	* pge-boot/Glibc.h: (New file).
	* pge-boot/Glibm.c: (New file).
	* pge-boot/Glibm.h: (New file).
	* pge-boot/Gmcrts.c: (New file).
	* pge-boot/Gmcrts.h: (New file).
	* pge-boot/Gnetwork.h: (New file).
	* pge-boot/Gpge.c: (New file).
	* pge-boot/Gtermios.cc: (New file).
	* pge-boot/Gtermios.h: (New file).
	* pge-boot/Gwrapc.c: (New file).
	* pge-boot/Gwrapc.h: (New file).
	* pge-boot/README: (New file).
	* pge-boot/m2rts.h: (New file).
	* pge-boot/main.c: (New file).
	* pge-boot/network.c: (New file).
	* plugin/README: (New file).
	* plugin/m2rte.cc: (New file).
	* tools-src/README: (New file).
	* tools-src/boilerplate.py: (New file).
	* tools-src/buildpg: (New file).
	* tools-src/calcpath: (New file).
	* tools-src/def2doc.py: (New file).
	* tools-src/makeSystem: (New file).
	* tools-src/mklink.c: (New file).
	* tools-src/tidydates.py: (New file).
	* images/LICENSE.IMG: (New file).
	* images/gnupng: (New file).
	* images/gnu.eps: (New file).
	* version.c: (New file).
	* configure: (Rebuilt).

gcc/testsuite/ChangeLog:

	* lib/gm2-dg.exp: (New file).
	* lib/gm2.exp: (New file).
	* lib/gm2-simple.exp: (New file).
	* lib/gm2-torture.exp: (New file).
	* gm2/calling-c/datatypes/unbounded/run/pass/c.c: (New file).
	* gm2/calling-c/datatypes/unbounded/run/pass/c.def: (New file).
	* gm2/calling-c/datatypes/unbounded/run/pass/calling-c-datatypes-unbounded-run-pass.exp:
	(New file).
	* gm2/calling-c/datatypes/unbounded/run/pass/m.mod: (New file).
	* gm2/case/pass/case-pass.exp: (New file).
	* gm2/case/pass/testcase1.mod: (New file).
	* gm2/case/pass/testcase2.mod: (New file).
	* gm2/case/pass/testcase3.mod: (New file).
	* gm2/case/pass/testcase4.mod: (New file).
	* gm2/complex/fail/var1.mod: (New file).
	* gm2/complex/pass/arith.mod: (New file).
	* gm2/complex/pass/arith2.mod: (New file).
	* gm2/complex/pass/arith3.mod: (New file).
	* gm2/complex/pass/arith4.mod: (New file).
	* gm2/complex/pass/arith5.mod: (New file).
	* gm2/complex/pass/arith6.mod: (New file).
	* gm2/complex/pass/complex-pass.exp: (New file).
	* gm2/complex/pass/consts.mod: (New file).
	* gm2/complex/pass/consts2.mod: (New file).
	* gm2/complex/pass/consts3.mod: (New file).
	* gm2/complex/pass/tinycabs.mod: (New file).
	* gm2/complex/pass/var1.mod: (New file).
	* gm2/complex/pass/var2.mod: (New file).
	* gm2/complex/pass/var3.mod: (New file).
	* gm2/complex/pass/var4.mod: (New file).
	* gm2/complex/pass/var5.mod: (New file).
	* gm2/complex/pass/var6.mod: (New file).
	* gm2/complex/pass/var7.mod: (New file).
	* gm2/complex/pass/var8.mod: (New file).
	* gm2/complex/run/pass/arith3.mod: (New file).
	* gm2/complex/run/pass/arith4.mod: (New file).
	* gm2/complex/run/pass/arith5.mod: (New file).
	* gm2/complex/run/pass/arith6.mod: (New file).
	* gm2/complex/run/pass/arith7.mod: (New file).
	* gm2/complex/run/pass/arith8.mod: (New file).
	* gm2/complex/run/pass/complex-run-pass.exp: (New file).
	* gm2/coroutines/pim/run/pass/coroutines-pim-run-pass.exp: (New file).
	* gm2/coroutines/pim/run/pass/testiotransfer.mod: (New file).
	* gm2/coroutines/pim/run/pass/testtransfer.mod: (New file).
	* gm2/cpp/fail/another.h: (New file).
	* gm2/cpp/fail/fail1.mod: (New file).
	* gm2/cpp/longcard2.mod: (New file).
	* gm2/cpp/longstrimp.mod: (New file).
	* gm2/cpp/pass/arrayhuge.mod: (New file).
	* gm2/cpp/pass/arrayhuge2.mod: (New file).
	* gm2/cpp/pass/cpp-pass.exp: (New file).
	* gm2/cpp/pass/cpp.mod: (New file).
	* gm2/cpp/pass/cpph.mod: (New file).
	* gm2/cpp/pass/subaddr.mod: (New file).
	* gm2/cpp/pass/testcpp.mod: (New file).
	* gm2/cpp/pass/testcpp2.mod: (New file).
	* gm2/cpp/setchar2.mod: (New file).
	* gm2/cpp/setchar6.mod: (New file).
	* gm2/cse/fail/cse-fail.exp: (New file).
	* gm2/cse/fail/testcse38.mod: (New file).
	* gm2/cse/pass/cse-pass.exp: (New file).
	* gm2/cse/pass/m2t.c: (New file).
	* gm2/cse/pass/testb.mod: (New file).
	* gm2/cse/pass/testbuiltin.def: (New file).
	* gm2/cse/pass/testbuiltin.mod: (New file).
	* gm2/cse/pass/testcse.def: (New file).
	* gm2/cse/pass/testcse.mod: (New file).
	* gm2/cse/pass/testcse10.mod: (New file).
	* gm2/cse/pass/testcse11.mod: (New file).
	* gm2/cse/pass/testcse12.mod: (New file).
	* gm2/cse/pass/testcse13.mod: (New file).
	* gm2/cse/pass/testcse14.mod: (New file).
	* gm2/cse/pass/testcse15.mod: (New file).
	* gm2/cse/pass/testcse16.mod: (New file).
	* gm2/cse/pass/testcse17.mod: (New file).
	* gm2/cse/pass/testcse18.mod: (New file).
	* gm2/cse/pass/testcse19.mod: (New file).
	* gm2/cse/pass/testcse2.mod: (New file).
	* gm2/cse/pass/testcse20.mod: (New file).
	* gm2/cse/pass/testcse21.mod: (New file).
	* gm2/cse/pass/testcse22.mod: (New file).
	* gm2/cse/pass/testcse23.mod: (New file).
	* gm2/cse/pass/testcse24.mod: (New file).
	* gm2/cse/pass/testcse25.mod: (New file).
	* gm2/cse/pass/testcse26.mod: (New file).
	* gm2/cse/pass/testcse27.mod: (New file).
	* gm2/cse/pass/testcse28.mod: (New file).
	* gm2/cse/pass/testcse29.mod: (New file).
	* gm2/cse/pass/testcse3.mod: (New file).
	* gm2/cse/pass/testcse31.mod: (New file).
	* gm2/cse/pass/testcse32.mod: (New file).
	* gm2/cse/pass/testcse33.mod: (New file).
	* gm2/cse/pass/testcse34.mod: (New file).
	* gm2/cse/pass/testcse35.mod: (New file).
	* gm2/cse/pass/testcse36.mod: (New file).
	* gm2/cse/pass/testcse37.mod: (New file).
	* gm2/cse/pass/testcse39.mod: (New file).
	* gm2/cse/pass/testcse4.c: (New file).
	* gm2/cse/pass/testcse4.mod: (New file).
	* gm2/cse/pass/testcse40.mod: (New file).
	* gm2/cse/pass/testcse41.mod: (New file).
	* gm2/cse/pass/testcse42.mod: (New file).
	* gm2/cse/pass/testcse43.mod: (New file).
	* gm2/cse/pass/testcse44.mod: (New file).
	* gm2/cse/pass/testcse45.mod: (New file).
	* gm2/cse/pass/testcse46.mod: (New file).
	* gm2/cse/pass/testcse47.mod: (New file).
	* gm2/cse/pass/testcse48.mod: (New file).
	* gm2/cse/pass/testcse49.mod: (New file).
	* gm2/cse/pass/testcse5.c: (New file).
	* gm2/cse/pass/testcse5.mod: (New file).
	* gm2/cse/pass/testcse50.def: (New file).
	* gm2/cse/pass/testcse50.mod: (New file).
	* gm2/cse/pass/testcse51.mod: (New file).
	* gm2/cse/pass/testcse52.def: (New file).
	* gm2/cse/pass/testcse52.mod: (New file).
	* gm2/cse/pass/testcse53.def: (New file).
	* gm2/cse/pass/testcse53.mod: (New file).
	* gm2/cse/pass/testcse6.c: (New file).
	* gm2/cse/pass/testcse6.mod: (New file).
	* gm2/cse/pass/testcse7.c: (New file).
	* gm2/cse/pass/testcse7.mod: (New file).
	* gm2/cse/pass/testcse8.c: (New file).
	* gm2/cse/pass/testcse8.mod: (New file).
	* gm2/cse/pass/testcse9.c: (New file).
	* gm2/cse/pass/testsize.mod: (New file).
	* gm2/dynamic/pass/add.mod: (New file).
	* gm2/dynamic/pass/dynamic-pass.exp: (New file).
	* gm2/dynamic/pass/prog21.mod: (New file).
	* gm2/dynamic/pass/testarray.mod: (New file).
	* gm2/dynamic/pass/testarray2.mod: (New file).
	* gm2/dynamic/pass/testarray3.mod: (New file).
	* gm2/dynamic/pass/testarray4.mod: (New file).
	* gm2/dynamic/pass/testarray6.mod: (New file).
	* gm2/dynamic/pass/testbec.mod: (New file).
	* gm2/dynamic/pass/testbec10.mod: (New file).
	* gm2/dynamic/pass/testbec11.mod: (New file).
	* gm2/dynamic/pass/testbec12.mod: (New file).
	* gm2/dynamic/pass/testbec13.mod: (New file).
	* gm2/dynamic/pass/testbec14.mod: (New file).
	* gm2/dynamic/pass/testbec15.mod: (New file).
	* gm2/dynamic/pass/testbec16.mod: (New file).
	* gm2/dynamic/pass/testbec17.mod: (New file).
	* gm2/dynamic/pass/testbec18.mod: (New file).
	* gm2/dynamic/pass/testbec19.mod: (New file).
	* gm2/dynamic/pass/testbec2.mod: (New file).
	* gm2/dynamic/pass/testbec20.mod: (New file).
	* gm2/dynamic/pass/testbec21.mod: (New file).
	* gm2/dynamic/pass/testbec22.mod: (New file).
	* gm2/dynamic/pass/testbec23.mod: (New file).
	* gm2/dynamic/pass/testbec24.mod: (New file).
	* gm2/dynamic/pass/testbec25.mod: (New file).
	* gm2/dynamic/pass/testbec26.mod: (New file).
	* gm2/dynamic/pass/testbec27.mod: (New file).
	* gm2/dynamic/pass/testbec28.mod: (New file).
	* gm2/dynamic/pass/testbec29.mod: (New file).
	* gm2/dynamic/pass/testbec3.mod: (New file).
	* gm2/dynamic/pass/testbec30.mod: (New file).
	* gm2/dynamic/pass/testbec31.mod: (New file).
	* gm2/dynamic/pass/testbec32.mod: (New file).
	* gm2/dynamic/pass/testbec33.mod: (New file).
	* gm2/dynamic/pass/testbec34.mod: (New file).
	* gm2/dynamic/pass/testbec35.mod: (New file).
	* gm2/dynamic/pass/testbec36.mod: (New file).
	* gm2/dynamic/pass/testbec37.mod: (New file).
	* gm2/dynamic/pass/testbec38.mod: (New file).
	* gm2/dynamic/pass/testbec39.mod: (New file).
	* gm2/dynamic/pass/testbec4.mod: (New file).
	* gm2/dynamic/pass/testbec40.mod: (New file).
	* gm2/dynamic/pass/testbec41.mod: (New file).
	* gm2/dynamic/pass/testbec42.mod: (New file).
	* gm2/dynamic/pass/testbec43.mod: (New file).
	* gm2/dynamic/pass/testbec44.mod: (New file).
	* gm2/dynamic/pass/testbec45.mod: (New file).
	* gm2/dynamic/pass/testbec5.mod: (New file).
	* gm2/dynamic/pass/testbec6.mod: (New file).
	* gm2/dynamic/pass/testbec7.mod: (New file).
	* gm2/dynamic/pass/testbec8.mod: (New file).
	* gm2/dynamic/pass/testbec9.mod: (New file).
	* gm2/dynamic/pass/testdavid.mod: (New file).
	* gm2/dynamic/pass/testdiv.mod: (New file).
	* gm2/dynamic/pass/testexp.mod: (New file).
	* gm2/dynamic/pass/testfor.mod: (New file).
	* gm2/dynamic/pass/testfor2.mod: (New file).
	* gm2/dynamic/pass/testfunc.mod: (New file).
	* gm2/dynamic/pass/testfunc2.mod: (New file).
	* gm2/dynamic/pass/testfunc3.mod: (New file).
	* gm2/dynamic/pass/testfunc4.mod: (New file).
	* gm2/dynamic/pass/testfunc5.mod: (New file).
	* gm2/dynamic/pass/testfunc6.mod: (New file).
	* gm2/dynamic/pass/testif.mod: (New file).
	* gm2/dynamic/pass/testit.mod: (New file).
	* gm2/dynamic/pass/testloop.mod: (New file).
	* gm2/dynamic/pass/testloop2.mod: (New file).
	* gm2/dynamic/pass/testloop3.mod: (New file).
	* gm2/dynamic/pass/testloop4.mod: (New file).
	* gm2/dynamic/pass/testloop5.mod: (New file).
	* gm2/dynamic/pass/testmin.mod: (New file).
	* gm2/dynamic/pass/testnum4.mod: (New file).
	* gm2/dynamic/pass/testord.mod: (New file).
	* gm2/dynamic/pass/testparam.mod: (New file).
	* gm2/dynamic/pass/testparam2.mod: (New file).
	* gm2/dynamic/pass/testproc.mod: (New file).
	* gm2/dynamic/pass/testproc2.c: (New file).
	* gm2/dynamic/pass/testproc2.def: (New file).
	* gm2/dynamic/pass/testproc2.mod: (New file).
	* gm2/dynamic/pass/testscn.mod: (New file).
	* gm2/dynamic/pass/testset.mod: (New file).
	* gm2/dynamic/pass/testset2.mod: (New file).
	* gm2/dynamic/pass/testset3.mod: (New file).
	* gm2/dynamic/pass/teststr.c: (New file).
	* gm2/dynamic/pass/teststr.mod: (New file).
	* gm2/dynamic/pass/teststr2.mod: (New file).
	* gm2/dynamic/pass/teststring.mod: (New file).
	* gm2/dynamic/pass/testunbounded.mod: (New file).
	* gm2/dynamic/pass/testwith.mod: (New file).
	* gm2/dynamic/pass/testzero.mod: (New file).
	* gm2/dynamic/pass/wc.mod: (New file).
	* gm2/embedded/pass/embedded-pass.exp: (New file).
	* gm2/embedded/pass/varataddress.mod: (New file).
	* gm2/embedded/pass/varataddress1.mod: (New file).
	* gm2/embedded/pass/varataddress2.mod: (New file).
	* gm2/embedded/pass/varataddress3.mod: (New file).
	* gm2/errors/fail/array1.mod: (New file).
	* gm2/errors/fail/badexpr.mod: (New file).
	* gm2/errors/fail/badfor.mod: (New file).
	* gm2/errors/fail/badhigh.mod: (New file).
	* gm2/errors/fail/badshift.mod: (New file).
	* gm2/errors/fail/badsubexpradr.mod: (New file).
	* gm2/errors/fail/binaryconst.mod: (New file).
	* gm2/errors/fail/binarygeneric.mod: (New file).
	* gm2/errors/fail/binarygenericconst.mod: (New file).
	* gm2/errors/fail/end.mod: (New file).
	* gm2/errors/fail/errors-fail.exp: (New file).
	* gm2/errors/fail/mismatched.mod: (New file).
	* gm2/errors/fail/mismatchedproc.mod: (New file).
	* gm2/errors/fail/nestedproc4.mod: (New file).
	* gm2/errors/fail/nomodule.mod: (New file).
	* gm2/errors/fail/proctype.mod: (New file).
	* gm2/errors/fail/prog110.mod: (New file).
	* gm2/errors/fail/prog111.mod: (New file).
	* gm2/errors/fail/prog113.mod: (New file).
	* gm2/errors/fail/prog114.mod: (New file).
	* gm2/errors/fail/testaddress.mod: (New file).
	* gm2/errors/fail/testarray.mod: (New file).
	* gm2/errors/fail/testbit.mod: (New file).
	* gm2/errors/fail/testbit2.mod: (New file).
	* gm2/errors/fail/testcase.mod: (New file).
	* gm2/errors/fail/testcomment.mod: (New file).
	* gm2/errors/fail/testcomment2.mod: (New file).
	* gm2/errors/fail/testcomment3.mod: (New file).
	* gm2/errors/fail/testconst.mod: (New file).
	* gm2/errors/fail/testdyn.mod: (New file).
	* gm2/errors/fail/testdyn2.mod: (New file).
	* gm2/errors/fail/testdyn3.mod: (New file).
	* gm2/errors/fail/testexp.mod: (New file).
	* gm2/errors/fail/testfio.mod: (New file).
	* gm2/errors/fail/testimport.mod: (New file).
	* gm2/errors/fail/testimport2.def: (New file).
	* gm2/errors/fail/testimport2.mod: (New file).
	* gm2/errors/fail/testinit.mod: (New file).
	* gm2/errors/fail/testmodule.mod: (New file).
	* gm2/errors/fail/testnil.mod: (New file).
	* gm2/errors/fail/testnil2.mod: (New file).
	* gm2/errors/fail/testparam.mod: (New file).
	* gm2/errors/fail/testproc.mod: (New file).
	* gm2/errors/fail/testproc2.mod: (New file).
	* gm2/errors/fail/testsize.mod: (New file).
	* gm2/errors/fail/teststring.mod: (New file).
	* gm2/errors/fail/testsub3.mod: (New file).
	* gm2/errors/fail/testsub4.mod: (New file).
	* gm2/errors/fail/testtype.mod: (New file).
	* gm2/errors/fail/testvar.mod: (New file).
	* gm2/errors/fail/testwith.mod: (New file).
	* gm2/errors/fail/testwrite.mod: (New file).
	* gm2/errors/fail/type.mod: (New file).
	* gm2/errors/fail/unarygeneric.mod: (New file).
	* gm2/errors/mustfail: (New file).
	* gm2/errors/options: (New file).
	* gm2/errors/testchar.mod: (New file).
	* gm2/errors/testsub2.mod: (New file).
	* gm2/examples/callingC/pass/examples-callingC-pass.exp: (New file).
	* gm2/examples/callingC/pass/hello.mod: (New file).
	* gm2/examples/callingC/pass/libprintf.def: (New file).
	* gm2/examples/callingC/run/pass/c.c: (New file).
	* gm2/examples/callingC/run/pass/c.def: (New file).
	* gm2/examples/callingC/run/pass/examples-callingC-run-pass.exp: (New file).
	* gm2/examples/callingC/run/pass/hello.mod: (New file).
	* gm2/examples/callingC/run/pass/libprintf.def: (New file).
	* gm2/examples/callingC/run/pass/m.mod: (New file).
	* gm2/examples/cpp/pass/examples-cpp-pass.exp: (New file).
	* gm2/examples/cpp/pass/hello.mod: (New file).
	* gm2/examples/cppDef/pass/a.def: (New file).
	* gm2/examples/cppDef/pass/a.mod: (New file).
	* gm2/examples/cppDef/pass/b.mod: (New file).
	* gm2/examples/cppDef/pass/examples-cppDef-pass.exp: (New file).
	* gm2/examples/cppDef/pass/libprintf.def: (New file).
	* gm2/examples/hello/pass/examples-hello-pass.exp: (New file).
	* gm2/examples/hello/pass/hello.mod: (New file).
	* gm2/examples/map/pass/AdvMap.def: (New file).
	* gm2/examples/map/pass/AdvMap.mod: (New file).
	* gm2/examples/map/pass/BoxMap.def: (New file).
	* gm2/examples/map/pass/BoxMap.mod: (New file).
	* gm2/examples/map/pass/Chance.def: (New file).
	* gm2/examples/map/pass/Chance.mod: (New file).
	* gm2/examples/map/pass/Find.def: (New file).
	* gm2/examples/map/pass/Find.mod: (New file).
	* gm2/examples/map/pass/Geometry.def: (New file).
	* gm2/examples/map/pass/Geometry.mod: (New file).
	* gm2/examples/map/pass/MakeBoxes.def: (New file).
	* gm2/examples/map/pass/MakeBoxes.mod: (New file).
	* gm2/examples/map/pass/Map.mod: (New file).
	* gm2/examples/map/pass/RoomMap.def: (New file).
	* gm2/examples/map/pass/RoomMap.mod: (New file).
	* gm2/examples/map/pass/Semantic.mod: (New file).
	* gm2/examples/map/pass/StoreCoord.def: (New file).
	* gm2/examples/map/pass/StoreCoord.mod: (New file).
	* gm2/examples/map/pass/StoreCoords.def: (New file).
	* gm2/examples/map/pass/StoreCoords.mod: (New file).
	* gm2/examples/map/pass/WriteMap.def: (New file).
	* gm2/examples/map/pass/WriteMap.mod: (New file).
	* gm2/examples/map/pass/examples-map-pass.exp: (New file).
	* gm2/examples/map/pass/makemaps: (New file).
	* gm2/examples/map/pass/testch2.mod: (New file).
	* gm2/examples/map/pass/testchan.mod: (New file).
	* gm2/examples/map/pass/testcoor.mod: (New file).
	* gm2/examples/map/pass/testmaps: (New file).
	* gm2/exceptions/run/pass/cpp.cpp: (New file).
	* gm2/exceptions/run/pass/cpp.def: (New file).
	* gm2/exceptions/run/pass/exceptions-run-pass.exp: (New file).
	* gm2/exceptions/run/pass/libexcept.mod: (New file).
	* gm2/exceptions/run/pass/m2test.def: (New file).
	* gm2/exceptions/run/pass/m2test.mod: (New file).
	* gm2/exceptions/run/pass/mycpp.cpp: (New file).
	* gm2/exceptions/run/pass/mycpp.def: (New file).
	* gm2/exceptions/run/pass/mym2.mod: (New file).
	* gm2/exceptions/run/pass/mym2a.mod: (New file).
	* gm2/extensions/pass/align.mod: (New file).
	* gm2/extensions/pass/align2.mod: (New file).
	* gm2/extensions/pass/card16p.mod: (New file).
	* gm2/extensions/pass/card32p.mod: (New file).
	* gm2/extensions/pass/card64p.mod: (New file).
	* gm2/extensions/pass/card8p.mod: (New file).
	* gm2/extensions/pass/co.def: (New file).
	* gm2/extensions/pass/co.mod: (New file).
	* gm2/extensions/pass/extensions-pass.exp: (New file).
	* gm2/extensions/pass/frame.mod: (New file).
	* gm2/extensions/pass/hello.mod: (New file).
	* gm2/extensions/pass/int16p.mod: (New file).
	* gm2/extensions/pass/int32p.mod: (New file).
	* gm2/extensions/pass/int64p.mod: (New file).
	* gm2/extensions/pass/int8p.mod: (New file).
	* gm2/extensions/pass/intsize8.mod: (New file).
	* gm2/extensions/pass/jmp.mod: (New file).
	* gm2/extensions/pass/libc.def: (New file).
	* gm2/extensions/pass/optparam.mod: (New file).
	* gm2/extensions/pass/optparam2.mod: (New file).
	* gm2/extensions/pass/return.mod: (New file).
	* gm2/extensions/pass/set8.mod: (New file).
	* gm2/extensions/pass/set8a.mod: (New file).
	* gm2/extensions/pass/set8b.mod: (New file).
	* gm2/extensions/pass/testco.mod: (New file).
	* gm2/extensions/run/fail/extensions-run-fail.exp: (New file).
	* gm2/extensions/run/fail/intsize8.mod: (New file).
	* gm2/extensions/run/pass/align3.mod: (New file).
	* gm2/extensions/run/pass/align4.mod: (New file).
	* gm2/extensions/run/pass/align5.mod: (New file).
	* gm2/extensions/run/pass/align6.mod: (New file).
	* gm2/extensions/run/pass/align7.mod: (New file).
	* gm2/extensions/run/pass/callingc.mod: (New file).
	* gm2/extensions/run/pass/card16p.mod: (New file).
	* gm2/extensions/run/pass/card32p.mod: (New file).
	* gm2/extensions/run/pass/card64p.mod: (New file).
	* gm2/extensions/run/pass/card8p.mod: (New file).
	* gm2/extensions/run/pass/column.mod: (New file).
	* gm2/extensions/run/pass/cvararg.c: (New file).
	* gm2/extensions/run/pass/cvararg.def: (New file).
	* gm2/extensions/run/pass/extensions-run-pass.exp: (New file).
	* gm2/extensions/run/pass/int16p.mod: (New file).
	* gm2/extensions/run/pass/int32p.mod: (New file).
	* gm2/extensions/run/pass/int64p.mod: (New file).
	* gm2/extensions/run/pass/int8field.mod: (New file).
	* gm2/extensions/run/pass/int8p.mod: (New file).
	* gm2/extensions/run/pass/packedrecord.mod: (New file).
	* gm2/extensions/run/pass/packedrecord2.mod: (New file).
	* gm2/extensions/run/pass/real32.mod: (New file).
	* gm2/extensions/run/pass/real32a.mod: (New file).
	* gm2/extensions/run/pass/record.mod: (New file).
	* gm2/extensions/run/pass/testopen.mod: (New file).
	* gm2/extensions/run/pass/vararg.mod: (New file).
	* gm2/extensions/run/pass/vararg2.mod: (New file).
	* gm2/extensions/run/pass/vararg3.mod: (New file).
	* gm2/fpu/pass/five.mod: (New file).
	* gm2/fpu/pass/fp.def: (New file).
	* gm2/fpu/pass/fp.mod: (New file).
	* gm2/fpu/pass/fpu-pass.exp: (New file).
	* gm2/fpu/pass/one.mod: (New file).
	* gm2/fpu/pass/r1.mod: (New file).
	* gm2/fpu/pass/realconst.mod: (New file).
	* gm2/fpu/pass/testfp.mod: (New file).
	* gm2/fpu/pass/testfp2.mod: (New file).
	* gm2/fpu/pass/testfpu1.mod: (New file).
	* gm2/fpu/pass/testfpu2.mod: (New file).
	* gm2/fpu/pass/testfpu3.mod: (New file).
	* gm2/fpu/pass/testsin.mod: (New file).
	* gm2/imports/run/pass/c.def: (New file).
	* gm2/imports/run/pass/c.mod: (New file).
	* gm2/imports/run/pass/imports-run-pass.exp: (New file).
	* gm2/imports/run/pass/innermods.mod: (New file).
	* gm2/imports/run/pass/innermods2.mod: (New file).
	* gm2/imports/run/pass/innermods3.mod: (New file).
	* gm2/imports/run/pass/innermods4.mod: (New file).
	* gm2/imports/run/pass/innermods5.def: (New file).
	* gm2/imports/run/pass/innermods5.mod: (New file).
	* gm2/imports/run/pass/innermods6.mod: (New file).
	* gm2/integer/div.mod: (New file).
	* gm2/integer/expr.mod: (New file).
	* gm2/integer/mod.mod: (New file).
	* gm2/integer/mod2.mod: (New file).
	* gm2/integer/one.mod: (New file).
	* gm2/integer/options: (New file).
	* gm2/integer/zero.mod: (New file).
	* gm2/iso/analysis/fail/Makefile: (New file).
	* gm2/iso/analysis/fail/arithoverflow.mod: (New file).
	* gm2/iso/analysis/fail/arithoverflow2.mod: (New file).
	* gm2/iso/analysis/fail/arithsubcard.mod: (New file).
	* gm2/iso/analysis/fail/arrayrange.mod: (New file).
	* gm2/iso/analysis/fail/assignvalue.mod: (New file).
	* gm2/iso/analysis/fail/callassignment.mod: (New file).
	* gm2/iso/analysis/fail/callassignment2.mod: (New file).
	* gm2/iso/analysis/fail/callassignment3.mod: (New file).
	* gm2/iso/analysis/fail/callassignment4.mod: (New file).
	* gm2/iso/analysis/fail/caserange.mod: (New file).
	* gm2/iso/analysis/fail/decvalue.mod: (New file).
	* gm2/iso/analysis/fail/forloop.mod: (New file).
	* gm2/iso/analysis/fail/incvalue.mod: (New file).
	* gm2/iso/analysis/fail/iso-analysis-fail.exp: (New file).
	* gm2/iso/analysis/fail/noreturn.mod: (New file).
	* gm2/iso/analysis/fail/returnvalue.mod: (New file).
	* gm2/iso/analysis/fail/staticarray.mod: (New file).
	* gm2/iso/check/fail/iso-check-fail.exp: (New file).
	* gm2/iso/check/fail/modulusoverflow.mod: (New file).
	* gm2/iso/fail/badarray.mod: (New file).
	* gm2/iso/fail/badarray2.mod: (New file).
	* gm2/iso/fail/badipv4.mod: (New file).
	* gm2/iso/fail/bug10.mod: (New file).
	* gm2/iso/fail/bug8.mod: (New file).
	* gm2/iso/fail/bug9.mod: (New file).
	* gm2/iso/fail/case.mod: (New file).
	* gm2/iso/fail/case2.mod: (New file).
	* gm2/iso/fail/case3.mod: (New file).
	* gm2/iso/fail/const1.mod: (New file).
	* gm2/iso/fail/constarray.mod: (New file).
	* gm2/iso/fail/constarray2.mod: (New file).
	* gm2/iso/fail/constprocedure.mod: (New file).
	* gm2/iso/fail/constrecord.mod: (New file).
	* gm2/iso/fail/constrecord2.mod: (New file).
	* gm2/iso/fail/constrecord3.mod: (New file).
	* gm2/iso/fail/constsubrange.mod: (New file).
	* gm2/iso/fail/constsubrange2.mod: (New file).
	* gm2/iso/fail/constsubrange3.mod: (New file).
	* gm2/iso/fail/defa.def: (New file).
	* gm2/iso/fail/defa.mod: (New file).
	* gm2/iso/fail/defb.def: (New file).
	* gm2/iso/fail/defb.mod: (New file).
	* gm2/iso/fail/defc.def: (New file).
	* gm2/iso/fail/defc.mod: (New file).
	* gm2/iso/fail/except.mod: (New file).
	* gm2/iso/fail/except2.mod: (New file).
	* gm2/iso/fail/iso-fail.exp: (New file).
	* gm2/iso/fail/isoa.def: (New file).
	* gm2/iso/fail/isoa.mod: (New file).
	* gm2/iso/fail/lengthsubexpr.mod: (New file).
	* gm2/iso/fail/proc.mod: (New file).
	* gm2/iso/fail/realbitscast.mod: (New file).
	* gm2/iso/fail/varient.mod: (New file).
	* gm2/iso/fail/varient2.mod: (New file).
	* gm2/iso/future/builtinlj.mod: (New file).
	* gm2/iso/pass/ChanConsts.def: (New file).
	* gm2/iso/pass/ChanConsts.mod: (New file).
	* gm2/iso/pass/ConvTypes.def: (New file).
	* gm2/iso/pass/ConvTypes.mod: (New file).
	* gm2/iso/pass/addadr1.mod: (New file).
	* gm2/iso/pass/bits32c.mod: (New file).
	* gm2/iso/pass/callwraptime.mod: (New file).
	* gm2/iso/pass/caseiso.mod: (New file).
	* gm2/iso/pass/caseiso2.mod: (New file).
	* gm2/iso/pass/cast.mod: (New file).
	* gm2/iso/pass/cast3.mod: (New file).
	* gm2/iso/pass/castiso.mod: (New file).
	* gm2/iso/pass/const1.mod: (New file).
	* gm2/iso/pass/constreal.mod: (New file).
	* gm2/iso/pass/constructor1.mod: (New file).
	* gm2/iso/pass/constructor2.mod: (New file).
	* gm2/iso/pass/constructor3.mod: (New file).
	* gm2/iso/pass/constructor4.mod: (New file).
	* gm2/iso/pass/constructor5.mod: (New file).
	* gm2/iso/pass/constructor6.mod: (New file).
	* gm2/iso/pass/constsize4.mod: (New file).
	* gm2/iso/pass/delim.mod: (New file).
	* gm2/iso/pass/delim2.mod: (New file).
	* gm2/iso/pass/enummodule.mod: (New file).
	* gm2/iso/pass/except1.mod: (New file).
	* gm2/iso/pass/expproc.mod: (New file).
	* gm2/iso/pass/expproc2.mod: (New file).
	* gm2/iso/pass/iso-pass.exp: (New file).
	* gm2/iso/pass/isob.def: (New file).
	* gm2/iso/pass/isob.mod: (New file).
	* gm2/iso/pass/isobitset.mod: (New file).
	* gm2/iso/pass/isobitset2.mod: (New file).
	* gm2/iso/pass/longm.mod: (New file).
	* gm2/iso/pass/m.mod: (New file).
	* gm2/iso/pass/proccast.mod: (New file).
	* gm2/iso/pass/realbitscast.mod: (New file).
	* gm2/iso/pass/set12.mod: (New file).
	* gm2/iso/pass/stringchar.mod: (New file).
	* gm2/iso/pass/subassign.mod: (New file).
	* gm2/iso/pass/testaddindr.mod: (New file).
	* gm2/iso/pass/testconv.def: (New file).
	* gm2/iso/pass/testconv.mod: (New file).
	* gm2/iso/pass/testconv2.def: (New file).
	* gm2/iso/pass/testconv2.mod: (New file).
	* gm2/iso/pass/testconv3.mod: (New file).
	* gm2/iso/pass/testconv4.mod: (New file).
	* gm2/iso/pass/testconv5.mod: (New file).
	* gm2/iso/pass/testconv6.mod: (New file).
	* gm2/iso/pass/testconv7.mod: (New file).
	* gm2/iso/pass/testconv8.mod: (New file).
	* gm2/iso/pass/testconv9.mod: (New file).
	* gm2/iso/pass/testiso.mod: (New file).
	* gm2/iso/pass/testiso2.mod: (New file).
	* gm2/iso/pass/testisosize.mod: (New file).
	* gm2/iso/pass/testlength.mod: (New file).
	* gm2/iso/pass/testlength2.mod: (New file).
	* gm2/iso/pass/testlength3.mod: (New file).
	* gm2/iso/pass/testlength4.mod: (New file).
	* gm2/iso/pass/testlength5.mod: (New file).
	* gm2/iso/pass/unbounded.mod: (New file).
	* gm2/iso/pass/unbounded2.mod: (New file).
	* gm2/iso/run/pass/adraddress.mod: (New file).
	* gm2/iso/run/pass/adrunbounded3.mod: (New file).
	* gm2/iso/run/pass/baseimport.mod: (New file).
	* gm2/iso/run/pass/compsize.mod: (New file).
	* gm2/iso/run/pass/concurrentstore.mod: (New file).
	* gm2/iso/run/pass/constprocedure.mod: (New file).
	* gm2/iso/run/pass/constructor1.mod: (New file).
	* gm2/iso/run/pass/constructor2.mod: (New file).
	* gm2/iso/run/pass/conststrarray.mod: (New file).
	* gm2/iso/run/pass/contimer.mod: (New file).
	* gm2/iso/run/pass/except.c: (New file).
	* gm2/iso/run/pass/except2.mod: (New file).
	* gm2/iso/run/pass/except3.cpp: (New file).
	* gm2/iso/run/pass/except4.mod: (New file).
	* gm2/iso/run/pass/except5.cpp: (New file).
	* gm2/iso/run/pass/except5.mod: (New file).
	* gm2/iso/run/pass/except6.cpp: (New file).
	* gm2/iso/run/pass/except7.mod: (New file).
	* gm2/iso/run/pass/except8.mod: (New file).
	* gm2/iso/run/pass/fileio.def: (New file).
	* gm2/iso/run/pass/fileio.mod: (New file).
	* gm2/iso/run/pass/hello.mod: (New file).
	* gm2/iso/run/pass/int8field.mod: (New file).
	* gm2/iso/run/pass/iso-run-pass.exp: (New file).
	* gm2/iso/run/pass/long.mod: (New file).
	* gm2/iso/run/pass/long2.mod: (New file).
	* gm2/iso/run/pass/long3.mod: (New file).
	* gm2/iso/run/pass/long4.c: (New file).
	* gm2/iso/run/pass/long4.mod: (New file).
	* gm2/iso/run/pass/minmax.mod: (New file).
	* gm2/iso/run/pass/modulus.mod: (New file).
	* gm2/iso/run/pass/nestediso.mod: (New file).
	* gm2/iso/run/pass/nestedrecord.mod: (New file).
	* gm2/iso/run/pass/onebyte.mod: (New file).
	* gm2/iso/run/pass/onebyte2.mod: (New file).
	* gm2/iso/run/pass/onebyte3.mod: (New file).
	* gm2/iso/run/pass/packed.mod: (New file).
	* gm2/iso/run/pass/proc.c: (New file).
	* gm2/iso/run/pass/proc.mod: (New file).
	* gm2/iso/run/pass/proc2.mod: (New file).
	* gm2/iso/run/pass/returnrecord.mod: (New file).
	* gm2/iso/run/pass/shift.mod: (New file).
	* gm2/iso/run/pass/shift2.mod: (New file).
	* gm2/iso/run/pass/shift3.mod: (New file).
	* gm2/iso/run/pass/shift4.mod: (New file).
	* gm2/iso/run/pass/simple: (New file).
	* gm2/iso/run/pass/simplelarge.mod: (New file).
	* gm2/iso/run/pass/strcons.mod: (New file).
	* gm2/iso/run/pass/strcons2.mod: (New file).
	* gm2/iso/run/pass/t.cpp: (New file).
	* gm2/iso/run/pass/t1.cpp: (New file).
	* gm2/iso/run/pass/testLength.mod: (New file).
	* gm2/iso/run/pass/testarray.mod: (New file).
	* gm2/iso/run/pass/testgeneric.mod: (New file).
	* gm2/iso/run/pass/testlarge.mod: (New file).
	* gm2/iso/run/pass/testsystem.mod: (New file).
	* gm2/iso/run/pass/tinyconst.mod: (New file).
	* gm2/iso/run/pass/tinyconst2.mod: (New file).
	* gm2/iso/run/pass/tinyconst3.mod: (New file).
	* gm2/iso/run/pass/tinyconst4.mod: (New file).
	* gm2/iso/run/pass/tinyconst5.mod: (New file).
	* gm2/iso/run/pass/tinytimer.mod: (New file).
	* gm2/iso/run/pass/trivialmodulus.mod: (New file).
	* gm2/iso/run/pass/tsize.mod: (New file).
	* gm2/iso/run/pass/tsize2.mod: (New file).
	* gm2/iso/run/pass/tstLength.mod: (New file).
	* gm2/iso/run/pass/unbounded.mod: (New file).
	* gm2/iso/run/pass/unbounded2.mod: (New file).
	* gm2/iso/run/pass/unbounded3.mod: (New file).
	* gm2/iso/run/pass/unbounded4.mod: (New file).
	* gm2/iso/run/pass/unbounded5.mod: (New file).
	* gm2/iso/run/pass/unbounded6.mod: (New file).
	* gm2/iso/run/pass/unbounded7.mod: (New file).
	* gm2/iso/run/pass/unbounded8.mod: (New file).
	* gm2/isocoroutines/run/pass/coroutine.mod: (New file).
	* gm2/isocoroutines/run/pass/isocoroutines-run-pass.exp: (New file).
	* gm2/isolib/run/pass/arraycons.mod: (New file).
	* gm2/isolib/run/pass/arraycons2.mod: (New file).
	* gm2/isolib/run/pass/arraycons3.mod: (New file).
	* gm2/isolib/run/pass/arraycons5.mod: (New file).
	* gm2/isolib/run/pass/arraycons6.mod: (New file).
	* gm2/isolib/run/pass/arraycons7.mod: (New file).
	* gm2/isolib/run/pass/arrayconst8.mod: (New file).
	* gm2/isolib/run/pass/exceptiontest.mod: (New file).
	* gm2/isolib/run/pass/filepos.mod: (New file).
	* gm2/isolib/run/pass/hello.mod: (New file).
	* gm2/isolib/run/pass/insert.mod: (New file).
	* gm2/isolib/run/pass/intconv.mod: (New file).
	* gm2/isolib/run/pass/isolib-run-pass.exp: (New file).
	* gm2/isolib/run/pass/longstr.mod: (New file).
	* gm2/isolib/run/pass/openlibc.mod: (New file).
	* gm2/isolib/run/pass/raise.mod: (New file).
	* gm2/isolib/run/pass/raise2.mod: (New file).
	* gm2/isolib/run/pass/readreal.mod: (New file).
	* gm2/isolib/run/pass/real1.mod: (New file).
	* gm2/isolib/run/pass/real2.mod: (New file).
	* gm2/isolib/run/pass/real3.mod: (New file).
	* gm2/isolib/run/pass/realconv.mod: (New file).
	* gm2/isolib/run/pass/realconv2.mod: (New file).
	* gm2/isolib/run/pass/realstr.mod: (New file).
	* gm2/isolib/run/pass/sigfig.mod: (New file).
	* gm2/isolib/run/pass/stringreal2.mod: (New file).
	* gm2/isolib/run/pass/termfile.mod-disabled: (New file).
	* gm2/isolib/run/pass/testappend.mod: (New file).
	* gm2/isolib/run/pass/testinput: (New file).
	* gm2/isolib/run/pass/testio.mod: (New file).
	* gm2/isolib/run/pass/testio2.mod: (New file).
	* gm2/isolib/run/pass/testmem.mod: (New file).
	* gm2/isolib/run/pass/testmem2.mod: (New file).
	* gm2/isolib/run/pass/testnumber: (New file).
	* gm2/isolib/run/pass/tiny.mod: (New file).
	* gm2/isolib/run/pass/tiny2.mod: (New file).
	* gm2/isolib/run/pass/tiny3.mod: (New file).
	* gm2/isolib/run/pass/tiny4.mod: (New file).
	* gm2/isolib/run/pass/tiny5.mod: (New file).
	* gm2/libs/a.def: (New file).
	* gm2/libs/a.mod: (New file).
	* gm2/libs/b.def: (New file).
	* gm2/libs/b.mod: (New file).
	* gm2/libs/testraw.mod: (New file).
	* gm2/link/externalscaffold/pass/hello.mod: (New file).
	* gm2/link/externalscaffold/pass/link-externalscaffold-pass.exp: (New file).
	* gm2/link/externalscaffold/pass/scaffold.c: (New file).
	* gm2/link/pim/fail/import.mod: (New file).
	* gm2/link/pim/fail/link-pim-fail.exp: (New file).
	* gm2/link/pim/pass/link-pim-pass.exp: (New file).
	* gm2/link/pimc/pass/README: (New file).
	* gm2/link/pimc/pass/link-pimc-pass.exp: (New file).
	* gm2/link/pimc/pass/testdtoa.mod: (New file).
	* gm2/link/pimc/pass/testerrno.mod: (New file).
	* gm2/link/pimc/pass/testgetopt.mod: (New file).
	* gm2/link/pimc/pass/testldtoa.mod: (New file).
	* gm2/link/pimc/pass/testlibc.mod: (New file).
	* gm2/link/pimc/pass/testlibc2.mod: (New file).
	* gm2/link/pimc/pass/testsckt.mod: (New file).
	* gm2/link/pimc/pass/testselective.mod: (New file).
	* gm2/link/pimc/pass/testsysexceptions.mod: (New file).
	* gm2/link/pimc/pass/testtermios.mod: (New file).
	* gm2/link/pimc/pass/testunixargs.mod: (New file).
	* gm2/link/pimc/pass/testwrapc.mod: (New file).
	* gm2/linking/libarchive/pass/c.c: (New file).
	* gm2/linking/libarchive/pass/c.def: (New file).
	* gm2/linking/libarchive/pass/d.def: (New file).
	* gm2/linking/libarchive/pass/e.def: (New file).
	* gm2/linking/libarchive/pass/linking-libarchive-pass.exp: (New file).
	* gm2/linking/libarchive/pass/m.mod: (New file).
	* gm2/linking/verbose/pass/hello.mod: (New file).
	* gm2/linking/verbose/pass/linking-verbose-pass.exp: (New file).
	* gm2/pim/fail/TestLong3.mod: (New file).
	* gm2/pim/fail/TestLong6.mod: (New file).
	* gm2/pim/fail/a.def: (New file).
	* gm2/pim/fail/assignbounds.mod: (New file).
	* gm2/pim/fail/assignsubrange.mod: (New file).
	* gm2/pim/fail/assignsubrange2.mod: (New file).
	* gm2/pim/fail/b.def: (New file).
	* gm2/pim/fail/bad.def: (New file).
	* gm2/pim/fail/badconst.mod: (New file).
	* gm2/pim/fail/badfunc.mod: (New file).
	* gm2/pim/fail/badparam.mod: (New file).
	* gm2/pim/fail/badparam2.mod: (New file).
	* gm2/pim/fail/badtype.mod: (New file).
	* gm2/pim/fail/badtypes.mod: (New file).
	* gm2/pim/fail/bits.mod: (New file).
	* gm2/pim/fail/bits2.mod: (New file).
	* gm2/pim/fail/bits3.mod: (New file).
	* gm2/pim/fail/bits4.mod: (New file).
	* gm2/pim/fail/cardword.mod: (New file).
	* gm2/pim/fail/constbec.mod: (New file).
	* gm2/pim/fail/constsize3.mod: (New file).
	* gm2/pim/fail/constvar.mod: (New file).
	* gm2/pim/fail/convert5.mod: (New file).
	* gm2/pim/fail/dupconst.mod: (New file).
	* gm2/pim/fail/dupenum.mod: (New file).
	* gm2/pim/fail/dupfield.mod: (New file).
	* gm2/pim/fail/duptype.mod: (New file).
	* gm2/pim/fail/dupvar.mod: (New file).
	* gm2/pim/fail/expression.mod: (New file).
	* gm2/pim/fail/expression2.mod: (New file).
	* gm2/pim/fail/expression3.mod: (New file).
	* gm2/pim/fail/func.mod: (New file).
	* gm2/pim/fail/good.def: (New file).
	* gm2/pim/fail/good.mod: (New file).
	* gm2/pim/fail/import.mod: (New file).
	* gm2/pim/fail/inserttok.def: (New file).
	* gm2/pim/fail/inserttok.mod: (New file).
	* gm2/pim/fail/integer.mod: (New file).
	* gm2/pim/fail/keyword.mod: (New file).
	* gm2/pim/fail/longtypes2.mod: (New file).
	* gm2/pim/fail/longtypes3.mod: (New file).
	* gm2/pim/fail/multisetf.mod: (New file).
	* gm2/pim/fail/nested3.mod: (New file).
	* gm2/pim/fail/opaque.mod: (New file).
	* gm2/pim/fail/opaque2.mod: (New file).
	* gm2/pim/fail/opasfail.mod: (New file).
	* gm2/pim/fail/opcpfail.mod: (New file).
	* gm2/pim/fail/pim-fail.exp: (New file).
	* gm2/pim/fail/procmod.mod: (New file).
	* gm2/pim/fail/rotate.mod: (New file).
	* gm2/pim/fail/rotate2.mod: (New file).
	* gm2/pim/fail/setbec.mod: (New file).
	* gm2/pim/fail/setequiv.mod: (New file).
	* gm2/pim/fail/setsnulf.mod: (New file).
	* gm2/pim/fail/settype.mod: (New file).
	* gm2/pim/fail/shift.mod: (New file).
	* gm2/pim/fail/shift2.mod: (New file).
	* gm2/pim/fail/subrange7.mod: (New file).
	* gm2/pim/fail/unary.mod: (New file).
	* gm2/pim/fail/undeclared.mod: (New file).
	* gm2/pim/fail/val.mod: (New file).
	* gm2/pim/fail/val2.mod: (New file).
	* gm2/pim/fail/wordconst.mod: (New file).
	* gm2/pim/no-options/run/pass/integer.mod: (New file).
	* gm2/pim/no-options/run/pass/pim-no-options-run-pass.exp: (New file).
	* gm2/pim/options/bounds/fail/IdentifierBug.mod: (New file).
	* gm2/pim/options/bounds/fail/pim-options-bounds-fail.exp: (New file).
	* gm2/pim/options/optimize/run/pass/addition.def: (New file).
	* gm2/pim/options/optimize/run/pass/addition.mod: (New file).
	* gm2/pim/options/optimize/run/pass/concat.mod: (New file).
	* gm2/pim/options/optimize/run/pass/pim-options-optimize-run-pass.exp:
	(New file).
	* gm2/pim/options/optimize/run/pass/testadd.mod: (New file).
	* gm2/pim/pass/ABSBug.mod: (New file).
	* gm2/pim/pass/TestLong4.mod: (New file).
	* gm2/pim/pass/TestLong7.mod: (New file).
	* gm2/pim/pass/TestLong8.mod: (New file).
	* gm2/pim/pass/TestLong9.mod: (New file).
	* gm2/pim/pass/another.mod: (New file).
	* gm2/pim/pass/aochar.mod: (New file).
	* gm2/pim/pass/array.mod: (New file).
	* gm2/pim/pass/array2.mod: (New file).
	* gm2/pim/pass/array3.mod: (New file).
	* gm2/pim/pass/array4.mod: (New file).
	* gm2/pim/pass/array5.mod: (New file).
	* gm2/pim/pass/array6.mod: (New file).
	* gm2/pim/pass/arraybool.mod: (New file).
	* gm2/pim/pass/arraychar.mod: (New file).
	* gm2/pim/pass/arraychar2.mod: (New file).
	* gm2/pim/pass/arraychar3.mod: (New file).
	* gm2/pim/pass/arrayconst1.mod: (New file).
	* gm2/pim/pass/arrayconst2.mod: (New file).
	* gm2/pim/pass/arrayconst3.mod: (New file).
	* gm2/pim/pass/arraydecl.mod: (New file).
	* gm2/pim/pass/arraydim.mod: (New file).
	* gm2/pim/pass/arraydyn.mod: (New file).
	* gm2/pim/pass/arrayeqiv.mod: (New file).
	* gm2/pim/pass/arrayfio.mod: (New file).
	* gm2/pim/pass/arrayhuge.mod: (New file).
	* gm2/pim/pass/arrayhuge2.mod: (New file).
	* gm2/pim/pass/arrayindex.mod: (New file).
	* gm2/pim/pass/arrayindirect.mod: (New file).
	* gm2/pim/pass/arrayinproc.mod: (New file).
	* gm2/pim/pass/arrayint.mod: (New file).
	* gm2/pim/pass/arrayofbyte.mod: (New file).
	* gm2/pim/pass/arrayofcard.mod: (New file).
	* gm2/pim/pass/arrayptr.mod: (New file).
	* gm2/pim/pass/arrayptr2.mod: (New file).
	* gm2/pim/pass/arrayptr3.mod: (New file).
	* gm2/pim/pass/arrayptr4.mod: (New file).
	* gm2/pim/pass/arrayptr5.mod: (New file).
	* gm2/pim/pass/arrayptr6.mod: (New file).
	* gm2/pim/pass/arrayrecord.mod: (New file).
	* gm2/pim/pass/arraytiny.c: (New file).
	* gm2/pim/pass/arraytiny.mod: (New file).
	* gm2/pim/pass/arraytype.mod: (New file).
	* gm2/pim/pass/arraytype2.mod: (New file).
	* gm2/pim/pass/arraytype3.mod: (New file).
	* gm2/pim/pass/arraytype4.mod: (New file).
	* gm2/pim/pass/assignment.mod: (New file).
	* gm2/pim/pass/assignment2.mod: (New file).
	* gm2/pim/pass/assignment3.mod: (New file).
	* gm2/pim/pass/assignment4.mod: (New file).
	* gm2/pim/pass/badpointer.mod: (New file).
	* gm2/pim/pass/bits32.def: (New file).
	* gm2/pim/pass/bits32.mod: (New file).
	* gm2/pim/pass/bits32i.mod: (New file).
	* gm2/pim/pass/bitset.mod: (New file).
	* gm2/pim/pass/bitset2.mod: (New file).
	* gm2/pim/pass/bitset3.mod: (New file).
	* gm2/pim/pass/bitset4.mod: (New file).
	* gm2/pim/pass/bitset5.mod: (New file).
	* gm2/pim/pass/bitsetfunc.mod: (New file).
	* gm2/pim/pass/block.mod: (New file).
	* gm2/pim/pass/blockindirect.mod: (New file).
	* gm2/pim/pass/builtin.def: (New file).
	* gm2/pim/pass/builtin.mod: (New file).
	* gm2/pim/pass/builtin2.mod: (New file).
	* gm2/pim/pass/builtinconst.mod: (New file).
	* gm2/pim/pass/bytearray.mod: (New file).
	* gm2/pim/pass/card.mod: (New file).
	* gm2/pim/pass/card2.mod: (New file).
	* gm2/pim/pass/char.mod: (New file).
	* gm2/pim/pass/char2.mod: (New file).
	* gm2/pim/pass/charproc.mod: (New file).
	* gm2/pim/pass/charset.mod: (New file).
	* gm2/pim/pass/charset2.mod: (New file).
	* gm2/pim/pass/charset3.mod: (New file).
	* gm2/pim/pass/checkparm.def: (New file).
	* gm2/pim/pass/checkparm.mod: (New file).
	* gm2/pim/pass/colour.mod: (New file).
	* gm2/pim/pass/comment1.mod: (New file).
	* gm2/pim/pass/complexarray.mod: (New file).
	* gm2/pim/pass/complextypes.mod: (New file).
	* gm2/pim/pass/constcast.mod: (New file).
	* gm2/pim/pass/constmax.mod: (New file).
	* gm2/pim/pass/constset.mod: (New file).
	* gm2/pim/pass/constset2.mod: (New file).
	* gm2/pim/pass/constset3.mod: (New file).
	* gm2/pim/pass/constsize.mod: (New file).
	* gm2/pim/pass/constsize2.mod: (New file).
	* gm2/pim/pass/convert.mod: (New file).
	* gm2/pim/pass/convert2.mod: (New file).
	* gm2/pim/pass/convert3.mod: (New file).
	* gm2/pim/pass/convert4.mod: (New file).
	* gm2/pim/pass/danglingelse.mod: (New file).
	* gm2/pim/pass/debug: (New file).
	* gm2/pim/pass/defset.def: (New file).
	* gm2/pim/pass/defset.mod: (New file).
	* gm2/pim/pass/deftype.mod: (New file).
	* gm2/pim/pass/divaddr.mod: (New file).
	* gm2/pim/pass/enum.mod: (New file).
	* gm2/pim/pass/enum2.mod: (New file).
	* gm2/pim/pass/enum3.mod: (New file).
	* gm2/pim/pass/file.mod: (New file).
	* gm2/pim/pass/filesystem.mod: (New file).
	* gm2/pim/pass/foo.mod: (New file).
	* gm2/pim/pass/foo2.mod: (New file).
	* gm2/pim/pass/for1.mod: (New file).
	* gm2/pim/pass/function.mod: (New file).
	* gm2/pim/pass/function2.mod: (New file).
	* gm2/pim/pass/gcd.def: (New file).
	* gm2/pim/pass/gcd.mod: (New file).
	* gm2/pim/pass/getconst.mod: (New file).
	* gm2/pim/pass/hello.mod: (New file).
	* gm2/pim/pass/impa.mod: (New file).
	* gm2/pim/pass/impb.def: (New file).
	* gm2/pim/pass/impb.mod: (New file).
	* gm2/pim/pass/impc.def: (New file).
	* gm2/pim/pass/impc.mod: (New file).
	* gm2/pim/pass/impd.mod: (New file).
	* gm2/pim/pass/impe.mod: (New file).
	* gm2/pim/pass/impf.mod: (New file).
	* gm2/pim/pass/impg.mod: (New file).
	* gm2/pim/pass/imph.mod: (New file).
	* gm2/pim/pass/impi.mod: (New file).
	* gm2/pim/pass/impj.mod: (New file).
	* gm2/pim/pass/impk.mod: (New file).
	* gm2/pim/pass/impl.mod: (New file).
	* gm2/pim/pass/impm.mod: (New file).
	* gm2/pim/pass/impn.def: (New file).
	* gm2/pim/pass/impn.mod: (New file).
	* gm2/pim/pass/impo.mod: (New file).
	* gm2/pim/pass/imports.mod: (New file).
	* gm2/pim/pass/impp.def: (New file).
	* gm2/pim/pass/impp.mod: (New file).
	* gm2/pim/pass/impq.def: (New file).
	* gm2/pim/pass/impq.mod: (New file).
	* gm2/pim/pass/incompsets.mod: (New file).
	* gm2/pim/pass/index.mod: (New file).
	* gm2/pim/pass/index2.mod: (New file).
	* gm2/pim/pass/indirect.mod: (New file).
	* gm2/pim/pass/inner.mod: (New file).
	* gm2/pim/pass/inner2.mod: (New file).
	* gm2/pim/pass/int.mod: (New file).
	* gm2/pim/pass/largeset.mod: (New file).
	* gm2/pim/pass/largeset1.mod: (New file).
	* gm2/pim/pass/largeset2.mod: (New file).
	* gm2/pim/pass/largeset3.mod: (New file).
	* gm2/pim/pass/largeset4.mod: (New file).
	* gm2/pim/pass/largeset5.mod: (New file).
	* gm2/pim/pass/largeset6.mod: (New file).
	* gm2/pim/pass/largeset7.mod: (New file).
	* gm2/pim/pass/localmod.mod: (New file).
	* gm2/pim/pass/localproc.mod: (New file).
	* gm2/pim/pass/localvar.mod: (New file).
	* gm2/pim/pass/log: (New file).
	* gm2/pim/pass/longint.mod: (New file).
	* gm2/pim/pass/longint2.mod: (New file).
	* gm2/pim/pass/longmm.mod: (New file).
	* gm2/pim/pass/longreal.mod: (New file).
	* gm2/pim/pass/longtypes.mod: (New file).
	* gm2/pim/pass/longtypes3.mod: (New file).
	* gm2/pim/pass/longtypes4.mod: (New file).
	* gm2/pim/pass/longtypes5.mod: (New file).
	* gm2/pim/pass/longtypes6.mod: (New file).
	* gm2/pim/pass/loopexit.mod: (New file).
	* gm2/pim/pass/math.mod: (New file).
	* gm2/pim/pass/maxlongint.mod: (New file).
	* gm2/pim/pass/maxreal.mod: (New file).
	* gm2/pim/pass/maxreal2.mod: (New file).
	* gm2/pim/pass/minmaxconst.mod: (New file).
	* gm2/pim/pass/minmaxconst2.mod: (New file).
	* gm2/pim/pass/modaddr.mod: (New file).
	* gm2/pim/pass/multaddr.mod: (New file).
	* gm2/pim/pass/multiple.mod: (New file).
	* gm2/pim/pass/multiset.mod: (New file).
	* gm2/pim/pass/multtypes.mod: (New file).
	* gm2/pim/pass/mydef.def: (New file).
	* gm2/pim/pass/negatives.def: (New file).
	* gm2/pim/pass/negatives.mod: (New file).
	* gm2/pim/pass/nested.mod: (New file).
	* gm2/pim/pass/nested2.mod: (New file).
	* gm2/pim/pass/nested3.mod: (New file).
	* gm2/pim/pass/nested4.mod: (New file).
	* gm2/pim/pass/nested5.mod: (New file).
	* gm2/pim/pass/nested6.mod: (New file).
	* gm2/pim/pass/nested7.mod: (New file).
	* gm2/pim/pass/nestedfor.mod: (New file).
	* gm2/pim/pass/nestedif.mod: (New file).
	* gm2/pim/pass/nestedset.mod: (New file).
	* gm2/pim/pass/onezero.mod: (New file).
	* gm2/pim/pass/opaque.def: (New file).
	* gm2/pim/pass/opaque.mod: (New file).
	* gm2/pim/pass/opaque2.mod: (New file).
	* gm2/pim/pass/opaquetype.def: (New file).
	* gm2/pim/pass/opaquetype.mod: (New file).
	* gm2/pim/pass/param.mod: (New file).
	* gm2/pim/pass/param2.mod: (New file).
	* gm2/pim/pass/param3.mod: (New file).
	* gm2/pim/pass/parambool.mod: (New file).
	* gm2/pim/pass/paramreal.mod: (New file).
	* gm2/pim/pass/pim-pass.exp: (New file).
	* gm2/pim/pass/pimimp.mod: (New file).
	* gm2/pim/pass/pointer.mod: (New file).
	* gm2/pim/pass/procadr.mod: (New file).
	* gm2/pim/pass/procconv.mod: (New file).
	* gm2/pim/pass/procconv2.mod: (New file).
	* gm2/pim/pass/procedure1.mod: (New file).
	* gm2/pim/pass/procedure2.mod: (New file).
	* gm2/pim/pass/procindirect.mod: (New file).
	* gm2/pim/pass/procmod.mod: (New file).
	* gm2/pim/pass/procmod2.mod: (New file).
	* gm2/pim/pass/procmod3.mod: (New file).
	* gm2/pim/pass/procmod31.mod: (New file).
	* gm2/pim/pass/procmod4.mod: (New file).
	* gm2/pim/pass/procmod5.mod: (New file).
	* gm2/pim/pass/procmod6.def: (New file).
	* gm2/pim/pass/procmod6.mod: (New file).
	* gm2/pim/pass/procmod7.mod: (New file).
	* gm2/pim/pass/procmod8.mod: (New file).
	* gm2/pim/pass/procmod9.mod: (New file).
	* gm2/pim/pass/proctype.mod: (New file).
	* gm2/pim/pass/proctype2.def: (New file).
	* gm2/pim/pass/proctype3.mod: (New file).
	* gm2/pim/pass/proctype4.mod: (New file).
	* gm2/pim/pass/program.mod: (New file).
	* gm2/pim/pass/program2.mod: (New file).
	* gm2/pim/pass/ptrarray.mod: (New file).
	* gm2/pim/pass/ptrarray2.mod: (New file).
	* gm2/pim/pass/ptrarray3.mod: (New file).
	* gm2/pim/pass/ptrcard.mod: (New file).
	* gm2/pim/pass/quads.def: (New file).
	* gm2/pim/pass/quads.mod: (New file).
	* gm2/pim/pass/real.mod: (New file).
	* gm2/pim/pass/real2.mod: (New file).
	* gm2/pim/pass/real3.mod: (New file).
	* gm2/pim/pass/realconst.mod: (New file).
	* gm2/pim/pass/realneg.mod: (New file).
	* gm2/pim/pass/realneg2.mod: (New file).
	* gm2/pim/pass/realone.mod: (New file).
	* gm2/pim/pass/realsize.mod: (New file).
	* gm2/pim/pass/record1.mod: (New file).
	* gm2/pim/pass/record10.mod: (New file).
	* gm2/pim/pass/record11.mod: (New file).
	* gm2/pim/pass/record12.def: (New file).
	* gm2/pim/pass/record13.def: (New file).
	* gm2/pim/pass/record14.def: (New file).
	* gm2/pim/pass/record15.def: (New file).
	* gm2/pim/pass/record16.def: (New file).
	* gm2/pim/pass/record2.mod: (New file).
	* gm2/pim/pass/record3.mod: (New file).
	* gm2/pim/pass/record4.mod: (New file).
	* gm2/pim/pass/record5.mod: (New file).
	* gm2/pim/pass/record6.mod: (New file).
	* gm2/pim/pass/record7.mod: (New file).
	* gm2/pim/pass/record8.mod: (New file).
	* gm2/pim/pass/record9.mod: (New file).
	* gm2/pim/pass/recordarray.c: (New file).
	* gm2/pim/pass/recordarray.mod: (New file).
	* gm2/pim/pass/recordarray2.mod: (New file).
	* gm2/pim/pass/redef.mod: (New file).
	* gm2/pim/pass/set10.mod: (New file).
	* gm2/pim/pass/set11.def: (New file).
	* gm2/pim/pass/set11.mod: (New file).
	* gm2/pim/pass/set12.mod: (New file).
	* gm2/pim/pass/set4.mod: (New file).
	* gm2/pim/pass/set5.mod: (New file).
	* gm2/pim/pass/set6.mod: (New file).
	* gm2/pim/pass/set7.mod: (New file).
	* gm2/pim/pass/set8.mod: (New file).
	* gm2/pim/pass/set9.mod: (New file).
	* gm2/pim/pass/setchar.mod: (New file).
	* gm2/pim/pass/setchar10.mod: (New file).
	* gm2/pim/pass/setchar11.mod: (New file).
	* gm2/pim/pass/setchar3.mod: (New file).
	* gm2/pim/pass/setchar4.mod: (New file).
	* gm2/pim/pass/setchar5.mod: (New file).
	* gm2/pim/pass/setchar7.mod: (New file).
	* gm2/pim/pass/setchar8.mod: (New file).
	* gm2/pim/pass/setchar9.mod: (New file).
	* gm2/pim/pass/setconst.mod: (New file).
	* gm2/pim/pass/setconst2.mod: (New file).
	* gm2/pim/pass/setconst3.mod: (New file).
	* gm2/pim/pass/setenum.mod: (New file).
	* gm2/pim/pass/setimp.mod: (New file).
	* gm2/pim/pass/setimp2.mod: (New file).
	* gm2/pim/pass/setofchar.mod: (New file).
	* gm2/pim/pass/setoverflow.mod: (New file).
	* gm2/pim/pass/sets.mod: (New file).
	* gm2/pim/pass/sets2.mod: (New file).
	* gm2/pim/pass/sets3.mod: (New file).
	* gm2/pim/pass/sets4.mod: (New file).
	* gm2/pim/pass/sets5.mod: (New file).
	* gm2/pim/pass/sets6.mod: (New file).
	* gm2/pim/pass/setsnul.mod: (New file).
	* gm2/pim/pass/settest1.mod: (New file).
	* gm2/pim/pass/settest2.mod: (New file).
	* gm2/pim/pass/settest3.mod: (New file).
	* gm2/pim/pass/simpleproc.mod: (New file).
	* gm2/pim/pass/sizes.mod: (New file).
	* gm2/pim/pass/sizetype.mod: (New file).
	* gm2/pim/pass/smallset1.mod: (New file).
	* gm2/pim/pass/smallset2.mod: (New file).
	* gm2/pim/pass/smallset3.mod: (New file).
	* gm2/pim/pass/smallset4.mod: (New file).
	* gm2/pim/pass/smallset5.mod: (New file).
	* gm2/pim/pass/smallset6.mod: (New file).
	* gm2/pim/pass/smallset7.mod: (New file).
	* gm2/pim/pass/stabs.mod: (New file).
	* gm2/pim/pass/stdio.mod: (New file).
	* gm2/pim/pass/str1.mod: (New file).
	* gm2/pim/pass/str2.mod: (New file).
	* gm2/pim/pass/str3.mod: (New file).
	* gm2/pim/pass/str4.mod: (New file).
	* gm2/pim/pass/str5.mod: (New file).
	* gm2/pim/pass/stressset.mod: (New file).
	* gm2/pim/pass/stringassign.mod: (New file).
	* gm2/pim/pass/stringopaq.mod: (New file).
	* gm2/pim/pass/strings.mod: (New file).
	* gm2/pim/pass/strparam.def: (New file).
	* gm2/pim/pass/strparam.mod: (New file).
	* gm2/pim/pass/subrange.mod: (New file).
	* gm2/pim/pass/subrange10.mod: (New file).
	* gm2/pim/pass/subrange11.mod: (New file).
	* gm2/pim/pass/subrange12.mod: (New file).
	* gm2/pim/pass/subrange14.mod: (New file).
	* gm2/pim/pass/subrange15.mod: (New file).
	* gm2/pim/pass/subrange16.mod: (New file).
	* gm2/pim/pass/subrange17.mod: (New file).
	* gm2/pim/pass/subrange2.mod: (New file).
	* gm2/pim/pass/subrange3.mod: (New file).
	* gm2/pim/pass/subrange4.mod: (New file).
	* gm2/pim/pass/subrange5.mod: (New file).
	* gm2/pim/pass/subrange6.mod: (New file).
	* gm2/pim/pass/subrange7.mod: (New file).
	* gm2/pim/pass/subrange8.mod: (New file).
	* gm2/pim/pass/subrange9.mod: (New file).
	* gm2/pim/pass/test2recursive.mod: (New file).
	* gm2/pim/pass/testabs.mod: (New file).
	* gm2/pim/pass/testbuiltin.mod: (New file).
	* gm2/pim/pass/testbuiltin2.mod: (New file).
	* gm2/pim/pass/testbuiltstr.mod: (New file).
	* gm2/pim/pass/testcap.mod: (New file).
	* gm2/pim/pass/testcap2.mod: (New file).
	* gm2/pim/pass/testcard.mod: (New file).
	* gm2/pim/pass/testcard2.mod: (New file).
	* gm2/pim/pass/testcard3.mod: (New file).
	* gm2/pim/pass/testcard4.mod: (New file).
	* gm2/pim/pass/testcard5.mod: (New file).
	* gm2/pim/pass/testcase.mod: (New file).
	* gm2/pim/pass/testcase2.mod: (New file).
	* gm2/pim/pass/testcase3.mod: (New file).
	* gm2/pim/pass/testcase4.mod: (New file).
	* gm2/pim/pass/testchar.mod: (New file).
	* gm2/pim/pass/testfloat.mod: (New file).
	* gm2/pim/pass/testfloat2.mod: (New file).
	* gm2/pim/pass/testfloat3.mod: (New file).
	* gm2/pim/pass/testfloat4.mod: (New file).
	* gm2/pim/pass/testfor.mod: (New file).
	* gm2/pim/pass/testimpvar.mod: (New file).
	* gm2/pim/pass/testlong3.mod: (New file).
	* gm2/pim/pass/testmod.mod: (New file).
	* gm2/pim/pass/testmod2.mod: (New file).
	* gm2/pim/pass/testodd.mod: (New file).
	* gm2/pim/pass/testopaque.mod: (New file).
	* gm2/pim/pass/testopaque2.mod: (New file).
	* gm2/pim/pass/testopaque3.mod: (New file).
	* gm2/pim/pass/testord.mod: (New file).
	* gm2/pim/pass/testparam.mod: (New file).
	* gm2/pim/pass/testparam2.mod: (New file).
	* gm2/pim/pass/testparam3.mod: (New file).
	* gm2/pim/pass/testpimsize.mod: (New file).
	* gm2/pim/pass/testrecursive.def: (New file).
	* gm2/pim/pass/testrecursive.mod: (New file).
	* gm2/pim/pass/testreturnstr.mod: (New file).
	* gm2/pim/pass/testset.mod: (New file).
	* gm2/pim/pass/testshort.mod: (New file).
	* gm2/pim/pass/testsinf.mod: (New file).
	* gm2/pim/pass/testsinl.mod: (New file).
	* gm2/pim/pass/testsize.mod: (New file).
	* gm2/pim/pass/testvar.mod: (New file).
	* gm2/pim/pass/testvarin.mod: (New file).
	* gm2/pim/pass/timeio.mod: (New file).
	* gm2/pim/pass/timeio2.mod: (New file).
	* gm2/pim/pass/timeio3.mod: (New file).
	* gm2/pim/pass/timeio4.mod: (New file).
	* gm2/pim/pass/timeio5.mod: (New file).
	* gm2/pim/pass/timeio6.mod: (New file).
	* gm2/pim/pass/timeio7.mod: (New file).
	* gm2/pim/pass/timeio8.mod: (New file).
	* gm2/pim/pass/timeio9.mod: (New file).
	* gm2/pim/pass/tinyalloc.mod: (New file).
	* gm2/pim/pass/tinyarray.mod: (New file).
	* gm2/pim/pass/tinyarray2.mod: (New file).
	* gm2/pim/pass/tinyarray3.mod: (New file).
	* gm2/pim/pass/tinyarray4.mod: (New file).
	* gm2/pim/pass/tinyarray5.mod: (New file).
	* gm2/pim/pass/tinyarray6.mod: (New file).
	* gm2/pim/pass/tinyassign.def: (New file).
	* gm2/pim/pass/tinyassign.mod: (New file).
	* gm2/pim/pass/tinyassign2.mod: (New file).
	* gm2/pim/pass/tinyassign3.mod: (New file).
	* gm2/pim/pass/tinyassign4.mod: (New file).
	* gm2/pim/pass/tinyassign5.mod: (New file).
	* gm2/pim/pass/tinybitset.mod: (New file).
	* gm2/pim/pass/tinyelse.mod: (New file).
	* gm2/pim/pass/tinyenum.mod: (New file).
	* gm2/pim/pass/tinyfor.mod: (New file).
	* gm2/pim/pass/tinyfor2.mod: (New file).
	* gm2/pim/pass/tinyfor3.mod: (New file).
	* gm2/pim/pass/tinyhalt.mod: (New file).
	* gm2/pim/pass/tinyhello.mod: (New file).
	* gm2/pim/pass/tinyif.mod: (New file).
	* gm2/pim/pass/tinyif2.mod: (New file).
	* gm2/pim/pass/tinyif3.mod: (New file).
	* gm2/pim/pass/tinyif4.mod: (New file).
	* gm2/pim/pass/tinyif5.mod: (New file).
	* gm2/pim/pass/tinyif6.mod: (New file).
	* gm2/pim/pass/tinyif7.mod: (New file).
	* gm2/pim/pass/tinyif8.mod: (New file).
	* gm2/pim/pass/tinyimp.mod: (New file).
	* gm2/pim/pass/tinylit.mod: (New file).
	* gm2/pim/pass/tinylit2.mod: (New file).
	* gm2/pim/pass/tinymax.mod: (New file).
	* gm2/pim/pass/tinymod.mod: (New file).
	* gm2/pim/pass/tinynode.mod: (New file).
	* gm2/pim/pass/tinyparam.mod: (New file).
	* gm2/pim/pass/tinyparam2.mod: (New file).
	* gm2/pim/pass/tinyplus.mod: (New file).
	* gm2/pim/pass/tinyproc.mod: (New file).
	* gm2/pim/pass/tinyproc2.mod: (New file).
	* gm2/pim/pass/tinyproc3.mod: (New file).
	* gm2/pim/pass/tinyproc4.mod: (New file).
	* gm2/pim/pass/tinyproc5.mod: (New file).
	* gm2/pim/pass/tinyproc6.mod: (New file).
	* gm2/pim/pass/tinyptr.mod: (New file).
	* gm2/pim/pass/tinyreal.mod: (New file).
	* gm2/pim/pass/tinyrecord.mod: (New file).
	* gm2/pim/pass/tinyrepeat.mod: (New file).
	* gm2/pim/pass/tinyset6.mod: (New file).
	* gm2/pim/pass/tinyset7.mod: (New file).
	* gm2/pim/pass/tinystate.mod: (New file).
	* gm2/pim/pass/tinysub.def: (New file).
	* gm2/pim/pass/tinytest.mod: (New file).
	* gm2/pim/pass/tinytrue.mod: (New file).
	* gm2/pim/pass/tinyvar.mod: (New file).
	* gm2/pim/pass/tinyvar2.mod: (New file).
	* gm2/pim/pass/tinyvar3.mod: (New file).
	* gm2/pim/pass/tinyvar4.mod: (New file).
	* gm2/pim/pass/tinyvar5.mod: (New file).
	* gm2/pim/pass/tinyvarient.mod: (New file).
	* gm2/pim/pass/tinyvarient2.mod: (New file).
	* gm2/pim/pass/tinyvarient3.def: (New file).
	* gm2/pim/pass/tinyvarient3.mod: (New file).
	* gm2/pim/pass/tinyvarient4.mod: (New file).
	* gm2/pim/pass/tinyvarient5.mod: (New file).
	* gm2/pim/pass/tinyvarient6.mod: (New file).
	* gm2/pim/pass/tinywhile.mod: (New file).
	* gm2/pim/pass/tinywith.mod: (New file).
	* gm2/pim/pass/tinywith2.mod: (New file).
	* gm2/pim/pass/tinywith3.mod: (New file).
	* gm2/pim/pass/tinywith4.mod: (New file).
	* gm2/pim/pass/tinywith5.mod: (New file).
	* gm2/pim/pass/tinywith6.mod: (New file).
	* gm2/pim/pass/trunc.mod: (New file).
	* gm2/pim/pass/try: (New file).
	* gm2/pim/pass/typeequiv.mod: (New file).
	* gm2/pim/pass/typeequiv2.mod: (New file).
	* gm2/pim/pass/typeequiv3.mod: (New file).
	* gm2/pim/pass/typeonly.def: (New file).
	* gm2/pim/pass/typeonly.mod: (New file).
	* gm2/pim/pass/typesize.mod: (New file).
	* gm2/pim/pass/unbounded.mod: (New file).
	* gm2/pim/pass/unbounded2.mod: (New file).
	* gm2/pim/pass/unbounded3.mod: (New file).
	* gm2/pim/pass/v.def: (New file).
	* gm2/pim/pass/varaddress.mod: (New file).
	* gm2/pim/pass/varaddress2.mod: (New file).
	* gm2/pim/pass/varaddress3.mod: (New file).
	* gm2/pim/pass/varcard.mod: (New file).
	* gm2/pim/pass/variant9.mod: (New file).
	* gm2/pim/pass/varient.mod: (New file).
	* gm2/pim/pass/varient2.mod: (New file).
	* gm2/pim/pass/varient3.mod: (New file).
	* gm2/pim/pass/varient4.mod: (New file).
	* gm2/pim/pass/varient5.mod: (New file).
	* gm2/pim/pass/varient6.mod: (New file).
	* gm2/pim/pass/varient7.mod: (New file).
	* gm2/pim/pass/varient8.mod: (New file).
	* gm2/pim/pass/varin.def: (New file).
	* gm2/pim/pass/varin.mod: (New file).
	* gm2/pim/pass/varint.mod: (New file).
	* gm2/pim/pass/wincat.mod: (New file).
	* gm2/pim/pass/with.mod: (New file).
	* gm2/pim/pass/wordconst.mod: (New file).
	* gm2/pim/run/fail/case.mod: (New file).
	* gm2/pim/run/fail/nil.mod: (New file).
	* gm2/pim/run/fail/pim-run-fail.exp: (New file).
	* gm2/pim/run/pass/Countdown.mod: (New file).
	* gm2/pim/run/pass/EndFor.def: (New file).
	* gm2/pim/run/pass/EndFor.mod: (New file).
	* gm2/pim/run/pass/EnumTest.mod: (New file).
	* gm2/pim/run/pass/For1.mod: (New file).
	* gm2/pim/run/pass/For10.mod: (New file).
	* gm2/pim/run/pass/For11.mod: (New file).
	* gm2/pim/run/pass/For12.mod: (New file).
	* gm2/pim/run/pass/For2.mod: (New file).
	* gm2/pim/run/pass/For3.mod: (New file).
	* gm2/pim/run/pass/For4.mod: (New file).
	* gm2/pim/run/pass/For5.mod: (New file).
	* gm2/pim/run/pass/For6.mod: (New file).
	* gm2/pim/run/pass/For7.mod: (New file).
	* gm2/pim/run/pass/For8.mod: (New file).
	* gm2/pim/run/pass/For9.mod: (New file).
	* gm2/pim/run/pass/FpuIOBug.mod: (New file).
	* gm2/pim/run/pass/MaxReal.mod: (New file).
	* gm2/pim/run/pass/MaxReal2.mod: (New file).
	* gm2/pim/run/pass/TestLong.mod: (New file).
	* gm2/pim/run/pass/TestLong2.mod: (New file).
	* gm2/pim/run/pass/TestLong4.mod: (New file).
	* gm2/pim/run/pass/TestLong5.mod: (New file).
	* gm2/pim/run/pass/addrarray.mod: (New file).
	* gm2/pim/run/pass/arraychar.mod: (New file).
	* gm2/pim/run/pass/arraychar2.mod: (New file).
	* gm2/pim/run/pass/arrayrecord.mod: (New file).
	* gm2/pim/run/pass/bitsettest.def: (New file).
	* gm2/pim/run/pass/bitsettest.mod: (New file).
	* gm2/pim/run/pass/bytearray.mod: (New file).
	* gm2/pim/run/pass/constdynstr.mod: (New file).
	* gm2/pim/run/pass/conststr.mod: (New file).
	* gm2/pim/run/pass/conststr2.mod: (New file).
	* gm2/pim/run/pass/cycles.mod: (New file).
	* gm2/pim/run/pass/dec.mod: (New file).
	* gm2/pim/run/pass/enums.mod: (New file).
	* gm2/pim/run/pass/incsubrange.def: (New file).
	* gm2/pim/run/pass/incsubrange.mod: (New file).
	* gm2/pim/run/pass/index3.mod: (New file).
	* gm2/pim/run/pass/int16.mod: (New file).
	* gm2/pim/run/pass/int32.mod: (New file).
	* gm2/pim/run/pass/int8.mod: (New file).
	* gm2/pim/run/pass/line.mod: (New file).
	* gm2/pim/run/pass/long.mod: (New file).
	* gm2/pim/run/pass/longfor.mod: (New file).
	* gm2/pim/run/pass/longtypes10.mod: (New file).
	* gm2/pim/run/pass/longtypes7.mod: (New file).
	* gm2/pim/run/pass/longtypes8.mod: (New file).
	* gm2/pim/run/pass/longtypes9.mod: (New file).
	* gm2/pim/run/pass/math.mod: (New file).
	* gm2/pim/run/pass/math2.mod: (New file).
	* gm2/pim/run/pass/mathconst.mod: (New file).
	* gm2/pim/run/pass/minhello.mod: (New file).
	* gm2/pim/run/pass/minimal.mod: (New file).
	* gm2/pim/run/pass/nestedproc.mod: (New file).
	* gm2/pim/run/pass/nestedproc2.mod: (New file).
	* gm2/pim/run/pass/nestedproc3.mod: (New file).
	* gm2/pim/run/pass/nestedproc4.mod: (New file).
	* gm2/pim/run/pass/nestedproc5.mod: (New file).
	* gm2/pim/run/pass/nestedproc6.mod: (New file).
	* gm2/pim/run/pass/nestedproc7.mod: (New file).
	* gm2/pim/run/pass/nestedwith.mod: (New file).
	* gm2/pim/run/pass/nestedwith2.mod: (New file).
	* gm2/pim/run/pass/nestedwith3.mod: (New file).
	* gm2/pim/run/pass/nothing.mod: (New file).
	* gm2/pim/run/pass/pim-run-pass.exp: (New file).
	* gm2/pim/run/pass/prog31ex.mod: (New file).
	* gm2/pim/run/pass/rts.mod: (New file).
	* gm2/pim/run/pass/setcritical.mod: (New file).
	* gm2/pim/run/pass/setequiv.mod: (New file).
	* gm2/pim/run/pass/str6.mod: (New file).
	* gm2/pim/run/pass/stringaddr.mod: (New file).
	* gm2/pim/run/pass/stringaddr2.def: (New file).
	* gm2/pim/run/pass/stringaddr2.mod: (New file).
	* gm2/pim/run/pass/stripped.mod: (New file).
	* gm2/pim/run/pass/sys.def: (New file).
	* gm2/pim/run/pass/sys.mod: (New file).
	* gm2/pim/run/pass/t.def: (New file).
	* gm2/pim/run/pass/testaddr.mod: (New file).
	* gm2/pim/run/pass/testaddr2.mod: (New file).
	* gm2/pim/run/pass/testaddr3.mod: (New file).
	* gm2/pim/run/pass/testarray.mod: (New file).
	* gm2/pim/run/pass/testarray2.mod: (New file).
	* gm2/pim/run/pass/testarray3.mod: (New file).
	* gm2/pim/run/pass/testarray4.mod: (New file).
	* gm2/pim/run/pass/testarray5.mod: (New file).
	* gm2/pim/run/pass/testavail.mod: (New file).
	* gm2/pim/run/pass/testdiv.mod: (New file).
	* gm2/pim/run/pass/testfpufunc.mod: (New file).
	* gm2/pim/run/pass/testfpufunc2.mod: (New file).
	* gm2/pim/run/pass/testlarge.mod: (New file).
	* gm2/pim/run/pass/testlarge2.mod: (New file).
	* gm2/pim/run/pass/testnextproc.mod: (New file).
	* gm2/pim/run/pass/testparam.mod: (New file).
	* gm2/pim/run/pass/testreturnstr.mod: (New file).
	* gm2/pim/run/pass/testreturnstr2.mod: (New file).
	* gm2/pim/run/pass/testreturnstr3.def: (New file).
	* gm2/pim/run/pass/testreturnstr3.mod: (New file).
	* gm2/pim/run/pass/testsize.mod: (New file).
	* gm2/pim/run/pass/testsize2.mod: (New file).
	* gm2/pim/run/pass/testsize3.mod: (New file).
	* gm2/pim/run/pass/testsize4.mod: (New file).
	* gm2/pim/run/pass/testtbitsize.mod: (New file).
	* gm2/pim/run/pass/tinywith.mod: (New file).
	* gm2/pim/run/pass/unbounded.mod: (New file).
	* gm2/pim/run/pass/varaddress3.mod: (New file).
	* gm2/pim/run/pass/varparam2.mod: (New file).
	* gm2/pim/run/pass/varparam3.mod: (New file).
	* gm2/pim/run/pass/varparm.mod: (New file).
	* gm2/pim/run/pass/wr.mod: (New file).
	* gm2/pimcoroutines/pass/imports.mod: (New file).
	* gm2/pimcoroutines/pass/imports2.mod: (New file).
	* gm2/pimcoroutines/pass/pimcoroutines-pass.exp: (New file).
	* gm2/pimcoroutines/run/pass/pimcoroutines-run-pass.exp: (New file).
	* gm2/pimcoroutines/run/pass/testtime.mod: (New file).
	* gm2/pimlib/base/run/pass/FIO.mod: (New file).
	* gm2/pimlib/base/run/pass/StrLib.mod: (New file).
	* gm2/pimlib/base/run/pass/pimlib-base-run-pass.exp: (New file).
	* gm2/pimlib/base/run/pass/testconvert.mod: (New file).
	* gm2/pimlib/coroutines/pass/pimlib-coroutines-pass.exp: (New file).
	* gm2/pimlib/coroutines/pass/priority.mod: (New file).
	* gm2/pimlib/coroutines/pass/priority2.mod: (New file).
	* gm2/pimlib/coroutines/pass/priority3.def: (New file).
	* gm2/pimlib/coroutines/pass/priority3.mod: (New file).
	* gm2/pimlib/logitech/pass/LogitechLong.mod: (New file).
	* gm2/pimlib/logitech/pass/hello.mod: (New file).
	* gm2/pimlib/logitech/pass/pimlib-logitech-pass.exp: (New file).
	* gm2/pimlib/logitech/run/pass/bbits.mod: (New file).
	* gm2/pimlib/logitech/run/pass/hello.mod: (New file).
	* gm2/pimlib/logitech/run/pass/helloinout.mod: (New file).
	* gm2/pimlib/logitech/run/pass/intb.mod: (New file).
	* gm2/pimlib/logitech/run/pass/pimlib-logitech-run-pass.exp: (New file).
	* gm2/pimlib/logitech/run/pass/realconv.mod: (New file).
	* gm2/pimlib/logitech/run/pass/realinput.mod: (New file).
	* gm2/pimlib/logitech/run/pass/realinput2.mod: (New file).
	* gm2/pimlib/logitech/run/pass/realinput3.mod: (New file).
	* gm2/pimlib/logitech/run/pass/rename.mod: (New file).
	* gm2/pimlib/logitech/run/pass/timedate.mod: (New file).
	* gm2/pimlib/logitech/run/pass/writeoct.mod: (New file).
	* gm2/pimlib/pass/pimlib-pass.exp: (New file).
	* gm2/pimlib/run/pass/format.mod: (New file).
	* gm2/pimlib/run/pass/limittests.c: (New file).
	* gm2/pimlib/run/pass/limittests.mod: (New file).
	* gm2/pimlib/run/pass/longreal.mod: (New file).
	* gm2/pimlib/run/pass/pimlib-run-pass.exp: (New file).
	* gm2/pimlib/run/pass/test.c: (New file).
	* gm2/pimlib/run/pass/testreal.mod: (New file).
	* gm2/pimlib/run/pass/testreal2.mod: (New file).
	* gm2/pimlib/run/pass/testreal4.mod: (New file).
	* gm2/projects/README: (New file).
	* gm2/projects/iso/run/pass/halma/halma.mod: (New file).
	* gm2/projects/iso/run/pass/halma/projects-iso-run-pass-halma.exp:
	(New file).
	* gm2/projects/iso/run/pass/hello/hello.mod: (New file).
	* gm2/projects/iso/run/pass/hello/projects-iso-run-pass-hello.exp:
	(New file).
	* gm2/projects/log/run/pass/hello/hello.mod: (New file).
	* gm2/projects/log/run/pass/hello/projects-log-run-pass-hello.exp:
	(New file).
	* gm2/projects/pim/run/pass/hello/hello.mod: (New file).
	* gm2/projects/pim/run/pass/hello/projects-pim-run-pass-hello.exp:
	(New file).
	* gm2/projects/pim/run/pass/random/AdvMap.def: (New file).
	* gm2/projects/pim/run/pass/random/AdvMap.mod: (New file).
	* gm2/projects/pim/run/pass/random/BoxMap.def: (New file).
	* gm2/projects/pim/run/pass/random/BoxMap.mod: (New file).
	* gm2/projects/pim/run/pass/random/Chance.def: (New file).
	* gm2/projects/pim/run/pass/random/Chance.mod: (New file).
	* gm2/projects/pim/run/pass/random/Geometry.def: (New file).
	* gm2/projects/pim/run/pass/random/Geometry.mod: (New file).
	* gm2/projects/pim/run/pass/random/MakeBoxes.def: (New file).
	* gm2/projects/pim/run/pass/random/MakeBoxes.mod: (New file).
	* gm2/projects/pim/run/pass/random/Map.mod: (New file).
	* gm2/projects/pim/run/pass/random/MapOptions.def: (New file).
	* gm2/projects/pim/run/pass/random/MapOptions.mod: (New file).
	* gm2/projects/pim/run/pass/random/Options.def: (New file).
	* gm2/projects/pim/run/pass/random/Options.mod: (New file).
	* gm2/projects/pim/run/pass/random/RoomMap.def: (New file).
	* gm2/projects/pim/run/pass/random/RoomMap.mod: (New file).
	* gm2/projects/pim/run/pass/random/StoreCoords.def: (New file).
	* gm2/projects/pim/run/pass/random/StoreCoords.mod: (New file).
	* gm2/projects/pim/run/pass/random/WriteMap.def: (New file).
	* gm2/projects/pim/run/pass/random/WriteMap.mod: (New file).
	* gm2/projects/pim/run/pass/random/projects-pim-run-pass-random.exp:
	(New file).
	* gm2/quads/run/pass/becomes.mod: (New file).
	* gm2/quads/run/pass/param.mod: (New file).
	* gm2/quads/run/pass/quads-run-pass.exp: (New file).
	* gm2/quads/run/pass/return.mod: (New file).
	* gm2/recover/pass/cannot-solve/begin.mod: (New file).
	* gm2/recover/pass/cannot-solve/statementsemi.mod: (New file).
	* gm2/recover/pass/end2.mod: (New file).
	* gm2/recover/pass/of.mod: (New file).
	* gm2/recover/pass/procsemi.mod: (New file).
	* gm2/recover/pass/recover-pass.exp: (New file).
	* gm2/recover/pass/rrbra.mod: (New file).
	* gm2/recover/pass/rsbra.mod: (New file).
	* gm2/recover/pass/semi.mod: (New file).
	* gm2/run/fail/list.mod: (New file).
	* gm2/run/fail/options: (New file).
	* gm2/run/fail/testdec.mod: (New file).
	* gm2/run/fail/testfunc.mod: (New file).
	* gm2/run/pass/cycles.mod: (New file).
	* gm2/run/pass/line.mod: (New file).
	* gm2/run/pass/nestedproc.mod: (New file).
	* gm2/run/pass/nestedproc2.mod: (New file).
	* gm2/run/pass/nestedproc3.mod: (New file).
	* gm2/run/pass/nestedproc5.mod: (New file).
	* gm2/run/pass/nestedset.mod: (New file).
	* gm2/run/pass/nothing.mod: (New file).
	* gm2/run/pass/options: (New file).
	* gm2/run/pass/prog31ex.mod: (New file).
	* gm2/run/pass/rts.mod: (New file).
	* gm2/run/pass/stripped.mod: (New file).
	* gm2/run/pass/testavail.mod: (New file).
	* gm2/run/pass/testfpufunc.mod: (New file).
	* gm2/run/pass/testfpufunc2.mod: (New file).
	* gm2/run/pass/testnextproc.mod: (New file).
	* gm2/run/pass/testparam.mod: (New file).
	* gm2/run/pass/testsize.mod: (New file).
	* gm2/run/pass/testsize2.mod: (New file).
	* gm2/run/pass/testsize3.mod: (New file).
	* gm2/run/pass/wr.mod: (New file).
	* gm2/scripts/addit: (New file).
	* gm2/scripts/comp: (New file).
	* gm2/scripts/compile: (New file).
	* gm2/scripts/compileiso: (New file).
	* gm2/scripts/link: (New file).
	* gm2/scripts/regression: (New file).
	* gm2/scripts/subit: (New file).
	* gm2/sets/run/pass/multisetarith.mod: (New file).
	* gm2/sets/run/pass/multisetarith2.mod: (New file).
	* gm2/sets/run/pass/multisetarith3.mod: (New file).
	* gm2/sets/run/pass/multisetarith4.mod: (New file).
	* gm2/sets/run/pass/multisetrotate.mod: (New file).
	* gm2/sets/run/pass/multisetrotate2.mod: (New file).
	* gm2/sets/run/pass/multisetrotate3.mod: (New file).
	* gm2/sets/run/pass/multisetrotate4.mod: (New file).
	* gm2/sets/run/pass/multisetshift.mod: (New file).
	* gm2/sets/run/pass/multisetshift2.mod: (New file).
	* gm2/sets/run/pass/multisimple.mod: (New file).
	* gm2/sets/run/pass/multisimple2.mod: (New file).
	* gm2/sets/run/pass/multisimple3.mod: (New file).
	* gm2/sets/run/pass/multisimple4.mod: (New file).
	* gm2/sets/run/pass/multisimple5.mod: (New file).
	* gm2/sets/run/pass/multisimple6.mod: (New file).
	* gm2/sets/run/pass/multisimple7.mod: (New file).
	* gm2/sets/run/pass/setarith.mod: (New file).
	* gm2/sets/run/pass/setarith2.mod: (New file).
	* gm2/sets/run/pass/setarith3.mod: (New file).
	* gm2/sets/run/pass/setarith4.mod: (New file).
	* gm2/sets/run/pass/setrotate.mod: (New file).
	* gm2/sets/run/pass/setrotate2.mod: (New file).
	* gm2/sets/run/pass/setrotate3.mod: (New file).
	* gm2/sets/run/pass/setrotate4.mod: (New file).
	* gm2/sets/run/pass/sets-run-pass.exp: (New file).
	* gm2/sets/run/pass/setshift.mod: (New file).
	* gm2/sets/run/pass/setshift2.mod: (New file).
	* gm2/sets/run/pass/simple.mod: (New file).
	* gm2/sets/run/pass/simple2.mod: (New file).
	* gm2/sets/run/pass/simple3.mod: (New file).
	* gm2/sets/run/pass/simple4.mod: (New file).
	* gm2/sets/run/pass/simple5.mod: (New file).
	* gm2/sets/run/pass/simple6.mod: (New file).
	* gm2/sets/run/pass/simple7.mod: (New file).
	* gm2/switches/auto-init/fail/switches-auto-init-fail.exp: (New file).
	* gm2/switches/auto-init/fail/uninitptr.mod: (New file).
	* gm2/switches/auto-init/fail/uninitptr2.mod: (New file).
	* gm2/switches/check-all/pim2/fail/overflow.mod: (New file).
	* gm2/switches/check-all/pim2/fail/overflow2.mod: (New file).
	* gm2/switches/check-all/pim2/fail/overflowdiv1.mod: (New file).
	* gm2/switches/check-all/pim2/fail/switches-check-all-pim2-fail.exp:
	(New file).
	* gm2/switches/check-all/plugin/iso/fail/divceilposneg.mod: (New file).
	* gm2/switches/check-all/plugin/iso/fail/divceilposneg2.mod: (New file).
	* gm2/switches/check-all/plugin/iso/fail/divceilposnegcall.mod: (New file).
	* gm2/switches/check-all/plugin/iso/fail/divceilposnegcall2.mod: (New file).
	* gm2/switches/check-all/plugin/iso/fail/divfloornegpos.mod: (New file).
	* gm2/switches/check-all/plugin/iso/fail/divfloorpospos.mod: (New file).
	* gm2/switches/check-all/plugin/iso/fail/lowdiv.mod: (New file).
	* gm2/switches/check-all/plugin/iso/fail/switches-check-all-plugin-iso-fail.exp:
	(New file).
	* gm2/switches/check-all/plugin/pim2/fail/divceil.mod: (New file).
	* gm2/switches/check-all/plugin/pim2/fail/highdiv.mod: (New file).
	* gm2/switches/check-all/plugin/pim2/fail/modulus.mod: (New file).
	* gm2/switches/check-all/plugin/pim2/fail/plugin1.mod: (New file).
	* gm2/switches/check-all/plugin/pim2/fail/plugin3.mod: (New file).
	* gm2/switches/check-all/plugin/pim2/fail/plugin4.def: (New file).
	* gm2/switches/check-all/plugin/pim2/fail/plugin4.mod: (New file).
	* gm2/switches/check-all/plugin/pim2/fail/plugin5.def: (New file).
	* gm2/switches/check-all/plugin/pim2/fail/plugin5.mod: (New file).
	* gm2/switches/check-all/plugin/pim2/fail/plugin6.def: (New file).
	* gm2/switches/check-all/plugin/pim2/fail/plugin6.mod: (New file).
	* gm2/switches/check-all/plugin/pim2/fail/plugin7.def: (New file).
	* gm2/switches/check-all/plugin/pim2/fail/plugin7.mod: (New file).
	* gm2/switches/check-all/plugin/pim2/fail/plugin8.def: (New file).
	* gm2/switches/check-all/plugin/pim2/fail/plugin8.mod: (New file).
	* gm2/switches/check-all/plugin/pim2/fail/plugin9.mod: (New file).
	* gm2/switches/check-all/plugin/pim2/fail/switches-check-all-plugin-pim2-fail.exp:
	(New file).
	* gm2/switches/check-all/run/fail/cardrange.mod: (New file).
	* gm2/switches/check-all/run/fail/cardrange2.mod: (New file).
	* gm2/switches/check-all/run/fail/cardrange3.mod: (New file).
	* gm2/switches/check-all/run/fail/intrange.mod: (New file).
	* gm2/switches/check-all/run/fail/intrange2.mod: (New file).
	* gm2/switches/check-all/run/fail/intrange3.mod: (New file).
	* gm2/switches/check-all/run/fail/intrange4.mod: (New file).
	* gm2/switches/check-all/run/fail/intrange5.mod: (New file).
	* gm2/switches/check-all/run/fail/multint1.mod: (New file).
	* gm2/switches/check-all/run/fail/multint2.mod: (New file).
	* gm2/switches/check-all/run/fail/multint3.mod: (New file).
	* gm2/switches/check-all/run/fail/rangesupport.def: (New file).
	* gm2/switches/check-all/run/fail/rangesupport.mod: (New file).
	* gm2/switches/check-all/run/fail/realrange.mod: (New file).
	* gm2/switches/check-all/run/fail/subrange.mod: (New file).
	* gm2/switches/check-all/run/fail/switches-check-all-run-fail.exp:
	(New file).
	* gm2/switches/check-all/run/fail/tinyrange.mod: (New file).
	* gm2/switches/check-all/run/pass/cardrange.mod: (New file).
	* gm2/switches/check-all/run/pass/forcheck.mod: (New file).
	* gm2/switches/check-all/run/pass/subrange.mod: (New file).
	* gm2/switches/check-all/run/pass/switches-check-all-run-pass.exp:
	(New file).
	* gm2/switches/extended-opaque/fail/a.def: (New file).
	* gm2/switches/extended-opaque/fail/a.mod: (New file).
	* gm2/switches/extended-opaque/fail/switches-extended-opaque-fail.exp:
	(New file).
	* gm2/switches/extended-opaque/pass/a.def: (New file).
	* gm2/switches/extended-opaque/pass/a.mod: (New file).
	* gm2/switches/extended-opaque/pass/b.mod: (New file).
	* gm2/switches/extended-opaque/pass/switches-extended-opaque-pass.exp:
	(New file).
	* gm2/switches/iso/run/pass/modulus.mod: (New file).
	* gm2/switches/iso/run/pass/modulus4.mod: (New file).
	* gm2/switches/iso/run/pass/switches-iso-run-pass.exp: (New file).
	* gm2/switches/makeall/fail/switches-makeall-fail.exp: (New file).
	* gm2/switches/makeall/fail/test.def: (New file).
	* gm2/switches/makeall/fail/test.mod: (New file).
	* gm2/switches/makeall/pass/switches-makeall-pass.exp: (New file).
	* gm2/switches/makeall/pass/test.def: (New file).
	* gm2/switches/makeall/pass/test.mod: (New file).
	* gm2/switches/none/run/pass/gm2-none.exp: (New file).
	* gm2/switches/none/run/pass/hello.mod: (New file).
	* gm2/switches/optimization/run/pass/fact.mod: (New file).
	* gm2/switches/optimization/run/pass/switches-optimization-run-pass.exp:
	(New file).
	* gm2/switches/pedantic-params/fail/a.def: (New file).
	* gm2/switches/pedantic-params/fail/a.mod: (New file).
	* gm2/switches/pedantic-params/fail/switches-pedantic-params-fail.exp:
	(New file).
	* gm2/switches/pedantic-params/pass/Strings.def: (New file).
	* gm2/switches/pedantic-params/pass/Strings.mod: (New file).
	* gm2/switches/pedantic-params/pass/Strings2.def: (New file).
	* gm2/switches/pedantic-params/pass/Strings2.mod: (New file).
	* gm2/switches/pedantic-params/pass/switches-pedantic-params-pass.exp:
	(New file).
	* gm2/switches/pedantic/fail/onlywrite.mod: (New file).
	* gm2/switches/pedantic/fail/readb4.mod: (New file).
	* gm2/switches/pic/run/pass/func.c: (New file).
	* gm2/switches/pic/run/pass/func.mod: (New file).
	* gm2/switches/pic/run/pass/func2.c: (New file).
	* gm2/switches/pic/run/pass/func2.mod: (New file).
	* gm2/switches/pic/run/pass/switches-pic-run-pass.exp: (New file).
	* gm2/switches/pim2/run/pass/modulus.mod: (New file).
	* gm2/switches/pim2/run/pass/switches-pim2-run-pass.exp: (New file).
	* gm2/switches/pim3/run/pass/modulus.mod: (New file).
	* gm2/switches/pim3/run/pass/switches-pim3-run-pass.exp: (New file).
	* gm2/switches/pim4/run/pass/FpuIOBug.mod: (New file).
	* gm2/switches/pim4/run/pass/InOutBug.mod: (New file).
	* gm2/switches/pim4/run/pass/NumberIOBug.mod: (New file).
	* gm2/switches/pim4/run/pass/modulus.mod: (New file).
	* gm2/switches/pim4/run/pass/modulus2.mod: (New file).
	* gm2/switches/pim4/run/pass/switches-pim4-run-pass.exp: (New file).
	* gm2/switches/whole-program/pass/run/hello.mod: (New file).
	* gm2/switches/whole-program/pass/run/hello2.mod: (New file).
	* gm2/switches/whole-program/pass/run/switches-whole-program-pass-run.exp:
	(New file).
	* gm2/switches/whole-program/pass/run/tiny.mod: (New file).
	* gm2/switches/whole-program/pass/run/tiny2.mod: (New file).
	* gm2/types/bitset.mod: (New file).
	* gm2/types/bitset2.mod: (New file).
	* gm2/types/bitset3.mod: (New file).
	* gm2/types/charset.mod: (New file).
	* gm2/types/const.mod: (New file).
	* gm2/types/prog35.mod: (New file).
	* gm2/types/real.mod: (New file).
	* gm2/types/run/pass/d.c: (New file).
	* gm2/types/run/pass/d.def: (New file).
	* gm2/types/run/pass/types-run-pass.exp: (New file).
	* gm2/types/run/pass/varient4.mod: (New file).
	* gm2/types/run/pass/varient5.mod: (New file).
	* gm2/types/string.mod: (New file).
	* gm2/types/type1.mod: (New file).
	* gm2/types/type2.mod: (New file).
	* gm2/types/type3.mod: (New file).
	* gm2/types/type4.mod: (New file).
	* gm2/types/varient.mod: (New file).
	* gm2/types/word.mod: (New file).
	* gm2/ulmlib/pass/ulmlib-pass.exp: (New file).
	* gm2/ulmlib/std/pass/ulmlib-std-pass.exp: (New file).
	* gm2/ulmlib/sys/pass/ulmlib-sys-pass.exp: (New file).
	* gm2/warnings/todo/nestedproc6.mod: (New file).
	* gm2/warnings/todo/options: (New file).
	* gm2/warnings/todo/testfor.mod: (New file).
	* gm2/warnings/todo/testfor2.mod: (New file).
	* gm2/warnings/todo/testfor3.mod: (New file).
	* gm2/warnings/todo/testkeywords.mod: (New file).
	* gm2/warnings/todo/testloop.mod: (New file).
	* gm2/warnings/todo/testscope.mod: (New file).
	* gm2/warnings/todo/testscope2.mod: (New file).
	* gm2/x86-asm/asm.mod: (New file).
	* gm2/x86-asm/asm2.mod: (New file).

Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
This commit is contained in:
Gaius Mulley 2022-12-14 17:43:08 +00:00
parent 330b9a8d87
commit 1eee94d351
2620 changed files with 541380 additions and 30 deletions

View file

@ -185,6 +185,7 @@ target_modules = { module= libffi; no_install=true; };
target_modules = { module= zlib; bootstrap=true; };
target_modules = { module= rda; };
target_modules = { module= libada; };
target_modules = { module= libgm2; lib_path=.libs; };
target_modules = { module= libgomp; bootstrap= true; lib_path=.libs; };
target_modules = { module= libitm; lib_path=.libs; };
target_modules = { module= libatomic; bootstrap=true; lib_path=.libs; };
@ -307,6 +308,8 @@ flags_to_pass = { flag= GOC_FOR_TARGET ; };
flags_to_pass = { flag= GOCFLAGS_FOR_TARGET ; };
flags_to_pass = { flag= GDC_FOR_TARGET ; };
flags_to_pass = { flag= GDCFLAGS_FOR_TARGET ; };
flags_to_pass = { flag= GM2_FOR_TARGET ; };
flags_to_pass = { flag= GM2FLAGS_FOR_TARGET ; };
flags_to_pass = { flag= LD_FOR_TARGET ; };
flags_to_pass = { flag= LIPO_FOR_TARGET ; };
flags_to_pass = { flag= LDFLAGS_FOR_TARGET ; };
@ -618,6 +621,8 @@ dependencies = { module=configure-target-libgo; on=all-target-libstdc++-v3; };
dependencies = { module=all-target-libgo; on=all-target-libbacktrace; };
dependencies = { module=all-target-libgo; on=all-target-libffi; };
dependencies = { module=all-target-libgo; on=all-target-libatomic; };
dependencies = { module=configure-target-libgm2; on=all-target-libstdc++-v3; };
dependencies = { module=all-target-libgm2; on=all-target-libatomic; };
dependencies = { module=configure-target-libphobos; on=configure-target-libbacktrace; };
dependencies = { module=configure-target-libphobos; on=configure-target-zlib; };
dependencies = { module=all-target-libphobos; on=all-target-libbacktrace; };
@ -673,6 +678,8 @@ languages = { language=obj-c++; gcc-check-target=check-obj-c++; };
languages = { language=go; gcc-check-target=check-go;
lib-check-target=check-target-libgo;
lib-check-target=check-gotools; };
languages = { language=m2; gcc-check-target=check-m2;
lib-check-target=check-target-libgm2; };
languages = { language=d; gcc-check-target=check-d;
lib-check-target=check-target-libphobos; };
languages = { language=jit; gcc-check-target=check-jit; };

View file

@ -163,6 +163,8 @@ BUILD_EXPORTS = \
GOCFLAGS="$(GOCFLAGS_FOR_BUILD)"; export GOCFLAGS; \
GDC="$(GDC_FOR_BUILD)"; export GDC; \
GDCFLAGS="$(GDCFLAGS_FOR_BUILD)"; export GDCFLAGS; \
GM2="$(GM2_FOR_BUILD)"; export GM2; \
GM2FLAGS="$(GM2FLAGS_FOR_BUILD)"; export GM2FLAGS; \
DLLTOOL="$(DLLTOOL_FOR_BUILD)"; export DLLTOOL; \
DSYMUTIL="$(DSYMUTIL_FOR_BUILD)"; export DSYMUTIL; \
LD="$(LD_FOR_BUILD)"; export LD; \
@ -201,6 +203,7 @@ HOST_EXPORTS = \
GFORTRAN="$(GFORTRAN)"; export GFORTRAN; \
GOC="$(GOC)"; export GOC; \
GDC="$(GDC)"; export GDC; \
GM2="$(GM2)"; export GM2; \
AR="$(AR)"; export AR; \
AS="$(AS)"; export AS; \
CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \
@ -304,6 +307,7 @@ BASE_TARGET_EXPORTS = \
GFORTRAN="$(GFORTRAN_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export GFORTRAN; \
GOC="$(GOC_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export GOC; \
GDC="$(GDC_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export GDC; \
GM2="$(GM2_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export GM2; \
DLLTOOL="$(DLLTOOL_FOR_TARGET)"; export DLLTOOL; \
DSYMUTIL="$(DSYMUTIL_FOR_TARGET)"; export DSYMUTIL; \
LD="$(COMPILER_LD_FOR_TARGET)"; export LD; \
@ -370,6 +374,7 @@ DSYMUTIL_FOR_BUILD = @DSYMUTIL_FOR_BUILD@
GFORTRAN_FOR_BUILD = @GFORTRAN_FOR_BUILD@
GOC_FOR_BUILD = @GOC_FOR_BUILD@
GDC_FOR_BUILD = @GDC_FOR_BUILD@
GM2_FOR_BUILD = @GM2_FOR_BUILD@
LDFLAGS_FOR_BUILD = @LDFLAGS_FOR_BUILD@
LD_FOR_BUILD = @LD_FOR_BUILD@
NM_FOR_BUILD = @NM_FOR_BUILD@
@ -440,6 +445,7 @@ CXXFLAGS = @CXXFLAGS@
LIBCXXFLAGS = $(CXXFLAGS) -fno-implicit-templates
GOCFLAGS = $(CFLAGS)
GDCFLAGS = $(CFLAGS)
GM2FLAGS = $(CFLAGS)
# Pass additional PGO and LTO compiler options to the PGO build.
BUILD_CFLAGS = $(PGO_BUILD_CFLAGS) $(PGO_BUILD_LTO_CFLAGS)
@ -655,6 +661,7 @@ RAW_CXX_FOR_TARGET=$(STAGE_CC_WRAPPER) @RAW_CXX_FOR_TARGET@
GFORTRAN_FOR_TARGET=$(STAGE_CC_WRAPPER) @GFORTRAN_FOR_TARGET@
GOC_FOR_TARGET=$(STAGE_CC_WRAPPER) @GOC_FOR_TARGET@
GDC_FOR_TARGET=$(STAGE_CC_WRAPPER) @GDC_FOR_TARGET@
GM2_FOR_TARGET=$(STAGE_CC_WRAPPER) @GM2_FOR_TARGET@
DLLTOOL_FOR_TARGET=@DLLTOOL_FOR_TARGET@
DSYMUTIL_FOR_TARGET=@DSYMUTIL_FOR_TARGET@
LD_FOR_TARGET=@LD_FOR_TARGET@
@ -680,6 +687,7 @@ CXXFLAGS_FOR_TARGET = @CXXFLAGS_FOR_TARGET@
LIBCFLAGS_FOR_TARGET = $(CFLAGS_FOR_TARGET)
LIBCXXFLAGS_FOR_TARGET = $(CXXFLAGS_FOR_TARGET) -fno-implicit-templates
LDFLAGS_FOR_TARGET = @LDFLAGS_FOR_TARGET@
GM2FLAGS_FOR_TARGET = -O2 -g
GOCFLAGS_FOR_TARGET = -O2 -g
GDCFLAGS_FOR_TARGET = -O2 -g
@ -706,7 +714,7 @@ all:
# This is the list of directories that may be needed in RPATH_ENVVAR
# so that programs built for the target machine work.
TARGET_LIB_PATH = $(TARGET_LIB_PATH_libstdc++-v3)$(TARGET_LIB_PATH_libsanitizer)$(TARGET_LIB_PATH_libvtv)$(TARGET_LIB_PATH_libssp)$(TARGET_LIB_PATH_libphobos)$(TARGET_LIB_PATH_libgomp)$(TARGET_LIB_PATH_libitm)$(TARGET_LIB_PATH_libatomic)$(HOST_LIB_PATH_gcc)
TARGET_LIB_PATH = $(TARGET_LIB_PATH_libstdc++-v3)$(TARGET_LIB_PATH_libsanitizer)$(TARGET_LIB_PATH_libvtv)$(TARGET_LIB_PATH_libssp)$(TARGET_LIB_PATH_libphobos)$(TARGET_LIB_PATH_libgm2)$(TARGET_LIB_PATH_libgomp)$(TARGET_LIB_PATH_libitm)$(TARGET_LIB_PATH_libatomic)$(HOST_LIB_PATH_gcc)
@if target-libstdc++-v3
TARGET_LIB_PATH_libstdc++-v3 = $$r/$(TARGET_SUBDIR)/libstdc++-v3/src/.libs:
@ -728,6 +736,10 @@ TARGET_LIB_PATH_libssp = $$r/$(TARGET_SUBDIR)/libssp/.libs:
TARGET_LIB_PATH_libphobos = $$r/$(TARGET_SUBDIR)/libphobos/src/.libs:
@endif target-libphobos
@if target-libgm2
TARGET_LIB_PATH_libgm2 = $$r/$(TARGET_SUBDIR)/libgm2/.libs:
@endif target-libgm2
@if target-libgomp
TARGET_LIB_PATH_libgomp = $$r/$(TARGET_SUBDIR)/libgomp/.libs:
@endif target-libgomp
@ -873,6 +885,8 @@ BASE_FLAGS_TO_PASS = \
"GOCFLAGS_FOR_TARGET=$(GOCFLAGS_FOR_TARGET)" \
"GDC_FOR_TARGET=$(GDC_FOR_TARGET)" \
"GDCFLAGS_FOR_TARGET=$(GDCFLAGS_FOR_TARGET)" \
"GM2_FOR_TARGET=$(GM2_FOR_TARGET)" \
"GM2FLAGS_FOR_TARGET=$(GM2FLAGS_FOR_TARGET)" \
"LD_FOR_TARGET=$(LD_FOR_TARGET)" \
"LIPO_FOR_TARGET=$(LIPO_FOR_TARGET)" \
"LDFLAGS_FOR_TARGET=$(LDFLAGS_FOR_TARGET)" \
@ -946,6 +960,7 @@ EXTRA_HOST_FLAGS = \
'GFORTRAN=$(GFORTRAN)' \
'GOC=$(GOC)' \
'GDC=$(GDC)' \
'GM2=$(GM2)' \
'LD=$(LD)' \
'LIPO=$(LIPO)' \
'NM=$(NM)' \
@ -972,6 +987,7 @@ POSTSTAGE1_FLAGS_TO_PASS = \
CC="$${CC}" CC_FOR_BUILD="$${CC_FOR_BUILD}" \
CXX="$${CXX}" CXX_FOR_BUILD="$${CXX_FOR_BUILD}" \
GDC="$${GDC}" GDC_FOR_BUILD="$${GDC_FOR_BUILD}" \
GM2="$${GM2}" GM2_FOR_BUILD="$${GM2_FOR_BUILD}" \
GNATBIND="$${GNATBIND}" \
LDFLAGS="$${LDFLAGS}" \
HOST_LIBS="$${HOST_LIBS}" \
@ -1007,6 +1023,8 @@ EXTRA_TARGET_FLAGS = \
'GOCFLAGS=$$(GOCFLAGS_FOR_TARGET)' \
'GDC=$$(GDC_FOR_TARGET) $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \
'GDCFLAGS=$$(GDCFLAGS_FOR_TARGET)' \
'GM2=$$(GM2_FOR_TARGET) $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \
'GM2FLAGS=$$(GM2FLAGS_FOR_TARGET)' \
'LD=$(COMPILER_LD_FOR_TARGET)' \
'LDFLAGS=$$(LDFLAGS_FOR_TARGET)' \
'LIBCFLAGS=$$(LIBCFLAGS_FOR_TARGET)' \
@ -1033,6 +1051,7 @@ TARGET_FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) $(EXTRA_TARGET_FLAGS)
# cross-building scheme.
EXTRA_GCC_FLAGS = \
"GCC_FOR_TARGET=$(GCC_FOR_TARGET) $$TFLAGS" \
"GM2_FOR_TARGET=$(GM2_FOR_TARGET) $$TFLAGS" \
"`echo 'STMP_FIXPROTO=$(STMP_FIXPROTO)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`" \
"`echo 'LIMITS_H_TEST=$(LIMITS_H_TEST)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`"
@ -1120,6 +1139,7 @@ configure-target: \
maybe-configure-target-zlib \
maybe-configure-target-rda \
maybe-configure-target-libada \
maybe-configure-target-libgm2 \
maybe-configure-target-libgomp \
maybe-configure-target-libitm \
maybe-configure-target-libatomic
@ -1313,6 +1333,7 @@ all-target: maybe-all-target-zlib
@endif target-zlib-no-bootstrap
all-target: maybe-all-target-rda
all-target: maybe-all-target-libada
all-target: maybe-all-target-libgm2
@if target-libgomp-no-bootstrap
all-target: maybe-all-target-libgomp
@endif target-libgomp-no-bootstrap
@ -1411,6 +1432,7 @@ info-target: maybe-info-target-libffi
info-target: maybe-info-target-zlib
info-target: maybe-info-target-rda
info-target: maybe-info-target-libada
info-target: maybe-info-target-libgm2
info-target: maybe-info-target-libgomp
info-target: maybe-info-target-libitm
info-target: maybe-info-target-libatomic
@ -1500,6 +1522,7 @@ dvi-target: maybe-dvi-target-libffi
dvi-target: maybe-dvi-target-zlib
dvi-target: maybe-dvi-target-rda
dvi-target: maybe-dvi-target-libada
dvi-target: maybe-dvi-target-libgm2
dvi-target: maybe-dvi-target-libgomp
dvi-target: maybe-dvi-target-libitm
dvi-target: maybe-dvi-target-libatomic
@ -1589,6 +1612,7 @@ pdf-target: maybe-pdf-target-libffi
pdf-target: maybe-pdf-target-zlib
pdf-target: maybe-pdf-target-rda
pdf-target: maybe-pdf-target-libada
pdf-target: maybe-pdf-target-libgm2
pdf-target: maybe-pdf-target-libgomp
pdf-target: maybe-pdf-target-libitm
pdf-target: maybe-pdf-target-libatomic
@ -1678,6 +1702,7 @@ html-target: maybe-html-target-libffi
html-target: maybe-html-target-zlib
html-target: maybe-html-target-rda
html-target: maybe-html-target-libada
html-target: maybe-html-target-libgm2
html-target: maybe-html-target-libgomp
html-target: maybe-html-target-libitm
html-target: maybe-html-target-libatomic
@ -1767,6 +1792,7 @@ TAGS-target: maybe-TAGS-target-libffi
TAGS-target: maybe-TAGS-target-zlib
TAGS-target: maybe-TAGS-target-rda
TAGS-target: maybe-TAGS-target-libada
TAGS-target: maybe-TAGS-target-libgm2
TAGS-target: maybe-TAGS-target-libgomp
TAGS-target: maybe-TAGS-target-libitm
TAGS-target: maybe-TAGS-target-libatomic
@ -1856,6 +1882,7 @@ install-info-target: maybe-install-info-target-libffi
install-info-target: maybe-install-info-target-zlib
install-info-target: maybe-install-info-target-rda
install-info-target: maybe-install-info-target-libada
install-info-target: maybe-install-info-target-libgm2
install-info-target: maybe-install-info-target-libgomp
install-info-target: maybe-install-info-target-libitm
install-info-target: maybe-install-info-target-libatomic
@ -1945,6 +1972,7 @@ install-dvi-target: maybe-install-dvi-target-libffi
install-dvi-target: maybe-install-dvi-target-zlib
install-dvi-target: maybe-install-dvi-target-rda
install-dvi-target: maybe-install-dvi-target-libada
install-dvi-target: maybe-install-dvi-target-libgm2
install-dvi-target: maybe-install-dvi-target-libgomp
install-dvi-target: maybe-install-dvi-target-libitm
install-dvi-target: maybe-install-dvi-target-libatomic
@ -2034,6 +2062,7 @@ install-pdf-target: maybe-install-pdf-target-libffi
install-pdf-target: maybe-install-pdf-target-zlib
install-pdf-target: maybe-install-pdf-target-rda
install-pdf-target: maybe-install-pdf-target-libada
install-pdf-target: maybe-install-pdf-target-libgm2
install-pdf-target: maybe-install-pdf-target-libgomp
install-pdf-target: maybe-install-pdf-target-libitm
install-pdf-target: maybe-install-pdf-target-libatomic
@ -2123,6 +2152,7 @@ install-html-target: maybe-install-html-target-libffi
install-html-target: maybe-install-html-target-zlib
install-html-target: maybe-install-html-target-rda
install-html-target: maybe-install-html-target-libada
install-html-target: maybe-install-html-target-libgm2
install-html-target: maybe-install-html-target-libgomp
install-html-target: maybe-install-html-target-libitm
install-html-target: maybe-install-html-target-libatomic
@ -2212,6 +2242,7 @@ installcheck-target: maybe-installcheck-target-libffi
installcheck-target: maybe-installcheck-target-zlib
installcheck-target: maybe-installcheck-target-rda
installcheck-target: maybe-installcheck-target-libada
installcheck-target: maybe-installcheck-target-libgm2
installcheck-target: maybe-installcheck-target-libgomp
installcheck-target: maybe-installcheck-target-libitm
installcheck-target: maybe-installcheck-target-libatomic
@ -2301,6 +2332,7 @@ mostlyclean-target: maybe-mostlyclean-target-libffi
mostlyclean-target: maybe-mostlyclean-target-zlib
mostlyclean-target: maybe-mostlyclean-target-rda
mostlyclean-target: maybe-mostlyclean-target-libada
mostlyclean-target: maybe-mostlyclean-target-libgm2
mostlyclean-target: maybe-mostlyclean-target-libgomp
mostlyclean-target: maybe-mostlyclean-target-libitm
mostlyclean-target: maybe-mostlyclean-target-libatomic
@ -2390,6 +2422,7 @@ clean-target: maybe-clean-target-libffi
clean-target: maybe-clean-target-zlib
clean-target: maybe-clean-target-rda
clean-target: maybe-clean-target-libada
clean-target: maybe-clean-target-libgm2
clean-target: maybe-clean-target-libgomp
clean-target: maybe-clean-target-libitm
clean-target: maybe-clean-target-libatomic
@ -2479,6 +2512,7 @@ distclean-target: maybe-distclean-target-libffi
distclean-target: maybe-distclean-target-zlib
distclean-target: maybe-distclean-target-rda
distclean-target: maybe-distclean-target-libada
distclean-target: maybe-distclean-target-libgm2
distclean-target: maybe-distclean-target-libgomp
distclean-target: maybe-distclean-target-libitm
distclean-target: maybe-distclean-target-libatomic
@ -2568,6 +2602,7 @@ maintainer-clean-target: maybe-maintainer-clean-target-libffi
maintainer-clean-target: maybe-maintainer-clean-target-zlib
maintainer-clean-target: maybe-maintainer-clean-target-rda
maintainer-clean-target: maybe-maintainer-clean-target-libada
maintainer-clean-target: maybe-maintainer-clean-target-libgm2
maintainer-clean-target: maybe-maintainer-clean-target-libgomp
maintainer-clean-target: maybe-maintainer-clean-target-libitm
maintainer-clean-target: maybe-maintainer-clean-target-libatomic
@ -2715,6 +2750,7 @@ check-target: \
maybe-check-target-zlib \
maybe-check-target-rda \
maybe-check-target-libada \
maybe-check-target-libgm2 \
maybe-check-target-libgomp \
maybe-check-target-libitm \
maybe-check-target-libatomic
@ -2906,6 +2942,7 @@ install-target: \
maybe-install-target-zlib \
maybe-install-target-rda \
maybe-install-target-libada \
maybe-install-target-libgm2 \
maybe-install-target-libgomp \
maybe-install-target-libitm \
maybe-install-target-libatomic
@ -3015,6 +3052,7 @@ install-strip-target: \
maybe-install-strip-target-zlib \
maybe-install-strip-target-rda \
maybe-install-strip-target-libada \
maybe-install-strip-target-libgm2 \
maybe-install-strip-target-libgomp \
maybe-install-strip-target-libitm \
maybe-install-strip-target-libatomic
@ -58104,6 +58142,491 @@ maintainer-clean-target-libada:
.PHONY: configure-target-libgm2 maybe-configure-target-libgm2
maybe-configure-target-libgm2:
@if gcc-bootstrap
configure-target-libgm2: stage_current
@endif gcc-bootstrap
@if target-libgm2
maybe-configure-target-libgm2: configure-target-libgm2
configure-target-libgm2:
@: $(MAKE); $(unstage)
@r=`${PWD_COMMAND}`; export r; \
s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
echo "Checking multilib configuration for libgm2..."; \
$(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/libgm2; \
$(CC_FOR_TARGET) --print-multi-lib > $(TARGET_SUBDIR)/libgm2/multilib.tmp 2> /dev/null; \
if test -r $(TARGET_SUBDIR)/libgm2/multilib.out; then \
if cmp -s $(TARGET_SUBDIR)/libgm2/multilib.tmp $(TARGET_SUBDIR)/libgm2/multilib.out; then \
rm -f $(TARGET_SUBDIR)/libgm2/multilib.tmp; \
else \
rm -f $(TARGET_SUBDIR)/libgm2/Makefile; \
mv $(TARGET_SUBDIR)/libgm2/multilib.tmp $(TARGET_SUBDIR)/libgm2/multilib.out; \
fi; \
else \
mv $(TARGET_SUBDIR)/libgm2/multilib.tmp $(TARGET_SUBDIR)/libgm2/multilib.out; \
fi; \
test ! -f $(TARGET_SUBDIR)/libgm2/Makefile || exit 0; \
$(SHELL) $(srcdir)/mkinstalldirs $(TARGET_SUBDIR)/libgm2; \
$(NORMAL_TARGET_EXPORTS) \
echo Configuring in $(TARGET_SUBDIR)/libgm2; \
cd "$(TARGET_SUBDIR)/libgm2" || exit 1; \
case $(srcdir) in \
/* | [A-Za-z]:[\\/]*) topdir=$(srcdir) ;; \
*) topdir=`echo $(TARGET_SUBDIR)/libgm2/ | \
sed -e 's,\./,,g' -e 's,[^/]*/,../,g' `$(srcdir) ;; \
esac; \
module_srcdir=libgm2; \
rm -f no-such-file || : ; \
CONFIG_SITE=no-such-file $(SHELL) \
$$s/$$module_srcdir/configure \
--srcdir=$${topdir}/$$module_srcdir \
$(TARGET_CONFIGARGS) --build=${build_alias} --host=${target_alias} \
--target=${target_alias} \
|| exit 1
@endif target-libgm2
.PHONY: all-target-libgm2 maybe-all-target-libgm2
maybe-all-target-libgm2:
@if gcc-bootstrap
all-target-libgm2: stage_current
@endif gcc-bootstrap
@if target-libgm2
TARGET-target-libgm2=all
maybe-all-target-libgm2: all-target-libgm2
all-target-libgm2: configure-target-libgm2
@: $(MAKE); $(unstage)
@r=`${PWD_COMMAND}`; export r; \
s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
$(NORMAL_TARGET_EXPORTS) \
(cd $(TARGET_SUBDIR)/libgm2 && \
$(MAKE) $(BASE_FLAGS_TO_PASS) $(EXTRA_TARGET_FLAGS) \
$(TARGET-target-libgm2))
@endif target-libgm2
.PHONY: check-target-libgm2 maybe-check-target-libgm2
maybe-check-target-libgm2:
@if target-libgm2
maybe-check-target-libgm2: check-target-libgm2
check-target-libgm2:
@: $(MAKE); $(unstage)
@r=`${PWD_COMMAND}`; export r; \
s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
$(NORMAL_TARGET_EXPORTS) \
(cd $(TARGET_SUBDIR)/libgm2 && \
$(MAKE) $(TARGET_FLAGS_TO_PASS) check)
@endif target-libgm2
.PHONY: install-target-libgm2 maybe-install-target-libgm2
maybe-install-target-libgm2:
@if target-libgm2
maybe-install-target-libgm2: install-target-libgm2
install-target-libgm2: installdirs
@: $(MAKE); $(unstage)
@r=`${PWD_COMMAND}`; export r; \
s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
$(NORMAL_TARGET_EXPORTS) \
(cd $(TARGET_SUBDIR)/libgm2 && \
$(MAKE) $(TARGET_FLAGS_TO_PASS) install)
@endif target-libgm2
.PHONY: install-strip-target-libgm2 maybe-install-strip-target-libgm2
maybe-install-strip-target-libgm2:
@if target-libgm2
maybe-install-strip-target-libgm2: install-strip-target-libgm2
install-strip-target-libgm2: installdirs
@: $(MAKE); $(unstage)
@r=`${PWD_COMMAND}`; export r; \
s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
$(NORMAL_TARGET_EXPORTS) \
(cd $(TARGET_SUBDIR)/libgm2 && \
$(MAKE) $(TARGET_FLAGS_TO_PASS) install-strip)
@endif target-libgm2
# Other targets (info, dvi, pdf, etc.)
.PHONY: maybe-info-target-libgm2 info-target-libgm2
maybe-info-target-libgm2:
@if target-libgm2
maybe-info-target-libgm2: info-target-libgm2
info-target-libgm2: \
configure-target-libgm2
@: $(MAKE); $(unstage)
@[ -f $(TARGET_SUBDIR)/libgm2/Makefile ] || exit 0; \
r=`${PWD_COMMAND}`; export r; \
s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
$(NORMAL_TARGET_EXPORTS) \
echo "Doing info in $(TARGET_SUBDIR)/libgm2"; \
for flag in $(EXTRA_TARGET_FLAGS); do \
eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
done; \
(cd $(TARGET_SUBDIR)/libgm2 && \
$(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
"CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
"RANLIB=$${RANLIB}" \
"DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
info) \
|| exit 1
@endif target-libgm2
.PHONY: maybe-dvi-target-libgm2 dvi-target-libgm2
maybe-dvi-target-libgm2:
@if target-libgm2
maybe-dvi-target-libgm2: dvi-target-libgm2
dvi-target-libgm2: \
configure-target-libgm2
@: $(MAKE); $(unstage)
@[ -f $(TARGET_SUBDIR)/libgm2/Makefile ] || exit 0; \
r=`${PWD_COMMAND}`; export r; \
s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
$(NORMAL_TARGET_EXPORTS) \
echo "Doing dvi in $(TARGET_SUBDIR)/libgm2"; \
for flag in $(EXTRA_TARGET_FLAGS); do \
eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
done; \
(cd $(TARGET_SUBDIR)/libgm2 && \
$(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
"CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
"RANLIB=$${RANLIB}" \
"DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
dvi) \
|| exit 1
@endif target-libgm2
.PHONY: maybe-pdf-target-libgm2 pdf-target-libgm2
maybe-pdf-target-libgm2:
@if target-libgm2
maybe-pdf-target-libgm2: pdf-target-libgm2
pdf-target-libgm2: \
configure-target-libgm2
@: $(MAKE); $(unstage)
@[ -f $(TARGET_SUBDIR)/libgm2/Makefile ] || exit 0; \
r=`${PWD_COMMAND}`; export r; \
s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
$(NORMAL_TARGET_EXPORTS) \
echo "Doing pdf in $(TARGET_SUBDIR)/libgm2"; \
for flag in $(EXTRA_TARGET_FLAGS); do \
eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
done; \
(cd $(TARGET_SUBDIR)/libgm2 && \
$(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
"CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
"RANLIB=$${RANLIB}" \
"DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
pdf) \
|| exit 1
@endif target-libgm2
.PHONY: maybe-html-target-libgm2 html-target-libgm2
maybe-html-target-libgm2:
@if target-libgm2
maybe-html-target-libgm2: html-target-libgm2
html-target-libgm2: \
configure-target-libgm2
@: $(MAKE); $(unstage)
@[ -f $(TARGET_SUBDIR)/libgm2/Makefile ] || exit 0; \
r=`${PWD_COMMAND}`; export r; \
s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
$(NORMAL_TARGET_EXPORTS) \
echo "Doing html in $(TARGET_SUBDIR)/libgm2"; \
for flag in $(EXTRA_TARGET_FLAGS); do \
eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
done; \
(cd $(TARGET_SUBDIR)/libgm2 && \
$(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
"CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
"RANLIB=$${RANLIB}" \
"DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
html) \
|| exit 1
@endif target-libgm2
.PHONY: maybe-TAGS-target-libgm2 TAGS-target-libgm2
maybe-TAGS-target-libgm2:
@if target-libgm2
maybe-TAGS-target-libgm2: TAGS-target-libgm2
TAGS-target-libgm2: \
configure-target-libgm2
@: $(MAKE); $(unstage)
@[ -f $(TARGET_SUBDIR)/libgm2/Makefile ] || exit 0; \
r=`${PWD_COMMAND}`; export r; \
s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
$(NORMAL_TARGET_EXPORTS) \
echo "Doing TAGS in $(TARGET_SUBDIR)/libgm2"; \
for flag in $(EXTRA_TARGET_FLAGS); do \
eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
done; \
(cd $(TARGET_SUBDIR)/libgm2 && \
$(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
"CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
"RANLIB=$${RANLIB}" \
"DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
TAGS) \
|| exit 1
@endif target-libgm2
.PHONY: maybe-install-info-target-libgm2 install-info-target-libgm2
maybe-install-info-target-libgm2:
@if target-libgm2
maybe-install-info-target-libgm2: install-info-target-libgm2
install-info-target-libgm2: \
configure-target-libgm2 \
info-target-libgm2
@: $(MAKE); $(unstage)
@[ -f $(TARGET_SUBDIR)/libgm2/Makefile ] || exit 0; \
r=`${PWD_COMMAND}`; export r; \
s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
$(NORMAL_TARGET_EXPORTS) \
echo "Doing install-info in $(TARGET_SUBDIR)/libgm2"; \
for flag in $(EXTRA_TARGET_FLAGS); do \
eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
done; \
(cd $(TARGET_SUBDIR)/libgm2 && \
$(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
"CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
"RANLIB=$${RANLIB}" \
"DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
install-info) \
|| exit 1
@endif target-libgm2
.PHONY: maybe-install-dvi-target-libgm2 install-dvi-target-libgm2
maybe-install-dvi-target-libgm2:
@if target-libgm2
maybe-install-dvi-target-libgm2: install-dvi-target-libgm2
install-dvi-target-libgm2: \
configure-target-libgm2 \
dvi-target-libgm2
@: $(MAKE); $(unstage)
@[ -f $(TARGET_SUBDIR)/libgm2/Makefile ] || exit 0; \
r=`${PWD_COMMAND}`; export r; \
s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
$(NORMAL_TARGET_EXPORTS) \
echo "Doing install-dvi in $(TARGET_SUBDIR)/libgm2"; \
for flag in $(EXTRA_TARGET_FLAGS); do \
eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
done; \
(cd $(TARGET_SUBDIR)/libgm2 && \
$(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
"CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
"RANLIB=$${RANLIB}" \
"DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
install-dvi) \
|| exit 1
@endif target-libgm2
.PHONY: maybe-install-pdf-target-libgm2 install-pdf-target-libgm2
maybe-install-pdf-target-libgm2:
@if target-libgm2
maybe-install-pdf-target-libgm2: install-pdf-target-libgm2
install-pdf-target-libgm2: \
configure-target-libgm2 \
pdf-target-libgm2
@: $(MAKE); $(unstage)
@[ -f $(TARGET_SUBDIR)/libgm2/Makefile ] || exit 0; \
r=`${PWD_COMMAND}`; export r; \
s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
$(NORMAL_TARGET_EXPORTS) \
echo "Doing install-pdf in $(TARGET_SUBDIR)/libgm2"; \
for flag in $(EXTRA_TARGET_FLAGS); do \
eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
done; \
(cd $(TARGET_SUBDIR)/libgm2 && \
$(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
"CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
"RANLIB=$${RANLIB}" \
"DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
install-pdf) \
|| exit 1
@endif target-libgm2
.PHONY: maybe-install-html-target-libgm2 install-html-target-libgm2
maybe-install-html-target-libgm2:
@if target-libgm2
maybe-install-html-target-libgm2: install-html-target-libgm2
install-html-target-libgm2: \
configure-target-libgm2 \
html-target-libgm2
@: $(MAKE); $(unstage)
@[ -f $(TARGET_SUBDIR)/libgm2/Makefile ] || exit 0; \
r=`${PWD_COMMAND}`; export r; \
s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
$(NORMAL_TARGET_EXPORTS) \
echo "Doing install-html in $(TARGET_SUBDIR)/libgm2"; \
for flag in $(EXTRA_TARGET_FLAGS); do \
eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
done; \
(cd $(TARGET_SUBDIR)/libgm2 && \
$(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
"CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
"RANLIB=$${RANLIB}" \
"DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
install-html) \
|| exit 1
@endif target-libgm2
.PHONY: maybe-installcheck-target-libgm2 installcheck-target-libgm2
maybe-installcheck-target-libgm2:
@if target-libgm2
maybe-installcheck-target-libgm2: installcheck-target-libgm2
installcheck-target-libgm2: \
configure-target-libgm2
@: $(MAKE); $(unstage)
@[ -f $(TARGET_SUBDIR)/libgm2/Makefile ] || exit 0; \
r=`${PWD_COMMAND}`; export r; \
s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
$(NORMAL_TARGET_EXPORTS) \
echo "Doing installcheck in $(TARGET_SUBDIR)/libgm2"; \
for flag in $(EXTRA_TARGET_FLAGS); do \
eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
done; \
(cd $(TARGET_SUBDIR)/libgm2 && \
$(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
"CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
"RANLIB=$${RANLIB}" \
"DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
installcheck) \
|| exit 1
@endif target-libgm2
.PHONY: maybe-mostlyclean-target-libgm2 mostlyclean-target-libgm2
maybe-mostlyclean-target-libgm2:
@if target-libgm2
maybe-mostlyclean-target-libgm2: mostlyclean-target-libgm2
mostlyclean-target-libgm2:
@: $(MAKE); $(unstage)
@[ -f $(TARGET_SUBDIR)/libgm2/Makefile ] || exit 0; \
r=`${PWD_COMMAND}`; export r; \
s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
$(NORMAL_TARGET_EXPORTS) \
echo "Doing mostlyclean in $(TARGET_SUBDIR)/libgm2"; \
for flag in $(EXTRA_TARGET_FLAGS); do \
eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
done; \
(cd $(TARGET_SUBDIR)/libgm2 && \
$(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
"CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
"RANLIB=$${RANLIB}" \
"DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
mostlyclean) \
|| exit 1
@endif target-libgm2
.PHONY: maybe-clean-target-libgm2 clean-target-libgm2
maybe-clean-target-libgm2:
@if target-libgm2
maybe-clean-target-libgm2: clean-target-libgm2
clean-target-libgm2:
@: $(MAKE); $(unstage)
@[ -f $(TARGET_SUBDIR)/libgm2/Makefile ] || exit 0; \
r=`${PWD_COMMAND}`; export r; \
s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
$(NORMAL_TARGET_EXPORTS) \
echo "Doing clean in $(TARGET_SUBDIR)/libgm2"; \
for flag in $(EXTRA_TARGET_FLAGS); do \
eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
done; \
(cd $(TARGET_SUBDIR)/libgm2 && \
$(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
"CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
"RANLIB=$${RANLIB}" \
"DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
clean) \
|| exit 1
@endif target-libgm2
.PHONY: maybe-distclean-target-libgm2 distclean-target-libgm2
maybe-distclean-target-libgm2:
@if target-libgm2
maybe-distclean-target-libgm2: distclean-target-libgm2
distclean-target-libgm2:
@: $(MAKE); $(unstage)
@[ -f $(TARGET_SUBDIR)/libgm2/Makefile ] || exit 0; \
r=`${PWD_COMMAND}`; export r; \
s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
$(NORMAL_TARGET_EXPORTS) \
echo "Doing distclean in $(TARGET_SUBDIR)/libgm2"; \
for flag in $(EXTRA_TARGET_FLAGS); do \
eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
done; \
(cd $(TARGET_SUBDIR)/libgm2 && \
$(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
"CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
"RANLIB=$${RANLIB}" \
"DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
distclean) \
|| exit 1
@endif target-libgm2
.PHONY: maybe-maintainer-clean-target-libgm2 maintainer-clean-target-libgm2
maybe-maintainer-clean-target-libgm2:
@if target-libgm2
maybe-maintainer-clean-target-libgm2: maintainer-clean-target-libgm2
maintainer-clean-target-libgm2:
@: $(MAKE); $(unstage)
@[ -f $(TARGET_SUBDIR)/libgm2/Makefile ] || exit 0; \
r=`${PWD_COMMAND}`; export r; \
s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
$(NORMAL_TARGET_EXPORTS) \
echo "Doing maintainer-clean in $(TARGET_SUBDIR)/libgm2"; \
for flag in $(EXTRA_TARGET_FLAGS); do \
eval `echo "$$flag" | sed -e "s|^\([^=]*\)=\(.*\)|\1='\2'; export \1|"`; \
done; \
(cd $(TARGET_SUBDIR)/libgm2 && \
$(MAKE) $(BASE_FLAGS_TO_PASS) "AR=$${AR}" "AS=$${AS}" \
"CC=$${CC}" "CXX=$${CXX}" "LD=$${LD}" "NM=$${NM}" \
"RANLIB=$${RANLIB}" \
"DLLTOOL=$${DLLTOOL}" "WINDRES=$${WINDRES}" "WINDMC=$${WINDMC}" \
maintainer-clean) \
|| exit 1
@endif target-libgm2
.PHONY: configure-target-libgomp maybe-configure-target-libgomp
maybe-configure-target-libgomp:
@if gcc-bootstrap
@ -61221,6 +61744,14 @@ check-gcc-go:
(cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) check-go);
check-go: check-gcc-go check-target-libgo check-gotools
.PHONY: check-gcc-m2 check-m2
check-gcc-m2:
r=`${PWD_COMMAND}`; export r; \
s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
$(HOST_EXPORTS) \
(cd gcc && $(MAKE) $(GCC_FLAGS_TO_PASS) check-m2);
check-m2: check-gcc-m2 check-target-libgm2
.PHONY: check-gcc-d check-d
check-gcc-d:
r=`${PWD_COMMAND}`; export r; \
@ -64679,6 +65210,7 @@ configure-stageautoprofile-target-zlib: maybe-all-stageautoprofile-gcc
configure-stageautofeedback-target-zlib: maybe-all-stageautofeedback-gcc
configure-target-rda: stage_last
configure-target-libada: stage_last
configure-target-libgm2: stage_last
configure-stage1-target-libgomp: maybe-all-stage1-gcc
configure-stage2-target-libgomp: maybe-all-stage2-gcc
configure-stage3-target-libgomp: maybe-all-stage3-gcc
@ -64720,6 +65252,7 @@ configure-target-libffi: maybe-all-gcc
configure-target-zlib: maybe-all-gcc
configure-target-rda: maybe-all-gcc
configure-target-libada: maybe-all-gcc
configure-target-libgm2: maybe-all-gcc
configure-target-libgomp: maybe-all-gcc
configure-target-libitm: maybe-all-gcc
configure-target-libatomic: maybe-all-gcc
@ -66006,6 +66539,8 @@ all-target-fastjar: maybe-all-target-zlib
configure-target-libgo: maybe-all-target-libstdc++-v3
all-target-libgo: maybe-all-target-libbacktrace
all-target-libgo: maybe-all-target-libatomic
configure-target-libgm2: maybe-all-target-libstdc++-v3
all-target-libgm2: maybe-all-target-libatomic
configure-target-newlib: maybe-all-binutils
configure-target-newlib: maybe-all-ld
configure-target-libgfortran: maybe-all-target-libbacktrace
@ -66111,6 +66646,7 @@ configure-target-libffi: maybe-all-target-libgcc
configure-target-zlib: maybe-all-target-libgcc
configure-target-rda: maybe-all-target-libgcc
configure-target-libada: maybe-all-target-libgcc
configure-target-libgm2: maybe-all-target-libgcc
configure-target-libgomp: maybe-all-target-libgcc
configure-target-libitm: maybe-all-target-libgcc
configure-target-libatomic: maybe-all-target-libgcc
@ -66153,6 +66689,8 @@ configure-target-rda: maybe-all-target-newlib maybe-all-target-libgloss
configure-target-libada: maybe-all-target-newlib maybe-all-target-libgloss
configure-target-libgm2: maybe-all-target-newlib maybe-all-target-libgloss
configure-target-libgomp: maybe-all-target-newlib maybe-all-target-libgloss
configure-target-libitm: maybe-all-target-newlib maybe-all-target-libgloss

View file

@ -166,6 +166,8 @@ BUILD_EXPORTS = \
GOCFLAGS="$(GOCFLAGS_FOR_BUILD)"; export GOCFLAGS; \
GDC="$(GDC_FOR_BUILD)"; export GDC; \
GDCFLAGS="$(GDCFLAGS_FOR_BUILD)"; export GDCFLAGS; \
GM2="$(GM2_FOR_BUILD)"; export GM2; \
GM2FLAGS="$(GM2FLAGS_FOR_BUILD)"; export GM2FLAGS; \
DLLTOOL="$(DLLTOOL_FOR_BUILD)"; export DLLTOOL; \
DSYMUTIL="$(DSYMUTIL_FOR_BUILD)"; export DSYMUTIL; \
LD="$(LD_FOR_BUILD)"; export LD; \
@ -204,6 +206,7 @@ HOST_EXPORTS = \
GFORTRAN="$(GFORTRAN)"; export GFORTRAN; \
GOC="$(GOC)"; export GOC; \
GDC="$(GDC)"; export GDC; \
GM2="$(GM2)"; export GM2; \
AR="$(AR)"; export AR; \
AS="$(AS)"; export AS; \
CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \
@ -307,6 +310,7 @@ BASE_TARGET_EXPORTS = \
GFORTRAN="$(GFORTRAN_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export GFORTRAN; \
GOC="$(GOC_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export GOC; \
GDC="$(GDC_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export GDC; \
GM2="$(GM2_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export GM2; \
DLLTOOL="$(DLLTOOL_FOR_TARGET)"; export DLLTOOL; \
DSYMUTIL="$(DSYMUTIL_FOR_TARGET)"; export DSYMUTIL; \
LD="$(COMPILER_LD_FOR_TARGET)"; export LD; \
@ -373,6 +377,7 @@ DSYMUTIL_FOR_BUILD = @DSYMUTIL_FOR_BUILD@
GFORTRAN_FOR_BUILD = @GFORTRAN_FOR_BUILD@
GOC_FOR_BUILD = @GOC_FOR_BUILD@
GDC_FOR_BUILD = @GDC_FOR_BUILD@
GM2_FOR_BUILD = @GM2_FOR_BUILD@
LDFLAGS_FOR_BUILD = @LDFLAGS_FOR_BUILD@
LD_FOR_BUILD = @LD_FOR_BUILD@
NM_FOR_BUILD = @NM_FOR_BUILD@
@ -443,6 +448,7 @@ CXXFLAGS = @CXXFLAGS@
LIBCXXFLAGS = $(CXXFLAGS) -fno-implicit-templates
GOCFLAGS = $(CFLAGS)
GDCFLAGS = $(CFLAGS)
GM2FLAGS = $(CFLAGS)
# Pass additional PGO and LTO compiler options to the PGO build.
BUILD_CFLAGS = $(PGO_BUILD_CFLAGS) $(PGO_BUILD_LTO_CFLAGS)
@ -578,6 +584,7 @@ RAW_CXX_FOR_TARGET=$(STAGE_CC_WRAPPER) @RAW_CXX_FOR_TARGET@
GFORTRAN_FOR_TARGET=$(STAGE_CC_WRAPPER) @GFORTRAN_FOR_TARGET@
GOC_FOR_TARGET=$(STAGE_CC_WRAPPER) @GOC_FOR_TARGET@
GDC_FOR_TARGET=$(STAGE_CC_WRAPPER) @GDC_FOR_TARGET@
GM2_FOR_TARGET=$(STAGE_CC_WRAPPER) @GM2_FOR_TARGET@
DLLTOOL_FOR_TARGET=@DLLTOOL_FOR_TARGET@
DSYMUTIL_FOR_TARGET=@DSYMUTIL_FOR_TARGET@
LD_FOR_TARGET=@LD_FOR_TARGET@
@ -603,6 +610,7 @@ CXXFLAGS_FOR_TARGET = @CXXFLAGS_FOR_TARGET@
LIBCFLAGS_FOR_TARGET = $(CFLAGS_FOR_TARGET)
LIBCXXFLAGS_FOR_TARGET = $(CXXFLAGS_FOR_TARGET) -fno-implicit-templates
LDFLAGS_FOR_TARGET = @LDFLAGS_FOR_TARGET@
GM2FLAGS_FOR_TARGET = -O2 -g
GOCFLAGS_FOR_TARGET = -O2 -g
GDCFLAGS_FOR_TARGET = -O2 -g
@ -709,6 +717,7 @@ EXTRA_HOST_FLAGS = \
'GFORTRAN=$(GFORTRAN)' \
'GOC=$(GOC)' \
'GDC=$(GDC)' \
'GM2=$(GM2)' \
'LD=$(LD)' \
'LIPO=$(LIPO)' \
'NM=$(NM)' \
@ -735,6 +744,7 @@ POSTSTAGE1_FLAGS_TO_PASS = \
CC="$${CC}" CC_FOR_BUILD="$${CC_FOR_BUILD}" \
CXX="$${CXX}" CXX_FOR_BUILD="$${CXX_FOR_BUILD}" \
GDC="$${GDC}" GDC_FOR_BUILD="$${GDC_FOR_BUILD}" \
GM2="$${GM2}" GM2_FOR_BUILD="$${GM2_FOR_BUILD}" \
GNATBIND="$${GNATBIND}" \
LDFLAGS="$${LDFLAGS}" \
HOST_LIBS="$${HOST_LIBS}" \
@ -770,6 +780,8 @@ EXTRA_TARGET_FLAGS = \
'GOCFLAGS=$$(GOCFLAGS_FOR_TARGET)' \
'GDC=$$(GDC_FOR_TARGET) $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \
'GDCFLAGS=$$(GDCFLAGS_FOR_TARGET)' \
'GM2=$$(GM2_FOR_TARGET) $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \
'GM2FLAGS=$$(GM2FLAGS_FOR_TARGET)' \
'LD=$(COMPILER_LD_FOR_TARGET)' \
'LDFLAGS=$$(LDFLAGS_FOR_TARGET)' \
'LIBCFLAGS=$$(LIBCFLAGS_FOR_TARGET)' \
@ -796,6 +808,7 @@ TARGET_FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) $(EXTRA_TARGET_FLAGS)
# cross-building scheme.
EXTRA_GCC_FLAGS = \
"GCC_FOR_TARGET=$(GCC_FOR_TARGET) $$TFLAGS" \
"GM2_FOR_TARGET=$(GM2_FOR_TARGET) $$TFLAGS" \
"`echo 'STMP_FIXPROTO=$(STMP_FIXPROTO)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`" \
"`echo 'LIMITS_H_TEST=$(LIMITS_H_TEST)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`"

229
configure vendored
View file

@ -613,6 +613,7 @@ DSYMUTIL_FOR_TARGET
DLLTOOL_FOR_TARGET
AS_FOR_TARGET
AR_FOR_TARGET
GM2_FOR_TARGET
GDC_FOR_TARGET
GOC_FOR_TARGET
GFORTRAN_FOR_TARGET
@ -803,6 +804,7 @@ enable_compressed_debug_sections
enable_libquadmath
enable_libquadmath_support
enable_libada
enable_libgm2
enable_libssp
enable_libstdcxx
enable_bootstrap
@ -880,6 +882,7 @@ GCC_FOR_TARGET
GFORTRAN_FOR_TARGET
GOC_FOR_TARGET
GDC_FOR_TARGET
GM2_FOR_TARGET
AR_FOR_TARGET
AS_FOR_TARGET
DLLTOOL_FOR_TARGET
@ -1540,6 +1543,7 @@ Optional Features:
--disable-libquadmath-support
disable libquadmath support for Fortran
--enable-libada build libada directory
--enable-libgm2 build libgm2 directory
--enable-libssp build libssp directory
--disable-libstdcxx do not build libstdc++-v3 directory
--enable-bootstrap enable bootstrapping [yes if native build]
@ -1674,6 +1678,8 @@ Some influential environment variables:
GOC for the target
GDC_FOR_TARGET
GDC for the target
GM2_FOR_TARGET
GM2 for the target
AR_FOR_TARGET
AR for the target
AS_FOR_TARGET
@ -2812,7 +2818,7 @@ host_libs="intl libiberty opcodes bfd readline tcl tk itcl libgui zlib libbacktr
# binutils, gas and ld appear in that order because it makes sense to run
# "make check" in that particular order.
# If --enable-gold is used, "gold" may replace "ld".
host_tools="texinfo flex bison binutils gas ld fixincludes gcc cgen sid sim gdb gdbserver gprof etc expect dejagnu m4 utils guile fastjar gnattools libcc1 gotools c++tools"
host_tools="texinfo flex bison binutils gas ld fixincludes gcc cgen sid sim gdb gdbserver gprof etc expect dejagnu m4 utils guile fastjar gnattools libcc1 gm2tools gotools c++tools"
# these libraries are built for the target environment, and are built after
# the host libraries and the host tools (which may be a cross compiler)
@ -2833,6 +2839,7 @@ target_libraries="target-libgcc \
target-libffi \
target-libobjc \
target-libada \
target-libgm2 \
target-libgo \
target-libphobos \
target-zlib"
@ -3176,6 +3183,17 @@ if test "${ENABLE_LIBADA}" != "yes" ; then
noconfigdirs="$noconfigdirs gnattools"
fi
# Check whether --enable-libgm2 was given.
if test "${enable_libgm2+set}" = set; then :
enableval=$enable_libgm2; ENABLE_LIBGM2=$enableval
else
ENABLE_LIBGM2=no
fi
if test "${ENABLE_LIBGM2}" != "yes" ; then
noconfigdirs="$noconfigdirs gm2tools"
fi
# Check whether --enable-libssp was given.
if test "${enable_libssp+set}" = set; then :
enableval=$enable_libssp; ENABLE_LIBSSP=$enableval
@ -13786,6 +13804,167 @@ fi
if test -n "$GM2_FOR_TARGET"; then
ac_cv_prog_GM2_FOR_TARGET=$GM2_FOR_TARGET
elif test -n "$ac_cv_prog_GM2_FOR_TARGET"; then
GM2_FOR_TARGET=$ac_cv_prog_GM2_FOR_TARGET
fi
if test -n "$ac_cv_prog_GM2_FOR_TARGET"; then
for ncn_progname in gm2; do
# Extract the first word of "${ncn_progname}", so it can be a program name with args.
set dummy ${ncn_progname}; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_GM2_FOR_TARGET+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$GM2_FOR_TARGET"; then
ac_cv_prog_GM2_FOR_TARGET="$GM2_FOR_TARGET" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_GM2_FOR_TARGET="${ncn_progname}"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
fi
fi
GM2_FOR_TARGET=$ac_cv_prog_GM2_FOR_TARGET
if test -n "$GM2_FOR_TARGET"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $GM2_FOR_TARGET" >&5
$as_echo "$GM2_FOR_TARGET" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
done
fi
if test -z "$ac_cv_prog_GM2_FOR_TARGET" && test -n "$with_build_time_tools"; then
for ncn_progname in gm2; do
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${ncn_progname} in $with_build_time_tools" >&5
$as_echo_n "checking for ${ncn_progname} in $with_build_time_tools... " >&6; }
if test -x $with_build_time_tools/${ncn_progname}; then
ac_cv_prog_GM2_FOR_TARGET=$with_build_time_tools/${ncn_progname}
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
break
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
done
fi
if test -z "$ac_cv_prog_GM2_FOR_TARGET"; then
for ncn_progname in gm2; do
if test -n "$ncn_target_tool_prefix"; then
# Extract the first word of "${ncn_target_tool_prefix}${ncn_progname}", so it can be a program name with args.
set dummy ${ncn_target_tool_prefix}${ncn_progname}; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_GM2_FOR_TARGET+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$GM2_FOR_TARGET"; then
ac_cv_prog_GM2_FOR_TARGET="$GM2_FOR_TARGET" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_GM2_FOR_TARGET="${ncn_target_tool_prefix}${ncn_progname}"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
fi
fi
GM2_FOR_TARGET=$ac_cv_prog_GM2_FOR_TARGET
if test -n "$GM2_FOR_TARGET"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $GM2_FOR_TARGET" >&5
$as_echo "$GM2_FOR_TARGET" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
fi
if test -z "$ac_cv_prog_GM2_FOR_TARGET" && test $build = $target ; then
# Extract the first word of "${ncn_progname}", so it can be a program name with args.
set dummy ${ncn_progname}; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_GM2_FOR_TARGET+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$GM2_FOR_TARGET"; then
ac_cv_prog_GM2_FOR_TARGET="$GM2_FOR_TARGET" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_GM2_FOR_TARGET="${ncn_progname}"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
fi
fi
GM2_FOR_TARGET=$ac_cv_prog_GM2_FOR_TARGET
if test -n "$GM2_FOR_TARGET"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $GM2_FOR_TARGET" >&5
$as_echo "$GM2_FOR_TARGET" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
fi
test -n "$ac_cv_prog_GM2_FOR_TARGET" && break
done
fi
if test -z "$ac_cv_prog_GM2_FOR_TARGET" ; then
set dummy gm2
if test $build = $target ; then
GM2_FOR_TARGET="$2"
else
GM2_FOR_TARGET="${ncn_target_tool_prefix}$2"
fi
else
GM2_FOR_TARGET="$ac_cv_prog_GM2_FOR_TARGET"
fi
cat > conftest.c << \EOF
#ifdef __GNUC__
gcc_yay;
@ -17718,6 +17897,51 @@ $as_echo "pre-installed" >&6; }
fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking where to find the target gm2" >&5
$as_echo_n "checking where to find the target gm2... " >&6; }
if test "x${build}" != "x${host}" ; then
if expr "x$GM2_FOR_TARGET" : "x/" > /dev/null; then
# We already found the complete path
ac_dir=`dirname $GM2_FOR_TARGET`
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: pre-installed in $ac_dir" >&5
$as_echo "pre-installed in $ac_dir" >&6; }
else
# Canadian cross, just use what we found
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: pre-installed" >&5
$as_echo "pre-installed" >&6; }
fi
else
ok=yes
case " ${configdirs} " in
*" gcc "*) ;;
*) ok=no ;;
esac
case ,${enable_languages}, in
*,m2,*) ;;
*) ok=no ;;
esac
if test $ok = yes; then
# An in-tree tool is available and we can use it
GM2_FOR_TARGET='$$r/$(HOST_SUBDIR)/gcc/gm2 -B$$r/$(HOST_SUBDIR)/gcc/'
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: just compiled" >&5
$as_echo "just compiled" >&6; }
elif expr "x$GM2_FOR_TARGET" : "x/" > /dev/null; then
# We already found the complete path
ac_dir=`dirname $GM2_FOR_TARGET`
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: pre-installed in $ac_dir" >&5
$as_echo "pre-installed in $ac_dir" >&6; }
elif test "x$target" = "x$host"; then
# We can use an host tool
GM2_FOR_TARGET='$(GM2)'
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: host tool" >&5
$as_echo "host tool" >&6; }
else
# We need a cross tool
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: pre-installed" >&5
$as_echo "pre-installed" >&6; }
fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking where to find the target ld" >&5
$as_echo_n "checking where to find the target ld... " >&6; }
if test "x${build}" != "x${host}" ; then
@ -18279,6 +18503,9 @@ fi
# Specify what files to not compare during bootstrap.
compare_exclusions="gcc/cc*-checksum\$(objext) | gcc/ada/*tools/*"
compare_exclusions="$compare_exclusions | gcc/m2/gm2-compiler-boot/M2Version*"
compare_exclusions="$compare_exclusions | gcc/m2/gm2-compiler-boot/SYSTEM*"
compare_exclusions="$compare_exclusions | gcc/m2/gm2version*"
case "$target" in
hppa*64*-*-hpux*) ;;
powerpc*-ibm-aix*) compare_exclusions="$compare_exclusions | *libgomp*\$(objext)" ;;

View file

@ -140,7 +140,7 @@ host_libs="intl libiberty opcodes bfd readline tcl tk itcl libgui zlib libbacktr
# binutils, gas and ld appear in that order because it makes sense to run
# "make check" in that particular order.
# If --enable-gold is used, "gold" may replace "ld".
host_tools="texinfo flex bison binutils gas ld fixincludes gcc cgen sid sim gdb gdbserver gprof etc expect dejagnu m4 utils guile fastjar gnattools libcc1 gotools c++tools"
host_tools="texinfo flex bison binutils gas ld fixincludes gcc cgen sid sim gdb gdbserver gprof etc expect dejagnu m4 utils guile fastjar gnattools libcc1 gm2tools gotools c++tools"
# these libraries are built for the target environment, and are built after
# the host libraries and the host tools (which may be a cross compiler)
@ -161,6 +161,7 @@ target_libraries="target-libgcc \
target-libffi \
target-libobjc \
target-libada \
target-libgm2 \
target-libgo \
target-libphobos \
target-zlib"
@ -464,6 +465,14 @@ if test "${ENABLE_LIBADA}" != "yes" ; then
noconfigdirs="$noconfigdirs gnattools"
fi
AC_ARG_ENABLE(libgm2,
[AS_HELP_STRING([--enable-libgm2], [build libgm2 directory])],
ENABLE_LIBGM2=$enableval,
ENABLE_LIBGM2=no)
if test "${ENABLE_LIBGM2}" != "yes" ; then
noconfigdirs="$noconfigdirs gm2tools"
fi
AC_ARG_ENABLE(libssp,
[AS_HELP_STRING([--enable-libssp], [build libssp directory])],
ENABLE_LIBSSP=$enableval,
@ -3579,6 +3588,7 @@ NCN_STRICT_CHECK_TARGET_TOOLS(GCC_FOR_TARGET, gcc, ${CC_FOR_TARGET})
NCN_STRICT_CHECK_TARGET_TOOLS(GFORTRAN_FOR_TARGET, gfortran)
NCN_STRICT_CHECK_TARGET_TOOLS(GOC_FOR_TARGET, gccgo)
NCN_STRICT_CHECK_TARGET_TOOLS(GDC_FOR_TARGET, gdc)
NCN_STRICT_CHECK_TARGET_TOOLS(GM2_FOR_TARGET, gm2)
ACX_CHECK_INSTALLED_TARGET_TOOL(AR_FOR_TARGET, ar)
ACX_CHECK_INSTALLED_TARGET_TOOL(AS_FOR_TARGET, as)
@ -3617,6 +3627,8 @@ GCC_TARGET_TOOL(gccgo, GOC_FOR_TARGET, GOC,
[gcc/gccgo -B$$r/$(HOST_SUBDIR)/gcc/], go)
GCC_TARGET_TOOL(gdc, GDC_FOR_TARGET, GDC,
[gcc/gdc -B$$r/$(HOST_SUBDIR)/gcc/], d)
GCC_TARGET_TOOL(gm2, GM2_FOR_TARGET, GM2,
[gcc/gm2 -B$$r/$(HOST_SUBDIR)/gcc/], m2)
GCC_TARGET_TOOL(ld, LD_FOR_TARGET, LD, [ld/ld-new])
GCC_TARGET_TOOL(lipo, LIPO_FOR_TARGET, LIPO)
GCC_TARGET_TOOL(nm, NM_FOR_TARGET, NM, [binutils/nm-new])
@ -3743,6 +3755,9 @@ AC_SUBST(stage2_werror_flag)
# Specify what files to not compare during bootstrap.
compare_exclusions="gcc/cc*-checksum\$(objext) | gcc/ada/*tools/*"
compare_exclusions="$compare_exclusions | gcc/m2/gm2-compiler-boot/M2Version*"
compare_exclusions="$compare_exclusions | gcc/m2/gm2-compiler-boot/SYSTEM*"
compare_exclusions="$compare_exclusions | gcc/m2/gm2version*"
case "$target" in
hppa*64*-*-hpux*) ;;
powerpc*-ibm-aix*) compare_exclusions="$compare_exclusions | *libgomp*\$(objext)" ;;

View file

@ -211,6 +211,12 @@
#endif
/* If --with-multiarch option is used */
#ifndef USED_FOR_TARGET
#undef ENABLE_MULTIARCH
#endif
/* Define to 1 if translation of program messages to the user's native
language is requested. */
#ifndef USED_FOR_TARGET
@ -2324,12 +2330,6 @@
#endif
/* Specify if mutliarch is enabled. */
#ifndef USED_FOR_TARGET
#undef ENABLE_MULTIARCH
#endif
/* The size of `dev_t', as computed by sizeof. */
#ifndef USED_FOR_TARGET
#undef SIZEOF_DEV_T

85
gcc/configure vendored
View file

@ -805,6 +805,8 @@ am__leading_dot
doc_build_sys
AR
NM
HAVE_PYTHON
PYTHON
BISON
FLEX
GENERATED_MANPAGES
@ -8899,6 +8901,84 @@ done
test -n "$BISON" || BISON="$MISSING bison"
# Python3?
# Extract the first word of "python3", so it can be a program name with args.
set dummy python3; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_PYTHON+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$PYTHON"; then
ac_cv_prog_PYTHON="$PYTHON" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_PYTHON="python3"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
fi
fi
PYTHON=$ac_cv_prog_PYTHON
if test -n "$PYTHON"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYTHON" >&5
$as_echo "$PYTHON" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
if test -n "$PYTHON"; then
# Found it, now check the version.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for modern python3" >&5
$as_echo_n "checking for modern python3... " >&6; }
if ${gcc_cv_prog_python3_modern+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_prog_version=`eval $PYTHON --version 2>&1 |
sed -n 's/^.*Python.* \([0-9][0-9.]*\).*$/\1/p'`
case $ac_prog_version in
'') gcc_cv_prog_python3_modern=no;;
3.[4-9]*|3.[1-9][0-9]*|[4-9].*|[1-9][0-9]*) gcc_cv_prog_python3_modern=yes;;
*) gcc_cv_prog_python3_modern=no;;
esac
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_prog_python3_modern" >&5
$as_echo "$gcc_cv_prog_python3_modern" >&6; }
else
gcc_cv_prog_python3_modern=no
fi
if test $gcc_cv_prog_python3_modern = no; then
PYTHON="${CONFIG_SHELL-/bin/sh} $ac_aux_dir/missing python3"
fi
if test $gcc_cv_prog_python3_modern = no; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING:
*** Python3 is missing.
*** Documentation for modula-2 will not include the target SYSTEM module." >&5
$as_echo "$as_me: WARNING:
*** Python3 is missing.
*** Documentation for modula-2 will not include the target SYSTEM module." >&2;}
HAVE_PYTHON=no
else
HAVE_PYTHON=yes
fi
# Binutils are not build modules, unlike bison/flex/makeinfo. So we
# check for build == host before using them.
@ -19712,7 +19792,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
#line 19715 "configure"
#line 19795 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@ -19818,7 +19898,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
#line 19821 "configure"
#line 19901 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@ -33909,4 +33989,3 @@ if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then
$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;}
fi

View file

@ -1263,6 +1263,20 @@ AC_CHECK_PROGS([FLEX], flex, [$MISSING flex])
# Bison?
AC_CHECK_PROGS([BISON], bison, [$MISSING bison])
# Python3?
ACX_CHECK_PROG_VER(PYTHON, python3, --version,
[Python.* \([0-9][0-9.]*\)],
[3.[4-9]*|3.[1-9][0-9]*|[4-9].*|[1-9][0-9]*])
if test $gcc_cv_prog_python3_modern = no; then
AC_MSG_WARN([
*** Python3 is missing.
*** Documentation for modula-2 will not include the target SYSTEM module.])
HAVE_PYTHON=no
else
HAVE_PYTHON=yes
fi
AC_SUBST(HAVE_PYTHON)
# Binutils are not build modules, unlike bison/flex/makeinfo. So we
# check for build == host before using them.
@ -7651,4 +7665,3 @@ done
],
[subdirs='$subdirs'])
AC_OUTPUT

2838
gcc/doc/gm2.texi Normal file

File diff suppressed because it is too large Load diff

View file

@ -308,6 +308,13 @@ On some targets, @samp{libphobos} isn't enabled by default, but compiles
and works if @option{--enable-libphobos} is used. Specifics are
documented for affected targets.
@item @anchor{GM2-prerequisite}GM2
Python3 is required if you want to build the complete Modula-2
documentation including the target @code{SYSTEM} definition module.
If Python3 is unavailable Modula-2 documentation will include a target
independent version of the SYSTEM modules.
@item A ``working'' POSIX compatible shell, or GNU bash
Necessary when running @command{configure} because some
@ -436,6 +443,34 @@ Necessary to build GCC with zstd compression used for LTO bytecode.
The library is searched in your default library patch search.
Alternatively, the @option{--with-zstd} configure option should be used.
@item Python3 modules
The complete list of Python3 modules broken down by GCC subcomponent
is shown below:
@table @asis
@item internal debugging in gdbhooks
@code{gdb}, @code{gdb.printing}, @code{gdb.types},
@code{os.path}, @code{re}, @code{sys} and @code{tempfile},
@item g++ testsuite
@code{gcov}, @code{gzip}, @code{json}, @code{os} and @code{pytest}.
@item c++ cxx api generation
@code{csv}, @code{os}, @code{sys} and @code{time}.
@item modula-2 documentation
@code{argparse}, @code{os}, @code{pathlib}, @code{shutil} and
@code{sys}.
@item git developer tools
@code{os} and @code{sys}.
@item ada documentation
@code{latex_elements}, @code{os}, @code{pygments}, @code{re},
@code{sys} and @code{time}.
@end table
@end table
@heading Tools/packages necessary for modifying GCC
@ -1853,11 +1888,13 @@ grep ^language= */config-lang.in
@end smallexample
Currently, you can use any of the following:
@code{all}, @code{default}, @code{ada}, @code{c}, @code{c++}, @code{d},
@code{fortran}, @code{go}, @code{jit}, @code{lto}, @code{objc}, @code{obj-c++}.
@code{fortran}, @code{go}, @code{jit}, @code{lto}, @code{m2},
@code{objc}, @code{obj-c++}.
Building the Ada compiler has special requirements, see below.
If you do not pass this flag, or specify the option @code{default}, then the
default languages available in the @file{gcc} sub-tree will be configured.
Ada, D, Go, Jit, and Objective-C++ are not default languages. LTO is not a
Ada, D, Go, Jit, Objective-C++ and Modula-2 are not default languages.
LTO is not a
default language, but is built by default because @option{--enable-lto} is
enabled by default. The other languages are default languages. If
@code{all} is specified, then all available languages are built. An
@ -1885,6 +1922,10 @@ be built. This can be useful for debugging, or for compatibility with
previous Ada build procedures, when it was required to explicitly
do a @samp{make -C gcc gnatlib_and_tools}.
@item --disable-libgm2
Specify that the run-time libraries and tools used by Modula-2 should not
be built. This can be useful for debugging.
@item --disable-libsanitizer
Specify that the run-time libraries for the various sanitizers should
not be built.
@ -3144,10 +3185,10 @@ on a simulator as described at @uref{https://gcc.gnu.org/simtest-howto.html}.
In order to run sets of tests selectively, there are targets
@samp{make check-gcc} and language specific @samp{make check-c},
@samp{make check-c++}, @samp{make check-d} @samp{make check-fortran},
@samp{make check-ada}, @samp{make check-objc}, @samp{make check-obj-c++},
@samp{make check-lto}
in the @file{gcc} subdirectory of the object directory. You can also
just run @samp{make check} in a subdirectory of the object directory.
@samp{make check-ada}, @samp{make check-m2}, @samp{make check-objc},
@samp{make check-obj-c++}, @samp{make check-lto} in the @file{gcc}
subdirectory of the object directory. You can also just run
@samp{make check} in a subdirectory of the object directory.
A more selective way to just run all @command{gcc} execute tests in the

View file

@ -97,6 +97,9 @@ The GCC runtime library.
@item libgfortran
The Fortran runtime library.
@item libgm2
The Modula-2 runtime library.
@item libgo
The Go runtime library. The bulk of this library is mirrored from the
@uref{https://github.com/@/golang/go, master Go repository}.
@ -184,7 +187,8 @@ The @file{gcc} directory contains the following subdirectories:
@item @var{language}
Subdirectories for various languages. Directories containing a file
@file{config-lang.in} are language subdirectories. The contents of
the subdirectories @file{c} (for C), @file{cp} (for C++),
the subdirectories @file{c} (for C), @file{cp} (for C++), @file{m2}
(for Modula-2),
@file{objc} (for Objective-C), @file{objcp} (for Objective-C++),
and @file{lto} (for LTO) are documented in this
manual (@pxref{Passes, , Passes and Files of the Compiler});

View file

@ -25221,6 +25221,8 @@ gen_compile_unit_die (const char *filename)
}
else if (strcmp (language_string, "GNU F77") == 0)
language = DW_LANG_Fortran77;
else if (strcmp (language_string, "GNU Modula-2") == 0)
language = DW_LANG_Modula2;
else if (dwarf_version >= 3 || !dwarf_strict)
{
if (strcmp (language_string, "GNU Ada") == 0)

397
gcc/m2/COPYING.FDL Normal file
View file

@ -0,0 +1,397 @@
GNU Free Documentation License
Version 1.2, November 2002
Copyright (C) 2000-2022 Free Software Foundation, Inc.
51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
0. PREAMBLE
The purpose of this License is to make a manual, textbook, or other
functional and useful document "free" in the sense of freedom: to
assure everyone the effective freedom to copy and redistribute it,
with or without modifying it, either commercially or noncommercially.
Secondarily, this License preserves for the author and publisher a way
to get credit for their work, while not being considered responsible
for modifications made by others.
This License is a kind of "copyleft", which means that derivative
works of the document must themselves be free in the same sense. It
complements the GNU General Public License, which is a copyleft
license designed for free software.
We have designed this License in order to use it for manuals for free
software, because free software needs free documentation: a free
program should come with manuals providing the same freedoms that the
software does. But this License is not limited to software manuals;
it can be used for any textual work, regardless of subject matter or
whether it is published as a printed book. We recommend this License
principally for works whose purpose is instruction or reference.
1. APPLICABILITY AND DEFINITIONS
This License applies to any manual or other work, in any medium, that
contains a notice placed by the copyright holder saying it can be
distributed under the terms of this License. Such a notice grants a
world-wide, royalty-free license, unlimited in duration, to use that
work under the conditions stated herein. The "Document", below,
refers to any such manual or work. Any member of the public is a
licensee, and is addressed as "you". You accept the license if you
copy, modify or distribute the work in a way requiring permission
under copyright law.
A "Modified Version" of the Document means any work containing the
Document or a portion of it, either copied verbatim, or with
modifications and/or translated into another language.
A "Secondary Section" is a named appendix or a front-matter section of
the Document that deals exclusively with the relationship of the
publishers or authors of the Document to the Document's overall subject
(or to related matters) and contains nothing that could fall directly
within that overall subject. (Thus, if the Document is in part a
textbook of mathematics, a Secondary Section may not explain any
mathematics.) The relationship could be a matter of historical
connection with the subject or with related matters, or of legal,
commercial, philosophical, ethical or political position regarding
them.
The "Invariant Sections" are certain Secondary Sections whose titles
are designated, as being those of Invariant Sections, in the notice
that says that the Document is released under this License. If a
section does not fit the above definition of Secondary then it is not
allowed to be designated as Invariant. The Document may contain zero
Invariant Sections. If the Document does not identify any Invariant
Sections then there are none.
The "Cover Texts" are certain short passages of text that are listed,
as Front-Cover Texts or Back-Cover Texts, in the notice that says that
the Document is released under this License. A Front-Cover Text may
be at most 5 words, and a Back-Cover Text may be at most 25 words.
A "Transparent" copy of the Document means a machine-readable copy,
represented in a format whose specification is available to the
general public, that is suitable for revising the document
straightforwardly with generic text editors or (for images composed of
pixels) generic paint programs or (for drawings) some widely available
drawing editor, and that is suitable for input to text formatters or
for automatic translation to a variety of formats suitable for input
to text formatters. A copy made in an otherwise Transparent file
format whose markup, or absence of markup, has been arranged to thwart
or discourage subsequent modification by readers is not Transparent.
An image format is not Transparent if used for any substantial amount
of text. A copy that is not "Transparent" is called "Opaque".
Examples of suitable formats for Transparent copies include plain
ASCII without markup, Texinfo input format, LaTeX input format, SGML
or XML using a publicly available DTD, and standard-conforming simple
HTML, PostScript or PDF designed for human modification. Examples of
transparent image formats include PNG, XCF and JPG. Opaque formats
include proprietary formats that can be read and edited only by
proprietary word processors, SGML or XML for which the DTD and/or
processing tools are not generally available, and the
machine-generated HTML, PostScript or PDF produced by some word
processors for output purposes only.
The "Title Page" means, for a printed book, the title page itself,
plus such following pages as are needed to hold, legibly, the material
this License requires to appear in the title page. For works in
formats which do not have any title page as such, "Title Page" means
the text near the most prominent appearance of the work's title,
preceding the beginning of the body of the text.
A section "Entitled XYZ" means a named subunit of the Document whose
title either is precisely XYZ or contains XYZ in parentheses following
text that translates XYZ in another language. (Here XYZ stands for a
specific section name mentioned below, such as "Acknowledgements",
"Dedications", "Endorsements", or "History".) To "Preserve the Title"
of such a section when you modify the Document means that it remains a
section "Entitled XYZ" according to this definition.
The Document may include Warranty Disclaimers next to the notice which
states that this License applies to the Document. These Warranty
Disclaimers are considered to be included by reference in this
License, but only as regards disclaiming warranties: any other
implication that these Warranty Disclaimers may have is void and has
no effect on the meaning of this License.
2. VERBATIM COPYING
You may copy and distribute the Document in any medium, either
commercially or noncommercially, provided that this License, the
copyright notices, and the license notice saying this License applies
to the Document are reproduced in all copies, and that you add no other
conditions whatsoever to those of this License. You may not use
technical measures to obstruct or control the reading or further
copying of the copies you make or distribute. However, you may accept
compensation in exchange for copies. If you distribute a large enough
number of copies you must also follow the conditions in section 3.
You may also lend copies, under the same conditions stated above, and
you may publicly display copies.
3. COPYING IN QUANTITY
If you publish printed copies (or copies in media that commonly have
printed covers) of the Document, numbering more than 100, and the
Document's license notice requires Cover Texts, you must enclose the
copies in covers that carry, clearly and legibly, all these Cover
Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on
the back cover. Both covers must also clearly and legibly identify
you as the publisher of these copies. The front cover must present
the full title with all words of the title equally prominent and
visible. You may add other material on the covers in addition.
Copying with changes limited to the covers, as long as they preserve
the title of the Document and satisfy these conditions, can be treated
as verbatim copying in other respects.
If the required texts for either cover are too voluminous to fit
legibly, you should put the first ones listed (as many as fit
reasonably) on the actual cover, and continue the rest onto adjacent
pages.
If you publish or distribute Opaque copies of the Document numbering
more than 100, you must either include a machine-readable Transparent
copy along with each Opaque copy, or state in or with each Opaque copy
a computer-network location from which the general network-using
public has access to download using public-standard network protocols
a complete Transparent copy of the Document, free of added material.
If you use the latter option, you must take reasonably prudent steps,
when you begin distribution of Opaque copies in quantity, to ensure
that this Transparent copy will remain thus accessible at the stated
location until at least one year after the last time you distribute an
Opaque copy (directly or through your agents or retailers) of that
edition to the public.
It is requested, but not required, that you contact the authors of the
Document well before redistributing any large number of copies, to give
them a chance to provide you with an updated version of the Document.
4. MODIFICATIONS
You may copy and distribute a Modified Version of the Document under
the conditions of sections 2 and 3 above, provided that you release
the Modified Version under precisely this License, with the Modified
Version filling the role of the Document, thus licensing distribution
and modification of the Modified Version to whoever possesses a copy
of it. In addition, you must do these things in the Modified Version:
A. Use in the Title Page (and on the covers, if any) a title distinct
from that of the Document, and from those of previous versions
(which should, if there were any, be listed in the History section
of the Document). You may use the same title as a previous version
if the original publisher of that version gives permission.
B. List on the Title Page, as authors, one or more persons or entities
responsible for authorship of the modifications in the Modified
Version, together with at least five of the principal authors of the
Document (all of its principal authors, if it has fewer than five),
unless they release you from this requirement.
C. State on the Title page the name of the publisher of the
Modified Version, as the publisher.
D. Preserve all the copyright notices of the Document.
E. Add an appropriate copyright notice for your modifications
adjacent to the other copyright notices.
F. Include, immediately after the copyright notices, a license notice
giving the public permission to use the Modified Version under the
terms of this License, in the form shown in the Addendum below.
G. Preserve in that license notice the full lists of Invariant Sections
and required Cover Texts given in the Document's license notice.
H. Include an unaltered copy of this License.
I. Preserve the section Entitled "History", Preserve its Title, and add
to it an item stating at least the title, year, new authors, and
publisher of the Modified Version as given on the Title Page. If
there is no section Entitled "History" in the Document, create one
stating the title, year, authors, and publisher of the Document as
given on its Title Page, then add an item describing the Modified
Version as stated in the previous sentence.
J. Preserve the network location, if any, given in the Document for
public access to a Transparent copy of the Document, and likewise
the network locations given in the Document for previous versions
it was based on. These may be placed in the "History" section.
You may omit a network location for a work that was published at
least four years before the Document itself, or if the original
publisher of the version it refers to gives permission.
K. For any section Entitled "Acknowledgements" or "Dedications",
Preserve the Title of the section, and preserve in the section all
the substance and tone of each of the contributor acknowledgements
and/or dedications given therein.
L. Preserve all the Invariant Sections of the Document,
unaltered in their text and in their titles. Section numbers
or the equivalent are not considered part of the section titles.
M. Delete any section Entitled "Endorsements". Such a section
may not be included in the Modified Version.
N. Do not retitle any existing section to be Entitled "Endorsements"
or to conflict in title with any Invariant Section.
O. Preserve any Warranty Disclaimers.
If the Modified Version includes new front-matter sections or
appendices that qualify as Secondary Sections and contain no material
copied from the Document, you may at your option designate some or all
of these sections as invariant. To do this, add their titles to the
list of Invariant Sections in the Modified Version's license notice.
These titles must be distinct from any other section titles.
You may add a section Entitled "Endorsements", provided it contains
nothing but endorsements of your Modified Version by various
parties--for example, statements of peer review or that the text has
been approved by an organization as the authoritative definition of a
standard.
You may add a passage of up to five words as a Front-Cover Text, and a
passage of up to 25 words as a Back-Cover Text, to the end of the list
of Cover Texts in the Modified Version. Only one passage of
Front-Cover Text and one of Back-Cover Text may be added by (or
through arrangements made by) any one entity. If the Document already
includes a cover text for the same cover, previously added by you or
by arrangement made by the same entity you are acting on behalf of,
you may not add another; but you may replace the old one, on explicit
permission from the previous publisher that added the old one.
The author(s) and publisher(s) of the Document do not by this License
give permission to use their names for publicity for or to assert or
imply endorsement of any Modified Version.
5. COMBINING DOCUMENTS
You may combine the Document with other documents released under this
License, under the terms defined in section 4 above for modified
versions, provided that you include in the combination all of the
Invariant Sections of all of the original documents, unmodified, and
list them all as Invariant Sections of your combined work in its
license notice, and that you preserve all their Warranty Disclaimers.
The combined work need only contain one copy of this License, and
multiple identical Invariant Sections may be replaced with a single
copy. If there are multiple Invariant Sections with the same name but
different contents, make the title of each such section unique by
adding at the end of it, in parentheses, the name of the original
author or publisher of that section if known, or else a unique number.
Make the same adjustment to the section titles in the list of
Invariant Sections in the license notice of the combined work.
In the combination, you must combine any sections Entitled "History"
in the various original documents, forming one section Entitled
"History"; likewise combine any sections Entitled "Acknowledgements",
and any sections Entitled "Dedications". You must delete all sections
Entitled "Endorsements".
6. COLLECTIONS OF DOCUMENTS
You may make a collection consisting of the Document and other documents
released under this License, and replace the individual copies of this
License in the various documents with a single copy that is included in
the collection, provided that you follow the rules of this License for
verbatim copying of each of the documents in all other respects.
You may extract a single document from such a collection, and distribute
it individually under this License, provided you insert a copy of this
License into the extracted document, and follow this License in all
other respects regarding verbatim copying of that document.
7. AGGREGATION WITH INDEPENDENT WORKS
A compilation of the Document or its derivatives with other separate
and independent documents or works, in or on a volume of a storage or
distribution medium, is called an "aggregate" if the copyright
resulting from the compilation is not used to limit the legal rights
of the compilation's users beyond what the individual works permit.
When the Document is included in an aggregate, this License does not
apply to the other works in the aggregate which are not themselves
derivative works of the Document.
If the Cover Text requirement of section 3 is applicable to these
copies of the Document, then if the Document is less than one half of
the entire aggregate, the Document's Cover Texts may be placed on
covers that bracket the Document within the aggregate, or the
electronic equivalent of covers if the Document is in electronic form.
Otherwise they must appear on printed covers that bracket the whole
aggregate.
8. TRANSLATION
Translation is considered a kind of modification, so you may
distribute translations of the Document under the terms of section 4.
Replacing Invariant Sections with translations requires special
permission from their copyright holders, but you may include
translations of some or all Invariant Sections in addition to the
original versions of these Invariant Sections. You may include a
translation of this License, and all the license notices in the
Document, and any Warranty Disclaimers, provided that you also include
the original English version of this License and the original versions
of those notices and disclaimers. In case of a disagreement between
the translation and the original version of this License or a notice
or disclaimer, the original version will prevail.
If a section in the Document is Entitled "Acknowledgements",
"Dedications", or "History", the requirement (section 4) to Preserve
its Title (section 1) will typically require changing the actual
title.
9. TERMINATION
You may not copy, modify, sublicense, or distribute the Document except
as expressly provided for under this License. Any other attempt to
copy, modify, sublicense or distribute the Document is void, and will
automatically terminate your rights under this License. However,
parties who have received copies, or rights, from you under this
License will not have their licenses terminated so long as such
parties remain in full compliance.
10. FUTURE REVISIONS OF THIS LICENSE
The Free Software Foundation may publish new, revised versions
of the GNU Free Documentation License from time to time. Such new
versions will be similar in spirit to the present version, but may
differ in detail to address new problems or concerns. See
http://www.gnu.org/copyleft/.
Each version of the License is given a distinguishing version number.
If the Document specifies that a particular numbered version of this
License "or any later version" applies to it, you have the option of
following the terms and conditions either of that specified version or
of any later version that has been published (not as a draft) by the
Free Software Foundation. If the Document does not specify a version
number of this License, you may choose any version ever published (not
as a draft) by the Free Software Foundation.
ADDENDUM: How to use this License for your documents
To use this License in a document you have written, include a copy of
the License in the document and put the following copyright and
license notices just after the title page:
Copyright (c) YEAR YOUR NAME.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.2
or any later version published by the Free Software Foundation;
with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
A copy of the license is included in the section entitled "GNU
Free Documentation License".
If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts,
replace the "with...Texts." line with this:
with the Invariant Sections being LIST THEIR TITLES, with the
Front-Cover Texts being LIST, and with the Back-Cover Texts being LIST.
If you have Invariant Sections without Cover Texts, or some other
combination of the three, merge those two alternatives to suit the
situation.
If your document contains nontrivial examples of program code, we
recommend releasing these examples in parallel under your choice of
free software license, such as the GNU General Public License,
to permit their use in free software.

73
gcc/m2/COPYING.RUNTIME Normal file
View file

@ -0,0 +1,73 @@
GCC RUNTIME LIBRARY EXCEPTION
Version 3.1, 31 March 2009
Copyright (C) 2009-2022 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies of this
license document, but changing it is not allowed.
This GCC Runtime Library Exception ("Exception") is an additional
permission under section 7 of the GNU General Public License, version
3 ("GPLv3"). It applies to a given file (the "Runtime Library") that
bears a notice placed by the copyright holder of the file stating that
the file is governed by GPLv3 along with this Exception.
When you use GCC to compile a program, GCC may combine portions of
certain GCC header files and runtime libraries with the compiled
program. The purpose of this Exception is to allow compilation of
non-GPL (including proprietary) programs to use, in this way, the
header files and runtime libraries covered by this Exception.
0. Definitions.
A file is an "Independent Module" if it either requires the Runtime
Library for execution after a Compilation Process, or makes use of an
interface provided by the Runtime Library, but is not otherwise based
on the Runtime Library.
"GCC" means a version of the GNU Compiler Collection, with or without
modifications, governed by version 3 (or a specified later version) of
the GNU General Public License (GPL) with the option of using any
subsequent versions published by the FSF.
"GPL-compatible Software" is software whose conditions of propagation,
modification and use would permit combination with GCC in accord with
the license of GCC.
"Target Code" refers to output from any compiler for a real or virtual
target processor architecture, in executable form or suitable for
input to an assembler, loader, linker and/or execution
phase. Notwithstanding that, Target Code does not include data in any
format that is used as a compiler intermediate representation, or used
for producing a compiler intermediate representation.
The "Compilation Process" transforms code entirely represented in
non-intermediate languages designed for human-written code, and/or in
Java Virtual Machine byte code, into Target Code. Thus, for example,
use of source code generators and preprocessors need not be considered
part of the Compilation Process, since the Compilation Process can be
understood as starting with the output of the generators or
preprocessors.
A Compilation Process is "Eligible" if it is done using GCC, alone or
with other GPL-compatible software, or if it is done without using any
work based on GCC. For example, using non-GPL-compatible Software to
optimize any GCC intermediate representations would not qualify as an
Eligible Compilation Process.
1. Grant of Additional Permission.
You have permission to propagate a work of Target Code formed by
combining the Runtime Library with Independent Modules, even if such
propagation would otherwise violate the terms of GPLv3, provided that
all Target Code was generated by Eligible Compilation Processes. You
may then convey such a combination under terms of your choice,
consistent with the licensing of the Independent Modules.
2. No Weakening of GCC Copyleft.
The availability of this Exception does not imply any general
presumption that third-party software is unaffected by the copyleft
requirements of the license of GCC.

675
gcc/m2/COPYING3 Normal file
View file

@ -0,0 +1,675 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
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 3 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, see <http://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<http://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<http://www.gnu.org/philosophy/why-not-lgpl.html>.

165
gcc/m2/COPYING3.LIB Normal file
View file

@ -0,0 +1,165 @@
GNU LESSER GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
This version of the GNU Lesser General Public License incorporates
the terms and conditions of version 3 of the GNU General Public
License, supplemented by the additional permissions listed below.
0. Additional Definitions.
As used herein, "this License" refers to version 3 of the GNU Lesser
General Public License, and the "GNU GPL" refers to version 3 of the GNU
General Public License.
"The Library" refers to a covered work governed by this License,
other than an Application or a Combined Work as defined below.
An "Application" is any work that makes use of an interface provided
by the Library, but which is not otherwise based on the Library.
Defining a subclass of a class defined by the Library is deemed a mode
of using an interface provided by the Library.
A "Combined Work" is a work produced by combining or linking an
Application with the Library. The particular version of the Library
with which the Combined Work was made is also called the "Linked
Version".
The "Minimal Corresponding Source" for a Combined Work means the
Corresponding Source for the Combined Work, excluding any source code
for portions of the Combined Work that, considered in isolation, are
based on the Application, and not on the Linked Version.
The "Corresponding Application Code" for a Combined Work means the
object code and/or source code for the Application, including any data
and utility programs needed for reproducing the Combined Work from the
Application, but excluding the System Libraries of the Combined Work.
1. Exception to Section 3 of the GNU GPL.
You may convey a covered work under sections 3 and 4 of this License
without being bound by section 3 of the GNU GPL.
2. Conveying Modified Versions.
If you modify a copy of the Library, and, in your modifications, a
facility refers to a function or data to be supplied by an Application
that uses the facility (other than as an argument passed when the
facility is invoked), then you may convey a copy of the modified
version:
a) under this License, provided that you make a good faith effort to
ensure that, in the event an Application does not supply the
function or data, the facility still operates, and performs
whatever part of its purpose remains meaningful, or
b) under the GNU GPL, with none of the additional permissions of
this License applicable to that copy.
3. Object Code Incorporating Material from Library Header Files.
The object code form of an Application may incorporate material from
a header file that is part of the Library. You may convey such object
code under terms of your choice, provided that, if the incorporated
material is not limited to numerical parameters, data structure
layouts and accessors, or small macros, inline functions and templates
(ten or fewer lines in length), you do both of the following:
a) Give prominent notice with each copy of the object code that the
Library is used in it and that the Library and its use are
covered by this License.
b) Accompany the object code with a copy of the GNU GPL and this license
document.
4. Combined Works.
You may convey a Combined Work under terms of your choice that,
taken together, effectively do not restrict modification of the
portions of the Library contained in the Combined Work and reverse
engineering for debugging such modifications, if you also do each of
the following:
a) Give prominent notice with each copy of the Combined Work that
the Library is used in it and that the Library and its use are
covered by this License.
b) Accompany the Combined Work with a copy of the GNU GPL and this license
document.
c) For a Combined Work that displays copyright notices during
execution, include the copyright notice for the Library among
these notices, as well as a reference directing the user to the
copies of the GNU GPL and this license document.
d) Do one of the following:
0) Convey the Minimal Corresponding Source under the terms of this
License, and the Corresponding Application Code in a form
suitable for, and under terms that permit, the user to
recombine or relink the Application with a modified version of
the Linked Version to produce a modified Combined Work, in the
manner specified by section 6 of the GNU GPL for conveying
Corresponding Source.
1) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (a) uses at run time
a copy of the Library already present on the user's computer
system, and (b) will operate properly with a modified version
of the Library that is interface-compatible with the Linked
Version.
e) Provide Installation Information, but only if you would otherwise
be required to provide such information under section 6 of the
GNU GPL, and only to the extent that such information is
necessary to install and execute a modified version of the
Combined Work produced by recombining or relinking the
Application with a modified version of the Linked Version. (If
you use option 4d0, the Installation Information must accompany
the Minimal Corresponding Source and Corresponding Application
Code. If you use option 4d1, you must provide the Installation
Information in the manner specified by section 6 of the GNU GPL
for conveying Corresponding Source.)
5. Combined Libraries.
You may place library facilities that are a work based on the
Library side by side in a single library together with other library
facilities that are not Applications and are not covered by this
License, and convey such a combined library under terms of your
choice, if you do both of the following:
a) Accompany the combined library with a copy of the same work based
on the Library, uncombined with any other library facilities,
conveyed under the terms of this License.
b) Give prominent notice with the combined library that part of it
is a work based on the Library, and explaining where to find the
accompanying uncombined form of the same work.
6. Revised Versions of the GNU Lesser General Public License.
The Free Software Foundation may publish revised and/or new versions
of the GNU Lesser General Public License from time to time. Such new
versions will be similar in spirit to the present version, but may
differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the
Library as you received it specifies that a certain numbered version
of the GNU Lesser General Public License "or any later version"
applies to it, you have the option of following the terms and
conditions either of that published version or of any later version
published by the Free Software Foundation. If the Library as you
received it does not specify a version number of the GNU Lesser
General Public License, you may choose any version of the GNU Lesser
General Public License ever published by the Free Software Foundation.
If the Library as you received it specifies that a proxy can decide
whether future versions of the GNU Lesser General Public License shall
apply, that proxy's public statement of acceptance of any version is
permanent authorization for you to choose that version for the
Library.

View file

@ -1,5 +0,0 @@
Copyright (C) 2022 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
notice and this notice are preserved.

1653
gcc/m2/Make-lang.in Normal file

File diff suppressed because it is too large Load diff

856
gcc/m2/Make-maintainer.in Normal file
View file

@ -0,0 +1,856 @@
# Make-maintainer.in build support tools for GNU M2.
# Copyright (C) 2022 Free Software Foundation, Inc.
#This file is part of GCC.
#GCC 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 3, or (at your option)
#any later version.
#GCC 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 GCC; see the file COPYING3. If not see
#<http://www.gnu.org/licenses/>.
# QUIAT=@
XGCC = ./xgcc -B./
GM2_2 = ./gm2 -B./stage2/m2 -g -fm2-g
# m2/ppg$(exeext) is the recursive descent parser generator.
PPG-INTERFACE-C = libc.c mcrts.c Selective.c termios.c \
SysExceptions.c wrapc.c \
SYSTEM.c errno.c
PPG-INTERFACE-CC = UnixArgs.cc ldtoa.cc dtoa.cc
# Implementation modules found in the gm2-compiler directory.
PPG-MODS = SymbolKey.mod NameKey.mod Lists.mod bnflex.mod Output.mod
# Core library definition modules used by ppg found in the gm2-libs directory.
PPG-LIB-DEFS = Args.def Assertion.def ASCII.def Debug.def \
DynamicStrings.def FIO.def Indexing.def IO.def \
NumberIO.def PushBackInput.def \
M2Dependent.def \
M2EXCEPTION.def M2LINK.def M2RTS.def \
RTExceptions.def \
StdIO.def SFIO.def StrIO.def StrLib.def \
Storage.def StrCase.def SysStorage.def
# Core library implementation modules used by ppg found in the gm2-libs directory.
PPG-LIB-MODS = ASCII.mod \
Args.mod \
Assertion.mod \
Debug.mod \
DynamicStrings.mod \
FIO.mod \
IO.mod \
Indexing.mod \
M2Dependent.mod \
M2EXCEPTION.mod \
M2RTS.mod \
NumberIO.mod \
PushBackInput.mod \
RTExceptions.mod \
SFIO.mod \
StdIO.mod \
Storage.mod \
StrCase.mod \
StrIO.mod \
StrLib.mod \
SysStorage.mod
# Program module ppg.mod from which pge.mod is created. ppg.mod is
# where changes should be made and then you should run pge-maintainer
# to recreate the C++ version of pge.
PPG-SRC = ppg.mod
BUILD-PPG-O = $(PPG-INTERFACE-C:%.c=m2/gm2-ppg-boot/$(SRC_PREFIX)%.o) \
$(PPG-INTERFACE-CC:%.cc=m2/gm2-ppg-boot/$(SRC_PREFIX)%.o) \
$(PPG-MODS:%.mod=m2/gm2-ppg-boot/$(SRC_PREFIX)%.o) \
$(PPG-LIB-MODS:%.mod=m2/gm2-ppg-boot/$(SRC_PREFIX)%.o) \
$(PPG-SRC:%.mod=m2/gm2-ppg-boot/$(SRC_PREFIX)%.o)
MCC_ARGS= --olang=c++ \
--quiet \
--h-file-prefix=$(SRC_PREFIX) \
-I$(srcdir)/m2/gm2-libs \
-I$(srcdir)/m2/gm2-compiler \
-I$(srcdir)/m2/gm2-libiberty \
-I$(srcdir)/m2/gm2-gcc
MCC=m2/boot-bin/mc$(exeext) $(MCC_ARGS)
BUILD-PPG-LIBS-H = $(PPG-LIB-DEFS:%.def=m2/gm2-ppg-boot/$(SRC_PREFIX)%.h)
BUILD-PPG-H = m2/boot-bin/mc$(exeext) $(BUILD-PPG-LIBS-H)
m2/gm2-ppg-boot/$(SRC_PREFIX)%.h: $(srcdir)/m2/gm2-libs/%.def $(MCDEPS)
$(MCC) -o=$@ $(srcdir)/m2/gm2-libs/$*.def
m2/gm2-ppg-boot/$(SRC_PREFIX)%.o: m2/mc-boot-ch/$(SRC_PREFIX)%.c m2/gm2-libs/gm2-libs-host.h
$(CXX) -I. -I$(srcdir)/../include -I$(srcdir) -I$(srcdir)/m2/mc-boot-ch -Im2/gm2-libs $(INCLUDES) -g -c $< -o $@
m2/gm2-ppg-boot/$(SRC_PREFIX)%.o: m2/mc-boot-ch/$(SRC_PREFIX)%.cc m2/gm2-libs/gm2-libs-host.h
$(CXX) -I. -I$(srcdir)/../include -I$(srcdir) -I$(srcdir)/m2/mc-boot-ch -Im2/gm2-libs $(INCLUDES) -g -c $< -o $@
m2/gm2-ppg-boot/$(SRC_PREFIX)%.o: $(srcdir)/m2/gm2-libs/%.mod $(MCDEPS) $(BUILD-BOOT-H)
$(MCC) -o=m2/gm2-ppg-boot/$(SRC_PREFIX)$*.c $(srcdir)/m2/gm2-libs/$*.mod
$(CXX) -I. -I$(srcdir)/../include -I$(srcdir) \
-Im2/gm2-ppg-boot -I$(srcdir)/m2/mc-boot -Im2/gm2-libs-boot \
-I$(srcdir)/m2/mc-boot-ch $(INCLUDES) -g -c m2/gm2-ppg-boot/$(SRC_PREFIX)$*.c -o $@
m2/gm2-ppg-boot/$(SRC_PREFIX)%.o: $(srcdir)/m2/gm2-compiler/%.mod $(MCDEPS) $(BUILD-BOOT-H)
$(MCC) -o=m2/gm2-ppg-boot/$(SRC_PREFIX)$*.c $(srcdir)/m2/gm2-compiler/$*.mod
$(CXX) -I. -I$(srcdir)/../include -I$(srcdir) \
-Im2/mc-boot -Im2/gm2-compiler-boot -Im2/gm2-libs-boot \
-I$(srcdir)/m2/mc-boot-ch $(INCLUDES) -g -c m2/gm2-ppg-boot/$(SRC_PREFIX)$*.c -o $@
m2/ppg$(exeext): m2/boot-bin/mc $(BUILD-PPG-O) $(BUILD-MC-INTERFACE-O) m2/gm2-ppg-boot/main.o \
m2/gm2-libs-boot/RTcodummy.o m2/mc-boot-ch/$(SRC_PREFIX)abort.o \
m2/gm2-libs-boot/M2LINK.o
+$(LINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) -o $@ $(BUILD-PPG-O) m2/gm2-ppg-boot/main.o \
m2/gm2-libs-boot/RTcodummy.o m2/mc-boot-ch/$(SRC_PREFIX)abort.o \
m2/gm2-libs-boot/M2LINK.o -lm
m2/gm2-ppg-boot/main.o: $(M2LINK) $(srcdir)/m2/init/mcinit
unset CC ; $(M2LINK) -s --langc++ --exit --name mainppginit.c $(srcdir)/m2/init/ppginit
mv mainppginit.c m2/gm2-ppg-boot/main.c
$(CXX) $(INCLUDES) -g -c -o $@ m2/gm2-ppg-boot/main.c
m2/gm2-auto:
test -d $@ || mkdir -p $@
# m2/pg$(exext) is the 2nd generation parser generator built from ebnf
# without error recovery
PG-SRC = pg.mod
BUILD-PG-O = $(PPG-INTERFACE-C:%.c=m2/gm2-pg-boot/$(SRC_PREFIX)%.o) \
$(PPG-INTERFACE-CC:%.cc=m2/gm2-pg-boot/$(SRC_PREFIX)%.o) \
$(PPG-MODS:%.mod=m2/gm2-pg-boot/$(SRC_PREFIX)%.o) \
$(PPG-LIB-MODS:%.mod=m2/gm2-pg-boot/$(SRC_PREFIX)%.o) \
$(PG-SRC:%.mod=m2/gm2-pg-boot/$(SRC_PREFIX)%.o)
m2/gm2-pg-boot/$(SRC_PREFIX)%.h: $(srcdir)/m2/gm2-libs/%.def $(MCDEPS)
$(MCC) -o=$@ $(srcdir)/m2/gm2-libs/$*.def
m2/gm2-pg-boot/$(SRC_PREFIX)%.o: m2/mc-boot-ch/$(SRC_PREFIX)%.c m2/gm2-libs/gm2-libs-host.h
$(CXX) -I. -I$(srcdir)/../include -I$(srcdir) -I$(srcdir)/m2/mc-boot-ch -Im2/gm2-libs $(INCLUDES) -g -c $< -o $@
m2/gm2-pg-boot/$(SRC_PREFIX)%.o: m2/mc-boot-ch/$(SRC_PREFIX)%.cc m2/gm2-libs/gm2-libs-host.h
$(CXX) -I. -I$(srcdir)/../include -I$(srcdir) -I$(srcdir)/m2/mc-boot-ch -Im2/gm2-libs $(INCLUDES) -g -c $< -o $@
m2/gm2-pg-boot/$(SRC_PREFIX)%.o: $(srcdir)/m2/gm2-libs/%.mod $(MCDEPS) $(BUILD-BOOT-H)
$(MCC) -o=m2/gm2-pg-boot/$(SRC_PREFIX)$*.c $(srcdir)/m2/gm2-libs/$*.mod
$(CXX) -I. -I$(srcdir)/../include -I$(srcdir) -Im2/gm2-pg-boot -I$(srcdir)/m2/mc-boot \
-I$(srcdir)/m2/mc-boot-ch \
-Im2/gm2-libs-boot $(INCLUDES) \
-g -c m2/gm2-pg-boot/$(SRC_PREFIX)$*.c -o $@
m2/gm2-pg-boot/$(SRC_PREFIX)%.o: $(srcdir)/m2/gm2-compiler/%.mod $(MCDEPS) $(BUILD-BOOT-H)
$(MCC) -o=m2/gm2-pg-boot/$(SRC_PREFIX)$*.c $(srcdir)/m2/gm2-compiler/$*.mod
$(CXX) -I. -I$(srcdir)/../include -I$(srcdir) -Im2/mc-boot -Im2/gm2-compiler-boot -Im2/gm2-libs-boot \
-I$(srcdir)/m2/mc-boot-ch $(INCLUDES) -g -c m2/gm2-pg-boot/$(SRC_PREFIX)$*.c -o $@
m2/gm2-pg-boot/$(SRC_PREFIX)pg.o: m2/gm2-auto/pg.mod $(MCDEPS) $(BUILD-BOOT-H)
$(MCC) -o=m2/gm2-pg-boot/$(SRC_PREFIX)pg.c m2/gm2-auto/pg.mod
$(CXX) -I. -I$(srcdir)/../include -I$(srcdir) -Im2/mc-boot -Im2/gm2-compiler-boot -Im2/gm2-libs-boot \
-I$(srcdir)/m2/mc-boot-ch $(INCLUDES) -g -c m2/gm2-pg-boot/$(SRC_PREFIX)pg.c -o $@
m2/pg$(exeext): m2/boot-bin/mc \
$(BUILD-PG-O) $(GM2-PPG-MODS:%.mod=m2/gm2-pg-boot/%.o) \
$(BUILD-MC-INTERFACE-O) m2/gm2-pg-boot/main.o m2/gm2-libs-boot/RTcodummy.o \
m2/mc-boot-ch/$(SRC_PREFIX)abort.o m2/gm2-libs-boot/M2LINK.o
+$(LINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) -o $@ $(BUILD-PG-O) \
m2/gm2-pg-boot/main.o m2/gm2-libs-boot/RTcodummy.o \
m2/gm2-libs-boot/M2LINK.o \
m2/mc-boot-ch/$(SRC_PREFIX)abort.o -lm
m2/gm2-auto/pginit:
sed -e 's/ppg/pg/' < $(srcdir)/m2/init/ppginit > $@
m2/gm2-pg-boot/main.o: m2/gm2-auto/pginit $(M2LINK)
unset CC ; $(M2LINK) -s --langc++ --exit --name mainpginit.c m2/gm2-auto/pginit
mv mainpginit.c m2/gm2-pg-boot/main.c
$(CXX) $(INCLUDES) -g -c -o $@ m2/gm2-pg-boot/main.c
m2/pg-e$(exeext): m2/pg$(exeext)
$(CP) m2/pg$(exeext) m2/pg-e$(exeext)
$(SHELL) $(srcdir)/m2/tools-src/buildpg $(srcdir)/m2/gm2-compiler/ppg.mod pg -e > m2/gm2-auto/t.bnf
./m2/pg-e$(exeext) -e -l m2/gm2-auto/t.bnf | sed -e 's/t\.bnf/pg\.bnf/' > m2/gm2-auto/t.mod
$(QUIAT)if ! diff m2/gm2-auto/t.mod m2/gm2-auto/pg.mod > /dev/null ; then \
echo "pg failed during self build" ; \
exit 1 ; \
fi
$(RM) m2/gm2-auto/t.bnf m2/gm2-auto/t.mod
m2/gm2-auto/pg.mod: m2/ppg$(exeext)
$(SHELL) $(srcdir)/m2/tools-src/buildpg $(srcdir)/m2/gm2-compiler/ppg.mod pg -e > m2/gm2-auto/pg.bnf
./m2/ppg$(exeext) -e -l m2/gm2-auto/pg.bnf > m2/gm2-auto/pg.mod
# pge is the recursive descent parser with first/followset error recovery.
PGE-SRC = pge.mod
BUILD-PGE-O = $(PPG-INTERFACE-C:%.c=m2/gm2-pge-boot/$(SRC_PREFIX)%.o) \
$(PPG-INTERFACE-CC:%.cc=m2/gm2-pge-boot/$(SRC_PREFIX)%.o) \
$(PPG-MODS:%.mod=m2/gm2-pge-boot/$(SRC_PREFIX)%.o) \
$(PPG-LIB-MODS:%.mod=m2/gm2-pge-boot/$(SRC_PREFIX)%.o) \
$(PGE-SRC:%.mod=m2/gm2-pge-boot/$(SRC_PREFIX)%.o)
m2/gm2-auto/pge.mod: m2/pg$(exeext)
$(SHELL) $(srcdir)/m2/tools-src/buildpg $(srcdir)/m2/gm2-compiler/ppg.mod pge > m2/gm2-auto/pge.bnf
./m2/pg$(exeext) -l m2/gm2-auto/pge.bnf -o m2/gm2-auto/pge.mod
m2/gm2-pge-boot/$(SRC_PREFIX)%.h: $(srcdir)/m2/gm2-libs/%.def $(MCDEPS)
$(MCC) -o=$@ $(srcdir)/m2/gm2-libs/$*.def
m2/gm2-pge-boot/$(SRC_PREFIX)libc.o: $(srcdir)/m2/mc-boot-ch/Glibc.c m2/gm2-libs/gm2-libs-host.h
$(CXX) -I. -I$(srcdir)/../include -I$(srcdir) $(INCLUDES) -I$(srcdir)/m2/mc-boot-ch -Im2/gm2-libs -g -c $< -o $@
m2/gm2-pge-boot/$(SRC_PREFIX)mcrts.o: $(srcdir)/m2/mc-boot-ch/Gmcrts.c m2/gm2-libs/gm2-libs-host.h
$(CXX) -I. -I$(srcdir)/../include -I$(srcdir) $(INCLUDES) -I$(srcdir)/m2/mc-boot-ch -Im2/gm2-libs -g -c $< -o $@
m2/gm2-pge-boot/$(SRC_PREFIX)UnixArgs.o: $(srcdir)/m2/mc-boot-ch/GUnixArgs.cc
$(CXX) -I. -I$(srcdir)/../include -I$(srcdir) -I$(srcdir)/m2/mc-boot-ch $(INCLUDES) -g -c $< -o $@
m2/gm2-pge-boot/$(SRC_PREFIX)Selective.o: $(srcdir)/m2/mc-boot-ch/GSelective.c m2/gm2-libs/gm2-libs-host.h
$(CXX) -I. -I$(srcdir)/../include -I$(srcdir) -I$(srcdir)/m2/mc-boot-ch $(INCLUDES) -Im2/gm2-libs -g -c $< -o $@
m2/gm2-pge-boot/$(SRC_PREFIX)termios.o: $(srcdir)/m2/mc-boot-ch/Gtermios.cc m2/gm2-libs/gm2-libs-host.h
$(CXX) -I. -I$(srcdir)/../include -I$(srcdir) -I$(srcdir)/m2/mc-boot-ch -Im2/gm2-libs $(INCLUDES) -g -c $< -o $@
m2/gm2-pge-boot/$(SRC_PREFIX)SysExceptions.o: $(srcdir)/m2/mc-boot-ch/GSysExceptions.c m2/gm2-libs/gm2-libs-host.h
$(CXX) -I. -I$(srcdir)/../include -I$(srcdir) -I$(srcdir)/m2/mc-boot-ch -Im2/gm2-libs $(INCLUDES) -g -c $< -o $@
m2/gm2-pge-boot/$(SRC_PREFIX)ldtoa.o: $(srcdir)/m2/mc-boot-ch/Gldtoa.c m2/gm2-libs/gm2-libs-host.h
$(CXX) -I. -I$(srcdir)/../include -I$(srcdir) -I$(srcdir)/m2/mc-boot-ch -Im2/gm2-libs $(INCLUDES) -g -c $< -o $@
m2/gm2-pge-boot/$(SRC_PREFIX)dtoa.o: $(srcdir)/m2/mc-boot-ch/Gdtoa.c m2/gm2-libs/gm2-libs-host.h
$(CXX) -I. -I$(srcdir)/../include -I$(srcdir) -I$(srcdir)/m2/mc-boot-ch -Im2/gm2-libs $(INCLUDES) -g -c $< -o $@
m2/gm2-pge-boot/$(SRC_PREFIX)wrapc.o: $(srcdir)/m2/mc-boot-ch/Gwrapc.c m2/gm2-libs/gm2-libs-host.h
$(CXX) -I. -I$(srcdir)/../include -I$(srcdir) -I$(srcdir)/m2/mc-boot-ch -Im2/gm2-libs $(INCLUDES) -g -c $< -o $@
m2/gm2-pge-boot/$(SRC_PREFIX)SYSTEM.o: $(srcdir)/m2/mc-boot-ch/GSYSTEM.c
$(CXX) -I. -I$(srcdir)/../include -I$(srcdir) -I$(srcdir)/m2/mc-boot-ch $(INCLUDES) -g -c $< -o $@
m2/gm2-pge-boot/$(SRC_PREFIX)errno.o: $(srcdir)/m2/mc-boot-ch/Gerrno.c
$(CXX) -I. -I$(srcdir)/../include -I$(srcdir) -I$(srcdir)/m2/mc-boot-ch $(INCLUDES) -g -c $< -o $@
m2/gm2-pge-boot/$(SRC_PREFIX)%.o: $(srcdir)/m2/gm2-libs/%.mod $(MCDEPS) $(BUILD-BOOT-H)
$(MCC) -o=m2/gm2-pge-boot/$(SRC_PREFIX)$*.c $(srcdir)/m2/gm2-libs/$*.mod
$(CXX) -I. -I$(srcdir)/../include -I$(srcdir) -Im2/gm2-pge-boot -I$(srcdir)/m2/mc-boot \
-I$(srcdir)/m2/mc-boot-ch -Im2/gm2-libs-boot \
$(INCLUDES) -g -c m2/gm2-pge-boot/$(SRC_PREFIX)$*.c -o $@
m2/gm2-pge-boot/$(SRC_PREFIX)%.o: $(srcdir)/m2/gm2-compiler/%.mod $(MCDEPS) $(BUILD-BOOT-H)
$(MCC) -o=m2/gm2-pge-boot/$(SRC_PREFIX)$*.c $(srcdir)/m2/gm2-compiler/$*.mod
$(CXX) -I. -I$(srcdir)/../include -I$(srcdir) -Im2/mc-boot -Im2/gm2-compiler-boot \
-Im2/gm2-libs-boot \
-I$(srcdir)/m2/mc-boot-ch $(INCLUDES) -g -c m2/gm2-pge-boot/$(SRC_PREFIX)$*.c -o $@
m2/gm2-pge-boot/$(SRC_PREFIX)pge.o: m2/gm2-auto/pge.mod $(MCDEPS) $(BUILD-BOOT-H)
$(MCC) -o=m2/gm2-pge-boot/$(SRC_PREFIX)pge.c m2/gm2-auto/pge.mod
$(CXX) -I. -I$(srcdir)/../include -I$(srcdir) \
-Im2/mc-boot -Im2/gm2-compiler-boot -Im2/gm2-libs-boot \
-I$(srcdir)/m2/mc-boot-ch $(INCLUDES) -g -c m2/gm2-pge-boot/$(SRC_PREFIX)pge.c -o $@
m2/pge$(exeext): m2/boot-bin/mc \
$(BUILD-PGE-O) $(GM2-PPG-MODS:%.mod=m2/gm2-pge-boot/%.o) \
$(BUILD-MC-INTERFACE-O) m2/gm2-pge-boot/main.o m2/gm2-libs-boot/RTcodummy.o \
m2/mc-boot-ch/$(SRC_PREFIX)abort.o m2/gm2-libs-boot/M2LINK.o
+$(LINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) -o $@ $(BUILD-PGE-O) \
m2/gm2-pge-boot/main.o m2/gm2-libs-boot/RTcodummy.o \
m2/mc-boot-ch/$(SRC_PREFIX)abort.o m2/gm2-libs-boot/M2LINK.o -lm
$(SHELL) $(srcdir)/m2/tools-src/buildpg $(srcdir)/m2/gm2-compiler/ppg.mod t > m2/gm2-auto/t.bnf
./m2/pge$(exeext) m2/gm2-auto/t.bnf -o m2/gm2-auto/t1.mod
./m2/pg$(exeext) m2/gm2-auto/t.bnf -o m2/gm2-auto/t2.mod
$(QUIAT)if ! diff m2/gm2-auto/t1.mod m2/gm2-auto/t2.mod > /dev/null ; then \
echo "failure: pg (with error recovery) failed" ; \
$(RM) m2/pge$(exeext) ; \
exit 1 ; \
fi
$(RM) m2/gm2-auto/t.mod m2/gm2-auto/t1.mod m2/gm2-auto/t2.mod
m2/gm2-auto/pgeinit:
sed -e 's/ppg/pge/' < $(srcdir)/m2/init/ppginit > $@
m2/gm2-pge-boot/main.o: m2/gm2-auto/pgeinit $(M2LINK)
unset CC ; $(M2LINK) -s --langc++ --exit --name mainpgeinit.c m2/gm2-auto/pgeinit
mv mainpgeinit.c m2/gm2-pge-boot/main.c
$(CXX) $(INCLUDES) -g -c -o $@ m2/gm2-pge-boot/main.c
$(objdir)/m2/gm2-ppg-boot:
test -d $@ || mkdir $@
$(objdir)/m2/gm2-pg-boot:
test -d $@ || mkdir $@
$(objdir)/m2/gm2-pge-boot:
test -d $@ || mkdir $@
m2/gm2-auto/pg.o: m2/gm2-auto/pg.mod $(MCDEPS)
$(MC) --quiet -o=m2/gm2-auto/pg.c m2/gm2-auto/pg.mod
$(COMPILER) -c $(CFLAGS) -I. -I$(srcdir)/../include -I$(srcdir) -I$(srcdir)/m2 -Im2/gm2-libs-boot -Im2/gm2-compiler-boot -I$(srcdir)/m2/mc-boot-ch $(INCLUDES) m2/gm2-auto/pg.c -o $@
m2/gm2-auto/pge.o: m2/gm2-auto/pge.mod $(MCDEPS)
$(MC) --quiet -o=m2/gm2-auto/pge.c m2/gm2-auto/pge.mod
$(COMPILER) -c $(CFLAGS) -I. -I$(srcdir)/../include -I$(srcdir) -I$(srcdir)/m2 -Im2/gm2-libs-boot -Im2/gm2-compiler-boot -I$(srcdir)/m2/mc-boot-ch $(INCLUDES) m2/gm2-auto/pge.c -o $@
pge-help: force
@echo "The pge maintainer commands are:"
@echo " "
@echo " make pge-maintainer"
@echo " make pge-verify"
@echo " make pge-push # copy pge C++ sources (app and libs) into srcdir/m2/pge-boot"
@echo " make pge-libs-push # copy C++ libraries which pge uses into srcdir/m2/pge-boot"
@echo " make pge-app-push # copy pge C++ application modules into srcdir/m2/pge-boot"
@echo " make pge-clean"
pge-maintainer: $(PGE)
# Copy the C++ sources for ppe.mod into $(srcdir)/pge-boot.
pge-push: pge-libs-push pge-app-push
pge-libs-push: force
for i in $(cat $(srcdir)/m2/init/ppginit) ; do \
if [ -f $(srcdir)/m2/gm2-libs-ch/${i}.h ] ; then \
cp $(srcdir)/m2/gm2-libs-ch/${i}.h $(srcdir) ; \
else \
echo "not found ${i}" ; \
fi ; \
if [ -f $(srcdir)/m2/gm2-libs-ch/${i}.c* ] ; then \
cp $(srcdir)/m2/gm2-libs-ch/${i}.c* $(srcdir) ; \
elif [ -f $(srcdir)/m2/gm2-pge-libs/${i}.c* ] ; then \
cp $(srcdir)/m2/gm2-pge-libs/${i}.c* $(srcdir) ; \
else \
echo "not found ${i}" ; \
fi ; \
done
pge-app-push: force
cp m2/gm2-pge-boot/*.c $(srcdir)/m2/pge-boot
# Perform sanity checks.
pge-verify: force
# Remove pge build files.
pge-clean: force
$(RM) -f m2/gm2-pg-boot/* m2/gm2-ppg-boot/* m2/gm2-pge-boot/*
# The rest of the Make-lang.in handles the bootstrap tool (maintained
# mode) and also provides testing between the bootstrapped and the
# non-bootstrapped compilers.
# Rules for mc
# The default rule used generate mc, eventually it will be replaced by mc-bootstrap.
BOOTGM2=gm2
MCOPTIONS=-g -c -fsources -fsoft-check-all -fm2-g # -fauto-init
MCLINK=-g # use -g -fmodules -c if you are debugging and wish to see missing modules.
# This is only needed in maintainer mode by 'make mc-maintainer' when regenerating the C
# version of mc. We need a working Modula-2 compiler to run mc-maintainer.
GM2SYS=${HOME}/opt/lib/gcc/x86_64-pc-linux-gnu/12.0.0/m2/m2pim
GM2PATH=$(srcdir)/m2/mc:$(GM2SYS):$(srcdir)/m2:m2/gm2-auto:$(srcdir)/m2/gm2-libs:$(srcdir)/m2/gm2-libs-iso
mc: mc-clean mc-devel
mc-push: force
cp -p m2/mc-boot-gen/*.c $(srcdir)/m2/mc-boot/
cp -p m2/mc-boot-gen/*.h $(srcdir)/m2/mc-boot/
mc-clean: force m2/mc-obj
$(RM) m2/mc-boot-gen/*.[ch] m2/boot-bin/* m2/mc-boot/* m2/mc-boot-ch/*
mc-maintainer: mc-clean mc-autogen mc-push mc-clean mc-bootstrap
mc-clean-libs: force
$(RM) m2/gm2-libs-boot/*
mc-continue: mc-clean mc-bootstrap mc-clean-libs mc-fresh $(BUILD-MC-INTERFACE-O) $(BUILD-LIBS-BOOT) $(BUILD-COMPILER-BOOT)
mc-fresh: force
$(RM) m2/gm2-auto/* m2/gm2-compiler-boot/* m2/gm2-libs-boot/*
mc-help: force
@echo "mc-maintainer produces a new mc C version in the source tree (takes longer)"
@echo "mc-continue builds the mc from the C version and attempts to build gm2 libraries and gm2 compiler"
@echo "mc-verify builds mc from Modula-2 sources and mc from C sources and run both on all sources diffing the output"
@echo "mc builds mc from Modula-2 sources, quickly"
@echo "m2/pge build the parser generator (needed by mc-maintainer)"
m2/mc-obj:
mkdir $@
mc-verify: mc-clean mc-bootstrap mc
mv mc m2/boot-bin/mc.m2
@echo "verifying the two generations of mc"
for i in $(GM2-VERIFY-MODS) ; do \
echo -n "$$i " ; \
m2/boot-bin/mc $(MC_ARGS) -o=mcout.c $(srcdir)/m2/gm2-compiler/$$i > /dev/null ; \
echo -n "[1]" ; \
m2/boot-bin/mc.m2 $(MC_ARGS) -o=mcout.m2 $(srcdir)/m2/gm2-compiler/$$i > /dev/null ; \
echo -n "[2]" ; \
$(RM) $$i.mc-diff ; \
if [ -f mcout.c -a -f mcout.m2 ] ; then \
if diff mcout.c mcout.m2 > /dev/null ; then \
echo "[passed]" ; \
else \
echo "[*** failed ***]" ; \
diff mcout.c mcout.m2 > $$i.mc-diff ; \
fi \
fi ; \
$(RM) mcout.c mcout.m2 ; \
done
mc-stage2: force
m2/boot-bin/mc$(exeext) -I$(srcdir)/m2/mc:$(srcdir)/m2/gm2-libs:$(srcdir)/m2/gm2-libs-iso $(EXTENDED_OPAQUE) --h-file-prefix=$(SRC_PREFIX) -o=m2/mc-boot-gen/GmcStream.c $(srcdir)/m2/mc/mcStream.mod
m2/boot-bin/mc$(exeext) -I$(srcdir)/m2/mc:$(srcdir)/m2/gm2-libs:$(srcdir)/m2/gm2-libs-iso $(EXTENDED_OPAQUE) --h-file-prefix=$(SRC_PREFIX) -o=m2/mc-boot-gen/Gdecl.c $(srcdir)/m2/mc/decl.mod
if diff m2/mc-boot-gen/Gdecl.c $(srcdir)/m2/mc-boot/Gdecl.c ; then echo "passed" ; else echo "failed" ; fi
# mc-devel - compiles mc using gm2
mc-devel: m2/boot-bin/mc-devel$(exeext)
m2/boot-bin/mc-devel$(exeext): m2/mc-obj/mcp1.mod \
m2/mc-obj/mcp2.mod \
m2/mc-obj/mcp3.mod \
m2/mc-obj/mcp4.mod \
m2/mc-obj/mcp5.mod \
mcflex.c \
m2/mc-boot-ch/Gabort.o
$(RM) -rf mc-obj
mkdir mc-obj
$(CC) -I$(srcdir)/m2/mc -c -g mcflex.c -o mc-obj/mcflex.o
$(BOOTGM2) $(MCOPTIONS) -I$(GM2PATH) $(srcdir)/m2/mc/decl.mod -o mc-obj/decl.o
$(BOOTGM2) $(MCOPTIONS) -I$(GM2PATH) $(srcdir)/m2/mc/mcStream.mod -o mc-obj/mcStream.o
$(BOOTGM2) $(MCOPTIONS) -I$(GM2PATH) $(srcdir)/m2/mc/mcPretty.mod -o mc-obj/mcPretty.o
$(BOOTGM2) $(MCOPTIONS) -I$(GM2PATH) $(srcdir)/m2/mc/mcStack.mod -o mc-obj/mcStack.o
$(BOOTGM2) $(MCOPTIONS) -I$(GM2PATH) $(srcdir)/m2/mc/varargs.mod -o mc-obj/varargs.o
$(BOOTGM2) $(MCOPTIONS) -I$(GM2PATH) $(srcdir)/m2/mc/mcMetaError.mod -o mc-obj/mcMetaError.o
$(BOOTGM2) $(MCOPTIONS) -I$(GM2PATH) $(srcdir)/m2/mc/mcOptions.mod -o mc-obj/mcOptions.o
$(BOOTGM2) $(MCOPTIONS) -I$(GM2PATH) $(srcdir)/m2/mc/mcComp.mod -o mc-obj/mcComp.o
$(BOOTGM2) $(MCOPTIONS) -I$(GM2PATH) m2/mc-obj/mcp1.mod -o mc-obj/mcp1.o
$(BOOTGM2) $(MCOPTIONS) -I$(GM2PATH) m2/mc-obj/mcp2.mod -o mc-obj/mcp2.o
$(BOOTGM2) $(MCOPTIONS) -I$(GM2PATH) m2/mc-obj/mcp3.mod -o mc-obj/mcp3.o
$(BOOTGM2) $(MCOPTIONS) -I$(GM2PATH) m2/mc-obj/mcp4.mod -o mc-obj/mcp4.o
$(BOOTGM2) $(MCOPTIONS) -I$(GM2PATH) m2/mc-obj/mcp5.mod -o mc-obj/mcp5.o
$(BOOTGM2) $(MCOPTIONS) -I$(GM2PATH) $(srcdir)/m2/mc/wlists.mod -o mc-obj/wlists.o
$(BOOTGM2) $(MCOPTIONS) -I$(GM2PATH) $(srcdir)/m2/mc/alists.mod -o mc-obj/alists.o
$(BOOTGM2) $(MCOPTIONS) -I$(GM2PATH) $(srcdir)/m2/mc/symbolKey.mod -o mc-obj/symbolKey.o
$(BOOTGM2) $(MCOPTIONS) -I$(GM2PATH) $(srcdir)/m2/mc/mcReserved.mod -o mc-obj/mcReserved.o
$(BOOTGM2) $(MCOPTIONS) -I$(GM2PATH) $(srcdir)/m2/mc/nameKey.mod -o mc-obj/nameKey.o
$(BOOTGM2) $(MCOPTIONS) -I$(GM2PATH) $(srcdir)/m2/mc/mcSearch.mod -o mc-obj/mcSearch.o
$(BOOTGM2) $(MCOPTIONS) -I$(GM2PATH) $(srcdir)/m2/mc/mcFileName.mod -o mc-obj/mcFileName.o
$(BOOTGM2) $(MCOPTIONS) -I$(GM2PATH) $(srcdir)/m2/mc/mcLexBuf.mod -o mc-obj/mcLexBuf.o
$(BOOTGM2) $(MCOPTIONS) -I$(GM2PATH) $(srcdir)/m2/mc/mcQuiet.mod -o mc-obj/mcQuiet.o
$(BOOTGM2) $(MCOPTIONS) -I$(GM2PATH) $(srcdir)/m2/mc/mcError.mod -o mc-obj/mcError.o
$(BOOTGM2) $(MCOPTIONS) -I$(GM2PATH) $(srcdir)/m2/mc/mcDebug.mod -o mc-obj/mcDebug.o
$(BOOTGM2) $(MCOPTIONS) -I$(GM2PATH) $(srcdir)/m2/mc/mcPrintf.mod -o mc-obj/mcPrintf.o
$(BOOTGM2) $(MCOPTIONS) -I$(GM2PATH) $(srcdir)/m2/mc/Indexing.mod -o mc-obj/Indexing.o
$(BOOTGM2) $(MCOPTIONS) -I$(GM2PATH) $(srcdir)/m2/mc/mcPreprocess.mod -o mc-obj/mcPreprocess.o
$(BOOTGM2) $(MCOPTIONS) -I$(GM2PATH) $(srcdir)/m2/mc/keyc.mod -o mc-obj/keyc.o
$(BOOTGM2) $(MCOPTIONS) -I$(GM2PATH) $(srcdir)/m2/mc/mcComment.mod -o mc-obj/mcComment.o
$(BOOTGM2) $(MCLINK) -I. -fscaffold-main -I$(GM2PATH) \
-fuse-list=$(srcdir)/m2/init/mcinit $(srcdir)/m2/mc/top.mod -o mc \
m2/gm2-libs-boot/RTcodummy.o \
m2/gm2-libs-boot/dtoa.o m2/gm2-libs-boot/ldtoa.o mc-obj/*o m2/mc-boot-ch/Gabort.o
m2/boot-bin/mc-opt$(exeext): m2/mc-obj/mcp1.mod \
m2/mc-obj/mcp2.mod \
m2/mc-obj/mcp3.mod \
m2/mc-obj/mcp4.mod \
m2/mc-obj/mcp5.mod \
mcflex.c
g++ -I$(srcdir)/m2/mc -c -g mcflex.c
$(BOOTGM2) -fsources -fm2-whole-program -g -I$(srcdir)/m2/mc:$(objdir)/m2/mc-obj:$(srcdir)/m2/gm2-libs:$(srcdir)/m2/mc $(srcdir)/m2/mc/top.mod
m2/mc/decl.o: $(srcdir)/m2/mc/decl.mod
$(BOOTGM2) $(MCOPTIONS) -I$(GM2PATH) -o $@ $(srcdir)/m2/mc/decl.mod
m2/mc-obj/%.mod: $(srcdir)/m2/mc/%.bnf $(PGE)
$(PGE) -l $< -o $@
gm2-bootstrap: mc-devel
for i in $(srcdir)/m2/gm2-libs/*.def ; do echo $$i ; ./mc --gcc-config-system -I$(srcdir)/m2/gm2-libs $$i ; done
for i in $(srcdir)/m2/gm2-compiler/*.def ; do echo $$i ; ./mc --gcc-config-system -I$(srcdir)/m2/gm2-libs:$(srcdir)/m2/gm2-compiler:$(srcdir)/m2/gm2-gcc $$i ; done
for i in $(srcdir)/m2/gm2-libs/*.mod ; do echo $$i ; ./mc --gcc-config-system -I$(srcdir)/m2/gm2-libs:$(srcdir)/m2/gm2-compiler:$(srcdir)/m2/gm2-gcc $$i ; done
$(objdir)/plugin:
test -d $@ || mkdir -p $@
$(objdir)/m2/mc-boot:
test -d $@ || mkdir -p $@
$(objdir)/m2/mc-boot-ch:
test -d $@ || mkdir -p $@
$(objdir)/m2/mc-boot-gen:
test -d $@ || mkdir -p $@
mc-autogen: mc-clean mc-devel \
$(BUILD-MC-BOOT-H) $(BUILD-MC-BOOT-C) \
$(BUILD-MC-BOOT-AUTO-C)
for i in m2/mc-boot-gen/*.c ; do \
echo $(CXX) -g -c -I. -I$(srcdir)/../include -I$(srcdir) -I$(srcdir)/m2/mc-boot-ch -Im2/mc-boot-gen/ $$i -o m2/mc-boot-gen/`basename $$i .c`.o ; \
$(CXX) -g -c -I. -I$(srcdir)/../include -I$(srcdir) -I$(srcdir)/m2/mc-boot-ch -Im2/mc-boot-gen/ $$i -o m2/mc-boot-gen/`basename $$i .c`.o ; done
@echo -n "built "
@cd m2/mc-boot-gen ; ls *.o | wc -l
@echo -n "out of "
@cd m2/mc-boot-gen ; ls *.c | wc -l
@echo "modules"
# EXTENDED_OPAQUE = --extended-opaque
EXTENDED_OPAQUE =
MC_OPTIONS = $(MC_COPYRIGHT) --gcc-config-system --olang=c++
m2/mc-boot-gen/$(SRC_PREFIX)%.h: $(srcdir)/m2/mc/%.def
./mc $(MC_OPTIONS) -I$(srcdir)/m2/mc:$(srcdir)/m2/gm2-libs:$(srcdir)/m2/gm2-libs-iso $(EXTENDED_OPAQUE) --h-file-prefix=$(SRC_PREFIX) -o=$@ $<
m2/mc-boot-gen/$(SRC_PREFIX)%.h: $(srcdir)/m2/gm2-libs/%.def
./mc $(MC_OPTIONS) -I$(srcdir)/m2/mc:$(srcdir)/m2/gm2-libs:$(srcdir)/m2/gm2-libs-iso $(EXTENDED_OPAQUE) --h-file-prefix=$(SRC_PREFIX) -o=$@ $<
m2/mc-boot-gen/$(SRC_PREFIX)decl.c: $(srcdir)/m2/mc/decl.mod
./mc $(MC_OPTIONS) --extended-opaque -I$(srcdir)/m2/mc:$(srcdir)/m2/gm2-libs:$(srcdir)/m2/gm2-libs-iso --h-file-prefix=$(SRC_PREFIX) -o=$@ $<
m2/mc-boot-gen/$(SRC_PREFIX)%.c: $(srcdir)/m2/mc/%.mod
./mc $(MC_OPTIONS) -I$(srcdir)/m2/mc:$(srcdir)/m2/gm2-libs:$(srcdir)/m2/gm2-libs-iso $(EXTENDED_OPAQUE) --h-file-prefix=$(SRC_PREFIX) -o=$@ $<
m2/mc-boot-gen/$(SRC_PREFIX)%.c: $(srcdir)/m2/gm2-libs/%.mod
./mc $(MC_OPTIONS) -I$(srcdir)/m2/mc:$(srcdir)/m2/gm2-libs:$(srcdir)/m2/gm2-libs-iso $(EXTENDED_OPAQUE) --h-file-prefix=$(SRC_PREFIX) -o=$@ $<
m2/mc-boot-gen/$(SRC_PREFIX)%.h: $(srcdir)/m2/gm2-libs-iso/%.def
./mc $(MC_OPTIONS) -I$(srcdir)/m2/mc:$(srcdir)/m2/gm2-libs:$(srcdir)/m2/gm2-libs-iso $(EXTENDED_OPAQUE) --h-file-prefix=$(SRC_PREFIX) -o=$@ $<
m2/mc-boot-gen/$(SRC_PREFIX)%.c: m2/mc-obj/%.mod
./mc $(MC_OPTIONS) -I$(srcdir)/m2/mc:$(srcdir)/m2/gm2-libs:$(srcdir)/m2/gm2-libs-iso $(EXTENDED_OPAQUE) --h-file-prefix=$(SRC_PREFIX) -o=$@ $<
# mc-bootstrap compiles mc using the C version previously generated by mc-autogen.
# These autogenerated files will be checked into git by the maintainer.
mc-bootstrap: mc-clean m2/boot-bin/mc$(exeext)
gm2.maintainer-reconfigure: force
autoconf $(srcdir)/m2/gm2-libs/config-host.in > $(srcdir)/m2/gm2-libs/config-host
( cd $(srcdir)/m2/gm2-libs ; autoheader config-host.in )
( cd $(srcdir)/m2 ; autoconf configure.in > configure )
gm2.maintainer-clean: force
-rm -f $(srcdir)/m2/gm2-auto/*
-rm -f $(srcdir)/m2/gm2-libs.texi
-rm -f $(srcdir)/m2/gm2-ebnf.texi
-rm -f $(srcdir)/m2/images/gnu.eps
gm2.maintainer-help: force
@echo "make knows about:"
@echo " "
@echo "make gm2.maintainer-help this command"
@echo "make gm2.maintainer-reconfigure rebuild the configure scripts"
@echo "make gm2.maintainer-clean clean pre-built images and texi files"
#
# verify the compiler can be built across three generations of cc1gm2 diffing assembly output.
# stage1/m2/cc1gm2 built by translating M2 into C++.
# stage2/m2/cc1gm2 built from stage1/m2/cc1gm2.
# stage3/m2/cc1gm2 built from stage2/m2/cc1gm2.
#
# GM2-VERIFY-MODS is a list of modules which have no __DATE__ stamp inside them
# and thus they can be built by the different versions of gm2.
# This list is used for testing only.
GM2-VERIFY-MODS = FifoQueue.mod M2AsmUtil.mod M2Optimize.mod \
M2StackWord.mod M2Pass.mod M2Batch.mod \
M2Quads.mod M2Comp.mod M2Reserved.mod \
M2Debug.mod M2Defaults.mod NameKey.mod \
M2FileName.mod P0SymBuild.mod P1SymBuild.mod P2SymBuild.mod \
P3SymBuild.mod \
SymbolKey.mod SymbolTable.mod M2Error.mod \
M2StackAddress.mod \
M2Students.mod \
M2BasicBlock.mod M2Code.mod M2GenGCC.mod M2GCCDeclare.mod\
M2ALU.mod M2System.mod M2Base.mod Lists.mod \
M2Search.mod bnflex.mod ppg.mod Output.mod \
SymbolConversion.mod \
M2Preprocess.mod M2Printf.mod M2LexBuf.mod M2Quiet.mod \
M2Bitset.mod M2Size.mod CLexBuf.mod M2Scope.mod \
M2Range.mod M2Swig.mod M2MetaError.mod Sets.mod \
M2CaseList.mod PCSymBuild.mod M2Const.mod \
M2DebugStack.mod ObjectFiles.mod M2ColorString.mod M2Emit.mod
GM2-VERIFY-AUTO = P1Build.mod P2Build.mod PCBuild.mod P3Build.mod \
PHBuild.mod pg.mod P0SyntaxCheck.mod
GM2_LIBS_PARANOID = m2/gm2-compiler-paranoid/gm2.a \
m2/gm2-libs-paranoid/libgm2.a # build it again using GM2_LIBS
gm2.paranoid: stage3/m2/cc1gm2$(exeext) gm2.verifyparanoid
stage3/m2/cc1gm2$(exeext): stage2/m2/cc1gm2$(exeext) m2/gm2-compiler-paranoid/m2flex.o \
$(P) $(GM2_C_OBJS) $(BACKEND) $(LIBDEPS) $(GM2_LIBS_PARANOID) \
m2/gm2-gcc/rtegraph.o plugin/m2rte$(exeext).so m2/gm2-libs-boot/M2LINK.o
@$(call LINK_PROGRESS,$(INDEX.m2),start)
+$(LLINKER) $(ALL_CFLAGS) $(LDFLAGS) -o $@ $(GM2_C_OBJS) m2/gm2-compiler-paranoid/m2flex.o \
attribs.o \
$(GM2_LIBS_PARANOID) \
$(BACKEND) $(LIBS) m2/gm2-gcc/rtegraph.o m2/gm2-libs-boot/M2LINK.o \
$(BACKENDLIBS) $(LIBSTDCXX) -lm
@$(call LINK_PROGRESS,$(INDEX.m2),end)
# gm2.verifyparanoid diffs the output of all three compilers with the compiler source code
gm2.verifyparanoid: stage1/m2/cc1gm2$(exeext) stage2/m2/cc1gm2$(exeext) stage3/m2/cc1gm2$(exeext) force
@echo "verifying the three generations of GNU Modula-2 compilers - it may take some time.."
$(QUIAT)for i in $(GM2-VERIFY-MODS) ; do \
echo -n "$$i " ; \
./gm2 -S $(GM2_FLAGS) -c -B./stage1/m2 -I$(srcdir)/m2/gm2-compiler:$(srcdir)/m2/gm2-libs:$(srcdir)/m2/gm2-gcc:$(srcdir)/m2/gm2-libiberty $(srcdir)/m2/gm2-compiler/$$i -o m2/gm2-compiler-verify/1.s ; \
echo -n "[1]" ; \
./gm2 -S $(GM2_FLAGS) -c -B./stage2/m2 -I$(srcdir)/m2/gm2-compiler:$(srcdir)/m2/gm2-libs:$(srcdir)/m2/gm2-gcc:$(srcdir)/m2/gm2-libiberty $(srcdir)/m2/gm2-compiler/$$i -o m2/gm2-compiler-verify/2.s ; \
echo -n "[2]" ; \
./gm2 -S $(GM2_FLAGS) -c -B./stage3/m2 -I$(srcdir)/m2/gm2-compiler:$(srcdir)/m2/gm2-libs:$(srcdir)/m2/gm2-gcc:$(srcdir)/m2/gm2-libiberty $(srcdir)/m2/gm2-compiler/$$i -o m2/gm2-compiler-verify/3.s ; \
echo -n "[3]" ; \
if ! diff m2/gm2-compiler-verify/1.s m2/gm2-compiler-verify/2.s > m2/gm2-compiler-verify/1_2.diff 2>&1 ; then \
echo -n " [stage 1 and stage 2 differ]" ; \
cp m2/gm2-compiler-verify/1.s m2/gm2-compiler-verify/t.s | as -ahl m2/gm2-compiler-verify/t.s > m2/gm2-compiler-verify/$$i.1.lst ; \
cp m2/gm2-compiler-verify/2.s m2/gm2-compiler-verify/t.s | as -ahl m2/gm2-compiler-verify/t.s > m2/gm2-compiler-verify/$$i.2.lst ; \
echo " " ; \
exit 1 ; \
fi ; \
if ! diff m2/gm2-compiler-verify/2.s m2/gm2-compiler-verify/3.s > m2/gm2-compiler-verify/2_3.diff 2>&1 ; then \
echo -n " [stage 2 and stage 3 differ]" ; \
cp m2/gm2-compiler-verify/2.s m2/gm2-compiler-verify/t.s | as -ahl m2/gm2-compiler-verify/t.s > m2/gm2-compiler-verify/$$i.2.lst ; \
cp m2/gm2-compiler-verify/3.s m2/gm2-compiler-verify/t.s | as -ahl m2/gm2-compiler-verify/t.s > m2/gm2-compiler-verify/$$i.3.lst ; \
fi ; \
echo " " ; \
done
$(QUIAT)echo "now verifying automatically built modules"
$(QUIAT)for i in x $(GM2-VERIFY-AUTO) ; do \
if [ -f m2/gm2-auto/$$i ] ; then \
echo -n "$$i " ; \
./gm2 -S $(GM2_FLAGS) -c -B./stage1/m2 -I$(srcdir)/m2/gm2-compiler:$(srcdir)/m2/gm2-libs:$(srcdir)/m2/gm2-gcc:$(srcdir)/m2/gm2-libiberty m2/gm2-auto/$$i -o m2/gm2-compiler-verify/1.s ; \
echo -n "[1]" ; \
./gm2 -S $(GM2_FLAGS) -c -B./stage2/m2 -I$(srcdir)/m2/gm2-compiler:$(srcdir)/m2/gm2-libs:$(srcdir)/m2/gm2-gcc:$(srcdir)/m2/gm2-libiberty m2/gm2-auto/$$i -o m2/gm2-compiler-verify/2.s ; \
echo -n "[2]" ; \
./gm2 -S $(GM2_FLAGS) -c -B./stage3/m2 -I$(srcdir)/m2/gm2-compiler:$(srcdir)/m2/gm2-libs:$(srcdir)/m2/gm2-gcc:$(srcdir)/m2/gm2-libiberty m2/gm2-auto/$$i -o m2/gm2-compiler-verify/3.s ; \
echo -n "[3]" ; \
if ! diff m2/gm2-compiler-verify/1.s m2/gm2-compiler-verify/2.s > m2/gm2-compiler-verify/1_2.diff 2>&1 ; then \
echo -n " [stage 1 and stage 2 differ]" ; \
cp m2/gm2-compiler-verify/1.s m2/gm2-compiler-verify/t.s | as -ahl m2/gm2-compiler-verify/t.s > m2/gm2-compiler-verify/$$i.1.lst ; \
cp m2/gm2-compiler-verify/2.s m2/gm2-compiler-verify/t.s | as -ahl m2/gm2-compiler-verify/t.s > m2/gm2-compiler-verify/$$i.2.lst ; \
echo " " ; \
exit 1 ; \
fi ; \
if ! diff m2/gm2-compiler-verify/2.s m2/gm2-compiler-verify/3.s > m2/gm2-compiler-verify/2_3.diff 2>&1 ; then \
echo -n " [stage 2 and stage 3 differ]" ; \
cp m2/gm2-compiler-verify/2.s m2/gm2-compiler-verify/t.s | as -ahl m2/gm2-compiler-verify/t.s > m2/gm2-compiler-verify/$$i.2.lst ; \
cp m2/gm2-compiler-verify/3.s m2/gm2-compiler-verify/t.s | as -ahl m2/gm2-compiler-verify/t.s > m2/gm2-compiler-verify/$$i.3.lst ; \
fi ; \
echo " " ; \
fi ; \
done ; \
$(RM) -f m2/gm2-compiler-verify/1.s m2/gm2-compiler-verify/2.s m2/gm2-compiler-verify/3.s m2/gm2-compiler-verify/2_3.diff m2/gm2-compiler-verify/1_2.diff
# gm2.verifystage12 diffs the output of the stage1 and stage2 compilers with the compiler source code
gm2.verifystage12: force stage1/m2/cc1gm2$(exeext) stage2/m2/cc1gm2$(exeext)
@echo "verifying stage1 and stage2 generations of GNU Modula-2 compilers - it may take some time.."
$(QUIAT)for i in $(GM2-VERIFY-MODS) ; do \
echo -n "$$i " ; \
./gm2 -S $(GM2_FLAGS) -c -B./stage1/m2 -I$(srcdir)/m2/gm2-compiler:$(srcdir)/m2/gm2-libs:$(srcdir)/m2/gm2-gcc:$(srcdir)/m2/gm2-libiberty $(srcdir)/m2/gm2-compiler/$$i -o m2/gm2-compiler-verify/1.s ; \
echo -n "[1]" ; \
./gm2 -S $(GM2_FLAGS) -c -B./stage2/m2 -I$(srcdir)/m2/gm2-compiler:$(srcdir)/m2/gm2-libs:$(srcdir)/m2/gm2-gcc:$(srcdir)/m2/gm2-libiberty $(srcdir)/m2/gm2-compiler/$$i -o m2/gm2-compiler-verify/2.s ; \
echo -n "[2]" ; \
if ! diff m2/gm2-compiler-verify/1.s m2/gm2-compiler-verify/2.s > m2/gm2-compiler-verify/1_2.diff 2>&1 ; then \
echo -n " [stage 1 and stage 2 differ]" ; \
cp m2/gm2-compiler-verify/1.s m2/gm2-compiler-verify/t.s | as -ahl m2/gm2-compiler-verify/t.s > m2/gm2-compiler-verify/$$i.1.lst ; \
cp m2/gm2-compiler-verify/2.s m2/gm2-compiler-verify/t.s | as -ahl m2/gm2-compiler-verify/t.s > m2/gm2-compiler-verify/$$i.2.lst ; \
echo " " ; \
fi ; \
echo " " ; \
done
$(QUIAT)echo "now verifying automatically built modules"
$(QUIAT)for i in x $(GM2-VERIFY-AUTO) ; do \
if [ -f m2/gm2-auto/$$i ] ; then \
echo -n "$$i " ; \
./gm2 -S $(GM2_FLAGS) -c -B./stage1/m2 -I$(srcdir)/m2/gm2-compiler:$(srcdir)/m2/gm2-libs:$(srcdir)/m2/gm2-gcc:$(srcdir)/m2/gm2-libiberty m2/gm2-auto/$$i -o m2/gm2-compiler-verify/1.s ; \
echo -n "[1]" ; \
./gm2 -S $(GM2_FLAGS) -c -B./stage2/m2 -I$(srcdir)/m2/gm2-compiler:$(srcdir)/m2/gm2-libs:$(srcdir)/m2/gm2-gcc:$(srcdir)/m2/gm2-libiberty m2/gm2-auto/$$i -o m2/gm2-compiler-verify/2.s ; \
echo -n "[2]" ; \
if ! diff m2/gm2-compiler-verify/1.s m2/gm2-compiler-verify/2.s > m2/gm2-compiler-verify/1_2.diff 2>&1 ; then \
echo -n " [stage 1 and stage 2 differ]" ; \
cp m2/gm2-compiler-verify/1.s m2/gm2-compiler-verify/t.s | as -ahl m2/gm2-compiler-verify/t.s > m2/gm2-compiler-verify/$$i.1.lst ; \
cp m2/gm2-compiler-verify/2.s m2/gm2-compiler-verify/t.s | as -ahl m2/gm2-compiler-verify/t.s > m2/gm2-compiler-verify/$$i.2.lst ; \
echo " " ; \
fi ; \
echo " " ; \
fi ; \
done ; \
$(RM) -f m2/gm2-compiler-verify/1.s m2/gm2-compiler-verify/2.s m2/gm2-compiler-verify/3.s m2/gm2-compiler-verify/2_3.diff m2/gm2-compiler-verify/1_2.diff
# The rules which build objects in the gm2-compiler-paranoid gm2-libs-paranoid directories.
m2/gm2-libs-paranoid/%.o: m2/gm2-libs-ch/%.c
$(XGCC) -c -g $(GM2_O_S3) $(GM2_O) -I./ -Im2/gm2-libs -Wall $(INCLUDES) $< -o $@
m2/gm2-libs-paranoid/%.o: $(srcdir)/m2/gm2-libs/%.mod
$(GM2_2) $(GM2_O_S3) $(GM2_FLAGS) -c -I$(srcdir)/m2/gm2-compiler -I$(srcdir)/m2/gm2-libs -I$(srcdir)/m2/gm2-libs-iso -I$(srcdir)/m2/gm2-libiberty $< -o $@
m2/gm2-compiler-paranoid/%.o: $(srcdir)/m2/gm2-compiler/%.mod
$(GM2_2) $(GM2_O_S3) $(GM2_FLAGS) -c -I$(srcdir)/m2/gm2-compiler -I$(srcdir)/m2/gm2-libs -I$(srcdir)/m2/gm2-gcc -I$(srcdir)/m2/gm2-libiberty $< -o $@
m2/gm2-compiler-paranoid/%.o: m2/gm2-compiler-paranoid/%.mod
$(GM2_2) $(GM2_O_S3) $(GM2_FLAGS) -c -I$(srcdir)/m2/gm2-compiler -I$(srcdir)/m2/gm2-libs -I$(srcdir)/m2/gm2-gcc -I$(srcdir)/m2/gm2-libiberty $< -o $@
m2/gm2-compiler-paranoid/P0SyntaxCheck.o: m2/gm2-compiler-paranoid/P0SyntaxCheck.mod
$(GM2_2) $(GM2_O_S3) $(GM2_FLAGS) -c -I$(srcdir)/m2/gm2-compiler -I$(srcdir)/m2/gm2-libs -I$(srcdir)/m2/gm2-gcc -I$(srcdir)/m2/gm2-libiberty $< -o $@
m2/gm2-compiler-paranoid/P1Build.o: m2/gm2-compiler-paranoid/P1Build.mod
$(GM2_2) $(GM2_O_S3) $(GM2_FLAGS) -c -I$(srcdir)/m2/gm2-compiler -I$(srcdir)/m2/gm2-libs -I$(srcdir)/m2/gm2-gcc -I$(srcdir)/m2/gm2-libiberty $< -o $@
m2/gm2-compiler-paranoid/P2Build.o: m2/gm2-compiler-paranoid/P2Build.mod
$(GM2_2) $(GM2_O_S3) $(GM2_FLAGS) -c -I$(srcdir)/m2/gm2-compiler -I$(srcdir)/m2/gm2-libs -I$(srcdir)/m2/gm2-gcc -I$(srcdir)/m2/gm2-libiberty $< -o $@
m2/gm2-compiler-paranoid/P3Build.o: m2/gm2-compiler-paranoid/P3Build.mod
$(GM2_2) $(GM2_O_S3) $(GM2_FLAGS) -c -I$(srcdir)/m2/gm2-compiler -I$(srcdir)/m2/gm2-libs -I$(srcdir)/m2/gm2-gcc -I$(srcdir)/m2/gm2-libiberty $< -o $@
m2/gm2-compiler-paranoid/PHBuild.o: m2/gm2-compiler-paranoid/PHBuild.mod
$(GM2_2) $(GM2_O_S3) $(GM2_FLAGS) -c -I$(srcdir)/m2/gm2-compiler -I$(srcdir)/m2/gm2-libs -I$(srcdir)/m2/gm2-gcc -I$(srcdir)/m2/gm2-libiberty $< -o $@
m2/gm2-compiler-paranoid/PCBuild.o: m2/gm2-compiler-paranoid/PCBuild.mod
$(GM2_2) $(GM2_O_S3) $(GM2_FLAGS) -c -I$(srcdir)/m2/gm2-compiler -I$(srcdir)/m2/gm2-libs -I$(srcdir)/m2/gm2-gcc -I$(srcdir)/m2/gm2-libiberty $< -o $@
m2/gm2-libs-paranoid/host.o: $(srcdir)/m2/gm2-libs-ch/host.c m2/gm2-libs/gm2-libs-host.h
$(CXX) -c $(GM2_O_S3) $(CFLAGS) -Im2/gm2-libs -I$(srcdir)/m2 -Im2 -I. -Im2/gm2-libs-boot $(INCLUDES) $< -o $@
m2/gm2-libs-paranoid/wrapc.o: $(srcdir)/m2/gm2-libs-ch/wrapc.c m2/gm2-libs-boot/$(SRC_PREFIX)wrapc.h m2/gm2-libs/gm2-libs-host.h
$(CXX) -c -DIN_GCC $(GM2_O_S3) $(CFLAGS) -Im2/gm2-libs -I$(srcdir)/m2 -Im2 -I. -Im2/gm2-libs-boot $(INCLUDES) $< -o $@
m2/gm2-libs-paranoid/UnixArgs.o: $(srcdir)/m2/gm2-libs-ch/UnixArgs.cc \
m2/gm2-libs-boot/$(SRC_PREFIX)UnixArgs.h
$(CXX) -c -DIN_GCC $(GM2_O_S3) $(CFLAGS) -Im2/gm2-libs -I$(srcdir)/m2 -Im2 -I. -Im2/gm2-libs-boot $(INCLUDES) $< -o $@
m2/gm2-libs-paranoid/errno.o: $(srcdir)/m2/gm2-libs-ch/errno.c \
m2/gm2-libs-boot/$(SRC_PREFIX)errno.h
$(CXX) -c -DIN_GCC $(GM2_O_S3) $(CFLAGS) -Im2/gm2-libs -I$(srcdir)/m2 -Im2 -I. -Im2/gm2-libs-boot $(INCLUDES) $< -o $@
m2/gm2-libs-paranoid/Selective.o: $(srcdir)/m2/gm2-libs-ch/Selective.c \
m2/gm2-libs-boot/$(SRC_PREFIX)Selective.h
$(COMPILER) -c -DIN_GCC $(GM2_O_S3) $(CFLAGS) -Im2/gm2-libs -I$(srcdir)/m2 -Im2 -I. -Im2/gm2-libs-boot $(INCLUDES) $< -o $@
m2/gm2-libs-paranoid/choosetemp.o: $(srcdir)/m2/gm2-libs-ch/choosetemp.c \
m2/gm2-libiberty/$(SRC_PREFIX)choosetemp.h
$(CXX) -c -DIN_GCC $(GM2_O_S3) $(CFLAGS) -Im2/gm2-libs -I$(srcdir)/m2 -Im2 -I. -Im2/gm2-libs-boot -Im2/gm2-libiberty $(INCLUDES) $< -o $@
m2/gm2-libs-paranoid/SysExceptions.o: $(srcdir)/m2/gm2-libs-ch/SysExceptions.c \
m2/gm2-libs-boot/$(SRC_PREFIX)SysExceptions.h
$(CXX) -c -DIN_GCC $(GM2_O_S3) $(CFLAGS) -Im2/gm2-libs -I$(srcdir)/m2 -Im2 -I. -Im2/gm2-libs-boot $(INCLUDES) $< -o $@
m2/gm2-compiler-paranoid/m2flex.o: m2/gm2-compiler/m2flex.c $(TIMEVAR_H)
$(COMPILER) -c $(GM2_O_S3) -g $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
$(GM2GCC) -Im2/gm2-compiler-boot -Im2/gm2-libs-boot $< -o $@
m2/gm2-libs-paranoid/dtoa.o: $(srcdir)/m2/gm2-libs-ch/dtoa.cc \
m2/gm2-libs-boot/$(SRC_PREFIX)dtoa.h \
m2/gm2-libs/gm2-libs-host.h
$(CXX) -c $(GM2_O_S3) $(CFLAGS) -I$(srcdir)/m2 -Im2/gm2-libs-boot -Im2/gm2-libs $(INCLUDES) $< -o $@
m2/gm2-libs-paranoid/ldtoa.o: $(srcdir)/m2/gm2-libs-ch/ldtoa.cc \
m2/gm2-libs-boot/$(SRC_PREFIX)ldtoa.h \
m2/gm2-libs/gm2-libs-host.h
$(CXX) -c $(GM2_O_S3) $(CFLAGS) -I$(srcdir)/m2 -Im2/gm2-libs-boot -Im2/gm2-libs $(INCLUDES) $< -o $@
m2/gm2-libs-paranoid/termios.o: $(srcdir)/m2/gm2-libs-ch/termios.c \
m2/gm2-libs-boot/$(SRC_PREFIX)termios.h \
m2/gm2-libs/gm2-libs-host.h
$(CXX) -c $(GM2_O_S3) $(CFLAGS) -I$(srcdir)/m2 -Im2/gm2-libs-boot -Im2/gm2-libs $(INCLUDES) $< -o $@
# The rules which build the paranoid version of gm2.
BUILD-LIBS-PARANOID-H = $(GM2-LIBS-BOOT-DEFS:%.def=m2/gm2-libs-boot/$(SRC_PREFIX)%.h)
BUILD-LIBS-PARANOID = $(BUILD-LIBS-PARANOID-H) \
$(GM2-LIBS-MODS:%.mod=m2/gm2-libs-paranoid/%.o) \
$(GM2-LIBS-CC:%.cc=m2/gm2-libs-paranoid/%.o) \
$(GM2-LIBS-C:%.c=m2/gm2-libs-paranoid/%.o)
m2/gm2-libs-paranoid/libgm2.a: m2/boot-bin/mc$(exeext) $(BUILD-LIBS-PARANOID)
$(AR) cr $@ $(GM2-LIBS-MODS:%.mod=m2/gm2-libs-paranoid/%.o) \
$(GM2-LIBS-CC:%.cc=m2/gm2-libs-paranoid/%.o) \
$(GM2-LIBS-C:%.c=m2/gm2-libs-paranoid/%.o)
$(RANLIB) $@
m2/gm2-compiler-paranoid/gm2.a: \
$(GM2-COMP-MODS:%.mod=m2/gm2-compiler-paranoid/%.o) \
$(GM2-AUTO-MODS:%.mod=m2/gm2-compiler-paranoid/%.o) \
m2/gm2-compiler-paranoid/M2Version.o \
m2/gm2-compiler-paranoid/m2flex.o
$(AR) cr $@ $(GM2-COMP-MODS:%.mod=m2/gm2-compiler-paranoid/%.o) \
$(GM2-AUTO-MODS:%.mod=m2/gm2-compiler-paranoid/%.o) \
m2/gm2-compiler-paranoid/M2Version.o
$(RANLIB) $@
m2/gm2-compiler-paranoid/M2Version.mod:
$(SHELL) $(srcdir)/m2/tools-src/makeversion -m $(srcdir) m2/gm2-compiler-paranoid
m2/gm2-compiler-paranoid/M2Version.o: m2/gm2-compiler-paranoid/M2Version.mod
$(GM2_2) $(GM2_FLAGS) -c -I$(srcdir)/m2/gm2-compiler -I$(srcdir)/m2/gm2-libs -I$(srcdir)/m2/gm2-gcc $< -o $@
m2/gm2-compiler-paranoid/%.mod: $(srcdir)/m2/gm2-compiler/%.bnf $(PGE)
$(PGE) -k -l $< -o $@
# Recreate the target independent copies of the documentation which is
# used during the build if Python3 is unavailable.
# m2-target-independent-doc-rst should be enabled once
# tools-src/def2doc.py is completed (module hyperlinks need rst
# treatment).
m2-target-independent-doc: m2-target-independent-doc-texi # m2-target-independent-doc-rst
m2-target-independent-doc-texi: force
ifeq ($(HAVE_PYTHON),yes)
python3 $(srcdir)/m2/tools-src/def2doc.py -t -b$(srcdir)/m2 -f$(srcdir)/m2/gm2-libs-iso/SYSTEM.def -o $(srcdir)/m2/target-independent/SYSTEM-iso.texi
python3 $(srcdir)/m2/tools-src/def2doc.py -t -b$(srcdir)/m2 -f$(srcdir)/m2/gm2-libs/SYSTEM.def -o $(srcdir)/m2/target-independent/SYSTEM-pim.texi
python3 $(srcdir)/m2/tools-src/def2doc.py -t -b$(srcdir)/m2 -f$(srcdir)/m2/gm2-libs/Builtins.def -o $(srcdir)/m2/target-independent/Builtins.texi
python3 $(srcdir)/m2/tools-src/def2doc.py -t -uLibraries -s$(srcdir)/m2 -b$(srcdir)/m2 -o $(srcdir)/m2/target-independent/gm2-libs.texi
else
echo "m2-target-independent-doc-texi will only work if Python3 was detected during configure"
endif
m2-target-independent-doc-rst: force
ifeq ($(HAVE_PYTHON),yes)
python3 $(srcdir)/m2/tools-src/def2doc.py -x -b$(srcdir)/m2 -f$(srcdir)/m2/gm2-libs-iso/SYSTEM.def -o $(srcdir)/m2/target-independent/SYSTEM-iso.rst
python3 $(srcdir)/m2/tools-src/def2doc.py -x -b$(srcdir)/m2 -f$(srcdir)/m2/gm2-libs/SYSTEM.def -o $(srcdir)/m2/target-independent/SYSTEM-pim.rst
python3 $(srcdir)/m2/tools-src/def2doc.py -x -b$(srcdir)/m2 -f$(srcdir)/m2/gm2-libs/Builtins.def -o $(srcdir)/m2/target-independent/Builtins.rst
python3 $(srcdir)/m2/tools-src/def2doc.py -x -uLibraries -s$(srcdir)/m2 -b$(srcdir)/m2 -o $(srcdir)/m2/target-independent/gm2-libs.rst
else
echo "m2-target-independent-doc-rst will only work if Python3 was detected during configure"
endif

231
gcc/m2/NEWS Normal file
View file

@ -0,0 +1,231 @@
This file describes recent user-visible changes in gm2. Bug fixes are
not described. There are more details in the man and info pages.
gm2 is now in the GCC tree and therefore these version numbers are
historical.
VERSION 1.9.5
=============
* More subexpressions tokens are created and accuracy of error positions
within subexpressions has been improved.
* the GCC switch -fanalyzer can be used with Modula-2.
VERSION 1.9.4
=============
* More GCC error routines utilized for error messages, erroneous
subexpressions are more accurately reported.
* Complete type checking now performed.
VERSION 1.9.3
=============
* GCC error routines utilized for error messages.
* complete whole number runtime range error detection finished.
* improved m2-plugin which analyzes the call graph and will issue
warnings if the compiler detects a exported procedure will cause
a range error. The plugin will issue an error if the range error
will be called from the module constructor/deconstructor.
VERSION 1.2.0
=============
* New improved more accurate source/line correlation in debugging output.
* -fm2-g generates nops to further improve debugging single stepping.
* -fm2-whole-program whole program optimization available.
* works with gcc-5.2.0 under x86_64, x86_32, arm 64 bit and arm 32 bit.
VERSION 1.0.4
=============
* Bug fixes to release 1.0
VERSION 1.0
===========
* All ISO libraries are complete.
* All ISO language implemented.
* All regression tests pass on both x86_64 and x86_32 Debian GNU/Linux
platforms.
VERSION 0.68
============
* more ISO library modules are implemented.
* many errors are much more informative and indicate what the
compiler has seen and what it expects.
VERSION 0.63
============
* many ISO library modules are implemented.
* Exception handling is complete and it can coexist with swig.
* all errors now include column information. Also added -fxcode
option which issues errors in Apple Xcode format.
* shared libraries are now implemented, to link against the shared
libraries use the new option -fshared. Likewise to generate a
shared library use the -fshared option.
* the keyword FINALLY is now implemented and both the initialization
and finalization blocks map onto GNU/Linux shared library
constructor and deconstructors.
* the PIM libraries are built with -O0, -O2, -O2 -fshared, -fshared.
* a new option -fswig automatically generates a swig interface file
corresponding to the definition module being compiled.
This allows Python and other scripting languages to call Modula-2
modules.
* new options, -fobject-path, allows users to specify the path for
all objects whereas -I specifies the path for the library sources.
* -fmakeinit option introduced which will generate a file
_m2_modulename.c in the current directory.
* introduced fixed sized types in the SYSTEM module.
VERSION 0.62
============
* all language options changed to -f. Warning options are
still -W. Introduced memmove to Builtins.def.
* Introduced gm2/gm2-libs-pim/BlockOps.{def,mod}
* gm2/gm2-libs-pim/BitByteOps.{def,mod}: added.
* -O now works on compiler and passes make gm2.paranoid.
VERSION 0.61
============
* builds when grafted onto gcc-4.1.2
VERSION 0.52
============
* tagged ready for branch for gcc-3.3.6 so that the head
can be developed with gcc-4.1.0
VERSION 0.51
============
* all regression tests pass on LP64 and i386 GNU/Linux
* declaration of variables at particular addresses is now implemented.
Now gm2 is a full PIM Modula-2 compiler and hence the formal release.
VERSION 0.50
============
* all regression tests pass on LP64 and i386 GNU/Linux, i386, Mac OS X.3 G5
* gm2-harness 0.7 will download, patch and build gcc, gdb, gm2 with the
SET and TYPE enhancements below. gm2-harness-0.7 also honours the
--prefix= option.
* Much better dwarf-2 debugging support and when used with
a patched gdb-6.3 the programmer can display RECORDs,
ARRAYs, SETs, subranges and constant char literals in
Modula-2 syntax.
* it currently complies with Programming in Modula-2 Edition 2, 3 and 4.
Users can switch on specific mutually exclusive features by using
-Wpim or -Wpim2.
* gm2 supports full PIM Modula-2 (except variables located at
particular addresses).
* profiling (-p) option is now available.
* module priorities now implemented.
* Logitech compatible libraries: Break.def, CardinalIO.def,
Conversions.def, DebugPMD.def, DebugTrace.def, Delay.def, Display.def,
ErrorCode.def, FloatingUtilities.def, InOut.def, Keyboard.def,
LongIO.def, Random.def, RealConversions.def, RealInOut.def,
Strings.def, Termbase.def, Terminal.def, TimeDate.def have been implemented.
* all Ulm libraries are available.
VERSION 0.49
============
* supports sets of any ordinal size (memory permitting).
* implements ISO Modula-2 SYSTEM which can be switched on via: -Wiso.
* easy interface to C, and varargs can be passed to C routines.
* University of Ulm libraries are installed together with the compiler
and can be accessed via: -Wlibs=ulm
* some Logitech libraries have been implemented and can be accessed via:
-Wlibs=logitech
* coroutines have been implemented in the PIM style and these are accessible
from SYSTEM. A number of supporting libraries (executive and file descriptor
mapping to interrupt vector libraries are available through the
-Wlibs=pim-coroutines switch).
VERSION 0.42
============
* MinGW cross compilation port released.
Please see http://floppsie.comp.glam.ac.uk/Glamorgan/gaius/web/gm2-mingw.html
for building details.
VERSION 0.41
============
* native sparc port passes make gm2.paranoid and make check-gm2
* native i386 port passes make gm2.paranoid and make check-gm2
* passes all 1350 regression tests
* builds with gcc-3.3.2
VERSION 0.40
============
* brought GM2 up to date with gcc-3.3.1
* many, many bug fixes and no patch is now required in the garbage collection
of gcc-3.3.1
* builds under Redhat 9.0 and Suse 9.0
* added the LONGCARD data type.
* LENGTH is now mapped onto M2RTS.Length if the parameter is not a constant
at compile time.
* standard procedures can be called inside constant expressions.
* introduced examples/pthread
* introduced a tool, h2def, to aid production of DEFINITION MODULE FOR "C" modules
from C header files.
* added MathLib0 module, added svga example.
* added access to thirty one gcc built-in functions.
VERSION 0.33
============
* implemented large sets.
* implemented ISO compliant sets.
* when gm2 is invoked with -gstabs a patched gdb will
display set contents. This also works well with SET OF CHAR.
* definition modules no longer have to explicitly export
identifiers.
VERSION 0.32
============
* gm2 can be built as a native or as a strongarm cross compiler.
* the C preprocessor can be invoked and it processes both definition and
implementation modules.
* error reporting understands preprocessed Modula-2 source.

35
gcc/m2/README Normal file
View file

@ -0,0 +1,35 @@
Building GNU Modula-2
=====================
Please see the GCC documentation (gcc.texi) and section
(Installing GCC).
Regression testing GM2
======================
cd host-build ; make check-m2
runs all regression tests.
Stress testing GM2
==================
cd host-build/gcc ; make gm2.paranoid
builds gm2 using itself and then compiles each module with both
versions of gm2 comparing the emitted assembler code.
Contributing to GNU Modula-2
============================
Please do. But also please read the GNU Emacs info under
* Standards: (standards). GNU coding standards.
* Intellectual Property:: Keeping Free Software Free
* Reading Non-Free Code:: Referring to Proprietary Programs
* Contributions:: Accepting Contributions
you might consider joining the GM2 Mailing list: see URL:
http://lists.nongnu.org/mailman/listinfo/gm2 before you start coding.
Many thanks and enjoy your programming!

83
gcc/m2/config-lang.in Normal file
View file

@ -0,0 +1,83 @@
# Top level configure fragment for GNU Modula-2.
# Copyright (C) 2000-2022 Free Software Foundation, Inc.
# This file is part of GCC.
# GCC 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 3, or (at your option)
# any later version.
# GCC 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 GCC; see the file COPYING3. If not see
# <http://www.gnu.org/licenses/>.
# Configure looks for the existence of this file to auto-config each language.
# We define several parameters used by configure:
#
# language - name of language as it would appear in $(LANGUAGES)
# compilers - value to add to $(COMPILERS)
# stagestuff - files to add to $(STAGESTUFF)
language="m2"
compilers="cc1gm2\$(exeext)"
stagestuff="gm2\$(exeext) cc1gm2\$(exeext) cc1gm2-cross\$(exeext)"
target_libs="target-libstdc++-v3 target-libgm2"
# The Modula-2 frontend needs C++ compiler during stage 1.
lang_requires_boot_languages=c++
# Do not build by default.
build_by_default="no"
gtfiles="\$(srcdir)/m2/gm2-lang.cc \
\$(srcdir)/m2/gm2-lang.h \
\$(srcdir)/m2/gm2-gcc/rtegraph.cc \
\$(srcdir)/m2/gm2-gcc/m2block.cc \
\$(srcdir)/m2/gm2-gcc/m2builtins.cc \
\$(srcdir)/m2/gm2-gcc/m2decl.cc \
\$(srcdir)/m2/gm2-gcc/m2except.cc \
\$(srcdir)/m2/gm2-gcc/m2expr.cc \
\$(srcdir)/m2/gm2-gcc/m2statement.cc \
\$(srcdir)/m2/gm2-gcc/m2type.cc"
outputs="m2/config-make \
m2/Make-maintainer \
"
mkdir -p m2/gm2-compiler-boot
mkdir -p m2/gm2-libs-boot
mkdir -p m2/gm2-ici-boot
mkdir -p m2/gm2-libiberty
mkdir -p m2/gm2-gcc
mkdir -p m2/gm2-compiler
mkdir -p m2/gm2-libs
mkdir -p m2/gm2-libs-iso
mkdir -p m2/gm2-compiler-paranoid
mkdir -p m2/gm2-libs-paranoid
mkdir -p m2/gm2-compiler-verify
mkdir -p m2/boot-bin
mkdir -p m2/gm2-libs-pim
mkdir -p m2/gm2-libs-coroutines
mkdir -p m2/gm2-libs-min
mkdir -p m2/pge-boot
mkdir -p plugin
mkdir -p stage1/m2 stage2/m2 stage3/m2 stage4/m2
# directories used by Make-maintainer
mkdir -p m2/gm2-auto
mkdir -p m2/gm2-pg-boot
mkdir -p m2/gm2-pge-boot
mkdir -p m2/gm2-ppg-boot
mkdir -p m2/mc-boot
mkdir -p m2/mc-boot-ch
mkdir -p m2/mc-boot-gen

6
gcc/m2/config-make.in Normal file
View file

@ -0,0 +1,6 @@
# Target libraries are put under this directory:
TARGET_SUBDIR = @target_subdir@
# Python3 executable name if it exists
PYTHON = @PYTHON@
# Does Python3 exist? (yes/no).
HAVE_PYTHON = @HAVE_PYTHON@

4718
gcc/m2/configure vendored Executable file

File diff suppressed because it is too large Load diff

38
gcc/m2/configure.ac Normal file
View file

@ -0,0 +1,38 @@
# configure.ac provides gm2spec.c with access to config values.
# Copyright (C) 2001-2022 Free Software Foundation, Inc.
# Contributed by Gaius Mulley <gaius.mulley@southwales.ac.uk>.
# GCC 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 3, or (at your option)
# any later version.
# GCC 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 GCC; see the file COPYING3. If not see
# <http://www.gnu.org/licenses/>.
AC_INIT(m2, [ ])
# Determine the host, build, and target systems
AC_CANONICAL_BUILD
AC_CANONICAL_HOST
AC_CANONICAL_TARGET
AC_CHECK_PROGS(regex_realpath, realpath)
if test x$regex_realpath = "x" ; then
AC_MSG_ERROR([realpath is required to build GNU Modula-2 (hint install coreutils).])
fi
AC_CHECK_FUNCS([stpcpy])
AC_CHECK_HEADERS(sys/types.h)
AC_HEADER_DIRENT
AC_CHECK_LIB([c],[opendir],[AC_DEFINE([HAVE_OPENDIR],[1],[found opendir])])
AC_CONFIG_HEADERS(gm2config.h, [echo timestamp > stamp-h])
AC_OUTPUT

View file

@ -0,0 +1,264 @@
(* CLexBuf.def provides a lexical buffer for clex.
Copyright (C) 2003-2022 Free Software Foundation, Inc.
Contributed by Gaius Mulley <gaius.mulley@southwales.ac.uk>.
This file is part of GNU Modula-2.
GNU Modula-2 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 3, or (at your option)
any later version.
GNU Modula-2 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 GNU Modula-2; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. *)
DEFINITION MODULE CLexBuf ;
(*
Title : CLexBuf
Author : Gaius Mulley
System : GNU Modula-2
Date : Thu Jan 23 12:32:36 2003
Revision : $Version$
Description: provides a lexical buffer for clex.
*)
FROM SYSTEM IMPORT ADDRESS ;
FROM DynamicStrings IMPORT String ;
FROM NameKey IMPORT Name ;
EXPORT QUALIFIED toktype,
IsMacroDefined, NoArgs, DefineMacro, UnDefineMacro,
OpenSource, CloseSource, ReInitialize, GetToken, InsertToken,
InsertTokenAndRewind, GetLineNo,
GetTokenNo, TokenToLineNo, FindFileNameFromToken, GetFileName,
ResetForNewPass,
currenttoken, currentstring, currentinteger,
EnableMacroSubstitutions,
AddTok, AddTokCharStar, AddTokInteger,
SetFile, PushFile, PopFile, FlushTokens ;
TYPE
toktype = (eoftok, startok, arrowtok, structtok, lsbratok, rsbratok,
lcbratok, rcbratok, lparatok, rparatok, semicolontok,
longtok, inttok, chartok, enumtok, typedeftok,
floattok, doubletok, unsignedtok, consttok,
periodperiodperiodtok,
integertok, hexintegertok, octintegertok,
identtok, realtok, conststringtok, constchartok, codetok,
starthashtok, endhashtok, definetok, undeftok, iftok, elsetok,
endiftok, ifdeftok, ifndeftok, includetok,
nottok, commatok,
periodtok,
gretok, lesstok, ortok, andtok, bartok, ambersandtok,
shiftlefttok, shiftrighttok, divtok, modtok,
sizeoftok, definedtok, hattok, equaltok, notequaltok,
greequaltok, lessequaltok, plustok, minustok, tildetok,
externtok, statictok, autotok, registertok,
voidtok, shorttok, signedtok, uniontok, colontok, becomestok,
volatiletok, typetok) ;
VAR
currenttoken : toktype ;
currentstring : ADDRESS ;
currentinteger: INTEGER ;
(*
EnableMacroSubstitutions -
*)
PROCEDURE EnableMacroSubstitutions (b: BOOLEAN) ;
(*
IsMacroDefined - returns TRUE if macro, n, was defined.
*)
PROCEDURE IsMacroDefined (n: Name) : BOOLEAN ;
(*
NoArgs - returns the number of arguments for macro, n.
-1 if the macro does not exist
*)
PROCEDURE NoArgs (n: Name) : INTEGER ;
(*
DefineMacro - defines macro, n, as defined to start at token, t.
*)
PROCEDURE DefineMacro (n: Name; t: CARDINAL) ;
(*
UnDefineMacro -
*)
PROCEDURE UnDefineMacro (n: Name) ;
(*
OpenSource - Attempts to open the source file, s.
The success of the operation is returned.
*)
PROCEDURE OpenSource (s: String) : BOOLEAN ;
(*
CloseSource - closes the current open file.
*)
PROCEDURE CloseSource ;
(*
ReInitialize - re-initialize the all the data structures.
*)
PROCEDURE ReInitialize ;
(*
ResetForNewPass - reset the buffer pointers to the beginning ready for
a new pass
*)
PROCEDURE ResetForNewPass ;
(*
GetToken - gets the next token into currenttoken.
*)
PROCEDURE GetToken ;
(*
InsertToken - inserts a symbol, token, infront of the current token
ready for the next pass.
*)
PROCEDURE InsertToken (token: toktype) ;
(*
InsertTokenAndRewind - inserts a symbol, token, infront of the current token
and then moves the token stream back onto the inserted token.
*)
PROCEDURE InsertTokenAndRewind (token: toktype) ;
(*
GetLineNo - returns the current line number where the symbol occurs in
the source file.
*)
PROCEDURE GetLineNo () : CARDINAL ;
(*
GetTokenNo - returns the number of tokens read from
the source file by the lexical analaysis.
*)
PROCEDURE GetTokenNo () : CARDINAL ;
(*
TokenToLineNo - returns the line number of the current file for the
TokenNo. The depth refers to the include depth.
A depth of 0 is the current file, depth of 1 is the file
which included the current file. Zero is returned if the
depth exceeds the file nesting level.
*)
PROCEDURE TokenToLineNo (TokenNo: CARDINAL; depth: CARDINAL) : CARDINAL ;
(*
FindFileNameFromToken - returns the complete FileName for the appropriate
source file yields the token number, TokenNo.
The, Depth, indicates the include level: 0..n
Level 0 is the current. NIL is returned if n+1
is requested.
*)
PROCEDURE FindFileNameFromToken (TokenNo: CARDINAL; depth: CARDINAL) : String ;
(*
GetFileName - assigns, a, to the current file name.
*)
PROCEDURE GetFileName () : String ;
(* ***********************************************************************
*
* These functions allow c.lex to deliver tokens into the buffer
*
************************************************************************* *)
(*
AddTok - adds a token to the buffer.
*)
PROCEDURE AddTok (t: toktype) ;
(*
AddTokCharStar - adds a token to the buffer and an additional string, s.
A copy of string, s, is made.
*)
PROCEDURE AddTokCharStar (t: toktype; s: ADDRESS) ;
(*
AddTokInteger - adds a token and an integer to the buffer.
*)
PROCEDURE AddTokInteger (t: toktype; i: INTEGER) ;
(*
SetFile - sets the current filename to, filename.
*)
PROCEDURE SetFile (filename: ADDRESS) ;
(*
PushFile - indicates that, filename, has just been included.
*)
PROCEDURE PushFile (filename: ADDRESS) ;
(*
PopFile - indicates that we are returning to, filename, having finished
an include.
*)
PROCEDURE PopFile (filename: ADDRESS) ;
(*
FlushTokens - removes the last token.
*)
PROCEDURE FlushTokens ;
END CLexBuf.

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,103 @@
(* FifoQueue.def provides a simple fifo queue.
Copyright (C) 2001-2022 Free Software Foundation, Inc.
Contributed by Gaius Mulley <gaius.mulley@southwales.ac.uk>.
This file is part of GNU Modula-2.
GNU Modula-2 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 3, or (at your option)
any later version.
GNU Modula-2 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 GNU Modula-2; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. *)
DEFINITION MODULE FifoQueue ;
(*
Author : Gaius Mulley
Title : FifoQueue
Date : Tue Dec 12 16:23:22 GMT 1989
Description: FifoQueue provides a mechanism to and from which CARDINAL
numbers can be stored and retrieved from a FIFO queue.
Last update: Tue Dec 12 16:24:24 GMT 1989
*)
EXPORT QUALIFIED PutEnumerationIntoFifoQueue, GetEnumerationFromFifoQueue,
PutSubrangeIntoFifoQueue, GetSubrangeFromFifoQueue,
PutConstIntoFifoQueue, GetConstFromFifoQueue,
PutConstructorIntoFifoQueue, GetConstructorFromFifoQueue ;
(*
PutEnumerationIntoFifoQueue - places an enumeration symbol, c,
into a fifo queue.
*)
PROCEDURE PutEnumerationIntoFifoQueue (c: CARDINAL) ;
(*
GetEnumerationFromFifoQueue - retrieves an enumeration symbol,
c, from a fifo queue.
*)
PROCEDURE GetEnumerationFromFifoQueue (VAR c: CARDINAL) ;
(*
PutSubrangeIntoFifoQueue - places a subrange symbol into a fifo
queue.
*)
PROCEDURE PutSubrangeIntoFifoQueue (c: CARDINAL) ;
(*
GetSubrangeFromFifoQueue - retrieves a subrange symbol from a
fifo queue.
*)
PROCEDURE GetSubrangeFromFifoQueue (VAR c: CARDINAL) ;
(*
PutConstIntoFifoQueue - places a constant symbol
into a fifo queue.
*)
PROCEDURE PutConstIntoFifoQueue (c: CARDINAL) ;
(*
GetConstFromFifoQueue - retrieves a const symbol
from a fifo queue.
*)
PROCEDURE GetConstFromFifoQueue (VAR c: CARDINAL) ;
(*
PutConstructorIntoFifoQueue - places a constructor symbol
into a fifo queue.
*)
PROCEDURE PutConstructorIntoFifoQueue (c: CARDINAL) ;
(*
GetConstructorFromFifoQueue - retrieves a constructor symbol
from a fifo queue.
*)
PROCEDURE GetConstructorFromFifoQueue (VAR c: CARDINAL) ;
END FifoQueue.

View file

@ -0,0 +1,170 @@
(* FifoQueue.mod provides a simple fifo queue.
Copyright (C) 2001-2022 Free Software Foundation, Inc.
Contributed by Gaius Mulley <gaius.mulley@southwales.ac.uk>.
This file is part of GNU Modula-2.
GNU Modula-2 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 3, or (at your option)
any later version.
GNU Modula-2 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 GNU Modula-2; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. *)
IMPLEMENTATION MODULE FifoQueue ;
FROM Lists IMPORT List, InitList, PutItemIntoList, GetItemFromList ;
TYPE
Fifo = RECORD
Queue: List ;
Out : CARDINAL ;
END ;
VAR
const,
subrange,
enumeration,
constructor: Fifo ;
(*
PutInto - places a CARDINAL number, c, into a fifo queue.
*)
PROCEDURE PutInto (VAR f: Fifo; c: CARDINAL) ;
BEGIN
WITH f DO
PutItemIntoList(Queue, c)
END
END PutInto ;
(*
GetFrom - retrieves a CARDINAL number, c, from a fifo queue.
*)
PROCEDURE GetFrom (VAR f: Fifo; VAR c: CARDINAL) ;
BEGIN
WITH f DO
INC(Out) ;
c := GetItemFromList(Queue, Out)
END
END GetFrom ;
(*
PutEnumerationIntoFifoQueue - places an enumeration symbol, c,
into a fifo queue.
*)
PROCEDURE PutEnumerationIntoFifoQueue (c: CARDINAL) ;
BEGIN
PutInto(enumeration, c)
END PutEnumerationIntoFifoQueue ;
(*
GetEnumerationFromFifoQueue - retrieves an enumeration symbol,
c, from a fifo queue.
*)
PROCEDURE GetEnumerationFromFifoQueue (VAR c: CARDINAL) ;
BEGIN
GetFrom(enumeration, c)
END GetEnumerationFromFifoQueue ;
(*
PutSubrangeIntoFifoQueue - places a subrange symbol into a fifo
queue.
*)
PROCEDURE PutSubrangeIntoFifoQueue (c: CARDINAL) ;
BEGIN
PutInto(subrange, c)
END PutSubrangeIntoFifoQueue ;
(*
GetSubrangeFromFifoQueue - retrieves a subrange symbol from a
fifo queue.
*)
PROCEDURE GetSubrangeFromFifoQueue (VAR c: CARDINAL) ;
BEGIN
GetFrom(subrange, c)
END GetSubrangeFromFifoQueue ;
(*
PutConstructorIntoFifoQueue - places a constructor symbol
into a fifo queue.
*)
PROCEDURE PutConstructorIntoFifoQueue (c: CARDINAL) ;
BEGIN
PutInto(constructor, c)
END PutConstructorIntoFifoQueue ;
(*
GetConstructorFromFifoQueue - retrieves a constructor symbol
from a fifo queue.
*)
PROCEDURE GetConstructorFromFifoQueue (VAR c: CARDINAL) ;
BEGIN
GetFrom(constructor, c)
END GetConstructorFromFifoQueue ;
(*
PutConstIntoFifoQueue - places a constant symbol
into a fifo queue.
*)
PROCEDURE PutConstIntoFifoQueue (c: CARDINAL) ;
BEGIN
PutInto(const, c)
END PutConstIntoFifoQueue ;
(*
GetConstFromFifoQueue - retrieves a const symbol
from a fifo queue.
*)
PROCEDURE GetConstFromFifoQueue (VAR c: CARDINAL) ;
BEGIN
GetFrom(const, c)
END GetConstFromFifoQueue ;
(*
Init - initialize the fifo queue.
*)
PROCEDURE Init (VAR f: Fifo) ;
BEGIN
WITH f DO
InitList(Queue) ;
Out := 0
END
END Init ;
BEGIN
Init(const) ;
Init(enumeration) ;
Init(subrange) ;
Init(constructor)
END FifoQueue.

View file

@ -0,0 +1,128 @@
(* Lists.def provides an unordered list manipulation package.
Copyright (C) 2001-2022 Free Software Foundation, Inc.
Contributed by Gaius Mulley <gaius.mulley@southwales.ac.uk>.
This file is part of GNU Modula-2.
GNU Modula-2 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 3, or (at your option)
any later version.
GNU Modula-2 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 GNU Modula-2; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. *)
DEFINITION MODULE Lists ;
(*
Author : Gaius Mulley
Title : Lists
Date : Tue Dec 12 20:53:36 EST 1989
SYSTEM : UNIX (GNU Modula-2)
Description: Provides an unordered list manipulation package.
Last update: $Date: 2010/10/03 19:01:05 $
Version : $Revision: 1.9 $
*)
FROM SYSTEM IMPORT WORD ;
FROM SymbolKey IMPORT PerformOperation ;
EXPORT QUALIFIED List,
InitList, KillList, PutItemIntoList, GetItemFromList,
GetIndexOfList,
NoOfItemsInList, IsItemInList, IncludeItemIntoList,
RemoveItemFromList, ForeachItemInListDo, DuplicateList ;
TYPE
List ;
(*
InitList - creates a new list, l.
*)
PROCEDURE InitList (VAR l: List) ;
(*
KillList - deletes the complete list, l.
*)
PROCEDURE KillList (VAR l: List) ;
(*
PutItemIntoList - places a CARDINAL, c, into list, l.
*)
PROCEDURE PutItemIntoList (l: List; c: WORD) ;
(*
GetItemFromList - retrieves the nth WORD from list, l.
*)
PROCEDURE GetItemFromList (l: List; n: CARDINAL) : WORD ;
(*
GetIndexOfList - returns the index for WORD, c, in list, l.
If more than one CARDINAL, c, exists the index
for the first is returned.
*)
PROCEDURE GetIndexOfList (l: List; c: WORD) : CARDINAL ;
(*
NoOfItemsInList - returns the number of items in list, l.
*)
PROCEDURE NoOfItemsInList (l: List) : CARDINAL ;
(*
IncludeItemIntoList - adds a WORD, c, into a list providing
the value does not already exist.
*)
PROCEDURE IncludeItemIntoList (l: List; c: WORD) ;
(*
RemoveItemFromList - removes a WORD, c, from a list.
It assumes that this value only appears once.
*)
PROCEDURE RemoveItemFromList (l: List; c: WORD) ;
(*
IsItemInList - returns true if a WORD, c, was found in list, l.
*)
PROCEDURE IsItemInList (l: List; c: WORD) : BOOLEAN ;
(*
ForeachItemInListDo - calls procedure, P, foreach item in list, l.
*)
PROCEDURE ForeachItemInListDo (l: List; P: PerformOperation) ;
(*
DuplicateList - returns a duplicate list derived from, l.
*)
PROCEDURE DuplicateList (l: List) : List ;
END Lists.

View file

@ -0,0 +1,341 @@
(* Lists.mod provides an unordered list manipulation package.
Copyright (C) 2001-2022 Free Software Foundation, Inc.
Contributed by Gaius Mulley <gaius.mulley@southwales.ac.uk>.
This file is part of GNU Modula-2.
GNU Modula-2 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 3, or (at your option)
any later version.
GNU Modula-2 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 GNU Modula-2; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. *)
IMPLEMENTATION MODULE Lists ;
FROM Storage IMPORT ALLOCATE, DEALLOCATE ;
CONST
MaxNoOfElements = 5 ;
TYPE
List = POINTER TO list ;
list = RECORD
NoOfElements: CARDINAL ;
Elements : ARRAY [1..MaxNoOfElements] OF WORD ;
Next : List ;
END ;
(*
InitList - creates a new list, l.
*)
PROCEDURE InitList (VAR l: List) ;
BEGIN
NEW (l) ;
WITH l^ DO
NoOfElements := 0 ;
Next := NIL
END
END InitList ;
(*
KillList - deletes the complete list, l.
*)
PROCEDURE KillList (VAR l: List) ;
BEGIN
IF l#NIL
THEN
IF l^.Next#NIL
THEN
KillList(l^.Next)
END ;
DISPOSE(l)
END
END KillList ;
(*
PutItemIntoList - places a WORD, c, into list, l.
*)
PROCEDURE PutItemIntoList (l: List; c: WORD) ;
BEGIN
WITH l^ DO
IF NoOfElements<MaxNoOfElements
THEN
INC(NoOfElements) ;
Elements[NoOfElements] := c
ELSIF Next#NIL
THEN
PutItemIntoList(Next, c)
ELSE
InitList(Next) ;
PutItemIntoList(Next, c)
END
END
END PutItemIntoList ;
(*
GetItemFromList - retrieves the nth WORD from list, l.
(recursive solution).
*)
(*
PROCEDURE GetItemFromList (l: List; n: CARDINAL) : WORD ;
BEGIN
IF n>NoOfItemsInList(l)
THEN
RETURN( 0 )
ELSE
WITH l^ DO
IF n<=NoOfElements
THEN
RETURN( Elements[n] )
ELSE
RETURN( GetItemFromList( Next, n-NoOfElements ) )
END
END
END
END GetItemFromList ;
*)
(* iterative solution *)
PROCEDURE GetItemFromList (l: List; n: CARDINAL) : WORD ;
BEGIN
WHILE l#NIL DO
WITH l^ DO
IF n<=NoOfElements
THEN
RETURN( Elements[n] )
ELSE
DEC(n, NoOfElements)
END
END ;
l := l^.Next
END ;
RETURN( 0 )
END GetItemFromList ;
(*
GetIndexOfList - returns the index for WORD, c, in list, l.
If more than one WORD, c, exists the index
for the first is returned.
*)
PROCEDURE GetIndexOfList (l: List; c: WORD) : CARDINAL ;
VAR
i: CARDINAL ;
BEGIN
IF l=NIL
THEN
RETURN( 0 )
ELSE
WITH l^ DO
i := 1 ;
WHILE i<=NoOfElements DO
IF Elements[i]=c
THEN
RETURN( i )
ELSE
INC(i)
END
END ;
RETURN( NoOfElements+GetIndexOfList(Next, c) )
END
END
END GetIndexOfList ;
(*
NoOfItemsInList - returns the number of items in list, l.
*)
(*
PROCEDURE NoOfItemsInList (l: List) : CARDINAL ;
BEGIN
IF l=NIL
THEN
RETURN( 0 )
ELSE
WITH l^ DO
RETURN( NoOfElements+NoOfItemsInList(Next) )
END
END
END NoOfItemsInList ;
*)
(*
NoOfItemsInList - returns the number of items in list, l.
(iterative algorithm of the above).
*)
PROCEDURE NoOfItemsInList (l: List) : CARDINAL ;
VAR
t: CARDINAL ;
BEGIN
IF l=NIL
THEN
RETURN( 0 )
ELSE
t := 0 ;
REPEAT
WITH l^ DO
INC(t, NoOfElements)
END ;
l := l^.Next
UNTIL l=NIL;
RETURN( t )
END
END NoOfItemsInList ;
(*
IncludeItemIntoList - adds a WORD, c, into a list providing
the value does not already exist.
*)
PROCEDURE IncludeItemIntoList (l: List; c: WORD) ;
BEGIN
IF NOT IsItemInList(l, c)
THEN
PutItemIntoList(l, c)
END
END IncludeItemIntoList ;
(*
RemoveItem - remove an element at index, i, from the list data type.
*)
PROCEDURE RemoveItem (p, l: List; i: CARDINAL) ;
BEGIN
WITH l^ DO
DEC(NoOfElements) ;
WHILE i<=NoOfElements DO
Elements[i] := Elements[i+1] ;
INC(i)
END ;
IF (NoOfElements=0) AND (p#NIL)
THEN
p^.Next := l^.Next ;
DISPOSE(l)
END
END
END RemoveItem ;
(*
RemoveItemFromList - removes a WORD, c, from a list.
It assumes that this value only appears once.
*)
PROCEDURE RemoveItemFromList (l: List; c: WORD) ;
VAR
p : List ;
i : CARDINAL ;
Found: BOOLEAN ;
BEGIN
IF l#NIL
THEN
Found := FALSE ;
p := NIL ;
REPEAT
WITH l^ DO
i := 1 ;
WHILE (i<=NoOfElements) AND (Elements[i]#c) DO
INC(i)
END ;
END ;
IF (i<=l^.NoOfElements) AND (l^.Elements[i]=c)
THEN
Found := TRUE
ELSE
p := l ;
l := l^.Next
END
UNTIL (l=NIL) OR Found ;
IF Found
THEN
RemoveItem(p, l, i)
END
END
END RemoveItemFromList ;
(*
IsItemInList - returns true if a WORD, c, was found in list, l.
*)
PROCEDURE IsItemInList (l: List; c: WORD) : BOOLEAN ;
VAR
i: CARDINAL ;
BEGIN
REPEAT
WITH l^ DO
i := 1 ;
WHILE (i<=NoOfElements) DO
IF Elements[i]=c
THEN
RETURN( TRUE )
ELSE
INC(i)
END
END
END ;
l := l^.Next
UNTIL l=NIL ;
RETURN( FALSE )
END IsItemInList ;
(*
ForeachItemInListDo - calls procedure, P, foreach item in list, l.
*)
PROCEDURE ForeachItemInListDo (l: List; P: PerformOperation) ;
VAR
i, n: CARDINAL ;
BEGIN
n := NoOfItemsInList(l) ;
i := 1 ;
WHILE i<=n DO
P(GetItemFromList(l, i)) ;
INC(i)
END
END ForeachItemInListDo ;
(*
DuplicateList - returns a duplicate list derived from, l.
*)
PROCEDURE DuplicateList (l: List) : List ;
VAR
m : List ;
n, i: CARDINAL ;
BEGIN
InitList(m) ;
n := NoOfItemsInList(l) ;
i := 1 ;
WHILE i<=n DO
PutItemIntoList(m, GetItemFromList(l, i)) ;
INC(i)
END ;
RETURN( m )
END DuplicateList ;
END Lists.

View file

@ -0,0 +1,989 @@
(* M2ALU.def gcc implementation of the M2ALU module.
Copyright (C) 2001-2022 Free Software Foundation, Inc.
Contributed by Gaius Mulley <gaius.mulley@southwales.ac.uk>.
This file is part of GNU Modula-2.
GNU Modula-2 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 3, or (at your option)
any later version.
GNU Modula-2 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 GNU Modula-2; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. *)
DEFINITION MODULE M2ALU ;
(*
Title : M2ALU.def
Author : Gaius Mulley
System : UNIX (gm2)
Date : Tue Jul 11 09:14:28 2000
Description: Handles all values in the Modula-2 compiler and all
manipulations of values. All values are mapped onto
gcc trees.
*)
FROM NameKey IMPORT Name ;
FROM m2tree IMPORT Tree ;
FROM M2GCCDeclare IMPORT WalkAction, IsAction ;
EXPORT QUALIFIED PtrToValue,
InitValue,
IsValueTypeNone,
IsValueTypeInteger,
IsValueTypeReal,
IsValueTypeComplex,
IsValueTypeSet,
IsValueTypeConstructor,
IsValueTypeArray,
IsValueTypeRecord,
PopInto, PushFrom,
PushIntegerTree, PopIntegerTree,
PushSetTree, PopSetTree,
PushRealTree, PopRealTree,
PushComplexTree, PopComplexTree,
PopConstructorTree,
PushCard,
PushInt,
PushChar,
PushString,
PushTypeOfTree,
CoerseLongRealToCard,
ConvertRealToInt,
ConvertToInt,
ConvertToType,
GetSetValueType,
IsSolved, IsValueConst,
PutConstructorSolved, EvaluateValue, TryEvaluateValue,
IsNulSet, IsGenericNulSet, PushNulSet, AddBitRange, AddBit, SubBit,
SetOr, SetAnd, SetIn,
SetDifference, SetSymmetricDifference,
SetNegate, SetShift, SetRotate,
Addn, Multn, Sub,
DivFloor, ModFloor, DivTrunc, ModTrunc,
Equ, NotEqu, Less, Gre, LessEqu, GreEqu,
GetValue, GetRange, ConstructSetConstant, BuildRange,
IsConstructorDependants, WalkConstructorDependants,
AddField, AddElements,
PushEmptyConstructor, PushEmptyArray, PushEmptyRecord,
ChangeToConstructor,
IsValueAndTreeKnown, CheckOrResetOverflow ;
TYPE
PtrToValue ;
(*
InitValue - initializes and returns a value container.
*)
PROCEDURE InitValue () : PtrToValue ;
(*
IsValueTypeNone - returns TRUE if the value on the top stack has no value.
*)
PROCEDURE IsValueTypeNone () : BOOLEAN ;
(*
IsValueTypeInteger - returns TRUE if the value on the top stack is an integer.
*)
PROCEDURE IsValueTypeInteger () : BOOLEAN ;
(*
IsValueTypeReal - returns TRUE if the value on the top stack is a real.
*)
PROCEDURE IsValueTypeReal () : BOOLEAN ;
(*
IsValueTypeComplex - returns TRUE if the value on the top stack is a complex.
*)
PROCEDURE IsValueTypeComplex () : BOOLEAN ;
(*
IsValueTypeSet - returns TRUE if the value on the top stack is a set.
*)
PROCEDURE IsValueTypeSet () : BOOLEAN ;
(*
IsValueTypeConstructor - returns TRUE if the value on the top
stack is a constructor.
*)
PROCEDURE IsValueTypeConstructor () : BOOLEAN ;
(*
IsValueTypeArray - returns TRUE if the value on the top
stack is an array.
*)
PROCEDURE IsValueTypeArray () : BOOLEAN ;
(*
IsValueTypeRecord - returns TRUE if the value on the top
stack is a record.
*)
PROCEDURE IsValueTypeRecord () : BOOLEAN ;
(*
GetSetValueType - returns the set type on top of the ALU stack.
*)
PROCEDURE GetSetValueType () : CARDINAL ;
(*
PushIntegerTree - pushes a gcc tree value onto the ALU stack.
*)
PROCEDURE PushIntegerTree (t: Tree) ;
(*
PopIntegerTree - pops a gcc tree value from the ALU stack.
*)
PROCEDURE PopIntegerTree () : Tree ;
(*
PushRealTree - pushes a gcc tree value onto the ALU stack.
*)
PROCEDURE PushRealTree (t: Tree) ;
(*
PopRealTree - pops a gcc tree value from the ALU stack.
*)
PROCEDURE PopRealTree () : Tree ;
(*
PushComplexTree - pushes a gcc tree value onto the ALU stack.
*)
PROCEDURE PushComplexTree (t: Tree) ;
(*
PopComplexTree - pops a gcc tree value from the ALU stack.
*)
PROCEDURE PopComplexTree () : Tree ;
(*
PushSetTree - pushes a gcc tree onto the ALU stack.
The tree, t, is expected to contain a
word value. It is converted into a set
type (sym). Bit 0 maps onto MIN(sym).
*)
PROCEDURE PushSetTree (tokenno: CARDINAL;
t: Tree; sym: CARDINAL) ;
(*
PopSetTree - pops a gcc tree from the ALU stack.
*)
PROCEDURE PopSetTree (tokenno: CARDINAL) : Tree ;
(*
PopConstructorTree - returns a tree containing the compound literal.
*)
PROCEDURE PopConstructorTree (tokenno: CARDINAL) : Tree ;
(*
PushFrom - pushes a copy of the contents of, v, onto stack.
*)
PROCEDURE PushFrom (v: PtrToValue) ;
(*
PopInto - pops the top element from the stack and places it into, v.
*)
PROCEDURE PopInto (v: PtrToValue) ;
(*
PushCard - pushes a cardinal onto the stack.
*)
PROCEDURE PushCard (c: CARDINAL) ;
(*
PushInt - pushes an integer onto the stack.
*)
PROCEDURE PushInt (i: INTEGER) ;
(*
PushChar - pushes a char onto the stack.
*)
PROCEDURE PushChar (c: CHAR) ;
(*
PushString - pushes the numerical value of the string onto the stack.
*)
PROCEDURE PushString (tokenno: CARDINAL; s: Name) ;
(*
CoerseLongRealToCard - performs a coersion between a REAL to a CARDINAL
*)
PROCEDURE CoerseLongRealToCard ;
(*
ConvertRealToInt - converts a REAL into an INTEGER
*)
PROCEDURE ConvertRealToInt ;
(*
ConvertToInt - converts the value into an INTEGER. This should be used
if we are computing the number of elements in a char set to
avoid an overflow.
*)
PROCEDURE ConvertToInt ;
(*
ConvertToType - converts the top of stack to type, t.
*)
PROCEDURE ConvertToType (t: CARDINAL) ;
(*
IsSolved - returns true if the memory cell indicated by v
has a known value.
*)
PROCEDURE IsSolved (v: PtrToValue) : BOOLEAN ;
(*
PutConstructorSolved - records that this constructor is solved.
*)
PROCEDURE PutConstructorSolved (sym: CARDINAL) ;
(*
EvaluateValue - attempts to evaluate the symbol, sym, value.
*)
PROCEDURE EvaluateValue (sym: CARDINAL) ;
(*
TryEvaluateValue - attempts to evaluate the symbol, sym, value.
*)
PROCEDURE TryEvaluateValue (sym: CARDINAL) ;
(*
Add - adds the top two elements on the stack.
The Stack:
Entry Exit
Ptr ->
+------------+
| Op1 | <- Ptr
|------------| +------------+
| Op2 | | Op2 + Op1 |
|------------| |------------|
*)
PROCEDURE Addn ;
(*
Sub - subtracts the top two elements on the stack.
The Stack:
Entry Exit
Ptr ->
+------------+
| Op1 | <- Ptr
|------------| +------------+
| Op2 | | Op2 - Op1 |
|------------| |------------|
*)
PROCEDURE Sub ;
(*
Mult - multiplies the top two elements on the stack.
The Stack:
Entry Exit
Ptr ->
+------------+
| Op1 | <- Ptr
|------------| +------------+
| Op2 | | Op2 * Op1 |
|------------| |------------|
*)
PROCEDURE Multn ;
(*
DivFloor - divides the top two elements on the stack.
The Stack:
Entry Exit
Ptr ->
+------------+
| Op1 | <- Ptr
|------------| +--------------+
| Op2 | | Op2 DIV Op1 |
|------------| |--------------|
*)
PROCEDURE DivFloor ;
(*
ModFloor - modulus of the top two elements on the stack.
The Stack:
Entry Exit
Ptr ->
+------------+
| Op1 | <- Ptr
|------------| +--------------+
| Op2 | | Op2 MOD Op1 |
|------------| |--------------|
*)
PROCEDURE ModFloor ;
(*
DivTrunc - divides the top two elements on the stack.
The Stack:
Entry Exit
Ptr ->
+------------+
| Op1 | <- Ptr
|------------| +--------------+
| Op2 | | Op2 DIV Op1 |
|------------| |--------------|
*)
PROCEDURE DivTrunc ;
(*
ModTrunc - modulus of the top two elements on the stack.
The Stack:
Entry Exit
Ptr ->
+------------+
| Op1 | <- Ptr
|------------| +--------------+
| Op2 | | Op2 MOD Op1 |
|------------| |--------------|
*)
PROCEDURE ModTrunc ;
(*
Equ - returns true if the top two elements on the stack
are identical.
The Stack:
Entry Exit
Ptr ->
+------------+
| Op1 |
|------------|
| Op2 |
|------------| Empty
RETURN( Op2 = Op1 )
*)
PROCEDURE Equ (tokenno: CARDINAL) : BOOLEAN ;
(*
NotEqu - returns true if the top two elements on the stack
are not identical.
The Stack:
Entry Exit
Ptr ->
+------------+
| Op1 |
|------------|
| Op2 |
|------------| Empty
RETURN( Op2 # Op1 )
*)
PROCEDURE NotEqu (tokenno: CARDINAL) : BOOLEAN ;
(*
Less - returns true if Op2 < Op1.
The Stack:
Entry Exit
Ptr ->
+------------+
| Op1 |
|------------|
| Op2 |
|------------| Empty
RETURN( Op2 < Op1 )
*)
PROCEDURE Less (tokenno: CARDINAL) : BOOLEAN ;
(*
Gre - returns true if Op2 > Op1
The Stack:
Entry Exit
Ptr ->
+------------+
| Op1 |
|------------|
| Op2 |
|------------| Empty
RETURN( Op2 > Op1 )
*)
PROCEDURE Gre (tokenno: CARDINAL) : BOOLEAN ;
(*
LessEqu - returns true if Op2 <= Op1
The Stack:
Entry Exit
Ptr ->
+------------+
| Op1 |
|------------|
| Op2 |
|------------| Empty
RETURN( Op2 <= Op1 )
*)
PROCEDURE LessEqu (tokenno: CARDINAL) : BOOLEAN ;
(*
GreEqu - returns true if Op2 >= Op1
are not identical.
The Stack:
Entry Exit
Ptr ->
+------------+
| Op1 |
|------------|
| Op2 |
|------------| Empty
RETURN( Op2 >= Op1 )
*)
PROCEDURE GreEqu (tokenno: CARDINAL) : BOOLEAN ;
(*
IsNulSet - returns TRUE if the top element is the nul set constant, {}.
*)
PROCEDURE IsNulSet () : BOOLEAN ;
(*
IsGenericNulSet - returns TRUE if the top element is the generic nul set constant, {}.
*)
PROCEDURE IsGenericNulSet () : BOOLEAN ;
(*
PushNulSet - pushes an empty set {} onto the ALU stack. The subrange type used
to construct the set is defined by, type. If this is NulSym then
the set is generic and compatible with all sets.
The Stack:
Entry Exit
<- Ptr
+------------+
| {} |
Ptr -> |------------|
*)
PROCEDURE PushNulSet (settype: CARDINAL) ;
(*
AddBitRange - adds the range op1..op2 to the underlying set.
Ptr ->
<- Ptr
+------------+ +------------+
| Set | | Set |
|------------| |------------|
*)
PROCEDURE AddBitRange (tokenno: CARDINAL; op1, op2: CARDINAL) ;
(*
AddBit - adds the bit op1 to the underlying set. INCL(Set, op1)
Ptr ->
<- Ptr
+------------+ +------------+
| Set | | Set |
|------------| |------------|
*)
PROCEDURE AddBit (tokenno: CARDINAL; op1: CARDINAL) ;
(*
SubBit - removes a bit op1 from the underlying set. EXCL(Set, Op1)
Ptr ->
+------------+
| Op1 | <- Ptr
|------------| +------------+
| Set | | Set |
|------------| |------------|
*)
PROCEDURE SubBit (tokenno: CARDINAL; op1: CARDINAL) ;
(*
SetIn - returns true if the Op1 IN Set
The Stack:
Entry Exit
Ptr ->
+------------+
| Set |
|------------|
| Op1 |
|------------| Empty
RETURN( Op1 IN Set )
*)
PROCEDURE SetIn (tokenno: CARDINAL; Op1: CARDINAL) : BOOLEAN ;
(*
SetOr - performs an inclusive OR of the top two sets on the stack.
The Stack:
Entry Exit
Ptr ->
+------------+
| Op1 | <- Ptr
|------------| +------------+
| Op2 | | Op2 + Op1 |
|------------| |------------|
*)
PROCEDURE SetOr (tokenno: CARDINAL) ;
(*
SetAnd - performs a set AND the top two sets on the stack.
The Stack:
Entry Exit
Ptr ->
+------------+
| Op1 | <- Ptr
|------------| +------------+
| Op2 | | Op2 * Op1 |
|------------| |------------|
*)
PROCEDURE SetAnd (tokenno: CARDINAL) ;
(*
SetDifference - performs a set difference of the top two elements on the stack.
For each member in the set
if member in Op2 and not member in Op1
The Stack:
Entry Exit
Ptr ->
+------------+
| Op1 | <- Ptr
|------------| +-------------------+
| Op2 | | Op2 and (not Op1) |
|------------| |-------------------|
*)
PROCEDURE SetDifference (tokenno: CARDINAL) ;
(*
SetSymmetricDifference - performs a set difference of the top two sets on the stack.
The Stack:
Entry Exit
Ptr ->
+------------+
| Op1 | <- Ptr
|------------| +------------+
| Op2 | | Op2 - Op1 |
|------------| |------------|
*)
PROCEDURE SetSymmetricDifference (tokenno: CARDINAL) ;
(*
SetNegate - negates the top set on the stack.
Ptr -> <- Ptr
+-----------+ +------------+
| Set | | Set |
|-----------| |------------|
*)
PROCEDURE SetNegate (tokenno: CARDINAL) ;
(*
SetShift - if op1 is positive
then
result := op2 << op1
else
result := op2 >> op1
fi
The Stack:
Entry Exit
Ptr ->
+------------+
| Op1 | <- Ptr
|------------| +------------+
| Op2 | | result |
|------------| |------------|
*)
PROCEDURE SetShift (tokenno: CARDINAL) ;
(*
SetRotate - if op1 is positive
then
result := ROTATERIGHT(op2, op1)
else
result := ROTATELEFT(op2, op1)
fi
The Stack:
Entry Exit
Ptr ->
+------------+
| Op1 | <- Ptr
|------------| +------------+
| Op2 | | result |
|------------| |------------|
*)
PROCEDURE SetRotate (tokenno: CARDINAL) ;
(*
GetValue - returns and pops the value from the top of stack.
*)
PROCEDURE GetValue (tokenno: CARDINAL) : PtrToValue ;
(*
GetRange - returns TRUE if range number, n, exists in the value, v.
A non empty set is defined by having 1..N ranges
*)
PROCEDURE GetRange (v: PtrToValue; n: CARDINAL; VAR low, high: CARDINAL) : BOOLEAN ;
(*
ConstructSetConstant - builds a struct of integers which represents the
set const, sym.
*)
PROCEDURE ConstructSetConstant (tokenno: CARDINAL; v: PtrToValue) : Tree ;
(*
BuildRange - returns a integer sized constant which represents the
value {e1..e2}.
*)
PROCEDURE BuildRange (tokenno: CARDINAL; e1, e2: Tree) : Tree ;
(*
IsConstructorDependants - return TRUE if returned if all
q(dependants) of, sym, return TRUE.
*)
PROCEDURE IsConstructorDependants (sym: CARDINAL; q: IsAction) : BOOLEAN ;
(*
WalkConstructorDependants - walk the constructor, sym, calling
p for each dependant.
*)
PROCEDURE WalkConstructorDependants (sym: CARDINAL; p: WalkAction) ;
(*
IsValueAndTreeKnown - returns TRUE if the value is known and the gcc tree
is defined.
The Stack:
Entry Exit
Ptr ->
+------------+
| Op1 | <- Ptr
|------------| +------------+
*)
PROCEDURE IsValueAndTreeKnown () : BOOLEAN ;
(*
CheckOrResetOverflow - tests to see whether the tree, t, has caused
an overflow error and if so it generates an
error message.
*)
PROCEDURE CheckOrResetOverflow (tokenno: CARDINAL; t: Tree; check: BOOLEAN) ;
(*
AddElements - adds the elements, el BY, n, to the array constant.
Ptr ->
<- Ptr
+------------+ +------------+
| Array | | Array |
|------------| |------------|
*)
PROCEDURE AddElements (tokenno: CARDINAL; el, n: CARDINAL) ;
(*
AddField - adds the field op1 to the underlying constructor.
Ptr ->
<- Ptr
+------------+ +------------+
| const | | const |
|------------| |------------|
*)
PROCEDURE AddField (tokenno: CARDINAL; op1: CARDINAL) ;
(*
PushEmptyConstructor - pushes an empty constructor {} onto the ALU stack.
This is expected to be filled in by subsequent
calls to AddElements, AddRange or AddField.
The Stack:
Entry Exit
<- Ptr
+------------+
| {} |
Ptr -> |------------|
*)
PROCEDURE PushEmptyConstructor (constype: CARDINAL) ;
(*
PushEmptyArray - pushes an empty array {} onto the ALU stack.
This is expected to be filled in by subsequent
calls to AddElements.
The Stack:
Entry Exit
<- Ptr
+------------+
| {} |
Ptr -> |------------|
*)
PROCEDURE PushEmptyArray (arraytype: CARDINAL) ;
(*
PushEmptyRecord - pushes an empty record {} onto the ALU stack.
This is expected to be filled in by subsequent
calls to AddField.
The Stack:
Entry Exit
<- Ptr
+------------+
| {} |
Ptr -> |------------|
*)
PROCEDURE PushEmptyRecord (recordtype: CARDINAL) ;
(*
ChangeToConstructor - change the top of stack value to a constructor, type.
*)
PROCEDURE ChangeToConstructor (tokenno: CARDINAL; constype: CARDINAL) ;
(*
IsValueConst - returns true if the memory cell indicated by v
is only defined by constants. For example
no variables are used in the constructor.
*)
PROCEDURE IsValueConst (v: PtrToValue) : BOOLEAN ;
(*
PushTypeOfTree - pushes tree, gcc, to the stack and records the
front end type.
*)
PROCEDURE PushTypeOfTree (sym: CARDINAL; gcc: Tree) ;
END M2ALU.

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,55 @@
(* M2AsmUtil.def provides asm symbol name conversion.
Copyright (C) 2001-2022 Free Software Foundation, Inc.
Contributed by Gaius Mulley <gaius.mulley@southwales.ac.uk>.
This file is part of GNU Modula-2.
GNU Modula-2 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 3, or (at your option)
any later version.
GNU Modula-2 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 GNU Modula-2; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. *)
DEFINITION MODULE M2AsmUtil ;
(*
Author : Gaius Mulley
Title : M2AsmUtil
Date : Thu Feb 1 15:34:08 GMT 1990
Description: Provides utilities relating symbols in the SymbolTable
to their equivalent representation in ASM format.
*)
FROM DynamicStrings IMPORT String ;
FROM NameKey IMPORT Name ;
EXPORT QUALIFIED GetFullSymName, GetFullScopeAsmName ;
(*
GetFullSymName - returns the NameKey for the symbol name (which also
may contain the module name). This is the same as
GetAsmName except that it does not have the leading _
*)
PROCEDURE GetFullSymName (sym: CARDINAL) : Name ;
(*
GetFullScopeAsmName - returns the fully qualified name for the symbol.
This will take the format
[DefImpModule|Module]_{InnerModule}_{Procedure}_SymbolName
*)
PROCEDURE GetFullScopeAsmName (sym: CARDINAL) : Name ;
END M2AsmUtil.

View file

@ -0,0 +1,189 @@
(* M2AsmUtil.mod provides utilities relating symbols in the SymbolTable.
Copyright (C) 2001-2022 Free Software Foundation, Inc.
Contributed by Gaius Mulley <gaius.mulley@southwales.ac.uk>.
This file is part of GNU Modula-2.
GNU Modula-2 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 3, or (at your option)
any later version.
GNU Modula-2 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 GNU Modula-2; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. *)
IMPLEMENTATION MODULE M2AsmUtil ;
FROM SFIO IMPORT WriteS ;
FROM FIO IMPORT StdOut ;
FROM DynamicStrings IMPORT String, string, ConCat, KillString, InitString, Mark, InitStringCharStar, ConCatChar ;
FROM StdIO IMPORT Write ;
FROM StrIO IMPORT WriteString ;
FROM NameKey IMPORT WriteKey, GetKey, MakeKey, makekey, KeyToCharStar ;
FROM M2Options IMPORT WholeProgram ;
FROM SymbolTable IMPORT NulSym,
GetSymName,
GetScope,
GetBaseModule,
IsInnerModule,
IsVar,
IsProcedure,
IsModule,
IsDefImp,
IsExportQualified,
IsExported, IsPublic, IsExtern, IsMonoName,
IsDefinitionForC ;
FROM M2Error IMPORT InternalError ;
FROM m2configure IMPORT UseUnderscoreForC ;
(*
StringToKey - returns a Name, from a string and destroys the string.
*)
PROCEDURE StringToKey (s: String) : Name ;
VAR
k: Name ;
BEGIN
k := makekey (string (s)) ;
s := KillString (s) ;
RETURN k
END StringToKey ;
(*
GetFullScopeAsmName - returns the fully qualified name for the symbol.
This will take the format
[DefImpModule|Module]_{InnerModule}_{Procedure}_SymbolName
*)
PROCEDURE GetFullScopeAsmName (sym: CARDINAL) : Name ;
VAR
leader: String ;
scope : CARDINAL ;
BEGIN
scope := GetScope (sym) ;
IF UseUnderscoreForC
THEN
leader := InitString ('_')
ELSE
leader := InitString ('')
END ;
IF IsProcedure (sym) AND IsMonoName (sym)
THEN
RETURN StringToKey (ConCat (leader, InitStringCharStar (KeyToCharStar (GetSymName (sym)))))
ELSE
RETURN StringToKey (ConCat (GetFullScopePrefix (leader, scope, sym),
InitStringCharStar (KeyToCharStar (GetSymName (sym)))))
END
END GetFullScopeAsmName ;
(*
GetFullSymName - returns the NameKey for the symbol name (which also
may contain the module name).
*)
PROCEDURE GetFullSymName (sym: CARDINAL) : Name ;
VAR
module: String ;
scope : CARDINAL ;
BEGIN
IF IsProcedure (sym) AND IsMonoName (sym)
THEN
RETURN GetSymName (sym)
ELSE
scope := GetScope (sym) ;
module := GetModulePrefix (InitString (''), sym, scope) ;
RETURN StringToKey (ConCat (module, InitStringCharStar (KeyToCharStar (GetSymName (sym)))))
END
END GetFullSymName ;
(*
SymNeedsModulePrefix -
*)
PROCEDURE SymNeedsModulePrefix (sym, mod: CARDINAL) : BOOLEAN ;
BEGIN
IF IsDefImp(mod)
THEN
IF WholeProgram
THEN
IF NOT IsDefinitionForC(mod)
THEN
RETURN( TRUE )
END
ELSIF IsExportQualified(sym)
THEN
RETURN( TRUE )
END
ELSIF IsModule(mod)
THEN
RETURN( WholeProgram )
END ;
RETURN( FALSE )
END SymNeedsModulePrefix ;
(*
GetModulePrefix - returns a String containing the module prefix
for module, ModSym, providing symbol, Sym, is exported.
Name is marked if it is appended onto the new string.
*)
PROCEDURE GetModulePrefix (Name: String; Sym, ModSym: CARDINAL) : String ;
BEGIN
IF (ModSym#NulSym) AND (ModSym#GetBaseModule())
THEN
IF IsInnerModule(Sym) OR IsInnerModule(ModSym)
THEN
RETURN( ConCat(ConCatChar(InitStringCharStar(KeyToCharStar(GetSymName(ModSym))), '_'),
GetModulePrefix(Name, ModSym, GetScope(ModSym))) )
ELSIF SymNeedsModulePrefix(Sym, ModSym)
THEN
RETURN( ConCatChar(ConCat(InitStringCharStar(KeyToCharStar(GetSymName(ModSym))), Mark(Name)), '_') )
END
END ;
RETURN( Name )
END GetModulePrefix ;
(*
GetFullScopePrefix - returns a String containing the full scope prefix
for symbol, Sym. It honours IsExportQualified.
Name is marked if it is appended onto the new string.
*)
PROCEDURE GetFullScopePrefix (Name: String; Scope, Sym: CARDINAL) : String ;
BEGIN
IF Sym#NulSym
THEN
IF IsInnerModule(Scope)
THEN
RETURN( ConCat(ConCatChar(InitStringCharStar(KeyToCharStar(GetSymName(Scope))), '_'),
GetFullScopePrefix(Name, GetScope(Scope), Sym)) )
ELSIF IsDefImp(Scope) AND IsExportQualified(Sym)
THEN
RETURN( ConCatChar(ConCat(InitStringCharStar(KeyToCharStar(GetSymName(Scope))), Mark(Name)), '_') )
ELSIF IsProcedure(Scope)
THEN
RETURN( ConCatChar(ConCat(InitStringCharStar(KeyToCharStar(GetSymName(Scope))), Mark(Name)), '_') )
END
END ;
RETURN( Name )
END GetFullScopePrefix ;
END M2AsmUtil.

View file

@ -0,0 +1,415 @@
(* M2Base.def provides a mechanism to check fundamental types.
Copyright (C) 2001-2022 Free Software Foundation, Inc.
Contributed by Gaius Mulley <gaius.mulley@southwales.ac.uk>.
This file is part of GNU Modula-2.
GNU Modula-2 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 3, or (at your option)
any later version.
GNU Modula-2 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 GNU Modula-2; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. *)
DEFINITION MODULE M2Base ;
(*
Author : Gaius Mulley
Title : M2Base
Date : 22/5/87
Description: Implements the default Base Types and Base
procedures in the Modula-2 compiler.
*)
FROM NameKey IMPORT Name ;
FROM m2linemap IMPORT location_t ;
EXPORT QUALIFIED Nil, (* Base constants *)
Cardinal, (* Base types *)
Integer,
Boolean,
True, False,
Char,
Proc,
LongInt, LongCard,
ShortInt, ShortCard,
ZType, RType, CType,
Real,
LongReal, ShortReal,
Complex,
LongComplex,
ShortComplex,
High, IsOrd, (* Base functions *)
LengthS,
Convert,
Re, Im, Cmplx,
Cap, Abs, Odd,
Chr, Val,
IsTrunc, IsFloat,
IsInt,
Min, Max,
New, Dispose, (* Base procedures *)
Inc, Dec,
Incl, Excl,
IsPseudoBaseFunction, (* Manipulation procedures *)
IsPseudoBaseProcedure, (* Manipulation procedures *)
IsBaseType,
GetBaseTypeMinMax,
InitBase,
CannotCheckTypeInPass3,
CheckExpressionCompatible,
CheckAssignmentCompatible,
CheckParameterCompatible,
IsAssignmentCompatible,
IsExpressionCompatible,
IsParameterCompatible,
IsComparisonCompatible,
IsValidParameter,
AssignmentRequiresWarning,
IsMathType,
IsRealType,
IsOrdinalType,
IsComplexType,
GetCmplxReturnType,
ComplexToScalar,
ScalarToComplex,
MixTypes, NegateType,
TemplateProcedure,
ActivationPointer,
IsNeededAtRunTime,
ExceptionAssign,
ExceptionReturn,
ExceptionInc,
ExceptionDec,
ExceptionIncl,
ExceptionExcl,
ExceptionShift,
ExceptionRotate,
ExceptionStaticArray,
ExceptionDynamicArray,
ExceptionForLoopBegin,
ExceptionForLoopTo,
ExceptionForLoopEnd,
ExceptionPointerNil,
ExceptionNoReturn,
ExceptionCase,
ExceptionNonPosDiv,
ExceptionNonPosMod,
ExceptionZeroDiv,
ExceptionZeroRem,
ExceptionWholeValue,
ExceptionRealValue,
ExceptionParameterBounds,
ExceptionNo ;
VAR
TemplateProcedure,
ActivationPointer,
Nil,
Cardinal, Integer,
Boolean, True, False,
Char, Proc,
LongInt, LongCard,
ShortInt, ShortCard,
ZType, RType, CType,
Real,
LongReal, ShortReal,
Complex, LongComplex,
ShortComplex,
Unbounded,
High, LengthS,
Cap, Abs, Odd,
Convert, Val,
Chr,
Re, Im, Cmplx,
Min, Max,
New, Dispose,
Inc, Dec,
Incl, Excl,
ExceptionAssign,
ExceptionReturn,
ExceptionInc,
ExceptionDec,
ExceptionIncl,
ExceptionExcl,
ExceptionShift,
ExceptionRotate,
ExceptionStaticArray,
ExceptionDynamicArray,
ExceptionForLoopBegin,
ExceptionForLoopTo,
ExceptionForLoopEnd,
ExceptionPointerNil,
ExceptionNoReturn,
ExceptionCase,
ExceptionNonPosDiv,
ExceptionNonPosMod,
ExceptionZeroDiv,
ExceptionZeroRem,
ExceptionWholeValue,
ExceptionRealValue,
ExceptionParameterBounds,
ExceptionNo : CARDINAL ;
(*
InitBase - initializes the base types and functions
used in the Modula-2 compiler.
*)
PROCEDURE InitBase (location: location_t; VAR sym: CARDINAL) ;
(*
GetBaseTypeMinMax - returns the minimum and maximum values for a
given base type. This procedure should only
be called if the type is NOT a subrange.
*)
PROCEDURE GetBaseTypeMinMax (type: CARDINAL; VAR min, max: CARDINAL) ;
(*
IsPseudoBaseFunction - returns true if Sym is a Base function.
*)
PROCEDURE IsPseudoBaseFunction (Sym: CARDINAL) : BOOLEAN ;
(*
IsPseudoBaseProcedure - returns true if Sym is a Base procedure.
*)
PROCEDURE IsPseudoBaseProcedure (Sym: CARDINAL) : BOOLEAN ;
(*
IsNeededAtRunTime - returns TRUE if procedure, sym, is a
runtime procedure. Ie a procedure which is
not a pseudo procedure and which is implemented
in M2RTS or SYSTEM and also exported.
*)
PROCEDURE IsNeededAtRunTime (tok: CARDINAL; sym: CARDINAL) : BOOLEAN ;
(*
IsBaseType - returns TRUE if Sym is a Base type.
*)
PROCEDURE IsBaseType (Sym: CARDINAL) : BOOLEAN ;
(*
IsOrdinalType - returns TRUE if, sym, is an ordinal type.
An ordinal type is defined as:
a base type which contains whole numbers or
a subrange type or an enumeration type.
*)
PROCEDURE IsOrdinalType (Sym: CARDINAL) : BOOLEAN ;
(*
IsOrd - returns TRUE if, sym, is ORD or its typed counterparts
ORDL, ORDS.
*)
PROCEDURE IsOrd (sym: CARDINAL) : BOOLEAN ;
(*
IsTrunc - returns TRUE if, sym, is TRUNC or its typed counterparts
TRUNCL, TRUNCS.
*)
PROCEDURE IsTrunc (sym: CARDINAL) : BOOLEAN ;
(*
IsFloat - returns TRUE if, sym, is FLOAT or its typed counterparts
FLOATL, FLOATS.
*)
PROCEDURE IsFloat (sym: CARDINAL) : BOOLEAN ;
(*
IsInt - returns TRUE if, sym, is INT or its typed counterparts
INTL, INTS.
*)
PROCEDURE IsInt (sym: CARDINAL) : BOOLEAN ;
(*
AssignmentRequiresWarning - returns TRUE if t1 and t2 can be used during
an assignment, but should generate a warning.
For example in PIM we can assign ADDRESS
and WORD providing they are both the
same size.
*)
PROCEDURE AssignmentRequiresWarning (t1, t2: CARDINAL) : BOOLEAN ;
(*
IsAssignmentCompatible - returns TRUE if t1 and t2 are assignment
compatible.
*)
PROCEDURE IsAssignmentCompatible (t1, t2: CARDINAL) : BOOLEAN ;
(*
IsExpressionCompatible - returns TRUE if t1 and t2 are expression
compatible.
*)
PROCEDURE IsExpressionCompatible (t1, t2: CARDINAL) : BOOLEAN ;
(*
IsParameterCompatible - returns TRUE if types t1 and t2 are parameter
compatible.
*)
PROCEDURE IsParameterCompatible (t1, t2: CARDINAL) : BOOLEAN ;
(*
IsComparisonCompatible - returns TRUE if t1 and t2 are comparison
compatible. PIM allows INTEGER and ADDRESS within
expressions but we warn against their comparison.
*)
PROCEDURE IsComparisonCompatible (t1, t2: CARDINAL) : BOOLEAN ;
(*
IsValidParameter - returns TRUE if an, actual, parameter can be passed
to the, formal, parameter. This differs from
IsParameterCompatible as this procedure includes checks
for unbounded formal parameters, var parameters and
constant actual parameters.
*)
PROCEDURE IsValidParameter (formal, actual: CARDINAL) : BOOLEAN ;
(*
CheckExpressionCompatible - returns if t1 and t2 are compatible types for
+, -, *, DIV, >, <, =, etc.
If t1 and t2 are not compatible then an error
message is displayed.
*)
PROCEDURE CheckExpressionCompatible (tok: CARDINAL;
left, right: CARDINAL) ;
(*
CheckAssignmentCompatible - returns if t1 and t2 are compatible types for
:=, =, #.
If t1 and t2 are not compatible then an error
message is displayed.
*)
PROCEDURE CheckAssignmentCompatible (tok: CARDINAL;
left, right: CARDINAL) ;
(*
CheckParameterCompatible - checks to see if types, t1, and, t2, are
compatible for parameter passing.
*)
PROCEDURE CheckParameterCompatible (tok: CARDINAL;
t1, t2: CARDINAL) ;
(*
CannotCheckTypeInPass3 - returns TRUE if we are unable to check the
type of, e, in pass 3.
*)
PROCEDURE CannotCheckTypeInPass3 (e: CARDINAL) : BOOLEAN ;
(*
MixTypes - returns the type symbol that corresponds to the types t1 and t2.
NearTok is used to identify the source position if a type
incompatability occurs.
*)
PROCEDURE MixTypes (t1, t2: CARDINAL; NearTok: CARDINAL) : CARDINAL ;
(*
NegateType - if the type is unsigned then returns the
signed equivalent.
*)
PROCEDURE NegateType (type: CARDINAL (* ; sympos: CARDINAL *) ) : CARDINAL ;
(*
IsMathType - returns TRUE if the type is a mathematical type.
A mathematical type has a range larger than INTEGER.
(Typically REAL/LONGREAL/LONGINT)
*)
PROCEDURE IsMathType (type: CARDINAL) : BOOLEAN ;
(*
IsRealType - returns TRUE if, t, is a real type.
*)
PROCEDURE IsRealType (t: CARDINAL) : BOOLEAN ;
(*
IsComplexType - returns TRUE if, sym, is COMPLEX,
LONGCOMPLEX or SHORTCOMPLEX.
*)
PROCEDURE IsComplexType (sym: CARDINAL) : BOOLEAN ;
(*
ComplexToScalar - returns the scalar (or base type) of the complex type, sym.
*)
PROCEDURE ComplexToScalar (sym: CARDINAL) : CARDINAL ;
(*
ScalarToComplex - given a real type, t, return the equivalent complex type.
*)
PROCEDURE ScalarToComplex (sym: CARDINAL) : CARDINAL ;
(*
GetCmplxReturnType - this code implements the table given in the
ISO standard Page 293 with an addition for
SHORTCOMPLEX and the fixed sized COMPLEX
types found in the GNU Modula-2 SYSTEM
Module.
*)
PROCEDURE GetCmplxReturnType (t1, t2: CARDINAL) : CARDINAL ;
END M2Base.

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,87 @@
(* M2BasicBlock.def converts a scope block into a list of basic blocks.
Copyright (C) 2001-2022 Free Software Foundation, Inc.
Contributed by Gaius Mulley <gaius.mulley@southwales.ac.uk>.
This file is part of GNU Modula-2.
GNU Modula-2 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 3, or (at your option)
any later version.
GNU Modula-2 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 GNU Modula-2; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. *)
DEFINITION MODULE M2BasicBlock ;
(*
Title : M2BasicBlock
Author : Gaius Mulley
Date : 20/8/2003
System : GNU Modula-2
Description: Converts a scope block into a list of basic blocks.
The basic blocks are either converted back into quadruples
or alternatively translated into GCC trees.
*)
FROM M2Scope IMPORT ScopeBlock ;
EXPORT QUALIFIED BasicBlock, BasicBlockProc,
InitBasicBlocks, InitBasicBlocksFromRange,
KillBasicBlocks, FreeBasicBlocks,
ForeachBasicBlockDo ;
TYPE
BasicBlock ;
BasicBlockProc = PROCEDURE (CARDINAL, CARDINAL) ;
(*
InitBasicBlocks - converts a list of quadruples as defined by
scope blocks into a set of basic blocks.
All quadruples within this list which are not
reachable are removed.
*)
PROCEDURE InitBasicBlocks (sb: ScopeBlock) : BasicBlock ;
(*
InitBasicBlocksFromRange - converts a list of quadruples as defined by
start..end.
All quadruples within this list which are not
reachable are removed.
*)
PROCEDURE InitBasicBlocksFromRange (start, end: CARDINAL) : BasicBlock ;
(*
KillBasicBlocks - destroys the list of Basic Blocks and assigns bb to NIL.
*)
PROCEDURE KillBasicBlocks (VAR bb: BasicBlock) ;
(*
FreeBasicBlocks - destroys the list of Basic Blocks.
*)
PROCEDURE FreeBasicBlocks (bb: BasicBlock) ;
(*
ForeachBasicBlockDo - for each basic block call procedure, p.
*)
PROCEDURE ForeachBasicBlockDo (bb: BasicBlock; p: BasicBlockProc) ;
END M2BasicBlock.

View file

@ -0,0 +1,355 @@
(* M2BasicBlock.mod converts a scope block into a list of basic blocks.
Copyright (C) 2001-2022 Free Software Foundation, Inc.
Contributed by Gaius Mulley <gaius.mulley@southwales.ac.uk>.
This file is part of GNU Modula-2.
GNU Modula-2 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 3, or (at your option)
any later version.
GNU Modula-2 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 GNU Modula-2; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. *)
IMPLEMENTATION MODULE M2BasicBlock ;
FROM Storage IMPORT ALLOCATE, DEALLOCATE ;
FROM StrIO IMPORT WriteString, WriteLn ;
FROM NumberIO IMPORT WriteCard ;
FROM M2Debug IMPORT Assert ;
FROM M2Options IMPORT OptimizeBasicBlock ;
FROM M2Quads IMPORT IsReferenced, IsConditional, IsUnConditional, IsCall,
IsReturn, IsNewLocalVar, IsKillLocalVar,
IsCatchBegin, IsCatchEnd,
IsInitStart, IsInitEnd, IsFinallyStart, IsFinallyEnd,
IsInitialisingConst,
IsPseudoQuad, IsDefOrModFile,
GetNextQuad, GetQuad, QuadOperator,
SubQuad ;
FROM M2Scope IMPORT ScopeBlock, ForeachScopeBlockDo ;
FROM M2GenGCC IMPORT ConvertQuadsToTree ;
TYPE
BasicBlock = POINTER TO RECORD
StartQuad : CARDINAL ; (* First Quad in Basic Block *)
EndQuad : CARDINAL ; (* End Quad in Basic Block *)
Right : BasicBlock ;
(* Last Basic Block in list *)
Left : BasicBlock ;
END ;
VAR
FreeList : BasicBlock ; (* Free list of Basic Blocks *)
HeadOfBasicBlock: BasicBlock ;
(*
InitBasicBlocks - converts a list of quadruples as defined by
scope blocks into a set of basic blocks.
All quadruples within this list which are not
reachable are removed.
*)
PROCEDURE InitBasicBlocks (sb: ScopeBlock) : BasicBlock ;
BEGIN
HeadOfBasicBlock := NIL ;
ForeachScopeBlockDo (sb, ConvertQuads2BasicBlock) ;
RETURN HeadOfBasicBlock
END InitBasicBlocks ;
(*
InitBasicBlocksFromRange - converts a list of quadruples as defined by
start..end.
All quadruples within this list which are not
reachable are removed.
*)
PROCEDURE InitBasicBlocksFromRange (start, end: CARDINAL) : BasicBlock ;
BEGIN
HeadOfBasicBlock := NIL ;
ConvertQuads2BasicBlock(start, end) ;
RETURN( HeadOfBasicBlock )
END InitBasicBlocksFromRange ;
(*
KillBasicBlocks - destroys the list of Basic Blocks.
*)
PROCEDURE KillBasicBlocks (VAR bb: BasicBlock) ;
BEGIN
FreeBasicBlocks (bb) ;
bb := NIL
END KillBasicBlocks ;
(*
FreeBasicBlocks - destroys the list of Basic Blocks.
*)
PROCEDURE FreeBasicBlocks (bb: BasicBlock) ;
VAR
b, c: BasicBlock ;
BEGIN
IF bb#NIL
THEN
b := bb ;
REPEAT
c := bb^.Right ;
bb^.Right := FreeList ;
FreeList := bb ;
bb := c
UNTIL bb=b
END
END FreeBasicBlocks ;
(*
New - returns a basic block.
*)
PROCEDURE New () : BasicBlock ;
VAR
b: BasicBlock ;
BEGIN
IF FreeList=NIL
THEN
NEW(b)
ELSE
b := FreeList ;
FreeList := FreeList^.Right
END ;
Assert(b#NIL) ;
RETURN( b )
END New ;
(*
ConvertQuads2BasicBlock - converts a list of quadruples to a list of
Basic Blocks.
A Basic Block is defined as a list of quadruples
which has only has one entry and exit point.
*)
PROCEDURE ConvertQuads2BasicBlock (Start, End: CARDINAL) ;
VAR
LastQuadDefMod,
LastQuadConditional,
LastQuadCall,
LastQuadReturn : BOOLEAN ;
Quad : CARDINAL ;
CurrentBB : BasicBlock ;
LastBB : BasicBlock ;
BEGIN
(*
Algorithm to perform Basic Block:
For every quadruple establish a set of leaders.
A Leader is defined as a quadruple which is
either:
(i) The first quadruple.
(ii) Any quadruple which is the target of a jump or unconditional jump.
(iii) Any statement which follows a conditional jump
For each leader construct a basic block.
A Basic Block starts with a leader quadruple and ends with either:
(i) Another Leader
(ii) An unconditional Jump.
Any quadruples that do not fall into a Basic Block can be thrown away
since they will never be executed.
*)
LastBB := NIL ;
CurrentBB := NIL ;
Quad := Start ;
LastQuadConditional := TRUE ; (* Force Rule (i) *)
LastQuadCall := FALSE ;
LastQuadReturn := FALSE ;
LastQuadDefMod := FALSE ;
(* Scan all quadruples *)
WHILE (Quad<=End) AND (Quad#0) DO
IF LastQuadConditional OR LastQuadCall OR LastQuadReturn OR
LastQuadDefMod OR IsReferenced(Quad)
THEN
(* Rule (ii) *)
CurrentBB := New() ; (* Get a new Basic Block *)
(* At least one quad in this Basic Block *)
StartBB(CurrentBB, Quad) ;
EndBB(CurrentBB, Quad)
ELSIF CurrentBB#NIL
THEN
(* We have a Basic Block - therefore add quad to this Block *)
EndBB(CurrentBB, Quad)
ELSIF IsPseudoQuad(Quad)
THEN
(* Add Quad to the Last BB since Pseudo Quads - compiler directives *)
(* must not be thrown away. *)
EndBB(LastBB, Quad)
ELSIF IsReturn(Quad) OR IsKillLocalVar(Quad) OR
IsCatchEnd(Quad) OR IsCatchBegin(Quad) OR
IsInitStart(Quad) OR IsInitEnd(Quad) OR
IsFinallyStart(Quad) OR IsFinallyEnd(Quad)
THEN
(* we must leave these quads alone *)
EndBB(LastBB, Quad)
ELSIF IsInitialisingConst(Quad)
THEN
(* we must leave these quads alone *)
EndBB(LastBB, Quad)
ELSE
(* remove this Quad since it will never be reached *)
SubQuad(Quad)
END ;
LastQuadConditional := IsConditional(Quad) ;
LastQuadCall := IsCall(Quad) ;
LastQuadReturn := IsReturn(Quad) ;
LastQuadDefMod := IsDefOrModFile(Quad) ;
IF IsUnConditional(Quad)
THEN
LastBB := CurrentBB ;
CurrentBB := NIL
END ;
Quad := GetNextQuad(Quad)
END
END ConvertQuads2BasicBlock ;
(*
ForeachBasicBlockDo - for each basic block call procedure, p.
*)
PROCEDURE ForeachBasicBlockDo (bb: BasicBlock; p: BasicBlockProc) ;
VAR
b: BasicBlock ;
BEGIN
IF bb#NIL
THEN
b := bb ;
REPEAT
WITH b^ DO
p(StartQuad, EndQuad)
END ;
b := b^.Right
UNTIL b=bb
END
END ForeachBasicBlockDo ;
(*
StartBB - Initially fills a Basic Block, b, with a start quad Quad.
The Basic Block is then added to the end of Basic Block list.
*)
PROCEDURE StartBB (b: BasicBlock; Quad: CARDINAL) ;
BEGIN
WITH b^ DO
StartQuad := Quad ;
EndQuad := Quad
END ;
Add(HeadOfBasicBlock, b) (* Add b to the end of the Basic Block list *)
END StartBB ;
(*
EndBB - Fills a Basic Block, b, with an end quad Quad.
*)
PROCEDURE EndBB (b: BasicBlock; Quad: CARDINAL) ;
BEGIN
b^.EndQuad := Quad
END EndBB ;
(*
Add adds a specified element to the end of a queue.
*)
PROCEDURE Add (VAR Head: BasicBlock;
b : BasicBlock) ;
BEGIN
IF Head=NIL
THEN
Head := b ;
b^.Left := b ;
b^.Right := b
ELSE
b^.Right := Head ;
b^.Left := Head^.Left ;
Head^.Left^.Right := b ;
Head^.Left := b
END
END Add ;
(*
Sub deletes an element from the specified queue.
*)
(*
PROCEDURE Sub (VAR Head: BasicBlock;
b: BasicBlock) ;
BEGIN
IF (b^.Right=Head) AND (b=Head)
THEN
Head := NIL
ELSE
IF Head=b
THEN
Head := Head^.Right
END ;
b^.Left^.Right := b^.Right ;
b^.Right^.Left := b^.Left
END
END Sub ;
*)
(*
DisplayBasicBlocks - displays the basic block data structure.
*)
(*
PROCEDURE DisplayBasicBlocks (bb: BasicBlock) ;
VAR
b: BasicBlock ;
BEGIN
b := bb ;
WriteString('quadruples') ; WriteLn ;
IF b#NIL
THEN
REPEAT
DisplayBlock(b) ;
b := b^.Right
UNTIL b=bb
END
END DisplayBasicBlocks ;
PROCEDURE DisplayBlock (b: BasicBlock) ;
BEGIN
WITH b^ DO
WriteString(' start ') ; WriteCard(StartQuad, 6) ;
WriteString(' end ') ; WriteCard(EndQuad, 6) ;
END
END DisplayBlock ;
*)
BEGIN
FreeList := NIL
END M2BasicBlock.

View file

@ -0,0 +1,194 @@
(* M2Batch.def implements a queue for modules pending compilation.
Copyright (C) 2001-2022 Free Software Foundation, Inc.
Contributed by Gaius Mulley <gaius.mulley@southwales.ac.uk>.
This file is part of GNU Modula-2.
GNU Modula-2 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 3, or (at your option)
any later version.
GNU Modula-2 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 GNU Modula-2; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. *)
DEFINITION MODULE M2Batch ;
(*
Author : Gaius Mulley
Title : M2Batch
Date : 29/5/87
Description: Implements a queue modules pending compilation.
MakeSource enters modules for later compilation.
GetSource collects the next module to be compiled.
*)
FROM DynamicStrings IMPORT String ;
FROM NameKey IMPORT Name ;
EXPORT QUALIFIED MakeDefinitionSource,
MakeImplementationSource,
MakeProgramSource,
GetSource, GetModuleNo, IsModuleKnown,
AssociateDefinition, GetDefinitionModuleFile,
AssociateModule, GetModuleFile, Get,
ForeachSourceModuleDo, IsSourceSeen, IsModuleSeen,
LookupModule, LookupOuterModule, DisplayModules ;
TYPE
DoProcedure = PROCEDURE (CARDINAL) ;
(*
MakeDefinitionSource - is given a Name, n, which is used to create a Definition
module.
The Definition Module will be placed onto the
compilation pending queue if it has not yet been
compiled.
If the module has been compiled then no action is
taken. The Module Sym is returned.
*)
PROCEDURE MakeDefinitionSource (tok: CARDINAL; n: Name) : CARDINAL ;
(*
MakeImplementationSource - is given a Name, n, which is used to create an
implementation module.
The implementation Module will be placed onto
the compilation pending
queue if it has not yet been compiled.
If the module has been compiled then no
action is taken. The Module Sym is returned.
*)
PROCEDURE MakeImplementationSource (tok: CARDINAL; n: Name) : CARDINAL ;
(*
MakeProgramSource - is given a Name, n, which is used to create a program module.
The program module will be placed onto the compilation
pending queue if it has not yet been compiled.
If the module has been compiled then no action is taken.
The Module Sym is returned.
*)
PROCEDURE MakeProgramSource (tok: CARDINAL; n: Name) : CARDINAL ;
(*
GetSource - returns with the symbol Sym of the next module to be compiled.
If Sym returns with value NulSym then no module should be
compiled.
*)
PROCEDURE GetSource () : CARDINAL ;
(*
GetModuleNo - returns with symbol number of the module which was
the nth module to be read in Pass 1.
The modules are numbered from 1..n
*)
PROCEDURE GetModuleNo (nth: CARDINAL) : CARDINAL ;
(*
IsModuleKnown - returns TRUE if the Name, n, matches a module.
*)
PROCEDURE IsModuleKnown (n: Name) : BOOLEAN ;
(*
AssociateDefinition - associate the source file, filename, with the definition module,
Sym.
*)
PROCEDURE AssociateDefinition (filename: String; Sym: CARDINAL) : String ;
(*
GetDefinitionModuleFile - returns the filename associated with the definition module, Sym.
It may return a temporary preprocessed file.
*)
PROCEDURE GetDefinitionModuleFile (Sym: CARDINAL) : String ;
(*
AssociateModule - associate the source file, filename, with the implementation/program
module, Sym.
*)
PROCEDURE AssociateModule (filename: String; Sym: CARDINAL) : String ;
(*
GetModuleFile - returns the filename associated with the implementation/program module, Sym.
It may return a temporary preprocessed file.
*)
PROCEDURE GetModuleFile (Sym: CARDINAL) : String ;
(*
ForeachSourceModuleDo - call each procedure, p, for which there is a known
source file.
*)
PROCEDURE ForeachSourceModuleDo (p: DoProcedure) ;
(*
IsSourceSeen - returns TRUE if the source for module, sym, has been seen.
*)
PROCEDURE IsSourceSeen (sym: CARDINAL) : BOOLEAN ;
(*
IsModuleSeen - returns TRUE if the source for module, name, has been seen.
*)
PROCEDURE IsModuleSeen (n: Name) : BOOLEAN ;
(*
LookupModule - looks up a module in the current scope, if a module does not exist
then it creates a DefImp module.
*)
PROCEDURE LookupModule (tok: CARDINAL; n: Name) : CARDINAL ;
(*
LookupOuterModule - looks up a module in the order of: current scope, then outer scope, finally if a
module does not exist then it creates a DefImp module.
*)
PROCEDURE LookupOuterModule (tok: CARDINAL; n: Name) : CARDINAL ;
(*
Get - returns the module symbol matching name, n.
*)
PROCEDURE Get (n: Name) : CARDINAL ;
(*
DisplayModules - a debugging routine to textually emit the names of modules in the DoneQ.
*)
PROCEDURE DisplayModules ;
END M2Batch.

View file

@ -0,0 +1,470 @@
(* M2Batch.mod implements a queue for modules pending compilation.
Copyright (C) 2001-2022 Free Software Foundation, Inc.
Contributed by Gaius Mulley <gaius.mulley@southwales.ac.uk>.
This file is part of GNU Modula-2.
GNU Modula-2 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 3, or (at your option)
any later version.
GNU Modula-2 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 GNU Modula-2; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. *)
IMPLEMENTATION MODULE M2Batch ;
FROM M2Debug IMPORT Assert ;
FROM SymbolTable IMPORT MakeModule, MakeDefImp, IsModule, IsDefImp, GetScope, GetLocalSym, GetCurrentScope, GetSym, NulSym ;
FROM NameKey IMPORT GetKey, WriteKey ;
FROM M2Printf IMPORT printf2 ;
FROM M2Error IMPORT InternalError ;
FROM M2MetaError IMPORT MetaError1 ;
FROM Indexing IMPORT Index, InitIndex, GetIndice, HighIndice, RemoveIndiceFromIndex, IncludeIndiceIntoIndex, InBounds ;
FROM Lists IMPORT List, InitList, IncludeItemIntoList, RemoveItemFromList,
GetItemFromList, NoOfItemsInList ;
FROM Storage IMPORT ALLOCATE ;
FROM DynamicStrings IMPORT String ;
FROM M2Pass IMPORT IsPass1, IsPass2, IsPass3, IsPassC ;
TYPE
Module = POINTER TO RECORD
SymNo : CARDINAL ;
Key : Name ;
DefFile,
ModFile: String ;
END ;
VAR
SeenList : Index ;
PendingQueue: List ;
(*
MakeProgramSource - is given a Name, n, which is used to create a program module.
The program module will be placed onto the compilation
pending queue if it has not yet been compiled.
If the module has been compiled then no action is taken.
The Module Sym is returned.
*)
PROCEDURE MakeProgramSource (tok: CARDINAL; n: Name) : CARDINAL ;
VAR
Sym: CARDINAL ;
BEGIN
Sym := Get (n) ;
IF Sym = NulSym
THEN
Assert ((NOT IsPass1 ()) AND (NOT IsPass2 ()) AND (NOT IsPass3 ()) AND (NOT IsPassC ())) ;
(* Neither been compiled or on the Pending Queue *)
Sym := MakeModule (tok, n) ;
Put (Sym, n) ;
Push (Sym)
END ;
RETURN Sym
END MakeProgramSource ;
(*
MakeDefinitionSource - is given a Name, n, which is used to create a Definition
module.
The Definition Module will be placed onto the
compilation pending queue if it has not yet been
compiled.
If the module has been compiled then no action is
taken. The Module Sym is returned.
*)
PROCEDURE MakeDefinitionSource (tok: CARDINAL; n: Name) : CARDINAL ;
VAR
Sym: CARDINAL ;
BEGIN
Sym := Get (n) ;
IF Sym = NulSym
THEN
Assert ((NOT IsPass1 ()) AND (NOT IsPass2 ()) AND (NOT IsPass3 ()) AND (NOT IsPassC ())) ;
(* Neither been compiled or on the Pending Queue *)
Sym := MakeDefImp (tok, n) ;
Put (Sym, n) ;
Push (Sym)
END ;
RETURN Sym
END MakeDefinitionSource ;
(*
MakeImplementationSource - is given a Name, n, which is used to create an
implementation module.
The implementation Module will be placed onto
the compilation pending
queue if it has not yet been compiled.
If the module has been compiled then no
action is taken. The Module Sym is returned.
*)
PROCEDURE MakeImplementationSource (tok: CARDINAL; n: Name) : CARDINAL ;
VAR
Sym: CARDINAL ;
BEGIN
Sym := Get (n) ;
IF Sym = NulSym
THEN
Assert ((NOT IsPass1 ()) AND (NOT IsPass2 ()) AND (NOT IsPass3 ()) AND (NOT IsPassC ())) ;
(* Neither been compiled or on the Pending Queue *)
Sym := MakeDefImp (tok, n) ;
Put (Sym, n) ;
Push (Sym)
END ;
RETURN Sym
END MakeImplementationSource ;
(*
GetSource - returns with the symbol Sym of the next module to be compiled.
If Sym returns with value 0 then no module should be compiled.
*)
PROCEDURE GetSource () : CARDINAL ;
BEGIN
RETURN Pop ()
END GetSource ;
(*
GetModuleNo - returns with symbol number of the nth module read during Pass 1.
*)
PROCEDURE GetModuleNo (nth: CARDINAL) : CARDINAL ;
VAR
m: Module ;
BEGIN
Assert (nth#0) ;
IF InBounds (SeenList, nth)
THEN
m := GetIndice (SeenList, nth) ;
RETURN m^.SymNo
ELSE
RETURN NulSym
END
END GetModuleNo ;
(*
IsModuleKnown - returns TRUE if the Name n matches a module.
*)
PROCEDURE IsModuleKnown (n: Name) : BOOLEAN ;
BEGIN
RETURN Get (n) # NulSym
END IsModuleKnown ;
(*
Get - returns the module symbol matching name n.
*)
PROCEDURE Get (n: Name) : CARDINAL ;
VAR
i, no: CARDINAL ;
m : Module ;
BEGIN
i := 1 ;
no := HighIndice (SeenList) ;
WHILE i <= no DO
m := GetIndice (SeenList, i) ;
WITH m^ DO
IF Key = n
THEN
RETURN SymNo
ELSE
INC (i)
END
END
END ;
RETURN NulSym
END Get ;
PROCEDURE Put (Sym: CARDINAL; n: Name) ;
VAR
m: Module ;
BEGIN
NEW (m) ;
IncludeIndiceIntoIndex (SeenList, m) ;
WITH m^ DO
SymNo := Sym ;
Key := n ;
DefFile := NIL ;
ModFile := NIL
END
END Put ;
PROCEDURE Push (Sym: CARDINAL) ;
BEGIN
IncludeItemIntoList (PendingQueue, Sym)
END Push ;
PROCEDURE Pop () : CARDINAL ;
VAR
n : CARDINAL ;
Sym: CARDINAL ;
BEGIN
n := NoOfItemsInList (PendingQueue) ;
IF n = 0
THEN
RETURN NulSym
ELSE
Sym := GetItemFromList (PendingQueue, n) ;
RemoveItemFromList (PendingQueue, Sym) ;
RETURN Sym
END
END Pop ;
(*
DisplayModules - a debugging routine to textually emit the names of modules in the SeenList.
*)
PROCEDURE DisplayModules ;
VAR
m : Module ;
n, i: CARDINAL ;
BEGIN
i := 1 ;
n := HighIndice (SeenList) ;
WHILE i<=n DO
m := GetIndice (SeenList, i) ;
WITH m^ DO
printf2 ('Module %a %d\n', Key, i)
END ;
INC (i)
END
END DisplayModules ;
(*
AssociateDefinition - associate the source file, filename, with the definition module,
Sym.
*)
PROCEDURE AssociateDefinition (filename: String; Sym: CARDINAL) : String ;
VAR
no, i: CARDINAL ;
m : Module ;
BEGIN
i := 1 ;
no := HighIndice (SeenList) ;
WHILE i <= no DO
m := GetIndice (SeenList, i) ;
WITH m^ DO
IF SymNo = Sym
THEN
DefFile := filename ;
RETURN filename
ELSE
INC (i)
END
END
END ;
InternalError ('failed to find module sym')
END AssociateDefinition ;
(*
GetDefinitionModuleFile - returns the filename associated with the definition module, Sym.
It may return a temporary preprocessed file.
*)
PROCEDURE GetDefinitionModuleFile (Sym: CARDINAL) : String ;
VAR
no, i: CARDINAL ;
m : Module ;
BEGIN
i := 1 ;
no := HighIndice (SeenList) ;
WHILE i <= no DO
m := GetIndice (SeenList, i) ;
WITH m^ DO
IF SymNo = Sym
THEN
RETURN DefFile
ELSE
INC (i)
END
END
END ;
RETURN NIL
END GetDefinitionModuleFile ;
(*
AssociateModule - associate the source file, filename, with the implementation/program
module, Sym.
*)
PROCEDURE AssociateModule (filename: String; Sym: CARDINAL) : String ;
VAR
no, i: CARDINAL ;
m : Module ;
BEGIN
i := 1 ;
no := HighIndice (SeenList) ;
WHILE i<=no DO
m := GetIndice (SeenList, i) ;
WITH m^ DO
IF SymNo = Sym
THEN
ModFile := filename ;
RETURN filename
ELSE
INC (i)
END
END
END ;
InternalError ('failed to find module sym')
END AssociateModule ;
(*
GetModuleFile - returns the filename associated with the implementation/program module, Sym.
It may return a temporary preprocessed file.
*)
PROCEDURE GetModuleFile (Sym: CARDINAL) : String ;
VAR
no, i: CARDINAL ;
m : Module ;
BEGIN
i := 1 ;
no := HighIndice (SeenList) ;
WHILE i <= no DO
m := GetIndice (SeenList, i) ;
WITH m^ DO
IF SymNo = Sym
THEN
RETURN ModFile
ELSE
INC (i)
END
END
END ;
RETURN NIL
END GetModuleFile ;
(*
ForeachSourceModuleDo - for each source file call procedure, p.
*)
PROCEDURE ForeachSourceModuleDo (p: DoProcedure) ;
VAR
i, no: CARDINAL ;
m : Module ;
BEGIN
i := 1 ;
no := HighIndice (SeenList) ;
WHILE i<=no DO
m := GetIndice (SeenList, i) ;
WITH m^ DO
IF ModFile # NIL
THEN
p (SymNo)
END
END ;
INC (i)
END
END ForeachSourceModuleDo ;
(*
IsSourceSeen - returns TRUE if the source for the program module or
implementation module has been seen.
*)
PROCEDURE IsSourceSeen (sym: CARDINAL) : BOOLEAN ;
BEGIN
Assert (IsModule (sym) OR IsDefImp (sym)) ;
RETURN GetModuleFile (sym) # NIL
END IsSourceSeen ;
(*
IsModuleSeen - returns TRUE if the source for module, name, has been seen.
*)
PROCEDURE IsModuleSeen (n: Name) : BOOLEAN ;
BEGIN
RETURN Get (n) # NulSym
END IsModuleSeen ;
(*
LookupModule - looks up a module in the current scope, if a module does not exist
then it creates a DefImp module.
*)
PROCEDURE LookupModule (tok: CARDINAL; n: Name) : CARDINAL ;
VAR
sym: CARDINAL ;
BEGIN
sym := GetSym (n) ;
IF sym = NulSym
THEN
RETURN MakeDefinitionSource (tok, n)
ELSIF IsModule (sym) OR IsDefImp (sym)
THEN
RETURN sym
ELSE
RETURN MakeDefinitionSource (tok, n)
END
END LookupModule ;
(*
LookupOuterModule - looks up a module in the order of: current scope, then outer scope, finally if a
module does not exist then it creates a DefImp module.
*)
PROCEDURE LookupOuterModule (tok: CARDINAL; n: Name) : CARDINAL ;
VAR
outer: CARDINAL ;
sym : CARDINAL ;
BEGIN
sym := GetSym (n) ;
IF sym = NulSym
THEN
outer := GetScope (GetCurrentScope ()) ;
IF outer # NulSym
THEN
sym := GetLocalSym (outer, n)
END ;
IF sym = NulSym
THEN
(* not a local module, so it must be refering to a definition module. *)
sym := MakeDefinitionSource (tok, n)
END
END ;
IF IsModule (sym) OR IsDefImp (sym)
THEN
RETURN sym
ELSE
RETURN MakeDefinitionSource (tok, n)
END
END LookupOuterModule ;
BEGIN
InitList (PendingQueue) ;
SeenList := InitIndex (1)
END M2Batch.

View file

@ -0,0 +1,54 @@
(* M2Bitset.def provides the BITSET type.
Copyright (C) 2003-2022 Free Software Foundation, Inc.
Contributed by Gaius Mulley <gaius.mulley@southwales.ac.uk>.
This file is part of GNU Modula-2.
GNU Modula-2 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 3, or (at your option)
any later version.
GNU Modula-2 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 GNU Modula-2; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. *)
DEFINITION MODULE M2Bitset ;
(*
Title : M2Bitset
Author : Gaius Mulley
System : GNU Modula-2
Date : Wed May 7 21:21:31 2003
Revision : $Version$
Description: provides the BITSET type.
*)
EXPORT QUALIFIED MakeBitset, GetBitsetMinMax, Bitset, Bitnum ;
VAR
Bitset, Bitnum: CARDINAL ;
(*
MakeBitset - creates and declares the type BITSET.
*)
PROCEDURE MakeBitset ;
(*
GetBitsetMinMax - assigns min and max to the minimum and maximum values of BITSET.
*)
PROCEDURE GetBitsetMinMax (VAR min, max: CARDINAL) ;
END M2Bitset.

View file

@ -0,0 +1,89 @@
(* M2Bitset.mod provides the BITSET type.
Copyright (C) 2003-2022 Free Software Foundation, Inc.
Contributed by Gaius Mulley <gaius.mulley@southwales.ac.uk>.
This file is part of GNU Modula-2.
GNU Modula-2 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 3, or (at your option)
any later version.
GNU Modula-2 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 GNU Modula-2; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. *)
IMPLEMENTATION MODULE M2Bitset ;
FROM M2Debug IMPORT Assert ;
FROM m2tree IMPORT Tree ;
FROM m2linemap IMPORT BuiltinsLocation ;
FROM m2type IMPORT GetWordType ;
FROM m2decl IMPORT GetBitsPerBitset ;
FROM m2expr IMPORT GetSizeOf ;
FROM M2ALU IMPORT PushCard, PushIntegerTree ;
FROM NameKey IMPORT MakeKey ;
FROM M2System IMPORT Word ;
FROM M2Base IMPORT Cardinal ;
FROM M2LexBuf IMPORT BuiltinTokenNo ;
FROM SymbolTable IMPORT NulSym,
MakeConstLit,
MakeConstVar,
MakeSet,
MakeSubrange,
PutSet,
PutSubrange,
PopValue,
PopSize ;
VAR
MinBitset, MaxBitset : CARDINAL ;
(*
MakeBitset - creates and declares the type BITSET.
*)
PROCEDURE MakeBitset ;
BEGIN
Bitset := MakeSet (BuiltinTokenNo, MakeKey('BITSET')) ; (* Base Type *)
(* MinBitset *)
MinBitset := MakeConstLit (BuiltinTokenNo, MakeKey('0'), Cardinal) ;
(* MaxBitset *)
MaxBitset := MakeConstVar (BuiltinTokenNo, MakeKey('MaxBitset')) ;
PushCard (GetBitsPerBitset()-1) ;
PopValue (MaxBitset) ;
Assert (Word#NulSym) ;
Bitnum := MakeSubrange (BuiltinTokenNo, MakeKey('BITNUM')) ;
PutSubrange (Bitnum, MinBitset, MaxBitset, Cardinal) ;
PutSet (Bitset, Bitnum, FALSE) ;
PushIntegerTree (GetSizeOf(BuiltinsLocation(), GetWordType())) ;
PopSize (Bitset)
END MakeBitset ;
(*
GetBitsetMinMax - assigns min and max to the minimum and maximum values of BITSET.
*)
PROCEDURE GetBitsetMinMax (VAR min, max: CARDINAL) ;
BEGIN
min := MinBitset ;
max := MaxBitset
END GetBitsetMinMax ;
END M2Bitset.

View file

@ -0,0 +1,123 @@
(* M2CaseList.def implement ISO case label lists.
Copyright (C) 2009-2022 Free Software Foundation, Inc.
Contributed by Gaius Mulley <gaius.mulley@southwales.ac.uk>.
This file is part of GNU Modula-2.
GNU Modula-2 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 3, or (at your option)
any later version.
GNU Modula-2 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 GNU Modula-2; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. *)
DEFINITION MODULE M2CaseList ;
(*
Title : M2CaseList
Author : Gaius Mulley
System : GNU Modula-2
Date : Fri Jul 24 09:53:48 2009
Revision : $Version$
Description:
*)
FROM DynamicStrings IMPORT String ;
FROM Lists IMPORT List ;
(*
PushCase - create a case entity and push it to an internal stack.
Return the case id.
*)
PROCEDURE PushCase (r: CARDINAL; v: CARDINAL) : CARDINAL ;
(*
PopCase - pop the top element of the case entity from the internal
stack.
*)
PROCEDURE PopCase ;
(*
ElseCase - indicates that this case varient does have an else clause.
*)
PROCEDURE ElseCase (f: CARDINAL) ;
(*
BeginCaseList - create a new label list.
*)
PROCEDURE BeginCaseList (v: CARDINAL) ;
(*
EndCaseList - terminate the current label list.
*)
PROCEDURE EndCaseList ;
(*
AddRange - add a range to the current label list.
*)
PROCEDURE AddRange (r1, r2: CARDINAL; tok: CARDINAL) ;
(*
CaseBoundsResolved - returns TRUE if all constants in the case list, c,
are known to GCC.
*)
PROCEDURE CaseBoundsResolved (tokenno: CARDINAL; c: CARDINAL) : BOOLEAN ;
(*
TypeCaseBounds - returns TRUE if all bounds in case list, c, are
compatible with the tagged type.
*)
PROCEDURE TypeCaseBounds (c: CARDINAL) : BOOLEAN ;
(*
OverlappingCaseBounds - returns TRUE if there were any overlapping bounds
in the case list, c. It will generate an error
messages for each overlapping bound found.
*)
PROCEDURE OverlappingCaseBounds (c: CARDINAL) : BOOLEAN ;
(*
MissingCaseBounds - returns TRUE if there were any missing bounds
in the varient record case list, c. It will
generate an error message for each missing
bounds found.
*)
PROCEDURE MissingCaseBounds (tokenno: CARDINAL; c: CARDINAL) : BOOLEAN ;
(*
WriteCase - displays the case list.
*)
PROCEDURE WriteCase (c: CARDINAL) ;
END M2CaseList.

View file

@ -0,0 +1,933 @@
(* M2CaseList.mod implement ISO case label lists.
Copyright (C) 2009-2022 Free Software Foundation, Inc.
Contributed by Gaius Mulley <gaius.mulley@southwales.ac.uk>.
This file is part of GNU Modula-2.
GNU Modula-2 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 3, or (at your option)
any later version.
GNU Modula-2 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 GNU Modula-2; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. *)
IMPLEMENTATION MODULE M2CaseList ;
FROM M2Debug IMPORT Assert ;
FROM M2GCCDeclare IMPORT TryDeclareConstant, GetTypeMin, GetTypeMax ;
FROM M2MetaError IMPORT MetaError1, MetaError2, MetaErrorT0, MetaErrorT1, MetaErrorT2, MetaErrorT3, MetaErrorT4, MetaErrorString1 ;
FROM M2Error IMPORT InternalError ;
FROM M2Range IMPORT OverlapsRange, IsEqual, IsGreater ;
FROM M2ALU IMPORT PushIntegerTree, PopIntegerTree, Addn, Sub, PushInt ;
FROM Indexing IMPORT Index, InitIndex, PutIndice, GetIndice, ForeachIndiceInIndexDo, HighIndice ;
FROM Lists IMPORT InitList, IncludeItemIntoList ;
FROM NameKey IMPORT KeyToCharStar ;
FROM SymbolConversion IMPORT GccKnowsAbout, Mod2Gcc, AddModGcc ;
FROM DynamicStrings IMPORT InitString, InitStringCharStar, ConCat, Mark, KillString ;
FROM m2tree IMPORT Tree ;
FROM m2block IMPORT RememberType ;
FROM m2type IMPORT GetMinFrom ;
FROM Storage IMPORT ALLOCATE ;
FROM M2Base IMPORT IsExpressionCompatible ;
FROM M2Printf IMPORT printf1 ;
FROM SymbolTable IMPORT NulSym, IsConst, IsFieldVarient, IsRecord, IsRecordField, GetVarientTag, GetType,
ForeachLocalSymDo, GetSymName, IsEnumeration, SkipType ;
TYPE
RangePair = POINTER TO RECORD
low, high: CARDINAL ;
tokenno : CARDINAL ;
END ;
ConflictingPair = POINTER TO RECORD
a, b: RangePair ;
END ;
CaseList = POINTER TO RECORD
maxRangeId : CARDINAL ;
rangeArray : Index ;
currentRange: RangePair ;
varientField: CARDINAL ;
END ;
CaseDescriptor = POINTER TO RECORD
elseClause : BOOLEAN ;
elseField : CARDINAL ;
record : CARDINAL ;
varient : CARDINAL ;
maxCaseId : CARDINAL ;
caseListArray: Index ;
currentCase : CaseList ;
next : CaseDescriptor ;
END ;
SetRange = POINTER TO RECORD
low, high: Tree ;
next : SetRange ;
END ;
VAR
caseStack : CaseDescriptor ;
caseId : CARDINAL ;
caseArray : Index ;
conflictArray: Index ;
FreeRangeList: SetRange ;
(*
PushCase - create a case entity and push it to an internal stack.
r, is NulSym if this is a CASE statement.
If, r, is a record then it indicates it includes one
or more varients reside in the record. The particular
varient is, v.
Return the case id.
*)
PROCEDURE PushCase (r: CARDINAL; v: CARDINAL) : CARDINAL ;
VAR
c: CaseDescriptor ;
BEGIN
INC(caseId) ;
NEW(c) ;
IF c=NIL
THEN
InternalError ('out of memory error')
ELSE
WITH c^ DO
elseClause := FALSE ;
elseField := NulSym ;
record := r ;
varient := v ;
maxCaseId := 0 ;
caseListArray := InitIndex(1) ;
next := caseStack ;
currentCase := NIL
END ;
caseStack := c ;
PutIndice(caseArray, caseId, c)
END ;
RETURN( caseId )
END PushCase ;
(*
PopCase - pop the top element of the case entity from the internal
stack.
*)
PROCEDURE PopCase ;
BEGIN
IF caseStack=NIL
THEN
InternalError ('case stack is empty')
END ;
caseStack := caseStack^.next
END PopCase ;
(*
ElseCase - indicates that this case varient does have an else clause.
*)
PROCEDURE ElseCase (f: CARDINAL) ;
BEGIN
WITH caseStack^ DO
elseClause := TRUE ;
elseField := f
END
END ElseCase ;
(*
BeginCaseList - create a new label list.
*)
PROCEDURE BeginCaseList (v: CARDINAL) ;
VAR
l: CaseList ;
BEGIN
NEW(l) ;
IF l=NIL
THEN
InternalError ('out of memory error')
END ;
WITH l^ DO
maxRangeId := 0 ;
rangeArray := InitIndex(1) ;
currentRange := NIL ;
varientField := v
END ;
WITH caseStack^ DO
INC(maxCaseId) ;
PutIndice(caseListArray, maxCaseId, l) ;
currentCase := l
END
END BeginCaseList ;
(*
EndCaseList - terminate the current label list.
*)
PROCEDURE EndCaseList ;
BEGIN
caseStack^.currentCase := NIL
END EndCaseList ;
(*
AddRange - add a range to the current label list.
*)
PROCEDURE AddRange (r1, r2: CARDINAL; tok: CARDINAL) ;
VAR
r: RangePair ;
BEGIN
NEW(r) ;
IF r=NIL
THEN
InternalError ('out of memory error')
ELSE
WITH r^ DO
low := r1 ;
high := r2 ;
tokenno := tok
END ;
WITH caseStack^.currentCase^ DO
INC(maxRangeId) ;
PutIndice(rangeArray, maxRangeId, r) ;
currentRange := r
END
END
END AddRange ;
(*
GetVariantTagType - returns the type associated with, variant.
*)
PROCEDURE GetVariantTagType (variant: CARDINAL) : CARDINAL ;
VAR
tag: CARDINAL ;
BEGIN
tag := GetVarientTag(variant) ;
IF IsFieldVarient(tag) OR IsRecordField(tag)
THEN
RETURN( GetType(tag) )
ELSE
RETURN( tag )
END
END GetVariantTagType ;
(*
CaseBoundsResolved - returns TRUE if all constants in the case list, c,
are known to GCC.
*)
PROCEDURE CaseBoundsResolved (tokenno: CARDINAL; c: CARDINAL) : BOOLEAN ;
VAR
resolved: BOOLEAN ;
p : CaseDescriptor ;
q : CaseList ;
r : RangePair ;
min,
max,
type,
i, j : CARDINAL ;
BEGIN
p := GetIndice(caseArray, c) ;
WITH p^ DO
IF varient#NulSym
THEN
(* not a CASE statement, but a varient record containing without an ELSE clause *)
type := GetVariantTagType(varient) ;
resolved := TRUE ;
IF NOT GccKnowsAbout(type)
THEN
(* do we need to add, type, to the list of types required to be resolved? *)
resolved := FALSE
END ;
min := GetTypeMin(type) ;
IF NOT GccKnowsAbout(min)
THEN
TryDeclareConstant(tokenno, min) ;
resolved := FALSE
END ;
max := GetTypeMax(type) ;
IF NOT GccKnowsAbout(max)
THEN
TryDeclareConstant(tokenno, max) ;
resolved := FALSE
END ;
IF NOT resolved
THEN
RETURN( FALSE )
END
END ;
i := 1 ;
WHILE i<=maxCaseId DO
q := GetIndice(caseListArray, i) ;
j := 1 ;
WHILE j<=q^.maxRangeId DO
r := GetIndice(q^.rangeArray, j) ;
IF r^.low#NulSym
THEN
IF IsConst(r^.low)
THEN
TryDeclareConstant(tokenno, r^.low) ;
IF NOT GccKnowsAbout(r^.low)
THEN
RETURN( FALSE )
END
ELSE
IF r^.high=NulSym
THEN
MetaError1('the CASE statement variant must be defined by a constant {%1Da:is a {%1d}}', r^.low)
ELSE
MetaError1('the CASE statement variant low value in a range must be defined by a constant {%1Da:is a {%1d}}',
r^.low)
END
END
END ;
IF r^.high#NulSym
THEN
IF IsConst(r^.high)
THEN
TryDeclareConstant(tokenno, r^.high) ;
IF NOT GccKnowsAbout(r^.high)
THEN
RETURN( FALSE )
END
ELSE
MetaError1('the CASE statement variant high value in a range must be defined by a constant {%1Da:is a {%1d}}',
r^.high)
END
END ;
INC(j)
END ;
INC(i)
END
END ;
RETURN( TRUE )
END CaseBoundsResolved ;
(*
IsSame - return TRUE if r, s, are in, e.
*)
PROCEDURE IsSame (e: ConflictingPair; r, s: RangePair) : BOOLEAN ;
BEGIN
WITH e^ DO
RETURN( ((a=r) AND (b=s)) OR ((a=s) AND (b=r)) )
END
END IsSame ;
(*
SeenBefore -
*)
PROCEDURE SeenBefore (r, s: RangePair) : BOOLEAN ;
VAR
i, h: CARDINAL ;
e : ConflictingPair ;
BEGIN
h := HighIndice(conflictArray) ;
i := 1 ;
WHILE i<=h DO
e := GetIndice(conflictArray, i) ;
IF IsSame(e, r, s)
THEN
RETURN( TRUE )
END ;
INC(i)
END ;
NEW(e) ;
WITH e^ DO
a := r ;
b := s
END ;
PutIndice(conflictArray, h+1, e) ;
RETURN( FALSE )
END SeenBefore ;
(*
Overlaps -
*)
PROCEDURE Overlaps (r, s: RangePair) : BOOLEAN ;
VAR
a, b, c, d: CARDINAL ;
BEGIN
a := r^.low ;
c := s^.low ;
IF r^.high=NulSym
THEN
b := a ;
IF s^.high=NulSym
THEN
d := c ;
IF OverlapsRange(Mod2Gcc(a), Mod2Gcc(b), Mod2Gcc(c), Mod2Gcc(d))
THEN
IF NOT SeenBefore(r, s)
THEN
MetaErrorT2 (r^.tokenno, 'case label {%1ad} is a duplicate with {%2ad}', a, c) ;
MetaErrorT2 (s^.tokenno, 'case label {%1ad} is a duplicate with {%2ad}', c, a)
END ;
RETURN( TRUE )
END
ELSE
d := s^.high ;
IF OverlapsRange(Mod2Gcc(a), Mod2Gcc(b), Mod2Gcc(c), Mod2Gcc(d))
THEN
IF NOT SeenBefore (r, s)
THEN
MetaErrorT3 (r^.tokenno, 'case label {%1ad} is a duplicate in the range {%2ad}..{%3ad}', a, c, d) ;
MetaErrorT3 (s^.tokenno, 'case range {%2ad}..{%3ad} is a duplicate of case label {%1ad}', c, d, a)
END ;
RETURN( TRUE )
END
END
ELSE
b := r^.high ;
IF s^.high=NulSym
THEN
d := c ;
IF OverlapsRange (Mod2Gcc(a), Mod2Gcc(b), Mod2Gcc(c), Mod2Gcc(d))
THEN
IF NOT SeenBefore(r, s)
THEN
MetaErrorT3 (r^.tokenno, 'case range {%1ad}..{%2ad} is a duplicate with case label {%3ad}', a, b, c) ;
MetaErrorT3 (s^.tokenno, 'case label {%1ad} is a duplicate with case range %{2ad}..{%3ad}', c, a, b)
END ;
RETURN( TRUE )
END
ELSE
d := s^.high ;
IF OverlapsRange(Mod2Gcc(a), Mod2Gcc(b), Mod2Gcc(c), Mod2Gcc(d))
THEN
IF NOT SeenBefore(r, s)
THEN
MetaErrorT4 (r^.tokenno, 'case range {%1ad}..{%2ad} overlaps case range {%3ad}..{%4ad}', a, b, c, d) ;
MetaErrorT4 (s^.tokenno, 'case range {%1ad}..{%2ad} overlaps case range {%3ad}..{%4ad}', c, d, a, b)
END ;
RETURN( TRUE )
END
END
END ;
RETURN( FALSE )
END Overlaps ;
(*
OverlappingCaseBound - returns TRUE if, r, overlaps any case bound in the
case statement, c.
*)
PROCEDURE OverlappingCaseBound (r: RangePair; c: CARDINAL) : BOOLEAN ;
VAR
p : CaseDescriptor ;
q : CaseList ;
s : RangePair ;
i, j : CARDINAL ;
overlap: BOOLEAN ;
BEGIN
p := GetIndice (caseArray, c) ;
overlap := FALSE ;
WITH p^ DO
i := 1 ;
WHILE i<=maxCaseId DO
q := GetIndice (caseListArray, i) ;
j := 1 ;
WHILE j<=q^.maxRangeId DO
s := GetIndice (q^.rangeArray, j) ;
IF (s#r) AND Overlaps (r, s)
THEN
overlap := TRUE
END ;
INC (j)
END ;
INC (i)
END
END ;
RETURN( overlap )
END OverlappingCaseBound ;
(*
OverlappingCaseBounds - returns TRUE if there were any overlapping bounds
in the case list, c. It will generate an error
messages for each overlapping bound found.
*)
PROCEDURE OverlappingCaseBounds (c: CARDINAL) : BOOLEAN ;
VAR
p : CaseDescriptor ;
q : CaseList ;
r : RangePair ;
i, j : CARDINAL ;
overlap: BOOLEAN ;
BEGIN
p := GetIndice(caseArray, c) ;
overlap := FALSE ;
WITH p^ DO
i := 1 ;
WHILE i<=maxCaseId DO
q := GetIndice(caseListArray, i) ;
j := 1 ;
WHILE j<=q^.maxRangeId DO
r := GetIndice(q^.rangeArray, j) ;
IF OverlappingCaseBound (r, c)
THEN
overlap := TRUE
END ;
INC(j)
END ;
INC(i)
END
END ;
RETURN( overlap )
END OverlappingCaseBounds ;
(*
NewRanges -
*)
PROCEDURE NewRanges () : SetRange ;
VAR
s: SetRange ;
BEGIN
IF FreeRangeList=NIL
THEN
NEW(s)
ELSE
s := FreeRangeList ;
FreeRangeList := FreeRangeList^.next
END ;
s^.next := NIL ;
RETURN( s )
END NewRanges ;
(*
NewSet -
*)
PROCEDURE NewSet (type: CARDINAL) : SetRange ;
VAR
s: SetRange ;
BEGIN
s := NewRanges() ;
WITH s^ DO
low := Mod2Gcc(GetTypeMin(type)) ;
high := Mod2Gcc(GetTypeMax(type)) ;
next := NIL
END ;
RETURN( s )
END NewSet ;
(*
DisposeRanges -
*)
PROCEDURE DisposeRanges (set: SetRange) : SetRange ;
VAR
t: SetRange ;
BEGIN
IF set#NIL
THEN
IF FreeRangeList=NIL
THEN
FreeRangeList := set
ELSE
t := set ;
WHILE t^.next#NIL DO
t := t^.next
END ;
t^.next := FreeRangeList ;
FreeRangeList := set
END
END ;
RETURN( NIL )
END DisposeRanges ;
(*
SubBitRange - subtracts bits, lo..hi, from, set.
*)
PROCEDURE SubBitRange (set: SetRange; lo, hi: Tree; tokenno: CARDINAL) : SetRange ;
VAR
h, i : SetRange ;
BEGIN
h := set ;
WHILE h#NIL DO
IF (h^.high=NIL) OR IsEqual(h^.high, h^.low)
THEN
IF IsEqual(h^.low, lo) OR OverlapsRange(lo, hi, h^.low, h^.low)
THEN
IF h=set
THEN
set := set^.next ;
h^.next := NIL ;
h := DisposeRanges(h) ;
h := set
ELSE
i := set ;
WHILE i^.next#h DO
i := i^.next
END ;
i^.next := h^.next ;
i := h ;
h := h^.next ;
i^.next := NIL ;
i := DisposeRanges(i)
END
ELSE
h := h^.next
END
ELSE
IF OverlapsRange(lo, hi, h^.low, h^.high)
THEN
IF IsGreater(h^.low, lo) OR IsGreater(hi, h^.high)
THEN
MetaErrorT0 (tokenno, 'variant case range lies outside tag value')
ELSE
IF IsEqual(h^.low, lo)
THEN
PushIntegerTree(hi) ;
PushInt(1) ;
Addn ;
h^.low := PopIntegerTree()
ELSIF IsEqual(h^.high, hi)
THEN
PushIntegerTree(lo) ;
PushInt(1) ;
Sub ;
h^.high := PopIntegerTree()
ELSE
(* lo..hi exist inside range h^.low..h^.high *)
i := NewRanges() ;
i^.next := h^.next ;
h^.next := i ;
i^.high := h^.high ;
PushIntegerTree(lo) ;
PushInt(1) ;
Sub ;
h^.high := PopIntegerTree() ;
PushIntegerTree(hi) ;
PushInt(1) ;
Addn ;
i^.low := PopIntegerTree()
END
END
ELSE
h := h^.next
END
END
END ;
RETURN( set )
END SubBitRange ;
(*
ExcludeCaseRanges - excludes all case ranges found in, p, from, set
*)
PROCEDURE ExcludeCaseRanges (set: SetRange; p: CaseDescriptor) : SetRange ;
VAR
i, j: CARDINAL ;
q : CaseList ;
r : RangePair ;
BEGIN
WITH p^ DO
i := 1 ;
WHILE i<=maxCaseId DO
q := GetIndice(caseListArray, i) ;
j := 1 ;
WHILE j<=q^.maxRangeId DO
r := GetIndice(q^.rangeArray, j) ;
IF r^.high=NulSym
THEN
set := SubBitRange(set, Mod2Gcc(r^.low), Mod2Gcc(r^.low), r^.tokenno)
ELSE
set := SubBitRange(set, Mod2Gcc(r^.low), Mod2Gcc(r^.high), r^.tokenno)
END ;
INC(j)
END ;
INC(i)
END
END ;
RETURN( set )
END ExcludeCaseRanges ;
VAR
High, Low : Tree ;
errorString: String ;
(*
DoEnumValues -
*)
PROCEDURE DoEnumValues (sym: CARDINAL) ;
BEGIN
IF (Low#NIL) AND IsEqual(Mod2Gcc(sym), Low)
THEN
errorString := ConCat(errorString, InitStringCharStar(KeyToCharStar(GetSymName(sym)))) ;
Low := NIL
END ;
IF (High#NIL) AND IsEqual(Mod2Gcc(sym), High)
THEN
errorString := ConCat(errorString, Mark(InitString('..'))) ;
errorString := ConCat(errorString, Mark(InitStringCharStar(KeyToCharStar(GetSymName(sym))))) ;
High := NIL
END
END DoEnumValues ;
(*
ErrorRange -
*)
PROCEDURE ErrorRange (p: CaseDescriptor; type: CARDINAL; set: SetRange) ;
BEGIN
type := SkipType(type) ;
IF IsEnumeration(type)
THEN
Low := set^.low ;
High := set^.high ;
IF IsEqual(Low, High)
THEN
High := NIL ;
errorString := InitString('enumeration value ') ;
ForeachLocalSymDo(type, DoEnumValues) ;
errorString := ConCat(errorString, InitString(' is ignored by the CASE variant record {%1D}'))
ELSE
errorString := InitString('enumeration values ') ;
ForeachLocalSymDo(type, DoEnumValues) ;
errorString := ConCat(errorString, InitString(' are ignored by the CASE variant record {%1D}'))
END ;
MetaErrorString1(errorString, p^.varient)
END
END ErrorRange ;
(*
ErrorRanges -
*)
PROCEDURE ErrorRanges (p: CaseDescriptor; type: CARDINAL; set: SetRange) ;
BEGIN
WHILE set#NIL DO
ErrorRange(p, type, set) ;
set := set^.next
END
END ErrorRanges ;
(*
MissingCaseBounds - returns TRUE if there were any missing bounds
in the varient record case list, c. It will
generate an error message for each missing
bounds found.
*)
PROCEDURE MissingCaseBounds (tokenno: CARDINAL; c: CARDINAL) : BOOLEAN ;
VAR
p : CaseDescriptor ;
type : CARDINAL ;
missing: BOOLEAN ;
set : SetRange ;
BEGIN
p := GetIndice(caseArray, c) ;
missing := FALSE ;
WITH p^ DO
IF (record#NulSym) AND (varient#NulSym) AND (NOT elseClause)
THEN
(* not a CASE statement, but a varient record containing without an ELSE clause *)
type := GetVariantTagType(varient) ;
set := NewSet(type) ;
set := ExcludeCaseRanges(set, p) ;
IF set#NIL
THEN
missing := TRUE ;
MetaErrorT2 (tokenno,
'not all variant record alternatives in the {%kCASE} clause are specified, hint you either need to specify each value of {%2ad} or use an {%kELSE} clause',
varient, type) ;
ErrorRanges(p, type, set)
END ;
set := DisposeRanges(set)
END
END ;
RETURN( missing )
END MissingCaseBounds ;
(*
InRangeList - returns TRUE if the value, tag, is defined in the case list.
PROCEDURE InRangeList (cl: CaseList; tag: CARDINAL) : BOOLEAN ;
VAR
i, h: CARDINAL ;
r : RangePair ;
a : Tree ;
BEGIN
WITH cl^ DO
i := 1 ;
h := HighIndice(rangeArray) ;
WHILE i<=h DO
r := GetIndice(rangeArray, i) ;
WITH r^ DO
IF high=NulSym
THEN
a := Mod2Gcc(low)
ELSE
a := Mod2Gcc(high)
END ;
IF OverlapsRange(Mod2Gcc(low), a, Mod2Gcc(tag), Mod2Gcc(tag))
THEN
RETURN( TRUE )
END
END ;
INC(i)
END
END ;
RETURN( FALSE )
END InRangeList ;
*)
(*
WriteCase - dump out the case list (internal debugging).
*)
PROCEDURE WriteCase (c: CARDINAL) ;
BEGIN
(* this debugging procedure should be finished. *)
printf1 ("%d", c)
END WriteCase ;
(*
checkTypes - checks to see that, constant, and, type, are compatible.
*)
PROCEDURE checkTypes (constant, type: CARDINAL) : BOOLEAN ;
VAR
consttype: CARDINAL ;
BEGIN
IF (constant#NulSym) AND IsConst(constant)
THEN
consttype := GetType(constant) ;
IF NOT IsExpressionCompatible(consttype, type)
THEN
MetaError2('the CASE statement variant tag {%1ad} must be type compatible with the constant {%2Da:is a {%2d}}',
type, constant) ;
RETURN( FALSE )
END
END ;
RETURN( TRUE )
END checkTypes ;
(*
inRange - returns TRUE if, min <= i <= max.
*)
PROCEDURE inRange (i, min, max: CARDINAL) : BOOLEAN ;
BEGIN
RETURN( OverlapsRange(Mod2Gcc(i), Mod2Gcc(i), Mod2Gcc(min), Mod2Gcc(max)) )
END inRange ;
(*
TypeCaseBounds - returns TRUE if all bounds in case list, c, are
compatible with the tagged type.
*)
PROCEDURE TypeCaseBounds (c: CARDINAL) : BOOLEAN ;
VAR
p : CaseDescriptor ;
q : CaseList ;
r : RangePair ;
min, max,
type,
i, j : CARDINAL ;
compatible: BOOLEAN ;
BEGIN
p := GetIndice(caseArray, c) ;
type := NulSym ;
WITH p^ DO
type := NulSym ;
IF varient#NulSym
THEN
(* not a CASE statement, but a varient record containing without an ELSE clause *)
type := GetVariantTagType(varient) ;
min := GetTypeMin(type) ;
max := GetTypeMax(type)
END ;
IF type=NulSym
THEN
RETURN( TRUE )
END ;
compatible := TRUE ;
i := 1 ;
WHILE i<=maxCaseId DO
q := GetIndice(caseListArray, i) ;
j := 1 ;
WHILE j<=q^.maxRangeId DO
r := GetIndice(q^.rangeArray, j) ;
IF (r^.low#NulSym) AND (NOT inRange(r^.low, min, max))
THEN
MetaError2('the CASE statement variant range {%1ad} exceeds that of the tag type {%2ad}',
r^.low, type) ;
compatible := FALSE
END ;
IF NOT checkTypes(r^.low, type)
THEN
compatible := FALSE
END ;
IF (r^.high#NulSym) AND (NOT inRange(r^.high, min, max))
THEN
MetaError2('the CASE statement variant range {%1ad} exceeds that of the tag type {%2ad}',
r^.high, type) ;
compatible := FALSE
END ;
IF NOT checkTypes(r^.high, type)
THEN
compatible := FALSE
END ;
INC(j)
END ;
INC(i)
END ;
RETURN( compatible )
END
END TypeCaseBounds ;
BEGIN
caseStack := NIL ;
caseId := 0 ;
caseArray := InitIndex(1) ;
conflictArray := InitIndex(1) ;
FreeRangeList := NIL
END M2CaseList.

View file

@ -0,0 +1,67 @@
(* M2Check.def perform rigerous type checking for fully declared symbols.
Copyright (C) 2020-2022 Free Software Foundation, Inc.
Contributed by Gaius Mulley <gaius.mulley@southwales.ac.uk>.
This file is part of GNU Modula-2.
GNU Modula-2 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 3, or (at your option)
any later version.
GNU Modula-2 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 GNU Modula-2; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. *)
DEFINITION MODULE M2Check ;
(*
Title : M2Check
Author : Gaius Mulley
System : GNU Modula-2
Date : Fri Mar 6 15:32:10 2020
Revision : $Version$
Description: provides a module to check the symbol type compatibility.
It assumes that the declaration of all dependants
is complete.
*)
(*
ParameterTypeCompatible - returns TRUE if the nth procedure parameter formal
is compatible with actual. If the string is empty then
no error is issued.
*)
PROCEDURE ParameterTypeCompatible (token: CARDINAL; format: ARRAY OF CHAR;
procedure, formal, actual, nth: CARDINAL;
isvar: BOOLEAN) : BOOLEAN ;
(*
AssignmentTypeCompatible - returns TRUE if the des and the expr are assignment compatible.
If the string is empty then no error is issued.
*)
PROCEDURE AssignmentTypeCompatible (token: CARDINAL; format: ARRAY OF CHAR;
des, expr: CARDINAL) : BOOLEAN ;
(*
ExpressionTypeCompatible - returns TRUE if the expressions, left and right,
are expression compatible.
If the string is empty then no error is issued.
*)
PROCEDURE ExpressionTypeCompatible (token: CARDINAL; format: ARRAY OF CHAR;
left, right: CARDINAL;
strict, isin: BOOLEAN) : BOOLEAN ;
END M2Check.

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,54 @@
(* M2Code.def coordinate the activity of the front end.
Copyright (C) 2001-2022 Free Software Foundation, Inc.
Contributed by Gaius Mulley <gaius.mulley@southwales.ac.uk>.
This file is part of GNU Modula-2.
GNU Modula-2 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 3, or (at your option)
any later version.
GNU Modula-2 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 GNU Modula-2; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. *)
DEFINITION MODULE M2Code ;
(*
Title : M2Code
Author : Gaius Mulley
Date : 6/8/87
System : UNIX (GNU Modula-2)
Description: M2Code provides a module which coordinates the activity of the front
end optimization routines and the gcc tree generation.
*)
FROM SYSTEM IMPORT WORD ;
EXPORT QUALIFIED Code, CodeBlock ;
(*
Code - calls procedures to generates trees from the quadruples.
All front end quadruple optimization is performed via this call.
*)
PROCEDURE Code ;
(*
CodeBlock - generates all code for this block and also declares all types
and procedures for this block. It will also optimize quadruples
within this scope.
*)
PROCEDURE CodeBlock (scope: WORD) ;
END M2Code.

View file

@ -0,0 +1,528 @@
(* M2Code.mod coordinate the activity of the front end.
Copyright (C) 2001-2022 Free Software Foundation, Inc.
Contributed by Gaius Mulley <gaius.mulley@southwales.ac.uk>.
This file is part of GNU Modula-2.
GNU Modula-2 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 3, or (at your option)
any later version.
GNU Modula-2 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 GNU Modula-2; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. *)
IMPLEMENTATION MODULE M2Code ;
FROM SYSTEM IMPORT WORD ;
FROM M2Options IMPORT Statistics, DisplayQuadruples, OptimizeUncalledProcedures,
(* OptimizeDynamic, *) OptimizeCommonSubExpressions,
StyleChecking, Optimizing, WholeProgram ;
FROM M2Error IMPORT InternalError ;
FROM M2Students IMPORT StudentVariableCheck ;
FROM SymbolTable IMPORT GetMainModule, IsProcedure,
IsModuleWithinProcedure,
CheckHiddenTypeAreAddress, IsModule, IsDefImp,
DebugLineNumbers,
ForeachProcedureDo,
ForeachInnerModuleDo, GetSymName ;
FROM M2Printf IMPORT printf2, printf1, printf0 ;
FROM NameKey IMPORT Name ;
FROM M2Batch IMPORT ForeachSourceModuleDo ;
FROM M2Quads IMPORT CountQuads, GetFirstQuad, DisplayQuadList, DisplayQuadRange,
BackPatchSubrangesAndOptParam, VariableAnalysis,
LoopAnalysis, ForLoopAnalysis, GetQuad, QuadOperator ;
FROM M2Pass IMPORT SetPassToNoPass, SetPassToCodeGeneration ;
FROM M2BasicBlock IMPORT BasicBlock,
InitBasicBlocks, InitBasicBlocksFromRange,
KillBasicBlocks, FreeBasicBlocks,
ForeachBasicBlockDo ;
FROM M2Optimize IMPORT FoldBranches, RemoveProcedures ;
FROM M2GenGCC IMPORT ConvertQuadsToTree ;
FROM M2GCCDeclare IMPORT FoldConstants, StartDeclareScope,
DeclareProcedure, InitDeclarations,
DeclareModuleVariables, MarkExported ;
FROM M2Scope IMPORT ScopeBlock, InitScopeBlock, KillScopeBlock, ForeachScopeBlockDo ;
FROM m2top IMPORT StartGlobalContext, EndGlobalContext, SetFlagUnitAtATime ;
FROM M2Error IMPORT FlushErrors, FlushWarnings ;
FROM M2Swig IMPORT GenerateSwigFile ;
FROM m2flex IMPORT GetTotalLines ;
FROM FIO IMPORT FlushBuffer, StdOut ;
FROM M2Quiet IMPORT qprintf0 ;
FROM M2SSA IMPORT DiscoverSSA ;
CONST
MaxOptimTimes = 10 ; (* upper limit of no of times we run through all optimization *)
Debugging = TRUE ;
VAR
Total,
Count,
OptimTimes,
DeltaProc,
Proc,
DeltaConst,
Const,
DeltaJump,
Jump,
DeltaBasicB,
BasicB : CARDINAL ;
(*
Percent - calculates the percentage from numerator and divisor
*)
PROCEDURE Percent (numerator, divisor: CARDINAL) ;
VAR
value: CARDINAL ;
BEGIN
printf0 (' (') ;
IF divisor=0
THEN
printf0 ('overflow error')
ELSE
value := numerator*100 DIV divisor ;
printf1 ('%3d', value)
END ;
printf0 ('\%)')
END Percent ;
(*
OptimizationAnalysis - displays some simple front end optimization statistics.
*)
PROCEDURE OptimizationAnalysis ;
VAR
value: CARDINAL ;
BEGIN
IF Statistics
THEN
Count := CountQuads() ;
printf1 ('M2 initial number of quadruples: %6d', Total) ;
Percent (Total, Total) ; printf0 ('\n');
printf1 ('M2 constant folding achieved : %6d', Const) ;
Percent (Const, Total) ; printf0 ('\n');
printf1 ('M2 branch folding achieved : %6d', Jump) ;
Percent (Jump, Total) ; printf0 ('\n');
value := Const+Jump+Proc ;
printf1 ('Front end optimization removed : %6d', value) ;
Percent (value, Total) ; printf0 ('\n') ;
printf1 ('Front end final : %6d', Count) ;
Percent (Count, Total) ; printf0 ('\n') ;
Count := GetTotalLines () ;
printf1 ('Total source lines compiled : %6d\n', Count) ;
FlushBuffer (StdOut)
END ;
IF DisplayQuadruples
THEN
printf0 ('after all front end optimization\n') ;
DisplayQuadList
END
END OptimizationAnalysis ;
(*
RemoveUnreachableCode -
*)
PROCEDURE RemoveUnreachableCode ;
BEGIN
IF WholeProgram
THEN
ForeachSourceModuleDo(RemoveProcedures)
ELSE
RemoveProcedures(GetMainModule())
END
END RemoveUnreachableCode ;
(*
DoModuleDeclare - declare all constants, types, variables, procedures for the
main module or all modules.
*)
PROCEDURE DoModuleDeclare ;
BEGIN
IF WholeProgram
THEN
ForeachSourceModuleDo (StartDeclareScope)
ELSE
StartDeclareScope (GetMainModule ())
END
END DoModuleDeclare ;
(*
PrintModule -
*)
(*
PROCEDURE PrintModule (sym: CARDINAL) ;
VAR
n: Name ;
BEGIN
n := GetSymName (sym) ;
printf1 ('module %a\n', n)
END PrintModule ;
*)
(*
DoCodeBlock - generate code for the main module or all modules.
*)
PROCEDURE DoCodeBlock ;
BEGIN
IF WholeProgram
THEN
(* ForeachSourceModuleDo(PrintModule) ; *)
CodeBlock (GetMainModule ())
ELSE
CodeBlock (GetMainModule ())
END
END DoCodeBlock ;
(*
DetermineSubExpTemporaries -
*)
PROCEDURE DetermineSubExpTemporaries ;
BEGIN
IF WholeProgram
THEN
ForeachSourceModuleDo (DiscoverSSA)
ELSE
DiscoverSSA (GetMainModule ())
END
END DetermineSubExpTemporaries ;
(*
Code - calls procedures to generates trees from the quadruples.
All front end quadruple optimization is performed via this call.
*)
PROCEDURE Code ;
BEGIN
CheckHiddenTypeAreAddress ;
SetPassToNoPass ;
BackPatchSubrangesAndOptParam ;
Total := CountQuads () ;
ForLoopAnalysis ; (* must be done before any optimization as the index variable increment quad might change *)
IF DisplayQuadruples
THEN
printf0 ('before any optimization\n') ;
DisplayQuadList
END ;
(* now is a suitable time to check for student errors as *)
(* we know all the front end symbols must be resolved. *)
IF StyleChecking
THEN
StudentVariableCheck
END ;
SetPassToCodeGeneration ;
SetFlagUnitAtATime (Optimizing) ;
StartGlobalContext ;
InitDeclarations ; (* default and fixed sized types are all declared from now on. *)
RemoveUnreachableCode ;
IF DisplayQuadruples
THEN
printf0 ('after dead procedure elimination\n') ;
DisplayQuadList
END ;
DetermineSubExpTemporaries ;
IF DisplayQuadruples
THEN
printf0 ('after identifying simple subexpression temporaries\n') ;
DisplayQuadList
END ;
qprintf0 (' symbols to gcc trees\n') ;
DoModuleDeclare ;
FlushWarnings ;
FlushErrors ;
qprintf0 (' statements to gcc trees\n') ;
DoCodeBlock ;
MarkExported (GetMainModule ()) ;
GenerateSwigFile (GetMainModule ()) ;
DebugLineNumbers (GetMainModule ()) ;
qprintf0 (' gcc trees given to the gcc backend\n') ;
EndGlobalContext ;
OptimizationAnalysis
END Code ;
(*
InitialDeclareAndCodeBlock - declares all objects within scope,
*)
PROCEDURE InitialDeclareAndOptimize (start, end: CARDINAL) ;
BEGIN
Count := CountQuads() ;
FreeBasicBlocks(InitBasicBlocksFromRange(start, end)) ;
BasicB := Count - CountQuads() ;
Count := CountQuads() ;
FoldBranches(start, end) ;
Jump := Count - CountQuads() ;
Count := CountQuads()
END InitialDeclareAndOptimize ;
(*
DeclareAndCodeBlock - declares all objects within scope,
*)
PROCEDURE SecondDeclareAndOptimize (start, end: CARDINAL) ;
BEGIN
REPEAT
FoldConstants(start, end) ;
DeltaConst := Count - CountQuads () ;
Count := CountQuads () ;
FreeBasicBlocks(InitBasicBlocksFromRange (start, end)) ;
DeltaBasicB := Count - CountQuads () ;
Count := CountQuads () ;
FreeBasicBlocks (InitBasicBlocksFromRange (start, end)) ;
FoldBranches(start, end) ;
DeltaJump := Count - CountQuads () ;
Count := CountQuads () ;
FreeBasicBlocks(InitBasicBlocksFromRange (start, end)) ;
INC (DeltaBasicB, Count - CountQuads ()) ;
Count := CountQuads () ;
(* now total the optimization components *)
INC (Proc, DeltaProc) ;
INC (Const, DeltaConst) ;
INC (Jump, DeltaJump) ;
INC (BasicB, DeltaBasicB)
UNTIL (OptimTimes>=MaxOptimTimes) OR
((DeltaProc=0) AND (DeltaConst=0) AND (DeltaJump=0) AND (DeltaBasicB=0)) ;
IF (DeltaProc#0) OR (DeltaConst#0) OR (DeltaJump#0) OR (DeltaBasicB#0)
THEN
printf0 ('optimization finished although more reduction may be possible (increase MaxOptimTimes)\n')
END
END SecondDeclareAndOptimize ;
(*
InitOptimizeVariables -
*)
PROCEDURE InitOptimizeVariables ;
BEGIN
Count := CountQuads () ;
OptimTimes := 0 ;
DeltaProc := 0 ;
DeltaConst := 0 ;
DeltaJump := 0 ;
DeltaBasicB := 0
END InitOptimizeVariables ;
(*
Init -
*)
PROCEDURE Init ;
BEGIN
Proc := 0 ;
Const := 0 ;
Jump := 0 ;
BasicB := 0
END Init ;
(*
BasicBlockVariableAnalysis -
*)
PROCEDURE BasicBlockVariableAnalysis (start, end: CARDINAL) ;
VAR
bb: BasicBlock ;
BEGIN
bb := InitBasicBlocksFromRange(start, end) ;
ForeachBasicBlockDo (bb, VariableAnalysis) ;
KillBasicBlocks (bb)
END BasicBlockVariableAnalysis ;
(*
DisplayQuadsInScope -
*)
(*
PROCEDURE DisplayQuadsInScope (sb: ScopeBlock) ;
BEGIN
printf0 ('Quads in scope\n') ;
ForeachScopeBlockDo (sb, DisplayQuadRange) ;
printf0 ('===============\n')
END DisplayQuadsInScope ;
*)
(*
OptimizeScopeBlock -
*)
PROCEDURE OptimizeScopeBlock (sb: ScopeBlock) ;
VAR
OptimTimes,
Previous,
Current : CARDINAL ;
BEGIN
InitOptimizeVariables ;
OptimTimes := 1 ;
Current := CountQuads () ;
ForeachScopeBlockDo (sb, InitialDeclareAndOptimize) ;
ForeachScopeBlockDo (sb, BasicBlockVariableAnalysis) ;
REPEAT
ForeachScopeBlockDo (sb, SecondDeclareAndOptimize) ;
Previous := Current ;
Current := CountQuads () ;
INC (OptimTimes)
UNTIL (OptimTimes=MaxOptimTimes) OR (Current=Previous) ;
ForeachScopeBlockDo (sb, LoopAnalysis)
END OptimizeScopeBlock ;
(*
DisplayQuadNumbers - the range, start..end.
*)
(*
PROCEDURE DisplayQuadNumbers (start, end: CARDINAL) ;
BEGIN
IF DisplayQuadruples
THEN
printf2 ('Coding [%d..%d]\n', start, end)
END
END DisplayQuadNumbers ;
*)
(*
CodeProceduresWithinBlock - codes the procedures within the module scope.
*)
PROCEDURE CodeProceduresWithinBlock (scope: CARDINAL) ;
BEGIN
ForeachProcedureDo (scope, CodeBlock)
END CodeProceduresWithinBlock ;
(*
CodeProcedures -
*)
PROCEDURE CodeProcedures (scope: CARDINAL) ;
BEGIN
IF IsDefImp (scope) OR IsModule (scope)
THEN
ForeachProcedureDo (scope, CodeBlock)
END
END CodeProcedures ;
(*
CodeBlock - generates all code for this block and also declares
all types and procedures for this block. It will
also optimize quadruples within this scope.
*)
PROCEDURE CodeBlock (scope: WORD) ;
VAR
sb: ScopeBlock ;
n : Name ;
BEGIN
IF DisplayQuadruples
THEN
n := GetSymName (scope) ;
printf1 ('before coding block %a\n', n)
END ;
sb := InitScopeBlock (scope) ;
OptimizeScopeBlock (sb) ;
IF IsProcedure (scope)
THEN
IF DisplayQuadruples
THEN
n := GetSymName(scope) ;
printf1('before coding procedure %a\n', n) ;
ForeachScopeBlockDo(sb, DisplayQuadRange) ;
printf0('===============\n')
END ;
ForeachScopeBlockDo(sb, ConvertQuadsToTree)
ELSIF IsModuleWithinProcedure(scope)
THEN
IF DisplayQuadruples
THEN
n := GetSymName(scope) ;
printf1('before coding module %a within procedure\n', n) ;
ForeachScopeBlockDo(sb, DisplayQuadRange) ;
printf0('===============\n')
END ;
ForeachScopeBlockDo(sb, ConvertQuadsToTree) ;
ForeachProcedureDo(scope, CodeBlock)
ELSE
IF DisplayQuadruples
THEN
n := GetSymName(scope) ;
printf1('before coding module %a\n', n) ;
ForeachScopeBlockDo(sb, DisplayQuadRange) ;
printf0('===============\n')
END ;
ForeachScopeBlockDo(sb, ConvertQuadsToTree) ;
IF WholeProgram
THEN
ForeachSourceModuleDo(CodeProcedures)
ELSE
ForeachProcedureDo(scope, CodeBlock)
END ;
ForeachInnerModuleDo(scope, CodeProceduresWithinBlock)
END ;
KillScopeBlock(sb)
END CodeBlock ;
BEGIN
Init
END M2Code.

View file

@ -0,0 +1,142 @@
(* M2ColorString.def provides procedures for obtaining GCC color strings.
Copyright (C) 2019-2022 Free Software Foundation, Inc.
Contributed by Gaius Mulley <gaius@glam.ac.uk>.
This file is part of GNU Modula-2.
GNU Modula-2 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 3, or (at your option)
any later version.
GNU Modula-2 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 GNU Modula-2; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. *)
DEFINITION MODULE M2ColorString ; (*!m2pim+gm2*)
(*
Title : M2ColorString
Author : Gaius Mulley
System : GNU Modula-2
Date : Sat Apr 13 19:21:03 2019
Revision : $Version$
Description: provides procedures for obtaining GCC color strings.
*)
FROM DynamicStrings IMPORT String ;
(*
SetEnableColor - sets the global variable to, b, and returns
the previous value.
*)
PROCEDURE SetEnableColor (b: BOOLEAN) : BOOLEAN ;
(*
quoteOpen - adds an open quote to string, s.
*)
PROCEDURE quoteOpen (s: String) : String ;
(*
quoteClose - adds a close quote to string, s.
*)
PROCEDURE quoteClose (s: String) : String ;
(*
endColor - stops using color.
*)
PROCEDURE endColor (s: String) : String ;
(*
quoteColor - adds quote color to string, s.
*)
PROCEDURE quoteColor (s: String) : String ;
(*
errorColor - adds error color to string, s.
*)
PROCEDURE errorColor (s: String) : String ;
(*
warningColor - adds warning color to string, s.
*)
PROCEDURE warningColor (s: String) : String ;
(*
noteColor - adds note color to string, s.
*)
PROCEDURE noteColor (s: String) : String ;
(*
locusColor - adds locus color to string, s.
*)
PROCEDURE locusColor (s: String) : String ;
(*
insertColor - adds fixit-insert color to string, s.
*)
PROCEDURE insertColor (s: String) : String ;
(*
deleteColor - adds fixit-insert color to string, s.
*)
PROCEDURE deleteColor (s: String) : String ;
(*
filenameColor - adds filename color to string, s.
*)
PROCEDURE filenameColor (s: String) : String ;
(*
typeColor - adds type color to string, s.
*)
PROCEDURE typeColor (s: String) : String ;
(*
range1Color - adds type color to string, s.
*)
PROCEDURE range1Color (s: String) : String ;
(*
range2Color - adds type color to string, s.
*)
PROCEDURE range2Color (s: String) : String ;
END M2ColorString.

View file

@ -0,0 +1,218 @@
(* M2ColorString.mod provides procedures for obtaining GCC color strings.
Copyright (C) 2019-2022 Free Software Foundation, Inc.
Contributed by Gaius Mulley <gaius@glam.ac.uk>.
This file is part of GNU Modula-2.
GNU Modula-2 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 3, or (at your option)
any later version.
GNU Modula-2 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 GNU Modula-2; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. *)
IMPLEMENTATION MODULE M2ColorString ;
FROM m2color IMPORT colorize_start, colorize_stop, open_quote, close_quote ;
FROM DynamicStrings IMPORT InitString, InitStringCharStar,
ConCat, ConCatChar, Mark, string, KillString,
Dup, char, Length, Mult ;
FROM StrLib IMPORT StrLen ;
FROM libc IMPORT printf ;
VAR
EnableColor: BOOLEAN ;
(*
SetEnableColor - sets the global variable to, b, and returns
the previous value.
*)
PROCEDURE SetEnableColor (b: BOOLEAN) : BOOLEAN ;
VAR
previous: BOOLEAN ;
BEGIN
previous := EnableColor ;
EnableColor := b ;
RETURN previous
END SetEnableColor ;
(*
append - appends color string, name, to the end of string, s,
and returns, s.
*)
PROCEDURE append (s: String; name: ARRAY OF CHAR) : String ;
VAR
c: String ;
BEGIN
c := InitStringCharStar (colorize_start (EnableColor, name, StrLen (name))) ;
s := ConCat (s, c) ;
c := KillString (c) ;
RETURN s
END append ;
(*
quoteOpen - adds an open quote to string, s.
*)
PROCEDURE quoteOpen (s: String) : String ;
BEGIN
RETURN ConCat (append (s, "quote"), Mark (InitStringCharStar (open_quote ())))
END quoteOpen ;
(*
quoteClose - adds a close quote to string, s.
*)
PROCEDURE quoteClose (s: String) : String ;
BEGIN
s := endColor (s) ;
s := append (s, "quote") ;
s := ConCat (s, Mark (InitStringCharStar (close_quote ()))) ;
s := endColor (s) ;
RETURN s
END quoteClose ;
(*
endColor - stops using color.
*)
PROCEDURE endColor (s: String) : String ;
VAR
c: String ;
BEGIN
c := InitStringCharStar (colorize_stop (EnableColor)) ;
s := ConCat (s, c) ;
c := KillString (c) ;
RETURN s
END endColor ;
(*
quoteColor - adds quote color to string, s.
*)
PROCEDURE quoteColor (s: String) : String ;
BEGIN
RETURN append (s, "quote")
END quoteColor ;
(*
errorColor - adds error color to string, s.
*)
PROCEDURE errorColor (s: String) : String ;
BEGIN
RETURN append (s, "error")
END errorColor ;
(*
warningColor - adds warning color to string, s.
*)
PROCEDURE warningColor (s: String) : String ;
BEGIN
RETURN append (s, "warning")
END warningColor ;
(*
noteColor - adds note color to string, s.
*)
PROCEDURE noteColor (s: String) : String ;
BEGIN
RETURN append (s, "note")
END noteColor ;
(*
locusColor - adds locus color to string, s.
*)
PROCEDURE locusColor (s: String) : String ;
BEGIN
RETURN append (s, "locus")
END locusColor ;
(*
insertColor - adds fixit-insert color to string, s.
*)
PROCEDURE insertColor (s: String) : String ;
BEGIN
RETURN append (s, "fixit-insert")
END insertColor ;
(*
deleteColor - adds fixit-insert color to string, s.
*)
PROCEDURE deleteColor (s: String) : String ;
BEGIN
RETURN append (s, "fixit-delete")
END deleteColor ;
(*
filenameColor - adds filename color to string, s.
*)
PROCEDURE filenameColor (s: String) : String ;
BEGIN
RETURN append (s, "diff-filename")
END filenameColor ;
(*
typeColor - adds type color to string, s.
*)
PROCEDURE typeColor (s: String) : String ;
BEGIN
RETURN append (s, "type")
END typeColor ;
(*
range1Color - adds type color to string, s.
*)
PROCEDURE range1Color (s: String) : String ;
BEGIN
RETURN append (s, "range1")
END range1Color ;
(*
range2Color - adds type color to string, s.
*)
PROCEDURE range2Color (s: String) : String ;
BEGIN
RETURN append (s, "range2")
END range2Color ;
BEGIN
EnableColor := TRUE
END M2ColorString.

View file

@ -0,0 +1,70 @@
(* M2Comp.def continually calls the compiler for every source file.
Copyright (C) 2001-2022 Free Software Foundation, Inc.
Contributed by Gaius Mulley <gaius.mulley@southwales.ac.uk>.
This file is part of GNU Modula-2.
GNU Modula-2 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 3, or (at your option)
any later version.
GNU Modula-2 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 GNU Modula-2; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. *)
DEFINITION MODULE M2Comp ;
(*
Author : Gaius Mulley
Title : M2Comp
Date : 29/5/87
Description: Continually calls the compiler for every source file
referenced in the Modula-2 compiler.
*)
FROM SYSTEM IMPORT ADDRESS ;
EXPORT QUALIFIED CompilingDefinitionModule,
CompilingImplementationModule,
CompilingProgramModule,
compile ;
(*
compile - compile the filename.
*)
PROCEDURE compile (filename: ADDRESS) ;
(*
CompilingDefinitionModule - returns true if the current module being
compiled is a definition module.
*)
PROCEDURE CompilingDefinitionModule () : BOOLEAN ;
(*
CompilingImplementationModule - returns true if the current module being
compiled is an implementation module.
*)
PROCEDURE CompilingImplementationModule () : BOOLEAN ;
(*
CompilingProgramModule - returns true if the current module being
compiled is a program module.
*)
PROCEDURE CompilingProgramModule () : BOOLEAN ;
END M2Comp.

View file

@ -0,0 +1,652 @@
(* M2Comp.mod continually calls the compiler for every source file.
Copyright (C) 2001-2022 Free Software Foundation, Inc.
Contributed by Gaius Mulley <gaius.mulley@southwales.ac.uk>.
This file is part of GNU Modula-2.
GNU Modula-2 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 3, or (at your option)
any later version.
GNU Modula-2 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 GNU Modula-2; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. *)
IMPLEMENTATION MODULE M2Comp ;
FROM M2Options IMPORT Statistics, Quiet, WholeProgram, ExtendedOpaque, GenModuleList ;
FROM M2Pass IMPORT SetPassToPass0, SetPassToPass1, SetPassToPass2, SetPassToPassC, SetPassToPass3,
SetPassToNoPass, SetPassToPassHidden ;
FROM M2Reserved IMPORT toktype ;
FROM M2Search IMPORT FindSourceDefFile, FindSourceModFile ;
FROM M2Code IMPORT Code ;
FROM M2LexBuf IMPORT OpenSource, CloseSource, ResetForNewPass, currenttoken, GetToken, ReInitialize, currentstring, GetTokenNo ;
FROM M2FileName IMPORT CalculateFileName ;
FROM M2Preprocess IMPORT PreprocessModule ;
FROM libc IMPORT exit ;
FROM M2Error IMPORT ErrorStringAt, ErrorStringAt2, ErrorStringsAt2,
WriteFormat0, FlushErrors, FlushWarnings, ResetErrorScope ;
FROM M2MetaError IMPORT MetaErrorString1, MetaError0, MetaError1 ;
FROM FormatStrings IMPORT Sprintf1 ;
FROM P0SymBuild IMPORT P0Init, P1Init ;
IMPORT m2flex ;
IMPORT P0SyntaxCheck ;
IMPORT P1Build ;
IMPORT P2Build ;
IMPORT PCBuild ;
IMPORT P3Build ;
IMPORT PHBuild ;
IMPORT PCSymBuild ;
FROM M2Batch IMPORT GetSource, GetModuleNo, GetDefinitionModuleFile, GetModuleFile,
AssociateModule, AssociateDefinition, MakeImplementationSource,
MakeProgramSource ;
FROM SymbolTable IMPORT GetSymName, IsDefImp, NulSym,
IsHiddenTypeDeclared, GetFirstUsed, GetMainModule, SetMainModule,
ResolveConstructorTypes, SanityCheckConstants, IsDefinitionForC,
IsBuiltinInModule, PutModLink, IsDefLink, IsModLink ;
FROM FIO IMPORT StdErr ;
FROM NameKey IMPORT Name, GetKey, KeyToCharStar, makekey ;
FROM M2Printf IMPORT fprintf1 ;
FROM M2Quiet IMPORT qprintf0, qprintf1, qprintf2 ;
FROM DynamicStrings IMPORT String, InitString, KillString, InitStringCharStar, Dup, Mark, string ;
CONST
Debugging = FALSE ;
VAR
ModuleType : (None, Definition, Implementation, Program) ;
(*
CompilingDefinitionModule - returns true if the current module being
compiled is a definition module.
*)
PROCEDURE CompilingDefinitionModule() : BOOLEAN ;
BEGIN
RETURN( ModuleType=Definition )
END CompilingDefinitionModule ;
(*
CompilingImplementationModule - returns true if the current module being
compiled is an implementation module.
*)
PROCEDURE CompilingImplementationModule() : BOOLEAN ;
BEGIN
RETURN( ModuleType=Implementation )
END CompilingImplementationModule ;
(*
CompilingProgramModule - returns true if the current module being
compiled is a program module.
*)
PROCEDURE CompilingProgramModule() : BOOLEAN ;
BEGIN
RETURN( ModuleType=Program )
END CompilingProgramModule ;
(*
NeedToParseImplementation -
*)
PROCEDURE NeedToParseImplementation (sym: CARDINAL) : BOOLEAN ;
BEGIN
RETURN (IsDefImp(sym) AND IsHiddenTypeDeclared(sym) AND ExtendedOpaque) OR
(IsDefImp(sym) AND IsBuiltinInModule(sym)) OR
(WholeProgram AND (NOT IsDefinitionForC(sym)))
END NeedToParseImplementation ;
(*
Compile - compile file, s, using a 5 pass technique.
*)
PROCEDURE Compile (s: String) ;
BEGIN
DoPass0(s) ;
FlushWarnings ; FlushErrors ;
ResetForNewPass ; ResetErrorScope ;
qprintf0('Pass 1: scopes, enumerated types, imports and exports\n') ;
DoPass1 ;
FlushWarnings ; FlushErrors ;
qprintf0('Pass 2: constants and types\n') ;
ResetForNewPass ; ResetErrorScope ;
DoPass2 ;
FlushWarnings ; FlushErrors ;
qprintf0('Pass C: aggregate constants\n') ;
ResetForNewPass ; ResetErrorScope ;
DoPassC ;
FlushWarnings ; FlushErrors ;
qprintf0('Pass 3: quadruple generation\n') ;
ResetForNewPass ; ResetErrorScope ;
DoPass3 ;
FlushWarnings ; FlushErrors ;
qprintf0('Pass 4: gcc tree generation\n') ;
Code ;
FlushWarnings ; FlushErrors
END Compile ;
(*
compile - compile the filename.
*)
PROCEDURE compile (filename: ADDRESS) ;
VAR
f: String ;
BEGIN
f := InitStringCharStar(filename) ;
Compile(f) ;
f := KillString(f) ;
END compile ;
(*
ExamineCompilationUnit - opens the source file to obtain the module name and kind of module.
*)
PROCEDURE ExamineCompilationUnit (VAR name: ADDRESS; VAR isdefimp: BOOLEAN) ;
BEGIN
isdefimp := FALSE ; (* default to program module *)
(* stop if we see eof, ';' or '[' *)
WHILE (currenttoken#eoftok) AND (currenttoken#semicolontok) AND (currenttoken#lsbratok) DO
IF (currenttoken=implementationtok) OR (currenttoken=definitiontok)
THEN
isdefimp := TRUE ;
GetToken
END ;
IF currenttoken=identtok
THEN
name := currentstring ;
RETURN
END ;
GetToken
END ;
m2flex.M2Error(string(InitString('failed to find module name'))) ;
exit(1)
END ExamineCompilationUnit ;
(*
PeepInto - peeps into source, s, and initializes a definition/implementation or
program module accordingly.
*)
PROCEDURE PeepInto (s: String) ;
VAR
name : ADDRESS ;
isdefimp: BOOLEAN ;
BEGIN
IF OpenSource(PreprocessModule(s))
THEN
ExamineCompilationUnit(name, isdefimp) ;
IF isdefimp
THEN
SetMainModule(MakeImplementationSource(GetTokenNo(), makekey(name)))
ELSE
SetMainModule(MakeProgramSource(GetTokenNo(), makekey(name)))
END ;
CloseSource ;
ReInitialize
ELSE
fprintf1(StdErr, 'failed to open %s\n', s) ;
exit(1)
END
END PeepInto ;
(*
DoPass0 -
*)
PROCEDURE DoPass0 (s: String) ;
VAR
Main,
Sym : CARDINAL ;
i : CARDINAL ;
SymName,
FileName: String ;
BEGIN
P0Init ;
SetPassToPass0 ;
PeepInto(s) ;
Main := GetMainModule() ;
i := 1 ;
Sym := GetModuleNo(i) ;
qprintf1('Compiling: %s\n', s) ;
qprintf0('Pass 0: lexical analysis, parsing, modules and associated filenames\n') ;
WHILE Sym#NulSym DO
SymName := InitStringCharStar(KeyToCharStar(GetSymName(Sym))) ;
IF IsDefImp(Sym)
THEN
IF FindSourceDefFile(SymName, FileName)
THEN
ModuleType := Definition ;
IF OpenSource(AssociateDefinition(PreprocessModule(FileName), Sym))
THEN
IF NOT P0SyntaxCheck.CompilationUnit()
THEN
WriteFormat0('compilation failed') ;
CloseSource ;
RETURN
END ;
qprintf2 (' Module %-20s : %s', SymName, FileName) ;
IF IsDefinitionForC (Sym)
THEN
qprintf0 (' (for C)')
END ;
IF IsDefLink (Sym)
THEN
qprintf0 (' (linking)')
END ;
qprintf0 ('\n') ;
CloseSource
ELSE
(* Unrecoverable error. *)
MetaErrorString1 (Sprintf1 (InitString ('file {%%1EUAF%s} containing module {%%1a} cannot be found'),
FileName), Sym)
END
ELSE
(* Unrecoverable error. *)
MetaError1 ('the file containing the definition module {%1EMAa} cannot be found', Sym)
END ;
ModuleType := Implementation
ELSE
ModuleType := Program
END ;
IF (Main=Sym) OR NeedToParseImplementation(Sym)
THEN
(* only need to read implementation module if hidden types are declared or it is the main module *)
IF Main=Sym
THEN
FileName := Dup(s)
ELSE
IF FindSourceModFile (SymName, FileName)
THEN
END
END ;
IF FileName#NIL
THEN
IF OpenSource (AssociateModule (PreprocessModule (FileName), Sym))
THEN
IF NOT P0SyntaxCheck.CompilationUnit()
THEN
WriteFormat0 ('compilation failed') ;
CloseSource ;
RETURN
END ;
qprintf2 (' Module %-20s : %s', SymName, FileName) ;
IF IsModLink (Sym)
THEN
qprintf0 (' (linking)')
END ;
qprintf0 ('\n') ;
CloseSource
ELSE
(* It is quite legitimate to implement a module in C (and pretend it was a M2
implementation) providing that it is not the main program module and the
definition module do not declare a hidden type when -fextended-opaque
is used. *)
IF (NOT WholeProgram) OR (Sym=Main) OR IsHiddenTypeDeclared(Sym)
THEN
(* Unrecoverable error. *)
MetaErrorString1 (Sprintf1 (InitString ('file {%%1EUAF%s} containing module {%%1a} cannot be found'),
FileName), Sym) ;
END
END
END
ELSIF GenModuleList
THEN
IF NOT IsDefinitionForC (Sym)
THEN
(* The implementation is only useful if -fgen-module-list= is
used and we do not insist upon it. *)
IF FindSourceModFile (SymName, FileName)
THEN
qprintf2 (' Module %-20s : %s (linking)\n', SymName, FileName) ;
IF OpenSource (AssociateModule (PreprocessModule (FileName), Sym))
THEN
PutModLink (Sym, TRUE) ; (* This source is only used to determine link time info. *)
IF NOT P0SyntaxCheck.CompilationUnit ()
THEN
WriteFormat0 ('compilation failed') ;
CloseSource ;
RETURN
END ;
CloseSource
END
END
END
END ;
SymName := KillString (SymName) ;
FileName := KillString (FileName) ;
INC (i) ;
Sym := GetModuleNo (i)
END ;
SetPassToNoPass
END DoPass0 ;
(*
DoPass1 - parses the sources of all modules necessary to compile
the required module, Main.
*)
PROCEDURE DoPass1 ;
VAR
name : Name ;
Sym : CARDINAL ;
i : CARDINAL ;
FileName: String ;
BEGIN
P1Init ;
SetPassToPass1 ;
i := 1 ;
Sym := GetModuleNo(i) ;
WHILE Sym#NulSym DO
FileName := GetDefinitionModuleFile(Sym) ;
IF FileName#NIL
THEN
IF Debugging
THEN
name := GetSymName(Sym) ;
qprintf1(' Module %a\n', name)
END ;
IF OpenSource(FileName)
THEN
ModuleType := Definition ;
IF NOT P1Build.CompilationUnit()
THEN
MetaError0('compilation failed') ;
CloseSource ;
RETURN
END ;
CloseSource
ELSE
fprintf1(StdErr, 'failed to open %s\n', FileName) ;
exit(1)
END ;
ModuleType := Implementation
ELSE
ModuleType := Program
END ;
FileName := GetModuleFile(Sym) ;
IF FileName#NIL
THEN
IF Debugging
THEN
name := GetSymName(Sym) ;
qprintf1(' Module %a\n', name)
END ;
IF OpenSource(FileName)
THEN
IF NOT P1Build.CompilationUnit()
THEN
MetaError0('compilation failed') ;
CloseSource ;
RETURN
END ;
CloseSource
ELSE
fprintf1(StdErr, 'failed to open %s\n', FileName) ;
exit(1)
END
END ;
INC(i) ;
Sym := GetModuleNo(i)
END ;
SetPassToNoPass
END DoPass1 ;
(*
DoPass2 - parses the sources of all modules necessary to compile
the required module, Main.
*)
PROCEDURE DoPass2 ;
VAR
name : Name ;
Sym : CARDINAL ;
i : CARDINAL ;
FileName: String ;
BEGIN
SetPassToPass2 ;
i := 1 ;
Sym := GetModuleNo(i) ;
WHILE Sym#NulSym DO
FileName := GetDefinitionModuleFile(Sym) ;
IF FileName#NIL
THEN
IF Debugging
THEN
name := GetSymName(Sym) ;
qprintf1(' Module %a\n', name)
END ;
IF OpenSource(FileName)
THEN
ModuleType := Definition ;
IF NOT P2Build.CompilationUnit()
THEN
MetaError0('compilation failed') ;
CloseSource ;
RETURN
END ;
CloseSource
ELSE
fprintf1(StdErr, 'failed to open %s\n', FileName) ;
exit(1)
END ;
ModuleType := Implementation
ELSE
ModuleType := Program
END ;
FileName := GetModuleFile(Sym) ;
IF FileName#NIL
THEN
IF Debugging
THEN
name := GetSymName(Sym) ;
qprintf1(' Module %a\n', name)
END ;
IF OpenSource(FileName)
THEN
IF NOT P2Build.CompilationUnit()
THEN
MetaError0('compilation failed') ;
CloseSource ;
RETURN
END ;
CloseSource
ELSE
fprintf1(StdErr, 'failed to open %s\n', FileName) ;
exit(1)
END
END ;
INC(i) ;
Sym := GetModuleNo(i)
END ;
SetPassToNoPass
END DoPass2 ;
(*
DoPassC - parses the sources of all modules necessary to compile
the required module, Main.
*)
PROCEDURE DoPassC ;
VAR
name : Name ;
Sym : CARDINAL ;
i : CARDINAL ;
FileName: String ;
BEGIN
SetPassToPassC ;
i := 1 ;
Sym := GetModuleNo(i) ;
WHILE Sym#NulSym DO
FileName := GetDefinitionModuleFile(Sym) ;
IF FileName#NIL
THEN
IF Debugging
THEN
name := GetSymName(Sym) ;
qprintf1(' Module %a\n', name)
END ;
IF OpenSource(FileName)
THEN
ModuleType := Definition ;
IF NOT PCBuild.CompilationUnit()
THEN
MetaError0('compilation failed') ;
CloseSource ;
RETURN
END ;
CloseSource
ELSE
fprintf1(StdErr, 'failed to open %s\n', FileName) ;
exit(1)
END ;
ModuleType := Implementation
ELSE
ModuleType := Program
END ;
FileName := GetModuleFile(Sym) ;
IF FileName#NIL
THEN
IF Debugging
THEN
name := GetSymName(Sym) ;
qprintf1(' Module %a\n', name)
END ;
IF OpenSource(FileName)
THEN
IF NOT PCBuild.CompilationUnit()
THEN
MetaError0('compilation failed') ;
CloseSource ;
RETURN
END ;
CloseSource
ELSE
fprintf1(StdErr, 'failed to open %s\n', FileName) ;
exit(1)
END
END ;
INC(i) ;
Sym := GetModuleNo(i)
END ;
PCSymBuild.ResolveConstTypes ;
ResolveConstructorTypes ;
SanityCheckConstants ;
SetPassToNoPass
END DoPassC ;
(*
DoPass3 - parses the sources of all modules necessary to compile
the required module, Main.
*)
PROCEDURE DoPass3 ;
VAR
Main,
Sym : CARDINAL ;
i : CARDINAL ;
FileName: String ;
BEGIN
SetPassToPass3 ;
Main := GetMainModule() ;
i := 1 ;
Sym := GetModuleNo(i) ;
WHILE Sym#NulSym DO
FileName := GetDefinitionModuleFile(Sym) ;
IF FileName#NIL
THEN
IF OpenSource(FileName)
THEN
ModuleType := Definition ;
IF NOT P3Build.CompilationUnit()
THEN
MetaError0('compilation failed') ;
CloseSource ;
RETURN
END ;
CloseSource
ELSE
fprintf1(StdErr, 'failed to open %s\n', FileName) ;
exit(1)
END ;
ModuleType := Implementation
ELSE
ModuleType := Program
END ;
FileName := GetModuleFile(Sym) ;
IF FileName#NIL
THEN
IF OpenSource(FileName)
THEN
IF (Main=Sym) OR WholeProgram
THEN
IF NOT P3Build.CompilationUnit()
THEN
MetaError0('compilation failed') ;
CloseSource ;
RETURN
END
ELSE
(*
not the main module .mod therefore must be implementing
a hidden type - we dont want to generate any
StatementSequence quadrupes but we do want to build TYPEs
and ConstExpressions.
*)
SetPassToNoPass ;
SetPassToPassHidden ;
IF NOT PHBuild.CompilationUnit()
THEN
MetaError0('compilation failed') ;
CloseSource ;
RETURN
END ;
SetPassToNoPass ;
SetPassToPass3
END ;
CloseSource
ELSE
fprintf1(StdErr, 'failed to open %s\n', FileName) ;
exit(1)
END
END ;
INC(i) ;
Sym := GetModuleNo(i)
END ;
SetPassToNoPass
END DoPass3 ;
BEGIN
ModuleType := None
END M2Comp.

View file

@ -0,0 +1,39 @@
(* M2Const.def maintain and resolve the types of constants.
Copyright (C) 2010-2022 Free Software Foundation, Inc.
Contributed by Gaius Mulley <gaius.mulley@southwales.ac.uk>.
This file is part of GNU Modula-2.
GNU Modula-2 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 3, or (at your option)
any later version.
GNU Modula-2 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 GNU Modula-2; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. *)
DEFINITION MODULE M2Const ;
(*
Title : M2Const
Author : Gaius Mulley
System : GNU Modula-2
Date : Thu Dec 23 15:02:59 2010
Revision : $Version$
Description: provides a module which maintains and resolves the types of constants.
*)
EXPORT QUALIFIED constType ;
TYPE
constType = (unknown, set, str, constructor, array, cast, boolean, ztype, rtype, ctype, procedure, char) ;
END M2Const.

View file

@ -0,0 +1,501 @@
(* M2Const.mod maintain and resolve the types of constants.
Copyright (C) 2010-2022 Free Software Foundation, Inc.
Contributed by Gaius Mulley <gaius.mulley@southwales.ac.uk>.
This file is part of GNU Modula-2.
GNU Modula-2 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 3, or (at your option)
any later version.
GNU Modula-2 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 GNU Modula-2; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. *)
IMPLEMENTATION MODULE M2Const ;
(*
CONST
Debugging = FALSE ;
DebugConsts = FALSE ;
TYPE
constList = POINTER TO cList ;
cList = RECORD
constsym : CARDINAL ;
constmeta: constType ;
expr : CARDINAL ;
type : CARDINAL ;
next : constList ;
END ;
VAR
headOfConsts: constList ;
PROCEDURE stop ; BEGIN END stop ;
(*
addToConstList - add a constant, sym, to the head of the constants list.
*)
PROCEDURE addToConstList (sym: CARDINAL) ;
VAR
h: constList ;
BEGIN
h := headOfConsts ;
WHILE h#NIL DO
IF h^.constsym=sym
THEN
InternalError ('should never see the same symbol id declared twice')
END ;
h := h^.next
END ;
NEW(h) ;
WITH h^ DO
constsym := sym ;
constmeta := unknown ;
expr := NulSym ;
type := NulSym ;
next := headOfConsts
END ;
headOfConsts := h
END addToConstList ;
(*
FixupConstAsString - fixes up a constant, sym, which will have the string type.
*)
PROCEDURE FixupConstAsString (sym: CARDINAL) ;
BEGIN
fixupConstMeta(sym, str)
END FixupConstAsString ;
(*
FixupConstType - fixes up a constant, sym, which will have the type, consttype.
*)
PROCEDURE FixupConstType (sym: CARDINAL; consttype: CARDINAL) ;
VAR
h: constList ;
BEGIN
h := headOfConsts ;
WHILE h#NIL DO
WITH h^ DO
IF constsym=sym
THEN
IF constmeta=str
THEN
InternalError ('cannot fix up a constant to have a type if it is already known as a string')
END ;
type := consttype ;
PutConst(sym, consttype) ;
RETURN
END
END ;
h := h^.next
END
END FixupConstType ;
(*
FixupProcedureType - creates a proctype from a procedure.
*)
PROCEDURE FixupProcedureType (p: CARDINAL) : CARDINAL ;
VAR
par,
t : CARDINAL ;
n, i: CARDINAL ;
BEGIN
IF IsProcedure(p)
THEN
t := MakeProcType(CheckAnonymous(NulName)) ;
i := 1 ;
n := NoOfParam(p) ;
WHILE i<=n DO
par := GetParam(p, i) ;
IF IsParameterVar(par)
THEN
PutProcTypeVarParam(t, GetType(par), IsParameterUnbounded(par))
ELSE
PutProcTypeParam(t, GetType(par), IsParameterUnbounded(par))
END ;
INC(i)
END ;
IF GetType(p)#NulSym
THEN
PutFunction(t, GetType(p))
END ;
RETURN( t )
ELSE
InternalError ('expecting a procedure')
END ;
RETURN( NulSym )
END FixupProcedureType ;
(*
FixupConstProcedure - fixes up a constant, sym, which will be equivalent to e.
*)
PROCEDURE FixupConstProcedure (sym: CARDINAL; e: CARDINAL) ;
VAR
h: constList ;
BEGIN
h := headOfConsts ;
WHILE h#NIL DO
WITH h^ DO
IF constsym=sym
THEN
expr := e ;
type := FixupProcedureType(e) ;
PutConst(sym, type) ;
RETURN
END
END ;
h := h^.next
END
END FixupConstProcedure ;
(*
FixupConstExpr - fixes up a constant, sym, which will be equivalent to e.
*)
PROCEDURE FixupConstExpr (sym: CARDINAL; e: CARDINAL) ;
VAR
h: constList ;
BEGIN
h := headOfConsts ;
WHILE h#NIL DO
WITH h^ DO
IF constsym=sym
THEN
expr := e ;
RETURN
END
END ;
h := h^.next
END
END FixupConstExpr ;
(*
fixupConstMeta - fixes up symbol, sym, to have the, meta, constType.
*)
PROCEDURE FixupConstMeta (sym: CARDINAL; meta: constType) ;
VAR
h: constList ;
BEGIN
h := headOfConsts ;
WHILE h#NIL DO
WITH h^ DO
IF constsym=sym
THEN
constmeta := meta ;
RETURN
END
END ;
h := h^.next
END
END FixupConstMeta ;
(*
fixupConstCast -
*)
PROCEDURE fixupConstCast (sym: CARDINAL; castType: CARDINAL) ;
VAR
h: constList ;
BEGIN
h := headOfConsts ;
WHILE h#NIL DO
WITH h^ DO
IF constsym=sym
THEN
type := castType ;
RETURN
END
END ;
h := h^.next
END
END fixupConstCast ;
(*
findConstType -
*)
PROCEDURE findConstType (sym: CARDINAL) : CARDINAL ;
VAR
h: constList ;
t: CARDINAL ;
BEGIN
h := headOfConsts ;
WHILE h#NIL DO
WITH h^ DO
IF constsym=sym
THEN
t := GetType(sym) ;
IF t=NulSym
THEN
RETURN( NulSym )
ELSE
RETURN( t )
END
END
END ;
h := h^.next
END ;
RETURN( NulSym )
END findConstType ;
(*
findConstMeta -
*)
PROCEDURE findConstMeta (sym: CARDINAL) : constType ;
VAR
h: constList ;
BEGIN
h := headOfConsts ;
WHILE h#NIL DO
WITH h^ DO
IF constsym=sym
THEN
RETURN( constmeta )
END
END ;
h := h^.next
END ;
RETURN( unknown )
END findConstMeta ;
(*
ReportUnresolvedConstTypes - emits an error message for any unresolved constant type.
*)
PROCEDURE ReportUnresolvedConstTypes ;
VAR
h: constList ;
BEGIN
h := headOfConsts ;
WHILE h#NIL DO
WITH h^ DO
IF (constmeta#unknown) AND (constmeta#str) AND (type=NulSym)
THEN
MetaError1('unable to resolve the type of the constant {%1Dad}', h^.constsym)
END
END ;
h := h^.next
END
END ReportUnresolvedConstTypes ;
(*
DebugMeta -
*)
PROCEDURE DebugMeta (h: constList) ;
VAR
n: Name ;
BEGIN
IF DebugConsts
THEN
WITH h^ DO
n := GetSymName(constsym) ;
printf1('constant %a ', n) ;
IF type=NulSym
THEN
printf0('type is unknown\n')
ELSE
printf0('type is known\n')
END
END
END
END DebugMeta ;
(*
constTypeResolved -
*)
PROCEDURE constTypeResolved (h: constList) : BOOLEAN ;
BEGIN
RETURN( h^.type#NulSym )
END constTypeResolved ;
(*
constExprResolved -
*)
PROCEDURE constExprResolved (h: constList) : BOOLEAN ;
BEGIN
RETURN( h^.expr#NulSym )
END constExprResolved ;
(*
findConstMetaExpr -
*)
PROCEDURE findConstMetaExpr (h: constList) : constType ;
BEGIN
RETURN( h^.constmeta )
END findConstMetaExpr ;
(*
constResolveViaMeta -
*)
PROCEDURE constResolveViaMeta (h: constList) : BOOLEAN ;
VAR
n: Name ;
BEGIN
WITH h^ DO
IF findConstMetaExpr(h)=str
THEN
PutConstString(constsym, MakeKey('')) ;
IF DebugConsts
THEN
n := GetSymName(constsym) ;
printf1('resolved constant %a as a string\n', n)
END ;
RETURN( TRUE )
END
END ;
RETURN( FALSE )
END constResolveViaMeta ;
(*
constResolvedViaType -
*)
PROCEDURE constResolvedViaType (h: constList) : BOOLEAN ;
VAR
n: Name ;
BEGIN
WITH h^ DO
type := findConstType(expr) ;
IF type#NulSym
THEN
PutConst(constsym, type) ;
IF DebugConsts
THEN
n := GetSymName(constsym) ;
printf1('resolved type of constant %a\n', n)
END ;
RETURN( TRUE )
END
END ;
RETURN( FALSE )
END constResolvedViaType ;
(*
resolveConstType -
*)
PROCEDURE resolveConstType (h: constList) : BOOLEAN ;
BEGIN
WITH h^ DO
IF (constmeta=unknown) OR (constmeta=str)
THEN
(* do nothing *)
ELSE
DebugMeta(h) ;
IF constTypeResolved(h)
THEN
(* nothing to do *)
ELSE
IF constExprResolved(h)
THEN
IF constResolveViaMeta(h)
THEN
RETURN( TRUE )
ELSIF constResolvedViaType(h)
THEN
RETURN( TRUE )
END
END
END
END
END ;
RETURN( FALSE )
END resolveConstType ;
(*
ResolveConstTypes - resolves the types of all aggegrate constants.
*)
PROCEDURE ResolveConstTypes ;
VAR
h : constList ;
changed: BOOLEAN ;
BEGIN
REPEAT
changed := FALSE ;
h := headOfConsts ;
WHILE h#NIL DO
changed := resolveConstType(h) ;
h := h^.next
END
UNTIL NOT changed ;
ReportUnresolvedConstTypes
END ResolveConstTypes ;
(*
SkipConst - returns the symbol which is a pseudonum of, sym.
*)
PROCEDURE SkipConst (sym: CARDINAL) : CARDINAL ;
VAR
init: CARDINAL ;
h : constList ;
BEGIN
init := sym ;
h := headOfConsts ;
WHILE h#NIL DO
IF (h^.constsym=sym) AND (h^.expr#NulSym)
THEN
sym := h^.expr ;
IF sym=init
THEN
(* circular definition found *)
RETURN( sym )
END ;
h := headOfConsts
ELSE
h := h^.next
END
END ;
RETURN( sym )
END SkipConst ;
BEGIN
headOfConsts := NIL
*)
BEGIN
END M2Const.

View file

@ -0,0 +1,49 @@
(* M2Debug.def simple debugging facilities in the Modula-2 compiler.
Copyright (C) 2001-2022 Free Software Foundation, Inc.
Contributed by Gaius Mulley <gaius.mulley@southwales.ac.uk>.
This file is part of GNU Modula-2.
GNU Modula-2 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 3, or (at your option)
any later version.
GNU Modula-2 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 GNU Modula-2; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. *)
DEFINITION MODULE M2Debug ;
(*
Author : Gaius Mulley
Title : M2Debug
Date : 30/5/87
Description: Implements the Debugging facilities in the Modula-2 compiler.
Last update: 30/5/87
*)
EXPORT QUALIFIED Assert, WriteDebug ;
(*
Assert - tests the boolean, q. If false then an error is reported
and the execution is HALTed.
*)
PROCEDURE Assert (q: BOOLEAN) ;
(*
WriteDebug - only writes a string if the debugging mode is on.
*)
PROCEDURE WriteDebug (a: ARRAY OF CHAR) ;
END M2Debug.

View file

@ -0,0 +1,57 @@
(* M2Debug.mod simple debugging facilities in the Modula-2 compiler.
Copyright (C) 2001-2022 Free Software Foundation, Inc.
Contributed by Gaius Mulley <gaius.mulley@southwales.ac.uk>.
This file is part of GNU Modula-2.
GNU Modula-2 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 3, or (at your option)
any later version.
GNU Modula-2 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 GNU Modula-2; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. *)
IMPLEMENTATION MODULE M2Debug ;
FROM StrIO IMPORT WriteString, WriteLn ;
FROM M2Error IMPORT InternalError ;
FROM M2Options IMPORT CompilerDebugging ;
(*
Assert - tests the boolean, q. If false then an error is reported
and the execution is HALTed.
*)
PROCEDURE Assert (q: BOOLEAN) ;
BEGIN
IF NOT q
THEN
InternalError ('assert failed')
END
END Assert ;
(*
WriteDebug - only writes a string if the debugging mode is on.
*)
PROCEDURE WriteDebug (a: ARRAY OF CHAR) ;
BEGIN
IF CompilerDebugging
THEN
WriteString(a) ; WriteLn
END
END WriteDebug ;
END M2Debug.

View file

@ -0,0 +1,51 @@
(* M2DebugStack.def display parameter stack.
Copyright (C) 2011-2022 Free Software Foundation, Inc.
Contributed by Gaius Mulley <gaius.mulley@southwales.ac.uk>.
This file is part of GNU Modula-2.
GNU Modula-2 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 3, or (at your option)
any later version.
GNU Modula-2 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 GNU Modula-2; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. *)
DEFINITION MODULE M2DebugStack ;
(*
Title : M2DebugStack
Author : Gaius Mulley
System : GNU Modula-2
Date : Mon Dec 5 16:19:43 2011
Revision : $Version$
Description: provides a procedure which displays the
compile time stack neatly and with annotation.
*)
FROM SYSTEM IMPORT WORD ;
FROM DynamicStrings IMPORT String ;
TYPE
ProcedureWord = PROCEDURE (CARDINAL) : WORD ;
ProcedureString = PROCEDURE (CARDINAL) : String ;
(*
DebugStack - displays the stack.
*)
PROCEDURE DebugStack (amount: CARDINAL;
opt, opf, opa, opd, oprw, optk: ProcedureWord;
opanno: ProcedureString) ;
END M2DebugStack.

View file

@ -0,0 +1,884 @@
(* M2DebugStack.mod display parameter stack.
Copyright (C) 2011-2022 Free Software Foundation, Inc.
Contributed by Gaius Mulley <gaius.mulley@southwales.ac.uk>.
This file is part of GNU Modula-2.
GNU Modula-2 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 3, or (at your option)
any later version.
GNU Modula-2 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 GNU Modula-2; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. *)
IMPLEMENTATION MODULE M2DebugStack ;
FROM DynamicStrings IMPORT InitString, KillString, Dup, Index, Slice, char,
ConCat, ConCatChar, InitStringCharStar, Length, Mark ;
FROM SymbolTable IMPORT IsConstLit, IsConstSet, IsConstructor, IsConst,
IsArray, IsVar, IsEnumeration, IsFieldEnumeration,
IsUnbounded, IsProcType, IsProcedure, IsPointer, IsParameter,
IsParameterVar, IsType, IsRecord, IsRecordField, IsVarient,
IsModule, IsDefImp, IsSet, IsSubrange, GetSymName, NulSym ;
FROM StringConvert IMPORT CardinalToString ;
FROM NameKey IMPORT Name, KeyToCharStar ;
FROM FIO IMPORT File, StdOut ;
FROM SFIO IMPORT WriteS ;
FROM M2Error IMPORT InternalError ;
FROM M2Printf IMPORT printf0, printf1, printf2, printf3, printf4 ;
CONST
Debugging = FALSE ;
VAR
OperandTok,
OperandT,
OperandF,
OperandA,
OperandD,
OperandRW : ProcedureWord ;
OperandAnno: ProcedureString ;
(*
x - checks to see that a=b.
*)
PROCEDURE x (a, b: String) : String ;
BEGIN
IF a#b
THEN
InternalError ('different string returned')
END ;
RETURN( a )
END x ;
(*
IsWhite - returns TRUE if, ch, is a space.
*)
PROCEDURE IsWhite (ch: CHAR) : BOOLEAN ;
BEGIN
RETURN( ch=' ' )
END IsWhite ;
(*
ConCatWord - joins sentances, a, b, together.
*)
PROCEDURE ConCatWord (a, b: String) : String ;
BEGIN
IF (Length(a)=1) AND (char(a, 0)='a')
THEN
a := x(a, ConCatChar(a, 'n'))
ELSIF (Length(a)>1) AND (char(a, -1)='a') AND IsWhite(char(a, -2))
THEN
a := x(a, ConCatChar(a, 'n'))
END ;
IF (Length(a)>0) AND (NOT IsWhite(char(a, -1)))
THEN
a := x(a, ConCatChar(a, ' '))
END ;
RETURN( x(a, ConCat(a, b)) )
END ConCatWord ;
(*
symDesc -
*)
PROCEDURE symDesc (sym: CARDINAL; o: String) : String ;
BEGIN
IF sym = NulSym
THEN
RETURN( ConCatWord(o, Mark(InitString('NulSym'))) )
ELSIF IsConstLit(sym)
THEN
RETURN( ConCatWord(o, Mark(InitString('constant literal'))) )
ELSIF IsConstSet(sym)
THEN
RETURN( ConCatWord(o, Mark(InitString('constant set'))) )
ELSIF IsConstructor(sym)
THEN
RETURN( ConCatWord(o, Mark(InitString('constructor'))) )
ELSIF IsConst(sym)
THEN
RETURN( ConCatWord(o, Mark(InitString('constant'))) )
ELSIF IsArray(sym)
THEN
RETURN( ConCatWord(o, Mark(InitString('array'))) )
ELSIF IsVar(sym)
THEN
RETURN( ConCatWord(o, Mark(InitString('variable'))) )
ELSIF IsEnumeration(sym)
THEN
RETURN( ConCatWord(o, Mark(InitString('enumeration type'))) )
ELSIF IsFieldEnumeration(sym)
THEN
RETURN( ConCatWord(o, Mark(InitString('enumeration field'))) )
ELSIF IsUnbounded(sym)
THEN
RETURN( ConCatWord(o, Mark(InitString('unbounded parameter'))) )
ELSIF IsProcType(sym)
THEN
RETURN( ConCatWord(o, Mark(InitString('procedure type'))) )
ELSIF IsProcedure(sym)
THEN
RETURN( ConCatWord(o, Mark(InitString('procedure'))) )
ELSIF IsPointer(sym)
THEN
RETURN( ConCatWord(o, Mark(InitString('pointer'))) )
ELSIF IsParameter(sym)
THEN
IF IsParameterVar(sym)
THEN
RETURN( ConCatWord(o, Mark(InitString('var parameter'))) )
ELSE
RETURN( ConCatWord(o, Mark(InitString('parameter'))) )
END
ELSIF IsType(sym)
THEN
RETURN( ConCatWord(o, Mark(InitString('type'))) )
ELSIF IsRecord(sym)
THEN
RETURN( ConCatWord(o, Mark(InitString('record'))) )
ELSIF IsRecordField(sym)
THEN
RETURN( ConCatWord(o, Mark(InitString('record field'))) )
ELSIF IsVarient(sym)
THEN
RETURN( ConCatWord(o, Mark(InitString('varient record'))) )
ELSIF IsModule(sym)
THEN
RETURN( ConCatWord(o, Mark(InitString('module'))) )
ELSIF IsDefImp(sym)
THEN
RETURN( ConCatWord(o, Mark(InitString('definition or implementation module'))) )
ELSIF IsSet(sym)
THEN
RETURN( ConCatWord(o, Mark(InitString('set'))) )
ELSIF IsSubrange(sym)
THEN
RETURN( ConCatWord(o, Mark(InitString('subrange'))) )
ELSE
RETURN( o )
END
END symDesc ;
(*
Output - output string, s, to Stdout. It also disposes of the string, s.
*)
PROCEDURE Output (s: String) ;
BEGIN
s := WriteS(StdOut, s) ;
s := KillString(s)
END Output ;
(*
GetComment -
*)
PROCEDURE GetComment (s: String) : INTEGER ;
VAR
c: INTEGER ;
BEGIN
c := Index(s, '|', 0) ;
WHILE c>=0 DO
INC(c) ;
IF c>=VAL(INTEGER, Length(s))
THEN
RETURN -1
ELSIF char(s, c)='|'
THEN
RETURN c+1
END ;
c := Index(s, '|', c)
END ;
RETURN -1
END GetComment ;
(*
doName - concatenate namekey, o, to, p.
*)
PROCEDURE doName (p: String; o: WORD) : String ;
BEGIN
RETURN ConCat(p, InitStringCharStar(KeyToCharStar(o))) ;
END doName ;
(*
doSymName - concatenate symbol, o, name to, p.
*)
PROCEDURE doSymName (p: String; o: WORD) : String ;
BEGIN
RETURN ConCat(p, InitStringCharStar(KeyToCharStar(GetSymName(o)))) ;
END doSymName ;
(*
doNumber - convert, o, to a cardinal and increment the length, l,
by the number of characters required to represent, o.
*)
PROCEDURE doNumber (p: String; o: WORD) : String ;
BEGIN
RETURN ConCat(p, CardinalToString(VAL(CARDINAL, o), 0, ' ', 10, TRUE))
END doNumber ;
(*
doSymbol - handles a symbol indicated by, o.
*)
PROCEDURE doSymbol (p: String; o: WORD) : String ;
BEGIN
RETURN symDesc(o, p)
END doSymbol ;
(*
doOperand -
*)
PROCEDURE doOperand (p, s: String; VAR i: INTEGER; e: INTEGER; o: WORD) : String ;
BEGIN
INC(i) ;
IF i<e
THEN
CASE char(s, i) OF
's': (* symbol number *)
INC(i) ;
RETURN doSymbol(p, o) |
'd': (* decimal number *)
INC(i) ;
RETURN doNumber(p, o) |
'a': (* symbol name key *)
INC(i) ;
RETURN doSymName(p, o) |
'n': (* ascii name key *)
INC(i) ;
RETURN doName(p, o)
ELSE
InternalError ("incorrect format specifier expecting one of 's', 'd' or 'a'")
END
END ;
RETURN p
END doOperand ;
(*
doPercent -
*)
PROCEDURE doPercent (o, s: String;
VAR i: INTEGER; e: INTEGER; n: CARDINAL) : String ;
BEGIN
INC(i) ;
IF i<e
THEN
CASE char(s, i) OF
'1': RETURN doOperand(o, s, i, e, OperandT(n)) |
'2': RETURN doOperand(o, s, i, e, OperandF(n)) |
'3': RETURN doOperand(o, s, i, e, OperandTok(n))
ELSE
InternalError ('unrecognised format specifier - expecting 1, 2 or 3 after the %')
END
END ;
InternalError ('end of field found before format specifier - expecting 1, 2 or 3 after the %')
END doPercent ;
(*
doNameLength - increment, l, by the ascii length of string determined by, o.
*)
PROCEDURE doNameLength (VAR l: CARDINAL; o: WORD) ;
VAR
s: String ;
BEGIN
s := InitStringCharStar(KeyToCharStar(o)) ;
INC(l, Length(s)) ;
s := KillString(s)
END doNameLength ;
(*
doSymNameLength - increment, l, by the ascii length of symbol, o.
*)
PROCEDURE doSymNameLength (VAR l: CARDINAL; o: WORD) ;
VAR
s: String ;
BEGIN
s := InitStringCharStar(KeyToCharStar(GetSymName(o))) ;
INC(l, Length(s)) ;
s := KillString(s)
END doSymNameLength ;
(*
doNumberLength - convert, o, to a cardinal and increment the length, l,
by the number of characters required to represent, o.
*)
PROCEDURE doNumberLength (VAR l: CARDINAL; o: WORD) ;
VAR
s: String ;
BEGIN
s := CardinalToString(VAL(CARDINAL, o), 0, ' ', 10, TRUE) ;
INC(l, Length(s)) ;
s := KillString(s)
END doNumberLength ;
(*
doSymbolLength - handles a symbol indicated by, o.
*)
PROCEDURE doSymbolLength (VAR l: CARDINAL; o: WORD) ;
VAR
s: String ;
BEGIN
s := symDesc(o, InitString('')) ;
INC(l, Length(s)) ;
s := KillString(s)
END doSymbolLength ;
(*
doOperandLength -
*)
PROCEDURE doOperandLength (s: String; VAR i: INTEGER; e: INTEGER; VAR l: CARDINAL; o: WORD) ;
BEGIN
INC(i) ;
IF i<e
THEN
CASE char(s, i) OF
's': (* symbol number *)
INC(i) ;
doSymbolLength(l, o) |
'd': (* decimal number *)
INC(i) ;
doNumberLength(l, o) |
'a': (* ascii name key *)
INC(i) ;
doSymNameLength(l, o) |
'n': (* ascii name key *)
INC(i) ;
doNameLength(l, o)
ELSE
InternalError ("incorrect format specifier expecting one of 's', 'd' or 'a'")
END
END
END doOperandLength ;
(*
doPercentLength -
*)
PROCEDURE doPercentLength (s: String; VAR i: INTEGER; e: INTEGER;
VAR l: CARDINAL; n: CARDINAL) ;
BEGIN
INC(i) ;
IF i<e
THEN
CASE char(s, i) OF
'1': doOperandLength(s, i, e, l, OperandT(n)) |
'2': doOperandLength(s, i, e, l, OperandF(n)) |
'3': doOperandLength(s, i, e, l, OperandTok(n)) |
ELSE
InternalError ('unrecognised format specifier - expecting 1, 2 or 3 after the %')
END
END
END doPercentLength ;
(*
doFieldLength - compute the string length given in annotation
at position, n, on the stack between characters
b and e.
The string description between: b..e can contain any
of these patterns:
%a ascii name key.
%s symbol number.
%d decimal cardinal number.
| indicates the next field.
*)
PROCEDURE doFieldLength (b, e: INTEGER; n: CARDINAL) : CARDINAL ;
VAR
l: CARDINAL ;
i: INTEGER ;
s: String ;
BEGIN
IF b=-1
THEN
RETURN( 0 )
END ;
s := OperandAnno(n) ;
IF e=-1
THEN
e := Length(s)
END ;
l := 0 ;
i := b ;
WHILE i<e DO
CASE char(s, i) OF
'|': RETURN l |
'%': doPercentLength(s, i, e, l, n) ;
ELSE
INC(l)
END ;
INC(i)
END ;
RETURN l
END doFieldLength ;
(*
stop -
*)
PROCEDURE stop ;
BEGIN
END stop ;
(*
doMaxCard - returns the maximum of two CARDINALs.
*)
PROCEDURE doMaxCard (a, b: CARDINAL) : CARDINAL ;
BEGIN
IF (a>100) OR (b>100)
THEN
stop
END ;
IF a>b
THEN
RETURN a
ELSE
RETURN b
END
END doMaxCard ;
(*
GetAnnotationFieldLength -
*)
PROCEDURE GetAnnotationFieldLength (n: CARDINAL; f: CARDINAL) : CARDINAL ;
VAR
c, e: INTEGER ;
BEGIN
c := GetComment(OperandAnno(n)) ;
IF c>0
THEN
IF Debugging
THEN
printf0('full anno is: ') ; Output(Dup(OperandAnno(n))) ; printf0('\n') ;
printf0('comment field is: ') ; Output(Slice(OperandAnno(n), c, 0)) ; printf0('\n')
END ;
e := Index(OperandAnno(n), '|', c) ;
IF f=0
THEN
RETURN doFieldLength(c, e, n)
ELSE
IF e>=0
THEN
INC(e)
END ;
RETURN doFieldLength(e, -1, n)
END
ELSE
RETURN 0
END
END GetAnnotationFieldLength ;
(*
GetAnnotationLength -
*)
PROCEDURE GetAnnotationLength (n: CARDINAL; f: CARDINAL) : CARDINAL ;
VAR
l: CARDINAL ;
BEGIN
IF OperandAnno(n)=NIL
THEN
l := 0 ;
IF f=0
THEN
doNumberLength(l, OperandT(n))
ELSE
doNumberLength(l, OperandF(n))
END ;
RETURN l
ELSE
RETURN GetAnnotationFieldLength(n, f)
END
END GetAnnotationLength ;
(*
GetFieldLength - returns the number of characters used in field, f,
at position, n, on the stack.
*)
PROCEDURE GetFieldLength (n: CARDINAL; f: CARDINAL) : CARDINAL ;
VAR
c, b, e: INTEGER ;
BEGIN
c := GetComment(OperandAnno(n)) ;
IF c>1
THEN
e := c-2
ELSE
e := Length(OperandAnno(n))
END ;
IF f=0
THEN
b := 0
ELSE
b := Index(OperandAnno(n), '|', 0) ;
IF b=-1
THEN
RETURN 0
ELSE
INC(b)
END
END ;
RETURN doFieldLength(b, e, n)
END GetFieldLength ;
(*
GetMaxFieldAnno - returns the maximum number of characters required
by either the annotation or field, f, at position, n,
on the stack.
*)
PROCEDURE GetMaxFieldAnno (n: CARDINAL; f: CARDINAL) : CARDINAL ;
BEGIN
RETURN doMaxCard(GetAnnotationLength(n, f), GetFieldLength(n, f))
END GetMaxFieldAnno ;
(*
GetStackFieldLengths - assigns, tn, and, fn, with the
maximum field width values.
*)
PROCEDURE GetStackFieldLengths (VAR tn, fn, tk: CARDINAL; amount: CARDINAL) ;
VAR
i: CARDINAL ;
BEGIN
i := 1 ;
tn := 0 ;
fn := 0 ;
tk := 0 ;
WHILE i<=amount DO
tn := doMaxCard(tn, GetMaxFieldAnno(i, 0)) ;
fn := doMaxCard(fn, GetMaxFieldAnno(i, 1)) ;
tk := doMaxCard(tk, GetMaxFieldAnno(i, 2)) ;
INC(i)
END
END GetStackFieldLengths ;
(*
DisplayRow -
*)
PROCEDURE DisplayRow (tn, fn, tk: CARDINAL; initOrFinal: BOOLEAN) ;
VAR
i: CARDINAL ;
BEGIN
printf0('+-') ;
FOR i := 1 TO tn DO
printf0('-')
END ;
IF (fn=0) AND (tk=0)
THEN
IF initOrFinal
THEN
printf0('-+-')
ELSE
printf0('-|-')
END
ELSE
IF initOrFinal
THEN
printf0('-+-')
ELSE
printf0('-|-')
END ;
IF fn#0
THEN
FOR i := 1 TO fn DO
printf0('-')
END
END ;
IF initOrFinal
THEN
printf0('-+-')
ELSE
printf0('-|-')
END ;
IF tk#0
THEN
FOR i := 1 TO tk DO
printf0('-')
END ;
printf0('-+\n')
END
END
END DisplayRow ;
(*
SkipToField -
*)
PROCEDURE SkipToField (s: String; n: CARDINAL) : INTEGER ;
VAR
i, h: INTEGER ;
BEGIN
i := 0 ;
h := Length(s) ;
WHILE (n>0) AND (i<h) DO
IF Index(s, '|', i)>0
THEN
DEC(n) ;
IF (i<h) AND (char(s, i+1)='|')
THEN
(* comment seen, no field available *)
RETURN -1
END ;
i := Index(s, '|', i)
ELSE
RETURN -1
END ;
INC(i)
END ;
IF i=h
THEN
i := -1
END ;
RETURN i
END SkipToField ;
(*
Pad - padds out string, s, to paddedLength characters.
*)
PROCEDURE Pad (o: String; paddedLength: CARDINAL) : String ;
VAR
i: CARDINAL ;
BEGIN
i := Length(o) ;
IF i<paddedLength
THEN
REPEAT
o := ConCatChar(o, ' ') ;
INC(i)
UNTIL i=paddedLength
END ;
RETURN o
END Pad ;
(*
doField - compute the string length given in annotation
at position, n, on the stack between characters
b and e.
The string description between: b..e can contain any
of these patterns:
%a ascii name key.
%s symbol number.
%d decimal cardinal number.
| indicates the next field.
*)
PROCEDURE doField (s: String; n: CARDINAL; f: CARDINAL; l: CARDINAL) : String ;
VAR
h, i, j: INTEGER ;
o : String ;
BEGIN
h := Length(s) ;
i := SkipToField(s, f) ;
o := InitString('') ;
IF i>=0
THEN
j := SkipToField(s, f+1) ;
IF j=-1
THEN
j := h
END ;
WHILE i<h DO
CASE char(s, i) OF
'|': i := h |
'%': o := doPercent(o, s, i, h, n)
ELSE
o := ConCatChar(o, char(s, i)) ;
INC(i)
END
END
END ;
o := Pad(o, l) ;
RETURN o
END doField ;
(*
doAnnotation -
*)
PROCEDURE doAnnotation (s: String; n: CARDINAL;
field: CARDINAL; width: CARDINAL) : String ;
VAR
c : INTEGER ;
cf, o: String ;
BEGIN
c := GetComment(s) ;
IF c>=0
THEN
cf := Slice(s, c, 0) ;
o := doField(cf, n, field, width) ;
cf := KillString(cf) ;
RETURN o
ELSE
RETURN InitString('')
END
END doAnnotation ;
(*
DisplayFields -
*)
PROCEDURE DisplayFields (n: CARDINAL; tn, fn, tk: CARDINAL) ;
VAR
s : String ;
t, f, k: CARDINAL ;
BEGIN
s := OperandAnno(n) ;
IF s=NIL
THEN
t := OperandT(n) ;
f := OperandF(n) ;
k := OperandTok(n) ;
printf0('| ') ;
Output(Pad(CardinalToString(VAL(CARDINAL, t), 0, ' ', 10, TRUE), tn)) ;
printf0(' | ') ;
Output(Pad(CardinalToString(VAL(CARDINAL, f), 0, ' ', 10, TRUE), fn)) ;
printf0(' | ') ;
Output(Pad(CardinalToString(VAL(CARDINAL, k), 0, ' ', 10, TRUE), tk)) ;
printf0(' |\n')
ELSE
IF tn>0
THEN
printf0('| ') ;
Output(doField(s, n, 0, tn))
END ;
IF fn>0
THEN
printf0(' | ') ;
Output(doField(s, n, 1, fn))
END ;
IF tk>0
THEN
printf0(' | ') ;
Output(doField(s, n, 2, tk))
END ;
printf0(' |\n') ;
IF tn>0
THEN
printf0('| ') ;
Output(doAnnotation(s, n, 0, tn))
END ;
IF fn>0
THEN
printf0(' | ') ;
Output(doAnnotation(s, n, 1, fn))
END ;
IF tk>0
THEN
printf0(' | ') ;
Output(doAnnotation(s, n, 2, tk))
END ;
printf0(' |\n')
END
END DisplayFields ;
(*
DebugStack - displays the stack.
*)
PROCEDURE DebugStack (amount: CARDINAL;
opt, opf, opa, opd, oprw, optk: ProcedureWord;
opanno: ProcedureString) ;
VAR
i : CARDINAL ;
tn, fn, tk: CARDINAL ;
BEGIN
OperandT := opt ;
OperandF := opf ;
OperandA := opa ;
OperandD := opd ;
OperandRW := oprw ;
OperandAnno := opanno ;
OperandTok := optk ;
GetStackFieldLengths(tn, fn, tk, amount) ;
i := 1 ;
WHILE i<=amount DO
IF i=1
THEN
DisplayRow(tn, fn, tk, TRUE)
END ;
DisplayFields(i, tn, fn, tk) ;
DisplayRow(tn, fn, tk, i=amount) ;
INC(i)
END
END DebugStack ;
END M2DebugStack.

View file

@ -0,0 +1,54 @@
(* M2Defaults.def provides path and argument defaults.
Copyright (C) 2001-2022 Free Software Foundation, Inc.
Contributed by Gaius Mulley <gaius.mulley@southwales.ac.uk>.
This file is part of GNU Modula-2.
GNU Modula-2 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 3, or (at your option)
any later version.
GNU Modula-2 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 GNU Modula-2; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. *)
DEFINITION MODULE M2Defaults;
(*
Title : M2Defaults
Author : Gaius Mulley
System : UNIX (gm2)
Date : Fri Dec 13 13:04:51 1991
Last edit : Fri Dec 13 13:04:51 1991
Description: Provides mechanisms to collect the default
search path and command line options.
*)
FROM DynamicStrings IMPORT String ;
EXPORT QUALIFIED GetSearchPath, GetOptions ;
(*
GetSearchPath - returns a string, which is a copy of the environment variable
M2PATH.
*)
PROCEDURE GetSearchPath () : String ;
(*
GetOptions - returns a string, which is a copy of the environment variable
M2OPTIONS
*)
PROCEDURE GetOptions () : String ;
END M2Defaults.

View file

@ -0,0 +1,64 @@
(* M2Defaults.mod provides path and argument defaults.
Copyright (C) 2001-2022 Free Software Foundation, Inc.
Contributed by Gaius Mulley <gaius.mulley@southwales.ac.uk>.
This file is part of GNU Modula-2.
GNU Modula-2 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 3, or (at your option)
any later version.
GNU Modula-2 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 GNU Modula-2; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. *)
IMPLEMENTATION MODULE M2Defaults;
FROM DynamicStrings IMPORT InitString, KillString ;
FROM SEnvironment IMPORT GetEnvironment ;
(*
GetSearchPath - sets string, a, to the environment variable
M2PATH.
*)
PROCEDURE GetSearchPath () : String ;
VAR
s, p: String ;
BEGIN
s := InitString('M2PATH') ;
IF GetEnvironment(s, p)
THEN
END ;
s := KillString(s) ;
RETURN( p )
END GetSearchPath ;
(*
GetOptions - returns a string, which is a copy of the environment variable
M2OPTIONS
*)
PROCEDURE GetOptions () : String ;
VAR
s, p: String ;
BEGIN
s := InitString('M2OPTIONS') ;
IF GetEnvironment(s, p)
THEN
END ;
s := KillString(s) ;
RETURN( p )
END GetOptions ;
END M2Defaults.

View file

@ -0,0 +1,43 @@
(* M2DriverOptions.def provides procedures to handle driver options.
Copyright (C) 2011-2022 Free Software Foundation, Inc.
Contributed by Gaius Mulley <gaius.mulley@southwales.ac.uk>.
This file is part of GNU Modula-2.
GNU Modula-2 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 3, or (at your option)
any later version.
GNU Modula-2 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 GNU Modula-2; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. *)
DEFINITION MODULE M2DriverOptions ;
(*
Title : M2DriverOptions
Author : Gaius Mulley
System : GNU Modula-2
Date : Tue Dec 18 13:52:08 2012
Revision : $Version$
Description: provides procedures to handle driver options.
*)
FROM DynamicStrings IMPORT String ;
(*
ScanCppArgs - scans the cpp arguments and builds up the cpp command line.
*)
PROCEDURE ScanCppArgs (i: CARDINAL) : CARDINAL ;
END M2DriverOptions.

View file

@ -0,0 +1,95 @@
(* M2DriverOptions.mod provides procedures to handle driver options.
Copyright (C) 2011-2022 Free Software Foundation, Inc.
Contributed by Gaius Mulley <gaius.mulley@southwales.ac.uk>.
This file is part of GNU Modula-2.
GNU Modula-2 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 3, or (at your option)
any later version.
GNU Modula-2 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 GNU Modula-2; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. *)
IMPLEMENTATION MODULE M2DriverOptions ;
FROM DynamicStrings IMPORT String, Length, InitString, Mark, Slice, EqualArray,
InitStringCharStar, ConCatChar, ConCat, KillString,
PushAllocation, PopAllocationExemption, char ;
FROM SArgs IMPORT GetArg, Narg ;
FROM M2Options IMPORT CppRemember ;
(*
CppArgument - some options might have arguments, remember these as well.
*)
PROCEDURE CppArgument (i: CARDINAL; option: String) : CARDINAL ;
VAR
arg: String ;
BEGIN
IF GetArg (arg, i+1) AND (char (arg, 0) # '-')
THEN
(* arg exists and is not an option and might be an argument to a specific option. *)
IF EqualArray (option, '-I')
THEN
INC (i) ;
CppRemember (arg) (* arg will be a path for -I. *)
ELSIF EqualArray (option, '-D')
THEN
INC (i) ;
CppRemember (arg) (* arg will be define for -D. *)
ELSIF EqualArray (option, '-isystem')
THEN
INC (i) ;
CppRemember (arg) (* arg will be a path for -isystem. *)
ELSIF EqualArray (option, '-imultiarch')
THEN
INC (i) ;
CppRemember (arg) (* arg will be a definition for -imultiarch. *)
END
END ;
RETURN i
END CppArgument ;
(*
ScanCppArgs - scans the cpp arguments and builds up the cpp command line.
*)
PROCEDURE ScanCppArgs (i: CARDINAL) : CARDINAL ;
VAR
option: String ;
BEGIN
IF GetArg (option, i) AND EqualArray (option, '-fcpp-begin')
THEN
INC (i) ;
WHILE GetArg (option, i) DO
IF EqualArray (option, '-fcpp-end')
THEN
RETURN i
ELSE
(* do not remember the filename. *)
IF char (option, 0)='-'
THEN
CppRemember (option) ;
i := CppArgument (i, option)
END
END ;
INC (i)
END
END ;
RETURN i
END ScanCppArgs ;
END M2DriverOptions.

View file

@ -0,0 +1,59 @@
(* M2Emit.def connects Modula-2 error reporting to GCC.
Copyright (C) 2001-2022 Free Software Foundation, Inc.
Contributed by Gaius Mulley <gaius.mulley@southwales.ac.uk>.
This file is part of GNU Modula-2.
GNU Modula-2 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 3, or (at your option)
any later version.
GNU Modula-2 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 GNU Modula-2; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. *)
DEFINITION MODULE M2Emit ;
FROM DynamicStrings IMPORT String ;
FROM m2linemap IMPORT location_t ;
(*
EmitError - pass the error to GCC or the gm2 tools output routines.
*)
PROCEDURE EmitError (error, note: BOOLEAN; token: CARDINAL; message: String) ;
(*
InternalError - issue an internal error, message.
*)
PROCEDURE InternalError (message: ARRAY OF CHAR) ;
(*
UnknownLocation - return the unknown location (using GCC linemap for cc1gm2)
and constants for gm2l and gm2m.
*)
PROCEDURE UnknownLocation () : location_t ;
(*
BuiltinsLocation - return the builtins location (using GCC linemap for cc1gm2)
and constants for gm2l and gm2m.
*)
PROCEDURE BuiltinsLocation () : location_t ;
END M2Emit.

View file

@ -0,0 +1,82 @@
(* M2Emit.mod issue errors to the GCC error reporting substructure.
Copyright (C) 2019-2022 Free Software Foundation, Inc.
Contributed by Gaius Mulley <gaius.mulley@southwales.ac.uk>.
This file is part of GNU Modula-2.
GNU Modula-2 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 3, or (at your option)
any later version.
GNU Modula-2 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 GNU Modula-2; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. *)
IMPLEMENTATION MODULE M2Emit ;
IMPORT m2linemap ;
FROM M2LexBuf IMPORT TokenToLocation ;
FROM m2linemap IMPORT ErrorAtf, WarningAtf, NoteAtf, internal_error ;
FROM DynamicStrings IMPORT string ;
FROM SYSTEM IMPORT ADR ;
(*
EmitError - pass the error to GCC.
*)
PROCEDURE EmitError (error, note: BOOLEAN; token: CARDINAL; message: String) ;
BEGIN
IF error
THEN
ErrorAtf (TokenToLocation (token), string (message))
ELSIF note
THEN
NoteAtf (TokenToLocation (token), string (message))
ELSE
WarningAtf (TokenToLocation (token), string (message))
END
END EmitError ;
(*
InternalError - issue an internal error, message.
*)
PROCEDURE InternalError (message: ARRAY OF CHAR) ;
BEGIN
internal_error (ADR (message))
END InternalError ;
(*
UnknownLocation - return the unknown location (using GCC linemap for cc1gm2)
and constants for gm2l and gm2m.
*)
PROCEDURE UnknownLocation () : location_t ;
BEGIN
RETURN m2linemap.UnknownLocation ()
END UnknownLocation ;
(*
BuiltinsLocation - return the builtins location (using GCC linemap for cc1gm2)
and constants for gm2l and gm2m.
*)
PROCEDURE BuiltinsLocation () : location_t ;
BEGIN
RETURN m2linemap.BuiltinsLocation ()
END BuiltinsLocation ;
END M2Emit.

View file

@ -0,0 +1,364 @@
(* M2Error.def error reporting interface.
Copyright (C) 2001-2022 Free Software Foundation, Inc.
Contributed by Gaius Mulley <gaius.mulley@southwales.ac.uk>.
This file is part of GNU Modula-2.
GNU Modula-2 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 3, or (at your option)
any later version.
GNU Modula-2 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 GNU Modula-2; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. *)
DEFINITION MODULE M2Error ;
(*
Title : M2Error
Author : Gaius Mulley
System : UNIX (gm2)
Description: provides an interface between the string handling modules
and the compiler.
*)
FROM SYSTEM IMPORT BYTE ;
FROM DynamicStrings IMPORT String ;
FROM NameKey IMPORT Name ;
EXPORT QUALIFIED Error, ErrorScope,
InternalError,
WriteFormat0, WriteFormat1, WriteFormat2, WriteFormat3,
NewError, ErrorFormat0, ErrorFormat1, ErrorFormat2, ErrorFormat3,
ErrorString,
NewWarning, NewNote, SetColor,
FlushErrors, FlushWarnings, ChainError,
ErrorStringAt, ErrorStringAt2, ErrorStringsAt2,
WarnStringAt, WarnStringAt2, WarnStringsAt2,
ErrorAbort0,
WarnFormat0, WarnFormat1, MoveError,
AnnounceScope, EnterImplementationScope,
EnterModuleScope, EnterDefinitionScope, EnterProgramScope,
EnterProcedureScope, DepthScope, GetAnnounceScope,
DefaultProgramModule, DefaultImplementationModule,
DefaultDefinitionModule, DefaultInnerModule, DefaultProcedure,
EnterErrorScope, GetCurrentErrorScope, ResetErrorScope,
LeaveErrorScope ;
TYPE
Error ;
ErrorScope ;
(*
InternalError - displays an internal error message together with the compiler source
file and line number.
This function is not buffered and is used when the compiler is about
to give up.
*)
PROCEDURE InternalError (message: ARRAY OF CHAR) <* noreturn *> ;
(* ***************************************************************************
The following routines are used for normal syntax and semantic error reporting
*************************************************************************** *)
(*
WriteFormat0 - displays the source module and line together
with the encapsulated format string.
Used for simple error messages tied to the current token.
*)
PROCEDURE WriteFormat0 (a: ARRAY OF CHAR) ;
(*
WriteFormat1 - displays the source module and line together
with the encapsulated format string.
Used for simple error messages tied to the current token.
*)
PROCEDURE WriteFormat1 (a: ARRAY OF CHAR; w: ARRAY OF BYTE) ;
(*
WriteFormat2 - displays the module and line together with the encapsulated
format strings.
Used for simple error messages tied to the current token.
*)
PROCEDURE WriteFormat2 (a: ARRAY OF CHAR; w1, w2: ARRAY OF BYTE) ;
(*
WriteFormat3 - displays the module and line together with the encapsulated
format strings.
Used for simple error messages tied to the current token.
*)
PROCEDURE WriteFormat3 (a: ARRAY OF CHAR; w1, w2, w3: ARRAY OF BYTE) ;
(*
NewError - creates and returns a new error handle.
*)
PROCEDURE NewError (AtTokenNo: CARDINAL) : Error ;
(*
NewWarning - creates and returns a new error handle suitable for a warning.
A warning will not stop compilation.
*)
PROCEDURE NewWarning (AtTokenNo: CARDINAL) : Error ;
(*
NewNote - creates and returns a new error handle suitable for a note.
A note will not stop compilation.
*)
PROCEDURE NewNote (AtTokenNo: CARDINAL) : Error ;
(*
ChainError - creates and returns a new error handle, this new error
is associated with, e, and is chained onto the end of, e.
*)
PROCEDURE ChainError (AtTokenNo: CARDINAL; e: Error) : Error ;
(*
MoveError - repositions an error, e, to token, AtTokenNo, and returns, e.
*)
PROCEDURE MoveError (e: Error; AtTokenNo: CARDINAL) : Error ;
(*
SetColor - informs the error module that this error will have had colors
assigned to it. If an error is issued without colors assigned
then the default colors will be assigned to the legacy error
messages.
*)
PROCEDURE SetColor (e: Error) : Error ;
(*
ErrorFormat routines provide a printf capability for the error handle.
*)
PROCEDURE ErrorFormat0 (e: Error; a: ARRAY OF CHAR) ;
PROCEDURE ErrorFormat1 (e: Error; a: ARRAY OF CHAR; w: ARRAY OF BYTE) ;
PROCEDURE ErrorFormat2 (e: Error; a: ARRAY OF CHAR; w1, w2: ARRAY OF BYTE) ;
PROCEDURE ErrorFormat3 (e: Error; a: ARRAY OF CHAR; w1, w2, w3: ARRAY OF BYTE) ;
PROCEDURE ErrorString (e: Error; str: String) ;
(* ***************************************************************************
The following routines are useful for positioning and warnings and errors
at tokens. The strings are emitted later, so the caller must not destroy
the strings.
*************************************************************************** *)
PROCEDURE ErrorStringAt (s: String; tok: CARDINAL) ;
PROCEDURE ErrorStringAt2 (s: String; tok1, tok2: CARDINAL) ;
PROCEDURE ErrorStringsAt2 (s1, s2: String; tok1, tok2: CARDINAL) ;
PROCEDURE WarnStringAt (s: String; tok: CARDINAL) ;
PROCEDURE WarnStringAt2 (s: String; tok1, tok2: CARDINAL) ;
PROCEDURE WarnStringsAt2 (s1, s2: String; tok1, tok2: CARDINAL) ;
(*
WarnFormat0 - displays the source module and line together
with the encapsulated format string.
Used for simple warning messages tied to the current token.
*)
PROCEDURE WarnFormat0 (a: ARRAY OF CHAR) ;
(*
WarnFormat1 - displays the source module and line together
with the encapsulated format string.
Used for simple warning messages tied to the current token.
*)
PROCEDURE WarnFormat1 (a: ARRAY OF CHAR; w: ARRAY OF BYTE) ;
(*
FlushErrors - switches the output channel to the error channel
and then writes out all errors.
If an error is present the compilation is terminated.
All warnings are ignored.
*)
PROCEDURE FlushErrors ;
(*
FlushWarnings - switches the output channel to the error channel
and then writes out all warnings.
If an error is present the compilation is terminated,
if warnings only were emitted then compilation will
continue.
*)
PROCEDURE FlushWarnings ;
(*
ErrorAbort0 - aborts compiling, it flushes all warnings and errors before aborting.
*)
PROCEDURE ErrorAbort0 (a: ARRAY OF CHAR) ;
(*
AnnounceScope - return the error string message with a scope description prepended
assuming that scope has changed.
*)
PROCEDURE AnnounceScope (e: Error; message: String) : String ;
(*
EnterImplementationScope - signifies to the error routines that the front end
has started to compile implementation module scopeName.
*)
PROCEDURE EnterImplementationScope (scopename: Name) ;
(*
EnterProgramScope - signifies to the error routines that the front end
has started to compile program module scopeName.
*)
PROCEDURE EnterProgramScope (scopename: Name) ;
(*
EnterModuleScope - signifies to the error routines that the front end
has started to compile an inner module scopeName.
*)
PROCEDURE EnterModuleScope (scopename: Name) ;
(*
EnterDefinitionScope - signifies to the error routines that the front end
has started to compile definition module scopeName.
*)
PROCEDURE EnterDefinitionScope (scopename: Name) ;
(*
EnterProcedureScope - signifies to the error routines that the front end
has started to compile definition module scopeName.
*)
PROCEDURE EnterProcedureScope (scopename: Name) ;
(*
DepthScope - returns the depth of the scope stack.
*)
PROCEDURE DepthScope () : CARDINAL ;
(*
GetAnnounceScope - return message with the error scope attached to message.
filename and message are treated as read only by this
procedure function.
*)
PROCEDURE GetAnnounceScope (filename, message: String) : String ;
(*
DefaultProgramModule - sets up an unnamed program scope before the Ident is seen.
*)
PROCEDURE DefaultProgramModule ;
(*
DefaultImplementationModule - sets up an unnamed implementation
scope before the Ident is seen.
*)
PROCEDURE DefaultImplementationModule ;
(*
DefaultDefinitionModule - sets up an unnamed definition
scope before the Ident is seen.
*)
PROCEDURE DefaultDefinitionModule ;
(*
DefaultInnerModule - sets up an unnamed inner
scope before the Ident is seen.
*)
PROCEDURE DefaultInnerModule ;
(*
DefaultProcedure - sets up an unnamed procedure
scope before the Ident is seen.
*)
PROCEDURE DefaultProcedure ;
(*
EnterErrorScope - pushes the currentScope and sets currentScope to scope.
*)
PROCEDURE EnterErrorScope (scope: ErrorScope) ;
(*
LeaveErrorScope - leave the current scope and pop into the previous one.
*)
PROCEDURE LeaveErrorScope ;
(*
GetCurrentErrorScope - returns currentScope.
*)
PROCEDURE GetCurrentErrorScope () : ErrorScope ;
(*
ResetErrorScope - should be called at the start of each pass to
reset the error scope index.
*)
PROCEDURE ResetErrorScope ;
END M2Error.

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,42 @@
(* M2EvalSym.def Evaluates all the symbol values within the symbol table.
Copyright (C) 2001-2022 Free Software Foundation, Inc.
Contributed by Gaius Mulley <gaius.mulley@southwales.ac.uk>.
This file is part of GNU Modula-2.
GNU Modula-2 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 3, or (at your option)
any later version.
GNU Modula-2 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 GNU Modula-2; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. *)
DEFINITION MODULE M2EvalSym ;
(*
Title : M2EvalSym
Author : Gaius Mulley
Date : 7/8/87
LastEdit : 7/8/87
System : UNIX (GNU Modula-2)
Description: Evaluates all the symbol values within the symbol table.
*)
EXPORT QUALIFIED Evaluate ;
(*
Evaluate - evaluate all the symbols in the symbol table.
*)
PROCEDURE Evaluate ;
END M2EvalSym.

View file

@ -0,0 +1,74 @@
(* M2FileName.def construct file names.
Copyright (C) 2001-2022 Free Software Foundation, Inc.
Contributed by Gaius Mulley <gaius.mulley@southwales.ac.uk>.
This file is part of GNU Modula-2.
GNU Modula-2 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 3, or (at your option)
any later version.
GNU Modula-2 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 GNU Modula-2; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. *)
DEFINITION MODULE M2FileName ;
(*
Author : Gaius Mulley
Title : M2FileName
Date : 3/4/86 [$Date: 2013/07/08 10:27:56 $]
SYSTEM : UNIX (GNU Modula-2)
Description: construct file names.
Version : $Revision: 1.11 $
*)
FROM DynamicStrings IMPORT String ;
EXPORT QUALIFIED CalculateFileName, CalculateStemName, ExtractExtension ;
(*
CalculateFileName - calculates and returns a new string filename
given a module and an extension. This file name
length will be operating system specific.
String, Extension, is concatenated onto
Module and thus it is safe to `Mark' the extension
for garbage collection.
*)
PROCEDURE CalculateFileName (Module, Extension: String) : String ;
(*
CalculateStemName - calculates the stem name for given a module.
This name length will be operating system and
compiler specific.
*)
PROCEDURE CalculateStemName (Module: String) : String ;
(*
ExtractExtension - given a, filename, return the filename without
the extension, Ext.
*)
PROCEDURE ExtractExtension (filename, ext: String) : String ;
(*
ExtractModule - given a, filename, return the module name including any
extension. A new string is returned.
*)
PROCEDURE ExtractModule (filename: String) : String ;
END M2FileName.

View file

@ -0,0 +1,106 @@
(* M2FileName.mod construct file names.
Copyright (C) 2001-2022 Free Software Foundation, Inc.
Contributed by Gaius Mulley <gaius.mulley@southwales.ac.uk>.
This file is part of GNU Modula-2.
GNU Modula-2 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 3, or (at your option)
any later version.
GNU Modula-2 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 GNU Modula-2; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. *)
IMPLEMENTATION MODULE M2FileName ;
FROM ASCII IMPORT nul ;
FROM DynamicStrings IMPORT InitString, Mark, Slice, Dup, ConCatChar, ConCat, Length, Equal, Index ;
CONST
MaxFileName = 0 ; (* zero means no limits *)
MaxStemName = 0 ;
Directory = '/' ;
(*
currently there are no limits on filename length, this may
be incorrect on some systems.
*)
(*
CalculateFileName - calculates and returns a new string filename given a module
and an extension. String, Extension, is concatenated onto
Module and thus it is safe to `Mark' the extension for garbage
collection.
*)
PROCEDURE CalculateFileName (Module, Extension: String) : String ;
BEGIN
IF MaxFileName=0
THEN
RETURN( ConCat(ConCatChar(Slice(Module, 0, MaxFileName), '.'), Extension) )
ELSE
RETURN( ConCat(ConCatChar(Slice(Module, 0, MaxFileName-Length(Extension)-1), '.'), Extension) )
END
END CalculateFileName ;
(*
CalculateStemName - calculates the stem name for given a module.
This name length will be operating system and
compiler specific.
*)
PROCEDURE CalculateStemName (Module: String) : String ;
BEGIN
RETURN( Slice(Module, 0, MaxStemName) )
END CalculateStemName ;
(*
ExtractExtension - given a, filename, return the filename without
the extension, Ext.
*)
PROCEDURE ExtractExtension (filename, ext: String) : String ;
BEGIN
IF Equal(ext, Mark(Slice(filename, -Length(ext), 0)))
THEN
RETURN( Slice(filename, 0, -Length(ext)) )
ELSE
RETURN( filename )
END
END ExtractExtension ;
(*
ExtractModule - given a, filename, return the module name including any
extension. A new string is returned.
*)
PROCEDURE ExtractModule (filename: String) : String ;
VAR
i: INTEGER ;
BEGIN
i := Index(filename, Directory, 0) ;
IF i=-1
THEN
RETURN( Dup(filename) )
ELSE
RETURN( Slice(filename, i+1, 0) )
END
END ExtractModule ;
END M2FileName.

View file

@ -0,0 +1,245 @@
(* M2GCCDeclare.def declares Modula-2 types to GCC.
Copyright (C) 2001-2022 Free Software Foundation, Inc.
Contributed by Gaius Mulley <gaius.mulley@southwales.ac.uk>.
This file is part of GNU Modula-2.
GNU Modula-2 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 3, or (at your option)
any later version.
GNU Modula-2 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 GNU Modula-2; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. *)
DEFINITION MODULE M2GCCDeclare ;
(*
Title : M2GCCDeclare
Author : Gaius Mulley
System : UNIX (gm2)
Date : Sat Jul 17 10:28:43 1999
Last edit : Sat Jul 17 10:28:43 1999
Description: declares Modula-2 types to GCC,
only declares a type once all subcomponents are known.
*)
FROM SYSTEM IMPORT WORD ;
FROM m2tree IMPORT Tree ;
EXPORT QUALIFIED FoldConstants,
DeclareConstant, TryDeclareConstant,
DeclareConstructor, TryDeclareConstructor,
DeclareLocalVariables, PromoteToString, DeclareLocalVariable,
InitDeclarations, StartDeclareScope, EndDeclareScope,
DeclareModuleVariables, IsProcedureGccNested,
DeclareProcedure, PoisonSymbols, DeclareParameters,
DeclareM2linkGlobals,
CompletelyResolved, MarkExported, PrintSym,
ConstantKnownAndUsed,
PutToBeSolvedByQuads,
GetTypeMin, GetTypeMax,
WalkAction, IsAction ;
TYPE
WalkAction = PROCEDURE (WORD) ;
IsAction = PROCEDURE (WORD) : BOOLEAN ;
(*
FoldConstants - a wrapper for ResolveConstantExpressions.
*)
PROCEDURE FoldConstants (start, end: CARDINAL) ;
(*
StartDeclareScope - declares types, variables associated with this scope.
*)
PROCEDURE StartDeclareScope (scope: CARDINAL) ;
(*
EndDeclareScope -
*)
PROCEDURE EndDeclareScope ;
(*
DeclareParameters -
*)
PROCEDURE DeclareParameters (sym: CARDINAL) ;
(*
DeclareConstant - if, sym, is a constant then declare it.
The constant must be solvable at this point.
*)
PROCEDURE DeclareConstant (tokenno: CARDINAL; sym: CARDINAL) ;
(*
DeclareConstructor - if, sym, is a constructor then declare it.
The constructor must be solvable at this point.
*)
PROCEDURE DeclareConstructor (tokenno: CARDINAL; quad: CARDINAL; sym: CARDINAL) ;
(*
TryDeclareConstant - try and declare a constant. If, sym, is a
constant try and declare it, if we cannot
then enter it into the to do list.
*)
PROCEDURE TryDeclareConstant (tokenno: CARDINAL; sym: CARDINAL) ;
(*
TryDeclareConstructor - try and declare a constructor. If, sym, is a
constructor try and declare it, if we cannot
then enter it into the to do list.
*)
PROCEDURE TryDeclareConstructor (tokenno: CARDINAL; sym: CARDINAL) ;
(*
DeclareLocalVariables - lists the Local variables for procedure
together with their offset.
*)
PROCEDURE DeclareLocalVariables (procedure: CARDINAL) ;
(*
DeclareLocalVariable - declare a local variable var.
*)
PROCEDURE DeclareLocalVariable (var: CARDINAL) ;
(*
DeclareProcedure - declares procedure, sym, or all procedures inside
module sym.
*)
PROCEDURE DeclareProcedure (sym: WORD) ;
(*
DeclareModuleVariables - declares Module variables for a module
which inside a procedure.
*)
PROCEDURE DeclareModuleVariables (sym: CARDINAL) ;
(*
DeclareM2linkGlobals - will create M2LINK.StaticInitialization
and M2LINK.ForcedModuleInitOrder providing
they have not already been created.
*)
PROCEDURE DeclareM2linkGlobals (tokenno: CARDINAL) ;
(*
IsProcedureGccNested - returns TRUE if procedure, sym, will be considered
as nested by GCC.
This will occur if either its outer defining scope
is a procedure or is a module which is inside a
procedure.
*)
PROCEDURE IsProcedureGccNested (sym: CARDINAL) : BOOLEAN ;
(*
PoisonSymbols - poisons all gcc symbols from procedure, sym.
A debugging aid.
*)
PROCEDURE PoisonSymbols (sym: CARDINAL) ;
(*
PromoteToString - declare, sym, and then promote it to a string.
Note that if sym is a single character we do
*not* record it as a string
but as a char however we always
return a string constant.
*)
PROCEDURE PromoteToString (tokenno: CARDINAL; sym: CARDINAL) : Tree ;
(*
CompletelyResolved - returns TRUE if a symbol has been completely resolved
and is not partially declared (such as a record,
array or procedure type).
*)
PROCEDURE CompletelyResolved (sym: CARDINAL) : BOOLEAN ;
(*
ConstantKnownAndUsed -
*)
PROCEDURE ConstantKnownAndUsed (sym: CARDINAL; t: Tree) ;
(*
PutToBeSolvedByQuads - places, sym, in this list.
*)
PROCEDURE PutToBeSolvedByQuads (sym: CARDINAL) ;
(*
MarkExported - tell GCC to mark all exported procedures in module sym.
*)
PROCEDURE MarkExported (sym: CARDINAL) ;
(*
GetTypeMin - returns a symbol corresponding to MIN(type)
*)
PROCEDURE GetTypeMin (type: CARDINAL) : CARDINAL ;
(*
GetTypeMax - returns a symbol corresponding to MAX(type)
*)
PROCEDURE GetTypeMax (type: CARDINAL) : CARDINAL ;
(*
PrintSym - prints limited information about a symbol.
*)
PROCEDURE PrintSym (sym: CARDINAL) ;
(*
InitDeclarations - initializes default types and the source filename.
*)
PROCEDURE InitDeclarations ;
END M2GCCDeclare.

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,103 @@
(* M2GenGCC.def convert the quadruples into GCC trees.
Copyright (C) 2001-2022 Free Software Foundation, Inc.
Contributed by Gaius Mulley <gaius.mulley@southwales.ac.uk>.
This file is part of GNU Modula-2.
GNU Modula-2 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 3, or (at your option)
any later version.
GNU Modula-2 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 GNU Modula-2; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. *)
DEFINITION MODULE M2GenGCC ;
(*
Title : M2GenGCC
Author : Gaius Mulley
System : UNIX (gm2)
Date : Fri Jul 9 13:05:13 1999
Last edit : Fri Jul 9 13:05:13 1999
Description: provides an interface to GCC, essentially convert the
internal quadruples of m2f into a GCC tree structure.
*)
FROM M2GCCDeclare IMPORT WalkAction ;
FROM m2tree IMPORT Tree ;
FROM m2linemap IMPORT location_t ;
EXPORT QUALIFIED ConvertQuadsToTree, ResolveConstantExpressions,
GetHighFromUnbounded, StringToChar,
LValueToGenericPtr, ZConstToTypedConst,
DoCopyString ;
(*
ConvertQuadsToTree - runs through the quadruple list, Start..End, and converts it into
the GCC tree structure.
*)
PROCEDURE ConvertQuadsToTree (Start, End: CARDINAL) ;
(*
ResolveConstantExpressions - resolves constant expressions from the quadruple list.
It returns TRUE if one or more constants were folded.
When a constant symbol value is solved, the call back
p(sym) is invoked.
*)
PROCEDURE ResolveConstantExpressions (p: WalkAction; start, end: CARDINAL) : BOOLEAN ;
(*
GetHighFromUnbounded - returns a Tree containing the value of
param.HIGH.
*)
PROCEDURE GetHighFromUnbounded (location: location_t; dim, param: CARDINAL) : Tree ;
(*
StringToChar - if type=Char and str is a string (of size <= 1)
then convert the string into a character constant.
*)
PROCEDURE StringToChar (t: Tree; type, str: CARDINAL) : Tree ;
(*
LValueToGenericPtr - returns a Tree representing symbol, sym.
It coerces a lvalue into an internal pointer type
*)
PROCEDURE LValueToGenericPtr (location: location_t; sym: CARDINAL) : Tree ;
(*
ZConstToTypedConst - checks whether op1 and op2 are constants and
coerces, t, appropriately.
*)
PROCEDURE ZConstToTypedConst (t: Tree; op1, op2: CARDINAL) : Tree ;
(*
DoCopyString - returns trees:
t number of bytes to be copied (including the nul)
op3t the string with the extra nul character
providing it fits.
*)
PROCEDURE DoCopyString (tokenno: CARDINAL; VAR length, op3t: Tree; op1t, op3: CARDINAL) ;
END M2GenGCC.

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,58 @@
(* M2Graph.def maintains the dependancy graph depth.
Copyright (C) 2022 Free Software Foundation, Inc.
Contributed by Gaius Mulley <gaius.mulley@southwales.ac.uk>.
This file is part of GNU Modula-2.
GNU Modula-2 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 3, or (at your option)
any later version.
GNU Modula-2 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 GNU Modula-2; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. *)
DEFINITION MODULE M2Graph ;
FROM Lists IMPORT List ;
TYPE
Graph ;
(*
InitGraph - creates and returns an empty graph.
*)
PROCEDURE InitGraph () : Graph ;
(*
KillGraph - deletes graph and all nodes.
*)
PROCEDURE KillGraph (VAR g: Graph) ;
(*
AddDependent - adds moduleSym <- dependSym into the graph.
*)
PROCEDURE AddDependent (graph: Graph; moduleSym, dependSym: CARDINAL) ;
(*
SortGraph - returns a List containing the sorted graph.
*)
PROCEDURE SortGraph (g: Graph; topModule: CARDINAL) : List ;
END M2Graph.

View file

@ -0,0 +1,234 @@
(* M2Graph.mod maintains the dependancy graph depth.
Copyright (C) 2022 Free Software Foundation, Inc.
Contributed by Gaius Mulley <gaius.mulley@southwales.ac.uk>.
This file is part of GNU Modula-2.
GNU Modula-2 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 3, or (at your option)
any later version.
GNU Modula-2 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 GNU Modula-2; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. *)
IMPLEMENTATION MODULE M2Graph ;
FROM Storage IMPORT ALLOCATE ;
FROM StrLib IMPORT StrEqual, StrCopy ;
FROM NumberIO IMPORT WriteCard ;
FROM StrIO IMPORT WriteString, WriteLn ;
FROM NameKey IMPORT Name, WriteKey ;
FROM Lists IMPORT InitList, KillList, IncludeItemIntoList, RemoveItemFromList ;
FROM Indexing IMPORT Index, HighIndice, IncludeIndiceIntoIndex, InitIndex, KillIndex, GetIndice ;
FROM M2Printf IMPORT printf0, printf1, printf2 ;
FROM SymbolTable IMPORT GetSymName, IsDefinitionForC, IsModule ;
CONST
Debugging = FALSE ;
TYPE
state = (initial, started, ordered) ;
node = POINTER TO RECORD
moduleSym: CARDINAL ; (* SymbolTable entry for module. *)
deps : Index ;
nstate : state ;
END ;
Graph = POINTER TO RECORD
nodes: Index ;
END ;
(*
InitGraph - creates and returns an empty graph.
*)
PROCEDURE InitGraph () : Graph ;
VAR
g: Graph ;
BEGIN
NEW (g) ;
g^.nodes := InitIndex (1) ;
RETURN g
END InitGraph ;
(*
KillNode - deletes the dynamic storage associated with nptr.
*)
PROCEDURE KillNode (nptr: node) ;
BEGIN
nptr^.deps := KillIndex (nptr^.deps)
END KillNode ;
(*
KillGraph - deletes graph and all nodes.
*)
PROCEDURE KillGraph (VAR g: Graph) ;
VAR
i, n: CARDINAL ;
nptr: node ;
BEGIN
n := HighIndice (g^.nodes) ;
i := 1 ;
WHILE i <= n DO
nptr := GetIndice (g^.nodes, i) ;
KillNode (nptr) ;
INC (i)
END ;
g := NIL
END KillGraph ;
(*
initNode - create a new node in graph and return the node.
*)
PROCEDURE initNode (graph: Graph; moduleSym: CARDINAL) : node ;
VAR
nptr: node ;
BEGIN
NEW (nptr) ;
nptr^.moduleSym := moduleSym ;
nptr^.deps := InitIndex (1) ;
nptr^.nstate := initial ;
IncludeIndiceIntoIndex (graph^.nodes, nptr) ;
RETURN nptr
END initNode ;
(*
getNode - returns a node from graph representing moduleSym.
If the node does not exist it is created.
*)
PROCEDURE getNode (graph: Graph; moduleSym: CARDINAL) : node ;
VAR
i, n: CARDINAL ;
nptr: node ;
BEGIN
i := 1 ;
n := HighIndice (graph^.nodes) ;
WHILE i <= n DO
nptr := GetIndice (graph^.nodes, i) ;
IF nptr^.moduleSym = moduleSym
THEN
RETURN nptr
END ;
INC (i)
END ;
RETURN initNode (graph, moduleSym)
END getNode ;
(*
createDependent - mptr imports from dptr.
*)
PROCEDURE createDependent (mptr, dptr: node) ;
BEGIN
IncludeIndiceIntoIndex (mptr^.deps, dptr)
END createDependent ;
(*
AddDependent - adds moduleSym <- dependSym into the graph.
*)
PROCEDURE AddDependent (graph: Graph; moduleSym, dependSym: CARDINAL) ;
VAR
mptr, dptr: node ;
BEGIN
IF (IsModule (moduleSym) OR (NOT IsDefinitionForC (moduleSym))) AND
(IsModule (dependSym) OR (NOT IsDefinitionForC (dependSym)))
THEN
mptr := getNode (graph, moduleSym) ;
dptr := getNode (graph, dependSym) ;
createDependent (mptr, dptr)
END
END AddDependent ;
(*
SortGraph - returns a List containing the sorted graph.
*)
PROCEDURE SortGraph (g: Graph; topModule: CARDINAL) : List ;
VAR
sorted: List ;
nptr : node ;
BEGIN
InitList (sorted) ;
setNodesInitial (g) ;
nptr := getNode (g, topModule) ;
resolveImports (sorted, nptr) ;
RemoveItemFromList (sorted, topModule) ;
IncludeItemIntoList (sorted, topModule) ; (* Ensure topModule is last. *)
RETURN sorted
END SortGraph ;
(*
resolveImports - recursively resolve imports using ISO Modula-2
rules for the order of module initialization.
*)
PROCEDURE resolveImports (sorted: List; nptr: node) ;
VAR
i, n: CARDINAL ;
name: Name ;
BEGIN
IF nptr^.nstate = initial
THEN
nptr^.nstate := started ;
name := GetSymName (nptr^.moduleSym) ;
i := 1 ;
n := HighIndice (nptr^.deps) ;
IF Debugging
THEN
printf2 ("resolving %a %d dependents\n", name, n)
END ;
WHILE i <= n DO
resolveImports (sorted, GetIndice (nptr^.deps, i)) ;
INC (i)
END ;
nptr^.nstate := ordered ;
IncludeItemIntoList (sorted, nptr^.moduleSym)
END
END resolveImports ;
(*
setNodesInitial - changes the state of all nodes in graph to initial.
*)
PROCEDURE setNodesInitial (g: Graph) ;
VAR
i, n: CARDINAL ;
nptr: node ;
BEGIN
i := 1 ;
n := HighIndice (g^.nodes) ;
WHILE i <= n DO
nptr := GetIndice (g^.nodes, i) ;
nptr^.nstate := initial ;
INC (i)
END
END setNodesInitial ;
END M2Graph.

View file

@ -0,0 +1,106 @@
(* M2Lex.def provides a non tokenised lexical analyser.
Copyright (C) 2001-2022 Free Software Foundation, Inc.
Contributed by Gaius Mulley <gaius.mulley@southwales.ac.uk>.
This file is part of GNU Modula-2.
GNU Modula-2 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 3, or (at your option)
any later version.
GNU Modula-2 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 GNU Modula-2; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. *)
DEFINITION MODULE M2Lex ;
(*
Title : M2Lex
Author : Gaius Mulley
Date : Date: Sat 16-09-1989 Time: 17:54:22.58
LastEdit : Date: Sat 16-09-1989 Time: 17:54:22.58
System : UNIX (GNU Modula-2)
Description: Provides a non tokenised version of M2Lexical.
Symbols are distinct MODULA-2 symbols.
*)
EXPORT QUALIFIED MaxLine,
GetSymbol,
PutSymbol,
CurrentSymbol,
LastSymbol,
OpenSource,
CloseSource,
SymIs,
IsSym,
WriteError ;
CONST
MaxLine = 1024 ;
VAR
LastSymbol,
CurrentSymbol : ARRAY [0..MaxLine] OF CHAR ;
(*
OpenSource - Attempts to open the source file, a.
The success of the operation is returned.
*)
PROCEDURE OpenSource (a: ARRAY OF CHAR) : BOOLEAN ;
(*
CloseSource - Closes the current open file.
*)
PROCEDURE CloseSource ;
(*
SymIs - if Name is equal to the CurrentSymbol the next Symbol is read
and true is returned, otherwise false is returned.
*)
PROCEDURE SymIs (Name: ARRAY OF CHAR) : BOOLEAN ;
(*
IsSym - returns the result of the comparison between CurrentSymbol
and Name.
*)
PROCEDURE IsSym (Name: ARRAY OF CHAR) : BOOLEAN ;
(*
GetSymbol - gets the next Symbol into CurrentSymbol.
*)
PROCEDURE GetSymbol ;
(*
PutSymbol - pushes a symbol, Name, back onto the input.
GetSymbol will set CurrentSymbol to, Name.
*)
PROCEDURE PutSymbol (Name: ARRAY OF CHAR) ;
(*
WriteError - displays the source line and points to the symbol in error.
The message, a, is displayed.
*)
PROCEDURE WriteError (a: ARRAY OF CHAR) ;
END M2Lex.

View file

@ -0,0 +1,418 @@
(* M2Lex.mod provides a non tokenised lexical analyser.
Copyright (C) 2001-2022 Free Software Foundation, Inc.
Contributed by Gaius Mulley <gaius.mulley@southwales.ac.uk>.
This file is part of GNU Modula-2.
GNU Modula-2 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 3, or (at your option)
any later version.
GNU Modula-2 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 GNU Modula-2; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. *)
IMPLEMENTATION MODULE M2Lex ;
FROM FIO IMPORT File, OpenToRead, ReadChar, Close, IsNoError ;
FROM StrIO IMPORT ReadString, WriteString, WriteLn ;
FROM StdIO IMPORT Write ;
FROM NumberIO IMPORT WriteCard ;
FROM ASCII IMPORT nul, lf, cr, EOL ;
FROM StrLib IMPORT StrCopy, StrEqual, StrLen ;
CONST
LineBuf = 1 ;
Wrap = LineBuf+1 ;
eof = 032C ;
MaxStack= 10 ;
VAR
f: File ;
Opened : BOOLEAN ;
CurrentChar : CHAR ;
NextChar : CHAR ;
FileName : ARRAY [0..MaxLine] OF CHAR ;
Lines : ARRAY [0..LineBuf] OF ARRAY [0..255] OF CHAR ;
(* Need two lines since the delimiter of the CurrentSymbol *)
(* maybe on the next line. *)
HighNext : CARDINAL ; (* Length of the NextChar line. *)
CurLine : CARDINAL ; (* Line number of the Current Char Line. *)
NextLine : CARDINAL ; (* Line number of the Next Char Line. *)
IndexCur : CARDINAL ; (* Index to the Lines array for Current Ln *)
IndexNext : CARDINAL ; (* Index to the Lines array for NextChar Ln *)
CurSym : CARDINAL ; (* Character start of the CurrentSymbol *)
CurSymLine : CARDINAL ; (* Line number of the CurrentSymbol *)
CurCharIndex : CARDINAL ; (* Character number of CurChar. *)
NextCharIndex : CARDINAL ; (* Character number of NextChar. *)
Eof : BOOLEAN ; (* End of source file. *)
InQuotes : BOOLEAN ; (* If we are in quotes. *)
QuoteChar : CHAR ; (* Quote character expected. *)
Stack : ARRAY [0..MaxStack] OF ARRAY [0..255] OF CHAR ;
StackPtr : CARDINAL ;
(*
IsSym - returns the result of the comparison between CurrentSymbol
and Name.
*)
PROCEDURE IsSym (Name: ARRAY OF CHAR) : BOOLEAN ;
BEGIN
RETURN( StrEqual(CurrentSymbol, Name) )
END IsSym ;
(*
SymIs - if Name is equal to the CurrentSymbol the next Symbol is read
and true is returned, otherwise false is returned.
*)
PROCEDURE SymIs (Name: ARRAY OF CHAR) : BOOLEAN ;
BEGIN
IF StrEqual(CurrentSymbol, Name)
THEN
GetSymbol ;
RETURN( TRUE )
ELSE
RETURN( FALSE )
END
END SymIs ;
(*
WriteError - displays the source line and points to the symbol in error.
The message, a, is displayed.
*)
PROCEDURE WriteError (a: ARRAY OF CHAR) ;
VAR
i: CARDINAL ;
BEGIN
WriteString(FileName) ; Write(':') ; WriteCard(CurSymLine, 0) ; Write(':') ; WriteString(a) ;
WriteLn ;
WriteString( Lines[IndexCur] ) ; WriteLn ;
i := CurSym ;
WHILE i>0 DO
Write(' ') ;
DEC(i)
END ;
i := StrLen(CurrentSymbol) ;
WHILE i>0 DO
Write('^') ;
DEC(i)
END ;
WriteLn ;
WriteString(a) ; WriteLn ;
END WriteError ;
(*
OpenSource - Attempts to open the source file, a.
The success of the operation is returned.
*)
PROCEDURE OpenSource (a: ARRAY OF CHAR) : BOOLEAN ;
BEGIN
f := OpenToRead(a) ;
IF IsNoError(f)
THEN
StrCopy(a, FileName) ;
Opened := TRUE ;
Init ;
RETURN( TRUE )
ELSE
Opened := FALSE ;
Eof := TRUE ;
RETURN( FALSE )
END
END OpenSource ;
(*
CloseSource - Closes the current open file.
*)
PROCEDURE CloseSource ;
BEGIN
IF Opened=TRUE
THEN
Opened := FALSE ;
Close( f )
END
END CloseSource ;
(*
GetSymbol - gets the next Symbol into CurrentSymbol.
*)
PROCEDURE GetSymbol ;
BEGIN
StrCopy( CurrentSymbol, LastSymbol ) ;
IF StackPtr>0
THEN
DEC(StackPtr) ;
StrCopy( Stack[StackPtr], CurrentSymbol )
ELSE
ReadSymbol( CurrentSymbol )
END
END GetSymbol ;
(*
PutSymbol - pushes a symbol, Name, back onto the input.
GetSymbol will set CurrentSymbol to, Name.
*)
PROCEDURE PutSymbol (Name: ARRAY OF CHAR) ;
BEGIN
IF StackPtr=MaxStack
THEN
WriteError('Maximum push back symbol exceeded - Increase CONST MaxStack')
ELSE
StrCopy(Name, Stack[StackPtr]) ;
INC(StackPtr)
END
END PutSymbol ;
PROCEDURE ReadSymbol (VAR a: ARRAY OF CHAR) ;
VAR
high,
i : CARDINAL ;
ok : BOOLEAN ;
BEGIN
high := HIGH(a) ;
IF NOT Eof
THEN
IF InQuotes
THEN
i := 0 ;
IF CurrentChar=QuoteChar
THEN
InQuotes := FALSE ;
a[i] := QuoteChar ;
INC(i) ;
AdvanceChar
ELSE
(* Fill in string or character *)
i := 0 ;
REPEAT
a[i] := CurrentChar ;
INC(i) ;
AdvanceChar
UNTIL (CurrentChar=QuoteChar) OR Eof OR (i>high) ;
END
ELSE
(* Get rid of all excess spaces *)
REPEAT
IF CurrentChar=' '
THEN
WHILE (CurrentChar=' ') AND (NOT Eof) DO
AdvanceChar
END ;
ok := FALSE
ELSIF (CurrentChar='(') AND (NextChar='*')
THEN
ConsumeComments ;
ok := FALSE
ELSE
ok := TRUE
END
UNTIL ok ;
i := 0 ;
CurSym := CurCharIndex ;
CurSymLine := CurLine ;
IF (CurrentChar='"') OR (CurrentChar="'")
THEN
InQuotes := TRUE ;
QuoteChar := CurrentChar ;
a[i] := CurrentChar ;
AdvanceChar ;
INC(i)
ELSIF DoubleDelimiter()
THEN
a[i] := CurrentChar ;
AdvanceChar ;
INC(i) ;
a[i] := CurrentChar ;
AdvanceChar ;
INC(i)
ELSIF Delimiter()
THEN
a[i] := CurrentChar ;
AdvanceChar ;
INC(i)
ELSE
REPEAT
a[i] := CurrentChar ;
AdvanceChar ;
INC(i)
UNTIL Delimiter() OR (i>high) OR (CurrentChar=' ') OR Eof
END
END
ELSE
(* eof *)
i := 0 ;
a[i] := eof ;
INC(i)
END ;
IF i<=HIGH(a)
THEN
a[i] := nul
END
END ReadSymbol ;
(*
ConsumeComments - consumes Modula-2 comments.
*)
PROCEDURE ConsumeComments ;
VAR
Level: CARDINAL ;
BEGIN
Level := 0 ;
REPEAT
IF (CurrentChar='(') AND (NextChar='*')
THEN
INC(Level)
ELSIF (CurrentChar='*') AND (NextChar=')')
THEN
DEC(Level)
END ;
AdvanceChar ;
UNTIL (Level=0) OR Eof ;
AdvanceChar
END ConsumeComments;
(* Delimiter returns true if and only if CurrentChar is a delimiter *)
PROCEDURE Delimiter() : BOOLEAN ;
BEGIN
IF (CurrentChar='-') OR
(CurrentChar='+') OR (CurrentChar='*') OR (CurrentChar='\') OR
(CurrentChar='|') OR (CurrentChar='(') OR (CurrentChar=')') OR
(CurrentChar='"') OR (CurrentChar="'") OR (CurrentChar='{')
THEN
RETURN( TRUE )
ELSIF
(CurrentChar='}') OR (CurrentChar='[') OR (CurrentChar=']') OR
(CurrentChar='#') OR (CurrentChar='=') OR (CurrentChar='<')
THEN
RETURN( TRUE )
ELSIF
(CurrentChar='>') OR (CurrentChar='.') OR (CurrentChar=';') OR
(CurrentChar=':') OR (CurrentChar='^') OR (CurrentChar=',')
THEN
RETURN( TRUE )
ELSE
RETURN( FALSE )
END
END Delimiter ;
PROCEDURE DoubleDelimiter () : BOOLEAN ;
BEGIN
RETURN (
((CurrentChar='>') AND (NextChar='=')) OR
((CurrentChar='<') AND (NextChar='=')) OR
((CurrentChar='<') AND (NextChar='>')) OR
((CurrentChar=':') AND (NextChar='=')) OR
((CurrentChar='.') AND (NextChar='.'))
)
END DoubleDelimiter ;
PROCEDURE AdvanceChar ;
BEGIN
IF NOT Eof
THEN
CurrentChar := NextChar ;
CurCharIndex := NextCharIndex ;
IndexCur := IndexNext ;
CurLine := NextLine ;
IF CurrentChar=eof
THEN
Eof := TRUE
ELSIF NextCharIndex=HighNext
THEN
IndexNext := (IndexCur+1) MOD Wrap ;
HighNext := 0 ;
REPEAT
NextChar := ReadChar(f) ;
IF NOT IsNoError(f)
THEN
NextChar := eof ;
Lines[IndexNext][HighNext] := NextChar ;
INC( HighNext )
END ;
WHILE (NextChar#eof) AND (NextChar#lf) AND (NextChar#cr) AND (HighNext<MaxLine) DO
Lines[IndexNext][HighNext] := NextChar ;
INC( HighNext ) ;
NextChar := ReadChar(f) ;
IF NOT IsNoError(f)
THEN
NextChar := eof
END
END ;
IF (NextChar=eof) OR (NextChar=lf) OR (NextChar=cr)
THEN
IF InQuotes
THEN
Lines[IndexNext][HighNext] := ' ' ; (* Space for delimiter *)
Lines[IndexNext][HighNext+1] := nul ;
WriteError('missing end of quote on this source line') ; HALT
END ;
INC( NextLine )
END
UNTIL HighNext>0 ;
IF HighNext>=MaxLine THEN WriteError('Line too long') ; HALT END ;
Lines[IndexNext][HighNext] := ' ' ; (* Space for delimiter *)
Lines[IndexNext][HighNext+1] := nul ;
NextCharIndex := 0 ;
NextChar := Lines[IndexNext][NextCharIndex]
ELSE
INC(NextCharIndex) ;
NextChar := Lines[IndexNext][NextCharIndex]
END
END
END AdvanceChar ;
PROCEDURE Init ;
BEGIN
StackPtr := 0 ;
InQuotes := FALSE ;
Eof := FALSE ;
IndexCur := 1 ;
IndexNext := 0 ;
CurCharIndex := 0 ;
Lines[IndexCur][0] := nul ;
HighNext := 0 ;
NextCharIndex := 0 ;
CurLine := 1 ;
NextLine := 1 ;
CurrentChar := ' ' ;
NextChar := ' ' ;
StrCopy("", CurrentSymbol) ;
StrCopy("", LastSymbol) ;
IndexCur := IndexNext
END Init ;
BEGIN
Init
END M2Lex.

View file

@ -0,0 +1,277 @@
(* M2LexBuf.def provides a buffer for m2.lex.
Copyright (C) 2001-2022 Free Software Foundation, Inc.
Contributed by Gaius Mulley <gaius.mulley@southwales.ac.uk>.
This file is part of GNU Modula-2.
GNU Modula-2 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 3, or (at your option)
any later version.
GNU Modula-2 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 GNU Modula-2; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. *)
DEFINITION MODULE M2LexBuf ;
(*
Title : M2LexBuf
Author : Gaius Mulley
System : UNIX (GNU Modula-2)
Date : Fri Jul 27 12:42:13 2001
Description: provides a buffer for the all the tokens created by m2.lex.
*)
FROM SYSTEM IMPORT ADDRESS ;
FROM M2Reserved IMPORT toktype ;
FROM DynamicStrings IMPORT String ;
FROM m2linemap IMPORT location_t ;
FROM NameKey IMPORT Name ;
EXPORT QUALIFIED OpenSource, CloseSource, ReInitialize, GetToken, InsertToken,
InsertTokenAndRewind, GetPreviousTokenLineNo, GetLineNo,
GetColumnNo, GetTokenNo, TokenToLineNo, TokenToColumnNo,
TokenToLocation, GetTokenName,
FindFileNameFromToken, GetFileName,
ResetForNewPass,
currenttoken, currentstring, currentinteger,
AddTok, AddTokCharStar, AddTokInteger, MakeVirtualTok,
SetFile, PushFile, PopFile,
PrintTokenNo, DisplayToken, DumpTokens,
BuiltinTokenNo, UnknownTokenNo ;
CONST
UnknownTokenNo = 0 ;
BuiltinTokenNo = 1 ;
VAR
currenttoken : toktype ;
currentstring : ADDRESS ;
currentcolumn : CARDINAL ;
currentinteger: INTEGER ;
(*
OpenSource - Attempts to open the source file, s.
The success of the operation is returned.
*)
PROCEDURE OpenSource (s: String) : BOOLEAN ;
(*
CloseSource - closes the current open file.
*)
PROCEDURE CloseSource ;
(*
ReInitialize - re-initialize the all the data structures.
*)
PROCEDURE ReInitialize ;
(*
ResetForNewPass - reset the buffer pointers to the beginning ready for
a new pass
*)
PROCEDURE ResetForNewPass ;
(*
GetToken - gets the next token into currenttoken.
*)
PROCEDURE GetToken ;
(*
InsertToken - inserts a symbol, token, infront of the current token
ready for the next pass.
*)
PROCEDURE InsertToken (token: toktype) ;
(*
InsertTokenAndRewind - inserts a symbol, token, infront of the current token
and then moves the token stream back onto the inserted token.
*)
PROCEDURE InsertTokenAndRewind (token: toktype) ;
(*
GetPreviousTokenLineNo - returns the line number of the previous token.
*)
PROCEDURE GetPreviousTokenLineNo () : CARDINAL ;
(*
GetLineNo - returns the current line number where the symbol occurs in
the source file.
*)
PROCEDURE GetLineNo () : CARDINAL ;
(*
GetTokenNo - returns the current token number.
*)
PROCEDURE GetTokenNo () : CARDINAL ;
(*
GetTokenName - returns the token name given the tokenno.
*)
PROCEDURE GetTokenName (tokenno: CARDINAL) : Name ;
(*
TokenToLineNo - returns the line number of the current file for the
TokenNo. The depth refers to the include depth.
A depth of 0 is the current file, depth of 1 is the file
which included the current file. Zero is returned if the
depth exceeds the file nesting level.
*)
PROCEDURE TokenToLineNo (TokenNo: CARDINAL; depth: CARDINAL) : CARDINAL ;
(*
GetColumnNo - returns the current column where the symbol occurs in
the source file.
*)
PROCEDURE GetColumnNo () : CARDINAL ;
(*
TokenToColumnNo - returns the column number of the current file for the
TokenNo. The depth refers to the include depth.
A depth of 0 is the current file, depth of 1 is the file
which included the current file. Zero is returned if the
depth exceeds the file nesting level.
*)
PROCEDURE TokenToColumnNo (TokenNo: CARDINAL; depth: CARDINAL) : CARDINAL ;
(*
TokenToLocation - returns the location_t corresponding to, TokenNo.
*)
PROCEDURE TokenToLocation (TokenNo: CARDINAL) : location_t ;
(*
FindFileNameFromToken - returns the complete FileName for the appropriate
source file yields the token number, TokenNo.
The, Depth, indicates the include level: 0..n
Level 0 is the current. NIL is returned if n+1
is requested.
*)
PROCEDURE FindFileNameFromToken (TokenNo: CARDINAL; depth: CARDINAL) : String ;
(*
GetFileName - returns a String defining the current file.
*)
PROCEDURE GetFileName () : String ;
(*
MakeVirtualTok - creates and return a new tokenno which is created from
tokenno range1 and range2.
*)
PROCEDURE MakeVirtualTok (caret, left, right: CARDINAL) : CARDINAL ;
(* ***********************************************************************
*
* These functions allow m2.lex to deliver tokens into the buffer
*
************************************************************************* *)
(*
AddTok - adds a token to the buffer.
*)
PROCEDURE AddTok (t: toktype) ;
(*
AddTokCharStar - adds a token to the buffer and an additional string, s.
A copy of string, s, is made.
*)
PROCEDURE AddTokCharStar (t: toktype; s: ADDRESS) ;
(*
AddTokInteger - adds a token and an integer to the buffer.
*)
PROCEDURE AddTokInteger (t: toktype; i: INTEGER) ;
(*
SetFile - sets the current filename to, filename.
*)
PROCEDURE SetFile (filename: ADDRESS) ;
(*
PushFile - indicates that, filename, has just been included.
*)
PROCEDURE PushFile (filename: ADDRESS) ;
(*
PopFile - indicates that we are returning to, filename, having finished
an include.
*)
PROCEDURE PopFile (filename: ADDRESS) ;
(*
PrintTokenNo - displays token and the location of the token.
*)
PROCEDURE PrintTokenNo (tokenno: CARDINAL) ;
(*
DisplayToken - display the token name using printf0 no newline is emitted.
*)
PROCEDURE DisplayToken (tok: toktype) ;
(*
DumpTokens - developer debugging aid.
*)
PROCEDURE DumpTokens ;
END M2LexBuf.

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,185 @@
(* M2MetaError.def provides a set of high level error routines.
Copyright (C) 2008-2022 Free Software Foundation, Inc.
Contributed by Gaius Mulley <gaius.mulley@southwales.ac.uk>.
This file is part of GNU Modula-2.
GNU Modula-2 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 3, or (at your option)
any later version.
GNU Modula-2 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 GNU Modula-2; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. *)
DEFINITION MODULE M2MetaError ;
(*
Title : M2MetaError
Author : Gaius Mulley
System : GNU Modula-2
Date : Tue Oct 14 12:11:13 2008
Revision : $Version$
Description: provides a set of high level error routines. These
routines utilise M2Error and provides the programmer
with an easier method to obtain useful symbol table
information.
*)
FROM DynamicStrings IMPORT String ;
FROM NameKey IMPORT Name ;
EXPORT QUALIFIED MetaError0, MetaError1, MetaError2, MetaError3, MetaError4,
MetaErrors1, MetaErrors2, MetaErrors3, MetaErrors4,
MetaErrorT0, MetaErrorT1, MetaErrorT2, MetaErrorT3, MetaErrorT4,
MetaErrorsT1, MetaErrorsT2, MetaErrorsT3, MetaErrorsT4,
MetaErrorString0,
MetaErrorString1, MetaErrorString2, MetaErrorString3,
MetaErrorString4,
MetaErrorStringT0, MetaErrorStringT1, MetaErrorStringT2,
MetaErrorStringT3, MetaErrorStringT4,
MetaErrorN1, MetaErrorN2, MetaErrorNT0, MetaErrorNT1, MetaErrorNT2,
MetaString0, MetaString1, MetaString2, MetaString3, MetaString4 ;
(*
All the procedures below expect the s, s1, s2, s3, s4 to be symbols
and m, m1, m2, m3 are error messages and format specifiers.
By default all substitutions are enclosed in quotes. However there
are a few format modifiers which disable quotations.
The format specifiers are:
{%1a} symbol name for the first symbol.
{%1q} qualified name for the first symbol.
{%1t} type name for the first symbol.
{%1ts} skips type pseudonyms.
{%1d} symbol description
{%1td} type name or symbol description
{%1Td} get the type of the first symbol and describe it.
{%1Sd} skip the type pseudonyms of the first symbol and describe it.
{%1ua} force no quotes after substituting the text.
{%1D} sets the error message to where symbol 1 was declared.
The declaration will choose the definition module, then
implementation (or program) module.
{%1M} sets the error message to where symbol 1 was declared.
The declaration will choose the implementation or program
module and if these do not exist then it falls back to
the definition module.
{%1U} sets the error message to where symbol 1 was first used.
{%A} abort, issue non recoverable error message (this should
not used for internal errors).
{%E} error (default recoverable error).
{%W} message is a warning, not an error.
{%O} message is a note, not an error.
{%Kword} the string word is quoted and rendered as a keyword.
{%kword} the string word is unquoted and rendered as a keyword.
{%C} chain this error on the previous rooted error.
{%R} this error will be the root of the future chained errors.
{%n} decimal number. Not quoted.
{%N} count (number), for example, 1st, 2nd, 3rd, 4th. Not quoted.
{%X} push contents of the output string onto the string stack.
{%Yname} place contents of dictionary entry name onto the output string.
{%Zname} replace dictionary entry name for the output string.
Pop contents of the string stack onto the output string.
{%Q} remove all entries in the dictionary.
{%P} push the current color state.
{%p} pop the current color state.
{%Ffilename} the string filename will be rendered using the filename color.
{%ccolor} change color into one of: none, fixit-delete, fixit-insert,
locus, filename, type, error, warning, note.
%< open quote and color.
%> close quote and color.
%% %
%{ {
%} }
the error messages may also embed optional strings such as:
{%1a:this string is emitted if the symbol name is non null}
{!%1a:this string is emitted if the symbol name is null}
{!%1a:{%1d}}
if the symbol name does not exist then print a description
of the symbol.
{%1atd} was incompatible with the return type of the procedure
means print the symbol name (if null then print the type name
if null then print out the description) followed by the
string "was incompatible with the return type of the procedure"
Note all replaced names or descriptions are enclosed in quotes, like:
'foo', which matches the behaviour of gcc. Also note temporary names
are treated as null. Finally the order of format specifiers does
matter, {%1td} means get type name and use it if non null, otherwise
describe the symbol. If ordinary text is copied then it is not quoted.
The color strings are: "filename", "quote", "error", "warning", "note",
"locus", "insert", "delete", "type", "range1", range2".
*)
(*
ebnf := { percent | lbra | any } =:
percent := '%' anych =:
lbra := '{' [ '!' ] percenttoken '}' =:
percenttoken := '%' ( '1' op | '2' op | '3' op | '4' op ) =:
op := {'a'|'q'|'t'|'d'|'n'|'s'|'D'|'U'|'E'|'W'} then =:
then := [ ':' ebnf ] =:
*)
PROCEDURE MetaError0 (m: ARRAY OF CHAR) ;
PROCEDURE MetaError1 (m: ARRAY OF CHAR; s: CARDINAL) ;
PROCEDURE MetaError2 (m: ARRAY OF CHAR; s1, s2: CARDINAL) ;
PROCEDURE MetaError3 (m: ARRAY OF CHAR; s1, s2, s3: CARDINAL) ;
PROCEDURE MetaError4 (m: ARRAY OF CHAR; s1, s2, s3, s4: CARDINAL) ;
PROCEDURE MetaErrors1 (m1, m2: ARRAY OF CHAR; s: CARDINAL) ;
PROCEDURE MetaErrors2 (m1, m2: ARRAY OF CHAR; s1, s2: CARDINAL) ;
PROCEDURE MetaErrors3 (m1, m2: ARRAY OF CHAR; s1, s2, s3: CARDINAL) ;
PROCEDURE MetaErrors4 (m1, m2: ARRAY OF CHAR; s1, s2, s3, s4: CARDINAL) ;
PROCEDURE MetaErrorT0 (tok: CARDINAL; m: ARRAY OF CHAR) ;
PROCEDURE MetaErrorT1 (tok: CARDINAL; m: ARRAY OF CHAR; s: CARDINAL) ;
PROCEDURE MetaErrorT2 (tok: CARDINAL; m: ARRAY OF CHAR; s1, s2: CARDINAL) ;
PROCEDURE MetaErrorT3 (tok: CARDINAL; m: ARRAY OF CHAR; s1, s2, s3: CARDINAL) ;
PROCEDURE MetaErrorT4 (tok: CARDINAL; m: ARRAY OF CHAR; s1, s2, s3, s4: CARDINAL) ;
PROCEDURE MetaErrorsT1 (tok: CARDINAL; m1, m2: ARRAY OF CHAR; s: CARDINAL) ;
PROCEDURE MetaErrorsT2 (tok: CARDINAL; m1, m2: ARRAY OF CHAR; s1, s2: CARDINAL) ;
PROCEDURE MetaErrorsT3 (tok: CARDINAL; m1, m2: ARRAY OF CHAR; s1, s2, s3: CARDINAL) ;
PROCEDURE MetaErrorsT4 (tok: CARDINAL; m1, m2: ARRAY OF CHAR; s1, s2, s3, s4: CARDINAL) ;
PROCEDURE MetaErrorString0 (m: String) ;
PROCEDURE MetaErrorString1 (m: String; s: CARDINAL) ;
PROCEDURE MetaErrorString2 (m: String; s1, s2: CARDINAL) ;
PROCEDURE MetaErrorString3 (m: String; s1, s2, s3: CARDINAL) ;
PROCEDURE MetaErrorString4 (m: String; s1, s2, s3, s4: CARDINAL) ;
PROCEDURE MetaErrorStringT0 (tok: CARDINAL; m: String) ;
PROCEDURE MetaErrorStringT1 (tok: CARDINAL; m: String; s: CARDINAL) ;
PROCEDURE MetaErrorStringT2 (tok: CARDINAL; m: String; s1, s2: CARDINAL) ;
PROCEDURE MetaErrorStringT3 (tok: CARDINAL; m: String; s1, s2, s3: CARDINAL) ;
PROCEDURE MetaErrorStringT4 (tok: CARDINAL; m: String; s1, s2, s3, s4: CARDINAL) ;
PROCEDURE MetaErrorN1 (m: ARRAY OF CHAR; n: Name) ;
PROCEDURE MetaErrorN2 (m: ARRAY OF CHAR; n1, n2: Name) ;
PROCEDURE MetaErrorNT0 (tok: CARDINAL; format: ARRAY OF CHAR) ;
PROCEDURE MetaErrorNT1 (tok: CARDINAL; format: ARRAY OF CHAR; name: Name) ;
PROCEDURE MetaErrorNT2 (tok: CARDINAL; format: ARRAY OF CHAR; name1, name2: Name) ;
PROCEDURE MetaString0 (m: String) : String ;
PROCEDURE MetaString1 (m: String; s: CARDINAL) : String ;
PROCEDURE MetaString2 (m: String; s1, s2: CARDINAL) : String ;
PROCEDURE MetaString3 (m: String; s1, s2, s3: CARDINAL) : String ;
PROCEDURE MetaString4 (m: String; s1, s2, s3, s4: CARDINAL) : String ;
END M2MetaError.

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,59 @@
(* M2Optimize.def removes redundant quadruples.
Copyright (C) 2001-2022 Free Software Foundation, Inc.
Contributed by Gaius Mulley <gaius.mulley@southwales.ac.uk>.
This file is part of GNU Modula-2.
GNU Modula-2 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 3, or (at your option)
any later version.
GNU Modula-2 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 GNU Modula-2; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. *)
DEFINITION MODULE M2Optimize ;
(*
Title : M2Optimize.def
Author : Gaius Mulley
System : UNIX (gm2)
Date : Fri Aug 20 14:51:00 1999
Description: provides a very simple branch optimization module so that
we dont give too many redundant gotos to gcc.
*)
EXPORT QUALIFIED FoldBranches, RemoveProcedures, DisplayReachable ;
(*
FoldBranches - folds unneccessary branches in the list of quadruples.
*)
PROCEDURE FoldBranches (start, end: CARDINAL) ;
(*
RemoveProcedures - removes any procedures that are never referenced
by the quadruples.
*)
PROCEDURE RemoveProcedures (scope: CARDINAL) ;
(*
DisplayReachable - displays the data structures surrounding Reachablity.
*)
PROCEDURE DisplayReachable ;
END M2Optimize.

View file

@ -0,0 +1,521 @@
(* M2Optimize.mod removes redundant quadruples.
Copyright (C) 2001-2022 Free Software Foundation, Inc.
Contributed by Gaius Mulley <gaius.mulley@southwales.ac.uk>.
This file is part of GNU Modula-2.
GNU Modula-2 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 3, or (at your option)
any later version.
GNU Modula-2 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 GNU Modula-2; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. *)
IMPLEMENTATION MODULE M2Optimize ;
(*
Title : M2Optimize
Author : Gaius Mulley
System : UNIX (GNU Modula-2)
Date : Sat Aug 14 15:07:47 1999
Description: removes redundant quadruples, redundant GotoOps, redundant procedures.
*)
FROM M2Debug IMPORT Assert ;
FROM NameKey IMPORT Name, WriteKey, MakeKey, GetKey ;
FROM StrIO IMPORT WriteString, WriteLn ;
FROM NumberIO IMPORT WriteCard ;
FROM M2Error IMPORT InternalError ;
FROM M2Batch IMPORT GetModuleNo ;
FROM M2Quiet IMPORT qprintf1 ;
FROM M2Scope IMPORT ScopeBlock, InitScopeBlock, KillScopeBlock, ForeachScopeBlockDo ;
FROM SymbolTable IMPORT GetSymName,
GetProcedureQuads, GetModuleQuads,
GetModule, GetNthProcedure,
GetSubrange, GetModuleScope,
PutProcedureReachable, IsProcedureReachable,
PutProcedureStartQuad, PutProcedureEndQuad,
PutProcedureScopeQuad,
PutNeedSavePriority,
IsProcedure, GetPriority,
GetDeclaredMod, GetFirstUsed,
GetType,
IsExportQualified, IsExportUnQualified, IsExported,
ForeachProcedureDo, ForeachInnerModuleDo,
IsModuleWithinProcedure,
NulSym ;
FROM M2Quads IMPORT QuadOperator, GetQuad, GetFirstQuad, GetNextQuad,
PutQuad, SubQuad, Opposite, IsReferenced,
GetRealQuad ;
(*
FoldBranches - folds unneccessary branches in the list of quadruples.
It searches for the following patterns:
[x] GotoOp _ _ y GotoOp _ _ z
... ...
[y] GotoOp _ _ z "deleted"
WHERE ... may contain 0..n Pseudo Quads
OR
[x] IfREL _ _ z If NOT REL _ _ a
... ...
[y] Goto _ _ a "deleted"
... ...
[z]
WHERE ... may contain 0..n Pseudo Quads
but in this case they must not be a
target of any other quad.
*)
PROCEDURE FoldBranches (start, end: CARDINAL) ;
VAR
Folded : BOOLEAN ;
i, j,
Right : CARDINAL ;
Operator : QuadOperator ;
Operand1,
Operand2,
Operand3 : CARDINAL ;
BEGIN
REPEAT
i := start ;
Folded := FALSE ;
WHILE (i<=end) AND (i#0) DO
j := GetNextQuad(i) ;
IF (j>end) OR (j=0)
THEN
RETURN
END ;
Right := GetRealQuad(j) ;
IF Right=0
THEN
RETURN
END ;
GetQuad(i, Operator, Operand1, Operand2, Operand3) ;
CASE Operator OF
GotoOp : Folded := ReduceGoto(i, Operand3,
Right, Folded) |
IfInOp, IfNotInOp,
IfNotEquOp, IfEquOp,
IfLessEquOp, IfGreEquOp,
IfGreOp, IfLessOp : Folded := ReduceBranch(Operator, i,
Operand1, Operand2, Operand3,
Right, Folded)
ELSE
END ;
i := Right
END
UNTIL NOT Folded
END FoldBranches ;
(*
ReduceBranch - searches for the following pattern:
[x] IfREL _ _ z If NOT REL _ _ a
... ...
[y] Goto _ _ a "deleted"
... ...
[z]
WHERE ... may contain 0..n Pseudo Quads
but in this case they must not be a
target of any other quad.
*)
PROCEDURE ReduceBranch (Operator: QuadOperator;
CurrentQuad,
CurrentOperand1, CurrentOperand2,
CurrentOperand3: CARDINAL;
VAR NextQuad: CARDINAL;
Folded: BOOLEAN) : BOOLEAN ;
VAR
OpNext : QuadOperator ;
NextPlusOne,
Op1Next,
Op2Next,
Op3Next,
From,
To : CARDINAL ;
BEGIN
(* If op NextQuad+1 *)
(* Goto x *)
IF NextQuad#0
THEN
IF (GetNextQuad(CurrentQuad)=CurrentOperand3) OR
(GetRealQuad(GetNextQuad(CurrentQuad))=CurrentOperand3)
THEN
SubQuad(CurrentQuad) ;
Folded := TRUE
ELSE
From := GetNextQuad(CurrentQuad) ; (* start after CurrentQuad *)
To := NextQuad ;
CurrentOperand3 := GetRealQuad(CurrentOperand3) ;
NextPlusOne := GetRealQuad(GetNextQuad(NextQuad)) ;
GetQuad(NextQuad, OpNext, Op1Next, Op2Next, Op3Next) ;
IF (OpNext=GotoOp) AND (NextPlusOne=CurrentOperand3) AND
IsBasicBlock(From, To)
THEN
(* Op3Next := GetRealQuad(Op3Next) ; *)
SubQuad(NextQuad) ;
PutQuad(CurrentQuad, Opposite(Operator),
CurrentOperand1, CurrentOperand2, Op3Next) ;
NextQuad := NextPlusOne ;
Folded := TRUE
END
END ;
IF FoldMultipleGoto(CurrentQuad)
THEN
Folded := TRUE
END
END ;
RETURN( Folded )
END ReduceBranch ;
(*
IsBasicBlock - returns TRUE if no other quadruple jumps inbetween
the range From..To.
It assumes that there are no jumps in the quadruples
From..To.
*)
PROCEDURE IsBasicBlock (From, To: CARDINAL) : BOOLEAN ;
BEGIN
WHILE From # To DO
IF IsReferenced (From)
THEN
RETURN FALSE
ELSE
IF From > To
THEN
InternalError ('assert failed From should never be larger than To')
END ;
From := GetNextQuad (From)
END
END ;
RETURN TRUE
END IsBasicBlock ;
(*
ReduceGoto - searches for the following patterns:
[x] GotoOp _ _ y GotoOp _ _ z
... ...
[y] GotoOp _ _ z "deleted"
*)
PROCEDURE ReduceGoto (CurrentQuad, CurrentOperand3, NextQuad: CARDINAL;
Folded: BOOLEAN) : BOOLEAN ;
BEGIN
CurrentOperand3 := GetRealQuad(CurrentOperand3) ;
(* IF next quad is a GotoOp *)
IF CurrentOperand3=NextQuad
THEN
SubQuad(CurrentQuad) ;
Folded := TRUE
ELSE
(* Does Goto point to another Goto ? *)
IF FoldMultipleGoto(CurrentQuad)
THEN
Folded := TRUE
END
END ;
RETURN( Folded )
END ReduceGoto ;
(*
FoldMultipleGoto - takes a QuadNo and if it jumps to another GotoOp
then it takes the later target as a replacement
for its own.
NOTE it does not remove any quadruples.
*)
PROCEDURE FoldMultipleGoto (QuadNo: CARDINAL) : BOOLEAN ;
VAR
Operator,
Op : QuadOperator ;
Op1, Op2,
Op3,
Operand1,
Operand2,
Operand3: CARDINAL ;
BEGIN
GetQuad(QuadNo, Operator, Operand1, Operand2, Operand3) ;
Operand3 := GetRealQuad(Operand3) ; (* skip pseudo quadruples *)
GetQuad(Operand3, Op, Op1, Op2, Op3) ;
IF Op=GotoOp
THEN
PutQuad(QuadNo, Operator, Operand1, Operand2, Op3) ;
(* Dont want success to be returned if in fact the Goto *)
(* line number has not changed... otherwise we loop *)
(* forever. *)
RETURN( Op3#Operand3 )
ELSE
RETURN( FALSE )
END
END FoldMultipleGoto ;
(*
CheckNeedSavePriority -
*)
PROCEDURE CheckNeedSavePriority (sym: CARDINAL) ;
BEGIN
IF IsProcedure(sym) AND (GetPriority(GetModuleScope(sym))#NulSym)
THEN
PutNeedSavePriority(sym)
END
END CheckNeedSavePriority ;
(*
CheckExportedReachable - checks to see whether procedure, sym, was
exported and if so it calls RemoveProcedures.
*)
PROCEDURE CheckExportedReachable (sym: CARDINAL) ;
BEGIN
IF IsExported(GetModuleScope(sym), sym)
THEN
RemoveProcedures(sym) ;
CheckNeedSavePriority(sym)
END
END CheckExportedReachable ;
(*
RemoveProcedures - removes any procedures that are never referenced
by the quadruples.
*)
PROCEDURE RemoveProcedures (scope: CARDINAL) ;
VAR
sb: ScopeBlock ;
BEGIN
sb := InitScopeBlock(scope) ;
IF IsProcedure(scope)
THEN
PutProcedureReachable(scope) ;
ForeachScopeBlockDo(sb, KnownReachable)
ELSIF IsModuleWithinProcedure(scope)
THEN
ForeachScopeBlockDo(sb, KnownReachable) ;
ForeachProcedureDo(scope, CheckExportedReachable)
ELSE
ForeachScopeBlockDo(sb, KnownReachable) ;
ForeachProcedureDo(scope, CheckExportedReachable)
END ;
ForeachInnerModuleDo(scope, RemoveProcedures) ;
KillScopeBlock(sb) ;
(* DeleteUnReachableProcedures *)
END RemoveProcedures ;
PROCEDURE KnownReachable (Start, End: CARDINAL) ;
VAR
Op : QuadOperator ;
Op1, Op2, Op3: CARDINAL ;
BEGIN
IF Start#0
THEN
REPEAT
GetQuad(Start, Op, Op1, Op2, Op3) ;
CASE Op OF
CallOp : KnownReach(Op3) |
AddrOp,
ParamOp,
XIndrOp,
BecomesOp: KnownReach(Op3) ;
CheckNeedSavePriority(Op3)
ELSE
END ;
Start := GetNextQuad(Start)
UNTIL (Start>End) OR (Start=0)
END
END KnownReachable ;
PROCEDURE KnownReach (sym: CARDINAL) ;
BEGIN
IF IsProcedure(sym) AND (NOT IsProcedureReachable(sym))
THEN
RemoveProcedures(sym)
END
END KnownReach ;
(*
DeleteUnReachableProcedures - Deletes all procedures that are unreachable.
*)
(*
PROCEDURE DeleteUnReachableProcedures ;
VAR
ProcName: Name ;
n, m,
Scope,
Start,
End,
Module,
Proc : CARDINAL ;
BEGIN
m := 1 ;
REPEAT
Module := GetModuleNo(m) ;
IF Module#NulSym
THEN
n := 1 ;
Proc := GetNthProcedure(Module, n) ;
WHILE Proc#NulSym DO
IF IsProcedureReachable(Proc) OR
IsExportQualified(Proc) OR IsExportUnQualified(Proc)
THEN
(* is reachable - do not delete it *)
ELSE
ProcName := GetSymName(Proc) ;
qprintf1('[%a]\n', ProcName) ;
GetProcedureQuads(Proc, Scope, Start, End) ;
IF Start#0
THEN
Delete(Scope, End) ;
(* No Longer any Quads for this Procedure *)
PutProcedureScopeQuad(Proc, 0) ;
PutProcedureStartQuad(Proc, 0) ;
PutProcedureEndQuad(Proc, 0)
END
END ;
INC(n) ;
Proc := GetNthProcedure(Module, n)
END ;
INC(m)
END
UNTIL Module=NulSym
END DeleteUnReachableProcedures ;
(*
Delete - deletes all quadruples from Start..End
or the end of the procedure.
*)
PROCEDURE Delete (Start, End: CARDINAL) ;
VAR
Last,
i : CARDINAL ;
Op : QuadOperator ;
Op1,
Op2,
Op3 : CARDINAL ;
BEGIN
Last := GetNextQuad(End) ;
WHILE (GetFirstQuad()#0) AND (Start#0) AND (Last#Start) DO
GetQuad(Start, Op, Op1, Op2, Op3) ;
IF Op=DummyOp
THEN
(* Start has already been deleted - try next quad *)
INC(Start)
ELSIF Op=ReturnOp
THEN
(* Found end of procedure therefore just delete and exit *)
(* WriteString('Deleting') ; WriteCard(Start, 6) ; WriteLn ; *)
SubQuad(Start) ;
Start := Last
ELSE
(* Following the list of quadruples to the End *)
i := GetNextQuad(Start) ;
(* WriteString('Deleting') ; WriteCard(Start, 6) ; WriteLn ; *)
SubQuad(Start) ;
Start := i
END
END
END Delete ;
*)
(*
DisplayReachable - Displays the data structures surrounding Reachablity.
*)
PROCEDURE DisplayReachable ;
VAR
n, m,
Scope,
StartInit,
EndInit,
StartFinish,
EndFinish,
Module,
Proc : CARDINAL ;
BEGIN
m := 1 ;
REPEAT
Module := GetModuleNo(m) ;
IF Module#NulSym
THEN
WriteString('Module') ; WriteCard(m, 3) ; WriteKey(GetSymName(Module)) ;
GetModuleQuads(Module, StartInit, EndInit, StartFinish, EndFinish) ;
WriteString(' Reachable initialization') ;
WriteCard(StartInit, 6) ; WriteCard(EndInit, 6) ; WriteLn ;
WriteString('Module') ; WriteCard(m, 3) ; WriteKey(GetSymName(Module)) ;
GetModuleQuads(Module, StartInit, EndInit, StartFinish, EndFinish) ;
WriteString(' Reachable finalization') ;
WriteCard(StartFinish, 6) ; WriteCard(EndFinish, 6) ; WriteLn ;
n := 1 ;
Proc := GetNthProcedure(Module, n) ;
WHILE Proc#NulSym DO
WriteString('Procedure ') ; WriteKey(GetSymName(Proc)) ;
GetProcedureQuads(Proc, Scope, StartInit, EndInit) ;
WriteString(' Quads: ') ; WriteCard(StartInit, 6) ; WriteCard(EndInit, 6) ;
IF NOT IsProcedureReachable(Proc)
THEN
WriteString(' UN reachable')
ELSE
WriteString(' IS reachable')
END ;
WriteLn ;
INC(n) ;
Proc := GetNthProcedure(Module, n)
END ;
INC(m)
END
UNTIL Module=NulSym
END DisplayReachable ;
END M2Optimize.

View file

@ -0,0 +1,818 @@
(* M2Options.def initializes the user options.
Copyright (C) 2001-2022 Free Software Foundation, Inc.
Contributed by Gaius Mulley <gaius.mulley@southwales.ac.uk>.
This file is part of GNU Modula-2.
GNU Modula-2 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 3, or (at your option)
any later version.
GNU Modula-2 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 GNU Modula-2; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. *)
DEFINITION MODULE M2Options ;
(*
Author : Gaius Mulley
Title : M2Options
Date : 27/5/87 [$Date: 2013/08/14 20:39:40 $]
SYSTEM : UNIX (GNU Modula-2)
Description: Initializes the user options in the Modula-2 compiler.
Version : $Revision: 1.31 $
*)
FROM SYSTEM IMPORT ADDRESS ;
FROM DynamicStrings IMPORT String ;
FROM m2linemap IMPORT location_t ;
EXPORT QUALIFIED SetReturnCheck, SetNilCheck, SetCaseCheck,
SetCheckAll, SetVerboseUnbounded, SetQuiet, SetCpp, GetCpp,
(* SetMakeall, SetMakeall0, SetIncludePath, *) SetAutoInit,
SetUnboundedByReference,
SetSearchPath, SetISO, SetPIM, SetPIM2, SetPIM3, SetPIM4,
SetPositiveModFloor, SetCompilerDebugging, SetExceptions,
SetStyle, SetPedantic, SetPedanticParamNames, SetPedanticCast,
SetExtendedOpaque, SetXCode, SetQuadDebugging, SetSources,
SetDumpSystemExports,
SetSwig, SetOptimizing, SetForcedLocation,
SetCC1Quiet, SetWholeProgram, SetDebugTraceQuad, SetDebugTraceAPI,
SetVerbose, SetM2g, GetM2g,
GetISO, GetPIM, GetPIM2, GetPIM3, GetPIM4,
GetPositiveModFloor,
SetFloatValueCheck, GetFloatValueCheck,
SetWholeValueCheck, GetWholeValueCheck,
SetLowerCaseKeywords,
SetIndex, SetRange, SetWholeDiv, SetStrictTypeChecking,
Setc, Getc, SetUselist, GetUselist, GetUselistFilename,
SetShared, SetB,
Iso, Pim, Pim2, Pim3, Pim4,
cflag,
PositiveModFloorDiv,
Pedantic, Verbose, Statistics,
UnboundedByReference, VerboseUnbounded,
Profiling, Coding, Optimizing,
OptimizeBasicBlock, OptimizeUncalledProcedures,
OptimizeCommonSubExpressions,
StyleChecking, WholeProgram,
NilChecking,
WholeDivChecking, WholeValueChecking,
IndexChecking, RangeChecking,
ReturnChecking, CaseElseChecking,
AutoInit,
VariantValueChecking,
UnusedVariableChecking, UnusedParameterChecking,
SetUnusedVariableChecking, SetUnusedParameterChecking,
Quiet, LineDirectives, StrictTypeChecking,
CPreProcessor, Xcode, ExtendedOpaque,
LowerCaseKeywords,
PedanticParamNames, PedanticCast,
DisplayQuadruples, DebugTraceQuad, DebugTraceAPI,
CompilerDebugging, GenerateDebugging, GenerateLineDebug,
DumpSystemExports, GenerateSwig, Exceptions,
OverrideLocation, FinaliseOptions,
DebugBuiltins, setdefextension, setmodextension,
SetStatistics, SetWall,
SetSaveTemps, SetSaveTempsDir, SaveTemps, GetSaveTempsDir,
GenModuleList,
CppArg, CppCommandLine, CppRemember,
SetDebugFunctionLineNumbers, DebugFunctionLineNumbers,
SetGenerateStatementNote, GenerateStatementNote,
ScaffoldDynamic, ScaffoldStatic,
SetScaffoldDynamic, SetScaffoldStatic,
SetScaffoldMain, ScaffoldMain,
SetRuntimeModuleOverride, GetRuntimeModuleOverride,
SetGenModuleList, GetGenModuleFilename, SharedFlag,
GetB ;
VAR
cflag, (* -c flag present? *)
Iso, (* -fiso use ISO SYSTEM.def *)
Pim, (* -fpim use PIM [234] SYSTEM.def *)
Pim2, (* -fpim2 use strict rules. *)
Pim3, (* -fpim3 use strict rules. *)
Pim4, (* -fpim4 use strict rules. *)
PositiveModFloorDiv, (* Force PIM4 behaviour for DIV and MOD *)
CompilerDebugging, (* -fd internal debugging messages *)
DebugTraceQuad, (* -fdebug-trace-quad *)
DebugTraceAPI, (* -fdebug-trace-api *)
GenerateDebugging, (* -g option to generate info for gdb/dbx *)
GenerateLineDebug, (* -gline to generate line debugging. *)
Verbose, (* -verbose produce verbose error messages. *)
Pedantic, (* -pedantic be pedantic on error checking. *)
PedanticParamNames, (* -Wpedantic-param-names *)
PedanticCast, (* -Wpedantic-cast warns if sizes differ. *)
Statistics, (* -fstatistics information about code *)
StyleChecking, (* -Wstudents checks for common student errs*)
DisplayQuadruples, (* -Wq option will display quadruples. *)
UnboundedByReference, (* -funbounded-by-reference *)
VerboseUnbounded, (* -Wverbose-unbounded *)
OptimizeUncalledProcedures, (* -Ouncalled removes uncalled procedures *)
OptimizeBasicBlock, (* -Obb create basic blocks and optimize. *)
OptimizeCommonSubExpressions, (* -Ocse optimize common subexpressions *)
WholeProgram, (* -fwhole-program optimization. *)
NilChecking, (* -fnil makes compiler test for pointer *)
(* NIL. *)
WholeDivChecking, (* -fwholediv produces code to raise an *)
(* exception if a whole number divide by *)
(* zero occurs. *)
WholeValueChecking, (* -fwholevalue produces code to raise an *)
(* exception if a whole value variable is *)
(* about to exceed the type limits. *)
FloatValueChecking, (* -ffloatvalue produces code to raise an *)
(* exception if a floating point variable *)
(* is about to exceed the type limits. *)
IndexChecking, (* -findex array bounds checking. *)
RangeChecking, (* -frange assignment, set values, *)
(* constructor values in range. *)
ReturnChecking, (* -freturn checks that functions always *)
(* exit with a RETURN statement. *)
CaseElseChecking, (* -fcase checks program does not need an *)
(* else statement within an case statement *)
(* when the user omits one *)
VariantValueChecking, (* Should we check all values are present *)
(* in a variant record? True for ISO and *)
(* false for PIM. *)
Quiet, (* -fquiet option specified. *)
LineDirectives, (* Should compiler understand preprocessor *)
(* # linenumber "filename" markers? *)
StrictTypeChecking, (* -fm2-strict-type experimental checker. *)
CPreProcessor, (* Must we run the cpp on the source? *)
Xcode, (* Should errors follow Xcode format? *)
ExtendedOpaque, (* Do we allow non pointer opaque types? *)
DumpSystemExports, (* Print all inbuilt system items? *)
GenerateSwig, (* Should we generate a swig interface file?*)
Exceptions, (* Should we generate exception code? *)
UnusedVariableChecking, (* Should we warn about unused variables? *)
UnusedParameterChecking, (* Should we warn about unused parameters? *)
LowerCaseKeywords, (* Should keywords in errors be in lower? *)
DebugBuiltins, (* Should we always call a real function? *)
AutoInit, (* -fauto-init assigns pointers to NIL. *)
SaveTemps, (* -save-temps save all temporary files. *)
ScaffoldDynamic, (* Should we generate a dynamic scaffold? *)
ScaffoldStatic, (* Should we generate a static scaffold? *)
ScaffoldMain, (* Should we generate a main function? *)
GenModuleList, (* Should the compiler generate a list of *)
(* all modules used? *)
SharedFlag, (* -fshared indicating this module needs *)
(* the shared library version of the *)
(* scaffold. *)
ForcedLocation,
DebugFunctionLineNumbers,
GenerateStatementNote,
Optimizing,
Coding,
Profiling : BOOLEAN ;
(*
Setc - set the cflag (compile only flag -c) to value.
*)
PROCEDURE Setc (value: BOOLEAN) ;
(*
Getc - get the cflag (compile only flag -c).
*)
PROCEDURE Getc () : BOOLEAN ;
(*
SetB - assigns Barg to arg.
*)
PROCEDURE SetB (arg: ADDRESS) ;
(*
GetB - returns argument to the -B option as a string or NIL if it were never set.
*)
PROCEDURE GetB () : ADDRESS ;
(*
SetScaffoldDynamic - set the -fscaffold-dynamic flag.
*)
PROCEDURE SetScaffoldDynamic (value: BOOLEAN) ;
(*
SetScaffoldStatic - set the -fscaffold-static flag.
*)
PROCEDURE SetScaffoldStatic (value: BOOLEAN) ;
(*
GetScaffoldDynamic - get the -fscaffold-dynamic flag.
*)
PROCEDURE GetScaffoldDynamic () : BOOLEAN ;
(*
GetScaffoldStatic - get the -fscaffold-static flag.
*)
PROCEDURE GetScaffoldStatic () : BOOLEAN ;
(*
SetScaffoldMain - set the -fscaffold-main flag.
*)
PROCEDURE SetScaffoldMain (value: BOOLEAN) ;
(*
SetRuntimeModuleOverride - set the override sequence used for module
initialization and finialization.
*)
PROCEDURE SetRuntimeModuleOverride (override: ADDRESS) ;
(*
GetRuntimeModuleOverride - return a string containing any user override
or the default module initialization override
sequence.
*)
PROCEDURE GetRuntimeModuleOverride () : ADDRESS ;
(*
SetUselist - set the uselist flag to value and remember the filename.
*)
PROCEDURE SetUselist (value: BOOLEAN; filename: ADDRESS) ;
(*
GetUselist - return the uselist flag.
*)
PROCEDURE GetUselist () : BOOLEAN ;
(*
GetUselistFilename - return the uselist filename as a String.
*)
PROCEDURE GetUselistFilename () : String ;
(*
SetWholeProgram - sets the WholeProgram flag (-fwhole-program).
*)
PROCEDURE SetWholeProgram (value: BOOLEAN) ;
(*
SetAutoInit - set the auto initialization flag to value. If the value
is true then all pointers are automatically
initialized to NIL.
*)
PROCEDURE SetAutoInit (value: BOOLEAN) : BOOLEAN ;
(*
SetReturnCheck - set return statement checking in procedure functions
to value.
*)
PROCEDURE SetReturnCheck (value: BOOLEAN) : BOOLEAN ;
(*
SetNilCheck - set access through NIL violation runtime checking to value.
*)
PROCEDURE SetNilCheck (value: BOOLEAN) : BOOLEAN ;
(*
SetCaseCheck - set else case checking to, value.
*)
PROCEDURE SetCaseCheck (value: BOOLEAN) : BOOLEAN ;
(*
SetCheckAll - set all runtime checking to, value.
*)
PROCEDURE SetCheckAll (value: BOOLEAN) : BOOLEAN ;
(*
SetVerboseUnbounded - sets the VerboseUnbounded flag to, value.
*)
PROCEDURE SetVerboseUnbounded (value: BOOLEAN) : BOOLEAN ;
(*
SetQuiet - sets the quiet flag to, value.
*)
PROCEDURE SetQuiet (value: BOOLEAN) : BOOLEAN ;
(*
SetCC1Quiet - sets the cc1quiet flag to, value.
*)
PROCEDURE SetCC1Quiet (value: BOOLEAN) ;
(*
SetCpp -
*)
PROCEDURE SetCpp (value: BOOLEAN) : BOOLEAN ;
(*
GetCpp - returns TRUE if the C preprocessor was used.
*)
PROCEDURE GetCpp () : BOOLEAN ;
(*
SetM2g - set the -fm2-g flag.
*)
PROCEDURE SetM2g (value: BOOLEAN) : BOOLEAN ;
(*
GetM2g - returns TRUE if the -fm2-g flags was used.
*)
PROCEDURE GetM2g () : BOOLEAN ;
(*
SetLowerCaseKeywords - set the lower case keyword flag and return the result.
*)
PROCEDURE SetLowerCaseKeywords (value: BOOLEAN) : BOOLEAN ;
(*
SetMakeall -
PROCEDURE SetMakeall (value: BOOLEAN) : BOOLEAN ;
*)
(*
SetMakeall0 -
PROCEDURE SetMakeall0 (value: BOOLEAN) : BOOLEAN ;
*)
(*
SetIncludePath -
PROCEDURE SetIncludePath (arg: ADDRESS) : BOOLEAN ;
*)
(*
SetUnboundedByReference -
*)
PROCEDURE SetUnboundedByReference (value: BOOLEAN) : BOOLEAN ;
(*
SetSearchPath -
*)
PROCEDURE SetSearchPath (arg: ADDRESS) ;
(*
SetISO -
*)
PROCEDURE SetISO (value: BOOLEAN) ;
(*
SetPIM -
*)
PROCEDURE SetPIM (value: BOOLEAN) ;
(*
SetPIM2 -
*)
PROCEDURE SetPIM2 (value: BOOLEAN) ;
(*
SetPIM3 -
*)
PROCEDURE SetPIM3 (value: BOOLEAN) ;
(*
SetPIM4 -
*)
PROCEDURE SetPIM4 (value: BOOLEAN) ;
(*
SetPositiveModFloor -
*)
PROCEDURE SetPositiveModFloor (value: BOOLEAN) ;
(*
SetWholeDiv - sets the whole division flag.
*)
PROCEDURE SetWholeDiv (value: BOOLEAN) ;
(*
SetIndex - sets the runtime array index checking flag.
*)
PROCEDURE SetIndex (value: BOOLEAN) ;
(*
SetRange - sets the runtime range checking flag.
*)
PROCEDURE SetRange (value: BOOLEAN) ;
(*
SetExceptions -
*)
PROCEDURE SetExceptions (value: BOOLEAN) ;
(*
SetStyle -
*)
PROCEDURE SetStyle (value: BOOLEAN) ;
(*
SetPedantic -
*)
PROCEDURE SetPedantic (value: BOOLEAN) ;
(*
SetPedanticParamNames -
*)
PROCEDURE SetPedanticParamNames (value: BOOLEAN) ;
(*
SetPedanticCast -
*)
PROCEDURE SetPedanticCast (value: BOOLEAN) ;
(*
SetExtendedOpaque -
*)
PROCEDURE SetExtendedOpaque (value: BOOLEAN) ;
(*
SetXCode -
*)
PROCEDURE SetXCode (value: BOOLEAN) ;
(*
SetCompilerDebugging - turn on internal compiler debugging.
*)
PROCEDURE SetCompilerDebugging (value: BOOLEAN) ;
(*
SetQuadDebugging - display the quadruples (internal debugging).
*)
PROCEDURE SetQuadDebugging (value: BOOLEAN) ;
(*
SetDebugTraceQuad -
*)
PROCEDURE SetDebugTraceQuad (value: BOOLEAN) ;
(*
SetDebugTraceAPI -
*)
PROCEDURE SetDebugTraceAPI (value: BOOLEAN) ;
(*
SetDebugFunctionLineNumbers - turn DebugFunctionLineNumbers on/off
(used internally for debugging).
*)
PROCEDURE SetDebugFunctionLineNumbers (value: BOOLEAN) ;
(*
SetGenerateStatementNote - turn on generation of nops if necessary
to generate pedalogical single stepping.
*)
PROCEDURE SetGenerateStatementNote (value: BOOLEAN) ;
(*
SetSources -
*)
PROCEDURE SetSources (value: BOOLEAN) ;
(*
SetDumpSystemExports -
*)
PROCEDURE SetDumpSystemExports (value: BOOLEAN) ;
(*
SetSwig -
*)
PROCEDURE SetSwig (value: BOOLEAN) ;
(*
SetOptimizing -
*)
PROCEDURE SetOptimizing (value: CARDINAL) ;
(*
OverrideLocation - possibly override the location value, depending upon
whether the -flocation= option was used.
*)
PROCEDURE OverrideLocation (location: location_t) : location_t ;
(*
SetForcedLocation - sets the location for the lifetime of this compile to, location.
This is primarily an internal debugging switch.
*)
PROCEDURE SetForcedLocation (location: location_t) ;
(*
SetUnusedVariableChecking - assigns the UnusedVariableChecking to value.
*)
PROCEDURE SetUnusedVariableChecking (value: BOOLEAN) ;
(*
SetUnusedParameterChecking - assigns the UnusedParameterChecking to value.
*)
PROCEDURE SetUnusedParameterChecking (value: BOOLEAN) ;
(*
SetStrictTypeChecking - assigns the StrictTypeChecking flag to value.
*)
PROCEDURE SetStrictTypeChecking (value: BOOLEAN) ;
(*
setdefextension -
*)
PROCEDURE setdefextension (arg: ADDRESS) ;
(*
setmodextension -
*)
PROCEDURE setmodextension (arg: ADDRESS) ;
(*
SetStatistics - turn on/off generate of compile time statistics.
*)
PROCEDURE SetStatistics (on: BOOLEAN) ;
(*
SetVerbose - set the Verbose flag to, value. It returns TRUE.
*)
PROCEDURE SetVerbose (value: BOOLEAN) : BOOLEAN ;
(*
CppArg - sets the option and arg in the cpp command line.
*)
PROCEDURE CppArg (opt, arg: ADDRESS; joined: BOOLEAN) ;
(*
CppCommandLine - returns the Cpp command line and all arguments.
*)
PROCEDURE CppCommandLine () : String ;
(*
CppRemember - remember a string, s, as a cpp related argument.
The string, s, is not garbage collected.
*)
PROCEDURE CppRemember (s: String) ;
(*
GetISO - return TRUE if -fiso was present on the command line.
*)
PROCEDURE GetISO () : BOOLEAN ;
(*
GetPIM - return TRUE if -fpim was present on the command line.
*)
PROCEDURE GetPIM () : BOOLEAN ;
(*
GetPIM2 - return TRUE if -fpim2 was present on the command line.
*)
PROCEDURE GetPIM2 () : BOOLEAN ;
(*
GetPIM3 - return TRUE if -fpim3 was present on the command line.
*)
PROCEDURE GetPIM3 () : BOOLEAN ;
(*
GetPIM4 - return TRUE if -fpim4 was present on the command line.
*)
PROCEDURE GetPIM4 () : BOOLEAN ;
(*
GetPositiveModFloor - return TRUE if -fpositive-mod-floor was present
on the command line.
*)
PROCEDURE GetPositiveModFloor () : BOOLEAN ;
(*
GetFloatValueCheck - return TRUE if -ffloatvalue was present on the
command line.
*)
PROCEDURE GetFloatValueCheck () : BOOLEAN ;
(*
SetFloatValueCheck - set depending upon the -ffloatvalue.
*)
PROCEDURE SetFloatValueCheck (value: BOOLEAN) ;
(*
GetWholeValueCheck - return TRUE if -fwholevalue was present on the
command line.
*)
PROCEDURE GetWholeValueCheck () : BOOLEAN ;
(*
SetWholeValueCheck - set depending upon the -fwholevalue.
*)
PROCEDURE SetWholeValueCheck (value: BOOLEAN) ;
(*
SetWall - set all warnings to, value.
*)
PROCEDURE SetWall (value: BOOLEAN) ;
(*
SetSaveTemps - turn on/off -save-temps.
*)
PROCEDURE SetSaveTemps (value: BOOLEAN) ;
(*
SetSaveTempsDir - turn on/off -save-temps specifying the
directory.
*)
PROCEDURE SetSaveTempsDir (arg: ADDRESS) ;
(*
GetSaveTempsDir - return SaveTempsDir or NIL if -save-temps was not used.
*)
PROCEDURE GetSaveTempsDir () : String ;
(*
SetGenModuleList - set the GenModuleList flag to value and pass
set GenModuleListFilename to filename.
*)
PROCEDURE SetGenModuleList (value: BOOLEAN; filename: ADDRESS) ;
(*
GetGenModuleFilename - returns the filename set by SetGenModuleList.
*)
PROCEDURE GetGenModuleFilename () : String ;
(*
SetShared - sets the SharedFlag to value.
*)
PROCEDURE SetShared (value: BOOLEAN) ;
(*
FinaliseOptions - once all options have been parsed we set any inferred
values.
*)
PROCEDURE FinaliseOptions ;
END M2Options.

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,178 @@
(* M2Pass.def provides setting and testing of the current pass.
Copyright (C) 2001-2022 Free Software Foundation, Inc.
Contributed by Gaius Mulley <gaius.mulley@southwales.ac.uk>.
This file is part of GNU Modula-2.
GNU Modula-2 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 3, or (at your option)
any later version.
GNU Modula-2 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 GNU Modula-2; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. *)
DEFINITION MODULE M2Pass ;
(*
Author : Gaius Mulley
Title : M2Lexical
Date : Thu Nov 2 12:58:18 GMT 1989
Description: Controls the setting and testing of the current pass.
Last update: Thu Nov 2 12:58:27 GMT 1989
*)
EXPORT QUALIFIED SetPassToNoPass,
SetPassToPass0,
SetPassToPass1,
SetPassToPass2,
SetPassToPassC,
SetPassToPass3,
SetPassToPassHidden,
SetPassToCodeGeneration,
SetPassToErrorPass,
IsNoPass,
IsPass0,
IsPass1,
IsPass2,
IsPass3,
IsPassC,
IsPassHidden,
IsPassCodeGeneration,
IsErrorPass ;
(*
SetPassToNoPass - sets the pass state to no Pass.
*)
PROCEDURE SetPassToNoPass ;
(*
SetPassToPass0 - sets the pass state to Pass 0.
*)
PROCEDURE SetPassToPass0 ;
(*
SetPassToPass1 - sets the pass state to Pass 1.
*)
PROCEDURE SetPassToPass1 ;
(*
SetPassToPass2 - sets the pass state to Pass 2.
*)
PROCEDURE SetPassToPass2 ;
(*
SetPassToPassC - sets the pass state to Pass C.
*)
PROCEDURE SetPassToPassC ;
(*
SetPassToPass3 - sets the pass state to Pass 3.
*)
PROCEDURE SetPassToPass3 ;
(*
SetPassToPassHidden - sets the pass state to the hidden type pass.
*)
PROCEDURE SetPassToPassHidden ;
(*
SetPassToCodeGeneration - sets the pass state to CodeGeneration.
*)
PROCEDURE SetPassToCodeGeneration ;
(*
SetPassToErrorPass - sets the pass state to no Error Pass.
*)
PROCEDURE SetPassToErrorPass ;
(*
IsNoPass - returns true if currently in no Pass.
*)
PROCEDURE IsNoPass () : BOOLEAN ;
(*
IsPass0 - returns true if currently in Pass 0.
*)
PROCEDURE IsPass0 () : BOOLEAN ;
(*
IsPass1 - returns true if currently in Pass 1.
*)
PROCEDURE IsPass1 () : BOOLEAN ;
(*
IsPass2 - returns true if currently in Pass 2.
*)
PROCEDURE IsPass2 () : BOOLEAN ;
(*
IsPassC - returns true if currently in Pass C.
*)
PROCEDURE IsPassC () : BOOLEAN ;
(*
IsPass3 - returns true if currently in Pass 3.
*)
PROCEDURE IsPass3 () : BOOLEAN ;
(*
IsPassHidden - returns TRUE if currently parsing for hidden types.
*)
PROCEDURE IsPassHidden () : BOOLEAN ;
(*
IsPassCodeGeneration - returns true if currently in the CodeGeneration Pass.
*)
PROCEDURE IsPassCodeGeneration () : BOOLEAN ;
(*
IsErrorPass - returns true if currently in the Error Pass.
*)
PROCEDURE IsErrorPass () : BOOLEAN ;
END M2Pass.

View file

@ -0,0 +1,246 @@
(* M2Pass.mod provides setting and testing of the current pass.
Copyright (C) 2001-2022 Free Software Foundation, Inc.
Contributed by Gaius Mulley <gaius.mulley@southwales.ac.uk>.
This file is part of GNU Modula-2.
GNU Modula-2 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 3, or (at your option)
any later version.
GNU Modula-2 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 GNU Modula-2; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. *)
IMPLEMENTATION MODULE M2Pass ;
FROM M2Error IMPORT InternalError ;
TYPE
Pass = (NoPass, Pass0, Pass1, Pass2, PassC, Pass3, CodeGeneration, ErrorPass, HiddenPass) ;
VAR
CurrentPass: Pass ;
(*
SetPassToNoPass - sets the pass state to no Pass.
*)
PROCEDURE SetPassToNoPass ;
BEGIN
CurrentPass := NoPass
END SetPassToNoPass ;
(*
SetPassToPass0 - sets the pass state to Pass 0.
*)
PROCEDURE SetPassToPass0 ;
BEGIN
IF CurrentPass=NoPass
THEN
CurrentPass := Pass0
ELSE
InternalError ('attempting to set CurrentPass to Pass1')
END
END SetPassToPass0 ;
(*
SetPassToPass1 - sets the pass state to Pass 1.
*)
PROCEDURE SetPassToPass1 ;
BEGIN
IF CurrentPass=NoPass
THEN
CurrentPass := Pass1
ELSE
InternalError ('attempting to set CurrentPass to Pass1')
END
END SetPassToPass1 ;
(*
SetPassToPass2 - sets the pass state to Pass 2.
*)
PROCEDURE SetPassToPass2 ;
BEGIN
IF CurrentPass=NoPass
THEN
CurrentPass := Pass2
ELSE
InternalError ('attempting to set CurrentPass to Pass2')
END
END SetPassToPass2 ;
(*
SetPassToPassC - sets the pass state to Pass C.
*)
PROCEDURE SetPassToPassC ;
BEGIN
IF CurrentPass=NoPass
THEN
CurrentPass := PassC
ELSE
InternalError ('attempting to set CurrentPass to PassC')
END
END SetPassToPassC ;
(*
SetPassToPass3 - sets the pass state to Pass 3.
*)
PROCEDURE SetPassToPass3 ;
BEGIN
IF CurrentPass=NoPass
THEN
CurrentPass := Pass3
ELSE
InternalError ('attempting to set CurrentPass to Pass3')
END
END SetPassToPass3 ;
(*
SetPassToErrorPass - sets the pass state to no Error Pass.
*)
PROCEDURE SetPassToErrorPass ;
BEGIN
CurrentPass := ErrorPass
END SetPassToErrorPass ;
(*
SetPassToPassHidden - sets the pass state to the hidden type pass.
*)
PROCEDURE SetPassToPassHidden ;
BEGIN
CurrentPass := HiddenPass
END SetPassToPassHidden ;
(*
SetPassToCodeGeneration - sets the pass state to CodeGeneration.
*)
PROCEDURE SetPassToCodeGeneration ;
BEGIN
IF CurrentPass=NoPass
THEN
CurrentPass := CodeGeneration
ELSE
InternalError ('attempting to set CurrentPass to CodeGeneration')
END
END SetPassToCodeGeneration ;
(*
IsNoPass - returns true if currently in no Pass.
*)
PROCEDURE IsNoPass () : BOOLEAN ;
BEGIN
RETURN( CurrentPass=NoPass )
END IsNoPass ;
(*
IsPass0 - returns true if currently in Pass 0.
*)
PROCEDURE IsPass0 () : BOOLEAN ;
BEGIN
RETURN( CurrentPass=Pass0 )
END IsPass0 ;
(*
IsPass1 - returns true if currently in Pass 1.
*)
PROCEDURE IsPass1 () : BOOLEAN ;
BEGIN
RETURN( CurrentPass=Pass1 )
END IsPass1 ;
(*
IsPass2 - returns true if currently in Pass 2.
*)
PROCEDURE IsPass2 () : BOOLEAN ;
BEGIN
RETURN( CurrentPass=Pass2 )
END IsPass2 ;
(*
IsPassC - returns true if currently in Pass C.
*)
PROCEDURE IsPassC () : BOOLEAN ;
BEGIN
RETURN( CurrentPass=PassC )
END IsPassC ;
(*
IsPass3 - returns true if currently in Pass 3.
*)
PROCEDURE IsPass3 () : BOOLEAN ;
BEGIN
RETURN( CurrentPass=Pass3 )
END IsPass3 ;
(*
IsPassCodeGeneration - returns true if currently in the CodeGeneration Pass.
*)
PROCEDURE IsPassCodeGeneration () : BOOLEAN ;
BEGIN
RETURN( CurrentPass=CodeGeneration )
END IsPassCodeGeneration ;
(*
IsPassHidden - returns TRUE if currently parsing for hidden types.
*)
PROCEDURE IsPassHidden () : BOOLEAN ;
BEGIN
RETURN( CurrentPass=HiddenPass )
END IsPassHidden ;
(*
IsErrorPass - returns true if currently in the Error Pass.
*)
PROCEDURE IsErrorPass () : BOOLEAN ;
BEGIN
RETURN( CurrentPass=ErrorPass )
END IsErrorPass ;
BEGIN
SetPassToNoPass
END M2Pass.

View file

@ -0,0 +1,51 @@
(* M2Preprocess.def provides a mechanism to invoke the C preprocessor.
Copyright (C) 2001-2022 Free Software Foundation, Inc.
Contributed by Gaius Mulley <gaius.mulley@southwales.ac.uk>.
This file is part of GNU Modula-2.
GNU Modula-2 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 3, or (at your option)
any later version.
GNU Modula-2 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 GNU Modula-2; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. *)
DEFINITION MODULE M2Preprocess ;
(*
Title : M2Preprocess
Author : Gaius Mulley
System : UNIX (GNU Modula-2)
Date : Thu Dec 6 17:59:57 2001
Last edit : $Date: 2010/10/03 19:01:06 $
Revision : $Version$
Description: provides a mechanism to invoke the C preprocessor.
*)
FROM DynamicStrings IMPORT String ;
EXPORT QUALIFIED PreprocessModule ;
(*
PreprocessModule - preprocess a file, filename, returning the new filename
of the preprocessed file.
Preprocessing will only occur if requested by the user.
If no preprocessing was requested then filename is returned.
If preprocessing occurs then a temporary file is created
and its name is returned.
All temporary files will be deleted when the compiler exits.
*)
PROCEDURE PreprocessModule (filename: String) : String ;
END M2Preprocess.

View file

@ -0,0 +1,152 @@
(* M2Preprocess.mod provides a mechanism to invoke the C preprocessor.
Copyright (C) 2001-2022 Free Software Foundation, Inc.
Contributed by Gaius Mulley <gaius.mulley@southwales.ac.uk>.
This file is part of GNU Modula-2.
GNU Modula-2 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 3, or (at your option)
any later version.
GNU Modula-2 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 GNU Modula-2; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. *)
IMPLEMENTATION MODULE M2Preprocess ;
FROM SYSTEM IMPORT WORD ;
FROM DynamicStrings IMPORT string, InitString, Mark, KillString, EqualArray, InitStringCharStar,
Dup, ConCat, ConCatChar, RIndex, Slice ;
FROM choosetemp IMPORT make_temp_file ;
FROM pexecute IMPORT pexecute ;
FROM libc IMPORT system, exit, unlink, printf, atexit ;
FROM Lists IMPORT List, InitList, KillList, IncludeItemIntoList, ForeachItemInListDo ;
FROM FIO IMPORT StdErr, StdOut ;
FROM M2Printf IMPORT fprintf1 ;
FROM M2Options IMPORT Verbose, CppCommandLine, SaveTemps ;
FROM NameKey IMPORT Name, MakeKey, KeyToCharStar, makekey ;
VAR
ListOfFiles: List ;
(*
OnExitDelete -
*)
PROCEDURE OnExitDelete (filename: String) : String ;
BEGIN
IncludeItemIntoList (ListOfFiles, makekey (filename)) ;
RETURN filename
END OnExitDelete ;
(*
RemoveFile - removes a single file, s.
*)
PROCEDURE RemoveFile (w: WORD) ;
VAR
n: Name ;
BEGIN
n := w ;
IF unlink (KeyToCharStar (n)) # 0
THEN
END
END RemoveFile ;
(*
RemoveFiles -
*)
PROCEDURE RemoveFiles () : INTEGER ;
BEGIN
ForeachItemInListDo (ListOfFiles, RemoveFile) ;
RETURN 0
END RemoveFiles ;
(*
MakeSaveTempsFileName - return a temporary file "filename.i".
*)
PROCEDURE MakeSaveTempsFileName (filename: String) : String ;
BEGIN
RETURN ConCat (Dup (filename), InitString ('.i'))
END MakeSaveTempsFileName ;
(*
PreprocessModule - preprocess a file, filename, returning the new filename
of the preprocessed file.
Preprocessing will only occur if requested by the user.
If no preprocessing was requested then filename is returned.
If preprocessing occurs then a temporary file is created
and its name is returned.
All temporary files will be deleted when the compiler exits.
*)
PROCEDURE PreprocessModule (filename: String) : String ;
VAR
tempfile,
command,
commandLine: String ;
BEGIN
command := CppCommandLine () ;
IF (command = NIL) OR EqualArray (command, '')
THEN
RETURN filename
ELSE
IF SaveTemps
THEN
tempfile := InitStringCharStar (MakeSaveTempsFileName (filename))
ELSE
tempfile := InitStringCharStar (make_temp_file (KeyToCharStar (MakeKey('i'))))
END ;
commandLine := Dup (command) ;
commandLine := ConCat (ConCat (ConCat (ConCatChar (Dup (commandLine), ' '), filename),
Mark (InitString(' -o '))),
tempfile) ;
(* use pexecute in the future
res := pexecute(string(Slice(commandLine, 0, Index(commandLine, ' ', 0))), etc etc );
*)
(* for now we'll use system *)
IF Verbose
THEN
fprintf1 (StdOut, "preprocess: %s\n", commandLine)
END ;
IF system (string (commandLine)) # 0
THEN
fprintf1 (StdErr, 'C preprocessor failed when preprocessing %s\n', filename) ;
exit (1)
END ;
commandLine := KillString (commandLine) ;
IF SaveTemps
THEN
RETURN tempfile
ELSE
RETURN OnExitDelete (tempfile)
END
END
END PreprocessModule ;
BEGIN
InitList (ListOfFiles) ;
IF atexit (RemoveFiles) # 0
THEN
HALT
END
END M2Preprocess.

View file

@ -0,0 +1,66 @@
(* M2Printf.def provides a simple printf capability.
Copyright (C) 2001-2022 Free Software Foundation, Inc.
Contributed by Gaius Mulley <gaius.mulley@southwales.ac.uk>.
This file is part of GNU Modula-2.
GNU Modula-2 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 3, or (at your option)
any later version.
GNU Modula-2 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 GNU Modula-2; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. *)
DEFINITION MODULE M2Printf ;
(*
Title : M2Printf
Author : Gaius Mulley
System : UNIX (GNU Modula-2)
Date : Tue Aug 7 15:32:02 2001
Last edit : $Date: 2010/10/03 19:01:07 $
Revision : $Version$
Description: provides a simple printf capability. It requires NameKey
as it will translate %a into a namekey.
It supports %a, %d, %c and %s.
*)
FROM SYSTEM IMPORT BYTE ;
FROM FIO IMPORT File ;
EXPORT QUALIFIED printf0, printf1, printf2, printf3, printf4,
fprintf0, fprintf1, fprintf2, fprintf3, fprintf4 ;
(*
printf0 - writes out an array to, StdOut, after the escape sequences have been
translated.
*)
PROCEDURE printf0 (a: ARRAY OF CHAR) ;
PROCEDURE printf1 (a: ARRAY OF CHAR; w: ARRAY OF BYTE) ;
PROCEDURE printf2 (a: ARRAY OF CHAR; w1, w2: ARRAY OF BYTE) ;
PROCEDURE printf3 (a: ARRAY OF CHAR; w1, w2, w3: ARRAY OF BYTE) ;
PROCEDURE printf4 (a: ARRAY OF CHAR; w1, w2, w3, w4: ARRAY OF BYTE) ;
(*
fprintf0 - writes out an array to, file, after the escape sequences have been
translated.
*)
PROCEDURE fprintf0 (file: File; a: ARRAY OF CHAR) ;
PROCEDURE fprintf1 (file: File; a: ARRAY OF CHAR; w: ARRAY OF BYTE) ;
PROCEDURE fprintf2 (file: File; a: ARRAY OF CHAR; w1, w2: ARRAY OF BYTE) ;
PROCEDURE fprintf3 (file: File; a: ARRAY OF CHAR; w1, w2, w3: ARRAY OF BYTE) ;
PROCEDURE fprintf4 (file: File; a: ARRAY OF CHAR; w1, w2, w3, w4: ARRAY OF BYTE) ;
END M2Printf.

View file

@ -0,0 +1,314 @@
(* M2Printf.mod provides a simple printf capability.
Copyright (C) 2001-2022 Free Software Foundation, Inc.
Contributed by Gaius Mulley <gaius.mulley@southwales.ac.uk>.
This file is part of GNU Modula-2.
GNU Modula-2 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 3, or (at your option)
any later version.
GNU Modula-2 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 GNU Modula-2; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. *)
IMPLEMENTATION MODULE M2Printf ;
FROM SFIO IMPORT WriteS ;
FROM FIO IMPORT StdOut ;
FROM DynamicStrings IMPORT String, string, InitString, KillString, InitStringCharStar, Mark ;
FROM StrLib IMPORT StrLen ;
FROM FormatStrings IMPORT Sprintf0, Sprintf1, Sprintf2, Sprintf3, Sprintf4 ;
FROM NameKey IMPORT Name, KeyToCharStar ;
(*
IsDigit - returns TRUE if, ch, is a character 0..9
*)
(*
PROCEDURE IsDigit (ch: CHAR) : BOOLEAN ;
BEGIN
RETURN (ch>='0') AND (ch<='9')
END IsDigit ;
*)
(*
Cast - casts a := b
*)
PROCEDURE Cast (VAR a: ARRAY OF BYTE; b: ARRAY OF BYTE) ;
VAR
i: CARDINAL ;
BEGIN
IF HIGH(a) = HIGH(b)
THEN
FOR i := 0 TO HIGH(a) DO
a[i] := b[i]
END
ELSE
HALT
END
END Cast ;
(*
TranslateNameToCharStar - takes a format specification string, a, and
if it contains %a then this is translated
into a String and %a is replaced by %s.
*)
PROCEDURE TranslateNameToCharStar (VAR a: ARRAY OF CHAR;
n: CARDINAL) : BOOLEAN ;
VAR
argno,
i, h : CARDINAL ;
BEGIN
argno := 1 ;
i := 0 ;
h := StrLen(a) ;
WHILE i<h DO
IF (a[i]='%') AND (i+1<h)
THEN
IF (a[i+1] = 'a') AND (argno = n)
THEN
a[i+1] := 's' ;
RETURN TRUE
END ;
INC (argno) ;
IF argno>n
THEN
(* all done *)
RETURN FALSE
END
END ;
INC (i)
END ;
RETURN FALSE
END TranslateNameToCharStar ;
(*
fprintf0 - writes out an array to, file, after the escape sequences
have been translated.
*)
PROCEDURE fprintf0 (file: File; a: ARRAY OF CHAR) ;
BEGIN
IF KillString (WriteS (file, Sprintf0 (InitString(a)))) = NIL
THEN
END
END fprintf0 ;
PROCEDURE fprintf1 (file: File; a: ARRAY OF CHAR; w: ARRAY OF BYTE) ;
VAR
s, t: String ;
n : Name ;
BEGIN
IF TranslateNameToCharStar (a, 1)
THEN
Cast (n, w) ;
s := Mark (InitStringCharStar (KeyToCharStar (n))) ;
t := Mark (InitString (a)) ;
s := Sprintf1 (t, s)
ELSE
t := Mark (InitString (a)) ;
s := Sprintf1 (t, w)
END ;
IF KillString (WriteS (file, s)) = NIL
THEN
END
END fprintf1 ;
PROCEDURE fprintf2 (file: File; a: ARRAY OF CHAR; w1, w2: ARRAY OF BYTE) ;
VAR
n : Name ;
s,
s1, s2: String ;
b : BITSET ;
BEGIN
b := {} ;
IF TranslateNameToCharStar (a, 1)
THEN
Cast (n, w1) ;
s1 := Mark(InitStringCharStar (KeyToCharStar (n))) ;
INCL (b, 1)
END ;
IF TranslateNameToCharStar (a, 2)
THEN
Cast(n, w2) ;
s2 := Mark(InitStringCharStar (KeyToCharStar (n))) ;
INCL (b, 2)
END ;
CASE b OF
{} : s := Sprintf2 (Mark (InitString(a)), w1, w2) |
{1} : s := Sprintf2 (Mark (InitString(a)), s1, w2) |
{2} : s := Sprintf2 (Mark (InitString(a)), w1, s2) |
{1,2}: s := Sprintf2 (Mark (InitString(a)), s1, s2)
ELSE
HALT
END ;
IF KillString (WriteS (file, s)) = NIL
THEN
END
END fprintf2 ;
PROCEDURE fprintf3 (file: File; a: ARRAY OF CHAR;
w1, w2, w3: ARRAY OF BYTE) ;
VAR
n : Name ;
s, s1, s2, s3: String ;
b : BITSET ;
BEGIN
b := {} ;
IF TranslateNameToCharStar (a, 1)
THEN
Cast (n, w1) ;
s1 := Mark (InitStringCharStar (KeyToCharStar (n))) ;
INCL (b, 1)
END ;
IF TranslateNameToCharStar(a, 2)
THEN
Cast (n, w2) ;
s2 := Mark (InitStringCharStar (KeyToCharStar (n))) ;
INCL (b, 2)
END ;
IF TranslateNameToCharStar(a, 3)
THEN
Cast (n, w3) ;
s3 := Mark (InitStringCharStar (KeyToCharStar (n))) ;
INCL (b, 3)
END ;
CASE b OF
{} : s := Sprintf3 (Mark (InitString (a)), w1, w2, w3) |
{1} : s := Sprintf3 (Mark (InitString (a)), s1, w2, w3) |
{2} : s := Sprintf3 (Mark (InitString (a)), w1, s2, w3) |
{1,2} : s := Sprintf3 (Mark (InitString (a)), s1, s2, w3) |
{3} : s := Sprintf3 (Mark (InitString (a)), w1, w2, s3) |
{1,3} : s := Sprintf3 (Mark (InitString (a)), s1, w2, s3) |
{2,3} : s := Sprintf3 (Mark (InitString (a)), w1, s2, s3) |
{1,2,3}: s := Sprintf3 (Mark (InitString (a)), s1, s2, s3)
ELSE
HALT
END ;
IF KillString (WriteS (file, s)) = NIL
THEN
END
END fprintf3 ;
PROCEDURE fprintf4 (file: File; a: ARRAY OF CHAR;
w1, w2, w3, w4: ARRAY OF BYTE) ;
VAR
n : Name ;
s, s1, s2, s3, s4: String ;
b : BITSET ;
BEGIN
b := {} ;
IF TranslateNameToCharStar (a, 1)
THEN
Cast (n, w1) ;
s1 := Mark (InitStringCharStar (KeyToCharStar (n))) ;
INCL (b, 1)
END ;
IF TranslateNameToCharStar (a, 2)
THEN
Cast (n, w2) ;
s2 := Mark (InitStringCharStar (KeyToCharStar (n))) ;
INCL (b, 2)
END ;
IF TranslateNameToCharStar (a, 3)
THEN
Cast (n, w3) ;
s3 := Mark (InitStringCharStar (KeyToCharStar (n))) ;
INCL (b, 3)
END ;
IF TranslateNameToCharStar (a, 4)
THEN
Cast (n, w4) ;
s4 := Mark (InitStringCharStar (KeyToCharStar (n))) ;
INCL (b, 4)
END ;
CASE b OF
{} : s := Sprintf4 (Mark (InitString (a)), w1, w2, w3, w4) |
{1} : s := Sprintf4 (Mark (InitString (a)), s1, w2, w3, w4) |
{2} : s := Sprintf4 (Mark (InitString (a)), w1, s2, w3, w4) |
{1,2} : s := Sprintf4 (Mark (InitString (a)), s1, s2, w3, w4) |
{3} : s := Sprintf4 (Mark (InitString (a)), w1, w2, s3, w4) |
{1,3} : s := Sprintf4 (Mark (InitString (a)), s1, w2, s3, w4) |
{2,3} : s := Sprintf4 (Mark (InitString (a)), w1, s2, s3, w4) |
{1,2,3} : s := Sprintf4 (Mark (InitString (a)), s1, s2, s3, w4) |
{4} : s := Sprintf4 (Mark (InitString (a)), w1, w2, w3, s4) |
{1,4} : s := Sprintf4 (Mark (InitString (a)), s1, w2, w3, s4) |
{2,4} : s := Sprintf4 (Mark (InitString (a)), w1, s2, w3, s4) |
{1,2,4} : s := Sprintf4 (Mark (InitString (a)), s1, s2, w3, s4) |
{3,4} : s := Sprintf4 (Mark (InitString (a)), w1, w2, s3, s4) |
{1,3,4} : s := Sprintf4 (Mark (InitString (a)), s1, w2, s3, s4) |
{2,3,4} : s := Sprintf4 (Mark (InitString (a)), w1, s2, s3, s4) |
{1,2,3,4}: s := Sprintf4 (Mark (InitString (a)), s1, s2, s3, s4)
ELSE
HALT
END ;
IF KillString (WriteS (file, s)) = NIL
THEN
END
END fprintf4 ;
(*
printf0 - writes out an array to, StdOut, after the escape
sequences have been translated.
*)
PROCEDURE printf0 (a: ARRAY OF CHAR) ;
BEGIN
fprintf0 (StdOut, a)
END printf0 ;
PROCEDURE printf1 (a: ARRAY OF CHAR;
w: ARRAY OF BYTE) ;
BEGIN
fprintf1 (StdOut, a, w)
END printf1 ;
PROCEDURE printf2 (a: ARRAY OF CHAR;
w1, w2: ARRAY OF BYTE) ;
BEGIN
fprintf2 (StdOut, a, w1, w2)
END printf2 ;
PROCEDURE printf3 (a: ARRAY OF CHAR;
w1, w2, w3: ARRAY OF BYTE) ;
BEGIN
fprintf3 (StdOut, a, w1, w2, w3)
END printf3 ;
PROCEDURE printf4 (a: ARRAY OF CHAR;
w1, w2, w3, w4: ARRAY OF BYTE) ;
BEGIN
fprintf4 (StdOut, a, w1, w2, w3, w4)
END printf4 ;
END M2Printf.

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,46 @@
(* M2Quiet.def provides a wrapper to M2Printf.
Copyright (C) 2001-2022 Free Software Foundation, Inc.
Contributed by Gaius Mulley <gaius.mulley@southwales.ac.uk>.
This file is part of GNU Modula-2.
GNU Modula-2 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 3, or (at your option)
any later version.
GNU Modula-2 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 GNU Modula-2; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. *)
DEFINITION MODULE M2Quiet ;
(*
Title : M2Quiet
Author : Gaius Mulley
System : UNIX (GNU Modula-2)
Date : Fri Oct 12 15:27:27 2001
Last edit : $Date: 2010/10/03 19:01:07 $
Revision : $Version$
Description: provides a wrapper to M2Printf the output only occurs if
M2Options.Quiet is set.
*)
FROM SYSTEM IMPORT BYTE ;
EXPORT QUALIFIED qprintf0, qprintf1, qprintf2, qprintf3, qprintf4 ;
PROCEDURE qprintf0 (a: ARRAY OF CHAR) ;
PROCEDURE qprintf1 (a: ARRAY OF CHAR; w: ARRAY OF BYTE) ;
PROCEDURE qprintf2 (a: ARRAY OF CHAR; w1, w2: ARRAY OF BYTE) ;
PROCEDURE qprintf3 (a: ARRAY OF CHAR; w1, w2, w3: ARRAY OF BYTE) ;
PROCEDURE qprintf4 (a: ARRAY OF CHAR; w1, w2, w3, w4: ARRAY OF BYTE) ;
END M2Quiet.

View file

@ -0,0 +1,74 @@
(* M2Quiet.mod provides a wrapper to M2Printf.
Copyright (C) 2001-2022 Free Software Foundation, Inc.
Contributed by Gaius Mulley <gaius.mulley@southwales.ac.uk>.
This file is part of GNU Modula-2.
GNU Modula-2 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 3, or (at your option)
any later version.
GNU Modula-2 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 GNU Modula-2; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. *)
IMPLEMENTATION MODULE M2Quiet ;
(* importing from M2Options is the reason why it is not a good idea to put this into M2Printf *)
FROM M2Options IMPORT Quiet ;
FROM M2Printf IMPORT printf0, printf1, printf2, printf3, printf4 ;
PROCEDURE qprintf0 (a: ARRAY OF CHAR) ;
BEGIN
IF NOT Quiet
THEN
printf0(a)
END
END qprintf0 ;
PROCEDURE qprintf1 (a: ARRAY OF CHAR; w: ARRAY OF BYTE) ;
BEGIN
IF NOT Quiet
THEN
printf1(a, w)
END
END qprintf1 ;
PROCEDURE qprintf2 (a: ARRAY OF CHAR; w1, w2: ARRAY OF BYTE) ;
BEGIN
IF NOT Quiet
THEN
printf2(a, w1, w2)
END
END qprintf2 ;
PROCEDURE qprintf3 (a: ARRAY OF CHAR; w1, w2, w3: ARRAY OF BYTE) ;
BEGIN
IF NOT Quiet
THEN
printf3(a, w1, w2, w3)
END
END qprintf3 ;
PROCEDURE qprintf4 (a: ARRAY OF CHAR; w1, w2, w3, w4: ARRAY OF BYTE) ;
BEGIN
IF NOT Quiet
THEN
printf4(a, w1, w2, w3, w4)
END
END qprintf4 ;
END M2Quiet.

View file

@ -0,0 +1,418 @@
(* M2Range.def exports procedures which maintain the range checking.
Copyright (C) 2008-2022 Free Software Foundation, Inc.
Contributed by Gaius Mulley <gaius.mulley@southwales.ac.uk>.
This file is part of GNU Modula-2.
GNU Modula-2 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 3, or (at your option)
any later version.
GNU Modula-2 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 GNU Modula-2; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. *)
DEFINITION MODULE M2Range ;
(*
Title : M2Range
Author : Gaius Mulley
System : GNU Modula-2
Date : Thu Feb 28 10:18:55 2008
Revision : $Version$
Description: exports procedures which maintain the range checking
state which is explored once all the subrange values
have been resolved by the front end (once
M2GCCDeclare has completed its task). We cannot
perform this activity during M2Quads, as we dont
know the subrange values and also we can do so much
more once optimization has occurred. It should be
possible to detect simple overflow errors at compile
time, post optimization.
*)
FROM SYSTEM IMPORT ADDRESS ;
FROM m2tree IMPORT Tree ;
FROM m2linemap IMPORT location_t ;
FROM DynamicStrings IMPORT String ;
EXPORT QUALIFIED InitAssignmentRangeCheck,
InitReturnRangeCheck,
InitSubrangeRangeCheck,
InitStaticArraySubscriptRangeCheck,
InitDynamicArraySubscriptRangeCheck,
InitIncRangeCheck,
InitDecRangeCheck,
InitInclCheck,
InitExclCheck,
InitRotateCheck,
InitShiftCheck,
InitTypesExpressionCheck,
InitTypesAssignmentCheck,
InitTypesParameterCheck,
InitParameterRangeCheck,
InitForLoopBeginRangeCheck,
InitForLoopToRangeCheck,
InitForLoopEndRangeCheck,
InitPointerRangeCheck,
InitNoReturnRangeCheck,
InitNoElseRangeCheck,
InitCaseBounds,
InitWholeNonPosDivCheck,
InitWholeNonPosModCheck,
InitWholeZeroDivisionCheck,
InitWholeZeroRemainderCheck,
CodeRangeCheck, FoldRangeCheck, CodeErrorCheck,
(* CheckRangeAddVariableRead, *)
(* CheckRangeRemoveVariableRead, *)
WriteRangeCheck,
OverlapsRange,
IsEqual, IsGreaterOrEqual, IsGreater,
BuildIfCallRealHandlerLoc,
BuildIfCallWholeHandlerLoc,
GetMinMax ;
(*
InitAssignmentRangeCheck - returns a range check node which
remembers the information necessary
so that a range check for d := e
can be generated later on.
*)
PROCEDURE InitAssignmentRangeCheck (tokno: CARDINAL; d, e: CARDINAL) : CARDINAL ;
(*
InitReturnRangeCheck - returns a range check node which
remembers the information necessary
so that a range check for RETURN e
from procedure, d, can be generated later on.
*)
PROCEDURE InitReturnRangeCheck (tokno: CARDINAL; d, e: CARDINAL) : CARDINAL ;
(*
InitSubrangeRangeCheck - returns a range check node which
remembers the information necessary
so that a range check for d := e
can be generated later on.
*)
PROCEDURE InitSubrangeRangeCheck (d, e: CARDINAL) : CARDINAL ;
(*
InitStaticArraySubscriptRangeCheck - returns a range check node which
remembers the information necessary
so that a range check for d[e]
can be generated later on.
*)
PROCEDURE InitStaticArraySubscriptRangeCheck (d, e, dim: CARDINAL) : CARDINAL ;
(*
InitDynamicArraySubscriptRangeCheck - returns a range check node which
remembers the information necessary
so that a range check for d[e]
can be generated later on.
*)
PROCEDURE InitDynamicArraySubscriptRangeCheck (d, e, dim: CARDINAL) : CARDINAL ;
(*
InitIncRangeCheck - returns a range check node which
remembers the information necessary
so that a range check for INC(d, e)
can be generated later on.
*)
PROCEDURE InitIncRangeCheck (d, e: CARDINAL) : CARDINAL ;
(*
InitDecRangeCheck - returns a range check node which
remembers the information necessary
so that a range check for DEC(d, e)
can be generated later on.
*)
PROCEDURE InitDecRangeCheck (d, e: CARDINAL) : CARDINAL ;
(*
InitForLoopBeginRangeCheck - returns a range check node which
remembers the information necessary
so that a range check for FOR d := e TO .. DO
can be generated later on.
*)
PROCEDURE InitForLoopBeginRangeCheck (d, e: CARDINAL) : CARDINAL ;
(*
InitForLoopToRangeCheck - returns a range check node which
remembers the information necessary
so that a range check for the final value
implied by ... e1 TO e2 BY e3 DO
can be generated later on.
*)
PROCEDURE InitForLoopToRangeCheck (d, e: CARDINAL) : CARDINAL ;
(*
InitForLoopEndRangeCheck - returns a range check node which
remembers the information necessary
so that a range check for
INC or DEC(d, e)
can be generated later on.
*)
PROCEDURE InitForLoopEndRangeCheck (d, e: CARDINAL) : CARDINAL ;
(*
InitPointerRangeCheck - creates a pointer # NIL check.
*)
PROCEDURE InitPointerRangeCheck (tokno: CARDINAL;
d: CARDINAL; isLeft: BOOLEAN) : CARDINAL ;
(*
InitNoReturnRangeCheck - creates a check held in the function
to detect the absence of a RETURN
statement at runtime.
*)
PROCEDURE InitNoReturnRangeCheck () : CARDINAL ;
(*
InitNoElseRangeCheck - creates a check held at the end of
a CASE statement without an ELSE
clause to detect its absence
at runtime.
*)
PROCEDURE InitNoElseRangeCheck () : CARDINAL ;
(*
InitWholeNonPosDivCheck - creates a check expression for non positive
or zero 2nd operand to division.
*)
PROCEDURE InitWholeNonPosDivCheck (tokno: CARDINAL; d, e: CARDINAL) : CARDINAL ;
(*
InitWholeNonPosModCheck - creates a check expression for non positive
or zero 2nd operand to modulus.
*)
PROCEDURE InitWholeNonPosModCheck (tokno: CARDINAL; d, e: CARDINAL) : CARDINAL ;
(*
InitWholeZeroDivisionCheck - creates a check expression for zero 2nd
operand for division.
*)
PROCEDURE InitWholeZeroDivisionCheck (tokno: CARDINAL; d, e: CARDINAL) : CARDINAL ;
(*
InitWholeZeroRemainderCheck - creates a check expression for zero 2nd
operand for remainder.
*)
PROCEDURE InitWholeZeroRemainderCheck (tokno: CARDINAL; d, e: CARDINAL) : CARDINAL ;
(*
InitInclCheck - checks to see that bit, e, is type compatible with
d and also in range.
*)
PROCEDURE InitInclCheck (d, e: CARDINAL) : CARDINAL ;
(*
InitExclCheck - checks to see that bit, e, is type compatible with
d and also in range.
*)
PROCEDURE InitExclCheck (d, e: CARDINAL) : CARDINAL ;
(*
InitShiftCheck - checks to see that bit, e, is type compatible with
d and also in range.
*)
PROCEDURE InitShiftCheck (d, e: CARDINAL) : CARDINAL ;
(*
InitRotateCheck - checks to see that bit, e, is type compatible with
d and also in range.
*)
PROCEDURE InitRotateCheck (d, e: CARDINAL) : CARDINAL ;
(*
InitTypesAssignmentCheck - checks to see that the types of, d, and, e,
are assignment compatible.
*)
PROCEDURE InitTypesAssignmentCheck (tokno: CARDINAL; d, e: CARDINAL) : CARDINAL ;
(*
InitTypesParameterCheck - checks to see that the types of, d, and, e,
are parameter compatible.
*)
PROCEDURE InitTypesParameterCheck (proc: CARDINAL; i: CARDINAL;
formal, actual: CARDINAL) : CARDINAL ;
(*
InitParameterRangeCheck - checks to see that the types of, d, and, e,
are parameter compatible.
*)
PROCEDURE InitParameterRangeCheck (proc: CARDINAL; i: CARDINAL;
formal, actual: CARDINAL) : CARDINAL ;
(*
InitTypesExpressionCheck - checks to see that the types of, d, and, e,
are expression compatible.
*)
PROCEDURE InitTypesExpressionCheck (tokno: CARDINAL; d, e: CARDINAL;
strict, isin: BOOLEAN) : CARDINAL ;
(*
InitCaseBounds - creates a case bound range check.
*)
PROCEDURE InitCaseBounds (b: CARDINAL) : CARDINAL ;
(*
CodeRangeCheck - creates a sequence of Trees representing the code for a
range test defined by, r.
*)
PROCEDURE CodeRangeCheck (r: CARDINAL; function: String) ;
(*
FoldRangeCheck - returns a Tree representing the code for a
range test defined by, r.
*)
PROCEDURE FoldRangeCheck (tokenno: CARDINAL; q: CARDINAL; r: CARDINAL) ;
(*
CodeErrorCheck - returns a Tree calling the approprate exception handler.
*)
PROCEDURE CodeErrorCheck (r: CARDINAL; function, message: String) : Tree ;
(*
CheckRangeAddVariableRead - ensures that any references to reading
variables used by this range check, r,
at this, quadNo, are recorded in the
symbol table.
*)
(* PROCEDURE CheckRangeAddVariableRead (r: CARDINAL; quadNo: CARDINAL) ; *)
(*
CheckRangeRemoveVariableRead - ensures that any references to reading
variable at this quadNo are removed from
the symbol table.
*)
(* PROCEDURE CheckRangeRemoveVariableRead (r: CARDINAL; quadNo: CARDINAL) ; *)
(*
WriteRangeCheck - displays debugging information about range, r.
*)
PROCEDURE WriteRangeCheck (r: CARDINAL) ;
(*
OverlapsRange - returns TRUE if a1..a2 overlaps with b1..b2.
*)
PROCEDURE OverlapsRange (a1, a2, b1, b2: Tree) : BOOLEAN ;
(*
IsEqual - returns TRUE if a=b.
*)
PROCEDURE IsEqual (a, b: Tree) : BOOLEAN ;
(*
IsGreaterOrEqual - returns TRUE if a>=b.
*)
PROCEDURE IsGreaterOrEqual (a, b: Tree) : BOOLEAN ;
(*
IsGreater - returns TRUE if a>b.
*)
PROCEDURE IsGreater (a, b: Tree) : BOOLEAN ;
(*
BuildIfCallWholeHandlerLoc - return a Tree containing a runtime test whether, condition, is true.
*)
PROCEDURE BuildIfCallWholeHandlerLoc (location: location_t; condition: Tree;
scope, message: ADDRESS) : Tree ;
(*
BuildIfCallRealHandlerLoc - return a Tree containing a runtime test whether, condition, is true.
*)
PROCEDURE BuildIfCallRealHandlerLoc (location: location_t; condition: Tree;
scope, message: ADDRESS) : Tree ;
(*
GetMinMax - returns TRUE if we know the max and min of a type, t.
*)
PROCEDURE GetMinMax (tokenno: CARDINAL; type: CARDINAL; VAR min, max: Tree) : BOOLEAN ;
END M2Range.

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,128 @@
(* M2Reserved.def determines is a token is a reserved word.
Copyright (C) 2001-2022 Free Software Foundation, Inc.
Contributed by Gaius Mulley <gaius.mulley@southwales.ac.uk>.
This file is part of GNU Modula-2.
GNU Modula-2 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 3, or (at your option)
any later version.
GNU Modula-2 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 GNU Modula-2; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. *)
DEFINITION MODULE M2Reserved ;
(*
Author : Gaius Mulley
Title : M2Reserved
Date : 15/5/87
Description: implements a procedure to determine if a symbol is a
Modula-2 reserved word and provides conversion between
toktype and the equivalent stringed, Name.
*)
FROM NameKey IMPORT Name ;
EXPORT QUALIFIED IsReserved, tokToTok,
NulTok, PlusTok, MinusTok, TimesTok, DivideTok, BecomesTok,
AmbersandTok, PeriodTok, CommaTok, SemiColonTok, LParaTok,
LSBraTok, LCBraTok, UpArrowTok, SingleQuoteTok, EqualTok,
HashTok, LessTok, GreaterTok, LessGreaterTok, LessEqualTok,
GreaterEqualTok, PeriodPeriodTok, ColonTok, RParaTok,
RSBraTok, RCBraTok, BarTok, DoubleQuotesTok,
AndTok, ArrayTok, BeginTok, ByTok, CaseTok, ConstTok,
DefinitionTok, DivTok, DoTok, ElseTok, ElsifTok, EndTok,
ExceptTok,
ExitTok, ExportTok, FinallyTok, ForTok, FromTok, IfTok,
ImplementationTok, ImportTok, InTok, LoopTok, ModTok,
ModuleTok, NotTok, OfTok, OrTok,
PackedSetTok, PointerTok, ProcedureTok,
QualifiedTok, UnQualifiedTok, RecordTok, RetryTok,
RemTok, RepeatTok,
ReturnTok, SetTok, ThenTok, ToTok, TypeTok, UntilTok, VarTok,
WhileTok, WithTok,
(* additional tokens which extend PIM Modula-2 slightly *)
EofTok, AsmTok, VolatileTok, DateTok, LineTok, FileTok,
AttributeTok, BuiltinTok, InlineTok,
toktype ;
TYPE
toktype = (eoftok, plustok, minustok, timestok, dividetok,
becomestok, ambersandtok, periodtok, commatok,
semicolontok, lparatok, rparatok, lsbratok, rsbratok,
lcbratok, rcbratok, uparrowtok, singlequotetok,
equaltok, hashtok, lesstok, greatertok, lessgreatertok,
lessequaltok, greaterequaltok,
ldirectivetok, rdirectivetok,
periodperiodtok,
colontok, doublequotestok, bartok, andtok,
arraytok, begintok, bytok, casetok, consttok,
definitiontok, divtok, dotok, elsetok, elsiftok,
endtok, excepttok, exittok, exporttok, finallytok,
fortok, fromtok, iftok, implementationtok,
importtok, intok, looptok, modtok,
moduletok, nottok, oftok, ortok,
packedsettok, pointertok, proceduretok,
qualifiedtok, unqualifiedtok,
recordtok, remtok, repeattok, retrytok, returntok,
settok, thentok,
totok, typetok, untiltok, vartok, whiletok, withtok,
asmtok, volatiletok, periodperiodperiodtok,
datetok, linetok, filetok,
attributetok, builtintok, inlinetok,
integertok, identtok, realtok, stringtok,
virtualrangetok) ;
VAR
NulTok, PlusTok, MinusTok, TimesTok, DivideTok, BecomesTok,
AmbersandTok, PeriodTok, CommaTok, SemiColonTok, LParaTok,
LSBraTok, LCBraTok, UpArrowTok, SingleQuoteTok, EqualTok,
HashTok, LessTok, GreaterTok, LessGreaterTok, LessEqualTok,
GreaterEqualTok, LDirectiveTok, RDirectiveTok,
PeriodPeriodTok, ColonTok, RParaTok,
RSBraTok, RCBraTok, BarTok, DoubleQuotesTok,
AndTok, ArrayTok, BeginTok, ByTok, CaseTok, ConstTok,
DefinitionTok, DivTok, DoTok, ElseTok, ElsifTok, EndTok,
ExceptTok, ExitTok, ExportTok, FinallyTok, ForTok, FromTok,
IfTok, ImplementationTok, ImportTok, InTok, LoopTok, ModTok,
ModuleTok, NotTok, OfTok, OrTok,
PackedSetTok, PointerTok, ProcedureTok,
QualifiedTok, UnQualifiedTok, RecordTok, RemTok, RepeatTok,
RetryTok, ReturnTok, SetTok, ThenTok, ToTok, TypeTok,
UntilTok, VarTok, WhileTok, WithTok,
EofTok, AsmTok, VolatileTok,
DateTok, LineTok, FileTok,
AttributeTok, BuiltinTok, InlineTok: Name ;
(*
IsReserved - returns TRUE if the symbol, Name, is a reserved word.
If TRUE it also sets tok to the appropriate enumerated
value.
*)
PROCEDURE IsReserved (n: Name; VAR tok: toktype) : BOOLEAN ;
(*
tokToTok - returns a Tok given the enumerated variable, t.
*)
PROCEDURE tokToTok (t: toktype) : Name ;
END M2Reserved.

View file

@ -0,0 +1,358 @@
(* M2Reserved.mod determines is a token is a reserved word.
Copyright (C) 2001-2022 Free Software Foundation, Inc.
Contributed by Gaius Mulley <gaius.mulley@southwales.ac.uk>.
This file is part of GNU Modula-2.
GNU Modula-2 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 3, or (at your option)
any later version.
GNU Modula-2 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 GNU Modula-2; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. *)
IMPLEMENTATION MODULE M2Reserved ;
FROM SymbolKey IMPORT SymbolTree, InitTree, PutSymKey, GetSymKey ;
FROM NameKey IMPORT MakeKey, NulName ;
FROM ASCII IMPORT nul ;
CONST
eof = 032C ;
VAR
NameTotok,
tokToName: SymbolTree ;
(*
AddKeyword - adds the Name and enumerated value of a keyword
into the binary tree.
*)
PROCEDURE AddKeyword (n: Name; tok: toktype) ;
BEGIN
PutSymKey(NameTotok, n, tok) ;
PutSymKey(tokToName, VAL(Name, tok), n)
END AddKeyword ;
PROCEDURE Init ;
VAR
a: ARRAY [0..1] OF CHAR ;
BEGIN
InitTree(NameTotok) ;
InitTree(tokToName) ;
NulTok := NulName ;
PlusTok := MakeKey('+') ;
AddKeyword(PlusTok, plustok) ;
MinusTok := MakeKey('-') ;
AddKeyword(MinusTok, minustok) ;
TimesTok := MakeKey('*') ;
AddKeyword(TimesTok, timestok) ;
DivideTok := MakeKey('/') ;
AddKeyword(DivideTok, dividetok) ;
BecomesTok := MakeKey(':=') ;
AddKeyword(BecomesTok, becomestok) ;
AmbersandTok := MakeKey('&') ;
AddKeyword(AmbersandTok, ambersandtok) ;
PeriodTok := MakeKey('.') ;
AddKeyword(PeriodTok, periodtok) ;
CommaTok := MakeKey(',') ;
AddKeyword(CommaTok, commatok) ;
SemiColonTok := MakeKey(';') ;
AddKeyword(SemiColonTok, semicolontok) ;
LParaTok := MakeKey('(') ;
AddKeyword(LParaTok, lparatok) ;
LSBraTok := MakeKey('[') ;
AddKeyword(LSBraTok, lsbratok) ;
LCBraTok := MakeKey('{') ;
AddKeyword(LCBraTok, lcbratok) ;
UpArrowTok := MakeKey('^') ;
AddKeyword(UpArrowTok, uparrowtok) ;
SingleQuoteTok := MakeKey("'") ;
AddKeyword(SingleQuoteTok, singlequotetok) ;
EqualTok := MakeKey('=') ;
AddKeyword(EqualTok, equaltok) ;
HashTok := MakeKey('#') ;
AddKeyword(HashTok, hashtok) ;
LessTok := MakeKey('<') ;
AddKeyword(LessTok, lesstok) ;
GreaterTok := MakeKey('>') ;
AddKeyword(GreaterTok, greatertok) ;
LessGreaterTok := MakeKey('<>') ;
AddKeyword(LessGreaterTok, lessgreatertok) ;
LessEqualTok := MakeKey('<=') ;
AddKeyword(LessEqualTok, lessequaltok) ;
GreaterEqualTok := MakeKey('>=') ;
AddKeyword(GreaterEqualTok, greaterequaltok) ;
LDirectiveTok := MakeKey('<*') ;
AddKeyword(LDirectiveTok, ldirectivetok) ;
RDirectiveTok := MakeKey('*>') ;
AddKeyword(RDirectiveTok, rdirectivetok) ;
PeriodPeriodTok := MakeKey('..') ;
AddKeyword(PeriodPeriodTok, periodperiodtok) ;
ColonTok := MakeKey(':') ;
AddKeyword(ColonTok, colontok) ;
RParaTok := MakeKey(')') ;
AddKeyword(RParaTok, rparatok) ;
RSBraTok := MakeKey(']') ;
AddKeyword(RSBraTok, rsbratok) ;
RCBraTok := MakeKey('}') ;
AddKeyword(RCBraTok, rcbratok) ;
BarTok := MakeKey('|') ;
AddKeyword(BarTok, bartok) ;
DoubleQuotesTok := MakeKey('"') ;
AddKeyword(DoubleQuotesTok, doublequotestok) ;
AndTok := MakeKey('AND') ;
AddKeyword(AndTok, andtok) ;
ArrayTok := MakeKey('ARRAY') ;
AddKeyword(ArrayTok, arraytok) ;
BeginTok := MakeKey('BEGIN') ;
AddKeyword(BeginTok, begintok) ;
ByTok := MakeKey('BY') ;
AddKeyword(ByTok, bytok) ;
CaseTok := MakeKey('CASE') ;
AddKeyword(CaseTok, casetok) ;
ConstTok := MakeKey('CONST') ;
AddKeyword(ConstTok, consttok) ;
DefinitionTok := MakeKey('DEFINITION') ;
AddKeyword(DefinitionTok, definitiontok) ;
DivTok := MakeKey('DIV') ;
AddKeyword(DivTok, divtok) ;
DoTok := MakeKey('DO') ;
AddKeyword(DoTok, dotok) ;
ElseTok := MakeKey('ELSE') ;
AddKeyword(ElseTok, elsetok) ;
ElsifTok := MakeKey('ELSIF') ;
AddKeyword(ElsifTok, elsiftok) ;
EndTok := MakeKey('END') ;
AddKeyword(EndTok, endtok) ;
ExitTok := MakeKey('EXIT') ;
AddKeyword(ExitTok, exittok) ;
ExceptTok := MakeKey('EXCEPT') ;
AddKeyword(ExceptTok, excepttok) ;
ExportTok := MakeKey('EXPORT') ;
AddKeyword(ExportTok, exporttok) ;
FinallyTok := MakeKey('FINALLY') ;
AddKeyword(FinallyTok, finallytok) ;
ForTok := MakeKey('FOR') ;
AddKeyword(ForTok, fortok) ;
FromTok := MakeKey('FROM') ;
AddKeyword(FromTok, fromtok) ;
IfTok := MakeKey('IF') ;
AddKeyword(IfTok, iftok) ;
ImplementationTok := MakeKey('IMPLEMENTATION') ;
AddKeyword(ImplementationTok, implementationtok) ;
ImportTok := MakeKey('IMPORT') ;
AddKeyword(ImportTok, importtok) ;
InTok := MakeKey('IN') ;
AddKeyword(InTok, intok) ;
LoopTok := MakeKey('LOOP') ;
AddKeyword(LoopTok, looptok) ;
ModTok := MakeKey('MOD') ;
AddKeyword(ModTok, modtok) ;
ModuleTok := MakeKey('MODULE') ;
AddKeyword(ModuleTok, moduletok) ;
NotTok := MakeKey('NOT') ;
AddKeyword(NotTok, nottok) ;
OfTok := MakeKey('OF') ;
AddKeyword(OfTok, oftok) ;
OrTok := MakeKey('OR') ;
AddKeyword(OrTok, ortok) ;
(*
PackedTok := MakeKey('PACKED') ;
AddKeyword(PackedTok, packedtok) ;
*)
PackedSetTok := MakeKey('PACKEDSET') ;
AddKeyword(PackedSetTok, packedsettok) ;
PointerTok := MakeKey('POINTER') ;
AddKeyword(PointerTok, pointertok) ;
ProcedureTok := MakeKey('PROCEDURE') ;
AddKeyword(ProcedureTok, proceduretok) ;
QualifiedTok := MakeKey('QUALIFIED') ;
AddKeyword(QualifiedTok, qualifiedtok) ;
UnQualifiedTok := MakeKey('UNQUALIFIED') ;
AddKeyword(UnQualifiedTok, unqualifiedtok) ;
RecordTok := MakeKey('RECORD') ;
AddKeyword(RecordTok, recordtok) ;
RemTok := MakeKey('REM') ;
AddKeyword(RemTok, remtok) ;
RepeatTok := MakeKey('REPEAT') ;
AddKeyword(RepeatTok, repeattok) ;
RetryTok := MakeKey('RETRY') ;
AddKeyword(RetryTok, retrytok) ;
ReturnTok := MakeKey('RETURN') ;
AddKeyword(ReturnTok, returntok) ;
SetTok := MakeKey('SET') ;
AddKeyword(SetTok, settok) ;
ThenTok := MakeKey('THEN') ;
AddKeyword(ThenTok, thentok) ;
ToTok := MakeKey('TO') ;
AddKeyword(ToTok, totok) ;
TypeTok := MakeKey('TYPE') ;
AddKeyword(TypeTok, typetok) ;
UntilTok := MakeKey('UNTIL') ;
AddKeyword(UntilTok, untiltok) ;
VarTok := MakeKey('VAR') ;
AddKeyword(VarTok, vartok) ;
WhileTok := MakeKey('WHILE') ;
AddKeyword(WhileTok, whiletok) ;
WithTok := MakeKey('WITH') ;
AddKeyword(WithTok, withtok) ;
AsmTok := MakeKey('ASM') ;
AddKeyword(AsmTok, asmtok) ;
VolatileTok := MakeKey('VOLATILE') ;
AddKeyword(VolatileTok, volatiletok) ;
DateTok := MakeKey('__DATE__') ; (* C compatible preprocessor primatives *)
AddKeyword(DateTok, datetok) ;
LineTok := MakeKey('__LINE__') ;
AddKeyword(LineTok, linetok) ;
FileTok := MakeKey('__FILE__') ;
AddKeyword(FileTok, filetok) ;
AttributeTok := MakeKey('__ATTRIBUTE__') ; (* GCC extension incorporated into gm2 *)
AddKeyword(AttributeTok, attributetok) ;
BuiltinTok := MakeKey('__BUILTIN__') ; (* GCC extension incorporated into gm2 *)
AddKeyword(BuiltinTok, builtintok) ;
InlineTok := MakeKey('__INLINE__') ; (* GCC extension incorporated into gm2 *)
AddKeyword(InlineTok, inlinetok) ;
a[0] := eof ;
a[1] := nul ;
EofTok := MakeKey(a) (* Not a reserved token *)
END Init ;
(*
IsReserved - returns TRUE if the symbol, Name, is a reserved word.
If TRUE it also sets tok to the appropriate enumerated
value. It will set tok to eoftok if appropriate.
*)
PROCEDURE IsReserved (n: Name; VAR tok: toktype) : BOOLEAN ;
VAR
t: CARDINAL ;
BEGIN
t := GetSymKey(NameTotok, n) ;
IF t=0
THEN
(* eoftok is not a reserved word *)
IF n=EofTok
THEN
tok := eoftok
END ;
RETURN( FALSE )
ELSE
tok := VAL(toktype, t) ;
RETURN( TRUE )
END
END IsReserved ;
(*
tokToTok - returns a Tok given the enumerated variable, t.
*)
PROCEDURE tokToTok (t: toktype) : Name ;
BEGIN
RETURN( GetSymKey(tokToName, VAL(Name, t)) )
END tokToTok ;
BEGIN
Init
END M2Reserved.

Some files were not shown because too many files have changed in this diff Show more