« blib/lib/SPVM/Document/NativeAPI/Compiler.pm
↑ Summary
blib/lib/SPVM/Document/NativeAPI/Internal.pm »
| 1 | =head1 Name | ||
| 2 | |||
| 3 | SPVM::Document::NativeAPI::Field - Field Native APIs | ||
| 4 | |||
| 5 | =head1 Description | ||
| 6 | |||
| 7 | The field native APIs in L<SPVM> are the APIs to get definition information for fields. | ||
| 8 | |||
| 9 | =head1 Usage | ||
| 10 | |||
| 11 | SPVM_API_FIELD* api_field = env->api->field; | ||
| 12 | |||
| 13 | SPVM_NATIVE_BASIC_TYPE* basic_type = env->get_basic_type(env, stack, "Foo"); | ||
| 14 | |||
| 15 | SPVM_NATIVE_FIELD* field = env->api->basic_type->get_field_by_name(env->runtime, basic_type, "value"); | ||
| 16 | |||
| 17 | const char* field_name = api_field->get_name(env->runtime, field); | ||
| 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_FIELD* field|SPVM::Document::NativeAPI::Field>);> | ||
| 24 | |||
| 25 | Returns the name of the field I<field>. | ||
| 26 | |||
| 27 | =head2 get_index | ||
| 28 | |||
| 29 | C<int32_t (*get_index)(L<SPVM_NATIVE_RUNTIME* runtime|SPVM::Document::NativeAPI::Runtime>, L<SPVM_NATIVE_FIELD* field|SPVM::Document::NativeAPI::Field>);> | ||
| 30 | |||
| 31 | Returns the index of the field I<field>. | ||
| 32 | |||
| 33 | =head2 get_offset | ||
| 34 | |||
| 35 | C<int32_t (*get_offset)(L<SPVM_NATIVE_RUNTIME* runtime|SPVM::Document::NativeAPI::Runtime>, L<SPVM_NATIVE_FIELD* field|SPVM::Document::NativeAPI::Field>);> | ||
| 36 | |||
| 37 | Returns the byte offset of the field I<field>. The byte offset is the position in bytes where the field is allocated in its belonging class. | ||
| 38 | |||
| 39 | =head2 get_basic_type | ||
| 40 | |||
| 41 | C<SPVM_NATIVE_BASIC_TYPE* (*get_basic_type)(L<SPVM_NATIVE_RUNTIME* runtime|SPVM::Document::NativeAPI::Runtime>, L<SPVM_NATIVE_FIELD* field|SPVM::Document::NativeAPI::Field>);> | ||
| 42 | |||
| 43 | Returns the L<basic type|SPVM::Document::NativeAPI::BasicType> of the field I<field>. | ||
| 44 | |||
| 45 | =head2 get_type_dimension | ||
| 46 | |||
| 47 | C<int32_t (*get_type_dimension)(L<SPVM_NATIVE_RUNTIME* runtime|SPVM::Document::NativeAPI::Runtime>, L<SPVM_NATIVE_FIELD* field|SPVM::Document::NativeAPI::Field>);> | ||
| 48 | |||
| 49 | Returns the type dimension of the field I<field>. | ||
| 50 | |||
| 51 | =head2 get_type_flag | ||
| 52 | |||
| 53 | C<int32_t (*get_type_flag)(L<SPVM_NATIVE_RUNTIME* runtime|SPVM::Document::NativeAPI::Runtime>, L<SPVM_NATIVE_FIELD* field|SPVM::Document::NativeAPI::Field>);> | ||
| 54 | |||
| 55 | Returns the L<type flag ID|SPVM::Document::NativeAPI/"Type Flag IDs"> of the field I<field>. | ||
| 56 | |||
| 57 | =head2 get_current_basic_type | ||
| 58 | |||
| 59 | C<SPVM_NATIVE_BASIC_TYPE* (*get_current_basic_type)(L<SPVM_NATIVE_RUNTIME* runtime|SPVM::Document::NativeAPI::Runtime>, L<SPVM_NATIVE_FIELD* field|SPVM::Document::NativeAPI::Field>);> | ||
| 60 | |||
| 61 | Returns the L<basic type|SPVM::Document::NativeAPI::BasicType> that owns the field I<field>. | ||
| 62 | |||
| 63 | =head2 get_exists_offset | ||
| 64 | |||
| 65 | C<int32_t (*get_exists_offset)(L<SPVM_NATIVE_RUNTIME* runtime|SPVM::Document::NativeAPI::Runtime>, L<SPVM_NATIVE_FIELD* field|SPVM::Document::NativeAPI::Field>);> | ||
| 66 | |||
| 67 | Returns the byte offset of the exists flag of the field I<field>. | ||
| 68 | |||
| 69 | =head2 get_exists_bit | ||
| 70 | |||
| 71 | C<int32_t (*get_exists_bit)(L<SPVM_NATIVE_RUNTIME* runtime|SPVM::Document::NativeAPI::Runtime>, L<SPVM_NATIVE_FIELD* field|SPVM::Document::NativeAPI::Field>);> | ||
| 72 | |||
| 73 | Return the bit shift of the exists flag of the field I<field>. | ||
| 74 | |||
| 75 | =head1 Native API IDs | ||
| 76 | |||
| 77 | 0 get_name | ||
| 78 | 1 get_index | ||
| 79 | 2 get_offset | ||
| 80 | 3 get_basic_type | ||
| 81 | 4 get_type_dimension | ||
| 82 | 5 get_type_flag | ||
| 83 | 6 get_current_basic_type | ||
| 84 | 7 get_exists_offset | ||
| 85 | 8 get_exists_bit | ||
| 86 | |||
| 87 | =head1 See Also | ||
| 88 | |||
| 89 | =over 2 | ||
| 90 | |||
| 91 | =item * L<SPVM::Document::NativeAPI> | ||
| 92 | |||
| 93 | =item * L<SPVM::Document::NativeClass> | ||
| 94 | |||
| 95 | =item * L<SPVM::Document> | ||
| 96 | |||
| 97 | =back | ||
| 98 | |||
| 99 | =head1 Copyright & License | ||
| 100 | |||
| 101 | Copyright (c) 2023 Yuki Kimoto | ||
| 102 | |||
| 103 | MIT License |