1: program errs(input,output,junk,locked);
   2: 
   3: label   99;
   4: 
   5: type
   6: etype = (ECHR, EHALT, ENILPTR, ECASE, EOUTOFMEM, ECTSNG,
   7: ESTLIM, EARGV, EPACK, EUNPACK, EASRT, ELLIMIT, ETRASHHEAP, EPASTEOF,
   8: EREFINAF, ENOFILE, ENAMESIZE, EBADINUM, EBADFNUM, ENUMNTFD, ENAMRNG,
   9: EFMTSIZE, ESEEK, ECREATE, EREMOVE, EOPEN, EREADIT, EWRITEIT, ESQRT,
  10: ELN, ERANGE, ESUBSC, EGOTO, ECLOSE, EWRITE, ECTLWR, ECTUPR, xxx);
  11: biggie = array[1..15000] of integer;
  12: 
  13: var
  14: ch :char;
  15: chs :alfa;
  16: ch1 :array[1..10] of char;
  17: ptr, ptr1 :^char;
  18: ptr2 :^biggie;
  19: junk, locked, other :file of char;
  20: variant :record
  21:     case boolean of
  22:     true:(val :1..100);
  23:     false:(name :etype)
  24:     end;
  25: s :set of 1..4;
  26: i :integer;
  27: r :real;
  28: err :etype;
  29: 
  30: begin
  31: writeln('Want a list of error names?');
  32: readln(ch);
  33: if ch = 'y' then begin
  34:     for err:=ECHR to pred(xxx) do begin
  35:         write(err:15);
  36:         if ord(err) mod 5 = 4 then
  37:             writeln;
  38:         end;
  39:     writeln;
  40:     end;
  41: writeln('enter an error name');
  42: readln(err);
  43: if err in [ESEEK, EGOTO, ECLOSE, EWRITE] then begin
  44:     writeln(err, ': error cannot be simulated');
  45:     goto 99;
  46:     end;
  47: case err of
  48: ECHR: ch:=chr(128);
  49: EHALT: halt;
  50: ENILPTR: ch:=ptr^;
  51: ECASE: case 4 of 1:; end;
  52: EOUTOFMEM: while true do begin
  53:         new(ptr2);
  54:         writeln('alloc successful');
  55:         end;
  56: ECTLWR: begin
  57:     i:=0;
  58:     s:=[i..2];
  59:     end;
  60: ECTUPR: begin
  61:     i:=5;
  62:     s:=[1..i];
  63:     end;
  64: ECTSNG: begin
  65:     i:=0;
  66:     s:=[i];
  67:     end;
  68: ESTLIM: stlimit(0);
  69: EARGV: argv(100,chs);
  70: EPACK: pack(ch1,2,chs);
  71: EUNPACK: unpack(chs,ch1,2);
  72: EASRT: assert(false);
  73: ELLIMIT: begin
  74:      linelimit(output,1);
  75:      writeln('This only should print');
  76:      writeln;
  77:      writeln('ERROR');
  78:      end;
  79: ETRASHHEAP: begin
  80:         new(ptr);
  81:         ptr1:=ptr;
  82:         dispose(ptr1);
  83:         dispose(ptr);
  84:         end;
  85: EPASTEOF: begin
  86:       rewrite(junk);
  87:       reset(junk);
  88:       get(junk);
  89:       get(junk);
  90:       write(junk^);
  91:       end;
  92: EREFINAF: ch:=junk^;
  93: ENOFILE: ch:=other^;
  94: ENAMESIZE: rewrite(junk,
  95: 'thisisaverylongandconvolutedfilenamewhichexceedsalllimitsofreasonablenessandgoodtaste');
  96: EBADINUM: begin
  97:       writeln('Enter a letter');
  98:       read(i);
  99:       end;
 100: EBADFNUM: begin
 101:       writeln('Enter a letter');
 102:       read(r);
 103:       end;
 104: ENUMNTFD: begin
 105:       writeln('Enter your name');
 106:       read(err);
 107:       end;
 108: ENAMRNG:  begin
 109:       variant.val:=100;
 110:       writeln(variant.name);
 111:       end;
 112: EFMTSIZE: begin
 113:       i:=-1;
 114:       writeln(1.0:i);
 115:       end;
 116: ECREATE: rewrite(locked);
 117: EREMOVE: remove('none');
 118: EOPEN: reset(locked);
 119: EREADIT: read(output,ch);
 120: EWRITEIT: write(input,ch);
 121: ESQRT: r:=sqrt(-1.0);
 122: ELN: r:=ln(0);
 123: ERANGE: ch:=succ(chr(127));
 124: ESUBSC: ch:=ch1[127 + 1];
 125: end;
 126: writeln('*** ERROR NOT DETECTED ***');
 127: 99:end.
Last modified: 1984-04-01
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 1432
Valid CSS Valid XHTML 1.0 Strict