annotate TL1/test/t4.tl1 @ 180:c3145f913f3d default tip

possible features
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Sat, 04 May 2019 11:17:42 +0900
parents 4d83154d2a78
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
175
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1 % ** TEST PROGRAM **
176
6ef317714ae8 mopen in TL/1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 175
diff changeset
2 FUNC SEARCH
6ef317714ae8 mopen in TL/1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 175
diff changeset
3 %--- MAIN ---
178
4d83154d2a78 add - {} some builtin in TL/1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 177
diff changeset
4 VAR DICT,BUF
176
6ef317714ae8 mopen in TL/1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 175
diff changeset
5 ARRAY TEND[2]
6ef317714ae8 mopen in TL/1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 175
diff changeset
6 BEGIN
180
c3145f913f3d possible features
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 178
diff changeset
7 DICT := OPENM((INT($2,0))
176
6ef317714ae8 mopen in TL/1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 175
diff changeset
8 WRITE(DICT:ASCII(0))
178
4d83154d2a78 add - {} some builtin in TL/1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 177
diff changeset
9 WRITE(DICT:ASCII(30),ASCII(-'P'),"ROC")
4d83154d2a78 add - {} some builtin in TL/1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 177
diff changeset
10 WRITE(DICT:ASCII(31),ASCII(-'F'),"UNC")
4d83154d2a78 add - {} some builtin in TL/1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 177
diff changeset
11 WRITE(DICT:ASCII(33),ASCII(-'V'),"AR",CRLF)
180
c3145f913f3d possible features
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 178
diff changeset
12 TEND := POSITION(DICT)
c3145f913f3d possible features
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 178
diff changeset
13 BUF := OPENM(INT($2,0))
176
6ef317714ae8 mopen in TL/1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 175
diff changeset
14 WRITE(BUF:"FUNC",ASCII(0))
6ef317714ae8 mopen in TL/1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 175
diff changeset
15 WRITE(0:SEARCH(BUF),CRLF)
180
c3145f913f3d possible features
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 178
diff changeset
16 SEEK(BUF,INT(0))
176
6ef317714ae8 mopen in TL/1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 175
diff changeset
17 WRITE(BUF:"NONAME",ASCII(0))
6ef317714ae8 mopen in TL/1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 175
diff changeset
18 WRITE(0:SEARCH(BUF),CRLF)
6ef317714ae8 mopen in TL/1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 175
diff changeset
19 END
175
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
20
176
6ef317714ae8 mopen in TL/1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 175
diff changeset
21 SEARCH(BUF)
178
4d83154d2a78 add - {} some builtin in TL/1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 177
diff changeset
22 VAR VAL,K,C
176
6ef317714ae8 mopen in TL/1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 175
diff changeset
23 ARRAY BEND
6ef317714ae8 mopen in TL/1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 175
diff changeset
24 BEGIN
6ef317714ae8 mopen in TL/1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 175
diff changeset
25 VAL := SEEK(DICT,TEND)
180
c3145f913f3d possible features
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 178
diff changeset
26 BEND:=POSITION(BUF)
176
6ef317714ae8 mopen in TL/1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 175
diff changeset
27 WHILE VAL#0 DO [
178
4d83154d2a78 add - {} some builtin in TL/1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 177
diff changeset
28 C:=SEEKR(BUF,-1)
4d83154d2a78 add - {} some builtin in TL/1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 177
diff changeset
29 K:=SEEKR(DICT,-1)
176
6ef317714ae8 mopen in TL/1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 175
diff changeset
30 IF K.LT.0 THEN [
178
4d83154d2a78 add - {} some builtin in TL/1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 177
diff changeset
31 IF C=-K THEN
176
6ef317714ae8 mopen in TL/1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 175
diff changeset
32 RETURN VAL % FOUND
178
4d83154d2a78 add - {} some builtin in TL/1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 177
diff changeset
33 VAL := SEEKR(DICT,-1)
176
6ef317714ae8 mopen in TL/1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 175
diff changeset
34 ] ELSE IF C#K THEN [
178
4d83154d2a78 add - {} some builtin in TL/1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 177
diff changeset
35 SEEK(BUF,BEND)
176
6ef317714ae8 mopen in TL/1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 175
diff changeset
36 REPEAT
178
4d83154d2a78 add - {} some builtin in TL/1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 177
diff changeset
37 K:=SEEKR(DICT,-1)
176
6ef317714ae8 mopen in TL/1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 175
diff changeset
38 UNTIL K.LT.0
178
4d83154d2a78 add - {} some builtin in TL/1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 177
diff changeset
39 VAL := SEEKR(DICT,-1)
175
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
40 ]
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
41 ]
176
6ef317714ae8 mopen in TL/1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 175
diff changeset
42 RETURN VAL % NOT FOUND
6ef317714ae8 mopen in TL/1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 175
diff changeset
43 END