From b7168bf6e811efa0f1333bcfb0defae316629e50 Mon Sep 17 00:00:00 2001 From: Rei FURUKAWA Date: Sun, 5 Oct 2003 16:25:59 +0000 Subject: [PATCH] =?utf8?q?=E8=87=AA=E5=8B=95=E5=88=A4=E5=88=A5=E3=81=AE?= =?utf8?q?=E7=8A=B6=E6=85=8B=E3=82=92=E4=BF=9D=E6=8C=81=E3=81=97=E3=81=9F?= =?utf8?q?=E3=81=BE=E3=81=BE=E5=A4=89=E6=8F=9B=E3=82=92=E7=B6=9A=E3=81=91?= =?utf8?q?=E3=82=8B=20nkf=5Fcontinue=20=E3=82=92=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- NKF.mod/NKF.pm | 4 ++-- NKF.mod/NKF.xs | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+), 2 deletions(-) diff --git a/NKF.mod/NKF.pm b/NKF.mod/NKF.pm index 1912169..2ad79b6 100644 --- a/NKF.mod/NKF.pm +++ b/NKF.mod/NKF.pm @@ -34,9 +34,9 @@ require DynaLoader; # names by default without a very good reason. Use EXPORT_OK instead. # Do not simply export all your public functions/methods/constants. @EXPORT = qw( - nkf + nkf nkf_continue inputcode ); -$VERSION = '2.00'; +$VERSION = '2.03'; bootstrap NKF $VERSION; diff --git a/NKF.mod/NKF.xs b/NKF.mod/NKF.xs index 66e1b31..626b634 100644 --- a/NKF.mod/NKF.xs +++ b/NKF.mod/NKF.xs @@ -166,3 +166,54 @@ nkf(...) OUTPUT: RETVAL +SV * +nkf_continue(...) + PROTOTYPE: @ + PREINIT: + char *data; + STRLEN rlen; + CODE: + + /* Get input data pointer from the last variable. */ + data = SvPV(ST(0),i_len); + input_ctr = 0; + + if(x0201_f == WISH_TRUE) + x0201_f = ((!iso2022jp_f)? TRUE : NO_X0201); + + /* allocate the result buffer */ + + /* During conversion, stirngs length may grow. This is the unit */ + /* of growth */ + incsize = INCSIZE; + rlen = i_len+INCSIZE; + result = newSV(rlen); + input = data; + + /* SvPV(result,o_len) does not work here. */ + output = SvPVX(result); + o_len = rlen; + output_ctr = 0; + + /* Convestion */ + kanji_convert(NULL); + nkf_putchar(0); /* Null terminator */ + + RETVAL = result; + SvPOK_on(RETVAL); + /* We cannot use + SvCUR_set(RETVAL, strlen(output)); + because output can contain \0. + */ + SvCUR_set(RETVAL, output_ctr - 1); + + OUTPUT: + RETVAL + +SV* +inputcode(...) + CODE: + RETVAL = newSV(strlen(input_codename) + 1); + sv_setpv(RETVAL, input_codename); + OUTPUT: + RETVAL -- 2.11.0