-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbasic.types
1496 lines (1010 loc) · 33 KB
/
basic.types
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
% BASIC TYPES
%
% CLU Compiler Version 3: specs for basic types and type generators
%
% 3/17/93 dwc: removed stream$_reset (doesn't exist), added stream$scripts
null_ = pathname "null"
bool_ = pathname "bool"
int_ = pathname "int"
real_ = pathname "real"
char_ = pathname "char"
string_ = pathname "string"
array_ = pathname "array"
sequence_ = pathname "sequence"
record_ = pathname "record"
oneof_ = pathname "oneof"
struct_ = pathname "struct"
variant_ = pathname "variant"
proctype_ = pathname "proctype"
itertype_ = pathname "itertype"
type_ = pathname "type"
% This is a hack to force gcd_tab to be the last DU.
date_ = pathname "date"
delete_file_ = pathname "delete_file"
e_form_ = pathname "e_form"
f_form_ = pathname "f_form"
file_name_ = pathname "file_name"
file_spec_ = pathname "file_spec"
g_form_ = pathname "g_form"
istream_ = pathname "istream"
now_ = pathname "now"
pstream_ = pathname "pstream"
rename_file_ = pathname "rename_file"
set_working_dir_= pathname "set_working_dir"
stream_ = pathname "stream"
user_name_ = pathname "user_name"
working_dir_ = pathname "working_dir"
equal_set = {t | t has equal: proctype (t, t) returns (bool)}
similar_set = {t | t has similar: proctype (t, t) returns (bool)}
copy_set = {t | t has copy: proctype (t) returns (t)}
print_set = {t | t has print: proctype (t, pstream)}
encode_set = {t | t has encode: proctype (t, istream) signals (not_possible(string))}
decode_set = {t | t has decode: proctype (istream) returns (t)
signals (end_of_file, not_possible(string))}
gcd_set = {t | t has _gcd: proctype (t, gcd_tab) returns (int)}
str = string
fname = file_name
fspec = file_spec
null_ = cluster is equal, similar, copy, print, encode, decode, _gcd
rep = null
equal = proc (n1, n2: null) returns (bool)
end equal
similar = proc (n1, n2: null) returns (bool)
end similar
copy = proc (n: null) returns (null)
end copy
print = proc (n: null, pst: pstream)
end print
encode = proc (n: null, ist: istream) signals (not_possible(string))
end encode
decode = proc (ist: istream) returns (null)
signals (end_of_file, not_possible(string))
end decode
_gcd = proc (n: null, tab: gcd_tab) returns (int)
end _gcd
end null_
bool_ = cluster is and, or, not, equal, similar, copy, print,
encode, decode, _gcd
rep = bool
and = proc (b1, b2: bool) returns (bool)
end and
or = proc (b1, b2: bool) returns (bool)
end or
not = proc (b: bool) returns (bool)
end not
equal = proc (b1, b2: bool) returns (bool)
end equal
similar = proc (b1, b2: bool) returns (bool)
end similar
copy = proc (b: bool) returns (bool)
end copy
print = proc (b: bool, pst: pstream)
end print
encode = proc (b: bool, ist: istream) signals (not_possible(string))
end encode
decode = proc (ist: istream) returns (bool)
signals (end_of_file, not_possible(string))
end decode
_gcd = proc (b: bool, tab: gcd_tab) returns (int)
end _gcd
end bool_
int_ = cluster is add, sub, mul, minus, div, power, mod, abs, min, max,
from_to_by, from_to, parse, unparse, lt, le, ge, gt,
equal, similar, copy, print, encode, decode, _gcd
rep = int
add = proc (i1, i2: int) returns (int) signals (overflow)
end add
sub = proc (i1, i2: int) returns (int) signals (overflow)
end sub
mul = proc (i1, i2: int) returns (int) signals (overflow)
end mul
minus = proc (i: int) returns (int) signals (overflow)
end minus
div = proc (num, den: int) returns (int) signals (zero_divide, overflow)
end div
power = proc (i, exp: int) returns (int) signals (negative_exponent, overflow)
end power
mod = proc (i, base: int) returns (int) signals (zero_divide, overflow)
end mod
abs = proc (i: int) returns (int) signals (overflow)
end abs
min = proc (i1, i2: int) returns (int)
end min
max = proc (i1, i2: int) returns (int)
end max
from_to_by = iter (from_, to_, by_: int) yields (int)
end from_to_by
from_to = iter (from_, to_: int) yields (int)
end from_to
parse = proc (s: string) returns (int) signals (bad_format, overflow)
end parse
unparse = proc (i: int) returns (string)
end unparse
lt = proc (i1, i2: int) returns (bool)
end lt
le = proc (i1, i2: int) returns (bool)
end le
ge = proc (i1, i2: int) returns (bool)
end ge
gt = proc (i1, i2: int) returns (bool)
end gt
equal = proc (i1, i2: int) returns (bool)
end equal
similar = proc (i1, i2: int) returns (bool)
end similar
copy = proc (i: int) returns (int)
end copy
print = proc (i: int, pst: pstream)
end print
encode = proc (i: int, ist: istream) signals (not_possible(string))
end encode
decode = proc (ist: istream) returns (int)
signals (end_of_file, not_possible(string))
end decode
_gcd = proc (i: int, tab: gcd_tab) returns (int)
end _gcd
end int_
real_ = cluster is add, sub, mul, div, minus, power, abs, min, max,
i2r, r2i, trunc, parse, unparse, exponent, mantissa,
lt, le, ge, gt, equal, similar, copy, print,
encode, decode, _gcd
rep = real
add = proc (r1, r2: real) returns (real) signals (overflow, underflow)
end add
sub = proc (r1, r2: real) returns (real) signals (overflow, underflow)
end sub
mul = proc (r1, r2: real) returns (real) signals (overflow, underflow)
end mul
div = proc (r1, r2: real) returns (real) signals (zero_divide, overflow, underflow)
end div
minus = proc (r: real) returns (real)
end minus
power = proc (r1, r2: real) returns (real)
signals (zero_divide, complex_result, overflow, underflow)
end power
abs = proc (r: real) returns (real)
end abs
min = proc (r1, r2: real) returns (real)
end min
max = proc (r1, r2: real) returns (real)
end max
i2r = proc (i: int) returns (real) signals (overflow)
end i2r
r2i = proc (r: real) returns (int) signals (oveflow)
end r2i
trunc = proc (r: real) returns (int) signals (overflow)
end trunc
parse = proc (s: string) returns (real) signals (bad_format, overflow, underflow)
end parse
unparse = proc (r: real) returns (string)
end unparse
exponent = proc (r: real) returns (int) signals (undefined)
end exponent
mantissa = proc (r: real) returns (real)
end mantissa
lt = proc (r1, r2: real) returns (bool)
end lt
le = proc (r1, r2: real) returns (bool)
end le
ge = proc (r1, r2: real) returns (bool)
end ge
gt = proc (r1, r2: real) returns (bool)
end gt
equal = proc (r1, r2: real) returns (bool)
end equal
similar = proc (r1, r2: real) returns (bool)
end similar
copy = proc (r: real) returns (real)
end copy
print = proc (r: real, pst: pstream)
end print
encode = proc (r: real, ist: istream) signals (not_possible(string))
end encode
decode = proc (ist: istream) returns (real)
signals (end_of_file, not_possible(string))
end decode
_gcd = proc (r: real, tab: gcd_tab) returns (int)
end _gcd
end real_
char_ = cluster is i2c, c2i, lt, le, ge, gt, equal, similar, copy, print,
encode, decode, _gcd
rep = char
i2c = proc (i: int) returns (char) signals (illegal_char)
end i2c
c2i = proc (c: char) returns (int)
end c2i
lt = proc (c1, c2: char) returns (bool)
end lt
le = proc (c1, c2: char) returns (bool)
end le
ge = proc (c1, c2: char) returns (bool)
end ge
gt = proc (c1, c2: char) returns (bool)
end gt
equal = proc (c1, c2: char) returns (bool)
end equal
similar = proc (c1, c2: char) returns (bool)
end similar
copy = proc (c: char) returns (char)
end copy
print = proc (c: char, pst: pstream)
end print
encode = proc (c: char, ist: istream) signals (not_possible(string))
end encode
decode = proc (ist: istream) returns (char)
signals (end_of_file, not_possible(string))
end decode
_gcd = proc (c: char, tab: gcd_tab) returns (int)
end _gcd
end char_
string_ = cluster is size, indexs, indexc, c2s, concat, append, fetch,
empty, substr, rest, s2ac, ac2s, s2sc, sc2s, chars,
lt, le, ge, gt, equal, similar, copy, print,
encode, decode, _gcd
rep = string
size = proc (s: string) returns (int)
end size
indexs = proc (find, s: string) returns (int)
end indexs
indexc = proc (find: char, s: string) returns (int)
end indexc
c2s = proc (c: char) returns (string)
end c2s
concat = proc (s1, s2: string) returns (string)
end concat
append = proc (s: string, c: char) returns (string)
end append
fetch = proc (s: string, index: int) returns (char) signals (bounds)
end fetch
empty = proc (s: string) returns (bool)
end empty
substr = proc (s: string, start, length: int) returns (string)
signals (bounds, negative_size)
end substr
rest = proc (s: string, start: int) returns (string) signals (bounds)
end rest
s2ac = proc (s: string) returns (array[char])
end s2ac
ac2s = proc (a: array[char]) returns (string)
end ac2s
s2sc = proc (s: string) returns (sequence[char])
end s2sc
sc2s = proc (q: sequence[char]) returns (string)
end sc2s
chars = iter (s: string) yields (char)
end chars
lt = proc (s1, s2: string) returns (bool)
end lt
le = proc (s1, s2: string) returns (bool)
end le
ge = proc (s1, s2: string) returns (bool)
end ge
gt = proc (s1, s2: string) returns (bool)
end gt
equal = proc (s1, s2: string) returns (bool)
end equal
similar = proc (s1, s2: string) returns (bool)
end similar
copy = proc (s: string) returns (string)
end copy
print = proc (s: string, pst: pstream)
end print
encode = proc (s: string, ist: istream) signals (not_possible(string))
end encode
decode = proc (ist: istream) returns (string)
signals (end_of_file, not_possible(string))
end decode
_gcd = proc (s: string, tab: gcd_tab) returns (int)
end _gcd
end string_
array_ = cluster [t: type] is create, new, predict, cons, cons2, empty, low,
high, size, set_low, trim, fill, fill_copy,
fetch, bottom, top, store, addh, addl, remh,
reml, elements, indexes, equal, similar,
similar1, copy, copy1, print, encode, decode,
_gcd
rep = array[t]
at = array[t]
create = proc (low_: int) returns (at)
end create
new = proc () returns (at)
end new
predict = proc (low_, size_: int) returns (at)
end predict
cons = proc (q: sequence[t]) returns (at)
end cons
cons2 = proc (low_: int, q: sequence[t]) returns (at)
end cons2
empty = proc (a: at) returns (bool)
end empty
low = proc (a: at) returns (int)
end low
high = proc (a: at) returns (int)
end high
size = proc (a: at) returns (int)
end size
set_low = proc (a: at, low_: int)
end set_low
trim = proc (a: at, low_, size_: int) signals (bounds, negative_size)
end trim
fill = proc (low_, size_: int, elt: t) returns (at) signals (negative_size)
end fill
fill_copy = proc (low_, size_: int, elt: t) returns (at) signals (negative_size)
where t in copy_set
end fill_copy
fetch = proc (a: at, index: int) returns (t) signals (bounds)
end fetch
bottom = proc (a: at) returns (t) signals (bounds)
end bottom
top = proc (a: at) returns (t) signals (bounds)
end top
store = proc (a: at, index: int, elt: t) signals (bounds)
end store
addh = proc (a: at, elt: t)
end addh
addl = proc (a: at, elt: t)
end addl
remh = proc (a: at) returns (t) signals (bounds)
end remh
reml = proc (a: at) returns (t) signals (bounds)
end reml
elements = iter (a: at) yields (t)
end elements
indexes = iter (a: at) yields (int)
end indexes
equal = proc (a1, a2: at) returns (bool)
end equal
similar = proc (a1, a2: at) returns (bool) where t in similar_set
end similar
similar1 = proc (a1, a2: at) returns (bool) where t in equal_set
end similar1
copy = proc (a: at) returns (at) where t in copy_set
end copy
copy1 = proc (a: at) returns (at)
end copy1
print = proc (a: at, pst: pstream) where t in print_set
end print
encode = proc (a: at, ist: istream) signals (not_possible(string)) where t in encode_set
end encode
decode = proc (ist: istream) returns (at)
signals (end_of_file, not_possible(string))
where t in decode_set
end decode
_gcd = proc (a: at, tab: gcd_tab) returns (int) where t in gcd_set
end _gcd
end array_
sequence_ = cluster [t: type] is new, cons, e2s, size, subseq, fill,
fill_copy, fetch, bottom, top, replace,
addh, addl, remh, reml, concat, a2s, s2a,
empty, elements, indexes, equal, similar,
copy, print, encode, decode, _gcd
rep = any
seq = sequence[t]
new = proc () returns (seq)
end new
cons = proc (x: seq) returns (seq)
end cons
e2s = proc (x: t) returns (seq)
end e2s
size = proc (s: seq) returns (int)
end size
subseq = proc (s: seq, start: int, length: int) returns (seq)
signals (bounds, negative_size)
end subseq
fill = proc (length: int, x: t) returns (seq) signals (negative_size)
end fill
fill_copy = proc (length: int, x: t) returns (seq) signals (negative_size)
where t has copy: proctype (t) returns (t)
end fill_copy
fetch = proc (s: seq, i: int) returns (t) signals (bounds)
end fetch
bottom = proc (s: seq) returns (t) signals (bounds)
end bottom
top = proc (s: seq) returns (t) signals (bounds)
end top
replace = proc (s: seq, i: int, x: t) returns (seq) signals (bounds)
end replace
addh = proc (s: seq, x: t) returns (seq)
end addh
addl = proc (s: seq, x: t) returns (seq)
end addl
remh = proc (s: seq) returns (seq) signals (bounds)
end remh
reml = proc (s: seq) returns (seq) signals (bounds)
end reml
concat = proc (s1, s2: seq) returns (seq)
end concat
a2s = proc (a: array[t]) returns (seq)
end a2s
s2a = proc (s: seq) returns (array[t])
end s2a
empty = proc (s: seq) returns (bool)
end empty
elements = iter (s: seq) yields (t)
end elements
indexes = iter (s: seq) yields (int)
end indexes
equal = proc (s1, s2: seq) returns (bool)
where t has equal: proctype (t, t) returns (bool)
end equal
similar = proc (s1, s2: seq) returns (bool)
where t has similar: proctype (t, t) returns (bool)
end similar
copy = proc (s: seq) returns (seq)
where t has copy: proctype (t) returns (t)
end copy
print = proc (s: seq, pst: pstream) where t in print_set
end print
encode = proc (s: seq, ist: istream) signals (not_possible(string))
where t in encode_set
end encode
decode = proc (ist: istream) returns (seq)
signals (end_of_file, not_possible(string))
where t in decode_set
end decode
_gcd = proc (s: seq, tab: gcd_tab) returns (int) where t in gcd_set
end _gcd
end sequence_
# extend
record_ = selector [rt, tt: type] is %create, r_gets_s,
get_, set_, r_gets_r,
equal, similar, similar1,
copy, copy1, print, encode, decode,
_gcd
rep = any
% create = proc (q: sequence[...]) returns (rt) end create
get_ = proc [t: type] (r: rt) returns (t)
end get_
set_ = proc [t: type] (r: rt, elt: t)
end set_
r_gets_r = proc (r1, r2: rt)
end r_gets_r
% r_gets_s = proc (r: rt, s: struct[...]) end r_gets_s
equal = proc (r1, r2: rt) returns (bool)
end equal
similar = proc (r1, r2: rt) returns (bool) where tt in similar_set
end similar
similar1 = proc (r1, r2: rt) returns (bool) where tt in equal_set
end similar1
copy = proc (r: rt) returns (rt) where tt in copy_set
end copy
copy1 = proc (r: rt) returns (rt)
end copy1
print = proc (r: rt, pst: pstream) where tt in print_set
end print
encode = proc (r: rt, ist: istream) signals (not_possible(string))
where tt in encode_set
end encode
decode = proc (ist: istream) returns (rt)
signals (end_of_file, not_possible(string))
where tt in decode_set
end decode
_gcd = proc (r: rt, tab: gcd_tab) returns (int) where tt in gcd_set
end _gcd
end record_
oneof_ = selector [ot, tt: type] is make_, is_, value_,
% o2v, v2o,
equal, similar, copy, print,
encode, decode, _gcd
rep = any
make_ = proc [t: type] (x: t) returns (ot)
end make_
is_ = proc [t: type] (o: ot) returns (bool)
end is_
value_ = proc [t: type] (o: ot) returns (t) signals (wrong_tag)
end value_
% o2v = proc (o: ot) returns (variant[...]) end o2v
% v2o = proc (v: variant[...]) returns (ot) end v2o
equal = proc (o1, o2: ot) returns (bool) where tt in equal_set
end equal
similar = proc (o1, o2: ot) returns (bool) where tt in similar_set
end similar
copy = proc (o: ot) returns (ot) where tt has copy: proctype (tt) returns (tt)
end copy
print = proc (o: ot, pst: pstream) where tt in print_set
end print
encode = proc (o: ot, ist: istream) signals (not_possible(string))
where tt in encode_set
end encode
decode = proc (ist: istream) returns (ot)
signals (end_of_file, not_possible(string))
where tt in decode_set
end decode
_gcd = proc (o: ot, tab: gcd_tab) returns (int) where tt in gcd_set
end _gcd
end oneof_
struct_ = selector [st, tt: type] is create, get_, replace_,
% s2r, r2s,
equal, similar, copy, print,
encode, decode, _gcd
rep = any
create = proc (s: st) returns (st)
end create
get_ = proc [t: type] (s: st) returns (t)
end get_
replace_ = proc [t: type] (s: st, elt: t) returns (st)
end replace_
% s2r = proc (s: st) returns (record[...]) end s2r
% r2s = proc (r: record[...]) returns (st) end r2s
equal = proc (s1, s2: st) returns (bool) where tt in equal_set
end equal
similar = proc (s1, s2: st) returns (bool) where tt in similar_set
end similar
copy = proc (s: st) returns (st) where tt in copy_set
end copy
print = proc (s: st, pst: pstream) where tt in print_set
end print
encode = proc (s: st, ist: istream) signals (not_possible(string))
where tt in encode_set
end encode
decode = proc (ist: istream) returns (st)
signals (end_of_file, not_possible(string))
where tt in decode_set
end decode
_gcd = proc (s: st, tab: gcd_tab) returns (int) where tt in gcd_set
end _gcd
end struct_
variant_ = selector [vt, tt: type] is make_, change_, is_, value_, v_gets_v,
% v_gets_o,
equal, similar, similar1, copy, copy1,
print, encode, decode, _gcd
rep = any
make_ = proc [t: type] (x: t) returns (vt)
end make_
change_ = proc [t: type] (v: vt, x: t)
end change_
is_ = proc [t: type] (v: vt) returns (bool)
end is_
value_ = proc [t: type] (v: vt) returns (t) signals (wrong_tag)
end value_
v_gets_v = proc (v1, v2: vt)
end v_gets_v
% v_gets_o = proc (v: vt, o: oneof[...]) end v_gets_o end
equal = proc (v1, v2: vt) returns (bool)
end equal
similar = proc (v1, v2: vt) returns (bool) where tt in similar_set
end similar
similar1 = proc (v1, v2: vt) returns (bool) where tt in equal_set
end similar1
copy = proc (v: vt) returns (vt) where tt in copy_set
end copy
copy1 = proc (v: vt) returns (vt)
end copy1
print = proc (v: vt, pst: pstream) where tt in print_set
end print
encode = proc (v: vt, ist: istream) signals (not_possible(string))
where tt in encode_set
end encode
decode = proc (ist: istream) returns (vt)
signals (end_of_file, not_possible(string))
where tt in decode_set
end decode
_gcd = proc (v: vt, tab: gcd_tab) returns (int) where tt in gcd_set
end _gcd
end variant_
proctype_ = applytype [pt: type] is equal, similar, copy
rep = any
equal = proc (p1, p2: pt) returns (bool)
end equal
similar = proc (p1, p2: pt) returns (bool)
end similar
copy = proc (p: pt) returns (pt)
end copy
end proctype_
itertype_ = applytype [it: type] is equal, similar, copy
rep = any
equal = proc (p1, p2: it) returns (bool)
end equal
similar = proc (p1, p2: it) returns (bool)
end similar
copy = proc (p: it) returns (it)
end copy
end itertype_
type_ = cluster is equal, similar, copy
rep = type
equal = proc (t1, t2: type) returns (bool)
end equal
similar = proc (t1, t2: type) returns (bool)
end similar
copy = proc (t: type) returns (type)
end copy
end type_
# normal
file_name = cluster is create, parse, unparse, get_dir, get_name, get_suffix,
get_other, make_output, make_temp, print,
equal, similar, copy, encode, decode, _gcd
rep = any
create = proc (dir, name, suffix, other: string) returns (fname) signals (bad_format)
end create
parse = proc (s: string) returns (fname) signals (bad_format)
end parse
unparse = proc (f: fname) returns (string)
end unparse
get_dir = proc (x: fname) returns (string)
end get_dir
get_name = proc (x: fname) returns (string)
end get_name
get_suffix = proc (x: fname) returns (string)
end get_suffix
get_other = proc (x: fname) returns (string)
end get_other
make_output = proc (x: fname, ext: string) returns (fname)
end make_output
make_temp = proc (tdir, prog, kind: string) returns (fname)
signals (bad_format)
end make_temp
print = proc (x: fname, ps: pstream)
end print
equal = proc (x, y: fname) returns (bool)
end equal
similar = proc (x, y: fname) returns (bool)
end similar
copy = proc (x: fname) returns (fname)
end copy
encode = proc (x: fname, ist: istream) signals (not_possible(string))
end encode
decode = proc (ist: istream) returns (fname)
signals (end_of_file, not_possible(string))
end decode
_gcd = proc (x: fname, tab: gcd_tab) returns (int)
end _gcd
end file_name
file_spec = cluster is create, parse, unparse, get_dir, get_name, get_suffix,
get_other, print, equal, similar, copy, encode, decode,
_gcd
rep = any
create = proc (dir, name, suffix, other: string) returns (fspec) signals (bad_format)
end create
parse = proc (s: string) returns (fspec) signals (bad_format)
end parse
unparse = proc (f: fspec) returns (string)
end unparse
get_dir = proc (x: fspec) returns (string)
end get_dir
get_name = proc (x: fspec) returns (string)
end get_name
get_suffix = proc (x: fspec) returns (string)
end get_suffix
get_other = proc (x: fspec) returns (string)
end get_other
print = proc (x: fspec, ps: pstream)
end print