<Cedar5.2>System>spGlobals.mesa>> <> <<>> DIRECTORY Ascii USING [SP], IO USING [STREAM], Rope USING [ROPE], ThymeParser; spGlobals: CEDAR DEFINITIONS = { <> itemType: TYPE = {name, comma, semi, colon, rightB, leftB, equal, number, leftC, rightC, eof, leftArrow, slash, upArrow, atSign, vertical, star, plus, minus, leftP, rightP, backSlash, greater, less, pound, squiggle, amperesand, quote, string, implies, greatEqual, lessEqual, maximum, minimum, nullItem}; keys: TYPE = {nodeKey, resKey, capKey, indKey, vsKey, isKey, runKey, printKey, circuitKey, modelKey, plotKey, icKey, dumpKey, assertsKey, checkPointKey, libraryKey, nullKey}; <<>> <> operators: TYPE = {load, neg, add, sub, mul, div, power, store, abs, exp, num, log, sqrt, not, grt, les, geq, leq, eq, neq, and, or, int, max, min, nullOpr}; expressionPtr: TYPE = REF expressionNode; expressionNode: TYPE = RECORD [ next: expressionPtr _ NIL, operands: SELECT operator: operators FROM add, sub, mul, div, power, and, or, grt, les, geq, leq, eq, neq, max, min => [leftOp: expressionPtr _ NIL, rightOp: expressionPtr _ NIL], abs, exp, neg, log, sqrt, not, int => [unaryOp: expressionPtr _ NIL], load, store => [var: namePtr _ NIL, expr: expressionPtr _ NIL], num => [v: REAL _ 0.0], ENDCASE ]; <> namePtr: TYPE = REF nameBlk; nameBlk: TYPE = RECORD [ nextName, <> srchLink: namePtr _ NIL, <> name: Rope.ROPE _ NIL, expExpr: expressionPtr _ NIL, <> realCopy: realThingPtr _ NIL, <> details: REF ANY _ NIL]; -- cf. the following 8 REF types RefNodeRec: TYPE = REF NodeRec; NodeRec: TYPE = RECORD []; elements: TYPE = {resistor, capacitor, inductor, vSource, iSource, nullElement}; RefBranchRec: TYPE = REF BranchRec; BranchRec: TYPE = RECORD [ branchType: elements _ nullElement, posNode, negNode, controller: namePtr _ NIL, modelIndex: NAT _ 0, valExpr: expressionPtr _ NIL]; RefCircuitRec: TYPE = REF CircuitRec; CircuitRec: TYPE = RECORD [ names, <> fakeNodes: namePtr _ NIL, <> conCount: NAT _ 0, <> parms, <> father: namePtr _ NIL, <> assertions: expressionPtr _ NIL]; RefConRec: TYPE = REF ConRec; ConRec: TYPE = RECORD []; RefParmRec: TYPE = REF ParmRec; ParmRec: TYPE = RECORD [ default: BOOL _ FALSE, dfltValue: REAL _ 0.0, nextParm: namePtr _ NIL]; RefCktInstRec: TYPE = REF CktInstance; CktInstance: TYPE = RECORD [ of: namePtr _ NIL, connections: conLinkPtr _ NIL, actualParms: expressionPtr _ NIL, attributes: attPtr _ NIL]; RefModelRec: TYPE = REF ModelRec; ModelRec: TYPE = RECORD [ modelProc: model _ NIL, modelResults: argList _ NIL, modelArgs: argNames _ NIL, modelArgVec, modelOldArgVec: argList _ NIL, modelParms: expressionPtr _ NIL]; RefFunctionRec: TYPE = REF FunctionRec; FunctionRec: TYPE = RECORD [ functionProc: function _ NIL, funcArgs: argNames _ NIL, funcArgVec: argList _ NIL, funcParms: expressionPtr _ NIL, branch: namePtr _ NIL]; <> conLinkPtr: TYPE = REF conLink; conLink: TYPE = RECORD [ nextLink: conLinkPtr _ NIL, namedNode: namePtr _ NIL]; <<>> <> attPtr: TYPE = REF attribute; attribute: TYPE = RECORD [ name: Rope.ROPE, value: Rope.ROPE, next: attPtr]; <> realThings: TYPE = {realNode, realBranch, realParm, realModel, unReal}; realThingPtr: TYPE = REF realThing; realThing: TYPE = RECORD [ nextThing: realThingPtr _ NIL, newLevel: BOOL _ TRUE, thing: REF ANY _ NIL]; -- cf. the following 5 REF types RefRealNode: TYPE = REF RealNode; RealNode: TYPE = RECORD [rn: Rope.ROPE _ NIL]; <> RefRealParm: TYPE = REF RealParm; RealParm: TYPE = RECORD [rp: REAL _ 0.0]; RefUnReal: TYPE = REF UnReal; UnReal: TYPE = RECORD []; ModelTablePtr: TYPE = REF ModelTableBlk; ModelTableBlk: TYPE = RECORD [ next: ModelTablePtr, name: Rope.ROPE, proc: model, numArgs, numParms, numResults: NAT]; FuncTablePtr: TYPE = REF FuncTableBlk; FuncTableBlk: TYPE = RECORD [ next: FuncTablePtr, name: Rope.ROPE, proc: function, numArgs, numParms: NAT]; <<>> <> argList: TYPE = REF ValueSeq; ValueSeq: TYPE = RECORD [value: SEQUENCE size: NAT OF REAL]; argNames: TYPE = REF namePtrSeq; namePtrSeq: TYPE = RECORD [names: SEQUENCE size: NAT OF namePtr]; <> model: TYPE = PROC[args, oldArgs, parms, results: argList]; function: TYPE = PROC[t: REAL, args, parms: argList] RETURNS [v: REAL]; <> Stages: TYPE = {idle, input, bomb, topo, run}; Handle: TYPE = REF ThymeToolRec; ThymeToolRec: TYPE = RECORD [ msgStream: IO.STREAM _ NIL, stage: Stages _ idle, checkProcess, simulation: PROCESS _ NIL, checkPointCV: CONDITION, height: NAT _ 0, vars: REF Variables _ NIL]; Variables: TYPE = RECORD [ <<>> <> fileStack: REF fileStackSeq _ NIL, fileStackTop: NAT _ 0, line: REF TEXT _ NIL, value: REAL _ 0.0, item: itemType _ nullItem, newString: REF TEXT _ NIL, char: CHAR _ Ascii.SP, cptr: NAT _ 0, -- pointer to "char" in "line" genSymCtr: LONG CARDINAL _ 10000, canned: BOOL _ FALSE, stopValue: REF BOOL _ NIL, <<>> <> gndNodeName, undefNode, cktRoot, currentCkt: namePtr _ NIL, <<>> <> nodeCount, resCount, capCount, fetCount, modelCount, funcCount: LONG CARDINAL _ 0, n: Rope.ROPE _ NIL, -- Real ones!!! p: REAL _ 0.0, resProc: ThymeParser.ResistorProc, capProc: ThymeParser.CapacitorProc, fetProc: ThymeParser.TransistorProc, attProc: ThymeParser.AttributeProc, nodeProc: ThymeParser.NodeProc, clientData: REF ANY, fetTable: ThymeParser.TypeList, pathName: Rope.ROPE, -- Stores cumulative path (list of names, separated by slashes) from root to current cell. Used by Crystal to assign unique names to each node. curCkt: namePtr, <<-- Current circuit being exploded.>> <> errCount, warnCount: NAT _ 0, triedOnce: BOOL _ FALSE, inStream, thymeDotErrors: IO.STREAM _ NIL, topOfMsgStream: INT _ 0, <<>> <> type: {real, name} _ real, <<>> checkPointCV: CONDITION ]; <<>> <> fileStackSeq: TYPE = RECORD [f: SEQUENCE numFiles: NAT OF IO.STREAM]; maxInclude: NAT = 10; <> ErrorSignal: SIGNAL[error: NAT, s: Rope.ROPE]; Retreat: SIGNAL[cause: Rope.ROPE]; Failure: SIGNAL[errorNum: NAT]; Aborted: SIGNAL; -- spGlobalsImpl <<>> <> <> version: Rope.ROPE; refNodeRec: READONLY RefNodeRec; refConRec: READONLY RefConRec; refUnReal: READONLY RefUnReal; modelTable: ModelTablePtr; functionTable: FuncTablePtr; <<>> <> <<>> <> openInputFile: PROC[handle: Handle]; OutputFileRoot: PROC[handle: Handle] RETURNS [Rope.ROPE]; WorkingDirectory: PROC[handle: Handle] RETURNS [Rope.ROPE]; FlushCloseNil: PROC[stream: IO.STREAM] RETURNS [IO.STREAM _ NIL]; CloseNil: PROC[stream: IO.STREAM] RETURNS [IO.STREAM _ NIL]; MsgTextsWithLook: PROC[handle: Handle, text: Rope.ROPE, look: CHAR['a..'z]]; next: PROC[handle: Handle]; searchKey: PROC[handle: Handle] RETURNS [index: keys]; getSignedNumber: PROC[handle: Handle] RETURNS [n: REAL _ 1.0]; GetLineAndCptr: PROC[handle: Handle] RETURNS [Rope.ROPE, NAT]; <<>> <> error: PROC[handle: Handle, err: NAT, skip, warning: BOOL _ FALSE]; error2: PROC[handle: Handle, err: NAT, n: namePtr]; ErrorStrings: PROC[handle: Handle, err: NAT, s1, s2: Rope.ROPE]; ErrWarnSummary: PROC[handle: Handle]; <<>> <> expression: PROC[handle: Handle] RETURNS [e: expressionPtr]; assignExpr: PROC[handle: Handle, leftContext: namePtr] RETURNS [a: expressionPtr]; eval: PROC[handle: Handle, exp: expressionPtr] RETURNS [v: REAL]; <<>> <> variable: PROC[handle: Handle, string: REF TEXT, context: namePtr] RETURNS [nPtr: namePtr _ NIL]; output: PROC[handle: Handle, ckt: namePtr, level: NAT]; defineCircuit: PROC[handle: Handle, ckt: namePtr, root: BOOL]; <> bomb: PROC[handle: Handle]; getParmValue: PROC[handle: Handle, nPtr: namePtr] RETURNS [REAL]; putParmValue: PROC[handle: Handle, nPtr: namePtr, val: REAL]; <<>> <<;>> PutMsgLine: PROC[handle: Handle, s: Rope.ROPE]; dumpAll: PROC[handle: Handle, t: REAL]; <<>> <> Canned: PROC[handle: Handle] RETURNS [BOOL]; StopIt: PROC[handle: Handle]; NextStage: PROC[handle: Handle]; findFunction: PROC[name: Rope.ROPE] RETURNS[function, NAT, NAT]; findModel: PROC[name: Rope.ROPE] RETURNS[model, NAT, NAT, NAT]; EnterModels: PROC[name: Rope.ROPE, proc: model, numArgs, numParms, numResults: NAT]; EnterFunctions: PROC[name: Rope.ROPE, proc: function, numArgs, numParms: NAT]; <<>> }. <<>> <> <> <> <> <> <> <<>>