<> <> <> <> <<>> <<>> <> DIRECTORY BcdDefs USING [VersionStamp], Rope USING [ROPE], SafeStorage USING [Type], WorldVM USING [World]; AMModel: DEFINITIONS = { OPEN BcdDefs, Rope, SafeStorage, WorldVM; <> Class: TYPE = {world, model, prog, interface, proc, statement}; -- objects of concern herein Source: TYPE = REF SourceObj; -- range in a source file SourceObj: TYPE = RECORD[ fileName: ROPE _ NIL, -- without path, e.g. foo.mesa class: Class, versionStamp: VersionStamp, sourceRange: SELECT tag: * FROM entire => [], field => [firstCharIndex: CharIndex _ 0, lastCharIndex: CharIndex _ 0] <> ENDCASE ]; CharIndex: TYPE = INT; -- into a source file. The first char has index = 0. IRIndex: TYPE = INT; -- into an interface instance. <> Section: TYPE = REF SectionObj; SectionObj: TYPE; -- opaque <> <> <<(someday modeller output bundle for a model)>> <> <> <> <> Context: TYPE = REF ANY; -- Context should be opaque, but convenient this way for now <> <> <> <> <> <> <> PartialInterfaceInstance: TYPE = RECORD[ir: --interface--Context, usingList: LIST OF IRIndex]; <> RootContext: PROC [world: World _ NIL] RETURNS [Context]; < use WorldVM.LocalWorld[]). Immediate children are its top-level Contexts: loadstate entries for individually loaded program modules and bound configs (someday models).>> <> <<... dealing with Source>> FileSource: PROC [fileName: ROPE, class: --model, prog, interface--Class] RETURNS [Source]; SourceFileName: PROC [source: Source] RETURNS [ROPE] = INLINE { RETURN[source.fileName]}; SourceClass: PROC [source: Source] RETURNS [Class] = INLINE { RETURN[source.class]}; SourceVersion: PROC [source: Source] RETURNS [VersionStamp] = INLINE { RETURN[source.versionStamp]}; SourceSection: PROC [source: Source, context: --worldRoot or model--Context] RETURNS [section: Section, contexts: LIST OF --prog--Context]; <> <> <> <> <> <> <<... dealing with Sections>> SectionClass: PROC [section: Section] RETURNS [Class]; SectionName: PROC [section: Section] RETURNS [ROPE]; <> <>> SectionType: PROC [section: Section] RETURNS [--procedure--Type]; <> SectionVersion: PROC [section: Section] RETURNS [VersionStamp]; SectionSource: PROC [section: Section] RETURNS [Source]; <> SectionParams: PROC [section: Section] RETURNS [LIST OF --interface-- Type]; <> <> SectionChildren: PROC [section: Section, proc: PROC [Section] RETURNS [stop: BOOL]] RETURNS [ans: Section _ NIL--NIL if not stopped--]; <> <> ParentSection: PROC [section: Section] RETURNS [Section]; <> <> <> <<... dealing with Contexts>> <> <> <> ContextClass: PROC [context: Context] RETURNS [Class]; ContextWorld: PROC [context: Context] RETURNS [World]; ContextName: PROC [context: Context] RETURNS [ROPE]; < worldName>> < :ConfigIndex#>> < :gfh#>> < >> < :fh#>> < :FGT#>> MostRecentNamedContext: PROC [name: ROPE, context: --world or model--Context] RETURNS [Context]; <> <> <> <> <> <> <> <> NamedContexts: PROC [name: ROPE, context: --worldRoot or model--Context, proc: PROC [Context] RETURNS [stop: BOOL]] RETURNS [Context--NIL if not stopped--]; <> <> ContextSection: PROC [context: Context] RETURNS [Section]; <> ParentContext: PROC [context: Context] RETURNS [Context]; < NIL>> < world>> < model>> < prog>> < proc>> ContextChildren: PROC [context: Context, proc: PROC [Context] RETURNS [stop: BOOL]] RETURNS [Context--NIL if not stopped--]; <> < models or progs (TVs for global frames),>> < progs,>> < statement (proc will be called only once)>> <<... dealing with interfaces>> InterfaceRecords: PROC [world: Context] RETURNS [LIST OF --interface--Context]; Imports: PROC [context: Context] RETURNS [LIST OF PartialInterfaceInstance]; <> Exports: PROC [context: Context] RETURNS [LIST OF PartialInterfaceInstance]; <> }.