Create:
PUBLIC
PROC [in, out:
STREAM,
osize: StackIndex ← 500, dsize: StackIndex ← 20, esize: StackIndex ← 250] ~ {
self: Root ~ NEW [RootRep];
self.zone ← SafeStorage.GetSystemZone[];
self.buffer ← NEW[TEXT[bufferSize]];
self.ostack ← NEW[OStackRep[osize]];
self.osize ← osize;
self.ocount ← 0;
self.dstack ← NEW[DStackRep[dsize]];
self.dsize ← dsize;
self.dcount ← 0;
self.esize ← esize;
self.ecount ← 0;
self.restore ← NEW[RestoreStackRep ← ALL[NIL]];
self.level ← 0;
self.systemdict ← DictCreate[self, systemdictSize];
self.userdict ← DictCreate[self, userdictSize];
self.errordict ← DictCreate[self, errordictSize];
self.nameDict ← DictCreate[self, nameDictSize];
self.stdin ← FileFromStream[self, in];
self.stdout ← FileFromStream[self, out];
self.stderr ← self.stdout;
Begin[self, self.systemdict];
DoInitialization[self];
Register[self, "null", null];
Register[self, "true", AnyFromBool[TRUE]];
Register[self, "false", AnyFromBool[FALSE]];
Register[self, "systemdict", AnyFromDict[self.systemdict]];
Register[self, "userdict", AnyFromDict[self.userdict]];
Register[self, "errordict", AnyFromDict[self.errordict]];
Register[self, "version", AnyFromString[StringSetAccess[
StringCreateFromText[self, "38.0"], readOnly]]];
Begin[self, self.userdict];
Register[self, "start", CvX[AnyFromString[StringCreateFromText[self,
"{prompt(%statementedit)(r)file cvx exec}loop"]]]];
Register[self, "prompt", CvX[AnyFromString[StringCreateFromText[self,
"(*)print"]]]];
Execute[self, AnyFromName[NameFromText[self, "start"]] !
CurrentFile => RESUME [FileFromStream[self, IO.noInputStream]];
Exit => RESUME;
Stop => RETRY;
Quit => CONTINUE;
];
};