Examples are now working. Simple module system
[email protected] Fri, 6 Aug 2004 16:29:03 -0700 (PDT)
| Newsgroups | gmane.lisp.scheme.ssax-sxml |
|---|---|
| Message-ID | <[email protected]> |
Hello!
SSAX-SXML examples, SSAX/examples, have been adjusted to
run with any Scheme system. Some time ago Michael Sperber has
announced that the examples run with Scheme48 and the latest version
of SSAX. Now, Makefile and the infrastructure have been adjusted to run
the examples with any Scheme system. I have tested with SCM, Petite
Chez Scheme, and Bigloo.
The biggest change is the integration of packages.scm into the
build system. Now Makefile uses the data from packages.scm to find all
files that provide imports for an example, `load' those files in a
platform-specific way, and build and run the example.
A new program examples/build-dependencies.scm reads
examples/packages.scm and lib/packages.scm, builds the transitive
closure of imported `structures' and the corresponding files, and
writes out a file examples/target-dependencies. The latter describes
the imports for each target in the examples/ directory. The Makefile
`includes' the file examples/target-dependencies and uses its data to
build the target for each specific platform. Thus, in a very poor-man
way, the Scheme48 module system is extended to many other Scheme systems.
See the extensive title comments in the file
examples/build-dependencies.scm for more details.
The Makefile has become far more generic -- and far
smaller. All the work is done by a single rule:
$($(PLATFORM)-targets):
$(call make-$(PLATFORM),\
$(call filter-$(PLATFORM),$(strip $($@-depend))),\
$@,$($@-$(PLATFORM)-post))
which obtains the dependency list of a target, filters it in a
platform-specific way, and has a platform-specific rule transform
the list of dependencies into platform-specific instructions to
`load', `include', `link', etc. those files and thus build the target.
As you can see, the above Makefile rule is purely applicative, with
triply-nested functions.
The example daml-parse-unparse is no longer
Bigloo-specific. Rather, it is R5RS. Incidentally, the example
includes a `match-case-simple' linear pattern matcher, written
in R5RS syntax-rules. The matcher supports pattern and dont-care
variables, simple list patterns, and guards. For example, the `entag'
function now reads
(define (entag tag elems)
(match-case-simple elems
((('@ . attrs) . children) ()
(list #\< tag attrs
(if (null? children) "/>"
(list #\> children "</" tag #\>))))
(() () (list #\< tag "/>"))
(else
(list #\< tag #\> elems "</" tag #\>))))
Mike: the examples
run-sxml, html-parser, daml-parse-unparse
are missing from examples/packages.scm. Could you add them?
-------------------------------------------------------
This SF.Net email is sponsored by OSTG. Have you noticed the changes on
Linux.com, ITManagersJournal and NewsForge in the past few weeks? Now,
one more big change to announce. We are now OSTG- Open Source Technology
Group. Come see the changes on the new OSTG site. www.ostg.com