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

264 Коммитов

Автор SHA1 Сообщение Дата
nobu 012c5ca966 * include/ruby/defines.h (RUBY_ALIAS_FUNCTION): fallback definition.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18609 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-14 06:27:50 +00:00
ko1 8f1e7a37e5 * thread.c (rb_thread_check_ints): added. please note that
this function may cause ruby's thread switching.
* include/ruby/intern.h: ditto.
* regint.h: use rb_thread_check_ints() instead of
  RUBY_CHECK_INTS() directly.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18572 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-13 08:21:24 +00:00
shugo f433d710d0 * object.c (rb_obj_untrusted): new method Object#untrusted?.
(rb_obj_untrust): new method Object#untrust.
  (rb_obj_trust): new method Object#trust.
* array.c, debug.c, time.c, include/ruby/ruby.h, re.c, variable.c,
  string.c, io.c, dir.c, vm_method.c, struct.c, class.c, hash.c,
  ruby.c, marshal.c: fixes for Object#untrusted?.
* test/ruby/test_module.rb, test/ruby/test_array.rb,
  test/ruby/test_object.rb, test/ruby/test_string.rb,
  test/ruby/test_marshal.rb, test/ruby/test_hash.rb: added tests for
  Object#untrusted?.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18568 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-13 07:25:05 +00:00
naruse 85c41f4fbc * error.c (rb_eEncCompatError): add Exception.
* include/ruby/ruby.h: ditto.

* encoding.c (rb_enc_check): use rb_eEncCompatError.

* string.c (rb_enc_cr_str_buf_cat): ditto.

* string.c (rb_str_sub_bang): ditto.

* string.c (rb_str_hex): ditto.

* string.c (rb_str_oct): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18546 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-12 18:17:05 +00:00
nobu f65719e5c6 * string.c (rb_str_drop_bytes): new function to drop first bytes.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18541 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-12 10:08:48 +00:00
nobu 26bc383ef8 * string.c (rb_str_drop): new function to drop first bytes.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18540 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-12 10:07:08 +00:00
nobu 456dc8bcee * include/ruby/intern.h (rb_str_new2, rb_tainted_str_new2,
rb_usascii_str_new2): use with-length versions with strlen to
  optimize strlen, if optimized.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18537 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-12 09:56:55 +00:00
nobu bdcb8fd07e * gc.c (STACK_LEVEL_MAX, ruby_stack_length): returns size_t.
[ruby-core:18207]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18463 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-09 23:56:17 +00:00
akr 4c6321a1f7 add a comment.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18414 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-07 09:06:04 +00:00
naruse 48e21d2051 * eval_intern.h: Add support to Haiku. see [ruby-core:18110]
* include/ruby/defines.h: ditto.

* configure.in: ditto.

* thread_pthread.c: ditto.

* io.c: ditto.

* lib/mkmf.rb: ditto.

* ext/socket/getaddrinfo.c: ditto.

* ext/socket/extconf.rb: ditto.

* ext/socket/socket.c: ditto.

* ext/socket/addrinfo.h: ditto.

* ext/socket/getnameinfo.c: ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18402 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-06 20:52:44 +00:00
nobu 5133fc67a4 * include/ruby/win32.h, bcc32/Makefile.sub (config.h): bcc 5.8 has
stdint.h.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18369 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-05 07:39:21 +00:00
nobu a58e3d763b * array.c (rb_ary_sort_bang): respect overridden <=> for String and
Fixnum.  [ruby-core:17708]

* include/ruby/node.h (NOEX_BASIC): basic definition method flag.

* include/ruby/intern.h, vm_method.c (rb_method_basic_definition_p):
  new function to check if the method is not redefined after the
  initialization.

* vm_method.c (rb_obj_respond_to): use rb_method_basic_definition_p.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18360 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-04 18:29:55 +00:00
nobu b49106dfd7 * array.c (rb_ary_tmp_new): added.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18358 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-04 10:21:46 +00:00
mame 84fd4181fc * include/ruby/ruby.h (struct RString): size of ary must be
RSTRING_EMBED_LEN_MAX + 1.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18289 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-07-31 04:19:01 +00:00
ko1 60be3dc560 * include/ruby/ruby.h: add a type T_DEFERRED.
* gc.c: fix deferred finalizer system.  finalize processes of
  T_DATA and T_FILE are executed after gc process.
  And fix to use BUILTIN_TYPE() instead of seeing flag.
