Generated: Monday, November 14, 2011, 09:13:18 Copyright © 2011 , Kurt Nørmark The local LAML software home page

Reference Manual of the LAML library

Kurt Nørmark © normark@cs.aau.dk Department of Computer Science, Aalborg University, Denmark.

LAML Source file: laml.scm

The file laml.scm is the very first laml file to load. It contains a number of variable and functions which must be defined whenever LAML is used. Some of the variables - the configuration variables - are defined via the LAML configuration process. It also contains some very fundamental LAML stuff, including a number of top level commands that activate LAML tools. Physically, laml.scm is composed of a tiny, configuration dependent file followed by the file laml-fundamental.scm. These two files are documented together.

laml.scm loads the scheme/OS/platform specific compatibility file and the general library from the lib directory. It is assumed that the value of the variable laml-dir is the full path of the LAML directory; laml-dir must be defined when laml.scm is loaded, and the path must end in a "/". The laml command prompt command and the LAML Emacs activation commands will take care of the definition of laml-dir for you.

Table of Contents:
1. The configuration section. 6. Interactive tool activation. 11. XML file writing procedures.
2. LAML version information. 7. Language settings. 12. The HTML character transformation table.
3. Library, style, tool, and local dir loading. 8. LAML home URL and directories. 13. R4RS and R5RS Scheme knowledge.
4. LAML contextual information. 9. Document prolog and epilog functions. 14. Miscellaneous.
5. Programmatic loading of laml files. 10. Cosmetic welcome, ending and copyright functions.

Alphabetic index:
anchor-name-of-scheme-knowledge anchor-name-of-scheme-knowledge Selects the anchor name of a scheme knowledge entry.
begin-laml (begin-laml) The function begin-laml is supposed to be called at the time all LAML software loading is done.
bibtex (bibtex file-name) Parse the bibtex file, file-name, which is a bibtex file name without the bibtex extension.
category-of-scheme-knowledge category-of-scheme-knowledge Selects the category of a scheme knowledge entry.
copyright-clause (copyright-clause) Return an HTML comment with a copyright notice, or an empty string.
credits (credits system-dk system-eng [system-url]) Return a credit message to Kurt Nørmark about system-dk (the Danish name) and system-eng (the English name).
document-type-declaration (document-type-declaration [language]) Return a document type declaration.
end-laml (end-laml) This function is intended to end a LAML file.
end-laml-loading end-laml-loading An alias of begin-laml.
essentiality-of-scheme-knowledge essentiality-of-scheme-knowledge Selects the essentiality of a scheme knowledge entry.
fake-startup-parameters (fake-startup-parameters source-file startup-dir . program-parameters) Fake the contextual startup parameters to a specific source file name and a specific startup directory.
fake-startup-parameters-prog-par-list (fake-startup-parameters-prog-par-list source-file startup-dir program-parameter-list) A convenience version of fake-startup-parameters which does not take program parameters as a rest parameter.
file-number-of-scheme-knowledge file-number-of-scheme-knowledge Selects the HTML file number of a scheme knowledge entry.
full-source-path-with-extension (full-source-path-with-extension ext) Return the full path to the current source file name in the startup directory, using the extension ext.
generate-xml-mirror (generate-xml-mirror parsed-dtd-file-name language-name [action-element-list]) Generate a mirror of an XML language in LAML and Scheme.
html-char-transform (html-char-transform char [transformation-table]) Return the transformation of char via a character transformation table.
html-char-transformation-table html-char-transformation-table A vector of length 256 which transforms character number i to a string.
html-parse (html-parse in-file-name [out-file-name]) Parse the HTML file file-name (a file name with or without extension) using the HTML parser for LAML.
html-pp (html-pp in-file-name [out-file-name single-lining indentation max-width]) Pretty prints the HTML file or HTML parse tree in in-file-name and place the pretty printed result in out-file-name.
html-to-laml (html-to-laml in-file-name out-file-name) Convert the HTML file on in-file-name to a LAML file on out-file-name.
in-startup-directory (in-startup-directory . suffixes) Return a (full) path relative to the current startup-directory.
is-a-laml-directory? (is-a-laml-directory? dir) Is the directory dir a (potential) subdirectory of laml-dir.
kn-manual-settings (kn-manual-settings [abstract-clause]) The LAML Manual/SchemeDoc standard settings.
kn-xml-in-laml (kn-xml-in-laml [with-icon]) The LAML author's name and address information.
laml (laml file-name . program-parameters) Load and execute the LAML file on the file file-name (a string).
laml-absolute-url-prefix laml-absolute-url-prefix The URL prefix of the LAML software home page at Aalborg University's WWW server.
laml-canonical-command-line (laml-canonical-command-line) Return the contextual command line information passed to LAML upon activation.
laml-cd (laml-cd dir) Set the LAML startup directory to dir.
laml-dir-prefix (laml-dir-prefix [dir]) Return the relative or absolute prefix file path from dir to the root directory of the LAML software.
laml-execution-mode laml-execution-mode A variable which can be used to control if laml is safe and informative, or fast.
laml-home-url-prefix (laml-home-url-prefix [extra-level start-dir]) Return a relative or absolute url prefix to the LAML home directory.
laml-library laml-library The scheme library relative to laml-dir.
laml-library-source-linking (laml-library-source-linking) A collection of scheme-source-linking-manual clauses which provides for linking from Scheme Sources to LAML manuals.
laml-load (laml-load full-file-path . optional-parameter-list) Load the laml file in full-file-path after faking the start up parameters.
laml-local-url-prefix (laml-local-url-prefix [dir]) Return the relative or absolute url to the local laml dir.
laml-ls (laml-ls) Returns a list of files and directories of the LAML startup directory (the current directory).
laml-platform laml-platform The platform on which LAML is in use (a symbol).
laml-power-icon (laml-power-icon [extra-level icon-size]) Return the LAML POWER icon with link to the LAML home page.
laml-program-parameters (laml-program-parameters) Return the list of program parameters passed to an activation of LAML.
laml-pwd (laml-pwd) Returns the working LAML directory.
laml-shortcut-icon (laml-shortcut-icon laml-home-url-dir) Generate a LAML shortcut icon from the current directory (the startup-directory).
laml-source-file-path (laml-source-file-path [extension]) Return the full path to the current source file (as returned by (source-filename-without-extension)) in the LAML startup directory (as returned by (startup-directory)).
laml-standard-comment (laml-standard-comment) Return a standard comment about LAML.
laml-style (laml-style style-spec [style-base load-variation]) Load a LAML style.
laml-temp-file-path (laml-temp-file-path) Returns a full, absolute path to a temp directory, to which LAML software is assumed to have write access.
laml-tool-load (laml-tool-load suffix-path) Load a file from the LAML tool directory.
laml-version laml-version A variable that refers to the version of LAML, bound at LAML installation time.
laml-version-kind (laml-version-kind) Return the kind of your current LAML distribution.
laml-version-numbers (laml-version-numbers) Return a list of two integers: the LAML major version number and the LAML minor version number.
laml-version-time (laml-version-time) Return the time stamp of this LAML distribution.
laml-welcome (laml-welcome) Initiating welcome and info text for interactive LAM tools.
language-preference language-preference A variable which determines which language to use in selected parts of the LAML software.
leno-xml (leno-xml leno-xml-file) Process a LENO xml file.
lib-load (lib-load suffix-path) Load file from the LAML library directory.
local-load (local-load suffix-path) Load file from the startup directory.
operating-system operating-system The operating system on which LAML is in use (a symbol).
process-xml (process-xml processing-specs file-path ast) Process the ast according to the processing-specs and write the resulting XML files to files determined by file-path.
read-scheme-knowledge (read-scheme-knowledge scheme-version) Read and the return the list structure for Scheme knowledge of RnRS, where n corresponds to scheme-version (a number).
scheme-pp (scheme-pp in-file-name [out-file-name single-lining indentation max-width]) Pretty prints the Scheme or Lisp file - including comments - in in-file-name and write the result to out-file-name.
scheme-pp-simple (scheme-pp-simple in-file-name [out-file-name single-lining indentation max-width]) Pretty prints the Scheme or Lisp file - without comment preservation - in in-file-name and write the result to out-file-name.
scheme-system scheme-system The Scheme system on which LAML depends (a symbol).
schemedoc (schemedoc scheme-input-file [commenting-style]) Extract documentation from a scheme source file and present the extracted information in an HTML file.
set-html-char-transformation-entry! (set-html-char-transformation-entry! transformation-table index new-entry) Mutate a html character transformation table at position index.
set-laml-program-parameters (set-laml-program-parameters program-parameters) Set the LAML program parameters.
set-laml-source-file (set-laml-source-file file) Set the LAML source file name (without extension) to file.
set-laml-startup-directory (set-laml-startup-directory dir) Set the LAML startup directory to dir.
source-filename-without-extension (source-filename-without-extension . unused-parameter) If possible return the name of the LAML source file (without extension).
standard-epilog (standard-epilog [language]) Returns a standard document epilog - end matters - inserted after the document elements.
standard-prolog (standard-prolog [language]) Return a standard document prolog - front matters - inserted before any document elements.
startup-directory (startup-directory . unused-parameter) Return the directory in which LAML is started up.
symbol-of-scheme-knowledge symbol-of-scheme-knowledge Selects the name of a scheme knowledge entry.
text-choice (text-choice danish english) Return either danish or english, depending on the value of the global variable language-preference.
tracing-comment (tracing-comment) Return a HTML comment which somehow traces this document.
url-suffix-of-scheme-knowledge (url-suffix-of-scheme-knowledge entry scheme-version) Return the suffix part of an URL to an RnRS Scheme HTML file.
write-html (write-html mode html-clause [file-path-with-extension]) Write html-clause (a string or an ast) to a text file.
write-xml (write-xml mode xml-clause [file-path-with-extension]) Write xml-clause (an XML-in-LAML ast) to a text file.
xml-dtd-manual (xml-dtd-manual dtd-path [target-path mirror-name-prefix]) Generate a LAML manual (in SchemeDoc style) of an XML DTD.
xml-dtd-parse (xml-dtd-parse dtd-file-name) Parse the XML DTD on dtd-file-name.
xml-parse-file (xml-parse-file in-file-name xml-language [out-file-name]) Parses an XML file, in-file-name, relative to the given xml-language.
xml-parse-string (xml-parse-string xml-string xml-language) Parses an XML string using the XML parser for LAML and delivers the corresponding XML-in-LAML AST as the result.
xml-pp (xml-pp in-file-name [out-file-name single-lining indentation max-width]) Pretty prints the XML file or XML parse tree in in-file-name and place the pretty printed result in out-file-name.


