Logiweb(TM)

7.1.8.1 Reference by name

Prev Up Next Page 151 of 800 Search internet


Consider three lgs source texts. The first one is ref1.lgs:

   ""P ref1
   ""R base
   ""D 0
   a
   b
   ""D 6
   " + "
   " - "
   ""B
   "We just include name definitions "[ ""N ]"
   and charge definitions "[ ""C ]" in the body"

The second lgs source text is ref2.lgs:

   ""P ref2
   ""R base
   ""D 0
   x
   y
   ""D 4
   " * "
   ""D 6
   " + "
   ""B
   "We just include name definitions "[ ""N ]"
   and charge definitions "[ ""C ]" in the body"

The third lgs source text is page.lgs:

   ""P page
   ""R ref1
   ""R ref2
   ""B
   a * x - b * y

Now suppose one issues the following commands:

   lgc ref1
   lgc ref2
   lgc page

When lgc translates the body of the third lgs file

   a * x - b * y

it will recognize a, b, and subtraction as constructs coming from ref1 and x, y, and multiplication as coming from ref2. The constructs will have names and charges as defined by ref1 and ref2 because ref1 and ref2 both include both a ""N and ""C escape sequence.

For the interested reader

In the following and until the end of the present page, a more detailed description of how ref1 and ref2 is located will be given. This can be skipped without loss of continuity.

Consider again the three commands:

   lgc ref1
   lgc ref2
   lgc page

The first two commands will translate ref1.lgs and ref2.lgs. By default, the result ends up in ~/.logiweb/name/ref1 and ~/.logiweb/name/ref2. Or, rather, ~/.logiweb/name/ref1 and ~/.logiweb/name/ref2 will become symbolic links to the result.

It is a good idea to make the name of the lgs file and the ""P page name be identical (like one does in the Java programming language). If the lgs file name and the ""P page name are different, it is the file name which dictates where the result ends up. That ensures that when a user issues a command like lgc ref1 the user can tell where the result ends up regardless of the contents of ref1.lgs.

Once ~/.logiweb/name/ref1 and ~/.logiweb/name/ref2 are in place, one can issue an lgc page command and get page.lgs translated. During translation of page.lgs, lgc will look up ref1 and ref2 using the namepath option of lgc(1). That option defaults to

   ~/.logiweb/:/rack.lgr

Thus, lgc will look up ref1 as ~/.logiweb/name/ref1/rack.lgr and ref2 as ~/.logiweb/name/ref2/rack.lgr.

As mentioned above, ~/.logiweb/name/ref1 and ~/.logiweb/name/ref2 are symbolic links to the output from lgc ref1 and lgc ref2. Where such links end up is controlled by the link option of lgc(1). By default, the link option is a list of two elements:

   ~/.logiweb/name/:
   :

The first element of the list generates the symbolic links ~/.logiweb/name/ref1 and ~/.logiweb/name/ref2. The second element generates links named ref1 and ref2 in the current directory.

Where the ref1 and ref2 pages really ends up is controlled by the rendering option of lgc(1). The default value is

   ~/.logiweb/logiweb/:/

Thus, ref1 and ref2 really end up in subdirectories named something like

   ~/.logiweb/logiweb/01...06/

where 01...06 is the reference of ref1 and ref2, respectively, in mixed endian hexadecimal.

Prev Up Next Page 151 of 800 Search logiweb.eu

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