Author: chromatic
Date: Tue May  1 17:00:16 2007
New Revision: 18383

Modified:
   trunk/docs/extend.pod
   trunk/ext/Parrot-Embed/lib/Parrot/Embed.xs
   trunk/ext/Parrot-Embed/typemap
   trunk/include/parrot/dynext.h
   trunk/include/parrot/extend.h
   trunk/include/parrot/interpreter.h
   trunk/lib/Parrot/Pmc2c/UtilFunctions.pm
   trunk/lib/Parrot/Vtable.pm
   trunk/src/extend.c
   trunk/src/pmc/namespace.pmc
   trunk/t/src/extend.t

Changes in other areas also in this revision:
Modified:
   trunk/docs/pdds/draft/pdd11_extending.pod

Log:
Sanitize external interface, mostly by changing Parrot_STRING to Parrot_String 
(Mattia Barbon, RT #24817).

Modified: trunk/docs/extend.pod
==============================================================================
--- trunk/docs/extend.pod       (original)
+++ trunk/docs/extend.pod       Tue May  1 17:00:16 2007
@@ -37,7 +37,7 @@
 =over 4
 
 =item C<Parrot_call_method(Parrot_Interp interp, Parrot_PMC sub
-       Parrot_PMC object, Parrot_STRING method, const char *signature, ...)>
+       Parrot_PMC object, Parrot_String method, const char *signature, ...)>
 
 Calls a method on C<object> with the given signature and arguments. C<sub> is
 the method that's being called, and C<method> is the name of the method in the

Modified: trunk/ext/Parrot-Embed/lib/Parrot/Embed.xs
==============================================================================
--- trunk/ext/Parrot-Embed/lib/Parrot/Embed.xs  (original)
+++ trunk/ext/Parrot-Embed/lib/Parrot/Embed.xs  Tue May  1 17:00:16 2007
@@ -114,8 +114,8 @@
 PREINIT:
        Parrot_Interp  real_interp;
        SV            *namespace;
-       Parrot_STRING  p_namespace;
-       Parrot_STRING  p_global;
+       Parrot_String  p_namespace;
+       Parrot_String  p_global;
        Parrot_PMC     pmc;
 CODE:
        if ( items < 2 || items > 3 )
@@ -181,7 +181,7 @@
        Parrot_PMC    pmc_actual;
        Parrot_PMC    out_pmc;
        Parrot_Interp interp;
-       Parrot_STRING arg_string;
+       Parrot_String arg_string;
 CODE:
        pmc_actual = pmc->pmc;
        interp     = get_interp( pmc->interp );

Modified: trunk/ext/Parrot-Embed/typemap
==============================================================================
--- trunk/ext/Parrot-Embed/typemap      (original)
+++ trunk/ext/Parrot-Embed/typemap      Tue May  1 17:00:16 2007
@@ -1,7 +1,7 @@
 TYPEMAP
 Parrot_Interp          T_PTR
 Parrot_PackFile        T_PTR
-Parrot_STRING          T_PTR
+Parrot_String          T_PTR
 
 Parrot_PMC                     T_PTROBJ_PARROT
 Parrot_Interp          T_PTROBJ_PARROT

Modified: trunk/include/parrot/dynext.h
==============================================================================
--- trunk/include/parrot/dynext.h       (original)
+++ trunk/include/parrot/dynext.h       Tue May  1 17:00:16 2007
@@ -8,27 +8,27 @@
 #if !defined(PARROT_DYNEXT_H_GUARD)
 #define PARROT_DYNEXT_H_GUARD
 
-
 /* dynamic lib/oplib/PMC loading */
-PARROT_API PMC *Parrot_load_lib(Interp *interp, STRING *lib, PMC *initializer);
+PARROT_API Parrot_PMC
+Parrot_load_lib(Parrot_Interp interp,
+                Parrot_String lib, Parrot_PMC initializer);
 
 /* dynamic lib/oplib/PMC init */
-PARROT_API PMC *
-Parrot_init_lib(Interp *interp,
-                PMC *(*load_func)(Interp *),
-                void (*init_func)(Interp *, PMC *));
+PARROT_API Parrot_PMC
+Parrot_init_lib(Parrot_Interp interp,
+                Parrot_PMC(*load_func)(Parrot_Interp),
+                void (*init_func)(Parrot_Interp, Parrot_PMC));
 
 /* for cloning live iterpreters to create new threads */