1 The configuration section.
The configuration section is meant to be addapted in each new LAML installation. This section contains a few fundamental variables. The variables are defined via the configuration file in the laml-config directory.

scheme-system
Form scheme-system
Description The Scheme system on which LAML depends (a symbol). Possible values are: mzscheme, scm, guile, drscheme. The value is frozen by the LAML configuration program.
See also Scheme source file scheme-system

laml-platform
Form laml-platform
Description The platform on which LAML is in use (a symbol). Possible values are: windows, unix, mac. mac is not yet in use. The value is frozen by the LAML configuration program.
See also Scheme source file laml-platform

operating-system
Form operating-system
Description The operating system on which LAML is in use (a symbol). Possible values on the windows platform: win98, win95, nt40, win2000. Possible values on the unix platform: solaris-6, solaris-7, or linux. The value is frozen by the LAML configuration program.
See also Scheme source file operating-system

laml-library
Form laml-library
Description The scheme library relative to laml-dir. A string. A single directory name (without ending slash). The value is frozen by the LAML configuration program. You can change this if you use an alternative or experimental LAML library.
See also Scheme source file laml-library

laml-version
Form laml-version
Description A variable that refers to the version of LAML, bound at LAML installation time.
Returns A string that contains the version number and a short description.
See also Scheme source file laml-version

