Browse Source

+ Added example 83 for assigned function

michael 27 years ago
parent
commit
314127b513
3 changed files with 33 additions and 1 deletions
  1. 1 1
      docs/refex/Makefile
  2. 1 0
      docs/refex/README
  3. 31 0
      docs/refex/ex83.pp

+ 1 - 1
docs/refex/Makefile

@@ -38,7 +38,7 @@ OBJECTS=ex1 ex2 ex3 ex4 ex5 ex6 ex7 ex8 ex9 ex10 ex11 ex12 ex13 ex14 \
         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 ex79 \
-	ex80 ex81 ex82
+	ex80 ex81 ex82 ex83
 
 TEXOBJECTS=$(addsuffix .tex, $(OBJECTS))
 

+ 1 - 0
docs/refex/README

@@ -85,3 +85,4 @@ ex79.pp contains an example of the SetJmp/LongJmp functions.
 ex80.pp contains an example of the High/Low functions.
 ex81.pp contains an example of the HexStr function.
 ex82.pp contains an example of the BinStr function.
+ex83.pp contains an example of the Assigned function.

+ 31 - 0
docs/refex/ex83.pp

@@ -0,0 +1,31 @@
+Program example83;
+
+{ Program to demonstrate the Assigned function }
+
+Procedure DoSomething;
+
+begin
+  Writeln ('Hello from doseomething!')
+end;
+
+Type 
+    TProcType = Procedure;
+
+Var P : Pointer;
+    Procvar : TProcType;
+    
+begin
+  P:=Nil;
+  If not Assigned(P) then 
+    Writeln('P is nil');
+  Getmem(P,1000);
+  If Assigned(P) Then 
+    writeln ('P Points in the heap.');
+  FreeMem(P,1000);
+  procvar:=@DoSomething;
+  If Assigned(ProcVar) then 
+    Writeln ('Procvar is non-nil');
+  procvar:=TProcType(Nil);
+  If Not Assigned(Procvar) then
+    Writeln ('Procvar is nil');
+end.