[m-dev.] for review: cleanup of grade handling

Zoltan Somogyi zs at cs.mu.OZ.AU
Thu Nov 4 17:08:41 AEDT 1999


For an extra-careful review by Fergus.

Fix potential problems with the way we were handling grade components: the
places that know about grade components were not being kept totally in sync.
This change fixes previous damage and aims to prevent future damage.

The file runtime/mercury_grade.h contains a list of all the files in the
compiler that know about grade components. All these files now process the
grade components in the same order, so that they can be checked for consistency
more easily.

runtime/mercury_grade.h:
	Add the list.

runtime/mercury_conf_param.h:
	Remove a comment about an obsolete grade component.

scripts/init_grade_options.sh-subr:
	Remove initializations of variables that do not correspond to grade
	components, add missing initializations of shell variables that do
	correspond to grade components, and concentrate the grade options
	component of usage messages here, to prevent double maintenance.

	Update list of user scripts.

scripts/final_grade_options.sh-subr:
	Update list of user scripts.

scripts/final_grade_options.sh-subr:
	Add missing initializations in processing the --grade superoption.

	Standardize the order of processing options, and the indentation.

	Update list of user scripts.

scripts/c2init.in:
	Take the usage message for grade component options from
	init_grade_options.sh-subr.

scripts/mgnuc.in:
	Take the usage message for grade component options from
	init_grade_options.sh-subr.

	Standardize the order of processing grade options, and separate the
	processing of grade options and non-grade options.

scripts/ml.in:
	Take the usage message for grade component options from
	init_grade_options.sh-subr.

	Standardize the order of processing grade options. Process some missing
	ones.

Zoltan.

cvs diff: Diffing .
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/include
cvs diff: Diffing boehm_gc/include/private
cvs diff: Diffing browser
cvs diff: Diffing bytecode
cvs diff: Diffing compiler
cvs diff: Diffing compiler/notes
cvs diff: Diffing debian
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/dynamic_linking
cvs diff: Diffing extras/graphics
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/maze
cvs diff: Diffing extras/graphics/samples/pent
cvs diff: Diffing extras/lazy_evaluation
cvs diff: Diffing extras/odbc
cvs diff: Diffing extras/posix
cvs diff: Diffing extras/references
cvs diff: Diffing extras/references/samples
cvs diff: Diffing extras/references/tests
cvs diff: Diffing extras/trailed_update
cvs diff: Diffing extras/trailed_update/samples
cvs diff: Diffing extras/trailed_update/tests
cvs diff: Diffing library
cvs diff: Diffing profiler
cvs diff: Diffing runtime
Index: runtime/mercury_conf_param.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_conf_param.h,v
retrieving revision 1.27
diff -u -b -r1.27 mercury_conf_param.h
--- mercury_conf_param.h	1999/10/26 13:41:11	1.27
+++ mercury_conf_param.h	1999/11/04 05:29:18
@@ -54,7 +54,6 @@
 **		--gcc-asm-labels
 **		--gc conservative
 **		--gc accurate		[not yet working]
-**		--args compact
 **		--no-type-layout
 **		--unboxed-float
 **		--use-trail
Index: runtime/mercury_grade.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_grade.h,v
retrieving revision 1.22
diff -u -b -r1.22 mercury_grade.h
--- mercury_grade.h	1999/10/28 06:22:57	1.22
+++ mercury_grade.h	1999/11/04 06:00:09
@@ -10,13 +10,16 @@
 ** This is used to get the linker to ensure that different object files
 ** were compiled with consistent grades.
 **
-** Any condition compilation macros that affect link compatibility
-** should be included here.
-** For documentation on the meaning of these macros, see
+** Any condition compilation macros that affect link compatibility should be
+** included here. For documentation on the meaning of these macros, see
 ** runtime/mercury_conf_param.h.
 **
 ** IMPORTANT: any changes here may also require changes to
+**	runtime/mercury_conf_param.h
+** 	scripts/init_grade_options.sh-subr
 ** 	scripts/parse_grade_options.sh-subr
+** 	scripts/final_grade_options.sh-subr
+** 	scripts/mgnuc.in
 ** 	scripts/ml.in
 **	compiler/handle_options.m
 **	compiler/mercury_compile.m
@@ -87,6 +90,7 @@
 #else
   #define MR_GRADE_PART_3	MR_GRADE_PART_2
 #endif
