develooper Front page | perl.cvs.parrot | Postings from January 2009

[svn:parrot] r35349 - in branches/strings: docs/pdds include/parrot languages/lua/src/pmc src src/io src/ops src/pmc

From:
simon
Date:
January 10, 2009 11:07
Subject:
[svn:parrot] r35349 - in branches/strings: docs/pdds include/parrot languages/lua/src/pmc src src/io src/ops src/pmc
Message ID:
20090110190734.881D6CB9F9@x12.develooper.com
Author: simon
Date: Sat Jan 10 11:07:32 2009
New Revision: 35349

Modified:
   branches/strings/docs/pdds/pdd28_strings.pod
   branches/strings/include/parrot/packfile.h
   branches/strings/include/parrot/pobj.h
   branches/strings/include/parrot/string_funcs.h
   branches/strings/languages/lua/src/pmc/luastring.pmc
   branches/strings/src/io/filehandle.c
   branches/strings/src/io/socket_unix.c
   branches/strings/src/ops/string.ops
   branches/strings/src/pmc/eval.pmc
   branches/strings/src/pmc/filehandle.pmc
   branches/strings/src/pmc/hash.pmc
   branches/strings/src/pmc/string.pmc
   branches/strings/src/pmc/undef.pmc
   branches/strings/src/pmc_freeze.c
   branches/strings/src/spf_render.c
   branches/strings/src/string.c

Log:
Remove deprecated (and mainly unused) "representation" concept.


Modified: branches/strings/docs/pdds/pdd28_strings.pod
==============================================================================
--- branches/strings/docs/pdds/pdd28_strings.pod	(original)
+++ branches/strings/docs/pdds/pdd28_strings.pod	Sat Jan 10 11:07:32 2009
@@ -564,10 +564,6 @@
 
 The following string functions are slated to be deprecated.
 
-=head3 string_primary_encoding_for_representation
-
-Not useful, it only ever returned ASCII.
-
 =head3 string_rep_compatible
 
 Only useful on a very narrow set of string encodings/character sets.

Modified: branches/strings/include/parrot/packfile.h
==============================================================================
--- branches/strings/include/parrot/packfile.h	(original)
+++ branches/strings/include/parrot/packfile.h	Sat Jan 10 11:07:32 2009
@@ -393,6 +393,34 @@
         FUNC_MODIFIES(*dir);
 
 PARROT_EXPORT
+void PackFile_Annotations_add_entry(PARROT_INTERP,
+    ARGMOD(struct PackFile_Annotations *self),
+    opcode_t offset,
+    opcode_t key,
+    opcode_t type,
+    opcode_t value)
+        __attribute__nonnull__(1)
+        __attribute__nonnull__(2)
+        FUNC_MODIFIES(*self);
+
+PARROT_EXPORT
+void PackFile_Annotations_add_group(PARROT_INTERP,
+    ARGMOD(struct PackFile_Annotations *self),
+    opcode_t offset)
+        __attribute__nonnull__(1)
+        __attribute__nonnull__(2)
+        FUNC_MODIFIES(*self);
+
+PARROT_EXPORT
+PARROT_CANNOT_RETURN_NULL
+PackFile_Segment * PackFile_Annotations_new(PARROT_INTERP,
+    ARGIN(struct PackFile *pf),
+    SHIM(const char *name),
+    NULLOK(int add))
+        __attribute__nonnull__(1)
+        __attribute__nonnull__(2);
+
+PARROT_EXPORT
 void PackFile_Constant_destroy(SHIM_INTERP,
     ARGMOD_NULLOK(PackFile_Constant *self))
         FUNC_MODIFIES(*self);
@@ -686,25 +714,6 @@
 void mark_const_subs(PARROT_INTERP)
         __attribute__nonnull__(1);
 
