Name

SPVM::Document::NativeAPI::BasicType - Basic Type Native APIs

Description

The basic type native APIs in SPVM are the APIs to get definition information for basic types.

Usage

int32_t error_id

SPVM_API_BASIC_TYPE* api_basic_type = env->api->basic_type;

void* basic_type = env->get_basic_type(env, stack, "Int");

const char* basic_type_name = api_basic_type->get_name(env->runtime, basic_type);

Native APIs

get_name

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

Returns the name of the basic type basic_type.

get_id

int32_t (*get_id)(void* runtime, void* basic_type);

Returns the ID of the basic type basic_type.

get_category

int32_t (*get_category)(void* runtime, void* basic_type);

Returns the base type category ID of the basic type basic_type.

get_parent

void* (*get_parent)(void* runtime, void* basic_type);

Returns the parent basic type object of the basic type basic_type.

get_version_string

const char* (*get_version_string)(void* runtime, void* basic_type);

Returns the version string of the basic type basic_type.

get_class_dir

const char* (*get_class_dir)(void* runtime, void* basic_type);

Returns the class directory of the basic type basic_type.

get_class_rel_file

const char* (*get_class_rel_file)(void* runtime, void* basic_type);

Returns the class relative file of the basic type basic_type.

is_pointer

int32_t (*is_pointer)(void* runtime, void* basic_type);

If the basic type basic_type is a pointer class, returns 1, otherwise returns 0.

is_anon

int32_t (*is_anon)(void* runtime, void* basic_type);

If the basic type basic_type is an anon class, returns 1, otherwise returns 0.

get_class_var_by_index

void* (*get_class_var_by_index)(void* runtime, void* basic_type, int32_t class_var_index);

Searches a class variable owned by the basic type basic_type given the class variable index class_var_index.

If it is found, returns it. Otherwise, returns NULL.

get_class_var_by_name

void* (*get_class_var_by_name)(void* runtime, void* basic_type, const char* class_var_name);

Searches a class variable owned by the basic type basic_type given the class variable name class_var_name.

If it is found, returns it. Otherwise, returns NULL.

get_class_vars_length

int32_t (*get_class_vars_length)(void* runtime, void* basic_type);

Returns the length of the class variables owned by the basic type basic_type.

get_field_by_index

void* (*get_field_by_index)(void* runtime, void* basic_type, int32_t field_index);

Searches a field owned by the basic type basic_type given the field index field_index.

If it is found, returns it. Otherwise, returns NULL.

get_field_by_name

void* (*get_field_by_name)(void* runtime, void* basic_type, const char* field_name);

Searches a field owned by the basic type basic_type given the field name field_name.

If it is found, returns it. Otherwise, returns NULL.

get_fields_length

int32_t (*get_fields_length)(void* runtime, void* basic_type);

Returns the length of the fields owned by the basic type basic_type.

get_method_by_index

void* (*get_method_by_index)(void* runtime, void* basic_type, int32_t method_index);

Searches a method owned by the basic type basic_type given the method index method_index.

If it is found, returns it. Otherwise, returns NULL.

get_method_by_name

void* (*get_method_by_name)(void* runtime, void* basic_type, const char* method_name);

Searches a method owned by the basic type basic_type given the method name method_name.

If it is found, returns it. Otherwise, returns NULL.

get_methods_length

int32_t (*get_methods_length)(void* runtime, void* basic_type);

Returns the length of the methods owned by the basic type basic_type.

get_anon_basic_type_by_index

void* (*get_anon_basic_type_by_index)(void* runtime, void* basic_type, int32_t anon_basic_type_index);

Searches an anon basic type owned by the basic type basic_type given an anon basic type index anon_basic_type_index.

If it is found, returns it. Otherwise, returns NULL.

get_anon_basic_types_length

int32_t (*get_anon_basic_types_length)(void* runtime, void* basic_type);

Returns the length of the anon basic types owned by the basic type basic_type.

has_interface

int32_t (*has_interface)(void* runtime, void* basic_type, void* interface_basic_type);

If the basic type basic_type has an interface interface_basic_type, returns 1, otherwise returns 0.

is_super_class

int32_t (*is_super_class)(void* runtime, void* dist_basic_type, void* src_basic_type);

If dist_basic_type is a super class of src_basic_type, returns 1, otherwise returns 0.

get_file

const char* (*get_file)(void* runtime, void* basic_type);

Returns the file path of the basic type basic_type.

This can be changed by a file directive.

#file /tempaltes/foo.html.ep
class Foo {

}

get_current_runtime

void* (*get_current_runtime)(void* runtime, void* basic_type);

Returns the runtime that owns the basic type basic_type.

get_basic_type_in_version_from

void* (*get_basic_type_in_version_from)(void* runtime, void* basic_type);

void* (*get_basic_type_in_version_from)(void* runtime, void* basic_type)

Returns the basic type basic type object specified by version_from statement.

Native API IDs

0 get_name
1 get_id
2 get_category
3 get_parent
4 get_version_string
5 get_class_dir
6 get_class_rel_file
7 is_pointer
8 is_anon
9 get_class_var_by_index
10 get_class_var_by_name
11 get_class_vars_length
12 get_field_by_index
13 get_field_by_name
14 get_fields_length
15 get_method_by_index
16 get_method_by_name
17 get_methods_length
18 get_anon_basic_type_by_index
19 get_anon_basic_types_length
20 has_interface
21 is_super_class
22 get_file
23 get_current_runtime
24 get_basic_type_in_version_from

See Aloso

Copyright & License

Copyright (c) 2023 Yuki Kimoto

MIT License