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.

2OOvan Wijngaarden,/et al.ALGOL <strong>68</strong> Revised Report201b)proc 9 edit string = (ref file f, string s, [ ] shame sf) void :begin bool supp, zs : = true, signput : = false, again, intj : = O, sign;proc copy = (char c) void :(- supp [ check pos (f); put char (f, c));for k to upb sfdo shame sfk = sf [ k ]; supp := supp of sfk;put insertion (f, si of sfk);to rep of sfkdo again : = true;while againdo j+: = 1; again := false;char sj = s LJ], marker = marker of sfk;if marker = "d"then copy (s j); zs : = trueelif marker= "z" then(sj = "0"1 copy ((zs I ".-"1 sj))]: sj = "+"[ again : = true] zs := false; copy (s j))elif marker = "u" v marker = "v" then(sj = " + " l sign := 1; again := truel: sj= ' .... [ sign := 2; again := true]: sj= "O" l copy ((zs l "._" l sj))t (" signputlcopy ((sign ] (marker = "u" l " + " l "._'9, "-'9);signput : = true);copy (s j); zs : = false)elif marker = "+" then(sj = "+" v sj =' .... I copy (s j)] (" signput] copy ((sign] "+", .... 9));j -: = 1)elif marker= ' .... then(sj = '%"1 copy ("._'9I: sj= ' .... I copy(sj)I (" signputl copy ((sign I ".-", .... 9));j-:= 1)elif marker = "." thencopy (".")elif marker = "e" v marker = "i"v marker = "a" v marker = "b"then copy (s j); zs : = true; signput : = falseelif marker = "r"then j -: = 1flodododend;10.3.5.2. Formatted inputa) proc getf = (ref file f, [ ] union (intype, format) x) void :if opened off thenfork to upb xdo case set read mood (f); set char mood (f); x[k]~n(format format): associate format (f, format),tintype it):begin int j : = O;picture picture, [ ] simplln y = straightin it;while (j +: = 1) _ 6 ] type of pattern - 41 10);indit string (f, s, sframes, radix);case type of pattern in /4¢ integral ¢(y[J]l¢ (ret I, int ii):incomp := - string to Lint (s, 10, ii)~] incomp := true),¢ real ¢(y[J]l(ref L real rr):incomp := - string to L real (s, rr) ~] incomp := true),¢ boolean ¢(Y [J] I(ref bool bb): bb := s = flip] incomp : = true),¢ complex ¢(y [J] I(ref L compl zz):(int i, bool bl, b2; char in string ("± ", i, s);bl := string to L real (s [ : i - 1 ], re of zz);b2 := string to L real (s [ i + 1 : ], im of zz);incomp := - (bl ^ b2))~[ incomp := true),

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

Saved successfully!

Ooh no, something went wrong!