I tried this example, but it does compile! No problem! ----- Original Message ----- From: 杨哲 To: fpc bug Sent: Saturday, May 21, 2005 4:10 AM Subject: [fpc-devel] Fwd: bug report
fpc 2.0.0 win32 problem: I can't see pi in proceudre pre but I can see it in procedure kmp. pre is a procedure belonging to kmp. I found that I could only see vars in this proceudre/function and main program, but I couldn't see vars in the procedure that this procedure belongs to. code: var t,p:string; procedure kmp(t,p:string); var n,m,q,i:integer; pi,match:array[1..255] of integer; procedure pre(p:string); var k,q:integer; begin pi[1]:=0; k:=0; for q:=2 to m do begin while (k>0) and (p[k+1]<>p[q]) do k:=pi[k]; if p[k+1]=p[q] then k:=k+1; pi[q]:=k; end; end; begin n:=length(t); m:=length(p); q:=0; pre(p); fillchar(match,sizeof(match),0); for i:=1 to n do begin while (q>0) and (p[q+1]<>t[i]) do begin match[i-q]:=q; q:=pi[q]; end; if p[q+1]=t[i] then q:=q+1; if q=m then begin match[i-q+1]:=q; q:=pi[q]; end; end; write(match[1]); for i:=2 to n do write(' ',match[i]); writeln; end; begin readln(t); readln(p); kmp(t,p); end. [EMAIL PROTECTED] 杨哲 Do You Yahoo!? 150万曲MP3疯狂搜,带您闯入音乐殿堂 美女明星应有尽有,搜遍美图、艳图和酷图 1G就是1000兆,雅虎电邮自助扩容! _______________________________________________ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel _______________________________________________ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel