18.104.22.168 References: ""R
| Page 117 of 800||
An lgs source can include zero, one, or more references. A reference starts with a ""R escape sequence and continues to the end of the line.
Instead of ending the ""R directive by a newline, one may end it by a newline escape sequence ""n. Furthermore, one can make a ""R directive span several lines by commenting out the newline using e.g. "";. If the characters of the ""R directive include double quote characters then only the characters from the last quote character until the end of the line define the reference. The other characters define a list a qualifiers as explained later.
A reference like
references the page defined by the file named pages/mypage/vector.lgw under the users home directory. The file: indicates that the page is a file in the local file system. The .lgw extension indicates that the page is stored as a vector.
A reference must have type file:, http:, name:, or lgw:. The default is name: so that e.g. name:base can be abbreviated base.
- An http reference is retrieved using an http GET operation.
- A file reference is looked up in the local file system. Tilde expansion is performed on file references. Relative file references are looked up relative to the current directory (this may change to being relative to the directory containing the lgs source).
- A name url is looked up using the namepath option of lgc(1). This is done by considering the elements of namepath one at a time and replacing the rightmost colon character of the element by the given name. The result must be a reference of type file: or http: which is then looked up. If successful, the page found is used. Otherwise, the next element of the namepath is tried.
- An lgw reference is looked up using the path option of lgc(1) in exactly the same way as a name is looked up. The only difference is that the characters after lgw: must be a Logiweb reference expressed in mixed endian hexadecimal.
An http or file reference must have extension .lgw, .lgr or .lgu. The extension determines the format of the referenced page as follows:
- A reference with extension .lgw contains a Logiweb vector. A Logiweb vector is a compact format suited for transmitting over the Internet which takes some time to translate to internal form. Given the vector of a page it is easy to verify the authenticity of a Logiweb vector, so the format is suited for storing pages in untrusted repositories and for transmission over untrusted networks.
- A reference with extension .lgr contains a Logiweb rack. A Logiweb rack is more extensive than a Logiweb vector. Even though a rack takes up more bytes than a vector, it does not contain more information so vectors are more compressed than racks. One may think of racks as decompressed and pre-compiled versions of vectors. Racks can be much faster to translate to internal form than Logiweb vectors. Racks are suited for storing in the local file system. There is no easy way to verify the authenticity of a Logiweb rack, so racks should only be stored in trusted places. In practice, most users will be happy just retrieving .lgr pages from their own cache. Whenever the Logiweb compiler has translated an .lgw page, it stores the .lgr equivalent in the users cache so that the time consuming translation is done once only.
- A reference with extension .lgu contains a Logiweb url. A Logiweb url is like a symbolic link in that its value is taken to be the reference of the page to be fetched. The type of the reference must be http. The extension can be .lgw, .lgr or .lgu. Note in particular that the value of Logiweb urls can have extension .lgu so that one can work with several levels of indirection. Logiweb urls are not used at present, but they are intended to be used by CGI-scripts (Logiweb 'servers') which can locate pages based on their reference.
Copyright © 2010
| Page 117 of 800||