Software

OCaml Logging Commands

This syntax extension provides simple logging with per-module
conditional output for OCaml. Extending the syntax allows us to
provide "lazy" evaluation of debug statements. Because of strict
evaluation, functions like

let log_if p s = if p then print_string s else ()

are forced to evaluate their arguments when p is false. Typically,
when logging is turned off, we would like to avoid evaluating
logging statements as much as possible.

Command-line options

-dprintf FUN_EXPR : use FUN_EXPR as
the debug logging printer. FUN_EXPR should be an OCaml
expression with type ('a, formatter, unit) format ->
'a (i.e., the same as Format.printf).

-lprintf FUN_EXPR : use FUN_EXPR as
the logging printer. FUN_EXPR should be an OCaml
expression with type ('a, formatter, unit) format ->
'a (i.e., the same as Format.printf).

What this extension does not do

Statically prevent logging code from appearing in the
executable. _DEBUG will generate a dynamic check on the debug
level. Using this extension will have a (probably negligible)
effect on running time and code size, even with logging turned
off.

OCaml Command-line Macros with Values

This is an add-on to the standard Pa_macro syntax extension which
allows for command-line arguments of the form
-DEFuid=expr where uid is an
upper-case identifier (a macro name) and expr is an arbitrary
OCaml expression.

Printing LNCS papers 2-up

I have an obsessive-compulsive problem with the default
formatting of LNCS papers on letter or A4 paper: the font is too large
and the margins are too wide. This Bash script takes an LNCS-formatted
Postscript or PDF file and generates a 2-per-page formatted Postscript
file, using acroread (for PDF inputs) and
pstops. The settings are what works on my system: the
pstops arguments will probably have to be tweaked on a
per-site basis. See this blog post for more information.