mirror of
https://github.com/Mercury-Language/mercury.git
synced 2025-12-17 14:57:03 +00:00
Estimated hours taken: 0.5
scripts/{c2init,mnc,mnl,msc,msl}.in:
Fix a portability problem: ULTRIX's /bin/sh does not understand
`shift 2', so I've replaced all occurrences of this with
`shift; shift'. (Thanks to Jeff Schultz for the bug report.)
54 lines
1.6 KiB
Bash
Executable File
54 lines
1.6 KiB
Bash
Executable File
#! /bin/sh
|
|
# @configure_input@
|
|
#---------------------------------------------------------------------------#
|
|
# Copyright (C) 1995 University of Melbourne.
|
|
# This file may only be copied under the terms of the GNU General
|
|
# Public License - see the file COPYING in the Mercury distribution.
|
|
#---------------------------------------------------------------------------#
|
|
|
|
# C2INIT - Convert *.c to *_init.c
|
|
#
|
|
# This script outputs an appropriate init.c, given the .c files.
|
|
# Type `c2init --help' for usage message.
|
|
#
|
|
# Environment variables: MERCURY_MOD_LIB_DIR, MERCURY_MOD_LIB_MODS,
|
|
# MERCURY_MKINIT.
|
|
|
|
MERCURY_MOD_LIB_DIR=${MERCURY_MOD_LIB_DIR=@LIBDIR@/modules}
|
|
MERCURY_MOD_LIB_MODS=${MERCURY_MOD_LIB_MODS=$MERCURY_MOD_LIB_DIR/*}
|
|
MKINIT=${MERCURY_MKINIT=mkinit}
|
|
|
|
# maximum number of calls to put in a single function
|
|
maxcalls=40
|
|
defentry=mercury__io__run_0_0
|
|
while true; do
|
|
case "$1" in
|
|
-c|--max-calls)
|
|
maxcalls="$2"; shift; shift;;
|
|
-w|--entry-point)
|
|
defentry="$2"; shift; shift;;
|
|
--)
|
|
shift; break;;
|
|
-*)
|
|
echo "Usage: c2init [options] modules ..." 1>&2
|
|
echo "Options: " 1>&2
|
|
echo "-c <n>, --max-calls <n>" 1>&2
|
|
echo " Break up the initialization into groups of at" \
|
|
"most <n> function calls" 1>&2
|
|
echo " (Default value of <n> is 40)" 1>&2
|
|
echo "-w <label>, --entry-point <label>" 1>&2
|
|
echo " Set entry point to <label>" 1>&2
|
|
echo " (Default value is \`mercury__io__run_0_0')" 1>&2
|
|
exit 1;;
|
|
*)
|
|
break;;
|
|
esac
|
|
done
|
|
|
|
case $# in
|
|
0) exec $MKINIT -w"$defentry" -c"$maxcalls" $MERCURY_MOD_LIB_MODS
|
|
;;
|
|
*) exec $MKINIT -w"$defentry" -c"$maxcalls" "$@" $MERCURY_MOD_LIB_MODS
|
|
;;
|
|
esac
|