[svn:parrot] r47098 - in branches/gsoc_nfg: config/gen/makefiles include/parrot src/string

darbelo at svn.parrot.org darbelo at svn.parrot.org
Fri May 28 20:56:28 UTC 2010


Author: darbelo
Date: Fri May 28 20:56:28 2010
New Revision: 47098
URL: https://trac.parrot.org/parrot/changeset/47098

Log:
Add nfg as an encoding on it's own, separate from ucs-4.

Modified:
   branches/gsoc_nfg/config/gen/makefiles/root.in
   branches/gsoc_nfg/include/parrot/encoding.h
   branches/gsoc_nfg/src/string/api.c
   branches/gsoc_nfg/src/string/charset.c
   branches/gsoc_nfg/src/string/encoding.c

Modified: branches/gsoc_nfg/config/gen/makefiles/root.in
==============================================================================
--- branches/gsoc_nfg/config/gen/makefiles/root.in	Fri May 28 16:52:23 2010	(r47097)
+++ branches/gsoc_nfg/config/gen/makefiles/root.in	Fri May 28 20:56:28 2010	(r47098)
@@ -1505,6 +1505,7 @@
 	src/string/encoding/utf16.h \
 	src/string/encoding/ucs2.h \
 	src/string/encoding/ucs4.h \
+	src/string/encoding/nfg.h \
 	src/string/charset/ascii.h \
 	src/string/charset/binary.h \
 	src/string/charset/iso-8859-1.h \

Modified: branches/gsoc_nfg/include/parrot/encoding.h
==============================================================================
--- branches/gsoc_nfg/include/parrot/encoding.h	Fri May 28 16:52:23 2010	(r47097)
+++ branches/gsoc_nfg/include/parrot/encoding.h	Fri May 28 20:56:28 2010	(r47098)
@@ -57,6 +57,7 @@
 PARROT_DATA ENCODING *Parrot_utf16_encoding_ptr;
 PARROT_DATA ENCODING *Parrot_ucs2_encoding_ptr;
 PARROT_DATA ENCODING *Parrot_ucs4_encoding_ptr;
+PARROT_DATA ENCODING *Parrot_nfg_encoding_ptr;
 PARROT_DATA ENCODING *Parrot_default_encoding_ptr;
 #endif
 

Modified: branches/gsoc_nfg/src/string/api.c
==============================================================================
--- branches/gsoc_nfg/src/string/api.c	Fri May 28 16:52:23 2010	(r47097)
+++ branches/gsoc_nfg/src/string/api.c	Fri May 28 20:56:28 2010	(r47098)
@@ -454,6 +454,9 @@
         if (a->encoding == Parrot_ucs4_encoding_ptr
             || b->encoding == Parrot_ucs4_encoding_ptr)
             enc = Parrot_ucs4_encoding_ptr;
+        else if (a->encoding == Parrot_nfg_encoding_ptr
+            || b->encoding == Parrot_nfg_encoding_ptr)
+            enc = Parrot_ucs4_encoding_ptr;
         else if (a->encoding == Parrot_utf16_encoding_ptr
             ||  b->encoding == Parrot_utf16_encoding_ptr
             ||  a->encoding == Parrot_ucs2_encoding_ptr

Modified: branches/gsoc_nfg/src/string/charset.c
==============================================================================
--- branches/gsoc_nfg/src/string/charset.c	Fri May 28 16:52:23 2010	(r47097)
+++ branches/gsoc_nfg/src/string/charset.c	Fri May 28 20:56:28 2010	(r47098)
@@ -24,6 +24,7 @@
 #include "encoding/utf16.h"
 #include "encoding/ucs2.h"
 #include "encoding/ucs4.h"
+#include "encoding/nfg.h"
 
 #include "charset/ascii.h"
 #include "charset/binary.h"
@@ -499,6 +500,7 @@
     Parrot_encoding_ucs2_init(interp);
     Parrot_encoding_utf16_init(interp);
     Parrot_encoding_ucs4_init(interp);
+    Parrot_encoding_nfg_init(interp);
 
     Parrot_charset_ascii_init(interp);
     Parrot_charset_iso_8859_1_init(interp);

Modified: branches/gsoc_nfg/src/string/encoding.c
==============================================================================
--- branches/gsoc_nfg/src/string/encoding.c	Fri May 28 16:52:23 2010	(r47097)
+++ branches/gsoc_nfg/src/string/encoding.c	Fri May 28 20:56:28 2010	(r47098)
@@ -44,6 +44,7 @@
 ENCODING *Parrot_ucs2_encoding_ptr    = NULL;
 ENCODING *Parrot_utf16_encoding_ptr   = NULL;
 ENCODING *Parrot_ucs4_encoding_ptr    = NULL;
+ENCODING *Parrot_nfg_encoding_ptr     = NULL;
 
 typedef struct One_encoding {
     NOTNULL(ENCODING *encoding);
@@ -363,7 +364,7 @@
 ENCODING *encoding)>
 
 Registers a character encoding C<encoding> with name C<encodingname>.
-Only allows one of 5 possibilities: fixed_8, utf8, utf16, ucs2 and ucs4.
+Allows one of 6 possibilities: fixed_8, utf8, utf16, ucs2, ucs4 and nfg.
 
 =cut
 
@@ -404,6 +405,10 @@
         Parrot_ucs4_encoding_ptr = encoding;
         return register_encoding(interp, encodingname, encoding);
     }
+    if (STREQ("nfg", encodingname)) {
+        Parrot_nfg_encoding_ptr = encoding;
+        return register_encoding(interp, encodingname, encoding);
+    }
     return 0;
 }
 


More information about the parrot-commits mailing list