[m-dev.] for review: cleanup of part of the runtime

Zoltan Somogyi zs at cs.mu.OZ.AU
Tue Apr 20 10:26:43 AEST 1999


> Prefix everything defined in runtime/mercury_{stacks,tags}.h MR_.
> In the process, get rid of the grade component MR_DEBUG_NONDET_STACK,
> since this makes the update to mercury_stacks.h simpler and its use is
> long obsolete (e.g. the grade handling stuff in handle_options.m doesn't
> know about it, nor do the grade handling script fragments).

I just removed the stuff in parentheses.

As for the rest, here is the relative diff. Note that I will commit the
changes to the extras that use the list macros later, when the main change
has been installed. (Committing them now would make them uncompileable
with the installed compiler until then.)

Zoltan.

Index: doc/reference_manual.texi
===================================================================
RCS file: /home/mercury1/repository/mercury/doc/reference_manual.texi,v
retrieving revision 1.136
diff -u -b -u -r1.136 reference_manual.texi
--- reference_manual.texi	1999/03/24 13:09:00	1.136
+++ reference_manual.texi	1999/04/20 02:09:57
@@ -3976,11 +3976,11 @@
 which are defined by the Mercury implementation.
 
 @example
-list_is_empty(list)     /* test if a list is empty */
-list_head(list)         /* get the head of a list */
-list_tail(list)         /* get the tail of a list */
-list_empty()            /* create an empty list */
-list_cons(head,tail)    /* construct a list with the given head and tail */
+MR_list_is_empty(list)     /* test if a list is empty */
+MR_list_head(list)         /* get the head of a list */
+MR_list_tail(list)         /* get the tail of a list */
+MR_list_empty()            /* create an empty list */
+MR_list_cons(head,tail)    /* construct a list with the given head and tail */
 @end example
 
 Note that the use of these macros is subject to some caveats
Index: extras/aditi/aditi.m
===================================================================
RCS file: /home/mercury1/repository/mercury/extras/aditi/aditi.m,v
retrieving revision 1.1
diff -u -b -u -r1.1 aditi.m
--- aditi.m	1998/12/07 01:32:37	1.1
+++ aditi.m	1999/04/20 02:12:01
@@ -1,5 +1,5 @@
 %---------------------------------------------------------------------------%
-% Copyright (C) 1998 University of Melbourne.
+% Copyright (C) 1998-1999 University of Melbourne.
 % This file may only be copied under the terms of the GNU Library General
 % Public License - see the file COPYING.LIB in the Mercury distribution.
 %---------------------------------------------------------------------------%
@@ -600,7 +600,7 @@
 	** we haven't altered any of the virtual_reg array entries.
 	*/
 
-	tuple_list = list_empty();
+	tuple_list = MR_list_empty();
 	DEBUG(printf(""building input tuple...""));
 	for (i = 0; i < num_input_args; i++) {
 		/* convert the argument to a string, adding it to the tuple */
Index: extras/odbc/odbc.m
===================================================================
RCS file: /home/mercury1/repository/mercury/extras/odbc/odbc.m,v
retrieving revision 1.6
diff -u -b -u -r1.6 odbc.m
--- odbc.m	1998/11/26 10:06:52	1.6
+++ odbc.m	1999/04/20 02:13:23
@@ -1,6 +1,6 @@
 %---------------------------------------------------------------------------%
 % Copyright (C) 1997 Mission Critical.
-% Copyright (C) 1997 The University of Melbourne.
+% Copyright (C) 1997,1999 The University of Melbourne.
 % This file may only be copied under the terms of the GNU Library General
 % Public License - see the file COPYING.LIB in the Mercury distribution.
 %---------------------------------------------------------------------------%
@@ -491,7 +491,7 @@
 	*/
 
 	odbc_connection = (SQLHDBC) Connection;
-	odbc_message_list = list_empty();
+	odbc_message_list = MR_list_empty();
 
 	/*
 	** Set up a location to jump to on a database exception.
@@ -539,7 +539,7 @@
 transaction_done:
 
 	*Msgs = odbc_message_list;
-	odbc_message_list = list_empty();
+	odbc_message_list = MR_list_empty();
 	odbc_connection = SQL_NULL_HDBC;
 	odbc_ret_code = SQL_SUCCESS;
 	*IO = IO0;
@@ -574,7 +574,7 @@
 		will_not_call_mercury,
 "
 {
-	odbc_message_list = list_cons(Error, odbc_message_list);
+	odbc_message_list = MR_list_cons(Error, odbc_message_list);
 	DB = DB0;
 }
 ").
@@ -681,7 +681,7 @@
 	odbc_check(odbc_env_handle, connect_handle, SQL_NULL_HSTMT, Status);
 
 	Messages = odbc_message_list;
-	odbc_message_list = list_empty();
+	odbc_message_list = MR_list_empty();
 
 	Handle = (Word) connect_handle;
 	odbc_connection = SQL_NULL_HDBC;
@@ -720,7 +720,7 @@
 
 
 	Messages = odbc_message_list;
-	odbc_message_list = list_empty();
+	odbc_message_list = MR_list_empty();
 
 	IO = IO0;
 ").
@@ -1345,7 +1345,8 @@
 			Word overflow_message;
 			MODBC_overflow_message(&overflow_message);
 			odbc_message_list =
-				list_cons(overflow_message, odbc_message_list);
+				MR_list_cons(overflow_message,
+					odbc_message_list);
 			odbc_do_cleanup_statement(stat);
 			odbc_throw();
 		}
@@ -1504,7 +1505,7 @@
 
 	DEBUG(printf(""getting column %i in chunks\n"", column_id));
 
-	chunk_list = list_empty();
+	chunk_list = MR_list_empty();
 
 	col = &(stat->row[column_id]);
 
@@ -1533,7 +1534,7 @@
 			odbc_throw();
 		}
 
-		chunk_list = list_cons(this_bit, chunk_list);
+		chunk_list = MR_list_cons(this_bit, chunk_list);
 		incr_hp_atomic(this_bit, MODBC_CHUNK_WORDS);
 	}
 
@@ -1918,9 +1919,9 @@
 		*/
 #ifdef MODBC_IODBC
 	Status = SQL_NO_DATA_FOUND;
-	SourceNames = list_empty();
-	SourceDescs = list_empty();
-	Messages = list_empty();
+	SourceNames = MR_list_empty();
+	SourceDescs = MR_list_empty();
+	Messages = MR_list_empty();
 #else /* !MODBC_IODBC */
 	Status = odbc_do_get_data_sources(&SourceNames, 
 			&SourceDescs, &Messages);
@@ -1951,9 +1952,9 @@
 	SWORD desc_len;
 	SQLRETURN rc;
 
-	odbc_message_list = list_empty();
-	*SourceNames = list_empty();
-	*SourceDescs = list_empty();
+	odbc_message_list = MR_list_empty();
+	*SourceNames = MR_list_empty();
+	*SourceDescs = MR_list_empty();
 
 	if (odbc_env_handle == SQL_NULL_HENV) {
 		rc = SQLAllocEnv(&odbc_env_handle);
@@ -1984,9 +1985,9 @@
 			** Copy the new data onto the Mercury heap
 			*/
 			make_aligned_string_copy(new_dsn, dsn);
-			*SourceNames = list_cons(new_dsn, *SourceNames);
+			*SourceNames = MR_list_cons(new_dsn, *SourceNames);
 			make_aligned_string_copy(new_desc, desc);
-			*SourceDescs = list_cons(new_desc, *SourceDescs);
+			*SourceDescs = MR_list_cons(new_desc, *SourceDescs);
 	
 			rc = SQLDataSources(odbc_env_handle,
 					SQL_FETCH_NEXT, dsn,
@@ -2000,7 +2001,7 @@
 	}
 
 	*Messages = odbc_message_list;
-	odbc_message_list = list_empty();
+	odbc_message_list = MR_list_empty();
 	return rc;
 }").
 
@@ -2324,7 +2325,7 @@
 
 			/* Append the message onto the list. */
 			odbc_message_list = 
-				list_cons(new_message, odbc_message_list);
+				MR_list_cons(new_message, odbc_message_list);
 
 		}
 
diff -u BEFORE/mercury_bootstrap.h ./mercury_bootstrap.h
--- BEFORE/mercury_bootstrap.h	Tue Apr 20 12:03:25 1999
+++ ./mercury_bootstrap.h	Tue Apr 20 12:08:34 1999
@@ -15,7 +15,20 @@
 #ifndef	MERCURY_BOOTSTRAP_H
 #define	MERCURY_BOOTSTRAP_H
 
-#ifndef	MERCURY_NO_BOOTSTRAP
+#ifndef	MR_NO_BACKWARDS_COMPAT
+
+/*
+** The list manipulation macros are available for use by ordinary Mercury
+** programmers. People may have written code using these macros before their
+** documented names were changed, so removing backward compatibility for them
+** requires more warning than for the other things in this file.
+*/
+
+#define	list_is_empty(l)	MR_list_is_empty(l)
+#define	list_head(l)		MR_list_head(l)
+#define	list_tail(l)		MR_list_tail(l)
+#define	list_empty()		MR_list_empty()
+#define	list_cons(h, t)		MR_list_cons((h), (t))
 
 #define succip			MR_succip
 #define hp			MR_hp
@@ -96,12 +109,6 @@
 #define	mask_field(p, i)	MR_mask_field((p), (i))
 #define	const_mask_field(p, i)	MR_const_mask_field((p), (i))
 
-#define	list_is_empty(l)	MR_list_is_empty(l)
-#define	list_head(l)		MR_list_head(l)
-#define	list_tail(l)		MR_list_tail(l)
-#define	list_empty()		MR_list_empty()
-#define	list_cons(h, t)		MR_list_cons((h), (t))
-
 /*
 ** The code generated by Mercury 0.8 includes references to these macros.
 */
@@ -207,6 +214,6 @@
 #define mercury_data_private_builtin__base_type_info_type_info_1_struct \
 	mercury_data_private_builtin__type_ctor_info_type_info_1_struct
 
-#endif	/* not MERCURY_NO_BOOTSTRAP */
+#endif	/* not MR_NO_BACKWARDS_COMPAT */
 
 #endif	/* MERCURY_BOOTSTRAP_H */
diff -u BEFORE/mercury_conf_param.h ./mercury_conf_param.h
--- BEFORE/mercury_conf_param.h	Tue Apr 20 12:03:25 1999
+++ ./mercury_conf_param.h	Tue Apr 20 12:25:19 1999
@@ -70,6 +70,11 @@
 **
 ** PARALLEL
 **	Enable support for parallelism [not yet working].
+**
+** MR_NO_BACKWARDS_COMPAT
+**	Disable backwards compatibility with C code using obsolete low-level
+**	constructs, e.g. referring to variables and macros without their MR_
+**	prefixes.
 */
 
 /*
--------------------------------------------------------------------------
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