The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

Name

SPVM::Document::NativeAPI::Field - Field Native APIs

Description

The field native APIs in SPVM are the APIs to get definition information for fields.

Usage

  SPVM_API_FIELD* api_field = env->api->field;
  
  void* basic_type = env->get_basic_type(env, stack, "Foo");
  
  void* field = env->api->basic_type->get_field_by_name(env->runtime, basic_type, "value");
  
  const char* field_name = api_field->get_name(env->runtime, field);

Native APIs

get_name

const char* (*get_name)(void* runtime, void* field);

Returns the name of the field field.

get_index

int32_t (*get_index)(void* runtime, void* field);

Returns the index of the field field.

get_offset

int32_t (*get_offset)(void* runtime, void* field);

Returns the byte offset of the field field. The byte offset is the position in bytes where the field is allocated in its belonging class.

get_basic_type

void* (*get_basic_type)(void* runtime, void* field);

Returns the basic type of the field field.

get_type_dimension

int32_t (*get_type_dimension)(void* runtime, void* field);

Returns the type dimension of the field field.

get_type_flag

int32_t (*get_type_flag)(void* runtime, void* field);

Returns the type flag ID of the field field.

get_current_basic_type

void* (*get_current_basic_type)(void* runtime, void* field);

Returns the basic type that owns the field field.

Native API IDs

  0 get_name
  1 get_index
  2 get_offset
  3 get_basic_type
  4 get_type_dimension
  5 get_type_flag
  6 get_current_basic_type

See Also

Copyright & License

Copyright (c) 2023 Yuki Kimoto

MIT License