1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

*** empty log message ***

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/v1_1r@252 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 1998-06-26 07:19:02 +00:00
parent 12b0a1b225
commit fdfa583944
4 changed files with 35 additions and 40 deletions

View file

@ -206,6 +206,7 @@ process.o: process.c ruby.h config.h defines.h intern.h rubysig.h st.h
random.o: random.c ruby.h config.h defines.h intern.h random.o: random.c ruby.h config.h defines.h intern.h
range.o: range.c ruby.h config.h defines.h intern.h range.o: range.c ruby.h config.h defines.h intern.h
re.o: re.c ruby.h config.h defines.h intern.h re.h regex.h re.o: re.c ruby.h config.h defines.h intern.h re.h regex.h
regex.o: regex.c config.h regex.h util.h
ruby.o: ruby.c ruby.h config.h defines.h intern.h dln.h ruby.o: ruby.c ruby.h config.h defines.h intern.h dln.h
signal.o: signal.c ruby.h config.h defines.h intern.h rubysig.h signal.o: signal.c ruby.h config.h defines.h intern.h rubysig.h
sprintf.o: sprintf.c ruby.h config.h defines.h intern.h sprintf.o: sprintf.c ruby.h config.h defines.h intern.h

View file

@ -12,13 +12,13 @@
#define RUBY #define RUBY
/* define EUC/SJIS for default kanji-code */ /* define RUBY_USE_EUC/SJIS for default kanji-code */
#if defined(MSDOS) || defined(__CYGWIN32__) || defined(__human68k__) || defined(__MACOS__) #if defined(MSDOS) || defined(__CYGWIN32__) || defined(__human68k__) || defined(__MACOS__)
#undef EUC #undef RUBY_USE_EUC
#define SJIS #define RUBY_USE_SJIS
#else #else
#define EUC #define RUBY_USE_EUC
#undef SJIS #undef RUBY_USE_SJIS
#endif #endif
#ifdef NeXT #ifdef NeXT

35
re.c
View file

@ -98,10 +98,10 @@ str_cicmp(str1, str2)
#define KCODE_MASK (KCODE_EUC|KCODE_SJIS) #define KCODE_MASK (KCODE_EUC|KCODE_SJIS)
static int reg_kcode = static int reg_kcode =
#ifdef EUC #ifdef RUBY_USE_EUC
KCODE_EUC; KCODE_EUC;
#else #else
# ifdef SJIS # ifdef RUBY_USE_SJIS
KCODE_SJIS; KCODE_SJIS;
# else # else
KCODE_NONE; KCODE_NONE;
@ -783,20 +783,16 @@ reg_s_new(argc, argv, self)
} }
src = argv[0]; src = argv[0];
switch (TYPE(src)) { if (TYPE(src) == T_REGEXP) {
case T_STRING:
return reg_new_1(self, RSTRING(src)->ptr, RSTRING(src)->len, flag);
break;
case T_REGEXP:
return reg_new_1(self, RREGEXP(src)->str, RREGEXP(src)->len, flag); return reg_new_1(self, RREGEXP(src)->str, RREGEXP(src)->len, flag);
break;
default:
Check_Type(src, T_STRING);
} }
else {
char *p;
int len;
return Qnil; /* not reached */ p = str2cstr(src, &len);
return reg_new_1(self, p, len, flag);
}
} }
static VALUE static VALUE
@ -992,8 +988,7 @@ static void
kcode_setter(val) kcode_setter(val)
struct RString *val; struct RString *val;
{ {
Check_Type(val, T_STRING); rb_set_kcode(STR2CSTR(val));
rb_set_kcode(val->ptr);
} }
static VALUE static VALUE
@ -1023,6 +1018,16 @@ Init_Regexp()
| RE_BACKSLASH_ESCAPE_IN_LISTS); | RE_BACKSLASH_ESCAPE_IN_LISTS);
re_set_casetable(casetable); re_set_casetable(casetable);
#ifdef RUBY_USE_EUC
mbcinit(MBCTYPE_EUC);
#else
#ifdef RUBY_USE_SJIS
mbcinit(MBCTYPE_SJIS);
#else
mbcinit(MBCTYPE_ASCII);
#endif
#endif
rb_define_virtual_variable("$~", match_getter, match_setter); rb_define_virtual_variable("$~", match_getter, match_setter);
rb_define_virtual_variable("$&", last_match_getter, 0); rb_define_virtual_variable("$&", last_match_getter, 0);
rb_define_virtual_variable("$`", prematch_getter, 0); rb_define_virtual_variable("$`", prematch_getter, 0);

13
regex.c
View file

@ -43,7 +43,6 @@
#endif #endif
#include "config.h" #include "config.h"
#include "defines.h"
void *xmalloc P((unsigned long)); void *xmalloc P((unsigned long));
void *xcalloc P((unsigned long,unsigned long)); void *xcalloc P((unsigned long,unsigned long));
@ -60,7 +59,7 @@ void free P((void*));
# endif # endif
# endif /* atarist */ # endif /* atarist */
#else #else
#if defined(HAVE_ALLOCA_H) && !defined(__GNUC__) # if defined(HAVE_ALLOCA_H)
# include <alloca.h> # include <alloca.h>
# else # else
char *alloca(); char *alloca();
@ -4120,18 +4119,8 @@ static const unsigned char mbctab_sjis[] = {
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
}; };
#ifdef EUC
const unsigned char *mbctab = mbctab_euc;
int current_mbctype = MBCTYPE_EUC;
#else
#ifdef SJIS
const unsigned char *mbctab = mbctab_sjis;
int current_mbctype = MBCTYPE_SJIS;
#else
const unsigned char *mbctab = mbctab_ascii; const unsigned char *mbctab = mbctab_ascii;
int current_mbctype = MBCTYPE_ASCII; int current_mbctype = MBCTYPE_ASCII;
#endif
#endif
void void
mbcinit(mbctype) mbcinit(mbctype)