[m-dev.] diff: nested modules & init files bug fix

Fergus Henderson fjh at cs.mu.OZ.AU
Sat May 30 20:45:00 AEST 1998


On 30-May-1998, Fergus Henderson <fjh at cs.mu.OZ.AU> wrote:
> util/mkinit.c:
> scripts/c2init.c:
> 	For efficiency, change c2init and mkinit so that when c2init's
> 	arguments are `.c' files, it computes the init function based
> 	on the filename (like it used to do with `.m' files), rather
> 	than by reading the file contents and searching for "** INIT"
> 	comments.  Add a new option `-x' (`--extra-inits') which keeps
> 	the old behaviour.

Oops, that should be `c2init.in' not `c2init.c'.

Index: c2init.in
===================================================================
RCS file: /home/mercury1/repository/mercury/scripts/c2init.in,v
retrieving revision 1.14
diff -u -u -r1.14 c2init.in
--- c2init.in	1997/09/06 12:04:15	1.14
+++ c2init.in	1998/05/30 10:41:06
@@ -17,7 +17,7 @@
 # that the manpage still looks OK.
 Help="\
 Name:	c2init - Create Mercury initialization file.
-Usage:	c2init [options] modules ...
+Usage:	c2init [options] *.c *.init ...
 Options: 
 	-l, --library
 		Don't generate a \`main()' function.
@@ -26,6 +26,12 @@
 		(declared in \"init.h\") that can be called from C code.
 		(A more fine-grained interface is also available;
 		see \"init.h\" for details.)
+	-x, --extra-inits
+		Search \`.c' files for extra initialization functions.
+		(This may be necessary if the C files contain
+		hand-coded low-level C code with \`** INIT' comments,
+		rather than containing only C code that was
+		automatically generated by the Mercury compiler.)
 	-c <n>, --max-calls <n>
 		Break up the initialization into groups of at most <n> function
 		calls.  (Default value of <n> is 40.)
@@ -47,6 +53,7 @@
 maxcalls=40
 defentry=mercury__main_2_0
 library_opt=""
+extra_inits_opt=""
 while true; do
 	case "$1" in
 	-c|--max-calls)
@@ -57,6 +64,10 @@
 		library_opt="-l"; shift;;
 	-l-|--no-library)
 		library_opt=""; shift;;
+	-x|--extra-inits)
+		extra_inits_opt="-x"; shift;;
+	-x-|--no-extra-inits)
+		extra_inits_opt=""; shift;;
 	-h|--help|"-?")
 		echo "$Help"
 		exit 0;;
@@ -73,9 +84,9 @@
 
 case $# in
 	0) exec $MKINIT -w"$defentry" -c"$maxcalls" $library_opt \
-		$MERCURY_MOD_LIB_MODS
+		$extra_inits_opt $MERCURY_MOD_LIB_MODS
 	   ;;
 	*) exec $MKINIT -w"$defentry" -c"$maxcalls" $library_opt \
-		"$@" $MERCURY_MOD_LIB_MODS
+		$extra_inits_opt "$@" $MERCURY_MOD_LIB_MODS
 	   ;;
 esac
-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>  |  of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3        |     -- the last words of T. S. Garp.



More information about the developers mailing list