MODULE; IMPORT SOxCoder, Atom, Formatter, SOxCodeUtils, SOxCodeFiles, Type, Wr, ImportList, CodeForType, AtomList; REVEAL T = SOxCoder.T BRANDED OBJECT OVERRIDES InitImports := initImports; Import := import; Head := head; Decls := decls; Main := noMain; Bottom := bottom; END; <* FATAL Wr.Failure*> PROCEDURE SOxIntfPklCode PutLine (fmtWr: Formatter.T; text: TEXT) = BEGIN Formatter.PutText(fmtWr, text); Formatter.NewLine(fmtWr, freshLine := FALSE); END PutLine; VAR extraImports := ARRAY [1..1] OF Atom.T{Atom.FromText("SharedObj")}; PROCEDUREinitImports (<*UNUSED*>self: T; <*UNUSED*>basename: TEXT; imports: ImportList.T) = BEGIN CodeForType.AugmentImportList(imports, extraImports); END initImports; PROCEDUREimport (<*UNUSED*>self: T; <*UNUSED*>type: Type.Object; <*UNUSED*>methods: ImportList.MethodList; <*UNUSED*>umethods: AtomList.T; <*UNUSED*>imports: ImportList.T) = BEGIN END import; PROCEDUREhead (self: T; wr: Formatter.T; filename: TEXT; basename: TEXT; imports: ImportList.T) = BEGIN WITH Nl = Formatter.NewLine DO SOxCodeUtils.HeaderComment(wr, filename); self.fbasename := SOxCodeUtils.FileName(basename, SOxCodeFiles.T.PKL_I3); PutLine(wr, "INTERFACE " & self.fbasename & ";\n"); CodeForType.ProduceImports(wr, imports); Nl(wr, freshLine := FALSE); END; END head; PROCEDUREdecls (<*UNUSED*>self: T; wr: Formatter.T; typeID: Type.Qid; <*UNUSED*>stypeID: Type.Qid; <*UNUSED*>implName: TEXT; <*UNUSED*>methods: ImportList.MethodList; <*UNUSED*>umethods: AtomList.T) = VAR typTxt : TEXT; identfTxt : TEXT; BEGIN WITH Put = Formatter.PutText, Nl = Formatter.NewLine, Tab = Formatter.Begin, EndTab = Formatter.End DO typTxt := CodeForType.QidToText(typeID); identfTxt := CodeForType.QidToIdentf(typeID); Tab(wr, 2); Put(wr, "TYPE"); EndTab(wr); Nl(wr, freshLine := FALSE); PutLine(wr, identfTxt & "Special <: SharedObj.Special;"); PutLine(wr, "PROCEDURE RegisterSpecial_" & identfTxt & "(sp: " & identfTxt & "Special);"); END END decls; PROCEDUREnoMain (<*UNUSED*> self: T; <*UNUSED*> wr: Formatter.T; <*UNUSED*> typeID: Type.Qid; <*UNUSED*> type : Type.Object; <*UNUSED*> stypeID: Type.Qid; <*UNUSED*> implName: TEXT; <*UNUSED*> methods: ImportList.MethodList; <*UNUSED*> umethods: AtomList.T) = BEGIN END noMain; PROCEDUREbottom (self: T; wr: Formatter.T; <*UNUSED*>fname: TEXT) = BEGIN PutLine(wr, "END " & self.fbasename & "."); END bottom; BEGIN END SOxIntfPklCode.