mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* win32/win32.c: just uniformed method style.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@8924 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
499b7d852a
commit
4d11a486ae
1 changed files with 40 additions and 36 deletions
|
@ -248,7 +248,8 @@ static struct {
|
||||||
/* interrupt stuff */
|
/* interrupt stuff */
|
||||||
static HANDLE interrupted_event;
|
static HANDLE interrupted_event;
|
||||||
|
|
||||||
HANDLE GetCurrentThreadHandle(void)
|
HANDLE
|
||||||
|
GetCurrentThreadHandle(void)
|
||||||
{
|
{
|
||||||
static HANDLE current_process_handle = NULL;
|
static HANDLE current_process_handle = NULL;
|
||||||
HANDLE h;
|
HANDLE h;
|
||||||
|
@ -386,7 +387,8 @@ NtInitialize(int *argc, char ***argv)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
char *getlogin()
|
char *
|
||||||
|
getlogin()
|
||||||
{
|
{
|
||||||
char buffer[200];
|
char buffer[200];
|
||||||
DWORD len = 200;
|
DWORD len = 200;
|
||||||
|
@ -461,7 +463,8 @@ FindFreeChildSlot(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int SafeFree(char **vec, int vecc)
|
int
|
||||||
|
SafeFree(char **vec, int vecc)
|
||||||
{
|
{
|
||||||
// vec
|
// vec
|
||||||
// |
|
// |
|
||||||
|
@ -729,9 +732,7 @@ pipe_exec(char *cmd, int mode, FILE **fpr, FILE **fpw)
|
||||||
extern VALUE rb_last_status;
|
extern VALUE rb_last_status;
|
||||||
|
|
||||||
int
|
int
|
||||||
do_spawn(mode, cmd)
|
do_spawn(int mode, char *cmd)
|
||||||
int mode;
|
|
||||||
char *cmd;
|
|
||||||
{
|
{
|
||||||
struct ChildRecord *child;
|
struct ChildRecord *child;
|
||||||
DWORD exitcode;
|
DWORD exitcode;
|
||||||
|
@ -768,10 +769,7 @@ char *cmd;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
do_aspawn(mode, prog, argv)
|
do_aspawn(int mode, char *prog, char **argv)
|
||||||
int mode;
|
|
||||||
char *prog;
|
|
||||||
char **argv;
|
|
||||||
{
|
{
|
||||||
char *cmd, *p, *q, *s, **t;
|
char *cmd, *p, *q, *s, **t;
|
||||||
int len, n, bs, quote;
|
int len, n, bs, quote;
|
||||||
|
@ -2404,9 +2402,9 @@ void endservent() {}
|
||||||
|
|
||||||
struct netent *getnetent (void) {return (struct netent *) NULL;}
|
struct netent *getnetent (void) {return (struct netent *) NULL;}
|
||||||
|
|
||||||
struct netent *getnetbyaddr(char *name) {return (struct netent *)NULL;}
|
struct netent *getnetbyaddr(long net, int type) {return (struct netent *)NULL;}
|
||||||
|
|
||||||
struct netent *getnetbyname(long net, int type) {return (struct netent *)NULL;}
|
struct netent *getnetbyname(char *name) {return (struct netent *)NULL;}
|
||||||
|
|
||||||
struct protoent *getprotoent (void) {return (struct protoent *) NULL;}
|
struct protoent *getprotoent (void) {return (struct protoent *) NULL;}
|
||||||
|
|
||||||
|
@ -2573,9 +2571,7 @@ gettimeofday(struct timeval *tv, struct timezone *tz)
|
||||||
}
|
}
|
||||||
|
|
||||||
char *
|
char *
|
||||||
rb_w32_getcwd(buffer, size)
|
rb_w32_getcwd(char *buffer, int size)
|
||||||
char *buffer;
|
|
||||||
int size;
|
|
||||||
{
|
{
|
||||||
int length;
|
int length;
|
||||||
char *bp;
|
char *bp;
|
||||||
|
@ -2902,7 +2898,8 @@ rb_w32_times(struct tms *tmbuf)
|
||||||
#define yield_once() Sleep(0)
|
#define yield_once() Sleep(0)
|
||||||
#define yield_until(condition) do yield_once(); while (!(condition))
|
#define yield_until(condition) do yield_once(); while (!(condition))
|
||||||
|
|
||||||
static DWORD wait_events(HANDLE event, DWORD timeout)
|
static DWORD
|
||||||
|
wait_events(HANDLE event, DWORD timeout)
|
||||||
{
|
{
|
||||||
HANDLE events[2];
|
HANDLE events[2];
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
@ -2923,7 +2920,8 @@ static DWORD wait_events(HANDLE event, DWORD timeout)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static CRITICAL_SECTION* system_state(void)
|
static CRITICAL_SECTION *
|
||||||
|
system_state(void)
|
||||||
{
|
{
|
||||||
static int initialized = 0;
|
static int initialized = 0;
|
||||||
static CRITICAL_SECTION syssect;
|
static CRITICAL_SECTION syssect;
|
||||||
|
@ -2938,7 +2936,8 @@ static CRITICAL_SECTION* system_state(void)
|
||||||
static LONG flag_interrupt = -1;
|
static LONG flag_interrupt = -1;
|
||||||
static volatile DWORD tlsi_interrupt = TLS_OUT_OF_INDEXES;
|
static volatile DWORD tlsi_interrupt = TLS_OUT_OF_INDEXES;
|
||||||
|
|
||||||
void rb_w32_enter_critical(void)
|
void
|
||||||
|
rb_w32_enter_critical(void)
|
||||||
{
|
{
|
||||||
if (IsWinNT()) {
|
if (IsWinNT()) {
|
||||||
EnterCriticalSection(system_state());
|
EnterCriticalSection(system_state());
|
||||||
|
@ -2959,7 +2958,8 @@ void rb_w32_enter_critical(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void rb_w32_leave_critical(void)
|
void
|
||||||
|
rb_w32_leave_critical(void)
|
||||||
{
|
{
|
||||||
if (IsWinNT()) {
|
if (IsWinNT()) {
|
||||||
LeaveCriticalSection(system_state());
|
LeaveCriticalSection(system_state());
|
||||||
|
@ -2978,7 +2978,8 @@ struct handler_arg_t {
|
||||||
HANDLE handshake;
|
HANDLE handshake;
|
||||||
};
|
};
|
||||||
|
|
||||||
static void rb_w32_call_handler(struct handler_arg_t* h)
|
static void
|
||||||
|
rb_w32_call_handler(struct handler_arg_t* h)
|
||||||
{
|
{
|
||||||
int status;
|
int status;
|
||||||
RUBY_CRITICAL(rb_protect((VALUE (*)(VALUE))h->handler, (VALUE)h->arg, &h->status);
|
RUBY_CRITICAL(rb_protect((VALUE (*)(VALUE))h->handler, (VALUE)h->arg, &h->status);
|
||||||
|
@ -2991,9 +2992,8 @@ static void rb_w32_call_handler(struct handler_arg_t* h)
|
||||||
yield_until(0);
|
yield_until(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct handler_arg_t* setup_handler(struct handler_arg_t *harg,
|
static struct handler_arg_t *
|
||||||
int arg,
|
setup_handler(struct handler_arg_t *harg, int arg, void (*handler)(int),
|
||||||
void (*handler)(int),
|
|
||||||
HANDLE handshake)
|
HANDLE handshake)
|
||||||
{
|
{
|
||||||
harg->handler = handler;
|
harg->handler = handler;
|
||||||
|
@ -3004,7 +3004,8 @@ static struct handler_arg_t* setup_handler(struct handler_arg_t *harg,
|
||||||
return harg;
|
return harg;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void setup_call(CONTEXT* ctx, struct handler_arg_t *harg)
|
static void
|
||||||
|
setup_call(CONTEXT* ctx, struct handler_arg_t *harg)
|
||||||
{
|
{
|
||||||
#ifdef _M_IX86
|
#ifdef _M_IX86
|
||||||
DWORD *esp = (DWORD *)ctx->Esp;
|
DWORD *esp = (DWORD *)ctx->Esp;
|
||||||
|
@ -3019,7 +3020,8 @@ static void setup_call(CONTEXT* ctx, struct handler_arg_t *harg)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int rb_w32_main_context(int arg, void (*handler)(int))
|
int
|
||||||
|
rb_w32_main_context(int arg, void (*handler)(int))
|
||||||
{
|
{
|
||||||
static HANDLE interrupt_done = NULL;
|
static HANDLE interrupt_done = NULL;
|
||||||
struct handler_arg_t harg;
|
struct handler_arg_t harg;
|
||||||
|
@ -3080,7 +3082,8 @@ int rb_w32_main_context(int arg, void (*handler)(int))
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
int rb_w32_sleep(unsigned long msec)
|
int
|
||||||
|
rb_w32_sleep(unsigned long msec)
|
||||||
{
|
{
|
||||||
DWORD ret;
|
DWORD ret;
|
||||||
RUBY_CRITICAL(ret = wait_events(NULL, msec));
|
RUBY_CRITICAL(ret = wait_events(NULL, msec));
|
||||||
|
@ -3089,7 +3092,8 @@ int rb_w32_sleep(unsigned long msec)
|
||||||
return ret != WAIT_TIMEOUT;
|
return ret != WAIT_TIMEOUT;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void catch_interrupt(void)
|
static void
|
||||||
|
catch_interrupt(void)
|
||||||
{
|
{
|
||||||
yield_once();
|
yield_once();
|
||||||
RUBY_CRITICAL(wait_events(NULL, 0));
|
RUBY_CRITICAL(wait_events(NULL, 0));
|
||||||
|
@ -3097,7 +3101,8 @@ static void catch_interrupt(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
#undef fgetc
|
#undef fgetc
|
||||||
int rb_w32_getc(FILE* stream)
|
int
|
||||||
|
rb_w32_getc(FILE* stream)
|
||||||
{
|
{
|
||||||
int c, trap_immediate = rb_trap_immediate;
|
int c, trap_immediate = rb_trap_immediate;
|
||||||
#ifndef _WIN32_WCE
|
#ifndef _WIN32_WCE
|
||||||
|
@ -3121,7 +3126,8 @@ int rb_w32_getc(FILE* stream)
|
||||||
}
|
}
|
||||||
|
|
||||||
#undef fputc
|
#undef fputc
|
||||||
int rb_w32_putc(int c, FILE* stream)
|
int
|
||||||
|
rb_w32_putc(int c, FILE* stream)
|
||||||
{
|
{
|
||||||
int trap_immediate = rb_trap_immediate;
|
int trap_immediate = rb_trap_immediate;
|
||||||
#ifndef _WIN32_WCE
|
#ifndef _WIN32_WCE
|
||||||
|
@ -3228,7 +3234,8 @@ rb_w32_asynchronize(asynchronous_func_t func, VALUE self,
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
|
||||||
char **rb_w32_get_environ(void)
|
char **
|
||||||
|
rb_w32_get_environ(void)
|
||||||
{
|
{
|
||||||
char *envtop, *env;
|
char *envtop, *env;
|
||||||
char **myenvtop, **myenv;
|
char **myenvtop, **myenv;
|
||||||
|
@ -3261,7 +3268,8 @@ char **rb_w32_get_environ(void)
|
||||||
return myenvtop;
|
return myenvtop;
|
||||||
}
|
}
|
||||||
|
|
||||||
void rb_w32_free_environ(char **env)
|
void
|
||||||
|
rb_w32_free_environ(char **env)
|
||||||
{
|
{
|
||||||
char **t = env;
|
char **t = env;
|
||||||
|
|
||||||
|
@ -3344,10 +3352,6 @@ unixtime_to_filetime(time_t time, FILETIME *ft)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#undef utime
|
|
||||||
#ifdef __BORLANDC__
|
|
||||||
#define utime _utime
|
|
||||||
#endif
|
|
||||||
int
|
int
|
||||||
rb_w32_utime(const char *path, struct utimbuf *times)
|
rb_w32_utime(const char *path, struct utimbuf *times)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue