[m-rev.] for review: library and browser namespaces

Zoltan Somogyi zs at cs.mu.OZ.AU
Mon Sep 23 20:24:14 AEST 2002


For review by anyone.

Zoltan.

Enforce namespace cleanliness in the library and browser directories
as well as in the runtime and trace directories.

Mmake.common.in:
	Move the rules check_namespace here (they used to be in the Mmakefiles
	of the runtime and trace directories), together with the variables they
	need. Generalize them to also handle the needs of the browser, library
	and bytecode directories. The former two in particular need the
	ability to check automatically generated .mh files.

	Makefile all the rules used by check_namespace conditional on a macro
	that is defined by the Makefiles in all the directories that are
	checked for namespace cleanliness.

trace/Mmakefile:
runtime/Mmakefile:
	Replace the old rules for check_namespace, which are now in
	../Mmake.common.in, with the macros needed to control their behavior.

bytecode/Mmakefile:
	Add the macros needed to control the behavior of the rules for
	check_namespace.

	Move the lists of files to the start, before the include of
	../Mmake.common.

browser/Mmakefile:
library/Mmakefile:
	Add the macros needed to control the behavior of the rules for
	check_namespace.

runtime/RESERVED_MACRO_NAMES:
	Update comments, and delete obsolete exceptions.

browser/RESERVED_MACRO_NAMES:
library/RESERVED_MACRO_NAMES:
	New files to contain the exceptions from the naming scheme.

tools/bootcheck:
	Invoke "mmake check_namespace" in the library and browser directories
	as well as the runtime and the trace directories. Perform the
	invocation before we delete the object files we are checking for
	cleanliness.

	Clean up object files in all stage2 directories, not just the library,
	as soon as we can.

library/array.m:
library/builtin.m:
library/io.m:
	Fix namespace violations.

cvs diff: Diffing .
Index: Mmake.common.in
===================================================================
RCS file: /home/mercury1/repository/mercury/Mmake.common.in,v
retrieving revision 1.65
diff -u -b -r1.65 Mmake.common.in
--- Mmake.common.in	22 Jun 2002 19:15:49 -0000	1.65
+++ Mmake.common.in	23 Sep 2002 10:22:47 -0000
@@ -219,6 +219,74 @@
 $(MERCURY_DIR)/Mmake.params: ;
 
 #-----------------------------------------------------------------------------#
+#
+# `mmake check_namespace' performs various checks on the header files
+# and object files to make sure that they conform with our coding standards.
+#
+
+ifdef CHECK_OBJS
+
+HDR_CHECK_CS	  = $(CHECK_HDRS:.h=.check_hdr.c)
+HDR_CHECK_OBJS    = $(CHECK_HDRS:.h=.check_hdr.$O)
+HDR_CHECK_MACROS  = $(CHECK_HDRS:.h=.check.macros)
+MHDR_CHECK_CS	  = $(CHECK_MHDRS:.mh=.check_mhdr.c)
+MHDR_CHECK_OBJS   = $(CHECK_MHDRS:.mh=.check_mhdr.$O)
+MHDR_CHECK_MACROS = $(CHECK_MHDRS:.mh=.check.mmacros)
+OBJ_CHECKS        = $(CHECK_OBJS:%=%.obj_check)
+
+# Macro names must normally start with one of the prefixes associated
+# with the different components of our system:
+# 	`MR_' or `MERCURY_' for stuff in the Mercury runtime implementation
+# 		(the `runtime' and `trace' directories)
+# 	`ML_' for stuff in the Mercury standard library
+# 		(the `library' directory)
+# 	`MDB_' for stuff in the browser
+# 		(the `browser' directory)
+# 	`GC_' for stuff in the Boehm et al conservative garbage collector
+# 		(the `boehm_gc' directory)
+# 	`MPS_' or `mps_' for stuff in the Memory Pool System toolkit
+# 		(the `mps_gc' directory, if present -- note that this
+# 		is in a separate CVS module and is not included in the
+# 		normal Mercury source distributions)
+# Exceptions to this policy must be listed in the RESERVED_MACRO_NAMES file
+# in the relevant directory.
+
+GEN_MACRO_PREFIX_EXPRS = \
+	-e '^MR_' -e '^MERCURY_' -e '^GC_' -e '^MPS_' -e '^mps_'
+GEN_OBJ_PREFIX_EXPRS = \
+	-e '^_entry' -e '^MR_' -e '^mercury_'
+
+ifeq ("$(ALLOW_LIB_PREFIX)","yes")
+LIB_MACRO_PREFIX_EXPRS = \
+	-e '^ML_'
+LIB_OBJ_PREFIX_EXPRS = \
+	-e '^ML_'
+else
+LIB_MACRO_PREFIX_EXPRS =
+LIB_OBJ_PREFIX_EXPRS =
+endif
+
+ifeq ("$(ALLOW_BROWSER_PREFIX)","yes")
+BROWSER_MACRO_PREFIX_EXPRS = \
+	-e '^MDB_'
+BROWSER_OBJ_PREFIX_EXPRS = \
+	-e '^MDB_'
+else
+BROWSER_MACRO_PREFIX_EXPRS =
+BROWSER_OBJ_PREFIX_EXPRS =
+endif
+
+MACRO_PREFIX_EXPRS = \
+	$(GEN_MACRO_PREFIX_EXPRS) \
+	$(LIB_MACRO_PREFIX_EXPRS) \
+	$(BROWSER_MACRO_PREFIX_EXPRS)
+OBJ_PREFIX_EXPRS   = \
+	$(GEN_OBJ_PREFIX_EXPRS) \
+	$(LIB_OBJ_PREFIX_EXPRS) \
+	$(BROWSER_OBJ_PREFIX_EXPRS)
+
+HEADER_CLEAN_FILTER = \
+	grep -v $(MACRO_PREFIX_EXPRS) | fgrep -v -x -f RESERVED_MACRO_NAMES
 
 # This rule checks that object files are properly namespace-clean, with
 # regard to the global symbols that they define.
@@ -228,33 +296,42 @@
 
 %.obj_check: %
 	nm -g $< | awk '$$1 != "U" { print $$3; }' | \
-		grep -v -e '^_entry' -e '^MR_' -e '^mercury_' | \
-		sort -u > $@
+		grep -v $(OBJ_PREFIX_EXPRS) | sort -u > $@
 	@if cmp -s /dev/null $@; then \
 		true; \
 	else \
 		echo "** Global symbols in user namespace:"; \
 		cat $@; \
-		echo "(You may need to add MR_ prefixes to these names.)"; \
+		echo "(You may need to add a distinguishing prefix to these names.)"; \
 		exit 1; \
 	fi
 
-# This rule helps to check that header files is self-contained, i.e. that each
+# These rules help to check that header files is self-contained, i.e. that each
 # header file foo.h includes any other header files that define types
 # used by foo.h. It creates a foo.check_hdr.c file that contains only a single
 # `#include' statement that includes foo.h; compiling foo.check_hdr.c will fail
-# if foo.h is not self-contained.
+# if foo.h is not self-contained. Similarly for .mh files.
 
 %.check_hdr.c : %.h
 	echo "#include \"$*.h\"" > $*.check_hdr.c
 
-# This rule checks whether a header file defines any macros it shouldn't.
-# It generates the list of macros defined in the header file, and filters this
+%.check_mhdr.c : %.mh
+	echo "#include \"$*.mh\"" > $*.check_mhdr.c
+
+# These rules check whether a header file defines any macros it shouldn't.
+# They generates the list of macros defined in the header file, and filter this
 # list through a command that is intended to filter out all references to macro
-# names that are all right. Each directory that uses this rule must set
-# the HEADER_CLEAN_FILTER make variable to contain this command.
+# names that are all right. Each directory that uses this rule must set arrange
+# for the precursors of the HEADER_CLEAN_FILTER make variable to contain this
+# command.
+#
+# The two rules should differ only in the filenames they use and in the fact
+# that the automatically created header file for module x is allowed to have
+# two macros, X_H and X_DECL_GUARD over and above what HEADER_CLEAN_FILTER
+# allows.
 
 AWK = awk
+
 %.check.macros: %.h %.check_hdr.c
 	-$(MGNUC) $(ALL_GRADEFLAGS) $(ALL_MGNUCFLAGS) \
 		-DMERCURY_BOOTSTRAP_H -DMR_NO_CONF_BACKWARDS_COMPAT \
@@ -270,5 +347,49 @@
 		echo "(You may need to add a distinguishing prefix to these names.)"; \
 		exit 1; \
 	fi
+
+%.check.mmacros: %.mh %.check_mhdr.c
+	-$(MGNUC) $(ALL_GRADEFLAGS) $(ALL_MGNUCFLAGS) \
+		-DMERCURY_BOOTSTRAP_H -DMR_NO_CONF_BACKWARDS_COMPAT \
+		-E $*.check_mhdr.c \
+		-nostdinc -dN \
+		2> /dev/null | $(AWK) '/^#define/ { print $$2; }' | \
+		grep -v -e `echo $(subst .check.mmacros,,$@) | tr '[a-z]' '[A-Z]'`_H | \
+		grep -v -e `echo $(subst .check.mmacros,,$@) | tr '[a-z]' '[A-Z]'`_DECL_GUARD | \
+		$(HEADER_CLEAN_FILTER) | sort -u > $@
+	@if cmp -s /dev/null $@; then \
+		true; \
+	else \
+		echo "** Macro name(s) in user namespace:"; \
+		cat $@; \
+		echo "(You may need to add a distinguishing prefix to these names.)"; \
+		exit 1; \
+	fi
+
+#-----------------------------------------------------------------------------#
+
+.PHONY: check_headers_self_contained
+check_headers_self_contained: $(HDR_CHECK_OBJS) $(MHDR_CHECK_OBJS)
+
+.PHONY: check_headers_macros
+check_headers_macros: $(HDR_CHECK_MACROS) $(MHDR_CHECK_MACROS)
+
+.PHONY: check_headers
+check_headers: check_headers_self_contained check_headers_macros
+
+.PHONY: check_objs
+check_objs: $(OBJ_CHECKS)
+
+.PHONY: check_namespace
+check_namespace: check_headers check_objs
+
+.PHONY: clean_check
+clean_check:
+	-rm -f $(HDR_CHECK_OBJS) $(HDR_CHECK_CS) $(HDR_CHECK_MACROS)
+	-rm -f $(MHDR_CHECK_OBJS) $(MHDR_CHECK_CS) $(MHDR_CHECK_MACROS)
+	-rm -f $(OBJ_CHECKS)
+
+endif
+# ifdef CHECK_OBJS
 
 #-----------------------------------------------------------------------------#
