summaryrefslogtreecommitdiff
path: root/ext/nkf
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-12-03 17:59:23 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-12-03 17:59:23 +0000
commit7c04694fab7c8166c0449fc6846abf45269c0807 (patch)
tree1a6db82860f20bea09d55d17020e521f7d3f5d3f /ext/nkf
parent4de33a3ac4fed2292071e8eaef526297d0d70d00 (diff)
* ext/nkf/nkf.c: add constant NKF::VERSION
* ext/nkf/nkf.c(guess): this becomes an alias of guess2 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@7449 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/nkf')
-rw-r--r--ext/nkf/nkf.c23
1 files changed, 13 insertions, 10 deletions
diff --git a/ext/nkf/nkf.c b/ext/nkf/nkf.c
index 6517b3aba1..65442a130c 100644
--- a/ext/nkf/nkf.c
+++ b/ext/nkf/nkf.c
@@ -1,11 +1,14 @@
/*
* NKF Module for Ruby base on nkf 2.x
*
- * original nkf2.0 is maintained at http://sourceforge.jp/projects/nkf/
+ * original nkf2.x is maintained at http://sourceforge.jp/projects/nkf/
+ *
+ * $Id$
*
*/
-static char *RVersion = "2.0.4.1r1";
+#define RUBY_NKF_REVISION "$Revision$"
+#define RUBY_NKF_VERSION NKF_VERSION " (" NKF_RELEASE_DATE ")"
#include "ruby.h"
@@ -71,6 +74,7 @@ rb_nkf_putchar(c)
/* getchar and putchar will be replaced during inclusion */
#define PERL_XS 1
+#include "nkf-utf8/config.h"
#include "nkf-utf8/utf8tbl.c"
#include "nkf-utf8/nkf.c"
@@ -85,12 +89,7 @@ rb_nkf_kconv(obj, opt, src)
StringValue(opt);
opt_ptr = RSTRING(opt)->ptr;
opt_end = opt_ptr + RSTRING(opt)->len;
- for (; opt_ptr < opt_end; opt_ptr++) {
- if (*opt_ptr != '-') {
- continue;
- }
- options(opt_ptr);
- }
+ options(opt_ptr);
incsize = INCSIZE;
@@ -270,7 +269,7 @@ Init_nkf()
VALUE mKconv = rb_define_module("NKF");
rb_define_module_function(mKconv, "nkf", rb_nkf_kconv, 2);
- rb_define_module_function(mKconv, "guess", rb_nkf_guess1, 1);
+ rb_define_module_function(mKconv, "guess", rb_nkf_guess2, 1);
rb_define_module_function(mKconv, "guess1", rb_nkf_guess1, 1);
rb_define_module_function(mKconv, "guess2", rb_nkf_guess2, 1);
@@ -285,5 +284,9 @@ Init_nkf()
rb_define_const(mKconv, "UTF16", INT2FIX(_UTF16));
rb_define_const(mKconv, "UTF32", INT2FIX(_UTF32));
rb_define_const(mKconv, "UNKNOWN", INT2FIX(_UNKNOWN));
- rb_define_const(mKconv, "VERSION", rb_str_new2(RVersion));
+ rb_define_const(mKconv, "VERSION", rb_str_new2(RUBY_NKF_VERSION));
+ /* for debug */
+ rb_define_const(mKconv, "NKF_VERSION", rb_str_new2(NKF_VERSION));
+ rb_define_const(mKconv, "NKF_RELEASE_DATE", rb_str_new2(NKF_RELEASE_DATE));
+ rb_define_const(mKconv, "REVISION", rb_str_new2(RUBY_NKF_REVISION));
}