begin-laml
Form (begin-laml)
Description The function begin-laml is supposed to be called at the time all LAML software loading is done. The function is also available via the alias end-laml-loading. The function loads the LAML init file, typically called .laml. By loading the LAML init file when all software is loaded, it is always possible to redefine crucial parts in the LAML init file. In HTML, SVG and similar contexts it is the responsibility of the document author to call begin-laml (as well as end-laml). In contexts where we process a more elaborate XML-in-LAML document, the software that processes the document calls begin-laml.
See also Scheme source file begin-laml
alias function end-laml-loading
related function end-laml

end-laml-loading
Form end-laml-loading
Description An alias of begin-laml. Rationale: In some contexts it is natural to state the point where all LAML loading is done.
See also Scheme source file end-laml-loading

laml-execution-mode
Form laml-execution-mode
Description A variable which can be used to control if laml is safe and informative, or fast. Possible values: fast or safe (a symbol).
See also Scheme source file laml-execution-mode

laml-temp-file-path
Form (laml-temp-file-path)
Description Returns a full, absolute path to a temp directory, to which LAML software is assumed to have write access. This directory is called the LAML temporary file directory. In the default implementation, return temp in laml-dir. You may redefine this function to return another path. This is necessary if you do not have write access to the default LAML temporary file directory. Redefinition of the function can take place in your .laml file.
See also Scheme source file laml-temp-file-path


2 LAML version information.
The functions in this section return information about the version of LAML that you have installed. The functions basically return the same information as the string laml-version. We provide these function to make the LAML version information available on a more convenient form than in in the string laml-version. The version information is taken from the file distribution-version.lsp in the root of the LAML distribution. Always use the functions in this section to access the version information. (Do not read and interpret the information in distribution-version.lsp directly).

laml-version-numbers
Form (laml-version-numbers)
Description Return a list of two integers: the LAML major version number and the LAML minor version number.
Returns A list of two integers: (major-version-number minor-version-number)
See also Scheme source file laml-version-numbers

laml-version-time
Form (laml-version-time)
Description Return the time stamp of this LAML distribution. A number that represents the number of second elapsed since Jan 1, 1970. Use the functions in the LAML time library to make good use of this number.
Returns An integer.
See also Scheme source file laml-version-time
Useful time function time-decode

laml-version-kind
Form (laml-version-kind)
Description Return the kind of your current LAML distribution. Currently we use the following kinds: full, slim, development.
Returns Either "full", "slim", "development" (a string).
See also Scheme source file laml-version-kind


3 Library, style, tool, and local dir loading.
The functions in this section loads LAML libraries and LAML styles.

lib-load
Form (lib-load suffix-path)
Description Load file from the LAML library directory.
Parameters suffix-path The part of the library file name relative to the LAML library directory, including file extension.
See also Scheme source file lib-load

laml-tool-load
Form (laml-tool-load suffix-path)
Description Load a file from the LAML tool directory.
Parameters suffix-path The part of the tool file name relative to the LAML tool directory, including file extension.
See also Scheme source file laml-tool-load

local-load
Form (local-load suffix-path)
Description Load file from the startup directory.
Parameters suffix-path The part of the file name relative to the LAML startup directory, including file extension.
See also Scheme source file local-load
related function startup-directory

