|
Ruby 3.0.5p211 (2022-11-24 revision ba5cf0f7c52d4d35cc6a173c89eda98ceffa2dcf)
|
#include "ruby/internal/config.h"#include <ctype.h>#include <errno.h>#include <sys/types.h>#include <sys/stat.h>#include "encindex.h"#include "id.h"#include "internal.h"#include "internal/array.h"#include "internal/dir.h"#include "internal/encoding.h"#include "internal/error.h"#include "internal/file.h"#include "internal/gc.h"#include "internal/io.h"#include "internal/vm.h"#include "ruby/encoding.h"#include "ruby/ruby.h"#include "ruby/thread.h"#include "ruby/util.h"#include "builtin.h"#include "dir.rbinc"Go to the source code of this file.
Data Structures | |
| struct | dir_data |
| struct | chdir_data |
| struct | mkdir_arg |
| struct | warning_args |
| struct | ruby_glob_funcs_t |
| struct | opendir_at_arg |
| struct | glob_pattern |
| struct | glob_args |
| struct | glob_error_args |
| struct | rb_dirent |
| struct | push_glob_args |
| struct | dirent_brace_args |
| union | ruby_glob_entries_t |
| struct | push_glob0_args |
| struct | brace_args |
Macros | |
| #define | O_CLOEXEC 0 |
| #define | USE_OPENDIR_AT 0 |
| #define | dirent direct |
| #define | NAMLEN(dirent) (dirent)->d_namlen |
| #define | HAVE_DIRENT_NAMLEN 1 |
| #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 | AT_FDCWD -1 |
| #define | vm_initialized rb_cThread |
| #define | IS_WIN32 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_GLOB_NOSORT 0x40 |
| #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 | 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 | RUBY_UNTYPED_DATA_WARNING 0 |
| #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 *)glob_alloc_n(sizeof(type), n)) |
| #define | GLOB_REALLOC(ptr, size) realloc((ptr), (size)) |
| #define | GLOB_REALLOC_N(ptr, n) glob_realloc_n(ptr, sizeof(*(ptr)), n) |
| #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)) |
Typedefs | |
| typedef int | ruby_glob_errfunc(const char *, VALUE, const void *, int) |
| typedef struct rb_dirent | rb_dirent_t |
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 , BRACE , MAGICAL , RECURSIVE , MATCH_ALL , MATCH_DIR } |
Functions | |
| char * | getenv () |
| char * | strchr (char *, char) |
| VALUE | rb_dir_getwd_ospath (void) |
| VALUE | rb_dir_getwd (void) |
| int | ruby_glob (const char *path, int flags, ruby_glob_func *func, VALUE arg) |
| void | rb_glob (const char *path, void(*func)(const char *, VALUE, void *), VALUE arg) |
| 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) |
| void | Init_Dir (void) |
Variables | |
| VALUE | rb_cDir |
| #define dir_fileno rb_f_notimplement |
| #define dir_s_chroot rb_f_notimplement |
| #define dir_seek rb_f_notimplement |
| #define dir_set_pos rb_f_notimplement |
| #define dir_tell rb_f_notimplement |
| #define GLOB_ALLOC_N | ( | type, | |
| n | |||
| ) | ((type *)glob_alloc_n(sizeof(type), n)) |
| #define glob_call_func | ( | func, | |
| path, | |||
| arg, | |||
| enc | |||
| ) | (*(func))((path), (arg), (void *)(enc)) |
| #define GLOB_JUMP_TAG | ( | status | ) | (((status) == -1) ? rb_memerror() : rb_jump_tag(status)) |
| #define IFTODT | ( | m | ) | (((m) & S_IFMT) / ((~S_IFMT & (S_IFMT-1)) + 1)) |
| #define Next | ( | p, | |
| e, | |||
| enc | |||
| ) | ((p)+ rb_enc_mbclen((p), (e), (enc))) |
| #define RUBY_UNTYPED_DATA_WARNING 0 |
| #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) |
| #define UNESCAPE | ( | p | ) | (escape && *(p) == '\\' ? (p) + 1 : (p)) |
| #define USE_NAME_ON_FS_BY_FNMATCH |
| #define USE_NAME_ON_FS_REAL_BASENAME |
| #define vm_initialized rb_cThread |
| typedef struct rb_dirent rb_dirent_t |
| enum glob_pattern_type |
| enum rb_pathtype_t |
| char * getenv | ( | ) |
| void Init_Dir | ( | void | ) |
Definition at line 3445 of file dir.c.
References dir_fileno, dir_s_chroot, dir_seek, dir_set_pos, dir_tell, 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_file_const(), rb_file_directory_p(), rb_include_module(), and rb_mEnumerable.
| VALUE rb_dir_getwd | ( | void | ) |
Definition at line 1116 of file dir.c.
References ENCINDEX_ASCII, ENCINDEX_US_ASCII, NULL, rb_dir_getwd_ospath(), rb_enc_associate_index(), rb_enc_to_index(), rb_filesystem_encoding(), and rb_str_conv_enc().
| VALUE rb_dir_getwd_ospath | ( | void | ) |
Definition at line 1092 of file dir.c.
References DATA_PTR, Data_Wrap_Struct, NULL, rb_str_new2, RUBY_DEFAULT_FREE, ruby_getcwd(), strlen(), and xfree.
Referenced by rb_dir_getwd(), rb_execarg_run_options(), and rb_get_expanded_load_path().
Definition at line 2711 of file dir.c.
References AT_FDCWD, glob_args::enc, glob_args::func, GLOB_JUMP_TAG, GLOB_VERBOSE, glob_args::path, rb_ascii8bit_encoding(), and glob_args::value.
| int ruby_brace_glob | ( | const char * | str, |
| int | flags, | ||
| ruby_glob_func * | func, | ||
| VALUE | arg | ||
| ) |
Definition at line 2826 of file dir.c.
References brace_args::flags, rb_ascii8bit_encoding(), ruby_brace_glob_with_enc(), and str.
| int ruby_brace_glob_with_enc | ( | const char * | str, |
| int | flags, | ||
| ruby_glob_func * | func, | ||
| VALUE | arg, | ||
| rb_encoding * | enc | ||
| ) |
Definition at line 2813 of file dir.c.
References ruby_glob_funcs_t::error, brace_args::flags, brace_args::funcs, ruby_glob_funcs_t::match, Qfalse, str, and brace_args::value.
Referenced by ruby_brace_glob().
| int ruby_glob | ( | const char * | path, |
| int | flags, | ||
| ruby_glob_func * | func, | ||
| VALUE | arg | ||
| ) |
Definition at line 2686 of file dir.c.
References push_glob0_args::arg, AT_FDCWD, ruby_glob_funcs_t::error, push_glob0_args::flags, push_glob0_args::funcs, GLOB_VERBOSE, ruby_glob_funcs_t::match, and rb_ascii8bit_encoding().
| char * strchr | ( | char * | , |
| char | |||
| ) |
| VALUE rb_cDir |
Definition at line 450 of file dir.c.
Referenced by Init_Dir().