cvs diff: Diffing bench
cvs diff: Diffing bench/progs
cvs diff: Diffing bench/progs/compress
cvs diff: Diffing bench/progs/icfp2000
cvs diff: Diffing bench/progs/icfp2001
cvs diff: Diffing bench/progs/nuc
cvs diff: Diffing bench/progs/ray
cvs diff: Diffing bench/progs/tree234
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
Index: browser/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/mercury/browser/Mmakefile,v
retrieving revision 1.24
diff -u -b -r1.24 Mmakefile
--- browser/Mmakefile	22 Jun 2002 19:15:52 -0000	1.24
+++ browser/Mmakefile	23 Sep 2002 08:55:16 -0000
@@ -15,6 +15,12 @@
 # in an executable must be of the same grade, we need to be able to
 # compile the modules in this directory in debug grades as well.
 
+CHECK_HDRS  =
+CHECK_MHDRS = $(mer_browser.mhs)
+CHECK_OBJS  = $(mer_browser.os)
+ALLOW_LIB_PREFIX=yes
+ALLOW_BROWSER_PREFIX=yes
+
 MERCURY_DIR=..
 LINK_STDLIB_ONLY=yes
 include $(MERCURY_DIR)/Mmake.common
Index: browser/RESERVED_MACRO_NAMES
===================================================================
RCS file: browser/RESERVED_MACRO_NAMES
diff -N browser/RESERVED_MACRO_NAMES
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ browser/RESERVED_MACRO_NAMES	23 Sep 2002 09:18:16 -0000
@@ -0,0 +1,39 @@
+#-----------------------------------------------------------------------------#
+# Copyright (C) 2000-2002 The 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.
+#-----------------------------------------------------------------------------#
+#
+# RESERVED_MACRO_NAMES
+#
+# This file lists the macro names, other than the ones starting with a
+# certain set of allowed prefixes that are defined by the Mercury header files.
+# The Mmakefile target `check_headers' automatically checks that no other
+# macro names are defined. This is done to keep our headers namespace-clean,
+# i.e. ensure that we don't invade the user's namespace.
+#
+# This file is used as the argument to `fgrep -f'.
+# Lines starting with `#' will not match anything in the input,
+# and can thus be used as comments.
+# Other lines are treated as strings to match against.
+#
+#-----------------------------------------------------------------------------#
+# This is documented in the Mercury language reference manual
+# and defined by mercury_types.h.
+SUCCESS_INDICATOR
+#-----------------------------------------------------------------------------#
+# pid_t is only defined in mercury_conf.h if it is not present
+# in the system headers. I don't think there is a nice way to
+# prefix this without requiring a later version of autoconf (e.g. 2.52).
+pid_t
+#-----------------------------------------------------------------------------#
+# These are defined by boehm_gc/gc.h.
+__GC
+_GC_H
+#-----------------------------------------------------------------------------#
+# This is defined by mps_gc/code/mercury_mps.h,
+# which uses this macro for its header guard.
+# Normally it would be better to use uppercase for header guard macro names,
+# but that would be inconsistent with the coding style used in mps_gc/code.
+mercury_mps_h
+#-----------------------------------------------------------------------------#
cvs diff: Diffing bytecode
Index: bytecode/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/mercury/bytecode/Mmakefile,v
retrieving revision 1.18
diff -u -b -r1.18 Mmakefile
--- bytecode/Mmakefile	19 Dec 2001 15:08:22 -0000	1.18
+++ bytecode/Mmakefile	23 Sep 2002 08:55:07 -0000
@@ -8,40 +8,6 @@
 
 MAIN_TARGET=all
 
-MERCURY_DIR=..
-include $(MERCURY_DIR)/Mmake.common
--include ../Mmake.params
-
-#-----------------------------------------------------------------------------#
-# NOTE: any library functions that called from bytecode must be compiled
-# with trace information. (So their entry labels can be looked up)
-#-----------------------------------------------------------------------------#
-
-MERCURY_SYSTEM	= \
-		$(RUNTIME_DIR)/*.c $(RUNTIME_DIR)/*.h \
-		$(RUNTIME_DIR)/machdeps/*.c $(RUNTIME_DIR)/machdeps/*.h\
-		$(LIBRARY_DIR)/*.m \
-		$(TRACE_DIR)/*.h $(TRACE_DIR)/*.c \
-		$(BROWSER_DIR)/*.h $(BROWSER_DIR)/*.c \
-		$(BOEHM_GC_DIR)/*.h $(BOEHM_GC_DIR)/include/*.h
-
-MERCURY_INC	= \
-		-I$(LIBRARY_DIR) \
-		 -I$(RUNTIME_DIR) \
-		 -I$(BOEHM_GC_DIR) \
-		 -I$(BOEHM_GC_DIR)/include \
-		 -I$(TRACE_DIR)
-	
-#-----------------------------------------------------------------------------#
-
-CFLAGS		= $(MERCURY_INC) -DMR_BYTECODE_CALLABLE -g
-
-MGNUCFLAGS-mb_disasm = --no-ansi
-
-MCFLAGS		= --trace shallow --generate-bytecode -O 0
-
-MLFLAGS		= --trace
-
 #-----------------------------------------------------------------------------#
 # keep these lists in alphabetical order, please
 
@@ -83,6 +49,45 @@
 
 $(MB_OBJS): $(MB_HDRS)
 
+CHECK_HDRS  = $(MB_HDRS)
+CHECK_MHDRS =
+CHECK_OBJS  = $(MB_OBJS)
+ALLOW_LIB_PREFIX=no
+ALLOW_BROWSER_PREFIX=no
+
+MERCURY_DIR=..
+include $(MERCURY_DIR)/Mmake.common
+-include ../Mmake.params
+
+#-----------------------------------------------------------------------------#
+# NOTE: any library functions that called from bytecode must be compiled
+# with trace information. (So their entry labels can be looked up)
+#-----------------------------------------------------------------------------#
+
+MERCURY_SYSTEM	= \
+		$(RUNTIME_DIR)/*.c $(RUNTIME_DIR)/*.h \
+		$(RUNTIME_DIR)/machdeps/*.c $(RUNTIME_DIR)/machdeps/*.h\
+		$(LIBRARY_DIR)/*.m \
+		$(TRACE_DIR)/*.h $(TRACE_DIR)/*.c \
+		$(BROWSER_DIR)/*.h $(BROWSER_DIR)/*.c \
+		$(BOEHM_GC_DIR)/*.h $(BOEHM_GC_DIR)/include/*.h
+
+MERCURY_INC	= \
+		-I$(LIBRARY_DIR) \
+		 -I$(RUNTIME_DIR) \
+		 -I$(BOEHM_GC_DIR) \
+		 -I$(BOEHM_GC_DIR)/include \
+		 -I$(TRACE_DIR)
+	
+#-----------------------------------------------------------------------------#
+
+CFLAGS		= $(MERCURY_INC) -DMR_BYTECODE_CALLABLE -g
+
+MGNUCFLAGS-mb_disasm = --no-ansi
+
+MCFLAGS		= --trace shallow --generate-bytecode -O 0
+
+MLFLAGS		= --trace
 
 #-----------------------------------------------------------------------------#
 # The actual program (as distinct from bytecode interpreter)
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/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/lex
cvs diff: Diffing extras/lex/samples
cvs diff: Diffing extras/logged_output
cvs diff: Diffing extras/moose
cvs diff: Diffing extras/moose/samples
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 java
cvs diff: Diffing java/library
cvs diff: Diffing java/runtime
cvs diff: Diffing library
Index: library/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/mercury/library/Mmakefile,v
retrieving revision 1.95
diff -u -b -r1.95 Mmakefile
--- library/Mmakefile	29 Jul 2002 07:51:06 -0000	1.95
+++ library/Mmakefile	23 Sep 2002 08:54:57 -0000
@@ -14,6 +14,12 @@
 EXTRA_LDLIBS =
 #-----------------------------------------------------------------------------#
  
+CHECK_HDRS  =
+CHECK_MHDRS = $(mer_std.mhs)
+CHECK_OBJS  = $(mer_std.os)
+ALLOW_LIB_PREFIX=yes
+ALLOW_BROWSER_PREFIX=no
+
 MERCURY_DIR=..
 LINK_RUNTIME_ONLY=yes
 include $(MERCURY_DIR)/Mmake.common
Index: library/RESERVED_MACRO_NAMES
===================================================================
RCS file: library/RESERVED_MACRO_NAMES
diff -N library/RESERVED_MACRO_NAMES
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ library/RESERVED_MACRO_NAMES	23 Sep 2002 01:27:25 -0000
@@ -0,0 +1,39 @@
+#-----------------------------------------------------------------------------#
+# Copyright (C) 2000-2002 The 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.
+#-----------------------------------------------------------------------------#
+#
+# RESERVED_MACRO_NAMES
+#
+# This file lists the macro names, other than the ones starting with a
+# certain set of allowed prefixes that are defined by the Mercury header files.
+# The Mmakefile target `check_headers' automatically checks that no other
+# macro names are defined. This is done to keep our headers namespace-clean,
+# i.e. ensure that we don't invade the user's namespace.
+#
+# This file is used as the argument to `fgrep -f'.
+# Lines starting with `#' will not match anything in the input,
+# and can thus be used as comments.
+# Other lines are treated as strings to match against.
+#
+#-----------------------------------------------------------------------------#
+# This is documented in the Mercury language reference manual
+# and defined by mercury_types.h.
+SUCCESS_INDICATOR
+#-----------------------------------------------------------------------------#
+# pid_t is only defined in mercury_conf.h if it is not present
+# in the system headers. I don't think there is a nice way to
+# prefix this without requiring a later version of autoconf (e.g. 2.52).
+pid_t
+#-----------------------------------------------------------------------------#
+# These are defined by boehm_gc/gc.h.
+__GC
+_GC_H
+#-----------------------------------------------------------------------------#
+# This is defined by mps_gc/code/mercury_mps.h,
+# which uses this macro for its header guard.
+# Normally it would be better to use uppercase for header guard macro names,
+# but that would be inconsistent with the coding style used in mps_gc/code.
+mercury_mps_h
+#-----------------------------------------------------------------------------#
Index: library/array.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/array.m,v
retrieving revision 1.114
diff -u -b -r1.114 array.m
--- library/array.m	16 Sep 2002 06:07:43 -0000	1.114
+++ library/array.m	23 Sep 2002 01:31:48 -0000
@@ -555,18 +555,18 @@
 
 /* Ensure that the initialization code for the above module gets run. */
 /*
-INIT sys_init_array_module_builtins
+INIT mercury_sys_init_array_module_builtins
 */
 
 /* suppress gcc -Wmissing-decl warning */
