Text preview for : DisplayControl.mesa_Oct77.pdf part of xerox DisplayControl.mesa Oct77 xerox mesa 3.0_1977 listing DisplayControl.mesa_Oct77.pdf
Back to : DisplayControl.mesa_Oct77 | Home
DisplayControl.mesa 25-0CT-77 15:01:02 Page 1
-- file DisplayControl.Mesa
-- last edited by Johnsson, October 14, 1977 2:57 PM
DIRECTORY
AltoFileDefs: FROM "AltoFileDefs",
ControlOefs: FROM "ControlDefs",
OirectoryOefs: FROM "OirectoryOefs",
OisplayOefs: FROM "OisplayOefs",
FontOefs: FROM "FontDefs",
ImageOefs: FROM "ImageOefs",
SegmentDefs: FROM "SegmentOefs",
StreamOefs: FROM "StreamDefs",
StringOefs: FROM "StringDefs",
SystemOisplay: FROM "SystemOisplay";
OisplayControl: PROGRAM
IMPORTS OirectoryOefs. DisplayOefs, FontDefs. ImageDefs. SegmentDefs. StreamDefs. StringDefs. SystemD
**isplay =
BEGIN
mesafont: short ImageOefs.FileRequest ~ [
link: NIL. file:. access: SegmentOefs.Read.
body: Short[fill:.name: "MesaFont.al."]];
sysfont: short ImageOefs.FileRequest ~ [
link: @mesafont. file:. access: SegmentDefs.Read,
body: short[fill:.name: "SysFont.al."]];
typescript: short ImageDefs.FileRequest ~ [
link: @Sysfont. file:.
access: SegmentDefs.Read+SegmentDefs.Write+SegmentOefs.Append.
body: short[fill:.name: "Mesa.Typescript."]];
font: FontOefs.FontHandle;
fontseg: SegmentDefs.FileSegmentHandle;
initialize: BOOLEAN ~ TRUE;
imaging: BOOLEAN;
cleanupitem: ImageDefs.CleanupItem ~ [
link:. proc: Cleanup]:
Cleanup: ImageDefs.CleanupProcedure
BEGIN
file: SegmentDefs.FileHandle;
i: CARDINAL;
si: StreamDefs.StreamIndex:
ts: StreamDefs.StreamHandle;
SELECT why FROM
Finish. Abort. Save =>
BEGIN
IF -initialize AND SystemDisplay.typescript # NIL THEN
BEGIN
StreamDefs.TruncateDiskStream[SystemDisplay.typescript]:
SystemDisplay.typescript ~ NIL;
END;
IF why = Save AND -initialize THEN
BEGIN
DisplayDefs.DisplayOff[black]:
font.destroy[font);
SegmentDefs.DeleteFileSegment[fontseg]:
END:
If. why # Save TIIEN RETURN:
imaging ~ (REGISTER[ControlDefs.SDreg]+ControlDefs.sAddFileRequest)t # 0:
mesafont.file ~ NIL;
IF imaging TH[N ImageDefs.AddFileRequest[@~esafont];
sysfont.file ~ NIL;
If Imaging THEN ImageDefs.AddFileRequest[@sysfont];
typescript.file ~ NIL;
IF imaging THfN ImageOefs.AddfileRequest[@typescript];
END;
Restore =)
BrGIN OPEN SegmentDefs;
If (file~mesafont.file) = NIL TIIEN file ~ sysfonl.file
ELSE ReleaseFile[sysfont.file);
fonLreg ~ NewFileSegment[file.DefaultBase,DefaultPages,Read];
font ~ FontDefs.Createfont[fontseg];
DisplnyControl.mesa 25-0CT-77 15:01:02 Page 2
IF initialize THEN
BEGIN initialize ~ FALSE; DisplayDefs.InitDisplay(72,30,20,font] END
ELSE
BEGIN SystemDisplay.SetFont[font]; DisplayDefs.DisplayOn[] END;
IF (file~typescript.file) = NIL THEN
file ~ NewFile[typescript.name, Read+Write+Append, DefaultVersion];
SystemDisplay.SetTypeScript[
StreamDefs.CreateByteStream[file, Read+Write+Append]]:
END;
InLd =)
IF SystemDisplay.typescript # NIL THEN
StreamDefs.OpenDiskStream[SystemOisplay.typescript];
OutLd =)
BEGIN OPEN StreamDefs;
IF (ts~SystemDisplay.typescript) = NIL THEN RETURN;
si ~ Getlndex[ts];
ts.put[ts,15C];
FOR i IN [0 .. 9) DO ts.put(ts, '-] ENDLOOP:
SetIndex[ts, Si];
CloseOiskStream(ts];
END;
ENDCASE;
END;
-- file requests
ProcessFileRequests: PROCEDURE [rHead: POINTER TO ImageDefs.FileRequest] =
BEGIN OPEN AltoFileDefs;
checkone: PROCEDURE (fp: POINTER TO FP, dname: STRING] RETURNS [BOOLEAN] =
BEGIN
ss: StringDefs.SubStringDescriptor ~ (dname,O,dname.length]:
r: POINTER TO ImageOefs.FileRequest;
prev: POINTER TO ImageDefs.FileRequest ~ NIL;
FOR r ~ rHead, r.link UNTIL r = NIL DO
IF (WITH r SELECT FROM
long =) StringDefs.EquivalentSubStrings(@ss,@name],
short =) StringDefs.EquivalentString[dname,name],
ENDCASE =) FALSE) THEN
BEGIN
IF r.file = NIL THEN r.file ~ SegmentDefs.InsertFile(fp,r.access]
ELSE r.file.fp ~ fpt;
IF prev = NIL THEN rHead ~ r. link
ELSE prevo link ~ r.1ink;
END
ELSE prev ~ r;
ENDLOOP;
RETURN(rHead = NIL]
END;
DirectoryDefs.EnumerateDirectory[checkone];
END;
ImageDefs.AddCleanupProcedure[@cleanupitem];
C1 eanup[Save];
IF imaging THEN STOP ELSE ProcessFileRequests[@typescript];
Cleanup[Restore];
END ...