From 41d96dbd357ac485b3e79d29328170fa069f55d7 Mon Sep 17 00:00:00 2001 From: kosako Date: Sat, 26 Feb 2005 08:05:06 +0000 Subject: remove oniggnu.h (GNU regex API). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@8029 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 5 ++ LEGAL | 3 +- ext/strscan/strscan.c | 8 ++-- oniggnu.h | 123 -------------------------------------------------- parse.y | 6 +-- re.c | 5 ++ regex.h | 15 +++++- 7 files changed, 31 insertions(+), 134 deletions(-) delete mode 100644 oniggnu.h diff --git a/ChangeLog b/ChangeLog index 4e583b4b86..be91159ebb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Sat Feb 26 16:58:20 2005 K.Kosako + + * parse.y, re.c, regex.h, LEGAL, ext/strscan/strscan.c: + remove oniggnu.h (GNU regex API). + Wed Feb 23 22:08:16 2005 Kazuo Saito * st.c, st.h: imported additional file changes on diff --git a/LEGAL b/LEGAL index 852a6bdf60..80c3c8852d 100644 --- a/LEGAL +++ b/LEGAL @@ -5,7 +5,6 @@ All the files in this distribution are covered under either the Ruby's license (see the file COPYING) or public-domain except some files mentioned below. -oniggnu.h: oniguruma.h: regcomp.c: regenc.[ch]: @@ -21,9 +20,9 @@ utf8.c: Oniguruma ---- (C) K.Kosako +http://www.geocities.jp/kosako3/oniguruma/ http://www.ruby-lang.org/cgi-bin/cvsweb.cgi/oniguruma/ http://www.freebsd.org/cgi/cvsweb.cgi/ports/devel/oniguruma/ -http://www.geocities.jp/kosako3/oniguruma/ When this software is partly used or it is distributed with Ruby, this of Ruby follows the license of Ruby. diff --git a/ext/strscan/strscan.c b/ext/strscan/strscan.c index 158fab321f..ab1428baac 100644 --- a/ext/strscan/strscan.c +++ b/ext/strscan/strscan.c @@ -245,7 +245,7 @@ strscan_init_copy(vself, vorig) self->str = orig->str; self->prev = orig->prev; self->curr = orig->curr; - re_copy_registers(&self->regs, &orig->regs); + onig_region_copy(&self->regs, &orig->regs); } return vself; @@ -684,9 +684,9 @@ adjust_registers_to_matched(p) struct strscanner *p; { if (p->regs.allocated == 0) { - p->regs.beg = ALLOC_N(int, RE_NREGS); - p->regs.end = ALLOC_N(int, RE_NREGS); - p->regs.allocated = RE_NREGS; + p->regs.beg = ALLOC_N(int, ONIG_NREGION); + p->regs.end = ALLOC_N(int, ONIG_NREGION); + p->regs.allocated = ONIG_NREGION; } p->regs.num_regs = 1; p->regs.beg[0] = 0; diff --git a/oniggnu.h b/oniggnu.h deleted file mode 100644 index 4a69515466..0000000000 --- a/oniggnu.h +++ /dev/null @@ -1,123 +0,0 @@ -#ifndef ONIGGNU_H -#define ONIGGNU_H -/********************************************************************** - oniggnu.h - Oniguruma (regular expression library) -**********************************************************************/ -/*- - * Copyright (c) 2002-2005 K.Kosako - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include "oniguruma.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#define MBCTYPE_ASCII 0 -#define MBCTYPE_EUC 1 -#define MBCTYPE_SJIS 2 -#define MBCTYPE_UTF8 3 - -/* GNU regex options */ -#ifndef RE_NREGS -#define RE_NREGS ONIG_NREGION -#endif - -#define RE_OPTION_IGNORECASE ONIG_OPTION_IGNORECASE -#define RE_OPTION_EXTENDED ONIG_OPTION_EXTEND -#define RE_OPTION_MULTILINE ONIG_OPTION_MULTILINE -#define RE_OPTION_SINGLELINE ONIG_OPTION_SINGLELINE -#define RE_OPTION_LONGEST ONIG_OPTION_FIND_LONGEST -#define RE_OPTION_POSIXLINE (RE_OPTION_MULTILINE|RE_OPTION_SINGLELINE) -#define RE_OPTION_FIND_NOT_EMPTY ONIG_OPTION_FIND_NOT_EMPTY -#define RE_OPTION_NEGATE_SINGLELINE ONIG_OPTION_NEGATE_SINGLELINE -#define RE_OPTION_DONT_CAPTURE_GROUP ONIG_OPTION_DONT_CAPTURE_GROUP -#define RE_OPTION_CAPTURE_GROUP ONIG_OPTION_CAPTURE_GROUP - -#ifdef RUBY_PLATFORM - -#ifndef ONIG_RUBY_M17N - -ONIG_EXTERN OnigEncoding OnigEncDefaultCharEncoding; - -#undef ismbchar -#define ismbchar(c) (mbclen((c)) != 1) -#define mbclen(c) \ - ONIGENC_MBC_ENC_LEN(OnigEncDefaultCharEncoding, (UChar* )(&c)) - -#endif /* ifndef ONIG_RUBY_M17N */ - -#define re_mbcinit ruby_re_mbcinit -#define re_compile_pattern ruby_re_compile_pattern -#define re_recompile_pattern ruby_re_recompile_pattern -#define re_free_pattern ruby_re_free_pattern -#define re_adjust_startpos ruby_re_adjust_startpos -#define re_search ruby_re_search -#define re_match ruby_re_match -#define re_set_casetable ruby_re_set_casetable -#define re_copy_registers ruby_re_copy_registers -#define re_free_registers ruby_re_free_registers -#define register_info_type ruby_register_info_type -#define re_error_code_to_str ruby_error_code_to_str - -#define ruby_error_code_to_str onig_error_code_to_str -#define ruby_re_copy_registers onig_region_copy -#else -#define re_error_code_to_str onig_error_code_to_str -#define re_copy_registers onig_region_copy -#endif - -#ifdef ONIG_RUBY_M17N -ONIG_EXTERN -void re_mbcinit P_((OnigEncoding)); -#else -ONIG_EXTERN -void re_mbcinit P_((int)); -#endif - -ONIG_EXTERN -int re_compile_pattern P_((const char*, int, struct re_pattern_buffer*, char* err_buf)); -ONIG_EXTERN -int re_recompile_pattern P_((const char*, int, struct re_pattern_buffer*, char* err_buf)); -ONIG_EXTERN -void re_free_pattern P_((struct re_pattern_buffer*)); -ONIG_EXTERN -int re_adjust_startpos P_((struct re_pattern_buffer*, const char*, int, int, int)); -ONIG_EXTERN -int re_search P_((struct re_pattern_buffer*, const char*, int, int, int, struct re_registers*)); -ONIG_EXTERN -int re_match P_((struct re_pattern_buffer*, const char *, int, int, struct re_registers*)); -ONIG_EXTERN -void re_set_casetable P_((const char*)); -ONIG_EXTERN -void re_free_registers P_((struct re_registers*)); -ONIG_EXTERN -int re_alloc_pattern P_((struct re_pattern_buffer**)); /* added */ - -#ifdef __cplusplus -} -#endif - -#endif /* ONIGGNU_H */ diff --git a/parse.y b/parse.y index 353a19883b..5b813b8a5f 100644 --- a/parse.y +++ b/parse.y @@ -4772,13 +4772,13 @@ parser_regx_options(parser) while (c = nextc(), ISALPHA(c)) { switch (c) { case 'i': - options |= RE_OPTION_IGNORECASE; + options |= ONIG_OPTION_IGNORECASE; break; case 'x': - options |= RE_OPTION_EXTENDED; + options |= ONIG_OPTION_EXTEND; break; case 'm': - options |= RE_OPTION_MULTILINE; + options |= ONIG_OPTION_MULTILINE; break; case 'o': options |= RE_OPTION_ONCE; diff --git a/re.c b/re.c index 8de3ddf8fa..15248d76bd 100644 --- a/re.c +++ b/re.c @@ -13,6 +13,11 @@ #include "re.h" #include +#define MBCTYPE_ASCII 0 +#define MBCTYPE_EUC 1 +#define MBCTYPE_SJIS 2 +#define MBCTYPE_UTF8 3 + static VALUE rb_eRegexpError; #define BEG(no) regs->beg[no] diff --git a/regex.h b/regex.h index 32d04789b0..d2877937ca 100644 --- a/regex.h +++ b/regex.h @@ -5,13 +5,24 @@ $Author$ $Date$ - Copyright (C) 1993-2004 Yukihiro Matsumoto + Copyright (C) 1993-2005 Yukihiro Matsumoto **********************************************************************/ #ifndef REGEX_H #define REGEX_H -#include "oniggnu.h" +#include "oniguruma.h" + +#ifndef ONIG_RUBY_M17N + +ONIG_EXTERN OnigEncoding OnigEncDefaultCharEncoding; + +#undef ismbchar +#define ismbchar(c) (mbclen((c)) != 1) +#define mbclen(c) \ + ONIGENC_MBC_ENC_LEN(OnigEncDefaultCharEncoding, (UChar* )(&c)) + +#endif /* ifndef ONIG_RUBY_M17N */ #endif /* !REGEX_H */ -- cgit v1.2.3