Wapp

mkccode.tcl generator
Login

mkccode.tcl generator

(1.4) By Vetelko (vetelko) on 2025-01-27 09:40:33 edited from 1.3 [link] [source]

Am I understanding this correctly? Can mkccode.tcl be used to compile/bundle my 'finished' Wapp application directly into wapptclsh, so that my index.cgi will only need to contain:

#!/usr/bin/wapptclsh?
wapp-start $argv

(2.1) By D. Richard Hipp (drh) on 2025-01-27 11:56:43 edited from 2.0 in reply to 1.4 [link] [source]

It was not designed to do that (or at least I don't remember designing it to do that), but maybe you can get it to work. Did you try it? What was the outcome?

(3) By Vetelko (vetelko) on 2025-01-27 15:29:41 in reply to 2.1 [link] [source]

I fiddled with it, but since I'm not an experienced C programmer, it's full of errors. It just occurred to me that if wapp.tcl can be part of a static interpreter, why not the application itself when it's already in a production state, instead of being interpreted from a CGI script.

Anyway, I'll keep fiddling with it since I'm developing a https://ufko.org/env that runs on Wapp.

(4) By ufko.org on 2025-02-02 08:26:51 in reply to 2.1 [link] [source]

So... I couldn't resist and tried it at least simply. I created a file app.tcl with a simple procedure hello {} and included it in wapptclsh.in.c like this:

static const char zApp[] =
BEGIN_STRING
INCLUDE $ROOT/app.tcl
END_STRING
;

Then I also added:

Tcl_GlobalEval(interp, zApp);  /* Load the app.tcl extension */

After that, I included app.tcl into the Makefile and recompiled the wapptclsh interpreter.

And it works:) so at a certain stage, the author of the application can decide that some procedures, which don't change often or are more complex, could be part of the binary, while, for example, PATH_HEAD handlers could still be interpreted from index.cgi.

I didn't do any special tests, but it I assume that the parts which are part of the wapptclsh interpreter are faster, even if it’s just by milliseconds.

(6) By Stephan Beal (stephan) on 2025-02-02 11:04:09 in reply to 4 [source]

So... I couldn't resist and tried it at least simply. I created a file app.tcl with a simple procedure hello {} and included it in wapptclsh.in.c like this:

Thank you for that report of success - that will definitely inspire me to try that out for my next app.

(7) By ufko.org on 2025-02-02 11:57:59 in reply to 6 [link] [source]

Great that it caught your interest. I don't think I would run a wapplication this way in the foreseeable future, but it's interesting to me because I'm not a skilled C programmer, I only understand some basics, and this way I can extend the functionality of the interpreter, for example, by compiling the markdown module from tcllib into it instead of sourcing it, and this might actually show its effects with a longer markdown document.

(5) By ufko.org on 2025-02-02 08:55:22 in reply to 2.1 [link] [source]

... and now I am at the stage where index.cgi contains only:

#!/usr/bin/wapptclsh
wapp-start $argv

  1. I have a faster response.
  2. The entire application is outside the document root.
  3. Deployment equals copying the binary to the server.

")

(8) By ufko.org on 2025-02-18 09:42:50 in reply to 1.4 [link] [source]

I forked this project to explore the idea of expanding its use to tasks beyond web application development. So it's more of a fork of the original concept than the code. Description is in the README.md on Github.