+
 #ifdef CONSERVATIVE_GC
   #define MR_GRADE_PART_4	MR_PASTE2(MR_GRADE_PART_3, _gc)
 #elif defined(NATIVE_GC)
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 scripts
Index: scripts/c2init.in
===================================================================
RCS file: /home/mercury1/repository/mercury/scripts/c2init.in,v
retrieving revision 1.25
diff -u -b -r1.25 c2init.in
--- c2init.in	1999/07/26 02:52:45	1.25
+++ c2init.in	1999/11/04 05:29:50
@@ -12,6 +12,30 @@
 # Type `c2init --help' for usage message.
 #
 
+# If you change these, you will also need to change Mmake.common.in,
+# scripts/ml.in, tools/bootcheck, tools/binary, tools/binary_step and
+# tools/linear.
+RT_LIB_NAME=mer_rt
+STD_LIB_NAME=mer_std
+TRACE_LIB_NAME=mer_trace
+BROWSER_LIB_NAME=mer_browser
+
+MERCURY_MOD_LIB_DIR=${MERCURY_MOD_LIB_DIR=@LIBDIR@/modules}
+MKINIT=${MERCURY_MKINIT=mkinit}
+
+# maximum number of calls to put in a single function
+maxcalls=40
+defentry=mercury__main_2_0
+init_opt=""
+trace_opt=""
+library_opt=""
+extra_inits_opt=""
+aditi_opt=""
+extra_init_dirs=""
+
+# include the file `init_grade_options.sh-subr'
+ at INIT_GRADE_OPTIONS@
+
 # IMPORTANT: the manpage is produced automatically from this help
 # message, so if you change the help message, don't forget to check
 # that the manpage still looks OK.
@@ -53,48 +77,12 @@
 		hand-coded C code with \`INIT' comments, rather than
 		containing only C code that was automatically generated
 		by the Mercury compiler.)
-	-s <grade>, --grade <grade>
-	--asm-labels
-	--gcc-non-local-gotos
-	--gcc-global-registers
-	--gc {conservative, accurate, none}
-	-p, --profiling
-	--profile-calls
-	--profile-time
-	--profile-memory
-	--debug
-	--use-trail
-	--pic-reg
-		See the documentation in the \"Invocation\" section
-		of the Mercury User's Guide.
+
+$grade_usage
 
 Environment variables:
 	MERCURY_MOD_LIB_DIR, MERCURY_MOD_LIB_MODS, MERCURY_MKINIT.
 "
-
-# If you change these, you will also need to change Mmake.common.in,
-# scripts/ml.in, tools/bootcheck, tools/binary, tools/binary_step and
-# tools/linear.
-RT_LIB_NAME=mer_rt
-STD_LIB_NAME=mer_std
-TRACE_LIB_NAME=mer_trace
-BROWSER_LIB_NAME=mer_browser
-
-MERCURY_MOD_LIB_DIR=${MERCURY_MOD_LIB_DIR=@LIBDIR@/modules}
-MKINIT=${MERCURY_MKINIT=mkinit}
-
-# maximum number of calls to put in a single function
-maxcalls=40
-defentry=mercury__main_2_0
-init_opt=""
-trace_opt=""
-library_opt=""
-extra_inits_opt=""
-aditi_opt=""
-extra_init_dirs=""
-
-# include the file `init_grade_options.sh-subr'
- at INIT_GRADE_OPTIONS@
 
 while true; do
 	case "$1" in
Index: scripts/final_grade_options.sh-subr
===================================================================
RCS file: /home/mercury1/repository/mercury/scripts/final_grade_options.sh-subr,v
retrieving revision 1.2
diff -u -b -r1.2 final_grade_options.sh-subr
--- final_grade_options.sh-subr	1999/04/20 11:48:28	1.2
+++ final_grade_options.sh-subr	1999/11/04 05:29:50
@@ -6,10 +6,16 @@
 #
 # final_grade_options.sh-subr:
 #	An `sh' subroutine for handling implications between grade-related
-#	options. Used by the `ml' and `mgnuc' scripts.
+#	options. Used by the `ml', `mgnuc' and `c2init' scripts.
 #
 #	The code here should be inserted after a script's option-parsing
 #	loop.
+#
+# IMPORTANT: any changes to the handling of grades here may also require
+# changes to compiler/handle_options.m.
+#
+# This file should only use the shell variables initialized by
+# init_grade_options.sh-subr.
 #
 #---------------------------------------------------------------------------#
 