laml-style
Form (laml-style style-spec [style-base load-variation])
Description Load a LAML style.
Parameters style-spec The name of the style to load. A style-spec is without extension. However, the style file must have the scm extension.
style-base: The directory which contains the style. If style-base is given it must be a full path directory (a slash terminated string) from which to load your style. If style-base is omitted, the style is loaded from styles subdirectory of the LAML directory.
load-variation: A load-variation assigned to the global LAML variable laml-load-variation.
Examples (laml-style "simple" #f 'xyz-variation)
(laml-style "manual" "manual/")
See also Scheme source file laml-style


4 LAML contextual information.
The functions in this section deal with the necessary context information, which must be passed to Scheme when we use LAML.

source-filename-without-extension
Form (source-filename-without-extension . unused-parameter)
Description If possible return the name of the LAML source file (without extension). This is only possible if the information somehow is passed to the Scheme execuctable. In cases where it is not possible to know the source file name, return #f. Notice: The parameter is not used, and should be avoided. In order to be backward compatible, however, we allow a dummy parameter.
See also Scheme source file source-filename-without-extension
similar function full-source-path-with-extension

startup-directory
Form (startup-directory . unused-parameter)
Description Return the directory in which LAML is started up. If this information is not available return #f. Notice: The parameter is not used, and should be avoided. In order to be backward compatible, however, we allow a dummy parameter.
See also Scheme source file startup-directory

laml-program-parameters
Form (laml-program-parameters)
Description Return the list of program parameters passed to an activation of LAML. If no program parameters are passed, the empty list is returned.
See also Scheme source file laml-program-parameters

laml-canonical-command-line
Form (laml-canonical-command-line)
Description Return the contextual command line information passed to LAML upon activation. Returns a list of lenght three, or #f if no command line activation exists. The first element must be the symbol laml. Element number two must be the laml source file name (without extension and initial path). Element number three must be a slash terminated directory in which the source file resides. This function must be redefined in the scheme-system dependent compatibility file. If you ever call this implementation of the function, it indicates a missing redefinition.
See also Scheme source file laml-canonical-command-line

fake-startup-parameters
Form (fake-startup-parameters source-file startup-dir . program-parameters)
Description Fake the contextual startup parameters to a specific source file name and a specific startup directory. As an optional parameter, a list of program parameters can be passed. Both of the parameters must be strings, or the boolean value #f (in case the informations are unknown). This function is useful for programmatic startup of LAML. This function must be redefined in the scheme-system dependent compatibility file. If you ever call this implementation of the function, it indicates a missing redefinition.
See also Scheme source file fake-startup-parameters

fake-startup-parameters-prog-par-list
Form (fake-startup-parameters-prog-par-list source-file startup-dir program-parameter-list)
Description A convenience version of fake-startup-parameters which does not take program parameters as a rest parameter.
Parameters source-file a file name without initial path and without extension.
start-dir an absolute path to a directory ending in a slash /.
See also Scheme source file fake-startup-parameters-prog-par-list

set-laml-startup-directory
Form (set-laml-startup-directory dir)
Description Set the LAML startup directory to dir. Dir can be a full path, "..", or a directory relative to the current laml startup directory. This is specialized call to fake-startup-parameters with only directory information.
See also Scheme source file set-laml-startup-directory

in-startup-directory
Form (in-startup-directory . suffixes)
Description Return a (full) path relative to the current startup-directory. The directory and file contributions in suffixes are concatenated.
See also Scheme source file in-startup-directory
relevant function startup-directory

laml-source-file-path
Form (laml-source-file-path [extension])
Description Return the full path to the current source file (as returned by (source-filename-without-extension)) in the LAML startup directory (as returned by (startup-directory)).
Parameters extension The extension of the returned file path. A string (without initial dot).
Returns A full file path to the current source file
See also Scheme source file laml-source-file-path

laml-cd
Form (laml-cd dir)
Description Set the LAML startup directory to dir. Dir can be a full path, "..", or a directory relative to the current laml startup directory. A convenient and easy to remember alias to set-laml-startup-directory.
See also Scheme source file laml-cd

laml-pwd
Form (laml-pwd)
Description Returns the working LAML directory. Similar to the UNIX command pwd. An alias of the function startup-directory.
See also Scheme source file laml-pwd

laml-ls
Form (laml-ls)
Description Returns a list of files and directories of the LAML startup directory (the current directory). Similar to the UNIX command ls
See also Scheme source file laml-ls

set-laml-source-file
Form (set-laml-source-file file)
Description Set the LAML source file name (without extension) to file. This is specialized call to fake-startup-parameters with only source file information.
See also Scheme source file set-laml-source-file

set-laml-program-parameters
Form (set-laml-program-parameters program-parameters)
Description Set the LAML program parameters. This is specialized call to fake-startup-parameters with only program parameters
See also Scheme source file set-laml-program-parameters

full-source-path-with-extension
Form (full-source-path-with-extension ext)
Description Return the full path to the current source file name in the startup directory, using the extension ext. This function can be used conveniently to name the typical file for LAML to HTML transformations.
See also Scheme source file full-source-path-with-extension
similar function source-filename-without-extension


5 Programmatic loading of laml files.
Loading a LAML file invovles the setting of two pieces of context: The name of of the source file and the startup directory. The function laml-load sets these information and loads a file.

laml
Form (laml file-name . program-parameters)
Description Load and execute the LAML file on the file file-name (a string). This procedure is a flexible and versatile alternative to laml-load.
Parameters file-name A file-name, with or without extension. The extension 'laml' will be added if not supplied. Takes file-name from the startup-directory. Can also be a full path.
program-parameters A list of program parameters
See also Scheme source file laml
useful function laml-program-parameters
Note Please notice that this procedure will not work in case you use directory or file names with dots ('.').

laml-load
Form (laml-load full-file-path . optional-parameter-list)
Description Load the laml file in full-file-path after faking the start up parameters. full-file-path must be the full path of a laml file, including the laml extension. This function is used by the function laml, which is recommended for most users.
See also Scheme source file laml-load
similar function laml


6 Interactive tool activation.
The procedures in this section activate LAML tools. It is recommended that you activate the commands from an interactive LAML (Scheme) prompt. From Emacs carry out the editor command run-laml-interactively .

All the commands below work relative to the LAML working directory, which is changed by the procedure laml-cd . Use the command laml-pwd to find out about the LAML working directory.


schemedoc
Form (schemedoc scheme-input-file [commenting-style])
Description Extract documentation from a scheme source file and present the extracted information in an HTML file. The HTML file is, per default, delivered as a sibling file to the Scheme source file. If the .source-destination-delta attribute is present, the HTML file may be delivered in another directory. This procedure is supposed to be called from a Scheme interpreter, in which LAML is loaded and available. The procedure takes into consideration the attributes, which are extracted from the introductory comment (the abstract comment) of the Scheme source file.
Parameters scheme-input-file The file name of the Scheme source file, including file extension. It can be an absolute file path. It can also be a simple file name (or relative file path) which is assumed to be relative to the so-called startup-directory of LAML.
commenting-style One of the symbols multi-semicolon or documentation-mark. The default value is multi-semicolon.
See also Scheme source file schemedoc
Further info LAML Tutorial section

xml-dtd-manual
Form (xml-dtd-manual dtd-path [target-path mirror-name-prefix])
Description Generate a LAML manual (in SchemeDoc style) of an XML DTD. This procedure reads the parsed dtd file (from a file with extension lsp) and generates an HTML file that represents the manual.
Precondition It is assumed that the DTD file already is parsed, and that the parsed DTD file is located side by side the DTD source file. It is also assumed that lib/xml-in-laml/xml-in-laml.scm is already loaded.
Parameters dtd-path the path to the dtd file, without any file extension.
target-path the path in which to write the manual target file. Defaults to the startup directory.
mirror-name-prefix The prefix name of the mirror of the XML language in LAML. (A string). Defaults to the empty string.
Examples (dtd-manual "xhtml10-transitional")
See also Scheme source file xml-dtd-manual
preparatory function xml-dtd-parse
Note It is recommended that the XHTML1.0 transitional mirror is loaded before use of this procedure. The precondition and the recommendation is fulfilled when used via M-x run-laml-interactively in Emacs.

xml-dtd-parse
Form (xml-dtd-parse dtd-file-name)
Description Parse the XML DTD on dtd-file-name. If the input file is f, the parsed file will be located in f.lsp. The parsed DTD is represented as a Scheme list structure.
Parameters dtd-file-name The name of the XML DTD file name in the startup directory. Without any extension.
See also Scheme source file xml-dtd-parse
Note As a side-effect, this procedure defines the variables element-list, attribute-list, and entity-list.

generate-xml-mirror
Form (generate-xml-mirror parsed-dtd-file-name language-name [action-element-list])
Description Generate a mirror of an XML language in LAML and Scheme. This includes the generation of finite state automata for XML validation purposes. If the parsed XML DTD file is named f.lsp, the generated mirror will be located in f.scm. This procedure does not provide access to all 'parameters' of the mirror generation tool. If you need to control the mirror generation in additional details, please write a small LAML script for this purpose.
Parameters parsed-dtd-file-name The name of the parsed XML DTD file in the startup directory. Without extension.
language-name The name allocated to the new XML language in LAML. A symbol of your choice.
action-element-list A list of names for which to generate action procedures (list of symbols).
See also Scheme source file generate-xml-mirror
preparatory procedure xml-dtd-parse
Full tool support XML-in-LAML Mirror generation
Note After the generation of the mirror you can move the Scheme mirror file (with extension scm) to a directory of your choice.

xml-parse-file
Form (xml-parse-file in-file-name xml-language [out-file-name])
Description Parses an XML file, in-file-name, relative to the given xml-language. Return the XML-in-LAML AST if the optional parameter out-file-name is not given. The returned AST has positive white spacing (which means that white spaces are given as #t values in between constituents). Handle white space preserving elements according to the value (xml-preformatted-text-elements-in xml-language). If an out-file-name is given, write the resulting AST to the file and return a non-specified value. Validate the resulting AST if the mirror library of xml-language is loaded on beforehand.
Precondition The XML-in-LAML library in /lib/xml-in-laml.xml-in-laml.scm must be loaded before this parsing procedure is called.
Parameters in-file-name The name of an XML file, with or without the xml file extension. May be an absolute file name, or a file relative the the current directory (the value of the epression (startup-directory)).
xml-language The name of the XML language in LAML, to which the resulting AST belongs. A symbol or string.
out-file-name The name of the file on which the AST is written. A file relative to the current directory.
Returns The AST, but only if no out-file-name is given.
See also Scheme source file xml-parse-file
similar procedure xml-parse-string

xml-parse-string
Form (xml-parse-string xml-string xml-language)
Description Parses an XML string using the XML parser for LAML and delivers the corresponding XML-in-LAML AST as the result. The returned AST has positive white spacing (which means that white spaces are given as #t values in between constituents). Handle white space preserving elements according the the value (xml-preformatted-text-elements-in xml-language). This function validates the resulting AST if that the mirror of the xml-language is loaded at the time xml-parse-string is called.
Parameters xml-string The string that holds the input to the parser.
xml-language The name of the XML language in LAML, to which the resulting AST belongs. A symbol or string.
Returns An XML-in-LAML AST.
See also Scheme source file xml-parse-string
similar procedure xml-parse-file

html-parse
Form (html-parse in-file-name [out-file-name])
Description Parse the HTML file file-name (a file name with or without extension) using the HTML parser for LAML. Writes the parse tree on the optional out-file-name. This function delivers a low level parse tree, which is not the same as an XML-in-LAML AST. If possible at all, use the function xml-parse-file instead.
Parameters in-file-name The name of an HTML file, with or without the html file extension.
out-file-name The name of the file on which the parse tree is written. Defaults to the proper name of the html file with and added lsp extension.
See also Scheme source file html-parse

xml-pp
Form (xml-pp in-file-name [out-file-name single-lining indentation max-width])
Description Pretty prints the XML file or XML parse tree in in-file-name and place the pretty printed result in out-file-name. The input is assumed to be a parse tree if and only if the extension is lsp. A XML file is parsed before pretty printing via use of the simple and non-complete, non-validating XML parser from the LAML software package. The optional file out-file-name defaults to in-file-name. In this case the original input file is overwritten. If you care for your input file, it is strongly recommended that your output file does not overwrite your input file!
Parameters in-file-name The file to pretty print
out-file-name The file on which to write the pretty printed result. Default value in-file-name.
single-lining A boolean variable that controls the line breaking; False means break consistently all forms. Default #t.
indentation The increment of indentation. Default value 3.
max-width The preferred maximum line width in the pretty printed file. Default value 80.
See also Scheme source file xml-pp
Similar function pretty-render-to-output-port
Similar function pretty-xml-render
Note The pretty printing done by this function is superseded by the LAML AST pretty printing, as implemented by pretty-render-to-output-port and pretty-xml-render.

html-pp
Form (html-pp in-file-name [out-file-name single-lining indentation max-width])
Description Pretty prints the HTML file or HTML parse tree in in-file-name and place the pretty printed result in out-file-name. The input is assumed to be a parse tree if and only if the extension is lsp. A HTML file is parsed before pretty printing via use of the non-validating HTML parser from the LAML software package. The optional file out-file-name defaults to in-file-name. In this case the original input file is overwritten. If you care for your input file, it is strongly recommended that your output file does not overwrite your input file!
Parameters in-file-name The file to pretty print
out-file-name The file on which to write the pretty printed result. Default value in-file-name.
single-lining A boolean variable that controls the line breaking; False means break consistently all forms. Default #t.
indentation The increment of indentation. Default value 3.
max-width The preferred maximum line width in the pretty printed file. Default value 80.
See also Scheme source file html-pp
Similar function pretty-render-to-output-port
Similar function pretty-xml-render
Note The pretty printing done by this function is superseded by the LAML AST pretty printing, as implemented by pretty-render-to-output-port and pretty-xml-render.

bibtex
Form (bibtex file-name)
Description Parse the bibtex file, file-name, which is a bibtex file name without the bibtex extension. Put the parsed result in file-name.lsp. In addition, deliver the result in the variable parse-result. Finally, present the parsed file as HTML in file-name.html.
See also Scheme source file bibtex

scheme-pp
Form (scheme-pp in-file-name [out-file-name single-lining indentation max-width])
Description Pretty prints the Scheme or Lisp file - including comments - in in-file-name and write the result to out-file-name. Conventional comments (prefixed with semicolon) are converted with the Schemedoc procedure lexical-to-syntactical-comments! before the pretty printing. In case you don't care about comments, you should probably use lisp-pp instead. The optional file out-file-name defaults to in-file-name. In this case the original input file is overwritten. It is strongly recommended that your output file does not overwrite your input file! This function assumes that the general LAML library is loaded in advance.
Parameters in-file-name The file to pretty print
out-file-name The file on which to write the pretty printed result. Default value in-file-name.
single-lining A boolean variable that controls the line breaking; False means break consistently all forms. Default #t.
indentation The increment of indentation. Default value 3.
max-width The preferred maximum line width in the pretty printed file. Default value 80.
See also Scheme source file scheme-pp
similar function scheme-pp-simple

scheme-pp-simple
Form (scheme-pp-simple in-file-name [out-file-name single-lining indentation max-width])
Description Pretty prints the Scheme or Lisp file - without comment preservation - in in-file-name and write the result to out-file-name. The pretty printing is simple because the conventional semicolon comments are lost. The similar function scheme-pp preserves the comments during pretty printing. The optional file out-file-name defaults to in-file-name. In this case the original input file is overwritten. It is strongly recommended that your output file does not overwrite your input file! This function assumes that the general LAML library is loaded in advance.
Parameters in-file-name The file to pretty print
out-file-name The file on which to write the pretty printed result. Default value in-file-name.
single-lining A boolean variable that controls the line breaking; False means break consistently all forms. Default #t.
indentation The increment of indentation. Default value 3.
max-width The preferred maximum line width in the pretty printed file. Default value 80.
See also Scheme source file scheme-pp-simple
similar function scheme-pp

html-to-laml
Form (html-to-laml in-file-name out-file-name)
Description Convert the HTML file on in-file-name to a LAML file on out-file-name. The conversion is done by parsing in-file-name, transforming the parse tree to LAML, and by pretty printing the resulting LAML program.
See also Scheme source file html-to-laml
Note Exprimental

leno-xml
Form (leno-xml leno-xml-file)
Description Process a LENO xml file.
See also Scheme source file leno-xml
Note Experimental


7 Language settings.

language-preference
Form language-preference
Description A variable which determines which language to use in selected parts of the LAML software. The value of the variable must be a symbol. Currently we only support danish and english. english is the default value.
See also Scheme source file language-preference

text-choice
Form (text-choice danish english)
Description Return either danish or english, depending on the value of the global variable language-preference.
See also Scheme source file text-choice


8 LAML home URL and directories.
The home directory of LAML is always the value of the variable laml-dir, which is defined a LAML installation time. In this directories there are useful URL and directory functions related to the LAML home directory.

laml-absolute-url-prefix
Form laml-absolute-url-prefix
Description The URL prefix of the LAML software home page at Aalborg University's WWW server. An absolute URL to the latest distributed version of LAML.
See also Scheme source file laml-absolute-url-prefix

laml-home-url-prefix
Form (laml-home-url-prefix [extra-level start-dir])
Description Return a relative or absolute url prefix to the LAML home directory. If start-dir is given, and if start-dir is a subdirectory of laml-dir, a relative directory path is returned. In other cases, an absolute URL is returned, namely the value of the variable laml-absolute-url-prefix. The parameter extra-level is an extra level (an integer) wich extends a relative path. As an example, extra-level should be 1 in case HTML files are organized in a sub-directory. Normally, extra-level is 0 (zero). If a boolean extra-level is passed we explicitly ask for an absolute URL result. If a string extra-level is passed, we use this string as a relative path to the home. The parameter start-dir is optional. It defaults to the value of (startup-directory).
Parameters extra-level The extra level as explained above (either an integer, a boolean, or a string). Defaults to the integer 0.
start-dir The directory from which we attempt to establish a relative path to the LAML home directory. Defaults to the value of the expression (startup-directory).
See also Scheme source file laml-home-url-prefix
applied function startup-directory

laml-dir-prefix
Form (laml-dir-prefix [dir])
Description Return the relative or absolute prefix file path from dir to the root directory of the LAML software. If dir is a subdirectory of laml-dir, return the relative path from dir to laml-dir. If not, return the absolute path laml-dir
Parameters dir An absolute directory path, inside or outside laml-dir. Defaults to the value of (startup-directory).
Returns If possible, the relative directory path from dir to laml-dir. Else laml-dir
See also Scheme source file laml-dir-prefix
similar function laml-local-url-prefix

laml-local-url-prefix
Form (laml-local-url-prefix [dir])
Description Return the relative or absolute url to the local laml dir. The URL function corresponding to laml-dir-prefix. If dir is a subdirectory of laml-dir, return the relative path from dir to laml-dir. If not, return the absolute file:// prefixed URL to the laml directory.
Parameters dir An absolute directory path, inside or outside laml-dir. Defaults to the value of (startup-directory).
Returns If possible, the relative url from dir to laml-dir. Else laml-dir prefixed with "file://"
See also Scheme source file laml-local-url-prefix
similar function laml-dir-prefix

is-a-laml-directory?
Form (is-a-laml-directory? dir)
Description Is the directory dir a (potential) subdirectory of laml-dir. It is not necessary for dir to actually exist within laml-dir. laml-dir is the path to the directory, in which your LAML system is installed.
See also Scheme source file is-a-laml-directory?


9 Document prolog and epilog functions.
This section contains definitions of document prolog and epilog functions. In addition, there are a number of more basic functions which return information about the document. Several of these return empty strings, and they intended to be redefined in other contexts.

standard-prolog
Form (standard-prolog [language])
Description Return a standard document prolog - front matters - inserted before any document elements. If requested, the rendering function can insert the standard prolog. In some contexts, the standard prolog may depend on the optional language parameter.
Returns The document type declaration and the copyright-clause.
See also Scheme source file standard-prolog

standard-epilog
Form (standard-epilog [language])
Description Returns a standard document epilog - end matters - inserted after the document elements. If requested, the rendering function can insert the standard epilog. In some contexts, the standard epilog may depend on the optional language parameter.
Returns the laml standard comment and the tracing comment.
See also Scheme source file standard-epilog

document-type-declaration
Form (document-type-declaration [language])
Description Return a document type declaration. This function is redefined in the individual mirrors. Called by standard-prolog. In some contexts, the document type declaration may depend on the optional language parameter.
Returns the empty string (if not redefined)
See also Scheme source file document-type-declaration

copyright-clause
Form (copyright-clause)
Description Return an HTML comment with a copyright notice, or an empty string. You can redefine this function if you need a copyright message as part of your document. If you redefine this function, it must return an HTML/XML comment. Called by standard-prolog.
Returns the empty string (if not redefined)
See also Scheme source file copyright-clause

laml-standard-comment
Form (laml-standard-comment)
Description Return a standard comment about LAML. Depends on the function html-comment. Called by standard-epilog.
Returns an HTML comment about LAML.
See also Scheme source file laml-standard-comment

tracing-comment
Form (tracing-comment)
Description Return a HTML comment which somehow traces this document. Typical information includes source file, time of generation, operating system, Scheme systemt, etc. Redefine this function if you need tracing information in your document.
Returns the empty string (if not redefined)
See also Scheme source file tracing-comment


10 Cosmetic welcome, ending and copyright functions.

laml-welcome
Form (laml-welcome)
Description Initiating welcome and info text for interactive LAM tools. As of now this is entirely cosmetic.
See also Scheme source file laml-welcome

end-laml
Form (end-laml)
Description This function is intended to end a LAML file. It is strongly recommended that any LAML file - in particular XML-in-LAML file - calls end-laml as the last action. Reports on elapsed processing time (currently only in MzScheme and Guile). Checks ID attributes and links (only from XML-in-LAML contexts, via redefine version of this function). A redefined version of end-laml in xml-in-laml.scm - used for xml-in-laml processing - calls this function (in addition to xml-in-laml relevant stuff).
See also Scheme source file end-laml
related function begin-laml
redefinition in XML-in-LAML end-laml

credits
Form (credits system-dk system-eng [system-url])
Description Return a credit message to Kurt Nørmark about system-dk (the Danish name) and system-eng (the English name). As an optional parameter, an URL can be supplied with a link to the credited system.
Parameters system-dk The system name in Danish
system-eng The system name in English
system-url A URL referring to a WWW description of the system
See also Scheme source file credits

laml-power-icon
Form (laml-power-icon [extra-level icon-size])
Description Return the LAML POWER icon with link to the LAML home page. Intended for the footer of LAML generated pages, from which the author wish to acknowledge the use of LAML. The LAML icon is located in the directory (string-append (laml-home-url-prefix extra-level) "images/"), where extra-level is the optional parameter of the current function. The optional parameter extra-level can be given if the generated HTML files are placed in a different directory than the startup directory. The default value is 0. The optional parameter icon-size can either be small or large. large is the default value. The role of extra-level is the same as in the procedure laml-home-url-prefix.
See also Scheme source file laml-power-icon
related procedure laml-home-url-prefix

laml-shortcut-icon
Form (laml-shortcut-icon laml-home-url-dir)
Description Generate a LAML shortcut icon from the current directory (the startup-directory). Shortcut icons are in some browsers shown as a tiny picture in the navigation tool bar, and together with bookmarks.
Precondition The HTML link mirror function must be defined for this function to work.
Parameters laml-home-url-dir A path from the current directory to the LAML home directory. Typically the value of (laml-home-url-prefix).
See also Scheme source file laml-shortcut-icon


11 XML file writing procedures.
In this section we have a convenient and versatile function which can be used to write an XML expression in LAML to a text file.

write-xml
Form (write-xml mode xml-clause [file-path-with-extension])
Description Write xml-clause (an XML-in-LAML ast) to a text file. Use the character transformation table assigned to the XML language of xml-clause, as availble via the expression (xml-char-transformation-table-in language). This procedure also collects links for later checking, and it expands procedural content items. The full path to the text file can be given by the third, optional parameter, the default value of which is (full-source-path-with-extension "html"). Mode may be a symbol (raw or pp), or a list of symbols including one of raw/pp and the symbols prolog and epilog. The latter determines the rendering of the standard prolog and the standard epilog, as defined by the functions standard-prolog and standard-epilog (in this file). If mode is the symbol pp, do pretty print the XML fragment before writing. If mode is raw, just write the xml clause without any kind of pretty printing. As the last action, activate a post processor function on the full file path to the XML target file name. If the file extension of the target file is e, the name of the post processor is (string-append e "-" "process"). (The post processor may, for instance, be used to transform an XSL-FO to PDF.)
Parameters mode a list with one or more of the symbols raw, pp, prolog, and epilog. Alternatively just one of the symbols pp or raw.
xml-clause the ast to be written.
file-path-with-extension the path of the file on which to write. Must include the file extension, typically html. Defaults to the name of the current source file with extension '.html'.
See also Scheme source file write-xml
default target file full-source-path-with-extension
prolog and epilog standard-prolog standard-epilog
Note This procedure is a renamed, XML-in-LAML only version of the procedure write-html

process-xml
Form (process-xml processing-specs file-path ast)
Description Process the ast according to the processing-specs and write the resulting XML files to files determined by file-path. More specifically, the AST is processed once for each processing-spec, by calling write-xml for each processing specification in processing-specs. As part of calling write-xml, the post processing facility may be activated (for instance for processing an XSL-FO file). A processing spec is a list (ext transformer . mode-symbols), where ext is the file extension, transformer is an AST transformation function, and mode-symbols is a list of symbols in the set {pp raw prolog epilog}.
Parameters ast The XML-in-LAML AST to be processed.
processing-specs A list of processing specifications.
file-path An absolute file path with or without file extension. The final file extension is determined by the first element of the processing-spec
See also Scheme source file process-xml
called function write-xml

write-html
Form (write-html mode html-clause [file-path-with-extension])
Description Write html-clause (a string or an ast) to a text file. When used on XML-in-LAML asts, this procedure also collects links (for later checking), and it expands procedural content items. The full path to the text file can be given by the third, optional parameter, the default value of which is (full-source-path-with-extension "html"). Mode may be a symbol (raw or pp), or a list of symbols including one of raw/pp and the symbols prolog and epilog. The latter determines the rendering of the standard prolog and the standard epilog, as defined by the functions standard-prolog and standard-epilog (in this file). If mode is the symbol pp, do pretty print the HTML fragment before writing. If mode is raw, just write the html clause without any kind of pretty printing. This procedure loads the LAML xml-html-support pretty printing stuff if needed. This procedure works on both the ast based (including XML-in-LAML) and the text based mirrors. In case html-clause is an AST, the tree is processed by an AST rendering function before the file writing takes place. In case hmtl-clause is an XML-in-LAML AST, it is expanded with respect to procedural content items before the writing takes place. There are still a few minor problems with the HTML pretty printer.
Parameters mode a list with one or more of the symbols raw, pp, prolog, and epilog. Alternatively just one of the symbols pp or raw.
html-clause the string or ast to be written
file-path-with-extension the path of the file on which to write. Must include the file extension, typically html. Defaults to the name of the current source file with extension '.html'.
See also Scheme source file write-html
default target file full-source-path-with-extension
prolog and epilog standard-prolog standard-epilog
Note This procedure is the original, broader version of write-xml.


12 The HTML character transformation table.
This table is used by the HTML rendering function to transliterate char data to textual contents, as to be shown in a browser. You can use this table to perform transformation of national characters to HTML character entities, and to perform other character transliterations.

html-char-transformation-table
Form html-char-transformation-table
Description A vector of length 256 which transforms character number i to a string. Position number i determines how the (extended) ASCII character i is transformed. Boolean entry #t means 'do not transform'. Boolean entry #f means 'ignore char'. A string entry describes a proper transformation. A char entry describes a proper transformation. An integer entry describes a transformation to the corresponding character number. All other entries are illegal. The table represent the identity transformation (all characters are mapped to the value #t). Use the function set-html-char-transformation-entry! for mutation of individual entries.
See also Scheme source file html-char-transformation-table
mutation function set-html-char-transformation-entry!

set-html-char-transformation-entry!
Form (set-html-char-transformation-entry! transformation-table index new-entry)
Description Mutate a html character transformation table at position index. More specifically, put new-entry at position index in the table. The first entry in the table has index 0.
Parameters transformation-table Typically the vector html-char-transformation-table
index a number between 0 and 255
new-entry The new entry, which can be boolean, a string, a character, or an integer. Boolean true means 'Do not transform character'. Boolean false means 'Ignore character' (outputs the empty string). A string means: 'Transform char to the given string'. An integer number means: 'Transform char to the char with the given number'. A character means: 'Transform to the given char'.
See also Scheme source file set-html-char-transformation-entry!
info about table html-char-transformation-table

html-char-transform
Form (html-char-transform char [transformation-table])
Description Return the transformation of char via a character transformation table. Chararcters outside the range [0..255] are just passed through, in case an extended character set is used.
Parameters char A character to be transformed.
transformation-table A character transformation table, which defaults to html-char-transformation-table defined in laml.scm
Returns A string (the transformation of character)
See also Scheme source file html-char-transform


13 R4RS and R5RS Scheme knowledge.
The section contains accessor and loading functions to R4RS and R5RS Scheme knowledge files. The Scheme knowledge files are located in the r4rs and the r5rs directories of the full LAML distribution. The r4rs and r5rs directories each hold a HTML version of the Scheme Report. Overall, a Scheme knowledge file is a mapping from syntax/procedure name to an URL in the Scheme Report. More precisely, a Scheme knowledge file is a list of entries, each of which contains the name of a Scheme form, the categorization of the form, and the URL of place, where form is described (in a compact format). Scheme knowledge files have extensions lsp.

read-scheme-knowledge
Form (read-scheme-knowledge scheme-version)
Description Read and the return the list structure for Scheme knowledge of RnRS, where n corresponds to scheme-version (a number).
Parameters scheme-version either 4 or 5 (integer numbers). Alternatively r4rs or r5rs (symbols).
Returns The list structure of Scheme knowledge
See also Scheme source file read-scheme-knowledge

symbol-of-scheme-knowledge
Form symbol-of-scheme-knowledge
Description Selects the name of a scheme knowledge entry.
See also Scheme source file symbol-of-scheme-knowledge

category-of-scheme-knowledge
Form category-of-scheme-knowledge
Description Selects the category of a scheme knowledge entry.
See also Scheme source file category-of-scheme-knowledge

essentiality-of-scheme-knowledge
Form essentiality-of-scheme-knowledge
Description Selects the essentiality of a scheme knowledge entry.
See also Scheme source file essentiality-of-scheme-knowledge

file-number-of-scheme-knowledge
Form file-number-of-scheme-knowledge
Description Selects the HTML file number of a scheme knowledge entry.
See also Scheme source file file-number-of-scheme-knowledge

anchor-name-of-scheme-knowledge
Form anchor-name-of-scheme-knowledge
Description Selects the anchor name of a scheme knowledge entry.
See also Scheme source file anchor-name-of-scheme-knowledge

url-suffix-of-scheme-knowledge
Form (url-suffix-of-scheme-knowledge entry scheme-version)
Description Return the suffix part of an URL to an RnRS Scheme HTML file.
Precondition The Scheme knowledge of RnRS corresponding to n = scheme-version must be read on beforehand, and the entry must be Scheme knowledge of an RnRS entry.
Parameters an entry in a Scheme knowledge file.
scheme-version either 4 or 5 (integer numbers). Alternatively r4rs or r5rs (symbols).
See also Scheme source file url-suffix-of-scheme-knowledge


14 Miscellaneous.

kn-manual-settings
Form (kn-manual-settings [abstract-clause])
Description The LAML Manual/SchemeDoc standard settings. The list returned is to be a constituent of laml-front-matters element of a LAML SchemeDoc manual.
Parameters abstract-clause A manual abstract form.
Returns A list of attributes and constituents of laml-front-matters.
See also Scheme source file kn-manual-settings
manual mirror function laml-front-matters
category ref1 ref2
Note I usually keep this and similar functions in my .laml file. A version in the .laml file will overwrite this function.

kn-xml-in-laml
Form (kn-xml-in-laml [with-icon])
Description The LAML author's name and address information.
Parameters with-icon A boolean value which enables display of the LAML icon.
See also Scheme source file kn-xml-in-laml
Note I usually keep this and similar functions in my .laml file. A version in the .laml file will overwrite this function.

laml-library-source-linking
Form (laml-library-source-linking)
Description A collection of scheme-source-linking-manual clauses which provides for linking from Scheme Sources to LAML manuals. The boolean SchemeDoc attribute named scheme-source-linking controls the generation of Scheme source linking from SchemeDoc manuals.
See also Scheme source file laml-library-source-linking
SchemeDoc scheme-source-linking-manual
Used by kn-manual-settings

Generated: Monday, November 14, 2011, 09:13:19
Generated by LAML SchemeDoc using LAML Version 38.0 (November 14, 2011, full)