Mercurial > hg > Members > kono > os9 > sbc09
comparison TL1/test/t4.tl1 @ 175:c83545730d6c
openm
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Sun, 14 Apr 2019 17:17:34 +0900 |
parents | |
children | 6ef317714ae8 |
comparison
equal
deleted
inserted
replaced
174:ce695e5e38d8 | 175:c83545730d6c |
---|---|
1 % ** TEST PROGRAM ** | |
2 func search | |
3 %--- main --- | |
4 var dict,buf | |
5 array tend[2] | |
6 begin | |
7 dict := openm($2,0) | |
8 write(dict:ascii(0)) | |
9 write(dict:ascii(30),ascii(-'P'),"ROC") | |
10 write(dict:ascii(31),ascii(-'F'),"UNC") | |
11 write(dict:ascii(33),ascii(-'V'),"AR") | |
12 postion(dict,tend) | |
13 buf := openm($2,0) | |
14 write(buf:"FUNC",ascii(0)) | |
15 write(0:search(buf),crlf) | |
16 seek(buf,0) | |
17 write(buf:"NONAME",ascii(0)) | |
18 write(0:search(buf),crlf) | |
19 end | |
20 | |
21 search(buf) | |
22 var val,k,c | |
23 array bend | |
24 begin | |
25 val := seek(dict,tend) | |
26 position(buf,bend) | |
27 while val#0 do [ | |
28 c:=seekr(buf,-1) | |
29 k:=seekr(dict,-1) | |
30 if k.lt.0 then [ | |
31 if c=-k then | |
32 return val % found | |
33 val := seekr(dict,-1) | |
34 ] else if c#k then [ | |
35 seek(buf,bend) | |
36 repeat | |
37 k:=seekr(dict,-1) | |
38 until k.lt.0 | |
39 val := seekr(dict,-1) | |
40 ] | |
41 ] | |
42 return val % not found | |
43 end |