* main.c (main): use platform-independent per-process initialization.
[ruby-dev:31900] * ruby.c (ruby_sysinit): new function for per-process initialization. * include/ruby/ruby.h (RUBY_GLOBAL_SETUP): toplevel setup declaration. * include/ruby/win32.h, win32/mkexports.rb: alias NtInitialize ruby_sysinit. * win32/win32.c (rb_w32_sysinit): renamed from NtInitialize. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13569 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
43c4d80930
commit
400202f6a5
14
ChangeLog
14
ChangeLog
@ -1,3 +1,17 @@
|
|||||||
|
Sat Sep 29 17:45:22 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
|
* main.c (main): use platform-independent per-process initialization.
|
||||||
|
[ruby-dev:31900]
|
||||||
|
|
||||||
|
* ruby.c (ruby_sysinit): new function for per-process initialization.
|
||||||
|
|
||||||
|
* include/ruby/ruby.h (RUBY_GLOBAL_SETUP): toplevel setup declaration.
|
||||||
|
|
||||||
|
* include/ruby/win32.h, win32/mkexports.rb: alias NtInitialize
|
||||||
|
ruby_sysinit.
|
||||||
|
|
||||||
|
* win32/win32.c (rb_w32_sysinit): renamed from NtInitialize.
|
||||||
|
|
||||||
Sat Sep 29 17:31:04 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
|
Sat Sep 29 17:31:04 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||||
|
|
||||||
* array.c (rb_ary_combination): new method to give all combination
|
* array.c (rb_ary_combination): new method to give all combination
|
||||||
|
@ -958,6 +958,15 @@ rb_special_const_p(VALUE obj)
|
|||||||
static char *dln_libs_to_be_linked[] = { EXTLIB, 0 };
|
static char *dln_libs_to_be_linked[] = { EXTLIB, 0 };
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if (defined(__APPLE__) || defined(__NeXT__)) && defined(__MACH__)
|
||||||
|
/* to link startup code with ObjC support */
|
||||||
|
#define RUBY_GLOBAL_SETUP static void objcdummyfunction(void) {objc_msgSend();}
|
||||||
|
#else
|
||||||
|
#define RUBY_GLOBAL_SETUP
|
||||||
|
#endif
|
||||||
|
|
||||||
|
void ruby_sysinit(int *, char ***);
|
||||||
|
|
||||||
#define RUBY_VM 1 /* YARV */
|
#define RUBY_VM 1 /* YARV */
|
||||||
#define HAVE_NATIVETHREAD
|
#define HAVE_NATIVETHREAD
|
||||||
int is_ruby_native_thread(void);
|
int is_ruby_native_thread(void);
|
||||||
|
@ -204,7 +204,7 @@ struct timezone {
|
|||||||
#undef isascii
|
#undef isascii
|
||||||
#define isascii __isascii
|
#define isascii __isascii
|
||||||
#endif
|
#endif
|
||||||
extern void NtInitialize(int *, char ***);
|
#define NtInitialize ruby_sysinit
|
||||||
extern int rb_w32_cmdvector(const char *, char ***);
|
extern int rb_w32_cmdvector(const char *, char ***);
|
||||||
extern rb_pid_t rb_w32_pipe_exec(const char *, const char *, int, int *);
|
extern rb_pid_t rb_w32_pipe_exec(const char *, const char *, int, int *);
|
||||||
extern int flock(int fd, int oper);
|
extern int flock(int fd, int oper);
|
||||||
|
20
main.c
20
main.c
@ -13,18 +13,7 @@
|
|||||||
#undef RUBY_EXPORT
|
#undef RUBY_EXPORT
|
||||||
#include "ruby/ruby.h"
|
#include "ruby/ruby.h"
|
||||||
|
|
||||||
#if defined(__MACOS__) && defined(__MWERKS__)
|
RUBY_GLOBAL_SETUP
|
||||||
#include <console.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* to link startup code with ObjC support */
|
|
||||||
#if (defined(__APPLE__) || defined(__NeXT__)) && defined(__MACH__)
|
|
||||||
static void
|
|
||||||
objcdummyfunction(void)
|
|
||||||
{
|
|
||||||
objc_msgSend();
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int
|
int
|
||||||
main(int argc, char **argv, char **envp)
|
main(int argc, char **argv, char **envp)
|
||||||
@ -33,13 +22,8 @@ main(int argc, char **argv, char **envp)
|
|||||||
extern void ruby_set_debug_option(const char *);
|
extern void ruby_set_debug_option(const char *);
|
||||||
ruby_set_debug_option(getenv("RUBY_DEBUG"));
|
ruby_set_debug_option(getenv("RUBY_DEBUG"));
|
||||||
#endif
|
#endif
|
||||||
#ifdef _WIN32
|
|
||||||
NtInitialize(&argc, &argv);
|
|
||||||
#endif
|
|
||||||
#if defined(__MACOS__) && defined(__MWERKS__)
|
|
||||||
argc = ccommand(&argv);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
ruby_sysinit(&argc, &argv);
|
||||||
{
|
{
|
||||||
RUBY_INIT_STACK;
|
RUBY_INIT_STACK;
|
||||||
ruby_init();
|
ruby_init();
|
||||||
|
42
ruby.c
42
ruby.c
@ -47,6 +47,10 @@
|
|||||||
# define MAXPATHLEN 1024
|
# define MAXPATHLEN 1024
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(__MACOS__) && defined(__MWERKS__)
|
||||||
|
#include <console.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "ruby/util.h"
|
#include "ruby/util.h"
|
||||||
|
|
||||||
/* for gdb */
|
/* for gdb */
|
||||||
@ -1307,17 +1311,12 @@ ruby_process_options(int argc, char **argv)
|
|||||||
struct cmdline_options opt;
|
struct cmdline_options opt;
|
||||||
NODE *tree;
|
NODE *tree;
|
||||||
|
|
||||||
origarg.argc = argc;
|
|
||||||
origarg.argv = argv;
|
|
||||||
|
|
||||||
MEMZERO(&opt, opt, 1);
|
MEMZERO(&opt, opt, 1);
|
||||||
ruby_script(argv[0]); /* for the time being */
|
ruby_script(argv[0]); /* for the time being */
|
||||||
rb_argv0 = rb_progname;
|
rb_argv0 = rb_progname;
|
||||||
#if defined(USE_DLN_A_OUT)
|
#if defined(USE_DLN_A_OUT)
|
||||||
dln_argv0 = argv[0];
|
dln_argv0 = argv[0];
|
||||||
#endif
|
|
||||||
#if !defined(PSTAT_SETCMD) && !defined(HAVE_SETPROCTITLE)
|
|
||||||
origarg.len = get_arglen(origarg.argc, origarg.argv);
|
|
||||||
#endif
|
#endif
|
||||||
tree = process_options(argc, argv, &opt);
|
tree = process_options(argc, argv, &opt);
|
||||||
|
|
||||||
@ -1327,3 +1326,36 @@ ruby_process_options(int argc, char **argv)
|
|||||||
|
|
||||||
return tree;
|
return tree;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
ruby_sysinit(int *argc, char ***argv)
|
||||||
|
{
|
||||||
|
#if defined(__APPLE__) && (defined(__MACH__) || defined(__DARWIN__))
|
||||||
|
int i, n = *argc, len = 0;
|
||||||
|
char **v1 = *argv, **v2, *p;
|
||||||
|
|
||||||
|
for (i = 0; i < n; ++i) {
|
||||||
|
len += strlen(v1[i]) + 1;
|
||||||
|
}
|
||||||
|
v2 = malloc((n + 1)* sizeof(char*) + len);
|
||||||
|
p = (char *)&v2[n + 1];
|
||||||
|
for (i = 0; i < n; ++i) {
|
||||||
|
int l = strlen(v1[i]);
|
||||||
|
memcpy(p, v1[i], l + 1);
|
||||||
|
v2[i] = p;
|
||||||
|
p += l + 1;
|
||||||
|
}
|
||||||
|
v2[n] = 0;
|
||||||
|
*argv = v2;
|
||||||
|
#elif defined(__MACOS__) && defined(__MWERKS__)
|
||||||
|
*argc = ccommand(argv);
|
||||||
|
#elif defined(_WIN32)
|
||||||
|
void rb_w32_sysinit(int *argc, char ***argv);
|
||||||
|
rb_w32_sysinit(argc, argv);
|
||||||
|
#endif
|
||||||
|
origarg.argc = *argc;
|
||||||
|
origarg.argv = *argv;
|
||||||
|
#if !defined(PSTAT_SETCMD) && !defined(HAVE_SETPROCTITLE)
|
||||||
|
origarg.len = get_arglen(origarg.argc, origarg.argv);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
@ -50,6 +50,7 @@ class Exports
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
syms["NtInitialize"] ||= "ruby_sysinit" if syms["ruby_sysinit"]
|
||||||
@syms = syms
|
@syms = syms
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -419,7 +419,7 @@ exit_handler(void)
|
|||||||
// Initialization stuff
|
// Initialization stuff
|
||||||
//
|
//
|
||||||
void
|
void
|
||||||
NtInitialize(int *argc, char ***argv)
|
rb_w32_sysinit(int *argc, char ***argv)
|
||||||
{
|
{
|
||||||
|
|
||||||
WORD version;
|
WORD version;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user