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

580 Коммитов

Автор SHA1 Сообщение Дата
tmm1 53e0d4666c gc.c: Load GC tuning settings earlier during boot.
* gc.c (ruby_gc_set_params): Accept safe_level argument so GC tuning
  settings can be applied before rb_safe_level() is available.
* internal.h (rb_gc_set_params): ditto.
* ruby.c (process_options): Apply GC tuning early during boot process
  so boot-time allocations can benefit. This also benefits any code
  loaded in via `ruby -r`.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43991 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-12-05 00:19:13 +00:00
nari 9d2f54b3e9 * include/ruby/intern.h (rb_gc_set_params): Deprecate
rb_gc_set_params because it's only used in ruby internal.

* internal.h (ruby_gc_set_params): Declare rb_gc_set_params's
  alias function.

* gc.c: ditto.

* ruby.c: use ruby_gc_set_params.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43794 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-22 07:26:55 +00:00
glass 5c54eb4045 * dir.c, pack.c, ruby.c, struct.c, vm_eval.c: use RARRAY_CONST_PTR().
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43580 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-11-08 02:37:47 +00:00
nobu 11ef85d237 ruby.c: load statically linked extensions before rubygems
* ruby.c (process_options): load statically linked extensions before
  rubygems, because of ext/thread.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43280 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-14 03:32:54 +00:00
nobu 02d28d01cf ruby.c: gem_prelude to load rubygems
* ruby.c (process_options): use gem_prelude instead of requiring
  rubygems directly when --enable=gems is given.
* Makefile.in (DEFAULT_PRELUDES): always use gem_prelude regardless of
  --disable-rubygems.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43278 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-14 03:22:24 +00:00
