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

* 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.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22437 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2009-02-19 06:11:41 +00:00
parent 6d3ceb6ce3
commit f35308b3ef
6 changed files with 42 additions and 32 deletions

View file

@ -1,3 +1,12 @@
Thu Feb 19 15:11:40 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
* 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@ruby-lang.org> Thu Feb 19 14:48:12 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
* configure.in, */Makefile.sub (LOAD_RELATIVE): moved from ruby.c * configure.in, */Makefile.sub (LOAD_RELATIVE): moved from ruby.c

13
dln.c
View file

@ -1268,16 +1268,6 @@ dln_load(const char *file)
# define RTLD_GLOBAL 0 # define RTLD_GLOBAL 0
#endif #endif
#if defined __SYMBIAN32__
{ /* Need backslash in the path again */
char *p;
for (p = (char *)file; *p; p++) {
if (*p == '/') {
*p = '\\';
}
}
}
#endif
/* Load file */ /* Load file */
if ((handle = (void*)dlopen(file, RTLD_LAZY|RTLD_GLOBAL)) == NULL) { if ((handle = (void*)dlopen(file, RTLD_LAZY|RTLD_GLOBAL)) == NULL) {
error = dln_strerror(); error = dln_strerror();
@ -1286,8 +1276,9 @@ dln_load(const char *file)
init_fct = (void(*)())dlsym(handle, buf); init_fct = (void(*)())dlsym(handle, buf);
#if defined __SYMBIAN32__ #if defined __SYMBIAN32__
if (init_fct == NULL) if (init_fct == NULL) {
init_fct = (void(*)())dlsym(handle, "1"); /* Some Symbian versions do not support symbol table in DLL, ordinal numbers only */ init_fct = (void(*)())dlsym(handle, "1"); /* Some Symbian versions do not support symbol table in DLL, ordinal numbers only */
}
#endif #endif
if (init_fct == NULL) { if (init_fct == NULL) {
error = DLN_ERROR(); error = DLN_ERROR();

View file

@ -205,4 +205,20 @@ VALUE rb_vm_top_self();
VALUE rb_vm_cbase(void); VALUE rb_vm_cbase(void);
void rb_trap_restore_mask(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 */ #endif /* RUBY_EVAL_INTERN_H */

11
load.c
View file

@ -529,8 +529,17 @@ load_failed(VALUE fname)
static VALUE static VALUE
load_ext(VALUE path) load_ext(VALUE path)
{ {
VALUE result;
SCOPE_SET(NOEX_PUBLIC); 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 VALUE

22
ruby.c
View file

@ -166,22 +166,6 @@ usage(const char *name)
VALUE rb_get_load_path(void); 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__ #if defined _WIN32 || defined __CYGWIN__ || defined __SYMBIAN32__
static VALUE static VALUE
rubylib_mangled_path(const char *s, unsigned int l) rubylib_mangled_path(const char *s, unsigned int l)
@ -206,7 +190,7 @@ rubylib_mangled_path(const char *s, unsigned int l)
if (newl == 0 || oldl == 0) { if (newl == 0 || oldl == 0) {
rb_fatal("malformed RUBYLIB_PREFIX"); rb_fatal("malformed RUBYLIB_PREFIX");
} }
translate_char(newp, '\\', '/'); translit_char(newp, '\\', '/');
} }
else { else {
notfound = 1; notfound = 1;
@ -370,7 +354,7 @@ ruby_init_loadpath_safe(int safe_level)
libpath[sizeof(libpath) - 1] = '\0'; libpath[sizeof(libpath) - 1] = '\0';
#if defined DOSISH #if defined DOSISH
translate_char(libpath, '\\', '/'); translit_char(libpath, '\\', '/');
#elif defined __CYGWIN__ #elif defined __CYGWIN__
{ {
char rubylib[FILENAME_MAX]; char rubylib[FILENAME_MAX];
@ -1270,7 +1254,7 @@ process_options(VALUE arg)
opt->script_name = rb_str_new_cstr(opt->script); opt->script_name = rb_str_new_cstr(opt->script);
opt->script = RSTRING_PTR(opt->script_name); opt->script = RSTRING_PTR(opt->script_name);
#if defined DOSISH || defined __CYGWIN__ #if defined DOSISH || defined __CYGWIN__
translate_char(RSTRING_PTR(opt->script_name), '\\', '/'); translit_char(RSTRING_PTR(opt->script_name), '\\', '/');
#endif #endif
rb_obj_freeze(opt->script_name); rb_obj_freeze(opt->script_name);

View file

@ -165,6 +165,7 @@ define config_h
@echo>>$(1) #define USE_ELF 1 @echo>>$(1) #define USE_ELF 1
@echo>>$(1) #define DLEXT_MAXLEN 4 @echo>>$(1) #define DLEXT_MAXLEN 4
@echo>>$(1) #define DLEXT ".dll" @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_LIB "C:/Data/Ruby/lib/$(MAJOR).$(MINOR).$(TEENY)"
@echo>>$(1) #define RUBY_SITE_LIB "E:/Data/Ruby/lib" @echo>>$(1) #define RUBY_SITE_LIB "E:/Data/Ruby/lib"
@echo>>$(1) #define RUBY_SITE_LIB2 "E:/Data/Ruby/lib/$(MAJOR).$(MINOR).$(TEENY)" @echo>>$(1) #define RUBY_SITE_LIB2 "E:/Data/Ruby/lib/$(MAJOR).$(MINOR).$(TEENY)"