Re: [Texmacs-dev] TeXmacs & Webassembly

2022-01-31 Thread Massimiliano Gubinelli
Hi,


> On 29. Jan 2022, at 18:57, Hammer Functor  wrote:
> 
> Hi Max,
> 
> Maybe it’s possible to access local files systems with the help of wasi 
> (webassembly system call). I know little technical details, but I do heard of 
> something about it last year. Native wasm runtimes like wasmtime and wasmer 
> are promising as well, which helps to run wasm programs without a browser, 
> though qt-wasm are tied to browsers at present. 
> 

my understanding is that the environment provided by a web browser is naturally 
constrained by design, so WASI which is an API, will not improve the situation. 
There is the possibility to persist some data in the browser by using the 
database facilities of HTML5. This seems easy to do, we have to mount a virtual 
filesystem visible from TeXmacs which connect to the DB, I will look into it. 
However to "spill" files in the native OS one need to download it from the 
browser to the native OS like one would download a file from a website. The 
same applies for printing. Think about how Google Docs works, it has the same 
limitations we experience. I do not think it is bad, we have to keep in mind 
that TeXmacs/web would anyway have restrictions which the TeXmacs desktop app 
would not have, e.g.: no direct access to the filesystem (including fonts, 
etc..), resources to be downloaded from the web, no possibility to run plugins, 
etc...

A different situation would be to run TeXmacs/webassembly inside node.js or any 
other wasm capable runtime which is not a browser and which could then 
implement indeed the WASI api and allow filesystem access. This is already 
possible and would allow to develop TeXmacs in a really cross-platform fashion 
in webasm and then provide a small substrate to interface to any given OS. This 
about applications like Whataspp desktop, Electron, Visual Studio Code. For 
this to be interesting for us we need to understand what is exaclty the 
performance penalty of compiling to webasm instead of native machine code. 


Best,
Max



> Hope it help. 
> 
> Sincerely,
> Hammer Hu
> 
> ___
> Texmacs-dev mailing list
> Texmacs-dev@gnu.org
> https://lists.gnu.org/mailman/listinfo/texmacs-dev


___
Texmacs-dev mailing list
Texmacs-dev@gnu.org
https://lists.gnu.org/mailman/listinfo/texmacs-dev


Re: [Texmacs-dev] TeXmacs & Webassembly

2022-01-29 Thread Hammer Functor
Hi Max,

Maybe it’s possible to access local files systems with the help of wasi 
(webassembly system call). I know little technical details, but I do heard of 
something about it last year. Native wasm runtimes like wasmtime and wasmer are 
promising as well, which helps to run wasm programs without a browser, though 
qt-wasm are tied to browsers at present. 

Hope it help. 

Sincerely,
Hammer Hu

___
Texmacs-dev mailing list
Texmacs-dev@gnu.org
https://lists.gnu.org/mailman/listinfo/texmacs-dev


Re: [Texmacs-dev] TeXmacs & Webassembly

2022-01-29 Thread Massimiliano Gubinelli
Hi Joris,

> On 28. Jan 2022, at 23:58, TeXmacs  wrote:
> 
> Dear Max,
> 
> On Fri, Jan 28, 2022 at 06:36:26PM +0100, TeXmacs wrote:
>> Thanks, that is already far more usable indeed.  Next issues:
>>  - I noted that the keyboard shortcuts are somewhat problematic,
>>since various modifier keys don't work.
>>Also, ^ did not work on a French keyboard.
>>  - Similarly the contextual menus via the mouse don't work.
>>  - The mouse pointer changes in weird ways.

Yes. I still have to understand how the integration with the browser works. So 
far I haven't done anything particular for keyboard handling.


>>  - The status bar is vertically expanded on a large screen.

Noted.

>>  - Starting a plug-in makes TeXmacs freeze.  Maybe there is a way
>>to somehow avoid or escape freezes of this kind.
> 

I'm unsure how to deal with plugins. I do not think we can support any, the 
sandboxing prevents to run apps on the machine. As first step I will just make 
sure that no plugin can be activated.

> A few more points:
> 
>  - I don't know how file handling works exactly, but it would be nice if
>we were at least able to access files on the web.  Currently, we use
>wget for doing that and this does not seem to work with WebAssembly.
>But they probably provide some better way to do this?
> 

This should be possible but with restriction. As far as I understand a web page 
can only request pages from the same domain. This has to be investigated better.

Apriori webassmebly in the browser do not have access to any filesystem, for 
C/C++ programs there is a library layer which emulate standard Posix calls and 
a virtual in memory filesystem in which one can load data at startup and use it 
for read/write during program execution, but the written data cannot be 
persisted in any way automatically. One need to provide some mechanism. The 
browser allows webassembly programs to access to a database which, as far as I 
understand, can be persisted across section, so we will have to use it for 
preferences, etc... 

>  - Updating the extents of the window seems a bit buggy.
> 

Yes, I have some problems with redrawing which I do not undestand. In general 
how windowing is implemented in the Qt/Wasm backend is a bit unclear, some more 
study is needed on my side.