Index: scripts/init_grade_options.sh-subr
===================================================================
RCS file: /home/mercury1/repository/mercury/scripts/init_grade_options.sh-subr,v
retrieving revision 1.8
diff -u -b -r1.8 init_grade_options.sh-subr
--- init_grade_options.sh-subr	1999/09/13 04:51:19	1.8
+++ init_grade_options.sh-subr	1999/11/04 05:29:50
@@ -6,16 +6,46 @@
 #
 # init_grade_options.sh-subr:
 #	An `sh' subroutine for initializing grade-related options.
-#	Used by the `ml' and `mgnuc' scripts.
+#	Used by the `ml', `mgnuc' and `c2init' scripts.
 #
 #	The code here should be inserted before a script's option-parsing
 #	loop.  The invoking script must define a DEFAULT_GRADE option.
 #
+# IMPORTANT: any changes to the handling of grades here may also require
+# changes to all the files indicated by runtime/mercury_grade.h.
+#
+# This file must initialize all the shell variables used by
+# parse_grade_options.sh-subr, and must list all the options processed in
+# parse_grade_options.sh-subr.
+#
 #---------------------------------------------------------------------------#
 
+grade_usage="\
+Grade options:
+	-s <grade>, --grade <grade>
+	--asm-labels
+	--gcc-non-local-gotos
+	--gcc-global-registers
+	--parallel
+	--gc {conservative, accurate, none}
+	-p, --profiling
+	--profile-calls
+	--profile-time
+	--profile-memory
+	--use-trail
+	--use-minimal-model
+	--pic-reg
+	--no-stack-trace
+	--debug
+		See the documentation in the \"Invocation\" section
+		of the Mercury User's Guide."
+
+# --profile-deep is not yet documented because it is not yet implemented
+
 asm_labels=true
 non_local_gotos=true
 global_regs=true
+thread_safe=false
 gc_method=conservative
 profile_time=false
 profile_calls=false
@@ -23,10 +53,9 @@
 profile_deep=false
 use_trail=false
 use_minimal_model=false
+pic_reg=false
 stack_trace=false
 require_tracing=false
-low_level_debug=false
-thread_safe=false
 
 case $# in
 	0) set - "--grade $DEFAULT_GRADE" ;;
Index: scripts/mgnuc.in
===================================================================
RCS file: /home/mercury1/repository/mercury/scripts/mgnuc.in,v
retrieving revision 1.66
diff -u -b -r1.66 mgnuc.in
--- mgnuc.in	1999/09/14 20:55:47	1.66
+++ mgnuc.in	1999/11/04 05:29:50
@@ -9,46 +9,7 @@
 # IMPORTANT: the manpage is produced automatically from this help
 # message, so if you change the help message, don't forget to check
 # that the manpage still looks OK.
-Help="\
-Name:	mgnuc - Mercury front-end to GNU C
-Usage:	mgnuc [<options>] [-- <gcc options>] files...
-Options:
-	-v, --verbose
-		Echo gcc command before executing it.
-	--no-ansi
-		Don't pass \`-ansi' to gcc.
-	--no-check
-		Don't enable any of gcc's warnings.
-	-s <grade>, --grade <grade>
-	--asm-labels
-	--gcc-non-local-gotos
-	--gcc-global-registers
-	--gc {conservative, accurate, none}
-	-p, --profiling
-	--profile-calls
-	--profile-time
-	--profile-memory
-	--debug
-	--low-level-debug
-	-g, --c-debug
-	--no-c-optimize
-	--use-trail
-	--pic-reg
-	--inline-alloc
-	--split-c-files
-		See the documentation in the \"Invocation\" section
-		of the Mercury User's Guide.
 		
-Description:
-	This runs gcc with the appropriate options for compiling Mercury
-	programs.
-	Normally it invokes gcc in ANSI mode with almost all warnings enabled,
-	but this can be changed using the \`--no-ansi' or \`--no-check'
-	options.
-Environment variables:
-	MERCURY_C_INCL_DIR, MERCURY_ALL_C_INCL_DIRS, MERCURY_DEFAULT_GRADE.
-"
-
 # *************************************************************************
 # *** IMPORTANT NOTE: any changes to this file may also require similar ***
 # *** changes to compiler/mercury_compile.m                             ***
@@ -116,6 +77,42 @@
 # include the file `init_grade_options.sh-subr'
 @INIT_GRADE_OPTIONS@
 
