Andrew Gregory wrote:
I am porting some complex mathematical Pascal code to GPC. In certain places in the middle of procedures at the nth level there are things like
if (X<-1) then begin writeln('Error X<1'); halt end;
Since I'm aiming to produce a DLL (main function in C), if X<1 I need to leave the Pascal routine immediately and return an integer failure code to my C program. How can I replace the halt statement by a jump to an exit point, with a stack clean-up?
In Pascal you can just do a nonlocal goto, i.e., set a label in the containing global routine (in your case, probably near its end, so you return to the caller), and you can `goto' it from any local routine.
Frank