-PARROT_EXPORT
-void PackFile_Annotations_add_entry(PARROT_INTERP,
-    ARGMOD(struct PackFile_Annotations *self),
-    opcode_t offset,
-    opcode_t key,
-    opcode_t type,
-    opcode_t value)
-        __attribute__nonnull__(1)
-        __attribute__nonnull__(2)
-        FUNC_MODIFIES(*self);
-
-PARROT_EXPORT
-void PackFile_Annotations_add_group(PARROT_INTERP,
-    ARGMOD(struct PackFile_Annotations *self),
-    opcode_t offset)
-        __attribute__nonnull__(1)
-        __attribute__nonnull__(2)
-        FUNC_MODIFIES(*self);
-
 void PackFile_Annotations_destroy(SHIM_INTERP,
     ARGMOD(struct PackFile_Segment *seg))
         __attribute__nonnull__(2)
@@ -723,15 +732,6 @@
         __attribute__nonnull__(1)
         __attribute__nonnull__(2);
 
-PARROT_EXPORT
-PARROT_CANNOT_RETURN_NULL
-PackFile_Segment * PackFile_Annotations_new(PARROT_INTERP,
-    ARGIN(struct PackFile *pf),
-    SHIM(const char *name),
-    NULLOK(int add))
-        __attribute__nonnull__(1)
-        __attribute__nonnull__(2);
-
 PARROT_CANNOT_RETURN_NULL
 opcode_t * PackFile_Annotations_pack(PARROT_INTERP,
     ARGIN(struct PackFile_Segment *seg),
@@ -761,6 +761,17 @@
 #define ASSERT_ARGS_PackFile_add_segment __attribute__unused__ int _ASSERT_ARGS_CHECK = \
        PARROT_ASSERT_ARG(dir) \
     || PARROT_ASSERT_ARG(seg)
+#define ASSERT_ARGS_PackFile_Annotations_add_entry \
+     __attribute__unused__ int _ASSERT_ARGS_CHECK = \
+       PARROT_ASSERT_ARG(interp) \
+    || PARROT_ASSERT_ARG(self)
+#define ASSERT_ARGS_PackFile_Annotations_add_group \
+     __attribute__unused__ int _ASSERT_ARGS_CHECK = \
+       PARROT_ASSERT_ARG(interp) \
+    || PARROT_ASSERT_ARG(self)
+#define ASSERT_ARGS_PackFile_Annotations_new __attribute__unused__ int _ASSERT_ARGS_CHECK = \
+       PARROT_ASSERT_ARG(interp) \
+    || PARROT_ASSERT_ARG(pf)
 #define ASSERT_ARGS_PackFile_Constant_destroy __attribute__unused__ int _ASSERT_ARGS_CHECK = 0
 #define ASSERT_ARGS_PackFile_Constant_new __attribute__unused__ int _ASSERT_ARGS_CHECK = 0
 #define ASSERT_ARGS_PackFile_Constant_pack_size __attribute__unused__ int _ASSERT_ARGS_CHECK = \
@@ -871,14 +882,6 @@
     || PARROT_ASSERT_ARG(self)
 #define ASSERT_ARGS_mark_const_subs __attribute__unused__ int _ASSERT_ARGS_CHECK = \
        PARROT_ASSERT_ARG(interp)
-#define ASSERT_ARGS_PackFile_Annotations_add_entry \
-     __attribute__unused__ int _ASSERT_ARGS_CHECK = \
-       PARROT_ASSERT_ARG(interp) \
-    || PARROT_ASSERT_ARG(self)
-#define ASSERT_ARGS_PackFile_Annotations_add_group \
-     __attribute__unused__ int _ASSERT_ARGS_CHECK = \
-       PARROT_ASSERT_ARG(interp) \
-    || PARROT_ASSERT_ARG(self)
 #define ASSERT_ARGS_PackFile_Annotations_destroy __attribute__unused__ int _ASSERT_ARGS_CHECK = \
        PARROT_ASSERT_ARG(seg)
 #define ASSERT_ARGS_PackFile_Annotations_dump __attribute__unused__ int _ASSERT_ARGS_CHECK = \
@@ -887,9 +890,6 @@
 #define ASSERT_ARGS_PackFile_Annotations_lookup __attribute__unused__ int _ASSERT_ARGS_CHECK = \
        PARROT_ASSERT_ARG(interp) \
     || PARROT_ASSERT_ARG(self)
-#define ASSERT_ARGS_PackFile_Annotations_new __attribute__unused__ int _ASSERT_ARGS_CHECK = \
-       PARROT_ASSERT_ARG(interp) \
-    || PARROT_ASSERT_ARG(pf)
 #define ASSERT_ARGS_PackFile_Annotations_pack __attribute__unused__ int _ASSERT_ARGS_CHECK = \
        PARROT_ASSERT_ARG(interp) \
     || PARROT_ASSERT_ARG(seg) \

Modified: branches/strings/include/parrot/pobj.h
==============================================================================
--- branches/strings/include/parrot/pobj.h	(original)
+++ branches/strings/include/parrot/pobj.h	Sat Jan 10 11:07:32 2009
@@ -110,13 +110,6 @@
 #  define PObj_bufrefcountptr(b) ((INTVAL *)PObj_bufallocstart(b))
 #endif
 
-typedef enum {
-    enum_stringrep_unknown = 0,
-    enum_stringrep_one     = 1,
-    enum_stringrep_two     = 2,
-    enum_stringrep_four    = 4
-} parrot_string_representation_t;
-
 struct parrot_string_t {
     UnionVal    cache;
     Parrot_UInt flags;
@@ -125,7 +118,6 @@
     UINTVAL     strlen;
     UINTVAL     hashval; /* cached hash value computation */
 
-    /*    parrot_string_representation_t representation;*/
     const struct _encoding *encoding;
     const struct _charset  *charset;
 };

Modified: branches/strings/include/parrot/string_funcs.h
==============================================================================
--- branches/strings/include/parrot/string_funcs.h	(original)
+++ branches/strings/include/parrot/string_funcs.h	Sat Jan 10 11:07:32 2009
@@ -356,9 +356,7 @@
 
 PARROT_EXPORT
 PARROT_CANNOT_RETURN_NULL
-STRING * string_make_empty(PARROT_INTERP,
-    parrot_string_representation_t representation,
-    UINTVAL capacity)
+STRING * string_make_empty(PARROT_INTERP, UINTVAL capacity)
         __attribute__nonnull__(1);
 
 PARROT_EXPORT
@@ -379,12 +377,6 @@
 
 PARROT_EXPORT
 PARROT_CANNOT_RETURN_NULL
-const char* string_primary_encoding_for_representation(PARROT_INTERP,
-    parrot_string_representation_t representation)
-        __attribute__nonnull__(1);
-
-PARROT_EXPORT
-PARROT_CANNOT_RETURN_NULL
 STRING * string_printf(PARROT_INTERP, ARGIN(const char *format), ...)
         __attribute__nonnull__(1)
         __attribute__nonnull__(2);
@@ -664,9 +656,6 @@
 #define ASSERT_ARGS_string_pin __attribute__unused__ int _ASSERT_ARGS_CHECK = \
        PARROT_ASSERT_ARG(interp) \
     || PARROT_ASSERT_ARG(s)
-#define ASSERT_ARGS_string_primary_encoding_for_representation \
-     __attribute__unused__ int _ASSERT_ARGS_CHECK = \
-       PARROT_ASSERT_ARG(interp)
 #define ASSERT_ARGS_string_printf __attribute__unused__ int _ASSERT_ARGS_CHECK = \
        PARROT_ASSERT_ARG(interp) \
     || PARROT_ASSERT_ARG(format)

Modified: branches/strings/languages/lua/src/pmc/luastring.pmc
==============================================================================
--- branches/strings/languages/lua/src/pmc/luastring.pmc	(original)
+++ branches/strings/languages/lua/src/pmc/luastring.pmc	Sat Jan 10 11:07:32 2009
@@ -42,7 +42,7 @@
 
 */
     VTABLE void init() {
-        PMC_str_val(SELF) = string_make_empty(INTERP, enum_stringrep_one, 0);
+        PMC_str_val(SELF) = string_make_empty(INTERP, 0);
         PObj_custom_mark_SET(SELF);
     }
 

Modified: branches/strings/src/io/filehandle.c
==============================================================================
--- branches/strings/src/io/filehandle.c	(original)
+++ branches/strings/src/io/filehandle.c	Sat Jan 10 11:07:32 2009
@@ -120,7 +120,7 @@
      * when we get a NULL string, we read a default len
      */
     if (*buf == NULL) {
-        *buf = string_make_empty(interp, enum_stringrep_one, len);
+        *buf = string_make_empty(interp, len);
         return *buf;
     }
     else {

Modified: branches/strings/src/io/socket_unix.c
==============================================================================
--- branches/strings/src/io/socket_unix.c	(original)
+++ branches/strings/src/io/socket_unix.c	Sat Jan 10 11:07:32 2009
@@ -362,11 +362,11 @@
             case ECONNRESET:
                 /* XXX why close it on err return result is -1 anyway */
                 close(io->fd);
-                *s = string_make_empty(interp, enum_stringrep_one, 0);
+                *s = string_make_empty(interp, 0);
                 return -1;
             default:
                 close(io->fd);
-                *s = string_make_empty(interp, enum_stringrep_one, 0);
+                *s = string_make_empty(interp, 0);
                 return -1;
         }
     }

