Since presym is now mandatory, mruby.h includes presym.h so that
MRB_SYM() macros are available everywhere without explicit include.
Remove redundant #include <mruby/presym.h> from all source files.
Co-authored-by: Claude <noreply@anthropic.com>
rename all HAL functions from mrb_<feature>_hal_<name>() to
mrb_hal_<feature>_<name>() for better grouping and clarity. this makes all
HAL functions immediately identifiable with the mrb_hal_* prefix.
affected gems:
- mruby-task: mrb_task_hal_* -> mrb_hal_task_*
- mruby-io: mrb_io_hal_* -> mrb_hal_io_*
- mruby-socket: mrb_socket_hal_* -> mrb_hal_socket_*
- mruby-dir: mrb_dir_hal_* -> mrb_hal_dir_*
Co-authored-by: Claude <noreply@anthropic.com>
platform-specific directory operations separated into hal-posix-dir and
hal-win-dir gems. this allows mruby-dir to support embedded platforms and
simplifies platform-specific implementations.
Co-authored-by: Claude <noreply@anthropic.com>
Change int variables to mrb_int in mrb_dir_getwd and mrb_dir_chroot
to maintain consistent use of mruby's integer type internally.
Keep explicit casts only at system interface boundaries where
different types are required by system calls.
Eliminates VC warning C4267 while following the same type
unification approach used in pack.c.
Co-authored-by: Claude <noreply@anthropic.com>
use mrb_int for size variable and cast to size_t only when calling getcwd.
this maintains consistency with mruby type system while avoiding
conversion warnings on windows vc compiler.
Co-authored-by: Claude <noreply@anthropic.com>
Moved Dir.children from Ruby to C implementation to eliminate
Ruby loop overhead and string comparison inefficiencies.
Uses existing skip_name_p helper to filter out "." and ".." entries
efficiently in C.
Co-authored-by: Claude <noreply@anthropic.com>
Moved Dir.entries from Ruby to C implementation to eliminate
Ruby loop overhead and array allocation inefficiencies.
Builds result array directly in C for better performance.
Co-authored-by: Claude <noreply@anthropic.com>
Added complete call-seq documentation for directory operations across
both mrblib/dir.rb (7 Ruby methods) and src/dir.c (12 C methods):
## Ruby Methods (mrblib/dir.rb):
- Dir instance methods: each, each_child for directory iteration with
enumerator support when no block given
- Dir class methods: entries, children for getting directory contents
as arrays, foreach for iteration, open for directory access with
optional block handling, chdir for changing working directory with
optional block for temporary changes
## C Methods (src/dir.c):
- Dir class methods: delete for removing directories, exist? for checking
directory existence, getwd/pwd for current directory, mkdir for creating
directories with optional permissions, chroot for changing filesystem root,
empty? for checking if directory is empty
- Dir instance methods: new for creating directory objects, close for
closing directory streams, read for reading directory entries, rewind
for repositioning to beginning, seek/tell/pos for directory positioning
Co-authored-by: Atlassian Rovo Dev
Instead of allocating `MAXPATHLEN` buffer string at the beginning,
allocate smaller (64 bytes) buffer, then resize it if needed. The
allocating max size is safe but consumes more memory.
Since `IOError` is a standard exception class in Ruby, there is no need to assume different superclasses.
The Ruby specification allows repeated class definitions as long as the superclass is the same.
This also avoids using the `mruby/ext/io.h` file to reference `E_IO_ERROR`.