[fpc-devel] runtime error 216 on nested procedures

Dariusz Mazur darekm at emadar.com
Mon May 4 20:48:45 CEST 2009


Hi
 I have problem with this small program below.  I've compiled if on 
Linux/i386 FPC 2.2.2
Every time of run program halt with runtime. I've test it with short and 
ansistring. Result the same.
But when I uncomment line with test2 everything goes OK.
Is something wrong with program? Can someone test it on newer version FPC?


program testwhile;

{$mode objfpc}{$H+}



 
function lineHtml( sa : string):string;
var
  xPoz : integer;
  xp,xk  : integer;

  function nextToken(var aPocz: integer;var aKon :integer):string;

  begin
    result:='';
    aPocz:=xPoz+1;
    aKon:=0;
    try
      while xpoz< length(sa) do begin
        inc(xpoz);
        case sa[xpoz] of

         '|' :begin
                 exit;
             end;
        else

        end;
        result:=result+sa[xpoz];
        inc(aKon);

      end;
    finally
      writeln('test ',result);
      aKon:=aPocz+aKon;
//    writeln('test2 ',result);
    end;
  end;


begin
   xpoz:=0;
   result:='';
   repeat
      nextToken(xp,xk);
   until xpoz>=length(sa);
end;


begin
   writeln(lineHTML('|  1 | 2 | 3'));
end.
 

-- 
  Darek







More information about the fpc-devel mailing list