@@ -99,23 +99,23 @@ mrb_str_to_cstr(mrb, v) /* const char* from String value */
9999
100100### Value Types
101101
102- | ` mrb_vtype ` | Ruby Class | Notes |
103- | ----------- | ---------- | ----- |
104- | ` MRB_TT_FALSE ` | FalseClass/NilClass | ` nil ` has ` MRB_TT_FALSE ` |
105- | ` MRB_TT_TRUE ` | TrueClass | |
106- | ` MRB_TT_INTEGER ` | Integer | Immediate value |
107- | ` MRB_TT_FLOAT ` | Float | May be immediate |
108- | ` MRB_TT_SYMBOL ` | Symbol | Immediate value |
109- | ` MRB_TT_STRING ` | String | Heap object |
110- | ` MRB_TT_ARRAY ` | Array | Heap object |
111- | ` MRB_TT_HASH ` | Hash | Heap object |
112- | ` MRB_TT_OBJECT ` | Object | User-defined classes |
113- | ` MRB_TT_CLASS ` | Class | |
114- | ` MRB_TT_MODULE ` | Module | |
115- | ` MRB_TT_PROC ` | Proc | |
116- | ` MRB_TT_CDATA ` | (C data) | Wrapped C structs |
117- | ` MRB_TT_EXCEPTION ` | Exception | |
118- | ` MRB_TT_FIBER ` | Fiber | |
102+ | ` mrb_vtype ` | Ruby Class | Notes |
103+ | ------------------ | ------------------- | ------------------- ----- |
104+ | ` MRB_TT_FALSE ` | FalseClass/NilClass | ` nil ` has ` MRB_TT_FALSE ` |
105+ | ` MRB_TT_TRUE ` | TrueClass | |
106+ | ` MRB_TT_INTEGER ` | Integer | Immediate value |
107+ | ` MRB_TT_FLOAT ` | Float | May be immediate |
108+ | ` MRB_TT_SYMBOL ` | Symbol | Immediate value |
109+ | ` MRB_TT_STRING ` | String | Heap object |
110+ | ` MRB_TT_ARRAY ` | Array | Heap object |
111+ | ` MRB_TT_HASH ` | Hash | Heap object |
112+ | ` MRB_TT_OBJECT ` | Object | User-defined classes |
113+ | ` MRB_TT_CLASS ` | Class | |
114+ | ` MRB_TT_MODULE ` | Module | |
115+ | ` MRB_TT_PROC ` | Proc | |
116+ | ` MRB_TT_CDATA ` | (C data) | Wrapped C structs |
117+ | ` MRB_TT_EXCEPTION ` | Exception | |
118+ | ` MRB_TT_FIBER ` | Fiber | |
119119
120120## Defining Classes and Modules
121121
@@ -165,15 +165,15 @@ mrb_define_module_function(mrb, mod, "name", my_method, MRB_ARGS_ANY());
165165
166166### Argument Specifiers
167167
168- | Macro | Meaning |
169- | ----- | ------- |
170- | `MRB_ARGS_NONE()` | No arguments |
171- | `MRB_ARGS_REQ(n)` | `n` required arguments |
172- | `MRB_ARGS_OPT(n)` | `n` optional arguments |
173- | `MRB_ARGS_ARG(r,o)` | `r` required + `o` optional |
174- | `MRB_ARGS_REST()` | Splat (`*args`) |
175- | `MRB_ARGS_BLOCK()` | Block (`&block`) |
176- | `MRB_ARGS_ANY()` | Any number (same as REST) |
168+ | Macro | Meaning |
169+ | ---------------------- | ------------------------------ ------- |
170+ | `MRB_ARGS_NONE()` | No arguments |
171+ | `MRB_ARGS_REQ(n)` | `n` required arguments |
172+ | `MRB_ARGS_OPT(n)` | `n` optional arguments |
173+ | `MRB_ARGS_ARG(r,o)` | `r` required + `o` optional |
174+ | `MRB_ARGS_REST()` | Splat (`*args`) |
175+ | `MRB_ARGS_BLOCK()` | Block (`&block`) |
176+ | `MRB_ARGS_ANY()` | Any number (same as REST) |
177177| `MRB_ARGS_KEY(n,rest)` | `n` keyword args, `rest`=1 for `**kw` |
178178
179179These can be combined with `|`:
@@ -192,27 +192,27 @@ mrb_int mrb_get_args(mrb_state *mrb, const char *format, ...);
192192
193193### Format Specifiers
194194
195- | Spec | Ruby Type | C Type(s) | Notes |
196- | ---- | --------- | --------- | ----- |
197- | `o` | any | `mrb_value` | No type check |
198- | `i` | Numeric | `mrb_int` | Coerces to integer |
199- | `f` | Numeric | `mrb_float` | Coerces to float |
200- | `b` | any | `mrb_bool` | Truthiness |
201- | `n` | String/Symbol | `mrb_sym` | Converts to symbol |
202- | `s` | String | `const char*, mrb_int` | Pointer + length |
203- | `z` | String | `const char*` | Null-terminated |
204- | `S` | String | `mrb_value` | String value |
205- | `A` | Array | `mrb_value` | Array value |
206- | `H` | Hash | `mrb_value` | Hash value |
207- | `C` | Class | `mrb_value` | Class/Module value |
208- | `c` | Class | `struct RClass*` | Class pointer |
209- | `a` | Array | `const mrb_value*, mrb_int` | Array pointer + length |
210- | `d` | C Data | `void*` | Requires `mrb_data_type*` |
211- | `&` | Block | `mrb_value` | Block argument |
212- | `*` | rest | `const mrb_value*, mrb_int` | Rest arguments |
213- | `\|` | — | — | Following args are optional |
214- | `?` | — | `mrb_bool` | Was previous optional arg given? |
215- | `:` | keywords | `mrb_kwargs` | Keyword arguments |
195+ | Spec | Ruby Type | C Type(s) | Notes |
196+ | ---- | ------------- | --------------------------- | --------------------------- ----- |
197+ | `o` | any | `mrb_value` | No type check |
198+ | `i` | Numeric | `mrb_int` | Coerces to integer |
199+ | `f` | Numeric | `mrb_float` | Coerces to float |
200+ | `b` | any | `mrb_bool` | Truthiness |
201+ | `n` | String/Symbol | `mrb_sym` | Converts to symbol |
202+ | `s` | String | `const char*, mrb_int` | Pointer + length |
203+ | `z` | String | `const char*` | Null-terminated |
204+ | `S` | String | `mrb_value` | String value |
205+ | `A` | Array | `mrb_value` | Array value |
206+ | `H` | Hash | `mrb_value` | Hash value |
207+ | `C` | Class | `mrb_value` | Class/Module value |
208+ | `c` | Class | `struct RClass*` | Class pointer |
209+ | `a` | Array | `const mrb_value*, mrb_int` | Array pointer + length |
210+ | `d` | C Data | `void*` | Requires `mrb_data_type*` |
211+ | `&` | Block | `mrb_value` | Block argument |
212+ | `*` | rest | `const mrb_value*, mrb_int` | Rest arguments |
213+ | `\|` | — | — | Following args are optional |
214+ | `?` | — | `mrb_bool` | Was previous optional arg given? |
215+ | `:` | keywords | `mrb_kwargs` | Keyword arguments |
216216
217217Adding `!` to `S`, `A`, `H`, `C`, `c`, `s`, `z`, `a`, `d` allows `nil`
218218(returns NULL/zero for nil).
@@ -608,14 +608,14 @@ my_yield_method(mrb_state *mrb, mrb_value self)
608608
609609### Fiber States
610610
611- | State | Meaning |
612- | ----- | ------- |
613- | ` MRB_FIBER_CREATED ` | Created but not yet resumed |
614- | ` MRB_FIBER_RUNNING ` | Currently executing |
615- | ` MRB_FIBER_RESUMED ` | Resumed another fiber |
616- | ` MRB_FIBER_SUSPENDED ` | Yielded, waiting to resume |
611+ | State | Meaning |
612+ | ----------------------- | ------------------------- ------- |
613+ | ` MRB_FIBER_CREATED ` | Created but not yet resumed |
614+ | ` MRB_FIBER_RUNNING ` | Currently executing |
615+ | ` MRB_FIBER_RESUMED ` | Resumed another fiber |
616+ | ` MRB_FIBER_SUSPENDED ` | Yielded, waiting to resume |
617617| ` MRB_FIBER_TRANSFERRED ` | Transferred via ` Fiber#transfer ` |
618- | ` MRB_FIBER_TERMINATED ` | Finished execution |
618+ | ` MRB_FIBER_TERMINATED ` | Finished execution |
619619
620620** Limitation:** fibers cannot yield across C function boundaries.
621621You cannot call ` mrb_fiber_yield ` from within a C-implemented
@@ -644,13 +644,13 @@ mrb_ccontext_free(mrb, cxt);
644644
645645The `mrb_ccontext` structure provides several flags:
646646
647- | Field | Purpose |
648- | ----- | ------- |
647+ | Field | Purpose |
648+ | ---------------- | -------------------------------- ------- |
649649| `capture_errors` | Collect parse errors instead of raising |
650- | `no_exec` | Compile without executing (get RProc) |
651- | `no_optimize` | Disable peephole optimizations |
652- | `no_ext_ops` | Disable extended operand instructions |
653- | `keep_lv` | Preserve local variables across loads |
650+ | `no_exec` | Compile without executing (get RProc) |
651+ | `no_optimize` | Disable peephole optimizations |
652+ | `no_ext_ops` | Disable extended operand instructions |
653+ | `keep_lv` | Preserve local variables across loads |
654654
655655### Loading with Context
656656
@@ -843,14 +843,14 @@ $ build/host/bin/mruby-config --libs # libraries
843843
844844Key macros that affect ABI:
845845
846- | Macro | Effect |
847- | ----- | ------ |
848- | ` MRB_NO_BOXING ` | Struct-based values (larger, debuggable) |
849- | ` MRB_WORD_BOXING ` | Single-word values (fast, 32-bit safe) |
850- | ` MRB_NAN_BOXING ` | NaN-tagged values (default on 32-bit) |
851- | ` MRB_NO_FLOAT ` | Disable Float support |
852- | ` MRB_INT64 ` | 64-bit integers |
853- | ` MRB_USE_FLOAT32 ` | 32-bit floats |
846+ | Macro | Effect |
847+ | ----------------- | ---------------------------------- ------ |
848+ | ` MRB_NO_BOXING ` | Struct-based values (larger, debuggable) |
849+ | ` MRB_WORD_BOXING ` | Single-word values (fast, 32-bit safe) |
850+ | ` MRB_NAN_BOXING ` | NaN-tagged values (default on 32-bit) |
851+ | ` MRB_NO_FLOAT ` | Disable Float support |
852+ | ` MRB_INT64 ` | 64-bit integers |
853+ | ` MRB_USE_FLOAT32 ` | 32-bit floats |
854854
855855Mismatching these between library and application causes silent
856856data corruption.
0 commit comments