[m-rev.] diff: initialization function

Zoltan Somogyi zs at cs.mu.OZ.AU
Mon May 9 18:09:36 AEST 2005


This has already been reviewed by Ralph.

Zoltan.

util/mkinit.c:
	Provide a mechanism that allows the user to specify that a certain
	function should always be executed on Mercury startup. This is intended
	to be used to initialize global variables that point to Mercury data.
	This is useful e.g. in constraint solvers, because it removes the need
	for the solver to check, on every access to its state, whether it has
	been initialized yet.

scripts/parse_ml_options-sh-subr.in:
scripts/c2init.in:
	Pass along the required option to mkinit.

scripts/Mmakefile:
	Provide a mechanism to automatically rebuild c2init and other
	configured files when ../config.status changes.

cvs diff: Diffing .
cvs diff: Diffing analysis
cvs diff: Diffing bindist
cvs diff: Diffing boehm_gc
cvs diff: Diffing boehm_gc/Mac_files
cvs diff: Diffing boehm_gc/cord
cvs diff: Diffing boehm_gc/cord/private
cvs diff: Diffing boehm_gc/doc
cvs diff: Diffing boehm_gc/include
cvs diff: Diffing boehm_gc/include/private
cvs diff: Diffing boehm_gc/tests
cvs diff: Diffing browser
cvs diff: Diffing bytecode
cvs diff: Diffing compiler
cvs diff: Diffing compiler/notes
cvs diff: Diffing debian
cvs diff: Diffing deep_profiler
cvs diff: Diffing deep_profiler/notes
cvs diff: Diffing doc
cvs diff: Diffing extras
cvs diff: Diffing extras/aditi
cvs diff: Diffing extras/cgi
cvs diff: Diffing extras/complex_numbers
cvs diff: Diffing extras/complex_numbers/samples
cvs diff: Diffing extras/complex_numbers/tests
cvs diff: Diffing extras/concurrency
cvs diff: Diffing extras/curs
cvs diff: Diffing extras/curs/samples
cvs diff: Diffing extras/curses
cvs diff: Diffing extras/curses/sample
cvs diff: Diffing extras/dynamic_linking
cvs diff: Diffing extras/error
cvs diff: Diffing extras/graphics
cvs diff: Diffing extras/graphics/easyx
cvs diff: Diffing extras/graphics/easyx/samples
cvs diff: Diffing extras/graphics/mercury_glut
cvs diff: Diffing extras/graphics/mercury_opengl
cvs diff: Diffing extras/graphics/mercury_tcltk
cvs diff: Diffing extras/graphics/samples
cvs diff: Diffing extras/graphics/samples/calc
cvs diff: Diffing extras/graphics/samples/gears
cvs diff: Diffing extras/graphics/samples/maze
cvs diff: Diffing extras/graphics/samples/pent
cvs diff: Diffing extras/lazy_evaluation
cvs diff: Diffing extras/lex
cvs diff: Diffing extras/lex/samples
cvs diff: Diffing extras/lex/tests
cvs diff: Diffing extras/logged_output
cvs diff: Diffing extras/moose
cvs diff: Diffing extras/moose/samples
cvs diff: Diffing extras/moose/tests
cvs diff: Diffing extras/morphine
cvs diff: Diffing extras/morphine/non-regression-tests
cvs diff: Diffing extras/morphine/scripts
cvs diff: Diffing extras/morphine/source
cvs diff: Diffing extras/odbc
cvs diff: Diffing extras/posix
cvs diff: Diffing extras/quickcheck
cvs diff: Diffing extras/quickcheck/tutes
cvs diff: Diffing extras/references
cvs diff: Diffing extras/references/samples
cvs diff: Diffing extras/references/tests
cvs diff: Diffing extras/stream
cvs diff: Diffing extras/trailed_update
cvs diff: Diffing extras/trailed_update/samples
cvs diff: Diffing extras/trailed_update/tests
cvs diff: Diffing extras/xml
cvs diff: Diffing extras/xml/samples
cvs diff: Diffing extras/xml_stylesheets
cvs diff: Diffing java
cvs diff: Diffing java/runtime
cvs diff: Diffing library
cvs diff: Diffing mdbcomp
cvs diff: Diffing profiler
cvs diff: Diffing robdd
cvs diff: Diffing runtime
cvs diff: Diffing runtime/GETOPT
cvs diff: Diffing runtime/machdeps
cvs diff: Diffing samples
cvs diff: Diffing samples/c_interface
cvs diff: Diffing samples/c_interface/c_calls_mercury
cvs diff: Diffing samples/c_interface/cplusplus_calls_mercury
cvs diff: Diffing samples/c_interface/mercury_calls_c
cvs diff: Diffing samples/c_interface/mercury_calls_cplusplus
cvs diff: Diffing samples/c_interface/mercury_calls_fortran
cvs diff: Diffing samples/c_interface/simpler_c_calls_mercury
cvs diff: Diffing samples/c_interface/simpler_cplusplus_calls_mercury
cvs diff: Diffing samples/diff
cvs diff: Diffing samples/muz
cvs diff: Diffing samples/rot13
cvs diff: Diffing samples/solutions
cvs diff: Diffing samples/tests
cvs diff: Diffing samples/tests/c_interface
cvs diff: Diffing samples/tests/c_interface/c_calls_mercury
cvs diff: Diffing samples/tests/c_interface/cplusplus_calls_mercury
cvs diff: Diffing samples/tests/c_interface/mercury_calls_c
cvs diff: Diffing samples/tests/c_interface/mercury_calls_cplusplus
cvs diff: Diffing samples/tests/c_interface/mercury_calls_fortran
cvs diff: Diffing samples/tests/c_interface/simpler_c_calls_mercury
cvs diff: Diffing samples/tests/c_interface/simpler_cplusplus_calls_mercury
cvs diff: Diffing samples/tests/diff
cvs diff: Diffing samples/tests/muz
cvs diff: Diffing samples/tests/rot13
cvs diff: Diffing samples/tests/solutions
cvs diff: Diffing samples/tests/toplevel
cvs diff: Diffing scripts
Index: scripts/Mmakefile
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/scripts/Mmakefile,v
retrieving revision 1.35
diff -u -b -r1.35 Mmakefile
--- scripts/Mmakefile	17 Mar 2005 02:29:44 -0000	1.35
+++ scripts/Mmakefile	30 Apr 2005 06:54:11 -0000
@@ -23,12 +23,21 @@
 
 #-----------------------------------------------------------------------------#
 
