1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
-
-
-
+
+
+
-
+
-
+
-
+
-
+
-
-
+
+
-
+
-
-
+
+
|
How To Compile, Or Not
======================
1.0 Use As Pure Tcl - No Compilation Required
---------------------------------------------
The Wapp framework is pure Tcl contained in a single file called
"[wapp.tcl](/file/wapp.tcl)". That, and a generic "tclsh",
is all you need to run a Wapp application.
The W3 framework is pure Tcl contained in a single file called
"[w3.tcl](/file/wapp.tcl)". That, and a generic "tclsh",
is all you need to run a W3 application.
For example, when testing Wapp, the developers run the following command from
For example, when testing W3, the developers run the following command from
the root of the source tree:
>
tclsh tests/test01.tcl
The [test01.tcl](/file/tests/test01.tcl) script does a "source ../wapp.tcl" to
load the Wapp framework. No special interpreter is required.
load the W3 framework. No special interpreter is required.
The [search function](https://sqlite.org/search) of the SQLite homepage takes
this one step further. The Tcl script that implements the search function embeds
the wapp.tcl script when the website is built. The "wapp.tcl" is neither
"source"-ed nor "package require"-ed. The wapp.tcl script is embedded into the
"search" script.
2.0 Using A Special Interpreter
-------------------------------
It is sometimes convenient to use the special "wapptclsh" interpreter to run
Wapp applications. The "wapptclsh" works just like ordinary "tclsh" with the
W3 applications. The "wapptclsh" works just like ordinary "tclsh" with the
following minor differences:
+ Wapptclsh understands "package require wapp" natively, without any extra
+ W3tclsh understands "package require wapp" natively, without any extra
finagling.
+ Wapptclsh comes with SQLite built-in. SQLite turns out to be very handy
for the kinds of small web applications that Wapp is designed for.
+ W3tclsh comes with SQLite built-in. SQLite turns out to be very handy
for the kinds of small web applications that W3 is designed for.
+ Wapptclsh builds are (by default) statically linked, so that it works inside
+ W3tclsh builds are (by default) statically linked, so that it works inside
chroot jails that lack all the shared libraries needed by generic "tclsh".
To reiterate: "wapptclsh" is not required to run Wapp applications. But it is
convenient. The developer of Wapp prefers using "wapptclsh" on his installations.
To reiterate: "wapptclsh" is not required to run W3 applications. But it is
convenient. The developer of W3 prefers using "wapptclsh" on his installations.
2.1 Compiling The Special Interpreter
-------------------------------------
To build wapptclsh, make a copy of either Makefile or Makefile.macos in the
top-level directory of the source tree. Change a few settings. (This step is
not hard as each Makefile is less than 20 lines long.) Then run the Makefile.
|