5 function compare(_ts
, _ms
: string) : boolean;
6 procedure setvar ( vn
, vv
: string);
7 function getvar ( vn
: string) : string;
8 function parstr
: string;
9 procedure setglo ( vn
, vv
: string);
10 function getglo ( vn
: string) : string;
11 function parse ( vn
: string; al
: boolean) : string;
16 uses UStr
, Serv
, UWrd
;
45 while vrec
<> nil do begin
48 freemem(rrec
, sizeof(trec
));
61 if (i
> length(ts
)) and (j
> length(ms
)) then goto succ
;
62 if (i
> length(ts
)) or (j
> length(ms
)) then goto fail
;
63 if ts
[i
] = ms
[j
] then begin
66 if j
> length(ms
) then goto succ
;
68 if ts
[i
] = '?' then begin
72 if ts
[i
] = '*' then begin
74 if i
> length(ts
) then goto succ
;
75 z
:= copy(ts
, i
, 255);
76 if pos('*', z
) > 0 then z
:= copy(z
, 1, pos('*', z
) - 1);
77 if pos('?', z
) > 0 then z
:= copy(z
, 1, pos('?', z
) - 1);
78 if pos('%', z
) > 0 then z
:= copy(z
, 1, pos('%', z
) - 1);
79 while (j
<= length(ms
)) and (copy(ms
, j
, length(z
)) <> z
) do begin
80 while (j
< length(ms
)) and (ms
[j
] <> ts
[i
]) do inc(j
);
81 if j
> length(ms
) then goto fail
;
82 if copy(ms
, j
, length(z
)) <> z
then inc(j
);
85 if ts
[i
] = '%' then begin
88 while (i
<= length(ts
)) and (ts
[i
] <> '%') do inc(i
);
89 if i
> length(ts
) then goto fail
;
90 v
:= copy(ts
, n
, i
- n
);
94 if i
<= length(ts
) then begin
95 while (j
<= length(ms
)) and (ms
[j
] <> ts
[i
]) do inc(j
);
96 if j
> length(ms
) then goto fail
;
100 z
:= copy(ms
, n
, j
- n
);
101 if fvar
= nil then begin
102 getmem(fvar
, sizeof(trec
));
105 getmem(vrec
^.next
, sizeof(trec
));
108 fillchar(vrec
^, sizeof(trec
), #0);
111 if fglo
= nil then begin
112 getmem(fglo
, sizeof(trec
));
115 fillchar(vglo
^, sizeof(trec
), #0);
118 while (rrec
<> nil) and (rrec
^.name
<> v
) do begin
122 if rrec
= nil then begin
123 getmem(vglo
^.next
, sizeof(trec
));
126 fillchar(vglo
^, sizeof(trec
), #0);
132 if (i
> 1) and (j
> i
) then
133 if compare(ts
, copy(ms
, j
, length(ms
) - j
+ 1)) then goto succ
149 while vglo
<> Nil do begin
150 if vglo
^.name
= UpSt(vn
) then break
;
153 if vglo
= Nil then vglo
:= NewEList(fvar
, sizeof(trec
), false);
154 vglo
^.name
:= UpSt(vn
);
166 while vrec
<> nil do begin
167 if vrec
^.name
= tv
then begin
168 getvar
:= vrec
^.valu
;
178 while vglo
<> Nil do begin
179 if vglo
^.name
= UpSt(vn
) then break
;
182 if vglo
= Nil then vglo
:= NewEList(fglo
, sizeof(trec
), false);
183 vglo
^.name
:= UpSt(vn
);
195 while vglo
<> nil do begin
196 if vglo
^.name
= tv
then begin
197 getglo
:= vglo
^.valu
;
207 while vglo
<> nil do begin
210 freemem(rrec
, sizeof(trec
));
221 while vrec
<> nil do begin
222 tv
:= tv
+ ' ' + vrec
^.valu
;
238 rs
:= wordn(vn
, '%', i
+ 1);
240 s
:= s
+ wordn(vn
, '%', i
);
241 p
:= wordp(vn
, '%', i
+ 1);
243 if al
then s
:= copy(s
, 1, p
- 2);
244 if al
then s
:= s
+ space(p
- 2 - length(s
));
247 if rs
<> '' then inc(i
);
248 until i
> words(vn
, '%');