-.SUFFIXES: .in
+# ensure there were no mispelt autoconf variable names \
 
-.in:
-	CONFIG_FILES=$@ CONFIG_HEADERS= $(MERCURY_DIR)/config.status
-	# check to ensure there were no mispelt autoconf variable names
-	if grep -n '[^$$]@' $@; then false; else true; fi
+# .SUFFIXES: .in
+
+# we test membership of SCRIPTS, because testing $(@D) (the directory part
+# of $*) does the wrong thing for Mercury.config. Not testing anything would
+# make this rule apply even to ../Mmake.common.
+
+%::	%.in $(MERCURY_DIR)/config.status
+	@for script in $(SCRIPTS) ; do \
+		if test "$*" = "$$script" ; then \
+		$(MERCURY_DIR)/config.status --file=$* ; \
+		if grep -n '[^$$]@' $@; then false; else true; fi \
+		fi \
+	done
 
 #-----------------------------------------------------------------------------#
 
Index: scripts/c2init.in
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/scripts/c2init.in,v
retrieving revision 1.45
diff -u -b -r1.45 c2init.in
--- scripts/c2init.in	15 Feb 2005 05:22:35 -0000	1.45
+++ scripts/c2init.in	30 Apr 2005 06:20:43 -0000
@@ -101,14 +101,15 @@
 	0) exec $MKINIT $aditi_opt -c"$maxcalls" $init_opt $trace_opt \
 		$library_opt $defentry_opt $extra_inits_opt \
 		-g "$GRADE" -o "$init_c_file" $experimental_complexity_opt \
