DIRECTORY Imager USING [Context], ISToken USING [TVObject, TVHandle, InterscriptContext], ISBinding USING [Handle], Rope USING [ROPE], ViewerClasses USING [Viewer]; ISNode: CEDAR DEFINITIONS = BEGIN Handle: TYPE = REF Object; Object: TYPE = RECORD [ implementationChainHandle: --PRIVATE-- REF _ NIL, empty: BOOLEAN _ FALSE, -- for marking empty nodes in pages -- parent: ISNode.Handle _ NIL, format: ATOM, --for PARA$-- text: Rope.ROPE, --for CHARS$-- looks: Rope.ROPE, --for CHARS$-- contextThread: ContextHandle _ NIL, printProc: TiogaPrintProc, taggedBindingsList: LIST OF ISBinding.Handle _ NIL, --Stores bindings assoc. with secondary tags, which have to stick around.-- seenSubnode: BOOL _ FALSE, --Used to tell if a CHARS$ child of a PARA$ should have ISContinuation property set in Tioga-- lastNodeEnd: INT _ 0, --Used in CHARS$ nodes to note end of previous node's text in temp file-- textIndex: INT _ 0, -- saves position of last character in first pass temp file -- primaryTag: ATOM, tag: ATOM, --tag currently being internalized, used by ISImplProcs.DefaultInternalizeProc-- tagThread: TagHandle _ NIL]; -- array of booleans for standardized -- ContextRecord: TYPE = RECORD [ type: ATOM, context: ISToken.InterscriptContext, next: ContextHandle ]; ContextHandle: TYPE = REF ContextRecord; TagRecord: TYPE = RECORD [tag: ATOM, next: TagHandle]; TagHandle: TYPE = REF TagRecord; ImplementationClass: TYPE = {primary, onlyBindings, onlyTag}; Implementation: TYPE = REF ImplementationObject; ImplementationObject: TYPE = RECORD [ internalize: InternalizeProc, externalize: ExternalizeProc, destroy: DestroyProc _ NIL, printTioga: TiogaPrintProc _ NIL, interpress: InterpressProc _ NIL, createWindow: CreateWindowProc _ NIL, enumerate: EnumerateChildrenProc _ NIL, copy: CopyProc _ NIL, getBinding: GetBindingProc _ NIL, setBinding: SetBindingProc _ NIL, getContentItem: GetContentItemProc _ NIL, coerceBindings: CoerceBindingsProc _ NIL, --added 22may85 rma-- implementationClass: ImplementationClass, mustInternalizeAllContent: BOOLEAN _ FALSE ]; InternalizeProc: TYPE = PROCEDURE [node: Handle, interscriptContext: ISToken.InterscriptContext]; TiogaPrintProc: TYPE = PROCEDURE [deltaLevel: INT, node: ISNode.Handle] RETURNS [nests: INT _ 0]; ExternalizeProc: TYPE = PROCEDURE [node: Handle, externalizeContext: --ISOut.Handle-- REF]; DestroyProc: TYPE = PROCEDURE [node: Handle]; InterpressClippingBox: TYPE = RECORD [x, y, w, h: REAL]; InterpressProc: TYPE = PROCEDURE [ node: Handle, interpressContext: Imager.Context, clippingBox: InterpressClippingBox ]; EditMode: TYPE = {galley, layout}; CreateWindowProc: TYPE = PROCEDURE [ node: Handle, editMode: EditMode, micasPerPixel: CARDINAL] RETURNS[ViewerClasses.Viewer]; EnumerateChildrenAnswerType: TYPE = {node, characters}; EnumerateChildrenAnswer: TYPE = RECORD [ body: SELECT type: EnumerateChildrenAnswerType FROM node => [handle: ISNode.Handle], characters => [ readerBody: Rope.ROPE, font: INTEGER, labels: SEQUENCE number: CARDINAL OF ATOM ], ENDCASE _ NULL ]; EnumerateChildrenCallback: TYPE = PROCEDURE [ child: EnumerateChildrenAnswer, context: REF ANY ] RETURNS [continue: BOOLEAN _ TRUE]; EnumerateChildrenProc: TYPE = PROCEDURE [ node: Handle, context: REF ANY, enumerationProc: EnumerateChildrenCallback ]; CopyProc: TYPE = PROCEDURE [ old, new: Handle ]; GetBindingProc: TYPE = PROCEDURE [node: Handle, binding: ATOM] RETURNS [ISToken.TVObject]; SetBindingProc: TYPE = PROCEDURE [ node: Handle, binding: ATOM, value: ISToken.TVHandle]; GetContentItemProc: TYPE = PROCEDURE [node: Handle, index: CARDINAL] RETURNS [ISToken.TVObject]; CoerceBindingsProc: TYPE = PROCEDURE [to, from: Handle, coercion: ISToken.TVHandle _ NIL]; ErrorCode: TYPE = {spare, extra}; Error: ERROR [code: ErrorCode]; SetImplementation: PROCEDURE [ -- Installation of an implementation -- tag: ATOM, family: ATOM, implementation: Implementation] RETURNS [oldImplementation: Implementation]; GetImplementation: PROCEDURE[ tag: ATOM, family: ATOM ] RETURNS [implementation: Implementation]; GetPrimaryImpl: PROCEDURE [Handle] RETURNS [Implementation]; GetPrimaryImplAndTag: PROCEDURE [Handle] RETURNS [implementation: Implementation, tag: ATOM]; Externalize: ExternalizeProc; Interpress: InterpressProc; CreateWindow: CreateWindowProc; Enumerate: EnumerateChildrenProc; Copy: PROCEDURE [old: Handle, with: Handle _ NIL] RETURNS [Handle]; Create: PROCEDURE [--with: ISNode.Handle--] RETURNS [Handle]; Destroy: PROCEDURE [REF Handle]; GetContext: PROCEDURE [node: Handle, type: ATOM] RETURNS [context: ISToken.InterscriptContext]; SetContext: PROCEDURE [node: Handle, type: ATOM, context: ISToken.InterscriptContext]; EnumerateContextsCallback: TYPE = PROCEDURE [node: Handle, type: ATOM, context: REF ] RETURNS [continue: BOOLEAN _ TRUE]; EnumerateContexts: PROCEDURE [node: Handle, enumerationProc: EnumerateContextsCallback, context: REF]; SetTag: PROCEDURE [node: Handle, tag: ATOM]; ClearTag: PROCEDURE [node: Handle, tag: ATOM]; HasTag: PROCEDURE [node: Handle, tag: ATOM] RETURNS [BOOLEAN]; AllocateInitialNode: PROCEDURE [session: REF] RETURNS [ISNode.Handle]; END. :ISNode.mesa Copyright c 1985 by Xerox Corporation. All rights reserved. edit by Ayers 22-May-85 13:21:31 Rick Beach, August 1, 1985 3:03:20 pm PDT MKaplan, September 13, 1985 2:21:55 pm PDT ISOut USING [Handle], ISNode.Object holds all information collected in parsing an object. Some of its fields are implementation dependent (i.e., useful only for some tags, like text for CHARS$). It can probably be cleaned up. ^^ ISNodeImpl.ImplementationChainHandle speeds search -- Context records are saved in the node. Really, only content and embedded contexts are used, a contentThread might be more appropriate for keeping in the node. Implementation objects map node types to functions that internalize them. These functions are the "code generation component" of the parser. Only internalize, and printTioga fields are used by us. InternalizeProcs are handed contexts as they are parsed. initial contexts for initializing nodes, content and embedded contexts for dealing with things that go into the node, end contexts for cleaning up. TiogaPrintProc is called once the node has been fully parsed, to write it out in tioga format. Plug-ins called by node implementations GetNextWindow: PROCEDURE [node: Handle, window: Window.Handle] RETURNS [Window.Handle]; GetWindowsNode: PROCEDURE[window: Window.Handle] RETURNS[Handle]; ΚΈ˜codešœ ™ Kšœ Οmœ1™Kšœž˜Kšœžœ  ˜Kšœ žœ ˜Kšœ žœ ˜ Kšœžœ˜#Kšœ˜Kšœžœžœ K˜Kšœ žœžœ ^˜yKšœ žœ I˜_Kšœ žœ >˜RKšœ žœ˜Kšœžœ P˜[Kšœžœ (˜E—K˜K™Ÿšœžœžœ˜Kšœžœ'˜1K˜—Kšœžœžœ˜(Kšœ žœžœžœ˜6Kšœ žœžœ ˜ K˜K™ΖKšœžœ$˜=K˜Kšœžœžœ˜0šœžœžœ˜%K˜K˜Kšœžœ˜Kšœžœ˜!Kšœžœ˜!Kšœ!žœ˜%Kšœ#žœ˜'Kšœžœ˜Kšœžœ˜!Kšœžœ˜!Kšœ%žœ˜)Kšœ%žœ ˜?K˜)Kšœžœžœ˜-K˜——˜K™ΝšΟnœžœž œ@˜aK˜—K™^š ‘œžœž œžœžœ žœ˜aK˜—š ‘œžœž œ$ œžœ˜[K˜—Kš‘ œžœž œ˜-K˜Kšœžœžœžœ˜8š‘œžœž œ˜"K˜ K˜"K˜%K˜—Kšœ žœ˜#Kš‘œžœž œžœ žœžœžœžœ˜~K˜Kšœžœ˜7šœžœžœ˜(šœžœ#ž˜3K˜ ˜Kšœžœ˜Kšœžœ˜Kš œžœ žœžœžœ˜,—Kšžœžœ˜——Kš‘œžœž œžœžœ žœžœ žœžœ˜„Kš ‘œžœž œžœžœ/˜wK˜Kš‘œžœž œ˜0K˜Kš ‘œžœž œžœžœ˜Zš‘œžœž œ˜"Kšœžœ˜6—K˜Kš ‘œžœž œžœžœ˜`K˜Kš‘œžœž œ1žœ˜ZK˜Kšœ žœ˜#šœžœ˜K˜—š‘œž œ '˜FKšœžœ˜ Kšœžœ˜ K˜Kšžœ%˜,K˜—š‘œž œ˜Kšœžœ˜ Kšœžœ˜Kšžœ"˜)—K˜Kš‘œž œ žœ˜<š‘œž œ ˜(Kšžœ'žœ˜4—K˜Kšœ'™'K˜K˜K˜K˜!˜Kš‘œž œžœžœ ˜CK˜Kš‘œž œ œžœ ˜=Kš‘œž œžœ ˜ K˜Kš‘ œž œžœžœ'˜_Kš‘ œž œžœ'˜VKš‘œžœž œžœ žœžœ žœžœ˜zKš‘œž œEžœ˜fK˜Kš‘ œž œ&žœ™WKš‘œž œžœ ™A—˜Kš‘œž œžœ˜,Kš‘œž œžœ˜.Kš ‘œž œžœžœžœ˜>K˜š‘œž œ žœ˜-Kšžœ˜K˜——šžœ˜K˜—K˜——…—*