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

249 Коммитов

Автор SHA1 Сообщение Дата
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
ko1 ed4139e39b * include/ruby/intern.h, proc.c: revert rb_proc_call() and
create rb_proc_call_with_block() instaed.
* include/ruby/ruby.h, eval_jump.c, thread.c, vm_insnhelper.c:
  rb_blockptr should not be exposed.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17081 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-10 16:33:51 +00:00
nobu 25de6b0087 * include/ruby/intern.h (rb_obj_instance_exec, rb_mod_module_exec):
added prototypes.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17075 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-10 08:30:21 +00:00
nobu a31f177eaa * include/ruby/ruby.h (CONST_ID_CACHE): fixed statement expression.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17068 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-10 03:43:33 +00:00
nobu 53ea4c0cbd * include/ruby/encoding.h: not to use varargs.h since requiring C89.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17066 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-10 02:24:45 +00:00
mame f2400eca0b * include/ruby/ruby.h, vm_core.h: add a type rb_blockptr.
* vm_insnhelper.c (vm_yield_with_cfunc): vm_yield_with_cfunc receives
  blockptr and passes it to iterating block.

* proc.c (rb_proc_call), include/ruby/intern.h: rb_proc_call receives
  blockptr.  "rb_proc_call(self, args, blockptr)" in C corresponds to
  "self.call(*args, &block)" in Ruby.

* proc.c (proc_call): pass blockptr to block that is written in C.

* proc.c (curry): receive blockptr and pass it to original proc.
  [ruby-core:15551]

* vm.c (invoke_block_from_c): fix for change of vm_yield_with_cfunc.

* thread.c (call_trace_proc), eval_jump.c (rb_call_end_proc): fix for
  change of rb_proc_call.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17065 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-09 15:52:51 +00:00
nobu 5a647a3f5f * include/ruby/ruby.h (CONST_ID): constant ID cache for non-gcc.
* *.c: no cache in init functions.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17053 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-09 09:25:32 +00:00
nobu 6cdc89332e * vm_core.h (struct rb_vm_struct): moved ruby_debug, ruby_verbose, and
rb_progname.

* ruby.c (rb_argv0): no longer used.

* vm.c: getters/setters for ruby_{debug,verbose}.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17039 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-09 05:18:03 +00:00
nobu 10bfa5d49f * include/ruby/intern.h (Init_stack): make to call ruby_init_stack.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17036 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-09 00:54:23 +00:00
usa 6d5e291f7d * include/ruby/win32.h: include ws2tcpip.h. fixed [ruby-Bugs-20528]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16854 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-06 07:43:45 +00:00
nobu 7c5e3348f7 * suppress warnings on cygwin, mingw and mswin.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16740 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-01 19:55:25 +00:00
nobu 075530a685 * suppress warnings with -Wwrite-string.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16716 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-31 09:28:20 +00:00
nobu 1a192e2b29 * include/ruby/mvm.h: new header file for MVM, and moved rb_vm_t and
rb_thread_t from vm_core.h.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16713 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-31 06:17:45 +00:00
nobu 7981720812 * include/ruby/ruby.h: renamed include guard.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16712 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-31 05:55:34 +00:00
ko1 a45cd8a01c * eval.c, eval_intern.h, include/ruby/intern.h, include/ruby/ruby.h,
vm.c, vm_core.h, vm_insnhelper.c: remove pointless "const".



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16540 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-22 16:19:14 +00:00
usa 477c0db2bd * eval_intern.h, vm_core.h, include/ruby/intern.h, include/ruby/ruby.h,
vm.c: need to add const to prototypes, of course.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16526 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-22 06:22:41 +00:00