hermann on Sun, 26 May 2024 14:37:07 +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-26 00:46, hermann@stamm-wilbrandt.de wrote:


Not with "https:" either ...
...
Some hints on the web tell me to use ".mjs" suffix.
While I cannot try that on your website, I will test whether that
works on mine ...

There is a catch22 situation here.
I am forced to use https.
Doing so with import fails because
https://pari.math.u-bordeaux.fr/gpjswasm/gp-sta.js
contains three "require()"s that do not work in that situation.
So currently it seems impossible to use above gp-sta.js from
that website as is with node ...

Below node session shows how to really evaluate a GP input in node with local gp-sta.js:

hermann@j4105:~/gpminimal$ node
Welcome to Node.js v20.13.1.
Type ".help" for more information.
hermann@j4105:~/gpminimal$ node
Welcome to Node.js v20.13.1.
Type ".help" for more information.
M = await import('./gp-sta.js')
[Module: null prototype] {
  default: {
    FS_createPath: [Function: createPath],
...
}
GP/PARI CALCULATOR Version 2.15.5 (development 28239-6c020b568b)
wasm running emscripten (portable C/GMP-6.2.1 kernel) 32-bit version
...
Type ?18 for how to get moral (and possibly technical) support.

parisize = 4000000, primelimit = 500000
? Goodbye!

M.default.ccall("gp_embedded_init",null,["number","number"],[4000000,1000000000]);
undefined
M.default.ccall("gp_embedded","string",["string"],["primes([2,100])"]);
'%1 = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97]\n'



Regards,

Hermann.