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

580 Коммитов

Автор SHA1 Сообщение Дата
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
nobu 5a647a3f5f * include/ruby/ruby.h (CONST_ID): constant ID cache for non-gcc.
* *.c: no cache in init functions.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17053 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-09 09:25:32 +00:00
matz 66054b9e3d * ruby.c (require_libraries): req_list may be NULL. [ruby-dev:35008]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17042 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-09 06:40:02 +00:00
nobu 6cdc89332e * vm_core.h (struct rb_vm_struct): moved ruby_debug, ruby_verbose, and
rb_progname.

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

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


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17039 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-09 05:18:03 +00:00
nobu 9fb521515d * vm_core.h (struct rb_vm_struct): moved src_encoding_index.
* ruby.c (struct cmdline_options): moved setids and req_list, and the
  latter is now an array, to prevent memory leak.

* ruby.c (cmdline_options_init): added.

* ruby.c (add_modules, require_libraries, init_ids, forbid_setid): use
  struct cmdline_options.

* vm.c (vm_init2): initialize src_encoding_index.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17038 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-09 04:20:07 +00:00
ko1 72ba13aa8e * array.c, bignum.c, cont.c, dir.c, dln.c, encoding.c, enumerator.c,
enumerator.c (enumerator_allocate), eval_jump.c, file.c, hash.c,
  io.c, load.c, pack.c, proc.c, random.c, re.c, ruby.c, st.c,
  string.c, thread.c, thread_pthread.c, time.c, util.c, variable.c,
  vm.c, gc.c:
  allocated memory objects by xmalloc (ruby_xmalloc) should be
  freed by xfree (ruby_xfree).
* ext/curses/curses.c, ext/dbm/dbm.c, ext/digest/digest.c,
  ext/gdbm/gdbm.c, ext/json/ext/parser/parser.c,
  ext/json/ext/parser/unicode.c, ext/openssl/ossl_cipher.c,
  ext/openssl/ossl_hmac.c, ext/openssl/ossl_pkey_ec.c,
  ext/sdbm/init.c, ext/strscan/strscan.c, ext/zlib/zlib.c:
  ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17017 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-08 10:01:40 +00:00
nobu 8f05f7fe05 * ruby.c (set_arg0): reverted used variable definition.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16738 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-01 18:52:15 +00:00
naruse ccb61351ea * rational.c (string_to_r_internal): use rb_isdigit.
* marshal.c (long_toobig): use %zd.

* ruby.c (set_arg0): move unused variable definition.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16736 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-06-01 18:23:10 +00:00
nobu 075530a685 * suppress warnings with -Wwrite-string.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16716 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-31 09:28:20 +00:00
nobu 75aa81b79d * ruby.c (process_options): --dump option exit immediately.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16490 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-20 04:19:27 +00:00
nobu 8afd39ad09 * ruby.c (proc_options, process_options): --dump option.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16488 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-20 03:13:52 +00:00
nobu 294a1d2270 * ruby.c (ruby_init_gems), gem_prelude.rb: check if Gem is defined
instead of Gem::Enable.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16371 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-12 01:52:53 +00:00
nobu 4264ca9436 * dln.c (dln_find_exe_r, dln_find_file_r): reentrant versions.
* file.c (rb_find_file_ext, rb_find_file), process.c (proc_exec_v),
  (rb_proc_exec, proc_spawn_v, proc_spawn), ruby.c (process_options):
  use reentrant versions.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16319 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-07 21:43:54 +00:00
usa ffd4bf96cc * ruby.c (process_options, ruby_set_argv): set encoding of rb_argv
after Init_prelude() because cannot load encoding extensions before
	  it.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16313 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-05-07 11:25:23 +00:00
nobu 01b773a093 * load.c (rb_load_path), vm_core.h (rb_vm_t): moved to VM.
* load.c (rb_get_load_path): returns absolute load path.

* load.c (load_path_getter): $LOAD_PATH getter.

* file.c (rb_find_file_ext, rb_find_file), ruby.c (push_include,
  ruby_init_loadpath): use the accessor.

