summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1998-04-14 04:55:53 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1998-04-14 04:55:53 +0000
commita1a693e138392467ca74fb4ba5b071dd7675960e (patch)
tree7586388b543e40af025fa9e03a63b442eb254009 /ext
parentd453b1a042a4483e74b17d66c7d88ec0c60b964a (diff)
signal delivered to main_thread
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/v1_1r@166 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext')
-rw-r--r--ext/dbm/dbm.c2
-rw-r--r--ext/dbm/extconf.rb1
-rw-r--r--ext/gtk/gtk.c110
-rw-r--r--ext/socket/socket.c16
4 files changed, 114 insertions, 15 deletions
diff --git a/ext/dbm/dbm.c b/ext/dbm/dbm.c
index 98c406ace0..2ecc725ecb 100644
--- a/ext/dbm/dbm.c
+++ b/ext/dbm/dbm.c
@@ -328,7 +328,9 @@ fdbm_store(obj, keystr, valstr)
dbmp->di_size = -1;
dbm = dbmp->di_dbm;
if (dbm_store(dbm, key, val, DBM_REPLACE)) {
+#ifdef HAVE_DBM_CLAERERR
dbm_clearerr(dbm);
+#endif
if (errno == EPERM) rb_sys_fail(Qnil);
Fail("dbm_store failed");
}
diff --git a/ext/dbm/extconf.rb b/ext/dbm/extconf.rb
index 4a5d41f275..595640737d 100644
--- a/ext/dbm/extconf.rb
+++ b/ext/dbm/extconf.rb
@@ -1,5 +1,6 @@
$LDFLAGS = "-L/usr/local/lib"
have_library("gdbm", "dbm_open") or have_library("dbm", "dbm_open")
if have_func("dbm_open")
+ have_func("dbm_clearerr")
create_makefile("dbm")
end
diff --git a/ext/gtk/gtk.c b/ext/gtk/gtk.c
index df0cf58eb1..418c677460 100644
--- a/ext/gtk/gtk.c
+++ b/ext/gtk/gtk.c
@@ -44,6 +44,7 @@ static VALUE gColorSel;
static VALUE gColorSelDialog;
static VALUE gImage;
static VALUE gDrawArea;
+static VALUE gEditable;
static VALUE gEntry;
static VALUE gEventBox;
static VALUE gFixed;
@@ -4430,6 +4431,98 @@ darea_size(self, w, h)
}
static VALUE
+edit_sel_region(self, start, end)
+ VALUE self, start, end;
+{
+ gtk_editable_select_region(GTK_EDITABLE(get_widget(self)),
+ NUM2INT(start), NUM2INT(end));
+ return self;
+}
+
+static VALUE
+edit_insert_text(self, new_text)
+ VALUE self;
+{
+ gint pos;
+
+ Check_Type(new_text, T_STRING);
+ gtk_editable_insert_text(GTK_EDITABLE(get_widget(self)),
+ RSTRING(new_text)->ptr,
+ RSTRING(new_text)->len,
+ &pos);
+ return INT2NUM(pos);
+}
+
+static VALUE
+edit_delete_text(self, start, end)
+ VALUE self, start, end;
+{
+ gtk_editable_delete_text(GTK_EDITABLE(get_widget(self)),
+ NUM2INT(start), NUM2INT(end));
+ return self;
+}
+
+static VALUE
+edit_get_chars(self, start, end)
+ VALUE self, start, end;
+{
+ gchar *s;
+
+ s = gtk_editable_get_chars(GTK_EDITABLE(get_widget(self)),
+ NUM2INT(start), NUM2INT(end));
+ return str_new2(s);
+}
+
+static VALUE
+edit_cut_clipboard(self, time)
+ VALUE self, time;
+{
+ gtk_editable_cut_clipboard(GTK_EDITABLE(get_widget(self)),NUM2INT(time));
+ return self;
+}
+
+static VALUE
+edit_copy_clipboard(self, time)
+ VALUE self, time;
+{
+ gtk_editable_copy_clipboard(GTK_EDITABLE(get_widget(self)),NUM2INT(time));
+ return self;
+}
+
+static VALUE
+edit_paste_clipboard(self, time)
+ VALUE self, time;
+{
+ gtk_editable_paste_clipboard(GTK_EDITABLE(get_widget(self)),NUM2INT(time));
+ return self;
+}
+
+static VALUE
+edit_claim_selection(self, claim, time)
+ VALUE self, claim, time;
+{
+ gtk_editable_claim_selection(GTK_EDITABLE(get_widget(self)),
+ RTEST(claim), NUM2INT(time));
+ return self;
+}
+
+static VALUE
+edit_delete_selection(self)
+ VALUE self;
+{
+ gtk_editable_delete_selection(GTK_EDITABLE(get_widget(self)));
+ return self;
+}
+
+static VALUE
+edit_changed(self)
+ VALUE self;
+{
+ gtk_editable_changed(GTK_EDITABLE(get_widget(self)));
+ return self;
+}
+
+static VALUE
entry_initialize(self)
VALUE self;
{
@@ -5625,7 +5718,8 @@ Init_gtk()
gColorSelDialog = rb_define_class_under(mGtk, "ColorSelectionDialog", gWindow);
gImage = rb_define_class_under(mGtk, "Image", gMisc);
gDrawArea = rb_define_class_under(mGtk, "DrawingArea", gWidget);
- gEntry = rb_define_class_under(mGtk, "Entry", gWidget);
+ gEditable = rb_define_class_under(mGtk, "Editable", gWidget);
+ gEntry = rb_define_class_under(mGtk, "Entry", gEditable);
gEventBox = rb_define_class_under(mGtk, "EventBox", gBin);
gFixed = rb_define_class_under(mGtk, "Fixed", gContainer);
gGamma = rb_define_class_under(mGtk, "GammaCurve", gVBox);
@@ -5666,7 +5760,7 @@ Init_gtk()
gProgressBar = rb_define_class_under(mGtk, "ProgressBar", gWidget);
gScrolledWin = rb_define_class_under(mGtk, "ScrolledWindow", gContainer);
gTable = rb_define_class_under(mGtk, "Table", gContainer);
- gText = rb_define_class_under(mGtk, "Text", gWidget);
+ gText = rb_define_class_under(mGtk, "Text", gEditable);
gToolbar = rb_define_class_under(mGtk, "Toolbar", gContainer);
gTooltips = rb_define_class_under(mGtk, "Tooltips", cData);
gTree = rb_define_class_under(mGtk, "Tree", gContainer);
@@ -5958,6 +6052,18 @@ Init_gtk()
rb_define_method(gDrawArea, "initialize", darea_initialize, 0);
rb_define_method(gDrawArea, "size", darea_size, 2);
+ /* Editable */
+ rb_define_method(gEditable, "select_region", edit_sel_region, 2);
+ rb_define_method(gEditable, "insert_text", edit_insert_text, 3);
+ rb_define_method(gEditable, "delete_text", edit_delete_text, 2);
+ rb_define_method(gEditable, "get_chars", edit_get_chars, 2);
+ rb_define_method(gEditable, "cut_clipboard", edit_cut_clipboard, 1);
+ rb_define_method(gEditable, "copy_clipboard", edit_copy_clipboard, 1);
+ rb_define_method(gEditable, "paste_clipboard", edit_paste_clipboard, 1);
+ rb_define_method(gEditable, "claim_selection", edit_claim_selection, 2);
+ rb_define_method(gEditable, "delete_selection", edit_delete_selection, 0);
+ rb_define_method(gEditable, "changed", edit_changed, 0);
+
/* Entry */
rb_define_method(gEntry, "initialize", entry_initialize, 0);
rb_define_method(gEntry, "set_text", entry_set_text, 1);
diff --git a/ext/socket/socket.c b/ext/socket/socket.c
index 0b3090124a..5aaff22c04 100644
--- a/ext/socket/socket.c
+++ b/ext/socket/socket.c
@@ -94,6 +94,7 @@ sock_new(class, fd)
fp->f2 = rb_fdopen(fd, "w");
fp->mode = FMODE_READWRITE;
io_unbuffered(fp);
+ obj_call_init((VALUE)sock);
return (VALUE)sock;
}
@@ -543,7 +544,6 @@ tcp_s_open(class, host, serv)
VALUE s;
Check_SafeStr(host);
s = open_inet(class, host, serv, INET_CLIENT);
- obj_call_init(s);
return s;
}
@@ -562,7 +562,6 @@ socks_s_open(class, host, serv)
Check_SafeStr(host);
s = open_inet(class, host, serv, INET_SOCKS);
- obj_call_init(s);
return s;
}
#endif
@@ -579,7 +578,6 @@ tcp_svr_s_open(argc, argv, class)
s = open_inet(class, arg1, arg2, INET_SERVER);
else
s = open_inet(class, 0, arg1, INET_SERVER);
- obj_call_init(s);
return s;
}
@@ -812,7 +810,6 @@ udp_s_open(class)
VALUE s;
s = sock_new(class, socket(AF_INET, SOCK_DGRAM, 0));
- obj_call_init(s);
return s;
}
@@ -958,7 +955,6 @@ unix_s_sock_open(sock, path)
{
VALUE s;
s = open_unix(sock, path, 0);
- obj_call_init(s);
return s;
}
@@ -985,7 +981,6 @@ unix_svr_s_open(sock, path)
{
VALUE s;
s = open_unix(sock, path, 1);
- obj_call_init(s);
return s;
}
@@ -1144,20 +1139,15 @@ sock_s_open(class, domain, type, protocol)
setup_domain_and_type(domain, &d, type, &t);
fd = socket(d, t, NUM2INT(protocol));
if (fd < 0) rb_sys_fail("socket(2)");
- s = sock_new(class, fd);
- obj_call_init(s);
- return s;
+ return sock_new(class, fd);
}
static VALUE
sock_s_for_fd(class, fd)
VALUE class, fd;
{
- VALUE s = sock_new(class, NUM2INT(fd));
-
- obj_call_init(s);
- return s;
+ return sock_new(class, NUM2INT(fd));
}
static VALUE