>  - For changing some user preferences, we have to reboot TeXmacs.
>But this destroys the file system.  Is there some way to keep files
>that we created for a subsequent run?  Also useful for caching purposes
>by the way and the compilation process itself...
> 

As I said. I think there is a way to persist data in the browser, as with other 
intergation matters should be investigated more, but certainly is a mechanism 
different from the usual Unix filesystem support. Maybe we would need a TMFS 
layer which handle the appropriate conversion. 

>  - I get messages like "This webpage is using significant memory.
>Closing it may improve the responsiveness of your Mac".
> 

Currently we are using too much resources, the program is quite large and has 
too much data (~70 MB of assembly and ~90MB of data) we would need to select 
the data we really want to download right away and maybe lazily download from a 
server the rest when requested. Also currently at startup I force the loading 
of all the lazy modules for debugging purpose, I will disable this so that we 
can start up faster.

Note also that we run in the main  browser thread for that tab so we can 
potentially block the thread, ideally we should split TeXmacs in at least two 
threads, a background one which do all our computations and a main thread which 
interacts with the browser and the plugins. It would be nice if the requests 
for resources we make (web pages, file loads) could be make asyncronous so that 
we do not block. I'm not sure it is like this right now.

>  - I also tested with Chrome and it works.
> 

Good to hear.


> Best wishes, --Joris
> 
> ___
> Texmacs-dev mailing list
> Texmacs-dev@gnu.org
> https://lists.gnu.org/mailman/listinfo/texmacs-dev


___
Texmacs-dev mailing list
Texmacs-dev@gnu.org
https://lists.gnu.org/mailman/listinfo/texmacs-dev


Re: [Texmacs-dev] TeXmacs & Webassembly

2022-01-28 Thread TeXmacs
Dear Max,

On Fri, Jan 28, 2022 at 06:36:26PM +0100, TeXmacs wrote:
> Thanks, that is already far more usable indeed.  Next issues:
>   - I noted that the keyboard shortcuts are somewhat problematic,
> since various modifier keys don't work.
> Also, ^ did not work on a French keyboard.
>   - Similarly the contextual menus via the mouse don't work.
>   - The mouse pointer changes in weird ways.
>   - The status bar is vertically expanded on a large screen.
>   - Starting a plug-in makes TeXmacs freeze.  Maybe there is a way
> to somehow avoid or escape freezes of this kind.

A few more points:

  - I don't know how file handling works exactly, but it would be nice if
we were at least able to access files on the web.  Currently, we use
wget for doing that and this does not seem to work with WebAssembly.
But they probably provide some better way to do this?

  - Updating the extents of the window seems a bit buggy.

  - For changing some user preferences, we have to reboot TeXmacs.
But this destroys the file system.  Is there some way to keep files
that we created for a subsequent run?  Also useful for caching purposes
by the way and the compilation process itself...

  - I get messages like "This webpage is using significant memory.
Closing it may improve the responsiveness of your Mac".

  - I also tested with Chrome and it works.

Best wishes, --Joris

___
Texmacs-dev mailing list
Texmacs-dev@gnu.org
https://lists.gnu.org/mailman/listinfo/texmacs-dev


Re: [Texmacs-dev] TeXmacs & Webassembly

2022-01-28 Thread TeXmacs
Dear Max,

On Fri, Jan 28, 2022 at 05:52:27PM +0100, Massimiliano Gubinelli wrote:
>  I've improved a bit the windowing. Here's a new version 
> 
> https://www.dropbox.com/s/fteoz8vv9s6ltc0/TeXmacs-webassembly-3.zip?dl=0 
> 

Thanks, that is already far more usable indeed.  Next issues:
  - I noted that the keyboard shortcuts are somewhat problematic,
since various modifier keys don't work.
Also, ^ did not work on a French keyboard.
  - Similarly the contextual menus via the mouse don't work.
  - The mouse pointer changes in weird ways.
  - The status bar is vertically expanded on a large screen.
  - Starting a plug-in makes TeXmacs freeze.  Maybe there is a way
to somehow avoid or escape freezes of this kind.

Great work, thanks!  --Joris

___
Texmacs-dev mailing list
Texmacs-dev@gnu.org
https://lists.gnu.org/mailman/listinfo/texmacs-dev


Re: [Texmacs-dev] TeXmacs & Webassembly

2022-01-28 Thread Massimiliano Gubinelli
Dear all,


 I've improved a bit the windowing. Here's a new version 


https://www.dropbox.com/s/fteoz8vv9s6ltc0/TeXmacs-webassembly-3.zip?dl=0 



Julien: ideally the application will be served by some fixed machine, so you do 
not have to run a server yourself in order to use it.

Best,
Max






> On 28. Jan 2022, at 14:45, TeXmacs  wrote:
> 

___
Texmacs-dev mailing list
Texmacs-dev@gnu.org
https://lists.gnu.org/mailman/listinfo/texmacs-dev


