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

279 Коммитов

Автор SHA1 Сообщение Дата
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 3a8f7f1d7f * include/ruby/ruby.h (FilePathStringValue): defined. similar to
FilePathValue but no taint check.

* file.c (rb_get_path_no_checksafe): implementation of
  FilePathStringValue.
  (rb_file_s_basename): use FilePathStringValue.
  (rb_file_s_dirname): ditto.
  (rb_file_s_extname): ditto.
  (rb_file_s_split): ditto.
  (rb_file_join): ditto.

* dir.c (file_s_fnmatch): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14155 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-09 05:12:31 +00:00
nobu 54f236542d * file.c (rb_get_path): use the original object if to_path method is
not defined.  [ruby-dev:32473]

* io.c (rb_f_open): call to_open on non-string objects, instead of
  to_str.  [ruby-dev:32473]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14152 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-09 03:18:21 +00:00
ko1 3453b2bd0e * gc.h, vm_core.h: decl of rb_gc_save_machine_context()
should be at vm_core.h.
* include/ruby/ruby.h, intern.h: remove type rb_thread_t.
* include/ruby/intern.h: change rb_unblock_function_t,
  rb_unblock_function_t.
* file.c, process.c: apply above changes.
* thread.c, thread_pthread.ci, thread_win32.ci: ditto.
* io.c: support blocking open (2). [ruby-core:13614]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13984 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-11-20 10:47:53 +00:00
akr 63a297994b * file.c (utime_internal): fallback utimensat to utimes.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13970 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-11-19 09:48:00 +00:00
akr a070c4fbe3 * configure.in: check struct timespec, clock_gettime, utimensat,
struct stat.st_atim,
  struct stat.st_atimespec,
  struct stat.st_atimensec,
  struct stat.st_mtim,
  struct stat.st_mtimespec,
  struct stat.st_mtimensec,
  struct stat.st_ctim,
  struct stat.st_ctimespec,
  struct stat.st_ctimensec.

* include/ruby/missing.h: provide struct timespec if not available.

* time.c: support nanosecond-resolution using struct timespec.

* include/ruby/intern.h: provide rb_time_nano_new.

* file.c (utime_internal): use utimensat if available.
  (rb_file_s_utime): refactored.
  (rb_f_test): use stat_atime, stat_mtime, stat_ctime.
  (rb_stat_cmp): check tv_nsec.
  (stat_atimespec): new function.
  (stat_atime): ditto.
  (stat_mtimespec): ditto.
  (stat_mtime): ditto.
  (stat_ctimespec): ditto.
  (stat_ctime): ditto.
  (rb_stat_atime): use stat_atime.
  (rb_file_s_atime): ditto.
  (rb_file_atime): ditto.
  (rb_stat_mtime): use stat_mtime.
  (rb_file_s_mtime): ditto.
  (rb_file_mtime): ditto.
  (rb_file_ctime): use stat_ctime.
  (rb_file_s_ctime): ditto.
  (rb_stat_ctime): ditto.

* variable.c (rb_copy_generic_ivar): clear clone's instance variables
  if obj has no instance variable.

* marshal.c (w_object): dump instance variables of generated string
  for TYPE_USERDEF, even if original object has instance variables.

