-- SaffronMakeType1Impl.mesa -- Copyright Ó 1987 by Xerox Corporation. All rights reserved. -- Generated by Rauen.pa at September 1, 1988 6:31:31 pm PDT -- using ThreeCasabaFour [1.2] of June 1, 1987 6:00:00 pm PDT DIRECTORY SaffronAG1aDef, SaffronPGDef, SaffronAG9Def, SaffronGenericDef, Rope, ThreeC4Support, SaffronBaseDef, SaffronATDef; SaffronMakeType1Impl: CEDAR PROGRAM IMPORTS SaffronPGDef, ThreeC4Support, SaffronBaseDef, SaffronATDef EXPORTS SaffronAG1aDef, SaffronAG9Def= BEGIN OPEN SaffronAG1aDef, SaffronPGDef, SaffronAG9Def, SaffronGenericDef, Rope, ThreeC4Support, SaffronBaseDef, SaffronATDef; TopmodulepProdDoTop: PUBLIC PROC[ref: REF ANY, fileName: ROPE, env: EnvironmentNode, cs: CompilerStateNode] RETURNS[temp0: EnvironmentNode] = BEGIN tree: TopNode_ NARROW[ref]; BEGIN ENABLE ThreeC4Support.GetSourceInfo => RESUME[tree.position, tree.length]; treeData: TopmodulepProdData _ NARROW[tree.data]; temp0 _ treeData.ModuleP.procs.MakeEnvironment[treeData.ModuleP, fileName, env, cs]; END END; ModulePimplProdMakeEnvironment: PUBLIC PROC[ref: REF ANY, fileName: ROPE, env: EnvironmentNode, cs: CompilerStateNode] RETURNS[temp0: EnvironmentNode] = BEGIN tree: ModulePNode_ NARROW[ref]; BEGIN ENABLE ThreeC4Support.GetSourceInfo => RESUME[tree.position, tree.length]; treeData: ModulePimplProdData _ NARROW[tree.data]; BEGIN env2: EnvironmentNode; pg2: ProgramGraphNode; procGraph: ProcedureGraphNode; contextTree: ContextTreeNode; programFragment: ProgramFragmentNode; pg1: ProgramGraphNode; pg: ProgramGraphNode; contextRib: ContextRibNode; lc4: LocalContextNode; moduleTGN: TypeGraphNodeNode; ffl: FrozenFieldListNode; fl2: FieldListNode; lc3: LocalContextNode; access: AccessValNode; lc2: LocalContextNode; implTGN: TypeGraphNodeNode; cedar: BOOLEAN; fl1: FieldListNode; lc1: LocalContextNode; env1: EnvironmentNode; fl: FieldListNode; lc: LocalContextNode; lc _ CreateEmptyContext[GetRootContextRib[cs], True[]]; fl _ CreateEmptyFieldList[]; [fl1, lc1, env1] _ treeData.Directory.procs.ProcessDirectoryClause[treeData.Directory, fl, lc, env, cs]; cedar _ treeData.Cedar.procs.IsKeywordPresent[treeData.Cedar]; [lc2, implTGN] _ treeData.ProgHead.procs.BuildImplementationTGN[treeData.ProgHead, lc1, cedar, cs]; access _ treeData.ProgHead.procs.GetAccessVal[treeData.ProgHead, AccessValConst["private"]]; [fl2, lc3] _ treeData.IdentList.procs.AddTypeDeclarationToFieldList[treeData.IdentList, fl1, lc2, cs, access, access, implTGN, BogusTypeExpPTree[], NullDefaultVal[]]; ffl _ FreezeFieldList[fl2]; [lc4, moduleTGN] _ CreateModuleTGN[lc3, ffl]; contextRib _ FreezeLocalContext[lc4, moduleTGN]; pg _ CreateEmptyProgramGraph[]; [contextTree, programFragment, pg1] _ treeData.Block.procs.Compile[treeData.Block, EmptyContextTree[contextRib], pg, cs]; procGraph _ MakeProcedureGraph[programFragment]; pg2 _ AddMainProcedureGraphToProgramGraph[procGraph, pg1]; env2 _ AddCompiledImplementationFileToEnvironment[env1, fileName, contextTree, pg2]; temp0 _ env2; END; END END; ModulePdefProdMakeEnvironment: PUBLIC PROC[ref: REF ANY, fileName: ROPE, env: EnvironmentNode, cs: CompilerStateNode] RETURNS[temp0: EnvironmentNode] = BEGIN tree: ModulePNode_ NARROW[ref]; BEGIN ENABLE ThreeC4Support.GetSourceInfo => RESUME[tree.position, tree.length]; treeData: ModulePdefProdData _ NARROW[tree.data]; BEGIN env2: EnvironmentNode; contextTree: ContextTreeNode; childContextTree: ContextTreeNode; contextRib: ContextRibNode; lc4: LocalContextNode; moduleTGN: TypeGraphNodeNode; ffl: FrozenFieldListNode; fl2: FieldListNode; lc3: LocalContextNode; access: AccessValNode; lc2: LocalContextNode; interfaceTGN: TypeGraphNodeNode; cedar: BOOLEAN; fl1: FieldListNode; lc1: LocalContextNode; env1: EnvironmentNode; fl: FieldListNode; lc: LocalContextNode; lc _ CreateEmptyContext[GetRootContextRib[cs], True[]]; fl _ CreateEmptyFieldList[]; [fl1, lc1, env1] _ treeData.Directory.procs.ProcessDirectoryClause[treeData.Directory, fl, lc, env, cs]; cedar _ treeData.Cedar.procs.IsKeywordPresent[treeData.Cedar]; [lc2, interfaceTGN] _ treeData.DefHead.procs.BuildInterfaceTGN[treeData.DefHead, lc1, cedar, cs]; access _ treeData.DefHead.procs.GetAccessVal[treeData.DefHead, AccessValConst["public"]]; [fl2, lc3] _ treeData.IdentList.procs.AddTypeDeclarationToFieldList[treeData.IdentList, fl1, lc2, cs, access, access, interfaceTGN, BogusTypeExpPTree[], NullDefaultVal[]]; ffl _ FreezeFieldList[fl2]; [lc4, moduleTGN] _ CreateModuleTGN[lc3, ffl]; contextRib _ FreezeLocalContext[lc4, moduleTGN]; childContextTree _ treeData.DefBody.procs.MakeContextTree[treeData.DefBody, contextRib, True[], cs]; contextTree _ AddSubContextTree[EmptyContextTree[contextRib], childContextTree]; env2 _ AddCompiledDefinitionsFileToEnvironment[env1, fileName, contextTree]; temp0 _ env2; END; END END; DirectoryemptyProdProcessDirectoryClause: PUBLIC PROC[ref: REF ANY, fl: FieldListNode, localContext: LocalContextNode, env: EnvironmentNode, cs: CompilerStateNode] RETURNS[temp0: FieldListNode, temp1: LocalContextNode, temp2: EnvironmentNode] = BEGIN tree: DirectoryNode_ NARROW[ref]; BEGIN ENABLE ThreeC4Support.GetSourceInfo => RESUME[tree.position, tree.length]; temp2 _ FakeDamageEnvironment[env]; temp1 _ FakeDamageContext[localContext]; temp0 _ FakeDamageFieldList[fl]; END END; DirectorymoreProdProcessDirectoryClause: PUBLIC PROC[ref: REF ANY, fl: FieldListNode, localContext: LocalContextNode, env: EnvironmentNode, cs: CompilerStateNode] RETURNS[temp0: FieldListNode, temp1: LocalContextNode, temp2: EnvironmentNode] = BEGIN tree: DirectoryNode_ NARROW[ref]; BEGIN ENABLE ThreeC4Support.GetSourceInfo => RESUME[tree.position, tree.length]; treeData: DirectorymoreProdData _ NARROW[tree.data]; BEGIN fl2: FieldListNode; field: FieldNode; lc2: LocalContextNode; env2: EnvironmentNode; fl1: FieldListNode; lc1: LocalContextNode; env1: EnvironmentNode; [fl1, lc1, env1] _ treeData.Directory.procs.ProcessDirectoryClause[treeData.Directory, fl, localContext, env, cs]; [field, lc2, env2] _ treeData.IncludeItem.procs.ProcessDirectoryItem[treeData.IncludeItem, lc1, env1, cs]; fl2 _ AppendFieldToFieldList[fl1, field]; temp2 _ env2; temp1 _ lc2; temp0 _ fl2; END; END END; IncludeItemProdProcessDirectoryItem: PUBLIC PROC[ref: REF ANY, lc: LocalContextNode, env: EnvironmentNode, cs: CompilerStateNode] RETURNS[temp0: FieldNode, temp1: LocalContextNode, temp2: EnvironmentNode] = BEGIN tree: IncludeItemNode_ NARROW[ref]; BEGIN ENABLE ThreeC4Support.GetSourceInfo => RESUME[tree.position, tree.length]; treeData: IncludeItemProdData _ NARROW[tree.data]; BEGIN field: FieldNode; parseTree: TypeExpPTreeNode; tgn1: TypeGraphNodeNode; lc1: LocalContextNode; tgn: TypeGraphNodeNode; position: PositionValNode; access: AccessValNode; interface: TypeGraphNodeNode; default: DefaultExpNode; env1: EnvironmentNode; fileName: ROPE; fileName _ treeData.IdOrString.procs.RopeFromIdOrString[treeData.IdOrString]; IF IsCompiledFileInEnv[env, fileName] THEN {env1 _ FakeDamageEnvironment[env]; } ELSE {BEGIN defFile: ModulePNode; defFile _ ModulePVal[ReadDefFile[fileName]]; env1 _ defFile.procs.MakeEnvironment[defFile, fileName, env, cs]; END; }; default _ NullDefaultVal[]; interface _ LookupInterfaceInEnv[env1, fileName, treeData.IdmoduleName]; access _ AccessValConst["public"]; position _ NullPosition[]; [lc1, tgn] _ CreateNamedTGN[lc, treeData.Idlocal, position, access, interface, default]; tgn1 _ treeData.Using.procs.RestrictNamedTGN[treeData.Using, tgn]; parseTree _ BogusTypeExpPTree[]; field _ CreateNamedTypeField[treeData.Idlocal, position, access, tgn1, parseTree]; temp2 _ env1; temp1 _ lc1; temp0 _ field; END; END END; UsingrestrictedProdRestrictNamedTGN: PUBLIC PROC[ref: REF ANY, namedTGN: TypeGraphNodeNode] RETURNS[temp0: TypeGraphNodeNode] = BEGIN tree: UsingNode_ NARROW[ref]; BEGIN ENABLE ThreeC4Support.GetSourceInfo => RESUME[tree.position, tree.length]; treeData: UsingrestrictedProdData _ NARROW[tree.data]; temp0 _ treeData.IdList.procs.AddIdsToRestrictionList[treeData.IdList, namedTGN]; END END; UsingnothingProdRestrictNamedTGN: PUBLIC PROC[ref: REF ANY, namedTGN: TypeGraphNodeNode] RETURNS[temp0: TypeGraphNodeNode] = BEGIN tree: UsingNode_ NARROW[ref]; BEGIN ENABLE ThreeC4Support.GetSourceInfo => RESUME[tree.position, tree.length]; temp0 _ FakeDamageTypeGraphNode[namedTGN]; END END; UsingunrestrictedProdRestrictNamedTGN: PUBLIC PROC[ref: REF ANY, namedTGN: TypeGraphNodeNode] RETURNS[temp0: TypeGraphNodeNode] = BEGIN tree: UsingNode_ NARROW[ref]; BEGIN ENABLE ThreeC4Support.GetSourceInfo => RESUME[tree.position, tree.length]; temp0 _ AddAllIdsToRestrictionList[namedTGN]; END END; DefHeadProdBuildInterfaceTGN: PUBLIC PROC[ref: REF ANY, lc: LocalContextNode, cedar: BOOLEAN, cs: CompilerStateNode] RETURNS[temp0: LocalContextNode, temp1: TypeGraphNodeNode] = BEGIN tree: DefHeadNode_ NARROW[ref]; BEGIN ENABLE ThreeC4Support.GetSourceInfo => RESUME[tree.position, tree.length]; treeData: DefHeadProdData _ NARROW[tree.data]; BEGIN locks: ROPE; imports: ROPE; shares: ROPE; shares _ "I should be a shares list"; imports _ "I should be an imports list"; locks _ "I should be a locks foobar"; [temp0, temp1] _ CreateInterfaceTGN[lc, cedar, locks, imports, shares]; END; END END; ProgHeadProdBuildImplementationTGN: PUBLIC PROC[ref: REF ANY, lc: LocalContextNode, cedar: BOOLEAN, cs: CompilerStateNode] RETURNS[temp0: LocalContextNode, temp1: TypeGraphNodeNode] = BEGIN tree: ProgHeadNode_ NARROW[ref]; BEGIN ENABLE ThreeC4Support.GetSourceInfo => RESUME[tree.position, tree.length]; treeData: ProgHeadProdData _ NARROW[tree.data]; BEGIN lc2: LocalContextNode; transferType: TypeGraphNodeNode; safe: BOOLEAN; lc1: LocalContextNode; input: FrozenFieldListNode; output: FrozenFieldListNode; paintRecords: BOOLEAN; locks: ROPE; imports: ROPE; exports: ROPE; shares: ROPE; shares _ "I should be a shares list"; exports _ "I should be an exports list"; imports _ "I should be an imports list"; locks _ "I should be a locks foobar"; paintRecords _ True[]; [lc1, input, output] _ treeData.Arguments.procs.MakeArgumentLists[treeData.Arguments, lc, paintRecords, cs]; safe _ treeData.Safe.procs.IsKeywordPresent[treeData.Safe]; [lc2, transferType] _ CreateTransferTGN[lc1, safe, "program", input, output]; [temp0, temp1] _ CreateImplementationTGN[lc2, cedar, transferType, locks, imports, exports, shares]; END; END END; END..