+Help="\
+Name:	mgnuc - Mercury front-end to GNU C
+Usage:	mgnuc [<options>] [-- <gcc options>] files...
+Options:
+	-v, --verbose
+		Echo gcc command before executing it.
+	--no-ansi
+		Don't pass \`-ansi' to gcc.
+	--no-check
+		Don't enable any of gcc's warnings.
+	--low-level-debug
+		Enable low-level debugging of the C code. Useful only
+		for Mercury system developers.
+	-g, --c-debug
+		Generate object files that can debugged with C debuggers
+		such as gdb.
+	--no-c-optimize
+		Disable optimization by the C compiler.
+	--inline-alloc
+		Inline calls to the memory allocator.
+	--split-c-files
+		Must be specified if the argument C files were generated
+		by the Mercury compiler with --split-c-files.
+
+$grade_usage
+		
+Description:
+	This runs gcc with the appropriate options for compiling Mercury
+	programs.
+	Normally it invokes gcc in ANSI mode with almost all warnings enabled,
+	but this can be changed using the \`--no-ansi' or \`--no-check'
+	options.
+Environment variables:
+	MERCURY_C_INCL_DIR, MERCURY_ALL_C_INCL_DIRS, MERCURY_DEFAULT_GRADE.
+"
+
 while : ; do
     case "$1" in
 	-h|--help|"-?")
@@ -194,12 +191,34 @@
 @FINAL_GRADE_OPTIONS@
 
 #
-# convert mgnuc options into gcc options
+# convert non-grade mgnuc options into gcc options
 #
 # IMPORTANT: any changes here will require similar changes to
 # compiler/mercury_compile.m.
 #
 
+case $c_debug in
+	true)		C_DEBUG_OPTS="-g" ;;
+	false)		C_DEBUG_OPTS="" ;;
+esac
+
+case $c_optimize in
+	true)		;;
+	false)		OPT_OPTS="" ;;
+esac
+
+case $low_level_debug in
+	true)		LLDEBUG_OPTS="-DMR_LOWLEVEL_DEBUG" ;;
+	false)		LLDEBUG_OPTS="" ;;
+esac
+
+#
+# convert grade mgnuc options into gcc options
+#
+# IMPORTANT: any changes here may require similar changes to all the files
+# mentioned in runtime/mercury_grade.h.
+#
+
 case $asm_labels in
 	true)		ASM_OPTS="-DUSE_ASM_LABELS" ;;
 	false)		ASM_OPTS="" ;;
@@ -214,30 +233,26 @@
 	true)		REG_OPTS="-DUSE_GCC_GLOBAL_REGISTERS" ;;
 	false)		REG_OPTS="" ;;
 esac
-
-case $stack_trace in
-	true)		STACK_TRACE_OPTS="-DMR_STACK_TRACE" ;;
-	false)		STACK_TRACE_OPTS="" ;;
-esac
-
-case $require_tracing in
-	true)		TRACE_OPTS="-DMR_REQUIRE_TRACING" ;;
-	false)		TRACE_OPTS="" ;;
-esac
 
-case $c_debug in
-	true)		C_DEBUG_OPTS="-g" ;;
-	false)		C_DEBUG_OPTS="" ;;
-esac
+case $thread_safe in
+	true)
+	case $FULLARCH in
+		*solaris*) THREAD_OPTS="-DMR_THREAD_SAFE -DSOLARIS_THREADS \
+				-D_SOLARIS_PTHREADS -D_REENTRANT"
+			;;
 
-case $c_optimize in
-	true)		;;
-	false)		OPT_OPTS="" ;;
-esac
+		*linux*) THREAD_OPTS="-DMR_THREAD_SAFE -DLINUX_THREADS \
+				-D_THREAD_SAFE -D_REENTRANT"
+				# Don't use -ansi under Linux or we get
+				# parse errors at sigset_t in the pthreads
+				# headers.
+			ANSI_OPTS=""
+			;;
 
-case $low_level_debug in
-	true)		LLDEBUG_OPTS="-DMR_LOWLEVEL_DEBUG" ;;
-	false)		LLDEBUG_OPTS="" ;;
+		*)		THREAD_OPTS=""
+			;;
+	esac ;;
+	false)		THREAD_OPTS="" ;;
 esac
 
 case $gc_method in
@@ -271,30 +286,19 @@
 	false)		MINIMAL_MODEL_OPTS="" ;;
 esac
 
-case $thread_safe in
-	true)
-	case $FULLARCH in
-		*solaris*) THREAD_OPTS="-DMR_THREAD_SAFE -DSOLARIS_THREADS \
-				-D_SOLARIS_PTHREADS -D_REENTRANT"
-			;;
-
-		*linux*) THREAD_OPTS="-DMR_THREAD_SAFE -DLINUX_THREADS \
-				-D_THREAD_SAFE -D_REENTRANT"
-				# Don't use -ansi under Linux or we get
-				# parse errors at sigset_t in the pthreads
-				# headers.
-			ANSI_OPTS=""
-			;;
-
-		*)		THREAD_OPTS=""
-			;;
-	esac ;;
-	false)		THREAD_OPTS="" ;;
-esac
-
 case $pic_reg in
 	true)		PICREG_OPTS="-DPIC_REG" ;;
 	false)		PICREG_OPTS="" ;;
+esac
+
+case $stack_trace in
+	true)		STACK_TRACE_OPTS="-DMR_STACK_TRACE" ;;
+	false)		STACK_TRACE_OPTS="" ;;
+esac
+
+case $require_tracing in
+	true)		TRACE_OPTS="-DMR_REQUIRE_TRACING" ;;
+	false)		TRACE_OPTS="" ;;
 esac
 
 GRADE_OPTS="$ASM_OPTS $GOTO_OPTS $REG_OPTS"
Index: scripts/ml.in
===================================================================
RCS file: /home/mercury1/repository/mercury/scripts/ml.in,v
retrieving revision 1.69
diff -u -b -r1.69 ml.in
--- ml.in	1999/10/29 05:09:38	1.69
+++ ml.in	1999/11/04 05:29:50
@@ -14,6 +14,69 @@
 #
 # Environment variables: MERCURY_C_LIB_DIR, MERCURY_DEFAULT_GRADE, ...
 
+FULLARCH=@FULLARCH@
+NONSHARED_LIB_DIR=${MERCURY_NONSHARED_LIB_DIR=@NONSHARED_LIB_DIR@}
+DEFAULT_LIBDIR=@LIBDIR@/lib
+LIBDIR=${MERCURY_C_LIB_DIR=$DEFAULT_LIBDIR}
+DEFAULT_GRADE=${MERCURY_DEFAULT_GRADE=@DEFAULT_GRADE@}
+# DEMANGLER=${MERCURY_DEMANGLER=@LIBDIR@/bin/@FULLARCH@/mdemangle}
+DEMANGLER=${MERCURY_DEMANGLER=mdemangle}
+CC=${MERCURY_C_COMPILER="@CC@"}
+MKFIFO=${MERCURY_MKFIFO="@MKFIFO@"}
+ERROR_UNDEFINED="@ERROR_UNDEFINED@"
+ALLOW_UNDEFINED="@ALLOW_UNDEFINED@"
+EXE_RPATH_OPT=${MERCURY_EXE_RPATH_OPT="@EXE_RPATH_OPT@"}
+EXE_RPATH_SEP=${MERCURY_EXE_RPATH_SEP="@EXE_RPATH_SEP@"}
+EXT_FOR_SHARED_LIB=${MERCURY_EXT_FOR_SHARED_LIB="@EXT_FOR_SHARED_LIB@"}
+LINK_SHARED_OBJ=${MERCURY_LINK_SHARED_OBJ="@LINK_SHARED_OBJ@"}
+SHLIB_RPATH_OPT=${MERCURY_SHLIB_RPATH_OPT="@SHLIB_RPATH_OPT@"}
+SHLIB_RPATH_SEP=${MERCURY_SHLIB_RPATH_SEP="@SHLIB_RPATH_SEP@"}
+SHARED_LIBS=${MERCURY_SHARED_LIBS="@SHARED_LIBS@"}
+TMPDIR=${TMPDIR=/tmp}
+
+# On some systems (Solaris for exemple), we need libraries to be able to 
+# use sockets. The name of the needed libraries is determined by autoconf
+# and passed through this variable.
+SOCKET_LIBRARY="@SOCKET_LIBRARY@"
+
+# Likewise for -ldl (libdl.so), which is often needed for dlopen() etc.
+DL_LIBRARY="@DL_LIBRARY@"
+
+# Likewise for -lreadline -l{termcap,curses,ncurses}
+READLINE_LIBRARIES="@READLINE_LIBRARIES@"
+
+# If you change these, you will also need to change Mmake.common.in,
+# scripts/c2init.in, tools/bootcheck, tools/binary, tools/binary_step
+# and tools/linear.
+RT_LIB_NAME=mer_rt
+STD_LIB_NAME=mer_std
+TRACE_LIB_NAME=mer_trace
+BROWSER_LIB_NAME=mer_browser
+
+verbose=false
+allow_undefined=false
+trace=false
+readline=true
+case $FULLARCH in
+	*-win95|*-winnt|*-win32|*-cygwin32|*-cygwin)
+		# `gcc -s' is broken in gnu-win32
+		strip=false
+		;;
+	*)
+		strip=true
+		;;
+esac
+mercury_libs=default
+all_libs=default
+demangle=true
+MAYBE_STATIC_OPT=""
+make_shared_lib=false
+leave_shlib_dirs_relative=false
+user_shlib_dirs=""
+
+# include the file `init_grade_options.sh-subr'
+ at INIT_GRADE_OPTIONS@
+
 Help="\
 Name: ml - Mercury Linker
 Usage: ml [<ml options>] [-- <gcc options>] files...
