File information: | |
File name: | BcdAllocator.mesa_Oct77.pdf [preview BcdAllocator.mesa Oct77] |
Size: | 206 kB |
Extension: | |
Mfg: | xerox |
Model: | BcdAllocator.mesa Oct77 🔎 |
Original: | BcdAllocator.mesa Oct77 🔎 |
Descr: | xerox mesa 3.0_1977 listing BcdAllocator.mesa_Oct77.pdf |
Group: | Electronics > Other |
Uploaded: | 07-03-2020 |
User: | Anonymous |
Multipart: | No multipart |
Information about the files in archive: | ||
Decompress result: | OK | |
Extracted files: | 1 | |
File name BcdAllocator.mesa_Oct77.pdf bcdallOCATOR.mESA 24-0CT-77 21:15:31 Page 1 -- BcdAllocator.Mesa Edited by Sandman on August 23. 1977 10:36 PM DIRECTORY InlineDefs: FROM "inlinedefs". SystemDefs: FROM "systemdeFs". BcdTableDefs: FROM "bcdtabledefs"; DEFINITIONS FROM BcdTableDefs; BcdAllocator: PROGRAM IMPORTS SystemDefs EXPORTS BcdTableDefs SHARES BcdTableDefs = BEGIN tbasp.: ARRAY TableSelector OF TableBase; limit: ARRAY TableSelector OF [O .. TableLimit]; top, oldTop: ARRAY TableSelector OF CARDINAL; tableOpen: BOOLEAN ~ FALSE: tableOrigin: CARDINAL: tableLimit: [0 .. TableLimit]; TableOverflow: PUBLIC SIGNAL RETURNS [origin, limit: CARDINAL] CODE: TableFailure: PUBLIC ERROR [TableSelector] = CODE: StackAllocateError: PUBLIC SIGNAL [TableSelector] = CODE; -- stack allocation from subzones Allocate: PUBLIC PROCEDURE [table: TableSelector. size: CARDINAL] RETURNS [TableIndex] BEGIN index: CARDINAL = top[table]: newtop: CARDINAL = index + size; IF newtop <= limit[table] THEN top[table] ~ newtop ELSE IF newtop < TableLimit THEN BEGIN top[table] ~ newtop: Repack[] END ELSE ERROR TableFailure[table]: RETURN [LOOPHOLE[index, TableIndex]] END: ResetTable: PUBLIC PROCEDURE [table: TableSelector] BEGIN top[table] ~ oldTop[table] ~ 0: RETURN END; TableBounds: PUBLIC PROCEDURE [table: TableSelector] RETURNS [base: TableBase, size: CARDINAL] BEGIN RETURN [tbase[table]. top[table]] END: Repack: PROCEDURE = BEGIN -- Garwick's Repacking algorithm (Knuth, Vol. 1. p. 245) i: CARDINAL; j. k. m: [FIRST[TableSelector] .. LAST[TableSelector]+1]: nTables: CARDINAL = (LAST[TableSeleclor]-FIRST[TableSelector]+1); sum. inc. delta. remainder: INTEGER; d: ARRAY TableSelector OF INTEGER: newBase: ARRAY TableSelector OF TableBase: sb. db: POINTER; newOrigin. newLimit: CARDINAL; sum ~ tableLimit: inc ~ 0; rOR j TN TableSelector DO sum ~ sum - top[j]; inc ~ inc + (d[j] .. rr top[j]>oldTop[j] THEN top[j]-oldTop[j] fL.SE 0); rNDIOOP; UNTIL sum )= MIN[lableLimit/ZO. 100B] DO [origin:newOrigin., limit:newLimiL]" SIGNAL TableOverflow; bcdallOCATOR.mESA 24-0CT-77 21:15:31 Page 2 fOR j IN TableSelector DO tbase(j] ~ tbase(j] + (newOrigin-tableOrigin); ENDLOOP; sum ~ sum + (newLimit-tableLimit); tableOrigin ~ newOrigin; tableLimit ~ newLimit; ENDLOOP; delta ~ sum/(10*nTables); remainder ~ sum ~ delta*nTables; newBase(FIRST(TableSelector]] ~ tbase(FIRST(TableSelector]]: FOR j IN (FIRST(TableSelector] .. LAST[TableSelector]] DO newBase[j] ~ newBase[j-l] + top[j-l] + delta + InlineOefs.LongDiv[ num: Inl ineDefs.LongMult[d[j-l]. remainder]. den:inc]; ENDLOOP; j ~ FIRST[TableSelector]+l; UNTIL j > |
Date | User | Rating | Comment |