* vm.c (rb_vm_mark): mark load_path.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16240 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-04-30 09:03:03 +00:00
naruse fe0446cc01 * ruby.c (ruby_set_argv): ARGV should be locale encoding.
[ruby-list:44861]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16214 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-04-26 23:08:38 +00:00
matz ae6782315a * ruby.c (process_options): set safe_level before loading script.
[ruby-dev:34421]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16180 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-04-24 08:20:56 +00:00
nobu 6cdd421a9b * ruby.c (process_options): preludes and parser need to run in safe
level 0.  [ruby-dev:34407]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16050 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-04-15 17:40:46 +00:00
nobu 73437c05f5 * ruby.c (process_options): dln_find_file returns the pointer to a
static buffer, so should copy it.  [ruby-dev:34409]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16049 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-04-15 17:26:29 +00:00
nobu 639c3a8962 * include/ruby/intern.h (rb_argv): replaced with rb_get_argv().
[ruby-Bugs-19514]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16037 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-04-15 09:02:19 +00:00
nobu 7b4a171158 * eval.c (ruby_exec_node, ruby_run_node), ruby.c (process_options):
use iseq instead of NODE.

* gc.c (source_filenames): removed.

* include/ruby/intern.h, parse.y (yycompile, parser_mark, parser_free,
  ripper_initialize): rb_source_filename() is no longer used.

* compile.c, compile.h (ERROR_ARGS), parse.y (node_newnode, fixpos,
  parser_warn, e_option_supplied, warn_unless_e_option, range_op,
  cond0): nd_file is no longer used.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15983 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-04-12 03:41:51 +00:00
nobu f6001be537 * ruby.c (proc_options): checks if the word is empty.
* ruby.c (process_options): typo fixed.  [ruby-dev:34122]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15837 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-03-25 07:32:58 +00:00
matz 8149168db6 * ruby.c (usage): remove some unimportant lines to fit -h message
in a page.  [ruby-dev:34018]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15740 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-03-10 15:47:47 +00:00
nobu 6a9bfa23bf * ruby.c (load_file): parse shebang in us-ascii. a patch from
sheepman <sheepman AT sheepman.sakura.ne.jp> in [ruby-dev:33955]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15670 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-03-02 01:13:15 +00:00
nobu b8a733d0b8 * io.c (struct argf): packed ARGF stuffs.
* ruby.c (proc_options): use ruby_set_inplace_mode().


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15663 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-03-01 08:59:04 +00:00
nobu b676e2671e * ruby.c (enable_option, disable_option): allow all for all known
features.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15591 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-23 21:49:15 +00:00
nobu 552badf29f * debug.c (ruby_set_debug_option): separated ruby_each_words().
* util.c (ruby_each_words): extracted from ruby_set_debug_option().

* ruby.c (proc_options): generalized enable/disable options.

* ruby.c (ruby_init_gems): take enabled flag.  [ruby-core:14840]

* ruby.c (process_options): added --disable-rubyopt flag.

