* configure.in: struct timeval is defined in winsock2.h on mingw.
* include/ruby/missing.h: include time.h for time_t, and sys/time.h
for timeval and timespec.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39777 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* io.c: here. because __syscall() is only used from io.c.
* include/ruby/missing.h: move "#include <sys/type.h>" to ....
* include/ruby/intern.h: here. because it was introduced for
fixing NFDBITS issue. [ruby-core:05179].
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39774 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* include/ruby/intern.h (rb_check_arity): same name macro for backward
compatibility checking by ifdef.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39610 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* include/ruby/intern.h (rb_check_arity): make a static inline
function so it can be used as an expression and argc would be
evaulated only once.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39598 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* include/ruby/version.h: bump RUBY_API_VERSION same as RUBY_VERSION.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39496 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
The order of making binding should be stack (frame) top to bottom.
[Bug #7635]
And also fix issue of collecting klass. Collecting klass is same
as TracePoint#defined_class.
(previous version, it returns T_ICLASS (internal objects).
* test/-ext-/debug/test_debug.rb: add a test.
* ext/-test-/debug/extconf.rb, init.c, inspector.c: ditto.
* vm_backtrace.c: remove magic number and add enum CALLER_BINDING_*.
* vm_backtrace.c, include/ruby/debug.h: add new C api (experimental)
rb_debug_inspector_frame_self_get().
* vm.c, vm_core.h, vm_trace.c: move decl. of
rb_vm_control_frame_id_and_class() and constify first parameter.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38970 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* vm_backtrace.c (rb_debug_inspector_frame_{class,binding,iseq}_get):
use long as index as well as RARRAY_LEN().
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38962 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* include/ruby/ruby.h (RBasic): to be aligned on a VALUE size
boundary. [Bug #7647]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38741 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This flag is not contained by RUBY_EVENT_TRACEPOINT_ALL.
This event is experimental one. It is possible to remove/rename
flag name after 2.0.1.
* vm_trace.c (get_event_id): return :line if SPECIFIED_LINE was
occurred. `:specified_line' never been returned.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38728 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* thread.c (recursive_check): object_id maybe a Bignum, not Fixnum on
LLP64. see also r38493 and r38548.
reported by Heesob Park at [ruby-core:51083] [Bug #7607], and patched
by shirosaki at [ruby-core:51095]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38595 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
rb_num_coerce_bit.
* numeric.c (rb_num_coerce_bit): the new coerce function for bitwise
binary operation.
* bignum.c (rb_big_and): use coerce to convert the argument, which isn't
a Fixnum nor a Bignum, to the corresponding Integer object so that
bitwise operations can support Integer-mimic objects.
[Bug #1792] [ruby-core:39491]
* bignum.c (rb_big_or): ditto.
* bignum.c (rb_big_xor): ditto.
* numeric.c (bit_coerce): ditto.
* numeric.c (fix_and): ditto.
* numeric.c (fix_or): ditto.
* numeric.c (fix_xor): ditto.
* test/ruby/test_integer.rb: add tests for the above changes.
* test/ruby/test_bignum.rb: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38560 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* include/ruby/ruby.h (RTEST, NIL_P): make bare expressions without
outermost parentheses.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38499 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
warnings for unused variables.
* ext/bigdecimal/bigdecimal.c (ENTER): use RB_UNUSED_VAR() to
suppress annoying warnings by -Wunused-but-set-variable in gcc 4.6.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38351 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This change is a little tricky, so it might be better to prohibit
module inclusion to refinements.
* include/ruby/ruby.h (RMODULE_INCLUDED_INTO_REFINEMENT): new flag
to represent that a module (iclass) is included into a refinement.
* class.c (include_modules_at): set RMODULE_INCLUDED_INTO_REFINEMENT
if klass is a refinement.
* eval.c (rb_mod_refine): set the superclass of a refinement to the
refined class for super.
* eval.c (rb_using_refinement): skip the above superclass (the
refined class) when creating iclasses for refinements. Otherwise,
`using Refinement1; using Refinement2' creates iclasses:
<Refinement2> -> <RefinedClass> -> <Refinement1> -> RefinedClass,
where <Module> is an iclass for Module, so RefinedClass is
searched before Refinement1. The correct iclasses should be
<Refinement2> -> <Refinement1> -> RefinedClass.
* vm_insnhelper.c (vm_search_normal_superclass): if klass is an
iclass for a refinement, use the refinement's superclass instead
of the iclass's superclass. Otherwise, multiple refinements are
searched by super. For example, if a refinement Refinement2
includes a module M (i.e., Refinement2 -> <M> -> RefinedClass,
and if refinements iclasses are <Refinement2> -> <M>' ->
<Refinement1> -> RefinedClass, then super in <Refinement2> should
use Refinement2's superclass <M> instead of <Refinement2>'s
superclass <M>'.
* vm_insnhelper.c (vm_search_super_method): do not raise a
NotImplementError if current_defind_class is a module included
into a refinement. Because of the change of
vm_search_normal_superclass(), the receiver might not be an
instance of the module('s iclass).
* test/ruby/test_refinement.rb: related test.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38298 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Module#refine activates all refinements defined in that module
only in a given block.
* string.c (sym_to_proc, sym_call): don't use refinements.
* test/ruby/test_refinement.rb: related test.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38269 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* iseq.c: add following two methods.
* ISeq#line_trace_all returns all line traces (line numbers)
* ISeq#line_trace_specify(pos, set) set `pos'th line event to
specified_line event (if set is true).
These features are introduced for debuggers (mainly to make
breakpoint).
* iseq.h: add decl. of C APIs.
* test/ruby/test_iseq.rb: add tests.
* vm_trace.c: add `specified_line' event.
* include/ruby/ruby.h: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38076 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* include/ruby/ruby.h (RB_GC_GUARD_PTR): add note.
* vm_backtrace.c (backtrace_to_str_ary): use RB_GC_GUARD() instead of
RB_GC_GUARD_PTR() which has no effect.
(backtrace_to_location_ary): ditto.
(vm_backtrace_to_ary): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38015 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
instead of rb_tracepoint_attr_*().
These APIs are for debuggers/profilers.
They will be explained in another docs somtime.
* vm_trace.c: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37975 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
meaning of function.
This function is called with same parameters of
`rb_thread_call_without_gvl()'.
However, if interrupts are detected, when return immediately.
* thread.c: implement `rb_thread_call_without_gvl2()'.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37938 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
to TracePoint#path and TracePoint#lineno respectively.
They are consistent to RubyVM::Backtrace::Location.
* include/ruby/debug.h: ditto.
* vm_core.h: ditto.
* test/ruby/test_settracefunc.rb: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37876 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Debugging/profiling features will be located.
* vm_trace.c: expose C-level TracePoint APIs.
Note that they are experimental.
* vm_trace.c, include/ruby/debug.h: rename `rb_hook_flag_t'
to `rb_event_hook_flag_t'.
Macro names `RUBY_HOOK_FLAG_*' are also renamed to
`RUBY_EVENT_HOOK_FLAG_*'.
* debug.h, vm_debug.h: rename debug.h to vm_debug.h.
* common.mk: ditto.
* debug.c, main.c, vm_core.h: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37765 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
`func' from `int *skip_interrupt' to `VALUE *flags'.
If (flags & RUBY_CALL_WO_GVL_FLAG_SKIP_CHECK_INTS) is not zero,
then skip checking interrupt.
[ruby-core:46547]
* include/ruby/thread.h: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37681 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* include/ruby/ruby.h (alloca), eval_intern.h (alloca), gc.c
(alloca): Make alloca() globally available by moving the
ultimate ifdef's to ruby/ruby.h. Gcc hides its builtin alloca()
when compiling with -ansi, and linking thus fails on platforms
that lack their own alloca() implementation in libc, which
include OpenBSD and some ports of NetBSD. We use alloca()
everywhere including from within third party C extentions, so
alloca() must be made globally available. [Bug #7307]
* addr2line.c (alloca): Replace the alloca() part with the
ultimate ifdef's. [Bug #7307]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37571 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
refinement module, and don't override method_added.
* vm_method.c (rb_method_entry_make): check redefinition of
optimized methods when a method is added to a refinement module.
[ruby-core:48970] [Bug #7290]
* test/ruby/test_refinement.rb: related test.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37534 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
[Feature #6636]
* include/ruby/intern.h: RETURN_SIZED_ENUMERATOR for support of
sized enumerators
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37497 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* load.c (rb_feature_p, rb_provide_feature): index $LOADED_FEATURES
so that require isn't so slow.
* load.c (rb_provide_feature, get_loaded_features_index): ensure
that $LOADED_FEATURES entries are frozen strings. The user
must mutate $LOADED_FEATURES itself rather than its individual
entries.
* load.c (reset_loaded_features_snapshot): add a new function to reset
vm->loaded_features_snapshot.
* load.c (get_loaded_features_index_raw): add a new function to get
the loaded-features index.
* load.c (features_index_add_single): add a new function to add to the
loaded-features index a single feature.
* load.c (features_index_add): add a new function to add to the
loaded-features index all the required entries for `feature`.
* vm_core.h (rb_vm_struct): add fields.
* vm.c (rb_vm_mark): mark new fields.
* include/ruby/intern.h (rb_hash_clear): declare function.
* hash.c (rb_hash_clear): make function non-static.
Patch by Greg Price.
[ruby-core:47970] [Bug #7158]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37480 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
should close over the current refinements.
[ruby-dev:46345] [Bug #7261]
* vm_eval.c (rb_call0, rb_search_method_entry,
rb_funcall_passing_block_with_refinements): add a new argument
`refinements' for the above changes.
* test/ruby/test_refinement.rb: related test.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37418 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
make all Float objects frozen.
[ruby-dev:46081] [ruby-trunk - Feature #6936]
Most part of patch by NARUSE, Yui <naruse@ruby-lang.org>.
* class.c (singleton_class_of): raise TypeError when
trying to define a singleton method on Float objects.
* vm.c (vm_define_method): ditto.
* test/ruby/marshaltestlib.rb: catch up above changes.
* test/ruby/test_class.rb: ditto.
* test/test_pp.rb: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37341 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* include/ruby/win32.h (fstat): use _fstati64() instead of fstati64()
on mingw32.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37337 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
`rb_add_method_cfunc_frameless()' API.
This API is not mature to become an offical API.
For example, we can not use this API with
`rb_define_private_method()'.
* method.h, vm_method.c (rb_add_method_cfunc_frameless): removed.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37320 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* include/ruby/win32.h (rb_w32_pow): set floating point precision
for mingw-w64 x86 pow(). This improves the precision of pow() on
Windows XP for TestFloat#test_round_with_precision failure.
[ruby-core:47911] [Bug #7142]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37168 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* random.c (rb_random_ulong_limited): new function to return a random
value from 0 upto limit as unsigned long, simillary to
rb_genrand_ulong_limited but with arbitrary RNG object.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37125 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* .gdbinit (rp): FLONUM support.
* include/ruby/ruby.h (ruby_special_consts): define FLONUM constants
always, so that they are available from gdb.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36917 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* include/ruby/ruby.h (RB_FLOAT_TYPE_P): merge FLONUM and non-FLONUM
versions. inline TYPE() comparison and FLONUM_P() should be
optimized away on non-FLONUM.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36916 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This technique was pointed by shinichiro.hamaji
<http://shinh.skr.jp/m/?date=20120825#p02>.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36832 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* include/ruby/ruby.h (rb_float_new): suppress bitwise-op-parentheses
warning, and zero-expand to VALUE before bit negation to get rid of
confusion.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36819 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
64bit CPU environment (sizeof(double) == sizeof(VALUE)).
flonum technique enables to avoid double object creation
if the double value d is in range about between
1.72723e-77 < |d| <= 1.15792e+77 or 0.0.
flonum Float value is immediate and their lowest two bits
are b10.
If flonum is activated, then USE_FLONUM macro is 1.
I'll write detailed in this technique on
https://bugs.ruby-lang.org/projects/ruby-trunk/wiki/Flonum_tech
* benchmark/bmx_temp.rb: add an benchmark for simple
Float calculation.
* gc.c (id2ref, rb_obj_id): add flonum Float support.
* include/ruby/intern.h: move decl of rb_float_new(double)
to include/ruby/ruby.h.
* insns.def, vm.c, vm_insnhelper.c: add flonum optimization
and simplify source code.
* vm_insnhelper.h (FLONUM_2_P): added.
* marshal.c: support flonum output.
* numeric.c (rb_float_new_in_heap): added.
* parse.y: support flonum.
* random.c: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36798 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
(1) add rb_hook_list_t data structure which includes
hooks, events (flag) and `need_clean' flag.
If the last flag is true, then clean the hooks list.
In other words, deleted hooks are contained by `hooks'.
Cleanup process should run before traversing the list.
(2) Change check mechanism
See EXEC_EVENT_HOOK() in vm_core.h.
(3) Add `raw' hooks APIs
Normal hooks are guarded from exception by rb_protect().
However, this protection is overhead for too simple
functions which never cause exceptions. `raw' hooks
are executed without protection and faster.
Now, we only provide registration APIs. All `raw'
hooks are kicked under protection (same as normal hooks).
* include/ruby/ruby.h: remove internal data definition and
macros.
* internal.h (ruby_suppress_tracing), vm_trace.c: rename
ruby_suppress_tracing() to rb_suppress_tracing()
and remove unused function parameter.
* parse.y: fix to use renamed rb_suppress_tracing().
* thread.c (thread_create_core): no need to set RUBY_VM_VM.
* vm.c (mark_event_hooks): move definition to vm_trace.c.
* vm.c (ruby_vm_event_flags): add a global variable.
This global variable represents all of Threads and VM's
event masks (T1#events | T2#events | ... | VM#events).
You can check the possibility kick trace func or not
with ruby_vm_event_flags.
ruby_vm_event_flags is maintained by vm_trace.c.
* cont.c (fiber_switch, rb_cont_call): restore tracing status.
[Feature #4347]
* test/ruby/test_continuation.rb: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36715 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* include/ruby/ruby.h (NUM2ULONG): optimize by inline as well as
NUM2LONG, and cast to unsigned long explicitly for the platforms
where SIZEOF_VALUE is larger than SIZEOF_LONG.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36631 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* include/ruby/win32.h (rb_w32_pow): add new function.
We use powl() instead of broken pow() for x64-mingw32. This workaround
fixes test failures related to floating point numeric.
[ruby-core:46686] [Bug #6784]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36522 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
except when the optional argument is set to false.
[ruby-dev:44034] [Bug #4971]
* variable.c (rb_mod_constants): fix typo in documentation.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36466 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* internal.h: move mark function declarations that should be private.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36463 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
it can skip last CHECK_INTS. See document for more details.
Document about it was updated a bit.
* include/ruby/thread.h (decl. of rb_thread_call_without_gvl2): added.
* thread.c (rb_thread_call_with_gvl): remove "EXPERIMENTAL!"
warning from a document.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36433 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* include/ruby/intern.h (rb_thread_blocking_region): fix declarations
prototypes without arguments in C++ have different meanings than C.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36379 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
we do not need to disclose intermediate representation of program.
The program embedding CRuby should use rb_eval_string family.
* include/ruby/ruby.h (ruby_opaque_t): removed.
(ruby_compile_main_from_file, ruby_compile_main_from_string,
ruby_eval_main): removed.
* eval.c (ruby_eval_main_internal): became ruby_exec_internal() again.
(ruby_eval_main): removed.
* ruby.c (PREPARE_PARSE_MAIN) reverted.
(parse_and_compile_main, ruby_compile_main_from_file,
ruby_compile_main_from_string): removed
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36362 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* include/ruby.h (HAVE_RUBY_THREAD_H): to show ruby/thread.h to be
available. fixup of r36355.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36359 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
no meaning definition since r24894.
* main.c: ditto.
* nacl/pepper_main.c: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36348 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* error.c (rb_check_copyable): new function, to ensure the target is
not frozen and the source is not tainted nor untrusted.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36174 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* include/ruby/ruby.h: public symbols must have default visibility.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36081 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
for few years because:
* NODE is no longer accessible.
* rb_iseq_eval_main crashes without preparing with rb_thread_t.
* some existing APIs calls exit(3) without giving the opportunity to
finalize or handle errors to the client.
* No general-purpose function to compile a source to an iseq are
published in the public headers.
This commit solves the problems.
* include/ruby/ruby.h: Grouped APIs for embedding CRuby interpreter.
(ruby_setup, ruby_compile_main_from_file,
ruby_compile_main_from_string, ruby_eval_main,
ruby_set_script_name): new APIs to embed CRuby.
(ruby_opaque_t) Opaque pointer to an internal data, to NODE or iseq
in particular.
* eval.c (ruby_setup): Similar to ruby_init but returns an error code
instead of exit(3) on error.
(ruby_eval_main): Similar to ruby_exec_node but returns the
evaluation result.
(ruby_eval_main_internal): renamed from ruby_exec_internal.
* ruby.c (toplevel_context): new helper function.
(PREPARE_EVAL_MAIN): moved.
(process_options): refactored with new functions.
(parse_and_compile_main) new helper funciton.
(ruby_compile_main_from_file, ruby_compile_main_from_string) new API
(ruby_set_script_name): new API.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36079 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* include/ruby/win32.h: get rid of C99 style one line comments.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36055 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
this API wraps an I/O handle (HANDLE or SOCKET) and returns fd.
the second parameter should be combination of O_*, for example,
O_RDWR | O_BINARY | O_NOINHERT.
* win32/win32.c, include/ruby/win32.h (rb_w32_unwrap_io_handle): new
API. this API unwraps an I/O handle and close the fd (not closes
the handle itself).
[Feature #4960] [ruby-core:37227]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35937 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
run_exec_dup2 here because it should be async-signal-safe.
(run_exec_dup2): use the temporary buffer.
(run_exec_dup2_tmpbuf_size): new function.
* include/ruby/intern.h (rb_exec_arg): add dup2_tmpbuf field.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35923 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
But now disabled. [experimental]
* complex.c: followed the above.
* rational.c: ditto.
* include/rub/intern.h: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35886 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
failed. [ruby-core:44093] [ruby-trunk - Bug #6249]
* include/ruby/intern.h (rb_exec_arg): add envp_str and envp_buf field
to store envp of execve().
* process.c (proc_exec_v): takes envp_str as an argument and use it
for execve().
(rb_proc_exec_ne): extended version of rb_proc_exec_n().
(rb_proc_exec_n): use rb_proc_exec_ne().
(rb_proc_exec): follow proc_exec_v() change.
(fill_envp_buf_i): new function.
(rb_exec_arg_fixup): set up envp_str and envp_buf.
(save_env_i): removed.
(save_env): removed.
(rb_run_exec_options_err): don't modify environment variables.
(rb_exec_err): use rb_proc_exec_ne().
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35882 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
To avoid buffer overflow when smaller FD_SETSISE is used in ext
libraries.
* win32/win32.c (rb_w32_fdset): this function is not used anymore.
But we leave this for compatibility.
* win32/win32.c (rb_w32_select_with_thread): fix SEGV when smaller
FD_SETSISE is used in ext libraries. Dereference of fd_set pointer
causes SEGV.
* test/-ext-/win32/test_fd_setsize.rb(TestFdSetSize): add tests for
above.
* ext/-test-/win32/fd_setsize/depend: ditto.
* ext/-test-/win32/fd_setsize/extconf.rb: ditto.
* ext/-test-/win32/fd_setsize/fd_setsize.c: ditto.
[ruby-core:44588] [Bug #6352]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35595 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
registered with NUL-terminated C string.
* sprintf.c (rb_str_format): avoid inadvertent symbol creation.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35300 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
the message in the given encoding. patched by now (Nikolai
Weibull) at [ruby-core:41160]. [Feature #5650]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35283 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
new function.
* process.c (enum): add EXEC_OPTION_PGROUP and move the position
above for the usage in proc_spawn_n().
* process.c (proc_spawn_n): add an argument to pass new option
`new_pgroup`. The option specifies CREATE_NEW_PROCESS_GROUP flag to
CreateProcessW(). This flag is necessary for the usage of
Process.kill on the subprocess on Windows.
* process.c (rb_exec_arg_addopt): ditto.
* process.c (rb_spawn_process): ditto.
* process.c (documentation for rb_f_spawn): add documentation for new
option `new_pgroup` of spawn.
* test/ruby/test_process.rb (TestProcess#test_execopts_new_pgroup):
add tests for option `new_pgroup`.
* test/ruby/test_thread.rb
(TestThreadGroup#test_thread_timer_and_interrupt):
add option `new_pgroup: true` to spawn on Windows. It's needed for
Process.kill on a subprocess.
* win32/win32.c (CreateChild): add an argument to pass
dwCreationFlags of CreateProcessW().
* win32/win32.c (rb_w32_spawn): ditto.
* win32/win32.c (rb_w32_aspawn_flags): add new function to pass
dwCreationFlags.
* win32/win32.c (rb_w32_aspawn): refactor to move the content to
rb_w32_aspawn_flags().
[ruby-core:43245][Bug #6131]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35250 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
well as String#hex and String#oct. [ruby-core:43566][Bug #6192]
* string.c (rb_must_asciicompat): check if ASCII compatible.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35120 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
to time_t directly, not to be affected by TZ unnecessarily.
* win32/win32.c (unixtime_to_filetime): convert time_t to FILETIME
simply.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35109 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
remove static.
* enumerator.c (lazy_init_iterator, lazy_init_yielder,
lazy_select_func, lazy_reject_func, lazy_grep_func): handle
multiple values correctly.
* enumerator.c (lazy_grep): change the behavior when a block is
given, to be consistent with Enumerable#grep.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35043 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
arbitrary object as a pointer to rb_encoding, and return NULL if
not found.
* io.c (io_encoding_set): just warn unsupported encodings, but not
exception. [ruby-core:40726] [Bug #5567]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34986 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
and st_delete_safe. patched by Sokolov Yura at
https://github.com/ruby/ruby/pull/84
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34963 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* error.c (rb_load_fail): use path as a string, not char*.
* internal.h: (rb_load_fail): moved from ruby/intern.h.
* ruby.c (load_file_internal): fname cannot be NULL.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34941 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
instance variable to the LoadError exception.
* load.c: call rb_loaderror_with_path so that the missing path is
added to the exception.
* ruby.c: call rb_loaderror rather than raising our own LoadError
exception.
* include/ruby/intern.h: add declaration for rb_loaderror_with_path.
* test/ruby/test_require.rb: add supporting test for LoadError#path
method.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34938 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Array() or Float(). a patch from Run Paint Run Run. Fix#3131
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34367 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* win32/win32.c (init_stdhandle): set default mode of stdin as binmode.
* io.c (set_binary_mode_with_seek_cur): new function to replace
SET_BINARY_MODE_WITH_SEEK_CUR macro. now returns previous mode of the
fd and take care of LF in rbuf.
* io.c (do_writeconv): set text mode when needed.
* io.c (io_read): need to change the mode of the IO to binmode
temporally when the length for IO#read, because IO#read with length
must behave so.
* test/ruby/test_io_m17n.rb (TestIO_M17N#est_{read_with_length,
read_with_length_binmode,get[cs]_and_read_with_binmode,
read_with_binmode_and_get[cs],read_write_with_binmode}): tests for
above changes.
all patches are written by Hiroshi Shirosaki. [ruby-core:41496]
[Feature #5714]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34043 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
an Integer if possible, but returns nil instead of raising an
exception otherwise.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34007 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
r33876. [ruby-core:41475] [Bug #5706]
* ext/socket/extconf.rb: the alternative hack for [Bug #5675].
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33947 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
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
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