-		$extra_init_dirs $EXTRA_INIT_FILES $TRACE_INIT_FILES \
-		$MERCURY_ALL_LIB_MODS
+		$extra_init_dirs $always_exec_init_opts \
+		$EXTRA_INIT_FILES $TRACE_INIT_FILES $MERCURY_ALL_LIB_MODS
 	   ;;
 	*) exec $MKINIT $aditi_opt -c"$maxcalls" $init_opt $trace_opt \
 		$library_opt $defentry_opt $extra_inits_opt \
 		-g "$GRADE" -o "$init_c_file" $experimental_complexity_opt \
 		-r "$runtime_flags" \
-		$extra_init_dirs "$@" $EXTRA_INIT_FILES $TRACE_INIT_FILES \
-		$MERCURY_ALL_LIB_MODS
+		$extra_init_dirs $always_exec_init_opts \
+		"$@" \
+		$EXTRA_INIT_FILES $TRACE_INIT_FILES $MERCURY_ALL_LIB_MODS
 	   ;;
 esac
Index: scripts/parse_ml_options.sh-subr.in
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/scripts/parse_ml_options.sh-subr.in,v
retrieving revision 1.9
diff -u -b -r1.9 parse_ml_options.sh-subr.in
--- scripts/parse_ml_options.sh-subr.in	15 Feb 2005 05:22:35 -0000	1.9
+++ scripts/parse_ml_options.sh-subr.in	30 Apr 2005 06:25:56 -0000
@@ -60,6 +60,7 @@
 library_opt=""
 extra_inits_opt=""
 aditi_opt=""
+always_exec_init_opts=""
 extra_init_dirs=""
 trace_init_files=""
 init_c_file="-"
@@ -195,6 +196,9 @@
 		Generate a function to upload Aditi-RL data to a database.
 		This option is needed when interfacing with the Aditi
 		deductive database system.
+	-A <funcname>
+		Always execute the named void function (which must take no
+		arguments) when the Mercury runtime is initialized.
 	-x, --extra-inits
 		Search \`.c' files for extra initialization functions.
 		(This may be necessary if the C files contain
@@ -419,6 +423,10 @@
 		aditi_opt="-a";;	
 	-a-|--no-aditi)
 		aditi_opt="";;	
+
+	-A)
+		always_exec_init_opts="$always_exec_init_opts -A $2"; shift;;
+
 	-c|--max-calls)
 		maxcalls="$2"; shift;;
 
cvs diff: Diffing slice
cvs diff: Diffing tests
cvs diff: Diffing tests/benchmarks
cvs diff: Diffing tests/debugger
cvs diff: Diffing tests/debugger/declarative
cvs diff: Diffing tests/dppd
cvs diff: Diffing tests/general
cvs diff: Diffing tests/general/accumulator
cvs diff: Diffing tests/general/string_format
cvs diff: Diffing tests/general/structure_reuse
cvs diff: Diffing tests/grade_subdirs
cvs diff: Diffing tests/hard_coded
cvs diff: Diffing tests/hard_coded/exceptions
cvs diff: Diffing tests/hard_coded/purity
cvs diff: Diffing tests/hard_coded/sub-modules
cvs diff: Diffing tests/hard_coded/typeclasses
cvs diff: Diffing tests/invalid
cvs diff: Diffing tests/invalid/purity
cvs diff: Diffing tests/misc_tests
cvs diff: Diffing tests/mmc_make
cvs diff: Diffing tests/mmc_make/lib
cvs diff: Diffing tests/recompilation
cvs diff: Diffing tests/tabling
cvs diff: Diffing tests/term
cvs diff: Diffing tests/valid
cvs diff: Diffing tests/warnings
cvs diff: Diffing tools
cvs diff: Diffing trace
cvs diff: Diffing util
cvs diff: Diffing vim
cvs diff: Diffing vim/after
cvs diff: Diffing vim/ftplugin
cvs diff: Diffing vim/syntax
--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list