* lib/time.rb (Time#xmlschema): use nsec instead of usec.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13968 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-11-19 09:09:38 +00:00
matz 7a978073c9 * parse.y (parser_yylex): should clear parser->tokp as well.
[ruby-dev:32250]

* parse.y: remove NEED_ASSOC that break test_parser_events.

* parse.y (parser_yylex): should not decrement line numbers at the
  end of file.

* file.c (rb_find_file_ext): search .rb files first through in the
  loadpath.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13966 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-11-19 07:10:09 +00:00
nobu 6c77d58356 * file.c (rb_get_path): returns frozen string.
* file.c (rb_file_s_chown, rb_file_s_lchown): use uid_t and gid_t.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13745 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-10-20 02:49:22 +00:00
ko1 6244e502cc * thread.c: fix Mutex to be interruptable lock.
* thread_win32.ci, thread_win32.h, thread_pthread.ci, thread_pthread.h:
  prepare native_cond_*() which are based on pthread_cond_*() spec.
* prelude.rb: fix Mutex#synchronize method.
* vm_core.h, include/ruby/intern.h: change unblock function interface
  (to pass some user data).
* file.c, process.c: ditto.
* benchmark/bm_vm2_mutex.rb: add a benchmark for mutex.
* benchmark/bm_vm3_thread_mutex.rb: add a benchmark for mutex
  with contension.
* benchmark/run.rb: fix to remove ENV['RUBYLIB'] for matzruby.
* test/ruby/test_thread.rb: add a test.
* common.mk: fix benchmark options.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13290 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-08-27 16:48:14 +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 42850db14b * configure.in (group_member): check if presents.
* configure.in (XCFLAGS): add _GNU_SOURCE on linux.

* file.c (group_member): use system routine if available.

* process.c: moved _GNU_SOURCE macro to Makefile.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13240 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-08-23 08:25:12 +00:00
nobu f1622c195d * file.c (rb_file_s_rename): deleted code to get rid of a bug of
old Cygwin.

* file.c (rb_file_truncate): added prototype of GetLastError()
  on cygwin.  [ruby-dev:31239]

* include/ruby/intern.h (is_ruby_native_thread): prototype.

* missing/strftime.c (strftime): fix printf format and actual
  arguments.

* ext/Win32API/Win32API.c (Win32API_initialize): ditto.

* ext/tk/tcltklib.c (ip_finalize): ditto.

* ext/win32ole/win32ole.c (lcid_installed): ditto.

* ext/socket/getnameinfo.c: include stdio.h always.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12836 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-07-22 05:33:54 +00:00
nobu 2b592580bf * include/ruby: moved public headers.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12501 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-06-10 03:06:15 +00:00
nobu 62b3932c9c * file.c (Init_File): method definition mismatch.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12296 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-05-18 16:04:22 +00:00
matz dcb9f150e5 * file.c (Init_File): add to_path method to File objects.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12292 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-05-18 07:57:51 +00:00
nobu 7b0f246345 * file.c (rb_stat_uid, rb_stat_gid, eaccess): use rb_uid_t and
rb_gid_t instead of int.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11986 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-03-04 14:41:16 +00:00
nobu 9b7ecc68a9 * file.c (rb_stat_s_utime): fixed a commit miss for the platforms
where utimes() does not exist.

* lib/fileutils.rb (touch): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11985 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-03-04 14:38:02 +00:00
nobu 15dabe8216 * file.c (rb_file_s_utime): allow nil to set the current time.
* lib/fileutils.rb (touch): ditto, and added :mtime and :nocreate
  options.  fixed: [ruby-talk:219037]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11973 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-03-03 13:37:02 +00:00
nobu 5b10c170e5 * file.c, gc.c, io.c, ruby.h, rubyio.h, win32/win32.h (rb_io_t):
renamed from OpenFile.

* ext/dl/cptr.c, ext/io/wait/wait.c, ext/openssl/ossl.h,
  ext/openssl/ossl_bio.c, ext/openssl/ossl_ssl.c, ext/pty/pty.c,
  ext/readline/readline.c, ext/socket/socket.c: ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11869 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-02-24 10:30:50 +00:00
nobu 8ac59769bc * file.c (rb_thread_flock, rb_file_flock): use UBF feature.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11865 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-02-24 09:45:41 +00:00
usa 61fbdef349 * file.c (rb_find_file): should not call fpath_check() with NULL.
fixed: [ruby-core:09867]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11520 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-01-09 08:50:04 +00:00
matz 7c96418526 * object.c (Init_Object): new method Dir.exist?(path).
[ruby-core:09663]

* file.c (Init_File): remove File.exists?; use File.exist?
  instead.

* file.c: rename functions to test_* to rb_file_*_p.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11366 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-12-07 15:18:14 +00:00
matz 5dd8f6e20c * file.c (test_grpowned, rb_stat_grpowned): should honor
supplementary group IDs.  [ruby-core:09546]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11302 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-11-22 08:37:11 +00:00
nobu b96af08add * file.c (rb_path_end): skip root directory. fixed: [ruby-core:08913]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11020 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-09-25 12:25:29 +00:00
matz 5cc2093ccd * hash.c (recursive_hash): remove unused local variable.
* parse.y (parser_yylex): ditto.

* parse.y (rb_gc_mark_symbols): fix unmatched prototype .

* file.c (rb_get_path): check NUL byte in the path string.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11018 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-09-25 05:57:37 +00:00
nobu 352303c906 * file.c: ISPRINT() needs ctype.h
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10905 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-09-10 00:41:44 +00:00
matz 0f785c3840 * file.c (rb_f_test): test(0) should not have any special
meaning.  [ruby-dev:29425]

* file.c (rb_f_test): properer error message.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10900 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-09-09 16:19:33 +00:00
nobu 585c61691e * file.c (path_check_0, fpath_check): disable path check on cygwin.
[ruby-talk:213074]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10874 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-09-07 14:28:36 +00:00
nobu b9a508bb96 * file.c (path_check_0): check if sticky bit is set on parent
directories for executable path.  fixed: [ruby-dev:29415]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10863 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-09-04 20:50:13 +00:00
matz 2156870525 * ruby.h (struct RArray): embed small arrays.
(RARRAY_LEN): defined for accessing array members.
  (RARRAY_PTR): ditto.

* array.c: use RARRAY_LEN and RARRAY_PTR.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10833 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-09-02 14:42:08 +00:00
usa 5b5e4a6fc1 * file.c (test_identical, rb_file_s_truncate): use RSTRING_PTR and
RSTRING_STR.

* io.c (pipe_open, rb_io_reopen): ditto.

* process.c (proc_spawn_n, rb_spawn): ditto.

* util.c (ruby_add_suffix): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10811 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-08-31 11:24:44 +00:00
matz 54af80844f * ruby.h (struct RString): embed small strings.
(RSTRING_LEN): defined for accessing string members.
  (RSTRING_PTR): ditto.

* string.c: use RSTRING_LEN and RSTRING_PTR.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10810 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-08-31 10:47:44 +00:00
drbrain b963ffbf1d Fix documentation submitted by Rick Ohnemus. ruby-Bugs-5529. [ruby-core:08725]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10783 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-08-27 22:25:08 +00:00
nobu f50c13da99 * file.c (rb_file_s_rename): use errno if set properly.
fixed: [ruby-dev:29293]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10747 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-08-19 02:29:18 +00:00
nobu 79b82a8749 * file.c (rb_stat_[rRwWxX]): check for super user.
fixed: [ruby-core:08616]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10741 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-08-17 10:15:55 +00:00
matz c09cea5e1b * object.c (rb_mod_attr): make Module#attr to be an alias to
attr_reader.  [RCR#331]

* ruby.h: export classes/modules to implement sandbox.
  [ruby-core:08283]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10577 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-07-20 17:36:36 +00:00
matz 1b7465e893 * eval.c, file.c, etc.: code-cleanup patch from Stefan Huehner
<stefan at huehner.org>.  [ruby-core:08029]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10351 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-06-20 18:02:17 +00:00
matz 7b48490222 * eval.c (Init_eval): add aliases invoke_method and
invoke_functional_method corresponding send and funcall
  respectively.  [ruby-talk:197512]

* parse.y (parser_yylex): returns the most typical keyword token
  on EXPR_FNAME.  [ruby-core:7995]

* ext/socket/socket.c: protoize.

* parse.y (then): remove ':' from 'then' and 'do' rules.

* hash.c (env_aset): raise TypeError on nil with more descriptive
  message.  [ruby-core:07990]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10304 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-06-17 14:50:04 +00:00
ocean 488b3d6819 * file.c: commit miss?
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9905 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-02-06 07:26:16 +00:00
eban b29ad4cd95 * file.c (cygwin_flock): save old errno.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9904 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-02-06 07:13:53 +00:00
eban 895778951e * file.c (rb_thread_flock): ERROR_NOT_LOCKED is not an error on Cygwin.
In such situation, flock() should return 0.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9903 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-02-06 07:06:22 +00:00
nobu a26039acbc * configure.in, dln.c, file.c, intern.h, missing.h (eaccess): use
system routine if provided.  fixed: [ruby-core:07195]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9856 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-01-25 13:30:11 +00:00
ocean 4678e9340a * file.c (rb_file_s_chmod): avoid warning where sizeof(int) !=
sizeof(void*).


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9832 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-01-13 18:44:34 +00:00
akr 935712e8e4 (rb_f_test): fix document. [ruby-dev:28087]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9731 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-12-21 09:20:15 +00:00
ocean b36585ce42 * file.c (w32_io_info): should return handle because FileIndex is
valid only while file is open. [ruby-dev:28088]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9730 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-12-21 07:53:55 +00:00
ocean 427c2754e9 * file.c (w32_io_info): CreateFile failed on Win9x if file was already
opened. (FILE_SHARE_READ was needed, but actually I don't understand
  the flags of CreateFile well...)


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9604 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-11-23 16:32:47 +00:00
ocean 29bcbe5c5e * file.c (w32_io_info): should not call GetFileInformationByHandle
for pipe.

* file.c (w32_io_info): checks return value from rb_w32_get_osfhandle.

* file.c (w32_io_info): now can identify directory on WinNT.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9600 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-11-23 09:56:23 +00:00
nobu 4ef75249df * file.c (test_identical): test if two files are identical.
* file.c (rb_f_test): support DOSISH systems where st_ino is not
  reliable.  fixed: [ruby-core:06672]

* win32.h, win32.c (rb_w32_osid): check the running platform.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9590 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-11-22 16:26:39 +00:00
usa 333e8b294d * file.c (rb_file_s_basename): skip slashes just after UNC top slashes.
* test/ruby/test_path.rb (test_dirname, test_basename): follow new
  spec. and add new tests.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9586 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-11-22 05:39:50 +00:00