Re: [Texmacs-dev] TeXmacs & Webassembly

2022-01-28 Thread TeXmacs
On Thu, Jan 27, 2022 at 12:57:05AM +0100, Massimiliano Gubinelli wrote:
> Sure, this is essentially the first version which can interpret user input in 
> some useful way. The browser impose some constraints so some work is needed 
> to have working windows and popup.

Yes, but despite all problems, it works already impressively well.
Although menus are problematic, help balloons do work as expected,
curiously (but not the new preview balloons!?).  Plug-ins also
don't work (as expected) and I don't understand yet how local files
are managed.

> > This looks very promising indeed.  I assume that we could
> > let TeXmacs run on one or more public servers in this way.
> 
> TeXmacs technically runs on your machine, never on the server. You need a 
> server only to serve the code and the data. But this simplifies drastically 
> the distribution since there is only one executable for all the OS and it 
> could work also on tablets. 

Very attractive indeed.

> > Any reason why you used the old Widkit instead of the Qt port?
> 
> Yes, I'm not sure what is the right approach for the UI in the browser.
> 
> 1) one possibility is that progressively one move the UI from Widkit to the 
> enclosing browser using standard HTML elements. In this respect Qt is a bit 
> redundant since we do not need anymore the cross-platform layer. Ideally, at 
> the end, all the UI can be implemented in HTML and the graphical canvas 
> contains only the document. This would use the best of the two technologies: 
> the input and the math typesetting is dealt with TeXmacs/C++/Scheme and the 
> UI via the browser/HTML/CSS/Javascript.
> 
> ( this is the approach used in AutoCAD web: 
> https://www.autodesk.com/products/autocad-web-app/overview 
>  )

I like this approach.  Some comments:

  - I would prefer to be able to have TeXmacs markup for all UI elements in 
that case,
which would be even more uniform and elegant from the TeXmacs perspective.
We do not use much (buttons, popups, and canvases with scrollbars, mainly),
so this seems very doable.  Nothing prevents us from having converters from
and to Html for such new markup elements.

  - While writing the Qt stylesheets, I noticed that this forced me to move away
from the "native look and feel", which was part of the original appeal of 
Qt.
But well-designed style sheets might even offer a better user experience.

  - I also like the single window approach.  In fact, I don't like windows that
pop up at random places on my screen and would prefer to have everything in
one or two side panes.  This will be an ongoing development of mine anyway.

> 2) One keep using Qt, but has anyway to come up with a different UI than the 
> desktop version since there are limitations of the web platform, e.g. no 
> multiple windows, no modal dialogs, etc... We need to have a "single window" 
> application. If the user wants to have multiple documents it can run multiple 
> instances of TeXmacs in different windows I guess.
> 
> (something like: https://www.qt.io/web-assembly-example-slate 
>  )
> 
> Anyway, I will try, as soon as I find some time, to compile the standard Qt 
> interface, it should be possible. 

I guess that we would still need something like this for transitional purposes,
if we want to pursue the webassembly port.

Best wishes, --Joris

___
Texmacs-dev mailing list
Texmacs-dev@gnu.org
https://lists.gnu.org/mailman/listinfo/texmacs-dev


Re: [Texmacs-dev] TeXmacs & Webassembly

2022-01-26 Thread Massimiliano Gubinelli
HI Joris,

> On 26. Jan 2022, at 21:23, TeXmacs  wrote:
> 
> Hi Max,
> 
> On Wed, Jan 26, 2022 at 07:04:24PM +0100, Massimiliano Gubinelli wrote:
> [...]

> Thanks, now it works.  With lots of quirks though.
> Especially the size of windows is problematic,
> for instance when opening a menu.
> But I managed to type some simple text and maths.
> 

Sure, this is essentially the first version which can interpret user input in 
some useful way. The browser impose some constraints so some work is needed to 
have working windows and popup.

> This looks very promising indeed.  I assume that we could
> let TeXmacs run on one or more public servers in this way.

TeXmacs technically runs on your machine, never on the server. You need a 
server only to serve the code and the data. But this simplifies drastically the 
distribution since there is only one executable for all the OS and it could 
work also on tablets. 

> Any reason why you used the old Widkit instead of the Qt port?
> 

Yes, I'm not sure what is the right approach for the UI in the browser.

1) one possibility is that progressively one move the UI from Widkit to the 
enclosing browser using standard HTML elements. In this respect Qt is a bit 
redundant since we do not need anymore the cross-platform layer. Ideally, at 
the end, all the UI can be implemented in HTML and the graphical canvas 
contains only the document. This would use the best of the two technologies: 
the input and the math typesetting is dealt with TeXmacs/C++/Scheme and the UI 
via the browser/HTML/CSS/Javascript.

( this is the approach used in AutoCAD web: 
https://www.autodesk.com/products/autocad-web-app/overview 
 )


