Home My Page Projects Code Snippets Project Openings SML/NJ
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files

SCM Repository

[smlnj] View of /config/releases/release-110.66/_ml-build
ViewVC logotype

View of /config/releases/release-110.66/_ml-build

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1656 - (download) (annotate)
Wed Oct 20 20:05:45 2004 UTC (14 years, 10 months ago) by mblume
Original Path: sml/trunk/config/_ml-build
File size: 1513 byte(s)
support for back-trace in standalone programs
#!@SHELL@

if [ x${SMLNJ_HOME} = x ] ; then
    BIN_DIR=@BINDIR@
else
    if [ x${CM_PATHCONFIG} = x ] ; then
	CM_PATHCONFIG=${SMLNJ_HOME}/lib/pathconfig
	export CM_PATHCONFIG
    fi
    BIN_DIR=${SMLNJ_HOME}/bin
fi

SML=$BIN_DIR/sml
LINK=$BIN_DIR/.link-sml

thisscript=$0

xx=$$
smlfile=$xx-export.sml
cmfile=$xx-export.cm
listfile=$xx-BOOTLIST
linkargsfile=$xx-LINKARGS

dulist=''

trap 'rm -rf $smlfile $cmfile $listfile $linkargsfile @CMDIRARC@/*/$smlfile' 0 1 2 3 15

usage() {
    echo ${thisscript}: $*
    echo Usage: $thisscript root-group main-function heapfile
    exit 1
}

while [ $# != 0 ] ; do
    case $1 in
    -D*|-U*|-C*)
	dulist="$dulist $1"
	shift
	;;
    *)
	break
	;;
    esac
done

if [ $# = 3 ] ; then
    setup=
    root=$1
    main=$2
    heap=$3
elif [ $# = 4 ] ; then
    setup=$1
    root=$2
    main=$3
    heap=$4
else
    usage wrong number of arguments
fi

rare=XYZ_XXX_0123

cat >$smlfile <<EOF
structure ${rare} = struct val _ = SMLofNJ.exportFn ("${heap}", ${main}) end
EOF

cat >$cmfile <<EOF
Group structure ${rare} is \$/basis.cm ${root} ${smlfile}
EOF

# Invoke sml with special option that causes CM to do its magic.
# Unless the heap image exists and is up-to-date CM will write the arguments
# for the link script into $linkargsfile.
# (See src/cm/main/cm-boot.sml [function "mlbuild"] for details.)
if $SML $dulist @CMbuild $setup $root $cmfile $heap $listfile $linkargsfile
then
    if [ -r $linkargsfile ]; then
	$LINK `cat $linkargsfile`
    fi
else
    exit $?
fi

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0