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::Argument - Argument Native APIs

Description

The argument native APIs in SPVM are the APIs to get definition information for arguments.

Usage

  SPVM_API_ARG* api_arg = env->api->arg;
  
  SPVM_API_METHOD* api_method = env->api->method;
  
  void* basic_type = env->get_basic_type(env, stack, "Foo");
  
  void* method = env->api->basic_type->get_method_by_name(env->runtime, basic_type, "get");
  
  void* arg = api_method->get_arg_by_index(env->runtime, method, 0);
  
  void* arg_basic_type = api_arg->get_basic_type(env->runtime, arg);

Native APIs

get_name

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

Returns the name of the argument arg.

get_index

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

Returns the index of the argument arg.

get_basic_type

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

Returns the basic type of the argument arg.

get_type_dimension

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

Returns the type dimention of the argument arg.

get_type_flag

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

Returns the type flag ID of the argument arg.

get_stack_index

int32_t (*get_stack_index)(void* runtime, void* arg);

Returns the stack index of the argument arg. The stack index is the position in a runtime stack.

get_current_method

void* (*get_current_method)(void* runtime, void* arg);

Returns the method that owns the argment arg.

is_optional

int32_t (*is_optional)(void* runtime, void* arg);

If the argument arg is an optional argument, returns 1. Otherwise, returns 0.

get_default_value

SPVM_VALUE (*get_default_value)(void* runtime, void* arg);

Returns the default value of the optional argument arg.

Native API IDs

  0 get_name
  1 get_index
  2 get_basic_type
  3 get_type_dimension
  4 get_type_flag
  5 get_stack_index
  6 get_current_method
  7 is_optional
  8 get_default_value

See Also

Copyright & License

Copyright (c) 2023 Yuki Kimoto

MIT License