-void sys_init_array_module_builtins_init(void);
-void sys_init_array_module_builtins_init_type_tables(void);
+void mercury_sys_init_array_module_builtins_init(void);
+void mercury_sys_init_array_module_builtins_init_type_tables(void);
 #ifdef	MR_DEEP_PROFILING
-void sys_init_array_module_builtins_write_out_proc_statics(FILE *fp);
+void mercury_sys_init_array_module_builtins_write_out_proc_statics(FILE *fp);
 #endif
 
 void
-sys_init_array_module_builtins_init(void)
+mercury_sys_init_array_module_builtins_init(void)
 {
 #ifndef MR_HIGHLEVEL_CODE
 	array_module_builtins();
@@ -577,7 +577,7 @@
 }
 
 void
-sys_init_array_module_builtins_init_type_tables(void)
+mercury_sys_init_array_module_builtins_init_type_tables(void)
 {
 #ifndef MR_HIGHLEVEL_CODE
 	MR_register_type_ctor_info(
@@ -587,7 +587,7 @@
 
 #ifdef	MR_DEEP_PROFILING
 void
-sys_init_array_module_builtins_write_out_proc_statics(FILE *fp)
+mercury_sys_init_array_module_builtins_write_out_proc_statics(FILE *fp)
 {
 	MR_write_out_proc_static(fp, (MR_ProcStatic *)
 		&MR_proc_static_compiler_name(array, __Unify__, array, 1, 0));
Index: library/builtin.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/builtin.m,v
retrieving revision 1.79
diff -u -b -r1.79 builtin.m
--- library/builtin.m	16 Sep 2002 06:07:44 -0000	1.79
+++ library/builtin.m	23 Sep 2002 01:32:42 -0000
@@ -790,7 +790,7 @@
 }
 
 /* forward decl, to suppress gcc -Wmissing-decl warning */
-void sys_init_copy_module(void);
+void mercury_sys_init_copy_module(void);
 
 #else /* ! MR_HIGHLEVEL_CODE */
 
@@ -885,20 +885,20 @@
 /* Ensure that the initialization code for the above module gets run. */
 
 /*
-INIT sys_init_copy_module
+INIT mercury_sys_init_copy_module
 */
 
 /* suppress gcc -Wmissing-decl warnings */
-void sys_init_copy_module_init(void);
-void sys_init_copy_module_init_type_tables(void);
+void mercury_sys_init_copy_module_init(void);
+void mercury_sys_init_copy_module_init_type_tables(void);
 #ifdef MR_DEEP_PROFILING
-void sys_init_copy_module_write_out_proc_statics(FILE *fp);
+void mercury_sys_init_copy_module_write_out_proc_statics(FILE *fp);
 #endif
 
 MR_MODULE_STATIC_OR_EXTERN MR_ModuleFunc copy_module;
 
 void
-sys_init_copy_module_init(void)
+mercury_sys_init_copy_module_init(void)
 {
 #ifndef MR_HIGHLEVEL_CODE
 	copy_module();
@@ -906,13 +906,13 @@
 }
 
 void
-sys_init_copy_module_init_type_tables(void)
+mercury_sys_init_copy_module_init_type_tables(void)
 {
 }
 
 #ifdef	MR_DEEP_PROFILING
 void
-sys_init_copy_module_write_out_proc_statics(FILE *fp)
+mercury_sys_init_copy_module_write_out_proc_statics(FILE *fp)
 {
 	MR_write_out_proc_static(fp, (MR_ProcStatic *)
 		&mercury_data__proc_static__mercury__copy_2_0);
Index: library/io.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/io.m,v
retrieving revision 1.265
diff -u -b -r1.265 io.m
--- library/io.m	24 Jul 2002 16:05:11 -0000	1.265
+++ library/io.m	23 Sep 2002 09:20:13 -0000
@@ -1604,7 +1604,7 @@
 	if (read_buffer != initial_read_buffer) {
 		MR_free(read_buffer);
 	}
-	update_io(IO0, IO);
+	MR_update_io(IO0, IO);
 ").
 
 io__read_line_as_string_2(_, _, _) -->
@@ -1774,7 +1774,7 @@
 	} else {
 		/* Not a file stream so do nothing */
 	}
-	update_io(IO0, IO);
+	MR_update_io(IO0, IO);
 }").
 
 :- pragma foreign_proc("MC++", io__clear_err(_Stream::in, IO0::di, IO::uo),
@@ -1783,7 +1783,7 @@
 	// XXX no error flag to reset as in MC++ an error throws directly an
 	// exception (we should create an error indicator in MF_Mercury_file
 	// for compatibility)
-	update_io(IO0, IO);
+	MR_update_io(IO0, IO);
 }").
 
 io__clear_err(_) -->
@@ -1822,7 +1822,7 @@
 
 	ML_maybe_make_err_msg(RetVal != 0, ""read failed: "",
 		MR_PROC_LABEL, RetStr);
-	update_io(IO0, IO);
+	MR_update_io(IO0, IO);
 }").
 
 :- pragma foreign_proc("MC++", ferror(_Stream::in, RetVal::out, _RetStr::out,
@@ -1831,7 +1831,7 @@
 "{
 	// XXX see clearerr
 	RetVal = 0;
-	update_io(IO0, IO);
+	MR_update_io(IO0, IO);
 }").
 
 ferror(_, _, _) -->
@@ -1851,7 +1851,7 @@
 		[will_not_call_mercury, promise_pure, tabled_for_io],
 "{
 	ML_maybe_make_err_msg(MR_TRUE, Msg0, MR_PROC_LABEL, Msg);
-	update_io(IO0, IO);
+	MR_update_io(IO0, IO);
 }").
 
 :- pragma foreign_proc("MC++", 
@@ -1908,7 +1908,7 @@
 #else
 	Size = -1;
 #endif
-	update_io(IO0, IO);
+	MR_update_io(IO0, IO);
 }").
 
 :- pragma foreign_proc("MC++", io__stream_file_size(Stream::in, Size::out,
@@ -1922,7 +1922,7 @@
 	} else {
 	       Size = -1;
 	}
-	update_io(IO0, IO);
+	MR_update_io(IO0, IO);
 }").
 
 io__stream_file_size(_, _) -->
@@ -1964,7 +1964,7 @@
 	Msg = MR_make_string_const(
 	""io__file_modification_time not available on this platform"");
 #endif
-	update_io(IO0, IO);
+	MR_update_io(IO0, IO);
 
 }").
 
@@ -2084,7 +2084,7 @@
 
 	Buffer = (MR_Word) buffer;
 	Pos = Pos0 + items_read;
-	update_io(IO0, IO);
+	MR_update_io(IO0, IO);
 }").
 
 
@@ -2972,7 +2972,7 @@
 		[will_not_call_mercury, promise_pure, tabled_for_io],
 "
 	StreamNames = ML_io_stream_names;