* include/ruby/util.h (ruby_each_words): prototype.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15590 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-23 21:13:05 +00:00
nobu b3b3ff29b5 * ruby.c (proc_options): check if argument for -E exists.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15589 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-23 20:25:29 +00:00
naruse 9a431fd58c * ruby.c (process_options): set default_external before loading
libraries. [ruby-dev:33801]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15496 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-15 23:03:22 +00:00
naruse dd738cd887 * ruby.c (load_file): enc must effect source encoding.
[ruby-core#15496]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15435 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-12 01:20:43 +00:00
naruse bd5a15f76d * ruby.c (load_file): the encoding of DATA follows the source
file encoding. [ruby-dev:33693]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15428 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-11 01:47:26 +00:00
usa 2160c40fb2 * parse.y (parser_initialize): set default script encoding as US-ASCII.
* ruby.c (load_file): ditto.

	* ruby.c (process_options): set script encoding of -e from locale
	  except when -K is specified.

	* ruby.c (load_file): set script encoding of stdin from locale except
	  when -K is specified. [ruby-dev:33375]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15246 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-25 18:49:28 +00:00
nobu a984e00b80 * ruby.c (load_file): set default to ASCII-8BIT explicitly if -K
option is not given.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15233 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-25 08:12:15 +00:00
nobu 8020c2e676 * ruby.c (process_options, load_file, rb_load_file): propagates script
encoding by -K to libraries.  [ruby-dev:33156]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15231 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-25 07:11:18 +00:00
nobu 5776f23d69 * ruby.c (process_options): set encoding of -e option from -E option
if they are compatible.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15230 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-25 06:56:50 +00:00
nobu c30d2489dd * ruby.c (cmdline_arguments): split argc and argv from cmdline_options.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15229 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-25 06:41:22 +00:00
nobu 95e59bd9e0 * ruby.c (process_options): not set encoding of -e option from -E
option if they are not compatible.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15228 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-25 06:12:44 +00:00
usa 2fc0fe5332 * ruby.c (proc_options, process_options, load_file): shouldn't effect
--encoding to script encoding. [ruby-dev:33169]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15226 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-25 04:18:14 +00:00
naruse ac7794478c * ruby.c (proc_optionc): -Kn means ASCII-8BIT.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15196 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-23 16:08:04 +00:00
nobu 9872d4d600 * parse.y (parser_prepare): get encoding from the first line.
[ruby-dev:33168]

* ruby.c (load_file): set encoding to input with set_encoding.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15119 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-18 23:35:38 +00:00
nobu 9eab65b3f0 * ruby.c (proc_options): encoding libraries cannot be loaded until
load path is set.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15060 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-15 07:59:33 +00:00
matz c884219d96 * ruby.1: a patch to describe --encoding. a patch from Yugui
<yugui AT yugui.sakura.ne.jp> in [ruby-dev:33079].

* ruby.c: ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15035 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-14 07:10:22 +00:00
nobu e26e05c4ab * ruby.c (load_file): local variable was not initialized when -x flag
is given.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15022 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-13 04:53:02 +00:00
nobu 60e38b6efb * ruby.c (load_file): script files should not be affected by locale.
[ruby-dev:33054]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15021 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-13 04:50:48 +00:00
nobu a7b36aebe8 * ruby.c (proc_options): fixed typo.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15020 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-13 04:37:17 +00:00
naruse 513d0ca7f6 * encoding.c (ENCINDEX_EUC_JP, ENCINDEX_SJIS): removed.
(rb_enc_init): EUC-JP and Shift_JIS are not builtin now.

* enc/Makefile.in: ditto.

* common.mk: ditto.

* ruby.c (proc_options): ditto.

* enc/shift_jis.c, enc/euc_jp.c: fixes for romove from builtin.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15016 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-13 02:51:15 +00:00
naruse 7f9c3b1c97 * ruby.c (process_options): -e'script' is locale encoding by default.
(load_file): ruby script from stdin is locale encoding by default.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14998 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-11 19:41:22 +00:00
nobu d036633dcb * ruby.c (process_options): give priority command line encoding option
to RUBYOPT, and enable -E option in RUBYOPT.

* ruby.c (load_file): deal with encoding option in shebang line if
  nothing in command line and RUBYOPT.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14965 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-09 06:54:26 +00:00
akr 6cdef2dc7e * $Date$ keyword removed to avoid inclusion of locale dependent
string.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14912 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-06 15:49:38 +00:00
nobu 4be0eb95cf * ruby.c (proc_options): no need for intermediate object.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14891 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-05 04:04:26 +00:00
matz b65d6208fe * ruby.c (proc_options): update according to the last API revert.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14885 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-04 16:47:41 +00:00
akr 041e829127 * include/ruby/encoding.h (rb_isascii): defined.
(rb_isalnum): ditto.
  (rb_isalpha): ditto.
  (rb_isblank): ditto.
  (rb_iscntrl): ditto.
  (rb_isdigit): ditto.
  (rb_isgraph): ditto.
  (rb_islower): ditto.
  (rb_isprint): ditto.
  (rb_ispunct): ditto.
  (rb_isspace): ditto.
  (rb_isupper): ditto.
  (rb_isxdigit): ditto.
  (rb_tolower): ditto.
  (rb_toupper): ditto.

* include/ruby/st.h (st_strcasecmp): declared.
  (st_strncasecmp): ditto.

* st.c (type_strcasehash): use st_strcasecmp instead of strcasecmp.
  (st_strcasecmp): defined.
  (st_strncasecmp): ditto.

* include/ruby/ruby.h: include include/ruby/encoding.h.
  (ISASCII): use rb_isascii.
  (ISPRINT): use rb_isprint.
  (ISSPACE): use rb_isspace.
  (ISUPPER): use rb_isupper.
  (ISLOWER): use rb_islower.
  (ISALNUM): use rb_isalnum.
  (ISALPHA): use rb_isalpha.
  (ISDIGIT): use rb_isdigit.
  (ISXDIGIT): use rb_isxdigit.
  (TOUPPER): defined.
  (TOLOWER): ditto.
  (STRCASECMP): ditto.
  (STRNCASECMP): ditto.

* dir.c, encoding.c, file.c, hash.c, process.c, ruby.c, time.c,
  transcode.c, ext/readline/readline.c: use locale insensitive
  functions.  [ruby-core:14662]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14829 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-01 12:24:04 +00:00
nobu d64a975396 * ruby.c (process_options): rejects dummy encoding.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14821 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-31 16:04:11 +00:00
nobu 6cb161a66c * ruby.c (proc_options, process_options): delays finding encoding
until load_path is set.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14820 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-31 14:57:46 +00:00
usa 7c1cab2a4f * encoding.c (Init_encoding): register Windows-31J and its alias.
[ruby-dev:32843]

	* ruby.c (proc_options): -Ks options means Windows-31J, not Shift_JIS.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14790 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-29 21:34:15 +00:00
akr 574b329748 unused variable removed.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14774 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-28 16:34:11 +00:00
usa eb1014e4ae * encoding.c (rb_locale_encoding): should check return value from
rb_locale_charmap().

	* ruby.c (locale_encoding): removed.

	* ruby.c (process_options): use rb_locale_encoding() instead of
	  locale_encoding().

	* ext/readline/readline.c (readline_readline): use locale encoding
	  instead of input IO's encoding. [ruby-dev:32872]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14770 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-28 10:41:52 +00:00
nobu 14ab3bd2ac * ruby.c (proc_options): encoding option in shbang and RUBYOPT did not
work, do not store alloca()ed string in a parent scope struct.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14706 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-25 14:16:03 +00:00
akr 5b809a28f8 * include/ruby/encoding.h, encoding.c, re.c, io.c, parse.y, numeric.c,
ruby.c, transcode.c: rename rb_ascii_encoding. to
  rb_ascii8bit_encoding.  rb_ascii_encoding is ambiguous with 
  ASCII-8BIT and US-ASCII.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14504 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-22 23:47:18 +00:00
matz d7cc14d436 * encoding.c (rb_ascii_encoding): renamed from previous
rb_default_encoding().

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14443 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-21 18:55:30 +00:00
nobu ef0706a5bf * encoding.c (rb_enc_register): set encoding constant.
* encoding.c (rb_enc_find_index): replace non-alphanumeric chars with
  underscores, so that initialize function can be called.

* ruby.c (proc_options, process_options): finds encoding after
  load_path is initialized.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14399 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-21 04:40:13 +00:00
akr 65a953c7c9 fix previous locale_encoding change.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14396 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-21 04:22:59 +00:00
akr 8c68d9a152 * encoding.c (rb_locale_charmap): return nil if no locale information.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14394 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-21 04:09:45 +00:00
akr 0530cf9ff8 * encoding.c: include locale.h
(rb_locale_charmap): new method Encoding.locale_charmap for
  nl_langinfo(CODESET).

* include/ruby/encoding.h (rb_locale_charmap): declared.

* main.c (main): call setlocale with LC_CTYPE.

* ruby.c (locale_encoding): use rb_locale_charmap.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14380 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-21 02:52:23 +00:00
akr 4cf437519f * regerror.c, string.c, io.c, lib/getoptlong.rb, lib/net/imap.rb,
compile.c, sprintf.c, parse.y, ext/win32ole/win32ole.c,
  ext/tk/sample/demos-en/entry3.rb, ext/tk/lib/tcltk.rb,
  ext/openssl/ossl_bn.c, numeric.c, vm.c,
  benchmark/bm_so_meteor_contest.rb, bignum.c, ruby.c: don't "illegal"
  for non law violation context.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14377 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-21 02:31:11 +00:00
akr b92cee1ddb * re.c, regerror.c, string.c, parse.y, ruby.c, file.c:
use capital letter for \xHH notation.  [ruby-dev:32511]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14202 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-12 14:30:54 +00:00
akr f4592d7bb0 * re.c (rb_reg_expr_str): use \xHH instead of \OOO.
* regerror.c (to_ascii): ditto.
  (onig_snprintf_with_pattern): ditto.
  (onig_snprintf_with_pattern): ditto.

* string.c (rb_str_inspect): ditto.
  (rb_str_dump): ditto.

* parse.y (parser_yylex): ditto.

* ruby.c (proc_options): ditto.

* file.c (rb_f_test): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14164 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-09 21:48:05 +00:00
akr 5b57724691 * ruby.c (proc_options): make rb_raise format as a string literal to
avoid warning.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14134 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-08 08:11:52 +00:00
nobu 6658e98c2d * ruby.c (process_options): reverted c flag.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14096 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-04 05:34:37 +00:00
matz d5bd9d1593 * encoding.c: rename primary_encoding -> default_external (encoding).
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14069 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-01 14:05:53 +00:00
akr 0529882de7 * ruby.c (usage): fix typo on --disable-gems option.
pointed by Richard Kilmer.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13924 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-11-15 02:27:08 +00:00
nobu d5a3389886 * common.mk (parse.c), ext/ripper/depend (ripper.c): process after
bison with sed.  [ruby-dev:32204]

* ruby.c (proc_options): use yydebug in cmdline_options.

* ruby.c (process_options): set yydebug flag of parser.

* parse.y (yydebug): moved into struct parser_params.

* parse.y (rb_parser_get_yydebug, rb_parser_set_yydebug): parser
  generic methods.

* */Makefile.sub (parse.c): moved to common.mk.

* tool/ytab.sed: comment out yydebug definition, and substitute
  yyerror with parser_yyerror.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13908 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-11-13 12:41:41 +00:00
akr 040ffb5d79 * gem_prelude.rb: new file for gem libraries. currently empty.
* common.mk: generate ext_prelude.c by prelude.rb and gem_prelude.rb.
  ruby (not miniruby) is linked with ext_prelude.o instead of prelude.o. 
* inits.c (rb_call_inits): don't call Init_prelude.

* ruby.c: support --disable-gems option.
  (ruby_init_gems): new function to define Gem::Enable and
  invoke Init_prelude.
  (process_options): call ruby_init_gems just after
  ruby_init_loadpath.

* tool/compile_prelude.rb: support multiple files.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13865 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-11-10 09:22:59 +00:00
nobu 94a6c1eef9 * ruby.c (locale_encoding): guestimate encoding from environment
variables.  [ruby-core:13315]

* ruby.c (process_options): set primary encoding from environment.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13855 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-11-09 08:48:13 +00:00
ko1 0303c1d42b * ruby.c (set_arg0): fix breaking environ bugs.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13842 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-11-09 01:10:06 +00:00
akr 21eebfb086 * configure.in: --with-vendordir implemented.
* mkconfig.rb: add config to vendorlibdir and vendorarchdir.

* instruby.rb: make vendor library directories.

* ruby.c: insert vendor library directories into load path.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13806 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-11-03 11:35:59 +00:00
nobu 4bc9096b23 * ruby.c (process_options): encoding set by command line option takes
priority over the encoding in the source, as the primary encoding.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13756 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-10-23 01:42:53 +00:00
matz 3493a66ec6 * ruby.c (proc_options): allow space after -E (encoding) option.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13755 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-10-22 15:29:53 +00:00
nobu a4e493a985 * ruby.c (process_options): set primary encoding from the parser
always.  [ruby-core:12758]

* ruby.c (load_file): should not discard the parser parameter.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13742 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-10-19 02:09:57 +00:00
nobu ae7ea35916 * ruby.c (proc_options): fixed reversed condition. [ruby-core:12722]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13734 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-10-17 08:39:33 +00:00
nobu 3cd040b6ef * encoding.c (rb_primary_encoding): added Encoding.primary_encoding.
* parse.y (rb_parser_encoding): added.

* ruby.c (proc_options): added -E and --encoding options.

* ruby.c (process_options): set primary encoding from command line
  option if set, or source encoding.

* include/ruby/encoding.h (rb_enc_from_encoding,
  rb_get_primary_encoding, rb_set_primary_encoding): prototypes.

* include/ruby/node.h (rb_parser_encoding): prototype.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13729 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-10-16 20:07:20 +00:00
akr 4b3a26c00e * ruby.c, debug.c: move debug enum and constants to debug.c.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13719 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-10-16 09:21:11 +00:00
akr b8dc3c1e2a * ruby.c (RUBY_ENCODING_SHIFT): added as enum.
* .gdbinit (rp): show encoding and coderange for strings.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13718 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-10-16 09:17:28 +00:00
nobu 676dc908b6 * parse.y (parser_regx_options): check if regexp encoding option
matches to current encoding.

* re.c (char_to_option, rb_char_to_option_kcode): 'n' is not kcode
  option now.

* re.c (rb_reg_to_s, rb_reg_error_desc): copy encoding rather than
  append as an option.

* re.c (make_regexp, rb_reg_prepare_re): use encoding of Regexp and
  String instead of kcode.

* re.c (rb_reg_initialize): set fixed option if none is set.

* re.c (rb_reg_regcomp): ditto.

* re.c (rb_reg_equal): check if encodings are equal.

* re.c (rb_reg_initialize_m): encoding option is obsolete.

* re.c (rb_kcode, rb_get_kcode, rb_set_kcode): removed.

* re.c (Init_Regexp): removed Regexp#kcode method.

* ruby.c (proc_options): allow long encoding name.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13717 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-10-16 05:48:40 +00:00
akr a6e5b6d660 * include/ruby/node.h: make node flags as VALUE type.
enum ruby_node_flags removed.

* ruby.c: define RUBY_NODE_* as const for gdb.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13653 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-10-07 13:03:05 +00:00
akr c2115fe8f4 * include/ruby/ruby.h: enum ruby_value_flags removed.
* ruby.c: define RUBY_FL_* as const VALUE for gdb.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13649 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-10-07 09:58:26 +00:00
nobu ee2ac58e4d * ruby.c (ruby_process_options): push frame with program name.
[ruby-core:12351]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13603 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-10-03 01:06:57 +00:00
nobu 014d1ae20d * ruby.c (require_libraries): use require method instead of calling
rb_require directly.  [ruby-dev:31322]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13580 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-10-01 01:58:44 +00:00
nobu b9b34059a6 * eval.c (ruby_options), ruby.c (proc_options, process_options): not
call exit(2) directly.  [ruby-dev:31912]

* eval.c (ruby_run_node): deal with direct exit code.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13579 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-10-01 01:52:32 +00:00
nobu 400202f6a5 * main.c (main): use platform-independent per-process initialization.
[ruby-dev:31900]

* ruby.c (ruby_sysinit): new function for per-process initialization.

* include/ruby/ruby.h (RUBY_GLOBAL_SETUP): toplevel setup declaration.

* include/ruby/win32.h, win32/mkexports.rb: alias NtInitialize
  ruby_sysinit.

* win32/win32.c (rb_w32_sysinit): renamed from NtInitialize.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13569 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-09-29 08:45:24 +00:00
nobu 310416744d * ruby.c (origarg): commit miss.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13559 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-09-28 21:50:01 +00:00
nobu 4507782baa * ruby.c (struct cmdline_options): static variables packed.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13558 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-09-28 21:47:31 +00:00
nobu 29621688c7 * io.c (rb_io_fdopen): create IO object from fd.
* parse.y (yycompile): use encoding of the source as default.

* ruby.c (proc_options, load_file): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13557 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-09-28 20:29:32 +00:00
nobu fd7e89ddc2 * parse.y (parser_initialize): set default encoding. [ruby-dev:31787]
* ruby.c (load_file): make new parse instance after processing shebang
  line options.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13448 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-09-15 08:32:12 +00:00
matz 9019911a2f * ruby.c (proc_options): -W should be allowed in RUBYOPT
environment variable.  [ruby-core:12118]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13432 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-09-12 14:14:32 +00:00
matz a25fbe3b3e * encoding.c: provide basic features for M17N.
* parse.y: encoding aware parsing.

* parse.y (pragma_encoding): encoding specification pragma.

* parse.y (rb_intern3): encoding specified symbols.

* string.c (rb_str_length): length based on characters.  
  for older behavior, bytesize method added.

* string.c (rb_str_index_m): index based on characters.  rindex as
  well.

* string.c (succ_char): encoding aware succeeding string.

* string.c (rb_str_reverse): reverse based on characters.

* string.c (rb_str_inspect): encoding aware string description.

* string.c (rb_str_upcase_bang): encoding aware case conversion.
  downcase, capitalize, swapcase as well.

* string.c (rb_str_tr_bang): tr based on characters.  delete,
  squeeze, tr_s, count as well.

* string.c (rb_str_split_m): split based on characters.

* string.c (rb_str_each_line): encoding aware each_line.

* string.c (rb_str_each_char): added.  iteration based on
  characters.

* string.c (rb_str_strip_bang): encoding aware whitespace
  stripping.  lstrip, rstrip as well.

* string.c (rb_str_justify): encoding aware justifying (ljust,
  rjust, center).

* string.c (str_encoding): get encoding attribute from a string. 

* re.c (rb_reg_initialize): encoding aware regular expression

* sprintf.c (rb_str_format): formatting (i.e. length count) based
  on characters.

* io.c (rb_io_getc): getc to return one-character string.
  for older behavior, getbyte method added.

* ext/stringio/stringio.c (strio_getc): ditto.

* io.c (rb_io_ungetc): allow pushing arbitrary string at the
  current reading point.

* ext/stringio/stringio.c (strio_ungetc): ditto.

* ext/strscan/strscan.c: encoding support.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13261 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-08-25 03:29:39 +00:00
nobu d134991730 * dln.c (load_1, dln_find_1): constified.
* ruby.c (usage): constified.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12848 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-07-26 04:57:48 +00:00
nobu ea7e249079 * dln.c (conv_to_posix_path): removed.
* ruby.c (rubylib_mangled_path, rubylib_mangled_path2): return
  VALUE instead of a pointer to static buffer.

* ruby.c (push_include_cygwin): fixed buffer overflow.
  [ruby-dev:31297]

* ruby.c (ruby_init_loadpath): not convert built-in paths.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12847 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-07-26 04:38:07 +00:00
nobu 233221db60 * parse.y (rb_parser_append_print, rb_parser_while_loop): moved check
for node to the head.

* ruby.c (proc_options): do nothing for -p/-n options if tree is null.
  submitted by Yusuke ENDOH <mame AT tsg.ne.jp> at [ruby-dev:31243].


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12812 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-07-18 00:19:10 +00:00
usa 92818d7eb6 * ruby.c: Qfalse is VALUE, not pointer.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12704 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-07-05 10:12:52 +00:00
nobu c5077a2c72 * ruby.c (proc_options): moved do_print and do_loop options
handling from ruby_process_options().


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12701 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-07-05 09:28:00 +00:00