2) One keep using Qt, but has anyway to come up with a different UI than the 
desktop version since there are limitations of the web platform, e.g. no 
multiple windows, no modal dialogs, etc... We need to have a "single window" 
application. If the user wants to have multiple documents it can run multiple 
instances of TeXmacs in different windows I guess.

(something like: https://www.qt.io/web-assembly-example-slate 
 )


Anyway, I will try, as soon as I find some time, to compile the standard Qt 
interface, it should be possible. 

Best,

Max

> Best wishes, --Joris
> 
> ___
> Texmacs-dev mailing list
> Texmacs-dev@gnu.org
> https://lists.gnu.org/mailman/listinfo/texmacs-dev

___
Texmacs-dev mailing list
Texmacs-dev@gnu.org
https://lists.gnu.org/mailman/listinfo/texmacs-dev


Re: [Texmacs-dev] TeXmacs & Webassembly

2022-01-26 Thread TeXmacs
Hi Max,

On Wed, Jan 26, 2022 at 07:04:24PM +0100, Massimiliano Gubinelli wrote:
> Sorry Joris,
>  my fault. I forgot an auxiliary file (on top of the image file). Now should 
> work, a new upload here
> 
> https://www.dropbox.com/s/y4rijsbuya2s827/TeXmacs-webassembly-2.zip?dl=0 
> 
> 
> same procedude as the other. Call
> 
> python3 -m http.server  
> 
> and visit
> 
> http://localhost:8000/TeXmacs .html

Thanks, now it works.  With lots of quirks though.
Especially the size of windows is problematic,
for instance when opening a menu.
But I managed to type some simple text and maths.

This looks very promising indeed.  I assume that we could
let TeXmacs run on one or more public servers in this way.
Any reason why you used the old Widkit instead of the Qt port?

Best wishes, --Joris

___
Texmacs-dev mailing list
Texmacs-dev@gnu.org
https://lists.gnu.org/mailman/listinfo/texmacs-dev


Re: [Texmacs-dev] TeXmacs & Webassembly

2022-01-26 Thread Massimiliano Gubinelli
Sorry Joris,
 my fault. I forgot an auxiliary file (on top of the image file). Now should 
work, a new upload here

https://www.dropbox.com/s/y4rijsbuya2s827/TeXmacs-webassembly-2.zip?dl=0 


same procedude as the other. Call

python3 -m http.server  

and visit

http://localhost:8000/TeXmacs .html

Best,
Max

> On 26. Jan 2022, at 17:48, TeXmacs  wrote:
> 
> On Wed, Jan 26, 2022 at 03:39:12PM +0100, Massimiliano Gubinelli wrote:
>> The files TeXmacs.* have to be right in the directory where you invoke the 
>> python script (i.e. in $PWD). And then you visit 
>> http://localhost:TeXmacs.html in the browser.
> 
> Yes, that is exactly what I did...
> 
> Best wishes, --Joris
> 
> ___
> Texmacs-dev mailing list
> Texmacs-dev@gnu.org
> https://lists.gnu.org/mailman/listinfo/texmacs-dev

___
Texmacs-dev mailing list
Texmacs-dev@gnu.org
https://lists.gnu.org/mailman/listinfo/texmacs-dev


Re: [Texmacs-dev] TeXmacs & Webassembly

2022-01-26 Thread TeXmacs
On Wed, Jan 26, 2022 at 03:39:12PM +0100, Massimiliano Gubinelli wrote:
> The files TeXmacs.* have to be right in the directory where you invoke the 
> python script (i.e. in $PWD). And then you visit 
> http://localhost:TeXmacs.html in the browser.

Yes, that is exactly what I did...

Best wishes, --Joris

___
Texmacs-dev mailing list
Texmacs-dev@gnu.org
https://lists.gnu.org/mailman/listinfo/texmacs-dev


Re: [Texmacs-dev] TeXmacs & Webassembly

2022-01-26 Thread Massimiliano Gubinelli
I'm not sure I understand the log correctly. Which page have you requested? It 
seems is not finding the files but it is strange since in this case it should 
not request for qtloader.js or the others.

The files TeXmacs.* have to be right in the directory where you invoke the 
python script (i.e. in $PWD). And then you visit http://localhost:TeXmacs.html 
in the browser.

Max


