]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
PR modula2/114529 Avoid ODR violations in bootstrap translated sources
authorGaius Mulley <gaiusmod2@gmail.com>
Tue, 11 Jun 2024 09:01:12 +0000 (10:01 +0100)
committerGaius Mulley <gaiusmod2@gmail.com>
Tue, 11 Jun 2024 09:01:12 +0000 (10:01 +0100)
This patch changes the bootstrap tool mc to avoid redefining any data
types and therefore preventing ODR violations.  All exported opaque type
usages are implemented as void *.  Local opaque type usages (static
functions containing opaque type parameters) use the full declaration.
mc casts usages between void * and full opaque type as necessary.
The --extended-opaque option in mc has been disabled, as this generated
ODR violations.  The extended-opaque option inlined all declarations in
the translated implementation module.  As this is no longer used there
is now a .h file for each .def file and a .cc file for every .mod file.
This results in more Makefile rules for the ppg tool in Make-maintainer.in.

gcc/m2/ChangeLog:

PR modula2/114529
* Make-lang.in (MC_EXTENDED_OPAQUE): Assign to nothing.
* Make-maintainer.in (mc-basetest): New rule.
(mc-devel-basetest): New rule.
(mc-clean): Remove mc.
(m2/mc-boot-gen/$(SRC_PREFIX)decl.cc): Replace --extended-opaque
with $(EXTENDED_OPAQUE).
(PG-SRC): Move define before generic rules.
(PGE-DEF): Ditto.
(m2/gm2-ppg-boot/$(SRC_PREFIX)%.h): New rule.
(m2/gm2-ppg-boot/$(SRC_PREFIX)libc.o): Ditto.
(m2/gm2-ppg-boot/$(SRC_PREFIX)mcrts.o): Ditto.
(m2/gm2-ppg-boot/$(SRC_PREFIX)UnixArgs.o): Ditto.
(m2/gm2-ppg-boot/$(SRC_PREFIX)Selective.o): Ditto.
(m2/gm2-ppg-boot/$(SRC_PREFIX)termios.o): Ditto.
(m2/gm2-ppg-boot/$(SRC_PREFIX)SysExceptions.o): Ditto.
(m2/gm2-ppg-boot/$(SRC_PREFIX)ldtoa.o): Ditto.
(m2/gm2-ppg-boot/$(SRC_PREFIX)wrapc.o): Ditto.
(m2/gm2-ppg-boot/$(SRC_PREFIX)SYSTEM.o): Ditto.
(m2/gm2-ppg-boot/$(SRC_PREFIX)errno.o): Ditto.
(m2/gm2-ppg-boot/$(SRC_PREFIX)M2RTS.o): Ditto.
(m2/gm2-ppg-boot/$(SRC_PREFIX)SymbolKey.h): Ditto.
(m2/gm2-ppg-boot/$(SRC_PREFIX)SymbolKey.o): Ditto.
(m2/gm2-ppg-boot/$(SRC_PREFIX)NameKey.h): Ditto.
(m2/gm2-ppg-boot/$(SRC_PREFIX)NameKey.o): Ditto.
(m2/gm2-ppg-boot/$(SRC_PREFIX)Lists.h): Ditto.
(m2/gm2-ppg-boot/$(SRC_PREFIX)Lists.o): Ditto.
(m2/gm2-ppg-boot/$(SRC_PREFIX)Output.h): Ditto.
(m2/gm2-ppg-boot/$(SRC_PREFIX)bnflex.h): Ditto.
(m2/gm2-ppg-boot/$(SRC_PREFIX)bnflex.o): Ditto.
(m2/gm2-ppg-boot/$(SRC_PREFIX)RTco.h): Ditto.
(m2/gm2-ppg-boot/$(SRC_PREFIX)RTentity.h): Ditto.
(m2/gm2-ppg-boot/$(SRC_PREFIX)RTco.o): Ditto.
(m2/gm2-ppg-boot/$(SRC_PREFIX)RTentity.o): Ditto.
(m2/gm2-ppg-boot/$(SRC_PREFIX)%.o): Ditto.
(m2/ppg$(exeext)): Ditto.
(m2/gm2-ppg-boot/main.o): Ditto.
(m2/gm2-auto): Ditto.
(c-family/m2pp.o): Ditto.
(BUILD-BOOT-PG-H): Correct macro definition.
(m2/gm2-pg-boot/$(SRC_PREFIX)%.h): New rule.
(m2/gm2-pg-boot/$(SRC_PREFIX)NameKey.h): Ditto.
(m2/gm2-pg-boot/$(SRC_PREFIX)NameKey.o): Ditto.
(m2/gm2-pg-boot/$(SRC_PREFIX)Lists.h): Ditto.
(m2/gm2-pg-boot/$(SRC_PREFIX)Lists.o): Ditto.
(m2/gm2-pg-boot/$(SRC_PREFIX)Output.h): Ditto.
(m2/gm2-pg-boot/$(SRC_PREFIX)Output.o): Ditto.
(m2/gm2-pg-boot/$(SRC_PREFIX)bnflex.h): Ditto.
(m2/gm2-pg-boot/$(SRC_PREFIX)bnflex.o): Ditto.
(m2/gm2-pg-boot/$(SRC_PREFIX)RTco.h): Ditto.
(m2/gm2-pg-boot/$(SRC_PREFIX)RTentity.h): Ditto.
(m2/gm2-pg-boot/$(SRC_PREFIX)RTco.o): Ditto.
(m2/gm2-pg-boot/$(SRC_PREFIX)RTentity.o): Ditto.
(BUILD-BOOT-PGE-H): Correct macro definition.
(m2/gm2-pge-boot/$(SRC_PREFIX)SymbolKey.h): Ditto.
(m2/gm2-pge-boot/$(SRC_PREFIX)SymbolKey.o): Ditto.
(m2/gm2-pge-boot/$(SRC_PREFIX)NameKey.h): Ditto.
(m2/gm2-pge-boot/$(SRC_PREFIX)NameKey.o): Ditto.
(m2/gm2-pge-boot/$(SRC_PREFIX)Lists.h): Ditto.
(m2/gm2-pge-boot/$(SRC_PREFIX)Lists.o): Ditto.
(m2/gm2-pge-boot/$(SRC_PREFIX)Output.h): Ditto.
(m2/gm2-pge-boot/$(SRC_PREFIX)Output.o): Ditto.
(m2/gm2-pge-boot/$(SRC_PREFIX)bnflex.h): Ditto.
(m2/gm2-pge-boot/$(SRC_PREFIX)bnflex.o): Ditto.
(m2/gm2-pge-boot/$(SRC_PREFIX)RTco.h): Ditto.
(m2/gm2-pge-boot/$(SRC_PREFIX)RTentity.h): Ditto.
(m2/gm2-pge-boot/$(SRC_PREFIX)RTco.o): Ditto.
(m2/gm2-pge-boot/$(SRC_PREFIX)RTentity.o): Ditto.
(mc-basetest): Ditto.
(mc-devel-basetest): Ditto.
* gm2-compiler/M2Options.def (SetM2Dump): Add BOOLEAN return.
* gm2-compiler/M2Quads.def (BuildAlignment): Add tokno parameter.
(BuildBitLength): Ditto.
* gm2-compiler/P3Build.bnf (ByteAlignment): Move tokpos assignment
to the start of the block.
* gm2-compiler/PCBuild.bnf (ConstSetOrQualidentOrFunction): Ditto.
(SetOrDesignatorOrFunction): Ditto.
* gm2-compiler/PHBuild.bnf (ConstSetOrQualidentOrFunction): Ditto.
(SetOrDesignatorOrFunction): Ditto.
(ByteAlignment): Ditto.
* gm2-libs/dtoa.def (dtoa): Change mode to INTEGER.
* gm2-libs/ldtoa.def (ldtoa): Ditto.
* mc-boot-ch/GSYSTEM.c (_M2_SYSTEM_init): Correct parameter list.
(_M2_SYSTEM_fini): Ditto.
* mc-boot-ch/Gdtoa.cc (dtoa_calcsign): Return bool.
(dtoa_dtoa): Return void * and use bool in the fifth parameter.
(_M2_dtoa_init): Correct parameter list.
(_M2_dtoa_fini): Ditto.
* mc-boot-ch/Gerrno.cc (_M2_errno_init): Ditto.
(_M2_errno_fini): Ditto.
* mc-boot-ch/Gldtoa.cc (dtoa_calcsign): Return bool.
(ldtoa_ldtoa): Return void * and use bool in the fifth parameter.
(_M2_ldtoa_init): Correct parameter list.
(_M2_ldtoa_fini): Ditto.
* mc-boot-ch/Glibc.c (tracedb_zresult): New function.
(libc_read): Return size_t and use size_t in parameter three.
(libc_write): Return size_t and use size_t in parameter three.
(libc_printf): Add const to the format specifier.
Change declaration of c to use const.
(libc_snprintf): Add const to the format specifier.
Change declaration of c to use const.
(libc_malloc): Use size_t.
(libc_memcpy): Ditto.
* mc-boot/GASCII.cc: Regenerate.
* mc-boot/GArgs.cc: Ditto.
* mc-boot/GAssertion.cc: Ditto.
* mc-boot/GBreak.cc: Ditto.
* mc-boot/GCmdArgs.cc: Ditto.
* mc-boot/GDebug.cc: Ditto.
* mc-boot/GDynamicStrings.cc: Ditto.
* mc-boot/GEnvironment.cc: Ditto.
* mc-boot/GFIO.cc: Ditto.
* mc-boot/GFormatStrings.cc: Ditto.
* mc-boot/GFpuIO.cc: Ditto.
* mc-boot/GIO.cc: Ditto.
* mc-boot/GIndexing.cc: Ditto.
* mc-boot/GM2Dependent.cc: Ditto.
* mc-boot/GM2EXCEPTION.cc: Ditto.
* mc-boot/GM2RTS.cc: Ditto.
* mc-boot/GMemUtils.cc: Ditto.
* mc-boot/GNumberIO.cc: Ditto.
* mc-boot/GPushBackInput.cc: Ditto.
* mc-boot/GRTExceptions.cc: Ditto.
* mc-boot/GRTint.cc: Ditto.
* mc-boot/GSArgs.cc: Ditto.
* mc-boot/GSFIO.cc: Ditto.
* mc-boot/GStdIO.cc: Ditto.
* mc-boot/GStorage.cc: Ditto.
* mc-boot/GStrCase.cc: Ditto.
* mc-boot/GStrIO.cc: Ditto.
* mc-boot/GStrLib.cc: Ditto.
* mc-boot/GStringConvert.cc: Ditto.
* mc-boot/GSysStorage.cc: Ditto.
* mc-boot/GTimeString.cc: Ditto.
* mc-boot/Galists.cc: Ditto.
* mc-boot/Gdecl.cc: Ditto.
* mc-boot/Gkeyc.cc: Ditto.
* mc-boot/Glists.cc: Ditto.
* mc-boot/GmcComment.cc: Ditto.
* mc-boot/GmcComp.cc: Ditto.
* mc-boot/GmcDebug.cc: Ditto.
* mc-boot/GmcError.cc: Ditto.
* mc-boot/GmcFileName.cc: Ditto.
* mc-boot/GmcLexBuf.cc: Ditto.
* mc-boot/GmcMetaError.cc: Ditto.
* mc-boot/GmcOptions.cc: Ditto.
* mc-boot/GmcPreprocess.cc: Ditto.
* mc-boot/GmcPretty.cc: Ditto.
* mc-boot/GmcPrintf.cc: Ditto.
* mc-boot/GmcQuiet.cc: Ditto.
* mc-boot/GmcReserved.cc: Ditto.
* mc-boot/GmcSearch.cc: Ditto.
* mc-boot/GmcStack.cc: Ditto.
* mc-boot/GmcStream.cc: Ditto.
* mc-boot/Gmcp1.cc: Ditto.
* mc-boot/Gmcp2.cc: Ditto.
* mc-boot/Gmcp3.cc: Ditto.
* mc-boot/Gmcp4.cc: Ditto.
* mc-boot/Gmcp5.cc: Ditto.
* mc-boot/GnameKey.cc: Ditto.
* mc-boot/GsymbolKey.cc: Ditto.
* mc-boot/Gvarargs.cc: Ditto.
* mc-boot/Gwlists.cc: Ditto.
* mc-boot/Gdecl.h: Ditto.
* mc-boot/Gldtoa.h: Ditto.
* mc-boot/Glibc.h: Ditto.
* mc/decl.def (putTypeOpaque): New procedure.
(isTypeOpaque): New procedure function.
* mc/decl.mod (debugOpaque): New constant.
(nodeT): New enumeration field opaquecast.
(node): New record field opaquecastF.
(opaqueCastState): New record.
(opaquecastT): New record.
(typeT): New field isOpaque.
(varT): New field opaqueState.
(arrayT): Ditto.
(varparamT): Ditto.
(paramT): Ditto.
(pointerT): Ditto.
(recordfieldT): Ditto.
(componentrefT): Ditto.
(pointerrefT): Ditto.
(arrayrefT): Ditto.
(procedureT): Ditto.
(proctypeT): Ditto.
(makeType): Initialize field isOpaque.
(makeTypeImp): Initialize field isOpaque.
(putVar): Call initNodeOpaqueCastState.
(putReturnType): Ditto.
(makeProcType): Ditto.
(putProcTypeReturn): Ditto.
(makeVarParameter): Ditto.
(makeNonVarParameter): Ditto.
(makeFuncCall): Ditto.
(putTypeOpaque): New procedure.
(isTypeOpaque): New procedure function.
(doMakeComponentRef): Call initNodeOpaqueCastState.
(makePointerRef): Call initNodeOpaqueCastState.
(doGetFuncType): Call initNodeOpaqueCastState.
(doBinary): Add FALSE parameter to doExprCup.
(doDeRefC): Rewrite.
(doComponentRefC): Call flushOpaque.
(doPointerRefC): Call flushOpaque.
(doArrayRefC): Add const_cast for unbounded array.
(doExprCup): Rewrite.
(doTypeAliasC): Remove.
(isDeclType): New procedure function.
(doEnumerationC): New procedure function.
(doParamTypeEmit): Ditto.
(doParamTypeNameModifier): Ditto.
(initOpaqueCastState): Ditto.
(initNodeOpaqueCastState): Ditto.
(setOpaqueCastState): Ditto.
(setNodeOpaqueVoidStar): Ditto.
(nodeUsesOpaque): Ditto.
(getNodeOpaqueVoidStar): Ditto.
(getOpaqueFlushNecessary): Ditto.
(makeOpaqueCast): Ditto.
(flushOpaque): Ditto.
(castOpaque): Ditto.
(isTypeOpaqueDefImp): Ditto.
(isParamVoidStar): Ditto.
(isRefVoidStar): Ditto.
(isReturnVoidStar): Ditto.
(isVarVoidStar): Ditto.
(initNodeOpaqueState): Ditto.
(assignNodeOpaqueCastState): Ditto.
(assignNodeOpaqueCastFalse): Ditto.
(dumpOpaqueState): Ditto.
(doProcTypeC): Rewrite.
(isDeclInImp): New procedure function.
(doTypeNameModifier): Ditto.
(doTypeC): Emit typedef if enum is declared in this module.
(doCompletePartialProcType): Rewrite.
(outputCompletePartialProcType): New procedure.
(doOpaqueModifier): Ditto.
(doVarC): Ditto.
(doProcedureHeadingC): Add opaque modifier to return type if
necessary.
(doReturnC): Cast opaque type for return if necessary.
(forceCastOpaque): New procedure.
(forceReintCastOpaque): New procedure.
(doUnConstCastUnbounded): New procedure.
(doAssignmentC): Cast opaque for both des and expr if necessary.
(doAdrExprC): Use static_cast for void * casting.
(doFuncVarParam): New procedure.
(doFuncParamC): Rewrite.
(doAdrArgC): Rewrite.
(getFunction): New procedure function.
(stop): Rename to ...
(localstop): ... this.
(dupFunccall): Call assignNodeOpaqueCastState.
(dbg): Rewrite.
(addDone): Rewrite.
(addDoneDef): Do not add opaque types to the doneQ when declared in
the definition module.
* mc/mc.flex (openSource): Return bool.
(_M2_mcflex_init): Correct parameter list.
(_M2_mcflex_fini): Ditto.
* mc/mcComment.h (stdbool.h): Include.
(mcComment_initComment): Change unsigned int to bool.
* mc/mcOptions.mod (handleOption): Disable --extended-opaque
and issue warning.
* mc/mcp1.bnf (DefTypeDeclaration): Call putTypeOpaque.

gcc/testsuite/ChangeLog:

PR modula2/114529
* gm2/base-lang/pass/SYSTEM.def: New test.
* gm2/base-lang/pass/base-lang-test.sh: New test.
* gm2/base-lang/pass/globalproctype.def: New test.
* gm2/base-lang/pass/globalproctype.mod: New test.
* gm2/base-lang/pass/globalvar.def: New test.
* gm2/base-lang/pass/globalvar.mod: New test.
* gm2/base-lang/pass/globalvarassign.def: New test.
* gm2/base-lang/pass/globalvarassign.mod: New test.
* gm2/base-lang/pass/localproctype.def: New test.
* gm2/base-lang/pass/localproctype.mod: New test.
* gm2/base-lang/pass/localvar.def: New test.
* gm2/base-lang/pass/localvar.mod: New test.
* gm2/base-lang/pass/localvarassign.def: New test.
* gm2/base-lang/pass/localvarassign.mod: New test.
* gm2/base-lang/pass/opaquefield.def: New test.
* gm2/base-lang/pass/opaquefield.mod: New test.
* gm2/base-lang/pass/opaquenew.def: New test.
* gm2/base-lang/pass/opaquenew.mod: New test.
* gm2/base-lang/pass/opaqueparam.def: New test.
* gm2/base-lang/pass/opaqueparam.mod: New test.
* gm2/base-lang/pass/opaquestr.def: New test.
* gm2/base-lang/pass/opaqueuse.def: New test.
* gm2/base-lang/pass/opaqueuse.mod: New test.
* gm2/base-lang/pass/opaqueusestr.def: New test.
* gm2/base-lang/pass/opaqueusestr.mod: New test.
* gm2/base-lang/pass/opaquevariant.def: New test.
* gm2/base-lang/pass/opaquevariant.mod: New test.
* gm2/base-lang/pass/opaquevarparam.def: New test.
* gm2/base-lang/pass/opaquevarparam.mod: New test.
* gm2/base-lang/pass/simplelist.def: New test.
* gm2/base-lang/pass/simplelist.mod: New test.
* gm2/base-lang/pass/simplelistiter.def: New test.
* gm2/base-lang/pass/simplelistiter.mod: New test.
* gm2/base-lang/pass/simpleopaque.def: New test.
* gm2/base-lang/pass/simpleopaque.mod: New test.
* gm2/base-lang/pass/straddress.def: New test.
* gm2/base-lang/pass/straddress.mod: New test.
* gm2/base-lang/pass/straddressexport.def: New test.
* gm2/base-lang/pass/straddressexport.mod: New test.
* gm2/base-lang/pass/unboundedarray.def: New test.
* gm2/base-lang/pass/unboundedarray.mod: New test.

Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
124 files changed:
gcc/m2/Make-lang.in
gcc/m2/Make-maintainer.in
gcc/m2/gm2-compiler/M2Options.def
gcc/m2/gm2-compiler/M2Quads.def
gcc/m2/gm2-compiler/P3Build.bnf
gcc/m2/gm2-compiler/PCBuild.bnf
gcc/m2/gm2-compiler/PHBuild.bnf
gcc/m2/gm2-libs/dtoa.def
gcc/m2/gm2-libs/ldtoa.def
gcc/m2/mc-boot-ch/GSYSTEM.c
gcc/m2/mc-boot-ch/Gdtoa.cc
gcc/m2/mc-boot-ch/Gerrno.cc
gcc/m2/mc-boot-ch/Gldtoa.cc
gcc/m2/mc-boot-ch/Glibc.c
gcc/m2/mc-boot/GASCII.cc
gcc/m2/mc-boot/GArgs.cc
gcc/m2/mc-boot/GAssertion.cc
gcc/m2/mc-boot/GBreak.cc
gcc/m2/mc-boot/GCmdArgs.cc
gcc/m2/mc-boot/GDebug.cc
gcc/m2/mc-boot/GDynamicStrings.cc
gcc/m2/mc-boot/GEnvironment.cc
gcc/m2/mc-boot/GFIO.cc
gcc/m2/mc-boot/GFormatStrings.cc
gcc/m2/mc-boot/GFpuIO.cc
gcc/m2/mc-boot/GIO.cc
gcc/m2/mc-boot/GIndexing.cc
gcc/m2/mc-boot/GM2Dependent.cc
gcc/m2/mc-boot/GM2EXCEPTION.cc
gcc/m2/mc-boot/GM2RTS.cc
gcc/m2/mc-boot/GMemUtils.cc
gcc/m2/mc-boot/GNumberIO.cc
gcc/m2/mc-boot/GPushBackInput.cc
gcc/m2/mc-boot/GRTExceptions.cc
gcc/m2/mc-boot/GRTint.cc
gcc/m2/mc-boot/GSArgs.cc
gcc/m2/mc-boot/GSFIO.cc
gcc/m2/mc-boot/GStdIO.cc
gcc/m2/mc-boot/GStorage.cc
gcc/m2/mc-boot/GStrCase.cc
gcc/m2/mc-boot/GStrIO.cc
gcc/m2/mc-boot/GStrLib.cc
gcc/m2/mc-boot/GStringConvert.cc
gcc/m2/mc-boot/GSysStorage.cc
gcc/m2/mc-boot/GTimeString.cc
gcc/m2/mc-boot/Galists.cc
gcc/m2/mc-boot/Gdecl.cc
gcc/m2/mc-boot/Gdecl.h
gcc/m2/mc-boot/Gkeyc.cc
gcc/m2/mc-boot/Gldtoa.h
gcc/m2/mc-boot/Glibc.h
gcc/m2/mc-boot/Glists.cc
gcc/m2/mc-boot/GmcComment.cc
gcc/m2/mc-boot/GmcComp.cc
gcc/m2/mc-boot/GmcDebug.cc
gcc/m2/mc-boot/GmcError.cc
gcc/m2/mc-boot/GmcFileName.cc
gcc/m2/mc-boot/GmcLexBuf.cc
gcc/m2/mc-boot/GmcMetaError.cc
gcc/m2/mc-boot/GmcOptions.cc
gcc/m2/mc-boot/GmcPreprocess.cc
gcc/m2/mc-boot/GmcPretty.cc
gcc/m2/mc-boot/GmcPrintf.cc
gcc/m2/mc-boot/GmcQuiet.cc
gcc/m2/mc-boot/GmcReserved.cc
gcc/m2/mc-boot/GmcSearch.cc
gcc/m2/mc-boot/GmcStack.cc
gcc/m2/mc-boot/GmcStream.cc
gcc/m2/mc-boot/Gmcp1.cc
gcc/m2/mc-boot/Gmcp2.cc
gcc/m2/mc-boot/Gmcp3.cc
gcc/m2/mc-boot/Gmcp4.cc
gcc/m2/mc-boot/Gmcp5.cc
gcc/m2/mc-boot/GnameKey.cc
gcc/m2/mc-boot/GsymbolKey.cc
gcc/m2/mc-boot/Gvarargs.cc
gcc/m2/mc-boot/Gwlists.cc
gcc/m2/mc/decl.def
gcc/m2/mc/decl.mod
gcc/m2/mc/mc.flex
gcc/m2/mc/mcComment.h
gcc/m2/mc/mcOptions.mod
gcc/m2/mc/mcp1.bnf
gcc/testsuite/gm2/base-lang/pass/SYSTEM.def [new file with mode: 0644]
gcc/testsuite/gm2/base-lang/pass/base-lang-test.sh [new file with mode: 0755]
gcc/testsuite/gm2/base-lang/pass/globalproctype.def [new file with mode: 0644]
gcc/testsuite/gm2/base-lang/pass/globalproctype.mod [new file with mode: 0644]
gcc/testsuite/gm2/base-lang/pass/globalvar.def [new file with mode: 0644]
gcc/testsuite/gm2/base-lang/pass/globalvar.mod [new file with mode: 0644]
gcc/testsuite/gm2/base-lang/pass/globalvarassign.def [new file with mode: 0644]
gcc/testsuite/gm2/base-lang/pass/globalvarassign.mod [new file with mode: 0644]
gcc/testsuite/gm2/base-lang/pass/localproctype.def [new file with mode: 0644]
gcc/testsuite/gm2/base-lang/pass/localproctype.mod [new file with mode: 0644]
gcc/testsuite/gm2/base-lang/pass/localvar.def [new file with mode: 0644]
gcc/testsuite/gm2/base-lang/pass/localvar.mod [new file with mode: 0644]
gcc/testsuite/gm2/base-lang/pass/localvarassign.def [new file with mode: 0644]
gcc/testsuite/gm2/base-lang/pass/localvarassign.mod [new file with mode: 0644]
gcc/testsuite/gm2/base-lang/pass/opaquefield.def [new file with mode: 0644]
gcc/testsuite/gm2/base-lang/pass/opaquefield.mod [new file with mode: 0644]
gcc/testsuite/gm2/base-lang/pass/opaquenew.def [new file with mode: 0644]
gcc/testsuite/gm2/base-lang/pass/opaquenew.mod [new file with mode: 0644]
gcc/testsuite/gm2/base-lang/pass/opaqueparam.def [new file with mode: 0644]
gcc/testsuite/gm2/base-lang/pass/opaqueparam.mod [new file with mode: 0644]
gcc/testsuite/gm2/base-lang/pass/opaquestr.def [new file with mode: 0644]
gcc/testsuite/gm2/base-lang/pass/opaqueuse.def [new file with mode: 0644]
gcc/testsuite/gm2/base-lang/pass/opaqueuse.mod [new file with mode: 0644]
gcc/testsuite/gm2/base-lang/pass/opaqueusestr.def [new file with mode: 0644]
gcc/testsuite/gm2/base-lang/pass/opaqueusestr.mod [new file with mode: 0644]
gcc/testsuite/gm2/base-lang/pass/opaquevariant.def [new file with mode: 0644]
gcc/testsuite/gm2/base-lang/pass/opaquevariant.mod [new file with mode: 0644]
gcc/testsuite/gm2/base-lang/pass/opaquevarparam.def [new file with mode: 0644]
gcc/testsuite/gm2/base-lang/pass/opaquevarparam.mod [new file with mode: 0644]
gcc/testsuite/gm2/base-lang/pass/simplelist.def [new file with mode: 0644]
gcc/testsuite/gm2/base-lang/pass/simplelist.mod [new file with mode: 0644]
gcc/testsuite/gm2/base-lang/pass/simplelistiter.def [new file with mode: 0644]
gcc/testsuite/gm2/base-lang/pass/simplelistiter.mod [new file with mode: 0644]
gcc/testsuite/gm2/base-lang/pass/simpleopaque.def [new file with mode: 0644]
gcc/testsuite/gm2/base-lang/pass/simpleopaque.mod [new file with mode: 0644]
gcc/testsuite/gm2/base-lang/pass/straddress.def [new file with mode: 0644]
gcc/testsuite/gm2/base-lang/pass/straddress.mod [new file with mode: 0644]
gcc/testsuite/gm2/base-lang/pass/straddressexport.def [new file with mode: 0644]
gcc/testsuite/gm2/base-lang/pass/straddressexport.mod [new file with mode: 0644]
gcc/testsuite/gm2/base-lang/pass/unboundedarray.def [new file with mode: 0644]
gcc/testsuite/gm2/base-lang/pass/unboundedarray.mod [new file with mode: 0644]

index 83d592f35d8d14183d3f12b4e200132be4002e76..daa7ef6747a599011d166e8b725e268ea223725c 100644 (file)
@@ -505,7 +505,7 @@ MC_ARGS= --olang=c++ \
  $(MC_COPYRIGHT) \
  --gcc-config-system
 
-MC_EXTENDED_OPAQUE=--extended-opaque
+MC_EXTENDED_OPAQUE=
 MCDEPS=m2/boot-bin/mc$(exeext)
 
 MC=m2/boot-bin/mc$(exeext) $(MC_ARGS)
index 52f35f30e5a3bddaec38d4ec1054fe0faaf55389..6fa58975c58d57eb60f951f5367ecba89bdf397b 100644 (file)
@@ -77,90 +77,14 @@ PPG-LIB-MODS     = ASCII.mod \
 
 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)
-
-BUILD-BOOT-PPG-H: $(BUILD-BOOT-H) \
-                 m2/gm2-ppg-boot/$(SRC_PREFIX)M2RTS.h \
-                 m2/gm2-ppg-boot/$(SRC_PREFIX)M2Dependent.h \
-                $(PPG-DEFS:%.def=m2/gm2-ppg-boot/$(SRC_PREFIX)%.h)
-
-m2/gm2-ppg-boot/$(SRC_PREFIX)%.h: $(srcdir)/m2/gm2-libs/%.def $(MCDEPS)
-       -test -d m2/gm2-ppg-boot || $(mkinstalldirs) m2/gm2-ppg-boot
-       $(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 $(BUILD-BOOT-PPG-H)
-       -test -d m2/gm2-ppg-boot || $(mkinstalldirs) m2/gm2-ppg-boot
-       $(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 $(BUILD-BOOT-PPG-H)
-       -test -d m2/gm2-ppg-boot || $(mkinstalldirs) m2/gm2-ppg-boot
-       $(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)M2RTS.o: $(srcdir)/m2/gm2-libs/M2RTS.mod $(MCDEPS) $(BUILD-BOOT-PPG-H)
-       -test -d m2/gm2-ppg-boot || $(mkinstalldirs) m2/gm2-ppg-boot
-       $(MCC) --suppress-noreturn -o=m2/gm2-ppg-boot/$(SRC_PREFIX)M2RTS.cc $(srcdir)/m2/gm2-libs/M2RTS.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)M2RTS.cc -o $@
-
-m2/gm2-ppg-boot/$(SRC_PREFIX)%.o: $(srcdir)/m2/gm2-libs/%.mod $(MCDEPS) $(BUILD-BOOT-PPG-H)
-       -test -d m2/gm2-ppg-boot || $(mkinstalldirs) m2/gm2-ppg-boot
-       $(MCC) -o=m2/gm2-ppg-boot/$(SRC_PREFIX)$*.cc $(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)$*.cc -o $@
-
-m2/gm2-ppg-boot/$(SRC_PREFIX)%.o: $(srcdir)/m2/gm2-compiler/%.mod $(MCDEPS) $(BUILD-BOOT-PPG-H)
-       -test -d m2/gm2-ppg-boot || $(mkinstalldirs) m2/gm2-ppg-boot
-       $(MCC) -o=m2/gm2-ppg-boot/$(SRC_PREFIX)$*.cc $(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)$*.cc -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
-       -test -d m2 || $(mkinstalldirs) m2
-       +$(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 -lm
-
-m2/gm2-ppg-boot/main.o: $(M2LINK) $(srcdir)/m2/init/mcinit
-       -test -d m2/gm2-ppg-boot || $(mkinstalldirs) m2/gm2-ppg-boot
-       unset CC ; $(M2LINK) -s --langc++ --exit --name mainppginit.cc $(srcdir)/m2/init/ppginit
-       mv mainppginit.cc m2/gm2-ppg-boot/main.cc
-       $(CXX) $(INCLUDES) -g -c -o $@ m2/gm2-ppg-boot/main.cc
-
-m2/gm2-auto:
-       -test -d $@ || $(mkinstalldirs) $@
-
-c-family/m2pp.o : $(srcdir)/m2/m2pp.cc $(GCC_HEADER_DEPENDENCIES_FOR_M2)
-       $(COMPILER) -c -g $(ALL_COMPILERFLAGS) \
-            $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
-
-# m2/pg$(exext) is the 2nd generation parser generator built from ebnf
-# without error recovery
+# m2/pg$(exext) is the 2nd generation parser generator built from the
+# ebnf src without error recovery
 
 PG-SRC = pg.mod
 PGE-DEF = ASCII.def \
    Args.def \
    Assertion.def \
+   bnflex.def \
    Break.def  \
    COROUTINES.def \
    CmdArgs.def \
@@ -176,6 +100,7 @@ PGE-DEF = ASCII.def \
    M2RTS.def \
    MemUtils.def \
    NumberIO.def \
+   Output.def \
    PushBackInput.def \
    RTExceptions.def \
    RTco.def \
@@ -191,6 +116,7 @@ PGE-DEF = ASCII.def \
    StrIO.def \
    StrLib.def \
    StringConvert.def \
+   SymbolKey.def \
    SysExceptions.def \
    SysStorage.def \
    TimeString.def \
@@ -260,6 +186,9 @@ PGE-DEPS = Gabort.cc \
    GPushBackInput.cc \
    GPushBackInput.h \
    GRTco.cc \
+   GRTco.h \
+   GRTentity.cc \
+   GRTentity.h \
    GRTExceptions.cc \
    GRTExceptions.h \
    GSArgs.h \
@@ -295,19 +224,320 @@ PGE-DEPS = Gabort.cc \
    Gwrapc.cc \
    Gwrapc.h
 
+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)
+
+BUILD-BOOT-PPG-H = $(BUILD-BOOT-H) \
+                   m2/gm2-ppg-boot/$(SRC_PREFIX)M2RTS.h \
+                   m2/gm2-ppg-boot/$(SRC_PREFIX)M2Dependent.h \
+                   $(PGE-DEF:%.def=m2/gm2-ppg-boot/$(SRC_PREFIX)%.h) \
+                   $(PPG-DEFS:%.def=m2/gm2-ppg-boot/$(SRC_PREFIX)%.h) \
+                   $(PPG-LIB-DEFS:%.def=m2/gm2-ppg-boot/$(SRC_PREFIX)%.h)
+
+# BUILD-BOOT-PPG-H = $(BUILD-BOOT-H) $(PGE-DEF:%.def=m2/gm2-ppg-boot/$(SRC_PREFIX)%.h)
+
+m2/gm2-ppg-boot/$(SRC_PREFIX)%.h: $(srcdir)/m2/gm2-libs/%.def $(MCDEPS)
+       -test -d m2/gm2-ppg-boot || $(mkinstalldirs) m2/gm2-ppg-boot
+       $(MCC) -o=$@ $(srcdir)/m2/gm2-libs/$*.def
+
+m2/gm2-ppg-boot/$(SRC_PREFIX)libc.o: $(srcdir)/m2/mc-boot-ch/Glibc.c m2/gm2-libs/gm2-libs-host.h
+       -test -d m2/gm2-ppg-boot || $(mkinstalldirs) m2/gm2-ppg-boot
+       $(CXX) -I. -I$(srcdir)/../include -I$(srcdir) $(INCLUDES) -I$(srcdir)/m2/mc-boot-ch -Im2/gm2-libs -g -c $< -o $@
+
+m2/gm2-ppg-boot/$(SRC_PREFIX)mcrts.o:  $(srcdir)/m2/mc-boot-ch/Gmcrts.c m2/gm2-libs/gm2-libs-host.h
+       -test -d m2/gm2-ppg-boot || $(mkinstalldirs) m2/gm2-ppg-boot
+       $(CXX) -I. -I$(srcdir)/../include -I$(srcdir) $(INCLUDES) -I$(srcdir)/m2/mc-boot-ch -Im2/gm2-libs -g -c $< -o $@
+
+m2/gm2-ppg-boot/$(SRC_PREFIX)UnixArgs.o:  $(srcdir)/m2/mc-boot-ch/GUnixArgs.cc
+       -test -d m2/gm2-ppg-boot || $(mkinstalldirs) m2/gm2-ppg-boot
+       $(CXX) -I. -I$(srcdir)/../include -I$(srcdir) -I$(srcdir)/m2/mc-boot-ch $(INCLUDES) -g -c $< -o $@
+
+m2/gm2-ppg-boot/$(SRC_PREFIX)Selective.o:  $(srcdir)/m2/mc-boot-ch/GSelective.c m2/gm2-libs/gm2-libs-host.h
+       -test -d m2/gm2-ppg-boot || $(mkinstalldirs) m2/gm2-ppg-boot
+       $(CXX) -I. -I$(srcdir)/../include -I$(srcdir) -I$(srcdir)/m2/mc-boot-ch $(INCLUDES) -Im2/gm2-libs -g -c $< -o $@
+
+m2/gm2-ppg-boot/$(SRC_PREFIX)termios.o:  $(srcdir)/m2/mc-boot-ch/Gtermios.cc m2/gm2-libs/gm2-libs-host.h
+       -test -d m2/gm2-ppg-boot || $(mkinstalldirs) m2/gm2-ppg-boot
+       $(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)SysExceptions.o:  $(srcdir)/m2/mc-boot-ch/GSysExceptions.c m2/gm2-libs/gm2-libs-host.h
+       -test -d m2/gm2-ppg-boot || $(mkinstalldirs) m2/gm2-ppg-boot
+       $(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)ldtoa.o:  $(srcdir)/m2/mc-boot-ch/Gldtoa.cc m2/gm2-libs/gm2-libs-host.h
+       -test -d m2/gm2-ppg-boot || $(mkinstalldirs) m2/gm2-ppg-boot
+       $(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)dtoa.o:  $(srcdir)/m2/mc-boot-ch/Gdtoa.cc m2/gm2-libs/gm2-libs-host.h
+       -test -d m2/gm2-ppg-boot || $(mkinstalldirs) m2/gm2-ppg-boot
+       $(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)wrapc.o:  $(srcdir)/m2/mc-boot-ch/Gwrapc.c m2/gm2-libs/gm2-libs-host.h
+       -test -d m2/gm2-ppg-boot || $(mkinstalldirs) m2/gm2-ppg-boot
+       $(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)SYSTEM.o:  $(srcdir)/m2/mc-boot-ch/GSYSTEM.c $(BUILD-BOOT-PPG-H)
+       -test -d m2/gm2-ppg-boot || $(mkinstalldirs) m2/gm2-ppg-boot
+       $(CXX) -I. -I$(srcdir)/../include -I$(srcdir) -I$(srcdir)/m2/mc-boot-ch $(INCLUDES) -g -c $< -o $@
+
+m2/gm2-ppg-boot/$(SRC_PREFIX)errno.o:  $(srcdir)/m2/mc-boot-ch/Gerrno.cc
+       -test -d m2/gm2-ppg-boot || $(mkinstalldirs) m2/gm2-ppg-boot
+       $(CXX) -I. -I$(srcdir)/../include -I$(srcdir) -I$(srcdir)/m2/mc-boot-ch $(INCLUDES) -g -c $< -o $@
+
+m2/gm2-ppg-boot/$(SRC_PREFIX)M2RTS.o: $(srcdir)/m2/gm2-libs/M2RTS.mod $(MCDEPS) $(BUILD-BOOT-PPG-H)
+       -test -d m2/gm2-ppg-boot || $(mkinstalldirs) m2/gm2-ppg-boot
+       $(MCC) --suppress-noreturn -o=m2/gm2-ppg-boot/$(SRC_PREFIX)M2RTS.cc $(srcdir)/m2/gm2-libs/M2RTS.mod
+       $(CXX) -I. -I$(srcdir)/../include -I$(srcdir) -I$(srcdir)/m2/gm2-ppg-boot -I$(srcdir)/m2/mc-boot \
+              -I$(srcdir)/m2/mc-boot-ch -Im2/gm2-libs-boot \
+              $(INCLUDES) -g -c m2/gm2-ppg-boot/$(SRC_PREFIX)M2RTS.cc -o $@
+
+m2/gm2-ppg-boot/$(SRC_PREFIX)SymbolKey.h: $(srcdir)/m2/gm2-compiler/SymbolKey.def $(MCDEPS)
+       -test -d m2/gm2-ppg-boot || $(mkinstalldirs) m2/gm2-ppg-boot
+       $(MCC) -o=$@ $(srcdir)/m2/gm2-compiler/SymbolKey.def
+
+m2/gm2-ppg-boot/$(SRC_PREFIX)SymbolKey.o: $(srcdir)/m2/gm2-compiler/SymbolKey.mod \
+                                          $(MCDEPS) $(BUILD-BOOT-PPG-H) \
+                                          m2/gm2-ppg-boot/$(SRC_PREFIX)SymbolKey.h
+       -test -d m2/gm2-ppg-boot || $(mkinstalldirs) m2/gm2-ppg-boot
+       $(MCC) --suppress-noreturn -o=m2/gm2-ppg-boot/$(SRC_PREFIX)SymbolKey.cc $(srcdir)/m2/gm2-compiler/SymbolKey.mod
+       $(CXX) -I. -I$(srcdir)/../include -I$(srcdir) -I$(srcdir)/m2/gm2-ppg-boot -I$(srcdir)/m2/mc-boot \
+              -I$(srcdir)/m2/mc-boot-ch -Im2/gm2-libs-boot \
+              $(INCLUDES) -g -c m2/gm2-ppg-boot/$(SRC_PREFIX)SymbolKey.cc -o $@
+
+m2/gm2-ppg-boot/$(SRC_PREFIX)NameKey.h: $(srcdir)/m2/gm2-compiler/NameKey.def $(MCDEPS)
+       -test -d m2/gm2-ppg-boot || $(mkinstalldirs) m2/gm2-ppg-boot
+       $(MCC) -o=$@ $(srcdir)/m2/gm2-compiler/NameKey.def
+
+m2/gm2-ppg-boot/$(SRC_PREFIX)NameKey.o: $(srcdir)/m2/gm2-compiler/NameKey.mod \
+                                        $(MCDEPS) $(BUILD-BOOT-PPG-H) \
+                                        m2/gm2-ppg-boot/$(SRC_PREFIX)NameKey.h
+       -test -d m2/gm2-ppg-boot || $(mkinstalldirs) m2/gm2-ppg-boot
+       $(MCC) --suppress-noreturn -o=m2/gm2-ppg-boot/$(SRC_PREFIX)NameKey.cc $(srcdir)/m2/gm2-compiler/NameKey.mod
+       $(CXX) -I. -I$(srcdir)/../include -I$(srcdir) -I$(srcdir)/m2/gm2-ppg-boot -I$(srcdir)/m2/mc-boot \
+              -I$(srcdir)/m2/mc-boot-ch -Im2/gm2-libs-boot \
+              $(INCLUDES) -g -c m2/gm2-ppg-boot/$(SRC_PREFIX)NameKey.cc -o $@
+
+m2/gm2-ppg-boot/$(SRC_PREFIX)Lists.h: $(srcdir)/m2/gm2-compiler/Lists.def $(MCDEPS)
+       -test -d m2/gm2-ppg-boot || $(mkinstalldirs) m2/gm2-ppg-boot
+       $(MCC) -o=$@ $(srcdir)/m2/gm2-compiler/Lists.def
+
+m2/gm2-ppg-boot/$(SRC_PREFIX)Lists.o: $(srcdir)/m2/gm2-compiler/Lists.mod \
+                                      $(MCDEPS) $(BUILD-BOOT-PPG-H) \
+                                      m2/gm2-ppg-boot/$(SRC_PREFIX)Lists.h
+       -test -d m2/gm2-ppg-boot || $(mkinstalldirs) m2/gm2-ppg-boot
+       $(MCC) --suppress-noreturn -o=m2/gm2-ppg-boot/$(SRC_PREFIX)Lists.cc $(srcdir)/m2/gm2-compiler/Lists.mod
+       $(CXX) -I. -I$(srcdir)/../include -I$(srcdir) -I$(srcdir)/m2/gm2-ppg-boot -I$(srcdir)/m2/mc-boot \
+              -I$(srcdir)/m2/mc-boot-ch -Im2/gm2-libs-boot \
+              $(INCLUDES) -g -c m2/gm2-ppg-boot/$(SRC_PREFIX)Lists.cc -o $@
+
+m2/gm2-ppg-boot/$(SRC_PREFIX)Output.h: $(srcdir)/m2/gm2-compiler/Output.def $(MCDEPS)
+       -test -d m2/gm2-ppg-boot || $(mkinstalldirs) m2/gm2-ppg-boot
+       $(MCC) -o=$@ $(srcdir)/m2/gm2-compiler/Output.def
+
+m2/gm2-ppg-boot/$(SRC_PREFIX)Output.o: $(srcdir)/m2/gm2-compiler/Output.mod \
+                                      $(MCDEPS) $(BUILD-BOOT-PPG-H) \
+                                      m2/gm2-ppg-boot/$(SRC_PREFIX)Output.h
+       -test -d m2/gm2-ppg-boot || $(mkinstalldirs) m2/gm2-ppg-boot
+       $(MCC) --suppress-noreturn -o=m2/gm2-ppg-boot/$(SRC_PREFIX)Output.cc $(srcdir)/m2/gm2-compiler/Output.mod
+       $(CXX) -I. -I$(srcdir)/../include -I$(srcdir) -I$(srcdir)/m2/gm2-ppg-boot -I$(srcdir)/m2/mc-boot \
+              -I$(srcdir)/m2/mc-boot-ch -Im2/gm2-libs-boot \
+              $(INCLUDES) -g -c m2/gm2-ppg-boot/$(SRC_PREFIX)Output.cc -o $@
+
+m2/gm2-ppg-boot/$(SRC_PREFIX)bnflex.h: $(srcdir)/m2/gm2-compiler/bnflex.def $(MCDEPS)
+       -test -d m2/gm2-ppg-boot || $(mkinstalldirs) m2/gm2-ppg-boot
+       $(MCC) -o=$@ $(srcdir)/m2/gm2-compiler/bnflex.def
+
+m2/gm2-ppg-boot/$(SRC_PREFIX)bnflex.o: $(srcdir)/m2/gm2-compiler/bnflex.mod \
+                                      $(MCDEPS) $(BUILD-BOOT-PPG-H) \
+                                      m2/gm2-ppg-boot/$(SRC_PREFIX)bnflex.h
+       -test -d m2/gm2-ppg-boot || $(mkinstalldirs) m2/gm2-ppg-boot
+       $(MCC) --suppress-noreturn -o=m2/gm2-ppg-boot/$(SRC_PREFIX)bnflex.cc $(srcdir)/m2/gm2-compiler/bnflex.mod
+       $(CXX) -I. -I$(srcdir)/../include -I$(srcdir) -I$(srcdir)/m2/gm2-ppg-boot -I$(srcdir)/m2/mc-boot \
+              -I$(srcdir)/m2/mc-boot-ch -Im2/gm2-libs-boot \
+              $(INCLUDES) -g -c m2/gm2-ppg-boot/$(SRC_PREFIX)bnflex.cc -o $@
+
+m2/gm2-ppg-boot/$(SRC_PREFIX)RTco.h: $(srcdir)/m2/gm2-libs-iso/RTco.def $(MCDEPS)
+       -test -d m2/gm2-ppg-boot || $(mkinstalldirs) m2/gm2-ppg-boot
+       $(MCC) -o=$@ -I$(srcdir)/m2/gm2-libs-iso -I$(srcdir)/m2/gm2-libs $(srcdir)/m2/gm2-libs-iso/RTco.def
+
+m2/gm2-ppg-boot/$(SRC_PREFIX)RTentity.h: $(srcdir)/m2/gm2-libs-iso/RTentity.def $(MCDEPS)
+       -test -d m2/gm2-ppg-boot || $(mkinstalldirs) m2/gm2-ppg-boot
+       $(MCC) -o=$@ -I$(srcdir)/m2/gm2-libs-iso -I$(srcdir)/m2/gm2-libs $(srcdir)/m2/gm2-libs-iso/RTentity.def
+
+m2/gm2-ppg-boot/$(SRC_PREFIX)RTco.o: $(srcdir)/m2/gm2-libs-iso/RTcodummy.c
+       -test -d m2/gm2-ppg-boot || $(mkinstalldirs) m2/gm2-ppg-boot
+       $(CXX) -I. -I$(srcdir)/../include -I$(srcdir) -I$(srcdir)/m2/gm2-ppg-boot -I$(srcdir)/m2/mc-boot \
+              -I$(srcdir)/m2/mc-boot-ch -Im2/gm2-libs-boot \
+              $(INCLUDES) -g -c $< -o $@
+
+m2/gm2-ppg-boot/$(SRC_PREFIX)RTentity.o: $(srcdir)/m2/gm2-libs-iso/RTentity.mod \
+                                      $(MCDEPS) $(BUILD-BOOT-PPG-H) \
+                                      m2/gm2-ppg-boot/$(SRC_PREFIX)RTentity.h
+       -test -d m2/gm2-ppg-boot || $(mkinstalldirs) m2/gm2-ppg-boot
+       $(MCC) --suppress-noreturn -o=m2/gm2-ppg-boot/$(SRC_PREFIX)RTentity.cc $(srcdir)/m2/gm2-libs-iso/RTentity.mod
+       $(CXX) -I. -I$(srcdir)/../include -I$(srcdir) -I$(srcdir)/m2/gm2-ppg-boot -I$(srcdir)/m2/mc-boot \
+              -I$(srcdir)/m2/mc-boot-ch -Im2/gm2-libs-boot \
+              $(INCLUDES) -g -c m2/gm2-ppg-boot/$(SRC_PREFIX)RTentity.cc -o $@
+
+m2/gm2-ppg-boot/$(SRC_PREFIX)%.o: $(srcdir)/m2/gm2-libs/%.mod $(MCDEPS) $(BUILD-BOOT-PPG-H)
+       -test -d m2/gm2-ppg-boot || $(mkinstalldirs) m2/gm2-ppg-boot
+       $(MCC) -o=m2/gm2-ppg-boot/$(SRC_PREFIX)$*.cc $(srcdir)/m2/gm2-libs/$*.mod
+       $(CXX) -I. -I$(srcdir)/../include -I$(srcdir) -I$(srcdir)/m2/gm2-ppg-boot -I$(srcdir)/m2/mc-boot \
+              -I$(srcdir)/m2/mc-boot-ch -Im2/gm2-libs-boot \
+              $(INCLUDES) -g -c m2/gm2-ppg-boot/$(SRC_PREFIX)$*.cc -o $@
+
+m2/gm2-ppg-boot/$(SRC_PREFIX)%.o: $(srcdir)/m2/gm2-compiler/%.mod $(MCDEPS) $(BUILD-BOOT-PPG-H)
+       -test -d m2/gm2-ppg-boot || $(mkinstalldirs) m2/gm2-ppg-boot
+       $(MCC) -o=m2/gm2-ppg-boot/$(SRC_PREFIX)$*.cc $(srcdir)/m2/gm2-compiler/$*.mod
+       $(CXX) -I. -I$(srcdir)/../include -I$(srcdir) -I$(srcdir)/m2/mc-boot -Im2/gm2-compiler-boot \
+              -Im2/gm2-libs-boot -Im2/gm2-ppg-boot \
+              -I$(srcdir)/m2/mc-boot-ch $(INCLUDES) -g -c m2/gm2-ppg-boot/$(SRC_PREFIX)$*.cc -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
+       -test -d m2 || $(mkinstalldirs) m2
+       +$(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 -lm
+
+m2/gm2-ppg-boot/main.o: $(M2LINK) $(srcdir)/m2/init/mcinit
+       -test -d m2/gm2-ppg-boot || $(mkinstalldirs) m2/gm2-ppg-boot
+       unset CC ; $(M2LINK) -s --langc++ --exit --name mainppginit.cc $(srcdir)/m2/init/ppginit
+       mv mainppginit.cc m2/gm2-ppg-boot/main.cc
+       $(CXX) $(INCLUDES) -g -c -o $@ m2/gm2-ppg-boot/main.cc
+
+m2/gm2-auto:
+       -test -d $@ || $(mkinstalldirs) $@
+
+c-family/m2pp.o : $(srcdir)/m2/m2pp.cc $(GCC_HEADER_DEPENDENCIES_FOR_M2)
+       $(COMPILER) -c -g $(ALL_COMPILERFLAGS) \
+            $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION)
+
+
 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)
 
-BUILD-BOOT-PG-H: $(BUILD-BOOT-H) \
+BUILD-BOOT-PG-H = $(BUILD-BOOT-H) \
                  m2/gm2-pg-boot/$(SRC_PREFIX)M2RTS.h \
-                 m2/gm2-pg-boot/$(SRC_PREFIX)M2Dependent.h
+                 m2/gm2-pg-boot/$(SRC_PREFIX)M2Dependent.h \
+                 $(PGE-DEF:%.def=m2/gm2-pg-boot/$(SRC_PREFIX)%.h) \
+                 $(PPG-DEFS:%.def=m2/gm2-pg-boot/$(SRC_PREFIX)%.h) \
+                 $(PPG-LIB-DEFS:%.def=m2/gm2-pg-boot/$(SRC_PREFIX)%.h)
 
 m2/gm2-pg-boot/$(SRC_PREFIX)%.h: $(srcdir)/m2/gm2-libs/%.def $(MCDEPS)
        -test -d m2/gm2-pg-boot || $(mkinstalldirs) m2/gm2-pg-boot
-       $(MCC) -o=$@ $(srcdir)/m2/gm2-libs/$*.def
+       $(MCC) -o=$@ $(srcdir)/m2/gm2-libs/$*.def $<
+
+m2/gm2-pg-boot/$(SRC_PREFIX)%.h: $(srcdir)/m2/gm2-compiler/%.def $(MCDEPS)
+       -test -d m2/gm2-pg-boot || $(mkinstalldirs) m2/gm2-pg-boot
+       $(MCC) -o=$@ -I$(srcdir)/m2/gm2-libs -I$(srcdir)/m2/gm2-compiler $<
+
+m2/gm2-pg-boot/$(SRC_PREFIX)SymbolKey.h: $(srcdir)/m2/gm2-compiler/SymbolKey.def $(MCDEPS)
+       -test -d m2/gm2-pg-boot || $(mkinstalldirs) m2/gm2-pg-boot
+       $(MCC) -o=$@ $(srcdir)/m2/gm2-compiler/SymbolKey.def
+
+m2/gm2-pg-boot/$(SRC_PREFIX)SymbolKey.o: $(srcdir)/m2/gm2-compiler/SymbolKey.mod \
+                                          $(MCDEPS) $(BUILD-BOOT-PG-H) \
+                                          m2/gm2-pg-boot/$(SRC_PREFIX)SymbolKey.h
+       -test -d m2/gm2-pg-boot || $(mkinstalldirs) m2/gm2-pg-boot
+       $(MCC) --suppress-noreturn -o=m2/gm2-pg-boot/$(SRC_PREFIX)SymbolKey.cc $(srcdir)/m2/gm2-compiler/SymbolKey.mod
+       $(CXX) -I. -I$(srcdir)/../include -I$(srcdir) -I$(srcdir)/m2/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)SymbolKey.cc -o $@
+
+m2/gm2-pg-boot/$(SRC_PREFIX)NameKey.h: $(srcdir)/m2/gm2-compiler/NameKey.def $(MCDEPS)
+       -test -d m2/gm2-pg-boot || $(mkinstalldirs) m2/gm2-pg-boot
+       $(MCC) -o=$@ $(srcdir)/m2/gm2-compiler/NameKey.def
+
+m2/gm2-pg-boot/$(SRC_PREFIX)NameKey.o: $(srcdir)/m2/gm2-compiler/NameKey.mod \
+                                        $(MCDEPS) $(BUILD-BOOT-PG-H) \
+                                        m2/gm2-pg-boot/$(SRC_PREFIX)NameKey.h
+       -test -d m2/gm2-pg-boot || $(mkinstalldirs) m2/gm2-pg-boot
+       $(MCC) --suppress-noreturn -o=m2/gm2-pg-boot/$(SRC_PREFIX)NameKey.cc $(srcdir)/m2/gm2-compiler/NameKey.mod
+       $(CXX) -I. -I$(srcdir)/../include -I$(srcdir) -I$(srcdir)/m2/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)NameKey.cc -o $@
+
+m2/gm2-pg-boot/$(SRC_PREFIX)Lists.h: $(srcdir)/m2/gm2-compiler/Lists.def $(MCDEPS)
+       -test -d m2/gm2-pg-boot || $(mkinstalldirs) m2/gm2-pg-boot
+       $(MCC) -o=$@ $(srcdir)/m2/gm2-compiler/Lists.def
+
+m2/gm2-pg-boot/$(SRC_PREFIX)Lists.o: $(srcdir)/m2/gm2-compiler/Lists.mod \
+                                      $(MCDEPS) $(BUILD-BOOT-PG-H) \
+                                      m2/gm2-pg-boot/$(SRC_PREFIX)Lists.h
+       -test -d m2/gm2-pg-boot || $(mkinstalldirs) m2/gm2-pg-boot
+       $(MCC) --suppress-noreturn -o=m2/gm2-pg-boot/$(SRC_PREFIX)Lists.cc $(srcdir)/m2/gm2-compiler/Lists.mod
+       $(CXX) -I. -I$(srcdir)/../include -I$(srcdir) -I$(srcdir)/m2/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)Lists.cc -o $@
+
+m2/gm2-pg-boot/$(SRC_PREFIX)Output.h: $(srcdir)/m2/gm2-compiler/Output.def $(MCDEPS)
+       -test -d m2/gm2-pg-boot || $(mkinstalldirs) m2/gm2-pg-boot
+       $(MCC) -o=$@ $(srcdir)/m2/gm2-compiler/Output.def
+
+m2/gm2-pg-boot/$(SRC_PREFIX)Output.o: $(srcdir)/m2/gm2-compiler/Output.mod \
+                                      $(MCDEPS) $(BUILD-BOOT-PG-H) \
+                                      m2/gm2-pg-boot/$(SRC_PREFIX)Output.h
+       -test -d m2/gm2-pg-boot || $(mkinstalldirs) m2/gm2-pg-boot
+       $(MCC) --suppress-noreturn -o=m2/gm2-pg-boot/$(SRC_PREFIX)Output.cc $(srcdir)/m2/gm2-compiler/Output.mod
+       $(CXX) -I. -I$(srcdir)/../include -I$(srcdir) -I$(srcdir)/m2/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)Output.cc -o $@
+
+m2/gm2-pg-boot/$(SRC_PREFIX)bnflex.h: $(srcdir)/m2/gm2-compiler/bnflex.def $(MCDEPS)
+       -test -d m2/gm2-pg-boot || $(mkinstalldirs) m2/gm2-pg-boot
+       $(MCC) -o=$@ $(srcdir)/m2/gm2-compiler/bnflex.def
+
+m2/gm2-pg-boot/$(SRC_PREFIX)bnflex.o: $(srcdir)/m2/gm2-compiler/bnflex.mod \
+                                      $(MCDEPS) $(BUILD-BOOT-PG-H) \
+                                      m2/gm2-pg-boot/$(SRC_PREFIX)bnflex.h
+       -test -d m2/gm2-pg-boot || $(mkinstalldirs) m2/gm2-pg-boot
+       $(MCC) --suppress-noreturn -o=m2/gm2-pg-boot/$(SRC_PREFIX)bnflex.cc $(srcdir)/m2/gm2-compiler/bnflex.mod
+       $(CXX) -I. -I$(srcdir)/../include -I$(srcdir) -I$(srcdir)/m2/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)bnflex.cc -o $@
+
+m2/gm2-pg-boot/$(SRC_PREFIX)RTco.h: $(srcdir)/m2/gm2-libs-iso/RTco.def $(MCDEPS)
+       -test -d m2/gm2-pg-boot || $(mkinstalldirs) m2/gm2-pg-boot
+       $(MCC) -o=$@ -I$(srcdir)/m2/gm2-libs-iso -I$(srcdir)/m2/gm2-libs $(srcdir)/m2/gm2-libs-iso/RTco.def
+
+m2/gm2-pg-boot/$(SRC_PREFIX)RTentity.h: $(srcdir)/m2/gm2-libs-iso/RTentity.def $(MCDEPS)
+       -test -d m2/gm2-pg-boot || $(mkinstalldirs) m2/gm2-pg-boot
+       $(MCC) -o=$@ -I$(srcdir)/m2/gm2-libs-iso -I$(srcdir)/m2/gm2-libs $(srcdir)/m2/gm2-libs-iso/RTentity.def
+
+m2/gm2-pg-boot/$(SRC_PREFIX)RTco.o: $(srcdir)/m2/gm2-libs-iso/RTcodummy.c
+       -test -d m2/gm2-pg-boot || $(mkinstalldirs) m2/gm2-pg-boot
+       $(CXX) -I. -I$(srcdir)/../include -I$(srcdir) -I$(srcdir)/m2/gm2-pg-boot -I$(srcdir)/m2/mc-boot \
+              -I$(srcdir)/m2/mc-boot-ch -Im2/gm2-libs-boot \
+              $(INCLUDES) -g -c $< -o $@
+
+m2/gm2-pg-boot/$(SRC_PREFIX)RTentity.o: $(srcdir)/m2/gm2-libs-iso/RTentity.mod \
+                                      $(MCDEPS) $(BUILD-BOOT-PG-H) \
+                                      m2/gm2-pg-boot/$(SRC_PREFIX)RTentity.h
+       -test -d m2/gm2-pg-boot || $(mkinstalldirs) m2/gm2-pg-boot
+       $(MCC) --suppress-noreturn -o=m2/gm2-pg-boot/$(SRC_PREFIX)RTentity.cc $(srcdir)/m2/gm2-libs-iso/RTentity.mod
+       $(CXX) -I. -I$(srcdir)/../include -I$(srcdir) -I$(srcdir)/m2/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)RTentity.cc -o $@
 
 m2/gm2-pg-boot/$(SRC_PREFIX)%.o: m2/mc-boot-ch/$(SRC_PREFIX)%.c m2/gm2-libs/gm2-libs-host.h $(BUILD-BOOT-PG-H)
        -test -d m2/gm2-pg-boot || $(mkinstalldirs) m2/gm2-pg-boot
@@ -319,16 +549,15 @@ m2/gm2-pg-boot/$(SRC_PREFIX)%.o: m2/mc-boot-ch/$(SRC_PREFIX)%.cc m2/gm2-libs/gm2
 
 m2/gm2-pg-boot/$(SRC_PREFIX)M2RTS.o: $(srcdir)/m2/gm2-libs/M2RTS.mod $(MCDEPS) $(BUILD-BOOT-PG-H)
        -test -d m2/gm2-pg-boot || $(mkinstalldirs) m2/gm2-pg-boot
-       $(MCC) --suppress-noreturn -o=m2/gm2-pg-boot/$(SRC_PREFIX)M2RTS.c $(srcdir)/m2/gm2-libs/M2RTS.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)M2RTS.c -o $@
+       $(MCC) --suppress-noreturn -o=m2/gm2-pg-boot/$(SRC_PREFIX)M2RTS.cc $(srcdir)/m2/gm2-libs/M2RTS.mod
+       $(CXX) -I. -I$(srcdir)/../include -I$(srcdir) -I$(srcdir)/m2/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)M2RTS.cc -o $@
 
 m2/gm2-pg-boot/$(SRC_PREFIX)%.o: $(srcdir)/m2/gm2-libs/%.mod $(MCDEPS) $(BUILD-BOOT-PG-H)
        -test -d m2/gm2-pg-boot || $(mkinstalldirs) m2/gm2-pg-boot
        $(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 \
+       $(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 $@
@@ -390,8 +619,7 @@ BUILD-PGE-O = $(PPG-INTERFACE-C:%.c=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)
 
-BUILD-BOOT-PGE-H: $(BUILD-BOOT-H) $(PGE-DEF:%.def=m2/gm2-pge-boot/$(SRC_PREFIX)%.h) \
-                  m2/gm2-pge-boot/GM2RTS.h m2/gm2-pge-boot/GM2Dependent.h
+BUILD-BOOT-PGE-H = $(BUILD-BOOT-H) $(PGE-DEF:%.def=m2/gm2-pge-boot/$(SRC_PREFIX)%.h)
 
 m2/gm2-auto/pge.mod: m2/pg$(exeext)
        -test -d m2/gm2-auto || $(mkinstalldirs) m2/gm2-auto
@@ -453,6 +681,94 @@ m2/gm2-pge-boot/$(SRC_PREFIX)M2RTS.o: $(srcdir)/m2/gm2-libs/M2RTS.mod $(MCDEPS)
               -I$(srcdir)/m2/mc-boot-ch -Im2/gm2-libs-boot \
               $(INCLUDES) -g -c m2/gm2-pge-boot/$(SRC_PREFIX)M2RTS.cc -o $@
 
+m2/gm2-pge-boot/$(SRC_PREFIX)SymbolKey.h: $(srcdir)/m2/gm2-compiler/SymbolKey.def $(MCDEPS)
+       -test -d m2/gm2-pge-boot || $(mkinstalldirs) m2/gm2-pge-boot
+       $(MCC) -o=$@ $(srcdir)/m2/gm2-compiler/SymbolKey.def
+
+m2/gm2-pge-boot/$(SRC_PREFIX)SymbolKey.o: $(srcdir)/m2/gm2-compiler/SymbolKey.mod \
+                                          $(MCDEPS) $(BUILD-BOOT-PGE-H) \
+                                          m2/gm2-pge-boot/$(SRC_PREFIX)SymbolKey.h
+       -test -d m2/gm2-pge-boot || $(mkinstalldirs) m2/gm2-pge-boot
+       $(MCC) --suppress-noreturn -o=m2/gm2-pge-boot/$(SRC_PREFIX)SymbolKey.cc $(srcdir)/m2/gm2-compiler/SymbolKey.mod
+       $(CXX) -I. -I$(srcdir)/../include -I$(srcdir) -I$(srcdir)/m2/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)SymbolKey.cc -o $@
+
+m2/gm2-pge-boot/$(SRC_PREFIX)NameKey.h: $(srcdir)/m2/gm2-compiler/NameKey.def $(MCDEPS)
+       -test -d m2/gm2-pge-boot || $(mkinstalldirs) m2/gm2-pge-boot
+       $(MCC) -o=$@ $(srcdir)/m2/gm2-compiler/NameKey.def
+
+m2/gm2-pge-boot/$(SRC_PREFIX)NameKey.o: $(srcdir)/m2/gm2-compiler/NameKey.mod \
+                                        $(MCDEPS) $(BUILD-BOOT-PGE-H) \
+                                        m2/gm2-pge-boot/$(SRC_PREFIX)NameKey.h
+       -test -d m2/gm2-pge-boot || $(mkinstalldirs) m2/gm2-pge-boot
+       $(MCC) --suppress-noreturn -o=m2/gm2-pge-boot/$(SRC_PREFIX)NameKey.cc $(srcdir)/m2/gm2-compiler/NameKey.mod
+       $(CXX) -I. -I$(srcdir)/../include -I$(srcdir) -I$(srcdir)/m2/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)NameKey.cc -o $@
+
+m2/gm2-pge-boot/$(SRC_PREFIX)Lists.h: $(srcdir)/m2/gm2-compiler/Lists.def $(MCDEPS)
+       -test -d m2/gm2-pge-boot || $(mkinstalldirs) m2/gm2-pge-boot
+       $(MCC) -o=$@ $(srcdir)/m2/gm2-compiler/Lists.def
+
+m2/gm2-pge-boot/$(SRC_PREFIX)Lists.o: $(srcdir)/m2/gm2-compiler/Lists.mod \
+                                      $(MCDEPS) $(BUILD-BOOT-PGE-H) \
+                                      m2/gm2-pge-boot/$(SRC_PREFIX)Lists.h
+       -test -d m2/gm2-pge-boot || $(mkinstalldirs) m2/gm2-pge-boot
+       $(MCC) --suppress-noreturn -o=m2/gm2-pge-boot/$(SRC_PREFIX)Lists.cc $(srcdir)/m2/gm2-compiler/Lists.mod
+       $(CXX) -I. -I$(srcdir)/../include -I$(srcdir) -I$(srcdir)/m2/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)Lists.cc -o $@
+
+m2/gm2-pge-boot/$(SRC_PREFIX)Output.h: $(srcdir)/m2/gm2-compiler/Output.def $(MCDEPS)
+       -test -d m2/gm2-pge-boot || $(mkinstalldirs) m2/gm2-pge-boot
+       $(MCC) -o=$@ $(srcdir)/m2/gm2-compiler/Output.def
+
+m2/gm2-pge-boot/$(SRC_PREFIX)Output.o: $(srcdir)/m2/gm2-compiler/Output.mod \
+                                      $(MCDEPS) $(BUILD-BOOT-PGE-H) \
+                                      m2/gm2-pge-boot/$(SRC_PREFIX)Output.h
+       -test -d m2/gm2-pge-boot || $(mkinstalldirs) m2/gm2-pge-boot
+       $(MCC) --suppress-noreturn -o=m2/gm2-pge-boot/$(SRC_PREFIX)Output.cc $(srcdir)/m2/gm2-compiler/Output.mod
+       $(CXX) -I. -I$(srcdir)/../include -I$(srcdir) -I$(srcdir)/m2/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)Output.cc -o $@
+
+m2/gm2-pge-boot/$(SRC_PREFIX)bnflex.h: $(srcdir)/m2/gm2-compiler/bnflex.def $(MCDEPS)
+       -test -d m2/gm2-pge-boot || $(mkinstalldirs) m2/gm2-pge-boot
+       $(MCC) -o=$@ $(srcdir)/m2/gm2-compiler/bnflex.def
+
+m2/gm2-pge-boot/$(SRC_PREFIX)bnflex.o: $(srcdir)/m2/gm2-compiler/bnflex.mod \
+                                      $(MCDEPS) $(BUILD-BOOT-PGE-H) \
+                                      m2/gm2-pge-boot/$(SRC_PREFIX)bnflex.h
+       -test -d m2/gm2-pge-boot || $(mkinstalldirs) m2/gm2-pge-boot
+       $(MCC) --suppress-noreturn -o=m2/gm2-pge-boot/$(SRC_PREFIX)bnflex.cc $(srcdir)/m2/gm2-compiler/bnflex.mod
+       $(CXX) -I. -I$(srcdir)/../include -I$(srcdir) -I$(srcdir)/m2/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)bnflex.cc -o $@
+
+m2/gm2-pge-boot/$(SRC_PREFIX)RTco.h: $(srcdir)/m2/gm2-libs-iso/RTco.def $(MCDEPS)
+       -test -d m2/gm2-pge-boot || $(mkinstalldirs) m2/gm2-pge-boot
+       $(MCC) -o=$@ -I$(srcdir)/m2/gm2-libs-iso -I$(srcdir)/m2/gm2-libs $(srcdir)/m2/gm2-libs-iso/RTco.def
+
+m2/gm2-pge-boot/$(SRC_PREFIX)RTentity.h: $(srcdir)/m2/gm2-libs-iso/RTentity.def $(MCDEPS)
+       -test -d m2/gm2-pge-boot || $(mkinstalldirs) m2/gm2-pge-boot
+       $(MCC) -o=$@ -I$(srcdir)/m2/gm2-libs-iso -I$(srcdir)/m2/gm2-libs $(srcdir)/m2/gm2-libs-iso/RTentity.def
+
+m2/gm2-pge-boot/$(SRC_PREFIX)RTco.o: $(srcdir)/m2/gm2-libs-iso/RTcodummy.c
+       -test -d m2/gm2-pge-boot || $(mkinstalldirs) m2/gm2-pge-boot
+       $(CXX) -I. -I$(srcdir)/../include -I$(srcdir) -I$(srcdir)/m2/gm2-pge-boot -I$(srcdir)/m2/mc-boot \
+              -I$(srcdir)/m2/mc-boot-ch -Im2/gm2-libs-boot \
+              $(INCLUDES) -g -c $< -o $@
+
+m2/gm2-pge-boot/$(SRC_PREFIX)RTentity.o: $(srcdir)/m2/gm2-libs-iso/RTentity.mod \
+                                      $(MCDEPS) $(BUILD-BOOT-PGE-H) \
+                                      m2/gm2-pge-boot/$(SRC_PREFIX)RTentity.h
+       -test -d m2/gm2-pge-boot || $(mkinstalldirs) m2/gm2-pge-boot
+       $(MCC) --suppress-noreturn -o=m2/gm2-pge-boot/$(SRC_PREFIX)RTentity.cc $(srcdir)/m2/gm2-libs-iso/RTentity.mod
+       $(CXX) -I. -I$(srcdir)/../include -I$(srcdir) -I$(srcdir)/m2/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)RTentity.cc -o $@
+
 m2/gm2-pge-boot/$(SRC_PREFIX)%.o: $(srcdir)/m2/gm2-libs/%.mod $(MCDEPS) $(BUILD-BOOT-PGE-H)
        -test -d m2/gm2-pge-boot || $(mkinstalldirs) m2/gm2-pge-boot
        $(MCC) -o=m2/gm2-pge-boot/$(SRC_PREFIX)$*.cc $(srcdir)/m2/gm2-libs/$*.mod
@@ -586,7 +902,6 @@ MCLINK=-g     # use -g -fmodules -c if you are debugging and wish to see missing
 # 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/13.0.0/m2/m2pim
 GM2PATH=-I$(srcdir)/m2/mc \
         -I$(srcdir)/m2 -Im2/gm2-auto \
         -fm2-pathname=m2pim -I$(srcdir)/m2/gm2-libs -I$(srcdir)/m2/gm2-libs-ch \
@@ -594,12 +909,18 @@ GM2PATH=-I$(srcdir)/m2/mc \
 
 mc: mc-clean mc-devel
 
+mc-basetest: force
+       $(SHELL) $(srcdir)/testsuite/gm2/base-lang/pass/base-lang-test.sh ./mc $(srcdir) `pwd` $(COMPILER)
+
+mc-devel-basetest: force
+       $(SHELL) $(srcdir)/testsuite/gm2/base-lang/pass/base-lang-test.sh m2/boot-bin/mc-devel$(exeext) $(srcdir) `pwd` $(COMPILER)
+
 mc-push: force
        cp -p m2/mc-boot-gen/*.cc $(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/*.{cc,h} m2/boot-bin/* m2/mc-boot/* m2/mc-boot-ch/*
+       $(RM) m2/mc-boot-gen/*.{cc,h} m2/boot-bin/* m2/mc-boot/* m2/mc-boot-ch/* mc
 
 mc-maintainer: mc-clean mc-autogen mc-push mc-clean mc-bootstrap
 
@@ -765,7 +1086,7 @@ m2/mc-boot-gen/$(SRC_PREFIX)%.h: $(srcdir)/m2/gm2-libs/%.def
 
 m2/mc-boot-gen/$(SRC_PREFIX)decl.cc: $(srcdir)/m2/mc/decl.mod
        -test -d m2/mc-boot-gen || $(mkinstalldirs) m2/mc-boot-gen
-       ./mc $(MC_OPTIONS) --extended-opaque -I$(srcdir)/m2/mc -I$(srcdir)/m2/gm2-libs -I$(srcdir)/m2/gm2-libs-iso --h-file-prefix=$(SRC_PREFIX) -o=$@ $<
+       ./mc $(MC_OPTIONS) $(EXTENDED_OPAQUE) -I$(srcdir)/m2/mc -I$(srcdir)/m2/gm2-libs -I$(srcdir)/m2/gm2-libs-iso --h-file-prefix=$(SRC_PREFIX) -o=$@ $<
 
 m2/mc-boot-gen/$(SRC_PREFIX)%.cc: $(srcdir)/m2/mc/%.mod
        -test -d m2/mc-boot-gen || $(mkinstalldirs) m2/mc-boot-gen
index a3d112c0cdf3603c6d756d149c6e5ebc1c8b6fed..d2d7e68fc353bed19446cf6f26981bf3df01e4fe 100644 (file)
@@ -1061,7 +1061,7 @@ PROCEDURE GetM2DumpFilter () : ADDRESS ;
    SetM2Dump - sets the dump via a comma separated list: quad,decl,gimple,all.
 *)
 
-PROCEDURE SetM2Dump (value: BOOLEAN; filter: ADDRESS) ;
+PROCEDURE SetM2Dump (value: BOOLEAN; filter: ADDRESS) : BOOLEAN ;
 
 
 (*
index 6175d8d1cb27c308b6fd09b1487c255e686186a6..304c8dd6eabb1bf89d1fec9633e9414d66971ccc 100644 (file)
@@ -1012,7 +1012,7 @@ PROCEDURE BuildAssignConstant (equalsTokNo: CARDINAL) ;
                             |---------------|       empty
 *)
 
-PROCEDURE BuildAlignment ;
+PROCEDURE BuildAlignment (tokno: CARDINAL) ;
 
 
 (*
@@ -1030,7 +1030,7 @@ PROCEDURE BuildAlignment ;
                            |------------|          empty
 *)
 
-PROCEDURE BuildBitLength ;
+PROCEDURE BuildBitLength (tokno: CARDINAL) ;
 
 
 (*
index d5eddc7e98e6f82f8f18dd78291c45a049e52b5e..643309424a7d5ba5a4dbafa36fcd0ef114eee22f 100644 (file)
@@ -790,8 +790,10 @@ ConstAttributeExpression :=
                                                               ">"
                           =:
 
-ByteAlignment := '<*'                                                      % PushAutoOn %
-                      AttributeExpression                                  % BuildAlignment %
+ByteAlignment :=                                                           % VAR tokpos: CARDINAL ; %
+                 '<*'                                                      % PushAutoOn %
+                                                                           % tokpos := GetTokenNo () %
+                      AttributeExpression                                  % BuildAlignment (tokpos) %
                                           '*>'                             % PopAuto %
                =:
 
index b983cc8b8520f6cc99cd0196eec1d52f61eff9dd..46f46af73ffe37d6689cb405a10a162d44fc53c6 100644 (file)
@@ -704,7 +704,8 @@ ConstructorOrConstActualParameters := Constructor | ConstActualParameters  % Pus
 
 ConstSetOrQualidentOrFunction :=                                           % PushAutoOff %
                                                                            % VAR tokpos: CARDINAL ; %
-                                 (                                         % tokpos := GetTokenNo () %
+                                                                           % tokpos := GetTokenNo () %
+                                 (
                                    PushQualident
                                    ( ConstructorOrConstActualParameters |  % PushConstType %
                                                                            % PopNothing %
@@ -1008,8 +1009,8 @@ ConstructorOrSimpleDes := Constructor |                                    % Pop
 
 SetOrDesignatorOrFunction :=                                              % PushAutoOff %
                                                                           % VAR tokpos: CARDINAL ; %
-
-                             (                                            % tokpos := GetTokenNo () %
+                                                                          % tokpos := GetTokenNo () %
+                             (
                                PushQualident
                                ( ConstructorOrSimpleDes |                 % PopNothing %
                                                           )
index 52214894d0acda03512466df21fdd4f01d1ec9dc..776601d3b1c3b6b3cb7de12de86f221cedde323b 100644 (file)
@@ -664,7 +664,8 @@ Constructor :=                                                             % VAR
 
 ConstSetOrQualidentOrFunction :=                                           % PushAutoOn %
                                                                            % VAR tokpos: CARDINAL ; %
-                                 (                                         % tokpos := GetTokenNo () %
+                                                                           % tokpos := GetTokenNo () %
+                                 (
                                     Qualident
                                     [ Constructor |
                                        ConstActualParameters               % BuildConstFunctionCall %
@@ -678,8 +679,10 @@ ConstAttribute := "__ATTRIBUTE__" "__BUILTIN__" "(" "(" ConstAttributeExpression
 
 ConstAttributeExpression := Ident | "<" Qualident ',' Ident ">" =:
 
-ByteAlignment := '<*'                                                      % PushAutoOn %
-                      AttributeExpression                                  % BuildAlignment %
+ByteAlignment :=                                                           % VAR tokpos: CARDINAL ; %
+                 '<*'                                                      % PushAutoOn %
+                                                                           % tokpos := GetTokenNo () %
+                      AttributeExpression                                  % BuildAlignment (tokpos) %
                                           '*>'                             % PopAuto %
                =:
 
index 0d19bc3d5930a3adc69853e2ff8ec987e802dc0e..a8f6509526c8f14f45f5f269cc0a8d4d6b4951d0 100644 (file)
@@ -50,7 +50,7 @@ PROCEDURE strtod (s: ADDRESS; VAR error: BOOLEAN) : REAL ;
 *)
 
 PROCEDURE dtoa (d        : REAL;
-                mode     : Mode;
+                mode     : INTEGER;
                 ndigits  : INTEGER;
                VAR decpt: INTEGER;
                VAR sign : BOOLEAN) : ADDRESS ;
index 7e712f37b859714d6412690bf88a9c56842c7287..4a0f1dfacd22461700ac9d711237e233b751661e 100644 (file)
@@ -50,7 +50,7 @@ PROCEDURE strtold (s: ADDRESS; VAR error: BOOLEAN) : LONGREAL ;
 *)
 
 PROCEDURE ldtoa (d        : LONGREAL;
-                 mode     : Mode;
+                 mode     : INTEGER;
                  ndigits  : INTEGER;
                  VAR decpt: INTEGER;
                  VAR sign : BOOLEAN) : ADDRESS ;
index 0492483ee09877fdfd2db6f7157d3bddd5e3dfcb..46340a565582ca1bdd6a679b0b00658c331a08b4 100644 (file)
@@ -27,12 +27,12 @@ along with GNU Modula-2; see the file COPYING3.  If not see
 
 EXTERN
 void
-_M2_SYSTEM_init (int argc, char *p)
+_M2_SYSTEM_init (int argc, char *argv[], char *envp[])
 {
 }
 
 EXTERN
 void
-_M2_SYSTEM_fini (int argc, char *p)
+_M2_SYSTEM_fini (int argc, char *argv[], char *envp[])
 {
 }
index 94f4488c13f45505e78ff4ce35d51de91cfe828b..b608c6b79ddc28f778d139db4b87261c8f60e68e 100644 (file)
@@ -123,21 +123,21 @@ dtoa_calcdecimal (char *p, int str_size, int ndigits)
 }
 
 
-int
+bool
 dtoa_calcsign (char *p, int str_size)
 {
   if (p[0] == '-')
     {
       memmove (p, p + 1, str_size - 1);
-      return TRUE;
+      return true;
     }
   else
-    return FALSE;
+    return false;
 }
 
 
-char *
-dtoa_dtoa (double d, int mode, int ndigits, int *decpt, int *sign)
+void *
+dtoa_dtoa (double d, int mode, int ndigits, int *decpt, bool *sign)
 {
   char format[50];
   char *p;
@@ -169,12 +169,12 @@ dtoa_dtoa (double d, int mode, int ndigits, int *decpt, int *sign)
 /* GNU Modula-2 hooks */
 
 void
-_M2_dtoa_init (void)
+_M2_dtoa_init (int argc, char *argv[], char *envp[])
 {
 }
 
 void
-_M2_dtoa_fini (void)
+_M2_dtoa_fini (int argc, char *argv[], char *envp[])
 {
 }
 #endif
index 4b507288852c9e53ee140b5da86a953c9444999d..af46002ed7849cf5286cd3e1b79ce66c6cb8fd8d 100644 (file)
@@ -38,14 +38,14 @@ errno_geterrno (void)
 /* init constructor for the module.  */
 
 void
-_M2_errno_init (int argc, char *p)
+_M2_errno_init (int argc, char *argv[], char *envp[])
 {
 }
 
 /* finish deconstructor for the module.  */
 
 void
-_M2_errno_fini (int argc, char *p)
+_M2_errno_fini (int argc, char *argv[], char *envp[])
 {
 }
 
index 2a266cf21082fe987093f1cd0b4ce60d2ec2eedb..1e7acb7ad40f8d8627d72233238d564c0c412259 100644 (file)
@@ -34,7 +34,7 @@ typedef enum Mode { maxsignicant, decimaldigits } Mode;
 
 extern int dtoa_calcmaxsig (char *p, int ndigits);
 extern int dtoa_calcdecimal (char *p, int str_size, int ndigits);
-extern int dtoa_calcsign (char *p, int str_size);
+extern bool dtoa_calcsign (char *p, int str_size);
 
 /* maxsignicant: return a string containing max(1,ndigits)
    significant digits.  The return string contains the string
@@ -62,8 +62,8 @@ ldtoa_strtold (const char *s, int *error)
   return d;
 }
 
-char *
-ldtoa_ldtoa (long double d, int mode, int ndigits, int *decpt, int *sign)
+void *
+ldtoa_ldtoa (long double d, int mode, int ndigits, int *decpt, bool *sign)
 {
   char format[50];
   char *p;
@@ -94,12 +94,12 @@ ldtoa_ldtoa (long double d, int mode, int ndigits, int *decpt, int *sign)
 /* GNU Modula-2 hooks */
 
 void
-_M2_ldtoa_init (void)
+_M2_ldtoa_init (int argc, char *argv[], char *envp[])
 {
 }
 
 void
-_M2_ldtoa_fini (void)
+_M2_ldtoa_fini (int argc, char *argv[], char *envp[])
 {
 }
 #   ifdef __cplusplus
index 23a490571ff907b99239f5556455325728d3a799..e53a76a0f13c3751ff939eb8ec762b5423166031 100644 (file)
@@ -110,23 +110,35 @@ tracedb_result (int result)
 #endif
 }
 
+static
+void
+tracedb_zresult (size_t result)
+{
+#if defined(BUILD_MC_LIBC_TRACE)
+  tracedb (" result = %zd", result);
+  if (result == -1)
+    tracedb (", errno = %s", strerror (errno));
+  tracedb ("\n");
+#endif
+}
+
 EXTERN
-int
-libc_read (int fd, void *a, int nbytes)
+size_t
+libc_read (int fd, void *a, size_t nbytes)
 {
-  tracedb ("libc_read (%d, %p, %d)\n", fd, a, nbytes);
-  int result = read (fd, a, nbytes);
-  tracedb_result (result);
+  tracedb ("libc_read (%d, %p, %zd)\n", fd, a, nbytes);
+  size_t result = read (fd, a, nbytes);
+  tracedb_zresult (result);
   return result;
 }
 
 EXTERN
-int
-libc_write (int fd, void *a, int nbytes)
+size_t
+libc_write (int fd, void *a, size_t nbytes)
 {
-  tracedb ("libc_write (%d, %p, %d)\n", fd, a, nbytes);
-  int result = write (fd, a, nbytes);
-  tracedb_result (result);
+  tracedb ("libc_write (%d, %p, %zd)\n", fd, a, nbytes);
+  size_t result = write (fd, a, nbytes);
+  tracedb_zresult (result);
   return result;
 }
 
@@ -162,7 +174,7 @@ libc_abort ()
 }
 
 EXTERN
-int
+size_t
 libc_strlen (char *s)
 {
   return strlen (s);
@@ -184,14 +196,14 @@ libc_localtime (time_t *epochtime)
 
 EXTERN
 int
-libc_printf (char *_format, unsigned int _format_high, ...)
+libc_printf (const char *_format, unsigned int _format_high, ...)
 {
   va_list arg;
   int done;
   char format[_format_high + 1];
   unsigned int i = 0;
   unsigned int j = 0;
-  char *c;
+  const char *c;
 
   do
     {
@@ -221,14 +233,14 @@ libc_printf (char *_format, unsigned int _format_high, ...)
 
 EXTERN
 int
-libc_snprintf (char *dest, size_t length, char *_format, unsigned int _format_high, ...)
+libc_snprintf (char *dest, size_t length, const char *_format, unsigned int _format_high, ...)
 {
   va_list arg;
   int done;
   char format[_format_high + 1];
   unsigned int i = 0;
   unsigned int j = 0;
-  char *c;
+  const char *c;
 
   do
     {
@@ -258,7 +270,7 @@ libc_snprintf (char *dest, size_t length, char *_format, unsigned int _format_hi
 
 EXTERN
 void *
-libc_malloc (unsigned int size)
+libc_malloc (size_t size)
 {
   return malloc (size);
 }
@@ -300,7 +312,7 @@ libc_system (char *command)
 
 EXTERN
 void *
-libc_memcpy (void *dest, void *src, int n)
+libc_memcpy (void *dest, void *src, size_t n)
 {
   return memcpy (dest, src, n);
 }
index 83c586666701dba9ea6ccfcca5e123faede93e9f..a5c59fd3c4b827ac4853c6e327b4ba0e15926002 100644 (file)
@@ -34,9 +34,9 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
        typedef struct { PROC_t proc; } PROC;
 #   endif
 
-#define _ASCII_H
 #define _ASCII_C
 
+#include "GASCII.h"
 
 #   define ASCII_nul (char) 000
 #   define ASCII_soh (char) 001
@@ -78,10 +78,10 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #   define ASCII_del (char) 0177
 #   define ASCII_EOL ASCII_nl
 
-extern "C" void _M2_ASCII_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
+extern "C" void _M2_ASCII_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
 {
 }
 
-extern "C" void _M2_ASCII_fini (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
+extern "C" void _M2_ASCII_fini (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
 {
 }
index c6a2bcab65a214a255f82bd620341a3e514a9aaf..182def800ea0a2f5f6d1d126369a93df1ca2ef2d 100644 (file)
@@ -34,9 +34,9 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
        typedef struct { PROC_t proc; } PROC;
 #   endif
 
-#define _Args_H
 #define _Args_C
 
+#include "GArgs.h"
 #   include "GUnixArgs.h"
 #   include "GASCII.h"
 
@@ -86,13 +86,13 @@ extern "C" bool Args_GetArg (char *a, unsigned int _a_high, unsigned int n)
       Source = static_cast<Args__T1> (UnixArgs_GetArgV ());
       while ((j < High) && ((*(*Source).array[i]).array[j] != ASCII_nul))
         {
-          a[j] = (*(*Source).array[i]).array[j];
+          const_cast<char *>(a)[j] = (*(*Source).array[i]).array[j];
           j += 1;
         }
     }
   if (j <= High)
     {
-      a[j] = ASCII_nul;
+      const_cast<char *>(a)[j] = ASCII_nul;
     }
   return i < (UnixArgs_GetArgC ());
   /* static analysis guarentees a RETURN statement will be used before here.  */
@@ -112,10 +112,10 @@ extern "C" unsigned int Args_Narg (void)
   __builtin_unreachable ();
 }
 
-extern "C" void _M2_Args_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
+extern "C" void _M2_Args_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
 {
 }
 
-extern "C" void _M2_Args_fini (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
+extern "C" void _M2_Args_fini (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
 {
 }
index fdebf020b61373dfda9e512cd333046d61463cc0..b6b47952108b1cdf7aa505d6dcfafa210f7c1df6 100644 (file)
@@ -34,9 +34,9 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
        typedef struct { PROC_t proc; } PROC;
 #   endif
 
-#define _Assertion_H
 #define _Assertion_C
 
+#include "GAssertion.h"
 #   include "GStrIO.h"
 #   include "GM2RTS.h"
 
@@ -63,10 +63,10 @@ extern "C" void Assertion_Assert (bool Condition)
     }
 }
 
-extern "C" void _M2_Assertion_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
+extern "C" void _M2_Assertion_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
 {
 }
 
-extern "C" void _M2_Assertion_fini (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
+extern "C" void _M2_Assertion_fini (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
 {
 }
index 23104d66ba0797e947a9747e8298d65e21c78118..4fea839214bd2d68fce459b144b1e55ba1e4b718 100644 (file)
@@ -34,15 +34,15 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
        typedef struct { PROC_t proc; } PROC;
 #   endif
 
-#define _Break_H
 #define _Break_C
 
+#include "GBreak.h"
 
 
-extern "C" void _M2_Break_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
+extern "C" void _M2_Break_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
 {
 }
 
-extern "C" void _M2_Break_fini (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
+extern "C" void _M2_Break_fini (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
 {
 }
index 0b7d587e1eb1d80d2c538d85a0fdbedd93b20235..cb8fa8ace58730491d3f398fd864d679a0a9bccf 100644 (file)
@@ -34,9 +34,9 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
        typedef struct { PROC_t proc; } PROC;
 #   endif
 
-#define _CmdArgs_H
 #define _CmdArgs_C
 
+#include "GCmdArgs.h"
 #   include "GASCII.h"
 #   include "GStrLib.h"
 
@@ -149,7 +149,7 @@ static bool GetNextArg (const char *CmdLine_, unsigned int _CmdLine_high, unsign
     }
   if (ArgIndex < HighA)
     {
-      Arg[ArgIndex] = ASCII_nul;
+      const_cast<char *>(Arg)[ArgIndex] = ASCII_nul;
     }
   return (*CmdIndex) < HighC;
   /* static analysis guarentees a RETURN statement will be used before here.  */
@@ -216,7 +216,7 @@ static void CopyChar (const char *From_, unsigned int _From_high, unsigned int *
       if ((*FromIndex) < FromHigh)
         {
           /* Copy Normal Character  */
-          To[(*ToIndex)] = From[(*FromIndex)];
+          const_cast<char *>(To)[(*ToIndex)] = From[(*FromIndex)];
           (*ToIndex) += 1;
           (*FromIndex) += 1;
         }
@@ -314,10 +314,10 @@ extern "C" unsigned int CmdArgs_Narg (const char *CmdLine_, unsigned int _CmdLin
   __builtin_unreachable ();
 }
 
-extern "C" void _M2_CmdArgs_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
+extern "C" void _M2_CmdArgs_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
 {
 }
 
-extern "C" void _M2_CmdArgs_fini (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
+extern "C" void _M2_CmdArgs_fini (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
 {
 }
index c1daa670b885f97734a41bc87f3f9d4c4414f279..3f0ec51507e4322de94b33ac3ac424f4074641d5 100644 (file)
@@ -34,9 +34,9 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
        typedef struct { PROC_t proc; } PROC;
 #   endif
 
-#define _Debug_H
 #define _Debug_C
 
+#include "GDebug.h"
 #   include "GASCII.h"
 #   include "GNumberIO.h"
 #   include "GStdIO.h"
@@ -165,10 +165,10 @@ extern "C" void Debug_DebugString (const char *a_, unsigned int _a_high)
     }
 }
 
-extern "C" void _M2_Debug_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
+extern "C" void _M2_Debug_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
 {
 }
 
-extern "C" void _M2_Debug_fini (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
+extern "C" void _M2_Debug_fini (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
 {
 }
index a1cb88c03b76d3c18ce3cea216bbdc0222922c98..329696929851af25913a1cb3b22ee589c90699a7 100644 (file)
@@ -47,9 +47,9 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #   undef NULL
 #   define NULL 0
 #endif
-#define _DynamicStrings_H
 #define _DynamicStrings_C
 
+#include "GDynamicStrings.h"
 #   include "Glibc.h"
 #   include "GStrLib.h"
 #   include "GStorage.h"
@@ -81,27 +81,27 @@ typedef struct DynamicStrings__T3_a DynamicStrings__T3;
 
 typedef enum {DynamicStrings_inuse, DynamicStrings_marked, DynamicStrings_onlist, DynamicStrings_poisoned} DynamicStrings_desState;
 
-typedef DynamicStrings_stringRecord *DynamicStrings_String;
+typedef DynamicStrings_stringRecord *DynamicStrings_String__opaque;
 
 struct DynamicStrings_DebugInfo_r {
-                                    DynamicStrings_String next;
-                                    void *file;
+                                    DynamicStrings_String__opaque next;
+                                    void * file;
                                     unsigned int line;
-                                    void *proc;
+                                    void * proc;
                                   };
 
 struct DynamicStrings_descriptor_r {
                                      bool charStarUsed;
-                                     void *charStar;
+                                     void * charStar;
                                      unsigned int charStarSize;
                                      bool charStarValid;
                                      DynamicStrings_desState state;
-                                     DynamicStrings_String garbage;
+                                     DynamicStrings_String__opaque garbage;
                                    };
 
 struct DynamicStrings_frameRec_r {
-                                   DynamicStrings_String alloc;
-                                   DynamicStrings_String dealloc;
+                                   DynamicStrings_String__opaque alloc;
+                                   DynamicStrings_String__opaque dealloc;
                                    DynamicStrings_frame next;
                                  };
 
@@ -109,7 +109,7 @@ struct DynamicStrings__T3_a { char array[(MaxBuf-1)+1]; };
 struct DynamicStrings_Contents_r {
                                    DynamicStrings__T3 buf;
                                    unsigned int len;
-                                   DynamicStrings_String next;
+                                   DynamicStrings_String__opaque next;
                                  };
 
 struct DynamicStrings_stringRecord_r {
@@ -120,7 +120,7 @@ struct DynamicStrings_stringRecord_r {
 
 static bool Initialized;
 static DynamicStrings_frame frameHead;
-static DynamicStrings_String captured;
+static DynamicStrings_String__opaque captured;
 
 /*
    InitString - creates and returns a String type object.
@@ -400,7 +400,7 @@ extern "C" DynamicStrings_String DynamicStrings_PopAllocationExemption (bool hal
 /*
  writeStringDesc write out debugging information about string, s.  */
 
-static void writeStringDesc (DynamicStrings_String s);
+static void writeStringDesc (DynamicStrings_String__opaque s);
 
 /*
    writeNspace -
@@ -412,7 +412,7 @@ static void writeNspace (unsigned int n);
    DumpStringInfo -
 */
 
-static void DumpStringInfo (DynamicStrings_String s, unsigned int i);
+static void DumpStringInfo (DynamicStrings_String__opaque s, unsigned int i);
 
 /*
    DumpStringInfo -
@@ -430,7 +430,7 @@ static void doDSdbEnter (void);
    doDSdbExit -
 */
 
-static void doDSdbExit (DynamicStrings_String s);
+static void doDSdbExit (DynamicStrings_String__opaque s);
 
 /*
    DSdbEnter -
@@ -442,8 +442,8 @@ static void DSdbEnter (void);
    DSdbExit -
 */
 
-static void DSdbExit (DynamicStrings_String s);
-static unsigned int Capture (DynamicStrings_String s);
+static void DSdbExit (DynamicStrings_String__opaque s);
+static unsigned int Capture (DynamicStrings_String__opaque s);
 
 /*
    Min -
@@ -497,73 +497,73 @@ static void writeLn (void);
    AssignDebug - assigns, file, and, line, information to string, s.
 */
 
-static DynamicStrings_String AssignDebug (DynamicStrings_String s, const char *file_, unsigned int _file_high, unsigned int line, const char *proc_, unsigned int _proc_high);
+static DynamicStrings_String__opaque AssignDebug (DynamicStrings_String__opaque s, const char *file_, unsigned int _file_high, unsigned int line, const char *proc_, unsigned int _proc_high);
 
 /*
    IsOn - returns TRUE if, s, is on one of the debug lists.
 */
 
-static bool IsOn (DynamicStrings_String list, DynamicStrings_String s);
+static bool IsOn (DynamicStrings_String__opaque list, DynamicStrings_String__opaque s);
 
 /*
    AddTo - adds string, s, to, list.
 */
 
-static void AddTo (DynamicStrings_String *list, DynamicStrings_String s);
+static void AddTo (DynamicStrings_String__opaque *list, DynamicStrings_String__opaque s);
 
 /*
    SubFrom - removes string, s, from, list.
 */
 
-static void SubFrom (DynamicStrings_String *list, DynamicStrings_String s);
+static void SubFrom (DynamicStrings_String__opaque *list, DynamicStrings_String__opaque s);
 
 /*
    AddAllocated - adds string, s, to the head of the allocated list.
 */
 
-static void AddAllocated (DynamicStrings_String s);
+static void AddAllocated (DynamicStrings_String__opaque s);
 
 /*
    AddDeallocated - adds string, s, to the head of the deallocated list.
 */
 
-static void AddDeallocated (DynamicStrings_String s);
+static void AddDeallocated (DynamicStrings_String__opaque s);
 
 /*
    IsOnAllocated - returns TRUE if the string, s, has ever been allocated.
 */
 
-static bool IsOnAllocated (DynamicStrings_String s);
+static bool IsOnAllocated (DynamicStrings_String__opaque s);
 
 /*
    IsOnDeallocated - returns TRUE if the string, s, has ever been deallocated.
 */
 
-static bool IsOnDeallocated (DynamicStrings_String s);
+static bool IsOnDeallocated (DynamicStrings_String__opaque s);
 
 /*
    SubAllocated - removes string, s, from the list of allocated strings.
 */
 
-static void SubAllocated (DynamicStrings_String s);
+static void SubAllocated (DynamicStrings_String__opaque s);
 
 /*
    SubDeallocated - removes string, s, from the list of deallocated strings.
 */
 
-static void SubDeallocated (DynamicStrings_String s);
+static void SubDeallocated (DynamicStrings_String__opaque s);
 
 /*
    SubDebugInfo - removes string, s, from the list of allocated strings.
 */
 
-static void SubDebugInfo (DynamicStrings_String s);
+static void SubDebugInfo (DynamicStrings_String__opaque s);
 
 /*
    AddDebugInfo - adds string, s, to the list of allocated strings.
 */
 
-static void AddDebugInfo (DynamicStrings_String s);
+static void AddDebugInfo (DynamicStrings_String__opaque s);
 
 /*
    ConcatContents - add the contents of string, a, where, h, is the
@@ -576,19 +576,19 @@ static void ConcatContents (DynamicStrings_Contents *c, const char *a_, unsigned
    DeallocateCharStar - deallocates any charStar.
 */
 
-static void DeallocateCharStar (DynamicStrings_String s);
+static void DeallocateCharStar (DynamicStrings_String__opaque s);
 
 /*
    CheckPoisoned - checks for a poisoned string, s.
 */
 
-static DynamicStrings_String CheckPoisoned (DynamicStrings_String s);
+static DynamicStrings_String__opaque CheckPoisoned (DynamicStrings_String__opaque s);
 
 /*
    MarkInvalid - marks the char * version of String, s, as invalid.
 */
 
-static void MarkInvalid (DynamicStrings_String s);
+static void MarkInvalid (DynamicStrings_String__opaque s);
 
 /*
    ConcatContentsAddress - concatenate the string, a, where, h, is the
@@ -603,13 +603,13 @@ static void ConcatContentsAddress (DynamicStrings_Contents *c, void * a, unsigne
                   onlist.  String, a, is returned.
 */
 
-static DynamicStrings_String AddToGarbage (DynamicStrings_String a, DynamicStrings_String b);
+static DynamicStrings_String__opaque AddToGarbage (DynamicStrings_String__opaque a, DynamicStrings_String__opaque b);
 
 /*
    IsOnGarbage - returns TRUE if, s, is on string, e, garbage list.
 */
 
-static bool IsOnGarbage (DynamicStrings_String e, DynamicStrings_String s);
+static bool IsOnGarbage (DynamicStrings_String__opaque e, DynamicStrings_String__opaque s);
 
 /*
    IsWhite - returns TRUE if, ch, is a space or a tab.
@@ -621,19 +621,19 @@ static bool IsWhite (char ch);
    DumpState -
 */
 
-static void DumpState (DynamicStrings_String s);
+static void DumpState (DynamicStrings_String__opaque s);
 
 /*
    DumpStringSynopsis -
 */
 
-static void DumpStringSynopsis (DynamicStrings_String s);
+static void DumpStringSynopsis (DynamicStrings_String__opaque s);
 
 /*
    DumpString - displays the contents of string, s.
 */
 
-static void DumpString (DynamicStrings_String s);
+static void DumpString (DynamicStrings_String__opaque s);
 
 /*
    Init - initialize the module.
@@ -645,7 +645,7 @@ static void Init (void);
 /*
  writeStringDesc write out debugging information about string, s.  */
 
-static void writeStringDesc (DynamicStrings_String s)
+static void writeStringDesc (DynamicStrings_String__opaque s)
 {
   writeCstring (s->debug.file);
   writeString ((const char *) ":", 1);
@@ -701,7 +701,7 @@ static void writeNspace (unsigned int n)
    DumpStringInfo -
 */
 
-static void DumpStringInfo (DynamicStrings_String s, unsigned int i)
+static void DumpStringInfo (DynamicStrings_String__opaque s, unsigned int i)
 {
   if (s != NULL)
     {
@@ -749,11 +749,11 @@ static void doDSdbEnter (void)
    doDSdbExit -
 */
 
-static void doDSdbExit (DynamicStrings_String s)
+static void doDSdbExit (DynamicStrings_String__opaque s)
 {
   if (CheckOn)
     {
-      s = DynamicStrings_PopAllocationExemption (true, s);
+      s = static_cast<DynamicStrings_String__opaque> (DynamicStrings_PopAllocationExemption (true, static_cast<DynamicStrings_String> (s)));
     }
 }
 
@@ -771,11 +771,11 @@ static void DSdbEnter (void)
    DSdbExit -
 */
 
-static void DSdbExit (DynamicStrings_String s)
+static void DSdbExit (DynamicStrings_String__opaque s)
 {
 }
 
-static unsigned int Capture (DynamicStrings_String s)
+static unsigned int Capture (DynamicStrings_String__opaque s)
 {
   /* 
  *   #undef GM2_DEBUG_DYNAMICSTINGS
@@ -843,7 +843,7 @@ static void writeString (const char *a_, unsigned int _a_high)
   /* make a local copy of each unbounded array.  */
   memcpy (a, a_, _a_high+1);
 
-  i = static_cast<int> (libc_write (1, &a, static_cast<size_t> (StrLib_StrLen ((const char *) a, _a_high))));
+  i = static_cast<int> (libc_write (1, const_cast<void*> (static_cast<const void*>(a)), static_cast<size_t> (StrLib_StrLen ((const char *) a, _a_high))));
 }
 
 
@@ -951,7 +951,7 @@ static void writeLn (void)
    AssignDebug - assigns, file, and, line, information to string, s.
 */
 
-static DynamicStrings_String AssignDebug (DynamicStrings_String s, const char *file_, unsigned int _file_high, unsigned int line, const char *proc_, unsigned int _proc_high)
+static DynamicStrings_String__opaque AssignDebug (DynamicStrings_String__opaque s, const char *file_, unsigned int _file_high, unsigned int line, const char *proc_, unsigned int _proc_high)
 {
   void * f;
   void * p;
@@ -962,8 +962,8 @@ static DynamicStrings_String AssignDebug (DynamicStrings_String s, const char *f
   memcpy (file, file_, _file_high+1);
   memcpy (proc, proc_, _proc_high+1);
 
-  f = &file;
-  p = &proc;
+  f = const_cast<void*> (static_cast<const void*>(file));
+  p = const_cast<void*> (static_cast<const void*>(proc));
   Storage_ALLOCATE (&s->debug.file, (StrLib_StrLen ((const char *) file, _file_high))+1);
   if ((libc_strncpy (s->debug.file, f, (StrLib_StrLen ((const char *) file, _file_high))+1)) == NULL)
     {}  /* empty.  */
@@ -981,7 +981,7 @@ static DynamicStrings_String AssignDebug (DynamicStrings_String s, const char *f
    IsOn - returns TRUE if, s, is on one of the debug lists.
 */
 
-static bool IsOn (DynamicStrings_String list, DynamicStrings_String s)
+static bool IsOn (DynamicStrings_String__opaque list, DynamicStrings_String__opaque s)
 {
   while ((list != s) && (list != NULL))
     {
@@ -997,12 +997,12 @@ static bool IsOn (DynamicStrings_String list, DynamicStrings_String s)
    AddTo - adds string, s, to, list.
 */
 
-static void AddTo (DynamicStrings_String *list, DynamicStrings_String s)
+static void AddTo (DynamicStrings_String__opaque *list, DynamicStrings_String__opaque s)
 {
   if ((*list) == NULL)
     {
       (*list) = s;
-      s->debug.next = NULL;
+      s->debug.next = static_cast<DynamicStrings_String__opaque> (NULL);
     }
   else
     {
@@ -1016,9 +1016,9 @@ static void AddTo (DynamicStrings_String *list, DynamicStrings_String s)
    SubFrom - removes string, s, from, list.
 */
 
-static void SubFrom (DynamicStrings_String *list, DynamicStrings_String s)
+static void SubFrom (DynamicStrings_String__opaque *list, DynamicStrings_String__opaque s)
 {
-  DynamicStrings_String p;
+  DynamicStrings_String__opaque p;
 
   if ((*list) == s)
     {
@@ -1038,10 +1038,10 @@ static void SubFrom (DynamicStrings_String *list, DynamicStrings_String s)
       else
         {
           /* not found, quit  */
-          return ;
+          return;
         }
     }
-  s->debug.next = NULL;
+  s->debug.next = static_cast<DynamicStrings_String__opaque> (NULL);
 }
 
 
@@ -1049,7 +1049,7 @@ static void SubFrom (DynamicStrings_String *list, DynamicStrings_String s)
    AddAllocated - adds string, s, to the head of the allocated list.
 */
 
-static void AddAllocated (DynamicStrings_String s)
+static void AddAllocated (DynamicStrings_String__opaque s)
 {
   Init ();
   AddTo (&frameHead->alloc, s);
@@ -1060,7 +1060,7 @@ static void AddAllocated (DynamicStrings_String s)
    AddDeallocated - adds string, s, to the head of the deallocated list.
 */
 
-static void AddDeallocated (DynamicStrings_String s)
+static void AddDeallocated (DynamicStrings_String__opaque s)
 {
   Init ();
   AddTo (&frameHead->dealloc, s);
@@ -1071,7 +1071,7 @@ static void AddDeallocated (DynamicStrings_String s)
    IsOnAllocated - returns TRUE if the string, s, has ever been allocated.
 */
 
-static bool IsOnAllocated (DynamicStrings_String s)
+static bool IsOnAllocated (DynamicStrings_String__opaque s)
 {
   DynamicStrings_frame f;
 
@@ -1097,7 +1097,7 @@ static bool IsOnAllocated (DynamicStrings_String s)
    IsOnDeallocated - returns TRUE if the string, s, has ever been deallocated.
 */
 
-static bool IsOnDeallocated (DynamicStrings_String s)
+static bool IsOnDeallocated (DynamicStrings_String__opaque s)
 {
   DynamicStrings_frame f;
 
@@ -1123,7 +1123,7 @@ static bool IsOnDeallocated (DynamicStrings_String s)
    SubAllocated - removes string, s, from the list of allocated strings.
 */
 
-static void SubAllocated (DynamicStrings_String s)
+static void SubAllocated (DynamicStrings_String__opaque s)
 {
   DynamicStrings_frame f;
 
@@ -1133,7 +1133,7 @@ static void SubAllocated (DynamicStrings_String s)
     if (IsOn (f->alloc, s))
       {
         SubFrom (&f->alloc, s);
-        return ;
+        return;
       }
     else
       {
@@ -1147,7 +1147,7 @@ static void SubAllocated (DynamicStrings_String s)
    SubDeallocated - removes string, s, from the list of deallocated strings.
 */
 
-static void SubDeallocated (DynamicStrings_String s)
+static void SubDeallocated (DynamicStrings_String__opaque s)
 {
   DynamicStrings_frame f;
 
@@ -1157,7 +1157,7 @@ static void SubDeallocated (DynamicStrings_String s)
     if (IsOn (f->dealloc, s))
       {
         SubFrom (&f->dealloc, s);
-        return ;
+        return;
       }
     else
       {
@@ -1171,13 +1171,13 @@ static void SubDeallocated (DynamicStrings_String s)
    SubDebugInfo - removes string, s, from the list of allocated strings.
 */
 
-static void SubDebugInfo (DynamicStrings_String s)
+static void SubDebugInfo (DynamicStrings_String__opaque s)
 {
   if (IsOnDeallocated (s))
     {
       Assertion_Assert (! DebugOn);
       /* string has already been deallocated  */
-      return ;
+      return;
     }
   if (IsOnAllocated (s))
     {
@@ -1196,9 +1196,9 @@ static void SubDebugInfo (DynamicStrings_String s)
    AddDebugInfo - adds string, s, to the list of allocated strings.
 */
 
-static void AddDebugInfo (DynamicStrings_String s)
+static void AddDebugInfo (DynamicStrings_String__opaque s)
 {
-  s->debug.next = NULL;
+  s->debug.next = static_cast<DynamicStrings_String__opaque> (NULL);
   s->debug.file = NULL;
   s->debug.line = 0;
   s->debug.proc = NULL;
@@ -1235,7 +1235,7 @@ static void ConcatContents (DynamicStrings_Contents *c, const char *a_, unsigned
       Storage_ALLOCATE ((void **) &(*c).next, sizeof (DynamicStrings_stringRecord));
       (*c).next->head = NULL;
       (*c).next->contents.len = 0;
-      (*c).next->contents.next = NULL;
+      (*c).next->contents.next = static_cast<DynamicStrings_String__opaque> (NULL);
       ConcatContents (&(*c).next->contents, (const char *) a, _a_high, h, o);
       AddDebugInfo ((*c).next);
       (*c).next = AssignDebug ((*c).next, (const char *) "../../gcc/m2/gm2-libs/DynamicStrings.mod", 40, 722, (const char *) "ConcatContents", 14);
@@ -1251,7 +1251,7 @@ static void ConcatContents (DynamicStrings_Contents *c, const char *a_, unsigned
    DeallocateCharStar - deallocates any charStar.
 */
 
-static void DeallocateCharStar (DynamicStrings_String s)
+static void DeallocateCharStar (DynamicStrings_String__opaque s)
 {
   if ((s != NULL) && (s->head != NULL))
     {
@@ -1271,7 +1271,7 @@ static void DeallocateCharStar (DynamicStrings_String s)
    CheckPoisoned - checks for a poisoned string, s.
 */
 
-static DynamicStrings_String CheckPoisoned (DynamicStrings_String s)
+static DynamicStrings_String__opaque CheckPoisoned (DynamicStrings_String__opaque s)
 {
   if (((PoisonOn && (s != NULL)) && (s->head != NULL)) && (s->head->state == DynamicStrings_poisoned))
     {
@@ -1288,7 +1288,7 @@ static DynamicStrings_String CheckPoisoned (DynamicStrings_String s)
    MarkInvalid - marks the char * version of String, s, as invalid.
 */
 
-static void MarkInvalid (DynamicStrings_String s)
+static void MarkInvalid (DynamicStrings_String__opaque s)
 {
   if (PoisonOn)
     {
@@ -1331,7 +1331,7 @@ static void ConcatContentsAddress (DynamicStrings_Contents *c, void * a, unsigne
       Storage_ALLOCATE ((void **) &(*c).next, sizeof (DynamicStrings_stringRecord));
       (*c).next->head = NULL;
       (*c).next->contents.len = 0;
-      (*c).next->contents.next = NULL;
+      (*c).next->contents.next = static_cast<DynamicStrings_String__opaque> (NULL);
       ConcatContentsAddress (&(*c).next->contents, reinterpret_cast<void *> (p), h-j);
       AddDebugInfo ((*c).next);
       if (TraceOn)
@@ -1342,7 +1342,7 @@ static void ConcatContentsAddress (DynamicStrings_Contents *c, void * a, unsigne
   else
     {
       (*c).len = i;
-      (*c).next = NULL;
+      (*c).next = static_cast<DynamicStrings_String__opaque> (NULL);
     }
 }
 
@@ -1353,9 +1353,9 @@ static void ConcatContentsAddress (DynamicStrings_Contents *c, void * a, unsigne
                   onlist.  String, a, is returned.
 */
 
-static DynamicStrings_String AddToGarbage (DynamicStrings_String a, DynamicStrings_String b)
+static DynamicStrings_String__opaque AddToGarbage (DynamicStrings_String__opaque a, DynamicStrings_String__opaque b)
 {
-  DynamicStrings_String c;
+  DynamicStrings_String__opaque c;
 
   if (PoisonOn)
     {
@@ -1392,7 +1392,7 @@ static DynamicStrings_String AddToGarbage (DynamicStrings_String a, DynamicStrin
    IsOnGarbage - returns TRUE if, s, is on string, e, garbage list.
 */
 
-static bool IsOnGarbage (DynamicStrings_String e, DynamicStrings_String s)
+static bool IsOnGarbage (DynamicStrings_String__opaque e, DynamicStrings_String__opaque s)
 {
   if ((e != NULL) && (s != NULL))
     {
@@ -1430,7 +1430,7 @@ static bool IsWhite (char ch)
    DumpState -
 */
 
-static void DumpState (DynamicStrings_String s)
+static void DumpState (DynamicStrings_String__opaque s)
 {
   switch (s->head->state)
     {
@@ -1464,7 +1464,7 @@ static void DumpState (DynamicStrings_String s)
    DumpStringSynopsis -
 */
 
-static void DumpStringSynopsis (DynamicStrings_String s)
+static void DumpStringSynopsis (DynamicStrings_String__opaque s)
 {
   writeCstring (s->debug.file);
   writeString ((const char *) ":", 1);
@@ -1497,9 +1497,9 @@ static void DumpStringSynopsis (DynamicStrings_String s)
    DumpString - displays the contents of string, s.
 */
 
-static void DumpString (DynamicStrings_String s)
+static void DumpString (DynamicStrings_String__opaque s)
 {
-  DynamicStrings_String t;
+  DynamicStrings_String__opaque t;
 
   if (s != NULL)
     {
@@ -1541,7 +1541,7 @@ static void Init (void)
 
 extern "C" DynamicStrings_String DynamicStrings_InitString (const char *a_, unsigned int _a_high)
 {
-  DynamicStrings_String s;
+  DynamicStrings_String__opaque s;
   char a[_a_high+1];
 
   /* make a local copy of each unbounded array.  */
@@ -1549,21 +1549,21 @@ extern "C" DynamicStrings_String DynamicStrings_InitString (const char *a_, unsi
 
   Storage_ALLOCATE ((void **) &s, sizeof (DynamicStrings_stringRecord));
   s->contents.len = 0;
-  s->contents.next = NULL;
+  s->contents.next = static_cast<DynamicStrings_String__opaque> (NULL);
   ConcatContents (&s->contents, (const char *) a, _a_high, StrLib_StrLen ((const char *) a, _a_high), 0);
   Storage_ALLOCATE ((void **) &s->head, sizeof (DynamicStrings_descriptor));
   s->head->charStarUsed = false;
   s->head->charStar = NULL;
   s->head->charStarSize = 0;
   s->head->charStarValid = false;
-  s->head->garbage = NULL;
+  s->head->garbage = static_cast<DynamicStrings_String__opaque> (NULL);
   s->head->state = DynamicStrings_inuse;
   AddDebugInfo (s);
   if (TraceOn)
     {
       s = AssignDebug (s, (const char *) "../../gcc/m2/gm2-libs/DynamicStrings.mod", 40, 758, (const char *) "InitString", 10);
     }
-  return s;
+  return static_cast<DynamicStrings_String> (s);
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -1576,48 +1576,48 @@ extern "C" DynamicStrings_String DynamicStrings_InitString (const char *a_, unsi
 
 extern "C" DynamicStrings_String DynamicStrings_KillString (DynamicStrings_String s)
 {
-  DynamicStrings_String t;
+  DynamicStrings_String__opaque t;
 
   if (PoisonOn)
     {
-      s = CheckPoisoned (s);
+      s = static_cast<DynamicStrings_String> (CheckPoisoned (static_cast<DynamicStrings_String__opaque> (s)));
     }
   if (s != NULL)
     {
       if (CheckOn)
         {
           /* avoid gcc warning by using compound statement even if not strictly necessary.  */
-          if (IsOnAllocated (s))
+          if (IsOnAllocated (static_cast<DynamicStrings_String__opaque> (s)))
             {
-              SubAllocated (s);
+              SubAllocated (static_cast<DynamicStrings_String__opaque> (s));
             }
-          else if (IsOnDeallocated (s))
+          else if (IsOnDeallocated (static_cast<DynamicStrings_String__opaque> (s)))
             {
               /* avoid dangling else.  */
-              SubDeallocated (s);
+              SubDeallocated (static_cast<DynamicStrings_String__opaque> (s));
             }
         }
-      if (s->head != NULL)
+      if (static_cast<DynamicStrings_String__opaque> (s)->head != NULL)
         {
-          s->head->state = DynamicStrings_poisoned;
-          s->head->garbage = DynamicStrings_KillString (s->head->garbage);
+          static_cast<DynamicStrings_String__opaque> (s)->head->state = DynamicStrings_poisoned;
+          static_cast<DynamicStrings_String__opaque> (s)->head->garbage = static_cast<DynamicStrings_String__opaque> (DynamicStrings_KillString (static_cast<DynamicStrings_String> (static_cast<DynamicStrings_String__opaque> (s)->head->garbage)));
           if (! PoisonOn)
             {
-              DeallocateCharStar (s);
+              DeallocateCharStar (static_cast<DynamicStrings_String__opaque> (s));
             }
           if (! PoisonOn)
             {
-              Storage_DEALLOCATE ((void **) &s->head, sizeof (DynamicStrings_descriptor));
-              s->head = NULL;
+              Storage_DEALLOCATE ((void **) &static_cast<DynamicStrings_String__opaque> (s)->head, sizeof (DynamicStrings_descriptor));
+              static_cast<DynamicStrings_String__opaque> (s)->head = NULL;
             }
         }
-      t = DynamicStrings_KillString (s->contents.next);
+      t = static_cast<DynamicStrings_String__opaque> (DynamicStrings_KillString (static_cast<DynamicStrings_String> (static_cast<DynamicStrings_String__opaque> (s)->contents.next)));
       if (! PoisonOn)
         {
           Storage_DEALLOCATE ((void **) &s, sizeof (DynamicStrings_stringRecord));
         }
     }
-  return NULL;
+  return static_cast<DynamicStrings_String> (NULL);
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -1645,11 +1645,11 @@ extern "C" void DynamicStrings_Fin (DynamicStrings_String s)
 
 extern "C" DynamicStrings_String DynamicStrings_InitStringCharStar (void * a)
 {
-  DynamicStrings_String s;
+  DynamicStrings_String__opaque s;
 
   Storage_ALLOCATE ((void **) &s, sizeof (DynamicStrings_stringRecord));
   s->contents.len = 0;
-  s->contents.next = NULL;
+  s->contents.next = static_cast<DynamicStrings_String__opaque> (NULL);
   if (a != NULL)
     {
       ConcatContentsAddress (&s->contents, a, static_cast<unsigned int> (libc_strlen (a)));
@@ -1659,14 +1659,14 @@ extern "C" DynamicStrings_String DynamicStrings_InitStringCharStar (void * a)
   s->head->charStar = NULL;
   s->head->charStarSize = 0;
   s->head->charStarValid = false;
-  s->head->garbage = NULL;
+  s->head->garbage = static_cast<DynamicStrings_String__opaque> (NULL);
   s->head->state = DynamicStrings_inuse;
   AddDebugInfo (s);
   if (TraceOn)
     {
       s = AssignDebug (s, (const char *) "../../gcc/m2/gm2-libs/DynamicStrings.mod", 40, 957, (const char *) "InitStringCharStar", 18);
     }
-  return s;
+  return static_cast<DynamicStrings_String> (s);
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -1682,16 +1682,16 @@ extern "C" DynamicStrings_String DynamicStrings_InitStringChar (char ch)
 
   struct InitStringChar__T5_a { char array[1+1]; };
   InitStringChar__T5 a;
-  DynamicStrings_String s;
+  DynamicStrings_String__opaque s;
 
   a.array[0] = ch;
   a.array[1] = ASCII_nul;
-  s = DynamicStrings_InitString ((const char *) &a.array[0], 1);
+  s = static_cast<DynamicStrings_String__opaque> (DynamicStrings_InitString ((const char *) &a.array[0], 1));
   if (TraceOn)
     {
       s = AssignDebug (s, (const char *) "../../gcc/m2/gm2-libs/DynamicStrings.mod", 40, 977, (const char *) "InitStringChar", 14);
     }
-  return s;
+  return static_cast<DynamicStrings_String> (s);
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -1705,11 +1705,11 @@ extern "C" DynamicStrings_String DynamicStrings_Mark (DynamicStrings_String s)
 {
   if (PoisonOn)
     {
-      s = CheckPoisoned (s);
+      s = static_cast<DynamicStrings_String> (CheckPoisoned (static_cast<DynamicStrings_String__opaque> (s)));
     }
-  if ((s != NULL) && (s->head->state == DynamicStrings_inuse))
+  if ((s != NULL) && (static_cast<DynamicStrings_String__opaque> (s)->head->state == DynamicStrings_inuse))
     {
-      s->head->state = DynamicStrings_marked;
+      static_cast<DynamicStrings_String__opaque> (s)->head->state = DynamicStrings_marked;
     }
   return s;
   /* static analysis guarentees a RETURN statement will be used before here.  */
@@ -1729,7 +1729,7 @@ extern "C" unsigned int DynamicStrings_Length (DynamicStrings_String s)
     }
   else
     {
-      return s->contents.len+(DynamicStrings_Length (s->contents.next));
+      return static_cast<DynamicStrings_String__opaque> (s)->contents.len+(DynamicStrings_Length (static_cast<DynamicStrings_String> (static_cast<DynamicStrings_String__opaque> (s)->contents.next)));
     }
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
@@ -1742,12 +1742,12 @@ extern "C" unsigned int DynamicStrings_Length (DynamicStrings_String s)
 
 extern "C" DynamicStrings_String DynamicStrings_ConCat (DynamicStrings_String a, DynamicStrings_String b)
 {
-  DynamicStrings_String t;
+  DynamicStrings_String__opaque t;
 
   if (PoisonOn)
     {
-      a = CheckPoisoned (a);
-      b = CheckPoisoned (b);
+      a = static_cast<DynamicStrings_String> (CheckPoisoned (static_cast<DynamicStrings_String__opaque> (a)));
+      b = static_cast<DynamicStrings_String> (CheckPoisoned (static_cast<DynamicStrings_String__opaque> (b)));
     }
   if (a == b)
     {
@@ -1756,17 +1756,17 @@ extern "C" DynamicStrings_String DynamicStrings_ConCat (DynamicStrings_String a,
   else if (a != NULL)
     {
       /* avoid dangling else.  */
-      a = AddToGarbage (a, b);
-      MarkInvalid (a);
-      t = a;
+      a = static_cast<DynamicStrings_String> (AddToGarbage (static_cast<DynamicStrings_String__opaque> (a), static_cast<DynamicStrings_String__opaque> (b)));
+      MarkInvalid (static_cast<DynamicStrings_String__opaque> (a));
+      t = static_cast<DynamicStrings_String__opaque> (a);
       while (b != NULL)
         {
           while ((t->contents.len == MaxBuf) && (t->contents.next != NULL))
             {
               t = t->contents.next;
             }
-          ConcatContents (&t->contents, (const char *) &b->contents.buf.array[0], (MaxBuf-1), b->contents.len, 0);
-          b = b->contents.next;
+          ConcatContents (&t->contents, (const char *) &static_cast<DynamicStrings_String__opaque> (b)->contents.buf.array[0], (MaxBuf-1), static_cast<DynamicStrings_String__opaque> (b)->contents.len, 0);
+          b = static_cast<DynamicStrings_String> (static_cast<DynamicStrings_String__opaque> (b)->contents.next);
         }
     }
   if ((a == NULL) && (b != NULL))
@@ -1790,16 +1790,16 @@ extern "C" DynamicStrings_String DynamicStrings_ConCatChar (DynamicStrings_Strin
 
   struct ConCatChar__T6_a { char array[1+1]; };
   ConCatChar__T6 b;
-  DynamicStrings_String t;
+  DynamicStrings_String__opaque t;
 
   if (PoisonOn)
     {
-      a = CheckPoisoned (a);
+      a = static_cast<DynamicStrings_String> (CheckPoisoned (static_cast<DynamicStrings_String__opaque> (a)));
     }
   b.array[0] = ch;
   b.array[1] = ASCII_nul;
-  t = a;
-  MarkInvalid (a);
+  t = static_cast<DynamicStrings_String__opaque> (a);
+  MarkInvalid (static_cast<DynamicStrings_String__opaque> (a));
   while ((t->contents.len == MaxBuf) && (t->contents.next != NULL))
     {
       t = t->contents.next;
@@ -1820,13 +1820,13 @@ extern "C" DynamicStrings_String DynamicStrings_Assign (DynamicStrings_String a,
 {
   if (PoisonOn)
     {
-      a = CheckPoisoned (a);
-      b = CheckPoisoned (b);
+      a = static_cast<DynamicStrings_String> (CheckPoisoned (static_cast<DynamicStrings_String__opaque> (a)));
+      b = static_cast<DynamicStrings_String> (CheckPoisoned (static_cast<DynamicStrings_String__opaque> (b)));
     }
   if ((a != NULL) && (b != NULL))
     {
-      a->contents.next = DynamicStrings_KillString (a->contents.next);
-      a->contents.len = 0;
+      static_cast<DynamicStrings_String__opaque> (a)->contents.next = static_cast<DynamicStrings_String__opaque> (DynamicStrings_KillString (static_cast<DynamicStrings_String> (static_cast<DynamicStrings_String__opaque> (a)->contents.next)));
+      static_cast<DynamicStrings_String__opaque> (a)->contents.len = 0;
     }
   return DynamicStrings_ConCat (a, b);
   /* static analysis guarentees a RETURN statement will be used before here.  */
@@ -1840,10 +1840,10 @@ extern "C" DynamicStrings_String DynamicStrings_Assign (DynamicStrings_String a,
 
 extern "C" DynamicStrings_String DynamicStrings_ReplaceChar (DynamicStrings_String s, char from, char to)
 {
-  DynamicStrings_String t;
+  DynamicStrings_String__opaque t;
   unsigned int i;
 
-  t = s;
+  t = static_cast<DynamicStrings_String__opaque> (s);
   while (t != NULL)
     {
       i = 0;
@@ -1871,12 +1871,12 @@ extern "C" DynamicStrings_String DynamicStrings_Dup (DynamicStrings_String s)
 {
   if (PoisonOn)
     {
-      s = CheckPoisoned (s);
+      s = static_cast<DynamicStrings_String> (CheckPoisoned (static_cast<DynamicStrings_String__opaque> (s)));
     }
   s = DynamicStrings_Assign (DynamicStrings_InitString ((const char *) "", 0), s);
   if (TraceOn)
     {
-      s = AssignDebug (s, (const char *) "../../gcc/m2/gm2-libs/DynamicStrings.mod", 40, 1198, (const char *) "Dup", 3);
+      s = static_cast<DynamicStrings_String> (AssignDebug (static_cast<DynamicStrings_String__opaque> (s), (const char *) "../../gcc/m2/gm2-libs/DynamicStrings.mod", 40, 1198, (const char *) "Dup", 3));
     }
   return s;
   /* static analysis guarentees a RETURN statement will be used before here.  */
@@ -1892,13 +1892,13 @@ extern "C" DynamicStrings_String DynamicStrings_Add (DynamicStrings_String a, Dy
 {
   if (PoisonOn)
     {
-      a = CheckPoisoned (a);
-      b = CheckPoisoned (b);
+      a = static_cast<DynamicStrings_String> (CheckPoisoned (static_cast<DynamicStrings_String__opaque> (a)));
+      b = static_cast<DynamicStrings_String> (CheckPoisoned (static_cast<DynamicStrings_String__opaque> (b)));
     }
   a = DynamicStrings_ConCat (DynamicStrings_ConCat (DynamicStrings_InitString ((const char *) "", 0), a), b);
   if (TraceOn)
     {
-      a = AssignDebug (a, (const char *) "../../gcc/m2/gm2-libs/DynamicStrings.mod", 40, 1218, (const char *) "Add", 3);
+      a = static_cast<DynamicStrings_String> (AssignDebug (static_cast<DynamicStrings_String__opaque> (a), (const char *) "../../gcc/m2/gm2-libs/DynamicStrings.mod", 40, 1218, (const char *) "Add", 3));
     }
   return a;
   /* static analysis guarentees a RETURN statement will be used before here.  */
@@ -1916,25 +1916,25 @@ extern "C" bool DynamicStrings_Equal (DynamicStrings_String a, DynamicStrings_St
 
   if (PoisonOn)
     {
-      a = CheckPoisoned (a);
-      b = CheckPoisoned (b);
+      a = static_cast<DynamicStrings_String> (CheckPoisoned (static_cast<DynamicStrings_String__opaque> (a)));
+      b = static_cast<DynamicStrings_String> (CheckPoisoned (static_cast<DynamicStrings_String__opaque> (b)));
     }
   if ((DynamicStrings_Length (a)) == (DynamicStrings_Length (b)))
     {
       while ((a != NULL) && (b != NULL))
         {
           i = 0;
-          Assertion_Assert (a->contents.len == b->contents.len);
-          while (i < a->contents.len)
+          Assertion_Assert (static_cast<DynamicStrings_String__opaque> (a)->contents.len == static_cast<DynamicStrings_String__opaque> (b)->contents.len);
+          while (i < static_cast<DynamicStrings_String__opaque> (a)->contents.len)
             {
-              if (a->contents.buf.array[i] != b->contents.buf.array[i])
+              if (static_cast<DynamicStrings_String__opaque> (a)->contents.buf.array[i] != static_cast<DynamicStrings_String__opaque> (b)->contents.buf.array[i])
                 {
                   return false;
                 }
               i += 1;
             }
-          a = a->contents.next;
-          b = b->contents.next;
+          a = static_cast<DynamicStrings_String> (static_cast<DynamicStrings_String__opaque> (a)->contents.next);
+          b = static_cast<DynamicStrings_String> (static_cast<DynamicStrings_String__opaque> (b)->contents.next);
         }
       return true;
     }
@@ -1954,26 +1954,26 @@ extern "C" bool DynamicStrings_Equal (DynamicStrings_String a, DynamicStrings_St
 
 extern "C" bool DynamicStrings_EqualCharStar (DynamicStrings_String s, void * a)
 {
-  DynamicStrings_String t;
+  DynamicStrings_String__opaque t;
 
   if (PoisonOn)
     {
-      s = CheckPoisoned (s);
+      s = static_cast<DynamicStrings_String> (CheckPoisoned (static_cast<DynamicStrings_String__opaque> (s)));
     }
-  t = DynamicStrings_InitStringCharStar (a);
+  t = static_cast<DynamicStrings_String__opaque> (DynamicStrings_InitStringCharStar (a));
   if (TraceOn)
     {
       t = AssignDebug (t, (const char *) "../../gcc/m2/gm2-libs/DynamicStrings.mod", 40, 1275, (const char *) "EqualCharStar", 13);
     }
-  t = AddToGarbage (t, s);
-  if (DynamicStrings_Equal (t, s))
+  t = AddToGarbage (t, static_cast<DynamicStrings_String__opaque> (s));
+  if (DynamicStrings_Equal (static_cast<DynamicStrings_String> (t), s))
     {
-      t = DynamicStrings_KillString (t);
+      t = static_cast<DynamicStrings_String__opaque> (DynamicStrings_KillString (static_cast<DynamicStrings_String> (t)));
       return true;
     }
   else
     {
-      t = DynamicStrings_KillString (t);
+      t = static_cast<DynamicStrings_String__opaque> (DynamicStrings_KillString (static_cast<DynamicStrings_String> (t)));
       return false;
     }
   /* static analysis guarentees a RETURN statement will be used before here.  */
@@ -1988,7 +1988,7 @@ extern "C" bool DynamicStrings_EqualCharStar (DynamicStrings_String s, void * a)
 
 extern "C" bool DynamicStrings_EqualArray (DynamicStrings_String s, const char *a_, unsigned int _a_high)
 {
-  DynamicStrings_String t;
+  DynamicStrings_String__opaque t;
   char a[_a_high+1];
 
   /* make a local copy of each unbounded array.  */
@@ -1996,22 +1996,22 @@ extern "C" bool DynamicStrings_EqualArray (DynamicStrings_String s, const char *
 
   if (PoisonOn)
     {
-      s = CheckPoisoned (s);
+      s = static_cast<DynamicStrings_String> (CheckPoisoned (static_cast<DynamicStrings_String__opaque> (s)));
     }
-  t = DynamicStrings_InitString ((const char *) a, _a_high);
+  t = static_cast<DynamicStrings_String__opaque> (DynamicStrings_InitString ((const char *) a, _a_high));
   if (TraceOn)
     {
       t = AssignDebug (t, (const char *) "../../gcc/m2/gm2-libs/DynamicStrings.mod", 40, 1305, (const char *) "EqualArray", 10);
     }
-  t = AddToGarbage (t, s);
-  if (DynamicStrings_Equal (t, s))
+  t = AddToGarbage (t, static_cast<DynamicStrings_String__opaque> (s));
+  if (DynamicStrings_Equal (static_cast<DynamicStrings_String> (t), s))
     {
-      t = DynamicStrings_KillString (t);
+      t = static_cast<DynamicStrings_String__opaque> (DynamicStrings_KillString (static_cast<DynamicStrings_String> (t)));
       return true;
     }
   else
     {
-      t = DynamicStrings_KillString (t);
+      t = static_cast<DynamicStrings_String__opaque> (DynamicStrings_KillString (static_cast<DynamicStrings_String> (t)));
       return false;
     }
   /* static analysis guarentees a RETURN statement will be used before here.  */
@@ -2027,11 +2027,11 @@ extern "C" DynamicStrings_String DynamicStrings_Mult (DynamicStrings_String s, u
 {
   if (PoisonOn)
     {
-      s = CheckPoisoned (s);
+      s = static_cast<DynamicStrings_String> (CheckPoisoned (static_cast<DynamicStrings_String__opaque> (s)));
     }
   if (n <= 0)
     {
-      s = AddToGarbage (DynamicStrings_InitString ((const char *) "", 0), s);
+      s = static_cast<DynamicStrings_String> (AddToGarbage (static_cast<DynamicStrings_String__opaque> (DynamicStrings_InitString ((const char *) "", 0)), static_cast<DynamicStrings_String__opaque> (s)));
     }
   else
     {
@@ -2039,7 +2039,7 @@ extern "C" DynamicStrings_String DynamicStrings_Mult (DynamicStrings_String s, u
     }
   if (TraceOn)
     {
-      s = AssignDebug (s, (const char *) "../../gcc/m2/gm2-libs/DynamicStrings.mod", 40, 1337, (const char *) "Mult", 4);
+      s = static_cast<DynamicStrings_String> (AssignDebug (static_cast<DynamicStrings_String__opaque> (s), (const char *) "../../gcc/m2/gm2-libs/DynamicStrings.mod", 40, 1337, (const char *) "Mult", 4));
     }
   return s;
   /* static analysis guarentees a RETURN statement will be used before here.  */
@@ -2061,15 +2061,15 @@ extern "C" DynamicStrings_String DynamicStrings_Mult (DynamicStrings_String s, u
 
 extern "C" DynamicStrings_String DynamicStrings_Slice (DynamicStrings_String s, int low, int high)
 {
-  DynamicStrings_String d;
-  DynamicStrings_String t;
+  DynamicStrings_String__opaque d;
+  DynamicStrings_String__opaque t;
   int start;
   int end;
   int o;
 
   if (PoisonOn)
     {
-      s = CheckPoisoned (s);
+      s = static_cast<DynamicStrings_String> (CheckPoisoned (static_cast<DynamicStrings_String__opaque> (s)));
     }
   if (low < 0)
     {
@@ -2084,17 +2084,17 @@ extern "C" DynamicStrings_String DynamicStrings_Slice (DynamicStrings_String s,
       /* make sure high is <= Length (s)  */
       high = Min (DynamicStrings_Length (s), static_cast<unsigned int> (high));
     }
-  d = DynamicStrings_InitString ((const char *) "", 0);
-  d = AddToGarbage (d, s);
+  d = static_cast<DynamicStrings_String__opaque> (DynamicStrings_InitString ((const char *) "", 0));
+  d = AddToGarbage (d, static_cast<DynamicStrings_String__opaque> (s));
   o = 0;
   t = d;
   while (s != NULL)
     {
-      if (low < (o+((int ) (s->contents.len))))
+      if (low < (o+((int ) (static_cast<DynamicStrings_String__opaque> (s)->contents.len))))
         {
           if (o > high)
             {
-              s = NULL;
+              s = static_cast<DynamicStrings_String> (NULL);
             }
           else
             {
@@ -2123,22 +2123,22 @@ extern "C" DynamicStrings_String DynamicStrings_Slice (DynamicStrings_String s,
                     }
                   t = t->contents.next;
                 }
-              ConcatContentsAddress (&t->contents, &s->contents.buf.array[start], static_cast<unsigned int> (end-start));
-              o += s->contents.len;
-              s = s->contents.next;
+              ConcatContentsAddress (&t->contents, &static_cast<DynamicStrings_String__opaque> (s)->contents.buf.array[start], static_cast<unsigned int> (end-start));
+              o += static_cast<DynamicStrings_String__opaque> (s)->contents.len;
+              s = static_cast<DynamicStrings_String> (static_cast<DynamicStrings_String__opaque> (s)->contents.next);
             }
         }
       else
         {
-          o += s->contents.len;
-          s = s->contents.next;
+          o += static_cast<DynamicStrings_String__opaque> (s)->contents.len;
+          s = static_cast<DynamicStrings_String> (static_cast<DynamicStrings_String__opaque> (s)->contents.next);
         }
     }
   if (TraceOn)
     {
       d = AssignDebug (d, (const char *) "../../gcc/m2/gm2-libs/DynamicStrings.mod", 40, 1422, (const char *) "Slice", 5);
     }
-  return d;
+  return static_cast<DynamicStrings_String> (d);
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -2157,21 +2157,21 @@ extern "C" int DynamicStrings_Index (DynamicStrings_String s, char ch, unsigned
 
   if (PoisonOn)
     {
-      s = CheckPoisoned (s);
+      s = static_cast<DynamicStrings_String> (CheckPoisoned (static_cast<DynamicStrings_String__opaque> (s)));
     }
   k = 0;
   while (s != NULL)
     {
-      if ((k+s->contents.len) < o)
+      if ((k+static_cast<DynamicStrings_String__opaque> (s)->contents.len) < o)
         {
-          k += s->contents.len;
+          k += static_cast<DynamicStrings_String__opaque> (s)->contents.len;
         }
       else
         {
           i = o-k;
-          while (i < s->contents.len)
+          while (i < static_cast<DynamicStrings_String__opaque> (s)->contents.len)
             {
-              if (s->contents.buf.array[i] == ch)
+              if (static_cast<DynamicStrings_String__opaque> (s)->contents.buf.array[i] == ch)
                 {
                   return k+i;
                 }
@@ -2180,7 +2180,7 @@ extern "C" int DynamicStrings_Index (DynamicStrings_String s, char ch, unsigned
           k += i;
           o = k;
         }
-      s = s->contents.next;
+      s = static_cast<DynamicStrings_String> (static_cast<DynamicStrings_String__opaque> (s)->contents.next);
     }
   return -1;
   /* static analysis guarentees a RETURN statement will be used before here.  */
@@ -2203,15 +2203,15 @@ extern "C" int DynamicStrings_RIndex (DynamicStrings_String s, char ch, unsigned
 
   if (PoisonOn)
     {
-      s = CheckPoisoned (s);
+      s = static_cast<DynamicStrings_String> (CheckPoisoned (static_cast<DynamicStrings_String__opaque> (s)));
     }
   j = -1;
   k = 0;
   while (s != NULL)
     {
-      if ((k+s->contents.len) < o)
+      if ((k+static_cast<DynamicStrings_String__opaque> (s)->contents.len) < o)
         {
-          k += s->contents.len;
+          k += static_cast<DynamicStrings_String__opaque> (s)->contents.len;
         }
       else
         {
@@ -2223,9 +2223,9 @@ extern "C" int DynamicStrings_RIndex (DynamicStrings_String s, char ch, unsigned
             {
               i = o-k;
             }
-          while (i < s->contents.len)
+          while (i < static_cast<DynamicStrings_String__opaque> (s)->contents.len)
             {
-              if (s->contents.buf.array[i] == ch)
+              if (static_cast<DynamicStrings_String__opaque> (s)->contents.buf.array[i] == ch)
                 {
                   j = k;
                 }
@@ -2233,7 +2233,7 @@ extern "C" int DynamicStrings_RIndex (DynamicStrings_String s, char ch, unsigned
               i += 1;
             }
         }
-      s = s->contents.next;
+      s = static_cast<DynamicStrings_String> (static_cast<DynamicStrings_String__opaque> (s)->contents.next);
     }
   return j;
   /* static analysis guarentees a RETURN statement will be used before here.  */
@@ -2257,7 +2257,7 @@ extern "C" int DynamicStrings_ReverseIndex (DynamicStrings_String s, char ch, in
 
   if (PoisonOn)
     {
-      s = CheckPoisoned (s);
+      s = static_cast<DynamicStrings_String> (CheckPoisoned (static_cast<DynamicStrings_String__opaque> (s)));
     }
   if (o < 0)
     {
@@ -2311,7 +2311,7 @@ extern "C" DynamicStrings_String DynamicStrings_RemoveComment (DynamicStrings_St
     }
   if (TraceOn)
     {
-      s = AssignDebug (s, (const char *) "../../gcc/m2/gm2-libs/DynamicStrings.mod", 40, 1576, (const char *) "RemoveComment", 13);
+      s = static_cast<DynamicStrings_String> (AssignDebug (static_cast<DynamicStrings_String__opaque> (s), (const char *) "../../gcc/m2/gm2-libs/DynamicStrings.mod", 40, 1576, (const char *) "RemoveComment", 13));
     }
   return s;
   /* static analysis guarentees a RETURN statement will be used before here.  */
@@ -2336,7 +2336,7 @@ extern "C" DynamicStrings_String DynamicStrings_RemoveWhitePrefix (DynamicString
   s = DynamicStrings_Slice (s, (int ) (i), 0);
   if (TraceOn)
     {
-      s = AssignDebug (s, (const char *) "../../gcc/m2/gm2-libs/DynamicStrings.mod", 40, 1688, (const char *) "RemoveWhitePrefix", 17);
+      s = static_cast<DynamicStrings_String> (AssignDebug (static_cast<DynamicStrings_String__opaque> (s), (const char *) "../../gcc/m2/gm2-libs/DynamicStrings.mod", 40, 1688, (const char *) "RemoveWhitePrefix", 17));
     }
   return s;
   /* static analysis guarentees a RETURN statement will be used before here.  */
@@ -2361,7 +2361,7 @@ extern "C" DynamicStrings_String DynamicStrings_RemoveWhitePostfix (DynamicStrin
   s = DynamicStrings_Slice (s, 0, i+1);
   if (TraceOn)
     {
-      s = AssignDebug (s, (const char *) "../../gcc/m2/gm2-libs/DynamicStrings.mod", 40, 1710, (const char *) "RemoveWhitePostfix", 18);
+      s = static_cast<DynamicStrings_String> (AssignDebug (static_cast<DynamicStrings_String__opaque> (s), (const char *) "../../gcc/m2/gm2-libs/DynamicStrings.mod", 40, 1710, (const char *) "RemoveWhitePostfix", 18));
     }
   return s;
   /* static analysis guarentees a RETURN statement will be used before here.  */
@@ -2379,12 +2379,12 @@ extern "C" DynamicStrings_String DynamicStrings_ToUpper (DynamicStrings_String s
 {
   char ch;
   unsigned int i;
-  DynamicStrings_String t;
+  DynamicStrings_String__opaque t;
 
   if (s != NULL)
     {
-      MarkInvalid (s);
-      t = s;
+      MarkInvalid (static_cast<DynamicStrings_String__opaque> (s));
+      t = static_cast<DynamicStrings_String__opaque> (s);
       while (t != NULL)
         {
           i = 0;
@@ -2416,12 +2416,12 @@ extern "C" DynamicStrings_String DynamicStrings_ToLower (DynamicStrings_String s
 {
   char ch;
   unsigned int i;
-  DynamicStrings_String t;
+  DynamicStrings_String__opaque t;
 
   if (s != NULL)
     {
-      MarkInvalid (s);
-      t = s;
+      MarkInvalid (static_cast<DynamicStrings_String__opaque> (s));
+      t = static_cast<DynamicStrings_String__opaque> (s);
       while (t != NULL)
         {
           i = 0;
@@ -2456,12 +2456,12 @@ extern "C" void DynamicStrings_CopyOut (char *a, unsigned int _a_high, DynamicSt
   i = 0;
   while (i < l)
     {
-      a[i] = DynamicStrings_char (s, static_cast<int> (i));
+      const_cast<char *>(a)[i] = DynamicStrings_char (s, static_cast<int> (i));
       i += 1;
     }
   if (i <= _a_high)
     {
-      a[i] = ASCII_nul;
+      const_cast<char *>(a)[i] = ASCII_nul;
     }
 }
 
@@ -2476,7 +2476,7 @@ extern "C" char DynamicStrings_char (DynamicStrings_String s, int i)
 
   if (PoisonOn)
     {
-      s = CheckPoisoned (s);
+      s = static_cast<DynamicStrings_String> (CheckPoisoned (static_cast<DynamicStrings_String__opaque> (s)));
     }
   if (i < 0)
     {
@@ -2486,18 +2486,18 @@ extern "C" char DynamicStrings_char (DynamicStrings_String s, int i)
     {
       c = i;
     }
-  while ((s != NULL) && (c >= s->contents.len))
+  while ((s != NULL) && (c >= static_cast<DynamicStrings_String__opaque> (s)->contents.len))
     {
-      c -= s->contents.len;
-      s = s->contents.next;
+      c -= static_cast<DynamicStrings_String__opaque> (s)->contents.len;
+      s = static_cast<DynamicStrings_String> (static_cast<DynamicStrings_String__opaque> (s)->contents.next);
     }
-  if ((s == NULL) || (c >= s->contents.len))
+  if ((s == NULL) || (c >= static_cast<DynamicStrings_String__opaque> (s)->contents.len))
     {
       return ASCII_nul;
     }
   else
     {
-      return s->contents.buf.array[c];
+      return static_cast<DynamicStrings_String__opaque> (s)->contents.buf.array[c];
     }
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
@@ -2512,14 +2512,14 @@ extern "C" void * DynamicStrings_string (DynamicStrings_String s)
 {
   typedef char *string__T2;
 
-  DynamicStrings_String a;
+  DynamicStrings_String__opaque a;
   unsigned int l;
   unsigned int i;
   string__T2 p;
 
   if (PoisonOn)
     {
-      s = CheckPoisoned (s);
+      s = static_cast<DynamicStrings_String> (CheckPoisoned (static_cast<DynamicStrings_String__opaque> (s)));
     }
   if (s == NULL)
     {
@@ -2527,18 +2527,18 @@ extern "C" void * DynamicStrings_string (DynamicStrings_String s)
     }
   else
     {
-      if (! s->head->charStarValid)
+      if (! static_cast<DynamicStrings_String__opaque> (s)->head->charStarValid)
         {
           l = DynamicStrings_Length (s);
-          if (! (s->head->charStarUsed && (s->head->charStarSize > l)))
+          if (! (static_cast<DynamicStrings_String__opaque> (s)->head->charStarUsed && (static_cast<DynamicStrings_String__opaque> (s)->head->charStarSize > l)))
             {
-              DeallocateCharStar (s);
-              Storage_ALLOCATE (&s->head->charStar, l+1);
-              s->head->charStarSize = l+1;
-              s->head->charStarUsed = true;
+              DeallocateCharStar (static_cast<DynamicStrings_String__opaque> (s));
+              Storage_ALLOCATE (&static_cast<DynamicStrings_String__opaque> (s)->head->charStar, l+1);
+              static_cast<DynamicStrings_String__opaque> (s)->head->charStarSize = l+1;
+              static_cast<DynamicStrings_String__opaque> (s)->head->charStarUsed = true;
             }
-          p = static_cast<string__T2> (s->head->charStar);
-          a = s;
+          p = static_cast<string__T2> (static_cast<DynamicStrings_String__opaque> (s)->head->charStar);
+          a = static_cast<DynamicStrings_String__opaque> (s);
           while (a != NULL)
             {
               i = 0;
@@ -2551,9 +2551,9 @@ extern "C" void * DynamicStrings_string (DynamicStrings_String s)
               a = a->contents.next;
             }
           (*p) = ASCII_nul;
-          s->head->charStarValid = true;
+          static_cast<DynamicStrings_String__opaque> (s)->head->charStarValid = true;
         }
-      return s->head->charStar;
+      return static_cast<DynamicStrings_String__opaque> (s)->head->charStar;
     }
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
@@ -2573,7 +2573,7 @@ extern "C" DynamicStrings_String DynamicStrings_InitStringDB (const char *a_, un
   memcpy (a, a_, _a_high+1);
   memcpy (file, file_, _file_high+1);
 
-  return AssignDebug (DynamicStrings_InitString ((const char *) a, _a_high), (const char *) file, _file_high, line, (const char *) "InitString", 10);
+  return static_cast<DynamicStrings_String> (AssignDebug (static_cast<DynamicStrings_String__opaque> (DynamicStrings_InitString ((const char *) a, _a_high)), (const char *) file, _file_high, line, (const char *) "InitString", 10));
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -2590,7 +2590,7 @@ extern "C" DynamicStrings_String DynamicStrings_InitStringCharStarDB (void * a,
   /* make a local copy of each unbounded array.  */
   memcpy (file, file_, _file_high+1);
 
-  return AssignDebug (DynamicStrings_InitStringCharStar (a), (const char *) file, _file_high, line, (const char *) "InitStringCharStar", 18);
+  return static_cast<DynamicStrings_String> (AssignDebug (static_cast<DynamicStrings_String__opaque> (DynamicStrings_InitStringCharStar (a)), (const char *) file, _file_high, line, (const char *) "InitStringCharStar", 18));
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -2607,7 +2607,7 @@ extern "C" DynamicStrings_String DynamicStrings_InitStringCharDB (char ch, const
   /* make a local copy of each unbounded array.  */
   memcpy (file, file_, _file_high+1);
 
-  return AssignDebug (DynamicStrings_InitStringChar (ch), (const char *) file, _file_high, line, (const char *) "InitStringChar", 14);
+  return static_cast<DynamicStrings_String> (AssignDebug (static_cast<DynamicStrings_String__opaque> (DynamicStrings_InitStringChar (ch)), (const char *) file, _file_high, line, (const char *) "InitStringChar", 14));
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -2624,7 +2624,7 @@ extern "C" DynamicStrings_String DynamicStrings_MultDB (DynamicStrings_String s,
   /* make a local copy of each unbounded array.  */
   memcpy (file, file_, _file_high+1);
 
-  return AssignDebug (DynamicStrings_Mult (s, n), (const char *) file, _file_high, line, (const char *) "Mult", 4);
+  return static_cast<DynamicStrings_String> (AssignDebug (static_cast<DynamicStrings_String__opaque> (DynamicStrings_Mult (s, n)), (const char *) file, _file_high, line, (const char *) "Mult", 4));
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -2641,7 +2641,7 @@ extern "C" DynamicStrings_String DynamicStrings_DupDB (DynamicStrings_String s,
   /* make a local copy of each unbounded array.  */
   memcpy (file, file_, _file_high+1);
 
-  return AssignDebug (DynamicStrings_Dup (s), (const char *) file, _file_high, line, (const char *) "Dup", 3);
+  return static_cast<DynamicStrings_String> (AssignDebug (static_cast<DynamicStrings_String__opaque> (DynamicStrings_Dup (s)), (const char *) file, _file_high, line, (const char *) "Dup", 3));
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -2659,8 +2659,8 @@ extern "C" DynamicStrings_String DynamicStrings_SliceDB (DynamicStrings_String s
   memcpy (file, file_, _file_high+1);
 
   DSdbEnter ();
-  s = AssignDebug (DynamicStrings_Slice (s, low, high), (const char *) file, _file_high, line, (const char *) "Slice", 5);
-  DSdbExit (s);
+  s = static_cast<DynamicStrings_String> (AssignDebug (static_cast<DynamicStrings_String__opaque> (DynamicStrings_Slice (s, low, high)), (const char *) file, _file_high, line, (const char *) "Slice", 5));
+  DSdbExit (static_cast<DynamicStrings_String__opaque> (s));
   return s;
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
@@ -2680,8 +2680,8 @@ extern "C" void DynamicStrings_PushAllocation (void)
       Init ();
       Storage_ALLOCATE ((void **) &f, sizeof (DynamicStrings_frameRec));
       f->next = frameHead;
-      f->alloc = NULL;
-      f->dealloc = NULL;
+      f->alloc = static_cast<DynamicStrings_String__opaque> (NULL);
+      f->dealloc = static_cast<DynamicStrings_String__opaque> (NULL);
       frameHead = f;
     }
 }
@@ -2700,7 +2700,7 @@ extern "C" void DynamicStrings_PopAllocation (bool halt)
 {
   if (CheckOn)
     {
-      if ((DynamicStrings_PopAllocationExemption (halt, NULL)) == NULL)
+      if ((DynamicStrings_PopAllocationExemption (halt, static_cast<DynamicStrings_String> (NULL))) == NULL)
         {}  /* empty.  */
     }
 }
@@ -2718,7 +2718,7 @@ extern "C" void DynamicStrings_PopAllocation (bool halt)
 
 extern "C" DynamicStrings_String DynamicStrings_PopAllocationExemption (bool halt, DynamicStrings_String e)
 {
-  DynamicStrings_String s;
+  DynamicStrings_String__opaque s;
   bool b;
 
   Init ();
@@ -2739,7 +2739,7 @@ extern "C" DynamicStrings_String DynamicStrings_PopAllocationExemption (bool hal
               s = frameHead->alloc;
               while (s != NULL)
                 {
-                  if (! (((e == s) || (IsOnGarbage (e, s))) || (IsOnGarbage (s, e))))
+                  if (! (((e == s) || (IsOnGarbage (static_cast<DynamicStrings_String__opaque> (e), s))) || (IsOnGarbage (s, static_cast<DynamicStrings_String__opaque> (e)))))
                     {
                       if (! b)
                         {
@@ -2764,12 +2764,12 @@ extern "C" DynamicStrings_String DynamicStrings_PopAllocationExemption (bool hal
   __builtin_unreachable ();
 }
 
-extern "C" void _M2_DynamicStrings_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
+extern "C" void _M2_DynamicStrings_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
 {
   Initialized = false;
   Init ();
 }
 
-extern "C" void _M2_DynamicStrings_fini (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
+extern "C" void _M2_DynamicStrings_fini (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
 {
 }
index 3916428a10823297737314afb0992edfe2f6ffde..aad1bb46c010e9f964acb4b6786efa6ac65c3a53 100644 (file)
@@ -38,9 +38,9 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #   undef NULL
 #   define NULL 0
 #endif
-#define _Environment_H
 #define _Environment_C
 
+#include "GEnvironment.h"
 #   include "GSYSTEM.h"
 #   include "Glibc.h"
 #   include "GASCII.h"
@@ -86,16 +86,16 @@ extern "C" bool Environment_GetEnvironment (const char *Env_, unsigned int _Env_
 
   i = 0;
   High = _dest_high;
-  Addr = static_cast<GetEnvironment__T1> (libc_getenv (&Env));
+  Addr = static_cast<GetEnvironment__T1> (libc_getenv (const_cast<void*> (static_cast<const void*>(Env))));
   while (((i < High) && (Addr != NULL)) && ((*Addr) != ASCII_nul))
     {
-      dest[i] = (*Addr);
+      const_cast<char *>(dest)[i] = (*Addr);
       Addr += 1;
       i += 1;
     }
   if (i < High)
     {
-      dest[i] = ASCII_nul;
+      const_cast<char *>(dest)[i] = ASCII_nul;
     }
   return Addr != NULL;
   /* static analysis guarentees a RETURN statement will be used before here.  */
@@ -116,15 +116,15 @@ extern "C" bool Environment_PutEnvironment (const char *EnvDef_, unsigned int _E
   /* make a local copy of each unbounded array.  */
   memcpy (EnvDef, EnvDef_, _EnvDef_high+1);
 
-  return (libc_putenv (&EnvDef)) == 0;
+  return (libc_putenv (const_cast<void*> (static_cast<const void*>(EnvDef)))) == 0;
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
 
-extern "C" void _M2_Environment_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
+extern "C" void _M2_Environment_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
 {
 }
 
-extern "C" void _M2_Environment_fini (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
+extern "C" void _M2_Environment_fini (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
 {
 }
index 3f05b35e6e2197785ce4d39a92a4511d0170f91f..229dc175e75b0ed5e1fa1555f60568fc3ed30c50 100644 (file)
@@ -48,9 +48,9 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #   undef NULL
 #   define NULL 0
 #endif
-#define _FIO_H
 #define _FIO_C
 
+#include "GFIO.h"
 #   include "GSYSTEM.h"
 #   include "GASCII.h"
 #   include "GStrLib.h"
@@ -63,9 +63,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 
 typedef unsigned int FIO_File;
 
-FIO_File FIO_StdErr;
-FIO_File FIO_StdOut;
-FIO_File FIO_StdIn;
 #   define MaxBufferLength (1024*16)
 #   define MaxErrorString (1024*8)
 #   define CreatePermissions 0666
@@ -88,7 +85,7 @@ typedef enum {FIO_successful, FIO_outofmemory, FIO_toomanyfilesopen, FIO_failed,
 typedef enum {FIO_unused, FIO_openedforread, FIO_openedforwrite, FIO_openedforrandom} FIO_FileUsage;
 
 struct FIO_NameInfo_r {
-                        void *address;
+                        void * address;
                         unsigned int size;
                       };
 
@@ -96,11 +93,11 @@ struct FIO_buf_r {
                    bool valid;
                    long int bufstart;
                    unsigned int position;
-                   void *address;
+                   void * address;
                    unsigned int filled;
                    unsigned int size;
                    unsigned int left;
-                   FIO__T7 *contents;
+                   FIO__T7 * contents;
                  };
 
 struct FIO__T7_a { char array[MaxBufferLength+1]; };
@@ -639,7 +636,7 @@ static FIO_File InitializeFile (FIO_File f, void * fname, unsigned int flength,
             {
               fd->buffer->left = 0;
             }
-          fd->buffer->contents = reinterpret_cast<FIO__T7 *> (fd->buffer->address);  /* provides easy access for reading characters  */
+          fd->buffer->contents = static_cast<FIO__T7 *> (fd->buffer->address);  /* provides easy access for reading characters  */
           fd->state = fstate;  /* provides easy access for reading characters  */
         }
     }
@@ -913,7 +910,7 @@ static void HandleEscape (char *dest, unsigned int _dest_high, const char *src_,
       if (src[(*i)+1] == 'n')
         {
           /* requires a newline  */
-          dest[(*j)] = ASCII_nl;
+          const_cast<char *>(dest)[(*j)] = ASCII_nl;
           (*j) += 1;
           (*i) += 2;
         }
@@ -921,7 +918,7 @@ static void HandleEscape (char *dest, unsigned int _dest_high, const char *src_,
         {
           /* avoid dangling else.  */
           /* requires a tab (yuck) tempted to fake this but I better not..  */
-          dest[(*j)] = ASCII_tab;
+          const_cast<char *>(dest)[(*j)] = ASCII_tab;
           (*j) += 1;
           (*i) += 2;
         }
@@ -930,7 +927,7 @@ static void HandleEscape (char *dest, unsigned int _dest_high, const char *src_,
           /* avoid dangling else.  */
           /* copy escaped character  */
           (*i) += 1;
-          dest[(*j)] = src[(*i)];
+          const_cast<char *>(dest)[(*j)] = src[(*i)];
           (*j) += 1;
           (*i) += 1;
         }
@@ -954,7 +951,7 @@ static void Cast (unsigned char *a, unsigned int _a_high, const unsigned char *b
     {
       for (i=0; i<=_a_high; i++)
         {
-          a[i] = b[i];
+          const_cast<unsigned char *>(a)[i] = b[i];
         }
     }
   else
@@ -1004,7 +1001,7 @@ static void StringFormat1 (char *dest, unsigned int _dest_high, const char *src_
         }
       else
         {
-          dest[j] = src[i];
+          const_cast<char *>(dest)[j] = src[i];
           i += 1;
           j += 1;
         }
@@ -1017,13 +1014,13 @@ static void StringFormat1 (char *dest, unsigned int _dest_high, const char *src_
           Cast ((unsigned char *) &p, (sizeof (p)-1), (const unsigned char *) w, _w_high);
           while ((j < HighDest) && ((*p) != ASCII_nul))
             {
-              dest[j] = (*p);
+              const_cast<char *>(dest)[j] = (*p);
               j += 1;
               p += 1;
             }
           if (j < HighDest)
             {
-              dest[j] = ASCII_nul;
+              const_cast<char *>(dest)[j] = ASCII_nul;
             }
           j = StrLib_StrLen ((const char *) dest, _dest_high);
           i += 2;
@@ -1031,7 +1028,7 @@ static void StringFormat1 (char *dest, unsigned int _dest_high, const char *src_
       else if (src[i+1] == 'd')
         {
           /* avoid dangling else.  */
-          dest[j] = ASCII_nul;
+          const_cast<char *>(dest)[j] = ASCII_nul;
           Cast ((unsigned char *) &c, (sizeof (c)-1), (const unsigned char *) w, _w_high);
           NumberIO_CardToStr (c, 0, (char *) &str.array[0], MaxErrorString);
           StrLib_StrConCat ((const char *) dest, _dest_high, (const char *) &str.array[0], MaxErrorString, (char *) dest, _dest_high);
@@ -1041,7 +1038,7 @@ static void StringFormat1 (char *dest, unsigned int _dest_high, const char *src_
       else
         {
           /* avoid dangling else.  */
-          dest[j] = src[i];
+          const_cast<char *>(dest)[j] = src[i];
           i += 1;
           j += 1;
         }
@@ -1055,14 +1052,14 @@ static void StringFormat1 (char *dest, unsigned int _dest_high, const char *src_
         }
       else
         {
-          dest[j] = src[i];
+          const_cast<char *>(dest)[j] = src[i];
           i += 1;
           j += 1;
         }
     }
   if (j < HighDest)
     {
-      dest[j] = ASCII_nul;
+      const_cast<char *>(dest)[j] = ASCII_nul;
     }
 }
 
@@ -1312,7 +1309,7 @@ static void PreInitialize (FIO_File f, const char *fname_, unsigned int _fname_h
   /* make a local copy of each unbounded array.  */
   memcpy (fname, fname_, _fname_high+1);
 
-  if ((InitializeFile (f, &fname, StrLib_StrLen ((const char *) fname, _fname_high), state, use, towrite, bufsize)) == f)
+  if ((InitializeFile (f, const_cast<void*> (static_cast<const void*>(fname)), StrLib_StrLen ((const char *) fname, _fname_high), state, use, towrite, bufsize)) == f)
     {
       fd = static_cast<FIO_FileDescriptor> (Indexing_GetIndice (FileInfo, f));
       if (f == Error)
@@ -1414,7 +1411,7 @@ extern "C" bool FIO_Exists (const char *fname_, unsigned int _fname_high)
   /* 
    The following functions are wrappers for the above.
   */
-  return FIO_exists (&fname, StrLib_StrLen ((const char *) fname, _fname_high));
+  return FIO_exists (const_cast<void*> (static_cast<const void*>(fname)), StrLib_StrLen ((const char *) fname, _fname_high));
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -1426,7 +1423,7 @@ extern "C" FIO_File FIO_OpenToRead (const char *fname_, unsigned int _fname_high
   /* make a local copy of each unbounded array.  */
   memcpy (fname, fname_, _fname_high+1);
 
-  return FIO_openToRead (&fname, StrLib_StrLen ((const char *) fname, _fname_high));
+  return FIO_openToRead (const_cast<void*> (static_cast<const void*>(fname)), StrLib_StrLen ((const char *) fname, _fname_high));
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -1438,7 +1435,7 @@ extern "C" FIO_File FIO_OpenToWrite (const char *fname_, unsigned int _fname_hig
   /* make a local copy of each unbounded array.  */
   memcpy (fname, fname_, _fname_high+1);
 
-  return FIO_openToWrite (&fname, StrLib_StrLen ((const char *) fname, _fname_high));
+  return FIO_openToWrite (const_cast<void*> (static_cast<const void*>(fname)), StrLib_StrLen ((const char *) fname, _fname_high));
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -1450,7 +1447,7 @@ extern "C" FIO_File FIO_OpenForRandom (const char *fname_, unsigned int _fname_h
   /* make a local copy of each unbounded array.  */
   memcpy (fname, fname_, _fname_high+1);
 
-  return FIO_openForRandom (&fname, StrLib_StrLen ((const char *) fname, _fname_high), towrite, newfile);
+  return FIO_openForRandom (const_cast<void*> (static_cast<const void*>(fname)), StrLib_StrLen ((const char *) fname, _fname_high), towrite, newfile);
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -1966,7 +1963,7 @@ extern "C" void FIO_WriteString (FIO_File f, const char *a_, unsigned int _a_hig
   memcpy (a, a_, _a_high+1);
 
   l = StrLib_StrLen ((const char *) a, _a_high);
-  if ((FIO_WriteNBytes (f, l, &a)) != l)
+  if ((FIO_WriteNBytes (f, l, const_cast<void*> (static_cast<const void*>(a)))) != l)
     {}  /* empty.  */
 }
 
@@ -1993,12 +1990,12 @@ extern "C" void FIO_ReadString (FIO_File f, char *a, unsigned int _a_high)
         /* avoid gcc warning by using compound statement even if not strictly necessary.  */
         if (((ch == ASCII_nl) || (! (FIO_IsNoError (f)))) || (FIO_EOF (f)))
           {
-            a[i] = ASCII_nul;
+            const_cast<char *>(a)[i] = ASCII_nul;
             i += 1;
           }
         else
           {
-            a[i] = ch;
+            const_cast<char *>(a)[i] = ch;
             i += 1;
           }
       }
@@ -2222,7 +2219,7 @@ extern "C" void FIO_GetFileName (FIO_File f, char *a, unsigned int _a_high)
               i = 0;
               while (((*p) != ASCII_nul) && (i <= _a_high))
                 {
-                  a[i] = (*p);
+                  const_cast<char *>(a)[i] = (*p);
                   p += 1;
                   i += 1;
                 }
@@ -2307,12 +2304,12 @@ extern "C" void FIO_FlushOutErr (void)
     }
 }
 
-extern "C" void _M2_FIO_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
+extern "C" void _M2_FIO_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
 {
   Init ();
 }
 
-extern "C" void _M2_FIO_fini (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
+extern "C" void _M2_FIO_fini (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
 {
   FIO_FlushOutErr ();
 }
index 6966ac6c635b85bfb6a8f726a649bcf0198c326c..d3acec3bc6c2add4a50e6058d8bf3ce5374eeefd 100644 (file)
@@ -46,9 +46,9 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #   undef NULL
 #   define NULL 0
 #endif
-#define _FormatStrings_H
 #define _FormatStrings_C
 
+#include "GFormatStrings.h"
 #   include "GDynamicStrings.h"
 #   include "GStringConvert.h"
 #   include "GSYSTEM.h"
@@ -254,7 +254,7 @@ static void Cast (unsigned char *a, unsigned int _a_high, const unsigned char *b
     {
       for (i=0; i<=_a_high; i++)
         {
-          a[i] = b[i];
+          const_cast<unsigned char *>(a)[i] = b[i];
         }
     }
   else
@@ -835,10 +835,10 @@ extern "C" DynamicStrings_String FormatStrings_HandleEscape (DynamicStrings_Stri
   __builtin_unreachable ();
 }
 
-extern "C" void _M2_FormatStrings_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
+extern "C" void _M2_FormatStrings_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
 {
 }
 
-extern "C" void _M2_FormatStrings_fini (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
+extern "C" void _M2_FormatStrings_fini (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
 {
 }
index 97d64254dae7ab2d415a05b88fa9e575054de17e..09fd4fb95cdffb6373e1c32b17cfd8477f4a3276 100644 (file)
@@ -42,9 +42,9 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #      define FALSE (1==0)
 #   endif
 
-#define _FpuIO_H
 #define _FpuIO_C
 
+#include "GFpuIO.h"
 #   include "GStrIO.h"
 #   include "GStrLib.h"
 #   include "GASCII.h"
@@ -328,10 +328,10 @@ extern "C" void FpuIO_LongIntToStr (long int x, unsigned int n, char *a, unsigne
   s = DynamicStrings_KillString (s);
 }
 
-extern "C" void _M2_FpuIO_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
+extern "C" void _M2_FpuIO_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
 {
 }
 
-extern "C" void _M2_FpuIO_fini (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
+extern "C" void _M2_FpuIO_fini (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
 {
 }
index 0699c4cb0d73ee05ffad44644d55d85ec0f113b6..4b76ed6bc80cd23fe3afdf622013bdfc7be939fa 100644 (file)
@@ -42,9 +42,9 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #      define FALSE (1==0)
 #   endif
 
-#define _IO_H
 #define _IO_C
 
+#include "GIO.h"
 #   include "GStrLib.h"
 #   include "GSYSTEM.h"
 #   include "Glibc.h"
@@ -177,7 +177,7 @@ static void doWrite (int fd, FIO_File f, char ch)
             r = static_cast<int> (libc_write (FIO_GetUnixFileDescriptor (f), &ch, static_cast<size_t> (1)));
             if (r == 1)
               {
-                return ;
+                return;
               }
             else if (r == -1)
               {
@@ -186,7 +186,7 @@ static void doWrite (int fd, FIO_File f, char ch)
                 if ((r != errno_EAGAIN) && (r != errno_EINTR))
                   {
                     fdState.array[fd].IsEof = true;
-                    return ;
+                    return;
                   }
               }
           }
@@ -319,7 +319,7 @@ extern "C" void IO_Read (char *ch)
             r = static_cast<int> (libc_read (FIO_GetUnixFileDescriptor (FIO_StdIn), ch, static_cast<size_t> (1)));
             if (r == 1)
               {
-                return ;
+                return;
               }
             else if (r == -1)
               {
@@ -329,7 +329,7 @@ extern "C" void IO_Read (char *ch)
                   {
                     fdState.array[0].IsEof = true;
                     (*ch) = ASCII_eof;
-                    return ;
+                    return;
                   }
               }
           }
@@ -471,11 +471,11 @@ extern "C" void IO_EchoOff (int fd, bool input)
   term = termios_KillTermios (term);
 }
 
-extern "C" void _M2_IO_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
+extern "C" void _M2_IO_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
 {
   Init ();
 }
 
-extern "C" void _M2_IO_fini (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
+extern "C" void _M2_IO_fini (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
 {
 }
index 894b8cbea1fc0864ea51baf1cc792309ea4119ce..3da42f68d716da38ec6f2e7d10ce7be362385878 100644 (file)
@@ -42,9 +42,9 @@ Boston, MA 02110-1301, USA.  */
 #   undef NULL
 #   define NULL 0
 #endif
-#define _Indexing_H
 #define _Indexing_C
 
+#include "GIndexing.h"
 #   include "Glibc.h"
 #   include "GStorage.h"
 #   include "GSYSTEM.h"
@@ -58,15 +58,12 @@ typedef struct Indexing__T2_r Indexing__T2;
 
 typedef void * *Indexing_PtrToAddress;
 
-typedef Indexing__T2 *Indexing_Index;
+typedef Indexing__T2 *Indexing_Index__opaque;
 
 typedef unsigned char *Indexing_PtrToByte;
 
-typedef void (*Indexing_IndexProcedure_t) (void *);
-struct Indexing_IndexProcedure_p { Indexing_IndexProcedure_t proc; };
-
 struct Indexing__T2_r {
-                        void *ArrayStart;
+                        void * ArrayStart;
                         unsigned int ArraySize;
                         unsigned int Used;
                         unsigned int Low;
@@ -163,7 +160,7 @@ extern "C" void Indexing_ForeachIndiceInIndexDo (Indexing_Index i, Indexing_Inde
 
 extern "C" Indexing_Index Indexing_InitIndex (unsigned int low)
 {
-  Indexing_Index i;
+  Indexing_Index__opaque i;
 
   Storage_ALLOCATE ((void **) &i, sizeof (Indexing__T2));
   i->Low = low;
@@ -174,7 +171,7 @@ extern "C" Indexing_Index Indexing_InitIndex (unsigned int low)
   i->Debug = false;
   i->Used = 0;
   i->Map = (unsigned int) 0;
-  return i;
+  return static_cast<Indexing_Index> (i);
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -186,9 +183,9 @@ extern "C" Indexing_Index Indexing_InitIndex (unsigned int low)
 
 extern "C" Indexing_Index Indexing_KillIndex (Indexing_Index i)
 {
-  Storage_DEALLOCATE (&i->ArrayStart, i->ArraySize);
+  Storage_DEALLOCATE (&static_cast<Indexing_Index__opaque> (i)->ArrayStart, static_cast<Indexing_Index__opaque> (i)->ArraySize);
   Storage_DEALLOCATE ((void **) &i, sizeof (Indexing__T2));
-  return NULL;
+  return static_cast<Indexing_Index> (NULL);
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -200,7 +197,7 @@ extern "C" Indexing_Index Indexing_KillIndex (Indexing_Index i)
 
 extern "C" Indexing_Index Indexing_DebugIndex (Indexing_Index i)
 {
-  i->Debug = true;
+  static_cast<Indexing_Index__opaque> (i)->Debug = true;
   return i;
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
@@ -221,7 +218,7 @@ extern "C" bool Indexing_InBounds (Indexing_Index i, unsigned int n)
     }
   else
     {
-      return (n >= i->Low) && (n <= i->High);
+      return (n >= static_cast<Indexing_Index__opaque> (i)->Low) && (n <= static_cast<Indexing_Index__opaque> (i)->High);
     }
   ReturnException ("../../gcc/m2/mc/Indexing.def", 20, 1);
   __builtin_unreachable ();
@@ -241,7 +238,7 @@ extern "C" unsigned int Indexing_HighIndice (Indexing_Index i)
     }
   else
     {
-      return i->High;
+      return static_cast<Indexing_Index__opaque> (i)->High;
     }
   ReturnException ("../../gcc/m2/mc/Indexing.def", 20, 1);
   __builtin_unreachable ();
@@ -261,7 +258,7 @@ extern "C" unsigned int Indexing_LowIndice (Indexing_Index i)
     }
   else
     {
-      return i->Low;
+      return static_cast<Indexing_Index__opaque> (i)->Low;
     }
   ReturnException ("../../gcc/m2/mc/Indexing.def", 20, 1);
   __builtin_unreachable ();
@@ -283,19 +280,19 @@ extern "C" void Indexing_PutIndice (Indexing_Index i, unsigned int n, void * a)
   if (! (Indexing_InBounds (i, n)))
     {
       /* avoid gcc warning by using compound statement even if not strictly necessary.  */
-      if (n < i->Low)
+      if (n < static_cast<Indexing_Index__opaque> (i)->Low)
         {
           M2RTS_HALT (-1);
           __builtin_unreachable ();
         }
       else
         {
-          oldSize = i->ArraySize;
-          while (((n-i->Low)*sizeof (void *)) >= i->ArraySize)
+          oldSize = static_cast<Indexing_Index__opaque> (i)->ArraySize;
+          while (((n-static_cast<Indexing_Index__opaque> (i)->Low)*sizeof (void *)) >= static_cast<Indexing_Index__opaque> (i)->ArraySize)
             {
-              i->ArraySize = i->ArraySize*2;
+              static_cast<Indexing_Index__opaque> (i)->ArraySize = static_cast<Indexing_Index__opaque> (i)->ArraySize*2;
             }
-          if (oldSize != i->ArraySize)
+          if (oldSize != static_cast<Indexing_Index__opaque> (i)->ArraySize)
             {
               /* 
                IF Debug
@@ -305,25 +302,25 @@ extern "C" void Indexing_PutIndice (Indexing_Index i, unsigned int n, void * a)
                           oldSize, ArraySize)
                END ;
   */
-              Storage_REALLOCATE (&i->ArrayStart, i->ArraySize);
+              Storage_REALLOCATE (&static_cast<Indexing_Index__opaque> (i)->ArrayStart, static_cast<Indexing_Index__opaque> (i)->ArraySize);
               /* and initialize the remainder of the array to NIL  */
-              b = i->ArrayStart;
+              b = static_cast<Indexing_Index__opaque> (i)->ArrayStart;
               b = reinterpret_cast<void *> (reinterpret_cast<char *> (b)+oldSize);
-              b = libc_memset (b, 0, static_cast<size_t> (i->ArraySize-oldSize));
+              b = libc_memset (b, 0, static_cast<size_t> (static_cast<Indexing_Index__opaque> (i)->ArraySize-oldSize));
             }
-          i->High = n;
+          static_cast<Indexing_Index__opaque> (i)->High = n;
         }
     }
-  b = i->ArrayStart;
-  b = reinterpret_cast<void *> (reinterpret_cast<char *> (b)+(n-i->Low)*sizeof (void *));
+  b = static_cast<Indexing_Index__opaque> (i)->ArrayStart;
+  b = reinterpret_cast<void *> (reinterpret_cast<char *> (b)+(n-static_cast<Indexing_Index__opaque> (i)->Low)*sizeof (void *));
   p = static_cast<PutIndice__T1> (b);
-  (*p) = reinterpret_cast<unsigned int *> (a);
-  i->Used += 1;
-  if (i->Debug)
+  (*p) = static_cast<unsigned int *> (a);
+  static_cast<Indexing_Index__opaque> (i)->Used += 1;
+  if (static_cast<Indexing_Index__opaque> (i)->Debug)
     {
       if (n < 32)
         {
-          i->Map |= (1 << (n ));
+          static_cast<Indexing_Index__opaque> (i)->Map |= (1 << (n ));
         }
     }
 }
@@ -343,12 +340,12 @@ extern "C" void * Indexing_GetIndice (Indexing_Index i, unsigned int n)
       M2RTS_HALT (-1);
       __builtin_unreachable ();
     }
-  b = static_cast<Indexing_PtrToByte> (i->ArrayStart);
-  b += (n-i->Low)*sizeof (void *);
+  b = static_cast<Indexing_PtrToByte> (static_cast<Indexing_Index__opaque> (i)->ArrayStart);
+  b += (n-static_cast<Indexing_Index__opaque> (i)->Low)*sizeof (void *);
   p = (Indexing_PtrToAddress) (b);
-  if (i->Debug)
+  if (static_cast<Indexing_Index__opaque> (i)->Debug)
     {
-      if (((n < 32) && (! ((((1 << (n)) & (i->Map)) != 0)))) && ((*p) != NULL))
+      if (((n < 32) && (! ((((1 << (n)) & (static_cast<Indexing_Index__opaque> (i)->Map)) != 0)))) && ((*p) != NULL))
         {
           M2RTS_HALT (-1);
           __builtin_unreachable ();
@@ -370,9 +367,9 @@ extern "C" bool Indexing_IsIndiceInIndex (Indexing_Index i, void * a)
   Indexing_PtrToByte b;
   Indexing_PtrToAddress p;
 
-  j = i->Low;
-  b = static_cast<Indexing_PtrToByte> (i->ArrayStart);
-  while (j <= i->High)
+  j = static_cast<Indexing_Index__opaque> (i)->Low;
+  b = static_cast<Indexing_PtrToByte> (static_cast<Indexing_Index__opaque> (i)->ArrayStart);
+  while (j <= static_cast<Indexing_Index__opaque> (i)->High)
     {
       p = (Indexing_PtrToAddress) (b);
       if ((*p) == a)
@@ -400,9 +397,9 @@ extern "C" void Indexing_RemoveIndiceFromIndex (Indexing_Index i, void * a)
   Indexing_PtrToAddress p;
   Indexing_PtrToByte b;
 
-  j = i->Low;
-  b = static_cast<Indexing_PtrToByte> (i->ArrayStart);
-  while (j <= i->High)
+  j = static_cast<Indexing_Index__opaque> (i)->Low;
+  b = static_cast<Indexing_PtrToByte> (static_cast<Indexing_Index__opaque> (i)->ArrayStart);
+  while (j <= static_cast<Indexing_Index__opaque> (i)->High)
     {
       p = (Indexing_PtrToAddress) (b);
       b += sizeof (void *);
@@ -426,13 +423,13 @@ extern "C" void Indexing_DeleteIndice (Indexing_Index i, unsigned int j)
 
   if (Indexing_InBounds (i, j))
     {
-      b = static_cast<Indexing_PtrToByte> (i->ArrayStart);
-      b += sizeof (void *)*(j-i->Low);
+      b = static_cast<Indexing_PtrToByte> (static_cast<Indexing_Index__opaque> (i)->ArrayStart);
+      b += sizeof (void *)*(j-static_cast<Indexing_Index__opaque> (i)->Low);
       p = (Indexing_PtrToAddress) (b);
       b += sizeof (void *);
-      p = static_cast<Indexing_PtrToAddress> (libc_memmove (reinterpret_cast<void *> (p), reinterpret_cast<void *> (b), static_cast<size_t> ((i->High-j)*sizeof (void *))));
-      i->High -= 1;
-      i->Used -= 1;
+      p = static_cast<Indexing_PtrToAddress> (libc_memmove (reinterpret_cast<void *> (p), reinterpret_cast<void *> (b), static_cast<size_t> ((static_cast<Indexing_Index__opaque> (i)->High-j)*sizeof (void *))));
+      static_cast<Indexing_Index__opaque> (i)->High -= 1;
+      static_cast<Indexing_Index__opaque> (i)->Used -= 1;
     }
   else
     {
@@ -452,7 +449,7 @@ extern "C" void Indexing_IncludeIndiceIntoIndex (Indexing_Index i, void * a)
   if (! (Indexing_IsIndiceInIndex (i, a)))
     {
       /* avoid gcc warning by using compound statement even if not strictly necessary.  */
-      if (i->Used == 0)
+      if (static_cast<Indexing_Index__opaque> (i)->Used == 0)
         {
           Indexing_PutIndice (i, Indexing_LowIndice (i), a);
         }
@@ -483,10 +480,10 @@ extern "C" void Indexing_ForeachIndiceInIndexDo (Indexing_Index i, Indexing_Inde
     }
 }
 
-extern "C" void _M2_Indexing_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
+extern "C" void _M2_Indexing_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
 {
 }
 
-extern "C" void _M2_Indexing_fini (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
+extern "C" void _M2_Indexing_fini (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
 {
 }
index bf0daab4563d79e447d711b638e5c437b443927f..25b47b35e2177ddd306b782fffd4a7f5d4285faa 100644 (file)
@@ -47,9 +47,9 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #   undef NULL
 #   define NULL 0
 #endif
-#define _M2Dependent_H
 #define _M2Dependent_C
 
+#include "GM2Dependent.h"
 #   include "Glibc.h"
 #   include "GASCII.h"
 #   include "GSYSTEM.h"
@@ -76,9 +76,6 @@ typedef struct M2Dependent__T4_a M2Dependent__T4;
 
 typedef enum {M2Dependent_unregistered, M2Dependent_unordered, M2Dependent_started, M2Dependent_ordered, M2Dependent_user} M2Dependent_DependencyState;
 
-typedef void (*M2Dependent_ArgCVEnvP_t) (int, void *, void *);
-struct M2Dependent_ArgCVEnvP_p { M2Dependent_ArgCVEnvP_t proc; };
-
 struct M2Dependent_DependencyList_r {
                                       PROC proc;
                                       bool forced;
@@ -100,8 +97,8 @@ struct M2Dependent__T3_r {
 
 struct M2Dependent__T4_a { M2Dependent_ModuleChain array[M2Dependent_user-M2Dependent_unregistered+1]; };
 struct M2Dependent__T2_r {
-                           void *name;
-                           void *libname;
+                           void * name;
+                           void * libname;
                            M2Dependent_ArgCVEnvP init;
                            M2Dependent_ArgCVEnvP fini;
                            M2Dependent_DependencyList dependency;
@@ -638,11 +635,11 @@ static void toCString (char *str, unsigned int _str_high)
         {
           if (str[i+1] == 'n')
             {
-              str[i] = ASCII_nl;
+              const_cast<char *>(str)[i] = ASCII_nl;
               j = i+1;
               while (j < high)
                 {
-                  str[j] = str[j+1];
+                  const_cast<char *>(str)[j] = str[j+1];
                   j += 1;
                 }
             }
@@ -962,7 +959,7 @@ static void DisplayModuleInfo (M2Dependent_DependencyState state, const char *de
 
   if (Modules.array[state-M2Dependent_unregistered] != NULL)
     {
-      libc_printf ((const char *) "%s modules\\n", 12, &desc);
+      libc_printf ((const char *) "%s modules\\n", 12, const_cast<void*> (static_cast<const void*>(desc)));
       mptr = Modules.array[state-M2Dependent_unregistered];
       count = 0;
       do {
@@ -1211,7 +1208,7 @@ static bool equal (void * cstr, const char *str_, unsigned int _str_high)
   /* make a local copy of each unbounded array.  */
   memcpy (str, str_, _str_high+1);
 
-  return (strncmp (reinterpret_cast<M2Dependent_PtrToChar> (cstr), reinterpret_cast<M2Dependent_PtrToChar> (&str), StrLib_StrLen ((const char *) str, _str_high))) == 0;
+  return (strncmp (reinterpret_cast<M2Dependent_PtrToChar> (cstr), reinterpret_cast<M2Dependent_PtrToChar> (const_cast<void*> (static_cast<const void*>(str))), StrLib_StrLen ((const char *) str, _str_high))) == 0;
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -1249,7 +1246,7 @@ static void SetupDebugFlags (void)
   ForceTrace = false;
   HexTrace = false;
   WarningTrace = false;
-  pc = static_cast<SetupDebugFlags__T1> (libc_getenv (const_cast<void*> (reinterpret_cast<const void*>("GCC_M2LINK_RTFLAG"))));
+  pc = static_cast<SetupDebugFlags__T1> (libc_getenv (const_cast<void*> (static_cast<const void*>("GCC_M2LINK_RTFLAG"))));
   while ((pc != NULL) && ((*pc) != ASCII_nul))
     {
       if (equal (reinterpret_cast<void *> (pc), (const char *) "all", 3))
@@ -1586,11 +1583,11 @@ extern "C" void M2Dependent_ExecuteTerminationProcedures (void)
   ExecuteReverse (TerminateProc.tail);
 }
 
-extern "C" void _M2_M2Dependent_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
+extern "C" void _M2_M2Dependent_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
 {
   CheckInitialized ();
 }
 
-extern "C" void _M2_M2Dependent_fini (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
+extern "C" void _M2_M2Dependent_fini (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
 {
 }
index 2e268317765ffde19a1fb2740fce31f71fb7cccb..97417cf6c82ae535ccebd91ceb324fd162ddef55 100644 (file)
@@ -35,14 +35,12 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #   endif
 
 #   include "Gmcrts.h"
-#define _M2EXCEPTION_H
 #define _M2EXCEPTION_C
 
+#include "GM2EXCEPTION.h"
 #   include "GSYSTEM.h"
 #   include "GRTExceptions.h"
 
-typedef enum {M2EXCEPTION_indexException, M2EXCEPTION_rangeException, M2EXCEPTION_caseSelectException, M2EXCEPTION_invalidLocation, M2EXCEPTION_functionException, M2EXCEPTION_wholeValueException, M2EXCEPTION_wholeDivException, M2EXCEPTION_realValueException, M2EXCEPTION_realDivException, M2EXCEPTION_complexValueException, M2EXCEPTION_complexDivException, M2EXCEPTION_protException, M2EXCEPTION_sysException, M2EXCEPTION_coException, M2EXCEPTION_exException} M2EXCEPTION_M2Exceptions;
-
 extern "C" M2EXCEPTION_M2Exceptions M2EXCEPTION_M2Exception (void);
 extern "C" bool M2EXCEPTION_IsM2Exception (void);
 
@@ -58,7 +56,7 @@ extern "C" M2EXCEPTION_M2Exceptions M2EXCEPTION_M2Exception (void)
   n = RTExceptions_GetNumber (e);
   if (n == (UINT_MAX))
     {
-      RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_exException)), const_cast<void*> (reinterpret_cast<const void*>("../../gcc/m2/gm2-libs/M2EXCEPTION.mod")), 47, 6, const_cast<void*> (reinterpret_cast<const void*>("M2Exception")), const_cast<void*> (reinterpret_cast<const void*>("current coroutine is not in the exceptional execution state")));
+      RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_exException)), const_cast<void*> (static_cast<const void*>("../../gcc/m2/gm2-libs/M2EXCEPTION.mod")), 47, 6, const_cast<void*> (static_cast<const void*>("M2Exception")), const_cast<void*> (static_cast<const void*>("current coroutine is not in the exceptional execution state")));
     }
   else
     {
@@ -80,11 +78,11 @@ extern "C" bool M2EXCEPTION_IsM2Exception (void)
   __builtin_unreachable ();
 }
 
-extern "C" void _M2_M2EXCEPTION_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
+extern "C" void _M2_M2EXCEPTION_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
 {
   RTExceptions_SetExceptionBlock (RTExceptions_InitExceptionBlock ());
 }
 
-extern "C" void _M2_M2EXCEPTION_fini (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
+extern "C" void _M2_M2EXCEPTION_fini (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
 {
 }
index d529a7880077ad28f16e6d06f1041d99cc0de210..ef5f7cf5ce1eda6db35dd699735b304945c44fa4 100644 (file)
@@ -42,9 +42,9 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #      define FALSE (1==0)
 #   endif
 
-#define _M2RTS_H
 #define _M2RTS_C
 
+#include "GM2RTS.h"
 #   include "Glibc.h"
 #   include "GNumberIO.h"
 #   include "GStrLib.h"
@@ -60,9 +60,6 @@ typedef struct M2RTS_ArgCVEnvP_p M2RTS_ArgCVEnvP;
 #   define stderrFd 2
 typedef char *M2RTS_PtrToChar;
 
-typedef void (*M2RTS_ArgCVEnvP_t) (int, void *, void *);
-struct M2RTS_ArgCVEnvP_p { M2RTS_ArgCVEnvP_t proc; };
-
 static int ExitValue;
 static bool isHalting;
 static bool CallExit;
@@ -257,7 +254,7 @@ static void ErrorString (const char *a_, unsigned int _a_high)
   /* make a local copy of each unbounded array.  */
   memcpy (a, a_, _a_high+1);
 
-  n = static_cast<int> (libc_write (stderrFd, &a, static_cast<size_t> (StrLib_StrLen ((const char *) a, _a_high))));
+  n = static_cast<int> (libc_write (stderrFd, const_cast<void*> (static_cast<const void*>(a)), static_cast<size_t> (StrLib_StrLen ((const char *) a, _a_high))));
 }
 
 
@@ -712,11 +709,11 @@ extern "C" void M2RTS_NoException (void * filename, unsigned int line, unsigned
   RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_exException)), filename, line, column, scope, message);
 }
 
-extern "C" void _M2_M2RTS_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
+extern "C" void _M2_M2RTS_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
 {
   CheckInitialized ();
 }
 
-extern "C" void _M2_M2RTS_fini (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
+extern "C" void _M2_M2RTS_fini (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
 {
 }
index 19b5b42f85ead3e59ee8fe63317fcc0f0881b376..1d9feed27d60532c14ff592b7415c58d05dad577 100644 (file)
@@ -34,9 +34,9 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
        typedef struct { PROC_t proc; } PROC;
 #   endif
 
-#define _MemUtils_H
 #define _MemUtils_C
 
+#include "GMemUtils.h"
 #   include "GSYSTEM.h"
 
 
@@ -118,10 +118,10 @@ extern "C" void MemUtils_MemZero (void * a, unsigned int length)
     }
 }
 
-extern "C" void _M2_MemUtils_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
+extern "C" void _M2_MemUtils_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
 {
 }
 
-extern "C" void _M2_MemUtils_fini (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
+extern "C" void _M2_MemUtils_fini (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
 {
 }
index 366d30e121b0f75a4c49f149404a7d2562837430..75720dd85e6e38acb47d9d25e2fb55ea797409be 100644 (file)
@@ -42,9 +42,9 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #      define FALSE (1==0)
 #   endif
 
-#define _NumberIO_H
 #define _NumberIO_C
 
+#include "GNumberIO.h"
 #   include "GASCII.h"
 #   include "GStrIO.h"
 #   include "GStrLib.h"
@@ -172,19 +172,19 @@ extern "C" void NumberIO_CardToStr (unsigned int x, unsigned int n, char *a, uns
   Higha = _a_high;
   while ((n > i) && (j <= Higha))
     {
-      a[j] = ' ';
+      const_cast<char *>(a)[j] = ' ';
       j += 1;
       n -= 1;
     }
   while ((i > 0) && (j <= Higha))
     {
-      a[j] = ((char) (buf.array[i-1]+ ((unsigned int) ('0'))));
+      const_cast<char *>(a)[j] = ((char) (buf.array[i-1]+ ((unsigned int) ('0'))));
       j += 1;
       i -= 1;
     }
   if (j <= Higha)
     {
-      a[j] = ASCII_nul;
+      const_cast<char *>(a)[j] = ASCII_nul;
     }
 }
 
@@ -270,7 +270,7 @@ extern "C" void NumberIO_HexToStr (unsigned int x, unsigned int n, char *a, unsi
   Higha = _a_high;
   while ((n > i) && (j <= Higha))
     {
-      a[j] = '0';
+      const_cast<char *>(a)[j] = '0';
       j += 1;
       n -= 1;
     }
@@ -278,18 +278,18 @@ extern "C" void NumberIO_HexToStr (unsigned int x, unsigned int n, char *a, unsi
     {
       if (buf.array[i-1] < 10)
         {
-          a[j] = ((char) (buf.array[i-1]+ ((unsigned int) ('0'))));
+          const_cast<char *>(a)[j] = ((char) (buf.array[i-1]+ ((unsigned int) ('0'))));
         }
       else
         {
-          a[j] = ((char) ((buf.array[i-1]+ ((unsigned int) ('A')))-10));
+          const_cast<char *>(a)[j] = ((char) ((buf.array[i-1]+ ((unsigned int) ('A')))-10));
         }
       j += 1;
       i -= 1;
     }
   if (j <= Higha)
     {
-      a[j] = ASCII_nul;
+      const_cast<char *>(a)[j] = ASCII_nul;
     }
 }
 
@@ -349,24 +349,24 @@ extern "C" void NumberIO_IntToStr (int x, unsigned int n, char *a, unsigned int
   Higha = _a_high;
   while ((n > i) && (j <= Higha))
     {
-      a[j] = ' ';
+      const_cast<char *>(a)[j] = ' ';
       j += 1;
       n -= 1;
     }
   if (Negative)
     {
-      a[j] = '-';
+      const_cast<char *>(a)[j] = '-';
       j += 1;
     }
   while ((i != 0) && (j <= Higha))
     {
-      a[j] = ((char) (buf.array[i-1]+ ((unsigned int) ('0'))));
+      const_cast<char *>(a)[j] = ((char) (buf.array[i-1]+ ((unsigned int) ('0'))));
       j += 1;
       i -= 1;
     }
   if (j <= Higha)
     {
-      a[j] = ASCII_nul;
+      const_cast<char *>(a)[j] = ASCII_nul;
     }
 }
 
@@ -490,19 +490,19 @@ extern "C" void NumberIO_OctToStr (unsigned int x, unsigned int n, char *a, unsi
   Higha = _a_high;
   while ((n > i) && (j <= Higha))
     {
-      a[j] = ' ';
+      const_cast<char *>(a)[j] = ' ';
       j += 1;
       n -= 1;
     }
   while ((i > 0) && (j <= Higha))
     {
-      a[j] = ((char) (buf.array[i-1]+ ((unsigned int) ('0'))));
+      const_cast<char *>(a)[j] = ((char) (buf.array[i-1]+ ((unsigned int) ('0'))));
       j += 1;
       i -= 1;
     }
   if (j <= Higha)
     {
-      a[j] = ASCII_nul;
+      const_cast<char *>(a)[j] = ASCII_nul;
     }
 }
 
@@ -567,19 +567,19 @@ extern "C" void NumberIO_BinToStr (unsigned int x, unsigned int n, char *a, unsi
   Higha = _a_high;
   while ((n > i) && (j <= Higha))
     {
-      a[j] = ' ';
+      const_cast<char *>(a)[j] = ' ';
       j += 1;
       n -= 1;
     }
   while ((i > 0) && (j <= Higha))
     {
-      a[j] = ((char) (buf.array[i-1]+ ((unsigned int) ('0'))));
+      const_cast<char *>(a)[j] = ((char) (buf.array[i-1]+ ((unsigned int) ('0'))));
       j += 1;
       i -= 1;
     }
   if (j <= Higha)
     {
-      a[j] = ASCII_nul;
+      const_cast<char *>(a)[j] = ASCII_nul;
     }
 }
 
@@ -768,10 +768,10 @@ extern "C" void NumberIO_StrToOctInt (const char *a_, unsigned int _a_high, int
     }
 }
 
-extern "C" void _M2_NumberIO_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
+extern "C" void _M2_NumberIO_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
 {
 }
 
-extern "C" void _M2_NumberIO_fini (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
+extern "C" void _M2_NumberIO_fini (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
 {
 }
index 4e0b41e491ed5490ac9bd9c77e178890e1296e49..9bc2a83abd4522978afa953cf6bcb813444138e4 100644 (file)
@@ -42,9 +42,9 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #   undef NULL
 #   define NULL 0
 #endif
-#define _PushBackInput_H
 #define _PushBackInput_C
 
+#include "GPushBackInput.h"
 #   include "GFIO.h"
 #   include "GDynamicStrings.h"
 #   include "GASCII.h"
@@ -478,12 +478,12 @@ extern "C" unsigned int PushBackInput_GetCurrentLine (void)
   __builtin_unreachable ();
 }
 
-extern "C" void _M2_PushBackInput_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
+extern "C" void _M2_PushBackInput_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
 {
   PushBackInput_SetDebug (false);
   Init ();
 }
 
-extern "C" void _M2_PushBackInput_fini (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
+extern "C" void _M2_PushBackInput_fini (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
 {
 }
index e7b35cfeed8a339055b2d2682feb8d2e79eed7cd..a0eff3ecc8af676edc79dda941ce828975cf3022 100644 (file)
@@ -47,9 +47,9 @@ extern void throw (unsigned int);
 #   undef NULL
 #   define NULL 0
 #endif
-#define _RTExceptions_H
 #define _RTExceptions_C
 
+#include "GRTExceptions.h"
 #   include "GASCII.h"
 #   include "GStrLib.h"
 #   include "GStorage.h"
@@ -72,17 +72,14 @@ typedef struct RTExceptions__T3_r RTExceptions__T3;
 
 typedef RTExceptions__T3 *RTExceptions_Handler;
 
-typedef RTExceptions__T1 *RTExceptions_EHBlock;
-
-typedef void (*RTExceptions_ProcedureHandler_t) (void);
-struct RTExceptions_ProcedureHandler_p { RTExceptions_ProcedureHandler_t proc; };
+typedef RTExceptions__T1 *RTExceptions_EHBlock__opaque;
 
 struct RTExceptions__T2_a { char array[MaxBuffer+1]; };
 struct RTExceptions__T1_r {
                             RTExceptions__T2 buffer;
                             unsigned int number;
                             RTExceptions_Handler handlers;
-                            RTExceptions_EHBlock right;
+                            RTExceptions_EHBlock__opaque right;
                           };
 
 struct RTExceptions__T3_r {
@@ -95,8 +92,8 @@ struct RTExceptions__T3_r {
 
 static bool inException;
 static RTExceptions_Handler freeHandler;
-static RTExceptions_EHBlock freeEHB;
-static RTExceptions_EHBlock currentEHB;
+static RTExceptions_EHBlock__opaque freeEHB;
+static RTExceptions_EHBlock__opaque currentEHB;
 static void * currentSource;
 
 /*
@@ -233,7 +230,7 @@ static void ErrorString (const char *a_, unsigned int _a_high);
    findHandler -
 */
 
-static RTExceptions_Handler findHandler (RTExceptions_EHBlock e, unsigned int number);
+static RTExceptions_Handler findHandler (RTExceptions_EHBlock__opaque e, unsigned int number);
 
 /*
    InvokeHandler - invokes the associated handler for the current
@@ -286,7 +283,7 @@ static void addNum (unsigned int n, unsigned int *i);
    New - returns a new EHBlock.
 */
 
-static RTExceptions_EHBlock New (void);
+static RTExceptions_EHBlock__opaque New (void);
 
 /*
    NewHandler - returns a new handler.
@@ -322,7 +319,7 @@ static void SubHandler (RTExceptions_Handler h);
    AddHandler - add, e, to the end of the list of handlers.
 */
 
-static void AddHandler (RTExceptions_EHBlock e, RTExceptions_Handler h);
+static void AddHandler (RTExceptions_EHBlock__opaque e, RTExceptions_Handler h);
 
 /*
    indexf - raise an index out of bounds exception.
@@ -439,7 +436,7 @@ static void ErrorString (const char *a_, unsigned int _a_high)
   /* make a local copy of each unbounded array.  */
   memcpy (a, a_, _a_high+1);
 
-  n = static_cast<int> (libc_write (2, &a, static_cast<size_t> (StrLib_StrLen ((const char *) a, _a_high))));
+  n = static_cast<int> (libc_write (2, const_cast<void*> (static_cast<const void*>(a)), static_cast<size_t> (StrLib_StrLen ((const char *) a, _a_high))));
 }
 
 
@@ -447,7 +444,7 @@ static void ErrorString (const char *a_, unsigned int _a_high)
    findHandler -
 */
 
-static RTExceptions_Handler findHandler (RTExceptions_EHBlock e, unsigned int number)
+static RTExceptions_Handler findHandler (RTExceptions_EHBlock__opaque e, unsigned int number)
 {
   RTExceptions_Handler h;
 
@@ -540,7 +537,7 @@ static void * stripPath (void * s)
           p += 1;
         }
     }
-  return reinterpret_cast<void *> (f);
+  return static_cast<void *> (f);
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -605,9 +602,9 @@ static void addNum (unsigned int n, unsigned int *i)
    New - returns a new EHBlock.
 */
 
-static RTExceptions_EHBlock New (void)
+static RTExceptions_EHBlock__opaque New (void)
 {
-  RTExceptions_EHBlock e;
+  RTExceptions_EHBlock__opaque e;
 
   if (freeEHB == NULL)
     {
@@ -707,7 +704,7 @@ static void SubHandler (RTExceptions_Handler h)
    AddHandler - add, e, to the end of the list of handlers.
 */
 
-static void AddHandler (RTExceptions_EHBlock e, RTExceptions_Handler h)
+static void AddHandler (RTExceptions_EHBlock__opaque e, RTExceptions_Handler h)
 {
   h->right = e->handlers;
   h->left = e->handlers->left;
@@ -722,7 +719,7 @@ static void AddHandler (RTExceptions_EHBlock e, RTExceptions_Handler h)
 
 static void indexf (void * a)
 {
-  RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_indexException)), const_cast<void*> (reinterpret_cast<const void*>("../../gcc/m2/gm2-libs/RTExceptions.mod")), 614, 9, const_cast<void*> (reinterpret_cast<const void*>("indexf")), const_cast<void*> (reinterpret_cast<const void*>("array index out of bounds")));
+  RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_indexException)), const_cast<void*> (static_cast<const void*>("../../gcc/m2/gm2-libs/RTExceptions.mod")), 614, 9, const_cast<void*> (static_cast<const void*>("indexf")), const_cast<void*> (static_cast<const void*>("array index out of bounds")));
 }
 
 
@@ -732,7 +729,7 @@ static void indexf (void * a)
 
 static void range (void * a)
 {
-  RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_rangeException)), const_cast<void*> (reinterpret_cast<const void*>("../../gcc/m2/gm2-libs/RTExceptions.mod")), 626, 9, const_cast<void*> (reinterpret_cast<const void*>("range")), const_cast<void*> (reinterpret_cast<const void*>("assignment out of range")));
+  RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_rangeException)), const_cast<void*> (static_cast<const void*>("../../gcc/m2/gm2-libs/RTExceptions.mod")), 626, 9, const_cast<void*> (static_cast<const void*>("range")), const_cast<void*> (static_cast<const void*>("assignment out of range")));
 }
 
 
@@ -742,7 +739,7 @@ static void range (void * a)
 
 static void casef (void * a)
 {
-  RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_caseSelectException)), const_cast<void*> (reinterpret_cast<const void*>("../../gcc/m2/gm2-libs/RTExceptions.mod")), 638, 9, const_cast<void*> (reinterpret_cast<const void*>("casef")), const_cast<void*> (reinterpret_cast<const void*>("case selector out of range")));
+  RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_caseSelectException)), const_cast<void*> (static_cast<const void*>("../../gcc/m2/gm2-libs/RTExceptions.mod")), 638, 9, const_cast<void*> (static_cast<const void*>("casef")), const_cast<void*> (static_cast<const void*>("case selector out of range")));
 }
 
 
@@ -752,7 +749,7 @@ static void casef (void * a)
 
 static void invalidloc (void * a)
 {
-  RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_invalidLocation)), const_cast<void*> (reinterpret_cast<const void*>("../../gcc/m2/gm2-libs/RTExceptions.mod")), 650, 9, const_cast<void*> (reinterpret_cast<const void*>("invalidloc")), const_cast<void*> (reinterpret_cast<const void*>("invalid address referenced")));
+  RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_invalidLocation)), const_cast<void*> (static_cast<const void*>("../../gcc/m2/gm2-libs/RTExceptions.mod")), 650, 9, const_cast<void*> (static_cast<const void*>("invalidloc")), const_cast<void*> (static_cast<const void*>("invalid address referenced")));
 }
 
 
@@ -762,7 +759,7 @@ static void invalidloc (void * a)
 
 static void function (void * a)
 {
-  RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_functionException)), const_cast<void*> (reinterpret_cast<const void*>("../../gcc/m2/gm2-libs/RTExceptions.mod")), 662, 9, const_cast<void*> (reinterpret_cast<const void*>("function")), const_cast<void*> (reinterpret_cast<const void*>("... function ... ")));  /* --fixme-- what has happened ?  */
+  RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_functionException)), const_cast<void*> (static_cast<const void*>("../../gcc/m2/gm2-libs/RTExceptions.mod")), 662, 9, const_cast<void*> (static_cast<const void*>("function")), const_cast<void*> (static_cast<const void*>("... function ... ")));  /* --fixme-- what has happened ?  */
 }
 
 
@@ -772,7 +769,7 @@ static void function (void * a)
 
 static void wholevalue (void * a)
 {
-  RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_wholeValueException)), const_cast<void*> (reinterpret_cast<const void*>("../../gcc/m2/gm2-libs/RTExceptions.mod")), 674, 9, const_cast<void*> (reinterpret_cast<const void*>("wholevalue")), const_cast<void*> (reinterpret_cast<const void*>("illegal whole value exception")));
+  RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_wholeValueException)), const_cast<void*> (static_cast<const void*>("../../gcc/m2/gm2-libs/RTExceptions.mod")), 674, 9, const_cast<void*> (static_cast<const void*>("wholevalue")), const_cast<void*> (static_cast<const void*>("illegal whole value exception")));
 }
 
 
@@ -782,7 +779,7 @@ static void wholevalue (void * a)
 
 static void wholediv (void * a)
 {
-  RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_wholeDivException)), const_cast<void*> (reinterpret_cast<const void*>("../../gcc/m2/gm2-libs/RTExceptions.mod")), 686, 9, const_cast<void*> (reinterpret_cast<const void*>("wholediv")), const_cast<void*> (reinterpret_cast<const void*>("illegal whole value exception")));
+  RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_wholeDivException)), const_cast<void*> (static_cast<const void*>("../../gcc/m2/gm2-libs/RTExceptions.mod")), 686, 9, const_cast<void*> (static_cast<const void*>("wholediv")), const_cast<void*> (static_cast<const void*>("illegal whole value exception")));
 }
 
 
@@ -792,7 +789,7 @@ static void wholediv (void * a)
 
 static void realvalue (void * a)
 {
-  RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_realValueException)), const_cast<void*> (reinterpret_cast<const void*>("../../gcc/m2/gm2-libs/RTExceptions.mod")), 698, 9, const_cast<void*> (reinterpret_cast<const void*>("realvalue")), const_cast<void*> (reinterpret_cast<const void*>("illegal real value exception")));
+  RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_realValueException)), const_cast<void*> (static_cast<const void*>("../../gcc/m2/gm2-libs/RTExceptions.mod")), 698, 9, const_cast<void*> (static_cast<const void*>("realvalue")), const_cast<void*> (static_cast<const void*>("illegal real value exception")));
 }
 
 
@@ -802,7 +799,7 @@ static void realvalue (void * a)
 
 static void realdiv (void * a)
 {
-  RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_realDivException)), const_cast<void*> (reinterpret_cast<const void*>("../../gcc/m2/gm2-libs/RTExceptions.mod")), 710, 9, const_cast<void*> (reinterpret_cast<const void*>("realdiv")), const_cast<void*> (reinterpret_cast<const void*>("real number division by zero exception")));
+  RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_realDivException)), const_cast<void*> (static_cast<const void*>("../../gcc/m2/gm2-libs/RTExceptions.mod")), 710, 9, const_cast<void*> (static_cast<const void*>("realdiv")), const_cast<void*> (static_cast<const void*>("real number division by zero exception")));
 }
 
 
@@ -812,7 +809,7 @@ static void realdiv (void * a)
 
 static void complexvalue (void * a)
 {
-  RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_complexValueException)), const_cast<void*> (reinterpret_cast<const void*>("../../gcc/m2/gm2-libs/RTExceptions.mod")), 722, 9, const_cast<void*> (reinterpret_cast<const void*>("complexvalue")), const_cast<void*> (reinterpret_cast<const void*>("illegal complex value exception")));
+  RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_complexValueException)), const_cast<void*> (static_cast<const void*>("../../gcc/m2/gm2-libs/RTExceptions.mod")), 722, 9, const_cast<void*> (static_cast<const void*>("complexvalue")), const_cast<void*> (static_cast<const void*>("illegal complex value exception")));
 }
 
 
@@ -822,7 +819,7 @@ static void complexvalue (void * a)
 
 static void complexdiv (void * a)
 {
-  RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_complexDivException)), const_cast<void*> (reinterpret_cast<const void*>("../../gcc/m2/gm2-libs/RTExceptions.mod")), 734, 9, const_cast<void*> (reinterpret_cast<const void*>("complexdiv")), const_cast<void*> (reinterpret_cast<const void*>("complex number division by zero exception")));
+  RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_complexDivException)), const_cast<void*> (static_cast<const void*>("../../gcc/m2/gm2-libs/RTExceptions.mod")), 734, 9, const_cast<void*> (static_cast<const void*>("complexdiv")), const_cast<void*> (static_cast<const void*>("complex number division by zero exception")));
 }
 
 
@@ -832,7 +829,7 @@ static void complexdiv (void * a)
 
 static void protection (void * a)
 {
-  RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_protException)), const_cast<void*> (reinterpret_cast<const void*>("../../gcc/m2/gm2-libs/RTExceptions.mod")), 746, 9, const_cast<void*> (reinterpret_cast<const void*>("protection")), const_cast<void*> (reinterpret_cast<const void*>("protection exception")));
+  RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_protException)), const_cast<void*> (static_cast<const void*>("../../gcc/m2/gm2-libs/RTExceptions.mod")), 746, 9, const_cast<void*> (static_cast<const void*>("protection")), const_cast<void*> (static_cast<const void*>("protection exception")));
 }
 
 
@@ -842,7 +839,7 @@ static void protection (void * a)
 
 static void systemf (void * a)
 {
-  RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_sysException)), const_cast<void*> (reinterpret_cast<const void*>("../../gcc/m2/gm2-libs/RTExceptions.mod")), 758, 9, const_cast<void*> (reinterpret_cast<const void*>("systemf")), const_cast<void*> (reinterpret_cast<const void*>("system exception")));
+  RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_sysException)), const_cast<void*> (static_cast<const void*>("../../gcc/m2/gm2-libs/RTExceptions.mod")), 758, 9, const_cast<void*> (static_cast<const void*>("systemf")), const_cast<void*> (static_cast<const void*>("system exception")));
 }
 
 
@@ -852,7 +849,7 @@ static void systemf (void * a)
 
 static void coroutine (void * a)
 {
-  RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_coException)), const_cast<void*> (reinterpret_cast<const void*>("../../gcc/m2/gm2-libs/RTExceptions.mod")), 770, 9, const_cast<void*> (reinterpret_cast<const void*>("coroutine")), const_cast<void*> (reinterpret_cast<const void*>("coroutine exception")));
+  RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_coException)), const_cast<void*> (static_cast<const void*>("../../gcc/m2/gm2-libs/RTExceptions.mod")), 770, 9, const_cast<void*> (static_cast<const void*>("coroutine")), const_cast<void*> (static_cast<const void*>("coroutine exception")));
 }
 
 
@@ -862,7 +859,7 @@ static void coroutine (void * a)
 
 static void exception (void * a)
 {
-  RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_exException)), const_cast<void*> (reinterpret_cast<const void*>("../../gcc/m2/gm2-libs/RTExceptions.mod")), 782, 9, const_cast<void*> (reinterpret_cast<const void*>("exception")), const_cast<void*> (reinterpret_cast<const void*>("exception exception")));
+  RTExceptions_Raise ( ((unsigned int) (M2EXCEPTION_exException)), const_cast<void*> (static_cast<const void*>("../../gcc/m2/gm2-libs/RTExceptions.mod")), 782, 9, const_cast<void*> (static_cast<const void*>("exception")), const_cast<void*> (static_cast<const void*>("exception exception")));
 }
 
 
@@ -874,8 +871,8 @@ static void Init (void)
 {
   inException = false;
   freeHandler = NULL;
-  freeEHB = NULL;
-  currentEHB = RTExceptions_InitExceptionBlock ();
+  freeEHB = static_cast<RTExceptions_EHBlock__opaque> (NULL);
+  currentEHB = static_cast<RTExceptions_EHBlock__opaque> (RTExceptions_InitExceptionBlock ());
   currentSource = NULL;
   RTExceptions_BaseExceptionsThrow ();
   SysExceptions_InitExceptionHandlers ((SysExceptions_PROCEXCEPTION) {(SysExceptions_PROCEXCEPTION_t) indexf}, (SysExceptions_PROCEXCEPTION) {(SysExceptions_PROCEXCEPTION_t) range}, (SysExceptions_PROCEXCEPTION) {(SysExceptions_PROCEXCEPTION_t) casef}, (SysExceptions_PROCEXCEPTION) {(SysExceptions_PROCEXCEPTION_t) invalidloc}, (SysExceptions_PROCEXCEPTION) {(SysExceptions_PROCEXCEPTION_t) function}, (SysExceptions_PROCEXCEPTION) {(SysExceptions_PROCEXCEPTION_t) wholevalue}, (SysExceptions_PROCEXCEPTION) {(SysExceptions_PROCEXCEPTION_t) wholediv}, (SysExceptions_PROCEXCEPTION) {(SysExceptions_PROCEXCEPTION_t) realvalue}, (SysExceptions_PROCEXCEPTION) {(SysExceptions_PROCEXCEPTION_t) realdiv}, (SysExceptions_PROCEXCEPTION) {(SysExceptions_PROCEXCEPTION_t) complexvalue}, (SysExceptions_PROCEXCEPTION) {(SysExceptions_PROCEXCEPTION_t) complexdiv}, (SysExceptions_PROCEXCEPTION) {(SysExceptions_PROCEXCEPTION_t) protection}, (SysExceptions_PROCEXCEPTION) {(SysExceptions_PROCEXCEPTION_t) systemf}, (SysExceptions_PROCEXCEPTION) {(SysExceptions_PROCEXCEPTION_t) coroutine}, (SysExceptions_PROCEXCEPTION) {(SysExceptions_PROCEXCEPTION_t) exception});
@@ -889,11 +886,11 @@ static void Init (void)
 static void TidyUp (void)
 {
   RTExceptions_Handler f;
-  RTExceptions_EHBlock e;
+  RTExceptions_EHBlock__opaque e;
 
   if (currentEHB != NULL)
     {
-      currentEHB = RTExceptions_KillExceptionBlock (currentEHB);
+      currentEHB = static_cast<RTExceptions_EHBlock__opaque> (RTExceptions_KillExceptionBlock (static_cast<RTExceptions_EHBlock> (currentEHB)));
     }
   while (freeHandler != NULL)
     {
@@ -953,7 +950,7 @@ extern "C" void RTExceptions_Raise (unsigned int number, void * file, unsigned i
 
 extern "C" void RTExceptions_SetExceptionBlock (RTExceptions_EHBlock source)
 {
-  currentEHB = source;
+  currentEHB = static_cast<RTExceptions_EHBlock__opaque> (source);
 }
 
 
@@ -963,7 +960,7 @@ extern "C" void RTExceptions_SetExceptionBlock (RTExceptions_EHBlock source)
 
 extern "C" RTExceptions_EHBlock RTExceptions_GetExceptionBlock (void)
 {
-  return currentEHB;
+  return static_cast<RTExceptions_EHBlock> (currentEHB);
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -975,7 +972,7 @@ extern "C" RTExceptions_EHBlock RTExceptions_GetExceptionBlock (void)
 
 extern "C" void * RTExceptions_GetTextBuffer (RTExceptions_EHBlock e)
 {
-  return &e->buffer;
+  return &static_cast<RTExceptions_EHBlock__opaque> (e)->buffer;
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -987,7 +984,7 @@ extern "C" void * RTExceptions_GetTextBuffer (RTExceptions_EHBlock e)
 
 extern "C" unsigned int RTExceptions_GetTextBufferSize (RTExceptions_EHBlock e)
 {
-  return sizeof (e->buffer);
+  return sizeof (static_cast<RTExceptions_EHBlock__opaque> (e)->buffer);
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -1000,7 +997,7 @@ extern "C" unsigned int RTExceptions_GetTextBufferSize (RTExceptions_EHBlock e)
 
 extern "C" unsigned int RTExceptions_GetNumber (RTExceptions_EHBlock source)
 {
-  return source->number;
+  return static_cast<RTExceptions_EHBlock__opaque> (source)->number;
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -1012,7 +1009,7 @@ extern "C" unsigned int RTExceptions_GetNumber (RTExceptions_EHBlock source)
 
 extern "C" RTExceptions_EHBlock RTExceptions_InitExceptionBlock (void)
 {
-  RTExceptions_EHBlock e;
+  RTExceptions_EHBlock__opaque e;
 
   e = New ();
   e->number = UINT_MAX;
@@ -1020,7 +1017,7 @@ extern "C" RTExceptions_EHBlock RTExceptions_InitExceptionBlock (void)
   e->handlers->right = e->handlers;  /* add the dummy onto the head  */
   e->handlers->left = e->handlers;
   e->right = e;
-  return e;
+  return static_cast<RTExceptions_EHBlock> (e);
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -1032,10 +1029,10 @@ extern "C" RTExceptions_EHBlock RTExceptions_InitExceptionBlock (void)
 
 extern "C" RTExceptions_EHBlock RTExceptions_KillExceptionBlock (RTExceptions_EHBlock e)
 {
-  e->handlers = KillHandlers (e->handlers);
-  e->right = freeEHB;
-  freeEHB = e;
-  return NULL;
+  static_cast<RTExceptions_EHBlock__opaque> (e)->handlers = KillHandlers (static_cast<RTExceptions_EHBlock__opaque> (e)->handlers);
+  static_cast<RTExceptions_EHBlock__opaque> (e)->right = freeEHB;
+  freeEHB = static_cast<RTExceptions_EHBlock__opaque> (e);
+  return static_cast<RTExceptions_EHBlock> (NULL);
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -1050,7 +1047,7 @@ extern "C" void RTExceptions_PushHandler (RTExceptions_EHBlock e, unsigned int n
   RTExceptions_Handler h;
   RTExceptions_Handler i;
 
-  h = findHandler (e, number);
+  h = findHandler (static_cast<RTExceptions_EHBlock__opaque> (e), number);
   if (h == NULL)
     {
       i = InitHandler (NewHandler (), NULL, NULL, NULL, number, p);
@@ -1063,7 +1060,7 @@ extern "C" void RTExceptions_PushHandler (RTExceptions_EHBlock e, unsigned int n
       i = InitHandler (NewHandler (), NULL, NULL, h, number, p);
     }
   /* add new handler  */
-  AddHandler (e, i);
+  AddHandler (static_cast<RTExceptions_EHBlock__opaque> (e), i);
 }
 
 
@@ -1076,14 +1073,14 @@ extern "C" void RTExceptions_PopHandler (RTExceptions_EHBlock e, unsigned int nu
 {
   RTExceptions_Handler h;
 
-  h = findHandler (e, number);
+  h = findHandler (static_cast<RTExceptions_EHBlock__opaque> (e), number);
   if (h != NULL)
     {
       /* remove, h,  */
       SubHandler (h);
       if (h->stack != NULL)
         {
-          AddHandler (e, h->stack);
+          AddHandler (static_cast<RTExceptions_EHBlock__opaque> (e), h->stack);
         }
       h = KillHandler (h);
     }
@@ -1098,11 +1095,11 @@ extern "C" void RTExceptions_PopHandler (RTExceptions_EHBlock e, unsigned int nu
 
 extern "C" void RTExceptions_DefaultErrorCatch (void)
 {
-  RTExceptions_EHBlock e;
+  RTExceptions_EHBlock__opaque e;
   int n;
 
-  e = RTExceptions_GetExceptionBlock ();
-  n = static_cast<int> (libc_write (2, RTExceptions_GetTextBuffer (e), libc_strlen (RTExceptions_GetTextBuffer (e))));
+  e = static_cast<RTExceptions_EHBlock__opaque> (RTExceptions_GetExceptionBlock ());
+  n = static_cast<int> (libc_write (2, RTExceptions_GetTextBuffer (static_cast<RTExceptions_EHBlock> (e)), libc_strlen (RTExceptions_GetTextBuffer (static_cast<RTExceptions_EHBlock> (e)))));
   M2RTS_HALT (-1);
   __builtin_unreachable ();
 }
@@ -1184,7 +1181,7 @@ extern "C" RTExceptions_EHBlock RTExceptions_GetBaseExceptionBlock (void)
     }
   else
     {
-      return currentEHB;
+      return static_cast<RTExceptions_EHBlock> (currentEHB);
     }
   ReturnException ("../../gcc/m2/gm2-libs/RTExceptions.def", 25, 1);
   __builtin_unreachable ();
@@ -1212,12 +1209,12 @@ extern "C" void * RTExceptions_GetExceptionSource (void)
   __builtin_unreachable ();
 }
 
-extern "C" void _M2_RTExceptions_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
+extern "C" void _M2_RTExceptions_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
 {
   Init ();
 }
 
-extern "C" void _M2_RTExceptions_fini (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
+extern "C" void _M2_RTExceptions_fini (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
 {
   TidyUp ();
 }
index 236dbf4af651cd8c049254335a01c616c6cdb998..11b4228074a4b1790a632f6d9aef1f5d01c46641 100644 (file)
@@ -48,9 +48,9 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #   undef NULL
 #   define NULL 0
 #endif
-#define _RTint_H
 #define _RTint_C
 
+#include "GRTint.h"
 #   include "GM2RTS.h"
 #   include "GStorage.h"
 #   include "GRTco.h"
@@ -72,13 +72,10 @@ typedef struct RTint__T2_a RTint__T2;
 
 typedef enum {RTint_input, RTint_output, RTint_time} RTint_VectorType;
 
-typedef void (*RTint_DispatchVector_t) (unsigned int, unsigned int, void *);
-struct RTint_DispatchVector_p { RTint_DispatchVector_t proc; };
-
 struct RTint__T1_r {
                      RTint_VectorType type;
                      unsigned int priority;
-                     void *arg;
+                     void * arg;
                      RTint_Vector pending;
                      RTint_Vector exists;
                      unsigned int no;
@@ -354,7 +351,7 @@ static void AddFd (Selective_SetOfFd *set, int *max, int fd)
 {
   if (fd < 0)
     {
-      return ;
+      return;
     }
   (*max) = Max (fd, (*max));
   if ((*set) == NULL)
@@ -1011,7 +1008,7 @@ extern "C" void RTint_Listen (bool untilInterrupt, RTint_DispatchVector call, un
           /* no file descriptors to be selected upon.  */
           timeval = Selective_KillTime (timeval);
           RTco_signal (lock);
-          return ;
+          return;
         }
       else
         {
@@ -1140,11 +1137,11 @@ extern "C" void RTint_Init (void)
     }
 }
 
-extern "C" void _M2_RTint_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
+extern "C" void _M2_RTint_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
 {
   RTint_Init ();
 }
 
-extern "C" void _M2_RTint_fini (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
+extern "C" void _M2_RTint_fini (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
 {
 }
index 3424fbcc9988cada8938afd92338c8bda07df275..042dbe3fb3f19bac11320f8b20cd3c7dc88bf473 100644 (file)
@@ -46,9 +46,9 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #   undef NULL
 #   define NULL 0
 #endif
-#define _SArgs_H
 #define _SArgs_C
 
+#include "GSArgs.h"
 #   include "GSYSTEM.h"
 #   include "GUnixArgs.h"
 #   include "GDynamicStrings.h"
@@ -119,10 +119,10 @@ extern "C" unsigned int SArgs_Narg (void)
   __builtin_unreachable ();
 }
 
-extern "C" void _M2_SArgs_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
+extern "C" void _M2_SArgs_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
 {
 }
 
-extern "C" void _M2_SArgs_fini (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
+extern "C" void _M2_SArgs_fini (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
 {
 }
index 3c59d50f0d3eddd47744159af9c59522d66d1d6b..b568cce23ebf317ef7317119fbaeb1196cb1cc41 100644 (file)
@@ -38,9 +38,9 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #   undef NULL
 #   define NULL 0
 #endif
-#define _SFIO_H
 #define _SFIO_C
 
+#include "GSFIO.h"
 #   include "GASCII.h"
 #   include "GDynamicStrings.h"
 #   include "GFIO.h"
@@ -207,10 +207,10 @@ extern "C" DynamicStrings_String SFIO_ReadS (FIO_File file)
   __builtin_unreachable ();
 }
 
-extern "C" void _M2_SFIO_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
+extern "C" void _M2_SFIO_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
 {
 }
 
-extern "C" void _M2_SFIO_fini (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
+extern "C" void _M2_SFIO_fini (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
 {
 }
index bf25ba25ee35cbd31a1b33b7ebcdd7ce2da9ade0..c9d3774ec0615dcaba812a73957cd325d14b190d 100644 (file)
@@ -35,9 +35,9 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #   endif
 
 #   include "Gmcrts.h"
-#define _StdIO_H
 #define _StdIO_C
 
+#include "GStdIO.h"
 #   include "GIO.h"
 #   include "GM2RTS.h"
 
@@ -50,12 +50,6 @@ typedef struct StdIO__T1_a StdIO__T1;
 
 typedef struct StdIO__T2_a StdIO__T2;
 
-typedef void (*StdIO_ProcWrite_t) (char);
-struct StdIO_ProcWrite_p { StdIO_ProcWrite_t proc; };
-
-typedef void (*StdIO_ProcRead_t) (char *);
-struct StdIO_ProcRead_p { StdIO_ProcRead_t proc; };
-
 struct StdIO__T1_a { StdIO_ProcWrite array[MaxStack+1]; };
 struct StdIO__T2_a { StdIO_ProcRead array[MaxStack+1]; };
 static StdIO__T1 StackW;
@@ -257,7 +251,7 @@ extern "C" StdIO_ProcRead StdIO_GetCurrentInput (void)
   __builtin_unreachable ();
 }
 
-extern "C" void _M2_StdIO_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
+extern "C" void _M2_StdIO_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
 {
   StackWPtr = 0;
   StackRPtr = 0;
@@ -265,6 +259,6 @@ extern "C" void _M2_StdIO_init (__attribute__((unused)) int argc,__attribute__((
   StdIO_PushInput ((StdIO_ProcRead) {(StdIO_ProcRead_t) IO_Read});
 }
 
-extern "C" void _M2_StdIO_fini (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
+extern "C" void _M2_StdIO_fini (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
 {
 }
index c5657cf5a070ac06ed074d77ed8af3e0e90990e5..67e7a8b7274baf3266c47fa9e3a62ceb20d65e23 100644 (file)
@@ -34,9 +34,9 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
        typedef struct { PROC_t proc; } PROC;
 #   endif
 
-#define _Storage_H
 #define _Storage_C
 
+#include "GStorage.h"
 #   include "GSysStorage.h"
 
 extern "C" void Storage_ALLOCATE (void * *a, unsigned int Size);
@@ -66,10 +66,10 @@ extern "C" bool Storage_Available (unsigned int Size)
   __builtin_unreachable ();
 }
 
-extern "C" void _M2_Storage_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
+extern "C" void _M2_Storage_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
 {
 }
 
-extern "C" void _M2_Storage_fini (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
+extern "C" void _M2_Storage_fini (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
 {
 }
index 5e756b1e0e4e9091fdb10e44d9304068a4b6076a..9492774596ba47c43d95072d7b25b6c9d4ae8024 100644 (file)
@@ -34,9 +34,9 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
        typedef struct { PROC_t proc; } PROC;
 #   endif
 
-#define _StrCase_H
 #define _StrCase_C
 
+#include "GStrCase.h"
 #   include "GASCII.h"
 #   include "GStrLib.h"
 
@@ -92,12 +92,12 @@ extern "C" void StrCase_StrToUpperCase (const char *a_, unsigned int _a_high, ch
   i = 0;
   while (((i < higha) && (a[i] != ASCII_nul)) && (i < highb))
     {
-      b[i] = StrCase_Cap (a[i]);
+      const_cast<char *>(b)[i] = StrCase_Cap (a[i]);
       i += 1;
     }
   if (i < highb)
     {
-      b[i] = ASCII_nul;
+      const_cast<char *>(b)[i] = ASCII_nul;
     }
 }
 
@@ -122,12 +122,12 @@ extern "C" void StrCase_StrToLowerCase (const char *a_, unsigned int _a_high, ch
   i = 0;
   while (((i < higha) && (a[i] != ASCII_nul)) && (i < highb))
     {
-      b[i] = StrCase_Lower (a[i]);
+      const_cast<char *>(b)[i] = StrCase_Lower (a[i]);
       i += 1;
     }
   if (i < highb)
     {
-      b[i] = ASCII_nul;
+      const_cast<char *>(b)[i] = ASCII_nul;
     }
 }
 
@@ -167,10 +167,10 @@ extern "C" char StrCase_Lower (char ch)
   __builtin_unreachable ();
 }
 
-extern "C" void _M2_StrCase_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
+extern "C" void _M2_StrCase_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
 {
 }
 
-extern "C" void _M2_StrCase_fini (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
+extern "C" void _M2_StrCase_fini (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
 {
 }
index 46e433349bb1ae1ea55719668452f7e762f9fb5c..d0c6e2085cd1123e3d0b81caee8e80d7ee4d9d22 100644 (file)
@@ -38,9 +38,9 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #      define FALSE (1==0)
 #   endif
 
-#define _StrIO_H
 #define _StrIO_C
 
+#include "GStrIO.h"
 #   include "GASCII.h"
 #   include "GStdIO.h"
 #   include "Glibc.h"
@@ -204,16 +204,16 @@ extern "C" void StrIO_ReadString (char *a, unsigned int _a_high)
         /* avoid dangling else.  */
         if ((ch == ASCII_cr) || (ch == ASCII_lf))
           {
-            a[n] = ASCII_nul;
+            const_cast<char *>(a)[n] = ASCII_nul;
             n += 1;
           }
         else if (ch == ASCII_ff)
           {
             /* avoid dangling else.  */
-            a[0] = ch;
+            const_cast<char *>(a)[0] = ch;
             if (high > 0)
               {
-                a[1] = ASCII_nul;
+                const_cast<char *>(a)[1] = ASCII_nul;
               }
             ch = ASCII_cr;
           }
@@ -221,18 +221,18 @@ extern "C" void StrIO_ReadString (char *a, unsigned int _a_high)
           {
             /* avoid dangling else.  */
             Echo (ch);
-            a[n] = ch;
+            const_cast<char *>(a)[n] = ch;
             n += 1;
           }
         else if (ch == ASCII_eof)
           {
             /* avoid dangling else.  */
-            a[n] = ch;
+            const_cast<char *>(a)[n] = ch;
             n += 1;
             ch = ASCII_cr;
             if (n <= high)
               {
-                a[n] = ASCII_nul;
+                const_cast<char *>(a)[n] = ASCII_nul;
               }
           }
       }
@@ -267,12 +267,12 @@ extern "C" void StrIO_WriteString (const char *a_, unsigned int _a_high)
     }
 }
 
-extern "C" void _M2_StrIO_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
+extern "C" void _M2_StrIO_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
 {
   /* IsATTY := isatty()  */
   IsATTY = false;
 }
 
-extern "C" void _M2_StrIO_fini (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
+extern "C" void _M2_StrIO_fini (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
 {
 }
index 8e976b9056d996198da12ea5fd957cc4725bac29..dc6d0ff2aa0717ea8478e9aa4361917ed4d71a13 100644 (file)
@@ -42,9 +42,9 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #      define FALSE (1==0)
 #   endif
 
-#define _StrLib_H
 #define _StrLib_C
 
+#include "GStrLib.h"
 #   include "GASCII.h"
 
 
@@ -127,13 +127,13 @@ extern "C" void StrLib_StrConCat (const char *a_, unsigned int _a_high, const ch
   j = 0;
   while ((j < Highb) && (i <= Highc))
     {
-      c[i] = b[j];
+      const_cast<char *>(c)[i] = b[j];
       i += 1;
       j += 1;
     }
   if (i <= Highc)
     {
-      c[i] = ASCII_nul;
+      const_cast<char *>(c)[i] = ASCII_nul;
     }
 }
 
@@ -247,12 +247,12 @@ extern "C" void StrLib_StrCopy (const char *src_, unsigned int _src_high, char *
   HighDest = _dest_high;
   while ((n < HighSrc) && (n <= HighDest))
     {
-      dest[n] = src[n];
+      const_cast<char *>(dest)[n] = src[n];
       n += 1;
     }
   if (n <= HighDest)
     {
-      dest[n] = ASCII_nul;
+      const_cast<char *>(dest)[n] = ASCII_nul;
     }
 }
 
@@ -328,20 +328,20 @@ extern "C" void StrLib_StrRemoveWhitePrefix (const char *a_, unsigned int _a_hig
     }
   while ((i < higha) && (j <= highb))
     {
-      b[j] = a[i];
+      const_cast<char *>(b)[j] = a[i];
       i += 1;
       j += 1;
     }
   if (j <= highb)
     {
-      b[j] = ASCII_nul;
+      const_cast<char *>(b)[j] = ASCII_nul;
     }
 }
 
-extern "C" void _M2_StrLib_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
+extern "C" void _M2_StrLib_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
 {
 }
 
-extern "C" void _M2_StrLib_fini (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
+extern "C" void _M2_StrLib_fini (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
 {
 }
index 5d07bd133bab39353ae8ed3ee2c7f6821ed1803e..5ab4b00a2b78c355aba917b4bbc0e5cd4a873100 100644 (file)
@@ -46,9 +46,9 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #   undef NULL
 #   define NULL 0
 #endif
-#define _StringConvert_H
 #define _StringConvert_C
 
+#include "GStringConvert.h"
 #   include "GSYSTEM.h"
 #   include "Glibc.h"
 #   include "Glibm.h"
@@ -1995,10 +1995,10 @@ extern "C" DynamicStrings_String StringConvert_ToDecimalPlaces (DynamicStrings_S
   __builtin_unreachable ();
 }
 
-extern "C" void _M2_StringConvert_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
+extern "C" void _M2_StringConvert_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
 {
 }
 
-extern "C" void _M2_StringConvert_fini (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
+extern "C" void _M2_StringConvert_fini (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
 {
 }
index d1d958df7792d6d0bcbf4716d2865cdd231df619..1ef723074d464b81470ed87fd97a0ab18ba9e2de 100644 (file)
@@ -46,9 +46,9 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #   undef NULL
 #   define NULL 0
 #endif
-#define _SysStorage_H
 #define _SysStorage_C
 
+#include "GSysStorage.h"
 #   include "Glibc.h"
 #   include "GDebug.h"
 #   include "GSYSTEM.h"
@@ -224,12 +224,12 @@ extern "C" void SysStorage_Init (void)
 {
 }
 
-extern "C" void _M2_SysStorage_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
+extern "C" void _M2_SysStorage_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
 {
   callno = 0;
   if (enableTrace)
     {
-      trace = (libc_getenv (const_cast<void*> (reinterpret_cast<const void*>("M2DEBUG_SYSSTORAGE_trace")))) != NULL;
+      trace = (libc_getenv (const_cast<void*> (static_cast<const void*>("M2DEBUG_SYSSTORAGE_trace")))) != NULL;
     }
   else
     {
@@ -237,7 +237,7 @@ extern "C" void _M2_SysStorage_init (__attribute__((unused)) int argc,__attribut
     }
   if (enableZero)
     {
-      zero = (libc_getenv (const_cast<void*> (reinterpret_cast<const void*>("M2DEBUG_SYSSTORAGE_zero")))) != NULL;
+      zero = (libc_getenv (const_cast<void*> (static_cast<const void*>("M2DEBUG_SYSSTORAGE_zero")))) != NULL;
     }
   else
     {
@@ -245,6 +245,6 @@ extern "C" void _M2_SysStorage_init (__attribute__((unused)) int argc,__attribut
     }
 }
 
-extern "C" void _M2_SysStorage_fini (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
+extern "C" void _M2_SysStorage_fini (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
 {
 }
index 66b15233df93feb425e44533f398080c425f6f29..af7b7e40814e530d8cb5fa4b38a93ea815926afd 100644 (file)
@@ -38,9 +38,9 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #   undef NULL
 #   define NULL 0
 #endif
-#define _TimeString_H
 #define _TimeString_C
 
+#include "GTimeString.h"
 #   include "Gwrapc.h"
 #   include "GASCII.h"
 #   include "GSYSTEM.h"
@@ -72,21 +72,21 @@ extern "C" void TimeString_GetTimeString (char *a, unsigned int _a_high)
     {
       while ((i < _a_high) && ((*Addr) != ASCII_nul))
         {
-          a[i] = (*Addr);
+          const_cast<char *>(a)[i] = (*Addr);
           i += 1;
           Addr += 1;
         }
     }
   if (i < _a_high)
     {
-      a[i] = ASCII_nul;
+      const_cast<char *>(a)[i] = ASCII_nul;
     }
 }
 
-extern "C" void _M2_TimeString_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
+extern "C" void _M2_TimeString_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
 {
 }
 
-extern "C" void _M2_TimeString_fini (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
+extern "C" void _M2_TimeString_fini (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
 {
 }
index 238bcc87d50756be026b4e0da0aba5402292b8da..ca582f3ce43a98996a619a683efd2b234e70bc00 100644 (file)
@@ -42,9 +42,9 @@ along with GNU Modula-2; see the file COPYING3.  If not see
 #   undef NULL
 #   define NULL 0
 #endif
-#define _alists_H
 #define _alists_C
 
+#include "Galists.h"
 #   include "GStorage.h"
 
 typedef struct alists_performOperation_p alists_performOperation;
@@ -54,16 +54,13 @@ typedef struct alists__T1_r alists__T1;
 
 typedef struct alists__T2_a alists__T2;
 
-typedef alists__T1 *alists_alist;
-
-typedef void (*alists_performOperation_t) (void *);
-struct alists_performOperation_p { alists_performOperation_t proc; };
+typedef alists__T1 *alists_alist__opaque;
 
 struct alists__T2_a { void * array[MaxnoOfelements-1+1]; };
 struct alists__T1_r {
                       unsigned int noOfelements;
                       alists__T2 elements;
-                      alists_alist next;
+                      alists_alist__opaque next;
                     };
 
 
@@ -147,14 +144,14 @@ extern "C" bool alists_equalList (alists_alist left, alists_alist right);
    removeItem - remove an element at index, i, from the alist data type.
 */
 
-static void removeItem (alists_alist p, alists_alist l, unsigned int i);
+static void removeItem (alists_alist__opaque p, alists_alist__opaque l, unsigned int i);
 
 
 /*
    removeItem - remove an element at index, i, from the alist data type.
 */
 
-static void removeItem (alists_alist p, alists_alist l, unsigned int i)
+static void removeItem (alists_alist__opaque p, alists_alist__opaque l, unsigned int i)
 {
   l->noOfelements -= 1;
   while (i <= l->noOfelements)
@@ -176,12 +173,12 @@ static void removeItem (alists_alist p, alists_alist l, unsigned int i)
 
 extern "C" alists_alist alists_initList (void)
 {
-  alists_alist l;
+  alists_alist__opaque l;
 
   Storage_ALLOCATE ((void **) &l, sizeof (alists__T1));
   l->noOfelements = 0;
-  l->next = NULL;
-  return l;
+  l->next = static_cast<alists_alist__opaque> (NULL);
+  return static_cast<alists_alist> (l);
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -195,9 +192,9 @@ extern "C" void alists_killList (alists_alist *l)
 {
   if ((*l) != NULL)
     {
-      if ((*l)->next != NULL)
+      if (static_cast<alists_alist__opaque> ((*l))->next != NULL)
         {
-          alists_killList (&(*l)->next);
+          alists_killList (reinterpret_cast<alists_alist *> (&static_cast<alists_alist__opaque> ((*l))->next));
         }
       Storage_DEALLOCATE ((void **) &(*l), sizeof (alists__T1));
     }
@@ -210,21 +207,21 @@ extern "C" void alists_killList (alists_alist *l)
 
 extern "C" void alists_putItemIntoList (alists_alist l, void * c)
 {
-  if (l->noOfelements < MaxnoOfelements)
+  if (static_cast<alists_alist__opaque> (l)->noOfelements < MaxnoOfelements)
     {
-      l->noOfelements += 1;
-      l->elements.array[l->noOfelements-1] = c;
+      static_cast<alists_alist__opaque> (l)->noOfelements += 1;
+      static_cast<alists_alist__opaque> (l)->elements.array[static_cast<alists_alist__opaque> (l)->noOfelements-1] = c;
     }
-  else if (l->next != NULL)
+  else if (static_cast<alists_alist__opaque> (l)->next != NULL)
     {
       /* avoid dangling else.  */
-      alists_putItemIntoList (l->next, c);
+      alists_putItemIntoList (static_cast<alists_alist> (static_cast<alists_alist__opaque> (l)->next), c);
     }
   else
     {
       /* avoid dangling else.  */
-      l->next = alists_initList ();
-      alists_putItemIntoList (l->next, c);
+      static_cast<alists_alist__opaque> (l)->next = static_cast<alists_alist__opaque> (alists_initList ());
+      alists_putItemIntoList (static_cast<alists_alist> (static_cast<alists_alist__opaque> (l)->next), c);
     }
 }
 
@@ -237,17 +234,17 @@ extern "C" void * alists_getItemFromList (alists_alist l, unsigned int n)
 {
   while (l != NULL)
     {
-      if (n <= l->noOfelements)
+      if (n <= static_cast<alists_alist__opaque> (l)->noOfelements)
         {
-          return l->elements.array[n-1];
+          return static_cast<alists_alist__opaque> (l)->elements.array[n-1];
         }
       else
         {
-          n -= l->noOfelements;
+          n -= static_cast<alists_alist__opaque> (l)->noOfelements;
         }
-      l = l->next;
+      l = static_cast<alists_alist> (static_cast<alists_alist__opaque> (l)->next);
     }
-  return reinterpret_cast<void *> (0);
+  return static_cast<void *> (0);
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -270,9 +267,9 @@ extern "C" unsigned int alists_getIndexOfList (alists_alist l, void * c)
   else
     {
       i = 1;
-      while (i <= l->noOfelements)
+      while (i <= static_cast<alists_alist__opaque> (l)->noOfelements)
         {
-          if (l->elements.array[i-1] == c)
+          if (static_cast<alists_alist__opaque> (l)->elements.array[i-1] == c)
             {
               return i;
             }
@@ -281,7 +278,7 @@ extern "C" unsigned int alists_getIndexOfList (alists_alist l, void * c)
               i += 1;
             }
         }
-      return l->noOfelements+(alists_getIndexOfList (l->next, c));
+      return static_cast<alists_alist__opaque> (l)->noOfelements+(alists_getIndexOfList (static_cast<alists_alist> (static_cast<alists_alist__opaque> (l)->next), c));
     }
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
@@ -304,8 +301,8 @@ extern "C" unsigned int alists_noOfItemsInList (alists_alist l)
     {
       t = 0;
       do {
-        t += l->noOfelements;
-        l = l->next;
+        t += static_cast<alists_alist__opaque> (l)->noOfelements;
+        l = static_cast<alists_alist> (static_cast<alists_alist__opaque> (l)->next);
       } while (! (l == NULL));
       return t;
     }
@@ -335,33 +332,33 @@ extern "C" void alists_includeItemIntoList (alists_alist l, void * c)
 
 extern "C" void alists_removeItemFromList (alists_alist l, void * c)
 {
-  alists_alist p;
+  alists_alist__opaque p;
   unsigned int i;
   bool found;
 
   if (l != NULL)
     {
       found = false;
-      p = NULL;
+      p = static_cast<alists_alist__opaque> (NULL);
       do {
         i = 1;
-        while ((i <= l->noOfelements) && (l->elements.array[i-1] != c))
+        while ((i <= static_cast<alists_alist__opaque> (l)->noOfelements) && (static_cast<alists_alist__opaque> (l)->elements.array[i-1] != c))
           {
             i += 1;
           }
-        if ((i <= l->noOfelements) && (l->elements.array[i-1] == c))
+        if ((i <= static_cast<alists_alist__opaque> (l)->noOfelements) && (static_cast<alists_alist__opaque> (l)->elements.array[i-1] == c))
           {
             found = true;
           }
         else
           {
-            p = l;
-            l = l->next;
+            p = static_cast<alists_alist__opaque> (l);
+            l = static_cast<alists_alist> (static_cast<alists_alist__opaque> (l)->next);
           }
       } while (! ((l == NULL) || found));
       if (found)
         {
-          removeItem (p, l, i);
+          removeItem (p, static_cast<alists_alist__opaque> (l), i);
         }
     }
 }
@@ -377,9 +374,9 @@ extern "C" bool alists_isItemInList (alists_alist l, void * c)
 
   do {
     i = 1;
-    while (i <= l->noOfelements)
+    while (i <= static_cast<alists_alist__opaque> (l)->noOfelements)
       {
-        if (l->elements.array[i-1] == c)
+        if (static_cast<alists_alist__opaque> (l)->elements.array[i-1] == c)
           {
             return true;
           }
@@ -388,7 +385,7 @@ extern "C" bool alists_isItemInList (alists_alist l, void * c)
             i += 1;
           }
       }
-    l = l->next;
+    l = static_cast<alists_alist> (static_cast<alists_alist__opaque> (l)->next);
   } while (! (l == NULL));
   return false;
   /* static analysis guarentees a RETURN statement will be used before here.  */
@@ -421,19 +418,19 @@ extern "C" void alists_foreachItemInListDo (alists_alist l, alists_performOperat
 
 extern "C" alists_alist alists_duplicateList (alists_alist l)
 {
-  alists_alist m;
+  alists_alist__opaque m;
   unsigned int n;
   unsigned int i;
 
-  m = alists_initList ();
+  m = static_cast<alists_alist__opaque> (alists_initList ());
   n = alists_noOfItemsInList (l);
   i = 1;
   while (i <= n)
     {
-      alists_putItemIntoList (m, alists_getItemFromList (l, i));
+      alists_putItemIntoList (static_cast<alists_alist> (m), alists_getItemFromList (l, i));
       i += 1;
     }
-  return m;
+  return static_cast<alists_alist> (m);
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -475,10 +472,10 @@ extern "C" bool alists_equalList (alists_alist left, alists_alist right)
   __builtin_unreachable ();
 }
 
-extern "C" void _M2_alists_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
+extern "C" void _M2_alists_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
 {
 }
 
-extern "C" void _M2_alists_fini (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
+extern "C" void _M2_alists_fini (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
 {
 }
index bd43faebeac94782f5dfafb6819082a11af62645..183d671c8b35d1353f79c1353a52d86d3c66f987 100644 (file)
@@ -43,99 +43,36 @@ along with GNU Modula-2; see the file COPYING3.  If not see
 #   undef NULL
 #   define NULL 0
 #endif
-typedef unsigned int nameKey_Name;
+#define _decl_C
 
-#   define nameKey_NulName 0
-typedef struct symbolKey__T8_r symbolKey__T8;
-
-typedef symbolKey__T8 *symbolKey_symbolTree;
-
-typedef struct mcPretty_writeProc_p mcPretty_writeProc;
-
-typedef struct mcPretty_writeLnProc_p mcPretty_writeLnProc;
-
-typedef unsigned int FIO_File;
-
-extern FIO_File FIO_StdOut;
-#   define symbolKey_NulKey NULL
-typedef struct symbolKey_performOperation_p symbolKey_performOperation;
-
-#   define ASCII_tab ASCII_ht
-#   define ASCII_ht (char) 011
-#   define ASCII_lf ASCII_nl
-#   define ASCII_nl (char) 012
-typedef struct Indexing_IndexProcedure_p Indexing_IndexProcedure;
+#include "Gdecl.h"
+#   include "GASCII.h"
+#   include "GsymbolKey.h"
+#   include "GmcDebug.h"
+#   include "GStorage.h"
+#   include "GnameKey.h"
+#   include "GSFIO.h"
+#   include "GFIO.h"
+#   include "GDynamicStrings.h"
+#   include "GStringConvert.h"
+#   include "GmcOptions.h"
+#   include "GFormatStrings.h"
+#   include "Glibc.h"
+#   include "GmcMetaError.h"
+#   include "GmcError.h"
+#   include "GmcLexBuf.h"
+#   include "GmcComment.h"
+#   include "GStrLib.h"
+#   include "GmcPretty.h"
+#   include "GIndexing.h"
+#   include "Galists.h"
+#   include "Gwlists.h"
+#   include "Gkeyc.h"
+#   include "GmcStream.h"
+#   include "GM2RTS.h"
 
 typedef struct decl_isNodeF_p decl_isNodeF;
 
-#   define SYSTEM_BITSPERBYTE 8
-#   define SYSTEM_BYTESPERWORD 4
-typedef struct M2RTS_ArgCVEnvP_p M2RTS_ArgCVEnvP;
-
-typedef struct symbolKey_isSymbol_p symbolKey_isSymbol;
-
-#   define ASCII_nul (char) 000
-#   define ASCII_soh (char) 001
-#   define ASCII_stx (char) 002
-#   define ASCII_etx (char) 003
-#   define ASCII_eot (char) 004
-#   define ASCII_enq (char) 005
-#   define ASCII_ack (char) 006
-#   define ASCII_bel (char) 007
-#   define ASCII_bs (char) 010
-#   define ASCII_vt (char) 013
-#   define ASCII_np (char) 014
-#   define ASCII_cr (char) 015
-#   define ASCII_so (char) 016
-#   define ASCII_si (char) 017
-#   define ASCII_dle (char) 020
-#   define ASCII_dc1 (char) 021
-#   define ASCII_dc2 (char) 022
-#   define ASCII_dc3 (char) 023
-#   define ASCII_dc4 (char) 024
-#   define ASCII_nak (char) 025
-#   define ASCII_syn (char) 026
-#   define ASCII_etb (char) 027
-#   define ASCII_can (char) 030
-#   define ASCII_em (char) 031
-#   define ASCII_sub (char) 032
-#   define ASCII_esc (char) 033
-#   define ASCII_fs (char) 034
-#   define ASCII_gs (char) 035
-#   define ASCII_rs (char) 036
-#   define ASCII_us (char) 037
-#   define ASCII_sp (char) 040
-#   define ASCII_ff ASCII_np
-#   define ASCII_eof ASCII_eot
-#   define ASCII_del (char) 0177
-#   define ASCII_EOL ASCII_nl
-extern FIO_File FIO_StdErr;
-extern FIO_File FIO_StdIn;
-typedef long int libc_time_t;
-
-typedef struct libc_tm_r libc_tm;
-
-typedef libc_tm *libc_ptrToTM;
-
-typedef struct libc_timeb_r libc_timeb;
-
-typedef struct libc_exitP_p libc_exitP;
-
-typedef struct mcError__T11_r mcError__T11;
-
-typedef mcError__T11 *mcError_error;
-
-extern int mcLexBuf_currentinteger;
-extern unsigned int mcLexBuf_currentcolumn;
-extern void * mcLexBuf_currentstring;
-typedef struct alists_performOperation_p alists_performOperation;
-
-typedef struct wlists_performOperation_p wlists_performOperation;
-
-typedef struct StdIO_ProcWrite_p StdIO_ProcWrite;
-
-typedef struct StdIO_ProcRead_p StdIO_ProcRead;
-
 #   define indentation 3
 #   define indentationC 2
 #   define debugScopes false
@@ -146,8 +83,13 @@ typedef struct StdIO_ProcRead_p StdIO_ProcRead;
 #   define enableDefForCStrings false
 #   define enableMemsetOnAllocation true
 #   define forceQualified true
+#   define debugOpaque false
 typedef struct decl_nodeRec_r decl_nodeRec;
 
+typedef struct decl_opaqueCastState_r decl_opaqueCastState;
+
+typedef struct decl_opaquecastT_r decl_opaquecastT;
+
 typedef struct decl_intrinsicT_r decl_intrinsicT;
 
 typedef struct decl_fixupInfo_r decl_fixupInfo;
@@ -264,136 +206,24 @@ typedef struct decl_nodeProcedure_p decl_nodeProcedure;
 
 typedef struct decl_cnameT_r decl_cnameT;
 
-typedef struct decl__T15_r decl__T15;
+typedef struct decl__T1_r decl__T1;
 
-typedef decl__T15 *decl_group;
+typedef decl__T1 *decl_group;
 
-#   define MaxBuf 127
-#   define maxNoOfElements 5
-typedef enum {decl_explist, decl_funccall, decl_exit, decl_return, decl_stmtseq, decl_comment, decl_halt, decl_new, decl_dispose, decl_inc, decl_dec, decl_incl, decl_excl, decl_length, decl_nil, decl_true, decl_false, decl_address, decl_loc, decl_byte, decl_word, decl_csizet, decl_cssizet, decl_char, decl_cardinal, decl_longcard, decl_shortcard, decl_integer, decl_longint, decl_shortint, decl_real, decl_longreal, decl_shortreal, decl_bitset, decl_boolean, decl_proc, decl_ztype, decl_rtype, decl_complex, decl_longcomplex, decl_shortcomplex, decl_type, decl_record, decl_varient, decl_var, decl_enumeration, decl_subrange, decl_array, decl_subscript, decl_string, decl_const, decl_literal, decl_varparam, decl_param, decl_varargs, decl_optarg, decl_pointer, decl_recordfield, decl_varientfield, decl_enumerationfield, decl_set, decl_proctype, decl_procedure, decl_def, decl_imp, decl_module, decl_loop, decl_while, decl_for, decl_repeat, decl_case, decl_caselabellist, decl_caselist, decl_range, decl_assignment, decl_if, decl_elsif, decl_constexp, decl_neg, decl_cast, decl_val, decl_plus, decl_sub, decl_div, decl_mod, decl_mult, decl_divide, decl_in, decl_adr, decl_size, decl_tsize, decl_ord, decl_float, decl_trunc, decl_chr, decl_abs, decl_cap, decl_high, decl_throw, decl_unreachable, decl_cmplx, decl_re, decl_im, decl_min, decl_max, decl_componentref, decl_pointerref, decl_arrayref, decl_deref, decl_equal, decl_notequal, decl_less, decl_greater, decl_greequal, decl_lessequal, decl_lsl, decl_lsr, decl_lor, decl_land, decl_lnot, decl_lxor, decl_and, decl_or, decl_not, decl_identlist, decl_vardecl, decl_setvalue} decl_nodeT;
+typedef enum {decl_explist, decl_funccall, decl_exit, decl_return, decl_stmtseq, decl_comment, decl_halt, decl_new, decl_dispose, decl_inc, decl_dec, decl_incl, decl_excl, decl_length, decl_nil, decl_true, decl_false, decl_address, decl_loc, decl_byte, decl_word, decl_csizet, decl_cssizet, decl_char, decl_cardinal, decl_longcard, decl_shortcard, decl_integer, decl_longint, decl_shortint, decl_real, decl_longreal, decl_shortreal, decl_bitset, decl_boolean, decl_proc, decl_ztype, decl_rtype, decl_complex, decl_longcomplex, decl_shortcomplex, decl_type, decl_record, decl_varient, decl_var, decl_enumeration, decl_subrange, decl_array, decl_subscript, decl_string, decl_const, decl_literal, decl_varparam, decl_param, decl_varargs, decl_optarg, decl_pointer, decl_recordfield, decl_varientfield, decl_enumerationfield, decl_set, decl_proctype, decl_procedure, decl_def, decl_imp, decl_module, decl_loop, decl_while, decl_for, decl_repeat, decl_case, decl_caselabellist, decl_caselist, decl_range, decl_assignment, decl_if, decl_elsif, decl_constexp, decl_neg, decl_cast, decl_val, decl_plus, decl_sub, decl_div, decl_mod, decl_mult, decl_divide, decl_in, decl_adr, decl_size, decl_tsize, decl_ord, decl_float, decl_trunc, decl_chr, decl_abs, decl_cap, decl_high, decl_throw, decl_unreachable, decl_cmplx, decl_re, decl_im, decl_min, decl_max, decl_componentref, decl_pointerref, decl_arrayref, decl_deref, decl_equal, decl_notequal, decl_less, decl_greater, decl_greequal, decl_lessequal, decl_lsl, decl_lsr, decl_lor, decl_land, decl_lnot, decl_lxor, decl_and, decl_or, decl_not, decl_identlist, decl_vardecl, decl_setvalue, decl_opaquecast} decl_nodeT;
 
-#   define MaxnoOfelements 5
-typedef enum {mcReserved_eoftok, mcReserved_plustok, mcReserved_minustok, mcReserved_timestok, mcReserved_dividetok, mcReserved_becomestok, mcReserved_ambersandtok, mcReserved_periodtok, mcReserved_commatok, mcReserved_semicolontok, mcReserved_lparatok, mcReserved_rparatok, mcReserved_lsbratok, mcReserved_rsbratok, mcReserved_lcbratok, mcReserved_rcbratok, mcReserved_uparrowtok, mcReserved_singlequotetok, mcReserved_equaltok, mcReserved_hashtok, mcReserved_lesstok, mcReserved_greatertok, mcReserved_lessgreatertok, mcReserved_lessequaltok, mcReserved_greaterequaltok, mcReserved_ldirectivetok, mcReserved_rdirectivetok, mcReserved_periodperiodtok, mcReserved_colontok, mcReserved_doublequotestok, mcReserved_bartok, mcReserved_andtok, mcReserved_arraytok, mcReserved_begintok, mcReserved_bytok, mcReserved_casetok, mcReserved_consttok, mcReserved_definitiontok, mcReserved_divtok, mcReserved_dotok, mcReserved_elsetok, mcReserved_elsiftok, mcReserved_endtok, mcReserved_excepttok, mcReserved_exittok, mcReserved_exporttok, mcReserved_finallytok, mcReserved_fortok, mcReserved_fromtok, mcReserved_iftok, mcReserved_implementationtok, mcReserved_importtok, mcReserved_intok, mcReserved_looptok, mcReserved_modtok, mcReserved_moduletok, mcReserved_nottok, mcReserved_oftok, mcReserved_ortok, mcReserved_packedsettok, mcReserved_pointertok, mcReserved_proceduretok, mcReserved_qualifiedtok, mcReserved_unqualifiedtok, mcReserved_recordtok, mcReserved_remtok, mcReserved_repeattok, mcReserved_retrytok, mcReserved_returntok, mcReserved_settok, mcReserved_thentok, mcReserved_totok, mcReserved_typetok, mcReserved_untiltok, mcReserved_vartok, mcReserved_whiletok, mcReserved_withtok, mcReserved_asmtok, mcReserved_volatiletok, mcReserved_periodperiodperiodtok, mcReserved_datetok, mcReserved_linetok, mcReserved_filetok, mcReserved_attributetok, mcReserved_builtintok, mcReserved_inlinetok, mcReserved_integertok, mcReserved_identtok, mcReserved_realtok, mcReserved_stringtok, mcReserved_commenttok} mcReserved_toktype;
-
-extern mcReserved_toktype mcLexBuf_currenttoken;
 typedef enum {decl_ansiC, decl_ansiCP, decl_pim4} decl_language;
 
 typedef enum {decl_completed, decl_blocked, decl_partial, decl_recursive} decl_dependentState;
 
 typedef enum {decl_text, decl_punct, decl_space} decl_outputStates;
 
-typedef decl_nodeRec *decl_node;
-
-typedef struct Indexing__T5_r Indexing__T5;
-
-typedef struct mcComment__T6_r mcComment__T6;
-
-typedef enum {mcComment_unknown, mcComment_procedureHeading, mcComment_inBody, mcComment_afterStatement} mcComment_commentType;
-
-typedef struct DynamicStrings_stringRecord_r DynamicStrings_stringRecord;
-
-typedef struct DynamicStrings_Contents_r DynamicStrings_Contents;
-
-typedef struct wlists__T9_r wlists__T9;
-
-typedef struct alists__T13_r alists__T13;
-
-typedef struct mcPretty__T12_r mcPretty__T12;
-
-typedef struct wlists__T10_a wlists__T10;
-
-typedef Indexing__T5 *Indexing_Index;
-
-typedef struct DynamicStrings__T7_a DynamicStrings__T7;
-
-typedef struct alists__T14_a alists__T14;
-
-typedef mcComment__T6 *mcComment_commentDesc;
-
-extern mcComment_commentDesc mcLexBuf_currentcomment;
-extern mcComment_commentDesc mcLexBuf_lastcomment;
-typedef DynamicStrings_stringRecord *DynamicStrings_String;
-
-typedef wlists__T9 *wlists_wlist;
-
-typedef alists__T13 *alists_alist;
-
-typedef mcPretty__T12 *mcPretty_pretty;
-
-struct symbolKey__T8_r {
-                         nameKey_Name name;
-                         void *key;
-                         symbolKey_symbolTree left;
-                         symbolKey_symbolTree right;
-                       };
-
-typedef void (*mcPretty_writeProc_t) (char);
-struct mcPretty_writeProc_p { mcPretty_writeProc_t proc; };
-
-typedef void (*mcPretty_writeLnProc_t) (void);
-struct mcPretty_writeLnProc_p { mcPretty_writeLnProc_t proc; };
-
-typedef void (*symbolKey_performOperation_t) (void *);
-struct symbolKey_performOperation_p { symbolKey_performOperation_t proc; };
-
-typedef void (*Indexing_IndexProcedure_t) (void *);
-struct Indexing_IndexProcedure_p { Indexing_IndexProcedure_t proc; };
-
-typedef bool (*decl_isNodeF_t) (decl_node);
-struct decl_isNodeF_p { decl_isNodeF_t proc; };
-
-typedef void (*M2RTS_ArgCVEnvP_t) (int, void *, void *);
-struct M2RTS_ArgCVEnvP_p { M2RTS_ArgCVEnvP_t proc; };
-
-typedef bool (*symbolKey_isSymbol_t) (void *);
-struct symbolKey_isSymbol_p { symbolKey_isSymbol_t proc; };
-
-struct libc_tm_r {
-                   int tm_sec;
-                   int tm_min;
-                   int tm_hour;
-                   int tm_mday;
-                   int tm_mon;
-                   int tm_year;
-                   int tm_wday;
-                   int tm_yday;
-                   int tm_isdst;
-                   long int tm_gmtoff;
-                   void *tm_zone;
-                 };
-
-struct libc_timeb_r {
-                      libc_time_t time_;
-                      short unsigned int millitm;
-                      short unsigned int timezone;
-                      short unsigned int dstflag;
-                    };
-
-typedef int (*libc_exitP_t) (void);
-typedef libc_exitP_t libc_exitP_C;
-
-struct libc_exitP_p { libc_exitP_t proc; };
-
-struct mcError__T11_r {
-                        mcError_error parent;
-                        mcError_error child;
-                        mcError_error next;
-                        bool fatal;
-                        DynamicStrings_String s;
-                        unsigned int token;
-                      };
-
-typedef void (*alists_performOperation_t) (void *);
-struct alists_performOperation_p { alists_performOperation_t proc; };
-
-typedef void (*wlists_performOperation_t) (unsigned int);
-struct wlists_performOperation_p { wlists_performOperation_t proc; };
-
-typedef void (*StdIO_ProcWrite_t) (char);
-struct StdIO_ProcWrite_p { StdIO_ProcWrite_t proc; };
+typedef decl_nodeRec *decl_node__opaque;
 
-typedef void (*StdIO_ProcRead_t) (char *);
-struct StdIO_ProcRead_p { StdIO_ProcRead_t proc; };
+struct decl_opaqueCastState_r {
+                                bool opaque;
+                                bool voidStar;
+                              };
 
 struct decl_fixupInfo_r {
                           unsigned int count;
@@ -405,7 +235,7 @@ struct decl_explistT_r {
                        };
 
 struct decl_setvalueT_r {
-                          decl_node type;
+                          decl_node__opaque type;
                           Indexing_Index values;
                         };
 
@@ -423,19 +253,20 @@ struct decl_stmtT_r {
                     };
 
 struct decl_exitT_r {
-                      decl_node loop;
+                      decl_node__opaque loop;
                     };
 
 struct decl_vardeclT_r {
                          wlists_wlist names;
-                         decl_node type;
-                         decl_node scope;
+                         decl_node__opaque type;
+                         decl_node__opaque scope;
                        };
 
 struct decl_typeT_r {
                       nameKey_Name name;
-                      decl_node type;
-                      decl_node scope;
+                      decl_node__opaque type;
+                      decl_node__opaque scope;
+                      bool isOpaque;
                       bool isHidden;
                       bool isInternal;
                     };
@@ -443,44 +274,37 @@ struct decl_typeT_r {
 struct decl_recordT_r {
                         symbolKey_symbolTree localSymbols;
                         Indexing_Index listOfSons;
-                        decl_node scope;
+                        decl_node__opaque scope;
                       };
 
 struct decl_varientT_r {
                          Indexing_Index listOfSons;
-                         decl_node varient;
-                         decl_node tag;
-                         decl_node scope;
+                         decl_node__opaque varient;
+                         decl_node__opaque tag;
+                         decl_node__opaque scope;
                        };
 
 struct decl_enumerationT_r {
                              unsigned int noOfElements;
                              symbolKey_symbolTree localSymbols;
                              Indexing_Index listOfSons;
-                             decl_node low;
-                             decl_node high;
-                             decl_node scope;
+                             decl_node__opaque low;
+                             decl_node__opaque high;
+                             decl_node__opaque scope;
                            };
 
 struct decl_subrangeT_r {
-                          decl_node low;
-                          decl_node high;
-                          decl_node type;
-                          decl_node scope;
+                          decl_node__opaque low;
+                          decl_node__opaque high;
+                          decl_node__opaque type;
+                          decl_node__opaque scope;
                         };
 
 struct decl_subscriptT_r {
-                           decl_node type;
-                           decl_node expr;
+                           decl_node__opaque type;
+                           decl_node__opaque expr;
                          };
 
-struct decl_arrayT_r {
-                       decl_node subr;
-                       decl_node type;
-                       decl_node scope;
-                       bool isUnbounded;
-                     };
-
 struct decl_stringT_r {
                         nameKey_Name name;
                         unsigned int length;
@@ -492,101 +316,60 @@ struct decl_stringT_r {
 
 struct decl_literalT_r {
                          nameKey_Name name;
-                         decl_node type;
+                         decl_node__opaque type;
                        };
 
 struct decl_constT_r {
                        nameKey_Name name;
-                       decl_node type;
-                       decl_node value;
-                       decl_node scope;
-                     };
-
-struct decl_varparamT_r {
-                          decl_node namelist;
-                          decl_node type;
-                          decl_node scope;
-                          bool isUnbounded;
-                          bool isForC;
-                          bool isUsed;
-                        };
-
-struct decl_paramT_r {
-                       decl_node namelist;
-                       decl_node type;
-                       decl_node scope;
-                       bool isUnbounded;
-                       bool isForC;
-                       bool isUsed;
+                       decl_node__opaque type;
+                       decl_node__opaque value;
+                       decl_node__opaque scope;
                      };
 
 struct decl_varargsT_r {
-                         decl_node scope;
+                         decl_node__opaque scope;
                        };
 
 struct decl_optargT_r {
-                        decl_node namelist;
-                        decl_node type;
-                        decl_node scope;
-                        decl_node init;
+                        decl_node__opaque namelist;
+                        decl_node__opaque type;
+                        decl_node__opaque scope;
+                        decl_node__opaque init;
                       };
 
-struct decl_pointerT_r {
-                         decl_node type;
-                         decl_node scope;
-                       };
-
 struct decl_varientfieldT_r {
                               nameKey_Name name;
-                              decl_node parent;
-                              decl_node varient;
+                              decl_node__opaque parent;
+                              decl_node__opaque varient;
                               bool simple;
                               Indexing_Index listOfSons;
-                              decl_node scope;
+                              decl_node__opaque scope;
                             };
 
 struct decl_setT_r {
-                     decl_node type;
-                     decl_node scope;
+                     decl_node__opaque type;
+                     decl_node__opaque scope;
                    };
 
-struct decl_componentrefT_r {
-                              decl_node rec;
-                              decl_node field;
-                              decl_node resultType;
-                            };
-
-struct decl_pointerrefT_r {
-                            decl_node ptr;
-                            decl_node field;
-                            decl_node resultType;
-                          };
-
-struct decl_arrayrefT_r {
-                          decl_node array;
-                          decl_node index;
-                          decl_node resultType;
-                        };
-
 struct decl_commentPair_r {
-                            decl_node after;
-                            decl_node body;
+                            decl_node__opaque after;
+                            decl_node__opaque body;
                           };
 
 struct decl_loopT_r {
-                      decl_node statements;
+                      decl_node__opaque statements;
                       unsigned int labelno;
                     };
 
 struct decl_caseT_r {
-                      decl_node expression;
+                      decl_node__opaque expression;
                       Indexing_Index caseLabelList;
-                      decl_node else_;
+                      decl_node__opaque else_;
                     };
 
 struct decl_caselabellistT_r {
-                               decl_node caseList;
-                               decl_node statements;
+                               decl_node__opaque caseList;
+                               decl_node__opaque statements;
                              };
 
 struct decl_caselistT_r {
@@ -594,16 +377,16 @@ struct decl_caselistT_r {
                         };
 
 struct decl_rangeT_r {
-                       decl_node lo;
-                       decl_node hi;
+                       decl_node__opaque lo;
+                       decl_node__opaque hi;
                      };
 
 struct decl_forT_r {
-                     decl_node des;
-                     decl_node start;
-                     decl_node end;
-                     decl_node increment;
-                     decl_node statements;
+                     decl_node__opaque des;
+                     decl_node__opaque start;
+                     decl_node__opaque end;
+                     decl_node__opaque increment;
+                     decl_node__opaque statements;
                    };
 
 struct decl_statementT_r {
@@ -618,24 +401,15 @@ struct decl_scopeT_r {
                        Indexing_Index variables;
                      };
 
-struct decl_proctypeT_r {
-                          Indexing_Index parameters;
-                          bool returnopt;
-                          bool vararg;
-                          decl_node optarg_;
-                          decl_node scope;
-                          decl_node returnType;
-                        };
-
 struct decl_binaryT_r {
-                        decl_node left;
-                        decl_node right;
-                        decl_node resultType;
+                        decl_node__opaque left;
+                        decl_node__opaque right;
+                        decl_node__opaque resultType;
                       };
 
 struct decl_unaryT_r {
-                       decl_node arg;
-                       decl_node resultType;
+                       decl_node__opaque arg;
+                       decl_node__opaque resultType;
                      };
 
 struct decl_where_r {
@@ -652,118 +426,161 @@ struct decl_cnameT_r {
                        bool init;
                      };
 
-struct decl__T15_r {
-                     alists_alist todoQ;
-                     alists_alist partialQ;
-                     alists_alist doneQ;
-                     decl_group next;
-                   };
-
-struct Indexing__T5_r {
-                        void *ArrayStart;
-                        unsigned int ArraySize;
-                        unsigned int Used;
-                        unsigned int Low;
-                        unsigned int High;
-                        bool Debug;
-                        unsigned int Map;
-                      };
+struct decl__T1_r {
+                    alists_alist todoQ;
+                    alists_alist partialQ;
+                    alists_alist doneQ;
+                    decl_group next;
+                  };
 
-struct mcComment__T6_r {
-                         mcComment_commentType type;
-                         DynamicStrings_String content;
-                         nameKey_Name procName;
-                         bool used;
-                       };
+struct decl_opaquecastT_r {
+                            decl_node__opaque exp;
+                            decl_opaqueCastState opaqueState;
+                          };
 
-struct wlists__T10_a { unsigned int array[maxNoOfElements-1+1]; };
-struct DynamicStrings__T7_a { char array[(MaxBuf-1)+1]; };
-struct alists__T14_a { void * array[MaxnoOfelements-1+1]; };
 struct decl_intrinsicT_r {
-                           decl_node args;
+                           decl_node__opaque args;
                            unsigned int noArgs;
-                           decl_node type;
+                           decl_node__opaque type;
                            decl_commentPair intrinsicComment;
                            bool postUnreachable;
                          };
 
 struct decl_funccallT_r {
-                          decl_node function;
-                          decl_node args;
-                          decl_node type;
+                          decl_node__opaque function;
+                          decl_node__opaque args;
+                          decl_node__opaque type;
                           decl_commentPair funccallComment;
+                          decl_opaqueCastState opaqueState;
                         };
 
 struct decl_returnT_r {
-                        decl_node exp;
-                        decl_node scope;
+                        decl_node__opaque exp;
+                        decl_node__opaque scope;
                         decl_commentPair returnComment;
                       };
 
 struct decl_varT_r {
                      nameKey_Name name;
-                     decl_node type;
-                     decl_node decl;
-                     decl_node scope;
+                     decl_node__opaque type;
+                     decl_node__opaque decl;
+                     decl_node__opaque scope;
                      bool isInitialised;
                      bool isParameter;
                      bool isVarParameter;
                      bool isUsed;
                      decl_cnameT cname;
+                     decl_opaqueCastState opaqueState;
                    };
 
+struct decl_arrayT_r {
+                       decl_node__opaque subr;
+                       decl_node__opaque type;
+                       decl_node__opaque scope;
+                       bool isUnbounded;
+                       decl_opaqueCastState opaqueState;
+                     };
+
+struct decl_varparamT_r {
+                          decl_node__opaque namelist;
+                          decl_node__opaque type;
+                          decl_node__opaque scope;
+                          bool isUnbounded;
+                          bool isForC;
+                          bool isUsed;
+                          decl_opaqueCastState opaqueState;
+                        };
+
+struct decl_paramT_r {
+                       decl_node__opaque namelist;
+                       decl_node__opaque type;
+                       decl_node__opaque scope;
+                       bool isUnbounded;
+                       bool isForC;
+                       bool isUsed;
+                       decl_opaqueCastState opaqueState;
+                     };
+
+struct decl_pointerT_r {
+                         decl_node__opaque type;
+                         decl_node__opaque scope;
+                         decl_opaqueCastState opaqueState;
+                       };
+
 struct decl_recordfieldT_r {
                              nameKey_Name name;
-                             decl_node type;
+                             decl_node__opaque type;
                              bool tag;
-                             decl_node parent;
-                             decl_node varient;
-                             decl_node scope;
+                             decl_node__opaque parent;
+                             decl_node__opaque varient;
+                             decl_node__opaque scope;
                              decl_cnameT cname;
+                             decl_opaqueCastState opaqueState;
                            };
 
 struct decl_enumerationfieldT_r {
                                   nameKey_Name name;
-                                  decl_node type;
-                                  decl_node scope;
+                                  decl_node__opaque type;
+                                  decl_node__opaque scope;
                                   unsigned int value;
                                   decl_cnameT cname;
                                 };
 
+struct decl_componentrefT_r {
+                              decl_node__opaque rec;
+                              decl_node__opaque field;
+                              decl_node__opaque resultType;
+                              decl_opaqueCastState opaqueState;
+                            };
+
+struct decl_pointerrefT_r {
+                            decl_node__opaque ptr;
+                            decl_node__opaque field;
+                            decl_node__opaque resultType;
+                            decl_opaqueCastState opaqueState;
+                          };
+
+struct decl_arrayrefT_r {
+                          decl_node__opaque array;
+                          decl_node__opaque index;
+                          decl_node__opaque resultType;
+                          decl_opaqueCastState opaqueState;
+                        };
+
 struct decl_assignmentT_r {
-                            decl_node des;
-                            decl_node expr;
+                            decl_node__opaque des;
+                            decl_node__opaque expr;
                             decl_commentPair assignComment;
                           };
 
 struct decl_ifT_r {
-                    decl_node expr;
-                    decl_node elsif;
-                    decl_node then;
-                    decl_node else_;
+                    decl_node__opaque expr;
+                    decl_node__opaque elsif;
+                    decl_node__opaque then;
+                    decl_node__opaque else_;
                     decl_commentPair ifComment;
                     decl_commentPair elseComment;
                     decl_commentPair endComment;
                   };
 
 struct decl_elsifT_r {
-                       decl_node expr;
-                       decl_node elsif;
-                       decl_node then;
-                       decl_node else_;
+                       decl_node__opaque expr;
+                       decl_node__opaque elsif;
+                       decl_node__opaque then;
+                       decl_node__opaque else_;
                        decl_commentPair elseComment;
                      };
 
 struct decl_whileT_r {
-                       decl_node expr;
-                       decl_node statements;
+                       decl_node__opaque expr;
+                       decl_node__opaque statements;
                        decl_commentPair doComment;
                        decl_commentPair endComment;
                      };
 
 struct decl_repeatT_r {
-                        decl_node expr;
-                        decl_node statements;
+                        decl_node__opaque expr;
+                        decl_node__opaque statements;
                         decl_commentPair repeatComment;
                         decl_commentPair untilComment;
                       };
@@ -771,7 +588,7 @@ struct decl_repeatT_r {
 struct decl_procedureT_r {
                            nameKey_Name name;
                            decl_scopeT decls;
-                           decl_node scope;
+                           decl_node__opaque scope;
                            Indexing_Index parameters;
                            bool isForC;
                            bool built;
@@ -781,14 +598,25 @@ struct decl_procedureT_r {
                            bool noreturnused;
                            bool noreturn;
                            unsigned int paramcount;
-                           decl_node optarg_;
-                           decl_node returnType;
-                           decl_node beginStatements;
+                           decl_node__opaque optarg_;
+                           decl_node__opaque returnType;
+                           decl_node__opaque beginStatements;
                            decl_cnameT cname;
                            mcComment_commentDesc defComment;
                            mcComment_commentDesc modComment;
+                           decl_opaqueCastState opaqueState;
                          };
 
+struct decl_proctypeT_r {
+                          Indexing_Index parameters;
+                          bool returnopt;
+                          bool vararg;
+                          decl_node__opaque optarg_;
+                          decl_node__opaque scope;
+                          decl_node__opaque returnType;
+                          decl_opaqueCastState opaqueState;
+                        };
+
 struct decl_moduleT_r {
                         nameKey_Name name;
                         nameKey_Name source;
@@ -796,8 +624,8 @@ struct decl_moduleT_r {
                         decl_fixupInfo constFixup;
                         decl_fixupInfo enumFixup;
                         decl_scopeT decls;
-                        decl_node beginStatements;
-                        decl_node finallyStatements;
+                        decl_node__opaque beginStatements;
+                        decl_node__opaque finallyStatements;
                         bool enumsComplete;
                         bool constsComplete;
                         bool visited;
@@ -826,9 +654,9 @@ struct decl_impT_r {
                      Indexing_Index importedModules;
                      decl_fixupInfo constFixup;
                      decl_fixupInfo enumFixup;
-                     decl_node beginStatements;
-                     decl_node finallyStatements;
-                     decl_node definitionModule;
+                     decl_node__opaque beginStatements;
+                     decl_node__opaque finallyStatements;
+                     decl_node__opaque definitionModule;
                      decl_scopeT decls;
                      bool enumsComplete;
                      bool constsComplete;
@@ -836,60 +664,6 @@ struct decl_impT_r {
                      decl_commentPair com;
                    };
 
-struct DynamicStrings_Contents_r {
-                                   DynamicStrings__T7 buf;
-                                   unsigned int len;
-                                   DynamicStrings_String next;
-                                 };
-
-struct wlists__T9_r {
-                      unsigned int noOfElements;
-                      wlists__T10 elements;
-                      wlists_wlist next;
-                    };
-
-struct alists__T13_r {
-                       unsigned int noOfelements;
-                       alists__T14 elements;
-                       alists_alist next;
-                     };
-
-struct mcPretty__T12_r {
-                         mcPretty_writeProc write_;
-                         mcPretty_writeLnProc writeln;
-                         bool needsSpace;
-                         bool needsIndent;
-                         unsigned int seekPos;
-                         unsigned int curLine;
-                         unsigned int curPos;
-                         unsigned int indent;
-                         mcPretty_pretty stacked;
-                       };
-
-typedef struct DynamicStrings_descriptor_r DynamicStrings_descriptor;
-
-typedef DynamicStrings_descriptor *DynamicStrings_Descriptor;
-
-typedef struct DynamicStrings_DebugInfo_r DynamicStrings_DebugInfo;
-
-typedef enum {DynamicStrings_inuse, DynamicStrings_marked, DynamicStrings_onlist, DynamicStrings_poisoned} DynamicStrings_desState;
-
-struct DynamicStrings_descriptor_r {
-                                     bool charStarUsed;
-                                     void *charStar;
-                                     unsigned int charStarSize;
-                                     bool charStarValid;
-                                     DynamicStrings_desState state;
-                                     DynamicStrings_String garbage;
-                                   };
-
-struct DynamicStrings_DebugInfo_r {
-                                    DynamicStrings_String next;
-                                    void *file;
-                                    unsigned int line;
-                                    void *proc;
-                                  };
-
 struct decl_nodeRec_r {
                         decl_nodeT kind;  /* case tag */
                         union {
@@ -944,82 +718,77 @@ struct decl_nodeRec_r {
                                 decl_vardeclT vardeclF;
                                 decl_funccallT funccallF;
                                 decl_setvalueT setvalueF;
+                                decl_opaquecastT opaquecastF;
                               };
                         decl_where at;
                       };
 
-struct DynamicStrings_stringRecord_r {
-                                       DynamicStrings_Contents contents;
-                                       DynamicStrings_Descriptor head;
-                                       DynamicStrings_DebugInfo debug;
-                                     };
-
 static decl_group freeGroup;
 static decl_group globalGroup;
 static FIO_File outputFile;
 static decl_language lang;
-static decl_node bitsperunitN;
-static decl_node bitsperwordN;
-static decl_node bitspercharN;
-static decl_node unitsperwordN;
-static decl_node mainModule;
-static decl_node currentModule;
-static decl_node defModule;
-static decl_node systemN;
-static decl_node addressN;
-static decl_node locN;
-static decl_node byteN;
-static decl_node wordN;
-static decl_node csizetN;
-static decl_node cssizetN;
-static decl_node adrN;
-static decl_node sizeN;
-static decl_node tsizeN;
-static decl_node newN;
-static decl_node disposeN;
-static decl_node lengthN;
-static decl_node incN;
-static decl_node decN;
-static decl_node inclN;
-static decl_node exclN;
-static decl_node highN;
-static decl_node m2rtsN;
-static decl_node haltN;
-static decl_node throwN;
-static decl_node chrN;
-static decl_node capN;
-static decl_node absN;
-static decl_node floatN;
-static decl_node truncN;
-static decl_node ordN;
-static decl_node valN;
-static decl_node minN;
-static decl_node maxN;
-static decl_node booleanN;
-static decl_node procN;
-static decl_node charN;
-static decl_node integerN;
-static decl_node cardinalN;
-static decl_node longcardN;
-static decl_node shortcardN;
-static decl_node longintN;
-static decl_node shortintN;
-static decl_node bitsetN;
-static decl_node bitnumN;
-static decl_node ztypeN;
-static decl_node rtypeN;
-static decl_node complexN;
-static decl_node longcomplexN;
-static decl_node shortcomplexN;
-static decl_node cmplxN;
-static decl_node reN;
-static decl_node imN;
-static decl_node realN;
-static decl_node longrealN;
-static decl_node shortrealN;
-static decl_node nilN;
-static decl_node trueN;
-static decl_node falseN;
+static decl_node__opaque bitsperunitN;
+static decl_node__opaque bitsperwordN;
+static decl_node__opaque bitspercharN;
+static decl_node__opaque unitsperwordN;
+static decl_node__opaque mainModule;
+static decl_node__opaque currentModule;
+static decl_node__opaque defModule;
+static decl_node__opaque systemN;
+static decl_node__opaque addressN;
+static decl_node__opaque locN;
+static decl_node__opaque byteN;
+static decl_node__opaque wordN;
+static decl_node__opaque csizetN;
+static decl_node__opaque cssizetN;
+static decl_node__opaque adrN;
+static decl_node__opaque sizeN;
+static decl_node__opaque tsizeN;
+static decl_node__opaque newN;
+static decl_node__opaque disposeN;
+static decl_node__opaque lengthN;
+static decl_node__opaque incN;
+static decl_node__opaque decN;
+static decl_node__opaque inclN;
+static decl_node__opaque exclN;
+static decl_node__opaque highN;
+static decl_node__opaque m2rtsN;
+static decl_node__opaque haltN;
+static decl_node__opaque throwN;
+static decl_node__opaque chrN;
+static decl_node__opaque capN;
+static decl_node__opaque absN;
+static decl_node__opaque floatN;
+static decl_node__opaque truncN;
+static decl_node__opaque ordN;
+static decl_node__opaque valN;
+static decl_node__opaque minN;
+static decl_node__opaque maxN;
+static decl_node__opaque booleanN;
+static decl_node__opaque procN;
+static decl_node__opaque charN;
+static decl_node__opaque integerN;
+static decl_node__opaque cardinalN;
+static decl_node__opaque longcardN;
+static decl_node__opaque shortcardN;
+static decl_node__opaque longintN;
+static decl_node__opaque shortintN;
+static decl_node__opaque bitsetN;
+static decl_node__opaque bitnumN;
+static decl_node__opaque ztypeN;
+static decl_node__opaque rtypeN;
+static decl_node__opaque complexN;
+static decl_node__opaque longcomplexN;
+static decl_node__opaque shortcomplexN;
+static decl_node__opaque cmplxN;
+static decl_node__opaque reN;
+static decl_node__opaque imN;
+static decl_node__opaque realN;
+static decl_node__opaque longrealN;
+static decl_node__opaque shortrealN;
+static decl_node__opaque nilN;
+static decl_node__opaque trueN;
+static decl_node__opaque falseN;
 static Indexing_Index scopeStack;
 static Indexing_Index defUniverseI;
 static Indexing_Index modUniverseI;
@@ -1031,52 +800,7 @@ static mcPretty_pretty doP;
 static bool mustVisitScope;
 static bool simplified;
 static unsigned int tempCount;
-static decl_node globalNode;
-extern "C" void SYSTEM_ShiftVal (unsigned int *s, unsigned int _s_high, unsigned int *d, unsigned int _d_high, unsigned int SetSizeInBits, int ShiftCount);
-extern "C" void SYSTEM_ShiftLeft (unsigned int *s, unsigned int _s_high, unsigned int *d, unsigned int _d_high, unsigned int SetSizeInBits, unsigned int ShiftCount);
-extern "C" void SYSTEM_ShiftRight (unsigned int *s, unsigned int _s_high, unsigned int *d, unsigned int _d_high, unsigned int SetSizeInBits, unsigned int ShiftCount);
-extern "C" void SYSTEM_RotateVal (unsigned int *s, unsigned int _s_high, unsigned int *d, unsigned int _d_high, unsigned int SetSizeInBits, int RotateCount);
-extern "C" void SYSTEM_RotateLeft (unsigned int *s, unsigned int _s_high, unsigned int *d, unsigned int _d_high, unsigned int SetSizeInBits, unsigned int RotateCount);
-extern "C" void SYSTEM_RotateRight (unsigned int *s, unsigned int _s_high, unsigned int *d, unsigned int _d_high, unsigned int SetSizeInBits, unsigned int RotateCount);
-extern "C" void M2RTS_ConstructModules (void * applicationmodule, void * libname, void * overrideliborder, int argc, void * argv, void * envp);
-extern "C" void M2RTS_DeconstructModules (void * applicationmodule, void * libname, int argc, void * argv, void * envp);
-extern "C" void M2RTS_RegisterModule (void * name, void * libname, M2RTS_ArgCVEnvP init, M2RTS_ArgCVEnvP fini, PROC dependencies);
-extern "C" void M2RTS_RequestDependant (void * modulename, void * libname, void * dependantmodule, void * dependantlibname);
-extern "C" bool M2RTS_InstallTerminationProcedure (PROC p);
-extern "C" void M2RTS_ExecuteInitialProcedures (void);
-extern "C" bool M2RTS_InstallInitialProcedure (PROC p);
-extern "C" void M2RTS_ExecuteTerminationProcedures (void);
-extern "C" void M2RTS_Terminate (void) __attribute__ ((noreturn));
-extern "C" void M2RTS_HALT (int exitcode) __attribute__ ((noreturn));
-extern "C" void M2RTS_Halt (const char *description_, unsigned int _description_high, const char *filename_, unsigned int _filename_high, const char *function_, unsigned int _function_high, unsigned int line) __attribute__ ((noreturn));
-extern "C" void M2RTS_HaltC (void * description, void * filename, void * function, unsigned int line) __attribute__ ((noreturn));
-extern "C" void M2RTS_ExitOnHalt (int e);
-extern "C" void M2RTS_ErrorMessage (const char *message_, unsigned int _message_high, const char *filename_, unsigned int _filename_high, unsigned int line, const char *function_, unsigned int _function_high) __attribute__ ((noreturn));
-extern "C" unsigned int M2RTS_Length (const char *a_, unsigned int _a_high);
-extern "C" void M2RTS_AssignmentException (void * filename, unsigned int line, unsigned int column, void * scope, void * message) __attribute__ ((noreturn));
-extern "C" void M2RTS_ReturnException (void * filename, unsigned int line, unsigned int column, void * scope, void * message) __attribute__ ((noreturn));
-extern "C" void M2RTS_IncException (void * filename, unsigned int line, unsigned int column, void * scope, void * message) __attribute__ ((noreturn));
-extern "C" void M2RTS_DecException (void * filename, unsigned int line, unsigned int column, void * scope, void * message) __attribute__ ((noreturn));
-extern "C" void M2RTS_InclException (void * filename, unsigned int line, unsigned int column, void * scope, void * message) __attribute__ ((noreturn));
-extern "C" void M2RTS_ExclException (void * filename, unsigned int line, unsigned int column, void * scope, void * message) __attribute__ ((noreturn));
-extern "C" void M2RTS_ShiftException (void * filename, unsigned int line, unsigned int column, void * scope, void * message) __attribute__ ((noreturn));
-extern "C" void M2RTS_RotateException (void * filename, unsigned int line, unsigned int column, void * scope, void * message) __attribute__ ((noreturn));
-extern "C" void M2RTS_StaticArraySubscriptException (void * filename, unsigned int line, unsigned int column, void * scope, void * message) __attribute__ ((noreturn));
-extern "C" void M2RTS_DynamicArraySubscriptException (void * filename, unsigned int line, unsigned int column, void * scope, void * message) __attribute__ ((noreturn));
-extern "C" void M2RTS_ForLoopBeginException (void * filename, unsigned int line, unsigned int column, void * scope, void * message) __attribute__ ((noreturn));
-extern "C" void M2RTS_ForLoopToException (void * filename, unsigned int line, unsigned int column, void * scope, void * message) __attribute__ ((noreturn));
-extern "C" void M2RTS_ForLoopEndException (void * filename, unsigned int line, unsigned int column, void * scope, void * message) __attribute__ ((noreturn));
-extern "C" void M2RTS_PointerNilException (void * filename, unsigned int line, unsigned int column, void * scope, void * message) __attribute__ ((noreturn));
-extern "C" void M2RTS_NoReturnException (void * filename, unsigned int line, unsigned int column, void * scope, void * message) __attribute__ ((noreturn));
-extern "C" void M2RTS_CaseException (void * filename, unsigned int line, unsigned int column, void * scope, void * message) __attribute__ ((noreturn));
-extern "C" void M2RTS_WholeNonPosDivException (void * filename, unsigned int line, unsigned int column, void * scope, void * message) __attribute__ ((noreturn));
-extern "C" void M2RTS_WholeNonPosModException (void * filename, unsigned int line, unsigned int column, void * scope, void * message) __attribute__ ((noreturn));
-extern "C" void M2RTS_WholeZeroDivException (void * filename, unsigned int line, unsigned int column, void * scope, void * message) __attribute__ ((noreturn));
-extern "C" void M2RTS_WholeZeroRemException (void * filename, unsigned int line, unsigned int column, void * scope, void * message) __attribute__ ((noreturn));
-extern "C" void M2RTS_WholeValueException (void * filename, unsigned int line, unsigned int column, void * scope, void * message) __attribute__ ((noreturn));
-extern "C" void M2RTS_RealValueException (void * filename, unsigned int line, unsigned int column, void * scope, void * message) __attribute__ ((noreturn));
-extern "C" void M2RTS_ParameterException (void * filename, unsigned int line, unsigned int column, void * scope, void * message) __attribute__ ((noreturn));
-extern "C" void M2RTS_NoException (void * filename, unsigned int line, unsigned int column, void * scope, void * message) __attribute__ ((noreturn));
+static decl_node__opaque globalNode;
 
 /*
    getDeclaredMod - returns the token number associated with the nodes declaration
@@ -1266,6 +990,19 @@ extern "C" bool decl_isTypeHidden (decl_node n);
 
 extern "C" bool decl_hasHidden (decl_node n);
 
+/*
+   putTypeOpaque - marks type, des, as being an opaque type.
+                   TYPE des ;
+*/
+
+extern "C" void decl_putTypeOpaque (decl_node des);
+
+/*
+   isTypeOpaque - returns TRUE if type, n, is an opaque type.
+*/
+
+extern "C" bool decl_isTypeOpaque (decl_node n);
+
 /*
    isVar - returns TRUE if node, n, is a type.
 */
@@ -1681,7 +1418,7 @@ extern "C" void decl_putCommentModProcedure (decl_node n);
 extern "C" decl_node decl_makeProcType (void);
 
 /*
-   putReturnType - sets the return type of procedure or proctype, proc, to, type.
+   putReturnType - sets the return type of procedure or proctype proc to type.
 */
 
 extern "C" void decl_putReturnType (decl_node proc, decl_node type);
@@ -2295,5261 +2032,5457 @@ extern "C" void decl_setLangM2 (void);
 */
 
 extern "C" void decl_out (void);
-extern "C" nameKey_Name nameKey_makeKey (const char *a_, unsigned int _a_high);
-extern "C" nameKey_Name nameKey_makekey (void * a);
-extern "C" void nameKey_getKey (nameKey_Name key, char *a, unsigned int _a_high);
-extern "C" unsigned int nameKey_lengthKey (nameKey_Name key);
-extern "C" bool nameKey_isKey (const char *a_, unsigned int _a_high);
-extern "C" void nameKey_writeKey (nameKey_Name key);
-extern "C" bool nameKey_isSameExcludingCase (nameKey_Name key1, nameKey_Name key2);
-extern "C" void * nameKey_keyToCharStar (nameKey_Name key);
-extern "C" symbolKey_symbolTree symbolKey_initTree (void);
-extern "C" void symbolKey_killTree (symbolKey_symbolTree *t);
-extern "C" void * symbolKey_getSymKey (symbolKey_symbolTree t, nameKey_Name name);
-extern "C" void symbolKey_putSymKey (symbolKey_symbolTree t, nameKey_Name name, void * key);
 
 /*
-   delSymKey - deletes an entry in the binary tree.
-
-               NB in order for this to work we must ensure that the InitTree sets
-               both left and right to NIL.
+   newNode - create and return a new node of kind k.
 */
 
-extern "C" void symbolKey_delSymKey (symbolKey_symbolTree t, nameKey_Name name);
+static decl_node__opaque newNode (decl_nodeT k);
 
 /*
-   isEmptyTree - returns true if symbolTree, t, is empty.
+   disposeNode - dispose node, n.
 */
 
-extern "C" bool symbolKey_isEmptyTree (symbolKey_symbolTree t);
+static void disposeNode (decl_node__opaque *n);
 
 /*
-   doesTreeContainAny - returns true if symbolTree, t, contains any
-                        symbols which in turn return true when procedure,
-                        p, is called with a symbol as its parameter.
-                        The symbolTree root is empty apart from the field,
-                        left, hence we need two procedures.
+   newGroup -
 */
 
-extern "C" bool symbolKey_doesTreeContainAny (symbolKey_symbolTree t, symbolKey_isSymbol p);
+static void newGroup (decl_group *g);
 
 /*
-   foreachNodeDo - for each node in symbolTree, t, a procedure, p,
-                   is called with the node symbol as its parameter.
-                   The tree root node only contains a legal left pointer,
-                   therefore we need two procedures to examine this tree.
+   initGroup - returns a group which with all lists initialized.
 */
 
-extern "C" void symbolKey_foreachNodeDo (symbolKey_symbolTree t, symbolKey_performOperation p);
+static decl_group initGroup (void);
 
 /*
-   initComment - the start of a new comment has been seen by the lexical analyser.
-                 A new comment block is created and all addText contents are placed
-                 in this block.  onlySpaces indicates whether we have only seen
-                 spaces on this line.
+   killGroup - deallocate the group and place the group record into the freeGroup list.
 */
 
-extern "C" mcComment_commentDesc mcComment_initComment (bool onlySpaces);
+static void killGroup (decl_group *g);
 
 /*
-   addText - cs is a C string (null terminated) which contains comment text.
-             This is appended to the comment, cd.
+   dupGroup - If g is not NIL then destroy g.
+              Return a duplicate of GlobalGroup (not g).
 */
 
-extern "C" void mcComment_addText (mcComment_commentDesc cd, void * cs);
+static decl_group dupGroup (decl_group g);
 
 /*
-   getContent - returns the content of comment, cd.
+   equalGroup - return TRUE if group left = right.
 */
 
-extern "C" DynamicStrings_String mcComment_getContent (mcComment_commentDesc cd);
+static bool equalGroup (decl_group left, decl_group right);
 
 /*
-   getCommentCharStar - returns the C string content of comment, cd.
+   isLocal - returns TRUE if symbol, n, is locally declared in a procedure.
 */
 
-extern "C" void * mcComment_getCommentCharStar (mcComment_commentDesc cd);
+static bool isLocal (decl_node__opaque n);
 
 /*
-   setProcedureComment - changes the type of comment, cd, to a
-                         procedure heading comment,
-                         providing it has the procname as the first word.
+   importEnumFields - if, n, is an enumeration type import the all fields into module, m.
 */
 
-extern "C" void mcComment_setProcedureComment (mcComment_commentDesc cd, nameKey_Name procname);
+static void importEnumFields (decl_node__opaque m, decl_node__opaque n);
 
 /*
-   getProcedureComment - returns the current procedure comment if available.
+   isComplex - returns TRUE if, n, is the complex type.
 */
 
-extern "C" DynamicStrings_String mcComment_getProcedureComment (mcComment_commentDesc cd);
+static bool isComplex (decl_node__opaque n);
 
 /*
-   getAfterStatementComment - returns the current statement after comment if available.
+   isLongComplex - returns TRUE if, n, is the longcomplex type.
 */
 
-extern "C" DynamicStrings_String mcComment_getAfterStatementComment (mcComment_commentDesc cd);
+static bool isLongComplex (decl_node__opaque n);
 
 /*
-   getInbodyStatementComment - returns the current statement after comment if available.
+   isShortComplex - returns TRUE if, n, is the shortcomplex type.
 */
 
-extern "C" DynamicStrings_String mcComment_getInbodyStatementComment (mcComment_commentDesc cd);
+static bool isShortComplex (decl_node__opaque n);
 
 /*
-   isProcedureComment - returns TRUE if, cd, is a procedure comment.
+   isAProcType - returns TRUE if, n, is a proctype or proc node.
 */
 
-extern "C" bool mcComment_isProcedureComment (mcComment_commentDesc cd);
+static bool isAProcType (decl_node__opaque n);
 
 /*
-   isBodyComment - returns TRUE if, cd, is a body comment.
+   initFixupInfo - initialize the fixupInfo record.
 */
 
-extern "C" bool mcComment_isBodyComment (mcComment_commentDesc cd);
+static decl_fixupInfo initFixupInfo (void);
 
 /*
-   isAfterComment - returns TRUE if, cd, is an after comment.
+   makeDef - returns a definition module node named, n.
 */
 
-extern "C" bool mcComment_isAfterComment (mcComment_commentDesc cd);
-extern "C" void mcDebug_assert (bool q);
-extern "C" void mcDebug_writeDebug (const char *a_, unsigned int _a_high);
-extern "C" void Storage_ALLOCATE (void * *a, unsigned int Size);
-extern "C" void Storage_DEALLOCATE (void * *a, unsigned int Size);
-extern "C" void Storage_REALLOCATE (void * *a, unsigned int Size);
-extern "C" bool Storage_Available (unsigned int Size);
-extern "C" bool SFIO_Exists (DynamicStrings_String fname);
-extern "C" FIO_File SFIO_OpenToRead (DynamicStrings_String fname);
-extern "C" FIO_File SFIO_OpenToWrite (DynamicStrings_String fname);
-extern "C" FIO_File SFIO_OpenForRandom (DynamicStrings_String fname, bool towrite, bool newfile);
-extern "C" DynamicStrings_String SFIO_WriteS (FIO_File file, DynamicStrings_String s);
-extern "C" DynamicStrings_String SFIO_ReadS (FIO_File file);
-extern "C" bool FIO_IsNoError (FIO_File f);
-extern "C" bool FIO_IsActive (FIO_File f);
-extern "C" bool FIO_Exists (const char *fname_, unsigned int _fname_high);
-extern "C" FIO_File FIO_OpenToRead (const char *fname_, unsigned int _fname_high);
-extern "C" FIO_File FIO_OpenToWrite (const char *fname_, unsigned int _fname_high);
-extern "C" FIO_File FIO_OpenForRandom (const char *fname_, unsigned int _fname_high, bool towrite, bool newfile);
-extern "C" void FIO_Close (FIO_File f);
-extern "C" bool FIO_exists (void * fname, unsigned int flength);
-extern "C" FIO_File FIO_openToRead (void * fname, unsigned int flength);
-extern "C" FIO_File FIO_openToWrite (void * fname, unsigned int flength);
-extern "C" FIO_File FIO_openForRandom (void * fname, unsigned int flength, bool towrite, bool newfile);
-extern "C" void FIO_FlushBuffer (FIO_File f);
-extern "C" unsigned int FIO_ReadNBytes (FIO_File f, unsigned int nBytes, void * dest);
-extern "C" void FIO_ReadAny (FIO_File f, unsigned char *a, unsigned int _a_high);
-extern "C" unsigned int FIO_WriteNBytes (FIO_File f, unsigned int nBytes, void * src);
-extern "C" void FIO_WriteAny (FIO_File f, unsigned char *a, unsigned int _a_high);
-extern "C" void FIO_WriteChar (FIO_File f, char ch);
-extern "C" bool FIO_EOF (FIO_File f);
-extern "C" bool FIO_EOLN (FIO_File f);
-extern "C" bool FIO_WasEOLN (FIO_File f);
-extern "C" char FIO_ReadChar (FIO_File f);
-extern "C" void FIO_UnReadChar (FIO_File f, char ch);
-extern "C" void FIO_WriteLine (FIO_File f);
-extern "C" void FIO_WriteString (FIO_File f, const char *a_, unsigned int _a_high);
-extern "C" void FIO_ReadString (FIO_File f, char *a, unsigned int _a_high);
-extern "C" void FIO_WriteCardinal (FIO_File f, unsigned int c);
-extern "C" unsigned int FIO_ReadCardinal (FIO_File f);
-extern "C" int FIO_GetUnixFileDescriptor (FIO_File f);
-extern "C" void FIO_SetPositionFromBeginning (FIO_File f, long int pos);
-extern "C" void FIO_SetPositionFromEnd (FIO_File f, long int pos);
-extern "C" long int FIO_FindPosition (FIO_File f);
-extern "C" void FIO_GetFileName (FIO_File f, char *a, unsigned int _a_high);
-extern "C" void * FIO_getFileName (FIO_File f);
-extern "C" unsigned int FIO_getFileNameLength (FIO_File f);
-extern "C" void FIO_FlushOutErr (void);
+static decl_node__opaque makeDef (nameKey_Name n);
 
 /*
-   InitString - creates and returns a String type object.
-                Initial contents are, a.
+   makeImp - returns an implementation module node named, n.
 */
 
-extern "C" DynamicStrings_String DynamicStrings_InitString (const char *a_, unsigned int _a_high);
+static decl_node__opaque makeImp (nameKey_Name n);
 
 /*
-   KillString - frees String, s, and its contents.
-                NIL is returned.
+   makeModule - returns a module node named, n.
 */
 
-extern "C" DynamicStrings_String DynamicStrings_KillString (DynamicStrings_String s);
+static decl_node__opaque makeModule (nameKey_Name n);
 
 /*
-   Fin - finishes with a string, it calls KillString with, s.
-         The purpose of the procedure is to provide a short cut
-         to calling KillString and then testing the return result.
+   isDefForC - returns TRUE if the definition module was defined FOR "C".
 */
 
-extern "C" void DynamicStrings_Fin (DynamicStrings_String s);
+static bool isDefForC (decl_node__opaque n);
 
 /*
-   InitStringCharStar - initializes and returns a String to contain the C string.
+   initDecls - initialize the decls, scopeT.
 */
 
-extern "C" DynamicStrings_String DynamicStrings_InitStringCharStar (void * a);
+static void initDecls (decl_scopeT *decls);
 
 /*
-   InitStringChar - initializes and returns a String to contain the single character, ch.
+   addTo - adds node, d, to scope decls and returns, d.
+           It stores, d, in the symbols tree associated with decls.
 */
 
-extern "C" DynamicStrings_String DynamicStrings_InitStringChar (char ch);
+static decl_node__opaque addTo (decl_scopeT *decls, decl_node__opaque d);
 
 /*
-   Mark - marks String, s, ready for garbage collection.
+   export - export node, n, from definition module, d.
 */
 
-extern "C" DynamicStrings_String DynamicStrings_Mark (DynamicStrings_String s);
+static void export_ (decl_node__opaque d, decl_node__opaque n);
 
 /*
-   Length - returns the length of the String, s.
+   addToScope - adds node, n, to the current scope and returns, n.
 */
 
-extern "C" unsigned int DynamicStrings_Length (DynamicStrings_String s);
+static decl_node__opaque addToScope (decl_node__opaque n);
 
 /*
-   ConCat - returns String, a, after the contents of, b, have been appended.
+   addModuleToScope - adds module, i, to module, m, scope.
 */
 
-extern "C" DynamicStrings_String DynamicStrings_ConCat (DynamicStrings_String a, DynamicStrings_String b);
+static void addModuleToScope (decl_node__opaque m, decl_node__opaque i);
 
 /*
-   ConCatChar - returns String, a, after character, ch, has been appended.
+   completedEnum - assign boolean enumsComplete to TRUE if a definition,
+                   implementation or module symbol.
 */
 
-extern "C" DynamicStrings_String DynamicStrings_ConCatChar (DynamicStrings_String a, char ch);
+static void completedEnum (decl_node__opaque n);
 
 /*
-   Assign - assigns the contents of, b, into, a.
-            String, a, is returned.
+   setUnary - sets a unary node to contain, arg, a, and type, t.
 */
 
-extern "C" DynamicStrings_String DynamicStrings_Assign (DynamicStrings_String a, DynamicStrings_String b);
+static void setUnary (decl_node__opaque u, decl_nodeT k, decl_node__opaque a, decl_node__opaque t);
 
 /*
-   ReplaceChar - returns string s after it has changed all occurances of from to to.
+   putVarBool - assigns the four booleans associated with a variable.
 */
 
-extern "C" DynamicStrings_String DynamicStrings_ReplaceChar (DynamicStrings_String s, char from, char to);
+static void putVarBool (decl_node__opaque v, bool init, bool param, bool isvar, bool isused);
 
 /*
-   Dup - duplicate a String, s, returning the copy of s.
+   checkPtr - in C++ we need to create a typedef for a pointer
+              in case we need to use reinterpret_cast.
 */
 
-extern "C" DynamicStrings_String DynamicStrings_Dup (DynamicStrings_String s);
+static decl_node__opaque checkPtr (decl_node__opaque n);
 
 /*
-   Add - returns a new String which contains the contents of a and b.
+   isVarDecl - returns TRUE if, n, is a vardecl node.
 */
 
-extern "C" DynamicStrings_String DynamicStrings_Add (DynamicStrings_String a, DynamicStrings_String b);
+static bool isVarDecl (decl_node__opaque n);
 
 /*
-   Equal - returns TRUE if String, a, and, b, are equal.
+   makeVariablesFromParameters - creates variables which are really parameters.
 */
 
-extern "C" bool DynamicStrings_Equal (DynamicStrings_String a, DynamicStrings_String b);
+static void makeVariablesFromParameters (decl_node__opaque proc, decl_node__opaque id, decl_node__opaque type, bool isvar, bool isused);
 
 /*
-   EqualCharStar - returns TRUE if contents of String, s, is the same as the
-                   string, a.
+   addProcedureToScope - add a procedure name n and node d to the
+                         current scope.
 */
 
-extern "C" bool DynamicStrings_EqualCharStar (DynamicStrings_String s, void * a);
+static decl_node__opaque addProcedureToScope (decl_node__opaque d, nameKey_Name n);
 
 /*
-   EqualArray - returns TRUE if contents of String, s, is the same as the
-                string, a.
+   putProcTypeReturn - sets the return type of, proc, to, type.
 */
 
-extern "C" bool DynamicStrings_EqualArray (DynamicStrings_String s, const char *a_, unsigned int _a_high);
+static void putProcTypeReturn (decl_node__opaque proc, decl_node__opaque type);
 
 /*
-   Mult - returns a new string which is n concatenations of String, s.
+   putProcTypeOptReturn - sets, proc, to have an optional return type.
 */
 
-extern "C" DynamicStrings_String DynamicStrings_Mult (DynamicStrings_String s, unsigned int n);
+static void putProcTypeOptReturn (decl_node__opaque proc);
 
 /*
-   Slice - returns a new string which contains the elements
-           low..high-1
-
-           strings start at element 0
-           Slice(s, 0, 2)  will return elements 0, 1 but not 2
-           Slice(s, 1, 3)  will return elements 1, 2 but not 3
-           Slice(s, 2, 0)  will return elements 2..max
-           Slice(s, 3, -1) will return elements 3..max-1
-           Slice(s, 4, -2) will return elements 4..max-2
+   makeOptParameter - creates and returns an optarg.
 */
 
-extern "C" DynamicStrings_String DynamicStrings_Slice (DynamicStrings_String s, int low, int high);
+static decl_node__opaque makeOptParameter (decl_node__opaque l, decl_node__opaque type, decl_node__opaque init);
 
 /*
-   Index - returns the indice of the first occurance of, ch, in
-           String, s. -1 is returned if, ch, does not exist.
-           The search starts at position, o.
+   setwatch - assign the globalNode to n.
 */
 
-extern "C" int DynamicStrings_Index (DynamicStrings_String s, char ch, unsigned int o);
+static bool setwatch (decl_node__opaque n);
 
 /*
-   RIndex - returns the indice of the last occurance of, ch,
-            in String, s.  The search starts at position, o.
-            -1 is returned if, ch, is not found.  The search
-            is performed left to right.
+   runwatch - set the globalNode to an identlist.
 */
 
-extern "C" int DynamicStrings_RIndex (DynamicStrings_String s, char ch, unsigned int o);
+static bool runwatch (void);
 
 /*
-   ReverseIndex - returns the indice of the last occurance of ch
-                  in String s.  The search starts at position o
-                  and searches from right to left.  The start position
-                  may be indexed negatively from the right (-1 is the
-                  last index).
-                  The return value if ch is found will always be positive.
-                  -1 is returned if ch is not found.
+   isIdentList - returns TRUE if, n, is an identlist.
 */
 
-extern "C" int DynamicStrings_ReverseIndex (DynamicStrings_String s, char ch, int o);
+static bool isIdentList (decl_node__opaque n);
 
 /*
-   RemoveComment - assuming that, comment, is a comment delimiter
-                   which indicates anything to its right is a comment
-                   then strip off the comment and also any white space
-                   on the remaining right hand side.
-                   It leaves any white space on the left hand side alone.
+   identListLen - returns the length of identlist.
 */
 
-extern "C" DynamicStrings_String DynamicStrings_RemoveComment (DynamicStrings_String s, char comment);
+static unsigned int identListLen (decl_node__opaque n);
 
 /*
-   RemoveWhitePrefix - removes any leading white space from String, s.
-                       A new string is returned.
+   checkParameters - placeholder for future parameter checking.
 */
 
-extern "C" DynamicStrings_String DynamicStrings_RemoveWhitePrefix (DynamicStrings_String s);
+static void checkParameters (decl_node__opaque p, decl_node__opaque i, decl_node__opaque type, bool isvar, bool isused);
 
 /*
-   RemoveWhitePostfix - removes any leading white space from String, s.
-                        A new string is returned.
+   checkMakeVariables - create shadow local variables for parameters providing that
+                        procedure n has not already been built and we are compiling
+                        a module or an implementation module.
 */
 
-extern "C" DynamicStrings_String DynamicStrings_RemoveWhitePostfix (DynamicStrings_String s);
+static void checkMakeVariables (decl_node__opaque n, decl_node__opaque i, decl_node__opaque type, bool isvar, bool isused);
 
 /*
-   ToUpper - returns string, s, after it has had its lower case characters
-             replaced by upper case characters.
-             The string, s, is not duplicated.
+   makeVarientField - create a varient field within varient, v,
+                      The new varient field is returned.
 */
 
-extern "C" DynamicStrings_String DynamicStrings_ToUpper (DynamicStrings_String s);
+static decl_node__opaque makeVarientField (decl_node__opaque v, decl_node__opaque p);
 
 /*
-   ToLower - returns string, s, after it has had its upper case characters
-             replaced by lower case characters.
-             The string, s, is not duplicated.
+   putFieldVarient - places the field varient, f, as a brother to, the
+                     varient symbol, v, and also tells, f, that its varient
+                     parent is, v.
 */
 
-extern "C" DynamicStrings_String DynamicStrings_ToLower (DynamicStrings_String s);
+static void putFieldVarient (decl_node__opaque f, decl_node__opaque v);
 
 /*
-   CopyOut - copies string, s, to a.
+   putFieldRecord - create a new recordfield and place it into record r.
+                    The new field has a tagname and type and can have a
+                    variant field v.
 */
 
-extern "C" void DynamicStrings_CopyOut (char *a, unsigned int _a_high, DynamicStrings_String s);
+static decl_node__opaque putFieldRecord (decl_node__opaque r, nameKey_Name tag, decl_node__opaque type, decl_node__opaque v);
 
 /*
-   char - returns the character, ch, at position, i, in String, s.
+   ensureOrder - ensures that, a, and, b, exist in, i, and also
+                 ensure that, a, is before, b.
 */
 
-extern "C" char DynamicStrings_char (DynamicStrings_String s, int i);
+static void ensureOrder (Indexing_Index i, decl_node__opaque a, decl_node__opaque b);
 
 /*
-   string - returns the C style char * of String, s.
+   putVarientTag - places tag into variant v.
 */
 
-extern "C" void * DynamicStrings_string (DynamicStrings_String s);
+static void putVarientTag (decl_node__opaque v, decl_node__opaque tag);
 
 /*
-   InitStringDB - the debug version of InitString.
+   getParent - returns the parent field of recordfield or varientfield symbol, n.
 */
 
-extern "C" DynamicStrings_String DynamicStrings_InitStringDB (const char *a_, unsigned int _a_high, const char *file_, unsigned int _file_high, unsigned int line);
+static decl_node__opaque getParent (decl_node__opaque n);
 
 /*
-   InitStringCharStarDB - the debug version of InitStringCharStar.
+   getRecord - returns the record associated with node, n.
+               (Parental record).
 */
 
-extern "C" DynamicStrings_String DynamicStrings_InitStringCharStarDB (void * a, const char *file_, unsigned int _file_high, unsigned int line);
+static decl_node__opaque getRecord (decl_node__opaque n);
 
 /*
-   InitStringCharDB - the debug version of InitStringChar.
+   isConstExp - return TRUE if the node kind is a constexp.
 */
 
-extern "C" DynamicStrings_String DynamicStrings_InitStringCharDB (char ch, const char *file_, unsigned int _file_high, unsigned int line);
+static bool isConstExp (decl_node__opaque c);
 
 /*
-   MultDB - the debug version of MultDB.
+   addEnumToModule - adds enumeration type, e, into the list of enums
+                     in module, m.
 */
 
-extern "C" DynamicStrings_String DynamicStrings_MultDB (DynamicStrings_String s, unsigned int n, const char *file_, unsigned int _file_high, unsigned int line);
+static void addEnumToModule (decl_node__opaque m, decl_node__opaque e);
 
 /*
-   DupDB - the debug version of Dup.
+   getNextFixup - return the next fixup from from f.
 */
 
-extern "C" DynamicStrings_String DynamicStrings_DupDB (DynamicStrings_String s, const char *file_, unsigned int _file_high, unsigned int line);
+static decl_node__opaque getNextFixup (decl_fixupInfo *f);
 
 /*
-   SliceDB - debug version of Slice.
+   doMakeEnum - create an enumeration type and add it to the current module.
 */
 
-extern "C" DynamicStrings_String DynamicStrings_SliceDB (DynamicStrings_String s, int low, int high, const char *file_, unsigned int _file_high, unsigned int line);
+static decl_node__opaque doMakeEnum (void);
 
 /*
-   PushAllocation - pushes the current allocation/deallocation lists.
+   doMakeEnumField - create an enumeration field name and add it to enumeration e.
+                     Return the new field.
 */
 
-extern "C" void DynamicStrings_PushAllocation (void);
+static decl_node__opaque doMakeEnumField (decl_node__opaque e, nameKey_Name n);
 
 /*
-   PopAllocation - test to see that all strings are deallocated since
-                   the last push.  Then it pops to the previous
-                   allocation/deallocation lists.
-
-                   If halt is true then the application terminates
-                   with an exit code of 1.
+   getExpList - returns the, n, th argument in an explist.
 */
 
-extern "C" void DynamicStrings_PopAllocation (bool halt);
+static decl_node__opaque getExpList (decl_node__opaque p, unsigned int n);
 
 /*
-   PopAllocationExemption - test to see that all strings are deallocated, except
-                            string e since the last push.
-                            Post-condition: it pops to the previous allocation/deallocation
-                            lists.
-
-                            If halt is true then the application terminates
-                            with an exit code of 1.
+   expListLen - returns the length of explist, p.
 */
 
-extern "C" DynamicStrings_String DynamicStrings_PopAllocationExemption (bool halt, DynamicStrings_String e);
-extern "C" DynamicStrings_String StringConvert_IntegerToString (int i, unsigned int width, char padding, bool sign, unsigned int base, bool lower);
-extern "C" DynamicStrings_String StringConvert_CardinalToString (unsigned int c, unsigned int width, char padding, unsigned int base, bool lower);
-extern "C" int StringConvert_StringToInteger (DynamicStrings_String s, unsigned int base, bool *found);
-extern "C" unsigned int StringConvert_StringToCardinal (DynamicStrings_String s, unsigned int base, bool *found);
-extern "C" DynamicStrings_String StringConvert_LongIntegerToString (long int i, unsigned int width, char padding, bool sign, unsigned int base, bool lower);
-extern "C" long int StringConvert_StringToLongInteger (DynamicStrings_String s, unsigned int base, bool *found);
-extern "C" DynamicStrings_String StringConvert_LongCardinalToString (long unsigned int c, unsigned int width, char padding, unsigned int base, bool lower);
-extern "C" long unsigned int StringConvert_StringToLongCardinal (DynamicStrings_String s, unsigned int base, bool *found);
-extern "C" DynamicStrings_String StringConvert_ShortCardinalToString (short unsigned int c, unsigned int width, char padding, unsigned int base, bool lower);
-extern "C" short unsigned int StringConvert_StringToShortCardinal (DynamicStrings_String s, unsigned int base, bool *found);
-extern "C" int StringConvert_stoi (DynamicStrings_String s);
-extern "C" DynamicStrings_String StringConvert_itos (int i, unsigned int width, char padding, bool sign);
-extern "C" DynamicStrings_String StringConvert_ctos (unsigned int c, unsigned int width, char padding);
-extern "C" unsigned int StringConvert_stoc (DynamicStrings_String s);
-extern "C" int StringConvert_hstoi (DynamicStrings_String s);
-extern "C" int StringConvert_ostoi (DynamicStrings_String s);
-extern "C" int StringConvert_bstoi (DynamicStrings_String s);
-extern "C" unsigned int StringConvert_hstoc (DynamicStrings_String s);
-extern "C" unsigned int StringConvert_ostoc (DynamicStrings_String s);
-extern "C" unsigned int StringConvert_bstoc (DynamicStrings_String s);
-extern "C" long double StringConvert_StringToLongreal (DynamicStrings_String s, bool *found);
-extern "C" DynamicStrings_String StringConvert_LongrealToString (long double x, unsigned int TotalWidth, unsigned int FractionWidth);
-extern "C" double StringConvert_stor (DynamicStrings_String s);
-extern "C" long double StringConvert_stolr (DynamicStrings_String s);
-extern "C" DynamicStrings_String StringConvert_ToSigFig (DynamicStrings_String s, unsigned int n);
-extern "C" DynamicStrings_String StringConvert_ToDecimalPlaces (DynamicStrings_String s, unsigned int n);
-extern "C" DynamicStrings_String mcOptions_handleOptions (void);
-extern "C" bool mcOptions_getQuiet (void);
-extern "C" bool mcOptions_getVerbose (void);
-extern "C" bool mcOptions_getInternalDebugging (void);
-extern "C" DynamicStrings_String mcOptions_getCppCommandLine (void);
-extern "C" DynamicStrings_String mcOptions_getOutputFile (void);
-extern "C" bool mcOptions_getExtendedOpaque (void);
-extern "C" void mcOptions_setDebugTopological (bool value);
-extern "C" bool mcOptions_getDebugTopological (void);
-extern "C" DynamicStrings_String mcOptions_getHPrefix (void);
-extern "C" bool mcOptions_getIgnoreFQ (void);
-extern "C" bool mcOptions_getGccConfigSystem (void);
-extern "C" bool mcOptions_getScaffoldDynamic (void);
-extern "C" bool mcOptions_getScaffoldMain (void);
-extern "C" void mcOptions_writeGPLheader (FIO_File f);
-extern "C" void mcOptions_setSuppressNoReturn (bool value);
-extern "C" bool mcOptions_getSuppressNoReturn (void);
-extern "C" bool mcOptions_useBool (void);
-extern "C" DynamicStrings_String mcOptions_getCRealType (void);
-extern "C" DynamicStrings_String mcOptions_getCLongRealType (void);
-extern "C" DynamicStrings_String mcOptions_getCShortRealType (void);
-extern "C" DynamicStrings_String FormatStrings_Sprintf0 (DynamicStrings_String fmt);
-extern "C" DynamicStrings_String FormatStrings_Sprintf1 (DynamicStrings_String fmt, const unsigned char *w_, unsigned int _w_high);
-extern "C" DynamicStrings_String FormatStrings_Sprintf2 (DynamicStrings_String fmt, const unsigned char *w1_, unsigned int _w1_high, const unsigned char *w2_, unsigned int _w2_high);
-extern "C" DynamicStrings_String FormatStrings_Sprintf3 (DynamicStrings_String fmt, const unsigned char *w1_, unsigned int _w1_high, const unsigned char *w2_, unsigned int _w2_high, const unsigned char *w3_, unsigned int _w3_high);
-extern "C" DynamicStrings_String FormatStrings_Sprintf4 (DynamicStrings_String fmt, const unsigned char *w1_, unsigned int _w1_high, const unsigned char *w2_, unsigned int _w2_high, const unsigned char *w3_, unsigned int _w3_high, const unsigned char *w4_, unsigned int _w4_high);
-extern "C" DynamicStrings_String FormatStrings_HandleEscape (DynamicStrings_String s);
-extern "C" ssize_t libc_write (int d, void * buf, size_t nbytes);
-extern "C" ssize_t libc_read (int d, void * buf, size_t nbytes);
-extern "C" int libc_system (void * a);
-extern "C" void libc_abort (void) __attribute__ ((noreturn));
-extern "C" void * libc_malloc (size_t size);
-extern "C" void libc_free (void * ptr);
-extern "C" void * libc_realloc (void * ptr, size_t size);
-extern "C" int libc_isatty (int fd);
-extern "C" void libc_exit (int r) __attribute__ ((noreturn));
-extern "C" void * libc_getenv (void * s);
-extern "C" int libc_putenv (void * s);
-extern "C" int libc_getpid (void);
-extern "C" int libc_dup (int d);
-extern "C" int libc_close (int d);
-extern "C" int libc_open (void * filename, int oflag, ...);
-extern "C" int libc_creat (void * filename, unsigned int mode);
-extern "C" ssize_t libc_lseek (int fd, ssize_t offset, int whence);
-extern "C" void libc_perror (const char *string_, unsigned int _string_high);
-extern "C" int libc_readv (int fd, void * v, int n);
-extern "C" int libc_writev (int fd, void * v, int n);
-extern "C" void * libc_getcwd (void * buf, size_t size);
-extern "C" int libc_chown (void * filename, int uid, int gid);
-extern "C" size_t libc_strlen (void * a);
-extern "C" void * libc_strcpy (void * dest, void * src);
-extern "C" void * libc_strncpy (void * dest, void * src, unsigned int n);
-extern "C" int libc_unlink (void * file);
-extern "C" void * libc_memcpy (void * dest, void * src, size_t size);
-extern "C" void * libc_memset (void * s, int c, size_t size);
-extern "C" void * libc_memmove (void * dest, void * src, size_t size);
-extern "C" int libc_printf (const char *format_, unsigned int _format_high, ...);
-extern "C" int libc_snprintf (void * dest, size_t size, const char *format_, unsigned int _format_high, ...);
-extern "C" int libc_setenv (void * name, void * value, int overwrite);
-extern "C" void libc_srand (int seed);
-extern "C" int libc_rand (void);
-extern "C" libc_time_t libc_time (void * a);
-extern "C" void * libc_localtime (libc_time_t *t);
-extern "C" int libc_ftime (libc_timeb *t);
-extern "C" int libc_shutdown (int s, int how);
-extern "C" int libc_rename (void * oldpath, void * newpath);
-extern "C" int libc_setjmp (void * env);
-extern "C" void libc_longjmp (void * env, int val);
-extern "C" int libc_atexit (libc_exitP_C proc);
-extern "C" void * libc_ttyname (int filedes);
-extern "C" unsigned int libc_sleep (unsigned int seconds);
-extern "C" int libc_execv (void * pathname, void * argv);
-extern "C" void mcMetaError_metaError1 (const char *m_, unsigned int _m_high, const unsigned char *s_, unsigned int _s_high);
-extern "C" void mcMetaError_metaError2 (const char *m_, unsigned int _m_high, const unsigned char *s1_, unsigned int _s1_high, const unsigned char *s2_, unsigned int _s2_high);
-extern "C" void mcMetaError_metaError3 (const char *m_, unsigned int _m_high, const unsigned char *s1_, unsigned int _s1_high, const unsigned char *s2_, unsigned int _s2_high, const unsigned char *s3_, unsigned int _s3_high);
-extern "C" void mcMetaError_metaError4 (const char *m_, unsigned int _m_high, const unsigned char *s1_, unsigned int _s1_high, const unsigned char *s2_, unsigned int _s2_high, const unsigned char *s3_, unsigned int _s3_high, const unsigned char *s4_, unsigned int _s4_high);
-extern "C" void mcMetaError_metaErrors1 (const char *m1_, unsigned int _m1_high, const char *m2_, unsigned int _m2_high, const unsigned char *s_, unsigned int _s_high);
-extern "C" void mcMetaError_metaErrors2 (const char *m1_, unsigned int _m1_high, const char *m2_, unsigned int _m2_high, const unsigned char *s1_, unsigned int _s1_high, const unsigned char *s2_, unsigned int _s2_high);
-extern "C" void mcMetaError_metaErrors3 (const char *m1_, unsigned int _m1_high, const char *m2_, unsigned int _m2_high, const unsigned char *s1_, unsigned int _s1_high, const unsigned char *s2_, unsigned int _s2_high, const unsigned char *s3_, unsigned int _s3_high);
-extern "C" void mcMetaError_metaErrors4 (const char *m1_, unsigned int _m1_high, const char *m2_, unsigned int _m2_high, const unsigned char *s1_, unsigned int _s1_high, const unsigned char *s2_, unsigned int _s2_high, const unsigned char *s3_, unsigned int _s3_high, const unsigned char *s4_, unsigned int _s4_high);
-extern "C" void mcMetaError_metaErrorT1 (unsigned int tok, const char *m_, unsigned int _m_high, const unsigned char *s_, unsigned int _s_high);
-extern "C" void mcMetaError_metaErrorT2 (unsigned int tok, const char *m_, unsigned int _m_high, const unsigned char *s1_, unsigned int _s1_high, const unsigned char *s2_, unsigned int _s2_high);
-extern "C" void mcMetaError_metaErrorT3 (unsigned int tok, const char *m_, unsigned int _m_high, const unsigned char *s1_, unsigned int _s1_high, const unsigned char *s2_, unsigned int _s2_high, const unsigned char *s3_, unsigned int _s3_high);
-extern "C" void mcMetaError_metaErrorT4 (unsigned int tok, const char *m_, unsigned int _m_high, const unsigned char *s1_, unsigned int _s1_high, const unsigned char *s2_, unsigned int _s2_high, const unsigned char *s3_, unsigned int _s3_high, const unsigned char *s4_, unsigned int _s4_high);
-extern "C" void mcMetaError_metaErrorsT1 (unsigned int tok, const char *m1_, unsigned int _m1_high, const char *m2_, unsigned int _m2_high, const unsigned char *s_, unsigned int _s_high);
-extern "C" void mcMetaError_metaErrorsT2 (unsigned int tok, const char *m1_, unsigned int _m1_high, const char *m2_, unsigned int _m2_high, const unsigned char *s1_, unsigned int _s1_high, const unsigned char *s2_, unsigned int _s2_high);
-extern "C" void mcMetaError_metaErrorsT3 (unsigned int tok, const char *m1_, unsigned int _m1_high, const char *m2_, unsigned int _m2_high, const unsigned char *s1_, unsigned int _s1_high, const unsigned char *s2_, unsigned int _s2_high, const unsigned char *s3_, unsigned int _s3_high);
-extern "C" void mcMetaError_metaErrorsT4 (unsigned int tok, const char *m1_, unsigned int _m1_high, const char *m2_, unsigned int _m2_high, const unsigned char *s1_, unsigned int _s1_high, const unsigned char *s2_, unsigned int _s2_high, const unsigned char *s3_, unsigned int _s3_high, const unsigned char *s4_, unsigned int _s4_high);
-extern "C" void mcMetaError_metaErrorString1 (DynamicStrings_String m, const unsigned char *s_, unsigned int _s_high);
-extern "C" void mcMetaError_metaErrorString2 (DynamicStrings_String m, const unsigned char *s1_, unsigned int _s1_high, const unsigned char *s2_, unsigned int _s2_high);
-extern "C" void mcMetaError_metaErrorString3 (DynamicStrings_String m, const unsigned char *s1_, unsigned int _s1_high, const unsigned char *s2_, unsigned int _s2_high, const unsigned char *s3_, unsigned int _s3_high);
-extern "C" void mcMetaError_metaErrorString4 (DynamicStrings_String m, const unsigned char *s1_, unsigned int _s1_high, const unsigned char *s2_, unsigned int _s2_high, const unsigned char *s3_, unsigned int _s3_high, const unsigned char *s4_, unsigned int _s4_high);
-extern "C" void mcMetaError_metaErrorStringT1 (unsigned int tok, DynamicStrings_String m, const unsigned char *s_, unsigned int _s_high);
-extern "C" void mcMetaError_metaErrorStringT2 (unsigned int tok, DynamicStrings_String m, const unsigned char *s1_, unsigned int _s1_high, const unsigned char *s2_, unsigned int _s2_high);
-extern "C" void mcMetaError_metaErrorStringT3 (unsigned int tok, DynamicStrings_String m, const unsigned char *s1_, unsigned int _s1_high, const unsigned char *s2_, unsigned int _s2_high, const unsigned char *s3_, unsigned int _s3_high);
-extern "C" void mcMetaError_metaErrorStringT4 (unsigned int tok, DynamicStrings_String m, const unsigned char *s1_, unsigned int _s1_high, const unsigned char *s2_, unsigned int _s2_high, const unsigned char *s3_, unsigned int _s3_high, const unsigned char *s4_, unsigned int _s4_high);
+static unsigned int expListLen (decl_node__opaque p);
 
 /*
-   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.
+   getConstExpComplete - gets the field from the def or imp or module, n.
 */
 
-extern "C" void mcError_internalError (const char *a_, unsigned int _a_high, const char *file_, unsigned int _file_high, unsigned int line);
+static bool getConstExpComplete (decl_node__opaque n);
 
 /*
-   writeFormat0 - displays the source module and line together
-                  with the encapsulated format string.
-                  Used for simple error messages tied to the current token.
+   addConstToModule - adds const exp, e, into the list of constant
+                      expressions in module, m.
 */
 
-extern "C" void mcError_writeFormat0 (const char *a_, unsigned int _a_high);
+static void addConstToModule (decl_node__opaque m, decl_node__opaque e);
 
 /*
-   writeFormat1 - displays the source module and line together
-                  with the encapsulated format string.
-                  Used for simple error messages tied to the current token.
+   doMakeConstExp - create a constexp node and add it to the current module.
 */
 
-extern "C" void mcError_writeFormat1 (const char *a_, unsigned int _a_high, const unsigned char *w_, unsigned int _w_high);
+static decl_node__opaque doMakeConstExp (void);
 
 /*
-   writeFormat2 - displays the module and line together with the encapsulated
-                  format strings.
-                  Used for simple error messages tied to the current token.
+   isAnyType - return TRUE if node n is any type kind.
 */
 
-extern "C" void mcError_writeFormat2 (const char *a_, unsigned int _a_high, const unsigned char *w1_, unsigned int _w1_high, const unsigned char *w2_, unsigned int _w2_high);
+static bool isAnyType (decl_node__opaque n);
 
 /*
-   writeFormat3 - displays the module and line together with the encapsulated
-                  format strings.
-                  Used for simple error messages tied to the current token.
+   makeVal - creates a VAL (type, expression) node.
 */
 
-extern "C" void mcError_writeFormat3 (const char *a_, unsigned int _a_high, const unsigned char *w1_, unsigned int _w1_high, const unsigned char *w2_, unsigned int _w2_high, const unsigned char *w3_, unsigned int _w3_high);
+static decl_node__opaque makeVal (decl_node__opaque params);
 
 /*
-   newError - creates and returns a new error handle.
+   makeCast - creates a cast node TYPENAME (expr).
 */
 
-extern "C" mcError_error mcError_newError (unsigned int atTokenNo);
+static decl_node__opaque makeCast (decl_node__opaque c, decl_node__opaque p);
+static decl_node__opaque makeIntrinsicProc (decl_nodeT k, unsigned int noArgs, decl_node__opaque p);
 
 /*
-   newWarning - creates and returns a new error handle suitable for a warning.
-                A warning will not stop compilation.
+   makeIntrinsicUnaryType - create an intrisic unary type.
 */
 
-extern "C" mcError_error mcError_newWarning (unsigned int atTokenNo);
+static decl_node__opaque makeIntrinsicUnaryType (decl_nodeT k, decl_node__opaque paramList, decl_node__opaque returnType);
 
 /*
-   chainError - creates and returns a new error handle, this new error
-                is associated with, e, and is chained onto the end of, e.
-                If, e, is NIL then the result to NewError is returned.
+   makeIntrinsicBinaryType - create an intrisic binary type.
 */
 
-extern "C" mcError_error mcError_chainError (unsigned int atTokenNo, mcError_error e);
-extern "C" void mcError_errorFormat0 (mcError_error e, const char *a_, unsigned int _a_high);
-extern "C" void mcError_errorFormat1 (mcError_error e, const char *a_, unsigned int _a_high, const unsigned char *w_, unsigned int _w_high);
-extern "C" void mcError_errorFormat2 (mcError_error e, const char *a_, unsigned int _a_high, const unsigned char *w1_, unsigned int _w1_high, const unsigned char *w2_, unsigned int _w2_high);
-extern "C" void mcError_errorFormat3 (mcError_error e, const char *a_, unsigned int _a_high, const unsigned char *w1_, unsigned int _w1_high, const unsigned char *w2_, unsigned int _w2_high, const unsigned char *w3_, unsigned int _w3_high);
-extern "C" void mcError_errorString (mcError_error e, DynamicStrings_String str);
+static decl_node__opaque makeIntrinsicBinaryType (decl_nodeT k, decl_node__opaque paramList, decl_node__opaque returnType);
 
 /*
-   errorStringAt - given an error string, s, it places this
-                   string at token position, tok.
-                   The string is consumed.
+   checkIntrinsic - checks to see if the function call to, c, with
+                    parameter list, n, is really an intrinic.  If it
+                    is an intrinic then an intrinic node is created
+                    and returned.  Otherwise NIL is returned.
 */
 
-extern "C" void mcError_errorStringAt (DynamicStrings_String s, unsigned int tok);
+static decl_node__opaque checkIntrinsic (decl_node__opaque c, decl_node__opaque n);
 
 /*
-   errorStringAt2 - given an error string, s, it places this
-                    string at token positions, tok1 and tok2, respectively.
-                    The string is consumed.
+   checkCHeaders - check to see if the function is a C system function and
+                   requires a header file included.
 */
 
-extern "C" void mcError_errorStringAt2 (DynamicStrings_String s, unsigned int tok1, unsigned int tok2);
+static void checkCHeaders (decl_node__opaque c);
 
 /*
-   errorStringsAt2 - given error strings, s1, and, s2, it places these
-                     strings at token positions, tok1 and tok2, respectively.
-                     Both strings are consumed.
+   isFuncCall - returns TRUE if, n, is a function/procedure call.
 */
 
-extern "C" void mcError_errorStringsAt2 (DynamicStrings_String s1, DynamicStrings_String s2, unsigned int tok1, unsigned int tok2);
+static bool isFuncCall (decl_node__opaque n);
 
 /*
-   warnStringAt - given an error string, s, it places this
-                  string at token position, tok.
-                  The string is consumed.
+   putTypeInternal - marks type, des, as being an internally generated type.
 */
 
-extern "C" void mcError_warnStringAt (DynamicStrings_String s, unsigned int tok);
+static void putTypeInternal (decl_node__opaque des);
 
 /*
-   warnStringAt2 - given an warning string, s, it places this
-                   string at token positions, tok1 and tok2, respectively.
-                   The string is consumed.
+   isTypeInternal - returns TRUE if type, n, is internal.
 */
 
-extern "C" void mcError_warnStringAt2 (DynamicStrings_String s, unsigned int tok1, unsigned int tok2);
+static bool isTypeInternal (decl_node__opaque n);
 
 /*
-   warnStringsAt2 - given warning strings, s1, and, s2, it places these
-                    strings at token positions, tok1 and tok2, respectively.
-                    Both strings are consumed.
+   lookupBase - return node named n from the base symbol scope.
 */
 
-extern "C" void mcError_warnStringsAt2 (DynamicStrings_String s1, DynamicStrings_String s2, unsigned int tok1, unsigned int tok2);
-extern "C" void mcError_warnFormat0 (const char *a_, unsigned int _a_high);
+static decl_node__opaque lookupBase (nameKey_Name n);
 
 /*
-   warnFormat1 - displays the source module and line together
-                 with the encapsulated format string.
-                 Used for simple warning messages tied to the current token.
+   dumpScopes - display the names of all the scopes stacked.
 */
 
-extern "C" void mcError_warnFormat1 (const char *a_, unsigned int _a_high, const unsigned char *w_, unsigned int _w_high);
+static void dumpScopes (void);
 
 /*
-   flushErrors - switches the output channel to the error channel
-                 and then writes out all errors.
+   out0 - write string a to StdOut.
 */
 
-extern "C" void mcError_flushErrors (void);
+static void out0 (const char *a_, unsigned int _a_high);
 
 /*
-   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.
+   out1 - write string a to StdOut using format specifier a.
 */
 
-extern "C" void mcError_flushWarnings (void);
+static void out1 (const char *a_, unsigned int _a_high, decl_node__opaque s);
 
 /*
-   errorAbort0 - aborts compiling, it flushes all warnings and errors before aborting.
+   out2 - write string a to StdOut using format specifier a.
 */
 
-extern "C" void mcError_errorAbort0 (const char *a_, unsigned int _a_high);
-extern "C" mcComment_commentDesc mcLexBuf_getProcedureComment (void);
-extern "C" mcComment_commentDesc mcLexBuf_getBodyComment (void);
-extern "C" mcComment_commentDesc mcLexBuf_getAfterComment (void);
-extern "C" bool mcLexBuf_openSource (DynamicStrings_String s);
-extern "C" void mcLexBuf_closeSource (void);
-extern "C" void mcLexBuf_reInitialize (void);
-extern "C" void mcLexBuf_resetForNewPass (void);
-extern "C" void mcLexBuf_getToken (void);
-extern "C" void mcLexBuf_insertToken (mcReserved_toktype token);
-extern "C" void mcLexBuf_insertTokenAndRewind (mcReserved_toktype token);
-extern "C" unsigned int mcLexBuf_getPreviousTokenLineNo (void);
-extern "C" unsigned int mcLexBuf_getLineNo (void);
-extern "C" unsigned int mcLexBuf_getTokenNo (void);
-extern "C" unsigned int mcLexBuf_tokenToLineNo (unsigned int tokenNo, unsigned int depth);
-extern "C" unsigned int mcLexBuf_getColumnNo (void);
-extern "C" unsigned int mcLexBuf_tokenToColumnNo (unsigned int tokenNo, unsigned int depth);
-extern "C" DynamicStrings_String mcLexBuf_findFileNameFromToken (unsigned int tokenNo, unsigned int depth);
-extern "C" DynamicStrings_String mcLexBuf_getFileName (void);
-extern "C" void mcLexBuf_addTok (mcReserved_toktype t);
-extern "C" void mcLexBuf_addTokCharStar (mcReserved_toktype t, void * s);
-extern "C" void mcLexBuf_addTokInteger (mcReserved_toktype t, int i);
-extern "C" void mcLexBuf_addTokComment (mcReserved_toktype t, mcComment_commentDesc com);
-extern "C" void mcLexBuf_setFile (void * filename);
-extern "C" void mcLexBuf_pushFile (void * filename);
-extern "C" void mcLexBuf_popFile (void * filename);
-extern "C" void StrLib_StrConCat (const char *a_, unsigned int _a_high, const char *b_, unsigned int _b_high, char *c, unsigned int _c_high);
-extern "C" bool StrLib_StrLess (const char *a_, unsigned int _a_high, const char *b_, unsigned int _b_high);
-extern "C" bool StrLib_StrEqual (const char *a_, unsigned int _a_high, const char *b_, unsigned int _b_high);
-extern "C" unsigned int StrLib_StrLen (const char *a_, unsigned int _a_high);
-extern "C" void StrLib_StrCopy (const char *src_, unsigned int _src_high, char *dest, unsigned int _dest_high);
-extern "C" bool StrLib_IsSubString (const char *a_, unsigned int _a_high, const char *b_, unsigned int _b_high);
-extern "C" void StrLib_StrRemoveWhitePrefix (const char *a_, unsigned int _a_high, char *b, unsigned int _b_high);
+static void out2 (const char *a_, unsigned int _a_high, unsigned int c, decl_node__opaque s);
 
 /*
-   initPretty - initialise a pretty print data structure.
+   out3 - write string a to StdOut using format specifier a.
 */
 
-extern "C" mcPretty_pretty mcPretty_initPretty (mcPretty_writeProc w, mcPretty_writeLnProc l);
+static void out3 (const char *a_, unsigned int _a_high, unsigned int l, nameKey_Name n, decl_node__opaque s);
 
 /*
-   dupPretty - duplicate a pretty print data structure.
+   isUnary - returns TRUE if, n, is an unary node.
 */
 
-extern "C" mcPretty_pretty mcPretty_dupPretty (mcPretty_pretty p);
+static bool isUnary (decl_node__opaque n);
 
 /*
-   killPretty - destroy a pretty print data structure.
-                Post condition:  p is assigned to NIL.
+   isBinary - returns TRUE if, n, is an binary node.
 */
 
-extern "C" void mcPretty_killPretty (mcPretty_pretty *p);
+static bool isBinary (decl_node__opaque n);
 
 /*
-   pushPretty - duplicate, p.  Push, p, and return the duplicate.
+   makeUnary - create a unary expression node with, e, as the argument
+               and res as the return type.
 */
 
-extern "C" mcPretty_pretty mcPretty_pushPretty (mcPretty_pretty p);
+static decl_node__opaque makeUnary (decl_nodeT k, decl_node__opaque e, decl_node__opaque res);
 
 /*
-   popPretty - pops the pretty object from the stack.
+   isLeafString - returns TRUE if n is a leaf node which is a string constant.
 */
 
-extern "C" mcPretty_pretty mcPretty_popPretty (mcPretty_pretty p);
+static bool isLeafString (decl_node__opaque n);
 
 /*
-   getindent - returns the current indent value.
+   getLiteralStringContents - return the contents of a literal node as a string.
 */
 
-extern "C" unsigned int mcPretty_getindent (mcPretty_pretty p);
+static DynamicStrings_String getLiteralStringContents (decl_node__opaque n);
 
 /*
-   setindent - sets the current indent to, n.
+   getStringContents - return the string contents of a constant, literal,
+                       string or a constexp node.
 */
 
-extern "C" void mcPretty_setindent (mcPretty_pretty p, unsigned int n);
+static DynamicStrings_String getStringContents (decl_node__opaque n);
 
 /*
-   getcurpos - returns the current cursor position.
+   addNames -
 */
 
-extern "C" unsigned int mcPretty_getcurpos (mcPretty_pretty s);
+static nameKey_Name addNames (decl_node__opaque a, decl_node__opaque b);
 
 /*
-   getseekpos - returns the seek position.
+   resolveString -
 */
 
-extern "C" unsigned int mcPretty_getseekpos (mcPretty_pretty s);
+static decl_node__opaque resolveString (decl_node__opaque n);
 
 /*
-   getcurline - returns the current line number.
+   foldBinary -
 */
 
-extern "C" unsigned int mcPretty_getcurline (mcPretty_pretty s);
-extern "C" void mcPretty_setNeedSpace (mcPretty_pretty s);
+static decl_node__opaque foldBinary (decl_nodeT k, decl_node__opaque l, decl_node__opaque r, decl_node__opaque res);
 
 /*
-   noSpace - unset needsSpace.
+   makeBinary - create a binary node with left/right/result type:  l, r and resultType.
 */
 
-extern "C" void mcPretty_noSpace (mcPretty_pretty s);
+static decl_node__opaque makeBinary (decl_nodeT k, decl_node__opaque l, decl_node__opaque r, decl_node__opaque resultType);
 
 /*
-   print - print a string using, p.
+   doMakeBinary - returns a binary node containing left/right/result values
+                  l, r, res, with a node operator, k.
 */
 
-extern "C" void mcPretty_print (mcPretty_pretty p, const char *a_, unsigned int _a_high);
+static decl_node__opaque doMakeBinary (decl_nodeT k, decl_node__opaque l, decl_node__opaque r, decl_node__opaque res);
 
 /*
-   prints - print a string using, p.
+   doMakeComponentRef -
 */
 
-extern "C" void mcPretty_prints (mcPretty_pretty p, DynamicStrings_String s);
+static decl_node__opaque doMakeComponentRef (decl_node__opaque rec, decl_node__opaque field);
 
 /*
-   raw - print out string, s, without any translation of
-         escape sequences.
+   isComponentRef -
 */
 
-extern "C" void mcPretty_raw (mcPretty_pretty p, DynamicStrings_String s);
+static bool isComponentRef (decl_node__opaque n);
 
 /*
-   InitIndex - creates and returns an Index.
+   isArrayRef - returns TRUE if the node was an arrayref.
 */
 
-extern "C" Indexing_Index Indexing_InitIndex (unsigned int low);
+static bool isArrayRef (decl_node__opaque n);
 
 /*
-   KillIndex - returns Index to free storage.
+   isDeref - returns TRUE if, n, is a deref node.
 */
 
-extern "C" Indexing_Index Indexing_KillIndex (Indexing_Index i);
+static bool isDeref (decl_node__opaque n);
 
 /*
-   DebugIndex - turns on debugging within an index.
+   makeBase - create a base type or constant.
+              It only supports the base types and constants
+              enumerated below.
 */
 
-extern "C" Indexing_Index Indexing_DebugIndex (Indexing_Index i);
+static decl_node__opaque makeBase (decl_nodeT k);
 
 /*
-   InBounds - returns TRUE if indice, n, is within the bounds
-              of the dynamic array.
+   isOrdinal - returns TRUE if, n, is an ordinal type.
 */
 
-extern "C" bool Indexing_InBounds (Indexing_Index i, unsigned int n);
+static bool isOrdinal (decl_node__opaque n);
 
 /*
-   HighIndice - returns the last legally accessible indice of this array.
+   mixTypes -
 */
 
-extern "C" unsigned int Indexing_HighIndice (Indexing_Index i);
+static decl_node__opaque mixTypes (decl_node__opaque a, decl_node__opaque b);
 
 /*
-   LowIndice - returns the first legally accessible indice of this array.
+   doSetExprType -
 */
 
-extern "C" unsigned int Indexing_LowIndice (Indexing_Index i);
+static decl_node__opaque doSetExprType (decl_node__opaque *t, decl_node__opaque n);
 
 /*
-   PutIndice - places, a, into the dynamic array at position i[n]
+   getMaxMinType -
 */
 
-extern "C" void Indexing_PutIndice (Indexing_Index i, unsigned int n, void * a);
+static decl_node__opaque getMaxMinType (decl_node__opaque n);
 
 /*
-   GetIndice - retrieves, element i[n] from the dynamic array.
+   doGetFuncType -
 */
 
-extern "C" void * Indexing_GetIndice (Indexing_Index i, unsigned int n);
+static decl_node__opaque doGetFuncType (decl_node__opaque n);
 
 /*
-   IsIndiceInIndex - returns TRUE if, a, is in the index, i.
+   doGetExprType - works out the type which is associated with node, n.
 */
 
-extern "C" bool Indexing_IsIndiceInIndex (Indexing_Index i, void * a);
+static decl_node__opaque doGetExprType (decl_node__opaque n);
 
 /*
-   RemoveIndiceFromIndex - removes, a, from Index, i.
+   getExprType - return the expression type.
 */
 
-extern "C" void Indexing_RemoveIndiceFromIndex (Indexing_Index i, void * a);
+static decl_node__opaque getExprType (decl_node__opaque n);
 
 /*
-   DeleteIndice - delete i[j] from the array.
+   openOutput -
 */
 
-extern "C" void Indexing_DeleteIndice (Indexing_Index i, unsigned int j);
+static void openOutput (void);
 
 /*
-   IncludeIndiceIntoIndex - if the indice is not in the index, then
-                            add it at the end.
+   closeOutput -
 */
 
-extern "C" void Indexing_IncludeIndiceIntoIndex (Indexing_Index i, void * a);
+static void closeOutput (void);
 
 /*
-   ForeachIndiceInIndexDo - for each j indice of i, call procedure p(i[j])
+   write - outputs a single char, ch.
 */
 
-extern "C" void Indexing_ForeachIndiceInIndexDo (Indexing_Index i, Indexing_IndexProcedure p);
+static void write_ (char ch);
 
 /*
-   initList - creates a new alist, l.
+   writeln -
 */
 
-extern "C" alists_alist alists_initList (void);
+static void writeln (void);
 
 /*
-   killList - deletes the complete alist, l.
+   doIncludeC - include header file for definition module, n.
 */
 
-extern "C" void alists_killList (alists_alist *l);
+static void doIncludeC (decl_node__opaque n);
 
 /*
-   putItemIntoList - places an ADDRESS, c, into alist, l.
+   getSymScope - returns the scope where node, n, was declared.
 */
 
-extern "C" void alists_putItemIntoList (alists_alist l, void * c);
+static decl_node__opaque getSymScope (decl_node__opaque n);
 
 /*
-   getItemFromList - retrieves the nth WORD from alist, l.
+   isQualifiedForced - should the node be written with a module prefix?
 */
 
-extern "C" void * alists_getItemFromList (alists_alist l, unsigned int n);
+static bool isQualifiedForced (decl_node__opaque n);
 
 /*
-   getIndexOfList - returns the index for WORD, c, in alist, l.
-                    If more than one WORD, c, exists the index
-                    for the first is returned.
+   getFQstring -
 */
 
-extern "C" unsigned int alists_getIndexOfList (alists_alist l, void * c);
+static DynamicStrings_String getFQstring (decl_node__opaque n);
 
 /*
-   noOfItemsInList - returns the number of items in alist, l.
+   getFQDstring -
 */
 
-extern "C" unsigned int alists_noOfItemsInList (alists_alist l);
+static DynamicStrings_String getFQDstring (decl_node__opaque n, bool scopes);
 
 /*
-   includeItemIntoList - adds an ADDRESS, c, into a alist providing
-                         the value does not already exist.
+   getString - returns the name as a string.
 */
 
-extern "C" void alists_includeItemIntoList (alists_alist l, void * c);
+static DynamicStrings_String getString (decl_node__opaque n);
 
 /*
-   removeItemFromList - removes a ADDRESS, c, from a alist.
-                        It assumes that this value only appears once.
+   doNone - call HALT.
 */
 
-extern "C" void alists_removeItemFromList (alists_alist l, void * c);
+static void doNone (decl_node__opaque n);
 
 /*
-   isItemInList - returns true if a ADDRESS, c, was found in alist, l.
+   doNothing - does nothing!
 */
 
-extern "C" bool alists_isItemInList (alists_alist l, void * c);
+static void doNothing (decl_node__opaque n);
 
 /*
-   foreachItemInListDo - calls procedure, P, foreach item in alist, l.
+   doConstC -
 */
 
-extern "C" void alists_foreachItemInListDo (alists_alist l, alists_performOperation p);
+static void doConstC (decl_node__opaque n);
 
 /*
-   duplicateList - returns a duplicate alist derived from, l.
+   needsParen - returns TRUE if expression, n, needs to be enclosed in ().
 */
 
-extern "C" alists_alist alists_duplicateList (alists_alist l);
+static bool needsParen (decl_node__opaque n);
 
 /*
-   equalList - returns TRUE if left contains the same information as right.
+   doUnary -
 */
 
-extern "C" bool alists_equalList (alists_alist left, alists_alist right);
+static void doUnary (mcPretty_pretty p, const char *op_, unsigned int _op_high, decl_node__opaque expr, decl_node__opaque type, bool l, bool r);
 
 /*
-   initList - creates a new wlist, l.
+   doSetSub - perform  l & (~ r)
 */
 
-extern "C" wlists_wlist wlists_initList (void);
+static void doSetSub (mcPretty_pretty p, decl_node__opaque left, decl_node__opaque right);
 
 /*
-   killList - deletes the complete wlist, l.
+   doPolyBinary -
 */
 
-extern "C" void wlists_killList (wlists_wlist *l);
+static void doPolyBinary (mcPretty_pretty p, decl_nodeT op, decl_node__opaque left, decl_node__opaque right, bool l, bool r);
 
 /*
-   putItemIntoList - places an WORD, c, into wlist, l.
+   doBinary -
 */
 
-extern "C" void wlists_putItemIntoList (wlists_wlist l, unsigned int c);
+static void doBinary (mcPretty_pretty p, const char *op_, unsigned int _op_high, decl_node__opaque left, decl_node__opaque right, bool l, bool r, bool unpackProc);
 
 /*
-   getItemFromList - retrieves the nth WORD from wlist, l.
+   doPostUnary -
 */
 
-extern "C" unsigned int wlists_getItemFromList (wlists_wlist l, unsigned int n);
+static void doPostUnary (mcPretty_pretty p, const char *op_, unsigned int _op_high, decl_node__opaque expr);
 
 /*
-   getIndexOfList - returns the index for WORD, c, in wlist, l.
-                    If more than one WORD, c, exists the index
-                    for the first is returned.
+   doDeRefC -
 */
 
-extern "C" unsigned int wlists_getIndexOfList (wlists_wlist l, unsigned int c);
+static decl_node__opaque doDeRefC (mcPretty_pretty p, decl_node__opaque expr);
 
 /*
-   noOfItemsInList - returns the number of items in wlist, l.
+   doGetLastOp - returns, a, if b is a terminal otherwise walk right.
 */
 
-extern "C" unsigned int wlists_noOfItemsInList (wlists_wlist l);
+static decl_node__opaque doGetLastOp (decl_node__opaque a, decl_node__opaque b);
 
 /*
-   includeItemIntoList - adds an WORD, c, into a wlist providing
-                         the value does not already exist.
+   doComponentRefC -
 */
 
-extern "C" void wlists_includeItemIntoList (wlists_wlist l, unsigned int c);
+static void doComponentRefC (mcPretty_pretty p, decl_node__opaque l, decl_node__opaque r);
 
 /*
-   removeItemFromList - removes a WORD, c, from a wlist.
-                        It assumes that this value only appears once.
+   doPointerRefC -
 */
 
-extern "C" void wlists_removeItemFromList (wlists_wlist l, unsigned int c);
+static void doPointerRefC (mcPretty_pretty p, decl_node__opaque l, decl_node__opaque r);
 
 /*
-   replaceItemInList - replace the nth WORD in wlist, l.
-                       The first item in a wlists is at index, 1.
-                       If the index, n, is out of range nothing is changed.
+   doPreBinary -
 */
 
-extern "C" void wlists_replaceItemInList (wlists_wlist l, unsigned int n, unsigned int w);
+static void doPreBinary (mcPretty_pretty p, const char *op_, unsigned int _op_high, decl_node__opaque left, decl_node__opaque right, bool l, bool r);
 
 /*
-   isItemInList - returns true if a WORD, c, was found in wlist, l.
+   doConstExpr -
 */
 
-extern "C" bool wlists_isItemInList (wlists_wlist l, unsigned int c);
+static void doConstExpr (mcPretty_pretty p, decl_node__opaque n);
 
 /*
-   foreachItemInListDo - calls procedure, P, foreach item in wlist, l.
+   doEnumerationField -
 */
 
-extern "C" void wlists_foreachItemInListDo (wlists_wlist l, wlists_performOperation p);
+static void doEnumerationField (mcPretty_pretty p, decl_node__opaque n);
 
 /*
-   duplicateList - returns a duplicate wlist derived from, l.
+   isZero - returns TRUE if node, n, is zero.
 */
 
-extern "C" wlists_wlist wlists_duplicateList (wlists_wlist l);
-extern "C" void keyc_useUnistd (void);
-extern "C" void keyc_useThrow (void);
-extern "C" void keyc_useStorage (void);
-extern "C" void keyc_useFree (void);
-extern "C" void keyc_useMalloc (void);
-extern "C" void keyc_useProc (void);
-extern "C" void keyc_useTrue (void);
-extern "C" void keyc_useFalse (void);
-extern "C" void keyc_useNull (void);
-extern "C" void keyc_useMemcpy (void);
-extern "C" void keyc_useIntMin (void);
-extern "C" void keyc_useUIntMin (void);
-extern "C" void keyc_useLongMin (void);
-extern "C" void keyc_useULongMin (void);
-extern "C" void keyc_useCharMin (void);
-extern "C" void keyc_useUCharMin (void);
-extern "C" void keyc_useIntMax (void);
-extern "C" void keyc_useUIntMax (void);
-extern "C" void keyc_useLongMax (void);
-extern "C" void keyc_useULongMax (void);
-extern "C" void keyc_useCharMax (void);
-extern "C" void keyc_useUCharMax (void);
-extern "C" void keyc_useSize_t (void);
-extern "C" void keyc_useSSize_t (void);
-extern "C" void keyc_useLabs (void);
-extern "C" void keyc_useAbs (void);
-extern "C" void keyc_useFabs (void);
-extern "C" void keyc_useFabsl (void);
-extern "C" void keyc_useException (void);
-extern "C" void keyc_useComplex (void);
-extern "C" void keyc_useM2RTS (void);
-extern "C" void keyc_useStrlen (void);
-extern "C" void keyc_useCtype (void);
-extern "C" void keyc_genDefs (mcPretty_pretty p);
-extern "C" void keyc_genConfigSystem (mcPretty_pretty p);
-extern "C" void keyc_enterScope (decl_node n);
-extern "C" void keyc_leaveScope (decl_node n);
-extern "C" DynamicStrings_String keyc_cname (nameKey_Name n, bool scopes);
-extern "C" nameKey_Name keyc_cnamen (nameKey_Name n, bool scopes);
-extern "C" void keyc_cp (void);
-extern "C" FIO_File mcStream_openFrag (unsigned int id);
-extern "C" void mcStream_setDest (FIO_File f);
-extern "C" FIO_File mcStream_combine (void);
-extern "C" void mcStream_removeFiles (void);
-extern "C" void StrIO_WriteLn (void);
-extern "C" void StrIO_ReadString (char *a, unsigned int _a_high);
-extern "C" void StrIO_WriteString (const char *a_, unsigned int _a_high);
-extern "C" void NumberIO_ReadCard (unsigned int *x);
-extern "C" void NumberIO_WriteCard (unsigned int x, unsigned int n);
-extern "C" void NumberIO_ReadHex (unsigned int *x);
-extern "C" void NumberIO_WriteHex (unsigned int x, unsigned int n);
-extern "C" void NumberIO_ReadInt (int *x);
-extern "C" void NumberIO_WriteInt (int x, unsigned int n);
-extern "C" void NumberIO_CardToStr (unsigned int x, unsigned int n, char *a, unsigned int _a_high);
-extern "C" void NumberIO_StrToCard (const char *a_, unsigned int _a_high, unsigned int *x);
-extern "C" void NumberIO_HexToStr (unsigned int x, unsigned int n, char *a, unsigned int _a_high);
-extern "C" void NumberIO_StrToHex (const char *a_, unsigned int _a_high, unsigned int *x);
-extern "C" void NumberIO_IntToStr (int x, unsigned int n, char *a, unsigned int _a_high);
-extern "C" void NumberIO_StrToInt (const char *a_, unsigned int _a_high, int *x);
-extern "C" void NumberIO_ReadOct (unsigned int *x);
-extern "C" void NumberIO_WriteOct (unsigned int x, unsigned int n);
-extern "C" void NumberIO_OctToStr (unsigned int x, unsigned int n, char *a, unsigned int _a_high);
-extern "C" void NumberIO_StrToOct (const char *a_, unsigned int _a_high, unsigned int *x);
-extern "C" void NumberIO_ReadBin (unsigned int *x);
-extern "C" void NumberIO_WriteBin (unsigned int x, unsigned int n);
-extern "C" void NumberIO_BinToStr (unsigned int x, unsigned int n, char *a, unsigned int _a_high);
-extern "C" void NumberIO_StrToBin (const char *a_, unsigned int _a_high, unsigned int *x);
-extern "C" void NumberIO_StrToBinInt (const char *a_, unsigned int _a_high, int *x);
-extern "C" void NumberIO_StrToHexInt (const char *a_, unsigned int _a_high, int *x);
-extern "C" void NumberIO_StrToOctInt (const char *a_, unsigned int _a_high, int *x);
-extern "C" void Debug_Halt (const char *Message_, unsigned int _Message_high, const char *Module_, unsigned int _Module_high, const char *Function_, unsigned int _Function_high, unsigned int LineNo);
-extern "C" void Debug_DebugString (const char *a_, unsigned int _a_high);
-extern "C" void Assertion_Assert (bool Condition);
-extern "C" void StdIO_Read (char *ch);
-extern "C" void StdIO_Write (char ch);
-extern "C" void StdIO_PushOutput (StdIO_ProcWrite p);
-extern "C" void StdIO_PopOutput (void);
-extern "C" StdIO_ProcWrite StdIO_GetCurrentOutput (void);
-extern "C" void StdIO_PushInput (StdIO_ProcRead p);
-extern "C" void StdIO_PopInput (void);
-extern "C" StdIO_ProcRead StdIO_GetCurrentInput (void);
-extern "C" void mcPrintf_printf0 (const char *a_, unsigned int _a_high);
-extern "C" void mcPrintf_printf1 (const char *a_, unsigned int _a_high, const unsigned char *w_, unsigned int _w_high);
-extern "C" void mcPrintf_printf2 (const char *a_, unsigned int _a_high, const unsigned char *w1_, unsigned int _w1_high, const unsigned char *w2_, unsigned int _w2_high);
-extern "C" void mcPrintf_printf3 (const char *a_, unsigned int _a_high, const unsigned char *w1_, unsigned int _w1_high, const unsigned char *w2_, unsigned int _w2_high, const unsigned char *w3_, unsigned int _w3_high);
-extern "C" void mcPrintf_printf4 (const char *a_, unsigned int _a_high, const unsigned char *w1_, unsigned int _w1_high, const unsigned char *w2_, unsigned int _w2_high, const unsigned char *w3_, unsigned int _w3_high, const unsigned char *w4_, unsigned int _w4_high);
-extern "C" void mcPrintf_fprintf0 (FIO_File file, const char *a_, unsigned int _a_high);
-extern "C" void mcPrintf_fprintf1 (FIO_File file, const char *a_, unsigned int _a_high, const unsigned char *w_, unsigned int _w_high);
-extern "C" void mcPrintf_fprintf2 (FIO_File file, const char *a_, unsigned int _a_high, const unsigned char *w1_, unsigned int _w1_high, const unsigned char *w2_, unsigned int _w2_high);
-extern "C" void mcPrintf_fprintf3 (FIO_File file, const char *a_, unsigned int _a_high, const unsigned char *w1_, unsigned int _w1_high, const unsigned char *w2_, unsigned int _w2_high, const unsigned char *w3_, unsigned int _w3_high);
-extern "C" void mcPrintf_fprintf4 (FIO_File file, const char *a_, unsigned int _a_high, const unsigned char *w1_, unsigned int _w1_high, const unsigned char *w2_, unsigned int _w2_high, const unsigned char *w3_, unsigned int _w3_high, const unsigned char *w4_, unsigned int _w4_high);
+static bool isZero (decl_node__opaque n);
 
 /*
-   newNode - create and return a new node of kind k.
+   doArrayRef - perform an array reference.  If constCast
+                then an unbounded array access will be const_cast
+                (the constCast should be TRUE if an assignment to
+                the array is required).
 */
 
-static decl_node newNode (decl_nodeT k);
+static void doArrayRef (mcPretty_pretty p, decl_node__opaque n, bool constCast);
 
 /*
-   disposeNode - dispose node, n.
+   doProcedure -
 */
 
-static void disposeNode (decl_node *n);
+static void doProcedure (mcPretty_pretty p, decl_node__opaque n);
 
 /*
-   newGroup -
+   doRecordfield -
 */
 
-static void newGroup (decl_group *g);
+static void doRecordfield (mcPretty_pretty p, decl_node__opaque n);
 
 /*
-   initGroup - returns a group which with all lists initialized.
+   doCastC -
 */
 
-static decl_group initGroup (void);
+static void doCastC (mcPretty_pretty p, decl_node__opaque t, decl_node__opaque e);
 
 /*
-   killGroup - deallocate the group and place the group record into the freeGroup list.
+   doSetValueC -
 */
 
-static void killGroup (decl_group *g);
+static void doSetValueC (mcPretty_pretty p, decl_node__opaque n);
 
 /*
-   dupGroup - If g is not NIL then destroy g.
-              Return a duplicate of GlobalGroup (not g).
+   getSetLow - returns the low value of the set type from
+               expression, n.
 */
 
-static decl_group dupGroup (decl_group g);
+static decl_node__opaque getSetLow (decl_node__opaque n);
 
 /*
-   equalGroup - return TRUE if group left = right.
+   doInC - performs (((1 << (l)) & (r)) != 0)
 */
 
-static bool equalGroup (decl_group left, decl_group right);
+static void doInC (mcPretty_pretty p, decl_node__opaque l, decl_node__opaque r);
 
 /*
-   isLocal - returns TRUE if symbol, n, is locally declared in a procedure.
+   doThrowC -
 */
 
-static bool isLocal (decl_node n);
+static void doThrowC (mcPretty_pretty p, decl_node__opaque n);
 
 /*
-   importEnumFields - if, n, is an enumeration type import the all fields into module, m.
+   doUnreachableC -
 */
 
-static void importEnumFields (decl_node m, decl_node n);
+static void doUnreachableC (mcPretty_pretty p, decl_node__opaque n);
 
 /*
-   isComplex - returns TRUE if, n, is the complex type.
+   outNull -
 */
 
-static bool isComplex (decl_node n);
+static void outNull (mcPretty_pretty p);
 
 /*
-   isLongComplex - returns TRUE if, n, is the longcomplex type.
+   outTrue -
 */
 
-static bool isLongComplex (decl_node n);
+static void outTrue (mcPretty_pretty p);
 
 /*
-   isShortComplex - returns TRUE if, n, is the shortcomplex type.
+   outFalse -
 */
 
-static bool isShortComplex (decl_node n);
+static void outFalse (mcPretty_pretty p);
 
 /*
-   isAProcType - returns TRUE if, n, is a proctype or proc node.
+   doExprC -
 */
 
-static bool isAProcType (decl_node n);
+static void doExprC (mcPretty_pretty p, decl_node__opaque n);
 
 /*
-   initFixupInfo - initialize the fixupInfo record.
+   doExprCup -
 */
 
-static decl_fixupInfo initFixupInfo (void);
+static decl_node__opaque doExprCup (mcPretty_pretty p, decl_node__opaque n, bool unpackProc, bool uncastConst);
 
 /*
-   makeDef - returns a definition module node named, n.
+   doExprM2 -
 */
 
-static decl_node makeDef (nameKey_Name n);
+static void doExprM2 (mcPretty_pretty p, decl_node__opaque n);
 
 /*
-   makeImp - returns an implementation module node named, n.
+   doVar -
 */
 
-static decl_node makeImp (nameKey_Name n);
+static void doVar (mcPretty_pretty p, decl_node__opaque n);
 
 /*
-   makeModule - returns a module node named, n.
+   doLiteralC -
 */
 
-static decl_node makeModule (nameKey_Name n);
+static void doLiteralC (mcPretty_pretty p, decl_node__opaque n);
 
 /*
-   isDefForC - returns TRUE if the definition module was defined FOR "C".
+   doLiteral -
 */
 
-static bool isDefForC (decl_node n);
+static void doLiteral (mcPretty_pretty p, decl_node__opaque n);
 
 /*
-   initDecls - initialize the decls, scopeT.
+   isString - returns TRUE if node, n, is a string.
 */
 
-static void initDecls (decl_scopeT *decls);
+static bool isString (decl_node__opaque n);
 
 /*
-   addTo - adds node, d, to scope decls and returns, d.
-           It stores, d, in the symbols tree associated with decls.
+   doString -
 */
 
-static decl_node addTo (decl_scopeT *decls, decl_node d);
+static void doString (mcPretty_pretty p, decl_node__opaque n);
 
 /*
-   export - export node, n, from definition module, d.
+   replaceChar - replace every occurance of, ch, by, a and return modified string, s.
 */
 
-static void export_ (decl_node d, decl_node n);
+static DynamicStrings_String replaceChar (DynamicStrings_String s, char ch, const char *a_, unsigned int _a_high);
 
 /*
-   addToScope - adds node, n, to the current scope and returns, n.
+   toCstring - translates string, n, into a C string
+               and returns the new String.
 */
 
-static decl_node addToScope (decl_node n);
+static DynamicStrings_String toCstring (nameKey_Name n);
 
 /*
-   addModuleToScope - adds module, i, to module, m, scope.
+   toCchar -
 */
 
-static void addModuleToScope (decl_node m, decl_node i);
+static DynamicStrings_String toCchar (nameKey_Name n);
 
 /*
-   completedEnum - assign boolean enumsComplete to TRUE if a definition,
-                   implementation or module symbol.
+   countChar -
 */
 
-static void completedEnum (decl_node n);
+static unsigned int countChar (DynamicStrings_String s, char ch);
 
 /*
-   setUnary - sets a unary node to contain, arg, a, and type, t.
+   lenCstring -
 */
 
-static void setUnary (decl_node u, decl_nodeT k, decl_node a, decl_node t);
+static unsigned int lenCstring (DynamicStrings_String s);
 
 /*
-   putVarBool - assigns the four booleans associated with a variable.
+   outCstring -
 */
 
-static void putVarBool (decl_node v, bool init, bool param, bool isvar, bool isused);
+static void outCstring (mcPretty_pretty p, decl_node__opaque s, bool aString);
 
 /*
-   checkPtr - in C++ we need to create a typedef for a pointer
-              in case we need to use reinterpret_cast.
+   doStringC -
 */
 
-static decl_node checkPtr (decl_node n);
+static void doStringC (mcPretty_pretty p, decl_node__opaque n);
 
 /*
-   isVarDecl - returns TRUE if, n, is a vardecl node.
+   isPunct -
 */
 
-static bool isVarDecl (decl_node n);
+static bool isPunct (char ch);
 
 /*
-   makeVariablesFromParameters - creates variables which are really parameters.
+   isWhite -
 */
 
-static void makeVariablesFromParameters (decl_node proc, decl_node id, decl_node type, bool isvar, bool isused);
+static bool isWhite (char ch);
 
 /*
-   addProcedureToScope - add a procedure name n and node d to the
-                         current scope.
+   outText -
 */
 
-static decl_node addProcedureToScope (decl_node d, nameKey_Name n);
+static void outText (mcPretty_pretty p, const char *a_, unsigned int _a_high);
 
 /*
-   putProcTypeReturn - sets the return type of, proc, to, type.
+   outRawS -
 */
 
-static void putProcTypeReturn (decl_node proc, decl_node type);
+static void outRawS (mcPretty_pretty p, DynamicStrings_String s);
 
 /*
-   putProcTypeOptReturn - sets, proc, to have an optional return type.
+   outKm2 -
 */
 
-static void putProcTypeOptReturn (decl_node proc);
+static mcPretty_pretty outKm2 (mcPretty_pretty p, const char *a_, unsigned int _a_high);
 
 /*
-   makeOptParameter - creates and returns an optarg.
+   outKc -
 */
 
-static decl_node makeOptParameter (decl_node l, decl_node type, decl_node init);
+static mcPretty_pretty outKc (mcPretty_pretty p, const char *a_, unsigned int _a_high);
 
 /*
-   setwatch - assign the globalNode to n.
+   outTextS -
 */
 
-static bool setwatch (decl_node n);
+static void outTextS (mcPretty_pretty p, DynamicStrings_String s);
 
 /*
-   runwatch - set the globalNode to an identlist.
+   outCard -
 */
 
-static bool runwatch (void);
+static void outCard (mcPretty_pretty p, unsigned int c);
 
 /*
-   isIdentList - returns TRUE if, n, is an identlist.
+   outTextN -
 */
 
-static bool isIdentList (decl_node n);
+static void outTextN (mcPretty_pretty p, nameKey_Name n);
 
 /*
-   identListLen - returns the length of identlist.
+   outputEnumerationC -
 */
 
-static unsigned int identListLen (decl_node n);
+static void outputEnumerationC (mcPretty_pretty p, decl_node__opaque n);
 
 /*
-   checkParameters - placeholder for future parameter checking.
+   isDeclType - return TRUE if the current module should declare type.
 */
 
-static void checkParameters (decl_node p, decl_node i, decl_node type, bool isvar, bool isused);
+static bool isDeclType (decl_node__opaque type);
 
 /*
-   checkMakeVariables - create shadow local variables for parameters providing that
-                        procedure n has not already been built and we are compiling
-                        a module or an implementation module.
+   doEnumerationC -
 */
 
-static void checkMakeVariables (decl_node n, decl_node i, decl_node type, bool isvar, bool isused);
+static void doEnumerationC (mcPretty_pretty p, decl_node__opaque n);
 
 /*
-   makeVarientField - create a varient field within varient, v,
-                      The new varient field is returned.
+   doNamesC -
 */
 
-static decl_node makeVarientField (decl_node v, decl_node p);
+static void doNamesC (mcPretty_pretty p, nameKey_Name n);
 
 /*
-   putFieldVarient - places the field varient, f, as a brother to, the
-                     varient symbol, v, and also tells, f, that its varient
-                     parent is, v.
+   doNameC -
 */
 
-static void putFieldVarient (decl_node f, decl_node v);
+static void doNameC (mcPretty_pretty p, decl_node__opaque n);
 
 /*
-   putFieldRecord - create a new recordfield and place it into record r.
-                    The new field has a tagname and type and can have a
-                    variant field v.
+   initCname -
 */
 
-static decl_node putFieldRecord (decl_node r, nameKey_Name tag, decl_node type, decl_node v);
+static void initCname (decl_cnameT *c);
 
 /*
-   ensureOrder - ensures that, a, and, b, exist in, i, and also
-                 ensure that, a, is before, b.
+   doCname -
 */
 
-static void ensureOrder (Indexing_Index i, decl_node a, decl_node b);
+static nameKey_Name doCname (nameKey_Name n, decl_cnameT *c, bool scopes);
 
 /*
-   putVarientTag - places tag into variant v.
+   getDName -
 */
 
-static void putVarientTag (decl_node v, decl_node tag);
+static nameKey_Name getDName (decl_node__opaque n, bool scopes);
 
 /*
-   getParent - returns the parent field of recordfield or varientfield symbol, n.
+   doDNameC -
 */
 
-static decl_node getParent (decl_node n);
+static void doDNameC (mcPretty_pretty p, decl_node__opaque n, bool scopes);
 
 /*
-   getRecord - returns the record associated with node, n.
-               (Parental record).
+   doFQDNameC -
 */
 
-static decl_node getRecord (decl_node n);
+static void doFQDNameC (mcPretty_pretty p, decl_node__opaque n, bool scopes);
 
 /*
-   isConstExp - return TRUE if the node kind is a constexp.
+   doFQNameC -
 */
 
-static bool isConstExp (decl_node c);
+static void doFQNameC (mcPretty_pretty p, decl_node__opaque n);
 
 /*
-   addEnumToModule - adds enumeration type, e, into the list of enums
-                     in module, m.
+   doNameM2 -
 */
 
-static void addEnumToModule (decl_node m, decl_node e);
+static void doNameM2 (mcPretty_pretty p, decl_node__opaque n);
 
 /*
-   getNextFixup - return the next fixup from from f.
+   doUsed -
 */
 
-static decl_node getNextFixup (decl_fixupInfo *f);
+static void doUsed (mcPretty_pretty p, bool used);
 
 /*
-   doMakeEnum - create an enumeration type and add it to the current module.
+   doHighC -
 */
 
-static decl_node doMakeEnum (void);
+static void doHighC (mcPretty_pretty p, decl_node__opaque a, nameKey_Name n, bool isused);
 
 /*
-   doMakeEnumField - create an enumeration field name and add it to enumeration e.
-                     Return the new field.
+   doParamConstCast -
 */
 
-static decl_node doMakeEnumField (decl_node e, nameKey_Name n);
+static void doParamConstCast (mcPretty_pretty p, decl_node__opaque n);
 
 /*
-   getExpList - returns the, n, th argument in an explist.
+   getParameterVariable - returns the variable which shadows the parameter
+                          named, m, in parameter block, n.
 */
 
-static decl_node getExpList (decl_node p, unsigned int n);
+static decl_node__opaque getParameterVariable (decl_node__opaque n, nameKey_Name m);
 
 /*
-   expListLen - returns the length of explist, p.
+   doParamTypeEmit - emit parameter type for C/C++.  It checks to see if the
+                     parameter type is a procedure type and if it were declared
+                     in a definition module for "C" and if so it uses the "C"
+                     definition for a procedure type, rather than the mc
+                     C++ version.
 */
 
-static unsigned int expListLen (decl_node p);
+static void doParamTypeEmit (mcPretty_pretty p, decl_node__opaque paramnode, decl_node__opaque paramtype);
 
 /*
-   getConstExpComplete - gets the field from the def or imp or module, n.
+   doParamTypeNameModifier - Add an _ to an unbounded parameter which is non var.
 */
 
-static bool getConstExpComplete (decl_node n);
+static void doParamTypeNameModifier (mcPretty_pretty p, decl_node__opaque ptype, bool varparam);
 
 /*
-   addConstToModule - adds const exp, e, into the list of constant
-                      expressions in module, m.
+   initOpaqueCastState - assign fields opaque and voidstar in opaquestate.
 */
 
-static void addConstToModule (decl_node m, decl_node e);
+static void initOpaqueCastState (decl_opaqueCastState *opaquestate, bool opaque, bool voidstar);
 
 /*
-   doMakeConstExp - create a constexp node and add it to the current module.
+   initNodeOpaqueCastState - assign opaque and currentvoidstar
 */
 
-static decl_node doMakeConstExp (void);
+static void initNodeOpaqueCastState (decl_node__opaque n, bool opaque, bool voidstar);
 
 /*
-   isAnyType - return TRUE if node n is any type kind.
+   setOpaqueCastState - set the voidStar field in opaquestate.
 */
 
-static bool isAnyType (decl_node n);
+static void setOpaqueCastState (decl_opaqueCastState *opaquestate, bool voidstar);
 
 /*
-   makeVal - creates a VAL (type, expression) node.
+   setNodeOpaqueVoidStar - sets the voidStar field in node to voidstar.
 */
 
-static decl_node makeVal (decl_node params);
+static void setNodeOpaqueVoidStar (decl_node__opaque n, bool voidstar);
 
 /*
-   makeCast - creates a cast node TYPENAME (expr).
+   nodeUsesOpaque - return TRUE if node n uses an opaque type.
 */
 
-static decl_node makeCast (decl_node c, decl_node p);
-static decl_node makeIntrinsicProc (decl_nodeT k, unsigned int noArgs, decl_node p);
+static bool nodeUsesOpaque (decl_node__opaque n);
 
 /*
-   makeIntrinsicUnaryType - create an intrisic unary type.
+   getNodeOpaqueVoidStar - return TRUE if the opaque type used by node n is a void *.
 */
 
-static decl_node makeIntrinsicUnaryType (decl_nodeT k, decl_node paramList, decl_node returnType);
+static bool getNodeOpaqueVoidStar (decl_node__opaque n);
 
 /*
-   makeIntrinsicBinaryType - create an intrisic binary type.
+   getOpaqueFlushNecessary - return TRUE if the value next differs from the opaque state.
 */
 
-static decl_node makeIntrinsicBinaryType (decl_nodeT k, decl_node paramList, decl_node returnType);
+static bool getOpaqueFlushNecessary (decl_opaqueCastState state, bool next);
 
 /*
-   checkIntrinsic - checks to see if the function call to, c, with
-                    parameter list, n, is really an intrinic.  If it
-                    is an intrinic then an intrinic node is created
-                    and returned.  Otherwise NIL is returned.
+   getNodeOpaqueFlushNecessary - return TRUE if the value of next requires a cast.
 */
 
-static decl_node checkIntrinsic (decl_node c, decl_node n);
+static bool getNodeOpaqueFlushNecessary (decl_node__opaque n, bool next);
 
 /*
-   checkCHeaders - check to see if the function is a C system function and
-                   requires a header file included.
+   makeOpaqueCast - wrap node n with an opaquecast node and assign
+                    voidstar into the new opaque state.
 */
 
-static void checkCHeaders (decl_node c);
+static decl_node__opaque makeOpaqueCast (decl_node__opaque n, bool voidstar);
 
 /*
-   isFuncCall - returns TRUE if, n, is a function/procedure call.
+   flushOpaque - perform a cast to voidstar (if necessary) and ignore the new
+                 node which could be created.
 */
 
-static bool isFuncCall (decl_node n);
+static void flushOpaque (mcPretty_pretty p, decl_node__opaque n, bool toVoidStar);
 
 /*
-   putTypeInternal - marks type, des, as being an internally generated type.
+   castOpaque - flushes the opaque type casts if necessary and changes the
+                voidstar boolean value.   If necessary it creates a opaquecast
+                and returns the new node otherwise return n.
 */
 
-static void putTypeInternal (decl_node des);
+static decl_node__opaque castOpaque (mcPretty_pretty p, decl_node__opaque n, bool toVoidStar);
 
 /*
-   isTypeInternal - returns TRUE if type, n, is internal.
+   isTypeOpaqueDefImp - returns TRUE if type is an opaque type by checking
+                        the def/imp pair of modules or fall back to the
+                        definition module.
 */
 
-static bool isTypeInternal (decl_node n);
+static bool isTypeOpaqueDefImp (decl_node__opaque type);
 
 /*
-   lookupBase - return node named n from the base symbol scope.
+   isParamVoidStar - return TRUE if the procedure or proctype opaque type
+                     parameter should be implemented as a (void * ).
 */
 
-static decl_node lookupBase (nameKey_Name n);
+static bool isParamVoidStar (decl_node__opaque n);
 
 /*
-   dumpScopes - display the names of all the scopes stacked.
+   isRefVoidStar - returns TRUE if the ref node uses an opaque type which
+                   is represented as a (void * ).
 */
 
-static void dumpScopes (void);
+static bool isRefVoidStar (decl_node__opaque n);
 
 /*
-   out0 - write string a to StdOut.
+   isReturnVoidStar - return TRUE if the procedure or proctype opaque type
+                      return type should be implemented as a (void * ).
 */
 
-static void out0 (const char *a_, unsigned int _a_high);
+static bool isReturnVoidStar (decl_node__opaque proc, decl_node__opaque type);
 
 /*
-   out1 - write string a to StdOut using format specifier a.
+   isVarVoidStar - return TRUE if the variable using an opaque type should
+                   be implemented as a (void * ).
 */
 
-static void out1 (const char *a_, unsigned int _a_high, decl_node s);
+static bool isVarVoidStar (decl_node__opaque n);
 
 /*
-   out2 - write string a to StdOut using format specifier a.
+   initNodeOpaqueState - initialize the node opaque state.
 */
 
-static void out2 (const char *a_, unsigned int _a_high, unsigned int c, decl_node s);
+static void initNodeOpaqueState (decl_node__opaque n);
 
 /*
-   out3 - write string a to StdOut using format specifier a.
+   assignNodeOpaqueCastState - copy the opaqueCastState from src into dest.
 */
 
-static void out3 (const char *a_, unsigned int _a_high, unsigned int l, nameKey_Name n, decl_node s);
+static void assignNodeOpaqueCastState (decl_node__opaque dest, decl_node__opaque src);
 
 /*
-   isUnary - returns TRUE if, n, is an unary node.
+   assignNodeOpaqueCastFalse - assign the voidstar field of dest to false.
+                               It assigns the opaque field of dest to the value
+                               of the src opaque field.
 */
 
-static bool isUnary (decl_node n);
+static void assignNodeOpaqueCastFalse (decl_node__opaque dest, decl_node__opaque src);
 
 /*
-   isBinary - returns TRUE if, n, is an binary node.
+   dumpOpaqueState -
 */
 
-static bool isBinary (decl_node n);
+static void dumpOpaqueState (decl_node__opaque n);
 
 /*
-   makeUnary - create a unary expression node with, e, as the argument
-               and res as the return type.
+   doParamC - emit parameter for C/C++.
 */
 
-static decl_node makeUnary (decl_nodeT k, decl_node e, decl_node res);
+static void doParamC (mcPretty_pretty p, decl_node__opaque n);
 
 /*
-   isLeafString - returns TRUE if n is a leaf node which is a string constant.
+   doVarParamC - emit a VAR parameter for C/C++.
 */
 
-static bool isLeafString (decl_node n);
+static void doVarParamC (mcPretty_pretty p, decl_node__opaque n);
 
 /*
-   getLiteralStringContents - return the contents of a literal node as a string.
+   doOptargC -
 */
 
-static DynamicStrings_String getLiteralStringContents (decl_node n);
+static void doOptargC (mcPretty_pretty p, decl_node__opaque n);
 
 /*
-   getStringContents - return the string contents of a constant, literal,
-                       string or a constexp node.
+   doParameterC -
 */
 
-static DynamicStrings_String getStringContents (decl_node n);
+static void doParameterC (mcPretty_pretty p, decl_node__opaque n);
 
 /*
-   addNames -
+   doProcTypeC -
 */
 
-static nameKey_Name addNames (decl_node a, decl_node b);
+static void doProcTypeC (mcPretty_pretty p, decl_node__opaque t, decl_node__opaque n);
 
 /*
-   resolveString -
+   isDeclInImp - returns TRUE if node type is declared as an opaque and
+                 is declared fully in the current implementation module.
+                 This should only be called if isType (type).  Its purpose
+                 is specific to a type checking whether it is an opaque type
+                 declared in the .def/.mod pair of the current imp module.
 */
 
-static decl_node resolveString (decl_node n);
+static bool isDeclInImp (decl_node__opaque type);
 
 /*
-   foldBinary -
+   doTypeNameModifier - adds the __opaque modifier to the type n provided
+                        it is an opaque type which is being declared in the
+                        implementation module.
 */
 
-static decl_node foldBinary (decl_nodeT k, decl_node l, decl_node r, decl_node res);
+static void doTypeNameModifier (mcPretty_pretty p, decl_node__opaque n);
 
 /*
-   makeBinary - create a binary node with left/right/result type:  l, r and resultType.
+   doTypesC -
 */
 
-static decl_node makeBinary (decl_nodeT k, decl_node l, decl_node r, decl_node resultType);
+static void doTypesC (decl_node__opaque n);
 
 /*
-   doMakeBinary - returns a binary node containing left/right/result values
-                  l, r, res, with a node operator, k.
+   doCompletePartialC -
 */
 
-static decl_node doMakeBinary (decl_nodeT k, decl_node l, decl_node r, decl_node res);
+static void doCompletePartialC (decl_node__opaque n);
 
 /*
-   doMakeComponentRef -
+   doCompletePartialRecord -
 */
 
-static decl_node doMakeComponentRef (decl_node rec, decl_node field);
+static void doCompletePartialRecord (mcPretty_pretty p, decl_node__opaque t, decl_node__opaque r);
 
 /*
-   isComponentRef -
+   doCompletePartialArray -
 */
 
-static bool isComponentRef (decl_node n);
+static void doCompletePartialArray (mcPretty_pretty p, decl_node__opaque t, decl_node__opaque r);
 
 /*
-   isArrayRef - returns TRUE if the node was an arrayref.
+   lookupConst -
 */
 
-static bool isArrayRef (decl_node n);
+static decl_node__opaque lookupConst (decl_node__opaque type, nameKey_Name n);
 
 /*
-   isDeref - returns TRUE if, n, is a deref node.
+   doMin -
 */
 
-static bool isDeref (decl_node n);
+static decl_node__opaque doMin (decl_node__opaque n);
 
 /*
-   makeBase - create a base type or constant.
-              It only supports the base types and constants
-              enumerated below.
+   doMax -
 */
 
-static decl_node makeBase (decl_nodeT k);
+static decl_node__opaque doMax (decl_node__opaque n);
 
 /*
-   isOrdinal - returns TRUE if, n, is an ordinal type.
+   getMax -
 */
 
-static bool isOrdinal (decl_node n);
+static decl_node__opaque getMax (decl_node__opaque n);
 
 /*
-   mixTypes -
+   getMin -
 */
 
-static decl_node mixTypes (decl_node a, decl_node b);
+static decl_node__opaque getMin (decl_node__opaque n);
 
 /*
-   doSetExprType -
+   doSubtractC -
 */
 
-static decl_node doSetExprType (decl_node *t, decl_node n);
+static void doSubtractC (mcPretty_pretty p, decl_node__opaque s);
 
 /*
-   getMaxMinType -
+   doSubrC -
 */
 
-static decl_node getMaxMinType (decl_node n);
+static void doSubrC (mcPretty_pretty p, decl_node__opaque s);
 
 /*
-   doGetFuncType -
+   doCompletePartialProcType -
 */
 
-static decl_node doGetFuncType (decl_node n);
+static void doCompletePartialProcType (mcPretty_pretty p, decl_node__opaque t, decl_node__opaque n);
 
 /*
-   doGetExprType - works out the type which is associated with node, n.
+   outputCompletePartialProcType -
 */
 
-static decl_node doGetExprType (decl_node n);
+static void outputCompletePartialProcType (mcPretty_pretty p, decl_node__opaque t, decl_node__opaque n);
 
 /*
-   getExprType - return the expression type.
+   isBase -
 */
 
-static decl_node getExprType (decl_node n);
+static bool isBase (decl_node__opaque n);
 
 /*
-   openOutput -
+   doBoolC -
 */
 
-static void openOutput (void);
+static void doBoolC (mcPretty_pretty p);
 
 /*
-   closeOutput -
+   doBaseC -
 */
 
-static void closeOutput (void);
+static void doBaseC (mcPretty_pretty p, decl_node__opaque n);
 
 /*
-   write - outputs a single char, ch.
+   isSystem -
 */
 
-static void write_ (char ch);
+static bool isSystem (decl_node__opaque n);
 
 /*
-   writeln -
+   doSystemC -
 */
 
-static void writeln (void);
+static void doSystemC (mcPretty_pretty p, decl_node__opaque n);
 
 /*
-   doIncludeC - include header file for definition module, n.
+   doArrayC -
 */
 
-static void doIncludeC (decl_node n);
+static void doArrayC (mcPretty_pretty p, decl_node__opaque n);
 
 /*
-   getSymScope - returns the scope where node, n, was declared.
+   doPointerC -
 */
 
-static decl_node getSymScope (decl_node n);
+static void doPointerC (mcPretty_pretty p, decl_node__opaque n, decl_node__opaque *m);
 
 /*
-   isQualifiedForced - should the node be written with a module prefix?
+   doRecordFieldC -
 */
 
-static bool isQualifiedForced (decl_node n);
+static void doRecordFieldC (mcPretty_pretty p, decl_node__opaque f);
 
 /*
-   getFQstring -
+   doVarientFieldC -
 */
 
-static DynamicStrings_String getFQstring (decl_node n);
+static void doVarientFieldC (mcPretty_pretty p, decl_node__opaque n);
 
 /*
-   getFQDstring -
+   doVarientC -
 */
 
-static DynamicStrings_String getFQDstring (decl_node n, bool scopes);
+static void doVarientC (mcPretty_pretty p, decl_node__opaque n);
 
 /*
-   getString - returns the name as a string.
+   doRecordC -
 */
 
-static DynamicStrings_String getString (decl_node n);
+static void doRecordC (mcPretty_pretty p, decl_node__opaque n, decl_node__opaque *m);
 
 /*
-   doNone - call HALT.
+   isBitset -
 */
 
-static void doNone (decl_node n);
+static bool isBitset (decl_node__opaque n);
 
 /*
-   doNothing - does nothing!
+   isNegative - returns TRUE if expression, n, is negative.
 */
 
-static void doNothing (decl_node n);
+static bool isNegative (decl_node__opaque n);
 
 /*
-   doConstC -
+   doSubrangeC -
 */
 
-static void doConstC (decl_node n);
+static void doSubrangeC (mcPretty_pretty p, decl_node__opaque n);
 
 /*
-   needsParen - returns TRUE if expression, n, needs to be enclosed in ().
+   doSetC - generates a C type which holds the set.
+            Currently we only support sets of size WORD.
 */
 
-static bool needsParen (decl_node n);
+static void doSetC (mcPretty_pretty p, decl_node__opaque n);
 
 /*
-   doUnary -
+   doTypeC -
 */
 
-static void doUnary (mcPretty_pretty p, const char *op_, unsigned int _op_high, decl_node expr, decl_node type, bool l, bool r);
+static void doTypeC (mcPretty_pretty p, decl_node__opaque n, decl_node__opaque *m);
 
 /*
-   doSetSub - perform  l & (~ r)
+   doArrayNameC - it displays the array declaration (it might be an unbounded).
 */
 
-static void doSetSub (mcPretty_pretty p, decl_node left, decl_node right);
+static void doArrayNameC (mcPretty_pretty p, decl_node__opaque n);
 
 /*
-   doPolyBinary -
+   doRecordNameC - emit the C/C++ record name <name of n>"_r".
 */
 
-static void doPolyBinary (mcPretty_pretty p, decl_nodeT op, decl_node left, decl_node right, bool l, bool r);
+static void doRecordNameC (mcPretty_pretty p, decl_node__opaque n);
 
 /*
-   doBinary -
+   doPointerNameC - emit the C/C++ pointer type <name of n>*.
 */
 
-static void doBinary (mcPretty_pretty p, const char *op_, unsigned int _op_high, decl_node left, decl_node right, bool l, bool r, bool unpackProc);
+static void doPointerNameC (mcPretty_pretty p, decl_node__opaque n);
 
 /*
-   doPostUnary -
+   doTypeNameC -
 */
 
-static void doPostUnary (mcPretty_pretty p, const char *op_, unsigned int _op_high, decl_node expr);
+static void doTypeNameC (mcPretty_pretty p, decl_node__opaque n);
 
 /*
-   doDeRefC -
+   isExternal - returns TRUE if symbol, n, was declared in another module.
 */
 
-static void doDeRefC (mcPretty_pretty p, decl_node expr);
+static bool isExternal (decl_node__opaque n);
 
 /*
-   doGetLastOp - returns, a, if b is a terminal otherwise walk right.
+   doOpaqueModifier - adds postfix __opaque providing n uses an opaque type which is
+                      not represented by ( void * ).  n is a non type node which might
+                      be using an opaque type.  For example a var or param node.
 */
 
-static decl_node doGetLastOp (decl_node a, decl_node b);
+static void doOpaqueModifier (mcPretty_pretty p, decl_node__opaque n);
 
 /*
-   doComponentRefC -
+   doDeclareVarC -
 */
 
-static void doComponentRefC (mcPretty_pretty p, decl_node l, decl_node r);
+static void doDeclareVarC (decl_node__opaque n);
 
 /*
-   doPointerRefC -
+   doVarC - output a variable declaration.  Note that we do not generate
+            a declaration if we are translating the implementation module
+            and a variable is exported as the variable will be in the .h
+            file to avoid all -Wodr issues.
 */
 
-static void doPointerRefC (mcPretty_pretty p, decl_node l, decl_node r);
+static void doVarC (decl_node__opaque n);
 
 /*
-   doPreBinary -
+   doExternCP -
 */
 
-static void doPreBinary (mcPretty_pretty p, const char *op_, unsigned int _op_high, decl_node left, decl_node right, bool l, bool r);
+static void doExternCP (mcPretty_pretty p);
 
 /*
-   doConstExpr -
+   doProcedureCommentText -
 */
 
-static void doConstExpr (mcPretty_pretty p, decl_node n);
+static void doProcedureCommentText (mcPretty_pretty p, DynamicStrings_String s);
 
 /*
-   doEnumerationField -
+   doProcedureComment -
 */
 
-static void doEnumerationField (mcPretty_pretty p, decl_node n);
+static void doProcedureComment (mcPretty_pretty p, DynamicStrings_String s);
 
 /*
-   isZero - returns TRUE if node, n, is zero.
+   doProcedureHeadingC -
 */
 
-static bool isZero (decl_node n);
+static void doProcedureHeadingC (decl_node__opaque n, bool prototype);
 
 /*
-   doArrayRef -
+   checkDeclareUnboundedParamCopyC -
 */
 
-static void doArrayRef (mcPretty_pretty p, decl_node n);
+static bool checkDeclareUnboundedParamCopyC (mcPretty_pretty p, decl_node__opaque n);
 
 /*
-   doProcedure -
+   checkUnboundedParamCopyC -
 */
 
-static void doProcedure (mcPretty_pretty p, decl_node n);
+static void checkUnboundedParamCopyC (mcPretty_pretty p, decl_node__opaque n);
 
 /*
-   doRecordfield -
+   doUnboundedParamCopyC -
 */
 
-static void doRecordfield (mcPretty_pretty p, decl_node n);
+static void doUnboundedParamCopyC (mcPretty_pretty p, decl_node__opaque n);
 
 /*
-   doCastC -
+   doPrototypeC -
 */
 
-static void doCastC (mcPretty_pretty p, decl_node t, decl_node e);
+static void doPrototypeC (decl_node__opaque n);
 
 /*
-   doSetValueC -
+   addTodo - adds, n, to the todo list.
 */
 
-static void doSetValueC (mcPretty_pretty p, decl_node n);
+static void addTodo (decl_node__opaque n);
 
 /*
-   getSetLow - returns the low value of the set type from
-               expression, n.
+   addVariablesTodo -
 */
 
-static decl_node getSetLow (decl_node n);
+static void addVariablesTodo (decl_node__opaque n);
 
 /*
-   doInC - performs (((1 << (l)) & (r)) != 0)
+   addTypesTodo -
 */
 
-static void doInC (mcPretty_pretty p, decl_node l, decl_node r);
+static void addTypesTodo (decl_node__opaque n);
 
 /*
-   doThrowC -
+   tempName -
 */
 
-static void doThrowC (mcPretty_pretty p, decl_node n);
+static DynamicStrings_String tempName (void);
 
 /*
-   doUnreachableC -
+   makeIntermediateType -
 */
 
-static void doUnreachableC (mcPretty_pretty p, decl_node n);
+static decl_node__opaque makeIntermediateType (DynamicStrings_String s, decl_node__opaque p);
 
 /*
-   outNull -
+   simplifyType -
 */
 
-static void outNull (mcPretty_pretty p);
+static void simplifyType (alists_alist l, decl_node__opaque *p);
 
 /*
-   outTrue -
+   simplifyVar -
 */
 
-static void outTrue (mcPretty_pretty p);
+static void simplifyVar (alists_alist l, decl_node__opaque n);
 
 /*
-   outFalse -
+   simplifyRecord -
 */
 
-static void outFalse (mcPretty_pretty p);
+static void simplifyRecord (alists_alist l, decl_node__opaque n);
 
 /*
-   doExprC -
+   simplifyVarient -
 */
 
-static void doExprC (mcPretty_pretty p, decl_node n);
+static void simplifyVarient (alists_alist l, decl_node__opaque n);
 
 /*
-   doExprCup -
+   simplifyVarientField -
 */
 
-static void doExprCup (mcPretty_pretty p, decl_node n, bool unpackProc);
+static void simplifyVarientField (alists_alist l, decl_node__opaque n);
 
 /*
-   doExprM2 -
+   doSimplifyNode -
 */
 
-static void doExprM2 (mcPretty_pretty p, decl_node n);
+static void doSimplifyNode (alists_alist l, decl_node__opaque n);
 
 /*
-   doVar -
+   simplifyNode -
 */
 
-static void doVar (mcPretty_pretty p, decl_node n);
+static void simplifyNode (alists_alist l, decl_node__opaque n);
 
 /*
-   doLiteralC -
+   doSimplify -
 */
 
-static void doLiteralC (mcPretty_pretty p, decl_node n);
+static void doSimplify (decl_node__opaque n);
 
 /*
-   doLiteral -
+   simplifyTypes -
 */
 
-static void doLiteral (mcPretty_pretty p, decl_node n);
+static void simplifyTypes (decl_scopeT s);
 
 /*
-   isString - returns TRUE if node, n, is a string.
+   outDeclsDefC -
 */
 
-static bool isString (decl_node n);
+static void outDeclsDefC (mcPretty_pretty p, decl_node__opaque n);
 
 /*
-   doString -
+   includeConstType -
 */
 
-static void doString (mcPretty_pretty p, decl_node n);
+static void includeConstType (decl_scopeT s);
 
 /*
-   replaceChar - replace every occurance of, ch, by, a and return modified string, s.
+   includeVarProcedure -
 */
 
-static DynamicStrings_String replaceChar (DynamicStrings_String s, char ch, const char *a_, unsigned int _a_high);
+static void includeVarProcedure (decl_scopeT s);
 
 /*
-   toCstring - translates string, n, into a C string
-               and returns the new String.
+   includeVar -
 */
 
-static DynamicStrings_String toCstring (nameKey_Name n);
+static void includeVar (decl_scopeT s);
 
 /*
-   toCchar -
+   includeExternals -
 */
 
-static DynamicStrings_String toCchar (nameKey_Name n);
+static void includeExternals (decl_node__opaque n);
 
 /*
-   countChar -
+   checkSystemInclude -
 */
 
-static unsigned int countChar (DynamicStrings_String s, char ch);
+static void checkSystemInclude (decl_node__opaque n);
 
 /*
-   lenCstring -
+   addExported -
 */
 
-static unsigned int lenCstring (DynamicStrings_String s);
+static void addExported (decl_node__opaque n);
 
 /*
-   outCstring -
+   addExternal - only adds, n, if this symbol is external to the
+                 implementation module and is not a hidden type.
 */
 
-static void outCstring (mcPretty_pretty p, decl_node s, bool aString);
+static void addExternal (decl_node__opaque n);
 
 /*
-   doStringC -
+   includeDefConstType -
 */
 
-static void doStringC (mcPretty_pretty p, decl_node n);
+static void includeDefConstType (decl_node__opaque n);
 
 /*
-   isPunct -
+   runIncludeDefConstType -
 */
 
-static bool isPunct (char ch);
+static void runIncludeDefConstType (decl_node__opaque n);
 
 /*
-   isWhite -
+   joinProcedures - copies procedures from definition module,
+                    d, into implementation module, i.
 */
 
-static bool isWhite (char ch);
+static void joinProcedures (decl_node__opaque i, decl_node__opaque d);
 
 /*
-   outText -
+   includeDefVarProcedure -
 */
 
-static void outText (mcPretty_pretty p, const char *a_, unsigned int _a_high);
+static void includeDefVarProcedure (decl_node__opaque n);
 
 /*
-   outRawS -
+   foreachModuleDo -
 */
 
-static void outRawS (mcPretty_pretty p, DynamicStrings_String s);
+static void foreachModuleDo (decl_node__opaque n, symbolKey_performOperation p);
 
 /*
-   outKm2 -
+   outDeclsImpC -
 */
 
-static mcPretty_pretty outKm2 (mcPretty_pretty p, const char *a_, unsigned int _a_high);
+static void outDeclsImpC (mcPretty_pretty p, decl_scopeT s);
 
 /*
-   outKc -
+   doStatementSequenceC -
 */
 
-static mcPretty_pretty outKc (mcPretty_pretty p, const char *a_, unsigned int _a_high);
+static void doStatementSequenceC (mcPretty_pretty p, decl_node__opaque s);
 
 /*
-   outTextS -
+   isStatementSequenceEmpty -
 */
 
-static void outTextS (mcPretty_pretty p, DynamicStrings_String s);
+static bool isStatementSequenceEmpty (decl_node__opaque s);
 
 /*
-   outCard -
+   isSingleStatement - returns TRUE if the statement sequence, s, has
+                       only one statement.
 */
 
-static void outCard (mcPretty_pretty p, unsigned int c);
+static bool isSingleStatement (decl_node__opaque s);
 
 /*
-   outTextN -
+   doCommentC -
 */
 
-static void outTextN (mcPretty_pretty p, nameKey_Name n);
+static void doCommentC (mcPretty_pretty p, decl_node__opaque s);
 
 /*
-   doTypeAliasC -
+   doAfterCommentC - emit an after comment, c, or a newline if, c, is empty.
 */
 
-static void doTypeAliasC (mcPretty_pretty p, decl_node n, decl_node *m);
+static void doAfterCommentC (mcPretty_pretty p, decl_node__opaque c);
 
 /*
-   doEnumerationC -
+   doReturnC - issue a return statement and also place in an after comment if one exists.
 */
 
-static void doEnumerationC (mcPretty_pretty p, decl_node n);
+static void doReturnC (mcPretty_pretty p, decl_node__opaque s);
 
 /*
-   doNamesC -
+   isZtypeEquivalent -
 */
 
-static void doNamesC (mcPretty_pretty p, nameKey_Name n);
+static bool isZtypeEquivalent (decl_node__opaque type);
 
 /*
-   doNameC -
+   isEquivalentType - returns TRUE if type1 and type2 are equivalent.
 */
 
-static void doNameC (mcPretty_pretty p, decl_node n);
+static bool isEquivalentType (decl_node__opaque type1, decl_node__opaque type2);
 
 /*
-   initCname -
+   doExprCastC - build a cast if necessary.
 */
 
-static void initCname (decl_cnameT *c);
+static void doExprCastC (mcPretty_pretty p, decl_node__opaque e, decl_node__opaque type);
 
 /*
-   doCname -
+   requiresUnpackProc - returns TRUE if either the expr is a procedure or the proctypes differ.
 */
 
-static nameKey_Name doCname (nameKey_Name n, decl_cnameT *c, bool scopes);
+static bool requiresUnpackProc (decl_node__opaque s);
 
 /*
-   getDName -
+   forceCastOpaque -
 */
 
-static nameKey_Name getDName (decl_node n, bool scopes);
+static void forceCastOpaque (mcPretty_pretty p, decl_node__opaque des, decl_node__opaque expr, bool toVoidStar);
 
 /*
-   doDNameC -
+   forceReintCastOpaque -
 */
 
-static void doDNameC (mcPretty_pretty p, decl_node n, bool scopes);
+static void forceReintCastOpaque (mcPretty_pretty p, decl_node__opaque des, decl_node__opaque expr, bool toVoidStar);
 
 /*
-   doFQDNameC -
+   doUnConstCastUnbounded - if node n type is an unbounded array then
+                            use const_cast to remove the const parameter
+                            to allow the unbounded array to be modified.
 */
 
-static void doFQDNameC (mcPretty_pretty p, decl_node n, bool scopes);
+static void doUnConstCastUnbounded (mcPretty_pretty p, decl_node__opaque n);
 
 /*
-   doFQNameC -
+   doAssignmentC -
 */
 
-static void doFQNameC (mcPretty_pretty p, decl_node n);
+static void doAssignmentC (mcPretty_pretty p, decl_node__opaque s);
 
 /*
-   doNameM2 -
+   containsStatement -
 */
 
-static void doNameM2 (mcPretty_pretty p, decl_node n);
+static bool containsStatement (decl_node__opaque s);
 
 /*
-   doUsed -
+   doCompoundStmt -
 */
 
-static void doUsed (mcPretty_pretty p, bool used);
+static void doCompoundStmt (mcPretty_pretty p, decl_node__opaque s);
 
 /*
-   doHighC -
+   doElsifC -
 */
 
-static void doHighC (mcPretty_pretty p, decl_node a, nameKey_Name n, bool isused);
+static void doElsifC (mcPretty_pretty p, decl_node__opaque s);
 
 /*
-   doParamConstCast -
+   noIfElse -
 */
 
-static void doParamConstCast (mcPretty_pretty p, decl_node n);
+static bool noIfElse (decl_node__opaque n);
 
 /*
-   getParameterVariable - returns the variable which shadows the parameter
-                          named, m, in parameter block, n.
+   noIfElseChained - returns TRUE if, n, is an IF statement which
+                     has no associated ELSE statement.  An IF with an
+                     ELSIF is also checked for no ELSE and will result
+                     in a return value of TRUE.
 */
 
-static decl_node getParameterVariable (decl_node n, nameKey_Name m);
+static bool noIfElseChained (decl_node__opaque n);
 
 /*
-   doParamTypeEmit - emit parameter type for C/C++.  It checks to see if the
-                     parameter type is a procedure type and if it were declared
-                     in a definition module for "C" and if so it uses the "C"
-                     definition for a procedure type, rather than the mc
-                     C++ version.
+   hasIfElse -
 */
 
-static void doParamTypeEmit (mcPretty_pretty p, decl_node paramnode, decl_node paramtype);
+static bool hasIfElse (decl_node__opaque n);
 
 /*
-   doParamC - emit parameter for C/C++.
+   isIfElse -
 */
 
-static void doParamC (mcPretty_pretty p, decl_node n);
+static bool isIfElse (decl_node__opaque n);
 
 /*
-   doVarParamC - emit a VAR parameter for C/C++.
+   hasIfAndNoElse - returns TRUE if statement, n, is a single statement
+                    which is an IF and it has no else statement.
 */
 
-static void doVarParamC (mcPretty_pretty p, decl_node n);
+static bool hasIfAndNoElse (decl_node__opaque n);
 
 /*
-   doOptargC -
+   doIfC - issue an if statement and also place in an after comment if one exists.
+           The if statement might contain an else or elsif which are also handled.
 */
 
-static void doOptargC (mcPretty_pretty p, decl_node n);
+static void doIfC (mcPretty_pretty p, decl_node__opaque s);
 
 /*
-   doParameterC -
+   doForIncCP -
 */
 
-static void doParameterC (mcPretty_pretty p, decl_node n);
+static void doForIncCP (mcPretty_pretty p, decl_node__opaque s);
 
 /*
-   doProcTypeC -
+   doForIncC -
 */
 
-static void doProcTypeC (mcPretty_pretty p, decl_node t, decl_node n);
+static void doForIncC (mcPretty_pretty p, decl_node__opaque s);
 
 /*
-   doTypesC -
+   doForInc -
 */
 
-static void doTypesC (decl_node n);
+static void doForInc (mcPretty_pretty p, decl_node__opaque s);
 
 /*
-   doCompletePartialC -
+   doForC -
 */
 
-static void doCompletePartialC (decl_node n);
+static void doForC (mcPretty_pretty p, decl_node__opaque s);
 
 /*
-   doCompletePartialRecord -
+   doRepeatC -
 */
 
-static void doCompletePartialRecord (mcPretty_pretty p, decl_node t, decl_node r);
+static void doRepeatC (mcPretty_pretty p, decl_node__opaque s);
 
 /*
-   doCompletePartialArray -
+   doWhileC -
 */
 
-static void doCompletePartialArray (mcPretty_pretty p, decl_node t, decl_node r);
+static void doWhileC (mcPretty_pretty p, decl_node__opaque s);
 
 /*
-   lookupConst -
+   doFuncHighC -
 */
 
-static decl_node lookupConst (decl_node type, nameKey_Name n);
+static void doFuncHighC (mcPretty_pretty p, decl_node__opaque a);
 
 /*
-   doMin -
+   doMultiplyBySize -
 */
 
-static decl_node doMin (decl_node n);
+static void doMultiplyBySize (mcPretty_pretty p, decl_node__opaque a);
 
 /*
-   doMax -
+   doTotype -
 */
 
-static decl_node doMax (decl_node n);
+static void doTotype (mcPretty_pretty p, decl_node__opaque a, decl_node__opaque t);
 
 /*
-   getMax -
+   doFuncUnbounded -
 */
 
-static decl_node getMax (decl_node n);
+static void doFuncUnbounded (mcPretty_pretty p, decl_node__opaque actual, decl_node__opaque formalParam, decl_node__opaque formal, decl_node__opaque func);
 
 /*
-   getMin -
+   doProcedureParamC -
 */
 
-static decl_node getMin (decl_node n);
+static void doProcedureParamC (mcPretty_pretty p, decl_node__opaque actual, decl_node__opaque formal);
 
 /*
-   doSubtractC -
+   doAdrExprC -
 */
 
-static void doSubtractC (mcPretty_pretty p, decl_node s);
+static void doAdrExprC (mcPretty_pretty p, decl_node__opaque n);
 
 /*
-   doSubrC -
+   typePair -
 */
 
-static void doSubrC (mcPretty_pretty p, decl_node s);
+static bool typePair (decl_node__opaque a, decl_node__opaque b, decl_node__opaque x, decl_node__opaque y);
 
 /*
-   doCompletePartialProcType -
+   needsCast - return TRUE if the actual type parameter needs to be cast to
+               the formal type.
 */
 
-static void doCompletePartialProcType (mcPretty_pretty p, decl_node t, decl_node n);
+static bool needsCast (decl_node__opaque at, decl_node__opaque ft);
 
 /*
-   isBase -
+   checkSystemCast - checks to see if we are passing to/from
+                     a system generic type (WORD, BYTE, ADDRESS)
+                     and if so emit a cast.  It returns the number of
+                     open parenthesis.
 */
 
-static bool isBase (decl_node n);
+static unsigned int checkSystemCast (mcPretty_pretty p, decl_node__opaque actual, decl_node__opaque formal);
 
 /*
-   doBoolC -
+   emitN -
 */
 
-static void doBoolC (mcPretty_pretty p);
+static void emitN (mcPretty_pretty p, const char *a_, unsigned int _a_high, unsigned int n);
 
 /*
-   doBaseC -
+   isForC - return true if node n is a varparam, param or procedure
+            which was declared inside a definition module for "C".
 */
 
-static void doBaseC (mcPretty_pretty p, decl_node n);
+static bool isForC (decl_node__opaque n);
 
 /*
-   isSystem -
+   isDefForCNode - return TRUE if node n was declared inside a definition module for "C".
 */
 
-static bool isSystem (decl_node n);
+static bool isDefForCNode (decl_node__opaque n);
 
 /*
-   doSystemC -
+   doFuncVarParam - detect whether the formal uses an opaque and ensure that the address of
+                    the actual parameter is cast to the formal type.
 */
 
-static void doSystemC (mcPretty_pretty p, decl_node n);
+static void doFuncVarParam (mcPretty_pretty p, decl_node__opaque actual, decl_node__opaque formal);
 
 /*
-   doArrayC -
+   doFuncParamC -
 */
 
-static void doArrayC (mcPretty_pretty p, decl_node n);
+static void doFuncParamC (mcPretty_pretty p, decl_node__opaque actual, decl_node__opaque formal, decl_node__opaque func);
 
 /*
-   doPointerC -
+   getNthParamType - return the type of parameter, i, in list, l.
+                     If the parameter is a vararg NIL is returned.
 */
 
-static void doPointerC (mcPretty_pretty p, decl_node n, decl_node *m);
+static decl_node__opaque getNthParamType (Indexing_Index l, unsigned int i);
 
 /*
-   doRecordFieldC -
+   getNthParam - return the parameter, i, in list, l.
+                 If the parameter is a vararg NIL is returned.
 */
 
-static void doRecordFieldC (mcPretty_pretty p, decl_node f);
+static decl_node__opaque getNthParam (Indexing_Index l, unsigned int i);
 
 /*
-   doVarientFieldC -
+   doFuncArgsC -
 */
 
-static void doVarientFieldC (mcPretty_pretty p, decl_node n);
+static void doFuncArgsC (mcPretty_pretty p, decl_node__opaque s, Indexing_Index l, bool needParen);
 
 /*
-   doVarientC -
+   doProcTypeArgsC -
 */
 
-static void doVarientC (mcPretty_pretty p, decl_node n);
+static void doProcTypeArgsC (mcPretty_pretty p, decl_node__opaque s, Indexing_Index args, bool needParen);
 
 /*
-   doRecordC -
+   doAdrArgC -
 */
 
-static void doRecordC (mcPretty_pretty p, decl_node n, decl_node *m);
+static void doAdrArgC (mcPretty_pretty p, decl_node__opaque n);
 
 /*
-   isBitset -
+   doAdrC -
 */
 
-static bool isBitset (decl_node n);
+static void doAdrC (mcPretty_pretty p, decl_node__opaque n);
 
 /*
-   isNegative - returns TRUE if expression, n, is negative.
+   doInc -
 */
 
-static bool isNegative (decl_node n);
+static void doInc (mcPretty_pretty p, decl_node__opaque n);
 
 /*
-   doSubrangeC -
+   doDec -
 */
 
-static void doSubrangeC (mcPretty_pretty p, decl_node n);
+static void doDec (mcPretty_pretty p, decl_node__opaque n);
 
 /*
-   doSetC - generates a C type which holds the set.
-            Currently we only support sets of size WORD.
+   doIncDecC -
 */
 
-static void doSetC (mcPretty_pretty p, decl_node n);
+static void doIncDecC (mcPretty_pretty p, decl_node__opaque n, const char *op_, unsigned int _op_high);
 
 /*
-   doTypeC -
+   doIncDecCP -
 */
 
-static void doTypeC (mcPretty_pretty p, decl_node n, decl_node *m);
+static void doIncDecCP (mcPretty_pretty p, decl_node__opaque n, const char *op_, unsigned int _op_high);
 
 /*
-   doArrayNameC - it displays the array declaration (it might be an unbounded).
+   doInclC -
 */
 
-static void doArrayNameC (mcPretty_pretty p, decl_node n);
+static void doInclC (mcPretty_pretty p, decl_node__opaque n);
 
 /*
-   doRecordNameC - emit the C/C++ record name <name of n>"_r".
+   doExclC -
 */
 
-static void doRecordNameC (mcPretty_pretty p, decl_node n);
+static void doExclC (mcPretty_pretty p, decl_node__opaque n);
 
 /*
-   doPointerNameC - emit the C/C++ pointer type <name of n>*.
+   doNewC -
 */
 
-static void doPointerNameC (mcPretty_pretty p, decl_node n);
+static void doNewC (mcPretty_pretty p, decl_node__opaque n);
 
 /*
-   doTypeNameC -
+   doDisposeC -
 */
 
-static void doTypeNameC (mcPretty_pretty p, decl_node n);
+static void doDisposeC (mcPretty_pretty p, decl_node__opaque n);
 
 /*
-   isExternal - returns TRUE if symbol, n, was declared in another module.
+   doCapC -
 */
 
-static bool isExternal (decl_node n);
+static void doCapC (mcPretty_pretty p, decl_node__opaque n);
 
 /*
-   doVarC -
+   doLengthC -
 */
 
-static void doVarC (decl_node n);
+static void doLengthC (mcPretty_pretty p, decl_node__opaque n);
 
 /*
-   doExternCP -
+   doAbsC -
 */
 
-static void doExternCP (mcPretty_pretty p);
+static void doAbsC (mcPretty_pretty p, decl_node__opaque n);
 
 /*
-   doProcedureCommentText -
+   doValC -
 */
 
-static void doProcedureCommentText (mcPretty_pretty p, DynamicStrings_String s);
+static void doValC (mcPretty_pretty p, decl_node__opaque n);
 
 /*
-   doProcedureComment -
+   doMinC -
 */
 
-static void doProcedureComment (mcPretty_pretty p, DynamicStrings_String s);
+static void doMinC (mcPretty_pretty p, decl_node__opaque n);
 
 /*
-   doProcedureHeadingC -
+   doMaxC -
 */
 
-static void doProcedureHeadingC (decl_node n, bool prototype);
+static void doMaxC (mcPretty_pretty p, decl_node__opaque n);
 
 /*
-   checkDeclareUnboundedParamCopyC -
+   isIntrinsic - returns if, n, is an intrinsic procedure.
+                 The intrinsic functions are represented as unary and binary nodes.
 */
 
-static bool checkDeclareUnboundedParamCopyC (mcPretty_pretty p, decl_node n);
+static bool isIntrinsic (decl_node__opaque n);
 
 /*
-   checkUnboundedParamCopyC -
+   doHalt -
 */
 
-static void checkUnboundedParamCopyC (mcPretty_pretty p, decl_node n);
+static void doHalt (mcPretty_pretty p, decl_node__opaque n);
 
 /*
-   doUnboundedParamCopyC -
+   doCreal - emit the appropriate creal function.
 */
 
-static void doUnboundedParamCopyC (mcPretty_pretty p, decl_node n);
+static void doCreal (mcPretty_pretty p, decl_node__opaque t);
 
 /*
-   doPrototypeC -
+   doCimag - emit the appropriate cimag function.
 */
 
-static void doPrototypeC (decl_node n);
+static void doCimag (mcPretty_pretty p, decl_node__opaque t);
 
 /*
-   addTodo - adds, n, to the todo list.
+   doReC -
 */
 
-static void addTodo (decl_node n);
+static void doReC (mcPretty_pretty p, decl_node__opaque n);
 
 /*
-   addVariablesTodo -
+   doImC -
 */
 
-static void addVariablesTodo (decl_node n);
+static void doImC (mcPretty_pretty p, decl_node__opaque n);
 
 /*
-   addTypesTodo -
+   doCmplx -
 */
 
-static void addTypesTodo (decl_node n);
+static void doCmplx (mcPretty_pretty p, decl_node__opaque n);
 
 /*
-   tempName -
+   doIntrinsicC -
 */
 
-static DynamicStrings_String tempName (void);
+static void doIntrinsicC (mcPretty_pretty p, decl_node__opaque n);
 
 /*
-   makeIntermediateType -
+   isIntrinsicFunction - returns true if, n, is an instrinsic function.
 */
 
-static decl_node makeIntermediateType (DynamicStrings_String s, decl_node p);
+static bool isIntrinsicFunction (decl_node__opaque n);
 
 /*
-   simplifyType -
+   doSizeC -
 */
 
-static void simplifyType (alists_alist l, decl_node *p);
+static void doSizeC (mcPretty_pretty p, decl_node__opaque n);
 
 /*
-   simplifyVar -
+   doConvertC -
 */
 
-static void simplifyVar (alists_alist l, decl_node n);
+static void doConvertC (mcPretty_pretty p, decl_node__opaque n, const char *conversion_, unsigned int _conversion_high);
 
 /*
-   simplifyRecord -
+   doConvertSC -
 */
 
-static void simplifyRecord (alists_alist l, decl_node n);
+static void doConvertSC (mcPretty_pretty p, decl_node__opaque n, DynamicStrings_String conversion);
 
 /*
-   simplifyVarient -
+   getFunction - return the function associate with funccall node n.
 */
 
-static void simplifyVarient (alists_alist l, decl_node n);
+static decl_node__opaque getFunction (decl_node__opaque n);
 
 /*
-   simplifyVarientField -
+   getFuncFromExpr -
 */
 
-static void simplifyVarientField (alists_alist l, decl_node n);
+static decl_node__opaque getFuncFromExpr (decl_node__opaque n);
 
 /*
-   doSimplifyNode -
+   doFuncExprC -
 */
 
-static void doSimplifyNode (alists_alist l, decl_node n);
+static void doFuncExprC (mcPretty_pretty p, decl_node__opaque n);
 
 /*
-   simplifyNode -
+   doFuncCallC -
 */
 
-static void simplifyNode (alists_alist l, decl_node n);
+static void doFuncCallC (mcPretty_pretty p, decl_node__opaque n);
 
 /*
-   doSimplify -
+   doCaseStatementC -
 */
 
-static void doSimplify (decl_node n);
+static void doCaseStatementC (mcPretty_pretty p, decl_node__opaque n, bool needBreak);
 
 /*
-   simplifyTypes -
+   doExceptionC -
 */
 
-static void simplifyTypes (decl_scopeT s);
+static void doExceptionC (mcPretty_pretty p, const char *a_, unsigned int _a_high, decl_node__opaque n);
 
 /*
-   outDeclsDefC -
+   doExceptionCP -
 */
 
-static void outDeclsDefC (mcPretty_pretty p, decl_node n);
+static void doExceptionCP (mcPretty_pretty p, const char *a_, unsigned int _a_high, decl_node__opaque n);
 
 /*
-   includeConstType -
+   doException -
 */
 
-static void includeConstType (decl_scopeT s);
+static void doException (mcPretty_pretty p, const char *a_, unsigned int _a_high, decl_node__opaque n);
 
 /*
-   includeVarProcedure -
+   doRangeListC -
 */
 
-static void includeVarProcedure (decl_scopeT s);
+static void doRangeListC (mcPretty_pretty p, decl_node__opaque c);
 
 /*
-   includeVar -
+   doRangeIfListC -
 */
 
-static void includeVar (decl_scopeT s);
+static void doRangeIfListC (mcPretty_pretty p, decl_node__opaque e, decl_node__opaque c);
 
 /*
-   includeExternals -
+   doCaseLabels -
 */
 
-static void includeExternals (decl_node n);
+static void doCaseLabels (mcPretty_pretty p, decl_node__opaque n, bool needBreak);
 
 /*
-   checkSystemInclude -
+   doCaseLabelListC -
 */
 
-static void checkSystemInclude (decl_node n);
+static void doCaseLabelListC (mcPretty_pretty p, decl_node__opaque n, bool haveElse);
 
 /*
-   addExported -
+   doCaseIfLabels -
 */
 
-static void addExported (decl_node n);
+static void doCaseIfLabels (mcPretty_pretty p, decl_node__opaque e, decl_node__opaque n, unsigned int i, unsigned int h);
 
 /*
-   addExternal - only adds, n, if this symbol is external to the
-                 implementation module and is not a hidden type.
+   doCaseIfLabelListC -
 */
 
-static void addExternal (decl_node n);
+static void doCaseIfLabelListC (mcPretty_pretty p, decl_node__opaque n);
 
 /*
-   includeDefConstType -
+   doCaseElseC -
 */
 
-static void includeDefConstType (decl_node n);
+static void doCaseElseC (mcPretty_pretty p, decl_node__opaque n);
 
 /*
-   runIncludeDefConstType -
+   doCaseIfElseC -
 */
 
-static void runIncludeDefConstType (decl_node n);
+static void doCaseIfElseC (mcPretty_pretty p, decl_node__opaque n);
 
 /*
-   joinProcedures - copies procedures from definition module,
-                    d, into implementation module, i.
+   canUseSwitchCaseLabels - returns TRUE if all the case labels are
+                            single values and not ranges.
 */
 
-static void joinProcedures (decl_node i, decl_node d);
+static bool canUseSwitchCaseLabels (decl_node__opaque n);
 
 /*
-   includeDefVarProcedure -
+   canUseSwitch - returns TRUE if the case statement can be implement
+                  by a switch statement.  This will be TRUE if all case
+                  selectors are single values rather than ranges.
 */
 
-static void includeDefVarProcedure (decl_node n);
+static bool canUseSwitch (decl_node__opaque n);
 
 /*
-   foreachModuleDo -
+   doCaseC -
 */
 
-static void foreachModuleDo (decl_node n, symbolKey_performOperation p);
+static void doCaseC (mcPretty_pretty p, decl_node__opaque n);
 
 /*
-   outDeclsImpC -
+   doLoopC -
 */
 
-static void outDeclsImpC (mcPretty_pretty p, decl_scopeT s);
+static void doLoopC (mcPretty_pretty p, decl_node__opaque s);
 
 /*
-   doStatementSequenceC -
+   doExitC -
 */
 
-static void doStatementSequenceC (mcPretty_pretty p, decl_node s);
+static void doExitC (mcPretty_pretty p, decl_node__opaque s);
 
 /*
-   isStatementSequenceEmpty -
+   doStatementsC -
 */
 
-static bool isStatementSequenceEmpty (decl_node s);
+static void doStatementsC (mcPretty_pretty p, decl_node__opaque s);
+static void localstop (void);
 
 /*
-   isSingleStatement - returns TRUE if the statement sequence, s, has
-                       only one statement.
+   doLocalVarC -
 */
 
-static bool isSingleStatement (decl_node s);
+static void doLocalVarC (mcPretty_pretty p, decl_scopeT s);
 
 /*
-   doCommentC -
+   doLocalConstTypesC -
 */
 
-static void doCommentC (mcPretty_pretty p, decl_node s);
+static void doLocalConstTypesC (mcPretty_pretty p, decl_scopeT s);
 
 /*
-   doAfterCommentC - emit an after comment, c, or a newline if, c, is empty.
+   addParamDone -
 */
 
-static void doAfterCommentC (mcPretty_pretty p, decl_node c);
+static void addParamDone (decl_node__opaque n);
 
 /*
-   doReturnC - issue a return statement and also place in an after comment if one exists.
+   includeParameters -
 */
 
-static void doReturnC (mcPretty_pretty p, decl_node s);
+static void includeParameters (decl_node__opaque n);
 
 /*
-   isZtypeEquivalent -
+   isHalt -
 */
 
-static bool isZtypeEquivalent (decl_node type);
+static bool isHalt (decl_node__opaque n);
 
 /*
-   isEquivalentType - returns TRUE if type1 and type2 are equivalent.
+   isReturnOrHalt -
 */
 
-static bool isEquivalentType (decl_node type1, decl_node type2);
+static bool isReturnOrHalt (decl_node__opaque n);
 
 /*
-   doExprCastC - build a cast if necessary.
+   isLastStatementReturn -
 */
 
-static void doExprCastC (mcPretty_pretty p, decl_node e, decl_node type);
+static bool isLastStatementReturn (decl_node__opaque n);
 
 /*
-   requiresUnpackProc - returns TRUE if either the expr is a procedure or the proctypes differ.
+   isLastStatementSequence -
 */
 
-static bool requiresUnpackProc (decl_node s);
+static bool isLastStatementSequence (decl_node__opaque n, decl_isNodeF q);
 
 /*
-   doAssignmentC -
+   isLastStatementIf -
 */
 
-static void doAssignmentC (mcPretty_pretty p, decl_node s);
+static bool isLastStatementIf (decl_node__opaque n, decl_isNodeF q);
 
 /*
-   containsStatement -
+   isLastStatementElsif -
 */
 
-static bool containsStatement (decl_node s);
+static bool isLastStatementElsif (decl_node__opaque n, decl_isNodeF q);
 
 /*
-   doCompoundStmt -
+   isLastStatementCase -
 */
 
-static void doCompoundStmt (mcPretty_pretty p, decl_node s);
+static bool isLastStatementCase (decl_node__opaque n, decl_isNodeF q);
 
 /*
-   doElsifC -
+   isLastStatement - returns TRUE if the last statement in, n, is, q.
 */
 
-static void doElsifC (mcPretty_pretty p, decl_node s);
+static bool isLastStatement (decl_node__opaque n, decl_isNodeF q);
 
 /*
-   noIfElse -
+   doProcedureC -
 */
 
-static bool noIfElse (decl_node n);
+static void doProcedureC (decl_node__opaque n);
 
 /*
-   noIfElseChained - returns TRUE if, n, is an IF statement which
-                     has no associated ELSE statement.  An IF with an
-                     ELSIF is also checked for no ELSE and will result
-                     in a return value of TRUE.
+   outProceduresC -
 */
 
-static bool noIfElseChained (decl_node n);
+static void outProceduresC (mcPretty_pretty p, decl_scopeT s);
 
 /*
-   hasIfElse -
+   output -
 */
 
-static bool hasIfElse (decl_node n);
+static void output (decl_node__opaque n, decl_nodeProcedure c, decl_nodeProcedure t, decl_nodeProcedure v);
 
 /*
-   isIfElse -
+   allDependants -
 */
 
-static bool isIfElse (decl_node n);
+static decl_dependentState allDependants (decl_node__opaque n);
 
 /*
-   hasIfAndNoElse - returns TRUE if statement, n, is a single statement
-                    which is an IF and it has no else statement.
+   walkDependants -
 */
 
-static bool hasIfAndNoElse (decl_node n);
+static decl_dependentState walkDependants (alists_alist l, decl_node__opaque n);
 
 /*
-   doIfC - issue an if statement and also place in an after comment if one exists.
-           The if statement might contain an else or elsif which are also handled.
+   walkType -
 */
 
-static void doIfC (mcPretty_pretty p, decl_node s);
+static decl_dependentState walkType (alists_alist l, decl_node__opaque n);
 
 /*
-   doForIncCP -
+   db -
 */
 
-static void doForIncCP (mcPretty_pretty p, decl_node s);
+static void db (const char *a_, unsigned int _a_high, decl_node__opaque n);
 
 /*
-   doForIncC -
+   dbt -
 */
 
-static void doForIncC (mcPretty_pretty p, decl_node s);
+static void dbt (const char *a_, unsigned int _a_high);
 
 /*
-   doForInc -
+   dbs -
 */
 
-static void doForInc (mcPretty_pretty p, decl_node s);
+static void dbs (decl_dependentState s, decl_node__opaque n);
 
 /*
-   doForC -
+   dbq -
 */
 
-static void doForC (mcPretty_pretty p, decl_node s);
+static void dbq (decl_node__opaque n);
 
 /*
-   doRepeatC -
+   walkRecord -
 */
 
-static void doRepeatC (mcPretty_pretty p, decl_node s);
+static decl_dependentState walkRecord (alists_alist l, decl_node__opaque n);
 
 /*
-   doWhileC -
+   walkVarient -
 */
 
-static void doWhileC (mcPretty_pretty p, decl_node s);
+static decl_dependentState walkVarient (alists_alist l, decl_node__opaque n);
 
 /*
-   doFuncHighC -
+   queueBlocked -
 */
 
-static void doFuncHighC (mcPretty_pretty p, decl_node a);
+static void queueBlocked (decl_node__opaque n);
 
 /*
-   doMultiplyBySize -
+   walkVar -
 */
 
-static void doMultiplyBySize (mcPretty_pretty p, decl_node a);
+static decl_dependentState walkVar (alists_alist l, decl_node__opaque n);
 
 /*
-   doTotype -
+   walkEnumeration -
 */
 
-static void doTotype (mcPretty_pretty p, decl_node a, decl_node t);
+static decl_dependentState walkEnumeration (alists_alist l, decl_node__opaque n);
 
 /*
-   doFuncUnbounded -
+   walkSubrange -
 */
 
-static void doFuncUnbounded (mcPretty_pretty p, decl_node actual, decl_node formalParam, decl_node formal, decl_node func);
+static decl_dependentState walkSubrange (alists_alist l, decl_node__opaque n);
 
 /*
-   doProcedureParamC -
+   walkSubscript -
 */
 
-static void doProcedureParamC (mcPretty_pretty p, decl_node actual, decl_node formal);
+static decl_dependentState walkSubscript (alists_alist l, decl_node__opaque n);
 
 /*
-   doAdrExprC -
+   walkPointer -
 */
 
-static void doAdrExprC (mcPretty_pretty p, decl_node n);
+static decl_dependentState walkPointer (alists_alist l, decl_node__opaque n);
 
 /*
-   typePair -
+   walkArray -
 */
 
-static bool typePair (decl_node a, decl_node b, decl_node x, decl_node y);
+static decl_dependentState walkArray (alists_alist l, decl_node__opaque n);
 
 /*
-   needsCast - return TRUE if the actual type parameter needs to be cast to
-               the formal type.
+   walkConst -
 */
 
-static bool needsCast (decl_node at, decl_node ft);
+static decl_dependentState walkConst (alists_alist l, decl_node__opaque n);
 
 /*
-   checkSystemCast - checks to see if we are passing to/from
-                     a system generic type (WORD, BYTE, ADDRESS)
-                     and if so emit a cast.  It returns the number of
-                     open parenthesis.
+   walkVarParam -
 */
 
-static unsigned int checkSystemCast (mcPretty_pretty p, decl_node actual, decl_node formal);
+static decl_dependentState walkVarParam (alists_alist l, decl_node__opaque n);
 
 /*
-   emitN -
+   walkParam -
 */
 
-static void emitN (mcPretty_pretty p, const char *a_, unsigned int _a_high, unsigned int n);
+static decl_dependentState walkParam (alists_alist l, decl_node__opaque n);
 
 /*
-   isForC - return true if node n is a varparam, param or procedure
-            which was declared inside a definition module for "C".
+   walkOptarg -
 */
 
-static bool isForC (decl_node n);
+static decl_dependentState walkOptarg (alists_alist l, decl_node__opaque n);
 
 /*
-   isDefForCNode - return TRUE if node n was declared inside a definition module for "C".
+   walkRecordField -
 */
 
-static bool isDefForCNode (decl_node n);
+static decl_dependentState walkRecordField (alists_alist l, decl_node__opaque n);
 
 /*
-   doFuncParamC -
+   walkVarientField -
 */
 
-static void doFuncParamC (mcPretty_pretty p, decl_node actual, decl_node formal, decl_node func);
+static decl_dependentState walkVarientField (alists_alist l, decl_node__opaque n);
 
 /*
-   getNthParamType - return the type of parameter, i, in list, l.
-                     If the parameter is a vararg NIL is returned.
+   walkEnumerationField -
 */
 
-static decl_node getNthParamType (Indexing_Index l, unsigned int i);
+static decl_dependentState walkEnumerationField (alists_alist l, decl_node__opaque n);
 
 /*
-   getNthParam - return the parameter, i, in list, l.
-                 If the parameter is a vararg NIL is returned.
+   walkSet -
 */
 
-static decl_node getNthParam (Indexing_Index l, unsigned int i);
+static decl_dependentState walkSet (alists_alist l, decl_node__opaque n);
 
 /*
-   doFuncArgsC -
+   walkProcType -
 */
 
-static void doFuncArgsC (mcPretty_pretty p, decl_node s, Indexing_Index l, bool needParen);
+static decl_dependentState walkProcType (alists_alist l, decl_node__opaque n);
 
 /*
-   doProcTypeArgsC -
+   walkProcedure -
 */
 
-static void doProcTypeArgsC (mcPretty_pretty p, decl_node s, Indexing_Index args, bool needParen);
+static decl_dependentState walkProcedure (alists_alist l, decl_node__opaque n);
 
 /*
-   doAdrArgC -
+   walkParameters -
 */
 
-static void doAdrArgC (mcPretty_pretty p, decl_node n);
+static decl_dependentState walkParameters (alists_alist l, Indexing_Index p);
 
 /*
-   doAdrC -
+   walkFuncCall -
 */
 
-static void doAdrC (mcPretty_pretty p, decl_node n);
+static decl_dependentState walkFuncCall (alists_alist l, decl_node__opaque n);
 
 /*
-   doInc -
+   walkUnary -
 */
 
-static void doInc (mcPretty_pretty p, decl_node n);
+static decl_dependentState walkUnary (alists_alist l, decl_node__opaque n);
 
 /*
-   doDec -
+   walkBinary -
 */
 
-static void doDec (mcPretty_pretty p, decl_node n);
+static decl_dependentState walkBinary (alists_alist l, decl_node__opaque n);
 
 /*
-   doIncDecC -
+   walkComponentRef -
 */
 
-static void doIncDecC (mcPretty_pretty p, decl_node n, const char *op_, unsigned int _op_high);
+static decl_dependentState walkComponentRef (alists_alist l, decl_node__opaque n);
 
 /*
-   doIncDecCP -
+   walkPointerRef -
 */
 
-static void doIncDecCP (mcPretty_pretty p, decl_node n, const char *op_, unsigned int _op_high);
+static decl_dependentState walkPointerRef (alists_alist l, decl_node__opaque n);
 
 /*
-   doInclC -
+   walkSetValue -
 */
 
-static void doInclC (mcPretty_pretty p, decl_node n);
+static decl_dependentState walkSetValue (alists_alist l, decl_node__opaque n);
 
 /*
-   doExclC -
+   doDependants - return the dependentState depending upon whether
+                  all dependants have been declared.
 */
 
-static void doExclC (mcPretty_pretty p, decl_node n);
+static decl_dependentState doDependants (alists_alist l, decl_node__opaque n);
 
 /*
-   doNewC -
+   tryComplete - returns TRUE if node, n, can be and was completed.
 */
 
-static void doNewC (mcPretty_pretty p, decl_node n);
+static bool tryComplete (decl_node__opaque n, decl_nodeProcedure c, decl_nodeProcedure t, decl_nodeProcedure v);
 
 /*
-   doDisposeC -
+   tryCompleteFromPartial -
 */
 
-static void doDisposeC (mcPretty_pretty p, decl_node n);
+static bool tryCompleteFromPartial (decl_node__opaque n, decl_nodeProcedure t);
 
 /*
-   doCapC -
+   visitIntrinsicFunction -
 */
 
-static void doCapC (mcPretty_pretty p, decl_node n);
+static void visitIntrinsicFunction (alists_alist v, decl_node__opaque n, decl_nodeProcedure p);
 
 /*
-   doLengthC -
+   visitUnary -
 */
 
-static void doLengthC (mcPretty_pretty p, decl_node n);
+static void visitUnary (alists_alist v, decl_node__opaque n, decl_nodeProcedure p);
 
 /*
-   doAbsC -
+   visitBinary -
 */
 
-static void doAbsC (mcPretty_pretty p, decl_node n);
+static void visitBinary (alists_alist v, decl_node__opaque n, decl_nodeProcedure p);
 
 /*
-   doValC -
+   visitBoolean -
 */
 
-static void doValC (mcPretty_pretty p, decl_node n);
+static void visitBoolean (alists_alist v, decl_node__opaque n, decl_nodeProcedure p);
 
 /*
-   doMinC -
+   visitScope -
 */
 
-static void doMinC (mcPretty_pretty p, decl_node n);
+static void visitScope (alists_alist v, decl_node__opaque n, decl_nodeProcedure p);
 
 /*
-   doMaxC -
+   visitType -
 */
 
-static void doMaxC (mcPretty_pretty p, decl_node n);
+static void visitType (alists_alist v, decl_node__opaque n, decl_nodeProcedure p);
 
 /*
-   isIntrinsic - returns if, n, is an intrinsic procedure.
-                 The intrinsic functions are represented as unary and binary nodes.
+   visitIndex -
 */
 
-static bool isIntrinsic (decl_node n);
+static void visitIndex (alists_alist v, Indexing_Index i, decl_nodeProcedure p);
 
 /*
-   doHalt -
+   visitRecord -
 */
 
-static void doHalt (mcPretty_pretty p, decl_node n);
+static void visitRecord (alists_alist v, decl_node__opaque n, decl_nodeProcedure p);
 
 /*
-   doCreal - emit the appropriate creal function.
+   visitVarient -
 */
 
-static void doCreal (mcPretty_pretty p, decl_node t);
+static void visitVarient (alists_alist v, decl_node__opaque n, decl_nodeProcedure p);
 
 /*
-   doCimag - emit the appropriate cimag function.
+   visitVar -
 */
 
-static void doCimag (mcPretty_pretty p, decl_node t);
+static void visitVar (alists_alist v, decl_node__opaque n, decl_nodeProcedure p);
 
 /*
-   doReC -
+   visitEnumeration -
 */
 
-static void doReC (mcPretty_pretty p, decl_node n);
+static void visitEnumeration (alists_alist v, decl_node__opaque n, decl_nodeProcedure p);
 
 /*
-   doImC -
+   visitSubrange -
 */
 
-static void doImC (mcPretty_pretty p, decl_node n);
+static void visitSubrange (alists_alist v, decl_node__opaque n, decl_nodeProcedure p);
 
 /*
-   doCmplx -
+   visitPointer -
 */
 
-static void doCmplx (mcPretty_pretty p, decl_node n);
+static void visitPointer (alists_alist v, decl_node__opaque n, decl_nodeProcedure p);
 
 /*
-   doIntrinsicC -
+   visitArray -
 */
 
-static void doIntrinsicC (mcPretty_pretty p, decl_node n);
+static void visitArray (alists_alist v, decl_node__opaque n, decl_nodeProcedure p);
 
 /*
-   isIntrinsicFunction - returns true if, n, is an instrinsic function.
+   visitConst -
 */
 
-static bool isIntrinsicFunction (decl_node n);
+static void visitConst (alists_alist v, decl_node__opaque n, decl_nodeProcedure p);
 
 /*
-   doSizeC -
+   visitVarParam -
 */
 
-static void doSizeC (mcPretty_pretty p, decl_node n);
+static void visitVarParam (alists_alist v, decl_node__opaque n, decl_nodeProcedure p);
 
 /*
-   doConvertC -
+   visitParam -
 */
 
-static void doConvertC (mcPretty_pretty p, decl_node n, const char *conversion_, unsigned int _conversion_high);
+static void visitParam (alists_alist v, decl_node__opaque n, decl_nodeProcedure p);
 
 /*
-   doConvertSC -
+   visitOptarg -
 */
 
-static void doConvertSC (mcPretty_pretty p, decl_node n, DynamicStrings_String conversion);
+static void visitOptarg (alists_alist v, decl_node__opaque n, decl_nodeProcedure p);
 
 /*
-   getFuncFromExpr -
+   visitRecordField -
 */
 
-static decl_node getFuncFromExpr (decl_node n);
+static void visitRecordField (alists_alist v, decl_node__opaque n, decl_nodeProcedure p);
 
 /*
-   doFuncExprC -
+   visitVarientField -
 */
 
-static void doFuncExprC (mcPretty_pretty p, decl_node n);
+static void visitVarientField (alists_alist v, decl_node__opaque n, decl_nodeProcedure p);
 
 /*
-   doFuncCallC -
+   visitEnumerationField -
 */
 
-static void doFuncCallC (mcPretty_pretty p, decl_node n);
+static void visitEnumerationField (alists_alist v, decl_node__opaque n, decl_nodeProcedure p);
 
 /*
-   doCaseStatementC -
+   visitSet -
 */
 
-static void doCaseStatementC (mcPretty_pretty p, decl_node n, bool needBreak);
+static void visitSet (alists_alist v, decl_node__opaque n, decl_nodeProcedure p);
 
 /*
-   doExceptionC -
+   visitProcType -
 */
 
-static void doExceptionC (mcPretty_pretty p, const char *a_, unsigned int _a_high, decl_node n);
+static void visitProcType (alists_alist v, decl_node__opaque n, decl_nodeProcedure p);
 
 /*
-   doExceptionCP -
+   visitSubscript -
 */
 
-static void doExceptionCP (mcPretty_pretty p, const char *a_, unsigned int _a_high, decl_node n);
+static void visitSubscript (alists_alist v, decl_node__opaque n, decl_nodeProcedure p);
 
 /*
-   doException -
+   visitDecls -
 */
 
-static void doException (mcPretty_pretty p, const char *a_, unsigned int _a_high, decl_node n);
+static void visitDecls (alists_alist v, decl_scopeT s, decl_nodeProcedure p);
 
 /*
-   doRangeListC -
+   visitProcedure -
 */
 
-static void doRangeListC (mcPretty_pretty p, decl_node c);
+static void visitProcedure (alists_alist v, decl_node__opaque n, decl_nodeProcedure p);
 
 /*
-   doRangeIfListC -
+   visitDef -
 */
 
-static void doRangeIfListC (mcPretty_pretty p, decl_node e, decl_node c);
+static void visitDef (alists_alist v, decl_node__opaque n, decl_nodeProcedure p);
 
 /*
-   doCaseLabels -
+   visitImp -
 */
 
-static void doCaseLabels (mcPretty_pretty p, decl_node n, bool needBreak);
+static void visitImp (alists_alist v, decl_node__opaque n, decl_nodeProcedure p);
 
 /*
-   doCaseLabelListC -
+   visitModule -
 */
 
-static void doCaseLabelListC (mcPretty_pretty p, decl_node n, bool haveElse);
+static void visitModule (alists_alist v, decl_node__opaque n, decl_nodeProcedure p);
 
 /*
-   doCaseIfLabels -
+   visitLoop -
 */
 
-static void doCaseIfLabels (mcPretty_pretty p, decl_node e, decl_node n, unsigned int i, unsigned int h);
+static void visitLoop (alists_alist v, decl_node__opaque n, decl_nodeProcedure p);
 
 /*
-   doCaseIfLabelListC -
+   visitWhile -
 */
 
-static void doCaseIfLabelListC (mcPretty_pretty p, decl_node n);
+static void visitWhile (alists_alist v, decl_node__opaque n, decl_nodeProcedure p);
 
 /*
-   doCaseElseC -
+   visitRepeat -
 */
 
-static void doCaseElseC (mcPretty_pretty p, decl_node n);
+static void visitRepeat (alists_alist v, decl_node__opaque n, decl_nodeProcedure p);
 
 /*
-   doCaseIfElseC -
+   visitCase -
 */
 
-static void doCaseIfElseC (mcPretty_pretty p, decl_node n);
+static void visitCase (alists_alist v, decl_node__opaque n, decl_nodeProcedure p);
 
 /*
-   canUseSwitchCaseLabels - returns TRUE if all the case labels are
-                            single values and not ranges.
+   visitCaseLabelList -
 */
 
-static bool canUseSwitchCaseLabels (decl_node n);
+static void visitCaseLabelList (alists_alist v, decl_node__opaque n, decl_nodeProcedure p);
 
 /*
-   canUseSwitch - returns TRUE if the case statement can be implement
-                  by a switch statement.  This will be TRUE if all case
-                  selectors are single values rather than ranges.
+   visitCaseList -
 */
 
-static bool canUseSwitch (decl_node n);
+static void visitCaseList (alists_alist v, decl_node__opaque n, decl_nodeProcedure p);
 
 /*
-   doCaseC -
+   visitRange -
 */
 
-static void doCaseC (mcPretty_pretty p, decl_node n);
+static void visitRange (alists_alist v, decl_node__opaque n, decl_nodeProcedure p);
 
 /*
-   doLoopC -
+   visitIf -
 */
 
-static void doLoopC (mcPretty_pretty p, decl_node s);
+static void visitIf (alists_alist v, decl_node__opaque n, decl_nodeProcedure p);
 
 /*
-   doExitC -
+   visitElsif -
 */
 
-static void doExitC (mcPretty_pretty p, decl_node s);
+static void visitElsif (alists_alist v, decl_node__opaque n, decl_nodeProcedure p);
 
 /*
-   doStatementsC -
+   visitFor -
 */
 
-static void doStatementsC (mcPretty_pretty p, decl_node s);
-static void stop (void);
+static void visitFor (alists_alist v, decl_node__opaque n, decl_nodeProcedure p);
 
 /*
-   doLocalVarC -
+   visitAssignment -
 */
 
-static void doLocalVarC (mcPretty_pretty p, decl_scopeT s);
+static void visitAssignment (alists_alist v, decl_node__opaque n, decl_nodeProcedure p);
 
 /*
-   doLocalConstTypesC -
+   visitComponentRef -
 */
 
-static void doLocalConstTypesC (mcPretty_pretty p, decl_scopeT s);
+static void visitComponentRef (alists_alist v, decl_node__opaque n, decl_nodeProcedure p);
 
 /*
-   addParamDone -
+   visitPointerRef -
 */
 
-static void addParamDone (decl_node n);
+static void visitPointerRef (alists_alist v, decl_node__opaque n, decl_nodeProcedure p);
 
 /*
-   includeParameters -
+   visitArrayRef -
 */
 
-static void includeParameters (decl_node n);
+static void visitArrayRef (alists_alist v, decl_node__opaque n, decl_nodeProcedure p);
 
 /*
-   isHalt -
+   visitFunccall -
 */
 
-static bool isHalt (decl_node n);
+static void visitFunccall (alists_alist v, decl_node__opaque n, decl_nodeProcedure p);
 
 /*
-   isReturnOrHalt -
+   visitVarDecl -
 */
 
-static bool isReturnOrHalt (decl_node n);
+static void visitVarDecl (alists_alist v, decl_node__opaque n, decl_nodeProcedure p);
 
 /*
-   isLastStatementReturn -
+   visitExplist -
 */
 
-static bool isLastStatementReturn (decl_node n);
+static void visitExplist (alists_alist v, decl_node__opaque n, decl_nodeProcedure p);
 
 /*
-   isLastStatementSequence -
+   visitExit -
 */
 
-static bool isLastStatementSequence (decl_node n, decl_isNodeF q);
+static void visitExit (alists_alist v, decl_node__opaque n, decl_nodeProcedure p);
 
 /*
-   isLastStatementIf -
+   visitReturn -
 */
 
-static bool isLastStatementIf (decl_node n, decl_isNodeF q);
+static void visitReturn (alists_alist v, decl_node__opaque n, decl_nodeProcedure p);
 
 /*
-   isLastStatementElsif -
+   visitStmtSeq -
 */
 
-static bool isLastStatementElsif (decl_node n, decl_isNodeF q);
+static void visitStmtSeq (alists_alist v, decl_node__opaque n, decl_nodeProcedure p);
 
 /*
-   isLastStatementCase -
+   visitVarargs -
 */
 
-static bool isLastStatementCase (decl_node n, decl_isNodeF q);
+static void visitVarargs (alists_alist v, decl_node__opaque n, decl_nodeProcedure p);
 
 /*
-   isLastStatement - returns TRUE if the last statement in, n, is, q.
+   visitSetValue -
 */
 
-static bool isLastStatement (decl_node n, decl_isNodeF q);
+static void visitSetValue (alists_alist v, decl_node__opaque n, decl_nodeProcedure p);
 
 /*
-   doProcedureC -
+   visitIntrinsic -
 */
 
-static void doProcedureC (decl_node n);
+static void visitIntrinsic (alists_alist v, decl_node__opaque n, decl_nodeProcedure p);
 
 /*
-   outProceduresC -
+   visitDependants - helper procedure function called from visitNode.
+                     node n has just been visited, this procedure will
+                     visit node, n, dependants.
 */
 
-static void outProceduresC (mcPretty_pretty p, decl_scopeT s);
+static void visitDependants (alists_alist v, decl_node__opaque n, decl_nodeProcedure p);
 
 /*
-   output -
+   visitNode - visits node, n, if it is not already in the alist, v.
+               It calls p(n) if the node is unvisited.
 */
 
-static void output (decl_node n, decl_nodeProcedure c, decl_nodeProcedure t, decl_nodeProcedure v);
+static void visitNode (alists_alist v, decl_node__opaque n, decl_nodeProcedure p);
 
 /*
-   allDependants -
+   genKind - returns a string depending upon the kind of node, n.
 */
 
-static decl_dependentState allDependants (decl_node n);
+static DynamicStrings_String genKind (decl_node__opaque n);
 
 /*
-   walkDependants -
+   gen - generate a small string describing node, n.
 */
 
-static decl_dependentState walkDependants (alists_alist l, decl_node n);
+static DynamicStrings_String gen (decl_node__opaque n);
 
 /*
-   walkType -
+   dumpQ -
 */
 
-static decl_dependentState walkType (alists_alist l, decl_node n);
+static void dumpQ (const char *q_, unsigned int _q_high, alists_alist l);
 
 /*
-   db -
+   dumpLists -
 */
 
-static void db (const char *a_, unsigned int _a_high, decl_node n);
+static void dumpLists (void);
 
 /*
-   dbt -
+   outputHidden -
 */
 
-static void dbt (const char *a_, unsigned int _a_high);
+static void outputHidden (decl_node__opaque n);
 
 /*
-   dbs -
+   outputHiddenComplete -
 */
 
-static void dbs (decl_dependentState s, decl_node n);
+static void outputHiddenComplete (decl_node__opaque n);
 
 /*
-   dbq -
+   tryPartial -
 */
 
-static void dbq (decl_node n);
+static bool tryPartial (decl_node__opaque n, decl_nodeProcedure pt);
 
 /*
-   walkRecord -
+   outputPartialRecordArrayProcType -
 */
 
-static decl_dependentState walkRecord (alists_alist l, decl_node n);
+static void outputPartialRecordArrayProcType (decl_node__opaque n, decl_node__opaque q, unsigned int indirection);
 
 /*
-   walkVarient -
+   outputPartial -
 */
 
-static decl_dependentState walkVarient (alists_alist l, decl_node n);
+static void outputPartial (decl_node__opaque n);
 
 /*
-   queueBlocked -
+   tryOutputTodo -
 */
 
-static void queueBlocked (decl_node n);
+static void tryOutputTodo (decl_nodeProcedure c, decl_nodeProcedure t, decl_nodeProcedure v, decl_nodeProcedure pt);
 
 /*
-   walkVar -
+   tryOutputPartial -
 */
 
-static decl_dependentState walkVar (alists_alist l, decl_node n);
+static void tryOutputPartial (decl_nodeProcedure t);
 
 /*
-   walkEnumeration -
+   debugList -
 */
 
-static decl_dependentState walkEnumeration (alists_alist l, decl_node n);
+static void debugList (const char *listName_, unsigned int _listName_high, const char *symName_, unsigned int _symName_high, alists_alist l);
 
 /*
-   walkSubrange -
+   debugLists -
 */
 
-static decl_dependentState walkSubrange (alists_alist l, decl_node n);
+static void debugLists (void);
 
 /*
-   walkSubscript -
+   addEnumConst -
 */
 
-static decl_dependentState walkSubscript (alists_alist l, decl_node n);
+static void addEnumConst (decl_node__opaque n);
 
 /*
-   walkPointer -
+   populateTodo -
 */
 
-static decl_dependentState walkPointer (alists_alist l, decl_node n);
+static void populateTodo (decl_nodeProcedure p);
 
 /*
-   walkArray -
+   topologicallyOut - keep trying to resolve the todoQ and partialQ
+                      until there is no change from the global group.
 */
 
-static decl_dependentState walkArray (alists_alist l, decl_node n);
+static void topologicallyOut (decl_nodeProcedure c, decl_nodeProcedure t, decl_nodeProcedure v, decl_nodeProcedure tp, decl_nodeProcedure pc, decl_nodeProcedure pt, decl_nodeProcedure pv);
 
 /*
-   walkConst -
+   scaffoldStatic -
 */
 
-static decl_dependentState walkConst (alists_alist l, decl_node n);
+static void scaffoldStatic (mcPretty_pretty p, decl_node__opaque n);
 
 /*
-   walkVarParam -
+   emitCtor -
 */
 
-static decl_dependentState walkVarParam (alists_alist l, decl_node n);
+static void emitCtor (mcPretty_pretty p, decl_node__opaque n);
 
 /*
-   walkParam -
+   scaffoldDynamic -
 */
 
-static decl_dependentState walkParam (alists_alist l, decl_node n);
+static void scaffoldDynamic (mcPretty_pretty p, decl_node__opaque n);
 
 /*
-   walkOptarg -
+   scaffoldMain -
 */
 
-static decl_dependentState walkOptarg (alists_alist l, decl_node n);
+static void scaffoldMain (mcPretty_pretty p, decl_node__opaque n);
 
 /*
-   walkRecordField -
+   outImpInitC - emit the init/fini functions and main function if required.
 */
 
-static decl_dependentState walkRecordField (alists_alist l, decl_node n);
+static void outImpInitC (mcPretty_pretty p, decl_node__opaque n);
 
 /*
-   walkVarientField -
+   runSimplifyTypes -
 */
 
-static decl_dependentState walkVarientField (alists_alist l, decl_node n);
+static void runSimplifyTypes (decl_node__opaque n);
 
 /*
-   walkEnumerationField -
+   outDefC -
 */
 
-static decl_dependentState walkEnumerationField (alists_alist l, decl_node n);
+static void outDefC (mcPretty_pretty p, decl_node__opaque n);
 
 /*
-   walkSet -
+   runPrototypeExported -
 */
 
-static decl_dependentState walkSet (alists_alist l, decl_node n);
+static void runPrototypeExported (decl_node__opaque n);
 
 /*
-   walkProcType -
+   runPrototypeDefC -
 */
 
-static decl_dependentState walkProcType (alists_alist l, decl_node n);
+static void runPrototypeDefC (decl_node__opaque n);
 
 /*
-   walkProcedure -
+   outImpC -
 */
 
-static decl_dependentState walkProcedure (alists_alist l, decl_node n);
+static void outImpC (mcPretty_pretty p, decl_node__opaque n);
 
 /*
-   walkParameters -
+   outDeclsModuleC -
 */
 
-static decl_dependentState walkParameters (alists_alist l, Indexing_Index p);
+static void outDeclsModuleC (mcPretty_pretty p, decl_scopeT s);
 
 /*
-   walkFuncCall -
+   outModuleInitC -
 */
 
-static decl_dependentState walkFuncCall (alists_alist l, decl_node n);
+static void outModuleInitC (mcPretty_pretty p, decl_node__opaque n);
 
 /*
-   walkUnary -
+   outModuleC -
 */
 
-static decl_dependentState walkUnary (alists_alist l, decl_node n);
+static void outModuleC (mcPretty_pretty p, decl_node__opaque n);
 
 /*
-   walkBinary -
+   outC -
 */
 
-static decl_dependentState walkBinary (alists_alist l, decl_node n);
+static void outC (mcPretty_pretty p, decl_node__opaque n);
 
 /*
-   walkComponentRef -
+   doIncludeM2 - include modules in module, n.
 */
 
-static decl_dependentState walkComponentRef (alists_alist l, decl_node n);
+static void doIncludeM2 (decl_node__opaque n);
 
 /*
-   walkPointerRef -
+   doConstM2 -
 */
 
-static decl_dependentState walkPointerRef (alists_alist l, decl_node n);
+static void doConstM2 (decl_node__opaque n);
 
 /*
-   walkSetValue -
+   doProcTypeM2 -
 */
 
-static decl_dependentState walkSetValue (alists_alist l, decl_node n);
+static void doProcTypeM2 (mcPretty_pretty p, decl_node__opaque n);
 
 /*
-   doDependants - return the dependentState depending upon whether
-                  all dependants have been declared.
+   doRecordFieldM2 -
 */
 
-static decl_dependentState doDependants (alists_alist l, decl_node n);
+static void doRecordFieldM2 (mcPretty_pretty p, decl_node__opaque f);
 
 /*
-   tryComplete - returns TRUE if node, n, can be and was completed.
+   doVarientFieldM2 -
 */
 
-static bool tryComplete (decl_node n, decl_nodeProcedure c, decl_nodeProcedure t, decl_nodeProcedure v);
+static void doVarientFieldM2 (mcPretty_pretty p, decl_node__opaque n);
 
 /*
-   tryCompleteFromPartial -
+   doVarientM2 -
 */
 
-static bool tryCompleteFromPartial (decl_node n, decl_nodeProcedure t);
+static void doVarientM2 (mcPretty_pretty p, decl_node__opaque n);
 
 /*
-   visitIntrinsicFunction -
+   doRecordM2 -
 */
 
-static void visitIntrinsicFunction (alists_alist v, decl_node n, decl_nodeProcedure p);
+static void doRecordM2 (mcPretty_pretty p, decl_node__opaque n);
 
 /*
-   visitUnary -
+   doPointerM2 -
 */
 
-static void visitUnary (alists_alist v, decl_node n, decl_nodeProcedure p);
+static void doPointerM2 (mcPretty_pretty p, decl_node__opaque n);
 
 /*
-   visitBinary -
+   doTypeAliasM2 -
 */
 
-static void visitBinary (alists_alist v, decl_node n, decl_nodeProcedure p);
+static void doTypeAliasM2 (mcPretty_pretty p, decl_node__opaque n);
 
 /*
-   visitBoolean -
+   doEnumerationM2 -
 */
 
-static void visitBoolean (alists_alist v, decl_node n, decl_nodeProcedure p);
+static void doEnumerationM2 (mcPretty_pretty p, decl_node__opaque n);
 
 /*
-   visitScope -
+   doBaseM2 -
 */
 
-static void visitScope (alists_alist v, decl_node n, decl_nodeProcedure p);
+static void doBaseM2 (mcPretty_pretty p, decl_node__opaque n);
 
 /*
-   visitType -
+   doSystemM2 -
 */
 
-static void visitType (alists_alist v, decl_node n, decl_nodeProcedure p);
+static void doSystemM2 (mcPretty_pretty p, decl_node__opaque n);
 
 /*
-   visitIndex -
+   doTypeM2 -
 */
 
-static void visitIndex (alists_alist v, Indexing_Index i, decl_nodeProcedure p);
+static void doTypeM2 (mcPretty_pretty p, decl_node__opaque n);
 
 /*
-   visitRecord -
+   doTypesM2 -
 */
 
-static void visitRecord (alists_alist v, decl_node n, decl_nodeProcedure p);
+static void doTypesM2 (decl_node__opaque n);
 
 /*
-   visitVarient -
+   doVarM2 -
 */
 
-static void visitVarient (alists_alist v, decl_node n, decl_nodeProcedure p);
+static void doVarM2 (decl_node__opaque n);
 
 /*
-   visitVar -
+   doVarsM2 -
 */
 
-static void visitVar (alists_alist v, decl_node n, decl_nodeProcedure p);
+static void doVarsM2 (decl_node__opaque n);
 
 /*
-   visitEnumeration -
+   doTypeNameM2 -
 */
 
-static void visitEnumeration (alists_alist v, decl_node n, decl_nodeProcedure p);
+static void doTypeNameM2 (mcPretty_pretty p, decl_node__opaque n);
 
 /*
-   visitSubrange -
+   doParamM2 -
 */
 
-static void visitSubrange (alists_alist v, decl_node n, decl_nodeProcedure p);
+static void doParamM2 (mcPretty_pretty p, decl_node__opaque n);
 
 /*
-   visitPointer -
+   doVarParamM2 -
 */
 
-static void visitPointer (alists_alist v, decl_node n, decl_nodeProcedure p);
+static void doVarParamM2 (mcPretty_pretty p, decl_node__opaque n);
 
 /*
-   visitArray -
+   doParameterM2 -
 */
 
-static void visitArray (alists_alist v, decl_node n, decl_nodeProcedure p);
+static void doParameterM2 (mcPretty_pretty p, decl_node__opaque n);
 
 /*
-   visitConst -
+   doPrototypeM2 -
 */
 
-static void visitConst (alists_alist v, decl_node n, decl_nodeProcedure p);
+static void doPrototypeM2 (decl_node__opaque n);
 
 /*
-   visitVarParam -
+   outputPartialM2 - just writes out record, array, and proctypes.
+                     No need for forward declarations in Modula-2
+                     but we need to keep topological sort happy.
+                     So when asked to output partial we emit the
+                     full type for these types and then do nothing
+                     when trying to complete partial to full.
 */
 
-static void visitVarParam (alists_alist v, decl_node n, decl_nodeProcedure p);
+static void outputPartialM2 (decl_node__opaque n);
 
 /*
-   visitParam -
+   outDeclsDefM2 -
 */
 
-static void visitParam (alists_alist v, decl_node n, decl_nodeProcedure p);
+static void outDeclsDefM2 (mcPretty_pretty p, decl_scopeT s);
 
 /*
-   visitOptarg -
+   outDefM2 -
 */
 
-static void visitOptarg (alists_alist v, decl_node n, decl_nodeProcedure p);
+static void outDefM2 (mcPretty_pretty p, decl_node__opaque n);
 
 /*
-   visitRecordField -
+   outDeclsImpM2 -
 */
 
-static void visitRecordField (alists_alist v, decl_node n, decl_nodeProcedure p);
+static void outDeclsImpM2 (mcPretty_pretty p, decl_scopeT s);
 
 /*
-   visitVarientField -
+   outImpM2 -
 */
 
-static void visitVarientField (alists_alist v, decl_node n, decl_nodeProcedure p);
+static void outImpM2 (mcPretty_pretty p, decl_node__opaque n);
 
 /*
-   visitEnumerationField -
+   outModuleM2 -
 */
 
-static void visitEnumerationField (alists_alist v, decl_node n, decl_nodeProcedure p);
+static void outModuleM2 (mcPretty_pretty p, decl_node__opaque n);
 
 /*
-   visitSet -
+   outM2 -
 */
 
-static void visitSet (alists_alist v, decl_node n, decl_nodeProcedure p);
+static void outM2 (mcPretty_pretty p, decl_node__opaque n);
 
 /*
-   visitProcType -
+   addDone - adds node, n, to the doneQ.
 */
 
-static void visitProcType (alists_alist v, decl_node n, decl_nodeProcedure p);
+static void addDone (decl_node__opaque n);
 
 /*
-   visitSubscript -
+   addDoneDef - adds node, n, to the doneQ providing
+                it is not an opaque of the main module we are compiling.
 */
 
-static void visitSubscript (alists_alist v, decl_node n, decl_nodeProcedure p);
+static void addDoneDef (decl_node__opaque n);
 
 /*
-   visitDecls -
+   dbgAdd -
 */
 
-static void visitDecls (alists_alist v, decl_scopeT s, decl_nodeProcedure p);
+static decl_node__opaque dbgAdd (alists_alist l, decl_node__opaque n);
 
 /*
-   visitProcedure -
+   dbgType -
 */
 
-static void visitProcedure (alists_alist v, decl_node n, decl_nodeProcedure p);
+static void dbgType (alists_alist l, decl_node__opaque n);
 
 /*
-   visitDef -
+   dbgPointer -
 */
 
-static void visitDef (alists_alist v, decl_node n, decl_nodeProcedure p);
+static void dbgPointer (alists_alist l, decl_node__opaque n);
 
 /*
-   visitImp -
+   dbgRecord -
 */
 
-static void visitImp (alists_alist v, decl_node n, decl_nodeProcedure p);
+static void dbgRecord (alists_alist l, decl_node__opaque n);
 
 /*
-   visitModule -
+   dbgVarient -
 */
 
-static void visitModule (alists_alist v, decl_node n, decl_nodeProcedure p);
+static void dbgVarient (alists_alist l, decl_node__opaque n);
 
 /*
-   visitLoop -
+   dbgEnumeration -
 */
 
-static void visitLoop (alists_alist v, decl_node n, decl_nodeProcedure p);
+static void dbgEnumeration (alists_alist l, decl_node__opaque n);
 
 /*
-   visitWhile -
+   dbgVar -
 */
 
-static void visitWhile (alists_alist v, decl_node n, decl_nodeProcedure p);
+static void dbgVar (alists_alist l, decl_node__opaque n);
 
 /*
-   visitRepeat -
+   dbgSubrange -
 */
 
-static void visitRepeat (alists_alist v, decl_node n, decl_nodeProcedure p);
+static void dbgSubrange (alists_alist l, decl_node__opaque n);
 
 /*
-   visitCase -
+   dbgArray -
 */
 
-static void visitCase (alists_alist v, decl_node n, decl_nodeProcedure p);
+static void dbgArray (alists_alist l, decl_node__opaque n);
 
 /*
-   visitCaseLabelList -
+   doDbg -
 */
 
-static void visitCaseLabelList (alists_alist v, decl_node n, decl_nodeProcedure p);
+static void doDbg (alists_alist l, decl_node__opaque n);
 
 /*
-   visitCaseList -
+   dbg -
 */
 
-static void visitCaseList (alists_alist v, decl_node n, decl_nodeProcedure p);
+static void dbg (const char *listName_, unsigned int _listName_high, const char *symName_, unsigned int _symName_high, decl_node__opaque n);
 
 /*
-   visitRange -
+   addGenericBody - adds comment node to funccall, return, assignment
+                    nodes.
 */
 
-static void visitRange (alists_alist v, decl_node n, decl_nodeProcedure p);
+static void addGenericBody (decl_node__opaque n, decl_node__opaque c);
 
 /*
-   visitIf -
+   addGenericAfter - adds comment node to funccall, return, assignment
+                     nodes.
 */
 
-static void visitIf (alists_alist v, decl_node n, decl_nodeProcedure p);
+static void addGenericAfter (decl_node__opaque n, decl_node__opaque c);
 
 /*
-   visitElsif -
+   isAssignment -
 */
 
-static void visitElsif (alists_alist v, decl_node n, decl_nodeProcedure p);
+static bool isAssignment (decl_node__opaque n);
 
 /*
-   visitFor -
+   isComment - returns TRUE if node, n, is a comment.
 */
 
-static void visitFor (alists_alist v, decl_node n, decl_nodeProcedure p);
+static bool isComment (decl_node__opaque n);
 
 /*
-   visitAssignment -
+   initPair - initialise the commentPair, c.
 */
 
-static void visitAssignment (alists_alist v, decl_node n, decl_nodeProcedure p);
+static void initPair (decl_commentPair *c);
 
 /*
-   visitComponentRef -
+   dupExplist -
 */
 
-static void visitComponentRef (alists_alist v, decl_node n, decl_nodeProcedure p);
+static decl_node__opaque dupExplist (decl_node__opaque n);
 
 /*
-   visitPointerRef -
+   dupArrayref -
 */
 
-static void visitPointerRef (alists_alist v, decl_node n, decl_nodeProcedure p);
+static decl_node__opaque dupArrayref (decl_node__opaque n);
 
 /*
-   visitArrayRef -
+   dupPointerref -
 */
 
-static void visitArrayRef (alists_alist v, decl_node n, decl_nodeProcedure p);
+static decl_node__opaque dupPointerref (decl_node__opaque n);
 
 /*
-   visitFunccall -
+   dupComponentref -
 */
 
-static void visitFunccall (alists_alist v, decl_node n, decl_nodeProcedure p);
+static decl_node__opaque dupComponentref (decl_node__opaque n);
 
 /*
-   visitVarDecl -
+   dupBinary -
 */
 
-static void visitVarDecl (alists_alist v, decl_node n, decl_nodeProcedure p);
+static decl_node__opaque dupBinary (decl_node__opaque n);
 
 /*
-   visitExplist -
+   dupUnary -
 */
 
-static void visitExplist (alists_alist v, decl_node n, decl_nodeProcedure p);
+static decl_node__opaque dupUnary (decl_node__opaque n);
 
 /*
-   visitExit -
+   dupFunccall -
 */
 
-static void visitExit (alists_alist v, decl_node n, decl_nodeProcedure p);
+static decl_node__opaque dupFunccall (decl_node__opaque n);
 
 /*
-   visitReturn -
+   dupSetValue -
 */
 
-static void visitReturn (alists_alist v, decl_node n, decl_nodeProcedure p);
+static decl_node__opaque dupSetValue (decl_node__opaque n);
 
 /*
-   visitStmtSeq -
+   doDupExpr -
 */
 
-static void visitStmtSeq (alists_alist v, decl_node n, decl_nodeProcedure p);
+static decl_node__opaque doDupExpr (decl_node__opaque n);
 
 /*
-   visitVarargs -
+   makeSystem -
 */
 
-static void visitVarargs (alists_alist v, decl_node n, decl_nodeProcedure p);
+static void makeSystem (void);
 
 /*
-   visitSetValue -
+   makeM2rts -
 */
 
-static void visitSetValue (alists_alist v, decl_node n, decl_nodeProcedure p);
+static void makeM2rts (void);
 
 /*
-   visitIntrinsic -
+   makeBitnum -
 */
 
-static void visitIntrinsic (alists_alist v, decl_node n, decl_nodeProcedure p);
+static decl_node__opaque makeBitnum (void);
 
 /*
-   visitDependants - helper procedure function called from visitNode.
-                     node n has just been visited, this procedure will
-                     visit node, n, dependants.
+   makeBaseSymbols -
 */
 
-static void visitDependants (alists_alist v, decl_node n, decl_nodeProcedure p);
+static void makeBaseSymbols (void);
 
 /*
-   visitNode - visits node, n, if it is not already in the alist, v.
-               It calls p(n) if the node is unvisited.
+   makeBuiltins -
 */
 
-static void visitNode (alists_alist v, decl_node n, decl_nodeProcedure p);
+static void makeBuiltins (void);
 
 /*
-   genKind - returns a string depending upon the kind of node, n.
+   init -
 */
 
-static DynamicStrings_String genKind (decl_node n);
-
-/*
-   gen - generate a small string describing node, n.
-*/
+static void init (void);
 
-static DynamicStrings_String gen (decl_node n);
 
 /*
-   dumpQ -
+   newNode - create and return a new node of kind k.
 */
 
-static void dumpQ (const char *q_, unsigned int _q_high, alists_alist l);
+static decl_node__opaque newNode (decl_nodeT k)
+{
+  decl_node__opaque d;
 
-/*
-   dumpLists -
-*/
+  Storage_ALLOCATE ((void **) &d, sizeof (decl_nodeRec));
+  if (enableMemsetOnAllocation)
+    {
+      d = static_cast<decl_node__opaque> (libc_memset (reinterpret_cast<void *> (d), 0, static_cast<size_t> (sizeof ((*d)))));
+    }
+  if (d == NULL)
+    {
+      M2RTS_HALT (-1);
+      __builtin_unreachable ();
+    }
+  else
+    {
+      d->kind = k;
+      d->at.defDeclared = 0;
+      d->at.modDeclared = 0;
+      d->at.firstUsed = 0;
+      return d;
+    }
+  ReturnException ("../../gcc/m2/mc/decl.def", 20, 1);
+  __builtin_unreachable ();
+}
 
-static void dumpLists (void);
 
 /*
-   outputHidden -
+   disposeNode - dispose node, n.
 */
 
-static void outputHidden (decl_node n);
-
-/*
-   outputHiddenComplete -
-*/
+static void disposeNode (decl_node__opaque *n)
+{
+  Storage_DEALLOCATE ((void **) &(*n), sizeof (decl_nodeRec));
+  (*n) = static_cast<decl_node__opaque> (NULL);
+}
 
-static void outputHiddenComplete (decl_node n);
 
 /*
-   tryPartial -
+   newGroup -
 */
 
-static bool tryPartial (decl_node n, decl_nodeProcedure pt);
+static void newGroup (decl_group *g)
+{
+  if (freeGroup == NULL)
+    {
+      Storage_ALLOCATE ((void **) &(*g), sizeof (decl__T1));
+    }
+  else
+    {
+      (*g) = freeGroup;
+      freeGroup = freeGroup->next;
+    }
+}
+
 
 /*
-   outputPartialRecordArrayProcType -
+   initGroup - returns a group which with all lists initialized.
 */
 
-static void outputPartialRecordArrayProcType (decl_node n, decl_node q, unsigned int indirection);
+static decl_group initGroup (void)
+{
+  decl_group g;
 
-/*
-   outputPartial -
-*/
+  newGroup (&g);
+  g->todoQ = alists_initList ();
+  g->partialQ = alists_initList ();
+  g->doneQ = alists_initList ();
+  g->next = NULL;
+  return g;
+  /* static analysis guarentees a RETURN statement will be used before here.  */
+  __builtin_unreachable ();
+}
 
-static void outputPartial (decl_node n);
 
 /*
-   tryOutputTodo -
+   killGroup - deallocate the group and place the group record into the freeGroup list.
 */
 
-static void tryOutputTodo (decl_nodeProcedure c, decl_nodeProcedure t, decl_nodeProcedure v, decl_nodeProcedure pt);
+static void killGroup (decl_group *g)
+{
+  alists_killList (&(*g)->todoQ);
+  alists_killList (&(*g)->partialQ);
+  alists_killList (&(*g)->doneQ);
+  (*g)->next = freeGroup;
+  freeGroup = (*g);
+}
+
 
 /*
-   tryOutputPartial -
+   dupGroup - If g is not NIL then destroy g.
+              Return a duplicate of GlobalGroup (not g).
 */
 
-static void tryOutputPartial (decl_nodeProcedure t);
+static decl_group dupGroup (decl_group g)
+{
+  if (g != NULL)
+    {
+      /* Kill old group.  */
+      killGroup (&g);
+    }
+  newGroup (&g);
+  /* Copy all lists.  */
+  g->todoQ = alists_duplicateList (globalGroup->todoQ);
+  g->partialQ = alists_duplicateList (globalGroup->partialQ);
+  g->doneQ = alists_duplicateList (globalGroup->doneQ);
+  g->next = NULL;
+  return g;
+  /* static analysis guarentees a RETURN statement will be used before here.  */
+  __builtin_unreachable ();
+}
+
 
 /*
-   debugList -
+   equalGroup - return TRUE if group left = right.
 */
 
-static void debugList (const char *a_, unsigned int _a_high, alists_alist l);
+static bool equalGroup (decl_group left, decl_group right)
+{
+  return (left == right) || (((alists_equalList (left->todoQ, right->todoQ)) && (alists_equalList (left->partialQ, right->partialQ))) && (alists_equalList (left->doneQ, right->doneQ)));
+  /* static analysis guarentees a RETURN statement will be used before here.  */
+  __builtin_unreachable ();
+}
+
 
 /*
-   debugLists -
+   isLocal - returns TRUE if symbol, n, is locally declared in a procedure.
 */
 
-static void debugLists (void);
+static bool isLocal (decl_node__opaque n)
+{
+  decl_node__opaque s;
 
-/*
-   addEnumConst -
-*/
+  s = static_cast<decl_node__opaque> (decl_getScope (static_cast<decl_node> (n)));
+  if (s != NULL)
+    {
+      return decl_isProcedure (static_cast<decl_node> (s));
+    }
+  return false;
+  /* static analysis guarentees a RETURN statement will be used before here.  */
+  __builtin_unreachable ();
+}
 
-static void addEnumConst (decl_node n);
 
 /*
-   populateTodo -
+   importEnumFields - if, n, is an enumeration type import the all fields into module, m.
 */
 
-static void populateTodo (decl_nodeProcedure p);
+static void importEnumFields (decl_node__opaque m, decl_node__opaque n)
+{
+  decl_node__opaque r;
+  decl_node__opaque e;
+  unsigned int i;
+  unsigned int h;
 
-/*
-   topologicallyOut - keep trying to resolve the todoQ and partialQ
-                      until there is no change from the global group.
-*/
+  mcDebug_assert (((decl_isDef (static_cast<decl_node> (m))) || (decl_isModule (static_cast<decl_node> (m)))) || (decl_isImp (static_cast<decl_node> (m))));
+  n = static_cast<decl_node__opaque> (decl_skipType (static_cast<decl_node> (n)));
+  if ((n != NULL) && (decl_isEnumeration (static_cast<decl_node> (n))))
+    {
+      i = Indexing_LowIndice (n->enumerationF.listOfSons);
+      h = Indexing_HighIndice (n->enumerationF.listOfSons);
+      while (i <= h)
+        {
+          e = static_cast<decl_node__opaque> (Indexing_GetIndice (n->enumerationF.listOfSons, i));
+          r = static_cast<decl_node__opaque> (decl_import (static_cast<decl_node> (m), static_cast<decl_node> (e)));
+          if (e != r)
+            {
+              mcMetaError_metaError2 ((const char *) "enumeration field {%1ad} cannot be imported implicitly into {%2d} due to a name clash", 85, (const unsigned char *) &e, (sizeof (e)-1), (const unsigned char *) &m, (sizeof (m)-1));
+            }
+          i += 1;
+        }
+    }
+}
 
-static void topologicallyOut (decl_nodeProcedure c, decl_nodeProcedure t, decl_nodeProcedure v, decl_nodeProcedure tp, decl_nodeProcedure pc, decl_nodeProcedure pt, decl_nodeProcedure pv);
 
 /*
-   scaffoldStatic -
+   isComplex - returns TRUE if, n, is the complex type.
 */
 
-static void scaffoldStatic (mcPretty_pretty p, decl_node n);
+static bool isComplex (decl_node__opaque n)
+{
+  return n == complexN;
+  /* static analysis guarentees a RETURN statement will be used before here.  */
+  __builtin_unreachable ();
+}
+
 
 /*
-   emitCtor -
+   isLongComplex - returns TRUE if, n, is the longcomplex type.
 */
 
-static void emitCtor (mcPretty_pretty p, decl_node n);
+static bool isLongComplex (decl_node__opaque n)
+{
+  return n == longcomplexN;
+  /* static analysis guarentees a RETURN statement will be used before here.  */
+  __builtin_unreachable ();
+}
+
 
 /*
-   scaffoldDynamic -
+   isShortComplex - returns TRUE if, n, is the shortcomplex type.
 */
 
-static void scaffoldDynamic (mcPretty_pretty p, decl_node n);
-
-/*
-   scaffoldMain -
-*/
+static bool isShortComplex (decl_node__opaque n)
+{
+  return n == shortcomplexN;
+  /* static analysis guarentees a RETURN statement will be used before here.  */
+  __builtin_unreachable ();
+}
 
-static void scaffoldMain (mcPretty_pretty p, decl_node n);
 
 /*
-   outImpInitC - emit the init/fini functions and main function if required.
+   isAProcType - returns TRUE if, n, is a proctype or proc node.
 */
 
-static void outImpInitC (mcPretty_pretty p, decl_node n);
-
-/*
-   runSimplifyTypes -
-*/
+static bool isAProcType (decl_node__opaque n)
+{
+  mcDebug_assert (n != NULL);
+  return (decl_isProcType (static_cast<decl_node> (n))) || (n == procN);
+  /* static analysis guarentees a RETURN statement will be used before here.  */
+  __builtin_unreachable ();
+}
 
-static void runSimplifyTypes (decl_node n);
 
 /*
-   outDefC -
+   initFixupInfo - initialize the fixupInfo record.
 */
 
-static void outDefC (mcPretty_pretty p, decl_node n);
+static decl_fixupInfo initFixupInfo (void)
+{
+  decl_fixupInfo f;
 
-/*
-   runPrototypeExported -
-*/
+  f.count = 0;
+  f.info = Indexing_InitIndex (1);
+  return f;
+  /* static analysis guarentees a RETURN statement will be used before here.  */
+  __builtin_unreachable ();
+}
 
-static void runPrototypeExported (decl_node n);
 
 /*
-   runPrototypeDefC -
+   makeDef - returns a definition module node named, n.
 */
 
-static void runPrototypeDefC (decl_node n);
+static decl_node__opaque makeDef (nameKey_Name n)
+{
+  decl_node__opaque d;
 
-/*
-   outImpC -
-*/
+  d = newNode (decl_def);
+  d->defF.name = n;
+  d->defF.source = nameKey_NulName;
+  d->defF.hasHidden = false;
+  d->defF.forC = false;
+  d->defF.exported = Indexing_InitIndex (1);
+  d->defF.importedModules = Indexing_InitIndex (1);
+  d->defF.constFixup = initFixupInfo ();
+  d->defF.enumFixup = initFixupInfo ();
+  initDecls (&d->defF.decls);
+  d->defF.enumsComplete = false;
+  d->defF.constsComplete = false;
+  d->defF.visited = false;
+  initPair (&d->defF.com);
+  return d;
+  /* static analysis guarentees a RETURN statement will be used before here.  */
+  __builtin_unreachable ();
+}
 
-static void outImpC (mcPretty_pretty p, decl_node n);
 
 /*
-   outDeclsModuleC -
+   makeImp - returns an implementation module node named, n.
 */
 
-static void outDeclsModuleC (mcPretty_pretty p, decl_scopeT s);
+static decl_node__opaque makeImp (nameKey_Name n)
+{
+  decl_node__opaque d;
 
-/*
-   outModuleInitC -
-*/
+  d = newNode (decl_imp);
+  d->impF.name = n;
+  d->impF.source = nameKey_NulName;
+  d->impF.importedModules = Indexing_InitIndex (1);
+  d->impF.constFixup = initFixupInfo ();
+  d->impF.enumFixup = initFixupInfo ();
+  initDecls (&d->impF.decls);
+  d->impF.beginStatements = static_cast<decl_node__opaque> (NULL);
+  d->impF.finallyStatements = static_cast<decl_node__opaque> (NULL);
+  d->impF.definitionModule = static_cast<decl_node__opaque> (NULL);
+  d->impF.enumsComplete = false;
+  d->impF.constsComplete = false;
+  d->impF.visited = false;
+  initPair (&d->impF.com);
+  return d;
+  /* static analysis guarentees a RETURN statement will be used before here.  */
+  __builtin_unreachable ();
+}
 
-static void outModuleInitC (mcPretty_pretty p, decl_node n);
 
 /*
-   outModuleC -
+   makeModule - returns a module node named, n.
 */
 
-static void outModuleC (mcPretty_pretty p, decl_node n);
+static decl_node__opaque makeModule (nameKey_Name n)
+{
+  decl_node__opaque d;
 
-/*
-   outC -
-*/
+  d = newNode (decl_module);
+  d->moduleF.name = n;
+  d->moduleF.source = nameKey_NulName;
+  d->moduleF.importedModules = Indexing_InitIndex (1);
+  d->moduleF.constFixup = initFixupInfo ();
+  d->moduleF.enumFixup = initFixupInfo ();
+  initDecls (&d->moduleF.decls);
+  d->moduleF.beginStatements = static_cast<decl_node__opaque> (NULL);
+  d->moduleF.finallyStatements = static_cast<decl_node__opaque> (NULL);
+  d->moduleF.enumsComplete = false;
+  d->moduleF.constsComplete = false;
+  d->moduleF.visited = false;
+  initPair (&d->moduleF.com);
+  return d;
+  /* static analysis guarentees a RETURN statement will be used before here.  */
+  __builtin_unreachable ();
+}
 
-static void outC (mcPretty_pretty p, decl_node n);
 
 /*
-   doIncludeM2 - include modules in module, n.
+   isDefForC - returns TRUE if the definition module was defined FOR "C".
 */
 
-static void doIncludeM2 (decl_node n);
-
-/*
-   doConstM2 -
-*/
+static bool isDefForC (decl_node__opaque n)
+{
+  return (decl_isDef (static_cast<decl_node> (n))) && n->defF.forC;
+  /* static analysis guarentees a RETURN statement will be used before here.  */
+  __builtin_unreachable ();
+}
 
-static void doConstM2 (decl_node n);
 
 /*
-   doProcTypeM2 -
+   initDecls - initialize the decls, scopeT.
 */
 
-static void doProcTypeM2 (mcPretty_pretty p, decl_node n);
-
-/*
-   doRecordFieldM2 -
-*/
+static void initDecls (decl_scopeT *decls)
+{
+  (*decls).symbols = symbolKey_initTree ();
+  (*decls).constants = Indexing_InitIndex (1);
+  (*decls).types = Indexing_InitIndex (1);
+  (*decls).procedures = Indexing_InitIndex (1);
+  (*decls).variables = Indexing_InitIndex (1);
+}
 
-static void doRecordFieldM2 (mcPretty_pretty p, decl_node f);
 
 /*
-   doVarientFieldM2 -
+   addTo - adds node, d, to scope decls and returns, d.
+           It stores, d, in the symbols tree associated with decls.
 */
 
-static void doVarientFieldM2 (mcPretty_pretty p, decl_node n);
+static decl_node__opaque addTo (decl_scopeT *decls, decl_node__opaque d)
+{
+  nameKey_Name n;
 
-/*
-   doVarientM2 -
-*/
+  n = decl_getSymName (static_cast<decl_node> (d));
+  if (n != nameKey_NulName)
+    {
+      /* avoid gcc warning by using compound statement even if not strictly necessary.  */
+      if ((symbolKey_getSymKey ((*decls).symbols, n)) == NULL)
+        {
+          symbolKey_putSymKey ((*decls).symbols, n, reinterpret_cast<void *> (d));
+        }
+      else
+        {
+          mcMetaError_metaError1 ((const char *) "{%1DMad} was declared", 21, (const unsigned char *) &d, (sizeof (d)-1));
+          mcMetaError_metaError1 ((const char *) "{%1k} and is being declared again", 33, (const unsigned char *) &n, (sizeof (n)-1));
+        }
+    }
+  if (decl_isConst (static_cast<decl_node> (d)))
+    {
+      Indexing_IncludeIndiceIntoIndex ((*decls).constants, reinterpret_cast<void *> (d));
+    }
+  else if (decl_isVar (static_cast<decl_node> (d)))
+    {
+      /* avoid dangling else.  */
+      Indexing_IncludeIndiceIntoIndex ((*decls).variables, reinterpret_cast<void *> (d));
+    }
+  else if (decl_isType (static_cast<decl_node> (d)))
+    {
+      /* avoid dangling else.  */
+      Indexing_IncludeIndiceIntoIndex ((*decls).types, reinterpret_cast<void *> (d));
+    }
+  else if (decl_isProcedure (static_cast<decl_node> (d)))
+    {
+      /* avoid dangling else.  */
+      Indexing_IncludeIndiceIntoIndex ((*decls).procedures, reinterpret_cast<void *> (d));
+      if (debugDecl)
+        {
+          libc_printf ((const char *) "%d procedures on the dynamic array\\n", 36, Indexing_HighIndice ((*decls).procedures));
+        }
+    }
+  return d;
+  /* static analysis guarentees a RETURN statement will be used before here.  */
+  __builtin_unreachable ();
+}
 
-static void doVarientM2 (mcPretty_pretty p, decl_node n);
 
 /*
-   doRecordM2 -
+   export - export node, n, from definition module, d.
 */
 
-static void doRecordM2 (mcPretty_pretty p, decl_node n);
+static void export_ (decl_node__opaque d, decl_node__opaque n)
+{
+  mcDebug_assert (decl_isDef (static_cast<decl_node> (d)));
+  Indexing_IncludeIndiceIntoIndex (d->defF.exported, reinterpret_cast<void *> (n));
+}
+
 
 /*
-   doPointerM2 -
+   addToScope - adds node, n, to the current scope and returns, n.
 */
 
-static void doPointerM2 (mcPretty_pretty p, decl_node n);
+static decl_node__opaque addToScope (decl_node__opaque n)
+{
+  decl_node__opaque s;
+  unsigned int i;
 
-/*
-   doTypeAliasM2 -
-*/
+  i = Indexing_HighIndice (scopeStack);
+  s = static_cast<decl_node__opaque> (Indexing_GetIndice (scopeStack, i));
+  if (decl_isProcedure (static_cast<decl_node> (s)))
+    {
+      if (debugDecl)
+        {
+          outText (doP, (const char *) "adding ", 7);
+          doNameC (doP, n);
+          outText (doP, (const char *) " to procedure\\n", 15);
+        }
+      return addTo (&s->procedureF.decls, n);
+    }
+  else if (decl_isModule (static_cast<decl_node> (s)))
+    {
+      /* avoid dangling else.  */
+      if (debugDecl)
+        {
+          outText (doP, (const char *) "adding ", 7);
+          doNameC (doP, n);
+          outText (doP, (const char *) " to module\\n", 12);
+        }
+      return addTo (&s->moduleF.decls, n);
+    }
+  else if (decl_isDef (static_cast<decl_node> (s)))
+    {
+      /* avoid dangling else.  */
+      if (debugDecl)
+        {
+          outText (doP, (const char *) "adding ", 7);
+          doNameC (doP, n);
+          outText (doP, (const char *) " to definition module\\n", 23);
+        }
+      export_ (s, n);
+      return addTo (&s->defF.decls, n);
+    }
+  else if (decl_isImp (static_cast<decl_node> (s)))
+    {
+      /* avoid dangling else.  */
+      if (debugDecl)
+        {
+          outText (doP, (const char *) "adding ", 7);
+          doNameC (doP, n);
+          outText (doP, (const char *) " to implementation module\\n", 27);
+        }
+      return addTo (&s->impF.decls, n);
+    }
+  M2RTS_HALT (-1);
+  __builtin_unreachable ();
+  ReturnException ("../../gcc/m2/mc/decl.def", 20, 1);
+  __builtin_unreachable ();
+}
 
-static void doTypeAliasM2 (mcPretty_pretty p, decl_node n);
 
 /*
-   doEnumerationM2 -
+   addModuleToScope - adds module, i, to module, m, scope.
 */
 
-static void doEnumerationM2 (mcPretty_pretty p, decl_node n);
+static void addModuleToScope (decl_node__opaque m, decl_node__opaque i)
+{
+  mcDebug_assert ((decl_getDeclScope ()) == m);
+  if ((decl_lookupSym (decl_getSymName (static_cast<decl_node> (i)))) == NULL)
+    {
+      i = addToScope (i);
+    }
+}
+
 
 /*
-   doBaseM2 -
+   completedEnum - assign boolean enumsComplete to TRUE if a definition,
+                   implementation or module symbol.
 */
 
-static void doBaseM2 (mcPretty_pretty p, decl_node n);
+static void completedEnum (decl_node__opaque n)
+{
+  mcDebug_assert (((decl_isDef (static_cast<decl_node> (n))) || (decl_isImp (static_cast<decl_node> (n)))) || (decl_isModule (static_cast<decl_node> (n))));
+  if (decl_isDef (static_cast<decl_node> (n)))
+    {
+      n->defF.enumsComplete = true;
+    }
+  else if (decl_isImp (static_cast<decl_node> (n)))
+    {
+      /* avoid dangling else.  */
+      n->impF.enumsComplete = true;
+    }
+  else if (decl_isModule (static_cast<decl_node> (n)))
+    {
+      /* avoid dangling else.  */
+      n->moduleF.enumsComplete = true;
+    }
+}
+
 
 /*
-   doSystemM2 -
+   setUnary - sets a unary node to contain, arg, a, and type, t.
 */
 
-static void doSystemM2 (mcPretty_pretty p, decl_node n);
-
-/*
-   doTypeM2 -
-*/
+static void setUnary (decl_node__opaque u, decl_nodeT k, decl_node__opaque a, decl_node__opaque t)
+{
+  switch (k)
+    {
+      case decl_constexp:
+      case decl_deref:
+      case decl_chr:
+      case decl_cap:
+      case decl_abs:
+      case decl_float:
+      case decl_trunc:
+      case decl_ord:
+      case decl_high:
+      case decl_throw:
+      case decl_re:
+      case decl_im:
+      case decl_not:
+      case decl_neg:
+      case decl_adr:
+      case decl_size:
+      case decl_tsize:
+      case decl_min:
+      case decl_max:
+        u->kind = k;
+        u->unaryF.arg = a;
+        u->unaryF.resultType = t;
+        break;
 
-static void doTypeM2 (mcPretty_pretty p, decl_node n);
 
-/*
-   doTypesM2 -
-*/
+      default:
+        CaseException ("../../gcc/m2/mc/decl.def", 20, 1);
+        __builtin_unreachable ();
+    }
+}
 
-static void doTypesM2 (decl_node n);
 
 /*
-   doVarM2 -
+   putVarBool - assigns the four booleans associated with a variable.
 */
 
-static void doVarM2 (decl_node n);
-
-/*
-   doVarsM2 -
-*/
+static void putVarBool (decl_node__opaque v, bool init, bool param, bool isvar, bool isused)
+{
+  mcDebug_assert (decl_isVar (static_cast<decl_node> (v)));
+  v->varF.isInitialised = init;
+  v->varF.isParameter = param;
+  v->varF.isVarParameter = isvar;
+  v->varF.isUsed = isused;
+}
 
-static void doVarsM2 (decl_node n);
 
 /*
-   doTypeNameM2 -
+   checkPtr - in C++ we need to create a typedef for a pointer
+              in case we need to use reinterpret_cast.
 */
 
-static void doTypeNameM2 (mcPretty_pretty p, decl_node n);
+static decl_node__opaque checkPtr (decl_node__opaque n)
+{
+  DynamicStrings_String s;
+  decl_node__opaque p;
 
-/*
-   doParamM2 -
-*/
+  if (lang == decl_ansiCP)
+    {
+      if (decl_isPointer (static_cast<decl_node> (n)))
+        {
+          s = tempName ();
+          p = static_cast<decl_node__opaque> (decl_makeType (nameKey_makekey (DynamicStrings_string (s))));
+          decl_putType (static_cast<decl_node> (p), static_cast<decl_node> (n));
+          s = DynamicStrings_KillString (s);
+          return p;
+        }
+    }
+  return n;
+  /* static analysis guarentees a RETURN statement will be used before here.  */
+  __builtin_unreachable ();
+}
 
-static void doParamM2 (mcPretty_pretty p, decl_node n);
 
 /*
-   doVarParamM2 -
+   isVarDecl - returns TRUE if, n, is a vardecl node.
 */
 
-static void doVarParamM2 (mcPretty_pretty p, decl_node n);
-
-/*
-   doParameterM2 -
-*/
+static bool isVarDecl (decl_node__opaque n)
+{
+  return n->kind == decl_vardecl;
+  /* static analysis guarentees a RETURN statement will be used before here.  */
+  __builtin_unreachable ();
+}
 
-static void doParameterM2 (mcPretty_pretty p, decl_node n);
 
 /*
-   doPrototypeM2 -
+   makeVariablesFromParameters - creates variables which are really parameters.
 */
 
-static void doPrototypeM2 (decl_node n);
+static void makeVariablesFromParameters (decl_node__opaque proc, decl_node__opaque id, decl_node__opaque type, bool isvar, bool isused)
+{
+  decl_node__opaque v;
+  unsigned int i;
+  unsigned int n;
+  nameKey_Name m;
+  DynamicStrings_String s;
 
-/*
-   outputPartialM2 - just writes out record, array, and proctypes.
-                     No need for forward declarations in Modula-2
-                     but we need to keep topological sort happy.
-                     So when asked to output partial we emit the
-                     full type for these types and then do nothing
-                     when trying to complete partial to full.
-*/
+  mcDebug_assert (decl_isProcedure (static_cast<decl_node> (proc)));
+  mcDebug_assert (isIdentList (id));
+  i = 1;
+  n = wlists_noOfItemsInList (id->identlistF.names);
+  while (i <= n)
+    {
+      m = static_cast<nameKey_Name> (wlists_getItemFromList (id->identlistF.names, i));
+      v = static_cast<decl_node__opaque> (decl_makeVar (m));
+      decl_putVar (static_cast<decl_node> (v), static_cast<decl_node> (type), static_cast<decl_node> (NULL));
+      putVarBool (v, true, true, isvar, isused);
+      if (debugScopes)
+        {
+          libc_printf ((const char *) "adding parameter variable into top scope\\n", 42);
+          dumpScopes ();
+          libc_printf ((const char *) " variable name is: ", 19);
+          s = DynamicStrings_InitStringCharStar (nameKey_keyToCharStar (m));
+          if ((DynamicStrings_KillString (SFIO_WriteS (FIO_StdOut, s))) == NULL)
+            {}  /* empty.  */
+          libc_printf ((const char *) "\\n", 2);
+        }
+      i += 1;
+    }
+}
 
-static void outputPartialM2 (decl_node n);
 
 /*
-   outDeclsDefM2 -
+   addProcedureToScope - add a procedure name n and node d to the
+                         current scope.
 */
 
-static void outDeclsDefM2 (mcPretty_pretty p, decl_scopeT s);
+static decl_node__opaque addProcedureToScope (decl_node__opaque d, nameKey_Name n)
+{
+  decl_node__opaque m;
+  unsigned int i;
 
-/*
-   outDefM2 -
-*/
+  i = Indexing_HighIndice (scopeStack);
+  m = static_cast<decl_node__opaque> (Indexing_GetIndice (scopeStack, i));
+  if (((decl_isDef (static_cast<decl_node> (m))) && ((decl_getSymName (static_cast<decl_node> (m))) == (nameKey_makeKey ((const char *) "M2RTS", 5)))) && ((decl_getSymName (static_cast<decl_node> (d))) == (nameKey_makeKey ((const char *) "HALT", 4))))
+    {
+      haltN = d;
+      symbolKey_putSymKey (baseSymbols, n, reinterpret_cast<void *> (haltN));
+    }
+  return addToScope (d);
+  /* static analysis guarentees a RETURN statement will be used before here.  */
+  __builtin_unreachable ();
+}
 
-static void outDefM2 (mcPretty_pretty p, decl_node n);
 
 /*
-   outDeclsImpM2 -
+   putProcTypeReturn - sets the return type of, proc, to, type.
 */
 
-static void outDeclsImpM2 (mcPretty_pretty p, decl_scopeT s);
-
-/*
-   outImpM2 -
-*/
+static void putProcTypeReturn (decl_node__opaque proc, decl_node__opaque type)
+{
+  mcDebug_assert (decl_isProcType (static_cast<decl_node> (proc)));
+  proc->proctypeF.returnType = type;
+  initNodeOpaqueState (proc);
+}
 
-static void outImpM2 (mcPretty_pretty p, decl_node n);
 
 /*
-   outModuleM2 -
+   putProcTypeOptReturn - sets, proc, to have an optional return type.
 */
 
-static void outModuleM2 (mcPretty_pretty p, decl_node n);
-
-/*
-   outM2 -
-*/
+static void putProcTypeOptReturn (decl_node__opaque proc)
+{
+  mcDebug_assert (decl_isProcType (static_cast<decl_node> (proc)));
+  proc->proctypeF.returnopt = true;
+}
 
-static void outM2 (mcPretty_pretty p, decl_node n);
 
 /*
-   addDone - adds node, n, to the doneQ.
+   makeOptParameter - creates and returns an optarg.
 */
 
-static void addDone (decl_node n);
+static decl_node__opaque makeOptParameter (decl_node__opaque l, decl_node__opaque type, decl_node__opaque init)
+{
+  decl_node__opaque n;
 
-/*
-   addDoneDef - adds node, n, to the doneQ providing
-                it is not an opaque of the main module we are compiling.
-*/
+  n = newNode (decl_optarg);
+  n->optargF.namelist = l;
+  n->optargF.type = type;
+  n->optargF.init = init;
+  n->optargF.scope = static_cast<decl_node__opaque> (NULL);
+  return n;
+  /* static analysis guarentees a RETURN statement will be used before here.  */
+  __builtin_unreachable ();
+}
 
-static void addDoneDef (decl_node n);
 
 /*
-   dbgAdd -
+   setwatch - assign the globalNode to n.
 */
 
-static decl_node dbgAdd (alists_alist l, decl_node n);
-
-/*
-   dbgType -
-*/
+static bool setwatch (decl_node__opaque n)
+{
+  globalNode = n;
+  return true;
+  /* static analysis guarentees a RETURN statement will be used before here.  */
+  __builtin_unreachable ();
+}
 
-static void dbgType (alists_alist l, decl_node n);
 
 /*
-   dbgPointer -
+   runwatch - set the globalNode to an identlist.
 */
 
-static void dbgPointer (alists_alist l, decl_node n);
-
-/*
-   dbgRecord -
-*/
+static bool runwatch (void)
+{
+  return globalNode->kind == decl_identlist;
+  /* static analysis guarentees a RETURN statement will be used before here.  */
+  __builtin_unreachable ();
+}
 
-static void dbgRecord (alists_alist l, decl_node n);
 
 /*
-   dbgVarient -
+   isIdentList - returns TRUE if, n, is an identlist.
 */
 
-static void dbgVarient (alists_alist l, decl_node n);
+static bool isIdentList (decl_node__opaque n)
+{
+  return n->kind == decl_identlist;
+  /* static analysis guarentees a RETURN statement will be used before here.  */
+  __builtin_unreachable ();
+}
+
 
 /*
-   dbgEnumeration -
+   identListLen - returns the length of identlist.
 */
 
-static void dbgEnumeration (alists_alist l, decl_node n);
+static unsigned int identListLen (decl_node__opaque n)
+{
+  if (n == NULL)
+    {
+      return 0;
+    }
+  else
+    {
+      mcDebug_assert (isIdentList (n));
+      return wlists_noOfItemsInList (n->identlistF.names);
+    }
+  /* static analysis guarentees a RETURN statement will be used before here.  */
+  __builtin_unreachable ();
+}
+
 
 /*
-   dbgVar -
+   checkParameters - placeholder for future parameter checking.
 */
 
-static void dbgVar (alists_alist l, decl_node n);
+static void checkParameters (decl_node__opaque p, decl_node__opaque i, decl_node__opaque type, bool isvar, bool isused)
+{
+  /* do check.  */
+  disposeNode (&i);
+}
+
 
 /*
-   dbgSubrange -
+   checkMakeVariables - create shadow local variables for parameters providing that
+                        procedure n has not already been built and we are compiling
+                        a module or an implementation module.
 */
 
-static void dbgSubrange (alists_alist l, decl_node n);
+static void checkMakeVariables (decl_node__opaque n, decl_node__opaque i, decl_node__opaque type, bool isvar, bool isused)
+{
+  if (((decl_isImp (static_cast<decl_node> (currentModule))) || (decl_isModule (static_cast<decl_node> (currentModule)))) && ! n->procedureF.built)
+    {
+      makeVariablesFromParameters (n, i, type, isvar, isused);
+    }
+}
+
 
 /*
-   dbgArray -
+   makeVarientField - create a varient field within varient, v,
+                      The new varient field is returned.
 */
 
-static void dbgArray (alists_alist l, decl_node n);
+static decl_node__opaque makeVarientField (decl_node__opaque v, decl_node__opaque p)
+{
+  decl_node__opaque n;
 
-/*
-   doDbg -
-*/
+  n = newNode (decl_varientfield);
+  n->varientfieldF.name = nameKey_NulName;
+  n->varientfieldF.parent = p;
+  n->varientfieldF.varient = v;
+  n->varientfieldF.simple = false;
+  n->varientfieldF.listOfSons = Indexing_InitIndex (1);
+  n->varientfieldF.scope = static_cast<decl_node__opaque> (decl_getDeclScope ());
+  return n;
+  /* static analysis guarentees a RETURN statement will be used before here.  */
+  __builtin_unreachable ();
+}
 
-static void doDbg (alists_alist l, decl_node n);
 
 /*
-   dbg -
+   putFieldVarient - places the field varient, f, as a brother to, the
+                     varient symbol, v, and also tells, f, that its varient
+                     parent is, v.
 */
 
-static void dbg (decl_node n);
-
-/*
-   addGenericBody - adds comment node to funccall, return, assignment
-                    nodes.
-*/
-
-static void addGenericBody (decl_node n, decl_node c);
-
-/*
-   addGenericAfter - adds comment node to funccall, return, assignment
-                     nodes.
-*/
+static void putFieldVarient (decl_node__opaque f, decl_node__opaque v)
+{
+  mcDebug_assert (decl_isVarient (static_cast<decl_node> (v)));
+  mcDebug_assert (decl_isVarientField (static_cast<decl_node> (f)));
+  switch (v->kind)
+    {
+      case decl_varient:
+        Indexing_IncludeIndiceIntoIndex (v->varientF.listOfSons, reinterpret_cast<void *> (f));
+        break;
 
-static void addGenericAfter (decl_node n, decl_node c);
 
-/*
-   isAssignment -
-*/
+      default:
+        CaseException ("../../gcc/m2/mc/decl.def", 20, 1);
+        __builtin_unreachable ();
+    }
+  switch (f->kind)
+    {
+      case decl_varientfield:
+        f->varientfieldF.varient = v;
+        break;
 
-static bool isAssignment (decl_node n);
 
-/*
-   isComment - returns TRUE if node, n, is a comment.
-*/
+      default:
+        CaseException ("../../gcc/m2/mc/decl.def", 20, 1);
+        __builtin_unreachable ();
+    }
+}
 
-static bool isComment (decl_node n);
 
 /*
-   initPair - initialise the commentPair, c.
+   putFieldRecord - create a new recordfield and place it into record r.
+                    The new field has a tagname and type and can have a
+                    variant field v.
 */
 
-static void initPair (decl_commentPair *c);
-
-/*
-   dupExplist -
-*/
+static decl_node__opaque putFieldRecord (decl_node__opaque r, nameKey_Name tag, decl_node__opaque type, decl_node__opaque v)
+{
+  decl_node__opaque f;
+  decl_node__opaque n;
+  decl_node__opaque p;
 
-static decl_node dupExplist (decl_node n);
+  n = newNode (decl_recordfield);
+  switch (r->kind)
+    {
+      case decl_record:
+        Indexing_IncludeIndiceIntoIndex (r->recordF.listOfSons, reinterpret_cast<void *> (n));
+        /* ensure that field, n, is in the parents Local Symbols.  */
+        if (tag != nameKey_NulName)
+          {
+            /* avoid gcc warning by using compound statement even if not strictly necessary.  */
+            if ((symbolKey_getSymKey (r->recordF.localSymbols, tag)) == symbolKey_NulKey)
+              {
+                symbolKey_putSymKey (r->recordF.localSymbols, tag, reinterpret_cast<void *> (n));
+              }
+            else
+              {
+                f = static_cast<decl_node__opaque> (symbolKey_getSymKey (r->recordF.localSymbols, tag));
+                mcMetaError_metaErrors1 ((const char *) "field record {%1Dad} has already been declared", 46, (const char *) "field record duplicate", 22, (const unsigned char *) &f, (sizeof (f)-1));
+              }
+          }
+        break;
 
-/*
-   dupArrayref -
-*/
+      case decl_varientfield:
+        Indexing_IncludeIndiceIntoIndex (r->varientfieldF.listOfSons, reinterpret_cast<void *> (n));
+        p = getParent (r);
+        mcDebug_assert (p->kind == decl_record);
+        if (tag != nameKey_NulName)
+          {
+            symbolKey_putSymKey (p->recordF.localSymbols, tag, reinterpret_cast<void *> (n));
+          }
+        break;
 
-static decl_node dupArrayref (decl_node n);
 
-/*
-   dupPointerref -
-*/
+      default:
+        CaseException ("../../gcc/m2/mc/decl.def", 20, 1);
+        __builtin_unreachable ();
+    }
+  /* fill in, n.  */
+  n->recordfieldF.type = type;
+  n->recordfieldF.name = tag;
+  n->recordfieldF.parent = r;
+  n->recordfieldF.varient = v;
+  n->recordfieldF.tag = false;
+  n->recordfieldF.scope = static_cast<decl_node__opaque> (NULL);
+  initCname (&n->recordfieldF.cname);
+  /* 
+   IF r^.kind=record
+   THEN
+      doRecordM2 (doP, r)
+   END ;
+  */
+  return n;
+  /* static analysis guarentees a RETURN statement will be used before here.  */
+  __builtin_unreachable ();
+}
 
-static decl_node dupPointerref (decl_node n);
 
 /*
-   dupComponentref -
+   ensureOrder - ensures that, a, and, b, exist in, i, and also
+                 ensure that, a, is before, b.
 */
 
-static decl_node dupComponentref (decl_node n);
-
-/*
-   dupBinary -
-*/
+static void ensureOrder (Indexing_Index i, decl_node__opaque a, decl_node__opaque b)
+{
+  mcDebug_assert (Indexing_IsIndiceInIndex (i, reinterpret_cast<void *> (a)));
+  mcDebug_assert (Indexing_IsIndiceInIndex (i, reinterpret_cast<void *> (b)));
+  Indexing_RemoveIndiceFromIndex (i, reinterpret_cast<void *> (a));
+  Indexing_RemoveIndiceFromIndex (i, reinterpret_cast<void *> (b));
+  Indexing_IncludeIndiceIntoIndex (i, reinterpret_cast<void *> (a));
+  Indexing_IncludeIndiceIntoIndex (i, reinterpret_cast<void *> (b));
+  mcDebug_assert (Indexing_IsIndiceInIndex (i, reinterpret_cast<void *> (a)));
+  mcDebug_assert (Indexing_IsIndiceInIndex (i, reinterpret_cast<void *> (b)));
+}
 
-static decl_node dupBinary (decl_node n);
 
 /*
-   dupUnary -
+   putVarientTag - places tag into variant v.
 */
 
-static decl_node dupUnary (decl_node n);
+static void putVarientTag (decl_node__opaque v, decl_node__opaque tag)
+{
+  decl_node__opaque p;
 
-/*
-   dupFunccall -
-*/
+  mcDebug_assert (decl_isVarient (static_cast<decl_node> (v)));
+  switch (v->kind)
+    {
+      case decl_varient:
+        v->varientF.tag = tag;
+        break;
 
-static decl_node dupFunccall (decl_node n);
 
-/*
-   dupSetValue -
-*/
+      default:
+        CaseException ("../../gcc/m2/mc/decl.def", 20, 1);
+        __builtin_unreachable ();
+    }
+}
 
-static decl_node dupSetValue (decl_node n);
 
 /*
-   doDupExpr -
+   getParent - returns the parent field of recordfield or varientfield symbol, n.
 */
 
-static decl_node doDupExpr (decl_node n);
+static decl_node__opaque getParent (decl_node__opaque n)
+{
+  switch (n->kind)
+    {
+      case decl_recordfield:
+        return n->recordfieldF.parent;
+        break;
 
-/*
-   makeSystem -
-*/
+      case decl_varientfield:
+        return n->varientfieldF.parent;
+        break;
 
-static void makeSystem (void);
 
-/*
-   makeM2rts -
-*/
+      default:
+        CaseException ("../../gcc/m2/mc/decl.def", 20, 1);
+        __builtin_unreachable ();
+    }
+  /* static analysis guarentees a RETURN statement will be used before here.  */
+  __builtin_unreachable ();
+}
 
-static void makeM2rts (void);
 
 /*
-   makeBitnum -
+   getRecord - returns the record associated with node, n.
+               (Parental record).
 */
 
-static decl_node makeBitnum (void);
+static decl_node__opaque getRecord (decl_node__opaque n)
+{
+  mcDebug_assert (n->kind != decl_varient);  /* if this fails then we need to add parent field to varient.  */
+  switch (n->kind)
+    {
+      case decl_record:
+        return n;  /* if this fails then we need to add parent field to varient.  */
+        break;
 
-/*
-   makeBaseSymbols -
-*/
+      case decl_varientfield:
+        return getRecord (getParent (n));
+        break;
 
-static void makeBaseSymbols (void);
 
-/*
-   makeBuiltins -
-*/
+      default:
+        CaseException ("../../gcc/m2/mc/decl.def", 20, 1);
+        __builtin_unreachable ();
+    }
+  /* static analysis guarentees a RETURN statement will be used before here.  */
+  __builtin_unreachable ();
+}
 
-static void makeBuiltins (void);
 
 /*
-   init -
+   isConstExp - return TRUE if the node kind is a constexp.
 */
 
-static void init (void);
+static bool isConstExp (decl_node__opaque c)
+{
+  mcDebug_assert (c != NULL);
+  return c->kind == decl_constexp;
+  /* static analysis guarentees a RETURN statement will be used before here.  */
+  __builtin_unreachable ();
+}
 
 
 /*
-   newNode - create and return a new node of kind k.
+   addEnumToModule - adds enumeration type, e, into the list of enums
+                     in module, m.
 */
 
-static decl_node newNode (decl_nodeT k)
+static void addEnumToModule (decl_node__opaque m, decl_node__opaque e)
 {
-  decl_node d;
-
-  Storage_ALLOCATE ((void **) &d, sizeof (decl_nodeRec));
-  if (enableMemsetOnAllocation)
+  mcDebug_assert ((decl_isEnumeration (static_cast<decl_node> (e))) || (decl_isEnumerationField (static_cast<decl_node> (e))));
+  mcDebug_assert (((decl_isModule (static_cast<decl_node> (m))) || (decl_isDef (static_cast<decl_node> (m)))) || (decl_isImp (static_cast<decl_node> (m))));
+  if (decl_isModule (static_cast<decl_node> (m)))
     {
-      d = static_cast<decl_node> (libc_memset (reinterpret_cast<void *> (d), 0, static_cast<size_t> (sizeof ((*d)))));
+      Indexing_IncludeIndiceIntoIndex (m->moduleF.enumFixup.info, reinterpret_cast<void *> (e));
     }
-  if (d == NULL)
+  else if (decl_isDef (static_cast<decl_node> (m)))
     {
-      M2RTS_HALT (-1);
-      __builtin_unreachable ();
+      /* avoid dangling else.  */
+      Indexing_IncludeIndiceIntoIndex (m->defF.enumFixup.info, reinterpret_cast<void *> (e));
     }
-  else
+  else if (decl_isImp (static_cast<decl_node> (m)))
     {
-      d->kind = k;
-      d->at.defDeclared = 0;
-      d->at.modDeclared = 0;
-      d->at.firstUsed = 0;
-      return d;
+      /* avoid dangling else.  */
+      Indexing_IncludeIndiceIntoIndex (m->impF.enumFixup.info, reinterpret_cast<void *> (e));
     }
-  ReturnException ("../../gcc/m2/mc/decl.def", 20, 1);
-  __builtin_unreachable ();
 }
 
 
 /*
-   disposeNode - dispose node, n.
+   getNextFixup - return the next fixup from from f.
 */
 
-static void disposeNode (decl_node *n)
+static decl_node__opaque getNextFixup (decl_fixupInfo *f)
 {
-  Storage_DEALLOCATE ((void **) &(*n), sizeof (decl_nodeRec));
-  (*n) = NULL;
+  (*f).count += 1;
+  return static_cast<decl_node__opaque> (Indexing_GetIndice ((*f).info, (*f).count));
+  /* static analysis guarentees a RETURN statement will be used before here.  */
+  __builtin_unreachable ();
 }
 
 
 /*
-   newGroup -
+   doMakeEnum - create an enumeration type and add it to the current module.
 */
 
-static void newGroup (decl_group *g)
+static decl_node__opaque doMakeEnum (void)
 {
-  if (freeGroup == NULL)
-    {
-      Storage_ALLOCATE ((void **) &(*g), sizeof (decl__T15));
-    }
-  else
-    {
-      (*g) = freeGroup;
-      freeGroup = freeGroup->next;
-    }
+  decl_node__opaque e;
+
+  e = newNode (decl_enumeration);
+  e->enumerationF.noOfElements = 0;
+  e->enumerationF.localSymbols = symbolKey_initTree ();
+  e->enumerationF.scope = static_cast<decl_node__opaque> (decl_getDeclScope ());
+  e->enumerationF.listOfSons = Indexing_InitIndex (1);
+  e->enumerationF.low = static_cast<decl_node__opaque> (NULL);
+  e->enumerationF.high = static_cast<decl_node__opaque> (NULL);
+  addEnumToModule (currentModule, e);
+  return e;
+  /* static analysis guarentees a RETURN statement will be used before here.  */
+  __builtin_unreachable ();
 }
 
 
 /*
-   initGroup - returns a group which with all lists initialized.
+   doMakeEnumField - create an enumeration field name and add it to enumeration e.
+                     Return the new field.
 */
 
-static decl_group initGroup (void)
+static decl_node__opaque doMakeEnumField (decl_node__opaque e, nameKey_Name n)
 {
-  decl_group g;
+  decl_node__opaque f;
 
-  newGroup (&g);
-  g->todoQ = alists_initList ();
-  g->partialQ = alists_initList ();
-  g->doneQ = alists_initList ();
-  g->next = NULL;
-  return g;
+  mcDebug_assert (decl_isEnumeration (static_cast<decl_node> (e)));
+  f = static_cast<decl_node__opaque> (decl_lookupSym (n));
+  if (f == NULL)
+    {
+      f = newNode (decl_enumerationfield);
+      symbolKey_putSymKey (e->enumerationF.localSymbols, n, reinterpret_cast<void *> (f));
+      Indexing_IncludeIndiceIntoIndex (e->enumerationF.listOfSons, reinterpret_cast<void *> (f));
+      f->enumerationfieldF.name = n;
+      f->enumerationfieldF.type = e;
+      f->enumerationfieldF.scope = static_cast<decl_node__opaque> (decl_getDeclScope ());
+      f->enumerationfieldF.value = e->enumerationF.noOfElements;
+      initCname (&f->enumerationfieldF.cname);
+      e->enumerationF.noOfElements += 1;
+      mcDebug_assert ((Indexing_GetIndice (e->enumerationF.listOfSons, e->enumerationF.noOfElements)) == f);
+      addEnumToModule (currentModule, f);
+      if (e->enumerationF.low == NULL)
+        {
+          e->enumerationF.low = f;
+        }
+      e->enumerationF.high = f;
+      return addToScope (f);
+    }
+  else
+    {
+      mcMetaError_metaErrors2 ((const char *) "cannot create enumeration field {%1k} as the name is already in use", 67, (const char *) "{%2DMad} was declared elsewhere", 31, (const unsigned char *) &n, (sizeof (n)-1), (const unsigned char *) &f, (sizeof (f)-1));
+    }
+  return f;
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
 
 
 /*
-   killGroup - deallocate the group and place the group record into the freeGroup list.
+   getExpList - returns the, n, th argument in an explist.
 */
 
-static void killGroup (decl_group *g)
+static decl_node__opaque getExpList (decl_node__opaque p, unsigned int n)
 {
-  alists_killList (&(*g)->todoQ);
-  alists_killList (&(*g)->partialQ);
-  alists_killList (&(*g)->doneQ);
-  (*g)->next = freeGroup;
-  freeGroup = (*g);
+  mcDebug_assert (p != NULL);
+  mcDebug_assert (decl_isExpList (static_cast<decl_node> (p)));
+  mcDebug_assert (n <= (Indexing_HighIndice (p->explistF.exp)));
+  return static_cast<decl_node__opaque> (Indexing_GetIndice (p->explistF.exp, n));
+  /* static analysis guarentees a RETURN statement will be used before here.  */
+  __builtin_unreachable ();
 }
 
 
 /*
-   dupGroup - If g is not NIL then destroy g.
-              Return a duplicate of GlobalGroup (not g).
+   expListLen - returns the length of explist, p.
 */
 
-static decl_group dupGroup (decl_group g)
+static unsigned int expListLen (decl_node__opaque p)
 {
-  if (g != NULL)
+  if (p == NULL)
     {
-      /* Kill old group.  */
-      killGroup (&g);
+      return 0;
+    }
+  else
+    {
+      mcDebug_assert (decl_isExpList (static_cast<decl_node> (p)));
+      return Indexing_HighIndice (p->explistF.exp);
     }
-  newGroup (&g);
-  /* Copy all lists.  */
-  g->todoQ = alists_duplicateList (globalGroup->todoQ);
-  g->partialQ = alists_duplicateList (globalGroup->partialQ);
-  g->doneQ = alists_duplicateList (globalGroup->doneQ);
-  g->next = NULL;
-  return g;
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
 
 
 /*
-   equalGroup - return TRUE if group left = right.
+   getConstExpComplete - gets the field from the def or imp or module, n.
 */
 
-static bool equalGroup (decl_group left, decl_group right)
+static bool getConstExpComplete (decl_node__opaque n)
 {
-  return (left == right) || (((alists_equalList (left->todoQ, right->todoQ)) && (alists_equalList (left->partialQ, right->partialQ))) && (alists_equalList (left->doneQ, right->doneQ)));
-  /* static analysis guarentees a RETURN statement will be used before here.  */
-  __builtin_unreachable ();
-}
+  switch (n->kind)
+    {
+      case decl_def:
+        return n->defF.constsComplete;
+        break;
 
+      case decl_imp:
+        return n->impF.constsComplete;
+        break;
 
-/*
-   isLocal - returns TRUE if symbol, n, is locally declared in a procedure.
-*/
+      case decl_module:
+        return n->moduleF.constsComplete;
+        break;
 
-static bool isLocal (decl_node n)
-{
-  decl_node s;
 
-  s = decl_getScope (n);
-  if (s != NULL)
-    {
-      return decl_isProcedure (s);
+      default:
+        CaseException ("../../gcc/m2/mc/decl.def", 20, 1);
+        __builtin_unreachable ();
     }
-  return false;
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
 
 
 /*
-   importEnumFields - if, n, is an enumeration type import the all fields into module, m.
+   addConstToModule - adds const exp, e, into the list of constant
+                      expressions in module, m.
 */
 
-static void importEnumFields (decl_node m, decl_node n)
+static void addConstToModule (decl_node__opaque m, decl_node__opaque e)
 {
-  decl_node r;
-  decl_node e;
-  unsigned int i;
-  unsigned int h;
-
-  mcDebug_assert (((decl_isDef (m)) || (decl_isModule (m))) || (decl_isImp (m)));
-  n = decl_skipType (n);
-  if ((n != NULL) && (decl_isEnumeration (n)))
+  mcDebug_assert (((decl_isModule (static_cast<decl_node> (m))) || (decl_isDef (static_cast<decl_node> (m)))) || (decl_isImp (static_cast<decl_node> (m))));
+  if (decl_isModule (static_cast<decl_node> (m)))
     {
-      i = Indexing_LowIndice (n->enumerationF.listOfSons);
-      h = Indexing_HighIndice (n->enumerationF.listOfSons);
-      while (i <= h)
-        {
-          e = static_cast<decl_node> (Indexing_GetIndice (n->enumerationF.listOfSons, i));
-          r = decl_import (m, e);
-          if (e != r)
-            {
-              mcMetaError_metaError2 ((const char *) "enumeration field {%1ad} cannot be imported implicitly into {%2d} due to a name clash", 85, (const unsigned char *) &e, (sizeof (e)-1), (const unsigned char *) &m, (sizeof (m)-1));
-            }
-          i += 1;
-        }
+      Indexing_IncludeIndiceIntoIndex (m->moduleF.constFixup.info, reinterpret_cast<void *> (e));
+    }
+  else if (decl_isDef (static_cast<decl_node> (m)))
+    {
+      /* avoid dangling else.  */
+      Indexing_IncludeIndiceIntoIndex (m->defF.constFixup.info, reinterpret_cast<void *> (e));
+    }
+  else if (decl_isImp (static_cast<decl_node> (m)))
+    {
+      /* avoid dangling else.  */
+      Indexing_IncludeIndiceIntoIndex (m->impF.constFixup.info, reinterpret_cast<void *> (e));
     }
 }
 
 
 /*
-   isComplex - returns TRUE if, n, is the complex type.
+   doMakeConstExp - create a constexp node and add it to the current module.
 */
 
-static bool isComplex (decl_node n)
+static decl_node__opaque doMakeConstExp (void)
 {
-  return n == complexN;
+  decl_node__opaque c;
+
+  c = makeUnary (decl_constexp, static_cast<decl_node__opaque> (NULL), static_cast<decl_node__opaque> (NULL));
+  addConstToModule (currentModule, c);
+  return c;
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
 
 
 /*
-   isLongComplex - returns TRUE if, n, is the longcomplex type.
+   isAnyType - return TRUE if node n is any type kind.
 */
 
-static bool isLongComplex (decl_node n)
+static bool isAnyType (decl_node__opaque n)
 {
-  return n == longcomplexN;
-  /* static analysis guarentees a RETURN statement will be used before here.  */
-  __builtin_unreachable ();
-}
-
+  mcDebug_assert (n != NULL);
+  switch (n->kind)
+    {
+      case decl_address:
+      case decl_loc:
+      case decl_byte:
+      case decl_word:
+      case decl_char:
+      case decl_cardinal:
+      case decl_longcard:
+      case decl_shortcard:
+      case decl_integer:
+      case decl_longint:
+      case decl_shortint:
+      case decl_complex:
+      case decl_longcomplex:
+      case decl_shortcomplex:
+      case decl_bitset:
+      case decl_boolean:
+      case decl_proc:
+      case decl_type:
+        return true;
+        break;
 
-/*
-   isShortComplex - returns TRUE if, n, is the shortcomplex type.
-*/
 
-static bool isShortComplex (decl_node n)
-{
-  return n == shortcomplexN;
+      default:
+        return false;
+        break;
+    }
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
 
 
 /*
-   isAProcType - returns TRUE if, n, is a proctype or proc node.
+   makeVal - creates a VAL (type, expression) node.
 */
 
-static bool isAProcType (decl_node n)
+static decl_node__opaque makeVal (decl_node__opaque params)
 {
-  mcDebug_assert (n != NULL);
-  return (decl_isProcType (n)) || (n == procN);
-  /* static analysis guarentees a RETURN statement will be used before here.  */
+  mcDebug_assert (decl_isExpList (static_cast<decl_node> (params)));
+  if ((expListLen (params)) == 2)
+    {
+      return makeBinary (decl_val, getExpList (params, 1), getExpList (params, 2), getExpList (params, 1));
+    }
+  else
+    {
+      M2RTS_HALT (-1);
+      __builtin_unreachable ();
+    }
+  ReturnException ("../../gcc/m2/mc/decl.def", 20, 1);
   __builtin_unreachable ();
 }
 
 
 /*
-   initFixupInfo - initialize the fixupInfo record.
+   makeCast - creates a cast node TYPENAME (expr).
 */
 
-static decl_fixupInfo initFixupInfo (void)
+static decl_node__opaque makeCast (decl_node__opaque c, decl_node__opaque p)
 {
-  decl_fixupInfo f;
-
-  f.count = 0;
-  f.info = Indexing_InitIndex (1);
-  return f;
-  /* static analysis guarentees a RETURN statement will be used before here.  */
+  mcDebug_assert (decl_isExpList (static_cast<decl_node> (p)));
+  if ((expListLen (p)) == 1)
+    {
+      return makeBinary (decl_cast, c, getExpList (p, 1), c);
+    }
+  else
+    {
+      M2RTS_HALT (-1);
+      __builtin_unreachable ();
+    }
+  ReturnException ("../../gcc/m2/mc/decl.def", 20, 1);
   __builtin_unreachable ();
 }
 
-
-/*
-   makeDef - returns a definition module node named, n.
-*/
-
-static decl_node makeDef (nameKey_Name n)
+static decl_node__opaque makeIntrinsicProc (decl_nodeT k, unsigned int noArgs, decl_node__opaque p)
 {
-  decl_node d;
+  decl_node__opaque f;
 
-  d = newNode (decl_def);
-  d->defF.name = n;
-  d->defF.source = nameKey_NulName;
-  d->defF.hasHidden = false;
-  d->defF.forC = false;
-  d->defF.exported = Indexing_InitIndex (1);
-  d->defF.importedModules = Indexing_InitIndex (1);
-  d->defF.constFixup = initFixupInfo ();
-  d->defF.enumFixup = initFixupInfo ();
-  initDecls (&d->defF.decls);
-  d->defF.enumsComplete = false;
-  d->defF.constsComplete = false;
-  d->defF.visited = false;
-  initPair (&d->defF.com);
-  return d;
+  /* 
+   makeIntrisicProc - create an intrinsic node.
+  */
+  f = newNode (k);
+  f->intrinsicF.args = p;
+  f->intrinsicF.noArgs = noArgs;
+  f->intrinsicF.type = static_cast<decl_node__opaque> (NULL);
+  f->intrinsicF.postUnreachable = k == decl_halt;
+  initPair (&f->intrinsicF.intrinsicComment);
+  return f;
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
 
 
 /*
-   makeImp - returns an implementation module node named, n.
+   makeIntrinsicUnaryType - create an intrisic unary type.
 */
 
-static decl_node makeImp (nameKey_Name n)
+static decl_node__opaque makeIntrinsicUnaryType (decl_nodeT k, decl_node__opaque paramList, decl_node__opaque returnType)
 {
-  decl_node d;
-
-  d = newNode (decl_imp);
-  d->impF.name = n;
-  d->impF.source = nameKey_NulName;
-  d->impF.importedModules = Indexing_InitIndex (1);
-  d->impF.constFixup = initFixupInfo ();
-  d->impF.enumFixup = initFixupInfo ();
-  initDecls (&d->impF.decls);
-  d->impF.beginStatements = NULL;
-  d->impF.finallyStatements = NULL;
-  d->impF.definitionModule = NULL;
-  d->impF.enumsComplete = false;
-  d->impF.constsComplete = false;
-  d->impF.visited = false;
-  initPair (&d->impF.com);
-  return d;
+  return makeUnary (k, getExpList (paramList, 1), returnType);
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
 
 
 /*
-   makeModule - returns a module node named, n.
+   makeIntrinsicBinaryType - create an intrisic binary type.
 */
 
-static decl_node makeModule (nameKey_Name n)
+static decl_node__opaque makeIntrinsicBinaryType (decl_nodeT k, decl_node__opaque paramList, decl_node__opaque returnType)
 {
-  decl_node d;
-
-  d = newNode (decl_module);
-  d->moduleF.name = n;
-  d->moduleF.source = nameKey_NulName;
-  d->moduleF.importedModules = Indexing_InitIndex (1);
-  d->moduleF.constFixup = initFixupInfo ();
-  d->moduleF.enumFixup = initFixupInfo ();
-  initDecls (&d->moduleF.decls);
-  d->moduleF.beginStatements = NULL;
-  d->moduleF.finallyStatements = NULL;
-  d->moduleF.enumsComplete = false;
-  d->moduleF.constsComplete = false;
-  d->moduleF.visited = false;
-  initPair (&d->moduleF.com);
-  return d;
+  return makeBinary (k, getExpList (paramList, 1), getExpList (paramList, 2), returnType);
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
 
 
 /*
-   isDefForC - returns TRUE if the definition module was defined FOR "C".
+   checkIntrinsic - checks to see if the function call to, c, with
+                    parameter list, n, is really an intrinic.  If it
+                    is an intrinic then an intrinic node is created
+                    and returned.  Otherwise NIL is returned.
 */
 
-static bool isDefForC (decl_node n)
+static decl_node__opaque checkIntrinsic (decl_node__opaque c, decl_node__opaque n)
 {
-  return (decl_isDef (n)) && n->defF.forC;
-  /* static analysis guarentees a RETURN statement will be used before here.  */
-  __builtin_unreachable ();
-}
-
-
-/*
-   initDecls - initialize the decls, scopeT.
-*/
-
-static void initDecls (decl_scopeT *decls)
-{
-  (*decls).symbols = symbolKey_initTree ();
-  (*decls).constants = Indexing_InitIndex (1);
-  (*decls).types = Indexing_InitIndex (1);
-  (*decls).procedures = Indexing_InitIndex (1);
-  (*decls).variables = Indexing_InitIndex (1);
-}
-
-
-/*
-   addTo - adds node, d, to scope decls and returns, d.
-           It stores, d, in the symbols tree associated with decls.
-*/
-
-static decl_node addTo (decl_scopeT *decls, decl_node d)
-{
-  nameKey_Name n;
-
-  n = decl_getSymName (d);
-  if (n != nameKey_NulName)
+  if (isAnyType (c))
     {
-      /* avoid gcc warning by using compound statement even if not strictly necessary.  */
-      if ((symbolKey_getSymKey ((*decls).symbols, n)) == NULL)
-        {
-          symbolKey_putSymKey ((*decls).symbols, n, reinterpret_cast<void *> (d));
-        }
-      else
-        {
-          mcMetaError_metaError1 ((const char *) "{%1DMad} was declared", 21, (const unsigned char *) &d, (sizeof (d)-1));
-          mcMetaError_metaError1 ((const char *) "{%1k} and is being declared again", 33, (const unsigned char *) &n, (sizeof (n)-1));
-        }
+      return makeCast (c, n);
     }
-  if (decl_isConst (d))
+  else if (c == maxN)
     {
-      Indexing_IncludeIndiceIntoIndex ((*decls).constants, reinterpret_cast<void *> (d));
+      /* avoid dangling else.  */
+      return makeIntrinsicUnaryType (decl_max, n, static_cast<decl_node__opaque> (NULL));
     }
-  else if (decl_isVar (d))
+  else if (c == minN)
     {
       /* avoid dangling else.  */
-      Indexing_IncludeIndiceIntoIndex ((*decls).variables, reinterpret_cast<void *> (d));
+      return makeIntrinsicUnaryType (decl_min, n, static_cast<decl_node__opaque> (NULL));
     }
-  else if (decl_isType (d))
+  else if (c == haltN)
     {
       /* avoid dangling else.  */
-      Indexing_IncludeIndiceIntoIndex ((*decls).types, reinterpret_cast<void *> (d));
+      return makeIntrinsicProc (decl_halt, expListLen (n), n);
     }
-  else if (decl_isProcedure (d))
+  else if (c == valN)
     {
       /* avoid dangling else.  */
-      Indexing_IncludeIndiceIntoIndex ((*decls).procedures, reinterpret_cast<void *> (d));
-      if (debugDecl)
-        {
-          libc_printf ((const char *) "%d procedures on the dynamic array\\n", 36, Indexing_HighIndice ((*decls).procedures));
-        }
+      return makeVal (n);
     }
-  return d;
+  else if (c == adrN)
+    {
+      /* avoid dangling else.  */
+      return makeIntrinsicUnaryType (decl_adr, n, addressN);
+    }
+  else if (c == sizeN)
+    {
+      /* avoid dangling else.  */
+      return makeIntrinsicUnaryType (decl_size, n, cardinalN);
+    }
+  else if (c == tsizeN)
+    {
+      /* avoid dangling else.  */
+      return makeIntrinsicUnaryType (decl_tsize, n, cardinalN);
+    }
+  else if (c == floatN)
+    {
+      /* avoid dangling else.  */
+      return makeIntrinsicUnaryType (decl_float, n, realN);
+    }
+  else if (c == truncN)
+    {
+      /* avoid dangling else.  */
+      return makeIntrinsicUnaryType (decl_trunc, n, integerN);
+    }
+  else if (c == ordN)
+    {
+      /* avoid dangling else.  */
+      return makeIntrinsicUnaryType (decl_ord, n, cardinalN);
+    }
+  else if (c == chrN)
+    {
+      /* avoid dangling else.  */
+      return makeIntrinsicUnaryType (decl_chr, n, charN);
+    }
+  else if (c == capN)
+    {
+      /* avoid dangling else.  */
+      return makeIntrinsicUnaryType (decl_cap, n, charN);
+    }
+  else if (c == absN)
+    {
+      /* avoid dangling else.  */
+      return makeIntrinsicUnaryType (decl_abs, n, static_cast<decl_node__opaque> (NULL));
+    }
+  else if (c == imN)
+    {
+      /* avoid dangling else.  */
+      return makeIntrinsicUnaryType (decl_im, n, static_cast<decl_node__opaque> (NULL));
+    }
+  else if (c == reN)
+    {
+      /* avoid dangling else.  */
+      return makeIntrinsicUnaryType (decl_re, n, static_cast<decl_node__opaque> (NULL));
+    }
+  else if (c == cmplxN)
+    {
+      /* avoid dangling else.  */
+      return makeIntrinsicBinaryType (decl_cmplx, n, static_cast<decl_node__opaque> (NULL));
+    }
+  else if (c == highN)
+    {
+      /* avoid dangling else.  */
+      return makeIntrinsicUnaryType (decl_high, n, cardinalN);
+    }
+  else if (c == incN)
+    {
+      /* avoid dangling else.  */
+      return makeIntrinsicProc (decl_inc, expListLen (n), n);
+    }
+  else if (c == decN)
+    {
+      /* avoid dangling else.  */
+      return makeIntrinsicProc (decl_dec, expListLen (n), n);
+    }
+  else if (c == inclN)
+    {
+      /* avoid dangling else.  */
+      return makeIntrinsicProc (decl_incl, expListLen (n), n);
+    }
+  else if (c == exclN)
+    {
+      /* avoid dangling else.  */
+      return makeIntrinsicProc (decl_excl, expListLen (n), n);
+    }
+  else if (c == newN)
+    {
+      /* avoid dangling else.  */
+      return makeIntrinsicProc (decl_new, 1, n);
+    }
+  else if (c == disposeN)
+    {
+      /* avoid dangling else.  */
+      return makeIntrinsicProc (decl_dispose, 1, n);
+    }
+  else if (c == lengthN)
+    {
+      /* avoid dangling else.  */
+      return makeIntrinsicUnaryType (decl_length, n, cardinalN);
+    }
+  else if (c == throwN)
+    {
+      /* avoid dangling else.  */
+      keyc_useThrow ();
+      return makeIntrinsicProc (decl_throw, 1, n);
+    }
+  return static_cast<decl_node__opaque> (NULL);
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
 
 
 /*
-   export - export node, n, from definition module, d.
+   checkCHeaders - check to see if the function is a C system function and
+                   requires a header file included.
 */
 
-static void export_ (decl_node d, decl_node n)
+static void checkCHeaders (decl_node__opaque c)
 {
-  mcDebug_assert (decl_isDef (d));
-  Indexing_IncludeIndiceIntoIndex (d->defF.exported, reinterpret_cast<void *> (n));
+  nameKey_Name name;
+  decl_node__opaque s;
+
+  if (decl_isProcedure (static_cast<decl_node> (c)))
+    {
+      s = static_cast<decl_node__opaque> (decl_getScope (static_cast<decl_node> (c)));
+      if ((decl_getSymName (static_cast<decl_node> (s))) == (nameKey_makeKey ((const char *) "libc", 4)))
+        {
+          name = decl_getSymName (static_cast<decl_node> (c));
+          if ((((name == (nameKey_makeKey ((const char *) "read", 4))) || (name == (nameKey_makeKey ((const char *) "write", 5)))) || (name == (nameKey_makeKey ((const char *) "open", 4)))) || (name == (nameKey_makeKey ((const char *) "close", 5))))
+            {
+              keyc_useUnistd ();
+            }
+        }
+    }
 }
 
 
 /*
-   addToScope - adds node, n, to the current scope and returns, n.
+   isFuncCall - returns TRUE if, n, is a function/procedure call.
 */
 
-static decl_node addToScope (decl_node n)
+static bool isFuncCall (decl_node__opaque n)
 {
-  decl_node s;
-  unsigned int i;
-
-  i = Indexing_HighIndice (scopeStack);
-  s = static_cast<decl_node> (Indexing_GetIndice (scopeStack, i));
-  if (decl_isProcedure (s))
-    {
-      if (debugDecl)
-        {
-          outText (doP, (const char *) "adding ", 7);
-          doNameC (doP, n);
-          outText (doP, (const char *) " to procedure\\n", 15);
-        }
-      return addTo (&s->procedureF.decls, n);
-    }
-  else if (decl_isModule (s))
-    {
-      /* avoid dangling else.  */
-      if (debugDecl)
-        {
-          outText (doP, (const char *) "adding ", 7);
-          doNameC (doP, n);
-          outText (doP, (const char *) " to module\\n", 12);
-        }
-      return addTo (&s->moduleF.decls, n);
-    }
-  else if (decl_isDef (s))
-    {
-      /* avoid dangling else.  */
-      if (debugDecl)
-        {
-          outText (doP, (const char *) "adding ", 7);
-          doNameC (doP, n);
-          outText (doP, (const char *) " to definition module\\n", 23);
-        }
-      export_ (s, n);
-      return addTo (&s->defF.decls, n);
-    }
-  else if (decl_isImp (s))
-    {
-      /* avoid dangling else.  */
-      if (debugDecl)
-        {
-          outText (doP, (const char *) "adding ", 7);
-          doNameC (doP, n);
-          outText (doP, (const char *) " to implementation module\\n", 27);
-        }
-      return addTo (&s->impF.decls, n);
-    }
-  M2RTS_HALT (-1);
-  __builtin_unreachable ();
-  ReturnException ("../../gcc/m2/mc/decl.def", 20, 1);
+  mcDebug_assert (n != NULL);
+  return n->kind == decl_funccall;
+  /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
 
 
 /*
-   addModuleToScope - adds module, i, to module, m, scope.
+   putTypeInternal - marks type, des, as being an internally generated type.
 */
 
-static void addModuleToScope (decl_node m, decl_node i)
+static void putTypeInternal (decl_node__opaque des)
 {
-  mcDebug_assert ((decl_getDeclScope ()) == m);
-  if ((decl_lookupSym (decl_getSymName (i))) == NULL)
-    {
-      i = addToScope (i);
-    }
+  mcDebug_assert (des != NULL);
+  mcDebug_assert (decl_isType (static_cast<decl_node> (des)));
+  des->typeF.isInternal = true;
 }
 
 
 /*
-   completedEnum - assign boolean enumsComplete to TRUE if a definition,
-                   implementation or module symbol.
+   isTypeInternal - returns TRUE if type, n, is internal.
 */
 
-static void completedEnum (decl_node n)
+static bool isTypeInternal (decl_node__opaque n)
 {
-  mcDebug_assert (((decl_isDef (n)) || (decl_isImp (n))) || (decl_isModule (n)));
-  if (decl_isDef (n))
-    {
-      n->defF.enumsComplete = true;
-    }
-  else if (decl_isImp (n))
-    {
-      /* avoid dangling else.  */
-      n->impF.enumsComplete = true;
-    }
-  else if (decl_isModule (n))
-    {
-      /* avoid dangling else.  */
-      n->moduleF.enumsComplete = true;
-    }
+  mcDebug_assert (n != NULL);
+  mcDebug_assert (decl_isType (static_cast<decl_node> (n)));
+  return n->typeF.isInternal;
+  /* static analysis guarentees a RETURN statement will be used before here.  */
+  __builtin_unreachable ();
 }
 
 
 /*
-   setUnary - sets a unary node to contain, arg, a, and type, t.
+   lookupBase - return node named n from the base symbol scope.
 */
 
-static void setUnary (decl_node u, decl_nodeT k, decl_node a, decl_node t)
+static decl_node__opaque lookupBase (nameKey_Name n)
 {
-  switch (k)
-    {
-      case decl_constexp:
-      case decl_deref:
-      case decl_chr:
-      case decl_cap:
-      case decl_abs:
-      case decl_float:
-      case decl_trunc:
-      case decl_ord:
-      case decl_high:
-      case decl_throw:
-      case decl_re:
-      case decl_im:
-      case decl_not:
-      case decl_neg:
-      case decl_adr:
-      case decl_size:
-      case decl_tsize:
-      case decl_min:
-      case decl_max:
-        u->kind = k;
-        u->unaryF.arg = a;
-        u->unaryF.resultType = t;
-        break;
+  decl_node__opaque m;
 
-
-      default:
-        CaseException ("../../gcc/m2/mc/decl.def", 20, 1);
-        __builtin_unreachable ();
+  m = static_cast<decl_node__opaque> (symbolKey_getSymKey (baseSymbols, n));
+  if (m == procN)
+    {
+      keyc_useProc ();
     }
-}
-
-
-/*
-   putVarBool - assigns the four booleans associated with a variable.
-*/
-
-static void putVarBool (decl_node v, bool init, bool param, bool isvar, bool isused)
-{
-  mcDebug_assert (decl_isVar (v));
-  v->varF.isInitialised = init;
-  v->varF.isParameter = param;
-  v->varF.isVarParameter = isvar;
-  v->varF.isUsed = isused;
-}
-
-
-/*
-   checkPtr - in C++ we need to create a typedef for a pointer
-              in case we need to use reinterpret_cast.
-*/
-
-static decl_node checkPtr (decl_node n)
-{
-  DynamicStrings_String s;
-  decl_node p;
-
-  if (lang == decl_ansiCP)
+  else if (((m == complexN) || (m == longcomplexN)) || (m == shortcomplexN))
     {
-      if (decl_isPointer (n))
-        {
-          s = tempName ();
-          p = decl_makeType (nameKey_makekey (DynamicStrings_string (s)));
-          decl_putType (p, n);
-          s = DynamicStrings_KillString (s);
-          return p;
-        }
+      /* avoid dangling else.  */
+      keyc_useComplex ();
     }
-  return n;
+  return m;
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
 
 
 /*
-   isVarDecl - returns TRUE if, n, is a vardecl node.
+   dumpScopes - display the names of all the scopes stacked.
 */
 
-static bool isVarDecl (decl_node n)
+static void dumpScopes (void)
 {
-  return n->kind == decl_vardecl;
-  /* static analysis guarentees a RETURN statement will be used before here.  */
-  __builtin_unreachable ();
+  unsigned int h;
+  decl_node__opaque s;
+
+  h = Indexing_HighIndice (scopeStack);
+  libc_printf ((const char *) "total scopes stacked %d\\n", 25, h);
+  while (h >= 1)
+    {
+      s = static_cast<decl_node__opaque> (Indexing_GetIndice (scopeStack, h));
+      out2 ((const char *) " scope [%d] is %s\\n", 19, h, s);
+      h -= 1;
+    }
 }
 
 
 /*
-   makeVariablesFromParameters - creates variables which are really parameters.
+   out0 - write string a to StdOut.
 */
 
-static void makeVariablesFromParameters (decl_node proc, decl_node id, decl_node type, bool isvar, bool isused)
+static void out0 (const char *a_, unsigned int _a_high)
 {
-  decl_node v;
-  unsigned int i;
-  unsigned int n;
-  nameKey_Name m;
-  DynamicStrings_String s;
+  DynamicStrings_String m;
+  char a[_a_high+1];
 
-  mcDebug_assert (decl_isProcedure (proc));
-  mcDebug_assert (isIdentList (id));
-  i = 1;
-  n = wlists_noOfItemsInList (id->identlistF.names);
-  while (i <= n)
-    {
-      m = static_cast<nameKey_Name> (wlists_getItemFromList (id->identlistF.names, i));
-      v = decl_makeVar (m);
-      decl_putVar (v, type, NULL);
-      putVarBool (v, true, true, isvar, isused);
-      if (debugScopes)
-        {
-          libc_printf ((const char *) "adding parameter variable into top scope\\n", 42);
-          dumpScopes ();
-          libc_printf ((const char *) " variable name is: ", 19);
-          s = DynamicStrings_InitStringCharStar (nameKey_keyToCharStar (m));
-          if ((DynamicStrings_KillString (SFIO_WriteS (FIO_StdOut, s))) == NULL)
-            {}  /* empty.  */
-          libc_printf ((const char *) "\\n", 2);
-        }
-      i += 1;
-    }
+  /* make a local copy of each unbounded array.  */
+  memcpy (a, a_, _a_high+1);
+
+  m = FormatStrings_Sprintf0 (DynamicStrings_InitString ((const char *) a, _a_high));
+  m = DynamicStrings_KillString (SFIO_WriteS (FIO_StdOut, m));
 }
 
 
 /*
-   addProcedureToScope - add a procedure name n and node d to the
-                         current scope.
+   out1 - write string a to StdOut using format specifier a.
 */
 
-static decl_node addProcedureToScope (decl_node d, nameKey_Name n)
+static void out1 (const char *a_, unsigned int _a_high, decl_node__opaque s)
 {
-  decl_node m;
-  unsigned int i;
+  DynamicStrings_String m;
+  unsigned int d;
+  char a[_a_high+1];
 
-  i = Indexing_HighIndice (scopeStack);
-  m = static_cast<decl_node> (Indexing_GetIndice (scopeStack, i));
-  if (((decl_isDef (m)) && ((decl_getSymName (m)) == (nameKey_makeKey ((const char *) "M2RTS", 5)))) && ((decl_getSymName (d)) == (nameKey_makeKey ((const char *) "HALT", 4))))
+  /* make a local copy of each unbounded array.  */
+  memcpy (a, a_, _a_high+1);
+
+  m = getFQstring (s);
+  if (DynamicStrings_EqualArray (m, (const char *) "", 0))
     {
-      haltN = d;
-      symbolKey_putSymKey (baseSymbols, n, reinterpret_cast<void *> (haltN));
+      d = (unsigned int ) ((long unsigned int ) (s));
+      m = DynamicStrings_KillString (m);
+      m = FormatStrings_Sprintf1 (DynamicStrings_InitString ((const char *) "[%d]", 4), (const unsigned char *) &d, (sizeof (d)-1));
     }
-  return addToScope (d);
-  /* static analysis guarentees a RETURN statement will be used before here.  */
-  __builtin_unreachable ();
+  m = FormatStrings_Sprintf1 (DynamicStrings_InitString ((const char *) a, _a_high), (const unsigned char *) &m, (sizeof (m)-1));
+  m = DynamicStrings_KillString (SFIO_WriteS (FIO_StdOut, m));
 }
 
 
 /*
-   putProcTypeReturn - sets the return type of, proc, to, type.
+   out2 - write string a to StdOut using format specifier a.
 */
 
-static void putProcTypeReturn (decl_node proc, decl_node type)
+static void out2 (const char *a_, unsigned int _a_high, unsigned int c, decl_node__opaque s)
 {
-  mcDebug_assert (decl_isProcType (proc));
-  proc->proctypeF.returnType = type;
-}
-
+  DynamicStrings_String m;
+  DynamicStrings_String m1;
+  char a[_a_high+1];
 
-/*
-   putProcTypeOptReturn - sets, proc, to have an optional return type.
-*/
+  /* make a local copy of each unbounded array.  */
+  memcpy (a, a_, _a_high+1);
 
-static void putProcTypeOptReturn (decl_node proc)
-{
-  mcDebug_assert (decl_isProcType (proc));
-  proc->proctypeF.returnopt = true;
+  m1 = getString (s);
+  m = FormatStrings_Sprintf2 (DynamicStrings_InitString ((const char *) a, _a_high), (const unsigned char *) &c, (sizeof (c)-1), (const unsigned char *) &m1, (sizeof (m1)-1));
+  m = DynamicStrings_KillString (SFIO_WriteS (FIO_StdOut, m));
+  m1 = DynamicStrings_KillString (m1);
 }
 
 
 /*
-   makeOptParameter - creates and returns an optarg.
+   out3 - write string a to StdOut using format specifier a.
 */
 
-static decl_node makeOptParameter (decl_node l, decl_node type, decl_node init)
+static void out3 (const char *a_, unsigned int _a_high, unsigned int l, nameKey_Name n, decl_node__opaque s)
 {
-  decl_node n;
+  DynamicStrings_String m;
+  DynamicStrings_String m1;
+  DynamicStrings_String m2;
+  char a[_a_high+1];
 
-  n = newNode (decl_optarg);
-  n->optargF.namelist = l;
-  n->optargF.type = type;
-  n->optargF.init = init;
-  n->optargF.scope = NULL;
-  return n;
-  /* static analysis guarentees a RETURN statement will be used before here.  */
-  __builtin_unreachable ();
+  /* make a local copy of each unbounded array.  */
+  memcpy (a, a_, _a_high+1);
+
+  m1 = DynamicStrings_InitStringCharStar (nameKey_keyToCharStar (n));
+  m2 = getString (s);
+  m = FormatStrings_Sprintf3 (DynamicStrings_InitString ((const char *) a, _a_high), (const unsigned char *) &l, (sizeof (l)-1), (const unsigned char *) &m1, (sizeof (m1)-1), (const unsigned char *) &m2, (sizeof (m2)-1));
+  m = DynamicStrings_KillString (SFIO_WriteS (FIO_StdOut, m));
+  m1 = DynamicStrings_KillString (m1);
+  m2 = DynamicStrings_KillString (m2);
 }
 
 
 /*
-   setwatch - assign the globalNode to n.
+   isUnary - returns TRUE if, n, is an unary node.
 */
 
-static bool setwatch (decl_node n)
+static bool isUnary (decl_node__opaque n)
 {
-  globalNode = n;
-  return true;
-  /* static analysis guarentees a RETURN statement will be used before here.  */
-  __builtin_unreachable ();
-}
-
+  mcDebug_assert (n != NULL);
+  switch (n->kind)
+    {
+      case decl_length:
+      case decl_re:
+      case decl_im:
+      case decl_deref:
+      case decl_high:
+      case decl_chr:
+      case decl_cap:
+      case decl_abs:
+      case decl_ord:
+      case decl_float:
+      case decl_trunc:
+      case decl_constexp:
+      case decl_not:
+      case decl_neg:
+      case decl_adr:
+      case decl_size:
+      case decl_tsize:
+      case decl_min:
+      case decl_max:
+        return true;
+        break;
 
-/*
-   runwatch - set the globalNode to an identlist.
-*/
 
-static bool runwatch (void)
-{
-  return globalNode->kind == decl_identlist;
+      default:
+        return false;
+        break;
+    }
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
 
 
 /*
-   isIdentList - returns TRUE if, n, is an identlist.
+   isBinary - returns TRUE if, n, is an binary node.
 */
 
-static bool isIdentList (decl_node n)
+static bool isBinary (decl_node__opaque n)
 {
-  return n->kind == decl_identlist;
+  mcDebug_assert (n != NULL);
+  switch (n->kind)
+    {
+      case decl_cmplx:
+      case decl_and:
+      case decl_or:
+      case decl_equal:
+      case decl_notequal:
+      case decl_less:
+      case decl_greater:
+      case decl_greequal:
+      case decl_lessequal:
+      case decl_val:
+      case decl_cast:
+      case decl_plus:
+      case decl_sub:
+      case decl_div:
+      case decl_mod:
+      case decl_mult:
+      case decl_divide:
+      case decl_in:
+        return true;
+        break;
+
+
+      default:
+        return false;
+        break;
+    }
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
 
 
 /*
-   identListLen - returns the length of identlist.
+   makeUnary - create a unary expression node with, e, as the argument
+               and res as the return type.
 */
 
-static unsigned int identListLen (decl_node n)
+static decl_node__opaque makeUnary (decl_nodeT k, decl_node__opaque e, decl_node__opaque res)
 {
-  if (n == NULL)
+  decl_node__opaque n;
+
+  if (k == decl_plus)
     {
-      return 0;
+      return e;
     }
   else
     {
-      mcDebug_assert (isIdentList (n));
-      return wlists_noOfItemsInList (n->identlistF.names);
+      n = newNode (k);
+      switch (n->kind)
+        {
+          case decl_min:
+          case decl_max:
+          case decl_throw:
+          case decl_re:
+          case decl_im:
+          case decl_deref:
+          case decl_high:
+          case decl_chr:
+          case decl_cap:
+          case decl_abs:
+          case decl_ord:
+          case decl_float:
+          case decl_trunc:
+          case decl_length:
+          case decl_constexp:
+          case decl_not:
+          case decl_neg:
+          case decl_adr:
+          case decl_size:
+          case decl_tsize:
+            n->unaryF.arg = e;
+            n->unaryF.resultType = res;
+            break;
+
+
+          default:
+            CaseException ("../../gcc/m2/mc/decl.def", 20, 1);
+            __builtin_unreachable ();
+        }
     }
+  return n;
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
 
 
 /*
-   checkParameters - placeholder for future parameter checking.
+   isLeafString - returns TRUE if n is a leaf node which is a string constant.
 */
 
-static void checkParameters (decl_node p, decl_node i, decl_node type, bool isvar, bool isused)
+static bool isLeafString (decl_node__opaque n)
 {
-  /* do check.  */
-  disposeNode (&i);
+  return ((isString (n)) || ((decl_isLiteral (static_cast<decl_node> (n))) && ((decl_getType (static_cast<decl_node> (n))) == charN))) || ((decl_isConst (static_cast<decl_node> (n))) && ((getExprType (n)) == charN));
+  /* static analysis guarentees a RETURN statement will be used before here.  */
+  __builtin_unreachable ();
 }
 
 
 /*
-   checkMakeVariables - create shadow local variables for parameters providing that
-                        procedure n has not already been built and we are compiling
-                        a module or an implementation module.
+   getLiteralStringContents - return the contents of a literal node as a string.
 */
 
-static void checkMakeVariables (decl_node n, decl_node i, decl_node type, bool isvar, bool isused)
+static DynamicStrings_String getLiteralStringContents (decl_node__opaque n)
 {
-  if (((decl_isImp (currentModule)) || (decl_isModule (currentModule))) && ! n->procedureF.built)
+  DynamicStrings_String number;
+  DynamicStrings_String content;
+  DynamicStrings_String s;
+
+  mcDebug_assert (n->kind == decl_literal);
+  s = DynamicStrings_InitStringCharStar (nameKey_keyToCharStar (n->literalF.name));
+  content = static_cast<DynamicStrings_String> (NULL);
+  if (n->literalF.type == charN)
     {
-      makeVariablesFromParameters (n, i, type, isvar, isused);
+      if ((DynamicStrings_char (s, -1)) == 'C')
+        {
+          if ((DynamicStrings_Length (s)) > 1)
+            {
+              number = DynamicStrings_Slice (s, 0, -1);
+              content = DynamicStrings_InitStringChar ((char ) (StringConvert_ostoc (number)));
+              number = DynamicStrings_KillString (number);
+            }
+          else
+            {
+              content = DynamicStrings_InitStringChar ('C');
+            }
+        }
+      else
+        {
+          content = DynamicStrings_Dup (s);
+        }
+    }
+  else
+    {
+      mcMetaError_metaError1 ((const char *) "cannot obtain string contents from {%1k}", 40, (const unsigned char *) &n->literalF.name, (sizeof (n->literalF.name)-1));
     }
+  s = DynamicStrings_KillString (s);
+  return content;
+  /* static analysis guarentees a RETURN statement will be used before here.  */
+  __builtin_unreachable ();
 }
 
 
 /*
-   makeVarientField - create a varient field within varient, v,
-                      The new varient field is returned.
+   getStringContents - return the string contents of a constant, literal,
+                       string or a constexp node.
+*/
+
+static DynamicStrings_String getStringContents (decl_node__opaque n)
+{
+  if (decl_isConst (static_cast<decl_node> (n)))
+    {
+      return getStringContents (n->constF.value);
+    }
+  else if (decl_isLiteral (static_cast<decl_node> (n)))
+    {
+      /* avoid dangling else.  */
+      return getLiteralStringContents (n);
+    }
+  else if (isString (n))
+    {
+      /* avoid dangling else.  */
+      return getString (n);
+    }
+  else if (isConstExp (n))
+    {
+      /* avoid dangling else.  */
+      return getStringContents (n->unaryF.arg);
+    }
+  M2RTS_HALT (-1);
+  __builtin_unreachable ();
+  ReturnException ("../../gcc/m2/mc/decl.def", 20, 1);
+  __builtin_unreachable ();
+}
+
+
+/*
+   addNames -
 */
 
-static decl_node makeVarientField (decl_node v, decl_node p)
+static nameKey_Name addNames (decl_node__opaque a, decl_node__opaque b)
 {
-  decl_node n;
+  DynamicStrings_String sa;
+  DynamicStrings_String sb;
+  nameKey_Name n;
 
-  n = newNode (decl_varientfield);
-  n->varientfieldF.name = nameKey_NulName;
-  n->varientfieldF.parent = p;
-  n->varientfieldF.varient = v;
-  n->varientfieldF.simple = false;
-  n->varientfieldF.listOfSons = Indexing_InitIndex (1);
-  n->varientfieldF.scope = decl_getDeclScope ();
+  sa = DynamicStrings_InitStringCharStar (nameKey_keyToCharStar (decl_getSymName (static_cast<decl_node> (a))));
+  sb = DynamicStrings_InitStringCharStar (nameKey_keyToCharStar (decl_getSymName (static_cast<decl_node> (b))));
+  sa = DynamicStrings_ConCat (sa, sb);
+  n = nameKey_makekey (DynamicStrings_string (sa));
+  sa = DynamicStrings_KillString (sa);
+  sb = DynamicStrings_KillString (sb);
   return n;
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
@@ -7557,102 +7490,52 @@ static decl_node makeVarientField (decl_node v, decl_node p)
 
 
 /*
-   putFieldVarient - places the field varient, f, as a brother to, the
-                     varient symbol, v, and also tells, f, that its varient
-                     parent is, v.
+   resolveString -
 */
 
-static void putFieldVarient (decl_node f, decl_node v)
+static decl_node__opaque resolveString (decl_node__opaque n)
 {
-  mcDebug_assert (decl_isVarient (v));
-  mcDebug_assert (decl_isVarientField (f));
-  switch (v->kind)
+  while ((decl_isConst (static_cast<decl_node> (n))) || (isConstExp (n)))
     {
-      case decl_varient:
-        Indexing_IncludeIndiceIntoIndex (v->varientF.listOfSons, reinterpret_cast<void *> (f));
-        break;
-
-
-      default:
-        CaseException ("../../gcc/m2/mc/decl.def", 20, 1);
-        __builtin_unreachable ();
+      if (decl_isConst (static_cast<decl_node> (n)))
+        {
+          n = n->constF.value;
+        }
+      else
+        {
+          n = n->unaryF.arg;
+        }
     }
-  switch (f->kind)
+  if (n->kind == decl_plus)
     {
-      case decl_varientfield:
-        f->varientfieldF.varient = v;
-        break;
-
-
-      default:
-        CaseException ("../../gcc/m2/mc/decl.def", 20, 1);
-        __builtin_unreachable ();
+      n = static_cast<decl_node__opaque> (decl_makeString (addNames (resolveString (n->binaryF.left), resolveString (n->binaryF.right))));
     }
+  return n;
+  /* static analysis guarentees a RETURN statement will be used before here.  */
+  __builtin_unreachable ();
 }
 
 
 /*
-   putFieldRecord - create a new recordfield and place it into record r.
-                    The new field has a tagname and type and can have a
-                    variant field v.
+   foldBinary -
 */
 
-static decl_node putFieldRecord (decl_node r, nameKey_Name tag, decl_node type, decl_node v)
+static decl_node__opaque foldBinary (decl_nodeT k, decl_node__opaque l, decl_node__opaque r, decl_node__opaque res)
 {
-  decl_node f;
-  decl_node n;
-  decl_node p;
+  decl_node__opaque n;
+  DynamicStrings_String ls;
+  DynamicStrings_String rs;
 
-  n = newNode (decl_recordfield);
-  switch (r->kind)
+  n = static_cast<decl_node__opaque> (NULL);
+  if (((k == decl_plus) && (isLeafString (l))) && (isLeafString (r)))
     {
-      case decl_record:
-        Indexing_IncludeIndiceIntoIndex (r->recordF.listOfSons, reinterpret_cast<void *> (n));
-        /* ensure that field, n, is in the parents Local Symbols.  */
-        if (tag != nameKey_NulName)
-          {
-            /* avoid gcc warning by using compound statement even if not strictly necessary.  */
-            if ((symbolKey_getSymKey (r->recordF.localSymbols, tag)) == symbolKey_NulKey)
-              {
-                symbolKey_putSymKey (r->recordF.localSymbols, tag, reinterpret_cast<void *> (n));
-              }
-            else
-              {
-                f = static_cast<decl_node> (symbolKey_getSymKey (r->recordF.localSymbols, tag));
-                mcMetaError_metaErrors1 ((const char *) "field record {%1Dad} has already been declared", 46, (const char *) "field record duplicate", 22, (const unsigned char *) &f, (sizeof (f)-1));
-              }
-          }
-        break;
-
-      case decl_varientfield:
-        Indexing_IncludeIndiceIntoIndex (r->varientfieldF.listOfSons, reinterpret_cast<void *> (n));
-        p = getParent (r);
-        mcDebug_assert (p->kind == decl_record);
-        if (tag != nameKey_NulName)
-          {
-            symbolKey_putSymKey (p->recordF.localSymbols, tag, reinterpret_cast<void *> (n));
-          }
-        break;
-
-
-      default:
-        CaseException ("../../gcc/m2/mc/decl.def", 20, 1);
-        __builtin_unreachable ();
+      ls = getStringContents (l);
+      rs = getStringContents (r);
+      ls = DynamicStrings_Add (ls, rs);
+      n = static_cast<decl_node__opaque> (decl_makeString (nameKey_makekey (DynamicStrings_string (ls))));
+      ls = DynamicStrings_KillString (ls);
+      rs = DynamicStrings_KillString (rs);
     }
-  /* fill in, n.  */
-  n->recordfieldF.type = type;
-  n->recordfieldF.name = tag;
-  n->recordfieldF.parent = r;
-  n->recordfieldF.varient = v;
-  n->recordfieldF.tag = false;
-  n->recordfieldF.scope = NULL;
-  initCname (&n->recordfieldF.cname);
-  /* 
-   IF r^.kind=record
-   THEN
-      doRecordM2 (doP, r)
-   END ;
-  */
   return n;
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
@@ -7660,60 +7543,57 @@ static decl_node putFieldRecord (decl_node r, nameKey_Name tag, decl_node type,
 
 
 /*
-   ensureOrder - ensures that, a, and, b, exist in, i, and also
-                 ensure that, a, is before, b.
+   makeBinary - create a binary node with left/right/result type:  l, r and resultType.
 */
 
-static void ensureOrder (Indexing_Index i, decl_node a, decl_node b)
+static decl_node__opaque makeBinary (decl_nodeT k, decl_node__opaque l, decl_node__opaque r, decl_node__opaque resultType)
 {
-  mcDebug_assert (Indexing_IsIndiceInIndex (i, reinterpret_cast<void *> (a)));
-  mcDebug_assert (Indexing_IsIndiceInIndex (i, reinterpret_cast<void *> (b)));
-  Indexing_RemoveIndiceFromIndex (i, reinterpret_cast<void *> (a));
-  Indexing_RemoveIndiceFromIndex (i, reinterpret_cast<void *> (b));
-  Indexing_IncludeIndiceIntoIndex (i, reinterpret_cast<void *> (a));
-  Indexing_IncludeIndiceIntoIndex (i, reinterpret_cast<void *> (b));
-  mcDebug_assert (Indexing_IsIndiceInIndex (i, reinterpret_cast<void *> (a)));
-  mcDebug_assert (Indexing_IsIndiceInIndex (i, reinterpret_cast<void *> (b)));
+  decl_node__opaque n;
+
+  n = foldBinary (k, l, r, resultType);
+  if (n == NULL)
+    {
+      n = doMakeBinary (k, l, r, resultType);
+    }
+  return n;
+  /* static analysis guarentees a RETURN statement will be used before here.  */
+  __builtin_unreachable ();
 }
 
 
 /*
-   putVarientTag - places tag into variant v.
+   doMakeBinary - returns a binary node containing left/right/result values
+                  l, r, res, with a node operator, k.
 */
 
-static void putVarientTag (decl_node v, decl_node tag)
+static decl_node__opaque doMakeBinary (decl_nodeT k, decl_node__opaque l, decl_node__opaque r, decl_node__opaque res)
 {
-  decl_node p;
+  decl_node__opaque n;
 
-  mcDebug_assert (decl_isVarient (v));
-  switch (v->kind)
+  n = newNode (k);
+  switch (n->kind)
     {
-      case decl_varient:
-        v->varientF.tag = tag;
-        break;
-
-
-      default:
-        CaseException ("../../gcc/m2/mc/decl.def", 20, 1);
-        __builtin_unreachable ();
-    }
-}
-
-
-/*
-   getParent - returns the parent field of recordfield or varientfield symbol, n.
-*/
-
-static decl_node getParent (decl_node n)
-{
-  switch (n->kind)
-    {
-      case decl_recordfield:
-        return n->recordfieldF.parent;
-        break;
-
-      case decl_varientfield:
-        return n->varientfieldF.parent;
+      case decl_cmplx:
+      case decl_equal:
+      case decl_notequal:
+      case decl_less:
+      case decl_greater:
+      case decl_greequal:
+      case decl_lessequal:
+      case decl_and:
+      case decl_or:
+      case decl_cast:
+      case decl_val:
+      case decl_plus:
+      case decl_sub:
+      case decl_div:
+      case decl_mod:
+      case decl_mult:
+      case decl_divide:
+      case decl_in:
+        n->binaryF.left = l;
+        n->binaryF.right = r;
+        n->binaryF.resultType = res;
         break;
 
 
@@ -7721,1673 +7601,1481 @@ static decl_node getParent (decl_node n)
         CaseException ("../../gcc/m2/mc/decl.def", 20, 1);
         __builtin_unreachable ();
     }
+  return n;
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
 
 
 /*
-   getRecord - returns the record associated with node, n.
-               (Parental record).
+   doMakeComponentRef -
 */
 
-static decl_node getRecord (decl_node n)
+static decl_node__opaque doMakeComponentRef (decl_node__opaque rec, decl_node__opaque field)
 {
-  mcDebug_assert (n->kind != decl_varient);  /* if this fails then we need to add parent field to varient.  */
-  switch (n->kind)
-    {
-      case decl_record:
-        return n;  /* if this fails then we need to add parent field to varient.  */
-        break;
-
-      case decl_varientfield:
-        return getRecord (getParent (n));
-        break;
-
+  decl_node__opaque n;
 
-      default:
-        CaseException ("../../gcc/m2/mc/decl.def", 20, 1);
-        __builtin_unreachable ();
-    }
+  n = newNode (decl_componentref);
+  n->componentrefF.rec = rec;
+  n->componentrefF.field = field;
+  n->componentrefF.resultType = static_cast<decl_node__opaque> (decl_getType (static_cast<decl_node> (field)));
+  initNodeOpaqueState (n);
+  return n;
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
 
 
 /*
-   isConstExp - return TRUE if the node kind is a constexp.
+   isComponentRef -
 */
 
-static bool isConstExp (decl_node c)
+static bool isComponentRef (decl_node__opaque n)
 {
-  mcDebug_assert (c != NULL);
-  return c->kind == decl_constexp;
+  mcDebug_assert (n != NULL);
+  return n->kind == decl_componentref;
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
 
 
 /*
-   addEnumToModule - adds enumeration type, e, into the list of enums
-                     in module, m.
-*/
-
-static void addEnumToModule (decl_node m, decl_node e)
-{
-  mcDebug_assert ((decl_isEnumeration (e)) || (decl_isEnumerationField (e)));
-  mcDebug_assert (((decl_isModule (m)) || (decl_isDef (m))) || (decl_isImp (m)));
-  if (decl_isModule (m))
-    {
-      Indexing_IncludeIndiceIntoIndex (m->moduleF.enumFixup.info, reinterpret_cast<void *> (e));
-    }
-  else if (decl_isDef (m))
-    {
-      /* avoid dangling else.  */
-      Indexing_IncludeIndiceIntoIndex (m->defF.enumFixup.info, reinterpret_cast<void *> (e));
-    }
-  else if (decl_isImp (m))
-    {
-      /* avoid dangling else.  */
-      Indexing_IncludeIndiceIntoIndex (m->impF.enumFixup.info, reinterpret_cast<void *> (e));
-    }
-}
-
-
-/*
-   getNextFixup - return the next fixup from from f.
+   isArrayRef - returns TRUE if the node was an arrayref.
 */
 
-static decl_node getNextFixup (decl_fixupInfo *f)
+static bool isArrayRef (decl_node__opaque n)
 {
-  (*f).count += 1;
-  return static_cast<decl_node> (Indexing_GetIndice ((*f).info, (*f).count));
+  mcDebug_assert (n != NULL);
+  return n->kind == decl_arrayref;
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
 
 
 /*
-   doMakeEnum - create an enumeration type and add it to the current module.
+   isDeref - returns TRUE if, n, is a deref node.
 */
 
-static decl_node doMakeEnum (void)
+static bool isDeref (decl_node__opaque n)
 {
-  decl_node e;
-
-  e = newNode (decl_enumeration);
-  e->enumerationF.noOfElements = 0;
-  e->enumerationF.localSymbols = symbolKey_initTree ();
-  e->enumerationF.scope = decl_getDeclScope ();
-  e->enumerationF.listOfSons = Indexing_InitIndex (1);
-  e->enumerationF.low = NULL;
-  e->enumerationF.high = NULL;
-  addEnumToModule (currentModule, e);
-  return e;
+  mcDebug_assert (n != NULL);
+  return n->kind == decl_deref;
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
 
 
 /*
-   doMakeEnumField - create an enumeration field name and add it to enumeration e.
-                     Return the new field.
+   makeBase - create a base type or constant.
+              It only supports the base types and constants
+              enumerated below.
 */
 
-static decl_node doMakeEnumField (decl_node e, nameKey_Name n)
+static decl_node__opaque makeBase (decl_nodeT k)
 {
-  decl_node f;
+  decl_node__opaque n;
 
-  mcDebug_assert (decl_isEnumeration (e));
-  f = decl_lookupSym (n);
-  if (f == NULL)
-    {
-      f = newNode (decl_enumerationfield);
-      symbolKey_putSymKey (e->enumerationF.localSymbols, n, reinterpret_cast<void *> (f));
-      Indexing_IncludeIndiceIntoIndex (e->enumerationF.listOfSons, reinterpret_cast<void *> (f));
-      f->enumerationfieldF.name = n;
-      f->enumerationfieldF.type = e;
-      f->enumerationfieldF.scope = decl_getDeclScope ();
-      f->enumerationfieldF.value = e->enumerationF.noOfElements;
-      initCname (&f->enumerationfieldF.cname);
-      e->enumerationF.noOfElements += 1;
-      mcDebug_assert ((Indexing_GetIndice (e->enumerationF.listOfSons, e->enumerationF.noOfElements)) == f);
-      addEnumToModule (currentModule, f);
-      if (e->enumerationF.low == NULL)
-        {
-          e->enumerationF.low = f;
-        }
-      e->enumerationF.high = f;
-      return addToScope (f);
-    }
-  else
+  n = newNode (k);
+  switch (k)
     {
-      mcMetaError_metaErrors2 ((const char *) "cannot create enumeration field {%1k} as the name is already in use", 67, (const char *) "{%2DMad} was declared elsewhere", 31, (const unsigned char *) &n, (sizeof (n)-1), (const unsigned char *) &f, (sizeof (f)-1));
+      case decl_new:
+      case decl_dispose:
+      case decl_length:
+      case decl_inc:
+      case decl_dec:
+      case decl_incl:
+      case decl_excl:
+      case decl_nil:
+      case decl_true:
+      case decl_false:
+      case decl_address:
+      case decl_loc:
+      case decl_byte:
+      case decl_word:
+      case decl_csizet:
+      case decl_cssizet:
+      case decl_char:
+      case decl_cardinal:
+      case decl_longcard:
+      case decl_shortcard:
+      case decl_integer:
+      case decl_longint:
+      case decl_shortint:
+      case decl_real:
+      case decl_longreal:
+      case decl_shortreal:
+      case decl_bitset:
+      case decl_boolean:
+      case decl_proc:
+      case decl_ztype:
+      case decl_rtype:
+      case decl_complex:
+      case decl_longcomplex:
+      case decl_shortcomplex:
+      case decl_adr:
+      case decl_chr:
+      case decl_cap:
+      case decl_abs:
+      case decl_float:
+      case decl_trunc:
+      case decl_ord:
+      case decl_high:
+      case decl_throw:
+      case decl_re:
+      case decl_im:
+      case decl_cmplx:
+      case decl_size:
+      case decl_tsize:
+      case decl_val:
+      case decl_min:
+      case decl_max:
+        break;
+
+
+      default:
+        M2RTS_HALT (-1);  /* legal kind.  */
+        __builtin_unreachable ();
+        break;
     }
-  return f;
+  return n;
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
 
 
 /*
-   getExpList - returns the, n, th argument in an explist.
+   isOrdinal - returns TRUE if, n, is an ordinal type.
 */
 
-static decl_node getExpList (decl_node p, unsigned int n)
+static bool isOrdinal (decl_node__opaque n)
 {
-  mcDebug_assert (p != NULL);
-  mcDebug_assert (decl_isExpList (p));
-  mcDebug_assert (n <= (Indexing_HighIndice (p->explistF.exp)));
-  return static_cast<decl_node> (Indexing_GetIndice (p->explistF.exp, n));
+  switch (n->kind)
+    {
+      case decl_address:
+      case decl_loc:
+      case decl_byte:
+      case decl_word:
+      case decl_csizet:
+      case decl_cssizet:
+      case decl_char:
+      case decl_integer:
+      case decl_longint:
+      case decl_shortint:
+      case decl_cardinal:
+      case decl_longcard:
+      case decl_shortcard:
+      case decl_bitset:
+        return true;
+        break;
+
+
+      default:
+        return false;
+        break;
+    }
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
 
 
 /*
-   expListLen - returns the length of explist, p.
+   mixTypes -
 */
 
-static unsigned int expListLen (decl_node p)
+static decl_node__opaque mixTypes (decl_node__opaque a, decl_node__opaque b)
 {
-  if (p == NULL)
-    {
-      return 0;
-    }
-  else
+  if ((a == addressN) || (b == addressN))
     {
-      mcDebug_assert (decl_isExpList (p));
-      return Indexing_HighIndice (p->explistF.exp);
+      return addressN;
     }
+  return a;
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
 
 
 /*
-   getConstExpComplete - gets the field from the def or imp or module, n.
+   doSetExprType -
 */
 
-static bool getConstExpComplete (decl_node n)
+static decl_node__opaque doSetExprType (decl_node__opaque *t, decl_node__opaque n)
 {
-  switch (n->kind)
+  if ((*t) == NULL)
     {
-      case decl_def:
-        return n->defF.constsComplete;
-        break;
-
-      case decl_imp:
-        return n->impF.constsComplete;
-        break;
-
-      case decl_module:
-        return n->moduleF.constsComplete;
-        break;
-
-
-      default:
-        CaseException ("../../gcc/m2/mc/decl.def", 20, 1);
-        __builtin_unreachable ();
+      (*t) = n;
     }
+  return (*t);
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
 
 
 /*
-   addConstToModule - adds const exp, e, into the list of constant
-                      expressions in module, m.
+   getMaxMinType -
 */
 
-static void addConstToModule (decl_node m, decl_node e)
+static decl_node__opaque getMaxMinType (decl_node__opaque n)
 {
-  mcDebug_assert (((decl_isModule (m)) || (decl_isDef (m))) || (decl_isImp (m)));
-  if (decl_isModule (m))
+  if ((decl_isVar (static_cast<decl_node> (n))) || (decl_isConst (static_cast<decl_node> (n))))
     {
-      Indexing_IncludeIndiceIntoIndex (m->moduleF.constFixup.info, reinterpret_cast<void *> (e));
+      return static_cast<decl_node__opaque> (decl_getType (static_cast<decl_node> (n)));
     }
-  else if (decl_isDef (m))
+  else if (isConstExp (n))
     {
       /* avoid dangling else.  */
-      Indexing_IncludeIndiceIntoIndex (m->defF.constFixup.info, reinterpret_cast<void *> (e));
+      n = getExprType (n->unaryF.arg);
+      if (n == bitsetN)
+        {
+          return ztypeN;
+        }
+      else
+        {
+          return n;
+        }
     }
-  else if (decl_isImp (m))
+  else
     {
       /* avoid dangling else.  */
-      Indexing_IncludeIndiceIntoIndex (m->impF.constFixup.info, reinterpret_cast<void *> (e));
+      return n;
     }
+  /* static analysis guarentees a RETURN statement will be used before here.  */
+  __builtin_unreachable ();
 }
 
 
 /*
-   doMakeConstExp - create a constexp node and add it to the current module.
+   doGetFuncType -
 */
 
-static decl_node doMakeConstExp (void)
+static decl_node__opaque doGetFuncType (decl_node__opaque n)
 {
-  decl_node c;
+  decl_node__opaque result;
 
-  c = makeUnary (decl_constexp, NULL, NULL);
-  addConstToModule (currentModule, c);
-  return c;
+  mcDebug_assert (isFuncCall (n));
+  result = doSetExprType (&n->funccallF.type, static_cast<decl_node__opaque> (decl_getType (static_cast<decl_node> (n->funccallF.function))));
+  initNodeOpaqueState (n);  /* Update now that the return type is known.  */
+  return result;  /* Update now that the return type is known.  */
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
 
 
 /*
-   isAnyType - return TRUE if node n is any type kind.
+   doGetExprType - works out the type which is associated with node, n.
 */
 
-static bool isAnyType (decl_node n)
+static decl_node__opaque doGetExprType (decl_node__opaque n)
 {
-  mcDebug_assert (n != NULL);
   switch (n->kind)
     {
+      case decl_max:
+      case decl_min:
+        return getMaxMinType (n->unaryF.arg);
+        break;
+
+      case decl_cast:
+      case decl_val:
+        return doSetExprType (&n->binaryF.resultType, n->binaryF.left);
+        break;
+
+      case decl_halt:
+      case decl_new:
+      case decl_dispose:
+        return static_cast<decl_node__opaque> (NULL);
+        break;
+
+      case decl_inc:
+      case decl_dec:
+      case decl_incl:
+      case decl_excl:
+        return static_cast<decl_node__opaque> (NULL);
+        break;
+
+      case decl_nil:
+        return addressN;
+        break;
+
+      case decl_true:
+      case decl_false:
+        return booleanN;
+        break;
+
       case decl_address:
+        return n;
+        break;
+
       case decl_loc:
+        return n;
+        break;
+
       case decl_byte:
+        return n;
+        break;
+
       case decl_word:
+        return n;
+        break;
+
+      case decl_csizet:
+        return n;
+        break;
+
+      case decl_cssizet:
+        return n;
+        break;
+
+      case decl_boolean:
+        /* base types.  */
+        return n;
+        break;
+
+      case decl_proc:
+        return n;
+        break;
+
       case decl_char:
+        return n;
+        break;
+
       case decl_cardinal:
+        return n;
+        break;
+
       case decl_longcard:
+        return n;
+        break;
+
       case decl_shortcard:
+        return n;
+        break;
+
       case decl_integer:
+        return n;
+        break;
+
       case decl_longint:
+        return n;
+        break;
+
       case decl_shortint:
-      case decl_complex:
-      case decl_longcomplex:
-      case decl_shortcomplex:
+        return n;
+        break;
+
+      case decl_real:
+        return n;
+        break;
+
+      case decl_longreal:
+        return n;
+        break;
+
+      case decl_shortreal:
+        return n;
+        break;
+
       case decl_bitset:
-      case decl_boolean:
-      case decl_proc:
-      case decl_type:
-        return true;
+        return n;
         break;
 
+      case decl_ztype:
+        return n;
+        break;
 
-      default:
-        return false;
+      case decl_rtype:
+        return n;
         break;
-    }
-  /* static analysis guarentees a RETURN statement will be used before here.  */
-  __builtin_unreachable ();
-}
 
+      case decl_complex:
+        return n;
+        break;
 
-/*
-   makeVal - creates a VAL (type, expression) node.
-*/
+      case decl_longcomplex:
+        return n;
+        break;
 
-static decl_node makeVal (decl_node params)
-{
-  mcDebug_assert (decl_isExpList (params));
-  if ((expListLen (params)) == 2)
-    {
-      return makeBinary (decl_val, getExpList (params, 1), getExpList (params, 2), getExpList (params, 1));
-    }
-  else
-    {
-      M2RTS_HALT (-1);
-      __builtin_unreachable ();
-    }
-  ReturnException ("../../gcc/m2/mc/decl.def", 20, 1);
-  __builtin_unreachable ();
-}
+      case decl_shortcomplex:
+        return n;
+        break;
 
+      case decl_type:
+        /* language features and compound type attributes.  */
+        return n->typeF.type;
+        break;
 
-/*
-   makeCast - creates a cast node TYPENAME (expr).
-*/
+      case decl_record:
+        return n;
+        break;
 
-static decl_node makeCast (decl_node c, decl_node p)
-{
-  mcDebug_assert (decl_isExpList (p));
-  if ((expListLen (p)) == 1)
-    {
-      return makeBinary (decl_cast, c, getExpList (p, 1), c);
-    }
-  else
-    {
-      M2RTS_HALT (-1);
-      __builtin_unreachable ();
-    }
-  ReturnException ("../../gcc/m2/mc/decl.def", 20, 1);
-  __builtin_unreachable ();
-}
+      case decl_varient:
+        return n;
+        break;
 
-static decl_node makeIntrinsicProc (decl_nodeT k, unsigned int noArgs, decl_node p)
-{
-  decl_node f;
+      case decl_var:
+        return n->varF.type;
+        break;
 
-  /* 
-   makeIntrisicProc - create an intrinsic node.
-  */
-  f = newNode (k);
-  f->intrinsicF.args = p;
-  f->intrinsicF.noArgs = noArgs;
-  f->intrinsicF.type = NULL;
-  f->intrinsicF.postUnreachable = k == decl_halt;
-  initPair (&f->intrinsicF.intrinsicComment);
-  return f;
-  /* static analysis guarentees a RETURN statement will be used before here.  */
-  __builtin_unreachable ();
-}
+      case decl_enumeration:
+        return n;
+        break;
 
+      case decl_subrange:
+        return n->subrangeF.type;
+        break;
 
-/*
-   makeIntrinsicUnaryType - create an intrisic unary type.
-*/
+      case decl_array:
+        return n->arrayF.type;
+        break;
 
-static decl_node makeIntrinsicUnaryType (decl_nodeT k, decl_node paramList, decl_node returnType)
-{
-  return makeUnary (k, getExpList (paramList, 1), returnType);
-  /* static analysis guarentees a RETURN statement will be used before here.  */
-  __builtin_unreachable ();
-}
+      case decl_string:
+        return charN;
+        break;
 
+      case decl_const:
+        return doSetExprType (&n->constF.type, getExprType (n->constF.value));
+        break;
 
-/*
-   makeIntrinsicBinaryType - create an intrisic binary type.
-*/
+      case decl_literal:
+        return n->literalF.type;
+        break;
 
-static decl_node makeIntrinsicBinaryType (decl_nodeT k, decl_node paramList, decl_node returnType)
-{
-  return makeBinary (k, getExpList (paramList, 1), getExpList (paramList, 2), returnType);
-  /* static analysis guarentees a RETURN statement will be used before here.  */
-  __builtin_unreachable ();
-}
+      case decl_varparam:
+        return n->varparamF.type;
+        break;
 
+      case decl_param:
+        return n->paramF.type;
+        break;
 
-/*
-   checkIntrinsic - checks to see if the function call to, c, with
-                    parameter list, n, is really an intrinic.  If it
-                    is an intrinic then an intrinic node is created
-                    and returned.  Otherwise NIL is returned.
-*/
+      case decl_optarg:
+        return n->optargF.type;
+        break;
 
-static decl_node checkIntrinsic (decl_node c, decl_node n)
-{
-  if (isAnyType (c))
-    {
-      return makeCast (c, n);
-    }
-  else if (c == maxN)
-    {
-      /* avoid dangling else.  */
-      return makeIntrinsicUnaryType (decl_max, n, NULL);
-    }
-  else if (c == minN)
-    {
-      /* avoid dangling else.  */
-      return makeIntrinsicUnaryType (decl_min, n, NULL);
-    }
-  else if (c == haltN)
-    {
-      /* avoid dangling else.  */
-      return makeIntrinsicProc (decl_halt, expListLen (n), n);
-    }
-  else if (c == valN)
-    {
-      /* avoid dangling else.  */
-      return makeVal (n);
-    }
-  else if (c == adrN)
-    {
-      /* avoid dangling else.  */
-      return makeIntrinsicUnaryType (decl_adr, n, addressN);
-    }
-  else if (c == sizeN)
-    {
-      /* avoid dangling else.  */
-      return makeIntrinsicUnaryType (decl_size, n, cardinalN);
-    }
-  else if (c == tsizeN)
-    {
-      /* avoid dangling else.  */
-      return makeIntrinsicUnaryType (decl_tsize, n, cardinalN);
-    }
-  else if (c == floatN)
-    {
-      /* avoid dangling else.  */
-      return makeIntrinsicUnaryType (decl_float, n, realN);
-    }
-  else if (c == truncN)
-    {
-      /* avoid dangling else.  */
-      return makeIntrinsicUnaryType (decl_trunc, n, integerN);
-    }
-  else if (c == ordN)
-    {
-      /* avoid dangling else.  */
-      return makeIntrinsicUnaryType (decl_ord, n, cardinalN);
-    }
-  else if (c == chrN)
-    {
-      /* avoid dangling else.  */
-      return makeIntrinsicUnaryType (decl_chr, n, charN);
-    }
-  else if (c == capN)
-    {
-      /* avoid dangling else.  */
-      return makeIntrinsicUnaryType (decl_cap, n, charN);
-    }
-  else if (c == absN)
-    {
-      /* avoid dangling else.  */
-      return makeIntrinsicUnaryType (decl_abs, n, NULL);
-    }
-  else if (c == imN)
-    {
-      /* avoid dangling else.  */
-      return makeIntrinsicUnaryType (decl_im, n, NULL);
-    }
-  else if (c == reN)
-    {
-      /* avoid dangling else.  */
-      return makeIntrinsicUnaryType (decl_re, n, NULL);
-    }
-  else if (c == cmplxN)
-    {
-      /* avoid dangling else.  */
-      return makeIntrinsicBinaryType (decl_cmplx, n, NULL);
-    }
-  else if (c == highN)
-    {
-      /* avoid dangling else.  */
-      return makeIntrinsicUnaryType (decl_high, n, cardinalN);
-    }
-  else if (c == incN)
-    {
-      /* avoid dangling else.  */
-      return makeIntrinsicProc (decl_inc, expListLen (n), n);
-    }
-  else if (c == decN)
-    {
-      /* avoid dangling else.  */
-      return makeIntrinsicProc (decl_dec, expListLen (n), n);
-    }
-  else if (c == inclN)
-    {
-      /* avoid dangling else.  */
-      return makeIntrinsicProc (decl_incl, expListLen (n), n);
-    }
-  else if (c == exclN)
-    {
-      /* avoid dangling else.  */
-      return makeIntrinsicProc (decl_excl, expListLen (n), n);
-    }
-  else if (c == newN)
-    {
-      /* avoid dangling else.  */
-      return makeIntrinsicProc (decl_new, 1, n);
-    }
-  else if (c == disposeN)
-    {
-      /* avoid dangling else.  */
-      return makeIntrinsicProc (decl_dispose, 1, n);
-    }
-  else if (c == lengthN)
-    {
-      /* avoid dangling else.  */
-      return makeIntrinsicUnaryType (decl_length, n, cardinalN);
-    }
-  else if (c == throwN)
-    {
-      /* avoid dangling else.  */
-      keyc_useThrow ();
-      return makeIntrinsicProc (decl_throw, 1, n);
-    }
-  return NULL;
-  /* static analysis guarentees a RETURN statement will be used before here.  */
-  __builtin_unreachable ();
-}
-
-
-/*
-   checkCHeaders - check to see if the function is a C system function and
-                   requires a header file included.
-*/
-
-static void checkCHeaders (decl_node c)
-{
-  nameKey_Name name;
-  decl_node s;
-
-  if (decl_isProcedure (c))
-    {
-      s = decl_getScope (c);
-      if ((decl_getSymName (s)) == (nameKey_makeKey ((const char *) "libc", 4)))
-        {
-          name = decl_getSymName (c);
-          if ((((name == (nameKey_makeKey ((const char *) "read", 4))) || (name == (nameKey_makeKey ((const char *) "write", 5)))) || (name == (nameKey_makeKey ((const char *) "open", 4)))) || (name == (nameKey_makeKey ((const char *) "close", 5))))
-            {
-              keyc_useUnistd ();
-            }
-        }
-    }
-}
-
-
-/*
-   isFuncCall - returns TRUE if, n, is a function/procedure call.
-*/
-
-static bool isFuncCall (decl_node n)
-{
-  mcDebug_assert (n != NULL);
-  return n->kind == decl_funccall;
-  /* static analysis guarentees a RETURN statement will be used before here.  */
-  __builtin_unreachable ();
-}
-
-
-/*
-   putTypeInternal - marks type, des, as being an internally generated type.
-*/
-
-static void putTypeInternal (decl_node des)
-{
-  mcDebug_assert (des != NULL);
-  mcDebug_assert (decl_isType (des));
-  des->typeF.isInternal = true;
-}
-
-
-/*
-   isTypeInternal - returns TRUE if type, n, is internal.
-*/
-
-static bool isTypeInternal (decl_node n)
-{
-  mcDebug_assert (n != NULL);
-  mcDebug_assert (decl_isType (n));
-  return n->typeF.isInternal;
-  /* static analysis guarentees a RETURN statement will be used before here.  */
-  __builtin_unreachable ();
-}
-
-
-/*
-   lookupBase - return node named n from the base symbol scope.
-*/
-
-static decl_node lookupBase (nameKey_Name n)
-{
-  decl_node m;
-
-  m = static_cast<decl_node> (symbolKey_getSymKey (baseSymbols, n));
-  if (m == procN)
-    {
-      keyc_useProc ();
-    }
-  else if (((m == complexN) || (m == longcomplexN)) || (m == shortcomplexN))
-    {
-      /* avoid dangling else.  */
-      keyc_useComplex ();
-    }
-  return m;
-  /* static analysis guarentees a RETURN statement will be used before here.  */
-  __builtin_unreachable ();
-}
-
-
-/*
-   dumpScopes - display the names of all the scopes stacked.
-*/
-
-static void dumpScopes (void)
-{
-  unsigned int h;
-  decl_node s;
-
-  h = Indexing_HighIndice (scopeStack);
-  libc_printf ((const char *) "total scopes stacked %d\\n", 25, h);
-  while (h >= 1)
-    {
-      s = static_cast<decl_node> (Indexing_GetIndice (scopeStack, h));
-      out2 ((const char *) " scope [%d] is %s\\n", 19, h, s);
-      h -= 1;
-    }
-}
-
-
-/*
-   out0 - write string a to StdOut.
-*/
-
-static void out0 (const char *a_, unsigned int _a_high)
-{
-  DynamicStrings_String m;
-  char a[_a_high+1];
+      case decl_pointer:
+        return n->pointerF.type;
+        break;
 
-  /* make a local copy of each unbounded array.  */
-  memcpy (a, a_, _a_high+1);
+      case decl_recordfield:
+        return n->recordfieldF.type;
+        break;
 
-  m = FormatStrings_Sprintf0 (DynamicStrings_InitString ((const char *) a, _a_high));
-  m = DynamicStrings_KillString (SFIO_WriteS (FIO_StdOut, m));
-}
+      case decl_varientfield:
+        return n;
+        break;
 
+      case decl_enumerationfield:
+        return n->enumerationfieldF.type;
+        break;
 
-/*
-   out1 - write string a to StdOut using format specifier a.
-*/
+      case decl_set:
+        return n->setF.type;
+        break;
 
-static void out1 (const char *a_, unsigned int _a_high, decl_node s)
-{
-  DynamicStrings_String m;
-  unsigned int d;
-  char a[_a_high+1];
+      case decl_proctype:
+        return n->proctypeF.returnType;
+        break;
 
-  /* make a local copy of each unbounded array.  */
-  memcpy (a, a_, _a_high+1);
+      case decl_subscript:
+        return n->subscriptF.type;
+        break;
 
-  m = getFQstring (s);
-  if (DynamicStrings_EqualArray (m, (const char *) "", 0))
-    {
-      d = (unsigned int ) ((long unsigned int ) (s));
-      m = DynamicStrings_KillString (m);
-      m = FormatStrings_Sprintf1 (DynamicStrings_InitString ((const char *) "[%d]", 4), (const unsigned char *) &d, (sizeof (d)-1));
-    }
-  m = FormatStrings_Sprintf1 (DynamicStrings_InitString ((const char *) a, _a_high), (const unsigned char *) &m, (sizeof (m)-1));
-  m = DynamicStrings_KillString (SFIO_WriteS (FIO_StdOut, m));
-}
+      case decl_procedure:
+        /* blocks.  */
+        return n->procedureF.returnType;
+        break;
 
+      case decl_throw:
+        return static_cast<decl_node__opaque> (NULL);
+        break;
 
-/*
-   out2 - write string a to StdOut using format specifier a.
-*/
+      case decl_unreachable:
+        return static_cast<decl_node__opaque> (NULL);
+        break;
 
-static void out2 (const char *a_, unsigned int _a_high, unsigned int c, decl_node s)
-{
-  DynamicStrings_String m;
-  DynamicStrings_String m1;
-  char a[_a_high+1];
+      case decl_def:
+      case decl_imp:
+      case decl_module:
+      case decl_loop:
+      case decl_while:
+      case decl_for:
+      case decl_repeat:
+      case decl_if:
+      case decl_elsif:
+      case decl_assignment:
+        /* statements.  */
+        M2RTS_HALT (-1);
+        __builtin_unreachable ();
+        break;
 
-  /* make a local copy of each unbounded array.  */
-  memcpy (a, a_, _a_high+1);
+      case decl_plus:
+      case decl_sub:
+      case decl_div:
+      case decl_mod:
+      case decl_mult:
+      case decl_divide:
+        /* expressions.  */
+        return doSetExprType (&n->binaryF.resultType, mixTypes (getExprType (n->binaryF.left), getExprType (n->binaryF.right)));
+        break;
 
-  m1 = getString (s);
-  m = FormatStrings_Sprintf2 (DynamicStrings_InitString ((const char *) a, _a_high), (const unsigned char *) &c, (sizeof (c)-1), (const unsigned char *) &m1, (sizeof (m1)-1));
-  m = DynamicStrings_KillString (SFIO_WriteS (FIO_StdOut, m));
-  m1 = DynamicStrings_KillString (m1);
-}
+      case decl_in:
+      case decl_and:
+      case decl_or:
+      case decl_equal:
+      case decl_notequal:
+      case decl_less:
+      case decl_greater:
+      case decl_greequal:
+      case decl_lessequal:
+        return doSetExprType (&n->binaryF.resultType, booleanN);
+        break;
 
+      case decl_cmplx:
+        return doSetExprType (&n->binaryF.resultType, complexN);
+        break;
 
-/*
-   out3 - write string a to StdOut using format specifier a.
-*/
+      case decl_abs:
+      case decl_constexp:
+      case decl_deref:
+      case decl_neg:
+        return doSetExprType (&n->unaryF.resultType, getExprType (n->unaryF.arg));
+        break;
 
-static void out3 (const char *a_, unsigned int _a_high, unsigned int l, nameKey_Name n, decl_node s)
-{
-  DynamicStrings_String m;
-  DynamicStrings_String m1;
-  DynamicStrings_String m2;
-  char a[_a_high+1];
+      case decl_adr:
+        return doSetExprType (&n->unaryF.resultType, addressN);
+        break;
 
-  /* make a local copy of each unbounded array.  */
-  memcpy (a, a_, _a_high+1);
+      case decl_size:
+      case decl_tsize:
+        return doSetExprType (&n->unaryF.resultType, cardinalN);
+        break;
 
-  m1 = DynamicStrings_InitStringCharStar (nameKey_keyToCharStar (n));
-  m2 = getString (s);
-  m = FormatStrings_Sprintf3 (DynamicStrings_InitString ((const char *) a, _a_high), (const unsigned char *) &l, (sizeof (l)-1), (const unsigned char *) &m1, (sizeof (m1)-1), (const unsigned char *) &m2, (sizeof (m2)-1));
-  m = DynamicStrings_KillString (SFIO_WriteS (FIO_StdOut, m));
-  m1 = DynamicStrings_KillString (m1);
-  m2 = DynamicStrings_KillString (m2);
-}
+      case decl_high:
+      case decl_ord:
+        return doSetExprType (&n->unaryF.resultType, cardinalN);
+        break;
 
+      case decl_float:
+        return doSetExprType (&n->unaryF.resultType, realN);
+        break;
 
-/*
-   isUnary - returns TRUE if, n, is an unary node.
-*/
+      case decl_trunc:
+        return doSetExprType (&n->unaryF.resultType, integerN);
+        break;
 
-static bool isUnary (decl_node n)
-{
-  mcDebug_assert (n != NULL);
-  switch (n->kind)
-    {
-      case decl_length:
-      case decl_re:
-      case decl_im:
-      case decl_deref:
-      case decl_high:
       case decl_chr:
+        return doSetExprType (&n->unaryF.resultType, charN);
+        break;
+
       case decl_cap:
-      case decl_abs:
-      case decl_ord:
-      case decl_float:
-      case decl_trunc:
-      case decl_constexp:
+        return doSetExprType (&n->unaryF.resultType, charN);
+        break;
+
       case decl_not:
-      case decl_neg:
-      case decl_adr:
-      case decl_size:
-      case decl_tsize:
-      case decl_min:
-      case decl_max:
-        return true;
+        return doSetExprType (&n->unaryF.resultType, booleanN);
         break;
 
+      case decl_re:
+        return doSetExprType (&n->unaryF.resultType, realN);
+        break;
 
-      default:
-        return false;
+      case decl_im:
+        return doSetExprType (&n->unaryF.resultType, realN);
         break;
-    }
-  /* static analysis guarentees a RETURN statement will be used before here.  */
-  __builtin_unreachable ();
-}
 
+      case decl_arrayref:
+        return n->arrayrefF.resultType;
+        break;
 
-/*
-   isBinary - returns TRUE if, n, is an binary node.
-*/
+      case decl_componentref:
+        return n->componentrefF.resultType;
+        break;
 
-static bool isBinary (decl_node n)
-{
-  mcDebug_assert (n != NULL);
-  switch (n->kind)
-    {
-      case decl_cmplx:
-      case decl_and:
-      case decl_or:
-      case decl_equal:
-      case decl_notequal:
-      case decl_less:
-      case decl_greater:
-      case decl_greequal:
-      case decl_lessequal:
-      case decl_val:
-      case decl_cast:
-      case decl_plus:
-      case decl_sub:
-      case decl_div:
-      case decl_mod:
-      case decl_mult:
-      case decl_divide:
-      case decl_in:
-        return true;
+      case decl_pointerref:
+        return n->pointerrefF.resultType;
         break;
 
+      case decl_funccall:
+        return doSetExprType (&n->funccallF.type, doGetFuncType (n));
+        break;
 
-      default:
-        return false;
+      case decl_setvalue:
+        return n->setvalueF.type;
         break;
+
+
+      default:
+        CaseException ("../../gcc/m2/mc/decl.def", 20, 1);
+        __builtin_unreachable ();
     }
-  /* static analysis guarentees a RETURN statement will be used before here.  */
+  M2RTS_HALT (-1);
+  __builtin_unreachable ();
+  ReturnException ("../../gcc/m2/mc/decl.def", 20, 1);
   __builtin_unreachable ();
 }
 
 
 /*
-   makeUnary - create a unary expression node with, e, as the argument
-               and res as the return type.
+   getExprType - return the expression type.
 */
 
-static decl_node makeUnary (decl_nodeT k, decl_node e, decl_node res)
+static decl_node__opaque getExprType (decl_node__opaque n)
 {
-  decl_node n;
+  decl_node__opaque t;
 
-  if (k == decl_plus)
+  if (((isFuncCall (n)) && ((decl_getType (static_cast<decl_node> (n))) != NULL)) && (decl_isProcType (decl_skipType (decl_getType (static_cast<decl_node> (n))))))
     {
-      return e;
+      return static_cast<decl_node__opaque> (decl_getType (decl_skipType (decl_getType (static_cast<decl_node> (n)))));
     }
-  else
+  t = static_cast<decl_node__opaque> (decl_getType (static_cast<decl_node> (n)));
+  if (t == NULL)
     {
-      n = newNode (k);
-      switch (n->kind)
-        {
-          case decl_min:
-          case decl_max:
-          case decl_throw:
-          case decl_re:
-          case decl_im:
-          case decl_deref:
-          case decl_high:
-          case decl_chr:
-          case decl_cap:
-          case decl_abs:
-          case decl_ord:
-          case decl_float:
-          case decl_trunc:
-          case decl_length:
-          case decl_constexp:
-          case decl_not:
-          case decl_neg:
-          case decl_adr:
-          case decl_size:
-          case decl_tsize:
-            n->unaryF.arg = e;
-            n->unaryF.resultType = res;
-            break;
-
-
-          default:
-            CaseException ("../../gcc/m2/mc/decl.def", 20, 1);
-            __builtin_unreachable ();
-        }
+      t = doGetExprType (n);
     }
-  return n;
-  /* static analysis guarentees a RETURN statement will be used before here.  */
-  __builtin_unreachable ();
-}
-
-
-/*
-   isLeafString - returns TRUE if n is a leaf node which is a string constant.
-*/
-
-static bool isLeafString (decl_node n)
-{
-  return ((isString (n)) || ((decl_isLiteral (n)) && ((decl_getType (n)) == charN))) || ((decl_isConst (n)) && ((getExprType (n)) == charN));
+  return t;
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
 
 
 /*
-   getLiteralStringContents - return the contents of a literal node as a string.
+   openOutput -
 */
 
-static DynamicStrings_String getLiteralStringContents (decl_node n)
+static void openOutput (void)
 {
-  DynamicStrings_String number;
-  DynamicStrings_String content;
   DynamicStrings_String s;
 
-  mcDebug_assert (n->kind == decl_literal);
-  s = DynamicStrings_InitStringCharStar (nameKey_keyToCharStar (n->literalF.name));
-  content = NULL;
-  if (n->literalF.type == charN)
+  s = mcOptions_getOutputFile ();
+  if (DynamicStrings_EqualArray (s, (const char *) "-", 1))
     {
-      if ((DynamicStrings_char (s, -1)) == 'C')
-        {
-          if ((DynamicStrings_Length (s)) > 1)
-            {
-              number = DynamicStrings_Slice (s, 0, -1);
-              content = DynamicStrings_InitStringChar ((char ) (StringConvert_ostoc (number)));
-              number = DynamicStrings_KillString (number);
-            }
-          else
-            {
-              content = DynamicStrings_InitStringChar ('C');
-            }
-        }
-      else
-        {
-          content = DynamicStrings_Dup (s);
-        }
+      outputFile = FIO_StdOut;
     }
   else
     {
-      mcMetaError_metaError1 ((const char *) "cannot obtain string contents from {%1k}", 40, (const unsigned char *) &n->literalF.name, (sizeof (n->literalF.name)-1));
+      outputFile = SFIO_OpenToWrite (s);
     }
-  s = DynamicStrings_KillString (s);
-  return content;
-  /* static analysis guarentees a RETURN statement will be used before here.  */
-  __builtin_unreachable ();
+  mcStream_setDest (outputFile);
 }
 
 
 /*
-   getStringContents - return the string contents of a constant, literal,
-                       string or a constexp node.
+   closeOutput -
 */
 
-static DynamicStrings_String getStringContents (decl_node n)
+static void closeOutput (void)
 {
-  if (decl_isConst (n))
-    {
-      return getStringContents (n->constF.value);
-    }
-  else if (decl_isLiteral (n))
-    {
-      /* avoid dangling else.  */
-      return getLiteralStringContents (n);
-    }
-  else if (isString (n))
-    {
-      /* avoid dangling else.  */
-      return getString (n);
-    }
-  else if (isConstExp (n))
+  DynamicStrings_String s;
+
+  s = mcOptions_getOutputFile ();
+  outputFile = mcStream_combine ();
+  if (! (DynamicStrings_EqualArray (s, (const char *) "-", 1)))
     {
-      /* avoid dangling else.  */
-      return getStringContents (n->unaryF.arg);
+      FIO_Close (outputFile);
     }
-  M2RTS_HALT (-1);
-  __builtin_unreachable ();
-  ReturnException ("../../gcc/m2/mc/decl.def", 20, 1);
-  __builtin_unreachable ();
 }
 
 
 /*
-   addNames -
+   write - outputs a single char, ch.
 */
 
-static nameKey_Name addNames (decl_node a, decl_node b)
+static void write_ (char ch)
 {
-  DynamicStrings_String sa;
-  DynamicStrings_String sb;
-  nameKey_Name n;
-
-  sa = DynamicStrings_InitStringCharStar (nameKey_keyToCharStar (decl_getSymName (a)));
-  sb = DynamicStrings_InitStringCharStar (nameKey_keyToCharStar (decl_getSymName (b)));
-  sa = DynamicStrings_ConCat (sa, sb);
-  n = nameKey_makekey (DynamicStrings_string (sa));
-  sa = DynamicStrings_KillString (sa);
-  sb = DynamicStrings_KillString (sb);
-  return n;
-  /* static analysis guarentees a RETURN statement will be used before here.  */
-  __builtin_unreachable ();
+  FIO_WriteChar (outputFile, ch);
+  FIO_FlushBuffer (outputFile);
 }
 
 
 /*
-   resolveString -
+   writeln -
 */
 
-static decl_node resolveString (decl_node n)
+static void writeln (void)
 {
-  while ((decl_isConst (n)) || (isConstExp (n)))
-    {
-      if (decl_isConst (n))
-        {
-          n = n->constF.value;
-        }
-      else
-        {
-          n = n->unaryF.arg;
-        }
-    }
-  if (n->kind == decl_plus)
-    {
-      n = decl_makeString (addNames (resolveString (n->binaryF.left), resolveString (n->binaryF.right)));
-    }
-  return n;
-  /* static analysis guarentees a RETURN statement will be used before here.  */
-  __builtin_unreachable ();
+  FIO_WriteLine (outputFile);
+  FIO_FlushBuffer (outputFile);
 }
 
 
 /*
-   foldBinary -
+   doIncludeC - include header file for definition module, n.
 */
 
-static decl_node foldBinary (decl_nodeT k, decl_node l, decl_node r, decl_node res)
+static void doIncludeC (decl_node__opaque n)
 {
-  decl_node n;
-  DynamicStrings_String ls;
-  DynamicStrings_String rs;
+  DynamicStrings_String s;
 
-  n = NULL;
-  if (((k == decl_plus) && (isLeafString (l))) && (isLeafString (r)))
+  s = DynamicStrings_InitStringCharStar (nameKey_keyToCharStar (decl_getSymName (static_cast<decl_node> (n))));
+  if (mcOptions_getExtendedOpaque ())
+    {}  /* empty.  */
+  /* no include in this case.  */
+  else if (decl_isDef (static_cast<decl_node> (n)))
     {
-      ls = getStringContents (l);
-      rs = getStringContents (r);
-      ls = DynamicStrings_Add (ls, rs);
-      n = decl_makeString (nameKey_makekey (DynamicStrings_string (ls)));
-      ls = DynamicStrings_KillString (ls);
-      rs = DynamicStrings_KillString (rs);
+      /* avoid dangling else.  */
+      mcPretty_print (doP, (const char *) "#   include \"", 13);
+      mcPretty_prints (doP, mcOptions_getHPrefix ());
+      mcPretty_prints (doP, s);
+      mcPretty_print (doP, (const char *) ".h\"\\n", 5);
+      symbolKey_foreachNodeDo (n->defF.decls.symbols, (symbolKey_performOperation) {(symbolKey_performOperation_t) addDoneDef});
     }
-  return n;
-  /* static analysis guarentees a RETURN statement will be used before here.  */
-  __builtin_unreachable ();
+  s = DynamicStrings_KillString (s);
 }
 
 
 /*
-   makeBinary - create a binary node with left/right/result type:  l, r and resultType.
+   getSymScope - returns the scope where node, n, was declared.
 */
 
-static decl_node makeBinary (decl_nodeT k, decl_node l, decl_node r, decl_node resultType)
+static decl_node__opaque getSymScope (decl_node__opaque n)
 {
-  decl_node n;
-
-  n = foldBinary (k, l, r, resultType);
-  if (n == NULL)
+  switch (n->kind)
     {
-      n = doMakeBinary (k, l, r, resultType);
+      case decl_const:
+        return n->constF.scope;
+        break;
+
+      case decl_type:
+        return n->typeF.scope;
+        break;
+
+      case decl_var:
+        return n->varF.scope;
+        break;
+
+      case decl_procedure:
+        return n->procedureF.scope;
+        break;
+
+
+      default:
+        CaseException ("../../gcc/m2/mc/decl.def", 20, 1);
+        __builtin_unreachable ();
     }
-  return n;
-  /* static analysis guarentees a RETURN statement will be used before here.  */
+  M2RTS_HALT (-1);
+  __builtin_unreachable ();
+  ReturnException ("../../gcc/m2/mc/decl.def", 20, 1);
   __builtin_unreachable ();
 }
 
 
 /*
-   doMakeBinary - returns a binary node containing left/right/result values
-                  l, r, res, with a node operator, k.
+   isQualifiedForced - should the node be written with a module prefix?
 */
 
-static decl_node doMakeBinary (decl_nodeT k, decl_node l, decl_node r, decl_node res)
+static bool isQualifiedForced (decl_node__opaque n)
 {
-  decl_node n;
-
-  n = newNode (k);
-  switch (n->kind)
-    {
-      case decl_cmplx:
-      case decl_equal:
-      case decl_notequal:
-      case decl_less:
-      case decl_greater:
-      case decl_greequal:
-      case decl_lessequal:
-      case decl_and:
-      case decl_or:
-      case decl_cast:
-      case decl_val:
-      case decl_plus:
-      case decl_sub:
-      case decl_div:
-      case decl_mod:
-      case decl_mult:
-      case decl_divide:
-      case decl_in:
-        n->binaryF.left = l;
-        n->binaryF.right = r;
-        n->binaryF.resultType = res;
-        break;
+  return forceQualified && (((((decl_isType (static_cast<decl_node> (n))) || (decl_isRecord (static_cast<decl_node> (n)))) || (decl_isArray (static_cast<decl_node> (n)))) || (decl_isEnumeration (static_cast<decl_node> (n)))) || (decl_isEnumerationField (static_cast<decl_node> (n))));
+  /* static analysis guarentees a RETURN statement will be used before here.  */
+  __builtin_unreachable ();
+}
 
 
-      default:
-        CaseException ("../../gcc/m2/mc/decl.def", 20, 1);
-        __builtin_unreachable ();
+/*
+   getFQstring -
+*/
+
+static DynamicStrings_String getFQstring (decl_node__opaque n)
+{
+  DynamicStrings_String i;
+  DynamicStrings_String s;
+
+  if ((decl_getScope (static_cast<decl_node> (n))) == NULL)
+    {
+      return DynamicStrings_InitStringCharStar (nameKey_keyToCharStar (decl_getSymName (static_cast<decl_node> (n))));
+    }
+  else if (isQualifiedForced (n))
+    {
+      /* avoid dangling else.  */
+      i = DynamicStrings_InitStringCharStar (nameKey_keyToCharStar (decl_getSymName (static_cast<decl_node> (n))));
+      s = DynamicStrings_InitStringCharStar (nameKey_keyToCharStar (decl_getSymName (decl_getScope (static_cast<decl_node> (n)))));
+      return FormatStrings_Sprintf2 (DynamicStrings_InitString ((const char *) "%s_%s", 5), (const unsigned char *) &s, (sizeof (s)-1), (const unsigned char *) &i, (sizeof (i)-1));
+    }
+  else if ((! (decl_isExported (static_cast<decl_node> (n)))) || (mcOptions_getIgnoreFQ ()))
+    {
+      /* avoid dangling else.  */
+      return DynamicStrings_InitStringCharStar (nameKey_keyToCharStar (decl_getSymName (static_cast<decl_node> (n))));
+    }
+  else
+    {
+      /* avoid dangling else.  */
+      i = DynamicStrings_InitStringCharStar (nameKey_keyToCharStar (decl_getSymName (static_cast<decl_node> (n))));
+      s = DynamicStrings_InitStringCharStar (nameKey_keyToCharStar (decl_getSymName (decl_getScope (static_cast<decl_node> (n)))));
+      return FormatStrings_Sprintf2 (DynamicStrings_InitString ((const char *) "%s_%s", 5), (const unsigned char *) &s, (sizeof (s)-1), (const unsigned char *) &i, (sizeof (i)-1));
     }
-  return n;
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
 
 
 /*
-   doMakeComponentRef -
+   getFQDstring -
 */
 
-static decl_node doMakeComponentRef (decl_node rec, decl_node field)
+static DynamicStrings_String getFQDstring (decl_node__opaque n, bool scopes)
 {
-  decl_node n;
+  DynamicStrings_String i;
+  DynamicStrings_String s;
 
-  n = newNode (decl_componentref);
-  n->componentrefF.rec = rec;
-  n->componentrefF.field = field;
-  n->componentrefF.resultType = decl_getType (field);
-  return n;
+  if ((decl_getScope (static_cast<decl_node> (n))) == NULL)
+    {
+      return DynamicStrings_InitStringCharStar (nameKey_keyToCharStar (getDName (n, scopes)));
+    }
+  else if (isQualifiedForced (n))
+    {
+      /* avoid dangling else.  */
+      /* we assume a qualified name will never conflict.  */
+      i = DynamicStrings_InitStringCharStar (nameKey_keyToCharStar (decl_getSymName (static_cast<decl_node> (n))));
+      s = DynamicStrings_InitStringCharStar (nameKey_keyToCharStar (decl_getSymName (decl_getScope (static_cast<decl_node> (n)))));
+      return FormatStrings_Sprintf2 (DynamicStrings_InitString ((const char *) "%s_%s", 5), (const unsigned char *) &s, (sizeof (s)-1), (const unsigned char *) &i, (sizeof (i)-1));
+    }
+  else if ((! (decl_isExported (static_cast<decl_node> (n)))) || (mcOptions_getIgnoreFQ ()))
+    {
+      /* avoid dangling else.  */
+      return DynamicStrings_InitStringCharStar (nameKey_keyToCharStar (getDName (n, scopes)));
+    }
+  else
+    {
+      /* avoid dangling else.  */
+      /* we assume a qualified name will never conflict.  */
+      i = DynamicStrings_InitStringCharStar (nameKey_keyToCharStar (decl_getSymName (static_cast<decl_node> (n))));
+      s = DynamicStrings_InitStringCharStar (nameKey_keyToCharStar (decl_getSymName (decl_getScope (static_cast<decl_node> (n)))));
+      return FormatStrings_Sprintf2 (DynamicStrings_InitString ((const char *) "%s_%s", 5), (const unsigned char *) &s, (sizeof (s)-1), (const unsigned char *) &i, (sizeof (i)-1));
+    }
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
 
 
 /*
-   isComponentRef -
+   getString - returns the name as a string.
 */
 
-static bool isComponentRef (decl_node n)
+static DynamicStrings_String getString (decl_node__opaque n)
 {
-  mcDebug_assert (n != NULL);
-  return n->kind == decl_componentref;
+  if ((decl_getSymName (static_cast<decl_node> (n))) == nameKey_NulName)
+    {
+      return DynamicStrings_InitString ((const char *) "", 0);
+    }
+  else
+    {
+      return DynamicStrings_InitStringCharStar (nameKey_keyToCharStar (decl_getSymName (static_cast<decl_node> (n))));
+    }
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
 
 
 /*
-   isArrayRef - returns TRUE if the node was an arrayref.
+   doNone - call HALT.
 */
 
-static bool isArrayRef (decl_node n)
+static void doNone (decl_node__opaque n)
 {
-  mcDebug_assert (n != NULL);
-  return n->kind == decl_arrayref;
-  /* static analysis guarentees a RETURN statement will be used before here.  */
+  M2RTS_HALT (-1);
   __builtin_unreachable ();
 }
 
 
 /*
-   isDeref - returns TRUE if, n, is a deref node.
+   doNothing - does nothing!
 */
 
-static bool isDeref (decl_node n)
+static void doNothing (decl_node__opaque n)
 {
-  mcDebug_assert (n != NULL);
-  return n->kind == decl_deref;
-  /* static analysis guarentees a RETURN statement will be used before here.  */
-  __builtin_unreachable ();
 }
 
 
 /*
-   makeBase - create a base type or constant.
-              It only supports the base types and constants
-              enumerated below.
+   doConstC -
 */
 
-static decl_node makeBase (decl_nodeT k)
+static void doConstC (decl_node__opaque n)
 {
-  decl_node n;
+  if (! (alists_isItemInList (globalGroup->doneQ, reinterpret_cast<void *> (n))))
+    {
+      mcPretty_print (doP, (const char *) "#   define ", 11);
+      doFQNameC (doP, n);
+      mcPretty_setNeedSpace (doP);
+      doExprC (doP, n->constF.value);
+      mcPretty_print (doP, (const char *) "\\n", 2);
+      alists_includeItemIntoList (globalGroup->doneQ, reinterpret_cast<void *> (n));
+    }
+}
 
-  n = newNode (k);
-  switch (k)
+
+/*
+   needsParen - returns TRUE if expression, n, needs to be enclosed in ().
+*/
+
+static bool needsParen (decl_node__opaque n)
+{
+  mcDebug_assert (n != NULL);
+  switch (n->kind)
     {
-      case decl_new:
-      case decl_dispose:
-      case decl_length:
-      case decl_inc:
-      case decl_dec:
-      case decl_incl:
-      case decl_excl:
       case decl_nil:
       case decl_true:
       case decl_false:
-      case decl_address:
-      case decl_loc:
-      case decl_byte:
-      case decl_word:
-      case decl_csizet:
-      case decl_cssizet:
-      case decl_char:
-      case decl_cardinal:
-      case decl_longcard:
-      case decl_shortcard:
-      case decl_integer:
-      case decl_longint:
-      case decl_shortint:
-      case decl_real:
-      case decl_longreal:
-      case decl_shortreal:
-      case decl_bitset:
-      case decl_boolean:
-      case decl_proc:
-      case decl_ztype:
-      case decl_rtype:
-      case decl_complex:
-      case decl_longcomplex:
-      case decl_shortcomplex:
+        return false;
+        break;
+
+      case decl_constexp:
+        return needsParen (n->unaryF.arg);
+        break;
+
+      case decl_neg:
+        return needsParen (n->unaryF.arg);
+        break;
+
+      case decl_not:
+        return needsParen (n->unaryF.arg);
+        break;
+
       case decl_adr:
-      case decl_chr:
-      case decl_cap:
-      case decl_abs:
+      case decl_size:
+      case decl_tsize:
+      case decl_ord:
       case decl_float:
       case decl_trunc:
-      case decl_ord:
+      case decl_chr:
+      case decl_cap:
       case decl_high:
-      case decl_throw:
-      case decl_re:
-      case decl_im:
-      case decl_cmplx:
-      case decl_size:
-      case decl_tsize:
+        return false;
+        break;
+
+      case decl_deref:
+        return false;
+        break;
+
+      case decl_equal:
+      case decl_notequal:
+      case decl_less:
+      case decl_greater:
+      case decl_greequal:
+      case decl_lessequal:
+        return true;
+        break;
+
+      case decl_componentref:
+        return false;
+        break;
+
+      case decl_pointerref:
+        return false;
+        break;
+
+      case decl_cast:
+        return true;
+        break;
+
       case decl_val:
-      case decl_min:
+        return true;
+        break;
+
+      case decl_abs:
+        return false;
+        break;
+
+      case decl_plus:
+      case decl_sub:
+      case decl_div:
+      case decl_mod:
+      case decl_mult:
+      case decl_divide:
+      case decl_in:
+        return true;
+        break;
+
+      case decl_literal:
+      case decl_const:
+      case decl_enumerationfield:
+      case decl_string:
+        return false;
+        break;
+
       case decl_max:
+        return true;
         break;
 
+      case decl_min:
+        return true;
+        break;
 
-      default:
-        M2RTS_HALT (-1);  /* legal kind.  */
-        __builtin_unreachable ();
+      case decl_var:
+        return false;
         break;
-    }
-  return n;
-  /* static analysis guarentees a RETURN statement will be used before here.  */
-  __builtin_unreachable ();
-}
 
+      case decl_arrayref:
+        return false;
+        break;
 
-/*
-   isOrdinal - returns TRUE if, n, is an ordinal type.
-*/
+      case decl_and:
+      case decl_or:
+        return true;
+        break;
+
+      case decl_funccall:
+        return true;
+        break;
+
+      case decl_recordfield:
+        return false;
+        break;
 
-static bool isOrdinal (decl_node n)
-{
-  switch (n->kind)
-    {
-      case decl_address:
       case decl_loc:
       case decl_byte:
       case decl_word:
-      case decl_csizet:
-      case decl_cssizet:
-      case decl_char:
-      case decl_integer:
-      case decl_longint:
-      case decl_shortint:
+      case decl_type:
+      case decl_char:
       case decl_cardinal:
       case decl_longcard:
       case decl_shortcard:
+      case decl_integer:
+      case decl_longint:
+      case decl_shortint:
+      case decl_real:
+      case decl_longreal:
+      case decl_shortreal:
+      case decl_complex:
+      case decl_longcomplex:
+      case decl_shortcomplex:
       case decl_bitset:
-        return true;
+      case decl_boolean:
+      case decl_proc:
+        return false;
+        break;
+
+      case decl_setvalue:
+        return false;
         break;
 
+      case decl_address:
+        return true;
+        break;
 
-      default:
+      case decl_procedure:
         return false;
         break;
-    }
-  /* static analysis guarentees a RETURN statement will be used before here.  */
-  __builtin_unreachable ();
-}
 
+      case decl_length:
+      case decl_cmplx:
+      case decl_re:
+      case decl_im:
+        return true;
+        break;
 
-/*
-   mixTypes -
-*/
 
-static decl_node mixTypes (decl_node a, decl_node b)
-{
-  if ((a == addressN) || (b == addressN))
-    {
-      return addressN;
+      default:
+        CaseException ("../../gcc/m2/mc/decl.def", 20, 1);
+        __builtin_unreachable ();
     }
-  return a;
+  return true;
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
 
 
 /*
-   doSetExprType -
+   doUnary -
 */
 
-static decl_node doSetExprType (decl_node *t, decl_node n)
+static void doUnary (mcPretty_pretty p, const char *op_, unsigned int _op_high, decl_node__opaque expr, decl_node__opaque type, bool l, bool r)
 {
-  if ((*t) == NULL)
+  char op[_op_high+1];
+
+  /* make a local copy of each unbounded array.  */
+  memcpy (op, op_, _op_high+1);
+
+  if (l)
     {
-      (*t) = n;
+      mcPretty_setNeedSpace (p);
+    }
+  mcPretty_print (p, (const char *) op, _op_high);
+  if (r)
+    {
+      mcPretty_setNeedSpace (p);
+    }
+  if (needsParen (expr))
+    {
+      outText (p, (const char *) "(", 1);
+      doExprC (p, expr);
+      outText (p, (const char *) ")", 1);
+    }
+  else
+    {
+      doExprC (p, expr);
     }
-  return (*t);
-  /* static analysis guarentees a RETURN statement will be used before here.  */
-  __builtin_unreachable ();
 }
 
 
 /*
-   getMaxMinType -
+   doSetSub - perform  l & (~ r)
 */
 
-static decl_node getMaxMinType (decl_node n)
+static void doSetSub (mcPretty_pretty p, decl_node__opaque left, decl_node__opaque right)
 {
-  if ((decl_isVar (n)) || (decl_isConst (n)))
+  if (needsParen (left))
     {
-      return decl_getType (n);
+      outText (p, (const char *) "(", 1);
+      doExprC (p, left);
+      outText (p, (const char *) ")", 1);
     }
-  else if (isConstExp (n))
+  else
     {
-      /* avoid dangling else.  */
-      n = getExprType (n->unaryF.arg);
-      if (n == bitsetN)
-        {
-          return ztypeN;
-        }
-      else
-        {
-          return n;
-        }
+      doExprC (p, left);
+    }
+  mcPretty_setNeedSpace (p);
+  outText (p, (const char *) "&", 1);
+  mcPretty_setNeedSpace (p);
+  if (needsParen (right))
+    {
+      outText (p, (const char *) "(~(", 3);
+      doExprC (p, right);
+      outText (p, (const char *) "))", 2);
     }
   else
     {
-      /* avoid dangling else.  */
-      return n;
+      outText (p, (const char *) "(~", 2);
+      doExprC (p, right);
+      outText (p, (const char *) ")", 1);
     }
-  /* static analysis guarentees a RETURN statement will be used before here.  */
-  __builtin_unreachable ();
 }
 
 
 /*
-   doGetFuncType -
+   doPolyBinary -
 */
 
-static decl_node doGetFuncType (decl_node n)
+static void doPolyBinary (mcPretty_pretty p, decl_nodeT op, decl_node__opaque left, decl_node__opaque right, bool l, bool r)
 {
-  mcDebug_assert (isFuncCall (n));
-  return doSetExprType (&n->funccallF.type, decl_getType (n->funccallF.function));
-  /* static analysis guarentees a RETURN statement will be used before here.  */
-  __builtin_unreachable ();
-}
-
-
-/*
-   doGetExprType - works out the type which is associated with node, n.
-*/
+  decl_node__opaque lt;
+  decl_node__opaque rt;
 
-static decl_node doGetExprType (decl_node n)
-{
-  switch (n->kind)
+  lt = static_cast<decl_node__opaque> (decl_skipType (static_cast<decl_node> (getExprType (left))));
+  rt = static_cast<decl_node__opaque> (decl_skipType (static_cast<decl_node> (getExprType (right))));
+  if (((lt != NULL) && ((decl_isSet (static_cast<decl_node> (lt))) || (isBitset (lt)))) || ((rt != NULL) && ((decl_isSet (static_cast<decl_node> (rt))) || (isBitset (rt)))))
     {
-      case decl_max:
-      case decl_min:
-        return getMaxMinType (n->unaryF.arg);
-        break;
-
-      case decl_cast:
-      case decl_val:
-        return doSetExprType (&n->binaryF.resultType, n->binaryF.left);
-        break;
+      switch (op)
+        {
+          case decl_plus:
+            doBinary (p, (const char *) "|", 1, left, right, l, r, false);
+            break;
 
-      case decl_halt:
-      case decl_new:
-      case decl_dispose:
-        return NULL;
-        break;
+          case decl_sub:
+            doSetSub (p, left, right);
+            break;
 
-      case decl_inc:
-      case decl_dec:
-      case decl_incl:
-      case decl_excl:
-        return NULL;
-        break;
+          case decl_mult:
+            doBinary (p, (const char *) "&", 1, left, right, l, r, false);
+            break;
 
-      case decl_nil:
-        return addressN;
-        break;
+          case decl_divide:
+            doBinary (p, (const char *) "^", 1, left, right, l, r, false);
+            break;
 
-      case decl_true:
-      case decl_false:
-        return booleanN;
-        break;
 
-      case decl_address:
-        return n;
-        break;
+          default:
+            CaseException ("../../gcc/m2/mc/decl.def", 20, 1);
+            __builtin_unreachable ();
+        }
+    }
+  else
+    {
+      switch (op)
+        {
+          case decl_plus:
+            doBinary (p, (const char *) "+", 1, left, right, l, r, false);
+            break;
 
-      case decl_loc:
-        return n;
-        break;
+          case decl_sub:
+            doBinary (p, (const char *) "-", 1, left, right, l, r, false);
+            break;
 
-      case decl_byte:
-        return n;
-        break;
+          case decl_mult:
+            doBinary (p, (const char *) "*", 1, left, right, l, r, false);
+            break;
 
-      case decl_word:
-        return n;
-        break;
+          case decl_divide:
+            doBinary (p, (const char *) "/", 1, left, right, l, r, false);
+            break;
 
-      case decl_csizet:
-        return n;
-        break;
 
-      case decl_cssizet:
-        return n;
-        break;
+          default:
+            CaseException ("../../gcc/m2/mc/decl.def", 20, 1);
+            __builtin_unreachable ();
+        }
+    }
+}
 
-      case decl_boolean:
-        /* base types.  */
-        return n;
-        break;
 
-      case decl_proc:
-        return n;
-        break;
+/*
+   doBinary -
+*/
 
-      case decl_char:
-        return n;
-        break;
+static void doBinary (mcPretty_pretty p, const char *op_, unsigned int _op_high, decl_node__opaque left, decl_node__opaque right, bool l, bool r, bool unpackProc)
+{
+  char op[_op_high+1];
 
-      case decl_cardinal:
-        return n;
-        break;
+  /* make a local copy of each unbounded array.  */
+  memcpy (op, op_, _op_high+1);
 
-      case decl_longcard:
-        return n;
-        break;
+  if (needsParen (left))
+    {
+      outText (p, (const char *) "(", 1);
+      left = doExprCup (p, left, unpackProc, false);
+      outText (p, (const char *) ")", 1);
+    }
+  else
+    {
+      left = doExprCup (p, left, unpackProc, false);
+    }
+  if (l)
+    {
+      mcPretty_setNeedSpace (p);
+    }
+  outText (p, (const char *) op, _op_high);
+  if (r)
+    {
+      mcPretty_setNeedSpace (p);
+    }
+  if (needsParen (right))
+    {
+      outText (p, (const char *) "(", 1);
+      right = doExprCup (p, right, unpackProc, false);
+      outText (p, (const char *) ")", 1);
+    }
+  else
+    {
+      right = doExprCup (p, right, unpackProc, false);
+    }
+}
 
-      case decl_shortcard:
-        return n;
-        break;
 
-      case decl_integer:
-        return n;
-        break;
+/*
+   doPostUnary -
+*/
 
-      case decl_longint:
-        return n;
-        break;
+static void doPostUnary (mcPretty_pretty p, const char *op_, unsigned int _op_high, decl_node__opaque expr)
+{
+  char op[_op_high+1];
 
-      case decl_shortint:
-        return n;
-        break;
+  /* make a local copy of each unbounded array.  */
+  memcpy (op, op_, _op_high+1);
 
-      case decl_real:
-        return n;
-        break;
+  doExprC (p, expr);
+  outText (p, (const char *) op, _op_high);
+}
 
-      case decl_longreal:
-        return n;
-        break;
 
-      case decl_shortreal:
-        return n;
-        break;
+/*
+   doDeRefC -
+*/
 
-      case decl_bitset:
-        return n;
-        break;
+static decl_node__opaque doDeRefC (mcPretty_pretty p, decl_node__opaque expr)
+{
+  outText (p, (const char *) "(*", 2);
+  expr = castOpaque (p, expr, false);
+  outText (p, (const char *) ")", 1);
+  return expr;
+  /* static analysis guarentees a RETURN statement will be used before here.  */
+  __builtin_unreachable ();
+}
 
-      case decl_ztype:
-        return n;
-        break;
 
-      case decl_rtype:
-        return n;
-        break;
+/*
+   doGetLastOp - returns, a, if b is a terminal otherwise walk right.
+*/
 
-      case decl_complex:
-        return n;
+static decl_node__opaque doGetLastOp (decl_node__opaque a, decl_node__opaque b)
+{
+  switch (b->kind)
+    {
+      case decl_nil:
+        return a;
         break;
 
-      case decl_longcomplex:
-        return n;
+      case decl_true:
+        return a;
         break;
 
-      case decl_shortcomplex:
-        return n;
+      case decl_false:
+        return a;
         break;
 
-      case decl_type:
-        /* language features and compound type attributes.  */
-        return n->typeF.type;
+      case decl_constexp:
+        return doGetLastOp (b, b->unaryF.arg);
         break;
 
-      case decl_record:
-        return n;
+      case decl_neg:
+        return doGetLastOp (b, b->unaryF.arg);
         break;
 
-      case decl_varient:
-        return n;
+      case decl_not:
+        return doGetLastOp (b, b->unaryF.arg);
         break;
 
-      case decl_var:
-        return n->varF.type;
+      case decl_adr:
+        return doGetLastOp (b, b->unaryF.arg);
         break;
 
-      case decl_enumeration:
-        return n;
+      case decl_size:
+        return doGetLastOp (b, b->unaryF.arg);
         break;
 
-      case decl_subrange:
-        return n->subrangeF.type;
+      case decl_tsize:
+        return doGetLastOp (b, b->unaryF.arg);
         break;
 
-      case decl_array:
-        return n->arrayF.type;
+      case decl_ord:
+        return doGetLastOp (b, b->unaryF.arg);
         break;
 
-      case decl_string:
-        return charN;
+      case decl_float:
+      case decl_trunc:
+        return doGetLastOp (b, b->unaryF.arg);
         break;
 
-      case decl_const:
-        return doSetExprType (&n->constF.type, getExprType (n->constF.value));
+      case decl_chr:
+        return doGetLastOp (b, b->unaryF.arg);
         break;
 
-      case decl_literal:
-        return n->literalF.type;
+      case decl_cap:
+        return doGetLastOp (b, b->unaryF.arg);
         break;
 
-      case decl_varparam:
-        return n->varparamF.type;
+      case decl_high:
+        return doGetLastOp (b, b->unaryF.arg);
         break;
 
-      case decl_param:
-        return n->paramF.type;
+      case decl_deref:
+        return doGetLastOp (b, b->unaryF.arg);
         break;
 
-      case decl_optarg:
-        return n->optargF.type;
+      case decl_re:
+      case decl_im:
+        return doGetLastOp (b, b->unaryF.arg);
         break;
 
-      case decl_pointer:
-        return n->pointerF.type;
+      case decl_equal:
+        return doGetLastOp (b, b->binaryF.right);
         break;
 
-      case decl_recordfield:
-        return n->recordfieldF.type;
+      case decl_notequal:
+        return doGetLastOp (b, b->binaryF.right);
         break;
 
-      case decl_varientfield:
-        return n;
+      case decl_less:
+        return doGetLastOp (b, b->binaryF.right);
         break;
 
-      case decl_enumerationfield:
-        return n->enumerationfieldF.type;
+      case decl_greater:
+        return doGetLastOp (b, b->binaryF.right);
         break;
 
-      case decl_set:
-        return n->setF.type;
+      case decl_greequal:
+        return doGetLastOp (b, b->binaryF.right);
         break;
 
-      case decl_proctype:
-        return n->proctypeF.returnType;
+      case decl_lessequal:
+        return doGetLastOp (b, b->binaryF.right);
         break;
 
-      case decl_subscript:
-        return n->subscriptF.type;
+      case decl_componentref:
+        return doGetLastOp (b, b->componentrefF.field);
         break;
 
-      case decl_procedure:
-        /* blocks.  */
-        return n->procedureF.returnType;
+      case decl_pointerref:
+        return doGetLastOp (b, b->pointerrefF.field);
         break;
 
-      case decl_throw:
-        return NULL;
+      case decl_cast:
+        return doGetLastOp (b, b->binaryF.right);
         break;
 
-      case decl_unreachable:
-        return NULL;
+      case decl_val:
+        return doGetLastOp (b, b->binaryF.right);
         break;
 
-      case decl_def:
-      case decl_imp:
-      case decl_module:
-      case decl_loop:
-      case decl_while:
-      case decl_for:
-      case decl_repeat:
-      case decl_if:
-      case decl_elsif:
-      case decl_assignment:
-        /* statements.  */
-        M2RTS_HALT (-1);
-        __builtin_unreachable ();
+      case decl_plus:
+        return doGetLastOp (b, b->binaryF.right);
         break;
 
-      case decl_plus:
       case decl_sub:
-      case decl_div:
-      case decl_mod:
-      case decl_mult:
-      case decl_divide:
-        /* expressions.  */
-        return doSetExprType (&n->binaryF.resultType, mixTypes (getExprType (n->binaryF.left), getExprType (n->binaryF.right)));
+        return doGetLastOp (b, b->binaryF.right);
         break;
 
-      case decl_in:
-      case decl_and:
-      case decl_or:
-      case decl_equal:
-      case decl_notequal:
-      case decl_less:
-      case decl_greater:
-      case decl_greequal:
-      case decl_lessequal:
-        return doSetExprType (&n->binaryF.resultType, booleanN);
+      case decl_div:
+        return doGetLastOp (b, b->binaryF.right);
         break;
 
-      case decl_cmplx:
-        return doSetExprType (&n->binaryF.resultType, complexN);
+      case decl_mod:
+        return doGetLastOp (b, b->binaryF.right);
         break;
 
-      case decl_abs:
-      case decl_constexp:
-      case decl_deref:
-      case decl_neg:
-        return doSetExprType (&n->unaryF.resultType, getExprType (n->unaryF.arg));
+      case decl_mult:
+        return doGetLastOp (b, b->binaryF.right);
         break;
 
-      case decl_adr:
-        return doSetExprType (&n->unaryF.resultType, addressN);
+      case decl_divide:
+        return doGetLastOp (b, b->binaryF.right);
         break;
 
-      case decl_size:
-      case decl_tsize:
-        return doSetExprType (&n->unaryF.resultType, cardinalN);
+      case decl_in:
+        return doGetLastOp (b, b->binaryF.right);
         break;
 
-      case decl_high:
-      case decl_ord:
-        return doSetExprType (&n->unaryF.resultType, cardinalN);
+      case decl_and:
+        return doGetLastOp (b, b->binaryF.right);
         break;
 
-      case decl_float:
-        return doSetExprType (&n->unaryF.resultType, realN);
+      case decl_or:
+        return doGetLastOp (b, b->binaryF.right);
         break;
 
-      case decl_trunc:
-        return doSetExprType (&n->unaryF.resultType, integerN);
+      case decl_cmplx:
+        return doGetLastOp (b, b->binaryF.right);
         break;
 
-      case decl_chr:
-        return doSetExprType (&n->unaryF.resultType, charN);
+      case decl_literal:
+        return a;
         break;
 
-      case decl_cap:
-        return doSetExprType (&n->unaryF.resultType, charN);
+      case decl_const:
+        return a;
         break;
 
-      case decl_not:
-        return doSetExprType (&n->unaryF.resultType, booleanN);
+      case decl_enumerationfield:
+        return a;
         break;
 
-      case decl_re:
-        return doSetExprType (&n->unaryF.resultType, realN);
+      case decl_string:
+        return a;
         break;
 
-      case decl_im:
-        return doSetExprType (&n->unaryF.resultType, realN);
+      case decl_max:
+        return doGetLastOp (b, b->unaryF.arg);
         break;
 
-      case decl_arrayref:
-        return n->arrayrefF.resultType;
+      case decl_min:
+        return doGetLastOp (b, b->unaryF.arg);
         break;
 
-      case decl_componentref:
-        return n->componentrefF.resultType;
+      case decl_var:
+        return a;
         break;
 
-      case decl_pointerref:
-        return n->pointerrefF.resultType;
+      case decl_arrayref:
+        return a;
         break;
 
       case decl_funccall:
-        return doSetExprType (&n->funccallF.type, doGetFuncType (n));
+        return a;
         break;
 
-      case decl_setvalue:
-        return n->setvalueF.type;
+      case decl_procedure:
+        return a;
+        break;
+
+      case decl_recordfield:
+        return a;
         break;
 
 
@@ -9395,424 +9083,635 @@ static decl_node doGetExprType (decl_node n)
         CaseException ("../../gcc/m2/mc/decl.def", 20, 1);
         __builtin_unreachable ();
     }
-  M2RTS_HALT (-1);
-  __builtin_unreachable ();
-  ReturnException ("../../gcc/m2/mc/decl.def", 20, 1);
+  /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
 
 
 /*
-   getExprType - return the expression type.
+   doComponentRefC -
+*/
+
+static void doComponentRefC (mcPretty_pretty p, decl_node__opaque l, decl_node__opaque r)
+{
+  flushOpaque (p, l, false);
+  outText (p, (const char *) ".", 1);
+  doExprC (p, r);
+}
+
+
+/*
+   doPointerRefC -
+*/
+
+static void doPointerRefC (mcPretty_pretty p, decl_node__opaque l, decl_node__opaque r)
+{
+  flushOpaque (p, l, false);
+  outText (p, (const char *) "->", 2);
+  doExprC (p, r);
+}
+
+
+/*
+   doPreBinary -
 */
 
-static decl_node getExprType (decl_node n)
+static void doPreBinary (mcPretty_pretty p, const char *op_, unsigned int _op_high, decl_node__opaque left, decl_node__opaque right, bool l, bool r)
 {
-  decl_node t;
+  char op[_op_high+1];
+
+  /* make a local copy of each unbounded array.  */
+  memcpy (op, op_, _op_high+1);
 
-  if (((isFuncCall (n)) && ((decl_getType (n)) != NULL)) && (decl_isProcType (decl_skipType (decl_getType (n)))))
+  if (l)
     {
-      return decl_getType (decl_skipType (decl_getType (n)));
+      mcPretty_setNeedSpace (p);
     }
-  t = decl_getType (n);
-  if (t == NULL)
+  outText (p, (const char *) op, _op_high);
+  if (r)
     {
-      t = doGetExprType (n);
+      mcPretty_setNeedSpace (p);
     }
-  return t;
-  /* static analysis guarentees a RETURN statement will be used before here.  */
-  __builtin_unreachable ();
+  outText (p, (const char *) "(", 1);
+  doExprC (p, left);
+  outText (p, (const char *) ",", 1);
+  mcPretty_setNeedSpace (p);
+  doExprC (p, right);
+  outText (p, (const char *) ")", 1);
 }
 
 
 /*
-   openOutput -
+   doConstExpr -
 */
 
-static void openOutput (void)
+static void doConstExpr (mcPretty_pretty p, decl_node__opaque n)
 {
-  DynamicStrings_String s;
+  doFQNameC (p, n);
+}
 
-  s = mcOptions_getOutputFile ();
-  if (DynamicStrings_EqualArray (s, (const char *) "-", 1))
-    {
-      outputFile = FIO_StdOut;
-    }
-  else
+
+/*
+   doEnumerationField -
+*/
+
+static void doEnumerationField (mcPretty_pretty p, decl_node__opaque n)
+{
+  doFQDNameC (p, n, false);
+}
+
+
+/*
+   isZero - returns TRUE if node, n, is zero.
+*/
+
+static bool isZero (decl_node__opaque n)
+{
+  if (isConstExp (n))
     {
-      outputFile = SFIO_OpenToWrite (s);
+      return isZero (n->unaryF.arg);
     }
-  mcStream_setDest (outputFile);
+  return (decl_getSymName (static_cast<decl_node> (n))) == (nameKey_makeKey ((const char *) "0", 1));
+  /* static analysis guarentees a RETURN statement will be used before here.  */
+  __builtin_unreachable ();
 }
 
 
 /*
-   closeOutput -
+   doArrayRef - perform an array reference.  If constCast
+                then an unbounded array access will be const_cast
+                (the constCast should be TRUE if an assignment to
+                the array is required).
 */
 
-static void closeOutput (void)
+static void doArrayRef (mcPretty_pretty p, decl_node__opaque n, bool constCast)
 {
-  DynamicStrings_String s;
+  decl_node__opaque type;
+  decl_node__opaque v;
+  unsigned int i;
+  unsigned int c;
 
-  s = mcOptions_getOutputFile ();
-  outputFile = mcStream_combine ();
-  if (! (DynamicStrings_EqualArray (s, (const char *) "-", 1)))
+  mcDebug_assert (n != NULL);
+  mcDebug_assert (isArrayRef (n));
+  type = static_cast<decl_node__opaque> (decl_skipType (decl_getType (static_cast<decl_node> (n->arrayrefF.array))));
+  if (decl_isUnbounded (static_cast<decl_node> (type)))
     {
-      FIO_Close (outputFile);
+      v = n->arrayrefF.array;
+      if ((constCast && (decl_isVar (static_cast<decl_node> (n->arrayrefF.array)))) && (v->varF.isParameter || v->varF.isVarParameter))
+        {
+          outText (p, (const char *) "const_cast<", 11);
+          doTypeNameC (p, static_cast<decl_node__opaque> (decl_getType (static_cast<decl_node> (v))));
+          outText (p, (const char *) ">(", 2);
+          outTextN (p, decl_getSymName (static_cast<decl_node> (n->arrayrefF.array)));
+          outText (p, (const char *) ")", 1);
+        }
+      else
+        {
+          outTextN (p, decl_getSymName (static_cast<decl_node> (n->arrayrefF.array)));
+        }
+    }
+  else
+    {
+      doExprC (p, n->arrayrefF.array);
+      mcDebug_assert (decl_isArray (static_cast<decl_node> (type)));
+      outText (p, (const char *) ".array", 6);
+    }
+  outText (p, (const char *) "[", 1);
+  i = 1;
+  c = expListLen (n->arrayrefF.index);
+  while (i <= c)
+    {
+      doExprC (p, getExpList (n->arrayrefF.index, i));
+      if (decl_isUnbounded (static_cast<decl_node> (type)))
+        {
+          mcDebug_assert (c == 1);
+        }
+      else
+        {
+          doSubtractC (p, getMin (type->arrayF.subr));
+          if (i < c)
+            {
+              mcDebug_assert (decl_isArray (static_cast<decl_node> (type)));
+              outText (p, (const char *) "].array[", 8);
+              type = static_cast<decl_node__opaque> (decl_skipType (decl_getType (static_cast<decl_node> (type))));
+            }
+        }
+      i += 1;
     }
+  outText (p, (const char *) "]", 1);
 }
 
 
 /*
-   write - outputs a single char, ch.
+   doProcedure -
 */
 
-static void write_ (char ch)
+static void doProcedure (mcPretty_pretty p, decl_node__opaque n)
 {
-  FIO_WriteChar (outputFile, ch);
-  FIO_FlushBuffer (outputFile);
+  mcDebug_assert (decl_isProcedure (static_cast<decl_node> (n)));
+  doFQDNameC (p, n, true);
 }
 
 
 /*
-   writeln -
+   doRecordfield -
 */
 
-static void writeln (void)
+static void doRecordfield (mcPretty_pretty p, decl_node__opaque n)
 {
-  FIO_WriteLine (outputFile);
-  FIO_FlushBuffer (outputFile);
+  doDNameC (p, n, false);
 }
 
 
 /*
-   doIncludeC - include header file for definition module, n.
+   doCastC -
 */
 
-static void doIncludeC (decl_node n)
+static void doCastC (mcPretty_pretty p, decl_node__opaque t, decl_node__opaque e)
 {
-  DynamicStrings_String s;
+  decl_node__opaque et;
 
-  s = DynamicStrings_InitStringCharStar (nameKey_keyToCharStar (decl_getSymName (n)));
-  if (mcOptions_getExtendedOpaque ())
-    {}  /* empty.  */
-  /* no include in this case.  */
-  else if (decl_isDef (n))
+  outText (p, (const char *) "(", 1);
+  doTypeNameC (p, t);
+  outText (p, (const char *) ")", 1);
+  mcPretty_setNeedSpace (p);
+  et = static_cast<decl_node__opaque> (decl_skipType (decl_getType (static_cast<decl_node> (e))));
+  if (((et != NULL) && (isAProcType (et))) && (isAProcType (static_cast<decl_node__opaque> (decl_skipType (static_cast<decl_node> (t))))))
     {
-      /* avoid dangling else.  */
-      mcPretty_print (doP, (const char *) "#   include \"", 13);
-      mcPretty_prints (doP, mcOptions_getHPrefix ());
-      mcPretty_prints (doP, s);
-      mcPretty_print (doP, (const char *) ".h\"\\n", 5);
-      symbolKey_foreachNodeDo (n->defF.decls.symbols, (symbolKey_performOperation) {(symbolKey_performOperation_t) addDoneDef});
+      outText (p, (const char *) "{(", 2);
+      doFQNameC (p, t);
+      outText (p, (const char *) "_t)", 3);
+      mcPretty_setNeedSpace (p);
+      doExprC (p, e);
+      outText (p, (const char *) ".proc}", 6);
+    }
+  else
+    {
+      outText (p, (const char *) "(", 1);
+      doExprC (p, e);
+      outText (p, (const char *) ")", 1);
     }
-  s = DynamicStrings_KillString (s);
 }
 
 
 /*
-   getSymScope - returns the scope where node, n, was declared.
+   doSetValueC -
 */
 
-static decl_node getSymScope (decl_node n)
+static void doSetValueC (mcPretty_pretty p, decl_node__opaque n)
 {
-  switch (n->kind)
-    {
-      case decl_const:
-        return n->constF.scope;
-        break;
-
-      case decl_type:
-        return n->typeF.scope;
-        break;
-
-      case decl_var:
-        return n->varF.scope;
-        break;
-
-      case decl_procedure:
-        return n->procedureF.scope;
-        break;
-
+  decl_node__opaque lo;
+  unsigned int i;
+  unsigned int h;
 
-      default:
-        CaseException ("../../gcc/m2/mc/decl.def", 20, 1);
-        __builtin_unreachable ();
+  mcDebug_assert (decl_isSetValue (static_cast<decl_node> (n)));
+  lo = getSetLow (n);
+  if (n->setvalueF.type != NULL)
+    {
+      outText (p, (const char *) "(", 1);
+      doTypeNameC (p, n->setvalueF.type);
+      mcPretty_noSpace (p);
+      outText (p, (const char *) ")", 1);
+      mcPretty_setNeedSpace (p);
+    }
+  if ((Indexing_HighIndice (n->setvalueF.values)) == 0)
+    {
+      outText (p, (const char *) "0", 1);
+    }
+  else
+    {
+      i = Indexing_LowIndice (n->setvalueF.values);
+      h = Indexing_HighIndice (n->setvalueF.values);
+      outText (p, (const char *) "(", 1);
+      while (i <= h)
+        {
+          outText (p, (const char *) "(1", 2);
+          mcPretty_setNeedSpace (p);
+          outText (p, (const char *) "<<", 2);
+          mcPretty_setNeedSpace (p);
+          outText (p, (const char *) "(", 1);
+          doExprC (p, static_cast<decl_node__opaque> (Indexing_GetIndice (n->setvalueF.values, i)));
+          doSubtractC (p, lo);
+          outText (p, (const char *) ")", 1);
+          outText (p, (const char *) ")", 1);
+          if (i < h)
+            {
+              mcPretty_setNeedSpace (p);
+              outText (p, (const char *) "|", 1);
+              mcPretty_setNeedSpace (p);
+            }
+          i += 1;
+        }
+      outText (p, (const char *) ")", 1);
     }
-  M2RTS_HALT (-1);
-  __builtin_unreachable ();
-  ReturnException ("../../gcc/m2/mc/decl.def", 20, 1);
-  __builtin_unreachable ();
 }
 
 
 /*
-   isQualifiedForced - should the node be written with a module prefix?
+   getSetLow - returns the low value of the set type from
+               expression, n.
 */
 
-static bool isQualifiedForced (decl_node n)
+static decl_node__opaque getSetLow (decl_node__opaque n)
 {
-  return forceQualified && (((((decl_isType (n)) || (decl_isRecord (n))) || (decl_isArray (n))) || (decl_isEnumeration (n))) || (decl_isEnumerationField (n)));
+  decl_node__opaque type;
+
+  if ((decl_getType (static_cast<decl_node> (n))) == NULL)
+    {
+      return static_cast<decl_node__opaque> (decl_makeLiteralInt (nameKey_makeKey ((const char *) "0", 1)));
+    }
+  else
+    {
+      type = static_cast<decl_node__opaque> (decl_skipType (decl_getType (static_cast<decl_node> (n))));
+      if (decl_isSet (static_cast<decl_node> (type)))
+        {
+          return getMin (static_cast<decl_node__opaque> (decl_skipType (decl_getType (static_cast<decl_node> (type)))));
+        }
+      else
+        {
+          return static_cast<decl_node__opaque> (decl_makeLiteralInt (nameKey_makeKey ((const char *) "0", 1)));
+        }
+    }
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
 
 
 /*
-   getFQstring -
+   doInC - performs (((1 << (l)) & (r)) != 0)
 */
 
-static DynamicStrings_String getFQstring (decl_node n)
+static void doInC (mcPretty_pretty p, decl_node__opaque l, decl_node__opaque r)
 {
-  DynamicStrings_String i;
-  DynamicStrings_String s;
+  decl_node__opaque lo;
 
-  if ((decl_getScope (n)) == NULL)
-    {
-      return DynamicStrings_InitStringCharStar (nameKey_keyToCharStar (decl_getSymName (n)));
-    }
-  else if (isQualifiedForced (n))
-    {
-      /* avoid dangling else.  */
-      i = DynamicStrings_InitStringCharStar (nameKey_keyToCharStar (decl_getSymName (n)));
-      s = DynamicStrings_InitStringCharStar (nameKey_keyToCharStar (decl_getSymName (decl_getScope (n))));
-      return FormatStrings_Sprintf2 (DynamicStrings_InitString ((const char *) "%s_%s", 5), (const unsigned char *) &s, (sizeof (s)-1), (const unsigned char *) &i, (sizeof (i)-1));
-    }
-  else if ((! (decl_isExported (n))) || (mcOptions_getIgnoreFQ ()))
-    {
-      /* avoid dangling else.  */
-      return DynamicStrings_InitStringCharStar (nameKey_keyToCharStar (decl_getSymName (n)));
-    }
-  else
-    {
-      /* avoid dangling else.  */
-      i = DynamicStrings_InitStringCharStar (nameKey_keyToCharStar (decl_getSymName (n)));
-      s = DynamicStrings_InitStringCharStar (nameKey_keyToCharStar (decl_getSymName (decl_getScope (n))));
-      return FormatStrings_Sprintf2 (DynamicStrings_InitString ((const char *) "%s_%s", 5), (const unsigned char *) &s, (sizeof (s)-1), (const unsigned char *) &i, (sizeof (i)-1));
-    }
-  /* static analysis guarentees a RETURN statement will be used before here.  */
-  __builtin_unreachable ();
+  lo = getSetLow (r);
+  outText (p, (const char *) "(((1", 4);
+  mcPretty_setNeedSpace (p);
+  outText (p, (const char *) "<<", 2);
+  mcPretty_setNeedSpace (p);
+  outText (p, (const char *) "(", 1);
+  doExprC (p, l);
+  doSubtractC (p, lo);
+  outText (p, (const char *) "))", 2);
+  mcPretty_setNeedSpace (p);
+  outText (p, (const char *) "&", 1);
+  mcPretty_setNeedSpace (p);
+  outText (p, (const char *) "(", 1);
+  doExprC (p, r);
+  outText (p, (const char *) "))", 2);
+  mcPretty_setNeedSpace (p);
+  outText (p, (const char *) "!=", 2);
+  mcPretty_setNeedSpace (p);
+  outText (p, (const char *) "0)", 2);
 }
 
 
 /*
-   getFQDstring -
+   doThrowC -
 */
 
-static DynamicStrings_String getFQDstring (decl_node n, bool scopes)
+static void doThrowC (mcPretty_pretty p, decl_node__opaque n)
 {
-  DynamicStrings_String i;
-  DynamicStrings_String s;
-
-  if ((decl_getScope (n)) == NULL)
-    {
-      return DynamicStrings_InitStringCharStar (nameKey_keyToCharStar (getDName (n, scopes)));
-    }
-  else if (isQualifiedForced (n))
-    {
-      /* avoid dangling else.  */
-      /* we assume a qualified name will never conflict.  */
-      i = DynamicStrings_InitStringCharStar (nameKey_keyToCharStar (decl_getSymName (n)));
-      s = DynamicStrings_InitStringCharStar (nameKey_keyToCharStar (decl_getSymName (decl_getScope (n))));
-      return FormatStrings_Sprintf2 (DynamicStrings_InitString ((const char *) "%s_%s", 5), (const unsigned char *) &s, (sizeof (s)-1), (const unsigned char *) &i, (sizeof (i)-1));
-    }
-  else if ((! (decl_isExported (n))) || (mcOptions_getIgnoreFQ ()))
-    {
-      /* avoid dangling else.  */
-      return DynamicStrings_InitStringCharStar (nameKey_keyToCharStar (getDName (n, scopes)));
-    }
-  else
+  mcDebug_assert (isIntrinsic (n));
+  outText (p, (const char *) "throw", 5);
+  mcPretty_setNeedSpace (p);
+  outText (p, (const char *) "(", 1);
+  if ((expListLen (n->intrinsicF.args)) == 1)
     {
-      /* avoid dangling else.  */
-      /* we assume a qualified name will never conflict.  */
-      i = DynamicStrings_InitStringCharStar (nameKey_keyToCharStar (decl_getSymName (n)));
-      s = DynamicStrings_InitStringCharStar (nameKey_keyToCharStar (decl_getSymName (decl_getScope (n))));
-      return FormatStrings_Sprintf2 (DynamicStrings_InitString ((const char *) "%s_%s", 5), (const unsigned char *) &s, (sizeof (s)-1), (const unsigned char *) &i, (sizeof (i)-1));
+      doExprC (p, getExpList (n->intrinsicF.args, 1));
     }
-  /* static analysis guarentees a RETURN statement will be used before here.  */
-  __builtin_unreachable ();
+  outText (p, (const char *) ")", 1);
 }
 
 
 /*
-   getString - returns the name as a string.
+   doUnreachableC -
 */
 
-static DynamicStrings_String getString (decl_node n)
+static void doUnreachableC (mcPretty_pretty p, decl_node__opaque n)
 {
-  if ((decl_getSymName (n)) == nameKey_NulName)
-    {
-      return DynamicStrings_InitString ((const char *) "", 0);
-    }
-  else
-    {
-      return DynamicStrings_InitStringCharStar (nameKey_keyToCharStar (decl_getSymName (n)));
-    }
-  /* static analysis guarentees a RETURN statement will be used before here.  */
-  __builtin_unreachable ();
+  mcDebug_assert (isIntrinsic (n));
+  outText (p, (const char *) "__builtin_unreachable", 21);
+  mcPretty_setNeedSpace (p);
+  outText (p, (const char *) "(", 1);
+  mcDebug_assert ((expListLen (n->intrinsicF.args)) == 0);
+  outText (p, (const char *) ")", 1);
 }
 
 
 /*
-   doNone - call HALT.
+   outNull -
 */
 
-static void doNone (decl_node n)
+static void outNull (mcPretty_pretty p)
 {
-  M2RTS_HALT (-1);
-  __builtin_unreachable ();
+  keyc_useNull ();
+  outText (p, (const char *) "NULL", 4);
 }
 
 
 /*
-   doNothing - does nothing!
+   outTrue -
 */
 
-static void doNothing (decl_node n)
+static void outTrue (mcPretty_pretty p)
 {
+  keyc_useTrue ();
+  if ((mcOptions_useBool ()) && (lang == decl_ansiCP))
+    {
+      outText (p, (const char *) "true", 4);
+    }
+  else
+    {
+      outText (p, (const char *) "TRUE", 4);
+    }
 }
 
 
 /*
-   doConstC -
+   outFalse -
 */
 
-static void doConstC (decl_node n)
+static void outFalse (mcPretty_pretty p)
 {
-  if (! (alists_isItemInList (globalGroup->doneQ, reinterpret_cast<void *> (n))))
+  keyc_useFalse ();
+  if ((mcOptions_useBool ()) && (lang == decl_ansiCP))
     {
-      mcPretty_print (doP, (const char *) "#   define ", 11);
-      doFQNameC (doP, n);
-      mcPretty_setNeedSpace (doP);
-      doExprC (doP, n->constF.value);
-      mcPretty_print (doP, (const char *) "\\n", 2);
-      alists_includeItemIntoList (globalGroup->doneQ, reinterpret_cast<void *> (n));
+      outText (p, (const char *) "false", 5);
+    }
+  else
+    {
+      outText (p, (const char *) "FALSE", 5);
     }
 }
 
 
 /*
-   needsParen - returns TRUE if expression, n, needs to be enclosed in ().
+   doExprC -
 */
 
-static bool needsParen (decl_node n)
+static void doExprC (mcPretty_pretty p, decl_node__opaque n)
 {
+  decl_node__opaque t;
+
   mcDebug_assert (n != NULL);
+  t = getExprType (n);
   switch (n->kind)
     {
       case decl_nil:
+        outNull (p);
+        break;
+
       case decl_true:
+        outTrue (p);
+        break;
+
       case decl_false:
-        return false;
+        outFalse (p);
         break;
 
       case decl_constexp:
-        return needsParen (n->unaryF.arg);
+        doUnary (p, (const char *) "", 0, n->unaryF.arg, n->unaryF.resultType, false, false);
         break;
 
       case decl_neg:
-        return needsParen (n->unaryF.arg);
+        doUnary (p, (const char *) "-", 1, n->unaryF.arg, n->unaryF.resultType, false, false);
         break;
 
       case decl_not:
-        return needsParen (n->unaryF.arg);
+        doUnary (p, (const char *) "!", 1, n->unaryF.arg, n->unaryF.resultType, false, true);
+        break;
+
+      case decl_val:
+        doValC (p, n);
         break;
 
       case decl_adr:
+        doAdrC (p, n);
+        break;
+
       case decl_size:
       case decl_tsize:
-      case decl_ord:
+        doSizeC (p, n);
+        break;
+
       case decl_float:
+        doConvertSC (p, n, mcOptions_getCRealType ());
+        break;
+
       case decl_trunc:
+        doConvertC (p, n, (const char *) "int", 3);
+        break;
+
+      case decl_ord:
+        doConvertC (p, n, (const char *) "unsigned int", 12);
+        break;
+
       case decl_chr:
+        doConvertC (p, n, (const char *) "char", 4);
+        break;
+
       case decl_cap:
+        doCapC (p, n);
+        break;
+
+      case decl_abs:
+        doAbsC (p, n);
+        break;
+
       case decl_high:
-        return false;
+        doFuncHighC (p, n->unaryF.arg);
+        break;
+
+      case decl_length:
+        doLengthC (p, n);
+        break;
+
+      case decl_min:
+        doMinC (p, n);
+        break;
+
+      case decl_max:
+        doMaxC (p, n);
+        break;
+
+      case decl_throw:
+        doThrowC (p, n);
+        break;
+
+      case decl_unreachable:
+        doUnreachableC (p, n);
+        break;
+
+      case decl_re:
+        doReC (p, n);
+        break;
+
+      case decl_im:
+        doImC (p, n);
+        break;
+
+      case decl_cmplx:
+        doCmplx (p, n);
         break;
 
       case decl_deref:
-        return false;
+        n->unaryF.arg = doDeRefC (p, n->unaryF.arg);
         break;
 
       case decl_equal:
+        doBinary (p, (const char *) "==", 2, n->binaryF.left, n->binaryF.right, true, true, true);
+        break;
+
       case decl_notequal:
+        doBinary (p, (const char *) "!=", 2, n->binaryF.left, n->binaryF.right, true, true, true);
+        break;
+
       case decl_less:
+        doBinary (p, (const char *) "<", 1, n->binaryF.left, n->binaryF.right, true, true, false);
+        break;
+
       case decl_greater:
+        doBinary (p, (const char *) ">", 1, n->binaryF.left, n->binaryF.right, true, true, false);
+        break;
+
       case decl_greequal:
+        doBinary (p, (const char *) ">=", 2, n->binaryF.left, n->binaryF.right, true, true, false);
+        break;
+
       case decl_lessequal:
-        return true;
+        doBinary (p, (const char *) "<=", 2, n->binaryF.left, n->binaryF.right, true, true, false);
         break;
 
       case decl_componentref:
-        return false;
+        doComponentRefC (p, n->componentrefF.rec, n->componentrefF.field);
         break;
 
       case decl_pointerref:
-        return false;
+        doPointerRefC (p, n->pointerrefF.ptr, n->pointerrefF.field);
+        break;
+
+      case decl_cast:
+        doCastC (p, n->binaryF.left, n->binaryF.right);
+        break;
+
+      case decl_plus:
+        doPolyBinary (p, decl_plus, n->binaryF.left, n->binaryF.right, false, false);
+        break;
+
+      case decl_sub:
+        doPolyBinary (p, decl_sub, n->binaryF.left, n->binaryF.right, false, false);
+        break;
+
+      case decl_div:
+        doBinary (p, (const char *) "/", 1, n->binaryF.left, n->binaryF.right, true, true, false);
+        break;
+
+      case decl_mod:
+        doBinary (p, (const char *) "%", 1, n->binaryF.left, n->binaryF.right, true, true, false);
+        break;
+
+      case decl_mult:
+        doPolyBinary (p, decl_mult, n->binaryF.left, n->binaryF.right, false, false);
+        break;
+
+      case decl_divide:
+        doPolyBinary (p, decl_divide, n->binaryF.left, n->binaryF.right, false, false);
         break;
 
-      case decl_cast:
-        return true;
+      case decl_in:
+        doInC (p, n->binaryF.left, n->binaryF.right);
         break;
 
-      case decl_val:
-        return true;
+      case decl_and:
+        doBinary (p, (const char *) "&&", 2, n->binaryF.left, n->binaryF.right, true, true, false);
         break;
 
-      case decl_abs:
-        return false;
+      case decl_or:
+        doBinary (p, (const char *) "||", 2, n->binaryF.left, n->binaryF.right, true, true, false);
         break;
 
-      case decl_plus:
-      case decl_sub:
-      case decl_div:
-      case decl_mod:
-      case decl_mult:
-      case decl_divide:
-      case decl_in:
-        return true;
+      case decl_literal:
+        doLiteralC (p, n);
         break;
 
-      case decl_literal:
       case decl_const:
-      case decl_enumerationfield:
-      case decl_string:
-        return false;
+        doConstExpr (p, n);
         break;
 
-      case decl_max:
-        return true;
+      case decl_enumerationfield:
+        doEnumerationField (p, n);
         break;
 
-      case decl_min:
-        return true;
+      case decl_string:
+        doStringC (p, n);
         break;
 
       case decl_var:
-        return false;
+        doVar (p, n);
         break;
 
       case decl_arrayref:
-        return false;
+        doArrayRef (p, n, false);
         break;
 
-      case decl_and:
-      case decl_or:
-        return true;
+      case decl_funccall:
+        doFuncExprC (p, n);
         break;
 
-      case decl_funccall:
-        return true;
+      case decl_procedure:
+        doProcedure (p, n);
         break;
 
       case decl_recordfield:
-        return false;
+        doRecordfield (p, n);
+        break;
+
+      case decl_setvalue:
+        doSetValueC (p, n);
         break;
 
-      case decl_loc:
-      case decl_byte:
-      case decl_word:
-      case decl_type:
       case decl_char:
       case decl_cardinal:
       case decl_longcard:
@@ -9820,448 +9719,248 @@ static bool needsParen (decl_node n)
       case decl_integer:
       case decl_longint:
       case decl_shortint:
-      case decl_real:
-      case decl_longreal:
-      case decl_shortreal:
       case decl_complex:
       case decl_longcomplex:
       case decl_shortcomplex:
+      case decl_real:
+      case decl_longreal:
+      case decl_shortreal:
       case decl_bitset:
       case decl_boolean:
       case decl_proc:
-        return false;
-        break;
-
-      case decl_setvalue:
-        return false;
+        doBaseC (p, n);
         break;
 
       case decl_address:
-        return true;
-        break;
-
-      case decl_procedure:
-        return false;
-        break;
-
-      case decl_length:
-      case decl_cmplx:
-      case decl_re:
-      case decl_im:
-        return true;
-        break;
-
-
-      default:
-        CaseException ("../../gcc/m2/mc/decl.def", 20, 1);
-        __builtin_unreachable ();
-    }
-  return true;
-  /* static analysis guarentees a RETURN statement will be used before here.  */
-  __builtin_unreachable ();
-}
-
-
-/*
-   doUnary -
-*/
-
-static void doUnary (mcPretty_pretty p, const char *op_, unsigned int _op_high, decl_node expr, decl_node type, bool l, bool r)
-{
-  char op[_op_high+1];
-
-  /* make a local copy of each unbounded array.  */
-  memcpy (op, op_, _op_high+1);
-
-  if (l)
-    {
-      mcPretty_setNeedSpace (p);
-    }
-  mcPretty_print (p, (const char *) op, _op_high);
-  if (r)
-    {
-      mcPretty_setNeedSpace (p);
-    }
-  if (needsParen (expr))
-    {
-      outText (p, (const char *) "(", 1);
-      doExprC (p, expr);
-      outText (p, (const char *) ")", 1);
-    }
-  else
-    {
-      doExprC (p, expr);
-    }
-}
-
-
-/*
-   doSetSub - perform  l & (~ r)
-*/
-
-static void doSetSub (mcPretty_pretty p, decl_node left, decl_node right)
-{
-  if (needsParen (left))
-    {
-      outText (p, (const char *) "(", 1);
-      doExprC (p, left);
-      outText (p, (const char *) ")", 1);
-    }
-  else
-    {
-      doExprC (p, left);
-    }
-  mcPretty_setNeedSpace (p);
-  outText (p, (const char *) "&", 1);
-  mcPretty_setNeedSpace (p);
-  if (needsParen (right))
-    {
-      outText (p, (const char *) "(~(", 3);
-      doExprC (p, right);
-      outText (p, (const char *) "))", 2);
-    }
-  else
-    {
-      outText (p, (const char *) "(~", 2);
-      doExprC (p, right);
-      outText (p, (const char *) ")", 1);
-    }
-}
-
-
-/*
-   doPolyBinary -
-*/
-
-static void doPolyBinary (mcPretty_pretty p, decl_nodeT op, decl_node left, decl_node right, bool l, bool r)
-{
-  decl_node lt;
-  decl_node rt;
-
-  lt = decl_skipType (getExprType (left));
-  rt = decl_skipType (getExprType (right));
-  if (((lt != NULL) && ((decl_isSet (lt)) || (isBitset (lt)))) || ((rt != NULL) && ((decl_isSet (rt)) || (isBitset (rt)))))
-    {
-      switch (op)
-        {
-          case decl_plus:
-            doBinary (p, (const char *) "|", 1, left, right, l, r, false);
-            break;
-
-          case decl_sub:
-            doSetSub (p, left, right);
-            break;
-
-          case decl_mult:
-            doBinary (p, (const char *) "&", 1, left, right, l, r, false);
-            break;
-
-          case decl_divide:
-            doBinary (p, (const char *) "^", 1, left, right, l, r, false);
-            break;
-
-
-          default:
-            CaseException ("../../gcc/m2/mc/decl.def", 20, 1);
-            __builtin_unreachable ();
-        }
-    }
-  else
-    {
-      switch (op)
-        {
-          case decl_plus:
-            doBinary (p, (const char *) "+", 1, left, right, l, r, false);
-            break;
-
-          case decl_sub:
-            doBinary (p, (const char *) "-", 1, left, right, l, r, false);
-            break;
-
-          case decl_mult:
-            doBinary (p, (const char *) "*", 1, left, right, l, r, false);
-            break;
-
-          case decl_divide:
-            doBinary (p, (const char *) "/", 1, left, right, l, r, false);
-            break;
-
-
-          default:
-            CaseException ("../../gcc/m2/mc/decl.def", 20, 1);
-            __builtin_unreachable ();
-        }
-    }
-}
-
-
-/*
-   doBinary -
-*/
-
-static void doBinary (mcPretty_pretty p, const char *op_, unsigned int _op_high, decl_node left, decl_node right, bool l, bool r, bool unpackProc)
-{
-  char op[_op_high+1];
-
-  /* make a local copy of each unbounded array.  */
-  memcpy (op, op_, _op_high+1);
-
-  if (needsParen (left))
-    {
-      outText (p, (const char *) "(", 1);
-      doExprCup (p, left, unpackProc);
-      outText (p, (const char *) ")", 1);
-    }
-  else
-    {
-      doExprCup (p, left, unpackProc);
-    }
-  if (l)
-    {
-      mcPretty_setNeedSpace (p);
-    }
-  outText (p, (const char *) op, _op_high);
-  if (r)
-    {
-      mcPretty_setNeedSpace (p);
-    }
-  if (needsParen (right))
-    {
-      outText (p, (const char *) "(", 1);
-      doExprCup (p, right, unpackProc);
-      outText (p, (const char *) ")", 1);
-    }
-  else
-    {
-      doExprCup (p, right, unpackProc);
-    }
-}
-
+      case decl_loc:
+      case decl_byte:
+      case decl_word:
+      case decl_csizet:
+      case decl_cssizet:
+        doSystemC (p, n);
+        break;
 
-/*
-   doPostUnary -
-*/
+      case decl_type:
+        doTypeNameC (p, n);
+        break;
 
-static void doPostUnary (mcPretty_pretty p, const char *op_, unsigned int _op_high, decl_node expr)
-{
-  char op[_op_high+1];
+      case decl_pointer:
+        doTypeNameC (p, n);
+        break;
 
-  /* make a local copy of each unbounded array.  */
-  memcpy (op, op_, _op_high+1);
 
-  doExprC (p, expr);
-  outText (p, (const char *) op, _op_high);
+      default:
+        CaseException ("../../gcc/m2/mc/decl.def", 20, 1);
+        __builtin_unreachable ();
+    }
 }
 
 
 /*
-   doDeRefC -
+   doExprCup -
 */
 
-static void doDeRefC (mcPretty_pretty p, decl_node expr)
+static decl_node__opaque doExprCup (mcPretty_pretty p, decl_node__opaque n, bool unpackProc, bool uncastConst)
 {
-  outText (p, (const char *) "(*", 2);
-  doExprC (p, expr);
-  outText (p, (const char *) ")", 1);
+  decl_node__opaque type;
+
+  if (uncastConst && (isArrayRef (n)))
+    {
+      doArrayRef (p, n, true);
+    }
+  else
+    {
+      doExprC (p, n);
+      if (unpackProc)
+        {
+          type = static_cast<decl_node__opaque> (decl_skipType (static_cast<decl_node> (getExprType (n))));
+          if ((type != NULL) && (isAProcType (type)))
+            {
+              outText (p, (const char *) ".proc", 5);
+            }
+        }
+    }
+  return n;
+  /* static analysis guarentees a RETURN statement will be used before here.  */
+  __builtin_unreachable ();
 }
 
 
 /*
-   doGetLastOp - returns, a, if b is a terminal otherwise walk right.
+   doExprM2 -
 */
 
-static decl_node doGetLastOp (decl_node a, decl_node b)
+static void doExprM2 (mcPretty_pretty p, decl_node__opaque n)
 {
-  switch (b->kind)
+  mcDebug_assert (n != NULL);
+  switch (n->kind)
     {
       case decl_nil:
-        return a;
+        outText (p, (const char *) "NIL", 3);
         break;
 
       case decl_true:
-        return a;
+        outText (p, (const char *) "TRUE", 4);
         break;
 
       case decl_false:
-        return a;
+        outText (p, (const char *) "FALSE", 5);
         break;
 
       case decl_constexp:
-        return doGetLastOp (b, b->unaryF.arg);
+        doUnary (p, (const char *) "", 0, n->unaryF.arg, n->unaryF.resultType, false, false);
         break;
 
       case decl_neg:
-        return doGetLastOp (b, b->unaryF.arg);
+        doUnary (p, (const char *) "-", 1, n->unaryF.arg, n->unaryF.resultType, false, false);
         break;
 
       case decl_not:
-        return doGetLastOp (b, b->unaryF.arg);
+        doUnary (p, (const char *) "NOT", 3, n->unaryF.arg, n->unaryF.resultType, true, true);
         break;
 
       case decl_adr:
-        return doGetLastOp (b, b->unaryF.arg);
+        doUnary (p, (const char *) "ADR", 3, n->unaryF.arg, n->unaryF.resultType, true, true);
         break;
 
       case decl_size:
-        return doGetLastOp (b, b->unaryF.arg);
+        doUnary (p, (const char *) "SIZE", 4, n->unaryF.arg, n->unaryF.resultType, true, true);
         break;
 
       case decl_tsize:
-        return doGetLastOp (b, b->unaryF.arg);
+        doUnary (p, (const char *) "TSIZE", 5, n->unaryF.arg, n->unaryF.resultType, true, true);
         break;
 
-      case decl_ord:
-        return doGetLastOp (b, b->unaryF.arg);
+      case decl_float:
+        doUnary (p, (const char *) "FLOAT", 5, n->unaryF.arg, n->unaryF.resultType, true, true);
         break;
 
-      case decl_float:
       case decl_trunc:
-        return doGetLastOp (b, b->unaryF.arg);
+        doUnary (p, (const char *) "TRUNC", 5, n->unaryF.arg, n->unaryF.resultType, true, true);
+        break;
+
+      case decl_ord:
+        doUnary (p, (const char *) "ORD", 3, n->unaryF.arg, n->unaryF.resultType, true, true);
         break;
 
       case decl_chr:
-        return doGetLastOp (b, b->unaryF.arg);
+        doUnary (p, (const char *) "CHR", 3, n->unaryF.arg, n->unaryF.resultType, true, true);
         break;
 
       case decl_cap:
-        return doGetLastOp (b, b->unaryF.arg);
+        doUnary (p, (const char *) "CAP", 3, n->unaryF.arg, n->unaryF.resultType, true, true);
         break;
 
       case decl_high:
-        return doGetLastOp (b, b->unaryF.arg);
+        doUnary (p, (const char *) "HIGH", 4, n->unaryF.arg, n->unaryF.resultType, true, true);
         break;
 
-      case decl_deref:
-        return doGetLastOp (b, b->unaryF.arg);
+      case decl_re:
+        doUnary (p, (const char *) "RE", 2, n->unaryF.arg, n->unaryF.resultType, true, true);
         break;
 
-      case decl_re:
       case decl_im:
-        return doGetLastOp (b, b->unaryF.arg);
+        doUnary (p, (const char *) "IM", 2, n->unaryF.arg, n->unaryF.resultType, true, true);
+        break;
+
+      case decl_deref:
+        doPostUnary (p, (const char *) "^", 1, n->unaryF.arg);
         break;
 
       case decl_equal:
-        return doGetLastOp (b, b->binaryF.right);
+        doBinary (p, (const char *) "=", 1, n->binaryF.left, n->binaryF.right, true, true, false);
         break;
 
       case decl_notequal:
-        return doGetLastOp (b, b->binaryF.right);
+        doBinary (p, (const char *) "#", 1, n->binaryF.left, n->binaryF.right, true, true, false);
         break;
 
       case decl_less:
-        return doGetLastOp (b, b->binaryF.right);
+        doBinary (p, (const char *) "<", 1, n->binaryF.left, n->binaryF.right, true, true, false);
         break;
 
       case decl_greater:
-        return doGetLastOp (b, b->binaryF.right);
+        doBinary (p, (const char *) ">", 1, n->binaryF.left, n->binaryF.right, true, true, false);
         break;
 
       case decl_greequal:
-        return doGetLastOp (b, b->binaryF.right);
+        doBinary (p, (const char *) ">=", 2, n->binaryF.left, n->binaryF.right, true, true, false);
         break;
 
       case decl_lessequal:
-        return doGetLastOp (b, b->binaryF.right);
+        doBinary (p, (const char *) "<=", 2, n->binaryF.left, n->binaryF.right, true, true, false);
         break;
 
       case decl_componentref:
-        return doGetLastOp (b, b->componentrefF.field);
+        doBinary (p, (const char *) ".", 1, n->componentrefF.rec, n->componentrefF.field, false, false, false);
         break;
 
       case decl_pointerref:
-        return doGetLastOp (b, b->pointerrefF.field);
+        doBinary (p, (const char *) "^.", 2, n->pointerrefF.ptr, n->pointerrefF.field, false, false, false);
         break;
 
       case decl_cast:
-        return doGetLastOp (b, b->binaryF.right);
+        doPreBinary (p, (const char *) "CAST", 4, n->binaryF.left, n->binaryF.right, true, true);
         break;
 
       case decl_val:
-        return doGetLastOp (b, b->binaryF.right);
+        doPreBinary (p, (const char *) "VAL", 3, n->binaryF.left, n->binaryF.right, true, true);
+        break;
+
+      case decl_cmplx:
+        doPreBinary (p, (const char *) "CMPLX", 5, n->binaryF.left, n->binaryF.right, true, true);
         break;
 
       case decl_plus:
-        return doGetLastOp (b, b->binaryF.right);
+        doBinary (p, (const char *) "+", 1, n->binaryF.left, n->binaryF.right, false, false, false);
         break;
 
       case decl_sub:
-        return doGetLastOp (b, b->binaryF.right);
+        doBinary (p, (const char *) "-", 1, n->binaryF.left, n->binaryF.right, false, false, false);
         break;
 
       case decl_div:
-        return doGetLastOp (b, b->binaryF.right);
+        doBinary (p, (const char *) "DIV", 3, n->binaryF.left, n->binaryF.right, true, true, false);
         break;
 
       case decl_mod:
-        return doGetLastOp (b, b->binaryF.right);
+        doBinary (p, (const char *) "MOD", 3, n->binaryF.left, n->binaryF.right, true, true, false);
         break;
 
       case decl_mult:
-        return doGetLastOp (b, b->binaryF.right);
+        doBinary (p, (const char *) "*", 1, n->binaryF.left, n->binaryF.right, false, false, false);
         break;
 
       case decl_divide:
-        return doGetLastOp (b, b->binaryF.right);
-        break;
-
-      case decl_in:
-        return doGetLastOp (b, b->binaryF.right);
-        break;
-
-      case decl_and:
-        return doGetLastOp (b, b->binaryF.right);
-        break;
-
-      case decl_or:
-        return doGetLastOp (b, b->binaryF.right);
-        break;
-
-      case decl_cmplx:
-        return doGetLastOp (b, b->binaryF.right);
+        doBinary (p, (const char *) "/", 1, n->binaryF.left, n->binaryF.right, false, false, false);
         break;
 
       case decl_literal:
-        return a;
+        doLiteral (p, n);
         break;
 
       case decl_const:
-        return a;
+        doConstExpr (p, n);
         break;
 
       case decl_enumerationfield:
-        return a;
+        doEnumerationField (p, n);
         break;
 
       case decl_string:
-        return a;
+        doString (p, n);
         break;
 
       case decl_max:
-        return doGetLastOp (b, b->unaryF.arg);
+        doUnary (p, (const char *) "MAX", 3, n->unaryF.arg, n->unaryF.resultType, true, true);
         break;
 
       case decl_min:
-        return doGetLastOp (b, b->unaryF.arg);
+        doUnary (p, (const char *) "MIN", 3, n->unaryF.arg, n->unaryF.resultType, true, true);
         break;
 
       case decl_var:
-        return a;
-        break;
-
-      case decl_arrayref:
-        return a;
-        break;
-
-      case decl_funccall:
-        return a;
-        break;
-
-      case decl_procedure:
-        return a;
-        break;
-
-      case decl_recordfield:
-        return a;
+        doVar (p, n);
         break;
 
 
@@ -10269,1478 +9968,1460 @@ static decl_node doGetLastOp (decl_node a, decl_node b)
         CaseException ("../../gcc/m2/mc/decl.def", 20, 1);
         __builtin_unreachable ();
     }
-  /* static analysis guarentees a RETURN statement will be used before here.  */
-  __builtin_unreachable ();
-}
-
-
-/*
-   doComponentRefC -
-*/
-
-static void doComponentRefC (mcPretty_pretty p, decl_node l, decl_node r)
-{
-  doExprC (p, l);
-  outText (p, (const char *) ".", 1);
-  doExprC (p, r);
-}
-
-
-/*
-   doPointerRefC -
-*/
-
-static void doPointerRefC (mcPretty_pretty p, decl_node l, decl_node r)
-{
-  doExprC (p, l);
-  outText (p, (const char *) "->", 2);
-  doExprC (p, r);
 }
 
 
 /*
-   doPreBinary -
+   doVar -
 */
 
-static void doPreBinary (mcPretty_pretty p, const char *op_, unsigned int _op_high, decl_node left, decl_node right, bool l, bool r)
+static void doVar (mcPretty_pretty p, decl_node__opaque n)
 {
-  char op[_op_high+1];
-
-  /* make a local copy of each unbounded array.  */
-  memcpy (op, op_, _op_high+1);
-
-  if (l)
-    {
-      mcPretty_setNeedSpace (p);
-    }
-  outText (p, (const char *) op, _op_high);
-  if (r)
+  mcDebug_assert (decl_isVar (static_cast<decl_node> (n)));
+  if (n->varF.isVarParameter)
     {
-      mcPretty_setNeedSpace (p);
+      outText (p, (const char *) "(*", 2);
+      doFQDNameC (p, n, true);
+      outText (p, (const char *) ")", 1);
     }
-  outText (p, (const char *) "(", 1);
-  doExprC (p, left);
-  outText (p, (const char *) ",", 1);
-  mcPretty_setNeedSpace (p);
-  doExprC (p, right);
-  outText (p, (const char *) ")", 1);
-}
-
-
-/*
-   doConstExpr -
-*/
-
-static void doConstExpr (mcPretty_pretty p, decl_node n)
-{
-  doFQNameC (p, n);
-}
-
-
-/*
-   doEnumerationField -
-*/
-
-static void doEnumerationField (mcPretty_pretty p, decl_node n)
-{
-  doFQDNameC (p, n, false);
-}
-
-
-/*
-   isZero - returns TRUE if node, n, is zero.
-*/
-
-static bool isZero (decl_node n)
-{
-  if (isConstExp (n))
+  else
     {
-      return isZero (n->unaryF.arg);
+      doFQDNameC (p, n, true);
     }
-  return (decl_getSymName (n)) == (nameKey_makeKey ((const char *) "0", 1));
-  /* static analysis guarentees a RETURN statement will be used before here.  */
-  __builtin_unreachable ();
 }
 
 
 /*
-   doArrayRef -
+   doLiteralC -
 */
 
-static void doArrayRef (mcPretty_pretty p, decl_node n)
+static void doLiteralC (mcPretty_pretty p, decl_node__opaque n)
 {
-  decl_node t;
-  unsigned int i;
-  unsigned int c;
+  DynamicStrings_String s;
 
-  mcDebug_assert (n != NULL);
-  mcDebug_assert (isArrayRef (n));
-  t = decl_skipType (decl_getType (n->arrayrefF.array));
-  if (decl_isUnbounded (t))
+  mcDebug_assert (decl_isLiteral (static_cast<decl_node> (n)));
+  s = DynamicStrings_InitStringCharStar (nameKey_keyToCharStar (decl_getSymName (static_cast<decl_node> (n))));
+  if (n->literalF.type == charN)
     {
-      outTextN (p, decl_getSymName (n->arrayrefF.array));
+      if ((DynamicStrings_char (s, -1)) == 'C')
+        {
+          s = DynamicStrings_Slice (DynamicStrings_Mark (s), 0, -1);
+          if ((DynamicStrings_char (s, 0)) != '0')
+            {
+              s = DynamicStrings_ConCat (DynamicStrings_InitString ((const char *) "0", 1), DynamicStrings_Mark (s));
+            }
+        }
+      outText (p, (const char *) "(char)", 6);
+      mcPretty_setNeedSpace (p);
     }
-  else
+  else if ((DynamicStrings_char (s, -1)) == 'H')
     {
-      doExprC (p, n->arrayrefF.array);
-      mcDebug_assert (decl_isArray (t));
-      outText (p, (const char *) ".array", 6);
+      /* avoid dangling else.  */
+      outText (p, (const char *) "0x", 2);
+      s = DynamicStrings_Slice (DynamicStrings_Mark (s), 0, -1);
     }
-  outText (p, (const char *) "[", 1);
-  i = 1;
-  c = expListLen (n->arrayrefF.index);
-  while (i <= c)
+  else if ((DynamicStrings_char (s, -1)) == 'B')
     {
-      doExprC (p, getExpList (n->arrayrefF.index, i));
-      if (decl_isUnbounded (t))
-        {
-          mcDebug_assert (c == 1);
-        }
-      else
+      /* avoid dangling else.  */
+      outText (p, (const char *) "0", 1);
+      s = DynamicStrings_Slice (DynamicStrings_Mark (s), 0, -1);
+    }
+  outTextS (p, s);
+  s = DynamicStrings_KillString (s);
+}
+
+
+/*
+   doLiteral -
+*/
+
+static void doLiteral (mcPretty_pretty p, decl_node__opaque n)
+{
+  DynamicStrings_String s;
+
+  mcDebug_assert (decl_isLiteral (static_cast<decl_node> (n)));
+  s = DynamicStrings_InitStringCharStar (nameKey_keyToCharStar (decl_getSymName (static_cast<decl_node> (n))));
+  if (n->literalF.type == charN)
+    {
+      if ((DynamicStrings_char (s, -1)) == 'C')
         {
-          doSubtractC (p, getMin (t->arrayF.subr));
-          if (i < c)
+          s = DynamicStrings_Slice (DynamicStrings_Mark (s), 0, -1);
+          if ((DynamicStrings_char (s, 0)) != '0')
             {
-              mcDebug_assert (decl_isArray (t));
-              outText (p, (const char *) "].array[", 8);
-              t = decl_skipType (decl_getType (t));
+              s = DynamicStrings_ConCat (DynamicStrings_InitString ((const char *) "0", 1), DynamicStrings_Mark (s));
             }
         }
-      i += 1;
+      outText (p, (const char *) "(char)", 6);
+      mcPretty_setNeedSpace (p);
     }
-  outText (p, (const char *) "]", 1);
+  outTextS (p, s);
+  s = DynamicStrings_KillString (s);
 }
 
 
 /*
-   doProcedure -
+   isString - returns TRUE if node, n, is a string.
 */
 
-static void doProcedure (mcPretty_pretty p, decl_node n)
+static bool isString (decl_node__opaque n)
 {
-  mcDebug_assert (decl_isProcedure (n));
-  doFQDNameC (p, n, true);
+  mcDebug_assert (n != NULL);
+  return n->kind == decl_string;
+  /* static analysis guarentees a RETURN statement will be used before here.  */
+  __builtin_unreachable ();
 }
 
 
 /*
-   doRecordfield -
+   doString -
 */
 
-static void doRecordfield (mcPretty_pretty p, decl_node n)
+static void doString (mcPretty_pretty p, decl_node__opaque n)
 {
-  doDNameC (p, n, false);
+  DynamicStrings_String s;
+
+  mcDebug_assert (isString (n));
+  s = DynamicStrings_InitStringCharStar (nameKey_keyToCharStar (decl_getSymName (static_cast<decl_node> (n))));
+  outTextS (p, s);
+  s = DynamicStrings_KillString (s);
+  /* 
+   IF DynamicStrings.Index (s, '"', 0)=-1
+   THEN
+      outText (p, '"') ;
+      outTextS (p, s) ;
+      outText (p, '"')
+   ELSIF DynamicStrings.Index (s, "'", 0)=-1
+   THEN
+      outText (p, '"') ;
+      outTextS (p, s) ;
+      outText (p, '"')
+   ELSE
+      metaError1 ('illegal string {%1k}', n)
+   END
+  */
+  M2RTS_HALT (-1);
+  __builtin_unreachable ();
 }
 
 
 /*
-   doCastC -
+   replaceChar - replace every occurance of, ch, by, a and return modified string, s.
 */
 
-static void doCastC (mcPretty_pretty p, decl_node t, decl_node e)
+static DynamicStrings_String replaceChar (DynamicStrings_String s, char ch, const char *a_, unsigned int _a_high)
 {
-  decl_node et;
+  int i;
+  char a[_a_high+1];
 
-  outText (p, (const char *) "(", 1);
-  doTypeNameC (p, t);
-  outText (p, (const char *) ")", 1);
-  mcPretty_setNeedSpace (p);
-  et = decl_skipType (decl_getType (e));
-  if (((et != NULL) && (isAProcType (et))) && (isAProcType (decl_skipType (t))))
-    {
-      outText (p, (const char *) "{(", 2);
-      doFQNameC (p, t);
-      outText (p, (const char *) "_t)", 3);
-      mcPretty_setNeedSpace (p);
-      doExprC (p, e);
-      outText (p, (const char *) ".proc}", 6);
-    }
-  else
-    {
-      outText (p, (const char *) "(", 1);
-      doExprC (p, e);
-      outText (p, (const char *) ")", 1);
-    }
+  /* make a local copy of each unbounded array.  */
+  memcpy (a, a_, _a_high+1);
+
+  i = 0;
+  for (;;)
+  {
+    i = DynamicStrings_Index (s, ch, static_cast<unsigned int> (i));
+    if (i == 0)
+      {
+        s = DynamicStrings_ConCat (DynamicStrings_InitString ((const char *) a, _a_high), DynamicStrings_Slice (s, 1, 0));
+        i = StrLib_StrLen ((const char *) a, _a_high);
+      }
+    else if (i > 0)
+      {
+        /* avoid dangling else.  */
+        s = DynamicStrings_ConCat (DynamicStrings_ConCat (DynamicStrings_Slice (s, 0, i), DynamicStrings_Mark (DynamicStrings_InitString ((const char *) a, _a_high))), DynamicStrings_Slice (s, i+1, 0));
+        i += StrLib_StrLen ((const char *) a, _a_high);
+      }
+    else
+      {
+        /* avoid dangling else.  */
+        return s;
+      }
+  }
+  ReturnException ("../../gcc/m2/mc/decl.def", 20, 1);
+  __builtin_unreachable ();
 }
 
 
 /*
-   doSetValueC -
+   toCstring - translates string, n, into a C string
+               and returns the new String.
 */
 
-static void doSetValueC (mcPretty_pretty p, decl_node n)
+static DynamicStrings_String toCstring (nameKey_Name n)
 {
-  decl_node lo;
-  unsigned int i;
-  unsigned int h;
+  DynamicStrings_String s;
 
-  mcDebug_assert (decl_isSetValue (n));
-  lo = getSetLow (n);
-  if (n->setvalueF.type != NULL)
-    {
-      outText (p, (const char *) "(", 1);
-      doTypeNameC (p, n->setvalueF.type);
-      mcPretty_noSpace (p);
-      outText (p, (const char *) ")", 1);
-      mcPretty_setNeedSpace (p);
-    }
-  if ((Indexing_HighIndice (n->setvalueF.values)) == 0)
-    {
-      outText (p, (const char *) "0", 1);
-    }
-  else
-    {
-      i = Indexing_LowIndice (n->setvalueF.values);
-      h = Indexing_HighIndice (n->setvalueF.values);
-      outText (p, (const char *) "(", 1);
-      while (i <= h)
-        {
-          outText (p, (const char *) "(1", 2);
-          mcPretty_setNeedSpace (p);
-          outText (p, (const char *) "<<", 2);
-          mcPretty_setNeedSpace (p);
-          outText (p, (const char *) "(", 1);
-          doExprC (p, reinterpret_cast<decl_node> (Indexing_GetIndice (n->setvalueF.values, i)));
-          doSubtractC (p, lo);
-          outText (p, (const char *) ")", 1);
-          outText (p, (const char *) ")", 1);
-          if (i < h)
-            {
-              mcPretty_setNeedSpace (p);
-              outText (p, (const char *) "|", 1);
-              mcPretty_setNeedSpace (p);
-            }
-          i += 1;
-        }
-      outText (p, (const char *) ")", 1);
-    }
+  s = DynamicStrings_Slice (DynamicStrings_InitStringCharStar (nameKey_keyToCharStar (n)), 1, -1);
+  return replaceChar (replaceChar (s, '\\', (const char *) "\\\\", 2), '"', (const char *) "\\\"", 2);
+  /* static analysis guarentees a RETURN statement will be used before here.  */
+  __builtin_unreachable ();
 }
 
 
 /*
-   getSetLow - returns the low value of the set type from
-               expression, n.
+   toCchar -
 */
 
-static decl_node getSetLow (decl_node n)
+static DynamicStrings_String toCchar (nameKey_Name n)
 {
-  decl_node type;
+  DynamicStrings_String s;
 
-  if ((decl_getType (n)) == NULL)
-    {
-      return decl_makeLiteralInt (nameKey_makeKey ((const char *) "0", 1));
-    }
-  else
-    {
-      type = decl_skipType (decl_getType (n));
-      if (decl_isSet (type))
-        {
-          return getMin (decl_skipType (decl_getType (type)));
-        }
-      else
-        {
-          return decl_makeLiteralInt (nameKey_makeKey ((const char *) "0", 1));
-        }
-    }
+  s = DynamicStrings_Slice (DynamicStrings_InitStringCharStar (nameKey_keyToCharStar (n)), 1, -1);
+  return replaceChar (replaceChar (s, '\\', (const char *) "\\\\", 2), '\'', (const char *) "\\'", 2);
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
 
 
 /*
-   doInC - performs (((1 << (l)) & (r)) != 0)
+   countChar -
 */
 
-static void doInC (mcPretty_pretty p, decl_node l, decl_node r)
+static unsigned int countChar (DynamicStrings_String s, char ch)
 {
-  decl_node lo;
+  int i;
+  unsigned int c;
 
-  lo = getSetLow (r);
-  outText (p, (const char *) "(((1", 4);
-  mcPretty_setNeedSpace (p);
-  outText (p, (const char *) "<<", 2);
-  mcPretty_setNeedSpace (p);
-  outText (p, (const char *) "(", 1);
-  doExprC (p, l);
-  doSubtractC (p, lo);
-  outText (p, (const char *) "))", 2);
-  mcPretty_setNeedSpace (p);
-  outText (p, (const char *) "&", 1);
-  mcPretty_setNeedSpace (p);
-  outText (p, (const char *) "(", 1);
-  doExprC (p, r);
-  outText (p, (const char *) "))", 2);
-  mcPretty_setNeedSpace (p);
-  outText (p, (const char *) "!=", 2);
-  mcPretty_setNeedSpace (p);
-  outText (p, (const char *) "0)", 2);
+  c = 0;
+  i = 0;
+  for (;;)
+  {
+    i = DynamicStrings_Index (s, ch, static_cast<unsigned int> (i));
+    if (i >= 0)
+      {
+        i += 1;
+        c += 1;
+      }
+    else
+      {
+        return c;
+      }
+  }
+  ReturnException ("../../gcc/m2/mc/decl.def", 20, 1);
+  __builtin_unreachable ();
 }
 
 
 /*
-   doThrowC -
+   lenCstring -
 */
 
-static void doThrowC (mcPretty_pretty p, decl_node n)
+static unsigned int lenCstring (DynamicStrings_String s)
 {
-  mcDebug_assert (isIntrinsic (n));
-  outText (p, (const char *) "throw", 5);
-  mcPretty_setNeedSpace (p);
-  outText (p, (const char *) "(", 1);
-  if ((expListLen (n->intrinsicF.args)) == 1)
-    {
-      doExprC (p, getExpList (n->intrinsicF.args, 1));
-    }
-  outText (p, (const char *) ")", 1);
+  return (DynamicStrings_Length (s))-(countChar (s, '\\'));
+  /* static analysis guarentees a RETURN statement will be used before here.  */
+  __builtin_unreachable ();
 }
 
 
 /*
-   doUnreachableC -
+   outCstring -
 */
 
-static void doUnreachableC (mcPretty_pretty p, decl_node n)
+static void outCstring (mcPretty_pretty p, decl_node__opaque s, bool aString)
 {
-  mcDebug_assert (isIntrinsic (n));
-  outText (p, (const char *) "__builtin_unreachable", 21);
-  mcPretty_setNeedSpace (p);
-  outText (p, (const char *) "(", 1);
-  mcDebug_assert ((expListLen (n->intrinsicF.args)) == 0);
-  outText (p, (const char *) ")", 1);
+  if (aString)
+    {
+      outText (p, (const char *) "\"", 1);
+      outRawS (p, s->stringF.cstring);
+      outText (p, (const char *) "\"", 1);
+    }
+  else
+    {
+      outText (p, (const char *) "'", 1);
+      outRawS (p, s->stringF.cchar);
+      outText (p, (const char *) "'", 1);
+    }
 }
 
 
 /*
-   outNull -
+   doStringC -
 */
 
-static void outNull (mcPretty_pretty p)
+static void doStringC (mcPretty_pretty p, decl_node__opaque n)
 {
-  keyc_useNull ();
-  outText (p, (const char *) "NULL", 4);
+  DynamicStrings_String s;
+
+  mcDebug_assert (isString (n));
+  /* 
+   s := InitStringCharStar (keyToCharStar (getSymName (n))) ;
+   IF DynamicStrings.Length (s)>3
+   THEN
+      IF DynamicStrings.Index (s, '"', 0)=-1
+      THEN
+         s := DynamicStrings.Slice (s, 1, -1) ;
+         outText (p, '"') ;
+         outCstring (p, s) ;
+         outText (p, '"')
+      ELSIF DynamicStrings.Index (s, "'", 0)=-1
+      THEN
+         s := DynamicStrings.Slice (s, 1, -1) ;
+         outText (p, '"') ;
+         outCstring (p, s) ;
+         outText (p, '"')
+      ELSE
+         metaError1 ('illegal string {%1k}', n)
+      END
+   ELSIF DynamicStrings.Length (s) = 3
+   THEN
+      s := DynamicStrings.Slice (s, 1, -1) ;
+      outText (p, "'") ;
+      IF DynamicStrings.char (s, 0) = "'"
+      THEN
+         outText (p, "\'")
+      ELSIF DynamicStrings.char (s, 0) = "\"
+      THEN
+         outText (p, "\\")
+      ELSE
+         outTextS (p, s)
+      END ;
+      outText (p, "'")
+   ELSE
+      outText (p, "'\0'")
+   END ;
+   s := KillString (s)
+  */
+  outCstring (p, n, ! n->stringF.isCharCompatible);
 }
 
 
 /*
-   outTrue -
+   isPunct -
 */
 
-static void outTrue (mcPretty_pretty p)
+static bool isPunct (char ch)
 {
-  keyc_useTrue ();
-  if ((mcOptions_useBool ()) && (lang == decl_ansiCP))
-    {
-      outText (p, (const char *) "true", 4);
-    }
-  else
-    {
-      outText (p, (const char *) "TRUE", 4);
-    }
+  return (((((((((ch == '.') || (ch == '(')) || (ch == ')')) || (ch == '^')) || (ch == ':')) || (ch == ';')) || (ch == '{')) || (ch == '}')) || (ch == ',')) || (ch == '*');
+  /* static analysis guarentees a RETURN statement will be used before here.  */
+  __builtin_unreachable ();
 }
 
 
 /*
-   outFalse -
+   isWhite -
 */
 
-static void outFalse (mcPretty_pretty p)
+static bool isWhite (char ch)
 {
-  keyc_useFalse ();
-  if ((mcOptions_useBool ()) && (lang == decl_ansiCP))
-    {
-      outText (p, (const char *) "false", 5);
-    }
-  else
-    {
-      outText (p, (const char *) "FALSE", 5);
-    }
+  return ((ch == ' ') || (ch == ASCII_tab)) || (ch == ASCII_lf);
+  /* static analysis guarentees a RETURN statement will be used before here.  */
+  __builtin_unreachable ();
 }
 
 
 /*
-   doExprC -
+   outText -
 */
 
-static void doExprC (mcPretty_pretty p, decl_node n)
+static void outText (mcPretty_pretty p, const char *a_, unsigned int _a_high)
 {
-  decl_node t;
-
-  mcDebug_assert (n != NULL);
-  t = getExprType (n);
-  switch (n->kind)
-    {
-      case decl_nil:
-        outNull (p);
-        break;
-
-      case decl_true:
-        outTrue (p);
-        break;
+  DynamicStrings_String s;
+  char a[_a_high+1];
 
-      case decl_false:
-        outFalse (p);
-        break;
+  /* make a local copy of each unbounded array.  */
+  memcpy (a, a_, _a_high+1);
 
-      case decl_constexp:
-        doUnary (p, (const char *) "", 0, n->unaryF.arg, n->unaryF.resultType, false, false);
-        break;
+  s = DynamicStrings_InitString ((const char *) a, _a_high);
+  outTextS (p, s);
+  s = DynamicStrings_KillString (s);
+}
 
-      case decl_neg:
-        doUnary (p, (const char *) "-", 1, n->unaryF.arg, n->unaryF.resultType, false, false);
-        break;
 
-      case decl_not:
-        doUnary (p, (const char *) "!", 1, n->unaryF.arg, n->unaryF.resultType, false, true);
-        break;
+/*
+   outRawS -
+*/
 
-      case decl_val:
-        doValC (p, n);
-        break;
+static void outRawS (mcPretty_pretty p, DynamicStrings_String s)
+{
+  mcPretty_raw (p, s);
+}
 
-      case decl_adr:
-        doAdrC (p, n);
-        break;
 
-      case decl_size:
-      case decl_tsize:
-        doSizeC (p, n);
-        break;
+/*
+   outKm2 -
+*/
 
-      case decl_float:
-        doConvertSC (p, n, mcOptions_getCRealType ());
-        break;
+static mcPretty_pretty outKm2 (mcPretty_pretty p, const char *a_, unsigned int _a_high)
+{
+  unsigned int i;
+  DynamicStrings_String s;
+  char a[_a_high+1];
 
-      case decl_trunc:
-        doConvertC (p, n, (const char *) "int", 3);
-        break;
+  /* make a local copy of each unbounded array.  */
+  memcpy (a, a_, _a_high+1);
 
-      case decl_ord:
-        doConvertC (p, n, (const char *) "unsigned int", 12);
-        break;
+  if (StrLib_StrEqual ((const char *) a, _a_high, (const char *) "RECORD", 6))
+    {
+      p = mcPretty_pushPretty (p);
+      i = mcPretty_getcurpos (p);
+      mcPretty_setindent (p, i);
+      outText (p, (const char *) a, _a_high);
+      p = mcPretty_pushPretty (p);
+      mcPretty_setindent (p, i+indentation);
+    }
+  else if (StrLib_StrEqual ((const char *) a, _a_high, (const char *) "END", 3))
+    {
+      /* avoid dangling else.  */
+      p = mcPretty_popPretty (p);
+      outText (p, (const char *) a, _a_high);
+      p = mcPretty_popPretty (p);
+    }
+  return p;
+  /* static analysis guarentees a RETURN statement will be used before here.  */
+  __builtin_unreachable ();
+}
 
-      case decl_chr:
-        doConvertC (p, n, (const char *) "char", 4);
-        break;
 
-      case decl_cap:
-        doCapC (p, n);
-        break;
+/*
+   outKc -
+*/
 
-      case decl_abs:
-        doAbsC (p, n);
-        break;
+static mcPretty_pretty outKc (mcPretty_pretty p, const char *a_, unsigned int _a_high)
+{
+  int i;
+  unsigned int c;
+  DynamicStrings_String s;
+  DynamicStrings_String t;
+  char a[_a_high+1];
 
-      case decl_high:
-        doFuncHighC (p, n->unaryF.arg);
-        break;
+  /* make a local copy of each unbounded array.  */
+  memcpy (a, a_, _a_high+1);
 
-      case decl_length:
-        doLengthC (p, n);
-        break;
+  s = DynamicStrings_InitString ((const char *) a, _a_high);
+  i = DynamicStrings_Index (s, '\\', 0);
+  if (i == -1)
+    {
+      t = static_cast<DynamicStrings_String> (NULL);
+    }
+  else
+    {
+      t = DynamicStrings_Slice (s, i, 0);
+      s = DynamicStrings_Slice (DynamicStrings_Mark (s), 0, i);
+    }
+  if ((DynamicStrings_char (s, 0)) == '{')
+    {
+      p = mcPretty_pushPretty (p);
+      c = mcPretty_getcurpos (p);
+      mcPretty_setindent (p, c);
+      outTextS (p, s);
+      p = mcPretty_pushPretty (p);
+      mcPretty_setindent (p, c+indentationC);
+    }
+  else if ((DynamicStrings_char (s, 0)) == '}')
+    {
+      /* avoid dangling else.  */
+      p = mcPretty_popPretty (p);
+      outTextS (p, s);
+      p = mcPretty_popPretty (p);
+    }
+  outTextS (p, t);
+  t = DynamicStrings_KillString (t);
+  s = DynamicStrings_KillString (s);
+  return p;
+  /* static analysis guarentees a RETURN statement will be used before here.  */
+  __builtin_unreachable ();
+}
 
-      case decl_min:
-        doMinC (p, n);
-        break;
 
-      case decl_max:
-        doMaxC (p, n);
-        break;
+/*
+   outTextS -
+*/
 
-      case decl_throw:
-        doThrowC (p, n);
-        break;
+static void outTextS (mcPretty_pretty p, DynamicStrings_String s)
+{
+  if (s != NULL)
+    {
+      mcPretty_prints (p, s);
+    }
+}
 
-      case decl_unreachable:
-        doUnreachableC (p, n);
-        break;
 
-      case decl_re:
-        doReC (p, n);
-        break;
+/*
+   outCard -
+*/
 
-      case decl_im:
-        doImC (p, n);
-        break;
+static void outCard (mcPretty_pretty p, unsigned int c)
+{
+  DynamicStrings_String s;
 
-      case decl_cmplx:
-        doCmplx (p, n);
-        break;
+  s = StringConvert_CardinalToString (c, 0, ' ', 10, false);
+  outTextS (p, s);
+  s = DynamicStrings_KillString (s);
+}
 
-      case decl_deref:
-        doDeRefC (p, n->unaryF.arg);
-        break;
 
-      case decl_equal:
-        doBinary (p, (const char *) "==", 2, n->binaryF.left, n->binaryF.right, true, true, true);
-        break;
+/*
+   outTextN -
+*/
 
-      case decl_notequal:
-        doBinary (p, (const char *) "!=", 2, n->binaryF.left, n->binaryF.right, true, true, true);
-        break;
+static void outTextN (mcPretty_pretty p, nameKey_Name n)
+{
+  DynamicStrings_String s;
 
-      case decl_less:
-        doBinary (p, (const char *) "<", 1, n->binaryF.left, n->binaryF.right, true, true, false);
-        break;
+  s = DynamicStrings_InitStringCharStar (nameKey_keyToCharStar (n));
+  mcPretty_prints (p, s);
+  s = DynamicStrings_KillString (s);
+}
 
-      case decl_greater:
-        doBinary (p, (const char *) ">", 1, n->binaryF.left, n->binaryF.right, true, true, false);
-        break;
 
-      case decl_greequal:
-        doBinary (p, (const char *) ">=", 2, n->binaryF.left, n->binaryF.right, true, true, false);
-        break;
+/*
+   outputEnumerationC -
+*/
 
-      case decl_lessequal:
-        doBinary (p, (const char *) "<=", 2, n->binaryF.left, n->binaryF.right, true, true, false);
-        break;
+static void outputEnumerationC (mcPretty_pretty p, decl_node__opaque n)
+{
+  unsigned int i;
+  unsigned int h;
+  decl_node__opaque s;
+  DynamicStrings_String t;
 
-      case decl_componentref:
-        doComponentRefC (p, n->componentrefF.rec, n->componentrefF.field);
-        break;
+  outText (p, (const char *) "enum {", 6);
+  i = Indexing_LowIndice (n->enumerationF.listOfSons);
+  h = Indexing_HighIndice (n->enumerationF.listOfSons);
+  while (i <= h)
+    {
+      s = static_cast<decl_node__opaque> (Indexing_GetIndice (n->enumerationF.listOfSons, i));
+      doFQDNameC (p, s, false);
+      if (i < h)
+        {
+          outText (p, (const char *) ",", 1);
+          mcPretty_setNeedSpace (p);
+        }
+      i += 1;
+    }
+  outText (p, (const char *) "}", 1);
+}
 
-      case decl_pointerref:
-        doPointerRefC (p, n->pointerrefF.ptr, n->pointerrefF.field);
-        break;
 
-      case decl_cast:
-        doCastC (p, n->binaryF.left, n->binaryF.right);
-        break;
+/*
+   isDeclType - return TRUE if the current module should declare type.
+*/
 
-      case decl_plus:
-        doPolyBinary (p, decl_plus, n->binaryF.left, n->binaryF.right, false, false);
-        break;
+static bool isDeclType (decl_node__opaque type)
+{
+  decl_node__opaque n;
+  decl_node__opaque def;
+  nameKey_Name name;
 
-      case decl_sub:
-        doPolyBinary (p, decl_sub, n->binaryF.left, n->binaryF.right, false, false);
-        break;
+  if (decl_isImp (static_cast<decl_node> (currentModule)))
+    {
+      name = decl_getSymName (static_cast<decl_node> (type));
+      if (name != nameKey_NulName)
+        {
+          /* Lookup the matching .def module.  */
+          def = static_cast<decl_node__opaque> (decl_lookupDef (decl_getSymName (static_cast<decl_node> (currentModule))));
+          if (def != NULL)
+            {
+              /* Return TRUE if the symbol has not already been declared in the .def.  */
+              return (decl_lookupExported (static_cast<decl_node> (def), name)) == NULL;
+            }
+        }
+    }
+  return true;
+  /* static analysis guarentees a RETURN statement will be used before here.  */
+  __builtin_unreachable ();
+}
 
-      case decl_div:
-        doBinary (p, (const char *) "/", 1, n->binaryF.left, n->binaryF.right, true, true, false);
-        break;
 
-      case decl_mod:
-        doBinary (p, (const char *) "%", 1, n->binaryF.left, n->binaryF.right, true, true, false);
-        break;
+/*
+   doEnumerationC -
+*/
 
-      case decl_mult:
-        doPolyBinary (p, decl_mult, n->binaryF.left, n->binaryF.right, false, false);
-        break;
+static void doEnumerationC (mcPretty_pretty p, decl_node__opaque n)
+{
+  if (isDeclType (n))
+    {
+      outputEnumerationC (p, n);
+    }
+}
 
-      case decl_divide:
-        doPolyBinary (p, decl_divide, n->binaryF.left, n->binaryF.right, false, false);
-        break;
 
-      case decl_in:
-        doInC (p, n->binaryF.left, n->binaryF.right);
-        break;
+/*
+   doNamesC -
+*/
 
-      case decl_and:
-        doBinary (p, (const char *) "&&", 2, n->binaryF.left, n->binaryF.right, true, true, false);
-        break;
+static void doNamesC (mcPretty_pretty p, nameKey_Name n)
+{
+  DynamicStrings_String s;
 
-      case decl_or:
-        doBinary (p, (const char *) "||", 2, n->binaryF.left, n->binaryF.right, true, true, false);
-        break;
+  s = DynamicStrings_InitStringCharStar (nameKey_keyToCharStar (n));
+  outTextS (p, s);
+  s = DynamicStrings_KillString (s);
+}
 
-      case decl_literal:
-        doLiteralC (p, n);
-        break;
 
-      case decl_const:
-        doConstExpr (p, n);
-        break;
+/*
+   doNameC -
+*/
 
-      case decl_enumerationfield:
-        doEnumerationField (p, n);
-        break;
+static void doNameC (mcPretty_pretty p, decl_node__opaque n)
+{
+  if ((n != NULL) && ((decl_getSymName (static_cast<decl_node> (n))) != nameKey_NulName))
+    {
+      doNamesC (p, decl_getSymName (static_cast<decl_node> (n)));
+    }
+}
 
-      case decl_string:
-        doStringC (p, n);
-        break;
 
-      case decl_var:
-        doVar (p, n);
-        break;
+/*
+   initCname -
+*/
 
-      case decl_arrayref:
-        doArrayRef (p, n);
-        break;
+static void initCname (decl_cnameT *c)
+{
+  (*c).init = false;
+}
 
-      case decl_funccall:
-        doFuncExprC (p, n);
-        break;
 
-      case decl_procedure:
-        doProcedure (p, n);
-        break;
+/*
+   doCname -
+*/
 
-      case decl_recordfield:
-        doRecordfield (p, n);
-        break;
+static nameKey_Name doCname (nameKey_Name n, decl_cnameT *c, bool scopes)
+{
+  DynamicStrings_String s;
 
-      case decl_setvalue:
-        doSetValueC (p, n);
-        break;
+  if ((*c).init)
+    {
+      return (*c).name;
+    }
+  else
+    {
+      (*c).init = true;
+      s = keyc_cname (n, scopes);
+      if (s == NULL)
+        {
+          (*c).name = n;
+        }
+      else
+        {
+          (*c).name = nameKey_makekey (DynamicStrings_string (s));
+          s = DynamicStrings_KillString (s);
+        }
+      return (*c).name;
+    }
+  /* static analysis guarentees a RETURN statement will be used before here.  */
+  __builtin_unreachable ();
+}
 
-      case decl_char:
-      case decl_cardinal:
-      case decl_longcard:
-      case decl_shortcard:
-      case decl_integer:
-      case decl_longint:
-      case decl_shortint:
-      case decl_complex:
-      case decl_longcomplex:
-      case decl_shortcomplex:
-      case decl_real:
-      case decl_longreal:
-      case decl_shortreal:
-      case decl_bitset:
-      case decl_boolean:
-      case decl_proc:
-        doBaseC (p, n);
+
+/*
+   getDName -
+*/
+
+static nameKey_Name getDName (decl_node__opaque n, bool scopes)
+{
+  nameKey_Name m;
+
+  m = decl_getSymName (static_cast<decl_node> (n));
+  switch (n->kind)
+    {
+      case decl_procedure:
+        return doCname (m, &n->procedureF.cname, scopes);
         break;
 
-      case decl_address:
-      case decl_loc:
-      case decl_byte:
-      case decl_word:
-      case decl_csizet:
-      case decl_cssizet:
-        doSystemC (p, n);
+      case decl_var:
+        return doCname (m, &n->varF.cname, scopes);
         break;
 
-      case decl_type:
-        doTypeNameC (p, n);
+      case decl_recordfield:
+        return doCname (m, &n->recordfieldF.cname, scopes);
         break;
 
-      case decl_pointer:
-        doTypeNameC (p, n);
+      case decl_enumerationfield:
+        return doCname (m, &n->enumerationfieldF.cname, scopes);
         break;
 
 
       default:
-        CaseException ("../../gcc/m2/mc/decl.def", 20, 1);
-        __builtin_unreachable ();
+        break;
     }
+  return m;
+  /* static analysis guarentees a RETURN statement will be used before here.  */
+  __builtin_unreachable ();
 }
 
 
 /*
-   doExprCup -
+   doDNameC -
 */
 
-static void doExprCup (mcPretty_pretty p, decl_node n, bool unpackProc)
+static void doDNameC (mcPretty_pretty p, decl_node__opaque n, bool scopes)
 {
-  decl_node t;
-
-  doExprC (p, n);
-  if (unpackProc)
+  if ((n != NULL) && ((decl_getSymName (static_cast<decl_node> (n))) != nameKey_NulName))
     {
-      t = decl_skipType (getExprType (n));
-      if ((t != NULL) && (isAProcType (t)))
-        {
-          outText (p, (const char *) ".proc", 5);
-        }
+      doNamesC (p, getDName (n, scopes));
     }
 }
 
 
 /*
-   doExprM2 -
+   doFQDNameC -
 */
 
-static void doExprM2 (mcPretty_pretty p, decl_node n)
+static void doFQDNameC (mcPretty_pretty p, decl_node__opaque n, bool scopes)
 {
-  mcDebug_assert (n != NULL);
-  switch (n->kind)
-    {
-      case decl_nil:
-        outText (p, (const char *) "NIL", 3);
-        break;
+  DynamicStrings_String s;
 
-      case decl_true:
-        outText (p, (const char *) "TRUE", 4);
-        break;
+  s = getFQDstring (n, scopes);
+  outTextS (p, s);
+  s = DynamicStrings_KillString (s);
+}
 
-      case decl_false:
-        outText (p, (const char *) "FALSE", 5);
-        break;
 
-      case decl_constexp:
-        doUnary (p, (const char *) "", 0, n->unaryF.arg, n->unaryF.resultType, false, false);
-        break;
+/*
+   doFQNameC -
+*/
 
-      case decl_neg:
-        doUnary (p, (const char *) "-", 1, n->unaryF.arg, n->unaryF.resultType, false, false);
-        break;
+static void doFQNameC (mcPretty_pretty p, decl_node__opaque n)
+{
+  DynamicStrings_String s;
 
-      case decl_not:
-        doUnary (p, (const char *) "NOT", 3, n->unaryF.arg, n->unaryF.resultType, true, true);
-        break;
+  s = getFQstring (n);
+  outTextS (p, s);
+  s = DynamicStrings_KillString (s);
+}
 
-      case decl_adr:
-        doUnary (p, (const char *) "ADR", 3, n->unaryF.arg, n->unaryF.resultType, true, true);
-        break;
 
-      case decl_size:
-        doUnary (p, (const char *) "SIZE", 4, n->unaryF.arg, n->unaryF.resultType, true, true);
-        break;
+/*
+   doNameM2 -
+*/
 
-      case decl_tsize:
-        doUnary (p, (const char *) "TSIZE", 5, n->unaryF.arg, n->unaryF.resultType, true, true);
-        break;
+static void doNameM2 (mcPretty_pretty p, decl_node__opaque n)
+{
+  doNameC (p, n);
+}
 
-      case decl_float:
-        doUnary (p, (const char *) "FLOAT", 5, n->unaryF.arg, n->unaryF.resultType, true, true);
-        break;
 
-      case decl_trunc:
-        doUnary (p, (const char *) "TRUNC", 5, n->unaryF.arg, n->unaryF.resultType, true, true);
-        break;
+/*
+   doUsed -
+*/
 
-      case decl_ord:
-        doUnary (p, (const char *) "ORD", 3, n->unaryF.arg, n->unaryF.resultType, true, true);
-        break;
+static void doUsed (mcPretty_pretty p, bool used)
+{
+  if (! used)
+    {
+      mcPretty_setNeedSpace (p);
+      outText (p, (const char *) "__attribute__((unused))", 23);
+    }
+}
 
-      case decl_chr:
-        doUnary (p, (const char *) "CHR", 3, n->unaryF.arg, n->unaryF.resultType, true, true);
-        break;
 
-      case decl_cap:
-        doUnary (p, (const char *) "CAP", 3, n->unaryF.arg, n->unaryF.resultType, true, true);
-        break;
+/*
+   doHighC -
+*/
 
-      case decl_high:
-        doUnary (p, (const char *) "HIGH", 4, n->unaryF.arg, n->unaryF.resultType, true, true);
-        break;
+static void doHighC (mcPretty_pretty p, decl_node__opaque a, nameKey_Name n, bool isused)
+{
+  if ((decl_isArray (static_cast<decl_node> (a))) && (decl_isUnbounded (static_cast<decl_node> (a))))
+    {
+      /* need to display high.  */
+      mcPretty_print (p, (const char *) ",", 1);
+      mcPretty_setNeedSpace (p);
+      doTypeNameC (p, cardinalN);
+      mcPretty_setNeedSpace (p);
+      mcPretty_print (p, (const char *) "_", 1);
+      outTextN (p, n);
+      mcPretty_print (p, (const char *) "_high", 5);
+      doUsed (p, isused);
+    }
+}
 
-      case decl_re:
-        doUnary (p, (const char *) "RE", 2, n->unaryF.arg, n->unaryF.resultType, true, true);
-        break;
 
-      case decl_im:
-        doUnary (p, (const char *) "IM", 2, n->unaryF.arg, n->unaryF.resultType, true, true);
-        break;
+/*
+   doParamConstCast -
+*/
 
-      case decl_deref:
-        doPostUnary (p, (const char *) "^", 1, n->unaryF.arg);
-        break;
+static void doParamConstCast (mcPretty_pretty p, decl_node__opaque n)
+{
+  decl_node__opaque ptype;
 
-      case decl_equal:
-        doBinary (p, (const char *) "=", 1, n->binaryF.left, n->binaryF.right, true, true, false);
-        break;
+  ptype = static_cast<decl_node__opaque> (decl_getType (static_cast<decl_node> (n)));
+  if (((decl_isArray (static_cast<decl_node> (ptype))) && (decl_isUnbounded (static_cast<decl_node> (ptype)))) && (lang == decl_ansiCP))
+    {
+      outText (p, (const char *) "const", 5);
+      mcPretty_setNeedSpace (p);
+    }
+}
 
-      case decl_notequal:
-        doBinary (p, (const char *) "#", 1, n->binaryF.left, n->binaryF.right, true, true, false);
-        break;
 
-      case decl_less:
-        doBinary (p, (const char *) "<", 1, n->binaryF.left, n->binaryF.right, true, true, false);
-        break;
+/*
+   getParameterVariable - returns the variable which shadows the parameter
+                          named, m, in parameter block, n.
+*/
 
-      case decl_greater:
-        doBinary (p, (const char *) ">", 1, n->binaryF.left, n->binaryF.right, true, true, false);
-        break;
+static decl_node__opaque getParameterVariable (decl_node__opaque n, nameKey_Name m)
+{
+  decl_node__opaque p;
 
-      case decl_greequal:
-        doBinary (p, (const char *) ">=", 2, n->binaryF.left, n->binaryF.right, true, true, false);
-        break;
+  mcDebug_assert ((decl_isParam (static_cast<decl_node> (n))) || (decl_isVarParam (static_cast<decl_node> (n))));
+  if (decl_isParam (static_cast<decl_node> (n)))
+    {
+      p = n->paramF.scope;
+    }
+  else
+    {
+      p = n->varparamF.scope;
+    }
+  mcDebug_assert (decl_isProcedure (static_cast<decl_node> (p)));
+  return static_cast<decl_node__opaque> (decl_lookupInScope (static_cast<decl_node> (p), m));
+  /* static analysis guarentees a RETURN statement will be used before here.  */
+  __builtin_unreachable ();
+}
 
-      case decl_lessequal:
-        doBinary (p, (const char *) "<=", 2, n->binaryF.left, n->binaryF.right, true, true, false);
-        break;
 
-      case decl_componentref:
-        doBinary (p, (const char *) ".", 1, n->componentrefF.rec, n->componentrefF.field, false, false, false);
-        break;
+/*
+   doParamTypeEmit - emit parameter type for C/C++.  It checks to see if the
+                     parameter type is a procedure type and if it were declared
+                     in a definition module for "C" and if so it uses the "C"
+                     definition for a procedure type, rather than the mc
+                     C++ version.
+*/
 
-      case decl_pointerref:
-        doBinary (p, (const char *) "^.", 2, n->pointerrefF.ptr, n->pointerrefF.field, false, false, false);
-        break;
+static void doParamTypeEmit (mcPretty_pretty p, decl_node__opaque paramnode, decl_node__opaque paramtype)
+{
+  mcDebug_assert ((decl_isParam (static_cast<decl_node> (paramnode))) || (decl_isVarParam (static_cast<decl_node> (paramnode))));
+  if ((isForC (paramnode)) && (decl_isProcType (decl_skipType (static_cast<decl_node> (paramtype)))))
+    {
+      doFQNameC (p, paramtype);
+      outText (p, (const char *) "_C", 2);
+    }
+  else
+    {
+      doTypeNameC (p, paramtype);
+      doOpaqueModifier (p, paramnode);
+    }
+  /* 
+      IF nodeUsesOpaque (paramnode) AND (NOT getNodeOpaqueVoidStar (paramnode))
+      THEN
+         outText (p, '__opaque')
+      END
+  */
+}
 
-      case decl_cast:
-        doPreBinary (p, (const char *) "CAST", 4, n->binaryF.left, n->binaryF.right, true, true);
-        break;
 
-      case decl_val:
-        doPreBinary (p, (const char *) "VAL", 3, n->binaryF.left, n->binaryF.right, true, true);
-        break;
+/*
+   doParamTypeNameModifier - Add an _ to an unbounded parameter which is non var.
+*/
 
-      case decl_cmplx:
-        doPreBinary (p, (const char *) "CMPLX", 5, n->binaryF.left, n->binaryF.right, true, true);
-        break;
+static void doParamTypeNameModifier (mcPretty_pretty p, decl_node__opaque ptype, bool varparam)
+{
+  if ((! varparam && (decl_isArray (static_cast<decl_node> (ptype)))) && (decl_isUnbounded (static_cast<decl_node> (ptype))))
+    {
+      outText (p, (const char *) "_", 1);
+    }
+}
 
-      case decl_plus:
-        doBinary (p, (const char *) "+", 1, n->binaryF.left, n->binaryF.right, false, false, false);
+
+/*
+   initOpaqueCastState - assign fields opaque and voidstar in opaquestate.
+*/
+
+static void initOpaqueCastState (decl_opaqueCastState *opaquestate, bool opaque, bool voidstar)
+{
+  (*opaquestate).opaque = opaque;
+  (*opaquestate).voidStar = voidstar;
+}
+
+
+/*
+   initNodeOpaqueCastState - assign opaque and currentvoidstar
+*/
+
+static void initNodeOpaqueCastState (decl_node__opaque n, bool opaque, bool voidstar)
+{
+  switch (n->kind)
+    {
+      case decl_opaquecast:
+        initOpaqueCastState (&n->opaquecastF.opaqueState, opaque, voidstar);
         break;
 
-      case decl_sub:
-        doBinary (p, (const char *) "-", 1, n->binaryF.left, n->binaryF.right, false, false, false);
+      case decl_funccall:
+        initOpaqueCastState (&n->funccallF.opaqueState, opaque, voidstar);
         break;
 
-      case decl_div:
-        doBinary (p, (const char *) "DIV", 3, n->binaryF.left, n->binaryF.right, true, true, false);
+      case decl_var:
+        initOpaqueCastState (&n->varF.opaqueState, opaque, voidstar);
         break;
 
-      case decl_mod:
-        doBinary (p, (const char *) "MOD", 3, n->binaryF.left, n->binaryF.right, true, true, false);
+      case decl_array:
+        initOpaqueCastState (&n->arrayF.opaqueState, opaque, voidstar);
         break;
 
-      case decl_mult:
-        doBinary (p, (const char *) "*", 1, n->binaryF.left, n->binaryF.right, false, false, false);
+      case decl_varparam:
+        initOpaqueCastState (&n->varparamF.opaqueState, opaque, voidstar);
         break;
 
-      case decl_divide:
-        doBinary (p, (const char *) "/", 1, n->binaryF.left, n->binaryF.right, false, false, false);
+      case decl_param:
+        initOpaqueCastState (&n->paramF.opaqueState, opaque, voidstar);
         break;
 
-      case decl_literal:
-        doLiteral (p, n);
+      case decl_pointer:
+        initOpaqueCastState (&n->pointerF.opaqueState, opaque, voidstar);
         break;
 
-      case decl_const:
-        doConstExpr (p, n);
+      case decl_recordfield:
+        initOpaqueCastState (&n->recordfieldF.opaqueState, opaque, voidstar);
         break;
 
-      case decl_enumerationfield:
-        doEnumerationField (p, n);
+      case decl_componentref:
+        initOpaqueCastState (&n->componentrefF.opaqueState, opaque, voidstar);
         break;
 
-      case decl_string:
-        doString (p, n);
+      case decl_pointerref:
+        initOpaqueCastState (&n->pointerrefF.opaqueState, opaque, voidstar);
         break;
 
-      case decl_max:
-        doUnary (p, (const char *) "MAX", 3, n->unaryF.arg, n->unaryF.resultType, true, true);
+      case decl_arrayref:
+        initOpaqueCastState (&n->arrayrefF.opaqueState, opaque, voidstar);
         break;
 
-      case decl_min:
-        doUnary (p, (const char *) "MIN", 3, n->unaryF.arg, n->unaryF.resultType, true, true);
+      case decl_procedure:
+        initOpaqueCastState (&n->procedureF.opaqueState, opaque, voidstar);
         break;
 
-      case decl_var:
-        doVar (p, n);
+      case decl_proctype:
+        initOpaqueCastState (&n->proctypeF.opaqueState, opaque, voidstar);
         break;
 
 
       default:
-        CaseException ("../../gcc/m2/mc/decl.def", 20, 1);
+        M2RTS_HALT (-1);
         __builtin_unreachable ();
+        break;
     }
 }
 
 
 /*
-   doVar -
+   setOpaqueCastState - set the voidStar field in opaquestate.
 */
 
-static void doVar (mcPretty_pretty p, decl_node n)
+static void setOpaqueCastState (decl_opaqueCastState *opaquestate, bool voidstar)
 {
-  mcDebug_assert (decl_isVar (n));
-  if (n->varF.isVarParameter)
-    {
-      outText (p, (const char *) "(*", 2);
-      doFQDNameC (p, n, true);
-      outText (p, (const char *) ")", 1);
-    }
-  else
-    {
-      doFQDNameC (p, n, true);
-    }
+  (*opaquestate).voidStar = voidstar;
 }
 
 
 /*
-   doLiteralC -
+   setNodeOpaqueVoidStar - sets the voidStar field in node to voidstar.
 */
 
-static void doLiteralC (mcPretty_pretty p, decl_node n)
+static void setNodeOpaqueVoidStar (decl_node__opaque n, bool voidstar)
 {
-  DynamicStrings_String s;
-
-  mcDebug_assert (decl_isLiteral (n));
-  s = DynamicStrings_InitStringCharStar (nameKey_keyToCharStar (decl_getSymName (n)));
-  if (n->literalF.type == charN)
-    {
-      if ((DynamicStrings_char (s, -1)) == 'C')
-        {
-          s = DynamicStrings_Slice (DynamicStrings_Mark (s), 0, -1);
-          if ((DynamicStrings_char (s, 0)) != '0')
-            {
-              s = DynamicStrings_ConCat (DynamicStrings_InitString ((const char *) "0", 1), DynamicStrings_Mark (s));
-            }
-        }
-      outText (p, (const char *) "(char)", 6);
-      mcPretty_setNeedSpace (p);
-    }
-  else if ((DynamicStrings_char (s, -1)) == 'H')
-    {
-      /* avoid dangling else.  */
-      outText (p, (const char *) "0x", 2);
-      s = DynamicStrings_Slice (DynamicStrings_Mark (s), 0, -1);
-    }
-  else if ((DynamicStrings_char (s, -1)) == 'B')
+  mcDebug_assert (nodeUsesOpaque (n));
+  switch (n->kind)
     {
-      /* avoid dangling else.  */
-      outText (p, (const char *) "0", 1);
-      s = DynamicStrings_Slice (DynamicStrings_Mark (s), 0, -1);
-    }
-  outTextS (p, s);
-  s = DynamicStrings_KillString (s);
-}
-
-
-/*
-   doLiteral -
-*/
+      case decl_opaquecast:
+        setOpaqueCastState (&n->opaquecastF.opaqueState, voidstar);
+        break;
 
-static void doLiteral (mcPretty_pretty p, decl_node n)
-{
-  DynamicStrings_String s;
+      case decl_funccall:
+        setOpaqueCastState (&n->funccallF.opaqueState, voidstar);
+        break;
 
-  mcDebug_assert (decl_isLiteral (n));
-  s = DynamicStrings_InitStringCharStar (nameKey_keyToCharStar (decl_getSymName (n)));
-  if (n->literalF.type == charN)
-    {
-      if ((DynamicStrings_char (s, -1)) == 'C')
-        {
-          s = DynamicStrings_Slice (DynamicStrings_Mark (s), 0, -1);
-          if ((DynamicStrings_char (s, 0)) != '0')
-            {
-              s = DynamicStrings_ConCat (DynamicStrings_InitString ((const char *) "0", 1), DynamicStrings_Mark (s));
-            }
-        }
-      outText (p, (const char *) "(char)", 6);
-      mcPretty_setNeedSpace (p);
-    }
-  outTextS (p, s);
-  s = DynamicStrings_KillString (s);
-}
+      case decl_var:
+        setOpaqueCastState (&n->varF.opaqueState, voidstar);
+        break;
 
+      case decl_array:
+        setOpaqueCastState (&n->arrayF.opaqueState, voidstar);
+        break;
 
-/*
-   isString - returns TRUE if node, n, is a string.
-*/
+      case decl_varparam:
+        setOpaqueCastState (&n->varparamF.opaqueState, voidstar);
+        break;
 
-static bool isString (decl_node n)
-{
-  mcDebug_assert (n != NULL);
-  return n->kind == decl_string;
-  /* static analysis guarentees a RETURN statement will be used before here.  */
-  __builtin_unreachable ();
-}
+      case decl_param:
+        setOpaqueCastState (&n->paramF.opaqueState, voidstar);
+        break;
 
+      case decl_pointer:
+        setOpaqueCastState (&n->pointerF.opaqueState, voidstar);
+        break;
 
-/*
-   doString -
-*/
+      case decl_recordfield:
+        setOpaqueCastState (&n->recordfieldF.opaqueState, voidstar);
+        break;
 
-static void doString (mcPretty_pretty p, decl_node n)
-{
-  DynamicStrings_String s;
+      case decl_componentref:
+        mcDebug_assert (! voidstar);
+        setOpaqueCastState (&n->componentrefF.opaqueState, voidstar);
+        break;
 
-  mcDebug_assert (isString (n));
-  s = DynamicStrings_InitStringCharStar (nameKey_keyToCharStar (decl_getSymName (n)));
-  outTextS (p, s);
-  s = DynamicStrings_KillString (s);
-  /* 
-   IF DynamicStrings.Index (s, '"', 0)=-1
-   THEN
-      outText (p, '"') ;
-      outTextS (p, s) ;
-      outText (p, '"')
-   ELSIF DynamicStrings.Index (s, "'", 0)=-1
-   THEN
-      outText (p, '"') ;
-      outTextS (p, s) ;
-      outText (p, '"')
-   ELSE
-      metaError1 ('illegal string {%1k}', n)
-   END
-  */
-  M2RTS_HALT (-1);
-  __builtin_unreachable ();
-}
+      case decl_pointerref:
+        mcDebug_assert (! voidstar);
+        setOpaqueCastState (&n->pointerrefF.opaqueState, voidstar);
+        break;
 
+      case decl_arrayref:
+        setOpaqueCastState (&n->arrayrefF.opaqueState, voidstar);
+        break;
 
-/*
-   replaceChar - replace every occurance of, ch, by, a and return modified string, s.
-*/
+      case decl_procedure:
+        setOpaqueCastState (&n->procedureF.opaqueState, voidstar);
+        break;
 
-static DynamicStrings_String replaceChar (DynamicStrings_String s, char ch, const char *a_, unsigned int _a_high)
-{
-  int i;
-  char a[_a_high+1];
+      case decl_proctype:
+        setOpaqueCastState (&n->proctypeF.opaqueState, voidstar);
+        break;
 
-  /* make a local copy of each unbounded array.  */
-  memcpy (a, a_, _a_high+1);
 
-  i = 0;
-  for (;;)
-  {
-    i = DynamicStrings_Index (s, ch, static_cast<unsigned int> (i));
-    if (i == 0)
-      {
-        s = DynamicStrings_ConCat (DynamicStrings_InitString ((const char *) a, _a_high), DynamicStrings_Slice (s, 1, 0));
-        i = StrLib_StrLen ((const char *) a, _a_high);
-      }
-    else if (i > 0)
-      {
-        /* avoid dangling else.  */
-        s = DynamicStrings_ConCat (DynamicStrings_ConCat (DynamicStrings_Slice (s, 0, i), DynamicStrings_Mark (DynamicStrings_InitString ((const char *) a, _a_high))), DynamicStrings_Slice (s, i+1, 0));
-        i += StrLib_StrLen ((const char *) a, _a_high);
-      }
-    else
-      {
-        /* avoid dangling else.  */
-        return s;
-      }
-  }
-  ReturnException ("../../gcc/m2/mc/decl.def", 20, 1);
-  __builtin_unreachable ();
+      default:
+        M2RTS_HALT (-1);
+        __builtin_unreachable ();
+        break;
+    }
 }
 
 
 /*
-   toCstring - translates string, n, into a C string
-               and returns the new String.
+   nodeUsesOpaque - return TRUE if node n uses an opaque type.
 */
 
-static DynamicStrings_String toCstring (nameKey_Name n)
+static bool nodeUsesOpaque (decl_node__opaque n)
 {
-  DynamicStrings_String s;
-
-  s = DynamicStrings_Slice (DynamicStrings_InitStringCharStar (nameKey_keyToCharStar (n)), 1, -1);
-  return replaceChar (replaceChar (s, '\\', (const char *) "\\\\", 2), '"', (const char *) "\\\"", 2);
-  /* static analysis guarentees a RETURN statement will be used before here.  */
-  __builtin_unreachable ();
-}
-
+  switch (n->kind)
+    {
+      case decl_opaquecast:
+        return n->opaquecastF.opaqueState.opaque;
+        break;
 
-/*
-   toCchar -
-*/
+      case decl_funccall:
+        return n->funccallF.opaqueState.opaque;
+        break;
 
-static DynamicStrings_String toCchar (nameKey_Name n)
-{
-  DynamicStrings_String s;
+      case decl_var:
+        return n->varF.opaqueState.opaque;
+        break;
 
-  s = DynamicStrings_Slice (DynamicStrings_InitStringCharStar (nameKey_keyToCharStar (n)), 1, -1);
-  return replaceChar (replaceChar (s, '\\', (const char *) "\\\\", 2), '\'', (const char *) "\\'", 2);
-  /* static analysis guarentees a RETURN statement will be used before here.  */
-  __builtin_unreachable ();
-}
+      case decl_array:
+        return n->arrayF.opaqueState.opaque;
+        break;
 
+      case decl_varparam:
+        return n->varparamF.opaqueState.opaque;
+        break;
 
-/*
-   countChar -
-*/
+      case decl_param:
+        return n->paramF.opaqueState.opaque;
+        break;
 
-static unsigned int countChar (DynamicStrings_String s, char ch)
-{
-  int i;
-  unsigned int c;
+      case decl_pointer:
+        return n->pointerF.opaqueState.opaque;
+        break;
 
-  c = 0;
-  i = 0;
-  for (;;)
-  {
-    i = DynamicStrings_Index (s, ch, static_cast<unsigned int> (i));
-    if (i >= 0)
-      {
-        i += 1;
-        c += 1;
-      }
-    else
-      {
-        return c;
-      }
-  }
-  ReturnException ("../../gcc/m2/mc/decl.def", 20, 1);
-  __builtin_unreachable ();
-}
+      case decl_recordfield:
+        return n->recordfieldF.opaqueState.opaque;
+        break;
 
+      case decl_componentref:
+        return n->componentrefF.opaqueState.opaque;
+        break;
 
-/*
-   lenCstring -
-*/
+      case decl_pointerref:
+        return n->pointerrefF.opaqueState.opaque;
+        break;
 
-static unsigned int lenCstring (DynamicStrings_String s)
-{
-  return (DynamicStrings_Length (s))-(countChar (s, '\\'));
+      case decl_arrayref:
+        return n->arrayrefF.opaqueState.opaque;
+        break;
+
+      case decl_procedure:
+        return n->procedureF.opaqueState.opaque;
+        break;
+
+      case decl_proctype:
+        return n->proctypeF.opaqueState.opaque;
+        break;
+
+      case decl_deref:
+        return nodeUsesOpaque (n->unaryF.arg);
+        break;
+
+
+      default:
+        return false;
+        break;
+    }
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
 
 
 /*
-   outCstring -
+   getNodeOpaqueVoidStar - return TRUE if the opaque type used by node n is a void *.
 */
 
-static void outCstring (mcPretty_pretty p, decl_node s, bool aString)
+static bool getNodeOpaqueVoidStar (decl_node__opaque n)
 {
-  if (aString)
-    {
-      outText (p, (const char *) "\"", 1);
-      outRawS (p, s->stringF.cstring);
-      outText (p, (const char *) "\"", 1);
-    }
-  else
+  mcDebug_assert (nodeUsesOpaque (n));
+  switch (n->kind)
     {
-      outText (p, (const char *) "'", 1);
-      outRawS (p, s->stringF.cchar);
-      outText (p, (const char *) "'", 1);
-    }
-}
+      case decl_opaquecast:
+        return n->opaquecastF.opaqueState.voidStar;
+        break;
 
+      case decl_funccall:
+        return n->funccallF.opaqueState.voidStar;
+        break;
 
-/*
-   doStringC -
-*/
+      case decl_var:
+        return n->varF.opaqueState.voidStar;
+        break;
 
-static void doStringC (mcPretty_pretty p, decl_node n)
-{
-  DynamicStrings_String s;
+      case decl_array:
+        return n->arrayF.opaqueState.voidStar;
+        break;
 
-  mcDebug_assert (isString (n));
-  /* 
-   s := InitStringCharStar (keyToCharStar (getSymName (n))) ;
-   IF DynamicStrings.Length (s)>3
-   THEN
-      IF DynamicStrings.Index (s, '"', 0)=-1
-      THEN
-         s := DynamicStrings.Slice (s, 1, -1) ;
-         outText (p, '"') ;
-         outCstring (p, s) ;
-         outText (p, '"')
-      ELSIF DynamicStrings.Index (s, "'", 0)=-1
-      THEN
-         s := DynamicStrings.Slice (s, 1, -1) ;
-         outText (p, '"') ;
-         outCstring (p, s) ;
-         outText (p, '"')
-      ELSE
-         metaError1 ('illegal string {%1k}', n)
-      END
-   ELSIF DynamicStrings.Length (s) = 3
-   THEN
-      s := DynamicStrings.Slice (s, 1, -1) ;
-      outText (p, "'") ;
-      IF DynamicStrings.char (s, 0) = "'"
-      THEN
-         outText (p, "\'")
-      ELSIF DynamicStrings.char (s, 0) = "\"
-      THEN
-         outText (p, "\\")
-      ELSE
-         outTextS (p, s)
-      END ;
-      outText (p, "'")
-   ELSE
-      outText (p, "'\0'")
-   END ;
-   s := KillString (s)
-  */
-  outCstring (p, n, ! n->stringF.isCharCompatible);
-}
+      case decl_varparam:
+        return n->varparamF.opaqueState.voidStar;
+        break;
 
+      case decl_param:
+        return n->paramF.opaqueState.voidStar;
+        break;
 
-/*
-   isPunct -
-*/
+      case decl_pointer:
+        return n->pointerF.opaqueState.voidStar;
+        break;
 
-static bool isPunct (char ch)
-{
-  return (((((((((ch == '.') || (ch == '(')) || (ch == ')')) || (ch == '^')) || (ch == ':')) || (ch == ';')) || (ch == '{')) || (ch == '}')) || (ch == ',')) || (ch == '*');
-  /* static analysis guarentees a RETURN statement will be used before here.  */
-  __builtin_unreachable ();
-}
+      case decl_recordfield:
+        return n->recordfieldF.opaqueState.voidStar;
+        break;
 
+      case decl_componentref:
+        return n->componentrefF.opaqueState.voidStar;
+        break;
 
-/*
-   isWhite -
-*/
+      case decl_pointerref:
+        return n->pointerrefF.opaqueState.voidStar;
+        break;
 
-static bool isWhite (char ch)
-{
-  return ((ch == ' ') || (ch == ASCII_tab)) || (ch == ASCII_lf);
-  /* static analysis guarentees a RETURN statement will be used before here.  */
-  __builtin_unreachable ();
-}
+      case decl_arrayref:
+        return n->arrayrefF.opaqueState.voidStar;
+        break;
 
+      case decl_procedure:
+        return n->procedureF.opaqueState.voidStar;
+        break;
 
-/*
-   outText -
-*/
+      case decl_proctype:
+        return n->proctypeF.opaqueState.voidStar;
+        break;
 
-static void outText (mcPretty_pretty p, const char *a_, unsigned int _a_high)
-{
-  DynamicStrings_String s;
-  char a[_a_high+1];
+      case decl_deref:
+        return false;
+        break;
 
-  /* make a local copy of each unbounded array.  */
-  memcpy (a, a_, _a_high+1);
 
-  s = DynamicStrings_InitString ((const char *) a, _a_high);
-  outTextS (p, s);
-  s = DynamicStrings_KillString (s);
+      default:
+        M2RTS_HALT (-1);
+        __builtin_unreachable ();
+        break;
+    }
+  ReturnException ("../../gcc/m2/mc/decl.def", 20, 1);
+  __builtin_unreachable ();
 }
 
 
 /*
-   outRawS -
+   getOpaqueFlushNecessary - return TRUE if the value next differs from the opaque state.
 */
 
-static void outRawS (mcPretty_pretty p, DynamicStrings_String s)
+static bool getOpaqueFlushNecessary (decl_opaqueCastState state, bool next)
 {
-  mcPretty_raw (p, s);
+  return state.opaque && (state.voidStar != next);
+  /* static analysis guarentees a RETURN statement will be used before here.  */
+  __builtin_unreachable ();
 }
 
 
 /*
-   outKm2 -
+   getNodeOpaqueFlushNecessary - return TRUE if the value of next requires a cast.
 */
 
-static mcPretty_pretty outKm2 (mcPretty_pretty p, const char *a_, unsigned int _a_high)
+static bool getNodeOpaqueFlushNecessary (decl_node__opaque n, bool next)
 {
-  unsigned int i;
-  DynamicStrings_String s;
-  char a[_a_high+1];
+  switch (n->kind)
+    {
+      case decl_opaquecast:
+        return getOpaqueFlushNecessary (n->opaquecastF.opaqueState, next);
+        break;
 
-  /* make a local copy of each unbounded array.  */
-  memcpy (a, a_, _a_high+1);
+      case decl_funccall:
+        return getOpaqueFlushNecessary (n->funccallF.opaqueState, next);
+        break;
 
-  if (StrLib_StrEqual ((const char *) a, _a_high, (const char *) "RECORD", 6))
-    {
-      p = mcPretty_pushPretty (p);
-      i = mcPretty_getcurpos (p);
-      mcPretty_setindent (p, i);
-      outText (p, (const char *) a, _a_high);
-      p = mcPretty_pushPretty (p);
-      mcPretty_setindent (p, i+indentation);
-    }
-  else if (StrLib_StrEqual ((const char *) a, _a_high, (const char *) "END", 3))
-    {
-      /* avoid dangling else.  */
-      p = mcPretty_popPretty (p);
-      outText (p, (const char *) a, _a_high);
-      p = mcPretty_popPretty (p);
-    }
-  return p;
-  /* static analysis guarentees a RETURN statement will be used before here.  */
-  __builtin_unreachable ();
-}
+      case decl_var:
+        return getOpaqueFlushNecessary (n->varF.opaqueState, next);
+        break;
 
+      case decl_array:
+        return getOpaqueFlushNecessary (n->arrayF.opaqueState, next);
+        break;
 
-/*
-   outKc -
-*/
+      case decl_varparam:
+        return getOpaqueFlushNecessary (n->varparamF.opaqueState, next);
+        break;
 
-static mcPretty_pretty outKc (mcPretty_pretty p, const char *a_, unsigned int _a_high)
-{
-  int i;
-  unsigned int c;
-  DynamicStrings_String s;
-  DynamicStrings_String t;
-  char a[_a_high+1];
+      case decl_param:
+        return getOpaqueFlushNecessary (n->paramF.opaqueState, next);
+        break;
 
-  /* make a local copy of each unbounded array.  */
-  memcpy (a, a_, _a_high+1);
+      case decl_pointer:
+        return getOpaqueFlushNecessary (n->pointerF.opaqueState, next);
+        break;
 
-  s = DynamicStrings_InitString ((const char *) a, _a_high);
-  i = DynamicStrings_Index (s, '\\', 0);
-  if (i == -1)
-    {
-      t = NULL;
-    }
-  else
-    {
-      t = DynamicStrings_Slice (s, i, 0);
-      s = DynamicStrings_Slice (DynamicStrings_Mark (s), 0, i);
-    }
-  if ((DynamicStrings_char (s, 0)) == '{')
-    {
-      p = mcPretty_pushPretty (p);
-      c = mcPretty_getcurpos (p);
-      mcPretty_setindent (p, c);
-      outTextS (p, s);
-      p = mcPretty_pushPretty (p);
-      mcPretty_setindent (p, c+indentationC);
-    }
-  else if ((DynamicStrings_char (s, 0)) == '}')
-    {
-      /* avoid dangling else.  */
-      p = mcPretty_popPretty (p);
-      outTextS (p, s);
-      p = mcPretty_popPretty (p);
-    }
-  outTextS (p, t);
-  t = DynamicStrings_KillString (t);
-  s = DynamicStrings_KillString (s);
-  return p;
-  /* static analysis guarentees a RETURN statement will be used before here.  */
-  __builtin_unreachable ();
-}
+      case decl_recordfield:
+        return getOpaqueFlushNecessary (n->recordfieldF.opaqueState, next);
+        break;
+
+      case decl_componentref:
+        return getOpaqueFlushNecessary (n->componentrefF.opaqueState, next);
+        break;
+
+      case decl_pointerref:
+        return getOpaqueFlushNecessary (n->pointerrefF.opaqueState, next);
+        break;
+
+      case decl_arrayref:
+        return getOpaqueFlushNecessary (n->arrayrefF.opaqueState, next);
+        break;
 
+      case decl_procedure:
+        return getOpaqueFlushNecessary (n->procedureF.opaqueState, next);
+        break;
 
-/*
-   outTextS -
-*/
+      case decl_proctype:
+        return getOpaqueFlushNecessary (n->proctypeF.opaqueState, next);
+        break;
 
-static void outTextS (mcPretty_pretty p, DynamicStrings_String s)
-{
-  if (s != NULL)
-    {
-      mcPretty_prints (p, s);
+
+      default:
+        return false;
+        break;
     }
+  /* static analysis guarentees a RETURN statement will be used before here.  */
+  __builtin_unreachable ();
 }
 
 
 /*
-   outCard -
+   makeOpaqueCast - wrap node n with an opaquecast node and assign
+                    voidstar into the new opaque state.
 */
 
-static void outCard (mcPretty_pretty p, unsigned int c)
+static decl_node__opaque makeOpaqueCast (decl_node__opaque n, bool voidstar)
 {
-  DynamicStrings_String s;
+  decl_node__opaque o;
 
-  s = StringConvert_CardinalToString (c, 0, ' ', 10, false);
-  outTextS (p, s);
-  s = DynamicStrings_KillString (s);
+  o = newNode (decl_opaquecast);
+  o->opaquecastF.exp = n;
+  initOpaqueCastState (&o->opaquecastF.opaqueState, true, voidstar);
+  return o;
+  /* static analysis guarentees a RETURN statement will be used before here.  */
+  __builtin_unreachable ();
 }
 
 
 /*
-   outTextN -
+   flushOpaque - perform a cast to voidstar (if necessary) and ignore the new
+                 node which could be created.
 */
 
-static void outTextN (mcPretty_pretty p, nameKey_Name n)
+static void flushOpaque (mcPretty_pretty p, decl_node__opaque n, bool toVoidStar)
 {
-  DynamicStrings_String s;
+  decl_node__opaque o;
 
-  s = DynamicStrings_InitStringCharStar (nameKey_keyToCharStar (n));
-  mcPretty_prints (p, s);
-  s = DynamicStrings_KillString (s);
+  o = castOpaque (p, n, toVoidStar);
 }
 
 
 /*
-   doTypeAliasC -
+   castOpaque - flushes the opaque type casts if necessary and changes the
+                voidstar boolean value.   If necessary it creates a opaquecast
+                and returns the new node otherwise return n.
 */
 
-static void doTypeAliasC (mcPretty_pretty p, decl_node n, decl_node *m)
+static decl_node__opaque castOpaque (mcPretty_pretty p, decl_node__opaque n, bool toVoidStar)
 {
-  mcPretty_print (p, (const char *) "typedef", 7);
-  mcPretty_setNeedSpace (p);
-  if ((decl_isTypeHidden (n)) && ((decl_isDef (decl_getMainModule ())) || ((decl_getScope (n)) != (decl_getMainModule ()))))
+  decl_node__opaque type;
+
+  if (getNodeOpaqueFlushNecessary (n, toVoidStar))
     {
-      outText (p, (const char *) "void *", 6);
+      type = static_cast<decl_node__opaque> (decl_getType (static_cast<decl_node> (n)));
+      if (toVoidStar)
+        {
+          /* next is true cast to void * opaque type.  */
+          outText (p, (const char *) "static_cast<", 12);
+          doTypeNameC (p, type);
+          mcPretty_noSpace (p);
+          outText (p, (const char *) "> (", 3);
+          doExprC (p, n);
+          outText (p, (const char *) ")", 1);
+          return makeOpaqueCast (n, true);
+        }
+      else
+        {
+          /* next is false cast to __opaque opaque type.  */
+          outText (p, (const char *) "static_cast<", 12);
+          doTypeNameC (p, type);
+          outText (p, (const char *) "__opaque", 8);
+          mcPretty_noSpace (p);
+          outText (p, (const char *) "> (", 3);
+          doExprC (p, n);
+          outText (p, (const char *) ")", 1);
+          return makeOpaqueCast (n, false);
+        }
     }
   else
     {
-      doTypeC (p, decl_getType (n), m);
-    }
-  if ((*m) != NULL)
-    {
-      doFQNameC (p, (*m));
+      if (debugOpaque)
+        {
+          doP = p;
+          dumpOpaqueState (n);
+          if (nodeUsesOpaque (n))
+            {
+              outText (p, (const char *) " /* no difference seen */ ", 26);
+            }
+          else
+            {
+              outText (p, (const char *) " /* no opaque used */ ", 22);
+            }
+        }
+      doExprC (p, n);
     }
-  mcPretty_print (p, (const char *) ";\\n\\n", 5);
+  return n;
+  /* static analysis guarentees a RETURN statement will be used before here.  */
+  __builtin_unreachable ();
 }
 
 
 /*
-   doEnumerationC -
+   isTypeOpaqueDefImp - returns TRUE if type is an opaque type by checking
+                        the def/imp pair of modules or fall back to the
+                        definition module.
 */
 
-static void doEnumerationC (mcPretty_pretty p, decl_node n)
+static bool isTypeOpaqueDefImp (decl_node__opaque type)
 {
-  unsigned int i;
-  unsigned int h;
-  decl_node s;
-  DynamicStrings_String t;
+  decl_node__opaque scope;
+  decl_node__opaque def;
+  decl_node__opaque opaque;
 
-  outText (p, (const char *) "enum {", 6);
-  i = Indexing_LowIndice (n->enumerationF.listOfSons);
-  h = Indexing_HighIndice (n->enumerationF.listOfSons);
-  while (i <= h)
+  if (type == NULL)
     {
-      s = static_cast<decl_node> (Indexing_GetIndice (n->enumerationF.listOfSons, i));
-      doFQDNameC (p, s, false);
-      if (i < h)
+      return false;
+    }
+  else if (decl_isType (static_cast<decl_node> (type)))
+    {
+      /* avoid dangling else.  */
+      scope = static_cast<decl_node__opaque> (decl_getScope (static_cast<decl_node> (type)));
+      if (decl_isImp (static_cast<decl_node> (scope)))
         {
-          outText (p, (const char *) ",", 1);
-          mcPretty_setNeedSpace (p);
+          /* avoid dangling else.  */
+          def = static_cast<decl_node__opaque> (decl_lookupDef (decl_getSymName (static_cast<decl_node> (scope))));
+          if (def != NULL)
+            {
+              /* Lookup the type name in the matching definition module.  */
+              opaque = static_cast<decl_node__opaque> (decl_lookupExported (static_cast<decl_node> (def), decl_getSymName (static_cast<decl_node> (type))));
+              return ((opaque != NULL) && (decl_isType (static_cast<decl_node> (opaque)))) && (decl_isTypeOpaque (static_cast<decl_node> (opaque)));
+            }
+        }
+      else
+        {
+          /* Otherwise just check the definition module.  */
+          return decl_isTypeOpaque (static_cast<decl_node> (type));
         }
-      i += 1;
     }
-  outText (p, (const char *) "}", 1);
+  return false;
+  /* static analysis guarentees a RETURN statement will be used before here.  */
+  __builtin_unreachable ();
 }
 
 
 /*
-   doNamesC -
+   isParamVoidStar - return TRUE if the procedure or proctype opaque type
+                     parameter should be implemented as a (void * ).
 */
 
-static void doNamesC (mcPretty_pretty p, nameKey_Name n)
+static bool isParamVoidStar (decl_node__opaque n)
 {
-  DynamicStrings_String s;
+  decl_node__opaque proc;
+  decl_node__opaque type;
 
-  s = DynamicStrings_InitStringCharStar (nameKey_keyToCharStar (n));
-  outTextS (p, s);
-  s = DynamicStrings_KillString (s);
+  proc = static_cast<decl_node__opaque> (decl_getScope (static_cast<decl_node> (n)));
+  mcDebug_assert ((decl_isProcedure (static_cast<decl_node> (proc))) || (decl_isProcType (static_cast<decl_node> (proc))));
+  type = static_cast<decl_node__opaque> (decl_getType (static_cast<decl_node> (n)));
+  return isReturnVoidStar (proc, type);
+  /* static analysis guarentees a RETURN statement will be used before here.  */
+  __builtin_unreachable ();
 }
 
 
 /*
-   doNameC -
+   isRefVoidStar - returns TRUE if the ref node uses an opaque type which
+                   is represented as a (void * ).
 */
 
-static void doNameC (mcPretty_pretty p, decl_node n)
+static bool isRefVoidStar (decl_node__opaque n)
 {
-  if ((n != NULL) && ((decl_getSymName (n)) != nameKey_NulName))
+  decl_node__opaque type;
+
+  type = static_cast<decl_node__opaque> (decl_getType (static_cast<decl_node> (n)));
+  if ((! (decl_isType (static_cast<decl_node> (type)))) || (! (decl_isTypeOpaque (static_cast<decl_node> (type)))))
     {
-      doNamesC (p, decl_getSymName (n));
+      /* We should finish the procedure as the ref does not use an opaque.  */
+      return true;
     }
+  else
+    {
+      /* We check whether the opaque type was declared in the implementation
+         module.  If it is declared in the implementation module then we
+         return FALSE.  */
+      return ! (isDeclInImp (type));
+    }
+  /* static analysis guarentees a RETURN statement will be used before here.  */
+  __builtin_unreachable ();
 }
 
 
 /*
-   initCname -
-*/
-
-static void initCname (decl_cnameT *c)
-{
-  (*c).init = false;
-}
-
-
-/*
-   doCname -
+   isReturnVoidStar - return TRUE if the procedure or proctype opaque type
+                      return type should be implemented as a (void * ).
 */
 
-static nameKey_Name doCname (nameKey_Name n, decl_cnameT *c, bool scopes)
+static bool isReturnVoidStar (decl_node__opaque proc, decl_node__opaque type)
 {
-  DynamicStrings_String s;
+  decl_node__opaque def;
 
-  if ((*c).init)
+  mcDebug_assert ((decl_isProcedure (static_cast<decl_node> (proc))) || (decl_isProcType (static_cast<decl_node> (proc))));
+  if (decl_isExported (static_cast<decl_node> (proc)))
     {
-      return (*c).name;
+      return true;
     }
   else
     {
-      (*c).init = true;
-      s = keyc_cname (n, scopes);
-      if (s == NULL)
+      /* Not exported therefore local, we check whether the opaque type
+         was declared in the implementation module.  */
+      if (decl_isImp (static_cast<decl_node> (currentModule)))
         {
-          (*c).name = n;
+          if (decl_isType (static_cast<decl_node> (type)))
+            {
+              return ! (isDeclInImp (type));
+            }
+          else
+            {
+              return false;
+            }
         }
       else
         {
-          (*c).name = nameKey_makekey (DynamicStrings_string (s));
-          s = DynamicStrings_KillString (s);
+          /* Always use void * in .def modules.  */
+          return true;
         }
-      return (*c).name;
     }
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
@@ -11748,189 +11429,266 @@ static nameKey_Name doCname (nameKey_Name n, decl_cnameT *c, bool scopes)
 
 
 /*
-   getDName -
+   isVarVoidStar - return TRUE if the variable using an opaque type should
+                   be implemented as a (void * ).
 */
 
-static nameKey_Name getDName (decl_node n, bool scopes)
+static bool isVarVoidStar (decl_node__opaque n)
 {
-  nameKey_Name m;
+  decl_node__opaque type;
 
-  m = decl_getSymName (n);
-  switch (n->kind)
+  mcDebug_assert (decl_isVar (static_cast<decl_node> (n)));
+  type = static_cast<decl_node__opaque> (decl_getType (static_cast<decl_node> (n)));
+  if ((! (decl_isType (static_cast<decl_node> (type)))) || (! (decl_isTypeOpaque (static_cast<decl_node> (type)))))
     {
-      case decl_procedure:
-        return doCname (m, &n->procedureF.cname, scopes);
-        break;
-
-      case decl_var:
-        return doCname (m, &n->varF.cname, scopes);
-        break;
-
-      case decl_recordfield:
-        return doCname (m, &n->recordfieldF.cname, scopes);
-        break;
-
-      case decl_enumerationfield:
-        return doCname (m, &n->enumerationfieldF.cname, scopes);
-        break;
-
-
-      default:
-        break;
+      /* We should finish the procedure as the variable does not use an opaque.  */
+      return true;
     }
-  return m;
-  /* static analysis guarentees a RETURN statement will be used before here.  */
-  __builtin_unreachable ();
-}
-
-
-/*
-   doDNameC -
-*/
-
-static void doDNameC (mcPretty_pretty p, decl_node n, bool scopes)
-{
-  if ((n != NULL) && ((decl_getSymName (n)) != nameKey_NulName))
+  else if (decl_isExported (static_cast<decl_node> (n)))
     {
-      doNamesC (p, getDName (n, scopes));
+      /* avoid dangling else.  */
+      /* Exported variables using an opaque type will always be implemented
+         with a (void * ).  */
+      return true;
+    }
+  else
+    {
+      /* avoid dangling else.  */
+      /* Not exported therefore static to the module (local or global non exported
+         variable), we check whether the opaque type was declared in the
+         implementation module.  If it is declared in the implementation module
+         then we return FALSE.  */
+      return ! (isDeclInImp (type));
     }
+  /* static analysis guarentees a RETURN statement will be used before here.  */
+  __builtin_unreachable ();
 }
 
 
 /*
-   doFQDNameC -
+   initNodeOpaqueState - initialize the node opaque state.
 */
 
-static void doFQDNameC (mcPretty_pretty p, decl_node n, bool scopes)
+static void initNodeOpaqueState (decl_node__opaque n)
 {
-  DynamicStrings_String s;
-
-  s = getFQDstring (n, scopes);
-  outTextS (p, s);
-  s = DynamicStrings_KillString (s);
-}
+  decl_node__opaque type;
 
+  switch (n->kind)
+    {
+      case decl_opaquecast:
+        break;
 
-/*
-   doFQNameC -
-*/
-
-static void doFQNameC (mcPretty_pretty p, decl_node n)
-{
-  DynamicStrings_String s;
+      case decl_funccall:
+        assignNodeOpaqueCastState (n, getFunction (n));  /* This must be done when the cast direction is known.  */
+        break;
 
-  s = getFQstring (n);
-  outTextS (p, s);
-  s = DynamicStrings_KillString (s);
-}
+      case decl_var:
+        type = static_cast<decl_node__opaque> (decl_getType (static_cast<decl_node> (n)));
+        if (n->varF.isParameter || n->varF.isVarParameter)
+          {
+            /* If the variable is really a parameter then it uses
+                        the state of the parameter.  */
+            initNodeOpaqueCastState (n, isTypeOpaqueDefImp (type), isParamVoidStar (n));
+          }
+        else
+          {
+            initNodeOpaqueCastState (n, isTypeOpaqueDefImp (type), isVarVoidStar (n));
+          }
+        break;
 
+      case decl_array:
+        type = static_cast<decl_node__opaque> (decl_getType (static_cast<decl_node> (n)));
+        initNodeOpaqueCastState (n, isTypeOpaqueDefImp (type), decl_isExported (static_cast<decl_node> (n)));
+        break;
 
-/*
-   doNameM2 -
-*/
+      case decl_varparam:
+      case decl_param:
+        mcDebug_assert ((decl_isProcedure (decl_getScope (static_cast<decl_node> (n)))) || (decl_isProcType (decl_getScope (static_cast<decl_node> (n)))));
+        type = static_cast<decl_node__opaque> (decl_getType (static_cast<decl_node> (n)));
+        initNodeOpaqueCastState (n, isTypeOpaqueDefImp (type), isParamVoidStar (n));
+        break;
 
-static void doNameM2 (mcPretty_pretty p, decl_node n)
-{
-  doNameC (p, n);
-}
+      case decl_componentref:
+      case decl_pointerref:
+      case decl_pointer:
+      case decl_recordfield:
+      case decl_arrayref:
+        type = static_cast<decl_node__opaque> (decl_getType (static_cast<decl_node> (n)));
+        /* In the future this should be revisited.  */
+        initNodeOpaqueCastState (n, isTypeOpaqueDefImp (type), isRefVoidStar (n));
+        break;
 
+      case decl_proctype:
+      case decl_procedure:
+        type = static_cast<decl_node__opaque> (decl_getType (static_cast<decl_node> (n)));  /* We only consider the return type for a procedure or proctype.
+                     The parameters and local vars are handled separately (see
+                     above).  */
+        if (type == NULL)
+          {
+            /* No return type, therefore no opaque type used.  */
+            initNodeOpaqueCastState (n, false, false);
+          }
+        else
+          {
+            /* Init state from the return type.  Is type an opaque type?
+                        Is the opaque type declared in this module?  */
+            initNodeOpaqueCastState (n, isTypeOpaqueDefImp (type), isReturnVoidStar (n, type));
+          }
+        break;
 
-/*
-   doUsed -
-*/
 
-static void doUsed (mcPretty_pretty p, bool used)
-{
-  if (! used)
-    {
-      mcPretty_setNeedSpace (p);
-      outText (p, (const char *) "__attribute__((unused))", 23);
+      default:
+        break;
     }
-}
-
-
-/*
-   doHighC -
-*/
-
-static void doHighC (mcPretty_pretty p, decl_node a, nameKey_Name n, bool isused)
-{
-  if ((decl_isArray (a)) && (decl_isUnbounded (a)))
-    {
-      /* need to display high.  */
-      mcPretty_print (p, (const char *) ",", 1);
-      mcPretty_setNeedSpace (p);
-      doTypeNameC (p, cardinalN);
-      mcPretty_setNeedSpace (p);
-      mcPretty_print (p, (const char *) "_", 1);
-      outTextN (p, n);
-      mcPretty_print (p, (const char *) "_high", 5);
-      doUsed (p, isused);
+  if (debugOpaque)
+    {
+      dumpOpaqueState (n);
     }
 }
 
 
 /*
-   doParamConstCast -
+   assignNodeOpaqueCastState - copy the opaqueCastState from src into dest.
 */
 
-static void doParamConstCast (mcPretty_pretty p, decl_node n)
+static void assignNodeOpaqueCastState (decl_node__opaque dest, decl_node__opaque src)
 {
-  decl_node ptype;
-
-  ptype = decl_getType (n);
-  if (((decl_isArray (ptype)) && (decl_isUnbounded (ptype))) && (lang == decl_ansiCP))
+  if (nodeUsesOpaque (src))
     {
-      outText (p, (const char *) "const", 5);
-      mcPretty_setNeedSpace (p);
+      initNodeOpaqueCastState (dest, true, getNodeOpaqueVoidStar (src));
+    }
+  else
+    {
+      initNodeOpaqueCastState (dest, false, false);
     }
 }
 
 
 /*
-   getParameterVariable - returns the variable which shadows the parameter
-                          named, m, in parameter block, n.
+   assignNodeOpaqueCastFalse - assign the voidstar field of dest to false.
+                               It assigns the opaque field of dest to the value
+                               of the src opaque field.
 */
 
-static decl_node getParameterVariable (decl_node n, nameKey_Name m)
+static void assignNodeOpaqueCastFalse (decl_node__opaque dest, decl_node__opaque src)
 {
-  decl_node p;
-
-  mcDebug_assert ((decl_isParam (n)) || (decl_isVarParam (n)));
-  if (decl_isParam (n))
+  if (nodeUsesOpaque (src))
     {
-      p = n->paramF.scope;
+      initNodeOpaqueCastState (dest, true, false);
     }
   else
     {
-      p = n->varparamF.scope;
+      initNodeOpaqueCastState (dest, false, false);
     }
-  mcDebug_assert (decl_isProcedure (p));
-  return decl_lookupInScope (p, m);
-  /* static analysis guarentees a RETURN statement will be used before here.  */
-  __builtin_unreachable ();
 }
 
 
 /*
-   doParamTypeEmit - emit parameter type for C/C++.  It checks to see if the
-                     parameter type is a procedure type and if it were declared
-                     in a definition module for "C" and if so it uses the "C"
-                     definition for a procedure type, rather than the mc
-                     C++ version.
+   dumpOpaqueState -
 */
 
-static void doParamTypeEmit (mcPretty_pretty p, decl_node paramnode, decl_node paramtype)
+static void dumpOpaqueState (decl_node__opaque n)
 {
-  mcDebug_assert ((decl_isParam (paramnode)) || (decl_isVarParam (paramnode)));
-  if ((isForC (paramnode)) && (decl_isProcType (decl_skipType (paramtype))))
+  decl_node__opaque o;
+
+  switch (n->kind)
     {
-      doFQNameC (p, paramtype);
-      outText (p, (const char *) "_C", 2);
+      case decl_opaquecast:
+      case decl_funccall:
+      case decl_var:
+      case decl_array:
+      case decl_varparam:
+      case decl_param:
+      case decl_pointer:
+      case decl_recordfield:
+      case decl_componentref:
+      case decl_arrayref:
+      case decl_procedure:
+      case decl_proctype:
+        o = n;
+        break;
+
+
+      default:
+        o = static_cast<decl_node__opaque> (NULL);
+        break;
     }
-  else
+  if (o != NULL)
     {
-      doTypeNameC (p, paramtype);
+      outText (doP, (const char *) "/* ", 3);
+      doNameC (doP, o);
+      outText (doP, (const char *) "  ", 2);
+      switch (o->kind)
+        {
+          case decl_opaquecast:
+            outText (doP, (const char *) "opaquecast", 10);
+            break;
+
+          case decl_funccall:
+            outText (doP, (const char *) "funccall", 8);
+            break;
+
+          case decl_var:
+            outText (doP, (const char *) "var", 3);
+            break;
+
+          case decl_array:
+            outText (doP, (const char *) "array", 5);
+            break;
+
+          case decl_varparam:
+            outText (doP, (const char *) "varparam", 8);
+            break;
+
+          case decl_param:
+            outText (doP, (const char *) "param", 5);
+            break;
+
+          case decl_pointer:
+            outText (doP, (const char *) "pointer", 7);
+            break;
+
+          case decl_recordfield:
+            outText (doP, (const char *) "recordfield", 11);
+            break;
+
+          case decl_componentref:
+            outText (doP, (const char *) "componentref", 12);
+            break;
+
+          case decl_pointerref:
+            outText (doP, (const char *) "pointerref", 10);
+            break;
+
+          case decl_arrayref:
+            outText (doP, (const char *) "arrayref", 8);
+            break;
+
+          case decl_procedure:
+            outText (doP, (const char *) "procedure", 9);
+            break;
+
+          case decl_proctype:
+            outText (doP, (const char *) "proctype", 8);
+            break;
+
+
+          default:
+            break;
+        }
+      if (nodeUsesOpaque (o))
+        {
+          /* avoid gcc warning by using compound statement even if not strictly necessary.  */
+          if (getNodeOpaqueVoidStar (o))
+            {
+              outText (doP, (const char *) " uses (void *) opaque", 21);
+            }
+          else
+            {
+              outText (doP, (const char *) " uses opaque__full", 18);
+            }
+        }
+      outText (doP, (const char *) " */ \\n", 6);
     }
 }
 
@@ -11939,24 +11697,24 @@ static void doParamTypeEmit (mcPretty_pretty p, decl_node paramnode, decl_node p
    doParamC - emit parameter for C/C++.
 */
 
-static void doParamC (mcPretty_pretty p, decl_node n)
+static void doParamC (mcPretty_pretty p, decl_node__opaque n)
 {
-  decl_node v;
-  decl_node ptype;
+  decl_node__opaque v;
+  decl_node__opaque ptype;
   nameKey_Name i;
   unsigned int c;
   unsigned int t;
   wlists_wlist l;
 
-  mcDebug_assert (decl_isParam (n));
-  ptype = decl_getType (n);
+  mcDebug_assert (decl_isParam (static_cast<decl_node> (n)));
+  ptype = static_cast<decl_node__opaque> (decl_getType (static_cast<decl_node> (n)));
   if (n->paramF.namelist == NULL)
     {
       /* avoid dangling else.  */
       doParamConstCast (p, n);
       doTypeNameC (p, ptype);
       doUsed (p, n->paramF.isUsed);
-      if ((decl_isArray (ptype)) && (decl_isUnbounded (ptype)))
+      if ((decl_isArray (static_cast<decl_node> (ptype))) && (decl_isUnbounded (static_cast<decl_node> (ptype))))
         {
           outText (p, (const char *) ",", 1);
           mcPretty_setNeedSpace (p);
@@ -11972,7 +11730,7 @@ static void doParamC (mcPretty_pretty p, decl_node n)
           /* avoid dangling else.  */
           doParamConstCast (p, n);
           doParamTypeEmit (p, n, ptype);
-          if ((decl_isArray (ptype)) && (decl_isUnbounded (ptype)))
+          if ((decl_isArray (static_cast<decl_node> (ptype))) && (decl_isUnbounded (static_cast<decl_node> (ptype))))
             {
               doUsed (p, n->paramF.isUsed);
               outText (p, (const char *) ",", 1);
@@ -11989,7 +11747,7 @@ static void doParamC (mcPretty_pretty p, decl_node n)
               doParamConstCast (p, n);
               doParamTypeEmit (p, n, ptype);
               i = static_cast<nameKey_Name> (wlists_getItemFromList (l, c));
-              if ((decl_isArray (ptype)) && (decl_isUnbounded (ptype)))
+              if ((decl_isArray (static_cast<decl_node> (ptype))) && (decl_isUnbounded (static_cast<decl_node> (ptype))))
                 {
                   mcPretty_noSpace (p);
                 }
@@ -12006,10 +11764,7 @@ static void doParamC (mcPretty_pretty p, decl_node n)
                 {
                   doFQDNameC (p, v, true);
                 }
-              if ((decl_isArray (ptype)) && (decl_isUnbounded (ptype)))
-                {
-                  outText (p, (const char *) "_", 1);
-                }
+              doParamTypeNameModifier (p, ptype, false);
               doUsed (p, n->paramF.isUsed);
               doHighC (p, ptype, i, n->paramF.isUsed);
               if (c < t)
@@ -12028,29 +11783,29 @@ static void doParamC (mcPretty_pretty p, decl_node n)
    doVarParamC - emit a VAR parameter for C/C++.
 */
 
-static void doVarParamC (mcPretty_pretty p, decl_node n)
+static void doVarParamC (mcPretty_pretty p, decl_node__opaque n)
 {
-  decl_node v;
-  decl_node ptype;
+  decl_node__opaque v;
+  decl_node__opaque ptype;
   nameKey_Name i;
   unsigned int c;
   unsigned int t;
   wlists_wlist l;
 
-  mcDebug_assert (decl_isVarParam (n));
-  ptype = decl_getType (n);
+  mcDebug_assert (decl_isVarParam (static_cast<decl_node> (n)));
+  ptype = static_cast<decl_node__opaque> (decl_getType (static_cast<decl_node> (n)));
   if (n->varparamF.namelist == NULL)
     {
       /* avoid dangling else.  */
       doTypeNameC (p, ptype);
       /* doTypeC (p, ptype, n) ;  */
-      if (! (decl_isArray (ptype)))
+      if (! (decl_isArray (static_cast<decl_node> (ptype))))
         {
           mcPretty_setNeedSpace (p);
           outText (p, (const char *) "*", 1);
         }
       doUsed (p, n->varparamF.isUsed);
-      if ((decl_isArray (ptype)) && (decl_isUnbounded (ptype)))
+      if ((decl_isArray (static_cast<decl_node> (ptype))) && (decl_isUnbounded (static_cast<decl_node> (ptype))))
         {
           outText (p, (const char *) ",", 1);
           mcPretty_setNeedSpace (p);
@@ -12073,7 +11828,7 @@ static void doVarParamC (mcPretty_pretty p, decl_node n)
           while (c <= t)
             {
               doParamTypeEmit (p, n, ptype);
-              if (! (decl_isArray (ptype)))
+              if (! (decl_isArray (static_cast<decl_node> (ptype))))
                 {
                   mcPretty_setNeedSpace (p);
                   outText (p, (const char *) "*", 1);
@@ -12088,6 +11843,7 @@ static void doVarParamC (mcPretty_pretty p, decl_node n)
                 {
                   doFQDNameC (p, v, true);
                 }
+              doParamTypeNameModifier (p, ptype, true);
               doUsed (p, n->varparamF.isUsed);
               doHighC (p, ptype, i, n->varparamF.isUsed);
               if (c < t)
@@ -12106,15 +11862,15 @@ static void doVarParamC (mcPretty_pretty p, decl_node n)
    doOptargC -
 */
 
-static void doOptargC (mcPretty_pretty p, decl_node n)
+static void doOptargC (mcPretty_pretty p, decl_node__opaque n)
 {
-  decl_node ptype;
+  decl_node__opaque ptype;
   nameKey_Name i;
   unsigned int t;
   wlists_wlist l;
 
-  mcDebug_assert (decl_isOptarg (n));
-  ptype = decl_getType (n);
+  mcDebug_assert (decl_isOptarg (static_cast<decl_node> (n)));
+  ptype = static_cast<decl_node__opaque> (decl_getType (static_cast<decl_node> (n)));
   mcDebug_assert (n->optargF.namelist != NULL);
   mcDebug_assert (isIdentList (n->paramF.namelist));
   l = n->paramF.namelist->identlistF.names;
@@ -12132,23 +11888,23 @@ static void doOptargC (mcPretty_pretty p, decl_node n)
    doParameterC -
 */
 
-static void doParameterC (mcPretty_pretty p, decl_node n)
+static void doParameterC (mcPretty_pretty p, decl_node__opaque n)
 {
-  if (decl_isParam (n))
+  if (decl_isParam (static_cast<decl_node> (n)))
     {
       doParamC (p, n);
     }
-  else if (decl_isVarParam (n))
+  else if (decl_isVarParam (static_cast<decl_node> (n)))
     {
       /* avoid dangling else.  */
       doVarParamC (p, n);
     }
-  else if (decl_isVarargs (n))
+  else if (decl_isVarargs (static_cast<decl_node> (n)))
     {
       /* avoid dangling else.  */
       mcPretty_print (p, (const char *) "...", 3);
     }
-  else if (decl_isOptarg (n))
+  else if (decl_isOptarg (static_cast<decl_node> (n)))
     {
       /* avoid dangling else.  */
       doOptargC (p, n);
@@ -12160,11 +11916,65 @@ static void doParameterC (mcPretty_pretty p, decl_node n)
    doProcTypeC -
 */
 
-static void doProcTypeC (mcPretty_pretty p, decl_node t, decl_node n)
+static void doProcTypeC (mcPretty_pretty p, decl_node__opaque t, decl_node__opaque n)
+{
+  mcDebug_assert (decl_isType (static_cast<decl_node> (t)));
+  if ((isDeclType (t)) && (isDeclType (n)))
+    {
+      outputPartial (t);
+      doCompletePartialProcType (p, t, n);
+    }
+}
+
+
+/*
+   isDeclInImp - returns TRUE if node type is declared as an opaque and
+                 is declared fully in the current implementation module.
+                 This should only be called if isType (type).  Its purpose
+                 is specific to a type checking whether it is an opaque type
+                 declared in the .def/.mod pair of the current imp module.
+*/
+
+static bool isDeclInImp (decl_node__opaque type)
+{
+  decl_node__opaque scope;
+  decl_node__opaque def;
+  nameKey_Name name;
+
+  mcDebug_assert (decl_isType (static_cast<decl_node> (type)));
+  scope = static_cast<decl_node__opaque> (decl_getScope (static_cast<decl_node> (type)));
+  if ((isTypeOpaqueDefImp (type)) && (decl_isImp (static_cast<decl_node> (currentModule))))
+    {
+      name = decl_getSymName (static_cast<decl_node> (type));
+      if (name != nameKey_NulName)
+        {
+          /* Lookup the matching .def module.  */
+          def = static_cast<decl_node__opaque> (decl_lookupDef (decl_getSymName (static_cast<decl_node> (currentModule))));
+          if ((def != NULL) && ((def == scope) || (currentModule == scope)))
+            {
+              /* Return TRUE if the symbol has already been declared in the .def.  */
+              return (decl_lookupExported (static_cast<decl_node> (def), name)) != NULL;
+            }
+        }
+    }
+  return false;
+  /* static analysis guarentees a RETURN statement will be used before here.  */
+  __builtin_unreachable ();
+}
+
+
+/*
+   doTypeNameModifier - adds the __opaque modifier to the type n provided
+                        it is an opaque type which is being declared in the
+                        implementation module.
+*/
+
+static void doTypeNameModifier (mcPretty_pretty p, decl_node__opaque n)
 {
-  mcDebug_assert (decl_isType (t));
-  outputPartial (t);
-  doCompletePartialProcType (p, t, n);
+  if ((isTypeOpaqueDefImp (n)) && (decl_isImp (static_cast<decl_node> (currentModule))))
+    {
+      outText (p, (const char *) "__opaque", 8);
+    }
 }
 
 
@@ -12172,39 +11982,43 @@ static void doProcTypeC (mcPretty_pretty p, decl_node t, decl_node n)
    doTypesC -
 */
 
-static void doTypesC (decl_node n)
+static void doTypesC (decl_node__opaque n)
 {
-  decl_node m;
+  decl_node__opaque m;
 
-  if (decl_isType (n))
+  if (decl_isType (static_cast<decl_node> (n)))
     {
-      m = decl_getType (n);
-      if (decl_isProcType (m))
+      m = static_cast<decl_node__opaque> (decl_getType (static_cast<decl_node> (n)));
+      if (decl_isProcType (static_cast<decl_node> (m)))
         {
           doProcTypeC (doP, n, m);
         }
-      else if ((decl_isType (m)) || (decl_isPointer (m)))
+      else if ((decl_isType (static_cast<decl_node> (m))) || (decl_isPointer (static_cast<decl_node> (m))))
         {
           /* avoid dangling else.  */
           outText (doP, (const char *) "typedef", 7);
           mcPretty_setNeedSpace (doP);
           doTypeC (doP, m, &m);
-          if (decl_isType (m))
+          if (decl_isType (static_cast<decl_node> (m)))
             {
               mcPretty_setNeedSpace (doP);
             }
           doTypeNameC (doP, n);
+          doTypeNameModifier (doP, n);
           outText (doP, (const char *) ";\\n\\n", 5);
         }
-      else if (decl_isEnumeration (m))
+      else if (decl_isEnumeration (static_cast<decl_node> (m)))
         {
           /* avoid dangling else.  */
-          outText (doP, (const char *) "typedef", 7);
-          mcPretty_setNeedSpace (doP);
-          doTypeC (doP, m, &m);
-          mcPretty_setNeedSpace (doP);
-          doTypeNameC (doP, n);
-          outText (doP, (const char *) ";\\n\\n", 5);
+          if (isDeclType (n))
+            {
+              outText (doP, (const char *) "typedef", 7);
+              mcPretty_setNeedSpace (doP);
+              doTypeC (doP, m, &m);
+              mcPretty_setNeedSpace (doP);
+              doTypeNameC (doP, n);
+              outText (doP, (const char *) ";\\n\\n", 5);
+            }
         }
       else
         {
@@ -12212,11 +12026,12 @@ static void doTypesC (decl_node n)
           outText (doP, (const char *) "typedef", 7);
           mcPretty_setNeedSpace (doP);
           doTypeC (doP, m, &m);
-          if (decl_isType (m))
+          if (decl_isType (static_cast<decl_node> (m)))
             {
               mcPretty_setNeedSpace (doP);
             }
           doTypeNameC (doP, n);
+          doTypeNameModifier (doP, n);
           outText (doP, (const char *) ";\\n\\n", 5);
         }
     }
@@ -12227,23 +12042,23 @@ static void doTypesC (decl_node n)
    doCompletePartialC -
 */
 
-static void doCompletePartialC (decl_node n)
+static void doCompletePartialC (decl_node__opaque n)
 {
-  decl_node m;
+  decl_node__opaque m;
 
-  if (decl_isType (n))
+  if (decl_isType (static_cast<decl_node> (n)))
     {
-      m = decl_getType (n);
-      if (decl_isRecord (m))
+      m = static_cast<decl_node__opaque> (decl_getType (static_cast<decl_node> (n)));
+      if (decl_isRecord (static_cast<decl_node> (m)))
         {
           doCompletePartialRecord (doP, n, m);
         }
-      else if (decl_isArray (m))
+      else if (decl_isArray (static_cast<decl_node> (m)))
         {
           /* avoid dangling else.  */
           doCompletePartialArray (doP, n, m);
         }
-      else if (decl_isProcType (m))
+      else if (decl_isProcType (static_cast<decl_node> (m)))
         {
           /* avoid dangling else.  */
           doCompletePartialProcType (doP, n, m);
@@ -12256,14 +12071,14 @@ static void doCompletePartialC (decl_node n)
    doCompletePartialRecord -
 */
 
-static void doCompletePartialRecord (mcPretty_pretty p, decl_node t, decl_node r)
+static void doCompletePartialRecord (mcPretty_pretty p, decl_node__opaque t, decl_node__opaque r)
 {
   unsigned int i;
   unsigned int h;
-  decl_node f;
+  decl_node__opaque f;
 
-  mcDebug_assert (decl_isRecord (r));
-  mcDebug_assert (decl_isType (t));
+  mcDebug_assert (decl_isRecord (static_cast<decl_node> (r)));
+  mcDebug_assert (decl_isType (static_cast<decl_node> (t)));
   outText (p, (const char *) "struct", 6);
   mcPretty_setNeedSpace (p);
   doFQNameC (p, t);
@@ -12274,24 +12089,23 @@ static void doCompletePartialRecord (mcPretty_pretty p, decl_node t, decl_node r
   h = Indexing_HighIndice (r->recordF.listOfSons);
   while (i <= h)
     {
-      f = static_cast<decl_node> (Indexing_GetIndice (r->recordF.listOfSons, i));
-      if (decl_isRecordField (f))
+      f = static_cast<decl_node__opaque> (Indexing_GetIndice (r->recordF.listOfSons, i));
+      if (decl_isRecordField (static_cast<decl_node> (f)))
         {
           /* avoid dangling else.  */
           if (! f->recordfieldF.tag)
             {
-              mcPretty_setNeedSpace (p);
               doRecordFieldC (p, f);
               outText (p, (const char *) ";\\n", 3);
             }
         }
-      else if (decl_isVarient (f))
+      else if (decl_isVarient (static_cast<decl_node> (f)))
         {
           /* avoid dangling else.  */
           doVarientC (p, f);
           outText (p, (const char *) ";\\n", 3);
         }
-      else if (decl_isVarientField (f))
+      else if (decl_isVarientField (static_cast<decl_node> (f)))
         {
           /* avoid dangling else.  */
           doVarientFieldC (p, f);
@@ -12306,14 +12120,14 @@ static void doCompletePartialRecord (mcPretty_pretty p, decl_node t, decl_node r
    doCompletePartialArray -
 */
 
-static void doCompletePartialArray (mcPretty_pretty p, decl_node t, decl_node r)
+static void doCompletePartialArray (mcPretty_pretty p, decl_node__opaque t, decl_node__opaque r)
 {
-  decl_node type;
-  decl_node s;
+  decl_node__opaque type;
+  decl_node__opaque s;
 
-  mcDebug_assert (decl_isArray (r));
+  mcDebug_assert (decl_isArray (static_cast<decl_node> (r)));
   type = r->arrayF.type;
-  s = NULL;
+  s = static_cast<decl_node__opaque> (NULL);
   outText (p, (const char *) "struct", 6);
   mcPretty_setNeedSpace (p);
   doFQNameC (p, t);
@@ -12333,9 +12147,9 @@ static void doCompletePartialArray (mcPretty_pretty p, decl_node t, decl_node r)
    lookupConst -
 */
 
-static decl_node lookupConst (decl_node type, nameKey_Name n)
+static decl_node__opaque lookupConst (decl_node__opaque type, nameKey_Name n)
 {
-  return decl_makeLiteralInt (n);
+  return static_cast<decl_node__opaque> (decl_makeLiteralInt (n));
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -12345,7 +12159,7 @@ static decl_node lookupConst (decl_node type, nameKey_Name n)
    doMin -
 */
 
-static decl_node doMin (decl_node n)
+static decl_node__opaque doMin (decl_node__opaque n)
 {
   if (n == booleanN)
     {
@@ -12384,7 +12198,7 @@ static decl_node doMin (decl_node n)
   else if (n == bitsetN)
     {
       /* avoid dangling else.  */
-      mcDebug_assert (decl_isSubrange (bitnumN));
+      mcDebug_assert (decl_isSubrange (static_cast<decl_node> (bitnumN)));
       return bitnumN->subrangeF.low;
     }
   else if (n == locN)
@@ -12425,7 +12239,7 @@ static decl_node doMin (decl_node n)
    doMax -
 */
 
-static decl_node doMax (decl_node n)
+static decl_node__opaque doMax (decl_node__opaque n)
 {
   if (n == booleanN)
     {
@@ -12464,7 +12278,7 @@ static decl_node doMax (decl_node n)
   else if (n == bitsetN)
     {
       /* avoid dangling else.  */
-      mcDebug_assert (decl_isSubrange (bitnumN));
+      mcDebug_assert (decl_isSubrange (static_cast<decl_node> (bitnumN)));
       return bitnumN->subrangeF.high;
     }
   else if (n == locN)
@@ -12489,7 +12303,7 @@ static decl_node doMax (decl_node n)
     {
       /* avoid dangling else.  */
       mcMetaError_metaError1 ((const char *) "trying to obtain MAX ({%1ad}) is illegal", 40, (const unsigned char *) &n, (sizeof (n)-1));
-      return NULL;
+      return static_cast<decl_node__opaque> (NULL);
     }
   else
     {
@@ -12506,14 +12320,14 @@ static decl_node doMax (decl_node n)
    getMax -
 */
 
-static decl_node getMax (decl_node n)
+static decl_node__opaque getMax (decl_node__opaque n)
 {
-  n = decl_skipType (n);
-  if (decl_isSubrange (n))
+  n = static_cast<decl_node__opaque> (decl_skipType (static_cast<decl_node> (n)));
+  if (decl_isSubrange (static_cast<decl_node> (n)))
     {
       return n->subrangeF.high;
     }
-  else if (decl_isEnumeration (n))
+  else if (decl_isEnumeration (static_cast<decl_node> (n)))
     {
       /* avoid dangling else.  */
       return n->enumerationF.high;
@@ -12533,14 +12347,14 @@ static decl_node getMax (decl_node n)
    getMin -
 */
 
-static decl_node getMin (decl_node n)
+static decl_node__opaque getMin (decl_node__opaque n)
 {
-  n = decl_skipType (n);
-  if (decl_isSubrange (n))
+  n = static_cast<decl_node__opaque> (decl_skipType (static_cast<decl_node> (n)));
+  if (decl_isSubrange (static_cast<decl_node> (n)))
     {
       return n->subrangeF.low;
     }
-  else if (decl_isEnumeration (n))
+  else if (decl_isEnumeration (static_cast<decl_node> (n)))
     {
       /* avoid dangling else.  */
       return n->enumerationF.low;
@@ -12560,7 +12374,7 @@ static decl_node getMin (decl_node n)
    doSubtractC -
 */
 
-static void doSubtractC (mcPretty_pretty p, decl_node s)
+static void doSubtractC (mcPretty_pretty p, decl_node__opaque s)
 {
   if (! (isZero (s)))
     {
@@ -12574,12 +12388,12 @@ static void doSubtractC (mcPretty_pretty p, decl_node s)
    doSubrC -
 */
 
-static void doSubrC (mcPretty_pretty p, decl_node s)
+static void doSubrC (mcPretty_pretty p, decl_node__opaque s)
 {
-  decl_node low;
-  decl_node high;
+  decl_node__opaque low;
+  decl_node__opaque high;
 
-  s = decl_skipType (s);
+  s = static_cast<decl_node__opaque> (decl_skipType (static_cast<decl_node> (s)));
   if (isOrdinal (s))
     {
       low = getMin (s);
@@ -12588,7 +12402,7 @@ static void doSubrC (mcPretty_pretty p, decl_node s)
       doSubtractC (p, low);
       outText (p, (const char *) "+1", 2);
     }
-  else if (decl_isEnumeration (s))
+  else if (decl_isEnumeration (static_cast<decl_node> (s)))
     {
       /* avoid dangling else.  */
       low = getMin (s);
@@ -12600,10 +12414,10 @@ static void doSubrC (mcPretty_pretty p, decl_node s)
   else
     {
       /* avoid dangling else.  */
-      mcDebug_assert (decl_isSubrange (s));
+      mcDebug_assert (decl_isSubrange (static_cast<decl_node> (s)));
       if ((s->subrangeF.high == NULL) || (s->subrangeF.low == NULL))
         {
-          doSubrC (p, decl_getType (s));
+          doSubrC (p, static_cast<decl_node__opaque> (decl_getType (static_cast<decl_node> (s))));
         }
       else
         {
@@ -12619,18 +12433,32 @@ static void doSubrC (mcPretty_pretty p, decl_node s)
    doCompletePartialProcType -
 */
 
-static void doCompletePartialProcType (mcPretty_pretty p, decl_node t, decl_node n)
+static void doCompletePartialProcType (mcPretty_pretty p, decl_node__opaque t, decl_node__opaque n)
+{
+  if ((isDeclType (t)) && (isDeclType (n)))
+    {
+      outputCompletePartialProcType (p, t, n);
+    }
+}
+
+
+/*
+   outputCompletePartialProcType -
+*/
+
+static void outputCompletePartialProcType (mcPretty_pretty p, decl_node__opaque t, decl_node__opaque n)
 {
   unsigned int i;
   unsigned int h;
-  decl_node v;
-  decl_node u;
+  decl_node__opaque v;
+  decl_node__opaque u;
 
-  mcDebug_assert (decl_isProcType (n));
-  u = NULL;
+  mcDebug_assert (decl_isProcType (static_cast<decl_node> (n)));
+  u = static_cast<decl_node__opaque> (NULL);
   outText (p, (const char *) "typedef", 7);
   mcPretty_setNeedSpace (p);
   doTypeC (p, n->proctypeF.returnType, &u);
+  doOpaqueModifier (p, n);
   mcPretty_setNeedSpace (p);
   outText (p, (const char *) "(*", 2);
   doFQNameC (p, t);
@@ -12639,7 +12467,7 @@ static void doCompletePartialProcType (mcPretty_pretty p, decl_node t, decl_node
   h = Indexing_HighIndice (n->proctypeF.parameters);
   while (i <= h)
     {
-      v = static_cast<decl_node> (Indexing_GetIndice (n->proctypeF.parameters, i));
+      v = static_cast<decl_node__opaque> (Indexing_GetIndice (n->proctypeF.parameters, i));
       doParameterC (p, v);
       mcPretty_noSpace (p);
       if (i < h)
@@ -12679,7 +12507,7 @@ static void doCompletePartialProcType (mcPretty_pretty p, decl_node t, decl_node
    isBase -
 */
 
-static bool isBase (decl_node n)
+static bool isBase (decl_node__opaque n)
 {
   switch (n->kind)
     {
@@ -12733,7 +12561,7 @@ static void doBoolC (mcPretty_pretty p)
    doBaseC -
 */
 
-static void doBaseC (mcPretty_pretty p, decl_node n)
+static void doBaseC (mcPretty_pretty p, decl_node__opaque n)
 {
   switch (n->kind)
     {
@@ -12814,7 +12642,7 @@ static void doBaseC (mcPretty_pretty p, decl_node n)
    isSystem -
 */
 
-static bool isSystem (decl_node n)
+static bool isSystem (decl_node__opaque n)
 {
   switch (n->kind)
     {
@@ -12856,7 +12684,7 @@ static bool isSystem (decl_node n)
    doSystemC -
 */
 
-static void doSystemC (mcPretty_pretty p, decl_node n)
+static void doSystemC (mcPretty_pretty p, decl_node__opaque n)
 {
   switch (n->kind)
     {
@@ -12903,16 +12731,16 @@ static void doSystemC (mcPretty_pretty p, decl_node n)
    doArrayC -
 */
 
-static void doArrayC (mcPretty_pretty p, decl_node n)
+static void doArrayC (mcPretty_pretty p, decl_node__opaque n)
 {
-  decl_node t;
-  decl_node s;
-  decl_node u;
+  decl_node__opaque t;
+  decl_node__opaque s;
+  decl_node__opaque u;
 
-  mcDebug_assert (decl_isArray (n));
+  mcDebug_assert (decl_isArray (static_cast<decl_node> (n)));
   t = n->arrayF.type;
   s = n->arrayF.subr;
-  u = NULL;
+  u = static_cast<decl_node__opaque> (NULL);
   if (s == NULL)
     {
       doTypeC (p, t, &u);
@@ -12949,13 +12777,13 @@ static void doArrayC (mcPretty_pretty p, decl_node n)
    doPointerC -
 */
 
-static void doPointerC (mcPretty_pretty p, decl_node n, decl_node *m)
+static void doPointerC (mcPretty_pretty p, decl_node__opaque n, decl_node__opaque *m)
 {
-  decl_node t;
-  decl_node s;
+  decl_node__opaque t;
+  decl_node__opaque s;
 
   t = n->pointerF.type;
-  s = NULL;
+  s = static_cast<decl_node__opaque> (NULL);
   doTypeC (p, t, &s);
   mcPretty_setNeedSpace (p);
   outText (p, (const char *) "*", 1);
@@ -12966,13 +12794,18 @@ static void doPointerC (mcPretty_pretty p, decl_node n, decl_node *m)
    doRecordFieldC -
 */
 
-static void doRecordFieldC (mcPretty_pretty p, decl_node f)
+static void doRecordFieldC (mcPretty_pretty p, decl_node__opaque f)
 {
-  decl_node m;
+  decl_node__opaque m;
 
-  m = NULL;
+  m = static_cast<decl_node__opaque> (NULL);
   mcPretty_setNeedSpace (p);
   doTypeC (p, f->recordfieldF.type, &m);
+  if ((decl_isType (static_cast<decl_node> (f->recordfieldF.type))) && (isDeclInImp (f->recordfieldF.type)))
+    {
+      outText (p, (const char *) "__opaque", 8);
+    }
+  mcPretty_setNeedSpace (p);
   doDNameC (p, f, false);
 }
 
@@ -12981,13 +12814,13 @@ static void doRecordFieldC (mcPretty_pretty p, decl_node f)
    doVarientFieldC -
 */
 
-static void doVarientFieldC (mcPretty_pretty p, decl_node n)
+static void doVarientFieldC (mcPretty_pretty p, decl_node__opaque n)
 {
   unsigned int i;
   unsigned int t;
-  decl_node q;
+  decl_node__opaque q;
 
-  mcDebug_assert (decl_isVarientField (n));
+  mcDebug_assert (decl_isVarientField (static_cast<decl_node> (n)));
   if (! n->varientfieldF.simple)
     {
       outText (p, (const char *) "struct", 6);
@@ -12998,8 +12831,8 @@ static void doVarientFieldC (mcPretty_pretty p, decl_node n)
   t = Indexing_HighIndice (n->varientfieldF.listOfSons);
   while (i <= t)
     {
-      q = static_cast<decl_node> (Indexing_GetIndice (n->varientfieldF.listOfSons, i));
-      if (decl_isRecordField (q))
+      q = static_cast<decl_node__opaque> (Indexing_GetIndice (n->varientfieldF.listOfSons, i));
+      if (decl_isRecordField (static_cast<decl_node> (q)))
         {
           /* avoid dangling else.  */
           if (! q->recordfieldF.tag)
@@ -13008,7 +12841,7 @@ static void doVarientFieldC (mcPretty_pretty p, decl_node n)
               outText (p, (const char *) ";\\n", 3);
             }
         }
-      else if (decl_isVarient (q))
+      else if (decl_isVarient (static_cast<decl_node> (q)))
         {
           /* avoid dangling else.  */
           doVarientC (p, q);
@@ -13033,22 +12866,22 @@ static void doVarientFieldC (mcPretty_pretty p, decl_node n)
    doVarientC -
 */
 
-static void doVarientC (mcPretty_pretty p, decl_node n)
+static void doVarientC (mcPretty_pretty p, decl_node__opaque n)
 {
   unsigned int i;
   unsigned int t;
-  decl_node q;
+  decl_node__opaque q;
 
-  mcDebug_assert (decl_isVarient (n));
+  mcDebug_assert (decl_isVarient (static_cast<decl_node> (n)));
   if (n->varientF.tag != NULL)
     {
       /* avoid gcc warning by using compound statement even if not strictly necessary.  */
-      if (decl_isRecordField (n->varientF.tag))
+      if (decl_isRecordField (static_cast<decl_node> (n->varientF.tag)))
         {
           doRecordFieldC (p, n->varientF.tag);
           outText (p, (const char *) ";  /* case tag */\\n", 19);
         }
-      else if (decl_isVarientField (n->varientF.tag))
+      else if (decl_isVarientField (static_cast<decl_node> (n->varientF.tag)))
         {
           /* avoid dangling else.  */
           /* doVarientFieldC (p, n^.varientF.tag)  */
@@ -13069,8 +12902,8 @@ static void doVarientC (mcPretty_pretty p, decl_node n)
   t = Indexing_HighIndice (n->varientF.listOfSons);
   while (i <= t)
     {
-      q = static_cast<decl_node> (Indexing_GetIndice (n->varientF.listOfSons, i));
-      if (decl_isRecordField (q))
+      q = static_cast<decl_node__opaque> (Indexing_GetIndice (n->varientF.listOfSons, i));
+      if (decl_isRecordField (static_cast<decl_node> (q)))
         {
           /* avoid dangling else.  */
           if (! q->recordfieldF.tag)
@@ -13079,7 +12912,7 @@ static void doVarientC (mcPretty_pretty p, decl_node n)
               outText (p, (const char *) ";\\n", 3);
             }
         }
-      else if (decl_isVarientField (q))
+      else if (decl_isVarientField (static_cast<decl_node> (q)))
         {
           /* avoid dangling else.  */
           doVarientFieldC (p, q);
@@ -13100,13 +12933,13 @@ static void doVarientC (mcPretty_pretty p, decl_node n)
    doRecordC -
 */
 
-static void doRecordC (mcPretty_pretty p, decl_node n, decl_node *m)
+static void doRecordC (mcPretty_pretty p, decl_node__opaque n, decl_node__opaque *m)
 {
   unsigned int i;
   unsigned int h;
-  decl_node f;
+  decl_node__opaque f;
 
-  mcDebug_assert (decl_isRecord (n));
+  mcDebug_assert (decl_isRecord (static_cast<decl_node> (n)));
   outText (p, (const char *) "struct", 6);
   mcPretty_setNeedSpace (p);
   p = outKc (p, (const char *) "{", 1);
@@ -13116,8 +12949,8 @@ static void doRecordC (mcPretty_pretty p, decl_node n, decl_node *m)
   outText (p, (const char *) "\\n", 2);
   while (i <= h)
     {
-      f = static_cast<decl_node> (Indexing_GetIndice (n->recordF.listOfSons, i));
-      if (decl_isRecordField (f))
+      f = static_cast<decl_node__opaque> (Indexing_GetIndice (n->recordF.listOfSons, i));
+      if (decl_isRecordField (static_cast<decl_node> (f)))
         {
           /* avoid dangling else.  */
           if (! f->recordfieldF.tag)
@@ -13126,13 +12959,13 @@ static void doRecordC (mcPretty_pretty p, decl_node n, decl_node *m)
               outText (p, (const char *) ";\\n", 3);
             }
         }
-      else if (decl_isVarient (f))
+      else if (decl_isVarient (static_cast<decl_node> (f)))
         {
           /* avoid dangling else.  */
           doVarientC (p, f);
           outText (p, (const char *) ";\\n", 3);
         }
-      else if (decl_isVarientField (f))
+      else if (decl_isVarientField (static_cast<decl_node> (f)))
         {
           /* avoid dangling else.  */
           doVarientFieldC (p, f);
@@ -13148,7 +12981,7 @@ static void doRecordC (mcPretty_pretty p, decl_node n, decl_node *m)
    isBitset -
 */
 
-static bool isBitset (decl_node n)
+static bool isBitset (decl_node__opaque n)
 {
   return n == bitsetN;
   /* static analysis guarentees a RETURN statement will be used before here.  */
@@ -13160,7 +12993,7 @@ static bool isBitset (decl_node n)
    isNegative - returns TRUE if expression, n, is negative.
 */
 
-static bool isNegative (decl_node n)
+static bool isNegative (decl_node__opaque n)
 {
   /* --fixme-- needs to be completed.  */
   return false;
@@ -13173,9 +13006,9 @@ static bool isNegative (decl_node n)
    doSubrangeC -
 */
 
-static void doSubrangeC (mcPretty_pretty p, decl_node n)
+static void doSubrangeC (mcPretty_pretty p, decl_node__opaque n)
 {
-  mcDebug_assert (decl_isSubrange (n));
+  mcDebug_assert (decl_isSubrange (static_cast<decl_node> (n)));
   if (isNegative (n->subrangeF.low))
     {
       outText (p, (const char *) "int", 3);
@@ -13194,9 +13027,9 @@ static void doSubrangeC (mcPretty_pretty p, decl_node n)
             Currently we only support sets of size WORD.
 */
 
-static void doSetC (mcPretty_pretty p, decl_node n)
+static void doSetC (mcPretty_pretty p, decl_node__opaque n)
 {
-  mcDebug_assert (decl_isSet (n));
+  mcDebug_assert (decl_isSet (static_cast<decl_node> (n)));
   outText (p, (const char *) "unsigned int", 12);
   mcPretty_setNeedSpace (p);
 }
@@ -13206,7 +13039,7 @@ static void doSetC (mcPretty_pretty p, decl_node n)
    doTypeC -
 */
 
-static void doTypeC (mcPretty_pretty p, decl_node n, decl_node *m)
+static void doTypeC (mcPretty_pretty p, decl_node__opaque n, decl_node__opaque *m)
 {
   if (n == NULL)
     {
@@ -13222,48 +13055,42 @@ static void doTypeC (mcPretty_pretty p, decl_node n, decl_node *m)
       /* avoid dangling else.  */
       doSystemC (p, n);
     }
-  else if (decl_isEnumeration (n))
+  else if (decl_isEnumeration (static_cast<decl_node> (n)))
     {
       /* avoid dangling else.  */
       doEnumerationC (p, n);
     }
-  else if (decl_isType (n))
+  else if (decl_isType (static_cast<decl_node> (n)))
     {
       /* avoid dangling else.  */
       doFQNameC (p, n);
-      /* 
-   ELSIF isProcType (n) OR isArray (n) OR isRecord (n)
-   THEN
-      HALT   n should have been simplified.  
-  */
-      mcPretty_setNeedSpace (p);
     }
-  else if (decl_isProcType (n))
+  else if (decl_isProcType (static_cast<decl_node> (n)))
     {
       /* avoid dangling else.  */
       doProcTypeC (p, n, (*m));
     }
-  else if (decl_isArray (n))
+  else if (decl_isArray (static_cast<decl_node> (n)))
     {
       /* avoid dangling else.  */
       doArrayC (p, n);
     }
-  else if (decl_isRecord (n))
+  else if (decl_isRecord (static_cast<decl_node> (n)))
     {
       /* avoid dangling else.  */
       doRecordC (p, n, m);
     }
-  else if (decl_isPointer (n))
+  else if (decl_isPointer (static_cast<decl_node> (n)))
     {
       /* avoid dangling else.  */
       doPointerC (p, n, m);
     }
-  else if (decl_isSubrange (n))
+  else if (decl_isSubrange (static_cast<decl_node> (n)))
     {
       /* avoid dangling else.  */
       doSubrangeC (p, n);
     }
-  else if (decl_isSet (n))
+  else if (decl_isSet (static_cast<decl_node> (n)))
     {
       /* avoid dangling else.  */
       doSetC (p, n);
@@ -13285,9 +13112,9 @@ static void doTypeC (mcPretty_pretty p, decl_node n, decl_node *m)
    doArrayNameC - it displays the array declaration (it might be an unbounded).
 */
 
-static void doArrayNameC (mcPretty_pretty p, decl_node n)
+static void doArrayNameC (mcPretty_pretty p, decl_node__opaque n)
 {
-  doTypeNameC (p, decl_getType (n));
+  doTypeNameC (p, static_cast<decl_node__opaque> (decl_getType (static_cast<decl_node> (n))));
   mcPretty_setNeedSpace (p);
   outText (p, (const char *) "*", 1);
 }
@@ -13297,7 +13124,7 @@ static void doArrayNameC (mcPretty_pretty p, decl_node n)
    doRecordNameC - emit the C/C++ record name <name of n>"_r".
 */
 
-static void doRecordNameC (mcPretty_pretty p, decl_node n)
+static void doRecordNameC (mcPretty_pretty p, decl_node__opaque n)
 {
   DynamicStrings_String s;
 
@@ -13312,9 +13139,9 @@ static void doRecordNameC (mcPretty_pretty p, decl_node n)
    doPointerNameC - emit the C/C++ pointer type <name of n>*.
 */
 
-static void doPointerNameC (mcPretty_pretty p, decl_node n)
+static void doPointerNameC (mcPretty_pretty p, decl_node__opaque n)
 {
-  doTypeNameC (p, decl_getType (n));
+  doTypeNameC (p, static_cast<decl_node__opaque> (decl_getType (static_cast<decl_node> (n))));
   mcPretty_setNeedSpace (p);
   outText (p, (const char *) "*", 1);
 }
@@ -13324,7 +13151,7 @@ static void doPointerNameC (mcPretty_pretty p, decl_node n)
    doTypeNameC -
 */
 
-static void doTypeNameC (mcPretty_pretty p, decl_node n)
+static void doTypeNameC (mcPretty_pretty p, decl_node__opaque n)
 {
   DynamicStrings_String t;
 
@@ -13343,38 +13170,38 @@ static void doTypeNameC (mcPretty_pretty p, decl_node n)
       /* avoid dangling else.  */
       doSystemC (p, n);
     }
-  else if (decl_isEnumeration (n))
+  else if (decl_isEnumeration (static_cast<decl_node> (n)))
     {
       /* avoid dangling else.  */
       mcPretty_print (p, (const char *) "is enumeration type name required\\n", 35);
     }
-  else if (decl_isType (n))
+  else if (decl_isType (static_cast<decl_node> (n)))
     {
       /* avoid dangling else.  */
       doFQNameC (p, n);
     }
-  else if (decl_isProcType (n))
+  else if (decl_isProcType (static_cast<decl_node> (n)))
     {
       /* avoid dangling else.  */
       doFQNameC (p, n);
       outText (p, (const char *) "_t", 2);
     }
-  else if (decl_isArray (n))
+  else if (decl_isArray (static_cast<decl_node> (n)))
     {
       /* avoid dangling else.  */
       doArrayNameC (p, n);
     }
-  else if (decl_isRecord (n))
+  else if (decl_isRecord (static_cast<decl_node> (n)))
     {
       /* avoid dangling else.  */
       doRecordNameC (p, n);
     }
-  else if (decl_isPointer (n))
+  else if (decl_isPointer (static_cast<decl_node> (n)))
     {
       /* avoid dangling else.  */
       doPointerNameC (p, n);
     }
-  else if (decl_isSubrange (n))
+  else if (decl_isSubrange (static_cast<decl_node> (n)))
     {
       /* avoid dangling else.  */
       doSubrangeC (p, n);
@@ -13383,7 +13210,6 @@ static void doTypeNameC (mcPretty_pretty p, decl_node n)
     {
       /* avoid dangling else.  */
       mcPretty_print (p, (const char *) "is type unknown required\\n", 26);
-      stop ();
     }
 }
 
@@ -13392,51 +13218,91 @@ static void doTypeNameC (mcPretty_pretty p, decl_node n)
    isExternal - returns TRUE if symbol, n, was declared in another module.
 */
 
-static bool isExternal (decl_node n)
+static bool isExternal (decl_node__opaque n)
 {
-  decl_node s;
+  decl_node__opaque s;
 
-  s = decl_getScope (n);
-  return ((s != NULL) && (decl_isDef (s))) && (((decl_isImp (decl_getMainModule ())) && (s != (decl_lookupDef (decl_getSymName (decl_getMainModule ()))))) || (decl_isModule (decl_getMainModule ())));
+  s = static_cast<decl_node__opaque> (decl_getScope (static_cast<decl_node> (n)));
+  return ((s != NULL) && (decl_isDef (static_cast<decl_node> (s)))) && (((decl_isImp (decl_getMainModule ())) && (s != (decl_lookupDef (decl_getSymName (decl_getMainModule ()))))) || (decl_isModule (decl_getMainModule ())));
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
 
 
 /*
-   doVarC -
+   doOpaqueModifier - adds postfix __opaque providing n uses an opaque type which is
+                      not represented by ( void * ).  n is a non type node which might
+                      be using an opaque type.  For example a var or param node.
+*/
+
+static void doOpaqueModifier (mcPretty_pretty p, decl_node__opaque n)
+{
+  mcDebug_assert (! (decl_isType (static_cast<decl_node> (n))));
+  if (((decl_isImp (decl_getCurrentModule ())) && (nodeUsesOpaque (n))) && (! (getNodeOpaqueVoidStar (n))))
+    {
+      outText (doP, (const char *) "__opaque", 8);
+    }
+}
+
+
+/*
+   doDeclareVarC -
 */
 
-static void doVarC (decl_node n)
+static void doDeclareVarC (decl_node__opaque n)
 {
-  decl_node s;
+  decl_node__opaque type;
+  decl_node__opaque s;
+
+  s = static_cast<decl_node__opaque> (NULL);
+  type = static_cast<decl_node__opaque> (decl_getType (static_cast<decl_node> (n)));
+  doTypeC (doP, type, &s);
+  doOpaqueModifier (doP, n);
+  mcPretty_setNeedSpace (doP);
+  doFQDNameC (doP, n, false);
+  mcPretty_print (doP, (const char *) ";\\n", 3);
+}
 
+
+/*
+   doVarC - output a variable declaration.  Note that we do not generate
+            a declaration if we are translating the implementation module
+            and a variable is exported as the variable will be in the .h
+            file to avoid all -Wodr issues.
+*/
+
+static void doVarC (decl_node__opaque n)
+{
   if (decl_isDef (decl_getMainModule ()))
     {
       mcPretty_print (doP, (const char *) "EXTERN", 6);
       mcPretty_setNeedSpace (doP);
+      doDeclareVarC (n);
     }
-  else if ((! (decl_isExported (n))) && (! (isLocal (n))))
+  else if ((! (decl_isExported (static_cast<decl_node> (n)))) && (! (isLocal (n))))
     {
       /* avoid dangling else.  */
       mcPretty_print (doP, (const char *) "static", 6);
       mcPretty_setNeedSpace (doP);
+      doDeclareVarC (n);
     }
   else if (mcOptions_getExtendedOpaque ())
     {
       /* avoid dangling else.  */
+      /* --fixme-- need to revisit extended opaque.  */
       if (isExternal (n))
         {
           /* different module declared this variable, therefore it is extern.  */
           mcPretty_print (doP, (const char *) "extern", 6);
           mcPretty_setNeedSpace (doP);
         }
+      doDeclareVarC (n);
+    }
+  else if (isLocal (n))
+    {
+      /* avoid dangling else.  */
+      doDeclareVarC (n);
     }
-  s = NULL;
-  doTypeC (doP, decl_getType (n), &s);
-  mcPretty_setNeedSpace (doP);
-  doFQDNameC (doP, n, false);
-  mcPretty_print (doP, (const char *) ";\\n", 3);
 }
 
 
@@ -13489,14 +13355,21 @@ static void doProcedureComment (mcPretty_pretty p, DynamicStrings_String s)
    doProcedureHeadingC -
 */
 
-static void doProcedureHeadingC (decl_node n, bool prototype)
+static void doProcedureHeadingC (decl_node__opaque n, bool prototype)
 {
+  DynamicStrings_String s;
   unsigned int i;
   unsigned int h;
-  decl_node p;
-  decl_node q;
+  decl_node__opaque p;
+  decl_node__opaque q;
 
-  mcDebug_assert (decl_isProcedure (n));
+  mcDebug_assert (decl_isProcedure (static_cast<decl_node> (n)));
+  s = getFQstring (n);
+  if (DynamicStrings_EqualArray (s, (const char *) "M2Quads_BuildAssignment", 23))
+    {
+      localstop ();
+    }
+  s = DynamicStrings_KillString (s);
   mcPretty_noSpace (doP);
   if (decl_isDef (decl_getMainModule ()))
     {
@@ -13504,7 +13377,7 @@ static void doProcedureHeadingC (decl_node n, bool prototype)
       outText (doP, (const char *) "EXTERN", 6);
       mcPretty_setNeedSpace (doP);
     }
-  else if (decl_isExported (n))
+  else if (decl_isExported (static_cast<decl_node> (n)))
     {
       /* avoid dangling else.  */
       doProcedureComment (doP, mcComment_getContent (n->procedureF.modComment));
@@ -13517,8 +13390,15 @@ static void doProcedureHeadingC (decl_node n, bool prototype)
       outText (doP, (const char *) "static", 6);
       mcPretty_setNeedSpace (doP);
     }
-  q = NULL;
+  q = static_cast<decl_node__opaque> (NULL);
   doTypeC (doP, n->procedureF.returnType, &q);
+  /* 
+   IF NOT isExported (n)
+   THEN
+      doTypeNameModifier (doP, n^.procedureF.returnType)
+   END ;
+  */
+  doOpaqueModifier (doP, n);
   mcPretty_setNeedSpace (doP);
   doFQDNameC (doP, n, false);
   mcPretty_setNeedSpace (doP);
@@ -13527,7 +13407,7 @@ static void doProcedureHeadingC (decl_node n, bool prototype)
   h = Indexing_HighIndice (n->procedureF.parameters);
   while (i <= h)
     {
-      p = static_cast<decl_node> (Indexing_GetIndice (n->procedureF.parameters, i));
+      p = static_cast<decl_node__opaque> (Indexing_GetIndice (n->procedureF.parameters, i));
       doParameterC (doP, p);
       mcPretty_noSpace (doP);
       if (i < h)
@@ -13554,20 +13434,20 @@ static void doProcedureHeadingC (decl_node n, bool prototype)
    checkDeclareUnboundedParamCopyC -
 */
 
-static bool checkDeclareUnboundedParamCopyC (mcPretty_pretty p, decl_node n)
+static bool checkDeclareUnboundedParamCopyC (mcPretty_pretty p, decl_node__opaque n)
 {
-  decl_node t;
+  decl_node__opaque t;
   unsigned int i;
   unsigned int c;
   wlists_wlist l;
   bool seen;
 
   seen = false;
-  t = decl_getType (n);
+  t = static_cast<decl_node__opaque> (decl_getType (static_cast<decl_node> (n)));
   l = n->paramF.namelist->identlistF.names;
-  if (((decl_isArray (t)) && (decl_isUnbounded (t))) && (l != NULL))
+  if (((decl_isArray (static_cast<decl_node> (t))) && (decl_isUnbounded (static_cast<decl_node> (t)))) && (l != NULL))
     {
-      t = decl_getType (t);
+      t = static_cast<decl_node__opaque> (decl_getType (static_cast<decl_node> (t)));
       c = wlists_noOfItemsInList (l);
       i = 1;
       while (i <= c)
@@ -13592,22 +13472,22 @@ static bool checkDeclareUnboundedParamCopyC (mcPretty_pretty p, decl_node n)
    checkUnboundedParamCopyC -
 */
 
-static void checkUnboundedParamCopyC (mcPretty_pretty p, decl_node n)
+static void checkUnboundedParamCopyC (mcPretty_pretty p, decl_node__opaque n)
 {
-  decl_node t;
-  decl_node s;
+  decl_node__opaque t;
+  decl_node__opaque s;
   unsigned int i;
   unsigned int c;
   wlists_wlist l;
 
-  t = decl_getType (n);
+  t = static_cast<decl_node__opaque> (decl_getType (static_cast<decl_node> (n)));
   l = n->paramF.namelist->identlistF.names;
-  if (((decl_isArray (t)) && (decl_isUnbounded (t))) && (l != NULL))
+  if (((decl_isArray (static_cast<decl_node> (t))) && (decl_isUnbounded (static_cast<decl_node> (t)))) && (l != NULL))
     {
       c = wlists_noOfItemsInList (l);
       i = 1;
-      t = decl_getType (t);
-      s = decl_skipType (t);
+      t = static_cast<decl_node__opaque> (decl_getType (static_cast<decl_node> (t)));
+      s = static_cast<decl_node__opaque> (decl_skipType (static_cast<decl_node> (t)));
       while (i <= c)
         {
           keyc_useMemcpy ();
@@ -13642,21 +13522,21 @@ static void checkUnboundedParamCopyC (mcPretty_pretty p, decl_node n)
    doUnboundedParamCopyC -
 */
 
-static void doUnboundedParamCopyC (mcPretty_pretty p, decl_node n)
+static void doUnboundedParamCopyC (mcPretty_pretty p, decl_node__opaque n)
 {
   unsigned int i;
   unsigned int h;
-  decl_node q;
+  decl_node__opaque q;
   bool seen;
 
-  mcDebug_assert (decl_isProcedure (n));
+  mcDebug_assert (decl_isProcedure (static_cast<decl_node> (n)));
   i = Indexing_LowIndice (n->procedureF.parameters);
   h = Indexing_HighIndice (n->procedureF.parameters);
   seen = false;
   while (i <= h)
     {
-      q = static_cast<decl_node> (Indexing_GetIndice (n->procedureF.parameters, i));
-      if (decl_isParam (q))
+      q = static_cast<decl_node__opaque> (Indexing_GetIndice (n->procedureF.parameters, i));
+      if (decl_isParam (static_cast<decl_node> (q)))
         {
           seen = (checkDeclareUnboundedParamCopyC (p, q)) || seen;
         }
@@ -13669,8 +13549,8 @@ static void doUnboundedParamCopyC (mcPretty_pretty p, decl_node n)
       i = Indexing_LowIndice (n->procedureF.parameters);
       while (i <= h)
         {
-          q = static_cast<decl_node> (Indexing_GetIndice (n->procedureF.parameters, i));
-          if (decl_isParam (q))
+          q = static_cast<decl_node__opaque> (Indexing_GetIndice (n->procedureF.parameters, i));
+          if (decl_isParam (static_cast<decl_node> (q)))
             {
               checkUnboundedParamCopyC (p, q);
             }
@@ -13684,14 +13564,14 @@ static void doUnboundedParamCopyC (mcPretty_pretty p, decl_node n)
    doPrototypeC -
 */
 
-static void doPrototypeC (decl_node n)
+static void doPrototypeC (decl_node__opaque n)
 {
-  if (! (decl_isExported (n)))
+  if (! (decl_isExported (static_cast<decl_node> (n))))
     {
-      keyc_enterScope (n);
+      keyc_enterScope (static_cast<decl_node> (n));
       doProcedureHeadingC (n, true);
       mcPretty_print (doP, (const char *) ";\\n", 3);
-      keyc_leaveScope (n);
+      keyc_leaveScope (static_cast<decl_node> (n));
     }
 }
 
@@ -13700,13 +13580,13 @@ static void doPrototypeC (decl_node n)
    addTodo - adds, n, to the todo list.
 */
 
-static void addTodo (decl_node n)
+static void addTodo (decl_node__opaque n)
 {
   if (((n != NULL) && (! (alists_isItemInList (globalGroup->partialQ, reinterpret_cast<void *> (n))))) && (! (alists_isItemInList (globalGroup->doneQ, reinterpret_cast<void *> (n)))))
     {
-      mcDebug_assert (! (decl_isVarient (n)));
-      mcDebug_assert (! (decl_isVarientField (n)));
-      mcDebug_assert (! (decl_isDef (n)));
+      mcDebug_assert (! (decl_isVarient (static_cast<decl_node> (n))));
+      mcDebug_assert (! (decl_isVarientField (static_cast<decl_node> (n))));
+      mcDebug_assert (! (decl_isDef (static_cast<decl_node> (n))));
       alists_includeItemIntoList (globalGroup->todoQ, reinterpret_cast<void *> (n));
     }
 }
@@ -13716,15 +13596,15 @@ static void addTodo (decl_node n)
    addVariablesTodo -
 */
 
-static void addVariablesTodo (decl_node n)
+static void addVariablesTodo (decl_node__opaque n)
 {
-  if (decl_isVar (n))
+  if (decl_isVar (static_cast<decl_node> (n)))
     {
       /* avoid gcc warning by using compound statement even if not strictly necessary.  */
       if (n->varF.isParameter || n->varF.isVarParameter)
         {
           addDone (n);
-          addTodo (decl_getType (n));
+          addTodo (static_cast<decl_node__opaque> (decl_getType (static_cast<decl_node> (n))));
         }
       else
         {
@@ -13738,9 +13618,9 @@ static void addVariablesTodo (decl_node n)
    addTypesTodo -
 */
 
-static void addTypesTodo (decl_node n)
+static void addTypesTodo (decl_node__opaque n)
 {
-  if (decl_isUnbounded (n))
+  if (decl_isUnbounded (static_cast<decl_node> (n)))
     {
       addDone (n);
     }
@@ -13768,16 +13648,16 @@ static DynamicStrings_String tempName (void)
    makeIntermediateType -
 */
 
-static decl_node makeIntermediateType (DynamicStrings_String s, decl_node p)
+static decl_node__opaque makeIntermediateType (DynamicStrings_String s, decl_node__opaque p)
 {
   nameKey_Name n;
-  decl_node o;
+  decl_node__opaque o;
 
   n = nameKey_makekey (DynamicStrings_string (s));
-  decl_enterScope (decl_getScope (p));
+  decl_enterScope (decl_getScope (static_cast<decl_node> (p)));
   o = p;
-  p = decl_makeType (nameKey_makekey (DynamicStrings_string (s)));
-  decl_putType (p, o);
+  p = static_cast<decl_node__opaque> (decl_makeType (nameKey_makekey (DynamicStrings_string (s))));
+  decl_putType (static_cast<decl_node> (p), static_cast<decl_node> (o));
   putTypeInternal (p);
   decl_leaveScope ();
   return p;
@@ -13790,11 +13670,11 @@ static decl_node makeIntermediateType (DynamicStrings_String s, decl_node p)
    simplifyType -
 */
 
-static void simplifyType (alists_alist l, decl_node *p)
+static void simplifyType (alists_alist l, decl_node__opaque *p)
 {
   DynamicStrings_String s;
 
-  if ((((*p) != NULL) && (((decl_isRecord ((*p))) || (decl_isArray ((*p)))) || (decl_isProcType ((*p))))) && (! (decl_isUnbounded ((*p)))))
+  if ((((*p) != NULL) && (((decl_isRecord (static_cast<decl_node> ((*p)))) || (decl_isArray (static_cast<decl_node> ((*p))))) || (decl_isProcType (static_cast<decl_node> ((*p)))))) && (! (decl_isUnbounded (static_cast<decl_node> ((*p))))))
     {
       s = tempName ();
       (*p) = makeIntermediateType (s, (*p));
@@ -13809,15 +13689,15 @@ static void simplifyType (alists_alist l, decl_node *p)
    simplifyVar -
 */
 
-static void simplifyVar (alists_alist l, decl_node n)
+static void simplifyVar (alists_alist l, decl_node__opaque n)
 {
   unsigned int i;
   unsigned int t;
-  decl_node v;
-  decl_node d;
-  decl_node o;
+  decl_node__opaque v;
+  decl_node__opaque d;
+  decl_node__opaque o;
 
-  mcDebug_assert (decl_isVar (n));
+  mcDebug_assert (decl_isVar (static_cast<decl_node> (n)));
   o = n->varF.type;
   simplifyType (l, &n->varF.type);
   if (o != n->varF.type)
@@ -13830,8 +13710,8 @@ static void simplifyVar (alists_alist l, decl_node n)
       i = 1;
       while (i <= t)
         {
-          v = decl_lookupInScope (n->varF.scope, wlists_getItemFromList (d->vardeclF.names, i));
-          mcDebug_assert (decl_isVar (v));
+          v = static_cast<decl_node__opaque> (decl_lookupInScope (static_cast<decl_node> (n->varF.scope), wlists_getItemFromList (d->vardeclF.names, i)));
+          mcDebug_assert (decl_isVar (static_cast<decl_node> (v)));
           v->varF.type = n->varF.type;
           i += 1;
         }
@@ -13843,17 +13723,17 @@ static void simplifyVar (alists_alist l, decl_node n)
    simplifyRecord -
 */
 
-static void simplifyRecord (alists_alist l, decl_node n)
+static void simplifyRecord (alists_alist l, decl_node__opaque n)
 {
   unsigned int i;
   unsigned int t;
-  decl_node q;
+  decl_node__opaque q;
 
   i = Indexing_LowIndice (n->recordF.listOfSons);
   t = Indexing_HighIndice (n->recordF.listOfSons);
   while (i <= t)
     {
-      q = static_cast<decl_node> (Indexing_GetIndice (n->recordF.listOfSons, i));
+      q = static_cast<decl_node__opaque> (Indexing_GetIndice (n->recordF.listOfSons, i));
       simplifyNode (l, q);
       i += 1;
     }
@@ -13864,18 +13744,18 @@ static void simplifyRecord (alists_alist l, decl_node n)
    simplifyVarient -
 */
 
-static void simplifyVarient (alists_alist l, decl_node n)
+static void simplifyVarient (alists_alist l, decl_node__opaque n)
 {
   unsigned int i;
   unsigned int t;
-  decl_node q;
+  decl_node__opaque q;
 
   simplifyNode (l, n->varientF.tag);
   i = Indexing_LowIndice (n->varientF.listOfSons);
   t = Indexing_HighIndice (n->varientF.listOfSons);
   while (i <= t)
     {
-      q = static_cast<decl_node> (Indexing_GetIndice (n->varientF.listOfSons, i));
+      q = static_cast<decl_node__opaque> (Indexing_GetIndice (n->varientF.listOfSons, i));
       simplifyNode (l, q);
       i += 1;
     }
@@ -13886,17 +13766,17 @@ static void simplifyVarient (alists_alist l, decl_node n)
    simplifyVarientField -
 */
 
-static void simplifyVarientField (alists_alist l, decl_node n)
+static void simplifyVarientField (alists_alist l, decl_node__opaque n)
 {
   unsigned int i;
   unsigned int t;
-  decl_node q;
+  decl_node__opaque q;
 
   i = Indexing_LowIndice (n->varientfieldF.listOfSons);
   t = Indexing_HighIndice (n->varientfieldF.listOfSons);
   while (i <= t)
     {
-      q = static_cast<decl_node> (Indexing_GetIndice (n->varientfieldF.listOfSons, i));
+      q = static_cast<decl_node__opaque> (Indexing_GetIndice (n->varientfieldF.listOfSons, i));
       simplifyNode (l, q);
       i += 1;
     }
@@ -13907,47 +13787,47 @@ static void simplifyVarientField (alists_alist l, decl_node n)
    doSimplifyNode -
 */
 
-static void doSimplifyNode (alists_alist l, decl_node n)
+static void doSimplifyNode (alists_alist l, decl_node__opaque n)
 {
   if (n == NULL)
     {}  /* empty.  */
-  else if (decl_isType (n))
+  else if (decl_isType (static_cast<decl_node> (n)))
     {
       /* avoid dangling else.  */
       /* no need to simplify a type.  */
-      simplifyNode (l, decl_getType (n));
+      simplifyNode (l, static_cast<decl_node__opaque> (decl_getType (static_cast<decl_node> (n))));
     }
-  else if (decl_isVar (n))
+  else if (decl_isVar (static_cast<decl_node> (n)))
     {
       /* avoid dangling else.  */
       simplifyVar (l, n);
     }
-  else if (decl_isRecord (n))
+  else if (decl_isRecord (static_cast<decl_node> (n)))
     {
       /* avoid dangling else.  */
       simplifyRecord (l, n);
     }
-  else if (decl_isRecordField (n))
+  else if (decl_isRecordField (static_cast<decl_node> (n)))
     {
       /* avoid dangling else.  */
       simplifyType (l, &n->recordfieldF.type);
     }
-  else if (decl_isArray (n))
+  else if (decl_isArray (static_cast<decl_node> (n)))
     {
       /* avoid dangling else.  */
       simplifyType (l, &n->arrayF.type);
     }
-  else if (decl_isVarient (n))
+  else if (decl_isVarient (static_cast<decl_node> (n)))
     {
       /* avoid dangling else.  */
       simplifyVarient (l, n);
     }
-  else if (decl_isVarientField (n))
+  else if (decl_isVarientField (static_cast<decl_node> (n)))
     {
       /* avoid dangling else.  */
       simplifyVarientField (l, n);
     }
-  else if (decl_isPointer (n))
+  else if (decl_isPointer (static_cast<decl_node> (n)))
     {
       /* avoid dangling else.  */
       simplifyType (l, &n->pointerF.type);
@@ -13959,7 +13839,7 @@ static void doSimplifyNode (alists_alist l, decl_node n)
    simplifyNode -
 */
 
-static void simplifyNode (alists_alist l, decl_node n)
+static void simplifyNode (alists_alist l, decl_node__opaque n)
 {
   if (! (alists_isItemInList (l, reinterpret_cast<void *> (n))))
     {
@@ -13973,7 +13853,7 @@ static void simplifyNode (alists_alist l, decl_node n)
    doSimplify -
 */
 
-static void doSimplify (decl_node n)
+static void doSimplify (decl_node__opaque n)
 {
   alists_alist l;
 
@@ -14001,7 +13881,7 @@ static void simplifyTypes (decl_scopeT s)
    outDeclsDefC -
 */
 
-static void outDeclsDefC (mcPretty_pretty p, decl_node n)
+static void outDeclsDefC (mcPretty_pretty p, decl_node__opaque n)
 {
   decl_scopeT s;
 
@@ -14053,7 +13933,7 @@ static void includeVar (decl_scopeT s)
    includeExternals -
 */
 
-static void includeExternals (decl_node n)
+static void includeExternals (decl_node__opaque n)
 {
   alists_alist l;
 
@@ -14067,7 +13947,7 @@ static void includeExternals (decl_node n)
    checkSystemInclude -
 */
 
-static void checkSystemInclude (decl_node n)
+static void checkSystemInclude (decl_node__opaque n)
 {
 }
 
@@ -14076,14 +13956,14 @@ static void checkSystemInclude (decl_node n)
    addExported -
 */
 
-static void addExported (decl_node n)
+static void addExported (decl_node__opaque n)
 {
-  decl_node s;
+  decl_node__opaque s;
 
-  s = decl_getScope (n);
-  if (((s != NULL) && (decl_isDef (s))) && (s != defModule))
+  s = static_cast<decl_node__opaque> (decl_getScope (static_cast<decl_node> (n)));
+  if (((s != NULL) && (decl_isDef (static_cast<decl_node> (s)))) && (s != defModule))
     {
-      if (((decl_isType (n)) || (decl_isVar (n))) || (decl_isConst (n)))
+      if (((decl_isType (static_cast<decl_node> (n))) || (decl_isVar (static_cast<decl_node> (n)))) || (decl_isConst (static_cast<decl_node> (n))))
         {
           addTodo (n);
         }
@@ -14096,12 +13976,12 @@ static void addExported (decl_node n)
                  implementation module and is not a hidden type.
 */
 
-static void addExternal (decl_node n)
+static void addExternal (decl_node__opaque n)
 {
-  if (((((decl_getScope (n)) == defModule) && (decl_isType (n))) && (decl_isTypeHidden (n))) && (! (mcOptions_getExtendedOpaque ())))
+  if (((((decl_getScope (static_cast<decl_node> (n))) == defModule) && (decl_isType (static_cast<decl_node> (n)))) && (decl_isTypeHidden (static_cast<decl_node> (n)))) && (! (mcOptions_getExtendedOpaque ())))
     {}  /* empty.  */
   /* do nothing.  */
-  else if (! (decl_isDef (n)))
+  else if (! (decl_isDef (static_cast<decl_node> (n))))
     {
       /* avoid dangling else.  */
       addTodo (n);
@@ -14113,13 +13993,13 @@ static void addExternal (decl_node n)
    includeDefConstType -
 */
 
-static void includeDefConstType (decl_node n)
+static void includeDefConstType (decl_node__opaque n)
 {
-  decl_node d;
+  decl_node__opaque d;
 
-  if (decl_isImp (n))
+  if (decl_isImp (static_cast<decl_node> (n)))
     {
-      defModule = decl_lookupDef (decl_getSymName (n));
+      defModule = static_cast<decl_node__opaque> (decl_lookupDef (decl_getSymName (static_cast<decl_node> (n))));
       if (defModule != NULL)
         {
           simplifyTypes (defModule->defF.decls);
@@ -14134,11 +14014,11 @@ static void includeDefConstType (decl_node n)
    runIncludeDefConstType -
 */
 
-static void runIncludeDefConstType (decl_node n)
+static void runIncludeDefConstType (decl_node__opaque n)
 {
-  decl_node d;
+  decl_node__opaque d;
 
-  if (decl_isDef (n))
+  if (decl_isDef (static_cast<decl_node> (n)))
     {
       simplifyTypes (n->defF.decls);
       includeConstType (n->defF.decls);
@@ -14152,13 +14032,13 @@ static void runIncludeDefConstType (decl_node n)
                     d, into implementation module, i.
 */
 
-static void joinProcedures (decl_node i, decl_node d)
+static void joinProcedures (decl_node__opaque i, decl_node__opaque d)
 {
   unsigned int h;
   unsigned int j;
 
-  mcDebug_assert (decl_isDef (d));
-  mcDebug_assert (decl_isImp (i));
+  mcDebug_assert (decl_isDef (static_cast<decl_node> (d)));
+  mcDebug_assert (decl_isImp (static_cast<decl_node> (i)));
   j = 1;
   h = Indexing_HighIndice (d->defF.decls.procedures);
   while (j <= h)
@@ -14173,14 +14053,14 @@ static void joinProcedures (decl_node i, decl_node d)
    includeDefVarProcedure -
 */
 
-static void includeDefVarProcedure (decl_node n)
+static void includeDefVarProcedure (decl_node__opaque n)
 {
-  decl_node d;
+  decl_node__opaque d;
 
-  if (decl_isImp (n))
+  if (decl_isImp (static_cast<decl_node> (n)))
     {
       /* avoid dangling else.  */
-      defModule = decl_lookupDef (decl_getSymName (n));
+      defModule = static_cast<decl_node__opaque> (decl_lookupDef (decl_getSymName (static_cast<decl_node> (n))));
       if (defModule != NULL)
         {
           /* 
@@ -14190,7 +14070,7 @@ static void includeDefVarProcedure (decl_node n)
           joinProcedures (n, defModule);
         }
     }
-  else if (decl_isDef (n))
+  else if (decl_isDef (static_cast<decl_node> (n)))
     {
       /* avoid dangling else.  */
       includeVar (n->defF.decls);
@@ -14203,7 +14083,7 @@ static void includeDefVarProcedure (decl_node n)
    foreachModuleDo -
 */
 
-static void foreachModuleDo (decl_node n, symbolKey_performOperation p)
+static void foreachModuleDo (decl_node__opaque n, symbolKey_performOperation p)
 {
   decl_foreachDefModuleDo (p);
   decl_foreachModModuleDo (p);
@@ -14230,17 +14110,17 @@ static void outDeclsImpC (mcPretty_pretty p, decl_scopeT s)
    doStatementSequenceC -
 */
 
-static void doStatementSequenceC (mcPretty_pretty p, decl_node s)
+static void doStatementSequenceC (mcPretty_pretty p, decl_node__opaque s)
 {
   unsigned int i;
   unsigned int h;
 
-  mcDebug_assert (decl_isStatementSequence (s));
+  mcDebug_assert (decl_isStatementSequence (static_cast<decl_node> (s)));
   h = Indexing_HighIndice (s->stmtF.statements);
   i = 1;
   while (i <= h)
     {
-      doStatementsC (p, reinterpret_cast<decl_node> (Indexing_GetIndice (s->stmtF.statements, i)));
+      doStatementsC (p, static_cast<decl_node__opaque> (Indexing_GetIndice (s->stmtF.statements, i)));
       i += 1;
     }
 }
@@ -14250,9 +14130,9 @@ static void doStatementSequenceC (mcPretty_pretty p, decl_node s)
    isStatementSequenceEmpty -
 */
 
-static bool isStatementSequenceEmpty (decl_node s)
+static bool isStatementSequenceEmpty (decl_node__opaque s)
 {
-  mcDebug_assert (decl_isStatementSequence (s));
+  mcDebug_assert (decl_isStatementSequence (static_cast<decl_node> (s)));
   return (Indexing_HighIndice (s->stmtF.statements)) == 0;
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
@@ -14264,18 +14144,18 @@ static bool isStatementSequenceEmpty (decl_node s)
                        only one statement.
 */
 
-static bool isSingleStatement (decl_node s)
+static bool isSingleStatement (decl_node__opaque s)
 {
   unsigned int h;
 
-  mcDebug_assert (decl_isStatementSequence (s));
+  mcDebug_assert (decl_isStatementSequence (static_cast<decl_node> (s)));
   h = Indexing_HighIndice (s->stmtF.statements);
   if ((h == 0) || (h > 1))
     {
       return false;
     }
-  s = static_cast<decl_node> (Indexing_GetIndice (s->stmtF.statements, 1));
-  return (! (decl_isStatementSequence (s))) || (isSingleStatement (s));
+  s = static_cast<decl_node__opaque> (Indexing_GetIndice (s->stmtF.statements, 1));
+  return (! (decl_isStatementSequence (static_cast<decl_node> (s)))) || (isSingleStatement (s));
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -14285,7 +14165,7 @@ static bool isSingleStatement (decl_node s)
    doCommentC -
 */
 
-static void doCommentC (mcPretty_pretty p, decl_node s)
+static void doCommentC (mcPretty_pretty p, decl_node__opaque s)
 {
   DynamicStrings_String c;
 
@@ -14316,7 +14196,7 @@ static void doCommentC (mcPretty_pretty p, decl_node s)
    doAfterCommentC - emit an after comment, c, or a newline if, c, is empty.
 */
 
-static void doAfterCommentC (mcPretty_pretty p, decl_node c)
+static void doAfterCommentC (mcPretty_pretty p, decl_node__opaque c)
 {
   if (c == NULL)
     {
@@ -14333,21 +14213,30 @@ static void doAfterCommentC (mcPretty_pretty p, decl_node c)
    doReturnC - issue a return statement and also place in an after comment if one exists.
 */
 
-static void doReturnC (mcPretty_pretty p, decl_node s)
+static void doReturnC (mcPretty_pretty p, decl_node__opaque s)
 {
-  mcDebug_assert (decl_isReturn (s));
+  decl_node__opaque type;
+
+  mcDebug_assert (decl_isReturn (static_cast<decl_node> (s)));
   doCommentC (p, s->returnF.returnComment.body);
   outText (p, (const char *) "return", 6);
-  if (s->returnF.scope != NULL)
+  if ((s->returnF.scope != NULL) && (s->returnF.exp != NULL))
     {
       mcPretty_setNeedSpace (p);
-      if ((! (decl_isProcedure (s->returnF.scope))) || ((decl_getType (s->returnF.scope)) == NULL))
+      if ((! (decl_isProcedure (static_cast<decl_node> (s->returnF.scope)))) || ((decl_getType (static_cast<decl_node> (s->returnF.scope))) == NULL))
         {
           mcMetaError_metaError1 ((const char *) "{%1DMad} has no return type", 27, (const unsigned char *) &s->returnF.scope, (sizeof (s->returnF.scope)-1));
         }
       else
         {
-          doExprCastC (p, s->returnF.exp, decl_getType (s->returnF.scope));
+          if ((decl_isProcedure (static_cast<decl_node> (s->returnF.scope))) && (nodeUsesOpaque (s->returnF.scope)))
+            {
+              forceCastOpaque (p, s->returnF.scope, s->returnF.exp, getNodeOpaqueVoidStar (s->returnF.scope));
+            }
+          else
+            {
+              doExprCastC (p, s->returnF.exp, static_cast<decl_node__opaque> (decl_getType (static_cast<decl_node> (s->returnF.scope))));
+            }
         }
     }
   outText (p, (const char *) ";", 1);
@@ -14359,7 +14248,7 @@ static void doReturnC (mcPretty_pretty p, decl_node s)
    isZtypeEquivalent -
 */
 
-static bool isZtypeEquivalent (decl_node type)
+static bool isZtypeEquivalent (decl_node__opaque type)
 {
   switch (type->kind)
     {
@@ -14387,10 +14276,10 @@ static bool isZtypeEquivalent (decl_node type)
    isEquivalentType - returns TRUE if type1 and type2 are equivalent.
 */
 
-static bool isEquivalentType (decl_node type1, decl_node type2)
+static bool isEquivalentType (decl_node__opaque type1, decl_node__opaque type2)
 {
-  type1 = decl_skipType (type1);
-  type2 = decl_skipType (type2);
+  type1 = static_cast<decl_node__opaque> (decl_skipType (static_cast<decl_node> (type1)));
+  type2 = static_cast<decl_node__opaque> (decl_skipType (static_cast<decl_node> (type2)));
   return (type1 == type2) || ((isZtypeEquivalent (type1)) && (isZtypeEquivalent (type2)));
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
@@ -14401,31 +14290,31 @@ static bool isEquivalentType (decl_node type1, decl_node type2)
    doExprCastC - build a cast if necessary.
 */
 
-static void doExprCastC (mcPretty_pretty p, decl_node e, decl_node type)
+static void doExprCastC (mcPretty_pretty p, decl_node__opaque e, decl_node__opaque type)
 {
-  decl_node stype;
+  decl_node__opaque stype;
 
-  stype = decl_skipType (type);
-  if ((! (isEquivalentType (type, getExprType (e)))) && (! ((e->kind == decl_nil) && ((decl_isPointer (stype)) || (stype->kind == decl_address)))))
+  stype = static_cast<decl_node__opaque> (decl_skipType (static_cast<decl_node> (type)));
+  if ((! (isEquivalentType (type, getExprType (e)))) && (! ((e->kind == decl_nil) && ((decl_isPointer (static_cast<decl_node> (stype))) || (stype->kind == decl_address)))))
     {
       if (lang == decl_ansiCP)
         {
           /* avoid gcc warning by using compound statement even if not strictly necessary.  */
           /* potentially a cast is required.  */
-          if ((decl_isPointer (type)) || (type == addressN))
+          if ((decl_isPointer (static_cast<decl_node> (type))) || (type == addressN))
             {
-              outText (p, (const char *) "reinterpret_cast<", 17);
+              outText (p, (const char *) "static_cast<", 12);
               doTypeNameC (p, type);
               mcPretty_noSpace (p);
               outText (p, (const char *) "> (", 3);
               doExprC (p, e);
               outText (p, (const char *) ")", 1);
-              return ;
+              return;
             }
           else
             {
               outText (p, (const char *) "static_cast<", 12);
-              if (decl_isProcType (decl_skipType (type)))
+              if (decl_isProcType (decl_skipType (static_cast<decl_node> (type))))
                 {
                   doTypeNameC (p, type);
                   outText (p, (const char *) "_t", 2);
@@ -14438,7 +14327,7 @@ static void doExprCastC (mcPretty_pretty p, decl_node e, decl_node type)
               outText (p, (const char *) "> (", 3);
               doExprC (p, e);
               outText (p, (const char *) ")", 1);
-              return ;
+              return;
             }
         }
     }
@@ -14450,28 +14339,130 @@ static void doExprCastC (mcPretty_pretty p, decl_node e, decl_node type)
    requiresUnpackProc - returns TRUE if either the expr is a procedure or the proctypes differ.
 */
 
-static bool requiresUnpackProc (decl_node s)
+static bool requiresUnpackProc (decl_node__opaque s)
 {
   mcDebug_assert (isAssignment (s));
-  return (decl_isProcedure (s->assignmentF.expr)) || ((decl_skipType (decl_getType (s->assignmentF.des))) != (decl_skipType (decl_getType (s->assignmentF.expr))));
+  return (decl_isProcedure (static_cast<decl_node> (s->assignmentF.expr))) || ((decl_skipType (decl_getType (static_cast<decl_node> (s->assignmentF.des)))) != (decl_skipType (decl_getType (static_cast<decl_node> (s->assignmentF.expr)))));
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
 
 
+/*
+   forceCastOpaque -
+*/
+
+static void forceCastOpaque (mcPretty_pretty p, decl_node__opaque des, decl_node__opaque expr, bool toVoidStar)
+{
+  if (nodeUsesOpaque (expr))
+    {
+      flushOpaque (p, expr, getNodeOpaqueVoidStar (des));
+    }
+  else
+    {
+      forceReintCastOpaque (p, des, expr, toVoidStar);
+    }
+}
+
+
+/*
+   forceReintCastOpaque -
+*/
+
+static void forceReintCastOpaque (mcPretty_pretty p, decl_node__opaque des, decl_node__opaque expr, bool toVoidStar)
+{
+  decl_node__opaque type;
+
+  type = static_cast<decl_node__opaque> (decl_getType (static_cast<decl_node> (des)));
+  if (toVoidStar)
+    {
+      /* next is true cast to void * opaque type.  */
+      outText (p, (const char *) "static_cast<", 12);
+      doTypeNameC (p, type);
+      mcPretty_noSpace (p);
+      outText (p, (const char *) "> (", 3);
+      doExprC (p, expr);
+      outText (p, (const char *) ")", 1);
+    }
+  else
+    {
+      /* next is false cast to __opaque opaque type.  */
+      outText (p, (const char *) "static_cast<", 12);
+      doTypeNameC (p, type);
+      outText (p, (const char *) "__opaque", 8);
+      mcPretty_noSpace (p);
+      outText (p, (const char *) "> (", 3);
+      doExprC (p, expr);
+      outText (p, (const char *) ")", 1);
+    }
+}
+
+
+/*
+   doUnConstCastUnbounded - if node n type is an unbounded array then
+                            use const_cast to remove the const parameter
+                            to allow the unbounded array to be modified.
+*/
+
+static void doUnConstCastUnbounded (mcPretty_pretty p, decl_node__opaque n)
+{
+  decl_node__opaque type;
+  decl_node__opaque v;
+
+  if (isArrayRef (n))
+    {
+      if (decl_isVar (static_cast<decl_node> (n->arrayrefF.array)))
+        {
+          v = n->arrayrefF.array;
+          if ((v->varF.isParameter || v->varF.isVarParameter) && (decl_isUnbounded (decl_getType (static_cast<decl_node> (v)))))
+            {
+              type = static_cast<decl_node__opaque> (decl_getType (static_cast<decl_node> (v)));
+              outText (p, (const char *) " /* const_cast<", 15);
+              doTypeNameC (p, type);
+              outText (p, (const char *) "> is needed */ ", 15);
+            }
+        }
+    }
+}
+
+
 /*
    doAssignmentC -
 */
 
-static void doAssignmentC (mcPretty_pretty p, decl_node s)
+static void doAssignmentC (mcPretty_pretty p, decl_node__opaque s)
 {
   mcDebug_assert (isAssignment (s));
   doCommentC (p, s->assignmentF.assignComment.body);
-  doExprCup (p, s->assignmentF.des, requiresUnpackProc (s));
+  if (debugOpaque)
+    {
+      outText (p, (const char *) " /* des: */ ", 12);
+      dumpOpaqueState (s->assignmentF.des);
+      outText (p, (const char *) " /* expr: */ ", 13);
+      dumpOpaqueState (s->assignmentF.expr);
+    }
+  s->assignmentF.des = doExprCup (p, s->assignmentF.des, requiresUnpackProc (s), true);
+  if (debugOpaque)
+    {
+      outText (p, (const char *) "\\n /* after doExprCup des: */ ", 30);
+      dumpOpaqueState (s->assignmentF.des);
+      outText (p, (const char *) "\\n", 2);
+    }
   mcPretty_setNeedSpace (p);
   outText (p, (const char *) "=", 1);
   mcPretty_setNeedSpace (p);
-  doExprCastC (p, s->assignmentF.expr, decl_getType (s->assignmentF.des));
+  if (nodeUsesOpaque (s->assignmentF.des))
+    {
+      forceCastOpaque (p, s->assignmentF.des, s->assignmentF.expr, getNodeOpaqueVoidStar (s->assignmentF.des));
+    }
+  else
+    {
+      if (debugOpaque)
+        {
+          outText (p, (const char *) " /* no opaque des seen */ ", 26);
+        }
+      doExprCastC (p, s->assignmentF.expr, static_cast<decl_node__opaque> (decl_getType (static_cast<decl_node> (s->assignmentF.des))));
+    }
   outText (p, (const char *) ";", 1);
   doAfterCommentC (p, s->assignmentF.assignComment.after);
 }
@@ -14481,9 +14472,9 @@ static void doAssignmentC (mcPretty_pretty p, decl_node s)
    containsStatement -
 */
 
-static bool containsStatement (decl_node s)
+static bool containsStatement (decl_node__opaque s)
 {
-  return ((s != NULL) && (decl_isStatementSequence (s))) && (! (isStatementSequenceEmpty (s)));
+  return ((s != NULL) && (decl_isStatementSequence (static_cast<decl_node> (s)))) && (! (isStatementSequenceEmpty (s)));
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -14493,16 +14484,16 @@ static bool containsStatement (decl_node s)
    doCompoundStmt -
 */
 
-static void doCompoundStmt (mcPretty_pretty p, decl_node s)
+static void doCompoundStmt (mcPretty_pretty p, decl_node__opaque s)
 {
-  if ((s == NULL) || ((decl_isStatementSequence (s)) && (isStatementSequenceEmpty (s))))
+  if ((s == NULL) || ((decl_isStatementSequence (static_cast<decl_node> (s))) && (isStatementSequenceEmpty (s))))
     {
       p = mcPretty_pushPretty (p);
       mcPretty_setindent (p, (mcPretty_getindent (p))+indentationC);
       outText (p, (const char *) "{}  /* empty.  */\\n", 19);
       p = mcPretty_popPretty (p);
     }
-  else if (((decl_isStatementSequence (s)) && (isSingleStatement (s))) && ! forceCompoundStatement)
+  else if (((decl_isStatementSequence (static_cast<decl_node> (s))) && (isSingleStatement (s))) && ! forceCompoundStatement)
     {
       /* avoid dangling else.  */
       p = mcPretty_pushPretty (p);
@@ -14530,9 +14521,9 @@ static void doCompoundStmt (mcPretty_pretty p, decl_node s)
    doElsifC -
 */
 
-static void doElsifC (mcPretty_pretty p, decl_node s)
+static void doElsifC (mcPretty_pretty p, decl_node__opaque s)
 {
-  mcDebug_assert (decl_isElsif (s));
+  mcDebug_assert (decl_isElsif (static_cast<decl_node> (s)));
   outText (p, (const char *) "else if", 7);
   mcPretty_setNeedSpace (p);
   outText (p, (const char *) "(", 1);
@@ -14579,7 +14570,7 @@ static void doElsifC (mcPretty_pretty p, decl_node s)
           doCompoundStmt (p, s->elsifF.else_);
         }
     }
-  else if ((s->elsifF.elsif != NULL) && (decl_isElsif (s->elsifF.elsif)))
+  else if ((s->elsifF.elsif != NULL) && (decl_isElsif (static_cast<decl_node> (s->elsifF.elsif))))
     {
       /* avoid dangling else.  */
       doElsifC (p, s->elsifF.elsif);
@@ -14591,9 +14582,9 @@ static void doElsifC (mcPretty_pretty p, decl_node s)
    noIfElse -
 */
 
-static bool noIfElse (decl_node n)
+static bool noIfElse (decl_node__opaque n)
 {
-  return (((n != NULL) && (decl_isIf (n))) && (n->ifF.else_ == NULL)) && (n->ifF.elsif == NULL);
+  return (((n != NULL) && (decl_isIf (static_cast<decl_node> (n)))) && (n->ifF.else_ == NULL)) && (n->ifF.elsif == NULL);
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -14606,14 +14597,14 @@ static bool noIfElse (decl_node n)
                      in a return value of TRUE.
 */
 
-static bool noIfElseChained (decl_node n)
+static bool noIfElseChained (decl_node__opaque n)
 {
-  decl_node e;
+  decl_node__opaque e;
 
   if (n != NULL)
     {
       /* avoid gcc warning by using compound statement even if not strictly necessary.  */
-      if (decl_isIf (n))
+      if (decl_isIf (static_cast<decl_node> (n)))
         {
           if (n->ifF.else_ != NULL)
             {
@@ -14631,11 +14622,11 @@ static bool noIfElseChained (decl_node n)
               /* avoid dangling else.  */
               /* test elsif for lack of else.  */
               e = n->ifF.elsif;
-              mcDebug_assert (decl_isElsif (e));
+              mcDebug_assert (decl_isElsif (static_cast<decl_node> (e)));
               return noIfElseChained (e);
             }
         }
-      else if (decl_isElsif (n))
+      else if (decl_isElsif (static_cast<decl_node> (n)))
         {
           /* avoid dangling else.  */
           if (n->elsifF.else_ != NULL)
@@ -14654,7 +14645,7 @@ static bool noIfElseChained (decl_node n)
               /* avoid dangling else.  */
               /* test elsif for lack of else.  */
               e = n->elsifF.elsif;
-              mcDebug_assert (decl_isElsif (e));
+              mcDebug_assert (decl_isElsif (static_cast<decl_node> (e)));
               return noIfElseChained (e);
             }
         }
@@ -14669,11 +14660,11 @@ static bool noIfElseChained (decl_node n)
    hasIfElse -
 */
 
-static bool hasIfElse (decl_node n)
+static bool hasIfElse (decl_node__opaque n)
 {
   if (n != NULL)
     {
-      if (decl_isStatementSequence (n))
+      if (decl_isStatementSequence (static_cast<decl_node> (n)))
         {
           /* avoid gcc warning by using compound statement even if not strictly necessary.  */
           if (isStatementSequenceEmpty (n))
@@ -14683,7 +14674,7 @@ static bool hasIfElse (decl_node n)
           else if (isSingleStatement (n))
             {
               /* avoid dangling else.  */
-              n = static_cast<decl_node> (Indexing_GetIndice (n->stmtF.statements, 1));
+              n = static_cast<decl_node__opaque> (Indexing_GetIndice (n->stmtF.statements, 1));
               return isIfElse (n);
             }
         }
@@ -14698,9 +14689,9 @@ static bool hasIfElse (decl_node n)
    isIfElse -
 */
 
-static bool isIfElse (decl_node n)
+static bool isIfElse (decl_node__opaque n)
 {
-  return ((n != NULL) && (decl_isIf (n))) && ((n->ifF.else_ != NULL) || (n->ifF.elsif != NULL));
+  return ((n != NULL) && (decl_isIf (static_cast<decl_node> (n)))) && ((n->ifF.else_ != NULL) || (n->ifF.elsif != NULL));
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -14711,12 +14702,12 @@ static bool isIfElse (decl_node n)
                     which is an IF and it has no else statement.
 */
 
-static bool hasIfAndNoElse (decl_node n)
+static bool hasIfAndNoElse (decl_node__opaque n)
 {
   if (n != NULL)
     {
       /* avoid gcc warning by using compound statement even if not strictly necessary.  */
-      if (decl_isStatementSequence (n))
+      if (decl_isStatementSequence (static_cast<decl_node> (n)))
         {
           if (isStatementSequenceEmpty (n))
             {
@@ -14725,17 +14716,17 @@ static bool hasIfAndNoElse (decl_node n)
           else if (isSingleStatement (n))
             {
               /* avoid dangling else.  */
-              n = static_cast<decl_node> (Indexing_GetIndice (n->stmtF.statements, 1));
+              n = static_cast<decl_node__opaque> (Indexing_GetIndice (n->stmtF.statements, 1));
               return hasIfAndNoElse (n);
             }
           else
             {
               /* avoid dangling else.  */
-              n = static_cast<decl_node> (Indexing_GetIndice (n->stmtF.statements, Indexing_HighIndice (n->stmtF.statements)));
+              n = static_cast<decl_node__opaque> (Indexing_GetIndice (n->stmtF.statements, Indexing_HighIndice (n->stmtF.statements)));
               return hasIfAndNoElse (n);
             }
         }
-      else if ((decl_isElsif (n)) || (decl_isIf (n)))
+      else if ((decl_isElsif (static_cast<decl_node> (n))) || (decl_isIf (static_cast<decl_node> (n))))
         {
           /* avoid dangling else.  */
           return noIfElseChained (n);
@@ -14752,9 +14743,9 @@ static bool hasIfAndNoElse (decl_node n)
            The if statement might contain an else or elsif which are also handled.
 */
 
-static void doIfC (mcPretty_pretty p, decl_node s)
+static void doIfC (mcPretty_pretty p, decl_node__opaque s)
 {
-  mcDebug_assert (decl_isIf (s));
+  mcDebug_assert (decl_isIf (static_cast<decl_node> (s)));
   doCommentC (p, s->ifF.ifComment.body);
   outText (p, (const char *) "if", 2);
   mcPretty_setNeedSpace (p);
@@ -14805,7 +14796,7 @@ static void doIfC (mcPretty_pretty p, decl_node s)
       doAfterCommentC (p, s->ifF.elseComment.after);
       doCompoundStmt (p, s->ifF.else_);
     }
-  else if ((s->ifF.elsif != NULL) && (decl_isElsif (s->ifF.elsif)))
+  else if ((s->ifF.elsif != NULL) && (decl_isElsif (static_cast<decl_node> (s->ifF.elsif))))
     {
       /* avoid dangling else.  */
       doCommentC (p, s->ifF.elseComment.body);
@@ -14821,19 +14812,19 @@ static void doIfC (mcPretty_pretty p, decl_node s)
    doForIncCP -
 */
 
-static void doForIncCP (mcPretty_pretty p, decl_node s)
+static void doForIncCP (mcPretty_pretty p, decl_node__opaque s)
 {
-  decl_node t;
+  decl_node__opaque t;
 
-  mcDebug_assert (decl_isFor (s));
-  t = decl_skipType (decl_getType (s->forF.des));
-  if (decl_isEnumeration (t))
+  mcDebug_assert (decl_isFor (static_cast<decl_node> (s)));
+  t = static_cast<decl_node__opaque> (decl_skipType (decl_getType (static_cast<decl_node> (s->forF.des))));
+  if (decl_isEnumeration (static_cast<decl_node> (t)))
     {
       if (s->forF.increment == NULL)
         {
           doExprC (p, s->forF.des);
           outText (p, (const char *) "= static_cast<", 14);
-          doTypeNameC (p, decl_getType (s->forF.des));
+          doTypeNameC (p, static_cast<decl_node__opaque> (decl_getType (static_cast<decl_node> (s->forF.des))));
           mcPretty_noSpace (p);
           outText (p, (const char *) ">(static_cast<int>(", 19);
           doExprC (p, s->forF.des);
@@ -14843,7 +14834,7 @@ static void doForIncCP (mcPretty_pretty p, decl_node s)
         {
           doExprC (p, s->forF.des);
           outText (p, (const char *) "= static_cast<", 14);
-          doTypeNameC (p, decl_getType (s->forF.des));
+          doTypeNameC (p, static_cast<decl_node__opaque> (decl_getType (static_cast<decl_node> (s->forF.des))));
           mcPretty_noSpace (p);
           outText (p, (const char *) ">(static_cast<int>(", 19);
           doExprC (p, s->forF.des);
@@ -14863,7 +14854,7 @@ static void doForIncCP (mcPretty_pretty p, decl_node s)
    doForIncC -
 */
 
-static void doForIncC (mcPretty_pretty p, decl_node s)
+static void doForIncC (mcPretty_pretty p, decl_node__opaque s)
 {
   if (s->forF.increment == NULL)
     {
@@ -14885,7 +14876,7 @@ static void doForIncC (mcPretty_pretty p, decl_node s)
    doForInc -
 */
 
-static void doForInc (mcPretty_pretty p, decl_node s)
+static void doForInc (mcPretty_pretty p, decl_node__opaque s)
 {
   if (lang == decl_ansiCP)
     {
@@ -14902,9 +14893,9 @@ static void doForInc (mcPretty_pretty p, decl_node s)
    doForC -
 */
 
-static void doForC (mcPretty_pretty p, decl_node s)
+static void doForC (mcPretty_pretty p, decl_node__opaque s)
 {
-  mcDebug_assert (decl_isFor (s));
+  mcDebug_assert (decl_isFor (static_cast<decl_node> (s)));
   outText (p, (const char *) "for (", 5);
   doExprC (p, s->forF.des);
   outText (p, (const char *) "=", 1);
@@ -14926,9 +14917,9 @@ static void doForC (mcPretty_pretty p, decl_node s)
    doRepeatC -
 */
 
-static void doRepeatC (mcPretty_pretty p, decl_node s)
+static void doRepeatC (mcPretty_pretty p, decl_node__opaque s)
 {
-  mcDebug_assert (decl_isRepeat (s));
+  mcDebug_assert (decl_isRepeat (static_cast<decl_node> (s)));
   doCommentC (p, s->repeatF.repeatComment.body);
   outText (p, (const char *) "do {", 4);
   doAfterCommentC (p, s->repeatF.repeatComment.after);
@@ -14948,9 +14939,9 @@ static void doRepeatC (mcPretty_pretty p, decl_node s)
    doWhileC -
 */
 
-static void doWhileC (mcPretty_pretty p, decl_node s)
+static void doWhileC (mcPretty_pretty p, decl_node__opaque s)
 {
-  mcDebug_assert (decl_isWhile (s));
+  mcDebug_assert (decl_isWhile (static_cast<decl_node> (s)));
   doCommentC (p, s->whileF.doComment.body);
   outText (p, (const char *) "while (", 7);
   doExprC (p, s->whileF.expr);
@@ -14966,12 +14957,12 @@ static void doWhileC (mcPretty_pretty p, decl_node s)
    doFuncHighC -
 */
 
-static void doFuncHighC (mcPretty_pretty p, decl_node a)
+static void doFuncHighC (mcPretty_pretty p, decl_node__opaque a)
 {
-  decl_node s;
-  decl_node n;
+  decl_node__opaque s;
+  decl_node__opaque n;
 
-  if ((decl_isLiteral (a)) && ((decl_getType (a)) == charN))
+  if ((decl_isLiteral (static_cast<decl_node> (a))) && ((decl_getType (static_cast<decl_node> (a))) == charN))
     {
       outCard (p, 0);
     }
@@ -14980,22 +14971,22 @@ static void doFuncHighC (mcPretty_pretty p, decl_node a)
       /* avoid dangling else.  */
       outCard (p, a->stringF.length-2);
     }
-  else if ((decl_isConst (a)) && (isString (a->constF.value)))
+  else if ((decl_isConst (static_cast<decl_node> (a))) && (isString (a->constF.value)))
     {
       /* avoid dangling else.  */
       doFuncHighC (p, a->constF.value);
     }
-  else if (decl_isUnbounded (decl_getType (a)))
+  else if (decl_isUnbounded (decl_getType (static_cast<decl_node> (a))))
     {
       /* avoid dangling else.  */
       outText (p, (const char *) "_", 1);
-      outTextN (p, decl_getSymName (a));
+      outTextN (p, decl_getSymName (static_cast<decl_node> (a)));
       outText (p, (const char *) "_high", 5);
     }
-  else if (decl_isArray (decl_skipType (decl_getType (a))))
+  else if (decl_isArray (decl_skipType (decl_getType (static_cast<decl_node> (a)))))
     {
       /* avoid dangling else.  */
-      n = decl_skipType (decl_getType (a));
+      n = static_cast<decl_node__opaque> (decl_skipType (decl_getType (static_cast<decl_node> (a))));
       s = n->arrayF.subr;
       if (isZero (getMin (s)))
         {
@@ -15026,7 +15017,7 @@ static void doFuncHighC (mcPretty_pretty p, decl_node a)
    doMultiplyBySize -
 */
 
-static void doMultiplyBySize (mcPretty_pretty p, decl_node a)
+static void doMultiplyBySize (mcPretty_pretty p, decl_node__opaque a)
 {
   if (((a != charN) && (a != byteN)) && (a != locN))
     {
@@ -15043,21 +15034,21 @@ static void doMultiplyBySize (mcPretty_pretty p, decl_node a)
    doTotype -
 */
 
-static void doTotype (mcPretty_pretty p, decl_node a, decl_node t)
+static void doTotype (mcPretty_pretty p, decl_node__opaque a, decl_node__opaque t)
 {
-  if ((! (isString (a))) && (! (decl_isLiteral (a))))
+  if ((! (isString (a))) && (! (decl_isLiteral (static_cast<decl_node> (a)))))
     {
-      if (decl_isVar (a))
+      if (decl_isVar (static_cast<decl_node> (a)))
         {
-          if (((a->varF.isParameter || a->varF.isVarParameter) && (decl_isUnbounded (decl_getType (a)))) && ((decl_skipType (decl_getType (decl_getType (a)))) == (decl_skipType (decl_getType (t)))))
+          if (((a->varF.isParameter || a->varF.isVarParameter) && (decl_isUnbounded (decl_getType (static_cast<decl_node> (a))))) && ((decl_skipType (decl_getType (decl_getType (static_cast<decl_node> (a))))) == (decl_skipType (decl_getType (static_cast<decl_node> (t))))))
             {
               /* do not multiply by size as the existing high value is correct.  */
-              return ;
+              return;
             }
-          a = decl_getType (a);
-          if (decl_isArray (a))
+          a = static_cast<decl_node__opaque> (decl_getType (static_cast<decl_node> (a)));
+          if (decl_isArray (static_cast<decl_node> (a)))
             {
-              doMultiplyBySize (p, decl_skipType (decl_getType (a)));
+              doMultiplyBySize (p, static_cast<decl_node__opaque> (decl_skipType (decl_getType (static_cast<decl_node> (a)))));
             }
         }
     }
@@ -15076,23 +15067,23 @@ static void doTotype (mcPretty_pretty p, decl_node a, decl_node t)
    doFuncUnbounded -
 */
 
-static void doFuncUnbounded (mcPretty_pretty p, decl_node actual, decl_node formalParam, decl_node formal, decl_node func)
+static void doFuncUnbounded (mcPretty_pretty p, decl_node__opaque actual, decl_node__opaque formalParam, decl_node__opaque formal, decl_node__opaque func)
 {
-  decl_node h;
+  decl_node__opaque h;
   DynamicStrings_String s;
 
-  mcDebug_assert (decl_isUnbounded (formal));
+  mcDebug_assert (decl_isUnbounded (static_cast<decl_node> (formal)));
   outText (p, (const char *) "(", 1);
-  if ((lang == decl_ansiCP) && (decl_isParam (formalParam)))
+  if ((lang == decl_ansiCP) && (decl_isParam (static_cast<decl_node> (formalParam))))
     {
       outText (p, (const char *) "const", 5);
       mcPretty_setNeedSpace (p);
     }
-  doTypeC (p, decl_getType (formal), &formal);
+  doTypeC (p, static_cast<decl_node__opaque> (decl_getType (static_cast<decl_node> (formal))), &formal);
   mcPretty_setNeedSpace (p);
   outText (p, (const char *) "*)", 2);
   mcPretty_setNeedSpace (p);
-  if ((decl_isLiteral (actual)) && ((decl_getType (actual)) == charN))
+  if ((decl_isLiteral (static_cast<decl_node> (actual))) && ((decl_getType (static_cast<decl_node> (actual))) == charN))
     {
       outText (p, (const char *) "\"\\0", 3);
       s = DynamicStrings_InitStringCharStar (nameKey_keyToCharStar (actual->literalF.name));
@@ -15106,7 +15097,7 @@ static void doFuncUnbounded (mcPretty_pretty p, decl_node actual, decl_node form
       /* avoid dangling else.  */
       outCstring (p, actual, true);
     }
-  else if (decl_isConst (actual))
+  else if (decl_isConst (static_cast<decl_node> (actual)))
     {
       /* avoid dangling else.  */
       actual = resolveString (actual);
@@ -15126,7 +15117,7 @@ static void doFuncUnbounded (mcPretty_pretty p, decl_node actual, decl_node form
           doExprC (p, actual);
         }
     }
-  else if (decl_isUnbounded (decl_getType (actual)))
+  else if (decl_isUnbounded (decl_getType (static_cast<decl_node> (actual))))
     {
       /* avoid dangling else.  */
       /* doExprC (p, actual).  */
@@ -15137,12 +15128,12 @@ static void doFuncUnbounded (mcPretty_pretty p, decl_node actual, decl_node form
       /* avoid dangling else.  */
       outText (p, (const char *) "&", 1);
       doExprC (p, actual);
-      if (decl_isArray (decl_skipType (decl_getType (actual))))
+      if (decl_isArray (decl_skipType (decl_getType (static_cast<decl_node> (actual)))))
         {
           outText (p, (const char *) ".array[0]", 9);
         }
     }
-  if (! (enableDefForCStrings && (isDefForC (decl_getScope (func)))))
+  if (! (enableDefForCStrings && (isDefForC (static_cast<decl_node__opaque> (decl_getScope (static_cast<decl_node> (func)))))))
     {
       outText (p, (const char *) ",", 1);
       mcPretty_setNeedSpace (p);
@@ -15156,12 +15147,12 @@ static void doFuncUnbounded (mcPretty_pretty p, decl_node actual, decl_node form
    doProcedureParamC -
 */
 
-static void doProcedureParamC (mcPretty_pretty p, decl_node actual, decl_node formal)
+static void doProcedureParamC (mcPretty_pretty p, decl_node__opaque actual, decl_node__opaque formal)
 {
   if (isForC (formal))
     {
       outText (p, (const char *) "(", 1);
-      doFQNameC (p, decl_getType (formal));
+      doFQNameC (p, static_cast<decl_node__opaque> (decl_getType (static_cast<decl_node> (formal))));
       outText (p, (const char *) "_C", 2);
       outText (p, (const char *) ")", 1);
       mcPretty_setNeedSpace (p);
@@ -15170,12 +15161,12 @@ static void doProcedureParamC (mcPretty_pretty p, decl_node actual, decl_node fo
   else
     {
       outText (p, (const char *) "(", 1);
-      doTypeNameC (p, decl_getType (formal));
+      doTypeNameC (p, static_cast<decl_node__opaque> (decl_getType (static_cast<decl_node> (formal))));
       outText (p, (const char *) ")", 1);
       mcPretty_setNeedSpace (p);
       outText (p, (const char *) "{", 1);
       outText (p, (const char *) "(", 1);
-      doFQNameC (p, decl_getType (formal));
+      doFQNameC (p, static_cast<decl_node__opaque> (decl_getType (static_cast<decl_node> (formal))));
       outText (p, (const char *) "_t)", 3);
       mcPretty_setNeedSpace (p);
       doExprC (p, actual);
@@ -15188,17 +15179,17 @@ static void doProcedureParamC (mcPretty_pretty p, decl_node actual, decl_node fo
    doAdrExprC -
 */
 
-static void doAdrExprC (mcPretty_pretty p, decl_node n)
+static void doAdrExprC (mcPretty_pretty p, decl_node__opaque n)
 {
   if (isDeref (n))
     {
-      /* no point in issuing & ( * n )  */
+      /* No point in issuing & ( * n ).  */
       doExprC (p, n->unaryF.arg);
     }
-  else if ((decl_isVar (n)) && n->varF.isVarParameter)
+  else if ((decl_isVar (static_cast<decl_node> (n))) && n->varF.isVarParameter)
     {
       /* avoid dangling else.  */
-      /* no point in issuing & ( * n )  */
+      /* No point in issuing & ( * n ).  */
       doFQNameC (p, n);
     }
   else
@@ -15214,7 +15205,7 @@ static void doAdrExprC (mcPretty_pretty p, decl_node n)
    typePair -
 */
 
-static bool typePair (decl_node a, decl_node b, decl_node x, decl_node y)
+static bool typePair (decl_node__opaque a, decl_node__opaque b, decl_node__opaque x, decl_node__opaque y)
 {
   return ((a == x) && (b == y)) || ((a == y) && (b == x));
   /* static analysis guarentees a RETURN statement will be used before here.  */
@@ -15227,10 +15218,10 @@ static bool typePair (decl_node a, decl_node b, decl_node x, decl_node y)
                the formal type.
 */
 
-static bool needsCast (decl_node at, decl_node ft)
+static bool needsCast (decl_node__opaque at, decl_node__opaque ft)
 {
-  at = decl_skipType (at);
-  ft = decl_skipType (ft);
+  at = static_cast<decl_node__opaque> (decl_skipType (static_cast<decl_node> (at)));
+  ft = static_cast<decl_node__opaque> (decl_skipType (static_cast<decl_node> (ft)));
   if (((((((((((((at == nilN) || (at->kind == decl_nil)) || (at == ft)) || (typePair (at, ft, cardinalN, wordN))) || (typePair (at, ft, cardinalN, ztypeN))) || (typePair (at, ft, integerN, ztypeN))) || (typePair (at, ft, longcardN, ztypeN))) || (typePair (at, ft, shortcardN, ztypeN))) || (typePair (at, ft, longintN, ztypeN))) || (typePair (at, ft, shortintN, ztypeN))) || (typePair (at, ft, realN, rtypeN))) || (typePair (at, ft, longrealN, rtypeN))) || (typePair (at, ft, shortrealN, rtypeN)))
     {
       return false;
@@ -15251,29 +15242,29 @@ static bool needsCast (decl_node at, decl_node ft)
                      open parenthesis.
 */
 
-static unsigned int checkSystemCast (mcPretty_pretty p, decl_node actual, decl_node formal)
+static unsigned int checkSystemCast (mcPretty_pretty p, decl_node__opaque actual, decl_node__opaque formal)
 {
-  decl_node at;
-  decl_node ft;
+  decl_node__opaque at;
+  decl_node__opaque ft;
 
   at = getExprType (actual);
-  ft = decl_getType (formal);
+  ft = static_cast<decl_node__opaque> (decl_getType (static_cast<decl_node> (formal)));
   if (needsCast (at, ft))
     {
       /* avoid gcc warning by using compound statement even if not strictly necessary.  */
       if (lang == decl_ansiCP)
         {
-          if ((isString (actual)) && ((decl_skipType (ft)) == addressN))
+          if ((isString (actual)) && ((decl_skipType (static_cast<decl_node> (ft))) == addressN))
             {
-              outText (p, (const char *) "const_cast<void*> (reinterpret_cast<const void*> (", 50);
+              outText (p, (const char *) "const_cast<void*> (static_cast<const void*> (", 45);
               return 2;
             }
-          else if ((decl_isPointer (decl_skipType (ft))) || ((decl_skipType (ft)) == addressN))
+          else if ((decl_isPointer (decl_skipType (static_cast<decl_node> (ft)))) || ((decl_skipType (static_cast<decl_node> (ft))) == addressN))
             {
               /* avoid dangling else.  */
               if (actual == nilN)
                 {
-                  if (decl_isVarParam (formal))
+                  if (decl_isVarParam (static_cast<decl_node> (formal)))
                     {
                       mcMetaError_metaError1 ((const char *) "NIL is being passed to a VAR parameter {%1DMad}", 47, (const unsigned char *) &formal, (sizeof (formal)-1));
                     }
@@ -15284,7 +15275,7 @@ static unsigned int checkSystemCast (mcPretty_pretty p, decl_node actual, decl_n
                 {
                   outText (p, (const char *) "reinterpret_cast<", 17);
                   doTypeNameC (p, ft);
-                  if (decl_isVarParam (formal))
+                  if (decl_isVarParam (static_cast<decl_node> (formal)))
                     {
                       outText (p, (const char *) "*", 1);
                     }
@@ -15297,7 +15288,7 @@ static unsigned int checkSystemCast (mcPretty_pretty p, decl_node actual, decl_n
               /* avoid dangling else.  */
               outText (p, (const char *) "static_cast<", 12);
               doTypeNameC (p, ft);
-              if (decl_isVarParam (formal))
+              if (decl_isVarParam (static_cast<decl_node> (formal)))
                 {
                   outText (p, (const char *) "*", 1);
                 }
@@ -15310,7 +15301,7 @@ static unsigned int checkSystemCast (mcPretty_pretty p, decl_node actual, decl_n
         {
           outText (p, (const char *) "(", 1);
           doTypeNameC (p, ft);
-          if (decl_isVarParam (formal))
+          if (decl_isVarParam (static_cast<decl_node> (formal)))
             {
               outText (p, (const char *) "*", 1);
             }
@@ -15349,48 +15340,87 @@ static void emitN (mcPretty_pretty p, const char *a_, unsigned int _a_high, unsi
             which was declared inside a definition module for "C".
 */
 
-static bool isForC (decl_node n)
+static bool isForC (decl_node__opaque n)
 {
-  if (decl_isVarParam (n))
+  if (decl_isVarParam (static_cast<decl_node> (n)))
     {
       return n->varparamF.isForC;
     }
-  else if (decl_isParam (n))
+  else if (decl_isParam (static_cast<decl_node> (n)))
     {
       /* avoid dangling else.  */
       return n->paramF.isForC;
     }
-  else if (decl_isProcedure (n))
+  else if (decl_isProcedure (static_cast<decl_node> (n)))
     {
       /* avoid dangling else.  */
       return n->procedureF.isForC;
     }
-  return false;
+  return false;
+  /* static analysis guarentees a RETURN statement will be used before here.  */
+  __builtin_unreachable ();
+}
+
+
+/*
+   isDefForCNode - return TRUE if node n was declared inside a definition module for "C".
+*/
+
+static bool isDefForCNode (decl_node__opaque n)
+{
+  nameKey_Name name;
+
+  while ((n != NULL) && (! (((decl_isImp (static_cast<decl_node> (n))) || (decl_isDef (static_cast<decl_node> (n)))) || (decl_isModule (static_cast<decl_node> (n))))))
+    {
+      n = static_cast<decl_node__opaque> (decl_getScope (static_cast<decl_node> (n)));
+    }
+  if ((n != NULL) && (decl_isImp (static_cast<decl_node> (n))))
+    {
+      name = decl_getSymName (static_cast<decl_node> (n));
+      n = static_cast<decl_node__opaque> (decl_lookupDef (name));
+    }
+  return ((n != NULL) && (decl_isDef (static_cast<decl_node> (n)))) && (isDefForC (n));
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
 
 
 /*
-   isDefForCNode - return TRUE if node n was declared inside a definition module for "C".
+   doFuncVarParam - detect whether the formal uses an opaque and ensure that the address of
+                    the actual parameter is cast to the formal type.
 */
 
-static bool isDefForCNode (decl_node n)
+static void doFuncVarParam (mcPretty_pretty p, decl_node__opaque actual, decl_node__opaque formal)
 {
-  nameKey_Name name;
+  decl_node__opaque type;
 
-  while ((n != NULL) && (! (((decl_isImp (n)) || (decl_isDef (n))) || (decl_isModule (n)))))
+  if ((nodeUsesOpaque (formal)) && (getNodeOpaqueFlushNecessary (actual, getNodeOpaqueVoidStar (formal))))
     {
-      n = decl_getScope (n);
+      type = static_cast<decl_node__opaque> (decl_getType (static_cast<decl_node> (formal)));
+      outText (p, (const char *) "reinterpret_cast<", 17);
+      if (getNodeOpaqueVoidStar (formal))
+        {
+          doTypeNameC (p, type);
+          mcPretty_setNeedSpace (p);
+          outText (p, (const char *) "*> (&", 5);
+          doExprC (p, actual);
+          outText (p, (const char *) ")", 1);
+          actual = makeOpaqueCast (actual, true);
+        }
+      else
+        {
+          doTypeNameC (p, type);
+          mcPretty_noSpace (p);
+          outText (p, (const char *) "__opaque *> (&", 14);
+          doExprC (p, actual);
+          outText (p, (const char *) ")", 1);
+          actual = makeOpaqueCast (actual, false);
+        }
     }
-  if ((n != NULL) && (decl_isImp (n)))
+  else
     {
-      name = decl_getSymName (n);
-      n = decl_lookupDef (name);
+      doAdrExprC (p, actual);
     }
-  return ((n != NULL) && (decl_isDef (n))) && (isDefForC (n));
-  /* static analysis guarentees a RETURN statement will be used before here.  */
-  __builtin_unreachable ();
 }
 
 
@@ -15398,10 +15428,10 @@ static bool isDefForCNode (decl_node n)
    doFuncParamC -
 */
 
-static void doFuncParamC (mcPretty_pretty p, decl_node actual, decl_node formal, decl_node func)
+static void doFuncParamC (mcPretty_pretty p, decl_node__opaque actual, decl_node__opaque formal, decl_node__opaque func)
 {
-  decl_node ft;
-  decl_node at;
+  decl_node__opaque ft;
+  decl_node__opaque at;
   unsigned int lbr;
 
   if (formal == NULL)
@@ -15410,16 +15440,16 @@ static void doFuncParamC (mcPretty_pretty p, decl_node actual, decl_node formal,
     }
   else
     {
-      ft = decl_skipType (decl_getType (formal));
-      if (decl_isUnbounded (ft))
+      ft = static_cast<decl_node__opaque> (decl_skipType (decl_getType (static_cast<decl_node> (formal))));
+      if (decl_isUnbounded (static_cast<decl_node> (ft)))
         {
           doFuncUnbounded (p, actual, formal, ft, func);
         }
       else
         {
-          if ((isAProcType (ft)) && (decl_isProcedure (actual)))
+          if ((isAProcType (ft)) && (decl_isProcedure (static_cast<decl_node> (actual))))
             {
-              if (decl_isVarParam (formal))
+              if (decl_isVarParam (static_cast<decl_node> (formal)))
                 {
                   mcMetaError_metaError1 ((const char *) "{%1MDad} cannot be passed as a VAR parameter", 44, (const unsigned char *) &actual, (sizeof (actual)-1));
                 }
@@ -15428,17 +15458,17 @@ static void doFuncParamC (mcPretty_pretty p, decl_node actual, decl_node formal,
                   doProcedureParamC (p, actual, formal);
                 }
             }
-          else if (((((decl_getType (actual)) != NULL) && (decl_isProcType (decl_skipType (decl_getType (actual))))) && (isAProcType (ft))) && (isForC (formal)))
+          else if (((((decl_getType (static_cast<decl_node> (actual))) != NULL) && (decl_isProcType (decl_skipType (decl_getType (static_cast<decl_node> (actual)))))) && (isAProcType (ft))) && (isForC (formal)))
             {
               /* avoid dangling else.  */
-              if (decl_isVarParam (formal))
+              if (decl_isVarParam (static_cast<decl_node> (formal)))
                 {
                   mcMetaError_metaError2 ((const char *) "{%1MDad} cannot be passed as a VAR parameter to the definition for C module as the parameter requires a cast to the formal type {%2MDtad}", 137, (const unsigned char *) &actual, (sizeof (actual)-1), (const unsigned char *) &formal, (sizeof (formal)-1));
                 }
               else
                 {
                   outText (p, (const char *) "(", 1);
-                  doFQNameC (p, decl_getType (formal));
+                  doFQNameC (p, static_cast<decl_node__opaque> (decl_getType (static_cast<decl_node> (formal))));
                   outText (p, (const char *) "_C", 2);
                   outText (p, (const char *) ")", 1);
                   mcPretty_setNeedSpace (p);
@@ -15446,31 +15476,40 @@ static void doFuncParamC (mcPretty_pretty p, decl_node actual, decl_node formal,
                   outText (p, (const char *) ".proc", 5);
                 }
             }
-          else if ((((decl_getType (actual)) != NULL) && (decl_isProcType (decl_skipType (decl_getType (actual))))) && ((decl_getType (actual)) != (decl_getType (formal))))
+          else if ((((decl_getType (static_cast<decl_node> (actual))) != NULL) && (decl_isProcType (decl_skipType (decl_getType (static_cast<decl_node> (actual)))))) && ((decl_getType (static_cast<decl_node> (actual))) != (decl_getType (static_cast<decl_node> (formal)))))
             {
               /* avoid dangling else.  */
-              if (decl_isVarParam (formal))
+              if (decl_isVarParam (static_cast<decl_node> (formal)))
                 {
                   mcMetaError_metaError2 ((const char *) "{%1MDad} cannot be passed as a VAR parameter as the parameter requires a cast to the formal type {%2MDtad}", 106, (const unsigned char *) &actual, (sizeof (actual)-1), (const unsigned char *) &formal, (sizeof (formal)-1));
                 }
               else
                 {
-                  doCastC (p, decl_getType (formal), actual);
+                  doCastC (p, static_cast<decl_node__opaque> (decl_getType (static_cast<decl_node> (formal))), actual);
                 }
             }
           else
             {
               /* avoid dangling else.  */
-              lbr = checkSystemCast (p, actual, formal);
-              if (decl_isVarParam (formal))
+              if (decl_isVarParam (static_cast<decl_node> (formal)))
                 {
-                  doAdrExprC (p, actual);
+                  lbr = checkSystemCast (p, actual, formal);
+                  doFuncVarParam (p, actual, formal);
+                  emitN (p, (const char *) ")", 1, lbr);
                 }
               else
                 {
-                  doExprC (p, actual);
+                  if (nodeUsesOpaque (formal))
+                    {
+                      forceCastOpaque (p, formal, actual, getNodeOpaqueVoidStar (formal));
+                    }
+                  else
+                    {
+                      lbr = checkSystemCast (p, actual, formal);
+                      doExprC (p, actual);
+                      emitN (p, (const char *) ")", 1, lbr);
+                    }
                 }
-              emitN (p, (const char *) ")", 1, lbr);
             }
         }
     }
@@ -15482,16 +15521,16 @@ static void doFuncParamC (mcPretty_pretty p, decl_node actual, decl_node formal,
                      If the parameter is a vararg NIL is returned.
 */
 
-static decl_node getNthParamType (Indexing_Index l, unsigned int i)
+static decl_node__opaque getNthParamType (Indexing_Index l, unsigned int i)
 {
-  decl_node p;
+  decl_node__opaque p;
 
   p = getNthParam (l, i);
   if (p != NULL)
     {
-      return decl_getType (p);
+      return static_cast<decl_node__opaque> (decl_getType (static_cast<decl_node> (p)));
     }
-  return NULL;
+  return static_cast<decl_node__opaque> (NULL);
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -15502,9 +15541,9 @@ static decl_node getNthParamType (Indexing_Index l, unsigned int i)
                  If the parameter is a vararg NIL is returned.
 */
 
-static decl_node getNthParam (Indexing_Index l, unsigned int i)
+static decl_node__opaque getNthParam (Indexing_Index l, unsigned int i)
 {
-  decl_node p;
+  decl_node__opaque p;
   unsigned int j;
   unsigned int k;
   unsigned int h;
@@ -15515,12 +15554,12 @@ static decl_node getNthParam (Indexing_Index l, unsigned int i)
       h = Indexing_HighIndice (l);
       while (j <= h)
         {
-          p = static_cast<decl_node> (Indexing_GetIndice (l, j));
-          if (decl_isParam (p))
+          p = static_cast<decl_node__opaque> (Indexing_GetIndice (l, j));
+          if (decl_isParam (static_cast<decl_node> (p)))
             {
               k = identListLen (p->paramF.namelist);
             }
-          else if (decl_isVarParam (p))
+          else if (decl_isVarParam (static_cast<decl_node> (p)))
             {
               /* avoid dangling else.  */
               k = identListLen (p->varparamF.namelist);
@@ -15528,8 +15567,8 @@ static decl_node getNthParam (Indexing_Index l, unsigned int i)
           else
             {
               /* avoid dangling else.  */
-              mcDebug_assert (decl_isVarargs (p));
-              return NULL;
+              mcDebug_assert (decl_isVarargs (static_cast<decl_node> (p)));
+              return static_cast<decl_node__opaque> (NULL);
             }
           if (i <= k)
             {
@@ -15542,7 +15581,7 @@ static decl_node getNthParam (Indexing_Index l, unsigned int i)
             }
         }
     }
-  return NULL;
+  return static_cast<decl_node__opaque> (NULL);
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -15552,10 +15591,10 @@ static decl_node getNthParam (Indexing_Index l, unsigned int i)
    doFuncArgsC -
 */
 
-static void doFuncArgsC (mcPretty_pretty p, decl_node s, Indexing_Index l, bool needParen)
+static void doFuncArgsC (mcPretty_pretty p, decl_node__opaque s, Indexing_Index l, bool needParen)
 {
-  decl_node actual;
-  decl_node formal;
+  decl_node__opaque actual;
+  decl_node__opaque formal;
   unsigned int i;
   unsigned int n;
 
@@ -15592,10 +15631,10 @@ static void doFuncArgsC (mcPretty_pretty p, decl_node s, Indexing_Index l, bool
    doProcTypeArgsC -
 */
 
-static void doProcTypeArgsC (mcPretty_pretty p, decl_node s, Indexing_Index args, bool needParen)
+static void doProcTypeArgsC (mcPretty_pretty p, decl_node__opaque s, Indexing_Index args, bool needParen)
 {
-  decl_node a;
-  decl_node b;
+  decl_node__opaque a;
+  decl_node__opaque b;
   unsigned int i;
   unsigned int n;
 
@@ -15610,7 +15649,7 @@ static void doProcTypeArgsC (mcPretty_pretty p, decl_node s, Indexing_Index args
       while (i <= n)
         {
           a = getExpList (s->funccallF.args, i);
-          b = static_cast<decl_node> (Indexing_GetIndice (args, i));
+          b = static_cast<decl_node__opaque> (Indexing_GetIndice (args, i));
           doFuncParamC (p, a, b, s->funccallF.function);
           if (i < n)
             {
@@ -15632,41 +15671,39 @@ static void doProcTypeArgsC (mcPretty_pretty p, decl_node s, Indexing_Index args
    doAdrArgC -
 */
 
-static void doAdrArgC (mcPretty_pretty p, decl_node n)
+static void doAdrArgC (mcPretty_pretty p, decl_node__opaque n)
 {
   if (isDeref (n))
     {
       /* & and * cancel each other out.  */
       doExprC (p, n->unaryF.arg);
     }
-  else if ((decl_isVar (n)) && n->varF.isVarParameter)
+  else if ((decl_isVar (static_cast<decl_node> (n))) && n->varF.isVarParameter)
     {
       /* avoid dangling else.  */
-      outTextN (p, decl_getSymName (n));  /* --fixme-- does the caller need to cast it?  */
+      outTextN (p, decl_getSymName (static_cast<decl_node> (n)));  /* --fixme-- does the caller need to cast it?  */
     }
-  else
+  else if ((isString (n)) || ((decl_isArray (decl_getType (static_cast<decl_node> (n)))) && (decl_isUnbounded (decl_getType (static_cast<decl_node> (n))))))
     {
       /* avoid dangling else.  */
-      if (isString (n))
+      if (lang == decl_ansiCP)
         {
-          if (lang == decl_ansiCP)
-            {
-              outText (p, (const char *) "const_cast<void*> (reinterpret_cast<const void*>", 48);
-              outText (p, (const char *) "(", 1);
-              doExprC (p, n);
-              outText (p, (const char *) "))", 2);
-            }
-          else
-            {
-              doExprC (p, n);
-            }
+          outText (p, (const char *) "const_cast<void*> (static_cast<const void*>", 43);
+          outText (p, (const char *) "(", 1);
+          doExprC (p, n);
+          outText (p, (const char *) "))", 2);
         }
       else
         {
-          outText (p, (const char *) "&", 1);
           doExprC (p, n);
         }
     }
+  else
+    {
+      /* avoid dangling else.  */
+      outText (p, (const char *) "&", 1);
+      doExprC (p, n);
+    }
 }
 
 
@@ -15674,7 +15711,7 @@ static void doAdrArgC (mcPretty_pretty p, decl_node n)
    doAdrC -
 */
 
-static void doAdrC (mcPretty_pretty p, decl_node n)
+static void doAdrC (mcPretty_pretty p, decl_node__opaque n)
 {
   mcDebug_assert (isUnary (n));
   doAdrArgC (p, n->unaryF.arg);
@@ -15685,7 +15722,7 @@ static void doAdrC (mcPretty_pretty p, decl_node n)
    doInc -
 */
 
-static void doInc (mcPretty_pretty p, decl_node n)
+static void doInc (mcPretty_pretty p, decl_node__opaque n)
 {
   mcDebug_assert (isIntrinsic (n));
   if (lang == decl_ansiCP)
@@ -15703,7 +15740,7 @@ static void doInc (mcPretty_pretty p, decl_node n)
    doDec -
 */
 
-static void doDec (mcPretty_pretty p, decl_node n)
+static void doDec (mcPretty_pretty p, decl_node__opaque n)
 {
   mcDebug_assert (isIntrinsic (n));
   if (lang == decl_ansiCP)
@@ -15721,7 +15758,7 @@ static void doDec (mcPretty_pretty p, decl_node n)
    doIncDecC -
 */
 
-static void doIncDecC (mcPretty_pretty p, decl_node n, const char *op_, unsigned int _op_high)
+static void doIncDecC (mcPretty_pretty p, decl_node__opaque n, const char *op_, unsigned int _op_high)
 {
   char op[_op_high+1];
 
@@ -15751,10 +15788,10 @@ static void doIncDecC (mcPretty_pretty p, decl_node n, const char *op_, unsigned
    doIncDecCP -
 */
 
-static void doIncDecCP (mcPretty_pretty p, decl_node n, const char *op_, unsigned int _op_high)
+static void doIncDecCP (mcPretty_pretty p, decl_node__opaque n, const char *op_, unsigned int _op_high)
 {
-  decl_node lhs;
-  decl_node type;
+  decl_node__opaque lhs;
+  decl_node__opaque type;
   char op[_op_high+1];
 
   /* make a local copy of each unbounded array.  */
@@ -15766,8 +15803,8 @@ static void doIncDecCP (mcPretty_pretty p, decl_node n, const char *op_, unsigne
       lhs = getExpList (n->intrinsicF.args, 1);
       doExprC (p, lhs);
       mcPretty_setNeedSpace (p);
-      type = decl_getType (lhs);
-      if ((decl_isPointer (type)) || (type == addressN))
+      type = static_cast<decl_node__opaque> (decl_getType (static_cast<decl_node> (lhs)));
+      if ((decl_isPointer (static_cast<decl_node> (type))) || (type == addressN))
         {
           /* cast to (char * ) and then back again after the arithmetic is complete.  */
           outText (p, (const char *) "=", 1);
@@ -15790,7 +15827,7 @@ static void doIncDecCP (mcPretty_pretty p, decl_node n, const char *op_, unsigne
             }
           outText (p, (const char *) ")", 1);
         }
-      else if (decl_isEnumeration (decl_skipType (type)))
+      else if (decl_isEnumeration (decl_skipType (static_cast<decl_node> (type))))
         {
           /* avoid dangling else.  */
           outText (p, (const char *) "= static_cast<", 14);
@@ -15833,9 +15870,9 @@ static void doIncDecCP (mcPretty_pretty p, decl_node n, const char *op_, unsigne
    doInclC -
 */
 
-static void doInclC (mcPretty_pretty p, decl_node n)
+static void doInclC (mcPretty_pretty p, decl_node__opaque n)
 {
-  decl_node lo;
+  decl_node__opaque lo;
 
   mcDebug_assert (isIntrinsic (n));
   if (n->intrinsicF.args != NULL)
@@ -15871,9 +15908,9 @@ static void doInclC (mcPretty_pretty p, decl_node n)
    doExclC -
 */
 
-static void doExclC (mcPretty_pretty p, decl_node n)
+static void doExclC (mcPretty_pretty p, decl_node__opaque n)
 {
-  decl_node lo;
+  decl_node__opaque lo;
 
   mcDebug_assert (isIntrinsic (n));
   if (n->intrinsicF.args != NULL)
@@ -15909,9 +15946,9 @@ static void doExclC (mcPretty_pretty p, decl_node n)
    doNewC -
 */
 
-static void doNewC (mcPretty_pretty p, decl_node n)
+static void doNewC (mcPretty_pretty p, decl_node__opaque n)
 {
-  decl_node t;
+  decl_node__opaque t;
 
   mcDebug_assert (isIntrinsic (n));
   if (n->intrinsicF.args == NULL)
@@ -15932,10 +15969,10 @@ static void doNewC (mcPretty_pretty p, decl_node n)
           doExprC (p, getExpList (n->intrinsicF.args, 1));
           outText (p, (const char *) ",", 1);
           mcPretty_setNeedSpace (p);
-          t = decl_skipType (decl_getType (getExpList (n->intrinsicF.args, 1)));
-          if (decl_isPointer (t))
+          t = static_cast<decl_node__opaque> (decl_skipType (decl_getType (static_cast<decl_node> (getExpList (n->intrinsicF.args, 1)))));
+          if (decl_isPointer (static_cast<decl_node> (t)))
             {
-              t = decl_getType (t);
+              t = static_cast<decl_node__opaque> (decl_getType (static_cast<decl_node> (t)));
               outText (p, (const char *) "sizeof", 6);
               mcPretty_setNeedSpace (p);
               outText (p, (const char *) "(", 1);
@@ -15956,9 +15993,9 @@ static void doNewC (mcPretty_pretty p, decl_node n)
    doDisposeC -
 */
 
-static void doDisposeC (mcPretty_pretty p, decl_node n)
+static void doDisposeC (mcPretty_pretty p, decl_node__opaque n)
 {
-  decl_node t;
+  decl_node__opaque t;
 
   mcDebug_assert (isIntrinsic (n));
   if (n->intrinsicF.args == NULL)
@@ -15979,10 +16016,10 @@ static void doDisposeC (mcPretty_pretty p, decl_node n)
           doExprC (p, getExpList (n->intrinsicF.args, 1));
           outText (p, (const char *) ",", 1);
           mcPretty_setNeedSpace (p);
-          t = decl_skipType (decl_getType (getExpList (n->intrinsicF.args, 1)));
-          if (decl_isPointer (t))
+          t = static_cast<decl_node__opaque> (decl_skipType (decl_getType (static_cast<decl_node> (getExpList (n->intrinsicF.args, 1)))));
+          if (decl_isPointer (static_cast<decl_node> (t)))
             {
-              t = decl_getType (t);
+              t = static_cast<decl_node__opaque> (decl_getType (static_cast<decl_node> (t)));
               outText (p, (const char *) "sizeof", 6);
               mcPretty_setNeedSpace (p);
               outText (p, (const char *) "(", 1);
@@ -16008,7 +16045,7 @@ static void doDisposeC (mcPretty_pretty p, decl_node n)
    doCapC -
 */
 
-static void doCapC (mcPretty_pretty p, decl_node n)
+static void doCapC (mcPretty_pretty p, decl_node__opaque n)
 {
   mcDebug_assert (isUnary (n));
   if (n->unaryF.arg == NULL)
@@ -16039,7 +16076,7 @@ static void doCapC (mcPretty_pretty p, decl_node n)
    doLengthC -
 */
 
-static void doLengthC (mcPretty_pretty p, decl_node n)
+static void doLengthC (mcPretty_pretty p, decl_node__opaque n)
 {
   mcDebug_assert (isUnary (n));
   if (n->unaryF.arg == NULL)
@@ -16066,9 +16103,9 @@ static void doLengthC (mcPretty_pretty p, decl_node n)
    doAbsC -
 */
 
-static void doAbsC (mcPretty_pretty p, decl_node n)
+static void doAbsC (mcPretty_pretty p, decl_node__opaque n)
 {
-  decl_node t;
+  decl_node__opaque t;
 
   mcDebug_assert (isUnary (n));
   if (n->unaryF.arg == NULL)
@@ -16125,7 +16162,7 @@ static void doAbsC (mcPretty_pretty p, decl_node n)
    doValC -
 */
 
-static void doValC (mcPretty_pretty p, decl_node n)
+static void doValC (mcPretty_pretty p, decl_node__opaque n)
 {
   mcDebug_assert (isBinary (n));
   outText (p, (const char *) "(", 1);
@@ -16142,9 +16179,9 @@ static void doValC (mcPretty_pretty p, decl_node n)
    doMinC -
 */
 
-static void doMinC (mcPretty_pretty p, decl_node n)
+static void doMinC (mcPretty_pretty p, decl_node__opaque n)
 {
-  decl_node t;
+  decl_node__opaque t;
 
   mcDebug_assert (isUnary (n));
   t = getExprType (n->unaryF.arg);
@@ -16156,9 +16193,9 @@ static void doMinC (mcPretty_pretty p, decl_node n)
    doMaxC -
 */
 
-static void doMaxC (mcPretty_pretty p, decl_node n)
+static void doMaxC (mcPretty_pretty p, decl_node__opaque n)
 {
-  decl_node t;
+  decl_node__opaque t;
 
   mcDebug_assert (isUnary (n));
   t = getExprType (n->unaryF.arg);
@@ -16171,7 +16208,7 @@ static void doMaxC (mcPretty_pretty p, decl_node n)
                  The intrinsic functions are represented as unary and binary nodes.
 */
 
-static bool isIntrinsic (decl_node n)
+static bool isIntrinsic (decl_node__opaque n)
 {
   switch (n->kind)
     {
@@ -16201,7 +16238,7 @@ static bool isIntrinsic (decl_node n)
    doHalt -
 */
 
-static void doHalt (mcPretty_pretty p, decl_node n)
+static void doHalt (mcPretty_pretty p, decl_node__opaque n)
 {
   mcDebug_assert (n->kind == decl_halt);
   if ((n->intrinsicF.args == NULL) || ((expListLen (n->intrinsicF.args)) == 0))
@@ -16226,7 +16263,7 @@ static void doHalt (mcPretty_pretty p, decl_node n)
    doCreal - emit the appropriate creal function.
 */
 
-static void doCreal (mcPretty_pretty p, decl_node t)
+static void doCreal (mcPretty_pretty p, decl_node__opaque t)
 {
   switch (t->kind)
     {
@@ -16257,7 +16294,7 @@ static void doCreal (mcPretty_pretty p, decl_node t)
    doCimag - emit the appropriate cimag function.
 */
 
-static void doCimag (mcPretty_pretty p, decl_node t)
+static void doCimag (mcPretty_pretty p, decl_node__opaque t)
 {
   switch (t->kind)
     {
@@ -16288,9 +16325,9 @@ static void doCimag (mcPretty_pretty p, decl_node t)
    doReC -
 */
 
-static void doReC (mcPretty_pretty p, decl_node n)
+static void doReC (mcPretty_pretty p, decl_node__opaque n)
 {
-  decl_node t;
+  decl_node__opaque t;
 
   mcDebug_assert (n->kind == decl_re);
   if (n->unaryF.arg != NULL)
@@ -16314,9 +16351,9 @@ static void doReC (mcPretty_pretty p, decl_node n)
    doImC -
 */
 
-static void doImC (mcPretty_pretty p, decl_node n)
+static void doImC (mcPretty_pretty p, decl_node__opaque n)
 {
-  decl_node t;
+  decl_node__opaque t;
 
   mcDebug_assert (n->kind == decl_im);
   if (n->unaryF.arg != NULL)
@@ -16340,7 +16377,7 @@ static void doImC (mcPretty_pretty p, decl_node n)
    doCmplx -
 */
 
-static void doCmplx (mcPretty_pretty p, decl_node n)
+static void doCmplx (mcPretty_pretty p, decl_node__opaque n)
 {
   mcDebug_assert (isBinary (n));
   keyc_useComplex ();
@@ -16365,7 +16402,7 @@ static void doCmplx (mcPretty_pretty p, decl_node n)
    doIntrinsicC -
 */
 
-static void doIntrinsicC (mcPretty_pretty p, decl_node n)
+static void doIntrinsicC (mcPretty_pretty p, decl_node__opaque n)
 {
   mcDebug_assert (isIntrinsic (n));
   doCommentC (p, n->intrinsicF.intrinsicComment.body);
@@ -16421,7 +16458,7 @@ static void doIntrinsicC (mcPretty_pretty p, decl_node n)
    isIntrinsicFunction - returns true if, n, is an instrinsic function.
 */
 
-static bool isIntrinsicFunction (decl_node n)
+static bool isIntrinsicFunction (decl_node__opaque n)
 {
   switch (n->kind)
     {
@@ -16459,7 +16496,7 @@ static bool isIntrinsicFunction (decl_node n)
    doSizeC -
 */
 
-static void doSizeC (mcPretty_pretty p, decl_node n)
+static void doSizeC (mcPretty_pretty p, decl_node__opaque n)
 {
   mcDebug_assert (isUnary (n));
   outText (p, (const char *) "sizeof (", 8);
@@ -16472,7 +16509,7 @@ static void doSizeC (mcPretty_pretty p, decl_node n)
    doConvertC -
 */
 
-static void doConvertC (mcPretty_pretty p, decl_node n, const char *conversion_, unsigned int _conversion_high)
+static void doConvertC (mcPretty_pretty p, decl_node__opaque n, const char *conversion_, unsigned int _conversion_high)
 {
   DynamicStrings_String s;
   char conversion[_conversion_high+1];
@@ -16490,7 +16527,7 @@ static void doConvertC (mcPretty_pretty p, decl_node n, const char *conversion_,
    doConvertSC -
 */
 
-static void doConvertSC (mcPretty_pretty p, decl_node n, DynamicStrings_String conversion)
+static void doConvertSC (mcPretty_pretty p, decl_node__opaque n, DynamicStrings_String conversion)
 {
   mcDebug_assert (isUnary (n));
   mcPretty_setNeedSpace (p);
@@ -16504,16 +16541,40 @@ static void doConvertSC (mcPretty_pretty p, decl_node n, DynamicStrings_String c
 }
 
 
+/*
+   getFunction - return the function associate with funccall node n.
+*/
+
+static decl_node__opaque getFunction (decl_node__opaque n)
+{
+  mcDebug_assert (isFuncCall (n));
+  switch (n->kind)
+    {
+      case decl_funccall:
+        return n->funccallF.function;
+        break;
+
+
+      default:
+        M2RTS_HALT (-1);
+        __builtin_unreachable ();
+        break;
+    }
+  ReturnException ("../../gcc/m2/mc/decl.def", 20, 1);
+  __builtin_unreachable ();
+}
+
+
 /*
    getFuncFromExpr -
 */
 
-static decl_node getFuncFromExpr (decl_node n)
+static decl_node__opaque getFuncFromExpr (decl_node__opaque n)
 {
-  n = decl_skipType (decl_getType (n));
-  while ((n != procN) && (! (decl_isProcType (n))))
+  n = static_cast<decl_node__opaque> (decl_skipType (decl_getType (static_cast<decl_node> (n))));
+  while ((n != procN) && (! (decl_isProcType (static_cast<decl_node> (n)))))
     {
-      n = decl_skipType (decl_getType (n));
+      n = static_cast<decl_node__opaque> (decl_skipType (decl_getType (static_cast<decl_node> (n))));
     }
   return n;
   /* static analysis guarentees a RETURN statement will be used before here.  */
@@ -16525,12 +16586,12 @@ static decl_node getFuncFromExpr (decl_node n)
    doFuncExprC -
 */
 
-static void doFuncExprC (mcPretty_pretty p, decl_node n)
+static void doFuncExprC (mcPretty_pretty p, decl_node__opaque n)
 {
-  decl_node t;
+  decl_node__opaque t;
 
   mcDebug_assert (isFuncCall (n));
-  if (decl_isProcedure (n->funccallF.function))
+  if (decl_isProcedure (static_cast<decl_node> (n->funccallF.function)))
     {
       doFQDNameC (p, n->funccallF.function, true);
       mcPretty_setNeedSpace (p);
@@ -16546,11 +16607,11 @@ static void doFuncExprC (mcPretty_pretty p, decl_node n)
       mcPretty_setNeedSpace (p);
       if (t == procN)
         {
-          doProcTypeArgsC (p, n, NULL, true);
+          doProcTypeArgsC (p, n, static_cast<Indexing_Index> (NULL), true);
         }
       else
         {
-          mcDebug_assert (decl_isProcType (t));
+          mcDebug_assert (decl_isProcType (static_cast<decl_node> (t)));
           doProcTypeArgsC (p, n, t->proctypeF.parameters, true);
         }
     }
@@ -16561,7 +16622,7 @@ static void doFuncExprC (mcPretty_pretty p, decl_node n)
    doFuncCallC -
 */
 
-static void doFuncCallC (mcPretty_pretty p, decl_node n)
+static void doFuncCallC (mcPretty_pretty p, decl_node__opaque n)
 {
   doCommentC (p, n->funccallF.funccallComment.body);
   doFuncExprC (p, n);
@@ -16574,7 +16635,7 @@ static void doFuncCallC (mcPretty_pretty p, decl_node n)
    doCaseStatementC -
 */
 
-static void doCaseStatementC (mcPretty_pretty p, decl_node n, bool needBreak)
+static void doCaseStatementC (mcPretty_pretty p, decl_node__opaque n, bool needBreak)
 {
   p = mcPretty_pushPretty (p);
   mcPretty_setindent (p, (mcPretty_getindent (p))+indentationC);
@@ -16591,7 +16652,7 @@ static void doCaseStatementC (mcPretty_pretty p, decl_node n, bool needBreak)
    doExceptionC -
 */
 
-static void doExceptionC (mcPretty_pretty p, const char *a_, unsigned int _a_high, decl_node n)
+static void doExceptionC (mcPretty_pretty p, const char *a_, unsigned int _a_high, decl_node__opaque n)
 {
   unsigned int w;
   char a[_a_high+1];
@@ -16599,7 +16660,7 @@ static void doExceptionC (mcPretty_pretty p, const char *a_, unsigned int _a_hig
   /* make a local copy of each unbounded array.  */
   memcpy (a, a_, _a_high+1);
 
-  w = decl_getDeclaredMod (n);
+  w = decl_getDeclaredMod (static_cast<decl_node> (n));
   outText (p, (const char *) a, _a_high);
   mcPretty_setNeedSpace (p);
   outText (p, (const char *) "(\"", 2);
@@ -16619,7 +16680,7 @@ static void doExceptionC (mcPretty_pretty p, const char *a_, unsigned int _a_hig
    doExceptionCP -
 */
 
-static void doExceptionCP (mcPretty_pretty p, const char *a_, unsigned int _a_high, decl_node n)
+static void doExceptionCP (mcPretty_pretty p, const char *a_, unsigned int _a_high, decl_node__opaque n)
 {
   unsigned int w;
   char a[_a_high+1];
@@ -16627,7 +16688,7 @@ static void doExceptionCP (mcPretty_pretty p, const char *a_, unsigned int _a_hi
   /* make a local copy of each unbounded array.  */
   memcpy (a, a_, _a_high+1);
 
-  w = decl_getDeclaredMod (n);
+  w = decl_getDeclaredMod (static_cast<decl_node> (n));
   outText (p, (const char *) a, _a_high);
   mcPretty_setNeedSpace (p);
   outText (p, (const char *) "(\"", 2);
@@ -16647,7 +16708,7 @@ static void doExceptionCP (mcPretty_pretty p, const char *a_, unsigned int _a_hi
    doException -
 */
 
-static void doException (mcPretty_pretty p, const char *a_, unsigned int _a_high, decl_node n)
+static void doException (mcPretty_pretty p, const char *a_, unsigned int _a_high, decl_node__opaque n)
 {
   char a[_a_high+1];
 
@@ -16670,18 +16731,18 @@ static void doException (mcPretty_pretty p, const char *a_, unsigned int _a_high
    doRangeListC -
 */
 
-static void doRangeListC (mcPretty_pretty p, decl_node c)
+static void doRangeListC (mcPretty_pretty p, decl_node__opaque c)
 {
-  decl_node r;
+  decl_node__opaque r;
   unsigned int i;
   unsigned int h;
 
-  mcDebug_assert (decl_isCaseList (c));
+  mcDebug_assert (decl_isCaseList (static_cast<decl_node> (c)));
   i = 1;
   h = Indexing_HighIndice (c->caselistF.rangePairs);
   while (i <= h)
     {
-      r = static_cast<decl_node> (Indexing_GetIndice (c->caselistF.rangePairs, i));
+      r = static_cast<decl_node__opaque> (Indexing_GetIndice (c->caselistF.rangePairs, i));
       mcDebug_assert ((r->rangeF.hi == NULL) || (r->rangeF.lo == r->rangeF.hi));
       outText (p, (const char *) "case", 4);
       mcPretty_setNeedSpace (p);
@@ -16696,18 +16757,18 @@ static void doRangeListC (mcPretty_pretty p, decl_node c)
    doRangeIfListC -
 */
 
-static void doRangeIfListC (mcPretty_pretty p, decl_node e, decl_node c)
+static void doRangeIfListC (mcPretty_pretty p, decl_node__opaque e, decl_node__opaque c)
 {
-  decl_node r;
+  decl_node__opaque r;
   unsigned int i;
   unsigned int h;
 
-  mcDebug_assert (decl_isCaseList (c));
+  mcDebug_assert (decl_isCaseList (static_cast<decl_node> (c)));
   i = 1;
   h = Indexing_HighIndice (c->caselistF.rangePairs);
   while (i <= h)
     {
-      r = static_cast<decl_node> (Indexing_GetIndice (c->caselistF.rangePairs, i));
+      r = static_cast<decl_node__opaque> (Indexing_GetIndice (c->caselistF.rangePairs, i));
       if ((r->rangeF.lo != r->rangeF.hi) && (r->rangeF.hi != NULL))
         {
           outText (p, (const char *) "((", 2);
@@ -16756,9 +16817,9 @@ static void doRangeIfListC (mcPretty_pretty p, decl_node e, decl_node c)
    doCaseLabels -
 */
 
-static void doCaseLabels (mcPretty_pretty p, decl_node n, bool needBreak)
+static void doCaseLabels (mcPretty_pretty p, decl_node__opaque n, bool needBreak)
 {
-  mcDebug_assert (decl_isCaseLabelList (n));
+  mcDebug_assert (decl_isCaseLabelList (static_cast<decl_node> (n)));
   doRangeListC (p, n->caselabellistF.caseList);
   p = mcPretty_pushPretty (p);
   mcPretty_setindent (p, (mcPretty_getindent (p))+indentationC);
@@ -16775,18 +16836,18 @@ static void doCaseLabels (mcPretty_pretty p, decl_node n, bool needBreak)
    doCaseLabelListC -
 */
 
-static void doCaseLabelListC (mcPretty_pretty p, decl_node n, bool haveElse)
+static void doCaseLabelListC (mcPretty_pretty p, decl_node__opaque n, bool haveElse)
 {
   unsigned int i;
   unsigned int h;
-  decl_node c;
+  decl_node__opaque c;
 
-  mcDebug_assert (decl_isCase (n));
+  mcDebug_assert (decl_isCase (static_cast<decl_node> (n)));
   i = 1;
   h = Indexing_HighIndice (n->caseF.caseLabelList);
   while (i <= h)
     {
-      c = static_cast<decl_node> (Indexing_GetIndice (n->caseF.caseLabelList, i));
+      c = static_cast<decl_node__opaque> (Indexing_GetIndice (n->caseF.caseLabelList, i));
       doCaseLabels (p, c, ((i < h) || haveElse) || caseException);
       i += 1;
     }
@@ -16797,9 +16858,9 @@ static void doCaseLabelListC (mcPretty_pretty p, decl_node n, bool haveElse)
    doCaseIfLabels -
 */
 
-static void doCaseIfLabels (mcPretty_pretty p, decl_node e, decl_node n, unsigned int i, unsigned int h)
+static void doCaseIfLabels (mcPretty_pretty p, decl_node__opaque e, decl_node__opaque n, unsigned int i, unsigned int h)
 {
-  mcDebug_assert (decl_isCaseLabelList (n));
+  mcDebug_assert (decl_isCaseLabelList (static_cast<decl_node> (n)));
   if (i > 1)
     {
       outText (p, (const char *) "else", 4);
@@ -16827,18 +16888,18 @@ static void doCaseIfLabels (mcPretty_pretty p, decl_node e, decl_node n, unsigne
    doCaseIfLabelListC -
 */
 
-static void doCaseIfLabelListC (mcPretty_pretty p, decl_node n)
+static void doCaseIfLabelListC (mcPretty_pretty p, decl_node__opaque n)
 {
   unsigned int i;
   unsigned int h;
-  decl_node c;
+  decl_node__opaque c;
 
-  mcDebug_assert (decl_isCase (n));
+  mcDebug_assert (decl_isCase (static_cast<decl_node> (n)));
   i = 1;
   h = Indexing_HighIndice (n->caseF.caseLabelList);
   while (i <= h)
     {
-      c = static_cast<decl_node> (Indexing_GetIndice (n->caseF.caseLabelList, i));
+      c = static_cast<decl_node__opaque> (Indexing_GetIndice (n->caseF.caseLabelList, i));
       doCaseIfLabels (p, n->caseF.expression, c, i, h);
       i += 1;
     }
@@ -16849,9 +16910,9 @@ static void doCaseIfLabelListC (mcPretty_pretty p, decl_node n)
    doCaseElseC -
 */
 
-static void doCaseElseC (mcPretty_pretty p, decl_node n)
+static void doCaseElseC (mcPretty_pretty p, decl_node__opaque n)
 {
-  mcDebug_assert (decl_isCase (n));
+  mcDebug_assert (decl_isCase (static_cast<decl_node> (n)));
   if (n->caseF.else_ == NULL)
     {
       /* avoid dangling else.  */
@@ -16876,9 +16937,9 @@ static void doCaseElseC (mcPretty_pretty p, decl_node n)
    doCaseIfElseC -
 */
 
-static void doCaseIfElseC (mcPretty_pretty p, decl_node n)
+static void doCaseIfElseC (mcPretty_pretty p, decl_node__opaque n)
 {
-  mcDebug_assert (decl_isCase (n));
+  mcDebug_assert (decl_isCase (static_cast<decl_node> (n)));
   if (n->caseF.else_ == NULL)
     {
       /* avoid dangling else.  */
@@ -16908,20 +16969,20 @@ static void doCaseIfElseC (mcPretty_pretty p, decl_node n)
                             single values and not ranges.
 */
 
-static bool canUseSwitchCaseLabels (decl_node n)
+static bool canUseSwitchCaseLabels (decl_node__opaque n)
 {
   unsigned int i;
   unsigned int h;
-  decl_node r;
-  decl_node l;
+  decl_node__opaque r;
+  decl_node__opaque l;
 
-  mcDebug_assert (decl_isCaseLabelList (n));
+  mcDebug_assert (decl_isCaseLabelList (static_cast<decl_node> (n)));
   l = n->caselabellistF.caseList;
   i = 1;
   h = Indexing_HighIndice (l->caselistF.rangePairs);
   while (i <= h)
     {
-      r = static_cast<decl_node> (Indexing_GetIndice (l->caselistF.rangePairs, i));
+      r = static_cast<decl_node__opaque> (Indexing_GetIndice (l->caselistF.rangePairs, i));
       if ((r->rangeF.hi != NULL) && (r->rangeF.lo != r->rangeF.hi))
         {
           return false;
@@ -16940,18 +17001,18 @@ static bool canUseSwitchCaseLabels (decl_node n)
                   selectors are single values rather than ranges.
 */
 
-static bool canUseSwitch (decl_node n)
+static bool canUseSwitch (decl_node__opaque n)
 {
   unsigned int i;
   unsigned int h;
-  decl_node c;
+  decl_node__opaque c;
 
-  mcDebug_assert (decl_isCase (n));
+  mcDebug_assert (decl_isCase (static_cast<decl_node> (n)));
   i = 1;
   h = Indexing_HighIndice (n->caseF.caseLabelList);
   while (i <= h)
     {
-      c = static_cast<decl_node> (Indexing_GetIndice (n->caseF.caseLabelList, i));
+      c = static_cast<decl_node__opaque> (Indexing_GetIndice (n->caseF.caseLabelList, i));
       if (! (canUseSwitchCaseLabels (c)))
         {
           return false;
@@ -16968,11 +17029,11 @@ static bool canUseSwitch (decl_node n)
    doCaseC -
 */
 
-static void doCaseC (mcPretty_pretty p, decl_node n)
+static void doCaseC (mcPretty_pretty p, decl_node__opaque n)
 {
   unsigned int i;
 
-  mcDebug_assert (decl_isCase (n));
+  mcDebug_assert (decl_isCase (static_cast<decl_node> (n)));
   if (canUseSwitch (n))
     {
       i = mcPretty_getindent (p);
@@ -17004,9 +17065,9 @@ static void doCaseC (mcPretty_pretty p, decl_node n)
    doLoopC -
 */
 
-static void doLoopC (mcPretty_pretty p, decl_node s)
+static void doLoopC (mcPretty_pretty p, decl_node__opaque s)
 {
-  mcDebug_assert (decl_isLoop (s));
+  mcDebug_assert (decl_isLoop (static_cast<decl_node> (s)));
   outText (p, (const char *) "for (;;)\\n", 10);
   outText (p, (const char *) "{\\n", 3);
   p = mcPretty_pushPretty (p);
@@ -17021,9 +17082,9 @@ static void doLoopC (mcPretty_pretty p, decl_node s)
    doExitC -
 */
 
-static void doExitC (mcPretty_pretty p, decl_node s)
+static void doExitC (mcPretty_pretty p, decl_node__opaque s)
 {
-  mcDebug_assert (decl_isExit (s));
+  mcDebug_assert (decl_isExit (static_cast<decl_node> (s)));
   outText (p, (const char *) "/* exit.  */\\n", 14);
 }
 
@@ -17032,11 +17093,11 @@ static void doExitC (mcPretty_pretty p, decl_node s)
    doStatementsC -
 */
 
-static void doStatementsC (mcPretty_pretty p, decl_node s)
+static void doStatementsC (mcPretty_pretty p, decl_node__opaque s)
 {
   if (s == NULL)
     {}  /* empty.  */
-  else if (decl_isStatementSequence (s))
+  else if (decl_isStatementSequence (static_cast<decl_node> (s)))
     {
       /* avoid dangling else.  */
       doStatementSequenceC (p, s);
@@ -17046,12 +17107,12 @@ static void doStatementsC (mcPretty_pretty p, decl_node s)
       /* avoid dangling else.  */
       doCommentC (p, s);
     }
-  else if (decl_isExit (s))
+  else if (decl_isExit (static_cast<decl_node> (s)))
     {
       /* avoid dangling else.  */
       doExitC (p, s);
     }
-  else if (decl_isReturn (s))
+  else if (decl_isReturn (static_cast<decl_node> (s)))
     {
       /* avoid dangling else.  */
       doReturnC (p, s);
@@ -17061,22 +17122,22 @@ static void doStatementsC (mcPretty_pretty p, decl_node s)
       /* avoid dangling else.  */
       doAssignmentC (p, s);
     }
-  else if (decl_isIf (s))
+  else if (decl_isIf (static_cast<decl_node> (s)))
     {
       /* avoid dangling else.  */
       doIfC (p, s);
     }
-  else if (decl_isFor (s))
+  else if (decl_isFor (static_cast<decl_node> (s)))
     {
       /* avoid dangling else.  */
       doForC (p, s);
     }
-  else if (decl_isRepeat (s))
+  else if (decl_isRepeat (static_cast<decl_node> (s)))
     {
       /* avoid dangling else.  */
       doRepeatC (p, s);
     }
-  else if (decl_isWhile (s))
+  else if (decl_isWhile (static_cast<decl_node> (s)))
     {
       /* avoid dangling else.  */
       doWhileC (p, s);
@@ -17091,17 +17152,17 @@ static void doStatementsC (mcPretty_pretty p, decl_node s)
       /* avoid dangling else.  */
       doFuncCallC (p, s);
     }
-  else if (decl_isCase (s))
+  else if (decl_isCase (static_cast<decl_node> (s)))
     {
       /* avoid dangling else.  */
       doCaseC (p, s);
     }
-  else if (decl_isLoop (s))
+  else if (decl_isLoop (static_cast<decl_node> (s)))
     {
       /* avoid dangling else.  */
       doLoopC (p, s);
     }
-  else if (decl_isExit (s))
+  else if (decl_isExit (static_cast<decl_node> (s)))
     {
       /* avoid dangling else.  */
       doExitC (p, s);
@@ -17114,7 +17175,7 @@ static void doStatementsC (mcPretty_pretty p, decl_node s)
     }
 }
 
-static void stop (void)
+static void localstop (void)
 {
 }
 
@@ -17148,12 +17209,12 @@ static void doLocalConstTypesC (mcPretty_pretty p, decl_scopeT s)
    addParamDone -
 */
 
-static void addParamDone (decl_node n)
+static void addParamDone (decl_node__opaque n)
 {
-  if ((decl_isVar (n)) && n->varF.isParameter)
+  if ((decl_isVar (static_cast<decl_node> (n))) && n->varF.isParameter)
     {
       addDone (n);
-      addDone (decl_getType (n));
+      addDone (static_cast<decl_node__opaque> (decl_getType (static_cast<decl_node> (n))));
     }
 }
 
@@ -17162,9 +17223,9 @@ static void addParamDone (decl_node n)
    includeParameters -
 */
 
-static void includeParameters (decl_node n)
+static void includeParameters (decl_node__opaque n)
 {
-  mcDebug_assert (decl_isProcedure (n));
+  mcDebug_assert (decl_isProcedure (static_cast<decl_node> (n)));
   Indexing_ForeachIndiceInIndexDo (n->procedureF.decls.variables, (Indexing_IndexProcedure) {(Indexing_IndexProcedure_t) addParamDone});
 }
 
@@ -17173,7 +17234,7 @@ static void includeParameters (decl_node n)
    isHalt -
 */
 
-static bool isHalt (decl_node n)
+static bool isHalt (decl_node__opaque n)
 {
   return n->kind == decl_halt;
   /* static analysis guarentees a RETURN statement will be used before here.  */
@@ -17185,9 +17246,9 @@ static bool isHalt (decl_node n)
    isReturnOrHalt -
 */
 
-static bool isReturnOrHalt (decl_node n)
+static bool isReturnOrHalt (decl_node__opaque n)
 {
-  return (isHalt (n)) || (decl_isReturn (n));
+  return (isHalt (n)) || (decl_isReturn (static_cast<decl_node> (n)));
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -17197,7 +17258,7 @@ static bool isReturnOrHalt (decl_node n)
    isLastStatementReturn -
 */
 
-static bool isLastStatementReturn (decl_node n)
+static bool isLastStatementReturn (decl_node__opaque n)
 {
   return isLastStatement (n, (decl_isNodeF) {(decl_isNodeF_t) isReturnOrHalt});
   /* static analysis guarentees a RETURN statement will be used before here.  */
@@ -17209,15 +17270,15 @@ static bool isLastStatementReturn (decl_node n)
    isLastStatementSequence -
 */
 
-static bool isLastStatementSequence (decl_node n, decl_isNodeF q)
+static bool isLastStatementSequence (decl_node__opaque n, decl_isNodeF q)
 {
   unsigned int h;
 
-  mcDebug_assert (decl_isStatementSequence (n));
+  mcDebug_assert (decl_isStatementSequence (static_cast<decl_node> (n)));
   h = Indexing_HighIndice (n->stmtF.statements);
   if (h > 0)
     {
-      return isLastStatement (reinterpret_cast<decl_node> (Indexing_GetIndice (n->stmtF.statements, h)), q);
+      return isLastStatement (static_cast<decl_node__opaque> (Indexing_GetIndice (n->stmtF.statements, h)), q);
     }
   return false;
   /* static analysis guarentees a RETURN statement will be used before here.  */
@@ -17229,11 +17290,11 @@ static bool isLastStatementSequence (decl_node n, decl_isNodeF q)
    isLastStatementIf -
 */
 
-static bool isLastStatementIf (decl_node n, decl_isNodeF q)
+static bool isLastStatementIf (decl_node__opaque n, decl_isNodeF q)
 {
   bool ret;
 
-  mcDebug_assert (decl_isIf (n));
+  mcDebug_assert (decl_isIf (static_cast<decl_node> (n)));
   ret = true;
   if ((n->ifF.elsif != NULL) && ret)
     {
@@ -17257,11 +17318,11 @@ static bool isLastStatementIf (decl_node n, decl_isNodeF q)
    isLastStatementElsif -
 */
 
-static bool isLastStatementElsif (decl_node n, decl_isNodeF q)
+static bool isLastStatementElsif (decl_node__opaque n, decl_isNodeF q)
 {
   bool ret;
 
-  mcDebug_assert (decl_isElsif (n));
+  mcDebug_assert (decl_isElsif (static_cast<decl_node> (n)));
   ret = true;
   if ((n->elsifF.elsif != NULL) && ret)
     {
@@ -17285,21 +17346,21 @@ static bool isLastStatementElsif (decl_node n, decl_isNodeF q)
    isLastStatementCase -
 */
 
-static bool isLastStatementCase (decl_node n, decl_isNodeF q)
+static bool isLastStatementCase (decl_node__opaque n, decl_isNodeF q)
 {
   bool ret;
   unsigned int i;
   unsigned int h;
-  decl_node c;
+  decl_node__opaque c;
 
   ret = true;
-  mcDebug_assert (decl_isCase (n));
+  mcDebug_assert (decl_isCase (static_cast<decl_node> (n)));
   i = 1;
   h = Indexing_HighIndice (n->caseF.caseLabelList);
   while (i <= h)
     {
-      c = static_cast<decl_node> (Indexing_GetIndice (n->caseF.caseLabelList, i));
-      mcDebug_assert (decl_isCaseLabelList (c));
+      c = static_cast<decl_node__opaque> (Indexing_GetIndice (n->caseF.caseLabelList, i));
+      mcDebug_assert (decl_isCaseLabelList (static_cast<decl_node> (c)));
       ret = ret && (isLastStatement (c->caselabellistF.statements, q));
       i += 1;
     }
@@ -17317,7 +17378,7 @@ static bool isLastStatementCase (decl_node n, decl_isNodeF q)
    isLastStatement - returns TRUE if the last statement in, n, is, q.
 */
 
-static bool isLastStatement (decl_node n, decl_isNodeF q)
+static bool isLastStatement (decl_node__opaque n, decl_isNodeF q)
 {
   bool ret;
 
@@ -17325,33 +17386,33 @@ static bool isLastStatement (decl_node n, decl_isNodeF q)
     {
       return false;
     }
-  else if (decl_isStatementSequence (n))
+  else if (decl_isStatementSequence (static_cast<decl_node> (n)))
     {
       /* avoid dangling else.  */
       return isLastStatementSequence (n, q);
     }
-  else if (decl_isProcedure (n))
+  else if (decl_isProcedure (static_cast<decl_node> (n)))
     {
       /* avoid dangling else.  */
-      mcDebug_assert (decl_isProcedure (n));
+      mcDebug_assert (decl_isProcedure (static_cast<decl_node> (n)));
       return isLastStatement (n->procedureF.beginStatements, q);
     }
-  else if (decl_isIf (n))
+  else if (decl_isIf (static_cast<decl_node> (n)))
     {
       /* avoid dangling else.  */
       return isLastStatementIf (n, q);
     }
-  else if (decl_isElsif (n))
+  else if (decl_isElsif (static_cast<decl_node> (n)))
     {
       /* avoid dangling else.  */
       return isLastStatementElsif (n, q);
     }
-  else if (decl_isCase (n))
+  else if (decl_isCase (static_cast<decl_node> (n)))
     {
       /* avoid dangling else.  */
       return isLastStatementCase (n, q);
     }
-  else if ((*q.proc) (n))
+  else if ((*q.proc) (static_cast<decl_node> (n)))
     {
       /* avoid dangling else.  */
       return true;
@@ -17366,13 +17427,13 @@ static bool isLastStatement (decl_node n, decl_isNodeF q)
    doProcedureC -
 */
 
-static void doProcedureC (decl_node n)
+static void doProcedureC (decl_node__opaque n)
 {
   unsigned int s;
 
   outText (doP, (const char *) "\\n", 2);
   includeParameters (n);
-  keyc_enterScope (n);
+  keyc_enterScope (static_cast<decl_node> (n));
   doProcedureHeadingC (n, false);
   outText (doP, (const char *) "\\n", 2);
   doP = outKc (doP, (const char *) "{\\n", 3);
@@ -17402,7 +17463,7 @@ static void doProcedureC (decl_node n)
         }
     }
   doP = outKc (doP, (const char *) "}\\n", 3);
-  keyc_leaveScope (n);
+  keyc_leaveScope (static_cast<decl_node> (n));
 }
 
 
@@ -17425,13 +17486,13 @@ static void outProceduresC (mcPretty_pretty p, decl_scopeT s)
    output -
 */
 
-static void output (decl_node n, decl_nodeProcedure c, decl_nodeProcedure t, decl_nodeProcedure v)
+static void output (decl_node__opaque n, decl_nodeProcedure c, decl_nodeProcedure t, decl_nodeProcedure v)
 {
-  if (decl_isConst (n))
+  if (decl_isConst (static_cast<decl_node> (n)))
     {
       (*c.proc) (n);
     }
-  else if (decl_isVar (n))
+  else if (decl_isVar (static_cast<decl_node> (n)))
     {
       /* avoid dangling else.  */
       (*v.proc) (n);
@@ -17448,7 +17509,7 @@ static void output (decl_node n, decl_nodeProcedure c, decl_nodeProcedure t, dec
    allDependants -
 */
 
-static decl_dependentState allDependants (decl_node n)
+static decl_dependentState allDependants (decl_node__opaque n)
 {
   alists_alist l;
   decl_dependentState s;
@@ -17466,7 +17527,7 @@ static decl_dependentState allDependants (decl_node n)
    walkDependants -
 */
 
-static decl_dependentState walkDependants (alists_alist l, decl_node n)
+static decl_dependentState walkDependants (alists_alist l, decl_node__opaque n)
 {
   if ((n == NULL) || (alists_isItemInList (globalGroup->doneQ, reinterpret_cast<void *> (n))))
     {
@@ -17492,11 +17553,11 @@ static decl_dependentState walkDependants (alists_alist l, decl_node n)
    walkType -
 */
 
-static decl_dependentState walkType (alists_alist l, decl_node n)
+static decl_dependentState walkType (alists_alist l, decl_node__opaque n)
 {
-  decl_node t;
+  decl_node__opaque t;
 
-  t = decl_getType (n);
+  t = static_cast<decl_node__opaque> (decl_getType (static_cast<decl_node> (n)));
   if (alists_isItemInList (globalGroup->doneQ, reinterpret_cast<void *> (t)))
     {
       return decl_completed;
@@ -17521,7 +17582,7 @@ static decl_dependentState walkType (alists_alist l, decl_node n)
    db -
 */
 
-static void db (const char *a_, unsigned int _a_high, decl_node n)
+static void db (const char *a_, unsigned int _a_high, decl_node__opaque n)
 {
   char a[_a_high+1];
 
@@ -17561,7 +17622,7 @@ static void dbt (const char *a_, unsigned int _a_high)
    dbs -
 */
 
-static void dbs (decl_dependentState s, decl_node n)
+static void dbs (decl_dependentState s, decl_node__opaque n)
 {
   if (mcOptions_getDebugTopological ())
     {
@@ -17601,7 +17662,7 @@ static void dbs (decl_dependentState s, decl_node n)
    dbq -
 */
 
-static void dbq (decl_node n)
+static void dbq (decl_node__opaque n)
 {
   if (mcOptions_getDebugTopological ())
     {
@@ -17631,13 +17692,13 @@ static void dbq (decl_node n)
    walkRecord -
 */
 
-static decl_dependentState walkRecord (alists_alist l, decl_node n)
+static decl_dependentState walkRecord (alists_alist l, decl_node__opaque n)
 {
   decl_dependentState s;
   unsigned int o;
   unsigned int i;
   unsigned int t;
-  decl_node q;
+  decl_node__opaque q;
 
   i = Indexing_LowIndice (n->recordF.listOfSons);
   t = Indexing_HighIndice (n->recordF.listOfSons);
@@ -17647,9 +17708,9 @@ static decl_dependentState walkRecord (alists_alist l, decl_node n)
   dbq (n);
   while (i <= t)
     {
-      q = static_cast<decl_node> (Indexing_GetIndice (n->recordF.listOfSons, i));
+      q = static_cast<decl_node__opaque> (Indexing_GetIndice (n->recordF.listOfSons, i));
       db ((const char *) "", 0, q);
-      if ((decl_isRecordField (q)) && q->recordfieldF.tag)
+      if ((decl_isRecordField (static_cast<decl_node> (q))) && q->recordfieldF.tag)
         {}  /* empty.  */
       else
         {
@@ -17660,7 +17721,7 @@ static decl_dependentState walkRecord (alists_alist l, decl_node n)
               dbs (s, q);
               addTodo (n);
               dbq (n);
-              db ((const char *) "\\n", 2, NULL);
+              db ((const char *) "\\n", 2, static_cast<decl_node__opaque> (NULL));
               mcPretty_setindent (doP, o);
               return s;
             }
@@ -17680,12 +17741,12 @@ static decl_dependentState walkRecord (alists_alist l, decl_node n)
    walkVarient -
 */
 
-static decl_dependentState walkVarient (alists_alist l, decl_node n)
+static decl_dependentState walkVarient (alists_alist l, decl_node__opaque n)
 {
   decl_dependentState s;
   unsigned int i;
   unsigned int t;
-  decl_node q;
+  decl_node__opaque q;
 
   db ((const char *) "\\nwalking", 9, n);
   s = walkDependants (l, n->varientF.tag);
@@ -17693,20 +17754,20 @@ static decl_dependentState walkVarient (alists_alist l, decl_node n)
     {
       dbs (s, n->varientF.tag);
       dbq (n->varientF.tag);
-      db ((const char *) "\\n", 2, NULL);
+      db ((const char *) "\\n", 2, static_cast<decl_node__opaque> (NULL));
       return s;
     }
   i = Indexing_LowIndice (n->varientF.listOfSons);
   t = Indexing_HighIndice (n->varientF.listOfSons);
   while (i <= t)
     {
-      q = static_cast<decl_node> (Indexing_GetIndice (n->varientF.listOfSons, i));
+      q = static_cast<decl_node__opaque> (Indexing_GetIndice (n->varientF.listOfSons, i));
       db ((const char *) "", 0, q);
       s = walkDependants (l, q);
       if (s != decl_completed)
         {
           dbs (s, q);
-          db ((const char *) "\\n", 2, NULL);
+          db ((const char *) "\\n", 2, static_cast<decl_node__opaque> (NULL));
           return s;
         }
       i += 1;
@@ -17723,7 +17784,7 @@ static decl_dependentState walkVarient (alists_alist l, decl_node n)
    queueBlocked -
 */
 
-static void queueBlocked (decl_node n)
+static void queueBlocked (decl_node__opaque n)
 {
   if (! ((alists_isItemInList (globalGroup->doneQ, reinterpret_cast<void *> (n))) || (alists_isItemInList (globalGroup->partialQ, reinterpret_cast<void *> (n)))))
     {
@@ -17736,11 +17797,11 @@ static void queueBlocked (decl_node n)
    walkVar -
 */
 
-static decl_dependentState walkVar (alists_alist l, decl_node n)
+static decl_dependentState walkVar (alists_alist l, decl_node__opaque n)
 {
-  decl_node t;
+  decl_node__opaque t;
 
-  t = decl_getType (n);
+  t = static_cast<decl_node__opaque> (decl_getType (static_cast<decl_node> (n)));
   if (alists_isItemInList (globalGroup->doneQ, reinterpret_cast<void *> (t)))
     {
       return decl_completed;
@@ -17759,19 +17820,19 @@ static decl_dependentState walkVar (alists_alist l, decl_node n)
    walkEnumeration -
 */
 
-static decl_dependentState walkEnumeration (alists_alist l, decl_node n)
+static decl_dependentState walkEnumeration (alists_alist l, decl_node__opaque n)
 {
   decl_dependentState s;
   unsigned int i;
   unsigned int t;
-  decl_node q;
+  decl_node__opaque q;
 
   i = Indexing_LowIndice (n->enumerationF.listOfSons);
   t = Indexing_HighIndice (n->enumerationF.listOfSons);
   s = decl_completed;
   while (i <= t)
     {
-      q = static_cast<decl_node> (Indexing_GetIndice (n->enumerationF.listOfSons, i));
+      q = static_cast<decl_node__opaque> (Indexing_GetIndice (n->enumerationF.listOfSons, i));
       s = walkDependants (l, q);
       if (s != decl_completed)
         {
@@ -17789,7 +17850,7 @@ static decl_dependentState walkEnumeration (alists_alist l, decl_node n)
    walkSubrange -
 */
 
-static decl_dependentState walkSubrange (alists_alist l, decl_node n)
+static decl_dependentState walkSubrange (alists_alist l, decl_node__opaque n)
 {
   decl_dependentState s;
 
@@ -17818,7 +17879,7 @@ static decl_dependentState walkSubrange (alists_alist l, decl_node n)
    walkSubscript -
 */
 
-static decl_dependentState walkSubscript (alists_alist l, decl_node n)
+static decl_dependentState walkSubscript (alists_alist l, decl_node__opaque n)
 {
   decl_dependentState s;
 
@@ -17842,12 +17903,12 @@ static decl_dependentState walkSubscript (alists_alist l, decl_node n)
    walkPointer -
 */
 
-static decl_dependentState walkPointer (alists_alist l, decl_node n)
+static decl_dependentState walkPointer (alists_alist l, decl_node__opaque n)
 {
-  decl_node t;
+  decl_node__opaque t;
 
   /* if the type of, n, is done or partial then we can output pointer.  */
-  t = decl_getType (n);
+  t = static_cast<decl_node__opaque> (decl_getType (static_cast<decl_node> (n)));
   if ((alists_isItemInList (globalGroup->partialQ, reinterpret_cast<void *> (t))) || (alists_isItemInList (globalGroup->doneQ, reinterpret_cast<void *> (t))))
     {
       /* pointer to partial can always generate a complete type.  */
@@ -17863,7 +17924,7 @@ static decl_dependentState walkPointer (alists_alist l, decl_node n)
    walkArray -
 */
 
-static decl_dependentState walkArray (alists_alist l, decl_node n)
+static decl_dependentState walkArray (alists_alist l, decl_node__opaque n)
 {
   decl_dependentState s;
 
@@ -17892,7 +17953,7 @@ static decl_dependentState walkArray (alists_alist l, decl_node n)
    walkConst -
 */
 
-static decl_dependentState walkConst (alists_alist l, decl_node n)
+static decl_dependentState walkConst (alists_alist l, decl_node__opaque n)
 {
   decl_dependentState s;
 
@@ -17916,11 +17977,11 @@ static decl_dependentState walkConst (alists_alist l, decl_node n)
    walkVarParam -
 */
 
-static decl_dependentState walkVarParam (alists_alist l, decl_node n)
+static decl_dependentState walkVarParam (alists_alist l, decl_node__opaque n)
 {
-  decl_node t;
+  decl_node__opaque t;
 
-  t = decl_getType (n);
+  t = static_cast<decl_node__opaque> (decl_getType (static_cast<decl_node> (n)));
   if (alists_isItemInList (globalGroup->partialQ, reinterpret_cast<void *> (t)))
     {
       /* parameter can be issued from a partial.  */
@@ -17936,11 +17997,11 @@ static decl_dependentState walkVarParam (alists_alist l, decl_node n)
    walkParam -
 */
 
-static decl_dependentState walkParam (alists_alist l, decl_node n)
+static decl_dependentState walkParam (alists_alist l, decl_node__opaque n)
 {
-  decl_node t;
+  decl_node__opaque t;
 
-  t = decl_getType (n);
+  t = static_cast<decl_node__opaque> (decl_getType (static_cast<decl_node> (n)));
   if (alists_isItemInList (globalGroup->partialQ, reinterpret_cast<void *> (t)))
     {
       /* parameter can be issued from a partial.  */
@@ -17956,11 +18017,11 @@ static decl_dependentState walkParam (alists_alist l, decl_node n)
    walkOptarg -
 */
 
-static decl_dependentState walkOptarg (alists_alist l, decl_node n)
+static decl_dependentState walkOptarg (alists_alist l, decl_node__opaque n)
 {
-  decl_node t;
+  decl_node__opaque t;
 
-  t = decl_getType (n);
+  t = static_cast<decl_node__opaque> (decl_getType (static_cast<decl_node> (n)));
   if (alists_isItemInList (globalGroup->partialQ, reinterpret_cast<void *> (t)))
     {
       /* parameter can be issued from a partial.  */
@@ -17976,13 +18037,13 @@ static decl_dependentState walkOptarg (alists_alist l, decl_node n)
    walkRecordField -
 */
 
-static decl_dependentState walkRecordField (alists_alist l, decl_node n)
+static decl_dependentState walkRecordField (alists_alist l, decl_node__opaque n)
 {
-  decl_node t;
+  decl_node__opaque t;
   decl_dependentState s;
 
-  mcDebug_assert (decl_isRecordField (n));
-  t = decl_getType (n);
+  mcDebug_assert (decl_isRecordField (static_cast<decl_node> (n)));
+  t = static_cast<decl_node__opaque> (decl_getType (static_cast<decl_node> (n)));
   if (alists_isItemInList (globalGroup->partialQ, reinterpret_cast<void *> (t)))
     {
       dbs (decl_partial, n);
@@ -18013,19 +18074,19 @@ static decl_dependentState walkRecordField (alists_alist l, decl_node n)
    walkVarientField -
 */
 
-static decl_dependentState walkVarientField (alists_alist l, decl_node n)
+static decl_dependentState walkVarientField (alists_alist l, decl_node__opaque n)
 {
   decl_dependentState s;
   unsigned int i;
   unsigned int t;
-  decl_node q;
+  decl_node__opaque q;
 
   i = Indexing_LowIndice (n->varientfieldF.listOfSons);
   t = Indexing_HighIndice (n->varientfieldF.listOfSons);
   s = decl_completed;
   while (i <= t)
     {
-      q = static_cast<decl_node> (Indexing_GetIndice (n->varientfieldF.listOfSons, i));
+      q = static_cast<decl_node__opaque> (Indexing_GetIndice (n->varientfieldF.listOfSons, i));
       s = walkDependants (l, q);
       if (s != decl_completed)
         {
@@ -18046,7 +18107,7 @@ static decl_dependentState walkVarientField (alists_alist l, decl_node n)
    walkEnumerationField -
 */
 
-static decl_dependentState walkEnumerationField (alists_alist l, decl_node n)
+static decl_dependentState walkEnumerationField (alists_alist l, decl_node__opaque n)
 {
   return decl_completed;
   /* static analysis guarentees a RETURN statement will be used before here.  */
@@ -18058,9 +18119,9 @@ static decl_dependentState walkEnumerationField (alists_alist l, decl_node n)
    walkSet -
 */
 
-static decl_dependentState walkSet (alists_alist l, decl_node n)
+static decl_dependentState walkSet (alists_alist l, decl_node__opaque n)
 {
-  return walkDependants (l, decl_getType (n));
+  return walkDependants (l, static_cast<decl_node__opaque> (decl_getType (static_cast<decl_node> (n))));
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -18070,12 +18131,12 @@ static decl_dependentState walkSet (alists_alist l, decl_node n)
    walkProcType -
 */
 
-static decl_dependentState walkProcType (alists_alist l, decl_node n)
+static decl_dependentState walkProcType (alists_alist l, decl_node__opaque n)
 {
   decl_dependentState s;
-  decl_node t;
+  decl_node__opaque t;
 
-  t = decl_getType (n);
+  t = static_cast<decl_node__opaque> (decl_getType (static_cast<decl_node> (n)));
   if (alists_isItemInList (globalGroup->partialQ, reinterpret_cast<void *> (t)))
     {}  /* empty.  */
   else
@@ -18097,11 +18158,11 @@ static decl_dependentState walkProcType (alists_alist l, decl_node n)
    walkProcedure -
 */
 
-static decl_dependentState walkProcedure (alists_alist l, decl_node n)
+static decl_dependentState walkProcedure (alists_alist l, decl_node__opaque n)
 {
   decl_dependentState s;
 
-  s = walkDependants (l, decl_getType (n));
+  s = walkDependants (l, static_cast<decl_node__opaque> (decl_getType (static_cast<decl_node> (n))));
   if (s != decl_completed)
     {
       return s;
@@ -18121,13 +18182,13 @@ static decl_dependentState walkParameters (alists_alist l, Indexing_Index p)
   decl_dependentState s;
   unsigned int i;
   unsigned int h;
-  decl_node q;
+  decl_node__opaque q;
 
   i = Indexing_LowIndice (p);
   h = Indexing_HighIndice (p);
   while (i <= h)
     {
-      q = static_cast<decl_node> (Indexing_GetIndice (p, i));
+      q = static_cast<decl_node__opaque> (Indexing_GetIndice (p, i));
       s = walkDependants (l, q);
       if (s != decl_completed)
         {
@@ -18145,7 +18206,7 @@ static decl_dependentState walkParameters (alists_alist l, Indexing_Index p)
    walkFuncCall -
 */
 
-static decl_dependentState walkFuncCall (alists_alist l, decl_node n)
+static decl_dependentState walkFuncCall (alists_alist l, decl_node__opaque n)
 {
   return decl_completed;
   /* static analysis guarentees a RETURN statement will be used before here.  */
@@ -18157,7 +18218,7 @@ static decl_dependentState walkFuncCall (alists_alist l, decl_node n)
    walkUnary -
 */
 
-static decl_dependentState walkUnary (alists_alist l, decl_node n)
+static decl_dependentState walkUnary (alists_alist l, decl_node__opaque n)
 {
   decl_dependentState s;
 
@@ -18176,7 +18237,7 @@ static decl_dependentState walkUnary (alists_alist l, decl_node n)
    walkBinary -
 */
 
-static decl_dependentState walkBinary (alists_alist l, decl_node n)
+static decl_dependentState walkBinary (alists_alist l, decl_node__opaque n)
 {
   decl_dependentState s;
 
@@ -18200,7 +18261,7 @@ static decl_dependentState walkBinary (alists_alist l, decl_node n)
    walkComponentRef -
 */
 
-static decl_dependentState walkComponentRef (alists_alist l, decl_node n)
+static decl_dependentState walkComponentRef (alists_alist l, decl_node__opaque n)
 {
   decl_dependentState s;
 
@@ -18224,7 +18285,7 @@ static decl_dependentState walkComponentRef (alists_alist l, decl_node n)
    walkPointerRef -
 */
 
-static decl_dependentState walkPointerRef (alists_alist l, decl_node n)
+static decl_dependentState walkPointerRef (alists_alist l, decl_node__opaque n)
 {
   decl_dependentState s;
 
@@ -18248,13 +18309,13 @@ static decl_dependentState walkPointerRef (alists_alist l, decl_node n)
    walkSetValue -
 */
 
-static decl_dependentState walkSetValue (alists_alist l, decl_node n)
+static decl_dependentState walkSetValue (alists_alist l, decl_node__opaque n)
 {
   decl_dependentState s;
   unsigned int i;
   unsigned int j;
 
-  mcDebug_assert (decl_isSetValue (n));
+  mcDebug_assert (decl_isSetValue (static_cast<decl_node> (n)));
   s = walkDependants (l, n->setvalueF.type);
   if (s != decl_completed)
     {
@@ -18264,7 +18325,7 @@ static decl_dependentState walkSetValue (alists_alist l, decl_node n)
   j = Indexing_HighIndice (n->setvalueF.values);
   while (i <= j)
     {
-      s = walkDependants (l, reinterpret_cast<decl_node> (Indexing_GetIndice (n->setvalueF.values, i)));
+      s = walkDependants (l, static_cast<decl_node__opaque> (Indexing_GetIndice (n->setvalueF.values, i)));
       if (s != decl_completed)
         {
           return s;
@@ -18282,7 +18343,7 @@ static decl_dependentState walkSetValue (alists_alist l, decl_node n)
                   all dependants have been declared.
 */
 
-static decl_dependentState doDependants (alists_alist l, decl_node n)
+static decl_dependentState doDependants (alists_alist l, decl_node__opaque n)
 {
   switch (n->kind)
     {
@@ -18490,15 +18551,15 @@ static decl_dependentState doDependants (alists_alist l, decl_node n)
    tryComplete - returns TRUE if node, n, can be and was completed.
 */
 
-static bool tryComplete (decl_node n, decl_nodeProcedure c, decl_nodeProcedure t, decl_nodeProcedure v)
+static bool tryComplete (decl_node__opaque n, decl_nodeProcedure c, decl_nodeProcedure t, decl_nodeProcedure v)
 {
-  if (decl_isEnumeration (n))
+  if (decl_isEnumeration (static_cast<decl_node> (n)))
     {
       /* can always emit enumerated types.  */
       output (n, c, t, v);
       return true;
     }
-  else if (((decl_isType (n)) && (decl_isTypeHidden (n))) && ((decl_getType (n)) == NULL))
+  else if (((decl_isType (static_cast<decl_node> (n))) && (decl_isTypeHidden (static_cast<decl_node> (n)))) && ((decl_getType (static_cast<decl_node> (n))) == NULL))
     {
       /* avoid dangling else.  */
       /* can always emit hidden types.  */
@@ -18521,9 +18582,9 @@ static bool tryComplete (decl_node n, decl_nodeProcedure c, decl_nodeProcedure t
    tryCompleteFromPartial -
 */
 
-static bool tryCompleteFromPartial (decl_node n, decl_nodeProcedure t)
+static bool tryCompleteFromPartial (decl_node__opaque n, decl_nodeProcedure t)
 {
-  if ((((decl_isType (n)) && ((decl_getType (n)) != NULL)) && (decl_isPointer (decl_getType (n)))) && ((allDependants (decl_getType (n))) == decl_completed))
+  if ((((decl_isType (static_cast<decl_node> (n))) && ((decl_getType (static_cast<decl_node> (n))) != NULL)) && (decl_isPointer (decl_getType (static_cast<decl_node> (n))))) && ((allDependants (static_cast<decl_node__opaque> (decl_getType (static_cast<decl_node> (n))))) == decl_completed))
     {
       /* alists.includeItemIntoList (globalGroup^.partialQ, getType (n)) ;  */
       outputHiddenComplete (n);
@@ -18545,7 +18606,7 @@ static bool tryCompleteFromPartial (decl_node n, decl_nodeProcedure t)
    visitIntrinsicFunction -
 */
 
-static void visitIntrinsicFunction (alists_alist v, decl_node n, decl_nodeProcedure p)
+static void visitIntrinsicFunction (alists_alist v, decl_node__opaque n, decl_nodeProcedure p)
 {
   mcDebug_assert (isIntrinsicFunction (n));
   switch (n->kind)
@@ -18588,7 +18649,7 @@ static void visitIntrinsicFunction (alists_alist v, decl_node n, decl_nodeProced
    visitUnary -
 */
 
-static void visitUnary (alists_alist v, decl_node n, decl_nodeProcedure p)
+static void visitUnary (alists_alist v, decl_node__opaque n, decl_nodeProcedure p)
 {
   mcDebug_assert (isUnary (n));
   visitNode (v, n->unaryF.arg, p);
@@ -18600,7 +18661,7 @@ static void visitUnary (alists_alist v, decl_node n, decl_nodeProcedure p)
    visitBinary -
 */
 
-static void visitBinary (alists_alist v, decl_node n, decl_nodeProcedure p)
+static void visitBinary (alists_alist v, decl_node__opaque n, decl_nodeProcedure p)
 {
   visitNode (v, n->binaryF.left, p);
   visitNode (v, n->binaryF.right, p);
@@ -18612,7 +18673,7 @@ static void visitBinary (alists_alist v, decl_node n, decl_nodeProcedure p)
    visitBoolean -
 */
 
-static void visitBoolean (alists_alist v, decl_node n, decl_nodeProcedure p)
+static void visitBoolean (alists_alist v, decl_node__opaque n, decl_nodeProcedure p)
 {
   visitNode (v, falseN, p);
   visitNode (v, trueN, p);
@@ -18623,7 +18684,7 @@ static void visitBoolean (alists_alist v, decl_node n, decl_nodeProcedure p)
    visitScope -
 */
 
-static void visitScope (alists_alist v, decl_node n, decl_nodeProcedure p)
+static void visitScope (alists_alist v, decl_node__opaque n, decl_nodeProcedure p)
 {
   if (mustVisitScope)
     {
@@ -18636,9 +18697,9 @@ static void visitScope (alists_alist v, decl_node n, decl_nodeProcedure p)
    visitType -
 */
 
-static void visitType (alists_alist v, decl_node n, decl_nodeProcedure p)
+static void visitType (alists_alist v, decl_node__opaque n, decl_nodeProcedure p)
 {
-  mcDebug_assert (decl_isType (n));
+  mcDebug_assert (decl_isType (static_cast<decl_node> (n)));
   visitNode (v, n->typeF.type, p);
   visitScope (v, n->typeF.scope, p);
 }
@@ -18657,7 +18718,7 @@ static void visitIndex (alists_alist v, Indexing_Index i, decl_nodeProcedure p)
   h = Indexing_HighIndice (i);
   while (j <= h)
     {
-      visitNode (v, reinterpret_cast<decl_node> (Indexing_GetIndice (i, j)), p);
+      visitNode (v, static_cast<decl_node__opaque> (Indexing_GetIndice (i, j)), p);
       j += 1;
     }
 }
@@ -18667,9 +18728,9 @@ static void visitIndex (alists_alist v, Indexing_Index i, decl_nodeProcedure p)
    visitRecord -
 */
 
-static void visitRecord (alists_alist v, decl_node n, decl_nodeProcedure p)
+static void visitRecord (alists_alist v, decl_node__opaque n, decl_nodeProcedure p)
 {
-  mcDebug_assert (decl_isRecord (n));
+  mcDebug_assert (decl_isRecord (static_cast<decl_node> (n)));
   visitScope (v, n->recordF.scope, p);
   visitIndex (v, n->recordF.listOfSons, p);
 }
@@ -18679,9 +18740,9 @@ static void visitRecord (alists_alist v, decl_node n, decl_nodeProcedure p)
    visitVarient -
 */
 
-static void visitVarient (alists_alist v, decl_node n, decl_nodeProcedure p)
+static void visitVarient (alists_alist v, decl_node__opaque n, decl_nodeProcedure p)
 {
-  mcDebug_assert (decl_isVarient (n));
+  mcDebug_assert (decl_isVarient (static_cast<decl_node> (n)));
   visitIndex (v, n->varientF.listOfSons, p);
   visitNode (v, n->varientF.varient, p);
   visitNode (v, n->varientF.tag, p);
@@ -18693,9 +18754,9 @@ static void visitVarient (alists_alist v, decl_node n, decl_nodeProcedure p)
    visitVar -
 */
 
-static void visitVar (alists_alist v, decl_node n, decl_nodeProcedure p)
+static void visitVar (alists_alist v, decl_node__opaque n, decl_nodeProcedure p)
 {
-  mcDebug_assert (decl_isVar (n));
+  mcDebug_assert (decl_isVar (static_cast<decl_node> (n)));
   visitNode (v, n->varF.type, p);
   visitNode (v, n->varF.decl, p);
   visitScope (v, n->varF.scope, p);
@@ -18706,9 +18767,9 @@ static void visitVar (alists_alist v, decl_node n, decl_nodeProcedure p)
    visitEnumeration -
 */
 
-static void visitEnumeration (alists_alist v, decl_node n, decl_nodeProcedure p)
+static void visitEnumeration (alists_alist v, decl_node__opaque n, decl_nodeProcedure p)
 {
-  mcDebug_assert (decl_isEnumeration (n));
+  mcDebug_assert (decl_isEnumeration (static_cast<decl_node> (n)));
   visitIndex (v, n->enumerationF.listOfSons, p);
   visitScope (v, n->enumerationF.scope, p);
 }
@@ -18718,9 +18779,9 @@ static void visitEnumeration (alists_alist v, decl_node n, decl_nodeProcedure p)
    visitSubrange -
 */
 
-static void visitSubrange (alists_alist v, decl_node n, decl_nodeProcedure p)
+static void visitSubrange (alists_alist v, decl_node__opaque n, decl_nodeProcedure p)
 {
-  mcDebug_assert (decl_isSubrange (n));
+  mcDebug_assert (decl_isSubrange (static_cast<decl_node> (n)));
   visitNode (v, n->subrangeF.low, p);
   visitNode (v, n->subrangeF.high, p);
   visitNode (v, n->subrangeF.type, p);
@@ -18732,9 +18793,9 @@ static void visitSubrange (alists_alist v, decl_node n, decl_nodeProcedure p)
    visitPointer -
 */
 
-static void visitPointer (alists_alist v, decl_node n, decl_nodeProcedure p)
+static void visitPointer (alists_alist v, decl_node__opaque n, decl_nodeProcedure p)
 {
-  mcDebug_assert (decl_isPointer (n));
+  mcDebug_assert (decl_isPointer (static_cast<decl_node> (n)));
   visitNode (v, n->pointerF.type, p);
   visitScope (v, n->pointerF.scope, p);
 }
@@ -18744,9 +18805,9 @@ static void visitPointer (alists_alist v, decl_node n, decl_nodeProcedure p)
    visitArray -
 */
 
-static void visitArray (alists_alist v, decl_node n, decl_nodeProcedure p)
+static void visitArray (alists_alist v, decl_node__opaque n, decl_nodeProcedure p)
 {
-  mcDebug_assert (decl_isArray (n));
+  mcDebug_assert (decl_isArray (static_cast<decl_node> (n)));
   visitNode (v, n->arrayF.subr, p);
   visitNode (v, n->arrayF.type, p);
   visitScope (v, n->arrayF.scope, p);
@@ -18757,9 +18818,9 @@ static void visitArray (alists_alist v, decl_node n, decl_nodeProcedure p)
    visitConst -
 */
 
-static void visitConst (alists_alist v, decl_node n, decl_nodeProcedure p)
+static void visitConst (alists_alist v, decl_node__opaque n, decl_nodeProcedure p)
 {
-  mcDebug_assert (decl_isConst (n));
+  mcDebug_assert (decl_isConst (static_cast<decl_node> (n)));
   visitNode (v, n->constF.type, p);
   visitNode (v, n->constF.value, p);
   visitScope (v, n->constF.scope, p);
@@ -18770,9 +18831,9 @@ static void visitConst (alists_alist v, decl_node n, decl_nodeProcedure p)
    visitVarParam -
 */
 
-static void visitVarParam (alists_alist v, decl_node n, decl_nodeProcedure p)
+static void visitVarParam (alists_alist v, decl_node__opaque n, decl_nodeProcedure p)
 {
-  mcDebug_assert (decl_isVarParam (n));
+  mcDebug_assert (decl_isVarParam (static_cast<decl_node> (n)));
   visitNode (v, n->varparamF.namelist, p);
   visitNode (v, n->varparamF.type, p);
   visitScope (v, n->varparamF.scope, p);
@@ -18783,9 +18844,9 @@ static void visitVarParam (alists_alist v, decl_node n, decl_nodeProcedure p)
    visitParam -
 */
 
-static void visitParam (alists_alist v, decl_node n, decl_nodeProcedure p)
+static void visitParam (alists_alist v, decl_node__opaque n, decl_nodeProcedure p)
 {
-  mcDebug_assert (decl_isParam (n));
+  mcDebug_assert (decl_isParam (static_cast<decl_node> (n)));
   visitNode (v, n->paramF.namelist, p);
   visitNode (v, n->paramF.type, p);
   visitScope (v, n->paramF.scope, p);
@@ -18796,9 +18857,9 @@ static void visitParam (alists_alist v, decl_node n, decl_nodeProcedure p)
    visitOptarg -
 */
 
-static void visitOptarg (alists_alist v, decl_node n, decl_nodeProcedure p)
+static void visitOptarg (alists_alist v, decl_node__opaque n, decl_nodeProcedure p)
 {
-  mcDebug_assert (decl_isOptarg (n));
+  mcDebug_assert (decl_isOptarg (static_cast<decl_node> (n)));
   visitNode (v, n->optargF.namelist, p);
   visitNode (v, n->optargF.type, p);
   visitNode (v, n->optargF.init, p);
@@ -18810,9 +18871,9 @@ static void visitOptarg (alists_alist v, decl_node n, decl_nodeProcedure p)
    visitRecordField -
 */
 
-static void visitRecordField (alists_alist v, decl_node n, decl_nodeProcedure p)
+static void visitRecordField (alists_alist v, decl_node__opaque n, decl_nodeProcedure p)
 {
-  mcDebug_assert (decl_isRecordField (n));
+  mcDebug_assert (decl_isRecordField (static_cast<decl_node> (n)));
   visitNode (v, n->recordfieldF.type, p);
   visitNode (v, n->recordfieldF.parent, p);
   visitNode (v, n->recordfieldF.varient, p);
@@ -18824,9 +18885,9 @@ static void visitRecordField (alists_alist v, decl_node n, decl_nodeProcedure p)
    visitVarientField -
 */
 
-static void visitVarientField (alists_alist v, decl_node n, decl_nodeProcedure p)
+static void visitVarientField (alists_alist v, decl_node__opaque n, decl_nodeProcedure p)
 {
-  mcDebug_assert (decl_isVarientField (n));
+  mcDebug_assert (decl_isVarientField (static_cast<decl_node> (n)));
   visitNode (v, n->varientfieldF.parent, p);
   visitNode (v, n->varientfieldF.varient, p);
   visitIndex (v, n->varientfieldF.listOfSons, p);
@@ -18838,9 +18899,9 @@ static void visitVarientField (alists_alist v, decl_node n, decl_nodeProcedure p
    visitEnumerationField -
 */
 
-static void visitEnumerationField (alists_alist v, decl_node n, decl_nodeProcedure p)
+static void visitEnumerationField (alists_alist v, decl_node__opaque n, decl_nodeProcedure p)
 {
-  mcDebug_assert (decl_isEnumerationField (n));
+  mcDebug_assert (decl_isEnumerationField (static_cast<decl_node> (n)));
   visitNode (v, n->enumerationfieldF.type, p);
   visitScope (v, n->enumerationfieldF.scope, p);
 }
@@ -18850,9 +18911,9 @@ static void visitEnumerationField (alists_alist v, decl_node n, decl_nodeProcedu
    visitSet -
 */
 
-static void visitSet (alists_alist v, decl_node n, decl_nodeProcedure p)
+static void visitSet (alists_alist v, decl_node__opaque n, decl_nodeProcedure p)
 {
-  mcDebug_assert (decl_isSet (n));
+  mcDebug_assert (decl_isSet (static_cast<decl_node> (n)));
   visitNode (v, n->setF.type, p);
   visitScope (v, n->setF.scope, p);
 }
@@ -18862,9 +18923,9 @@ static void visitSet (alists_alist v, decl_node n, decl_nodeProcedure p)
    visitProcType -
 */
 
-static void visitProcType (alists_alist v, decl_node n, decl_nodeProcedure p)
+static void visitProcType (alists_alist v, decl_node__opaque n, decl_nodeProcedure p)
 {
-  mcDebug_assert (decl_isProcType (n));
+  mcDebug_assert (decl_isProcType (static_cast<decl_node> (n)));
   visitIndex (v, n->proctypeF.parameters, p);
   visitNode (v, n->proctypeF.optarg_, p);
   visitNode (v, n->proctypeF.returnType, p);
@@ -18876,7 +18937,7 @@ static void visitProcType (alists_alist v, decl_node n, decl_nodeProcedure p)
    visitSubscript -
 */
 
-static void visitSubscript (alists_alist v, decl_node n, decl_nodeProcedure p)
+static void visitSubscript (alists_alist v, decl_node__opaque n, decl_nodeProcedure p)
 {
 }
 
@@ -18898,9 +18959,9 @@ static void visitDecls (alists_alist v, decl_scopeT s, decl_nodeProcedure p)
    visitProcedure -
 */
 
-static void visitProcedure (alists_alist v, decl_node n, decl_nodeProcedure p)
+static void visitProcedure (alists_alist v, decl_node__opaque n, decl_nodeProcedure p)
 {
-  mcDebug_assert (decl_isProcedure (n));
+  mcDebug_assert (decl_isProcedure (static_cast<decl_node> (n)));
   visitDecls (v, n->procedureF.decls, p);
   visitScope (v, n->procedureF.scope, p);
   visitIndex (v, n->procedureF.parameters, p);
@@ -18914,9 +18975,9 @@ static void visitProcedure (alists_alist v, decl_node n, decl_nodeProcedure p)
    visitDef -
 */
 
-static void visitDef (alists_alist v, decl_node n, decl_nodeProcedure p)
+static void visitDef (alists_alist v, decl_node__opaque n, decl_nodeProcedure p)
 {
-  mcDebug_assert (decl_isDef (n));
+  mcDebug_assert (decl_isDef (static_cast<decl_node> (n)));
   visitDecls (v, n->defF.decls, p);
 }
 
@@ -18925,9 +18986,9 @@ static void visitDef (alists_alist v, decl_node n, decl_nodeProcedure p)
    visitImp -
 */
 
-static void visitImp (alists_alist v, decl_node n, decl_nodeProcedure p)
+static void visitImp (alists_alist v, decl_node__opaque n, decl_nodeProcedure p)
 {
-  mcDebug_assert (decl_isImp (n));
+  mcDebug_assert (decl_isImp (static_cast<decl_node> (n)));
   visitDecls (v, n->impF.decls, p);
   visitNode (v, n->impF.beginStatements, p);
   /* --fixme-- do we need to visit definitionModule?  */
@@ -18939,9 +19000,9 @@ static void visitImp (alists_alist v, decl_node n, decl_nodeProcedure p)
    visitModule -
 */
 
-static void visitModule (alists_alist v, decl_node n, decl_nodeProcedure p)
+static void visitModule (alists_alist v, decl_node__opaque n, decl_nodeProcedure p)
 {
-  mcDebug_assert (decl_isModule (n));
+  mcDebug_assert (decl_isModule (static_cast<decl_node> (n)));
   visitDecls (v, n->moduleF.decls, p);
   visitNode (v, n->moduleF.beginStatements, p);
   visitNode (v, n->moduleF.finallyStatements, p);
@@ -18952,9 +19013,9 @@ static void visitModule (alists_alist v, decl_node n, decl_nodeProcedure p)
    visitLoop -
 */
 
-static void visitLoop (alists_alist v, decl_node n, decl_nodeProcedure p)
+static void visitLoop (alists_alist v, decl_node__opaque n, decl_nodeProcedure p)
 {
-  mcDebug_assert (decl_isLoop (n));
+  mcDebug_assert (decl_isLoop (static_cast<decl_node> (n)));
   visitNode (v, n->loopF.statements, p);
 }
 
@@ -18963,9 +19024,9 @@ static void visitLoop (alists_alist v, decl_node n, decl_nodeProcedure p)
    visitWhile -
 */
 
-static void visitWhile (alists_alist v, decl_node n, decl_nodeProcedure p)
+static void visitWhile (alists_alist v, decl_node__opaque n, decl_nodeProcedure p)
 {
-  mcDebug_assert (decl_isWhile (n));
+  mcDebug_assert (decl_isWhile (static_cast<decl_node> (n)));
   visitNode (v, n->whileF.expr, p);
   visitNode (v, n->whileF.statements, p);
 }
@@ -18975,9 +19036,9 @@ static void visitWhile (alists_alist v, decl_node n, decl_nodeProcedure p)
    visitRepeat -
 */
 
-static void visitRepeat (alists_alist v, decl_node n, decl_nodeProcedure p)
+static void visitRepeat (alists_alist v, decl_node__opaque n, decl_nodeProcedure p)
 {
-  mcDebug_assert (decl_isRepeat (n));
+  mcDebug_assert (decl_isRepeat (static_cast<decl_node> (n)));
   visitNode (v, n->repeatF.expr, p);
   visitNode (v, n->repeatF.statements, p);
 }
@@ -18987,9 +19048,9 @@ static void visitRepeat (alists_alist v, decl_node n, decl_nodeProcedure p)
    visitCase -
 */
 
-static void visitCase (alists_alist v, decl_node n, decl_nodeProcedure p)
+static void visitCase (alists_alist v, decl_node__opaque n, decl_nodeProcedure p)
 {
-  mcDebug_assert (decl_isCase (n));
+  mcDebug_assert (decl_isCase (static_cast<decl_node> (n)));
   visitNode (v, n->caseF.expression, p);
   visitIndex (v, n->caseF.caseLabelList, p);
   visitNode (v, n->caseF.else_, p);
@@ -19000,9 +19061,9 @@ static void visitCase (alists_alist v, decl_node n, decl_nodeProcedure p)
    visitCaseLabelList -
 */
 
-static void visitCaseLabelList (alists_alist v, decl_node n, decl_nodeProcedure p)
+static void visitCaseLabelList (alists_alist v, decl_node__opaque n, decl_nodeProcedure p)
 {
-  mcDebug_assert (decl_isCaseLabelList (n));
+  mcDebug_assert (decl_isCaseLabelList (static_cast<decl_node> (n)));
   visitNode (v, n->caselabellistF.caseList, p);
   visitNode (v, n->caselabellistF.statements, p);
 }
@@ -19012,9 +19073,9 @@ static void visitCaseLabelList (alists_alist v, decl_node n, decl_nodeProcedure
    visitCaseList -
 */
 
-static void visitCaseList (alists_alist v, decl_node n, decl_nodeProcedure p)
+static void visitCaseList (alists_alist v, decl_node__opaque n, decl_nodeProcedure p)
 {
-  mcDebug_assert (decl_isCaseList (n));
+  mcDebug_assert (decl_isCaseList (static_cast<decl_node> (n)));
   visitIndex (v, n->caselistF.rangePairs, p);
 }
 
@@ -19023,9 +19084,9 @@ static void visitCaseList (alists_alist v, decl_node n, decl_nodeProcedure p)
    visitRange -
 */
 
-static void visitRange (alists_alist v, decl_node n, decl_nodeProcedure p)
+static void visitRange (alists_alist v, decl_node__opaque n, decl_nodeProcedure p)
 {
-  mcDebug_assert (decl_isRange (n));
+  mcDebug_assert (decl_isRange (static_cast<decl_node> (n)));
   visitNode (v, n->rangeF.lo, p);
   visitNode (v, n->rangeF.hi, p);
 }
@@ -19035,9 +19096,9 @@ static void visitRange (alists_alist v, decl_node n, decl_nodeProcedure p)
    visitIf -
 */
 
-static void visitIf (alists_alist v, decl_node n, decl_nodeProcedure p)
+static void visitIf (alists_alist v, decl_node__opaque n, decl_nodeProcedure p)
 {
-  mcDebug_assert (decl_isIf (n));
+  mcDebug_assert (decl_isIf (static_cast<decl_node> (n)));
   visitNode (v, n->ifF.expr, p);
   visitNode (v, n->ifF.elsif, p);
   visitNode (v, n->ifF.then, p);
@@ -19049,9 +19110,9 @@ static void visitIf (alists_alist v, decl_node n, decl_nodeProcedure p)
    visitElsif -
 */
 
-static void visitElsif (alists_alist v, decl_node n, decl_nodeProcedure p)
+static void visitElsif (alists_alist v, decl_node__opaque n, decl_nodeProcedure p)
 {
-  mcDebug_assert (decl_isElsif (n));
+  mcDebug_assert (decl_isElsif (static_cast<decl_node> (n)));
   visitNode (v, n->elsifF.expr, p);
   visitNode (v, n->elsifF.elsif, p);
   visitNode (v, n->elsifF.then, p);
@@ -19063,9 +19124,9 @@ static void visitElsif (alists_alist v, decl_node n, decl_nodeProcedure p)
    visitFor -
 */
 
-static void visitFor (alists_alist v, decl_node n, decl_nodeProcedure p)
+static void visitFor (alists_alist v, decl_node__opaque n, decl_nodeProcedure p)
 {
-  mcDebug_assert (decl_isFor (n));
+  mcDebug_assert (decl_isFor (static_cast<decl_node> (n)));
   visitNode (v, n->forF.des, p);
   visitNode (v, n->forF.start, p);
   visitNode (v, n->forF.end, p);
@@ -19078,7 +19139,7 @@ static void visitFor (alists_alist v, decl_node n, decl_nodeProcedure p)
    visitAssignment -
 */
 
-static void visitAssignment (alists_alist v, decl_node n, decl_nodeProcedure p)
+static void visitAssignment (alists_alist v, decl_node__opaque n, decl_nodeProcedure p)
 {
   mcDebug_assert (isAssignment (n));
   visitNode (v, n->assignmentF.des, p);
@@ -19090,7 +19151,7 @@ static void visitAssignment (alists_alist v, decl_node n, decl_nodeProcedure p)
    visitComponentRef -
 */
 
-static void visitComponentRef (alists_alist v, decl_node n, decl_nodeProcedure p)
+static void visitComponentRef (alists_alist v, decl_node__opaque n, decl_nodeProcedure p)
 {
   mcDebug_assert (isComponentRef (n));
   visitNode (v, n->componentrefF.rec, p);
@@ -19103,9 +19164,9 @@ static void visitComponentRef (alists_alist v, decl_node n, decl_nodeProcedure p
    visitPointerRef -
 */
 
-static void visitPointerRef (alists_alist v, decl_node n, decl_nodeProcedure p)
+static void visitPointerRef (alists_alist v, decl_node__opaque n, decl_nodeProcedure p)
 {
-  mcDebug_assert (decl_isPointerRef (n));
+  mcDebug_assert (decl_isPointerRef (static_cast<decl_node> (n)));
   visitNode (v, n->pointerrefF.ptr, p);
   visitNode (v, n->pointerrefF.field, p);
   visitNode (v, n->pointerrefF.resultType, p);
@@ -19116,7 +19177,7 @@ static void visitPointerRef (alists_alist v, decl_node n, decl_nodeProcedure p)
    visitArrayRef -
 */
 
-static void visitArrayRef (alists_alist v, decl_node n, decl_nodeProcedure p)
+static void visitArrayRef (alists_alist v, decl_node__opaque n, decl_nodeProcedure p)
 {
   mcDebug_assert (isArrayRef (n));
   visitNode (v, n->arrayrefF.array, p);
@@ -19129,7 +19190,7 @@ static void visitArrayRef (alists_alist v, decl_node n, decl_nodeProcedure p)
    visitFunccall -
 */
 
-static void visitFunccall (alists_alist v, decl_node n, decl_nodeProcedure p)
+static void visitFunccall (alists_alist v, decl_node__opaque n, decl_nodeProcedure p)
 {
   mcDebug_assert (isFuncCall (n));
   visitNode (v, n->funccallF.function, p);
@@ -19142,7 +19203,7 @@ static void visitFunccall (alists_alist v, decl_node n, decl_nodeProcedure p)
    visitVarDecl -
 */
 
-static void visitVarDecl (alists_alist v, decl_node n, decl_nodeProcedure p)
+static void visitVarDecl (alists_alist v, decl_node__opaque n, decl_nodeProcedure p)
 {
   mcDebug_assert (isVarDecl (n));
   visitNode (v, n->vardeclF.type, p);
@@ -19154,9 +19215,9 @@ static void visitVarDecl (alists_alist v, decl_node n, decl_nodeProcedure p)
    visitExplist -
 */
 
-static void visitExplist (alists_alist v, decl_node n, decl_nodeProcedure p)
+static void visitExplist (alists_alist v, decl_node__opaque n, decl_nodeProcedure p)
 {
-  mcDebug_assert (decl_isExpList (n));
+  mcDebug_assert (decl_isExpList (static_cast<decl_node> (n)));
   visitIndex (v, n->explistF.exp, p);
 }
 
@@ -19165,9 +19226,9 @@ static void visitExplist (alists_alist v, decl_node n, decl_nodeProcedure p)
    visitExit -
 */
 
-static void visitExit (alists_alist v, decl_node n, decl_nodeProcedure p)
+static void visitExit (alists_alist v, decl_node__opaque n, decl_nodeProcedure p)
 {
-  mcDebug_assert (decl_isExit (n));
+  mcDebug_assert (decl_isExit (static_cast<decl_node> (n)));
   visitNode (v, n->exitF.loop, p);
 }
 
@@ -19176,9 +19237,9 @@ static void visitExit (alists_alist v, decl_node n, decl_nodeProcedure p)
    visitReturn -
 */
 
-static void visitReturn (alists_alist v, decl_node n, decl_nodeProcedure p)
+static void visitReturn (alists_alist v, decl_node__opaque n, decl_nodeProcedure p)
 {
-  mcDebug_assert (decl_isReturn (n));
+  mcDebug_assert (decl_isReturn (static_cast<decl_node> (n)));
   visitNode (v, n->returnF.exp, p);
 }
 
@@ -19187,9 +19248,9 @@ static void visitReturn (alists_alist v, decl_node n, decl_nodeProcedure p)
    visitStmtSeq -
 */
 
-static void visitStmtSeq (alists_alist v, decl_node n, decl_nodeProcedure p)
+static void visitStmtSeq (alists_alist v, decl_node__opaque n, decl_nodeProcedure p)
 {
-  mcDebug_assert (decl_isStatementSequence (n));
+  mcDebug_assert (decl_isStatementSequence (static_cast<decl_node> (n)));
   visitIndex (v, n->stmtF.statements, p);
 }
 
@@ -19198,9 +19259,9 @@ static void visitStmtSeq (alists_alist v, decl_node n, decl_nodeProcedure p)
    visitVarargs -
 */
 
-static void visitVarargs (alists_alist v, decl_node n, decl_nodeProcedure p)
+static void visitVarargs (alists_alist v, decl_node__opaque n, decl_nodeProcedure p)
 {
-  mcDebug_assert (decl_isVarargs (n));
+  mcDebug_assert (decl_isVarargs (static_cast<decl_node> (n)));
   visitScope (v, n->varargsF.scope, p);
 }
 
@@ -19209,9 +19270,9 @@ static void visitVarargs (alists_alist v, decl_node n, decl_nodeProcedure p)
    visitSetValue -
 */
 
-static void visitSetValue (alists_alist v, decl_node n, decl_nodeProcedure p)
+static void visitSetValue (alists_alist v, decl_node__opaque n, decl_nodeProcedure p)
 {
-  mcDebug_assert (decl_isSetValue (n));
+  mcDebug_assert (decl_isSetValue (static_cast<decl_node> (n)));
   visitNode (v, n->setvalueF.type, p);
   visitIndex (v, n->setvalueF.values, p);
 }
@@ -19221,7 +19282,7 @@ static void visitSetValue (alists_alist v, decl_node n, decl_nodeProcedure p)
    visitIntrinsic -
 */
 
-static void visitIntrinsic (alists_alist v, decl_node n, decl_nodeProcedure p)
+static void visitIntrinsic (alists_alist v, decl_node__opaque n, decl_nodeProcedure p)
 {
   mcDebug_assert (isIntrinsic (n));
   visitNode (v, n->intrinsicF.args, p);
@@ -19234,7 +19295,7 @@ static void visitIntrinsic (alists_alist v, decl_node n, decl_nodeProcedure p)
                      visit node, n, dependants.
 */
 
-static void visitDependants (alists_alist v, decl_node n, decl_nodeProcedure p)
+static void visitDependants (alists_alist v, decl_node__opaque n, decl_nodeProcedure p)
 {
   mcDebug_assert (n != NULL);
   mcDebug_assert (alists_isItemInList (v, reinterpret_cast<void *> (n)));
@@ -19588,7 +19649,7 @@ static void visitDependants (alists_alist v, decl_node n, decl_nodeProcedure p)
                It calls p(n) if the node is unvisited.
 */
 
-static void visitNode (alists_alist v, decl_node n, decl_nodeProcedure p)
+static void visitNode (alists_alist v, decl_node__opaque n, decl_nodeProcedure p)
 {
   if ((n != NULL) && (! (alists_isItemInList (v, reinterpret_cast<void *> (n)))))
     {
@@ -19603,7 +19664,7 @@ static void visitNode (alists_alist v, decl_node n, decl_nodeProcedure p)
    genKind - returns a string depending upon the kind of node, n.
 */
 
-static DynamicStrings_String genKind (decl_node n)
+static DynamicStrings_String genKind (decl_node__opaque n)
 {
   switch (n->kind)
     {
@@ -19635,7 +19696,7 @@ static DynamicStrings_String genKind (decl_node n)
       case decl_longcomplex:
       case decl_shortcomplex:
         /* types, no need to generate a kind string as it it contained in the name.  */
-        return NULL;
+        return static_cast<DynamicStrings_String> (NULL);
         break;
 
       case decl_type:
@@ -19938,7 +19999,7 @@ static DynamicStrings_String genKind (decl_node n)
    gen - generate a small string describing node, n.
 */
 
-static DynamicStrings_String gen (decl_node n)
+static DynamicStrings_String gen (decl_node__opaque n)
 {
   DynamicStrings_String s;
   unsigned int d;
@@ -19962,7 +20023,7 @@ static DynamicStrings_String gen (decl_node n)
 static void dumpQ (const char *q_, unsigned int _q_high, alists_alist l)
 {
   DynamicStrings_String m;
-  decl_node n;
+  decl_node__opaque n;
   unsigned int d;
   unsigned int h;
   unsigned int i;
@@ -19981,7 +20042,7 @@ static void dumpQ (const char *q_, unsigned int _q_high, alists_alist l)
   h = alists_noOfItemsInList (l);
   while (i <= h)
     {
-      n = static_cast<decl_node> (alists_getItemFromList (l, i));
+      n = static_cast<decl_node__opaque> (alists_getItemFromList (l, i));
       m = DynamicStrings_KillString (SFIO_WriteS (FIO_StdOut, gen (n)));
       i += 1;
     }
@@ -19996,12 +20057,8 @@ static void dumpQ (const char *q_, unsigned int _q_high, alists_alist l)
 
 static void dumpLists (void)
 {
-  DynamicStrings_String m;
-
-  if (mcOptions_getDebugTopological ())
+  if ((mcOptions_getDebugTopological ()) && false)
     {
-      m = FormatStrings_Sprintf0 (DynamicStrings_InitString ((const char *) "\\n", 2));
-      m = DynamicStrings_KillString (SFIO_WriteS (FIO_StdOut, m));
       dumpQ ((const char *) "todo", 4, globalGroup->todoQ);
       dumpQ ((const char *) "partial", 7, globalGroup->partialQ);
       dumpQ ((const char *) "done", 4, globalGroup->doneQ);
@@ -20013,7 +20070,7 @@ static void dumpLists (void)
    outputHidden -
 */
 
-static void outputHidden (decl_node n)
+static void outputHidden (decl_node__opaque n)
 {
   outText (doP, (const char *) "#if !defined (", 14);
   doFQNameC (doP, n);
@@ -20032,18 +20089,18 @@ static void outputHidden (decl_node n)
    outputHiddenComplete -
 */
 
-static void outputHiddenComplete (decl_node n)
+static void outputHiddenComplete (decl_node__opaque n)
 {
-  decl_node t;
+  decl_node__opaque t;
 
-  mcDebug_assert (decl_isType (n));
-  t = decl_getType (n);
-  mcDebug_assert (decl_isPointer (t));
+  mcDebug_assert (decl_isType (static_cast<decl_node> (n)));
+  t = static_cast<decl_node__opaque> (decl_getType (static_cast<decl_node> (n)));
+  mcDebug_assert (decl_isPointer (static_cast<decl_node> (t)));
   outText (doP, (const char *) "#define ", 8);
   doFQNameC (doP, n);
   outText (doP, (const char *) "_D\\n", 4);
   outText (doP, (const char *) "typedef ", 8);
-  doTypeNameC (doP, decl_getType (t));
+  doTypeNameC (doP, static_cast<decl_node__opaque> (decl_getType (static_cast<decl_node> (t))));
   mcPretty_setNeedSpace (doP);
   outText (doP, (const char *) "*", 1);
   doFQNameC (doP, n);
@@ -20055,27 +20112,27 @@ static void outputHiddenComplete (decl_node n)
    tryPartial -
 */
 
-static bool tryPartial (decl_node n, decl_nodeProcedure pt)
+static bool tryPartial (decl_node__opaque n, decl_nodeProcedure pt)
 {
-  decl_node q;
+  decl_node__opaque q;
 
-  if ((n != NULL) && (decl_isType (n)))
+  if ((n != NULL) && (decl_isType (static_cast<decl_node> (n))))
     {
-      q = decl_getType (n);
-      while (decl_isPointer (q))
+      q = static_cast<decl_node__opaque> (decl_getType (static_cast<decl_node> (n)));
+      while (decl_isPointer (static_cast<decl_node> (q)))
         {
-          q = decl_getType (q);
+          q = static_cast<decl_node__opaque> (decl_getType (static_cast<decl_node> (q)));
         }
       if (q != NULL)
         {
           /* avoid gcc warning by using compound statement even if not strictly necessary.  */
-          if ((decl_isRecord (q)) || (decl_isProcType (q)))
+          if ((decl_isRecord (static_cast<decl_node> (q))) || (decl_isProcType (static_cast<decl_node> (q))))
             {
               (*pt.proc) (n);
               addTodo (q);
               return true;
             }
-          else if (decl_isArray (q))
+          else if (decl_isArray (static_cast<decl_node> (q)))
             {
               /* avoid dangling else.  */
               (*pt.proc) (n);
@@ -20094,23 +20151,23 @@ static bool tryPartial (decl_node n, decl_nodeProcedure pt)
    outputPartialRecordArrayProcType -
 */
 
-static void outputPartialRecordArrayProcType (decl_node n, decl_node q, unsigned int indirection)
+static void outputPartialRecordArrayProcType (decl_node__opaque n, decl_node__opaque q, unsigned int indirection)
 {
   DynamicStrings_String s;
 
   outText (doP, (const char *) "typedef struct", 14);
   mcPretty_setNeedSpace (doP);
   s = getFQstring (n);
-  if (decl_isRecord (q))
+  if (decl_isRecord (static_cast<decl_node> (q)))
     {
       s = DynamicStrings_ConCat (s, DynamicStrings_Mark (DynamicStrings_InitString ((const char *) "_r", 2)));
     }
-  else if (decl_isArray (q))
+  else if (decl_isArray (static_cast<decl_node> (q)))
     {
       /* avoid dangling else.  */
       s = DynamicStrings_ConCat (s, DynamicStrings_Mark (DynamicStrings_InitString ((const char *) "_a", 2)));
     }
-  else if (decl_isProcType (q))
+  else if (decl_isProcType (static_cast<decl_node> (q)))
     {
       /* avoid dangling else.  */
       s = DynamicStrings_ConCat (s, DynamicStrings_Mark (DynamicStrings_InitString ((const char *) "_p", 2)));
@@ -20132,16 +20189,16 @@ static void outputPartialRecordArrayProcType (decl_node n, decl_node q, unsigned
    outputPartial -
 */
 
-static void outputPartial (decl_node n)
+static void outputPartial (decl_node__opaque n)
 {
-  decl_node q;
+  decl_node__opaque q;
   unsigned int indirection;
 
-  q = decl_getType (n);
+  q = static_cast<decl_node__opaque> (decl_getType (static_cast<decl_node> (n)));
   indirection = 0;
-  while (decl_isPointer (q))
+  while (decl_isPointer (static_cast<decl_node> (q)))
     {
-      q = decl_getType (q);
+      q = static_cast<decl_node__opaque> (decl_getType (static_cast<decl_node> (q)));
       indirection += 1;
     }
   outputPartialRecordArrayProcType (n, q, indirection);
@@ -20156,17 +20213,17 @@ static void tryOutputTodo (decl_nodeProcedure c, decl_nodeProcedure t, decl_node
 {
   unsigned int i;
   unsigned int n;
-  decl_node d;
+  decl_node__opaque d;
 
   i = 1;
   n = alists_noOfItemsInList (globalGroup->todoQ);
   while (i <= n)
     {
-      d = static_cast<decl_node> (alists_getItemFromList (globalGroup->todoQ, i));
+      d = static_cast<decl_node__opaque> (alists_getItemFromList (globalGroup->todoQ, i));
       if (tryComplete (d, c, t, v))
         {
           alists_removeItemFromList (globalGroup->todoQ, reinterpret_cast<void *> (d));
-          alists_includeItemIntoList (globalGroup->doneQ, reinterpret_cast<void *> (d));
+          addDone (d);
           i = 1;
         }
       else if (tryPartial (d, pt))
@@ -20194,17 +20251,17 @@ static void tryOutputPartial (decl_nodeProcedure t)
 {
   unsigned int i;
   unsigned int n;
-  decl_node d;
+  decl_node__opaque d;
 
   i = 1;
   n = alists_noOfItemsInList (globalGroup->partialQ);
   while (i <= n)
     {
-      d = static_cast<decl_node> (alists_getItemFromList (globalGroup->partialQ, i));
+      d = static_cast<decl_node__opaque> (alists_getItemFromList (globalGroup->partialQ, i));
       if (tryCompleteFromPartial (d, t))
         {
           alists_removeItemFromList (globalGroup->partialQ, reinterpret_cast<void *> (d));
-          alists_includeItemIntoList (globalGroup->doneQ, reinterpret_cast<void *> (d));
+          addDone (d);
           i = 1;
           n -= 1;
         }
@@ -20220,25 +20277,25 @@ static void tryOutputPartial (decl_nodeProcedure t)
    debugList -
 */
 
-static void debugList (const char *a_, unsigned int _a_high, alists_alist l)
+static void debugList (const char *listName_, unsigned int _listName_high, const char *symName_, unsigned int _symName_high, alists_alist l)
 {
   unsigned int i;
   unsigned int h;
-  decl_node n;
-  char a[_a_high+1];
+  decl_node__opaque n;
+  char listName[_listName_high+1];
+  char symName[_symName_high+1];
 
   /* make a local copy of each unbounded array.  */
-  memcpy (a, a_, _a_high+1);
+  memcpy (listName, listName_, _listName_high+1);
+  memcpy (symName, symName_, _symName_high+1);
 
   h = alists_noOfItemsInList (l);
   if (h > 0)
     {
-      outText (doP, (const char *) a, _a_high);
-      outText (doP, (const char *) " still contains node(s)\\n", 25);
       i = 1;
       do {
-        n = static_cast<decl_node> (alists_getItemFromList (l, i));
-        dbg (n);
+        n = static_cast<decl_node__opaque> (alists_getItemFromList (l, i));
+        dbg ((const char *) listName, _listName_high, (const char *) symName, _symName_high, n);
         i += 1;
       } while (! (i > h));
     }
@@ -20253,8 +20310,9 @@ static void debugLists (void)
 {
   if (mcOptions_getDebugTopological ())
     {
-      debugList ((const char *) "todo", 4, globalGroup->todoQ);
-      debugList ((const char *) "partial", 7, globalGroup->partialQ);
+      debugList ((const char *) "todo", 4, (const char *) "decl_node", 9, globalGroup->todoQ);
+      debugList ((const char *) "partial", 7, (const char *) "decl_node", 9, globalGroup->partialQ);
+      debugList ((const char *) "done", 4, (const char *) "decl_node", 9, globalGroup->doneQ);
     }
 }
 
@@ -20263,11 +20321,11 @@ static void debugLists (void)
    addEnumConst -
 */
 
-static void addEnumConst (decl_node n)
+static void addEnumConst (decl_node__opaque n)
 {
   DynamicStrings_String s;
 
-  if ((decl_isConst (n)) || (decl_isEnumeration (n)))
+  if ((decl_isConst (static_cast<decl_node> (n))) || (decl_isEnumeration (static_cast<decl_node> (n))))
     {
       addTodo (n);
     }
@@ -20280,7 +20338,7 @@ static void addEnumConst (decl_node n)
 
 static void populateTodo (decl_nodeProcedure p)
 {
-  decl_node n;
+  decl_node__opaque n;
   unsigned int i;
   unsigned int h;
   alists_alist l;
@@ -20289,7 +20347,7 @@ static void populateTodo (decl_nodeProcedure p)
   i = 1;
   while (i <= h)
     {
-      n = static_cast<decl_node> (alists_getItemFromList (globalGroup->todoQ, i));
+      n = static_cast<decl_node__opaque> (alists_getItemFromList (globalGroup->todoQ, i));
       l = alists_initList ();
       visitNode (l, n, p);
       alists_killList (&l);
@@ -20327,7 +20385,7 @@ static void topologicallyOut (decl_nodeProcedure c, decl_nodeProcedure t, decl_n
    scaffoldStatic -
 */
 
-static void scaffoldStatic (mcPretty_pretty p, decl_node n)
+static void scaffoldStatic (mcPretty_pretty p, decl_node__opaque n)
 {
   outText (p, (const char *) "\\n", 2);
   doExternCP (p);
@@ -20337,9 +20395,11 @@ static void scaffoldStatic (mcPretty_pretty p, decl_node n)
   doFQNameC (p, n);
   outText (p, (const char *) "_init", 5);
   mcPretty_setNeedSpace (p);
-  outText (p, (const char *) "(__attribute__((unused)) int argc", 33);
-  outText (p, (const char *) ",__attribute__((unused)) char *argv[]", 37);
-  outText (p, (const char *) ",__attribute__((unused)) char *envp[])\\n", 40);
+  outText (p, (const char *) "(__attribute__((unused)) int argc,", 34);
+  mcPretty_setNeedSpace (p);
+  outText (p, (const char *) "__attribute__((unused)) char *argv[],", 37);
+  mcPretty_setNeedSpace (p);
+  outText (p, (const char *) "__attribute__((unused)) char *envp[])\\n", 39);
   p = outKc (p, (const char *) "{\\n", 3);
   doStatementsC (p, n->impF.beginStatements);
   p = outKc (p, (const char *) "}\\n", 3);
@@ -20351,9 +20411,11 @@ static void scaffoldStatic (mcPretty_pretty p, decl_node n)
   doFQNameC (p, n);
   outText (p, (const char *) "_fini", 5);
   mcPretty_setNeedSpace (p);
-  outText (p, (const char *) "(__attribute__((unused)) int argc", 33);
-  outText (p, (const char *) ",__attribute__((unused)) char *argv[]", 37);
-  outText (p, (const char *) ",__attribute__((unused)) char *envp[])\\n", 40);
+  outText (p, (const char *) "(__attribute__((unused)) int argc,", 34);
+  mcPretty_setNeedSpace (p);
+  outText (p, (const char *) "__attribute__((unused)) char *argv[],", 37);
+  mcPretty_setNeedSpace (p);
+  outText (p, (const char *) "__attribute__((unused)) char *envp[])\\n", 39);
   p = outKc (p, (const char *) "{\\n", 3);
   doStatementsC (p, n->impF.finallyStatements);
   p = outKc (p, (const char *) "}\\n", 3);
@@ -20364,7 +20426,7 @@ static void scaffoldStatic (mcPretty_pretty p, decl_node n)
    emitCtor -
 */
 
-static void emitCtor (mcPretty_pretty p, decl_node n)
+static void emitCtor (mcPretty_pretty p, decl_node__opaque n)
 {
   DynamicStrings_String s;
 
@@ -20375,7 +20437,7 @@ static void emitCtor (mcPretty_pretty p, decl_node n)
   doFQNameC (p, n);
   p = outKc (p, (const char *) "{\\n", 3);
   outText (p, (const char *) "M2RTS_RegisterModule (\"", 23);
-  s = DynamicStrings_InitStringCharStar (nameKey_keyToCharStar (decl_getSymName (n)));
+  s = DynamicStrings_InitStringCharStar (nameKey_keyToCharStar (decl_getSymName (static_cast<decl_node> (n))));
   mcPretty_prints (p, s);
   outText (p, (const char *) "\",\\n", 4);
   outText (p, (const char *) "init, fini, dependencies);\\n", 28);
@@ -20412,7 +20474,7 @@ static void emitCtor (mcPretty_pretty p, decl_node n)
    scaffoldDynamic -
 */
 
-static void scaffoldDynamic (mcPretty_pretty p, decl_node n)
+static void scaffoldDynamic (mcPretty_pretty p, decl_node__opaque n)
 {
   outText (p, (const char *) "\\n", 2);
   doExternCP (p);
@@ -20423,8 +20485,10 @@ static void scaffoldDynamic (mcPretty_pretty p, decl_node n)
   outText (p, (const char *) "_init", 5);
   mcPretty_setNeedSpace (p);
   outText (p, (const char *) "(__attribute__((unused)) int argc,", 34);
-  outText (p, (const char *) " __attribute__((unused)) char *argv[]", 37);
-  outText (p, (const char *) " __attribute__((unused)) char *envp[])\\n", 40);
+  mcPretty_setNeedSpace (p);
+  outText (p, (const char *) "__attribute__((unused)) char *argv[],", 37);
+  mcPretty_setNeedSpace (p);
+  outText (p, (const char *) "__attribute__((unused)) char *envp[])\\n", 39);
   p = outKc (p, (const char *) "{\\n", 3);
   doStatementsC (p, n->impF.beginStatements);
   p = outKc (p, (const char *) "}\\n", 3);
@@ -20437,8 +20501,10 @@ static void scaffoldDynamic (mcPretty_pretty p, decl_node n)
   outText (p, (const char *) "_fini", 5);
   mcPretty_setNeedSpace (p);
   outText (p, (const char *) "(__attribute__((unused)) int argc,", 34);
-  outText (p, (const char *) " __attribute__((unused)) char *argv[]", 37);
-  outText (p, (const char *) " __attribute__((unused)) char *envp[])\\n", 40);
+  mcPretty_setNeedSpace (p);
+  outText (p, (const char *) "__attribute__((unused)) char *argv[],", 37);
+  mcPretty_setNeedSpace (p);
+  outText (p, (const char *) "__attribute__((unused)) char *envp[])\\n", 39);
   p = outKc (p, (const char *) "{\\n", 3);
   doStatementsC (p, n->impF.finallyStatements);
   p = outKc (p, (const char *) "}\\n", 3);
@@ -20450,7 +20516,7 @@ static void scaffoldDynamic (mcPretty_pretty p, decl_node n)
    scaffoldMain -
 */
 
-static void scaffoldMain (mcPretty_pretty p, decl_node n)
+static void scaffoldMain (mcPretty_pretty p, decl_node__opaque n)
 {
   DynamicStrings_String s;
 
@@ -20460,7 +20526,7 @@ static void scaffoldMain (mcPretty_pretty p, decl_node n)
   outText (p, (const char *) "(int argc, char *argv[], char *envp[])\\n", 40);
   p = outKc (p, (const char *) "{\\n", 3);
   outText (p, (const char *) "M2RTS_ConstructModules (", 24);
-  s = DynamicStrings_InitStringCharStar (nameKey_keyToCharStar (decl_getSymName (n)));
+  s = DynamicStrings_InitStringCharStar (nameKey_keyToCharStar (decl_getSymName (static_cast<decl_node> (n))));
   mcPretty_prints (p, s);
   outText (p, (const char *) ", argc, argv, envp);\\n", 22);
   outText (p, (const char *) "M2RTS_DeconstructModules (", 26);
@@ -20476,7 +20542,7 @@ static void scaffoldMain (mcPretty_pretty p, decl_node n)
    outImpInitC - emit the init/fini functions and main function if required.
 */
 
-static void outImpInitC (mcPretty_pretty p, decl_node n)
+static void outImpInitC (mcPretty_pretty p, decl_node__opaque n)
 {
   if (mcOptions_getScaffoldDynamic ())
     {
@@ -20497,18 +20563,18 @@ static void outImpInitC (mcPretty_pretty p, decl_node n)
    runSimplifyTypes -
 */
 
-static void runSimplifyTypes (decl_node n)
+static void runSimplifyTypes (decl_node__opaque n)
 {
-  if (decl_isImp (n))
+  if (decl_isImp (static_cast<decl_node> (n)))
     {
       simplifyTypes (n->impF.decls);
     }
-  else if (decl_isModule (n))
+  else if (decl_isModule (static_cast<decl_node> (n)))
     {
       /* avoid dangling else.  */
       simplifyTypes (n->moduleF.decls);
     }
-  else if (decl_isDef (n))
+  else if (decl_isDef (static_cast<decl_node> (n)))
     {
       /* avoid dangling else.  */
       simplifyTypes (n->defF.decls);
@@ -20520,13 +20586,13 @@ static void runSimplifyTypes (decl_node n)
    outDefC -
 */
 
-static void outDefC (mcPretty_pretty p, decl_node n)
+static void outDefC (mcPretty_pretty p, decl_node__opaque n)
 {
   DynamicStrings_String s;
 
-  mcDebug_assert (decl_isDef (n));
+  mcDebug_assert (decl_isDef (static_cast<decl_node> (n)));
   outputFile = mcStream_openFrag (1);  /* first fragment.  */
-  s = DynamicStrings_InitStringCharStar (nameKey_keyToCharStar (decl_getSymName (n)));  /* first fragment.  */
+  s = DynamicStrings_InitStringCharStar (nameKey_keyToCharStar (decl_getSymName (static_cast<decl_node> (n))));  /* first fragment.  */
   mcPretty_print (p, (const char *) "/* do not edit automatically generated by mc from ", 50);
   mcPretty_prints (p, s);
   mcPretty_print (p, (const char *) ".  */\\n", 7);
@@ -20571,14 +20637,14 @@ static void outDefC (mcPretty_pretty p, decl_node n)
    runPrototypeExported -
 */
 
-static void runPrototypeExported (decl_node n)
+static void runPrototypeExported (decl_node__opaque n)
 {
-  if (decl_isExported (n))
+  if (decl_isExported (static_cast<decl_node> (n)))
     {
-      keyc_enterScope (n);
+      keyc_enterScope (static_cast<decl_node> (n));
       doProcedureHeadingC (n, true);
       mcPretty_print (doP, (const char *) ";\\n", 3);
-      keyc_leaveScope (n);
+      keyc_leaveScope (static_cast<decl_node> (n));
     }
 }
 
@@ -20587,9 +20653,9 @@ static void runPrototypeExported (decl_node n)
    runPrototypeDefC -
 */
 
-static void runPrototypeDefC (decl_node n)
+static void runPrototypeDefC (decl_node__opaque n)
 {
-  if (decl_isDef (n))
+  if (decl_isDef (static_cast<decl_node> (n)))
     {
       Indexing_ForeachIndiceInIndexDo (n->defF.decls.procedures, (Indexing_IndexProcedure) {(Indexing_IndexProcedure_t) runPrototypeExported});
     }
@@ -20600,14 +20666,14 @@ static void runPrototypeDefC (decl_node n)
    outImpC -
 */
 
-static void outImpC (mcPretty_pretty p, decl_node n)
+static void outImpC (mcPretty_pretty p, decl_node__opaque n)
 {
   DynamicStrings_String s;
-  decl_node defModule;
+  decl_node__opaque defModule;
 
-  mcDebug_assert (decl_isImp (n));
+  mcDebug_assert (decl_isImp (static_cast<decl_node> (n)));
   outputFile = mcStream_openFrag (1);  /* first fragment.  */
-  s = DynamicStrings_InitStringCharStar (nameKey_keyToCharStar (decl_getSymName (n)));  /* first fragment.  */
+  s = DynamicStrings_InitStringCharStar (nameKey_keyToCharStar (decl_getSymName (static_cast<decl_node> (n))));  /* first fragment.  */
   mcPretty_print (p, (const char *) "/* do not edit automatically generated by mc from ", 50);
   mcPretty_prints (p, s);
   mcPretty_print (p, (const char *) ".  */\\n", 7);
@@ -20629,14 +20695,16 @@ static void outImpC (mcPretty_pretty p, decl_node n)
     }
   else
     {
-      s = DynamicStrings_InitStringCharStar (nameKey_keyToCharStar (decl_getSymName (n)));
-      /* we don't want to include the .h file for this implementation module.  */
-      mcPretty_print (p, (const char *) "#define _", 9);
-      mcPretty_prints (p, s);
-      mcPretty_print (p, (const char *) "_H\\n", 4);
+      s = DynamicStrings_InitStringCharStar (nameKey_keyToCharStar (decl_getSymName (static_cast<decl_node> (n))));
+      /* Inform the source that this code belongs to the implementation module.  */
       mcPretty_print (p, (const char *) "#define _", 9);
       mcPretty_prints (p, s);
       mcPretty_print (p, (const char *) "_C\\n\\n", 6);
+      /* Include the definition module for any opaque types.  */
+      mcPretty_print (doP, (const char *) "#include \"", 10);
+      mcPretty_prints (p, mcOptions_getHPrefix ());
+      mcPretty_prints (p, s);
+      mcPretty_print (p, (const char *) ".h\"\\n", 5);
       s = DynamicStrings_KillString (s);
       doP = p;
       Indexing_ForeachIndiceInIndexDo (n->impF.importedModules, (Indexing_IndexProcedure) {(Indexing_IndexProcedure_t) doIncludeC});
@@ -20644,7 +20712,7 @@ static void outImpC (mcPretty_pretty p, decl_node n)
       includeDefConstType (n);
       includeDefVarProcedure (n);
       outDeclsImpC (p, n->impF.decls);
-      defModule = decl_lookupDef (decl_getSymName (n));
+      defModule = static_cast<decl_node__opaque> (decl_lookupDef (decl_getSymName (static_cast<decl_node> (n))));
       if (defModule != NULL)
         {
           runPrototypeDefC (defModule);
@@ -20680,7 +20748,7 @@ static void outDeclsModuleC (mcPretty_pretty p, decl_scopeT s)
    outModuleInitC -
 */
 
-static void outModuleInitC (mcPretty_pretty p, decl_node n)
+static void outModuleInitC (mcPretty_pretty p, decl_node__opaque n)
 {
   outText (p, (const char *) "\\n", 2);
   doExternCP (p);
@@ -20717,13 +20785,13 @@ static void outModuleInitC (mcPretty_pretty p, decl_node n)
    outModuleC -
 */
 
-static void outModuleC (mcPretty_pretty p, decl_node n)
+static void outModuleC (mcPretty_pretty p, decl_node__opaque n)
 {
   DynamicStrings_String s;
 
-  mcDebug_assert (decl_isModule (n));
+  mcDebug_assert (decl_isModule (static_cast<decl_node> (n)));
   outputFile = mcStream_openFrag (1);  /* first fragment.  */
-  s = DynamicStrings_InitStringCharStar (nameKey_keyToCharStar (decl_getSymName (n)));  /* first fragment.  */
+  s = DynamicStrings_InitStringCharStar (nameKey_keyToCharStar (decl_getSymName (static_cast<decl_node> (n))));  /* first fragment.  */
   mcPretty_print (p, (const char *) "/* do not edit automatically generated by mc from ", 50);
   mcPretty_prints (p, s);
   mcPretty_print (p, (const char *) ".  */\\n", 7);
@@ -20761,19 +20829,19 @@ static void outModuleC (mcPretty_pretty p, decl_node n)
    outC -
 */
 
-static void outC (mcPretty_pretty p, decl_node n)
+static void outC (mcPretty_pretty p, decl_node__opaque n)
 {
-  keyc_enterScope (n);
-  if (decl_isDef (n))
+  keyc_enterScope (static_cast<decl_node> (n));
+  if (decl_isDef (static_cast<decl_node> (n)))
     {
       outDefC (p, n);
     }
-  else if (decl_isImp (n))
+  else if (decl_isImp (static_cast<decl_node> (n)))
     {
       /* avoid dangling else.  */
       outImpC (p, n);
     }
-  else if (decl_isModule (n))
+  else if (decl_isModule (static_cast<decl_node> (n)))
     {
       /* avoid dangling else.  */
       outModuleC (p, n);
@@ -20784,7 +20852,7 @@ static void outC (mcPretty_pretty p, decl_node n)
       M2RTS_HALT (-1);
       __builtin_unreachable ();
     }
-  keyc_leaveScope (n);
+  keyc_leaveScope (static_cast<decl_node> (n));
 }
 
 
@@ -20792,25 +20860,25 @@ static void outC (mcPretty_pretty p, decl_node n)
    doIncludeM2 - include modules in module, n.
 */
 
-static void doIncludeM2 (decl_node n)
+static void doIncludeM2 (decl_node__opaque n)
 {
   DynamicStrings_String s;
 
-  s = DynamicStrings_InitStringCharStar (nameKey_keyToCharStar (decl_getSymName (n)));
+  s = DynamicStrings_InitStringCharStar (nameKey_keyToCharStar (decl_getSymName (static_cast<decl_node> (n))));
   mcPretty_print (doP, (const char *) "IMPORT ", 7);
   mcPretty_prints (doP, s);
   mcPretty_print (doP, (const char *) " ;\\n", 4);
   s = DynamicStrings_KillString (s);
-  if (decl_isDef (n))
+  if (decl_isDef (static_cast<decl_node> (n)))
     {
       symbolKey_foreachNodeDo (n->defF.decls.symbols, (symbolKey_performOperation) {(symbolKey_performOperation_t) addDone});
     }
-  else if (decl_isImp (n))
+  else if (decl_isImp (static_cast<decl_node> (n)))
     {
       /* avoid dangling else.  */
       symbolKey_foreachNodeDo (n->impF.decls.symbols, (symbolKey_performOperation) {(symbolKey_performOperation_t) addDone});
     }
-  else if (decl_isModule (n))
+  else if (decl_isModule (static_cast<decl_node> (n)))
     {
       /* avoid dangling else.  */
       symbolKey_foreachNodeDo (n->moduleF.decls.symbols, (symbolKey_performOperation) {(symbolKey_performOperation_t) addDone});
@@ -20822,7 +20890,7 @@ static void doIncludeM2 (decl_node n)
    doConstM2 -
 */
 
-static void doConstM2 (decl_node n)
+static void doConstM2 (decl_node__opaque n)
 {
   mcPretty_print (doP, (const char *) "CONST\\n", 7);
   doFQNameC (doP, n);
@@ -20836,7 +20904,7 @@ static void doConstM2 (decl_node n)
    doProcTypeM2 -
 */
 
-static void doProcTypeM2 (mcPretty_pretty p, decl_node n)
+static void doProcTypeM2 (mcPretty_pretty p, decl_node__opaque n)
 {
   outText (p, (const char *) "proc type to do..", 17);
 }
@@ -20846,12 +20914,12 @@ static void doProcTypeM2 (mcPretty_pretty p, decl_node n)
    doRecordFieldM2 -
 */
 
-static void doRecordFieldM2 (mcPretty_pretty p, decl_node f)
+static void doRecordFieldM2 (mcPretty_pretty p, decl_node__opaque f)
 {
   doNameM2 (p, f);
   outText (p, (const char *) ":", 1);
   mcPretty_setNeedSpace (p);
-  doTypeM2 (p, decl_getType (f));
+  doTypeM2 (p, static_cast<decl_node__opaque> (decl_getType (static_cast<decl_node> (f))));
   mcPretty_setNeedSpace (p);
 }
 
@@ -20860,13 +20928,13 @@ static void doRecordFieldM2 (mcPretty_pretty p, decl_node f)
    doVarientFieldM2 -
 */
 
-static void doVarientFieldM2 (mcPretty_pretty p, decl_node n)
+static void doVarientFieldM2 (mcPretty_pretty p, decl_node__opaque n)
 {
   unsigned int i;
   unsigned int t;
-  decl_node q;
+  decl_node__opaque q;
 
-  mcDebug_assert (decl_isVarientField (n));
+  mcDebug_assert (decl_isVarientField (static_cast<decl_node> (n)));
   doNameM2 (p, n);
   outText (p, (const char *) ":", 1);
   mcPretty_setNeedSpace (p);
@@ -20874,13 +20942,13 @@ static void doVarientFieldM2 (mcPretty_pretty p, decl_node n)
   t = Indexing_HighIndice (n->varientfieldF.listOfSons);
   while (i <= t)
     {
-      q = static_cast<decl_node> (Indexing_GetIndice (n->varientfieldF.listOfSons, i));
-      if (decl_isRecordField (q))
+      q = static_cast<decl_node__opaque> (Indexing_GetIndice (n->varientfieldF.listOfSons, i));
+      if (decl_isRecordField (static_cast<decl_node> (q)))
         {
           doRecordFieldM2 (p, q);
           outText (p, (const char *) ";\\n", 3);
         }
-      else if (decl_isVarient (q))
+      else if (decl_isVarient (static_cast<decl_node> (q)))
         {
           /* avoid dangling else.  */
           doVarientM2 (p, q);
@@ -20901,23 +20969,23 @@ static void doVarientFieldM2 (mcPretty_pretty p, decl_node n)
    doVarientM2 -
 */
 
-static void doVarientM2 (mcPretty_pretty p, decl_node n)
+static void doVarientM2 (mcPretty_pretty p, decl_node__opaque n)
 {
   unsigned int i;
   unsigned int t;
-  decl_node q;
+  decl_node__opaque q;
 
-  mcDebug_assert (decl_isVarient (n));
+  mcDebug_assert (decl_isVarient (static_cast<decl_node> (n)));
   outText (p, (const char *) "CASE", 4);
   mcPretty_setNeedSpace (p);
   if (n->varientF.tag != NULL)
     {
       /* avoid gcc warning by using compound statement even if not strictly necessary.  */
-      if (decl_isRecordField (n->varientF.tag))
+      if (decl_isRecordField (static_cast<decl_node> (n->varientF.tag)))
         {
           doRecordFieldM2 (p, n->varientF.tag);
         }
-      else if (decl_isVarientField (n->varientF.tag))
+      else if (decl_isVarientField (static_cast<decl_node> (n->varientF.tag)))
         {
           /* avoid dangling else.  */
           doVarientFieldM2 (p, n->varientF.tag);
@@ -20935,8 +21003,8 @@ static void doVarientM2 (mcPretty_pretty p, decl_node n)
   t = Indexing_HighIndice (n->varientF.listOfSons);
   while (i <= t)
     {
-      q = static_cast<decl_node> (Indexing_GetIndice (n->varientF.listOfSons, i));
-      if (decl_isRecordField (q))
+      q = static_cast<decl_node__opaque> (Indexing_GetIndice (n->varientF.listOfSons, i));
+      if (decl_isRecordField (static_cast<decl_node> (q)))
         {
           /* avoid dangling else.  */
           if (! q->recordfieldF.tag)
@@ -20945,7 +21013,7 @@ static void doVarientM2 (mcPretty_pretty p, decl_node n)
               outText (p, (const char *) ";\\n", 3);
             }
         }
-      else if (decl_isVarientField (q))
+      else if (decl_isVarientField (static_cast<decl_node> (q)))
         {
           /* avoid dangling else.  */
           doVarientFieldM2 (p, q);
@@ -20967,21 +21035,21 @@ static void doVarientM2 (mcPretty_pretty p, decl_node n)
    doRecordM2 -
 */
 
-static void doRecordM2 (mcPretty_pretty p, decl_node n)
+static void doRecordM2 (mcPretty_pretty p, decl_node__opaque n)
 {
   unsigned int i;
   unsigned int h;
-  decl_node f;
+  decl_node__opaque f;
 
-  mcDebug_assert (decl_isRecord (n));
+  mcDebug_assert (decl_isRecord (static_cast<decl_node> (n)));
   p = outKm2 (p, (const char *) "RECORD", 6);
   i = Indexing_LowIndice (n->recordF.listOfSons);
   h = Indexing_HighIndice (n->recordF.listOfSons);
   outText (p, (const char *) "\\n", 2);
   while (i <= h)
     {
-      f = static_cast<decl_node> (Indexing_GetIndice (n->recordF.listOfSons, i));
-      if (decl_isRecordField (f))
+      f = static_cast<decl_node__opaque> (Indexing_GetIndice (n->recordF.listOfSons, i));
+      if (decl_isRecordField (static_cast<decl_node> (f)))
         {
           /* avoid dangling else.  */
           if (! f->recordfieldF.tag)
@@ -20990,13 +21058,13 @@ static void doRecordM2 (mcPretty_pretty p, decl_node n)
               outText (p, (const char *) ";\\n", 3);
             }
         }
-      else if (decl_isVarient (f))
+      else if (decl_isVarient (static_cast<decl_node> (f)))
         {
           /* avoid dangling else.  */
           doVarientM2 (p, f);
           outText (p, (const char *) ";\\n", 3);
         }
-      else if (decl_isVarientField (f))
+      else if (decl_isVarientField (static_cast<decl_node> (f)))
         {
           /* avoid dangling else.  */
           doVarientFieldM2 (p, f);
@@ -21012,11 +21080,11 @@ static void doRecordM2 (mcPretty_pretty p, decl_node n)
    doPointerM2 -
 */
 
-static void doPointerM2 (mcPretty_pretty p, decl_node n)
+static void doPointerM2 (mcPretty_pretty p, decl_node__opaque n)
 {
   outText (p, (const char *) "POINTER TO", 10);
   mcPretty_setNeedSpace (doP);
-  doTypeM2 (p, decl_getType (n));
+  doTypeM2 (p, static_cast<decl_node__opaque> (decl_getType (static_cast<decl_node> (n))));
   mcPretty_setNeedSpace (p);
   outText (p, (const char *) ";\\n", 3);
 }
@@ -21026,13 +21094,13 @@ static void doPointerM2 (mcPretty_pretty p, decl_node n)
    doTypeAliasM2 -
 */
 
-static void doTypeAliasM2 (mcPretty_pretty p, decl_node n)
+static void doTypeAliasM2 (mcPretty_pretty p, decl_node__opaque n)
 {
   doTypeNameC (p, n);
   mcPretty_setNeedSpace (p);
   outText (doP, (const char *) "=", 1);
   mcPretty_setNeedSpace (p);
-  doTypeM2 (p, decl_getType (n));
+  doTypeM2 (p, static_cast<decl_node__opaque> (decl_getType (static_cast<decl_node> (n))));
   mcPretty_setNeedSpace (p);
   outText (p, (const char *) "\\n", 2);
 }
@@ -21042,11 +21110,11 @@ static void doTypeAliasM2 (mcPretty_pretty p, decl_node n)
    doEnumerationM2 -
 */
 
-static void doEnumerationM2 (mcPretty_pretty p, decl_node n)
+static void doEnumerationM2 (mcPretty_pretty p, decl_node__opaque n)
 {
   unsigned int i;
   unsigned int h;
-  decl_node s;
+  decl_node__opaque s;
   DynamicStrings_String t;
 
   outText (p, (const char *) "(", 1);
@@ -21054,7 +21122,7 @@ static void doEnumerationM2 (mcPretty_pretty p, decl_node n)
   h = Indexing_HighIndice (n->enumerationF.listOfSons);
   while (i <= h)
     {
-      s = static_cast<decl_node> (Indexing_GetIndice (n->enumerationF.listOfSons, i));
+      s = static_cast<decl_node__opaque> (Indexing_GetIndice (n->enumerationF.listOfSons, i));
       doFQNameC (p, s);
       if (i < h)
         {
@@ -21071,7 +21139,7 @@ static void doEnumerationM2 (mcPretty_pretty p, decl_node n)
    doBaseM2 -
 */
 
-static void doBaseM2 (mcPretty_pretty p, decl_node n)
+static void doBaseM2 (mcPretty_pretty p, decl_node__opaque n)
 {
   switch (n->kind)
     {
@@ -21107,7 +21175,7 @@ static void doBaseM2 (mcPretty_pretty p, decl_node n)
    doSystemM2 -
 */
 
-static void doSystemM2 (mcPretty_pretty p, decl_node n)
+static void doSystemM2 (mcPretty_pretty p, decl_node__opaque n)
 {
   switch (n->kind)
     {
@@ -21132,7 +21200,7 @@ static void doSystemM2 (mcPretty_pretty p, decl_node n)
    doTypeM2 -
 */
 
-static void doTypeM2 (mcPretty_pretty p, decl_node n)
+static void doTypeM2 (mcPretty_pretty p, decl_node__opaque n)
 {
   if (isBase (n))
     {
@@ -21143,27 +21211,27 @@ static void doTypeM2 (mcPretty_pretty p, decl_node n)
       /* avoid dangling else.  */
       doSystemM2 (p, n);
     }
-  else if (decl_isType (n))
+  else if (decl_isType (static_cast<decl_node> (n)))
     {
       /* avoid dangling else.  */
       doTypeAliasM2 (p, n);
     }
-  else if (decl_isProcType (n))
+  else if (decl_isProcType (static_cast<decl_node> (n)))
     {
       /* avoid dangling else.  */
       doProcTypeM2 (p, n);
     }
-  else if (decl_isPointer (n))
+  else if (decl_isPointer (static_cast<decl_node> (n)))
     {
       /* avoid dangling else.  */
       doPointerM2 (p, n);
     }
-  else if (decl_isEnumeration (n))
+  else if (decl_isEnumeration (static_cast<decl_node> (n)))
     {
       /* avoid dangling else.  */
       doEnumerationM2 (p, n);
     }
-  else if (decl_isRecord (n))
+  else if (decl_isRecord (static_cast<decl_node> (n)))
     {
       /* avoid dangling else.  */
       doRecordM2 (p, n);
@@ -21175,9 +21243,9 @@ static void doTypeM2 (mcPretty_pretty p, decl_node n)
    doTypesM2 -
 */
 
-static void doTypesM2 (decl_node n)
+static void doTypesM2 (decl_node__opaque n)
 {
-  decl_node m;
+  decl_node__opaque m;
 
   outText (doP, (const char *) "TYPE\\n", 6);
   doTypeM2 (doP, n);
@@ -21188,13 +21256,13 @@ static void doTypesM2 (decl_node n)
    doVarM2 -
 */
 
-static void doVarM2 (decl_node n)
+static void doVarM2 (decl_node__opaque n)
 {
-  mcDebug_assert (decl_isVar (n));
+  mcDebug_assert (decl_isVar (static_cast<decl_node> (n)));
   doNameC (doP, n);
   outText (doP, (const char *) ":", 1);
   mcPretty_setNeedSpace (doP);
-  doTypeM2 (doP, decl_getType (n));
+  doTypeM2 (doP, static_cast<decl_node__opaque> (decl_getType (static_cast<decl_node> (n))));
   mcPretty_setNeedSpace (doP);
   outText (doP, (const char *) ";\\n", 3);
 }
@@ -21204,9 +21272,9 @@ static void doVarM2 (decl_node n)
    doVarsM2 -
 */
 
-static void doVarsM2 (decl_node n)
+static void doVarsM2 (decl_node__opaque n)
 {
-  decl_node m;
+  decl_node__opaque m;
 
   outText (doP, (const char *) "VAR\\n", 5);
   doVarM2 (n);
@@ -21217,7 +21285,7 @@ static void doVarsM2 (decl_node n)
    doTypeNameM2 -
 */
 
-static void doTypeNameM2 (mcPretty_pretty p, decl_node n)
+static void doTypeNameM2 (mcPretty_pretty p, decl_node__opaque n)
 {
   doNameM2 (p, n);
 }
@@ -21227,16 +21295,16 @@ static void doTypeNameM2 (mcPretty_pretty p, decl_node n)
    doParamM2 -
 */
 
-static void doParamM2 (mcPretty_pretty p, decl_node n)
+static void doParamM2 (mcPretty_pretty p, decl_node__opaque n)
 {
-  decl_node ptype;
+  decl_node__opaque ptype;
   nameKey_Name i;
   unsigned int c;
   unsigned int t;
   wlists_wlist l;
 
-  mcDebug_assert (decl_isParam (n));
-  ptype = decl_getType (n);
+  mcDebug_assert (decl_isParam (static_cast<decl_node> (n)));
+  ptype = static_cast<decl_node__opaque> (decl_getType (static_cast<decl_node> (n)));
   if (n->paramF.namelist == NULL)
     {
       doTypeNameM2 (p, ptype);
@@ -21277,18 +21345,18 @@ static void doParamM2 (mcPretty_pretty p, decl_node n)
    doVarParamM2 -
 */
 
-static void doVarParamM2 (mcPretty_pretty p, decl_node n)
+static void doVarParamM2 (mcPretty_pretty p, decl_node__opaque n)
 {
-  decl_node ptype;
+  decl_node__opaque ptype;
   nameKey_Name i;
   unsigned int c;
   unsigned int t;
   wlists_wlist l;
 
-  mcDebug_assert (decl_isVarParam (n));
+  mcDebug_assert (decl_isVarParam (static_cast<decl_node> (n)));
   outText (p, (const char *) "VAR", 3);
   mcPretty_setNeedSpace (p);
-  ptype = decl_getType (n);
+  ptype = static_cast<decl_node__opaque> (decl_getType (static_cast<decl_node> (n)));
   if (n->varparamF.namelist == NULL)
     {
       doTypeNameM2 (p, ptype);
@@ -21329,18 +21397,18 @@ static void doVarParamM2 (mcPretty_pretty p, decl_node n)
    doParameterM2 -
 */
 
-static void doParameterM2 (mcPretty_pretty p, decl_node n)
+static void doParameterM2 (mcPretty_pretty p, decl_node__opaque n)
 {
-  if (decl_isParam (n))
+  if (decl_isParam (static_cast<decl_node> (n)))
     {
       doParamM2 (p, n);
     }
-  else if (decl_isVarParam (n))
+  else if (decl_isVarParam (static_cast<decl_node> (n)))
     {
       /* avoid dangling else.  */
       doVarParamM2 (p, n);
     }
-  else if (decl_isVarargs (n))
+  else if (decl_isVarargs (static_cast<decl_node> (n)))
     {
       /* avoid dangling else.  */
       mcPretty_print (p, (const char *) "...", 3);
@@ -21352,13 +21420,13 @@ static void doParameterM2 (mcPretty_pretty p, decl_node n)
    doPrototypeM2 -
 */
 
-static void doPrototypeM2 (decl_node n)
+static void doPrototypeM2 (decl_node__opaque n)
 {
   unsigned int i;
   unsigned int h;
-  decl_node p;
+  decl_node__opaque p;
 
-  mcDebug_assert (decl_isProcedure (n));
+  mcDebug_assert (decl_isProcedure (static_cast<decl_node> (n)));
   mcPretty_noSpace (doP);
   doNameM2 (doP, n);
   mcPretty_setNeedSpace (doP);
@@ -21367,7 +21435,7 @@ static void doPrototypeM2 (decl_node n)
   h = Indexing_HighIndice (n->procedureF.parameters);
   while (i <= h)
     {
-      p = static_cast<decl_node> (Indexing_GetIndice (n->procedureF.parameters, i));
+      p = static_cast<decl_node__opaque> (Indexing_GetIndice (n->procedureF.parameters, i));
       doParameterM2 (doP, p);
       mcPretty_noSpace (doP);
       if (i < h)
@@ -21398,21 +21466,21 @@ static void doPrototypeM2 (decl_node n)
                      when trying to complete partial to full.
 */
 
-static void outputPartialM2 (decl_node n)
+static void outputPartialM2 (decl_node__opaque n)
 {
-  decl_node q;
+  decl_node__opaque q;
 
-  q = decl_getType (n);
-  if (decl_isRecord (q))
+  q = static_cast<decl_node__opaque> (decl_getType (static_cast<decl_node> (n)));
+  if (decl_isRecord (static_cast<decl_node> (q)))
     {
       doTypeM2 (doP, n);
     }
-  else if (decl_isArray (q))
+  else if (decl_isArray (static_cast<decl_node> (q)))
     {
       /* avoid dangling else.  */
       doTypeM2 (doP, n);
     }
-  else if (decl_isProcType (q))
+  else if (decl_isProcType (static_cast<decl_node> (q)))
     {
       /* avoid dangling else.  */
       doTypeM2 (doP, n);
@@ -21440,16 +21508,16 @@ static void outDeclsDefM2 (mcPretty_pretty p, decl_scopeT s)
    outDefM2 -
 */
 
-static void outDefM2 (mcPretty_pretty p, decl_node n)
+static void outDefM2 (mcPretty_pretty p, decl_node__opaque n)
 {
   DynamicStrings_String s;
 
-  s = DynamicStrings_InitStringCharStar (nameKey_keyToCharStar (decl_getSource (n)));
+  s = DynamicStrings_InitStringCharStar (nameKey_keyToCharStar (decl_getSource (static_cast<decl_node> (n))));
   mcPretty_print (p, (const char *) "(* automatically created by mc from ", 36);
   mcPretty_prints (p, s);
   mcPretty_print (p, (const char *) ".  *)\\n\\n", 9);
   s = DynamicStrings_KillString (s);
-  s = DynamicStrings_InitStringCharStar (nameKey_keyToCharStar (decl_getSymName (n)));
+  s = DynamicStrings_InitStringCharStar (nameKey_keyToCharStar (decl_getSymName (static_cast<decl_node> (n))));
   mcPretty_print (p, (const char *) "DEFINITION MODULE ", 18);
   mcPretty_prints (p, s);
   mcPretty_print (p, (const char *) " ;\\n\\n", 6);
@@ -21486,11 +21554,11 @@ static void outDeclsImpM2 (mcPretty_pretty p, decl_scopeT s)
    outImpM2 -
 */
 
-static void outImpM2 (mcPretty_pretty p, decl_node n)
+static void outImpM2 (mcPretty_pretty p, decl_node__opaque n)
 {
   DynamicStrings_String s;
 
-  s = DynamicStrings_InitStringCharStar (nameKey_keyToCharStar (decl_getSource (n)));
+  s = DynamicStrings_InitStringCharStar (nameKey_keyToCharStar (decl_getSource (static_cast<decl_node> (n))));
   mcPretty_print (p, (const char *) "(* automatically created by mc from ", 36);
   mcPretty_prints (p, s);
   mcPretty_print (p, (const char *) ".  *)\\n\\n", 9);
@@ -21514,7 +21582,7 @@ static void outImpM2 (mcPretty_pretty p, decl_node n)
    outModuleM2 -
 */
 
-static void outModuleM2 (mcPretty_pretty p, decl_node n)
+static void outModuleM2 (mcPretty_pretty p, decl_node__opaque n)
 {
 }
 
@@ -21523,18 +21591,18 @@ static void outModuleM2 (mcPretty_pretty p, decl_node n)
    outM2 -
 */
 
-static void outM2 (mcPretty_pretty p, decl_node n)
+static void outM2 (mcPretty_pretty p, decl_node__opaque n)
 {
-  if (decl_isDef (n))
+  if (decl_isDef (static_cast<decl_node> (n)))
     {
       outDefM2 (p, n);
     }
-  else if (decl_isImp (n))
+  else if (decl_isImp (static_cast<decl_node> (n)))
     {
       /* avoid dangling else.  */
       outImpM2 (p, n);
     }
-  else if (decl_isModule (n))
+  else if (decl_isModule (static_cast<decl_node> (n)))
     {
       /* avoid dangling else.  */
       outModuleM2 (p, n);
@@ -21552,9 +21620,16 @@ static void outM2 (mcPretty_pretty p, decl_node n)
    addDone - adds node, n, to the doneQ.
 */
 
-static void addDone (decl_node n)
+static void addDone (decl_node__opaque n)
 {
+  DynamicStrings_String s;
+
   alists_includeItemIntoList (globalGroup->doneQ, reinterpret_cast<void *> (n));
+  if ((decl_isVar (static_cast<decl_node> (n))) || (decl_isParameter (static_cast<decl_node> (n))))
+    {
+      initNodeOpaqueState (n);
+    }
+  debugLists ();
 }
 
 
@@ -21563,21 +21638,29 @@ static void addDone (decl_node n)
                 it is not an opaque of the main module we are compiling.
 */
 
-static void addDoneDef (decl_node n)
+static void addDoneDef (decl_node__opaque n)
 {
-  if (decl_isDef (n))
+  if (decl_isDef (static_cast<decl_node> (n)))
     {
       addDone (n);
-      return ;
+      return;
     }
-  if (false && ((decl_lookupImp (decl_getSymName (decl_getScope (n)))) == (decl_getMainModule ())))
+  if (false && ((decl_lookupImp (decl_getSymName (decl_getScope (static_cast<decl_node> (n))))) == (decl_getMainModule ())))
     {
       mcMetaError_metaError1 ((const char *) "cyclic dependancy found between another module using {%1ad} from the definition module of the implementation main being compiled, use the --extended-opaque option to compile", 173, (const unsigned char *) &n, (sizeof (n)-1));
       mcError_flushErrors ();
       mcError_errorAbort0 ((const char *) "terminating compilation", 23);
     }
+  else if ((decl_isType (static_cast<decl_node> (n))) && (isDeclInImp (n)))
+    {
+      /* avoid dangling else.  */
+    }
   else
     {
+      /* avoid dangling else.  */
+      /* Ignore an opaque type which is declared in this implementation module as it
+         will be fully declared in C/C++ with the __opaque postfix.  Whereas the
+         void * non prefixed typedef will be declared in the .h file.  */
       addDone (n);
     }
 }
@@ -21587,7 +21670,7 @@ static void addDoneDef (decl_node n)
    dbgAdd -
 */
 
-static decl_node dbgAdd (alists_alist l, decl_node n)
+static decl_node__opaque dbgAdd (alists_alist l, decl_node__opaque n)
 {
   if (n != NULL)
     {
@@ -21603,11 +21686,11 @@ static decl_node dbgAdd (alists_alist l, decl_node n)
    dbgType -
 */
 
-static void dbgType (alists_alist l, decl_node n)
+static void dbgType (alists_alist l, decl_node__opaque n)
 {
-  decl_node t;
+  decl_node__opaque t;
 
-  t = dbgAdd (l, decl_getType (n));
+  t = dbgAdd (l, static_cast<decl_node__opaque> (decl_getType (static_cast<decl_node> (n))));
   out1 ((const char *) "<%s type", 8, n);
   if (t == NULL)
     {
@@ -21624,11 +21707,11 @@ static void dbgType (alists_alist l, decl_node n)
    dbgPointer -
 */
 
-static void dbgPointer (alists_alist l, decl_node n)
+static void dbgPointer (alists_alist l, decl_node__opaque n)
 {
-  decl_node t;
+  decl_node__opaque t;
 
-  t = dbgAdd (l, decl_getType (n));
+  t = dbgAdd (l, static_cast<decl_node__opaque> (decl_getType (static_cast<decl_node> (n))));
   out1 ((const char *) "<%s pointer", 11, n);
   out1 ((const char *) " to %s>\\n", 9, t);
 }
@@ -21638,28 +21721,28 @@ static void dbgPointer (alists_alist l, decl_node n)
    dbgRecord -
 */
 
-static void dbgRecord (alists_alist l, decl_node n)
+static void dbgRecord (alists_alist l, decl_node__opaque n)
 {
   unsigned int i;
   unsigned int t;
-  decl_node q;
+  decl_node__opaque q;
 
   out1 ((const char *) "<%s record:\\n", 13, n);
   i = Indexing_LowIndice (n->recordF.listOfSons);
   t = Indexing_HighIndice (n->recordF.listOfSons);
   while (i <= t)
     {
-      q = static_cast<decl_node> (Indexing_GetIndice (n->recordF.listOfSons, i));
-      if (decl_isRecordField (q))
+      q = static_cast<decl_node__opaque> (Indexing_GetIndice (n->recordF.listOfSons, i));
+      if (decl_isRecordField (static_cast<decl_node> (q)))
         {
           out1 ((const char *) " <recordfield %s", 16, q);
         }
-      else if (decl_isVarientField (q))
+      else if (decl_isVarientField (static_cast<decl_node> (q)))
         {
           /* avoid dangling else.  */
           out1 ((const char *) " <varientfield %s", 17, q);
         }
-      else if (decl_isVarient (q))
+      else if (decl_isVarient (static_cast<decl_node> (q)))
         {
           /* avoid dangling else.  */
           out1 ((const char *) " <varient %s", 12, q);
@@ -21670,7 +21753,7 @@ static void dbgRecord (alists_alist l, decl_node n)
           M2RTS_HALT (-1);
           __builtin_unreachable ();
         }
-      q = dbgAdd (l, decl_getType (q));
+      q = dbgAdd (l, static_cast<decl_node__opaque> (decl_getType (static_cast<decl_node> (q))));
       out1 ((const char *) ": %s>\\n", 7, q);
       i += 1;
     }
@@ -21682,15 +21765,15 @@ static void dbgRecord (alists_alist l, decl_node n)
    dbgVarient -
 */
 
-static void dbgVarient (alists_alist l, decl_node n)
+static void dbgVarient (alists_alist l, decl_node__opaque n)
 {
   unsigned int i;
   unsigned int t;
-  decl_node q;
+  decl_node__opaque q;
 
   out1 ((const char *) "<%s varient: ", 13, n);
   out1 ((const char *) "tag %s", 6, n->varientF.tag);
-  q = decl_getType (n->varientF.tag);
+  q = static_cast<decl_node__opaque> (decl_getType (static_cast<decl_node> (n->varientF.tag)));
   if (q == NULL)
     {
       outText (doP, (const char *) "\\n", 2);
@@ -21704,17 +21787,17 @@ static void dbgVarient (alists_alist l, decl_node n)
   t = Indexing_HighIndice (n->varientF.listOfSons);
   while (i <= t)
     {
-      q = static_cast<decl_node> (Indexing_GetIndice (n->varientF.listOfSons, i));
-      if (decl_isRecordField (q))
+      q = static_cast<decl_node__opaque> (Indexing_GetIndice (n->varientF.listOfSons, i));
+      if (decl_isRecordField (static_cast<decl_node> (q)))
         {
           out1 ((const char *) " <recordfield %s", 16, q);
         }
-      else if (decl_isVarientField (q))
+      else if (decl_isVarientField (static_cast<decl_node> (q)))
         {
           /* avoid dangling else.  */
           out1 ((const char *) " <varientfield %s", 17, q);
         }
-      else if (decl_isVarient (q))
+      else if (decl_isVarient (static_cast<decl_node> (q)))
         {
           /* avoid dangling else.  */
           out1 ((const char *) " <varient %s", 12, q);
@@ -21725,7 +21808,7 @@ static void dbgVarient (alists_alist l, decl_node n)
           M2RTS_HALT (-1);
           __builtin_unreachable ();
         }
-      q = dbgAdd (l, decl_getType (q));
+      q = dbgAdd (l, static_cast<decl_node__opaque> (decl_getType (static_cast<decl_node> (q))));
       out1 ((const char *) ": %s>\\n", 7, q);
       i += 1;
     }
@@ -21737,9 +21820,9 @@ static void dbgVarient (alists_alist l, decl_node n)
    dbgEnumeration -
 */
 
-static void dbgEnumeration (alists_alist l, decl_node n)
+static void dbgEnumeration (alists_alist l, decl_node__opaque n)
 {
-  decl_node e;
+  decl_node__opaque e;
   unsigned int i;
   unsigned int h;
 
@@ -21748,7 +21831,7 @@ static void dbgEnumeration (alists_alist l, decl_node n)
   h = Indexing_HighIndice (n->enumerationF.listOfSons);
   while (i <= h)
     {
-      e = static_cast<decl_node> (Indexing_GetIndice (n->enumerationF.listOfSons, i));
+      e = static_cast<decl_node__opaque> (Indexing_GetIndice (n->enumerationF.listOfSons, i));
       out1 ((const char *) "%s, ", 4, e);
       i += 1;
     }
@@ -21760,11 +21843,11 @@ static void dbgEnumeration (alists_alist l, decl_node n)
    dbgVar -
 */
 
-static void dbgVar (alists_alist l, decl_node n)
+static void dbgVar (alists_alist l, decl_node__opaque n)
 {
-  decl_node t;
+  decl_node__opaque t;
 
-  t = dbgAdd (l, decl_getType (n));
+  t = dbgAdd (l, static_cast<decl_node__opaque> (decl_getType (static_cast<decl_node> (n))));
   out1 ((const char *) "<%s var", 7, n);
   out1 ((const char *) ", type = %s>\\n", 14, t);
 }
@@ -21774,7 +21857,7 @@ static void dbgVar (alists_alist l, decl_node n)
    dbgSubrange -
 */
 
-static void dbgSubrange (alists_alist l, decl_node n)
+static void dbgSubrange (alists_alist l, decl_node__opaque n)
 {
   if (n->subrangeF.low == NULL)
     {
@@ -21792,11 +21875,11 @@ static void dbgSubrange (alists_alist l, decl_node n)
    dbgArray -
 */
 
-static void dbgArray (alists_alist l, decl_node n)
+static void dbgArray (alists_alist l, decl_node__opaque n)
 {
-  decl_node t;
+  decl_node__opaque t;
 
-  t = dbgAdd (l, decl_getType (n));
+  t = dbgAdd (l, static_cast<decl_node__opaque> (decl_getType (static_cast<decl_node> (n))));
   out1 ((const char *) "<%s array ", 10, n);
   if (n->arrayF.subr != NULL)
     {
@@ -21810,46 +21893,46 @@ static void dbgArray (alists_alist l, decl_node n)
    doDbg -
 */
 
-static void doDbg (alists_alist l, decl_node n)
+static void doDbg (alists_alist l, decl_node__opaque n)
 {
   if (n == NULL)
     {}  /* empty.  */
-  else if (decl_isSubrange (n))
+  else if (decl_isSubrange (static_cast<decl_node> (n)))
     {
       /* avoid dangling else.  */
       dbgSubrange (l, n);
     }
-  else if (decl_isType (n))
+  else if (decl_isType (static_cast<decl_node> (n)))
     {
       /* avoid dangling else.  */
       dbgType (l, n);
     }
-  else if (decl_isRecord (n))
+  else if (decl_isRecord (static_cast<decl_node> (n)))
     {
       /* avoid dangling else.  */
       dbgRecord (l, n);
     }
-  else if (decl_isVarient (n))
+  else if (decl_isVarient (static_cast<decl_node> (n)))
     {
       /* avoid dangling else.  */
       dbgVarient (l, n);
     }
-  else if (decl_isEnumeration (n))
+  else if (decl_isEnumeration (static_cast<decl_node> (n)))
     {
       /* avoid dangling else.  */
       dbgEnumeration (l, n);
     }
-  else if (decl_isPointer (n))
+  else if (decl_isPointer (static_cast<decl_node> (n)))
     {
       /* avoid dangling else.  */
       dbgPointer (l, n);
     }
-  else if (decl_isArray (n))
+  else if (decl_isArray (static_cast<decl_node> (n)))
     {
       /* avoid dangling else.  */
       dbgArray (l, n);
     }
-  else if (decl_isVar (n))
+  else if (decl_isVar (static_cast<decl_node> (n)))
     {
       /* avoid dangling else.  */
       dbgVar (l, n);
@@ -21861,13 +21944,19 @@ static void doDbg (alists_alist l, decl_node n)
    dbg -
 */
 
-static void dbg (decl_node n)
+static void dbg (const char *listName_, unsigned int _listName_high, const char *symName_, unsigned int _symName_high, decl_node__opaque n)
 {
   alists_alist l;
   mcPretty_pretty o;
   FIO_File f;
   DynamicStrings_String s;
   unsigned int i;
+  char listName[_listName_high+1];
+  char symName[_symName_high+1];
+
+  /* make a local copy of each unbounded array.  */
+  memcpy (listName, listName_, _listName_high+1);
+  memcpy (symName, symName_, _symName_high+1);
 
   o = doP;
   f = outputFile;
@@ -21876,10 +21965,20 @@ static void dbg (decl_node n)
   l = alists_initList ();
   alists_includeItemIntoList (l, reinterpret_cast<void *> (n));
   i = 1;
-  out1 ((const char *) "dbg (%s)\\n", 10, n);
   do {
-    n = static_cast<decl_node> (alists_getItemFromList (l, i));
-    doDbg (l, n);
+    n = static_cast<decl_node__opaque> (alists_getItemFromList (l, i));
+    if (decl_isType (static_cast<decl_node> (n)))
+      {
+        s = getFQstring (n);
+        if (DynamicStrings_EqualArray (s, (const char *) symName, _symName_high))
+          {
+            out0 ((const char *) "list ", 5);
+            out0 ((const char *) listName, _listName_high);
+            out0 ((const char *) ": ", 2);
+            doDbg (l, n);
+          }
+        s = DynamicStrings_KillString (s);
+      }
     i += 1;
   } while (! (i > (alists_noOfItemsInList (l))));
   doP = o;
@@ -21892,7 +21991,7 @@ static void dbg (decl_node n)
                     nodes.
 */
 
-static void addGenericBody (decl_node n, decl_node c)
+static void addGenericBody (decl_node__opaque n, decl_node__opaque c)
 {
   switch (n->kind)
     {
@@ -21944,7 +22043,7 @@ static void addGenericBody (decl_node n, decl_node c)
                      nodes.
 */
 
-static void addGenericAfter (decl_node n, decl_node c)
+static void addGenericAfter (decl_node__opaque n, decl_node__opaque c)
 {
   switch (n->kind)
     {
@@ -21995,7 +22094,7 @@ static void addGenericAfter (decl_node n, decl_node c)
    isAssignment -
 */
 
-static bool isAssignment (decl_node n)
+static bool isAssignment (decl_node__opaque n)
 {
   return n->kind == decl_assignment;
   /* static analysis guarentees a RETURN statement will be used before here.  */
@@ -22007,7 +22106,7 @@ static bool isAssignment (decl_node n)
    isComment - returns TRUE if node, n, is a comment.
 */
 
-static bool isComment (decl_node n)
+static bool isComment (decl_node__opaque n)
 {
   mcDebug_assert (n != NULL);
   return n->kind == decl_comment;
@@ -22022,8 +22121,8 @@ static bool isComment (decl_node n)
 
 static void initPair (decl_commentPair *c)
 {
-  (*c).after = NULL;
-  (*c).body = NULL;
+  (*c).after = static_cast<decl_node__opaque> (NULL);
+  (*c).body = static_cast<decl_node__opaque> (NULL);
 }
 
 
@@ -22031,17 +22130,17 @@ static void initPair (decl_commentPair *c)
    dupExplist -
 */
 
-static decl_node dupExplist (decl_node n)
+static decl_node__opaque dupExplist (decl_node__opaque n)
 {
-  decl_node m;
+  decl_node__opaque m;
   unsigned int i;
 
-  mcDebug_assert (decl_isExpList (n));
-  m = decl_makeExpList ();
+  mcDebug_assert (decl_isExpList (static_cast<decl_node> (n)));
+  m = static_cast<decl_node__opaque> (decl_makeExpList ());
   i = Indexing_LowIndice (n->explistF.exp);
   while (i <= (Indexing_HighIndice (n->explistF.exp)))
     {
-      decl_putExpList (m, decl_dupExpr (reinterpret_cast<decl_node> (Indexing_GetIndice (n->explistF.exp, i))));
+      decl_putExpList (static_cast<decl_node> (m), decl_dupExpr (static_cast<decl_node> (Indexing_GetIndice (n->explistF.exp, i))));
       i += 1;
     }
   return m;
@@ -22054,10 +22153,10 @@ static decl_node dupExplist (decl_node n)
    dupArrayref -
 */
 
-static decl_node dupArrayref (decl_node n)
+static decl_node__opaque dupArrayref (decl_node__opaque n)
 {
   mcDebug_assert (isArrayRef (n));
-  return decl_makeArrayRef (decl_dupExpr (n->arrayrefF.array), decl_dupExpr (n->arrayrefF.index));
+  return static_cast<decl_node__opaque> (decl_makeArrayRef (decl_dupExpr (static_cast<decl_node> (n->arrayrefF.array)), decl_dupExpr (static_cast<decl_node> (n->arrayrefF.index))));
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -22067,10 +22166,10 @@ static decl_node dupArrayref (decl_node n)
    dupPointerref -
 */
 
-static decl_node dupPointerref (decl_node n)
+static decl_node__opaque dupPointerref (decl_node__opaque n)
 {
-  mcDebug_assert (decl_isPointerRef (n));
-  return decl_makePointerRef (decl_dupExpr (n->pointerrefF.ptr), decl_dupExpr (n->pointerrefF.field));
+  mcDebug_assert (decl_isPointerRef (static_cast<decl_node> (n)));
+  return static_cast<decl_node__opaque> (decl_makePointerRef (decl_dupExpr (static_cast<decl_node> (n->pointerrefF.ptr)), decl_dupExpr (static_cast<decl_node> (n->pointerrefF.field))));
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -22080,10 +22179,10 @@ static decl_node dupPointerref (decl_node n)
    dupComponentref -
 */
 
-static decl_node dupComponentref (decl_node n)
+static decl_node__opaque dupComponentref (decl_node__opaque n)
 {
   mcDebug_assert (isComponentRef (n));
-  return doMakeComponentRef (decl_dupExpr (n->componentrefF.rec), decl_dupExpr (n->componentrefF.field));
+  return doMakeComponentRef (static_cast<decl_node__opaque> (decl_dupExpr (static_cast<decl_node> (n->componentrefF.rec))), static_cast<decl_node__opaque> (decl_dupExpr (static_cast<decl_node> (n->componentrefF.field))));
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -22093,10 +22192,10 @@ static decl_node dupComponentref (decl_node n)
    dupBinary -
 */
 
-static decl_node dupBinary (decl_node n)
+static decl_node__opaque dupBinary (decl_node__opaque n)
 {
   /* assert (isBinary (n)) ;  */
-  return makeBinary (n->kind, decl_dupExpr (n->binaryF.left), decl_dupExpr (n->binaryF.right), n->binaryF.resultType);
+  return makeBinary (n->kind, static_cast<decl_node__opaque> (decl_dupExpr (static_cast<decl_node> (n->binaryF.left))), static_cast<decl_node__opaque> (decl_dupExpr (static_cast<decl_node> (n->binaryF.right))), n->binaryF.resultType);
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -22106,10 +22205,10 @@ static decl_node dupBinary (decl_node n)
    dupUnary -
 */
 
-static decl_node dupUnary (decl_node n)
+static decl_node__opaque dupUnary (decl_node__opaque n)
 {
   /* assert (isUnary (n)) ;  */
-  return makeUnary (n->kind, decl_dupExpr (n->unaryF.arg), n->unaryF.resultType);
+  return makeUnary (n->kind, static_cast<decl_node__opaque> (decl_dupExpr (static_cast<decl_node> (n->unaryF.arg))), n->unaryF.resultType);
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -22119,13 +22218,14 @@ static decl_node dupUnary (decl_node n)
    dupFunccall -
 */
 
-static decl_node dupFunccall (decl_node n)
+static decl_node__opaque dupFunccall (decl_node__opaque n)
 {
-  decl_node m;
+  decl_node__opaque m;
 
   mcDebug_assert (isFuncCall (n));
-  m = decl_makeFuncCall (decl_dupExpr (n->funccallF.function), decl_dupExpr (n->funccallF.args));
+  m = static_cast<decl_node__opaque> (decl_makeFuncCall (decl_dupExpr (static_cast<decl_node> (n->funccallF.function)), decl_dupExpr (static_cast<decl_node> (n->funccallF.args))));
   m->funccallF.type = n->funccallF.type;
+  assignNodeOpaqueCastState (m, n);
   return m;
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
@@ -22136,9 +22236,9 @@ static decl_node dupFunccall (decl_node n)
    dupSetValue -
 */
 
-static decl_node dupSetValue (decl_node n)
+static decl_node__opaque dupSetValue (decl_node__opaque n)
 {
-  decl_node m;
+  decl_node__opaque m;
   unsigned int i;
 
   m = newNode (decl_setvalue);
@@ -22146,7 +22246,7 @@ static decl_node dupSetValue (decl_node n)
   i = Indexing_LowIndice (n->setvalueF.values);
   while (i <= (Indexing_HighIndice (n->setvalueF.values)))
     {
-      m = decl_putSetValue (m, decl_dupExpr (reinterpret_cast<decl_node> (Indexing_GetIndice (n->setvalueF.values, i))));
+      m = static_cast<decl_node__opaque> (decl_putSetValue (static_cast<decl_node> (m), decl_dupExpr (static_cast<decl_node> (Indexing_GetIndice (n->setvalueF.values, i)))));
       i += 1;
     }
   return m;
@@ -22159,7 +22259,7 @@ static decl_node dupSetValue (decl_node n)
    doDupExpr -
 */
 
-static decl_node doDupExpr (decl_node n)
+static decl_node__opaque doDupExpr (decl_node__opaque n)
 {
   mcDebug_assert (n != NULL);
   switch (n->kind)
@@ -22347,7 +22447,7 @@ static decl_node doDupExpr (decl_node n)
 
 static void makeSystem (void)
 {
-  systemN = decl_lookupDef (nameKey_makeKey ((const char *) "SYSTEM", 6));
+  systemN = static_cast<decl_node__opaque> (decl_lookupDef (nameKey_makeKey ((const char *) "SYSTEM", 6)));
   addressN = makeBase (decl_address);
   locN = makeBase (decl_loc);
   byteN = makeBase (decl_byte);
@@ -22357,7 +22457,7 @@ static void makeSystem (void)
   adrN = makeBase (decl_adr);
   tsizeN = makeBase (decl_tsize);
   throwN = makeBase (decl_throw);
-  decl_enterScope (systemN);
+  decl_enterScope (static_cast<decl_node> (systemN));
   addressN = addToScope (addressN);
   locN = addToScope (locN);
   byteN = addToScope (byteN);
@@ -22385,7 +22485,7 @@ static void makeSystem (void)
 
 static void makeM2rts (void)
 {
-  m2rtsN = decl_lookupDef (nameKey_makeKey ((const char *) "M2RTS", 5));
+  m2rtsN = static_cast<decl_node__opaque> (decl_lookupDef (nameKey_makeKey ((const char *) "M2RTS", 5)));
 }
 
 
@@ -22393,13 +22493,13 @@ static void makeM2rts (void)
    makeBitnum -
 */
 
-static decl_node makeBitnum (void)
+static decl_node__opaque makeBitnum (void)
 {
-  decl_node b;
+  decl_node__opaque b;
 
   b = newNode (decl_subrange);
-  b->subrangeF.type = NULL;
-  b->subrangeF.scope = NULL;
+  b->subrangeF.type = static_cast<decl_node__opaque> (NULL);
+  b->subrangeF.scope = static_cast<decl_node__opaque> (NULL);
   b->subrangeF.low = lookupConst (b, nameKey_makeKey ((const char *) "0", 1));
   b->subrangeF.high = lookupConst (b, nameKey_makeKey ((const char *) "31", 2));
   return b;
@@ -22529,10 +22629,10 @@ static void makeBaseSymbols (void)
 
 static void makeBuiltins (void)
 {
-  bitsperunitN = decl_makeLiteralInt (nameKey_makeKey ((const char *) "8", 1));
-  bitsperwordN = decl_makeLiteralInt (nameKey_makeKey ((const char *) "32", 2));
-  bitspercharN = decl_makeLiteralInt (nameKey_makeKey ((const char *) "8", 1));
-  unitsperwordN = decl_makeLiteralInt (nameKey_makeKey ((const char *) "4", 1));
+  bitsperunitN = static_cast<decl_node__opaque> (decl_makeLiteralInt (nameKey_makeKey ((const char *) "8", 1)));
+  bitsperwordN = static_cast<decl_node__opaque> (decl_makeLiteralInt (nameKey_makeKey ((const char *) "32", 2)));
+  bitspercharN = static_cast<decl_node__opaque> (decl_makeLiteralInt (nameKey_makeKey ((const char *) "8", 1)));
+  unitsperwordN = static_cast<decl_node__opaque> (decl_makeLiteralInt (nameKey_makeKey ((const char *) "4", 1)));
   addDone (bitsperunitN);
   addDone (bitsperwordN);
   addDone (bitspercharN);
@@ -22573,7 +22673,7 @@ static void init (void)
 
 extern "C" unsigned int decl_getDeclaredMod (decl_node n)
 {
-  return n->at.modDeclared;
+  return static_cast<decl_node__opaque> (n)->at.modDeclared;
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -22586,7 +22686,7 @@ extern "C" unsigned int decl_getDeclaredMod (decl_node n)
 
 extern "C" unsigned int decl_getDeclaredDef (decl_node n)
 {
-  return n->at.defDeclared;
+  return static_cast<decl_node__opaque> (n)->at.defDeclared;
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -22599,7 +22699,7 @@ extern "C" unsigned int decl_getDeclaredDef (decl_node n)
 
 extern "C" unsigned int decl_getFirstUsed (decl_node n)
 {
-  return n->at.firstUsed;
+  return static_cast<decl_node__opaque> (n)->at.firstUsed;
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -22612,7 +22712,7 @@ extern "C" unsigned int decl_getFirstUsed (decl_node n)
 extern "C" bool decl_isDef (decl_node n)
 {
   mcDebug_assert (n != NULL);
-  return n->kind == decl_def;
+  return static_cast<decl_node__opaque> (n)->kind == decl_def;
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -22625,7 +22725,7 @@ extern "C" bool decl_isDef (decl_node n)
 extern "C" bool decl_isImp (decl_node n)
 {
   mcDebug_assert (n != NULL);
-  return n->kind == decl_imp;
+  return static_cast<decl_node__opaque> (n)->kind == decl_imp;
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -22649,18 +22749,18 @@ extern "C" bool decl_isImpOrModule (decl_node n)
 
 extern "C" bool decl_isVisited (decl_node n)
 {
-  switch (n->kind)
+  switch (static_cast<decl_node__opaque> (n)->kind)
     {
       case decl_def:
-        return n->defF.visited;
+        return static_cast<decl_node__opaque> (n)->defF.visited;
         break;
 
       case decl_imp:
-        return n->impF.visited;
+        return static_cast<decl_node__opaque> (n)->impF.visited;
         break;
 
       case decl_module:
-        return n->moduleF.visited;
+        return static_cast<decl_node__opaque> (n)->moduleF.visited;
         break;
 
 
@@ -22679,18 +22779,18 @@ extern "C" bool decl_isVisited (decl_node n)
 
 extern "C" void decl_unsetVisited (decl_node n)
 {
-  switch (n->kind)
+  switch (static_cast<decl_node__opaque> (n)->kind)
     {
       case decl_def:
-        n->defF.visited = false;
+        static_cast<decl_node__opaque> (n)->defF.visited = false;
         break;
 
       case decl_imp:
-        n->impF.visited = false;
+        static_cast<decl_node__opaque> (n)->impF.visited = false;
         break;
 
       case decl_module:
-        n->moduleF.visited = false;
+        static_cast<decl_node__opaque> (n)->moduleF.visited = false;
         break;
 
 
@@ -22707,18 +22807,18 @@ extern "C" void decl_unsetVisited (decl_node n)
 
 extern "C" void decl_setVisited (decl_node n)
 {
-  switch (n->kind)
+  switch (static_cast<decl_node__opaque> (n)->kind)
     {
       case decl_def:
-        n->defF.visited = true;
+        static_cast<decl_node__opaque> (n)->defF.visited = true;
         break;
 
       case decl_imp:
-        n->impF.visited = true;
+        static_cast<decl_node__opaque> (n)->impF.visited = true;
         break;
 
       case decl_module:
-        n->moduleF.visited = true;
+        static_cast<decl_node__opaque> (n)->moduleF.visited = true;
         break;
 
 
@@ -22735,18 +22835,18 @@ extern "C" void decl_setVisited (decl_node n)
 
 extern "C" void decl_setEnumsComplete (decl_node n)
 {
-  switch (n->kind)
+  switch (static_cast<decl_node__opaque> (n)->kind)
     {
       case decl_def:
-        n->defF.enumsComplete = true;
+        static_cast<decl_node__opaque> (n)->defF.enumsComplete = true;
         break;
 
       case decl_imp:
-        n->impF.enumsComplete = true;
+        static_cast<decl_node__opaque> (n)->impF.enumsComplete = true;
         break;
 
       case decl_module:
-        n->moduleF.enumsComplete = true;
+        static_cast<decl_node__opaque> (n)->moduleF.enumsComplete = true;
         break;
 
 
@@ -22763,18 +22863,18 @@ extern "C" void decl_setEnumsComplete (decl_node n)
 
 extern "C" bool decl_getEnumsComplete (decl_node n)
 {
-  switch (n->kind)
+  switch (static_cast<decl_node__opaque> (n)->kind)
     {
       case decl_def:
-        return n->defF.enumsComplete;
+        return static_cast<decl_node__opaque> (n)->defF.enumsComplete;
         break;
 
       case decl_imp:
-        return n->impF.enumsComplete;
+        return static_cast<decl_node__opaque> (n)->impF.enumsComplete;
         break;
 
       case decl_module:
-        return n->moduleF.enumsComplete;
+        return static_cast<decl_node__opaque> (n)->moduleF.enumsComplete;
         break;
 
 
@@ -22797,17 +22897,17 @@ extern "C" void decl_resetEnumPos (decl_node n)
   mcDebug_assert (((decl_isDef (n)) || (decl_isImp (n))) || (decl_isModule (n)));
   if (decl_isDef (n))
     {
-      n->defF.enumFixup.count = 0;
+      static_cast<decl_node__opaque> (n)->defF.enumFixup.count = 0;
     }
   else if (decl_isImp (n))
     {
       /* avoid dangling else.  */
-      n->impF.enumFixup.count = 0;
+      static_cast<decl_node__opaque> (n)->impF.enumFixup.count = 0;
     }
   else if (decl_isModule (n))
     {
       /* avoid dangling else.  */
-      n->moduleF.enumFixup.count = 0;
+      static_cast<decl_node__opaque> (n)->moduleF.enumFixup.count = 0;
     }
 }
 
@@ -22818,27 +22918,27 @@ extern "C" void decl_resetEnumPos (decl_node n)
 
 extern "C" decl_node decl_getNextEnum (void)
 {
-  decl_node n;
+  decl_node__opaque n;
 
-  n = NULL;
-  mcDebug_assert (((decl_isDef (currentModule)) || (decl_isImp (currentModule))) || (decl_isModule (currentModule)));
-  if (decl_isDef (currentModule))
+  n = static_cast<decl_node__opaque> (NULL);
+  mcDebug_assert (((decl_isDef (static_cast<decl_node> (currentModule))) || (decl_isImp (static_cast<decl_node> (currentModule)))) || (decl_isModule (static_cast<decl_node> (currentModule))));
+  if (decl_isDef (static_cast<decl_node> (currentModule)))
     {
       n = getNextFixup (&currentModule->defF.enumFixup);
     }
-  else if (decl_isImp (currentModule))
+  else if (decl_isImp (static_cast<decl_node> (currentModule)))
     {
       /* avoid dangling else.  */
       n = getNextFixup (&currentModule->impF.enumFixup);
     }
-  else if (decl_isModule (currentModule))
+  else if (decl_isModule (static_cast<decl_node> (currentModule)))
     {
       /* avoid dangling else.  */
       n = getNextFixup (&currentModule->moduleF.enumFixup);
     }
   mcDebug_assert (n != NULL);
-  mcDebug_assert ((decl_isEnumeration (n)) || (decl_isEnumerationField (n)));
-  return n;
+  mcDebug_assert ((decl_isEnumeration (static_cast<decl_node> (n))) || (decl_isEnumerationField (static_cast<decl_node> (n))));
+  return static_cast<decl_node> (n);
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -22851,7 +22951,7 @@ extern "C" decl_node decl_getNextEnum (void)
 extern "C" bool decl_isModule (decl_node n)
 {
   mcDebug_assert (n != NULL);
-  return n->kind == decl_module;
+  return static_cast<decl_node__opaque> (n)->kind == decl_module;
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -22879,7 +22979,7 @@ extern "C" bool decl_isMainModule (decl_node n)
 extern "C" void decl_setMainModule (decl_node n)
 {
   mcDebug_assert (n != NULL);
-  mainModule = n;
+  mainModule = static_cast<decl_node__opaque> (n);
 }
 
 
@@ -22890,7 +22990,7 @@ extern "C" void decl_setMainModule (decl_node n)
 extern "C" void decl_setCurrentModule (decl_node n)
 {
   mcDebug_assert (n != NULL);
-  currentModule = n;
+  currentModule = static_cast<decl_node__opaque> (n);
 }
 
 
@@ -22900,16 +23000,16 @@ extern "C" void decl_setCurrentModule (decl_node n)
 
 extern "C" decl_node decl_lookupDef (nameKey_Name n)
 {
-  decl_node d;
+  decl_node__opaque d;
 
-  d = static_cast<decl_node> (symbolKey_getSymKey (defUniverse, n));
+  d = static_cast<decl_node__opaque> (symbolKey_getSymKey (defUniverse, n));
   if (d == NULL)
     {
       d = makeDef (n);
       symbolKey_putSymKey (defUniverse, n, reinterpret_cast<void *> (d));
       Indexing_IncludeIndiceIntoIndex (defUniverseI, reinterpret_cast<void *> (d));
     }
-  return d;
+  return static_cast<decl_node> (d);
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -22921,17 +23021,17 @@ extern "C" decl_node decl_lookupDef (nameKey_Name n)
 
 extern "C" decl_node decl_lookupImp (nameKey_Name n)
 {
-  decl_node m;
+  decl_node__opaque m;
 
-  m = static_cast<decl_node> (symbolKey_getSymKey (modUniverse, n));
+  m = static_cast<decl_node__opaque> (symbolKey_getSymKey (modUniverse, n));
   if (m == NULL)
     {
       m = makeImp (n);
       symbolKey_putSymKey (modUniverse, n, reinterpret_cast<void *> (m));
       Indexing_IncludeIndiceIntoIndex (modUniverseI, reinterpret_cast<void *> (m));
     }
-  mcDebug_assert (! (decl_isModule (m)));
-  return m;
+  mcDebug_assert (! (decl_isModule (static_cast<decl_node> (m))));
+  return static_cast<decl_node> (m);
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -22943,17 +23043,17 @@ extern "C" decl_node decl_lookupImp (nameKey_Name n)
 
 extern "C" decl_node decl_lookupModule (nameKey_Name n)
 {
-  decl_node m;
+  decl_node__opaque m;
 
-  m = static_cast<decl_node> (symbolKey_getSymKey (modUniverse, n));
+  m = static_cast<decl_node__opaque> (symbolKey_getSymKey (modUniverse, n));
   if (m == NULL)
     {
       m = makeModule (n);
       symbolKey_putSymKey (modUniverse, n, reinterpret_cast<void *> (m));
       Indexing_IncludeIndiceIntoIndex (modUniverseI, reinterpret_cast<void *> (m));
     }
-  mcDebug_assert (! (decl_isImp (m)));
-  return m;
+  mcDebug_assert (! (decl_isImp (static_cast<decl_node> (m))));
+  return static_cast<decl_node> (m);
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -22966,7 +23066,7 @@ extern "C" decl_node decl_lookupModule (nameKey_Name n)
 extern "C" void decl_putDefForC (decl_node n)
 {
   mcDebug_assert (decl_isDef (n));
-  n->defF.forC = true;
+  static_cast<decl_node__opaque> (n)->defF.forC = true;
 }
 
 
@@ -22976,26 +23076,26 @@ extern "C" void decl_putDefForC (decl_node n)
 
 extern "C" decl_node decl_lookupInScope (decl_node scope, nameKey_Name n)
 {
-  switch (scope->kind)
+  switch (static_cast<decl_node__opaque> (scope)->kind)
     {
       case decl_def:
-        return static_cast<decl_node> (symbolKey_getSymKey (scope->defF.decls.symbols, n));
+        return static_cast<decl_node> (symbolKey_getSymKey (static_cast<decl_node__opaque> (scope)->defF.decls.symbols, n));
         break;
 
       case decl_module:
-        return static_cast<decl_node> (symbolKey_getSymKey (scope->moduleF.decls.symbols, n));
+        return static_cast<decl_node> (symbolKey_getSymKey (static_cast<decl_node__opaque> (scope)->moduleF.decls.symbols, n));
         break;
 
       case decl_imp:
-        return static_cast<decl_node> (symbolKey_getSymKey (scope->impF.decls.symbols, n));
+        return static_cast<decl_node> (symbolKey_getSymKey (static_cast<decl_node__opaque> (scope)->impF.decls.symbols, n));
         break;
 
       case decl_procedure:
-        return static_cast<decl_node> (symbolKey_getSymKey (scope->procedureF.decls.symbols, n));
+        return static_cast<decl_node> (symbolKey_getSymKey (static_cast<decl_node__opaque> (scope)->procedureF.decls.symbols, n));
         break;
 
       case decl_record:
-        return static_cast<decl_node> (symbolKey_getSymKey (scope->recordF.localSymbols, n));
+        return static_cast<decl_node> (symbolKey_getSymKey (static_cast<decl_node__opaque> (scope)->recordF.localSymbols, n));
         break;
 
 
@@ -23015,7 +23115,7 @@ extern "C" decl_node decl_lookupInScope (decl_node scope, nameKey_Name n)
 extern "C" bool decl_isConst (decl_node n)
 {
   mcDebug_assert (n != NULL);
-  return n->kind == decl_const;
+  return static_cast<decl_node__opaque> (n)->kind == decl_const;
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -23028,7 +23128,7 @@ extern "C" bool decl_isConst (decl_node n)
 extern "C" bool decl_isType (decl_node n)
 {
   mcDebug_assert (n != NULL);
-  return n->kind == decl_type;
+  return static_cast<decl_node__opaque> (n)->kind == decl_type;
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -23043,7 +23143,7 @@ extern "C" void decl_putType (decl_node des, decl_node exp)
 {
   mcDebug_assert (des != NULL);
   mcDebug_assert (decl_isType (des));
-  des->typeF.type = exp;
+  static_cast<decl_node__opaque> (des)->typeF.type = static_cast<decl_node__opaque> (exp);
 }
 
 
@@ -23053,31 +23153,31 @@ extern "C" void decl_putType (decl_node des, decl_node exp)
 
 extern "C" decl_node decl_getType (decl_node n)
 {
-  switch (n->kind)
+  switch (static_cast<decl_node__opaque> (n)->kind)
     {
       case decl_new:
       case decl_dispose:
-        return NULL;
+        return static_cast<decl_node> (NULL);
         break;
 
       case decl_length:
-        return cardinalN;
+        return static_cast<decl_node> (cardinalN);
         break;
 
       case decl_inc:
       case decl_dec:
       case decl_incl:
       case decl_excl:
-        return NULL;
+        return static_cast<decl_node> (NULL);
         break;
 
       case decl_nil:
-        return addressN;
+        return static_cast<decl_node> (addressN);
         break;
 
       case decl_true:
       case decl_false:
-        return booleanN;
+        return static_cast<decl_node> (booleanN);
         break;
 
       case decl_address:
@@ -23179,7 +23279,7 @@ extern "C" decl_node decl_getType (decl_node n)
 
       case decl_type:
         /* language features and compound type attributes.  */
-        return n->typeF.type;
+        return static_cast<decl_node> (static_cast<decl_node__opaque> (n)->typeF.type);
         break;
 
       case decl_record:
@@ -23191,7 +23291,7 @@ extern "C" decl_node decl_getType (decl_node n)
         break;
 
       case decl_var:
-        return n->varF.type;
+        return static_cast<decl_node> (static_cast<decl_node__opaque> (n)->varF.type);
         break;
 
       case decl_enumeration:
@@ -23199,43 +23299,43 @@ extern "C" decl_node decl_getType (decl_node n)
         break;
 
       case decl_subrange:
-        return n->subrangeF.type;
+        return static_cast<decl_node> (static_cast<decl_node__opaque> (n)->subrangeF.type);
         break;
 
       case decl_array:
-        return n->arrayF.type;
+        return static_cast<decl_node> (static_cast<decl_node__opaque> (n)->arrayF.type);
         break;
 
       case decl_string:
-        return charN;
+        return static_cast<decl_node> (charN);
         break;
 
       case decl_const:
-        return n->constF.type;
+        return static_cast<decl_node> (static_cast<decl_node__opaque> (n)->constF.type);
         break;
 
       case decl_literal:
-        return n->literalF.type;
+        return static_cast<decl_node> (static_cast<decl_node__opaque> (n)->literalF.type);
         break;
 
       case decl_varparam:
-        return n->varparamF.type;
+        return static_cast<decl_node> (static_cast<decl_node__opaque> (n)->varparamF.type);
         break;
 
       case decl_param:
-        return n->paramF.type;
+        return static_cast<decl_node> (static_cast<decl_node__opaque> (n)->paramF.type);
         break;
 
       case decl_optarg:
-        return n->optargF.type;
+        return static_cast<decl_node> (static_cast<decl_node__opaque> (n)->optargF.type);
         break;
 
       case decl_pointer:
-        return n->pointerF.type;
+        return static_cast<decl_node> (static_cast<decl_node__opaque> (n)->pointerF.type);
         break;
 
       case decl_recordfield:
-        return n->recordfieldF.type;
+        return static_cast<decl_node> (static_cast<decl_node__opaque> (n)->recordfieldF.type);
         break;
 
       case decl_varientfield:
@@ -23243,32 +23343,32 @@ extern "C" decl_node decl_getType (decl_node n)
         break;
 
       case decl_enumerationfield:
-        return n->enumerationfieldF.type;
+        return static_cast<decl_node> (static_cast<decl_node__opaque> (n)->enumerationfieldF.type);
         break;
 
       case decl_set:
-        return n->setF.type;
+        return static_cast<decl_node> (static_cast<decl_node__opaque> (n)->setF.type);
         break;
 
       case decl_proctype:
-        return n->proctypeF.returnType;
+        return static_cast<decl_node> (static_cast<decl_node__opaque> (n)->proctypeF.returnType);
         break;
 
       case decl_subscript:
-        return n->subscriptF.type;
+        return static_cast<decl_node> (static_cast<decl_node__opaque> (n)->subscriptF.type);
         break;
 
       case decl_procedure:
         /* blocks.  */
-        return n->procedureF.returnType;
+        return static_cast<decl_node> (static_cast<decl_node__opaque> (n)->procedureF.returnType);
         break;
 
       case decl_throw:
-        return NULL;
+        return static_cast<decl_node> (NULL);
         break;
 
       case decl_unreachable:
-        return NULL;
+        return static_cast<decl_node> (NULL);
         break;
 
       case decl_def:
@@ -23296,11 +23396,11 @@ extern "C" decl_node decl_getType (decl_node n)
       case decl_mult:
       case decl_divide:
         /* expressions.  */
-        return n->binaryF.resultType;
+        return static_cast<decl_node> (static_cast<decl_node__opaque> (n)->binaryF.resultType);
         break;
 
       case decl_in:
-        return booleanN;
+        return static_cast<decl_node> (booleanN);
         break;
 
       case decl_max:
@@ -23314,7 +23414,7 @@ extern "C" decl_node decl_getType (decl_node n)
       case decl_adr:
       case decl_size:
       case decl_tsize:
-        return n->unaryF.resultType;
+        return static_cast<decl_node> (static_cast<decl_node__opaque> (n)->unaryF.resultType);
         break;
 
       case decl_and:
@@ -23326,51 +23426,51 @@ extern "C" decl_node decl_getType (decl_node n)
       case decl_greater:
       case decl_greequal:
       case decl_lessequal:
-        return booleanN;
+        return static_cast<decl_node> (booleanN);
         break;
 
       case decl_trunc:
-        return integerN;
+        return static_cast<decl_node> (integerN);
         break;
 
       case decl_float:
-        return realN;
+        return static_cast<decl_node> (realN);
         break;
 
       case decl_high:
-        return cardinalN;
+        return static_cast<decl_node> (cardinalN);
         break;
 
       case decl_ord:
-        return cardinalN;
+        return static_cast<decl_node> (cardinalN);
         break;
 
       case decl_chr:
-        return charN;
+        return static_cast<decl_node> (charN);
         break;
 
       case decl_cap:
-        return charN;
+        return static_cast<decl_node> (charN);
         break;
 
       case decl_arrayref:
-        return n->arrayrefF.resultType;
+        return static_cast<decl_node> (static_cast<decl_node__opaque> (n)->arrayrefF.resultType);
         break;
 
       case decl_componentref:
-        return n->componentrefF.resultType;
+        return static_cast<decl_node> (static_cast<decl_node__opaque> (n)->componentrefF.resultType);
         break;
 
       case decl_pointerref:
-        return n->pointerrefF.resultType;
+        return static_cast<decl_node> (static_cast<decl_node__opaque> (n)->pointerrefF.resultType);
         break;
 
       case decl_funccall:
-        return n->funccallF.type;
+        return static_cast<decl_node> (static_cast<decl_node__opaque> (n)->funccallF.type);
         break;
 
       case decl_setvalue:
-        return n->setvalueF.type;
+        return static_cast<decl_node> (static_cast<decl_node__opaque> (n)->setvalueF.type);
         break;
 
 
@@ -23413,13 +23513,13 @@ extern "C" decl_node decl_skipType (decl_node n)
 
 extern "C" void decl_putTypeHidden (decl_node des)
 {
-  decl_node s;
+  decl_node__opaque s;
 
   mcDebug_assert (des != NULL);
   mcDebug_assert (decl_isType (des));
-  des->typeF.isHidden = true;
-  s = decl_getScope (des);
-  mcDebug_assert (decl_isDef (s));
+  static_cast<decl_node__opaque> (des)->typeF.isHidden = true;
+  s = static_cast<decl_node__opaque> (decl_getScope (des));
+  mcDebug_assert (decl_isDef (static_cast<decl_node> (s)));
   s->defF.hasHidden = true;
 }
 
@@ -23432,7 +23532,7 @@ extern "C" bool decl_isTypeHidden (decl_node n)
 {
   mcDebug_assert (n != NULL);
   mcDebug_assert (decl_isType (n));
-  return n->typeF.isHidden;
+  return static_cast<decl_node__opaque> (n)->typeF.isHidden;
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -23445,7 +23545,36 @@ extern "C" bool decl_isTypeHidden (decl_node n)
 extern "C" bool decl_hasHidden (decl_node n)
 {
   mcDebug_assert (decl_isDef (n));
-  return n->defF.hasHidden;
+  return static_cast<decl_node__opaque> (n)->defF.hasHidden;
+  /* static analysis guarentees a RETURN statement will be used before here.  */
+  __builtin_unreachable ();
+}
+
+
+/*
+   putTypeOpaque - marks type, des, as being an opaque type.
+                   TYPE des ;
+*/
+
+extern "C" void decl_putTypeOpaque (decl_node des)
+{
+  decl_node__opaque s;
+
+  mcDebug_assert (des != NULL);
+  mcDebug_assert (decl_isType (des));
+  static_cast<decl_node__opaque> (des)->typeF.isOpaque = true;
+}
+
+
+/*
+   isTypeOpaque - returns TRUE if type, n, is an opaque type.
+*/
+
+extern "C" bool decl_isTypeOpaque (decl_node n)
+{
+  mcDebug_assert (n != NULL);
+  mcDebug_assert (decl_isType (n));
+  return static_cast<decl_node__opaque> (n)->typeF.isOpaque;
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -23458,7 +23587,7 @@ extern "C" bool decl_hasHidden (decl_node n)
 extern "C" bool decl_isVar (decl_node n)
 {
   mcDebug_assert (n != NULL);
-  return n->kind == decl_var;
+  return static_cast<decl_node__opaque> (n)->kind == decl_var;
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -23483,9 +23612,9 @@ extern "C" bool decl_isTemporary (decl_node n)
 
 extern "C" bool decl_isExported (decl_node n)
 {
-  decl_node s;
+  decl_node__opaque s;
 
-  s = decl_getScope (n);
+  s = static_cast<decl_node__opaque> (decl_getScope (n));
   if (s != NULL)
     {
       switch (s->kind)
@@ -23528,7 +23657,7 @@ extern "C" decl_node decl_getDeclScope (void)
 
 extern "C" decl_node decl_getScope (decl_node n)
 {
-  switch (n->kind)
+  switch (static_cast<decl_node__opaque> (n)->kind)
     {
       case decl_stmtseq:
       case decl_exit:
@@ -23547,7 +23676,7 @@ extern "C" decl_node decl_getScope (decl_node n)
       case decl_nil:
       case decl_true:
       case decl_false:
-        return NULL;
+        return static_cast<decl_node> (NULL);
         break;
 
       case decl_address:
@@ -23556,7 +23685,7 @@ extern "C" decl_node decl_getScope (decl_node n)
       case decl_word:
       case decl_csizet:
       case decl_cssizet:
-        return systemN;
+        return static_cast<decl_node> (systemN);
         break;
 
       case decl_boolean:
@@ -23578,93 +23707,93 @@ extern "C" decl_node decl_getScope (decl_node n)
       case decl_longcomplex:
       case decl_shortcomplex:
         /* base types.  */
-        return NULL;
+        return static_cast<decl_node> (NULL);
         break;
 
       case decl_type:
         /* language features and compound type attributes.  */
-        return n->typeF.scope;
+        return static_cast<decl_node> (static_cast<decl_node__opaque> (n)->typeF.scope);
         break;
 
       case decl_record:
-        return n->recordF.scope;
+        return static_cast<decl_node> (static_cast<decl_node__opaque> (n)->recordF.scope);
         break;
 
       case decl_varient:
-        return n->varientF.scope;
+        return static_cast<decl_node> (static_cast<decl_node__opaque> (n)->varientF.scope);
         break;
 
       case decl_var:
-        return n->varF.scope;
+        return static_cast<decl_node> (static_cast<decl_node__opaque> (n)->varF.scope);
         break;
 
       case decl_enumeration:
-        return n->enumerationF.scope;
+        return static_cast<decl_node> (static_cast<decl_node__opaque> (n)->enumerationF.scope);
         break;
 
       case decl_subrange:
-        return n->subrangeF.scope;
+        return static_cast<decl_node> (static_cast<decl_node__opaque> (n)->subrangeF.scope);
         break;
 
       case decl_array:
-        return n->arrayF.scope;
+        return static_cast<decl_node> (static_cast<decl_node__opaque> (n)->arrayF.scope);
         break;
 
       case decl_string:
-        return NULL;
+        return static_cast<decl_node> (NULL);
         break;
 
       case decl_const:
-        return n->constF.scope;
+        return static_cast<decl_node> (static_cast<decl_node__opaque> (n)->constF.scope);
         break;
 
       case decl_literal:
-        return NULL;
+        return static_cast<decl_node> (NULL);
         break;
 
       case decl_varparam:
-        return n->varparamF.scope;
+        return static_cast<decl_node> (static_cast<decl_node__opaque> (n)->varparamF.scope);
         break;
 
       case decl_param:
-        return n->paramF.scope;
+        return static_cast<decl_node> (static_cast<decl_node__opaque> (n)->paramF.scope);
         break;
 
       case decl_optarg:
-        return n->optargF.scope;
+        return static_cast<decl_node> (static_cast<decl_node__opaque> (n)->optargF.scope);
         break;
 
       case decl_pointer:
-        return n->pointerF.scope;
+        return static_cast<decl_node> (static_cast<decl_node__opaque> (n)->pointerF.scope);
         break;
 
       case decl_recordfield:
-        return n->recordfieldF.scope;
+        return static_cast<decl_node> (static_cast<decl_node__opaque> (n)->recordfieldF.scope);
         break;
 
       case decl_varientfield:
-        return n->varientfieldF.scope;
+        return static_cast<decl_node> (static_cast<decl_node__opaque> (n)->varientfieldF.scope);
         break;
 
       case decl_enumerationfield:
-        return n->enumerationfieldF.scope;
+        return static_cast<decl_node> (static_cast<decl_node__opaque> (n)->enumerationfieldF.scope);
         break;
 
       case decl_set:
-        return n->setF.scope;
+        return static_cast<decl_node> (static_cast<decl_node__opaque> (n)->setF.scope);
         break;
 
       case decl_proctype:
-        return n->proctypeF.scope;
+        return static_cast<decl_node> (static_cast<decl_node__opaque> (n)->proctypeF.scope);
         break;
 
       case decl_subscript:
-        return NULL;
+        return static_cast<decl_node> (NULL);
         break;
 
       case decl_procedure:
         /* blocks.  */
-        return n->procedureF.scope;
+        return static_cast<decl_node> (static_cast<decl_node__opaque> (n)->procedureF.scope);
         break;
 
       case decl_def:
@@ -23679,7 +23808,7 @@ extern "C" decl_node decl_getScope (decl_node n)
       case decl_elsif:
       case decl_assignment:
         /* statements.  */
-        return NULL;
+        return static_cast<decl_node> (NULL);
         break;
 
       case decl_componentref:
@@ -23701,11 +23830,11 @@ extern "C" decl_node decl_getScope (decl_node n)
       case decl_divide:
       case decl_in:
         /* expressions.  */
-        return NULL;
+        return static_cast<decl_node> (NULL);
         break;
 
       case decl_neg:
-        return NULL;
+        return static_cast<decl_node> (NULL);
         break;
 
       case decl_lsl:
@@ -23725,14 +23854,14 @@ extern "C" decl_node decl_getScope (decl_node n)
       case decl_greater:
       case decl_greequal:
       case decl_lessequal:
-        return NULL;
+        return static_cast<decl_node> (NULL);
         break;
 
       case decl_adr:
       case decl_size:
       case decl_tsize:
       case decl_throw:
-        return systemN;
+        return static_cast<decl_node> (systemN);
         break;
 
       case decl_unreachable:
@@ -23741,35 +23870,35 @@ extern "C" decl_node decl_getScope (decl_node n)
       case decl_im:
       case decl_min:
       case decl_max:
-        return NULL;
+        return static_cast<decl_node> (NULL);
         break;
 
       case decl_vardecl:
-        return n->vardeclF.scope;
+        return static_cast<decl_node> (static_cast<decl_node__opaque> (n)->vardeclF.scope);
         break;
 
       case decl_funccall:
-        return NULL;
+        return static_cast<decl_node> (NULL);
         break;
 
       case decl_explist:
-        return NULL;
+        return static_cast<decl_node> (NULL);
         break;
 
       case decl_caselabellist:
-        return NULL;
+        return static_cast<decl_node> (NULL);
         break;
 
       case decl_caselist:
-        return NULL;
+        return static_cast<decl_node> (NULL);
         break;
 
       case decl_range:
-        return NULL;
+        return static_cast<decl_node> (NULL);
         break;
 
       case decl_varargs:
-        return n->varargsF.scope;
+        return static_cast<decl_node> (static_cast<decl_node__opaque> (n)->varargsF.scope);
         break;
 
 
@@ -23789,7 +23918,7 @@ extern "C" decl_node decl_getScope (decl_node n)
 extern "C" bool decl_isLiteral (decl_node n)
 {
   mcDebug_assert (n != NULL);
-  return n->kind == decl_literal;
+  return static_cast<decl_node__opaque> (n)->kind == decl_literal;
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -23819,7 +23948,7 @@ extern "C" bool decl_isConstSet (decl_node n)
 extern "C" bool decl_isEnumerationField (decl_node n)
 {
   mcDebug_assert (n != NULL);
-  return n->kind == decl_enumerationfield;
+  return static_cast<decl_node__opaque> (n)->kind == decl_enumerationfield;
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -23832,7 +23961,7 @@ extern "C" bool decl_isEnumerationField (decl_node n)
 extern "C" bool decl_isEnumeration (decl_node n)
 {
   mcDebug_assert (n != NULL);
-  return n->kind == decl_enumeration;
+  return static_cast<decl_node__opaque> (n)->kind == decl_enumeration;
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -23845,7 +23974,7 @@ extern "C" bool decl_isEnumeration (decl_node n)
 extern "C" bool decl_isUnbounded (decl_node n)
 {
   mcDebug_assert (n != NULL);
-  return (n->kind == decl_array) && n->arrayF.isUnbounded;
+  return (static_cast<decl_node__opaque> (n)->kind == decl_array) && static_cast<decl_node__opaque> (n)->arrayF.isUnbounded;
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -23858,7 +23987,7 @@ extern "C" bool decl_isUnbounded (decl_node n)
 extern "C" bool decl_isParameter (decl_node n)
 {
   mcDebug_assert (n != NULL);
-  return (n->kind == decl_param) || (n->kind == decl_varparam);
+  return (static_cast<decl_node__opaque> (n)->kind == decl_param) || (static_cast<decl_node__opaque> (n)->kind == decl_varparam);
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -23871,7 +24000,7 @@ extern "C" bool decl_isParameter (decl_node n)
 extern "C" bool decl_isVarParam (decl_node n)
 {
   mcDebug_assert (n != NULL);
-  return n->kind == decl_varparam;
+  return static_cast<decl_node__opaque> (n)->kind == decl_varparam;
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -23884,7 +24013,7 @@ extern "C" bool decl_isVarParam (decl_node n)
 extern "C" bool decl_isParam (decl_node n)
 {
   mcDebug_assert (n != NULL);
-  return n->kind == decl_param;
+  return static_cast<decl_node__opaque> (n)->kind == decl_param;
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -23910,19 +24039,19 @@ extern "C" bool decl_isNonVarParam (decl_node n)
 
 extern "C" decl_node decl_addOptParameter (decl_node proc, nameKey_Name id, decl_node type, decl_node init)
 {
-  decl_node p;
-  decl_node l;
+  decl_node__opaque p;
+  decl_node__opaque l;
 
   mcDebug_assert (decl_isProcedure (proc));
-  l = decl_makeIdentList ();
-  mcDebug_assert (decl_putIdent (l, id));
-  checkMakeVariables (proc, l, type, false, true);
-  if (! proc->procedureF.checking)
+  l = static_cast<decl_node__opaque> (decl_makeIdentList ());
+  mcDebug_assert (decl_putIdent (static_cast<decl_node> (l), id));
+  checkMakeVariables (static_cast<decl_node__opaque> (proc), l, static_cast<decl_node__opaque> (type), false, true);
+  if (! static_cast<decl_node__opaque> (proc)->procedureF.checking)
     {
-      p = makeOptParameter (l, type, init);
-      decl_addParameter (proc, p);
+      p = makeOptParameter (l, static_cast<decl_node__opaque> (type), static_cast<decl_node__opaque> (init));
+      decl_addParameter (proc, static_cast<decl_node> (p));
     }
-  return p;
+  return static_cast<decl_node> (p);
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -23934,7 +24063,7 @@ extern "C" decl_node decl_addOptParameter (decl_node proc, nameKey_Name id, decl
 
 extern "C" bool decl_isOptarg (decl_node n)
 {
-  return n->kind == decl_optarg;
+  return static_cast<decl_node__opaque> (n)->kind == decl_optarg;
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -23947,7 +24076,7 @@ extern "C" bool decl_isOptarg (decl_node n)
 extern "C" bool decl_isRecord (decl_node n)
 {
   mcDebug_assert (n != NULL);
-  return n->kind == decl_record;
+  return static_cast<decl_node__opaque> (n)->kind == decl_record;
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -23960,7 +24089,7 @@ extern "C" bool decl_isRecord (decl_node n)
 extern "C" bool decl_isRecordField (decl_node n)
 {
   mcDebug_assert (n != NULL);
-  return n->kind == decl_recordfield;
+  return static_cast<decl_node__opaque> (n)->kind == decl_recordfield;
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -23973,7 +24102,7 @@ extern "C" bool decl_isRecordField (decl_node n)
 extern "C" bool decl_isVarientField (decl_node n)
 {
   mcDebug_assert (n != NULL);
-  return n->kind == decl_varientfield;
+  return static_cast<decl_node__opaque> (n)->kind == decl_varientfield;
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -23986,7 +24115,7 @@ extern "C" bool decl_isVarientField (decl_node n)
 extern "C" bool decl_isArray (decl_node n)
 {
   mcDebug_assert (n != NULL);
-  return n->kind == decl_array;
+  return static_cast<decl_node__opaque> (n)->kind == decl_array;
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -23999,7 +24128,7 @@ extern "C" bool decl_isArray (decl_node n)
 extern "C" bool decl_isProcType (decl_node n)
 {
   mcDebug_assert (n != NULL);
-  return n->kind == decl_proctype;
+  return static_cast<decl_node__opaque> (n)->kind == decl_proctype;
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -24012,7 +24141,7 @@ extern "C" bool decl_isProcType (decl_node n)
 extern "C" bool decl_isPointer (decl_node n)
 {
   mcDebug_assert (n != NULL);
-  return n->kind == decl_pointer;
+  return static_cast<decl_node__opaque> (n)->kind == decl_pointer;
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -24025,7 +24154,7 @@ extern "C" bool decl_isPointer (decl_node n)
 extern "C" bool decl_isProcedure (decl_node n)
 {
   mcDebug_assert (n != NULL);
-  return n->kind == decl_procedure;
+  return static_cast<decl_node__opaque> (n)->kind == decl_procedure;
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -24038,7 +24167,7 @@ extern "C" bool decl_isProcedure (decl_node n)
 extern "C" bool decl_isVarient (decl_node n)
 {
   mcDebug_assert (n != NULL);
-  return n->kind == decl_varient;
+  return static_cast<decl_node__opaque> (n)->kind == decl_varient;
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -24051,7 +24180,7 @@ extern "C" bool decl_isVarient (decl_node n)
 extern "C" bool decl_isSet (decl_node n)
 {
   mcDebug_assert (n != NULL);
-  return n->kind == decl_set;
+  return static_cast<decl_node__opaque> (n)->kind == decl_set;
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -24064,7 +24193,7 @@ extern "C" bool decl_isSet (decl_node n)
 extern "C" bool decl_isSubrange (decl_node n)
 {
   mcDebug_assert (n != NULL);
-  return n->kind == decl_subrange;
+  return static_cast<decl_node__opaque> (n)->kind == decl_subrange;
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -24100,14 +24229,14 @@ extern "C" bool decl_isRtype (decl_node n)
 
 extern "C" decl_node decl_makeConst (nameKey_Name n)
 {
-  decl_node d;
+  decl_node__opaque d;
 
   d = newNode (decl_const);
   d->constF.name = n;
-  d->constF.type = NULL;
-  d->constF.scope = decl_getDeclScope ();
-  d->constF.value = NULL;
-  return addToScope (d);
+  d->constF.type = static_cast<decl_node__opaque> (NULL);
+  d->constF.scope = static_cast<decl_node__opaque> (decl_getDeclScope ());
+  d->constF.value = static_cast<decl_node__opaque> (NULL);
+  return static_cast<decl_node> (addToScope (d));
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -24120,7 +24249,7 @@ extern "C" decl_node decl_makeConst (nameKey_Name n)
 extern "C" void decl_putConst (decl_node n, decl_node v)
 {
   mcDebug_assert (decl_isConst (n));
-  n->constF.value = v;
+  static_cast<decl_node__opaque> (n)->constF.value = static_cast<decl_node__opaque> (v);
 }
 
 
@@ -24130,15 +24259,16 @@ extern "C" void decl_putConst (decl_node n, decl_node v)
 
 extern "C" decl_node decl_makeType (nameKey_Name n)
 {
-  decl_node d;
+  decl_node__opaque d;
 
   d = newNode (decl_type);
   d->typeF.name = n;
-  d->typeF.type = NULL;
-  d->typeF.scope = decl_getDeclScope ();
+  d->typeF.type = static_cast<decl_node__opaque> (NULL);
+  d->typeF.scope = static_cast<decl_node__opaque> (decl_getDeclScope ());
+  d->typeF.isOpaque = false;
   d->typeF.isHidden = false;
   d->typeF.isInternal = false;
-  return addToScope (d);
+  return static_cast<decl_node> (addToScope (d));
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -24151,22 +24281,23 @@ extern "C" decl_node decl_makeType (nameKey_Name n)
 
 extern "C" decl_node decl_makeTypeImp (nameKey_Name n)
 {
-  decl_node d;
+  decl_node__opaque d;
 
-  d = decl_lookupSym (n);
+  d = static_cast<decl_node__opaque> (decl_lookupSym (n));
   if (d != NULL)
     {
       d->typeF.isHidden = false;
-      return addToScope (d);
+      return static_cast<decl_node> (addToScope (d));
     }
   else
     {
       d = newNode (decl_type);
       d->typeF.name = n;
-      d->typeF.type = NULL;
-      d->typeF.scope = decl_getDeclScope ();
+      d->typeF.type = static_cast<decl_node__opaque> (NULL);
+      d->typeF.scope = static_cast<decl_node__opaque> (decl_getDeclScope ());
+      d->typeF.isOpaque = false;
       d->typeF.isHidden = false;
-      return addToScope (d);
+      return static_cast<decl_node> (addToScope (d));
     }
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
@@ -24179,18 +24310,18 @@ extern "C" decl_node decl_makeTypeImp (nameKey_Name n)
 
 extern "C" decl_node decl_makeVar (nameKey_Name n)
 {
-  decl_node d;
+  decl_node__opaque d;
 
   d = newNode (decl_var);
   d->varF.name = n;
-  d->varF.type = NULL;
-  d->varF.decl = NULL;
-  d->varF.scope = decl_getDeclScope ();
+  d->varF.type = static_cast<decl_node__opaque> (NULL);
+  d->varF.decl = static_cast<decl_node__opaque> (NULL);
+  d->varF.scope = static_cast<decl_node__opaque> (decl_getDeclScope ());
   d->varF.isInitialised = false;
   d->varF.isParameter = false;
   d->varF.isVarParameter = false;
   initCname (&d->varF.cname);
-  return addToScope (d);
+  return static_cast<decl_node> (addToScope (d));
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -24204,8 +24335,9 @@ extern "C" void decl_putVar (decl_node var, decl_node type, decl_node decl)
 {
   mcDebug_assert (var != NULL);
   mcDebug_assert (decl_isVar (var));
-  var->varF.type = type;
-  var->varF.decl = decl;
+  static_cast<decl_node__opaque> (var)->varF.type = static_cast<decl_node__opaque> (type);
+  static_cast<decl_node__opaque> (var)->varF.decl = static_cast<decl_node__opaque> (decl);
+  initNodeOpaqueState (static_cast<decl_node__opaque> (var));
 }
 
 
@@ -24216,26 +24348,26 @@ extern "C" void decl_putVar (decl_node var, decl_node type, decl_node decl)
 
 extern "C" decl_node decl_makeVarDecl (decl_node i, decl_node type)
 {
-  decl_node d;
-  decl_node v;
+  decl_node__opaque d;
+  decl_node__opaque v;
   unsigned int j;
   unsigned int n;
 
-  type = checkPtr (type);
+  type = static_cast<decl_node> (checkPtr (static_cast<decl_node__opaque> (type)));
   d = newNode (decl_vardecl);
-  d->vardeclF.names = i->identlistF.names;
-  d->vardeclF.type = type;
-  d->vardeclF.scope = decl_getDeclScope ();
+  d->vardeclF.names = static_cast<decl_node__opaque> (i)->identlistF.names;
+  d->vardeclF.type = static_cast<decl_node__opaque> (type);
+  d->vardeclF.scope = static_cast<decl_node__opaque> (decl_getDeclScope ());
   n = wlists_noOfItemsInList (d->vardeclF.names);
   j = 1;
   while (j <= n)
     {
-      v = decl_lookupSym (wlists_getItemFromList (d->vardeclF.names, j));
-      mcDebug_assert (decl_isVar (v));
-      decl_putVar (v, type, d);
+      v = static_cast<decl_node__opaque> (decl_lookupSym (wlists_getItemFromList (d->vardeclF.names, j)));
+      mcDebug_assert (decl_isVar (static_cast<decl_node> (v)));
+      decl_putVar (static_cast<decl_node> (v), type, static_cast<decl_node> (d));
       j += 1;
     }
-  return d;
+  return static_cast<decl_node> (d);
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -24247,13 +24379,13 @@ extern "C" decl_node decl_makeVarDecl (decl_node i, decl_node type)
 
 extern "C" decl_node decl_makeEnum (void)
 {
-  if ((currentModule != NULL) && (decl_getEnumsComplete (currentModule)))
+  if ((currentModule != NULL) && (decl_getEnumsComplete (static_cast<decl_node> (currentModule))))
     {
       return decl_getNextEnum ();
     }
   else
     {
-      return doMakeEnum ();
+      return static_cast<decl_node> (doMakeEnum ());
     }
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
@@ -24266,13 +24398,13 @@ extern "C" decl_node decl_makeEnum (void)
 
 extern "C" decl_node decl_makeEnumField (decl_node e, nameKey_Name n)
 {
-  if ((currentModule != NULL) && (decl_getEnumsComplete (currentModule)))
+  if ((currentModule != NULL) && (decl_getEnumsComplete (static_cast<decl_node> (currentModule))))
     {
       return decl_getNextEnum ();
     }
   else
     {
-      return doMakeEnumField (e, n);
+      return static_cast<decl_node> (doMakeEnumField (static_cast<decl_node__opaque> (e), n));
     }
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
@@ -24285,14 +24417,14 @@ extern "C" decl_node decl_makeEnumField (decl_node e, nameKey_Name n)
 
 extern "C" decl_node decl_makeSubrange (decl_node low, decl_node high)
 {
-  decl_node n;
+  decl_node__opaque n;
 
   n = newNode (decl_subrange);
-  n->subrangeF.low = low;
-  n->subrangeF.high = high;
-  n->subrangeF.type = NULL;
-  n->subrangeF.scope = decl_getDeclScope ();
-  return n;
+  n->subrangeF.low = static_cast<decl_node__opaque> (low);
+  n->subrangeF.high = static_cast<decl_node__opaque> (high);
+  n->subrangeF.type = static_cast<decl_node__opaque> (NULL);
+  n->subrangeF.scope = static_cast<decl_node__opaque> (decl_getDeclScope ());
+  return static_cast<decl_node> (n);
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -24305,7 +24437,7 @@ extern "C" decl_node decl_makeSubrange (decl_node low, decl_node high)
 extern "C" void decl_putSubrangeType (decl_node sub, decl_node type)
 {
   mcDebug_assert (decl_isSubrange (sub));
-  sub->subrangeF.type = type;
+  static_cast<decl_node__opaque> (sub)->subrangeF.type = static_cast<decl_node__opaque> (type);
 }
 
 
@@ -24315,12 +24447,12 @@ extern "C" void decl_putSubrangeType (decl_node sub, decl_node type)
 
 extern "C" decl_node decl_makePointer (decl_node type)
 {
-  decl_node n;
+  decl_node__opaque n;
 
   n = newNode (decl_pointer);
-  n->pointerF.type = type;
-  n->pointerF.scope = decl_getDeclScope ();
-  return n;
+  n->pointerF.type = static_cast<decl_node__opaque> (type);
+  n->pointerF.scope = static_cast<decl_node__opaque> (decl_getDeclScope ());
+  return static_cast<decl_node> (n);
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -24332,12 +24464,12 @@ extern "C" decl_node decl_makePointer (decl_node type)
 
 extern "C" decl_node decl_makeSet (decl_node type)
 {
-  decl_node n;
+  decl_node__opaque n;
 
   n = newNode (decl_set);
-  n->setF.type = type;
-  n->setF.scope = decl_getDeclScope ();
-  return n;
+  n->setF.type = static_cast<decl_node__opaque> (type);
+  n->setF.scope = static_cast<decl_node__opaque> (decl_getDeclScope ());
+  return static_cast<decl_node> (n);
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -24349,17 +24481,17 @@ extern "C" decl_node decl_makeSet (decl_node type)
 
 extern "C" decl_node decl_makeArray (decl_node subr, decl_node type)
 {
-  decl_node n;
-  decl_node s;
+  decl_node__opaque n;
+  decl_node__opaque s;
 
-  s = decl_skipType (subr);
-  mcDebug_assert (((decl_isSubrange (s)) || (isOrdinal (s))) || (decl_isEnumeration (s)));
+  s = static_cast<decl_node__opaque> (decl_skipType (subr));
+  mcDebug_assert (((decl_isSubrange (static_cast<decl_node> (s))) || (isOrdinal (s))) || (decl_isEnumeration (static_cast<decl_node> (s))));
   n = newNode (decl_array);
-  n->arrayF.subr = subr;
-  n->arrayF.type = type;
-  n->arrayF.scope = decl_getDeclScope ();
+  n->arrayF.subr = static_cast<decl_node__opaque> (subr);
+  n->arrayF.type = static_cast<decl_node__opaque> (type);
+  n->arrayF.scope = static_cast<decl_node__opaque> (decl_getDeclScope ());
   n->arrayF.isUnbounded = false;
-  return n;
+  return static_cast<decl_node> (n);
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -24371,8 +24503,8 @@ extern "C" decl_node decl_makeArray (decl_node subr, decl_node type)
 
 extern "C" void decl_putUnbounded (decl_node n)
 {
-  mcDebug_assert (n->kind == decl_array);
-  n->arrayF.isUnbounded = true;
+  mcDebug_assert (static_cast<decl_node__opaque> (n)->kind == decl_array);
+  static_cast<decl_node__opaque> (n)->arrayF.isUnbounded = true;
 }
 
 
@@ -24382,13 +24514,13 @@ extern "C" void decl_putUnbounded (decl_node n)
 
 extern "C" decl_node decl_makeRecord (void)
 {
-  decl_node n;
+  decl_node__opaque n;
 
   n = newNode (decl_record);
   n->recordF.localSymbols = symbolKey_initTree ();
   n->recordF.listOfSons = Indexing_InitIndex (1);
-  n->recordF.scope = decl_getDeclScope ();
-  return n;
+  n->recordF.scope = static_cast<decl_node__opaque> (decl_getDeclScope ());
+  return static_cast<decl_node> (n);
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -24401,30 +24533,30 @@ extern "C" decl_node decl_makeRecord (void)
 
 extern "C" decl_node decl_makeVarient (decl_node r)
 {
-  decl_node n;
+  decl_node__opaque n;
 
   n = newNode (decl_varient);
   n->varientF.listOfSons = Indexing_InitIndex (1);
   /* if so use this   n^.varientF.parent := r  */
   if (decl_isRecord (r))
     {
-      n->varientF.varient = NULL;
+      n->varientF.varient = static_cast<decl_node__opaque> (NULL);
     }
   else
     {
-      n->varientF.varient = r;
+      n->varientF.varient = static_cast<decl_node__opaque> (r);
     }
-  n->varientF.tag = NULL;
-  n->varientF.scope = decl_getDeclScope ();
-  switch (r->kind)
+  n->varientF.tag = static_cast<decl_node__opaque> (NULL);
+  n->varientF.scope = static_cast<decl_node__opaque> (decl_getDeclScope ());
+  switch (static_cast<decl_node__opaque> (r)->kind)
     {
       case decl_record:
         /* now add, n, to the record/varient, r, field list  */
-        Indexing_IncludeIndiceIntoIndex (r->recordF.listOfSons, reinterpret_cast<void *> (n));
+        Indexing_IncludeIndiceIntoIndex (static_cast<decl_node__opaque> (r)->recordF.listOfSons, reinterpret_cast<void *> (n));
         break;
 
       case decl_varientfield:
-        Indexing_IncludeIndiceIntoIndex (r->varientfieldF.listOfSons, reinterpret_cast<void *> (n));
+        Indexing_IncludeIndiceIntoIndex (static_cast<decl_node__opaque> (r)->varientfieldF.listOfSons, reinterpret_cast<void *> (n));
         break;
 
 
@@ -24432,7 +24564,7 @@ extern "C" decl_node decl_makeVarient (decl_node r)
         CaseException ("../../gcc/m2/mc/decl.def", 20, 1);
         __builtin_unreachable ();
     }
-  return n;
+  return static_cast<decl_node> (n);
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -24445,33 +24577,33 @@ extern "C" decl_node decl_makeVarient (decl_node r)
 
 extern "C" decl_node decl_addFieldsToRecord (decl_node r, decl_node v, decl_node i, decl_node t)
 {
-  decl_node p;
-  decl_node fj;
+  decl_node__opaque p;
+  decl_node__opaque fj;
   unsigned int j;
   unsigned int n;
   nameKey_Name fn;
 
   if (decl_isRecord (r))
     {
-      p = r;
-      v = NULL;
+      p = static_cast<decl_node__opaque> (r);
+      v = static_cast<decl_node> (NULL);
     }
   else
     {
-      p = getRecord (getParent (r));
+      p = getRecord (getParent (static_cast<decl_node__opaque> (r)));
       mcDebug_assert (decl_isVarientField (r));
       mcDebug_assert (decl_isVarient (v));
-      putFieldVarient (r, v);
+      putFieldVarient (static_cast<decl_node__opaque> (r), static_cast<decl_node__opaque> (v));
     }
-  n = wlists_noOfItemsInList (i->identlistF.names);
+  n = wlists_noOfItemsInList (static_cast<decl_node__opaque> (i)->identlistF.names);
   j = 1;
   while (j <= n)
     {
-      fn = static_cast<nameKey_Name> (wlists_getItemFromList (i->identlistF.names, j));
-      fj = static_cast<decl_node> (symbolKey_getSymKey (p->recordF.localSymbols, n));
+      fn = static_cast<nameKey_Name> (wlists_getItemFromList (static_cast<decl_node__opaque> (i)->identlistF.names, j));
+      fj = static_cast<decl_node__opaque> (symbolKey_getSymKey (p->recordF.localSymbols, n));
       if (fj == NULL)
         {
-          fj = putFieldRecord (r, fn, t, v);
+          fj = putFieldRecord (static_cast<decl_node__opaque> (r), fn, static_cast<decl_node__opaque> (t), static_cast<decl_node__opaque> (v));
         }
       else
         {
@@ -24493,7 +24625,7 @@ extern "C" decl_node decl_addFieldsToRecord (decl_node r, decl_node v, decl_node
 
 extern "C" void decl_buildVarientSelector (decl_node r, decl_node v, nameKey_Name tag, decl_node type)
 {
-  decl_node f;
+  decl_node__opaque f;
 
   mcDebug_assert ((decl_isRecord (r)) || (decl_isVarientField (r)));
   if ((decl_isRecord (r)) || (decl_isVarientField (r)))
@@ -24506,16 +24638,16 @@ extern "C" void decl_buildVarientSelector (decl_node r, decl_node v, nameKey_Nam
       else if (type == NULL)
         {
           /* avoid dangling else.  */
-          f = decl_lookupSym (tag);
-          putVarientTag (v, f);
+          f = static_cast<decl_node__opaque> (decl_lookupSym (tag));
+          putVarientTag (static_cast<decl_node__opaque> (v), f);
         }
       else
         {
           /* avoid dangling else.  */
-          f = putFieldRecord (r, tag, type, v);
-          mcDebug_assert (decl_isRecordField (f));
+          f = putFieldRecord (static_cast<decl_node__opaque> (r), tag, static_cast<decl_node__opaque> (type), static_cast<decl_node__opaque> (v));
+          mcDebug_assert (decl_isRecordField (static_cast<decl_node> (f)));
           f->recordfieldF.tag = true;
-          putVarientTag (v, f);
+          putVarientTag (static_cast<decl_node__opaque> (v), f);
         }
     }
 }
@@ -24528,13 +24660,13 @@ extern "C" void decl_buildVarientSelector (decl_node r, decl_node v, nameKey_Nam
 
 extern "C" decl_node decl_buildVarientFieldRecord (decl_node v, decl_node p)
 {
-  decl_node f;
+  decl_node__opaque f;
 
   mcDebug_assert (decl_isVarient (v));
-  f = makeVarientField (v, p);
-  mcDebug_assert (decl_isVarientField (f));
-  putFieldVarient (f, v);
-  return f;
+  f = makeVarientField (static_cast<decl_node__opaque> (v), static_cast<decl_node__opaque> (p));
+  mcDebug_assert (decl_isVarientField (static_cast<decl_node> (f)));
+  putFieldVarient (f, static_cast<decl_node__opaque> (v));
+  return static_cast<decl_node> (f);
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -24546,7 +24678,7 @@ extern "C" decl_node decl_buildVarientFieldRecord (decl_node v, decl_node p)
 
 extern "C" nameKey_Name decl_getSymName (decl_node n)
 {
-  switch (n->kind)
+  switch (static_cast<decl_node__opaque> (n)->kind)
     {
       case decl_new:
         return nameKey_makeKey ((const char *) "NEW", 3);
@@ -24687,7 +24819,7 @@ extern "C" nameKey_Name decl_getSymName (decl_node n)
 
       case decl_type:
         /* language features and compound type attributes.  */
-        return n->typeF.name;
+        return static_cast<decl_node__opaque> (n)->typeF.name;
         break;
 
       case decl_record:
@@ -24699,7 +24831,7 @@ extern "C" nameKey_Name decl_getSymName (decl_node n)
         break;
 
       case decl_var:
-        return n->varF.name;
+        return static_cast<decl_node__opaque> (n)->varF.name;
         break;
 
       case decl_enumeration:
@@ -24719,15 +24851,15 @@ extern "C" nameKey_Name decl_getSymName (decl_node n)
         break;
 
       case decl_string:
-        return n->stringF.name;
+        return static_cast<decl_node__opaque> (n)->stringF.name;
         break;
 
       case decl_const:
-        return n->constF.name;
+        return static_cast<decl_node__opaque> (n)->constF.name;
         break;
 
       case decl_literal:
-        return n->literalF.name;
+        return static_cast<decl_node__opaque> (n)->literalF.name;
         break;
 
       case decl_varparam:
@@ -24743,15 +24875,15 @@ extern "C" nameKey_Name decl_getSymName (decl_node n)
         break;
 
       case decl_recordfield:
-        return n->recordfieldF.name;
+        return static_cast<decl_node__opaque> (n)->recordfieldF.name;
         break;
 
       case decl_varientfield:
-        return n->varientfieldF.name;
+        return static_cast<decl_node__opaque> (n)->varientfieldF.name;
         break;
 
       case decl_enumerationfield:
-        return n->enumerationfieldF.name;
+        return static_cast<decl_node__opaque> (n)->enumerationfieldF.name;
         break;
 
       case decl_set:
@@ -24768,19 +24900,19 @@ extern "C" nameKey_Name decl_getSymName (decl_node n)
 
       case decl_procedure:
         /* blocks.  */
-        return n->procedureF.name;
+        return static_cast<decl_node__opaque> (n)->procedureF.name;
         break;
 
       case decl_def:
-        return n->defF.name;
+        return static_cast<decl_node__opaque> (n)->defF.name;
         break;
 
       case decl_imp:
-        return n->impF.name;
+        return static_cast<decl_node__opaque> (n)->impF.name;
         break;
 
       case decl_module:
-        return n->moduleF.name;
+        return static_cast<decl_node__opaque> (n)->moduleF.name;
         break;
 
       case decl_loop:
@@ -24915,25 +25047,25 @@ extern "C" nameKey_Name decl_getSymName (decl_node n)
 extern "C" decl_node decl_import (decl_node m, decl_node n)
 {
   nameKey_Name name;
-  decl_node r;
+  decl_node__opaque r;
 
   mcDebug_assert (((decl_isDef (m)) || (decl_isModule (m))) || (decl_isImp (m)));
   name = decl_getSymName (n);
-  r = decl_lookupInScope (m, name);
+  r = static_cast<decl_node__opaque> (decl_lookupInScope (m, name));
   if (r == NULL)
     {
-      switch (m->kind)
+      switch (static_cast<decl_node__opaque> (m)->kind)
         {
           case decl_def:
-            symbolKey_putSymKey (m->defF.decls.symbols, name, reinterpret_cast<void *> (n));
+            symbolKey_putSymKey (static_cast<decl_node__opaque> (m)->defF.decls.symbols, name, reinterpret_cast<void *> (n));
             break;
 
           case decl_imp:
-            symbolKey_putSymKey (m->impF.decls.symbols, name, reinterpret_cast<void *> (n));
+            symbolKey_putSymKey (static_cast<decl_node__opaque> (m)->impF.decls.symbols, name, reinterpret_cast<void *> (n));
             break;
 
           case decl_module:
-            symbolKey_putSymKey (m->moduleF.decls.symbols, name, reinterpret_cast<void *> (n));
+            symbolKey_putSymKey (static_cast<decl_node__opaque> (m)->moduleF.decls.symbols, name, reinterpret_cast<void *> (n));
             break;
 
 
@@ -24941,10 +25073,10 @@ extern "C" decl_node decl_import (decl_node m, decl_node n)
             CaseException ("../../gcc/m2/mc/decl.def", 20, 1);
             __builtin_unreachable ();
         }
-      importEnumFields (m, n);
+      importEnumFields (static_cast<decl_node__opaque> (m), static_cast<decl_node__opaque> (n));
       return n;
     }
-  return r;
+  return static_cast<decl_node> (r);
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -24958,15 +25090,15 @@ extern "C" decl_node decl_import (decl_node m, decl_node n)
 
 extern "C" decl_node decl_lookupExported (decl_node n, nameKey_Name i)
 {
-  decl_node r;
+  decl_node__opaque r;
 
   mcDebug_assert (decl_isDef (n));
-  r = static_cast<decl_node> (symbolKey_getSymKey (n->defF.decls.symbols, i));
-  if ((r != NULL) && (decl_isExported (r)))
+  r = static_cast<decl_node__opaque> (symbolKey_getSymKey (static_cast<decl_node__opaque> (n)->defF.decls.symbols, i));
+  if ((r != NULL) && (decl_isExported (static_cast<decl_node> (r))))
     {
-      return r;
+      return static_cast<decl_node> (r);
     }
-  return NULL;
+  return static_cast<decl_node> (NULL);
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -24978,8 +25110,8 @@ extern "C" decl_node decl_lookupExported (decl_node n, nameKey_Name i)
 
 extern "C" decl_node decl_lookupSym (nameKey_Name n)
 {
-  decl_node s;
-  decl_node m;
+  decl_node__opaque s;
+  decl_node__opaque m;
   unsigned int l;
   unsigned int h;
 
@@ -24987,8 +25119,8 @@ extern "C" decl_node decl_lookupSym (nameKey_Name n)
   h = Indexing_HighIndice (scopeStack);
   while (h >= l)
     {
-      s = static_cast<decl_node> (Indexing_GetIndice (scopeStack, h));
-      m = decl_lookupInScope (s, n);
+      s = static_cast<decl_node__opaque> (Indexing_GetIndice (scopeStack, h));
+      m = static_cast<decl_node__opaque> (decl_lookupInScope (static_cast<decl_node> (s), n));
       if (debugScopes && (m == NULL))
         {
           out3 ((const char *) " [%d] search for symbol name %s in scope %s\\n", 45, h, n, s);
@@ -24999,11 +25131,11 @@ extern "C" decl_node decl_lookupSym (nameKey_Name n)
             {
               out3 ((const char *) " [%d] search for symbol name %s in scope %s (found)\\n", 53, h, n, s);
             }
-          return m;
+          return static_cast<decl_node> (m);
         }
       h -= 1;
     }
-  return lookupBase (n);
+  return static_cast<decl_node> (lookupBase (n));
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -25020,17 +25152,17 @@ extern "C" void decl_addImportedModule (decl_node m, decl_node i, bool scoped)
   mcDebug_assert ((decl_isDef (i)) || (decl_isModule (i)));
   if (decl_isDef (m))
     {
-      Indexing_IncludeIndiceIntoIndex (m->defF.importedModules, reinterpret_cast<void *> (i));
+      Indexing_IncludeIndiceIntoIndex (static_cast<decl_node__opaque> (m)->defF.importedModules, reinterpret_cast<void *> (i));
     }
   else if (decl_isImp (m))
     {
       /* avoid dangling else.  */
-      Indexing_IncludeIndiceIntoIndex (m->impF.importedModules, reinterpret_cast<void *> (i));
+      Indexing_IncludeIndiceIntoIndex (static_cast<decl_node__opaque> (m)->impF.importedModules, reinterpret_cast<void *> (i));
     }
   else if (decl_isModule (m))
     {
       /* avoid dangling else.  */
-      Indexing_IncludeIndiceIntoIndex (m->moduleF.importedModules, reinterpret_cast<void *> (i));
+      Indexing_IncludeIndiceIntoIndex (static_cast<decl_node__opaque> (m)->moduleF.importedModules, reinterpret_cast<void *> (i));
     }
   else
     {
@@ -25040,7 +25172,7 @@ extern "C" void decl_addImportedModule (decl_node m, decl_node i, bool scoped)
     }
   if (scoped)
     {
-      addModuleToScope (m, i);
+      addModuleToScope (static_cast<decl_node__opaque> (m), static_cast<decl_node__opaque> (i));
     }
 }
 
@@ -25051,18 +25183,18 @@ extern "C" void decl_addImportedModule (decl_node m, decl_node i, bool scoped)
 
 extern "C" void decl_setSource (decl_node n, nameKey_Name s)
 {
-  switch (n->kind)
+  switch (static_cast<decl_node__opaque> (n)->kind)
     {
       case decl_def:
-        n->defF.source = s;
+        static_cast<decl_node__opaque> (n)->defF.source = s;
         break;
 
       case decl_module:
-        n->moduleF.source = s;
+        static_cast<decl_node__opaque> (n)->moduleF.source = s;
         break;
 
       case decl_imp:
-        n->impF.source = s;
+        static_cast<decl_node__opaque> (n)->impF.source = s;
         break;
 
 
@@ -25079,18 +25211,18 @@ extern "C" void decl_setSource (decl_node n, nameKey_Name s)
 
 extern "C" nameKey_Name decl_getSource (decl_node n)
 {
-  switch (n->kind)
+  switch (static_cast<decl_node__opaque> (n)->kind)
     {
       case decl_def:
-        return n->defF.source;
+        return static_cast<decl_node__opaque> (n)->defF.source;
         break;
 
       case decl_module:
-        return n->moduleF.source;
+        return static_cast<decl_node__opaque> (n)->moduleF.source;
         break;
 
       case decl_imp:
-        return n->impF.source;
+        return static_cast<decl_node__opaque> (n)->impF.source;
         break;
 
 
@@ -25109,7 +25241,7 @@ extern "C" nameKey_Name decl_getSource (decl_node n)
 
 extern "C" decl_node decl_getMainModule (void)
 {
-  return mainModule;
+  return static_cast<decl_node> (mainModule);
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -25121,7 +25253,7 @@ extern "C" decl_node decl_getMainModule (void)
 
 extern "C" decl_node decl_getCurrentModule (void)
 {
-  return currentModule;
+  return static_cast<decl_node> (currentModule);
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -25179,10 +25311,10 @@ extern "C" void decl_enterScope (decl_node n)
 extern "C" void decl_leaveScope (void)
 {
   unsigned int i;
-  decl_node n;
+  decl_node__opaque n;
 
   i = Indexing_HighIndice (scopeStack);
-  n = static_cast<decl_node> (Indexing_GetIndice (scopeStack, i));
+  n = static_cast<decl_node__opaque> (Indexing_GetIndice (scopeStack, i));
   Indexing_RemoveIndiceFromIndex (scopeStack, reinterpret_cast<void *> (n));
   if (debugScopes)
     {
@@ -25198,32 +25330,32 @@ extern "C" void decl_leaveScope (void)
 
 extern "C" decl_node decl_makeProcedure (nameKey_Name n)
 {
-  decl_node d;
+  decl_node__opaque d;
 
-  d = decl_lookupSym (n);
+  d = static_cast<decl_node__opaque> (decl_lookupSym (n));
   if (d == NULL)
     {
       d = newNode (decl_procedure);
       d->procedureF.name = n;
       initDecls (&d->procedureF.decls);
-      d->procedureF.scope = decl_getDeclScope ();
+      d->procedureF.scope = static_cast<decl_node__opaque> (decl_getDeclScope ());
       d->procedureF.parameters = Indexing_InitIndex (1);
-      d->procedureF.isForC = isDefForCNode (decl_getDeclScope ());
+      d->procedureF.isForC = isDefForCNode (static_cast<decl_node__opaque> (decl_getDeclScope ()));
       d->procedureF.built = false;
       d->procedureF.returnopt = false;
-      d->procedureF.optarg_ = NULL;
+      d->procedureF.optarg_ = static_cast<decl_node__opaque> (NULL);
       d->procedureF.noreturnused = false;
       d->procedureF.noreturn = false;
       d->procedureF.vararg = false;
       d->procedureF.checking = false;
       d->procedureF.paramcount = 0;
-      d->procedureF.returnType = NULL;
-      d->procedureF.beginStatements = NULL;
+      d->procedureF.returnType = static_cast<decl_node__opaque> (NULL);
+      d->procedureF.beginStatements = static_cast<decl_node__opaque> (NULL);
       initCname (&d->procedureF.cname);
-      d->procedureF.defComment = NULL;
-      d->procedureF.modComment = NULL;
+      d->procedureF.defComment = static_cast<mcComment_commentDesc> (NULL);
+      d->procedureF.modComment = static_cast<mcComment_commentDesc> (NULL);
     }
-  return addProcedureToScope (d, n);
+  return static_cast<decl_node> (addProcedureToScope (d, n));
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -25240,7 +25372,7 @@ extern "C" void decl_putCommentDefProcedure (decl_node n)
   mcDebug_assert (decl_isProcedure (n));
   if (mcComment_isProcedureComment (mcLexBuf_lastcomment))
     {
-      n->procedureF.defComment = mcLexBuf_lastcomment;
+      static_cast<decl_node__opaque> (n)->procedureF.defComment = mcLexBuf_lastcomment;
     }
 }
 
@@ -25256,7 +25388,7 @@ extern "C" void decl_putCommentModProcedure (decl_node n)
   mcDebug_assert (decl_isProcedure (n));
   if (mcComment_isProcedureComment (mcLexBuf_lastcomment))
     {
-      n->procedureF.modComment = mcLexBuf_lastcomment;
+      static_cast<decl_node__opaque> (n)->procedureF.modComment = mcLexBuf_lastcomment;
     }
 }
 
@@ -25267,23 +25399,24 @@ extern "C" void decl_putCommentModProcedure (decl_node n)
 
 extern "C" decl_node decl_makeProcType (void)
 {
-  decl_node d;
+  decl_node__opaque d;
 
   d = newNode (decl_proctype);
-  d->proctypeF.scope = decl_getDeclScope ();
+  d->proctypeF.scope = static_cast<decl_node__opaque> (decl_getDeclScope ());
   d->proctypeF.parameters = Indexing_InitIndex (1);
   d->proctypeF.returnopt = false;
-  d->proctypeF.optarg_ = NULL;
+  d->proctypeF.optarg_ = static_cast<decl_node__opaque> (NULL);
   d->proctypeF.vararg = false;
-  d->proctypeF.returnType = NULL;
-  return d;
+  d->proctypeF.returnType = static_cast<decl_node__opaque> (NULL);
+  initNodeOpaqueState (d);
+  return static_cast<decl_node> (d);
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
 
 
 /*
-   putReturnType - sets the return type of procedure or proctype, proc, to, type.
+   putReturnType - sets the return type of procedure or proctype proc to type.
 */
 
 extern "C" void decl_putReturnType (decl_node proc, decl_node type)
@@ -25291,12 +25424,13 @@ extern "C" void decl_putReturnType (decl_node proc, decl_node type)
   mcDebug_assert ((decl_isProcedure (proc)) || (decl_isProcType (proc)));
   if (decl_isProcedure (proc))
     {
-      proc->procedureF.returnType = type;
+      static_cast<decl_node__opaque> (proc)->procedureF.returnType = static_cast<decl_node__opaque> (type);
     }
   else
     {
-      proc->proctypeF.returnType = type;
+      static_cast<decl_node__opaque> (proc)->proctypeF.returnType = static_cast<decl_node__opaque> (type);
     }
+  initNodeOpaqueState (static_cast<decl_node__opaque> (proc));
 }
 
 
@@ -25309,11 +25443,11 @@ extern "C" void decl_putOptReturn (decl_node proc)
   mcDebug_assert ((decl_isProcedure (proc)) || (decl_isProcType (proc)));
   if (decl_isProcedure (proc))
     {
-      proc->procedureF.returnopt = true;
+      static_cast<decl_node__opaque> (proc)->procedureF.returnopt = true;
     }
   else
     {
-      proc->proctypeF.returnopt = true;
+      static_cast<decl_node__opaque> (proc)->proctypeF.returnopt = true;
     }
 }
 
@@ -25324,17 +25458,18 @@ extern "C" void decl_putOptReturn (decl_node proc)
 
 extern "C" decl_node decl_makeVarParameter (decl_node l, decl_node type, decl_node proc, bool isused)
 {
-  decl_node d;
+  decl_node__opaque d;
 
-  mcDebug_assert ((l == NULL) || (isIdentList (l)));
+  mcDebug_assert ((l == NULL) || (isIdentList (static_cast<decl_node__opaque> (l))));
   d = newNode (decl_varparam);
-  d->varparamF.namelist = l;
-  d->varparamF.type = type;
-  d->varparamF.scope = proc;
+  d->varparamF.namelist = static_cast<decl_node__opaque> (l);
+  d->varparamF.type = static_cast<decl_node__opaque> (type);
+  d->varparamF.scope = static_cast<decl_node__opaque> (proc);
   d->varparamF.isUnbounded = false;
-  d->varparamF.isForC = isDefForCNode (proc);
+  d->varparamF.isForC = isDefForCNode (static_cast<decl_node__opaque> (proc));
   d->varparamF.isUsed = isused;
-  return d;
+  initNodeOpaqueState (d);
+  return static_cast<decl_node> (d);
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -25346,17 +25481,18 @@ extern "C" decl_node decl_makeVarParameter (decl_node l, decl_node type, decl_no
 
 extern "C" decl_node decl_makeNonVarParameter (decl_node l, decl_node type, decl_node proc, bool isused)
 {
-  decl_node d;
+  decl_node__opaque d;
 
-  mcDebug_assert ((l == NULL) || (isIdentList (l)));
+  mcDebug_assert ((l == NULL) || (isIdentList (static_cast<decl_node__opaque> (l))));
   d = newNode (decl_param);
-  d->paramF.namelist = l;
-  d->paramF.type = type;
-  d->paramF.scope = proc;
+  d->paramF.namelist = static_cast<decl_node__opaque> (l);
+  d->paramF.type = static_cast<decl_node__opaque> (type);
+  d->paramF.scope = static_cast<decl_node__opaque> (proc);
   d->paramF.isUnbounded = false;
-  d->paramF.isForC = isDefForCNode (proc);
+  d->paramF.isForC = isDefForCNode (static_cast<decl_node__opaque> (proc));
   d->paramF.isUsed = isused;
-  return d;
+  initNodeOpaqueState (d);
+  return static_cast<decl_node> (d);
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -25369,7 +25505,7 @@ extern "C" decl_node decl_makeNonVarParameter (decl_node l, decl_node type, decl
 extern "C" void decl_paramEnter (decl_node n)
 {
   mcDebug_assert (decl_isProcedure (n));
-  n->procedureF.paramcount = 0;
+  static_cast<decl_node__opaque> (n)->procedureF.paramcount = 0;
 }
 
 
@@ -25380,10 +25516,10 @@ extern "C" void decl_paramEnter (decl_node n)
 extern "C" void decl_paramLeave (decl_node n)
 {
   mcDebug_assert (decl_isProcedure (n));
-  n->procedureF.checking = true;
-  if ((decl_isImp (currentModule)) || (decl_isModule (currentModule)))
+  static_cast<decl_node__opaque> (n)->procedureF.checking = true;
+  if ((decl_isImp (static_cast<decl_node> (currentModule))) || (decl_isModule (static_cast<decl_node> (currentModule))))
     {
-      n->procedureF.built = true;
+      static_cast<decl_node__opaque> (n)->procedureF.built = true;
     }
 }
 
@@ -25394,12 +25530,12 @@ extern "C" void decl_paramLeave (decl_node n)
 
 extern "C" decl_node decl_makeIdentList (void)
 {
-  decl_node n;
+  decl_node__opaque n;
 
   n = newNode (decl_identlist);
   n->identlistF.names = wlists_initList ();
   n->identlistF.cnamed = false;
-  return n;
+  return static_cast<decl_node> (n);
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -25412,14 +25548,14 @@ extern "C" decl_node decl_makeIdentList (void)
 
 extern "C" bool decl_putIdent (decl_node n, nameKey_Name i)
 {
-  mcDebug_assert (isIdentList (n));
-  if (wlists_isItemInList (n->identlistF.names, i))
+  mcDebug_assert (isIdentList (static_cast<decl_node__opaque> (n)));
+  if (wlists_isItemInList (static_cast<decl_node__opaque> (n)->identlistF.names, i))
     {
       return false;
     }
   else
     {
-      wlists_putItemIntoList (n->identlistF.names, i);
+      wlists_putItemIntoList (static_cast<decl_node__opaque> (n)->identlistF.names, i);
       return true;
     }
   /* static analysis guarentees a RETURN statement will be used before here.  */
@@ -25434,19 +25570,19 @@ extern "C" bool decl_putIdent (decl_node n, nameKey_Name i)
 
 extern "C" void decl_addVarParameters (decl_node n, decl_node i, decl_node type, bool isused)
 {
-  decl_node p;
+  decl_node__opaque p;
 
-  mcDebug_assert (isIdentList (i));
+  mcDebug_assert (isIdentList (static_cast<decl_node__opaque> (i)));
   mcDebug_assert (decl_isProcedure (n));
-  checkMakeVariables (n, i, type, true, isused);
-  if (n->procedureF.checking)
+  checkMakeVariables (static_cast<decl_node__opaque> (n), static_cast<decl_node__opaque> (i), static_cast<decl_node__opaque> (type), true, isused);
+  if (static_cast<decl_node__opaque> (n)->procedureF.checking)
     {
-      checkParameters (n, i, type, true, isused);  /* will destroy, i.  */
+      checkParameters (static_cast<decl_node__opaque> (n), static_cast<decl_node__opaque> (i), static_cast<decl_node__opaque> (type), true, isused);  /* will destroy, i.  */
     }
   else
     {
-      p = decl_makeVarParameter (i, type, n, isused);
-      Indexing_IncludeIndiceIntoIndex (n->procedureF.parameters, reinterpret_cast<void *> (p));
+      p = static_cast<decl_node__opaque> (decl_makeVarParameter (i, type, n, isused));
+      Indexing_IncludeIndiceIntoIndex (static_cast<decl_node__opaque> (n)->procedureF.parameters, reinterpret_cast<void *> (p));
     }
 }
 
@@ -25458,19 +25594,19 @@ extern "C" void decl_addVarParameters (decl_node n, decl_node i, decl_node type,
 
 extern "C" void decl_addNonVarParameters (decl_node n, decl_node i, decl_node type, bool isused)
 {
-  decl_node p;
+  decl_node__opaque p;
 
-  mcDebug_assert (isIdentList (i));
+  mcDebug_assert (isIdentList (static_cast<decl_node__opaque> (i)));
   mcDebug_assert (decl_isProcedure (n));
-  checkMakeVariables (n, i, type, false, isused);
-  if (n->procedureF.checking)
+  checkMakeVariables (static_cast<decl_node__opaque> (n), static_cast<decl_node__opaque> (i), static_cast<decl_node__opaque> (type), false, isused);
+  if (static_cast<decl_node__opaque> (n)->procedureF.checking)
     {
-      checkParameters (n, i, type, false, isused);  /* will destroy, i.  */
+      checkParameters (static_cast<decl_node__opaque> (n), static_cast<decl_node__opaque> (i), static_cast<decl_node__opaque> (type), false, isused);  /* will destroy, i.  */
     }
   else
     {
-      p = decl_makeNonVarParameter (i, type, n, isused);
-      Indexing_IncludeIndiceIntoIndex (n->procedureF.parameters, reinterpret_cast<void *> (p));
+      p = static_cast<decl_node__opaque> (decl_makeNonVarParameter (i, type, n, isused));
+      Indexing_IncludeIndiceIntoIndex (static_cast<decl_node__opaque> (n)->procedureF.parameters, reinterpret_cast<void *> (p));
     }
 }
 
@@ -25481,11 +25617,11 @@ extern "C" void decl_addNonVarParameters (decl_node n, decl_node i, decl_node ty
 
 extern "C" decl_node decl_makeVarargs (void)
 {
-  decl_node d;
+  decl_node__opaque d;
 
   d = newNode (decl_varargs);
-  d->varargsF.scope = NULL;
-  return d;
+  d->varargsF.scope = static_cast<decl_node__opaque> (NULL);
+  return static_cast<decl_node> (d);
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -25497,7 +25633,7 @@ extern "C" decl_node decl_makeVarargs (void)
 
 extern "C" bool decl_isVarargs (decl_node n)
 {
-  return n->kind == decl_varargs;
+  return static_cast<decl_node__opaque> (n)->kind == decl_varargs;
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -25510,29 +25646,29 @@ extern "C" bool decl_isVarargs (decl_node n)
 extern "C" void decl_addParameter (decl_node proc, decl_node param)
 {
   mcDebug_assert ((((decl_isVarargs (param)) || (decl_isParam (param))) || (decl_isVarParam (param))) || (decl_isOptarg (param)));
-  switch (proc->kind)
+  switch (static_cast<decl_node__opaque> (proc)->kind)
     {
       case decl_procedure:
-        Indexing_IncludeIndiceIntoIndex (proc->procedureF.parameters, reinterpret_cast<void *> (param));
+        Indexing_IncludeIndiceIntoIndex (static_cast<decl_node__opaque> (proc)->procedureF.parameters, reinterpret_cast<void *> (param));
         if (decl_isVarargs (param))
           {
-            proc->procedureF.vararg = true;
+            static_cast<decl_node__opaque> (proc)->procedureF.vararg = true;
           }
         if (decl_isOptarg (param))
           {
-            proc->procedureF.optarg_ = param;
+            static_cast<decl_node__opaque> (proc)->procedureF.optarg_ = static_cast<decl_node__opaque> (param);
           }
         break;
 
       case decl_proctype:
-        Indexing_IncludeIndiceIntoIndex (proc->proctypeF.parameters, reinterpret_cast<void *> (param));
+        Indexing_IncludeIndiceIntoIndex (static_cast<decl_node__opaque> (proc)->proctypeF.parameters, reinterpret_cast<void *> (param));
         if (decl_isVarargs (param))
           {
-            proc->proctypeF.vararg = true;
+            static_cast<decl_node__opaque> (proc)->proctypeF.vararg = true;
           }
         if (decl_isOptarg (param))
           {
-            proc->proctypeF.optarg_ = param;
+            static_cast<decl_node__opaque> (proc)->proctypeF.optarg_ = static_cast<decl_node__opaque> (param);
           }
         break;
 
@@ -25553,77 +25689,77 @@ extern "C" decl_node decl_makeBinaryTok (mcReserved_toktype op, decl_node l, dec
 {
   if (op == mcReserved_equaltok)
     {
-      return makeBinary (decl_equal, l, r, booleanN);
+      return static_cast<decl_node> (makeBinary (decl_equal, static_cast<decl_node__opaque> (l), static_cast<decl_node__opaque> (r), booleanN));
     }
   else if ((op == mcReserved_hashtok) || (op == mcReserved_lessgreatertok))
     {
       /* avoid dangling else.  */
-      return makeBinary (decl_notequal, l, r, booleanN);
+      return static_cast<decl_node> (makeBinary (decl_notequal, static_cast<decl_node__opaque> (l), static_cast<decl_node__opaque> (r), booleanN));
     }
   else if (op == mcReserved_lesstok)
     {
       /* avoid dangling else.  */
-      return makeBinary (decl_less, l, r, booleanN);
+      return static_cast<decl_node> (makeBinary (decl_less, static_cast<decl_node__opaque> (l), static_cast<decl_node__opaque> (r), booleanN));
     }
   else if (op == mcReserved_greatertok)
     {
       /* avoid dangling else.  */
-      return makeBinary (decl_greater, l, r, booleanN);
+      return static_cast<decl_node> (makeBinary (decl_greater, static_cast<decl_node__opaque> (l), static_cast<decl_node__opaque> (r), booleanN));
     }
   else if (op == mcReserved_greaterequaltok)
     {
       /* avoid dangling else.  */
-      return makeBinary (decl_greequal, l, r, booleanN);
+      return static_cast<decl_node> (makeBinary (decl_greequal, static_cast<decl_node__opaque> (l), static_cast<decl_node__opaque> (r), booleanN));
     }
   else if (op == mcReserved_lessequaltok)
     {
       /* avoid dangling else.  */
-      return makeBinary (decl_lessequal, l, r, booleanN);
+      return static_cast<decl_node> (makeBinary (decl_lessequal, static_cast<decl_node__opaque> (l), static_cast<decl_node__opaque> (r), booleanN));
     }
   else if (op == mcReserved_andtok)
     {
       /* avoid dangling else.  */
-      return makeBinary (decl_and, l, r, booleanN);
+      return static_cast<decl_node> (makeBinary (decl_and, static_cast<decl_node__opaque> (l), static_cast<decl_node__opaque> (r), booleanN));
     }
   else if (op == mcReserved_ortok)
     {
       /* avoid dangling else.  */
-      return makeBinary (decl_or, l, r, booleanN);
+      return static_cast<decl_node> (makeBinary (decl_or, static_cast<decl_node__opaque> (l), static_cast<decl_node__opaque> (r), booleanN));
     }
   else if (op == mcReserved_plustok)
     {
       /* avoid dangling else.  */
-      return makeBinary (decl_plus, l, r, NULL);
+      return static_cast<decl_node> (makeBinary (decl_plus, static_cast<decl_node__opaque> (l), static_cast<decl_node__opaque> (r), static_cast<decl_node__opaque> (NULL)));
     }
   else if (op == mcReserved_minustok)
     {
       /* avoid dangling else.  */
-      return makeBinary (decl_sub, l, r, NULL);
+      return static_cast<decl_node> (makeBinary (decl_sub, static_cast<decl_node__opaque> (l), static_cast<decl_node__opaque> (r), static_cast<decl_node__opaque> (NULL)));
     }
   else if (op == mcReserved_divtok)
     {
       /* avoid dangling else.  */
-      return makeBinary (decl_div, l, r, NULL);
+      return static_cast<decl_node> (makeBinary (decl_div, static_cast<decl_node__opaque> (l), static_cast<decl_node__opaque> (r), static_cast<decl_node__opaque> (NULL)));
     }
   else if (op == mcReserved_timestok)
     {
       /* avoid dangling else.  */
-      return makeBinary (decl_mult, l, r, NULL);
+      return static_cast<decl_node> (makeBinary (decl_mult, static_cast<decl_node__opaque> (l), static_cast<decl_node__opaque> (r), static_cast<decl_node__opaque> (NULL)));
     }
   else if (op == mcReserved_modtok)
     {
       /* avoid dangling else.  */
-      return makeBinary (decl_mod, l, r, NULL);
+      return static_cast<decl_node> (makeBinary (decl_mod, static_cast<decl_node__opaque> (l), static_cast<decl_node__opaque> (r), static_cast<decl_node__opaque> (NULL)));
     }
   else if (op == mcReserved_intok)
     {
       /* avoid dangling else.  */
-      return makeBinary (decl_in, l, r, NULL);
+      return static_cast<decl_node> (makeBinary (decl_in, static_cast<decl_node__opaque> (l), static_cast<decl_node__opaque> (r), static_cast<decl_node__opaque> (NULL)));
     }
   else if (op == mcReserved_dividetok)
     {
       /* avoid dangling else.  */
-      return makeBinary (decl_divide, l, r, NULL);
+      return static_cast<decl_node> (makeBinary (decl_divide, static_cast<decl_node__opaque> (l), static_cast<decl_node__opaque> (r), static_cast<decl_node__opaque> (NULL)));
     }
   else
     {
@@ -25645,17 +25781,17 @@ extern "C" decl_node decl_makeUnaryTok (mcReserved_toktype op, decl_node e)
 {
   if (op == mcReserved_nottok)
     {
-      return makeUnary (decl_not, e, booleanN);
+      return static_cast<decl_node> (makeUnary (decl_not, static_cast<decl_node__opaque> (e), booleanN));
     }
   else if (op == mcReserved_plustok)
     {
       /* avoid dangling else.  */
-      return makeUnary (decl_plus, e, NULL);
+      return static_cast<decl_node> (makeUnary (decl_plus, static_cast<decl_node__opaque> (e), static_cast<decl_node__opaque> (NULL)));
     }
   else if (op == mcReserved_minustok)
     {
       /* avoid dangling else.  */
-      return makeUnary (decl_neg, e, NULL);
+      return static_cast<decl_node> (makeUnary (decl_neg, static_cast<decl_node__opaque> (e), static_cast<decl_node__opaque> (NULL)));
     }
   else
     {
@@ -25675,8 +25811,8 @@ extern "C" decl_node decl_makeUnaryTok (mcReserved_toktype op, decl_node e)
 
 extern "C" decl_node decl_makeComponentRef (decl_node rec, decl_node field)
 {
-  decl_node n;
-  decl_node a;
+  decl_node__opaque n;
+  decl_node__opaque a;
 
   /* 
    n := getLastOp (rec) ;
@@ -25693,18 +25829,19 @@ extern "C" decl_node decl_makeComponentRef (decl_node rec, decl_node field)
       RETURN doMakeComponentRef (rec, field)
    END
   */
-  if (isDeref (rec))
-    {
-      a = rec->unaryF.arg;
-      rec->kind = decl_pointerref;
-      rec->pointerrefF.ptr = a;
-      rec->pointerrefF.field = field;
-      rec->pointerrefF.resultType = decl_getType (field);
+  if (isDeref (static_cast<decl_node__opaque> (rec)))
+    {
+      a = static_cast<decl_node__opaque> (rec)->unaryF.arg;
+      static_cast<decl_node__opaque> (rec)->kind = decl_pointerref;
+      static_cast<decl_node__opaque> (rec)->pointerrefF.ptr = a;
+      static_cast<decl_node__opaque> (rec)->pointerrefF.field = static_cast<decl_node__opaque> (field);
+      static_cast<decl_node__opaque> (rec)->pointerrefF.resultType = static_cast<decl_node__opaque> (decl_getType (field));
+      initNodeOpaqueState (static_cast<decl_node__opaque> (rec));
       return rec;
     }
   else
     {
-      return doMakeComponentRef (rec, field);
+      return static_cast<decl_node> (doMakeComponentRef (static_cast<decl_node__opaque> (rec), static_cast<decl_node__opaque> (field)));
     }
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
@@ -25718,13 +25855,14 @@ extern "C" decl_node decl_makeComponentRef (decl_node rec, decl_node field)
 
 extern "C" decl_node decl_makePointerRef (decl_node ptr, decl_node field)
 {
-  decl_node n;
+  decl_node__opaque n;
 
   n = newNode (decl_pointerref);
-  n->pointerrefF.ptr = ptr;
-  n->pointerrefF.field = field;
-  n->pointerrefF.resultType = decl_getType (field);
-  return n;
+  n->pointerrefF.ptr = static_cast<decl_node__opaque> (ptr);
+  n->pointerrefF.field = static_cast<decl_node__opaque> (field);
+  n->pointerrefF.resultType = static_cast<decl_node__opaque> (decl_getType (field));
+  initNodeOpaqueState (n);
+  return static_cast<decl_node> (n);
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -25737,7 +25875,7 @@ extern "C" decl_node decl_makePointerRef (decl_node ptr, decl_node field)
 extern "C" bool decl_isPointerRef (decl_node n)
 {
   mcDebug_assert (n != NULL);
-  return n->kind == decl_pointerref;
+  return static_cast<decl_node__opaque> (n)->kind == decl_pointerref;
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -25749,11 +25887,11 @@ extern "C" bool decl_isPointerRef (decl_node n)
 
 extern "C" decl_node decl_makeDeRef (decl_node n)
 {
-  decl_node t;
+  decl_node__opaque t;
 
-  t = decl_skipType (decl_getType (n));
-  mcDebug_assert (decl_isPointer (t));
-  return makeUnary (decl_deref, n, decl_getType (t));
+  t = static_cast<decl_node__opaque> (decl_skipType (decl_getType (n)));
+  mcDebug_assert (decl_isPointer (static_cast<decl_node> (t)));
+  return static_cast<decl_node> (makeUnary (decl_deref, static_cast<decl_node__opaque> (n), static_cast<decl_node__opaque> (decl_getType (static_cast<decl_node> (t)))));
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -25767,22 +25905,22 @@ extern "C" decl_node decl_makeDeRef (decl_node n)
 
 extern "C" decl_node decl_makeArrayRef (decl_node array, decl_node index)
 {
-  decl_node n;
-  decl_node t;
+  decl_node__opaque n;
+  decl_node__opaque t;
   unsigned int i;
   unsigned int j;
 
   n = newNode (decl_arrayref);
-  n->arrayrefF.array = array;
-  n->arrayrefF.index = index;
-  t = array;
-  j = expListLen (index);
+  n->arrayrefF.array = static_cast<decl_node__opaque> (array);
+  n->arrayrefF.index = static_cast<decl_node__opaque> (index);
+  t = static_cast<decl_node__opaque> (array);
+  j = expListLen (static_cast<decl_node__opaque> (index));
   i = 1;
-  t = decl_skipType (decl_getType (t));
+  t = static_cast<decl_node__opaque> (decl_skipType (decl_getType (static_cast<decl_node> (t))));
   do {
-    if (decl_isArray (t))
+    if (decl_isArray (static_cast<decl_node> (t)))
       {
-        t = decl_skipType (decl_getType (t));
+        t = static_cast<decl_node__opaque> (decl_skipType (decl_getType (static_cast<decl_node> (t))));
       }
     else
       {
@@ -25791,7 +25929,7 @@ extern "C" decl_node decl_makeArrayRef (decl_node array, decl_node index)
     i += 1;
   } while (! (i > j));
   n->arrayrefF.resultType = t;
-  return n;
+  return static_cast<decl_node> (n);
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -25803,7 +25941,7 @@ extern "C" decl_node decl_makeArrayRef (decl_node array, decl_node index)
 
 extern "C" decl_node decl_getLastOp (decl_node n)
 {
-  return doGetLastOp (n, n);
+  return static_cast<decl_node> (doGetLastOp (static_cast<decl_node__opaque> (n), static_cast<decl_node__opaque> (n)));
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -25815,7 +25953,7 @@ extern "C" decl_node decl_getLastOp (decl_node n)
 
 extern "C" decl_node decl_getCardinal (void)
 {
-  return cardinalN;
+  return static_cast<decl_node> (cardinalN);
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -25827,7 +25965,7 @@ extern "C" decl_node decl_getCardinal (void)
 
 extern "C" decl_node decl_makeLiteralInt (nameKey_Name n)
 {
-  decl_node m;
+  decl_node__opaque m;
   DynamicStrings_String s;
 
   m = newNode (decl_literal);
@@ -25842,7 +25980,7 @@ extern "C" decl_node decl_makeLiteralInt (nameKey_Name n)
       m->literalF.type = ztypeN;
     }
   s = DynamicStrings_KillString (s);
-  return m;
+  return static_cast<decl_node> (m);
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -25854,12 +25992,12 @@ extern "C" decl_node decl_makeLiteralInt (nameKey_Name n)
 
 extern "C" decl_node decl_makeLiteralReal (nameKey_Name n)
 {
-  decl_node m;
+  decl_node__opaque m;
 
   m = newNode (decl_literal);
   m->literalF.name = n;
   m->literalF.type = rtypeN;
-  return m;
+  return static_cast<decl_node> (m);
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -25871,7 +26009,7 @@ extern "C" decl_node decl_makeLiteralReal (nameKey_Name n)
 
 extern "C" decl_node decl_makeString (nameKey_Name n)
 {
-  decl_node m;
+  decl_node__opaque m;
 
   m = newNode (decl_string);
   m->stringF.name = n;
@@ -25885,9 +26023,9 @@ extern "C" decl_node decl_makeString (nameKey_Name n)
     }
   else
     {
-      m->stringF.cchar = NULL;
+      m->stringF.cchar = static_cast<DynamicStrings_String> (NULL);
     }
-  return m;
+  return static_cast<decl_node> (m);
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -25899,12 +26037,12 @@ extern "C" decl_node decl_makeString (nameKey_Name n)
 
 extern "C" decl_node decl_makeSetValue (void)
 {
-  decl_node n;
+  decl_node__opaque n;
 
   n = newNode (decl_setvalue);
   n->setvalueF.type = bitsetN;
   n->setvalueF.values = Indexing_InitIndex (1);
-  return n;
+  return static_cast<decl_node> (n);
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -25917,7 +26055,7 @@ extern "C" decl_node decl_makeSetValue (void)
 extern "C" bool decl_isSetValue (decl_node n)
 {
   mcDebug_assert (n != NULL);
-  return n->kind == decl_setvalue;
+  return static_cast<decl_node__opaque> (n)->kind == decl_setvalue;
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -25931,7 +26069,7 @@ extern "C" bool decl_isSetValue (decl_node n)
 extern "C" decl_node decl_putSetValue (decl_node n, decl_node t)
 {
   mcDebug_assert (decl_isSetValue (n));
-  n->setvalueF.type = t;
+  static_cast<decl_node__opaque> (n)->setvalueF.type = static_cast<decl_node__opaque> (t);
   return n;
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
@@ -25948,7 +26086,7 @@ extern "C" decl_node decl_putSetValue (decl_node n, decl_node t)
 extern "C" decl_node decl_includeSetValue (decl_node n, decl_node l, decl_node h)
 {
   mcDebug_assert (decl_isSetValue (n));
-  Indexing_IncludeIndiceIntoIndex (n->setvalueF.values, reinterpret_cast<void *> (l));
+  Indexing_IncludeIndiceIntoIndex (static_cast<decl_node__opaque> (n)->setvalueF.values, reinterpret_cast<void *> (l));
   return n;
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
@@ -25963,27 +26101,27 @@ extern "C" decl_node decl_getBuiltinConst (nameKey_Name n)
 {
   if (n == (nameKey_makeKey ((const char *) "BITS_PER_UNIT", 13)))
     {
-      return bitsperunitN;
+      return static_cast<decl_node> (bitsperunitN);
     }
   else if (n == (nameKey_makeKey ((const char *) "BITS_PER_WORD", 13)))
     {
       /* avoid dangling else.  */
-      return bitsperwordN;
+      return static_cast<decl_node> (bitsperwordN);
     }
   else if (n == (nameKey_makeKey ((const char *) "BITS_PER_CHAR", 13)))
     {
       /* avoid dangling else.  */
-      return bitspercharN;
+      return static_cast<decl_node> (bitspercharN);
     }
   else if (n == (nameKey_makeKey ((const char *) "UNITS_PER_WORD", 14)))
     {
       /* avoid dangling else.  */
-      return unitsperwordN;
+      return static_cast<decl_node> (unitsperwordN);
     }
   else
     {
       /* avoid dangling else.  */
-      return NULL;
+      return static_cast<decl_node> (NULL);
     }
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
@@ -25996,11 +26134,11 @@ extern "C" decl_node decl_getBuiltinConst (nameKey_Name n)
 
 extern "C" decl_node decl_makeExpList (void)
 {
-  decl_node n;
+  decl_node__opaque n;
 
   n = newNode (decl_explist);
   n->explistF.exp = Indexing_InitIndex (1);
-  return n;
+  return static_cast<decl_node> (n);
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -26013,7 +26151,7 @@ extern "C" decl_node decl_makeExpList (void)
 extern "C" bool decl_isExpList (decl_node n)
 {
   mcDebug_assert (n != NULL);
-  return n->kind == decl_explist;
+  return static_cast<decl_node__opaque> (n)->kind == decl_explist;
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -26027,7 +26165,7 @@ extern "C" void decl_putExpList (decl_node n, decl_node e)
 {
   mcDebug_assert (n != NULL);
   mcDebug_assert (decl_isExpList (n));
-  Indexing_PutIndice (n->explistF.exp, (Indexing_HighIndice (n->explistF.exp))+1, reinterpret_cast<void *> (e));
+  Indexing_PutIndice (static_cast<decl_node__opaque> (n)->explistF.exp, (Indexing_HighIndice (static_cast<decl_node__opaque> (n)->explistF.exp))+1, reinterpret_cast<void *> (e));
 }
 
 
@@ -26043,7 +26181,7 @@ extern "C" decl_node decl_makeConstExp (void)
     }
   else
     {
-      return doMakeConstExp ();
+      return static_cast<decl_node> (doMakeConstExp ());
     }
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
@@ -26056,24 +26194,24 @@ extern "C" decl_node decl_makeConstExp (void)
 
 extern "C" decl_node decl_getNextConstExp (void)
 {
-  decl_node n;
+  decl_node__opaque n;
 
-  mcDebug_assert (((decl_isDef (currentModule)) || (decl_isImp (currentModule))) || (decl_isModule (currentModule)));
-  if (decl_isDef (currentModule))
+  mcDebug_assert (((decl_isDef (static_cast<decl_node> (currentModule))) || (decl_isImp (static_cast<decl_node> (currentModule)))) || (decl_isModule (static_cast<decl_node> (currentModule))));
+  if (decl_isDef (static_cast<decl_node> (currentModule)))
     {
-      return getNextFixup (&currentModule->defF.constFixup);
+      return static_cast<decl_node> (getNextFixup (&currentModule->defF.constFixup));
     }
-  else if (decl_isImp (currentModule))
+  else if (decl_isImp (static_cast<decl_node> (currentModule)))
     {
       /* avoid dangling else.  */
-      return getNextFixup (&currentModule->impF.constFixup);
+      return static_cast<decl_node> (getNextFixup (&currentModule->impF.constFixup));
     }
-  else if (decl_isModule (currentModule))
+  else if (decl_isModule (static_cast<decl_node> (currentModule)))
     {
       /* avoid dangling else.  */
-      return getNextFixup (&currentModule->moduleF.constFixup);
+      return static_cast<decl_node> (getNextFixup (&currentModule->moduleF.constFixup));
     }
-  return n;
+  return static_cast<decl_node> (n);
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -26085,18 +26223,18 @@ extern "C" decl_node decl_getNextConstExp (void)
 
 extern "C" void decl_setConstExpComplete (decl_node n)
 {
-  switch (n->kind)
+  switch (static_cast<decl_node__opaque> (n)->kind)
     {
       case decl_def:
-        n->defF.constsComplete = true;
+        static_cast<decl_node__opaque> (n)->defF.constsComplete = true;
         break;
 
       case decl_imp:
-        n->impF.constsComplete = true;
+        static_cast<decl_node__opaque> (n)->impF.constsComplete = true;
         break;
 
       case decl_module:
-        n->moduleF.constsComplete = true;
+        static_cast<decl_node__opaque> (n)->moduleF.constsComplete = true;
         break;
 
 
@@ -26113,8 +26251,8 @@ extern "C" void decl_setConstExpComplete (decl_node n)
 
 extern "C" decl_node decl_fixupConstExp (decl_node c, decl_node e)
 {
-  mcDebug_assert (isConstExp (c));
-  c->unaryF.arg = e;
+  mcDebug_assert (isConstExp (static_cast<decl_node__opaque> (c)));
+  static_cast<decl_node__opaque> (c)->unaryF.arg = static_cast<decl_node__opaque> (e);
   return c;
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
@@ -26131,17 +26269,17 @@ extern "C" void decl_resetConstExpPos (decl_node n)
   mcDebug_assert (((decl_isDef (n)) || (decl_isImp (n))) || (decl_isModule (n)));
   if (decl_isDef (n))
     {
-      n->defF.constFixup.count = 0;
+      static_cast<decl_node__opaque> (n)->defF.constFixup.count = 0;
     }
   else if (decl_isImp (n))
     {
       /* avoid dangling else.  */
-      n->impF.constFixup.count = 0;
+      static_cast<decl_node__opaque> (n)->impF.constFixup.count = 0;
     }
   else if (decl_isModule (n))
     {
       /* avoid dangling else.  */
-      n->moduleF.constFixup.count = 0;
+      static_cast<decl_node__opaque> (n)->moduleF.constFixup.count = 0;
     }
 }
 
@@ -26152,24 +26290,25 @@ extern "C" void decl_resetConstExpPos (decl_node n)
 
 extern "C" decl_node decl_makeFuncCall (decl_node c, decl_node n)
 {
-  decl_node f;
+  decl_node__opaque f;
 
   mcDebug_assert ((n == NULL) || (decl_isExpList (n)));
   if (((c == haltN) && ((decl_getMainModule ()) != (decl_lookupDef (nameKey_makeKey ((const char *) "M2RTS", 5))))) && ((decl_getMainModule ()) != (decl_lookupImp (nameKey_makeKey ((const char *) "M2RTS", 5)))))
     {
       decl_addImportedModule (decl_getMainModule (), decl_lookupDef (nameKey_makeKey ((const char *) "M2RTS", 5)), false);
     }
-  f = checkIntrinsic (c, n);
-  checkCHeaders (c);
+  f = checkIntrinsic (static_cast<decl_node__opaque> (c), static_cast<decl_node__opaque> (n));
+  checkCHeaders (static_cast<decl_node__opaque> (c));
   if (f == NULL)
     {
       f = newNode (decl_funccall);
-      f->funccallF.function = c;
-      f->funccallF.args = n;
-      f->funccallF.type = NULL;
+      f->funccallF.function = static_cast<decl_node__opaque> (c);
+      f->funccallF.args = static_cast<decl_node__opaque> (n);
+      f->funccallF.type = static_cast<decl_node__opaque> (decl_getType (c));
       initPair (&f->funccallF.funccallComment);
+      initNodeOpaqueState (f);
     }
-  return f;
+  return static_cast<decl_node> (f);
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -26181,11 +26320,11 @@ extern "C" decl_node decl_makeFuncCall (decl_node c, decl_node n)
 
 extern "C" decl_node decl_makeStatementSequence (void)
 {
-  decl_node n;
+  decl_node__opaque n;
 
   n = newNode (decl_stmtseq);
   n->stmtF.statements = Indexing_InitIndex (1);
-  return n;
+  return static_cast<decl_node> (n);
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -26197,7 +26336,7 @@ extern "C" decl_node decl_makeStatementSequence (void)
 
 extern "C" bool decl_isStatementSequence (decl_node n)
 {
-  return n->kind == decl_stmtseq;
+  return static_cast<decl_node__opaque> (n)->kind == decl_stmtseq;
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -26212,11 +26351,11 @@ extern "C" void decl_addStatement (decl_node s, decl_node n)
   if (n != NULL)
     {
       mcDebug_assert (decl_isStatementSequence (s));
-      Indexing_PutIndice (s->stmtF.statements, (Indexing_HighIndice (s->stmtF.statements))+1, reinterpret_cast<void *> (n));
-      if ((isIntrinsic (n)) && n->intrinsicF.postUnreachable)
+      Indexing_PutIndice (static_cast<decl_node__opaque> (s)->stmtF.statements, (Indexing_HighIndice (static_cast<decl_node__opaque> (s)->stmtF.statements))+1, reinterpret_cast<void *> (n));
+      if ((isIntrinsic (static_cast<decl_node__opaque> (n))) && static_cast<decl_node__opaque> (n)->intrinsicF.postUnreachable)
         {
-          n->intrinsicF.postUnreachable = false;
-          decl_addStatement (s, makeIntrinsicProc (decl_unreachable, 0, NULL));
+          static_cast<decl_node__opaque> (n)->intrinsicF.postUnreachable = false;
+          decl_addStatement (s, static_cast<decl_node> (makeIntrinsicProc (decl_unreachable, 0, static_cast<decl_node__opaque> (NULL))));
         }
     }
 }
@@ -26235,7 +26374,7 @@ extern "C" void decl_addCommentBody (decl_node n)
       b = mcLexBuf_getBodyComment ();
       if (b != NULL)
         {
-          addGenericBody (n, decl_makeCommentS (b));
+          addGenericBody (static_cast<decl_node__opaque> (n), static_cast<decl_node__opaque> (decl_makeCommentS (b)));
         }
     }
 }
@@ -26254,7 +26393,7 @@ extern "C" void decl_addCommentAfter (decl_node n)
       a = mcLexBuf_getAfterComment ();
       if (a != NULL)
         {
-          addGenericAfter (n, decl_makeCommentS (a));
+          addGenericAfter (static_cast<decl_node__opaque> (n), static_cast<decl_node__opaque> (decl_makeCommentS (a)));
         }
     }
 }
@@ -26267,8 +26406,8 @@ extern "C" void decl_addCommentAfter (decl_node n)
 extern "C" void decl_addIfComments (decl_node n, decl_node body, decl_node after)
 {
   mcDebug_assert (decl_isIf (n));
-  n->ifF.ifComment.after = after;
-  n->ifF.ifComment.body = body;
+  static_cast<decl_node__opaque> (n)->ifF.ifComment.after = static_cast<decl_node__opaque> (after);
+  static_cast<decl_node__opaque> (n)->ifF.ifComment.body = static_cast<decl_node__opaque> (body);
 }
 
 
@@ -26281,13 +26420,13 @@ extern "C" void decl_addElseComments (decl_node n, decl_node body, decl_node aft
   mcDebug_assert ((decl_isIf (n)) || (decl_isElsif (n)));
   if (decl_isIf (n))
     {
-      n->ifF.elseComment.after = after;
-      n->ifF.elseComment.body = body;
+      static_cast<decl_node__opaque> (n)->ifF.elseComment.after = static_cast<decl_node__opaque> (after);
+      static_cast<decl_node__opaque> (n)->ifF.elseComment.body = static_cast<decl_node__opaque> (body);
     }
   else
     {
-      n->elsifF.elseComment.after = after;
-      n->elsifF.elseComment.body = body;
+      static_cast<decl_node__opaque> (n)->elsifF.elseComment.after = static_cast<decl_node__opaque> (after);
+      static_cast<decl_node__opaque> (n)->elsifF.elseComment.body = static_cast<decl_node__opaque> (body);
     }
 }
 
@@ -26299,8 +26438,8 @@ extern "C" void decl_addElseComments (decl_node n, decl_node body, decl_node aft
 extern "C" void decl_addIfEndComments (decl_node n, decl_node body, decl_node after)
 {
   mcDebug_assert (decl_isIf (n));
-  n->ifF.endComment.after = after;
-  n->ifF.endComment.body = body;
+  static_cast<decl_node__opaque> (n)->ifF.endComment.after = static_cast<decl_node__opaque> (after);
+  static_cast<decl_node__opaque> (n)->ifF.endComment.body = static_cast<decl_node__opaque> (body);
 }
 
 
@@ -26310,21 +26449,21 @@ extern "C" void decl_addIfEndComments (decl_node n, decl_node body, decl_node af
 
 extern "C" decl_node decl_makeReturn (void)
 {
-  decl_node type;
-  decl_node n;
+  decl_node__opaque type;
+  decl_node__opaque n;
 
   n = newNode (decl_return);
-  n->returnF.exp = NULL;
+  n->returnF.exp = static_cast<decl_node__opaque> (NULL);
   if (decl_isProcedure (decl_getDeclScope ()))
     {
-      n->returnF.scope = decl_getDeclScope ();
+      n->returnF.scope = static_cast<decl_node__opaque> (decl_getDeclScope ());
     }
   else
     {
-      n->returnF.scope = NULL;
+      n->returnF.scope = static_cast<decl_node__opaque> (NULL);
     }
   initPair (&n->returnF.returnComment);
-  return n;
+  return static_cast<decl_node> (n);
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -26337,7 +26476,7 @@ extern "C" decl_node decl_makeReturn (void)
 extern "C" bool decl_isReturn (decl_node n)
 {
   mcDebug_assert (n != NULL);
-  return n->kind == decl_return;
+  return static_cast<decl_node__opaque> (n)->kind == decl_return;
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -26350,7 +26489,7 @@ extern "C" bool decl_isReturn (decl_node n)
 extern "C" void decl_putReturn (decl_node n, decl_node e)
 {
   mcDebug_assert (decl_isReturn (n));
-  n->returnF.exp = e;
+  static_cast<decl_node__opaque> (n)->returnF.exp = static_cast<decl_node__opaque> (e);
 }
 
 
@@ -26360,14 +26499,14 @@ extern "C" void decl_putReturn (decl_node n, decl_node e)
 
 extern "C" decl_node decl_makeWhile (void)
 {
-  decl_node n;
+  decl_node__opaque n;
 
   n = newNode (decl_while);
-  n->whileF.expr = NULL;
-  n->whileF.statements = NULL;
+  n->whileF.expr = static_cast<decl_node__opaque> (NULL);
+  n->whileF.statements = static_cast<decl_node__opaque> (NULL);
   initPair (&n->whileF.doComment);
   initPair (&n->whileF.endComment);
-  return n;
+  return static_cast<decl_node> (n);
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -26381,8 +26520,8 @@ extern "C" decl_node decl_makeWhile (void)
 extern "C" void decl_putWhile (decl_node n, decl_node e, decl_node s)
 {
   mcDebug_assert (decl_isWhile (n));
-  n->whileF.expr = e;
-  n->whileF.statements = s;
+  static_cast<decl_node__opaque> (n)->whileF.expr = static_cast<decl_node__opaque> (e);
+  static_cast<decl_node__opaque> (n)->whileF.statements = static_cast<decl_node__opaque> (s);
 }
 
 
@@ -26392,7 +26531,7 @@ extern "C" void decl_putWhile (decl_node n, decl_node e, decl_node s)
 
 extern "C" bool decl_isWhile (decl_node n)
 {
-  return n->kind == decl_while;
+  return static_cast<decl_node__opaque> (n)->kind == decl_while;
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -26405,8 +26544,8 @@ extern "C" bool decl_isWhile (decl_node n)
 extern "C" void decl_addWhileDoComment (decl_node w, decl_node body, decl_node after)
 {
   mcDebug_assert (decl_isWhile (w));
-  w->whileF.doComment.after = after;
-  w->whileF.doComment.body = body;
+  static_cast<decl_node__opaque> (w)->whileF.doComment.after = static_cast<decl_node__opaque> (after);
+  static_cast<decl_node__opaque> (w)->whileF.doComment.body = static_cast<decl_node__opaque> (body);
 }
 
 
@@ -26417,8 +26556,8 @@ extern "C" void decl_addWhileDoComment (decl_node w, decl_node body, decl_node a
 extern "C" void decl_addWhileEndComment (decl_node w, decl_node body, decl_node after)
 {
   mcDebug_assert (decl_isWhile (w));
-  w->whileF.endComment.after = after;
-  w->whileF.endComment.body = body;
+  static_cast<decl_node__opaque> (w)->whileF.endComment.after = static_cast<decl_node__opaque> (after);
+  static_cast<decl_node__opaque> (w)->whileF.endComment.body = static_cast<decl_node__opaque> (body);
 }
 
 
@@ -26429,13 +26568,13 @@ extern "C" void decl_addWhileEndComment (decl_node w, decl_node body, decl_node
 
 extern "C" decl_node decl_makeAssignment (decl_node d, decl_node e)
 {
-  decl_node n;
+  decl_node__opaque n;
 
   n = newNode (decl_assignment);
-  n->assignmentF.des = d;
-  n->assignmentF.expr = e;
+  n->assignmentF.des = static_cast<decl_node__opaque> (d);
+  n->assignmentF.expr = static_cast<decl_node__opaque> (e);
   initPair (&n->assignmentF.assignComment);
-  return n;
+  return static_cast<decl_node> (n);
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -26450,18 +26589,18 @@ extern "C" decl_node decl_makeAssignment (decl_node d, decl_node e)
 extern "C" void decl_putBegin (decl_node b, decl_node s)
 {
   mcDebug_assert (((decl_isImp (b)) || (decl_isProcedure (b))) || (decl_isModule (b)));
-  switch (b->kind)
+  switch (static_cast<decl_node__opaque> (b)->kind)
     {
       case decl_imp:
-        b->impF.beginStatements = s;
+        static_cast<decl_node__opaque> (b)->impF.beginStatements = static_cast<decl_node__opaque> (s);
         break;
 
       case decl_module:
-        b->moduleF.beginStatements = s;
+        static_cast<decl_node__opaque> (b)->moduleF.beginStatements = static_cast<decl_node__opaque> (s);
         break;
 
       case decl_procedure:
-        b->procedureF.beginStatements = s;
+        static_cast<decl_node__opaque> (b)->procedureF.beginStatements = static_cast<decl_node__opaque> (s);
         break;
 
 
@@ -26481,14 +26620,14 @@ extern "C" void decl_putBegin (decl_node b, decl_node s)
 extern "C" void decl_putFinally (decl_node b, decl_node s)
 {
   mcDebug_assert (((decl_isImp (b)) || (decl_isProcedure (b))) || (decl_isModule (b)));
-  switch (b->kind)
+  switch (static_cast<decl_node__opaque> (b)->kind)
     {
       case decl_imp:
-        b->impF.finallyStatements = s;
+        static_cast<decl_node__opaque> (b)->impF.finallyStatements = static_cast<decl_node__opaque> (s);
         break;
 
       case decl_module:
-        b->moduleF.finallyStatements = s;
+        static_cast<decl_node__opaque> (b)->moduleF.finallyStatements = static_cast<decl_node__opaque> (s);
         break;
 
 
@@ -26505,13 +26644,13 @@ extern "C" void decl_putFinally (decl_node b, decl_node s)
 
 extern "C" decl_node decl_makeExit (decl_node l, unsigned int n)
 {
-  decl_node e;
+  decl_node__opaque e;
 
   mcDebug_assert (decl_isLoop (l));
   e = newNode (decl_exit);
-  e->exitF.loop = l;
-  l->loopF.labelno = n;
-  return e;
+  e->exitF.loop = static_cast<decl_node__opaque> (l);
+  static_cast<decl_node__opaque> (l)->loopF.labelno = n;
+  return static_cast<decl_node> (e);
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -26524,7 +26663,7 @@ extern "C" decl_node decl_makeExit (decl_node l, unsigned int n)
 extern "C" bool decl_isExit (decl_node n)
 {
   mcDebug_assert (n != NULL);
-  return n->kind == decl_exit;
+  return static_cast<decl_node__opaque> (n)->kind == decl_exit;
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -26536,12 +26675,12 @@ extern "C" bool decl_isExit (decl_node n)
 
 extern "C" decl_node decl_makeLoop (void)
 {
-  decl_node l;
+  decl_node__opaque l;
 
   l = newNode (decl_loop);
-  l->loopF.statements = NULL;
+  l->loopF.statements = static_cast<decl_node__opaque> (NULL);
   l->loopF.labelno = 0;
-  return l;
+  return static_cast<decl_node> (l);
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -26554,7 +26693,7 @@ extern "C" decl_node decl_makeLoop (void)
 extern "C" bool decl_isLoop (decl_node n)
 {
   mcDebug_assert (n != NULL);
-  return n->kind == decl_loop;
+  return static_cast<decl_node__opaque> (n)->kind == decl_loop;
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -26567,7 +26706,7 @@ extern "C" bool decl_isLoop (decl_node n)
 extern "C" void decl_putLoop (decl_node l, decl_node s)
 {
   mcDebug_assert (decl_isLoop (l));
-  l->loopF.statements = s;
+  static_cast<decl_node__opaque> (l)->loopF.statements = static_cast<decl_node__opaque> (s);
 }
 
 
@@ -26600,17 +26739,17 @@ extern "C" decl_node decl_makeComment (const char *a_, unsigned int _a_high)
 
 extern "C" decl_node decl_makeCommentS (mcComment_commentDesc c)
 {
-  decl_node n;
+  decl_node__opaque n;
 
   if (c == NULL)
     {
-      return NULL;
+      return static_cast<decl_node> (NULL);
     }
   else
     {
       n = newNode (decl_comment);
       n->commentF.content = c;
-      return n;
+      return static_cast<decl_node> (n);
     }
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
@@ -26625,17 +26764,17 @@ extern "C" decl_node decl_makeCommentS (mcComment_commentDesc c)
 
 extern "C" decl_node decl_makeIf (decl_node e, decl_node s)
 {
-  decl_node n;
+  decl_node__opaque n;
 
   n = newNode (decl_if);
-  n->ifF.expr = e;
-  n->ifF.then = s;
-  n->ifF.else_ = NULL;
-  n->ifF.elsif = NULL;
+  n->ifF.expr = static_cast<decl_node__opaque> (e);
+  n->ifF.then = static_cast<decl_node__opaque> (s);
+  n->ifF.else_ = static_cast<decl_node__opaque> (NULL);
+  n->ifF.elsif = static_cast<decl_node__opaque> (NULL);
   initPair (&n->ifF.ifComment);
   initPair (&n->ifF.elseComment);
   initPair (&n->ifF.endComment);
-  return n;
+  return static_cast<decl_node> (n);
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -26647,7 +26786,7 @@ extern "C" decl_node decl_makeIf (decl_node e, decl_node s)
 
 extern "C" bool decl_isIf (decl_node n)
 {
-  return n->kind == decl_if;
+  return static_cast<decl_node__opaque> (n)->kind == decl_if;
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -26661,26 +26800,26 @@ extern "C" bool decl_isIf (decl_node n)
 
 extern "C" decl_node decl_makeElsif (decl_node i, decl_node e, decl_node s)
 {
-  decl_node n;
+  decl_node__opaque n;
 
   n = newNode (decl_elsif);
-  n->elsifF.expr = e;
-  n->elsifF.then = s;
-  n->elsifF.elsif = NULL;
-  n->elsifF.else_ = NULL;
+  n->elsifF.expr = static_cast<decl_node__opaque> (e);
+  n->elsifF.then = static_cast<decl_node__opaque> (s);
+  n->elsifF.elsif = static_cast<decl_node__opaque> (NULL);
+  n->elsifF.else_ = static_cast<decl_node__opaque> (NULL);
   initPair (&n->elsifF.elseComment);
   mcDebug_assert ((decl_isIf (i)) || (decl_isElsif (i)));
   if (decl_isIf (i))
     {
-      i->ifF.elsif = n;
-      mcDebug_assert (i->ifF.else_ == NULL);
+      static_cast<decl_node__opaque> (i)->ifF.elsif = n;
+      mcDebug_assert (static_cast<decl_node__opaque> (i)->ifF.else_ == NULL);
     }
   else
     {
-      i->elsifF.elsif = n;
-      mcDebug_assert (i->elsifF.else_ == NULL);
+      static_cast<decl_node__opaque> (i)->elsifF.elsif = n;
+      mcDebug_assert (static_cast<decl_node__opaque> (i)->elsifF.else_ == NULL);
     }
-  return n;
+  return static_cast<decl_node> (n);
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -26692,7 +26831,7 @@ extern "C" decl_node decl_makeElsif (decl_node i, decl_node e, decl_node s)
 
 extern "C" bool decl_isElsif (decl_node n)
 {
-  return n->kind == decl_elsif;
+  return static_cast<decl_node__opaque> (n)->kind == decl_elsif;
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -26708,15 +26847,15 @@ extern "C" void decl_putElse (decl_node i, decl_node s)
   mcDebug_assert ((decl_isIf (i)) || (decl_isElsif (i)));
   if (decl_isIf (i))
     {
-      mcDebug_assert (i->ifF.elsif == NULL);
-      mcDebug_assert (i->ifF.else_ == NULL);
-      i->ifF.else_ = s;
+      mcDebug_assert (static_cast<decl_node__opaque> (i)->ifF.elsif == NULL);
+      mcDebug_assert (static_cast<decl_node__opaque> (i)->ifF.else_ == NULL);
+      static_cast<decl_node__opaque> (i)->ifF.else_ = static_cast<decl_node__opaque> (s);
     }
   else
     {
-      mcDebug_assert (i->elsifF.elsif == NULL);
-      mcDebug_assert (i->elsifF.else_ == NULL);
-      i->elsifF.else_ = s;
+      mcDebug_assert (static_cast<decl_node__opaque> (i)->elsifF.elsif == NULL);
+      mcDebug_assert (static_cast<decl_node__opaque> (i)->elsifF.else_ == NULL);
+      static_cast<decl_node__opaque> (i)->elsifF.else_ = static_cast<decl_node__opaque> (s);
     }
 }
 
@@ -26727,15 +26866,15 @@ extern "C" void decl_putElse (decl_node i, decl_node s)
 
 extern "C" decl_node decl_makeFor (void)
 {
-  decl_node n;
+  decl_node__opaque n;
 
   n = newNode (decl_for);
-  n->forF.des = NULL;
-  n->forF.start = NULL;
-  n->forF.end = NULL;
-  n->forF.increment = NULL;
-  n->forF.statements = NULL;
-  return n;
+  n->forF.des = static_cast<decl_node__opaque> (NULL);
+  n->forF.start = static_cast<decl_node__opaque> (NULL);
+  n->forF.end = static_cast<decl_node__opaque> (NULL);
+  n->forF.increment = static_cast<decl_node__opaque> (NULL);
+  n->forF.statements = static_cast<decl_node__opaque> (NULL);
+  return static_cast<decl_node> (n);
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -26748,7 +26887,7 @@ extern "C" decl_node decl_makeFor (void)
 extern "C" bool decl_isFor (decl_node n)
 {
   mcDebug_assert (n != NULL);
-  return n->kind == decl_for;
+  return static_cast<decl_node__opaque> (n)->kind == decl_for;
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -26766,11 +26905,11 @@ extern "C" bool decl_isFor (decl_node n)
 extern "C" void decl_putFor (decl_node f, decl_node i, decl_node s, decl_node e, decl_node b, decl_node sq)
 {
   mcDebug_assert (decl_isFor (f));
-  f->forF.des = i;
-  f->forF.start = s;
-  f->forF.end = e;
-  f->forF.increment = b;
-  f->forF.statements = sq;
+  static_cast<decl_node__opaque> (f)->forF.des = static_cast<decl_node__opaque> (i);
+  static_cast<decl_node__opaque> (f)->forF.start = static_cast<decl_node__opaque> (s);
+  static_cast<decl_node__opaque> (f)->forF.end = static_cast<decl_node__opaque> (e);
+  static_cast<decl_node__opaque> (f)->forF.increment = static_cast<decl_node__opaque> (b);
+  static_cast<decl_node__opaque> (f)->forF.statements = static_cast<decl_node__opaque> (sq);
 }
 
 
@@ -26780,14 +26919,14 @@ extern "C" void decl_putFor (decl_node f, decl_node i, decl_node s, decl_node e,
 
 extern "C" decl_node decl_makeRepeat (void)
 {
-  decl_node n;
+  decl_node__opaque n;
 
   n = newNode (decl_repeat);
-  n->repeatF.expr = NULL;
-  n->repeatF.statements = NULL;
+  n->repeatF.expr = static_cast<decl_node__opaque> (NULL);
+  n->repeatF.statements = static_cast<decl_node__opaque> (NULL);
   initPair (&n->repeatF.repeatComment);
   initPair (&n->repeatF.untilComment);
-  return n;
+  return static_cast<decl_node> (n);
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -26800,7 +26939,7 @@ extern "C" decl_node decl_makeRepeat (void)
 extern "C" bool decl_isRepeat (decl_node n)
 {
   mcDebug_assert (n != NULL);
-  return n->kind == decl_repeat;
+  return static_cast<decl_node__opaque> (n)->kind == decl_repeat;
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -26813,8 +26952,8 @@ extern "C" bool decl_isRepeat (decl_node n)
 
 extern "C" void decl_putRepeat (decl_node n, decl_node s, decl_node e)
 {
-  n->repeatF.expr = e;
-  n->repeatF.statements = s;
+  static_cast<decl_node__opaque> (n)->repeatF.expr = static_cast<decl_node__opaque> (e);
+  static_cast<decl_node__opaque> (n)->repeatF.statements = static_cast<decl_node__opaque> (s);
 }
 
 
@@ -26825,8 +26964,8 @@ extern "C" void decl_putRepeat (decl_node n, decl_node s, decl_node e)
 extern "C" void decl_addRepeatComment (decl_node r, decl_node body, decl_node after)
 {
   mcDebug_assert (decl_isRepeat (r));
-  r->repeatF.repeatComment.after = after;
-  r->repeatF.repeatComment.body = body;
+  static_cast<decl_node__opaque> (r)->repeatF.repeatComment.after = static_cast<decl_node__opaque> (after);
+  static_cast<decl_node__opaque> (r)->repeatF.repeatComment.body = static_cast<decl_node__opaque> (body);
 }
 
 
@@ -26837,8 +26976,8 @@ extern "C" void decl_addRepeatComment (decl_node r, decl_node body, decl_node af
 extern "C" void decl_addUntilComment (decl_node r, decl_node body, decl_node after)
 {
   mcDebug_assert (decl_isRepeat (r));
-  r->repeatF.untilComment.after = after;
-  r->repeatF.untilComment.body = body;
+  static_cast<decl_node__opaque> (r)->repeatF.untilComment.after = static_cast<decl_node__opaque> (after);
+  static_cast<decl_node__opaque> (r)->repeatF.untilComment.body = static_cast<decl_node__opaque> (body);
 }
 
 
@@ -26848,13 +26987,13 @@ extern "C" void decl_addUntilComment (decl_node r, decl_node body, decl_node aft
 
 extern "C" decl_node decl_makeCase (void)
 {
-  decl_node n;
+  decl_node__opaque n;
 
   n = newNode (decl_case);
-  n->caseF.expression = NULL;
+  n->caseF.expression = static_cast<decl_node__opaque> (NULL);
   n->caseF.caseLabelList = Indexing_InitIndex (1);
-  n->caseF.else_ = NULL;
-  return n;
+  n->caseF.else_ = static_cast<decl_node__opaque> (NULL);
+  return static_cast<decl_node> (n);
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -26867,7 +27006,7 @@ extern "C" decl_node decl_makeCase (void)
 extern "C" bool decl_isCase (decl_node n)
 {
   mcDebug_assert (n != NULL);
-  return n->kind == decl_case;
+  return static_cast<decl_node__opaque> (n)->kind == decl_case;
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -26881,7 +27020,7 @@ extern "C" bool decl_isCase (decl_node n)
 extern "C" decl_node decl_putCaseExpression (decl_node n, decl_node e)
 {
   mcDebug_assert (decl_isCase (n));
-  n->caseF.expression = e;
+  static_cast<decl_node__opaque> (n)->caseF.expression = static_cast<decl_node__opaque> (e);
   return n;
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
@@ -26896,7 +27035,7 @@ extern "C" decl_node decl_putCaseExpression (decl_node n, decl_node e)
 extern "C" decl_node decl_putCaseElse (decl_node n, decl_node e)
 {
   mcDebug_assert (decl_isCase (n));
-  n->caseF.else_ = e;
+  static_cast<decl_node__opaque> (n)->caseF.else_ = static_cast<decl_node__opaque> (e);
   return n;
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
@@ -26913,7 +27052,7 @@ extern "C" decl_node decl_putCaseStatement (decl_node n, decl_node l, decl_node
 {
   mcDebug_assert (decl_isCase (n));
   mcDebug_assert (decl_isCaseList (l));
-  Indexing_IncludeIndiceIntoIndex (n->caseF.caseLabelList, reinterpret_cast<void *> (decl_makeCaseLabelList (l, s)));
+  Indexing_IncludeIndiceIntoIndex (static_cast<decl_node__opaque> (n)->caseF.caseLabelList, reinterpret_cast<void *> (decl_makeCaseLabelList (l, s)));
   return n;
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
@@ -26926,12 +27065,12 @@ extern "C" decl_node decl_putCaseStatement (decl_node n, decl_node l, decl_node
 
 extern "C" decl_node decl_makeCaseLabelList (decl_node l, decl_node s)
 {
-  decl_node n;
+  decl_node__opaque n;
 
   n = newNode (decl_caselabellist);
-  n->caselabellistF.caseList = l;
-  n->caselabellistF.statements = s;
-  return n;
+  n->caselabellistF.caseList = static_cast<decl_node__opaque> (l);
+  n->caselabellistF.statements = static_cast<decl_node__opaque> (s);
+  return static_cast<decl_node> (n);
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -26944,7 +27083,7 @@ extern "C" decl_node decl_makeCaseLabelList (decl_node l, decl_node s)
 extern "C" bool decl_isCaseLabelList (decl_node n)
 {
   mcDebug_assert (n != NULL);
-  return n->kind == decl_caselabellist;
+  return static_cast<decl_node__opaque> (n)->kind == decl_caselabellist;
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -26956,11 +27095,11 @@ extern "C" bool decl_isCaseLabelList (decl_node n)
 
 extern "C" decl_node decl_makeCaseList (void)
 {
-  decl_node n;
+  decl_node__opaque n;
 
   n = newNode (decl_caselist);
   n->caselistF.rangePairs = Indexing_InitIndex (1);
-  return n;
+  return static_cast<decl_node> (n);
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -26973,7 +27112,7 @@ extern "C" decl_node decl_makeCaseList (void)
 extern "C" bool decl_isCaseList (decl_node n)
 {
   mcDebug_assert (n != NULL);
-  return n->kind == decl_caselist;
+  return static_cast<decl_node__opaque> (n)->kind == decl_caselist;
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -26986,7 +27125,7 @@ extern "C" bool decl_isCaseList (decl_node n)
 extern "C" decl_node decl_putCaseRange (decl_node n, decl_node lo, decl_node hi)
 {
   mcDebug_assert (decl_isCaseList (n));
-  Indexing_IncludeIndiceIntoIndex (n->caselistF.rangePairs, reinterpret_cast<void *> (decl_makeRange (lo, hi)));
+  Indexing_IncludeIndiceIntoIndex (static_cast<decl_node__opaque> (n)->caselistF.rangePairs, reinterpret_cast<void *> (decl_makeRange (lo, hi)));
   return n;
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
@@ -26999,12 +27138,12 @@ extern "C" decl_node decl_putCaseRange (decl_node n, decl_node lo, decl_node hi)
 
 extern "C" decl_node decl_makeRange (decl_node lo, decl_node hi)
 {
-  decl_node n;
+  decl_node__opaque n;
 
   n = newNode (decl_range);
-  n->rangeF.lo = lo;
-  n->rangeF.hi = hi;
-  return n;
+  n->rangeF.lo = static_cast<decl_node__opaque> (lo);
+  n->rangeF.hi = static_cast<decl_node__opaque> (hi);
+  return static_cast<decl_node> (n);
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -27017,7 +27156,7 @@ extern "C" decl_node decl_makeRange (decl_node lo, decl_node hi)
 extern "C" bool decl_isRange (decl_node n)
 {
   mcDebug_assert (n != NULL);
-  return n->kind == decl_range;
+  return static_cast<decl_node__opaque> (n)->kind == decl_range;
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -27031,12 +27170,12 @@ extern "C" void decl_setNoReturn (decl_node n, bool value)
 {
   mcDebug_assert (n != NULL);
   mcDebug_assert (decl_isProcedure (n));
-  if (n->procedureF.noreturnused && (n->procedureF.noreturn != value))
+  if (static_cast<decl_node__opaque> (n)->procedureF.noreturnused && (static_cast<decl_node__opaque> (n)->procedureF.noreturn != value))
     {
       mcMetaError_metaError1 ((const char *) "{%1DMad} definition module and implementation module have different <* noreturn *> attributes", 93, (const unsigned char *) &n, (sizeof (n)-1));
     }
-  n->procedureF.noreturn = value;
-  n->procedureF.noreturnused = true;
+  static_cast<decl_node__opaque> (n)->procedureF.noreturn = value;
+  static_cast<decl_node__opaque> (n)->procedureF.noreturnused = true;
 }
 
 
@@ -27050,11 +27189,11 @@ extern "C" decl_node decl_dupExpr (decl_node n)
 {
   if (n == NULL)
     {
-      return NULL;
+      return static_cast<decl_node> (NULL);
     }
   else
     {
-      return doDupExpr (n);
+      return static_cast<decl_node> (doDupExpr (static_cast<decl_node__opaque> (n)));
     }
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
@@ -27108,15 +27247,15 @@ extern "C" void decl_out (void)
   switch (lang)
     {
       case decl_ansiC:
-        outC (p, decl_getMainModule ());
+        outC (p, static_cast<decl_node__opaque> (decl_getMainModule ()));
         break;
 
       case decl_ansiCP:
-        outC (p, decl_getMainModule ());
+        outC (p, static_cast<decl_node__opaque> (decl_getMainModule ()));
         break;
 
       case decl_pim4:
-        outM2 (p, decl_getMainModule ());
+        outM2 (p, static_cast<decl_node__opaque> (decl_getMainModule ()));
         break;
 
 
@@ -27127,11 +27266,11 @@ extern "C" void decl_out (void)
   closeOutput ();
 }
 
-extern "C" void _M2_decl_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
+extern "C" void _M2_decl_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
 {
   init ();
 }
 
-extern "C" void _M2_decl_fini (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
+extern "C" void _M2_decl_fini (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
 {
 }
index 67cd5b2e4d2b466f43148e854b93f1da91ede366..a237a25a3f6c2852cf42a8ebe57216845224c839 100644 (file)
@@ -246,6 +246,19 @@ EXTERN bool decl_isTypeHidden (decl_node n);
 
 EXTERN bool decl_hasHidden (decl_node n);
 
+/*
+   putTypeOpaque - marks type, des, as being an opaque type.
+                   TYPE des ;
+*/
+
+EXTERN void decl_putTypeOpaque (decl_node des);
+
+/*
+   isTypeOpaque - returns TRUE if type, n, is an opaque type.
+*/
+
+EXTERN bool decl_isTypeOpaque (decl_node n);
+
 /*
    isVar - returns TRUE if node, n, is a type.
 */
index 0deb633d6b44fcbb2d94f717e8f372b82d61e2a6..4a15f7b73719fe0cb82351c5f785f93c03480828 100644 (file)
@@ -42,9 +42,9 @@ Boston, MA 02110-1301, USA.  */
 #   undef NULL
 #   define NULL 0
 #endif
-#define _keyc_H
 #define _keyc_C
 
+#include "Gkeyc.h"
 #   include "GmcPretty.h"
 #   include "GStorage.h"
 #   include "GDynamicStrings.h"
@@ -1630,11 +1630,11 @@ extern "C" void keyc_cp (void)
     }
 }
 
-extern "C" void _M2_keyc_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
+extern "C" void _M2_keyc_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
 {
   init ();
 }
 
-extern "C" void _M2_keyc_fini (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
+extern "C" void _M2_keyc_fini (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
 {
 }
index df1f791b3bb3986b1459af7e7f2686cabfa21f49..c4b4d904fb0c51d3787c147db3c009ecc1449798 100644 (file)
@@ -68,7 +68,7 @@ EXTERN long double ldtoa_strtold (void * s, bool *error);
            sign       does the string have a sign?
 */
 
-EXTERN void * ldtoa_ldtoa (long double d, ldtoa_Mode mode, int ndigits, int *decpt, bool *sign);
+EXTERN void * ldtoa_ldtoa (long double d, int mode, int ndigits, int *decpt, bool *sign);
 #   ifdef __cplusplus
 }
 #   endif
index 382b737e4b8fff2340a327f52a89a23570ca7855..2f7fac46d77101b951776b1649cc960424280a61 100644 (file)
@@ -70,7 +70,7 @@ struct libc_tm_r {
                    int tm_yday;
                    int tm_isdst;
                    long int tm_gmtoff;
-                   void *tm_zone;
+                   void * tm_zone;
                  };
 
 struct libc_timeb_r {
index 4bfc310e8ce26eeb376a457068e7a12fea3c30d4..dbbcd0eeb66586b4b4749654078bf1b5de701053 100644 (file)
@@ -41,9 +41,9 @@ Boston, MA 02110-1301, USA.  */
 #   undef NULL
 #   define NULL 0
 #endif
-#define _lists_H
 #define _lists_C
 
+#include "Glists.h"
 #   include "GStorage.h"
 
 typedef struct symbolKey_performOperation_p symbolKey_performOperation;
@@ -53,16 +53,13 @@ typedef struct lists__T1_r lists__T1;
 
 typedef struct lists__T2_a lists__T2;
 
-typedef lists__T1 *lists_list;
-
-typedef void (*symbolKey_performOperation_t) (void *);
-struct symbolKey_performOperation_p { symbolKey_performOperation_t proc; };
+typedef lists__T1 *lists_list__opaque;
 
 struct lists__T2_a { void * array[MaxnoOfelements-1+1]; };
 struct lists__T1_r {
                      unsigned int noOfelements;
                      lists__T2 elements;
-                     lists_list next;
+                     lists_list__opaque next;
                    };
 
 
@@ -140,14 +137,14 @@ extern "C" lists_list lists_duplicateList (lists_list l);
    removeItem - remove an element at index, i, from the list data type.
 */
 
-static void removeItem (lists_list p, lists_list l, unsigned int i);
+static void removeItem (lists_list__opaque p, lists_list__opaque l, unsigned int i);
 
 
 /*
    removeItem - remove an element at index, i, from the list data type.
 */
 
-static void removeItem (lists_list p, lists_list l, unsigned int i)
+static void removeItem (lists_list__opaque p, lists_list__opaque l, unsigned int i)
 {
   l->noOfelements -= 1;
   while (i <= l->noOfelements)
@@ -169,12 +166,12 @@ static void removeItem (lists_list p, lists_list l, unsigned int i)
 
 extern "C" lists_list lists_initList (void)
 {
-  lists_list l;
+  lists_list__opaque l;
 
   Storage_ALLOCATE ((void **) &l, sizeof (lists__T1));
   l->noOfelements = 0;
-  l->next = NULL;
-  return l;
+  l->next = static_cast<lists_list__opaque> (NULL);
+  return static_cast<lists_list> (l);
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -188,9 +185,9 @@ extern "C" void lists_killList (lists_list *l)
 {
   if ((*l) != NULL)
     {
-      if ((*l)->next != NULL)
+      if (static_cast<lists_list__opaque> ((*l))->next != NULL)
         {
-          lists_killList (&(*l)->next);
+          lists_killList (reinterpret_cast<lists_list *> (&static_cast<lists_list__opaque> ((*l))->next));
         }
       Storage_DEALLOCATE ((void **) &(*l), sizeof (lists__T1));
     }
@@ -203,21 +200,21 @@ extern "C" void lists_killList (lists_list *l)
 
 extern "C" void lists_putItemIntoList (lists_list l, void * c)
 {
-  if (l->noOfelements < MaxnoOfelements)
+  if (static_cast<lists_list__opaque> (l)->noOfelements < MaxnoOfelements)
     {
-      l->noOfelements += 1;
-      l->elements.array[l->noOfelements-1] = c;
+      static_cast<lists_list__opaque> (l)->noOfelements += 1;
+      static_cast<lists_list__opaque> (l)->elements.array[static_cast<lists_list__opaque> (l)->noOfelements-1] = c;
     }
-  else if (l->next != NULL)
+  else if (static_cast<lists_list__opaque> (l)->next != NULL)
     {
       /* avoid dangling else.  */
-      lists_putItemIntoList (l->next, c);
+      lists_putItemIntoList (static_cast<lists_list> (static_cast<lists_list__opaque> (l)->next), c);
     }
   else
     {
       /* avoid dangling else.  */
-      l->next = lists_initList ();
-      lists_putItemIntoList (l->next, c);
+      static_cast<lists_list__opaque> (l)->next = static_cast<lists_list__opaque> (lists_initList ());
+      lists_putItemIntoList (static_cast<lists_list> (static_cast<lists_list__opaque> (l)->next), c);
     }
 }
 
@@ -230,17 +227,17 @@ extern "C" void * lists_getItemFromList (lists_list l, unsigned int n)
 {
   while (l != NULL)
     {
-      if (n <= l->noOfelements)
+      if (n <= static_cast<lists_list__opaque> (l)->noOfelements)
         {
-          return l->elements.array[n-1];
+          return static_cast<lists_list__opaque> (l)->elements.array[n-1];
         }
       else
         {
-          n -= l->noOfelements;
+          n -= static_cast<lists_list__opaque> (l)->noOfelements;
         }
-      l = l->next;
+      l = static_cast<lists_list> (static_cast<lists_list__opaque> (l)->next);
     }
-  return reinterpret_cast<void *> (0);
+  return static_cast<void *> (0);
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -263,9 +260,9 @@ extern "C" unsigned int lists_getIndexOfList (lists_list l, void * c)
   else
     {
       i = 1;
-      while (i <= l->noOfelements)
+      while (i <= static_cast<lists_list__opaque> (l)->noOfelements)
         {
-          if (l->elements.array[i-1] == c)
+          if (static_cast<lists_list__opaque> (l)->elements.array[i-1] == c)
             {
               return i;
             }
@@ -274,7 +271,7 @@ extern "C" unsigned int lists_getIndexOfList (lists_list l, void * c)
               i += 1;
             }
         }
-      return l->noOfelements+(lists_getIndexOfList (l->next, c));
+      return static_cast<lists_list__opaque> (l)->noOfelements+(lists_getIndexOfList (static_cast<lists_list> (static_cast<lists_list__opaque> (l)->next), c));
     }
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
@@ -297,8 +294,8 @@ extern "C" unsigned int lists_noOfItemsInList (lists_list l)
     {
       t = 0;
       do {
-        t += l->noOfelements;
-        l = l->next;
+        t += static_cast<lists_list__opaque> (l)->noOfelements;
+        l = static_cast<lists_list> (static_cast<lists_list__opaque> (l)->next);
       } while (! (l == NULL));
       return t;
     }
@@ -328,33 +325,33 @@ extern "C" void lists_includeItemIntoList (lists_list l, void * c)
 
 extern "C" void lists_removeItemFromList (lists_list l, void * c)
 {
-  lists_list p;
+  lists_list__opaque p;
   unsigned int i;
   bool found;
 
   if (l != NULL)
     {
       found = false;
-      p = NULL;
+      p = static_cast<lists_list__opaque> (NULL);
       do {
         i = 1;
-        while ((i <= l->noOfelements) && (l->elements.array[i-1] != c))
+        while ((i <= static_cast<lists_list__opaque> (l)->noOfelements) && (static_cast<lists_list__opaque> (l)->elements.array[i-1] != c))
           {
             i += 1;
           }
-        if ((i <= l->noOfelements) && (l->elements.array[i-1] == c))
+        if ((i <= static_cast<lists_list__opaque> (l)->noOfelements) && (static_cast<lists_list__opaque> (l)->elements.array[i-1] == c))
           {
             found = true;
           }
         else
           {
-            p = l;
-            l = l->next;
+            p = static_cast<lists_list__opaque> (l);
+            l = static_cast<lists_list> (static_cast<lists_list__opaque> (l)->next);
           }
       } while (! ((l == NULL) || found));
       if (found)
         {
-          removeItem (p, l, i);
+          removeItem (p, static_cast<lists_list__opaque> (l), i);
         }
     }
 }
@@ -370,9 +367,9 @@ extern "C" bool lists_isItemInList (lists_list l, void * c)
 
   do {
     i = 1;
-    while (i <= l->noOfelements)
+    while (i <= static_cast<lists_list__opaque> (l)->noOfelements)
       {
-        if (l->elements.array[i-1] == c)
+        if (static_cast<lists_list__opaque> (l)->elements.array[i-1] == c)
           {
             return true;
           }
@@ -381,7 +378,7 @@ extern "C" bool lists_isItemInList (lists_list l, void * c)
             i += 1;
           }
       }
-    l = l->next;
+    l = static_cast<lists_list> (static_cast<lists_list__opaque> (l)->next);
   } while (! (l == NULL));
   return false;
   /* static analysis guarentees a RETURN statement will be used before here.  */
@@ -414,27 +411,27 @@ extern "C" void lists_foreachItemInListDo (lists_list l, symbolKey_performOperat
 
 extern "C" lists_list lists_duplicateList (lists_list l)
 {
-  lists_list m;
+  lists_list__opaque m;
   unsigned int n;
   unsigned int i;
 
-  m = lists_initList ();
+  m = static_cast<lists_list__opaque> (lists_initList ());
   n = lists_noOfItemsInList (l);
   i = 1;
   while (i <= n)
     {
-      lists_putItemIntoList (m, lists_getItemFromList (l, i));
+      lists_putItemIntoList (static_cast<lists_list> (m), lists_getItemFromList (l, i));
       i += 1;
     }
-  return m;
+  return static_cast<lists_list> (m);
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
 
-extern "C" void _M2_lists_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
+extern "C" void _M2_lists_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
 {
 }
 
-extern "C" void _M2_lists_fini (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
+extern "C" void _M2_lists_fini (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
 {
 }
index f17fb19a8e659b1c13da785fd8a2bb752454f140..4c7650283ec229b257c354dbd243ba122e4f7cf3 100644 (file)
@@ -43,9 +43,9 @@ along with GNU Modula-2; see the file COPYING3.  If not see
 #   undef NULL
 #   define NULL 0
 #endif
-#define _mcComment_H
 #define _mcComment_C
 
+#include "GmcComment.h"
 #   include "GDynamicStrings.h"
 #   include "GStorage.h"
 #   include "GnameKey.h"
@@ -57,7 +57,7 @@ typedef struct mcComment__T1_r mcComment__T1;
 
 typedef enum {mcComment_unknown, mcComment_procedureHeading, mcComment_inBody, mcComment_afterStatement} mcComment_commentType;
 
-typedef mcComment__T1 *mcComment_commentDesc;
+typedef mcComment__T1 *mcComment_commentDesc__opaque;
 
 struct mcComment__T1_r {
                          mcComment_commentType type;
@@ -156,13 +156,13 @@ static DynamicStrings_String RemoveNewlines (DynamicStrings_String s);
                    in the comment.
 */
 
-static bool seenProcedure (mcComment_commentDesc cd, nameKey_Name procName);
+static bool seenProcedure (mcComment_commentDesc__opaque cd, nameKey_Name procName);
 
 /*
    dumpComment -
 */
 
-static void dumpComment (mcComment_commentDesc cd);
+static void dumpComment (mcComment_commentDesc__opaque cd);
 
 
 /*
@@ -212,7 +212,7 @@ static DynamicStrings_String RemoveNewlines (DynamicStrings_String s)
                    in the comment.
 */
 
-static bool seenProcedure (mcComment_commentDesc cd, nameKey_Name procName)
+static bool seenProcedure (mcComment_commentDesc__opaque cd, nameKey_Name procName)
 {
   DynamicStrings_String s;
   void * a;
@@ -235,7 +235,7 @@ static bool seenProcedure (mcComment_commentDesc cd, nameKey_Name procName)
    dumpComment -
 */
 
-static void dumpComment (mcComment_commentDesc cd)
+static void dumpComment (mcComment_commentDesc__opaque cd)
 {
   libc_printf ((const char *) "comment : ", 10);
   switch (cd->type)
@@ -282,7 +282,7 @@ static void dumpComment (mcComment_commentDesc cd)
 
 extern "C" mcComment_commentDesc mcComment_initComment (bool onlySpaces)
 {
-  mcComment_commentDesc cd;
+  mcComment_commentDesc__opaque cd;
 
   Storage_ALLOCATE ((void **) &cd, sizeof (mcComment__T1));
   mcDebug_assert (cd != NULL);
@@ -297,7 +297,7 @@ extern "C" mcComment_commentDesc mcComment_initComment (bool onlySpaces)
   cd->content = DynamicStrings_InitString ((const char *) "", 0);
   cd->procName = nameKey_NulName;
   cd->used = false;
-  return cd;
+  return static_cast<mcComment_commentDesc> (cd);
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -312,7 +312,7 @@ extern "C" void mcComment_addText (mcComment_commentDesc cd, void * cs)
 {
   if (cd != NULL)
     {
-      cd->content = DynamicStrings_ConCat (cd->content, DynamicStrings_InitStringCharStar (cs));
+      static_cast<mcComment_commentDesc__opaque> (cd)->content = DynamicStrings_ConCat (static_cast<mcComment_commentDesc__opaque> (cd)->content, DynamicStrings_InitStringCharStar (cs));
     }
 }
 
@@ -325,7 +325,7 @@ extern "C" DynamicStrings_String mcComment_getContent (mcComment_commentDesc cd)
 {
   if (cd != NULL)
     {
-      return cd->content;
+      return static_cast<mcComment_commentDesc__opaque> (cd)->content;
     }
   return static_cast<DynamicStrings_String> (NULL);
   /* static analysis guarentees a RETURN statement will be used before here.  */
@@ -365,10 +365,10 @@ extern "C" void mcComment_setProcedureComment (mcComment_commentDesc cd, nameKey
 {
   if (cd != NULL)
     {
-      if (seenProcedure (cd, procname))
+      if (seenProcedure (static_cast<mcComment_commentDesc__opaque> (cd), procname))
         {
-          cd->type = mcComment_procedureHeading;
-          cd->procName = procname;
+          static_cast<mcComment_commentDesc__opaque> (cd)->type = mcComment_procedureHeading;
+          static_cast<mcComment_commentDesc__opaque> (cd)->procName = procname;
         }
     }
 }
@@ -380,10 +380,10 @@ extern "C" void mcComment_setProcedureComment (mcComment_commentDesc cd, nameKey
 
 extern "C" DynamicStrings_String mcComment_getProcedureComment (mcComment_commentDesc cd)
 {
-  if ((cd->type == mcComment_procedureHeading) && ! cd->used)
+  if ((static_cast<mcComment_commentDesc__opaque> (cd)->type == mcComment_procedureHeading) && ! static_cast<mcComment_commentDesc__opaque> (cd)->used)
     {
-      cd->used = true;
-      return cd->content;
+      static_cast<mcComment_commentDesc__opaque> (cd)->used = true;
+      return static_cast<mcComment_commentDesc__opaque> (cd)->content;
     }
   return static_cast<DynamicStrings_String> (NULL);
   /* static analysis guarentees a RETURN statement will be used before here.  */
@@ -397,10 +397,10 @@ extern "C" DynamicStrings_String mcComment_getProcedureComment (mcComment_commen
 
 extern "C" DynamicStrings_String mcComment_getAfterStatementComment (mcComment_commentDesc cd)
 {
-  if ((cd->type == mcComment_afterStatement) && ! cd->used)
+  if ((static_cast<mcComment_commentDesc__opaque> (cd)->type == mcComment_afterStatement) && ! static_cast<mcComment_commentDesc__opaque> (cd)->used)
     {
-      cd->used = true;
-      return cd->content;
+      static_cast<mcComment_commentDesc__opaque> (cd)->used = true;
+      return static_cast<mcComment_commentDesc__opaque> (cd)->content;
     }
   return static_cast<DynamicStrings_String> (NULL);
   /* static analysis guarentees a RETURN statement will be used before here.  */
@@ -414,10 +414,10 @@ extern "C" DynamicStrings_String mcComment_getAfterStatementComment (mcComment_c
 
 extern "C" DynamicStrings_String mcComment_getInbodyStatementComment (mcComment_commentDesc cd)
 {
-  if ((cd->type == mcComment_inBody) && ! cd->used)
+  if ((static_cast<mcComment_commentDesc__opaque> (cd)->type == mcComment_inBody) && ! static_cast<mcComment_commentDesc__opaque> (cd)->used)
     {
-      cd->used = true;
-      return cd->content;
+      static_cast<mcComment_commentDesc__opaque> (cd)->used = true;
+      return static_cast<mcComment_commentDesc__opaque> (cd)->content;
     }
   return static_cast<DynamicStrings_String> (NULL);
   /* static analysis guarentees a RETURN statement will be used before here.  */
@@ -431,7 +431,7 @@ extern "C" DynamicStrings_String mcComment_getInbodyStatementComment (mcComment_
 
 extern "C" bool mcComment_isProcedureComment (mcComment_commentDesc cd)
 {
-  return (cd != NULL) && (cd->type == mcComment_procedureHeading);
+  return (cd != NULL) && (static_cast<mcComment_commentDesc__opaque> (cd)->type == mcComment_procedureHeading);
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -443,7 +443,7 @@ extern "C" bool mcComment_isProcedureComment (mcComment_commentDesc cd)
 
 extern "C" bool mcComment_isBodyComment (mcComment_commentDesc cd)
 {
-  return (cd != NULL) && (cd->type == mcComment_inBody);
+  return (cd != NULL) && (static_cast<mcComment_commentDesc__opaque> (cd)->type == mcComment_inBody);
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -455,15 +455,15 @@ extern "C" bool mcComment_isBodyComment (mcComment_commentDesc cd)
 
 extern "C" bool mcComment_isAfterComment (mcComment_commentDesc cd)
 {
-  return (cd != NULL) && (cd->type == mcComment_afterStatement);
+  return (cd != NULL) && (static_cast<mcComment_commentDesc__opaque> (cd)->type == mcComment_afterStatement);
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
 
-extern "C" void _M2_mcComment_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
+extern "C" void _M2_mcComment_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
 {
 }
 
-extern "C" void _M2_mcComment_fini (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
+extern "C" void _M2_mcComment_fini (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
 {
 }
index 33c8201d8ad442f127308a65bfd496918a19c821..02877639ad73f2c731623a0d4c2f045c91fa47e5 100644 (file)
@@ -38,9 +38,9 @@ Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
 #   undef NULL
 #   define NULL 0
 #endif
-#define _mcComp_H
 #define _mcComp_C
 
+#include "GmcComp.h"
 #   include "GFIO.h"
 #   include "Glibc.h"
 #   include "Gdecl.h"
@@ -562,7 +562,7 @@ static void pass (unsigned int no, decl_node n, mcComp_parserFunction f, decl_is
             {
               mcError_writeFormat0 ((const char *) "compilation failed", 18);
               mcLexBuf_closeSource ();
-              return ;
+              return;
             }
           mcLexBuf_closeSource ();
         }
@@ -651,11 +651,11 @@ extern "C" unsigned int mcComp_getPassNo (void)
   __builtin_unreachable ();
 }
 
-extern "C" void _M2_mcComp_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
+extern "C" void _M2_mcComp_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
 {
   init ();
 }
 
-extern "C" void _M2_mcComp_fini (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
+extern "C" void _M2_mcComp_fini (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
 {
 }
index f891959319938786d37829de5810d67174b79ec2..154ae6926c1d613d7036ca0771032f05d4b65b79 100644 (file)
@@ -24,9 +24,9 @@ Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
        typedef struct { PROC_t proc; } PROC;
 #   endif
 
-#define _mcDebug_H
 #define _mcDebug_C
 
+#include "GmcDebug.h"
 #   include "GStrIO.h"
 #   include "GmcOptions.h"
 #   include "GmcError.h"
@@ -78,10 +78,10 @@ extern "C" void mcDebug_writeDebug (const char *a_, unsigned int _a_high)
     }
 }
 
-extern "C" void _M2_mcDebug_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
+extern "C" void _M2_mcDebug_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
 {
 }
 
-extern "C" void _M2_mcDebug_fini (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
+extern "C" void _M2_mcDebug_fini (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
 {
 }
index 7a17119f6f347539c6bbf97cfbe2477a8f186bf2..5893201913feda0623e73a27f9d585b723a1bb6b 100644 (file)
@@ -42,9 +42,9 @@ along with GNU Modula-2; see the file COPYING3.  If not see
 #   undef NULL
 #   define NULL 0
 #endif
-#define _mcError_H
 #define _mcError_C
 
+#include "GmcError.h"
 #   include "GASCII.h"
 #   include "GDynamicStrings.h"
 #   include "GFIO.h"
@@ -63,18 +63,18 @@ along with GNU Modula-2; see the file COPYING3.  If not see
 #   define Xcode true
 typedef struct mcError__T2_r mcError__T2;
 
-typedef mcError__T2 *mcError_error;
+typedef mcError__T2 *mcError_error__opaque;
 
 struct mcError__T2_r {
-                       mcError_error parent;
-                       mcError_error child;
-                       mcError_error next;
+                       mcError_error__opaque parent;
+                       mcError_error__opaque child;
+                       mcError_error__opaque next;
                        bool fatal;
                        DynamicStrings_String s;
                        unsigned int token;
                      };
 
-static mcError_error head;
+static mcError_error__opaque head;
 static bool inInternal;
 
 /*
@@ -282,7 +282,7 @@ static void checkIncludes (unsigned int token, unsigned int depth);
    flushAll - flushes all errors in list, e.
 */
 
-static bool flushAll (mcError_error e, bool FatalStatus);
+static bool flushAll (mcError_error__opaque e, bool FatalStatus);
 
 
 /*
@@ -301,7 +301,7 @@ static void cast (unsigned char *a, unsigned int _a_high, const unsigned char *b
     {
       for (i=0; i<=_a_high; i++)
         {
-          a[i] = b[i];
+          const_cast<unsigned char *>(a)[i] = b[i];
         }
     }
 }
@@ -326,7 +326,7 @@ static bool translateNameToCharStar (char *a, unsigned int _a_high, unsigned int
         {
           if ((a[i+1] == 'a') && (argno == n))
             {
-              a[i+1] = 's';
+              const_cast<char *>(a)[i+1] = 's';
               return true;
             }
           argno += 1;
@@ -600,7 +600,7 @@ static DynamicStrings_String doFormat3 (const char *a_, unsigned int _a_high, co
 
 static void init (void)
 {
-  head = NULL;
+  head = static_cast<mcError_error__opaque> (NULL);
   inInternal = false;
 }
 
@@ -656,9 +656,9 @@ static void checkIncludes (unsigned int token, unsigned int depth)
    flushAll - flushes all errors in list, e.
 */
 
-static bool flushAll (mcError_error e, bool FatalStatus)
+static bool flushAll (mcError_error__opaque e, bool FatalStatus)
 {
-  mcError_error f;
+  mcError_error__opaque f;
   bool written;
 
   written = false;
@@ -734,13 +734,13 @@ extern "C" void mcError_internalError (const char *a_, unsigned int _a_high, con
 
 extern "C" void mcError_writeFormat0 (const char *a_, unsigned int _a_high)
 {
-  mcError_error e;
+  mcError_error__opaque e;
   char a[_a_high+1];
 
   /* make a local copy of each unbounded array.  */
   memcpy (a, a_, _a_high+1);
 
-  e = mcError_newError (mcLexBuf_getTokenNo ());
+  e = static_cast<mcError_error__opaque> (mcError_newError (mcLexBuf_getTokenNo ()));
   e->s = FormatStrings_Sprintf0 (DynamicStrings_Mark (DynamicStrings_InitString ((const char *) a, _a_high)));
 }
 
@@ -753,7 +753,7 @@ extern "C" void mcError_writeFormat0 (const char *a_, unsigned int _a_high)
 
 extern "C" void mcError_writeFormat1 (const char *a_, unsigned int _a_high, const unsigned char *w_, unsigned int _w_high)
 {
-  mcError_error e;
+  mcError_error__opaque e;
   char a[_a_high+1];
   unsigned char w[_w_high+1];
 
@@ -761,7 +761,7 @@ extern "C" void mcError_writeFormat1 (const char *a_, unsigned int _a_high, cons
   memcpy (a, a_, _a_high+1);
   memcpy (w, w_, _w_high+1);
 
-  e = mcError_newError (mcLexBuf_getTokenNo ());
+  e = static_cast<mcError_error__opaque> (mcError_newError (mcLexBuf_getTokenNo ()));
   e->s = doFormat1 ((const char *) a, _a_high, (const unsigned char *) w, _w_high);
 }
 
@@ -774,7 +774,7 @@ extern "C" void mcError_writeFormat1 (const char *a_, unsigned int _a_high, cons
 
 extern "C" void mcError_writeFormat2 (const char *a_, unsigned int _a_high, const unsigned char *w1_, unsigned int _w1_high, const unsigned char *w2_, unsigned int _w2_high)
 {
-  mcError_error e;
+  mcError_error__opaque e;
   char a[_a_high+1];
   unsigned char w1[_w1_high+1];
   unsigned char w2[_w2_high+1];
@@ -784,7 +784,7 @@ extern "C" void mcError_writeFormat2 (const char *a_, unsigned int _a_high, cons
   memcpy (w1, w1_, _w1_high+1);
   memcpy (w2, w2_, _w2_high+1);
 
-  e = mcError_newError (mcLexBuf_getTokenNo ());
+  e = static_cast<mcError_error__opaque> (mcError_newError (mcLexBuf_getTokenNo ()));
   e->s = doFormat2 ((const char *) a, _a_high, (const unsigned char *) w1, _w1_high, (const unsigned char *) w2, _w2_high);
 }
 
@@ -797,7 +797,7 @@ extern "C" void mcError_writeFormat2 (const char *a_, unsigned int _a_high, cons
 
 extern "C" void mcError_writeFormat3 (const char *a_, unsigned int _a_high, const unsigned char *w1_, unsigned int _w1_high, const unsigned char *w2_, unsigned int _w2_high, const unsigned char *w3_, unsigned int _w3_high)
 {
-  mcError_error e;
+  mcError_error__opaque e;
   char a[_a_high+1];
   unsigned char w1[_w1_high+1];
   unsigned char w2[_w2_high+1];
@@ -809,7 +809,7 @@ extern "C" void mcError_writeFormat3 (const char *a_, unsigned int _a_high, cons
   memcpy (w2, w2_, _w2_high+1);
   memcpy (w3, w3_, _w3_high+1);
 
-  e = mcError_newError (mcLexBuf_getTokenNo ());
+  e = static_cast<mcError_error__opaque> (mcError_newError (mcLexBuf_getTokenNo ()));
   e->s = doFormat3 ((const char *) a, _a_high, (const unsigned char *) w1, _w1_high, (const unsigned char *) w2, _w2_high, (const unsigned char *) w3, _w3_high);
 }
 
@@ -820,15 +820,15 @@ extern "C" void mcError_writeFormat3 (const char *a_, unsigned int _a_high, cons
 
 extern "C" mcError_error mcError_newError (unsigned int atTokenNo)
 {
-  mcError_error e;
-  mcError_error f;
+  mcError_error__opaque e;
+  mcError_error__opaque f;
 
   Storage_ALLOCATE ((void **) &e, sizeof (mcError__T2));
   e->s = static_cast<DynamicStrings_String> (NULL);
   e->token = atTokenNo;
-  e->next = NULL;
-  e->parent = NULL;
-  e->child = NULL;
+  e->next = static_cast<mcError_error__opaque> (NULL);
+  e->parent = static_cast<mcError_error__opaque> (NULL);
+  e->child = static_cast<mcError_error__opaque> (NULL);
   e->fatal = true;
   if ((head == NULL) || (head->token > atTokenNo))
     {
@@ -845,7 +845,7 @@ extern "C" mcError_error mcError_newError (unsigned int atTokenNo)
       e->next = f->next;
       f->next = e;
     }
-  return e;
+  return static_cast<mcError_error> (e);
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -858,11 +858,11 @@ extern "C" mcError_error mcError_newError (unsigned int atTokenNo)
 
 extern "C" mcError_error mcError_newWarning (unsigned int atTokenNo)
 {
-  mcError_error e;
+  mcError_error__opaque e;
 
-  e = mcError_newError (atTokenNo);
+  e = static_cast<mcError_error__opaque> (mcError_newError (atTokenNo));
   e->fatal = false;
-  return e;
+  return static_cast<mcError_error> (e);
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -876,7 +876,7 @@ extern "C" mcError_error mcError_newWarning (unsigned int atTokenNo)
 
 extern "C" mcError_error mcError_chainError (unsigned int atTokenNo, mcError_error e)
 {
-  mcError_error f;
+  mcError_error__opaque f;
 
   if (e == NULL)
     {
@@ -887,13 +887,13 @@ extern "C" mcError_error mcError_chainError (unsigned int atTokenNo, mcError_err
       Storage_ALLOCATE ((void **) &f, sizeof (mcError__T2));
       f->s = static_cast<DynamicStrings_String> (NULL);
       f->token = atTokenNo;
-      f->next = e->child;
-      f->parent = e;
-      f->child = NULL;
-      f->fatal = e->fatal;
-      e->child = f;
+      f->next = static_cast<mcError_error__opaque> (e)->child;
+      f->parent = static_cast<mcError_error__opaque> (e);
+      f->child = static_cast<mcError_error__opaque> (NULL);
+      f->fatal = static_cast<mcError_error__opaque> (e)->fatal;
+      static_cast<mcError_error__opaque> (e)->child = f;
     }
-  return f;
+  return static_cast<mcError_error> (f);
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -908,13 +908,13 @@ extern "C" void mcError_errorFormat0 (mcError_error e, const char *a_, unsigned
   /* 
    errorFormat routines provide a printf capability for the error handle.
   */
-  if (e->s == NULL)
+  if (static_cast<mcError_error__opaque> (e)->s == NULL)
     {
-      e->s = FormatStrings_Sprintf0 (DynamicStrings_Mark (DynamicStrings_InitString ((const char *) a, _a_high)));
+      static_cast<mcError_error__opaque> (e)->s = FormatStrings_Sprintf0 (DynamicStrings_Mark (DynamicStrings_InitString ((const char *) a, _a_high)));
     }
   else
     {
-      e->s = DynamicStrings_ConCat (e->s, DynamicStrings_Mark (FormatStrings_Sprintf0 (DynamicStrings_Mark (DynamicStrings_InitString ((const char *) a, _a_high)))));
+      static_cast<mcError_error__opaque> (e)->s = DynamicStrings_ConCat (static_cast<mcError_error__opaque> (e)->s, DynamicStrings_Mark (FormatStrings_Sprintf0 (DynamicStrings_Mark (DynamicStrings_InitString ((const char *) a, _a_high)))));
     }
 }
 
@@ -929,13 +929,13 @@ extern "C" void mcError_errorFormat1 (mcError_error e, const char *a_, unsigned
   memcpy (w, w_, _w_high+1);
 
   s1 = doFormat1 ((const char *) a, _a_high, (const unsigned char *) w, _w_high);
-  if (e->s == NULL)
+  if (static_cast<mcError_error__opaque> (e)->s == NULL)
     {
-      e->s = s1;
+      static_cast<mcError_error__opaque> (e)->s = s1;
     }
   else
     {
-      e->s = DynamicStrings_ConCat (e->s, DynamicStrings_Mark (s1));
+      static_cast<mcError_error__opaque> (e)->s = DynamicStrings_ConCat (static_cast<mcError_error__opaque> (e)->s, DynamicStrings_Mark (s1));
     }
 }
 
@@ -952,13 +952,13 @@ extern "C" void mcError_errorFormat2 (mcError_error e, const char *a_, unsigned
   memcpy (w2, w2_, _w2_high+1);
 
   s1 = doFormat2 ((const char *) a, _a_high, (const unsigned char *) w1, _w1_high, (const unsigned char *) w2, _w2_high);
-  if (e->s == NULL)
+  if (static_cast<mcError_error__opaque> (e)->s == NULL)
     {
-      e->s = s1;
+      static_cast<mcError_error__opaque> (e)->s = s1;
     }
   else
     {
-      e->s = DynamicStrings_ConCat (e->s, DynamicStrings_Mark (s1));
+      static_cast<mcError_error__opaque> (e)->s = DynamicStrings_ConCat (static_cast<mcError_error__opaque> (e)->s, DynamicStrings_Mark (s1));
     }
 }
 
@@ -977,19 +977,19 @@ extern "C" void mcError_errorFormat3 (mcError_error e, const char *a_, unsigned
   memcpy (w3, w3_, _w3_high+1);
 
   s1 = doFormat3 ((const char *) a, _a_high, (const unsigned char *) w1, _w1_high, (const unsigned char *) w2, _w2_high, (const unsigned char *) w3, _w3_high);
-  if (e->s == NULL)
+  if (static_cast<mcError_error__opaque> (e)->s == NULL)
     {
-      e->s = s1;
+      static_cast<mcError_error__opaque> (e)->s = s1;
     }
   else
     {
-      e->s = DynamicStrings_ConCat (e->s, DynamicStrings_Mark (s1));
+      static_cast<mcError_error__opaque> (e)->s = DynamicStrings_ConCat (static_cast<mcError_error__opaque> (e)->s, DynamicStrings_Mark (s1));
     }
 }
 
 extern "C" void mcError_errorString (mcError_error e, DynamicStrings_String str)
 {
-  e->s = str;
+  static_cast<mcError_error__opaque> (e)->s = str;
 }
 
 
@@ -1001,10 +1001,10 @@ extern "C" void mcError_errorString (mcError_error e, DynamicStrings_String str)
 
 extern "C" void mcError_errorStringAt (DynamicStrings_String s, unsigned int tok)
 {
-  mcError_error e;
+  mcError_error__opaque e;
 
-  e = mcError_newError (tok);
-  mcError_errorString (e, s);
+  e = static_cast<mcError_error__opaque> (mcError_newError (tok));
+  mcError_errorString (static_cast<mcError_error> (e), s);
 }
 
 
@@ -1028,15 +1028,15 @@ extern "C" void mcError_errorStringAt2 (DynamicStrings_String s, unsigned int to
 
 extern "C" void mcError_errorStringsAt2 (DynamicStrings_String s1, DynamicStrings_String s2, unsigned int tok1, unsigned int tok2)
 {
-  mcError_error e;
+  mcError_error__opaque e;
 
   if (s1 == s2)
     {
       s2 = DynamicStrings_Dup (s1);
     }
-  e = mcError_newError (tok1);
-  mcError_errorString (e, s1);
-  mcError_errorString (mcError_chainError (tok2, e), s2);
+  e = static_cast<mcError_error__opaque> (mcError_newError (tok1));
+  mcError_errorString (static_cast<mcError_error> (e), s1);
+  mcError_errorString (mcError_chainError (tok2, static_cast<mcError_error> (e)), s2);
 }
 
 
@@ -1048,10 +1048,10 @@ extern "C" void mcError_errorStringsAt2 (DynamicStrings_String s1, DynamicString
 
 extern "C" void mcError_warnStringAt (DynamicStrings_String s, unsigned int tok)
 {
-  mcError_error e;
+  mcError_error__opaque e;
 
-  e = mcError_newWarning (tok);
-  mcError_errorString (e, s);
+  e = static_cast<mcError_error__opaque> (mcError_newWarning (tok));
+  mcError_errorString (static_cast<mcError_error> (e), s);
 }
 
 
@@ -1075,20 +1075,20 @@ extern "C" void mcError_warnStringAt2 (DynamicStrings_String s, unsigned int tok
 
 extern "C" void mcError_warnStringsAt2 (DynamicStrings_String s1, DynamicStrings_String s2, unsigned int tok1, unsigned int tok2)
 {
-  mcError_error e;
+  mcError_error__opaque e;
 
   if (s1 == s2)
     {
       s2 = DynamicStrings_Dup (s1);
     }
-  e = mcError_newWarning (tok1);
-  mcError_errorString (e, s1);
-  mcError_errorString (mcError_chainError (tok2, e), s2);
+  e = static_cast<mcError_error__opaque> (mcError_newWarning (tok1));
+  mcError_errorString (static_cast<mcError_error> (e), s1);
+  mcError_errorString (mcError_chainError (tok2, static_cast<mcError_error> (e)), s2);
 }
 
 extern "C" void mcError_warnFormat0 (const char *a_, unsigned int _a_high)
 {
-  mcError_error e;
+  mcError_error__opaque e;
   char a[_a_high+1];
 
   /* make a local copy of each unbounded array.  */
@@ -1099,7 +1099,7 @@ extern "C" void mcError_warnFormat0 (const char *a_, unsigned int _a_high)
                  with the encapsulated format string.
                  Used for simple warning messages tied to the current token.
   */
-  e = mcError_newWarning (mcLexBuf_getTokenNo ());
+  e = static_cast<mcError_error__opaque> (mcError_newWarning (mcLexBuf_getTokenNo ()));
   e->s = FormatStrings_Sprintf0 (DynamicStrings_Mark (DynamicStrings_InitString ((const char *) a, _a_high)));
 }
 
@@ -1112,7 +1112,7 @@ extern "C" void mcError_warnFormat0 (const char *a_, unsigned int _a_high)
 
 extern "C" void mcError_warnFormat1 (const char *a_, unsigned int _a_high, const unsigned char *w_, unsigned int _w_high)
 {
-  mcError_error e;
+  mcError_error__opaque e;
   char a[_a_high+1];
   unsigned char w[_w_high+1];
 
@@ -1120,7 +1120,7 @@ extern "C" void mcError_warnFormat1 (const char *a_, unsigned int _a_high, const
   memcpy (a, a_, _a_high+1);
   memcpy (w, w_, _w_high+1);
 
-  e = mcError_newWarning (mcLexBuf_getTokenNo ());
+  e = static_cast<mcError_error__opaque> (mcError_newWarning (mcLexBuf_getTokenNo ()));
   e->s = doFormat1 ((const char *) a, _a_high, (const unsigned char *) w, _w_high);
 }
 
@@ -1188,11 +1188,11 @@ extern "C" void mcError_errorAbort0 (const char *a_, unsigned int _a_high)
   __builtin_unreachable ();
 }
 
-extern "C" void _M2_mcError_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
+extern "C" void _M2_mcError_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
 {
   init ();
 }
 
-extern "C" void _M2_mcError_fini (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
+extern "C" void _M2_mcError_fini (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
 {
 }
index c2c23941287d8c4fa0a8d97298d780b1adaa9cd2..6999113a85ef55f7bcd9ce63e3e5da9e169ac374 100644 (file)
@@ -24,9 +24,9 @@ Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
        typedef struct { PROC_t proc; } PROC;
 #   endif
 
-#define _mcFileName_H
 #define _mcFileName_C
 
+#include "GmcFileName.h"
 #   include "GASCII.h"
 #   include "GDynamicStrings.h"
 
@@ -144,10 +144,10 @@ extern "C" DynamicStrings_String mcFileName_extractModule (DynamicStrings_String
   __builtin_unreachable ();
 }
 
-extern "C" void _M2_mcFileName_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
+extern "C" void _M2_mcFileName_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
 {
 }
 
-extern "C" void _M2_mcFileName_fini (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
+extern "C" void _M2_mcFileName_fini (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
 {
 }
index d84440be51d72eda044d39a74eec35adb60fd8af..bd6d45738dfa42f6720d8e7bd1d3ef9789d191fd 100644 (file)
@@ -42,9 +42,9 @@ along with GNU Modula-2; see the file COPYING3.  If not see
 #   undef NULL
 #   define NULL 0
 #endif
-#define _mcLexBuf_H
 #define _mcLexBuf_C
 
+#include "GmcLexBuf.h"
 #   include "Gmcflex.h"
 #   include "Glibc.h"
 #   include "GSYSTEM.h"
@@ -58,12 +58,6 @@ along with GNU Modula-2; see the file COPYING3.  If not see
 #   include "GmcDebug.h"
 #   include "GM2RTS.h"
 
-mcComment_commentDesc mcLexBuf_currentcomment;
-mcComment_commentDesc mcLexBuf_lastcomment;
-int mcLexBuf_currentinteger;
-unsigned int mcLexBuf_currentcolumn;
-void * mcLexBuf_currentstring;
-mcReserved_toktype mcLexBuf_currenttoken;
 #   define MaxBucketSize 100
 #   define Debugging false
 typedef struct mcLexBuf_tokenDesc_r mcLexBuf_tokenDesc;
@@ -1152,7 +1146,7 @@ static void doGetToken (void)
               /* call the lexical phase to place a new token into the last bucket.  */
               a = mcflex_getToken ();
               mcLexBuf_getToken ();  /* and call ourselves again to collect the token from bucket.  */
-              return ;  /* and call ourselves again to collect the token from bucket.  */
+              return;  /* and call ourselves again to collect the token from bucket.  */
             }
         }
       else
@@ -1840,11 +1834,11 @@ extern "C" void mcLexBuf_popFile (void * filename)
   /* source file list is empty, cannot pop an include..  */
 }
 
-extern "C" void _M2_mcLexBuf_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
+extern "C" void _M2_mcLexBuf_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
 {
   init ();
 }
 
-extern "C" void _M2_mcLexBuf_fini (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
+extern "C" void _M2_mcLexBuf_fini (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
 {
 }
index b4f483bdb187a792585f742cb31f4f254b9a9c07..d3b0fab9cbc0756a6210ee7507c437eccf074b31 100644 (file)
@@ -36,9 +36,9 @@ Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
 #   undef NULL
 #   define NULL 0
 #endif
-#define _mcMetaError_H
 #define _mcMetaError_C
 
+#include "GmcMetaError.h"
 #   include "GnameKey.h"
 #   include "GStrLib.h"
 #   include "GmcLexBuf.h"
@@ -1270,7 +1270,7 @@ static void ebnf (mcError_error *e, mcMetaError_errorType *t, DynamicStrings_Str
             break;
 
           case '}':
-            return ;
+            return;
             break;
 
 
@@ -1872,10 +1872,10 @@ extern "C" void mcMetaError_metaErrorStringT4 (unsigned int tok, DynamicStrings_
   varargs_end (&sym);
 }
 
-extern "C" void _M2_mcMetaError_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
+extern "C" void _M2_mcMetaError_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
 {
 }
 
-extern "C" void _M2_mcMetaError_fini (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
+extern "C" void _M2_mcMetaError_fini (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
 {
 }
index 23d2a39ccda9c0ca96e79240df23c4057daadd12..99e7fb9700ac744b2f2b20292f0309383235bad8 100644 (file)
@@ -37,9 +37,9 @@ Boston, MA 02110-1301, USA.  */
 #   undef NULL
 #   define NULL 0
 #endif
-#define _mcOptions_H
 #define _mcOptions_C
 
+#include "GmcOptions.h"
 #   include "GSArgs.h"
 #   include "GmcSearch.h"
 #   include "Glibc.h"
@@ -885,7 +885,8 @@ static void handleOption (DynamicStrings_String arg)
   else if (optionIs ((const char *) "--extended-opaque", 17, arg))
     {
       /* avoid dangling else.  */
-      setExtendedOpaque (true);
+      /* setExtendedOpaque (TRUE)  */
+      mcPrintf_printf0 ((const char *) "IGNORING --extended-opaque - this option is no longer implemented - please adjust the call to mc\\n", 98);
     }
   else if (optionIs ((const char *) "--debug-top", 11, arg))
     {
@@ -1258,7 +1259,7 @@ extern "C" DynamicStrings_String mcOptions_getCShortRealType (void)
   __builtin_unreachable ();
 }
 
-extern "C" void _M2_mcOptions_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
+extern "C" void _M2_mcOptions_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
 {
   langC = true;
   langCPP = false;
@@ -1293,6 +1294,6 @@ extern "C" void _M2_mcOptions_init (__attribute__((unused)) int argc,__attribute
   CShortReal = DynamicStrings_InitString ((const char *) "float", 5);
 }
 
-extern "C" void _M2_mcOptions_fini (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
+extern "C" void _M2_mcOptions_fini (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
 {
 }
index 74add0c4392e15e8cc21eefe95ed34428e41bd81..6f7679ef3231b9008d2cfeb3addf6d5c274c0eb4 100644 (file)
@@ -24,9 +24,9 @@ Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
        typedef struct { PROC_t proc; } PROC;
 #   endif
 
-#define _mcPreprocess_H
 #define _mcPreprocess_C
 
+#include "GmcPreprocess.h"
 #   include "GSYSTEM.h"
 #   include "GDynamicStrings.h"
 #   include "Glibc.h"
@@ -167,7 +167,7 @@ extern "C" DynamicStrings_String mcPreprocess_preprocessModule (DynamicStrings_S
   __builtin_unreachable ();
 }
 
-extern "C" void _M2_mcPreprocess_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
+extern "C" void _M2_mcPreprocess_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
 {
   listOfFiles = alists_initList ();
   if (! (M2RTS_InstallTerminationProcedure ((PROC ) {(PROC_t) removeFiles})))
@@ -177,6 +177,6 @@ extern "C" void _M2_mcPreprocess_init (__attribute__((unused)) int argc,__attrib
     }
 }
 
-extern "C" void _M2_mcPreprocess_fini (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
+extern "C" void _M2_mcPreprocess_fini (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
 {
 }
index cd48032564538f04dfabb47275d6b5e4d4f0c320..10b262b89792cba0d9856b15be2462c041de6d57 100644 (file)
@@ -38,9 +38,9 @@ Boston, MA 02110-1301, USA.  */
 #   undef NULL
 #   define NULL 0
 #endif
-#define _mcPretty_H
 #define _mcPretty_C
 
+#include "GmcPretty.h"
 #   include "GDynamicStrings.h"
 #   include "GStorage.h"
 
@@ -50,13 +50,7 @@ typedef struct mcPretty_writeLnProc_p mcPretty_writeLnProc;
 
 typedef struct mcPretty__T1_r mcPretty__T1;
 
-typedef mcPretty__T1 *mcPretty_pretty;
-
-typedef void (*mcPretty_writeProc_t) (char);
-struct mcPretty_writeProc_p { mcPretty_writeProc_t proc; };
-
-typedef void (*mcPretty_writeLnProc_t) (void);
-struct mcPretty_writeLnProc_p { mcPretty_writeLnProc_t proc; };
+typedef mcPretty__T1 *mcPretty_pretty__opaque;
 
 struct mcPretty__T1_r {
                         mcPretty_writeProc write_;
@@ -67,7 +61,7 @@ struct mcPretty__T1_r {
                         unsigned int curLine;
                         unsigned int curPos;
                         unsigned int indent;
-                        mcPretty_pretty stacked;
+                        mcPretty_pretty__opaque stacked;
                       };
 
 
@@ -162,20 +156,20 @@ extern "C" void mcPretty_raw (mcPretty_pretty p, DynamicStrings_String s);
    flushSpace -
 */
 
-static void flushSpace (mcPretty_pretty p);
+static void flushSpace (mcPretty_pretty__opaque p);
 
 /*
    flushIndent -
 */
 
-static void flushIndent (mcPretty_pretty p);
+static void flushIndent (mcPretty_pretty__opaque p);
 
 
 /*
    flushSpace -
 */
 
-static void flushSpace (mcPretty_pretty p)
+static void flushSpace (mcPretty_pretty__opaque p)
 {
   if (p->needsSpace)
     {
@@ -191,7 +185,7 @@ static void flushSpace (mcPretty_pretty p)
    flushIndent -
 */
 
-static void flushIndent (mcPretty_pretty p)
+static void flushIndent (mcPretty_pretty__opaque p)
 {
   unsigned int i;
 
@@ -215,7 +209,7 @@ static void flushIndent (mcPretty_pretty p)
 
 extern "C" mcPretty_pretty mcPretty_initPretty (mcPretty_writeProc w, mcPretty_writeLnProc l)
 {
-  mcPretty_pretty p;
+  mcPretty_pretty__opaque p;
 
   Storage_ALLOCATE ((void **) &p, sizeof (mcPretty__T1));
   p->write_ = w;
@@ -226,8 +220,8 @@ extern "C" mcPretty_pretty mcPretty_initPretty (mcPretty_writeProc w, mcPretty_w
   p->curLine = 0;
   p->seekPos = 0;
   p->indent = 0;
-  p->stacked = NULL;
-  return p;
+  p->stacked = static_cast<mcPretty_pretty__opaque> (NULL);
+  return static_cast<mcPretty_pretty> (p);
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -239,11 +233,11 @@ extern "C" mcPretty_pretty mcPretty_initPretty (mcPretty_writeProc w, mcPretty_w
 
 extern "C" mcPretty_pretty mcPretty_dupPretty (mcPretty_pretty p)
 {
-  mcPretty_pretty q;
+  mcPretty_pretty__opaque q;
 
   Storage_ALLOCATE ((void **) &q, sizeof (mcPretty__T1));
-  (*q) = (*p);
-  return q;
+  (*q) = (*static_cast<mcPretty_pretty__opaque> (p));
+  return static_cast<mcPretty_pretty> (q);
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -256,10 +250,10 @@ extern "C" mcPretty_pretty mcPretty_dupPretty (mcPretty_pretty p)
 
 extern "C" void mcPretty_killPretty (mcPretty_pretty *p)
 {
-  (*p) = NULL;
-  return ;
+  (*p) = static_cast<mcPretty_pretty> (NULL);
+  return;
   Storage_DEALLOCATE ((void **) &(*p), sizeof (mcPretty__T1));
-  (*p) = NULL;
+  (*p) = static_cast<mcPretty_pretty> (NULL);
 }
 
 
@@ -269,11 +263,11 @@ extern "C" void mcPretty_killPretty (mcPretty_pretty *p)
 
 extern "C" mcPretty_pretty mcPretty_pushPretty (mcPretty_pretty p)
 {
-  mcPretty_pretty q;
+  mcPretty_pretty__opaque q;
 
-  q = mcPretty_dupPretty (p);
-  q->stacked = p;
-  return q;
+  q = static_cast<mcPretty_pretty__opaque> (mcPretty_dupPretty (p));
+  q->stacked = static_cast<mcPretty_pretty__opaque> (p);
+  return static_cast<mcPretty_pretty> (q);
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -285,16 +279,16 @@ extern "C" mcPretty_pretty mcPretty_pushPretty (mcPretty_pretty p)
 
 extern "C" mcPretty_pretty mcPretty_popPretty (mcPretty_pretty p)
 {
-  mcPretty_pretty q;
-
-  q = p->stacked;
-  q->needsIndent = p->needsIndent;
-  q->needsSpace = p->needsSpace;
-  q->curPos = p->curPos;
-  q->seekPos = p->seekPos;
-  q->curLine = p->curLine;
+  mcPretty_pretty__opaque q;
+
+  q = static_cast<mcPretty_pretty__opaque> (p)->stacked;
+  q->needsIndent = static_cast<mcPretty_pretty__opaque> (p)->needsIndent;
+  q->needsSpace = static_cast<mcPretty_pretty__opaque> (p)->needsSpace;
+  q->curPos = static_cast<mcPretty_pretty__opaque> (p)->curPos;
+  q->seekPos = static_cast<mcPretty_pretty__opaque> (p)->seekPos;
+  q->curLine = static_cast<mcPretty_pretty__opaque> (p)->curLine;
   mcPretty_killPretty (&p);
-  return q;
+  return static_cast<mcPretty_pretty> (q);
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -306,7 +300,7 @@ extern "C" mcPretty_pretty mcPretty_popPretty (mcPretty_pretty p)
 
 extern "C" unsigned int mcPretty_getindent (mcPretty_pretty p)
 {
-  return p->indent;
+  return static_cast<mcPretty_pretty__opaque> (p)->indent;
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -318,7 +312,7 @@ extern "C" unsigned int mcPretty_getindent (mcPretty_pretty p)
 
 extern "C" void mcPretty_setindent (mcPretty_pretty p, unsigned int n)
 {
-  p->indent = n;
+  static_cast<mcPretty_pretty__opaque> (p)->indent = n;
 }
 
 
@@ -328,13 +322,13 @@ extern "C" void mcPretty_setindent (mcPretty_pretty p, unsigned int n)
 
 extern "C" unsigned int mcPretty_getcurpos (mcPretty_pretty s)
 {
-  if (s->needsSpace)
+  if (static_cast<mcPretty_pretty__opaque> (s)->needsSpace)
     {
-      return s->curPos+1;
+      return static_cast<mcPretty_pretty__opaque> (s)->curPos+1;
     }
   else
     {
-      return s->curPos;
+      return static_cast<mcPretty_pretty__opaque> (s)->curPos;
     }
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
@@ -347,7 +341,7 @@ extern "C" unsigned int mcPretty_getcurpos (mcPretty_pretty s)
 
 extern "C" unsigned int mcPretty_getseekpos (mcPretty_pretty s)
 {
-  return s->seekPos;
+  return static_cast<mcPretty_pretty__opaque> (s)->seekPos;
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -359,7 +353,7 @@ extern "C" unsigned int mcPretty_getseekpos (mcPretty_pretty s)
 
 extern "C" unsigned int mcPretty_getcurline (mcPretty_pretty s)
 {
-  return s->curLine;
+  return static_cast<mcPretty_pretty__opaque> (s)->curLine;
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -369,7 +363,7 @@ extern "C" void mcPretty_setNeedSpace (mcPretty_pretty s)
   /* 
    setneedSpace - sets needSpace flag to TRUE.
   */
-  s->needsSpace = true;
+  static_cast<mcPretty_pretty__opaque> (s)->needsSpace = true;
 }
 
 
@@ -379,7 +373,7 @@ extern "C" void mcPretty_setNeedSpace (mcPretty_pretty s)
 
 extern "C" void mcPretty_noSpace (mcPretty_pretty s)
 {
-  s->needsSpace = false;
+  static_cast<mcPretty_pretty__opaque> (s)->needsSpace = false;
 }
 
 
@@ -412,25 +406,25 @@ extern "C" void mcPretty_prints (mcPretty_pretty p, DynamicStrings_String s)
 
   l = DynamicStrings_Length (s);
   i = 0;
-  flushSpace (p);
+  flushSpace (static_cast<mcPretty_pretty__opaque> (p));
   while (i < l)
     {
       if ((((i+2) <= l) && ((DynamicStrings_char (s, static_cast<int> (i))) == '\\')) && ((DynamicStrings_char (s, static_cast<int> (i+1))) == 'n'))
         {
-          p->needsIndent = true;
-          p->needsSpace = false;
-          p->curPos = 0;
-          (*p->writeln.proc) ();
-          p->seekPos += 1;
-          p->curLine += 1;
+          static_cast<mcPretty_pretty__opaque> (p)->needsIndent = true;
+          static_cast<mcPretty_pretty__opaque> (p)->needsSpace = false;
+          static_cast<mcPretty_pretty__opaque> (p)->curPos = 0;
+          (*static_cast<mcPretty_pretty__opaque> (p)->writeln.proc) ();
+          static_cast<mcPretty_pretty__opaque> (p)->seekPos += 1;
+          static_cast<mcPretty_pretty__opaque> (p)->curLine += 1;
           i += 1;
         }
       else
         {
-          flushIndent (p);
-          (*p->write_.proc) (DynamicStrings_char (s, static_cast<int> (i)));
-          p->curPos += 1;
-          p->seekPos += 1;
+          flushIndent (static_cast<mcPretty_pretty__opaque> (p));
+          (*static_cast<mcPretty_pretty__opaque> (p)->write_.proc) (DynamicStrings_char (s, static_cast<int> (i)));
+          static_cast<mcPretty_pretty__opaque> (p)->curPos += 1;
+          static_cast<mcPretty_pretty__opaque> (p)->seekPos += 1;
         }
       i += 1;
     }
@@ -449,21 +443,21 @@ extern "C" void mcPretty_raw (mcPretty_pretty p, DynamicStrings_String s)
 
   l = DynamicStrings_Length (s);
   i = 0;
-  flushSpace (p);
-  flushIndent (p);
+  flushSpace (static_cast<mcPretty_pretty__opaque> (p));
+  flushIndent (static_cast<mcPretty_pretty__opaque> (p));
   while (i < l)
     {
-      (*p->write_.proc) (DynamicStrings_char (s, static_cast<int> (i)));
-      p->curPos += 1;
-      p->seekPos += 1;
+      (*static_cast<mcPretty_pretty__opaque> (p)->write_.proc) (DynamicStrings_char (s, static_cast<int> (i)));
+      static_cast<mcPretty_pretty__opaque> (p)->curPos += 1;
+      static_cast<mcPretty_pretty__opaque> (p)->seekPos += 1;
       i += 1;
     }
 }
 
-extern "C" void _M2_mcPretty_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
+extern "C" void _M2_mcPretty_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
 {
 }
 
-extern "C" void _M2_mcPretty_fini (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
+extern "C" void _M2_mcPretty_fini (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
 {
 }
index 3fd4117c92a421634a6200915992d5b5b2633230..f95ee136e5fb4f00d02171b31f402c8eba6fb4ea 100644 (file)
@@ -36,9 +36,9 @@ Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
 #   undef NULL
 #   define NULL 0
 #endif
-#define _mcPrintf_H
 #define _mcPrintf_C
 
+#include "GmcPrintf.h"
 #   include "GSFIO.h"
 #   include "GFIO.h"
 #   include "GDynamicStrings.h"
@@ -167,7 +167,7 @@ static void cast (unsigned char *a, unsigned int _a_high, const unsigned char *b
     {
       for (i=0; i<=_a_high; i++)
         {
-          a[i] = b[i];
+          const_cast<unsigned char *>(a)[i] = b[i];
         }
     }
   else
@@ -199,7 +199,7 @@ static bool TranslateNameToCharStar (char *a, unsigned int _a_high, unsigned int
         {
           if ((a[i+1] == 'a') && (argno == n))
             {
-              a[i+1] = 's';
+              const_cast<char *>(a)[i+1] = 's';
               return true;
             }
           argno += 1;
@@ -647,10 +647,10 @@ extern "C" void mcPrintf_fprintf4 (FIO_File file, const char *a_, unsigned int _
     {}  /* empty.  */
 }
 
-extern "C" void _M2_mcPrintf_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
+extern "C" void _M2_mcPrintf_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
 {
 }
 
-extern "C" void _M2_mcPrintf_fini (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
+extern "C" void _M2_mcPrintf_fini (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
 {
 }
index ccff3b64b5a15dfae3afc01cfe821ebb7f4aa42f..b9d4e22110a88813080d4d5c88ed13ff79dd41e2 100644 (file)
@@ -24,9 +24,9 @@ Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
        typedef struct { PROC_t proc; } PROC;
 #   endif
 
-#define _mcQuiet_H
 #define _mcQuiet_C
 
+#include "GmcQuiet.h"
 #   include "GmcOptions.h"
 #   include "GmcPrintf.h"
 
@@ -121,10 +121,10 @@ extern "C" void mcQuiet_qprintf4 (const char *a_, unsigned int _a_high, const un
     }
 }
 
-extern "C" void _M2_mcQuiet_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
+extern "C" void _M2_mcQuiet_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
 {
 }
 
-extern "C" void _M2_mcQuiet_fini (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
+extern "C" void _M2_mcQuiet_fini (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
 {
 }
index 9e3519b018451146a3ea0bf215f5afb7b87dd6f8..af7363a0aa651dae577ce6e2d2dc009c4bf9a0c5 100644 (file)
@@ -25,17 +25,15 @@ Boston, MA 02110-1301, USA.  */
        typedef struct { PROC_t proc; } PROC;
 #   endif
 
-#define _mcReserved_H
 #define _mcReserved_C
 
+#include "GmcReserved.h"
 
-typedef enum {mcReserved_eoftok, mcReserved_plustok, mcReserved_minustok, mcReserved_timestok, mcReserved_dividetok, mcReserved_becomestok, mcReserved_ambersandtok, mcReserved_periodtok, mcReserved_commatok, mcReserved_semicolontok, mcReserved_lparatok, mcReserved_rparatok, mcReserved_lsbratok, mcReserved_rsbratok, mcReserved_lcbratok, mcReserved_rcbratok, mcReserved_uparrowtok, mcReserved_singlequotetok, mcReserved_equaltok, mcReserved_hashtok, mcReserved_lesstok, mcReserved_greatertok, mcReserved_lessgreatertok, mcReserved_lessequaltok, mcReserved_greaterequaltok, mcReserved_ldirectivetok, mcReserved_rdirectivetok, mcReserved_periodperiodtok, mcReserved_colontok, mcReserved_doublequotestok, mcReserved_bartok, mcReserved_andtok, mcReserved_arraytok, mcReserved_begintok, mcReserved_bytok, mcReserved_casetok, mcReserved_consttok, mcReserved_definitiontok, mcReserved_divtok, mcReserved_dotok, mcReserved_elsetok, mcReserved_elsiftok, mcReserved_endtok, mcReserved_excepttok, mcReserved_exittok, mcReserved_exporttok, mcReserved_finallytok, mcReserved_fortok, mcReserved_fromtok, mcReserved_iftok, mcReserved_implementationtok, mcReserved_importtok, mcReserved_intok, mcReserved_looptok, mcReserved_modtok, mcReserved_moduletok, mcReserved_nottok, mcReserved_oftok, mcReserved_ortok, mcReserved_packedsettok, mcReserved_pointertok, mcReserved_proceduretok, mcReserved_qualifiedtok, mcReserved_unqualifiedtok, mcReserved_recordtok, mcReserved_remtok, mcReserved_repeattok, mcReserved_retrytok, mcReserved_returntok, mcReserved_settok, mcReserved_thentok, mcReserved_totok, mcReserved_typetok, mcReserved_untiltok, mcReserved_vartok, mcReserved_whiletok, mcReserved_withtok, mcReserved_asmtok, mcReserved_volatiletok, mcReserved_periodperiodperiodtok, mcReserved_datetok, mcReserved_linetok, mcReserved_filetok, mcReserved_attributetok, mcReserved_builtintok, mcReserved_inlinetok, mcReserved_integertok, mcReserved_identtok, mcReserved_realtok, mcReserved_stringtok, mcReserved_commenttok} mcReserved_toktype;
 
-
-extern "C" void _M2_mcReserved_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
+extern "C" void _M2_mcReserved_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
 {
 }
 
-extern "C" void _M2_mcReserved_fini (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
+extern "C" void _M2_mcReserved_fini (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
 {
 }
index add9b820b33bcfc4855f6aa9a7f07a4419da81be..7ebe597d67aef19361456efd2cf7d32f88415b16 100644 (file)
@@ -36,9 +36,9 @@ Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */
 #   undef NULL
 #   define NULL 0
 #endif
-#define _mcSearch_H
 #define _mcSearch_C
 
+#include "GmcSearch.h"
 #   include "GSFIO.h"
 #   include "GmcFileName.h"
 #   include "GDynamicStrings.h"
@@ -399,11 +399,11 @@ extern "C" void mcSearch_setModExtension (DynamicStrings_String ext)
   Mod = DynamicStrings_Dup (ext);
 }
 
-extern "C" void _M2_mcSearch_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
+extern "C" void _M2_mcSearch_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
 {
   Init ();
 }
 
-extern "C" void _M2_mcSearch_fini (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
+extern "C" void _M2_mcSearch_fini (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
 {
 }
index c35fef32f112615c14d576da84904361ae9bd33b..11ff03e407fb3c3be0fa511e0bc7a8b56671bd34 100644 (file)
@@ -31,16 +31,16 @@ Boston, MA 02110-1301, USA.  */
 #   undef NULL
 #   define NULL 0
 #endif
-#define _mcStack_H
 #define _mcStack_C
 
+#include "GmcStack.h"
 #   include "GStorage.h"
 #   include "GIndexing.h"
 #   include "GM2RTS.h"
 
 typedef struct mcStack__T1_r mcStack__T1;
 
-typedef mcStack__T1 *mcStack_stack;
+typedef mcStack__T1 *mcStack_stack__opaque;
 
 struct mcStack__T1_r {
                        Indexing_Index list;
@@ -101,12 +101,12 @@ extern "C" void * mcStack_access (mcStack_stack s, unsigned int i);
 
 extern "C" mcStack_stack mcStack_init (void)
 {
-  mcStack_stack s;
+  mcStack_stack__opaque s;
 
   Storage_ALLOCATE ((void **) &s, sizeof (mcStack__T1));
   s->list = Indexing_InitIndex (1);
   s->count = 0;
-  return s;
+  return static_cast<mcStack_stack> (s);
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -118,9 +118,9 @@ extern "C" mcStack_stack mcStack_init (void)
 
 extern "C" void mcStack_kill (mcStack_stack *s)
 {
-  (*s)->list = Indexing_KillIndex ((*s)->list);
+  static_cast<mcStack_stack__opaque> ((*s))->list = Indexing_KillIndex (static_cast<mcStack_stack__opaque> ((*s))->list);
   Storage_DEALLOCATE ((void **) &(*s), sizeof (mcStack__T1));
-  (*s) = NULL;
+  (*s) = static_cast<mcStack_stack> (NULL);
 }
 
 
@@ -131,15 +131,15 @@ extern "C" void mcStack_kill (mcStack_stack *s)
 
 extern "C" void * mcStack_push (mcStack_stack s, void * a)
 {
-  if (s->count == 0)
+  if (static_cast<mcStack_stack__opaque> (s)->count == 0)
     {
-      Indexing_PutIndice (s->list, Indexing_LowIndice (s->list), a);
+      Indexing_PutIndice (static_cast<mcStack_stack__opaque> (s)->list, Indexing_LowIndice (static_cast<mcStack_stack__opaque> (s)->list), a);
     }
   else
     {
-      Indexing_PutIndice (s->list, (Indexing_HighIndice (s->list))+1, a);
+      Indexing_PutIndice (static_cast<mcStack_stack__opaque> (s)->list, (Indexing_HighIndice (static_cast<mcStack_stack__opaque> (s)->list))+1, a);
     }
-  s->count += 1;
+  static_cast<mcStack_stack__opaque> (s)->count += 1;
   return a;
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
@@ -154,16 +154,16 @@ extern "C" void * mcStack_pop (mcStack_stack s)
 {
   void * a;
 
-  if (s->count == 0)
+  if (static_cast<mcStack_stack__opaque> (s)->count == 0)
     {
       M2RTS_HALT (-1);
       __builtin_unreachable ();
     }
   else
     {
-      s->count -= 1;
-      a = Indexing_GetIndice (s->list, Indexing_HighIndice (s->list));
-      Indexing_DeleteIndice (s->list, Indexing_HighIndice (s->list));
+      static_cast<mcStack_stack__opaque> (s)->count -= 1;
+      a = Indexing_GetIndice (static_cast<mcStack_stack__opaque> (s)->list, Indexing_HighIndice (static_cast<mcStack_stack__opaque> (s)->list));
+      Indexing_DeleteIndice (static_cast<mcStack_stack__opaque> (s)->list, Indexing_HighIndice (static_cast<mcStack_stack__opaque> (s)->list));
       return a;
     }
   ReturnException ("../../gcc/m2/mc/mcStack.def", 20, 1);
@@ -192,7 +192,7 @@ extern "C" void * mcStack_replace (mcStack_stack s, void * a)
 
 extern "C" unsigned int mcStack_depth (mcStack_stack s)
 {
-  return s->count;
+  return static_cast<mcStack_stack__opaque> (s)->count;
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -207,23 +207,23 @@ extern "C" unsigned int mcStack_depth (mcStack_stack s)
 
 extern "C" void * mcStack_access (mcStack_stack s, unsigned int i)
 {
-  if ((i > s->count) || (i == 0))
+  if ((i > static_cast<mcStack_stack__opaque> (s)->count) || (i == 0))
     {
       M2RTS_HALT (-1);
       __builtin_unreachable ();
     }
   else
     {
-      return Indexing_GetIndice (s->list, i);
+      return Indexing_GetIndice (static_cast<mcStack_stack__opaque> (s)->list, i);
     }
   ReturnException ("../../gcc/m2/mc/mcStack.def", 20, 1);
   __builtin_unreachable ();
 }
 
-extern "C" void _M2_mcStack_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
+extern "C" void _M2_mcStack_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
 {
 }
 
-extern "C" void _M2_mcStack_fini (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
+extern "C" void _M2_mcStack_fini (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
 {
 }
index baf301aff61d30b11f639bae13d7c6e32d081d1d..3d8d01da46501f93884293a92df90448d54c6597 100644 (file)
@@ -42,9 +42,9 @@ along with GNU Modula-2; see the file COPYING3.  If not see
 #   undef NULL
 #   define NULL 0
 #endif
-#define _mcStream_H
 #define _mcStream_C
 
+#include "GmcStream.h"
 #   include "GFIO.h"
 #   include "Glibc.h"
 #   include "GIndexing.h"
@@ -264,13 +264,13 @@ extern "C" void mcStream_removeFiles (void)
   listOfFiles = alists_initList ();
 }
 
-extern "C" void _M2_mcStream_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
+extern "C" void _M2_mcStream_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
 {
   listOfFiles = alists_initList ();
   seenDest = false;
   frag = Indexing_InitIndex (1);
 }
 
-extern "C" void _M2_mcStream_fini (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
+extern "C" void _M2_mcStream_fini (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
 {
 }
index c005fcbb7a306046481595534b09b5addbde1af4..b6b0f87a43af5c84b761a8d9d0c2cedbdc9e6f29 100644 (file)
@@ -41,9 +41,9 @@ see <https://www.gnu.org/licenses/>.  */
 #   undef NULL
 #   define NULL 0
 #endif
-#define _mcp1_H
 #define _mcp1_C
 
+#include "Gmcp1.h"
 #   include "GDynamicStrings.h"
 #   include "GmcError.h"
 #   include "GnameKey.h"
@@ -1831,7 +1831,8 @@ static void DefinitionModule (mcp1_SetOfStop0 stopset0, mcp1_SetOfStop1 stopset1
                            
                            % n := makeType (curident)  %
                            ( ';' 
-                             % putTypeHidden (n)  %
+                             % putTypeHidden (n) ;
+                               putTypeOpaque (n)  %
                               | '=' Type Alignment 
                              ';'  )  } 
 
@@ -6955,7 +6956,8 @@ static void DefinitionModule (mcp1_SetOfStop0 stopset0, mcp1_SetOfStop1 stopset1
                            
                            % n := makeType (curident)  %
                            ( ';' 
-                             % putTypeHidden (n)  %
+                             % putTypeHidden (n) ;
+                               putTypeOpaque (n)  %
                               | '=' Type Alignment 
                              ';'  )  } 
 
@@ -6976,6 +6978,7 @@ static void DefTypeDeclaration (mcp1_SetOfStop0 stopset0, mcp1_SetOfStop1 stopse
         {
           Expect (mcReserved_semicolontok, stopset0, stopset1, stopset2|(mcp1_SetOfStop2) ((1 << (mcReserved_identtok-mcReserved_recordtok))));
           decl_putTypeHidden (n);
+          decl_putTypeOpaque (n);
         }
       else if (mcLexBuf_currenttoken == mcReserved_equaltok)
         {
@@ -7257,10 +7260,10 @@ extern "C" bool mcp1_CompilationUnit (void)
   __builtin_unreachable ();
 }
 
-extern "C" void _M2_mcp1_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
+extern "C" void _M2_mcp1_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
 {
 }
 
-extern "C" void _M2_mcp1_fini (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
+extern "C" void _M2_mcp1_fini (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
 {
 }
index c5f32c1395e5605e682f1d6f51b6000c8bb9b56d..f61e42220d415f713f8661876b06b6e6771aff78 100644 (file)
@@ -41,9 +41,9 @@ see <https://www.gnu.org/licenses/>.  */
 #   undef NULL
 #   define NULL 0
 #endif
-#define _mcp2_H
 #define _mcp2_C
 
+#include "Gmcp2.h"
 #   include "GDynamicStrings.h"
 #   include "GmcError.h"
 #   include "GnameKey.h"
@@ -7629,10 +7629,10 @@ extern "C" bool mcp2_CompilationUnit (void)
   __builtin_unreachable ();
 }
 
-extern "C" void _M2_mcp2_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
+extern "C" void _M2_mcp2_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
 {
 }
 
-extern "C" void _M2_mcp2_fini (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
+extern "C" void _M2_mcp2_fini (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
 {
 }
index 096cdafbc64caffc34d4a92f8dca8b4746276ae3..e327d366b560fcd31e462d601b65a28c9022bcd4 100644 (file)
@@ -41,9 +41,9 @@ see <https://www.gnu.org/licenses/>.  */
 #   undef NULL
 #   define NULL 0
 #endif
-#define _mcp3_H
 #define _mcp3_C
 
+#include "Gmcp3.h"
 #   include "GDynamicStrings.h"
 #   include "GmcError.h"
 #   include "GnameKey.h"
@@ -7846,10 +7846,10 @@ extern "C" bool mcp3_CompilationUnit (void)
   __builtin_unreachable ();
 }
 
-extern "C" void _M2_mcp3_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
+extern "C" void _M2_mcp3_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
 {
 }
 
-extern "C" void _M2_mcp3_fini (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
+extern "C" void _M2_mcp3_fini (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
 {
 }
index 0cfbe9b243a1b05e33083e191bdc5a0b061e35d0..2fdd0ae25232bf556c25172d057fe769ca84d4d2 100644 (file)
@@ -41,9 +41,9 @@ see <https://www.gnu.org/licenses/>.  */
 #   undef NULL
 #   define NULL 0
 #endif
-#define _mcp4_H
 #define _mcp4_C
 
+#include "Gmcp4.h"
 #   include "GDynamicStrings.h"
 #   include "GmcError.h"
 #   include "GnameKey.h"
@@ -7709,10 +7709,10 @@ extern "C" bool mcp4_CompilationUnit (void)
   __builtin_unreachable ();
 }
 
-extern "C" void _M2_mcp4_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
+extern "C" void _M2_mcp4_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
 {
 }
 
-extern "C" void _M2_mcp4_fini (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
+extern "C" void _M2_mcp4_fini (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
 {
 }
index 08de65334e8a486f7596c0f3d972c0577a353bef..d1e1fe984fa4c031051ce2a2865187b326e4dce7 100644 (file)
@@ -41,9 +41,9 @@ see <https://www.gnu.org/licenses/>.  */
 #   undef NULL
 #   define NULL 0
 #endif
-#define _mcp5_H
 #define _mcp5_C
 
+#include "Gmcp5.h"
 #   include "GDynamicStrings.h"
 #   include "GmcError.h"
 #   include "GnameKey.h"
@@ -5553,7 +5553,7 @@ static void SubDesignator (mcp5_SetOfStop0 stopset0, mcp5_SetOfStop1 stopset1, m
     {
       ErrorArray ((const char *) "no expression found", 19);
       mcError_flushErrors ();
-      return ;
+      return;
     }
   type = decl_skipType (decl_getType (n));
   if (mcLexBuf_currenttoken == mcReserved_periodtok)
@@ -8568,10 +8568,10 @@ extern "C" bool mcp5_CompilationUnit (void)
   __builtin_unreachable ();
 }
 
-extern "C" void _M2_mcp5_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
+extern "C" void _M2_mcp5_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
 {
 }
 
-extern "C" void _M2_mcp5_fini (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
+extern "C" void _M2_mcp5_fini (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
 {
 }
index 2b236667ea1bb98a869b2f77d9b6307fc5f04483..ba9eaa026c03c8ee71e3a1526bd1e7fb2f7e30ad 100644 (file)
@@ -43,9 +43,9 @@ along with GNU Modula-2; see the file COPYING3.  If not see
 #   undef NULL
 #   define NULL 0
 #endif
-#define _nameKey_H
 #define _nameKey_C
 
+#include "GnameKey.h"
 #   include "GSYSTEM.h"
 #   include "GStorage.h"
 #   include "GIndexing.h"
@@ -394,13 +394,13 @@ extern "C" void nameKey_getKey (nameKey_Name key, char *a, unsigned int _a_high)
   higha = _a_high;
   while (((p != NULL) && (i <= higha)) && ((*p) != ASCII_nul))
     {
-      a[i] = (*p);
+      const_cast<char *>(a)[i] = (*p);
       p += 1;
       i += 1;
     }
   if (i <= higha)
     {
-      a[i] = ASCII_nul;
+      const_cast<char *>(a)[i] = ASCII_nul;
     }
 }
 
@@ -572,7 +572,7 @@ extern "C" void * nameKey_keyToCharStar (nameKey_Name key)
   __builtin_unreachable ();
 }
 
-extern "C" void _M2_nameKey_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
+extern "C" void _M2_nameKey_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
 {
   lastIndice = 0;
   keyIndex = Indexing_InitIndex (1);
@@ -580,6 +580,6 @@ extern "C" void _M2_nameKey_init (__attribute__((unused)) int argc,__attribute__
   binaryTree->left = NULL;
 }
 
-extern "C" void _M2_nameKey_fini (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
+extern "C" void _M2_nameKey_fini (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
 {
 }
index 8a396ef1bac03508cecc9fc280789e1e19a81de2..17072597304b2a8b34f236ed39074ddb4e12b780 100644 (file)
@@ -38,9 +38,9 @@ along with GNU Modula-2; see the file COPYING3.  If not see
 #   undef NULL
 #   define NULL 0
 #endif
-#define _symbolKey_H
 #define _symbolKey_C
 
+#include "GsymbolKey.h"
 #   include "GStorage.h"
 #   include "GStrIO.h"
 #   include "GNumberIO.h"
@@ -54,19 +54,13 @@ typedef struct symbolKey_performOperation_p symbolKey_performOperation;
 
 typedef struct symbolKey__T1_r symbolKey__T1;
 
-typedef symbolKey__T1 *symbolKey_symbolTree;
-
-typedef bool (*symbolKey_isSymbol_t) (void *);
-struct symbolKey_isSymbol_p { symbolKey_isSymbol_t proc; };
-
-typedef void (*symbolKey_performOperation_t) (void *);
-struct symbolKey_performOperation_p { symbolKey_performOperation_t proc; };
+typedef symbolKey__T1 *symbolKey_symbolTree__opaque;
 
 struct symbolKey__T1_r {
                          nameKey_Name name;
-                         void *key;
-                         symbolKey_symbolTree left;
-                         symbolKey_symbolTree right;
+                         void * key;
+                         symbolKey_symbolTree__opaque left;
+                         symbolKey_symbolTree__opaque right;
                        };
 
 extern "C" symbolKey_symbolTree symbolKey_initTree (void);
@@ -113,7 +107,7 @@ extern "C" void symbolKey_foreachNodeDo (symbolKey_symbolTree t, symbolKey_perfo
                              if an entry is found, father is set to the node above child.
 */
 
-static void findNodeAndParentInTree (symbolKey_symbolTree t, nameKey_Name n, symbolKey_symbolTree *child, symbolKey_symbolTree *father);
+static void findNodeAndParentInTree (symbolKey_symbolTree__opaque t, nameKey_Name n, symbolKey_symbolTree__opaque *child, symbolKey_symbolTree__opaque *father);
 
 /*
    searchForAny - performs the search required for doesTreeContainAny.
@@ -121,7 +115,7 @@ static void findNodeAndParentInTree (symbolKey_symbolTree t, nameKey_Name n, sym
                   therefore we must skip over it.
 */
 
-static bool searchForAny (symbolKey_symbolTree t, symbolKey_isSymbol p);
+static bool searchForAny (symbolKey_symbolTree__opaque t, symbolKey_isSymbol p);
 
 /*
    searchAndDo - searches all the nodes in symbolTree, t, and
@@ -129,7 +123,7 @@ static bool searchForAny (symbolKey_symbolTree t, symbolKey_isSymbol p);
                  It traverse the tree in order.
 */
 
-static void searchAndDo (symbolKey_symbolTree t, symbolKey_performOperation p);
+static void searchAndDo (symbolKey_symbolTree__opaque t, symbolKey_performOperation p);
 
 
 /*
@@ -137,7 +131,7 @@ static void searchAndDo (symbolKey_symbolTree t, symbolKey_performOperation p);
                              if an entry is found, father is set to the node above child.
 */
 
-static void findNodeAndParentInTree (symbolKey_symbolTree t, nameKey_Name n, symbolKey_symbolTree *child, symbolKey_symbolTree *father)
+static void findNodeAndParentInTree (symbolKey_symbolTree__opaque t, nameKey_Name n, symbolKey_symbolTree__opaque *child, symbolKey_symbolTree__opaque *father)
 {
   /* remember to skip the sentinal value and assign father and child  */
   (*father) = t;
@@ -171,7 +165,7 @@ static void findNodeAndParentInTree (symbolKey_symbolTree t, nameKey_Name n, sym
                   therefore we must skip over it.
 */
 
-static bool searchForAny (symbolKey_symbolTree t, symbolKey_isSymbol p)
+static bool searchForAny (symbolKey_symbolTree__opaque t, symbolKey_isSymbol p)
 {
   if (t == NULL)
     {
@@ -192,7 +186,7 @@ static bool searchForAny (symbolKey_symbolTree t, symbolKey_isSymbol p)
                  It traverse the tree in order.
 */
 
-static void searchAndDo (symbolKey_symbolTree t, symbolKey_performOperation p)
+static void searchAndDo (symbolKey_symbolTree__opaque t, symbolKey_performOperation p)
 {
   if (t != NULL)
     {
@@ -204,12 +198,12 @@ static void searchAndDo (symbolKey_symbolTree t, symbolKey_performOperation p)
 
 extern "C" symbolKey_symbolTree symbolKey_initTree (void)
 {
-  symbolKey_symbolTree t;
+  symbolKey_symbolTree__opaque t;
 
   Storage_ALLOCATE ((void **) &t, sizeof (symbolKey__T1));  /* The value entity  */
-  t->left = NULL;
-  t->right = NULL;
-  return t;
+  t->left = static_cast<symbolKey_symbolTree__opaque> (NULL);
+  t->right = static_cast<symbolKey_symbolTree__opaque> (NULL);
+  return static_cast<symbolKey_symbolTree> (t);
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -218,17 +212,17 @@ extern "C" void symbolKey_killTree (symbolKey_symbolTree *t)
 {
   if ((*t) != NULL)
     {
-      symbolKey_killTree (&(*t)->left);
-      symbolKey_killTree (&(*t)->right);
+      symbolKey_killTree (reinterpret_cast<symbolKey_symbolTree *> (&static_cast<symbolKey_symbolTree__opaque> ((*t))->left));
+      symbolKey_killTree (reinterpret_cast<symbolKey_symbolTree *> (&static_cast<symbolKey_symbolTree__opaque> ((*t))->right));
       Storage_DEALLOCATE ((void **) &(*t), sizeof (symbolKey__T1));
-      (*t) = NULL;
+      (*t) = static_cast<symbolKey_symbolTree> (NULL);
     }
 }
 
 extern "C" void * symbolKey_getSymKey (symbolKey_symbolTree t, nameKey_Name name)
 {
-  symbolKey_symbolTree father;
-  symbolKey_symbolTree child;
+  symbolKey_symbolTree__opaque father;
+  symbolKey_symbolTree__opaque child;
 
   if (t == NULL)
     {
@@ -236,7 +230,7 @@ extern "C" void * symbolKey_getSymKey (symbolKey_symbolTree t, nameKey_Name name
     }
   else
     {
-      findNodeAndParentInTree (t, name, &child, &father);
+      findNodeAndParentInTree (static_cast<symbolKey_symbolTree__opaque> (t), name, &child, &father);
       if (child == NULL)
         {
           return symbolKey_NulKey;
@@ -252,10 +246,10 @@ extern "C" void * symbolKey_getSymKey (symbolKey_symbolTree t, nameKey_Name name
 
 extern "C" void symbolKey_putSymKey (symbolKey_symbolTree t, nameKey_Name name, void * key)
 {
-  symbolKey_symbolTree father;
-  symbolKey_symbolTree child;
+  symbolKey_symbolTree__opaque father;
+  symbolKey_symbolTree__opaque child;
 
-  findNodeAndParentInTree (t, name, &child, &father);
+  findNodeAndParentInTree (static_cast<symbolKey_symbolTree__opaque> (t), name, &child, &father);
   if (child == NULL)
     {
       /* no child found, now is name less than father or greater?  */
@@ -279,8 +273,8 @@ extern "C" void symbolKey_putSymKey (symbolKey_symbolTree t, nameKey_Name name,
               father->right = child;
             }
         }
-      child->right = NULL;
-      child->left = NULL;
+      child->right = static_cast<symbolKey_symbolTree__opaque> (NULL);
+      child->left = static_cast<symbolKey_symbolTree__opaque> (NULL);
       child->key = key;
       child->name = name;
     }
@@ -300,11 +294,11 @@ extern "C" void symbolKey_putSymKey (symbolKey_symbolTree t, nameKey_Name name,
 
 extern "C" void symbolKey_delSymKey (symbolKey_symbolTree t, nameKey_Name name)
 {
-  symbolKey_symbolTree i;
-  symbolKey_symbolTree child;
-  symbolKey_symbolTree father;
+  symbolKey_symbolTree__opaque i;
+  symbolKey_symbolTree__opaque child;
+  symbolKey_symbolTree__opaque father;
 
-  findNodeAndParentInTree (t, name, &child, &father);  /* find father and child of the node  */
+  findNodeAndParentInTree (static_cast<symbolKey_symbolTree__opaque> (t), name, &child, &father);  /* find father and child of the node  */
   if ((child != NULL) && (child->name == name))
     {
       /* Have found the node to be deleted  */
@@ -364,7 +358,7 @@ extern "C" void symbolKey_delSymKey (symbolKey_symbolTree t, nameKey_Name name)
 
 extern "C" bool symbolKey_isEmptyTree (symbolKey_symbolTree t)
 {
-  return t->left == NULL;
+  return static_cast<symbolKey_symbolTree__opaque> (t)->left == NULL;
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -380,7 +374,7 @@ extern "C" bool symbolKey_isEmptyTree (symbolKey_symbolTree t)
 
 extern "C" bool symbolKey_doesTreeContainAny (symbolKey_symbolTree t, symbolKey_isSymbol p)
 {
-  return searchForAny (t->left, p);
+  return searchForAny (static_cast<symbolKey_symbolTree__opaque> (t)->left, p);
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -395,13 +389,13 @@ extern "C" bool symbolKey_doesTreeContainAny (symbolKey_symbolTree t, symbolKey_
 
 extern "C" void symbolKey_foreachNodeDo (symbolKey_symbolTree t, symbolKey_performOperation p)
 {
-  searchAndDo (t->left, p);
+  searchAndDo (static_cast<symbolKey_symbolTree__opaque> (t)->left, p);
 }
 
-extern "C" void _M2_symbolKey_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
+extern "C" void _M2_symbolKey_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
 {
 }
 
-extern "C" void _M2_symbolKey_fini (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
+extern "C" void _M2_symbolKey_fini (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
 {
 }
index 23bd7cd1644bd390f043e049a82bc0be3bf378a1..5c8abd9940b858b95aa6a81c25c66267711a9fb9 100644 (file)
@@ -34,9 +34,9 @@ along with GNU Modula-2; see the file COPYING3.  If not see
 #   undef NULL
 #   define NULL 0
 #endif
-#define _varargs_H
 #define _varargs_C
 
+#include "Gvarargs.h"
 #   include "GStorage.h"
 #   include "Glibc.h"
 #   include "GSYSTEM.h"
@@ -51,10 +51,10 @@ typedef unsigned char *varargs_ptrToByte;
 
 typedef struct varargs__T7_a varargs__T7;
 
-typedef varargs__T6 *varargs_vararg;
+typedef varargs__T6 *varargs_vararg__opaque;
 
 struct varargs_argDesc_r {
-                           void *ptr;
+                           void * ptr;
                            unsigned int len;
                          };
 
@@ -62,7 +62,7 @@ struct varargs__T7_a { varargs_argDesc array[MaxArg+1]; };
 struct varargs__T6_r {
                        unsigned int nArgs;
                        unsigned int i;
-                       void *contents;
+                       void * contents;
                        unsigned int size;
                        varargs__T7 arg;
                      };
@@ -138,7 +138,7 @@ extern "C" varargs_vararg varargs_start4 (const unsigned char *a_, unsigned int
 
 extern "C" unsigned int varargs_nargs (varargs_vararg v)
 {
-  return v->nArgs;
+  return static_cast<varargs_vararg__opaque> (v)->nArgs;
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -156,20 +156,20 @@ extern "C" void varargs_arg (varargs_vararg v, unsigned char *a, unsigned int _a
   arg__T1 p;
   unsigned int j;
 
-  if (v->i == v->nArgs)
+  if (static_cast<varargs_vararg__opaque> (v)->i == static_cast<varargs_vararg__opaque> (v)->nArgs)
     {
       M2RTS_HALT (-1);  /* too many calls to arg.  */
       __builtin_unreachable ();
     }
   else
     {
-      if ((_a_high+1) == v->arg.array[v->i].len)
+      if ((_a_high+1) == static_cast<varargs_vararg__opaque> (v)->arg.array[static_cast<varargs_vararg__opaque> (v)->i].len)
         {
-          p = static_cast<arg__T1> (v->arg.array[v->i].ptr);
+          p = static_cast<arg__T1> (static_cast<varargs_vararg__opaque> (v)->arg.array[static_cast<varargs_vararg__opaque> (v)->i].ptr);
           j = 0;
           while (j <= _a_high)
             {
-              a[j] = (*p);
+              const_cast<unsigned char *>(a)[j] = (*p);
               p += 1;
               j += 1;
             }
@@ -179,7 +179,7 @@ extern "C" void varargs_arg (varargs_vararg v, unsigned char *a, unsigned int _a
           M2RTS_HALT (-1);  /* parameter mismatch.  */
           __builtin_unreachable ();
         }
-      v->i += 1;
+      static_cast<varargs_vararg__opaque> (v)->i += 1;
     }
 }
 
@@ -190,7 +190,7 @@ extern "C" void varargs_arg (varargs_vararg v, unsigned char *a, unsigned int _a
 
 extern "C" void varargs_next (varargs_vararg v, unsigned int i)
 {
-  v->i = i;
+  static_cast<varargs_vararg__opaque> (v)->i = i;
 }
 
 
@@ -200,24 +200,24 @@ extern "C" void varargs_next (varargs_vararg v, unsigned int i)
 
 extern "C" varargs_vararg varargs_copy (varargs_vararg v)
 {
-  varargs_vararg c;
+  varargs_vararg__opaque c;
   unsigned int j;
   unsigned int offset;
 
   Storage_ALLOCATE ((void **) &c, sizeof (varargs__T6));
-  c->i = v->i;
-  c->nArgs = v->nArgs;
-  c->size = v->size;
+  c->i = static_cast<varargs_vararg__opaque> (v)->i;
+  c->nArgs = static_cast<varargs_vararg__opaque> (v)->nArgs;
+  c->size = static_cast<varargs_vararg__opaque> (v)->size;
   Storage_ALLOCATE (&c->contents, c->size);
-  c->contents = libc_memcpy (c->contents, v->contents, static_cast<size_t> (c->size));
+  c->contents = libc_memcpy (c->contents, static_cast<varargs_vararg__opaque> (v)->contents, static_cast<size_t> (c->size));
   for (j=0; j<=c->nArgs; j++)
     {
-      offset = (unsigned int ) (((varargs_ptrToByte) (v->contents))-((varargs_ptrToByte) (v->arg.array[j].ptr)));
-      c->arg.array[j].ptr = reinterpret_cast<void *> ((varargs_ptrToByte) (c->contents));
+      offset = (unsigned int ) (((varargs_ptrToByte) (static_cast<varargs_vararg__opaque> (v)->contents))-((varargs_ptrToByte) (static_cast<varargs_vararg__opaque> (v)->arg.array[j].ptr)));
+      c->arg.array[j].ptr = static_cast<void *> ((varargs_ptrToByte) (c->contents));
       c->arg.array[j].ptr = reinterpret_cast<void *> (reinterpret_cast<char *> (c->arg.array[j].ptr)+offset);
-      c->arg.array[j].len = v->arg.array[j].len;
+      c->arg.array[j].len = static_cast<varargs_vararg__opaque> (v)->arg.array[j].len;
     }
-  return c;
+  return static_cast<varargs_vararg> (c);
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -236,16 +236,16 @@ extern "C" void varargs_replace (varargs_vararg v, unsigned char *a, unsigned in
   replace__T2 p;
   unsigned int j;
 
-  if (v->i == v->nArgs)
+  if (static_cast<varargs_vararg__opaque> (v)->i == static_cast<varargs_vararg__opaque> (v)->nArgs)
     {
       M2RTS_HALT (-1);  /* too many calls to arg.  */
       __builtin_unreachable ();
     }
   else
     {
-      if ((_a_high+1) == v->arg.array[v->i].len)
+      if ((_a_high+1) == static_cast<varargs_vararg__opaque> (v)->arg.array[static_cast<varargs_vararg__opaque> (v)->i].len)
         {
-          p = static_cast<replace__T2> (v->arg.array[v->i].ptr);
+          p = static_cast<replace__T2> (static_cast<varargs_vararg__opaque> (v)->arg.array[static_cast<varargs_vararg__opaque> (v)->i].ptr);
           j = 0;
           while (j <= _a_high)
             {
@@ -271,7 +271,7 @@ extern "C" void varargs_end (varargs_vararg *v)
 {
   if ((*v) != NULL)
     {
-      Storage_DEALLOCATE (&(*v)->contents, sizeof (varargs_vararg));
+      Storage_DEALLOCATE (&static_cast<varargs_vararg__opaque> ((*v))->contents, sizeof (varargs_vararg));
       Storage_DEALLOCATE ((void **) &(*v), sizeof (varargs__T6));
     }
 }
@@ -283,7 +283,7 @@ extern "C" void varargs_end (varargs_vararg *v)
 
 extern "C" varargs_vararg varargs_start1 (const unsigned char *a_, unsigned int _a_high)
 {
-  varargs_vararg v;
+  varargs_vararg__opaque v;
   unsigned char a[_a_high+1];
 
   /* make a local copy of each unbounded array.  */
@@ -294,10 +294,10 @@ extern "C" varargs_vararg varargs_start1 (const unsigned char *a_, unsigned int
   v->nArgs = 1;
   v->size = _a_high+1;
   Storage_ALLOCATE (&v->contents, v->size);
-  v->contents = libc_memcpy (v->contents, &a, static_cast<size_t> (v->size));
+  v->contents = libc_memcpy (v->contents, const_cast<void*> (static_cast<const void*>(a)), static_cast<size_t> (v->size));
   v->arg.array[0].ptr = v->contents;
   v->arg.array[0].len = v->size;
-  return v;
+  return static_cast<varargs_vararg> (v);
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -311,7 +311,7 @@ extern "C" varargs_vararg varargs_start2 (const unsigned char *a_, unsigned int
 {
   typedef unsigned char *start2__T3;
 
-  varargs_vararg v;
+  varargs_vararg__opaque v;
   start2__T3 p;
   unsigned char a[_a_high+1];
   unsigned char b[_b_high+1];
@@ -325,14 +325,14 @@ extern "C" varargs_vararg varargs_start2 (const unsigned char *a_, unsigned int
   v->nArgs = 2;
   v->size = (_a_high+_b_high)+2;
   Storage_ALLOCATE (&v->contents, v->size);
-  p = static_cast<start2__T3> (libc_memcpy (v->contents, &a, static_cast<size_t> (_a_high+1)));
-  v->arg.array[0].ptr = reinterpret_cast<void *> (p);
+  p = static_cast<start2__T3> (libc_memcpy (v->contents, const_cast<void*> (static_cast<const void*>(a)), static_cast<size_t> (_a_high+1)));
+  v->arg.array[0].ptr = static_cast<void *> (p);
   v->arg.array[0].len = _a_high+1;
   p += v->arg.array[0].len;
-  p = static_cast<start2__T3> (libc_memcpy (reinterpret_cast<void *> (p), &b, static_cast<size_t> (_b_high+1)));
-  v->arg.array[1].ptr = reinterpret_cast<void *> (p);
+  p = static_cast<start2__T3> (libc_memcpy (reinterpret_cast<void *> (p), const_cast<void*> (static_cast<const void*>(b)), static_cast<size_t> (_b_high+1)));
+  v->arg.array[1].ptr = static_cast<void *> (p);
   v->arg.array[1].len = _b_high+1;
-  return v;
+  return static_cast<varargs_vararg> (v);
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -346,7 +346,7 @@ extern "C" varargs_vararg varargs_start3 (const unsigned char *a_, unsigned int
 {
   typedef unsigned char *start3__T4;
 
-  varargs_vararg v;
+  varargs_vararg__opaque v;
   start3__T4 p;
   unsigned char a[_a_high+1];
   unsigned char b[_b_high+1];
@@ -362,18 +362,18 @@ extern "C" varargs_vararg varargs_start3 (const unsigned char *a_, unsigned int
   v->nArgs = 3;
   v->size = ((_a_high+_b_high)+_c_high)+3;
   Storage_ALLOCATE (&v->contents, v->size);
-  p = static_cast<start3__T4> (libc_memcpy (v->contents, &a, static_cast<size_t> (_a_high+1)));
-  v->arg.array[0].ptr = reinterpret_cast<void *> (p);
+  p = static_cast<start3__T4> (libc_memcpy (v->contents, const_cast<void*> (static_cast<const void*>(a)), static_cast<size_t> (_a_high+1)));
+  v->arg.array[0].ptr = static_cast<void *> (p);
   v->arg.array[0].len = _a_high+1;
   p += v->arg.array[0].len;
-  p = static_cast<start3__T4> (libc_memcpy (reinterpret_cast<void *> (p), &b, static_cast<size_t> (_b_high+1)));
-  v->arg.array[1].ptr = reinterpret_cast<void *> (p);
+  p = static_cast<start3__T4> (libc_memcpy (reinterpret_cast<void *> (p), const_cast<void*> (static_cast<const void*>(b)), static_cast<size_t> (_b_high+1)));
+  v->arg.array[1].ptr = static_cast<void *> (p);
   v->arg.array[1].len = _b_high+1;
   p += v->arg.array[1].len;
-  p = static_cast<start3__T4> (libc_memcpy (reinterpret_cast<void *> (p), &c, static_cast<size_t> (_c_high+1)));
-  v->arg.array[2].ptr = reinterpret_cast<void *> (p);
+  p = static_cast<start3__T4> (libc_memcpy (reinterpret_cast<void *> (p), const_cast<void*> (static_cast<const void*>(c)), static_cast<size_t> (_c_high+1)));
+  v->arg.array[2].ptr = static_cast<void *> (p);
   v->arg.array[2].len = _c_high+1;
-  return v;
+  return static_cast<varargs_vararg> (v);
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -387,7 +387,7 @@ extern "C" varargs_vararg varargs_start4 (const unsigned char *a_, unsigned int
 {
   typedef unsigned char *start4__T5;
 
-  varargs_vararg v;
+  varargs_vararg__opaque v;
   start4__T5 p;
   unsigned char a[_a_high+1];
   unsigned char b[_b_high+1];
@@ -405,29 +405,29 @@ extern "C" varargs_vararg varargs_start4 (const unsigned char *a_, unsigned int
   v->nArgs = 4;
   v->size = (((_a_high+_b_high)+_c_high)+_d_high)+4;
   Storage_ALLOCATE (&v->contents, v->size);
-  p = static_cast<start4__T5> (libc_memcpy (v->contents, &a, static_cast<size_t> (_a_high+1)));
+  p = static_cast<start4__T5> (libc_memcpy (v->contents, const_cast<void*> (static_cast<const void*>(a)), static_cast<size_t> (_a_high+1)));
   v->arg.array[0].len = _a_high+1;
   p += v->arg.array[0].len;
-  p = static_cast<start4__T5> (libc_memcpy (reinterpret_cast<void *> (p), &b, static_cast<size_t> (_b_high+1)));
-  v->arg.array[1].ptr = reinterpret_cast<void *> (p);
+  p = static_cast<start4__T5> (libc_memcpy (reinterpret_cast<void *> (p), const_cast<void*> (static_cast<const void*>(b)), static_cast<size_t> (_b_high+1)));
+  v->arg.array[1].ptr = static_cast<void *> (p);
   v->arg.array[1].len = _b_high+1;
   p += v->arg.array[1].len;
-  p = static_cast<start4__T5> (libc_memcpy (reinterpret_cast<void *> (p), &c, static_cast<size_t> (_c_high+1)));
-  v->arg.array[2].ptr = reinterpret_cast<void *> (p);
+  p = static_cast<start4__T5> (libc_memcpy (reinterpret_cast<void *> (p), const_cast<void*> (static_cast<const void*>(c)), static_cast<size_t> (_c_high+1)));
+  v->arg.array[2].ptr = static_cast<void *> (p);
   v->arg.array[2].len = _c_high+1;
   p += v->arg.array[2].len;
-  p = static_cast<start4__T5> (libc_memcpy (reinterpret_cast<void *> (p), &c, static_cast<size_t> (_c_high+1)));
-  v->arg.array[3].ptr = reinterpret_cast<void *> (p);
+  p = static_cast<start4__T5> (libc_memcpy (reinterpret_cast<void *> (p), const_cast<void*> (static_cast<const void*>(c)), static_cast<size_t> (_c_high+1)));
+  v->arg.array[3].ptr = static_cast<void *> (p);
   v->arg.array[3].len = _c_high+1;
-  return v;
+  return static_cast<varargs_vararg> (v);
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
 
-extern "C" void _M2_varargs_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
+extern "C" void _M2_varargs_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
 {
 }
 
-extern "C" void _M2_varargs_fini (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
+extern "C" void _M2_varargs_fini (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
 {
 }
index fa3f73ac212fff1035ab58d8cb367e7155700e7c..87daa42c3efd57ea33ba4db14e4a0d2d97e5ac17 100644 (file)
@@ -42,9 +42,9 @@ along with GNU Modula-2; see the file COPYING3.  If not see
 #   undef NULL
 #   define NULL 0
 #endif
-#define _wlists_H
 #define _wlists_C
 
+#include "Gwlists.h"
 #   include "GStorage.h"
 
 typedef struct wlists_performOperation_p wlists_performOperation;
@@ -54,16 +54,13 @@ typedef struct wlists__T1_r wlists__T1;
 
 typedef struct wlists__T2_a wlists__T2;
 
-typedef wlists__T1 *wlists_wlist;
-
-typedef void (*wlists_performOperation_t) (unsigned int);
-struct wlists_performOperation_p { wlists_performOperation_t proc; };
+typedef wlists__T1 *wlists_wlist__opaque;
 
 struct wlists__T2_a { unsigned int array[maxNoOfElements-1+1]; };
 struct wlists__T1_r {
                       unsigned int noOfElements;
                       wlists__T2 elements;
-                      wlists_wlist next;
+                      wlists_wlist__opaque next;
                     };
 
 
@@ -149,14 +146,14 @@ extern "C" wlists_wlist wlists_duplicateList (wlists_wlist l);
    removeItem - remove an element at index, i, from the wlist data type.
 */
 
-static void removeItem (wlists_wlist p, wlists_wlist l, unsigned int i);
+static void removeItem (wlists_wlist__opaque p, wlists_wlist__opaque l, unsigned int i);
 
 
 /*
    removeItem - remove an element at index, i, from the wlist data type.
 */
 
-static void removeItem (wlists_wlist p, wlists_wlist l, unsigned int i)
+static void removeItem (wlists_wlist__opaque p, wlists_wlist__opaque l, unsigned int i)
 {
   l->noOfElements -= 1;
   while (i <= l->noOfElements)
@@ -178,12 +175,12 @@ static void removeItem (wlists_wlist p, wlists_wlist l, unsigned int i)
 
 extern "C" wlists_wlist wlists_initList (void)
 {
-  wlists_wlist l;
+  wlists_wlist__opaque l;
 
   Storage_ALLOCATE ((void **) &l, sizeof (wlists__T1));
   l->noOfElements = 0;
-  l->next = NULL;
-  return l;
+  l->next = static_cast<wlists_wlist__opaque> (NULL);
+  return static_cast<wlists_wlist> (l);
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
@@ -197,9 +194,9 @@ extern "C" void wlists_killList (wlists_wlist *l)
 {
   if ((*l) != NULL)
     {
-      if ((*l)->next != NULL)
+      if (static_cast<wlists_wlist__opaque> ((*l))->next != NULL)
         {
-          wlists_killList (&(*l)->next);
+          wlists_killList (reinterpret_cast<wlists_wlist *> (&static_cast<wlists_wlist__opaque> ((*l))->next));
         }
       Storage_DEALLOCATE ((void **) &(*l), sizeof (wlists__T1));
     }
@@ -212,21 +209,21 @@ extern "C" void wlists_killList (wlists_wlist *l)
 
 extern "C" void wlists_putItemIntoList (wlists_wlist l, unsigned int c)
 {
-  if (l->noOfElements < maxNoOfElements)
+  if (static_cast<wlists_wlist__opaque> (l)->noOfElements < maxNoOfElements)
     {
-      l->noOfElements += 1;
-      l->elements.array[l->noOfElements-1] = c;
+      static_cast<wlists_wlist__opaque> (l)->noOfElements += 1;
+      static_cast<wlists_wlist__opaque> (l)->elements.array[static_cast<wlists_wlist__opaque> (l)->noOfElements-1] = c;
     }
-  else if (l->next != NULL)
+  else if (static_cast<wlists_wlist__opaque> (l)->next != NULL)
     {
       /* avoid dangling else.  */
-      wlists_putItemIntoList (l->next, c);
+      wlists_putItemIntoList (static_cast<wlists_wlist> (static_cast<wlists_wlist__opaque> (l)->next), c);
     }
   else
     {
       /* avoid dangling else.  */
-      l->next = wlists_initList ();
-      wlists_putItemIntoList (l->next, c);
+      static_cast<wlists_wlist__opaque> (l)->next = static_cast<wlists_wlist__opaque> (wlists_initList ());
+      wlists_putItemIntoList (static_cast<wlists_wlist> (static_cast<wlists_wlist__opaque> (l)->next), c);
     }
 }
 
@@ -239,15 +236,15 @@ extern "C" unsigned int wlists_getItemFromList (wlists_wlist l, unsigned int n)
 {
   while (l != NULL)
     {
-      if (n <= l->noOfElements)
+      if (n <= static_cast<wlists_wlist__opaque> (l)->noOfElements)
         {
-          return l->elements.array[n-1];
+          return static_cast<wlists_wlist__opaque> (l)->elements.array[n-1];
         }
       else
         {
-          n -= l->noOfElements;
+          n -= static_cast<wlists_wlist__opaque> (l)->noOfElements;
         }
-      l = l->next;
+      l = static_cast<wlists_wlist> (static_cast<wlists_wlist__opaque> (l)->next);
     }
   return static_cast<unsigned int> (0);
   /* static analysis guarentees a RETURN statement will be used before here.  */
@@ -272,9 +269,9 @@ extern "C" unsigned int wlists_getIndexOfList (wlists_wlist l, unsigned int c)
   else
     {
       i = 1;
-      while (i <= l->noOfElements)
+      while (i <= static_cast<wlists_wlist__opaque> (l)->noOfElements)
         {
-          if (l->elements.array[i-1] == c)
+          if (static_cast<wlists_wlist__opaque> (l)->elements.array[i-1] == c)
             {
               return i;
             }
@@ -283,7 +280,7 @@ extern "C" unsigned int wlists_getIndexOfList (wlists_wlist l, unsigned int c)
               i += 1;
             }
         }
-      return l->noOfElements+(wlists_getIndexOfList (l->next, c));
+      return static_cast<wlists_wlist__opaque> (l)->noOfElements+(wlists_getIndexOfList (static_cast<wlists_wlist> (static_cast<wlists_wlist__opaque> (l)->next), c));
     }
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
@@ -306,8 +303,8 @@ extern "C" unsigned int wlists_noOfItemsInList (wlists_wlist l)
     {
       t = 0;
       do {
-        t += l->noOfElements;
-        l = l->next;
+        t += static_cast<wlists_wlist__opaque> (l)->noOfElements;
+        l = static_cast<wlists_wlist> (static_cast<wlists_wlist__opaque> (l)->next);
       } while (! (l == NULL));
       return t;
     }
@@ -337,33 +334,33 @@ extern "C" void wlists_includeItemIntoList (wlists_wlist l, unsigned int c)
 
 extern "C" void wlists_removeItemFromList (wlists_wlist l, unsigned int c)
 {
-  wlists_wlist p;
+  wlists_wlist__opaque p;
   unsigned int i;
   bool found;
 
   if (l != NULL)
     {
       found = false;
-      p = NULL;
+      p = static_cast<wlists_wlist__opaque> (NULL);
       do {
         i = 1;
-        while ((i <= l->noOfElements) && (l->elements.array[i-1] != c))
+        while ((i <= static_cast<wlists_wlist__opaque> (l)->noOfElements) && (static_cast<wlists_wlist__opaque> (l)->elements.array[i-1] != c))
           {
             i += 1;
           }
-        if ((i <= l->noOfElements) && (l->elements.array[i-1] == c))
+        if ((i <= static_cast<wlists_wlist__opaque> (l)->noOfElements) && (static_cast<wlists_wlist__opaque> (l)->elements.array[i-1] == c))
           {
             found = true;
           }
         else
           {
-            p = l;
-            l = l->next;
+            p = static_cast<wlists_wlist__opaque> (l);
+            l = static_cast<wlists_wlist> (static_cast<wlists_wlist__opaque> (l)->next);
           }
       } while (! ((l == NULL) || found));
       if (found)
         {
-          removeItem (p, l, i);
+          removeItem (p, static_cast<wlists_wlist__opaque> (l), i);
         }
     }
 }
@@ -379,15 +376,15 @@ extern "C" void wlists_replaceItemInList (wlists_wlist l, unsigned int n, unsign
 {
   while (l != NULL)
     {
-      if (n <= l->noOfElements)
+      if (n <= static_cast<wlists_wlist__opaque> (l)->noOfElements)
         {
-          l->elements.array[n-1] = w;
+          static_cast<wlists_wlist__opaque> (l)->elements.array[n-1] = w;
         }
       else
         {
-          n -= l->noOfElements;
+          n -= static_cast<wlists_wlist__opaque> (l)->noOfElements;
         }
-      l = l->next;
+      l = static_cast<wlists_wlist> (static_cast<wlists_wlist__opaque> (l)->next);
     }
 }
 
@@ -402,9 +399,9 @@ extern "C" bool wlists_isItemInList (wlists_wlist l, unsigned int c)
 
   do {
     i = 1;
-    while (i <= l->noOfElements)
+    while (i <= static_cast<wlists_wlist__opaque> (l)->noOfElements)
       {
-        if (l->elements.array[i-1] == c)
+        if (static_cast<wlists_wlist__opaque> (l)->elements.array[i-1] == c)
           {
             return true;
           }
@@ -413,7 +410,7 @@ extern "C" bool wlists_isItemInList (wlists_wlist l, unsigned int c)
             i += 1;
           }
       }
-    l = l->next;
+    l = static_cast<wlists_wlist> (static_cast<wlists_wlist__opaque> (l)->next);
   } while (! (l == NULL));
   return false;
   /* static analysis guarentees a RETURN statement will be used before here.  */
@@ -446,27 +443,27 @@ extern "C" void wlists_foreachItemInListDo (wlists_wlist l, wlists_performOperat
 
 extern "C" wlists_wlist wlists_duplicateList (wlists_wlist l)
 {
-  wlists_wlist m;
+  wlists_wlist__opaque m;
   unsigned int n;
   unsigned int i;
 
-  m = wlists_initList ();
+  m = static_cast<wlists_wlist__opaque> (wlists_initList ());
   n = wlists_noOfItemsInList (l);
   i = 1;
   while (i <= n)
     {
-      wlists_putItemIntoList (m, wlists_getItemFromList (l, i));
+      wlists_putItemIntoList (static_cast<wlists_wlist> (m), wlists_getItemFromList (l, i));
       i += 1;
     }
-  return m;
+  return static_cast<wlists_wlist> (m);
   /* static analysis guarentees a RETURN statement will be used before here.  */
   __builtin_unreachable ();
 }
 
-extern "C" void _M2_wlists_init (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
+extern "C" void _M2_wlists_init (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
 {
 }
 
-extern "C" void _M2_wlists_fini (__attribute__((unused)) int argc,__attribute__((unused)) char *argv[],__attribute__((unused)) char *envp[])
+extern "C" void _M2_wlists_fini (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[], __attribute__((unused)) char *envp[])
 {
 }
index 0cd8d7151f75e61c3931b1a60e7b457973bfe675..8f12f010850c3b1d15a15e6f1e44576a4b2054d7 100644 (file)
@@ -249,6 +249,21 @@ PROCEDURE isTypeHidden (n: node) : BOOLEAN ;
 PROCEDURE hasHidden (n: node) : BOOLEAN ;
 
 
+(*
+   putTypeOpaque - marks type, des, as being an opaque type.
+                   TYPE des ;
+*)
+
+PROCEDURE putTypeOpaque (des: node) ;
+
+
+(*
+   isTypeOpaque - returns TRUE if type, n, is an opaque type.
+*)
+
+PROCEDURE isTypeOpaque (n: node) : BOOLEAN ;
+
+
 (*
    isVar - returns TRUE if node, n, is a type.
 *)
index c3ee646caaf30c0e47d672527394d39df6d98738..37fc3962695a79eab3876e1a3416f16592ec2743 100644 (file)
@@ -81,6 +81,7 @@ CONST
    enableDefForCStrings   = FALSE ;   (* currently disabled.  *)
    enableMemsetOnAllocation = TRUE ;  (* Should we memset (..., 0, ...) the allocated mem?  *)
    forceQualified  = TRUE ;
+   debugOpaque     = FALSE ;
 
 TYPE
    language = (ansiC, ansiCP, pim4) ;
@@ -127,7 +128,7 @@ TYPE
             componentref, pointerref, arrayref, deref,
            equal, notequal, less, greater, greequal, lessequal,
            lsl, lsr, lor, land, lnot, lxor,
-           and, or, not, identlist, vardecl, setvalue) ;
+           and, or, not, identlist, vardecl, setvalue, opaquecast) ;
 
     node = POINTER TO nodeRec ;
 
@@ -260,12 +261,24 @@ TYPE
                         identlist       :  identlistF       : identlistT |
                         vardecl         :  vardeclF         : vardeclT |
                          funccall        :  funccallF        : funccallT |
-                        setvalue        :  setvalueF        : setvalueT
+                        setvalue        :  setvalueF        : setvalueT |
+                         opaquecast      :  opaquecastF      : opaquecastT
 
                          END ;
                          at: where ;
                       END ;
 
+       opaqueCastState = RECORD
+                            opaque,
+                            voidStar: BOOLEAN ;
+                         END ;
+
+       opaquecastT = RECORD
+                        (* Describes the cast of the opaque.  *)
+                        exp        : node ;
+                        opaqueState: opaqueCastState ;
+                     END ;
+
        intrinsicT = RECORD
                        args            : node ;
                        noArgs          : CARDINAL ;
@@ -298,6 +311,7 @@ TYPE
                      args           : node ;
                      type           : node ;
                      funccallComment: commentPair ;
+                      opaqueState    : opaqueCastState ;
                    END ;
 
        commentT = RECORD
@@ -328,6 +342,7 @@ TYPE
                   name      :  Name ;
                  type      :  node ;
                  scope     :  node ;
+                  isOpaque,
                  isHidden,
                  isInternal:  BOOLEAN ;
                END ;
@@ -355,6 +370,7 @@ TYPE
                 isVarParameter,
                  isUsed        :  BOOLEAN ;
                  cname         :  cnameT ;
+                 opaqueState   :  opaqueCastState ;
               END ;
 
        enumerationT = RECORD
@@ -382,6 +398,7 @@ TYPE
                   type,
                   scope      :  node ;
                   isUnbounded:  BOOLEAN ;
+                   opaqueState:  opaqueCastState ;
                 END ;
 
        stringT = RECORD
@@ -412,6 +429,7 @@ TYPE
                       isUnbounded:  BOOLEAN ;
                       isForC     :  BOOLEAN ;
                       isUsed     :  BOOLEAN ;
+                      opaqueState:  opaqueCastState ;
                    END ;
 
        paramT = RECORD
@@ -421,6 +439,7 @@ TYPE
                    isUnbounded:  BOOLEAN ;
                    isForC     :  BOOLEAN ;
                    isUsed     :  BOOLEAN ;
+                   opaqueState:  opaqueCastState ;
                 END ;
 
        varargsT = RECORD
@@ -435,18 +454,20 @@ TYPE
                  END ;
 
        pointerT = RECORD
-                     type :  node ;
-                     scope:  node ;
+                     type       :  node ;
+                     scope      :  node ;
+                     opaqueState:  opaqueCastState ;
                   END ;
 
        recordfieldT = RECORD
-                         name   :  Name ;
-                        type   :  node ;
-                        tag    :  BOOLEAN ;
-                        parent :  node ;
-                        varient:  node ;
-                        scope  :  node ;
-                        cname  :  cnameT ;
+                         name       :  Name ;
+                        type       :  node ;
+                        tag        :  BOOLEAN ;
+                        parent     :  node ;
+                        varient    :  node ;
+                        scope      :  node ;
+                        cname      :  cnameT ;
+                         opaqueState:  opaqueCastState ;
                       END ;
 
        varientfieldT = RECORD
@@ -472,21 +493,24 @@ TYPE
               END ;
 
        componentrefT = RECORD
-                          rec       :  node ;
-                          field     :  node ;
-                          resultType:  node ;
+                          rec        :  node ;
+                          field      :  node ;
+                          resultType :  node ;
+                          opaqueState:  opaqueCastState ;
                        END ;
 
        pointerrefT = RECORD
-                        ptr       :  node ;
-                        field     :  node ;
-                        resultType:  node ;
+                        ptr        :  node ;
+                        field      :  node ;
+                        resultType :  node ;
+                        opaqueState:  opaqueCastState ;
                      END ;
 
        arrayrefT = RECORD
-                      array     :  node ;
-                      index     :  node ;
-                      resultType:  node ;
+                      array      :  node ;
+                      index      :  node ;
+                      resultType :  node ;
+                      opaqueState:  opaqueCastState ;
                    END ;
 
        commentPair = RECORD
@@ -596,15 +620,17 @@ TYPE
                        cname          :  cnameT ;
                       defComment,
                       modComment     :  commentDesc ;
+                       opaqueState    :  opaqueCastState ;
                     END ;
 
        proctypeT = RECORD
-                      parameters:  Index ;
+                      parameters :  Index ;
                       returnopt,
-                      vararg    :  BOOLEAN ;
-                      optarg    :  node ;
-                     scope     :  node ;
-                      returnType:  node ;
+                      vararg     :  BOOLEAN ;
+                      optarg     :  node ;
+                     scope      :  node ;
+                      returnType :  node ;
+                      opaqueState:  opaqueCastState ;
                    END ;
 
        binaryT = RECORD
@@ -2025,6 +2051,7 @@ BEGIN
       typeF.name := n ;
       typeF.type := NIL ;
       typeF.scope := getDeclScope () ;
+      typeF.isOpaque := FALSE ;
       typeF.isHidden := FALSE ;
       typeF.isInternal := FALSE
    END ;
@@ -2052,6 +2079,7 @@ BEGIN
          typeF.name := n ;
          typeF.type := NIL ;
          typeF.scope := getDeclScope () ;
+         typeF.isOpaque := FALSE ;
          typeF.isHidden := FALSE
       END ;
       RETURN addToScope (d)
@@ -2091,7 +2119,8 @@ BEGIN
    assert (var#NIL) ;
    assert (isVar (var)) ;
    var^.varF.type := type ;
-   var^.varF.decl := decl
+   var^.varF.decl := decl ;
+   initNodeOpaqueState (var) ;
 END putVar ;
 
 
@@ -2328,7 +2357,7 @@ END paramLeave ;
 
 
 (*
-   putReturnType - sets the return type of procedure or proctype, proc, to, type.
+   putReturnType - sets the return type of procedure or proctype proc to type.
 *)
 
 PROCEDURE putReturnType (proc, type: node) ;
@@ -2339,7 +2368,8 @@ BEGIN
       proc^.procedureF.returnType := type
    ELSE
       proc^.proctypeF.returnType := type
-   END
+   END ;
+   initNodeOpaqueState (proc)
 END putReturnType ;
 
 
@@ -2374,8 +2404,9 @@ BEGIN
       proctypeF.returnopt := FALSE ;
       proctypeF.optarg := NIL ;
       proctypeF.vararg := FALSE ;
-      proctypeF.returnType := NIL
+      proctypeF.returnType := NIL ;
    END ;
+   initNodeOpaqueState (d) ;
    RETURN d
 END makeProcType ;
 
@@ -2387,7 +2418,8 @@ END makeProcType ;
 PROCEDURE putProcTypeReturn (proc, type: node) ;
 BEGIN
    assert (isProcType (proc)) ;
-   proc^.proctypeF.returnType := type
+   proc^.proctypeF.returnType := type ;
+   initNodeOpaqueState (proc)
 END putProcTypeReturn ;
 
 
@@ -2418,6 +2450,7 @@ BEGIN
    d^.paramF.isUnbounded := FALSE ;
    d^.paramF.isForC := isDefForCNode (proc) ;
    d^.paramF.isUsed := isused ;
+   initNodeOpaqueState (d) ;
    RETURN d
 END makeNonVarParameter ;
 
@@ -2438,6 +2471,7 @@ BEGIN
    d^.varparamF.isUnbounded := FALSE ;
    d^.varparamF.isForC := isDefForCNode (proc) ;
    d^.varparamF.isUsed := isused ;
+   initNodeOpaqueState (d) ;
    RETURN d
 END makeVarParameter ;
 
@@ -3864,8 +3898,9 @@ BEGIN
       f := newNode (funccall) ;
       f^.funccallF.function := c ;
       f^.funccallF.args := n ;
-      f^.funccallF.type := NIL ;
-      initPair (f^.funccallF.funccallComment)
+      f^.funccallF.type := getType (c) ;
+      initPair (f^.funccallF.funccallComment) ;
+      initNodeOpaqueState (f)
    END ;
    RETURN f
 END makeFuncCall ;
@@ -3936,6 +3971,33 @@ BEGIN
 END hasHidden ;
 
 
+(*
+   putTypeOpaque - marks type, des, as being an opaque type.
+                   TYPE des ;
+*)
+
+PROCEDURE putTypeOpaque (des: node) ;
+VAR
+   s: node ;
+BEGIN
+   assert (des#NIL) ;
+   assert (isType (des)) ;
+   des^.typeF.isOpaque := TRUE
+END putTypeOpaque ;
+
+
+(*
+   isTypeOpaque - returns TRUE if type, n, is an opaque type.
+*)
+
+PROCEDURE isTypeOpaque (n: node) : BOOLEAN ;
+BEGIN
+   assert (n#NIL) ;
+   assert (isType (n)) ;
+   RETURN n^.typeF.isOpaque
+END isTypeOpaque ;
+
+
 (*
    putTypeInternal - marks type, des, as being an internally generated type.
 *)
@@ -4673,6 +4735,7 @@ BEGIN
    n^.componentrefF.rec := rec ;
    n^.componentrefF.field := field ;
    n^.componentrefF.resultType := getType (field) ;
+   initNodeOpaqueState (n) ;
    RETURN n
 END doMakeComponentRef ;
 
@@ -4708,6 +4771,7 @@ BEGIN
       rec^.pointerrefF.ptr := a ;
       rec^.pointerrefF.field := field ;
       rec^.pointerrefF.resultType := getType (field) ;
+      initNodeOpaqueState (rec) ;
       RETURN rec
    ELSE
       RETURN doMakeComponentRef (rec, field)
@@ -4739,6 +4803,7 @@ BEGIN
    n^.pointerrefF.ptr := ptr ;
    n^.pointerrefF.field := field ;
    n^.pointerrefF.resultType := getType (field) ;
+   initNodeOpaqueState (n) ;
    RETURN n
 END makePointerRef ;
 
@@ -5192,9 +5257,13 @@ END getMaxMinType ;
 *)
 
 PROCEDURE doGetFuncType (n: node) : node ;
+VAR
+   result: node ;
 BEGIN
    assert (isFuncCall (n)) ;
-   RETURN doSetExprType (n^.funccallF.type, getType (n^.funccallF.function))
+   result := doSetExprType (n^.funccallF.type, getType (n^.funccallF.function)) ;
+   initNodeOpaqueState (n) ;  (* Update now that the return type is known.  *)
+   RETURN result
 END doGetFuncType ;
 
 
@@ -5951,10 +6020,10 @@ BEGIN
    IF needsParen (left)
    THEN
       outText (p, '(') ;
-      doExprCup (p, left, unpackProc) ;
+      left := doExprCup (p, left, unpackProc, FALSE) ;
       outText (p, ')')
    ELSE
-      doExprCup (p, left, unpackProc)
+      left := doExprCup (p, left, unpackProc, FALSE)
    END ;
    IF l
    THEN
@@ -5968,10 +6037,10 @@ BEGIN
    IF needsParen (right)
    THEN
       outText (p, '(') ;
-      doExprCup (p, right, unpackProc) ;
+      right := doExprCup (p, right, unpackProc, FALSE) ;
       outText (p, ')')
    ELSE
-      doExprCup (p, right, unpackProc)
+      right := doExprCup (p, right, unpackProc, FALSE)
    END
 END doBinary ;
 
@@ -5991,11 +6060,12 @@ END doPostUnary ;
    doDeRefC -
 *)
 
-PROCEDURE doDeRefC (p: pretty; expr: node) ;
+PROCEDURE doDeRefC (p: pretty; expr: node) : node ;
 BEGIN
    outText (p, '(*') ;
-   doExprC (p, expr) ;
-   outText (p, ')')
+   expr := castOpaque (p, expr, FALSE) ;
+   outText (p, ')') ;
+   RETURN expr
 END doDeRefC ;
 
 
@@ -6079,7 +6149,7 @@ END getLastOp ;
 
 PROCEDURE doComponentRefC (p: pretty; l, r: node) ;
 BEGIN
-   doExprC (p, l) ;
+   flushOpaque (p, l, FALSE) ;
    outText (p, '.') ;
    doExprC (p, r)
 END doComponentRefC ;
@@ -6091,7 +6161,7 @@ END doComponentRefC ;
 
 PROCEDURE doPointerRefC (p: pretty; l, r: node) ;
 BEGIN
-   doExprC (p, l) ;
+   flushOpaque (p, l, FALSE) ;
    outText (p, '->') ;
    doExprC (p, r)
 END doPointerRefC ;
@@ -6156,23 +6226,38 @@ END isZero ;
 
 
 (*
-   doArrayRef -
+   doArrayRef - perform an array reference.  If constCast
+                then an unbounded array access will be const_cast
+                (the constCast should be TRUE if an assignment to
+                the array is required).
 *)
 
-PROCEDURE doArrayRef (p: pretty; n: node) ;
+PROCEDURE doArrayRef (p: pretty; n: node; constCast: BOOLEAN) ;
 VAR
-   t   : node ;
+   type,
+   v   : node ;
    i, c: CARDINAL ;
 BEGIN
    assert (n # NIL) ;
    assert (isArrayRef (n)) ;
-   t := skipType (getType (n^.arrayrefF.array)) ;
-   IF isUnbounded (t)
+   type := skipType (getType (n^.arrayrefF.array)) ;
+   IF isUnbounded (type)
    THEN
-      outTextN (p, getSymName (n^.arrayrefF.array))
+      v := n^.arrayrefF.array ;
+      IF constCast AND isVar (n^.arrayrefF.array) AND
+         (v^.varF.isParameter OR v^.varF.isVarParameter)
+      THEN
+         outText (p, "const_cast<") ;
+         doTypeNameC (p, getType (v)) ;
+         outText (p, ">(") ;
+         outTextN (p, getSymName (n^.arrayrefF.array)) ;
+         outText (p, ")")
+      ELSE
+         outTextN (p, getSymName (n^.arrayrefF.array))
+      END
    ELSE
       doExprC (p, n^.arrayrefF.array) ;
-      assert (isArray (t)) ;
+      assert (isArray (type)) ;
       outText (p, '.array')
    END ;
    outText (p, '[') ;
@@ -6180,16 +6265,16 @@ BEGIN
    c := expListLen (n^.arrayrefF.index) ;
    WHILE i<=c DO
       doExprC (p, getExpList (n^.arrayrefF.index, i)) ;
-      IF isUnbounded (t)
+      IF isUnbounded (type)
       THEN
          assert (c = 1)
       ELSE
-         doSubtractC (p, getMin (t^.arrayF.subr)) ;
+         doSubtractC (p, getMin (type^.arrayF.subr)) ;
         IF i<c
          THEN
-            assert (isArray (t)) ;
+            assert (isArray (type)) ;
             outText (p, '].array[') ;
-            t := skipType (getType (t))
+            type := skipType (getType (type))
          END
       END ;
       INC (i)
@@ -6466,7 +6551,7 @@ BEGIN
       im              :  doImC (p, n) |
       cmplx           :  doCmplx (p, n) |
 
-      deref           :  doDeRefC (p, unaryF.arg) |
+      deref           :  unaryF.arg := doDeRefC (p, unaryF.arg) |
       equal           :  doBinary (p, '==', binaryF.left, binaryF.right, TRUE, TRUE, TRUE) |
       notequal        :  doBinary (p, '!=', binaryF.left, binaryF.right, TRUE, TRUE, TRUE) |
       less            :  doBinary (p, '<', binaryF.left, binaryF.right, TRUE, TRUE, FALSE) |
@@ -6490,7 +6575,7 @@ BEGIN
       enumerationfield:  doEnumerationField (p, n) |
       string          :  doStringC (p, n) |
       var             :  doVar (p, n) |
-      arrayref        :  doArrayRef (p, n) |
+      arrayref        :  doArrayRef (p, n, FALSE) |
       funccall        :  doFuncExprC (p, n) |
       procedure       :  doProcedure (p, n) |
       recordfield     :  doRecordfield (p, n) |
@@ -6529,19 +6614,26 @@ END doExprC ;
    doExprCup -
 *)
 
-PROCEDURE doExprCup (p: pretty; n: node; unpackProc: BOOLEAN) ;
+PROCEDURE doExprCup (p: pretty; n: node;
+                     unpackProc, uncastConst: BOOLEAN) : node ;
 VAR
-   t: node ;
+   type: node ;
 BEGIN
-   doExprC (p, n) ;
-   IF unpackProc
+   IF uncastConst AND isArrayRef (n)
    THEN
-      t := skipType (getExprType (n)) ;
-      IF (t # NIL) AND isAProcType (t)
+      doArrayRef (p, n, TRUE)
+   ELSE
+      doExprC (p, n) ;
+      IF unpackProc
       THEN
-         outText (p, '.proc')
+         type := skipType (getExprType (n)) ;
+         IF (type # NIL) AND isAProcType (type)
+         THEN
+            outText (p, '.proc')
+         END
       END
-   END
+   END ;
+   RETURN n
 END doExprCup ;
 
 
@@ -7040,31 +7132,10 @@ END outTextN ;
 
 
 (*
-   doTypeAliasC -
-*)
-
-PROCEDURE doTypeAliasC (p: pretty; n: node; VAR m: node) ;
-BEGIN
-   print (p, "typedef") ; setNeedSpace (p) ;
-   IF isTypeHidden (n) AND (isDef (getMainModule ()) OR (getScope (n) # getMainModule ()))
-   THEN
-      outText (p, "void *")
-   ELSE
-      doTypeC (p, getType (n), m)
-   END ;
-   IF m#NIL
-   THEN
-      doFQNameC (p, m)
-   END ;
-   print (p, ';\n\n')
-END doTypeAliasC ;
-
-
-(*
-   doEnumerationC -
+   outputEnumerationC -
 *)
 
-PROCEDURE doEnumerationC (p: pretty; n: node) ;
+PROCEDURE outputEnumerationC (p: pretty; n: node) ;
 VAR
    i, h: CARDINAL ;
    s   : node ;
@@ -7083,6 +7154,47 @@ BEGIN
       INC (i)
    END ;
    outText (p, "}")
+END outputEnumerationC ;
+
+
+(*
+   isDeclType - return TRUE if the current module should declare type.
+*)
+
+PROCEDURE isDeclType (type: node) : BOOLEAN ;
+VAR
+   n,
+   def : node ;
+   name: Name ;
+BEGIN
+   IF isImp (currentModule)
+   THEN
+      name := getSymName (type) ;
+      IF name # NulName
+      THEN
+         (* Lookup the matching .def module.  *)
+         def := lookupDef (getSymName (currentModule)) ;
+         IF def # NIL
+         THEN
+            (* Return TRUE if the symbol has not already been declared in the .def.  *)
+            RETURN lookupExported (def, name) = NIL
+         END
+      END
+   END ;
+   RETURN TRUE
+END isDeclType ;
+
+
+(*
+   doEnumerationC -
+*)
+
+PROCEDURE doEnumerationC (p: pretty; n: node) ;
+BEGIN
+   IF isDeclType (n)
+   THEN
+      outputEnumerationC (p, n)
+   END
 END doEnumerationC ;
 
 
@@ -7301,15 +7413,593 @@ END getParameterVariable ;
 
 PROCEDURE doParamTypeEmit (p: pretty; paramnode, paramtype: node) ;
 BEGIN
-   assert (isParam (paramnode) OR isVarParam (paramnode)) ;
-   IF isForC (paramnode) AND isProcType (skipType (paramtype))
-   THEN
-      doFQNameC (p, paramtype) ;
-      outText (p, "_C")
+   assert (isParam (paramnode) OR isVarParam (paramnode)) ;
+   IF isForC (paramnode) AND isProcType (skipType (paramtype))
+   THEN
+      doFQNameC (p, paramtype) ;
+      outText (p, "_C")
+   ELSE
+      doTypeNameC (p, paramtype) ;
+      doOpaqueModifier (p, paramnode) ;
+      (*
+      IF nodeUsesOpaque (paramnode) AND (NOT getNodeOpaqueVoidStar (paramnode))
+      THEN
+         outText (p, '__opaque')
+      END
+      *)
+   END
+END doParamTypeEmit ;
+
+
+(*
+   doParamTypeNameModifier - Add an _ to an unbounded parameter which is non var.
+*)
+
+PROCEDURE doParamTypeNameModifier (p: pretty; ptype: node; varparam: BOOLEAN) ;
+BEGIN
+   IF (NOT varparam) AND isArray (ptype) AND isUnbounded (ptype)
+   THEN
+      outText (p, '_')
+   END
+END doParamTypeNameModifier ;
+
+
+(*
+   initOpaqueCastState - assign fields opaque and voidstar in opaquestate.
+*)
+
+PROCEDURE initOpaqueCastState (VAR opaquestate: opaqueCastState; opaque, voidstar: BOOLEAN) ;
+BEGIN
+   opaquestate.opaque := opaque ;
+   opaquestate.voidStar := voidstar
+END initOpaqueCastState ;
+
+
+(*
+   initNodeOpaqueCastState - assign opaque and currentvoidstar
+*)
+
+PROCEDURE initNodeOpaqueCastState (n: node; opaque, voidstar: BOOLEAN) ;
+BEGIN
+   CASE n^.kind OF
+
+   opaquecast  :  initOpaqueCastState (n^.opaquecastF.opaqueState, opaque, voidstar) |
+   funccall    :  initOpaqueCastState (n^.funccallF.opaqueState, opaque, voidstar) |
+   var         :  initOpaqueCastState (n^.varF.opaqueState, opaque, voidstar) |
+   array       :  initOpaqueCastState (n^.arrayF.opaqueState, opaque, voidstar) |
+   varparam    :  initOpaqueCastState (n^.varparamF.opaqueState, opaque, voidstar) |
+   param       :  initOpaqueCastState (n^.paramF.opaqueState, opaque, voidstar) |
+   pointer     :  initOpaqueCastState (n^.pointerF.opaqueState, opaque, voidstar) |
+   recordfield :  initOpaqueCastState (n^.recordfieldF.opaqueState, opaque, voidstar) |
+   componentref:  initOpaqueCastState (n^.componentrefF.opaqueState, opaque, voidstar) |
+   pointerref  :  initOpaqueCastState (n^.pointerrefF.opaqueState, opaque, voidstar) |
+   arrayref    :  initOpaqueCastState (n^.arrayrefF.opaqueState, opaque, voidstar) |
+   procedure   :  initOpaqueCastState (n^.procedureF.opaqueState, opaque, voidstar) |
+   proctype    :  initOpaqueCastState (n^.proctypeF.opaqueState, opaque, voidstar)
+
+   ELSE
+      HALT
+   END
+END initNodeOpaqueCastState ;
+
+
+(*
+   setOpaqueCastState - set the voidStar field in opaquestate.
+*)
+
+PROCEDURE setOpaqueCastState (VAR opaquestate: opaqueCastState; voidstar: BOOLEAN) ;
+BEGIN
+   opaquestate.voidStar := voidstar
+END setOpaqueCastState ;
+
+
+(*
+   setNodeOpaqueVoidStar - sets the voidStar field in node to voidstar.
+*)
+
+PROCEDURE setNodeOpaqueVoidStar (n: node; voidstar: BOOLEAN) ;
+BEGIN
+   assert (nodeUsesOpaque (n)) ;
+   CASE n^.kind OF
+
+   opaquecast  :  setOpaqueCastState (n^.opaquecastF.opaqueState, voidstar) |
+   funccall    :  setOpaqueCastState (n^.funccallF.opaqueState, voidstar) |
+   var         :  setOpaqueCastState (n^.varF.opaqueState, voidstar) |
+   array       :  setOpaqueCastState (n^.arrayF.opaqueState, voidstar) |
+   varparam    :  setOpaqueCastState (n^.varparamF.opaqueState, voidstar) |
+   param       :  setOpaqueCastState (n^.paramF.opaqueState, voidstar) |
+   pointer     :  setOpaqueCastState (n^.pointerF.opaqueState, voidstar) |
+   recordfield :  setOpaqueCastState (n^.recordfieldF.opaqueState, voidstar) |
+   componentref:  assert (NOT voidstar) ;
+                  setOpaqueCastState (n^.componentrefF.opaqueState, voidstar) |
+   pointerref  :  assert (NOT voidstar) ;
+                  setOpaqueCastState (n^.pointerrefF.opaqueState, voidstar) |
+   arrayref    :  setOpaqueCastState (n^.arrayrefF.opaqueState, voidstar) |
+   procedure   :  setOpaqueCastState (n^.procedureF.opaqueState, voidstar) |
+   proctype    :  setOpaqueCastState (n^.proctypeF.opaqueState, voidstar)
+
+   ELSE
+      HALT
+   END
+END setNodeOpaqueVoidStar ;
+
+
+(*
+   nodeUsesOpaque - return TRUE if node n uses an opaque type.
+*)
+
+PROCEDURE nodeUsesOpaque (n: node) : BOOLEAN ;
+BEGIN
+   CASE n^.kind OF
+
+   opaquecast  :  RETURN n^.opaquecastF.opaqueState.opaque |
+   funccall    :  RETURN n^.funccallF.opaqueState.opaque |
+   var         :  RETURN n^.varF.opaqueState.opaque |
+   array       :  RETURN n^.arrayF.opaqueState.opaque |
+   varparam    :  RETURN n^.varparamF.opaqueState.opaque |
+   param       :  RETURN n^.paramF.opaqueState.opaque |
+   pointer     :  RETURN n^.pointerF.opaqueState.opaque |
+   recordfield :  RETURN n^.recordfieldF.opaqueState.opaque |
+   componentref:  RETURN n^.componentrefF.opaqueState.opaque |
+   pointerref  :  RETURN n^.pointerrefF.opaqueState.opaque |
+   arrayref    :  RETURN n^.arrayrefF.opaqueState.opaque |
+   procedure   :  RETURN n^.procedureF.opaqueState.opaque |
+   proctype    :  RETURN n^.proctypeF.opaqueState.opaque |
+   deref       :  RETURN nodeUsesOpaque (n^.unaryF.arg)
+
+   ELSE
+      RETURN FALSE
+   END
+END nodeUsesOpaque ;
+
+
+(*
+   getNodeOpaqueVoidStar - return TRUE if the opaque type used by node n is a void *.
+*)
+
+PROCEDURE getNodeOpaqueVoidStar (n: node) : BOOLEAN ;
+BEGIN
+   assert (nodeUsesOpaque (n)) ;
+   CASE n^.kind OF
+
+   opaquecast  :  RETURN n^.opaquecastF.opaqueState.voidStar |
+   funccall    :  RETURN n^.funccallF.opaqueState.voidStar |
+   var         :  RETURN n^.varF.opaqueState.voidStar |
+   array       :  RETURN n^.arrayF.opaqueState.voidStar |
+   varparam    :  RETURN n^.varparamF.opaqueState.voidStar |
+   param       :  RETURN n^.paramF.opaqueState.voidStar |
+   pointer     :  RETURN n^.pointerF.opaqueState.voidStar |
+   recordfield :  RETURN n^.recordfieldF.opaqueState.voidStar |
+   componentref:  RETURN n^.componentrefF.opaqueState.voidStar |
+   pointerref  :  RETURN n^.pointerrefF.opaqueState.voidStar |
+   arrayref    :  RETURN n^.arrayrefF.opaqueState.voidStar |
+   procedure   :  RETURN n^.procedureF.opaqueState.voidStar |
+   proctype    :  RETURN n^.proctypeF.opaqueState.voidStar |
+   deref       :  RETURN FALSE
+
+   ELSE
+      HALT
+   END
+END getNodeOpaqueVoidStar ;
+
+
+(*
+   getOpaqueFlushNecessary - return TRUE if the value next differs from the opaque state.
+*)
+
+PROCEDURE getOpaqueFlushNecessary (state: opaqueCastState; next: BOOLEAN) : BOOLEAN ;
+BEGIN
+   RETURN state.opaque AND (state.voidStar # next)
+END getOpaqueFlushNecessary ;
+
+
+(*
+   getNodeOpaqueFlushNecessary - return TRUE if the value of next requires a cast.
+*)
+
+PROCEDURE getNodeOpaqueFlushNecessary (n: node; next: BOOLEAN) : BOOLEAN ;
+BEGIN
+   CASE n^.kind OF
+
+   opaquecast  :  RETURN getOpaqueFlushNecessary (n^.opaquecastF.opaqueState, next) |
+   funccall    :  RETURN getOpaqueFlushNecessary (n^.funccallF.opaqueState, next) |
+   var         :  RETURN getOpaqueFlushNecessary (n^.varF.opaqueState, next) |
+   array       :  RETURN getOpaqueFlushNecessary (n^.arrayF.opaqueState, next) |
+   varparam    :  RETURN getOpaqueFlushNecessary (n^.varparamF.opaqueState, next) |
+   param       :  RETURN getOpaqueFlushNecessary (n^.paramF.opaqueState, next) |
+   pointer     :  RETURN getOpaqueFlushNecessary (n^.pointerF.opaqueState, next) |
+   recordfield :  RETURN getOpaqueFlushNecessary (n^.recordfieldF.opaqueState, next) |
+   componentref:  RETURN getOpaqueFlushNecessary (n^.componentrefF.opaqueState, next) |
+   pointerref  :  RETURN getOpaqueFlushNecessary (n^.pointerrefF.opaqueState, next) |
+   arrayref    :  RETURN getOpaqueFlushNecessary (n^.arrayrefF.opaqueState, next) |
+   procedure   :  RETURN getOpaqueFlushNecessary (n^.procedureF.opaqueState, next) |
+   proctype    :  RETURN getOpaqueFlushNecessary (n^.proctypeF.opaqueState, next)
+
+   ELSE
+      RETURN FALSE
+   END
+END getNodeOpaqueFlushNecessary ;
+
+
+(*
+   makeOpaqueCast - wrap node n with an opaquecast node and assign
+                    voidstar into the new opaque state.
+*)
+
+PROCEDURE makeOpaqueCast (n: node; voidstar: BOOLEAN) : node ;
+VAR
+   o: node ;
+BEGIN
+   o := newNode (opaquecast) ;
+   WITH o^.opaquecastF DO
+      exp := n ;
+      initOpaqueCastState (opaqueState, TRUE, voidstar)
+   END ;
+   RETURN o
+END makeOpaqueCast ;
+
+
+(*
+   flushOpaque - perform a cast to voidstar (if necessary) and ignore the new
+                 node which could be created.
+*)
+
+PROCEDURE flushOpaque (p: pretty; n: node; toVoidStar: BOOLEAN) ;
+VAR
+   o: node ;
+BEGIN
+   o := castOpaque (p, n, toVoidStar)
+END flushOpaque ;
+
+
+(*
+   castOpaque - flushes the opaque type casts if necessary and changes the
+                voidstar boolean value.   If necessary it creates a opaquecast
+                and returns the new node otherwise return n.
+*)
+
+PROCEDURE castOpaque (p: pretty; n: node; toVoidStar: BOOLEAN) : node ;
+VAR
+   type: node ;
+BEGIN
+   IF getNodeOpaqueFlushNecessary (n, toVoidStar)
+   THEN
+      type := getType (n) ;
+      IF toVoidStar
+      THEN
+         (* next is true cast to void * opaque type.  *)
+         outText (p, 'static_cast<') ;
+         doTypeNameC (p, type) ;
+         noSpace (p) ;
+         outText (p, '> (') ;
+         doExprC (p, n) ;
+         outText (p, ')') ;
+         RETURN makeOpaqueCast (n, TRUE)
+      ELSE
+         (* next is false cast to __opaque opaque type.  *)
+         outText (p, 'static_cast<') ;
+         doTypeNameC (p, type) ;
+         outText (p, '__opaque') ;
+         noSpace (p) ;
+         outText (p, '> (') ;
+         doExprC (p, n) ;
+         outText (p, ')') ;
+         RETURN makeOpaqueCast (n, FALSE)
+      END
+   ELSE
+      IF debugOpaque
+      THEN
+         doP := p ;
+         dumpOpaqueState (n) ;
+         IF nodeUsesOpaque (n)
+         THEN
+            outText (p, ' /* no difference seen */ ')
+         ELSE
+            outText (p, ' /* no opaque used */ ')
+         END
+      END ;
+      doExprC (p, n)
+   END ;
+   RETURN n
+END castOpaque ;
+
+
+(*
+   isTypeOpaqueDefImp - returns TRUE if type is an opaque type by checking
+                        the def/imp pair of modules or fall back to the
+                        definition module.
+*)
+
+PROCEDURE isTypeOpaqueDefImp (type: node) : BOOLEAN ;
+VAR
+   scope,
+   def,
+   opaque: node ;
+BEGIN
+   IF type = NIL
+   THEN
+      RETURN FALSE
+   ELSIF isType (type)
+   THEN
+      scope := getScope (type) ;
+      IF isImp (scope)
+      THEN
+         def := lookupDef (getSymName (scope)) ;
+         IF def # NIL
+         THEN
+            (* Lookup the type name in the matching definition module.  *)
+            opaque := lookupExported (def, getSymName (type)) ;
+            RETURN (opaque # NIL) AND isType (opaque) AND isTypeOpaque (opaque)
+         END
+      ELSE
+         (* Otherwise just check the definition module.  *)
+         RETURN isTypeOpaque (type)
+      END
+   END ;
+   RETURN FALSE
+END isTypeOpaqueDefImp ;
+
+
+(*
+   isParamVoidStar - return TRUE if the procedure or proctype opaque type
+                     parameter should be implemented as a (void * ).
+*)
+
+PROCEDURE isParamVoidStar (n: node) : BOOLEAN ;
+VAR
+   proc,
+   type: node ;
+BEGIN
+   proc := getScope (n) ;
+   assert (isProcedure (proc) OR isProcType (proc)) ;
+   type := getType (n) ;
+   RETURN isReturnVoidStar (proc, type)
+END isParamVoidStar ;
+
+
+(*
+   isRefVoidStar - returns TRUE if the ref node uses an opaque type which
+                   is represented as a (void * ).
+*)
+
+PROCEDURE isRefVoidStar (n: node) : BOOLEAN ;
+VAR
+   type: node ;
+BEGIN
+   type := getType (n) ;
+   IF (NOT isType (type)) OR (NOT isTypeOpaque (type))
+   THEN
+      (* We should finish the procedure as the ref does not use an opaque.  *)
+      RETURN TRUE
+   ELSE
+      (* We check whether the opaque type was declared in the implementation
+         module.  If it is declared in the implementation module then we
+         return FALSE.  *)
+      RETURN NOT isDeclInImp (type)
+   END
+END isRefVoidStar ;
+
+
+(*
+   isReturnVoidStar - return TRUE if the procedure or proctype opaque type
+                      return type should be implemented as a (void * ).
+*)
+
+PROCEDURE isReturnVoidStar (proc, type: node) : BOOLEAN ;
+VAR
+   def : node ;
+BEGIN
+   assert (isProcedure (proc) OR isProcType (proc)) ;
+   IF isExported (proc)
+   THEN
+      RETURN TRUE
+   ELSE
+      (* Not exported therefore local, we check whether the opaque type
+         was declared in the implementation module.  *)
+      IF isImp (currentModule)
+      THEN
+         IF isType (type)
+         THEN
+            RETURN NOT isDeclInImp (type)
+         ELSE
+            RETURN FALSE
+         END
+      ELSE
+         (* Always use void * in .def modules.  *)
+         RETURN TRUE
+      END
+   END
+END isReturnVoidStar ;
+
+
+(*
+   isVarVoidStar - return TRUE if the variable using an opaque type should
+                   be implemented as a (void * ).
+*)
+
+PROCEDURE isVarVoidStar (n: node) : BOOLEAN ;
+VAR
+   type: node ;
+BEGIN
+   assert (isVar (n)) ;
+   type := getType (n) ;
+   IF (NOT isType (type)) OR (NOT isTypeOpaque (type))
+   THEN
+      (* We should finish the procedure as the variable does not use an opaque.  *)
+      RETURN TRUE
+   ELSIF isExported (n)
+   THEN
+      (* Exported variables using an opaque type will always be implemented
+         with a (void * ).  *)
+      RETURN TRUE
+   ELSE
+      (* Not exported therefore static to the module (local or global non exported
+         variable), we check whether the opaque type was declared in the
+         implementation module.  If it is declared in the implementation module
+         then we return FALSE.  *)
+      RETURN NOT isDeclInImp (type)
+   END
+END isVarVoidStar ;
+
+
+(*
+   initNodeOpaqueState - initialize the node opaque state.
+*)
+
+PROCEDURE initNodeOpaqueState (n: node) ;
+VAR
+   type: node ;
+BEGIN
+   CASE n^.kind OF
+
+   opaquecast  :  |  (* This must be done when the cast direction is known.  *)
+   funccall    :  assignNodeOpaqueCastState (n, getFunction (n)) |
+   var         :  type := getType (n) ;
+                  IF n^.varF.isParameter OR n^.varF.isVarParameter
+                  THEN
+                     (* If the variable is really a parameter then it uses
+                        the state of the parameter.  *)
+                     initNodeOpaqueCastState (n, isTypeOpaqueDefImp (type),
+                                              isParamVoidStar (n))
+                  ELSE
+                     initNodeOpaqueCastState (n, isTypeOpaqueDefImp (type),
+                                              isVarVoidStar (n))
+                  END  |
+   array       :  type := getType (n) ;
+                  initNodeOpaqueCastState (n, isTypeOpaqueDefImp (type),
+                                           isExported (n)) |
+   varparam,
+   param       :  assert (isProcedure (getScope (n)) OR isProcType (getScope (n))) ;
+                  type := getType (n) ;
+                  initNodeOpaqueCastState (n, isTypeOpaqueDefImp (type),
+                                           isParamVoidStar (n)) |
+   componentref,
+   pointerref,
+   pointer,
+   recordfield,
+   arrayref    :  type := getType (n) ;
+                  (* In the future this should be revisited.  *)
+                  initNodeOpaqueCastState (n, isTypeOpaqueDefImp (type),
+                                           isRefVoidStar (n)) |
+                          (* For the moment treat as never exported.  *)
+   proctype,
+   procedure   :  (* We only consider the return type for a procedure or proctype.
+                     The parameters and local vars are handled separately (see
+                     above).  *)
+                  type := getType (n) ;
+                  IF type = NIL
+                  THEN
+                     (* No return type, therefore no opaque type used.  *)
+                     initNodeOpaqueCastState (n, FALSE, FALSE)
+                  ELSE
+                     (* Init state from the return type.  Is type an opaque type?
+                        Is the opaque type declared in this module?  *)
+                     initNodeOpaqueCastState (n, isTypeOpaqueDefImp (type),
+                                              isReturnVoidStar (n, type))
+                  END |
+
+   ELSE
+   END ;
+   IF debugOpaque
+   THEN
+      dumpOpaqueState (n)
+   END
+END initNodeOpaqueState ;
+
+
+(*
+   assignNodeOpaqueCastState - copy the opaqueCastState from src into dest.
+*)
+
+PROCEDURE assignNodeOpaqueCastState (dest, src: node) ;
+BEGIN
+   IF nodeUsesOpaque (src)
+   THEN
+      initNodeOpaqueCastState (dest, TRUE, getNodeOpaqueVoidStar (src))
+   ELSE
+      initNodeOpaqueCastState (dest, FALSE, FALSE)
+   END
+END assignNodeOpaqueCastState ;
+
+
+(*
+   assignNodeOpaqueCastFalse - assign the voidstar field of dest to false.
+                               It assigns the opaque field of dest to the value
+                               of the src opaque field.
+*)
+
+PROCEDURE assignNodeOpaqueCastFalse (dest, src: node) ;
+BEGIN
+   IF nodeUsesOpaque (src)
+   THEN
+      initNodeOpaqueCastState (dest, TRUE, FALSE)
+   ELSE
+      initNodeOpaqueCastState (dest, FALSE, FALSE)
+   END
+END assignNodeOpaqueCastFalse ;
+
+
+(*
+   dumpOpaqueState -
+*)
+
+PROCEDURE dumpOpaqueState (n: node) ;
+VAR
+   o: node ;
+BEGIN
+   CASE n^.kind OF
+
+   opaquecast,
+   funccall,
+   var,
+   array,
+   varparam,
+   param,
+   pointer,
+   recordfield,
+   componentref,
+   arrayref,
+   procedure,
+   proctype    :  o := n
+
    ELSE
-      doTypeNameC (p, paramtype)
+      o := NIL
+   END ;
+   IF o # NIL
+   THEN
+      outText (doP, "/* ") ;
+      doNameC (doP, o) ;
+      outText (doP, "  ") ;
+      CASE o^.kind OF
+
+      opaquecast  :  outText (doP, "opaquecast") |
+      funccall    :  outText (doP, "funccall") |
+      var         :  outText (doP, "var") |
+      array       :  outText (doP, "array") |
+      varparam    :  outText (doP, "varparam") |
+      param       :  outText (doP, "param") |
+      pointer     :  outText (doP, "pointer") |
+      recordfield :  outText (doP, "recordfield") |
+      componentref:  outText (doP, "componentref") |
+      pointerref  :  outText (doP, "pointerref") |
+      arrayref    :  outText (doP, "arrayref") |
+      procedure   :  outText (doP, "procedure") |
+      proctype    :  outText (doP, "proctype")
+
+      ELSE
+      END ;
+      IF nodeUsesOpaque (o)
+      THEN
+         IF getNodeOpaqueVoidStar (o)
+         THEN
+            outText (doP, " uses (void *) opaque")
+         ELSE
+            outText (doP, " uses opaque__full")
+         END ;
+      END ;
+      outText (doP, " */ \n")
    END
-END doParamTypeEmit ;
+END dumpOpaqueState ;
 
 
 (*
@@ -7369,10 +8059,7 @@ BEGIN
             ELSE
                doFQDNameC (p, v, TRUE)
             END ;
-            IF isArray (ptype) AND isUnbounded (ptype)
-            THEN
-               outText (p, '_')
-            END ;
+            doParamTypeNameModifier (p, ptype, FALSE) ;
             doUsed (p, n^.paramF.isUsed) ;
             doHighC (p, ptype, i, n^.paramF.isUsed) ;
             IF c<t
@@ -7440,6 +8127,7 @@ BEGIN
             ELSE
                doFQDNameC (p, v, TRUE)
             END ;
+            doParamTypeNameModifier (p, ptype, TRUE) ;
             doUsed (p, n^.varparamF.isUsed) ;
             doHighC (p, ptype, i, n^.varparamF.isUsed) ;
             IF c<t
@@ -7508,11 +8196,63 @@ END doParameterC ;
 PROCEDURE doProcTypeC (p: pretty; t, n: node) ;
 BEGIN
    assert (isType (t)) ;
-   outputPartial (t) ;
-   doCompletePartialProcType (p, t, n)
+   IF isDeclType (t) AND isDeclType (n)
+   THEN
+      outputPartial (t) ;
+      doCompletePartialProcType (p, t, n)
+   END
 END doProcTypeC ;
 
 
+(*
+   isDeclInImp - returns TRUE if node type is declared as an opaque and
+                 is declared fully in the current implementation module.
+                 This should only be called if isType (type).  Its purpose
+                 is specific to a type checking whether it is an opaque type
+                 declared in the .def/.mod pair of the current imp module.
+*)
+
+PROCEDURE isDeclInImp (type: node) : BOOLEAN ;
+VAR
+   scope,
+   def  : node ;
+   name : Name ;
+BEGIN
+   assert (isType (type)) ;
+   scope := getScope (type) ;
+   IF isTypeOpaqueDefImp (type) AND isImp (currentModule)
+   THEN
+      name := getSymName (type) ;
+      IF name # NulName
+      THEN
+         (* Lookup the matching .def module.  *)
+         def := lookupDef (getSymName (currentModule)) ;
+         IF (def # NIL) AND ((def = scope) OR (currentModule = scope))
+         THEN
+            (* Return TRUE if the symbol has already been declared in the .def.  *)
+            RETURN lookupExported (def, name) # NIL
+         END
+      END
+   END ;
+   RETURN FALSE
+END isDeclInImp ;
+
+
+(*
+   doTypeNameModifier - adds the __opaque modifier to the type n provided
+                        it is an opaque type which is being declared in the
+                        implementation module.
+*)
+
+PROCEDURE doTypeNameModifier (p: pretty; n: node) ;
+BEGIN
+   IF isTypeOpaqueDefImp (n) AND isImp (currentModule)
+   THEN
+      outText (p, '__opaque')
+   END
+END doTypeNameModifier ;
+
+
 (*
    doTypesC -
 *)
@@ -7536,14 +8276,18 @@ BEGIN
             setNeedSpace (doP)
          END ;
          doTypeNameC (doP, n) ;
+         doTypeNameModifier (doP, n) ;
          outText (doP, ";\n\n")
       ELSIF isEnumeration (m)
       THEN
-         outText (doP, "typedef") ; setNeedSpace (doP) ;
-         doTypeC (doP, m, m) ;
-         setNeedSpace (doP) ;
-        doTypeNameC (doP, n) ;
-         outText (doP, ";\n\n")
+         IF isDeclType (n)
+         THEN
+            outText (doP, "typedef") ; setNeedSpace (doP) ;
+            doTypeC (doP, m, m) ;
+            setNeedSpace (doP) ;
+            doTypeNameC (doP, n) ;
+            outText (doP, ";\n\n")
+         END
       ELSE
          outText (doP, "typedef") ; setNeedSpace (doP) ;
          doTypeC (doP, m, m) ;
@@ -7552,6 +8296,7 @@ BEGIN
             setNeedSpace (doP)
          END ;
          doTypeNameC (doP, n) ;
+         doTypeNameModifier (doP, n) ;
          outText (doP, ";\n\n")
       END
    END
@@ -7606,7 +8351,6 @@ BEGIN
       THEN
          IF NOT f^.recordfieldF.tag
          THEN
-            setNeedSpace (p) ;
             doRecordFieldC (p, f) ;
             outText (p, ";\n")
          END
@@ -7864,6 +8608,19 @@ END doSubrC ;
 *)
 
 PROCEDURE doCompletePartialProcType (p: pretty; t, n: node) ;
+BEGIN
+   IF isDeclType (t) AND isDeclType (n)
+   THEN
+      outputCompletePartialProcType (p, t, n)
+   END
+END doCompletePartialProcType ;
+
+
+(*
+   outputCompletePartialProcType -
+*)
+
+PROCEDURE outputCompletePartialProcType (p: pretty; t, n: node) ;
 VAR
    i, h: CARDINAL ;
    v, u: node ;
@@ -7871,7 +8628,9 @@ BEGIN
    assert (isProcType (n)) ;
    u := NIL ;
    outText (p, "typedef") ; setNeedSpace (p) ;
-   doTypeC (p, n^.proctypeF.returnType, u) ; setNeedSpace (p) ;
+   doTypeC (p, n^.proctypeF.returnType, u) ;
+   doOpaqueModifier (p, n) ;
+   setNeedSpace (p) ;
    outText (p, "(*") ;
    doFQNameC (p, t) ;
    outText (p, "_t) (") ;
@@ -7906,7 +8665,7 @@ BEGIN
    outText (p, "_p {") ; setNeedSpace (p) ;
    doFQNameC (p, t) ;
    outText (p, "_t proc; };\n\n")
-END doCompletePartialProcType ;
+END outputCompletePartialProcType ;
 
 
 (*
@@ -8092,6 +8851,11 @@ BEGIN
    m := NIL ;
    setNeedSpace (p) ;
    doTypeC (p, f^.recordfieldF.type, m) ;
+   IF isType (f^.recordfieldF.type) AND isDeclInImp (f^.recordfieldF.type)
+   THEN
+      outText (p, '__opaque')
+   END ;
+   setNeedSpace (p) ;
    doDNameC (p, f, FALSE)
 END doRecordFieldC ;
 
@@ -8298,14 +9062,7 @@ BEGIN
       doEnumerationC (p, n)
    ELSIF isType (n)
    THEN
-      doFQNameC (p, n) ;
-      setNeedSpace (p)
-      (* doTypeAliasC (p, n, n) *)  (* type, n, has a name, so we choose this over, m.  *)
-(*
-   ELSIF isProcType (n) OR isArray (n) OR isRecord (n)
-   THEN
-      HALT  (* n should have been simplified.  *)
-*)
+      doFQNameC (p, n)
    ELSIF isProcType (n)
    THEN
       doProcTypeC (p, n, m)
@@ -8408,8 +9165,7 @@ BEGIN
    THEN
       doSubrangeC (p, n)
    ELSE
-      print (p, "is type unknown required\n") ;
-      stop
+      print (p, "is type unknown required\n")
    END
 END doTypeNameC ;
 
@@ -8430,32 +9186,70 @@ END isExternal ;
 
 
 (*
-   doVarC -
+   doOpaqueModifier - adds postfix __opaque providing n uses an opaque type which is
+                      not represented by ( void * ).  n is a non type node which might
+                      be using an opaque type.  For example a var or param node.
 *)
 
-PROCEDURE doVarC (n: node) ;
+PROCEDURE doOpaqueModifier (p: pretty; n: node) ;
+BEGIN
+   assert (NOT isType (n)) ;
+   IF isImp (getCurrentModule ()) AND nodeUsesOpaque (n) AND (NOT getNodeOpaqueVoidStar (n))
+   THEN
+      outText (doP, '__opaque')
+   END
+END doOpaqueModifier ;
+
+
+(*
+   doDeclareVarC -
+*)
+
+PROCEDURE doDeclareVarC (n: node) ;
 VAR
-   s: node ;
+   type,
+   s   : node ;
+BEGIN
+   s := NIL ;
+   type := getType (n) ;
+   doTypeC (doP, type, s) ;
+   doOpaqueModifier (doP, n) ;
+   setNeedSpace (doP) ;
+   doFQDNameC (doP, n, FALSE) ;
+   print (doP, ";\n")
+END doDeclareVarC ;
+
+
+(*
+   doVarC - output a variable declaration.  Note that we do not generate
+            a declaration if we are translating the implementation module
+            and a variable is exported as the variable will be in the .h
+            file to avoid all -Wodr issues.
+*)
+
+PROCEDURE doVarC (n: node) ;
 BEGIN
    IF isDef (getMainModule ())
    THEN
-      print (doP, "EXTERN") ; setNeedSpace (doP)
+      print (doP, "EXTERN") ; setNeedSpace (doP) ;
+      doDeclareVarC (n)
    ELSIF (NOT isExported (n)) AND (NOT isLocal (n))
    THEN
-      print (doP, "static") ; setNeedSpace (doP)
+      print (doP, "static") ; setNeedSpace (doP) ;
+      doDeclareVarC (n)
    ELSIF getExtendedOpaque ()
    THEN
+      (* --fixme-- need to revisit extended opaque.  *)
       IF isExternal (n)
       THEN
          (* different module declared this variable, therefore it is extern.  *)
          print (doP, "extern") ; setNeedSpace (doP)
-      END
-   END ;
-   s := NIL ;
-   doTypeC (doP, getType (n), s) ;
-   setNeedSpace (doP) ;
-   doFQDNameC (doP, n, FALSE) ;
-   print (doP, ";\n")
+      END ;
+      doDeclareVarC (n)
+   ELSIF isLocal (n)
+   THEN
+      doDeclareVarC (n)
+   END
 END doVarC ;
 
 
@@ -8507,10 +9301,17 @@ END doProcedureComment ;
 
 PROCEDURE doProcedureHeadingC (n: node; prototype: BOOLEAN) ;
 VAR
+   s   : String ;
    i, h: CARDINAL ;
    p, q: node ;
 BEGIN
    assert (isProcedure (n)) ;
+   s := getFQstring (n) ;
+   IF EqualArray (s, 'M2Quads_BuildAssignment')
+   THEN
+      localstop
+   END ;
+   s := KillString (s) ;
    noSpace (doP) ;
    IF isDef (getMainModule ())
    THEN
@@ -8525,7 +9326,15 @@ BEGIN
       outText (doP, "static") ; setNeedSpace (doP)
    END ;
    q := NIL ;
-   doTypeC (doP, n^.procedureF.returnType, q) ; setNeedSpace (doP) ;
+   doTypeC (doP, n^.procedureF.returnType, q) ;
+   (*
+   IF NOT isExported (n)
+   THEN
+      doTypeNameModifier (doP, n^.procedureF.returnType)
+   END ;
+   *)
+   doOpaqueModifier (doP, n) ;
+   setNeedSpace (doP) ;
    doFQDNameC (doP, n, FALSE) ;
    setNeedSpace (doP) ;
    outText (doP, "(") ;
@@ -9301,18 +10110,26 @@ END doAfterCommentC ;
 *)
 
 PROCEDURE doReturnC (p: pretty; s: node) ;
+VAR
+   type: node ;
 BEGIN
    assert (isReturn (s)) ;
    doCommentC (p, s^.returnF.returnComment.body) ;
    outText (p, "return") ;
-   IF s^.returnF.scope#NIL
+   IF (s^.returnF.scope#NIL) AND (s^.returnF.exp#NIL)
    THEN
       setNeedSpace (p) ;
       IF (NOT isProcedure (s^.returnF.scope)) OR (getType (s^.returnF.scope)=NIL)
       THEN
          metaError1 ('{%1DMad} has no return type', s^.returnF.scope) ;
       ELSE
-         doExprCastC (p, s^.returnF.exp, getType (s^.returnF.scope))
+         IF isProcedure (s^.returnF.scope) AND nodeUsesOpaque (s^.returnF.scope)
+         THEN
+            forceCastOpaque (p, s^.returnF.scope, s^.returnF.exp,
+                             getNodeOpaqueVoidStar (s^.returnF.scope))
+         ELSE
+            doExprCastC (p, s^.returnF.exp, getType (s^.returnF.scope))
+         END
       END
    END ;
    outText (p, ";") ;
@@ -9372,7 +10189,7 @@ BEGIN
          (* potentially a cast is required.  *)
          IF isPointer (type) OR (type = addressN)
          THEN
-            outText (p, 'reinterpret_cast<') ;
+            outText (p, 'static_cast<') ;
             doTypeNameC (p, type) ;
             noSpace (p) ;
             outText (p, '> (') ;
@@ -9412,6 +10229,80 @@ BEGIN
 END requiresUnpackProc ;
 
 
+(*
+   forceCastOpaque -
+*)
+
+PROCEDURE forceCastOpaque (p: pretty; des, expr: node; toVoidStar: BOOLEAN) ;
+BEGIN
+   IF nodeUsesOpaque (expr)
+   THEN
+      flushOpaque (p, expr, getNodeOpaqueVoidStar (des))
+   ELSE
+      forceReintCastOpaque (p, des, expr, toVoidStar)
+   END
+END forceCastOpaque ;
+
+
+(*
+   forceReintCastOpaque -
+*)
+
+PROCEDURE forceReintCastOpaque (p: pretty; des, expr: node; toVoidStar: BOOLEAN) ;
+VAR
+   type: node ;
+BEGIN
+   type := getType (des) ;
+   IF toVoidStar
+   THEN
+      (* next is true cast to void * opaque type.  *)
+      outText (p, 'static_cast<') ;
+      doTypeNameC (p, type) ;
+      noSpace (p) ;
+      outText (p, '> (') ;
+      doExprC (p, expr) ;
+      outText (p, ')')
+   ELSE
+      (* next is false cast to __opaque opaque type.  *)
+      outText (p, 'static_cast<') ;
+      doTypeNameC (p, type) ;
+      outText (p, '__opaque') ;
+      noSpace (p) ;
+      outText (p, '> (') ;
+      doExprC (p, expr) ;
+      outText (p, ')') ;
+   END
+END forceReintCastOpaque ;
+
+
+(*
+   doUnConstCastUnbounded - if node n type is an unbounded array then
+                            use const_cast to remove the const parameter
+                            to allow the unbounded array to be modified.
+*)
+
+PROCEDURE doUnConstCastUnbounded (p: pretty; n: node) ;
+VAR
+   type, v: node ;
+BEGIN
+   IF isArrayRef (n)
+   THEN
+      IF isVar (n^.arrayrefF.array)
+      THEN
+         v := n^.arrayrefF.array ;
+         IF (v^.varF.isParameter OR v^.varF.isVarParameter) AND
+           isUnbounded (getType (v))
+         THEN
+            type := getType (v) ;
+            outText (p, " /* const_cast<") ;
+            doTypeNameC (p, type) ;
+            outText (p, "> is needed */ ") ;
+         END
+      END
+   END
+END doUnConstCastUnbounded ;
+
+
 (*
    doAssignmentC -
 *)
@@ -9420,11 +10311,35 @@ PROCEDURE doAssignmentC (p: pretty; s: node) ;
 BEGIN
    assert (isAssignment (s)) ;
    doCommentC (p, s^.assignmentF.assignComment.body) ;
-   doExprCup (p, s^.assignmentF.des, requiresUnpackProc (s)) ;
+   IF debugOpaque
+   THEN
+      outText (p, " /* des: */ ") ;
+      dumpOpaqueState (s^.assignmentF.des) ;
+      outText (p, " /* expr: */ ") ;
+      dumpOpaqueState (s^.assignmentF.expr)
+   END ;
+   s^.assignmentF.des := doExprCup (p, s^.assignmentF.des,
+                                    requiresUnpackProc (s), TRUE) ;
+   IF debugOpaque
+   THEN
+      outText (p, "\n /* after doExprCup des: */ ") ;
+      dumpOpaqueState (s^.assignmentF.des) ;
+      outText (p, "\n")
+   END ;
    setNeedSpace (p) ;
    outText (p, "=") ;
    setNeedSpace (p) ;
-   doExprCastC (p, s^.assignmentF.expr, getType (s^.assignmentF.des)) ;
+   IF nodeUsesOpaque (s^.assignmentF.des)
+   THEN
+      forceCastOpaque (p, s^.assignmentF.des, s^.assignmentF.expr,
+                       getNodeOpaqueVoidStar (s^.assignmentF.des))
+   ELSE
+      IF debugOpaque
+      THEN
+         outText (p, " /* no opaque des seen */ ")
+      END ;
+      doExprCastC (p, s^.assignmentF.expr, getType (s^.assignmentF.des))
+   END ;
    outText (p, ";") ;
    doAfterCommentC (p, s^.assignmentF.assignComment.after)
 END doAssignmentC ;
@@ -10058,11 +10973,11 @@ PROCEDURE doAdrExprC (p: pretty; n: node) ;
 BEGIN
    IF isDeref (n)
    THEN
-      (* (* no point in issuing & ( * n )  *) *)
+      (* No point in issuing & ( * n ).  *)
       doExprC (p, n^.unaryF.arg)
    ELSIF isVar (n) AND n^.varF.isVarParameter
    THEN
-      (* (* no point in issuing & ( * n )  *) *)
+      (* No point in issuing & ( * n ).  *)
       doFQNameC (p, n)
    ELSE
       outText (p, '&') ;
@@ -10129,7 +11044,7 @@ BEGIN
       THEN
          IF isString (actual) AND (skipType (ft) = addressN)
          THEN
-            outText (p, "const_cast<void*> (reinterpret_cast<const void*> (") ;
+            outText (p, "const_cast<void*> (static_cast<const void*> (") ;
            RETURN 2
          ELSIF isPointer (skipType (ft)) OR (skipType (ft) = addressN)
          THEN
@@ -10232,6 +11147,42 @@ BEGIN
 END isDefForCNode ;
 
 
+(*
+   doFuncVarParam - detect whether the formal uses an opaque and ensure that the address of
+                    the actual parameter is cast to the formal type.
+*)
+
+PROCEDURE doFuncVarParam (p: pretty; actual, formal: node) ;
+VAR
+   type: node ;
+BEGIN
+   IF nodeUsesOpaque (formal) AND
+      getNodeOpaqueFlushNecessary (actual, getNodeOpaqueVoidStar (formal))
+   THEN
+      type := getType (formal) ;
+      outText (p, 'reinterpret_cast<') ;
+      IF getNodeOpaqueVoidStar (formal)
+      THEN
+         doTypeNameC (p, type) ;
+         setNeedSpace (p) ;
+         outText (p, '*> (&') ;
+         doExprC (p, actual) ;
+         outText (p, ')') ;
+         actual := makeOpaqueCast (actual, TRUE)
+      ELSE
+         doTypeNameC (p, type) ;
+         noSpace (p) ;
+         outText (p, '__opaque *> (&') ;
+         doExprC (p, actual) ;
+         outText (p, ')') ;
+         actual := makeOpaqueCast (actual, FALSE)
+      END
+   ELSE
+      doAdrExprC (p, actual)
+   END
+END doFuncVarParam ;
+
+
 (*
    doFuncParamC -
 *)
@@ -10283,14 +11234,22 @@ BEGIN
                doCastC (p, getType (formal), actual)
             END
          ELSE
-            lbr := checkSystemCast (p, actual, formal) ;
             IF isVarParam (formal)
             THEN
-               doAdrExprC (p, actual)
+               lbr := checkSystemCast (p, actual, formal) ;
+               doFuncVarParam (p, actual, formal) ;
+               emitN (p, ")", lbr)
             ELSE
-               doExprC (p, actual)
-            END ;
-            emitN (p, ")", lbr)
+               IF nodeUsesOpaque (formal)
+               THEN
+                  forceCastOpaque (p, formal, actual,
+                                   getNodeOpaqueVoidStar (formal))
+               ELSE
+                  lbr := checkSystemCast (p, actual, formal) ;
+                  doExprC (p, actual) ;
+                  emitN (p, ")", lbr)
+               END
+            END
          END
       END
    END
@@ -10442,22 +11401,20 @@ BEGIN
    THEN
       (* & and * cancel each other out.  *)
       outTextN (p, getSymName (n))   (* --fixme-- does the caller need to cast it?  *)
-   ELSE
-      IF isString (n)
+   ELSIF isString (n) OR (isArray (getType (n)) AND isUnbounded (getType (n)))
+   THEN
+      IF lang = ansiCP
       THEN
-         IF lang = ansiCP
-         THEN
-            outText (p, "const_cast<void*> (reinterpret_cast<const void*>") ;
-            outText (p, "(") ;
-            doExprC (p, n) ;
-            outText (p, "))")
-         ELSE
-            doExprC (p, n)
-         END
+         outText (p, "const_cast<void*> (static_cast<const void*>") ;
+         outText (p, "(") ;
+         doExprC (p, n) ;
+         outText (p, "))")
       ELSE
-         outText (p, "&") ;
          doExprC (p, n)
       END
+   ELSE
+      outText (p, "&") ;
+      doExprC (p, n)
    END
 END doAdrArgC ;
 
@@ -11170,6 +12127,23 @@ END doConvertSC ;
 *)
 
 
+(*
+   getFunction - return the function associate with funccall node n.
+*)
+
+PROCEDURE getFunction (n: node) : node ;
+BEGIN
+   assert (isFuncCall (n)) ;
+   CASE n^.kind OF
+
+   funccall:  RETURN n^.funccallF.function
+
+   ELSE
+      HALT
+   END
+END getFunction ;
+
+
 (*
    getFuncFromExpr -
 *)
@@ -11701,7 +12675,9 @@ BEGIN
 END doStatementsC ;
 
 
-PROCEDURE stop ; END stop ;
+PROCEDURE localstop ;
+END localstop ;
+
 
 (*
    doLocalVarC -
@@ -11711,7 +12687,6 @@ PROCEDURE doLocalVarC (p: pretty; s: scopeT) ;
 BEGIN
    includeVarProcedure (s) ;
    debugLists ;
-
    topologicallyOut (doConstC, doTypesC, doVarC,
                      outputPartial,
                      doNone, doCompletePartialC, doNone)
@@ -13912,13 +14887,9 @@ END dumpQ ;
 *)
 
 PROCEDURE dumpLists ;
-VAR
-   m: String ;
 BEGIN
-   IF getDebugTopological ()
+   IF getDebugTopological () AND FALSE
    THEN
-      m := Sprintf0 (InitString ('\n')) ;
-      m := KillString (WriteS (StdOut, m)) ;
       dumpQ ('todo', globalGroup^.todoQ) ;
       dumpQ ('partial', globalGroup^.partialQ) ;
       dumpQ ('done', globalGroup^.doneQ)
@@ -14099,7 +15070,7 @@ BEGIN
       IF tryComplete (d, c, t, v)
       THEN
          alists.removeItemFromList (globalGroup^.todoQ, d) ;
-        alists.includeItemIntoList (globalGroup^.doneQ, d) ;
+         addDone (d) ;
          i := 1
       ELSIF tryPartial (d, pt)
       THEN
@@ -14130,7 +15101,7 @@ BEGIN
       IF tryCompleteFromPartial (d, t)
       THEN
          alists.removeItemFromList (globalGroup^.partialQ, d) ;
-         alists.includeItemIntoList (globalGroup^.doneQ, d) ;
+         addDone (d) ;
          i := 1 ;
          DEC (n)
       ELSE
@@ -14144,7 +15115,7 @@ END tryOutputPartial ;
    debugList -
 *)
 
-PROCEDURE debugList (a: ARRAY OF CHAR; l: alist) ;
+PROCEDURE debugList (listName, symName: ARRAY OF CHAR; l: alist) ;
 VAR
    i, h: CARDINAL ;
    n   : node ;
@@ -14152,12 +15123,10 @@ BEGIN
    h := alists.noOfItemsInList (l) ;
    IF h>0
    THEN
-      outText (doP, a) ;
-      outText (doP, ' still contains node(s)\n') ;
       i := 1 ;
       REPEAT
          n := alists.getItemFromList (l, i) ;
-         dbg (n) ;
+         dbg (listName, symName, n) ;
          INC (i)
       UNTIL i > h
    END
@@ -14172,8 +15141,9 @@ PROCEDURE debugLists ;
 BEGIN
    IF getDebugTopological ()
    THEN
-      debugList ('todo', globalGroup^.todoQ) ;
-      debugList ('partial', globalGroup^.partialQ)
+      debugList ('todo', 'decl_node', globalGroup^.todoQ) ;
+      debugList ('partial', 'decl_node', globalGroup^.partialQ) ;
+      debugList ('done', 'decl_node', globalGroup^.doneQ)
    END
 END debugLists ;
 
@@ -14255,9 +15225,11 @@ BEGIN
    doFQNameC (p, n) ;
    outText (p, "_init") ;
    setNeedSpace (p) ;
-   outText (p, "(__attribute__((unused)) int argc") ;
-   outText (p, ",__attribute__((unused)) char *argv[]") ;
-   outText (p, ",__attribute__((unused)) char *envp[])\n");
+   outText (p, "(__attribute__((unused)) int argc,") ;
+   setNeedSpace (p) ;
+   outText (p, "__attribute__((unused)) char *argv[],") ;
+   setNeedSpace (p) ;
+   outText (p, "__attribute__((unused)) char *envp[])\n");
    p := outKc (p, "{\n") ;
    doStatementsC (p, n^.impF.beginStatements) ;
    p := outKc (p, "}\n") ;
@@ -14269,9 +15241,11 @@ BEGIN
    doFQNameC (p, n) ;
    outText (p, "_fini") ;
    setNeedSpace (p) ;
-   outText (p, "(__attribute__((unused)) int argc") ;
-   outText (p, ",__attribute__((unused)) char *argv[]") ;
-   outText (p, ",__attribute__((unused)) char *envp[])\n");
+   outText (p, "(__attribute__((unused)) int argc,") ;
+   setNeedSpace (p) ;
+   outText (p, "__attribute__((unused)) char *argv[],") ;
+   setNeedSpace (p) ;
+   outText (p, "__attribute__((unused)) char *envp[])\n");
    p := outKc (p, "{\n") ;
    doStatementsC (p, n^.impF.finallyStatements) ;
    p := outKc (p, "}\n")
@@ -14341,8 +15315,10 @@ BEGIN
    outText (p, "_init") ;
    setNeedSpace (p) ;
    outText (p, "(__attribute__((unused)) int argc,") ;
-   outText (p, " __attribute__((unused)) char *argv[]") ;
-   outText (p, " __attribute__((unused)) char *envp[])\n") ;
+   setNeedSpace (p) ;
+   outText (p, "__attribute__((unused)) char *argv[],") ;
+   setNeedSpace (p) ;
+   outText (p, "__attribute__((unused)) char *envp[])\n") ;
    p := outKc (p, "{\n") ;
    doStatementsC (p, n^.impF.beginStatements) ;
    p := outKc (p, "}\n") ;
@@ -14355,8 +15331,10 @@ BEGIN
    outText (p, "_fini") ;
    setNeedSpace (p) ;
    outText (p, "(__attribute__((unused)) int argc,") ;
-   outText (p, " __attribute__((unused)) char *argv[]") ;
-   outText (p, " __attribute__((unused)) char *envp[])\n") ;
+   setNeedSpace (p) ;
+   outText (p, "__attribute__((unused)) char *argv[],") ;
+   setNeedSpace (p) ;
+   outText (p, "__attribute__((unused)) char *envp[])\n") ;
    p := outKc (p, "{\n") ;
    doStatementsC (p, n^.impF.finallyStatements) ;
    p := outKc (p, "}\n") ;
@@ -14543,9 +15521,13 @@ BEGIN
       foreachDefModuleDo (runPrototypeDefC)
    ELSE
       s := InitStringCharStar (keyToCharStar (getSymName (n))) ;
-      (* we don't want to include the .h file for this implementation module.  *)
-      print (p, "#define _") ; prints (p, s) ; print (p, "_H\n") ;
+      (* Inform the source that this code belongs to the implementation module.  *)
       print (p, "#define _") ; prints (p, s) ; print (p, "_C\n\n") ;
+      (* Include the definition module for any opaque types.  *)
+      print (doP, '#include "') ;
+      prints (p, getHPrefix ()) ;
+      prints (p, s) ;
+      print (p, '.h"\n') ;
       s := KillString (s) ;
 
       doP := p ;
@@ -15442,8 +16424,15 @@ END setLangM2 ;
 *)
 
 PROCEDURE addDone (n: node) ;
+VAR
+   s: String ;
 BEGIN
-   alists.includeItemIntoList (globalGroup^.doneQ, n)
+   alists.includeItemIntoList (globalGroup^.doneQ, n) ;
+   IF isVar (n) OR isParameter (n)
+   THEN
+      initNodeOpaqueState (n)
+   END ;
+   debugLists
 END addDone ;
 
 
@@ -15464,6 +16453,11 @@ BEGIN
       metaError1 ('cyclic dependancy found between another module using {%1ad} from the definition module of the implementation main being compiled, use the --extended-opaque option to compile', n) ;
       flushErrors ;
       errorAbort0 ('terminating compilation')
+   ELSIF isType (n) AND isDeclInImp (n)
+   THEN
+      (* Ignore an opaque type which is declared in this implementation module as it
+         will be fully declared in C/C++ with the __opaque postfix.  Whereas the
+         void * non prefixed typedef will be declared in the .h file.  *)
    ELSE
       addDone (n)
    END
@@ -15704,7 +16698,7 @@ END doDbg ;
    dbg -
 *)
 
-PROCEDURE dbg (n: node) ;
+PROCEDURE dbg (listName, symName: ARRAY OF CHAR; n: node) ;
 VAR
    l: alist ;
    o: pretty ;
@@ -15720,10 +16714,20 @@ BEGIN
    l := alists.initList () ;
    alists.includeItemIntoList (l, n) ;
    i := 1 ;
-   out1 ("dbg (%s)\n", n) ;
    REPEAT
       n := alists.getItemFromList (l, i) ;
-      doDbg (l, n) ;
+      IF isType (n)
+      THEN
+         s := getFQstring (n) ;
+         IF EqualArray (s, symName)
+         THEN
+            out0 ("list ") ;
+            out0 (listName) ;
+            out0 (": ") ;
+            doDbg (l, n)
+         END ;
+         s := KillString (s)
+      END ;
       INC (i)
    UNTIL i>alists.noOfItemsInList (l) ;
    doP := o ;
@@ -16658,6 +17662,7 @@ BEGIN
    assert (isFuncCall (n)) ;
    m := makeFuncCall (dupExpr (n^.funccallF.function), dupExpr (n^.funccallF.args)) ;
    m^.funccallF.type := n^.funccallF.type ;
+   assignNodeOpaqueCastState (m, n) ;
    RETURN m
 END dupFunccall ;
 
index 7c841bf8d63ea4a5940c6a47a2d1f1d25cc958b1..26139516dfd647f2b9ee748d76916b0a73189454 100644 (file)
@@ -27,6 +27,7 @@ along with GNU Modula-2; see the file COPYING3.  If not see
 
 #include <time.h>
 #include <ctype.h>
+#include <stdbool.h>
 
 #ifndef alloca
 #ifdef __GNUC__
@@ -101,11 +102,11 @@ static  void pushFunction             (char *function, int module);
 static  void popFunction              (void);
 static  void checkFunction            (void);
         int  mcflex_getColumnNo       (void);
-       int  mcflex_openSource        (char *s);
+       bool mcflex_openSource        (char *s);
        int  mcflex_getLineNo         (void);
        void mcflex_closeSource       (void);
        char *mcflex_getToken         (void);
-        void _M2_mcflex_init          (void);
+        void _M2_mcflex_init          (int argc, char *argv[], char *envp[]);
         int  mcflex_getTotalLines     (void);
 extern  void  yylex                   (void);
 
@@ -659,13 +660,13 @@ mcflex_closeSource (void)
 /* openSource returns TRUE if file s can be opened and
    all tokens are taken from this file.  */
 
-int
+bool
 mcflex_openSource (char *s)
 {
   FILE *newInputFile = fopen (s, "r");
 
   if (newInputFile == NULL)
-    return FALSE;
+    return false;
   else
     {
       isDefinitionModule = FALSE;
@@ -687,7 +688,7 @@ mcflex_openSource (char *s)
       if (currentLine != NULL)
        currentLine->actualline = lineno;
       START_FILE (filename, lineno);
-      return TRUE;
+      return true;
     }
 }
 
@@ -734,12 +735,12 @@ yywrap (void)
 }
 
 void
-_M2_mcflex_init (void)
+_M2_mcflex_init (int argc, char *argv[], char *envp[])
 {
 }
 
 void
-_M2_mcflex_fini (void)
+_M2_mcflex_fini (int argc, char *argv[], char *envp[])
 {
 }
 
index 31f412fcf8af3a78414055399ea87597c47c2d1f..9e75ca5e42a31272f4cf8baa91340be92b6d8fb7 100644 (file)
@@ -22,6 +22,8 @@ along with GNU Modula-2; see the file COPYING3.  If not see
 #ifndef mcCommentH
 #define mcCommentH
 
+#include <stdbool.h>
+
 /* addText the text cs is appended to the current comment.  */
 
 extern void mcComment_addText (void *cd, char *cs);
@@ -34,7 +36,7 @@ extern void mcComment_addText (void *cd, char *cs);
    If onlySpaces is TRUE then an inbody comment is created.
    If onlySpaces is FALSE then an after statement comment is created.  */
 
-extern void *mcComment_initComment (unsigned int onlySpaces);
+extern void *mcComment_initComment (bool onlySpaces);
 
 
 #endif
index 7b81222f356fbb58cada1e17cf2a3c0414e129cf..cdea1f466bf644f86fd69c62a5f025a014debe91 100644 (file)
@@ -752,7 +752,8 @@ BEGIN
       setOutputFile (Slice (arg, 3, 0))
    ELSIF optionIs ("--extended-opaque", arg)
    THEN
-      setExtendedOpaque (TRUE)
+      (* setExtendedOpaque (TRUE) *)
+      printf0 ("IGNORING --extended-opaque - this option is no longer implemented - please adjust the call to mc\n")
    ELSIF optionIs ("--debug-top", arg)
    THEN
       setDebugTopological (TRUE)
index 5c1460b5517e81bbe565aedb0d01a7ac914a10eb..5b9661b4c2328becf5aaea15de5979416ca75fa6 100644 (file)
@@ -59,7 +59,7 @@ FROM mcLexBuf IMPORT currentstring, currenttoken, getToken, insertToken,
 FROM decl IMPORT node, lookupDef, lookupImp, lookupModule, getSymName,
                  lookupSym, putDefForC,
                  makeProcedure, makeType, makeTypeImp, makeVar, makeConst,
-                enterScope, leaveScope, putTypeHidden,
+                enterScope, leaveScope, putTypeHidden, putTypeOpaque,
                 addImportedModule, getCurrentModule,
                 putCommentDefProcedure, putCommentModProcedure ;
 
@@ -1064,7 +1064,8 @@ DefinitionModule :=                                                    % VAR c:
 
 DefTypeDeclaration := { Ident                                          % VAR n: node ; %
                                                                       % n := makeType (curident) %
-                        ( ";"                                          % putTypeHidden (n) %
+                        ( ";"                                          % putTypeHidden (n) ;
+                                                                         putTypeOpaque (n) %
                              | "=" Type Alignment ";" ) }
                    =:
 
diff --git a/gcc/testsuite/gm2/base-lang/pass/SYSTEM.def b/gcc/testsuite/gm2/base-lang/pass/SYSTEM.def
new file mode 100644 (file)
index 0000000..fde650b
--- /dev/null
@@ -0,0 +1,197 @@
+(* SYSTEM.def provides access to the SYSTEM dependent module.
+
+Copyright (C) 2001-2024 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.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+<http://www.gnu.org/licenses/>.  *)
+
+DEFINITION MODULE SYSTEM ;
+
+EXPORT QUALIFIED BITSPERBYTE, BYTESPERWORD,
+                 ADDRESS, WORD, BYTE, CSIZE_T, CSSIZE_T, (* @SYSTEM_DATATYPES@  *)
+                 ADR, TSIZE, ROTATE, SHIFT, THROW, TBITSIZE ;
+                 (* SIZE is also exported if -fpim2 is used.  *)
+
+CONST
+  BITSPERBYTE   = __ATTRIBUTE__ __BUILTIN__ ((BITS_PER_UNIT)) ;
+  BYTESPERWORD  = __ATTRIBUTE__ __BUILTIN__ ((UNITS_PER_WORD)) ;
+
+(* Note that the full list of system and sized datatypes include:
+   LOC, WORD, BYTE, ADDRESS,
+
+   (and the non language standard target types)
+
+   INTEGER8, INTEGER16, INTEGER32, INTEGER64,
+   CARDINAL8, CARDINAL16, CARDINAL32, CARDINAL64,
+   WORD16, WORD32, WORD64, BITSET8, BITSET16,
+   BITSET32, REAL32, REAL64, REAL128, COMPLEX32,
+   COMPLEX64, COMPLEX128, CSIZE_T, CSSIZE_T.
+
+   Also note that the non-standard data types will
+   move into another module in the future.  *)
+
+
+(* The following types are supported on this target:
+TYPE
+   @SYSTEM_TYPES@
+*)
+
+
+(*
+   all the functions below are declared internally to gm2
+   ======================================================
+
+PROCEDURE ADR (VAR v: <anytype>): ADDRESS;
+  (* Returns the address of variable v. *)
+
+PROCEDURE SIZE (v: <type>) : ZType;
+  (* Returns the number of BYTES used to store a v of
+     any specified <type>.  Only available if -fpim2 is used.
+  *)
+
+PROCEDURE TSIZE (<type>) : CARDINAL;
+  (* Returns the number of BYTES used to store a value of the
+     specified <type>.
+  *)
+
+PROCEDURE ROTATE (val: <a set type>;
+                  num: INTEGER): <type of first parameter>;
+  (* Returns a bit sequence obtained from val by rotating up/right
+     or down/right by the absolute value of num.  The direction is
+     down/right if the sign of num is negative, otherwise the direction
+     is up/left.
+  *)
+
+PROCEDURE SHIFT (val: <a set type>;
+                 num: INTEGER): <type of first parameter>;
+  (* Returns a bit sequence obtained from val by shifting up/left
+     or down/right by the absolute value of num, introducing
+     zeros as necessary.  The direction is down/right if the sign of
+     num is negative, otherwise the direction is up/left.
+  *)
+
+PROCEDURE THROW (i: INTEGER) <* noreturn *> ;
+  (*
+     THROW is a GNU extension and was not part of the PIM or ISO
+     standards.  It throws an exception which will be caught by the
+     EXCEPT block (assuming it exists).  This is a compiler builtin
+     function which interfaces to the GCC exception handling runtime
+     system.
+     GCC uses the term throw, hence the naming distinction between
+     the GCC builtin and the Modula-2 runtime library procedure Raise.
+     The later library procedure Raise will call SYSTEM.THROW after
+     performing various housekeeping activities.
+  *)
+
+PROCEDURE TBITSIZE (<type>) : CARDINAL ;
+  (* Returns the minimum number of bits necessary to represent
+     <type>.  This procedure function is only useful for determining
+     the number of bits used for any type field within a packed RECORD.
+     It is not particularly useful elsewhere since <type> might be
+     optimized for speed, for example a BOOLEAN could occupy a WORD.
+  *)
+*)
+
+(* The following procedures are invoked by GNU Modula-2 to
+   shift non word sized set types. They are not strictly part
+   of the core PIM Modula-2, however they are used
+   to implement the SHIFT procedure defined above,
+   which are in turn used by the Logitech compatible libraries.
+
+   Users will access these procedures by using the procedure
+   SHIFT above and GNU Modula-2 will map SHIFT onto one of
+   the following procedures.
+*)
+
+(*
+   ShiftVal - is a runtime procedure whose job is to implement
+              the SHIFT procedure of ISO SYSTEM. GNU Modula-2 will
+              inline a SHIFT of a single WORD sized set and will only
+              call this routine for larger sets.
+*)
+
+PROCEDURE ShiftVal (VAR s, d: ARRAY OF BITSET;
+                    SetSizeInBits: CARDINAL;
+                    ShiftCount: INTEGER) ;
+
+
+(*
+   ShiftLeft - performs the shift left for a multi word set.
+               This procedure might be called by the back end of
+               GNU Modula-2 depending whether amount is known at
+               compile time.
+*)
+
+PROCEDURE ShiftLeft (VAR s, d: ARRAY OF BITSET;
+                     SetSizeInBits: CARDINAL;
+                     ShiftCount: CARDINAL) ;
+
+(*
+   ShiftRight - performs the shift left for a multi word set.
+                This procedure might be called by the back end of
+                GNU Modula-2 depending whether amount is known at
+                compile time.
+*)
+
+PROCEDURE ShiftRight (VAR s, d: ARRAY OF BITSET;
+                      SetSizeInBits: CARDINAL;
+                      ShiftCount: CARDINAL) ;
+
+
+(*
+   RotateVal - is a runtime procedure whose job is to implement
+               the ROTATE procedure of ISO SYSTEM. GNU Modula-2 will
+               inline a ROTATE of a single WORD (or less)
+               sized set and will only call this routine for larger
+               sets.
+*)
+
+PROCEDURE RotateVal (VAR s, d: ARRAY OF BITSET;
+                     SetSizeInBits: CARDINAL;
+                     RotateCount: INTEGER) ;
+
+
+(*
+   RotateLeft - performs the rotate left for a multi word set.
+                This procedure might be called by the back end of
+                GNU Modula-2 depending whether amount is known at
+                compile time.
+*)
+
+PROCEDURE RotateLeft (VAR s, d: ARRAY OF BITSET;
+                      SetSizeInBits: CARDINAL;
+                      RotateCount: CARDINAL) ;
+
+
+(*
+   RotateRight - performs the rotate right for a multi word set.
+                 This procedure might be called by the back end of
+                 GNU Modula-2 depending whether amount is known at
+                 compile time.
+*)
+
+PROCEDURE RotateRight (VAR s, d: ARRAY OF BITSET;
+                       SetSizeInBits: CARDINAL;
+                       RotateCount: CARDINAL) ;
+
+
+END SYSTEM.
diff --git a/gcc/testsuite/gm2/base-lang/pass/base-lang-test.sh b/gcc/testsuite/gm2/base-lang/pass/base-lang-test.sh
new file mode 100755 (executable)
index 0000000..de33018
--- /dev/null
@@ -0,0 +1,291 @@
+#!/bin/sh
+# Copyright (C) 2024 Free Software Foundation, Inc.
+
+# 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 GCC; see the file COPYING3.  If not see
+# <http://www.gnu.org/licenses/>.
+
+# This file was written by Gaius Mulley (gaiusmod2@gmail.com)
+
+# This script performs base language translation tests with the bootstrap tool mc.
+
+MC=$1
+GCCSRCDIR=$2
+GCCBUILDDIR=$3
+GXX=$4
+
+
+SCRATCHDIR=${GCCBUILDDIR}/m2/mc-base-lang-test
+
+
+function compile () {
+    echo $*
+    if ! $* ; then
+       echo $*
+       echo "bootstrap compiler ${MC} failed: $*"
+       exit 1
+    fi
+}
+
+
+function compile_def () {
+    SRC=$1
+    compile ${MC} -o=${SCRATCHDIR}/G${SRC}.h --olang=c++  --h-file-prefix=G --quiet \
+           -I${GCCSRCDIR}/m2/gm2-libs -I${GCCSRCDIR}/testsuite/gm2/base-lang/pass \
+           ${GCCSRCDIR}/testsuite/gm2/base-lang/pass/${SRC}.def
+}
+
+
+function compile_mod () {
+    SRC=$1
+    compile ${MC} -o=${SCRATCHDIR}/G${SRC}.cc --olang=c++  --h-file-prefix=G --quiet \
+           -I${GCCSRCDIR}/m2/gm2-libs -I${GCCSRCDIR}/testsuite/gm2/base-lang/pass \
+           ${GCCSRCDIR}/testsuite/gm2/base-lang/pass/${SRC}.mod
+}
+
+
+#
+#  verify - check that the translated sources compile with -Wodr
+#
+
+function verify () {
+    SRC=$1
+    if ${GXX} -Wodr -Werror -I${SCRATCHDIR} -c ${SCRATCHDIR}/G${SRC}.cc -o ${SCRATCHDIR}/G${SRC}.o ; then
+       echo "${NAME}: Passed"
+    else
+       echo "${NAME}: Failed (${GXX} -Wodr -Werror -I${SCRATCHDIR} -c ${SCRATCHDIR}/G${SRC}.cc)"
+       exit 1
+    fi
+}
+
+
+function localvar () {
+    rm -rf ${SCRATCHDIR}
+    mkdir -p ${SCRATCHDIR}
+    NAME="local variable creation"
+    compile_def localvar
+    compile_mod localvar
+    verify localvar
+}
+
+
+function globalvar () {
+    rm -rf ${SCRATCHDIR}
+    mkdir -p ${SCRATCHDIR}
+    NAME="global variable creation"
+    compile_def globalvar
+    compile_mod globalvar
+    verify globalvar
+}
+
+
+function localvarassign () {
+    rm -rf ${SCRATCHDIR}
+    mkdir -p ${SCRATCHDIR}
+    NAME="local variable assignment"
+    compile_def localvarassign
+    compile_mod localvarassign
+    verify localvarassign
+}
+
+
+function globalvarassign () {
+    rm -rf ${SCRATCHDIR}
+    mkdir -p ${SCRATCHDIR}
+    NAME="global variable assignment"
+    compile_def globalvarassign
+    compile_mod globalvarassign
+    verify globalvarassign
+}
+
+
+function localproctype () {
+    rm -rf ${SCRATCHDIR}
+    mkdir -p ${SCRATCHDIR}
+    NAME="local proctype creation"
+    compile_def localproctype
+    compile_mod localproctype
+    verify localproctype
+}
+
+
+function globalproctype () {
+    rm -rf ${SCRATCHDIR}
+    mkdir -p ${SCRATCHDIR}
+    NAME="global proctype creation"
+    compile_def globalproctype
+    compile_mod globalproctype
+    verify globalproctype
+}
+
+
+function simpleopaque () {
+    rm -rf ${SCRATCHDIR}
+    mkdir -p ${SCRATCHDIR}
+    NAME="simple opaque type creation"
+    compile_def simpleopaque
+    compile_mod simpleopaque
+    verify simpleopaque
+}
+
+
+function simplelist () {
+    rm -rf ${SCRATCHDIR}
+    mkdir -p ${SCRATCHDIR}
+    NAME="simple list opaque type field manipulation"
+    compile_def simplelist
+    compile_mod simplelist
+    verify simplelist
+}
+
+
+function simplelistiter () {
+    rm -rf ${SCRATCHDIR}
+    mkdir -p ${SCRATCHDIR}
+    NAME="simple iteration using opaque type field"
+    compile_def simplelistiter
+    compile_mod simplelistiter
+    verify simplelistiter
+}
+
+
+function opaqueparam () {
+    rm -rf ${SCRATCHDIR}
+    mkdir -p ${SCRATCHDIR}
+    NAME="opaque parameter and field assignment"
+    compile_def opaqueparam
+    compile_mod opaqueparam
+    verify opaqueparam
+}
+
+
+function opaqueuse () {
+    rm -rf ${SCRATCHDIR}
+    mkdir -p ${SCRATCHDIR}
+    NAME="opaque use"
+    compile_def opaqueparam
+    compile_def opaqueuse
+    compile_mod opaqueuse
+    verify opaqueuse
+}
+
+
+function opaquestr () {
+    rm -rf ${SCRATCHDIR}
+    mkdir -p ${SCRATCHDIR}
+    NAME="opaque str"
+    compile_def opaquestr
+    compile_def opaqueusestr
+    compile_mod opaqueusestr
+    verify opaqueusestr
+}
+
+
+function opaquenew () {
+    rm -rf ${SCRATCHDIR}
+    mkdir -p ${SCRATCHDIR}
+    NAME="opaque new"
+    compile_def opaquenew
+    compile_mod opaquenew
+    verify opaquenew
+}
+
+
+function opaquefield () {
+    rm -rf ${SCRATCHDIR}
+    mkdir -p ${SCRATCHDIR}
+    NAME="opaque field"
+    compile_def opaquestr
+    compile_def opaquefield
+    compile_mod opaquefield
+    verify opaquefield
+}
+
+
+function opaquevariant () {
+    rm -rf ${SCRATCHDIR}
+    mkdir -p ${SCRATCHDIR}
+    NAME="opaque variant"
+    compile_def opaquevariant
+    compile_mod opaquevariant
+    verify opaquevariant
+}
+
+
+function opaquevarparam () {
+    rm -rf ${SCRATCHDIR}
+    mkdir -p ${SCRATCHDIR}
+    NAME="opaque variant"
+    compile_def opaquevarparam
+    compile_mod opaquevarparam
+    verify opaquevarparam
+}
+
+
+function straddress () {
+    rm -rf ${SCRATCHDIR}
+    mkdir -p ${SCRATCHDIR}
+    NAME="string address"
+    compile_def SYSTEM
+    compile_def straddress
+    compile_mod straddress
+    verify straddress
+}
+
+
+function straddressexport () {
+    rm -rf ${SCRATCHDIR}
+    mkdir -p ${SCRATCHDIR}
+    NAME="string address"
+    compile_def SYSTEM
+    compile_def straddressexport
+    compile_mod straddressexport
+    verify straddressexport
+}
+
+
+function unboundedarray () {
+    rm -rf ${SCRATCHDIR}
+    mkdir -p ${SCRATCHDIR}
+    NAME="string address"
+    compile_def unboundedarray
+    compile_mod unboundedarray
+    verify unboundedarray
+}
+
+
+function runall () {
+    localvar
+    globalvar
+    localvarassign
+    globalvarassign
+    localproctype
+    globalproctype
+    simpleopaque
+    simplelist
+    simplelistiter
+    opaqueparam
+    opaqueuse
+    opaquestr
+    opaquenew
+    opaquefield
+    opaquevariant
+    opaquevarparam
+    straddress
+    straddressexport
+    unboundedarray
+    echo "all base language boot strap tests pass -Wodr -Werror"
+}
+
+
+runall
diff --git a/gcc/testsuite/gm2/base-lang/pass/globalproctype.def b/gcc/testsuite/gm2/base-lang/pass/globalproctype.def
new file mode 100644 (file)
index 0000000..ce52321
--- /dev/null
@@ -0,0 +1,7 @@
+DEFINITION MODULE globalproctype ;  (*!m2pim*)
+
+TYPE
+   myproc = PROCEDURE (CARDINAL) ;
+
+
+END globalproctype.
diff --git a/gcc/testsuite/gm2/base-lang/pass/globalproctype.mod b/gcc/testsuite/gm2/base-lang/pass/globalproctype.mod
new file mode 100644 (file)
index 0000000..bddb5a9
--- /dev/null
@@ -0,0 +1,13 @@
+IMPLEMENTATION MODULE globalproctype ;  (*!m2pim*)
+
+
+PROCEDURE foo (c: CARDINAL) ;
+BEGIN
+END foo ;
+
+
+VAR
+   p: myproc ;
+BEGIN
+   p := foo
+END globalproctype.
diff --git a/gcc/testsuite/gm2/base-lang/pass/globalvar.def b/gcc/testsuite/gm2/base-lang/pass/globalvar.def
new file mode 100644 (file)
index 0000000..8c6ff98
--- /dev/null
@@ -0,0 +1,3 @@
+DEFINITION MODULE globalvar ;  (*!m2pim*)
+
+END globalvar.
diff --git a/gcc/testsuite/gm2/base-lang/pass/globalvar.mod b/gcc/testsuite/gm2/base-lang/pass/globalvar.mod
new file mode 100644 (file)
index 0000000..d18058c
--- /dev/null
@@ -0,0 +1,6 @@
+IMPLEMENTATION MODULE globalvar ;  (*!m2pim*)
+
+VAR
+   i: INTEGER ;
+BEGIN
+END globalvar.
diff --git a/gcc/testsuite/gm2/base-lang/pass/globalvarassign.def b/gcc/testsuite/gm2/base-lang/pass/globalvarassign.def
new file mode 100644 (file)
index 0000000..8238bbf
--- /dev/null
@@ -0,0 +1,3 @@
+DEFINITION MODULE globalvarassign ;  (*!m2pim*)
+
+END globalvarassign.
diff --git a/gcc/testsuite/gm2/base-lang/pass/globalvarassign.mod b/gcc/testsuite/gm2/base-lang/pass/globalvarassign.mod
new file mode 100644 (file)
index 0000000..17e88e4
--- /dev/null
@@ -0,0 +1,8 @@
+IMPLEMENTATION MODULE globalvarassign ;  (*!m2pim*)
+
+
+VAR
+   i: INTEGER ;
+BEGIN
+   i := 1
+END globalvarassign.
diff --git a/gcc/testsuite/gm2/base-lang/pass/localproctype.def b/gcc/testsuite/gm2/base-lang/pass/localproctype.def
new file mode 100644 (file)
index 0000000..54164f9
--- /dev/null
@@ -0,0 +1,3 @@
+DEFINITION MODULE localproctype ;  (*!m2pim*)
+
+END localproctype.
diff --git a/gcc/testsuite/gm2/base-lang/pass/localproctype.mod b/gcc/testsuite/gm2/base-lang/pass/localproctype.mod
new file mode 100644 (file)
index 0000000..e896ef2
--- /dev/null
@@ -0,0 +1,16 @@
+IMPLEMENTATION MODULE localproctype ;  (*!m2pim*)
+
+TYPE
+   myproc = PROCEDURE (CARDINAL) ;
+
+
+PROCEDURE foo (c: CARDINAL) ;
+BEGIN
+END foo ;
+
+
+VAR
+   p: myproc ;
+BEGIN
+   p := foo
+END localproctype.
diff --git a/gcc/testsuite/gm2/base-lang/pass/localvar.def b/gcc/testsuite/gm2/base-lang/pass/localvar.def
new file mode 100644 (file)
index 0000000..726d461
--- /dev/null
@@ -0,0 +1,3 @@
+DEFINITION MODULE localvar ;  (*!m2pim*)
+
+END localvar.
diff --git a/gcc/testsuite/gm2/base-lang/pass/localvar.mod b/gcc/testsuite/gm2/base-lang/pass/localvar.mod
new file mode 100644 (file)
index 0000000..0839351
--- /dev/null
@@ -0,0 +1,11 @@
+IMPLEMENTATION MODULE localvar ;  (*!m2pim*)
+
+PROCEDURE foo ;
+VAR
+   i: INTEGER ;
+BEGIN
+END foo ;
+
+BEGIN
+   foo
+END localvar.
diff --git a/gcc/testsuite/gm2/base-lang/pass/localvarassign.def b/gcc/testsuite/gm2/base-lang/pass/localvarassign.def
new file mode 100644 (file)
index 0000000..a9bb7a4
--- /dev/null
@@ -0,0 +1,3 @@
+DEFINITION MODULE localvarassign ;  (*!m2pim*)
+
+END localvarassign.
diff --git a/gcc/testsuite/gm2/base-lang/pass/localvarassign.mod b/gcc/testsuite/gm2/base-lang/pass/localvarassign.mod
new file mode 100644 (file)
index 0000000..d4de6a5
--- /dev/null
@@ -0,0 +1,14 @@
+IMPLEMENTATION MODULE localvarassign ;  (*!m2pim*)
+
+
+PROCEDURE foo ;
+VAR
+   i: INTEGER ;
+BEGIN
+   i := 1
+END foo ;
+
+
+BEGIN
+   foo
+END localvarassign.
diff --git a/gcc/testsuite/gm2/base-lang/pass/opaquefield.def b/gcc/testsuite/gm2/base-lang/pass/opaquefield.def
new file mode 100644 (file)
index 0000000..83006ec
--- /dev/null
@@ -0,0 +1,8 @@
+DEFINITION MODULE opaquefield ;  (*!m2pim*)
+
+TYPE
+   Content ;
+
+PROCEDURE create () : Content ;
+
+END opaquefield.
diff --git a/gcc/testsuite/gm2/base-lang/pass/opaquefield.mod b/gcc/testsuite/gm2/base-lang/pass/opaquefield.mod
new file mode 100644 (file)
index 0000000..4bbf223
--- /dev/null
@@ -0,0 +1,19 @@
+IMPLEMENTATION MODULE opaquefield ;  (*!m2pim*)
+
+FROM opaquestr IMPORT String, initString ;
+
+TYPE
+   Content = POINTER TO RECORD
+                           next: String ;
+                        END ;
+
+PROCEDURE create () : Content ;
+VAR
+   c: Content ;
+BEGIN
+   c^.next := initString () ;
+   RETURN c
+END create ;
+
+
+END opaquefield.
diff --git a/gcc/testsuite/gm2/base-lang/pass/opaquenew.def b/gcc/testsuite/gm2/base-lang/pass/opaquenew.def
new file mode 100644 (file)
index 0000000..457c3e5
--- /dev/null
@@ -0,0 +1,8 @@
+DEFINITION MODULE opaquenew ;  (*!m2pim*)
+
+TYPE
+   List ;
+
+PROCEDURE dupList (l: List) : List ;
+
+END opaquenew.
diff --git a/gcc/testsuite/gm2/base-lang/pass/opaquenew.mod b/gcc/testsuite/gm2/base-lang/pass/opaquenew.mod
new file mode 100644 (file)
index 0000000..c9b873f
--- /dev/null
@@ -0,0 +1,18 @@
+IMPLEMENTATION MODULE opaquenew ;  (*!m2pim*)
+
+TYPE
+   List = POINTER TO RECORD
+                        next: List ;
+                     END ;
+
+
+PROCEDURE dupList (l: List) : List ;
+VAR
+   n: List ;
+BEGIN
+   (* NEW (n) *)
+   n^ := l^ ;
+   RETURN n
+END dupList ;
+
+END opaquenew.
diff --git a/gcc/testsuite/gm2/base-lang/pass/opaqueparam.def b/gcc/testsuite/gm2/base-lang/pass/opaqueparam.def
new file mode 100644 (file)
index 0000000..007bfb7
--- /dev/null
@@ -0,0 +1,12 @@
+DEFINITION MODULE opaqueparam ;  (*!m2pim*)
+
+TYPE
+   List ;
+
+
+PROCEDURE initList () : List ;
+
+PROCEDURE add (l: List) ;
+
+
+END opaqueparam.
diff --git a/gcc/testsuite/gm2/base-lang/pass/opaqueparam.mod b/gcc/testsuite/gm2/base-lang/pass/opaqueparam.mod
new file mode 100644 (file)
index 0000000..1b854f0
--- /dev/null
@@ -0,0 +1,32 @@
+IMPLEMENTATION MODULE opaqueparam ;  (*!m2pim*)
+
+TYPE
+   List = POINTER TO RECORD
+                        next: List ;
+                     END ;
+
+
+PROCEDURE local (l: List) : List ;
+BEGIN
+   RETURN l
+END local ;
+
+
+PROCEDURE add (l: List) ;
+BEGIN
+   IF l = NIL
+   THEN
+      l^.next := local (initList ())
+   END
+END add ;
+
+
+PROCEDURE initList () : List ;
+VAR
+   l: List ;
+BEGIN
+   RETURN l
+END initList ;
+
+
+END opaqueparam.
diff --git a/gcc/testsuite/gm2/base-lang/pass/opaquestr.def b/gcc/testsuite/gm2/base-lang/pass/opaquestr.def
new file mode 100644 (file)
index 0000000..8ebf166
--- /dev/null
@@ -0,0 +1,10 @@
+DEFINITION MODULE opaquestr ;  (*!m2pim*)
+
+TYPE
+   String ;
+
+PROCEDURE initString () : String ;
+PROCEDURE concat (left, right: String) : String ;
+
+
+END opaquestr.
diff --git a/gcc/testsuite/gm2/base-lang/pass/opaqueuse.def b/gcc/testsuite/gm2/base-lang/pass/opaqueuse.def
new file mode 100644 (file)
index 0000000..084d255
--- /dev/null
@@ -0,0 +1,7 @@
+DEFINITION MODULE opaqueuse ;  (*!m2pim*)
+
+FROM opaqueparam IMPORT List ;
+
+PROCEDURE extending (l: List) : List ;
+
+END opaqueuse.
diff --git a/gcc/testsuite/gm2/base-lang/pass/opaqueuse.mod b/gcc/testsuite/gm2/base-lang/pass/opaqueuse.mod
new file mode 100644 (file)
index 0000000..577a54b
--- /dev/null
@@ -0,0 +1,15 @@
+IMPLEMENTATION MODULE opaqueuse ;  (*!m2pim*)
+
+FROM opaqueparam IMPORT initList, add ;
+
+PROCEDURE extending (l: List) : List ;
+VAR
+   n: List ;
+BEGIN
+   n := initList () ;
+   add (n) ;
+   RETURN n
+END extending ;
+
+
+END opaqueuse.
diff --git a/gcc/testsuite/gm2/base-lang/pass/opaqueusestr.def b/gcc/testsuite/gm2/base-lang/pass/opaqueusestr.def
new file mode 100644 (file)
index 0000000..1e05e45
--- /dev/null
@@ -0,0 +1,9 @@
+DEFINITION MODULE opaqueusestr ;  (*!m2pim*)
+
+FROM opaquestr IMPORT String ;
+
+PROCEDURE doDecimalPlaces (s: String; n: CARDINAL) : String ;
+PROCEDURE IntegerToString (i: INTEGER) : String ;
+
+
+END opaqueusestr.
diff --git a/gcc/testsuite/gm2/base-lang/pass/opaqueusestr.mod b/gcc/testsuite/gm2/base-lang/pass/opaqueusestr.mod
new file mode 100644 (file)
index 0000000..65aebee
--- /dev/null
@@ -0,0 +1,27 @@
+IMPLEMENTATION MODULE opaqueusestr ;  (*!m2pim*)
+
+FROM opaquestr IMPORT initString, concat ;
+
+
+PROCEDURE rtos (r: REAL; TotalWidth, FractionWidth: CARDINAL) : String ;
+BEGIN
+   RETURN ( NIL )
+END rtos ;
+
+
+PROCEDURE doDecimalPlaces (s: String; n: CARDINAL) : String ;
+BEGIN
+   RETURN concat (s, initString ())
+END doDecimalPlaces ;
+
+
+PROCEDURE IntegerToString (i: INTEGER) : String ;
+VAR
+   s: String ;
+BEGIN
+   s := initString () ;
+   RETURN s
+END IntegerToString ;
+
+
+END opaqueusestr.
diff --git a/gcc/testsuite/gm2/base-lang/pass/opaquevariant.def b/gcc/testsuite/gm2/base-lang/pass/opaquevariant.def
new file mode 100644 (file)
index 0000000..84f0bbd
--- /dev/null
@@ -0,0 +1,6 @@
+DEFINITION MODULE opaquevariant ;  (*!m2pim*)
+
+TYPE
+   Opaque ;
+
+END opaquevariant.
diff --git a/gcc/testsuite/gm2/base-lang/pass/opaquevariant.mod b/gcc/testsuite/gm2/base-lang/pass/opaquevariant.mod
new file mode 100644 (file)
index 0000000..3197a04
--- /dev/null
@@ -0,0 +1,26 @@
+IMPLEMENTATION MODULE opaquevariant ;  (*!m2pim*)
+
+TYPE
+   colour = (red, blue, green) ;
+   Opaque = POINTER TO RECORD
+                          CASE key: colour OF
+
+                          red  :  truefield : TrueRec |
+                          blue,
+                          green:  falsefield: FalseRec
+
+                          END
+                       END ;
+
+   TrueRec = RECORD
+                a: Opaque
+             END ;
+
+   FalseRec = RECORD
+                 b: Opaque
+              END ;
+
+VAR
+   v: Opaque ;
+
+END opaquevariant.
diff --git a/gcc/testsuite/gm2/base-lang/pass/opaquevarparam.def b/gcc/testsuite/gm2/base-lang/pass/opaquevarparam.def
new file mode 100644 (file)
index 0000000..3249da1
--- /dev/null
@@ -0,0 +1,9 @@
+DEFINITION MODULE opaquevarparam ;
+
+TYPE
+   Opaque ;
+
+PROCEDURE del (VAR o: Opaque) ;
+
+
+END opaquevarparam.
diff --git a/gcc/testsuite/gm2/base-lang/pass/opaquevarparam.mod b/gcc/testsuite/gm2/base-lang/pass/opaquevarparam.mod
new file mode 100644 (file)
index 0000000..90a34bd
--- /dev/null
@@ -0,0 +1,16 @@
+IMPLEMENTATION MODULE opaquevarparam ;
+
+TYPE
+   Opaque = POINTER TO RECORD
+                          next: Opaque ;
+                       END ;
+
+PROCEDURE del (VAR o: Opaque) ;
+BEGIN
+   IF o # NIL
+   THEN
+      del (o^.next)
+   END
+END del ;
+
+END opaquevarparam.
diff --git a/gcc/testsuite/gm2/base-lang/pass/simplelist.def b/gcc/testsuite/gm2/base-lang/pass/simplelist.def
new file mode 100644 (file)
index 0000000..f622175
--- /dev/null
@@ -0,0 +1,11 @@
+DEFINITION MODULE simplelist ;  (*!m2pim*)
+
+TYPE
+   List ;
+
+PROCEDURE initList () : List ;
+
+PROCEDURE concat (l: List) : List ;
+
+
+END simplelist.
diff --git a/gcc/testsuite/gm2/base-lang/pass/simplelist.mod b/gcc/testsuite/gm2/base-lang/pass/simplelist.mod
new file mode 100644 (file)
index 0000000..37b1e59
--- /dev/null
@@ -0,0 +1,33 @@
+IMPLEMENTATION MODULE simplelist ;  (*!m2pim*)
+
+
+TYPE
+   List = POINTER TO RECORD
+                        next: List ;
+                     END ;
+
+
+PROCEDURE initList () : List ;
+VAR
+   l: List ;
+BEGIN
+   (* Ignore NEW (l) for now.  *)
+   RETURN l
+END initList ;
+
+
+PROCEDURE concat (l: List) : List ;
+BEGIN
+   l^.next := initList () ;
+   RETURN l
+END concat ;
+
+
+PROCEDURE addList (l: List) : List ;
+BEGIN
+   l^.next := initList () ;
+   RETURN l
+END addList ;
+
+
+END simplelist.
diff --git a/gcc/testsuite/gm2/base-lang/pass/simplelistiter.def b/gcc/testsuite/gm2/base-lang/pass/simplelistiter.def
new file mode 100644 (file)
index 0000000..b2eae76
--- /dev/null
@@ -0,0 +1,10 @@
+DEFINITION MODULE simplelistiter ;  (*!m2pim*)
+
+TYPE
+   List ;
+
+PROCEDURE initList () : List ;
+
+PROCEDURE items (l: List) : CARDINAL ;
+
+END simplelistiter.
diff --git a/gcc/testsuite/gm2/base-lang/pass/simplelistiter.mod b/gcc/testsuite/gm2/base-lang/pass/simplelistiter.mod
new file mode 100644 (file)
index 0000000..10cacde
--- /dev/null
@@ -0,0 +1,30 @@
+IMPLEMENTATION MODULE simplelistiter ;  (*!m2pim*)
+
+TYPE
+   List = POINTER TO RECORD
+                        next: List ;
+                     END ;
+
+PROCEDURE initList () : List ;
+VAR
+   l: List ;
+BEGIN
+   RETURN l
+END initList ;
+
+
+PROCEDURE items (l: List) : CARDINAL ;
+(* VAR
+   count: CARDINAL ; *)
+BEGIN
+(*   count := 0 ; *)
+   WHILE l # NIL DO
+      (* INC (count) ; *)
+      l := l^.next
+   END ;
+   (* RETURN count *)
+   RETURN 0
+END items ;
+
+
+END simplelistiter.
diff --git a/gcc/testsuite/gm2/base-lang/pass/simpleopaque.def b/gcc/testsuite/gm2/base-lang/pass/simpleopaque.def
new file mode 100644 (file)
index 0000000..ca601aa
--- /dev/null
@@ -0,0 +1,13 @@
+DEFINITION MODULE simpleopaque ;  (*!m2pim*)
+
+TYPE
+   List ;
+
+PROCEDURE init () : List ;
+
+PROCEDURE join (left, right: List) : List ;
+
+PROCEDURE delete (VAR l: List) ;
+
+
+END simpleopaque.
diff --git a/gcc/testsuite/gm2/base-lang/pass/simpleopaque.mod b/gcc/testsuite/gm2/base-lang/pass/simpleopaque.mod
new file mode 100644 (file)
index 0000000..62d56c0
--- /dev/null
@@ -0,0 +1,32 @@
+IMPLEMENTATION MODULE simpleopaque ;  (*!m2pim*)
+
+TYPE
+   List = POINTER TO RECORD
+                        next: List ;
+                     END ;
+
+
+PROCEDURE init () : List ;
+VAR
+   l: List ;
+BEGIN
+   RETURN l
+END init ;
+
+
+PROCEDURE join (left, right: List) : List ;
+VAR
+   l: List ;
+BEGIN
+   l := left ;
+   RETURN l
+END join ;
+
+
+PROCEDURE delete (VAR l: List) ;
+BEGIN
+   l := NIL
+END delete ;
+
+
+END simpleopaque.
diff --git a/gcc/testsuite/gm2/base-lang/pass/straddress.def b/gcc/testsuite/gm2/base-lang/pass/straddress.def
new file mode 100644 (file)
index 0000000..24b243c
--- /dev/null
@@ -0,0 +1,5 @@
+DEFINITION MODULE straddress ;  (*!m2pim*)
+
+PROCEDURE Open (a: ARRAY OF CHAR) ;
+
+END straddress.
diff --git a/gcc/testsuite/gm2/base-lang/pass/straddress.mod b/gcc/testsuite/gm2/base-lang/pass/straddress.mod
new file mode 100644 (file)
index 0000000..78f90ba
--- /dev/null
@@ -0,0 +1,16 @@
+IMPLEMENTATION MODULE straddress ;  (*!m2pim*)
+
+FROM SYSTEM IMPORT ADDRESS, ADR ;
+
+
+PROCEDURE open (a: ADDRESS) ;
+BEGIN
+END open ;
+
+PROCEDURE Open (a: ARRAY OF CHAR) ;
+BEGIN
+   open (ADR (a))
+END Open ;
+
+
+END straddress.
diff --git a/gcc/testsuite/gm2/base-lang/pass/straddressexport.def b/gcc/testsuite/gm2/base-lang/pass/straddressexport.def
new file mode 100644 (file)
index 0000000..34618ec
--- /dev/null
@@ -0,0 +1,8 @@
+DEFINITION MODULE straddressexport ;  (*!m2pim*)
+
+FROM SYSTEM IMPORT ADDRESS ;
+
+PROCEDURE Open (a: ARRAY OF CHAR) ;
+PROCEDURE open (a: ADDRESS) ;
+
+END straddressexport.
diff --git a/gcc/testsuite/gm2/base-lang/pass/straddressexport.mod b/gcc/testsuite/gm2/base-lang/pass/straddressexport.mod
new file mode 100644 (file)
index 0000000..0f1cca9
--- /dev/null
@@ -0,0 +1,16 @@
+IMPLEMENTATION MODULE straddressexport ;  (*!m2pim*)
+
+FROM SYSTEM IMPORT ADR ;
+
+
+PROCEDURE open (a: ADDRESS) ;
+BEGIN
+END open ;
+
+PROCEDURE Open (a: ARRAY OF CHAR) ;
+BEGIN
+   open (ADR (a))
+END Open ;
+
+
+END straddressexport.
diff --git a/gcc/testsuite/gm2/base-lang/pass/unboundedarray.def b/gcc/testsuite/gm2/base-lang/pass/unboundedarray.def
new file mode 100644 (file)
index 0000000..52c0035
--- /dev/null
@@ -0,0 +1,5 @@
+DEFINITION MODULE unboundedarray ;
+
+PROCEDURE message (m: ARRAY OF CARDINAL) ;
+
+END unboundedarray.
diff --git a/gcc/testsuite/gm2/base-lang/pass/unboundedarray.mod b/gcc/testsuite/gm2/base-lang/pass/unboundedarray.mod
new file mode 100644 (file)
index 0000000..48f027e
--- /dev/null
@@ -0,0 +1,8 @@
+IMPLEMENTATION MODULE unboundedarray ;
+
+PROCEDURE message (m: ARRAY OF CARDINAL) ;
+BEGIN
+   m[0] := 1
+END message ;
+
+END unboundedarray.