mruby/c VM Source Code release 3.4
Loading...
Searching...
No Matches
value.c File Reference

mruby/c value definitions More...

#include "mrubyc.h"
Include dependency graph for value.c:

Go to the source code of this file.

Functions

int mrbc_compare (const mrbc_value *v1, const mrbc_value *v2)
mrbc_int_t mrbc_atoi (const char *s, int base)
int mrbc_strcpy (char *dest, int destsize, const char *src)
mrbc_int_t mrbc_val_i (struct VM *vm, const mrbc_value *val)
mrbc_int_t mrbc_val_i2 (struct VM *vm, const mrbc_value *val, mrbc_int_t default_value)
double mrbc_val_f (struct VM *vm, const mrbc_value *val)
double mrbc_val_f2 (struct VM *vm, const mrbc_value *val, double default_value)
const char * mrbc_val_s (struct VM *vm, const mrbc_value *val)
const char * mrbc_val_s2 (struct VM *vm, const mrbc_value *val, const char *default_value)
mrbc_int_t mrbc_to_i (struct VM *vm, mrbc_value v[], int argc, mrbc_value *val)
mrbc_float_t mrbc_to_f (struct VM *vm, mrbc_value v[], int argc, mrbc_value *val)
char * mrbc_to_s (struct VM *vm, mrbc_value v[], int argc, mrbc_value *val)
mrbc_valuemrbc_arg (struct VM *vm, mrbc_value v[], int argc, int n)
mrbc_int_t mrbc_arg_i (struct VM *vm, mrbc_value v[], int argc, int n)
mrbc_int_t mrbc_arg_i2 (struct VM *vm, mrbc_value v[], int argc, int n, mrbc_int_t default_value)
mrbc_float_t mrbc_arg_f (struct VM *vm, mrbc_value v[], int argc, int n)
mrbc_float_t mrbc_arg_f2 (struct VM *vm, mrbc_value v[], int argc, int n, mrbc_float_t default_value)
const char * mrbc_arg_s (struct VM *vm, mrbc_value v[], int argc, int n)
const char * mrbc_arg_s2 (struct VM *vm, mrbc_value v[], int argc, int n, const char *default_value)
int mrbc_arg_b (struct VM *vm, mrbc_value v[], int argc, int n)
int mrbc_arg_b2 (struct VM *vm, mrbc_value v[], int argc, int n, int default_value)

Variables

void(*const mrbc_delfunc [])(mrbc_value *)

Detailed Description

mruby/c value definitions

Copyright (C) 2015- Kyushu Institute of Technology.
Copyright (C) 2015- Shimane IT Open-Innovation Center.

This file is distributed under BSD 3-Clause License.

Definition in file value.c.

Function Documentation

◆ mrbc_arg()

mrbc_value * mrbc_arg ( struct VM * vm,
mrbc_value v[],
int argc,
int n )

(beta) Get a N'th argument pointer.

Parameters
vmpointer to vm.
vargument array.
argcnum of argument.
ntarget argument number.
Returns
pointer to mrbc_value.
Remarks
There is a useful macro MRBC_ARG().

Definition at line 530 of file value.c.

Here is the call graph for this function:

◆ mrbc_arg_b()

int mrbc_arg_b ( struct VM * vm,
mrbc_value v[],
int argc,
int n )

(beta) Get a True/False argument as a C integer.

Parameters
vmpointer to vm.
vargument array.
argcnum of argument.
ntarget argument number.
Returns
bool (0/1) value.
Remarks
There is a useful macro MRBC_ARG_B().

Definition at line 722 of file value.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mrbc_arg_b2()

int mrbc_arg_b2 ( struct VM * vm,
mrbc_value v[],
int argc,
int n,
int default_value )

(beta) Get a True/False argument as a C integer with default value.

Parameters
vmpointer to vm.
vargument array.
argcnum of argument.
ntarget argument number.
default_valuedefault value.
Returns
bool (0/1) value.
Remarks
There is a useful macro MRBC_ARG_B().

Definition at line 759 of file value.c.

Here is the call graph for this function:

◆ mrbc_arg_f()

