-
Notifications
You must be signed in to change notification settings - Fork 25
/
CRB_dev.h
61 lines (51 loc) · 1.18 KB
/
CRB_dev.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#ifndef PUBLIC_CRB_DEV_H_INCLUDED
#define PUBLIC_CRB_DEV_H_INCLUDED
/**
* Crowbar 里面的布尔类型
*/
typedef enum {
CRB_FALSE = 0,
CRB_TRUE = 1
} CRB_Boolean;
/**
* CRB 里面的字符串类型
*/
typedef struct CRB_String_tag CRB_String;
typedef struct {
char *name;
} CRB_NativePointerInfo;
/**
* Crowbar 里面支持的所有的值类型
*/
typedef enum {
CRB_BOOLEAN_VALUE = 1,
CRB_INT_VALUE,
CRB_DOUBLE_VALUE,
CRB_STRING_VALUE,
CRB_NATIVE_POINTER_VALUE,
CRB_NULL_VALUE
} CRB_ValueType;
typedef struct {
CRB_NativePointerInfo *info;
void *pointer;
} CRB_NativePointer;
typedef struct {
CRB_ValueType type;
union {
CRB_Boolean boolean_value;
int int_value;
double double_value;
CRB_String *string_value;
CRB_NativePointer native_pointer;
}u;
} CRB_Value;
typedef CRB_Value CRB_NativeFunctionProc(CRB_Interpreter *interpreter,
int arg_count,
CRB_Value *args);
void CRB_add_native_function(CRB_Interpreter *interpreter,
char *name,
CRB_NativeFunctionProc *proc);
void CRB_add_global_variable(CRB_Interpreter *interpreter,
char *identifier,
CRB_Value *value);
#endif /* PUBLIC_CRB_DEV_H_INCLUDED */