Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
| Download
GAP 4.8.9 installation with standard packages -- copy to your CoCalc project to get it
Project: cocalc-sagemath-dev-slelievre
Views: 418346#ifndef AVOID_PRECOMPILED1/* C file produced by GAC */2#include "src/compiled.h"34/* global variables used in handlers */5static GVar G_QUO__INT;6static Obj GF_QUO__INT;7static GVar G_LEN__LIST;8static Obj GF_LEN__LIST;9static GVar G_R__N;10static Obj GC_R__N;11static GVar G_R__X;12static Obj GC_R__X;13static GVar G_R__228;14static Obj GC_R__228;15static GVar G_RANDOM__LIST;16static GVar G_RANDOM__SEED;17static Obj GF_RANDOM__SEED;1819/* record names used in handlers */2021/* information for the functions */22static Obj NameFunc[4];23static Obj NamsFunc[4];24static Int NargFunc[4];25static Obj DefaultName;26static Obj FileName;2728/* handler for function 2 */29static Obj HdlrFunc2 (30Obj self,31Obj a_list )32{33Obj t_1 = 0;34Obj t_2 = 0;35Obj t_3 = 0;36Obj t_4 = 0;37Obj t_5 = 0;38Obj t_6 = 0;39Obj t_7 = 0;40Obj t_8 = 0;41Obj t_9 = 0;42Obj t_10 = 0;43Obj t_11 = 0;44Bag oldFrame;45OLD_BRK_CURR_STAT4647/* allocate new stack frame */48SWITCH_TO_NEW_FRAME(self,0,0,oldFrame);49REM_BRK_CURR_STAT();50SET_BRK_CURR_STAT(0);5152/* R_N := R_N mod 55 + 1; */53t_3 = GC_R__N;54CHECK_BOUND( t_3, "R_N" )55t_2 = MOD( t_3, INTOBJ_INT(55) );56C_SUM_FIA( t_1, t_2, INTOBJ_INT(1) )57AssGVar( G_R__N, t_1 );5859/* R_X[R_N] := (R_X[R_N] + R_X[((R_N + 30) mod 55 + 1)]) mod R_228; */60t_1 = GC_R__X;61CHECK_BOUND( t_1, "R_X" )62t_2 = GC_R__N;63CHECK_BOUND( t_2, "R_N" )64CHECK_INT_POS( t_2 )65t_6 = GC_R__X;66CHECK_BOUND( t_6, "R_X" )67t_7 = GC_R__N;68CHECK_BOUND( t_7, "R_N" )69CHECK_INT_POS( t_7 )70C_ELM_LIST_FPL( t_5, t_6, t_7 )71t_7 = GC_R__X;72CHECK_BOUND( t_7, "R_X" )73t_11 = GC_R__N;74CHECK_BOUND( t_11, "R_N" )75C_SUM_FIA( t_10, t_11, INTOBJ_INT(30) )76t_9 = MOD( t_10, INTOBJ_INT(55) );77C_SUM_FIA( t_8, t_9, INTOBJ_INT(1) )78CHECK_INT_POS( t_8 )79C_ELM_LIST_FPL( t_6, t_7, t_8 )80C_SUM_FIA( t_4, t_5, t_6 )81t_5 = GC_R__228;82CHECK_BOUND( t_5, "R_228" )83t_3 = MOD( t_4, t_5 );84C_ASS_LIST_FPL( t_1, t_2, t_3 )8586/* return list[QUO_INT( R_X[R_N] * LEN_LIST( list ), R_228 ) + 1]; */87t_4 = GF_QUO__INT;88t_7 = GC_R__X;89CHECK_BOUND( t_7, "R_X" )90t_8 = GC_R__N;91CHECK_BOUND( t_8, "R_N" )92CHECK_INT_POS( t_8 )93C_ELM_LIST_FPL( t_6, t_7, t_8 )94t_8 = GF_LEN__LIST;95t_7 = CALL_1ARGS( t_8, a_list );96CHECK_FUNC_RESULT( t_7 )97C_PROD_FIA( t_5, t_6, t_7 )98t_6 = GC_R__228;99CHECK_BOUND( t_6, "R_228" )100t_3 = CALL_2ARGS( t_4, t_5, t_6 );101CHECK_FUNC_RESULT( t_3 )102C_SUM_FIA( t_2, t_3, INTOBJ_INT(1) )103CHECK_INT_POS( t_2 )104C_ELM_LIST_FPL( t_1, a_list, t_2 )105RES_BRK_CURR_STAT();106SWITCH_TO_OLD_FRAME(oldFrame);107return t_1;108109/* return; */110RES_BRK_CURR_STAT();111SWITCH_TO_OLD_FRAME(oldFrame);112return 0;113}114115/* handler for function 3 */116static Obj HdlrFunc3 (117Obj self,118Obj a_n )119{120Obj l_i = 0;121Obj t_1 = 0;122Obj t_2 = 0;123Obj t_3 = 0;124Obj t_4 = 0;125Obj t_5 = 0;126Obj t_6 = 0;127Obj t_7 = 0;128Obj t_8 = 0;129Obj t_9 = 0;130Obj t_10 = 0;131Obj t_11 = 0;132Obj t_12 = 0;133Bag oldFrame;134OLD_BRK_CURR_STAT135136/* allocate new stack frame */137SWITCH_TO_NEW_FRAME(self,0,0,oldFrame);138REM_BRK_CURR_STAT();139SET_BRK_CURR_STAT(0);140141/* R_N := 1; */142AssGVar( G_R__N, INTOBJ_INT(1) );143144/* R_X := [ n mod R_228 ]; */145t_1 = NEW_PLIST( T_PLIST, 1 );146SET_LEN_PLIST( t_1, 1 );147t_3 = GC_R__228;148CHECK_BOUND( t_3, "R_228" )149t_2 = MOD( a_n, t_3 );150SET_ELM_PLIST( t_1, 1, t_2 );151CHANGED_BAG( t_1 );152AssGVar( G_R__X, t_1 );153154/* for i in [ 2 .. 55 ] do */155for ( t_1 = INTOBJ_INT(2);156((Int)t_1) <= ((Int)INTOBJ_INT(55));157t_1 = (Obj)(((UInt)t_1)+4) ) {158l_i = t_1;159160/* R_X[i] := (1664525 * R_X[(i - 1)] + 1) mod R_228; */161t_2 = GC_R__X;162CHECK_BOUND( t_2, "R_X" )163t_7 = GC_R__X;164CHECK_BOUND( t_7, "R_X" )165C_DIFF_INTOBJS( t_8, l_i, INTOBJ_INT(1) )166CHECK_INT_POS( t_8 )167C_ELM_LIST_FPL( t_6, t_7, t_8 )168C_PROD_FIA( t_5, INTOBJ_INT(1664525), t_6 )169C_SUM_FIA( t_4, t_5, INTOBJ_INT(1) )170t_5 = GC_R__228;171CHECK_BOUND( t_5, "R_228" )172t_3 = MOD( t_4, t_5 );173C_ASS_LIST_FPL( t_2, l_i, t_3 )174175}176/* od */177178/* for i in [ 1 .. 99 ] do */179for ( t_1 = INTOBJ_INT(1);180((Int)t_1) <= ((Int)INTOBJ_INT(99));181t_1 = (Obj)(((UInt)t_1)+4) ) {182l_i = t_1;183184/* R_N := R_N mod 55 + 1; */185t_4 = GC_R__N;186CHECK_BOUND( t_4, "R_N" )187t_3 = MOD( t_4, INTOBJ_INT(55) );188C_SUM_FIA( t_2, t_3, INTOBJ_INT(1) )189AssGVar( G_R__N, t_2 );190191/* R_X[R_N] := (R_X[R_N] + R_X[((R_N + 30) mod 55 + 1)]) mod R_228; */192t_2 = GC_R__X;193CHECK_BOUND( t_2, "R_X" )194t_3 = GC_R__N;195CHECK_BOUND( t_3, "R_N" )196CHECK_INT_POS( t_3 )197t_7 = GC_R__X;198CHECK_BOUND( t_7, "R_X" )199t_8 = GC_R__N;200CHECK_BOUND( t_8, "R_N" )201CHECK_INT_POS( t_8 )202C_ELM_LIST_FPL( t_6, t_7, t_8 )203t_8 = GC_R__X;204CHECK_BOUND( t_8, "R_X" )205t_12 = GC_R__N;206CHECK_BOUND( t_12, "R_N" )207C_SUM_FIA( t_11, t_12, INTOBJ_INT(30) )208t_10 = MOD( t_11, INTOBJ_INT(55) );209C_SUM_FIA( t_9, t_10, INTOBJ_INT(1) )210CHECK_INT_POS( t_9 )211C_ELM_LIST_FPL( t_7, t_8, t_9 )212C_SUM_FIA( t_5, t_6, t_7 )213t_6 = GC_R__228;214CHECK_BOUND( t_6, "R_228" )215t_4 = MOD( t_5, t_6 );216C_ASS_LIST_FPL( t_2, t_3, t_4 )217218}219/* od */220221/* return; */222RES_BRK_CURR_STAT();223SWITCH_TO_OLD_FRAME(oldFrame);224return 0;225226/* return; */227RES_BRK_CURR_STAT();228SWITCH_TO_OLD_FRAME(oldFrame);229return 0;230}231232/* handler for function 1 */233static Obj HdlrFunc1 (234Obj self )235{236Obj t_1 = 0;237Obj t_2 = 0;238Obj t_3 = 0;239Bag oldFrame;240OLD_BRK_CURR_STAT241242/* allocate new stack frame */243SWITCH_TO_NEW_FRAME(self,0,0,oldFrame);244REM_BRK_CURR_STAT();245SET_BRK_CURR_STAT(0);246247/* R_N := 1; */248AssGVar( G_R__N, INTOBJ_INT(1) );249250/* R_X := [ ]; */251t_1 = NEW_PLIST( T_PLIST, 0 );252SET_LEN_PLIST( t_1, 0 );253AssGVar( G_R__X, t_1 );254255/* R_228 := 2 ^ 28; */256t_1 = POW( INTOBJ_INT(2), INTOBJ_INT(28) );257AssGVar( G_R__228, t_1 );258259/* RANDOM_LIST := function ( list )260R_N := R_N mod 55 + 1;261R_X[R_N] := (R_X[R_N] + R_X[((R_N + 30) mod 55 + 1)]) mod R_228;262return list[QUO_INT( R_X[R_N] * LEN_LIST( list ), R_228 ) + 1];263end; */264t_1 = NewFunction( NameFunc[2], NargFunc[2], NamsFunc[2], HdlrFunc2 );265ENVI_FUNC( t_1 ) = TLS(CurrLVars);266t_2 = NewBag( T_BODY, NUMBER_HEADER_ITEMS_BODY*sizeof(Obj) );267STARTLINE_BODY(t_2) = INTOBJ_INT(23);268ENDLINE_BODY(t_2) = INTOBJ_INT(27);269FILENAME_BODY(t_2) = FileName;270BODY_FUNC(t_1) = t_2;271CHANGED_BAG( TLS(CurrLVars) );272AssGVar( G_RANDOM__LIST, t_1 );273274/* RANDOM_SEED := function ( n )275local i;276R_N := 1;277R_X := [ n mod R_228 ];278for i in [ 2 .. 55 ] do279R_X[i] := (1664525 * R_X[(i - 1)] + 1) mod R_228;280od;281for i in [ 1 .. 99 ] do282R_N := R_N mod 55 + 1;283R_X[R_N] := (R_X[R_N] + R_X[((R_N + 30) mod 55 + 1)]) mod R_228;284od;285return;286end; */287t_1 = NewFunction( NameFunc[3], NargFunc[3], NamsFunc[3], HdlrFunc3 );288ENVI_FUNC( t_1 ) = TLS(CurrLVars);289t_2 = NewBag( T_BODY, NUMBER_HEADER_ITEMS_BODY*sizeof(Obj) );290STARTLINE_BODY(t_2) = INTOBJ_INT(29);291ENDLINE_BODY(t_2) = INTOBJ_INT(39);292FILENAME_BODY(t_2) = FileName;293BODY_FUNC(t_1) = t_2;294CHANGED_BAG( TLS(CurrLVars) );295AssGVar( G_RANDOM__SEED, t_1 );296297/* if R_X = [ ] then */298t_2 = GC_R__X;299CHECK_BOUND( t_2, "R_X" )300t_3 = NEW_PLIST( T_PLIST, 0 );301SET_LEN_PLIST( t_3, 0 );302t_1 = (Obj)(UInt)(EQ( t_2, t_3 ));303if ( t_1 ) {304305/* RANDOM_SEED( 1 ); */306t_1 = GF_RANDOM__SEED;307CALL_1ARGS( t_1, INTOBJ_INT(1) );308309}310/* fi */311312/* return; */313RES_BRK_CURR_STAT();314SWITCH_TO_OLD_FRAME(oldFrame);315return 0;316317/* return; */318RES_BRK_CURR_STAT();319SWITCH_TO_OLD_FRAME(oldFrame);320return 0;321}322323/* 'InitKernel' sets up data structures, fopies, copies, handlers */324static Int InitKernel ( StructInitInfo * module )325{326327/* global variables used in handlers */328InitFopyGVar( "QUO_INT", &GF_QUO__INT );329InitFopyGVar( "LEN_LIST", &GF_LEN__LIST );330InitCopyGVar( "R_N", &GC_R__N );331InitCopyGVar( "R_X", &GC_R__X );332InitCopyGVar( "R_228", &GC_R__228 );333InitFopyGVar( "RANDOM_SEED", &GF_RANDOM__SEED );334335/* information for the functions */336InitGlobalBag( &DefaultName, "GAPROOT/lib/random.g:DefaultName(-48550429)" );337InitGlobalBag( &FileName, "GAPROOT/lib/random.g:FileName(-48550429)" );338InitHandlerFunc( HdlrFunc1, "GAPROOT/lib/random.g:HdlrFunc1(-48550429)" );339InitGlobalBag( &(NameFunc[1]), "GAPROOT/lib/random.g:NameFunc[1](-48550429)" );340InitHandlerFunc( HdlrFunc2, "GAPROOT/lib/random.g:HdlrFunc2(-48550429)" );341InitGlobalBag( &(NameFunc[2]), "GAPROOT/lib/random.g:NameFunc[2](-48550429)" );342InitHandlerFunc( HdlrFunc3, "GAPROOT/lib/random.g:HdlrFunc3(-48550429)" );343InitGlobalBag( &(NameFunc[3]), "GAPROOT/lib/random.g:NameFunc[3](-48550429)" );344345/* return success */346return 0;347348}349350/* 'InitLibrary' sets up gvars, rnams, functions */351static Int InitLibrary ( StructInitInfo * module )352{353Obj func1;354Obj body1;355356/* Complete Copy/Fopy registration */357UpdateCopyFopyInfo();358359/* global variables used in handlers */360G_QUO__INT = GVarName( "QUO_INT" );361G_LEN__LIST = GVarName( "LEN_LIST" );362G_R__N = GVarName( "R_N" );363G_R__X = GVarName( "R_X" );364G_R__228 = GVarName( "R_228" );365G_RANDOM__LIST = GVarName( "RANDOM_LIST" );366G_RANDOM__SEED = GVarName( "RANDOM_SEED" );367368/* record names used in handlers */369370/* information for the functions */371C_NEW_STRING( DefaultName, 14, "local function" );372C_NEW_STRING( FileName, 20, "GAPROOT/lib/random.g" );373NameFunc[1] = DefaultName;374NamsFunc[1] = 0;375NargFunc[1] = 0;376NameFunc[2] = DefaultName;377NamsFunc[2] = 0;378NargFunc[2] = 1;379NameFunc[3] = DefaultName;380NamsFunc[3] = 0;381NargFunc[3] = 1;382383/* create all the functions defined in this module */384func1 = NewFunction(NameFunc[1],NargFunc[1],NamsFunc[1],HdlrFunc1);385ENVI_FUNC( func1 ) = TLS(CurrLVars);386CHANGED_BAG( TLS(CurrLVars) );387body1 = NewBag( T_BODY, NUMBER_HEADER_ITEMS_BODY*sizeof(Obj));388BODY_FUNC( func1 ) = body1;389CHANGED_BAG( func1 );390CALL_0ARGS( func1 );391392/* return success */393return 0;394395}396397/* 'PostRestore' restore gvars, rnams, functions */398static Int PostRestore ( StructInitInfo * module )399{400401/* global variables used in handlers */402G_QUO__INT = GVarName( "QUO_INT" );403G_LEN__LIST = GVarName( "LEN_LIST" );404G_R__N = GVarName( "R_N" );405G_R__X = GVarName( "R_X" );406G_R__228 = GVarName( "R_228" );407G_RANDOM__LIST = GVarName( "RANDOM_LIST" );408G_RANDOM__SEED = GVarName( "RANDOM_SEED" );409410/* record names used in handlers */411412/* information for the functions */413NameFunc[1] = DefaultName;414NamsFunc[1] = 0;415NargFunc[1] = 0;416NameFunc[2] = DefaultName;417NamsFunc[2] = 0;418NargFunc[2] = 1;419NameFunc[3] = DefaultName;420NamsFunc[3] = 0;421NargFunc[3] = 1;422423/* return success */424return 0;425426}427428429/* <name> returns the description of this module */430static StructInitInfo module = {431/* type = */ 2,432/* name = */ "GAPROOT/lib/random.g",433/* revision_c = */ 0,434/* revision_h = */ 0,435/* version = */ 0,436/* crc = */ -48550429,437/* initKernel = */ InitKernel,438/* initLibrary = */ InitLibrary,439/* checkInit = */ 0,440/* preSave = */ 0,441/* postSave = */ 0,442/* postRestore = */ PostRestore443};444445StructInitInfo * Init__random ( void )446{447return &module;448}449450/* compiled code ends here */451#endif452453454