mrbc_float_t mrbc_arg_f ( struct VM * vm,
mrbc_value v[],
int argc,
int n )

(beta) Get a argument as a C float (double).

Parameters
vmpointer to vm.
vargument array.
argcnum of argument.
ntarget argument number.
Returns
float value.
Remarks
There is a useful macro MRBC_ARG_F().

Definition at line 611 of file value.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mrbc_arg_f2()

mrbc_float_t mrbc_arg_f2 ( struct VM * vm,
mrbc_value v[],
int argc,
int n,
mrbc_float_t default_value )

(beta) Get a argument as a C float (double) with default value.

Parameters
vmpointer to vm.
vargument array.
argcnum of argument.
ntarget argument number.
default_valuedefault value.
Returns
float value.
Remarks
There is a useful macro MRBC_ARG_F().

Definition at line 648 of file value.c.

Here is the call graph for this function:

◆ mrbc_arg_i()

mrbc_int_t mrbc_arg_i ( struct VM * vm,
mrbc_value v[],
int argc,
int n )

(beta) Get a argument as a C integer.

Parameters
vmpointer to vm.
vargument array.
argcnum of argument.
ntarget argument number.
Returns
integer value.
Remarks
There is a useful macro MRBC_ARG_I().

Definition at line 554 of file value.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mrbc_arg_i2()

mrbc_int_t mrbc_arg_i2 ( struct VM * vm,
mrbc_value v[],
int argc,
int n,
mrbc_int_t default_value )

(beta) Get a argument as a C integer with default value.

Parameters
vmpointer to vm.
vargument array.
argcnum of argument.
ntarget argument number.
default_valuedefault value.
Returns
integer value.
Remarks
There is a useful macro MRBC_ARG_I().

Definition at line 591 of file value.c.

Here is the call graph for this function:

◆ mrbc_arg_s()

const char * mrbc_arg_s ( struct VM * vm,
mrbc_value v[],
int argc,
int n )

(beta) Get a argument as a C string.

Parameters
vmpointer to vm.
vargument array.
argcnum of argument.
ntarget argument number.
Returns
pointer to C string.
Remarks
There is a useful macro MRBC_ARG_S().

Definition at line 668 of file value.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mrbc_arg_s2()

const char * mrbc_arg_s2 ( struct VM * vm,
mrbc_value v[],
int argc,
int n,
const char * default_value )

(beta) Get a argument as a C string with default value.

Parameters
vmpointer to vm.
vargument array.
argcnum of argument.
ntarget argument number.
default_valuedefault value.
Returns
pointer to C string.
Remarks
There is a useful macro MRBC_ARG_S().

Definition at line 702 of file value.c.

Here is the call graph for this function:

◆ mrbc_atoi()

mrbc_int_t mrbc_atoi ( const char * s,
int base )

convert ASCII string to integer mruby/c version

Parameters
ssource string.
basen base.
Returns
result.

Definition at line 186 of file value.c.

◆ mrbc_compare()

int mrbc_compare ( const mrbc_value * v1,
const mrbc_value * v2 )

compare two mrbc_values

Parameters
v1Pointer to mrbc_value
v2Pointer to another mrbc_value
Return values
0v1 == v2
plusv1 > v2
minusv1 < v2

Definition at line 66 of file value.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mrbc_strcpy()

int mrbc_strcpy ( char * dest,
int destsize,
const char * src )

string copy

Parameters
destdestination buffer.
destsizebuffer size.
srcsource.
Returns
int number of bytes copied.

Definition at line 239 of file value.c.

Here is the caller graph for this function:

◆ mrbc_to_f()

mrbc_float_t mrbc_to_f ( struct VM * vm,
mrbc_value v[],
int argc,
mrbc_value * val )

(beta) Convert mrbc_value type to Float.

Parameters
vmpointer to vm.
vargument array.
argcnum of argument.
valtarget value.
Returns
float value.
Remarks
There is a useful macro MRBC_TO_F().

Definition at line 451 of file value.c.

Here is the call graph for this function:

◆ mrbc_to_i()

