[m-rev.] for review: fix samples/c_interface/cplusplus_calls_mercury

Ian MacLarty maclarty at cs.mu.OZ.AU
Wed Apr 20 18:48:14 AEST 2005


On Wed, Apr 20, 2005 at 05:59:22PM +1000, Zoltan Somogyi wrote:
> On 20-Apr-2005, Ian MacLarty <maclarty at cs.mu.OZ.AU> wrote:
> > --- compiler/rtti.m	22 Mar 2005 06:40:24 -0000	1.57
> > +++ compiler/rtti.m	20 Apr 2005 04:49:31 -0000
> > @@ -1837,9 +1837,9 @@
> >  :- pred tc_rtti_name_type(tc_rtti_name::in, string::out, bool::out) is det.
> >  
> >  tc_rtti_name_type(base_typeclass_info(_, _),    "BaseTypeclassInfo", yes).
> > -tc_rtti_name_type(type_class_id,		"TypeClassId", no).
> > +tc_rtti_name_type(type_class_id,		"TypeClassIdStruct", no).
> >  tc_rtti_name_type(type_class_id_var_names,	"ConstString", yes).
> > -tc_rtti_name_type(type_class_id_method_ids,	"TypeClassMethod", yes).
> > +tc_rtti_name_type(type_class_id_method_ids,	"TypeClassMethodStruct", yes).
> >  tc_rtti_name_type(type_class_decl,		"TypeClassDeclStruct", no).
> >  tc_rtti_name_type(type_class_decl_super(_, N), TypeName, no) :-
> >  	TypeName = tc_constraint_type_name(N).
> > Index: runtime/mercury_type_tables.c
> > ===================================================================
> > RCS file: /home/mercury1/repository/mercury/runtime/mercury_type_tables.c,v
> > retrieving revision 1.10
> > diff -u -b -r1.10 mercury_type_tables.c
> > --- runtime/mercury_type_tables.c	24 Feb 2004 08:49:55 -0000	1.10
> > +++ runtime/mercury_type_tables.c	19 Apr 2005 05:35:38 -0000
> > @@ -111,9 +111,9 @@
> >  	MR_Dlist		*element_ptr;
> >  	MR_TypeClassDeclInfo	*cur_type_class_decl_info;
> >  	MR_TypeClassDecl	cur_type_class_decl;
> > -	const MR_TypeClassId	*cur_type_class_id;
> > +	MR_TypeClassId		cur_type_class_id;
> >  	MR_TypeClassDeclInfo	*type_class_decl_info;
> > -	const MR_TypeClassId	*type_class_id;
> > +	MR_TypeClassId		type_class_id;
> >  
> >  	MR_assert(type_class_decl != NULL);
> >  	type_class_id = type_class_decl->MR_tc_decl_id;
> > @@ -214,7 +214,7 @@
> >  	MR_Dlist		*element_ptr;
> >  	MR_TypeClassDeclInfo	*cur_type_class_decl_info;
> >  	MR_TypeClassDecl	cur_type_class_decl;
> > -	const MR_TypeClassId	*cur_type_class_id;
> > +	MR_TypeClassId		cur_type_class_id;
> 
> The change to rtti.m and mercury_type_tables.c look like the introductions
> of bugs; the correct code is the old code.
> 

Okay, here is the new complete diff:

Index: runtime/mercury_typeclass_info.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_typeclass_info.h,v
retrieving revision 1.4
diff -u -r1.4 mercury_typeclass_info.h
--- runtime/mercury_typeclass_info.h	3 Feb 2004 05:40:05 -0000	1.4
+++ runtime/mercury_typeclass_info.h	20 Apr 2005 08:30:24 -0000
@@ -109,11 +109,11 @@
 ** of a given type class.
 */
 
-typedef struct {
+struct MR_TypeClassMethod_Struct {
     MR_ConstString              MR_tc_method_name;
     const MR_int_least8_t       MR_tc_method_arity;
     const MR_PredFunc           MR_tc_method_pred_func;
-} MR_TypeClassMethod;
+};
 
 /*
 ** MR_TypeClassId structures are intended to provide a printable representation
@@ -139,15 +139,15 @@
 ** to method descriptors, one for each method.
 */
 
-typedef struct {
+struct MR_TypeClassId_Struct {
     MR_ConstString              MR_tc_id_module_name;
     MR_ConstString              MR_tc_id_name;
     const MR_int_least8_t       MR_tc_id_arity;
     const MR_int_least8_t       MR_tc_id_num_type_vars;
     const MR_int_least16_t      MR_tc_id_num_methods;
     const MR_ConstString        *MR_tc_id_type_var_names;
-    const MR_TypeClassMethod    *MR_tc_id_methods;
-} MR_TypeClassId;
+    MR_TypeClassMethod          MR_tc_id_methods;
+};
 
 /*
 ** We generate one static MR_TypeClassDecl structure for each typeclass
@@ -281,12 +281,12 @@
 ** of this design at runtime, just as we do for type_ctor_infos.
 */
 
-typedef struct {
+struct MR_ClassDict_Struct {
     MR_Integer              MR_class_dict_version_number;
     MR_TypeClassDecl        MR_class_dict_class;
     MR_TypeInfo             *MR_class_dict_type_binding;
     MR_Code                 *MR_class_dict_methods;
-} MR_ClassDict;
+};
 
 /*
 ** A MR_Dictionary_Struct structure corresponds to a fully solved type class
@@ -307,10 +307,10 @@
 ** (The +1 is because array numbering starts at 0.)
 */
 
-typedef struct {
+struct MR_Dictionary_Struct {
     MR_Instance             *MR_dict_top_instance;
     MR_ClassDict            *MR_dict_class_methods;
     MR_ClassDict            **MR_dict_superclass_dicts;
-} MR_Dictionary_Struct;
+};
 
 #endif /* not MERCURY_TYPECLASS_INFO_H */
Index: runtime/mercury_types.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_types.h,v
retrieving revision 1.40
diff -u -r1.40 mercury_types.h
--- runtime/mercury_types.h	14 Dec 2004 01:07:25 -0000	1.40
+++ runtime/mercury_types.h	20 Apr 2005 08:25:19 -0000
@@ -196,6 +196,9 @@
 typedef const struct MR_DictId_Struct                   *MR_DictId;
 typedef       struct MR_Dictionary_Struct               MR_DictionaryStruct;
 typedef const struct MR_Dictionary_Struct               *MR_Dictionary;
+typedef       struct MR_TypeClassId_Struct              MR_TypeClassId;
+typedef       struct MR_TypeClassMethod_Struct          MR_TypeClassMethod;
+typedef       struct MR_ClassDict_Struct                MR_ClassDict;
 
 typedef struct MR_TrailEntry_Struct             MR_TrailEntry;
 typedef struct MR_TrailEntry_Struct             *MR_TrailEntryPtr;

Is that okay?

Ian.
--------------------------------------------------------------------------
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