* thread.c, vm_core.h: add RUBY_VM_SET_FINALIZER_INTERRUPT()
  and check intterupt_flag at rb_thread_execute_interrupts().
* thread.c (mutex_mark): fix to mark next_mutex.
* vm.c (rb_thread_mark): fix to mark keeping_mutexes.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18231 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-07-27 05:59:32 +00:00
nobu 70b317b9da * include/ruby/intern.h, sprintf.c (rb_str_catf, rb_str_vcatf): new
functions.  [ruby-dev:35597]

* string.c (rb_str_capacity): new function to return the capacity.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18156 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-07-22 07:48:00 +00:00
nobu 5ffd0cc80f * include/ruby/intern.h (rb_str_buf_new2): optimization for literals.
* string.c (str_buf_cat): returns VALUE.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18148 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-07-21 19:26:18 +00:00
nobu c62db0676b * include/ruby/intern.h (rb_str_buf_cat2, rb_str_cat2): optimization
for literals.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18146 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-07-21 17:51:49 +00:00
usa a0fe21b362 * include/ruby/ruby.h (PRI_PTRDIFF_PREFIX, PRI_SIZE_PREFIX): typo.
* {bcc32,win32}/Makefile.sub: (SIZEOF_SIZE_T, SIZEOF_PTRDIFF_T): added.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18051 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-07-12 20:39:02 +00:00
nobu 4fd8cbe484 * include/ruby/ruby.h (PRI_PTRDIFF_PREFIX, PRI_SIZE_PREFIX): fixed typo.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18040 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-07-12 13:41:42 +00:00
nobu 7365301470 * include/ruby/intern.h (HAVE_RUBY_RUBY_H): defines macros so that
extconf.rb do not need to check if headers exist under separated
  directory.  [ruby-dev:35437]

* include/{ruby,rubyio,rubysig}.h, include/ruby/intern.h: use
  "ruby/..." instead of <ruby/...>.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18039 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-07-12 13:30:46 +00:00
nobu f94f8f351e * configure.in (sizeof ptrdiff_t): check for size of ptrdiff_t.
* include/ruby/ruby.h (PRI?PTRDIFF, PRI?SIZE): printf conversion
  specifiers for ptrdiff_t and size_t/ssize_t.

* insns.def (leave), marshal.c (long_toobig), transcode.c
  (str_transcode), vm_dump.c (control_frame_dump, stack_dump_each),
  (debug_print_register, debug_print_pre): t and z length modifiers
  are C99.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18038 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-07-12 13:17:29 +00:00
usa 989d3ef272 * include/ruby/win32.h (pipe): prohibit inheritance.
fixed: [ruby-dev:35421]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18015 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-07-10 20:09:38 +00:00
usa 2db158667a * dir.c: shoudn't use ruby object in globbing, because glob service
routines are called before initializing ruby on some platforms (ex.
	  windows).



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17953 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-07-08 02:44:12 +00:00
naruse 0ad460dde8 * dir.c: preserve encoding of strings in glob and fnmatch.
* include/ruby/ruby.h: related changes.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17950 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-07-07 17:29:44 +00:00
akr d375b77352 * include/ruby/ruby.h (NUM2INT): cast to int.
(FIX2INT): ditto.
  (NUM2UINT): cast to unsigned int.
  (FIX2UINT): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17897 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-07-05 14:47:06 +00:00
akr b279bf4270 rename rb_pipe_internal to rb_pipe.
use rb_pipe in pipe_nocrash.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17895 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-07-05 14:12:53 +00:00
nobu 28b216ac45 * include/ruby/oniguruma.h (OnigEncoding): removed auxiliary_data.
* include/ruby/encoding.h (ENC_DUMMY_P): moved dummy encoding flag to
  rb_encoding from Encoding instance.

* encoding.c (rb_encoding_list): list of Encoding instances.

