root/nativeif.c
/* [<][>][^][v][top][bottom][index][help] */
DEFINITIONS
This source file includes following definitions.
- CRB_object_get_string
- CRB_object_get_native_pointer
- CRB_object_set_native_pointer
- CRB_array_get
- CRB_array_set
#include "DBG.h"
#include "crowbar.h"
char *
CRB_object_get_string(CRB_Object *obj)
{
DBG_assert(obj->type == STRING_OBJECT,
("obj->type..%d\n", obj->type));
return obj->u.string.string;
}
void *
CRB_object_get_native_pointer(CRB_Object *obj)
{
DBG_assert(obj->type == NATIVE_POINTER_OBJECT,
("obj->type..%d\n", obj->type));
return obj->u.native_pointer.pointer;
}
void
CRB_object_set_native_pointer(CRB_Object *obj, void *p)
{
DBG_assert(obj->type == NATIVE_POINTER_OBJECT,
("obj->type..%d\n", obj->type));
obj->u.native_pointer.pointer = p;
}
CRB_Value *
CRB_array_get(CRB_Interpreter *inter, CRB_LocalEnvironment *env,
CRB_Object *obj, int index)
{
return &obj->u.array.array[index];
}
void
CRB_array_set(CRB_Interpreter *inter, CRB_LocalEnvironment *env,
CRB_Object *obj, int index, CRB_Value *value)
{
DBG_assert(obj->type == ARRAY_OBJECT,
("obj->type..%d\n", obj->type));
obj->u.array.array[index] = *value;
}