|
DataMuseum.dkPresents historical artifacts from the history of: RC4000/8000/9000 |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about RC4000/8000/9000 Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - download
Length: 3840 (0xf00) Types: TextFile Names: »testoutput«
└─⟦a41ae585a⟧ Bits:30001842 SW-save af projekt 1000, Alarm-system └─⟦72244f0ef⟧ └─⟦this⟧ »testoutput«
process testoutput (var insem, opsem: semaphore); (*The process spools output sent to >insem< and outputs it to >opsem<, presumable the operator, on request herefrom, i.e. answer to a read*) var full : semaphore; inp, outp: shadow; process input (var insem, full: semaphore); const n = 25 (*No of lines spooled*); type char4 = array (1..4) of char; shortline = record first, last, next: integer; userstuff: array (6..35) of char; spooler_mark: char4; newline: char end; var p: pool n of shortline; free: semaphore; refi, refo: reference; j, curr_mark: integer:= 0; function mark: char4; var i: 1..4; no: integer; begin no:= curr_mark; for i:= 4 downto 1 do begin mark(i):= chr (no mod 10 + ord ('0')); no:= no div 10 end; curr_mark:= succ (curr_mark) mod 10000 end (*mark*); \f begin while openpool (p) do begin alloc (refo, p, free); return (refo) end; repeat wait (refi, insem); if open (free) then sensesem (refo, free) else wait (refo, full); lock refi as i: shortline do lock refo as o: shortline do with o do begin o:= i; for j:= last to 35 do userstuff(j):= ' '; last:= 35+4+1; newline:= chr (10); spooler_mark:= mark end; return (refi); signal (refo, full) until false end (*input*); \f process output (var outsem, full: semaphore); type shortline = record first, last, next: integer; info: array (6..35+4+1) of char end; buffertype = record info: shortline; filler: array (35+4+1+1..97) of char end; var copy, ref: reference; answer, att: semaphore; buf: pool 1+2 of buffertype; i: integer; begin alloc (ref, buf, att); ref^.u1:= 1 (*read*); lock ref as b: buffertype do with b, info do begin first:= 6+alfalength; last:= 97; info:= 'testoutput' end; signal (ref, outsem); while openpool (buf) do begin alloc (ref, buf, answer); ref^.u1:= 2 (*write*); return (ref) end; repeat i:= 7 (* 7 * 3 < 22 lines/screen *); wait (ref, att); signal (ref, outsem); while open (full) and (i <> 0) do begin i:= pred (i); wait (copy, full); wait (ref, answer); lock ref as r: buffertype do lock copy as c: shortline do r.info:= c; return (copy); signal (ref, outsem) end until false end (*output*); \f begin case create ('spooler inp', input (insem, full), inp, 300) of 0: end; case create ('spooler outp', output (opsem, full), outp, 300) of 0: end; start (inp, stdpriority); start (outp, stdpriority) end (*spooler*). ▶EOF◀