Unverified Commit ce12ef7e authored by dearblue's avatar dearblue Committed by Yukihiro "Matz" Matsumoto

Hiding method implementation C functions in mruby-io

parent 8bca11a6
...@@ -89,7 +89,7 @@ flock(int fd, int operation) { ...@@ -89,7 +89,7 @@ flock(int fd, int operation) {
} }
#endif #endif
mrb_value static mrb_value
mrb_file_s_umask(mrb_state *mrb, mrb_value klass) mrb_file_s_umask(mrb_state *mrb, mrb_value klass)
{ {
#if defined(_WIN32) || defined(_WIN64) #if defined(_WIN32) || defined(_WIN64)
...@@ -265,7 +265,7 @@ mrb_file_realpath(mrb_state *mrb, mrb_value klass) ...@@ -265,7 +265,7 @@ mrb_file_realpath(mrb_state *mrb, mrb_value klass)
return result; return result;
} }
mrb_value static mrb_value
mrb_file__getwd(mrb_state *mrb, mrb_value klass) mrb_file__getwd(mrb_state *mrb, mrb_value klass)
{ {
mrb_value path; mrb_value path;
...@@ -401,7 +401,7 @@ mrb_file_mtime(mrb_state *mrb, mrb_value self) ...@@ -401,7 +401,7 @@ mrb_file_mtime(mrb_state *mrb, mrb_value self)
return mrb_funcall(mrb, obj, "at", 1, mrb_fixnum_value(st.st_mtime)); return mrb_funcall(mrb, obj, "at", 1, mrb_fixnum_value(st.st_mtime));
} }
mrb_value static mrb_value
mrb_file_flock(mrb_state *mrb, mrb_value self) mrb_file_flock(mrb_state *mrb, mrb_value self)
{ {
#if defined(sun) #if defined(sun)
......
...@@ -85,7 +85,7 @@ mrb_lstat(mrb_state *mrb, mrb_value obj, struct stat *st) ...@@ -85,7 +85,7 @@ mrb_lstat(mrb_state *mrb, mrb_value obj, struct stat *st)
* File.directory?(".") * File.directory?(".")
*/ */
mrb_value static mrb_value
mrb_filetest_s_directory_p(mrb_state *mrb, mrb_value klass) mrb_filetest_s_directory_p(mrb_state *mrb, mrb_value klass)
{ {
#ifndef S_ISDIR #ifndef S_ISDIR
...@@ -112,7 +112,7 @@ mrb_filetest_s_directory_p(mrb_state *mrb, mrb_value klass) ...@@ -112,7 +112,7 @@ mrb_filetest_s_directory_p(mrb_state *mrb, mrb_value klass)
* Returns <code>true</code> if the named file is a pipe. * Returns <code>true</code> if the named file is a pipe.
*/ */
mrb_value static mrb_value
mrb_filetest_s_pipe_p(mrb_state *mrb, mrb_value klass) mrb_filetest_s_pipe_p(mrb_state *mrb, mrb_value klass)
{ {
#if defined(_WIN32) || defined(_WIN64) #if defined(_WIN32) || defined(_WIN64)
...@@ -145,7 +145,7 @@ mrb_filetest_s_pipe_p(mrb_state *mrb, mrb_value klass) ...@@ -145,7 +145,7 @@ mrb_filetest_s_pipe_p(mrb_state *mrb, mrb_value klass)
* Returns <code>true</code> if the named file is a symbolic link. * Returns <code>true</code> if the named file is a symbolic link.
*/ */
mrb_value static mrb_value
mrb_filetest_s_symlink_p(mrb_state *mrb, mrb_value klass) mrb_filetest_s_symlink_p(mrb_state *mrb, mrb_value klass)
{ {
#if defined(_WIN32) || defined(_WIN64) #if defined(_WIN32) || defined(_WIN64)
...@@ -188,7 +188,7 @@ mrb_filetest_s_symlink_p(mrb_state *mrb, mrb_value klass) ...@@ -188,7 +188,7 @@ mrb_filetest_s_symlink_p(mrb_state *mrb, mrb_value klass)
* Returns <code>true</code> if the named file is a socket. * Returns <code>true</code> if the named file is a socket.
*/ */
mrb_value static mrb_value
mrb_filetest_s_socket_p(mrb_state *mrb, mrb_value klass) mrb_filetest_s_socket_p(mrb_state *mrb, mrb_value klass)
{ {
#if defined(_WIN32) || defined(_WIN64) #if defined(_WIN32) || defined(_WIN64)
...@@ -232,7 +232,7 @@ mrb_filetest_s_socket_p(mrb_state *mrb, mrb_value klass) ...@@ -232,7 +232,7 @@ mrb_filetest_s_socket_p(mrb_state *mrb, mrb_value klass)
* Return <code>true</code> if the named file exists. * Return <code>true</code> if the named file exists.
*/ */
mrb_value static mrb_value
mrb_filetest_s_exist_p(mrb_state *mrb, mrb_value klass) mrb_filetest_s_exist_p(mrb_state *mrb, mrb_value klass)
{ {
struct stat st; struct stat st;
...@@ -253,7 +253,7 @@ mrb_filetest_s_exist_p(mrb_state *mrb, mrb_value klass) ...@@ -253,7 +253,7 @@ mrb_filetest_s_exist_p(mrb_state *mrb, mrb_value klass)
* regular file. * regular file.
*/ */
mrb_value static mrb_value
mrb_filetest_s_file_p(mrb_state *mrb, mrb_value klass) mrb_filetest_s_file_p(mrb_state *mrb, mrb_value klass)
{ {
#ifndef S_ISREG #ifndef S_ISREG
...@@ -281,7 +281,7 @@ mrb_filetest_s_file_p(mrb_state *mrb, mrb_value klass) ...@@ -281,7 +281,7 @@ mrb_filetest_s_file_p(mrb_state *mrb, mrb_value klass)
* a zero size. * a zero size.
*/ */
mrb_value static mrb_value
mrb_filetest_s_zero_p(mrb_state *mrb, mrb_value klass) mrb_filetest_s_zero_p(mrb_state *mrb, mrb_value klass)
{ {
struct stat st; struct stat st;
...@@ -306,7 +306,7 @@ mrb_filetest_s_zero_p(mrb_state *mrb, mrb_value klass) ...@@ -306,7 +306,7 @@ mrb_filetest_s_zero_p(mrb_state *mrb, mrb_value klass)
* _file_name_ can be an IO object. * _file_name_ can be an IO object.
*/ */
mrb_value static mrb_value
mrb_filetest_s_size(mrb_state *mrb, mrb_value klass) mrb_filetest_s_size(mrb_state *mrb, mrb_value klass)
{ {
struct stat st; struct stat st;
...@@ -328,7 +328,7 @@ mrb_filetest_s_size(mrb_state *mrb, mrb_value klass) ...@@ -328,7 +328,7 @@ mrb_filetest_s_size(mrb_state *mrb, mrb_value klass)
* file otherwise. * file otherwise.
*/ */
mrb_value static mrb_value
mrb_filetest_s_size_p(mrb_state *mrb, mrb_value klass) mrb_filetest_s_size_p(mrb_state *mrb, mrb_value klass)
{ {
struct stat st; struct stat st;
......
...@@ -341,7 +341,7 @@ option_to_fd(mrb_state *mrb, mrb_value hash, const char *key) ...@@ -341,7 +341,7 @@ option_to_fd(mrb_state *mrb, mrb_value hash, const char *key)
} }
#ifdef _WIN32 #ifdef _WIN32
mrb_value static mrb_value
mrb_io_s_popen(mrb_state *mrb, mrb_value klass) mrb_io_s_popen(mrb_state *mrb, mrb_value klass)
{ {
mrb_value cmd, io; mrb_value cmd, io;
...@@ -439,14 +439,14 @@ mrb_io_s_popen(mrb_state *mrb, mrb_value klass) ...@@ -439,14 +439,14 @@ mrb_io_s_popen(mrb_state *mrb, mrb_value klass)
return io; return io;
} }
#elif defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE #elif defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE
mrb_value static mrb_value
mrb_io_s_popen(mrb_state *mrb, mrb_value klass) mrb_io_s_popen(mrb_state *mrb, mrb_value klass)
{ {
mrb_raise(mrb, E_NOTIMP_ERROR, "IO#popen is not supported on the platform"); mrb_raise(mrb, E_NOTIMP_ERROR, "IO#popen is not supported on the platform");
return mrb_false_value(); return mrb_false_value();
} }
#else #else
mrb_value static mrb_value
mrb_io_s_popen(mrb_state *mrb, mrb_value klass) mrb_io_s_popen(mrb_state *mrb, mrb_value klass)
{ {
mrb_value cmd, io, result; mrb_value cmd, io, result;
...@@ -596,7 +596,7 @@ mrb_dup(mrb_state *mrb, int fd, mrb_bool *failed) ...@@ -596,7 +596,7 @@ mrb_dup(mrb_state *mrb, int fd, mrb_bool *failed)
return new_fd; return new_fd;
} }
mrb_value static mrb_value
mrb_io_initialize_copy(mrb_state *mrb, mrb_value copy) mrb_io_initialize_copy(mrb_state *mrb, mrb_value copy)
{ {
mrb_value orig; mrb_value orig;
...@@ -682,7 +682,7 @@ badfd: ...@@ -682,7 +682,7 @@ badfd:
mrb_sys_fail(mrb, "bad file descriptor"); mrb_sys_fail(mrb, "bad file descriptor");
} }
mrb_value static mrb_value
mrb_io_initialize(mrb_state *mrb, mrb_value io) mrb_io_initialize(mrb_state *mrb, mrb_value io)
{ {
struct mrb_io *fptr; struct mrb_io *fptr;
...@@ -785,7 +785,7 @@ fptr_finalize(mrb_state *mrb, struct mrb_io *fptr, int quiet) ...@@ -785,7 +785,7 @@ fptr_finalize(mrb_state *mrb, struct mrb_io *fptr, int quiet)
} }
} }
mrb_value static mrb_value
mrb_io_check_readable(mrb_state *mrb, mrb_value self) mrb_io_check_readable(mrb_state *mrb, mrb_value self)
{ {
struct mrb_io *fptr = io_get_open_fptr(mrb, self); struct mrb_io *fptr = io_get_open_fptr(mrb, self);
...@@ -795,7 +795,7 @@ mrb_io_check_readable(mrb_state *mrb, mrb_value self) ...@@ -795,7 +795,7 @@ mrb_io_check_readable(mrb_state *mrb, mrb_value self)
return mrb_nil_value(); return mrb_nil_value();
} }
mrb_value static mrb_value
mrb_io_isatty(mrb_state *mrb, mrb_value self) mrb_io_isatty(mrb_state *mrb, mrb_value self)
{ {
struct mrb_io *fptr; struct mrb_io *fptr;
...@@ -806,7 +806,7 @@ mrb_io_isatty(mrb_state *mrb, mrb_value self) ...@@ -806,7 +806,7 @@ mrb_io_isatty(mrb_state *mrb, mrb_value self)
return mrb_true_value(); return mrb_true_value();
} }
mrb_value static mrb_value
mrb_io_s_for_fd(mrb_state *mrb, mrb_value klass) mrb_io_s_for_fd(mrb_state *mrb, mrb_value klass)
{ {
struct RClass *c = mrb_class_ptr(klass); struct RClass *c = mrb_class_ptr(klass);
...@@ -819,7 +819,7 @@ mrb_io_s_for_fd(mrb_state *mrb, mrb_value klass) ...@@ -819,7 +819,7 @@ mrb_io_s_for_fd(mrb_state *mrb, mrb_value klass)
return mrb_io_initialize(mrb, obj); return mrb_io_initialize(mrb, obj);
} }
mrb_value static mrb_value
mrb_io_s_sysclose(mrb_state *mrb, mrb_value klass) mrb_io_s_sysclose(mrb_state *mrb, mrb_value klass)
{ {
mrb_int fd; mrb_int fd;
...@@ -830,7 +830,7 @@ mrb_io_s_sysclose(mrb_state *mrb, mrb_value klass) ...@@ -830,7 +830,7 @@ mrb_io_s_sysclose(mrb_state *mrb, mrb_value klass)
return mrb_fixnum_value(0); return mrb_fixnum_value(0);
} }
int static int
mrb_cloexec_open(mrb_state *mrb, const char *pathname, mrb_int flags, mrb_int mode) mrb_cloexec_open(mrb_state *mrb, const char *pathname, mrb_int flags, mrb_int mode)
{ {
int fd, retry = FALSE; int fd, retry = FALSE;
...@@ -865,7 +865,7 @@ reopen: ...@@ -865,7 +865,7 @@ reopen:
return fd; return fd;
} }
mrb_value static mrb_value
mrb_io_s_sysopen(mrb_state *mrb, mrb_value klass) mrb_io_s_sysopen(mrb_state *mrb, mrb_value klass)
{ {
mrb_value path = mrb_nil_value(); mrb_value path = mrb_nil_value();
...@@ -895,7 +895,7 @@ mrb_sysread_dummy(int fd, void *buf, fsize_t nbytes, off_t offset) ...@@ -895,7 +895,7 @@ mrb_sysread_dummy(int fd, void *buf, fsize_t nbytes, off_t offset)
return (mrb_io_read_write_size)read(fd, buf, nbytes); return (mrb_io_read_write_size)read(fd, buf, nbytes);
} }
mrb_value static mrb_value
mrb_io_sysread(mrb_state *mrb, mrb_value io) mrb_io_sysread(mrb_state *mrb, mrb_value io)
{ {
mrb_value buf = mrb_nil_value(); mrb_value buf = mrb_nil_value();
...@@ -949,7 +949,7 @@ mrb_io_sysread_common(mrb_state *mrb, ...@@ -949,7 +949,7 @@ mrb_io_sysread_common(mrb_state *mrb,
return buf; return buf;
} }
mrb_value static mrb_value
mrb_io_sysseek(mrb_state *mrb, mrb_value io) mrb_io_sysseek(mrb_state *mrb, mrb_value io)
{ {
struct mrb_io *fptr; struct mrb_io *fptr;
...@@ -1009,7 +1009,7 @@ mrb_syswrite_dummy(int fd, const void *buf, fsize_t nbytes, off_t offset) ...@@ -1009,7 +1009,7 @@ mrb_syswrite_dummy(int fd, const void *buf, fsize_t nbytes, off_t offset)
return (mrb_io_read_write_size)write(fd, buf, nbytes); return (mrb_io_read_write_size)write(fd, buf, nbytes);
} }
mrb_value static mrb_value
mrb_io_syswrite(mrb_state *mrb, mrb_value io) mrb_io_syswrite(mrb_state *mrb, mrb_value io)
{ {
mrb_value buf; mrb_value buf;
...@@ -1019,7 +1019,7 @@ mrb_io_syswrite(mrb_state *mrb, mrb_value io) ...@@ -1019,7 +1019,7 @@ mrb_io_syswrite(mrb_state *mrb, mrb_value io)
return mrb_io_syswrite_common(mrb, mrb_syswrite_dummy, io, buf, 0); return mrb_io_syswrite_common(mrb, mrb_syswrite_dummy, io, buf, 0);
} }
mrb_value static mrb_value
mrb_io_close(mrb_state *mrb, mrb_value self) mrb_io_close(mrb_state *mrb, mrb_value self)
{ {
struct mrb_io *fptr; struct mrb_io *fptr;
...@@ -1028,7 +1028,7 @@ mrb_io_close(mrb_state *mrb, mrb_value self) ...@@ -1028,7 +1028,7 @@ mrb_io_close(mrb_state *mrb, mrb_value self)
return mrb_nil_value(); return mrb_nil_value();
} }
mrb_value static mrb_value
mrb_io_close_write(mrb_state *mrb, mrb_value self) mrb_io_close_write(mrb_state *mrb, mrb_value self)
{ {
struct mrb_io *fptr; struct mrb_io *fptr;
...@@ -1039,7 +1039,7 @@ mrb_io_close_write(mrb_state *mrb, mrb_value self) ...@@ -1039,7 +1039,7 @@ mrb_io_close_write(mrb_state *mrb, mrb_value self)
return mrb_nil_value(); return mrb_nil_value();
} }
mrb_value static mrb_value
mrb_io_closed(mrb_state *mrb, mrb_value io) mrb_io_closed(mrb_state *mrb, mrb_value io)
{ {
struct mrb_io *fptr; struct mrb_io *fptr;
...@@ -1051,7 +1051,7 @@ mrb_io_closed(mrb_state *mrb, mrb_value io) ...@@ -1051,7 +1051,7 @@ mrb_io_closed(mrb_state *mrb, mrb_value io)
return mrb_true_value(); return mrb_true_value();
} }
mrb_value static mrb_value
mrb_io_pid(mrb_state *mrb, mrb_value io) mrb_io_pid(mrb_state *mrb, mrb_value io)
{ {
struct mrb_io *fptr; struct mrb_io *fptr;
...@@ -1317,7 +1317,7 @@ mrb_io_fileno_m(mrb_state *mrb, mrb_value io) ...@@ -1317,7 +1317,7 @@ mrb_io_fileno_m(mrb_state *mrb, mrb_value io)
return mrb_fixnum_value(fd); return mrb_fixnum_value(fd);
} }
mrb_value static mrb_value
mrb_io_close_on_exec_p(mrb_state *mrb, mrb_value self) mrb_io_close_on_exec_p(mrb_state *mrb, mrb_value self)
{ {
#if defined(F_GETFD) && defined(F_SETFD) && defined(FD_CLOEXEC) #if defined(F_GETFD) && defined(F_SETFD) && defined(FD_CLOEXEC)
...@@ -1341,7 +1341,7 @@ mrb_io_close_on_exec_p(mrb_state *mrb, mrb_value self) ...@@ -1341,7 +1341,7 @@ mrb_io_close_on_exec_p(mrb_state *mrb, mrb_value self)
#endif #endif
} }
mrb_value static mrb_value
mrb_io_set_close_on_exec(mrb_state *mrb, mrb_value self) mrb_io_set_close_on_exec(mrb_state *mrb, mrb_value self)
{ {
#if defined(F_GETFD) && defined(F_SETFD) && defined(FD_CLOEXEC) #if defined(F_GETFD) && defined(F_SETFD) && defined(FD_CLOEXEC)
...@@ -1377,7 +1377,7 @@ mrb_io_set_close_on_exec(mrb_state *mrb, mrb_value self) ...@@ -1377,7 +1377,7 @@ mrb_io_set_close_on_exec(mrb_state *mrb, mrb_value self)
#endif #endif
} }
mrb_value static mrb_value
mrb_io_set_sync(mrb_state *mrb, mrb_value self) mrb_io_set_sync(mrb_state *mrb, mrb_value self)
{ {
struct mrb_io *fptr; struct mrb_io *fptr;
...@@ -1389,7 +1389,7 @@ mrb_io_set_sync(mrb_state *mrb, mrb_value self) ...@@ -1389,7 +1389,7 @@ mrb_io_set_sync(mrb_state *mrb, mrb_value self)
return mrb_bool_value(b); return mrb_bool_value(b);
} }
mrb_value static mrb_value
mrb_io_sync(mrb_state *mrb, mrb_value self) mrb_io_sync(mrb_state *mrb, mrb_value self)
{ {
struct mrb_io *fptr; struct mrb_io *fptr;
......
...@@ -210,7 +210,7 @@ mrb_io_test_rmdir(mrb_state *mrb, mrb_value klass) ...@@ -210,7 +210,7 @@ mrb_io_test_rmdir(mrb_state *mrb, mrb_value klass)
return mrb_true_value(); return mrb_true_value();
} }
mrb_value static mrb_value
mrb_io_win_p(mrb_state *mrb, mrb_value klass) mrb_io_win_p(mrb_state *mrb, mrb_value klass)
{ {
#if defined(_WIN32) || defined(_WIN64) #if defined(_WIN32) || defined(_WIN64)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment