[m-dev.] trivial diff: more MR_ prefixes (trailed_update & clpr)
Fergus Henderson
fjh at cs.mu.OZ.AU
Fri Dec 8 00:16:32 AEDT 2000
Estimated hours taken: 0.75
extras/clpr/cfloat.m:
extras/clpr/dump.m:
extras/trailed_update/tr_array.m:
extras/trailed_update/tr_store.m:
extras/trailed_update/var.m:
Add some missing `MR_' prefixes.
Workspace: /home/pgrad/fjh/ws/hg
Index: extras/clpr/cfloat.m
===================================================================
RCS file: /home/mercury1/repository/clpr/cfloat.m,v
retrieving revision 1.29
diff -u -d -r1.29 cfloat.m
--- extras/clpr/cfloat.m 2000/05/08 13:48:20 1.29
+++ extras/clpr/cfloat.m 2000/12/07 13:03:27
@@ -477,7 +477,7 @@
CLPR_solver_id = choicepoint->solver_id;
old_trtop = choicepoint->trtop;
for (i = CLPR_trtop - 1; i >= old_trtop; i--) {
- CLPR_solver_backtrack((Word) CLPR_trail[i]);
+ CLPR_solver_backtrack((MR_Word) CLPR_trail[i]);
}
CLPR_trtop = old_trtop;
ML_cfloat_current_cp = choicepoint;
@@ -497,7 +497,7 @@
:- pragma c_header_code("
-typedef Integer ML_svar;
+typedef MR_Integer ML_svar;
/*
** The following ""functions"" are currently all implemented using macros.
@@ -506,24 +506,24 @@
*/
bool ML_cfloat_eq(ML_svar, ML_svar);
-bool ML_cfloat_eq_float(ML_svar, Float);
+bool ML_cfloat_eq_float(ML_svar, MR_Float);
/* bool ML_cfloat_diseq(ML_svar, ML_svar, bool&); */
-/* bool ML_cfloat_diseq_float(ML_svar, Float, bool&); */
+/* bool ML_cfloat_diseq_float(ML_svar, MR_Float, bool&); */
bool ML_cfloat_gt(ML_svar, ML_svar);
-bool ML_cfloat_gt_float(ML_svar, Float);
+bool ML_cfloat_gt_float(ML_svar, MR_Float);
bool ML_cfloat_lt(ML_svar, ML_svar);
-bool ML_cfloat_lt_float(ML_svar, Float);
+bool ML_cfloat_lt_float(ML_svar, MR_Float);
bool ML_cfloat_ge(ML_svar, ML_svar);
-bool ML_cfloat_ge_float(ML_svar, Float);
+bool ML_cfloat_ge_float(ML_svar, MR_Float);
bool ML_cfloat_le(ML_svar, ML_svar);
-bool ML_cfloat_le_float(ML_svar, Float);
+bool ML_cfloat_le_float(ML_svar, MR_Float);
bool ML_cfloat_plus(ML_svar, ML_svar, ML_svar);
-bool ML_cfloat_plus_float(ML_svar, Float, ML_svar);
+bool ML_cfloat_plus_float(ML_svar, MR_Float, ML_svar);
bool ML_cfloat_minus(ML_svar, ML_svar, ML_svar);
-bool ML_cfloat_minus_float(ML_svar, Float, ML_svar);
+bool ML_cfloat_minus_float(ML_svar, MR_Float, ML_svar);
bool ML_cfloat_mult(ML_svar, ML_svar, ML_svar);
-bool ML_cfloat_mult_float(ML_svar, Float, ML_svar);
-bool ML_cfloat_div_float(ML_svar, Float, ML_svar);
+bool ML_cfloat_mult_float(ML_svar, MR_Float, ML_svar);
+bool ML_cfloat_div_float(ML_svar, MR_Float, ML_svar);
bool ML_cfloat_min(ML_svar, ML_svar, ML_svar);
bool ML_cfloat_max(ML_svar, ML_svar, ML_svar);
bool ML_cfloat_abs(ML_svar, ML_svar);
@@ -572,7 +572,7 @@
*/
#define ML_cfloat_diseq(Svar1, Svar2, result) \\
do { \\
- Word Diff, AbsDiff; \\
+ MR_Word Diff, AbsDiff; \\
\\
ML_cfloat_init_solver_var(Diff); \\
ML_cfloat_init_solver_var(AbsDiff); \\
@@ -589,7 +589,7 @@
*/
#define ML_cfloat_diseq_float(Svar, Val, result) \\
do { \\
- Word Diff, AbsDiff; \\
+ MR_Word Diff, AbsDiff; \\
\\
ML_cfloat_init_solver_var(Diff); \\
ML_cfloat_init_solver_var(AbsDiff); \\
Index: extras/clpr/dump.m
===================================================================
RCS file: /home/mercury1/repository/clpr/dump.m,v
retrieving revision 1.14
diff -u -d -r1.14 dump.m
--- extras/clpr/dump.m 2000/05/08 13:48:20 1.14
+++ extras/clpr/dump.m 2000/12/07 13:07:40
@@ -196,7 +196,7 @@
if ((s = malloc(Length * sizeof(char))) == NULL)
MR_fatal_error(
""malloc() failed in dump__allocate_clpr_string"");
- CLPRString = (Word) s;
+ CLPRString = (MR_Word) s;
}").
:- pred dump__add_strings(list(string)::in, c_pointer::in, int::in,
@@ -233,12 +233,12 @@
:- pragma c_code(dump__do_dump(Vars::in, Names::in), will_not_call_mercury,
"CLPR_dump1(stdout, (CLPR_int *)&Vars, (char *)Names);").
-:- pragma c_header_code("static void free_clpr_list_mem(Word list);").
+:- pragma c_header_code("static void free_clpr_list_mem(MR_Word list);").
:- pragma c_code("
- static void free_clpr_list_mem(Word list)
+ static void free_clpr_list_mem(MR_Word list)
{
if (CLPR_tag(list) == CLPR_TAG_CONS) {
- Word *list_ptr = (Word *) pmask(list);
+ MR_Word *list_ptr = (MR_Word *) pmask(list);
free_clpr_list_mem(list_ptr[1]);
free(list_ptr);
}
Index: extras/trailed_update/tr_array.m
===================================================================
RCS file: /home/mercury1/repository/mercury/extras/trailed_update/tr_array.m,v
retrieving revision 1.6
diff -u -d -r1.6 tr_array.m
--- extras/trailed_update/tr_array.m 2000/05/08 13:48:30 1.6
+++ extras/trailed_update/tr_array.m 2000/12/07 00:52:47
@@ -182,7 +182,7 @@
will_not_call_mercury,
"{
MR_ArrayType *array = (MR_ArrayType *) Array0;
- if ((Unsigned) Index >= (Unsigned) array->size) {
+ if ((MR_Unsigned) Index >= (MR_Unsigned) array->size) {
MR_fatal_error(""tr_array__set: array index out of bounds"");
}
MR_trail_current_value(&array->elements[Index]);
@@ -262,7 +262,7 @@
will_not_call_mercury,
"{
MR_ArrayType *array = (MR_ArrayType *) Array;
- if ((Unsigned) Index >= (Unsigned) array->size) {
+ if ((MR_Unsigned) Index >= (MR_Unsigned) array->size) {
MR_fatal_error(""tr_array__lookup: ""
""array index out of bounds"");
}
@@ -272,7 +272,7 @@
will_not_call_mercury,
"{
MR_ArrayType *array = (MR_ArrayType *) Array;
- if ((Unsigned) Index >= (Unsigned) array->size) {
+ if ((MR_Unsigned) Index >= (MR_Unsigned) array->size) {
MR_fatal_error(""tr_array__lookup: array index out of bounds"");
}
Item = array->elements[Index];
@@ -282,17 +282,17 @@
:- pragma c_header_code("
MR_ArrayType * ML_tr_resize_array(MR_ArrayType *old_array,
- Integer array_size, Word item);
+ MR_Integer array_size, MR_Word item);
").
:- pragma c_code("
MR_ArrayType *
-ML_tr_resize_array(MR_ArrayType *old_array, Integer array_size,
- Word item)
+ML_tr_resize_array(MR_ArrayType *old_array, MR_Integer array_size,
+ MR_Word item)
{
- Integer i;
+ MR_Integer i;
MR_ArrayType* array;
- Integer elements_to_copy;
+ MR_Integer elements_to_copy;
elements_to_copy = old_array->size;
if (elements_to_copy == array_size) return old_array;
@@ -300,7 +300,7 @@
elements_to_copy = array_size;
}
- array = (MR_ArrayType *) MR_GC_NEW_ARRAY(Word, array_size + 1);
+ array = (MR_ArrayType *) MR_GC_NEW_ARRAY(MR_Word, array_size + 1);
array->size = array_size;
for (i = 0; i < elements_to_copy; i++) {
array->elements[i] = old_array->elements[i];
@@ -323,7 +323,8 @@
Array::array_uo),
will_not_call_mercury,
"
- Array = (Word) ML_tr_resize_array((MR_ArrayType *) Array0, Size, Item);
+ Array = (MR_Word) ML_tr_resize_array((MR_ArrayType *) Array0,
+ Size, Item);
").
:- pragma c_code(
@@ -331,7 +332,8 @@
Array::array_uo),
will_not_call_mercury,
"
- Array = (Word) ML_tr_resize_array((MR_ArrayType *) Array0, Size, Item);
+ Array = (MR_Word) ML_tr_resize_array((MR_ArrayType *) Array0,
+ Size, Item);
").
@@ -339,16 +341,16 @@
:- pragma c_header_code("
MR_ArrayType * ML_tr_shrink_array(MR_ArrayType *old_array,
- Integer array_size);
+ MR_Integer array_size);
").
:- pragma c_code("
MR_ArrayType *
-ML_tr_shrink_array(MR_ArrayType *old_array, Integer array_size)
+ML_tr_shrink_array(MR_ArrayType *old_array, MR_Integer array_size)
{
- Integer i;
+ MR_Integer i;
MR_ArrayType* array;
- Integer old_array_size;
+ MR_Integer old_array_size;
old_array_size = old_array->size;
if (old_array_size == array_size) return old_array;
@@ -357,7 +359,7 @@
""tr_array__shrink: can't shrink to a larger size"");
}
- array = (MR_ArrayType *) MR_GC_NEW_ARRAY(Word, array_size + 1);
+ array = (MR_ArrayType *) MR_GC_NEW_ARRAY(MR_Word, array_size + 1);
array->size = array_size;
for (i = 0; i < array_size; i++) {
array->elements[i] = old_array->elements[i];
@@ -376,7 +378,7 @@
tr_array__shrink(Array0::array_mui, Size::in, Array::array_uo),
will_not_call_mercury,
"
- Array = (Word) ML_tr_shrink_array(
+ Array = (MR_Word) ML_tr_shrink_array(
(MR_ArrayType *) Array0, Size);
").
@@ -384,7 +386,7 @@
tr_array__shrink(Array0::in, Size::in, Array::array_uo),
will_not_call_mercury,
"
- Array = (Word) ML_tr_shrink_array(
+ Array = (MR_Word) ML_tr_shrink_array(
(MR_ArrayType *) Array0, Size);
").
@@ -403,9 +405,9 @@
** changes to deepcopy() in runtime/deep_copy.c.
*/
- Integer i;
+ MR_Integer i;
MR_ArrayType* array;
- Integer array_size;
+ MR_Integer array_size;
array_size = old_array->size;
array = MR_make_array(array_size);
@@ -421,14 +423,14 @@
tr_array__copy(Array0::array_mui, Array::array_uo),
will_not_call_mercury,
"
- Array = (Word) ML_tr_copy_array((MR_ArrayType *) Array0);
+ Array = (MR_Word) ML_tr_copy_array((MR_ArrayType *) Array0);
").
:- pragma c_code(
tr_array__copy(Array0::in, Array::array_uo),
will_not_call_mercury,
"
- Array = (Word) ML_tr_copy_array((MR_ArrayType *) Array0);
+ Array = (MR_Word) ML_tr_copy_array((MR_ArrayType *) Array0);
").
%-----------------------------------------------------------------------------%
Index: extras/trailed_update/tr_store.m
===================================================================
RCS file: /home/mercury1/repository/mercury/extras/trailed_update/tr_store.m,v
retrieving revision 1.7
diff -u -d -r1.7 tr_store.m
--- extras/trailed_update/tr_store.m 2000/05/08 13:48:30 1.7
+++ extras/trailed_update/tr_store.m 2000/12/07 13:03:46
@@ -150,23 +150,23 @@
:- pragma c_code(new_mutvar(Val::in, Mutvar::out, S0::mdi, S::muo),
will_not_call_mercury,
"
- incr_hp(Mutvar, 1);
- *(Word *)Mutvar = Val;
+ MR_incr_hp(Mutvar, 1);
+ *(MR_Word *)Mutvar = Val;
S = S0;
").
:- pragma c_code(get_mutvar(Mutvar::in, Val::out, S0::mdi, S::muo),
will_not_call_mercury,
"
- Val = *(Word *)Mutvar;
+ Val = *(MR_Word *)Mutvar;
S = S0;
").
:- pragma c_code(set_mutvar(Mutvar::in, Val::in, S0::mdi, S::muo),
will_not_call_mercury,
"
- MR_trail_current_value((Word *) Mutvar);
- *(Word *)Mutvar = Val;
+ MR_trail_current_value((MR_Word *) Mutvar);
+ *(MR_Word *)Mutvar = Val;
S = S0;
").
@@ -175,8 +175,8 @@
:- pragma c_code(new_ref(Val::mdi, Ref::out, S0::mdi, S::muo),
will_not_call_mercury,
"
- incr_hp(Ref, 1);
- *(Word *)Ref = Val;
+ MR_incr_hp(Ref, 1);
+ *(MR_Word *)Ref = Val;
S = S0;
").
@@ -193,7 +193,7 @@
:- pragma c_code(unsafe_ref_value(Ref::in, Val::uo, S0::mdi, S::muo),
will_not_call_mercury,
"
- Val = *(Word *)Ref;
+ Val = *(MR_Word *)Ref;
S = S0;
").
@@ -203,19 +203,19 @@
:- pragma c_header_code("
/* ML_arg() is defined in std_util.m */
-extern bool ML_arg(MR_TypeInfo type_info, Word *term, int arg_index,
- MR_TypeInfo *arg_type_info_ptr, Word **argument_ptr);
+extern bool ML_arg(MR_TypeInfo type_info, MR_Word *term, int arg_index,
+ MR_TypeInfo *arg_type_info_ptr, MR_Word **argument_ptr);
").
:- pragma c_code(arg_ref(Ref::in, ArgNum::in, ArgRef::out, S0::mdi, S::muo),
will_not_call_mercury,
"{
MR_TypeInfo arg_type_info;
- Word* arg_ref;
+ MR_Word* arg_ref;
- save_transient_registers();
+ MR_save_transient_registers();
- if (!ML_arg((MR_TypeInfo) TypeInfo_for_T, (Word *) Ref, ArgNum,
+ if (!ML_arg((MR_TypeInfo) TypeInfo_for_T, (MR_Word *) Ref, ArgNum,
&arg_type_info, &arg_ref))
{
MR_fatal_error(""tr_store__arg_ref: ""
@@ -223,14 +223,14 @@
}
if (MR_compare_type_info(arg_type_info,
- (MR_TypeInfo) TypeInfo_for_ArgT) != COMPARE_EQUAL)
+ (MR_TypeInfo) TypeInfo_for_ArgT) != MR_COMPARE_EQUAL)
{
MR_fatal_error(""tr_store__arg_ref: argument has wrong type"");
}
- restore_transient_registers();
+ MR_restore_transient_registers();
- ArgRef = (Word) arg_ref;
+ ArgRef = (MR_Word) arg_ref;
S = S0;
}").
@@ -238,11 +238,11 @@
will_not_call_mercury,
"{
MR_TypeInfo arg_type_info;
- Word* arg_ref;
+ MR_Word* arg_ref;
- save_transient_registers();
+ MR_save_transient_registers();
- if (!ML_arg((MR_TypeInfo) TypeInfo_for_T, (Word *) &Val, ArgNum,
+ if (!ML_arg((MR_TypeInfo) TypeInfo_for_T, (MR_Word *) &Val, ArgNum,
&arg_type_info, &arg_ref))
{
MR_fatal_error(""tr_store__new_arg_ref: ""
@@ -250,13 +250,13 @@
}
if (MR_compare_type_info(arg_type_info,
- (MR_TypeInfo) TypeInfo_for_ArgT) != COMPARE_EQUAL)
+ (MR_TypeInfo) TypeInfo_for_ArgT) != MR_COMPARE_EQUAL)
{
MR_fatal_error(""tr_store__new_arg_ref: ""
""argument has wrong type"");
}
- restore_transient_registers();
+ MR_restore_transient_registers();
/*
** For no_tag types, the argument may have the same address as the
@@ -265,10 +265,10 @@
** to copy it to the heap before returning.
*/
if (arg_ref == &Val) {
- incr_hp(ArgRef, 1);
- *(Word *)ArgRef = Val;
+ MR_incr_hp(ArgRef, 1);
+ *(MR_Word *)ArgRef = Val;
} else {
- ArgRef = (Word) arg_ref;
+ ArgRef = (MR_Word) arg_ref;
}
S = S0;
}").
@@ -276,23 +276,23 @@
:- pragma c_code(set_ref(Ref::in, ValRef::in, S0::mdi, S::muo),
will_not_call_mercury,
"
- MR_trail_current_value((Word *) Ref);
- *(Word *)Ref = *(Word *)ValRef;
+ MR_trail_current_value((MR_Word *) Ref);
+ *(MR_Word *)Ref = *(MR_Word *)ValRef;
S = S0;
").
:- pragma c_code(set_ref_value(Ref::in, Val::mdi, S0::mdi, S::muo),
will_not_call_mercury,
"
- MR_trail_current_value((Word *) Ref);
- *(Word *)Ref = Val;
+ MR_trail_current_value((MR_Word *) Ref);
+ *(MR_Word *)Ref = Val;
S = S0;
").
:- pragma c_code(extract_ref_value(_S::mdi, Ref::in, Val::out),
will_not_call_mercury,
"
- Val = *(Word *)Ref;
+ Val = *(MR_Word *)Ref;
").
%-----------------------------------------------------------------------------%
@@ -301,8 +301,8 @@
will_not_call_mercury,
"{
/* unsafe - does not check type & arity, won't handle no_tag types */
- Word *Ptr = (Word *) MR_strip_tag(Ref);
- ArgRef = (Word) &Ptr[Arg];
+ MR_Word *Ptr = (MR_Word *) MR_strip_tag(Ref);
+ ArgRef = (MR_Word) &Ptr[Arg];
S = S0;
}").
@@ -310,8 +310,8 @@
S0::mdi, S::muo), will_not_call_mercury,
"{
/* unsafe - does not check type & arity, won't handle no_tag types */
- Word *Ptr = (Word *) MR_strip_tag(Val);
- ArgRef = (Word) &Ptr[Arg];
+ MR_Word *Ptr = (MR_Word *) MR_strip_tag(Val);
+ ArgRef = (MR_Word) &Ptr[Arg];
S = S0;
}").
Index: extras/trailed_update/var.m
===================================================================
RCS file: /home/mercury1/repository/mercury/extras/trailed_update/var.m,v
retrieving revision 1.16
diff -u -d -r1.16 var.m
--- extras/trailed_update/var.m 2000/05/08 13:48:30 1.16
+++ extras/trailed_update/var.m 2000/12/07 13:07:05
@@ -393,8 +393,8 @@
:- pragma c_header_code("
/* Warning: the layout of this type must match its layout in Mercury */
typedef struct ML_var_delayed_conj_struct {
- Word goal;
- Word woken;
+ MR_Word goal;
+ MR_Word woken;
struct ML_var_delayed_conj_struct *prev;
struct ML_var_delayed_conj_struct *next;
} ML_var_delayed_conj;
@@ -422,7 +422,7 @@
:- pragma c_code(get_last_delayed_goal(Ptr::out(delayed_goal_list)),
will_not_call_mercury,
"
- Ptr = (Word) &ML_var_last_goal;
+ Ptr = (MR_Word) &ML_var_last_goal;
").
:- impure
@@ -637,7 +637,7 @@
freeze(X::in, Pred::(pred(in, out) is det), Y::out), % det
may_call_mercury,
"{
- Word XVal, YVal;
+ MR_Word XVal, YVal;
/* don't delay, just call the pred */
ML_var_get_value(TypeInfo_for_T1, X, &XVal);
@@ -649,7 +649,7 @@
freeze(X::in, Pred::(pred(in, out) is semidet), Y::out), % semidet
may_call_mercury,
"{
- Word XVal, YVal;
+ MR_Word XVal, YVal;
/* don't delay, just call the pred */
ML_var_get_value(TypeInfo_for_T1, X, &XVal);
@@ -667,7 +667,7 @@
% semidet
may_call_mercury,
"{
- Word p;
+ MR_Word p;
Y = ML_var_alias(TypeInfo_for_T2, ML_var_free(TypeInfo_for_T2));
p = ML_var_binary_det_pred(TypeInfo_for_T1, Pred, TypeInfo_for_T2, Y);
@@ -679,7 +679,7 @@
% semidet
may_call_mercury,
"{
- Word p;
+ MR_Word p;
Y = ML_var_alias(TypeInfo_for_T2, ML_var_free(TypeInfo_for_T2));
p = ML_var_binary_semidet_pred(TypeInfo_for_T1,
@@ -693,7 +693,7 @@
Y::out(any)), % semidet
may_call_mercury,
"{
- Word p;
+ MR_Word p;
Y = ML_var_alias(TypeInfo_for_T2, ML_var_free(TypeInfo_for_T2));
p = ML_var_binary_semidet_pred_any(TypeInfo_for_T1,
@@ -908,7 +908,8 @@
setarg(MercuryTerm::in(any), ArgNum::in, NewValue::in(any)),
will_not_call_mercury,
"{
- Word *ptr = (Word *) MR_strip_tag(MercuryTerm); /* strip off tag bits */
+ /* strip off tag bits */
+ MR_Word *ptr = (MR_Word *) MR_strip_tag(MercuryTerm);
MR_trail_current_value(&ptr[ArgNum - 1]);
ptr[ArgNum - 1] = NewValue;
}").
@@ -922,7 +923,8 @@
untrailed_setarg(MercuryTerm::in(any), ArgNum::in, NewValue::in(any)),
will_not_call_mercury,
"{
- Word *ptr = (Word *) MR_strip_tag(MercuryTerm); /* strip off tag bits */
+ /* strip off tag bits */
+ MR_Word *ptr = (MR_Word *) MR_strip_tag(MercuryTerm);
ptr[ArgNum - 1] = NewValue;
}").
--
Fergus Henderson <fjh at cs.mu.oz.au> | "I have always known that the pursuit
| of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh> | -- the last words of T. S. Garp.
--------------------------------------------------------------------------
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