DIRECTORY Rope USING [ROPE], SilKernel USING [SilModel] ; SilFile: CEDAR DEFINITIONS = BEGIN ROPE: TYPE = Rope.ROPE; SilModel: TYPE = SilKernel.SilModel; FontType: TYPE = {print, display}; UserFonts: TYPE = [0..9]; MacroFonts: TYPE = [4..9]; FileMacroFonts: TYPE = [4..4]; PresetFonts: TYPE = [0..3]; LibraryFonts: TYPE = [5..9]; InternalFonts: TYPE = [0..15]; InternalMacroFonts: TYPE = [8..13]; InternalFileMacroFonts: TYPE = [8..8]; InternalPresetFonts: TYPE = [0..7]; InternalLibraryFonts: TYPE = [9..13]; InternalRopeFonts: TYPE = [0..13]; --those fonts which do not denote boxes. See below InternalBoxFonts: TYPE = [14..15]; InternalForegroundBoxFonts: TYPE = [14..14]; InternalBackgroundBoxFonts: TYPE = [15..15]; InternalFileMacroFont: InternalFonts = 8; foregroundBoxFont: InternalFonts = 14; backgroundBoxFont: InternalFonts = 15; SilSelection: TYPE = RECORD[ model: SilModel _ NIL, objects: SilObject _ NIL, lastObject: SilObject _ NIL, --this is a dummy object marking the end of the select chain numObjects: INTEGER _ 0, xMin, yMin, xMax, yMax: INTEGER _ 0 ]; PrintingChars: TYPE = CHAR['!..'~]; -- the range of Ascii chars which print meaningfully MacroName: TYPE = CHAR['!..'~]; -- only printing characters are used MacroNameSize: INTEGER = ('~ - '!) + 1; -- number of macro names SilObject: TYPE = LIST OF SilObjectRec; SilObjectRec: TYPE = RECORD[ xMin, yMin: INTEGER, -- Upper Left boundary of box or string xMax, yMax: INTEGER, -- Lower right boundary of box, guess for lower right of string color: Color, -- Color used to display or print object font: InternalFonts, -- Only interesting for Ropes (fonts 0-13) italic: BOOL, -- Only interesting for Ropes (fonts 0-13), TRUE for italic strings value: ROPE _ NIL, selectObj: SilObject _ NIL -- chain together all the currently selected objects ]; Color: TYPE = [0..15]; maxRopeLen: INTEGER = 256; --the longest a String can be (1 byte for its length) PictureType: TYPE = {none, fgnd, bkgnd, macro}; BuildMarkArray: TYPE = ARRAY BuildMarkIndex OF BuildMark; BuildMarkIndex: TYPE = [1..4]; BuildMark: TYPE = RECORD[ xMin, yMin: INTEGER, -- Upper Left boundary of mark xMax, yMax: INTEGER -- Lower right boundary of mark ]; buildMarks: BuildMarkArray = [ [0, 753, 80, 760], [162, 753, 242, 760], [324, 753, 404, 760], [486, 753, 566, 760] ]; InitSil: PROC[] ; NewSilModel: PROC[] RETURNS [model: SilModel]; MainFileToModel: PROC[model: SilModel, name: ROPE, relative: BOOL]; ModelToFile: PROC[model: SilModel, name: ROPE, clipIt: BOOL _ FALSE, large: BOOL _ FALSE, xMin, yMin, xMax, yMax: INTEGER _ 0] RETURNS [wasClipped: BOOL _ FALSE]; ClearModel: PROC[model: SilModel]; ClearMacros: PROC[model: SilModel]; AddObjectToMainPicture: PROC [model: SilModel, sobr: SilObjectRec] RETURNS [sob: SilObject _ NIL]; GetObjectList: PROC [model: SilModel, mode: PictureType _ fgnd, fontNumber: InternalFonts _ 8, c: CHAR _ '!] RETURNS [oblist: SilObject]; CheckSelectionsForMacroDefs: PROC[model: SilModel, disallowName: BOOL _ FALSE, name: MacroName _ '!] RETURNS [SelectionOk: BOOL _ TRUE]; DefineMacroFromSelection: PROC[model: SilModel, name: MacroName _ '!, xRef, yRef: INTEGER]; GetMacroBoundingBox: PROC [model: SilModel, fontNumber: InternalFonts _ 8, c: CHAR _ '!] RETURNS [xMin, yMin, xMax, yMax: INTEGER]; GetSelection: PROC [] RETURNS [selection: SilSelection]; CopySelection: PROC [] RETURNS [copiedSelection: SilSelection]; EvaluateSelection: PROC; DefineSelectWithBox: PROC [model: SilModel, xMin, yMin, xMax, yMax: INTEGER] RETURNS[objXMin, objYMin, objXMax, objYMax: INTEGER _ 0]; DefineSelectWithObject: PROC [model: SilModel, sob: SilObject]; Deselect: PROC [model: SilModel, sob: SilObject]; DeselectAll: PROC []; DeleteAndCacheSelection: PUBLIC PROC[cache: BOOL _ FALSE]; DeleteAndCacheObject: PUBLIC PROC[model: SilModel, sob: SilObject]; Undelete: PROC[model: SilModel] RETURNS [sob: SilObject]; ObjectAtPos: PROC [model: SilModel, x, y: INTEGER] RETURNS [sob: SilObject _ NIL]; ObjectIsSelected: PROC [model: SilModel, sob: SilObject] RETURNS [selected: BOOL]; FontNameFromInternalFont: PROC[font: PresetFonts, fontType: FontType _ display] RETURNS [fName: ROPE]; InternalFontFromUserFont: PUBLIC PROC [font: UserFonts, bold: BOOL] RETURNS [ifont: InternalFonts]; UserFontFromInternalFont: PUBLIC PROC [ifont: InternalFonts] RETURNS [font: UserFonts, bold: BOOL]; FontIsBold: PROC [font: InternalFonts] RETURNS [bold: BOOL]; GetActiveFileName: PROC [model: SilModel] RETURNS [name: ROPE]; GetLastActiveFileName: PROC [model: SilModel] RETURNS [name: ROPE]; MarkFileAsEdited: PROC [model: SilModel] RETURNS [deletedBuildBoxes: BOOL _ FALSE]; END. ºSilFile.Mesa Copyright c 1985 by Xerox Corporation. All rights reserved. Tracy Larrabee, March 29, 1984 1:03:45 pm PST Last Edited by Ken Pier, August 22, 1985 4:19:04 pm PDT This module contains the definitions of the external data types and procedures which are the custodian of the internal data structures built for Sil files. Creations, deletions, or queries will pass through here. THE BASIC IDEA: Information from one or more Sil Files can be contained in one internal Sil Model. A Sil Model will consist of a main picture (which is to be displayed), several secondary pictures which have been defined as macro character set, and a list of objects which are currently selected. Each picture will consist of a list of objects which are to be painted. Each object will be a box or a rope. Both kinds of objects have positional and color attributes, while ropes also have the attributes of font (including bold and italic). (see below.) Fonts are very important in Sil. Every object has a font. There is even a special font for background. How the user is encouraged to think about fonts, and how fonts are stored internally differ (see below). Internal fonts correspond to user fonts in the following way: Internal Font: User Font 0: Font 0 1: Font 0 Bold 2: Font 1 3: Font 1 Bold 4: Font 2 5: Font 2 Bold 6: Font 3 7: Font 3 Bold 8: Font 4 - macro definitions looked up in File 9: Font 5 - macro definitions looked up in Sil.lb5 10: Font 6 - macro definitions looked up in Sil.lb6 11: Font 7 - macro definitions looked up in Sil.lb7 12: Font 8 - macro definitions looked up in Sil.lb8 13: Font 9 - macro definitions looked up in Sil.lb9 14: Object is a box (no associated Rope) 15: Object is a background box (no associated Rope) This procedure will initialize all of Sil's internal structure by reading in any library files and retreiving the names of any fonts. ! SilError with explain = BadFile: One of the library files contained some sort sort of lie concerning its length (such as a non-integral number of Sil objects). BadFileName: a Sil file name was given in the user profile which referenced a file which could not be opened. Create an empty Sil Model. This should be called after Sil has been initialized, and new model has been created. This proc will add any data in the named file to the main picture data currently in the model provided. ! SilError with explain = BadFile: This Sil file contained some sort sort of lie concerning its length (such as a non-integral number of Sil objects). BadFileName: No file could be opened for Read-only given this name. This will output all the information in this model to the file name given. If clipit then only output those objects which lie entirely inside the region given. If large then use the new output format for CedarSil files. ! SilError with explain = BadFileName: No file could be opened with this name. This will delete the model's main picture as well as any macro definitions. This will cause macro definitions in the model to be discarded, along with any macro objects. Add new object to the main picture of model. Return the pertinent object list (main, or macro) out of the model. If mode is main, ignore fontNumber and c. Check the selection to see if it references macro's that are not defined in model. If disallowName, make sure that the selection does not reference any macro's with name name. Add the macro definition with name name to the model given. Return the bounding box of the macro given. Return the selection. Return a copy of the selection which has all the objects of the real selection, but no mention of their model. Causes the bounding box of the selection to get reevaluated after some selected objects sizes change In model, find all the objects inside the box defined by xMin, yMin, xMax, and yMax and add them to the selection. If there are no objects in the box, add no elements to the selection. Return the actual minimum and maximum dimensions of objects inside the box (if there are no objects within the box return the minimum and maximums provided). Sob is added to the previously selected objects. Deselect sob. Deselect all objects. Delete all objects which are selected. IF cache, put deleted objects on delete queue. Delete this Specific object (delink it from the selection list if necessary). Undelete the most recently deleted object for this model and make it the selection. In model, find the object at with the smallest bounding box and return that object. If there is no object at return NIL. TRUE if sob is already selected Return the correct Font name for the given Sil font. Return the internal font corresponding to the user font and boldness given. Return the user font and boldness corresponding to the internal font given. True if this internal font corresponds to a bold user font. Get the name of the currently active Sil file for this model. Get the name of the last active Sil file for this model. Build marks are visual cues placed in Sil files by the Design Automation postprocessing programms. A file which has build marks will have them removed if the file is edited. Mark this file as edited. If this is a "built" file the build marks will be deleted and the display process should know about this. Êw˜codešœ ™ Kšœ Ïmœ1™<—K™-K™7K™K™ØK™šÏb™Kšœ!žœ'žœ™TKšœžœ»™ÆKšœžœžœ™GKšœžœ®™¹K™—šÏk ˜ KšœŸœŸœ˜Kšœ Ÿœ ˜Kšœ˜—K˜šžœŸœŸ œŸ˜"K˜KšŸœŸœŸœ˜Kšœ Ÿœ˜$K˜K™ÒK˜Kšœ Ÿœ˜"Kšœ Ÿœ ˜Kšœ Ÿœ ˜KšœŸœ ˜Kšœ Ÿœ ˜KšœŸœ ˜K˜KšœŸœ ˜KšœŸœ ˜#KšœŸœ ˜&KšœŸœ ˜#KšœŸœ ˜%KšœŸœ Ïc3˜VKšœŸœ ˜"KšœŸœ ˜,KšœŸœ ˜,Kšœ)˜)K˜&K˜&K˜K™=™Kšœ™Kšœ ™ Kšœ™Kšœ ™ Kšœ™Kšœ ™ Kšœ™Kšœ ™ Kšœ™Kšœ/™/Kšœ2™2Kšœ3™3Kšœ3™3Kšœ3™3Kšœ3™3Kšœ(™(Kšœ3™3—K™šœŸœŸœ˜KšœŸœ˜KšœŸœ˜KšœŸœ <˜YKšœ Ÿœ˜KšœŸœ˜#Kšœ˜K˜—KšœŸœŸœ  4˜XKšœ ŸœŸœ  $˜DšœŸœ ˜@K˜—Kšœ ŸœŸœŸœ˜'šœŸœŸœ˜Kšœ Ÿœ '˜