-- File: [Thyme]<Thyme>System>CSIM01>spGlobals.mesa -- Last editted: -- SChen April 19, 1983 1:30 PM -- Wilhelm April 27, 1982 4:05 PM, reformated by Barth and stored under -- [Cherry]<Barth>Thyme>1.97> . -- Details at end of file. DIRECTORY IODefs, SystemDefs, FSPDefs, StreamDefs, AltoDefs, StringDefs, Real, spModelDefs; spGlobals: DEFINITIONS IMPORTS IODefs, SystemDefs, FSPDefs, StringDefs, StreamDefs, Real, spModelDefs = BEGIN 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}; item: itemType; value: REAL; newString: LONG STRING; inputFileName: STRING; keys: TYPE = {nodeKey, resKey, capKey, indKey, vsKey, isKey, runKey, printKey, circuitKey, modelKey, plotKey, icKey, dumpKey, assertsKey, checkPointKey, libraryKey, badKey}; argList: TYPE = spModelDefs.argList; argNames: TYPE = LONG DESCRIPTOR FOR ARRAY OF namePtr; argSource: TYPE = LONG DESCRIPTOR FOR ARRAY OF nodePtr; function: TYPE = spModelDefs.function; modBrPtr: TYPE = LONG POINTER TO modelBranch; modelBranch: TYPE = RECORD[nextBranch: modBrPtr, b: branchPtr]; model: TYPE = spModelDefs.model; modFuncPtr: TYPE = LONG POINTER TO modFuncBlk; functionPtr: TYPE = LONG POINTER TO fn modFuncBlk; modelPtr: TYPE = LONG POINTER TO mod modFuncBlk; modFuncBlk: TYPE = RECORD[nextFunction: modFuncPtr, arguments: argSource, argVector: argList, parmVector: argList, actualParms: expressionPtr, fbVar: SELECT fbForm: {mod, fn} FROM fn => [functionProc: function, branch: branchPtr], mod => [modelProc: model, modelResults: argList, modelName: modelNamePtr, modelBranches: modBrPtr], ENDCASE]; instTreePtr: TYPE = LONG POINTER TO instTreeNode; instTreeNode: TYPE = RECORD[father: instTreePtr, brothers, sons: instTreePtr, instance: cktInstNamePtr, nodes: nodePtr, branches: branchPtr]; nodePtr: TYPE = LONG POINTER TO node; node: TYPE = RECORD[nextNode: nodePtr, nodeName: namePtr, treeLevel: instTreePtr, brotherNodes: nodePtr, branches: branchLinkPtr, curPtr: vSourcePtr, nextIntNode: nodePtr, nHist: history, integrate: BOOLEAN, marked, converged: BOOLEAN]; branchLinkPtr: TYPE = LONG POINTER TO branchLink; branchLink: TYPE = RECORD[nextLink: branchLinkPtr, branch: branchPtr, otherNode: nodePtr, pos: BOOLEAN]; branchPtr: TYPE = LONG POINTER TO branch; elements: TYPE = {resistor, capacitor, inductor, vSource, iSource}; branch: TYPE = RECORD[branchName: namePtr, treeLevel: instTreePtr, brotherBranches: branchPtr, posNode: nodePtr, negNode: nodePtr, comVal: REAL, controller: modFuncPtr, modelIndex: CARDINAL, element: SELECT eType: elements FROM resistor => [ ], capacitor => [nextCapacitor: capacitorPtr], inductor => [nextInductor: inductorPtr, iHist: history], vSource => [nextvSource: vSourcePtr, vsCurrent: REAL, oldCurrent: REAL], iSource => [nextiSource: iSourcePtr], ENDCASE]; history: TYPE = RECORD[y, oldy, sumk, oldf, f0, f1, f2, f3, f4: REAL]; initialHistory: history; resistorPtr: TYPE = LONG POINTER TO resistor branch; capacitorPtr: TYPE = LONG POINTER TO capacitor branch; inductorPtr: TYPE = LONG POINTER TO inductor branch; vSourcePtr: TYPE = LONG POINTER TO vSource branch; iSourcePtr: TYPE = LONG POINTER TO iSource branch; conLinkPtr: TYPE = LONG POINTER TO conLink; conLink: TYPE = RECORD[nextLink: conLinkPtr, namedNode: namePtr]; 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}; expressionPtr: TYPE = LONG POINTER TO expressionNode; expressionNode: TYPE = RECORD[nextExpression: expressionPtr, operands: SELECT op: operators FROM add, sub, mul, div, power, and, or, grt, les, geq, leq, eq, neq, max, min => [leftOp: expressionPtr, rightOp: expressionPtr], abs, exp, neg, log, sqrt, not, int => [unaryOp: expressionPtr], load, store => [var: namePtr, expr: expressionPtr], num => [v: REAL], ENDCASE]; realThings: TYPE = {realNode, realBranch, realParm, realModel, unReal}; realThingPtr: TYPE = LONG POINTER TO realThing; realThing: TYPE = RECORD[nextThing: realThingPtr, newLevel: BOOLEAN, thing: SELECT thingType: realThings FROM realNode => [rn: nodePtr], realBranch => [rb: branchPtr], realParm => [rp: REAL], realModel => [rm: modelPtr], unReal => [], ENDCASE]; namePtr: TYPE = LONG POINTER TO nameBlk; nameTypes: TYPE = {nodeName, branchName, circuitName, parmName, conName, cktInstance, modelName, functionName}; nameBlk: TYPE = RECORD[nextName: namePtr, srchLink: namePtr, name: LONG STRING, expExpr: expressionPtr, realCopy: realThingPtr, forms: SELECT nType: nameTypes FROM nodeName => [], branchName => [branchType: elements, posNode: namePtr, negNode: namePtr, controller: namePtr, modelIndex: CARDINAL, valExpr: expressionPtr], circuitName => [names: namePtr, fakeNodes: namePtr, conCount: CARDINAL, parms: parmNamePtr, father: circuitNamePtr, assertions: expressionPtr], conName => [], parmName => [default: BOOLEAN, dfltValue: REAL, nextParm: parmNamePtr], cktInstance => [of: circuitNamePtr, connections: conLinkPtr, actualParms: expressionPtr], modelName => [modelProc: model, modelResults: argList, modelArgs: argNames, modelArgVec: argList, modelParms: expressionPtr], functionName => [functionProc: function, funcArgs: argNames, funcArgVec: argList, funcParms: expressionPtr, branch: branchNamePtr], ENDCASE]; circuitNamePtr: TYPE = LONG POINTER TO circuitName nameBlk; parmNamePtr: TYPE = LONG POINTER TO parmName nameBlk; cktInstNamePtr: TYPE = LONG POINTER TO cktInstance nameBlk; nodeNamePtr: TYPE = LONG POINTER TO nodeName nameBlk; branchNamePtr: TYPE = LONG POINTER TO branchName nameBlk; modelNamePtr: TYPE = LONG POINTER TO modelName nameBlk; functionNamePtr: TYPE = LONG POINTER TO functionName nameBlk; -- Signals ErrorSignal: SIGNAL[error: CARDINAL, s: LONG STRING]; -- Exported by spGlobalsImpl makeRealThing: PROCEDURE[last: realThingPtr] RETURNS[new: realThingPtr]; makeName: PROCEDURE[last: namePtr] RETURNS[new: namePtr]; makeBranchLink: PROCEDURE[last: branchLinkPtr, b: branchPtr, positiveNode: BOOLEAN] RETURNS[new: branchLinkPtr]; makeConLink: PROCEDURE[last: conLinkPtr, conName: namePtr] RETURNS[new: conLinkPtr]; makeExpr: PROCEDURE RETURNS[e: expressionPtr]; makeNode: PROCEDURE RETURNS[n: nodePtr]; makeResistor: PROCEDURE RETURNS[r: resistorPtr]; makeCapacitor: PROCEDURE RETURNS[c: capacitorPtr]; makeInductor: PROCEDURE RETURNS[l: inductorPtr]; makeVoltage: PROCEDURE RETURNS[v: vSourcePtr]; makeCurrent: PROCEDURE RETURNS[i: iSourcePtr]; makeFunction: PROCEDURE RETURNS[f: functionPtr]; makeModel: PROCEDURE RETURNS[m: modelPtr]; makeModBranch: PROCEDURE[last: modBrPtr, b: branchPtr] RETURNS[mb: modBrPtr]; makeArgSource: PROCEDURE[na: CARDINAL] RETURNS[a: argSource]; makeArgNames: PROCEDURE[na: CARDINAL] RETURNS[a: argNames]; makeArgList: PROCEDURE[na: CARDINAL] RETURNS[a: argList]; makeTreeNode: PROCEDURE[inst: cktInstNamePtr] RETURNS[t: instTreePtr]; makeLongString: PROCEDURE[len: CARDINAL] RETURNS[ls: LONG STRING]; openInputFile: PROCEDURE; next: PROCEDURE; searchKey: PROCEDURE RETURNS[index: keys]; getSignedNumber: PROCEDURE RETURNS[n: REAL ← 1.0]; LongEqualStrings: PROCEDURE[s, S: LONG STRING] RETURNS[eq: BOOLEAN ← FALSE]; LongStringGetsString: PROCEDURE[s, S: LONG STRING]; GetLineAndCptr: PROCEDURE RETURNS[STRING, CARDINAL]; -- Exported by spErrors error: PROCEDURE[err: CARDINAL, skip, warning: BOOLEAN ← FALSE]; error2: PROCEDURE[err: CARDINAL, n: namePtr]; ErrorStrings: PROCEDURE[err: CARDINAL, s1, s2: LONG STRING]; ErrorAtNB: PROCEDURE[err: CARDINAL, n: nodePtr, b: branchPtr]; AnyErrors: PROCEDURE RETURNS[BOOLEAN]; -- Exported by spExpressions expression: PROCEDURE RETURNS[e: expressionPtr]; assignExpr: PROCEDURE[leftContext: circuitNamePtr] RETURNS[a: expressionPtr]; eval: PROCEDURE[exp: expressionPtr] RETURNS[v: REAL]; -- Exported by spInput gndNodeName: namePtr; cktRoot: circuitNamePtr; variable: PROCEDURE[context: circuitNamePtr] RETURNS[nPtr: namePtr ← NIL]; input: PROCEDURE; output: PROCEDURE[ckt: circuitNamePtr, level: CARDINAL]; -- Exported by spBomb gndNode: nodePtr; nodeList: nodePtr; capacitorList: capacitorPtr; inductorList: inductorPtr; vSourceList: vSourcePtr; iSourceList: iSourcePtr; functionList: modFuncPtr; bomb: PROCEDURE; printHole: PROCEDURE; findNodeOrBranch: PROCEDURE RETURNS[n: nodePtr, b: branchPtr]; printNode: PROCEDURE[n: nodePtr, ok: BOOLEAN]; printBranch: PROCEDURE[b: branchPtr, ok: BOOLEAN]; makeStringNB: PROCEDURE[n: nodePtr, b: branchPtr, ok: BOOLEAN ← TRUE] RETURNS[STRING]; getParmValue: PROCEDURE[name: namePtr] RETURNS[REAL]; putParmValue: PROCEDURE[name: namePtr, val: REAL]; -- Exported by spAnalysis topoAnalysis: PROCEDURE; -- Exported by spSolve intNodeList: nodePtr; intNodeModFunc: modFuncPtr; otherModFunc: modFuncPtr; runIt: PROCEDURE RETURNS[REAL]; canIt: PROCEDURE; checkIt: PROCEDURE; setICs: PROCEDURE; -- Exported by spOutput openSysWindow: PROCEDURE[herald: STRING]; printFromList: PROCEDURE[ni: CARDINAL, t: REAL, printStep: BOOLEAN]; makePrintList: PROCEDURE; plotFromList: PROCEDURE[t: REAL]; makePlotList: PROCEDURE[bw: BOOLEAN]; initPlot: PROCEDURE[tMin, tMax: REAL, blank: BOOLEAN]; restoreDisplay: PROCEDURE; killPlot: PROCEDURE; printSysWindow: PROCEDURE[s: STRING]; dumpAll: PROCEDURE[t: REAL]; -- Exported by spMain advanceCursor: PROCEDURE; END. 4/19/83:- original: [Cherry]<Barth>Thyme>1.97>spExpressions.mesa changes: 1. itemType - added maximum and minimum. 2. operators - added max and min. 3. expressionNode - added codes for max and min operators.