1 /* C file produced by GAC */
2 #include "compiled.h"
3 #define FILE_CRC "5799640"
4
5 /* global variables used in handlers */
6 static GVar G_runtest;
7
8 /* record names used in handlers */
9
10 /* information for the functions */
11 static Obj NameFunc[3];
12 static Obj FileName;
13
14 /* handler for function 2 */
HdlrFunc2(Obj self)15 static Obj HdlrFunc2 (
16 Obj self )
17 {
18 Obj t_1 = 0;
19 Bag oldFrame;
20
21 /* allocate new stack frame */
22 SWITCH_TO_NEW_FRAME(self,0,0,oldFrame);
23
24 /* return 1 + 2; */
25 C_SUM_INTOBJS( t_1, INTOBJ_INT(1), INTOBJ_INT(2) )
26 SWITCH_TO_OLD_FRAME(oldFrame);
27 return t_1;
28
29 /* return; */
30 SWITCH_TO_OLD_FRAME(oldFrame);
31 return 0;
32 }
33
34 /* handler for function 1 */
HdlrFunc1(Obj self)35 static Obj HdlrFunc1 (
36 Obj self )
37 {
38 Obj t_1 = 0;
39 Obj t_2 = 0;
40 Bag oldFrame;
41
42 /* allocate new stack frame */
43 SWITCH_TO_NEW_FRAME(self,0,0,oldFrame);
44
45 /* runtest := function ( )
46 return 1 + 2;
47 end; */
48 t_1 = NewFunction( NameFunc[2], 0, 0, HdlrFunc2 );
49 SET_ENVI_FUNC( t_1, STATE(CurrLVars) );
50 t_2 = NewFunctionBody();
51 SET_STARTLINE_BODY(t_2, 1);
52 SET_ENDLINE_BODY(t_2, 3);
53 SET_FILENAME_BODY(t_2, FileName);
54 SET_BODY_FUNC(t_1, t_2);
55 AssGVar( G_runtest, t_1 );
56
57 /* return; */
58 SWITCH_TO_OLD_FRAME(oldFrame);
59 return 0;
60
61 /* return; */
62 SWITCH_TO_OLD_FRAME(oldFrame);
63 return 0;
64 }
65
66 /* 'PostRestore' restore gvars, rnams, functions */
PostRestore(StructInitInfo * module)67 static Int PostRestore ( StructInitInfo * module )
68 {
69
70 /* global variables used in handlers */
71 G_runtest = GVarName( "runtest" );
72
73 /* record names used in handlers */
74
75 /* information for the functions */
76 NameFunc[1] = 0;
77 NameFunc[2] = 0;
78
79 /* return success */
80 return 0;
81
82 }
83
84
85 /* 'InitKernel' sets up data structures, fopies, copies, handlers */
InitKernel(StructInitInfo * module)86 static Int InitKernel ( StructInitInfo * module )
87 {
88
89 /* global variables used in handlers */
90
91 /* information for the functions */
92 InitGlobalBag( &FileName, "plus.g:FileName("FILE_CRC")" );
93 InitHandlerFunc( HdlrFunc1, "plus.g:HdlrFunc1("FILE_CRC")" );
94 InitGlobalBag( &(NameFunc[1]), "plus.g:NameFunc[1]("FILE_CRC")" );
95 InitHandlerFunc( HdlrFunc2, "plus.g:HdlrFunc2("FILE_CRC")" );
96 InitGlobalBag( &(NameFunc[2]), "plus.g:NameFunc[2]("FILE_CRC")" );
97
98 /* return success */
99 return 0;
100
101 }
102
103 /* 'InitLibrary' sets up gvars, rnams, functions */
InitLibrary(StructInitInfo * module)104 static Int InitLibrary ( StructInitInfo * module )
105 {
106 Obj func1;
107 Obj body1;
108
109 /* Complete Copy/Fopy registration */
110 UpdateCopyFopyInfo();
111 FileName = MakeImmString( "plus.g" );
112 PostRestore(module);
113
114 /* create all the functions defined in this module */
115 func1 = NewFunction(NameFunc[1],0,0,HdlrFunc1);
116 SET_ENVI_FUNC( func1, STATE(CurrLVars) );
117 body1 = NewFunctionBody();
118 SET_BODY_FUNC( func1, body1 );
119 CHANGED_BAG( func1 );
120 CALL_0ARGS( func1 );
121
122 /* return success */
123 return 0;
124
125 }
126
127 /* <name> returns the description of this module */
128 static StructInitInfo module = {
129 .type = MODULE_DYNAMIC,
130 .name = "plus.g",
131 .crc = 5799640,
132 .initKernel = InitKernel,
133 .initLibrary = InitLibrary,
134 .postRestore = PostRestore,
135 };
136
Init__Dynamic(void)137 StructInitInfo * Init__Dynamic ( void )
138 {
139 return &module;
140 }
141
142 /* compiled code ends here */
143