Ruby
2.4.2p198(2017-09-14revision59899)
|
#include "internal.h"
#include "encindex.h"
#include <sys/types.h>
#include <sys/stat.h>
#include <errno.h>
#include <ctype.h>
#include "ruby/util.h"
Go to the source code of this file.
Data Structures | |
struct | dir_data |
struct | chdir_data |
struct | warning_args |
struct | glob_pattern |
struct | glob_args |
struct | brace_args |
struct | push_glob_args |
Macros | |
#define | dirent direct |
#define | NAMLEN(dirent) (dirent)->d_namlen |
#define | HAVE_DIRENT_NAMLEN 1 |
#define | IS_WIN32 0 |
#define | USE_NAME_ON_FS_REAL_BASENAME |
#define | USE_NAME_ON_FS_BY_FNMATCH |
#define | USE_NAME_ON_FS 0 |
#define | NORMALIZE_UTF8PATH 0 |
#define | IF_NORMALIZE_UTF8PATH(something) /* nothing */ |
#define | IFTODT(m) (((m) & S_IFMT) / ((~S_IFMT & S_IFMT-1) + 1)) |
#define | FNM_NOESCAPE 0x01 |
#define | FNM_PATHNAME 0x02 |
#define | FNM_DOTMATCH 0x04 |
#define | FNM_CASEFOLD 0x08 |
#define | FNM_EXTGLOB 0x10 |
#define | FNM_SYSCASE 0 |
#define | FNM_SHORTNAME 0 |
#define | FNM_NOMATCH 1 |
#define | FNM_ERROR 2 |
#define | Next(p, e, enc) ((p)+ rb_enc_mbclen((p), (e), (enc))) |
#define | Inc(p, e, enc) ((p) = Next((p), (e), (enc))) |
#define | UNESCAPE(p) (escape && *(p) == '\\' ? (p) + 1 : (p)) |
#define | ISEND(p) (!*(p) || (pathname && *(p) == '/')) |
#define | RETURN(val) return *pcur = p, *scur = s, (val); |
#define | GlobPathValue(str, safe) |
#define | check_safe_glob(str, safe) ((safe) ? rb_check_safe_obj(str) : (void)0) |
#define | check_glob_encoding(str) rb_enc_check((str), rb_enc_from_encoding(rb_usascii_encoding())) |
#define | GetDIR(obj, dirp) ((dirp) = dir_check(obj)) |
#define | dir_fileno rb_f_notimplement |
#define | READDIR(dir, enc) readdir((dir)) |
#define | dir_tell rb_f_notimplement |
#define | dir_seek rb_f_notimplement |
#define | dir_set_pos rb_f_notimplement |
#define | dir_s_chroot rb_f_notimplement |
#define | sys_enc_warning_in(func, mesg, enc) sys_enc_warning(mesg, enc) |
#define | GLOB_VERBOSE (1U << (sizeof(int) * CHAR_BIT - 1)) |
#define | sys_warning(val, enc) ((flags & GLOB_VERBOSE) ? sys_enc_warning_in(RUBY_FUNCTION_NAME_STRING, (val), (enc)) :(void)0) |
#define | GLOB_ALLOC(type) ((type *)malloc(sizeof(type))) |
#define | GLOB_ALLOC_N(type, n) ((type *)malloc(sizeof(type) * (n))) |
#define | GLOB_REALLOC(ptr, size) realloc((ptr), (size)) |
#define | GLOB_FREE(ptr) free(ptr) |
#define | GLOB_JUMP_TAG(status) (((status) == -1) ? rb_memerror() : rb_jump_tag(status)) |
#define | STAT(p, s) stat((p), (s)) |
#define | do_lstat do_stat |
#define | S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) |
#define | S_ISLNK(m) (0) |
#define | glob_call_func(func, path, arg, enc) (*(func))((path), (arg), (void *)(enc)) |
Enumerations | |
enum | rb_pathtype_t { path_exist, path_directory = IFTODT(S_IFDIR), path_regular = IFTODT(S_IFREG), path_symlink = IFTODT(S_IFLNK), path_noent = -1, path_unknown = -2 } |
enum | glob_pattern_type { PLAIN, ALPHA, MAGICAL, RECURSIVE, MATCH_ALL, MATCH_DIR } |
Functions | |
char * | getenv () |
char * | strchr (char *, char) |
static char * | bracket (const char *p, const char *pend, const char *s, const char *send, int flags, rb_encoding *enc) |
static int | fnmatch_helper (const char **pcur, const char **scur, int flags, rb_encoding *enc) |
static int | fnmatch (const char *pattern, rb_encoding *enc, const char *string, int flags) |
static void | dir_mark (void *ptr) |
static void | dir_free (void *ptr) |
static size_t | dir_memsize (const void *ptr) |
static VALUE | dir_close (VALUE) |
static VALUE | dir_s_alloc (VALUE klass) |
static VALUE | dir_initialize (int argc, VALUE *argv, VALUE dir) |
static VALUE | dir_s_open (int argc, VALUE *argv, VALUE klass) |
static void | dir_closed (void) |
static struct dir_data * | dir_get (VALUE dir) |
static struct dir_data * | dir_check (VALUE dir) |
static VALUE | dir_inspect (VALUE dir) |
static VALUE | dir_path (VALUE dir) |
static int | to_be_skipped (const struct dirent *dp) |
static VALUE | dir_read (VALUE dir) |
static VALUE | dir_each (VALUE dir) |
static VALUE | dir_rewind (VALUE dir) |
static void | dir_chdir (VALUE path) |
static VALUE | chdir_yield (struct chdir_data *args) |
static VALUE | chdir_restore (struct chdir_data *args) |
static VALUE | dir_s_chdir (int argc, VALUE *argv, VALUE obj) |
VALUE | rb_dir_getwd (void) |
static VALUE | dir_s_getwd (VALUE dir) |
static VALUE | check_dirname (VALUE dir) |
static VALUE | dir_s_mkdir (int argc, VALUE *argv, VALUE obj) |
static VALUE | dir_s_rmdir (VALUE obj, VALUE dir) |
static VALUE | sys_warning_1 (VALUE mesg) |
static void | sys_enc_warning_in (const char *func, const char *mesg, rb_encoding *enc) |
ALWAYS_INLINE (static int to_be_ignored(int e)) | |
static int | to_be_ignored (int e) |
static int | do_stat (const char *path, struct stat *pst, int flags, rb_encoding *enc) |
static DIR * | do_opendir (const char *path, int flags, rb_encoding *enc) |
static enum glob_pattern_type | has_magic (const char *p, const char *pend, int flags, rb_encoding *enc) |
static char * | find_dirsep (const char *p, const char *pend, int flags, rb_encoding *enc) |
static char * | remove_backslashes (char *p, register const char *pend, rb_encoding *enc) |
static void | glob_free_pattern (struct glob_pattern *list) |
static struct glob_pattern * | glob_make_pattern (const char *p, const char *e, int flags, rb_encoding *enc) |
static char * | join_path (const char *path, long len, int dirsep, const char *name, size_t namlen) |
static VALUE | glob_func_caller (VALUE val) |
static int | dirent_match (const char *pat, rb_encoding *enc, const char *name, const struct dirent *dp, int flags) |
static int | glob_helper (const char *path, long pathlen, int dirsep, rb_pathtype_t pathtype, struct glob_pattern **beg, struct glob_pattern **end, int flags, ruby_glob_func *func, VALUE arg, rb_encoding *enc) |
static int | ruby_glob0 (const char *path, int flags, ruby_glob_func *func, VALUE arg, rb_encoding *enc) |
int | ruby_glob (const char *path, int flags, ruby_glob_func *func, VALUE arg) |
static int | rb_glob_caller (const char *path, VALUE a, void *enc) |
void | rb_glob (const char *path, void(*func)(const char *, VALUE, void *), VALUE arg) |
static void | push_pattern (const char *path, VALUE ary, void *enc) |
static int | ruby_brace_expand (const char *str, int flags, ruby_glob_func *func, VALUE arg, rb_encoding *enc) |
static int | glob_brace (const char *path, VALUE val, void *enc) |
int | ruby_brace_glob_with_enc (const char *str, int flags, ruby_glob_func *func, VALUE arg, rb_encoding *enc) |
int | ruby_brace_glob (const char *str, int flags, ruby_glob_func *func, VALUE arg) |
static int | push_caller (const char *path, VALUE val, void *enc) |
static int | push_glob (VALUE ary, VALUE str, int flags) |
static VALUE | rb_push_glob (VALUE str, int flags) |
static VALUE | dir_globs (long argc, const VALUE *argv, int flags) |
static VALUE | dir_s_aref (int argc, VALUE *argv, VALUE obj) |
static VALUE | dir_s_glob (int argc, VALUE *argv, VALUE obj) |
static VALUE | dir_open_dir (int argc, VALUE *argv) |
static VALUE | dir_foreach (int argc, VALUE *argv, VALUE io) |
static VALUE | dir_entries (int argc, VALUE *argv, VALUE io) |
static int | fnmatch_brace (const char *pattern, VALUE val, void *enc) |
static VALUE | file_s_fnmatch (int argc, VALUE *argv, VALUE obj) |
static VALUE | dir_s_home (int argc, VALUE *argv, VALUE obj) |
static VALUE | rb_dir_exists_p (VALUE obj, VALUE fname) |
static VALUE | rb_dir_s_empty_p (VALUE obj, VALUE dirname) |
void | Init_Dir (void) |
Variables | |
VALUE | rb_cDir |
static const rb_data_type_t | dir_data_type |
static int | chdir_blocking = 0 |
static VALUE | chdir_thread = Qnil |
#define check_glob_encoding | ( | str | ) | rb_enc_check((str), rb_enc_from_encoding(rb_usascii_encoding())) |
#define check_safe_glob | ( | str, | |
safe | |||
) | ((safe) ? rb_check_safe_obj(str) : (void)0) |
#define dir_fileno rb_f_notimplement |
Definition at line 670 of file dir.c.
Referenced by dir_inspect(), and Init_Dir().
#define dir_s_chroot rb_f_notimplement |
Definition at line 1129 of file dir.c.
Referenced by check_dirname(), and Init_Dir().
#define dir_seek rb_f_notimplement |
Definition at line 865 of file dir.c.
Referenced by Init_Dir().
#define dir_set_pos rb_f_notimplement |
Definition at line 890 of file dir.c.
Referenced by Init_Dir().
#define dir_tell rb_f_notimplement |
Definition at line 836 of file dir.c.
Referenced by dir_each(), and Init_Dir().
#define dirent direct |
Definition at line 32 of file dir.c.
Referenced by dir_each(), dir_read(), glob_helper(), and rb_dir_s_empty_p().
#define do_lstat do_stat |
Definition at line 1273 of file dir.c.
Referenced by do_stat(), and glob_helper().
#define FNM_CASEFOLD 0x08 |
Definition at line 181 of file dir.c.
Referenced by bracket(), fnmatch_helper(), glob_helper(), and Init_Dir().
#define FNM_DOTMATCH 0x04 |
Definition at line 180 of file dir.c.
Referenced by fnmatch(), fnmatch_helper(), glob_helper(), and Init_Dir().
#define FNM_EXTGLOB 0x10 |
Definition at line 182 of file dir.c.
Referenced by file_s_fnmatch(), and Init_Dir().
#define FNM_NOESCAPE 0x01 |
Definition at line 178 of file dir.c.
Referenced by bracket(), find_dirsep(), fnmatch_helper(), glob_helper(), has_magic(), Init_Dir(), and ruby_brace_expand().
#define FNM_NOMATCH 1 |
Definition at line 194 of file dir.c.
Referenced by fnmatch(), fnmatch_brace(), and fnmatch_helper().
#define FNM_PATHNAME 0x02 |
Definition at line 179 of file dir.c.
Referenced by fnmatch(), fnmatch_helper(), and Init_Dir().
#define FNM_SHORTNAME 0 |
Definition at line 191 of file dir.c.
Referenced by dirent_match(), and Init_Dir().
#define FNM_SYSCASE 0 |
Definition at line 186 of file dir.c.
Referenced by glob_make_pattern(), Init_Dir(), and ruby_glob0().
#define GetDIR | ( | obj, | |
dirp | |||
) | ((dirp) = dir_check(obj)) |
Definition at line 603 of file dir.c.
Referenced by dir_each(), dir_inspect(), dir_read(), and dir_rewind().
#define GLOB_ALLOC | ( | type | ) | ((type *)malloc(sizeof(type))) |
Definition at line 1226 of file dir.c.
Referenced by glob_make_pattern().
#define GLOB_ALLOC_N | ( | type, | |
n | |||
) | ((type *)malloc(sizeof(type) * (n))) |
Definition at line 1227 of file dir.c.
Referenced by glob_helper(), glob_make_pattern(), join_path(), ruby_brace_expand(), and ruby_glob0().
Definition at line 1697 of file dir.c.
Referenced by glob_func_caller(), glob_helper(), and ruby_brace_expand().
#define GLOB_FREE | ( | ptr | ) | free(ptr) |
Definition at line 1229 of file dir.c.
Referenced by glob_free_pattern(), glob_helper(), glob_make_pattern(), join_path(), ruby_brace_expand(), and ruby_glob0().
#define GLOB_JUMP_TAG | ( | status | ) | (((status) == -1) ? rb_memerror() : rb_jump_tag(status)) |
Definition at line 1230 of file dir.c.
Referenced by dir_globs(), rb_glob(), and rb_push_glob().
Definition at line 1228 of file dir.c.
Referenced by join_path().
#define GLOB_VERBOSE (1U << (sizeof(int) * CHAR_BIT - 1)) |
Definition at line 1222 of file dir.c.
Referenced by push_glob(), rb_glob(), ruby_brace_glob_with_enc(), and ruby_glob().
#define GlobPathValue | ( | str, | |
safe | |||
) |
Definition at line 459 of file dir.c.
Referenced by dir_globs(), dir_initialize(), rb_dir_s_empty_p(), and rb_push_glob().
#define IF_NORMALIZE_UTF8PATH | ( | something | ) | /* nothing */ |
Definition at line 155 of file dir.c.
Referenced by dir_each(), glob_helper(), and join_path().
#define IFTODT | ( | m | ) | (((m) & S_IFMT) / ((~S_IFMT & S_IFMT-1) + 1)) |
Definition at line 159 of file dir.c.
Referenced by glob_helper().
#define Inc | ( | p, | |
e, | |||
enc | |||
) | ((p) = Next((p), (e), (enc))) |
Definition at line 198 of file dir.c.
Referenced by fnmatch(), fnmatch_helper(), remove_backslashes(), and ruby_brace_expand().
#define IS_WIN32 0 |
Definition at line 79 of file dir.c.
Referenced by has_magic().
#define ISEND | ( | p | ) | (!*(p) || (pathname && *(p) == '/')) |
Definition at line 275 of file dir.c.
Referenced by fnmatch_helper().
Definition at line 33 of file dir.c.
Referenced by dir_each(), dir_read(), glob_helper(), and to_be_skipped().
#define Next | ( | p, | |
e, | |||
enc | |||
) | ((p)+ rb_enc_mbclen((p), (e), (enc))) |
Definition at line 197 of file dir.c.
Referenced by find_dirsep(), has_magic(), and sock_s_unpack_sockaddr_in().
#define READDIR | ( | dir, | |
enc | |||
) | readdir((dir)) |
Definition at line 708 of file dir.c.
Referenced by dir_each(), dir_read(), glob_helper(), and rb_dir_s_empty_p().
Definition at line 276 of file dir.c.
Referenced by fnmatch_helper(), get_event_id(), and symbol2event_flag().
#define S_ISLNK | ( | m | ) | (0) |
Definition at line 1684 of file dir.c.
Referenced by rb_file_expand_path_internal(), rb_file_ftype(), rb_file_symlink_p(), rb_stat_l(), and realpath_rec().
#define STAT | ( | p, | |
s | |||
) | stat((p), (s)) |
#define sys_enc_warning_in | ( | func, | |
mesg, | |||
enc | |||
) | sys_enc_warning(mesg, enc) |
#define sys_warning | ( | val, | |
enc | |||
) | ((flags & GLOB_VERBOSE) ? sys_enc_warning_in(RUBY_FUNCTION_NAME_STRING, (val), (enc)) :(void)0) |
Definition at line 1223 of file dir.c.
Referenced by do_opendir(), do_stat(), and join_path().
#define UNESCAPE | ( | p | ) | (escape && *(p) == '\\' ? (p) + 1 : (p)) |
Definition at line 274 of file dir.c.
Referenced by fnmatch_helper().
#define USE_NAME_ON_FS 0 |
Definition at line 100 of file dir.c.
Referenced by glob_make_pattern().
#define USE_NAME_ON_FS_BY_FNMATCH |
#define USE_NAME_ON_FS_REAL_BASENAME |
enum glob_pattern_type |
enum rb_pathtype_t |
ALWAYS_INLINE | ( | static int | to_be_ignoredint e | ) |
|
static |
Definition at line 201 of file dir.c.
References FNM_CASEFOLD, FNM_NOESCAPE, memcmp(), NULL, r2, rb_enc_codepoint, rb_enc_mbclen(), and rb_enc_toupper().
Referenced by fnmatch_helper().
|
static |
Definition at line 964 of file dir.c.
References chdir_blocking, chdir_thread, dir_chdir(), chdir_data::done, chdir_data::old_path, and Qnil.
Referenced by dir_s_chdir().
|
static |
Definition at line 953 of file dir.c.
References chdir_blocking, chdir_thread, dir_chdir(), chdir_data::done, chdir_data::new_path, Qnil, rb_thread_current(), rb_yield(), and TRUE.
Referenced by dir_s_chdir().
Definition at line 1090 of file dir.c.
References dir_data::dir, dir_s_chroot, dir_data::enc, FilePathValue, INT2FIX, len, dir_data::path, rb_enc_get(), rb_enc_path_end(), rb_enc_path_skip_prefix(), rb_str_encode_ospath(), rb_str_subseq(), rb_sys_fail_path, RSTRING_GETMEM, RSTRING_PTR, and StringValueCStr.
Referenced by dir_s_mkdir(), and dir_s_rmdir().
|
static |
Definition at line 938 of file dir.c.
References rb_sys_fail_path, and RSTRING_PTR.
Referenced by chdir_restore(), chdir_yield(), and dir_s_chdir().
Definition at line 596 of file dir.c.
References dir_data::dir, dir_closed(), and dir_get().
Definition at line 925 of file dir.c.
References closedir, dir_data::dir, dir_get(), NULL, and Qnil.
Referenced by dir_entries(), dir_foreach(), dir_s_open(), and Init_Dir().
|
static |
Definition at line 583 of file dir.c.
References rb_eIOError, and rb_raise().
Referenced by dir_check(), and dir_each().
Definition at line 783 of file dir.c.
References dir_data::dir, dir_closed(), dir_tell, dirent, dp, dir_data::enc, GetDIR, IF_NORMALIZE_UTF8PATH, name, NAMLEN, NIL_P, NULL, dir_data::path, rb_external_str_new_with_enc(), rb_external_str_with_enc(), rb_int2inum(), rb_yield(), READDIR, RETURN_ENUMERATOR, rewinddir(), RSTRING_PTR, and telldir().
Referenced by dir_foreach(), and Init_Dir().
Definition at line 2440 of file dir.c.
References dir_data::dir, dir_close(), dir_open_dir(), rb_Array(), and rb_ensure().
Referenced by Init_Dir().
Definition at line 2414 of file dir.c.
References dir_data::dir, dir_close(), dir_each(), dir_open_dir(), Qnil, rb_ensure(), and RETURN_ENUMERATOR.
Referenced by Init_Dir().
|
static |
Definition at line 436 of file dir.c.
References closedir, dir_data::dir, and xfree().
Definition at line 589 of file dir.c.
References rb_check_frozen, and rb_check_typeddata().
Referenced by dir_check(), and dir_close().
Definition at line 2245 of file dir.c.
References argc, GLOB_JUMP_TAG, GlobPathValue, push_glob(), rb_ary_new(), and TRUE.
Referenced by dir_s_aref(), and dir_s_glob().
Definition at line 492 of file dir.c.
References closedir, dir_data::dir, dp, dir_data::enc, errno, FALSE, GlobPathValue, NIL_P, NULL, opendir, dir_data::path, Qnil, Qundef, rb_filesystem_encoding(), rb_gc_for_fd(), RB_GC_GUARD, rb_get_kwargs(), rb_id_encoding(), rb_scan_args(), rb_str_dup_frozen(), rb_str_encode_ospath(), rb_syserr_fail_path, rb_to_encoding(), RSTRING_PTR, and TypedData_Get_Struct.
Referenced by dir_s_open(), and Init_Dir().
Definition at line 613 of file dir.c.
References CLASS_OF, dir_data::dir, dir_fileno, GetDIR, INT2NUM, NIL_P, dir_data::path, rb_class_name(), rb_funcallv, rb_intern, rb_str_append(), rb_str_cat2(), rb_str_new_cstr(), rb_sys_fail(), and TypedData_Get_Struct.
Referenced by Init_Dir().
|
static |
Definition at line 429 of file dir.c.
References dir_data::dir, dir_data::path, and rb_gc_mark().
Definition at line 2382 of file dir.c.
References dir_data::dir, rb_cDir, rb_check_typeddata(), rb_funcallv, and rb_intern.
Referenced by dir_entries(), and dir_foreach().
Definition at line 684 of file dir.c.
References dir_data::enc, ENCINDEX_ASCII, ENCINDEX_US_ASCII, ENCINDEX_UTF_8, FALSE, NIL_P, dir_data::path, Qnil, rb_enc_to_index(), rb_str_dup(), TRUE, and TypedData_Get_Struct.
Referenced by Init_Dir().
Definition at line 745 of file dir.c.
References dir_data::dir, dirent, dp, dir_data::enc, errno, GetDIR, NAMLEN, NULL, Qnil, rb_external_str_new_with_enc(), rb_syserr_fail(), and READDIR.
Referenced by Init_Dir().
Definition at line 905 of file dir.c.
References dir_data::dir, GetDIR, and rewinddir().
Referenced by Init_Dir().
Definition at line 469 of file dir.c.
References dir_data::dir, dir_data::enc, NULL, dir_data::path, Qnil, and TypedData_Make_Struct.
Referenced by Init_Dir().
Definition at line 2270 of file dir.c.
References dir_globs(), and rb_push_glob().
Referenced by Init_Dir().
Definition at line 1015 of file dir.c.
References chdir_blocking, chdir_restore(), chdir_thread, chdir_yield(), dir_chdir(), chdir_data::done, FALSE, FilePathValue, getenv(), INT2FIX, chdir_data::new_path, chdir_data::old_path, dir_data::path, Qnil, rb_block_given_p(), rb_dir_getwd(), rb_eArgError, rb_ensure(), rb_raise(), rb_scan_args(), rb_str_encode_ospath(), rb_str_new2, rb_thread_current(), and rb_warn().
Referenced by Init_Dir().
Definition at line 2354 of file dir.c.
References dir_globs(), push_glob_args::flags, NIL_P, NUM2INT, Qnil, RARRAY_CONST_PTR, RARRAY_LEN, rb_ary_each(), rb_block_given_p(), rb_check_array_type(), RB_GC_GUARD, rb_push_glob(), and rb_scan_args().
Referenced by Init_Dir().
Definition at line 2611 of file dir.c.
References NIL_P, Qnil, rb_check_arity, rb_default_home_dir(), rb_file_directory_p(), rb_home_dir_of(), rb_must_asciicompat(), rb_str_new(), SafeStringValue, and StringValueCStr.
Referenced by Init_Dir().
Definition at line 1148 of file dir.c.
References check_dirname(), INT2FIX, NUM2INT, dir_data::path, rb_scan_args(), rb_sys_fail_path, and RSTRING_PTR.
Referenced by Init_Dir().
Definition at line 569 of file dir.c.
References dir_data::dir, dir_close(), dir_initialize(), dp, rb_block_given_p(), rb_ensure(), rb_yield(), and TypedData_Make_Struct.
Referenced by Init_Dir().
Definition at line 1177 of file dir.c.
References check_dirname(), INT2FIX, rb_sys_fail_path, and RSTRING_PTR.
Referenced by Init_Dir().
|
inlinestatic |
Definition at line 1709 of file dir.c.
References FNM_SHORTNAME, and fnmatch().
Referenced by glob_helper().
|
static |
Definition at line 1277 of file dir.c.
References errno, opendir, rb_enc_str_new(), rb_gc_for_fd(), rb_str_encode_ospath(), rb_str_resize(), RSTRING_PTR, strlen(), sys_warning, and to_be_ignored().
Referenced by glob_helper().
|
static |
Definition at line 1253 of file dir.c.
References do_lstat, errno, lstat(), dir_data::path, stat, STAT, sys_warning, and to_be_ignored().
Referenced by glob_helper().
Definition at line 2568 of file dir.c.
References FilePathStringValue, brace_args::flags, FNM_EXTGLOB, fnmatch(), fnmatch_brace(), NUM2INT, dir_data::path, Qfalse, Qtrue, rb_enc_compatible(), rb_enc_get(), RB_GC_GUARD, rb_scan_args(), RSTRING_PTR, ruby_brace_expand(), StringValue, and brace_args::value.
Referenced by Init_Dir().
|
static |
Definition at line 1356 of file dir.c.
References FNM_NOESCAPE, and Next.
Referenced by glob_make_pattern().
|
static |
Definition at line 371 of file dir.c.
References FNM_DOTMATCH, FNM_NOMATCH, FNM_PATHNAME, fnmatch_helper(), Inc, and strlen().
Referenced by dirent_match(), file_s_fnmatch(), fnmatch_brace(), and glob_helper().
Definition at line 2449 of file dir.c.
References dir_data::enc, ENC_CODERANGE_7BIT, brace_args::flags, FNM_NOMATCH, fnmatch(), len, rb_enc_asciicompat, rb_enc_get(), rb_enc_str_asciionly_p(), rb_str_coderange_scan_restartable(), RSTRING_PTR, strlen(), and brace_args::value.
Referenced by file_s_fnmatch().
|
static |
Definition at line 279 of file dir.c.
References bracket(), FNM_CASEFOLD, FNM_DOTMATCH, FNM_NOESCAPE, FNM_NOMATCH, FNM_PATHNAME, Inc, ISEND, MBCLEN_CHARFOUND_P, memcmp(), rb_enc_codepoint, rb_enc_precise_mbclen(), rb_enc_toupper(), RETURN, strlen(), and UNESCAPE.
Referenced by fnmatch().
char* getenv | ( | ) |
Referenced by dir_s_chdir().
Definition at line 2152 of file dir.c.
References brace_args::flags, brace_args::func, ruby_glob0(), and brace_args::value.
Referenced by ruby_brace_glob_with_enc().
|
static |
Definition at line 1492 of file dir.c.
References GLOB_FREE, list, glob_pattern::next, and glob_pattern::str.
Referenced by glob_make_pattern(), and ruby_glob0().
Definition at line 1700 of file dir.c.
References glob_args::enc, glob_args::func, glob_call_func, glob_args::path, Qnil, and glob_args::value.
Referenced by rb_glob_caller().
|
static |
Definition at line 1721 of file dir.c.
References ALPHA, buf, closedir, dirent, dirent_match(), do_lstat, do_opendir(), do_stat(), dp, DT_UNKNOWN, errno, FNM_CASEFOLD, FNM_DOTMATCH, FNM_NOESCAPE, fnmatch(), GLOB_ALLOC_N, glob_call_func, GLOB_FREE, IF_NORMALIZE_UTF8PATH, IFTODT, join_path(), len, MAGICAL, MATCH_ALL, MATCH_DIR, memcpy, name, NAMLEN, glob_pattern::next, NIL_P, NULL, path_directory, path_exist, path_noent, path_unknown, PLAIN, Qnil, rb_bug(), rb_str_resize(), READDIR, RECURSIVE, remove_backslashes(), RSTRING_GETMEM, stat, glob_pattern::str, strlen(), and glob_pattern::type.
Referenced by ruby_glob0().
|
static |
Definition at line 1424 of file dir.c.
References ALPHA, buf, find_dirsep(), FNM_SYSCASE, GLOB_ALLOC, GLOB_ALLOC_N, GLOB_FREE, glob_free_pattern(), has_magic(), list, MAGICAL, MATCH_ALL, MATCH_DIR, memcpy, glob_pattern::next, PLAIN, RECURSIVE, glob_pattern::str, glob_pattern::type, and USE_NAME_ON_FS.
Referenced by ruby_glob0().
|
static |
Definition at line 1314 of file dir.c.
References ALPHA, FNM_NOESCAPE, IS_WIN32, ISALPHA, MAGICAL, Next, and PLAIN.
Referenced by glob_make_pattern().
void Init_Dir | ( | void | ) |
Definition at line 2736 of file dir.c.
References dir_close(), dir_each(), dir_entries(), dir_fileno, dir_foreach(), dir_initialize(), dir_inspect(), dir_path(), dir_read(), dir_rewind(), dir_s_alloc(), dir_s_aref(), dir_s_chdir(), dir_s_chroot, dir_s_getwd(), dir_s_glob(), dir_s_home(), dir_s_mkdir(), dir_s_open(), dir_s_rmdir(), dir_seek, dir_set_pos, dir_tell, file_s_fnmatch(), FNM_CASEFOLD, FNM_DOTMATCH, FNM_EXTGLOB, FNM_NOESCAPE, FNM_PATHNAME, FNM_SHORTNAME, FNM_SYSCASE, INT2FIX, rb_cDir, rb_cFile, rb_cObject, rb_define_alloc_func(), rb_define_class(), rb_define_method(), rb_define_singleton_method(), rb_dir_exists_p(), rb_dir_s_empty_p(), rb_file_const(), rb_file_directory_p(), rb_include_module(), and rb_mEnumerable.
|
static |
Definition at line 1504 of file dir.c.
References buf, errno, free(), GLOB_ALLOC_N, GLOB_FREE, GLOB_REALLOC, IF_NORMALIZE_UTF8PATH, len, MAXPATHLEN, memcpy, name, NIL_P, NULL, dir_data::path, path_directory, path_exist, path_noent, path_regular, path_symlink, Qnil, rb_enc_str_new_cstr(), rb_str_encode_ospath(), rb_str_resize(), rb_w32_conv_from_wchar(), rb_w32_map_errno(), rb_w32_mbstr_to_wstr(), rb_w32_reparse_symlink_p(), RSTRING_GETMEM, RSTRING_LEN, RSTRING_PTR, sys_warning, and to_be_ignored().
Referenced by glob_helper().
Definition at line 2183 of file dir.c.
References push_glob_args::flags, push_glob_args::glob, rb_glob_caller(), and ruby_glob0().
Referenced by push_glob().
Definition at line 2191 of file dir.c.
References dir_data::enc, glob_args::enc, ENCINDEX_US_ASCII, push_glob_args::flags, glob_args::func, push_glob_args::glob, GLOB_VERBOSE, push_caller(), push_pattern(), rb_ascii8bit_encoding(), rb_enc_get(), rb_enc_to_index(), rb_filesystem_encoding(), RB_GC_GUARD, rb_str_encode_ospath(), rb_utf8_encoding(), RSTRING_PTR, ruby_brace_expand(), and glob_args::value.
Referenced by dir_globs(), and rb_push_glob().
Definition at line 2073 of file dir.c.
References name, NULL, OBJ_TAINT, rb_ary_push(), rb_default_internal_encoding(), rb_external_str_new_with_enc(), rb_str_conv_enc(), rb_utf8_str_new_cstr(), and strlen().
Referenced by push_glob().
Definition at line 2652 of file dir.c.
References rb_file_directory_p(), and rb_warning().
Referenced by Init_Dir().
VALUE rb_dir_getwd | ( | void | ) |
Definition at line 1051 of file dir.c.
References ENCINDEX_ASCII, ENCINDEX_US_ASCII, my_getcwd, OBJ_TAINT, dir_data::path, rb_enc_associate_index(), rb_enc_to_index(), rb_filesystem_encoding(), rb_tainted_str_new2, strlen(), and xfree().
Referenced by dir_s_chdir(), dir_s_getwd(), and rb_realpath_internal().
Definition at line 2666 of file dir.c.
References closedir, dir_data::dir, dirent, dp, errno, FALSE, GlobPathValue, NULL, opendir, dir_data::path, Qfalse, Qtrue, rb_gc_for_fd(), rb_str_dup_frozen(), rb_str_encode_ospath(), rb_sys_fail_path, rb_syserr_fail_path, READDIR, result, RSTRING_PTR, and to_be_skipped().
Referenced by Init_Dir().
Definition at line 2058 of file dir.c.
References glob_args::enc, func, glob_args::func, GLOB_JUMP_TAG, GLOB_VERBOSE, rb_ascii8bit_encoding(), rb_glob_caller(), ruby_glob0(), and glob_args::value.
Definition at line 2047 of file dir.c.
References glob_func_caller(), dir_data::path, glob_args::path, and rb_protect().
Referenced by push_caller(), and rb_glob().
Definition at line 2218 of file dir.c.
References GLOB_JUMP_TAG, GlobPathValue, push_glob(), rb_ary_new(), rb_enc_get(), rb_enc_str_new(), RSTRING_LEN, RSTRING_PTR, strlen(), and TRUE.
Referenced by dir_s_aref(), and dir_s_glob().
|
static |
|
static |
Definition at line 2087 of file dir.c.
References buf, FNM_NOESCAPE, GLOB_ALLOC_N, glob_call_func, GLOB_FREE, Inc, len, memcpy, shift(), strlcpy(), and strlen().
Referenced by file_s_fnmatch(), push_glob(), and ruby_brace_glob_with_enc().
int ruby_brace_glob | ( | const char * | str, |
int | flags, | ||
ruby_glob_func * | func, | ||
VALUE | arg | ||
) |
Definition at line 2172 of file dir.c.
References rb_ascii8bit_encoding(), and ruby_brace_glob_with_enc().
int ruby_brace_glob_with_enc | ( | const char * | str, |
int | flags, | ||
ruby_glob_func * | func, | ||
VALUE | arg, | ||
rb_encoding * | enc | ||
) |
Definition at line 2160 of file dir.c.
References brace_args::flags, func, brace_args::func, glob_brace(), GLOB_VERBOSE, ruby_brace_expand(), and brace_args::value.
Referenced by cmdglob(), and ruby_brace_glob().
int ruby_glob | ( | const char * | path, |
int | flags, | ||
ruby_glob_func * | func, | ||
VALUE | arg | ||
) |
Definition at line 2040 of file dir.c.
References GLOB_VERBOSE, rb_ascii8bit_encoding(), and ruby_glob0().
|
static |
Definition at line 2004 of file dir.c.
References buf, FNM_SYSCASE, GLOB_ALLOC_N, GLOB_FREE, glob_free_pattern(), glob_helper(), glob_make_pattern(), list, MEMCPY, dir_data::path, path_unknown, rb_enc_path_skip_prefix(), and strlen().
Referenced by glob_brace(), push_caller(), rb_glob(), and ruby_glob().
char* strchr | ( | char * | , |
char | |||
) |
Referenced by bug_important_message(), check_exec_env_i(), date__strptime_internal(), date_strftime_with_tmx(), dln_find_1(), env_each_pair(), env_has_value(), env_inspect(), env_key(), env_keys(), env_rassoc(), env_shift(), env_to_a(), env_to_hash(), env_values(), envix(), getnameinfo(), loaded_feature_path(), nl_langinfo_codeset(), num_pattern_p(), out_of_range_float(), pack_pack(), pack_unpack_internal(), parse_ddd_cb(), process_sflag(), rb_env_size(), rb_exec_fillarg(), rb_f_test(), rb_feature_provided(), rb_file_open_internal(), rb_io_extract_modeenc(), rb_io_modestr_fmode(), rb_path_check(), rb_strftime_with_timespec(), ruby_scan_hex(), ruby_strtod(), search_required(), str2num(), w32_aspawn_flags(), and w32_spawn().
|
static |
Definition at line 1211 of file dir.c.
References dir_data::enc, warning_args::enc, func, warning_args::mesg, rb_protect(), and sys_warning_1().
Definition at line 1199 of file dir.c.
References warning_args::enc, warning_args::mesg, Qnil, and rb_sys_enc_warning().
Referenced by sys_enc_warning_in().
|
inlinestatic |
Definition at line 1238 of file dir.c.
Referenced by do_opendir(), do_stat(), and join_path().
|
static |
Definition at line 944 of file dir.c.
Referenced by chdir_restore(), chdir_yield(), and dir_s_chdir().
Definition at line 945 of file dir.c.
Referenced by chdir_restore(), chdir_yield(), and dir_s_chdir().
|
static |
VALUE rb_cDir |
Definition at line 420 of file dir.c.
Referenced by dir_open_dir(), Init_Dir(), path_each_entry(), path_empty_p(), path_entries(), path_mkdir(), path_opendir(), path_rmdir(), path_s_getwd(), path_s_glob(), and unlink_body().