Text preview for : Version.mesa_Oct77.pdf part of xerox Version.mesa Oct77 xerox mesa 3.0_1977 listing Version.mesa_Oct77.pdf



Back to : Version.mesa_Oct77.pdf | Home

Version.mesa 25-0CT-77 16:23:13 Page 1


-- Version.Mesa Edited by Wick on October 8, 1977 6:48 PM
DIRECTORY
AltoFileDefs: FROM "altofiledefs",
BcdDefs: FROM "bcddefs",
DirectoryDefs: FROM "directorydefs",
ImageDefs: FROM "imagedefs",
IODefs: FROM "iodefs",
SegmentDefs: FROM "segmentdefs",
StreamDefs: FROM "streamdefs",
StringDefs: FROM "StringDefs",
TimeDefs: FROM "timedefs";
DEFINITIONS FROM 10Defs, StreamDefs, StringDefs;
Version: PROGRAM
IMPORTS DireetoryDefs, IODefs, SegmentDefs, StreamDefs, StringDefs, TimeDefs
SHARES ImageDefs =
BEGIN
FP: TYPE = AltoFileDefs.FP;
BcdBase: TYPE = POINTER TO BcdDefs.BCD;
UnpackedTime: TYPE = TimeDefs.UnpaekedTime;

BinaryVersion: PROCEDURE [info: POINTER TO FileInfo]
BEGIN OPEN SegmentDefs;
bed: BedBase;
seg: FileSegmentHandle ..
NewFileSegment[lnsertFile[@info.fp.Read],l,l,Read]:
Swapln[seg]; bed" FileSegmentAddress[seg]:
SELECT bcd.versionident FROM
BedDefs.VersionID =>
BEGIN
PrintVersion[bed.version]:
WriteChar[CR];
IF info.ty,e=objeet AND verbose THEN
BEGIN
IF bcd.nPages > 1 THEN
BEGIN
Unloek[seg]:
MoveFileSegment[seg,l,bcd.nPages]:
SwapIn[seg]:
bed" FileSegmentAddress[seg]:
END:
, PrintFileVersions[bed]:
END;
END:
ImageDefs.VerSionID =>
BEGIN
PrintVersion[bcd.version];
Wr iteChar[CR]:
END;
ENDCASE =>
BEGIN
WriteString[" bad version 10 "]:
WriteDeeimal[bed.versionident];
WriteChar[CR];
END:
Unloek[seg];
DeleteFileSegment[seg];
RETURN
END;
SoureeOate: PROC[OURE [info: POINT[R TO FileInfo]
BEGIN
date: TimeDefs,UnpaekedTime .. [O.O.O.O.O.O.FALSE];
index: CAROINAL[O .. 12);
stream: StreamHandle;
token: STRING .. [40];
found: BOOlFAN;
stream .. CreateRyLeStream[
SegmentOefs.Insertrile[@info.fp.Read].Read];
UNTIL Getlndex[stream].page # 0 00
rNARLf Streamfrror =) [XIT;
N I t e111 [ 5 l ream. to ken] ;
ext
Version.mesa 25-0CT-77 15:23:13 Page 2


[found,index] ~ IsMonth[token];
IF found THEN
BEGIN
NextItem[stream,token];
IF IsNumber[token] THEN
BEGIN
date.month ~ index:
date.day ~ StringToDecimal[token];
NextItem[stream,token];
IF IsNumber[token] THEN
date.year ~ StringToDecimal[token]:
NextItem[stream,token];
IF IsNumber[token] THEN
BEGIN
date.hour ~ StringToDecimal[token]:
NextItem[stream,token]:
IF IsNumber[token] THEN
date.minute ~ StringToDecimal[token];
NextItem[stream,token];
IF EquivalentString[token,"PM"]
AND date.hour < 12 THEN
date. hour ~ date.hour+12:
END:
WriteChar[' ]; PrintDate[date];
WriteChar[CR]: EXIT:
END:
END;
ENDLOOP;
stream.destroy[stream];
RETURN
END;
Months: ARRAY [0 .. 12) OF STRING = [
"January","February","March","April","May","June","July",
"August","September","October","November","December"];
IsMonth: PROCEDURE [candidate: STRING] RETURNS [BOOL~AN,CARDINAL] =
BEGIN
i: CARDINAL[O .. 12);
FOR i IN [0 .. 12) DO
IF EquivalentString[candidate,Months[i]] THEN RETURN[TRUE,i]:
ENDLOOP:
RETURN[FALSE,O]
END:
IsNumber: PROCEDURE [s: STRING] RETURNS [BOOLEAN] =
BEGIN
i: CARDINAL:
FOR i IN [O .. s.length) DO
SELECT s[i] FROM
IN ['0 .. '9] =) NULL:
ENOCASE =) RETURN[FALSE]:
ENDLOOP:
RETURN[TRUE]
END;
NextItem: PROCEDURE [stream: StreamHandle, token: STRING]
BEGIN
c: CHARACTER;
token. length ~ 0;
WHILE -stream.endof[stream] DO
e ~ stream.get[stream];
SELECT e FROM
IN ['a .. 'z], IN ['A .. 'Z], IN ['0 .. '9] =) AppendChar[token,e];
ENDCAS[ =) IF token. length # a TIIEN EXIT;
ENDLOOP;
RETURN
END;
PrinlFileVersions: PROCEDURE [bed: BcdRase]
BEGIN opeN RedDefs;
line: STRING ~ [40];
filename: SubStringDescriptor;
fti: FTlndex;
flb: CARDINAl'; IOOPIIOlr[bed+bcd.ftOffset];
stb: STRING = IOOPIIOLf[bcd+bed.ssOffset];
Version.mesa 26-0CT-77 16:23:13 Page 3


FOR Fti ~ FIRST[FTIndex]. fti+SIZE[FTRecord]
UNTIL fti