Debian Codegraph @

demo/dynfunc.rexx

raw
1 #!/usr/bin/env regina
2 /*
3 * Test program for Regina 08e
4 *
5 * This program demonstrates the loading of two dynamic/shared
6 * libraries of external functions.
7 *
8 * Assumes that the dynamic/shared libraries have been built
9 * and are in the current directory or in a directory specified
10 * by the environment variable appropriate to the Operating System
11 * eg. LD_LIBRARY_PATH under Unix, LIBPATH under OS/2.
12 *
13 * There is one external function in each of the dynamic libraries.
14 * All this function does is displays each of the parameters passed
15 * to it, plus the name of the dynamic library.
16 */
17 Trace o
18 Parse Source platform .
19
20 Call Rxfuncadd 'Test1LoadFuncs','rxtest1','Test1LoadFuncs'
21 Call Rxfuncadd 'Test2LoadFuncs','rxtest2','Test2LoadFuncs'
22
23 /*
24 * Set the arguments for each function
25 */
26 parm1 = 'Param1'
27 parm2 = 'Param2'
28
29 If Test1LoadFuncs() \= 0 Then Abort("Calling Test1LoadFuncs")
30 If Test2LoadFuncs() \= 0 Then Abort("Calling Test2LoadFuncs")
31
32 If Test1Function1('Test1Function1',parm1) \= 0 Then
33 Abort("Calling Test1Function1")
34 /*
35 * Test for set variables...
36 */
37 If test1function1.0 \= 2 Then
38 Abort("Stem index: test1function1.0 not set correctly")
39 If test1function1.1 \= 'Test1Function1' Then
40 Abort("Stem value: test1function1.1 not set correctly")
41 If test1function1.2 \= parm1 Then
42 Abort("Stem value: test1function1.2 not set correctly")
43
44 If Test2Function1('Test2Function1',parm1) \= 0 Then
45 Abort("Calling Test2Function1")
46 /*
47 * Test for set variables...
48 */
49 If test2function1.0 \= 2 Then
50 Abort("Stem index: test2function1.0 not set correctly")
51 If test2function1.1 \= 'Test2Function1' Then
52 Abort("Stem value: test2function1.1 not set correctly")
53 If test2function1.2 \= parm1 Then
54 Abort("Stem value: test2function1.2 not set correctly")
55
56 If Test1Function2('Test1Function2',parm1,parm2) \= 0 Then
57 Abort("Calling Test1Function2")
58 /*
59 * Test for set variables...
60 */
61 If test1function2.0 \= 3 Then
62 Abort("Stem index: test1function2.0 not set correctly")
63 If test1function2.1 \= 'Test1Function2' Then
64 Abort("Stem value: test1function2.1 not set correctly")
65 If test1function2.2 \= parm1 Then
66 Abort("Stem value: test1function2.2 not set correctly")
67 If test1function2.3 \= parm2 Then
68 Abort("Stem value: test1function2.3 not set correctly")
69
70 If Test2Function2('Test2Function2',parm1,parm2) \= 0 Then
71 Abort("Calling Test2Function2")
72 /*
73 * Test for set variables...
74 */
75 If test2function2.0 \= 3 Then
76 Abort("Stem index: test2function2.0 not set correctly")
77 If test2function2.1 \= 'Test2Function2' Then
78 Abort("Stem value: test2function2.1 not set correctly")
79 If test2function2.2 \= parm1 Then
80 Abort("Stem value: test2function2.2 not set correctly")
81 If test2function2.3 \= parm2 Then
82 Abort("Stem value: test2function2.3 not set correctly")
83
84 return 0
85
86 Abort: Procedure
87 Parse Arg mesg
88 Say "Error trapped:" mesg
89 Exit 1