summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
Diffstat (limited to 'ext')
-rw-r--r--ext/extmk.rb.nt3
-rw-r--r--ext/gdbm/extconf.rb6
-rw-r--r--ext/pty/pty.c2
-rw-r--r--ext/readline/readline.c81
-rw-r--r--ext/socket/addrinfo.h7
-rw-r--r--ext/tcltklib/tcltklib.c51
6 files changed, 108 insertions, 42 deletions
diff --git a/ext/extmk.rb.nt b/ext/extmk.rb.nt
index 379d1bbb41..436cac295f 100644
--- a/ext/extmk.rb.nt
+++ b/ext/extmk.rb.nt
@@ -59,6 +59,7 @@ def older(file1, file2)
return false
end
+CFLAGS = ""
#LINK = "cl -o conftest.exe -I../.. -Zi -O -I. %s conftest.c %s > nul"
LINK = "cl -o conftest.exe -Zi -O %s conftest.c %s > nul"
CPP = "cl -E -I../.. -I../../missing -I../../win32 -I. -Zi -O %s conftest.c > nul"
@@ -435,8 +436,6 @@ def extmake(target)
return if $nodynamic and not $static
- $CFLAGS = nil
- $LDFLAGS = nil
$LOCAL_LIBS = "" # to be assigned in extconf.rb
$CFLAGS = ""
$LDFLAGS = ""
diff --git a/ext/gdbm/extconf.rb b/ext/gdbm/extconf.rb
index 3c36f29f14..bb51ac8971 100644
--- a/ext/gdbm/extconf.rb
+++ b/ext/gdbm/extconf.rb
@@ -1,7 +1,7 @@
require 'mkmf'
$LDFLAGS = "-L/usr/local/lib"
-have_library("gdbm", "gdbm_open")
-have_header("gdbm.h")
-if have_func("gdbm_open")
+if have_library("gdbm", "gdbm_open") and
+ have_header("gdbm.h") and
+ have_func("gdbm_open") then
create_makefile("gdbm")
end
diff --git a/ext/pty/pty.c b/ext/pty/pty.c
index 3748b55e47..8184b90185 100644
--- a/ext/pty/pty.c
+++ b/ext/pty/pty.c
@@ -180,7 +180,7 @@ chld_changed()
rb_raise(rb_eRuntimeError, "Stopped: %d",cpid);
}
#else
-#error "Either IF_STOPPED or WIFSTOPPED is needed"
+---->> Either IF_STOPPED or WIFSTOPPED is needed <<----
#endif /* WIFSTOPPED */
#endif /* IF_STOPPED */
if (n >= 0) {
diff --git a/ext/readline/readline.c b/ext/readline/readline.c
index dbee8c7963..60d45bf56b 100644
--- a/ext/readline/readline.c
+++ b/ext/readline/readline.c
@@ -23,7 +23,10 @@ readline_event()
}
static VALUE
-readline_readline(int argc, VALUE *argv, VALUE self)
+readline_readline(argc, argv, self)
+ int argc;
+ VALUE *argv;
+ VALUE self;
{
VALUE tmp, add_hist, result;
char *prompt = NULL;
@@ -45,7 +48,9 @@ readline_readline(int argc, VALUE *argv, VALUE self)
}
static VALUE
-readline_s_set_completion_proc(VALUE self, VALUE proc)
+readline_s_set_completion_proc(self, proc)
+ VALUE self;
+ VALUE proc;
{
if (!rb_respond_to(proc, rb_intern("call")))
rb_raise(rb_eArgError, "argument have to respond to `call'");
@@ -53,25 +58,32 @@ readline_s_set_completion_proc(VALUE self, VALUE proc)
}
static VALUE
-readline_s_get_completion_proc(VALUE self)
+readline_s_get_completion_proc(self)
+ VALUE self;
{
return rb_iv_get(mReadline, COMPLETION_PROC);
}
static VALUE
-readline_s_set_completion_case_fold(VALUE self, VALUE val)
+readline_s_set_completion_case_fold(self, val)
+ VALUE self;
+ VALUE val;
{
return rb_iv_set(mReadline, COMPLETION_CASE_FOLD, val);
}
static VALUE
-readline_s_get_completion_case_fold(VALUE self)
+readline_s_get_completion_case_fold(self)
+ VALUE self;
{
return rb_iv_get(mReadline, COMPLETION_CASE_FOLD);
}
static char **
-readline_attempted_completion_function(char *text, int start, int end)
+readline_attempted_completion_function(text, start, end)
+ char *text;
+ int start;
+ int end;
{
VALUE proc, ary, temp;
char **result;
@@ -133,27 +145,32 @@ readline_attempted_completion_function(char *text, int start, int end)
}
static VALUE
-readline_s_vi_editing_mode(VALUE self)
+readline_s_vi_editing_mode(self)
+ VALUE self;
{
rl_vi_editing_mode(1,0);
return Qnil;
}
static VALUE
-readline_s_emacs_editing_mode(VALUE self)
+readline_s_emacs_editing_mode(self)
+ VALUE self;
{
rl_emacs_editing_mode(1,0);
return Qnil;
}
static VALUE
-hist_to_s(VALUE self)
+hist_to_s(self)
+ VALUE self;
{
return rb_str_new2("HISTORY");
}
static VALUE
-hist_get(VALUE self, VALUE index)
+hist_get(self, index)
+ VALUE self;
+ VALUE index;
{
HISTORY_STATE *state;
int i;
@@ -167,7 +184,10 @@ hist_get(VALUE self, VALUE index)
}
static VALUE
-hist_set(VALUE self, VALUE index, VALUE str)
+hist_set(self, index, str)
+ VALUE self;
+ VALUE index;
+ VALUE str;
{
HISTORY_STATE *state;
int i;
@@ -182,15 +202,19 @@ hist_set(VALUE self, VALUE index, VALUE str)
}
static VALUE
-hist_push(VALUE self, VALUE str)
+hist_push(self, str)
+ VALUE self;
+ VALUE str;
{
add_history(STR2CSTR(str));
return self;
}
static VALUE
-hist_push_method(int argc, VALUE *argv,
- VALUE self)
+hist_push_method(argc, argv, self)
+ int argc;
+ VALUE *argv;
+ VALUE self;
{
VALUE str;
@@ -202,7 +226,8 @@ hist_push_method(int argc, VALUE *argv,
}
static VALUE
-hist_pop(VALUE self)
+hist_pop(self)
+ VALUE self;
{
HISTORY_STATE *state;
HIST_ENTRY *entry;
@@ -217,7 +242,8 @@ hist_pop(VALUE self)
}
static VALUE
-hist_shift(VALUE self)
+hist_shift(self)
+ VALUE self;
{
HISTORY_STATE *state;
HIST_ENTRY *entry;
@@ -232,7 +258,8 @@ hist_shift(VALUE self)
}
static VALUE
-hist_each(VALUE self)
+hist_each(self)
+ VALUE self;
{
HISTORY_STATE *state;
int i;
@@ -245,7 +272,8 @@ hist_each(VALUE self)
}
static VALUE
-hist_length(VALUE self)
+hist_length(self)
+ VALUE self;
{
HISTORY_STATE *state;
@@ -254,7 +282,8 @@ hist_length(VALUE self)
}
static VALUE
-hist_empty_p(VALUE self)
+hist_empty_p(self)
+ VALUE self;
{
HISTORY_STATE *state;
@@ -266,7 +295,9 @@ hist_empty_p(VALUE self)
}
static VALUE
-hist_delete_at(VALUE self, VALUE index)
+hist_delete_at(self, index)
+ VALUE self;
+ VALUE index;
{
HISTORY_STATE *state;
HIST_ENTRY *entry;
@@ -282,7 +313,9 @@ hist_delete_at(VALUE self, VALUE index)
}
static VALUE
-filename_completion_proc_call(VALUE self, VALUE str)
+filename_completion_proc_call(self, str)
+ VALUE self;
+ VALUE str;
{
VALUE result;
char **matches;
@@ -307,7 +340,9 @@ filename_completion_proc_call(VALUE self, VALUE str)
}
static VALUE
-username_completion_proc_call(VALUE self, VALUE str)
+username_completion_proc_call(self, str)
+ VALUE self;
+ VALUE str;
{
VALUE result;
char **matches;
@@ -332,7 +367,7 @@ username_completion_proc_call(VALUE self, VALUE str)
}
void
-Init_readline(void)
+Init_readline()
{
VALUE histary, fcomp, ucomp;
diff --git a/ext/socket/addrinfo.h b/ext/socket/addrinfo.h
index d4e2091d69..6ea4a823f6 100644
--- a/ext/socket/addrinfo.h
+++ b/ext/socket/addrinfo.h
@@ -154,4 +154,11 @@ extern void freehostent __P((struct hostent *));
extern void freeaddrent __P((struct addrinfo *));
extern char *gai_strerror __P((int));
+/* In case there is no definition of offsetof() provided - though any proper
+Standard C system should have one. */
+
+#ifndef offsetof
+#define offsetof(p_type,field) ((size_t)&(((p_type *)0)->field))
+#endif
+
#endif
diff --git a/ext/tcltklib/tcltklib.c b/ext/tcltklib/tcltklib.c
index a08391b7bb..ffc6f2f57c 100644
--- a/ext/tcltklib/tcltklib.c
+++ b/ext/tcltklib/tcltklib.c
@@ -49,7 +49,8 @@ typedef struct {
} Tk_TimerData;
/* timer callback */
-void _timer_for_tcl (ClientData clientData)
+void _timer_for_tcl(clientData)
+ ClientData clientData;
{
Tk_TimerData *timer = (Tk_TimerData*)clientData;
@@ -64,7 +65,8 @@ void _timer_for_tcl (ClientData clientData)
/* execute Tk_MainLoop */
static VALUE
-lib_mainloop(VALUE self)
+lib_mainloop(self)
+ VALUE self;
{
Tk_TimerData *timer;
@@ -95,7 +97,9 @@ struct tcltkip {
/* Tcl command `ruby' */
static VALUE
-ip_eval_rescue(VALUE *failed, VALUE einfo)
+ip_eval_rescue(failed, einfo)
+ VALUE *failed;
+ VALUE einfo;
{
*failed = einfo;
return Qnil;
@@ -103,10 +107,17 @@ ip_eval_rescue(VALUE *failed, VALUE einfo)
static int
#if TCL_MAJOR_VERSION >= 8
-ip_ruby(ClientData clientData, Tcl_Interp *interp,
- int argc, Tcl_Obj *CONST argv[])
+ip_ruby(clientData, interp, argc, argv)
+ ClientData clientData;
+ Tcl_Interp *interp;
+ int argc;
+ Tcl_Obj *CONST argv[];
#else
-ip_ruby(ClientData clientData, Tcl_Interp *interp, int argc, char *argv[])
+ip_ruby(clientData, interp, argc, argv)
+ ClientData clientData;
+ Tcl_Interp *interp;
+ int argc;
+ char *argv[];
#endif
{
VALUE res;
@@ -163,7 +174,8 @@ ip_ruby(ClientData clientData, Tcl_Interp *interp, int argc, char *argv[])
/* destroy interpreter */
static void
-ip_free(struct tcltkip *ptr)
+ip_free(ptr)
+ struct tcltkip *ptr;
{
DUMP1("Tcl_DeleteInterp");
Tcl_DeleteInterp(ptr->ip);
@@ -172,7 +184,8 @@ ip_free(struct tcltkip *ptr)
/* create and initialize interpreter */
static VALUE
-ip_new(VALUE self)
+ip_new(self)
+ VALUE self;
{
struct tcltkip *ptr; /* tcltkip data struct */
VALUE obj; /* newly created object */
@@ -214,7 +227,9 @@ ip_new(VALUE self)
/* eval string in tcl by Tcl_Eval() */
static VALUE
-ip_eval(VALUE self, VALUE str)
+ip_eval(self, str)
+ VALUE self;
+ VALUE str;
{
char *s;
char *buf; /* Tcl_Eval requires re-writable string region */
@@ -240,7 +255,10 @@ ip_eval(VALUE self, VALUE str)
static VALUE
-ip_toUTF8(VALUE self, VALUE str, VALUE encodename)
+ip_toUTF8(self, str, encodename)
+ VALUE self;
+ VALUE str;
+ VALUE encodename;
{
#ifndef TCL_UTF_MAX
return str;
@@ -272,7 +290,10 @@ ip_toUTF8(VALUE self, VALUE str, VALUE encodename)
}
static VALUE
-ip_fromUTF8(VALUE self, VALUE str, VALUE encodename)
+ip_fromUTF8(self, str, encodename)
+ VALUE self;
+ VALUE str;
+ VALUE encodename;
{
#ifndef TCL_UTF_MAX
return str;
@@ -305,7 +326,10 @@ ip_fromUTF8(VALUE self, VALUE str, VALUE encodename)
static VALUE
-ip_invoke(int argc, VALUE *argv, VALUE obj)
+ip_invoke(argc, argv, obj)
+ int argc;
+ VALUE *argv;
+ VALUE obj;
{
struct tcltkip *ptr; /* tcltkip data struct */
int i;
@@ -384,7 +408,8 @@ ip_invoke(int argc, VALUE *argv, VALUE obj)
/* get return code from Tcl_Eval() */
static VALUE
-ip_retval(VALUE self)
+ip_retval(self)
+ VALUE self;
{
struct tcltkip *ptr; /* tcltkip data struct */