-PARROT_API PMC *
-Parrot_clone_lib_into(Interp *dest_interp, Interp *source_interp, PMC 
*lib_pmc);
+PARROT_API Parrot_PMC
+Parrot_clone_lib_into(Parrot_Interp dest_interp, Parrot_Interp source_interp,
+                      Parrot_PMC lib_pmc);
 
 #endif /* PARROT_DYNEXT_H_GUARD */
 
-
 /*
  * Local variables:
  *   c-file-style: "parrot"
  * End:
  * vim: expandtab shiftwidth=4:
  */
-

Modified: trunk/include/parrot/extend.h
==============================================================================
--- trunk/include/parrot/extend.h       (original)
+++ trunk/include/parrot/extend.h       Tue May  1 17:00:16 2007
@@ -25,7 +25,7 @@
    but that would be really annoying */
 #if defined(PARROT_IN_CORE)
 
-#define Parrot_STRING STRING *
+#define Parrot_String STRING *
 #define Parrot_PMC PMC *
 #define Parrot_Language Parrot_Int
 #define Parrot_VTABLE VTABLE *
@@ -42,7 +42,7 @@
 
 #else
 
-typedef void * Parrot_STRING;
+typedef void * Parrot_String;
 typedef void * Parrot_PMC;
 typedef Parrot_Int Parrot_Language;
 typedef void * Parrot_Encoding;
@@ -57,7 +57,7 @@
 
 Parrot_VTABLE Parrot_get_vtable(Parrot_Interp, Parrot_Int);
 Parrot_PMC Parrot_PMC_get_pmc_intkey(Parrot_Interp, Parrot_PMC, Parrot_Int);
-Parrot_STRING Parrot_PMC_get_string_intkey(Parrot_Interp, Parrot_PMC, 
Parrot_Int);
+Parrot_String Parrot_PMC_get_string_intkey(Parrot_Interp, Parrot_PMC, 
Parrot_Int);
 void *Parrot_PMC_get_pointer_intkey(Parrot_Interp, Parrot_PMC, Parrot_Int);
 Parrot_Int Parrot_PMC_get_intval(Parrot_Interp, Parrot_PMC);
 Parrot_Int Parrot_PMC_get_intval_pmckey(Parrot_Interp, Parrot_PMC, Parrot_PMC);
@@ -72,8 +72,8 @@
 void Parrot_PMC_set_vtable(Parrot_Interp, Parrot_PMC, Parrot_VTABLE);
 void Parrot_PMC_set_pmc_intkey(Parrot_Interp, Parrot_PMC, Parrot_Int, 
Parrot_PMC);
 void Parrot_PMC_set_pmc_pmckey(Parrot_Interp, Parrot_PMC, Parrot_PMC, 
Parrot_PMC);
-void Parrot_PMC_set_string(Parrot_Interp, Parrot_PMC, Parrot_STRING);
-void Parrot_PMC_set_string_intkey(Parrot_Interp, Parrot_PMC, Parrot_Int, 
Parrot_STRING);
+void Parrot_PMC_set_string(Parrot_Interp, Parrot_PMC, Parrot_String);
+void Parrot_PMC_set_string_intkey(Parrot_Interp, Parrot_PMC, Parrot_Int, 
Parrot_String);
 void Parrot_PMC_set_pointer_intkey(Parrot_Interp, Parrot_PMC, Parrot_Int, void 
*);
 void Parrot_PMC_set_cstring(Parrot_Interp, Parrot_PMC, const char *);
 void Parrot_PMC_set_cstring_intkey(Parrot_Interp, Parrot_PMC, Parrot_Int, 
const char *);
@@ -99,23 +99,23 @@
 Parrot_Float  Parrot_call_sub_ret_float(Parrot_Interp, Parrot_PMC,
                     const char *, ...);
 void *        Parrot_call_method(Parrot_Interp, Parrot_PMC,
-                    Parrot_PMC, Parrot_STRING, const char *, ...);
+                    Parrot_PMC, Parrot_String, const char *, ...);
 Parrot_Int    Parrot_call_method_ret_int(Parrot_Interp, Parrot_PMC,
-                    Parrot_PMC, Parrot_STRING, const char *, ...);
+                    Parrot_PMC, Parrot_String, const char *, ...);
 Parrot_Float  Parrot_call_method_ret_float(Parrot_Interp, Parrot_PMC,
-                    Parrot_PMC, Parrot_STRING, const char *, ...);
+                    Parrot_PMC, Parrot_String, const char *, ...);
 
 Parrot_Int    Parrot_get_intreg(Parrot_Interp, Parrot_Int);
 Parrot_Float  Parrot_get_numreg(Parrot_Interp, Parrot_Int);
