Ruby  3.1.0dev(2021-09-10revisionb76ad15ed0da636161de0243c547ee1e6fc95681)
Data Structures | Macros | Functions
file.c File Reference

(b76ad15ed0da636161de0243c547ee1e6fc95681)

#include "ruby/ruby.h"
#include "ruby/encoding.h"
#include "internal.h"
#include "internal/error.h"
#include <winbase.h>
#include <wchar.h>
#include <shlwapi.h>
#include "win32/file.h"
Include dependency graph for file.c:

Go to the source code of this file.

Data Structures

struct  code_page_table
 

Macros

#define INVALID_FILE_ATTRIBUTES   ((DWORD)-1)
 
#define IS_DIR_SEPARATOR_P(c)   (c == L'\\' || c == L'/')
 
#define IS_DIR_UNC_P(c)   (IS_DIR_SEPARATOR_P(c[0]) && IS_DIR_SEPARATOR_P(c[1]))
 
#define INVALID_CODE_PAGE   51932
 
#define PATH_BUFFER_SIZE   MAX_PATH * 2
 
#define system_code_page   rb_w32_filecp
 
#define mbstr_to_wstr   rb_w32_mbstr_to_wstr
 
#define wstr_to_mbstr   rb_w32_wstr_to_mbstr
 
#define fix_string_encoding(str, encoding)   rb_str_conv_enc((str), (encoding), rb_utf8_encoding())
 

Functions

void rb_enc_foreach_name (int(*func)(st_data_t name, st_data_t idx, st_data_t arg), st_data_t arg)
 
VALUE rb_default_home_dir (VALUE result)
 
VALUE rb_file_expand_path_internal (VALUE fname, VALUE dname, int abs_mode, int long_name, VALUE result)
 
VALUE rb_readlink (VALUE path, rb_encoding *resultenc)
 
int rb_file_load_ok (const char *path)
 
int rb_freopen (VALUE fname, const char *mode, FILE *file)
 
void Init_w32_codepage (void)
 

Macro Definition Documentation

◆ fix_string_encoding

#define fix_string_encoding (   str,
  encoding 
)    rb_str_conv_enc((str), (encoding), rb_utf8_encoding())

Definition at line 143 of file file.c.

◆ INVALID_CODE_PAGE

#define INVALID_CODE_PAGE   51932

Definition at line 37 of file file.c.

◆ INVALID_FILE_ATTRIBUTES

#define INVALID_FILE_ATTRIBUTES   ((DWORD)-1)

Definition at line 15 of file file.c.

◆ IS_DIR_SEPARATOR_P

#define IS_DIR_SEPARATOR_P (   c)    (c == L'\\' || c == L'/')

Definition at line 24 of file file.c.

◆ IS_DIR_UNC_P

#define IS_DIR_UNC_P (   c)    (IS_DIR_SEPARATOR_P(c[0]) && IS_DIR_SEPARATOR_P(c[1]))

Definition at line 25 of file file.c.

◆ mbstr_to_wstr

#define mbstr_to_wstr   rb_w32_mbstr_to_wstr

Definition at line 42 of file file.c.

◆ PATH_BUFFER_SIZE

#define PATH_BUFFER_SIZE   MAX_PATH * 2

Definition at line 38 of file file.c.

◆ system_code_page

#define system_code_page   rb_w32_filecp

Definition at line 41 of file file.c.

◆ wstr_to_mbstr

#define wstr_to_mbstr   rb_w32_wstr_to_mbstr

Definition at line 43 of file file.c.

Function Documentation

◆ Init_w32_codepage()

void Init_w32_codepage ( void  )

Definition at line 699 of file file.c.

◆ rb_default_home_dir()

VALUE rb_default_home_dir ( VALUE  result)

Definition at line 262 of file file.c.

◆ rb_enc_foreach_name()

void rb_enc_foreach_name ( int(*)(st_data_t name, st_data_t idx, st_data_t arg)  func,
st_data_t  arg 
)

Definition at line 2210 of file encoding.c.

References GLOBAL_ENC_TABLE_EVAL, and st_foreach().

◆ rb_file_expand_path_internal()

VALUE rb_file_expand_path_internal ( VALUE  fname,
VALUE  dname,
int  abs_mode,
int  long_name,
VALUE  result 
)

Definition at line 275 of file file.c.

◆ rb_file_load_ok()

int rb_file_load_ok ( const char *  path)

◆ rb_freopen()

int rb_freopen ( VALUE  fname,
const char *  mode,
FILE file 
)

Definition at line 670 of file file.c.

References ALLOCV_END, ALLOCV_N, len, name, NULL, numberof, RB_GC_GUARD, rb_long2int, and RSTRING_GETMEM.

◆ rb_readlink()

VALUE rb_readlink ( VALUE  path,
rb_encoding resultenc 
)

Definition at line 595 of file file.c.

References FilePathValue, len, rb_enc_get(), rb_encoding, rp, and str.