Modified: branches/strings/src/ops/string.ops
==============================================================================
--- branches/strings/src/ops/string.ops	(original)
+++ branches/strings/src/ops/string.ops	Sat Jan 10 11:07:32 2009
@@ -338,11 +338,11 @@
 =cut
 
 inline op new(out STR) :base_mem {
-  $1 = string_make_empty(interp, enum_stringrep_one, 0);
+  $1 = string_make_empty(interp, 0);
 }
 
 inline op new(out STR, in INT) :base_mem {
-    $1 = string_make_empty(interp, enum_stringrep_one, $2);
+    $1 = string_make_empty(interp, $2);
 }
 
 

Modified: branches/strings/src/pmc/eval.pmc
==============================================================================
--- branches/strings/src/pmc/eval.pmc	(original)
+++ branches/strings/src/pmc/eval.pmc	Sat Jan 10 11:07:32 2009
@@ -255,8 +255,7 @@
          * effect
          */
         aligned_size = size + 15;
-        res          = string_make_empty(INTERP, enum_stringrep_one,
-                                         aligned_size);
+        res          = string_make_empty(INTERP, aligned_size);
         res->strlen  = res->bufused = size;
 
         if ((size_t)(res->strstart) & 0xf) {

Modified: branches/strings/src/pmc/filehandle.pmc
==============================================================================
--- branches/strings/src/pmc/filehandle.pmc	(original)
+++ branches/strings/src/pmc/filehandle.pmc	Sat Jan 10 11:07:32 2009
@@ -432,7 +432,7 @@
                 Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_PIO_ERROR,
                                 "Cannot readall without a file name or open filehandle");
             }
