MicroOps.mesa
Copyright © 1985 by Xerox Corporation. All rights reserved.
Willie-sue, March 10, 1986 12:57:10 pm PST
DIRECTORY
BasicTime USING [GMT],
CommandTool USING [ArgumentVector],
IO,
Rope,
MicroDefs
USING [
ArgRef, EvalMode, Memory, OutputFile, SrcFile, SymbolObj, SymbolType, WordSeq];
MicroOps:
CEDAR
DEFINITIONS
= BEGIN
STREAM: TYPE = IO.STREAM;
ROPE: TYPE = Rope.ROPE;
SymbolObj: TYPE = MicroDefs.SymbolObj;
Memory: TYPE = MicroDefs.Memory;
WordSeq: TYPE = MicroDefs.WordSeq;
From MicroInputImpl
InitIn: PROC;
InPush: PROC[srcFile: MicroDefs.SrcFile] RETURNS[fileOK: BOOL];
InPop: PROC RETURNS[stackEmpty: BOOL];
InitReadStmt: PROC[convertToUpper: BOOL];
ReadStmt:
PROC
RETURNS[stmtOK:
BOOL];
reads next statement into buffer
PrintStatement:
PROC[out:
STREAM];
writes current statement in buffer to strm
ExpandNameWithExt: PROC[fileName, ext: ROPE] RETURNS[fullName: ROPE];
GetStmtChar: PROC[offset: NAT] RETURNS[ch: CHAR];
PutStmtChar:
PROC[offset:
NAT, ch:
CHAR];
puts a character into the statement buffer at position offset
GetStmtInteger:
PROC[offset:
NAT]
RETURNS[val:
INTEGER];
gets an integer from the statement buffer at position offset
PutStmtInteger:
PROC[offset:
NAT, val:
INTEGER];
puts an integer into the statement buffer at position offset
GetStmtValue:
PROC[offset:
NAT]
RETURNS[val:
WORD];
gets a word from the statement buffer at position offset
PutStmtValue:
PROC[offset:
NAT, val:
WORD];
puts a word into the statement buffer at position offset
PushStmtChar:
PROC[ch:
CHAR]
RETURNS[pushOK:
BOOL];
pushes a character onto the statement buffer and increments the top pointer
PushStmtInteger:
PROC[val:
INTEGER]
RETURNS[pushOK:
BOOL];
pushes an integer onto the statement buffer and increments the top pointer
PushStmtValue:
PROC[val:
WORD]
RETURNS[pushOK:
BOOL];
pushes an word onto the statement buffer and increments the top pointer
MoveValueInStmtBuffer:
PROC[to, from:
NAT];
moves the value at from to to in the statement buffer
LookupBufferSymbol: PROC[offset: NAT, len: INTEGER]
RETURNS[symIndex: INTEGER, symb: ATOM];
From MicroOutputImpl
ListingReport: PROC[msg1, msg2: ROPE ← NIL];
WriteFixup: PROC[memIndex, loc, feIndex, symIndex: INTEGER];
WriteWord: PROC[accWord: WordSeq, mem: Memory, loc: INTEGER];
WriteSymName: PROC[symIndex: INTEGER];
WriteMemoryDef: PROC[mem: Memory];
EndListing: PROC[xListFlag: BOOL];
EndOutput: PROC[symDumpStartIndex: INTEGER];
From MicroSymbolsImpl
InitSymbolTable: PROC;
LookupSymbol:
PROC[ePtr:
LONG
POINTER
TO
WORD, len:
INTEGER]
RETURNS[symIndex: INTEGER, symb: ATOM];
returns symIndex=0 if not found
PutInSymbol:
PROC[symb:
ATOM, type: MicroDefs.SymbolType]
RETURNS[symIndex: INTEGER, sObj: MicroDefs.SymbolObj];
GetSymbol:
PROC[symIndex:
INTEGER]
RETURNS[symObj: MicroDefs.SymbolObj];
returns NIL if symIndex does not define a valid symbol
NewDef:
PROC[symIndex:
INTEGER]
RETURNS[newObj: MicroDefs.SymbolObj];
If symIndex is new, do nothing; if symIndex is old, make a new symbol for its name and returns the new symbol
RecoverSymbols: PROC[fromFile: ROPE, recoverOld: BOOL ← FALSE] RETURNS[success: BOOL];
DumpSymbols:
PROC[toFileRec: MicroDefs.OutputFile]
RETURNS[success: BOOL, oldLastStIndexPlus1: INTEGER];
FilterSyms:
PROC[typ: MicroDefs.SymbolType, startIndex:
INTEGER ← -1]
RETURNS[lSyms: LIST OF MicroDefs.SymbolObj];
From MicroInitImpl
InitMicroVars:
PROC[cmdLine, wDir:
ROPE, argv: CommandTool.ArgumentVector]
RETURNS[srcFileList: MicroDefs.SrcFile, ok: BOOL, start: BasicTime.GMT];
InPushFile: PROC[fileName: ROPE] RETURNS[fullName: ROPE, fileOK: BOOL];
From MicroAccumulateImpl
InitAcc: PROC;
Assemble: PROC;
SetField:
PROC[symIndex:
INTEGER, val:
WORD, set:
BOOL];
Store val into field with name GetSymbol[symIndex].name
GetField: PROC[symIndex: INTEGER] RETURNS[WORD];
TargetSet: PROC[symIndex: INTEGER];
LabelDefn: PROC[symIndex: INTEGER, symb: ATOM];
UndefnRef:
PROC[feIndex:
INTEGER, symIndex:
INTEGER];
Write undefined reference
IsFieldSet:
PROC[symIndex:
INTEGER]
RETURNS[
BOOL];
Test if field has been set
StoreBuiltin: PROC[symIndex: INTEGER, aPtr: LONG POINTER TO WORD, lx: INTEGER];
DefaultBuiltin: PROC[symIndex: INTEGER, aPtr: LONG POINTER TO WORD, lx: INTEGER];
SetListFieldsBuiltin:
PROC[
symIndex: INTEGER, aPtr: LONG POINTER TO WORD, lx: INTEGER];
GetBits: PROC[acw: WordSeq, firstBitNum, numBits: INTEGER] RETURNS[WORD];
SetBits: PROC[acw: WordSeq, firstBitNum, numBits: INTEGER, val: WORD];
From MicroProcessImpl
ProcessOneClause: PROC[mode: MicroDefs.EvalMode];
ProcessStmt:
PROC[sPtr:
LONG POINTER TO WORD, lx:
INTEGER, mode: MicroDefs.EvalMode]
RETURNS[typ: MicroDefs.SymbolType, val: WORD];
EvalArg:
PROC[argP:
LONG POINTER TO WORD, lx:
INTEGER]
RETURNS[val:
WORD];
Evaluate argument
ExpandLength:
PROC[aPtr:
LONG POINTER TO WORD, lx:
INTEGER]
RETURNS[len:
INTEGER];
Returns the length of an expanded block, or -1 if no encoded data
Expand:
PROC[argRef: MicroDefs.ArgRef]
RETURNS[didExpansion:
BOOL];
Expand a block possibly containing encoded data; uses argRef for the result
Returns TRUE iff expansion actually occurred
From MicroMacroOpsImpl
InitMacroOps: PROC;
ArgString: PROC[nChars: INTEGER] RETURNS[LONG POINTER TO WORD];
CollectArgs: PROC RETURNS[nArgs: INT];
MacroCall: PROC[symIndex: INTEGER, nArgs: INTEGER];
MacroDefn:
PROC[argP:
LONG POINTER TO WORD, lx:
INTEGER]
RETURNS[macroDefnIndex: INT];
MacroDefnFromIndex:
PROC[macroDefnIndex:
INT]
RETURNS[macroDefn: LONG POINTER TO WORD];
From MicroBuiltInsImpl
GetMemory:
PROC[symIndex:
INTEGER]
RETURNS[mem: Memory];
index may be positive or negative
AddressTagDefn:
PROC[symIndex:
INTEGER, mem: Memory, val:
INTEGER]
RETURNS[symbolIndex: INTEGER];
Defines an address tag
DoBuiltIn:
PROC[
symIndex: INTEGER, nArgs: INTEGER, argPtr: LONG POINTER TO WORD];
Do builtin
DoField:
PROC[
symIndex: INTEGER, aPtr: LONG POINTER TO WORD, len: INTEGER, set: BOOL];
"assign" and "preassign" builtin
From MicroListingImpl
ReportError: PROC[msg: ROPE, abort: BOOL];
ListWord:
PROC[
acw: WordSeq, listBuf: WordSeq, mem: Memory,
location: INTEGER, options: WORD];