-
Notifications
You must be signed in to change notification settings - Fork 8
/
flite.replacements
172 lines (154 loc) · 5.82 KB
/
flite.replacements
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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
convert c: #define TRUE (1 == 1)
to c: #define TRUE 1
convert c: #define FALSE (1 == 0)
to c: #define FALSE 0
convert c: #define DEF_CONST_VAL_INT(N, V) const cst_val_int N = {CST_VAL_TYPE_INT, -1, V}
to fb: #define DEF_CONST_VAL_INT(N, V) dim as const cst_val_int N = (CST_VAL_TYPE_INT, -1, V)
convert c: #define DEF_CONST_VAL_STRING(N, S) const cst_val_void N = {CST_VAL_TYPE_STRING, -1, (void *)S}
to fb: #define DEF_CONST_VAL_STRING(N, S) dim as const cst_val_void N = (CST_VAL_TYPE_STRING, -1, cptr(any ptr, S))
convert c: #define DEF_CONST_VAL_FLOAT(N, F) const cst_val_float N = {CST_VAL_TYPE_FLOAT, -1, (float)F}
to fb: #define DEF_CONST_VAL_FLOAT(N, F) dim as const cst_val_float N = (CST_VAL_TYPE_FLOAT, -1, csng(F))
convert c: #define DEF_CONST_VAL_CONS(N, A, D) const cst_val_cons N = {A, D}
to fb: #define DEF_CONST_VAL_CONS(N, A, D) dim as const cst_val_cons N = (A, D)
convert c: #define DEF_STATIC_CONST_VAL_INT(N, V) static DEF_CONST_VAL_INT(N, V)
to fb: #define DEF_STATIC_CONST_VAL_INT(N, V) static as const cst_val_int N = (CST_VAL_TYPE_INT, -1, V)
convert c: #define DEF_STATIC_CONST_VAL_STRING(N, S) static DEF_CONST_VAL_STRING(N, S)
to fb: #define DEF_STATIC_CONST_VAL_STRING(N, S) static as const cst_val_void N = (CST_VAL_TYPE_STRING, -1, cptr(any ptr, S))
convert c: #define DEF_STATIC_CONST_VAL_FLOAT(N, F) static DEF_CONST_VAL_FLOAT(N, F)
to fb: #define DEF_STATIC_CONST_VAL_FLOAT(N, F) static as const cst_val_float N = (CST_VAL_TYPE_FLOAT, -1, csng(F))
convert c: #define DEF_STATIC_CONST_VAL_CONS(N, A, D) static DEF_CONST_VAL_CONS(N, A, D)
to fb: #define DEF_STATIC_CONST_VAL_CONS(N, A, D) static as const cst_val_cons N = (A, D)
convert c:
#define CST_VAL_USER_TYPE_DCLS(NAME,TYPE)
extern const int cst_val_type_##NAME;
TYPE *val_##NAME(const cst_val *v);
cst_val *NAME##_val(const TYPE *v);
to fb:
#macro CST_VAL_USER_TYPE_DCLS(NAME, TYPE)
extern "C"
extern cst_val_type_##NAME as const long
declare function val_##NAME(byval v as const cst_val ptr) as TYPE ptr
declare function NAME##_val(byval v as const TYPE ptr) as cst_val ptr
end extern
#endmacro
convert c:
#define CST_VAL_USER_FUNCPTR_DCLS(NAME, TYPE)
extern const int cst_val_type_##NAME;
TYPE val_##NAME(const cst_val *v);
cst_val *NAME##_val(const TYPE v);
to fb:
#macro CST_VAL_USER_FUNCPTR_DCLS(NAME, TYPE)
extern "C"
extern cst_val_type_##NAME as const long
declare function val_##NAME(byval v as const cst_val ptr) as TYPE
declare function NAME##_val(byval v as const TYPE) as cst_val ptr
end extern
#endmacro
convert c:
#define CST_VAL_REGISTER_TYPE(NAME, TYPE)
TYPE *val_##NAME(const cst_val *v) {
return (TYPE *)val_generic(v,cst_val_type_##NAME,#NAME);
}
void val_delete_##NAME(void *v) {
delete_##NAME((TYPE *)v);
}
cst_val *NAME##_val(const TYPE *v) {
return val_new_typed(cst_val_type_##NAME, (void *)v);
}
to fb:
#macro CST_VAL_REGISTER_TYPE(NAME, TYPE)
extern "C"
function val_##NAME(byval v as const cst_val ptr) as TYPE ptr
return cptr(TYPE ptr, val_generic(v, cst_val_type_##NAME, #NAME))
end function
sub val_delete_##NAME(byval v as any ptr)
delete_##NAME(cptr(TYPE ptr, v))
end sub
function NAME##_val(byval v as const TYPE ptr) as cst_val ptr
return val_new_typed(cst_val_type_##NAME, cptr(any ptr, v))
end function
end extern
#endmacro
convert c:
#define CST_VAL_REG_TD_TYPE(NAME, TYPE, NUM)
extern const int cst_val_type_##NAME;
const int cst_val_type_##NAME = NUM;
void val_delete_##NAME(void *v);
to fb:
#macro CST_VAL_REG_TD_TYPE(NAME, TYPE, NUM)
extern "C"
extern cst_val_type_##NAME as const long
const cst_val_type_##NAME as long = NUM
declare sub val_delete_##NAME(byval v as any ptr)
end extern
#endmacro
convert c:
#define CST_VAL_REGISTER_TYPE_NODEL(NAME, TYPE)
TYPE *val_##NAME(const cst_val *v) {
return (TYPE *)val_generic(v, cst_val_type_##NAME, #NAME);
}
cst_val *NAME##_val(const TYPE *v) {
return val_new_typed(cst_val_type_##NAME, (void *)v);
}
to fb:
#macro CST_VAL_REGISTER_TYPE_NODEL(NAME, TYPE)
extern "C"
function val_##NAME(byval v as const cst_val ptr) as TYPE ptr
return cptr(TYPE ptr, val_generic(v, cst_val_type_##NAME, #NAME))
end function
function NAME##_val(byval v as const TYPE ptr) as cst_val ptr
return val_new_typed(cst_val_type_##NAME, cptr(any ptr, v))
end function
end extern
#endmacro
convert c:
#define CST_VAL_REG_TD_TYPE_NODEL(NAME, TYPE, NUM)
extern const int cst_val_type_##NAME;
const int cst_val_type_##NAME = NUM;
void val_delete_##NAME(void *v) {
(void)v;
}
to fb:
#macro CST_VAL_REG_TD_TYPE_NODEL(NAME, TYPE, NUM)
extern "C"
extern cst_val_type_##NAME as const long
const cst_val_type_##NAME as long = NUM
sub val_delete_##NAME(byval v as any ptr)
end sub
end extern
#endmacro
convert c:
#define CST_VAL_REGISTER_FUNCPTR(NAME, TYPE)
TYPE val_##NAME(const cst_val *v) {
return (TYPE)val_generic(v, cst_val_type_##NAME, #NAME);
}
cst_val *NAME##_val(const TYPE v) {
return val_new_typed(cst_val_type_##NAME, (void *)v);
}
to fb:
#macro CST_VAL_REGISTER_FUNCPTR(NAME, TYPE)
extern "C"
function val_##NAME(byval v as const cst_val ptr) as TYPE
return cast(TYPE, val_generic(v, cst_val_type_##NAME, #NAME))
end function
function NAME##_val(byval v as const TYPE) as cst_val ptr
return val_new_typed(cst_val_type_##NAME, cptr(any ptr, v))
end function
end extern
#endmacro
convert c:
#define CST_VAL_REG_TD_FUNCPTR(NAME, TYPE, NUM)
extern const int cst_val_type_##NAME;
const int cst_val_type_##NAME = NUM;
void val_delete_##NAME(void *v) {
(void)v;
}
to fb:
#macro CST_VAL_REG_TD_FUNCPTR(NAME, TYPE, NUM)
extern "C"
extern cst_val_type_##NAME as const long
const cst_val_type_##NAME as long = NUM
sub val_delete_##NAME(byval v as any ptr)
end sub
end extern
#endmacro