7.15.2 Logiweb scripts

Prev Up Next Page 264 of 800 Search internet

In the present implementation and under Unix, each Logiweb machine is represented by a 'script', i.e. as a text file which is marked executable. We shall refer to such scripts as Logiweb scripts. As an example, the lgc compiler is a Logiweb machine, and it is represented by the following Logiweb script:

     1	#!/usr/bin/lgwam script
     2	string
     3	012BDADEAB85B6C94B13FB254D655D12A1602D16B292ABDB81A184BC0806
     4	lgc
     5	execute
     6	siteconfig=/etc/logiweb/lgc.conf

We shall refer to the Logiweb machine defined by the script above as the 'lgc machine'. In the lgc machine, the Logiweb abstract machine (lgwam) implements the engine and interface. In general, lgwam implements the engine and interface of every Logiweb machine in the present implementation.

The word 'script' in Line 1 occurs in every Logiweb machine. It tells lgwam(1) that it shall execute the script.

The cache of the lgc machine is not included directly in the script. Rather, the cache is given as a reference in mixed endian hexadecimal. Lgwam uses that to look up the cache.

Lgwam looks up the cache using the LGW_PATH variable. The value of that variable is interpreted as as list of Unix path names separated by semicolons. Lgwam tries each Unix path in turn. For each path, lgwam replaces the rightmost colon character in the path by the reference of the cache. The default value of LGW_PATH is $HOME/.logiweb/logiweb/:/rack.lgr.

Line 2 of the lgc machine indicates how lgwam can locate the cache and the handler of the machine. At present, the 'string' method is the only method which is not deprecated.

When using the string method, Line 4 and 5 of the machine are strings which indicate where to find the handler. We shall refer to the strings in Line 4 and 5 is symbol and aspect, respectively. In the present implementation, the aspect is always the string 'execute'.

The handler of the machine is found thus: A definition of the given aspect of the given symbol is located in the rack of the given reference. The principal operator of the right hand side of the definition is supposed to have arity at least two. The handler is taken to be the value of the first subtree of the right hand side.

The source text of the lgc compiler contains the following definition:

   define "execute" of "lgc" as newline
   << lgc-main ,, !"siteconfig=/etc/logiweb/lgc.conf" >> end define

That definition defines the 'execute' aspect of the string 'lgc'. The head of the right hand side is lgc-main, so lgc-main becomes the handler of the lgc machine.

Lines after Line 5 are not interpreted by lgwam. Lgwam makes these lines available to the Logiweb machine together with command line arguments and environment variables, and leaves it to the handler to decide what to do with them.

Prev Up Next Page 264 of 800 Search logiweb.eu

Copyright © 2010 Klaus Grue, GRD-2010-01-05