* encoding.c (struct rb_encoding_entry): moved base encoding from
  instance variable.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17875 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-07-04 11:44:05 +00:00
mame ae3a03eb07 * include/ruby/intern.h: remove prototypes about coverage.
* iseq.c (prepare_iseq_build): add prototype.

* parse.y (coverage): ditto.

* thread.c (clear_coverage): ditto.

* thread.c (update_coverage): use rb_sourceline.

* thread.c (rb_get_coverages): rename and move to vm.c.

* vm.c (rb_vm_get_coverages): ditto.

* ext/coverage/coverage.c: add rdoc.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17859 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-07-03 14:27:43 +00:00
mame f08581c7b6 * ext/coverage/coverage.c, ext/coverage/extconf.rb: eliminate
COVERAGE__ and introduce coverage.so instead.  How to measure
  coverage: (1) require "coverage.so", (2) require or load Ruby source
  file, and (3) Coverage.result will return the same hash as COVERAGE__.
  [ruby-dev:35324]

* thread.c (rb_enable_coverages): start coverage measurement by using
  rb_add_event_hook.

* thread.c (rb_get_coverages): returns current results of coverage
  measurement.

* include/ruby/intern.h: add prototype for above two functions.

* vm_core.h, vm.c: add field of coverages to rb_vm_t.

* insns.def (trace): remove special handling for COVERAGE__.

* iseq.c (prepare_iseq_build): switch COVERAGE__ to
  rb_get_coverages().

* parse.y (coverage): ditto.

* thread.c (clear_coverage): ditto.

* lib/coverage.rb: use coverage.so instead of COVERAGE__.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17857 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-07-03 12:55:12 +00:00
suke 8519afcb41 * gc.c: add rb_during_gc(). based on a patch from arton <artonx AT
yahoo.co.jp> at [ruby-dev:35313].   

* include/ruby/intern.h: ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17819 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-07-02 15:18:44 +00:00
ko1 9a61579c16 * compile.h, insns.def: reduce insn operand of "trace".
* include/ruby/ruby.h: add RUBY_EVENT_COVERAGE event.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17785 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-07-01 18:13:22 +00:00
shyouhei 3e69e83a62 * include/ruby/ruby.h (enum ruby_special_consts): ISO C forbids
comma at end of enumerator list

 	* include/ruby/ruby.h (enum ruby_value_type): ditto.

	* eval_intern.h (enum): ditto.

	* vm_core.h (enum rb_thread_status): ditto.

	* parse.y (enum lex_state_e): ditto.

	* parse.y (enum string_type): ditto.

	* process.c (enum): ditto.

	* ruby.c (enum dump_flag_bits): ditto.

	* ruby.c (enum disable_flag_bits): ditto.

	* compile.c (iseq_link_element): ditto

	* debug.c (union): ditto.

	* cont.c (enum context_type): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17766 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-07-01 08:27:58 +00:00
nobu 4f572663c8 * regexec.c (stack_double): use MatchStackLimitSize atomically.
* regparse.c (onig_free_shared_cclass_table): OnigTypeCClassTable
  needs atomicity

* regsyntax.c: constified all predefined OnigSyntaxTypes.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17765 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-07-01 08:21:44 +00:00
shyouhei 6f88631baa * include/ruby/st.h (struct st_table): type of bit-field
'num_entries' is a GCC extension


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17764 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-07-01 07:59:21 +00:00
shyouhei a739f59359 * include/ruby/ruby.h (rb_intern): prefix __extnsion__ for
braced-groups within expressions.

  	* include/ruby/intern.h (rb_usascii_str_new2): ditto.

	* include/ruby/intern.h (rb_tainted_str_new2): ditto.

	* include/ruby/intern.h (rb_str_new2): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17763 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-07-01 07:56:51 +00:00
naruse 04d83114a6 * encoding.c (rb_utf8_encindex): defined.
* include/ruby/encoding.h (rb_utf8_encindex): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17724 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-29 17:33:01 +00:00
ko1 9ebf6473eb * vm.c, vm_core.h,vm_core.h, vm_dump.c, iseq.c: rename class name
VM -> RubyVM, and rename rb_cVM -> rb_cRubyVM.
  "VM" is too short name for class.
