Граф коммитов

736 Коммитов

Автор SHA1 Сообщение Дата
luislavena f9a6a1dd0c Introduce NEED_READCONV and NEED_WRITECONV to replace universal newline decorator
Use CRLF only when required to improve file reading and writing under Windows.
Patch by Hiroshi Shirosaki. [ruby-core:40706] [Feature #5562]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33937 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-12-04 01:10:06 +00:00
nobu abb40f8eb3 * include/ruby/subst.h: reverted r33916, since some names in vm.inc conflict.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33917 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-12-01 06:19:57 +00:00
nobu f274088eec * include/ruby/subst.h: removed arguments lists so that function
calls with zero arguments can be substituted.  aliasing in .def
  file has no effect for static library.  [ruby-core:41370]
  [Bug#5681]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33916 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-12-01 05:48:05 +00:00
nobu 9fe88af9ef * win32/win32.c (rb_w32_inet_ntop): constified.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33893 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-11-29 00:51:40 +00:00
nagachika 22702f9278 * include/ruby/win32.h (GetCurrentThreadHandle): remove unused API.
follow r33881.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33889 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-11-28 17:44:25 +00:00
usa d81c20771d * include/ruby/subst.h: typo of r33876.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33877 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-11-28 02:00:53 +00:00
nobu 1510ad86c4 * include/ruby/subst.h: moved Windows specific substitions from
win32.h.
* ext/socket/rubysocket.h: include ruby/subst.h.  [Bug #5675]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33876 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-11-28 01:36:09 +00:00
kosaki fd5a7ee75c * include/ruby/ruby.h(NUM2LONG, NUM2INT, NUM2SHORT, NUM2LL,
INT2NUM, UINT2NUM, LONG2NUM, ULONG2NUM, NUM2CHR): wrap by
  macros.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33759 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-11-15 05:57:34 +00:00
ngoto 3d85b0ff5a * fix ANSI C compliance of r33757
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33758 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-11-15 05:05:35 +00:00
ngoto fa00b6516c * include/ruby/defines.h (FLUSH_REGISTER_WINDOWS): move sparc asm code
to a separete file sparc.c for preventing inlining optimization.
  Patched by Jurij Smakov. [Bug #5244] [ruby-core:40685]
* sparc.c (rb_sparc_flush_register_windows): ditto.
* configure.in: ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33757 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-11-15 04:42:31 +00:00
kosaki 9cdd62bd19 * include/ruby/ruby.h: get rid of gcc specific rb_long2int(),
NUM2LONG(), NUM2INT(), NUM2SHORT(), NUM2LL(), INT2NUM(),
  UINT2NUM(), LONG2NUM(), ULONG2NUM() and NUM2CHR()
  implementation. Because 1) They don't make any better code
  at all. 2) Inline function have a better debugger supoort.
  3) If they become to make better code in the future, they
  might make cross compiler ABI compatibility issue.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33756 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-11-15 04:18:43 +00:00
kosaki 9debadd948 * include/ruby/ruby.h: add #ifdef comment.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33744 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-11-14 03:55:40 +00:00
kosaki b2a2ba1191 * include/ruby/ruby.h: add NUM2SHORT(), NUM2USHORT() macros.
* numeric.c: ditto.

* test/-ext-/num2int/test_num2int.rb: add testcases for NUM2SHORT().
* ext/-test-/num2int/num2int.c: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33743 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-11-14 03:54:34 +00:00
nobu 6bb4ddcba5 * include/ruby/ruby.h (rb_long2int): define as a macro always, so
that cpp conditionals can tell if it is provided.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33670 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-11-08 08:59:28 +00:00
usa add77a592b * include/ruby/encoding.h (ECONV_NEWLINE_DECORATOR_READ_MASK,
ECONV_NEWLINE_DECORATOR_WRITE_MASK): new macro.

* io.c (rb_io_extract_modeenc, pipe_open, prep_stdio, argf_next_argv):
  set TEXTMODE_NEWLINE_DECORATOR_ON_WRITE for textmode on creating IO
  if the flag is available.

* io.c (make_writeconv): drop decorators for reading.

* io.c (make_readconv): drop decorators for writing.

* io.c (do_writeconv): existing writeconv is not the condition to raise
  ArgumentError.  should check textmode or not.

* test/ruby/test_io_m17n.rb
  (TestIO_M17N#test_{cr,lf,crlf}_decorator_on_stdout): test above
  changes.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33662 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-11-07 17:48:11 +00:00
akr 1a70dfe6f4 * include/ruby/intern.h (rb_fd_fix_cloexec): renamed from
rb_fd_set_cloexec.

* io.c: follow the above renaming.

* ext/pty/pty.c: ditto.

* ext/socket/init.c: ditto.

* ext/socket/socket.c: ditto.

* ext/socket/ancdata.c: ditto.

* ext/socket/unixsocket.c: ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33585 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-10-31 12:49:16 +00:00
usa b2a1af1547 * win32/win32.c (setfl): extract from fcntl().
* win32/win32.c (dupfd): new function to support F_DUPFD. base on a
  patch written by akr.

* win32/win32.c (fcntl): use above functions.

* include/ruby/win32.h (F_DUPFD): define. [experimental]

* include/ruby/win32.h (F_SETFL): change the value to correspond with
  other platforms.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33581 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-10-31 04:16:11 +00:00
akr 5c19f07700 * include/ruby/intern.h (rb_cloexec_fcntl_dupfd): declared.
* io.c (rb_cloexec_fcntl_dupfd): new function.
  (nogvl_io_cntl): use rb_cloexec_fcntl_dupfd.

* process.c (move_fds_to_avoid_crash): use rb_cloexec_fcntl_dupfd.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33575 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-10-30 15:17:27 +00:00
akr 0d2a92e0b3 * include/ruby/intern.h (rb_cloexec_pipe): declared.
* io.c (rb_cloexec_pipe): new function.
  (rb_pipe): use rb_cloexec_pipe.

* thread_pthread.c (rb_thread_create_timer_thread): use
  rb_cloexec_pipe.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33572 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-10-30 12:13:05 +00:00
akr 0a9cb21e62 * include/ruby/intern.h (rb_cloexec_dup2): declared.
* io.c (rb_cloexec_dup2): new function.
  (io_reopen): use rb_cloexec_dup2.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33557 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-10-29 13:11:01 +00:00
akr 4ae2b92576 * include/ruby/intern.h (rb_cloexec_dup): declared.
* io.c (rb_cloexec_dup): new function.
  (ruby_dup): use rb_cloexec_dup.

* ext/pty/pty.c (pty_getpty): use rb_cloexec_dup.
  
* ext/openssl/ossl_bio.c (ossl_obj2bio): ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33553 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-10-29 11:02:32 +00:00
akr 3ae3cd741d * include/ruby/intern.h (rb_cloexec_open): declared.
* io.c (fd_set_cloexec): extracted from rb_fd_set_cloexec.
  (rb_cloexec_open): new function.
  (sysopen_func): use rb_cloexec_open.
  (rb_sysopen_internal): use rb_update_max_fd instead of
  rb_fd_set_cloexec.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33549 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-10-29 02:33:28 +00:00
naruse bafe837658 * include/ruby/ruby.h (SIZE_MAX): define SIZE_MAX if not defined.
patched by The Written Word Inc. [ruby-core:40422] [Bug #5489]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33532 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-10-27 00:59:46 +00:00
akr 49f6242b34 * include/ruby/defines.h: use "__sparc" instead of "sparc" and
"__sparc__".

* dln.c: ditto.

  [ruby-dev:44694]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33524 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-10-25 12:54:21 +00:00
akr b574a4d4a1 * include/ruby/intern.h (rb_fd_set_cloexec): declared.
* io.c (rb_fd_set_cloexec): new function.
  (ruby_dup): call rb_fd_set_cloexec to set close-on-exec flag.
  (rb_sysopen_internal): ditto.
  (rb_pipe): ditto.
  (io_reopen): ditto.
  (io_cntl): ditto.

* process.c (rb_f_exec): change the default :close_others option to
  true.
  (rb_f_system): ditto.
  (move_fds_to_avoid_crash): call rb_fd_set_cloexec to set
  close-on-exec flag.
  (ruby_setsid): ditto.
  (rb_daemon): ditto.

* thread_pthread.c (rb_thread_create_timer_thread): call
  rb_fd_set_cloexec to set close-on-exec flag.

* ruby.c (load_file_internal): ditto.

* file.c (rb_file_s_truncate): ditto.
  (file_load_ok): ditto.

* random.c (fill_random_seed): ditto.

* ext/pty/pty.c (chfunc): ditto.
  (get_device_once): ditto.

* ext/openssl/ossl_bio.c (ossl_obj2bio): ditto.

* ext/socket/init.c (rsock_socket): ditto.
  (rsock_s_accept_nonblock): ditto.
  (rsock_s_accept): ditto.

* ext/socket/socket.c (rsock_sock_s_socketpair): ditto.

* ext/socket/ancdata.c (discard_cmsg): ditto.
  (make_io_for_unix_rights): ditto.

* ext/socket/unixsocket.c (unix_recv_io): ditto.

* ext/io/console/console.c (console_dev): ditto.

[ruby-core:38140] [Feature #5041]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33507 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-10-22 09:58:15 +00:00
ngoto 971769cd76 * numeric.c (rb_infinity, rb_nan): use union to prevent bus error
caused by misalignment.  [Bug #5469] [ruby-dev:44657]
* include/ruby/missing.h (INFINITY, NAN): ditto


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33502 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-10-21 17:34:58 +00:00
nobu 9c49753182 * include/ruby/defines.h (flush_register_windows): use software
trap on Debian Sparc 32-bit userspace.  [Bug #5244]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33492 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-10-20 04:09:37 +00:00
nobu 3a0e582e1f * include/ruby/intern.h (rb_ary_reverse): export.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33467 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-10-14 02:19:39 +00:00
kosaki 20ae79b0c2 * include/ruby/defines.h: remove NextStep, OpenStep, Rhapsody
support. Last activity of their OSs are 7 years ago.
* configure.in: ditto.
* dir.c: ditto.
* ext/tk/extconf.rb: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33337 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-09-26 00:19:03 +00:00
usa ee7d523631 * win32/win32.c, include/ruby/intern.h (rb_w32_fd_copy): implement
for rb_thread_select() in thread.c.  the use of rb_fd_copy() is
  introduced in r33117.
  [Bug #5229] [ruby-core:39102]

* thread.c (rb_thread_select): must call rb_fd_init() before using
  rb_fdset_t.  see the implementations of rb_fd_init()s if you want to
  know the reason.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33128 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-08-30 15:04:11 +00:00
nobu 543ecd95d5 * include/ruby/win32.h (frexp, modf): original macros.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32862 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-08-05 13:20:26 +00:00
nobu 11667b9c9a * include/ruby/missing.h: fix typo and so on.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32840 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-08-04 02:54:22 +00:00
naruse d04697df88 * include/ruby/missing.h: define __syscall on OpenBSD as r32702.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32839 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-08-04 02:32:19 +00:00
naruse d7c026d058 Mark a code is GPL or not.
This is made the comparison between current and initial commit.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32830 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-08-03 15:40:03 +00:00
usa f9e9eee677 * util.c, include/ruby/util.h (ruby_add_suffix): remove the function.
[Bug #5153] [ruby-core:38736]

* io.c (argf_next_argv): remove the call of above function.

* ext/-test-/add_suffix, test/-ext-/test_add_suffix.rb: remove the test
  extension module because this is only for testsing ruby_add_suffix().

* LEGAL: remove the mention about a part of util.c, because now we
  removed the part.

* io.c (argf_next_argv): now the new filename is not guranteed to
  use, so should check the return value of rename(2).

* test/ruby/test_argf.rb (TestArgf#test_inplace_rename_impossible):
  now we expect same result with other platforms on no_safe_rename
  platforms (=Windows).


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32826 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-08-03 07:10:56 +00:00
naruse da6c57aa54 See __APPLE__ for __syscall.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32715 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-07-28 00:23:28 +00:00
naruse 9f2b8eafdd * include/ruby/missing.h: define __syscall if the platform has
__syscall in the library but doesn't define it in headers
  for example Mac OS X.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32702 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-07-27 08:58:38 +00:00
nobu 3fbc65d47f * parse.y (rb_check_id): make the given name a symbol or a string.
based on the second patch by Jeremy Evans at [ruby-core:38447]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32684 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-07-26 16:05:27 +00:00
nobu 4dc1a21809 * error.c (rb_name_error_str): new function to raise NameError
with the name string but not ID.
* object.c, proc.c, variable.c: more removal of inadvertent symbol
  creation.  [Feature #5079]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32645 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-07-23 15:05:03 +00:00
nobu 34918aa832 * object.c (rb_mod_{const,cvar}_defined, rb_obj_ivar_defined):
avoid inadvertent symbol creation in reflection methods.  based
  on a patch by Jeremy Evans at [ruby-core:38367].  [Feature #5072]
* vm_method.c (rb_mod_method_defined)
  (rb_mod_{public,private,protected}_method_defined)
  (obj_respond_to): ditto.
* parse.y (rb_check_id): new function returns already interned ID
  or 0.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32621 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-07-22 12:06:42 +00:00
nobu c276b73804 * parse.y (rb_is_global_id, rb_is_attrset_id): add missing
predicates.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32620 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-07-22 11:44:53 +00:00
akr b41ccc4a9c * include/ruby/intern.h (rb_update_max_fd): declaration moved from
internal.h.

* file.c: ditto.

* io.c: call rb_update_max_fd for each new fds.

* process.c: ditto.

* random.c: ditto.

* ruby.c: ditto.

* ext/io/console/console.c: ditto.

* ext/openssl/ossl_bio.c: ditto.

* ext/pty/pty.c: ditto.

* ext/socket/init.c: ditto.

* ext/socket/socket.c: ditto.

* ext/socket/ancdata.c: ditto.

* ext/socket/unixsocket.c: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32587 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-07-20 13:26:10 +00:00
nobu e2fd80b3d3 * error.c (rb_check_trusted): new function to check an object is
trusted.
* struct.c (rb_struct_modify), time.c (time_modify): check by the
  above function to show proper class names.  [Bug #5036]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32569 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-07-17 07:26:45 +00:00
usa f15d0deaaf * win32/win32.c, include/ruby/win32.h (rb_w32_io_cancelable_p): renamed
from rb_w32_has_cancel_io().  now it takes a parameter as fd to check
  the fd is console or not, because we cannot cancel console input even
  if we have cancel_io function.

* io.c (WAIT_FD_IN_WIN32): call above function instead of the old one,
  so now we can kill the thread which calls STDIN.gets.
  the problem was reported by ko1 vir IRC.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32549 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-07-15 05:33:45 +00:00
nobu 63ab190151 * win32/win32.c (rb_w32_{read,write}): should be signed.
Bug #5001

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32470 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-07-09 06:59:23 +00:00
ko1 eb35bb0b35 * include/ruby/intern.h, thread_pthread.c (rb_reserved_fd_p,
RB_RESERVED_FD_P): added.  This C API is to limit to access
  fds which are used by RubyVM internal.  In this version of
  CRuby, return 1 if fd is communication pipe.
  If your application needs to close all file descriptors to
  preent resource leak, skip internal fds using this C API.
  We also define a macro RB_RESERVED_FD_P(fd).  So you can write
  #ifndef RB_RESERVED_FD_P
  #define RB_RESERVED_FD_P(fd) 0
  #endif
  for Ruby 1.9.2 or previous version to write compatible extensions.
  See [ruby-core:37727]
* thread_win32.c (rb_reserved_fd_p): added (return 0 for any fds).
* io.c (rb_io_initialize): raise ArgumentError if given fd is reserved by Ruby.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32394 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-07-03 21:56:59 +00:00
kosaki 908baefe7d * internal.h: move rb_thread_io_blocking_region() declaration
from intern.h to internal.h. It's still experimental API and
  need more discussion. [ruby-dev:43698]
* include/ruby/intern.h: ditto.

* ext/socket/rubysocket.h: include internal.h.
* ext/socket/depend: add internal.h dependency.
* ext/socket/extconf.rb: add $INCFLAGS to topdir.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32187 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-21 12:31:17 +00:00
kosaki b9d9ea62b4 revert r32183
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32186 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-21 11:52:24 +00:00
kosaki 97beed076f * internal.h: move rb_thread_io_blocking_region() declaration
from intern.h to internal.h. It's still experimental API and
  need more discussion.
* include/ruby/intern.h: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32183 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-21 10:57:53 +00:00
nobu 19f386674e * include/ruby/backward/classext.h: for evil gems. fixed #4803
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32162 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-18 03:05:11 +00:00