1 #ifndef RUBY_IO_BUFFER_H
2 #define RUBY_IO_BUFFER_H
17 #include "ruby/internal/config.h"
22 #define RB_IO_BUFFER_EXPERIMENTAL 1
24 #define RUBY_IO_BUFFER_VERSION 2
38 enum rb_io_buffer_flags {
41 RB_IO_BUFFER_EXTERNAL = 1,
43 RB_IO_BUFFER_INTERNAL = 2,
46 RB_IO_BUFFER_MAPPED = 4,
49 RB_IO_BUFFER_SHARED = 8,
54 RB_IO_BUFFER_LOCKED = 32,
57 RB_IO_BUFFER_PRIVATE = 64,
60 RB_IO_BUFFER_READONLY = 128,
63 RB_IO_BUFFER_FILE = 256,
67 enum rb_io_buffer_endian {
69 RB_IO_BUFFER_LITTLE_ENDIAN = 4,
70 RB_IO_BUFFER_BIG_ENDIAN = 8,
72 #if defined(WORDS_BIGENDIAN)
73 RB_IO_BUFFER_HOST_ENDIAN = RB_IO_BUFFER_BIG_ENDIAN,
75 RB_IO_BUFFER_HOST_ENDIAN = RB_IO_BUFFER_LITTLE_ENDIAN,
78 RB_IO_BUFFER_NETWORK_ENDIAN = RB_IO_BUFFER_BIG_ENDIAN
81 VALUE rb_io_buffer_new(
void *base,
size_t size,
enum rb_io_buffer_flags flags);
82 VALUE rb_io_buffer_map(
VALUE io,
size_t size, rb_off_t offset,
enum rb_io_buffer_flags flags);
86 int rb_io_buffer_try_unlock(
VALUE self);
94 enum rb_io_buffer_flags rb_io_buffer_get_bytes(
VALUE self,
void **base,
size_t *size);
95 void rb_io_buffer_get_bytes_for_reading(
VALUE self,
const void **base,
size_t *size);
96 void rb_io_buffer_get_bytes_for_writing(
VALUE self,
void **base,
size_t *size);
99 void rb_io_buffer_resize(
VALUE self,
size_t size);
100 void rb_io_buffer_clear(
VALUE self, uint8_t value,
size_t offset,
size_t length);
103 VALUE rb_io_buffer_read(
VALUE self,
VALUE io,
size_t length,
size_t offset);
104 VALUE rb_io_buffer_pread(
VALUE self,
VALUE io, rb_off_t from,
size_t length,
size_t offset);
105 VALUE rb_io_buffer_write(
VALUE self,
VALUE io,
size_t length,
size_t offset);
106 VALUE rb_io_buffer_pwrite(
VALUE self,
VALUE io, rb_off_t from,
size_t length,
size_t offset);
#define RUBY_EXTERN
Declaration of externally visible global variables.
#define RBIMPL_SYMBOL_EXPORT_END()
Counterpart of RBIMPL_SYMBOL_EXPORT_BEGIN.
#define RBIMPL_SYMBOL_EXPORT_BEGIN()
Shortcut macro equivalent to RUBY_SYMBOL_EXPORT_BEGIN extern "C" {.
uintptr_t VALUE
Type that represents a Ruby object.