Permalink
Browse files

20000105

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@598 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information...
1 parent a1d1b15 commit de7161526014b781468cea5d84411e23be945f79 matz committed Jan 5, 2000
Showing with 1,821 additions and 1,051 deletions.
  1. +144 −0 ChangeLog
  2. +9 −6 Makefile.in
  3. +1 −0 README
  4. +29 −26 README.jp
  5. +1 −0 ToDo
  6. +135 −31 array.c
  7. +65 −15 bignum.c
  8. +1 −1 class.c
  9. +1 −1 compar.c
  10. +4 −4 configure
  11. +43 −28 configure.in
  12. +2 −3 cygwin/GNUmakefile.in
  13. +2 −2 defines.h
  14. +1 −1 dir.c
  15. +1 −1 dln.c
  16. +1 −1 enum.c
  17. +2 −2 error.c
  18. +151 −118 eval.c
  19. +7 −8 ext/Win32API/Win32API.c
  20. +2 −9 ext/socket/socket.c
  21. +28 −66 ext/tk/lib/tk.rb
  22. +4 −8 ext/tk/lib/tkcanvas.rb
  23. +4 −8 ext/tk/lib/tktext.rb
  24. +153 −2 file.c
  25. +6 −2 gc.c
  26. +52 −104 hash.c
  27. +1 −1 inits.c
  28. +5 −2 intern.h
  29. +17 −17 io.c
  30. +1 −1 lib/cgi.rb
  31. +625 −323 lib/debug.rb
  32. +3 −1 lib/find.rb
  33. +3 −1 lib/mkmf.rb
  34. +2 −2 lib/timeout.rb
  35. +1 −1 main.c
  36. +59 −24 marshal.c
  37. +1 −1 math.c
  38. +10 −13 misc/ruby-mode.el
  39. +2 −0 missing/x68.c
  40. +1 −1 node.h
  41. +1 −1 numeric.c
  42. +2 −4 object.c
  43. +6 −6 pack.c
  44. +37 −19 parse.y
  45. +2 −2 prec.c
  46. +1 −1 process.c
  47. +1 −1 random.c
  48. +1 −1 range.c
  49. +33 −26 re.c
  50. +1 −1 re.h
  51. +7 −3 ruby.c
  52. +12 −18 ruby.h
  53. +1 −1 rubyio.h
  54. +1 −1 sample/mpart.rb
  55. +2 −2 signal.c
  56. +8 −10 sprintf.c
  57. +1 −1 st.c
  58. +1 −1 st.h
  59. +70 −39 string.c
  60. +8 −8 struct.c
  61. +10 −10 time.c
  62. +2 −12 util.c
  63. +1 −1 util.h
  64. +12 −0 variable.c
  65. +2 −2 version.c
  66. +1 −1 win32/Makefile
  67. +1 −1 win32/config.status
  68. +14 −41 win32/win32.c
  69. +2 −2 win32/win32.h
