зеркало из https://github.com/github/ruby.git
* 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:
Родитель
6d3ceb6ce3
Коммит
f35308b3ef
|
@ -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>
|
||||
|
||||
* configure.in, */Makefile.sub (LOAD_RELATIVE): moved from ruby.c
|
||||
|
|
13
dln.c
13
dln.c
|
@ -1268,16 +1268,6 @@ dln_load(const char *file)
|
|||
# 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 @@ dln_load(const char *file)
|
|||
|
||||
init_fct = (void(*)())dlsym(handle, buf);
|
||||
#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 */
|
||||
}
|
||||
#endif
|
||||
if (init_fct == NULL) {
|
||||
error = DLN_ERROR();
|
||||
|
|
|
@ -205,4 +205,20 @@ VALUE rb_vm_top_self();
|
|||
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 */
|
||||
|
|
11
load.c
11
load.c
|
@ -529,8 +529,17 @@ load_failed(VALUE fname)
|
|||
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
|
||||
|
|
22
ruby.c
22
ruby.c
|
@ -166,22 +166,6 @@ usage(const char *name)
|
|||
|
||||
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 @@ rubylib_mangled_path(const char *s, unsigned int l)
|
|||
if (newl == 0 || oldl == 0) {
|
||||
rb_fatal("malformed RUBYLIB_PREFIX");
|
||||
}
|
||||
translate_char(newp, '\\', '/');
|
||||
translit_char(newp, '\\', '/');
|
||||
}
|
||||
else {
|
||||
notfound = 1;
|
||||
|
@ -370,7 +354,7 @@ ruby_init_loadpath_safe(int safe_level)
|
|||
|
||||
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 @@ process_options(VALUE arg)
|
|||
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);
|
||||
|
||||
|
|
|
@ -165,6 +165,7 @@ define config_h
|
|||
@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)"
|
||||
|
|
Загрузка…
Ссылка в новой задаче