-Parrot_STRING Parrot_get_strreg(Parrot_Interp, Parrot_Int);
+Parrot_String Parrot_get_strreg(Parrot_Interp, Parrot_Int);
 Parrot_PMC    Parrot_get_pmcreg(Parrot_Interp, Parrot_Int);
 
 void Parrot_set_intreg(Parrot_Interp, Parrot_Int, Parrot_Int);
 void Parrot_set_numreg(Parrot_Interp, Parrot_Int, Parrot_Float);
-void Parrot_set_strreg(Parrot_Interp, Parrot_Int, Parrot_STRING);
+void Parrot_set_strreg(Parrot_Interp, Parrot_Int, Parrot_String);
 void Parrot_set_pmcreg(Parrot_Interp, Parrot_Int, Parrot_PMC);
 
-Parrot_STRING Parrot_new_string(Parrot_Interp, char *, int, const char * 
const, Parrot_Int);
+Parrot_String Parrot_new_string(Parrot_Interp, char *, int, const char * 
const, Parrot_Int);
 
 Parrot_Language Parrot_find_language(Parrot_Interp, char*);
 

Modified: trunk/include/parrot/interpreter.h
==============================================================================
--- trunk/include/parrot/interpreter.h  (original)
+++ trunk/include/parrot/interpreter.h  Tue May  1 17:00:16 2007
@@ -104,10 +104,15 @@
 
 struct parrot_interp_t;
 
-typedef struct parrot_interp_t *Parrot_Interp;
-
 #if defined(PARROT_IN_CORE)
 
+#define Parrot_String   STRING *
+#define Parrot_PMC      PMC *
+#define Parrot_Language Parrot_Int
+#define Parrot_Vtable struct _vtable*
+
+typedef struct parrot_interp_t *Parrot_Interp;
+
 typedef Parrot_Interp_flag Interp_flags;
 typedef Parrot_Run_core_t Run_Cores;
 
@@ -546,6 +551,9 @@
 
 #else
 
+struct Parrot_Interp_;
+typedef struct Parrot_Interp_ *Parrot_Interp;
+
 typedef void * *(*native_func_t)(Parrot_Interp interp,
                                  void *cur_opcode,
                                  void *start_code);

Modified: trunk/lib/Parrot/Pmc2c/UtilFunctions.pm
==============================================================================
--- trunk/lib/Parrot/Pmc2c/UtilFunctions.pm     (original)
+++ trunk/lib/Parrot/Pmc2c/UtilFunctions.pm     Tue May  1 17:00:16 2007
@@ -90,8 +90,8 @@
 PARROT_DYNEXT_EXPORT extern Parrot_PMC 