@@ -83,87 +146,9 @@
 		Don't link in the GPL'd GNU Readline Library.
 	-g, --c-debug, --no-strip
 		Do not strip C debugging information.
-
-Grade options:
-	-s <grade>, --grade <grade>
-	--asm-labels
-	--gcc-non-local-gotos
-	--gcc-global-registers
-	--gc {conservative, accurate, none}
-	-p, --profiling
-	--profile-calls
-	--profile-time
-	--profile-memory
-	--debug
-	--low-level-debug
-	--use-trail
-	--pic-reg
-		See the documentation in the \"Invocation\" section
-		of the Mercury User's Guide."
-
-FULLARCH=@FULLARCH@
-NONSHARED_LIB_DIR=${MERCURY_NONSHARED_LIB_DIR=@NONSHARED_LIB_DIR@}
-DEFAULT_LIBDIR=@LIBDIR@/lib
-LIBDIR=${MERCURY_C_LIB_DIR=$DEFAULT_LIBDIR}
-DEFAULT_GRADE=${MERCURY_DEFAULT_GRADE=@DEFAULT_GRADE@}
-# DEMANGLER=${MERCURY_DEMANGLER=@LIBDIR@/bin/@FULLARCH@/mdemangle}
-DEMANGLER=${MERCURY_DEMANGLER=mdemangle}
-CC=${MERCURY_C_COMPILER="@CC@"}
-MKFIFO=${MERCURY_MKFIFO="@MKFIFO@"}
-ERROR_UNDEFINED="@ERROR_UNDEFINED@"
-ALLOW_UNDEFINED="@ALLOW_UNDEFINED@"
-EXE_RPATH_OPT=${MERCURY_EXE_RPATH_OPT="@EXE_RPATH_OPT@"}
-EXE_RPATH_SEP=${MERCURY_EXE_RPATH_SEP="@EXE_RPATH_SEP@"}
-EXT_FOR_SHARED_LIB=${MERCURY_EXT_FOR_SHARED_LIB="@EXT_FOR_SHARED_LIB@"}
-LINK_SHARED_OBJ=${MERCURY_LINK_SHARED_OBJ="@LINK_SHARED_OBJ@"}
-SHLIB_RPATH_OPT=${MERCURY_SHLIB_RPATH_OPT="@SHLIB_RPATH_OPT@"}
-SHLIB_RPATH_SEP=${MERCURY_SHLIB_RPATH_SEP="@SHLIB_RPATH_SEP@"}
-SHARED_LIBS=${MERCURY_SHARED_LIBS="@SHARED_LIBS@"}
-TMPDIR=${TMPDIR=/tmp}
 