-	update_io(IO0, IO);
+	MR_update_io(IO0, IO);
 ").
 
 :- pragma foreign_proc("C", 
@@ -2980,7 +2980,7 @@
 		[will_not_call_mercury, promise_pure, tabled_for_io],
 "
 	ML_io_stream_names = StreamNames;
-	update_io(IO0, IO);
+	MR_update_io(IO0, IO);
 ").
 
 :- pragma foreign_proc("MC++", 
@@ -2988,7 +2988,7 @@
 		[will_not_call_mercury, promise_pure, tabled_for_io],
 "
 	StreamNames = ML_io_stream_names;
-	update_io(IO0, IO);
+	MR_update_io(IO0, IO);
 ").
 
 :- pragma foreign_proc("MC++", 
@@ -2996,7 +2996,7 @@
 		[will_not_call_mercury, promise_pure, tabled_for_io],
 "
 	ML_io_stream_names = StreamNames;
-	update_io(IO0, IO);
+	MR_update_io(IO0, IO);
 ").
 
 io__get_stream_names(_) -->
@@ -3038,7 +3038,7 @@
 		[will_not_call_mercury, promise_pure, tabled_for_io],
 "
 	Globals = ML_io_user_globals;
-	update_io(IOState0, IOState);
+	MR_update_io(IOState0, IOState);
 ").
 
 :- pragma foreign_proc("C", 
@@ -3047,7 +3047,7 @@
 "
 	/* XXX need to globalize the memory */
 	ML_io_user_globals = Globals;
-	update_io(IOState0, IOState);
+	MR_update_io(IOState0, IOState);
 ").
 
 :- pragma foreign_proc("MC++", 
@@ -3055,7 +3055,7 @@
 		[will_not_call_mercury, promise_pure, tabled_for_io],
 "
 	Globals = ML_io_user_globals;
-	update_io(IOState0, IOState);
+	MR_update_io(IOState0, IOState);
 ").
 
 :- pragma foreign_proc("MC++", 
@@ -3063,7 +3063,7 @@
 		[will_not_call_mercury, promise_pure, tabled_for_io],
 "
 	ML_io_user_globals = Globals;
-	update_io(IOState0, IOState);
+	MR_update_io(IOState0, IOState);
 ").
 
 io__set_globals(_) -->
@@ -3229,13 +3229,13 @@
 #endif
 	MR_add_root(&ML_io_stream_names, (MR_TypeInfo) StreamNamesType);
 	MR_add_root(&ML_io_user_globals, (MR_TypeInfo) UserGlobalsType);
-	update_io(IO0, IO);
+	MR_update_io(IO0, IO);
 ").
 
 :- pragma foreign_proc("MC++", 
 		io__gc_init(_StreamNamesType::in, _UserGlobalsType::in,
 		IO0::di, IO::uo), [will_not_call_mercury, promise_pure], "
-	update_io(IO0, IO);
+	MR_update_io(IO0, IO);
 	ascii_encoder =	new System::Text::ASCIIEncoding();
 ").
 
@@ -3356,9 +3356,10 @@
 extern MercuryFile *mercury_current_binary_input;
 extern MercuryFile *mercury_current_binary_output;
 
-#define initial_io_state()		0	/* some random number */
-#define update_io(r_src, r_dest)	((r_dest) = (r_src))
-#define final_io_state(r)		((void)0)
+#define MR_initial_io_state()		0	/* some random number */
+#define MR_final_io_state(r)		((void)0)
+
+#define MR_update_io(r_src, r_dest)	((r_dest) = (r_src))
 
 void 		mercury_init_io(void);
 MercuryFile*	mercury_open(const char *filename, const char *openmode);
@@ -3402,9 +3403,9 @@
 #define ML_DownCast(Cast, Expr) dynamic_cast<Cast>(Expr)
 #define ML_UpCast(Cast, Expr) ((Cast) (Expr))
 
-#define initial_io_state()	0	/* some random number */
-#define update_io(r_src, r_dest)	(0)
-#define final_io_state(r)
+#define MR_initial_io_state()	0	/* some random number */
+#define MR_update_io(r_src, r_dest)	(0)
+#define MR_final_io_state(r)
 
 
 ").
@@ -3933,7 +3934,7 @@
 		[will_not_call_mercury, promise_pure, tabled_for_io],
 "
 	CharCode = mercury_getc((MercuryFile *) File);
-	update_io(IO0, IO);
+	MR_update_io(IO0, IO);
 ").
 
 :- pragma foreign_proc("C", 
@@ -3948,7 +3949,7 @@
 	if (MR_UNGETCH(*mf, Character) == EOF) {
 		mercury_io_error(mf, ""io__putback_char: ungetc failed"");
 	}
-	update_io(IO0, IO);
+	MR_update_io(IO0, IO);
 }").
 
 :- pragma foreign_proc("C",
@@ -3960,7 +3961,7 @@
 	if (MR_UNGETCH(*mf, Character) == EOF) {
 		mercury_io_error(mf, ""io__putback_byte: ungetc failed"");
 	}
-	update_io(IO0, IO);
+	MR_update_io(IO0, IO);
 }").
 
 :- pragma foreign_proc("MC++", 
@@ -3969,7 +3970,7 @@
 	MR_MercuryFile mf = ML_DownCast(MR_MercuryFile, 
 		MR_word_to_c_pointer(File));
 	CharCode = mercury_getc(mf);
-	update_io(IO0, IO);
+	MR_update_io(IO0, IO);
 ").
 
 :- pragma foreign_proc("MC++", 
@@ -3982,7 +3983,7 @@
 		mf->line_number--;
 	}
 	mf->stream->Seek(-1, System::IO::SeekOrigin::Current);
-	update_io(IO0, IO);
+	MR_update_io(IO0, IO);
 }").
 
 :- pragma foreign_proc("MC++",
@@ -3992,7 +3993,7 @@
 	MR_MercuryFile mf = ML_DownCast(MR_MercuryFile, 
 		MR_word_to_c_pointer(File));
 	mf->stream->Seek(-1, System::IO::SeekOrigin::Current);
-	update_io(IO0, IO);
+	MR_update_io(IO0, IO);
 }").
 
 io__read_char_code(_, _) -->
@@ -4017,7 +4018,7 @@
 		[may_call_mercury, promise_pure, tabled_for_io, thread_safe],
 "
 	mercury_print_string(mercury_current_text_output, Message);
-	update_io(IO0, IO);
+	MR_update_io(IO0, IO);
 ").
 
 :- pragma foreign_proc("C", 
@@ -4030,7 +4031,7 @@
 	if (Character == '\\n') {
 		MR_line_number(*mercury_current_text_output)++;
 	}
-	update_io(IO0, IO);
+	MR_update_io(IO0, IO);
 ").
 
 :- pragma foreign_proc("C",
@@ -4040,7 +4041,7 @@
 	if (ML_fprintf(mercury_current_text_output, ""%ld"", (long) Val) < 0) {
 		mercury_output_error(mercury_current_text_output);
 	}
-	update_io(IO0, IO);
+	MR_update_io(IO0, IO);
 ").
 
 :- pragma foreign_proc("C",
@@ -4050,7 +4051,7 @@
 	if (ML_fprintf(mercury_current_text_output, ""%#.15g"", Val) < 0) {
 		mercury_output_error(mercury_current_text_output);
 	}
-	update_io(IO0, IO);
+	MR_update_io(IO0, IO);
 ").
 
 :- pragma foreign_proc("C",
@@ -4063,7 +4064,7 @@
 	{
 		mercury_output_error(mercury_current_text_output);
 	}
-	update_io(IO0, IO);
+	MR_update_io(IO0, IO);
 ").
 
 :- pragma foreign_proc("C",
@@ -4071,7 +4072,7 @@
 		[may_call_mercury, promise_pure, tabled_for_io, thread_safe],
 "{
 	mercury_print_binary_string(mercury_current_binary_output, Message);
-	update_io(IO0, IO);
+	MR_update_io(IO0, IO);
 }").
 
 :- pragma foreign_proc("C", 
@@ -4081,7 +4082,7 @@
 	if (MR_FLUSH(*mercury_current_text_output) < 0) {
 		mercury_output_error(mercury_current_text_output);
 	}
-	update_io(IO0, IO);
+	MR_update_io(IO0, IO);
 ").
 
 :- pragma foreign_proc("C",
@@ -4091,7 +4092,7 @@
 	if (MR_FLUSH(*mercury_current_binary_output) < 0) {
 		mercury_output_error(mercury_current_binary_output);
 	}
-	update_io(IO0, IO);
+	MR_update_io(IO0, IO);
 ").
 
 :- pragma foreign_proc("MC++", 
@@ -4099,7 +4100,7 @@
 		[may_call_mercury, promise_pure, thread_safe, tabled_for_io],
 "
 	mercury_print_string(mercury_current_text_output, Message);
-	update_io(IO0, IO);
+	MR_update_io(IO0, IO);
 ").
 
 :- pragma foreign_proc("MC++", 
@@ -4113,7 +4114,7 @@
 	if (Character == '\\n') {
 		mercury_current_text_output->line_number++;
 	}
-	update_io(IO0, IO);
+	MR_update_io(IO0, IO);
 ").
 
 :- pragma foreign_proc("MC++",
@@ -4121,7 +4122,7 @@
 		[may_call_mercury, promise_pure, thread_safe, tabled_for_io],
 "
 	mercury_print_string(mercury_current_text_output, Val.ToString());
-	update_io(IO0, IO);
+	MR_update_io(IO0, IO);
 ").
 
 :- pragma foreign_proc("MC++",
@@ -4129,7 +4130,7 @@
 		[may_call_mercury, promise_pure, thread_safe, tabled_for_io],
 "
 	mercury_print_string(mercury_current_text_output, Val.ToString());
-	update_io(IO0, IO);
+	MR_update_io(IO0, IO);
 ").
 
 :- pragma foreign_proc("MC++",
@@ -4149,7 +4150,7 @@
 		[may_call_mercury, promise_pure, thread_safe, tabled_for_io],
 "{
 	mercury_print_binary_string(mercury_current_binary_output, Message);
-	update_io(IO0, IO);
+	MR_update_io(IO0, IO);
 }").
 
 :- pragma foreign_proc("MC++", 
@@ -4157,7 +4158,7 @@
 		[may_call_mercury, promise_pure, thread_safe, tabled_for_io],
 "
 	mercury_current_text_output->stream->Flush();
-	update_io(IO0, IO);
+	MR_update_io(IO0, IO);
 ").
 
 :- pragma foreign_proc("MC++",
@@ -4165,7 +4166,7 @@
 		[may_call_mercury, promise_pure, thread_safe, tabled_for_io],
 "
 	mercury_current_binary_output->stream->Flush();
-	update_io(IO0, IO);
+	MR_update_io(IO0, IO);
 ").
 
 io__write_string(_) -->
@@ -4239,7 +4240,7 @@
 		mercury_io_error(stream,
 				""io__seek_binary_2: unseekable stream"");
 	}
-	update_io(IO0, IO);
+	MR_update_io(IO0, IO);
 }").
 
 :- pragma foreign_proc("C",
@@ -4257,7 +4258,7 @@
 		mercury_io_error(stream,
 			""io__binary_stream_offset: untellable stream"");
 	}
-	update_io(IO0, IO);
+	MR_update_io(IO0, IO);
 }").
 
 io__seek_binary_2(_, _, _) -->
@@ -4278,7 +4279,7 @@
 "{
 	MercuryFile *stream = (MercuryFile *) Stream;
 	mercury_print_string(stream, Message);
-	update_io(IO0, IO);
+	MR_update_io(IO0, IO);
 }").
 
 :- pragma foreign_proc("C",
@@ -4292,7 +4293,7 @@
 	if (Character == '\\n') {
 		MR_line_number(*stream)++;
 	}
-	update_io(IO0, IO);
+	MR_update_io(IO0, IO);
 }").
 
 :- pragma foreign_proc("C",
@@ -4303,7 +4304,7 @@
 	if (ML_fprintf(stream, ""%ld"", (long) Val) < 0) {
 		mercury_output_error(stream);
 	}
-	update_io(IO0, IO);
+	MR_update_io(IO0, IO);
 }").
 
 :- pragma foreign_proc("C",
@@ -4314,7 +4315,7 @@
 	if (ML_fprintf(stream, ""%#.15g"", Val) < 0) {
 		mercury_output_error(stream);
 	}
-	update_io(IO0, IO);
+	MR_update_io(IO0, IO);
 }").
 
 :- pragma foreign_proc("C",
@@ -4326,7 +4327,7 @@
 	if (MR_PUTCH(*stream, (int) ((unsigned char) Byte)) < 0) {
 		mercury_output_error(stream);
 	}
-	update_io(IO0, IO);
+	MR_update_io(IO0, IO);
 }").
 
 :- pragma foreign_proc("C",
@@ -4335,7 +4336,7 @@
 "{
 	MercuryFile *stream = (MercuryFile *) Stream;
 	mercury_print_binary_string(stream, Message);
-	update_io(IO0, IO);
+	MR_update_io(IO0, IO);
 }").
 
 :- pragma foreign_proc("C",
@@ -4346,7 +4347,7 @@
 	if (MR_FLUSH(*stream) < 0) {
 		mercury_output_error(stream);
 	}
-	update_io(IO0, IO);
+	MR_update_io(IO0, IO);
 }").
 
 :- pragma foreign_proc("C",
@@ -4357,7 +4358,7 @@
 	if (MR_FLUSH(*stream) < 0) {
 		mercury_output_error(stream);
 	}
-	update_io(IO0, IO);
+	MR_update_io(IO0, IO);
 }").
 
 :- pragma foreign_proc("MC++",
@@ -4367,7 +4368,7 @@
 	MR_MercuryFile stream = ML_DownCast(MR_MercuryFile, 
 		MR_word_to_c_pointer(Stream));
 	mercury_print_string(stream, Message);
-	update_io(IO0, IO);
+	MR_update_io(IO0, IO);
 }").
 
 :- pragma foreign_proc("MC++",
@@ -4380,7 +4381,7 @@
 		mercury_current_binary_output->stream);
 	w->Write(Character);
 	w->Flush();
-	update_io(IO0, IO);
+	MR_update_io(IO0, IO);
 }").
 
 :- pragma foreign_proc("MC++",
@@ -4393,7 +4394,7 @@
 		mercury_current_binary_output->stream);
 	w->Write(Val.ToString());
 	w->Flush();
-	update_io(IO0, IO);
+	MR_update_io(IO0, IO);
 }").
 
 :- pragma foreign_proc("MC++",
@@ -4406,7 +4407,7 @@
 		mercury_current_binary_output->stream);
 	w->Write(Val.ToString());
 	w->Flush();
-	update_io(IO0, IO);
+	MR_update_io(IO0, IO);
 }").
 
 :- pragma foreign_proc("MC++",
@@ -4421,7 +4422,7 @@
 		mercury_current_binary_output->stream);
 	w->Write(Byte.ToString());
 	w->Flush();
-	update_io(IO0, IO);
+	MR_update_io(IO0, IO);
 }").
 
 :- pragma foreign_proc("MC++",
@@ -4431,7 +4432,7 @@
 	MR_MercuryFile stream = ML_DownCast(MR_MercuryFile, 
 		MR_word_to_c_pointer(Stream));
 	mercury_print_binary_string(stream, Message);
-	update_io(IO0, IO);
+	MR_update_io(IO0, IO);
 }").
 
 :- pragma foreign_proc("MC++",
@@ -4441,7 +4442,7 @@
 	MR_MercuryFile stream = ML_DownCast(MR_MercuryFile, 
 		MR_word_to_c_pointer(Stream));
 	stream->stream->Flush();
-	update_io(IO0, IO);
+	MR_update_io(IO0, IO);
 }").
 
 :- pragma foreign_proc("MC++",
@@ -4451,7 +4452,7 @@
 	MR_MercuryFile stream = ML_DownCast(MR_MercuryFile, 
 		MR_word_to_c_pointer(Stream));
 	stream->stream->Flush();
-	update_io(IO0, IO);
+	MR_update_io(IO0, IO);
 }").
 
 io__write_string(_, _) -->
@@ -4506,7 +4507,7 @@
 			thread_safe],
 "
 	Stream = (MR_Word) &mercury_stdin;
-	update_io(IO0, IO);
+	MR_update_io(IO0, IO);
 ").
 
 :- pragma foreign_proc("C",
@@ -4515,7 +4516,7 @@
 			thread_safe],
 "
 	Stream = (MR_Word) &mercury_stdout;
-	update_io(IO0, IO);
+	MR_update_io(IO0, IO);
 ").
 
 :- pragma foreign_proc("C",
@@ -4524,7 +4525,7 @@
 			thread_safe],
 "
 	Stream = (MR_Word) &mercury_stderr;
-	update_io(IO0, IO);
+	MR_update_io(IO0, IO);
 ").
 
 :- pragma foreign_proc("C",
@@ -4533,7 +4534,7 @@
 			thread_safe],
 "
 	Stream = (MR_Word) &mercury_stdin_binary;
-	update_io(IO0, IO);
+	MR_update_io(IO0, IO);
 ").
 
 :- pragma foreign_proc("C",
@@ -4542,7 +4543,7 @@
 			thread_safe],
 "
 	Stream = (MR_Word) &mercury_stdout_binary;
-	update_io(IO0, IO);
+	MR_update_io(IO0, IO);
 ").
 
 :- pragma foreign_proc("C",
@@ -4550,7 +4551,7 @@
 		[will_not_call_mercury, promise_pure, tabled_for_io],
 "
 	Stream = (MR_Word) mercury_current_text_input;
-	update_io(IO0, IO);
+	MR_update_io(IO0, IO);
 ").
 
 :- pragma foreign_proc("C",
@@ -4558,7 +4559,7 @@
 		[will_not_call_mercury, promise_pure, tabled_for_io],
 "
 	Stream = (MR_Word) mercury_current_text_output;
-	update_io(IO0, IO);
+	MR_update_io(IO0, IO);
 ").
 
 :- pragma foreign_proc("C",
@@ -4566,7 +4567,7 @@
 		[will_not_call_mercury, promise_pure, tabled_for_io],
 "
 	Stream = (MR_Word) mercury_current_binary_input;
-	update_io(IO0, IO);
+	MR_update_io(IO0, IO);
 ").
 
 :- pragma foreign_proc("C",
@@ -4574,7 +4575,7 @@
 		[will_not_call_mercury, promise_pure, tabled_for_io],
 "
 	Stream = (MR_Word) mercury_current_binary_output;
-	update_io(IO0, IO);
+	MR_update_io(IO0, IO);
 ").
 
 :- pragma foreign_proc("C",
@@ -4582,7 +4583,7 @@
 		[will_not_call_mercury, promise_pure, tabled_for_io],
 "
 	LineNum = MR_line_number(*mercury_current_text_input);
-	update_io(IO0, IO);
+	MR_update_io(IO0, IO);
 ").
 
 :- pragma foreign_proc("C",
@@ -4591,7 +4592,7 @@
 "{
 	MercuryFile *stream = (MercuryFile *) Stream;
 	LineNum = MR_line_number(*stream);
-	update_io(IO0, IO);
+	MR_update_io(IO0, IO);
 }").
 
 :- pragma foreign_proc("C",
@@ -4599,7 +4600,7 @@
 		[will_not_call_mercury, promise_pure, tabled_for_io],
 "
 	MR_line_number(*mercury_current_text_input) = LineNum;
-	update_io(IO0, IO);
+	MR_update_io(IO0, IO);
 ").
 
 :- pragma foreign_proc("C",
@@ -4608,7 +4609,7 @@
 "{
 	MercuryFile *stream = (MercuryFile *) Stream;
 	MR_line_number(*stream) = LineNum;
-	update_io(IO0, IO);
+	MR_update_io(IO0, IO);
 }").
 
 :- pragma foreign_proc("C",
@@ -4616,7 +4617,7 @@
 		[will_not_call_mercury, promise_pure, tabled_for_io],
 "
 	LineNum = MR_line_number(*mercury_current_text_output);
-	update_io(IO0, IO);
+	MR_update_io(IO0, IO);
 ").
 	
 :- pragma foreign_proc("C",
@@ -4625,7 +4626,7 @@
 "{
 	MercuryFile *stream = (MercuryFile *) Stream;
 	LineNum = MR_line_number(*stream);
-	update_io(IO0, IO);
+	MR_update_io(IO0, IO);
 }").
 
 :- pragma foreign_proc("C",
@@ -4633,7 +4634,7 @@
 		[will_not_call_mercury, promise_pure, tabled_for_io],
 "
 	MR_line_number(*mercury_current_text_output) = LineNum;
-	update_io(IO0, IO);
+	MR_update_io(IO0, IO);
 ").
 
 :- pragma foreign_proc("C",
@@ -4643,7 +4644,7 @@
 "{
 	MercuryFile *stream = (MercuryFile *) Stream;
 	MR_line_number(*stream) = LineNum;
-	update_io(IO0, IO);
+	MR_update_io(IO0, IO);
 }").
 
 :- pragma foreign_proc("C",
@@ -4651,7 +4652,7 @@
 		[will_not_call_mercury, promise_pure, tabled_for_io],
 "
 	OutStream = (MR_Word) mercury_current_text_input;
-	update_io(IO0, IO);
+	MR_update_io(IO0, IO);
 ").
 
 :- pragma foreign_proc("C",
@@ -4659,7 +4660,7 @@
 		[will_not_call_mercury, promise_pure, tabled_for_io],
 "
 	OutStream = (MR_Word) mercury_current_text_output;
-	update_io(IO0, IO);
+	MR_update_io(IO0, IO);
 ").
 
 :- pragma foreign_proc("C",
@@ -4667,7 +4668,7 @@
 		[will_not_call_mercury, promise_pure, tabled_for_io],
 "
 	OutStream = (MR_Word) mercury_current_binary_input;
-	update_io(IO0, IO);
+	MR_update_io(IO0, IO);
 ").
 
 :- pragma foreign_proc("C",
@@ -4675,7 +4676,7 @@
 		[will_not_call_mercury, promise_pure, tabled_for_io],
 "
 	OutStream = (MR_Word) mercury_current_binary_output;
-	update_io(IO0, IO);
+	MR_update_io(IO0, IO);
 ").
 
 % io__set_input_stream(NewStream, OldStream, IO0, IO1)
@@ -4688,7 +4689,7 @@
 "
 	OutStream = (MR_Word) mercury_current_text_input;
 	mercury_current_text_input = (MercuryFile *) NewStream;
-	update_io(IO0, IO);
+	MR_update_io(IO0, IO);
 ").
 
 :- pragma foreign_proc("C",
@@ -4698,7 +4699,7 @@
 "
 	OutStream = (MR_Word) mercury_current_text_output;
 	mercury_current_text_output = (MercuryFile *) NewStream;
-	update_io(IO0, IO);
+	MR_update_io(IO0, IO);
 ").
 
 :- pragma foreign_proc("C",
@@ -4708,7 +4709,7 @@
 "
 	OutStream = (MR_Word) mercury_current_binary_input;
 	mercury_current_binary_input = (MercuryFile *) NewStream;
-	update_io(IO0, IO);
+	MR_update_io(IO0, IO);
 ").
 
 :- pragma foreign_proc("C",
@@ -4718,7 +4719,7 @@
 "
 	OutStream = (MR_Word) mercury_current_binary_output;
 	mercury_current_binary_output = (MercuryFile *) NewStream;
-	update_io(IO0, IO);
+	MR_update_io(IO0, IO);
 ").
 
 :- pragma foreign_proc("MC++",
@@ -4727,7 +4728,7 @@
 			tabled_for_io],
 "
 	MR_c_pointer_to_word(Stream, mercury_stdin);
-	update_io(IO0, IO);
+	MR_update_io(IO0, IO);
 ").
 
 :- pragma foreign_proc("MC++",
@@ -4736,7 +4737,7 @@
 			tabled_for_io],
 "
 	MR_c_pointer_to_word(Stream, mercury_stdout);
-	update_io(IO0, IO);
+	MR_update_io(IO0, IO);
 ").
 
 :- pragma foreign_proc("MC++",
@@ -4745,7 +4746,7 @@
 			tabled_for_io],
 "
 	MR_c_pointer_to_word(Stream, mercury_stderr);
-	update_io(IO0, IO);
+	MR_update_io(IO0, IO);
 ").
 
 :- pragma foreign_proc("MC++",
@@ -4754,7 +4755,7 @@
 			tabled_for_io],
 "
 	MR_c_pointer_to_word(Stream, mercury_stdin_binary);
-	update_io(IO0, IO);
+	MR_update_io(IO0, IO);
 ").
 
 :- pragma foreign_proc("MC++",
@@ -4763,7 +4764,7 @@
 			tabled_for_io],
 "
 	MR_c_pointer_to_word(Stream, mercury_stdout_binary);
-	update_io(IO0, IO);
+	MR_update_io(IO0, IO);
 ").
 
 :- pragma foreign_proc("MC++",
@@ -4771,7 +4772,7 @@
 		[will_not_call_mercury, promise_pure, tabled_for_io],
 "
 	MR_c_pointer_to_word(Stream, mercury_current_text_input);
-	update_io(IO0, IO);
+	MR_update_io(IO0, IO);
 ").
 
 :- pragma foreign_proc("MC++",
@@ -4779,7 +4780,7 @@
 		[will_not_call_mercury, promise_pure, tabled_for_io],
 "
 	MR_c_pointer_to_word(Stream, mercury_current_text_output);
-	update_io(IO0, IO);
+	MR_update_io(IO0, IO);
 ").
 
 :- pragma foreign_proc("MC++",
@@ -4787,7 +4788,7 @@
 		[will_not_call_mercury, promise_pure, tabled_for_io],
 "
 	MR_c_pointer_to_word(Stream, mercury_current_binary_input);
-	update_io(IO0, IO);
+	MR_update_io(IO0, IO);
 ").
 
 :- pragma foreign_proc("MC++",
@@ -4795,7 +4796,7 @@
 		[will_not_call_mercury, promise_pure, tabled_for_io],
 "
 	MR_c_pointer_to_word(Stream, mercury_current_binary_output);
-	update_io(IO0, IO);
+	MR_update_io(IO0, IO);
 ").
 
 :- pragma foreign_proc("MC++",
@@ -4803,7 +4804,7 @@
 		[will_not_call_mercury, promise_pure, tabled_for_io],
 "
 	LineNum = mercury_current_text_input->line_number;
-	update_io(IO0, IO);
+	MR_update_io(IO0, IO);
 ").
 
 :- pragma foreign_proc("MC++",
@@ -4813,7 +4814,7 @@
 	MR_MercuryFile stream = ML_DownCast(MR_MercuryFile, 
 		MR_word_to_c_pointer(Stream));
 	LineNum = stream->line_number;
-	update_io(IO0, IO);
+	MR_update_io(IO0, IO);
 }").
 
 :- pragma foreign_proc("MC++",
@@ -4821,7 +4822,7 @@
 		[will_not_call_mercury, promise_pure, tabled_for_io],
 "
 	mercury_current_text_input->line_number = LineNum;
-	update_io(IO0, IO);
+	MR_update_io(IO0, IO);
 ").
 
 :- pragma foreign_proc("MC++",
@@ -4831,14 +4832,14 @@
 	MR_MercuryFile stream = ML_DownCast(MR_MercuryFile, 
 		MR_word_to_c_pointer(Stream));
 	stream->line_number = LineNum;
-	update_io(IO0, IO);
+	MR_update_io(IO0, IO);
 }").
 
 :- pragma foreign_proc("MC++",
 	io__get_output_line_number(LineNum::out, IO0::di, IO::uo),
 		[will_not_call_mercury, promise_pure, tabled_for_io], "
 	LineNum = mercury_current_text_output->line_number;
-	update_io(IO0, IO);
+	MR_update_io(IO0, IO);
 ").
 
 :- pragma foreign_proc("MC++",
@@ -4847,14 +4848,14 @@
 	MR_MercuryFile stream = ML_DownCast(MR_MercuryFile, 
 		MR_word_to_c_pointer(Stream));
 	LineNum = stream->line_number;
-	update_io(IO0, IO);
+	MR_update_io(IO0, IO);
 }").
 
 :- pragma foreign_proc("MC++",
 	io__set_output_line_number(LineNum::in, IO0::di, IO::uo),
 		[will_not_call_mercury, promise_pure, tabled_for_io], "
 	mercury_current_text_output->line_number = LineNum;
-	update_io(IO0, IO);
+	MR_update_io(IO0, IO);
 ").
 
 :- pragma foreign_proc("MC++",
@@ -4863,7 +4864,7 @@
 	MR_MercuryFile stream = ML_DownCast(MR_MercuryFile, 
 		MR_word_to_c_pointer(Stream));
 	stream->line_number = LineNum;
-	update_io(IO0, IO);
+	MR_update_io(IO0, IO);
 }").
 
 % io__set_input_stream(NewStream, OldStream, IO0, IO1)
@@ -4875,7 +4876,7 @@
 	MR_c_pointer_to_word(OutStream, mercury_current_text_input);
 	mercury_current_text_input = 
 		ML_DownCast(MR_MercuryFile, MR_word_to_c_pointer(NewStream));
-	update_io(IO0, IO);
+	MR_update_io(IO0, IO);
 ").
 
 :- pragma foreign_proc("MC++",
@@ -4884,7 +4885,7 @@
 	MR_c_pointer_to_word(OutStream, mercury_current_text_output);
 	mercury_current_text_output = 
 		ML_DownCast(MR_MercuryFile, MR_word_to_c_pointer(NewStream));
-	update_io(IO0, IO);
+	MR_update_io(IO0, IO);
 ").
 
 :- pragma foreign_proc("MC++",
@@ -4894,7 +4895,7 @@
 	MR_c_pointer_to_word(OutStream, mercury_current_binary_input);
 	mercury_current_binary_input = 
 		ML_DownCast(MR_MercuryFile, MR_word_to_c_pointer(NewStream));
-	update_io(IO0, IO);
+	MR_update_io(IO0, IO);
 ").
 
 :- pragma foreign_proc("MC++",
@@ -4904,7 +4905,7 @@
 	MR_c_pointer_to_word(OutStream, mercury_current_binary_output);
 	mercury_current_binary_output = 
 		ML_DownCast(MR_MercuryFile, MR_word_to_c_pointer(NewStream));
-	update_io(IO0, IO);
+	MR_update_io(IO0, IO);
 ").
 
 io__stdin_stream(_) -->
@@ -5045,7 +5046,7 @@
 "
 	Stream = (MR_Word) mercury_open(FileName, Mode);
 	ResultCode = (Stream ? 0 : -1);
-	update_io(IO0, IO);
+	MR_update_io(IO0, IO);
 ").
 
 :- pragma foreign_proc("MC++",
@@ -5057,7 +5058,7 @@
 	MR_MercuryFile mf = mercury_open(FileName, Mode);
 	MR_c_pointer_to_word(Stream, mf);
 	ResultCode = (mf ? 0 : -1);
-	update_io(IO0, IO);
+	MR_update_io(IO0, IO);
 ").
 
 io__do_open(_, _, _, _) -->
@@ -5086,7 +5087,7 @@
 :- pragma foreign_proc("C", io__close_stream(Stream::in, IO0::di, IO::uo),
 		[may_call_mercury, promise_pure, tabled_for_io, thread_safe], "
 	mercury_close((MercuryFile *) Stream);
-	update_io(IO0, IO);
+	MR_update_io(IO0, IO);
 ").
 
 :- pragma foreign_proc("MC++", io__close_stream(Stream::in, IO0::di, IO::uo),
@@ -5094,7 +5095,7 @@
 	MR_MercuryFile mf = ML_DownCast(MR_MercuryFile, 
 		MR_word_to_c_pointer(Stream));
 	mercury_close(mf);
-	update_io(IO0, IO);
+	MR_update_io(IO0, IO);
 ").
 
 io__close_stream(_) -->
@@ -5124,7 +5125,7 @@
 	} else {
 		PrognameOut = DefaultProgname;
 	}
-	update_io(IO0, IO);
+	MR_update_io(IO0, IO);
 ").
 
 :- pragma foreign_proc("C",
@@ -5140,7 +5141,7 @@
 			MR_PROC_LABEL);
 	  }
 	}
-	update_io(IO0, IO);
+	MR_update_io(IO0, IO);
 ").
 
 :- pragma foreign_proc("C",
@@ -5148,7 +5149,7 @@
 		[will_not_call_mercury, promise_pure, tabled_for_io], 
 "
 	ExitStatus = mercury_exit_status;
-	update_io(IO0, IO);
+	MR_update_io(IO0, IO);
 ").
 
 :- pragma foreign_proc("C",
@@ -5156,7 +5157,7 @@
 		[will_not_call_mercury, promise_pure, tabled_for_io],
 "
 	mercury_exit_status = ExitStatus;
-	update_io(IO0, IO);
+	MR_update_io(IO0, IO);
 ").
 
 :- pragma foreign_proc("C",
@@ -5178,7 +5179,7 @@
 	} else {
 		Msg = MR_make_string_const("""");	
 	}
-	update_io(IO0, IO);
+	MR_update_io(IO0, IO);
 ").
 
 
@@ -5252,7 +5253,7 @@
 	while (--i > 0) {
 		MR_list_cons(Args, arg_vector[i], Args);
 	}
-	update_io(IO0, IO);
+	MR_update_io(IO0, IO);
 #endif
 ").
 
@@ -5261,7 +5262,7 @@
 		[will_not_call_mercury, promise_pure, tabled_for_io],
 "
 	ExitStatus = System::Environment::get_ExitCode();
-	update_io(IO0, IO);
+	MR_update_io(IO0, IO);
 ").
 
 :- pragma foreign_proc("MC++",
@@ -5269,7 +5270,7 @@
 		[will_not_call_mercury, promise_pure, tabled_for_io],
 "
 	System::Environment::set_ExitCode(ExitStatus);
-	update_io(IO0, IO);
+	MR_update_io(IO0, IO);
 ").
 
 /* XXX Implementation needs to be finished.
@@ -5286,7 +5287,7 @@
 	mercury::runtime::Errors::SORRY(""foreign code for this function"");
 //	Diagnostics::Process::Start(commandstr, argstr);
 	Status = NULL;
-	update_io(IO0, IO);
+	MR_update_io(IO0, IO);
 ").
 */
 
@@ -5468,7 +5469,7 @@
 			MR_PROC_LABEL, ErrorMessage);
 		Error = err;
 	}
-	update_io(IO0, IO);
+	MR_update_io(IO0, IO);
 }").
 
 io__do_make_temp(_, _, _, _, _) -->
@@ -5542,7 +5543,7 @@
 	RetVal = remove(FileName);
 	ML_maybe_make_err_msg(RetVal != 0, ""remove failed: "",
 		MR_PROC_LABEL, RetStr);
-	update_io(IO0, IO);
+	MR_update_io(IO0, IO);
 }").
 
 /* XXX Implementation needs to be finished.
@@ -5556,7 +5557,7 @@
 	System::IO::File::Delete(FileName);
 	RetVal = 0;
 	RetStr = """";
-	update_io(IO0, IO);
+	MR_update_io(IO0, IO);
 }").
 */
 
@@ -5585,7 +5586,7 @@
 	RetVal = rename(OldFileName, NewFileName);
 	ML_maybe_make_err_msg(RetVal != 0, ""rename failed: "",
 		MR_PROC_LABEL, RetStr);
-	update_io(IO0, IO);
+	MR_update_io(IO0, IO);
 }").
 
 io__rename_file_2(_, _, _, _) -->
cvs diff: Diffing profiler
cvs diff: Diffing robdd
cvs diff: Diffing runtime
Index: runtime/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/Mmakefile,v
retrieving revision 1.94
diff -u -b -r1.94 Mmakefile
--- runtime/Mmakefile	11 Sep 2002 19:00:12 -0000	1.94
+++ runtime/Mmakefile	23 Sep 2002 08:54:34 -0000
@@ -4,25 +4,6 @@
 # Public License - see the file COPYING in the Mercury distribution.
 #-----------------------------------------------------------------------------#
 
-# Mmake - Mmake file for the Mercury runtime library
-
-MAIN_TARGET=runtime
-
-MERCURY_DIR=..
-LINK_BOEHM_GC_ONLY=yes
-include $(MERCURY_DIR)/Mmake.common
--include Mmake.runtime.params
-
-# Avoid trying to make this file with `mmc --make' if it doesn't exist.
-Mmake.runtime.params: ;
-
-#-----------------------------------------------------------------------------#
-
-CFLAGS	+= -g $(DLL_CFLAGS) -DMERCURY_BOOTSTRAP_H -DMERCURY_CONF_BOOTSTRAP_H
-MGNUCFLAGS	+= --no-ansi
-
-#-----------------------------------------------------------------------------#
-
 # All the headers in $(HDRS) should be syntactically well-formed
 # header files, unlike the headers in $(BODY_HDRS).
 # All the headers in $(HDRS) must also be in C (not C++).
@@ -187,6 +168,33 @@
 			mercury_type_tables.c	\
 			mercury_wrapper.c
 
+#-----------------------------------------------------------------------------#
+
+# Mmake - Mmake file for the Mercury runtime library
+
+MAIN_TARGET=runtime
+
+CHECK_HDRS  = $(HDRS)
+CHECK_MHDRS =
+CHECK_OBJS  = $(CFILES:.c=.$O)
+ALLOW_LIB_PREFIX=no
+ALLOW_BROWSER_PREFIX=no
+
+MERCURY_DIR=..
+LINK_BOEHM_GC_ONLY=yes
+include $(MERCURY_DIR)/Mmake.common
+-include Mmake.runtime.params
+
+# Avoid trying to make this file with `mmc --make' if it doesn't exist.
+Mmake.runtime.params: ;
+
+#-----------------------------------------------------------------------------#
+
+CFLAGS	+= -g $(DLL_CFLAGS) -DMERCURY_BOOTSTRAP_H -DMERCURY_CONF_BOOTSTRAP_H
+MGNUCFLAGS	+= --no-ansi
+
+#-----------------------------------------------------------------------------#
+
 OBJS		= $(CFILES:.c=.$O)
 PIC_OBJS	= $(CFILES:.c=.$(EXT_FOR_PIC_OBJECTS))
 
@@ -199,11 +207,6 @@
 		  esac							\
 		`
 
-HDR_CHECK_CS = $(HDRS:.h=.check_hdr.c)
-HDR_CHECK_OBJS = $(HDRS:.h=.check_hdr.$O)
-HDR_CHECK_MACROS = $(HDRS:.h=.check.macros)
-OBJ_CHECKS = $(OBJS:%=%.obj_check)
-
 $(HDR_CHECK_OBJS):	mercury_conf.h
 
 #-----------------------------------------------------------------------------#
@@ -316,42 +319,6 @@
 	ctags $(CFILES) $(HDRS) $(BODY_HDRS)
 
 #-----------------------------------------------------------------------------#
-#
-# `mmake check_namespace' performs various checks on the header files
-# and object files to make sure that they conform with our coding standards.
-#
-
-# Macro names must normally start with one of the prefixes associated
-# with the different components of our system:
-# 	`MR_' or `MERCURY_' for stuff in the Mercury runtime implementation
-# 		(the `runtime' and `trace' directories)
-# 	`GC_' for stuff in the Boehm et al conservative garbage collector
-# 		(the `boehm_gc' directory)
-# 	`MPS_' or `mps_' for stuff in the Memory Pool System toolkit
-# 		(the `mps_gc' directory, if present -- note that this
-# 		is in a separate CVS module and is not included in the
-# 		normal Mercury source distributions)
-# Exceptions to this policy must be listed in the RESERVED_MACRO_NAMES file.
-HEADER_CLEAN_FILTER = \
-	grep -v -e '^MR_' -e '^MERCURY_' -e '^GC_' -e '^MPS_' -e '^mps_' | \
-	fgrep -v -x -f RESERVED_MACRO_NAMES
-
-.PHONY: check_headers_self_contained
-check_headers_self_contained: $(HDR_CHECK_OBJS)
-
-.PHONY: check_headers_macros
-check_headers_macros: $(HDR_CHECK_MACROS)
-
-.PHONY: check_headers
-check_headers: check_headers_self_contained check_headers_macros
-
-.PHONY: check_objs
-check_objs: $(OBJ_CHECKS)
-
-.PHONY: check_namespace
-check_namespace: check_headers check_objs
-
-#-----------------------------------------------------------------------------#
 
 # installation rules
 
@@ -412,11 +379,6 @@
 .PHONY: clean_o
 clean_o:
 	rm -f $(OBJS) $(PIC_OBJS)
-
-.PHONY: clean_check
-clean_check:
-	rm -f $(HDR_CHECK_OBJS) $(HDR_CHECK_CS) $(HDR_CHECK_MACROS)
-	rm -f $(OBJ_CHECKS)
 
 .PHONY: realclean_local
 realclean_local:
Index: runtime/RESERVED_MACRO_NAMES
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/RESERVED_MACRO_NAMES,v
retrieving revision 1.12
diff -u -b -r1.12 RESERVED_MACRO_NAMES
--- runtime/RESERVED_MACRO_NAMES	21 Aug 2002 11:27:40 -0000	1.12
+++ runtime/RESERVED_MACRO_NAMES	21 Sep 2002 13:30:26 -0000
@@ -6,12 +6,10 @@
 #
 # RESERVED_MACRO_NAMES
 #
-# This file lists the macro names, other than the
-# ones starting with `MR_', `MERCURY_', or `GC_',
-# that are defined by the Mercury header files.
-# The Mmakefile target `check_headers' automatically
-# checks that no other macro names are defined.
-# This is done to keep our headers namespace-clean,
+# This file lists the macro names, other than the ones starting with a
+# certain set of allowed prefixes that are defined by the Mercury header files.
+# The Mmakefile target `check_headers' automatically checks that no other
+# macro names are defined. This is done to keep our headers namespace-clean,
 # i.e. ensure that we don't invade the user's namespace.
 #
 # This file is used as the argument to `fgrep -f'.
@@ -28,22 +26,6 @@
 # in the system headers. I don't think there is a nice way to
 # prefix this without requiring a later version of autoconf (e.g. 2.52).
 pid_t
-#-----------------------------------------------------------------------------#
-# These are defined by mercury.h
-# Normally macros should start with capital letters,
-# but in this case we need to use lowercase, otherwise
-# the macros wouldn't achieve their desired effect.
-# The `mercury__' prefix is unique enough.
-mercury__builtin____type_ctor_info_character_0
-mercury__builtin____type_ctor_info_float_0
-mercury__builtin____type_ctor_info_func_0
-mercury__builtin____type_ctor_info_int_0
-mercury__builtin____type_ctor_info_pred_0
-mercury__builtin____type_ctor_info_string_0
-mercury__builtin____type_ctor_info_tuple_0
-mercury__builtin____type_ctor_info_void_0
-mercury__private_builtin__SIZEOF_WORD
-mercury__private_builtin__unsafe_type_cast_2_p_0
 #-----------------------------------------------------------------------------#
 # These are defined by boehm_gc/gc.h.
 __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 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
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/structure_reuse
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/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
Index: tools/bootcheck
===================================================================
RCS file: /home/mercury1/repository/mercury/tools/bootcheck,v
retrieving revision 1.137
diff -u -b -r1.137 bootcheck
--- tools/bootcheck	2 Sep 2002 03:40:40 -0000	1.137
+++ tools/bootcheck	23 Sep 2002 10:11:22 -0000
@@ -54,15 +54,14 @@
 		that is not compatible with the standard one.
 	-p, --copy-profiler
 		Copy the profiler directory instead of linking it.
-		This is sometimes necessary for bootstrapping
-		changes.
+		This is sometimes necessary for bootstrapping changes.
 	-b-, --no-bootcheck
 		Do not run the bootstrap check; execute the test suite and/or
 		the extras only. This option requires a previous bootstrap
 		check to have left a working stage 2 directory.
 	--no-check-namespace
-		Don't build the check_namespace targets in the runtime
-		and trace directories.
+		Don't build the check_namespace targets in the runtime,
+		trace, browser and library directories.
 	-t-, --no-test-suite
 		By default, bootcheck will also run the test quite.
 		This option prevents that.
@@ -661,20 +660,63 @@
 		fi
 	fi
 
+	# Build the check_namespace target in the relevant directories.
+	# We want to do so before we delete any of the stage2 object files.
+
+	check_namespace_status=0
+	if $check_namespace
+	then
+		cd $root/stage2/runtime
+		mmake $mmake_opts check_namespace || {
+			echo '** mmake check_namespace failed in runtime!'
+			check_namespace_status=1
+		}
+		cd $root/stage2/trace
+		mmake $mmake_opts check_namespace || {
+			echo '** mmake check_namespace failed in trace!'
+			check_namespace_status=1
+		}
+		cd $root/stage2/library
+		mmake $mmake_opts check_namespace || {
+			echo '** mmake check_namespace failed in library!'
+			check_namespace_status=1
+		}
+		cd $root/stage2/browser
+		mmake $mmake_opts check_namespace || {
+			echo '** mmake check_namespace failed in browser!'
+			check_namespace_status=1
+		}
+		cd $root
+	fi
+
 	if $stop_after_stage_2
 	then
 		echo "stopping after building stage 2"
 		exit 0
 	fi
 
-	# We can remove the library object files now,
-	# but we will keep the compiler objects for a while longer
+	# We can now remove the object files from most stage2 directories,
+	# but we will keep the compiler objects for a while longer.
 	if $keep_objs
 	then
 		true
 	else
-		find $root/stage2/library -name "*.o" -print |
-		xargs /bin/rm -f
+		libdirs=$root/stage2/{library,browser}
+		if $copy_profiler
+		then
+			profdirs=
+		else
+			profdirs=$root/stage2/{profiler,deep_profiler}
+		fi
+		if $copy_runtime
+		then
+			rundirs=
+		else
+			rundirs=$root/stage2/{runtime,trace}
+		fi
+
+		objdirs="$libdirs $profdirs $rundirs"
+		find $objdirs -name "*.o" -print | xargs /bin/rm -f
 	fi
 
 	MERCURY_COMPILER=$root/stage2/compiler/mercury_compile
@@ -935,26 +977,6 @@
 	# Set PATH for mkinit, mmc, mgnuc, ml etc
 	PATH=$root/${stage2_insert}util:$root/${stage2_insert}scripts:$PATH
 	export PATH
-fi
-
-#-----------------------------------------------------------------------------#
-
-# build the check_namespace target in the runtime directory
-
-check_namespace_status=0
-if $check_namespace
-then
-	cd $root/${stage2_insert}runtime
-	mmake $mmake_opts check_namespace || {
-		echo '** mmake check_namespace failed!'
-		check_namespace_status=1
-	}
-	cd $root/${stage2_insert}trace
-	mmake $mmake_opts check_namespace || {
-		echo '** mmake check_namespace failed!'
-		check_namespace_status=1
-	}
-	cd $root
 fi
 
 #-----------------------------------------------------------------------------#
cvs diff: Diffing trace
Index: trace/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/mercury/trace/Mmakefile,v
retrieving revision 1.34
diff -u -b -r1.34 Mmakefile
--- trace/Mmakefile	11 Sep 2002 19:00:19 -0000	1.34
+++ trace/Mmakefile	23 Sep 2002 08:54:43 -0000
@@ -7,29 +7,6 @@
 # Mmakefile for the Mercury trace library, which contains the runtime
 # system components that are needed only if some procedures are traced.
 
-MAIN_TARGET=trace
-
-MERCURY_DIR=..
-LINK_STDLIB_ONLY=yes
-include $(MERCURY_DIR)/Mmake.common
--include Mmake.trace.params
-
-# Avoid trying to make this file with `mmc --make' if it doesn't exist.
-Mmake.trace.params: ;
-
-#-----------------------------------------------------------------------------#
-
-CFLAGS		+= -I$(BROWSER_DIR) -g $(DLL_CFLAGS) \
-			-DMR_NO_BACKWARDS_COMPAT -DMERCURY_CONF_BOOTSTRAP_H
-MGNUCFLAGS	+= --no-ansi
-
-#-----------------------------------------------------------------------------#
-
-# mercury_readline.c #includes the GNU readline headers, which
-# lack prototypes and `const', so we need to disable warnings
-# when compiling that file.
-MGNUCFLAGS-mercury_trace_readline = --no-check
-
 #-----------------------------------------------------------------------------#
 
 # keep this list in alphabetical order, please
@@ -77,11 +54,6 @@
 OBJS		= $(CFILES:.c=.$O)
 PIC_OBJS	= $(CFILES:.c=.$(EXT_FOR_PIC_OBJECTS))
 
-HDR_CHECK_CS	= $(HDRS:.h=.check_hdr.c)
-HDR_CHECK_OBJS	= $(HDRS:.h=.check_hdr.$O)
-HDR_CHECK_MACROS = $(HDRS:.h=.check.macros)
-OBJ_CHECKS	= $(OBJS:%=%.obj_check)
-
 LDFLAGS		= -L$(BROWSER_DIR) -L$(LIBRARY_DIR) \
 			-L$(RUNTIME_DIR) -L$(BOEHM_GC_DIR) -L/usr/local/lib
 LDLIBS		= -l$(BROWSER_LIB_NAME) $(MLLIBS) $(SOCKET_LIBRARY) \
@@ -91,6 +63,34 @@
 		    *.par*) echo "-lpthread" ;;				\
 		  esac							\
 		`
+MAIN_TARGET=trace
+
+CHECK_HDRS  = $(HDRS)
+CHECK_MHDRS =
+CHECK_OBJS  = $(OBJS)
+ALLOW_LIB_PREFIX=no
+ALLOW_BROWSER_PREFIX=no
+
+MERCURY_DIR=..
+LINK_STDLIB_ONLY=yes
+include $(MERCURY_DIR)/Mmake.common
+-include Mmake.trace.params
+
+# Avoid trying to make this file with `mmc --make' if it doesn't exist.
+Mmake.trace.params: ;
+
+#-----------------------------------------------------------------------------#
+
+CFLAGS		+= -I$(BROWSER_DIR) -g $(DLL_CFLAGS) \
+			-DMR_NO_BACKWARDS_COMPAT -DMERCURY_CONF_BOOTSTRAP_H
+MGNUCFLAGS	+= --no-ansi
+
+#-----------------------------------------------------------------------------#
+
+# mercury_readline.c #includes the GNU readline headers, which
+# lack prototypes and `const', so we need to disable warnings
+# when compiling that file.
+MGNUCFLAGS-mercury_trace_readline = --no-check
 
 #-----------------------------------------------------------------------------#
 
@@ -148,33 +148,6 @@
 	ctags $(CFILES) $(HDRS) $(RUNTIME_DIR)/*.c $(RUNTIME_DIR)/*.h
 
 #-----------------------------------------------------------------------------#
-#
-# `mmake check_namespace' performs various checks on the header files
-# and object files to make sure that they conform with our coding standards.
-#
-
-# This should match the definition of HEADER_CLEAN_FILTER in
-# runtime/Mmakefile.  See the documentation there.
-HEADER_CLEAN_FILTER = \
-	grep -v -e '^MR_' -e '^MERCURY_' -e '^MPS_' -e '^mps_' -e '^GC_' | \
-	fgrep -v -x -f $(RUNTIME_DIR)/RESERVED_MACRO_NAMES
-
-.PHONY: check_headers_self_contained
-check_headers_self_contained: $(HDR_CHECK_OBJS)
-
-.PHONY: check_headers_macros
-check_headers_macros: $(HDR_CHECK_MACROS)
-
-.PHONY: check_headers
-check_headers: check_headers_self_contained check_headers_macros
-
-.PHONY: check_objs
-check_objs: $(OBJ_CHECKS)
-
-.PHONY: check_namespace
-check_namespace: check_headers check_objs
-
-#-----------------------------------------------------------------------------#
 
 # installation rules
 
@@ -213,11 +186,6 @@
 .PHONY: clean_o
 clean_o:
 	rm -f $(OBJS) $(PIC_OBJS)
-
-.PHONY: clean_check
-clean_check:
-	rm -f $(HDR_CHECK_OBJS) $(HDR_CHECK_CS) $(HDR_CHECK_MACROS)
-	rm -f $(OBJ_CHECKS)
 
 .PHONY: realclean_local
 realclean_local:
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