-            result = string_make_empty(INTERP, enum_stringrep_one, 0);
+            result = string_make_empty(INTERP, 0);
 
             /* Do line buffering on the filehandle */
             if (!(PARROT_FILEHANDLE(SELF)->flags & PIO_F_LINEBUF))

Modified: branches/strings/src/pmc/hash.pmc
==============================================================================
--- branches/strings/src/pmc/hash.pmc	(original)
+++ branches/strings/src/pmc/hash.pmc	Sat Jan 10 11:07:32 2009
@@ -410,7 +410,7 @@
          *      (--leo)
          */
         if (!b)
-            return string_make_empty(INTERP, enum_stringrep_one, 0);
+            return string_make_empty(INTERP, 0);
 
         return VTABLE_get_string(INTERP, (PMC*) b->value);
     }
@@ -456,7 +456,7 @@
          *      (--leo)
          */
         if (!b)
-            return string_make_empty(INTERP, enum_stringrep_one, 0);
+            return string_make_empty(INTERP, 0);
 
         nextkey = key_next(INTERP, key);
         valpmc  = (PMC *)b->value;

Modified: branches/strings/src/pmc/string.pmc
==============================================================================
--- branches/strings/src/pmc/string.pmc	(original)
+++ branches/strings/src/pmc/string.pmc	Sat Jan 10 11:07:32 2009
@@ -35,7 +35,7 @@
 */
 
     VTABLE void init() {
-        PMC_str_val(SELF) = string_make_empty(INTERP, enum_stringrep_one, 0);
+        PMC_str_val(SELF) = string_make_empty(INTERP, 0);
         PObj_custom_mark_SET(SELF);
     }
 