-# On some systems (Solaris for exemple), we need libraries to be able to 
-# use sockets. The name of the needed libraries is determined by autoconf
-# and passed through this variable.
-SOCKET_LIBRARY="@SOCKET_LIBRARY@"
+$grade_usage"
 
-# Likewise for -ldl (libdl.so), which is often needed for dlopen() etc.
-DL_LIBRARY="@DL_LIBRARY@"
-
-# Likewise for -lreadline -l{termcap,curses,ncurses}
-READLINE_LIBRARIES="@READLINE_LIBRARIES@"
-
-# If you change these, you will also need to change Mmake.common.in,
-# scripts/c2init.in, tools/bootcheck, tools/binary, tools/binary_step
-# and tools/linear.
-RT_LIB_NAME=mer_rt
-STD_LIB_NAME=mer_std
-TRACE_LIB_NAME=mer_trace
-BROWSER_LIB_NAME=mer_browser
-
-verbose=false
-allow_undefined=false
-trace=false
-readline=true
-case $FULLARCH in
-	*-win95|*-winnt|*-win32|*-cygwin32|*-cygwin)
-		# `gcc -s' is broken in gnu-win32
-		strip=false
-		;;
-	*)
-		strip=true
-		;;
-esac
-mercury_libs=default
-all_libs=default
-demangle=true
-MAYBE_STATIC_OPT=""
-make_shared_lib=false
-leave_shlib_dirs_relative=false
-user_shlib_dirs=""
-
-# include the file `init_grade_options.sh-subr'
- at INIT_GRADE_OPTIONS@
-
 while : ; do
     case "$1" in
 	-h|--help|"-?")