knu 1b4addb445 Process#setproctitle,argv0: Fix and improve rdoc.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42771 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-09-02 05:42:02 +00:00
nobu e941e50506 ruby.c: use String path version parser functions
* ruby.c (load_file_internal): use rb_parser_compile_string_path and
  rb_parser_compile_file_path, String path name versions.  [Bug #8753]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42468 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-09 13:20:58 +00:00
knu d5ecd17aee Add Process.argv0.
* ruby.c (Process.argv0): New method to return the original value
  of $0. [Feature #8696]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42426 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-07 14:12:08 +00:00
knu 34bb945c40 Add Process.setproctitle().
* ruby.c (Process.setproctitle): New method to change the title of
  the running process that is shown in ps(1). [Feature #8696]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42425 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-07 14:12:04 +00:00
nobu 8948280c67 load.c: search in OS path encoding
* load.c (rb_load_internal): use rb_load_file_str() to keep path
  encoding.
* load.c (rb_require_safe): search in OS path encoding for Windows.
* ruby.c (rb_load_file_str): load file with keeping path encoding.
* win32/file.c (rb_file_load_ok): use WCHAR type API assuming incoming
  path is encoded in UTF-8.  [ruby-core:56136] [Bug #8676]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42183 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-07-26 04:04:23 +00:00
charliesome fff3589899 * compile.c (make_name_for_block): use PRIsVALUE in format string
instead of %s and RSTRING_PTR to protect objects from being garbage
  collected too soon
* encoding.c (str_to_encindex): ditto
* hash.c (rb_hash_fetch_m): ditto
* io.c (rb_io_reopen): ditto
* parse.y (reg_fragment_check_gen): ditto
* parse.y (reg_compile_gen): ditto
* parse.y (ripper_assert_Qundef): ditto
* re.c (rb_reg_raise): ditto
* ruby.c (set_option_encoding_once): ditto
* vm_eval.c (rb_throw_obj): ditto

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41597 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-24 11:31:21 +00:00
akr bd15d4ca78 * internal.h (numberof): Gathered from various files.
* array.c, math.c, thread_pthread.c, iseq.c, enum.c, string.c, io.c,
  load.c, compile.c, struct.c, eval.c, gc.c, parse.y, process.c,
  error.c, ruby.c: Remove the definitions of numberof.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41142 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-07 10:01:19 +00:00
ktsj edb98f8b91 fix typos. Patch by k_takata.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40825 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-19 03:10:21 +00:00
ko1 83aba04862 * include/ruby/ruby.h: constify RBasic::klass and add
RBASIC_CLASS(obj) macro which returns a class of `obj'.
  This change is a part of RGENGC branch [ruby-trunk - Feature #8339].
* object.c: add new function rb_obj_reveal().
  This function reveal interal (hidden) object by rb_obj_hide().
  Note that do not change class before and after hiding.
  Only permitted example is:
  klass = RBASIC_CLASS(obj);
  rb_obj_hide(obj);
  ....
  rb_obj_reveal(obj, klass);
  TODO: API design. rb_obj_reveal() should be replaced with others.
  TODO: modify constified variables using cast may be harmful for
  compiler's analysis and optimizaton.
  Any idea to prohibt inserting RBasic::klass directly?
  If rename RBasic::klass and force to use RBASIC_CLASS(obj),
  then all codes such as `RBASIC(obj)->klass' will be
  compilation error. Is it acceptable? (We have similar
  experience at Ruby 1.9,
  for example "RARRAY(ary)->ptr" to "RARRAY_PTR(ary)".
* internal.h: add some macros.
* RBASIC_CLEAR_CLASS(obj) clear RBasic::klass to make it internal
  object.
* RBASIC_SET_CLASS(obj, cls) set RBasic::klass.
* RBASIC_SET_CLASS_RAW(obj, cls) same as RBASIC_SET_CLASS
  without write barrier (planned).
* RCLASS_SET_SUPER(a, b) set super class of a.
* array.c, class.c, compile.c, encoding.c, enum.c, error.c, eval.c,
  file.c, gc.c, hash.c, io.c, iseq.c, marshal.c, object.c,
  parse.y, proc.c, process.c, random.c, ruby.c, sprintf.c,
  string.c, thread.c, transcode.c, vm.c, vm_eval.c, win32/file.c:
  Use above macros and functions to access RBasic::klass.
* ext/coverage/coverage.c, ext/readline/readline.c,
  ext/socket/ancdata.c, ext/socket/init.c,
* ext/zlib/zlib.c: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40691 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-13 10:49:11 +00:00
ko1 aacd771046 * *.c, parse.y, insns.def: use RARRAY_AREF/ASET macro
instead of using RARRAY_PTR().



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40690 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-13 09:56:22 +00:00
zzak 0b4214ad9b * class.c: Example of Object#methods by @windwiny [Fixes GH-293]
* ruby.c: Document return values of Kernel #sub, #gsub, and #chop


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40432 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-24 04:47:31 +00:00
nobu 7505436d62 * ruby.c (is_option_with_optarg): macro for optional argument option.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39526 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-02-27 08:08:10 +00:00
nobu 74016f1842 ruby.c: fix for multiarch library
* ruby.c (ruby_init_loadpath_safe): try two levels upper for stripping
  libdir name.  [Bug #7874]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39348 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-02-21 03:45:07 +00:00
nobu 46cdc66f84 version.c: move ruby_exec_prefix
* version.c (ruby_exec_prefix): move all path configuration stuffs.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39296 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-02-18 01:11:58 +00:00
kazu 09f564b15f * ruby.c (usage): sort --*-encoding in help. (same order of -E)
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38784 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-01-11 14:38:57 +00:00
ko1 f4ef96e6a2 * ruby.c (process_options): need to acquire env from TOPLEVEL_BINDING
each time.
  `bind->env' may update after `eval()'.
  [Bug #7536]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38529 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-21 10:39:59 +00:00
usa e446378ad0 * ruby.c (load_file_internal): use original C string as the filename
for parser.
  reported by whiteleaf at [ruby-list:49085] [ruby-dev:46738]
  [Bug #7562]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38474 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-19 14:54:50 +00:00
nobu b9163cc1fd ruby.c: argv check
* ruby.c (proc_options, process_options, ruby_process_options): take
  care of the case argc is 0, and check if argv has NULL.
  [ruby-core:49889] [Bug #7423]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37823 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-23 15:00:55 +00:00
nobu 48df345894 ruby.c: wrap descriptions
* ruby.c (usage): wrap description lines if options are too long.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37818 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-23 08:31:57 +00:00
nobu 38a1bcb056 * ruby.c, test/ruby/test_rubyoptions.rb: revert r37815:r37816.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37817 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-23 08:31:52 +00:00
tadf 10cceae9e3 * ruby.c: revert r37298.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37816 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-23 03:35:27 +00:00
zzak 7e96fb252a * ruby.c (usage_msg): Fix typo [ruby-core:49205] [Bug #7327]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37745 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-20 03:37:27 +00:00
duerst 35020e355c ruby.c: removed a comma before "before"
(at Tamatsukuri Hot Spring (Onsen Hackathon))

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37615 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-10 23:47:45 +00:00
naruse 58ef0f06c6 * ruby.c (load_file_internal): set default source encoding as
UTF-8 instead of US-ASCII. [ruby-core:46021] [Feature #6679]

* parse.y (parser_initialize): set default parser encoding as
  UTF-8 instead of US-ASCII.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37485 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-06 00:49:57 +00:00
shirosaki 9823c46189 Cache the expanded load path
* load.c (rb_get_expanded_load_path): cache the expanded load
  path.  This saves 4KB of allocation and some stats for every
  element of the load path (so nearly a MB in my Rails app)
  on every require.

* load.c (rb_construct_expanded_load_path): ensure that $LOAD_PATH
  entries are frozen strings.  The user must mutate $LOAD_PATH
  itself rather than its individual entries.

* vm_core.h (rb_vm_struct): add fields.

* vm.c (rb_vm_mark): mark new fields.

* ruby.c (process_options): modify $LOAD_PATH directly rather than
  its elements.
  Patch by Greg Price.
  [ruby-core:47970] [Bug #7158]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37481 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-05 15:27:05 +00:00
nobu 357a5f5ab5 ruby.c: --help option
* ruby.c (usage, process_options): show more info in --help.
  [EXPREIMENTAL] [ruby-core:48072] [Bug #7184]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37298 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-23 08:08:42 +00:00
nobu 9e02550b21 ruby.c: passing block
* ruby.c (rb_f_sub, rb_f_gsub): pass the given block.
  [ruby-core:47967] [Bug #7157]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37177 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-14 03:30:50 +00:00
nobu 22c81db9d8 configure.in: use configured libdir value
* configure.in (LIBDIR_BASENAME): use configured libdir value to fix
  --enable-load-relative on systems where libdir is not default value,
  overridden in config.site files.  [ruby-core:47267] [Bug #6903]
* ruby.c (ruby_init_loadpath_safe): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36847 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-08-29 06:03:09 +00:00
nobu 58d0277775 ruby.c: magic numbers
* ruby.c (ruby_init_loadpath_safe): remove magic numbers.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36845 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-08-29 05:59:05 +00:00
nobu c68d29960b load.c: keep encoding of feature name
* file.c (rb_find_file_ext_safe, rb_find_file_safe): default to
  US-ASCII for encdb and transdb.
* load.c (search_required): keep encoding of feature name.  set
  loading path to filesystem encoding.  [Bug #6377][ruby-core:44750]
* ruby.c (add_modules, require_libraries): assume default external
  encoding as well as ARGV.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36800 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-08-23 07:46:12 +00:00
nobu 0e92dc4b72 ruby.c: show version only once
* ruby.c (proc_options): show version only once even if -v and
  --verbose are given together.
  http://twitter.com/d6rkaiz/status/233491797085671424


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36667 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-08-09 09:33:49 +00:00
yugui 64ef091a64 Reverts a half of r36079. As we discussed on ruby-dev@ and IRC,
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
2012-07-11 03:25:16 +00:00
naruse 007c9aa2bf * ruby.c (proc_options): warn only if -K and -w option is specified.
see also r36274 [Feature #5206]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36310 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-07-04 16:01:01 +00:00
naruse c2a87e2733 * ruby.c (proc_options): warn if -K option is specified. [Feature #5206]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36274 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-07-03 01:52:51 +00:00
ko1 c4bc9b5758 * iseq.c, vm_eval.c: set th->base_block properly.
th->base_block is information for (a) parsing, (b) compiling
  and (c) setting up the frame to execute the program passed by
  `eval' method.  For example, (1) parser need to know up-level
  variables to detect it is variable or method without paren.
  Befor (a), (b) and (c), VM set th->base_block by passed bindng
  (or previous frame information).  After execute (a), (b) and (c),
  VM should clear th->base_block.  However, if (a), (b) or (c)
  raises an exception, then th->base_block is not cleared.
  Problem is that the uncleared value th->balo_block is used for
  irrelevant iseq compilation.  It causes SEGV or critical error.
  I tried to solve this problem: to clear them before exception,
  but finally I found out that it is difficult to do it (Ruby
  program can be run in many places).
  Because of this background, I set th->base_block before
  compiling iseq and restore it after compiling.
  Basically, th->base_block is dirty hack (similar to global
  variable) and this patch is also dirty.
* bootstraptest/test_eval.rb: add a test for above.
* internal.h: remove unused decl.
* iseq.c (rb_iseq_compile_with_option): add base_block parameter.
  set th->base_block before compation and restore it after
  compilation.
* ruby.c (require_libraries): pass 0 as base_block instead of
  setting th->base_block
* tool/compile_prelude.rb (prelude_eval): apply above changes.
* vm.c, vm_eval.c: ditto.
* vm_core.h: add comments.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36179 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-22 09:32:56 +00:00
kosaki 6d69c3b0ce * ruby.c (rb_f_sub): use ansi style declaration.
* ruby.c (rb_f_gsub): ditto.
* ruby.c (rb_f_chomp): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36145 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-19 21:50:09 +00:00
nobu 6648846e05 ruby.c: add cast
* ruby.c (parse_and_compile_main): add cast to a pointer type.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36083 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-14 04:03:31 +00:00
nobu 073297789a fix r36079
* 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
2012-06-14 03:03:48 +00:00
yugui 8c9a453f2d Embedding CRuby interpreter without internal headers has been difficult
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
2012-06-14 02:22:08 +00:00
yugui f8601bd903 * eval.c: Add doxygen comments.
* ruby.c: ditto.

* thread_pthread.c: ditto

* version.c: ditto.

* vm_core.h: ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36078 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-14 02:21:51 +00:00
nobu ea0c3a8832 ruby.c: fixed typo
* ruby.c (Init_enc): fixed typo. defined in dmyext.c.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35725 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-05-20 14:00:10 +00:00
yugui 3fa3f9abb9 Supports static linking of extensions and encodings again.
Fixes --with-static-linked-ext.

Patch by Google Inc. [ruby-core:45073].

* Makefile.in (ENCOBJS, EXTOBJS): New variables to specify static
  linked libraries. Also reintroduces extinit.o, introduces encinit.o
  introduces encinit.o

* common.mk: Builds static libraries rather than shared objects if
  specified.

* configure.in (LD): new substitution. 
  Avoids PIE if s

* enc/depend: Supports static linked libraries
  (libencs, libenc, libtrans): New target.

* enc/encinit.c.erb: new template to generate the initialization of
  statically linked encodings.

* enc/make_encmake.rb (--module): new flag to specify whether static
  or dynamic.

* transcode_data.h (TRANS_INIT): New macro to get rid of the name
  collision of encoding initializers and transcoder initializers.

* ext/extmk.rb: Fixes the behavior on $extstatic is true.

* lib/mkmf.rb (clean-static): new target to clean up static linked
  libraries.

* ruby.c (process_options): New initializes statically linked
  encodings here.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35662 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-05-16 05:39:06 +00:00
nobu 57fb219905 * reduce UNREACHABLE.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35333 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-04-15 00:06:13 +00:00
drbrain e95f7ea80d * variable.c (trace_ev): Removed "not reached" comment as this line is
reached.
* variable.c (rb_obj_remove_instance_variable):  Replaced "not reached"
  comment with the UNREACHABLE macro.
* variable.c (rb_mod_const_missing):  ditto.
* variable.c (rb_mod_remove_cvar):  ditto.
* enum.c (first_i):  ditto.
* string.c (rb_str_aref):  ditto.
* string.c (str_byte_aref):  ditto.
* string.c (rb_to_id):  ditto.
* io.c (rb_io_fmode_modestr):  ditto.
* io.c (rb_io_oflags_modestr):  ditto.
* pack.c (num2i32):  ditto.
* vm_eval.c (rb_method_missing):  ditto.
* vm_eval.c (rb_f_throw):  ditto.
* dir.c (dir_read):  ditto.
* win32/win32.c (child_result):  ditto.
* struct.c (rb_struct_getmember):  ditto.
* struct.c (rb_struct_set):  ditto.
* struct.c (rb_struct_aref_id):  ditto.
* eval.c (rb_f_raise):  ditto.
* process.c (rb_f_exit_bang):  ditto.
* process.c (rb_f_exit):  ditto.
* process.c (rb_f_abort):  ditto.
* ext/-test-/iter/break.c (iter_break_value):  ditto.
* ext/pty/pty.c (pty_check):  ditto.
* ext/openssl/ossl_pkey.c (ossl_pkey_new):  ditto.
* ext/readline/readline.c (rb_remove_history):  ditto.
* ext/stringio/stringio.c (strio_unimpl):  ditto.
* numeric.c (num_sadded):  ditto.
* numeric.c (num_init_copy):  ditto.
* numeric.c (rb_num2ll):  ditto.
* numeric.c (rb_num2ull):  ditto.
* vm_insnhelper.c (call_cfunc):  ditto.
* ruby.c (opt_W_getter):  ditto.
* bignum.c (rb_big_coerce):  ditto.
* file.c (rb_f_test):  ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35322 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-04-14 00:36:26 +00:00
nobu 7a0d81eaa2 * win32/win32.c (check_if_dir, check_if_wdir): fix for Visual C++
not to use S_ISDIR().  [Feature #2408][ruby-core:26925]
* ruby.c (load_file_internal): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35134 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-03-26 04:51:27 +00:00
nobu 764d54788a * ruby.c (load_file_internal): bail out if the script is a directory.
[Feature #2408][ruby-core:26925]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35131 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-03-26 02:46:04 +00:00
nobu 075d98c7dc * error.c (rb_load_fail): should honor encoding.
* load.c (load_failed): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34944 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-03-07 07:30:31 +00:00
nobu 72de92d1f9 rb_load_fail
* 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
2012-03-07 03:26:30 +00:00
tenderlove d576a25c26 * error.c (rb_loaderror_with_path): Adding the missing file as an
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
2012-03-06 23:38:33 +00:00
nobu b3e2baa3b5 * missing/setproctitle.c (ruby_init_setproctitle): changed prefix.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34326 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-01-17 08:13:50 +00:00
usa 9b8aca6ae5 * ruby.c (load_file_internal): convert the encoding of load path if
needed by platform.  calling open() was replaced by rb_cloexec_open()
  at r33549, but the function expected UTF-8 pathname on Windows.
  (open() expected "locale" pathname.)
  reported by taco via IRC.

* ruby.c (load_file): change the type of the 2nd parameter to pass its
  encoding to load_file_internal().

* ruby.c (process_options, rb_load_file): follow above change.
  NOTE: we should pass encoding information to rb_load_file().


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33591 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-10-31 18:05:03 +00:00
akr a3efca16a1 * ruby.c (fill_standard_fds): use fstat() instead of fcntl(F_GETFD)
for MinGW.  reported by Luis Lavena.  [ruby-core:40526] [Bug #5516]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33573 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-10-30 13:34:04 +00:00
akr 7c43d8523c * ruby.c (fill_standard_fds): new function to open closed standard
file descriptors.
  (ruby_sysinit): call fill_standard_fds.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33567 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-10-30 09:46:56 +00:00
akr da74bc7552 * process.c (ruby_setsid): use rb_cloexec_open.
(rb_daemon): ditto.

* 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/io/console/console.c (console_dev): ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33550 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-10-29 04:01:54 +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
nobu 8e6e8e6288 * use RB_TYPE_P which is optimized for constant types, instead of
comparison with TYPE.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33357 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-09-29 11:07:45 +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 cfa0035962 * encoding.c (rb_enc_set_index, rb_enc_associate_index): should
check if frozen.
* parse.y (rb_intern3), ruby.c (process_options, ruby_script):
  defer freezing after associating encodings.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32435 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-07-07 06:44:46 +00:00
nobu 65c2fec50c * ruby.c (ruby_init_loadpath_safe): ensure RUBYLIB_PREFIX stored
before RUBYLIB, even if MANGLED_PATH is enabled.  fixed #1679.
  MANGLED_PATH is disabled by the default and will be removed
  completely in the future.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32310 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-29 21:37:48 +00:00
drbrain 926301969f * math.c: Attach documentation for Math.
* object.c:  Document NIL, TRUE, FALSE.
	* io.c:  Improve grammar in ARGF comment.  Document STDIN/OUT/ERR.
	  Document ARGF global constant.
	* lib/rake:  Hide deprecated toplevel constants from RDoc (import from
	  rake trunk).
	* lib/thwait.rb:  Document ThWait.
	* lib/mathn.rb:  Hide Math redefinition from RDoc
	* lib/sync.rb:  Add a basic comment for Sync_m, Synchronizer_m, Sync,
	  Synchronizer.
	* parse.y:  Document SCRIPT_LINES__.
	* hash.c:  Document ENV class and global constant.
	* vm.c:  Document TOPLEVEL_BINDING.
	* version.c:  Document RUBY_* constants.
	* ruby.c:  Document DATA and ARGV.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32281 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-29 03:09:34 +00:00
akr afd7e4668f * internal.h: declare more internal functions.
* iseq.h (rb_method_get_iseq): declared.

* compile.c, eval.c, eval_error.c, iseq.c, parse.y, proc.c, range.c,
  ruby.c, time.c, util.c, vm.c: don't declare internal functions.

* eval.c, parse.y, thread_pthread.c: non-existing function declarations
  removed.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32158 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-18 01:54:57 +00:00
akr e7996eb3cc * internal.h: declare internal functions here.
* node.h: declare NODE dependent internal functions here.

* iseq.h: declare rb_iseq_t dependent internal functions here.

* vm_core.h: declare rb_thread_t dependent internal functions here.

* bignum.c, class.c, compile.c, complex.c, cont.c, dir.c, encoding.c,
  enumerator.c, error.c, eval.c, file.c, gc.c, hash.c, inits.c, io.c,
  iseq.c, load.c, marshal.c, math.c, numeric.c, object.c, parse.y,
  proc.c, process.c, range.c, rational.c, re.c, ruby.c, string.c,
  thread.c, time.c, transcode.c, variable.c, vm.c,
  tool/compile_prelude.rb: don't declare internal functions declared
  in above headers.  include above headers if required.

  Note that rb_thread_mark() was declared as
  void rb_thread_mark(rb_thread_t *th) in cont.c but defined as
  void rb_thread_mark(void *ptr) in vm.c.  Now it is declared as
  the later in internal.h.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32156 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-17 22:43:38 +00:00
nobu 1482fccef5 * ruby.c (ruby_process_options): add missing return type.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31987 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-11 01:01:09 +00:00
kosaki 3ad44e0aa1 introduce missing/setproctitle.c
* include/ruby/missing.h: add setproctitle() declaration.
* missing/setproctitle.c: added.
* configure.in: add check for missing/setproctitle.c.

* ruby.c (ruby_process_options): add to call compat_init_setproctitle().
* ruby.c (set_arg0): remove all platform specific code. it's
  moved to missing/setproctitle.c.
* ruby.c (origarg): remove len field. It's no longer used.
* ruby.c (get_arglen): removed.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31565 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-05-14 10:49:47 +00:00
kazu 82fd7175b5 * ruby.c (proc_options): reduce warning: "ALLOW_DEFAULT_SOURCE_ENCODING" is not defined.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31291 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-04-15 14:42:36 +00:00
nobu 24055b89c8 * ruby.c (proc_options): remove an experimental feature: --gem option.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31157 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-03-22 23:05:53 +00:00
nobu 50b3370db8 * ruby.c (proc_options): remove an experimental feature: --require
option.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31156 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-03-22 23:05:51 +00:00
nobu e63f298f85 * ruby.c (add_gems): remove unused variable.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31155 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-03-22 23:05:49 +00:00
matz eb807d42ec * gc.c (rb_gc_set_params): allow GC parameter configuration by
environment variables.  based on a patch from funny-falcon at
  https://gist.github.com/856296, but honors safe level.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31044 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-03-07 08:39:39 +00:00
nobu 68ef047b8f * ruby.c (proc_options): enable rubygems if --gem option is given.
* ruby.c (process_options): load rubygems if it is disabled but
  --gem option is given.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30846 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-02-11 16:04:08 +00:00
yugui f17b469860 * ruby.c (proc_options): add --gem=enabled as an alias of
--enable=gems and --gem=disabled as an alias of --disable=gems.
  Gem named "enabled" or "disabled" has already been reserved
  legitimately for this purpose.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30844 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-02-11 15:03:51 +00:00
nobu 4ed23fe8c5 * ruby.c (add_gems, require_libraries, proc_options): add
--require and --gem options.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30836 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-02-11 03:06:50 +00:00
nobu 020dc4ba60 * configure.in (rubygems): add --disable-rubygems option.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30835 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-02-11 03:03:26 +00:00
nobu 8561ae195f * ruby.c (process_options): revert r30549.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30580 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-01-17 12:40:30 +00:00
nobu ca6a75cd38 * ruby.c (process_options): autoload rubygems.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30549 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-01-15 01:04:16 +00:00
nobu 7350562e5e * ruby.c (ruby_init_prelude): get rid of global namespace
pullution.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30547 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-01-15 00:48:16 +00:00
ryan f52c2cc24d Reduced gem_prelude to just require rubygems. Reviewed by Evan Phoenix
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30538 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-01-14 02:02:12 +00:00
akr 8af7ed6036 * ruby.c: parenthesize macro arguments.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30411 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-12-27 22:37:59 +00:00
nobu 1a4bf59430 * ruby.c (ruby_init_loadpath_safe): relatively called non-shared
binary cannot be found in PATH, so use given pathname.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30164 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-12-10 09:29:22 +00:00
nobu af54c1694c * ruby.c (load_file_internal): decrement for ungotten line.
[ruby-dev:42680]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30084 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-12-05 02:27:13 +00:00
nobu 41cae1744f * file.c (file_expand_path): use cygwin_conv_path on cygwin 1.7 or
later.
* ruby.c (push_include_cygwin): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29742 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-11-11 12:24:41 +00:00
nobu 536e266e58 * cygwin/GNUmakefile.in (scriptbin): make executable file from
scripts with stub.
* ruby.c (load_file_internal): assume xflag for exe file as well
  as no-shebang file.
* tool/rbinstall.rb: install script programs.
* win32/mkexports.rb (Exports#initialize): alias ruby_sysinit for
  stub.
* win32/stub.c: stub for scripts.  [EXPERIMENTAL]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29738 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-11-09 22:20:12 +00:00
nobu 5425f8fe6e * ruby.c (ruby_init_loadpath_safe): ensure sopath to be modifiable
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28864 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-08-05 05:12:50 +00:00
nobu 1849a2baf1 * ruby.c (ruby_init_loadpath_safe): rb_str_set_len modifies ptr
since r26303.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28836 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-08-02 12:51:18 +00:00
nobu a67f1a9534 * include/ruby/io.h, io.c: reverted r21709.
* ruby.c (load_file_internal): nothing to read if EOF reached
  while reading shebang.  [ruby-core:30910]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28451 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-06-27 14:31:19 +00:00
naruse 72fa4d34c0 * ruby.c: add prototype of rb_realpath_internal.
* load.c: ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28358 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-06-18 01:16:13 +00:00
mame 2db572514c * load.c (rb_load_internal): remove call to rb_realpath_internal
within rb_load_internal which caused big performance degradation.
  Instead, call rb_realpath_internal in the caller of
  rb_load_internal.  [ruby-dev:41502] [ruby-dev:41610]

* vm.c (rb_vm_call_cfunc): ditto.

* eval_intern.h (rb_vm_call_cfunc): ditto.

* ruby.c (process_options): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28351 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-06-17 14:32:20 +00:00
nobu af97da84ed * ruby.c (process_options, load_file_internal): $0 seen from
required libraries by -r option should be the main script.
  [ruby-core:23717]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28172 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-06-05 06:59:12 +00:00
nobu 2ef85089ec * ruby.c (process_options): revert r25330, so that $0 can be seen
from required libraries by -r option.  [ruby-core:23717]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28161 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-06-05 00:57:02 +00:00
nobu 87af442f94 * suppress warnings.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27944 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-21 09:10:23 +00:00
nobu 73997d38f4 * ruby.c (ruby_init_loadpath_safe): use real path for non-shared
build.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27939 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-21 04:35:58 +00:00
marcandre 7729de4d91 * array.c: Documentation: change => in call-seq to ->.
Harmonize "#=>" in examples. [ruby-core:30206]

* bignum.c: ditto

* class.c: ditto

* compar.c: ditto

* cont.c: ditto

* dir.c: ditto

* encoding.c: ditto

* enum.c: ditto

* enumerator.c: ditto

* error.c: ditto

* eval.c: ditto

* file.c: ditto

* gc.c: ditto

* io.c: ditto

* load.c: ditto

* marshal.c: ditto

* math.c: ditto

* numeric.c: ditto

* object.c: ditto

* pack.c: ditto

* proc.c: ditto

* process.c: ditto

* random.c: ditto

* range.c: ditto

* re.c: ditto

* ruby.c: ditto

* signal.c: ditto

* sprintf.c: ditto

* string.c: ditto

* struct.c: ditto

* thread.c: ditto

* time.c: ditto

* transcode.c: ditto

* variable.c: ditto

* vm_eval.c: ditto

* vm_method.c: ditto

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27865 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-17 21:07:33 +00:00
nobu 655b2ade49 * ruby.c (get_arglen): skip the last terminator of argv before
checking environ.

* ruby.c (get_arglen): duplicate environ area if setenv and unsetenv
  are provided.

* ruby.c (set_arg0): keep empty strings.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27468 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-24 04:06:59 +00:00
nobu 30014a6156 * ruby.c (PREFIX_PATH): use RUBY_RELATIVE macro.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27452 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-23 00:14:00 +00:00
nobu 43ab72099b * configure.in (RUBY_EXEC_PREFIX): added to config.h.
* ruby.c (ruby_init_loadpath_safe): TMP_RUBY_PREFIX should be
  exec_prefix, not rubylibprefix.  [ruby-core:28718]

* version.c (RUBY_LIB_PREFIX): fallback to RUBY_EXEC_PREFIX.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26970 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-03-17 21:28:36 +00:00
mame 6ff75042db * compile.c, iseq.c, ruby.c, vm.c, vm_core.h, vm_eval.c: add absolute
path field into rb_iseq_t.  The field contains a string representing
  a path to corresponding source file. or nil when the iseq is created
  from -e, stdin, eval, etc.  This field is used for require_relative.
  [ruby-dev:40004]

* load.c (rb_f_require_relative): add C implementation of
  require_relative.

* prelude.rb (require_relative): get rid of Ruby implementation of
  require_relative.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26959 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-03-16 17:40:00 +00:00
nobu 04e68d0107 * ruby.c (ruby_init_loadpath_safe): mark initial load paths.
* gem_prelude.rb (push_all_highest_version_gems_on_load_path):
  search insertion position by initial load path mark.

* lib/rubygems.rb (Gem.load_path_insert_index): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26895 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-03-12 15:11:10 +00:00
nobu 1dcf1174ea * ruby.c (ruby_init_loadpath_safe, ruby_init_gems): set and remove
TMP_RUBY_PREFIX.

* variable.c (rb_mod_remove_const): new function.

* tool/compile_prelude.rb: split each preludes.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26881 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-03-11 22:15:11 +00:00
naruse 77088d6672 * ruby.c (rb_parser_dump_tree): add prototype.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26070 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-12-13 11:29:33 +00:00
mame 38828fa8d1 * node.c: node management added. Currently, only pretty-dumper is
implemented.  [ruby-dev:39853]

* ruby.c: --dump=parsetree and --dump=parsetree_with_comment options
  added.  This is just for debug or research purpose.  Note that the
  compatibility of these options are not supported at all.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26053 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-12-09 14:05:59 +00:00
naruse a7db2c1efd * encoding.c (enc_set_default_encoding): reset filesytem
encoding because on resetting default_external because
  Unix's filesystem encoding depends on default_external.

* encoding.c (enc_set_filesystem_encoding): added.

* ruby.c (process_options): don't call rb_filesystem_encoding
  because filesystem encoding is reset when default_external
  is reset.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25837 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-11-18 03:38:20 +00:00
akr 1aba3f9d76 * encoding.c (rb_filesystem_encindex): use default external encoding
instead of locale encoding in Unix.

* ruby.c (process_options): delay inifilesystem encoding
  initialization after default external encoding initialization.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25782 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-11-15 16:37:38 +00:00
nobu ab4e003969 * ruby.c (set_{internal,external}_encoding_once): fixed typos.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25642 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-11-04 06:46:32 +00:00
naruse 2f2e8455e3 Revert set locale and filesystem encindex in Init_Encoding.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25559 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-29 09:40:25 +00:00
naruse 06346d5849 * encoding.c (Init_Encoding): set locale and filesystem encindex.
* ruby.c (process_options): move setting func of filesystem
  encoding to Init_Encoding.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25558 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-29 08:14:09 +00:00
naruse 2bb26c118d * ruby.c (process_options): call rb_filesystem_encoding().
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25555 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-28 19:42:59 +00:00
mame 1996a4af69 * ruby.c (usage): -T and -W descriptions updated. see
[ruby-dev:39539]

* man/ruby.1: ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25486 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-26 03:41:01 +00:00
nobu d68e5dce35 * ruby.c (ruby_init_loadpath_safe): should not dup tmp string. a
patch from neomjp neomjp in [ruby-core:24251].


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25390 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-18 09:32:02 +00:00
nobu 0e4121aa5b * ruby.c (process_options): script name should not be shown in an
error message before loaded.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25330 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-14 04:24:16 +00:00
nobu a39f4e5cf6 * ruby.c (process_sflag, proc_options, load_file_internal): fixed
types.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24899 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-13 11:18:51 +00:00
nobu bc832b8e5b * ruby.c (load_file_internal): no need to define DATA when error.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24897 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-13 10:38:36 +00:00
nobu f9be12fb14 * ruby.c (ruby_init_loadpath_safe): suppressed warnings.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24682 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-08-27 04:55:55 +00:00
nobu 8bc6c71547 * ruby.c (load_file_internal): assumes -x flag if no "ruby" is in
the shebang line.  [ruby-dev:39015]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24410 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-08-05 10:19:18 +00:00
nobu cb9038cbaf * io.c (rb_stdio_set_default_encoding): prototyped.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24409 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-08-05 10:18:21 +00:00
naruse c6abdf3e0c * ruby.c (rb_stdio_set_default_encoding): declared.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24408 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-08-05 10:12:31 +00:00
naruse 00499c097f Set encodings of stdio after setting default internal and external.
* io.c (rb_stdio_set_default_encoding): added.

* ruby.c (process_options): call rb_stdio_set_default_encoding
  after setting defualt internal and external.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24337 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-31 07:37:02 +00:00
akr 98aac1e651 * ruby.c (process_options): don't specify .so for encdb here.
"." is replaced by "_" in load_encoding.

* encoding.c (load_encoding): add .so here. 



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23821 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-22 16:21:09 +00:00
nobu 4a81d13592 * ruby.c (ruby_init_loadpath_safe): removed "." from load_path.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23816 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-22 07:26:16 +00:00
nobu c030cf1975 * ruby.c (process_options), enc/prelude.rb: encdb and transdb are
extension libraries.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23813 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-22 05:41:51 +00:00
nobu 210e51f3bd * ruby.c (process_options): set progname earlier.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23812 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-22 05:35:51 +00:00
mame 5d30ddec17 * load.c (Init_load): $: must be readonly. [ruby-dev:38690]
* ruby.c (ruby_prog_init): $-W must be readonly.  [ruby-dev:38691]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23809 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-06-21 13:35:41 +00:00
nobu 3b6d6b0861 * ruby.c (ruby_init_loadpath_safe): VARIABLE_LIBPATH is always
defined, see its value instead.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23478 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-05-17 14:05:08 +00:00
nobu 589ec2beb5 * ruby.c (ruby_script): sets also VM toplevel program name.
* ruby.c (process_options): no longer needs additional frame.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23473 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-05-17 05:02:58 +00:00
nobu cda453c238 * ruby.c (cmdline_options_init): initialize encodings.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23471 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-05-17 00:51:09 +00:00
nobu 64f767b556 * ruby.c (cmdline_options_init): initialize encodings.
* ruby.c (add_modules, require_libraries, process_sflag):

* ruby.c (process_sflag): not process twice.

* ruby.c (moreswitches): get rid of possible overflow.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23470 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-05-17 00:47:49 +00:00
nobu bd9a5871dd * ruby.c (ruby_init_loadpath_safe): support for cygwin 1.7. see
[ruby-core:23241].
  gets rid of possible buffer overflow with realpath().


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23468 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-05-17 00:02:58 +00:00
nobu 214e725334 * ruby.c (set_arg0): get rids of overrun.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23467 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-05-16 23:55:46 +00:00
nobu 22cde7b682 * dir.c, dln.c, parse.y, re.c, ruby.c, sprintf.c, strftime.c,
string.c, util.c, variable.c: use strlcpy, memcpy and snprintf
  instead of strcpy, strncpy and sprintf.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22984 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-03-17 01:29:17 +00:00
nobu 731504b4d3 * ruby.c (load_file_internal): stop the timer thread before exec.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22965 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-03-15 02:00:15 +00:00
nobu 4de12b6ae9 * util.c (ruby_scan_oct, ruby_scan_hex): use size_t.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22957 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-03-14 09:25:20 +00:00
nobu 745bc1fd83 * ruby.c (ruby_init_loadpath_safe): expands libpath and removes
last /lib.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22881 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-03-10 21:12:49 +00:00
nobu ee4fbaa37e * configure.in (MANGLED_PATH): defines for RUBYLIB_PREFIX.
* ruby.c (ruby_init_loadpath_safe): uses string as buffer.

* symbian/setup (config_h): defines MANGLED_PATH.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22866 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-03-09 19:56:46 +00:00
nobu 31d1d0a829 * configure.in (load_relative): new option to enable load path
relative to libruby_so.

* ruby.c (ruby_init_loadpath_safe): added the case using dladdr().


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22860 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-03-09 15:06:22 +00:00
nobu 033bed37c8 * ext/dl/dl.h (dlerror): fixed on Windows.
* ext/dl/handle.c (rb_dlhandle_initialize): returns handle to
  libruby if nil is given on Windows as dlopen.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22703 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-03-02 02:01:48 +00:00
yugui 5c94b5d113 * eval.c (ruby_options): evaluator now expects iseq instead of tree.
* ruby.c (ruby_process_options): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22498 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-22 04:04:31 +00:00
nobu f35308b3ef * eval_intern.h (translit_char): moved from ruby.c.
* load.c (load_ext): transliterates file separators and back if
  needed.

* symbian/setup (DLN_NEEDS_ALT_SEPARATOR): defined.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22437 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-19 06:11:41 +00:00
nobu 6d3ceb6ce3 * configure.in, */Makefile.sub (LOAD_RELATIVE): moved from ruby.c
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22436 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-19 05:48:14 +00:00
usa 03c7332241 * ruby.c (process_options): set initial default_external before -r.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22086 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-06 03:12:09 +00:00
usa 5067bfe36e * ruby.c (process_options): -K and -E in shebang should be reflect to
default_external. [ruby-dev:37920]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22085 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-06 03:05:27 +00:00
nobu f4e9d9a2c5 * configure.in (RUBY_LIB_VERSION): added for library version, to
split from core version.  [ruby-dev:37748]

* configure.in (RUBY_LIB_PATH, etc): moved actual version
  dependent stuff to version.c.

* ruby.c (ruby_init_loadpath_safe): ditto.

* version.c (ruby_initial_load_paths): moved initial load path
  version depending on version from ruby.c.

* version.h (RUBY_VERSION_{MAJOR,MINOR,TEENY}): now mean library
  and API version, and reverted to 1.9.1.  [ruby-dev:37889]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22069 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-05 02:21:37 +00:00
nobu 813dad7afd * ruby.c (load_file_internal): resets EOF flag after parse.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22017 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-03 14:37:09 +00:00
nobu 845103b751 * cont.c (rb_fiber_current), dln.c (dln_print_undef, dln_undefined),
eval.c (rb_iterator_p, rb_need_block), load.c: (Init_load), ruby.c
  (uscore_get, rb_f_chop), st.c (stat_col), signal.c
  (rb_signal_buff_size, ruby_sig_finalize), thread.c
  (rb_thread_sleep_forever, rb_thread_sleep_deadly, rb_thread_alone):
  protoized.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21929 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-02-01 12:51:44 +00:00
nobu 938fcd6b70 * io.c (rb_io_ungetbyte, rb_io_ungetc): allows nil to reset EOF
flag with ungetting nothing.

* ruby.c (load_file_internal): rests EOF flag to make possible to
  load from stdin after reading data.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21718 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-01-21 12:42:39 +00:00
nobu 1a0f593b3c * ruby.c (load_file_internal): no need to cast.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21711 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-01-21 04:59:20 +00:00
ko1 d31e1d4a52 * ruby.c (require_libraries): reset th->parse_in_eval while
loading libraries.  fixes [ruby-dev:37780]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21661 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-01-19 04:41:19 +00:00
ko1 c4c3f238d7 * iseq.c:
rename ruby_iseq_disasm_insn() -> rb_iseq_disasm_insn().
  rename ruby_iseq_disasm() -> rb_iseq_disasm().
* compile.c:
  rename ruby_iseq_compile() -> rb_iseq_compile_node().
  rename ruby_iseq_translate_threaded_code() ->
  rb_iseq_translate_threaded_code().
  rename ruby_insns_name_array() -> rb_insns_name_array().
  rename ruby_iseq_build_from_ary() -> rb_iseq_build_from_ary().
* iseq.c, compile.c: remove ruby_insn_make_insn_table() and make
  static function insn_make_insn_table().
* iseq.h, ruby.c, vm.c, vm_core.h, vm_eval.c, vm_dump.c,
  blockinlining.c: ditto.
  Rename strange "ruby_" prefix to "rb_" prefix.
  This changes may affect only core because renamed functions
  require a pointer of rb_iseq_t which is not exposed.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21653 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-01-19 01:06:56 +00:00
ko1 e40928733d * ruby.c (process_options): decrement parse_in_eval to recognize
parsing main or normal eval script.
* compile.c (rb_parse_in_main): return 1 if parsing main script.
  (if parse_in_eval is negative value, it means main script)
* parse.y (yycompile0): check rb_parse_in_main() to accumulate
  script text.  Bug #848 [ruby-core:20450]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21571 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-01-15 16:14:43 +00:00
matz c6af6b1b94 * symbian/README.SYMBIAN: symbian support added. great appreciate
to <alexandre.zavorine at symbian.com>.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21513 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-01-15 01:53:08 +00:00
ko1 ec5283e691 * ruby.c (process_options): set th->base_block only while
it is needed.
* ruby.c (require_libraries): clear th->base_block before
  require libraries.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21143 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-28 18:45:24 +00:00
ko1 b19be9b1a9 * ruby.c (process_options): fix to untouch th->mild_compile_error.
[ruby-dev:37621], [ruby-dev:37620]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21089 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-27 06:05:41 +00:00
ko1 597220ef0c * vm.c (Init_VM): create and define TOPLEVEL_BINDING at first.
* vm.c (vm_set_main_stack, rb_iseq_eval_main): added.
* parse.y (rb_parser_compile_file): fix to check parse_in_eval flag.
* eval.c (ruby_exec_node): use rb_iseq_eval_main()
  instead of rb_iseq_eval().
* iseq.c (rb_iseq_new_main), vm_core.h: added.
  main script (specified by -e or script name) should be run
  under TOPLEVEL_BINDING using Kernel#eval.  Above changes
  simulate Kernel#eval behaviour.  [ruby-dev:37240]
* compile.c (make_name_for_block): skip iseq except block type.
  this fix is needed for [ruby-dev:37240], and also fixes
  [ruby-dev:35392].



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21079 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-27 01:15:56 +00:00
nobu e5bfdb8391 * ruby.c (process_options): get rid of warning on DOSISH.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20869 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-19 06:51:52 +00:00
usa 6a613ba2e4 * ruby.c (set_arg0): use strlcpy() instead of strncpy().
* load.c (rb_feature_p): ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20771 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-16 02:37:45 +00:00
matz 0e20782339 * ruby.c (process_options): revive global sub, gsub, chop, chomp
only when auto looping options (-p/-n) is specified.
  [ruby-core:20570]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20765 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-15 14:46:50 +00:00
nobu f403298449 * ruby.c (rubylib_mangled_path, rubylib_mangled_path2): cannot use
locale encoding before load path is initialized

* ruby.c (ruby_init_loadpath_safe): ditto.

* ruby.c (process_options): loads encdb so that encodings can be
  loaded, then associates script name and load paths with the
  locale encoding.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20741 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-15 02:32:21 +00:00
kouji e53990e4bd * ruby.c (process_options): fixed default_internal is nil.
(closes #862)


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20720 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-13 06:58:58 +00:00
yugui aa06e69000 * encoding.c (enc_get_default_encoding): removed.
Generalizing rb_default_{external,internal}_encoding seems to be
  difficult. 
  default_external cannot be NULL even before detected. [ruby-dev:37390]

* encoding.c (rb_default_external_encoding): has its own
  implementation again.

* encoding.c (rb_default_internal_encoding): ditto.

* gem_prelude.rb: added notice.

* ruby.c (rubylib_mangled_path, rubylib_mangled_path2): uses locale
  encoding but not ASCII-8BIT.

* ruby.c (process_options): refers less to default_external.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20656 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-12 05:25:39 +00:00
nobu 774f924db9 * ruby.c (proc_options): added version, copyright, usage, yydebug,
syntax to --dump option.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20577 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-08 02:28:17 +00:00
nobu ba274d1f46 * ruby.c (proc_options): source-encoding option.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20576 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-08 02:15:47 +00:00
nobu ecc83033ba * ruby.c (set_option_encoding_once): dry.
* ruby.c (proc_options): checks extra argument for -E/--encoding.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20575 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-12-08 01:32:36 +00:00
matz b58ed03759 * ruby.c (usage): -W description updated. [ruby-core:19858]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20295 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-11-21 18:34:03 +00:00
davidflanagan 2228f91851 ruby.c (set_internal_encoding_once): fix typo in error string
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20227 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-11-11 22:18:21 +00:00
nobu 04e94c6ec8 * ruby.c (process_options): delays setting safe level.
[ruby-dev:36997]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20067 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-30 23:16:16 +00:00
matz 86c50e3983 * ruby.c (load_file_internal): should not set script encoding to
ASCII-8BIT.

* ruby.c (load_file_internal): do not auto convert scripts even
  when default_internal is set.  [ruby-core:19579]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20056 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-30 09:17:49 +00:00
nobu 5cdd7f52cc * ruby.c (moreswitches): splits option string and passes arguments.
* ruby.c (proc_options): checks if allowed in RUBYOPT.

* ruby.c (process_options): allows long style options in RUBYOPT.

* ruby.c (load_file_internal): ditto in shebang.  [ruby-dev:36979]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20053 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-30 01:34:23 +00:00
nobu bc4bc3a80f * ruby.c (load_file_internal): use ASCII-8BIT to prevent conversion.
[ruby-core:19579]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20013 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-29 00:30:09 +00:00
nobu bd92ab89c0 * ruby.c (load_file_internal): cache common interned IDs.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20012 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-29 00:23:04 +00:00
nobu 0a20a506e1 * ruby.c (load_file): preserves $.. [ruby-dev:36937]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19965 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-27 06:58:28 +00:00
yugui 5106742893 * ruby.c (usage): updated the description of -E option.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19932 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-25 02:18:53 +00:00
matz 3f0ec8887f * string.c (rb_external_str_new): a new function to convert from
external encoding to internal encoding.  if something went
  wrong, it returns a string with the external encoding.

* string.c (rb_external_str_new_with_enc): same as above besides
  you can specify the source encoding.

* ruby.c (ruby_set_argv): use rb_external_str_new()

* ruby.c (set_arg0, ruby_script): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19834 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-18 10:36:20 +00:00
matz 4709e330cf * ruby.c (proc_options): no warning when default_external already
set by -E.

* test/ruby/test_rubyoptions.rb (TestRubyOptions#test_rubyopt):
  put -K after -E to set script encoding.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19811 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-16 22:21:09 +00:00
matz 40adf66644 * ruby.c (process_options): -U should be allowed in RUBYOPT
environment variable.  [ruby-dev:36720]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19790 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-15 07:48:34 +00:00
nobu 40c08c9ee6 * ruby.c (proc_options): -U can be followed by other options.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19779 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-14 05:11:20 +00:00
matz 339ceda4e8 * ruby.c (set_internal_encoding_once): check double contradicted
specification of the encoding from command line.

* ruby.c (set_external_encoding_once): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19773 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-14 00:41:09 +00:00
matz 9ed35ae793 * ruby.c (proc_options): add -U command line option to specify
utf-8 as default_internal.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19766 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-12 23:03:17 +00:00
matz baeeebf474 * encoding.c (rb_default_internal_encoding): merged a patch from
Michael Selig <michael.selig at fs.com.au> in [ruby-core:18985].

* io.c (rb_io_ext_int_to_encs): ditto.

* ruby.c (proc_options): support default internal encoding in -E
  option.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19709 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-07 17:39:44 +00:00
yugui e8ee99ff1a * dln.c: Ruby no longer supports VMS.
* error.c: ditto.

* eval.c: ditto.

* eval_intern.h: ditto.

* include/ruby/defines.h: ditto.

* include/ruby/ruby.h: ditto.

* io.c: ditto.

* process.c: ditto.

* ruby.c: ditto.

* vms/config.h: removed.

* vms/vms.h: ditto.

* vms/vmsruby_private.c: ditto.

* vms/vmsruby_private.h: ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19682 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-04 13:57:06 +00:00
yugui a8c3540b32 * dln.c: Ruby no longer supports Windows CE.
* eval.c: ditto.

* include/ruby/defines.h: ditto.

* include/ruby/win32.h: ditto.

* ruby.c: ditto.

* strftime.c: ditto.

* win32/Makefile.sub: ditto.

* win32/win32.c: ditto.

* ext/tk/extconf.rb: ditto.

* lib/fileutils.rb: ditto.

* test/fileutils/test_fileutils.rb: ditto.

* wince/*: removed.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19681 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-04 13:48:20 +00:00
yugui 642e081879 * dln.c: Ruby no longer supports MacOS 9 or before.
* eval.c: ditto.

* eval_intern.h: ditto.

* ext/extmk.rb: ditto.

* ext/tk/sample/tkextlib/treectrl/demo.rb: ditto.

* ext/tk/stubs.c: ditto.

* file.c: ditto.

* hash.c: ditto.

* include/ruby/defines.h: ditto.

* ruby.c: ditto.

* signal.c: ditto.

* vm_core.h: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19680 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-04 13:42:00 +00:00
yugui ae7ea3332b * dln.c: Ruby no longer supports MS-DOS.
* ext/sdbm/_sdbm.c: ditto.

* ext/sdbm/sdbm.h: ditto.

* gc.c: ditto.

* hash.c: ditto.

* include/ruby/defines.h: ditto.

* include/ruby/util.h: ditto.

* io.c: ditto.

* process.c: ditto.

* ruby.c: ditto.

* strftime.c: ditto.

* util.c: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19679 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-04 13:33:22 +00:00
yugui 8dd118c0db * djgpp/GNUmakefile.in: removed. Ruby no longer supports djgpp.
* djgpp/README.djgpp: ditto.

* djgpp/config.hin: ditto.

* djgpp/config.sed: ditto.

* djgpp/configure.bat: ditto.

* djgpp/mkver.sed: ditto.

* ext/Setup.dj: ditto.

* dln.c: removed djgpp supports.

* file.c: ditto.

* gc.c: ditto.

* io.c: ditto.

* process.c: ditto.

* ruby.c: ditto.

* signal.c: ditto.

* util.c: ditto.

* vm_core.h: ditto.

* lib/fileutils.rb: ditto.

* lib/mkmf.rb: ditto.

* ext/socket/socket.c: ditto.

* test/fileutils/test_fileutils.rb: ditto.

* test/ruby/test_env.rb: ditto.

* test/ruby/test_path.rb: ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19678 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-04 13:25:12 +00:00
yugui bbbd9c0b7b * x68/_dtos18.c: removed. Ruby no longer supports human68k.
* x68/_round.c: ditto.

* x68/fconvert.c: ditto.

* x68/select.c: ditto.

* ext/Setup.x68: ditto.

* missing/x68.c: ditto.

* dln.c (dln_find_exe_r): removed human68k supports.
  (dln_find_1): ditto.

* lib/mkmf.rb: ditto.

* ext/extmk.rb (Init_ext): ditto.

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

* gc.c (GC_MALLOC_LIMIT): ditto.
  (rb_setjmp, rb_jmpbuf): ditto.
  (mark_current_machine_context): ditto.

* include/ruby/defines.h (PATH_ENV): ditto.

* io.c: ditto.

* process.c: ditto.

* ruby.c: ditto.

* test/ruby/test_env.rb: ditto.

* test/ruby/test_path.rb: ditto.

* LEGAL


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19677 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-10-04 13:12:13 +00:00
ko1 2e311f6bd5 * include/ruby/node.h, node.h: move node.h from include path.
This change stop to install node.h beacuase of saving ABI
  (node.h will be changed. Extensions should not depends on
  this file).
* blockinlining.c, class.c, compile.c, debug.h, enum.c,
  gc.c, iseq.c, parse.y, ruby.c, signal.c, variable.c,
  vm.c, vm_core.h, vm_dump.c: ditto.
* ext/ripper/depend: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19500 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-23 19:52:31 +00:00
ko1 7f7834abf7 * include/ruby/node.h, vm_core.h: move definition of
RUBY_VM_METHOD_NODE to node.h.
* class.c, common.mk: remove useless inclusion.
* compile.h, iseq.h, vm_core.h: rename compile.h to iseq.h.
  move some definitions from vm_core.h to iseq.h.
* compile.c, iseq.c, vm.c: ditto.
* eval.c, compile.c: move some functions for parser
  from eval.c to compile.c.
* eval_intern.h, vm_core.h: move va_init_list() macro to
  vm_core.h.
* iseq.c (rb_iseq_new_top, rb_iseq_first_lineno): added.
* load.c, ruby.c: use rb_iseq_new_top() instead of
  rb_iseq_new() with ISEQ_TYPE_TOP constant directly.
* proc.c: use rb_iseq_first_lineno() instead of accessing
  iseq structure.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19472 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-23 07:49:45 +00:00
ko1 69029b90fe * gc.c, include/ruby/ruby.h: rename rb_register_mark_object()
to rb_gc_register_mark_object().
* eval.c, vm.c: initialize vm->mark_object_ary at
  Init_top_self().
* bignum.c, complex.c, encoding.c, ext/win32ole/win32ole.c,
  io.c, load.c, marshal.c, rational.c, ruby.c, vm.c:
  use rb_gc_register_mark_object() instead of
  rb_global_variable() or rb_gc_register_address().



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19365 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-15 14:59:14 +00:00
nobu 387d645af0 * ruby.c (process_options): associates the locale encoding with $0 as
well as ARGV.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19337 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-09-14 07:07:31 +00:00
nobu ce60bbc851 * include/ruby/intern.h (rb_io_ungetbyte): added prototype.
* io.c (rb_io_gets): use rb_io_getline_1 for unget buffer.

* ruby.c (load_file): use rb_io_ungetbyte.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18832 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-08-25 08:36:46 +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
shyouhei 0ef21e44e7 forgot to commit
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17773 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-07-01 09:50:30 +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 de15273702 * ruby.c (set_arg0, ruby_prog_init): freeze $0. a patch from Keita
Yamaguchi <keita.yamaguchi at gmail.com>.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17586 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-26 15:00:16 +00:00
nobu 29ad22694f * ruby.c (verbose_setter, opt_W_getter): fixed prototypes.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17418 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-18 12:08:16 +00:00
usa 2c66adba64 * ruby.c (opt_W_getter): use ruby_verbose directly instead of parameter
because ruby_verbose is not a real variable, so the address of
	  parameter is not collect.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17412 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-18 10:22:06 +00:00
nobu 3e30cdad08 * ruby.c (opt_W_getter): made a hooked variable.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17386 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-17 14:02:20 +00:00
nobu 7799fe9e9f * ruby.c (rb_argv0): revised for ext/tk.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17067 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-10 02:25:18 +00:00