[svn:mod_parrot] r609 - in mod_parrot/trunk: include src src/pmc

[email protected] Sun, 8 Feb 2009 08:04:46 -0800 (PST)
Newsgroups perl.cvs.mod_parrot
Message-ID <[email protected]>
Author: jhorwitz
Date: Sun Feb  8 08:04:44 2009
New Revision: 609

Modified:
   mod_parrot/trunk/include/mod_parrot.h
   mod_parrot/trunk/src/nci.c
   mod_parrot/trunk/src/parrot_util.c
   mod_parrot/trunk/src/pmc/modparrothandle.pmc

Log:
fix for pdd28_strings changes to parrot


Modified: mod_parrot/trunk/include/mod_parrot.h
==============================================================================
--- mod_parrot/trunk/include/mod_parrot.h	(original)
+++ mod_parrot/trunk/include/mod_parrot.h	Sun Feb  8 08:04:44 2009
@@ -31,7 +31,7 @@
 #define MODPARROT_DEFAULT_INIT "mod_parrot.pbc"
 
 /* string macros */
-#define MAKE_PARROT_STRING(x) (string_from_cstring(interp, x, strlen(x)))
+#define MAKE_PARROT_STRING(x) (Parrot_str_new(interp, x, strlen(x)))
 
 /* context macros */
 #define MODPARROT_CTX_ISLOCKED(x) (x->locked == 1)

Modified: mod_parrot/trunk/src/nci.c
==============================================================================
--- mod_parrot/trunk/src/nci.c	(original)
+++ mod_parrot/trunk/src/nci.c	Sun Feb  8 08:04:44 2009
@@ -198,7 +198,7 @@
 
     buf = Parrot_PMC_get_cstringn(ctxp->interp, p, &plen);
     len = ap_rwrite(buf, (plen < size) ? len : size, r);
-    string_cstring_free(buf);
+    Parrot_str_free_cstring(buf);
 
     return(len);
 }

Modified: mod_parrot/trunk/src/parrot_util.c
==============================================================================
--- mod_parrot/trunk/src/parrot_util.c	(original)
+++ mod_parrot/trunk/src/parrot_util.c	Sun Feb  8 08:04:44 2009
@@ -203,7 +203,7 @@
     if (!PMC_IS_NULL(sub)) {
         str = Parrot_Context_infostr(interp, ctx);
         if (str)
-            buf = string_concat(interp, buf, str, 0);
+            buf = Parrot_str_concat(interp, buf, str, 0);
     }
 
     /* backtrace: follow the continuation chain */
@@ -224,15 +224,15 @@
             PMC_cont(sub)->to_ctx->current_sub) {
             ++rec_level;
         } else if (rec_level != 0) {
-            buf = string_printf(interp, "... call repeated %d times\n",
+            buf = Parrot_sprintf_c(interp, "... call repeated %d times\n",
                 rec_level);
-            buf = string_concat(interp, buf, str, 0);
+            buf = Parrot_str_concat(interp, buf, str, 0);
             rec_level = 0;
         }
 
         /* print the context description */
         if (rec_level == 0)
-            buf = string_concat(interp, buf, str, 0);
+            buf = Parrot_str_concat(interp, buf, str, 0);
 
         /* get the next Continuation */
         ctx = PMC_cont(sub)->to_ctx;
@@ -241,10 +241,11 @@
             break;
     }
     if (rec_level != 0) {
-        buf = string_printf(interp, "... call repeated %d times\n", rec_level);
+        buf = Parrot_sprintf_c(interp,"... call repeated %d times\n",
+            rec_level);
     }
 
-    trace_string = string_to_cstring(interp, buf);
+    trace_string = Parrot_str_to_cstring(interp, buf);
     return(trace_string);
 }
 
@@ -258,8 +259,8 @@
     Parrot_PMC init;
     int typenum;
 
-    namespace = string_split(interp, string_from_literal(interp, ";"),
-        string_from_cstring(interp, classname, strlen(classname)));
+    namespace = Parrot_str_split(interp, string_from_literal(interp, ";"),
+        Parrot_str_new(interp, classname, strlen(classname)));
     Parrot_register_pmc(interp, namespace);
     _class = Parrot_oo_get_class(interp, namespace);
     Parrot_unregister_pmc(interp, namespace);