@@ -299,7 +284,7 @@
 # include the file `final_grade_options.sh-subr'
 @FINAL_GRADE_OPTIONS@
 
-# --require-tracing (which is implied by --debug) implies --trace
+# --debug implies --trace
 case $require_tracing in
 	true)	trace=true ;;
 	false)	;;
@@ -373,6 +358,10 @@
 	true)		GRADE="asm_$GRADE" ;;
 	false)		;;
 esac
+case $thread_safe in
+	true)	GRADE="$GRADE.par" ;;
+	false)	;;
+esac
 case $gc_method in
 	conservative)	GRADE="$GRADE.gc" ;;
 	accurate)	GRADE="$GRADE.agc" ;;
@@ -394,15 +383,19 @@
 	true)		GRADE="$GRADE.tr" ;;
 	false)		;;
 esac
+case $use_minimal_model in
+	true)	GRADE="$GRADE.mm" ;;
+	false)	;;
+esac
+case $picreg in
+	true)	GRADE="$GRADE.picreg" ;;
+	false)	;;
+esac
 case $stack_trace,$require_tracing in
 	true,true)	GRADE="$GRADE.debug" ;;
 	false,true)	GRADE="$GRADE.trace" ;;
 	true,false)	GRADE="$GRADE.strce" ;;
 	false,false)	;;
-esac
-case $thread_safe in
-	true)	GRADE="$GRADE.par" ;;
-	false)	;;
 esac
 
 case "$GRADE" in
Index: scripts/parse_grade_options.sh-subr
===================================================================
RCS file: /home/mercury1/repository/mercury/scripts/parse_grade_options.sh-subr,v
retrieving revision 1.11
diff -u -b -r1.11 parse_grade_options.sh-subr
--- parse_grade_options.sh-subr	1999/09/13 04:51:20	1.11
+++ parse_grade_options.sh-subr	1999/11/04 05:29:50
@@ -6,11 +6,18 @@
 #
 # parse_grade_options.sh-subr:
 #	An `sh' subroutine for parsing grade-related options.
-#	Used by the `ml' and `mgnuc' scripts.
+#	Used by the `ml', `mgnuc' and `c2init' scripts.
 #
-#	The code here should be inserted in the case statement in a scripts
+#	The code here should be inserted in the case statement in a script's
 #	option-parsing loop.
 #
+# IMPORTANT: any changes to the handling of grades here may also require
+# changes to all the files indicated by runtime/mercury_grade.h.
+#
+# This file should handle the setting of all the shell variables defined by
+# parse_grade_options.sh-subr. All the options it processes should be listed
+# in usage_grade_options.sh-subr.
+#
 #---------------------------------------------------------------------------#
 
 	--asm-labels)
@@ -28,26 +35,6 @@
 	--no-gcc-global-registers)
 		global_regs=false ;;
 
-	--debug)
-		stack_trace=true 
-		require_tracing=true
-		;;
-	--no-debug)
-		stack_trace=false 
-		require_tracing=false
-		;;
-# The following more fine-grained options have been omitted
-# since they are not very useful and would probably only
-# confuse people.
-#	--stack-trace)
-#		stack_trace=true ;;
-#	--no-stack-trace)
-#		stack_trace=false ;;
-#	--require-tracing)
-#		require_tracing=true ;;
-#	--no-require-tracing)
-#		require_tracing=false ;;
-
 	--gc)
 		shift
 		case "$1" in
@@ -119,6 +106,25 @@
 	--no-pic-reg)
 		pic_reg=false ;;
 
