« blib/lib/SPVM/Document/NativeAPI/ClassFile.pm
↑ Summary
blib/lib/SPVM/Document/NativeAPI/Compiler.pm »
| 1 | =head1 Name | ||
| 2 | |||
| 3 | SPVM::Document::NativeAPI::ClassVariable - Class Variable Native APIs | ||
| 4 | |||
| 5 | =head1 Description | ||
| 6 | |||
| 7 | The class variable native APIs in L<SPVM> are the APIs to get definition information for class variables. | ||
| 8 | |||
| 9 | =head1 Usage | ||
| 10 | |||
| 11 | SPVM_API_CLASS_VAR* api_class_var = env->api->class_var; | ||
| 12 | |||
| 13 | SPVM_NATIVE_BASIC_TYPE* basic_type = env->get_basic_type(env, stack, "Foo"); | ||
| 14 | |||
| 15 | SPVM_NATIVE_CLASS_VAR* class_var = env->api->basic_type->get_class_var_by_name(env->runtime, basic_type, "$VAR"); | ||
| 16 | |||
| 17 | const char* class_var_name = api_class_var->get_name(env->runtime, class_var); | ||
| 18 | |||
| 19 | =head1 Native APIs | ||
| 20 | |||
| 21 | =head2 get_name | ||
| 22 | |||
| 23 | C<const char* (*get_name)(L<SPVM_NATIVE_RUNTIME* runtime|SPVM::Document::NativeAPI::Runtime>, L<SPVM_NATIVE_CLASS_VAR* class_var|SPVM::Document::NativeAPI::ClassVariable>);> | ||
| 24 | |||
| 25 | Returns the name of the class variable I<class_var>. | ||
| 26 | |||
| 27 | =head2 get_index | ||
| 28 | |||
| 29 | C<int32_t (*get_index)(L<SPVM_NATIVE_RUNTIME* runtime|SPVM::Document::NativeAPI::Runtime>, L<SPVM_NATIVE_CLASS_VAR* class_var|SPVM::Document::NativeAPI::ClassVariable>);> | ||
| 30 | |||
| 31 | Returns the index of the class variable I<class_var>. This index is the position of the class variable in its belonging class. | ||
| 32 | |||
| 33 | =head2 get_basic_type | ||
| 34 | |||
| 35 | C<SPVM_NATIVE_BASIC_TYPE* (*get_basic_type)(L<SPVM_NATIVE_RUNTIME* runtime|SPVM::Document::NativeAPI::Runtime>, L<SPVM_NATIVE_CLASS_VAR* class_var|SPVM::Document::NativeAPI::ClassVariable>);> | ||
| 36 | |||
| 37 | Returns the L<basic type|SPVM::Document::NativeAPI::BasicType> of the class variable I<class_var>. | ||
| 38 | |||
| 39 | =head2 get_type_dimension | ||
| 40 | |||
| 41 | C<int32_t (*get_type_dimension)(L<SPVM_NATIVE_RUNTIME* runtime|SPVM::Document::NativeAPI::Runtime>, L<SPVM_NATIVE_CLASS_VAR* class_var|SPVM::Document::NativeAPI::ClassVariable>);> | ||
| 42 | |||
| 43 | Returns the type dimension of the class variable I<class_var>. | ||
| 44 | |||
| 45 | =head2 get_type_flag | ||
| 46 | |||
| 47 | C<int32_t (*get_type_flag)(L<SPVM_NATIVE_RUNTIME* runtime|SPVM::Document::NativeAPI::Runtime>, L<SPVM_NATIVE_CLASS_VAR* class_var|SPVM::Document::NativeAPI::ClassVariable>);> | ||
| 48 | |||
| 49 | Returns the L<type flag ID|SPVM::Document::NativeAPI/"Type Flag IDs"> of the class variable I<class_var>. | ||
| 50 | |||
| 51 | =head2 get_current_basic_type | ||
| 52 | |||
| 53 | C<SPVM_NATIVE_BASIC_TYPE* (*get_current_basic_type)(L<SPVM_NATIVE_RUNTIME* runtime|SPVM::Document::NativeAPI::Runtime>, L<SPVM_NATIVE_CLASS_VAR* class_var|SPVM::Document::NativeAPI::ClassVariable>);> | ||
| 54 | |||
| 55 | Returns the L<basic type|SPVM::Document::NativeAPI::BasicType> that owns the class variable I<class_var>. | ||
| 56 | |||
| 57 | =head2 is_cache | ||
| 58 | |||
| 59 | C<int32_t (*is_cache)(L<SPVM_NATIVE_RUNTIME* runtime|SPVM::Document::NativeAPI::Runtime>, L<SPVM_NATIVE_CLASS_VAR* class_var|SPVM::Document::NativeAPI::ClassVariable>);> | ||
| 60 | |||
| 61 | If C<cache> class variable attribute is specified, returns 1, otherwise returns 0. | ||
| 62 | |||
| 63 | =head1 Native API IDs | ||
| 64 | |||
| 65 | 0 get_name | ||
| 66 | 1 get_index | ||
| 67 | 2 get_basic_type | ||
| 68 | 3 get_type_dimension | ||
| 69 | 4 get_type_flag | ||
| 70 | 5 get_current_basic_type | ||
| 71 | 6 is_cache | ||
| 72 | |||
| 73 | =head1 See Also | ||
| 74 | |||
| 75 | =over 2 | ||
| 76 | |||
| 77 | =item * L<SPVM::Document::NativeAPI> | ||
| 78 | |||
| 79 | =item * L<SPVM::Document::NativeClass> | ||
| 80 | |||
| 81 | =item * L<SPVM::Document> | ||
| 82 | |||
| 83 | =back | ||
| 84 | |||
| 85 | =head1 Copyright & License | ||
| 86 | |||
| 87 | Copyright (c) 2023 Yuki Kimoto | ||
| 88 | |||
| 89 | MIT License |