Bill Allombert on Fri, 24 May 2024 23:07:43 +0200


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

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


On Fri, May 24, 2024 at 01:48:27PM +0200, hermann@stamm-wilbrandt.de wrote:
> Then I remembered this webpage:
> https://pari.math.u-bordeaux.fr/gpwasm.html
> 
> While there is plenty of documentation on the website for many aspects,
> I found none for making use of wasm GP in browser.

Agreed, but I do not know enough to write it.

The source code for gpwasm.html is at
https://pari.math.u-bordeaux.fr/cgi-bin/gitweb.cgi?p=www.git;a=blob;f=wml/gpwasm.wml

> So I did save complete webpage, and downloaded gp-sta.wasm in addition:

You need a gpjswasm directory with gp-sta.js and gp-sta.wasm
(and optionaly root/ for optional packages).

Theses files are generated when you compile PARI with emscripten/wasm

> function myevalm(s) { return
> Module.ccall("gp_embedded","string",["string"],[s]); }
> in browser JavaScript?

gp_embedded is documented in doc/develop.tex.
Once gp_embedded_init start, you can use it to evaluate strings.

> 2) Is it OK to use
> 
> https://pari.math.u-bordeaux.fr/gpwasm/gp-sta.wasm
> 
> in own webpages for using myevalm() ?

> 3) Is it OK to host gp-sta.wasm eg. locally in github.io domain from
> lattice_sphere_cmp repo?
> 
> 4) Does the repo need to have GNU license for 3?

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