To do this, the
Neko library provides a series of allocation functions. Table 20 - 4 lists these functions:
Table 20 - 4
Function Description
alloc_int( int v ) Returns a Neko value from a C/C++ int .
alloc_float( float t ) Returns a Neko value from a C/C++ float .
alloc_bool( bool b ) Returns a Neko value from a C/C++ bool .
alloc_string( char *str ) Returns a copy of the string in a Neko value .
alloc_empty_string( unsigned
int size )
Returns a Neko value struct containing an empty string
value that is a given number of bytes in size.
copy_string( char *str, int_
val size )
The same as alloc_string() , except it will only copy a
given number of bytes.
alloc_object( value o ) Returns a C/C++ construct representing a Neko object
within a value struct. The value struct can also be NULL .
alloc_array( unsigned int n ) Creates an array of type value ( value* ) with a given size.
alloc_abstract( vkind k, void
*data )
Creates a value from a pointer to abstract data and flags the
value with the given identifier.
Pages:
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044