@@ -273,7 +274,7 @@
         init = (Parrot_PMC)Parrot_PMC_new(interp, typenum);
         Parrot_register_pmc(interp, init);
         Parrot_PMC_set_pmc_keyed_str(interp, init,
-            string_from_cstring(interp, init_key, strlen(init_key)),
+            Parrot_str_new(interp, init_key, strlen(init_key)),
                 pointer_pmc);
         obj = Parrot_Class_instantiate(interp, _class, init);
     }

Modified: mod_parrot/trunk/src/pmc/modparrothandle.pmc
==============================================================================
--- mod_parrot/trunk/src/pmc/modparrothandle.pmc	(original)
+++ mod_parrot/trunk/src/pmc/modparrothandle.pmc	Sun Feb  8 08:04:44 2009
@@ -89,8 +89,9 @@
         Parrot_ModParrotHandle_attributes * const data_struct = PARROT_MODPARROTHANDLE(copy);
 
         data_struct->flags        = old_struct->flags;
-        data_struct->mode         = string_copy(INTERP, old_struct->mode);
-        data_struct->encoding     = string_copy(INTERP, old_struct->encoding);
+        data_struct->mode         = Parrot_str_copy(INTERP, old_struct->mode);
+        data_struct->encoding     = Parrot_str_copy(INTERP,
+                                        old_struct->encoding);
         data_struct->r            = old_struct->r;
 
         return copy;
@@ -178,12 +179,12 @@
         SET_ATTR_r(INTERP, SELF, r);
 
         if (got_mode && !STRING_IS_NULL(mode))
-            SET_ATTR_mode(INTERP, SELF, string_copy(INTERP, mode));
+            SET_ATTR_mode(INTERP, SELF, Parrot_str_copy(INTERP, mode));
 
         /* Set a default mode of read-write. */
         GET_ATTR_mode(INTERP, SELF, open_mode);
         if (STRING_IS_NULL(open_mode)) {
-            open_mode = const_string(INTERP, "r");
+            open_mode = Parrot_str_new_constant(INTERP, "r");
             SET_ATTR_mode(INTERP, SELF, open_mode);
         }
 
@@ -234,13 +235,13 @@
 
     METHOD is_closed() {
         request_rec *rr = NULL;
-        STRING *attrname = const_string(INTERP, "r");
+        STRING *attrname = Parrot_str_new_constant(INTERP, "r");
         PMC *attrpmc;
         PMC *r;
 
         GET_ATTR_r(INTERP, SELF, r)
         if (r) {
-            attrname = const_string(INTERP, "r");
+            attrname = Parrot_str_new_constant(INTERP, "r");
             attrpmc = VTABLE_get_attr_str(INTERP, r, attrname);
             rr = (request_rec *)PMC_data(attrpmc);
         }
@@ -273,7 +274,7 @@
             Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_PIO_ERROR,
                 "Cannot read from a closed filehandle");
 
-        attrname = const_string(INTERP, "r");
+        attrname = Parrot_str_new_constant(INTERP, "r");
         attrpmc = VTABLE_get_attr_str(INTERP, r, attrname);
         rr = (request_rec *)PMC_data(attrpmc);
 
@@ -288,7 +289,7 @@
         if (bytes) {
             GET_ATTR_read_offset(INTERP, SELF, offset);
             SET_ATTR_read_offset(INTERP, SELF, offset + bytes);
-            str = string_from_cstring(INTERP, buf, bytes);
+            str = Parrot_str_new(INTERP, buf, bytes);
         }
         else {
             /* XXX should be a null string */
@@ -339,11 +340,11 @@
         if (!rpmc)
             Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_PIO_ERROR,
                 "Cannot read from a closed filehandle");
-        attrname = const_string(INTERP, "r");
+        attrname = Parrot_str_new_constant(INTERP, "r");
         attrpmc = VTABLE_get_attr_str(INTERP, rpmc, attrname);
         r = (request_rec *)PMC_data(attrpmc);
 
