fxp patches

Fxp comprises a library and sample applications for parsing and manipulating XML documents. It is written in Standard ML.

I have used Fxp in an SML application that processes XML-formatted input; it works well. Fxp is also remarkably portable, depending only on a minimum of features from the SML Basis Library, despite supporting Unicode encodings.

The patches downloadable from this page,

  • incorporate Kevin S. Millikin's patches for compilation under working versions (110.65) of SML/NJ,
  • incorporate Wesley W. Terpstra's patches for MLton,
  • update the Compilation Manager (.cm) files to enable library stabilisation, and simultaneous use of both blessed and working versions of SML/NJ, and,
  • include a script and minor patches for compilation, under Windows, with sml.net,
  • include two minor patches for compilation with Poly/ML.

The patches do not update the makefile. The FreeBSD port includes most of the patches and an updated (pmake) makefile.

To apply the patches:

  1. Download and extract the Fxp source files.
  2. Download the patch file and apply with patch -p0 < fxp-2.0.patch

Building the applications

SML/NJ (blessed and working)

Use the makefile (with minor modifications for the working version), to create an SML/NJ heap and script file. SML/NJ must be installed to run the applications.

SML/NJ (working version under Unix)

Use the ml-build and heap2exec utilities to create stand-alone executables (SML/NJ is not required to run them).

ml-build src/Apps/Null/null.cm Null.null fxp
heap2exec fxp.x86-* fxp
ml-build src/Apps/Canon/canon.cm Canon.canon fxcanon
heap2exec fxcanon.x86-* fxcanon
ml-build src/Apps/Copy/copy.cm Copy.copy fxcopy
heap2exec fxcopy.x86-* fxcopy
ml-build src/Apps/Esis/esis.cm Esis.esis fxesis
heap2exec fxesis.x86-* fxesis
ml-build src/Apps/Viz/viz.cm Viz.viz fxviz
heap2exec fxviz.x86-* fxviz

MLton (Unix, or Windows with Cygwin or MinGW)

Build stand-alone executables with mlton.

mlton -output fxp src/Apps/Null/null.mlb
mlton -output fxcanon src/Apps/Canon/canon.mlb
mlton -output fxcopy src/Apps/Copy/copy.mlb
mlton -output fxesis src/Apps/Esis/esis.mlb
mlton -output fxviz src/Apps/Viz/viz.mlb

sml.net (windows with .net framework components)

Use the script to build stand-alone Windows executables.

smlnet @src/fxlib

Using the library

SML/NJ Blessed version (110.7)

First stabilise the library, from within the interactive loop, to speed up interactive development cycles.

CM.stabilize' ("src/fxlib.cm", true);

Before using the fxp signatures and structures, type:

CM.make' "src/fxlib.cm";

The same path to fxlib.cm can be added to custom .cm files.

SML/NJ Working version (110.65+)

First, define an anchor by adding a line to either /usr/local/smlnj/lib/pathconfig or $HOME/.smlnj-pathconfig:

fxlib.cm /usr/local/lib/fxp-2.0/src

Then, stabilise the library, from within the interactive loop, to speed up interactive development cycles.

CM.stabilize true "$/fxlib.cm";

Before using the fxp signatures and structures, type:

CM.make "$/fxlib.cm";

The same reference to $/fxlib.cm can be added to custom .cm files.


Add the path to fxlib.mlb to custom .mlb files when required.


Edit the fxlib.smlnet script by commenting out the last 25 lines. Then process the script before any others that require the Fxp signatures and structures.