ruby-changes:10864
From: nobu <ko1@a...>
Date: Thu, 19 Feb 2009 15:12:10 +0900 (JST)
Subject: [ruby-changes:10864] Ruby:r22437 (trunk): * eval_intern.h (translit_char): moved from ruby.c.
nobu 2009-02-19 15:11:41 +0900 (Thu, 19 Feb 2009) New Revision: 22437 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=22437 Log: * eval_intern.h (translit_char): moved from ruby.c. * load.c (load_ext): transliterates file separators and back if needed. * symbian/setup (DLN_NEEDS_ALT_SEPARATOR): defined. Modified files: trunk/ChangeLog trunk/dln.c trunk/eval_intern.h trunk/load.c trunk/ruby.c trunk/symbian/setup Index: eval_intern.h =================================================================== --- eval_intern.h (revision 22436) +++ eval_intern.h (revision 22437) @@ -205,4 +205,20 @@ VALUE rb_vm_cbase(void); void rb_trap_restore_mask(void); +#ifndef CharNext /* defined as CharNext[AW] on Windows. */ +#define CharNext(p) ((p) + mblen(p, RUBY_MBCHAR_MAXSIZE)) +#endif + +#if defined DOSISH || defined __CYGWIN__ +static inline void +translit_char(char *p, int from, int to) +{ + while (*p) { + if ((unsigned char)*p == from) + *p = to; + p = CharNext(p); + } +} +#endif + #endif /* RUBY_EVAL_INTERN_H */ Index: ChangeLog =================================================================== --- ChangeLog (revision 22436) +++ ChangeLog (revision 22437) @@ -1,3 +1,12 @@ +Thu Feb 19 15:11:40 2009 Nobuyoshi Nakada <nobu@r...> + + * eval_intern.h (translit_char): moved from ruby.c. + + * load.c (load_ext): transliterates file separators and back if + needed. + + * symbian/setup (DLN_NEEDS_ALT_SEPARATOR): defined. + Thu Feb 19 14:48:12 2009 Nobuyoshi Nakada <nobu@r...> * configure.in, */Makefile.sub (LOAD_RELATIVE): moved from ruby.c Index: load.c =================================================================== --- load.c (revision 22436) +++ load.c (revision 22437) @@ -529,8 +529,17 @@ static VALUE load_ext(VALUE path) { + VALUE result; + SCOPE_SET(NOEX_PUBLIC); - return (VALUE)dln_load(RSTRING_PTR(path)); +#if defined DLN_NEEDS_ALT_SEPARATOR && DLN_NEEDS_ALT_SEPARATOR + translit_char(RSTRING_PTR(path), '/', '\\'); +#endif + result = (VALUE)dln_load(RSTRING_PTR(path)); +#if defined DLN_NEEDS_ALT_SEPARATOR && DLN_NEEDS_ALT_SEPARATOR + translit_char(RSTRING_PTR(path), '\\', '/'); +#endif + return result; } VALUE Index: symbian/setup =================================================================== --- symbian/setup (revision 22436) +++ symbian/setup (revision 22437) @@ -165,6 +165,7 @@ @echo>>$(1) #define USE_ELF 1 @echo>>$(1) #define DLEXT_MAXLEN 4 @echo>>$(1) #define DLEXT ".dll" +@echo>>$(1) #define DLN_NEEDS_ALT_SEPARATOR 1 @echo>>$(1) #define RUBY_LIB "C:/Data/Ruby/lib/$(MAJOR).$(MINOR).$(TEENY)" @echo>>$(1) #define RUBY_SITE_LIB "E:/Data/Ruby/lib" @echo>>$(1) #define RUBY_SITE_LIB2 "E:/Data/Ruby/lib/$(MAJOR).$(MINOR).$(TEENY)" Index: dln.c =================================================================== --- dln.c (revision 22436) +++ dln.c (revision 22437) @@ -1268,16 +1268,6 @@ # define RTLD_GLOBAL 0 #endif -#if defined __SYMBIAN32__ - { /* Need backslash in the path again */ - char *p; - for (p = (char *)file; *p; p++) { - if (*p == '/') { - *p = '\\'; - } - } - } -#endif /* Load file */ if ((handle = (void*)dlopen(file, RTLD_LAZY|RTLD_GLOBAL)) == NULL) { error = dln_strerror(); @@ -1286,8 +1276,9 @@ init_fct = (void(*)())dlsym(handle, buf); #if defined __SYMBIAN32__ - if (init_fct == NULL) - init_fct = (void(*)())dlsym(handle, "1"); /* Some Symbian versions do not support symbol table in DLL, ordinal numbers only */ + if (init_fct == NULL) { + init_fct = (void(*)())dlsym(handle, "1"); /* Some Symbian versions do not support symbol table in DLL, ordinal numbers only */ + } #endif if (init_fct == NULL) { error = DLN_ERROR(); Index: ruby.c =================================================================== --- ruby.c (revision 22436) +++ ruby.c (revision 22437) @@ -166,22 +166,6 @@ VALUE rb_get_load_path(void); -#ifndef CharNext /* defined as CharNext[AW] on Windows. */ -#define CharNext(p) ((p) + mblen(p, RUBY_MBCHAR_MAXSIZE)) -#endif - -#if defined DOSISH || defined __CYGWIN__ -static inline void -translate_char(char *p, int from, int to) -{ - while (*p) { - if ((unsigned char)*p == from) - *p = to; - p = CharNext(p); - } -} -#endif - #if defined _WIN32 || defined __CYGWIN__ || defined __SYMBIAN32__ static VALUE rubylib_mangled_path(const char *s, unsigned int l) @@ -206,7 +190,7 @@ if (newl == 0 || oldl == 0) { rb_fatal("malformed RUBYLIB_PREFIX"); } - translate_char(newp, '\\', '/'); + translit_char(newp, '\\', '/'); } else { notfound = 1; @@ -370,7 +354,7 @@ libpath[sizeof(libpath) - 1] = '\0'; #if defined DOSISH - translate_char(libpath, '\\', '/'); + translit_char(libpath, '\\', '/'); #elif defined __CYGWIN__ { char rubylib[FILENAME_MAX]; @@ -1270,7 +1254,7 @@ opt->script_name = rb_str_new_cstr(opt->script); opt->script = RSTRING_PTR(opt->script_name); #if defined DOSISH || defined __CYGWIN__ - translate_char(RSTRING_PTR(opt->script_name), '\\', '/'); + translit_char(RSTRING_PTR(opt->script_name), '\\', '/'); #endif rb_obj_freeze(opt->script_name); -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/