Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download

GAP 4.8.9 installation with standard packages -- copy to your CoCalc project to get it

Views: 415065
1
#ifndef AVOID_PRECOMPILED
2
/* C file produced by GAC */
3
#include "src/compiled.h"
4
5
/* global variables used in handlers */
6
static GVar G_QUO__INT;
7
static Obj GF_QUO__INT;
8
static GVar G_LEN__LIST;
9
static Obj GF_LEN__LIST;
10
static GVar G_R__N;
11
static Obj GC_R__N;
12
static GVar G_R__X;
13
static Obj GC_R__X;
14
static GVar G_R__228;
15
static Obj GC_R__228;
16
static GVar G_RANDOM__LIST;
17
static GVar G_RANDOM__SEED;
18
static Obj GF_RANDOM__SEED;
19
20
/* record names used in handlers */
21
22
/* information for the functions */
23
static Obj NameFunc[4];
24
static Obj NamsFunc[4];
25
static Int NargFunc[4];
26
static Obj DefaultName;
27
static Obj FileName;
28
29
/* handler for function 2 */
30
static Obj HdlrFunc2 (
31
Obj self,
32
Obj a_list )
33
{
34
Obj t_1 = 0;
35
Obj t_2 = 0;
36
Obj t_3 = 0;
37
Obj t_4 = 0;
38
Obj t_5 = 0;
39
Obj t_6 = 0;
40
Obj t_7 = 0;
41
Obj t_8 = 0;
42
Obj t_9 = 0;
43
Obj t_10 = 0;
44
Obj t_11 = 0;
45
Bag oldFrame;
46
OLD_BRK_CURR_STAT
47
48
/* allocate new stack frame */
49
SWITCH_TO_NEW_FRAME(self,0,0,oldFrame);
50
REM_BRK_CURR_STAT();
51
SET_BRK_CURR_STAT(0);
52
53
/* R_N := R_N mod 55 + 1; */
54
t_3 = GC_R__N;
55
CHECK_BOUND( t_3, "R_N" )
56
t_2 = MOD( t_3, INTOBJ_INT(55) );
57
C_SUM_FIA( t_1, t_2, INTOBJ_INT(1) )
58
AssGVar( G_R__N, t_1 );
59
60
/* R_X[R_N] := (R_X[R_N] + R_X[((R_N + 30) mod 55 + 1)]) mod R_228; */
61
t_1 = GC_R__X;
62
CHECK_BOUND( t_1, "R_X" )
63
t_2 = GC_R__N;
64
CHECK_BOUND( t_2, "R_N" )
65
CHECK_INT_POS( t_2 )
66
t_6 = GC_R__X;
67
CHECK_BOUND( t_6, "R_X" )
68
t_7 = GC_R__N;
69
CHECK_BOUND( t_7, "R_N" )
70
CHECK_INT_POS( t_7 )
71
C_ELM_LIST_FPL( t_5, t_6, t_7 )
72
t_7 = GC_R__X;
73
CHECK_BOUND( t_7, "R_X" )
74
t_11 = GC_R__N;
75
CHECK_BOUND( t_11, "R_N" )
76
C_SUM_FIA( t_10, t_11, INTOBJ_INT(30) )
77
t_9 = MOD( t_10, INTOBJ_INT(55) );
78
C_SUM_FIA( t_8, t_9, INTOBJ_INT(1) )
79
CHECK_INT_POS( t_8 )
80
C_ELM_LIST_FPL( t_6, t_7, t_8 )
81
C_SUM_FIA( t_4, t_5, t_6 )
82
t_5 = GC_R__228;
83
CHECK_BOUND( t_5, "R_228" )
84
t_3 = MOD( t_4, t_5 );
85
C_ASS_LIST_FPL( t_1, t_2, t_3 )
86
87
/* return list[QUO_INT( R_X[R_N] * LEN_LIST( list ), R_228 ) + 1]; */
88
t_4 = GF_QUO__INT;
89
t_7 = GC_R__X;
90
CHECK_BOUND( t_7, "R_X" )
91
t_8 = GC_R__N;
92
CHECK_BOUND( t_8, "R_N" )
93
CHECK_INT_POS( t_8 )
94
C_ELM_LIST_FPL( t_6, t_7, t_8 )
95
t_8 = GF_LEN__LIST;
96
t_7 = CALL_1ARGS( t_8, a_list );
97
CHECK_FUNC_RESULT( t_7 )
98
C_PROD_FIA( t_5, t_6, t_7 )
99
t_6 = GC_R__228;
100
CHECK_BOUND( t_6, "R_228" )
101
t_3 = CALL_2ARGS( t_4, t_5, t_6 );
102
CHECK_FUNC_RESULT( t_3 )
103
C_SUM_FIA( t_2, t_3, INTOBJ_INT(1) )
104
CHECK_INT_POS( t_2 )
105
C_ELM_LIST_FPL( t_1, a_list, t_2 )
106
RES_BRK_CURR_STAT();
107
SWITCH_TO_OLD_FRAME(oldFrame);
108
return t_1;
109
110
/* return; */
111
RES_BRK_CURR_STAT();
112
SWITCH_TO_OLD_FRAME(oldFrame);
113
return 0;
114
}
115
116
/* handler for function 3 */
117
static Obj HdlrFunc3 (
118
Obj self,
119
Obj a_n )
120
{
121
Obj l_i = 0;
122
Obj t_1 = 0;
123
Obj t_2 = 0;
124
Obj t_3 = 0;
125
Obj t_4 = 0;
126
Obj t_5 = 0;
127
Obj t_6 = 0;
128
Obj t_7 = 0;
129
Obj t_8 = 0;
130
Obj t_9 = 0;
131
Obj t_10 = 0;
132
Obj t_11 = 0;
133
Obj t_12 = 0;
134
Bag oldFrame;
135
OLD_BRK_CURR_STAT
136
137
/* allocate new stack frame */
138
SWITCH_TO_NEW_FRAME(self,0,0,oldFrame);
139
REM_BRK_CURR_STAT();
140
SET_BRK_CURR_STAT(0);
141
142
/* R_N := 1; */
143
AssGVar( G_R__N, INTOBJ_INT(1) );
144
145
/* R_X := [ n mod R_228 ]; */
146
t_1 = NEW_PLIST( T_PLIST, 1 );
147
SET_LEN_PLIST( t_1, 1 );
148
t_3 = GC_R__228;
149
CHECK_BOUND( t_3, "R_228" )
150
t_2 = MOD( a_n, t_3 );
151
SET_ELM_PLIST( t_1, 1, t_2 );
152
CHANGED_BAG( t_1 );
153
AssGVar( G_R__X, t_1 );
154
155
/* for i in [ 2 .. 55 ] do */
156
for ( t_1 = INTOBJ_INT(2);
157
((Int)t_1) <= ((Int)INTOBJ_INT(55));
158
t_1 = (Obj)(((UInt)t_1)+4) ) {
159
l_i = t_1;
160
161
/* R_X[i] := (1664525 * R_X[(i - 1)] + 1) mod R_228; */
162
t_2 = GC_R__X;
163
CHECK_BOUND( t_2, "R_X" )
164
t_7 = GC_R__X;
165
CHECK_BOUND( t_7, "R_X" )
166
C_DIFF_INTOBJS( t_8, l_i, INTOBJ_INT(1) )
167
CHECK_INT_POS( t_8 )
168
C_ELM_LIST_FPL( t_6, t_7, t_8 )
169
C_PROD_FIA( t_5, INTOBJ_INT(1664525), t_6 )
170
C_SUM_FIA( t_4, t_5, INTOBJ_INT(1) )
171
t_5 = GC_R__228;
172
CHECK_BOUND( t_5, "R_228" )
173
t_3 = MOD( t_4, t_5 );
174
C_ASS_LIST_FPL( t_2, l_i, t_3 )
175
176
}
177
/* od */
178
179
/* for i in [ 1 .. 99 ] do */
180
for ( t_1 = INTOBJ_INT(1);
181
((Int)t_1) <= ((Int)INTOBJ_INT(99));
182
t_1 = (Obj)(((UInt)t_1)+4) ) {
183
l_i = t_1;
184
185
/* R_N := R_N mod 55 + 1; */
186
t_4 = GC_R__N;
187
CHECK_BOUND( t_4, "R_N" )
188
t_3 = MOD( t_4, INTOBJ_INT(55) );
189
C_SUM_FIA( t_2, t_3, INTOBJ_INT(1) )
190
AssGVar( G_R__N, t_2 );
191
192
/* R_X[R_N] := (R_X[R_N] + R_X[((R_N + 30) mod 55 + 1)]) mod R_228; */
193
t_2 = GC_R__X;
194
CHECK_BOUND( t_2, "R_X" )
195
t_3 = GC_R__N;
196
CHECK_BOUND( t_3, "R_N" )
197
CHECK_INT_POS( t_3 )
198
t_7 = GC_R__X;
199
CHECK_BOUND( t_7, "R_X" )
200
t_8 = GC_R__N;
201
CHECK_BOUND( t_8, "R_N" )
202
CHECK_INT_POS( t_8 )
203
C_ELM_LIST_FPL( t_6, t_7, t_8 )
204
t_8 = GC_R__X;
205
CHECK_BOUND( t_8, "R_X" )
206
t_12 = GC_R__N;
207
CHECK_BOUND( t_12, "R_N" )
208
C_SUM_FIA( t_11, t_12, INTOBJ_INT(30) )
209
t_10 = MOD( t_11, INTOBJ_INT(55) );
210
C_SUM_FIA( t_9, t_10, INTOBJ_INT(1) )
211
CHECK_INT_POS( t_9 )
212
C_ELM_LIST_FPL( t_7, t_8, t_9 )
213
C_SUM_FIA( t_5, t_6, t_7 )
214
t_6 = GC_R__228;
215
CHECK_BOUND( t_6, "R_228" )
216
t_4 = MOD( t_5, t_6 );
217
C_ASS_LIST_FPL( t_2, t_3, t_4 )
218
219
}
220
/* od */
221
222
/* return; */
223
RES_BRK_CURR_STAT();
224
SWITCH_TO_OLD_FRAME(oldFrame);
225
return 0;
226
227
/* return; */
228
RES_BRK_CURR_STAT();
229
SWITCH_TO_OLD_FRAME(oldFrame);
230
return 0;
231
}
232
233
/* handler for function 1 */
234
static Obj HdlrFunc1 (
235
Obj self )
236
{
237
Obj t_1 = 0;
238
Obj t_2 = 0;
239
Obj t_3 = 0;
240
Bag oldFrame;
241
OLD_BRK_CURR_STAT
242
243
/* allocate new stack frame */
244
SWITCH_TO_NEW_FRAME(self,0,0,oldFrame);
245
REM_BRK_CURR_STAT();
246
SET_BRK_CURR_STAT(0);
247
248
/* R_N := 1; */
249
AssGVar( G_R__N, INTOBJ_INT(1) );
250
251
/* R_X := [ ]; */
252
t_1 = NEW_PLIST( T_PLIST, 0 );
253
SET_LEN_PLIST( t_1, 0 );
254
AssGVar( G_R__X, t_1 );
255
256
/* R_228 := 2 ^ 28; */
257
t_1 = POW( INTOBJ_INT(2), INTOBJ_INT(28) );
258
AssGVar( G_R__228, t_1 );
259
260
/* RANDOM_LIST := function ( list )
261
R_N := R_N mod 55 + 1;
262
R_X[R_N] := (R_X[R_N] + R_X[((R_N + 30) mod 55 + 1)]) mod R_228;
263
return list[QUO_INT( R_X[R_N] * LEN_LIST( list ), R_228 ) + 1];
264
end; */
265
t_1 = NewFunction( NameFunc[2], NargFunc[2], NamsFunc[2], HdlrFunc2 );
266
ENVI_FUNC( t_1 ) = TLS(CurrLVars);
267
t_2 = NewBag( T_BODY, NUMBER_HEADER_ITEMS_BODY*sizeof(Obj) );
268
STARTLINE_BODY(t_2) = INTOBJ_INT(23);
269
ENDLINE_BODY(t_2) = INTOBJ_INT(27);
270
FILENAME_BODY(t_2) = FileName;
271
BODY_FUNC(t_1) = t_2;
272
CHANGED_BAG( TLS(CurrLVars) );
273
AssGVar( G_RANDOM__LIST, t_1 );
274
275
/* RANDOM_SEED := function ( n )
276
local i;
277
R_N := 1;
278
R_X := [ n mod R_228 ];
279
for i in [ 2 .. 55 ] do
280
R_X[i] := (1664525 * R_X[(i - 1)] + 1) mod R_228;
281
od;
282
for i in [ 1 .. 99 ] do
283
R_N := R_N mod 55 + 1;
284
R_X[R_N] := (R_X[R_N] + R_X[((R_N + 30) mod 55 + 1)]) mod R_228;
285
od;
286
return;
287
end; */
288
t_1 = NewFunction( NameFunc[3], NargFunc[3], NamsFunc[3], HdlrFunc3 );
289
ENVI_FUNC( t_1 ) = TLS(CurrLVars);
290
t_2 = NewBag( T_BODY, NUMBER_HEADER_ITEMS_BODY*sizeof(Obj) );
291
STARTLINE_BODY(t_2) = INTOBJ_INT(29);
292
ENDLINE_BODY(t_2) = INTOBJ_INT(39);
293
FILENAME_BODY(t_2) = FileName;
294
BODY_FUNC(t_1) = t_2;
295
CHANGED_BAG( TLS(CurrLVars) );
296
AssGVar( G_RANDOM__SEED, t_1 );
297
298
/* if R_X = [ ] then */
299
t_2 = GC_R__X;
300
CHECK_BOUND( t_2, "R_X" )
301
t_3 = NEW_PLIST( T_PLIST, 0 );
302
SET_LEN_PLIST( t_3, 0 );
303
t_1 = (Obj)(UInt)(EQ( t_2, t_3 ));
304
if ( t_1 ) {
305
306
/* RANDOM_SEED( 1 ); */
307
t_1 = GF_RANDOM__SEED;
308
CALL_1ARGS( t_1, INTOBJ_INT(1) );
309
310
}
311
/* fi */
312
313
/* return; */
314
RES_BRK_CURR_STAT();
315
SWITCH_TO_OLD_FRAME(oldFrame);
316
return 0;
317
318
/* return; */
319
RES_BRK_CURR_STAT();
320
SWITCH_TO_OLD_FRAME(oldFrame);
321
return 0;
322
}
323
324
/* 'InitKernel' sets up data structures, fopies, copies, handlers */
325
static Int InitKernel ( StructInitInfo * module )
326
{
327
328
/* global variables used in handlers */
329
InitFopyGVar( "QUO_INT", &GF_QUO__INT );
330
InitFopyGVar( "LEN_LIST", &GF_LEN__LIST );
331
InitCopyGVar( "R_N", &GC_R__N );
332
InitCopyGVar( "R_X", &GC_R__X );
333
InitCopyGVar( "R_228", &GC_R__228 );
334
InitFopyGVar( "RANDOM_SEED", &GF_RANDOM__SEED );
335
336
/* information for the functions */
337
InitGlobalBag( &DefaultName, "GAPROOT/lib/random.g:DefaultName(-48550429)" );
338
InitGlobalBag( &FileName, "GAPROOT/lib/random.g:FileName(-48550429)" );
339
InitHandlerFunc( HdlrFunc1, "GAPROOT/lib/random.g:HdlrFunc1(-48550429)" );
340
InitGlobalBag( &(NameFunc[1]), "GAPROOT/lib/random.g:NameFunc[1](-48550429)" );
341
InitHandlerFunc( HdlrFunc2, "GAPROOT/lib/random.g:HdlrFunc2(-48550429)" );
342
InitGlobalBag( &(NameFunc[2]), "GAPROOT/lib/random.g:NameFunc[2](-48550429)" );
343
InitHandlerFunc( HdlrFunc3, "GAPROOT/lib/random.g:HdlrFunc3(-48550429)" );
344
InitGlobalBag( &(NameFunc[3]), "GAPROOT/lib/random.g:NameFunc[3](-48550429)" );
345
346
/* return success */
347
return 0;
348
349
}
350
351
/* 'InitLibrary' sets up gvars, rnams, functions */
352
static Int InitLibrary ( StructInitInfo * module )
353
{
354
Obj func1;
355
Obj body1;
356
357
/* Complete Copy/Fopy registration */
358
UpdateCopyFopyInfo();
359
360
/* global variables used in handlers */
361
G_QUO__INT = GVarName( "QUO_INT" );
362
G_LEN__LIST = GVarName( "LEN_LIST" );
363
G_R__N = GVarName( "R_N" );
364
G_R__X = GVarName( "R_X" );
365
G_R__228 = GVarName( "R_228" );
366
G_RANDOM__LIST = GVarName( "RANDOM_LIST" );
367
G_RANDOM__SEED = GVarName( "RANDOM_SEED" );
368
369
/* record names used in handlers */
370
371
/* information for the functions */
372
C_NEW_STRING( DefaultName, 14, "local function" );
373
C_NEW_STRING( FileName, 20, "GAPROOT/lib/random.g" );
374
NameFunc[1] = DefaultName;
375
NamsFunc[1] = 0;
376
NargFunc[1] = 0;
377
NameFunc[2] = DefaultName;
378
NamsFunc[2] = 0;
379
NargFunc[2] = 1;
380
NameFunc[3] = DefaultName;
381
NamsFunc[3] = 0;
382
NargFunc[3] = 1;
383
384
/* create all the functions defined in this module */
385
func1 = NewFunction(NameFunc[1],NargFunc[1],NamsFunc[1],HdlrFunc1);
386
ENVI_FUNC( func1 ) = TLS(CurrLVars);
387
CHANGED_BAG( TLS(CurrLVars) );
388
body1 = NewBag( T_BODY, NUMBER_HEADER_ITEMS_BODY*sizeof(Obj));
389
BODY_FUNC( func1 ) = body1;
390
CHANGED_BAG( func1 );
391
CALL_0ARGS( func1 );
392
393
/* return success */
394
return 0;
395
396
}
397
398
/* 'PostRestore' restore gvars, rnams, functions */
399
static Int PostRestore ( StructInitInfo * module )
400
{
401
402
/* global variables used in handlers */
403
G_QUO__INT = GVarName( "QUO_INT" );
404
G_LEN__LIST = GVarName( "LEN_LIST" );
405
G_R__N = GVarName( "R_N" );
406
G_R__X = GVarName( "R_X" );
407
G_R__228 = GVarName( "R_228" );
408
G_RANDOM__LIST = GVarName( "RANDOM_LIST" );
409
G_RANDOM__SEED = GVarName( "RANDOM_SEED" );
410
411
/* record names used in handlers */
412
413
/* information for the functions */
414
NameFunc[1] = DefaultName;
415
NamsFunc[1] = 0;
416
NargFunc[1] = 0;
417
NameFunc[2] = DefaultName;
418
NamsFunc[2] = 0;
419
NargFunc[2] = 1;
420
NameFunc[3] = DefaultName;
421
NamsFunc[3] = 0;
422
NargFunc[3] = 1;
423
424
/* return success */
425
return 0;
426
427
}
428
429
430
/* <name> returns the description of this module */
431
static StructInitInfo module = {
432
/* type = */ 2,
433
/* name = */ "GAPROOT/lib/random.g",
434
/* revision_c = */ 0,
435
/* revision_h = */ 0,
436
/* version = */ 0,
437
/* crc = */ -48550429,
438
/* initKernel = */ InitKernel,
439
/* initLibrary = */ InitLibrary,
440
/* checkInit = */ 0,
441
/* preSave = */ 0,
442
/* postSave = */ 0,
443
/* postRestore = */ PostRestore
444
};
445
446
StructInitInfo * Init__random ( void )
447
{
448
return &module;
449
}
450
451
/* compiled code ends here */
452
#endif
453
454