-- JaMVM.mesa
-- Last edit by Bill Paxton, 30-Jan-82  8:43:16

DIRECTORY
  JaMBasic USING [DictBody, Object, Root, StringLength, Tuple, TuplePtr];

JaMVM: DEFINITIONS = {
OPEN JaMBasic;

-- Virtual memory access

AllocString: PROC[length: StringLength] RETURNS[string Object];
AllocArray: PROC[length: CARDINAL] RETURNS[array Object];
AllocDict: PROC[size: CARDINAL] RETURNS[dict Object];

GetRoot: PROC[root: LONG POINTER TO Root];
PutRoot: PROC[root: LONG POINTER TO Root];

GetDict: PROC[dict: dict Object]
  RETURNS[DictBody] = INLINE { RETURN[dict.dict↑] };
PutDict: PROC[dict: dict Object,
  dd: DictBody] = INLINE { dict.dict↑ ← dd };

GetTuple: PROC[slot: TuplePtr]
  RETURNS[Tuple] = INLINE { RETURN[slot↑] };
PutTuple: PROC[slot: TuplePtr,
  tuple: Tuple] = INLINE { slot↑ ← tuple };

GetElem: PROC[array: array Object, i: CARDINAL]
  RETURNS[Object] = INLINE { RETURN[array.base[i]] };
PutElem: PROC[array: array Object, i: CARDINAL,
  object: Object] = INLINE { array.base[i] ← object };

GetChar: PROC[string: string Object, i: CARDINAL]
  RETURNS[CHARACTER] = INLINE { RETURN[string.text[i+string.offset]] };
PutChar: PROC[string: string Object, i: CARDINAL,
  char: CHARACTER] = INLINE { string.text[i+string.offset] ← char };

CopyArray: PROC[src,dst: array Object];
-- copies MIN[src.length,dst.length] objects

CopyString: PROC[src,dst: string Object];
-- copies MIN[src.length,dst.length] characters

GetText: PROC[string: string Object, text: LONG STRING];
PutText: PROC[string: string Object, text: LONG STRING];
-- these transfer MIN[string.length,text.maxlength] characters

Start: PROC;

}.