Parrot_lib_${lc_libname}_load(Parrot_Interp interp); /* don't warn */
 Parrot_PMC Parrot_lib_${lc_libname}_load(Parrot_Interp interp)
 {
-    Parrot_STRING whoami;
-    Parrot_PMC pmc;
+    Parrot_String whoami;
+    Parrot_PMC    pmc;
 EOC
     while ( my ( $class, $info ) = each %classes ) {
         next if $info->{flags}->{noinit};

Modified: trunk/lib/Parrot/Vtable.pm
==============================================================================
--- trunk/lib/Parrot/Vtable.pm  (original)
+++ trunk/lib/Parrot/Vtable.pm  Tue May  1 17:00:16 2007
@@ -378,7 +378,7 @@
     my $type = shift;
 
     my %typemap = (
-        'STRING*'   => 'Parrot_STRING',
+        'STRING*'   => 'Parrot_String',
         'void*'     => 'void*',
         'INTVAL'    => 'Parrot_Int',
         'PMC*'      => 'Parrot_PMC',

Modified: trunk/src/extend.c
==============================================================================
--- trunk/src/extend.c  (original)
+++ trunk/src/extend.c  Tue May  1 17:00:16 2007
@@ -63,7 +63,7 @@
 
 /*
 
-=item C<Parrot_STRING
+=item C<Parrot_String
 Parrot_PMC_get_string_intkey(Parrot_Interp interp, Parrot_PMC pmc,
                              Parrot_Int key)>
 
@@ -73,9 +73,9 @@
 
 */
 
-Parrot_STRING Parrot_PMC_get_string_intkey(Parrot_Interp interp,
+Parrot_String Parrot_PMC_get_string_intkey(Parrot_Interp interp,
                                            Parrot_PMC pmc, Parrot_Int key) {
-    Parrot_STRING retval;
+    Parrot_String retval;
     PARROT_CALLIN_START(interp);
     retval = VTABLE_get_string_keyed_int(interp, pmc, key);
     PARROT_CALLIN_END(interp);
@@ -343,7 +343,7 @@
 
 =item C<void
 Parrot_PMC_set_string(Parrot_Interp interp, Parrot_PMC pmc,
-                      Parrot_STRING value)>
+                      Parrot_String value)>
 
 Assign the passed-in Parrot string to the passed-in PMC.
 
@@ -353,7 +353,7 @@
 
 void
 Parrot_PMC_set_string(Parrot_Interp interp, Parrot_PMC pmc,
-                      Parrot_STRING value) {
+                      Parrot_String value) {
     PARROT_CALLIN_START(interp);
     VTABLE_set_string_native(interp, pmc, value);
     PARROT_CALLIN_END(interp);
@@ -363,7 +363,7 @@
 
 =item C<void
 Parrot_PMC_set_string_intkey(Parrot_Interp interp, Parrot_PMC pmc,
-                              Parrot_Int key, Parrot_STRING value)>
+                              Parrot_Int key, Parrot_String value)>
 
 Assign the passed-in Parrot string to the passed-in PMC.
 
@@ -373,7 +373,7 @@
 
 void
 Parrot_PMC_set_string_intkey(Parrot_Interp interp, Parrot_PMC pmc,
-                                  Parrot_Int key, Parrot_STRING value)
+                                  Parrot_Int key, Parrot_String value)
 {
     PARROT_CALLIN_START(interp);
     VTABLE_set_string_keyed_int(interp, pmc, key, value);
@@ -743,7 +743,7 @@
     v ... void return
     I ... Parrot_Int
     N ... Parrot_Float
-    S ... Parrot_STRING
+    S ... Parrot_String
     P ... Parrot_PMC
 
 =item C<Parrot_Int>
@@ -820,14 +820,14 @@
 /*
 
 =item C<void* Parrot_call_method(Parrot_Interp interp, Parrot_PMC sub,
-        Parrot_PMC object, Parrot_STRING method, const char *signature, ...)>
+        Parrot_PMC object, Parrot_String method, const char *signature, ...)>
 
 =item C<Parrot_Int Parrot_call_method_ret_int(Parrot_Interp interp,
-    Parrot_PMC sub, Parrot_PMC object, Parrot_STRING method,
+    Parrot_PMC sub, Parrot_PMC object, Parrot_String method,
     const char *signature, ...)>
 
 =item C<Parrot_Float Parrot_call_method_ret_float(Parrot_Interp interp,
-    Parrot_PMC sub, Parrot_PMC object, Parrot_STRING method,
+    Parrot_PMC sub, Parrot_PMC object, Parrot_String method,
     const char *signature, ...)>
 
 Call a parrot method for the given object.
@@ -838,7 +838,7 @@
 
 void *
 Parrot_call_method(Parrot_Interp interp, Parrot_PMC sub, Parrot_PMC obj,
-                        Parrot_STRING method, const char *signature, ...)
+                        Parrot_String method, const char *signature, ...)
 {
     void *result;
     va_list ap;
@@ -854,7 +854,7 @@
 
 Parrot_Int
 Parrot_call_method_ret_int(Parrot_Interp interp, Parrot_PMC sub,
-        Parrot_PMC obj, Parrot_STRING method, const char *signature, ...)
+        Parrot_PMC obj, Parrot_String method, const char *signature, ...)
 {
     Parrot_Int result;
     va_list ap;
@@ -870,7 +870,7 @@
 
 Parrot_Float
 Parrot_call_method_ret_float(Parrot_Interp interp, Parrot_PMC sub,
-        Parrot_PMC obj, Parrot_STRING method, const char *signature, ...)
+        Parrot_PMC obj, Parrot_String method, const char *signature, ...)
 {
     Parrot_Float result;
     va_list ap;
@@ -920,7 +920,7 @@
 
 /*
 
-=item C<Parrot_STRING
+=item C<Parrot_String
 Parrot_get_strreg(Parrot_Interp interp, Parrot_Int regnum)>
 
 Return the value of a string register.
@@ -929,7 +929,7 @@
 
 */
 
-Parrot_STRING
+Parrot_String
 Parrot_get_strreg(Parrot_Interp interp, Parrot_Int regnum)
 {
     return REG_STR(regnum);
@@ -994,7 +994,7 @@
 
 =item C<void
 Parrot_set_strreg(Parrot_Interp interp, Parrot_Int regnum,
-                  Parrot_STRING value)>
+                  Parrot_String value)>
 
 Set the value of an S register.
 
@@ -1004,7 +1004,7 @@
 
 void
 Parrot_set_strreg(Parrot_Interp interp, Parrot_Int regnum,
-                  Parrot_STRING value)
+                  Parrot_String value)
 {
     REG_STR(regnum) = value;
 }
@@ -1033,7 +1033,7 @@
  */
 /*
 
-=item C<Parrot_STRING Parrot_new_string(Parrot_Interp interp,
+=item C<Parrot_String Parrot_new_string(Parrot_Interp interp,
                                 char *buffer, int length,
                                 const char * const encoding_name,
                                 Parrot_Int flags)>
@@ -1047,13 +1047,13 @@
 
 */
 
-Parrot_STRING
+Parrot_String
 Parrot_new_string(Parrot_Interp interp,
                                 char *buffer, int length,
                                 const char * const encoding_name,
                                 Parrot_Int flags)
 {
-    Parrot_STRING retval;
+    Parrot_String retval;
     PARROT_CALLIN_START(interp);
     retval = string_make(interp, buffer, length, encoding_name, flags);
     PARROT_CALLIN_END(interp);

Modified: trunk/src/pmc/namespace.pmc
==============================================================================
--- trunk/src/pmc/namespace.pmc (original)
+++ trunk/src/pmc/namespace.pmc Tue May  1 17:00:16 2007
@@ -591,7 +591,7 @@
 
 /*
 
-=item C<METHOD void export_to(PMC* dest, PMC* what)>
+=item C<METHOD void export_to(PMC *dest, PMC *what)>
 
 Export items from this NameSpace into the C<dest> NameSpace. The items to
 export are named in C<what>, which may be an array of strings, a hash, or null.

Modified: trunk/t/src/extend.t
==============================================================================
--- trunk/t/src/extend.t        (original)
+++ trunk/t/src/extend.t        Tue May  1 17:00:16 2007
@@ -100,7 +100,7 @@
 int
 main(int argc, char* argv[]) {
     Parrot_Interp interp;
-    Parrot_STRING output;
+    Parrot_String output;
 
     /* Interpreter set-up */
     interp = Parrot_new(NULL);
@@ -127,7 +127,7 @@
 main(int argc, char* argv[]) {
     Parrot_Interp interp;
     Parrot_Int parrot_reg;
-    Parrot_STRING value, new_value;
+    Parrot_String value, new_value;
 
     /* Interpreter set-up */
     interp = Parrot_new(NULL);
@@ -298,7 +298,7 @@
 main(int argc, char* argv[]) {
     Parrot_Interp interp;
     Parrot_Int type;
-    Parrot_STRING value, new_value;
+    Parrot_String value, new_value;
     Parrot_PMC testpmc;
 
     /* Interpreter set-up */

Reply via email to