diff --git a/Changelog.md b/Changelog.md index dcf9482..13c62bf 100644 --- a/Changelog.md +++ b/Changelog.md @@ -2,6 +2,12 @@ ## Releases +### Version 0.13.1 + +#### Bugfixes + +* Fixed documentation + ### Version 0.13.0 #### Features diff --git a/README.md b/README.md index df00ea0..fc13f30 100644 --- a/README.md +++ b/README.md @@ -226,6 +226,12 @@ The term 'anyoli' means 'green' in the Maasai language, thus naming 'anyolite'. ## Upcoming releases +### Version 0.14.0 + +#### Features + +* [ ] Windows support + ### Version 1.0.0 This release will mark the first full release of Anyolite, mostly @@ -237,7 +243,6 @@ Anyolite are already implemented. #### Platform support -* [ ] Windows support (currently not supported due to problems with Crystal) * [ ] Mac support (might be possible, not tested yet) #### Documentation diff --git a/shard.yml b/shard.yml index 3a3a533..916d81e 100644 --- a/shard.yml +++ b/shard.yml @@ -1,5 +1,5 @@ name: anyolite -version: 0.13.0 +version: 0.13.1 authors: - Hadeweka diff --git a/src/implementations/mri/FormatString.cr b/src/implementations/mri/FormatString.cr index 96ab539..ddc605f 100644 --- a/src/implementations/mri/FormatString.cr +++ b/src/implementations/mri/FormatString.cr @@ -1,32 +1,34 @@ -module Anyolite - module Macro - macro format_string(args, context = nil) - {% if args %} - {% required_counter = 0 %} - {% optional_counter = 0 %} - {% optional_args = false %} +{% if flag?(:anyolite_implementation_ruby_3) %} + module Anyolite + module Macro + macro format_string(args, context = nil) + {% if args %} + {% required_counter = 0 %} + {% optional_counter = 0 %} + {% optional_args = false %} - {% for arg in args %} - {% if arg.is_a?(TypeDeclaration) %} - {% if arg.value || optional_args %} - {% optional_counter += 1 %} - {% optional_args = true %} + {% for arg in args %} + {% if arg.is_a?(TypeDeclaration) %} + {% if arg.value || optional_args %} + {% optional_counter += 1 %} + {% optional_args = true %} + {% else %} + {% required_counter += 1 %} + {% end %} {% else %} - {% required_counter += 1 %} - {% end %} - {% else %} - {% if optional_args %} - {% optional_counter += 1 %} - {% else %} - {% required_counter += 1 %} + {% if optional_args %} + {% optional_counter += 1 %} + {% else %} + {% required_counter += 1 %} + {% end %} {% end %} {% end %} - {% end %} - "{{required_counter}}{{optional_counter > 0 ? optional_counter : "".id}}" - {% else %} - "" - {% end %} + "{{required_counter}}{{optional_counter > 0 ? optional_counter : "".id}}" + {% else %} + "" + {% end %} + end end end -end \ No newline at end of file +{% end %} \ No newline at end of file diff --git a/src/implementations/mri/Implementation.cr b/src/implementations/mri/Implementation.cr index ff3dded..80c0f5a 100644 --- a/src/implementations/mri/Implementation.cr +++ b/src/implementations/mri/Implementation.cr @@ -1,99 +1,101 @@ -require "./RbCore.cr" -require "./FormatString.cr" +{% if flag?(:anyolite_implementation_ruby_3) %} + require "./RbCore.cr" + require "./FormatString.cr" -{% if !flag?(:use_general_object_format_chars) %} - {% raise "Flag 'use_general_object_format_chars' needs to be set for a working MRI implementation" %} -{% end %} + {% if !flag?(:use_general_object_format_chars) %} + {% raise "Flag 'use_general_object_format_chars' needs to be set for a working MRI implementation" %} + {% end %} -module Anyolite - module Macro - macro new_rb_func(&b) - Anyolite::RbCore::RbFunc.new do |_argc, _argv, _obj| - _rb = Pointer(Anyolite::RbCore::State).null - {{b.body}} + module Anyolite + module Macro + macro new_rb_func(&b) + Anyolite::RbCore::RbFunc.new do |_argc, _argv, _obj| + _rb = Pointer(Anyolite::RbCore::State).null + {{b.body}} + end end - end - macro new_rb_data_func(&b) - Anyolite::RbCore::RbDataFunc.new do |__ptr| - __rb = Pointer(Anyolite::RbCore::State).null - {{b.body}} + macro new_rb_data_func(&b) + Anyolite::RbCore::RbDataFunc.new do |__ptr| + __rb = Pointer(Anyolite::RbCore::State).null + {{b.body}} + end end - end - macro set_default_args_for_regular_args(args, regular_arg_tuple, number_of_args) - {% c = 0 %} - {% if args %} - {% for arg in args %} - {% if arg.is_a? TypeDeclaration %} - {% if arg.value %} - if {{number_of_args}} <= {{c}} && Anyolite::RbCast.check_for_nil({{regular_arg_tuple}}[{{c}}].value) - {{regular_arg_tuple}}[{{c}}].value = Anyolite::RbCast.return_value(_rb, {{arg.value}}) - end + macro set_default_args_for_regular_args(args, regular_arg_tuple, number_of_args) + {% c = 0 %} + {% if args %} + {% for arg in args %} + {% if arg.is_a? TypeDeclaration %} + {% if arg.value %} + if {{number_of_args}} <= {{c}} && Anyolite::RbCast.check_for_nil({{regular_arg_tuple}}[{{c}}].value) + {{regular_arg_tuple}}[{{c}}].value = Anyolite::RbCast.return_value(_rb, {{arg.value}}) + end + {% end %} + {% elsif arg.is_a? Path %} + # No default argument was given, so no action is required here + {% else %} + {% raise "Not a TypeDeclaration or a Path: #{arg} of #{arg.class_name}" %} {% end %} - {% elsif arg.is_a? Path %} - # No default argument was given, so no action is required here - {% else %} - {% raise "Not a TypeDeclaration or a Path: #{arg} of #{arg.class_name}" %} + {% c += 1 %} {% end %} - {% c += 1 %} {% end %} - {% end %} - end + end - macro load_args_into_vars(args, format_string, regular_arg_tuple, block_ptr = nil) - {% if block_ptr %} - number_of_args = Anyolite::RbCore.rb_get_args(_argc, _argv, {{format_string}}, *{{regular_arg_tuple}}, {{block_ptr}}) - {% else %} - number_of_args = Anyolite::RbCore.rb_get_args(_argc, _argv, {{format_string}}, *{{regular_arg_tuple}}) - {% end %} + macro load_args_into_vars(args, format_string, regular_arg_tuple, block_ptr = nil) + {% if block_ptr %} + number_of_args = Anyolite::RbCore.rb_get_args(_argc, _argv, {{format_string}}, *{{regular_arg_tuple}}, {{block_ptr}}) + {% else %} + number_of_args = Anyolite::RbCore.rb_get_args(_argc, _argv, {{format_string}}, *{{regular_arg_tuple}}) + {% end %} - Anyolite::Macro.set_default_args_for_regular_args({{args}}, {{regular_arg_tuple}}, number_of_args) - end + Anyolite::Macro.set_default_args_for_regular_args({{args}}, {{regular_arg_tuple}}, number_of_args) + end - macro load_kw_args_into_vars(regular_args, keyword_args, format_string, regular_arg_tuple, block_ptr = nil) - kw_ptr = Pointer(Anyolite::RbCore::RbValue).malloc(size: 1, value: Anyolite::RbCast.return_nil) + macro load_kw_args_into_vars(regular_args, keyword_args, format_string, regular_arg_tuple, block_ptr = nil) + kw_ptr = Pointer(Anyolite::RbCore::RbValue).malloc(size: 1, value: Anyolite::RbCast.return_nil) - {% if block_ptr %} - number_of_args = Anyolite::RbCore.rb_get_args(_argc, _argv, {{format_string}}, *{{regular_arg_tuple}}, kw_ptr, {{block_ptr}}) - {% else %} - number_of_args = Anyolite::RbCore.rb_get_args(_argc, _argv, {{format_string}}, *{{regular_arg_tuple}}, kw_ptr) - {% end %} + {% if block_ptr %} + number_of_args = Anyolite::RbCore.rb_get_args(_argc, _argv, {{format_string}}, *{{regular_arg_tuple}}, kw_ptr, {{block_ptr}}) + {% else %} + number_of_args = Anyolite::RbCore.rb_get_args(_argc, _argv, {{format_string}}, *{{regular_arg_tuple}}, kw_ptr) + {% end %} - # TODO: Is number_of_args for the regular arg function correct here? + # TODO: Is number_of_args for the regular arg function correct here? - Anyolite::Macro.set_default_args_for_regular_args({{regular_args}}, {{regular_arg_tuple}}, number_of_args) + Anyolite::Macro.set_default_args_for_regular_args({{regular_args}}, {{regular_arg_tuple}}, number_of_args) - # TODO: This is relatively complicated and messy, so can this be simplified? + # TODO: This is relatively complicated and messy, so can this be simplified? - if Anyolite::RbCast.check_for_nil(kw_ptr.value) - hash_key_values = [] of String - else - rb_hash_key_values = Anyolite::RbCore.rb_hash_keys(_rb, kw_ptr.value) - hash_key_values = Anyolite::Macro.convert_from_ruby_to_crystal(_rb, rb_hash_key_values, k : Array(String)) - end + if Anyolite::RbCast.check_for_nil(kw_ptr.value) + hash_key_values = [] of String + else + rb_hash_key_values = Anyolite::RbCore.rb_hash_keys(_rb, kw_ptr.value) + hash_key_values = Anyolite::Macro.convert_from_ruby_to_crystal(_rb, rb_hash_key_values, k : Array(String)) + end - return_hash = {} of Symbol => Anyolite::RbCore::RbValue - {% for keyword_arg in keyword_args %} - {% if keyword_arg.is_a? TypeDeclaration %} - if hash_key_values.includes?(":{{keyword_arg.var.id}}") - ruby_hash_value = Anyolite::RbCore.rb_hash_get(_rb, kw_ptr.value, Anyolite::RbCore.get_symbol_value_of_string(_rb, "{{keyword_arg.var.id}}")) - return_hash[:{{keyword_arg.var.id}}] = ruby_hash_value - else - {% if !keyword_arg.value.is_a? Nop %} - return_hash[:{{keyword_arg.var.id}}] = Anyolite::RbCast.return_value(_rb, {{keyword_arg.value}}) - {% else %} - Anyolite.raise_argument_error("Keyword #{"{{keyword_arg.var.id}}"} was not defined.") - {% end %} - end - {% elsif arg.is_a? Path %} - # No default argument was given, so no action is required here - {% else %} - {% raise "Not a TypeDeclaration or a Path: #{keyword_arg} of #{keyword_arg.class_name}" %} + return_hash = {} of Symbol => Anyolite::RbCore::RbValue + {% for keyword_arg in keyword_args %} + {% if keyword_arg.is_a? TypeDeclaration %} + if hash_key_values.includes?(":{{keyword_arg.var.id}}") + ruby_hash_value = Anyolite::RbCore.rb_hash_get(_rb, kw_ptr.value, Anyolite::RbCore.get_symbol_value_of_string(_rb, "{{keyword_arg.var.id}}")) + return_hash[:{{keyword_arg.var.id}}] = ruby_hash_value + else + {% if !keyword_arg.value.is_a? Nop %} + return_hash[:{{keyword_arg.var.id}}] = Anyolite::RbCast.return_value(_rb, {{keyword_arg.value}}) + {% else %} + Anyolite.raise_argument_error("Keyword #{"{{keyword_arg.var.id}}"} was not defined.") + {% end %} + end + {% elsif arg.is_a? Path %} + # No default argument was given, so no action is required here + {% else %} + {% raise "Not a TypeDeclaration or a Path: #{keyword_arg} of #{keyword_arg.class_name}" %} + {% end %} {% end %} - {% end %} - return_hash + return_hash + end end end -end \ No newline at end of file +{% end %} \ No newline at end of file diff --git a/src/implementations/mri/RbCore.cr b/src/implementations/mri/RbCore.cr index 730f97a..b38da7d 100644 --- a/src/implementations/mri/RbCore.cr +++ b/src/implementations/mri/RbCore.cr @@ -1,222 +1,224 @@ -module Anyolite - macro link_libraries - {% build_path = env("ANYOLITE_BUILD_PATH") ? env("ANYOLITE_BUILD_PATH") : "build" %} - - {% if flag?(:win32) %} - @[Link(ldflags: "#{__DIR__}/../../../{{build_path.id}}/mri/lib/libruby-static.lib -lgmp -lcrypt -lz msvcrt.lib Ws2_32.lib")] - @[Link(ldflags: "#{__DIR__}/../../../{{build_path.id}}/glue/mri/return_functions.obj -lgmp -lcrypt -lz")] - @[Link(ldflags: "#{__DIR__}/../../../{{build_path.id}}/glue/mri/data_helper.obj -lgmp -lcrypt -lz")] - @[Link(ldflags: "#{__DIR__}/../../../{{build_path.id}}/glue/mri/script_helper.obj -lgmp -lcrypt -lz")] - @[Link(ldflags: "#{__DIR__}/../../../{{build_path.id}}/glue/mri/error_helper.obj -lgmp -lcrypt -lz")] - {% else %} - @[Link(ldflags: "#{__DIR__}/../../../{{build_path.id}}/mri/lib/libruby-static.a -lgmp -lcrypt -lz")] - @[Link(ldflags: "#{__DIR__}/../../../{{build_path.id}}/glue/mri/return_functions.o -lgmp -lcrypt -lz")] - @[Link(ldflags: "#{__DIR__}/../../../{{build_path.id}}/glue/mri/data_helper.o -lgmp -lcrypt -lz")] - @[Link(ldflags: "#{__DIR__}/../../../{{build_path.id}}/glue/mri/script_helper.o -lgmp -lcrypt -lz")] - @[Link(ldflags: "#{__DIR__}/../../../{{build_path.id}}/glue/mri/error_helper.o -lgmp -lcrypt -lz")] - {% end %} - end - - Anyolite.link_libraries - - lib RbCore - alias RbFunc = Proc(RbInt, RbValue*, RbValue, RbValue) # argc, argv, self -> VALUE - alias RbDataFunc = Proc(Void*, Nil) - - type State = Void - - alias RClassPtr = RbValue - - alias RbFloat = LibC::Double - alias RbInt = Int64 - alias RbBool = UInt8 - alias RbSymbol = LibC::ULong - - enum MrbVType - MRB_TT_FALSE = 0 - MRB_TT_TRUE - MRB_TT_SYMBOL - MRB_TT_UNDEF - MRB_TT_FREE - MRB_TT_FLOAT - MRB_TT_INTEGER - MRB_TT_CPTR - MRB_TT_OBJECT - MRB_TT_CLASS - MRB_TT_MODULE - MRB_TT_ICLASS - MRB_TT_SCLASS - MRB_TT_PROC - MRB_TT_ARRAY - MRB_TT_HASH - MRB_TT_STRING - MRB_TT_RANGE - MRB_TT_EXCEPTION - MRB_TT_ENV - MRB_TT_DATA - MRB_TT_FIBER - MRB_TT_ISTRUCT - MRB_TT_BREAK - MRB_TT_COMPLEX - MRB_TT_RATIONAL - MRB_TT_MAXDEFINE - end - - struct RbValue - w : LibC::ULong - end - - struct RbDataType - struct_name : LibC::Char* - dmark : RbDataFunc - dfree : RbDataFunc - dize : Proc(Void*, LibC::SizeT) - dcompact : RbDataFunc - reserved : Void** - parent : RbDataType* - data : Void* - flags : RbValue - end - - struct KWArgs - num : UInt32 - required : UInt32 - table : RbSymbol* - values : RbValue* - rest : RbValue* +{% if flag?(:anyolite_implementation_ruby_3) %} + module Anyolite + macro link_libraries + {% build_path = env("ANYOLITE_BUILD_PATH") ? env("ANYOLITE_BUILD_PATH") : "build" %} + + {% if flag?(:win32) %} + @[Link(ldflags: "#{__DIR__}/../../../{{build_path.id}}/mri/lib/libruby-static.lib -lgmp -lcrypt -lz msvcrt.lib Ws2_32.lib")] + @[Link(ldflags: "#{__DIR__}/../../../{{build_path.id}}/glue/mri/return_functions.obj -lgmp -lcrypt -lz")] + @[Link(ldflags: "#{__DIR__}/../../../{{build_path.id}}/glue/mri/data_helper.obj -lgmp -lcrypt -lz")] + @[Link(ldflags: "#{__DIR__}/../../../{{build_path.id}}/glue/mri/script_helper.obj -lgmp -lcrypt -lz")] + @[Link(ldflags: "#{__DIR__}/../../../{{build_path.id}}/glue/mri/error_helper.obj -lgmp -lcrypt -lz")] + {% else %} + @[Link(ldflags: "#{__DIR__}/../../../{{build_path.id}}/mri/lib/libruby-static.a -lgmp -lcrypt -lz")] + @[Link(ldflags: "#{__DIR__}/../../../{{build_path.id}}/glue/mri/return_functions.o -lgmp -lcrypt -lz")] + @[Link(ldflags: "#{__DIR__}/../../../{{build_path.id}}/glue/mri/data_helper.o -lgmp -lcrypt -lz")] + @[Link(ldflags: "#{__DIR__}/../../../{{build_path.id}}/glue/mri/script_helper.o -lgmp -lcrypt -lz")] + @[Link(ldflags: "#{__DIR__}/../../../{{build_path.id}}/glue/mri/error_helper.o -lgmp -lcrypt -lz")] + {% end %} end - - fun rb_open = open_interpreter : State* - fun rb_close = close_interpreter(rb : State*) - - fun rb_define_module = rb_define_module_helper(rb : State*, name : LibC::Char*) : RClassPtr - fun rb_define_module_under = rb_define_module_under_helper(rb : State*, under : RClassPtr, name : LibC::Char*) : RClassPtr - fun rb_define_class = rb_define_class_helper(rb : State*, name : LibC::Char*, superclass : RClassPtr) : RClassPtr - fun rb_define_class_under = rb_define_class_under_helper(rb : State*, under : RClassPtr, name : LibC::Char*, superclass : RClassPtr) : RClassPtr - - fun rb_define_method = rb_define_method_helper(rb : State*, c : RClassPtr, name : LibC::Char*, func : RbFunc, aspec : UInt32) # TODO: Aspec values - fun rb_define_class_method = rb_define_class_method_helper(rb : State*, c : RClassPtr, name : LibC::Char*, func : RbFunc, aspect : UInt32) - fun rb_define_module_function = rb_define_module_function_helper(rb : State*, c : RClassPtr, name : LibC::Char*, func : RbFunc, aspect : UInt32) - - fun rb_define_const = rb_define_const_helper(rb : State*, c : RClassPtr, name : LibC::Char*, val : RbValue) - - # UNUSED - # fun rb_print_error = mrb_print_error(rb : State*) - - fun rb_raise = rb_raise_helper(rb : State*, c : RClassPtr, msg : LibC::Char*) - fun rb_raise_runtime_error = rb_raise_runtime_error(rb : State*, msg : LibC::Char*) - fun rb_raise_type_error = rb_raise_type_error(rb : State*, msg : LibC::Char*) - fun rb_raise_argument_error = rb_raise_argument_error(rb : State*, msg : LibC::Char*) - fun rb_raise_index_error = rb_raise_index_error(rb : State*, msg : LibC::Char*) - fun rb_raise_range_error = rb_raise_range_error(rb : State*, msg : LibC::Char*) - fun rb_raise_name_error = rb_raise_name_error(rb : State*, msg : LibC::Char*) - fun rb_raise_script_error = rb_raise_script_error(rb : State*, msg : LibC::Char*) - fun rb_raise_not_implemented_error = rb_raise_not_implemented_error(rb : State*, msg : LibC::Char*) - fun rb_raise_key_error = rb_raise_key_error(rb : State*, msg : LibC::Char*) - - fun rb_get_args = rb_scan_args(argc : RbInt, argv : RbValue*, format : LibC::Char*, ...) : RbInt - # UNUSED - # fun rb_get_argc = mrb_get_argc(rb : State*) : RbInt - # fun rb_get_argv = mrb_get_argv(rb : State*) : RbValue* + Anyolite.link_libraries + + lib RbCore + alias RbFunc = Proc(RbInt, RbValue*, RbValue, RbValue) # argc, argv, self -> VALUE + alias RbDataFunc = Proc(Void*, Nil) + + type State = Void + + alias RClassPtr = RbValue + + alias RbFloat = LibC::Double + alias RbInt = Int64 + alias RbBool = UInt8 + alias RbSymbol = LibC::ULong + + enum MrbVType + MRB_TT_FALSE = 0 + MRB_TT_TRUE + MRB_TT_SYMBOL + MRB_TT_UNDEF + MRB_TT_FREE + MRB_TT_FLOAT + MRB_TT_INTEGER + MRB_TT_CPTR + MRB_TT_OBJECT + MRB_TT_CLASS + MRB_TT_MODULE + MRB_TT_ICLASS + MRB_TT_SCLASS + MRB_TT_PROC + MRB_TT_ARRAY + MRB_TT_HASH + MRB_TT_STRING + MRB_TT_RANGE + MRB_TT_EXCEPTION + MRB_TT_ENV + MRB_TT_DATA + MRB_TT_FIBER + MRB_TT_ISTRUCT + MRB_TT_BREAK + MRB_TT_COMPLEX + MRB_TT_RATIONAL + MRB_TT_MAXDEFINE + end + + struct RbValue + w : LibC::ULong + end + + struct RbDataType + struct_name : LibC::Char* + dmark : RbDataFunc + dfree : RbDataFunc + dize : Proc(Void*, LibC::SizeT) + dcompact : RbDataFunc + reserved : Void** + parent : RbDataType* + data : Void* + flags : RbValue + end + + struct KWArgs + num : UInt32 + required : UInt32 + table : RbSymbol* + values : RbValue* + rest : RbValue* + end + + fun rb_open = open_interpreter : State* + fun rb_close = close_interpreter(rb : State*) + + fun rb_define_module = rb_define_module_helper(rb : State*, name : LibC::Char*) : RClassPtr + fun rb_define_module_under = rb_define_module_under_helper(rb : State*, under : RClassPtr, name : LibC::Char*) : RClassPtr + fun rb_define_class = rb_define_class_helper(rb : State*, name : LibC::Char*, superclass : RClassPtr) : RClassPtr + fun rb_define_class_under = rb_define_class_under_helper(rb : State*, under : RClassPtr, name : LibC::Char*, superclass : RClassPtr) : RClassPtr + + fun rb_define_method = rb_define_method_helper(rb : State*, c : RClassPtr, name : LibC::Char*, func : RbFunc, aspec : UInt32) # TODO: Aspec values + fun rb_define_class_method = rb_define_class_method_helper(rb : State*, c : RClassPtr, name : LibC::Char*, func : RbFunc, aspect : UInt32) + fun rb_define_module_function = rb_define_module_function_helper(rb : State*, c : RClassPtr, name : LibC::Char*, func : RbFunc, aspect : UInt32) + + fun rb_define_const = rb_define_const_helper(rb : State*, c : RClassPtr, name : LibC::Char*, val : RbValue) + + # UNUSED + # fun rb_print_error = mrb_print_error(rb : State*) + + fun rb_raise = rb_raise_helper(rb : State*, c : RClassPtr, msg : LibC::Char*) + fun rb_raise_runtime_error = rb_raise_runtime_error(rb : State*, msg : LibC::Char*) + fun rb_raise_type_error = rb_raise_type_error(rb : State*, msg : LibC::Char*) + fun rb_raise_argument_error = rb_raise_argument_error(rb : State*, msg : LibC::Char*) + fun rb_raise_index_error = rb_raise_index_error(rb : State*, msg : LibC::Char*) + fun rb_raise_range_error = rb_raise_range_error(rb : State*, msg : LibC::Char*) + fun rb_raise_name_error = rb_raise_name_error(rb : State*, msg : LibC::Char*) + fun rb_raise_script_error = rb_raise_script_error(rb : State*, msg : LibC::Char*) + fun rb_raise_not_implemented_error = rb_raise_not_implemented_error(rb : State*, msg : LibC::Char*) + fun rb_raise_key_error = rb_raise_key_error(rb : State*, msg : LibC::Char*) + + fun rb_get_args = rb_scan_args(argc : RbInt, argv : RbValue*, format : LibC::Char*, ...) : RbInt + + # UNUSED + # fun rb_get_argc = mrb_get_argc(rb : State*) : RbInt + # fun rb_get_argv = mrb_get_argv(rb : State*) : RbValue* + + fun rb_yield = rb_yield_helper(rb : State*, value : RbValue, arg : RbValue) : RbValue + fun rb_yield_argv = rb_yield_argv_helper(rb : State*, value : RbValue, argc : RbInt, argv : RbValue*) : RbValue + + fun rb_call_block = rb_yield_helper(rb : State*, value : RbValue, arg : RbValue) : RbValue + fun rb_call_block_with_args = rb_call_block_with_args_helper(rb : State*, value : RbValue, argc : RbInt, argv : RbValue*) : RbValue + + fun rb_ary_ref = rb_ary_ref_helper(rb : State*, value : RbValue, pos : RbInt) : RbValue + fun rb_ary_entry(value : RbValue, offset : RbInt) : RbValue + fun array_length = rb_ary_length_helper(value : RbValue) : LibC::SizeT + + fun rb_ary_new_from_values = rb_ary_new_from_values_helper(rb : State*, size : RbInt, values : RbValue*) : RbValue + + fun rb_hash_new = rb_hash_new_helper(rb : State*) : RbValue + fun rb_hash_set = rb_hash_set_helper(rb : State*, hash : RbValue, key : RbValue, value : RbValue) + fun rb_hash_get = rb_hash_get_helper(rb : State*, hash : RbValue, key : RbValue) : RbValue + fun rb_hash_keys = rb_hash_keys_helper(rb : State*, hash : RbValue) : RbValue + fun rb_hash_size = rb_hash_size_helper(rb : State*, hash : RbValue) : RbInt + + fun get_nil_value : RbValue + fun get_false_value : RbValue + fun get_true_value : RbValue + fun get_fixnum_value(value : RbInt) : RbValue + fun get_bool_value(value : RbBool) : RbValue + fun get_float_value(rb : State*, value : RbFloat) : RbValue + fun get_string_value(rb : State*, value : LibC::Char*) : RbValue + + fun check_rb_fixnum(value : RbValue) : LibC::Int + fun check_rb_float(value : RbValue) : LibC::Int + fun check_rb_true (value : RbValue) : LibC::Int + fun check_rb_false(value : RbValue) : LibC::Int + fun check_rb_nil(value : RbValue) : LibC::Int + fun check_rb_undef(value : RbValue) : LibC::Int + fun check_rb_string(value : RbValue) : LibC::Int + fun check_rb_symbol(value : RbValue) : LibC::Int + fun check_rb_array(value : RbValue) : LibC::Int + fun check_rb_hash(value : RbValue) : LibC::Int + fun check_rb_data(value : RbValue) : LibC::Int + + fun get_rb_fixnum(value : RbValue) : RbInt + fun get_rb_float(value : RbValue) : RbFloat + fun get_rb_bool(value : RbValue) : RbBool + fun get_rb_string(rb : State*, value : RbValue) : LibC::Char* + + fun rb_str_to_cstr(rb : State*, value : RbValue) : LibC::Char* + + fun convert_to_rb_sym = convert_to_rb_sym_helper(rb : State*, value : LibC::Char*) : RbSymbol + fun get_symbol_value_of_string(rb : State*, value : LibC::Char*) : RbValue + + # Base class, not to be confused with `get_class_of_obj` + fun get_object_class(rb : State*) : RClassPtr + + # UNUSED + # fun rb_obj_inspect = mrb_obj_inspect(rb : State*, value : RbValue) : RbValue + # fun rb_any_to_s = mrb_any_to_s(rb : State*, value : RbValue) : RbValue + + fun rb_inspect = rb_inspect_helper(rb : State*, value : RbValue) : RbValue - fun rb_yield = rb_yield_helper(rb : State*, value : RbValue, arg : RbValue) : RbValue - fun rb_yield_argv = rb_yield_argv_helper(rb : State*, value : RbValue, argc : RbInt, argv : RbValue*) : RbValue + fun rb_gc_register = rb_gc_register_helper(rb : State*, value : RbValue) : Void + fun rb_gc_unregister = rb_gc_unregister_helper(rb : State*, value : RbValue) : Void - fun rb_call_block = rb_yield_helper(rb : State*, value : RbValue, arg : RbValue) : RbValue - fun rb_call_block_with_args = rb_call_block_with_args_helper(rb : State*, value : RbValue, argc : RbInt, argv : RbValue*) : RbValue + fun rb_class_name = rb_class_name_helper(rb : State*, class_ptr : RClassPtr) : LibC::Char* - fun rb_ary_ref = rb_ary_ref_helper(rb : State*, value : RbValue, pos : RbInt) : RbValue - fun rb_ary_entry(value : RbValue, offset : RbInt) : RbValue - fun array_length = rb_ary_length_helper(value : RbValue) : LibC::SizeT + # UNUSED + # fun data_type(value : RbValue) : RbDataType* + # fun rb_data_get_ptr = mrb_data_get_ptr(rb : State*, obj : RbValue, type : RbDataType*) : Void* - fun rb_ary_new_from_values = rb_ary_new_from_values_helper(rb : State*, size : RbInt, values : RbValue*) : RbValue + fun set_instance_tt_as_data(ruby_class : RClassPtr) : Void + fun new_empty_object(rb : State*, ruby_class : RClassPtr, data_ptr : Void*, type : RbDataType*) : RbValue + fun set_data_ptr_and_type(ruby_object : RbValue, data : Void*, type : RbDataType*) + fun get_data_ptr(ruby_object : RbValue) : Void* - fun rb_hash_new = rb_hash_new_helper(rb : State*) : RbValue - fun rb_hash_set = rb_hash_set_helper(rb : State*, hash : RbValue, key : RbValue, value : RbValue) - fun rb_hash_get = rb_hash_get_helper(rb : State*, hash : RbValue, key : RbValue) : RbValue - fun rb_hash_keys = rb_hash_keys_helper(rb : State*, hash : RbValue) : RbValue - fun rb_hash_size = rb_hash_size_helper(rb : State*, hash : RbValue) : RbInt + fun get_rb_obj_value(p : RClassPtr) : RbValue - fun get_nil_value : RbValue - fun get_false_value : RbValue - fun get_true_value : RbValue - fun get_fixnum_value(value : RbInt) : RbValue - fun get_bool_value(value : RbBool) : RbValue - fun get_float_value(rb : State*, value : RbFloat) : RbValue - fun get_string_value(rb : State*, value : LibC::Char*) : RbValue + fun rb_obj_is_kind_of = rb_obj_is_kind_of_helper(rb : State*, obj : RbValue, c : RClassPtr) : RbBool + fun get_class_of_obj = rb_obj_class_helper(rb : State*, obj : RbValue) : RClassPtr - fun check_rb_fixnum(value : RbValue) : LibC::Int - fun check_rb_float(value : RbValue) : LibC::Int - fun check_rb_true (value : RbValue) : LibC::Int - fun check_rb_false(value : RbValue) : LibC::Int - fun check_rb_nil(value : RbValue) : LibC::Int - fun check_rb_undef(value : RbValue) : LibC::Int - fun check_rb_string(value : RbValue) : LibC::Int - fun check_rb_symbol(value : RbValue) : LibC::Int - fun check_rb_array(value : RbValue) : LibC::Int - fun check_rb_hash(value : RbValue) : LibC::Int - fun check_rb_data(value : RbValue) : LibC::Int + fun rb_funcall_argv = rb_funcall_argv_helper(rb : State*, value : RbValue, name : RbSymbol, argc : RbInt, argv : RbValue*) : RbValue + fun rb_funcall_argv_with_block = rb_funcall_argv_with_block_helper(rb : State*, value : RbValue, name : RbSymbol, argc : RbInt, argv : RbValue*, block : RbValue) : RbValue - fun get_rb_fixnum(value : RbValue) : RbInt - fun get_rb_float(value : RbValue) : RbFloat - fun get_rb_bool(value : RbValue) : RbBool - fun get_rb_string(rb : State*, value : RbValue) : LibC::Char* + fun rb_respond_to = rb_respond_to_helper(rb : State*, obj : RbValue, name : RbSymbol) : RbBool - fun rb_str_to_cstr(rb : State*, value : RbValue) : LibC::Char* + fun rb_iv_set = rb_iv_set_helper(rb : State*, obj : RbValue, sym : RbSymbol, value : RbValue) : Void + fun rb_iv_get = rb_iv_get_helper(rb : State*, obj : RbValue, sym : RbSymbol) : RbValue - fun convert_to_rb_sym = convert_to_rb_sym_helper(rb : State*, value : LibC::Char*) : RbSymbol - fun get_symbol_value_of_string(rb : State*, value : LibC::Char*) : RbValue + fun rb_cv_set = rb_cv_set_helper(rb : State*, mod : RbValue, sym : RbSymbol, value : RbValue) : Void + fun rb_cv_get = rb_cv_get_helper(rb : State*, mod : RbValue, sym : RbSymbol) : RbValue - # Base class, not to be confused with `get_class_of_obj` - fun get_object_class(rb : State*) : RClassPtr + fun rb_gv_set = rb_gv_set_helper(rb : State*, name : LibC::Char*, value : RbValue) : Void + fun rb_gv_get = rb_gv_get_helper(rb : State*, name : LibC::Char*) : RbValue - # UNUSED - # fun rb_obj_inspect = mrb_obj_inspect(rb : State*, value : RbValue) : RbValue - # fun rb_any_to_s = mrb_any_to_s(rb : State*, value : RbValue) : RbValue + fun load_script_from_file(rb : State*, filename : LibC::Char*) : Void - fun rb_inspect = rb_inspect_helper(rb : State*, value : RbValue) : RbValue + fun execute_script_line(rb : State*, str : LibC::Char*) : RbValue - fun rb_gc_register = rb_gc_register_helper(rb : State*, value : RbValue) : Void - fun rb_gc_unregister = rb_gc_unregister_helper(rb : State*, value : RbValue) : Void - - fun rb_class_name = rb_class_name_helper(rb : State*, class_ptr : RClassPtr) : LibC::Char* - - # UNUSED - # fun data_type(value : RbValue) : RbDataType* - # fun rb_data_get_ptr = mrb_data_get_ptr(rb : State*, obj : RbValue, type : RbDataType*) : Void* - - fun set_instance_tt_as_data(ruby_class : RClassPtr) : Void - fun new_empty_object(rb : State*, ruby_class : RClassPtr, data_ptr : Void*, type : RbDataType*) : RbValue - fun set_data_ptr_and_type(ruby_object : RbValue, data : Void*, type : RbDataType*) - fun get_data_ptr(ruby_object : RbValue) : Void* - - fun get_rb_obj_value(p : RClassPtr) : RbValue - - fun rb_obj_is_kind_of = rb_obj_is_kind_of_helper(rb : State*, obj : RbValue, c : RClassPtr) : RbBool - fun get_class_of_obj = rb_obj_class_helper(rb : State*, obj : RbValue) : RClassPtr - - fun rb_funcall_argv = rb_funcall_argv_helper(rb : State*, value : RbValue, name : RbSymbol, argc : RbInt, argv : RbValue*) : RbValue - fun rb_funcall_argv_with_block = rb_funcall_argv_with_block_helper(rb : State*, value : RbValue, name : RbSymbol, argc : RbInt, argv : RbValue*, block : RbValue) : RbValue - - fun rb_respond_to = rb_respond_to_helper(rb : State*, obj : RbValue, name : RbSymbol) : RbBool - - fun rb_iv_set = rb_iv_set_helper(rb : State*, obj : RbValue, sym : RbSymbol, value : RbValue) : Void - fun rb_iv_get = rb_iv_get_helper(rb : State*, obj : RbValue, sym : RbSymbol) : RbValue - - fun rb_cv_set = rb_cv_set_helper(rb : State*, mod : RbValue, sym : RbSymbol, value : RbValue) : Void - fun rb_cv_get = rb_cv_get_helper(rb : State*, mod : RbValue, sym : RbSymbol) : RbValue - - fun rb_gv_set = rb_gv_set_helper(rb : State*, name : LibC::Char*, value : RbValue) : Void - fun rb_gv_get = rb_gv_get_helper(rb : State*, name : LibC::Char*) : RbValue - - fun load_script_from_file(rb : State*, filename : LibC::Char*) : Void - - fun execute_script_line(rb : State*, str : LibC::Char*) : RbValue - - # UNUSED - # fun execute_bytecode(rb : State*, bytecode : UInt8*) : RbValue - # fun load_bytecode_from_file(rb : State*, filename : LibC::Char*) : RbValue - # fun transform_script_to_bytecode(filename : LibC::Char*, target_filename : LibC::Char*) : LibC::Int + # UNUSED + # fun execute_bytecode(rb : State*, bytecode : UInt8*) : RbValue + # fun load_bytecode_from_file(rb : State*, filename : LibC::Char*) : RbValue + # fun transform_script_to_bytecode(filename : LibC::Char*, target_filename : LibC::Char*) : LibC::Int + end end -end +{% end %} \ No newline at end of file