TypeScript.mesa; Edited by Paxton on January 4, 1983 2:31 pm
Last Edited by: Maxwell, January 5, 1983 9:57 am
Last Edited by: Teitelman, January 10, 1983 1:09 pm
DIRECTORY
Rope USING [ROPE],
ViewerClasses USING [Viewer, ViewerRec],
ViewerOps USING [DestroyViewer];
TypeScript: CEDAR DEFINITIONS IMPORTS ViewerOps = BEGIN
TS: TYPE = ViewerClasses.Viewer;
Creating and destroying typescripts
Create: PROC [info: ViewerClasses.ViewerRec, paint: BOOL ← TRUE] RETURNS [ts: TS] ;
IsATypeScript:
PROC [ts:
TS]
RETURNS [yes:
BOOL] =
INLINE {
RETURN [ts # NIL AND ts.class.flavor = $Typescript] };
Destroy:
PROC [ts:
TS] =
INLINE {ViewerOps.DestroyViewer[ts]};
Destroys typescript viewer and related data structures
Reset:
PROC [ts:
TS] =
INLINE {ts.class.init[ts]};
Erases all the typescript text data and clears the screen.
Output to typescript
PutChar: PROC [ts: TS, char: CHAR] ;
PutRope: PROC [ts: TS, rope: Rope.ROPE] ;
PutText:
PROC [ts:
TS, text:
REF
READONLY
TEXT, start:
INTEGER ← 0,
stopPlusOne: INTEGER ← LAST[INTEGER]];
BackSpace:
PROC [ts:
TS, count:
INT ← 1];
Delete character(s) from end of ts.
ChangeLooks:
PROC [ts:
TS, look:
CHAR];
look char in 'a..'z means add that look
in 'A..'Z means remove
blank means remove all looks
GetLooks:
PROC [ts:
TS]
RETURNS [looks: Rope.
ROPE];
Following echoed chars will not have any looks.'
Input from typescript
GetChar: PROC [ts: TS] RETURNS [char: CHARACTER] ;
CharsAvailable:
PROC [ts:
TS]
RETURNS [
BOOLEAN] ;
RETURNS TRUE if no chars waiting.
Simulate user typein to a typescript
TypeIn:
PROC [ts:
TS, input:
REF
ANY] =
INLINE
{ts.class.notify[ts, LIST[input]]} ;
can be REF CHARACTER, ROPE, REF TEXT, or ATOM (be careful).
InsertRopeAtFrontOfBuffer:
PROC [ts:
TS, rope: Rope.
ROPE]
;
This will be the next thing read, even if there are characters waiting in the input buffer.
InsertCharAtFrontOfBuffer: PROC [ts: TS, char: CHARACTER];
Synchronization
Flush:
PROC [ts:
TS];
This won't return until echo buffer has been emptied and all chars inserted in ts. (done automatically by BackSpace, AddLooks, and ClearLooks)'
WaitUntilIdle:
PROC [ts:
TS];
This won't return until input buffer has been emptied and input process is waiting in GetChar for more characters.
WaitUntilCharsAvail:
PROC [ts:
TS];
This won't return until a character is available to GetChar.
Errors
Destroyed: ERROR [ts: TS];
END.