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/****************************************************************************12This is a prototype of a HELLO_WORLD example implemented as a kernel module.34An example of its compilation:56dyn-194-155:src alexk$ ~/gap4r4/bin/i686-apple-darwin10.4.0-gcc/gac -d hellod.c7gcc -fPIC -o /var/folders/NB/NBxYeZaRHxGpf4haob7SqE+++TQ/-Tmp-//gac36146/36146_hellod.o -I/Users/alexk/gap4r4/bin/i686-apple-darwin10.4.0-gcc/../.. -I/Users/alexk/gap4r4/bin/i686-apple-darwin10.4.0-gcc -DCONFIG_H -c hellod.c8ld -bundle -bundle_loader /Users/alexk/gap4r4/bin/i686-apple-darwin10.4.0-gcc/gap /usr/lib/bundle1.o -lc -lm -o hellod.so /var/folders/NB/NBxYeZaRHxGpf4haob7SqE+++TQ/-Tmp-//gac36146/36146_hellod.o9rm -f /var/folders/NB/NBxYeZaRHxGpf4haob7SqE+++TQ/-Tmp-//gac36146/36146_hellod.o1011It works as follows:1213gap> LoadDynamicModule("hellod.so");14gap> HELLO_WORLD();15Hello World!16gap>1718It may be included in one of the future versions of the Example package.19However, this will require documenting more rules of kernel programming.2021****************************************************************************/2223#include <stdio.h>24#include "src/compiled.h"2526Obj FuncHELLO_WORLD( Obj self ) {27Pr("Hello World!\n",0L, 0L);28return (Obj) 0;29}3031static StructGVarFunc GVarFuncs [] = {3233{ "HELLO_WORLD", 0, "", FuncHELLO_WORLD, "src/string.c:FuncHELLO_WORLD" },3435};363738/**************************************************************************3940*F InitKernel( <module> ) . . . . . . . . initialise kernel data structures41*/42static Int InitKernel (43StructInitInfo * module )44{4546/* init filters and functions */47InitHdlrFuncsFromTable( GVarFuncs );4849/* return success */50return 0;51}525354/****************************************************************************55**56*F InitLibrary( <module> ) . . . . . . . initialise library data structures57*/58static Int InitLibrary (59StructInitInfo * module )60{61/* UInt gvar;62Obj tmp; */6364/* init filters and functions */65/* printf("Init El..Small\n");fflush(stdout); */66InitGVarFuncsFromTable( GVarFuncs );6768/* return success */69return 0;70}717273/****************************************************************************74**75*F InitInfopl() . . . . . . . . . . . . . . . . . table of init functions76*/77/* <name> returns the description of this module */78static StructInitInfo module = {79#ifdef EDIVSTATIC80/* type = */ MODULE_STATIC,81#else82/* type = */ MODULE_DYNAMIC,83#endif84/* name = */ "hello",85/* revision_c = */ 0,86/* revision_h = */ 0,87/* version = */ 0,88/* crc = */ 0,89/* initKernel = */ InitKernel,90/* initLibrary = */ InitLibrary,91/* checkInit = */ 0,92/* preSave = */ 0,93/* postSave = */ 0,94/* postRestore = */ 095};9697#ifndef EDIVSTATIC98StructInitInfo * Init__Dynamic ( void )99{100return &module;101}102#endif103104StructInitInfo * Init__ediv ( void )105{106return &module;107}108109