lout-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Literate programming with Lout


From: kahl
Subject: Re: Literate programming with Lout
Date: Thu, 6 Jun 2002 03:01:28 +0400 (MSD)

Clint Olsen <address@hidden>, too, wants to do
LitProg in Lout:

 > 
 > My concern of course is making sure that you can embed the C code (where
 > explicitly requested) so you don't have to write code snippets twice.

I have an OCaml program ``loutfw'' that I use with @Filter to produce a
FunnelWeb file (containing mostly Haskell code ;-).
I use FunnelWeb because it allows me to create many output files,
and in different langauges.
loutfw is a glorified ``tee -a lout.fw'' ---
you could experiment with using that instead.
It is not documented, and not nice --- sorry.

It would of course be preferrable (and probably not too hard)
to add Lout as an alternative typesetting mechanism to FunnelWeb itself.


Wolfram

========================================================

FunnelWeb: http://www.ross.net/funnelweb/
OCaml:     http://caml.inria.fr/


===============Makefile fragment========================
fw:
@<TAB@>rm -f lout.fw
@<TAB@>lout1 $SOURCEDIR/$MAIN.lt && xfw lout.fw
========================================================

FunnelWeb-Lout definition for the TAB macro used above:

========================================================
@LP
@FunnelWeb @Begin
@$@<TAB@>@address@hidden@address@hidden
@^D(009)@-
@}
@End @FunnelWeb
@LP
========================================================
Don't use one-line FunnelWeb definitions with loutfw!


Filter definition:
(@FwHide has to be defined with flags to loutfw)
                   
========================================================
    ###########################################################################
    #                                                                         #
    #   @FunnelWeb (Wolfram Kahl)                                             #
    #                                                                         #
    ###########################################################################

    def @FunnelWeb right x
    {
        def @Filter {
            loutfw @FwHide @FilterIn @FilterOut
        }
        {lines 0.99fx} @Break {Courier Base -2p} @Font x
    }
========================================================

Wrapper for lout:

=======lout1============================================
#!/bin/sh
FILE=$1
shift
NAME=`basename $FILE .lt`
DIR=`dirname $FILE`
if [ "$DIR" == "." -o "$DIR" == "`pwd`" ]
then
   echo "Working on ./$NAME.lt"
else
   rm -f $NAME.lt
   cp $DIR/$NAME.lt .
fi
lout -c $NAME $* $NAME.lt > $NAME.ps

========================================================

Wrapper for FunnelWeb:

=======xfw=============================================
#!/bin/sh
FILE=$1
NAME=`basename $FILE .fw`
DIR=`dirname $FILE`
shift
if [ "$DIR" != "." -a "$DIR" != "`pwd`" ]
then
  sed -e "s|@<xfw DATE@>|`date`|g" $DIR/$NAME.fw > $NAME.fw
fi
fw +D $* $NAME.fw || less $NAME.lis


========================================================

The program has a few flags

Attachment: loutfw.ml
Description: Binary data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]