> On 26. Jan 2022, at 15:04, TeXmacs  wrote:
> 
> On Wed, Jan 26, 2022 at 02:37:51PM +0100, TeXmacs wrote:
>>> this will load the .wasm file and compile it  and then load the .data file 
>>> (which contains the resources like fonts, scripts, etc..) and create a 
>>> virtual FS out of it. 
>>> It takes some time but sooner or later you should see TeXmacs in the 
>>> window. (tested on Safari and Firefox on Mac).
>> 
>> I obtain a broken link to some image with the caption 'Qt for WebAssembly: 
>> TeXmacs'.
>> Nothing seems to happen appart from that.
> 
> I also got the following terminal output:
> 
> Joriss-iMac-Pro:webassembly vdhoeven$ python3 -m http.server
> Serving HTTP on :: port 8000 (http://[::]:8000/) ...
> :::127.0.0.1 - - [26/Jan/2022 14:32:55] "GET /TeXmacs.html HTTP/1.1" 200 -
> :::127.0.0.1 - - [26/Jan/2022 14:32:55] code 404, message File not found
> :::127.0.0.1 - - [26/Jan/2022 14:32:55] "GET /qtloader.js HTTP/1.1" 404 -
> :::127.0.0.1 - - [26/Jan/2022 14:32:55] code 404, message File not found
> :::127.0.0.1 - - [26/Jan/2022 14:32:55] "GET /qtlogo.svg HTTP/1.1" 404 -
> :::127.0.0.1 - - [26/Jan/2022 14:32:55] code 404, message File not found
> :::127.0.0.1 - - [26/Jan/2022 14:32:55] "GET /favicon.ico HTTP/1.1" 404 -
> ::1 - - [26/Jan/2022 14:33:43] "GET /TeXmacs.html HTTP/1.1" 200 -
> ::1 - - [26/Jan/2022 14:33:43] code 404, message File not found
> ::1 - - [26/Jan/2022 14:33:43] "GET /qtlogo.svg HTTP/1.1" 404 -
> ::1 - - [26/Jan/2022 14:33:43] code 404, message File not found
> ::1 - - [26/Jan/2022 14:33:43] "GET /qtloader.js HTTP/1.1" 404 -
> ::1 - - [26/Jan/2022 14:33:43] code 404, message File not found
> ::1 - - [26/Jan/2022 14:33:43] "GET /favicon.ico HTTP/1.1" 404 -
> ::1 - - [26/Jan/2022 14:34:10] "GET /TeXmacs.html HTTP/1.1" 200 -
> ::1 - - [26/Jan/2022 14:34:10] code 404, message File not found
> ::1 - - [26/Jan/2022 14:34:10] code 404, message File not found
> ::1 - - [26/Jan/2022 14:34:10] "GET /qtlogo.svg HTTP/1.1" 404 -
> ::1 - - [26/Jan/2022 14:34:10] "GET /qtloader.js HTTP/1.1" 404 -
> ::1 - - [26/Jan/2022 14:34:10] code 404, message File not found
> ::1 - - [26/Jan/2022 14:34:10] "GET /favicon.ico HTTP/1.1" 404 -
> ::1 - - [26/Jan/2022 14:34:26] code 404, message File not found
> ::1 - - [26/Jan/2022 14:34:26] "GET /qtlogo.svg HTTP/1.1" 404 -
> ::1 - - [26/Jan/2022 14:34:40] code 404, message File not found
> ::1 - - [26/Jan/2022 14:34:40] "GET /qtlogo.svg HTTP/1.1" 404 -
> ::1 - - [26/Jan/2022 14:34:40] code 404, message File not found
> ::1 - - [26/Jan/2022 14:34:40] "GET /qtloader.js HTTP/1.1" 404 -
> ::1 - - [26/Jan/2022 14:34:43] "GET / HTTP/1.1" 200 -
> ::1 - - [26/Jan/2022 14:34:52] "GET /TeXmacs.wasm HTTP/1.1" 200 -
> 
> Exception occurred during processing of request from ('::1', 64116, 0, 0)
> Traceback (most recent call last):
>  File 
> "/usr/local/Cellar/python@3.9/3.9.10/Frameworks/Python.framework/Versions/3.9/lib/python3.9/socketserver.py",
>  line 683, in process_request_thread
>self.finish_request(request, client_address)
>  File 
> "/usr/local/Cellar/python@3.9/3.9.10/Frameworks/Python.framework/Versions/3.9/lib/python3.9/socketserver.py",
>  line 360, in finish_request
>self.RequestHandlerClass(request, client_address, self)
>  File 
> "/usr/local/Cellar/python@3.9/3.9.10/Frameworks/Python.framework/Versions/3.9/lib/python3.9/http/server.py",
>  line 653, in __init__
>super().__init__(*args, **kwargs)
>  File 
> "/usr/local/Cellar/python@3.9/3.9.10/Frameworks/Python.framework/Versions/3.9/lib/python3.9/socketserver.py",
>  line 747, in __init__
>self.handle()
>  File 
> "/usr/local/Cellar/python@3.9/3.9.10/Frameworks/Python.framework/Versions/3.9/lib/python3.9/http/server.py",
>  line 427, in handle
>self.handle_one_request()
>  File 
> "/usr/local/Cellar/python@3.9/3.9.10/Frameworks/Python.framework/Versions/3.9/lib/python3.9/http/server.py",
>  line 415, in handle_one_request
>method()
>  File 
> "/usr/local/Cellar/python@3.9/3.9.10/Frameworks/Python.framework/Versions/3.9/lib/python3.9/http/server.py",
>  line 660, in do_GET
>self.copyfile(f, self.wfile)
>  File 
> "/usr/local/Cellar/python@3.9/3.9.10/Frameworks/Python.framework/Versions/3.9/lib/python3.9/http/server.py",
>  line 860, in copyfile
>shutil.copyfileobj(source, outputfile)
>  File 
> "/usr/local/Cellar/python@3.9/3.9.10/Frameworks/Python.framework/Versions/3.9/lib/python3.9/shutil.py",
>  line 208, in copyfileobj
>fdst_write(buf)
>  File 
> "/usr/local/Cellar/python@3.9/3.9.10/Frameworks/Python.framework/Versio

Re: [Texmacs-dev] TeXmacs & Webassembly

2022-01-26 Thread Massimiliano Gubinelli
The broken image is normal, I forgot to add a file to the bundle. Should not 
matter (it does not on my machine).

You have to wait ~30 sec. The server should output some messages to indicate 
that the files have been requested by the browser. Firefox is faster in my 
experience, but it should work on Safari too. 

Max


> On 26. Jan 2022, at 14:37, TeXmacs  wrote:
> 
> Hi Max,
> 
> On Wed, Jan 26, 2022 at 02:19:57PM +0100, Massimiliano Gubinelli wrote:
>> on my machine works as follows:
>> 
>> - unzip the files and enter the directory.
>> - run 'python3 -m http.server' or something like this to initiate an HTTP 
>> server. For me it start listening to localhost:8000:
>> 
>> mgubi@Ulrike build-wasm % python3 -m http.server
>> Serving HTTP on :: port 8000 (http://[::]:8000/) ...
> 
> Until here, it works.
> 
>> then on a browser visit the page http://localhost:8000/TeXmacs.html 
>> 
>> 
>> this will load the .wasm file and compile it  and then load the .data file 
>> (which contains the resources like fonts, scripts, etc..) and create a 
>> virtual FS out of it. 
>> It takes some time but sooner or later you should see TeXmacs in the window. 
>> (tested on Safari and Firefox on Mac).
> 
> I obtain a broken link to some image with the caption 'Qt for WebAssembly: 
> TeXmacs'.
> Nothing seems to happen appart from that.
> 
> Best wishes, --Joris
> 
> ___
> Texmacs-dev mailing list
> Texmacs-dev@gnu.org
> https://lists.gnu.org/mailman/listinfo/texmacs-dev


___
Texmacs-dev mailing list
Texmacs-dev@gnu.org
https://lists.gnu.org/mailman/listinfo/texmacs-dev


Re: [Texmacs-dev] TeXmacs & Webassembly

2022-01-26 Thread TeXmacs
On Wed, Jan 26, 2022 at 02:37:51PM +0100, TeXmacs wrote:
> > this will load the .wasm file and compile it  and then load the .data file 
> > (which contains the resources like fonts, scripts, etc..) and create a 
> > virtual FS out of it. 
> > It takes some time but sooner or later you should see TeXmacs in the 
> > window. (tested on Safari and Firefox on Mac).
> 
> I obtain a broken link to some image with the caption 'Qt for WebAssembly: 
> TeXmacs'.
> Nothing seems to happen appart from that.

I also got the following terminal output:

Joriss-iMac-Pro:webassembly vdhoeven$ python3 -m http.server
Serving HTTP on :: port 8000 (http://[::]:8000/) ...
:::127.0.0.1 - - [26/Jan/2022 14:32:55] "GET /TeXmacs.html HTTP/1.1" 200 -
:::127.0.0.1 - - [26/Jan/2022 14:32:55] code 404, message File not found
:::127.0.0.1 - - [26/Jan/2022 14:32:55] "GET /qtloader.js HTTP/1.1" 404 -
:::127.0.0.1 - - [26/Jan/2022 14:32:55] code 404, message File not found
:::127.0.0.1 - - [26/Jan/2022 14:32:55] "GET /qtlogo.svg HTTP/1.1" 404 -
:::127.0.0.1 - - [26/Jan/2022 14:32:55] code 404, message File not found
:::127.0.0.1 - - [26/Jan/2022 14:32:55] "GET /favicon.ico HTTP/1.1" 404 -
::1 - - [26/Jan/2022 14:33:43] "GET /TeXmacs.html HTTP/1.1" 200 -
::1 - - [26/Jan/2022 14:33:43] code 404, message File not found
::1 - - [26/Jan/2022 14:33:43] "GET /qtlogo.svg HTTP/1.1" 404 -
::1 - - [26/Jan/2022 14:33:43] code 404, message File not found
::1 - - [26/Jan/2022 14:33:43] "GET /qtloader.js HTTP/1.1" 404 -
::1 - - [26/Jan/2022 14:33:43] code 404, message File not found
::1 - - [26/Jan/2022 14:33:43] "GET /favicon.ico HTTP/1.1" 404 -
::1 - - [26/Jan/2022 14:34:10] "GET /TeXmacs.html HTTP/1.1" 200 -
::1 - - [26/Jan/2022 14:34:10] code 404, message File not found
::1 - - [26/Jan/2022 14:34:10] code 404, message File not found
::1 - - [26/Jan/2022 14:34:10] "GET /qtlogo.svg HTTP/1.1" 404 -
::1 - - [26/Jan/2022 14:34:10] "GET /qtloader.js HTTP/1.1" 404 -
::1 - - [26/Jan/2022 14:34:10] code 404, message File not found
::1 - - [26/Jan/2022 14:34:10] "GET /favicon.ico HTTP/1.1" 404 -
::1 - - [26/Jan/2022 14:34:26] code 404, message File not found
::1 - - [26/Jan/2022 14:34:26] "GET /qtlogo.svg HTTP/1.1" 404 -
::1 - - [26/Jan/2022 14:34:40] code 404, message File not found
::1 - - [26/Jan/2022 14:34:40] "GET /qtlogo.svg HTTP/1.1" 404 -
::1 - - [26/Jan/2022 14:34:40] code 404, message File not found
::1 - - [26/Jan/2022 14:34:40] "GET /qtloader.js HTTP/1.1" 404 -
::1 - - [26/Jan/2022 14:34:43] "GET / HTTP/1.1" 200 -
::1 - - [26/Jan/2022 14:34:52] "GET /TeXmacs.wasm HTTP/1.1" 200 -

Exception occurred during processing of request from ('::1', 64116, 0, 0)
Traceback (most recent call last):
  File 
"/usr/local/Cellar/python@3.9/3.9.10/Frameworks/Python.framework/Versions/3.9/lib/python3.9/socketserver.py",
 line 683, in process_request_thread
self.finish_request(request, client_address)
  File 
"/usr/local/Cellar/python@3.9/3.9.10/Frameworks/Python.framework/Versions/3.9/lib/python3.9/socketserver.py",
 line 360, in finish_request
self.RequestHandlerClass(request, client_address, self)
  File 
"/usr/local/Cellar/python@3.9/3.9.10/Frameworks/Python.framework/Versions/3.9/lib/python3.9/http/server.py",
 line 653, in __init__
super().__init__(*args, **kwargs)
  File 
"/usr/local/Cellar/python@3.9/3.9.10/Frameworks/Python.framework/Versions/3.9/lib/python3.9/socketserver.py",
 line 747, in __init__
self.handle()
  File 
"/usr/local/Cellar/python@3.9/3.9.10/Frameworks/Python.framework/Versions/3.9/lib/python3.9/http/server.py",
 line 427, in handle
self.handle_one_request()
  File 
"/usr/local/Cellar/python@3.9/3.9.10/Frameworks/Python.framework/Versions/3.9/lib/python3.9/http/server.py",
 line 415, in handle_one_request
method()
  File 
"/usr/local/Cellar/python@3.9/3.9.10/Frameworks/Python.framework/Versions/3.9/lib/python3.9/http/server.py",
 line 660, in do_GET
self.copyfile(f, self.wfile)
  File 
"/usr/local/Cellar/python@3.9/3.9.10/Frameworks/Python.framework/Versions/3.9/lib/python3.9/http/server.py",
 line 860, in copyfile
shutil.copyfileobj(source, outputfile)
  File 
"/usr/local/Cellar/python@3.9/3.9.10/Frameworks/Python.framework/Versions/3.9/lib/python3.9/shutil.py",
 line 208, in copyfileobj
fdst_write(buf)
  File 
"/usr/local/Cellar/python@3.9/3.9.10/Frameworks/Python.framework/Versions/3.9/lib/python3.9/socketserver.py",
 line 826, in write
self._sock.sendall(b)
BrokenPipeError: [Errno 32] Broken pipe

::1 - - [26/Jan/2022 14:34:58] "GET /TeXmacs.js HTTP/1.1" 200 -
::1 - - [26/Jan/2022 14:35:04] code 404, message File not found
::1 - - [26/Jan/2022 14:35:04] code 404, message File not found
::1 - - [26/Jan/2022 14:35:04] "GET /qtloader.js HTTP/1.1" 404 -
::1 - - [26/Jan/2022 14:35:04] "GET /qtlogo.svg HTTP/1.1" 404 -

___
Texmacs-dev mailing list
Texmac

Re: [Texmacs-dev] TeXmacs & Webassembly

2022-01-26 Thread TeXmacs
Hi Max,

On Wed, Jan 26, 2022 at 02:19:57PM +0100, Massimiliano Gubinelli wrote:
> on my machine works as follows:
> 
> - unzip the files and enter the directory.
> - run 'python3 -m http.server' or something like this to initiate an HTTP 
> server. For me it start listening to localhost:8000:
> 
> mgubi@Ulrike build-wasm % python3 -m http.server
> Serving HTTP on :: port 8000 (http://[::]:8000/) ...

Until here, it works.

> then on a browser visit the page http://localhost:8000/TeXmacs.html 
> 
> 
> this will load the .wasm file and compile it  and then load the .data file 
> (which contains the resources like fonts, scripts, etc..) and create a 
> virtual FS out of it. 
> It takes some time but sooner or later you should see TeXmacs in the window. 
> (tested on Safari and Firefox on Mac).

I obtain a broken link to some image with the caption 'Qt for WebAssembly: 
TeXmacs'.
Nothing seems to happen appart from that.

Best wishes, --Joris

___
Texmacs-dev mailing list
Texmacs-dev@gnu.org
https://lists.gnu.org/mailman/listinfo/texmacs-dev


Re: [Texmacs-dev] TeXmacs & Webassembly

2022-01-26 Thread Massimiliano Gubinelli
Joris,

 on my machine works as follows:

- unzip the files and enter the directory.
- run 'python3 -m http.server' or something like this to initiate an HTTP 
server. For me it start listening to localhost:8000:

mgubi@Ulrike build-wasm % python3 -m http.server
Serving HTTP on :: port 8000 (http://[::]:8000/) ...

then on a browser visit the page http://localhost:8000/TeXmacs.html 


this will load the .wasm file and compile it  and then load the .data file 
(which contains the resources like fonts, scripts, etc..) and create a virtual 
FS out of it. 
It takes some time but sooner or later you should see TeXmacs in the window. 
(tested on Safari and Firefox on Mac).

Max
 

> On 26. Jan 2022, at 14:15, TeXmacs  wrote:
> 
> Hi Max,
> 
> Thanks, this sounds interesting, but could you provide a small HOWTO
> about how to launch this version of TeXmacs?  I downloaded the zip file and
> I don't see how to use it.
> 
> Best wishes, --Joris
> 
> 
> On Wed, Jan 26, 2022 at 11:01:40AM +0100, Massimiliano Gubinelli wrote:
>> Dear all,
>> 
>> I've experimented in porting TeXmacs to Webassembly. The result is attached 
>> to this message. It is a version of TeXmacs with S7 as scheme interpreter 
>> and running with the legacy widget kit on top of a Qt layer. All compiled in 
>> Webassembly with Qt/Wasm and Emscripten. It seems usable even if compiled 
>> without optimization.
>> 
>> You can grab it here (67mb compressed)
>> 
>> https://www.dropbox.com/s/56vw20vnz8w0azr/TeXmacs-webassembly.zip?dl=0
>> 
>> but you need a local server to serve the files to the browser.
>> 
>> Note that this is just a test. Windows and maybe many other things are not 
>> yet working properly. You can try it safely since the program is sandboxed 
>> and cannot interact with your filesystem. In particular you have only access 
>> to a virtual filesystem in memory, so you cannot save files on your computer 
>> (yet).
>> 
>> Hope you enjoy. Webassembly is really an interesting technology. We should 
>> think if we can leverage it to have more widespread adoption of TeXmacs.
>> 
>> Max
>> 
>> 
> 
>> ___
>> Texmacs-dev mailing list
>> Texmacs-dev@gnu.org 
>> https://lists.gnu.org/mailman/listinfo/texmacs-dev 
>> 
> 
> 
> ___
> Texmacs-dev mailing list
> Texmacs-dev@gnu.org 
> https://lists.gnu.org/mailman/listinfo/texmacs-dev 
> 
___
Texmacs-dev mailing list
Texmacs-dev@gnu.org
https://lists.gnu.org/mailman/listinfo/texmacs-dev


Re: [Texmacs-dev] TeXmacs & Webassembly

2022-01-26 Thread TeXmacs
Hi Max,

Thanks, this sounds interesting, but could you provide a small HOWTO
about how to launch this version of TeXmacs?  I downloaded the zip file and
I don't see how to use it.

Best wishes, --Joris


On Wed, Jan 26, 2022 at 11:01:40AM +0100, Massimiliano Gubinelli wrote:
> Dear all,
> 
>  I've experimented in porting TeXmacs to Webassembly. The result is attached 
> to this message. It is a version of TeXmacs with S7 as scheme interpreter and 
> running with the legacy widget kit on top of a Qt layer. All compiled in 
> Webassembly with Qt/Wasm and Emscripten. It seems usable even if compiled 
> without optimization.
> 
> You can grab it here (67mb compressed)
> 
> https://www.dropbox.com/s/56vw20vnz8w0azr/TeXmacs-webassembly.zip?dl=0
> 
> but you need a local server to serve the files to the browser.
> 
> Note that this is just a test. Windows and maybe many other things are not 
> yet working properly. You can try it safely since the program is sandboxed 
> and cannot interact with your filesystem. In particular you have only access 
> to a virtual filesystem in memory, so you cannot save files on your computer 
> (yet).
> 
> Hope you enjoy. Webassembly is really an interesting technology. We should 
> think if we can leverage it to have more widespread adoption of TeXmacs.
> 
> Max
> 
> 

> ___
> Texmacs-dev mailing list
> Texmacs-dev@gnu.org
> https://lists.gnu.org/mailman/listinfo/texmacs-dev


___
Texmacs-dev mailing list
Texmacs-dev@gnu.org
https://lists.gnu.org/mailman/listinfo/texmacs-dev