« blib/lib/SPVM/Document/NativeAPI/Allocator.pm
↑ Summary
blib/lib/SPVM/Document/NativeAPI/BasicType.pm »
| 1 | =head1 Name | ||
| 2 | |||
| 3 | SPVM::Document::NativeAPI::Argument - Argument Native APIs | ||
| 4 | |||
| 5 | =head1 Description | ||
| 6 | |||
| 7 | The argument native APIs in L<SPVM> are the APIs to get definition information for arguments. | ||
| 8 | |||
| 9 | =head1 Usage | ||
| 10 | |||
| 11 | SPVM_API_ARG* api_arg = env->api->arg; | ||
| 12 | |||
| 13 | SPVM_API_METHOD* api_method = env->api->method; | ||
| 14 | |||
| 15 | SPVM_NATIVE_BASIC_TYPE* basic_type = env->get_basic_type(env, stack, "Foo"); | ||
| 16 | |||
| 17 | SPVM_NATIVE_METHOD* method = env->api->basic_type->get_method_by_name(env->runtime, basic_type, "get"); | ||
| 18 | |||
| 19 | SPVM_NATIVE_ARG* arg = api_method->get_arg_by_index(env->runtime, method, 0); | ||
| 20 | |||
| 21 | SPVM_NATIVE_BASIC_TYPE* arg_basic_type = api_arg->get_basic_type(env->runtime, arg); | ||
| 22 | |||
| 23 | =head1 Native APIs | ||
| 24 | |||
| 25 | =head2 get_name | ||
| 26 | |||
| 27 | C<const char* (*get_name)(L<SPVM_NATIVE_RUNTIME* runtime|SPVM::Document::NativeAPI::Runtime>, L<SPVM_NATIVE_ARG* arg|SPVM::Document::NativeAPI::Argument>);> | ||
| 28 | |||
| 29 | Returns the name of the argument I<arg>. | ||
| 30 | |||
| 31 | =head2 get_index | ||
| 32 | |||
| 33 | C<int32_t (*get_index)(L<SPVM_NATIVE_RUNTIME* runtime|SPVM::Document::NativeAPI::Runtime>, L<SPVM_NATIVE_ARG* arg|SPVM::Document::NativeAPI::Argument>);> | ||
| 34 | |||
| 35 | Returns the index of the argument I<arg>. | ||
| 36 | |||
| 37 | =head2 get_basic_type | ||
| 38 | |||
| 39 | C<SPVM_NATIVE_BASIC_TYPE* (*get_basic_type)(L<SPVM_NATIVE_RUNTIME* runtime|SPVM::Document::NativeAPI::Runtime>, L<SPVM_NATIVE_ARG* arg|SPVM::Document::NativeAPI::Argument>);> | ||
| 40 | |||
| 41 | Returns the L<basic type|SPVM::Document::NativeAPI::BasicType> of the argument I<arg>. | ||
| 42 | |||
| 43 | =head2 get_type_dimension | ||
| 44 | |||
| 45 | C<int32_t (*get_type_dimension)(L<SPVM_NATIVE_RUNTIME* runtime|SPVM::Document::NativeAPI::Runtime>, L<SPVM_NATIVE_ARG* arg|SPVM::Document::NativeAPI::Argument>);> | ||
| 46 | |||
| 47 | Returns the type dimension of the argument I<arg>. | ||
| 48 | |||
| 49 | =head2 get_type_flag | ||
| 50 | |||
| 51 | C<int32_t (*get_type_flag)(L<SPVM_NATIVE_RUNTIME* runtime|SPVM::Document::NativeAPI::Runtime>, L<SPVM_NATIVE_ARG* arg|SPVM::Document::NativeAPI::Argument>);> | ||
| 52 | |||
| 53 | Returns the L<type flag ID|SPVM::Document::NativeAPI/"Type Flag IDs"> of the argument I<arg>. | ||
| 54 | |||
| 55 | =head2 get_stack_index | ||
| 56 | |||
| 57 | C<int32_t (*get_stack_index)(L<SPVM_NATIVE_RUNTIME* runtime|SPVM::Document::NativeAPI::Runtime>, L<SPVM_NATIVE_ARG* arg|SPVM::Document::NativeAPI::Argument>);> | ||
| 58 | |||
| 59 | Returns the stack index of the argument I<arg>. The stack index is the position in a L<runtime stack|SPVM::Document::NativeClass/"Runtime Stack">. | ||
| 60 | |||
| 61 | =head2 get_current_method | ||
| 62 | |||
| 63 | C<SPVM_NATIVE_METHOD* (*get_current_method)(L<SPVM_NATIVE_RUNTIME* runtime|SPVM::Document::NativeAPI::Runtime>, L<SPVM_NATIVE_ARG* arg|SPVM::Document::NativeAPI::Argument>);> | ||
| 64 | |||
| 65 | Returns the L<method|SPVM::Document::NativeAPI::Method> that owns the argument I<arg>. | ||
| 66 | |||
| 67 | =head2 is_optional | ||
| 68 | |||
| 69 | C<int32_t (*is_optional)(L<SPVM_NATIVE_RUNTIME* runtime|SPVM::Document::NativeAPI::Runtime>, L<SPVM_NATIVE_ARG* arg|SPVM::Document::NativeAPI::Argument>);> | ||
| 70 | |||
| 71 | If the argument I<arg> is an optional argument, returns 1, otherwise returns 0. | ||
| 72 | |||
| 73 | =head2 get_default_value | ||
| 74 | |||
| 75 | C<SPVM_VALUE (*get_default_value)(L<SPVM_NATIVE_RUNTIME* runtime|SPVM::Document::NativeAPI::Runtime>, L<SPVM_NATIVE_ARG* arg|SPVM::Document::NativeAPI::Argument>);> | ||
| 76 | |||
| 77 | Returns the default value of the optional argument I<arg>. | ||
| 78 | |||
| 79 | =head1 Native API IDs | ||
| 80 | |||
| 81 | 0 get_name | ||
| 82 | 1 get_index | ||
| 83 | 2 get_basic_type | ||
| 84 | 3 get_type_dimension | ||
| 85 | 4 get_type_flag | ||
| 86 | 5 get_stack_index | ||
| 87 | 6 get_current_method | ||
| 88 | 7 is_optional | ||
| 89 | 8 get_default_value | ||
| 90 | |||
| 91 | =head1 See Also | ||
| 92 | |||
| 93 | =over 2 | ||
| 94 | |||
| 95 | =item * L<SPVM::Document::NativeAPI> | ||
| 96 | |||
| 97 | =item * L<SPVM::Document::NativeAPI::Method> | ||
| 98 | |||
| 99 | =item * L<SPVM::Document::NativeClass> | ||
| 100 | |||
| 101 | =item * L<SPVM::Document> | ||
| 102 | |||
| 103 | =back | ||
| 104 | |||
| 105 | =head1 Copyright & License | ||
| 106 | |||
| 107 | Copyright (c) 2023 Yuki Kimoto | ||
| 108 | |||
| 109 | MIT License |