Module index

source download

Module: embed

Author: Ralph Ronnquist, Real Thing Entertainment Pty. Ltd.
Location: http://www.realthing.com.au/files/newlisp/embed.lsp
Version: 1.0

Utility for embedding

This is a utility module for producing an embedded newlisp program, including all loaded source. It instruments the "load" function to use an embedded source if such exists, or else to capture the external file for embedding. Embedding is a three-stage procedure:



syntax: (embed-save main-file)
parameter: main-file - is the name of the main file to append.
When invoked for creating the embedding base, the embed-save function writes this as an embeddable source file for the application and exits.

The embedding base constists of a preamble that is a snapshot of the Embed context, which in particular includes the embedded variable as set up with all loaded files, and its initial variable set to false. This is followed by action clauses to redirect the load function to embed-load, which uses the embedded sources rather than loading external files. Finally the given main file is appended.

When invoked in the embedded appliation, embed-save just returns without ado.



syntax: (embed-load filename)
The embed-load function replicates the standard load function, but taking its input from pre-loaded files from the embedded alist, if possible, and otherwise capturing those that are read in into the embedded ailst.

- ∂ -

generated with newLISP  and newLISPdoc