hermann on Sat, 25 May 2024 22:59:01 +0200


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: Making use of "GP in your browser" questions


On 2024-05-24 23:07, Bill Allombert wrote:
...
The file  gp-sta.wasm is a binary file generated from PARI source code
(and GNU GMP) with emscripten.
So it is covered by the GNU GPL v2+. So you need to point to the GPL and
you need to also distribute the source code of PARI and GNU GMP.

Everything should be available from
https://pari.math.u-bordeaux.fr/pub/pari/javascript/
except the is no wasm file yet, I need to fix it.

Whether you want to copy or link to gp-sta.wasm is your choice, but it
is probably safer to copy
them, in case I make some incompatible change on the PARI website.

Cheers,
Bill

Thanks.
What I really want is to use JavaScript PARI/GP in a JSCAD code, like the code you see on right:

https://jscad.app

So I need to run gp-sta.js in node, not in browser.
gp-sta.js has no export, so require does not work.
But "import" does.
But import does not allow to import with "http:" or "https:" out of the box.
But with "--experimental-network-imports"
https://h3manth.com/posts/HTTP-imports-node/
use of "http:" states that "https:" is needed for non-local addresses like
http://pari.math.u-bordeaux.fr/gpjswasm/gp-sta.js
so still work in progress.

But what is amazing is that local gp-sta.js PARI/GP runs in node already(!!), see below.

Regards,

Hermann.


As stated import works, but node told me that "await import(...)" has to be used.

hermann@j4105:~/gpminimal$ node
Welcome to Node.js v20.13.1.
Type ".help" for more information.
await import("./gp-sta.js")
[Module: null prototype] {
  default: {
    FS_createPath: [Function: createPath],
    FS_createDataFile: [Function: createDataFile],
    FS_createPreloadedFile: [Function: FS_createPreloadedFile],
    FS_unlink: [Function: unlink],
    FS_createLazyFile: [Function: createLazyFile],
    FS_createDevice: [Function: createDevice] { major: 66 },
    requestFullscreen: [Function: requestFullscreen],
    requestAnimationFrame: [Function: requestAnimationFrame],
    setCanvasSize: [Function: setCanvasSize],
    pauseMainLoop: [Function: pause],
    resumeMainLoop: [Function: resume],
    getUserMedia: [Function: getUserMedia],
    createContext: [Function: createContext],
    _gp_embedded_init: [Function (anonymous)],
    _gp_embedded: [Function (anonymous)],
    _pari_emscripten_plot_init: [Function (anonymous)],
    _main: [Function (anonymous)],
    dynCall_ii: [Function (anonymous)],
    dynCall_iiii: [Function (anonymous)],
    dynCall_vii: [Function (anonymous)],
    dynCall_iii: [Function (anonymous)],
    dynCall_iiiii: [Function (anonymous)],
    dynCall_iiiiii: [Function (anonymous)],
    dynCall_vi: [Function (anonymous)],
    dynCall_viii: [Function (anonymous)],
    dynCall_viiiii: [Function (anonymous)],
    dynCall_i: [Function (anonymous)],
    dynCall_iidi: [Function (anonymous)],
    dynCall_id: [Function (anonymous)],
    dynCall_viiiiii: [Function (anonymous)],
    dynCall_v: [Function (anonymous)],
    dynCall_viiii: [Function (anonymous)],
    ___emscripten_embedded_file_data: 406976,
    addRunDependency: [Function: addRunDependency],
    removeRunDependency: [Function: removeRunDependency],
    ccall: [Function: ccall]
  }
}
GP/PARI CALCULATOR Version 2.15.5 (development 28239-6c020b568b)
wasm running emscripten (portable C/GMP-6.2.1 kernel) 32-bit version compiled: Feb 17 2024, clang version 19.0.0git (https://github.com/llvm/llvm-project e769fb8699e3fa8e40623764f7713bfc783b0330)
                            threading engine: single
               (readline not compiled in, extended help enabled)

                     Copyright (C) 2000-2022 The PARI Group

PARI/GP is free software, covered by the GNU General Public License, and comes
WITHOUT ANY WARRANTY WHATSOEVER.

Type ? for help, \q to quit.
Type ?18 for how to get moral (and possibly technical) support.

parisize = 4000000, primelimit = 500000
? Goodbye!