10.07.2015 Views

Algol 68 - ACM Digital Library

Algol 68 - ACM Digital Library

Algol 68 - ACM Digital Library

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

206 van Wijngaa~den. et al.10.3.6.1. Binary outputa) procputbin=(reffllef, [ ] outtypeot)void:if opened off thenset bin mood (f); set write mood (f);for k to upb otdo [ ] simplout y = straightoul ot [ k ];for j to upb ydo [ ] char bin = to bin (f, y [j]);for i to upb bindo next pos (f);set bin mood (f);refpos cpos = cpos off, lpos = lpos of book off;case text of fin(flextext t2):t2 [p of cpos ] [ l of cpos ] [ c of cpos ] := bin [i]esac;c of cpos+:= 1;if cpos beyond lpos then lpos : = cposslit - set possible (f)^ pos (p of lpos, I of lpos, 1) beyond cposthen lpos := cpos;(compressible (f) lc the size of the line and page containing thelogical end of the book and of allsubsequent lines and pages may beincreased c)flodododelse undefinedfl;10.3.6.2. Binary inputa) proc get bin = (ref file f, [ ] intype it) void :if opened off thenset bin mood (f); set read mood (f);for k to upb itdo [ ] simplin y=streightin it [k ];for j to upb ydoslmplout yj = case y [j ] in~(refL intO: i~, ~(refL realr): r~,~ (ref L compl z): z~ , (ref bool b): b,~(ref L bits lb): lb~ , (ref char c): c, (ref [ ] chars): s,(ref slring ss): ss esac;ALGOL <strong>68</strong> Revised Report[1 : upb (to bin (f, yj)) ] char bin;for i to upb bindo next pos (f); set bin mood (f);retpos cpos = cpos off;bin [i] :=case text of f ln(flextext t2):t2 [p of cpos ] [ l of cpos ] [ c of cpos ]esac;c ofcpos +: = 1od;case y [j ] In+ (ref L int ii): (~m ~in (f, ii, bin) l (L IntO: ,~. = i) ~ ,(ref L real rr):(from bin (f, rr, bin) ] (L real r): rr : = r) ~ ,(ref L compl zz):(from bin (f, zz, bin) l (L compl z): zz : = z) ~ ,(refbool bb): (from bin (f, bb, bin) l (bool b): bb := b) ,~ (ref L bits lb):(from bin (f, lb, bin) l (L bits b): lb := b)~,(ref cher cc): (from/bin (f, cc, bin)[ (char c): cc := c) ,(ref [ ] char ss)i= "(from bin (f, ss, bin) l ([ ] chars): ss := s) ,(ref string ssss):(from bin (f, ssss, bin) l ([ ] chars): ssss := s)esacI"ododelse undefinedfl;[But Eeyore wasn't listening. He was takingthe balloon out, and putting it back again,as happy as could be ....Winnie-the-Pooh,A.A.Milne.}}

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!