Permalink
Browse files

encoding.c: unicode_p

* enc/encdb.c, enc/utf_16_32.h (ENC_DUMMY_UNICODE): endian-less wide
  UTF encodings are dummy but Unicode.
* encoding.c (rb_encdb_set_unicode): set Unicode flag.
* template/encdb.h.tmpl: allow ENC_DUMMY variants.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37101 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information...
1 parent 5d316e7 commit 928d1a5261fc3afcfcdfb267b6b5f0323b81a669 @nobu nobu committed Oct 6, 2012
Showing with 24 additions and 3 deletions.
  1. +11 −0 ChangeLog
  2. +2 −0 enc/encdb.c
  3. +3 −2 enc/utf_16_32.h
  4. +7 −0 encoding.c
  5. +1 −1 template/encdb.h.tmpl
View
@@ -1,3 +1,14 @@
+Sat Oct 6 09:42:04 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * enc/encdb.c, enc/utf_16_32.h (ENC_DUMMY_UNICODE): endian-less wide
+ UTF encodings are dummy but Unicode.
+
+ * encoding.c (rb_encdb_set_unicode): set Unicode flag.
+
+ * template/encdb.h.tmpl: allow ENC_DUMMY variants.
+
+ * encoding.c (rb_enc_unicode_p): oniguruma provides Unicode flag.
+
Fri Oct 5 17:18:42 JST 2012 TAKANO Mitsuhiro <tak@no32.tk>
* template/Doxyfile.tmpl: remove SHOW_DIRECTORIES and
View
@@ -14,11 +14,13 @@ int rb_encdb_alias(const char *alias, const char *orig);
int rb_encdb_dummy(const char *name);
void rb_encdb_declare(const char *name);
void rb_enc_set_base(const char *name, const char *orig);
+void rb_encdb_set_unicode(int index);
#define ENC_REPLICATE(name, orig) rb_encdb_replicate((name), (orig))
#define ENC_ALIAS(name, orig) rb_encdb_alias((name), (orig))
#define ENC_DUMMY(name) rb_encdb_dummy(name)
#define ENC_DEFINE(name) rb_encdb_declare(name)
#define ENC_SET_BASE(name, orig) rb_enc_set_base((name), (orig))
+#define ENC_DUMMY_UNICODE(name) rb_encdb_set_unicode(ENC_DUMMY(name))
void
Init_encdb(void)
View
@@ -1,4 +1,5 @@
#include "regenc.h"
/* dummy for unsupported, statefull encoding */
-ENC_DUMMY("UTF-16");
-ENC_DUMMY("UTF-32");
+#define ENC_DUMMY_UNICODE(name) ENC_DUMMY(name)
+ENC_DUMMY_UNICODE("UTF-16");
+ENC_DUMMY_UNICODE("UTF-32");
View
@@ -32,6 +32,7 @@ void rb_encdb_declare(const char *name);
int rb_encdb_replicate(const char *name, const char *orig);
int rb_encdb_dummy(const char *name);
int rb_encdb_alias(const char *alias, const char *orig);
+void rb_encdb_set_unicode(int index);
#pragma GCC visibility pop
#endif
@@ -512,6 +513,12 @@ rb_encdb_alias(const char *alias, const char *orig)
return enc_alias(alias, idx);
}
+void
+rb_encdb_set_unicode(int index)
+{
+ rb_enc_from_index(index)->flags |= ONIGENC_FLAG_UNICODE;
+}
+
enum {
ENCINDEX_ASCII,
ENCINDEX_UTF_8,
View
@@ -61,7 +61,7 @@ encdirs.each do |encdir|
raise ArgumentError,
'%s:%d: ENC_ALIAS: %s is not defined yet. (alias %s)' %
[fn, $., $2, $1] unless defs[$2.upcase]
- when /^ENC_DUMMY\(\s*"([^"]+)"/
+ when /^ENC_DUMMY\w*\(\s*"([^"]+)"/
count += 1
else
next

0 comments on commit 928d1a5

Please sign in to comment.