* test/ruby/test_method.rb, test/ruby/test_settracefunc.rb: ditto.
* include/ruby/ruby.h: rb_cRubyVM, rb_cEnv, rb_cISeq should not be
  exposed.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17723 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-29 17:26:16 +00:00
akr 340cd503a7 * include/ruby/ruby.h (struct RRegexp): new field usecnt. replace
str and len by src.

* gc.c (gc_mark_children): mark src field of regexp.
  (obj_free): don't free str field.

* re.c (REG_BUSY): removed.
  (rb_reg_initialize): prohibit re-initialize regexp.
  (rb_reg_search): use usecnt to prevent freeing regexp currently
  using.  this prevents SEGV by:
    r = /\A((a.)*(a.)*)*b/
    r =~ "ab" + "\xc2\xa1".force_encoding("euc-jp")
    t = Thread.new { r =~ "ab"*8 + "\xc2\xa1".force_encoding("utf-8")}
    sleep 0.2
    r =~ "ab"*8 + "\xc2\xa1".force_encoding("euc-jp")



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17635 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-28 12:25:45 +00:00
nobu 4c766e1713 * include/ruby/intern.h (rb_str_new2, rb_tainted_str_new2,
rb_usascii_str_new2): use inline versions only for constant
  literals.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17634 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-28 12:15:55 +00:00
nobu 54b64e2096 * include/ruby/intern.h (rb_str_new2, rb_tainted_str_new2,
rb_usascii_str_new2): use inline versions for gcc 4 or lator.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17633 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-28 11:50:38 +00:00
nobu f1d4745627 * include/ruby/intern.h (rb_str_new2, rb_tainted_str_new2,
rb_usascii_str_new2): use with-length versions with strlen to
  optimize strlen, if optimized.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17599 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-27 04:29:29 +00:00
nobu 2983df49d5 * include/ruby/intern.h (rb_str_new2, rb_tainted_str_new2,
rb_usascii_str_new2): use with-length versions with strlen to
  optimize strlen.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17598 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-27 04:18:54 +00:00
usa d3a0ef8198 * include/ruby/win32.h, win32/win32.c (rb_w32_getppid): now support
getppid() on win32 (but only Win2k or later).

	* process.c (get_ppid): remove win32 special logic.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17553 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-24 02:14:00 +00:00
akr 04739ba617 * string.c (rb_memhash): randomize hash to avoid algorithmic
complexity attacks.
  (rb_str_hash): use rb_memhash.

* include/ruby/intern.h (rb_reset_random_seed): declared.

* thread.c (rb_thread_atfork): call rb_reset_random_seed.

* inits.c (rb_call_inits): call Init_RandomSeed at first.

* random.c (seed_initialized): defined.
  (fill_random_seed): extracted from random_seed.
  (make_seed_value): extracted from random_seed.
  (rb_f_rand): initialize random seed at first.
  (initial_seed): defined.
  (Init_RandomSeed): defined.
  (Init_RandomSeed2): defined.
  (rb_reset_random_seed): defined.
  (Init_Random): call Init_RandomSeed2.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17465 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-20 02:46:17 +00:00
usa 844952338b * include/ruby/win32.h (pipe): now pipe is textmode. although this
change is experimental, it will be spec if no compatiblity problem
	  is reported.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17400 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-18 04:51:08 +00:00
usa 5e54153132 * include/ruby/win32.h (pipe): expand pipe buffer size.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17377 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-17 09:11:28 +00:00
naruse 2755479bd9 * encoding.c (rb_filesystem_encoding): defined.
* include/ruby/encoding.h (rb_filesystem_encoding): added.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17372 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-16 21:28:03 +00:00
tadf c7f4ebc8b7 * complex.c (string_to_c, nucomp_s_convert): preserve the current
backref.

	* rational.c (string_to_r, nurat_s_convert): ditto.

	* include/ruby/intern.h (rb_match_busy): added a declaration.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17150 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-13 12:29:50 +00:00
akr 69fa5eea6a * include/ruby/ruby.h (rb_intern): use rb_intern2 with strlen for
constant symbols to optimize strlen.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17105 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-12 04:46:16 +00:00