mirror of
				https://gitlab.com/freepascal.org/fpc/source.git
				synced 2025-11-04 01:19:38 +01:00 
			
		
		
		
	
		
			
				
	
	
		
			26 lines
		
	
	
		
			458 B
		
	
	
	
		
			ObjectPascal
		
	
	
	
	
	
			
		
		
	
	
			26 lines
		
	
	
		
			458 B
		
	
	
	
		
			ObjectPascal
		
	
	
	
	
	
program example79;
 | 
						|
 | 
						|
{ Program to demonstrate the setjmp, longjmp functions }
 | 
						|
 | 
						|
procedure dojmp(var env : jmp_buf; value : longint);
 | 
						|
 | 
						|
begin
 | 
						|
  value:=2;
 | 
						|
  Writeln ('Going to jump !');
 | 
						|
  { This will return to the setjmp call, 
 | 
						|
    and return value instead of 0 }
 | 
						|
  longjmp(env,value);
 | 
						|
end;
 | 
						|
 | 
						|
var env : jmp_buf;
 | 
						|
 | 
						|
begin
 | 
						|
  if setjmp(env)=0 then
 | 
						|
    begin
 | 
						|
    writeln ('Passed first time.');
 | 
						|
    dojmp(env,2);
 | 
						|
    end
 | 
						|
  else
 | 
						|
    writeln ('Passed second time.');
 | 
						|
end.
 |