summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-02-19 06:11:41 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-02-19 06:11:41 +0000
commitf35308b3ef20be1716660a751087b4e726db2171 (patch)
tree0a81f4109473d2c5746f12c65c9287ef06b5b1e0
parent6d3ceb6ce38f91898dfc388fc96f5401ff3edc52 (diff)
* 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
-rw-r--r--ChangeLog9
-rw-r--r--dln.c15
-rw-r--r--eval_intern.h16
-rw-r--r--load.c11
-rw-r--r--ruby.c22
-rw-r--r--symbian/setup1
6 files changed, 42 insertions, 32 deletions
diff --git a/ChangeLog b/ChangeLog
index 4fbd2588d9..36f532ad69 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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
diff --git a/dln.c b/dln.c
index e9d0bb1508..7521678623 100644
--- a/dln.c
+++ b/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)
- 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();
diff --git a/eval_intern.h b/eval_intern.h
index 40f64eca06..ac2999d3b9 100644
--- a/eval_intern.h
+++ b/eval_intern.h
@@ -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 */
diff --git a/load.c b/load.c
index f642019053..5f72d5510a 100644
--- a/load.c
+++ b/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
diff --git a/ruby.c b/ruby.c
index 950c3e1ce0..5fdcb67c6b 100644
--- a/ruby.c
+++ b/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);
diff --git a/symbian/setup b/symbian/setup
index cb28157b69..c3ce317ad5 100644
--- a/symbian/setup
+++ b/symbian/setup
@@ -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)"