Modified: branches/strings/src/pmc/undef.pmc
==============================================================================
--- branches/strings/src/pmc/undef.pmc	(original)
+++ branches/strings/src/pmc/undef.pmc	Sat Jan 10 11:07:32 2009
@@ -148,7 +148,7 @@
 */
 
     VTABLE STRING *get_string() {
-        return string_make_empty(INTERP, enum_stringrep_one, 0);
+        return string_make_empty(INTERP, 0);
     }
 
 /*

Modified: branches/strings/src/pmc_freeze.c
==============================================================================
--- branches/strings/src/pmc_freeze.c	(original)
+++ branches/strings/src/pmc_freeze.c	Sat Jan 10 11:07:32 2009
@@ -1793,7 +1793,7 @@
     else
         len = FREEZE_BYTES_PER_ITEM;
 
-    info->image = string_make_empty(interp, enum_stringrep_one, len);
+    info->image = string_make_empty(interp, len);
 }
 
 /*

Modified: branches/strings/src/spf_render.c
==============================================================================
--- branches/strings/src/spf_render.c	(original)
+++ branches/strings/src/spf_render.c	Sat Jan 10 11:07:32 2009
@@ -329,7 +329,7 @@
     HUGEINTVAL num;
 
     /* start with a buffer; double the pattern length to avoid realloc #1 */
-    STRING *targ = string_make_empty(interp, enum_stringrep_one, pat_len << 1);
+    STRING *targ = string_make_empty(interp, pat_len << 1);
 
     /* ts is used almost universally as an intermediate target;
      * tc is used as a temporary buffer by uint_to_string and

Modified: branches/strings/src/string.c
==============================================================================
--- branches/strings/src/string.c	(original)
+++ branches/strings/src/string.c	Sat Jan 10 11:07:32 2009
@@ -54,8 +54,7 @@
 
 static void make_writable(PARROT_INTERP,
     ARGMOD(STRING **s),
-    const size_t len,
-    parrot_string_representation_t representation)
+    const size_t len)
         __attribute__nonnull__(1)
         __attribute__nonnull__(2)
         FUNC_MODIFIES(*s);
@@ -389,17 +388,11 @@
 PARROT_EXPORT
 PARROT_CANNOT_RETURN_NULL
 STRING *
-string_make_empty(PARROT_INTERP,
-    parrot_string_representation_t representation, UINTVAL capacity)
+string_make_empty(PARROT_INTERP, UINTVAL capacity)
 {
     ASSERT_ARGS(string_make_empty)
     STRING * const s = new_string_header(interp, 0);
 
-    /* TODO adapt string creation functions */
-    if (representation != enum_stringrep_one)
-        Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_INVALID_CHARTYPE,
-            "Unsupported representation");
-
     s->charset  = PARROT_DEFAULT_CHARSET;
     s->encoding = CHARSET_GET_PREFERRED_ENCODING(interp, s);
 