View
144 ChangeLog
@@ -1,3 +1,147 @@
+Wed Jan 5 02:14:46 2000 EGUCHI Osamu <eguchi@shizuokanet.ne.jp>
+
+ * parse.y: Fix SEGV on empty parens with UMINUS or UPLUS.
+
+Tue Jan 4 22:25:54 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * parse.y (stmt): `() while cond' dumped core.
+
+Tue Jan 4 06:04:14 2000 WATANABE Hirofumi <eban@os.rim.or.jp>
+
+ * configure.in: modify for cross-compiling.
+ use target_* instead of host_*.
+ use AC_CANONICAL_TARGET.
+
+ * Makefile.in: ditto.
+
+ * cygwin/GNUmakefile.in: ditto.
+
+Sat Jan 1 13:26:14 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * eval.c (rb_yield_0): force_recycle ruby_dyna_vars to performance
+ gain.
+
+ * array.c (rb_ary_delete_at_m): takes same argument pattern with
+ rb_ary_aref.
+
+Sat Jan 1 10:12:26 2000 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * ruby.h,util.c (rb_special_const_p): peep hole optimization.
+
+ * ruby.h,util.c (rb_test_false_or_nil): removed.
+
+ * ruby.h (RTEST, SPECIAL_CONST_P): peep hole optimization.
+
+ * ruby.h (FL_ABLE, FL_SET, FL_UNSET, FL_REVERSE): made expressions
+ not statements.
+
+ * ruby.h (OBJ_INFECT): newly added which copies taint from `s' to
+ `x'.
+
+Sat Jan 1 02:04:18 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * eval.c (rb_thread_safe_level): new method.
+
+ * eval.c (rb_yield_0): recycle dyna_var_map to reduce object
+ allocation.
+
+Fri Dec 31 00:52:48 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * eval.c: thread independent trace_func not needed.
+
+Thu Dec 30 14:47:31 1999 akira yamada <akira@ruby-lang.org>
+
+ * configure.in: specifies -soname in LIBRUBY_DLDFLAGS on linux
+ platforms.
+
+Thu Dec 30 10:51:27 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * array.c,io.c,hash,c,re.c,string.c: `_m' suffix instead of
+ `_method' for wrapper functions to implement method,
+ e.g. `rb_str_join_m()'.
+
+Thu Dec 30 02:08:02 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * bignum.c (rb_cstr2inum): non-numeric format check added.
+ currently it works only with base == 0 (i.e. Integer()).
+
+ * bignum.c (rb_str2inum): now takes VALUE to 1st argument. null
+ byte check added.
+
+ * array.c (rb_ary_replace): unless replacement is an array,
+ replacement shall be converted to array by `[replacement]', not
+ by `replacement.to_a'.
+
+ * array.c (rb_ary_plus): right operand must be an array.
+
+ * array.c (rb_ary_concat): argument must be an array.
+
+Mon Dec 27 12:35:47 1999 Katsuyuki Komatsu <komatsu@sarion.co.jp>
+
+ * ext/socket/socket.c (sock_finalize): mswin32: fix socket handle leak.
+
+ * win32/win32.c (myfdclose): ditto.
+
+Sun Dec 26 23:15:13 1999 Katsuyuki Komatsu <komatsu@sarion.co.jp>
+
+ * win32/win32.c (mypopen): raise catchable error instead of rb_fatal.
+ * win32/win32.c (mypclose): fix process handle laek.
+
+Sun Dec 26 16:17:11 1999 Katsuyuki Komatsu <komatsu@sarion.co.jp>
+
+ * ext/Win32API/Win32API.c (Win32API_initialize): use UINT2NUM
+ instead of INT2NUM to set __dll__ and __proc__.
+
+Sat Dec 25 00:08:59 1999 KANEKO Naoshi <wbs01621@mail.wbs.ne.jp>
+
+ * ext/Win32API/Win32API.c (Win32API_Call): remove 'dword ptr'
+ from _asm.
+
+Fri Dec 24 10:26:47 1999 Koji Oda <oda@bsd1.qnes.nec.co.jp>
+
+ * win32/win32.h: use "C++" linkage.
+
+Fri Dec 24 02:00:57 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * eval.c (THREAD_ALLOC): should initialize th->trace.
+
+Fri Dec 24 00:43:39 1999 KANEKO Naoshi <wbs01621@mail.wbs.ne.jp>
+
+ * io.c (pipe_open): check for `fptr->f == NULL'.
+ * win32/win32.c (mypopen): STDERR does not work during ` function.
+
+Tue Dec 21 17:21:28 1999 Koji Oda <oda@bsd1.qnes.nec.co.jp>
+
+ * ext/socket/socket.c (sock_finalize): mswin32: fix FILE* leak.
+
+Sun Dec 19 22:56:31 1999 KANEKO Naoshi <wbs01621@mail.wbs.ne.jp>
+
+ * lib/find.rb: support dosish root directory.
+ * win32/Makefile: ditto.
+ * win32/config.status: ditto.
+ * win32/win32.c (opendir): ditto.
+ * win32/win32.c (opendir): use CharPrev() to get last character
+ of the directory name.
+
+Sat Dec 18 03:00:01 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * file.c (path_check_1): check should be done by absolute path.
+
+ * marshal.c (r_ivar): should restore generic_ivar too.
+
+ * marshal.c (w_ivar): should dump generic_ivar too.
+
+Fri Dec 17 19:27:43 1999 IWAMURO Motonori <iwa@mmp.fujitsu.co.jp>
+
+ * eval.c (rb_load): should initialize ruby_frame->last_class.
+
+Wed Dec 15 01:35:29 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * ruby.c (proc_options): option to change directory changed to
+ `-C' like tar.
+
+ * ruby.c (proc_options): argv boundary check for `-X'.
+
Mon Dec 13 15:15:31 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
* regex.c (re_adjust_startpos): separate startpos adjustment
View
15 Makefile.in
@@ -81,8 +81,8 @@ OBJS = array.@OBJEXT@ \
version.@OBJEXT@ \
$(MISSING)
-all: miniruby$(EXEEXT) rbconfig.rb
- @./miniruby$(EXEEXT) -Xext extmk.rb @EXTSTATIC@
+all: miniruby$(EXEEXT) @PREP@ rbconfig.rb
+ @@MINIRUBY@ -Xext extmk.rb @EXTSTATIC@
miniruby$(EXEEXT): config.status $(LIBRUBY_A) $(MAINOBJ) dmyext.@OBJEXT@
@rm -f $@
@@ -98,16 +98,16 @@ $(LIBRUBY_A): $(OBJS) dmyext.@OBJEXT@
$(LIBRUBY_SO): $(OBJS) dmyext.@OBJEXT@
$(LDSHARED) $(DLDFLAGS) $(SOLIBS) $(OBJS) dmyext.@OBJEXT@ -o $@
- @-./miniruby -e 'ARGV.each{|link| File.delete link if File.exist? link; \
+ @-@MINIRUBY@ -e 'ARGV.each{|link| File.delete link if File.exist? link; \
File.symlink "$(LIBRUBY_SO)", link}' \
$(LIBRUBY_ALIASES) || true
install: rbconfig.rb
- ./miniruby$(EXEEXT) $(srcdir)/instruby.rb $(DESTDIR)
+ @MINIRUBY@ $(srcdir)/instruby.rb $(DESTDIR)
clean:; @rm -f $(OBJS) $(LIBRUBY_A) $(LIBRUBY_SO) $(LIBRUBY_ALIASES) $(MAINOBJ) rbconfig.rb
@rm -f ext/extinit.c ext/extinit.@OBJEXT@ dmyext.@OBJEXT@
- @-./miniruby$(EXEEXT) -Xext extmk.rb clean 2> /dev/null || true
+ @-@MINIRUBY@ -Xext extmk.rb clean 2> /dev/null || true
@rm -f $(PROGRAM) miniruby$(EXEEXT)
distclean: clean
@@ -123,7 +123,10 @@ test: miniruby$(EXEEXT)
@./miniruby$(EXEEXT) $(srcdir)/rubytest.rb
rbconfig.rb: miniruby$(EXEEXT)
- @./miniruby$(EXEEXT) $(srcdir)/mkconfig.rb rbconfig.rb
+ @@MINIRUBY@ $(srcdir)/mkconfig.rb rbconfig.rb
+
+prep.rb: miniruby$(EXEEXT)
+ @echo 'PLATFORM=RUBY_PLATFORM="@arch@"' > $@
config.status: $(srcdir)/configure
$(SHELL) ./config.status --recheck
View
1 README
@@ -116,6 +116,7 @@ You can redistribute it and/or modify it under either the terms of the GPL
4. You may modify and include the part of the software into any other
software (possibly commercial). But some files in the distribution
are not written by the author, so that they are not under this terms.
+
They are gc.c(partly), utils.c(partly), regex.[ch], st.[ch] and some
files under the ./missing directory. See each file for the copying
condition.
View
55 README.jp
@@ -135,29 +135,30 @@ UNIX
* ���۾��
-Ruby�ϥե꡼���եȥ������Ǥ���GPL(the GNU General Public
-License)�ޤ��ϰʲ��˼�������Ruby������ۤǤ��ޤ���GPL�ˤ
-���Ƥ�COPYING�ե�����򻲾Ȥ��Ʋ�������
+�ܥץ����ϥե꡼���եȥ������Ǥ���GPL(the GNU General
+Public License)�ޤ��ϰʲ��˼��������ܥץ���������ۤ
+���ޤ���GPL�ˤĤ��Ƥ�COPYING�ե�����򻲾Ȥ��Ʋ�������
1. ʣ�����¤ʤ���ͳ�Ǥ���
- 2. �ʲ��ξ��Τ����줫�����������˼긵��Ruby�Υ�������
- ͳ���ѹ��Ǥ��ޤ���
+ 2. �ʲ��ξ��Τ����줫�������������ܥץ����Υ�������
+ ��ͳ���ѹ��Ǥ��ޤ���
(a) �ͥåȥ˥塼���˥ݥ��Ȥ����ꡤ��Ԥ��ѹ������դ���
�ʤɤ���ˡ�ǡ��ѹ�����롥
- (b) �ѹ�����Ruby��ʬ�ν�°�����ȿ��������ǻȤ���
+ (b) �ѹ������ܥץ�����ʬ�ν�°�����ȿ���������
+ �Ȥ���
(c) �ѹ��������������������եȥ�������̾����ѹ����롥
- ���Υ��եȥ����������ۤ�����ˤ��ѹ����Ruby��Ʊ��
- �����ۤ��롥�ޤ����ѹ����Ruby�Υ�����������ˡ����
- �����롥
+ ���Υ��եȥ����������ۤ�����ˤ��ѹ�����ܥץ���
+ ���Ʊ�������ۤ��롥�ޤ����ѹ�����ܥץ����Υ���
+ ��������ˡ��������
(d) ����¾���ѹ������Ԥȹ�դ��롥
- 3. �ʲ��ξ��Τ����줫������������Ruby�򥪥֥������ȥ��
- �ɤ�¹Է���Ǥ����ۤǤ��ޤ���
+ 3. �ʲ��ξ��Τ����줫�������������ܥץ����򥳥�ѥ
+ �뤷�����֥������ȥ����ɤ�¹Է���Ǥ����ۤǤ��ޤ���
(a) �Х��ʥ����ä��ͤ�������������Ǥ���褦�ˡ�
������������ˡ��������롥
@@ -170,21 +171,23 @@ License)
(d) ����¾�����۾����Ԥȹ�դ��롥
4. ¾�Υץ����ؤΰ��ѤϤ����ʤ���Ū�Ǥ��켫ͳ�Ǥ�����
- �����Ruby�˴ޤޤ��¾�κ�Ԥˤ�륳���ɤϡ����줾���
- ��Ԥΰո��ˤ����¤��ä����ޤ�������Ū�ˤ�gc.c(����)��
- util.c(����)��st.[ch]��regex.[ch] ����� ./missing�ǥ�
- �쥯�ȥ겼�Υե����뷲������ޤ������줾������۾��
- �ʤɤ��դ��Ƥϳƥե�����򻲾Ȥ��Ƥ��������
-
- 5. Ruby�ؤ����ϤȤʤ륹����ץȤ���ӡ�Ruby����ν��Ϥθ�
- ���Ruby�κ�ԤǤϤʤ������줾��������Ϥ��������ͤ�
- °���ޤ����ޤ���Ruby���Ȥ߹��ि��γ�ĥ�饤�֥��ˤ�
- ���Ƥ�Ʊ�ͤǤ���
-
- 6. Ruby��̵�ݾڤǤ�����Ԥ�Ruby�򥵥ݡ��Ȥ���ջ֤Ϥ����
- ������Ruby���ȤΥХ����뤤��Ruby������ץȤΥХ��ʤɤ�
- ��ȯ����뤤���ʤ�»�����Ф��Ƥ���Ǥ����ޤ���
-
+ ������ܥץ����˴ޤޤ��¾�κ�Ԥˤ�륳���ɤϡ���
+ �줾��κ�Ԥΰո��ˤ����¤��ä�����礬����ޤ���
+
+ ����Ū�ˤ�gc.c(����)��util.c(����)��st.[ch]��regex.[ch]
+ ����� ./missing�ǥ��쥯�ȥ겼�Υե����뷲������ޤ���
+ ���줾������۾��ʤɤ��դ��Ƥϳƥե�����򻲾Ȥ��Ƥ�
+ �������
+
+ 5. �ܥץ����ؤ����ϤȤʤ륹����ץȤ���ӡ��ܥץ���
+ �फ��ν��Ϥθ�����ܥץ����κ�ԤǤϤʤ������줾
+ ��������Ϥ��������ͤ�°���ޤ����ޤ����ܥץ�����
+ �Ȥ߹��ޤ�뤿��γ�ĥ�饤�֥��ˤĤ��Ƥ�Ʊ�ͤǤ���
+
+ 6. �ܥץ�����̵�ݾڤǤ�����Ԥ��ܥץ����򥵥ݡ���
+ ����ջ֤Ϥ���ޤ������ץ���༫�ȤΥХ����뤤���ܥ�
+ �����μ¹Ԥʤɤ���ȯ����뤤���ʤ�»�����Ф��Ƥ���
+ Ǥ����ޤ���
* ���
View
1 ToDo
@@ -44,6 +44,7 @@ Standard Libraries
- sprintf/printf's $ to specify argument order
- Dir.glob("**/*.c") ala zsh
- Remove Enumerable#{size,length}
+* Marshal should handle generic instance variables.
* SyntaxError and NameError should not be subclasses of StandardError, maybe.
* debugger for thread programming
* Struct::new([name,]member,...) ??
View
166 array.c
@@ -6,7 +6,7 @@
$Date$
created at: Fri Aug 6 09:46:12 JST 1993
- Copyright (C) 1993-1999 Yukihiro Matsumoto
+ Copyright (C) 1993-2000 Yukihiro Matsumoto
************************************************/
@@ -268,7 +268,7 @@ rb_ary_push(ary, item)
}
static VALUE
-rb_ary_push_method(argc, argv, ary)
+rb_ary_push_m(argc, argv, ary)
int argc;
VALUE *argv;
VALUE ary;
@@ -292,6 +292,31 @@ rb_ary_pop(ary)
return RARRAY(ary)->ptr[--RARRAY(ary)->len];
}
+static VALUE
+rb_ary_pop_m(argc, argv, ary)
+ int argc;
+ VALUE *argv;
+ VALUE ary;
+{
+ int n = 1;
+ VALUE result;
+
+ if (argc == 0) {
+ return rb_ary_pop(ary);
+ }
+ if (argc > 2) {
+ rb_raise(rb_eArgError, "wrong # of arguments (%d for 1)", argc);
+ }
+ n = NUM2INT(argv[0]);
+ if (RARRAY(ary)->len < n)
+ n = RARRAY(ary)->len;
+ result = rb_ary_new2(n);
+ while (n--) {
+ rb_ary_store(result, n, rb_ary_pop(ary));
+ }
+ return result;
+}
+
VALUE
rb_ary_shift(ary)
VALUE ary;
@@ -314,6 +339,31 @@ rb_ary_shift(ary)
return top;
}
+static VALUE
+rb_ary_shift_m(argc, argv, ary)
+ int argc;
+ VALUE *argv;
+ VALUE ary;
+{
+ int n = 1;
+ VALUE result;
+
+ if (argc == 0) {
+ return rb_ary_shift(ary);
+ }
+ if (argc > 2) {
+ rb_raise(rb_eArgError, "wrong # of arguments (%d for 1)", argc);
+ }
+ n = NUM2INT(argv[0]);
+ if (RARRAY(ary)->len < n)
+ n = RARRAY(ary)->len;
+ result = rb_ary_new2(n);
+ while (n--) {
+ rb_ary_push(result, rb_ary_shift(ary));
+ }
+ return result;
+}
+
VALUE
rb_ary_unshift(ary, item)
VALUE ary, item;
@@ -506,8 +556,11 @@ rb_ary_replace(ary, beg, len, rpl)
len = RARRAY(ary)->len - beg;
}
- if (TYPE(rpl) != T_ARRAY) {
- rpl = rb_Array(rpl);
+ if (NIL_P(rpl)) {
+ rpl = rb_ary_new2(0);
+ }
+ else if (TYPE(rpl) != T_ARRAY) {
+ rpl = rb_ary_new3(1, rpl);
}
rb_ary_modify(ary);
@@ -631,19 +684,23 @@ static VALUE
rb_ary_clone(ary)
VALUE ary;
{
- VALUE ary2 = rb_ary_new2(RARRAY(ary)->len);
+ VALUE clone = rb_ary_new2(RARRAY(ary)->len);
- CLONESETUP(ary2, ary);
- MEMCPY(RARRAY(ary2)->ptr, RARRAY(ary)->ptr, VALUE, RARRAY(ary)->len);
- RARRAY(ary2)->len = RARRAY(ary)->len;
- return ary2;
+ CLONESETUP(clone, ary);
+ MEMCPY(RARRAY(clone)->ptr, RARRAY(ary)->ptr, VALUE, RARRAY(ary)->len);
+ RARRAY(clone)->len = RARRAY(ary)->len;
+ return clone;
}
static VALUE
rb_ary_dup(ary)
VALUE ary;
{
- return rb_ary_s_create(RARRAY(ary)->len, RARRAY(ary)->ptr, CLASS_OF(ary));
+ VALUE dup;
+
+ dup = rb_ary_s_create(RARRAY(ary)->len, RARRAY(ary)->ptr, CLASS_OF(ary));
+ if (OBJ_TAINTED(ary)) OBJ_TAINT(dup);
+ return dup;
}
static VALUE
@@ -668,10 +725,15 @@ rb_ary_join(ary, sep)
VALUE ary, sep;
{
long i;
+ int taint;
VALUE result, tmp;
+
if (RARRAY(ary)->len == 0) return rb_str_new(0, 0);
+ if (OBJ_TAINTED(ary)) taint = 1;
+ if (OBJ_TAINTED(sep)) taint = 1;
tmp = RARRAY(ary)->ptr[0];
+ if (OBJ_TAINTED(tmp)) taint = 1;
switch (TYPE(tmp)) {
case T_STRING:
result = rb_str_dup(tmp);
@@ -715,14 +777,15 @@ rb_ary_join(ary, sep)
}
if (!NIL_P(sep)) rb_str_concat(result, sep);
rb_str_cat(result, RSTRING(tmp)->ptr, RSTRING(tmp)->len);
- if (OBJ_TAINTED(tmp)) OBJ_TAINT(result);
+ if (OBJ_TAINTED(tmp)) taint = 1;
}
+ if (taint) OBJ_TAINT(result);
return result;
}
static VALUE
-rb_ary_join_method(argc, argv, ary)
+rb_ary_join_m(argc, argv, ary)
int argc;
VALUE *argv;
VALUE ary;
@@ -788,10 +851,14 @@ rb_protect_inspect(func, obj, arg)
inspect_tbl = rb_ary_new();
rb_thread_local_aset(rb_thread_current(), inspect_key, inspect_tbl);
}
+ if (rb_ary_includes(inspect_tbl, obj)) {
+ return (*func)(obj, arg);
+ }
rb_ary_push(inspect_tbl, obj);
iarg.func = func;
iarg.arg1 = obj;
iarg.arg2 = arg;
+
return rb_ensure(inspect_call, (VALUE)&iarg, inspect_ensure, obj);
}
@@ -866,7 +933,7 @@ rb_ary_reverse(ary)
}
static VALUE
-rb_ary_reverse_method(ary)
+rb_ary_reverse_m(ary)
VALUE ary;
{
return rb_ary_reverse(rb_ary_dup(ary));
@@ -985,11 +1052,11 @@ rb_ary_delete(ary, item)
}
VALUE
-rb_ary_delete_at(ary, at)
+rb_ary_delete_at(ary, pos)
VALUE ary;
- VALUE at;
+ long pos;
{
- long i, pos = NUM2LONG(at), len = RARRAY(ary)->len;
+ long i, len = RARRAY(ary)->len;
VALUE del = Qnil;
rb_ary_modify(ary);
@@ -1007,6 +1074,47 @@ rb_ary_delete_at(ary, at)
}
static VALUE
+rb_ary_delete_at_m(argc, argv, ary)
+ int argc;
+ VALUE *argv;
+ VALUE ary;
+{
+ VALUE arg1, arg2;
+ long pos, len, i;
+
+ rb_ary_modify(ary);
+ if (rb_scan_args(argc, argv, "11", &arg1, &arg2) == 2) {
+ pos = NUM2LONG(arg1);
+ len = NUM2LONG(arg2);
+ delete_pos_len:
+ if (pos < 0) {
+ pos = RARRAY(ary)->len + pos;
+ }
+ arg2 = rb_ary_subary(ary, pos, len);
+ rb_ary_replace(ary, pos, len, Qnil); /* Qnil/rb_ary_new2(0) */
+ return arg2;
+ }
+
+ if (!FIXNUM_P(arg1) && rb_range_beg_len(arg1, &pos, &len, RARRAY(ary)->len, 1)) {
+ goto delete_pos_len;
+ }
+
+ pos = NUM2LONG(arg1);
+ len = RARRAY(ary)->len;
+
+ if (pos >= len) return Qnil;
+ if (pos < 0) pos += len;
+ if (pos < 0) return Qnil;
+
+ arg2 = RARRAY(ary)->ptr[pos];
+ for (i = pos + 1; i < len; i++, pos++) {
+ RARRAY(ary)->ptr[pos] = RARRAY(ary)->ptr[i];
+ }
+ RARRAY(ary)->len = pos;
+
+ return arg2;
+}
+static VALUE
rb_ary_delete_if(ary)
VALUE ary;
{
@@ -1039,7 +1147,7 @@ rb_ary_filter(ary)
}
static VALUE
-rb_ary_replace_method(ary, ary2)
+rb_ary_replace_m(ary, ary2)
VALUE ary, ary2;
{
ary2 = to_ary(ary2);
@@ -1116,9 +1224,7 @@ rb_ary_plus(x, y)
{
VALUE z;
- if (TYPE(y) != T_ARRAY) {
- y = rb_Array(y);
- }
+ Check_Type(y, T_ARRAY);
z = rb_ary_new2(RARRAY(x)->len + RARRAY(y)->len);
MEMCPY(RARRAY(z)->ptr, RARRAY(x)->ptr, VALUE, RARRAY(x)->len);
@@ -1134,9 +1240,7 @@ rb_ary_concat(x, y)
VALUE *p, *pend;
rb_ary_modify(x);
- if (TYPE(y) != T_ARRAY) {
- y = rb_Array(y);
- }
+ Check_Type(y, T_ARRAY);
p = RARRAY(y)->ptr;
pend = p + RARRAY(y)->len;
@@ -1339,7 +1443,7 @@ rb_ary_or(ary1, ary2)
if (TYPE(ary2) != T_ARRAY) {
if (rb_ary_includes(ary1, ary2)) return ary1;
- else return rb_ary_plus(ary1, ary2);
+ else return rb_ary_push(ary1, ary2);
}
ary3 = rb_ary_new();
@@ -1495,9 +1599,9 @@ Init_Array()
rb_define_method(rb_cArray, "last", rb_ary_last, 0);
rb_define_method(rb_cArray, "concat", rb_ary_concat, 1);
rb_define_method(rb_cArray, "<<", rb_ary_push, 1);
- rb_define_method(rb_cArray, "push", rb_ary_push_method, -1);
- rb_define_method(rb_cArray, "pop", rb_ary_pop, 0);
- rb_define_method(rb_cArray, "shift", rb_ary_shift, 0);
+ rb_define_method(rb_cArray, "push", rb_ary_push_m, -1);
+ rb_define_method(rb_cArray, "pop", rb_ary_pop_m, -1);
+ rb_define_method(rb_cArray, "shift", rb_ary_shift_m, -1);
rb_define_method(rb_cArray, "unshift", rb_ary_unshift, 1);
rb_define_method(rb_cArray, "each", rb_ary_each, 0);
rb_define_method(rb_cArray, "each_index", rb_ary_each_index, 0);
@@ -1511,18 +1615,18 @@ Init_Array()
rb_define_method(rb_cArray, "indices", rb_ary_indexes, -1);
rb_define_method(rb_cArray, "clone", rb_ary_clone, 0);
rb_define_method(rb_cArray, "dup", rb_ary_dup, 0);
- rb_define_method(rb_cArray, "join", rb_ary_join_method, -1);
- rb_define_method(rb_cArray, "reverse", rb_ary_reverse_method, 0);
+ rb_define_method(rb_cArray, "join", rb_ary_join_m, -1);
+ rb_define_method(rb_cArray, "reverse", rb_ary_reverse_m, 0);
rb_define_method(rb_cArray, "reverse!", rb_ary_reverse, 0);
rb_define_method(rb_cArray, "sort", rb_ary_sort, 0);
rb_define_method(rb_cArray, "sort!", rb_ary_sort_bang, 0);
rb_define_method(rb_cArray, "collect", rb_ary_collect, 0);
rb_define_method(rb_cArray, "delete", rb_ary_delete, 1);
- rb_define_method(rb_cArray, "delete_at", rb_ary_delete_at, 1);
+ rb_define_method(rb_cArray, "delete_at", rb_ary_delete_at_m, -1);
rb_define_method(rb_cArray, "delete_if", rb_ary_delete_if, 0);
rb_define_method(rb_cArray, "reject!", rb_ary_delete_if, 0);
rb_define_method(rb_cArray, "filter", rb_ary_filter, 0);
- rb_define_method(rb_cArray, "replace", rb_ary_replace_method, 1);
+ rb_define_method(rb_cArray, "replace", rb_ary_replace_m, 1);
rb_define_method(rb_cArray, "clear", rb_ary_clear, 0);
rb_define_method(rb_cArray, "fill", rb_ary_fill, -1);
rb_define_method(rb_cArray, "include?", rb_ary_includes, 1);
View
80 bignum.c
@@ -15,10 +15,10 @@
VALUE rb_cBignum;
typedef unsigned short USHORT;
-#define BDIGITS(x) RBIGNUM(x)->digits
+#define BDIGITS(x) ((USHORT*)RBIGNUM(x)->digits)
#define BITSPERDIG (sizeof(short)*CHAR_BIT)
#define BIGRAD (1L << BITSPERDIG)
-#define DIGSPERINT ((unsigned int)(sizeof(long)/sizeof(short)))
+#define DIGSPERLONG ((unsigned int)(sizeof(long)/sizeof(short)))
#define BIGUP(x) ((unsigned long)(x) << BITSPERDIG)
#define BIGDN(x) RSHIFT(x,BITSPERDIG)
#define BIGLO(x) ((USHORT)((x) & (BIGRAD-1)))
@@ -33,7 +33,7 @@ bignew_1(klass, len, sign)
OBJSETUP(big, klass, T_BIGNUM);
big->sign = sign;
big->len = len;
- BDIGITS(big) = ALLOC_N(USHORT, len);
+ big->digits = ALLOC_N(USHORT, len);
return (VALUE)big;
}
@@ -116,14 +116,14 @@ rb_uint2big(n)
VALUE big;
i = 0;
- big = bignew(DIGSPERINT, 1);
+ big = bignew(DIGSPERLONG, 1);
digits = BDIGITS(big);
- while (i < DIGSPERINT) {
+ while (i < DIGSPERLONG) {
digits[i++] = BIGLO(n);
n = BIGDN(n);
}
- i = DIGSPERINT;
+ i = DIGSPERLONG;
while (i-- && !digits[i]) ;
RBIGNUM(big)->len = i+1;
return big;
@@ -164,18 +164,21 @@ rb_int2inum(n)
}
VALUE
-rb_str2inum(str, base)
+rb_cstr2inum(str, base)
const char *str;
int base;
{
+ const char *s = str;
+ char *end;
+ int badcheck = (base==0)?1:0;
char sign = 1, c;
unsigned long num;
long len, blen = 1;
long i;
VALUE z;
USHORT *zds;
- while (ISSPACE(*str)) str++;
+ while (*str && ISSPACE(*str)) str++;
if (*str == '+') {
str++;
@@ -197,11 +200,12 @@ rb_str2inum(str, base)
}
else {
base = 8;
+ if (!*str) return INT2FIX(0);
}
- if (*str == '\0') return INT2FIX(0);
}
else {
base = 10;
+ if (!*str) return INT2FIX(0);
}
}
if (base == 8) {
@@ -215,12 +219,23 @@ rb_str2inum(str, base)
if (base == 2 && str[0] == '0' && (str[1] == 'b'||str[1] == 'B')) {
str += 2;
}
- while (str[0] == '0') str++;
+ while (*str && *str == '0') str++;
+ if (!*str) str--;
len = 4*strlen(str)*sizeof(char);
}
if (len <= (sizeof(VALUE)*CHAR_BIT)) {
- unsigned long val = strtoul((char*)str, 0, base);
+ unsigned long val = strtoul((char*)str, &end, base);
+
+ if (badcheck) {
+ if (end == str || *end)
+ goto bad;
+ while (*end && ISSPACE(*end)) end++;
+ if (*end) {
+ bad:
+ rb_raise(rb_eArgError, "invalid literal for Integer: %s", s);
+ }
+ }
if (POSFIXABLE(val)) {
if (sign) return INT2FIX(val);
@@ -256,6 +271,15 @@ rb_str2inum(str, base)
break;
default:
c = base;
+ if (badcheck) {
+ if (ISSPACE(c)) {
+ while (*str && ISSPACE(*str)) str++;
+ if (*str) {
+ break;
+ }
+ }
+ rb_raise(rb_eArgError, "invalid literal for Integer: %s", s);
+ }
break;
}
if (c >= base) break;
@@ -274,9 +298,25 @@ rb_str2inum(str, base)
break;
}
}
+
return bignorm(z);
}
+VALUE
+rb_str2inum(str, base)
+ VALUE str;
+ int base;
+{
+ char *s;
+ int len;
+
+ s = rb_str2cstr(str, &len);
+ if (len != strlen(s)) {
+ rb_raise(rb_eArgError, "string for Integer contains null byte");
+ }
+ return rb_cstr2inum(s, base);
+}
+
static char hexmap[] = "0123456789abcdef";
VALUE
rb_big2str(x, base)
@@ -354,16 +394,17 @@ rb_big_to_s(x)
return rb_big2str(x, 10);
}
-unsigned long
-rb_big2ulong(x)
+static unsigned long
+big2ulong(x, type)
VALUE x;
+ char *type;
{
unsigned long num;
long len = RBIGNUM(x)->len;
USHORT *ds;
if (len > sizeof(long)/sizeof(USHORT))
- rb_raise(rb_eArgError, "bignum too big to convert into `uint'");
+ rb_raise(rb_eArgError, "bignum too big to convert into `%s'", type);
ds = BDIGITS(x);
num = 0;
while (len--) {
@@ -373,11 +414,20 @@ rb_big2ulong(x)
return num;
}
+unsigned long
+rb_big2ulong(x)
+ VALUE x;
+{
+ unsigned long num = big2ulong(x, "unsigned long");
+
+ if (!RBIGNUM(x)->sign) return -num;
+}
+
long
rb_big2long(x)
VALUE x;
{
- unsigned long num = rb_big2ulong(x);
+ unsigned long num = big2ulong(x, "int");
if ((long)num < 0) {
rb_raise(rb_eArgError, "bignum too big to convert into `int'");
View
2 class.c
@@ -6,7 +6,7 @@
$Date$
created at: Tue Aug 10 15:05:44 JST 1993
- Copyright (C) 1993-1999 Yukihiro Matsumoto
+ Copyright (C) 1993-2000 Yukihiro Matsumoto
************************************************/
View
2 compar.c
@@ -6,7 +6,7 @@
$Date$
created at: Thu Aug 26 14:39:48 JST 1993
- Copyright (C) 1993-1999 Yukihiro Matsumoto
+ Copyright (C) 1993-2000 Yukihiro Matsumoto
************************************************/
View
8 configure
@@ -1732,7 +1732,7 @@ case "$host_os" in
nextstep*) ;;
openstep*) ;;
rhapsody*) ;;
-human*) ;;
+human*) ac_cv_func_getpgrp_void=yes;;
beos*) ;;
cygwin*) ;;
*) LIBS="-lm $LIBS";;
@@ -4360,7 +4360,7 @@ else
echo "$ac_t""no" 1>&6
fi
- for ac_func in select
+ for ac_func in select gettimeofday
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
echo "configure:4367: checking for $ac_func" >&5
@@ -4501,7 +4501,7 @@ EOF
fi
LIBOBJS="$LIBOBJS x68.o"
- CFLAGS="$CFLAGS -fansi-only -cc1-stack=196608 -cpp-stack=2694144"
+ CFLAGS="$CFLAGS -fansi-only -cc1-stack=262144 -cpp-stack=2694144"
EXEEXT=.x
OBJEXT=o
setup=Setup.x68
@@ -4572,7 +4572,7 @@ if test "$enable_shared" = 'yes'; then
LIBRUBY_ALIASES='lib$(RUBY_INSTALL_NAME).so.$(MAJOR).$(MINOR) lib$(RUBY_INSTALL_NAME).so'
;;
linux*)
- XLDFLAGS='-Wl,-rpath,${prefix}/lib':/usr/lib:/lib
+ LIBRUBY_DLDFLAGS='-Wl,-soname,lib$(RUBY_INSTALL_NAME).so.$(MAJOR).$(MINOR)'
LIBRUBY_ALIASES='lib$(RUBY_INSTALL_NAME).so.$(MAJOR).$(MINOR) lib$(RUBY_INSTALL_NAME).so'
;;
freebsd*)
View
71 configure.in
@@ -26,6 +26,7 @@ then
fi
AC_CANONICAL_HOST
+AC_CANONICAL_TARGET
dnl checks for fat-binary
fat_binary=no
@@ -36,7 +37,7 @@ AC_ARG_ENABLE(fat-binary,
AC_MSG_CHECKING(target architecture)
- case "$host_os" in
+ case "$target_os" in
rhapsody*)
echo -n "MacOS X Server: "
if test "$TARGET_ARCHS" = "" ; then
@@ -136,11 +137,11 @@ if test "$rb_cv_have_attr_noreturn" = yes; then
fi
dnl Checks for libraries.
-case "$host_os" in
+case "$target_os" in
nextstep*) ;;
openstep*) ;;
rhapsody*) ;;
-human*) ;;
+human*) ac_cv_func_getpgrp_void=yes;;
beos*) ;;
cygwin*) ;;
*) LIBS="-lm $LIBS";;
@@ -326,7 +327,7 @@ AC_ARG_WITH(dln-a-out,
AC_SUBST(XLDFLAGS)dnl
-case "$host_os" in
+case "$target_os" in
linux*)
AC_CACHE_CHECK(whether ELF binaries are produced, rb_cv_binary_elf,
[AC_TRY_RUN([
@@ -351,7 +352,7 @@ main() {
rb_cv_binary_elf=yes)])
if test "$rb_cv_binary_elf" = no; then
with_dln_a_out=yes
- host_os=${host_os}-a_out
+ target_os=${target_os}-a_out
else
LDFLAGS="-rdynamic"
fi;;
@@ -370,22 +371,22 @@ if test "$with_dln_a_out" != yes; then
rb_cv_dlopen=unknown
AC_MSG_CHECKING(whether OS depend dynamic link works)
if test "$GCC" = yes; then
- case "$host_os" in
+ case "$target_os" in
nextstep*) ;;
openstep*) ;;
rhapsody*) ;;
human*) ;;
bsdi*) ;;
cygwin*) ;;
netbsd*) CCDLFLAGS=-fpic
- case "$host_cpu" in
+ case "$target_cpu" in
mips*) CCDLFLAGS=-fPIC ;;
*) ;;
esac ;;
*) CCDLFLAGS=-fPIC;;
esac
else
- case "$host_os" in
+ case "$target_os" in
hpux*) CCDLFLAGS='+z';;
solaris*|irix*) CCDLFLAGS='-K PIC' ;;
sunos*) CCDLFLAGS='-PIC' ;;
@@ -394,7 +395,7 @@ if test "$with_dln_a_out" != yes; then
esac
fi
- case "$host_os" in
+ case "$target_os" in
hpux*) DLDFLAGS="-E"
LDSHARED='ld -b'
LDFLAGS="-Wl,-E"
@@ -429,7 +430,7 @@ if test "$with_dln_a_out" != yes; then
fi
rb_cv_dlopen=yes ;;
netbsd*) LDSHARED="ld -shared"
- case "$host_cpu" in
+ case "$target_cpu" in
alpha)
LDFLAGS="-export-dynamic" ;;
esac
@@ -464,7 +465,7 @@ if test "$with_dln_a_out" != yes; then
LDSHARED=''
LDFLAGS=''
rb_cv_dlopen=yes ;;
- beos*) case "$host_cpu" in
+ beos*) case "$target_cpu" in
powerpc*)
LDSHARED="ld -xms"
DLDFLAGS="-f ruby.exp -lbe -lroot glue-noinit.a init_term_dyn.o start_dyn.o"
@@ -477,7 +478,7 @@ if test "$with_dln_a_out" != yes; then
DLDFLAGS="ruby.def -lbe -lroot glue-noinit.a init_term_dyn.o start_dyn.o"
esac
rb_cv_dlopen=yes ;;
- cygwin*) LDSHARED='dllwrap --export-all -s'
+ cygwin*) : ${LDSHARED='dllwrap --export-all -s'}
rb_cv_dlopen=yes ;;
*) LDSHARED='ld' ;;
esac
@@ -513,7 +514,7 @@ if test "$dln_a_out_works" = yes; then
AC_DEFINE(DLEXT, ".so")
CCDLFLAGS=
else
- case "$host_os" in
+ case "$target_os" in
hpux*) DLEXT=sl
AC_DEFINE(DLEXT, ".sl");;
nextstep*) DLEXT=bundle
@@ -538,7 +539,7 @@ else
STRIP=strip
fi
-case "$host_os" in
+case "$target_os" in
linux*)
STRIP='strip -S -x';;
nextstep*)
@@ -559,11 +560,11 @@ AC_ARG_WITH(static-linked-ext,
*) ;;
esac])
-case "$host_os" in
+case "$target_os" in
human*)
AC_CHECK_LIB(signal, _harderr)
AC_CHECK_LIB(hmem, hmemset)
- AC_CHECK_FUNCS(select)
+ AC_CHECK_FUNCS(select gettimeofday)
AC_CACHE_CHECK(whether PD libc _dtos18 fail to convert big number,
rb_cv_missing__dtos18,
[AC_TRY_RUN(
@@ -602,7 +603,7 @@ rb_cv_missing_fconvert=yes, rb_cv_missing_fconvert=no, rb_cv_missing_fconvert=no
AC_DEFINE(MISSING_FCONVERT)
fi
LIBOBJS="$LIBOBJS x68.o"
- CFLAGS="$CFLAGS -fansi-only -cc1-stack=196608 -cpp-stack=2694144"
+ CFLAGS="$CFLAGS -fansi-only -cc1-stack=262144 -cpp-stack=2694144"
EXEEXT=.x
OBJEXT=o
setup=Setup.x68
@@ -630,16 +631,26 @@ if test "$fat_binary" = yes ; then
CFLAGS="$CFLAGS $ARCH_FLAG"
fi
+if test x"$cross_compiling" = xyes; then
+ MINIRUBY='ruby -I.. -rprep'
+ PREP=prep.rb
+else
+ MINIRUBY='./miniruby$(EXEEXT)'
+ PREP=''
+fi
+AC_SUBST(MINIRUBY)
+AC_SUBST(PREP)
+
LIBRUBY_A='lib$(RUBY_INSTALL_NAME).a'
LIBRUBY='$(LIBRUBY_A)'
LIBRUBYARG='$(LIBRUBY_A)'
SOLIBS=
-if test "$host_os" = "beos"; then
+if test "$target_os" = "beos"; then
LIBRUBY='$(LIBRUBY_SO)'
LIBRUBYARG='-l$(RUBY_INSTALL_NAME)'
SOLIBS='-lnet'
echo creating ruby.def
- case "$host_cpu" in
+ case "$target_cpu" in
powerpc*)
cp beos/ruby.def.in ruby.exp
CFLAGS="$CFLAGS -relax_pointers"
@@ -666,12 +677,12 @@ if test "$enable_shared" = 'yes'; then
LIBRUBY='$(LIBRUBY_SO)'
LIBRUBYARG='-L. -l$(RUBY_INSTALL_NAME)'
CFLAGS="$CFLAGS $CCDLFLAGS"
- case "$host_os" in
+ case "$target_os" in
sunos4*)
LIBRUBY_ALIASES='lib$(RUBY_INSTALL_NAME).so.$(MAJOR).$(MINOR) lib$(RUBY_INSTALL_NAME).so'
;;
linux*)
- XLDFLAGS='-Wl,-rpath,${prefix}/lib':/usr/lib:/lib
+ LIBRUBY_DLDFLAGS='-Wl,-soname,lib$(RUBY_INSTALL_NAME).so.$(MAJOR).$(MINOR)'
LIBRUBY_ALIASES='lib$(RUBY_INSTALL_NAME).so.$(MAJOR).$(MINOR) lib$(RUBY_INSTALL_NAME).so'
;;
freebsd*)
@@ -683,7 +694,7 @@ if test "$enable_shared" = 'yes'; then
;;
netbsd*)
LIBRUBY_SO='lib$(RUBY_INSTALL_NAME).so.$(MAJOR).$(MINOR)'
- case "$host_cpu" in
+ case "$target_cpu" in
alpha|mipsel|mipseb|powerpc|sparc64) # ELF platforms
LIBRUBY_ALIASES='lib$(RUBY_INSTALL_NAME).so.$(MAJOR) lib$(RUBY_INSTALL_NAME).so' ;;
*) LIBRUBY_ALIASES= ;; # a.out platforms
@@ -716,13 +727,17 @@ if test "$enable_shared" = 'yes'; then
FIRSTMAKEFILE=GNUmakefile:cygwin/GNUmakefile.in
LIBOBJS="$LIBOBJS strftime.o"
CCDLFLAGS=-DUSEIMPORTLIB
+ : ${NM=nm}
+ AC_SUBST(NM)
+ : ${DLLWRAP=dllwrap}
+ AC_SUBST(DLLWRAP)
;;
*)
;;
esac
fi
-case "$host_os" in
+case "$target_os" in
nextstep*)
CFLAGS="$CFLAGS -pipe"
;;
@@ -765,16 +780,16 @@ configure_args=$ac_configure_args
AC_SUBST(configure_args)dnl
if test "$fat_binary" = yes ; then
- arch="fat-${host_os}"
+ arch="fat-${target_os}"
AC_DEFINE_UNQUOTED(RUBY_THIN_ARCHLIB,
- "${RUBY_LIB_PATH}/" __ARCHITECTURE__ "-${host_os}")
+ "${RUBY_LIB_PATH}/" __ARCHITECTURE__ "-${target_os}")
AC_DEFINE_UNQUOTED(RUBY_SITE_THIN_ARCHLIB,
- "${RUBY_SITE_LIB_PATH}/" __ARCHITECTURE__ "-${host_os}")
- AC_DEFINE_UNQUOTED(RUBY_PLATFORM, __ARCHITECTURE__ "-${host_os}")
+ "${RUBY_SITE_LIB_PATH}/" __ARCHITECTURE__ "-${target_os}")
+ AC_DEFINE_UNQUOTED(RUBY_PLATFORM, __ARCHITECTURE__ "-${target_os}")
else
- arch="${host_cpu}-${host_os}"
+ arch="${target_cpu}-${target_os}"
AC_DEFINE_UNQUOTED(RUBY_PLATFORM, "${arch}")
fi
AC_DEFINE_UNQUOTED(RUBY_ARCHLIB, "${RUBY_LIB_PATH}/${arch}")
View
5 cygwin/GNUmakefile.in
@@ -4,6 +4,5 @@ RUBYCWDLL=rubycw.dll
miniruby$(EXEEXT): $(RUBYCWDLL)
-$(RUBYCWDLL): $(OBJS) dmyext.o
- dllwrap -o $(RUBYCWDLL) --export-all --output-lib=$(LIBRUBY_SO) --dllname=$(RUBYCWDLL) -Wl,-e,__cygwin_noncygwin_dll_entry@12 --add-stdcall-alias -s $(OBJS) dmyext.o
- nm --extern-only $(OBJS) dmyext.o | sed -n '/^........ [CD] _\(.*\)$$/s//#define \1 (*__imp_\1)/p' >import.h
+ $(LDSHARED) $(DLDFLAGS) -o $(RUBYCWDLL) --output-lib=$(LIBRUBY_SO) --dllname=$(RUBYCWDLL) -Wl,-e,__cygwin_noncygwin_dll_entry@12 --add-stdcall-alias $(OBJS) dmyext.o
+ @NM@ --extern-only $(OBJS) dmyext.o | sed -n '/^........ [CD] _\(.*\)$$/s//#define \1 (*__imp_\1)/p' >import.h
View
4 defines.h
@@ -14,7 +14,7 @@
/* define RUBY_USE_EUC/SJIS for default kanji-code */
#ifndef DEFAULT_KCODE
-#if defined(MSDOS) || defined(__CYGWIN32__) || defined(__human68k__) || defined(__MACOS__) || defined(__EMX__) || defined(OS2) || defined(NT)
+#if defined(MSDOS) || defined(__CYGWIN__) || defined(__human68k__) || defined(__MACOS__) || defined(__EMX__) || defined(OS2) || defined(NT)
#define DEFAULT_KCODE KCODE_SJIS
#else
#define DEFAULT_KCODE KCODE_EUC
@@ -55,7 +55,7 @@
#endif
#define PATH_SEP_CHAR PATH_SEP[0]
-#if defined(__human68k__) || defined(__CYGWIN32__)
+#if defined(__human68k__) || defined(__CYGWIN__)
#undef HAVE_RANDOM
#undef HAVE_SETITIMER
#endif
View
2 dir.c
@@ -6,7 +6,7 @@
$Date$
created at: Wed Jan 5 09:51:01 JST 1994
- Copyright (C) 1993-1999 Yukihiro Matsumoto
+ Copyright (C) 1993-2000 Yukihiro Matsumoto
************************************************/
View
2 dln.c
@@ -6,7 +6,7 @@
$Date$
created at: Tue Jan 18 17:05:06 JST 1994
- Copyright (C) 1993-1999 Yukihiro Matsumoto
+ Copyright (C) 1993-2000 Yukihiro Matsumoto
************************************************/
View
2 enum.c
@@ -6,7 +6,7 @@
$Date$
created at: Fri Oct 1 15:15:19 JST 1993
- Copyright (C) 1993-1999 Yukihiro Matsumoto
+ Copyright (C) 1993-2000 Yukihiro Matsumoto
************************************************/
View
4 error.c
@@ -6,7 +6,7 @@
$Date$
created at: Mon Aug 9 16:11:34 JST 1993
- Copyright (C) 1993-1999 Yukihiro Matsumoto
+ Copyright (C) 1993-2000 Yukihiro Matsumoto
************************************************/
@@ -279,7 +279,7 @@ rb_exc_new3(etype, str)
char *s;
int len;
- s = str2cstr(str, &len);
+ s = rb_str2cstr(str, &len);
return rb_exc_new(etype, s, len);
}
View
269 eval.c
@@ -6,7 +6,7 @@
$Date$
created at: Thu Jun 10 14:22:17 JST 1993
- Copyright (C) 1993-1999 Yukihiro Matsumoto
+ Copyright (C) 1993-2000 Yukihiro Matsumoto
************************************************/
@@ -566,6 +566,8 @@ struct RVarmap *ruby_dyna_vars;
ruby_dyna_vars = _old; \
}
+#define DVAR_DONT_RECYCLE FL_USER0
+
static struct RVarmap*
new_dvar(id, value, prev)
ID id;
@@ -790,6 +792,7 @@ static VALUE massign _((VALUE,NODE*,VALUE,int));
static void assign _((VALUE,NODE*,VALUE,int));
static VALUE trace_func = 0;
+static int tracing = 0;
static void call_trace_func _((char*,char*,int,VALUE,ID,VALUE));
static void
@@ -990,6 +993,7 @@ ruby_options(argc, argv)
POP_TAG();
if (state) {
trace_func = 0;
+ tracing = 0;
error_print();
exit(1);
}
@@ -1110,7 +1114,7 @@ compile_error(at)
char *mesg;
int len;
- mesg = str2cstr(ruby_errinfo, &len);
+ mesg = rb_str2cstr(ruby_errinfo, &len);
ruby_nerrs = 0;
str = rb_str_new2("compile error");
if (at) {
@@ -1397,6 +1401,9 @@ rb_undef(klass, id)
VALUE origin;
NODE *body;
+ if (ruby_class == rb_cObject) {
+ rb_secure(4);
+ }
if (safe_level >= 4 && !OBJ_TAINTED(klass)) {
rb_raise(rb_eSecurityError, "Insecure: can't undef");
}
@@ -1481,9 +1488,14 @@ rb_mod_alias_method(mod, newname, oldname)
(tmp__protect_tmp = rb_node_newnode(NODE_ALLOCA, \
ALLOC_N(VALUE,n),tmp__protect_tmp,n), \
(void*)tmp__protect_tmp->nd_head)
+# define TMP_PROTECT_END do {\
+ rb_gc_force_recycle((VALUE)tmp__protect_tmp);\
+ alloca(0);\
+} while (0)
#else
# define TMP_PROTECT typedef int foobazzz
# define TMP_ALLOC(n) ALLOCA_N(VALUE,n)
+# define TMP_PROTECT_END
#endif
#define SETUP_ARGS(anode) {\
@@ -1766,18 +1778,15 @@ call_trace_func(event, file, line, self, id, klass)
VALUE klass; /* OK */
{
int state;
- volatile VALUE trace;
struct FRAME *prev;
char *file_save = ruby_sourcefile;
int line_save = ruby_sourceline;
VALUE srcfile;
if (!trace_func) return;
+ if (tracing) return;
- trace = trace_func;
- trace_func = 0;
- rb_thread_critical++;
-
+ tracing = 1;
prev = ruby_frame;
PUSH_FRAME();
*ruby_frame = *prev;
@@ -1795,18 +1804,17 @@ call_trace_func(event, file, line, self, id, klass)
PUSH_TAG(PROT_NONE);
if ((state = EXEC_TAG()) == 0) {
srcfile = rb_str_new2(ruby_sourcefile?ruby_sourcefile:"(ruby)");
- proc_call(trace, rb_ary_new3(6, rb_str_new2(event),
- srcfile,
- INT2FIX(ruby_sourceline),
- INT2FIX(id),
- self?rb_f_binding(self):Qnil,
- klass));
+ proc_call(trace_func, rb_ary_new3(6, rb_str_new2(event),
+ srcfile,
+ INT2FIX(ruby_sourceline),
+ INT2FIX(id),
+ self?rb_f_binding(self):Qnil,
+ klass));
}
POP_TMPTAG(); /* do not propagate retval */
POP_FRAME();
- rb_thread_critical--;
- if (!trace_func) trace_func = trace;
+ tracing = 0;
ruby_sourceline = line_save;
ruby_sourcefile = file_save;
if (state) JUMP_TAG(state);
@@ -2288,6 +2296,7 @@ rb_eval(self, node)
END_CALLARGS;
result = rb_call(CLASS_OF(recv),recv,node->nd_mid,argc,argv,0);
+ TMP_PROTECT_END;
}
break;
@@ -2301,6 +2310,7 @@ rb_eval(self, node)
END_CALLARGS;
result = rb_call(CLASS_OF(self),self,node->nd_mid,argc,argv,1);
+ TMP_PROTECT_END;
}
break;
@@ -2333,6 +2343,7 @@ rb_eval(self, node)
ruby_frame->self, ruby_frame->last_func,
argc, argv, 3);
POP_ITER();
+ TMP_PROTECT_END;
}
break;
@@ -2394,6 +2405,7 @@ rb_eval(self, node)
argv[argc-1] = val;
val = rb_funcall2(recv, aset, argc, argv);
result = val;
+ TMP_PROTECT_END;
}
break;
@@ -2767,9 +2779,6 @@ rb_eval(self, node)
if (NIL_P(ruby_class)) {
rb_raise(rb_eTypeError, "no class to undef method");
}
- if (ruby_class == rb_cObject) {
- rb_secure(4);
- }
rb_undef(ruby_class, node->nd_mid);
result = Qnil;
break;
@@ -3006,6 +3015,7 @@ module_setup(module, node)
call_trace_func("end", file, line, 0,
ruby_frame->last_func, ruby_frame->last_class);
}
+ TMP_PROTECT_END;
if (state) JUMP_TAG(state);
return result;
@@ -3319,6 +3329,15 @@ rb_yield_0(val, self, klass, acheck)
pop_state:
POP_ITER();
POP_CLASS();
+ if ((block->flags & BLOCK_D_SCOPE) &&
+ !FL_TEST(ruby_dyna_vars, DVAR_DONT_RECYCLE)) {
+ struct RVarmap *vars = ruby_dyna_vars;
+
+ do {
+ rb_gc_force_recycle((VALUE)vars);
+ vars = vars->next;
+ } while (vars && vars->id != 0);
+ }
POP_VARS();
ruby_block = block;
ruby_frame = ruby_frame->prev;
@@ -3339,7 +3358,10 @@ rb_yield(val)
static VALUE
rb_f_loop()
{
- for (;;) { rb_yield_0(Qnil, 0, 0, Qfalse); }
+ for (;;) {
+ rb_yield_0(Qnil, 0, 0, Qfalse);
+ CHECK_INTS;
+ }
return Qnil; /* dummy */
}
@@ -3538,6 +3560,7 @@ handle_rescue(self, node)
if (rb_obj_is_kind_of(ruby_errinfo, argv[0])) return 1;
argv++;
}
+ TMP_PROTECT_END;
return 0;
}
@@ -4075,6 +4098,7 @@ rb_call0(klass, recv, id, argc, argv, body, nosuper)
}
POP_FRAME();
POP_ITER();
+ TMP_PROTECT_END;
return result;
}
@@ -4638,84 +4662,6 @@ rb_mod_module_eval(argc, argv, mod)
VALUE rb_load_path;
-static int
-is_absolute_path(path)
- const char *path;
-{
- if (path[0] == '/') return 1;
-# if defined(MSDOS) || defined(NT) || defined(__human68k__) || defined(__EMX__)
- if (path[0] == '\\') return 1;
- if (strlen(path) > 2 && path[1] == ':') return 1;
-# endif
- return 0;
-}
-
-#ifdef __MACOS__
-static int
-is_macos_native_path(path)
- const char *path;
-{
- if (strchr(path, ':')) return 1;
- return 0;
-}
-#endif
-
-static char*
-find_file(file)
- char *file;
-{
- volatile VALUE vpath;
- char *path;
-
-#ifdef __MACOS__
- if (is_macos_native_path(file)) {
- FILE *f = fopen(file, "r");
-
- if (f == NULL) return 0;
- fclose(f);
- return file;
- }
-#endif
-
- if (is_absolute_path(file)) {
- FILE *f = fopen(file, "r");
-
- if (f == NULL) return 0;
- fclose(f);
- return file;
- }
-
- if (file[0] == '~') {
- VALUE argv[1];
- argv[0] = rb_str_new2(file);
- file = STR2CSTR(rb_file_s_expand_path(1, argv));
- }
-
- if (rb_load_path) {
- int i;
-
- Check_Type(rb_load_path, T_ARRAY);
- vpath = rb_ary_new();
- for (i=0;i<RARRAY(rb_load_path)->len;i++) {
- VALUE str = RARRAY(rb_load_path)->ptr[i];
- Check_SafeStr(str);
- if (RSTRING(str)->len > 0) {
- rb_ary_push(vpath, str);
- }
- }
- vpath = rb_ary_join(vpath, rb_str_new2(PATH_SEP));
- path = STR2CSTR(vpath);
- if (safe_level >= 2 && !rb_path_check(path)) {
- rb_raise(rb_eSecurityError, "loading from unsafe path %s", path);
- }
- }
- else {
- path = 0;
- }
-
- return dln_find_file(file, path);
-}
-
void
rb_load(fname, wrap)
VALUE fname;
@@ -4734,7 +4680,7 @@ rb_load(fname, wrap)
else {
Check_SafeStr(fname);
}
- file = find_file(RSTRING(fname)->ptr);
+ file = rb_find_file(RSTRING(fname)->ptr);
if (!file) {
rb_raise(rb_eLoadError, "No such file to load -- %s", RSTRING(fname)->ptr);
}
@@ -4755,6 +4701,7 @@ rb_load(fname, wrap)
}
PUSH_FRAME();
ruby_frame->last_func = 0;
+ ruby_frame->last_class = 0;
ruby_frame->self = ruby_top_self;
ruby_frame->cbase = (VALUE)rb_node_newnode(NODE_CREF,ruby_class,0,0);
PUSH_SCOPE();
@@ -4797,6 +4744,7 @@ rb_load(fname, wrap)
ruby_nerrs = 0;
rb_exc_raise(ruby_errinfo);
}
+ TMP_PROTECT_END;
if (state) JUMP_TAG(state);
}
@@ -4892,7 +4840,7 @@ rb_f_require(obj, fname)
if (ext) {
if (strcmp(".rb", ext) == 0) {
feature = file = RSTRING(fname)->ptr;
- file = find_file(file);
+ file = rb_find_file(file);
if (file) goto load_rb;
}
else if (strcmp(".so", ext) == 0 || strcmp(".o", ext) == 0) {
@@ -4905,27 +4853,27 @@ rb_f_require(obj, fname)
file = feature = buf;
if (rb_provided(feature)) return Qfalse;
}
- file = find_file(file);
+ file = rb_find_file(file);
if (file) goto load_dyna;
}
else if (strcmp(DLEXT, ext) == 0) {
feature = RSTRING(fname)->ptr;
- file = find_file(feature);
+ file = rb_find_file(feature);
if (file) goto load_dyna;
}
}
buf = ALLOCA_N(char, strlen(RSTRING(fname)->ptr) + 5);
strcpy(buf, RSTRING(fname)->ptr);
strcat(buf, ".rb");
- file = find_file(buf);
+ file = rb_find_file(buf);
if (file) {
fname = rb_str_new2(file);
feature = buf;
goto load_rb;
}
strcpy(buf, RSTRING(fname)->ptr);
strcat(buf, DLEXT);
- file = find_file(buf);
+ file = rb_find_file(buf);
if (file) {
feature = buf;
goto load_dyna;
@@ -5576,7 +5524,7 @@ bind_clone(self)
Data_Get_Struct(self, struct BLOCK, orig);
bind = Data_Make_Struct(rb_cBinding,struct BLOCK,blk_mark,blk_free,data);
- CLONESETUP(bind,self);
+ CLONESETUP(bind, self);
MEMCPY(data, orig, struct BLOCK, 1);
frame_dup(&data->frame);
@@ -5595,6 +5543,7 @@ rb_f_binding(self)
VALUE self;
{
struct BLOCK *data;
+ struct RVarmap *vars;
VALUE bind;
PUSH_BLOCK(0,0);
@@ -5616,6 +5565,9 @@ rb_f_binding(self)
data->prev = 0;
}
+ for (vars = data->d_vars; vars; vars = vars->next) {
+ FL_SET(vars, DVAR_DONT_RECYCLE);
+ }
scope_dup(data->scope);
POP_BLOCK();
@@ -5671,6 +5623,7 @@ proc_s_new(klass)
{
volatile VALUE proc;
struct BLOCK *data;
+ struct RVarmap *vars;
if (!rb_iterator_p() && !rb_f_iterator_p()) {
rb_raise(rb_eArgError, "tried to create Procedure-Object out of iterator");
@@ -5691,6 +5644,9 @@ proc_s_new(klass)
}
data->flags |= BLOCK_DYNAMIC;
+ for (vars = data->d_vars; vars; vars = vars->next) {
+ FL_SET(vars, DVAR_DONT_RECYCLE);
+ }
scope_dup(data->scope);
proc_save_safe_level(proc);
@@ -6134,12 +6090,12 @@ struct thread {
VALUE klass;
VALUE wrapper;
- VALUE trace;
int flags; /* misc. states (vmode/rb_trap_immediate/raised) */
char *file;
int line;
+ int tracing;
VALUE errinfo;
VALUE last_status;
VALUE last_line;
@@ -6207,7 +6163,6 @@ thread_mark(th)
rb_gc_mark(th->errinfo);
rb_gc_mark(th->last_line);
rb_gc_mark(th->last_match);
- rb_gc_mark(th->trace);
rb_mark_tbl(th->locals);
/* mark data in copied stack */
@@ -6286,7 +6241,7 @@ rb_thread_save_context(th)
th->stk_pos = (rb_gc_stack_start<(VALUE*)&v)?rb_gc_stack_start
:rb_gc_stack_start - len;
if (len > th->stk_max) {
-REALLOC_N(th->stk_ptr, VALUE, len);
+ REALLOC_N(th->stk_ptr, VALUE, len);
th->stk_max = len;
}
th->stk_len = len;
@@ -6302,13 +6257,13 @@ REALLOC_N(th->stk_ptr, VALUE, len);
th->flags = scope_vmode | (rb_trap_immediate<<8);
th->iter = ruby_iter;
th->tag = prot_tag;
+ th->tracing = tracing;
th->errinfo = ruby_errinfo;
th->last_status = rb_last_status;
th->last_line = rb_lastline_get();
th->last_match = rb_backref_get();
th->safe = safe_level;
- th->trace = trace_func;
th->file = ruby_sourcefile;
th->line = ruby_sourceline;
}
@@ -6371,11 +6326,11 @@ rb_thread_restore_context(th, exit)
rb_trap_immediate = (th->flags&0x100)?1:0;
ruby_iter = th->iter;
prot_tag = th->tag;
+ tracing = th->tracing;
ruby_errinfo = th->errinfo;
rb_last_status = th->last_status;
safe_level = th->safe;
- trace_func = th->trace;
ruby_sourcefile = th->file;
ruby_sourceline = th->line;
@@ -6515,7 +6470,7 @@ rb_thread_schedule()
}
FOREACH_THREAD_FROM(curr, th) {
- if (th->status != THREAD_STOPPED && th->status != THREAD_KILLED) {
+ if (th->status == THREAD_RUNNABLE || th->status == THREAD_TO_KILL) {
if (!next || next->priority < th->priority)
next = th;
}
@@ -6886,6 +6841,26 @@ rb_thread_main()
}
VALUE
+rb_thread_list()
+{
+ thread_t th;
+ VALUE ary = rb_ary_new();
+
+ FOREACH_THREAD(th) {
+ switch (th->status) {
+ case THREAD_RUNNABLE:
+ case THREAD_STOPPED:
+ rb_ary_push(ary, th->thread);
+ default:
+ break;
+ }
+ }
+ END_FOREACH(th);
+
+ return ary;
+}
+
+VALUE
rb_thread_wakeup(thread)
VALUE thread;
{
@@ -7014,6 +6989,16 @@ rb_thread_priority_set(thread, prio)
return thread;
}
+static VALUE
+rb_thread_safe_level(thread)
+ VALUE thread;
+{
+ thread_t th;
+
+ th = rb_thread_check(thread);
+ return INT2NUM(th->safe);
+}
+
static int thread_abort;
static VALUE
@@ -7074,6 +7059,7 @@ rb_thread_abort_exc_set(thread, val)
th->block = 0;\
th->iter = 0;\
th->tag = 0;\
+ th->tracing = 0;\
th->errinfo = 0;\
th->last_status = 0;\
th->last_line = 0;\
@@ -7280,6 +7266,18 @@ rb_thread_status(thread)
return Qnil;
}
+ if (th->status == THREAD_STOPPED)
+ return rb_str_new2("sleep");
+ return rb_str_new2("run");
+}
+
+static VALUE
+rb_thread_alive_p(thread)
+ VALUE thread;
+{
+ thread_t th = rb_thread_check(thread);
+
+ if (rb_thread_dead(th)) return Qfalse;
return Qtrue;
}
@@ -7523,7 +7521,36 @@ rb_thread_key_p(thread, id)
return Qfalse;
}
-static VALUE rb_cContinuation;
+static VALUE
+rb_thread_inspect(thread)
+ VALUE thread;
+{
+ char *cname = rb_class2name(CLASS_OF(thread));
+ thread_t th = rb_thread_check(thread);
+ char *s, *status;
+ VALUE str;
+
+ switch (th->status) {
+ case THREAD_RUNNABLE:
+ status = "run"; break;
+ case THREAD_STOPPED:
+ status = "sleep"; break;
+ case THREAD_TO_KILL:
+ status = "aborting"; break;
+ case THREAD_KILLED:
+ status = "dead"; break;
+ default:
+ status = "unknown"; break;
+ }
+ s = ALLOCA_N(char, strlen(cname)+6+16+9+1); /* 6:tags 16:addr 9:status 1:nul */
+ sprintf(s, "#<%s:0x%lx %s>", cname, thread, status);
+ str = rb_str_new2(s);
+ OBJ_INFECT(str, thread);
+
+ return str;
+}
+
+static VALUE rb_cCont;
static VALUE
rb_callcc(self)
@@ -7534,7 +7561,7 @@ rb_callcc(self)
struct tag *tag;
THREAD_ALLOC(th);
- th->thread = cont = Data_Wrap_Struct(rb_cContinuation, thread_mark,
+ th->thread = cont = Data_Wrap_Struct(rb_cCont, thread_mark,
thread_free, th);
FL_SET(ruby_scope, SCOPE_DONT_RECYCLE);
@@ -7551,7 +7578,7 @@ rb_callcc(self)
}
static VALUE
-rb_continuation_call(argc, argv, cont)
+rb_cont_call(argc, argv, cont)
int argc;
VALUE *argv;
VALUE cont;
@@ -7569,6 +7596,7 @@ rb_continuation_call(argc, argv, cont)
th->result = rb_ary_new4(argc, argv);
break;
}
+
rb_thread_restore_context(th, RESTORE_NORMAL);
return Qnil;
}
@@ -7590,6 +7618,7 @@ Init_Thread()
rb_define_singleton_method(rb_cThread, "join", rb_thread_s_join, 1);
rb_define_singleton_method(rb_cThread, "current", rb_thread_current, 0);
rb_define_singleton_method(rb_cThread, "main", rb_thread_main, 0);
+ rb_define_singleton_method(rb_cThread, "list", rb_thread_list, 0);
rb_define_singleton_method(rb_cThread, "critical", rb_thread_critical_get, 0);
rb_define_singleton_method(rb_cThread, "critical=", rb_thread_critical_set, 1);
@@ -7599,11 +7628,12 @@ Init_Thread()
rb_define_method(rb_cThread, "run", rb_thread_run, 0);
rb_define_method(rb_cThread, "wakeup", rb_thread_wakeup, 0);
+ rb_define_method(rb_cThread, "kill", rb_thread_kill, 0);
rb_define_method(rb_cThread, "exit", rb_thread_kill, 0);
rb_define_method(rb_cThread, "value", rb_thread_value, 0);
rb_define_method(rb_cThread, "status", rb_thread_status, 0);
rb_define_method(rb_cThread, "join", rb_thread_join, 0);
- rb_define_method(rb_cThread, "alive?", rb_thread_status, 0);
+ rb_define_method(rb_cThread, "alive?", rb_thread_alive_p, 0);
rb_define_method(rb_cThread, "stop?", rb_thread_stop_p, 0);
rb_define_method(rb_cThread, "raise", rb_thread_raise, -1);
@@ -7612,17 +7642,20 @@ Init_Thread()
rb_define_method(rb_cThread, "priority", rb_thread_priority, 0);
rb_define_method(rb_cThread, "priority=", rb_thread_priority_set, 1);
+ rb_define_method(rb_cThread, "safe_level", rb_thread_safe_level, 0);
rb_define_method(rb_cThread, "[]", rb_thread_aref, 1);
rb_define_method(rb_cThread, "[]=", rb_thread_aset, 2);
rb_define_method(rb_cThread, "key?", rb_thread_key_p, 1);
+ rb_define_method(rb_cThread, "inspect", rb_thread_inspect, 0);
+
/* allocate main thread */
main_thread = rb_thread_alloc(rb_cThread);
- rb_cContinuation = rb_define_class("Continuation", rb_cObject);
- rb_undef_method(CLASS_OF(rb_cContinuation), "new");
- rb_define_method(rb_cContinuation, "call", rb_continuation_call, -1);
+ rb_cCont = rb_define_class("Continuation", rb_cObject);
+ rb_undef_method(CLASS_OF(rb_cCont), "new");
+ rb_define_method(rb_cCont, "call", rb_cont_call, -1);
rb_define_global_function("callcc", rb_callcc, 0);
}
@@ -7653,7 +7686,7 @@ static VALUE
catch_i(tag)
ID tag;
{
- return rb_f_catch(0, FIX2INT(tag));
+ return rb_funcall(Qnil, rb_intern("catch"), 0, FIX2INT(tag));
}
VALUE
View
15 ext/Win32API/Win32API.c
@@ -68,9 +68,9 @@ Win32API_initialize(self, dllname, proc, import, export)
rb_raise(rb_eRuntimeError, "GetProcAddress: %s or %s\n",
RSTRING(proc)->ptr, RSTRING(str)->ptr);
}
- rb_iv_set(self, "__dll__", INT2NUM((int)hdll));
+ rb_iv_set(self, "__dll__", UINT2NUM((unsigned long)hdll));
rb_iv_set(self, "__dllname__", dllname);
- rb_iv_set(self, "__proc__", INT2NUM((int)hproc));
+ rb_iv_set(self, "__proc__", UINT2NUM((unsigned long)hproc));
a_import = rb_ary_new();
ptr = RARRAY(import)->ptr;
@@ -124,7 +124,7 @@ Win32API_Call(argc, argv, obj)
ApiVoid *ApiFunctionVoid;
ApiInteger *ApiFunctionInteger;
- long lParam;
+ long lParam;
char *pParam;
VALUE Return;
@@ -144,7 +144,7 @@ Win32API_Call(argc, argv, obj)
obj_import = rb_iv_get(obj, "__import__");
obj_export = rb_iv_get(obj, "__export__");
- nimport = RARRAY(obj_import)->len;
+ nimport = RARRAY(obj_import)->len;
texport = FIX2INT(obj_export);
if (items != nimport)
@@ -165,7 +165,7 @@ Win32API_Call(argc, argv, obj)
mov eax, lParam
push eax
}
-#elif defined(__CYGWIN32__) || defined(__MINGW32__)
+#elif defined(__CYGWIN__) || defined(__MINGW32__)
asm volatile ("pushl %0" :: "g" (lParam));
#else
#error
@@ -184,18 +184,17 @@ Win32API_Call(argc, argv, obj)
}
#if defined(_MSC_VER) || defined(__LCC__)
_asm {
- mov eax, dword ptr pParam
+ mov eax, pParam
push eax
}
-#elif defined(__CYGWIN32__) || defined(__MINGW32__)
+#elif defined(__CYGWIN__) || defined(__MINGW32__)
asm volatile ("pushl %0" :: "g" (pParam));
#else
#error
#endif
break;
}
}
-
}
switch (texport) {
View
11 ext/socket/socket.c
@@ -92,17 +92,10 @@ static void
sock_finalize(fptr)
OpenFile *fptr;
{
- SOCKET s;
- extern int errno;
-
if (!fptr->f) return;
- myfdclose(fptr->f);
- if(fptr->f2) myfdclose(fptr->f);
-/*
- s = get_osfhandle(fileno(fptr->f));
- closesocket(s);
-*/
+ myfdclose(fptr->f);
+ if(fptr->f2) myfdclose(fptr->f2);
}
#endif
View
9