This patch fixes all remaining -Wodr warnings in the modula-2 front end.
It removes the m2 Tree and m2 Location definitions and uses tree and
location_t throughout. This allows the bootstrap tool mc to pick up the
GCC definitions for these data types (for the C translation of m2 sources).
The patch introduces a new module CDataTypes which contain two pointer
types: CharStar and ConstCharStar. These map onto their C counterparts
when processed by mc however currently gm2 treats them as ADDRESS.
It might be sensible to have the gm2 versions of these data types
implemented though a builtin module in the future.
gcc/m2/ChangeLog:
PR modula2/116181
* Make-lang.in (GM2-GCC-DEFS): Add gcctypes.def and
CDataTypes.def.
(MC-LIB-DEFS): Add CDataTypes.def.
* Make-maintainer.in (m2/gm2-pge-boot/$(SRC_PREFIX)M2RTS.o):
Change include path to pge-boot.
(m2/gm2-pge-boot/$(SRC_PREFIX)SymbolKey.o): Ditto.
(m2/gm2-pge-boot/$(SRC_PREFIX)NameKey.o): Ditto.
(m2/gm2-pge-boot/$(SRC_PREFIX)Lists.o): Ditto.
(m2/gm2-pge-boot/$(SRC_PREFIX)Output.o): Ditto.
(m2/gm2-pge-boot/$(SRC_PREFIX)bnflex.o): Ditto.
(m2/gm2-pge-boot/$(SRC_PREFIX)RTentity.h): Ditto.
(m2/gm2-pge-boot/$(SRC_PREFIX)RTentity.o): Ditto.
(m2/gm2-pge-boot/$(SRC_PREFIX)%.o): Ditto.
(GM2PATH): Add -I$(srcdir)/m2/gm2-gcc.
(m2/mc-boot-gen/$(SRC_PREFIX)%.h): Add -I$(srcdir)/m2/gm2-gcc.
(m2/mc-boot-gen/$(SRC_PREFIX)%.cc): Ditto.
* gm2-compiler/M2ALU.def (PushIntegerTree): Replace Tree with tree.
(PopIntegerTree): Ditto.
(PushRealTree): Ditto.
(PopRealTree): Ditto.
(PushComplexTree): Ditto.
(PopComplexTree): Ditto.
(PushSetTree): Ditto.
(PopSetTree): Ditto.
(PopConstructorTree): Ditto.
(ConstructSetConstant): Ditto.
(BuildRange): Ditto.
(CheckOrResetOverflow): Ditto.
(PushTypeOfTree): Ditto.
* gm2-compiler/M2ALU.mod (Tree): Replace with ...
(tree): ... this.
(gcctypes): Import location_t and tree.
(m2linemap): Remove import of location_t.
* gm2-compiler/M2Base.def (m2linemap): Replace with ...
(gcctypes): ... this.
* gm2-compiler/M2Base.mod (gcctypes): Import of location_t.
(m2linemap): Remove import of location_t.
* gm2-compiler/M2Bitset.mod (m2tree): Remove import of Tree.
* gm2-compiler/M2CaseList.mod (gcctypes): Import tree.
(m2tree): Remove import of Tree.
(Tree): Replace with ...
(tree): ... this.
* gm2-compiler/M2Emit.def (gcctypes): Import location_t.
* gm2-compiler/M2GCCDeclare.def (gcctypes): Import tree.
(PromoteToString): Replace Tree with tree.
(PromoteToCString): Ditto.
(ConstantKnownAndUsed): Ditto.
* gm2-compiler/M2GCCDeclare.mod (gcctypes): Import tree.
(m2tree): Remove import of Tree.
(Tree): Replace with ...
(tree): ... this.
* gm2-compiler/M2GenGCC.def (gcctypes): Import tree.
(m2tree): Remove import of Tree.
(Tree): Replace with ...
(tree): ... this.
(GetHighFromUnbounded): Replace Tree with tree.
(StringToChar): Ditto.
(LValueToGenericPtr): Ditto.
(ZConstToTypedConst): Ditto.
(PrepareCopyString): Ditto.
* gm2-compiler/M2GenGCC.mod (gcctypes): Import tree.
(m2tree): Remove import of Tree.
(Tree): Replace with ...
(tree): ... this.
* gm2-compiler/M2LangDump.def (gcctypes): Import tree.
(m2tree): Remove import of Tree.
(Tree): Replace with ...
(tree): ... this.
* gm2-compiler/M2LangDump.mod (Tree): Replace with ...
(tree): ... this.
* gm2-compiler/M2LexBuf.def (m2linemap): Replace with ...
(gcctypes): ... this.
* gm2-compiler/M2LexBuf.mod (m2linemap): Replace with ...
(gcctypes): ... this.
* gm2-compiler/M2Options.def (m2linemap): Replace with ...
(gcctypes): ... this.
* gm2-compiler/M2Options.mod (m2linemap): Replace with ...
(gcctypes): ... this.
* gm2-compiler/M2Range.def (m2linemap): Replace with ...
(gcctypes): ... this.
(CDataTypes): Import ConstCharStar.
(CodeErrorCheck): Replace Tree with tree.
(OverlapsRange): Ditto.
(IsEqual): Ditto.
(IsGreaterOrEqual): Ditto.
(IsGreater): Ditto.
(BuildIfCallWholeHandlerLoc): Replace Tree with tree.
Replace ADDRESS with ConstCharStar.
(BuildIfCallRealHandlerLoc): Ditto.
(GetMinMax): Ditto.
* gm2-compiler/M2Range.mod (m2tree): Remove Tree.
(CodeErrorCheck): Replace Tree with tree.
(OverlapsRange): Ditto.
(IsEqual): Ditto.
(IsGreaterOrEqual): Ditto.
(IsGreater): Ditto.
(GetMinMax): Ditto.
(BuildIfCallWholeHandlerLoc): Replace Tree with tree.
Replace ADDRESS with ConstCharStar.
(BuildIfCallRealHandlerLoc): Ditto.
* gm2-compiler/M2System.def (m2linemap): Replace with ...
(gcctypes): ... this.
* gm2-compiler/M2System.mod (m2linemap): Replace with ...
(gcctypes): ... this.
(CreateMinMaxFor): Replace Tree with tree.
(CreateType): Ditto.
(AttemptToCreateType): Ditto.
(CreateSetType): Ditto.
(AttemptToCreateSetType): Ditto.
* gm2-compiler/P2SymBuild.mod (m2linemap): Replace with ...
(gcctypes): ... this.
* gm2-compiler/SymbolConversion.def (m2tree): Replace with ...
(gcctypes): ... this.
(Mod2Gcc): Replace Tree with tree.
(Gcc2Mod): Ditto.
(AddModGcc): Ditto.
* gm2-compiler/SymbolConversion.mod (m2tree): Replace with ...
(gcctypes): ... this.
(Mod2Gcc): Replace Tree with tree.
(Gcc2Mod): Ditto.
(AddModGcc): Ditto.
(Mod2GccWithoutGCCPoison): Ditto.
* gm2-compiler/SymbolTable.def (m2tree): Replace with ...
(gcctypes): ... this.
(PutModuleFinallyFunction): Replace Tree with tree.
(GetModuleFinallyFunction): Ditto.
* gm2-compiler/SymbolTable.mod (m2tree): Replace with ...
(gcctypes): ... this.
(PutModuleFinallyFunction): Replace Tree with tree.
(GetModuleFinallyFunction): Ditto.
* gm2-compiler/m2flex.def (m2linemap): Replace with ...
(gcctypes): ... this.
* gm2-gcc/init.def (PerCompilationInit): Replace ADDRESS with ConstCharStar.
(CDataTypes): Import ConstCharStar.
* gm2-gcc/m2block.def (SYSTEM): Remove import.
(CDataTypes): Import ConstCharStar.
(m2linemap): Remove import.
(m2tree): Remove import.
(gcctypes): Import tree.
(global_constant): Replace Tree with tree.
(RememberInitModuleFunction): Ditto.
(DumpGlobalConstants): Ditto.
(RememberConstant): Ditto.
(RememberType): Ditto.
(pushDecl): Ditto.
(popFunctionScope): Ditto.
(pushFunctionScope): Ditto.
(finishFunctionCode): Ditto.
(finishFunctionDecl): Ditto.
(GetErrorNode): Ditto.
(includeDecl): Ditto.
(GetGlobals): Ditto.
(GetGlobalContext): Ditto.
(begin_statement_list): Ditto.
(push_statement_list): Ditto.
(pop_statement_list): Ditto.
(getLabel): Replace Tree with tree.
Replace ADDRESS with ConstCharStar.
* gm2-gcc/m2builtins.def (CDataTypes): Import ConstCharStar.
(GetBuiltinConst): Replace Tree with tree.
(GetBuiltinConstType): Ditto.
(GetBuiltinTypeInfoType): Ditto.
(GetBuiltinTypeInfo): Ditto.
(BuiltinExists): Ditto.
(BuildBuiltinTree): Ditto.
(BuiltinMemCopy): Ditto.
(BuiltinMemSet): Ditto.
(BuiltInAlloca): Ditto.
(BuiltInIsfinite): Ditto.
* gm2-gcc/m2convert.def (CDataTypes): Import ConstCharStar.
(ToWord): Ditto.
(ToCardinal): Ditto.
(ToInteger): Ditto.
(ToBitset): Ditto.
(ConvertToPtr): Ditto.
(BuildConvert): Ditto.
(ConvertConstantAndCheck): Ditto.
(ConvertString): Ditto.
(GenericToType): Ditto.
* gm2-gcc/m2decl.cc (m2decl_BuildParameterDeclaration): Add
const attribute.
* gm2-gcc/m2decl.def (CDataTypes): Import ConstCharStar.
(BuildModuleCtor): Ditto.
(DeclareModuleCtor): Ditto.
(DeclareM2linkForcedModuleInitOrder): Ditto.
(DeclareM2linkStaticInitialization): Ditto.
(BuildPtrToTypeString): Ditto.
(BuildIntegerConstant): Ditto.
(BuildStringConstantType): Ditto.
(DeclareKnownVariable): Ditto.
(DeclareKnownConstant): Ditto.
(BuildParameterDeclaration): Ditto.
(BuildEndFunctionDeclaration): Ditto.
(RememberVariables): Ditto.
(BuildConstLiteralNumber): Ditto.
(BuildStringConstant): Ditto.
(BuildCStringConstant): Ditto.
(GetDeclContext): Ditto.
* gm2-gcc/m2decl.h (m2decl_BuildParameterDeclaration): Add
const attribute.
* gm2-gcc/m2except.def (CDataTypes): Import ConstCharStar.
(BuildThrow): Ditto.
(BuildTryBegin): Ditto.
(BuildTryEnd): Ditto.
(BuildCatchBegin): Ditto.
(BuildCatchEnd): Ditto.
* gm2-gcc/m2expr.def (CDataTypes): Import ConstCharStar.
(CSTIntToString): Ditto.
(CSTIntToChar): Ditto.
(CheckConstStrZtypeRange): Ditto.
(CompareTrees): Ditto.
(GetPointerOne): Ditto.
(GetPointerZero): Ditto.
(GetWordOne): Ditto.
(GetWordZero): Ditto.
(GetIntegerOne): Ditto.
(GetIntegerZero): Ditto.
(GetCardinalOne): Ditto.
(GetCardinalZero): Ditto.
(GetSizeOfInBits): Ditto.
(GetSizeOf): Ditto.
(BuildLogicalRotate): Ditto.
(BuildLRRn): Ditto.
(BuildLRLn): Ditto.
(BuildMask): Ditto.
(BuildMult): Ditto.
(BuildMultCheck): Ditto.
(BuildLRR): Ditto.
(BuildLRL): Ditto.
(BuildLogicalShift): Ditto.
(BuildLSR): Ditto.
(BuildLSL): Ditto.
(BuildDivM2): Ditto.
(BuildDivM2Check): Ditto.
(BuildModM2): Ditto.
(BuildModM2Check): Ditto.
(BuildModFloor): Ditto.
(BuildDivCeil): Ditto.
(BuildModCeil): Ditto.
(BuildDivFloor): Ditto.
(BuildModTrunc): Ditto.
(BuildDivTrunc): Ditto.
(BuildDivTruncCheck): Ditto.
(BuildRDiv): Ditto.
(BuildSubCheck): Ditto.
(BuildAddCheck): Ditto.
(BuildSub): Ditto.
(BuildAdd): Ditto.
(FoldAndStrip): Ditto.
(StringLength): Ditto.
(TreeOverflow): Ditto.
(RemoveOverflow): Ditto.
(BuildCoerce): Ditto.
(BuildTrunc): Ditto.
(BuildNegate): Ditto.
(BuildNegateCheck): Ditto.
(BuildSetNegate): Ditto.
(BuildTBitSize): Ditto.
(BuildSize): Ditto.
(BuildAddr): Ditto.
(BuildOffset1): Ditto.
(BuildOffset): Ditto.
(BuildLogicalOrAddress): Ditto.
(BuildLogicalOr): Ditto.
(BuildLogicalAnd): Ditto.
(BuildSymmetricDifference): Ditto.
(BuildLogicalDifference): Ditto.
(BuildLessThan): Ditto.
(BuildGreaterThan): Ditto.
(BuildLessThanOrEqual): Ditto.
(BuildGreaterThanOrEqual): Ditto.
(BuildEqualTo): Ditto.
(BuildNotEqualTo): Ditto.
(BuildIsSuperset): Ditto.
(BuildIsNotSuperset): Ditto.
(BuildIsSubset): Ditto.
(BuildIsNotSubset): Ditto.
(BuildIfConstInVar): Ditto.
(BuildIfNotConstInVar): Ditto.
(BuildIfVarInVar): Ditto.
(BuildIfNotVarInVar): Ditto.
(BuildForeachWordInSetDoIfExpr): Ditto.
(BuildIfInRangeGoto): Ditto.
(BuildIfNotInRangeGoto): Ditto.
(BuildArray): Ditto.
(BuildComponentRef): Ditto.
(BuildIndirect): Ditto.
(IsTrue): Ditto.
(IsFalse): Ditto.
(GetCstInteger): Ditto.
(AreConstantsEqual): Ditto.
(AreRealOrComplexConstantsEqual): Ditto.
(DetermineSign): Ditto.
(BuildCap): Ditto.
(BuildAbs): Ditto.
(BuildRe): Ditto.
(BuildIm): Ditto.
(BuildCmplx): Ditto.
(BuildBinaryForeachWordDo): Ditto.
(BuildBinarySetDo): Ditto.
(ConstantExpressionWarning): Ditto.
(BuildAddAddress): Ditto.
(calcNbits): Ditto.
(OverflowZType): Ditto.
(BuildCondIfExpression): Ditto.
* gm2-gcc/m2linemap.def (CDataTypes): Import ConstCharStar.
* gm2-gcc/m2misc.def (m2tree): Replace with ...
(gcctypes): ... this.
(DebugTree): Replace Tree with tree.
* gm2-gcc/m2pp.def (m2tree): Replace with ...
(gcctypes): ... this.
(DumpGimpleFd): Replace Tree with tree.
* gm2-gcc/m2statement.cc (m2statement_BuildBuiltinCallTree):
Remove unused location parameter.
* gm2-gcc/m2statement.def (m2linemap): Replace with ...
(gcctypes): ... this.
(CDataTypes): Import CharStar.
(DoJump): Replace Tree with tree.
Replace ADDRESS with CharStar.
(BuildStartFunctionCode): Replace Tree with tree.
(BuildEndFunctionCode): Ditto.
(BuildReturnValueCode): Ditto.
(BuildAssignmentTree): Ditto.
(BuildAssignmentStatement): Ditto.
(BuildGoto): Ditto.
(DeclareLabel): Ditto.
(BuildIfThenDoEnd): Ditto.
(BuildIfThenElseEnd): Ditto.
(BuildParam): Ditto.
(BuildFunctionCallTree): Ditto.
(BuildProcedureCallTree): Ditto.
(BuildIndirectProcedureCallTree): Ditto.
(BuildFunctValue): Ditto.
(BuildCall2): Ditto.
(BuildCall3): Ditto.
(SetLastFunction): Ditto.
(GetLastFunction): Ditto.
(GetParamTree): Ditto.
(BuildTryFinally): Ditto.
(BuildCleanUp): Ditto.
(BuildAsm): Ditto.
(BuildUnaryForeachWordDo): Ditto.
(BuildExcludeVarConst): Ditto.
(BuildExcludeVarVar): Ditto.
(BuildIncludeVarConst): Ditto.
(BuildIncludeVarVar): Ditto.
(BuildStart): Ditto.
(BuildEnd): Ditto.
(BuildCallInner): Ditto.
(BuildBuiltinCallTree): Remove unused location parameter.
* gm2-gcc/m2statement.h (m2statement_BuildBuiltinCallTree): Remove
unused location parameter.
* gm2-gcc/m2tree.def (gcctypes): Import tree.
(IsAConstant): Replace Tree with tree.
(IsOrdinal): Ditto.
(IsTreeOverflow): Ditto.
(skip_const_decl): Ditto.
(skip_type_decl): Ditto.
(is_type): Ditto.
(is_array): Ditto.
(is_var): Ditto.
(debug_tree): Ditto.
(IstreeOverflow): Ditto.
* gm2-gcc/m2treelib.def (m2linemap): Replace with ...
(gcctypes): ... this.
(get_set_address_if_var): Ditto.
(get_set_field_rhs): Ditto.
(get_set_field_lhs): Ditto.
(get_set_address): Ditto.
(get_set_value): Ditto.
(get_field_no): Ditto.
(get_rvalue): Ditto.
(DoCall): Ditto.
(build_modify_expr): Ditto.
(do_jump_if_bit): Ditto.
* gm2-gcc/m2type.def (m2linemap): Replace with ...
(gcctypes): ... this.
(m2tree): Remove.
(CDataTypes): Import ConstCharStar and charStar.
(ValueInTypeRange): Replace Tree with tree.
(ValueOutOfTypeRange): Ditto.
(ExceedsTypeRange): Ditto.
(WithinTypeRange): Ditto.
(BuildSubrangeType): Ditto.
(BuildCharConstant): Ditto.
(BuildCharConstantChar): Ditto.
(BuildArrayConstructorElement): Ditto.
(BuildEndArrayConstructor): Ditto.
(BuildStartArrayConstructor): Ditto.
(BuildRecordConstructorElement): Ditto.
(BuildEndRecordConstructor): Ditto.
(BuildStartRecordConstructor): Ditto.
(BuildEndSetConstructor): Ditto.
(BuildSetConstructorElement): Ditto.
(BuildStartSetConstructor): Ditto.
(BuildSetType): Ditto.
(BuildConstPointerType): Ditto.
(BuildPointerType): Ditto.
(BuildEnumerator): Ditto.
(BuildEndEnumeration): Ditto.
(BuildStartEnumeration): Ditto.
(BuildTypeDeclaration): Ditto.
(GetMaxFrom): Ditto.
(GetMinFrom): Ditto.
(GetDefaultType): Ditto.
(BuildEndType): Ditto.
(BuildStartType): Ditto.
(BuildVariableArrayAndDeclare): Ditto.
(BuildProcTypeParameterDeclaration): Ditto.
(BuildStartFunctionType): Ditto.
(BuildEndFunctionType): Ditto.
(GetTreeType): Ditto.
(DeclareKnownType): Ditto.
(GetM2ZType): Ditto.
(GetM2RType): Ditto.
(BuildSetTypeFromSubrange): Ditto.
(BuildSmallestTypeRange): Ditto.
(GetBooleanType): Ditto.
(GetBooleanFalse): Ditto.
(GetBooleanTrue): Ditto.
(GetPackedBooleanType): Ditto.
(GetCharType): Ditto.
(GetByteType): Ditto.
(GetVoidType): Ditto.
(GetBitnumType): Ditto.
(GetRealType): Ditto.
(GetLongRealType): Ditto.
(GetShortRealType): Ditto.
(GetLongIntType): Ditto.
(GetPointerType): Ditto.
(GetCardinalType): Ditto.
(GetIntegerType): Ditto.
(GetWordType): Ditto.
(GetM2CardinalType): Ditto.
(GetBitsetType): Ditto.
(GetM2CType): Ditto.
(GetProcType): Ditto.
(GetM2ComplexType): Ditto.
(GetM2LongComplexType): Ditto.
(GetM2ShortComplexType): Ditto.
(GetM2Complex128): Ditto.
(GetM2Complex96): Ditto.
(GetM2Complex64): Ditto.
(GetM2Complex32): Ditto.
(GetM2Real128): Ditto.
(GetM2Real96): Ditto.
(GetM2Real64): Ditto.
(GetM2Real32): Ditto.
(GetM2Bitset32): Ditto.
(GetM2Bitset16): Ditto.
(GetM2Bitset8): Ditto.
(GetM2Word64): Ditto.
(GetM2Word32): Ditto.
(GetM2Word16): Ditto.
(GetM2Cardinal64): Ditto.
(GetM2Cardinal32): Ditto.
(GetM2Cardinal16): Ditto.
(GetM2Cardinal8): Ditto.
(GetM2Integer64): Ditto.
(GetM2Integer32): Ditto.
(GetM2Integer16): Ditto.
(GetM2Integer8): Ditto.
(GetISOLocType): Ditto.
(GetISOByteType): Ditto.
(GetISOWordType): Ditto.
(GetShortCardType): Ditto.
(GetM2ShortCardType): Ditto.
(GetShortIntType): Ditto.
(GetM2ShortIntType): Ditto.
(GetM2LongCardType): Ditto.
(GetM2LongIntType): Ditto.
(GetM2LongRealType): Ditto.
(GetM2RealType): Ditto.
(GetM2ShortRealType): Ditto.
(GetM2IntegerType): Ditto.
(GetM2CharType): Ditto.
(GetCSizeTType): Ditto.
(GetCSSizeTType): Ditto.
(BuildArrayStringConstructor): Ditto.
(RealToTree): Ditto.
(BuildStartRecord): Ditto.
(BuildStartUnion): Ditto.
(BuildStartVarient): Ditto.
(BuildEndVarient): Ditto.
(BuildStartFieldVarient): Ditto.
(BuildEndFieldVarient): Ditto.
(BuildStartFieldRecord): Ditto.
(BuildFieldRecord): Ditto.
(ChainOn): Ditto.
(ChainOnParamValue): Ditto.
(AddStringToTreeList): Ditto.
(BuildEndRecord): Ditto.
(SetAlignment): Ditto.
(SetDeclPacked): Ditto.
(SetTypePacked): Ditto.
(SetRecordFieldOffset): Ditto.
(BuildPackedFieldRecord): Ditto.
(BuildNumberOfArrayElements): Ditto.
(AddStatement): Ditto.
(MarkFunctionReferenced): Ditto.
(BuildArrayIndexType): Ditto.
(GetArrayNoOfElements): Ditto.
(BuildEndArrayType): Ditto.
(PutArrayType): Ditto.
(BuildStartArrayType): Ditto.
(IsAddress): Ditto.
(SameRealType): Ditto.
* m2.flex (Gm2linemap.h): Include.
* mc-boot/GDynamicStrings.cc: Rebuild.
* mc-boot/GFIO.cc: Ditto.
* mc-boot/GIndexing.cc: Ditto.
* mc-boot/GM2Dependent.cc: Ditto.
* mc-boot/GSArgs.cc: Ditto.
* mc-boot/GStringConvert.cc: Ditto.
* mc-boot/Gdecl.cc: Ditto.
* mc-boot/Gdecl.h: Ditto.
* mc-boot/Gdtoa.h: Ditto.
* mc-boot/Gkeyc.cc: Ditto.
* mc-boot/Gkeyc.h: Ditto.
* mc-boot/Glibc.h: Ditto.
* mc-boot/GmcComp.cc: Ditto.
* mc-boot/GmcLexBuf.cc: Ditto.
* mc-boot/GmcPreprocess.cc: Ditto.
* mc-boot/GmcStream.cc: Ditto.
* mc-boot/Gmcp1.cc: Ditto.
* mc-boot/Gmcp3.cc: Ditto.
* mc-boot/Gmcp4.cc: Ditto.
* mc-boot/Gmcp5.cc: Ditto.
* mc-boot/GnameKey.cc: Ditto.
* mc-boot/Gvarargs.cc: Ditto.
* mc/decl.def (putDefUnqualified): New procedure function.
(isDefUnqualified): Ditto.
* mc/decl.mod (defT): Add unqualified field.
(charStarN): New variable.
(constCharStarN): Ditto.
(checkGccType): New procedure.
(checkCDataTypes): Ditto.
(import): Call checkGccType and checkCDataTypes.
(putDefUnqualified): New procedure function.
(isDefUnqualified): Ditto.
* mc/keyc.def (useGccTree): New procedure.
(useGccLocation): Ditto.
* mc/keyc.mod (checkGccConfigSystem): Call checkGccConfigSystem.
(useGccTree): New procedure.
(useGccLocation): Ditto.
* mc/mcp1.bnf (decl): Import putDefUnqualified.
(Export): Call putDefUnqualified.
* gm2-gcc/CDataTypes.def: New file.
* gm2-gcc/gcctypes.def: New file.
Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
# The interface between the modula-2 front end and gimple/trees found in directory gm2-gcc.
GM2-GCC-DEFS = \
+ gcctypes.def \
m2block.def \
m2builtins.def \
m2color.def \
m2tree.def \
m2treelib.def \
m2type.def \
+ CDataTypes.def \
# The following lists define the source files used to build gm2 using Modula-2
# sources directly.
Break.def \
COROUTINES.def \
CmdArgs.def \
+ CDataTypes.def \
Debug.def \
DynamicStrings.def \
Environment.def \
$(MC) -o=$@ $(srcdir)/m2/gm2-compiler/$*.def
m2/gm2-compiler-boot/m2flex.o: m2/gm2-compiler/m2flex.c $(BUILD-BOOT-H) $(TIMEVAR_H) \
- $(BUILD-LIBS-BOOT-H) m2/gm2-compiler-boot/$(SRC_PREFIX)NameKey.h \
+ $(BUILD-LIBS-BOOT-H) m2/gm2-compiler-boot/$(SRC_PREFIX)NameKey.h \
$(CONFIG_H) m2/gm2config.h $(TARGET_H) $(PLUGIN_HEADERS)
-test -d $(@D)/$(DEPDIR) || $(mkinstalldirs) $(@D)/$(DEPDIR)
$(COMPILER) $(CM2DEP) -c -g $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
m2/gm2-pge-boot/$(SRC_PREFIX)M2RTS.o: $(srcdir)/m2/gm2-libs/M2RTS.mod $(MCDEPS) $(BUILD-BOOT-PGE-H)
-test -d m2/gm2-pge-boot || $(mkinstalldirs) m2/gm2-pge-boot
$(MCC) --suppress-noreturn -o=m2/gm2-pge-boot/$(SRC_PREFIX)M2RTS.cc $(srcdir)/m2/gm2-libs/M2RTS.mod
- $(CXX) -I. -I$(srcdir)/../include -I$(srcdir) -I$(srcdir)/m2/gm2-pge-boot -I$(srcdir)/m2/mc-boot \
+ $(CXX) -I. -I$(srcdir)/../include -I$(srcdir) -I$(srcdir)/m2/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)M2RTS.cc -o $@
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 \
+ $(CXX) -I. -I$(srcdir)/../include -I$(srcdir) -I$(srcdir)/m2/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
-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 \
+ $(CXX) -I. -I$(srcdir)/../include -I$(srcdir) -I$(srcdir)/m2/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
-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 \
+ $(CXX) -I. -I$(srcdir)/../include -I$(srcdir) -I$(srcdir)/m2/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
-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 \
+ $(CXX) -I. -I$(srcdir)/../include -I$(srcdir) -I$(srcdir)/m2/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
-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 \
+ $(CXX) -I. -I$(srcdir)/../include -I$(srcdir) -I$(srcdir)/m2/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.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 \
+ $(CXX) -I. -I$(srcdir)/../include -I$(srcdir) -I$(srcdir)/m2/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.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 \
+ $(CXX) -I. -I$(srcdir)/../include -I$(srcdir) -I$(srcdir)/m2/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
- $(CXX) -I. -I$(srcdir)/../include -I$(srcdir) -I$(srcdir)/m2/gm2-pge-boot -I$(srcdir)/m2/mc-boot \
+ $(CXX) -I. -I$(srcdir)/../include -I$(srcdir) -I$(srcdir)/m2/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)$*.cc -o $@
GM2PATH=-I$(srcdir)/m2/mc \
-I$(srcdir)/m2 -Im2/gm2-auto \
+ -I$(srcdir)/m2/gm2-gcc \
-fm2-pathname=m2pim -I$(srcdir)/m2/gm2-libs -I$(srcdir)/m2/gm2-libs-ch \
-fm2-pathname=m2iso -I$(srcdir)/m2/gm2-libs-iso -fm2-pathname=-
m2/mc-boot-gen/$(SRC_PREFIX)%.h: $(srcdir)/m2/mc/%.def
-test -d m2/mc-boot-gen || $(mkinstalldirs) m2/mc-boot-gen
- ./mc $(MC_OPTIONS) -I$(srcdir)/m2/mc -I$(srcdir)/m2/gm2-libs -I$(srcdir)/m2/gm2-libs-iso $(EXTENDED_OPAQUE) --h-file-prefix=$(SRC_PREFIX) -o=$@ $<
+ ./mc $(MC_OPTIONS) -I$(srcdir)/m2/mc -I$(srcdir)/m2/gm2-libs -I$(srcdir)/m2/gm2-libs-iso -I$(srcdir)/m2/gm2-gcc $(EXTENDED_OPAQUE) --h-file-prefix=$(SRC_PREFIX) -o=$@ $<
m2/mc-boot-gen/$(SRC_PREFIX)%.h: $(srcdir)/m2/gm2-libs-iso/%.def
-test -d m2/mc-boot-gen || $(mkinstalldirs) m2/mc-boot-gen
- ./mc $(MC_OPTIONS) -I$(srcdir)/m2/mc -I$(srcdir)/m2/gm2-libs -I$(srcdir)/m2/gm2-libs-iso $(EXTENDED_OPAQUE) --h-file-prefix=$(SRC_PREFIX) -o=$@ $<
+ ./mc $(MC_OPTIONS) -I$(srcdir)/m2/mc -I$(srcdir)/m2/gm2-libs -I$(srcdir)/m2/gm2-libs-iso -I$(srcdir)/m2/gm2-gcc $(EXTENDED_OPAQUE) --h-file-prefix=$(SRC_PREFIX) -o=$@ $<
m2/mc-boot-gen/$(SRC_PREFIX)%.h: $(srcdir)/m2/gm2-libs/%.def
-test -d m2/mc-boot-gen || $(mkinstalldirs) m2/mc-boot-gen
- ./mc $(MC_OPTIONS) -I$(srcdir)/m2/mc -I$(srcdir)/m2/gm2-libs -I$(srcdir)/m2/gm2-libs-iso $(EXTENDED_OPAQUE) --h-file-prefix=$(SRC_PREFIX) -o=$@ $<
+ ./mc $(MC_OPTIONS) -I$(srcdir)/m2/mc -I$(srcdir)/m2/gm2-libs -I$(srcdir)/m2/gm2-libs-iso -I$(srcdir)/m2/gm2-gcc $(EXTENDED_OPAQUE) --h-file-prefix=$(SRC_PREFIX) -o=$@ $<
+
+m2/mc-boot-gen/$(SRC_PREFIX)%.h: $(srcdir)/m2/gm2-gcc/%.def
+ -test -d m2/mc-boot-gen || $(mkinstalldirs) m2/mc-boot-gen
+ ./mc $(MC_OPTIONS) -I$(srcdir)/m2/mc -I$(srcdir)/m2/gm2-libs -I$(srcdir)/m2/gm2-libs-iso -I$(srcdir)/m2/gm2-gcc $(EXTENDED_OPAQUE) --h-file-prefix=$(SRC_PREFIX) -o=$@ $<
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 -I$(srcdir)/m2/gm2-gcc --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
- ./mc $(MC_OPTIONS) -I$(srcdir)/m2/mc -I$(srcdir)/m2/gm2-libs -I$(srcdir)/m2/gm2-libs-iso $(EXTENDED_OPAQUE) --h-file-prefix=$(SRC_PREFIX) -o=$@ $<
+ ./mc $(MC_OPTIONS) -I$(srcdir)/m2/mc -I$(srcdir)/m2/gm2-libs -I$(srcdir)/m2/gm2-libs-iso -I$(srcdir)/m2/gm2-gcc $(EXTENDED_OPAQUE) --h-file-prefix=$(SRC_PREFIX) -o=$@ $<
m2/mc-boot-gen/$(SRC_PREFIX)%.cc: $(srcdir)/m2/gm2-libs/%.mod
-test -d m2/mc-boot-gen || $(mkinstalldirs) m2/mc-boot-gen
- ./mc $(MC_OPTIONS) -I$(srcdir)/m2/mc -I$(srcdir)/m2/gm2-libs -I$(srcdir)/m2/gm2-libs-iso $(EXTENDED_OPAQUE) --h-file-prefix=$(SRC_PREFIX) -o=$@ $<
+ ./mc $(MC_OPTIONS) -I$(srcdir)/m2/mc -I$(srcdir)/m2/gm2-libs -I$(srcdir)/m2/gm2-libs-iso -I$(srcdir)/m2/gm2-gcc $(EXTENDED_OPAQUE) --h-file-prefix=$(SRC_PREFIX) -o=$@ $<
m2/mc-boot-gen/$(SRC_PREFIX)%.cc: $(srcdir)/m2/gm2-libs-iso/%.mod
-test -d m2/mc-boot-gen || $(mkinstalldirs) m2/mc-boot-gen
- ./mc $(MC_OPTIONS) -I$(srcdir)/m2/mc -I$(srcdir)/m2/gm2-libs -I$(srcdir)/m2/gm2-libs-iso $(EXTENDED_OPAQUE) --h-file-prefix=$(SRC_PREFIX) -o=$@ $<
+ ./mc $(MC_OPTIONS) -I$(srcdir)/m2/mc -I$(srcdir)/m2/gm2-libs -I$(srcdir)/m2/gm2-libs-iso -I$(srcdir)/m2/gm2-gcc $(EXTENDED_OPAQUE) --h-file-prefix=$(SRC_PREFIX) -o=$@ $<
m2/mc-boot-gen/$(SRC_PREFIX)%.h: $(srcdir)/m2/gm2-libs-iso/%.def
-test -d m2/mc-boot-gen || $(mkinstalldirs) m2/mc-boot-gen
- ./mc $(MC_OPTIONS) -I$(srcdir)/m2/mc -I$(srcdir)/m2/gm2-libs -I$(srcdir)/m2/gm2-libs-iso $(EXTENDED_OPAQUE) --h-file-prefix=$(SRC_PREFIX) -o=$@ $<
+ ./mc $(MC_OPTIONS) -I$(srcdir)/m2/mc -I$(srcdir)/m2/gm2-libs -I$(srcdir)/m2/gm2-libs-iso -I$(srcdir)/m2/gm2-gcc $(EXTENDED_OPAQUE) --h-file-prefix=$(SRC_PREFIX) -o=$@ $<
m2/mc-boot-gen/$(SRC_PREFIX)%.cc: m2/mc-obj/%.mod
-test -d m2/mc-boot-gen || $(mkinstalldirs) m2/mc-boot-gen
- ./mc $(MC_OPTIONS) -I$(srcdir)/m2/mc -I$(srcdir)/m2/gm2-libs -I$(srcdir)/m2/gm2-libs-iso $(EXTENDED_OPAQUE) --h-file-prefix=$(SRC_PREFIX) -o=$@ $<
+ ./mc $(MC_OPTIONS) -I$(srcdir)/m2/mc -I$(srcdir)/m2/gm2-libs -I$(srcdir)/m2/gm2-libs-iso -I$(srcdir)/m2/gm2-gcc $(EXTENDED_OPAQUE) --h-file-prefix=$(SRC_PREFIX) -o=$@ $<
# mc-bootstrap compiles mc using the C version previously generated by mc-autogen.
# These autogenerated files will be checked into git by the maintainer.
*)
FROM NameKey IMPORT Name ;
-FROM m2tree IMPORT Tree ;
FROM M2GCCDeclare IMPORT WalkAction, IsAction ;
+FROM gcctypes IMPORT tree ;
EXPORT QUALIFIED PtrToValue,
InitValue,
PushIntegerTree - pushes a gcc tree value onto the ALU stack.
*)
-PROCEDURE PushIntegerTree (t: Tree) ;
+PROCEDURE PushIntegerTree (t: tree) ;
(*
PopIntegerTree - pops a gcc tree value from the ALU stack.
*)
-PROCEDURE PopIntegerTree () : Tree ;
+PROCEDURE PopIntegerTree () : tree ;
(*
PushRealTree - pushes a gcc tree value onto the ALU stack.
*)
-PROCEDURE PushRealTree (t: Tree) ;
+PROCEDURE PushRealTree (t: tree) ;
(*
PopRealTree - pops a gcc tree value from the ALU stack.
*)
-PROCEDURE PopRealTree () : Tree ;
+PROCEDURE PopRealTree () : tree ;
(*
PushComplexTree - pushes a gcc tree value onto the ALU stack.
*)
-PROCEDURE PushComplexTree (t: Tree) ;
+PROCEDURE PushComplexTree (t: tree) ;
(*
PopComplexTree - pops a gcc tree value from the ALU stack.
*)
-PROCEDURE PopComplexTree () : Tree ;
+PROCEDURE PopComplexTree () : tree ;
(*
*)
PROCEDURE PushSetTree (tokenno: CARDINAL;
- t: Tree; sym: CARDINAL) ;
+ t: tree; sym: CARDINAL) ;
(*
PopSetTree - pops a gcc tree from the ALU stack.
*)
-PROCEDURE PopSetTree (tokenno: CARDINAL) : Tree ;
+PROCEDURE PopSetTree (tokenno: CARDINAL) : tree ;
(*
PopConstructorTree - returns a tree containing the compound literal.
*)
-PROCEDURE PopConstructorTree (tokenno: CARDINAL) : Tree ;
+PROCEDURE PopConstructorTree (tokenno: CARDINAL) : tree ;
(*
set const, sym.
*)
-PROCEDURE ConstructSetConstant (tokenno: CARDINAL; v: PtrToValue) : Tree ;
+PROCEDURE ConstructSetConstant (tokenno: CARDINAL; v: PtrToValue) : tree ;
(*
value {e1..e2}.
*)
-PROCEDURE BuildRange (tokenno: CARDINAL; e1, e2: Tree) : Tree ;
+PROCEDURE BuildRange (tokenno: CARDINAL; e1, e2: tree) : tree ;
(*
error message.
*)
-PROCEDURE CheckOrResetOverflow (tokenno: CARDINAL; t: Tree; check: BOOLEAN) ;
+PROCEDURE CheckOrResetOverflow (tokenno: CARDINAL; t: tree; check: BOOLEAN) ;
(*
front end type.
*)
-PROCEDURE PushTypeOfTree (sym: CARDINAL; gcc: Tree) ;
+PROCEDURE PushTypeOfTree (sym: CARDINAL; gcc: tree) ;
END M2ALU.
*)
FROM ASCII IMPORT nul ;
-FROM SYSTEM IMPORT WORD ;
+FROM SYSTEM IMPORT WORD, ADDRESS ;
FROM NameKey IMPORT KeyToCharStar, MakeKey, CharKey ;
FROM M2Error IMPORT InternalError, FlushErrors ;
FROM M2Debug IMPORT Assert ;
IMPORT DynamicStrings ;
-FROM m2tree IMPORT Tree ;
-FROM m2linemap IMPORT location_t, UnknownLocation ;
+FROM gcctypes IMPORT location_t, tree ;
+FROM m2linemap IMPORT UnknownLocation ;
FROM m2expr IMPORT BuildAdd, BuildSub, BuildMult,
BuildDivTrunc, BuildModTrunc, BuildDivFloor, BuildModFloor,
solved : BOOLEAN ;
constructorType: CARDINAL ;
next : PtrToValue ;
- numberValue : Tree ;
+ numberValue : tree ;
CASE type: cellType OF
RangeFreeList : listOfRange ;
FreeList,
TopOfStack : PtrToValue ;
- EnumerationValue: Tree ;
+ EnumerationValue: tree ;
EnumerationField: CARDINAL ;
CurrentTokenNo : CARDINAL ;
(* WatchedValue : PtrToValue ; *)
PushIntegerTree - pushes a gcc tree value onto the ALU stack.
*)
-PROCEDURE PushIntegerTree (t: Tree) ;
+PROCEDURE PushIntegerTree (t: tree) ;
VAR
v: PtrToValue ;
BEGIN
PopIntegerTree - pops a gcc tree value from the ALU stack.
*)
-PROCEDURE PopIntegerTree () : Tree ;
+PROCEDURE PopIntegerTree () : tree ;
VAR
v: PtrToValue ;
- t: Tree ;
+ t: tree ;
BEGIN
v := Pop() ;
WITH v^ DO
PushRealTree - pushes a gcc tree value onto the ALU stack.
*)
-PROCEDURE PushRealTree (t: Tree) ;
+PROCEDURE PushRealTree (t: tree) ;
VAR
v: PtrToValue ;
BEGIN
PopRealTree - pops a gcc tree value from the ALU stack.
*)
-PROCEDURE PopRealTree () : Tree ;
+PROCEDURE PopRealTree () : tree ;
VAR
v: PtrToValue ;
- t: Tree ;
+ t: tree ;
BEGIN
v := Pop() ;
WITH v^ DO
PushComplexTree - pushes a gcc tree value onto the ALU stack.
*)
-PROCEDURE PushComplexTree (t: Tree) ;
+PROCEDURE PushComplexTree (t: tree) ;
VAR
v: PtrToValue ;
BEGIN
PopComplexTree - pops a gcc tree value from the ALU stack.
*)
-PROCEDURE PopComplexTree () : Tree ;
+PROCEDURE PopComplexTree () : tree ;
VAR
v: PtrToValue ;
- t: Tree ;
+ t: tree ;
BEGIN
v := Pop() ;
WITH v^ DO
*)
PROCEDURE PushSetTree (tokenno: CARDINAL;
- t: Tree; sym: CARDINAL) ;
+ t: tree; sym: CARDINAL) ;
VAR
v: PtrToValue ;
c,
PopSetTree - pops a gcc tree from the ALU stack.
*)
-PROCEDURE PopSetTree (tokenno: CARDINAL) : Tree ;
+PROCEDURE PopSetTree (tokenno: CARDINAL) : tree ;
VAR
v: PtrToValue ;
- t: Tree ;
+ t: tree ;
BEGIN
v := Pop() ;
WITH v^ DO
PopConstructorTree - returns a tree containing the compound literal.
*)
-PROCEDURE PopConstructorTree (tokenno: CARDINAL) : Tree ;
+PROCEDURE PopConstructorTree (tokenno: CARDINAL) : tree ;
VAR
v: PtrToValue ;
- t: Tree ;
+ t: tree ;
BEGIN
v := Pop() ;
WITH v^ DO
of type, type.
*)
-PROCEDURE Val (tokenno: CARDINAL; type: CARDINAL; value: Tree) : CARDINAL ;
+PROCEDURE Val (tokenno: CARDINAL; type: CARDINAL; value: tree) : CARDINAL ;
VAR
sym: CARDINAL ;
BEGIN
*)
PROCEDURE DupConstAndAdd (tokenno: CARDINAL;
- sym: CARDINAL; extra: Tree) : CARDINAL ;
+ sym: CARDINAL; extra: tree) : CARDINAL ;
BEGIN
PushValue(sym) ;
PushIntegerTree(extra) ;
*)
PROCEDURE DupConstAndAddMod (tokenno: CARDINAL;
- sym: CARDINAL; extra: Tree;
+ sym: CARDINAL; extra: tree;
l, h: CARDINAL) : CARDINAL ;
BEGIN
(* result := (((sym-l) + extra) MOD (h-l)) + l) *)
MinTree - returns the tree symbol which has the least value.
*)
-PROCEDURE MinTree (tokenno: CARDINAL; a, b: Tree) : Tree ;
+PROCEDURE MinTree (tokenno: CARDINAL; a, b: tree) : tree ;
BEGIN
PushIntegerTree(a) ;
ConvertToInt ;
MaxTree - returns the symbol which has the greatest value.
*)
-PROCEDURE MaxTree (tokenno: CARDINAL; a, b: Tree) : Tree ;
+PROCEDURE MaxTree (tokenno: CARDINAL; a, b: tree) : tree ;
BEGIN
PushIntegerTree(a) ;
ConvertToInt ;
IsIntersectionTree - returns TRUE if ranges, a..b, and, c..d, intersect.
*)
-PROCEDURE IsIntersectionTree (tokenno: CARDINAL; a, b, c, d: Tree) : BOOLEAN ;
+PROCEDURE IsIntersectionTree (tokenno: CARDINAL; a, b, c, d: tree) : BOOLEAN ;
BEGIN
(* easier to prove NOT outside limits *)
PushIntegerTree(a) ;
SubTree - returns the tree value containing (a-b)
*)
-PROCEDURE SubTree (a, b: Tree) : Tree ;
+PROCEDURE SubTree (a, b: tree) : tree ;
BEGIN
PushIntegerTree(a) ;
PushIntegerTree(b) ;
low and high are the limits of the subrange.
*)
-PROCEDURE BuildStructBitset (tokenno: CARDINAL; v: PtrToValue; low, high: Tree) : Tree ;
+PROCEDURE BuildStructBitset (tokenno: CARDINAL; v: PtrToValue; low, high: tree) : tree ;
VAR
- BitsInSet : Tree ;
+ BitsInSet : tree ;
bpw : CARDINAL ;
cons : Constructor ;
BEGIN
{ (cardinal), (cardinal) etc }
*)
-PROCEDURE ConstructLargeOrSmallSet (tokenno: CARDINAL; v: PtrToValue; low, high: CARDINAL) : Tree ;
+PROCEDURE ConstructLargeOrSmallSet (tokenno: CARDINAL; v: PtrToValue; low, high: CARDINAL) : tree ;
BEGIN
PushValue(high) ;
ConvertToInt ;
set const as defined by, v.
*)
-PROCEDURE ConstructSetConstant (tokenno: CARDINAL; v: PtrToValue) : Tree ;
+PROCEDURE ConstructSetConstant (tokenno: CARDINAL; v: PtrToValue) : tree ;
VAR
n1, n2 : Name ;
- gccsym : Tree ;
+ gccsym : tree ;
baseType,
high, low: CARDINAL ;
BEGIN
array constructor.
*)
-PROCEDURE ConvertConstToType (tokenno: CARDINAL; field: CARDINAL; init: CARDINAL) : Tree ;
+PROCEDURE ConvertConstToType (tokenno: CARDINAL; field: CARDINAL; init: CARDINAL) : tree ;
VAR
initT,
- nBytes: Tree ;
+ nBytes: tree ;
BEGIN
IF IsConstString(init) AND IsArray(SkipType(GetType(field))) AND
(SkipTypeAndSubrange(GetType(GetType(field)))=Char)
ConstructRecordConstant - builds a struct initializer, as defined by, v.
*)
-PROCEDURE ConstructRecordConstant (tokenno: CARDINAL; v: PtrToValue) : Tree ;
+PROCEDURE ConstructRecordConstant (tokenno: CARDINAL; v: PtrToValue) : tree ;
VAR
n1, n2 : Name ;
i,
PROCEDURE GetConstructorElement (tokenno: CARDINAL; v: PtrToValue; i: CARDINAL) : CARDINAL ;
VAR
- j: Tree ;
+ j: tree ;
e: listOfElements ;
BEGIN
WITH v^ DO
InitialiseArrayOfCharWithString -
*)
-PROCEDURE InitialiseArrayOfCharWithString (tokenno: CARDINAL; cons: Tree;
- el, baseType, arrayType: CARDINAL) : Tree ;
+PROCEDURE InitialiseArrayOfCharWithString (tokenno: CARDINAL; cons: ADDRESS;
+ el, baseType, arrayType: CARDINAL) : tree ;
VAR
isChar : BOOLEAN ;
s, letter: String ;
i, l : CARDINAL ;
high, low: CARDINAL ;
value,
- indice : Tree ;
+ indice : tree ;
location : location_t ;
BEGIN
location := TokenToLocation(tokenno) ;
CheckElementString -
*)
-PROCEDURE CheckElementString (el, arrayType: CARDINAL; tokenno: CARDINAL) : Tree ;
+PROCEDURE CheckElementString (el, arrayType: CARDINAL; tokenno: CARDINAL) : tree ;
VAR
- cons: Tree ;
+ cons: ADDRESS ;
BEGIN
IF IsString(arrayType) AND IsString(el)
THEN
InitialiseArrayWith -
*)
-PROCEDURE InitialiseArrayWith (tokenno: CARDINAL; cons: Tree;
- v: PtrToValue; el, high, low, arrayType: CARDINAL) : Tree ;
+PROCEDURE InitialiseArrayWith (tokenno: CARDINAL; cons: ADDRESS;
+ v: PtrToValue; el, high, low, arrayType: CARDINAL) : tree ;
VAR
location: location_t ;
i : CARDINAL ;
indice,
- value : Tree ;
+ value : tree ;
BEGIN
location := TokenToLocation (tokenno) ;
i := 0 ;
constDecl: PtrToValue;
consType: CARDINAL ;
arrayIndex: CARDINAL;
- VAR value: Tree) : BOOLEAN ;
+ VAR value: tree) : BOOLEAN ;
VAR
elementIndex: CARDINAL ;
element : CARDINAL ;
InitialiseArrayOfCharWith -
*)
-PROCEDURE InitialiseArrayOfCharWith (tokenno: CARDINAL; cons: Tree;
+PROCEDURE InitialiseArrayOfCharWith (tokenno: CARDINAL; cons: ADDRESS;
constDecl: PtrToValue;
- el, high, low, consType, arrayType: CARDINAL) : Tree ;
+ el, high, low, consType, arrayType: CARDINAL) : tree ;
VAR
location : location_t ;
arrayIndex: CARDINAL ; (* arrayIndex is the char position index of the final string. *)
indice,
- value : Tree ;
+ value : tree ;
BEGIN
location := TokenToLocation (tokenno) ;
arrayIndex := 0 ;
ConstructArrayConstant - builds a struct initializer, as defined by, v.
*)
-PROCEDURE ConstructArrayConstant (tokenno: CARDINAL; v: PtrToValue) : Tree ;
+PROCEDURE ConstructArrayConstant (tokenno: CARDINAL; v: PtrToValue) : tree ;
VAR
n1, n2 : Name ;
el1, el2,
baseType,
arrayType,
high, low : CARDINAL ;
- cons : Constructor ;
+ cons : ADDRESS ;
BEGIN
WITH v^ DO
IF constructorType=NulSym
value {e1..e2}.
*)
-PROCEDURE BuildRange (tokenno: CARDINAL; e1, e2: Tree) : Tree ;
+PROCEDURE BuildRange (tokenno: CARDINAL; e1, e2: tree) : tree ;
VAR
- c, i, t : Tree ;
+ c, i, t : tree ;
location: location_t ;
BEGIN
location := TokenToLocation(tokenno) ;
e1 := e2 ;
e2 := c
END ;
- t := Tree(NIL) ;
+ t := tree(NIL) ;
PushIntegerTree(e1) ;
i := PopIntegerTree() ;
REPEAT
- IF t=Tree(NIL)
+ IF t=tree(NIL)
THEN
t := BuildLSL(location, GetWordOne(location), ToWord(location, i), FALSE)
ELSE
*)
PROCEDURE BuildBitset (tokenno: CARDINAL;
- v: PtrToValue; low, high: Tree) : Tree ;
+ v: PtrToValue; low, high: tree) : tree ;
VAR
tl, th,
- t : Tree ;
+ t : tree ;
n : CARDINAL ;
r1, r2 : CARDINAL ;
location: location_t ;
error message.
*)
-PROCEDURE CheckOverflow (tokenno: CARDINAL; t: Tree) ;
+PROCEDURE CheckOverflow (tokenno: CARDINAL; t: tree) ;
BEGIN
IF TreeOverflow (t)
THEN
error message.
*)
-PROCEDURE CheckOrResetOverflow (tokenno: CARDINAL; t: Tree; check: BOOLEAN) ;
+PROCEDURE CheckOrResetOverflow (tokenno: CARDINAL; t: tree; check: BOOLEAN) ;
BEGIN
IF check
THEN
PushGCCArrayTree - pushes a gcc tree value onto the ALU stack.
*)
-PROCEDURE PushGCCArrayTree (gcc: Tree; t: CARDINAL) ;
+PROCEDURE PushGCCArrayTree (gcc: tree; t: CARDINAL) ;
VAR
v: PtrToValue ;
BEGIN
PushGCCSetTree - pushes a gcc tree value onto the ALU stack.
*)
-PROCEDURE PushGCCSetTree (gcc: Tree; t: CARDINAL) ;
+PROCEDURE PushGCCSetTree (gcc: tree; t: CARDINAL) ;
VAR
v: PtrToValue ;
BEGIN
PushGCCRecordTree - pushes a gcc tree value onto the ALU stack.
*)
-PROCEDURE PushGCCRecordTree (gcc: Tree; t: CARDINAL) ;
+PROCEDURE PushGCCRecordTree (gcc: tree; t: CARDINAL) ;
VAR
v: PtrToValue ;
BEGIN
front end type.
*)
-PROCEDURE PushTypeOfTree (sym: CARDINAL; gcc: Tree) ;
+PROCEDURE PushTypeOfTree (sym: CARDINAL; gcc: tree) ;
VAR
t: CARDINAL ;
BEGIN
*)
FROM NameKey IMPORT Name ;
-FROM m2linemap IMPORT location_t ;
+FROM gcctypes IMPORT location_t ;
EXPORT QUALIFIED Nil, (* Base constants *)
Cardinal, (* Base types *)
InitBaseTypes ;
FROM m2expr IMPORT GetSizeOf ;
-FROM m2linemap IMPORT location_t, BuiltinsLocation ;
+FROM gcctypes IMPORT location_t ;
+FROM m2linemap IMPORT BuiltinsLocation ;
FROM m2decl IMPORT BuildIntegerConstant ;
FROM M2Debug IMPORT Assert ;
-FROM m2tree IMPORT Tree ;
FROM m2linemap IMPORT BuiltinsLocation ;
FROM m2type IMPORT GetWordType ;
FROM m2decl IMPORT GetBitsPerBitset ;
FROM NameKey IMPORT KeyToCharStar ;
FROM SymbolConversion IMPORT GccKnowsAbout, Mod2Gcc, AddModGcc ;
FROM DynamicStrings IMPORT InitString, InitStringCharStar, InitStringChar, ConCat, Mark, KillString ;
-FROM m2tree IMPORT Tree ;
+FROM gcctypes IMPORT tree ;
FROM m2block IMPORT RememberType ;
FROM m2type IMPORT GetMinFrom ;
FROM m2expr IMPORT GetIntegerOne, CSTIntToString, CSTIntToChar ;
END ;
SetRange = POINTER TO RECORD
- low, high: Tree ;
+ low, high: tree ;
next : SetRange ;
END ;
SubBitRange - subtracts bits, lo..hi, from, set.
*)
-PROCEDURE SubBitRange (set: SetRange; lo, hi: Tree; tokenno: CARDINAL) : SetRange ;
+PROCEDURE SubBitRange (set: SetRange; lo, hi: tree; tokenno: CARDINAL) : SetRange ;
VAR
h, i: SetRange ;
BEGIN
PROCEDURE CheckLowHigh (rp: RangePair) ;
VAR
- lo, hi: Tree ;
+ lo, hi: tree ;
temp : CARDINAL ;
BEGIN
lo := Mod2Gcc (rp^.low) ;
IncludeElement - only include enumeration field into errorString if it lies between low..high.
*)
-PROCEDURE IncludeElement (enumList: List; field: CARDINAL; low, high: Tree) ;
+PROCEDURE IncludeElement (enumList: List; field: CARDINAL; low, high: tree) ;
VAR
- fieldTree: Tree ;
+ fieldTree: tree ;
BEGIN
IF field # NulSym
THEN
IncludeElements - only include enumeration field values low..high in errorString.
*)
-PROCEDURE IncludeElements (type: CARDINAL; enumList: List; low, high: Tree) ;
+PROCEDURE IncludeElements (type: CARDINAL; enumList: List; low, high: tree) ;
VAR
field : CARDINAL ;
i,
PROCEDURE ErrorRangeEnum (type: CARDINAL; set: SetRange; enumList: List) ;
VAR
- Low, High: Tree ;
+ Low, High: tree ;
BEGIN
Low := set^.low ;
High := set^.high ;
NoOfSetElements - return the number of set elements.
*)
-PROCEDURE NoOfSetElements (set: SetRange) : Tree ;
+PROCEDURE NoOfSetElements (set: SetRange) : tree ;
BEGIN
PushInt (0) ;
WHILE set # NIL DO
isPrintableChar - a cautious isprint.
*)
-PROCEDURE isPrintableChar (value: Tree) : BOOLEAN ;
+PROCEDURE isPrintableChar (value: tree) : BOOLEAN ;
BEGIN
CASE CSTIntToChar (value) OF
CHAR constants and will fall back to CHR (x) if necessary.
*)
-PROCEDURE appendTree (value: Tree; type: CARDINAL) ;
+PROCEDURE appendTree (value: tree; type: CARDINAL) ;
BEGIN
IF SkipType (GetType (type)) = Char
THEN
sr : SetRange ;
rangeNo : CARDINAL ;
nMissing,
- zero, one: Tree ;
+ zero, one: tree ;
BEGIN
nMissing := NoOfSetElements (set) ;
PushInt (0) ;
var
i, h: cardinal ;
r : RangePair ;
- a : Tree ;
+ a : tree ;
begin
with cl^ do
i := 1 ;
FROM DynamicStrings IMPORT String ;
-FROM m2linemap IMPORT location_t ;
+FROM gcctypes IMPORT location_t ;
(*
*)
FROM SYSTEM IMPORT WORD ;
-FROM m2tree IMPORT Tree ;
+FROM gcctypes IMPORT tree ;
FROM M2BasicBlock IMPORT BasicBlock ;
TYPE
return a string constant.
*)
-PROCEDURE PromoteToString (tokenno: CARDINAL; sym: CARDINAL) : Tree ;
+PROCEDURE PromoteToString (tokenno: CARDINAL; sym: CARDINAL) : tree ;
(*
return a string constant.
*)
-PROCEDURE PromoteToCString (tokenno: CARDINAL; sym: CARDINAL) : Tree ;
+PROCEDURE PromoteToCString (tokenno: CARDINAL; sym: CARDINAL) : tree ;
(*
ConstantKnownAndUsed -
*)
-PROCEDURE ConstantKnownAndUsed (sym: CARDINAL; t: Tree) ;
+PROCEDURE ConstantKnownAndUsed (sym: CARDINAL; t: tree) ;
(*
ChangeToConstructor, EvaluateValue, TryEvaluateValue ;
FROM M2Batch IMPORT IsSourceSeen, GetModuleFile, IsModuleSeen, LookupModule ;
-FROM m2tree IMPORT Tree ;
-FROM m2linemap IMPORT location_t, BuiltinsLocation ;
+FROM gcctypes IMPORT location_t, tree ;
+FROM m2linemap IMPORT BuiltinsLocation ;
FROM m2decl IMPORT BuildIntegerConstant, BuildStringConstant, BuildCStringConstant,
BuildStartFunctionDeclaration,
TYPE
- StartProcedure = PROCEDURE (location_t, ADDRESS) : Tree ;
+ StartProcedure = PROCEDURE (location_t, ADDRESS) : tree ;
ListType = (fullydeclared, partiallydeclared, niltypedarrays,
heldbyalignment, finishedalignment, todolist,
tobesolvedbyquads, finishedsetarray) ;
GetEnumList -
*)
-PROCEDURE GetEnumList (sym: CARDINAL) : Tree ;
+PROCEDURE GetEnumList (sym: CARDINAL) : tree ;
BEGIN
IF InBounds(EnumerationIndex, sym)
THEN
- RETURN( GetIndice(EnumerationIndex, sym) )
+ RETURN( tree (GetIndice(EnumerationIndex, sym)) )
ELSE
RETURN( NIL )
END
PutEnumList -
*)
-PROCEDURE PutEnumList (sym: CARDINAL; enumlist: Tree) ;
+PROCEDURE PutEnumList (sym: CARDINAL; enumlist: tree) ;
BEGIN
PutIndice(EnumerationIndex, sym, enumlist)
END PutEnumList ;
recursive types.
*)
-PROCEDURE DoStartDeclaration (sym: CARDINAL; p: StartProcedure) : Tree ;
+PROCEDURE DoStartDeclaration (sym: CARDINAL; p: StartProcedure) : tree ;
VAR
location: location_t ;
BEGIN
PROCEDURE DeclareTypeConstFully (sym: CARDINAL) ;
VAR
- t: Tree ;
+ t: tree ;
BEGIN
IF NOT IsElementInSet(GlobalGroup^.ToBeSolvedByQuads, sym)
THEN
PROCEDURE DeclareTypeFromPartial (sym: CARDINAL) ;
VAR
- t: Tree ;
+ t: tree ;
BEGIN
t := CompleteDeclarationOf(sym) ;
IF t=NIL
dependents.
*)
-PROCEDURE CompleteDeclarationOf (sym: CARDINAL) : Tree ;
+PROCEDURE CompleteDeclarationOf (sym: CARDINAL) : tree ;
BEGIN
IF IsArray(sym)
THEN
we must tell GCC about it.
*)
-PROCEDURE DeclareType (sym: CARDINAL) : Tree ;
+PROCEDURE DeclareType (sym: CARDINAL) : tree ;
VAR
- t : Tree ;
+ t : tree ;
location: location_t ;
BEGIN
IF GetSType(sym)=NulSym
ELSE
IF GetSymName(sym)=NulName
THEN
- RETURN( Tree(Mod2Gcc(GetSType(sym))) )
+ RETURN( tree(Mod2Gcc(GetSType(sym))) )
ELSE
location := TokenToLocation(GetDeclaredMod(sym)) ;
IF GccKnowsAbout(sym)
DeclareIntegerFromTree - declares an integer constant from a Tree, value.
*)
-PROCEDURE DeclareConstantFromTree (sym: CARDINAL; value: Tree) ;
+PROCEDURE DeclareConstantFromTree (sym: CARDINAL; value: tree) ;
BEGIN
PreAddModGcc(sym, value) ;
WatchRemoveList(sym, todolist) ;
PROCEDURE DeclareStringConstant (tokenno: CARDINAL; sym: CARDINAL) ;
VAR
- symtree : Tree ;
+ symtree : tree ;
BEGIN
Assert (IsConstStringKnown (sym)) ;
IF IsConstStringM2nul (sym) OR IsConstStringCnul (sym)
return a string constant.
*)
-PROCEDURE PromoteToString (tokenno: CARDINAL; sym: CARDINAL) : Tree ;
+PROCEDURE PromoteToString (tokenno: CARDINAL; sym: CARDINAL) : tree ;
VAR
size: CARDINAL ;
ch : CHAR ;
IF size > 1
THEN
(* It will be already be declared as a string, so return it. *)
- RETURN Tree (Mod2Gcc (sym))
+ RETURN tree (Mod2Gcc (sym))
ELSE
RETURN BuildStringConstant (KeyToCharStar (GetString (sym)),
GetStringLength (tokenno, sym))
return a string constant.
*)
-PROCEDURE PromoteToCString (tokenno: CARDINAL; sym: CARDINAL) : Tree ;
+PROCEDURE PromoteToCString (tokenno: CARDINAL; sym: CARDINAL) : tree ;
VAR
size: CARDINAL ;
ch : CHAR ;
PROCEDURE DeclareConstant (tokenno: CARDINAL; sym: CARDINAL) ;
VAR
type: CARDINAL ;
- t : Tree ;
+ t : tree ;
BEGIN
IF IsConst(sym)
THEN
DeclareConst - declares a const to gcc and returns a Tree.
*)
-PROCEDURE DeclareConst (tokenno: CARDINAL; sym: CARDINAL) : Tree ;
+PROCEDURE DeclareConst (tokenno: CARDINAL; sym: CARDINAL) : tree ;
VAR
type: CARDINAL ;
BEGIN
PROCEDURE DeclareProcedureToGccWholeProgram (Sym: CARDINAL) ;
VAR
returnType,
- GccParam : Tree ;
+ GccParam : tree ;
scope,
Son,
p, i : CARDINAL ;
PROCEDURE DeclareProcedureToGccSeparateProgram (Sym: CARDINAL) ;
VAR
returnType,
- GccParam : Tree ;
+ GccParam : tree ;
scope,
Son,
p, i : CARDINAL ;
PreAddModGcc - adds a relationship between sym and tree.
*)
-PROCEDURE PreAddModGcc (sym: CARDINAL; tree: Tree) ;
+PROCEDURE PreAddModGcc (sym: CARDINAL; tree: tree) ;
BEGIN
AddModGcc (sym, tree)
END PreAddModGcc ;
DeclareDefaultType - declares a default type, sym, with, name.
*)
-PROCEDURE DeclareDefaultType (sym: CARDINAL; name: ARRAY OF CHAR; gcctype: Tree) ;
+PROCEDURE DeclareDefaultType (sym: CARDINAL; name: ARRAY OF CHAR; gcctype: tree) ;
VAR
- t : Tree ;
+ t : tree ;
high, low: CARDINAL ;
location : location_t ;
BEGIN
(if the back end support such a type).
*)
-PROCEDURE DeclareFixedSizedType (name: ARRAY OF CHAR; type: CARDINAL; t: Tree) ;
+PROCEDURE DeclareFixedSizedType (name: ARRAY OF CHAR; type: CARDINAL; t: tree) ;
VAR
location : location_t ;
typetype,
a procedure will return the procedure Tree.
*)
-PROCEDURE FindContext (sym: CARDINAL) : Tree ;
+PROCEDURE FindContext (sym: CARDINAL) : tree ;
BEGIN
sym := GetProcedureScope(sym) ;
IF sym=NulSym
PROCEDURE DoVariableDeclaration (var: CARDINAL; name: ADDRESS;
isImported, isExported,
isTemporary, isGlobal: BOOLEAN;
- scope: Tree) ;
+ scope: tree) ;
VAR
- type : Tree ;
+ type : tree ;
varType : CARDINAL ;
location: location_t ;
BEGIN
PROCEDURE DeclareVariable (ModSym, variable: CARDINAL) ;
VAR
- scope: Tree ;
+ scope: tree ;
decl : CARDINAL ;
BEGIN
IF NOT GccKnowsAbout (variable)
PROCEDURE DeclareVariableWholeProgram (mainModule, variable: CARDINAL) ;
VAR
- scope: Tree ;
+ scope: tree ;
decl : CARDINAL ;
BEGIN
IF NOT GccKnowsAbout (variable)
PROCEDURE DeclareModuleVariables (sym: CARDINAL) ;
VAR
- scope : Tree ;
+ scope : tree ;
i, Var: CARDINAL ;
BEGIN
i := 1 ;
DeclareFieldValue -
*)
-PROCEDURE DeclareFieldValue (sym: CARDINAL; value: Tree; VAR list: Tree) : Tree ;
+PROCEDURE DeclareFieldValue (sym: CARDINAL; value: tree; VAR list: tree) : tree ;
VAR
location: location_t ;
BEGIN
DeclareFieldEnumeration - declares an enumerator within the current enumeration type.
*)
-PROCEDURE DeclareFieldEnumeration (sym: WORD) : Tree ;
+PROCEDURE DeclareFieldEnumeration (sym: WORD) : tree ;
VAR
type : CARDINAL ;
field,
- enumlist: Tree ;
+ enumlist: tree ;
BEGIN
(* add relationship between gccSym and sym *)
type := GetSType (sym) ;
DeclareEnumeration - declare an enumerated type.
*)
-PROCEDURE DeclareEnumeration (sym: WORD) : Tree ;
+PROCEDURE DeclareEnumeration (sym: WORD) : tree ;
VAR
enumlist,
- gccenum : Tree ;
+ gccenum : tree ;
location: location_t ;
BEGIN
location := TokenToLocation (GetDeclaredMod (sym)) ;
*)
PROCEDURE DeclareSubrangeNarrow (location: location_t;
- high, low: CARDINAL; type: Tree) : Tree ;
+ high, low: CARDINAL; type: tree) : tree ;
VAR
m2low, m2high,
lowtree,
- hightree : Tree ;
+ hightree : tree ;
BEGIN
(* No zero alignment, therefore the front end will prioritize subranges to match
unsigned int, int, or ZTYPE assuming the low..high range fits. *)
DeclareSubrange - declare a subrange type.
*)
-PROCEDURE DeclareSubrange (sym: CARDINAL) : Tree ;
+PROCEDURE DeclareSubrange (sym: CARDINAL) : tree ;
VAR
type,
- gccsym : Tree ;
+ gccsym : tree ;
align,
high, low: CARDINAL ;
location: location_t ;
CheckAlignment -
*)
-PROCEDURE CheckAlignment (type: Tree; sym: CARDINAL) : Tree ;
+PROCEDURE CheckAlignment (type: tree; sym: CARDINAL) : tree ;
VAR
align: CARDINAL ;
BEGIN
CheckPragma -
*)
-PROCEDURE CheckPragma (type: Tree; sym: CARDINAL) : Tree ;
+PROCEDURE CheckPragma (type: tree; sym: CARDINAL) : tree ;
BEGIN
IF IsDeclaredPacked (sym)
THEN
PROCEDURE DeclarePackedSubrange (equiv, sym: CARDINAL) ;
VAR
type,
- gccsym : Tree ;
+ gccsym : tree ;
high, low: CARDINAL ;
location : location_t ;
BEGIN
VAR
highLimit,
range,
- gccsym : Tree ;
+ gccsym : tree ;
type,
high, low: CARDINAL ;
location: location_t ;
equiv,
type : CARDINAL ;
field,
- enumlist: Tree ;
+ enumlist: tree ;
BEGIN
(* add relationship between gccSym and sym *)
type := GetSType (sym) ;
PROCEDURE DeclarePackedEnumeration (equiv, sym: CARDINAL) ;
VAR
enumlist,
- gccenum : Tree ;
+ gccenum : tree ;
location: location_t ;
BEGIN
location := TokenToLocation(GetDeclaredMod(sym)) ;
doDeclareEquivalent -
*)
-PROCEDURE doDeclareEquivalent (sym: CARDINAL; p: doDeclareProcedure) : Tree ;
+PROCEDURE doDeclareEquivalent (sym: CARDINAL; p: doDeclareProcedure) : tree ;
VAR
equiv: CARDINAL ;
BEGIN
PossiblyPacked -
*)
-PROCEDURE PossiblyPacked (sym: CARDINAL; isPacked: BOOLEAN) : Tree ;
+PROCEDURE PossiblyPacked (sym: CARDINAL; isPacked: BOOLEAN) : tree ;
BEGIN
IF isPacked
THEN
GetPackedType - returns a possibly packed type for field.
*)
-PROCEDURE GetPackedType (sym: CARDINAL) : Tree ;
+PROCEDURE GetPackedType (sym: CARDINAL) : tree ;
BEGIN
IF IsSubrange(sym)
THEN
the offsets if appropriate.
*)
-PROCEDURE MaybeAlignField (field: CARDINAL; VAR byteOffset, bitOffset: Tree) : Tree ;
+PROCEDURE MaybeAlignField (field: CARDINAL; VAR byteOffset, bitOffset: tree) : tree ;
VAR
f, ftype,
- nbits : Tree ;
+ nbits : tree ;
location: location_t ;
BEGIN
f := Mod2Gcc(field) ;
The final gcc record type is returned.
*)
-PROCEDURE DeclareRecord (Sym: CARDINAL) : Tree ;
+PROCEDURE DeclareRecord (Sym: CARDINAL) : tree ;
VAR
Field : CARDINAL ;
i : CARDINAL ;
byteOffset,
bitOffset,
FieldList,
- RecordType: Tree ;
+ RecordType: tree ;
location : location_t ;
BEGIN
i := 1 ;
- FieldList := Tree(NIL) ;
+ FieldList := tree(NIL) ;
RecordType := DoStartDeclaration(Sym, BuildStartRecord) ;
location := TokenToLocation(GetDeclaredMod(Sym)) ;
byteOffset := GetIntegerZero(location) ;
DeclareRecordField -
*)
-PROCEDURE DeclareRecordField (sym: CARDINAL) : Tree ;
+PROCEDURE DeclareRecordField (sym: CARDINAL) : tree ;
VAR
field,
- GccFieldType: Tree ;
+ GccFieldType: tree ;
location : location_t ;
BEGIN
location := TokenToLocation(GetDeclaredMod(sym)) ;
The final gcc record type is returned.
*)
-PROCEDURE DeclareVarient (sym: CARDINAL) : Tree ;
+PROCEDURE DeclareVarient (sym: CARDINAL) : tree ;
VAR
Field : CARDINAL ;
i : CARDINAL ;
byteOffset,
bitOffset,
FieldList,
- VarientType : Tree ;
+ VarientType : tree ;
location : location_t ;
BEGIN
i := 1 ;
- FieldList := Tree(NIL) ;
+ FieldList := tree(NIL) ;
VarientType := DoStartDeclaration(sym, BuildStartVarient) ;
location := TokenToLocation(GetDeclaredMod(sym)) ;
byteOffset := GetIntegerZero(location) ;
DeclareFieldVarient -
*)
-PROCEDURE DeclareFieldVarient (sym: CARDINAL) : Tree ;
+PROCEDURE DeclareFieldVarient (sym: CARDINAL) : tree ;
VAR
i, f : CARDINAL ;
VarientList,
VarientType,
byteOffset,
bitOffset,
- GccFieldType: Tree ;
+ GccFieldType: tree ;
location : location_t ;
BEGIN
location := TokenToLocation(GetDeclaredMod(sym)) ;
i := 1 ;
- VarientList := Tree(NIL) ;
+ VarientList := tree(NIL) ;
VarientType := DoStartDeclaration(sym, BuildStartFieldVarient) ;
(* no need to store the [sym, RecordType] tuple as it is stored by DeclareRecord which calls us *)
byteOffset := GetIntegerZero(location) ;
DeclarePointer - declares a pointer type to gcc and returns the Tree.
*)
-PROCEDURE DeclarePointer (sym: CARDINAL) : Tree ;
+PROCEDURE DeclarePointer (sym: CARDINAL) : tree ;
BEGIN
RETURN( BuildPointerType(Mod2Gcc(GetSType(sym))) )
END DeclarePointer ;
DeclareUnbounded - builds an unbounded type and returns the gcc tree.
*)
-PROCEDURE DeclareUnbounded (sym: CARDINAL) : Tree ;
+PROCEDURE DeclareUnbounded (sym: CARDINAL) : tree ;
VAR
record: CARDINAL ;
BEGIN
BuildIndex -
*)
-PROCEDURE BuildIndex (tokenno: CARDINAL; array: CARDINAL) : Tree ;
+PROCEDURE BuildIndex (tokenno: CARDINAL; array: CARDINAL) : tree ;
VAR
Subscript: CARDINAL ;
Type,
High, Low: CARDINAL ;
n,
- low, high: Tree ;
+ low, high: tree ;
location : location_t ;
BEGIN
location := TokenToLocation(tokenno) ;
DeclareArray - declares an array to gcc and returns the gcc tree.
*)
-PROCEDURE DeclareArray (Sym: CARDINAL) : Tree ;
+PROCEDURE DeclareArray (Sym: CARDINAL) : tree ;
VAR
typeOfArray: CARDINAL ;
ArrayType,
GccArray,
- GccIndex : Tree ;
+ GccIndex : tree ;
Subscript : CARDINAL ;
tokenno : CARDINAL ;
location : location_t ;
DeclareProcType - declares a procedure type to gcc and returns the gcc type tree.
*)
-PROCEDURE DeclareProcType (Sym: CARDINAL) : Tree ;
+PROCEDURE DeclareProcType (Sym: CARDINAL) : tree ;
VAR
i, p, Son,
ReturnType: CARDINAL ;
func,
- GccParam : Tree ;
+ GccParam : tree ;
location : location_t ;
BEGIN
ReturnType := GetSType(Sym) ;
low and high are the limits of the subrange.
*)
-PROCEDURE DeclareLargeSet (n: Name; type: CARDINAL; low, high: CARDINAL) : Tree ;
+PROCEDURE DeclareLargeSet (n: Name; type: CARDINAL; low, high: CARDINAL) : tree ;
VAR
lowtree,
hightree,
BitsInSet,
RecordType,
GccField,
- FieldList : Tree ;
+ FieldList : tree ;
bpw : CARDINAL ;
location : location_t ;
BEGIN
lowtree := PopIntegerTree() ;
PushValue(high) ;
hightree := PopIntegerTree() ;
- FieldList := Tree(NIL) ;
+ FieldList := tree(NIL) ;
RecordType := BuildStartRecord(location, KeyToCharStar(n)) ; (* no problem with recursive types here *)
PushNoOfBits(type, low, high) ;
PushCard(1) ;
*)
PROCEDURE DeclareLargeOrSmallSet (sym: CARDINAL;
- n: Name; type: CARDINAL; low, high: CARDINAL) : Tree ;
+ n: Name; type: CARDINAL; low, high: CARDINAL) : tree ;
VAR
location: location_t ;
packed : BOOLEAN ;
DeclareSet - declares a set type to gcc and returns a Tree.
*)
-PROCEDURE DeclareSet (sym: CARDINAL) : Tree ;
+PROCEDURE DeclareSet (sym: CARDINAL) : tree ;
VAR
- gccsym : Tree ;
+ gccsym : tree ;
type,
high, low: CARDINAL ;
BEGIN
return the GCC Tree equivalent.
*)
-PROCEDURE TypeConstFullyDeclared (sym: CARDINAL) : Tree ;
+PROCEDURE TypeConstFullyDeclared (sym: CARDINAL) : tree ;
VAR
- t: Tree ;
+ t: tree ;
BEGIN
IF IsEnumeration(sym)
THEN
ConstantKnownAndUsed -
*)
-PROCEDURE ConstantKnownAndUsed (sym: CARDINAL; t: Tree) ;
+PROCEDURE ConstantKnownAndUsed (sym: CARDINAL; t: tree) ;
BEGIN
DeclareConstantFromTree(sym, RememberConstant(t))
END ConstantKnownAndUsed ;
*)
FROM M2GCCDeclare IMPORT WalkAction ;
-FROM m2tree IMPORT Tree ;
-FROM m2linemap IMPORT location_t ;
+FROM gcctypes IMPORT location_t, tree ;
FROM M2BasicBlock IMPORT BasicBlock ;
param.HIGH.
*)
-PROCEDURE GetHighFromUnbounded (location: location_t; dim, param: CARDINAL) : Tree ;
+PROCEDURE GetHighFromUnbounded (location: location_t; dim, param: CARDINAL) : tree ;
(*
then convert the string into a character constant.
*)
-PROCEDURE StringToChar (t: Tree; type, str: CARDINAL) : Tree ;
+PROCEDURE StringToChar (t: tree; type, str: CARDINAL) : tree ;
(*
It coerces a lvalue into an internal pointer type
*)
-PROCEDURE LValueToGenericPtr (location: location_t; sym: CARDINAL) : Tree ;
+PROCEDURE LValueToGenericPtr (location: location_t; sym: CARDINAL) : tree ;
(*
coerces, t, appropriately.
*)
-PROCEDURE ZConstToTypedConst (t: Tree; op1, op2: CARDINAL) : Tree ;
+PROCEDURE ZConstToTypedConst (t: tree; op1, op2: CARDINAL) : tree ;
(*
which fits in dest.
*)
-PROCEDURE PrepareCopyString (tokenno: CARDINAL; VAR length, srcTree: Tree;
+PROCEDURE PrepareCopyString (tokenno: CARDINAL; VAR length, srcTree: tree;
src, destStrType: CARDINAL) : BOOLEAN ;
BuildAddAddress,
BuildIfInRangeGoto, BuildIfNotInRangeGoto ;
-FROM m2tree IMPORT Tree, debug_tree, skip_const_decl ;
-FROM m2linemap IMPORT location_t ;
+FROM m2tree IMPORT debug_tree, skip_const_decl ;
+FROM gcctypes IMPORT location_t, tree ;
FROM m2decl IMPORT BuildStringConstant, BuildCStringConstant,
DeclareKnownConstant, GetBitsPerBitset,
constant representing the storage size in bytes.
*)
-PROCEDURE FindSize (tokenno: CARDINAL; sym: CARDINAL) : Tree ;
+PROCEDURE FindSize (tokenno: CARDINAL; sym: CARDINAL) : tree ;
VAR
location: location_t ;
BEGIN
BuildTreeFromInterface - generates a GCC tree from an interface definition.
*)
-PROCEDURE BuildTreeFromInterface (sym: CARDINAL) : Tree ;
+PROCEDURE BuildTreeFromInterface (sym: CARDINAL) : tree ;
CONST
DebugTokPos = FALSE ;
VAR
str,
obj : CARDINAL ;
gccName,
- tree : Tree ;
+ asmTree : tree ;
BEGIN
- tree := Tree (NIL) ;
+ asmTree := tree (NIL) ;
IF sym#NulSym
THEN
i := 1 ;
ELSE
gccName := BuildCStringConstant (KeyToCharStar (name), LengthKey (name))
END ;
- tree := ChainOnParamValue (tree, gccName, PromoteToCString (tok, str),
- skip_const_decl (Mod2Gcc (obj))) ;
+ asmTree := ChainOnParamValue (asmTree, gccName, PromoteToCString (tok, str),
+ skip_const_decl (Mod2Gcc (obj))) ;
IF DebugTokPos
THEN
WarnStringAt (InitString ('input expression'), tok)
INC(i)
UNTIL (str = NulSym) AND (obj = NulSym) ;
END ;
- RETURN tree
+ RETURN asmTree
END BuildTreeFromInterface ;
BuildTrashTreeFromInterface - generates a GCC string tree from an interface definition.
*)
-PROCEDURE BuildTrashTreeFromInterface (sym: CARDINAL) : Tree ;
+PROCEDURE BuildTrashTreeFromInterface (sym: CARDINAL) : tree ;
CONST
DebugTokPos = FALSE ;
VAR
- tok : CARDINAL ;
- i : CARDINAL ;
+ tok : CARDINAL ;
+ i : CARDINAL ;
str,
- obj : CARDINAL ;
- name: Name ;
- tree: Tree ;
+ obj : CARDINAL ;
+ name : Name ;
+ asmTree: tree ;
BEGIN
- tree := Tree (NIL) ;
+ asmTree := tree (NIL) ;
IF sym # NulSym
THEN
i := 1 ;
THEN
IF IsConstString (str)
THEN
- tree := AddStringToTreeList (tree, PromoteToCString (tok, str)) ;
+ asmTree := AddStringToTreeList (asmTree, PromoteToCString (tok, str)) ;
IF DebugTokPos
THEN
WarnStringAt (InitString ('trash expression'), tok)
INC (i)
UNTIL (str = NulSym) AND (obj = NulSym)
END ;
- RETURN tree
+ RETURN asmTree
END BuildTrashTreeFromInterface ;
inputs,
outputs,
trash,
- labels : Tree ;
+ labels : tree ;
location : location_t ;
BEGIN
GetQuadOtok (quad, asmpos, op, op1, op2, GnuAsm,
PROCEDURE CodeSaveException (des, exceptionProcedure: CARDINAL) ;
VAR
- functValue: Tree ;
+ functValue: tree ;
location : location_t;
BEGIN
location := TokenToLocation (CurrentQuadToken) ;
PROCEDURE CodeRestoreException (des, exceptionProcedure: CARDINAL) ;
VAR
- functValue: Tree ;
+ functValue: tree ;
location : location_t;
BEGIN
location := TokenToLocation (CurrentQuadToken) ;
GetAddressOfUnbounded - returns the address of the unbounded array contents.
*)
-PROCEDURE GetAddressOfUnbounded (location: location_t; param: CARDINAL) : Tree ;
+PROCEDURE GetAddressOfUnbounded (location: location_t; param: CARDINAL) : tree ;
VAR
UnboundedType: CARDINAL ;
BEGIN
param.HIGH.
*)
-PROCEDURE GetHighFromUnbounded (location: location_t; dim, param: CARDINAL) : Tree ;
+PROCEDURE GetHighFromUnbounded (location: location_t; dim, param: CARDINAL) : tree ;
VAR
UnboundedType,
ArrayType,
HighField : CARDINAL ;
- HighTree : Tree ;
+ HighTree : tree ;
accessibleDim: CARDINAL ;
(* remainingDim : CARDINAL ; *)
BEGIN
occupies.
*)
-PROCEDURE GetSizeOfHighFromUnbounded (tokenno: CARDINAL; param: CARDINAL) : Tree ;
+PROCEDURE GetSizeOfHighFromUnbounded (tokenno: CARDINAL; param: CARDINAL) : tree ;
VAR
- t : Tree ;
+ t : tree ;
UnboundedType,
ArrayType : CARDINAL ;
i, n : CARDINAL ;
else call Builtins.alloca.
*)
-PROCEDURE MaybeDebugBuiltinAlloca (location: location_t; tok: CARDINAL; high: Tree) : Tree ;
+PROCEDURE MaybeDebugBuiltinAlloca (location: location_t; tok: CARDINAL; high: tree) : tree ;
VAR
call,
memptr,
- func : Tree ;
+ func : tree ;
BEGIN
IF DebugBuiltins
THEN
else call Builtins.memcpy.
*)
-PROCEDURE MaybeDebugBuiltinMemcpy (location: location_t; src, dest, nbytes: Tree) : Tree ;
+PROCEDURE MaybeDebugBuiltinMemcpy (location: location_t; src, dest, nbytes: tree) : tree ;
VAR
call,
- func: Tree ;
+ func: tree ;
BEGIN
IF DebugBuiltins
THEN
UnboundedType: CARDINAL ;
Addr,
High,
- NewArray : Tree ;
+ NewArray : tree ;
BEGIN
location := TokenToLocation (tokenno) ;
UnboundedType := GetType (param) ;
GetParamAddress - returns the address of parameter, param.
*)
-PROCEDURE GetParamAddress (location: location_t; proc, param: CARDINAL) : Tree ;
+PROCEDURE GetParamAddress (location: location_t; proc, param: CARDINAL) : tree ;
VAR
sym,
type: CARDINAL ;
GetParamSize - returns the size in bytes of, param.
*)
-PROCEDURE GetParamSize (tokenno: CARDINAL; param: CARDINAL) : Tree ;
+PROCEDURE GetParamSize (tokenno: CARDINAL; param: CARDINAL) : tree ;
BEGIN
Assert(IsVar(param) OR IsParameter(param)) ;
IF IsUnbounded(param)
else jump to, fLabel.
*)
-PROCEDURE DoIsIntersection (tokenno: CARDINAL; ta, tb, tc, td: Tree; tLabel, fLabel: String) ;
+PROCEDURE DoIsIntersection (tokenno: CARDINAL; ta, tb, tc, td: tree; tLabel, fLabel: String) ;
VAR
location: location_t ;
BEGIN
proc, param: CARDINAL) ;
VAR
ta, tb,
- tc, td : Tree ;
+ tc, td : tree ;
n, j : CARDINAL ;
tLabel,
fLabel,
PROCEDURE CodeKillLocalVar (CurrentProcedure: CARDINAL) ;
VAR
begin, end: CARDINAL ;
- proc : Tree ;
+ proc : tree ;
BEGIN
GetProcedureBeginEnd (CurrentProcedure, begin, end) ;
CurrentQuadToken := end ;
expr, none, procedure : CARDINAL ;
combinedpos,
returnpos, exprpos, nonepos, procpos: CARDINAL ;
- value, length : Tree ;
+ value, length : tree ;
location : location_t ;
BEGIN
GetQuadOtok (quad, returnpos, op, expr, none, procedure,
PROCEDURE CodeCall (tokenno: CARDINAL; procedure: CARDINAL) ;
VAR
- tree : Tree ;
+ callTree: tree ;
location: location_t ;
BEGIN
IF IsProcedure (procedure)
THEN
DeclareParameters (procedure) ;
- tree := CodeDirectCall (tokenno, procedure)
+ callTree := CodeDirectCall (tokenno, procedure)
ELSIF IsProcType (SkipType (GetType (procedure)))
THEN
DeclareParameters (SkipType (GetType (procedure))) ;
- tree := CodeIndirectCall (tokenno, procedure) ;
+ callTree := CodeIndirectCall (tokenno, procedure) ;
procedure := SkipType (GetType (procedure))
ELSE
InternalError ('expecting Procedure or ProcType')
IF GetType (procedure) = NulSym
THEN
location := TokenToLocation (tokenno) ;
- AddStatement (location, tree)
+ AddStatement (location, callTree)
ELSE
(* leave tree alone - as it will be picked up when processing FunctValue *)
END
CanUseBuiltin or IsProcedureBuiltinAvailable returns TRUE.
*)
-PROCEDURE UseBuiltin (tokenno: CARDINAL; Sym: CARDINAL) : Tree ;
+PROCEDURE UseBuiltin (tokenno: CARDINAL; Sym: CARDINAL) : tree ;
BEGIN
IF BuiltinExists(KeyToCharStar(GetProcedureBuiltin(Sym)))
THEN
CodeDirectCall - calls a function/procedure.
*)
-PROCEDURE CodeDirectCall (tokenno: CARDINAL; procedure: CARDINAL) : Tree ;
+PROCEDURE CodeDirectCall (tokenno: CARDINAL; procedure: CARDINAL) : tree ;
VAR
location: location_t ;
- call : Tree ;
+ call : tree ;
BEGIN
location := TokenToLocation (tokenno) ;
IF IsProcedureBuiltinAvailable (procedure)
call := UseBuiltin (tokenno, procedure) ;
IF call # NIL
THEN
- call := BuildBuiltinCallTree (location, call)
+ call := BuildBuiltinCallTree (call)
END
ELSE
call := NIL
CodeIndirectCall - calls a function/procedure indirectly.
*)
-PROCEDURE CodeIndirectCall (tokenno: CARDINAL; ProcVar: CARDINAL) : Tree ;
+PROCEDURE CodeIndirectCall (tokenno: CARDINAL; ProcVar: CARDINAL) : tree ;
VAR
- ReturnType: Tree ;
+ ReturnType: tree ;
proc : CARDINAL ;
location : location_t ;
BEGIN
proc := SkipType(GetType(ProcVar)) ;
IF GetType(proc)=NulSym
THEN
- ReturnType := Tree(NIL)
+ ReturnType := tree(NIL)
ELSE
- ReturnType := Tree(Mod2Gcc(GetType(proc)))
+ ReturnType := tree(Mod2Gcc(GetType(proc)))
END ;
(* now we dereference the lvalue if necessary *)
then convert the string into a character constant.
*)
-PROCEDURE StringToChar (t: Tree; type, str: CARDINAL) : Tree ;
+PROCEDURE StringToChar (t: tree; type, str: CARDINAL) : tree ;
VAR
s: String ;
n: Name ;
a symbol of, type.
*)
-PROCEDURE ConvertTo (t: Tree; type, op3: CARDINAL) : Tree ;
+PROCEDURE ConvertTo (t: tree; type, op3: CARDINAL) : tree ;
BEGIN
IF SkipType(type)#SkipType(GetType(op3))
THEN
first and then the remaining types.
*)
-PROCEDURE ConvertRHS (t: Tree; type, rhs: CARDINAL) : Tree ;
+PROCEDURE ConvertRHS (t: tree; type, rhs: CARDINAL) : tree ;
BEGIN
t := StringToChar (Mod2Gcc (rhs), type, rhs) ;
RETURN ConvertTo (t, type, rhs)
CheckConvertCoerceParameter -
*)
-PROCEDURE CheckConvertCoerceParameter (tokenno: CARDINAL; op1, op2, op3: CARDINAL) : Tree ;
+PROCEDURE CheckConvertCoerceParameter (tokenno: CARDINAL; op1, op2, op3: CARDINAL) : tree ;
VAR
OperandType,
ParamType : CARDINAL ;
CheckConstant - checks to see whether we should declare the constant.
*)
-PROCEDURE CheckConstant (tokenno: CARDINAL; des, expr: CARDINAL) : Tree ;
+PROCEDURE CheckConstant (tokenno: CARDINAL; des, expr: CARDINAL) : tree ;
VAR
location: location_t ;
BEGIN
max,
tmp,
res,
- val : Tree ;
+ val : tree ;
location: location_t ;
BEGIN
location := TokenToLocation (CurrentQuadToken) ;
bits,
max,
tmp,
- val : Tree ;
+ val : tree ;
location: location_t ;
BEGIN
location := TokenToLocation (tokenno) ;
op1, op2,
op3 : CARDINAL ;
op : QuadOperator ;
- val, call : Tree ;
+ val, call : tree ;
location : location_t ;
BEGIN
GetQuad (q, op, op1, op2, op3) ;
Replace - replace the entry for sym in the double entry bookkeeping with sym/tree.
*)
-PROCEDURE Replace (sym: CARDINAL; tree: Tree) ;
+PROCEDURE Replace (sym: CARDINAL; gcc: tree) ;
BEGIN
IF GccKnowsAbout (sym)
THEN
RemoveMod2Gcc (sym)
END ;
- AddModGcc (sym, tree)
+ AddModGcc (sym, gcc)
END Replace ;
PROCEDURE CodeFunctValue (location: location_t; op1: CARDINAL) ;
VAR
call,
- value: Tree ;
+ value: tree ;
BEGIN
(*
operator : FunctValueOp
PROCEDURE CodeAddr (tokenno: CARDINAL; quad: CARDINAL; op1, op3: CARDINAL) ;
VAR
- value : Tree ;
+ value : tree ;
type : CARDINAL ;
location: location_t ;
BEGIN
VAR
- tryBlock: Tree ; (* this must be placed into gccgm2 and it must follow the
+ tryBlock: tree ; (* this must be placed into gccgm2 and it must follow the
current function scope - ie it needs work with nested procedures *)
- handlerBlock: Tree ;
+ handlerBlock: tree ;
(*
location := TokenToLocation (CurrentQuadToken) ;
IF value = NulSym
THEN
- AddStatement (location, BuildThrow (location, Tree (NIL)))
+ AddStatement (location, BuildThrow (location, tree (NIL)))
ELSE
DeclareConstant (CurrentQuadToken, value) ; (* checks to see whether it is a constant and declares it *)
AddStatement (location, BuildThrow (location, BuildConvert (location,
typed constants.
*)
-PROCEDURE DefaultConvertGM2 (sym: CARDINAL) : Tree ;
+PROCEDURE DefaultConvertGM2 (sym: CARDINAL) : tree ;
BEGIN
sym := SkipType (sym) ;
IF sym=Bitset
*)
PROCEDURE FoldConstBecomes (tokenno: CARDINAL;
- op1, op3: CARDINAL) : Tree ;
+ op1, op3: CARDINAL) : tree ;
VAR
- t, type : Tree ;
+ t, type : tree ;
location: location_t ;
BEGIN
IF IsConstSet(op3) OR ((SkipType(GetType(op3))#NulSym) AND
which fits in dest.
*)
-PROCEDURE PrepareCopyString (tokenno: CARDINAL; VAR length, srcTree: Tree;
+PROCEDURE PrepareCopyString (tokenno: CARDINAL; VAR length, srcTree: tree;
src, destStrType: CARDINAL) : BOOLEAN ;
VAR
location : location_t ;
PROCEDURE checkArrayElements (des, expr: CARDINAL; virtpos, despos, exprpos: CARDINAL) : BOOLEAN ;
VAR
- e1, e3: Tree ;
+ e1, e3: tree ;
t1, t3: CARDINAL ;
BEGIN
t1 := GetType (des) ;
op2pos,
exprpos : CARDINAL ;
length,
- exprt : Tree ;
+ exprt : tree ;
location : location_t ;
BEGIN
GetQuadOtok (quad, becomespos, op, des, op2, expr,
It coerces a lvalue into an internal pointer type
*)
-PROCEDURE LValueToGenericPtr (location: location_t; sym: CARDINAL) : Tree ;
+PROCEDURE LValueToGenericPtr (location: location_t; sym: CARDINAL) : tree ;
VAR
- t: Tree ;
+ t: tree ;
BEGIN
t := Mod2Gcc (sym) ;
IF t = NIL
else convert to type, type. Return the converted tree.
*)
-PROCEDURE LValueToGenericPtrOrConvert (sym: CARDINAL; type: Tree) : Tree ;
+PROCEDURE LValueToGenericPtrOrConvert (sym: CARDINAL; type: tree) : tree ;
VAR
- n : Tree ;
+ n : tree ;
location: location_t ;
BEGIN
n := Mod2Gcc (sym) ;
coerces, t, appropriately.
*)
-PROCEDURE ZConstToTypedConst (t: Tree; op1, op2: CARDINAL) : Tree ;
+PROCEDURE ZConstToTypedConst (t: tree; op1, op2: CARDINAL) : tree ;
VAR
location: location_t ;
BEGIN
PROCEDURE FoldBinary (tokenno: CARDINAL; p: WalkAction; binop: BuildBinProcedure;
quad: CARDINAL; op1, op2, op3: CARDINAL) ;
VAR
- tl, tr, tv, resType: Tree ;
+ tl, tr, tv, resType: tree ;
location : location_t ;
BEGIN
(* firstly ensure that constant literals are declared *)
ConvertBinaryOperands -
*)
-PROCEDURE ConvertBinaryOperands (location: location_t; VAR tl, tr: Tree; type, op2, op3: CARDINAL) ;
+PROCEDURE ConvertBinaryOperands (location: location_t; VAR tl, tr: tree; type, op2, op3: CARDINAL) ;
BEGIN
tl := NIL ;
tr := NIL ;
min, max,
lowest,
tv,
- tl, tr : Tree ;
+ tl, tr : tree ;
location : location_t ;
BEGIN
(* firstly ensure that constant literals are declared. *)
op3pos,
type : CARDINAL ;
tv,
- tl, tr : Tree ;
+ tl, tr : tree ;
location: location_t ;
BEGIN
(* firstly ensure that constant literals are declared *)
PROCEDURE FoldBuiltinConst (tokenno: CARDINAL; p: WalkAction;
quad: CARDINAL; result, constDesc: CARDINAL) ;
VAR
- value: Tree ;
+ value: tree ;
BEGIN
value := GetBuiltinConst (KeyToCharStar (Name (constDesc))) ;
IF value = NIL
PROCEDURE FoldBuiltinTypeInfo (tokenno: CARDINAL; p: WalkAction;
quad: CARDINAL; op1, op2, op3: CARDINAL) ;
VAR
- t : Tree ;
+ t : tree ;
location: location_t ;
BEGIN
IF GccKnowsAbout(op2) AND CompletelyResolved(op2)
PROCEDURE CodeSavePriority (oldValue, scopeSym, procedureSym: CARDINAL) ;
VAR
- funcTree: Tree ;
+ funcTree: tree ;
mod : CARDINAL ;
n : Name ;
location: location_t ;
PROCEDURE CodeRestorePriority (oldValue, scopeSym, procedureSym: CARDINAL) ;
VAR
- funcTree: Tree ;
+ funcTree: tree ;
mod : CARDINAL ;
n : Name ;
location: location_t ;
unbounded,
leftproc,
rightproc,
- varproc : Tree ;
+ varproc : tree ;
location : location_t ;
BEGIN
(* firstly ensure that constant literals are declared *)
GetFieldNo - returns the field number in the, set, which contains, element.
*)
-PROCEDURE GetFieldNo (tokenno: CARDINAL; element: CARDINAL; set: CARDINAL; VAR offset: Tree) : INTEGER ;
+PROCEDURE GetFieldNo (tokenno: CARDINAL; element: CARDINAL; set: CARDINAL; VAR offset: tree) : INTEGER ;
VAR
low, high, bpw, c: CARDINAL ;
location : location_t ;
VAR
low,
high : CARDINAL ;
- offset : Tree ;
+ offset : tree ;
fieldno : INTEGER ;
location: location_t ;
BEGIN
VAR
low,
high : CARDINAL ;
- offset : Tree ;
+ offset : tree ;
fieldno : INTEGER ;
location: location_t ;
BEGIN
*)
PROCEDURE FoldUnary (tokenno: CARDINAL; p: WalkAction;
- unop: BuildUnaryProcedure; ZConstToTypedConst: Tree;
+ unop: BuildUnaryProcedure; ZConstToTypedConst: tree;
quad: CARDINAL; result, expr: CARDINAL) ;
VAR
- tv : Tree ;
+ tv : tree ;
location: location_t ;
BEGIN
(* firstly ensure that any constant literal is declared *)
(* fine, we can take advantage of this and fold constants *)
IF IsConst (result)
THEN
- IF ZConstToTypedConst = Tree(NIL)
+ IF ZConstToTypedConst = tree(NIL)
THEN
IF (GetType (expr) = NulSym) OR IsOrdinalType (SkipType (GetType (expr)))
THEN
CodeUnaryCheck - encode a unary arithmetic operation.
*)
-PROCEDURE CodeUnaryCheck (unop: BuildUnaryCheckProcedure; ZConstToTypedConst: Tree;
+PROCEDURE CodeUnaryCheck (unop: BuildUnaryCheckProcedure; ZConstToTypedConst: tree;
quad: CARDINAL; result, expr: CARDINAL) ;
VAR
lowestType: CARDINAL ;
min, max,
lowest,
- tv : Tree ;
+ tv : tree ;
location : location_t ;
BEGIN
(* firstly ensure that any constant literal is declared *)
CheckOrResetOverflow (CurrentQuadToken, tv, MustCheckOverflow(quad)) ;
IF IsConst (result)
THEN
- IF ZConstToTypedConst = Tree (NIL)
+ IF ZConstToTypedConst = tree (NIL)
THEN
- ZConstToTypedConst := Tree (Mod2Gcc( GetType (expr)))
+ ZConstToTypedConst := tree (Mod2Gcc( GetType (expr)))
END ;
(* still have a constant which was not resolved, pass it to gcc *)
PutConst (result, FindType (expr)) ;
CodeUnary - encode a unary arithmetic operation.
*)
-PROCEDURE CodeUnary (unop: BuildUnaryProcedure; ZConstToTypedConst: Tree;
+PROCEDURE CodeUnary (unop: BuildUnaryProcedure; ZConstToTypedConst: tree;
quad: CARDINAL; result, expr: CARDINAL) ;
VAR
- tv : Tree ;
+ tv : tree ;
location: location_t ;
BEGIN
(* firstly ensure that any constant literal is declared *)
CheckOrResetOverflow (CurrentQuadToken, tv, MustCheckOverflow (quad)) ;
IF IsConst(result)
THEN
- IF ZConstToTypedConst=Tree(NIL)
+ IF ZConstToTypedConst=tree(NIL)
THEN
- ZConstToTypedConst := Tree(Mod2Gcc(GetType(expr)))
+ ZConstToTypedConst := tree(Mod2Gcc(GetType(expr)))
END ;
(* still have a constant which was not resolved, pass it to gcc *)
PutConst (result, FindType (expr)) ;
PROCEDURE FoldSize (tokenno: CARDINAL; p: WalkAction;
quad: CARDINAL; op1, op2, op3: CARDINAL) ;
VAR
- t : Tree ;
+ t : tree ;
location: location_t ;
BEGIN
location := TokenToLocation(tokenno) ;
VAR
recordType,
fieldType : CARDINAL ;
- ptr : Tree ;
+ ptr : tree ;
location : location_t ;
BEGIN
RETURN ; (* this procedure should no longer be called *)
VAR
recordType,
fieldType : CARDINAL ;
- ptr : Tree ;
+ ptr : tree ;
location : location_t ;
BEGIN
location := TokenToLocation (CurrentQuadToken) ;
BuildHighFromChar -
*)
-PROCEDURE BuildHighFromChar (operand: CARDINAL) : Tree ;
+PROCEDURE BuildHighFromChar (operand: CARDINAL) : tree ;
VAR
location: location_t ;
BEGIN
BuildHighFromArray -
*)
-PROCEDURE BuildHighFromArray (tokenno: CARDINAL; dim, operand: CARDINAL) : Tree ;
+PROCEDURE BuildHighFromArray (tokenno: CARDINAL; dim, operand: CARDINAL) : tree ;
VAR
Type : CARDINAL ;
location: location_t ;
BuildHighFromStaticArray -
*)
-PROCEDURE BuildHighFromStaticArray (location: location_t; (* dim, *) Type: CARDINAL) : Tree ;
+PROCEDURE BuildHighFromStaticArray (location: location_t; (* dim, *) Type: CARDINAL) : tree ;
VAR
High, Low: CARDINAL ;
Subscript,
GetBaseTypeMinMax (Subrange, Low, High) ;
IF GccKnowsAbout (High)
THEN
- RETURN Tree (Mod2Gcc (High))
+ RETURN tree (Mod2Gcc (High))
END
ELSIF IsSubrange(Subrange)
THEN
END
ELSE
MetaError1 ('array subscript {%1EDad:for} must be a subrange or enumeration type', Type) ;
- RETURN Tree(NIL)
+ RETURN tree(NIL)
END ;
IF GccKnowsAbout (High)
THEN
- RETURN Tree (Mod2Gcc (High))
+ RETURN tree (Mod2Gcc (High))
ELSE
- RETURN Tree (NIL)
+ RETURN tree (NIL)
END
END BuildHighFromStaticArray ;
BuildHighFromString -
*)
-PROCEDURE BuildHighFromString (operand: CARDINAL) : Tree ;
+PROCEDURE BuildHighFromString (operand: CARDINAL) : tree ;
VAR
location: location_t ;
BEGIN
HIGH(operand).
*)
-PROCEDURE ResolveHigh (tokenno: CARDINAL; dim, operand: CARDINAL) : Tree ;
+PROCEDURE ResolveHigh (tokenno: CARDINAL; dim, operand: CARDINAL) : tree ;
VAR
Type : CARDINAL ;
location: location_t ;
PROCEDURE FoldHigh (tokenno: CARDINAL; p: WalkAction;
quad: CARDINAL; op1, dim, op3: CARDINAL) ;
VAR
- t : Tree ;
+ t : tree ;
location: location_t ;
BEGIN
(* firstly ensure that any constant literal is declared *)
THEN
t := ResolveHigh(tokenno, dim, op3) ;
(* fine, we can take advantage of this and fold constants *)
- IF IsConst(op1) AND (t#Tree(NIL))
+ IF IsConst(op1) AND (t#tree(NIL))
THEN
PutConst(op1, Cardinal) ;
AddModGcc(op1,
PROCEDURE CodeUnbounded (result, array: CARDINAL) ;
VAR
- Addr : Tree ;
+ Addr : tree ;
location: location_t ;
BEGIN
location := TokenToLocation (CurrentQuadToken) ;
low,
subscript : CARDINAL ;
a, ta,
- ti, tl : Tree ;
+ ti, tl : tree ;
location : location_t ;
BEGIN
location := TokenToLocation (CurrentQuadToken) ;
PopKindTree - returns a Tree from M2ALU of the type implied by, op.
*)
-PROCEDURE PopKindTree (op: CARDINAL; tokenno: CARDINAL) : Tree ;
+PROCEDURE PopKindTree (op: CARDINAL; tokenno: CARDINAL) : tree ;
VAR
type: CARDINAL ;
BEGIN
quad: CARDINAL; op1, op2, op3: CARDINAL) ;
VAR
- tl : Tree ;
+ tl : tree ;
location: location_t ;
BEGIN
location := TokenToLocation(tokenno) ;
PROCEDURE CodeConvert (quad: CARDINAL; lhs, type, rhs: CARDINAL) ;
VAR
- tl, tr : Tree ;
+ tl, tr : tree ;
location: location_t ;
BEGIN
CheckStop(quad) ;
PROCEDURE PerformCodeIfLess (quad: CARDINAL) ;
VAR
- tl, tr : Tree ;
+ tl, tr : tree ;
location : location_t ;
left, right, dest, combined,
leftpos, rightpos, destpos : CARDINAL ;
PROCEDURE PerformCodeIfGre (quad: CARDINAL) ;
VAR
- tl, tr : Tree ;
+ tl, tr : tree ;
location : location_t ;
left, right, dest, combined,
leftpos, rightpos, destpos : CARDINAL ;
PROCEDURE PerformCodeIfLessEqu (quad: CARDINAL) ;
VAR
- tl, tr : Tree ;
+ tl, tr : tree ;
location : location_t ;
left, right, dest, combined,
leftpos, rightpos, destpos : CARDINAL ;
PROCEDURE PerformCodeIfGreEqu (quad: CARDINAL) ;
VAR
- tl, tr: Tree ;
+ tl, tr: tree ;
location : location_t ;
left, right, dest, combined,
leftpos, rightpos, destpos : CARDINAL ;
PROCEDURE PerformCodeIfEqu (quad: CARDINAL) ;
VAR
- tl, tr : Tree ;
+ tl, tr : tree ;
location : location_t ;
left, right, dest, combined,
leftpos, rightpos, destpos : CARDINAL ;
PROCEDURE PerformCodeIfNotEqu (quad: CARDINAL) ;
VAR
- tl, tr : Tree ;
+ tl, tr : tree ;
location : location_t ;
left, right, dest, combined,
leftpos, rightpos, destpos : CARDINAL ;
PROCEDURE BuildIfVarInConstValue (location: location_t; tokenno: CARDINAL;
constsetvalue: PtrToValue; var, trueexit: CARDINAL) ;
VAR
- vt, lt, ht : Tree ;
+ vt, lt, ht : tree ;
type,
low, high, n: CARDINAL ;
truelabel : String ;
PROCEDURE BuildIfNotVarInConstValue (quad: CARDINAL; constsetvalue: PtrToValue; var, trueexit: CARDINAL) ;
VAR
- vt, lt, ht : Tree ;
+ vt, lt, ht : tree ;
type,
low, high, n: CARDINAL ;
falselabel,
high : CARDINAL ;
lowtree,
hightree,
- offset : Tree ;
+ offset : tree ;
fieldno : INTEGER ;
location : location_t ;
left, right, dest, combined,
high : CARDINAL ;
lowtree,
hightree,
- offset : Tree ;
+ offset : tree ;
fieldno : INTEGER ;
location : location_t ;
left, right, dest, combined,
typepos,
xindrpos : CARDINAL ;
length,
- newstr : Tree ;
+ newstr : tree ;
location : location_t ;
BEGIN
GetQuadOtok (quad, xindrpos, op, left, type, right,
DEFINITION MODULE M2LangDump ;
-FROM m2tree IMPORT Tree ;
+FROM gcctypes IMPORT tree ;
FROM DynamicStrings IMPORT String ;
FROM FIO IMPORT File ;
If no filter is specified it will always return default.
*)
-PROCEDURE IsDumpRequiredTree (tree: Tree; default: BOOLEAN) : BOOLEAN ;
+PROCEDURE IsDumpRequiredTree (gcctree: tree; default: BOOLEAN) : BOOLEAN ;
(*
IsDumpRequiredTree - return TRUE if the gcc tree should be dumped.
*)
-PROCEDURE IsDumpRequiredTree (tree: Tree; default: BOOLEAN) : BOOLEAN ;
+PROCEDURE IsDumpRequiredTree (gcctree: tree; default: BOOLEAN) : BOOLEAN ;
VAR
sym: CARDINAL ;
BEGIN
- sym := Gcc2Mod (tree) ;
+ sym := Gcc2Mod (gcctree) ;
IF sym = NulSym
THEN
RETURN default
FROM SYSTEM IMPORT ADDRESS ;
FROM M2Reserved IMPORT toktype ;
FROM DynamicStrings IMPORT String ;
-FROM m2linemap IMPORT location_t ;
+FROM gcctypes IMPORT location_t ;
FROM NameKey IMPORT Name ;
FROM M2Debug IMPORT Assert ;
FROM NameKey IMPORT makekey ;
FROM NumberIO IMPORT CardToStr ;
-FROM m2linemap IMPORT location_t, GetLocationBinary ;
+FROM gcctypes IMPORT location_t ;
+FROM m2linemap IMPORT GetLocationBinary ;
FROM M2Emit IMPORT UnknownLocation, BuiltinsLocation ;
FROM M2Error IMPORT WarnStringAt ;
FROM M2MetaError IMPORT MetaErrorT0 ;
FROM SYSTEM IMPORT ADDRESS ;
FROM DynamicStrings IMPORT String ;
-FROM m2linemap IMPORT location_t ;
+FROM gcctypes IMPORT location_t ;
VAR
FROM FIO IMPORT StdErr ;
FROM libc IMPORT exit, printf ;
FROM Debug IMPORT Halt ;
-FROM m2linemap IMPORT location_t ;
+FROM gcctypes IMPORT location_t ;
FROM m2configure IMPORT FullPathCPP, TargetIEEEQuadDefault ;
FROM M2Error IMPORT InternalError ;
FROM FormatStrings IMPORT Sprintf1 ;
time, post optimization.
*)
-FROM SYSTEM IMPORT ADDRESS ;
-FROM m2tree IMPORT Tree ;
-FROM m2linemap IMPORT location_t ;
+FROM CDataTypes IMPORT ConstCharStar ;
+FROM gcctypes IMPORT location_t, tree ;
FROM DynamicStrings IMPORT String ;
+
(*
InitAssignmentRangeCheck - returns a range check node which
remembers the information necessary
CodeErrorCheck - returns a Tree calling the approprate exception handler.
*)
-PROCEDURE CodeErrorCheck (r: CARDINAL; function, message: String) : Tree ;
+PROCEDURE CodeErrorCheck (r: CARDINAL; function, message: String) : tree ;
(*
OverlapsRange - returns TRUE if a1..a2 overlaps with b1..b2.
*)
-PROCEDURE OverlapsRange (a1, a2, b1, b2: Tree) : BOOLEAN ;
+PROCEDURE OverlapsRange (a1, a2, b1, b2: tree) : BOOLEAN ;
(*
IsEqual - returns TRUE if a=b.
*)
-PROCEDURE IsEqual (a, b: Tree) : BOOLEAN ;
+PROCEDURE IsEqual (a, b: tree) : BOOLEAN ;
(*
IsGreaterOrEqual - returns TRUE if a>=b.
*)
-PROCEDURE IsGreaterOrEqual (a, b: Tree) : BOOLEAN ;
+PROCEDURE IsGreaterOrEqual (a, b: tree) : BOOLEAN ;
(*
IsGreater - returns TRUE if a>b.
*)
-PROCEDURE IsGreater (a, b: Tree) : BOOLEAN ;
+PROCEDURE IsGreater (a, b: tree) : BOOLEAN ;
(*
BuildIfCallWholeHandlerLoc - return a Tree containing a runtime test whether, condition, is true.
*)
-PROCEDURE BuildIfCallWholeHandlerLoc (location: location_t; condition: Tree;
- scope, message: ADDRESS) : Tree ;
+PROCEDURE BuildIfCallWholeHandlerLoc (location: location_t; condition: tree;
+ scope, message: ConstCharStar) : tree ;
(*
BuildIfCallRealHandlerLoc - return a Tree containing a runtime test whether, condition, is true.
*)
-PROCEDURE BuildIfCallRealHandlerLoc (location: location_t; condition: Tree;
- scope, message: ADDRESS) : Tree ;
+PROCEDURE BuildIfCallRealHandlerLoc (location: location_t; condition: tree;
+ scope, message: ConstCharStar) : tree ;
(*
GetMinMax - returns TRUE if we know the max and min of a type, t.
*)
-PROCEDURE GetMinMax (tokenno: CARDINAL; type: CARDINAL; VAR min, max: Tree) : BOOLEAN ;
+PROCEDURE GetMinMax (tokenno: CARDINAL; type: CARDINAL; VAR min, max: tree) : BOOLEAN ;
END M2Range.
IsParameter, GetDeclaredMod, IsVarParam, GetNthParam,
ModeOfAddr ;
-FROM m2tree IMPORT Tree, debug_tree ;
+FROM SYSTEM IMPORT ADDRESS ;
+FROM m2tree IMPORT debug_tree ;
+
FROM m2linemap IMPORT ErrorAt, GetFilenameFromLocation, GetColumnNoFromLocation, GetLineNoFromLocation ;
FROM m2type IMPORT GetMinFrom, GetMaxFrom,
OverlapsRange - returns TRUE if a1..a2 overlaps with b1..b2.
*)
-PROCEDURE OverlapsRange (a1, a2, b1, b2: Tree) : BOOLEAN ;
+PROCEDURE OverlapsRange (a1, a2, b1, b2: tree) : BOOLEAN ;
BEGIN
(* RETURN( ((a1<=b2) AND (a2>=b1)) ) *)
RETURN( (CompareTrees(a1, b2)<=0) AND (CompareTrees(a2, b1)>=0) )
IsGreater - returns TRUE if a>b.
*)
-PROCEDURE IsGreater (a, b: Tree) : BOOLEAN ;
+PROCEDURE IsGreater (a, b: tree) : BOOLEAN ;
BEGIN
RETURN( CompareTrees(a, b)>0 )
END IsGreater ;
IsGreaterOrEqual - returns TRUE if a>=b.
*)
-PROCEDURE IsGreaterOrEqual (a, b: Tree) : BOOLEAN ;
+PROCEDURE IsGreaterOrEqual (a, b: tree) : BOOLEAN ;
BEGIN
RETURN( CompareTrees(a, b)>=0 )
END IsGreaterOrEqual ;
IsEqual - returns TRUE if a=b.
*)
-PROCEDURE IsEqual (a, b: Tree) : BOOLEAN ;
+PROCEDURE IsEqual (a, b: tree) : BOOLEAN ;
BEGIN
RETURN( CompareTrees(a, b)=0 )
END IsEqual ;
GetMinMax - returns TRUE if we know the max and min of m2type.
*)
-PROCEDURE GetMinMax (tokenno: CARDINAL; type: CARDINAL; VAR min, max: Tree) : BOOLEAN ;
+PROCEDURE GetMinMax (tokenno: CARDINAL; type: CARDINAL; VAR min, max: tree) : BOOLEAN ;
VAR
minC, maxC: CARDINAL ;
location : location_t ;
*)
PROCEDURE OutOfRange (tokenno: CARDINAL;
- min: Tree;
+ min: tree;
expr: CARDINAL;
- max: Tree;
+ max: tree;
type: CARDINAL) : BOOLEAN ;
BEGIN
IF TreeOverflow (min)
PROCEDURE FoldAssignment (tokenno: CARDINAL; q: CARDINAL; r: CARDINAL) ;
VAR
p : Range ;
- min, max: Tree ;
+ min, max: tree ;
BEGIN
p := GetIndice (RangeIndex, r) ;
WITH p^ DO
PROCEDURE FoldParameterAssign (tokenno: CARDINAL; q: CARDINAL; r: CARDINAL) ;
VAR
p : Range ;
- min, max: Tree ;
+ min, max: tree ;
BEGIN
p := GetIndice(RangeIndex, r) ;
WITH p^ DO
PROCEDURE FoldReturn (tokenno: CARDINAL; q: CARDINAL; r: CARDINAL) ;
VAR
p : Range ;
- min, max: Tree ;
+ min, max: tree ;
BEGIN
p := GetIndice(RangeIndex, r) ;
WITH p^ DO
PROCEDURE FoldInc (tokenno: CARDINAL; q: CARDINAL; r: CARDINAL) ;
VAR
p : Range ;
- t, min, max: Tree ;
+ t, min, max: tree ;
location : location_t ;
BEGIN
location := TokenToLocation(tokenno) ;
PROCEDURE FoldDec (tokenno: CARDINAL; q: CARDINAL; r: CARDINAL) ;
VAR
p : Range ;
- t, min, max: Tree ;
+ t, min, max: tree ;
location : location_t ;
BEGIN
location := TokenToLocation(tokenno) ;
PROCEDURE FoldIncl (tokenno: CARDINAL; q: CARDINAL; r: CARDINAL) ;
VAR
p : Range ;
- min, max: Tree ;
+ min, max: tree ;
BEGIN
p := GetIndice(RangeIndex, r) ;
WITH p^ DO
PROCEDURE FoldExcl (tokenno: CARDINAL; q: CARDINAL; r: CARDINAL) ;
VAR
p : Range ;
- min, max: Tree ;
+ min, max: tree ;
BEGIN
p := GetIndice(RangeIndex, r) ;
WITH p^ DO
p : Range ;
shiftMin,
shiftMax,
- min, max: Tree ;
+ min, max: tree ;
location : location_t ;
BEGIN
location := TokenToLocation(tokenno) ;
p : Range ;
rotateMin,
rotateMax,
- min, max : Tree ;
+ min, max : tree ;
location : location_t ;
BEGIN
location := TokenToLocation(tokenno) ;
PROCEDURE FoldForLoopBegin (tokenno: CARDINAL; q: CARDINAL; r: CARDINAL) ;
VAR
p : Range ;
- min, max: Tree ;
+ min, max: tree ;
BEGIN
p := GetIndice(RangeIndex, r) ;
WITH p^ DO
PROCEDURE FoldForLoopTo (tokenno: CARDINAL; q: CARDINAL; r: CARDINAL) ;
VAR
p : Range ;
- min, max: Tree ;
+ min, max: tree ;
BEGIN
p := GetIndice(RangeIndex, r) ;
WITH p^ DO
PROCEDURE FoldStaticArraySubscript (tokenno: CARDINAL; q: CARDINAL; r: CARDINAL) ;
VAR
p : Range ;
- min, max: Tree ;
+ min, max: tree ;
BEGIN
p := GetIndice (RangeIndex, r) ;
WITH p^ DO
is an LValue.
*)
-PROCEDURE DeReferenceLValue (tokenno: CARDINAL; expr: CARDINAL) : Tree ;
+PROCEDURE DeReferenceLValue (tokenno: CARDINAL; expr: CARDINAL) : tree ;
VAR
- e : Tree ;
+ e : tree ;
location: location_t ;
BEGIN
location := TokenToLocation(tokenno) ;
CodeErrorCheck - returns a Tree calling the approprate exception handler.
*)
-PROCEDURE CodeErrorCheck (r: CARDINAL; function, message: String) : Tree ;
+PROCEDURE CodeErrorCheck (r: CARDINAL; function, message: String) : tree ;
VAR
filename: String ;
line,
column : CARDINAL ;
p : Range ;
- f : Tree ;
+ f : tree ;
location: location_t ;
BEGIN
IF HandlerExists (r)
*)
PROCEDURE CodeErrorCheckLoc (location: location_t;
- function, message: ADDRESS; func: CARDINAL) : Tree ;
+ function, message: ConstCharStar; func: CARDINAL) : tree ;
VAR
scope,
errorMessage: String ;
- t : Tree ;
+ t : tree ;
filename : String ;
line,
column : CARDINAL ;
IssueWarningLoc -
*)
-PROCEDURE IssueWarningLoc (location: location_t; message: ADDRESS) ;
+PROCEDURE IssueWarningLoc (location: location_t; message: ConstCharStar) ;
VAR
s: String ;
BEGIN
BuildIfCallWholeHandlerLoc - return a Tree containing a runtime test whether, condition, is true.
*)
-PROCEDURE BuildIfCallWholeHandlerLoc (location: location_t; condition: Tree;
- scope, message: ADDRESS) : Tree ;
+PROCEDURE BuildIfCallWholeHandlerLoc (location: location_t; condition: tree;
+ scope, message: ConstCharStar) : tree ;
BEGIN
RETURN BuildIfCallHandlerLoc (location, condition, scope, message, ExceptionWholeValue)
END BuildIfCallWholeHandlerLoc ;
BuildIfCallRealHandlerLoc - return a Tree containing a runtime test whether, condition, is true.
*)
-PROCEDURE BuildIfCallRealHandlerLoc (location: location_t; condition: Tree;
- scope, message: ADDRESS) : Tree ;
+PROCEDURE BuildIfCallRealHandlerLoc (location: location_t; condition: tree;
+ scope, message: ConstCharStar) : tree ;
BEGIN
RETURN BuildIfCallHandlerLoc (location, condition, scope, message, ExceptionRealValue)
END BuildIfCallRealHandlerLoc ;
BuildIfCallHandlerLoc - return a Tree containing a runtime test whether, condition, is true.
*)
-PROCEDURE BuildIfCallHandlerLoc (location: location_t; condition: Tree;
- scope, message: ADDRESS; func: CARDINAL) : Tree ;
+PROCEDURE BuildIfCallHandlerLoc (location: location_t; condition: tree;
+ scope, message: ConstCharStar; func: CARDINAL) : tree ;
BEGIN
IF IsTrue (condition)
THEN
BuildIfCallHandler -
*)
-PROCEDURE BuildIfCallHandler (condition: Tree; r: CARDINAL;
- function, message: String; warning: BOOLEAN) : Tree ;
+PROCEDURE BuildIfCallHandler (condition: tree; r: CARDINAL;
+ function, message: String; warning: BOOLEAN) : tree ;
BEGIN
IF warning AND IsTrue (condition)
THEN
PROCEDURE RangeCheckReal (p: Range; r: CARDINAL; function, message: String) ;
VAR
e,
- condition: Tree ;
+ condition: tree ;
location : location_t ;
BEGIN
WITH p^ DO
VAR
condition,
desMin, desMax,
- exprMin, exprMax: Tree ;
+ exprMin, exprMax: tree ;
location : location_t ;
BEGIN
WITH p^ DO
r: CARDINAL; function, message: String) ;
VAR
condition,
- desMin, desMax: Tree ;
+ desMin, desMax: tree ;
location : location_t ;
BEGIN
WITH p^ DO
IfOutsideLimitsDo -
*)
-PROCEDURE IfOutsideLimitsDo (tokenno: CARDINAL; min, expr, max: Tree; r: CARDINAL;
+PROCEDURE IfOutsideLimitsDo (tokenno: CARDINAL; min, expr, max: tree; r: CARDINAL;
function, message: String) ;
VAR
- condition: Tree ;
+ condition: tree ;
location : location_t ;
BEGIN
location := TokenToLocation (tokenno) ;
p : Range ;
t, condition,
e,
- desMin, desMax: Tree ;
+ desMin, desMax: tree ;
location : location_t ;
BEGIN
location := TokenToLocation(tokenno) ;
p : Range ;
t, condition,
e,
- desMin, desMax: Tree ;
+ desMin, desMax: tree ;
location : location_t ;
BEGIN
location := TokenToLocation(tokenno) ;
VAR
p : Range ;
e,
- desMin, desMax: Tree ;
+ desMin, desMax: tree ;
location : location_t ;
BEGIN
location := TokenToLocation(tokenno) ;
p : Range ;
e,
shiftMin, shiftMax,
- desMin, desMax : Tree ;
+ desMin, desMax : tree ;
location : location_t ;
BEGIN
p := GetIndice(RangeIndex, r) ;
r: CARDINAL; function, message: String) ;
VAR
p : Range ;
- desMin, desMax: Tree ;
+ desMin, desMax: tree ;
location : location_t ;
BEGIN
location := TokenToLocation (tokenno) ;
VAR
UnboundedType: CARDINAL ;
p : Range ;
- high, e : Tree ;
+ high, e : tree ;
location : location_t ;
BEGIN
location := TokenToLocation(tokenno) ;
*)
PROCEDURE SameTypesCodeForLoopEnd (tokenNo: CARDINAL; r: CARDINAL; function, message: String;
- p: Range; dmax: Tree) ;
+ p: Range; dmax: tree) ;
VAR
inc,
room,
statement,
- condition: Tree ;
+ condition: tree ;
location : location_t ;
BEGIN
location := TokenToLocation(tokenNo) ;
*)
PROCEDURE DiffTypesCodeForLoopEnd (tokenNo: CARDINAL; r: CARDINAL; function, message: String;
- p: Range; dmax, emin, emax: Tree) ;
+ p: Range; dmax, emin, emax: tree) ;
VAR
location : location_t ;
desoftypee,
s4, s5, s6,
s7, s8,
lg1, lg2,
- dz, ez : Tree ;
+ dz, ez : tree ;
BEGIN
location := TokenToLocation(tokenNo) ;
WITH p^ DO
isCard : BOOLEAN ;
p : Range ;
dmin, dmax,
- emin, emax: Tree ;
+ emin, emax: tree ;
BEGIN
p := GetIndice(RangeIndex, r) ;
WITH p^ DO
PROCEDURE CodeNil (r: CARDINAL; function, message: String) ;
VAR
p : Range ;
- condition, t: Tree ;
+ condition, t: tree ;
location : location_t ;
BEGIN
p := GetIndice(RangeIndex, r) ;
zero : CARDINAL ;
p : Range ;
condition,
- e : Tree ;
+ e : tree ;
location : location_t ;
BEGIN
p := GetIndice(RangeIndex, r) ;
zero : CARDINAL ;
p : Range ;
condition,
- e : Tree ;
+ e : tree ;
location : location_t ;
BEGIN
p := GetIndice(RangeIndex, r) ;
are mapped onto their equivalents in the gcc backend.
*)
-FROM m2linemap IMPORT location_t ;
+FROM gcctypes IMPORT location_t ;
EXPORT QUALIFIED
System, (* The SYSTEM module symbol. *)
LongReal, LongCard, LongInt, LongComplex,
ShortReal, ShortCard, ShortInt, ShortComplex ;
-FROM m2tree IMPORT Tree ;
+FROM gcctypes IMPORT tree ;
FROM m2linemap IMPORT BuiltinsLocation ;
FROM m2decl IMPORT GetBitsPerBitset, GetBitsPerUnit ;
CreateMinMaxFor - creates the min and max values for, type, given gccType.
*)
-PROCEDURE CreateMinMaxFor (type: CARDINAL; min, max: ARRAY OF CHAR; gccType: Tree) ;
+PROCEDURE CreateMinMaxFor (type: CARDINAL; min, max: ARRAY OF CHAR; gccType: tree) ;
VAR
maxval, minval: CARDINAL ;
BEGIN
PROCEDURE MapType (type: CARDINAL;
name, min, max: ARRAY OF CHAR;
- needsExporting: BOOLEAN; t: Tree) ;
+ needsExporting: BOOLEAN; t: tree) ;
VAR
n: Name ;
BEGIN
*)
PROCEDURE CreateType (name, min, max: ARRAY OF CHAR;
- needsExporting: BOOLEAN; gccType: Tree) : CARDINAL ;
+ needsExporting: BOOLEAN; gccType: tree) : CARDINAL ;
VAR
type: CARDINAL ;
BEGIN
*)
PROCEDURE AttemptToCreateType (name, min, max: ARRAY OF CHAR;
- needsExporting: BOOLEAN; gccType: Tree) ;
+ needsExporting: BOOLEAN; gccType: tree) ;
BEGIN
Assert (IsLegal (CreateType (name, min, max, needsExporting, gccType)))
END AttemptToCreateType ;
*)
PROCEDURE CreateSetType (name, highBit: ARRAY OF CHAR;
- needsExporting: BOOLEAN; gccType: Tree) : CARDINAL ;
+ needsExporting: BOOLEAN; gccType: tree) : CARDINAL ;
VAR
low,
high,
*)
PROCEDURE AttemptToCreateSetType (name, highBit: ARRAY OF CHAR;
- needsExporting: BOOLEAN; gccType: Tree) ;
+ needsExporting: BOOLEAN; gccType: tree) ;
BEGIN
Assert (IsLegal (CreateSetType (name, highBit, needsExporting, gccType)))
END AttemptToCreateSetType ;
FROM StrIO IMPORT WriteString, WriteLn ;
FROM M2Base IMPORT ZType ;
FROM Storage IMPORT ALLOCATE ;
-FROM m2linemap IMPORT location_t ;
+FROM gcctypes IMPORT location_t ;
FROM M2LexBuf IMPORT TokenToLocation ;
FROM M2Reserved IMPORT ImportTok, ExportTok, QualifiedTok, UnQualifiedTok,
Description: mapping between m2 symbols and gcc symbols.
*)
-FROM m2tree IMPORT Tree ;
+FROM gcctypes IMPORT tree ;
FROM SYSTEM IMPORT WORD ;
Mod2Gcc - given a modula-2 symbol, sym, return the gcc equivalent.
*)
-PROCEDURE Mod2Gcc (sym: CARDINAL) : Tree ;
+PROCEDURE Mod2Gcc (sym: CARDINAL) : tree ;
(*
Gcc2Mod - given a gcc tree return the modula-2 symbol.
*)
-PROCEDURE Gcc2Mod (tree: Tree) : CARDINAL ;
+PROCEDURE Gcc2Mod (tree: tree) : CARDINAL ;
(*
AddModGcc - adds the tuple [ sym, gcc ] into the database.
*)
-PROCEDURE AddModGcc (sym: CARDINAL; gcc: Tree) ;
+PROCEDURE AddModGcc (sym: CARDINAL; gcc: tree) ;
(*
FROM M2Error IMPORT InternalError ;
FROM M2ALU IMPORT PushTypeOfTree ;
FROM m2block IMPORT GetErrorNode, RememberConstant ;
-FROM m2tree IMPORT Tree ;
+FROM gcctypes IMPORT tree ;
FROM M2Printf IMPORT printf1 ;
FROM Storage IMPORT ALLOCATE ;
FROM SYSTEM IMPORT ADDRESS ;
Mod2Gcc - given a modula-2 symbol, sym, return the gcc equivalent.
*)
-PROCEDURE Mod2Gcc (sym: CARDINAL) : Tree ;
+PROCEDURE Mod2Gcc (sym: CARDINAL) : tree ;
VAR
n : Name ;
t : PtrToCardinal ;
- tr: Tree ;
+ tr: tree ;
BEGIN
IF USEPOISON
THEN
END ;
IF InBounds(mod2gcc, sym)
THEN
- tr := Tree(GetIndice(mod2gcc, sym)) ;
+ tr := tree(GetIndice(mod2gcc, sym)) ;
IF tr=PoisonedSymbol
THEN
n := GetSymName(sym) ;
Gcc2Mod - given a gcc tree return the modula-2 symbol.
*)
-PROCEDURE Gcc2Mod (tree: Tree) : CARDINAL ;
+PROCEDURE Gcc2Mod (tree: tree) : CARDINAL ;
VAR
high, i: CARDINAL ;
BEGIN
AddModGcc - adds the tuple [ sym, gcc ] into the database.
*)
-PROCEDURE AddModGcc (sym: CARDINAL; gcc: Tree) ;
+PROCEDURE AddModGcc (sym: CARDINAL; gcc: tree) ;
VAR
- old: Tree ;
+ old: tree ;
t : PtrToCardinal ;
BEGIN
IF gcc=GetErrorNode()
IF USEPOISON
THEN
t := PtrToCardinal(gcc) ;
- IF (gcc#Tree(NIL)) AND (t^=GGCPOISON)
+ IF (gcc#tree(NIL)) AND (t^=GGCPOISON)
THEN
InternalError ('gcc symbol has been poisoned')
END
END ;
old := Mod2Gcc(sym) ;
- IF old=Tree(NIL)
+ IF old=tree(NIL)
THEN
(* absent - add it *)
PutIndice(mod2gcc, sym, gcc) ;
whether the gcc symbol has been poisoned.
*)
-PROCEDURE Mod2GccWithoutGCCPoison (sym: CARDINAL) : Tree ;
+PROCEDURE Mod2GccWithoutGCCPoison (sym: CARDINAL) : tree ;
VAR
n : Name ;
- tr: Tree ;
+ tr: tree ;
BEGIN
IF InBounds(mod2gcc, sym)
THEN
- tr := Tree(GetIndice(mod2gcc, sym)) ;
+ tr := tree(GetIndice(mod2gcc, sym)) ;
IF tr=PoisonedSymbol
THEN
n := GetSymName(sym) ;
FROM SYSTEM IMPORT WORD ;
FROM SymbolKey IMPORT PerformOperation ;
FROM NameKey IMPORT Name ;
-FROM m2tree IMPORT Tree ;
+FROM gcctypes IMPORT tree ;
FROM DynamicStrings IMPORT String ;
FROM M2Error IMPORT ErrorScope ;
FROM Lists IMPORT List ;
PutModuleFinallyFunction - Places Tree, finally, into the Module symbol, Sym.
*)
-PROCEDURE PutModuleFinallyFunction (Sym: CARDINAL; finally: Tree) ;
+PROCEDURE PutModuleFinallyFunction (Sym: CARDINAL; finally: tree) ;
(*
GetModuleFinallyFunction - returns the finally tree from the Module symbol, Sym.
*)
-PROCEDURE GetModuleFinallyFunction (Sym: CARDINAL) : Tree ;
+PROCEDURE GetModuleFinallyFunction (Sym: CARDINAL) : tree ;
(*
PutIndice, GetIndice, InitIndexTuned ;
FROM Sets IMPORT Set, InitSet, IncludeElementIntoSet, IsElementInSet ;
-FROM m2linemap IMPORT location_t ;
+FROM gcctypes IMPORT location_t ;
FROM M2Options IMPORT Pedantic, ExtendedOpaque,
GetDebugFunctionLineNumbers, ScaffoldDynamic,
FROM M2System IMPORT Address ;
FROM m2expr IMPORT OverflowZType ;
-FROM m2tree IMPORT Tree ;
+FROM gcctypes IMPORT tree ;
FROM m2linemap IMPORT BuiltinsLocation ;
FROM StrLib IMPORT StrEqual ;
FROM m2builtins IMPORT BuiltinExists ;
StartFinishQuad: CARDINAL ; (* Signify the finalization *)
(* code. *)
EndFinishQuad : CARDINAL ; (* should point to a finish *)
- FinallyFunction: Tree ; (* The GCC function for finally *)
+ FinallyFunction: tree ; (* The GCC function for finally *)
ExceptionFinally,
ExceptionBlock: BOOLEAN ; (* does it have an exception? *)
ContainsHiddenType: BOOLEAN ;(* True if this module *)
StartFinishQuad: CARDINAL ; (* Signify the finalization *)
(* code. *)
EndFinishQuad : CARDINAL ; (* should point to a finish *)
- FinallyFunction: Tree ; (* The GCC function for finally *)
+ FinallyFunction: tree ; (* The GCC function for finally *)
ExceptionFinally,
ExceptionBlock: BOOLEAN ; (* does it have an exception? *)
ModLink : BOOLEAN ; (* Is the module parsed for *)
PutModuleFinallyFunction - Places Tree, finally, into the Module symbol, Sym.
*)
-PROCEDURE PutModuleFinallyFunction (Sym: CARDINAL; finally: Tree) ;
+PROCEDURE PutModuleFinallyFunction (Sym: CARDINAL; finally: tree) ;
VAR
pSym: PtrToSymbol ;
BEGIN
GetModuleFinallyFunction - returns the finally tree from the Module symbol, Sym.
*)
-PROCEDURE GetModuleFinallyFunction (Sym: CARDINAL) : Tree ;
+PROCEDURE GetModuleFinallyFunction (Sym: CARDINAL) : tree ;
VAR
pSym: PtrToSymbol ;
BEGIN
*)
FROM SYSTEM IMPORT ADDRESS ;
-FROM m2linemap IMPORT location_t ;
+FROM gcctypes IMPORT location_t ;
EXPORT QUALIFIED GetToken, M2Error, OpenSource, CloseSource, GetLineNo,
GetColumnNo, GetLocation, GetTotalLines ;
--- /dev/null
+(* CDataTypes provides a placeholder module for C address types.
+
+Copyright (C) 2024 Free Software Foundation, Inc.
+Contributed by Gaius Mulley <gaiusmod2@gmail.com>.
+
+This file is part of GNU Modula-2.
+
+GNU Modula-2 is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GNU Modula-2 is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Modula-2; see the file COPYING3. If not see
+<http://www.gnu.org/licenses/>. *)
+
+DEFINITION MODULE CDataTypes ; (*!m2pim*)
+
+FROM SYSTEM IMPORT ADDRESS ;
+
+EXPORT UNQUALIFIED CharStar, ConstCharStar ;
+
+TYPE
+ CharStar = ADDRESS ;
+ ConstCharStar = ADDRESS ;
+
+
+END CDataTypes.
--- /dev/null
+(* gcctypes provides a placeholder module for gcc declared data types.
+
+Copyright (C) 2024 Free Software Foundation, Inc.
+Contributed by Gaius Mulley <gaiusmod2@gmail.com>.
+
+This file is part of GNU Modula-2.
+
+GNU Modula-2 is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 3, or (at your option)
+any later version.
+
+GNU Modula-2 is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Modula-2; see the file COPYING3. If not see
+<http://www.gnu.org/licenses/>. *)
+
+DEFINITION MODULE gcctypes ;
+
+FROM SYSTEM IMPORT ADDRESS ;
+
+EXPORT UNQUALIFIED location_t, tree ;
+
+
+TYPE
+ (* Not declared here by the bootstrap tool mc when
+ --gcc-config-system is used. *)
+ location_t = CARDINAL ;
+ tree = ADDRESS ;
+
+
+END gcctypes.
DEFINITION MODULE FOR "C" init ;
-FROM SYSTEM IMPORT ADDRESS ;
+FROM CDataTypes IMPORT ConstCharStar ;
(*
This is to be called every time we compile a new file.
*)
-PROCEDURE PerCompilationInit (filename: ADDRESS) ;
+PROCEDURE PerCompilationInit (filename: ConstCharStar) ;
END init.
DEFINITION MODULE FOR "C" m2block ;
-
-FROM m2tree IMPORT Tree ;
-FROM m2linemap IMPORT location_t ;
-FROM SYSTEM IMPORT ADDRESS ;
+FROM gcctypes IMPORT location_t, tree ;
+FROM CDataTypes IMPORT CharStar ;
(*
in the global binding level.
*)
-PROCEDURE global_constant (t: Tree) : Tree ;
+PROCEDURE global_constant (t: tree) : tree ;
(*
inside the current_binding_level I suspect.
*)
-PROCEDURE RememberInitModuleFunction (t: Tree) : Tree ;
+PROCEDURE RememberInitModuleFunction (t: tree) : tree ;
(*
poisoned.
*)
-PROCEDURE DumpGlobalConstants () : Tree ;
+PROCEDURE DumpGlobalConstants () : tree ;
(*
can be used by many different functions if necessary.
*)
-PROCEDURE RememberConstant (t: Tree) : Tree ;
+PROCEDURE RememberConstant (t: tree) : tree ;
(*
RememberType - remember the type, t, in the ggc marked list.
*)
-PROCEDURE RememberType (t: Tree) : Tree ;
+PROCEDURE RememberType (t: tree) : tree ;
(*
pushDecl - pushes a declaration onto the current binding level.
*)
-PROCEDURE pushDecl (decl: Tree) : Tree ;
+PROCEDURE pushDecl (decl: tree) : tree ;
(*
binding level.
*)
-PROCEDURE popFunctionScope () : Tree ;
+PROCEDURE popFunctionScope () : tree ;
(*
pushFunctionScope - push a binding level.
*)
-PROCEDURE pushFunctionScope (fndecl: Tree) ;
+PROCEDURE pushFunctionScope (fndecl: tree) ;
(*
The cur_stmt_list is appended to the STATEMENT_LIST.
*)
-PROCEDURE finishFunctionCode (fndecl: Tree) ;
+PROCEDURE finishFunctionCode (fndecl: tree) ;
(*
containing the DECL_EXPR is also created.
*)
-PROCEDURE finishFunctionDecl (location: location_t; fndecl: Tree) ;
+PROCEDURE finishFunctionDecl (location: location_t; fndecl: tree) ;
(*
in the current scope.
*)
-PROCEDURE getLabel (location: location_t; name: ADDRESS) : Tree ;
+PROCEDURE getLabel (location: location_t; name: CharStar) : tree ;
(*
GetErrorNode - returns the gcc error_mark_node.
*)
-PROCEDURE GetErrorNode () : Tree ;
+PROCEDURE GetErrorNode () : tree ;
(*
it is not already present.
*)
-PROCEDURE includeDecl (decl: Tree) ;
+PROCEDURE includeDecl (decl: tree) ;
(*
GetGlobals - returns a list of global variables, functions, constants.
*)
-PROCEDURE GetGlobals () : Tree ;
+PROCEDURE GetGlobals () : tree ;
(*
GetGlobalContext - returns the global context tree.
*)
-PROCEDURE GetGlobalContext () : Tree ;
+PROCEDURE GetGlobalContext () : tree ;
(*
statement list and returns the list node.
*)
-PROCEDURE begin_statement_list () : Tree ;
+PROCEDURE begin_statement_list () : tree ;
(*
current binding level.
*)
-PROCEDURE push_statement_list (t: Tree) : Tree ;
+PROCEDURE push_statement_list (t: tree) : tree ;
(*
current binding level.
*)
-PROCEDURE pop_statement_list () : Tree ;
+PROCEDURE pop_statement_list () : tree ;
(*
DEFINITION MODULE FOR "C" m2builtins ;
-FROM SYSTEM IMPORT ADDRESS ;
-FROM m2tree IMPORT Tree ;
-FROM m2linemap IMPORT location_t ;
+FROM CDataTypes IMPORT CharStar, ConstCharStar ;
+FROM gcctypes IMPORT location_t, tree ;
EXPORT QUALIFIED GetBuiltinConst, GetBuiltinConstType,
GetBuiltinTypeInfoType, GetBuiltinTypeInfo,
NIL is returned if the constant is unknown.
*)
-PROCEDURE GetBuiltinConst (name: ADDRESS) : Tree ;
+PROCEDURE GetBuiltinConst (name: CharStar) : tree ;
(*
2 = real
*)
-PROCEDURE GetBuiltinConstType (name: ADDRESS) : CARDINAL ;
+PROCEDURE GetBuiltinConstType (name: CharStar) : CARDINAL ;
3 if ident is large, small.
*)
-PROCEDURE GetBuiltinTypeInfoType (ident: ADDRESS) : CARDINAL ;
+PROCEDURE GetBuiltinTypeInfoType (ident: ConstCharStar) : CARDINAL ;
(*
- GetBuiltinTypeInfo - returns a Tree value:
+ GetBuiltinTypeInfo - returns a tree value:
NULL_TREE if ident is unknown.
- boolean Tree if ident is IEC559, LIA1, ISO, IEEE, rounds, underflow,
+ boolean tree if ident is IEC559, LIA1, ISO, IEEE, rounds, underflow,
exception, extend.
- ZType Tree if ident is radix, places, exponentmin, exponentmax,
+ ZType tree if ident is radix, places, exponentmin, exponentmax,
noofmodes.
- RType Tree if ident is large, small.
+ RType tree if ident is large, small.
*)
-PROCEDURE GetBuiltinTypeInfo (location: location_t; type: Tree; ident: ADDRESS) : Tree ;
+PROCEDURE GetBuiltinTypeInfo (location: location_t; type: tree; ident: ConstCharStar) : tree ;
(*
for this target architecture.
*)
-PROCEDURE BuiltinExists (name: ADDRESS) : BOOLEAN ;
+PROCEDURE BuiltinExists (name: CharStar) : BOOLEAN ;
(*
- BuildBuiltinTree - returns a Tree containing the builtin function, name.
+ BuildBuiltinTree - returns a tree containing the builtin function, name.
*)
-PROCEDURE BuildBuiltinTree (location: location_t; name: ADDRESS) : Tree ;
+PROCEDURE BuildBuiltinTree (location: location_t; name: CharStar) : tree ;
(*
BuiltinMemCopy and BuiltinAlloca - are called by M2GenGCC to implement open arrays.
*)
-PROCEDURE BuiltinMemCopy (location: location_t; dest, src, n: Tree) : Tree ;
+PROCEDURE BuiltinMemCopy (location: location_t; dest, src, n: tree) : tree ;
(*
BuiltinMemSet is called by M2GenGCC to implement the set type.
*)
-PROCEDURE BuiltinMemSet (location: location_t; dest, bytevalue, nbytes: Tree) : Tree ;
+PROCEDURE BuiltinMemSet (location: location_t; dest, bytevalue, nbytes: tree) : tree ;
(*
of the current function.
*)
-PROCEDURE BuiltInAlloca (location: location_t; n: Tree) : Tree ;
+PROCEDURE BuiltInAlloca (location: location_t; n: tree) : tree ;
(*
- BuiltInIsfinite - given an expression, e, return an integer Tree of 1 if the
- value is finite. Return an integer Tree 0 if the value is
+ BuiltInIsfinite - given an expression, e, return an integer tree of 1 if the
+ value is finite. Return an integer tree 0 if the value is
not finite.
*)
-PROCEDURE BuiltInIsfinite (location: location_t; e: Tree) : Tree ;
+PROCEDURE BuiltInIsfinite (location: location_t; e: tree) : tree ;
END m2builtins.
DEFINITION MODULE FOR "C" m2convert ;
-FROM m2tree IMPORT Tree ;
-FROM m2linemap IMPORT location_t ;
+FROM gcctypes IMPORT location_t, tree ;
(*
a WORD.
*)
-PROCEDURE ToWord (location: location_t; expr: Tree) : Tree ;
+PROCEDURE ToWord (location: location_t; expr: tree) : tree ;
(*
ToCardinal - convert an expression, expr, to a CARDINAL.
*)
-PROCEDURE ToCardinal (location: location_t; expr: Tree) : Tree ;
+PROCEDURE ToCardinal (location: location_t; expr: tree) : tree ;
(*
ToInteger - convert an expression, expr, to an INTEGER.
*)
-PROCEDURE ToInteger (location: location_t; expr: Tree) : Tree ;
+PROCEDURE ToInteger (location: location_t; expr: tree) : tree ;
(*
ToBitset - convert an expression, expr, to a BITSET.
*)
-PROCEDURE ToBitset (location: location_t; expr: Tree) : Tree ;
+PROCEDURE ToBitset (location: location_t; expr: tree) : tree ;
(*
ConvertToPtr - convert an expression to a void *.
*)
-PROCEDURE ConvertToPtr (p: Tree) : Tree ;
+PROCEDURE ConvertToPtr (p: tree) : tree ;
(*
should suppress overflow checking.
*)
-PROCEDURE BuildConvert (location: location_t; type: Tree; value: Tree; checkOverflow: BOOLEAN) : Tree ;
+PROCEDURE BuildConvert (location: location_t; type: tree; value: tree; checkOverflow: BOOLEAN) : tree ;
(*
overflow checking is performed.
*)
-PROCEDURE ConvertConstantAndCheck (location: location_t; type: Tree; expr: Tree) : Tree ;
+PROCEDURE ConvertConstantAndCheck (location: location_t; type: tree; expr: tree) : tree ;
(*
ConvertString - converts string, expr, into a string of type, type.
*)
-PROCEDURE ConvertString (type, expr: Tree) : Tree ;
+PROCEDURE ConvertString (type, expr: tree) : tree ;
(*
expr is returned unaltered.
*)
-PROCEDURE GenericToType (location: location_t; type, expr: Tree) : Tree ;
+PROCEDURE GenericToType (location: location_t; type, expr: tree) : tree ;
END m2convert.
param_type_list. */
tree
-m2decl_BuildParameterDeclaration (location_t location, char *name, tree type,
+m2decl_BuildParameterDeclaration (location_t location, const char *name, tree type,
bool isreference)
{
tree parm_decl;
DEFINITION MODULE m2decl ;
FROM SYSTEM IMPORT ADDRESS ;
-FROM m2tree IMPORT Tree ;
-FROM m2linemap IMPORT location_t ;
+FROM gcctypes IMPORT location_t, tree ;
+FROM CDataTypes IMPORT ConstCharStar ;
(*
the dynamic linking scaffold.
*)
-PROCEDURE BuildModuleCtor (moduleCtor: Tree) ;
+PROCEDURE BuildModuleCtor (moduleCtor: tree) ;
(*
DeclareModuleCtor configures the function to be used as a ctor.
*)
-PROCEDURE DeclareModuleCtor (decl: Tree) : Tree ;
+PROCEDURE DeclareModuleCtor (decl: tree) : tree ;
*)
PROCEDURE DeclareM2linkForcedModuleInitOrder (location: location_t;
- RuntimeOverride: ADDRESS) : Tree ;
+ RuntimeOverride: ADDRESS) : tree ;
PROCEDURE DeclareM2linkStaticInitialization (location: location_t;
- ScaffoldStatic: INTEGER) : Tree ;
+ ScaffoldStatic: INTEGER) : tree ;
-PROCEDURE BuildPtrToTypeString (location: location_t; string: ADDRESS; type: Tree) : Tree ;
+PROCEDURE BuildPtrToTypeString (location: location_t; string: ADDRESS; type: tree) : tree ;
(*
BuildIntegerConstant - return a tree containing the integer value.
*)
-PROCEDURE BuildIntegerConstant (value: INTEGER) : Tree ;
+PROCEDURE BuildIntegerConstant (value: INTEGER) : tree ;
(*
BuildStringConstantType - builds a string constant with a type.
*)
-PROCEDURE BuildStringConstantType (length: INTEGER; string: ADDRESS; type: Tree) : Tree ;
+PROCEDURE BuildStringConstantType (length: INTEGER; string: ConstCharStar; type: tree) : tree ;
(*
isglobal is TRUE.
*)
-PROCEDURE DeclareKnownVariable (location: location_t; name: ADDRESS; type: Tree;
+PROCEDURE DeclareKnownVariable (location: location_t; name: ConstCharStar; type: tree;
exported, imported, istemporary, isglobal: BOOLEAN;
- scope, initial: Tree) : Tree ;
+ scope, initial: tree) : tree ;
(*
always be referenced.
*)
-PROCEDURE DeclareKnownConstant (location: location_t; type: Tree; value: Tree) : Tree ;
+PROCEDURE DeclareKnownConstant (location: location_t; type: tree; value: tree) : tree ;
(*
type declaration and we ignore names.
*)
-PROCEDURE BuildParameterDeclaration (location: location_t; name: ADDRESS; type: Tree;
- isreference: BOOLEAN) : Tree ;
+PROCEDURE BuildParameterDeclaration (location: location_t; name: ConstCharStar; type: tree;
+ isreference: BOOLEAN) : tree ;
(*
*)
PROCEDURE BuildEndFunctionDeclaration (location_begin, location_end: location_t;
- name: ADDRESS; returntype: Tree;
+ name: ConstCharStar; returntype: tree;
isexternal, isnested, ispublic,
- isnoreturn: BOOLEAN) : Tree ;
+ isnoreturn: BOOLEAN) : tree ;
(*
RememberVariables -
*)
-PROCEDURE RememberVariables (l: Tree) ;
+PROCEDURE RememberVariables (l: tree) ;
(*
*)
PROCEDURE BuildConstLiteralNumber (location: location_t;
- str: ADDRESS; base: CARDINAL;
- issueError: BOOLEAN) : Tree ;
+ str: ConstCharStar; base: CARDINAL;
+ issueError: BOOLEAN) : tree ;
(*
and, length.
*)
-PROCEDURE BuildStringConstant (string: ADDRESS; length: INTEGER) : Tree ;
+PROCEDURE BuildStringConstant (string: ConstCharStar; length: INTEGER) : tree ;
(*
and, length.
*)
-PROCEDURE BuildCStringConstant (string: ADDRESS; length: INTEGER) : Tree ;
+PROCEDURE BuildCStringConstant (string: ConstCharStar; length: INTEGER) : tree ;
-PROCEDURE GetDeclContext (t: Tree) : Tree ;
+PROCEDURE GetDeclContext (t: tree) : tree ;
END m2decl.
tree returntype, bool isexternal, bool isnested, bool ispublic,
bool isnoreturn);
EXTERN void m2decl_BuildStartFunctionDeclaration (bool uses_varargs);
-EXTERN tree m2decl_BuildParameterDeclaration (location_t location, char *name,
+EXTERN tree m2decl_BuildParameterDeclaration (location_t location, const char *name,
tree type, bool isreference);
EXTERN tree m2decl_DeclareKnownConstant (location_t location, tree type,
tree value);
DEFINITION MODULE FOR "C" m2except ;
-FROM m2tree IMPORT Tree ;
-FROM m2linemap IMPORT location_t ;
+FROM gcctypes IMPORT location_t, tree ;
(*
BuildThrow - builds a throw statement and return the tree.
*)
-PROCEDURE BuildThrow (location: location_t; t: Tree) : Tree ;
+PROCEDURE BuildThrow (location: location_t; t: tree) : tree ;
(*
BuildTryBegin - returns a tree representing the 'try' block.
*)
-PROCEDURE BuildTryBegin (location: location_t) : Tree ;
+PROCEDURE BuildTryBegin (location: location_t) : tree ;
(*
for the catch handlers.
*)
-PROCEDURE BuildTryEnd (tryBlock: Tree) ;
+PROCEDURE BuildTryEnd (tryBlock: tree) ;
(*
It returns the handler tree.
*)
-PROCEDURE BuildCatchBegin (location: location_t) : Tree ;
+PROCEDURE BuildCatchBegin (location: location_t) : tree ;
(*
'}' which matches the catch above.
*)
-PROCEDURE BuildCatchEnd (location: location_t; handler, tryBlock: Tree) : Tree ;
+PROCEDURE BuildCatchEnd (location: location_t; handler, tryBlock: tree) : tree ;
END m2except.
DEFINITION MODULE FOR "C" m2expr ;
-FROM SYSTEM IMPORT ADDRESS ;
-FROM m2tree IMPORT Tree ;
-FROM m2linemap IMPORT location_t ;
+FROM gcctypes IMPORT location_t, tree ;
+FROM CDataTypes IMPORT CharStar, ConstCharStar ;
TYPE
- BuildBinCheckProcedure = PROCEDURE (location_t, Tree, Tree, Tree, Tree, Tree) : Tree ;
- BuildBinProcedure = PROCEDURE (location_t, Tree, Tree, BOOLEAN) : Tree ;
- BuildUnaryProcedure = PROCEDURE (location_t, Tree, BOOLEAN) : Tree ;
- BuildUnaryCheckProcedure = PROCEDURE (location_t, Tree, Tree, Tree, Tree) : Tree ;
- BuildExprProcedure = PROCEDURE (location_t, Tree, Tree) : Tree ;
- BuildSetProcedure = PROCEDURE (location_t, Tree, Tree, Tree, Tree, BOOLEAN) ;
- BuildUnarySetProcedure = PROCEDURE (location_t, Tree, BOOLEAN) ;
- BuildUnarySetFunction = PROCEDURE (location_t, Tree, BOOLEAN) : Tree ;
+ BuildBinCheckProcedure = PROCEDURE (location_t, tree, tree, tree, tree, tree) : tree ;
+ BuildBinProcedure = PROCEDURE (location_t, tree, tree, BOOLEAN) : tree ;
+ BuildUnaryProcedure = PROCEDURE (location_t, tree, BOOLEAN) : tree ;
+ BuildUnaryCheckProcedure = PROCEDURE (location_t, tree, tree, tree, tree) : tree ;
+ BuildExprProcedure = PROCEDURE (location_t, tree, tree) : tree ;
+ BuildSetProcedure = PROCEDURE (location_t, tree, tree, tree, tree, BOOLEAN) ;
+ BuildUnarySetProcedure = PROCEDURE (location_t, tree, BOOLEAN) ;
+ BuildUnarySetFunction = PROCEDURE (location_t, tree, BOOLEAN) : tree ;
(*
The string returned will have been malloc'd.
*)
-PROCEDURE CSTIntToString (t: Tree) : ADDRESS ;
+PROCEDURE CSTIntToString (t: tree) : CharStar ;
+
(*
CSTIntToChar - return the CHAR representation of tree t.
*)
-PROCEDURE CSTIntToChar (t: Tree) : CHAR ;
+PROCEDURE CSTIntToChar (t: tree) : CHAR ;
PROCEDURE CheckConstStrZtypeRange (location: location_t;
- str: ADDRESS; base: CARDINAL) : BOOLEAN ;
+ str: CharStar; base: CARDINAL) : BOOLEAN ;
(*
CompareTrees - returns -1 if e1 < e2, 0 if e1 == e2, and 1 if e1 > e2.
*)
-PROCEDURE CompareTrees (e1: Tree; e2: Tree) : INTEGER ;
+PROCEDURE CompareTrees (e1: tree; e2: tree) : INTEGER ;
-PROCEDURE GetPointerOne (location: location_t) : Tree ;
+PROCEDURE GetPointerOne (location: location_t) : tree ;
-PROCEDURE GetPointerZero (location: location_t) : Tree ;
+PROCEDURE GetPointerZero (location: location_t) : tree ;
-PROCEDURE GetWordOne (location: location_t) : Tree ;
+PROCEDURE GetWordOne (location: location_t) : tree ;
-PROCEDURE GetWordZero (location: location_t) : Tree ;
+PROCEDURE GetWordZero (location: location_t) : tree ;
-PROCEDURE GetIntegerOne (location: location_t) : Tree ;
+PROCEDURE GetIntegerOne (location: location_t) : tree ;
-PROCEDURE GetIntegerZero (location: location_t) : Tree ;
+PROCEDURE GetIntegerZero (location: location_t) : tree ;
-PROCEDURE GetCardinalOne (location: location_t) : Tree ;
+PROCEDURE GetCardinalOne (location: location_t) : tree ;
-PROCEDURE GetCardinalZero (location: location_t) : Tree ;
+PROCEDURE GetCardinalZero (location: location_t) : tree ;
-PROCEDURE GetSizeOfInBits (type: Tree) : Tree ;
+PROCEDURE GetSizeOfInBits (type: tree) : tree ;
-PROCEDURE GetSizeOf (location: location_t; type: Tree) : Tree ;
+PROCEDURE GetSizeOf (location: location_t; type: tree) : tree ;
(*
for a fundamental data type.
*)
-PROCEDURE BuildLogicalRotate (location: location_t; op1: Tree; op2: Tree; op3: Tree; nBits: Tree; needconvert: BOOLEAN) ;
+PROCEDURE BuildLogicalRotate (location: location_t; op1: tree; op2: tree; op3: tree; nBits: tree; needconvert: BOOLEAN) ;
(*
it rotates a set of size, nBits.
*)
-PROCEDURE BuildLRRn (location: location_t; op1: Tree; op2: Tree; nBits: Tree; needconvert: BOOLEAN) : Tree ;
+PROCEDURE BuildLRRn (location: location_t; op1: tree; op2: tree; nBits: tree; needconvert: BOOLEAN) : tree ;
(*
it rotates a set of size, nBits.
*)
-PROCEDURE BuildLRLn (location: location_t; op1: Tree; op2: Tree; nBits: Tree; needconvert: BOOLEAN) : Tree ;
+PROCEDURE BuildLRLn (location: location_t; op1: tree; op2: tree; nBits: tree; needconvert: BOOLEAN) : tree ;
-PROCEDURE BuildMask (location: location_t; nBits: Tree; needconvert: BOOLEAN) : Tree ;
+PROCEDURE BuildMask (location: location_t; nBits: tree; needconvert: BOOLEAN) : tree ;
(*
BuildMult - builds a multiplication tree.
*)
-PROCEDURE BuildMult (location: location_t; op1: Tree; op2: Tree; needconvert: BOOLEAN) : Tree ;
+PROCEDURE BuildMult (location: location_t; op1: tree; op2: tree; needconvert: BOOLEAN) : tree ;
(*
BuildMultCheck - builds a multiplication tree after checking for overflow.
*)
-PROCEDURE BuildMultCheck (location: location_t; op1, op2, lowest, min, max: Tree) : Tree ;
+PROCEDURE BuildMultCheck (location: location_t; op1, op2, lowest, min, max: tree) : tree ;
(*
BuildLRR - builds and returns tree (op1 rotate right by op2 bits)
*)
-PROCEDURE BuildLRR (location: location_t; op1: Tree; op2: Tree; needconvert: BOOLEAN) : Tree ;
+PROCEDURE BuildLRR (location: location_t; op1: tree; op2: tree; needconvert: BOOLEAN) : tree ;
(*
BuildLRL - builds and returns tree (op1 rotate left by op2 bits)
*)
-PROCEDURE BuildLRL (location: location_t; op1: Tree; op2: Tree; needconvert: BOOLEAN) : Tree ;
+PROCEDURE BuildLRL (location: location_t; op1: tree; op2: tree; needconvert: BOOLEAN) : tree ;
(*
for a fundamental data type.
*)
-PROCEDURE BuildLogicalShift (location: location_t; op1: Tree; op2: Tree; op3: Tree; nBits: Tree; needconvert: BOOLEAN) ;
+PROCEDURE BuildLogicalShift (location: location_t; op1: tree; op2: tree; op3: tree; nBits: tree; needconvert: BOOLEAN) ;
(*
BuildLSR - builds and returns tree (op1 >> op2)
*)
-PROCEDURE BuildLSR (location: location_t; op1: Tree; op2: Tree; needconvert: BOOLEAN) : Tree ;
+PROCEDURE BuildLSR (location: location_t; op1: tree; op2: tree; needconvert: BOOLEAN) : tree ;
(*
BuildLSL - builds and returns tree (op1 << op2)
*)
-PROCEDURE BuildLSL (location: location_t; op1: Tree; op2: Tree; needconvert: BOOLEAN) : Tree ;
+PROCEDURE BuildLSL (location: location_t; op1: tree; op2: tree; needconvert: BOOLEAN) : tree ;
(*
return op1 div trunc op2
*)
-PROCEDURE BuildDivM2 (location: location_t; op1, op2: Tree; needsconvert: BOOLEAN) : Tree ;
+PROCEDURE BuildDivM2 (location: location_t; op1, op2: tree; needsconvert: BOOLEAN) : tree ;
(*
return op1 div trunc op2. Use the checking div equivalents.
*)
-PROCEDURE BuildDivM2Check (location: location_t; op1, op2, lowest, min, max: Tree) : Tree ;
+PROCEDURE BuildDivM2Check (location: location_t; op1, op2, lowest, min, max: tree) : tree ;
(*
return op1 div trunc op2
*)
-PROCEDURE BuildModM2 (location: location_t; op1, op2: Tree; needsconvert: BOOLEAN) : Tree ;
+PROCEDURE BuildModM2 (location: location_t; op1, op2: tree; needsconvert: BOOLEAN) : tree ;
(*
return op1 div trunc op2. Use the checking div equivalents.
*)
-PROCEDURE BuildModM2Check (location: location_t; op1, op2, lowest, min, max: Tree) : Tree ;
+PROCEDURE BuildModM2Check (location: location_t; op1, op2, lowest, min, max: tree) : tree ;
(*
BuildModFloor - builds a modulus tree.
*)
-PROCEDURE BuildModFloor (location: location_t; op1: Tree; op2: Tree; needconvert: BOOLEAN) : Tree ;
+PROCEDURE BuildModFloor (location: location_t; op1: tree; op2: tree; needconvert: BOOLEAN) : tree ;
(*
BuildDivCeil - builds a division tree.
*)
-PROCEDURE BuildDivCeil (location: location_t; op1: Tree; op2: Tree; needconvert: BOOLEAN) : Tree ;
+PROCEDURE BuildDivCeil (location: location_t; op1: tree; op2: tree; needconvert: BOOLEAN) : tree ;
(*
BuildModCeil - builds a modulus tree.
*)
-PROCEDURE BuildModCeil (location: location_t; op1: Tree; op2: Tree; needconvert: BOOLEAN) : Tree ;
+PROCEDURE BuildModCeil (location: location_t; op1: tree; op2: tree; needconvert: BOOLEAN) : tree ;
(*
BuildDivFloor - builds a division tree.
*)
-PROCEDURE BuildDivFloor (location: location_t; op1: Tree; op2: Tree; needconvert: BOOLEAN) : Tree ;
+PROCEDURE BuildDivFloor (location: location_t; op1: tree; op2: tree; needconvert: BOOLEAN) : tree ;
(*
BuildModTrunc - builds a modulus tree.
*)
-PROCEDURE BuildModTrunc (location: location_t; op1: Tree; op2: Tree; needconvert: BOOLEAN) : Tree ;
+PROCEDURE BuildModTrunc (location: location_t; op1: tree; op2: tree; needconvert: BOOLEAN) : tree ;
(*
BuildDivTrunc - builds a division tree.
*)
-PROCEDURE BuildDivTrunc (location: location_t; op1: Tree; op2: Tree; needconvert: BOOLEAN) : Tree ;
+PROCEDURE BuildDivTrunc (location: location_t; op1: tree; op2: tree; needconvert: BOOLEAN) : tree ;
(*
BuildDivTruncCheck - builds a division tree after checking for overflow.
*)
-PROCEDURE BuildDivTruncCheck (location: location_t; op1, op2, lowest, min, max: Tree) : Tree ;
+PROCEDURE BuildDivTruncCheck (location: location_t; op1, op2, lowest, min, max: tree) : tree ;
(*
types and NEVER for integer based types).
*)
-PROCEDURE BuildRDiv (location: location_t; op1, op2: Tree; needconvert: BOOLEAN) : Tree ;
+PROCEDURE BuildRDiv (location: location_t; op1, op2: tree; needconvert: BOOLEAN) : tree ;
(*
BuildSubCheck - builds a subtraction tree after checking for overflow.
*)
-PROCEDURE BuildSubCheck (location: location_t; op1, op2, lowest, min, max: Tree) : Tree ;
+PROCEDURE BuildSubCheck (location: location_t; op1, op2, lowest, min, max: tree) : tree ;
(*
BuildAddCheck - builds an addition tree after checking for overflow.
*)
-PROCEDURE BuildAddCheck (location: location_t; op1, op2, lowest, min, max: Tree) : Tree ;
+PROCEDURE BuildAddCheck (location: location_t; op1, op2, lowest, min, max: tree) : tree ;
(*
BuildSub - builds a subtraction tree.
*)
-PROCEDURE BuildSub (location: location_t; op1: Tree; op2: Tree; needconvert: BOOLEAN) : Tree ;
+PROCEDURE BuildSub (location: location_t; op1: tree; op2: tree; needconvert: BOOLEAN) : tree ;
(*
BuildAdd - builds an addition tree.
*)
-PROCEDURE BuildAdd (location: location_t; op1: Tree; op2: Tree; needconvert: BOOLEAN) : Tree ;
+PROCEDURE BuildAdd (location: location_t; op1: tree; op2: tree; needconvert: BOOLEAN) : tree ;
(*
FoldAndStrip - return expression, t, after it has been folded (if possible).
*)
-PROCEDURE FoldAndStrip (t: Tree) : Tree ;
+PROCEDURE FoldAndStrip (t: tree) : tree ;
(*
of, string.
*)
-PROCEDURE StringLength (string: Tree) : CARDINAL ;
+PROCEDURE StringLength (string: tree) : CARDINAL ;
(*
is emitted and no modification is made to, t.
*)
-PROCEDURE TreeOverflow (t: Tree) : BOOLEAN ;
+PROCEDURE TreeOverflow (t: tree) : BOOLEAN ;
(*
any overflow flag and returns, t.
*)
-PROCEDURE RemoveOverflow (t: Tree) : Tree ;
+PROCEDURE RemoveOverflow (t: tree) : tree ;
(*
it has been coersed to, type.
*)
-PROCEDURE BuildCoerce (location: location_t; des: Tree; type: Tree; expr: Tree) : Tree ;
+PROCEDURE BuildCoerce (location: location_t; des: tree; type: tree; expr: tree) : tree ;
(*
BuildTrunc - returns an integer expression from a REAL or LONGREAL op1.
*)
-PROCEDURE BuildTrunc (op1: Tree) : Tree ;
+PROCEDURE BuildTrunc (op1: tree) : tree ;
(*
BuildNegate - builds a negate expression and returns the tree.
*)
-PROCEDURE BuildNegate (location: location_t; op1: Tree; needconvert: BOOLEAN) : Tree ;
+PROCEDURE BuildNegate (location: location_t; op1: tree; needconvert: BOOLEAN) : tree ;
(*
BuildNegateCheck - builds a negate expression and returns the tree.
*)
-PROCEDURE BuildNegateCheck (location: location_t; arg, lowest, min, max: Tree) : Tree ;
+PROCEDURE BuildNegateCheck (location: location_t; arg, lowest, min, max: tree) : tree ;
(*
BuildSetNegate - builds a set negate expression and returns the tree.
*)
-PROCEDURE BuildSetNegate (location: location_t; op1: Tree; needconvert: BOOLEAN) : Tree ;
+PROCEDURE BuildSetNegate (location: location_t; op1: tree; needconvert: BOOLEAN) : tree ;
(*
BuildTBitSize - returns the minimum number of bits to represent, type.
*)
-PROCEDURE BuildTBitSize (location: location_t; type: Tree) : Tree ;
+PROCEDURE BuildTBitSize (location: location_t; type: tree) : tree ;
(*
BuildSize - builds a SIZE function expression and returns the tree.
*)
-PROCEDURE BuildSize (location: location_t; op1: Tree; needconvert: BOOLEAN) : Tree ;
+PROCEDURE BuildSize (location: location_t; op1: tree; needconvert: BOOLEAN) : tree ;
(*
op1 and returns the tree.
*)
-PROCEDURE BuildAddr (location: location_t; op1: Tree; needconvert: BOOLEAN) : Tree ;
+PROCEDURE BuildAddr (location: location_t; op1: tree; needconvert: BOOLEAN) : tree ;
(*
The expression is returned.
*)
-PROCEDURE BuildOffset1 (location: location_t; field: Tree; needconvert: BOOLEAN) : Tree ;
+PROCEDURE BuildOffset1 (location: location_t; field: tree; needconvert: BOOLEAN) : tree ;
(*
The expression is returned.
*)
-PROCEDURE BuildOffset (location: location_t; record: Tree; field: Tree; needconvert: BOOLEAN) : Tree ;
+PROCEDURE BuildOffset (location: location_t; record: tree; field: tree; needconvert: BOOLEAN) : tree ;
(*
BuildLogicalOrAddress - build a logical or expressions and return the tree.
*)
-PROCEDURE BuildLogicalOrAddress (location: location_t; op1: Tree; op2: Tree; needconvert: BOOLEAN) : Tree ;
+PROCEDURE BuildLogicalOrAddress (location: location_t; op1: tree; op2: tree; needconvert: BOOLEAN) : tree ;
(*
BuildLogicalOr - build a logical or expressions and return the tree.
*)
-PROCEDURE BuildLogicalOr (location: location_t; op1: Tree; op2: Tree; needconvert: BOOLEAN) : Tree ;
+PROCEDURE BuildLogicalOr (location: location_t; op1: tree; op2: tree; needconvert: BOOLEAN) : tree ;
(*
BuildLogicalAnd - build a logical and expression and return the tree.
*)
-PROCEDURE BuildLogicalAnd (location: location_t; op1: Tree; op2: Tree; needconvert: BOOLEAN) : Tree ;
+PROCEDURE BuildLogicalAnd (location: location_t; op1: tree; op2: tree; needconvert: BOOLEAN) : tree ;
-PROCEDURE BuildSymmetricDifference (location: location_t; op1: Tree; op2: Tree; needconvert: BOOLEAN) : Tree ;
+PROCEDURE BuildSymmetricDifference (location: location_t; op1: tree; op2: tree; needconvert: BOOLEAN) : tree ;
(*
(op1 and (not op2))
*)
-PROCEDURE BuildLogicalDifference (location: location_t; op1: Tree; op2: Tree; needconvert: BOOLEAN) : Tree ;
+PROCEDURE BuildLogicalDifference (location: location_t; op1: tree; op2: tree; needconvert: BOOLEAN) : tree ;
(*
BuildLessThan - return a tree which computes <
*)
-PROCEDURE BuildLessThan (location: location_t; op1: Tree; op2: Tree) : Tree ;
+PROCEDURE BuildLessThan (location: location_t; op1: tree; op2: tree) : tree ;
(*
BuildGreaterThan - return a tree which computes >
*)
-PROCEDURE BuildGreaterThan (location: location_t; op1: Tree; op2: Tree) : Tree ;
+PROCEDURE BuildGreaterThan (location: location_t; op1: tree; op2: tree) : tree ;
(*
BuildLessThanOrEqual - return a tree which computes <
*)
-PROCEDURE BuildLessThanOrEqual (location: location_t; op1: Tree; op2: Tree) : Tree ;
+PROCEDURE BuildLessThanOrEqual (location: location_t; op1: tree; op2: tree) : tree ;
(*
BuildGreaterThanOrEqual - return a tree which computes >=
*)
-PROCEDURE BuildGreaterThanOrEqual (location: location_t; op1: Tree; op2: Tree) : Tree ;
+PROCEDURE BuildGreaterThanOrEqual (location: location_t; op1: tree; op2: tree) : tree ;
(*
BuildEqualTo - return a tree which computes =
*)
-PROCEDURE BuildEqualTo (location: location_t; op1: Tree; op2: Tree) : Tree ;
+PROCEDURE BuildEqualTo (location: location_t; op1: tree; op2: tree) : tree ;
-PROCEDURE BuildNotEqualTo (location: location_t; op1: Tree; op2: Tree) : Tree ;
+PROCEDURE BuildNotEqualTo (location: location_t; op1: tree; op2: tree) : tree ;
(*
BuildIsSuperset - return a tree which computes: op1 & op2 == op2
*)
-PROCEDURE BuildIsSuperset (location: location_t; op1: Tree; op2: Tree) : Tree ;
+PROCEDURE BuildIsSuperset (location: location_t; op1: tree; op2: tree) : tree ;
(*
BuildIsNotSuperset - return a tree which computes: op1 & op2 != op2
*)
-PROCEDURE BuildIsNotSuperset (location: location_t; op1: Tree; op2: Tree) : Tree ;
+PROCEDURE BuildIsNotSuperset (location: location_t; op1: tree; op2: tree) : tree ;
(*
BuildIsSubset - return a tree which computes: op1 & op2 == op1
*)
-PROCEDURE BuildIsSubset (location: location_t; op1: Tree; op2: Tree) : Tree ;
+PROCEDURE BuildIsSubset (location: location_t; op1: tree; op2: tree) : tree ;
(*
BuildIsNotSubset - return a tree which computes: op1 & op2 != op1
*)
-PROCEDURE BuildIsNotSubset (location: location_t; op1: Tree; op2: Tree) : Tree ;
+PROCEDURE BuildIsNotSubset (location: location_t; op1: tree; op2: tree) : tree ;
(*
BuildIfConstInVar - generates: if constel in varset then goto label.
*)
-PROCEDURE BuildIfConstInVar (location: location_t; type: Tree; varset: Tree; constel: Tree; is_lvalue: BOOLEAN; fieldno: INTEGER; label: ADDRESS) ;
+PROCEDURE BuildIfConstInVar (location: location_t; type: tree; varset: tree; constel: tree; is_lvalue: BOOLEAN; fieldno: INTEGER; label: CharStar) ;
-PROCEDURE BuildIfNotConstInVar (location: location_t; type: Tree; varset: Tree; constel: Tree; is_lvalue: BOOLEAN; fieldno: INTEGER; label: ADDRESS) ;
+PROCEDURE BuildIfNotConstInVar (location: location_t; type: tree; varset: tree; constel: tree; is_lvalue: BOOLEAN; fieldno: INTEGER; label: CharStar) ;
(*
BuildIfVarInVar - generates: if varel in varset then goto label
*)
-PROCEDURE BuildIfVarInVar (location: location_t; type: Tree; varset: Tree; varel: Tree; is_lvalue: BOOLEAN; low: Tree; high: Tree; label: ADDRESS) ;
+PROCEDURE BuildIfVarInVar (location: location_t; type: tree; varset: tree; varel: tree; is_lvalue: BOOLEAN; low: tree; high: tree; label: CharStar) ;
(*
BuildIfNotVarInVar - generates: if not (varel in varset) then goto label
*)
-PROCEDURE BuildIfNotVarInVar (location: location_t; type: Tree; varset: Tree; varel: Tree; is_lvalue: BOOLEAN; low: Tree; high: Tree; label: ADDRESS) ;
+PROCEDURE BuildIfNotVarInVar (location: location_t; type: tree; varset: tree; varel: tree; is_lvalue: BOOLEAN; low: tree; high: tree; label: CharStar) ;
(*
*)
PROCEDURE BuildForeachWordInSetDoIfExpr (location: location_t;
- type, op1, op2: Tree;
+ type, op1, op2: tree;
is_op1lvalue, is_op2lvalue,
is_op1const, isop2const: BOOLEAN;
- expr: BuildExprProcedure; label: ADDRESS) ;
+ expr: BuildExprProcedure; label: CharStar) ;
(*
BuildIfInRangeGoto - if var is in the range low..high then goto label
*)
-PROCEDURE BuildIfInRangeGoto (location: location_t; var: Tree; low: Tree; high: Tree; label: ADDRESS) ;
+PROCEDURE BuildIfInRangeGoto (location: location_t; var: tree; low: tree; high: tree; label: CharStar) ;
(*
BuildIfNotInRangeGoto - if var is not in the range low..high then goto label
*)
-PROCEDURE BuildIfNotInRangeGoto (location: location_t; var: Tree; low: Tree; high: Tree; label: ADDRESS) ;
+PROCEDURE BuildIfNotInRangeGoto (location: location_t; var: tree; low: tree; high: tree; label: CharStar) ;
(*
given, lowIndice.
*)
-PROCEDURE BuildArray (location: location_t; type: Tree; array: Tree; index: Tree; lowIndice: Tree) : Tree ;
+PROCEDURE BuildArray (location: location_t; type: tree; array: tree; index: tree; lowIndice: tree) : tree ;
(*
BuildComponentRef on the penultimate field.
*)
-PROCEDURE BuildComponentRef (location: location_t; record: Tree; field: Tree) : Tree ;
+PROCEDURE BuildComponentRef (location: location_t; record: tree; field: tree) : tree ;
(*
BuildIndirect - build: ( *target) given that the object to be copied is of, type.
*)
-PROCEDURE BuildIndirect (location: location_t; target: Tree; type: Tree) : Tree ;
+PROCEDURE BuildIndirect (location: location_t; target: tree; type: tree) : tree ;
(*
IsTrue - returns TRUE if, t, is known to be TRUE.
*)
-PROCEDURE IsTrue (t: Tree) : BOOLEAN ;
+PROCEDURE IsTrue (t: tree) : BOOLEAN ;
(*
IsFalse - returns FALSE if, t, is known to be FALSE.
*)
-PROCEDURE IsFalse (t: Tree) : BOOLEAN ;
+PROCEDURE IsFalse (t: tree) : BOOLEAN ;
(*
GetCstInteger - return the integer value of the cst tree.
*)
-PROCEDURE GetCstInteger (cst: Tree) : INTEGER ;
+PROCEDURE GetCstInteger (cst: tree) : INTEGER ;
(*
TRUE if the value of e1 is the same as e2.
*)
-PROCEDURE AreConstantsEqual (e1: Tree; e2: Tree) : BOOLEAN ;
+PROCEDURE AreConstantsEqual (e1: tree; e2: tree) : BOOLEAN ;
(*
-0 == 0 and NaN != NaN.
*)
-PROCEDURE AreRealOrComplexConstantsEqual (e1: Tree; e2: Tree) : BOOLEAN ;
+PROCEDURE AreRealOrComplexConstantsEqual (e1: tree; e2: tree) : BOOLEAN ;
(*
an unsigned constant will never return -1
*)
-PROCEDURE DetermineSign (e: Tree) : INTEGER ;
+PROCEDURE DetermineSign (e: tree) : INTEGER ;
(*
BuildCap - builds the Modula-2 function CAP(t) and returns
- the result in a gcc Tree.
+ the result in a gcc tree.
*)
-PROCEDURE BuildCap (location: location_t; t: Tree) : Tree ;
+PROCEDURE BuildCap (location: location_t; t: tree) : tree ;
(*
BuildAbs - builds the Modula-2 function ABS(t) and returns
- the result in a gcc Tree.
+ the result in a gcc tree.
*)
-PROCEDURE BuildAbs (location: location_t; t: Tree) : Tree ;
+PROCEDURE BuildAbs (location: location_t; t: tree) : tree ;
(*
BuildRe - builds an expression for the function RE.
*)
-PROCEDURE BuildRe (op1: Tree) : Tree ;
+PROCEDURE BuildRe (op1: tree) : tree ;
(*
BuildIm - builds an expression for the function IM.
*)
-PROCEDURE BuildIm (op1: Tree) : Tree ;
+PROCEDURE BuildIm (op1: tree) : tree ;
(*
BuildCmplx - builds an expression for the function CMPLX.
*)
-PROCEDURE BuildCmplx (location: location_t; type: Tree; real: Tree; imag: Tree) : Tree ;
+PROCEDURE BuildCmplx (location: location_t; type: tree; real: tree; imag: tree) : tree ;
(*
*)
PROCEDURE BuildBinaryForeachWordDo (location: location_t;
- type, op1, op2, op3: Tree;
+ type, op1, op2, op3: tree;
binop: BuildBinProcedure;
is_op1lvalue,
is_op2lvalue,
*)
PROCEDURE BuildBinarySetDo (location: location_t;
- settype, op1, op2, op3: Tree;
+ settype, op1, op2, op3: tree;
binop: BuildSetProcedure;
is_op1lvalue, is_op2lvalue, is_op3lvalue: BOOLEAN;
- nBits, unbounded: Tree;
- varproc, leftproc, rightproc: Tree) ;
+ nBits, unbounded: tree;
+ varproc, leftproc, rightproc: tree) ;
(*
ConstantExpressionWarning - issue a warning if the constant has overflowed.
*)
-PROCEDURE ConstantExpressionWarning (value: Tree) ;
+PROCEDURE ConstantExpressionWarning (value: tree) ;
(*
and op2 is not a pointer type.
*)
-PROCEDURE BuildAddAddress (location: location_t; op1, op2: Tree) : Tree ;
+PROCEDURE BuildAddAddress (location: location_t; op1, op2: tree) : tree ;
(*
represent: min..max.
*)
-PROCEDURE calcNbits (location: location_t; min, max: Tree) : Tree ;
+PROCEDURE calcNbits (location: location_t; min, max: tree) : tree ;
(*
*)
PROCEDURE OverflowZType (location: location_t;
- str: ADDRESS; base: CARDINAL;
+ str: ConstCharStar; base: CARDINAL;
issueError: BOOLEAN) : BOOLEAN ;
(*
(condition) ? (left) : right.
*)
-PROCEDURE BuildCondIfExpression (condition, type, left, right: Tree) : Tree ;
+PROCEDURE BuildCondIfExpression (condition, type, left, right: tree) : tree ;
END m2expr.
-(* m2linemap.def provides access to GCC location_t.
+(* m2linemap.def provides access to GCC location_t functions.
Copyright (C) 2011-2024 Free Software Foundation, Inc.
Contributed by Gaius Mulley <gaius.mulley@southwales.ac.uk>.
DEFINITION MODULE FOR "C" m2linemap ;
FROM SYSTEM IMPORT ADDRESS ;
+FROM gcctypes IMPORT location_t ;
EXPORT QUALIFIED StartFile, EndFile, StartLine, GetLocationColumn, GetLocationRange,
GetLocationBinary, UnknownLocation, BuiltinsLocation,
GetLineNoFromLocation, GetColumnNoFromLocation,
GetFilenameFromLocation, ErrorAt, ErrorAtf,
- WarningAtf, NoteAtf, internal_error, location_t ;
-
-TYPE
- location_t = CARDINAL ;
+ WarningAtf, NoteAtf, internal_error ;
PROCEDURE StartFile (filename: ADDRESS; linebegin: CARDINAL) ;
DEFINITION MODULE FOR "C" m2misc ;
-FROM m2tree IMPORT Tree ;
+FROM gcctypes IMPORT tree ;
FROM SYSTEM IMPORT ADDRESS ;
-PROCEDURE DebugTree (t: Tree) ;
+PROCEDURE DebugTree (t: tree) ;
PROCEDURE error (message: ARRAY OF CHAR) ;
PROCEDURE cerror (message: ADDRESS) ;
PROCEDURE warning_m2_dump_filter (message, rule: ADDRESS) ;
DEFINITION MODULE FOR "C" m2pp ;
FROM SYSTEM IMPORT ADDRESS ;
-FROM m2tree IMPORT Tree ;
+FROM gcctypes IMPORT tree ;
(*
PROCEDURE CloseDumpGimple ;
-PROCEDURE DumpGimpleFd (fd: INTEGER; fndecl: Tree) ;
+PROCEDURE DumpGimpleFd (fd: INTEGER; fndecl: tree) ;
END m2pp.
/* BuildBuiltinCallTree calls the builtin procedure. */
tree
-m2statement_BuildBuiltinCallTree (location_t location, tree func)
+m2statement_BuildBuiltinCallTree (tree func)
{
TREE_USED (func) = true;
TREE_SIDE_EFFECTS (func) = true;
DEFINITION MODULE FOR "C" m2statement ;
-
-FROM SYSTEM IMPORT ADDRESS ;
-FROM m2tree IMPORT Tree ;
-FROM m2linemap IMPORT location_t ;
+FROM gcctypes IMPORT location_t, tree ;
+FROM CDataTypes IMPORT CharStar ;
FROM m2expr IMPORT BuildUnarySetFunction ;
result of the expression is TRUE or FALSE.
*)
-PROCEDURE DoJump (location: location_t; exp: Tree; falselabel: ADDRESS; truelabel: ADDRESS) ;
+PROCEDURE DoJump (location: location_t; exp: tree; falselabel, truelabel: CharStar) ;
(*
BuildStartFunctionCode - generate function entry code.
*)
-PROCEDURE BuildStartFunctionCode (location: location_t; fndecl: Tree; isexported: BOOLEAN; isinline: BOOLEAN) ;
+PROCEDURE BuildStartFunctionCode (location: location_t; fndecl: tree; isexported: BOOLEAN; isinline: BOOLEAN) ;
(*
BuildEndFunctionCode - generates the function epilogue.
*)
-PROCEDURE BuildEndFunctionCode (location: location_t; fndecl: Tree; nested: BOOLEAN) ;
+PROCEDURE BuildEndFunctionCode (location: location_t; fndecl: tree; nested: BOOLEAN) ;
(*
BuildReturnValueCode - generates the code associated with: RETURN( value )
*)
-PROCEDURE BuildReturnValueCode (location: location_t; fndecl: Tree; value: Tree) ;
+PROCEDURE BuildReturnValueCode (location: location_t; fndecl: tree; value: tree) ;
(*
It returns, des.
*)
-PROCEDURE BuildAssignmentTree (location: location_t; des, expr: Tree) : Tree ;
+PROCEDURE BuildAssignmentTree (location: location_t; des, expr: tree) : tree ;
(*
BuildAssignmentStatement builds the assignment of, des, and, expr.
*)
-PROCEDURE BuildAssignmentStatement (location: location_t; des, expr: Tree) ;
+PROCEDURE BuildAssignmentStatement (location: location_t; des, expr: tree) ;
(*
BuildGoto - builds a goto operation.
*)
-PROCEDURE BuildGoto (location: location_t; name: ADDRESS) ;
+PROCEDURE BuildGoto (location: location_t; name: CharStar) ;
(*
DeclareLabel - create a label, name.
*)
-PROCEDURE DeclareLabel (location: location_t; name: ADDRESS) ;
+PROCEDURE DeclareLabel (location: location_t; name: CharStar) ;
(*
statement, s, if, condition, is true.
*)
-PROCEDURE BuildIfThenDoEnd (condition: Tree; then_block: Tree) : Tree ;
+PROCEDURE BuildIfThenDoEnd (condition: tree; then_block: tree) : tree ;
(*
condition.
*)
-PROCEDURE BuildIfThenElseEnd (condition: Tree; then_block: Tree; else_block: Tree) : Tree ;
+PROCEDURE BuildIfThenElseEnd (condition: tree; then_block: tree; else_block: tree) : tree ;
(*
BuildParam - build a list of parameters, ready for a subsequent procedure call.
*)
-PROCEDURE BuildParam (location: location_t; param: Tree) ;
+PROCEDURE BuildParam (location: location_t; param: tree) ;
(*
a call to BuildFunctionCallTree.
*)
-PROCEDURE BuildFunctionCallTree (location: location_t; procedure: Tree; rettype: Tree) ;
+PROCEDURE BuildFunctionCallTree (location: location_t; procedure: tree; rettype: tree) ;
(*
parameter list and the return type, rettype.
*)
-PROCEDURE BuildProcedureCallTree (location: location_t; procedure: Tree; rettype: Tree) : Tree ;
+PROCEDURE BuildProcedureCallTree (location: location_t; procedure: tree; rettype: tree) : tree ;
(*
parameter list and the return type, rettype.
*)
-PROCEDURE BuildIndirectProcedureCallTree (location: location_t; procedure: Tree; rettype: Tree) : Tree ;
+PROCEDURE BuildIndirectProcedureCallTree (location: location_t; procedure: tree; rettype: tree) : tree ;
(*
BuildFunctValue - generates code for value := last_function(foobar);
*)
-PROCEDURE BuildFunctValue (location: location_t; value: Tree) : Tree ;
+PROCEDURE BuildFunctValue (location: location_t; value: tree) : tree ;
(*
*)
PROCEDURE BuildCall2 (location: location_t;
- function, rettype, arg1, arg2: Tree) : Tree ;
+ function, rettype, arg1, arg2: tree) : tree ;
(*
*)
PROCEDURE BuildCall3 (location: location_t;
- function, rettype, arg1, arg2, arg3: Tree) : Tree ;
+ function, rettype, arg1, arg2, arg3: tree) : tree ;
(*
SetLastFunction - set the last_function to, t.
*)
-PROCEDURE SetLastFunction (t: Tree) ;
+PROCEDURE SetLastFunction (t: tree) ;
(*
GetLastFunction - returns, last_function.
*)
-PROCEDURE GetLastFunction () : Tree ;
+PROCEDURE GetLastFunction () : tree ;
(*
GetParamTree - return parameter, i.
*)
-PROCEDURE GetParamTree (call: Tree; i: CARDINAL) : Tree ;
+PROCEDURE GetParamTree (call: tree; i: CARDINAL) : tree ;
(*
attached.
*)
-PROCEDURE BuildTryFinally (location: location_t; call: Tree; cleanups: Tree) : Tree ;
+PROCEDURE BuildTryFinally (location: location_t; call: tree; cleanups: tree) : tree ;
(*
BuildCleanUp - return a CLEANUP_POINT_EXPR which will clobber, param.
*)
-PROCEDURE BuildCleanUp (param: Tree) : Tree ;
+PROCEDURE BuildCleanUp (param: tree) : tree ;
(*
BuildAsm - generates an inline assembler instruction.
*)
-PROCEDURE BuildAsm (location: location_t; instr: Tree;
+PROCEDURE BuildAsm (location: location_t; instr: tree;
isVolatile: BOOLEAN; isSimple: BOOLEAN;
- inputs: Tree; outputs: Tree; trash: Tree; labels: Tree) ;
+ inputs: tree; outputs: tree; trash: tree; labels: tree) ;
(*
of the large set invoking the unop.
*)
-PROCEDURE BuildUnaryForeachWordDo (location: location_t; type: Tree; op1: Tree; op2: Tree;
+PROCEDURE BuildUnaryForeachWordDo (location: location_t; type: tree; op1: tree; op2: tree;
unop: BuildUnarySetFunction;
is_op1lvalue, is_op2lvalue, is_op1const, is_op2const: BOOLEAN) ;
op2 is a constant.
*)
-PROCEDURE BuildExcludeVarConst (location: location_t; type: Tree; op1: Tree; op2: Tree; is_lvalue: BOOLEAN; fieldno: INTEGER) ;
+PROCEDURE BuildExcludeVarConst (location: location_t; type: tree; op1: tree; op2: tree; is_lvalue: BOOLEAN; fieldno: INTEGER) ;
(*
varel is a variable.
*)
-PROCEDURE BuildExcludeVarVar (location: location_t; type: Tree; varset: Tree; varel: Tree; is_lvalue: BOOLEAN; low: Tree) ;
+PROCEDURE BuildExcludeVarVar (location: location_t; type: tree; varset: tree; varel: tree; is_lvalue: BOOLEAN; low: tree) ;
(*
op2 is a constant.
*)
-PROCEDURE BuildIncludeVarConst (location: location_t; type: Tree; op1: Tree; op2: Tree; is_lvalue: BOOLEAN; fieldno: INTEGER) ;
+PROCEDURE BuildIncludeVarConst (location: location_t; type: tree; op1: tree; op2: tree; is_lvalue: BOOLEAN; fieldno: INTEGER) ;
(*
op2 is a variable.
*)
-PROCEDURE BuildIncludeVarVar (location: location_t; type: Tree; varset: Tree; varel: Tree; is_lvalue: BOOLEAN; low: Tree) ;
+PROCEDURE BuildIncludeVarVar (location: location_t; type: tree; varset: tree; varel: tree; is_lvalue: BOOLEAN; low: tree) ;
(*
sequence for all modules.
*)
-PROCEDURE BuildStart (location: location_t; name: ADDRESS; inner_module: BOOLEAN) : Tree ;
+PROCEDURE BuildStart (location: location_t; name: CharStar; inner_module: BOOLEAN) : tree ;
(*
BuildEnd - complete the initialisation function for this module.
*)
-PROCEDURE BuildEnd (location: location_t; fndecl: Tree; nested: BOOLEAN) ;
+PROCEDURE BuildEnd (location: location_t; fndecl: tree; nested: BOOLEAN) ;
(*
BuildCallInner - call the inner module function. It has no parameters and no return value.
*)
-PROCEDURE BuildCallInner (location: location_t; fndecl: Tree) ;
+PROCEDURE BuildCallInner (location: location_t; fndecl: tree) ;
(*
BuildBuiltinCallTree - calls the builtin procedure.
*)
-PROCEDURE BuildBuiltinCallTree (location: location_t; func: Tree) : Tree ;
+PROCEDURE BuildBuiltinCallTree (func: tree) : tree ;
END m2statement.
EXTERN void m2statement_SetBeginLocation (location_t location);
EXTERN void m2statement_SetEndLocation (location_t location);
EXTERN tree m2statement_GetParamTree (tree call, unsigned int i);
-EXTERN tree m2statement_BuildBuiltinCallTree (location_t location, tree func);
+EXTERN tree m2statement_BuildBuiltinCallTree (tree func);
EXTERN tree m2statement_BuildTryFinally (location_t location, tree call,
tree cleanups);
DEFINITION MODULE FOR "C" m2tree ;
FROM SYSTEM IMPORT ADDRESS ;
-
-TYPE
- Tree = ADDRESS ;
-
-
-PROCEDURE IsAConstant (t: Tree) : BOOLEAN ;
-PROCEDURE IsOrdinal (type: Tree) : BOOLEAN ;
-PROCEDURE IsTreeOverflow (value: Tree) : BOOLEAN ;
-PROCEDURE skip_const_decl (exp: Tree) : Tree ;
-PROCEDURE skip_type_decl (type: Tree) : Tree ;
-PROCEDURE is_type (type: Tree) : BOOLEAN ;
-PROCEDURE is_array (array: Tree) : BOOLEAN ;
-PROCEDURE is_var (var: Tree) : BOOLEAN ;
-PROCEDURE debug_tree (t: Tree) ;
+FROM gcctypes IMPORT tree ;
+
+
+PROCEDURE IsAConstant (t: tree) : BOOLEAN ;
+PROCEDURE IsOrdinal (type: tree) : BOOLEAN ;
+PROCEDURE IstreeOverflow (value: tree) : BOOLEAN ;
+PROCEDURE skip_const_decl (exp: tree) : tree ;
+PROCEDURE skip_type_decl (type: tree) : tree ;
+PROCEDURE is_type (type: tree) : BOOLEAN ;
+PROCEDURE is_array (array: tree) : BOOLEAN ;
+PROCEDURE is_var (var: tree) : BOOLEAN ;
+PROCEDURE debug_tree (t: tree) ;
END m2tree.
DEFINITION MODULE FOR "C" m2treelib ;
-FROM m2tree IMPORT Tree ;
-FROM m2linemap IMPORT location_t ;
+FROM gcctypes IMPORT location_t, tree ;
FROM SYSTEM IMPORT ADDRESS ;
TYPE
NULL is returned if, op, is a constant.
*)
-PROCEDURE get_set_address_if_var (location: location_t; op: Tree; is_lvalue, is_const: BOOLEAN) : Tree ;
+PROCEDURE get_set_address_if_var (location: location_t; op: tree; is_lvalue, is_const: BOOLEAN) : tree ;
(*
get_set_field_rhs - returns the value of p->field.
*)
-PROCEDURE get_set_field_rhs (location: location_t; p: Tree; field: Tree) : Tree ;
+PROCEDURE get_set_field_rhs (location: location_t; p: tree; field: tree) : tree ;
(*
get_set_field_lhs - returns the address of p->field.
*)
-PROCEDURE get_set_field_lhs (location: location_t; p: Tree; field: Tree) : Tree ;
+PROCEDURE get_set_field_lhs (location: location_t; p: tree; field: tree) : tree ;
(*
get_set_address - returns the address of op1.
*)
-PROCEDURE get_set_address (location: location_t; op1: Tree; is_lvalue: BOOLEAN) : Tree ;
+PROCEDURE get_set_address (location: location_t; op1: tree; is_lvalue: BOOLEAN) : tree ;
(*
Either p->field or the constant(op.fieldNo) is returned.
*)
-PROCEDURE get_set_value (location: location_t; p: Tree; field: Tree; is_const: BOOLEAN; op: Tree; fieldNo: CARDINAL) : Tree ;
+PROCEDURE get_set_value (location: location_t; p: tree; field: tree; is_const: BOOLEAN; op: tree; fieldNo: CARDINAL) : tree ;
(*
appropriate field number.
*)
-PROCEDURE get_field_no (type: Tree; op: Tree; is_const: BOOLEAN; fieldNo: CARDINAL) : Tree ;
+PROCEDURE get_field_no (type: tree; op: tree; is_const: BOOLEAN; fieldNo: CARDINAL) : tree ;
(*
copied upon indirection.
*)
-PROCEDURE get_rvalue (location: location_t; t: Tree; type: Tree; is_lvalue: BOOLEAN) : Tree ;
+PROCEDURE get_rvalue (location: location_t; t: tree; type: tree; is_lvalue: BOOLEAN) : tree ;
(*
DoCall - build a call tree arranging the parameter list as a vector.
*)
-PROCEDURE DoCall (location: location_t; rettype: Tree; funcptr: Tree; param_list: Tree) : Tree ;
+PROCEDURE DoCall (location: location_t; rettype: tree; funcptr: tree; param_list: tree) : tree ;
-PROCEDURE build_modify_expr (location: location_t; des: Tree; modifycode: tree_code; copy: Tree) : Tree ;
+PROCEDURE build_modify_expr (location: location_t; des: tree; modifycode: tree_code; copy: tree) : tree ;
(*
If the result is true then jump to label.
*)
-PROCEDURE do_jump_if_bit (location: location_t; code: tree_code; word: Tree; bit: Tree; label: ADDRESS) ;
+PROCEDURE do_jump_if_bit (location: location_t; code: tree_code; word: tree; bit: tree; label: ADDRESS) ;
END m2treelib.
DEFINITION MODULE FOR "C" m2type ;
FROM SYSTEM IMPORT ADDRESS ;
-FROM m2tree IMPORT Tree ;
-FROM m2linemap IMPORT location_t ;
-
+FROM gcctypes IMPORT location_t, tree ;
+FROM CDataTypes IMPORT CharStar, ConstCharStar ;
TYPE
Constructor = ADDRESS ;
of, type.
*)
-PROCEDURE ValueInTypeRange (type: Tree; value: Tree) : BOOLEAN ;
+PROCEDURE ValueInTypeRange (type: tree; value: tree) : BOOLEAN ;
(*
of, type.
*)
-PROCEDURE ValueOutOfTypeRange (type: Tree; value: Tree) : BOOLEAN ;
+PROCEDURE ValueOutOfTypeRange (type: tree; value: tree) : BOOLEAN ;
(*
ExceedsTypeRange - return TRUE if low or high exceed the range of, type.
*)
-PROCEDURE ExceedsTypeRange (type: Tree; low, high: Tree) : BOOLEAN ;
+PROCEDURE ExceedsTypeRange (type: tree; low, high: tree) : BOOLEAN ;
(*
WithinTypeRange - return TRUE if low and high are within the range of, type.
*)
-PROCEDURE WithinTypeRange (type: Tree; low, high: Tree) : BOOLEAN ;
+PROCEDURE WithinTypeRange (type: tree; low, high: tree) : BOOLEAN ;
(*
BuildSubrangeType - creates a subrange of, type, with, lowval, highval.
*)
-PROCEDURE BuildSubrangeType (location: location_t; name: ADDRESS; type: Tree; lowval: Tree; highval: Tree) : Tree ;
+PROCEDURE BuildSubrangeType (location: location_t; name: CharStar; type: tree; lowval: tree; highval: tree) : tree ;
(*
BuildCharConstant - creates a character constant given a, string.
*)
-PROCEDURE BuildCharConstant (location: location_t; string: ADDRESS) : Tree ;
+PROCEDURE BuildCharConstant (location: location_t; string: ConstCharStar) : tree ;
(*
BuildCharConstantChar - creates a character constant given a character, ch.
*)
-PROCEDURE BuildCharConstantChar (location: location_t; ch: CHAR) : Tree ;
+PROCEDURE BuildCharConstantChar (location: location_t; ch: CHAR) : tree ;
(*
BuildArrayConstructorElement - adds, value, to the constructor_element_list.
*)
-PROCEDURE BuildArrayConstructorElement (p: ADDRESS; value: Tree; indice: Tree) ;
+PROCEDURE BuildArrayConstructorElement (p: ADDRESS; value: tree; indice: tree) ;
(*
compound literal.
*)
-PROCEDURE BuildEndArrayConstructor (p: Constructor) : Tree ;
+PROCEDURE BuildEndArrayConstructor (p: Constructor) : tree ;
(*
compound literal.
*)
-PROCEDURE BuildStartArrayConstructor (type: Tree) : Constructor ;
+PROCEDURE BuildStartArrayConstructor (type: tree) : Constructor ;
(*
BuildRecordConstructorElement - adds, value, to the constructor_element_list.
*)
-PROCEDURE BuildRecordConstructorElement (p: Constructor; value: Tree) ;
+PROCEDURE BuildRecordConstructorElement (p: Constructor; value: tree) ;
(*
BuildEndRecordConstructor - returns a tree containing the record compound literal.
*)
-PROCEDURE BuildEndRecordConstructor (p: Constructor) : Tree ;
+PROCEDURE BuildEndRecordConstructor (p: Constructor) : tree ;
(*
constructor frame.
*)
-PROCEDURE BuildStartRecordConstructor (type: Tree) : Constructor ;
+PROCEDURE BuildStartRecordConstructor (type: tree) : Constructor ;
(*
BuildEndSetConstructor - finishes building a set constant.
*)
-PROCEDURE BuildEndSetConstructor (p: Constructor) : Tree ;
+PROCEDURE BuildEndSetConstructor (p: Constructor) : tree ;
(*
BuildSetConstructorElement - adds, value, to the constructor_element_list.
*)
-PROCEDURE BuildSetConstructorElement (p: Constructor; value: Tree) ;
+PROCEDURE BuildSetConstructorElement (p: Constructor; value: tree) ;
(*
Remember that type is really a record type.
*)
-PROCEDURE BuildStartSetConstructor (type: Tree) : Constructor ;
+PROCEDURE BuildStartSetConstructor (type: tree) : Constructor ;
(*
BuildSetType - creates a SET OF [lowval..highval]
*)
-PROCEDURE BuildSetType (location: location_t; name: ADDRESS; type: Tree; lowval: Tree; highval: Tree; ispacked: BOOLEAN) : Tree ;
+PROCEDURE BuildSetType (location: location_t; name: CharStar; type: tree; lowval: tree; highval: tree; ispacked: BOOLEAN) : tree ;
(*
BuildConstPointerType - returns a type which is a const pointer to, totype.
*)
-PROCEDURE BuildConstPointerType (totype: Tree) : Tree ;
+PROCEDURE BuildConstPointerType (totype: tree) : tree ;
(*
BuildPointerType - returns a type which is a pointer to, totype.
*)
-PROCEDURE BuildPointerType (totype: Tree) : Tree ;
+PROCEDURE BuildPointerType (totype: tree) : tree ;
(*
It returns a copy of the value. --fixme-- why do this?
*)
-PROCEDURE BuildEnumerator (location: location_t; name: ADDRESS; value: Tree;
- VAR enumvalues: Tree) : Tree ;
+PROCEDURE BuildEnumerator (location: location_t; name: CharStar; value: tree;
+ VAR enumvalues: tree) : tree ;
(*
list, enumvalues, and returns a enumeration type tree.
*)
-PROCEDURE BuildEndEnumeration (location: location_t; type: Tree; enumvalues: Tree) : Tree ;
+PROCEDURE BuildEndEnumeration (location: location_t; type: tree; enumvalues: tree) : tree ;
(*
BuildStartEnumeration - create an enumerated type in gcc.
*)
-PROCEDURE BuildStartEnumeration (location: location_t; name: ADDRESS; ispacked: BOOLEAN) : Tree ;
+PROCEDURE BuildStartEnumeration (location: location_t; name: CharStar; ispacked: BOOLEAN) : tree ;
(*
BuildTypeDeclaration - adds the, type, to the current statement list.
*)
-PROCEDURE BuildTypeDeclaration (location: location_t; type: Tree) ;
+PROCEDURE BuildTypeDeclaration (location: location_t; type: tree) ;
(*
legal value.
*)
-PROCEDURE GetMaxFrom (location: location_t; type: Tree) : Tree ;
+PROCEDURE GetMaxFrom (location: location_t; type: tree) : tree ;
(*
legal value.
*)
-PROCEDURE GetMinFrom (location: location_t; type: Tree) : Tree ;
+PROCEDURE GetMinFrom (location: location_t; type: tree) : tree ;
(*
declare C default types and _some_ M2 default types.
*)
-PROCEDURE GetDefaultType (location: location_t; name: ADDRESS; type: Tree) : Tree ;
+PROCEDURE GetDefaultType (location: location_t; name: CharStar; type: tree) : tree ;
(*
BuildEndType - finish declaring, type, and return, type.
*)
-PROCEDURE BuildEndType (location: location_t; type: Tree) : Tree ;
+PROCEDURE BuildEndType (location: location_t; type: tree) : tree ;
(*
yet to be 'gm2_finish_decl'ed.
*)
-PROCEDURE BuildStartType (location: location_t; name: ADDRESS; type: Tree) : Tree ;
+PROCEDURE BuildStartType (location: location_t; name: CharStar; type: tree) : tree ;
(*
This creates and array index, array type and local variable.
*)
-PROCEDURE BuildVariableArrayAndDeclare (location: location_t; elementtype: Tree; high: Tree; name: ADDRESS; scope: Tree) : Tree ;
+PROCEDURE BuildVariableArrayAndDeclare (location: location_t; elementtype: tree; high: tree; name: CharStar; scope: tree) : tree ;
(*
It appends this parameter to the internal param_type_list.
*)
-PROCEDURE BuildProcTypeParameterDeclaration (location: location_t; type: Tree; isreference: BOOLEAN) : Tree ;
+PROCEDURE BuildProcTypeParameterDeclaration (location: location_t; type: tree; isreference: BOOLEAN) : tree ;
(*
create a function type.
*)
-PROCEDURE BuildStartFunctionType (location: location_t; name: ADDRESS) : Tree ;
+PROCEDURE BuildStartFunctionType (location: location_t; name: CharStar) : tree ;
(*
The arguments have been created by BuildParameterDeclaration.
*)
-PROCEDURE BuildEndFunctionType (func: Tree; type: Tree; usesvarags: BOOLEAN) : Tree ;
+PROCEDURE BuildEndFunctionType (func: tree; type: tree; usesvarags: BOOLEAN) : tree ;
(*
GetTreeType - returns TREE_TYPE (t).
*)
-PROCEDURE GetTreeType (type: Tree) : Tree ;
+PROCEDURE GetTreeType (type: tree) : tree ;
(*
name = foo ;
*)
-PROCEDURE DeclareKnownType (location: location_t; name: ADDRESS; type: Tree) : Tree ;
+PROCEDURE DeclareKnownType (location: location_t; name: CharStar; type: tree) : tree ;
(*
GetM2ZType - return the ISO Z data type, the longest int datatype.
*)
-PROCEDURE GetM2ZType () : Tree ;
+PROCEDURE GetM2ZType () : tree ;
(*
GetM2RType - return the ISO R data type, the longest real datatype.
*)
-PROCEDURE GetM2RType () : Tree ;
+PROCEDURE GetM2RType () : tree ;
(*
BuildSetTypeFromSubrange - constructs a set type from a subrangeType.
*)
-PROCEDURE BuildSetTypeFromSubrange (location: location_t; name: ADDRESS;
- subrangeType: Tree;
- lowval: Tree; highval: Tree;
- ispacked: BOOLEAN) : Tree ;
+PROCEDURE BuildSetTypeFromSubrange (location: location_t; name: CharStar;
+ subrangeType: tree;
+ lowval: tree; highval: tree;
+ ispacked: BOOLEAN) : tree ;
(*
sufficient to contain values: low..high.
*)
-PROCEDURE BuildSmallestTypeRange (location: location_t; low: Tree; high: Tree) : Tree ;
+PROCEDURE BuildSmallestTypeRange (location: location_t; low: tree; high: tree) : tree ;
(*
GetBooleanType -
*)
-PROCEDURE GetBooleanType () : Tree ;
+PROCEDURE GetBooleanType () : tree ;
(*
GetBooleanFalse -
*)
-PROCEDURE GetBooleanFalse () : Tree ;
+PROCEDURE GetBooleanFalse () : tree ;
(*
GetBooleanTrue -
*)
-PROCEDURE GetBooleanTrue () : Tree ;
+PROCEDURE GetBooleanTrue () : tree ;
(*
GetPackedBooleanType - return the packed boolean data type node.
*)
-PROCEDURE GetPackedBooleanType () : Tree ;
+PROCEDURE GetPackedBooleanType () : tree ;
(*
GetCharType - return the char type node.
*)
-PROCEDURE GetCharType () : Tree ;
+PROCEDURE GetCharType () : tree ;
(*
GetByteType - return the byte type node.
*)
-PROCEDURE GetByteType () : Tree ;
+PROCEDURE GetByteType () : tree ;
(*
GetVoidType - return the C void type.
*)
-PROCEDURE GetVoidType () : Tree ;
+PROCEDURE GetVoidType () : tree ;
(*
GetBitnumType - return the ISO bitnum type.
*)
-PROCEDURE GetBitnumType () : Tree ;
+PROCEDURE GetBitnumType () : tree ;
(*
GetRealType -
*)
-PROCEDURE GetRealType () : Tree ;
+PROCEDURE GetRealType () : tree ;
(*
GetLongRealType - return the C long double data type.
*)
-PROCEDURE GetLongRealType () : Tree ;
+PROCEDURE GetLongRealType () : tree ;
(*
GetShortRealType - return the C float data type.
*)
-PROCEDURE GetShortRealType () : Tree ;
+PROCEDURE GetShortRealType () : tree ;
(*
GetLongIntType - return the C long int data type.
*)
-PROCEDURE GetLongIntType () : Tree ;
+PROCEDURE GetLongIntType () : tree ;
(*
GetPointerType - return the GCC ptr type node. Equivalent to (void * ).
*)
-PROCEDURE GetPointerType () : Tree ;
+PROCEDURE GetPointerType () : tree ;
(*
GetCardinalType - return the cardinal type.
*)
-PROCEDURE GetCardinalType () : Tree ;
+PROCEDURE GetCardinalType () : tree ;
(*
GetIntegerType - return the integer type node.
*)
-PROCEDURE GetIntegerType () : Tree ;
+PROCEDURE GetIntegerType () : tree ;
(*
GetWordType - return the C unsigned data type.
*)
-PROCEDURE GetWordType () : Tree ;
+PROCEDURE GetWordType () : tree ;
(*
GetM2CardinalType - return the m2 cardinal data type.
*)
-PROCEDURE GetM2CardinalType () : Tree ;
+PROCEDURE GetM2CardinalType () : tree ;
(*
GetBitsetType - return the bitset type.
*)
-PROCEDURE GetBitsetType () : Tree ;
+PROCEDURE GetBitsetType () : tree ;
(*
GetM2CType - a test function.
*)
-PROCEDURE GetM2CType () : Tree ;
+PROCEDURE GetM2CType () : tree ;
(*
GetProcType - return the m2 proc data type.
*)
-PROCEDURE GetProcType () : Tree ;
+PROCEDURE GetProcType () : tree ;
(*
GetM2ComplexType - return the complex type.
*)
-PROCEDURE GetM2ComplexType () : Tree ;
+PROCEDURE GetM2ComplexType () : tree ;
(*
GetM2LongComplexType - return the long complex type.
*)
-PROCEDURE GetM2LongComplexType () : Tree ;
+PROCEDURE GetM2LongComplexType () : tree ;
(*
GetM2ShortComplexType - return the short complex type.
*)
-PROCEDURE GetM2ShortComplexType () : Tree ;
+PROCEDURE GetM2ShortComplexType () : tree ;
(*
GetM2Complex128Type - return the fixed size complex type.
*)
-PROCEDURE GetM2Complex128 () : Tree ;
+PROCEDURE GetM2Complex128 () : tree ;
(*
GetM2Complex96 - return the fixed size complex type.
*)
-PROCEDURE GetM2Complex96 () : Tree ;
+PROCEDURE GetM2Complex96 () : tree ;
(*
GetM2Complex64 - return the fixed size complex type.
*)
-PROCEDURE GetM2Complex64 () : Tree ;
+PROCEDURE GetM2Complex64 () : tree ;
(*
GetM2Complex32 - return the fixed size complex type.
*)
-PROCEDURE GetM2Complex32 () : Tree ;
+PROCEDURE GetM2Complex32 () : tree ;
(*
GetM2Real128 - return the real 128 bit type.
*)
-PROCEDURE GetM2Real128 () : Tree ;
+PROCEDURE GetM2Real128 () : tree ;
(*
GetM2Real96 - return the real 96 bit type.
*)
-PROCEDURE GetM2Real96 () : Tree ;
+PROCEDURE GetM2Real96 () : tree ;
(*
GetM2Real64 - return the real 64 bit type.
*)
-PROCEDURE GetM2Real64 () : Tree ;
+PROCEDURE GetM2Real64 () : tree ;
(*
GetM2Real32 - return the real 32 bit type.
*)
-PROCEDURE GetM2Real32 () : Tree ;
+PROCEDURE GetM2Real32 () : tree ;
(*
GetM2Bitset32 - return the bitset 32 bit type.
*)
-PROCEDURE GetM2Bitset32 () : Tree ;
+PROCEDURE GetM2Bitset32 () : tree ;
(*
GetM2Bitset16 - return the bitset 16 bit type.
*)
-PROCEDURE GetM2Bitset16 () : Tree ;
+PROCEDURE GetM2Bitset16 () : tree ;
(*
GetM2Bitset8 - return the bitset 8 bit type.
*)
-PROCEDURE GetM2Bitset8 () : Tree ;
+PROCEDURE GetM2Bitset8 () : tree ;
(*
GetM2Word64 - return the word 64 bit type.
*)
-PROCEDURE GetM2Word64 () : Tree ;
+PROCEDURE GetM2Word64 () : tree ;
(*
GetM2Word32 - return the word 32 bit type.
*)
-PROCEDURE GetM2Word32 () : Tree ;
+PROCEDURE GetM2Word32 () : tree ;
(*
GetM2Word16 - return the word 16 bit type.
*)
-PROCEDURE GetM2Word16 () : Tree ;
+PROCEDURE GetM2Word16 () : tree ;
(*
GetM2Cardinal64 - return the cardinal 64 bit type.
*)
-PROCEDURE GetM2Cardinal64 () : Tree ;
+PROCEDURE GetM2Cardinal64 () : tree ;
(*
GetM2Cardinal32 - return the cardinal 32 bit type.
*)
-PROCEDURE GetM2Cardinal32 () : Tree ;
+PROCEDURE GetM2Cardinal32 () : tree ;
(*
GetM2Cardinal16 - return the cardinal 16 bit type.
*)
-PROCEDURE GetM2Cardinal16 () : Tree ;
+PROCEDURE GetM2Cardinal16 () : tree ;
(*
GetM2Cardinal8 - return the cardinal 8 bit type.
*)
-PROCEDURE GetM2Cardinal8 () : Tree ;
+PROCEDURE GetM2Cardinal8 () : tree ;
(*
GetM2Integer64 - return the integer 64 bit type.
*)
-PROCEDURE GetM2Integer64 () : Tree ;
+PROCEDURE GetM2Integer64 () : tree ;
(*
GetM2Integer32 - return the integer 32 bit type.
*)
-PROCEDURE GetM2Integer32 () : Tree ;
+PROCEDURE GetM2Integer32 () : tree ;
(*
GetM2Integer16 - return the integer 16 bit type.
*)
-PROCEDURE GetM2Integer16 () : Tree ;
+PROCEDURE GetM2Integer16 () : tree ;
(*
GetM2Integer8 - return the integer 8 bit type.
*)
-PROCEDURE GetM2Integer8 () : Tree ;
+PROCEDURE GetM2Integer8 () : tree ;
(*
GetISOLocType - return the m2 loc word data type.
*)
-PROCEDURE GetISOLocType () : Tree ;
+PROCEDURE GetISOLocType () : tree ;
(*
GetISOByteType - return the m2 iso byte data type.
*)
-PROCEDURE GetISOByteType () : Tree ;
+PROCEDURE GetISOByteType () : tree ;
(*
GetISOWordType - return the m2 iso word data type.
*)
-PROCEDURE GetISOWordType () : Tree ;
+PROCEDURE GetISOWordType () : tree ;
(*
GetShortCardType - return the C short unsigned data type.
*)
-PROCEDURE GetShortCardType () : Tree ;
+PROCEDURE GetShortCardType () : tree ;
(*
GetM2ShortCardType - return the m2 short cardinal data type.
*)
-PROCEDURE GetM2ShortCardType () : Tree ;
+PROCEDURE GetM2ShortCardType () : tree ;
(*
GetShortIntType - return the C short int data type.
*)
-PROCEDURE GetShortIntType () : Tree ;
+PROCEDURE GetShortIntType () : tree ;
(*
GetM2ShortIntType - return the m2 short integer data type.
*)
-PROCEDURE GetM2ShortIntType () : Tree ;
+PROCEDURE GetM2ShortIntType () : tree ;
(*
GetM2LongCardType - return the m2 long cardinal data type.
*)
-PROCEDURE GetM2LongCardType () : Tree ;
+PROCEDURE GetM2LongCardType () : tree ;
(*
GetM2LongIntType - return the m2 long integer data type.
*)
-PROCEDURE GetM2LongIntType () : Tree ;
+PROCEDURE GetM2LongIntType () : tree ;
(*
GetM2LongRealType - return the m2 long real data type.
*)
-PROCEDURE GetM2LongRealType () : Tree ;
+PROCEDURE GetM2LongRealType () : tree ;
(*
GetM2RealType - return the m2 real data type.
*)
-PROCEDURE GetM2RealType () : Tree ;
+PROCEDURE GetM2RealType () : tree ;
(*
GetM2ShortRealType - return the m2 short real data type.
*)
-PROCEDURE GetM2ShortRealType () : Tree ;
+PROCEDURE GetM2ShortRealType () : tree ;
(*
GetM2IntegerType - return the m2 integer data type.
*)
-PROCEDURE GetM2IntegerType () : Tree ;
+PROCEDURE GetM2IntegerType () : tree ;
(*
GetM2CharType - return the m2 char data type.
*)
-PROCEDURE GetM2CharType () : Tree ;
+PROCEDURE GetM2CharType () : tree ;
(*
GetCSizeTType - return a type representing, size_t on this system.
*)
-PROCEDURE GetCSizeTType () : Tree ;
+PROCEDURE GetCSizeTType () : tree ;
(*
GetCSSizeTType - return a type representing, ssize_t on this system.
*)
-PROCEDURE GetCSSizeTType () : Tree ;
+PROCEDURE GetCSSizeTType () : tree ;
(*
defined by, str, of, length, characters.
*)
-PROCEDURE BuildArrayStringConstructor (location: location_t; arrayType: Tree; str: Tree; length: Tree) : Tree ;
+PROCEDURE BuildArrayStringConstructor (location: location_t; arrayType: tree; str: tree; length: tree) : tree ;
(*
RealToTree - convert a real number into a Tree.
*)
-PROCEDURE RealToTree (name: ADDRESS) : Tree ;
+PROCEDURE RealToTree (name: CharStar) : tree ;
(*
BuildStartRecord - return a RECORD tree.
*)
-PROCEDURE BuildStartRecord (location: location_t; name: ADDRESS) : Tree ;
+PROCEDURE BuildStartRecord (location: location_t; name: CharStar) : tree ;
(*
BuildStartUnion - return a union tree.
*)
-PROCEDURE BuildStartUnion (location: location_t; name: ADDRESS) : Tree ;
+PROCEDURE BuildStartUnion (location: location_t; name: CharStar) : tree ;
-PROCEDURE BuildStartVarient (location: location_t; name: ADDRESS) : Tree ;
+PROCEDURE BuildStartVarient (location: location_t; name: CharStar) : tree ;
-PROCEDURE BuildEndVarient (location: location_t; varientField: Tree; varientList: Tree; isPacked: BOOLEAN) : Tree ;
+PROCEDURE BuildEndVarient (location: location_t; varientField: tree; varientList: tree; isPacked: BOOLEAN) : tree ;
-PROCEDURE BuildStartFieldVarient (location: location_t; name: ADDRESS) : Tree ;
+PROCEDURE BuildStartFieldVarient (location: location_t; name: CharStar) : tree ;
-PROCEDURE BuildEndFieldVarient (location: location_t; varientField: Tree; varientList: Tree; isPacked: BOOLEAN) : Tree ;
+PROCEDURE BuildEndFieldVarient (location: location_t; varientField: tree; varientList: tree; isPacked: BOOLEAN) : tree ;
-PROCEDURE BuildStartFieldRecord (location: location_t; name: ADDRESS; type: Tree) : Tree ;
+PROCEDURE BuildStartFieldRecord (location: location_t; name: CharStar; type: tree) : tree ;
-PROCEDURE BuildFieldRecord (location: location_t; name: ADDRESS; type: Tree) : Tree ;
+PROCEDURE BuildFieldRecord (location: location_t; name: CharStar; type: tree) : tree ;
(*
declarations.
*)
-PROCEDURE ChainOn (t1: Tree; t2: Tree) : Tree ;
+PROCEDURE ChainOn (t1: tree; t2: tree) : tree ;
(*
ChainOnParamValue - adds a list node {{name, str}, value} into the tree list.
*)
-PROCEDURE ChainOnParamValue (list: Tree; name: Tree; str: Tree; value: Tree) : Tree ;
+PROCEDURE ChainOnParamValue (list: tree; name: tree; str: tree; value: tree) : tree ;
(*
AddStringToTreeList - adds, string, to list.
*)
-PROCEDURE AddStringToTreeList (list: Tree; string: Tree) : Tree ;
+PROCEDURE AddStringToTreeList (list: tree; string: tree) : tree ;
(*
the structure.
*)
-PROCEDURE BuildEndRecord (location: location_t; record: Tree; fieldlist: Tree; isPacked: BOOLEAN) : Tree ;
+PROCEDURE BuildEndRecord (location: location_t; record: tree; fieldlist: tree; isPacked: BOOLEAN) : tree ;
(*
to prevent alignment effecting behaviour elsewhere.
*)
-PROCEDURE SetAlignment (node: Tree; align: Tree) : Tree ;
+PROCEDURE SetAlignment (node: tree; align: tree) : tree ;
(*
It returns the node.
*)
-PROCEDURE SetDeclPacked (node: Tree) : Tree ;
+PROCEDURE SetDeclPacked (node: tree) : tree ;
(*
It returns the node.
*)
-PROCEDURE SetTypePacked (node: Tree) : Tree ;
+PROCEDURE SetTypePacked (node: tree) : tree ;
(*
has been applied to it.
*)
-PROCEDURE SetRecordFieldOffset (field: Tree; byteOffset: Tree; bitOffset: Tree; fieldtype: Tree; nbits: Tree) : Tree ;
+PROCEDURE SetRecordFieldOffset (field: tree; byteOffset: tree; bitOffset: tree; fieldtype: tree; nbits: tree) : tree ;
(*
name, and, fieldtype.
*)
-PROCEDURE BuildPackedFieldRecord (location: location_t; name: ADDRESS; fieldtype: Tree) : Tree ;
+PROCEDURE BuildPackedFieldRecord (location: location_t; name: CharStar; fieldtype: tree) : tree ;
(*
arrayType.
*)
-PROCEDURE BuildNumberOfArrayElements (location: location_t; arrayType: Tree) : Tree ;
+PROCEDURE BuildNumberOfArrayElements (location: location_t; arrayType: tree) : tree ;
(*
AddStatement - maps onto add_stmt.
*)
-PROCEDURE AddStatement (location: location_t; t: Tree) ;
+PROCEDURE AddStatement (location: location_t; t: tree) ;
(*
MarkFunctionReferenced - marks a function as referenced.
*)
-PROCEDURE MarkFunctionReferenced (f: Tree) ;
+PROCEDURE MarkFunctionReferenced (f: tree) ;
(*
low and high are the min, max elements of the array.
*)
-PROCEDURE BuildArrayIndexType (low: Tree; high: Tree) : Tree ;
+PROCEDURE BuildArrayIndexType (low: tree; high: tree) : tree ;
(*
GetArrayNoOfElements - returns the number of elements in, arraytype.
*)
-PROCEDURE GetArrayNoOfElements (location: location_t; arraytype: Tree) : Tree ;
+PROCEDURE GetArrayNoOfElements (location: location_t; arraytype: tree) : tree ;
(*
and which has ElementType elements.
*)
-PROCEDURE BuildEndArrayType (arraytype: Tree; elementtype: Tree; indextype: Tree; type: INTEGER) : Tree ;
+PROCEDURE BuildEndArrayType (arraytype: tree; elementtype: tree; indextype: tree; type: INTEGER) : tree ;
(*
PutArrayType -
*)
-PROCEDURE PutArrayType (array: Tree; type: Tree) ;
+PROCEDURE PutArrayType (array: tree; type: tree) ;
(*
NULL_TREE.
*)
-PROCEDURE BuildStartArrayType (index_type: Tree; elt_type: Tree; type: INTEGER) : Tree ;
+PROCEDURE BuildStartArrayType (index_type: tree; elt_type: tree; type: INTEGER) : tree ;
(*
IsAddress - return TRUE if the type is an ADDRESS.
*)
-PROCEDURE IsAddress (type: Tree) : BOOLEAN ;
+PROCEDURE IsAddress (type: tree) : BOOLEAN ;
(*
SameRealType - return true if real types a and b are the same.
*)
-PROCEDURE SameRealType (a, b: Tree) : BOOLEAN ;
+PROCEDURE SameRealType (a, b: tree) : BOOLEAN ;
END m2type.
#include "GM2LexBuf.h"
#include "input.h"
#include "m2options.h"
+#include "Gm2linemap.h"
static int cpreprocessor = 0; /* Replace this with correct getter. */
writeString ((const char *) ":", 1);
writeCstring (s->debug.proc);
writeString ((const char *) " ", 1);
- writeAddress (reinterpret_cast<void *> (s));
+ writeAddress (reinterpret_cast <void *> (s));
writeString ((const char *) " ", 1);
switch (s->head->state)
{
(*c).next->head = NULL;
(*c).next->contents.len = 0;
(*c).next->contents.next = static_cast<DynamicStrings_String__opaque> (NULL);
- ConcatContentsAddress (&(*c).next->contents, reinterpret_cast<void *> (p), h-j);
+ ConcatContentsAddress (&(*c).next->contents, reinterpret_cast <void *> (p), h-j);
AddDebugInfo ((*c).next);
if (TraceOn)
{
writeString ((const char *) ":", 1);
writeCstring (s->debug.proc);
writeString ((const char *) " string ", 8);
- writeAddress (reinterpret_cast<void *> (s));
+ writeAddress (reinterpret_cast <void *> (s));
writeString ((const char *) " ", 1);
DumpState (s);
if (IsOnAllocated (s))
DynamicStrings_String__opaque d;
DynamicStrings_String__opaque t;
int start;
- int end;
+ int stop;
int o;
if (PoisonOn)
{
start = low-o;
}
- end = Max (Min (MaxBuf, static_cast<unsigned int> (high-o)), 0);
+ stop = Max (Min (MaxBuf, static_cast<unsigned int> (high-o)), 0);
while (t->contents.len == MaxBuf)
{
if (t->contents.next == NULL)
}
t = t->contents.next;
}
- ConcatContentsAddress (&t->contents, &static_cast<DynamicStrings_String__opaque> (s)->contents.buf.array[start], static_cast<unsigned int> (end-start));
+ ConcatContentsAddress (&t->contents, &static_cast<DynamicStrings_String__opaque> (s)->contents.buf.array[start], static_cast<unsigned int> (stop-start));
o += static_cast<DynamicStrings_String__opaque> (s)->contents.len;
s = static_cast<DynamicStrings_String> (static_cast<DynamicStrings_String__opaque> (s)->contents.next);
}
}
else
{
- Indexing_PutIndice (FileInfo, f, reinterpret_cast<void *> (fd));
+ Indexing_PutIndice (FileInfo, f, reinterpret_cast <void *> (fd));
fd->name.size = flength+1; /* need to guarantee the nul for C */
fd->usage = use; /* need to guarantee the nul for C */
fd->output = towrite;
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> ((static_cast<Indexing_Index__opaque> (i)->High-j)*sizeof (void *))));
+ 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;
}
{
ptr = Modules.array[state-M2Dependent_unregistered];
do {
- if (((strncmp (reinterpret_cast<M2Dependent_PtrToChar> (ptr->name), reinterpret_cast<M2Dependent_PtrToChar> (name), max (namelen, static_cast<unsigned int> (strlen_ (reinterpret_cast<M2Dependent_PtrToChar> (ptr->name)))))) == 0) && ((strncmp (reinterpret_cast<M2Dependent_PtrToChar> (ptr->libname), reinterpret_cast<M2Dependent_PtrToChar> (libname), max (libnamelen, static_cast<unsigned int> (strlen_ (reinterpret_cast<M2Dependent_PtrToChar> (ptr->libname)))))) == 0))
+ if (((strncmp (reinterpret_cast <M2Dependent_PtrToChar> (ptr->name), reinterpret_cast <M2Dependent_PtrToChar> (name), max (namelen, static_cast<unsigned int> (strlen_ (reinterpret_cast <M2Dependent_PtrToChar> (ptr->name)))))) == 0) && ((strncmp (reinterpret_cast <M2Dependent_PtrToChar> (ptr->libname), reinterpret_cast <M2Dependent_PtrToChar> (libname), max (libnamelen, static_cast<unsigned int> (strlen_ (reinterpret_cast <M2Dependent_PtrToChar> (ptr->libname)))))) == 0))
{
return ptr;
}
static M2Dependent_ModuleChain LookupModule (M2Dependent_DependencyState state, void * name, void * libname)
{
- return LookupModuleN (state, name, static_cast<unsigned int> (strlen_ (reinterpret_cast<M2Dependent_PtrToChar> (name))), libname, static_cast<unsigned int> (strlen_ (reinterpret_cast<M2Dependent_PtrToChar> (libname))));
+ return LookupModuleN (state, name, static_cast<unsigned int> (strlen_ (reinterpret_cast <M2Dependent_PtrToChar> (name))), libname, static_cast<unsigned int> (strlen_ (reinterpret_cast <M2Dependent_PtrToChar> (libname))));
/* static analysis guarentees a RETURN statement will be used before here. */
__builtin_unreachable ();
}
case ',':
modname = start;
modlen = len;
- ForceModule (reinterpret_cast<void *> (modname), modlen, reinterpret_cast<void *> (libname), liblen);
+ ForceModule (reinterpret_cast <void *> (modname), modlen, reinterpret_cast <void *> (libname), liblen);
libname = NULL;
liblen = 0;
modlen = 0;
}
if (start != pc)
{
- ForceModule (reinterpret_cast<void *> (start), len, reinterpret_cast<void *> (libname), liblen);
+ ForceModule (reinterpret_cast <void *> (start), len, reinterpret_cast <void *> (libname), liblen);
}
combine (M2Dependent_user, M2Dependent_ordered);
}
/* 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> (const_cast<void*> (static_cast<const void*>(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 ();
}
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))
+ if (equal (reinterpret_cast <void *> (pc), (const char *) "all", 3))
{
ModuleTrace = true;
DependencyTrace = true;
WarningTrace = true;
pc += 3;
}
- else if (equal (reinterpret_cast<void *> (pc), (const char *) "module", 6))
+ else if (equal (reinterpret_cast <void *> (pc), (const char *) "module", 6))
{
/* avoid dangling else. */
ModuleTrace = true;
pc += 6;
}
- else if (equal (reinterpret_cast<void *> (pc), (const char *) "warning", 7))
+ else if (equal (reinterpret_cast <void *> (pc), (const char *) "warning", 7))
{
/* avoid dangling else. */
WarningTrace = true;
pc += 7;
}
- else if (equal (reinterpret_cast<void *> (pc), (const char *) "hex", 3))
+ else if (equal (reinterpret_cast <void *> (pc), (const char *) "hex", 3))
{
/* avoid dangling else. */
HexTrace = true;
pc += 3;
}
- else if (equal (reinterpret_cast<void *> (pc), (const char *) "dep", 3))
+ else if (equal (reinterpret_cast <void *> (pc), (const char *) "dep", 3))
{
/* avoid dangling else. */
DependencyTrace = true;
pc += 3;
}
- else if (equal (reinterpret_cast<void *> (pc), (const char *) "pre", 3))
+ else if (equal (reinterpret_cast <void *> (pc), (const char *) "pre", 3))
{
/* avoid dangling else. */
PreTrace = true;
pc += 3;
}
- else if (equal (reinterpret_cast<void *> (pc), (const char *) "post", 4))
+ else if (equal (reinterpret_cast <void *> (pc), (const char *) "post", 4))
{
/* avoid dangling else. */
PostTrace = true;
pc += 4;
}
- else if (equal (reinterpret_cast<void *> (pc), (const char *) "force", 5))
+ else if (equal (reinterpret_cast <void *> (pc), (const char *) "force", 5))
{
/* avoid dangling else. */
ForceTrace = true;
a = (void *) (UnixArgs_GetArgV ());
a = reinterpret_cast<void *> (reinterpret_cast<char *> (a)+n*sizeof (SArgs_PtrToChar));
ppc = static_cast<SArgs_PtrToPtrToChar> (a);
- (*s) = DynamicStrings_InitStringCharStar (reinterpret_cast<void *> ((*ppc)));
+ (*s) = DynamicStrings_InitStringCharStar (reinterpret_cast <void *> ((*ppc)));
return true;
}
else
if (TotalWidth == 0)
{
maxprecision = true;
- r = ldtoa_ldtoa (x, ldtoa_decimaldigits, 100, &point, &sign);
+ r = ldtoa_ldtoa (x, static_cast<int> (ldtoa_decimaldigits), 100, &point, &sign);
}
else
{
- r = ldtoa_ldtoa (x, ldtoa_decimaldigits, 100, &point, &sign);
+ r = ldtoa_ldtoa (x, static_cast<int> (ldtoa_decimaldigits), 100, &point, &sign);
}
s = DynamicStrings_InitStringCharStar (r);
libc_free (r);
struct decl_defT_r {
nameKey_Name name;
nameKey_Name source;
+ bool unqualified;
bool hasHidden;
bool forC;
Indexing_Index exported;
static decl_group globalGroup;
static FIO_File outputFile;
static decl_language lang;
+static decl_node__opaque charStarN;
+static decl_node__opaque constCharStarN;
static decl_node__opaque bitsperunitN;
static decl_node__opaque bitsperwordN;
static decl_node__opaque bitspercharN;
extern "C" void decl_putDefForC (decl_node n);
+/*
+ putDefUnqualified - the definition module uses unqualified.
+*/
+
+extern "C" void decl_putDefUnqualified (decl_node n);
+
+/*
+ isDefUnqualified - returns TRUE if the definition module uses unqualified.
+*/
+
+extern "C" bool decl_isDefUnqualified (decl_node n);
+
/*
lookupInScope - looks up a symbol named, n, from, scope.
*/
static void importEnumFields (decl_node__opaque m, decl_node__opaque n);
+/*
+ checkGccType - check to see if node n is gcc tree or location_t
+ and record its use in keyc.
+*/
+
+static void checkGccType (decl_node__opaque n);
+
+/*
+ checkCDataTypes - check to see if node n is CharStar or ConstCharStar
+ and if necessary assign n to the global variable.
+*/
+
+static void checkCDataTypes (decl_node__opaque n);
+
/*
isComplex - returns TRUE if, n, is the complex type.
*/
static void doTypeNameModifier (mcPretty_pretty p, decl_node__opaque n);
+/*
+ isGccType - return TRUE if n is tree or location_t.
+*/
+
+static bool isGccType (decl_node__opaque n);
+
+/*
+ doGccType - record whether we are going to declare tree or location_t
+ so that the appropriate gcc header can be included instead.
+*/
+
+static void doGccType (mcPretty_pretty p, decl_node__opaque n);
+
+/*
+ isCDataType - return true if n is charStar or constCharStar.
+*/
+
+static bool isCDataType (decl_node__opaque n);
+
+/*
+ isCDataTypes - return TRUE if n is CharStar or ConstCharStar.
+*/
+
+static bool isCDataTypes (decl_node__opaque n);
+
+/*
+ doCDataTypes - if we are going to declare CharStar or ConstCharStar
+ then generate a comment instead.
+*/
+
+static void doCDataTypes (mcPretty_pretty p, decl_node__opaque n);
+
+/*
+ doCDataTypesC - generate the C representation of the CDataTypes data types.
+*/
+
+static void doCDataTypesC (mcPretty_pretty p, decl_node__opaque n);
+
+/*
+ doTypeOrPointer - only declare type or pointer n providing that
+ the name is not location_t or tree and
+ the --gccConfigSystem option is enabled.
+*/
+
+static void doTypeOrPointer (mcPretty_pretty p, decl_node__opaque n);
+
+/*
+ doTypedef - generate a typedef for n provuiding it is not
+*/
+
+static void doTypedef (mcPretty_pretty p, decl_node__opaque n);
+
/*
doTypesC -
*/
static bool needsCast (decl_node__opaque at, decl_node__opaque ft);
+/*
+ castDestType - emit the destination type ft
+*/
+
+static void castDestType (mcPretty_pretty p, decl_node__opaque formal, decl_node__opaque ft);
+
+/*
+ identifyPointer -
+*/
+
+static decl_node__opaque identifyPointer (decl_node__opaque type);
+
+/*
+ castPointer - provides a six way cast between ADDRESS (ie void * ),
+ char * and const char *.
+*/
+
+static unsigned int castPointer (mcPretty_pretty p, decl_node__opaque actual, decl_node__opaque formal, decl_node__opaque at, decl_node__opaque ft);
+
/*
checkSystemCast - checks to see if we are passing to/from
a system generic type (WORD, BYTE, ADDRESS)
static void makeBuiltins (void);
+/*
+ makeCDataTypes - assign the charStarN and constCharStarN to NIL.
+*/
+
+static void makeCDataTypes (void);
+
/*
init -
*/
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)))));
+ d = static_cast<decl_node__opaque> (libc_memset (reinterpret_cast <void *> (d), 0, static_cast<size_t> (sizeof ((*d)))));
}
if (d == NULL)
{
}
+/*
+ checkGccType - check to see if node n is gcc tree or location_t
+ and record its use in keyc.
+*/
+
+static void checkGccType (decl_node__opaque n)
+{
+ if (((mcOptions_getGccConfigSystem ()) && ((decl_getScope (static_cast<decl_node> (n))) != NULL)) && ((decl_getSymName (decl_getScope (static_cast<decl_node> (n)))) == (nameKey_makeKey ((const char *) "gcctypes", 8))))
+ {
+ /* avoid gcc warning by using compound statement even if not strictly necessary. */
+ if ((decl_getSymName (static_cast<decl_node> (n))) == (nameKey_makeKey ((const char *) "location_t", 10)))
+ {
+ keyc_useGccLocation ();
+ }
+ else if ((decl_getSymName (static_cast<decl_node> (n))) == (nameKey_makeKey ((const char *) "tree", 4)))
+ {
+ /* avoid dangling else. */
+ keyc_useGccTree ();
+ }
+ }
+}
+
+
+/*
+ checkCDataTypes - check to see if node n is CharStar or ConstCharStar
+ and if necessary assign n to the global variable.
+*/
+
+static void checkCDataTypes (decl_node__opaque n)
+{
+ if (((decl_getScope (static_cast<decl_node> (n))) != NULL) && ((decl_getSymName (decl_getScope (static_cast<decl_node> (n)))) == (nameKey_makeKey ((const char *) "CDataTypes", 10))))
+ {
+ /* avoid gcc warning by using compound statement even if not strictly necessary. */
+ if ((decl_getSymName (static_cast<decl_node> (n))) == (nameKey_makeKey ((const char *) "CharStar", 8)))
+ {
+ charStarN = n;
+ }
+ else if ((decl_getSymName (static_cast<decl_node> (n))) == (nameKey_makeKey ((const char *) "ConstCharStar", 13)))
+ {
+ /* avoid dangling else. */
+ constCharStarN = n;
+ }
+ }
+}
+
+
/*
isComplex - returns TRUE if, n, is the complex type.
*/
d->defF.source = nameKey_NulName;
d->defF.hasHidden = false;
d->defF.forC = false;
+ d->defF.unqualified = false;
d->defF.exported = Indexing_InitIndex (1);
d->defF.importedModules = Indexing_InitIndex (1);
d->defF.constFixup = initFixupInfo ();
/* 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));
+ symbolKey_putSymKey ((*decls).symbols, n, reinterpret_cast <void *> (d));
}
else
{
}
if (decl_isConst (static_cast<decl_node> (d)))
{
- Indexing_IncludeIndiceIntoIndex ((*decls).constants, reinterpret_cast<void *> (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));
+ 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));
+ 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));
+ 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));
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));
+ Indexing_IncludeIndiceIntoIndex (d->defF.exported, reinterpret_cast <void *> (n));
}
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));
+ symbolKey_putSymKey (baseSymbols, n, reinterpret_cast <void *> (haltN));
}
return addToScope (d);
/* static analysis guarentees a RETURN statement will be used before here. */
switch (v->kind)
{
case decl_varient:
- Indexing_IncludeIndiceIntoIndex (v->varientF.listOfSons, reinterpret_cast<void *> (f));
+ Indexing_IncludeIndiceIntoIndex (v->varientF.listOfSons, reinterpret_cast <void *> (f));
break;
switch (r->kind)
{
case decl_record:
- Indexing_IncludeIndiceIntoIndex (r->recordF.listOfSons, reinterpret_cast<void *> (n));
+ 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));
+ symbolKey_putSymKey (r->recordF.localSymbols, tag, reinterpret_cast <void *> (n));
}
else
{
break;
case decl_varientfield:
- Indexing_IncludeIndiceIntoIndex (r->varientfieldF.listOfSons, reinterpret_cast<void *> (n));
+ 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));
+ symbolKey_putSymKey (p->recordF.localSymbols, tag, reinterpret_cast <void *> (n));
}
break;
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)));
+ 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)));
}
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)))
{
- Indexing_IncludeIndiceIntoIndex (m->moduleF.enumFixup.info, reinterpret_cast<void *> (e));
+ Indexing_IncludeIndiceIntoIndex (m->moduleF.enumFixup.info, reinterpret_cast <void *> (e));
}
else if (decl_isDef (static_cast<decl_node> (m)))
{
/* avoid dangling else. */
- Indexing_IncludeIndiceIntoIndex (m->defF.enumFixup.info, reinterpret_cast<void *> (e));
+ Indexing_IncludeIndiceIntoIndex (m->defF.enumFixup.info, reinterpret_cast <void *> (e));
}
else if (decl_isImp (static_cast<decl_node> (m)))
{
/* avoid dangling else. */
- Indexing_IncludeIndiceIntoIndex (m->impF.enumFixup.info, reinterpret_cast<void *> (e));
+ Indexing_IncludeIndiceIntoIndex (m->impF.enumFixup.info, reinterpret_cast <void *> (e));
}
}
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));
+ 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 ());
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)))
{
- Indexing_IncludeIndiceIntoIndex (m->moduleF.constFixup.info, reinterpret_cast<void *> (e));
+ 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));
+ 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));
+ Indexing_IncludeIndiceIntoIndex (m->impF.constFixup.info, reinterpret_cast <void *> (e));
}
}
DynamicStrings_String i;
DynamicStrings_String s;
- if ((decl_getScope (static_cast<decl_node> (n))) == NULL)
+ if (((decl_getScope (static_cast<decl_node> (n))) == NULL) || (decl_isDefUnqualified (decl_getScope (static_cast<decl_node> (n)))))
{
return 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 ()))
+ else if (((! (decl_isExported (static_cast<decl_node> (n)))) || (mcOptions_getIgnoreFQ ())) || (decl_isDefUnqualified (decl_getScope (static_cast<decl_node> (n)))))
{
/* avoid dangling else. */
return DynamicStrings_InitStringCharStar (nameKey_keyToCharStar (decl_getSymName (static_cast<decl_node> (n))));
DynamicStrings_String i;
DynamicStrings_String s;
- if ((decl_getScope (static_cast<decl_node> (n))) == NULL)
+ if (((decl_getScope (static_cast<decl_node> (n))) == NULL) || (decl_isDefUnqualified (decl_getScope (static_cast<decl_node> (n)))))
{
return DynamicStrings_InitStringCharStar (nameKey_keyToCharStar (getDName (n, scopes)));
}
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 ()))
+ else if (((! (decl_isExported (static_cast<decl_node> (n)))) || (mcOptions_getIgnoreFQ ())) || (decl_isDefUnqualified (decl_getScope (static_cast<decl_node> (n)))))
{
/* avoid dangling else. */
return DynamicStrings_InitStringCharStar (nameKey_keyToCharStar (getDName (n, scopes)));
static void doConstC (decl_node__opaque n)
{
- if (! (alists_isItemInList (globalGroup->doneQ, reinterpret_cast<void *> (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));
+ alists_includeItemIntoList (globalGroup->doneQ, reinterpret_cast <void *> (n));
}
}
}
+/*
+ isGccType - return TRUE if n is tree or location_t.
+*/
+
+static bool isGccType (decl_node__opaque n)
+{
+ return (mcOptions_getGccConfigSystem ()) && (((decl_getSymName (static_cast<decl_node> (n))) == (nameKey_makeKey ((const char *) "location_t", 10))) || ((decl_getSymName (static_cast<decl_node> (n))) == (nameKey_makeKey ((const char *) "tree", 4))));
+ /* static analysis guarentees a RETURN statement will be used before here. */
+ __builtin_unreachable ();
+}
+
+
+/*
+ doGccType - record whether we are going to declare tree or location_t
+ so that the appropriate gcc header can be included instead.
+*/
+
+static void doGccType (mcPretty_pretty p, decl_node__opaque n)
+{
+ if (mcOptions_getGccConfigSystem ())
+ {
+ /* avoid gcc warning by using compound statement even if not strictly necessary. */
+ if ((decl_getSymName (static_cast<decl_node> (n))) == (nameKey_makeKey ((const char *) "location_t", 10)))
+ {
+ outText (p, (const char *) "/* Not going to declare ", 24);
+ doTypeNameC (p, n);
+ outText (p, (const char *) " as it is declared in the gcc header input.h. */\\n\\n", 53);
+ keyc_useGccLocation ();
+ }
+ else if ((decl_getSymName (static_cast<decl_node> (n))) == (nameKey_makeKey ((const char *) "tree", 4)))
+ {
+ /* avoid dangling else. */
+ outText (p, (const char *) "/* Not going to declare ", 24);
+ doTypeNameC (p, n);
+ outText (p, (const char *) " as it is declared in the gcc header tree.h. */\\n\\n", 52);
+ keyc_useGccTree ();
+ }
+ }
+}
+
+
+/*
+ isCDataType - return true if n is charStar or constCharStar.
+*/
+
+static bool isCDataType (decl_node__opaque n)
+{
+ return (n != NULL) && ((n == charStarN) || (n == constCharStarN));
+ /* static analysis guarentees a RETURN statement will be used before here. */
+ __builtin_unreachable ();
+}
+
+
+/*
+ isCDataTypes - return TRUE if n is CharStar or ConstCharStar.
+*/
+
+static bool isCDataTypes (decl_node__opaque n)
+{
+ decl_node__opaque scope;
+
+ scope = static_cast<decl_node__opaque> (decl_getScope (static_cast<decl_node> (n)));
+ return ((scope != NULL) && ((decl_getSymName (static_cast<decl_node> (scope))) == (nameKey_makeKey ((const char *) "CDataTypes", 10)))) && (((decl_getSymName (static_cast<decl_node> (n))) == (nameKey_makeKey ((const char *) "CharStar", 8))) || ((decl_getSymName (static_cast<decl_node> (n))) == (nameKey_makeKey ((const char *) "ConstCharStar", 13))));
+ /* static analysis guarentees a RETURN statement will be used before here. */
+ __builtin_unreachable ();
+}
+
+
+/*
+ doCDataTypes - if we are going to declare CharStar or ConstCharStar
+ then generate a comment instead.
+*/
+
+static void doCDataTypes (mcPretty_pretty p, decl_node__opaque n)
+{
+ if (isCDataTypes (n))
+ {
+ /* avoid gcc warning by using compound statement even if not strictly necessary. */
+ if ((decl_getSymName (static_cast<decl_node> (n))) == (nameKey_makeKey ((const char *) "CharStar", 8)))
+ {
+ outText (p, (const char *) "/* Not going to declare ", 24);
+ doTypeNameC (p, n);
+ outText (p, (const char *) " as it is a C type. */\\n\\n", 27);
+ charStarN = n;
+ }
+ else if ((decl_getSymName (static_cast<decl_node> (n))) == (nameKey_makeKey ((const char *) "ConstCharStar", 13)))
+ {
+ /* avoid dangling else. */
+ outText (p, (const char *) "/* Not going to declare ", 24);
+ doTypeNameC (p, n);
+ outText (p, (const char *) " as it is a C type. */\\n\\n", 27);
+ constCharStarN = n;
+ }
+ }
+}
+
+
+/*
+ doCDataTypesC - generate the C representation of the CDataTypes data types.
+*/
+
+static void doCDataTypesC (mcPretty_pretty p, decl_node__opaque n)
+{
+ if (n == charStarN)
+ {
+ outText (p, (const char *) "char *", 6);
+ mcPretty_setNeedSpace (p);
+ }
+ else if (n == constCharStarN)
+ {
+ /* avoid dangling else. */
+ outText (p, (const char *) "const char *", 12);
+ mcPretty_setNeedSpace (p);
+ }
+}
+
+
+/*
+ doTypeOrPointer - only declare type or pointer n providing that
+ the name is not location_t or tree and
+ the --gccConfigSystem option is enabled.
+*/
+
+static void doTypeOrPointer (mcPretty_pretty p, decl_node__opaque n)
+{
+ decl_node__opaque m;
+
+ if (isGccType (n))
+ {
+ doGccType (p, n);
+ }
+ else if (isCDataTypes (n))
+ {
+ /* avoid dangling else. */
+ doCDataTypes (p, n);
+ }
+ else
+ {
+ /* avoid dangling else. */
+ m = static_cast<decl_node__opaque> (decl_getType (static_cast<decl_node> (n)));
+ outText (p, (const char *) "typedef", 7);
+ mcPretty_setNeedSpace (p);
+ doTypeC (p, m, &m);
+ if (decl_isType (static_cast<decl_node> (m)))
+ {
+ mcPretty_setNeedSpace (p);
+ }
+ doTypeNameC (p, n);
+ doTypeNameModifier (p, n);
+ outText (p, (const char *) ";\\n\\n", 5);
+ }
+}
+
+
+/*
+ doTypedef - generate a typedef for n provuiding it is not
+*/
+
+static void doTypedef (mcPretty_pretty p, decl_node__opaque n)
+{
+ decl_node__opaque m;
+
+ if (isGccType (n))
+ {
+ doGccType (p, n);
+ }
+ else if (isCDataTypes (n))
+ {
+ /* avoid dangling else. */
+ doCDataTypes (p, n);
+ }
+ else
+ {
+ /* avoid dangling else. */
+ m = static_cast<decl_node__opaque> (decl_getType (static_cast<decl_node> (n)));
+ outText (p, (const char *) "typedef", 7);
+ mcPretty_setNeedSpace (p);
+ doTypeC (p, m, &m);
+ if (decl_isType (static_cast<decl_node> (m)))
+ {
+ mcPretty_setNeedSpace (p);
+ }
+ doTypeNameC (p, n);
+ doTypeNameModifier (p, n);
+ outText (p, (const char *) ";\\n\\n", 5);
+ }
+}
+
+
/*
doTypesC -
*/
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 (static_cast<decl_node> (m)))
- {
- mcPretty_setNeedSpace (doP);
- }
- doTypeNameC (doP, n);
- doTypeNameModifier (doP, n);
- outText (doP, (const char *) ";\\n\\n", 5);
+ doTypeOrPointer (doP, n);
}
else if (decl_isEnumeration (static_cast<decl_node> (m)))
{
else
{
/* avoid dangling else. */
- outText (doP, (const char *) "typedef", 7);
- mcPretty_setNeedSpace (doP);
- doTypeC (doP, m, &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);
+ doTypedef (doP, n);
}
}
}
{
outText (p, (const char *) "void", 4);
}
+ else if (isCDataTypes (n))
+ {
+ /* avoid dangling else. */
+ doCDataTypesC (p, n);
+ }
else if (isBase (n))
{
/* avoid dangling else. */
/* avoid dangling else. */
doSetC (p, n);
}
+ else if (isCDataTypes (n))
+ {
+ /* avoid dangling else. */
+ doCDataTypesC (p, n);
+ }
else
{
/* avoid dangling else. */
- /* --fixme-- */
- mcPretty_print (p, (const char *) "to do ... typedef etc etc ", 27);
- doFQNameC (p, n);
- mcPretty_print (p, (const char *) ";\\n", 3);
- M2RTS_HALT (-1);
- __builtin_unreachable ();
+ mcMetaError_metaError1 ((const char *) "expecting a type symbol rather than a {%1DMd} {%1DMa}", 53, (const unsigned char *) &n, (sizeof (n)-1));
+ mcError_flushErrors ();
+ mcError_errorAbort0 ((const char *) "terminating compilation", 23);
}
}
outText (p, (const char *) "void", 4);
mcPretty_setNeedSpace (p);
}
+ else if (n == charStarN)
+ {
+ /* avoid dangling else. */
+ outText (p, (const char *) "char *", 6);
+ mcPretty_setNeedSpace (p);
+ }
+ else if (n == constCharStarN)
+ {
+ /* avoid dangling else. */
+ outText (p, (const char *) "const char *", 12);
+ mcPretty_setNeedSpace (p);
+ }
else if (isBase (n))
{
/* avoid dangling else. */
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)))))
+ if (((n != NULL) && (! (alists_isItemInList (globalGroup->partialQ, reinterpret_cast <void *> (n))))) && (! (alists_isItemInList (globalGroup->doneQ, reinterpret_cast <void *> (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));
+ alists_includeItemIntoList (globalGroup->todoQ, reinterpret_cast <void *> (n));
}
}
static void simplifyNode (alists_alist l, decl_node__opaque n)
{
- if (! (alists_isItemInList (l, reinterpret_cast<void *> (n))))
+ if (! (alists_isItemInList (l, reinterpret_cast <void *> (n))))
{
- alists_includeItemIntoList (l, reinterpret_cast<void *> (n));
+ alists_includeItemIntoList (l, reinterpret_cast <void *> (n));
doSimplifyNode (l, n);
}
}
}
+/*
+ castDestType - emit the destination type ft
+*/
+
+static void castDestType (mcPretty_pretty p, decl_node__opaque formal, decl_node__opaque ft)
+{
+ doTypeNameC (p, ft);
+ if (decl_isVarParam (static_cast<decl_node> (formal)))
+ {
+ outText (p, (const char *) "*", 1);
+ }
+}
+
+
+/*
+ identifyPointer -
+*/
+
+static decl_node__opaque identifyPointer (decl_node__opaque type)
+{
+ if (decl_isPointer (static_cast<decl_node> (type)))
+ {
+ /* avoid gcc warning by using compound statement even if not strictly necessary. */
+ if ((decl_skipType (decl_getType (static_cast<decl_node> (type)))) == charN)
+ {
+ return charStarN;
+ }
+ else if (((decl_skipType (decl_getType (static_cast<decl_node> (type)))) == byteN) || ((decl_skipType (decl_getType (static_cast<decl_node> (type)))) == locN))
+ {
+ /* avoid dangling else. */
+ return addressN;
+ }
+ }
+ return type;
+ /* static analysis guarentees a RETURN statement will be used before here. */
+ __builtin_unreachable ();
+}
+
+
+/*
+ castPointer - provides a six way cast between ADDRESS (ie void * ),
+ char * and const char *.
+*/
+
+static unsigned int castPointer (mcPretty_pretty p, decl_node__opaque actual, decl_node__opaque formal, decl_node__opaque at, decl_node__opaque ft)
+{
+ decl_node__opaque sat;
+ decl_node__opaque sft;
+ unsigned int parenth;
+
+ parenth = 0;
+ if (at != ft)
+ {
+ sat = identifyPointer (static_cast<decl_node__opaque> (decl_skipType (static_cast<decl_node> (at))));
+ sft = identifyPointer (static_cast<decl_node__opaque> (decl_skipType (static_cast<decl_node> (ft))));
+ if (sat == addressN)
+ {
+ if (sft == charStarN)
+ {
+ outText (p, (const char *) "reinterpret_cast <", 18);
+ castDestType (p, formal, ft);
+ outText (p, (const char *) ">", 1);
+ }
+ else if (sft == constCharStarN)
+ {
+ /* avoid dangling else. */
+ outText (p, (const char *) "const_cast <", 12);
+ castDestType (p, formal, ft);
+ outText (p, (const char *) "> (static_cast <", 16);
+ doTypeNameC (p, charStarN);
+ outText (p, (const char *) ">", 1);
+ parenth += 1;
+ }
+ else
+ {
+ /* avoid dangling else. */
+ outText (p, (const char *) "reinterpret_cast <", 18);
+ castDestType (p, formal, ft);
+ outText (p, (const char *) ">", 1);
+ }
+ }
+ else if (sat == charStarN)
+ {
+ /* avoid dangling else. */
+ if (sft == addressN)
+ {
+ outText (p, (const char *) "reinterpret_cast <", 18);
+ castDestType (p, formal, ft);
+ outText (p, (const char *) ">", 1);
+ }
+ else if (sft == constCharStarN)
+ {
+ /* avoid dangling else. */
+ outText (p, (const char *) "const_cast <", 12);
+ castDestType (p, formal, ft);
+ outText (p, (const char *) ">", 1);
+ }
+ else
+ {
+ /* avoid dangling else. */
+ outText (p, (const char *) "reinterpret_cast <", 18);
+ castDestType (p, formal, ft);
+ outText (p, (const char *) ">", 1);
+ }
+ }
+ else if (sat == constCharStarN)
+ {
+ /* avoid dangling else. */
+ if (sft == addressN)
+ {
+ outText (p, (const char *) "static_cast <", 13);
+ castDestType (p, formal, ft);
+ outText (p, (const char *) "> (const_cast <", 15);
+ doTypeNameC (p, charStarN);
+ outText (p, (const char *) ">", 1);
+ parenth += 1;
+ }
+ else if (sft == charStarN)
+ {
+ /* avoid dangling else. */
+ outText (p, (const char *) "const_cast <", 12);
+ castDestType (p, formal, ft);
+ outText (p, (const char *) ">", 1);
+ }
+ else
+ {
+ /* avoid dangling else. */
+ outText (p, (const char *) "reinterpret_cast <", 18);
+ castDestType (p, formal, ft);
+ outText (p, (const char *) ">", 1);
+ }
+ }
+ else
+ {
+ /* avoid dangling else. */
+ outText (p, (const char *) "reinterpret_cast <", 18);
+ castDestType (p, formal, ft);
+ outText (p, (const char *) ">", 1);
+ }
+ mcPretty_setNeedSpace (p);
+ outText (p, (const char *) "(", 1);
+ parenth += 1;
+ }
+ return parenth;
+ /* static analysis guarentees a RETURN statement will be used before here. */
+ __builtin_unreachable ();
+}
+
+
/*
checkSystemCast - checks to see if we are passing to/from
a system generic type (WORD, BYTE, ADDRESS)
/* avoid gcc warning by using compound statement even if not strictly necessary. */
if (lang == decl_ansiCP)
{
- if ((isString (actual)) && ((decl_skipType (static_cast<decl_node> (ft))) == addressN))
+ if ((isString (actual)) && (isCDataType (static_cast<decl_node__opaque> (decl_skipType (static_cast<decl_node> (ft))))))
+ {
+ /* Nothing to do. */
+ return 0;
+ }
+ else if ((isString (actual)) && ((decl_skipType (static_cast<decl_node> (ft))) == addressN))
{
+ /* avoid dangling else. */
outText (p, (const char *) "const_cast<void*> (static_cast<const void*> (", 45);
return 2;
}
- else if ((decl_isPointer (decl_skipType (static_cast<decl_node> (ft)))) || ((decl_skipType (static_cast<decl_node> (ft))) == addressN))
+ else if (((decl_isPointer (decl_skipType (static_cast<decl_node> (ft)))) || ((decl_skipType (static_cast<decl_node> (ft))) == addressN)) || (isCDataType (static_cast<decl_node__opaque> (decl_skipType (static_cast<decl_node> (ft))))))
{
/* avoid dangling else. */
if (actual == nilN)
}
else
{
- outText (p, (const char *) "reinterpret_cast<", 17);
- doTypeNameC (p, ft);
- if (decl_isVarParam (static_cast<decl_node> (formal)))
- {
- outText (p, (const char *) "*", 1);
- }
- mcPretty_noSpace (p);
- outText (p, (const char *) "> (", 3);
+ return castPointer (p, actual, formal, at, ft);
}
}
else
static decl_dependentState walkDependants (alists_alist l, decl_node__opaque n)
{
- if ((n == NULL) || (alists_isItemInList (globalGroup->doneQ, reinterpret_cast<void *> (n))))
+ if ((n == NULL) || (alists_isItemInList (globalGroup->doneQ, reinterpret_cast <void *> (n))))
{
return decl_completed;
}
- else if (alists_isItemInList (l, reinterpret_cast<void *> (n)))
+ else if (alists_isItemInList (l, reinterpret_cast <void *> (n)))
{
/* avoid dangling else. */
return decl_recursive;
else
{
/* avoid dangling else. */
- alists_includeItemIntoList (l, reinterpret_cast<void *> (n));
+ alists_includeItemIntoList (l, reinterpret_cast <void *> (n));
return doDependants (l, n);
}
/* static analysis guarentees a RETURN statement will be used before here. */
decl_node__opaque t;
t = static_cast<decl_node__opaque> (decl_getType (static_cast<decl_node> (n)));
- if (alists_isItemInList (globalGroup->doneQ, reinterpret_cast<void *> (t)))
+ if (alists_isItemInList (globalGroup->doneQ, reinterpret_cast <void *> (t)))
{
return decl_completed;
}
- else if (alists_isItemInList (globalGroup->partialQ, reinterpret_cast<void *> (t)))
+ else if (alists_isItemInList (globalGroup->partialQ, reinterpret_cast <void *> (t)))
{
/* avoid dangling else. */
return decl_blocked;
if (mcOptions_getDebugTopological ())
{
/* avoid gcc warning by using compound statement even if not strictly necessary. */
- if (alists_isItemInList (globalGroup->todoQ, reinterpret_cast<void *> (n)))
+ if (alists_isItemInList (globalGroup->todoQ, reinterpret_cast <void *> (n)))
{
db ((const char *) "{T", 2, n);
outText (doP, (const char *) "}", 1);
}
- else if (alists_isItemInList (globalGroup->partialQ, reinterpret_cast<void *> (n)))
+ else if (alists_isItemInList (globalGroup->partialQ, reinterpret_cast <void *> (n)))
{
/* avoid dangling else. */
db ((const char *) "{P", 2, n);
outText (doP, (const char *) "}", 1);
}
- else if (alists_isItemInList (globalGroup->doneQ, reinterpret_cast<void *> (n)))
+ else if (alists_isItemInList (globalGroup->doneQ, reinterpret_cast <void *> (n)))
{
/* avoid dangling else. */
db ((const char *) "{D", 2, 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)))))
+ if (! ((alists_isItemInList (globalGroup->doneQ, reinterpret_cast <void *> (n))) || (alists_isItemInList (globalGroup->partialQ, reinterpret_cast <void *> (n)))))
{
addTodo (n);
}
decl_node__opaque t;
t = static_cast<decl_node__opaque> (decl_getType (static_cast<decl_node> (n)));
- if (alists_isItemInList (globalGroup->doneQ, reinterpret_cast<void *> (t)))
+ if (alists_isItemInList (globalGroup->doneQ, reinterpret_cast <void *> (t)))
{
return decl_completed;
}
/* if the type of, n, is done or partial then we can output pointer. */
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))))
+ 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. */
return decl_completed;
decl_dependentState s;
/* an array can only be declared if its data type has already been emitted. */
- if (! (alists_isItemInList (globalGroup->doneQ, reinterpret_cast<void *> (n->arrayF.type))))
+ if (! (alists_isItemInList (globalGroup->doneQ, reinterpret_cast <void *> (n->arrayF.type))))
{
s = walkDependants (l, n->arrayF.type);
queueBlocked (n->arrayF.type);
decl_node__opaque t;
t = static_cast<decl_node__opaque> (decl_getType (static_cast<decl_node> (n)));
- if (alists_isItemInList (globalGroup->partialQ, reinterpret_cast<void *> (t)))
+ if (alists_isItemInList (globalGroup->partialQ, reinterpret_cast <void *> (t)))
{
/* parameter can be issued from a partial. */
return decl_completed;
decl_node__opaque t;
t = static_cast<decl_node__opaque> (decl_getType (static_cast<decl_node> (n)));
- if (alists_isItemInList (globalGroup->partialQ, reinterpret_cast<void *> (t)))
+ if (alists_isItemInList (globalGroup->partialQ, reinterpret_cast <void *> (t)))
{
/* parameter can be issued from a partial. */
return decl_completed;
decl_node__opaque t;
t = static_cast<decl_node__opaque> (decl_getType (static_cast<decl_node> (n)));
- if (alists_isItemInList (globalGroup->partialQ, reinterpret_cast<void *> (t)))
+ if (alists_isItemInList (globalGroup->partialQ, reinterpret_cast <void *> (t)))
{
/* parameter can be issued from a partial. */
return decl_completed;
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)))
+ if (alists_isItemInList (globalGroup->partialQ, reinterpret_cast <void *> (t)))
{
dbs (decl_partial, n);
return decl_partial;
}
- else if (alists_isItemInList (globalGroup->doneQ, reinterpret_cast<void *> (t)))
+ else if (alists_isItemInList (globalGroup->doneQ, reinterpret_cast <void *> (t)))
{
/* avoid dangling else. */
dbs (decl_completed, n);
decl_node__opaque t;
t = static_cast<decl_node__opaque> (decl_getType (static_cast<decl_node> (n)));
- if (alists_isItemInList (globalGroup->partialQ, reinterpret_cast<void *> (t)))
+ if (alists_isItemInList (globalGroup->partialQ, reinterpret_cast <void *> (t)))
{} /* empty. */
else
{
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)));
+ mcDebug_assert (alists_isItemInList (v, reinterpret_cast <void *> (n)));
switch (n->kind)
{
case decl_explist:
static void visitNode (alists_alist v, decl_node__opaque n, decl_nodeProcedure p)
{
- if ((n != NULL) && (! (alists_isItemInList (v, reinterpret_cast<void *> (n)))))
+ if ((n != NULL) && (! (alists_isItemInList (v, reinterpret_cast <void *> (n)))))
{
- alists_includeItemIntoList (v, reinterpret_cast<void *> (n));
+ alists_includeItemIntoList (v, reinterpret_cast <void *> (n));
(*p.proc) (n);
visitDependants (v, n, p);
}
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_removeItemFromList (globalGroup->todoQ, reinterpret_cast <void *> (d));
addDone (d);
i = 1;
}
else if (tryPartial (d, pt))
{
/* avoid dangling else. */
- alists_removeItemFromList (globalGroup->todoQ, reinterpret_cast<void *> (d));
- alists_includeItemIntoList (globalGroup->partialQ, reinterpret_cast<void *> (d));
+ alists_removeItemFromList (globalGroup->todoQ, reinterpret_cast <void *> (d));
+ alists_includeItemIntoList (globalGroup->partialQ, reinterpret_cast <void *> (d));
i = 1;
}
else
d = static_cast<decl_node__opaque> (alists_getItemFromList (globalGroup->partialQ, i));
if (tryCompleteFromPartial (d, t))
{
- alists_removeItemFromList (globalGroup->partialQ, reinterpret_cast<void *> (d));
+ alists_removeItemFromList (globalGroup->partialQ, reinterpret_cast <void *> (d));
addDone (d);
i = 1;
n -= 1;
{
DynamicStrings_String s;
- alists_includeItemIntoList (globalGroup->doneQ, reinterpret_cast<void *> (n));
+ 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);
{
if (n != NULL)
{
- alists_includeItemIntoList (l, reinterpret_cast<void *> (n));
+ alists_includeItemIntoList (l, reinterpret_cast <void *> (n));
}
return n;
/* static analysis guarentees a RETURN statement will be used before here. */
outputFile = FIO_StdOut;
doP = mcPretty_initPretty ((mcPretty_writeProc) {(mcPretty_writeProc_t) write_}, (mcPretty_writeLnProc) {(mcPretty_writeLnProc_t) writeln});
l = alists_initList ();
- alists_includeItemIntoList (l, reinterpret_cast<void *> (n));
+ alists_includeItemIntoList (l, reinterpret_cast <void *> (n));
i = 1;
do {
n = static_cast<decl_node__opaque> (alists_getItemFromList (l, i));
imN = makeBase (decl_im);
reN = makeBase (decl_re);
cmplxN = makeBase (decl_cmplx);
- symbolKey_putSymKey (baseSymbols, nameKey_makeKey ((const char *) "BOOLEAN", 7), reinterpret_cast<void *> (booleanN));
- symbolKey_putSymKey (baseSymbols, nameKey_makeKey ((const char *) "PROC", 4), reinterpret_cast<void *> (procN));
- symbolKey_putSymKey (baseSymbols, nameKey_makeKey ((const char *) "CHAR", 4), reinterpret_cast<void *> (charN));
- symbolKey_putSymKey (baseSymbols, nameKey_makeKey ((const char *) "CARDINAL", 8), reinterpret_cast<void *> (cardinalN));
- symbolKey_putSymKey (baseSymbols, nameKey_makeKey ((const char *) "SHORTCARD", 9), reinterpret_cast<void *> (shortcardN));
- symbolKey_putSymKey (baseSymbols, nameKey_makeKey ((const char *) "LONGCARD", 8), reinterpret_cast<void *> (longcardN));
- symbolKey_putSymKey (baseSymbols, nameKey_makeKey ((const char *) "INTEGER", 7), reinterpret_cast<void *> (integerN));
- symbolKey_putSymKey (baseSymbols, nameKey_makeKey ((const char *) "LONGINT", 7), reinterpret_cast<void *> (longintN));
- symbolKey_putSymKey (baseSymbols, nameKey_makeKey ((const char *) "SHORTINT", 8), reinterpret_cast<void *> (shortintN));
- symbolKey_putSymKey (baseSymbols, nameKey_makeKey ((const char *) "BITSET", 6), reinterpret_cast<void *> (bitsetN));
- symbolKey_putSymKey (baseSymbols, nameKey_makeKey ((const char *) "REAL", 4), reinterpret_cast<void *> (realN));
- symbolKey_putSymKey (baseSymbols, nameKey_makeKey ((const char *) "SHORTREAL", 9), reinterpret_cast<void *> (shortrealN));
- symbolKey_putSymKey (baseSymbols, nameKey_makeKey ((const char *) "LONGREAL", 8), reinterpret_cast<void *> (longrealN));
- symbolKey_putSymKey (baseSymbols, nameKey_makeKey ((const char *) "COMPLEX", 7), reinterpret_cast<void *> (complexN));
- symbolKey_putSymKey (baseSymbols, nameKey_makeKey ((const char *) "LONGCOMPLEX", 11), reinterpret_cast<void *> (longcomplexN));
- symbolKey_putSymKey (baseSymbols, nameKey_makeKey ((const char *) "SHORTCOMPLEX", 12), reinterpret_cast<void *> (shortcomplexN));
- symbolKey_putSymKey (baseSymbols, nameKey_makeKey ((const char *) "NIL", 3), reinterpret_cast<void *> (nilN));
- symbolKey_putSymKey (baseSymbols, nameKey_makeKey ((const char *) "TRUE", 4), reinterpret_cast<void *> (trueN));
- symbolKey_putSymKey (baseSymbols, nameKey_makeKey ((const char *) "FALSE", 5), reinterpret_cast<void *> (falseN));
- symbolKey_putSymKey (baseSymbols, nameKey_makeKey ((const char *) "SIZE", 4), reinterpret_cast<void *> (sizeN));
- symbolKey_putSymKey (baseSymbols, nameKey_makeKey ((const char *) "MIN", 3), reinterpret_cast<void *> (minN));
- symbolKey_putSymKey (baseSymbols, nameKey_makeKey ((const char *) "MAX", 3), reinterpret_cast<void *> (maxN));
- symbolKey_putSymKey (baseSymbols, nameKey_makeKey ((const char *) "FLOAT", 5), reinterpret_cast<void *> (floatN));
- symbolKey_putSymKey (baseSymbols, nameKey_makeKey ((const char *) "TRUNC", 5), reinterpret_cast<void *> (truncN));
- symbolKey_putSymKey (baseSymbols, nameKey_makeKey ((const char *) "ORD", 3), reinterpret_cast<void *> (ordN));
- symbolKey_putSymKey (baseSymbols, nameKey_makeKey ((const char *) "VAL", 3), reinterpret_cast<void *> (valN));
- symbolKey_putSymKey (baseSymbols, nameKey_makeKey ((const char *) "CHR", 3), reinterpret_cast<void *> (chrN));
- symbolKey_putSymKey (baseSymbols, nameKey_makeKey ((const char *) "CAP", 3), reinterpret_cast<void *> (capN));
- symbolKey_putSymKey (baseSymbols, nameKey_makeKey ((const char *) "ABS", 3), reinterpret_cast<void *> (absN));
- symbolKey_putSymKey (baseSymbols, nameKey_makeKey ((const char *) "NEW", 3), reinterpret_cast<void *> (newN));
- symbolKey_putSymKey (baseSymbols, nameKey_makeKey ((const char *) "DISPOSE", 7), reinterpret_cast<void *> (disposeN));
- symbolKey_putSymKey (baseSymbols, nameKey_makeKey ((const char *) "LENGTH", 6), reinterpret_cast<void *> (lengthN));
- symbolKey_putSymKey (baseSymbols, nameKey_makeKey ((const char *) "INC", 3), reinterpret_cast<void *> (incN));
- symbolKey_putSymKey (baseSymbols, nameKey_makeKey ((const char *) "DEC", 3), reinterpret_cast<void *> (decN));
- symbolKey_putSymKey (baseSymbols, nameKey_makeKey ((const char *) "INCL", 4), reinterpret_cast<void *> (inclN));
- symbolKey_putSymKey (baseSymbols, nameKey_makeKey ((const char *) "EXCL", 4), reinterpret_cast<void *> (exclN));
- symbolKey_putSymKey (baseSymbols, nameKey_makeKey ((const char *) "HIGH", 4), reinterpret_cast<void *> (highN));
- symbolKey_putSymKey (baseSymbols, nameKey_makeKey ((const char *) "CMPLX", 5), reinterpret_cast<void *> (cmplxN));
- symbolKey_putSymKey (baseSymbols, nameKey_makeKey ((const char *) "RE", 2), reinterpret_cast<void *> (reN));
- symbolKey_putSymKey (baseSymbols, nameKey_makeKey ((const char *) "IM", 2), reinterpret_cast<void *> (imN));
+ symbolKey_putSymKey (baseSymbols, nameKey_makeKey ((const char *) "BOOLEAN", 7), reinterpret_cast <void *> (booleanN));
+ symbolKey_putSymKey (baseSymbols, nameKey_makeKey ((const char *) "PROC", 4), reinterpret_cast <void *> (procN));
+ symbolKey_putSymKey (baseSymbols, nameKey_makeKey ((const char *) "CHAR", 4), reinterpret_cast <void *> (charN));
+ symbolKey_putSymKey (baseSymbols, nameKey_makeKey ((const char *) "CARDINAL", 8), reinterpret_cast <void *> (cardinalN));
+ symbolKey_putSymKey (baseSymbols, nameKey_makeKey ((const char *) "SHORTCARD", 9), reinterpret_cast <void *> (shortcardN));
+ symbolKey_putSymKey (baseSymbols, nameKey_makeKey ((const char *) "LONGCARD", 8), reinterpret_cast <void *> (longcardN));
+ symbolKey_putSymKey (baseSymbols, nameKey_makeKey ((const char *) "INTEGER", 7), reinterpret_cast <void *> (integerN));
+ symbolKey_putSymKey (baseSymbols, nameKey_makeKey ((const char *) "LONGINT", 7), reinterpret_cast <void *> (longintN));
+ symbolKey_putSymKey (baseSymbols, nameKey_makeKey ((const char *) "SHORTINT", 8), reinterpret_cast <void *> (shortintN));
+ symbolKey_putSymKey (baseSymbols, nameKey_makeKey ((const char *) "BITSET", 6), reinterpret_cast <void *> (bitsetN));
+ symbolKey_putSymKey (baseSymbols, nameKey_makeKey ((const char *) "REAL", 4), reinterpret_cast <void *> (realN));
+ symbolKey_putSymKey (baseSymbols, nameKey_makeKey ((const char *) "SHORTREAL", 9), reinterpret_cast <void *> (shortrealN));
+ symbolKey_putSymKey (baseSymbols, nameKey_makeKey ((const char *) "LONGREAL", 8), reinterpret_cast <void *> (longrealN));
+ symbolKey_putSymKey (baseSymbols, nameKey_makeKey ((const char *) "COMPLEX", 7), reinterpret_cast <void *> (complexN));
+ symbolKey_putSymKey (baseSymbols, nameKey_makeKey ((const char *) "LONGCOMPLEX", 11), reinterpret_cast <void *> (longcomplexN));
+ symbolKey_putSymKey (baseSymbols, nameKey_makeKey ((const char *) "SHORTCOMPLEX", 12), reinterpret_cast <void *> (shortcomplexN));
+ symbolKey_putSymKey (baseSymbols, nameKey_makeKey ((const char *) "NIL", 3), reinterpret_cast <void *> (nilN));
+ symbolKey_putSymKey (baseSymbols, nameKey_makeKey ((const char *) "TRUE", 4), reinterpret_cast <void *> (trueN));
+ symbolKey_putSymKey (baseSymbols, nameKey_makeKey ((const char *) "FALSE", 5), reinterpret_cast <void *> (falseN));
+ symbolKey_putSymKey (baseSymbols, nameKey_makeKey ((const char *) "SIZE", 4), reinterpret_cast <void *> (sizeN));
+ symbolKey_putSymKey (baseSymbols, nameKey_makeKey ((const char *) "MIN", 3), reinterpret_cast <void *> (minN));
+ symbolKey_putSymKey (baseSymbols, nameKey_makeKey ((const char *) "MAX", 3), reinterpret_cast <void *> (maxN));
+ symbolKey_putSymKey (baseSymbols, nameKey_makeKey ((const char *) "FLOAT", 5), reinterpret_cast <void *> (floatN));
+ symbolKey_putSymKey (baseSymbols, nameKey_makeKey ((const char *) "TRUNC", 5), reinterpret_cast <void *> (truncN));
+ symbolKey_putSymKey (baseSymbols, nameKey_makeKey ((const char *) "ORD", 3), reinterpret_cast <void *> (ordN));
+ symbolKey_putSymKey (baseSymbols, nameKey_makeKey ((const char *) "VAL", 3), reinterpret_cast <void *> (valN));
+ symbolKey_putSymKey (baseSymbols, nameKey_makeKey ((const char *) "CHR", 3), reinterpret_cast <void *> (chrN));
+ symbolKey_putSymKey (baseSymbols, nameKey_makeKey ((const char *) "CAP", 3), reinterpret_cast <void *> (capN));
+ symbolKey_putSymKey (baseSymbols, nameKey_makeKey ((const char *) "ABS", 3), reinterpret_cast <void *> (absN));
+ symbolKey_putSymKey (baseSymbols, nameKey_makeKey ((const char *) "NEW", 3), reinterpret_cast <void *> (newN));
+ symbolKey_putSymKey (baseSymbols, nameKey_makeKey ((const char *) "DISPOSE", 7), reinterpret_cast <void *> (disposeN));
+ symbolKey_putSymKey (baseSymbols, nameKey_makeKey ((const char *) "LENGTH", 6), reinterpret_cast <void *> (lengthN));
+ symbolKey_putSymKey (baseSymbols, nameKey_makeKey ((const char *) "INC", 3), reinterpret_cast <void *> (incN));
+ symbolKey_putSymKey (baseSymbols, nameKey_makeKey ((const char *) "DEC", 3), reinterpret_cast <void *> (decN));
+ symbolKey_putSymKey (baseSymbols, nameKey_makeKey ((const char *) "INCL", 4), reinterpret_cast <void *> (inclN));
+ symbolKey_putSymKey (baseSymbols, nameKey_makeKey ((const char *) "EXCL", 4), reinterpret_cast <void *> (exclN));
+ symbolKey_putSymKey (baseSymbols, nameKey_makeKey ((const char *) "HIGH", 4), reinterpret_cast <void *> (highN));
+ symbolKey_putSymKey (baseSymbols, nameKey_makeKey ((const char *) "CMPLX", 5), reinterpret_cast <void *> (cmplxN));
+ symbolKey_putSymKey (baseSymbols, nameKey_makeKey ((const char *) "RE", 2), reinterpret_cast <void *> (reN));
+ symbolKey_putSymKey (baseSymbols, nameKey_makeKey ((const char *) "IM", 2), reinterpret_cast <void *> (imN));
addDone (booleanN);
addDone (charN);
addDone (cardinalN);
}
+/*
+ makeCDataTypes - assign the charStarN and constCharStarN to NIL.
+*/
+
+static void makeCDataTypes (void)
+{
+ decl_node__opaque CdatatypesN;
+
+ CdatatypesN = static_cast<decl_node__opaque> (decl_lookupDef (nameKey_makeKey ((const char *) "CDataTypes", 10)));
+ decl_enterScope (static_cast<decl_node> (CdatatypesN));
+ charStarN = static_cast<decl_node__opaque> (decl_makePointer (static_cast<decl_node> (charN)));
+ constCharStarN = static_cast<decl_node__opaque> (decl_makePointer (static_cast<decl_node> (charN)));
+ decl_leaveScope ();
+}
+
+
/*
init -
*/
outputState = decl_punct;
tempCount = 0;
mustVisitScope = false;
+ makeCDataTypes ();
}
if (d == NULL)
{
d = makeDef (n);
- symbolKey_putSymKey (defUniverse, n, reinterpret_cast<void *> (d));
- Indexing_IncludeIndiceIntoIndex (defUniverseI, reinterpret_cast<void *> (d));
+ symbolKey_putSymKey (defUniverse, n, reinterpret_cast <void *> (d));
+ Indexing_IncludeIndiceIntoIndex (defUniverseI, reinterpret_cast <void *> (d));
}
return static_cast<decl_node> (d);
/* static analysis guarentees a RETURN statement will be used before here. */
if (m == NULL)
{
m = makeImp (n);
- symbolKey_putSymKey (modUniverse, n, reinterpret_cast<void *> (m));
- Indexing_IncludeIndiceIntoIndex (modUniverseI, reinterpret_cast<void *> (m));
+ symbolKey_putSymKey (modUniverse, n, reinterpret_cast <void *> (m));
+ Indexing_IncludeIndiceIntoIndex (modUniverseI, reinterpret_cast <void *> (m));
}
mcDebug_assert (! (decl_isModule (static_cast<decl_node> (m))));
return static_cast<decl_node> (m);
if (m == NULL)
{
m = makeModule (n);
- symbolKey_putSymKey (modUniverse, n, reinterpret_cast<void *> (m));
- Indexing_IncludeIndiceIntoIndex (modUniverseI, reinterpret_cast<void *> (m));
+ symbolKey_putSymKey (modUniverse, n, reinterpret_cast <void *> (m));
+ Indexing_IncludeIndiceIntoIndex (modUniverseI, reinterpret_cast <void *> (m));
}
mcDebug_assert (! (decl_isImp (static_cast<decl_node> (m))));
return static_cast<decl_node> (m);
}
+/*
+ putDefUnqualified - the definition module uses unqualified.
+*/
+
+extern "C" void decl_putDefUnqualified (decl_node n)
+{
+ mcDebug_assert (decl_isDef (n));
+ /* Currently (and this is a temporary development restriction to
+ reduce any search space for bugs) the only module which can be
+ export unqualified is gcctypes. */
+ if (static_cast<decl_node__opaque> (n)->defF.name == (nameKey_makeKey ((const char *) "gcctypes", 8)))
+ {
+ static_cast<decl_node__opaque> (n)->defF.unqualified = true;
+ }
+}
+
+
+/*
+ isDefUnqualified - returns TRUE if the definition module uses unqualified.
+*/
+
+extern "C" bool decl_isDefUnqualified (decl_node n)
+{
+ return (decl_isDef (n)) && static_cast<decl_node__opaque> (n)->defF.unqualified;
+ /* static analysis guarentees a RETURN statement will be used before here. */
+ __builtin_unreachable ();
+}
+
+
/*
lookupInScope - looks up a symbol named, n, from, scope.
*/
extern "C" decl_node decl_skipType (decl_node n)
{
- while ((n != NULL) && (decl_isType (n)))
+ while (((n != NULL) && (decl_isType (n))) && (! (isCDataType (static_cast<decl_node__opaque> (n)))))
{
if ((decl_getType (n)) == NULL)
{
switch (s->kind)
{
case decl_def:
- return Indexing_IsIndiceInIndex (s->defF.exported, reinterpret_cast<void *> (n));
+ return Indexing_IsIndiceInIndex (s->defF.exported, reinterpret_cast <void *> (n));
break;
{
case decl_record:
/* now add, n, to the record/varient, r, field list */
- Indexing_IncludeIndiceIntoIndex (static_cast<decl_node__opaque> (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 (static_cast<decl_node__opaque> (r)->varientfieldF.listOfSons, reinterpret_cast<void *> (n));
+ Indexing_IncludeIndiceIntoIndex (static_cast<decl_node__opaque> (r)->varientfieldF.listOfSons, reinterpret_cast <void *> (n));
break;
mcDebug_assert (((decl_isDef (m)) || (decl_isModule (m))) || (decl_isImp (m)));
name = decl_getSymName (n);
+ checkGccType (static_cast<decl_node__opaque> (n));
+ checkCDataTypes (static_cast<decl_node__opaque> (n));
r = static_cast<decl_node__opaque> (decl_lookupInScope (m, name));
if (r == NULL)
{
switch (static_cast<decl_node__opaque> (m)->kind)
{
case decl_def:
- symbolKey_putSymKey (static_cast<decl_node__opaque> (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 (static_cast<decl_node__opaque> (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 (static_cast<decl_node__opaque> (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;
mcDebug_assert ((decl_isDef (i)) || (decl_isModule (i)));
if (decl_isDef (m))
{
- Indexing_IncludeIndiceIntoIndex (static_cast<decl_node__opaque> (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 (static_cast<decl_node__opaque> (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 (static_cast<decl_node__opaque> (m)->moduleF.importedModules, reinterpret_cast<void *> (i));
+ Indexing_IncludeIndiceIntoIndex (static_cast<decl_node__opaque> (m)->moduleF.importedModules, reinterpret_cast <void *> (i));
}
else
{
extern "C" void decl_enterScope (decl_node n)
{
- if (Indexing_IsIndiceInIndex (scopeStack, reinterpret_cast<void *> (n)))
+ if (Indexing_IsIndiceInIndex (scopeStack, reinterpret_cast <void *> (n)))
{
M2RTS_HALT (-1);
__builtin_unreachable ();
}
else
{
- Indexing_IncludeIndiceIntoIndex (scopeStack, reinterpret_cast<void *> (n));
+ Indexing_IncludeIndiceIntoIndex (scopeStack, reinterpret_cast <void *> (n));
}
if (debugScopes)
{
i = Indexing_HighIndice (scopeStack);
n = static_cast<decl_node__opaque> (Indexing_GetIndice (scopeStack, i));
- Indexing_RemoveIndiceFromIndex (scopeStack, reinterpret_cast<void *> (n));
+ Indexing_RemoveIndiceFromIndex (scopeStack, reinterpret_cast <void *> (n));
if (debugScopes)
{
libc_printf ((const char *) "leave scope\\n", 13);
else
{
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));
+ Indexing_IncludeIndiceIntoIndex (static_cast<decl_node__opaque> (n)->procedureF.parameters, reinterpret_cast <void *> (p));
}
}
else
{
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));
+ Indexing_IncludeIndiceIntoIndex (static_cast<decl_node__opaque> (n)->procedureF.parameters, reinterpret_cast <void *> (p));
}
}
switch (static_cast<decl_node__opaque> (proc)->kind)
{
case decl_procedure:
- Indexing_IncludeIndiceIntoIndex (static_cast<decl_node__opaque> (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))
{
static_cast<decl_node__opaque> (proc)->procedureF.vararg = true;
break;
case decl_proctype:
- Indexing_IncludeIndiceIntoIndex (static_cast<decl_node__opaque> (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))
{
static_cast<decl_node__opaque> (proc)->proctypeF.vararg = true;
extern "C" decl_node decl_includeSetValue (decl_node n, decl_node l, decl_node h)
{
mcDebug_assert (decl_isSetValue (n));
- Indexing_IncludeIndiceIntoIndex (static_cast<decl_node__opaque> (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 ();
{
mcDebug_assert (n != NULL);
mcDebug_assert (decl_isExpList (n));
- 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));
+ 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));
}
if (n != NULL)
{
mcDebug_assert (decl_isStatementSequence (s));
- 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));
+ 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)
{
static_cast<decl_node__opaque> (n)->intrinsicF.postUnreachable = false;
{
mcDebug_assert (decl_isCase (n));
mcDebug_assert (decl_isCaseList (l));
- Indexing_IncludeIndiceIntoIndex (static_cast<decl_node__opaque> (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 ();
extern "C" decl_node decl_putCaseRange (decl_node n, decl_node lo, decl_node hi)
{
mcDebug_assert (decl_isCaseList (n));
- Indexing_IncludeIndiceIntoIndex (static_cast<decl_node__opaque> (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 ();
EXTERN void decl_putDefForC (decl_node n);
+/*
+ putDefUnqualified - the definition module uses export unqualified.
+*/
+
+EXTERN void decl_putDefUnqualified (decl_node n);
+
+/*
+ isDefUnqualified - returns TRUE if the definition module uses unqualified.
+*/
+
+EXTERN bool decl_isDefUnqualified (decl_node n);
+
/*
lookupInScope - looks up a symbol named, n, from, scope.
*/
sign does the string have a sign?
*/
-EXTERN void * dtoa_dtoa (double d, dtoa_Mode mode, int ndigits, int *decpt, bool *sign);
+EXTERN void * dtoa_dtoa (double d, int mode, int ndigits, int *decpt, bool *sign);
# ifdef __cplusplus
}
# endif
static symbolKey_symbolTree macros;
static bool initializedCP;
static bool initializedGCC;
+static bool seenGccTree;
+static bool seenGccLocation;
static bool seenIntMin;
static bool seenUIntMin;
static bool seenLongMin;
static bool seenStrlen;
static bool seenCtype;
+/*
+ useGccTree - indicate we have imported tree from gcctypes.
+*/
+
+extern "C" void keyc_useGccTree (void);
+
+/*
+ useGccLocation - indicate we have imported tree from gcctypes.
+*/
+
+extern "C" void keyc_useGccLocation (void);
+
/*
useUnistd - need to use unistd.h call using open/close/read/write require this header.
*/
static void checkGccConfigSystem (mcPretty_pretty p);
+/*
+ checkGccTypes - if we have imported tree or location_t from gcctypes
+ then we include the gcc headers.
+*/
+
+static void checkGccTypes (mcPretty_pretty p);
+
/*
checkCtype -
*/
initializedGCC = true;
mcPretty_print (p, (const char *) "#include \"config.h\"\\n", 21);
mcPretty_print (p, (const char *) "#include \"system.h\"\\n", 21);
+ checkGccTypes (p);
}
}
}
+/*
+ checkGccTypes - if we have imported tree or location_t from gcctypes
+ then we include the gcc headers.
+*/
+
+static void checkGccTypes (mcPretty_pretty p)
+{
+ if (seenGccTree || seenGccLocation)
+ {
+ mcPretty_print (p, (const char *) "#include \"gcc-consolidation.h\"\\n\\n", 34);
+ }
+}
+
+
/*
checkCtype -
*/
/* make a local copy of each unbounded array. */
memcpy (a, a_, _a_high+1);
- symbolKey_putSymKey (s, nameKey_makeKey ((const char *) a, _a_high), reinterpret_cast<void *> (DynamicStrings_InitString ((const char *) a, _a_high)));
+ symbolKey_putSymKey (s, nameKey_makeKey ((const char *) a, _a_high), reinterpret_cast <void *> (DynamicStrings_InitString ((const char *) a, _a_high)));
}
seenSize_t = false;
seenSSize_t = false;
seenSysTypes = false;
+ seenGccTree = false;
+ seenGccLocation = false;
initializedCP = false;
initializedGCC = false;
stack = NULL;
}
+/*
+ useGccTree - indicate we have imported tree from gcctypes.
+*/
+
+extern "C" void keyc_useGccTree (void)
+{
+ seenGccTree = true;
+}
+
+
+/*
+ useGccLocation - indicate we have imported tree from gcctypes.
+*/
+
+extern "C" void keyc_useGccLocation (void)
+{
+ seenGccLocation = true;
+}
+
+
/*
useUnistd - need to use unistd.h call using open/close/read/write require this header.
*/
{
/* no longer a clash with, m, so add it to the current scope. */
n = nameKey_makekey (DynamicStrings_string (m));
- symbolKey_putSymKey (stack->symbols, n, reinterpret_cast<void *> (m));
+ symbolKey_putSymKey (stack->symbols, n, reinterpret_cast <void *> (m));
}
}
else
{
/* avoid dangling else. */
/* no clash, add it to the current scope. */
- symbolKey_putSymKey (stack->symbols, n, reinterpret_cast<void *> (DynamicStrings_InitStringCharStar (nameKey_keyToCharStar (n))));
+ symbolKey_putSymKey (stack->symbols, n, reinterpret_cast <void *> (DynamicStrings_InitStringCharStar (nameKey_keyToCharStar (n))));
}
return m;
/* static analysis guarentees a RETURN statement will be used before here. */
if (scopes)
{
/* no longer a clash with, m, so add it to the current scope. */
- symbolKey_putSymKey (stack->symbols, n, reinterpret_cast<void *> (m));
+ symbolKey_putSymKey (stack->symbols, n, reinterpret_cast <void *> (m));
}
}
else
{
/* avoid dangling else. */
/* no clash, add it to the current scope. */
- symbolKey_putSymKey (stack->symbols, n, reinterpret_cast<void *> (DynamicStrings_InitStringCharStar (nameKey_keyToCharStar (n))));
+ symbolKey_putSymKey (stack->symbols, n, reinterpret_cast <void *> (DynamicStrings_InitStringCharStar (nameKey_keyToCharStar (n))));
}
m = DynamicStrings_KillString (m);
return n;
# endif
+/*
+ useGccTree - indicate we have imported tree from gcctypes.
+*/
+
+EXTERN void keyc_useGccTree (void);
+
+/*
+ useGccLocation - indicate we have imported tree from gcctypes.
+*/
+
+EXTERN void keyc_useGccLocation (void);
+
/*
useUnistd - need to use unistd.h call using open/close/read/write require this header.
*/
struct libc_exitP_p { libc_exitP_t proc; };
+EXTERN double libc_atof (void * nptr);
+EXTERN int libc_atoi (void * nptr);
+EXTERN ssize_t libc_atol (void * nptr);
+EXTERN long int libc_atoll (void * nptr);
+EXTERN double libc_strtod (void * nptr, void * endptr);
+EXTERN float libc_strtof (void * nptr, void * endptr);
+EXTERN long double libc_strtold (void * nptr, void * endptr);
+EXTERN ssize_t libc_strtol (void * nptr, void * endptr, int base);
+EXTERN long int libc_strtoll (void * nptr, void * endptr, int base);
+EXTERN size_t libc_strtoul (void * nptr, void * endptr, int base);
+EXTERN long unsigned int libc_strtoull (void * nptr, void * endptr, int base);
EXTERN ssize_t libc_write (int d, void * buf, size_t nbytes);
EXTERN ssize_t libc_read (int d, void * buf, size_t nbytes);
EXTERN int libc_system (void * a);
if (parseDefs && (decl_isImp (decl_getMainModule ())))
{
/* we need to parse the definition module of a corresponding implementation module. */
- (*p.proc) (reinterpret_cast<void *> (decl_lookupDef (decl_getSymName (decl_getMainModule ()))));
+ (*p.proc) (reinterpret_cast <void *> (decl_lookupDef (decl_getSymName (decl_getMainModule ()))));
}
- (*p.proc) (reinterpret_cast<void *> (decl_getMainModule ()));
+ (*p.proc) (reinterpret_cast <void *> (decl_getMainModule ()));
}
if (parseDefs)
{
currentSource = newList ();
while (l != h)
{
- addTo (newElement (reinterpret_cast<void *> (l->name)));
+ addTo (newElement (reinterpret_cast <void *> (l->name)));
l = l->right;
}
}
static DynamicStrings_String onExitDelete (DynamicStrings_String filename)
{
- alists_includeItemIntoList (listOfFiles, reinterpret_cast<void *> (DynamicStrings_Dup (filename)));
+ alists_includeItemIntoList (listOfFiles, reinterpret_cast <void *> (DynamicStrings_Dup (filename)));
return filename;
/* static analysis guarentees a RETURN statement will be used before here. */
__builtin_unreachable ();
}
else
{
- tempfile = DynamicStrings_InitStringCharStar (reinterpret_cast<void *> (makeTempFile (DynamicStrings_InitString ((const char *) "cpp", 3))));
+ tempfile = DynamicStrings_InitStringCharStar (reinterpret_cast <void *> (makeTempFile (DynamicStrings_InitString ((const char *) "cpp", 3))));
commandLine = DynamicStrings_Dup (command);
commandLine = DynamicStrings_ConCat (DynamicStrings_ConCat (DynamicStrings_ConCat (DynamicStrings_ConCatChar (DynamicStrings_Dup (commandLine), ' '), filename), DynamicStrings_Mark (DynamicStrings_InitString ((const char *) " -o ", 4))), tempfile);
if (mcOptions_getVerbose ())
static DynamicStrings_String removeLater (DynamicStrings_String filename)
{
- alists_includeItemIntoList (listOfFiles, reinterpret_cast<void *> (filename));
+ alists_includeItemIntoList (listOfFiles, reinterpret_cast <void *> (filename));
return filename;
/* static analysis guarentees a RETURN statement will be used before here. */
__builtin_unreachable ();
f = createTemporaryFile (id);
Storage_ALLOCATE ((void **) &p, sizeof (FIO_File));
(*p) = f;
- Indexing_PutIndice (frag, id, reinterpret_cast<void *> (p));
+ Indexing_PutIndice (frag, id, reinterpret_cast <void *> (p));
return f;
/* static analysis guarentees a RETURN statement will be used before here. */
__builtin_unreachable ();
/*
Export := 'EXPORT' ( 'QUALIFIED' IdentList |
- 'UNQUALIFIED' IdentList |
+ 'UNQUALIFIED'
+ % putDefUnqualified (curmodule) %
+ IdentList |
IdentList ) ';'
first symbols:exporttok
/*
Export := 'EXPORT' ( 'QUALIFIED' IdentList |
- 'UNQUALIFIED' IdentList |
+ 'UNQUALIFIED'
+ % putDefUnqualified (curmodule) %
+ IdentList |
IdentList ) ';'
first symbols:exporttok
{
/* avoid dangling else. */
Expect (mcReserved_unqualifiedtok, stopset0, stopset1, stopset2|(mcp1_SetOfStop2) ((1 << (mcReserved_identtok-mcReserved_recordtok))));
+ decl_putDefUnqualified (curmodule);
IdentList (stopset0|(mcp1_SetOfStop0) ((1 << (mcReserved_semicolontok-mcReserved_eoftok))), stopset1, stopset2);
}
else if (mcLexBuf_currenttoken == mcReserved_identtok)
static decl_node push (decl_node n)
{
- return static_cast<decl_node> (mcStack_push (stk, reinterpret_cast<void *> (n)));
+ return static_cast<decl_node> (mcStack_push (stk, reinterpret_cast <void *> (n)));
/* static analysis guarentees a RETURN statement will be used before here. */
__builtin_unreachable ();
}
static decl_node replace (decl_node n)
{
- return static_cast<decl_node> (mcStack_replace (stk, reinterpret_cast<void *> (n)));
+ return static_cast<decl_node> (mcStack_replace (stk, reinterpret_cast <void *> (n)));
/* static analysis guarentees a RETURN statement will be used before here. */
__builtin_unreachable ();
}
static decl_node push (decl_node n)
{
- return static_cast<decl_node> (mcStack_push (stk, reinterpret_cast<void *> (n)));
+ return static_cast<decl_node> (mcStack_push (stk, reinterpret_cast <void *> (n)));
/* static analysis guarentees a RETURN statement will be used before here. */
__builtin_unreachable ();
}
static decl_node replace (decl_node n)
{
- return static_cast<decl_node> (mcStack_replace (stk, reinterpret_cast<void *> (n)));
+ return static_cast<decl_node> (mcStack_replace (stk, reinterpret_cast <void *> (n)));
/* static analysis guarentees a RETURN statement will be used before here. */
__builtin_unreachable ();
}
static decl_node push (decl_node n)
{
- return static_cast<decl_node> (mcStack_push (stk, reinterpret_cast<void *> (n)));
+ return static_cast<decl_node> (mcStack_push (stk, reinterpret_cast <void *> (n)));
/* static analysis guarentees a RETURN statement will be used before here. */
__builtin_unreachable ();
}
static decl_node replace (decl_node n)
{
- return static_cast<decl_node> (mcStack_replace (stk, reinterpret_cast<void *> (n)));
+ return static_cast<decl_node> (mcStack_replace (stk, reinterpret_cast <void *> (n)));
/* static analysis guarentees a RETURN statement will be used before here. */
__builtin_unreachable ();
}
static void startWith (decl_node n)
{
- n = static_cast<decl_node> (mcStack_push (withStk, reinterpret_cast<void *> (n)));
+ n = static_cast<decl_node> (mcStack_push (withStk, reinterpret_cast <void *> (n)));
}
static decl_node pushStmt (decl_node n)
{
- return static_cast<decl_node> (mcStack_push (stmtStk, reinterpret_cast<void *> (n)));
+ return static_cast<decl_node> (mcStack_push (stmtStk, reinterpret_cast <void *> (n)));
/* static analysis guarentees a RETURN statement will be used before here. */
__builtin_unreachable ();
}
static decl_node pushLoop (decl_node n)
{
- return static_cast<decl_node> (mcStack_push (loopStk, reinterpret_cast<void *> (n)));
+ return static_cast<decl_node> (mcStack_push (loopStk, reinterpret_cast <void *> (n)));
/* static analysis guarentees a RETURN statement will be used before here. */
__builtin_unreachable ();
}
lastIndice += 1;
child->key = lastIndice;
child->data = n;
- Indexing_PutIndice (keyIndex, child->key, reinterpret_cast<void *> (n));
+ Indexing_PutIndice (keyIndex, child->key, reinterpret_cast <void *> (n));
k = lastIndice;
}
else
{
- Storage_DEALLOCATE (reinterpret_cast<void **> (&n), higha+1);
+ Storage_DEALLOCATE (reinterpret_cast <void **> (&n), higha+1);
k = child->key;
}
return k;
memcpy (a, a_, _a_high+1);
higha = StrLib_StrLen ((const char *) a, _a_high);
- Storage_ALLOCATE (reinterpret_cast<void **> (&p), higha+1);
+ Storage_ALLOCATE (reinterpret_cast <void **> (&p), higha+1);
if (p == NULL)
{
M2RTS_HALT (-1); /* out of memory error */
else
{
higha = static_cast<unsigned int> (libc_strlen (a));
- Storage_ALLOCATE (reinterpret_cast<void **> (&p), higha+1);
+ Storage_ALLOCATE (reinterpret_cast <void **> (&p), higha+1);
if (p == NULL)
{
M2RTS_HALT (-1); /* out of memory error */
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), const_cast<void*> (static_cast<const void*>(b)), static_cast<size_t> (_b_high+1)));
+ 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 static_cast<varargs_vararg> (v);
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), const_cast<void*> (static_cast<const void*>(b)), static_cast<size_t> (_b_high+1)));
+ 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), const_cast<void*> (static_cast<const void*>(c)), static_cast<size_t> (_c_high+1)));
+ 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 static_cast<varargs_vararg> (v);
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), const_cast<void*> (static_cast<const void*>(b)), static_cast<size_t> (_b_high+1)));
+ 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), const_cast<void*> (static_cast<const void*>(c)), static_cast<size_t> (_c_high+1)));
+ 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), const_cast<void*> (static_cast<const void*>(c)), static_cast<size_t> (_c_high+1)));
+ 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 static_cast<varargs_vararg> (v);
PROCEDURE putDefForC (n: node) ;
+(*
+ putDefUnqualified - the definition module uses export unqualified.
+*)
+
+PROCEDURE putDefUnqualified (n: node) ;
+
+
+(*
+ isDefUnqualified - returns TRUE if the definition module uses unqualified.
+*)
+
+PROCEDURE isDefUnqualified (n: node) : BOOLEAN ;
+
+
(*
lookupInScope - looks up a symbol named, n, from, scope.
*)
defT = RECORD
name : Name ;
source : Name ;
+ unqualified,
hasHidden,
forC : BOOLEAN ;
exported,
globalGroup : group ; (* The global group of all alists. *)
outputFile : File ;
lang : language ;
+ charStarN,
+ constCharStarN,
bitsperunitN,
bitsperwordN,
bitspercharN,
END importEnumFields ;
+(*
+ checkGccType - check to see if node n is gcc tree or location_t
+ and record its use in keyc.
+*)
+
+PROCEDURE checkGccType (n: node) ;
+BEGIN
+ IF getGccConfigSystem () AND (getScope (n) # NIL) AND
+ (getSymName (getScope (n)) = makeKey ('gcctypes'))
+ THEN
+ IF getSymName (n) = makeKey ('location_t')
+ THEN
+ keyc.useGccLocation
+ ELSIF getSymName (n) = makeKey ('tree')
+ THEN
+ keyc.useGccTree
+ END
+ END
+END checkGccType ;
+
+
+(*
+ checkCDataTypes - check to see if node n is CharStar or ConstCharStar
+ and if necessary assign n to the global variable.
+*)
+
+PROCEDURE checkCDataTypes (n: node) ;
+BEGIN
+ IF (getScope (n) # NIL) AND (getSymName (getScope (n)) = makeKey ('CDataTypes'))
+ THEN
+ IF getSymName (n) = makeKey ('CharStar')
+ THEN
+ charStarN := n
+ ELSIF getSymName (n) = makeKey ('ConstCharStar')
+ THEN
+ constCharStarN := n
+ END
+ END
+END checkCDataTypes ;
+
+
(*
import - attempts to add node, n, into the scope of module, m.
It might fail due to a name clash in which case the
BEGIN
assert (isDef (m) OR isModule (m) OR isImp (m)) ;
name := getSymName (n) ;
+ checkGccType (n) ;
+ checkCDataTypes (n) ;
r := lookupInScope (m, name) ;
IF r=NIL
THEN
defF.source := NulName ;
defF.hasHidden := FALSE ;
defF.forC := FALSE ;
+ defF.unqualified := FALSE ;
defF.exported := InitIndex (1) ;
defF.importedModules := InitIndex (1) ;
defF.constFixup := initFixupInfo () ;
END isDefForC ;
+(*
+ putDefUnqualified - the definition module uses unqualified.
+*)
+
+PROCEDURE putDefUnqualified (n: node) ;
+BEGIN
+ assert (isDef (n)) ;
+ (* Currently (and this is a temporary development restriction to
+ reduce any search space for bugs) the only module which can be
+ export unqualified is gcctypes. *)
+ IF n^.defF.name = makeKey ('gcctypes')
+ THEN
+ n^.defF.unqualified := TRUE
+ END
+END putDefUnqualified ;
+
+
+(*
+ isDefUnqualified - returns TRUE if the definition module uses unqualified.
+*)
+
+PROCEDURE isDefUnqualified (n: node) : BOOLEAN ;
+BEGIN
+ RETURN isDef (n) AND n^.defF.unqualified
+END isDefUnqualified ;
+
+
(*
lookupDef - returns a definition module node named, n.
*)
THEN
RETURN getNextFixup (impF.constFixup)
ELSE
- assert (isModule (currentModule))
+ assert (isModule (currentModule)) ;
RETURN getNextFixup (moduleF.constFixup)
END
END
PROCEDURE skipType (n: node) : node ;
BEGIN
- WHILE (n#NIL) AND isType (n) DO
+ WHILE (n#NIL) AND isType (n) AND (NOT isCDataType (n)) DO
IF getType (n) = NIL
THEN
(* this will occur if, n, is an opaque type. *)
VAR
i, s: String ;
BEGIN
- IF getScope (n) = NIL
+ IF (getScope (n) = NIL) OR (isDefUnqualified (getScope (n)))
THEN
RETURN InitStringCharStar (keyToCharStar (getSymName (n)))
ELSIF isQualifiedForced (n)
i := InitStringCharStar (keyToCharStar (getSymName (n))) ;
s := InitStringCharStar (keyToCharStar (getSymName (getScope (n)))) ;
RETURN Sprintf2 (InitString ("%s_%s"), s, i)
- ELSIF (NOT isExported (n)) OR getIgnoreFQ ()
+ ELSIF (NOT isExported (n)) OR getIgnoreFQ () OR (isDefUnqualified (getScope (n)))
THEN
RETURN InitStringCharStar (keyToCharStar (getSymName (n)))
ELSE
VAR
i, s: String ;
BEGIN
- IF getScope (n) = NIL
+ IF (getScope (n) = NIL) OR (isDefUnqualified (getScope (n)))
THEN
RETURN InitStringCharStar (keyToCharStar (getDName (n, scopes)))
ELSIF isQualifiedForced (n)
i := InitStringCharStar (keyToCharStar (getSymName (n))) ;
s := InitStringCharStar (keyToCharStar (getSymName (getScope (n)))) ;
RETURN Sprintf2 (InitString ("%s_%s"), s, i)
- ELSIF (NOT isExported (n)) OR getIgnoreFQ ()
+ ELSIF (NOT isExported (n)) OR getIgnoreFQ () OR (isDefUnqualified (getScope (n)))
THEN
RETURN InitStringCharStar (keyToCharStar (getDName (n, scopes)))
ELSE
END doTypeNameModifier ;
+(*
+ isGccType - return TRUE if n is tree or location_t.
+*)
+
+PROCEDURE isGccType (n: node) : BOOLEAN ;
+BEGIN
+ RETURN (getGccConfigSystem () AND
+ ((getSymName (n) = makeKey ('location_t')) OR
+ (getSymName (n) = makeKey ('tree'))))
+END isGccType ;
+
+
+(*
+ doGccType - record whether we are going to declare tree or location_t
+ so that the appropriate gcc header can be included instead.
+*)
+
+PROCEDURE doGccType (p: pretty; n: node) ;
+BEGIN
+ IF getGccConfigSystem ()
+ THEN
+ IF getSymName (n) = makeKey ('location_t')
+ THEN
+ outText (p, "/* Not going to declare ") ;
+ doTypeNameC (p, n) ;
+ outText (p, " as it is declared in the gcc header input.h. */\n\n") ;
+ keyc.useGccLocation
+ ELSIF getSymName (n) = makeKey ('tree')
+ THEN
+ outText (p, "/* Not going to declare ") ;
+ doTypeNameC (p, n) ;
+ outText (p, " as it is declared in the gcc header tree.h. */\n\n") ;
+ keyc.useGccTree
+ END
+ END
+END doGccType ;
+
+
+(*
+ isCDataType - return true if n is charStar or constCharStar.
+*)
+
+PROCEDURE isCDataType (n: node) : BOOLEAN ;
+BEGIN
+ RETURN (n # NIL) AND ((n = charStarN) OR (n = constCharStarN))
+END isCDataType ;
+
+
+(*
+ isCDataTypes - return TRUE if n is CharStar or ConstCharStar.
+*)
+
+PROCEDURE isCDataTypes (n: node) : BOOLEAN ;
+VAR
+ scope: node ;
+BEGIN
+ scope := getScope (n) ;
+ RETURN (scope # NIL) AND (getSymName (scope) = makeKey ('CDataTypes')) AND
+ ((getSymName (n) = makeKey ('CharStar')) OR
+ (getSymName (n) = makeKey ('ConstCharStar')))
+END isCDataTypes ;
+
+
+(*
+ doCDataTypes - if we are going to declare CharStar or ConstCharStar
+ then generate a comment instead.
+*)
+
+PROCEDURE doCDataTypes (p: pretty; n: node) ;
+BEGIN
+ IF isCDataTypes (n)
+ THEN
+ IF getSymName (n) = makeKey ('CharStar')
+ THEN
+ outText (p, "/* Not going to declare ") ;
+ doTypeNameC (p, n) ;
+ outText (p, " as it is a C type. */\n\n") ;
+ charStarN := n
+ ELSIF getSymName (n) = makeKey ('ConstCharStar')
+ THEN
+ outText (p, "/* Not going to declare ") ;
+ doTypeNameC (p, n) ;
+ outText (p, " as it is a C type. */\n\n") ;
+ constCharStarN := n
+ END
+ END
+END doCDataTypes ;
+
+
+(*
+ doCDataTypesC - generate the C representation of the CDataTypes data types.
+*)
+
+PROCEDURE doCDataTypesC (p: pretty; n: node) ;
+BEGIN
+ IF n = charStarN
+ THEN
+ outText (p, "char *") ;
+ setNeedSpace (p)
+ ELSIF n = constCharStarN
+ THEN
+ outText (p, "const char *") ;
+ setNeedSpace (p)
+ END
+END doCDataTypesC ;
+
+
+(*
+ doTypeOrPointer - only declare type or pointer n providing that
+ the name is not location_t or tree and
+ the --gccConfigSystem option is enabled.
+*)
+
+PROCEDURE doTypeOrPointer (p: pretty; n: node) ;
+VAR
+ m: node ;
+BEGIN
+ IF isGccType (n)
+ THEN
+ doGccType (p, n)
+ ELSIF isCDataTypes (n)
+ THEN
+ doCDataTypes (p, n)
+ ELSE
+ m := getType (n) ;
+ outText (p, "typedef") ; setNeedSpace (p) ;
+ doTypeC (p, m, m) ;
+ IF isType (m)
+ THEN
+ setNeedSpace (p)
+ END ;
+ doTypeNameC (p, n) ;
+ doTypeNameModifier (p, n) ;
+ outText (p, ";\n\n")
+ END
+END doTypeOrPointer ;
+
+
+(*
+ doTypedef - generate a typedef for n provuiding it is not
+*)
+
+PROCEDURE doTypedef (p: pretty; n: node) ;
+VAR
+ m: node ;
+BEGIN
+ IF isGccType (n)
+ THEN
+ doGccType (p, n)
+ ELSIF isCDataTypes (n)
+ THEN
+ doCDataTypes (p, n)
+ ELSE
+ m := getType (n) ;
+ outText (p, "typedef") ; setNeedSpace (p) ;
+ doTypeC (p, m, m) ;
+ IF isType (m)
+ THEN
+ setNeedSpace (p)
+ END ;
+ doTypeNameC (p, n) ;
+ doTypeNameModifier (p, n) ;
+ outText (p, ";\n\n")
+ END
+END doTypedef ;
+
+
(*
doTypesC -
*)
doProcTypeC (doP, n, m)
ELSIF isType (m) OR isPointer (m)
THEN
- outText (doP, "typedef") ; setNeedSpace (doP) ;
- doTypeC (doP, m, m) ;
- IF isType (m)
- THEN
- setNeedSpace (doP)
- END ;
- doTypeNameC (doP, n) ;
- doTypeNameModifier (doP, n) ;
- outText (doP, ";\n\n")
+ doTypeOrPointer (doP, n)
ELSIF isEnumeration (m)
THEN
IF isDeclType (n)
outText (doP, ";\n\n")
END
ELSE
- outText (doP, "typedef") ; setNeedSpace (doP) ;
- doTypeC (doP, m, m) ;
- IF isType (m)
- THEN
- setNeedSpace (doP)
- END ;
- doTypeNameC (doP, n) ;
- doTypeNameModifier (doP, n) ;
- outText (doP, ";\n\n")
+ doTypedef (doP, n)
END
END
END doTypesC ;
IF n=NIL
THEN
outText (p, "void")
+ ELSIF isCDataTypes (n)
+ THEN
+ doCDataTypesC (p, n)
ELSIF isBase (n)
THEN
doBaseC (p, n)
ELSIF isSet (n)
THEN
doSetC (p, n)
+ ELSIF isCDataTypes (n)
+ THEN
+ doCDataTypesC (p, n)
ELSE
- (* --fixme-- *)
- print (p, "to do ... typedef etc etc ") ; doFQNameC (p, n) ; print (p, ";\n") ;
- HALT
+ metaError1 ('expecting a type symbol rather than a {%1DMd} {%1DMa}', n) ;
+ flushErrors ;
+ errorAbort0 ('terminating compilation')
END
END doTypeC ;
THEN
outText (p, "void") ;
setNeedSpace (p)
+ ELSIF n = charStarN
+ THEN
+ outText (p, "char *") ;
+ setNeedSpace (p)
+ ELSIF n = constCharStarN
+ THEN
+ outText (p, "const char *") ;
+ setNeedSpace (p)
ELSIF isBase (n)
THEN
doBaseC (p, n)
END needsCast ;
+(*
+ castDestType - emit the destination type ft
+*)
+
+PROCEDURE castDestType (p: pretty; formal, ft: node) ;
+BEGIN
+ doTypeNameC (p, ft) ;
+ IF isVarParam (formal)
+ THEN
+ outText (p, '*')
+ END
+END castDestType ;
+
+
+(*
+ identifyPointer -
+*)
+
+PROCEDURE identifyPointer (type: node) : node ;
+BEGIN
+ IF isPointer (type)
+ THEN
+ IF skipType (getType (type)) = charN
+ THEN
+ RETURN charStarN
+ ELSIF (skipType (getType (type)) = byteN) OR
+ (skipType (getType (type)) = locN)
+ THEN
+ RETURN addressN
+ END
+ END ;
+ RETURN type
+END identifyPointer ;
+
+
+(*
+ castPointer - provides a six way cast between ADDRESS (ie void * ),
+ char * and const char *.
+*)
+
+PROCEDURE castPointer (p: pretty; actual, formal, at, ft: node) : CARDINAL ;
+VAR
+ sat, sft: node ;
+ parenth : CARDINAL ;
+BEGIN
+ parenth := 0 ;
+ IF at # ft
+ THEN
+ sat := identifyPointer (skipType (at)) ;
+ sft := identifyPointer (skipType (ft)) ;
+ IF sat = addressN
+ THEN
+ IF sft = charStarN
+ THEN
+ outText (p, 'reinterpret_cast <') ;
+ castDestType (p, formal, ft) ;
+ outText (p, '>')
+ ELSIF sft = constCharStarN
+ THEN
+ outText (p, 'const_cast <') ;
+ castDestType (p, formal, ft) ;
+ outText (p, '> (static_cast <') ;
+ doTypeNameC (p, charStarN) ;
+ outText (p, '>') ;
+ INC (parenth)
+ ELSE
+ outText (p, 'reinterpret_cast <') ;
+ castDestType (p, formal, ft) ;
+ outText (p, '>')
+ END
+ ELSIF sat = charStarN
+ THEN
+ IF sft = addressN
+ THEN
+ outText (p, 'reinterpret_cast <') ;
+ castDestType (p, formal, ft) ;
+ outText (p, '>')
+ ELSIF sft = constCharStarN
+ THEN
+ outText (p, 'const_cast <') ;
+ castDestType (p, formal, ft) ;
+ outText (p, '>')
+ ELSE
+ outText (p, 'reinterpret_cast <') ;
+ castDestType (p, formal, ft) ;
+ outText (p, '>')
+ END
+ ELSIF sat = constCharStarN
+ THEN
+ IF sft = addressN
+ THEN
+ outText (p, 'static_cast <') ;
+ castDestType (p, formal, ft) ;
+ outText (p, '> (const_cast <') ;
+ doTypeNameC (p, charStarN) ;
+ outText (p, '>') ;
+ INC (parenth)
+ ELSIF sft = charStarN
+ THEN
+ outText (p, 'const_cast <') ;
+ castDestType (p, formal, ft) ;
+ outText (p, '>')
+ ELSE
+ outText (p, 'reinterpret_cast <') ;
+ castDestType (p, formal, ft) ;
+ outText (p, '>')
+ END
+ ELSE
+ outText (p, 'reinterpret_cast <') ;
+ castDestType (p, formal, ft) ;
+ outText (p, '>')
+ END ;
+ setNeedSpace (p) ;
+ outText (p, '(') ;
+ INC (parenth)
+ END ;
+ RETURN parenth
+END castPointer ;
+
+
(*
checkSystemCast - checks to see if we are passing to/from
a system generic type (WORD, BYTE, ADDRESS)
THEN
IF lang = ansiCP
THEN
- IF isString (actual) AND (skipType (ft) = addressN)
+ IF isString (actual) AND isCDataType (skipType (ft))
+ THEN
+ (* Nothing to do. *)
+ RETURN 0
+ ELSIF isString (actual) AND (skipType (ft) = addressN)
THEN
outText (p, "const_cast<void*> (static_cast<const void*> (") ;
RETURN 2
- ELSIF isPointer (skipType (ft)) OR (skipType (ft) = addressN)
+ ELSIF isPointer (skipType (ft)) OR (skipType (ft) = addressN) OR
+ isCDataType (skipType (ft))
THEN
IF actual = nilN
THEN
(* NULL is compatible with pointers/address. *)
RETURN 0
ELSE
- outText (p, 'reinterpret_cast<') ;
- doTypeNameC (p, ft) ;
- IF isVarParam (formal)
- THEN
- outText (p, '*')
- END ;
- noSpace (p) ;
- outText (p, '> (')
+ RETURN castPointer (p, actual, formal, at, ft)
END
ELSE
outText (p, 'static_cast<') ;
END makeBuiltins ;
+(*
+ makeCDataTypes - assign the charStarN and constCharStarN to NIL.
+*)
+
+PROCEDURE makeCDataTypes ;
+VAR
+ CdatatypesN: node ;
+BEGIN
+ CdatatypesN := lookupDef (makeKey ('CDataTypes')) ;
+ enterScope (CdatatypesN) ;
+ charStarN := makePointer (charN) ;
+ constCharStarN := makePointer (charN) ;
+ leaveScope
+END makeCDataTypes ;
+
+
(*
init -
*)
makeM2rts ;
outputState := punct ;
tempCount := 0 ;
- mustVisitScope := FALSE
+ mustVisitScope := FALSE ;
+ makeCDataTypes
END init ;
FROM nameKey IMPORT Name ;
+(*
+ useGccTree - indicate we have imported tree from gcctypes.
+*)
+
+PROCEDURE useGccTree ;
+
+
+(*
+ useGccLocation - indicate we have imported tree from gcctypes.
+*)
+
+PROCEDURE useGccLocation ;
+
+
(*
useUnistd - need to use unistd.h call using open/close/read/write require this header.
*)
initializedCP,
initializedGCC,
+ seenGccTree,
+ seenGccLocation,
seenIntMin,
seenUIntMin,
seenLongMin,
initializedGCC := TRUE ;
print (p, '#include "config.h"\n');
print (p, '#include "system.h"\n');
+ checkGccTypes (p)
END
END
END checkGccConfigSystem ;
+(*
+ useGccTree - indicate we have imported tree from gcctypes.
+*)
+
+PROCEDURE useGccTree ;
+BEGIN
+ seenGccTree := TRUE
+END useGccTree ;
+
+
+(*
+ useGccLocation - indicate we have imported tree from gcctypes.
+*)
+
+PROCEDURE useGccLocation ;
+BEGIN
+ seenGccLocation := TRUE
+END useGccLocation ;
+
+
(*
useStorage - indicate we have used storage.
*)
END useCtype ;
+(*
+ checkGccTypes - if we have imported tree or location_t from gcctypes
+ then we include the gcc headers.
+*)
+
+PROCEDURE checkGccTypes (p: pretty) ;
+BEGIN
+ IF seenGccTree OR seenGccLocation
+ THEN
+ print (p, '#include "gcc-consolidation.h"\n\n')
+ END
+END checkGccTypes ;
+
+
(*
checkCtype -
*)
BEGIN
IF seenCtype
THEN
- checkGccConfigSystem (p);
+ checkGccConfigSystem (p) ;
IF getGccConfigSystem ()
THEN
(* GCC header files use a safe variant. *)
seenSize_t := FALSE ;
seenSSize_t := FALSE ;
seenSysTypes := FALSE ;
+ seenGccTree := FALSE ;
+ seenGccLocation := FALSE ;
initializedCP := FALSE ;
initializedGCC := FALSE ;
insertTokenAndRewind, getTokenNo, lastcomment ;
FROM decl IMPORT node, lookupDef, lookupImp, lookupModule, getSymName,
- lookupSym, putDefForC,
+ lookupSym, putDefForC, putDefUnqualified,
makeProcedure, makeType, makeTypeImp, makeVar, makeConst,
enterScope, leaveScope, putTypeHidden, putTypeOpaque,
addImportedModule, getCurrentModule,
Export := "EXPORT" ( "QUALIFIED"
IdentList |
- "UNQUALIFIED"
+ "UNQUALIFIED" % putDefUnqualified (curmodule) %
IdentList |
IdentList ) ";" =: