DIRECTORY FS, IO, OrderedSymbolTableRef, Rope, RoseTranslateTypes, RoseTranslateInsides, TextNode, TiogaFileOps, TiogaOps, ViewerClasses, ViewerOps; RoseTranslateSymbols: CEDAR PROGRAM IMPORTS FS, IO, OSTR: OrderedSymbolTableRef, Rope, RoseTranslateInsides EXPORTS RoseTranslateInsides = BEGIN OPEN RoseTranslateTypes, RoseTranslateInsides; AddSymbols: PUBLIC PROC [job: Job, rootName: ROPE] = BEGIN error: BOOLEAN _ FALSE; IF job.libbed.Lookup[rootName] # NIL THEN RETURN; job.libbed.Insert[rootName]; IF NOT error THEN [] _ DigestSymbols[job, rootName]; END; DigestSymbols: PROC [parent: Job, rootName: ROPE] RETURNS [error: BOOLEAN] = BEGIN job: Job _ NEW [JobRep _ [ log: parent.log, exec: parent.exec, rootName: rootName, things: parent.things, type: TranslateJob]]; symbolsSource: IO.STREAM; job.from _ symbolsSource _ FS.StreamOpen[rootName.Concat[".RoseSymbols"] !FS.Error => BEGIN Whimper[nullSR, parent, "Unable to open %g.RoseSymbols", IO.rope[rootName]]; symbolsSource _ NIL; CONTINUE; END]; IF symbolsSource = NIL THEN RETURN [TRUE]; job.log.PutF["Reading symbols from %g.RoseSymbols... ", IO.rope[rootName]]; [] _ symbolsSource.SkipWhitespace[flushComments: FALSE]; WHILE NOT symbolsSource.EndOf[] DO fun: BOOL _ symbolsSource.GetBool[]; symbolName: ROPE _ symbolsSource.GetTokenRope[MyBreak].token; globvar: BOOL _ symbolsSource.GetBool[]; definer: ROPE _ symbolsSource.GetTokenRope[MyBreak].token; initializerGiven: BOOL _ symbolsSource.GetBool[]; cd: CellDef _ NEW [CellDefRep _ [initializerGiven: initializerGiven]]; [] _ symbolsSource.SkipWhitespace[]; SELECT symbolsSource.PeekChar[] FROM 'F => { IF symbolsSource.GetChar[] # 'F THEN ERROR; }; '" => { interfaceAsRope: ROPE _ symbolsSource.GetRopeLiteral[]; ok: BOOL _ TRUE; iel: InterfaceEltList; asAny: REF ANY; job.from _ IO.RIS[interfaceAsRope]; asAny _ ParseExpression[job]; WITH asAny SELECT FROM sb: SquareBracketed => IF sb.subject = NIL THEN iel _ NIL ELSE WITH sb.subject SELECT FROM il: InterfaceEltList => iel _ il; ENDCASE => ok _ FALSE; ENDCASE => ok _ FALSE; IF NOT ok THEN BEGIN [] _ Complain[nullSR, job, "Bad interface: %g", IO.refAny[asAny]]; job.log.PutRope["Done reading symbols\n"]; RETURN [TRUE]; END; IF (cd.interfaceLiteral _ DigestInterface[job, iel]) = NIL THEN BEGIN job.log.PutRope["Done reading symbols\n"]; RETURN [TRUE]; END; }; ENDCASE => ERROR; IF fun THEN { cfe: cfEntry _ NEW [SymbolTableEntryRep[cellFn] _ [name: symbolName, value: cellFn[definedIn: definer, cf: NEW [CellFnRep _ [cd: cd]] ]]]; cd.forFn _ cfe.cf; AddCellFn[job, cfe]; } ELSE { cce: ccEntry _ NEW [SymbolTableEntryRep[cellClass] _ [name: symbolName, value: cellClass[globvar: globvar, definedIn: definer, cd: cd]]]; AddCellClass[job, cce]; }; [] _ symbolsSource.SkipWhitespace[flushComments: FALSE]; ENDLOOP; job.log.PutRope["done\n"]; error _ FALSE; END; AddCellClass: PUBLIC PROC [job: Job, cce: ccEntry] = BEGIN ste: SymbolTableEntry _ NARROW[job.things.Lookup[cce.name]]; complain: BOOLEAN _ ste # NIL; IF complain THEN WITH ste SELECT FROM oldCCE: ccEntry => IF oldCCE.definedIn = NIL AND cce.definedIn # NIL THEN BEGIN oldCCE.definedIn _ cce.definedIn; oldCCE.cd _ cce.cd; RETURN; END; ENDCASE; IF complain THEN BEGIN Whimper[nullSR, job, "Multiple definition of cell class %g", IO.rope[cce.name]]; END ELSE job.things.Insert[cce]; END; AddCellFn: PUBLIC PROC [job: Job, cfe: cfEntry] = BEGIN ste: SymbolTableEntry _ NARROW[job.things.Lookup[cfe.name]]; complain: BOOLEAN _ ste # NIL; IF complain THEN WITH ste SELECT FROM oldCFE: cfEntry => IF oldCFE.definedIn = NIL AND cfe.definedIn # NIL THEN BEGIN oldCFE.definedIn _ cfe.definedIn; oldCFE.cf _ cfe.cf; RETURN; END; ENDCASE; IF complain THEN BEGIN Whimper[nullSR, job, "Multiple definition of cell type function %g", IO.rope[cfe.name]]; END ELSE job.things.Insert[cfe]; END; DigestInterface: PUBLIC PROC [context: REF ANY, iel: InterfaceEltList] RETURNS [di: DigestedInterface] = BEGIN di _ NEW [DigestedInterfaceRep _ [ asTable: OSTR.CreateTable[CompareInterfaceElts], asList: iel]]; FOR iel _ iel, iel.rest WHILE iel # NIL DO IF di.asTable.Lookup[iel.first.name] # NIL THEN BEGIN [] _ Complain[iel.first.sr, context, "Multiple def of %g in interface %g", IO.rope[iel.first.name], IO.refAny[di]]; RETURN [NIL]; END; di.asTable.Insert[iel.first]; IF NOT iel.first.sti.st.simple THEN di.hasSwitchElt _ TRUE; ENDLOOP; END; CompareInterfaceElts: OSTR.CompareProc = BEGIN s1, s2: ROPE; s1 _ WITH r1 SELECT FROM r: ROPE => r, ie: InterfaceElt => ie.name, ENDCASE => ERROR; s2 _ WITH r2 SELECT FROM r: ROPE => r, ie: InterfaceElt => ie.name, ENDCASE => ERROR; RETURN [s1.Compare[s2, FALSE]]; END; END. –RoseTranslateSymbols.Mesa Last Edited by: Spreitzer, September 2, 1984 6:19:19 pm PDT Last Edited by: Gasbarro, August 17, 1984 11:27:52 am PDT Κ ˜J™J™;J™9J˜codešΟk œœœ„˜”K˜—šΠbxœœ˜#Kšœœœœ3˜GKšœ˜—K˜Kšœœ*˜4K˜šΟn œœœœ˜4Kš˜Kšœœœ˜K˜Kšœœœœ˜1K˜K˜Kšœœœ#˜4Kšœ˜—K˜š Ÿ œœœœ œ˜LKš˜šœ œ ˜Kšœ˜K˜K˜K˜K˜—Kšœœœ˜šœœ-œ ˜UKš˜Kšœ9œ˜LKšœœ˜Kšœ˜ Kšœ˜—Kš œœœœœ˜*Kšœ8œ˜KKšœ1œ˜8šœœ˜"Kšœœ˜$Kšœ œ-˜=Kšœ œ˜(Kšœ œ-˜:Kšœœ˜1Kšœœ5˜FKšœ$˜$šœ˜$˜Kšœœœ˜+K˜—˜Kšœœ"˜7Kšœœœ˜K˜Kšœœœ˜Kšœ œœ˜#Kšœ˜šœœ˜šœœœœœœœ œ˜ZKšœ!˜!Kšœ œ˜—Kšœ œ˜—šœœœ˜šœ0œ˜BK˜*Kšœœ˜Kšœ˜——šœ5œ˜?Kš˜K˜*Kšœœ˜Kšœ˜—K˜—Kšœœ˜—šœœ˜ KšœœYœ˜ŠK˜K˜K˜—šœ˜Kšœœw˜‰K˜K˜—Kšœ1œ˜8Kšœ˜—K˜Kšœœ˜Kšœ˜—K˜šŸ œœœ˜4Kš˜Kšœœ˜