+# The following more fine-grained options have been omitted
+# since they are not very useful and would probably only
+# confuse people.
+#	--stack-trace)
+#		stack_trace=true ;;
+#	--no-stack-trace)
+#		stack_trace=false ;;
+#	--require-tracing)
+#		require_tracing=true ;;
+#	--no-require-tracing)
+#		require_tracing=false ;;
+
+	--debug)
+		stack_trace=true
+		require_tracing=true ;;
+	--no-debug)
+		stack_trace=false
+		require_tracing=false ;;
+
 	-s|--grade)
 		shift
 		grade="$1";
@@ -126,47 +132,72 @@
 		# Convert a grade to a set of options.
 		#
 		# IMPORTANT: any changes to the handling of grades here
-		# may also require changes to
-		#	runtime/mercury_grade.h
-		#	compiler/handle_options.m
-		#	scripts/ml.in
+		# may also require changes to all the files indicated by
+		# runtime/mercury_grade.h.
 
 	    asm_labels=false
 	    non_local_gotos=false
 	    global_regs=false
+		thread_safe=false
 	    gc_method=none
 	    profile_time=false
 	    profile_calls=false
 	    profile_memory=false
+		profile_deep=false
 	    use_trail=false
 	    use_minimal_model=false
-	    stack_trace=false
-	    require_tracing=false
-	    low_level_debug=false
-	    thread_safe=false
+		pic_reg=false
+		stack_trace=true
+		debug=false
 
 	    grade_pieces=`echo $grade | tr '.' ' '`
 	    for grade_piece in $grade_pieces
 	    do
 		case "$grade_piece" in
-			debug)
-				stack_trace=true
-				require_tracing=true
+				asm_fast)
+					asm_labels=true
+					non_local_gotos=true
+					global_regs=true
 				;;
-# The following alternatives have been omitted since
-# they're not very useful and would probably just confuse people.
-#			trace)
-#				stack_trace=false
-#				require_tracing=true
-#				;;
-#			strce)
-#				stack_trace=true
-#				require_tracing=false
-#				;;
-			tr)	use_trail=true
+				asm_jump)
+					asm_labels=true
+					non_local_gotos=true
 				;;
-			mm)	use_minimal_model=true
+				fast)
+					asm_labels=false
+					non_local_gotos=true
+					global_regs=true
 				;;
+				jump)
+					asm_labels=false
+					non_local_gotos=true
+					global_regs=false
+					;;
+				reg)
+					asm_labels=false
+					non_local_gotos=false
+					global_regs=true
+					;;
+				none)
+					asm_labels=false
+					non_local_gotos=false
+					global_regs=false
+					;;
+
+				par)
+					thread_safe=true
+					;;
+
+				agc)
+					gc_method=accurate
+					;;
+				gc)
+					gc_method=conservative
+					;;
+				nogc)
+					gc_method=none
+					;;
+
 			memprof)
 				profile_time=false
 				profile_calls=true
@@ -202,43 +233,26 @@
 				profile_calls=false
 				profile_memory=false
 				profile_deep=true
-				;;
-			agc)	gc_method=accurate
-				;;
-			gc)	gc_method=conservative
-				;;
-			nogc)	gc_method=none
-				;;
-			par)	thread_safe=true
-				;;
-			asm_fast)
-				asm_labels=true
-				non_local_gotos=true
-				global_regs=true
 				;;
-			asm_jump)
-				asm_labels=true
-				non_local_gotos=true
+
+				tr)
+					use_trail=true
 				;;
-			fast)
-				asm_labels=false
-				non_local_gotos=true
-				global_regs=true
+
+				mm)
+					use_minimal_model=true
 				;;
-			jump)
-				asm_labels=false
-				non_local_gotos=true
-				global_regs=false
+
+				picreg)
+					pic_reg=true
 				;;
-			reg)
-				asm_labels=false
-				non_local_gotos=false
-				global_regs=true
+
+				nostrace)
+					stack_trace=false
 				;;
-			none)
-				asm_labels=false
-				non_local_gotos=false
-				global_regs=false
+
+				debug)
+					debug=true
 				;;
 		esac
 	    done
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/hard_coded
cvs diff: Diffing tests/hard_coded/exceptions
cvs diff: Diffing tests/hard_coded/sub-modules
cvs diff: Diffing tests/hard_coded/typeclasses
cvs diff: Diffing tests/invalid
cvs diff: Diffing tests/misc_tests
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 trial
cvs diff: Diffing util
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list