2004-10-29 10:51:33 +04:00
|
|
|
/*
|
2006-03-27 17:48:21 +04:00
|
|
|
* NKF - Ruby extension for Network Kanji Filter
|
2004-10-29 10:51:33 +04:00
|
|
|
*
|
2006-03-27 17:48:21 +04:00
|
|
|
* original nkf2.x is maintained at http://sourceforge.jp/projects/nkf/
|
2004-11-09 16:24:07 +03:00
|
|
|
*
|
2006-03-27 17:48:21 +04:00
|
|
|
* $Id$
|
2004-10-29 10:51:33 +04:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2004-11-09 16:24:07 +03:00
|
|
|
#define RUBY_NKF_REVISION "$Revision$"
|
2004-12-02 00:09:02 +03:00
|
|
|
#define RUBY_NKF_VERSION NKF_VERSION " (" NKF_RELEASE_DATE ")"
|
2023-05-25 12:11:17 +03:00
|
|
|
#define NKF_GEM_VERSION "0.1.3"
|
2004-10-29 10:51:33 +04:00
|
|
|
|
2007-12-19 07:29:22 +03:00
|
|
|
#include "ruby/ruby.h"
|
|
|
|
#include "ruby/encoding.h"
|
1999-08-13 09:37:52 +04:00
|
|
|
|
2004-10-29 10:51:33 +04:00
|
|
|
/* Replace nkf's getchar/putchar for variable modification */
|
|
|
|
/* we never use getc, ungetc */
|
|
|
|
|
1999-08-13 09:37:52 +04:00
|
|
|
#undef getc
|
|
|
|
#undef ungetc
|
2004-10-29 10:51:33 +04:00
|
|
|
#define getc(f) (input_ctr>=i_len?-1:input[input_ctr++])
|
|
|
|
#define ungetc(c,f) input_ctr--
|
1999-08-13 09:37:52 +04:00
|
|
|
|
2004-10-29 10:51:33 +04:00
|
|
|
#define INCSIZE 32
|
1999-08-13 09:37:52 +04:00
|
|
|
#undef putchar
|
2004-10-29 10:51:33 +04:00
|
|
|
#undef TRUE
|
|
|
|
#undef FALSE
|
|
|
|
#define putchar(c) rb_nkf_putchar(c)
|
1999-08-13 09:37:52 +04:00
|
|
|
|
2004-10-29 10:51:33 +04:00
|
|
|
/* Input/Output pointers */
|
1999-08-13 09:37:52 +04:00
|
|
|
|
2004-10-29 10:51:33 +04:00
|
|
|
static unsigned char *output;
|
|
|
|
static unsigned char *input;
|
|
|
|
static int input_ctr;
|
|
|
|
static int i_len;
|
|
|
|
static int output_ctr;
|
|
|
|
static int o_len;
|
|
|
|
static int incsize;
|
1999-08-13 09:37:52 +04:00
|
|
|
|
2004-10-29 10:51:33 +04:00
|
|
|
static VALUE result;
|
1999-08-13 09:37:52 +04:00
|
|
|
|
|
|
|
static int
|
* sprintf.c (rb_str_format): allow %c to print one character
string (e.g. ?x).
* lib/tempfile.rb (Tempfile::make_tmpname): put dot between
basename and pid. [ruby-talk:196272]
* parse.y (do_block): remove -> style block.
* parse.y (parser_yylex): remove tLAMBDA_ARG.
* eval.c (rb_call0): binding for the return event hook should have
consistent scope. [ruby-core:07928]
* eval.c (proc_invoke): return behavior should depend whether it
is surrounded by a lambda or a mere block.
* eval.c (formal_assign): handles post splat arguments.
* eval.c (rb_call0): ditto.
* st.c (strhash): use FNV-1a hash.
* parse.y (parser_yylex): removed experimental ';;' terminator.
* eval.c (rb_node_arity): should be aware of post splat arguments.
* eval.c (rb_proc_arity): ditto.
* parse.y (f_args): syntax rule enhanced to support arguments
after the splat.
* parse.y (block_param): ditto for block parameters.
* parse.y (f_post_arg): mandatory formal arguments after the splat
argument.
* parse.y (new_args_gen): generate nodes for mandatory formal
arguments after the splat argument.
* eval.c (rb_eval): dispatch mandatory formal arguments after the
splat argument.
* parse.y (args): allow more than one splat in the argument list.
* parse.y (method_call): allow aref [] to accept all kind of
method argument, including assocs, splat, and block argument.
* eval.c (SETUP_ARGS0): prepare block argument as well.
* lib/mathn.rb (Integer): remove Integer#gcd2. [ruby-core:07931]
* eval.c (error_line): print receivers true/false/nil specially.
* eval.c (rb_proc_yield): handles parameters in yield semantics.
* eval.c (nil_yield): gives LocalJumpError to denote no block
error.
* io.c (rb_io_getc): now takes one-character string.
* string.c (rb_str_hash): use FNV-1a hash from Fowler/Noll/Vo
hashing algorithm.
* string.c (rb_str_aref): str[0] now returns 1 character string,
instead of a fixnum. [Ruby2]
* parse.y (parser_yylex): ?c now returns 1 character string,
instead of a fixnum. [Ruby2]
* string.c (rb_str_aset): no longer support fixnum insertion.
* eval.c (umethod_bind): should not update original class.
[ruby-dev:28636]
* eval.c (ev_const_get): should support constant access from
within instance_eval(). [ruby-dev:28327]
* time.c (time_timeval): should round for usec floating
number. [ruby-core:07896]
* time.c (time_add): ditto.
* dir.c (sys_warning): should not call a vararg function
rb_sys_warning() indirectly. [ruby-core:07886]
* numeric.c (flo_divmod): the first element of Float#divmod should
be an integer. [ruby-dev:28589]
* test/ruby/test_float.rb: add tests for divmod, div, modulo and remainder.
* re.c (rb_reg_initialize): should not allow modifying literal
regexps. frozen check moved from rb_reg_initialize_m as well.
* re.c (rb_reg_initialize): should not modify untainted objects in
safe levels higher than 3.
* re.c (rb_memcmp): type change from char* to const void*.
* dir.c (dir_close): should not close untainted dir stream.
* dir.c (GetDIR): add tainted/frozen check for each dir operation.
* lib/rdoc/parsers/parse_rb.rb (RDoc::RubyParser::parse_symbol_arg):
typo fixed. a patch from Florian Gross <florg at florg.net>.
* eval.c (EXEC_EVENT_HOOK): trace_func may remove itself from
event_hooks. no guarantee for arbitrary hook deletion.
[ruby-dev:28632]
* util.c (ruby_strtod): differ addition to minimize error.
[ruby-dev:28619]
* util.c (ruby_strtod): should not raise ERANGE when the input
string does not have any digits. [ruby-dev:28629]
* eval.c (proc_invoke): should restore old ruby_frame->block.
thanks to ts <decoux at moulon.inra.fr>. [ruby-core:07833]
also fix [ruby-dev:28614] as well.
* signal.c (trap): sig should be less then NSIG. Coverity found
this bug. a patch from Kevin Tew <tewk at tewk.com>.
[ruby-core:07823]
* math.c (math_log2): add new method inspired by
[ruby-talk:191237].
* math.c (math_log): add optional base argument to Math::log().
[ruby-talk:191308]
* ext/syck/emitter.c (syck_scan_scalar): avoid accessing
uninitialized array element. a patch from Pat Eyler
<rubypate at gmail.com>. [ruby-core:07809]
* array.c (rb_ary_fill): initialize local variables first. a
patch from Pat Eyler <rubypate at gmail.com>. [ruby-core:07810]
* ext/syck/yaml2byte.c (syck_yaml2byte_handler): need to free
type_tag. a patch from Pat Eyler <rubypate at gmail.com>.
[ruby-core:07808]
* ext/socket/socket.c (make_hostent_internal): accept ai_family
check from Sam Roberts <sroberts at uniserve.com>.
[ruby-core:07691]
* util.c (ruby_strtod): should not cut off 18 digits for no
reason. [ruby-core:07796]
* array.c (rb_ary_fill): internalize local variable "beg" to
pacify Coverity. [ruby-core:07770]
* pack.c (pack_unpack): now supports CRLF newlines. a patch from
<tommy at tmtm.org>. [ruby-dev:28601]
* applied code clean-up patch from Stefan Huehner
<stefan at huehner.org>. [ruby-core:07764]
* lib/jcode.rb (String::tr_s): should have translated non
squeezing character sequence (i.e. a character) as well. thanks
to Hiroshi Ichikawa <gimite at gimite.ddo.jp> [ruby-list:42090]
* ext/socket/socket.c: document update patch from Sam Roberts
<sroberts at uniserve.com>. [ruby-core:07701]
* lib/mathn.rb (Integer): need not to remove gcd2. a patch from
NARUSE, Yui <naruse at airemix.com>. [ruby-dev:28570]
* parse.y (arg): too much NEW_LIST()
* eval.c (SETUP_ARGS0): remove unnecessary access to nd_alen.
* eval.c (rb_eval): use ARGSCAT for NODE_OP_ASGN1.
[ruby-dev:28585]
* parse.y (arg): use NODE_ARGSCAT for placeholder.
* lib/getoptlong.rb (GetoptLong::get): RDoc update patch from
mathew <meta at pobox.com>. [ruby-core:07738]
* variable.c (rb_const_set): raise error when no target klass is
supplied. [ruby-dev:28582]
* prec.c (prec_prec_f): documentation patch from
<gerardo.santana at gmail.com>. [ruby-core:07689]
* bignum.c (rb_big_pow): second operand may be too big even if
it's a Fixnum. [ruby-talk:187984]
* README.EXT: update symbol description. [ruby-talk:188104]
* COPYING: explicitly note GPLv2. [ruby-talk:187922]
* parse.y: remove some obsolete syntax rules (unparenthesized
method calls in argument list).
* eval.c (rb_call0): insecure calling should be checked for non
NODE_SCOPE method invocations too.
* eval.c (rb_alias): should preserve the current safe level as
well as method definition.
* process.c (rb_f_sleep): remove RDoc description about SIGALRM
which is not valid on the current implementation. [ruby-dev:28464]
Thu Mar 23 21:40:47 2006 K.Kosako <sndgk393 AT ybb.ne.jp>
* eval.c (method_missing): should support argument splat in
super. a bug in combination of super, splat and
method_missing. [ruby-talk:185438]
* configure.in: Solaris SunPro compiler -rapth patch from
<kuwa at labs.fujitsu.com>. [ruby-dev:28443]
* configure.in: remove enable_rpath=no for Solaris.
[ruby-dev:28440]
* ext/win32ole/win32ole.c (ole_val2olevariantdata): change behavior
of converting OLE Variant object with VT_ARRAY|VT_UI1 and Ruby
String object.
* ruby.1: a clarification patch from David Lutterkort
<dlutter at redhat.com>. [ruby-core:7508]
* lib/rdoc/ri/ri_paths.rb (RI::Paths): adding paths from rubygems
directories. a patch from Eric Hodel <drbrain at segment7.net>.
[ruby-core:07423]
* eval.c (rb_clear_cache_by_class): clearing wrong cache.
* ext/extmk.rb: use :remove_destination to install extension libraries
to avoid SEGV. [ruby-dev:28417]
* eval.c (rb_thread_fd_writable): should not re-schedule output
from KILLED thread (must be error printing).
* array.c (rb_ary_flatten_bang): allow specifying recursion
level. [ruby-talk:182170]
* array.c (rb_ary_flatten): ditto.
* gc.c (add_heap): a heap_slots may overflow. a patch from Stefan
Weil <weil at mail.berlios.de>.
* eval.c (rb_call): use separate cache for fcall/vcall
invocation.
* eval.c (rb_eval): NODE_FCALL, NODE_VCALL can call local
functions.
* eval.c (rb_mod_local): a new method to specify newly added
visibility "local".
* eval.c (search_method): search for local methods which are
visible only from the current class.
* class.c (rb_class_local_methods): a method to list local methods.
* object.c (Init_Object): add BasicObject class as a top level
BlankSlate class.
* ruby.h (SYM2ID): should not cast to signed long.
[ruby-core:07414]
* class.c (rb_include_module): allow module duplication.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10235 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-06-10 01:20:17 +04:00
|
|
|
rb_nkf_putchar(unsigned int c)
|
1999-08-13 09:37:52 +04:00
|
|
|
{
|
|
|
|
if (output_ctr >= o_len) {
|
|
|
|
o_len += incsize;
|
2004-10-29 10:51:33 +04:00
|
|
|
rb_str_resize(result, o_len);
|
1999-08-13 09:37:52 +04:00
|
|
|
incsize *= 2;
|
2007-02-27 13:35:17 +03:00
|
|
|
output = (unsigned char *)RSTRING_PTR(result);
|
1999-08-13 09:37:52 +04:00
|
|
|
}
|
|
|
|
output[output_ctr++] = c;
|
1999-10-18 13:03:16 +04:00
|
|
|
|
1999-08-13 09:37:52 +04:00
|
|
|
return c;
|
|
|
|
}
|
|
|
|
|
2004-10-29 10:51:33 +04:00
|
|
|
/* Include kanji filter main part */
|
|
|
|
/* getchar and putchar will be replaced during inclusion */
|
|
|
|
|
1999-08-13 09:37:52 +04:00
|
|
|
#define PERL_XS 1
|
2004-11-09 16:24:07 +03:00
|
|
|
#include "nkf-utf8/config.h"
|
2004-10-29 10:51:33 +04:00
|
|
|
#include "nkf-utf8/utf8tbl.c"
|
|
|
|
#include "nkf-utf8/nkf.c"
|
1999-08-13 09:37:52 +04:00
|
|
|
|
2007-12-19 13:19:38 +03:00
|
|
|
rb_encoding* rb_nkf_enc_get(const char *name)
|
|
|
|
{
|
|
|
|
int idx = rb_enc_find_index(name);
|
2007-12-22 11:36:30 +03:00
|
|
|
if (idx < 0) {
|
|
|
|
nkf_encoding *nkf_enc = nkf_enc_find(name);
|
2008-01-01 18:22:25 +03:00
|
|
|
idx = rb_enc_find_index(nkf_enc_name(nkf_enc_to_base_encoding(nkf_enc)));
|
2007-12-22 11:36:30 +03:00
|
|
|
if (idx < 0) {
|
2007-12-23 12:37:51 +03:00
|
|
|
idx = rb_define_dummy_encoding(name);
|
2007-12-22 11:36:30 +03:00
|
|
|
}
|
|
|
|
}
|
2007-12-19 13:19:38 +03:00
|
|
|
return rb_enc_from_index(idx);
|
|
|
|
}
|
|
|
|
|
* sprintf.c (rb_str_format): allow %c to print one character
string (e.g. ?x).
* lib/tempfile.rb (Tempfile::make_tmpname): put dot between
basename and pid. [ruby-talk:196272]
* parse.y (do_block): remove -> style block.
* parse.y (parser_yylex): remove tLAMBDA_ARG.
* eval.c (rb_call0): binding for the return event hook should have
consistent scope. [ruby-core:07928]
* eval.c (proc_invoke): return behavior should depend whether it
is surrounded by a lambda or a mere block.
* eval.c (formal_assign): handles post splat arguments.
* eval.c (rb_call0): ditto.
* st.c (strhash): use FNV-1a hash.
* parse.y (parser_yylex): removed experimental ';;' terminator.
* eval.c (rb_node_arity): should be aware of post splat arguments.
* eval.c (rb_proc_arity): ditto.
* parse.y (f_args): syntax rule enhanced to support arguments
after the splat.
* parse.y (block_param): ditto for block parameters.
* parse.y (f_post_arg): mandatory formal arguments after the splat
argument.
* parse.y (new_args_gen): generate nodes for mandatory formal
arguments after the splat argument.
* eval.c (rb_eval): dispatch mandatory formal arguments after the
splat argument.
* parse.y (args): allow more than one splat in the argument list.
* parse.y (method_call): allow aref [] to accept all kind of
method argument, including assocs, splat, and block argument.
* eval.c (SETUP_ARGS0): prepare block argument as well.
* lib/mathn.rb (Integer): remove Integer#gcd2. [ruby-core:07931]
* eval.c (error_line): print receivers true/false/nil specially.
* eval.c (rb_proc_yield): handles parameters in yield semantics.
* eval.c (nil_yield): gives LocalJumpError to denote no block
error.
* io.c (rb_io_getc): now takes one-character string.
* string.c (rb_str_hash): use FNV-1a hash from Fowler/Noll/Vo
hashing algorithm.
* string.c (rb_str_aref): str[0] now returns 1 character string,
instead of a fixnum. [Ruby2]
* parse.y (parser_yylex): ?c now returns 1 character string,
instead of a fixnum. [Ruby2]
* string.c (rb_str_aset): no longer support fixnum insertion.
* eval.c (umethod_bind): should not update original class.
[ruby-dev:28636]
* eval.c (ev_const_get): should support constant access from
within instance_eval(). [ruby-dev:28327]
* time.c (time_timeval): should round for usec floating
number. [ruby-core:07896]
* time.c (time_add): ditto.
* dir.c (sys_warning): should not call a vararg function
rb_sys_warning() indirectly. [ruby-core:07886]
* numeric.c (flo_divmod): the first element of Float#divmod should
be an integer. [ruby-dev:28589]
* test/ruby/test_float.rb: add tests for divmod, div, modulo and remainder.
* re.c (rb_reg_initialize): should not allow modifying literal
regexps. frozen check moved from rb_reg_initialize_m as well.
* re.c (rb_reg_initialize): should not modify untainted objects in
safe levels higher than 3.
* re.c (rb_memcmp): type change from char* to const void*.
* dir.c (dir_close): should not close untainted dir stream.
* dir.c (GetDIR): add tainted/frozen check for each dir operation.
* lib/rdoc/parsers/parse_rb.rb (RDoc::RubyParser::parse_symbol_arg):
typo fixed. a patch from Florian Gross <florg at florg.net>.
* eval.c (EXEC_EVENT_HOOK): trace_func may remove itself from
event_hooks. no guarantee for arbitrary hook deletion.
[ruby-dev:28632]
* util.c (ruby_strtod): differ addition to minimize error.
[ruby-dev:28619]
* util.c (ruby_strtod): should not raise ERANGE when the input
string does not have any digits. [ruby-dev:28629]
* eval.c (proc_invoke): should restore old ruby_frame->block.
thanks to ts <decoux at moulon.inra.fr>. [ruby-core:07833]
also fix [ruby-dev:28614] as well.
* signal.c (trap): sig should be less then NSIG. Coverity found
this bug. a patch from Kevin Tew <tewk at tewk.com>.
[ruby-core:07823]
* math.c (math_log2): add new method inspired by
[ruby-talk:191237].
* math.c (math_log): add optional base argument to Math::log().
[ruby-talk:191308]
* ext/syck/emitter.c (syck_scan_scalar): avoid accessing
uninitialized array element. a patch from Pat Eyler
<rubypate at gmail.com>. [ruby-core:07809]
* array.c (rb_ary_fill): initialize local variables first. a
patch from Pat Eyler <rubypate at gmail.com>. [ruby-core:07810]
* ext/syck/yaml2byte.c (syck_yaml2byte_handler): need to free
type_tag. a patch from Pat Eyler <rubypate at gmail.com>.
[ruby-core:07808]
* ext/socket/socket.c (make_hostent_internal): accept ai_family
check from Sam Roberts <sroberts at uniserve.com>.
[ruby-core:07691]
* util.c (ruby_strtod): should not cut off 18 digits for no
reason. [ruby-core:07796]
* array.c (rb_ary_fill): internalize local variable "beg" to
pacify Coverity. [ruby-core:07770]
* pack.c (pack_unpack): now supports CRLF newlines. a patch from
<tommy at tmtm.org>. [ruby-dev:28601]
* applied code clean-up patch from Stefan Huehner
<stefan at huehner.org>. [ruby-core:07764]
* lib/jcode.rb (String::tr_s): should have translated non
squeezing character sequence (i.e. a character) as well. thanks
to Hiroshi Ichikawa <gimite at gimite.ddo.jp> [ruby-list:42090]
* ext/socket/socket.c: document update patch from Sam Roberts
<sroberts at uniserve.com>. [ruby-core:07701]
* lib/mathn.rb (Integer): need not to remove gcd2. a patch from
NARUSE, Yui <naruse at airemix.com>. [ruby-dev:28570]
* parse.y (arg): too much NEW_LIST()
* eval.c (SETUP_ARGS0): remove unnecessary access to nd_alen.
* eval.c (rb_eval): use ARGSCAT for NODE_OP_ASGN1.
[ruby-dev:28585]
* parse.y (arg): use NODE_ARGSCAT for placeholder.
* lib/getoptlong.rb (GetoptLong::get): RDoc update patch from
mathew <meta at pobox.com>. [ruby-core:07738]
* variable.c (rb_const_set): raise error when no target klass is
supplied. [ruby-dev:28582]
* prec.c (prec_prec_f): documentation patch from
<gerardo.santana at gmail.com>. [ruby-core:07689]
* bignum.c (rb_big_pow): second operand may be too big even if
it's a Fixnum. [ruby-talk:187984]
* README.EXT: update symbol description. [ruby-talk:188104]
* COPYING: explicitly note GPLv2. [ruby-talk:187922]
* parse.y: remove some obsolete syntax rules (unparenthesized
method calls in argument list).
* eval.c (rb_call0): insecure calling should be checked for non
NODE_SCOPE method invocations too.
* eval.c (rb_alias): should preserve the current safe level as
well as method definition.
* process.c (rb_f_sleep): remove RDoc description about SIGALRM
which is not valid on the current implementation. [ruby-dev:28464]
Thu Mar 23 21:40:47 2006 K.Kosako <sndgk393 AT ybb.ne.jp>
* eval.c (method_missing): should support argument splat in
super. a bug in combination of super, splat and
method_missing. [ruby-talk:185438]
* configure.in: Solaris SunPro compiler -rapth patch from
<kuwa at labs.fujitsu.com>. [ruby-dev:28443]
* configure.in: remove enable_rpath=no for Solaris.
[ruby-dev:28440]
* ext/win32ole/win32ole.c (ole_val2olevariantdata): change behavior
of converting OLE Variant object with VT_ARRAY|VT_UI1 and Ruby
String object.
* ruby.1: a clarification patch from David Lutterkort
<dlutter at redhat.com>. [ruby-core:7508]
* lib/rdoc/ri/ri_paths.rb (RI::Paths): adding paths from rubygems
directories. a patch from Eric Hodel <drbrain at segment7.net>.
[ruby-core:07423]
* eval.c (rb_clear_cache_by_class): clearing wrong cache.
* ext/extmk.rb: use :remove_destination to install extension libraries
to avoid SEGV. [ruby-dev:28417]
* eval.c (rb_thread_fd_writable): should not re-schedule output
from KILLED thread (must be error printing).
* array.c (rb_ary_flatten_bang): allow specifying recursion
level. [ruby-talk:182170]
* array.c (rb_ary_flatten): ditto.
* gc.c (add_heap): a heap_slots may overflow. a patch from Stefan
Weil <weil at mail.berlios.de>.
* eval.c (rb_call): use separate cache for fcall/vcall
invocation.
* eval.c (rb_eval): NODE_FCALL, NODE_VCALL can call local
functions.
* eval.c (rb_mod_local): a new method to specify newly added
visibility "local".
* eval.c (search_method): search for local methods which are
visible only from the current class.
* class.c (rb_class_local_methods): a method to list local methods.
* object.c (Init_Object): add BasicObject class as a top level
BlankSlate class.
* ruby.h (SYM2ID): should not cast to signed long.
[ruby-core:07414]
* class.c (rb_include_module): allow module duplication.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10235 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-06-10 01:20:17 +04:00
|
|
|
int nkf_split_options(const char *arg)
|
2006-03-27 17:48:21 +04:00
|
|
|
{
|
|
|
|
int count = 0;
|
2008-04-22 16:20:36 +04:00
|
|
|
unsigned char option[256];
|
2006-03-27 17:48:21 +04:00
|
|
|
int i = 0, j = 0;
|
|
|
|
int is_escaped = FALSE;
|
|
|
|
int is_single_quoted = FALSE;
|
|
|
|
int is_double_quoted = FALSE;
|
|
|
|
for(i = 0; arg[i]; i++){
|
|
|
|
if(j == 255){
|
|
|
|
return -1;
|
|
|
|
}else if(is_single_quoted){
|
|
|
|
if(arg[i] == '\''){
|
|
|
|
is_single_quoted = FALSE;
|
|
|
|
}else{
|
|
|
|
option[j++] = arg[i];
|
|
|
|
}
|
|
|
|
}else if(is_escaped){
|
|
|
|
is_escaped = FALSE;
|
|
|
|
option[j++] = arg[i];
|
|
|
|
}else if(arg[i] == '\\'){
|
|
|
|
is_escaped = TRUE;
|
|
|
|
}else if(is_double_quoted){
|
|
|
|
if(arg[i] == '"'){
|
|
|
|
is_double_quoted = FALSE;
|
|
|
|
}else{
|
|
|
|
option[j++] = arg[i];
|
|
|
|
}
|
|
|
|
}else if(arg[i] == '\''){
|
|
|
|
is_single_quoted = TRUE;
|
|
|
|
}else if(arg[i] == '"'){
|
|
|
|
is_double_quoted = TRUE;
|
|
|
|
}else if(arg[i] == ' '){
|
|
|
|
option[j] = '\0';
|
|
|
|
options(option);
|
|
|
|
j = 0;
|
|
|
|
}else{
|
|
|
|
option[j++] = arg[i];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(j){
|
|
|
|
option[j] = '\0';
|
|
|
|
options(option);
|
|
|
|
}
|
|
|
|
return count;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* call-seq:
|
2008-01-01 18:22:25 +03:00
|
|
|
* NKF.nkf(opt, str) => string
|
2006-03-27 17:48:21 +04:00
|
|
|
*
|
|
|
|
* Convert _str_ and return converted result.
|
|
|
|
* Conversion details are specified by _opt_ as String.
|
|
|
|
*
|
|
|
|
* require 'nkf'
|
|
|
|
* output = NKF.nkf("-s", input)
|
|
|
|
*/
|
|
|
|
|
1999-08-13 09:37:52 +04:00
|
|
|
static VALUE
|
2007-12-19 07:29:22 +03:00
|
|
|
rb_nkf_convert(VALUE obj, VALUE opt, VALUE src)
|
1999-08-13 09:37:52 +04:00
|
|
|
{
|
2012-09-14 20:07:49 +04:00
|
|
|
VALUE tmp;
|
2007-12-19 07:29:22 +03:00
|
|
|
reinit();
|
2017-09-30 11:35:23 +03:00
|
|
|
nkf_split_options(StringValueCStr(opt));
|
2008-01-27 10:43:31 +03:00
|
|
|
if (!output_encoding) rb_raise(rb_eArgError, "no output encoding given");
|
2007-12-19 07:29:22 +03:00
|
|
|
|
2008-05-20 17:10:28 +04:00
|
|
|
switch (nkf_enc_to_index(output_encoding)) {
|
|
|
|
case UTF_8_BOM: output_encoding = nkf_enc_from_index(UTF_8); break;
|
|
|
|
case UTF_16BE_BOM: output_encoding = nkf_enc_from_index(UTF_16BE); break;
|
|
|
|
case UTF_16LE_BOM: output_encoding = nkf_enc_from_index(UTF_16LE); break;
|
|
|
|
case UTF_32BE_BOM: output_encoding = nkf_enc_from_index(UTF_32BE); break;
|
|
|
|
case UTF_32LE_BOM: output_encoding = nkf_enc_from_index(UTF_32LE); break;
|
|
|
|
}
|
|
|
|
output_bom_f = FALSE;
|
|
|
|
|
2007-12-19 07:29:22 +03:00
|
|
|
incsize = INCSIZE;
|
|
|
|
|
|
|
|
input_ctr = 0;
|
2017-09-30 11:35:23 +03:00
|
|
|
input = (unsigned char *)StringValuePtr(src);
|
2010-05-21 14:11:44 +04:00
|
|
|
i_len = RSTRING_LENINT(src);
|
2012-09-14 20:07:49 +04:00
|
|
|
tmp = rb_str_new(0, i_len*3 + 10);
|
2007-12-19 07:29:22 +03:00
|
|
|
|
|
|
|
output_ctr = 0;
|
2012-09-14 20:07:49 +04:00
|
|
|
output = (unsigned char *)RSTRING_PTR(tmp);
|
|
|
|
o_len = RSTRING_LENINT(tmp);
|
2007-12-19 07:29:22 +03:00
|
|
|
*output = '\0';
|
|
|
|
|
2012-09-14 20:07:49 +04:00
|
|
|
/* use _result_ begin*/
|
|
|
|
result = tmp;
|
2007-12-19 07:29:22 +03:00
|
|
|
kanji_convert(NULL);
|
2012-09-14 20:07:49 +04:00
|
|
|
result = Qnil;
|
|
|
|
/* use _result_ end */
|
|
|
|
|
|
|
|
rb_str_set_len(tmp, output_ctr);
|
2007-12-19 13:19:38 +03:00
|
|
|
|
2008-07-24 23:14:47 +04:00
|
|
|
if (mimeout_f)
|
2012-09-14 20:07:49 +04:00
|
|
|
rb_enc_associate(tmp, rb_usascii_encoding());
|
2008-07-24 23:14:47 +04:00
|
|
|
else
|
2012-09-14 20:07:49 +04:00
|
|
|
rb_enc_associate(tmp, rb_nkf_enc_get(nkf_enc_name(output_encoding)));
|
2007-12-19 13:19:38 +03:00
|
|
|
|
2012-09-14 20:07:49 +04:00
|
|
|
return tmp;
|
1999-08-13 09:37:52 +04:00
|
|
|
}
|
|
|
|
|
2004-10-29 10:51:33 +04:00
|
|
|
|
1999-08-13 09:37:52 +04:00
|
|
|
/*
|
2006-03-27 17:48:21 +04:00
|
|
|
* call-seq:
|
2008-01-01 18:22:25 +03:00
|
|
|
* NKF.guess(str) => encoding
|
2007-12-19 07:29:22 +03:00
|
|
|
*
|
|
|
|
* Returns guessed encoding of _str_ by nkf routine.
|
|
|
|
*
|
1999-08-13 09:37:52 +04:00
|
|
|
*/
|
|
|
|
|
|
|
|
static VALUE
|
2007-12-19 07:29:22 +03:00
|
|
|
rb_nkf_guess(VALUE obj, VALUE src)
|
1999-08-13 09:37:52 +04:00
|
|
|
{
|
2007-12-19 07:29:22 +03:00
|
|
|
reinit();
|
2004-10-29 10:51:33 +04:00
|
|
|
|
2007-12-19 07:29:22 +03:00
|
|
|
input_ctr = 0;
|
2017-09-30 11:35:23 +03:00
|
|
|
input = (unsigned char *)StringValuePtr(src);
|
2010-05-21 14:11:44 +04:00
|
|
|
i_len = RSTRING_LENINT(src);
|
2004-10-29 10:51:33 +04:00
|
|
|
|
2007-12-19 07:29:22 +03:00
|
|
|
guess_f = TRUE;
|
|
|
|
kanji_convert( NULL );
|
|
|
|
guess_f = FALSE;
|
2004-10-29 10:51:33 +04:00
|
|
|
|
2007-12-19 13:19:38 +03:00
|
|
|
return rb_enc_from_encoding(rb_nkf_enc_get(get_guessed_code()));
|
2004-10-29 10:51:33 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-03-27 17:48:21 +04:00
|
|
|
/*
|
2010-04-22 12:04:13 +04:00
|
|
|
* NKF - Ruby extension for Network Kanji Filter
|
2006-03-27 17:48:21 +04:00
|
|
|
*
|
|
|
|
* == Description
|
|
|
|
*
|
2007-10-03 18:39:54 +04:00
|
|
|
* This is a Ruby Extension version of nkf (Network Kanji Filter).
|
|
|
|
* It converts the first argument and returns converted result. Conversion
|
2006-03-27 17:48:21 +04:00
|
|
|
* details are specified by flags as the first argument.
|
|
|
|
*
|
|
|
|
* *Nkf* is a yet another kanji code converter among networks, hosts and terminals.
|
|
|
|
* It converts input kanji code to designated kanji code
|
|
|
|
* such as ISO-2022-JP, Shift_JIS, EUC-JP, UTF-8 or UTF-16.
|
|
|
|
*
|
|
|
|
* One of the most unique faculty of *nkf* is the guess of the input kanji encodings.
|
|
|
|
* It currently recognizes ISO-2022-JP, Shift_JIS, EUC-JP, UTF-8 and UTF-16.
|
|
|
|
* So users needn't set the input kanji code explicitly.
|
|
|
|
*
|
|
|
|
* By default, X0201 kana is converted into X0208 kana.
|
|
|
|
* For X0201 kana, SO/SI, SSO and ESC-(-I methods are supported.
|
|
|
|
* For automatic code detection, nkf assumes no X0201 kana in Shift_JIS.
|
|
|
|
* To accept X0201 in Shift_JIS, use <b>-X</b>, <b>-x</b> or <b>-S</b>.
|
|
|
|
*
|
|
|
|
* == Flags
|
|
|
|
*
|
|
|
|
* === -b -u
|
|
|
|
*
|
|
|
|
* Output is buffered (DEFAULT), Output is unbuffered.
|
|
|
|
*
|
2006-09-15 15:26:07 +04:00
|
|
|
* === -j -s -e -w -w16 -w32
|
2006-03-27 17:48:21 +04:00
|
|
|
*
|
|
|
|
* Output code is ISO-2022-JP (7bit JIS), Shift_JIS, EUC-JP,
|
2006-09-15 15:26:07 +04:00
|
|
|
* UTF-8N, UTF-16BE, UTF-32BE.
|
2006-03-27 17:48:21 +04:00
|
|
|
* Without this option and compile option, ISO-2022-JP is assumed.
|
|
|
|
*
|
2006-09-15 15:26:07 +04:00
|
|
|
* === -J -S -E -W -W16 -W32
|
2006-03-27 17:48:21 +04:00
|
|
|
*
|
|
|
|
* Input assumption is JIS 7 bit, Shift_JIS, EUC-JP,
|
2006-09-15 15:26:07 +04:00
|
|
|
* UTF-8, UTF-16, UTF-32.
|
2006-03-27 17:48:21 +04:00
|
|
|
*
|
|
|
|
* ==== -J
|
|
|
|
*
|
|
|
|
* Assume JIS input. It also accepts EUC-JP.
|
|
|
|
* This is the default. This flag does not exclude Shift_JIS.
|
|
|
|
*
|
|
|
|
* ==== -S
|
|
|
|
*
|
|
|
|
* Assume Shift_JIS and X0201 kana input. It also accepts JIS.
|
|
|
|
* EUC-JP is recognized as X0201 kana. Without <b>-x</b> flag,
|
|
|
|
* X0201 kana (halfwidth kana) is converted into X0208.
|
|
|
|
*
|
|
|
|
* ==== -E
|
|
|
|
*
|
|
|
|
* Assume EUC-JP input. It also accepts JIS.
|
|
|
|
* Same as -J.
|
|
|
|
*
|
|
|
|
* === -t
|
|
|
|
*
|
|
|
|
* No conversion.
|
|
|
|
*
|
|
|
|
* === -i_
|
|
|
|
*
|
|
|
|
* Output sequence to designate JIS-kanji. (DEFAULT B)
|
|
|
|
*
|
|
|
|
* === -o_
|
|
|
|
*
|
|
|
|
* Output sequence to designate ASCII. (DEFAULT B)
|
|
|
|
*
|
|
|
|
* === -r
|
|
|
|
*
|
|
|
|
* {de/en}crypt ROT13/47
|
|
|
|
*
|
2022-04-13 21:09:50 +03:00
|
|
|
* === \-h[123] --hiragana --katakana --katakana-hiragana
|
2006-03-27 17:48:21 +04:00
|
|
|
*
|
|
|
|
* [-h1 --hiragana] Katakana to Hiragana conversion.
|
|
|
|
*
|
|
|
|
* [-h2 --katakana] Hiragana to Katakana conversion.
|
|
|
|
*
|
|
|
|
* [-h3 --katakana-hiragana] Katakana to Hiragana and Hiragana to Katakana conversion.
|
|
|
|
*
|
|
|
|
* === -T
|
|
|
|
*
|
|
|
|
* Text mode output (MS-DOS)
|
|
|
|
*
|
|
|
|
* === -l
|
|
|
|
*
|
|
|
|
* ISO8859-1 (Latin-1) support
|
|
|
|
*
|
|
|
|
* === -f[<code>m</code> [- <code>n</code>]]
|
|
|
|
*
|
|
|
|
* Folding on <code>m</code> length with <code>n</code> margin in a line.
|
|
|
|
* Without this option, fold length is 60 and fold margin is 10.
|
|
|
|
*
|
|
|
|
* === -F
|
|
|
|
*
|
|
|
|
* New line preserving line folding.
|
|
|
|
*
|
2022-04-13 21:09:50 +03:00
|
|
|
* === \-Z[0-3]
|
2006-03-27 17:48:21 +04:00
|
|
|
*
|
|
|
|
* Convert X0208 alphabet (Fullwidth Alphabets) to ASCII.
|
|
|
|
*
|
|
|
|
* [-Z -Z0] Convert X0208 alphabet to ASCII.
|
|
|
|
*
|
|
|
|
* [-Z1] Converts X0208 kankaku to single ASCII space.
|
|
|
|
*
|
|
|
|
* [-Z2] Converts X0208 kankaku to double ASCII spaces.
|
|
|
|
*
|
|
|
|
* [-Z3] Replacing Fullwidth >, <, ", & into '>', '<', '"', '&' as in HTML.
|
|
|
|
*
|
|
|
|
* === -X -x
|
|
|
|
*
|
|
|
|
* Assume X0201 kana in MS-Kanji.
|
|
|
|
* With <b>-X</b> or without this option, X0201 is converted into X0208 Kana.
|
|
|
|
* With <b>-x</b>, try to preserve X0208 kana and do not convert X0201 kana to X0208.
|
|
|
|
* In JIS output, ESC-(-I is used. In EUC output, SSO is used.
|
|
|
|
*
|
2022-04-13 21:09:50 +03:00
|
|
|
* === \-B[0-2]
|
2006-03-27 17:48:21 +04:00
|
|
|
*
|
|
|
|
* Assume broken JIS-Kanji input, which lost ESC.
|
|
|
|
* Useful when your site is using old B-News Nihongo patch.
|
|
|
|
*
|
|
|
|
* [-B1] allows any char after ESC-( or ESC-$.
|
|
|
|
*
|
|
|
|
* [-B2] forces ASCII after NL.
|
|
|
|
*
|
|
|
|
* === -I
|
|
|
|
*
|
|
|
|
* Replacing non iso-2022-jp char into a geta character
|
|
|
|
* (substitute character in Japanese).
|
|
|
|
*
|
|
|
|
* === -d -c
|
|
|
|
*
|
|
|
|
* Delete \r in line feed, Add \r in line feed.
|
|
|
|
*
|
2022-04-13 21:09:50 +03:00
|
|
|
* === \-m[BQN0]
|
2006-03-27 17:48:21 +04:00
|
|
|
*
|
|
|
|
* MIME ISO-2022-JP/ISO8859-1 decode. (DEFAULT)
|
|
|
|
* To see ISO8859-1 (Latin-1) -l is necessary.
|
|
|
|
*
|
|
|
|
* [-mB] Decode MIME base64 encoded stream. Remove header or other part before
|
2010-04-22 12:04:13 +04:00
|
|
|
* conversion.
|
2006-03-27 17:48:21 +04:00
|
|
|
*
|
|
|
|
* [-mQ] Decode MIME quoted stream. '_' in quoted stream is converted to space.
|
|
|
|
*
|
|
|
|
* [-mN] Non-strict decoding.
|
|
|
|
* It allows line break in the middle of the base64 encoding.
|
|
|
|
*
|
|
|
|
* [-m0] No MIME decode.
|
|
|
|
*
|
|
|
|
* === -M
|
|
|
|
*
|
|
|
|
* MIME encode. Header style. All ASCII code and control characters are intact.
|
|
|
|
* Kanji conversion is performed before encoding, so this cannot be used as a picture encoder.
|
|
|
|
*
|
|
|
|
* [-MB] MIME encode Base64 stream.
|
|
|
|
*
|
2021-11-03 13:14:57 +03:00
|
|
|
* [-MQ] Perform quoted encoding.
|
2006-03-27 17:48:21 +04:00
|
|
|
*
|
|
|
|
* === -l
|
|
|
|
*
|
|
|
|
* Input and output code is ISO8859-1 (Latin-1) and ISO-2022-JP.
|
|
|
|
* <b>-s</b>, <b>-e</b> and <b>-x</b> are not compatible with this option.
|
|
|
|
*
|
2022-04-13 21:09:50 +03:00
|
|
|
* === \-L[uwm]
|
2006-03-27 17:48:21 +04:00
|
|
|
*
|
|
|
|
* new line mode
|
|
|
|
* Without this option, nkf doesn't convert line breaks.
|
|
|
|
*
|
|
|
|
* [-Lu] unix (LF)
|
|
|
|
*
|
|
|
|
* [-Lw] windows (CRLF)
|
|
|
|
*
|
|
|
|
* [-Lm] mac (CR)
|
|
|
|
*
|
|
|
|
* === --fj --unix --mac --msdos --windows
|
|
|
|
*
|
|
|
|
* convert for these system
|
|
|
|
*
|
|
|
|
* === --jis --euc --sjis --mime --base64
|
|
|
|
*
|
|
|
|
* convert for named code
|
|
|
|
*
|
|
|
|
* === --jis-input --euc-input --sjis-input --mime-input --base64-input
|
|
|
|
*
|
|
|
|
* assume input system
|
|
|
|
*
|
|
|
|
* === --ic=<code>input codeset</code> --oc=<code>output codeset</code>
|
|
|
|
*
|
|
|
|
* Set the input or output codeset.
|
|
|
|
* NKF supports following codesets and those codeset name are case insensitive.
|
|
|
|
*
|
|
|
|
* [ISO-2022-JP] a.k.a. RFC1468, 7bit JIS, JUNET
|
|
|
|
*
|
|
|
|
* [EUC-JP (eucJP-nkf)] a.k.a. AT&T JIS, Japanese EUC, UJIS
|
|
|
|
*
|
|
|
|
* [eucJP-ascii] a.k.a. x-eucjp-open-19970715-ascii
|
|
|
|
*
|
|
|
|
* [eucJP-ms] a.k.a. x-eucjp-open-19970715-ms
|
|
|
|
*
|
|
|
|
* [CP51932] Microsoft Version of EUC-JP.
|
|
|
|
*
|
|
|
|
* [Shift_JIS] SJIS, MS-Kanji
|
|
|
|
*
|
2008-01-01 18:22:25 +03:00
|
|
|
* [Windows-31J] a.k.a. CP932
|
2006-03-27 17:48:21 +04:00
|
|
|
*
|
|
|
|
* [UTF-8] same as UTF-8N
|
|
|
|
*
|
|
|
|
* [UTF-8N] UTF-8 without BOM
|
|
|
|
*
|
|
|
|
* [UTF-8-BOM] UTF-8 with BOM
|
|
|
|
*
|
|
|
|
* [UTF-16] same as UTF-16BE
|
|
|
|
*
|
|
|
|
* [UTF-16BE] UTF-16 Big Endian without BOM
|
|
|
|
*
|
|
|
|
* [UTF-16BE-BOM] UTF-16 Big Endian with BOM
|
|
|
|
*
|
|
|
|
* [UTF-16LE] UTF-16 Little Endian without BOM
|
|
|
|
*
|
|
|
|
* [UTF-16LE-BOM] UTF-16 Little Endian with BOM
|
|
|
|
*
|
2006-09-15 15:26:07 +04:00
|
|
|
* [UTF-32] same as UTF-32BE
|
|
|
|
*
|
|
|
|
* [UTF-32BE] UTF-32 Big Endian without BOM
|
|
|
|
*
|
|
|
|
* [UTF-32BE-BOM] UTF-32 Big Endian with BOM
|
|
|
|
*
|
|
|
|
* [UTF-32LE] UTF-32 Little Endian without BOM
|
|
|
|
*
|
|
|
|
* [UTF-32LE-BOM] UTF-32 Little Endian with BOM
|
|
|
|
*
|
2006-03-27 17:48:21 +04:00
|
|
|
* [UTF8-MAC] NKDed UTF-8, a.k.a. UTF8-NFD (input only)
|
|
|
|
*
|
|
|
|
* === --fb-{skip, html, xml, perl, java, subchar}
|
|
|
|
*
|
|
|
|
* Specify the way that nkf handles unassigned characters.
|
|
|
|
* Without this option, --fb-skip is assumed.
|
|
|
|
*
|
|
|
|
* === --prefix= <code>escape character</code> <code>target character</code> ..
|
|
|
|
*
|
|
|
|
* When nkf converts to Shift_JIS,
|
|
|
|
* nkf adds a specified escape character to specified 2nd byte of Shift_JIS characters.
|
|
|
|
* 1st byte of argument is the escape character and following bytes are target characters.
|
|
|
|
*
|
2006-09-15 15:26:07 +04:00
|
|
|
* === --no-cp932ext
|
2006-03-27 17:48:21 +04:00
|
|
|
*
|
|
|
|
* Handle the characters extended in CP932 as unassigned characters.
|
|
|
|
*
|
2006-09-15 15:26:07 +04:00
|
|
|
* == --no-best-fit-chars
|
|
|
|
*
|
|
|
|
* When Unicode to Encoded byte conversion,
|
|
|
|
* don't convert characters which is not round trip safe.
|
|
|
|
* When Unicode to Unicode conversion,
|
|
|
|
* with this and -x option, nkf can be used as UTF converter.
|
|
|
|
* (In other words, without this and -x option, nkf doesn't save some characters)
|
|
|
|
*
|
2021-04-25 18:10:39 +03:00
|
|
|
* When nkf convert string which related to path, you should use this option.
|
2006-09-15 15:26:07 +04:00
|
|
|
*
|
2006-03-27 17:48:21 +04:00
|
|
|
* === --cap-input
|
|
|
|
*
|
|
|
|
* Decode hex encoded characters.
|
|
|
|
*
|
|
|
|
* === --url-input
|
|
|
|
*
|
|
|
|
* Unescape percent escaped characters.
|
|
|
|
*
|
|
|
|
* === --
|
|
|
|
*
|
|
|
|
* Ignore rest of -option.
|
|
|
|
*/
|
2004-10-29 10:51:33 +04:00
|
|
|
|
1999-08-13 09:37:52 +04:00
|
|
|
void
|
2014-09-30 09:25:32 +04:00
|
|
|
Init_nkf(void)
|
1999-08-13 09:37:52 +04:00
|
|
|
{
|
2007-12-19 07:29:22 +03:00
|
|
|
VALUE mNKF = rb_define_module("NKF");
|
2006-03-27 17:48:21 +04:00
|
|
|
|
2007-12-19 07:29:22 +03:00
|
|
|
rb_define_module_function(mNKF, "nkf", rb_nkf_convert, 2);
|
|
|
|
rb_define_module_function(mNKF, "guess", rb_nkf_guess, 1);
|
|
|
|
rb_define_alias(rb_singleton_class(mNKF), "guess", "guess");
|
|
|
|
|
2007-12-19 13:19:38 +03:00
|
|
|
rb_define_const(mNKF, "AUTO", Qnil);
|
|
|
|
rb_define_const(mNKF, "NOCONV", Qnil);
|
|
|
|
rb_define_const(mNKF, "UNKNOWN", Qnil);
|
|
|
|
rb_define_const(mNKF, "BINARY", rb_enc_from_encoding(rb_nkf_enc_get("BINARY")));
|
2008-01-11 04:03:23 +03:00
|
|
|
rb_define_const(mNKF, "ASCII", rb_enc_from_encoding(rb_nkf_enc_get("US-ASCII")));
|
2007-12-19 13:19:38 +03:00
|
|
|
rb_define_const(mNKF, "JIS", rb_enc_from_encoding(rb_nkf_enc_get("ISO-2022-JP")));
|
|
|
|
rb_define_const(mNKF, "EUC", rb_enc_from_encoding(rb_nkf_enc_get("EUC-JP")));
|
|
|
|
rb_define_const(mNKF, "SJIS", rb_enc_from_encoding(rb_nkf_enc_get("Shift_JIS")));
|
2007-12-22 11:36:30 +03:00
|
|
|
rb_define_const(mNKF, "UTF8", rb_enc_from_encoding(rb_utf8_encoding()));
|
2008-05-20 08:20:53 +04:00
|
|
|
rb_define_const(mNKF, "UTF16", rb_enc_from_encoding(rb_nkf_enc_get("UTF-16BE")));
|
|
|
|
rb_define_const(mNKF, "UTF32", rb_enc_from_encoding(rb_nkf_enc_get("UTF-32BE")));
|
2007-12-19 13:19:38 +03:00
|
|
|
|
2006-03-27 17:48:21 +04:00
|
|
|
/* Full version string of nkf */
|
2007-12-19 07:29:22 +03:00
|
|
|
rb_define_const(mNKF, "VERSION", rb_str_new2(RUBY_NKF_VERSION));
|
2006-03-27 17:48:21 +04:00
|
|
|
/* Version of nkf */
|
2007-12-19 07:29:22 +03:00
|
|
|
rb_define_const(mNKF, "NKF_VERSION", rb_str_new2(NKF_VERSION));
|
2006-03-27 17:48:21 +04:00
|
|
|
/* Release date of nkf */
|
2007-12-19 07:29:22 +03:00
|
|
|
rb_define_const(mNKF, "NKF_RELEASE_DATE", rb_str_new2(NKF_RELEASE_DATE));
|
2023-04-14 06:01:01 +03:00
|
|
|
/* Version of nkf library */
|
|
|
|
rb_define_const(mNKF, "GEM_VERSION", rb_str_new_cstr(NKF_GEM_VERSION));
|
1999-08-13 09:37:52 +04:00
|
|
|
}
|