-        result = string_make_empty(INTERP, enum_stringrep_one, 0);
+        result = Parrot_str_new_noinit(INTERP, enum_stringrep_one, 0);
         headers = r->headers_in;
         buf = apr_table_get(headers, "Content-Length");
         if (!buf) {
@@ -357,9 +358,9 @@
             STRING * const part =
                 Parrot_io_reads(INTERP, SELF, MODPARROTHANDLE_READ_SIZE);
             /* XXX is this reliably in bytes??? */
-            nread = string_length(INTERP, part);
+            nread = Parrot_str_byte_length(INTERP, part);
             if (nread) {
-                result = string_append(INTERP, result, part);
+                result = Parrot_str_append(INTERP, result, part);
             }
             else {
                 /* prevent infinite loops.  this should never happen */
@@ -423,7 +424,7 @@
             Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_PIO_ERROR,
                 "Cannot write to a closed filehandle");
 
-        attrname = const_string(INTERP, "r");
+        attrname = Parrot_str_new_constant(INTERP, "r");
         attrpmc = VTABLE_get_attr_str(INTERP, r, attrname);
         rr = (request_rec *)PMC_data(attrpmc);
 
@@ -432,9 +433,9 @@
             Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_PIO_ERROR,
                 "Cannot write to a filehandle not opened for write");
 
-        str = string_to_cstring(INTERP, to_print);
+        str = string_to_cstring_nullable(INTERP, to_print);
         status = ap_rputs(str, rr);
-        string_cstring_free(str);
+        Parrot_str_free_cstring(str);
 
         RETURN(INTVAL status);
     }
@@ -452,22 +453,22 @@
 
     METHOD buffer_type(STRING *new_type :optional, INTVAL got_type :opt_flag) {
         INTVAL flags;
-        STRING *nobuffer_string   = const_string(INTERP, "unbuffered");
-        STRING *linebuffer_string = const_string(INTERP, "line-buffered");
-        STRING *fullbuffer_string = const_string(INTERP, "full-buffered");
+        STRING *nobuffer_string   = Parrot_str_new_constant(INTERP, "unbuffered");
+        STRING *linebuffer_string = Parrot_str_new_constant(INTERP, "line-buffered");
+        STRING *fullbuffer_string = Parrot_str_new_constant(INTERP, "full-buffered");
 
         GET_ATTR_flags(INTERP, SELF, flags);
 
         if (got_type) {
-            if (string_equal(INTERP, new_type, nobuffer_string) == 0) {
+            if (Parrot_str_equal(INTERP, new_type, nobuffer_string)) {
                 flags &= ~ PIO_F_LINEBUF;
                 flags &= ~ PIO_F_BLKBUF;
             }
-            else if (string_equal(INTERP, new_type, linebuffer_string) == 0) {
+            else if (Parrot_str_equal(INTERP, new_type, linebuffer_string)) {
                 flags |=   PIO_F_LINEBUF;
                 flags &= ~ PIO_F_BLKBUF;
             }
-            else if (string_equal(INTERP, new_type, fullbuffer_string) == 0) {
+            else if (Parrot_str_equal(INTERP, new_type, fullbuffer_string)) {
                 flags &= ~ PIO_F_LINEBUF;
                 flags |=   PIO_F_BLKBUF;
             }
@@ -511,7 +512,7 @@
         STRING *mode, *mode_copy;
 
         GET_ATTR_mode(INTERP, SELF, mode);
-        mode_copy = string_copy(INTERP, mode);
+        mode_copy = Parrot_str_copy(INTERP, mode);
 
         RETURN(STRING *mode_copy);
 
@@ -534,14 +535,14 @@
 
         if (got_encoding) {
             if (!STRING_IS_NULL(new_encoding))
-                encoding_copy = string_copy(INTERP, new_encoding);
+                encoding_copy = Parrot_str_copy(INTERP, new_encoding);
             SET_ATTR_encoding(INTERP, SELF, encoding_copy);
             RETURN(STRING *new_encoding);
         }
 
         GET_ATTR_encoding(INTERP, SELF, encoding);
         if (!STRING_IS_NULL(encoding))
-            encoding_copy = string_copy(INTERP, encoding);
+            encoding_copy = Parrot_str_copy(INTERP, encoding);
 
         RETURN(STRING *encoding_copy);