mrbc_int_t mrbc_to_i ( struct VM * vm,
mrbc_value v[],
int argc,
mrbc_value * val )

(beta) Convert mrbc_value type to Integer.

Parameters
vmpointer to vm.
vargument array.
argcnum of argument.
valtarget value.
Returns
integer value.
Remarks
There is a useful macro MRBC_TO_I().

Definition at line 410 of file value.c.

Here is the call graph for this function:

◆ mrbc_to_s()

char * mrbc_to_s ( struct VM * vm,
mrbc_value v[],
int argc,
mrbc_value * val )

(beta) Convert mrbc_value type to String.

Parameters
vmpointer to vm.
vargument array.
argcnum of argument.
valtarget value.
Returns
pointer to C string or NULL.
Remarks
There is a useful macro MRBC_TO_S().

Definition at line 492 of file value.c.

Here is the call graph for this function:

◆ mrbc_val_f()

double mrbc_val_f ( struct VM * vm,
const mrbc_value * val )

(beta) mrbc_value accessor for double type return value.

Parameters
vmpointer to vm.
valtarget value.
Returns
integer value.
Remarks
There is a useful macro MRBC_VAL_F().

Definition at line 313 of file value.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mrbc_val_f2()

double mrbc_val_f2 ( struct VM * vm,
const mrbc_value * val,
double default_value )

(beta) mrbc_value accessor for double type return value. have a default value.

Parameters
vmpointer to vm.
valtarget value.
default_valuedefault value.
Returns
integer value.
Remarks
There is a useful macro MRBC_VAL_F().

Definition at line 344 of file value.c.

Here is the call graph for this function:

◆ mrbc_val_i()

mrbc_int_t mrbc_val_i ( struct VM * vm,
const mrbc_value * val )

(beta) mrbc_value accessor for int type return value.

Parameters
vmpointer to vm.
valtarget value.
Returns
integer value.
Remarks
There is a useful macro MRBC_VAL_I().

Definition at line 264 of file value.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mrbc_val_i2()

mrbc_int_t mrbc_val_i2 ( struct VM * vm,
const mrbc_value * val,
mrbc_int_t default_value )

(beta) mrbc_value accessor for int type return value. have a default value.

Parameters
vmpointer to vm.
valtarget value.
default_valuedefault value.
Returns
integer value.
Remarks
There is a useful macro MRBC_VAL_I().

Definition at line 295 of file value.c.

Here is the call graph for this function:

◆ mrbc_val_s()

const char * mrbc_val_s ( struct VM * vm,
const mrbc_value * val )

(beta) mrbc_value accessor for const char * type return value.

Parameters
vmpointer to vm.
valtarget value.
Returns
integer value.
Remarks
There is a useful macro MRBC_VAL_S().

Definition at line 362 of file value.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mrbc_val_s2()

const char * mrbc_val_s2 ( struct VM * vm,
const mrbc_value * val,
const char * default_value )

(beta) mrbc_value accessor for const char * type return value. have a default value.

Parameters
vmpointer to vm.
valtarget value.
default_valuedefault value.
Returns
integer value.
Remarks
There is a useful macro MRBC_VAL_S().

Definition at line 390 of file value.c.

Here is the call graph for this function:

Variable Documentation

◆ mrbc_delfunc

void(*const mrbc_delfunc[])(mrbc_value *) ( mrbc_value * )
Initial value:
= {
0, 0, 0, 0, 0, 0, 0, 0, 0,
}
void mrbc_array_delete(mrbc_value *ary)
Definition c_array.c:113
void mrbc_hash_delete(mrbc_value *hash)
Definition c_hash.c:108
void mrbc_proc_delete(mrbc_value *val)
Definition c_proc.c:73
void mrbc_range_delete(mrbc_value *v)
Definition c_range.c:64
void mrbc_string_delete(mrbc_value *str)
Definition c_string.c:129
void mrbc_instance_delete(mrbc_value *v)
Definition class.c:355
void mrbc_exception_delete(mrbc_value *value)
Definition error.c:133

function table for object delete.

Note
must be same order as mrbc_vtype.
See also
mrbc_vtype in value.h

Definition at line 37 of file value.c.