-
Notifications
You must be signed in to change notification settings - Fork 1
/
rb_native.h
158 lines (135 loc) · 4.88 KB
/
rb_native.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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
/* -HEADER----------------------------------------------------------------------
RapidBATCH
Copyright (C) 2008, 2009 by Phorward Software Technologies, Jan Max Meyer
http://www.phorward-software.com ++ mail@phorward-software.com
File: rb_native.h
Author: Jan Max Meyer
Usage: Header Template for the Native Function SDK
WARNING: THIS IS A HEADER FILE THAT IS USED TO GENERATED THE NATIVE
FUNCTION SDK FOR BOTH THE EXTERNAL AND INTERNAL BUILD.
DO NEVER USE THIS FILE DIRECTLY!
----------------------------------------------------------------------------- */
#include "rb_vm.h"
#define rb_param vm_stackitem*
#define rb_var vm_var*
/*
* Macros
*/
/********************************
NATIVE FUNCTION RELATED
********************************/
/* Native function parameters */
#define RB_FCT_PARMS \
rb_param _RB_RET, rb_param _RB_PARMS, int _RB_PARMS_COUNT
#define RB_FCT_PARMS_PASS_THROUGH \
_RB_RET, _RB_PARMS, _RB_PARMS_COUNT
/* Native function header macros */
#define RB_FCT( name ) \
int name( RB_FCT_PARMS )
/* Native function param access */
#define RB_FCT_PARM_COUNT() \
( _RB_PARMS_COUNT )
#define RB_FCT_PARM_ACCESS( num ) \
( ( ( num ) < _RB_PARMS_COUNT ) ? \
_RB_PARMS + (num) : (rb_param)NULL )
#define RB_FCT_RET \
( _RB_RET )
#ifdef __WITH_TRACE
#define RB_FCT_DUMP_PARMS() \
PARMS( "_RB_RET", "%p", _RB_RET ), \
PARMS( "_RB_PARMS", "%p", _RB_PARMS ), \
PARMS( "_RB_PARMS_COUNT", "%d", _RB_PARMS_COUNT )
#else
#define RB_FCT_DUMP_PARMS()
#endif
/********************************
NATIVE VARIABLE RELATED
********************************/
/* Native function parameters */
#define RB_VARFCT_PARMS \
rb_param _RB_VAL
#define RB_VARFCT_PARMS_PASS_TROUGH \
_RB_VAL
/* System variable header macros */
#define RB_VARFCT( name ) \
int name( RB_VARFCT_PARMS )
/* Native function param access */
#define RB_VARFCT_VAL \
( _RB_VAL )
#ifdef __WITH_TRACE
#define RB_VARFCT_DUMP_PARMS() \
PARMS( "_RB_VAL", "%p", _RB_VAL )
#else
#define RB_VARFCT_DUMP_PARMS()
#endif
/********************************
PARAMETER VALUE ACCESS
********************************/
#define RB_PARM_VAL( parm ) ITEM_GET_VAL( parm )
#define RB_PARM_VAR( parm ) ITEM_GET_VAR( parm )
#define RB_PARM_IS_VAL( parm ) RB_PARM_VAL( parm )
#define RB_PARM_IS_VAR( parm ) RB_PARM_VAR( parm )
/* Value structure access (getter/setter macros) */
#define RB_PARM_VAL_GET_ULONG( parm ) ( RB_PARM_VAL( parm ) ? \
RB_VAL_GET_ADDR( \
RB_PARM_VAL( parm ) ) : \
(unsigned long)0 )
#define RB_PARM_VAL_GET_LONG( parm ) ( RB_PARM_VAL( parm ) ? \
RB_VAL_GET_LONG( \
RB_PARM_VAL( parm ) ) : 0L )
#define RB_PARM_VAL_GET_DBL( parm ) ( RB_PARM_VAL( parm ) ? \
RB_VAL_GET_DBL( \
RB_PARM_VAL( parm ) ) : 0.0 )
#define RB_PARM_VAL_GET_STR( parm ) ( RB_PARM_VAL( parm ) ? \
RB_VAL_GET_STR( \
RB_PARM_VAL( parm ) ) : \
(char*)NULL )
#define RB_PARM_VAL_SET_ULONG( parm, v ) ( RB_PARM_VAL( parm ) ? \
RB_VAL_SET_ADDR( RB_PARM_VAL( \
parm ), v ), 0 : \
-1 )
#define RB_PARM_VAL_SET_LONG( parm, v ) ( RB_PARM_VAL( parm ) ? \
RB_VAL_SET_LONG( RB_PARM_VAL( \
parm ), v ), 0 : \
-1 )
#define RB_PARM_VAL_SET_DBL( parm, v ) ( RB_PARM_VAL( parm ) ? \
RB_VAL_SET_DBL( RB_PARM_VAL( \
parm ), v ), 0 : \
-1 )
#define RB_PARM_VAL_SET_CSTR( parm, v ) ( RB_PARM_VAL( parm ) ? \
RB_VAL_SET_CSTR( RB_PARM_VAL( \
parm ), v ), 0 : \
-1 )
#define RB_PARM_VAL_SET_STR( parm, v ) ( RB_PARM_VAL( parm ) ? \
RB_VAL_SET_STR( RB_PARM_VAL( \
parm ), v ), 0 : \
-1 )
/* Variable structure access (getter/setter macros) */
#define RB_PARM_VAR_GET_ULONG( parm ) ( RB_PARM_VAR( parm ) ? \
RB_VAR_GET_ADDR( RB_PARM_VAR( \
parm ) ) : (unsigned long)0 )
#define RB_PARM_VAR_GET_LONG( parm ) ( RB_PARM_VAR( parm ) ? \
RB_VAR_GET_LONG( RB_PARM_VAR( \
parm ) ) : 0L )
#define RB_PARM_VAR_GET_DBL( parm ) ( RB_PARM_VAR( parm ) ? \
RB_VAR_GET_DBL( RB_PARM_VAR( \
parm ) ) : 0.0 )
#define RB_PARM_VAR_GET_STR( parm ) ( RB_PARM_VAR( parm ) ? \
RB_VAR_GET_STR( RB_PARM_VAR( \
parm ) ) : (char*)NULL )
#define RB_PARM_VAR_SET_ULONG( parm, v ) ( RB_PARM_VAR( parm ) ? \
RB_VAR_SET_ADDR( RB_PARM_VAR( \
parm ), v ), \
0 : -1 )
#define RB_PARM_VAR_SET_LONG( parm, v ) ( RB_PARM_VAR( parm ) ? \
RB_VAR_SET_LONG( RB_PARM_VAR( \
parm ), v ), \
0 : -1 )
#define RB_PARM_VAR_SET_DBL( parm, v ) ( RB_PARM_VAR( parm ) ? \
RB_VAR_SET_DBL( RB_PARM_VAR( \
parm ), v ), \
0 : -1 )
#define RB_PARM_VAR_SET_STR( parm, v ) ( RB_PARM_VAR( parm ) ? \
RB_VAR_SET_STR( RB_PARM_VAR( \
parm ), v ), \
0 : -1 )