@@ -632,34 +625,6 @@
 
 /*
 
-=item C<const char* string_primary_encoding_for_representation>
-
-Returns the primary encoding for the specified representation.
-
-This is needed for packfile unpacking, unless we just always use UTF-8 or BOCU.
-
-=cut
-
-*/
-
-PARROT_EXPORT
-PARROT_CANNOT_RETURN_NULL
-const char*
-string_primary_encoding_for_representation(PARROT_INTERP,
-    parrot_string_representation_t representation)
-{
-    ASSERT_ARGS(string_primary_encoding_for_representation)
-    if (representation == enum_stringrep_one)
-        return "ascii";
-
-    Parrot_ex_throw_from_c_args(interp, NULL,
-        EXCEPTION_INVALID_STRING_REPRESENTATION,
-        "string_primary_encoding_for_representation: "
-        "invalid string representation");
-}
-
-/*
-
 =item C<STRING * const_string>
 
 Creates and returns a constant Parrot string.
@@ -1153,7 +1118,7 @@
 
         /* Allow regexes to return $' easily for "aaa" =~ /aaa/ */
         if (offset == (INTVAL)string_length(interp, src) || length < 1)
-            return string_make_empty(interp, enum_stringrep_one, 0);
+            return string_make_empty(interp, 0);
 
         if (offset < 0)
             true_offset = (UINTVAL)(src->strlen + offset);
@@ -1527,12 +1492,11 @@
 */
 
 static void
-make_writable(PARROT_INTERP, ARGMOD(STRING **s),
-    const size_t len, parrot_string_representation_t representation)
+make_writable(PARROT_INTERP, ARGMOD(STRING **s), const size_t len)
 {
     ASSERT_ARGS(make_writable)
     if (!*s)
-        *s = string_make_empty(interp, representation, len);
+        *s = string_make_empty(interp, len);
     else if ((*s)->strlen < len)
         string_grow(interp, *s, (UINTVAL)(len - (*s)->strlen));
     else if (PObj_is_cowed_TESTALL(*s))
@@ -1601,7 +1565,7 @@
         Parrot_do_dod_run(interp, GC_trace_stack_FLAG);
 #endif
 
-    make_writable(interp, &res, minlen, enum_stringrep_one);
+    make_writable(interp, &res, minlen);
 
     { /* bitwise AND the strings */
         const Parrot_UInt1 *curr1 = (Parrot_UInt1 *)s1->strstart;
@@ -1753,7 +1717,7 @@
         Parrot_do_dod_run(interp, GC_trace_stack_FLAG);
 #endif
 
-    make_writable(interp, &res, maxlen, enum_stringrep_one);
+    make_writable(interp, &res, maxlen);
 
     BITWISE_OR_STRINGS(Parrot_UInt1, Parrot_UInt1, Parrot_UInt1,
             s1, s2, res, maxlen);
@@ -1828,7 +1792,7 @@
         Parrot_do_dod_run(interp, GC_trace_stack_FLAG);
 #endif
 
-    make_writable(interp, &res, maxlen, enum_stringrep_one);
+    make_writable(interp, &res, maxlen);
 
     BITWISE_XOR_STRINGS(Parrot_UInt1, Parrot_UInt1, Parrot_UInt1,
             s1, s2, res, maxlen);
@@ -1906,7 +1870,7 @@
         Parrot_do_dod_run(interp, GC_trace_stack_FLAG);
 #endif
 
-    make_writable(interp, &res, len, enum_stringrep_one);
+    make_writable(interp, &res, len);
 
     res->strlen = res->bufused = len;
 
@@ -3031,7 +2995,7 @@
         return NULL;
 
     if (!src->strlen)
-        return string_make_empty(interp, enum_stringrep_one, 0);
+        return string_make_empty(interp, 0);
 
     return CHARSET_COMPOSE(interp, src);
 }
@@ -3061,7 +3025,7 @@
     int i;
 
     if (ar_len == 0)
-        return string_make_empty(interp, enum_stringrep_one, 0);
+        return string_make_empty(interp, 0);
 
     s   = VTABLE_get_string_keyed_int(interp, ar, 0);
     res = s ? string_copy(interp, s) : NULL;



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About