mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-21 08:09:33 +02:00
+ added example 79
This commit is contained in:
parent
e1d76d097a
commit
eca58b48ce
@ -37,7 +37,7 @@ OBJECTS=ex1 ex2 ex3 ex4 ex5 ex6 ex7 ex8 ex9 ex10 ex11 ex12 ex13 ex14 \
|
||||
ex28 ex29 ex30 ex31 ex32 ex33 ex34 ex35 ex36 ex37 ex38 ex39 ex40 \
|
||||
ex41 ex42 ex43 ex44 ex45 ex46 ex47 ex48 ex49 ex50 ex51 ex52 ex53 \
|
||||
ex54 ex55 ex56 ex57 ex58 ex59 ex60 ex61 ex62 ex63 ex64 ex65 ex66 \
|
||||
ex67 ex68 ex69 ex70 ex71 ex72 ex73 ex74 ex75 ex76 ex77 ex78
|
||||
ex67 ex68 ex69 ex70 ex71 ex72 ex73 ex74 ex75 ex76 ex77 ex78 ex79
|
||||
|
||||
TEXOBJECTS=$(addsuffix .tex, $(OBJECTS))
|
||||
|
||||
|
@ -81,3 +81,4 @@ ex75.pp contains an example of the Write(ln) function.
|
||||
ex76.pp contains an example of the FillWord function.
|
||||
ex77.pp contains an example of the Rename function.
|
||||
ex78.pp contains an example of the Power function.
|
||||
ex79.pp contains an example of the SetJmp/LongJmp functions.
|
||||
|
25
docs/refex/ex79.pp
Normal file
25
docs/refex/ex79.pp
Normal file
@ -0,0 +1,25 @@
|
||||
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.
|
Loading…
Reference in New Issue
Block a user