Re: [perl #24817] [PATCH] various extending interface changes

2004-01-06 Thread Leopold Toetsch
Mattia Barbon [EMAIL PROTECTED] wrote:
   Hello,
 this patch

 * renames Parrot_INTERP and Parrot_STRING to Parrot_Interp and Parrot_String,
   which matches the rest of Parrot types, as well as the embedding interface

AFAIK are the types in extend.c opaque types which are different to the
internals.

 Regards
 Mattia

leo


Re[2]: [perl #24817] [PATCH] various extending interface changes

2004-01-06 Thread Mattia Barbon
Il Tue, 6 Jan 2004 16:43:42 +0100 Leopold Toetsch [EMAIL PROTECTED] ha scritto:

 Mattia Barbon [EMAIL PROTECTED] wrote:
Hello,
  this patch
 
  * renames Parrot_INTERP and Parrot_STRING to Parrot_Interp and
 Parrot_String,
which matches the rest of Parrot types, as well as the
 embedding interface
 
 AFAIK are the types in extend.c opaque types which are different to
 the
 internals.
  Sure. But: embed.h and extend.h do not use the same types. They should,
whichever the type names are (I am not to decide[1], but somebody ought to...).
In addition the patch leaves the types opaque, it just changes their names.

Regards
Mattia



[perl #24817] [PATCH] various extending interface changes

2004-01-05 Thread via RT
# New Ticket Created by  Mattia Barbon 
# Please include the string:  [perl #24817]
# in the subject line of all future correspondence about this issue. 
# URL: http://rt.perl.org/rt3/Ticket/Display.html?id=24817 


  Hello,
this patch

* renames Parrot_INTERP and Parrot_STRING to Parrot_Interp and Parrot_String,
  which matches the rest of Parrot types, as well as the embedding interface
* Adds Parrot_PMC_get/set_vtable
* makes the extending interface compilable with a C++ compiler
  (removed typedef struct Parrot_Interp* Parrot_Interp)
  (note: only *compiles*, it probably does not link yet)
* changes typedefs in extend.h from
  typedef void* type 
  to
  typedef struct type_* type
  which allows for slightly better type safety

Regards
Mattia

Index: include/parrot/dynext.h
===
RCS file: /cvs/public/parrot/include/parrot/dynext.h,v
retrieving revision 1.4
diff -u -2 -r1.4 dynext.h
--- include/parrot/dynext.h 30 Sep 2003 09:29:41 -  1.4
+++ include/parrot/dynext.h 5 Jan 2004 20:52:34 -
@@ -11,5 +11,5 @@
 
 /* dynamic lib/oplib/PMC loading */
-PMC *Parrot_load_lib(Interp *interpreter, STRING *lib, PMC *initializer);
+Parrot_PMC Parrot_load_lib(Parrot_Interp interpreter, Parrot_String lib, Parrot_PMC 
initializer);
 
 #endif
Index: include/parrot/extend.h
===
RCS file: /cvs/public/parrot/include/parrot/extend.h,v
retrieving revision 1.12
diff -u -2 -r1.12 extend.h
--- include/parrot/extend.h 31 Dec 2003 11:54:32 -  1.12
+++ include/parrot/extend.h 5 Jan 2004 20:52:35 -
@@ -16,4 +16,6 @@
 #define PARROT_EXTEND_H_GUARD
 
+#include stddef.h /* size_t */
+
 #include parrot/config.h  /* PARROT_VERSION, PARROT_JIT_CAPABLE... */
 #include parrot/interpreter.h /* give us the interpreter flags */
@@ -24,67 +26,67 @@
we'll split this into two pieces and not install the core version,
but that would be really annoying */
-#if defined(PARROT_IN_CORE)
+#if !defined(PARROT_IN_CORE)
 
-#define Parrot_INTERP struct Parrot_Interp *
-#define Parrot_STRING STRING *
-#define Parrot_PMC PMC *
-#define Parrot_Language Parrot_Int
-
-#else
-
-typedef void * Parrot_INTERP;
-typedef void * Parrot_STRING;
-typedef void * Parrot_PMC;
+typedef struct Parrot_String_* Parrot_String;
+typedef struct Parrot_PMC_* Parrot_PMC;
 typedef Parrot_Int Parrot_Language;
-typedef void * Parrot_Encoding;
-typedef void * Parrot_CharType;
-typedef const void * Parrot_Const_Encoding;
-typedef const void * Parrot_Const_CharType;
+typedef struct Parrot_Encoding_* Parrot_Encoding;
+typedef struct Parrot_Chartype_* Parrot_CharType;
+typedef const struct Parrot_Encoding_* Parrot_Const_Encoding;
+typedef const struct Parrot_Chartype_* Parrot_Const_CharType;
+typedef struct _vtable* Parrot_Vtable;
+/* XXX for vtables */
+typedef void BIGNUM;
+typedef void visit_info;
 
 #endif
 
-Parrot_STRING Parrot_PMC_get_string(Parrot_INTERP, Parrot_PMC);
-void *Parrot_PMC_get_pointer(Parrot_INTERP, Parrot_PMC);
-Parrot_Int Parrot_PMC_get_intval(Parrot_INTERP, Parrot_PMC);
-Parrot_Int Parrot_PMC_get_intval_intkey(Parrot_INTERP, Parrot_PMC, Parrot_Int);
-Parrot_Float Parrot_PMC_get_numval(Parrot_INTERP, Parrot_PMC);
-char *Parrot_PMC_get_cstring(Parrot_INTERP, Parrot_PMC);
-char *Parrot_PMC_get_cstringn(Parrot_INTERP, Parrot_PMC, Parrot_Int *);
-
-void Parrot_PMC_set_string(Parrot_INTERP, Parrot_PMC, Parrot_STRING);
-void Parrot_PMC_set_pointer(Parrot_INTERP, Parrot_PMC, void *);
-void Parrot_PMC_set_cstring(Parrot_INTERP, Parrot_PMC, const char *);
-void Parrot_PMC_set_cstringn(Parrot_INTERP, Parrot_PMC, const char *, Parrot_Int);
-void Parrot_PMC_set_intval(Parrot_INTERP, Parrot_PMC, Parrot_Int);
-void Parrot_PMC_set_intval_intkey(Parrot_INTERP, Parrot_PMC, Parrot_Int, Parrot_Int);
-void Parrot_PMC_set_numval(Parrot_INTERP, Parrot_PMC, Parrot_Float);
+#include parrot/vtable.h  /* Parrot_Vtable */
+
+Parrot_String Parrot_PMC_get_string(Parrot_Interp, Parrot_PMC);
+void *Parrot_PMC_get_pointer(Parrot_Interp, Parrot_PMC);
+Parrot_Int Parrot_PMC_get_intval(Parrot_Interp, Parrot_PMC);
+Parrot_Int Parrot_PMC_get_intval_intkey(Parrot_Interp, Parrot_PMC, Parrot_Int);
+Parrot_Float Parrot_PMC_get_numval(Parrot_Interp, Parrot_PMC);
+char *Parrot_PMC_get_cstring(Parrot_Interp, Parrot_PMC);
+char *Parrot_PMC_get_cstringn(Parrot_Interp, Parrot_PMC, Parrot_Int *);
+Parrot_Vtable Parrot_PMC_get_vtable(Parrot_Interp, Parrot_PMC);
+
+void Parrot_PMC_set_string(Parrot_Interp, Parrot_PMC, Parrot_String);
+void Parrot_PMC_set_pointer(Parrot_Interp, Parrot_PMC, void *);
+void Parrot_PMC_set_cstring(Parrot_Interp, Parrot_PMC, const char *);
+void Parrot_PMC_set_cstringn(Parrot_Interp, Parrot_PMC, const char *, Parrot_Int);
+void Parrot_PMC_set_intval(Parrot_Interp, Parrot_PMC, Parrot_Int);
+void Parrot_PMC_set_intval_intkey(Parrot_Interp, Parrot_PMC, Parrot_Int, Parrot_Int);
+void