071a2906fedbb50995acec354e3bbc24f1bc4345
[com/gs-lite.git] / cfg / external_fcns.def
1  ///////////////////////////////////////////////////////////
2 //          Matching predicates
3 ///////////////////////////////////////////////////////////
4         PRED [LFTA_LEGAL, COST HIGH]str_exists_substr[string, string];
5         PRED [LFTA_LEGAL, COST HIGH]str_compare[string,string];
6         PRED [LFTA_LEGAL, COST LOW] str_match_offset [uint,string,string];
7         PRED [LFTA_LEGAL, COST LOW] byte_match_offset [uint,uint,string];
8     
9 ///////////////////////////////////////////////////////////
10 //          MIN/MAX functions
11 ///////////////////////////////////////////////////////////
12
13 // return ullong
14         ullong FUN [LFTA_LEGAL, COST FREE] ULLMIN (uint,int);
15         ullong FUN [LFTA_LEGAL, COST FREE] ULLMIN (uint,uint);
16         ullong FUN [LFTA_LEGAL, COST FREE] ULLMIN (uint,llong);
17         ullong FUN [LFTA_LEGAL, COST FREE] ULLMIN (uint,ullong);
18         ullong FUN [LFTA_LEGAL, COST FREE] ULLMIN (uint,float);
19         ullong FUN [LFTA_LEGAL, COST FREE] ULLMIN (int,int);
20         ullong FUN [LFTA_LEGAL, COST FREE] ULLMIN (int,uint);
21         ullong FUN [LFTA_LEGAL, COST FREE] ULLMIN (int,llong);
22         ullong FUN [LFTA_LEGAL, COST FREE] ULLMIN (int,ullong);
23         ullong FUN [LFTA_LEGAL, COST FREE] ULLMIN (int,float);
24         ullong FUN [LFTA_LEGAL, COST FREE] ULLMIN (ullong,int);
25         ullong FUN [LFTA_LEGAL, COST FREE] ULLMIN (ullong,uint);
26         ullong FUN [LFTA_LEGAL, COST FREE] ULLMIN (ullong,llong);
27         ullong FUN [LFTA_LEGAL, COST FREE] ULLMIN (ullong,ullong);
28         ullong FUN [LFTA_LEGAL, COST FREE] ULLMIN (ullong,float);
29         ullong FUN [LFTA_LEGAL, COST FREE] ULLMIN (llong,int);
30         ullong FUN [LFTA_LEGAL, COST FREE] ULLMIN (llong,uint);
31         ullong FUN [LFTA_LEGAL, COST FREE] ULLMIN (llong,llong);
32         ullong FUN [LFTA_LEGAL, COST FREE] ULLMIN (llong,ullong);
33         ullong FUN [LFTA_LEGAL, COST FREE] ULLMIN (llong,float);
34         ullong FUN [LFTA_LEGAL, COST FREE] ULLMIN (float,int);
35         ullong FUN [LFTA_LEGAL, COST FREE] ULLMIN (float,uint);
36         ullong FUN [LFTA_LEGAL, COST FREE] ULLMIN (float,llong);
37         ullong FUN [LFTA_LEGAL, COST FREE] ULLMIN (float,ullong);
38         ullong FUN [LFTA_LEGAL, COST FREE] ULLMIN (float,float);
39
40         ullong FUN [LFTA_LEGAL, COST FREE] ULLMAX (uint,int);
41         ullong FUN [LFTA_LEGAL, COST FREE] ULLMAX (uint,uint);
42         ullong FUN [LFTA_LEGAL, COST FREE] ULLMAX (uint,llong);
43         ullong FUN [LFTA_LEGAL, COST FREE] ULLMAX (uint,ullong);
44         ullong FUN [LFTA_LEGAL, COST FREE] ULLMAX (uint,float);
45         ullong FUN [LFTA_LEGAL, COST FREE] ULLMAX (int,int);
46         ullong FUN [LFTA_LEGAL, COST FREE] ULLMAX (int,uint);
47         ullong FUN [LFTA_LEGAL, COST FREE] ULLMAX (int,llong);
48         ullong FUN [LFTA_LEGAL, COST FREE] ULLMAX (int,ullong);
49         ullong FUN [LFTA_LEGAL, COST FREE] ULLMAX (int,float);
50         ullong FUN [LFTA_LEGAL, COST FREE] ULLMAX (ullong,int);
51         ullong FUN [LFTA_LEGAL, COST FREE] ULLMAX (ullong,uint);
52         ullong FUN [LFTA_LEGAL, COST FREE] ULLMAX (ullong,llong);
53         ullong FUN [LFTA_LEGAL, COST FREE] ULLMAX (ullong,ullong);
54         ullong FUN [LFTA_LEGAL, COST FREE] ULLMAX (ullong,float);
55         ullong FUN [LFTA_LEGAL, COST FREE] ULLMAX (llong,int);
56         ullong FUN [LFTA_LEGAL, COST FREE] ULLMAX (llong,uint);
57         ullong FUN [LFTA_LEGAL, COST FREE] ULLMAX (llong,llong);
58         ullong FUN [LFTA_LEGAL, COST FREE] ULLMAX (llong,ullong);
59         ullong FUN [LFTA_LEGAL, COST FREE] ULLMAX (llong,float);
60         ullong FUN [LFTA_LEGAL, COST FREE] ULLMAX (float,int);
61         ullong FUN [LFTA_LEGAL, COST FREE] ULLMAX (float,uint);
62         ullong FUN [LFTA_LEGAL, COST FREE] ULLMAX (float,llong);
63         ullong FUN [LFTA_LEGAL, COST FREE] ULLMAX (float,ullong);
64         ullong FUN [LFTA_LEGAL, COST FREE] ULLMAX (float,float);
65
66 // return llong
67         ullong FUN [LFTA_LEGAL, COST FREE] LLMIN (uint,int);
68         ullong FUN [LFTA_LEGAL, COST FREE] LLMIN (uint,uint);
69         ullong FUN [LFTA_LEGAL, COST FREE] LLMIN (uint,llong);
70         ullong FUN [LFTA_LEGAL, COST FREE] LLMIN (uint,ullong);
71         ullong FUN [LFTA_LEGAL, COST FREE] LLMIN (uint,float);
72         ullong FUN [LFTA_LEGAL, COST FREE] LLMIN (int,int);
73         ullong FUN [LFTA_LEGAL, COST FREE] LLMIN (int,uint);
74         ullong FUN [LFTA_LEGAL, COST FREE] LLMIN (int,llong);
75         ullong FUN [LFTA_LEGAL, COST FREE] LLMIN (int,ullong);
76         ullong FUN [LFTA_LEGAL, COST FREE] LLMIN (int,float);
77         ullong FUN [LFTA_LEGAL, COST FREE] LLMIN (ullong,int);
78         ullong FUN [LFTA_LEGAL, COST FREE] LLMIN (ullong,uint);
79         ullong FUN [LFTA_LEGAL, COST FREE] LLMIN (ullong,llong);
80         ullong FUN [LFTA_LEGAL, COST FREE] LLMIN (ullong,ullong);
81         ullong FUN [LFTA_LEGAL, COST FREE] LLMIN (ullong,float);
82         ullong FUN [LFTA_LEGAL, COST FREE] LLMIN (llong,int);
83         ullong FUN [LFTA_LEGAL, COST FREE] LLMIN (llong,uint);
84         ullong FUN [LFTA_LEGAL, COST FREE] LLMIN (llong,llong);
85         ullong FUN [LFTA_LEGAL, COST FREE] LLMIN (llong,ullong);
86         ullong FUN [LFTA_LEGAL, COST FREE] LLMIN (llong,float);
87         ullong FUN [LFTA_LEGAL, COST FREE] LLMIN (float,int);
88         ullong FUN [LFTA_LEGAL, COST FREE] LLMIN (float,uint);
89         ullong FUN [LFTA_LEGAL, COST FREE] LLMIN (float,llong);
90         ullong FUN [LFTA_LEGAL, COST FREE] LLMIN (float,ullong);
91         ullong FUN [LFTA_LEGAL, COST FREE] LLMIN (float,float);
92
93         ullong FUN [LFTA_LEGAL, COST FREE] LLMAX (uint,int);
94         ullong FUN [LFTA_LEGAL, COST FREE] LLMAX (uint,uint);
95         ullong FUN [LFTA_LEGAL, COST FREE] LLMAX (uint,llong);
96         ullong FUN [LFTA_LEGAL, COST FREE] LLMAX (uint,ullong);
97         ullong FUN [LFTA_LEGAL, COST FREE] LLMAX (uint,float);
98         ullong FUN [LFTA_LEGAL, COST FREE] LLMAX (int,int);
99         ullong FUN [LFTA_LEGAL, COST FREE] LLMAX (int,uint);
100         ullong FUN [LFTA_LEGAL, COST FREE] LLMAX (int,llong);
101         ullong FUN [LFTA_LEGAL, COST FREE] LLMAX (int,ullong);
102         ullong FUN [LFTA_LEGAL, COST FREE] LLMAX (int,float);
103         ullong FUN [LFTA_LEGAL, COST FREE] LLMAX (ullong,int);
104         ullong FUN [LFTA_LEGAL, COST FREE] LLMAX (ullong,uint);
105         ullong FUN [LFTA_LEGAL, COST FREE] LLMAX (ullong,llong);
106         ullong FUN [LFTA_LEGAL, COST FREE] LLMAX (ullong,ullong);
107         ullong FUN [LFTA_LEGAL, COST FREE] LLMAX (ullong,float);
108         ullong FUN [LFTA_LEGAL, COST FREE] LLMAX (llong,int);
109         ullong FUN [LFTA_LEGAL, COST FREE] LLMAX (llong,uint);
110         ullong FUN [LFTA_LEGAL, COST FREE] LLMAX (llong,llong);
111         ullong FUN [LFTA_LEGAL, COST FREE] LLMAX (llong,ullong);
112         ullong FUN [LFTA_LEGAL, COST FREE] LLMAX (llong,float);
113         ullong FUN [LFTA_LEGAL, COST FREE] LLMAX (float,int);
114         ullong FUN [LFTA_LEGAL, COST FREE] LLMAX (float,uint);
115         ullong FUN [LFTA_LEGAL, COST FREE] LLMAX (float,llong);
116         ullong FUN [LFTA_LEGAL, COST FREE] LLMAX (float,ullong);
117         ullong FUN [LFTA_LEGAL, COST FREE] LLMAX (float,float);
118
119 // return uint
120         uint FUN [LFTA_LEGAL, COST FREE] UMIN (uint,int);
121         uint FUN [LFTA_LEGAL, COST FREE] UMIN (uint,uint);
122         uint FUN [LFTA_LEGAL, COST FREE] UMIN (uint,llong);
123         uint FUN [LFTA_LEGAL, COST FREE] UMIN (uint,ullong);
124         uint FUN [LFTA_LEGAL, COST FREE] UMIN (uint,float);
125         uint FUN [LFTA_LEGAL, COST FREE] UMIN (int,int);
126         uint FUN [LFTA_LEGAL, COST FREE] UMIN (int,uint);
127         uint FUN [LFTA_LEGAL, COST FREE] UMIN (int,llong);
128         uint FUN [LFTA_LEGAL, COST FREE] UMIN (int,ullong);
129         uint FUN [LFTA_LEGAL, COST FREE] UMIN (int,float);
130         uint FUN [LFTA_LEGAL, COST FREE] UMIN (ullong,int);
131         uint FUN [LFTA_LEGAL, COST FREE] UMIN (ullong,uint);
132         uint FUN [LFTA_LEGAL, COST FREE] UMIN (ullong,llong);
133         uint FUN [LFTA_LEGAL, COST FREE] UMIN (ullong,ullong);
134         uint FUN [LFTA_LEGAL, COST FREE] UMIN (ullong,float);
135         uint FUN [LFTA_LEGAL, COST FREE] UMIN (llong,int);
136         uint FUN [LFTA_LEGAL, COST FREE] UMIN (llong,uint);
137         uint FUN [LFTA_LEGAL, COST FREE] UMIN (llong,llong);
138         uint FUN [LFTA_LEGAL, COST FREE] UMIN (llong,ullong);
139         uint FUN [LFTA_LEGAL, COST FREE] UMIN (llong,float);
140         uint FUN [LFTA_LEGAL, COST FREE] UMIN (float,int);
141         uint FUN [LFTA_LEGAL, COST FREE] UMIN (float,uint);
142         uint FUN [LFTA_LEGAL, COST FREE] UMIN (float,llong);
143         uint FUN [LFTA_LEGAL, COST FREE] UMIN (float,ullong);
144         uint FUN [LFTA_LEGAL, COST FREE] UMIN (float,float);
145
146         uint FUN [LFTA_LEGAL, COST FREE] UMAX (uint,int);
147         uint FUN [LFTA_LEGAL, COST FREE] UMAX (uint,uint);
148         uint FUN [LFTA_LEGAL, COST FREE] UMAX (uint,llong);
149         uint FUN [LFTA_LEGAL, COST FREE] UMAX (uint,ullong);
150         uint FUN [LFTA_LEGAL, COST FREE] UMAX (uint,float);
151         uint FUN [LFTA_LEGAL, COST FREE] UMAX (int,int);
152         uint FUN [LFTA_LEGAL, COST FREE] UMAX (int,uint);
153         uint FUN [LFTA_LEGAL, COST FREE] UMAX (int,llong);
154         uint FUN [LFTA_LEGAL, COST FREE] UMAX (int,ullong);
155         uint FUN [LFTA_LEGAL, COST FREE] UMAX (int,float);
156         uint FUN [LFTA_LEGAL, COST FREE] UMAX (ullong,int);
157         uint FUN [LFTA_LEGAL, COST FREE] UMAX (ullong,uint);
158         uint FUN [LFTA_LEGAL, COST FREE] UMAX (ullong,llong);
159         uint FUN [LFTA_LEGAL, COST FREE] UMAX (ullong,ullong);
160         uint FUN [LFTA_LEGAL, COST FREE] UMAX (ullong,float);
161         uint FUN [LFTA_LEGAL, COST FREE] UMAX (llong,int);
162         uint FUN [LFTA_LEGAL, COST FREE] UMAX (llong,uint);
163         uint FUN [LFTA_LEGAL, COST FREE] UMAX (llong,llong);
164         uint FUN [LFTA_LEGAL, COST FREE] UMAX (llong,ullong);
165         uint FUN [LFTA_LEGAL, COST FREE] UMAX (llong,float);
166         uint FUN [LFTA_LEGAL, COST FREE] UMAX (float,int);
167         uint FUN [LFTA_LEGAL, COST FREE] UMAX (float,uint);
168         uint FUN [LFTA_LEGAL, COST FREE] UMAX (float,llong);
169         uint FUN [LFTA_LEGAL, COST FREE] UMAX (float,ullong);
170         uint FUN [LFTA_LEGAL, COST FREE] UMAX (float,float);
171
172 // return int
173         int FUN [LFTA_LEGAL, COST FREE] LMIN (uint,int);
174         int FUN [LFTA_LEGAL, COST FREE] LMIN (uint,uint);
175         int FUN [LFTA_LEGAL, COST FREE] LMIN (uint,llong);
176         int FUN [LFTA_LEGAL, COST FREE] LMIN (uint,ullong);
177         int FUN [LFTA_LEGAL, COST FREE] LMIN (uint,float);
178         int FUN [LFTA_LEGAL, COST FREE] LMIN (int,int);
179         int FUN [LFTA_LEGAL, COST FREE] LMIN (int,uint);
180         int FUN [LFTA_LEGAL, COST FREE] LMIN (int,llong);
181         int FUN [LFTA_LEGAL, COST FREE] LMIN (int,ullong);
182         int FUN [LFTA_LEGAL, COST FREE] LMIN (int,float);
183         int FUN [LFTA_LEGAL, COST FREE] LMIN (ullong,int);
184         int FUN [LFTA_LEGAL, COST FREE] LMIN (ullong,uint);
185         int FUN [LFTA_LEGAL, COST FREE] LMIN (ullong,llong);
186         int FUN [LFTA_LEGAL, COST FREE] LMIN (ullong,ullong);
187         int FUN [LFTA_LEGAL, COST FREE] LMIN (ullong,float);
188         int FUN [LFTA_LEGAL, COST FREE] LMIN (llong,int);
189         int FUN [LFTA_LEGAL, COST FREE] LMIN (llong,uint);
190         int FUN [LFTA_LEGAL, COST FREE] LMIN (llong,llong);
191         int FUN [LFTA_LEGAL, COST FREE] LMIN (llong,ullong);
192         int FUN [LFTA_LEGAL, COST FREE] LMIN (llong,float);
193         int FUN [LFTA_LEGAL, COST FREE] LMIN (float,int);
194         int FUN [LFTA_LEGAL, COST FREE] LMIN (float,uint);
195         int FUN [LFTA_LEGAL, COST FREE] LMIN (float,llong);
196         int FUN [LFTA_LEGAL, COST FREE] LMIN (float,ullong);
197         int FUN [LFTA_LEGAL, COST FREE] LMIN (float,float);
198
199         int FUN [LFTA_LEGAL, COST FREE] LMAX (uint,int);
200         int FUN [LFTA_LEGAL, COST FREE] LMAX (uint,uint);
201         int FUN [LFTA_LEGAL, COST FREE] LMAX (uint,llong);
202         int FUN [LFTA_LEGAL, COST FREE] LMAX (uint,ullong);
203         int FUN [LFTA_LEGAL, COST FREE] LMAX (uint,float);
204         int FUN [LFTA_LEGAL, COST FREE] LMAX (int,int);
205         int FUN [LFTA_LEGAL, COST FREE] LMAX (int,uint);
206         int FUN [LFTA_LEGAL, COST FREE] LMAX (int,llong);
207         int FUN [LFTA_LEGAL, COST FREE] LMAX (int,ullong);
208         int FUN [LFTA_LEGAL, COST FREE] LMAX (int,float);
209         int FUN [LFTA_LEGAL, COST FREE] LMAX (ullong,int);
210         int FUN [LFTA_LEGAL, COST FREE] LMAX (ullong,uint);
211         int FUN [LFTA_LEGAL, COST FREE] LMAX (ullong,llong);
212         int FUN [LFTA_LEGAL, COST FREE] LMAX (ullong,ullong);
213         int FUN [LFTA_LEGAL, COST FREE] LMAX (ullong,float);
214         int FUN [LFTA_LEGAL, COST FREE] LMAX (llong,int);
215         int FUN [LFTA_LEGAL, COST FREE] LMAX (llong,uint);
216         int FUN [LFTA_LEGAL, COST FREE] LMAX (llong,llong);
217         int FUN [LFTA_LEGAL, COST FREE] LMAX (llong,ullong);
218         int FUN [LFTA_LEGAL, COST FREE] LMAX (llong,float);
219         int FUN [LFTA_LEGAL, COST FREE] LMAX (float,int);
220         int FUN [LFTA_LEGAL, COST FREE] LMAX (float,uint);
221         int FUN [LFTA_LEGAL, COST FREE] LMAX (float,llong);
222         int FUN [LFTA_LEGAL, COST FREE] LMAX (float,ullong);
223         int FUN [LFTA_LEGAL, COST FREE] LMAX (float,float);
224
225 // return float
226         float FUN [LFTA_LEGAL, COST FREE] FMIN (uint,int);
227         float FUN [LFTA_LEGAL, COST FREE] FMIN (uint,uint);
228         float FUN [LFTA_LEGAL, COST FREE] FMIN (uint,llong);
229         float FUN [LFTA_LEGAL, COST FREE] FMIN (uint,ullong);
230         float FUN [LFTA_LEGAL, COST FREE] FMIN (uint,float);
231         float FUN [LFTA_LEGAL, COST FREE] FMIN (int,int);
232         float FUN [LFTA_LEGAL, COST FREE] FMIN (int,uint);
233         float FUN [LFTA_LEGAL, COST FREE] FMIN (int,llong);
234         float FUN [LFTA_LEGAL, COST FREE] FMIN (int,ullong);
235         float FUN [LFTA_LEGAL, COST FREE] FMIN (int,float);
236         float FUN [LFTA_LEGAL, COST FREE] FMIN (ullong,int);
237         float FUN [LFTA_LEGAL, COST FREE] FMIN (ullong,uint);
238         float FUN [LFTA_LEGAL, COST FREE] FMIN (ullong,llong);
239         float FUN [LFTA_LEGAL, COST FREE] FMIN (ullong,ullong);
240         float FUN [LFTA_LEGAL, COST FREE] FMIN (ullong,float);
241         float FUN [LFTA_LEGAL, COST FREE] FMIN (llong,int);
242         float FUN [LFTA_LEGAL, COST FREE] FMIN (llong,uint);
243         float FUN [LFTA_LEGAL, COST FREE] FMIN (llong,llong);
244         float FUN [LFTA_LEGAL, COST FREE] FMIN (llong,ullong);
245         float FUN [LFTA_LEGAL, COST FREE] FMIN (llong,float);
246         float FUN [LFTA_LEGAL, COST FREE] FMIN (float,int);
247         float FUN [LFTA_LEGAL, COST FREE] FMIN (float,uint);
248         float FUN [LFTA_LEGAL, COST FREE] FMIN (float,llong);
249         float FUN [LFTA_LEGAL, COST FREE] FMIN (float,ullong);
250         float FUN [LFTA_LEGAL, COST FREE] FMIN (float,float);
251
252         float FUN [LFTA_LEGAL, COST FREE] FMAX (uint,int);
253         float FUN [LFTA_LEGAL, COST FREE] FMAX (uint,uint);
254         float FUN [LFTA_LEGAL, COST FREE] FMAX (uint,llong);
255         float FUN [LFTA_LEGAL, COST FREE] FMAX (uint,ullong);
256         float FUN [LFTA_LEGAL, COST FREE] FMAX (uint,float);
257         float FUN [LFTA_LEGAL, COST FREE] FMAX (int,int);
258         float FUN [LFTA_LEGAL, COST FREE] FMAX (int,uint);
259         float FUN [LFTA_LEGAL, COST FREE] FMAX (int,llong);
260         float FUN [LFTA_LEGAL, COST FREE] FMAX (int,ullong);
261         float FUN [LFTA_LEGAL, COST FREE] FMAX (int,float);
262         float FUN [LFTA_LEGAL, COST FREE] FMAX (ullong,int);
263         float FUN [LFTA_LEGAL, COST FREE] FMAX (ullong,uint);
264         float FUN [LFTA_LEGAL, COST FREE] FMAX (ullong,llong);
265         float FUN [LFTA_LEGAL, COST FREE] FMAX (ullong,ullong);
266         float FUN [LFTA_LEGAL, COST FREE] FMAX (ullong,float);
267         float FUN [LFTA_LEGAL, COST FREE] FMAX (llong,int);
268         float FUN [LFTA_LEGAL, COST FREE] FMAX (llong,uint);
269         float FUN [LFTA_LEGAL, COST FREE] FMAX (llong,llong);
270         float FUN [LFTA_LEGAL, COST FREE] FMAX (llong,ullong);
271         float FUN [LFTA_LEGAL, COST FREE] FMAX (llong,float);
272         float FUN [LFTA_LEGAL, COST FREE] FMAX (float,int);
273         float FUN [LFTA_LEGAL, COST FREE] FMAX (float,uint);
274         float FUN [LFTA_LEGAL, COST FREE] FMAX (float,llong);
275         float FUN [LFTA_LEGAL, COST FREE] FMAX (float,ullong);
276         float FUN [LFTA_LEGAL, COST FREE] FMAX (float,float);
277
278 // return IP
279         IP FUN [LFTA_LEGAL, COST FREE] UMIN (IP,IP);
280         IP FUN [LFTA_LEGAL, COST FREE] UMAX (IP,IP);
281    
282 ///////////////////////////////////////////////////////////
283 //          conditional functions
284 ///////////////////////////////////////////////////////////
285
286 // rhs == lhs
287         uint FUN [LFTA_LEGAL, COST FREE] EQ (uint, int);
288         uint FUN [LFTA_LEGAL, COST FREE] EQ (uint, uint);
289         uint FUN [LFTA_LEGAL, COST FREE] EQ (uint, llong);
290         uint FUN [LFTA_LEGAL, COST FREE] EQ (uint, ullong);
291         uint FUN [LFTA_LEGAL, COST FREE] EQ (uint, float);
292         uint FUN [LFTA_LEGAL, COST FREE] EQ (int, int);
293         uint FUN [LFTA_LEGAL, COST FREE] EQ (int, uint);
294         uint FUN [LFTA_LEGAL, COST FREE] EQ (int, llong);
295         uint FUN [LFTA_LEGAL, COST FREE] EQ (int, ullong);
296         uint FUN [LFTA_LEGAL, COST FREE] EQ (int, float);
297         uint FUN [LFTA_LEGAL, COST FREE] EQ (ullong, int);
298         uint FUN [LFTA_LEGAL, COST FREE] EQ (ullong, uint);
299         uint FUN [LFTA_LEGAL, COST FREE] EQ (ullong, llong);
300         uint FUN [LFTA_LEGAL, COST FREE] EQ (ullong, ullong);
301         uint FUN [LFTA_LEGAL, COST FREE] EQ (ullong, float);
302         uint FUN [LFTA_LEGAL, COST FREE] EQ (llong, int);
303         uint FUN [LFTA_LEGAL, COST FREE] EQ (llong, uint);
304         uint FUN [LFTA_LEGAL, COST FREE] EQ (llong, llong);
305         uint FUN [LFTA_LEGAL, COST FREE] EQ (llong, ullong);
306         uint FUN [LFTA_LEGAL, COST FREE] EQ (llong, float);
307         uint FUN [LFTA_LEGAL, COST FREE] EQ (float, int);
308         uint FUN [LFTA_LEGAL, COST FREE] EQ (float, uint);
309         uint FUN [LFTA_LEGAL, COST FREE] EQ (float, llong);
310         uint FUN [LFTA_LEGAL, COST FREE] EQ (float, ullong);
311         uint FUN [LFTA_LEGAL, COST FREE] EQ (float, float);
312
313 // rhs >= lhs
314         uint FUN [LFTA_LEGAL, COST FREE] GEQ (uint, int);
315         uint FUN [LFTA_LEGAL, COST FREE] GEQ (uint, uint);
316         uint FUN [LFTA_LEGAL, COST FREE] GEQ (uint, llong);
317         uint FUN [LFTA_LEGAL, COST FREE] GEQ (uint, ullong);
318         uint FUN [LFTA_LEGAL, COST FREE] GEQ (uint, float);
319         uint FUN [LFTA_LEGAL, COST FREE] GEQ (int, int);
320         uint FUN [LFTA_LEGAL, COST FREE] GEQ (int, uint);
321         uint FUN [LFTA_LEGAL, COST FREE] GEQ (int, llong);
322         uint FUN [LFTA_LEGAL, COST FREE] GEQ (int, ullong);
323         uint FUN [LFTA_LEGAL, COST FREE] GEQ (int, float);
324         uint FUN [LFTA_LEGAL, COST FREE] GEQ (ullong, int);
325         uint FUN [LFTA_LEGAL, COST FREE] GEQ (ullong, uint);
326         uint FUN [LFTA_LEGAL, COST FREE] GEQ (ullong, llong);
327         uint FUN [LFTA_LEGAL, COST FREE] GEQ (ullong, ullong);
328         uint FUN [LFTA_LEGAL, COST FREE] GEQ (ullong, float);
329         uint FUN [LFTA_LEGAL, COST FREE] GEQ (llong, int);
330         uint FUN [LFTA_LEGAL, COST FREE] GEQ (llong, uint);
331         uint FUN [LFTA_LEGAL, COST FREE] GEQ (llong, llong);
332         uint FUN [LFTA_LEGAL, COST FREE] GEQ (llong, ullong);
333         uint FUN [LFTA_LEGAL, COST FREE] GEQ (llong, float);
334         uint FUN [LFTA_LEGAL, COST FREE] GEQ (float, int);
335         uint FUN [LFTA_LEGAL, COST FREE] GEQ (float, uint);
336         uint FUN [LFTA_LEGAL, COST FREE] GEQ (float, llong);
337         uint FUN [LFTA_LEGAL, COST FREE] GEQ (float, ullong);
338         uint FUN [LFTA_LEGAL, COST FREE] GEQ (float, float);
339
340 // rhs > lhs
341         uint FUN [LFTA_LEGAL, COST FREE] GE (uint, int);
342         uint FUN [LFTA_LEGAL, COST FREE] GE (uint, uint);
343         uint FUN [LFTA_LEGAL, COST FREE] GE (uint, llong);
344         uint FUN [LFTA_LEGAL, COST FREE] GE (uint, ullong);
345         uint FUN [LFTA_LEGAL, COST FREE] GE (uint, float);
346         uint FUN [LFTA_LEGAL, COST FREE] GE (int, int);
347         uint FUN [LFTA_LEGAL, COST FREE] GE (int, uint);
348         uint FUN [LFTA_LEGAL, COST FREE] GE (int, llong);
349         uint FUN [LFTA_LEGAL, COST FREE] GE (int, ullong);
350         uint FUN [LFTA_LEGAL, COST FREE] GE (int, float);
351         uint FUN [LFTA_LEGAL, COST FREE] GE (ullong, int);
352         uint FUN [LFTA_LEGAL, COST FREE] GE (ullong, uint);
353         uint FUN [LFTA_LEGAL, COST FREE] GE (ullong, llong);
354         uint FUN [LFTA_LEGAL, COST FREE] GE (ullong, ullong);
355         uint FUN [LFTA_LEGAL, COST FREE] GE (ullong, float);
356         uint FUN [LFTA_LEGAL, COST FREE] GE (llong, int);
357         uint FUN [LFTA_LEGAL, COST FREE] GE (llong, uint);
358         uint FUN [LFTA_LEGAL, COST FREE] GE (llong, llong);
359         uint FUN [LFTA_LEGAL, COST FREE] GE (llong, ullong);
360         uint FUN [LFTA_LEGAL, COST FREE] GE (llong, float);
361         uint FUN [LFTA_LEGAL, COST FREE] GE (float, int);
362         uint FUN [LFTA_LEGAL, COST FREE] GE (float, uint);
363         uint FUN [LFTA_LEGAL, COST FREE] GE (float, llong);
364         uint FUN [LFTA_LEGAL, COST FREE] GE (float, ullong);
365         uint FUN [LFTA_LEGAL, COST FREE] GE (float, float);
366
367 // rhs <= lhs
368         uint FUN [LFTA_LEGAL, COST FREE] LEQ (uint, int);
369         uint FUN [LFTA_LEGAL, COST FREE] LEQ (uint, uint);
370         uint FUN [LFTA_LEGAL, COST FREE] LEQ (uint, llong);
371         uint FUN [LFTA_LEGAL, COST FREE] LEQ (uint, ullong);
372         uint FUN [LFTA_LEGAL, COST FREE] LEQ (uint, float);
373         uint FUN [LFTA_LEGAL, COST FREE] LEQ (int, int);
374         uint FUN [LFTA_LEGAL, COST FREE] LEQ (int, uint);
375         uint FUN [LFTA_LEGAL, COST FREE] LEQ (int, llong);
376         uint FUN [LFTA_LEGAL, COST FREE] LEQ (int, ullong);
377         uint FUN [LFTA_LEGAL, COST FREE] LEQ (int, float);
378         uint FUN [LFTA_LEGAL, COST FREE] LEQ (ullong, int);
379         uint FUN [LFTA_LEGAL, COST FREE] LEQ (ullong, uint);
380         uint FUN [LFTA_LEGAL, COST FREE] LEQ (ullong, llong);
381         uint FUN [LFTA_LEGAL, COST FREE] LEQ (ullong, ullong);
382         uint FUN [LFTA_LEGAL, COST FREE] LEQ (ullong, float);
383         uint FUN [LFTA_LEGAL, COST FREE] LEQ (llong, int);
384         uint FUN [LFTA_LEGAL, COST FREE] LEQ (llong, uint);
385         uint FUN [LFTA_LEGAL, COST FREE] LEQ (llong, llong);
386         uint FUN [LFTA_LEGAL, COST FREE] LEQ (llong, ullong);
387         uint FUN [LFTA_LEGAL, COST FREE] LEQ (llong, float);
388         uint FUN [LFTA_LEGAL, COST FREE] LEQ (float, int);
389         uint FUN [LFTA_LEGAL, COST FREE] LEQ (float, uint);
390         uint FUN [LFTA_LEGAL, COST FREE] LEQ (float, llong);
391         uint FUN [LFTA_LEGAL, COST FREE] LEQ (float, ullong);
392         uint FUN [LFTA_LEGAL, COST FREE] LEQ (float, float);
393
394 // rhs < lhs
395         uint FUN [LFTA_LEGAL, COST FREE] LE (uint, int);
396         uint FUN [LFTA_LEGAL, COST FREE] LE (uint, uint);
397         uint FUN [LFTA_LEGAL, COST FREE] LE (uint, llong);
398         uint FUN [LFTA_LEGAL, COST FREE] LE (uint, ullong);
399         uint FUN [LFTA_LEGAL, COST FREE] LE (uint, float);
400         uint FUN [LFTA_LEGAL, COST FREE] LE (int, int);
401         uint FUN [LFTA_LEGAL, COST FREE] LE (int, uint);
402         uint FUN [LFTA_LEGAL, COST FREE] LE (int, llong);
403         uint FUN [LFTA_LEGAL, COST FREE] LE (int, ullong);
404         uint FUN [LFTA_LEGAL, COST FREE] LE (int, float);
405         uint FUN [LFTA_LEGAL, COST FREE] LE (ullong, int);
406         uint FUN [LFTA_LEGAL, COST FREE] LE (ullong, uint);
407         uint FUN [LFTA_LEGAL, COST FREE] LE (ullong, llong);
408         uint FUN [LFTA_LEGAL, COST FREE] LE (ullong, ullong);
409         uint FUN [LFTA_LEGAL, COST FREE] LE (ullong, float);
410         uint FUN [LFTA_LEGAL, COST FREE] LE (llong, int);
411         uint FUN [LFTA_LEGAL, COST FREE] LE (llong, uint);
412         uint FUN [LFTA_LEGAL, COST FREE] LE (llong, llong);
413         uint FUN [LFTA_LEGAL, COST FREE] LE (llong, ullong);
414         uint FUN [LFTA_LEGAL, COST FREE] LE (llong, float);
415         uint FUN [LFTA_LEGAL, COST FREE] LE (float, int);
416         uint FUN [LFTA_LEGAL, COST FREE] LE (float, uint);
417         uint FUN [LFTA_LEGAL, COST FREE] LE (float, llong);
418         uint FUN [LFTA_LEGAL, COST FREE] LE (float, ullong);
419         uint FUN [LFTA_LEGAL, COST FREE] LE (float, float);
420
421 //////////////////////////////////////////////////////////////
422 //      Conditional evaluation
423 //              add int, uint in the else clause to allow for constants
424 ///////////////////////////////////////////////////////
425
426         int FUN [LFTA_LEGAL, COST FREE] if_else_i(uint, int, int);
427         int FUN [LFTA_LEGAL, COST FREE] if_else_i(uint, int, uint);
428         uint FUN [LFTA_LEGAL, COST FREE] if_else_i(uint, uint, uint); 
429         uint FUN [LFTA_LEGAL, COST FREE] if_else_i(uint, uint, int);
430         llong FUN [LFTA_LEGAL, COST FREE] if_else_i(uint, llong, llong);
431         llong FUN [LFTA_LEGAL, COST FREE] if_else_i(uint, llong, uint);
432         llong FUN [LFTA_LEGAL, COST FREE] if_else_i(uint, llong, int);
433         ullong FUN [LFTA_LEGAL, COST FREE] if_else_i(uint, ullong, ullong);
434         ullong FUN [LFTA_LEGAL, COST FREE] if_else_i(uint, ullong, int);
435         ullong FUN [LFTA_LEGAL, COST FREE] if_else_i(uint, ullong, uint);
436
437
438 ///////////////////////////////////////////////////////////
439 //          Function for regex matching
440 ///////////////////////////////////////////////////////////
441
442         uint FUN [LFTA_LEGAL] endian_swap_ui(uint);
443
444 ///////////////////////////////////////////////////////////
445 //          Function for regex matching
446 ///////////////////////////////////////////////////////////
447
448
449 uint FUN [LFTA_LEGAL, COST EXPENSIVE]
450                 str_regex_match( string, string HANDLE);
451         uint FUN [LFTA_LEGAL, COST EXPENSIVE] 
452                 str_partial_regex_match( string, string HANDLE, uint);
453         string FUN [PARTIAL, COST EXPENSIVE] str_extract_regex( string, string HANDLE);
454   
455
456 ///////////////////////////////////////////////////////////
457 //         Truncating strings        
458 ///////////////////////////////////////////////////////////
459        
460         string FUN [LFTA_LEGAL,PARTIAL,COST FREE] str_truncate (string, uint);
461
462
463 ///////////////////////////////////////////////////////////
464 //         hashing
465 ///////////////////////////////////////////////////////////
466
467         uint FUN [LFTA_LEGAL] string_hash(string);
468         ullong FUN string_hash_long(string);
469
470  
471 ///////////////////////////////////////////////////////////
472 //          Function for casting
473 ///////////////////////////////////////////////////////////
474
475     int FUN [LFTA_LEGAL,COST FREE] non_temporal(int);
476         uint FUN [LFTA_LEGAL,COST FREE] non_temporal(uint);
477         llong FUN [LFTA_LEGAL,COST FREE] non_temporal(llong);
478         ullong FUN [LFTA_LEGAL,COST FREE] non_temporal(ullong);
479
480         int FUN [LFTA_LEGAL,COST FREE]INT(uint);
481         int FUN [LFTA_LEGAL,COST FREE]INT(int);
482     int FUN [LFTA_LEGAL,COST FREE]INT(ullong);
483     int FUN [LFTA_LEGAL,COST FREE]INT(llong);
484     int FUN [LFTA_LEGAL,COST FREE]INT(float);
485  
486     uint FUN [LFTA_LEGAL,COST FREE]UINT(uint);
487     uint FUN [LFTA_LEGAL,COST FREE]UINT(int);
488     uint FUN [LFTA_LEGAL,COST FREE]UINT(ullong);
489     uint FUN [LFTA_LEGAL,COST FREE]UINT(llong);
490     uint FUN [LFTA_LEGAL,COST FREE]UINT(float);
491         uint FUN [LFTA_LEGAL,COST FREE]UINT(IP);
492
493         float FUN [LFTA_LEGAL,COST FREE] FLOAT(llong);
494         float FUN [LFTA_LEGAL,COST FREE] FLOAT(float);
495         float FUN [LFTA_LEGAL,COST FREE] FLOAT(ullong);
496         float FUN [LFTA_LEGAL,COST FREE] FLOAT(int);
497         float FUN [LFTA_LEGAL,COST FREE] FLOAT(uint);
498
499         ullong FUN [LFTA_LEGAL,COST FREE]ULLONG(uint);
500         ullong FUN [LFTA_LEGAL,COST FREE]ULLONG(int);
501         ullong FUN [LFTA_LEGAL,COST FREE]ULLONG(ullong);
502         ullong FUN [LFTA_LEGAL,COST FREE]ULLONG(llong);
503         ullong FUN [LFTA_LEGAL,COST FREE]ULLONG(float);
504
505         llong FUN [LFTA_LEGAL,COST FREE]LLONG(uint);
506         llong FUN [LFTA_LEGAL,COST FREE]LLONG(int);
507         llong FUN [LFTA_LEGAL,COST FREE]LLONG(ullong);
508         llong FUN [LFTA_LEGAL,COST FREE]LLONG(llong);
509         llong FUN [LFTA_LEGAL,COST FREE]LLONG(float);
510
511 ///////////////////////////////////////////////////////////
512 //          Numeric functions
513 ///////////////////////////////////////////////////////////
514
515         float FUN [LFTA_LEGAL, COST LOW] sqrt(float); 
516         float FUN [LFTA_LEGAL, COST LOW] pow(float, float); 
517         float FUN [LFTA_LEGAL, COST LOW] sin(float); 
518         float FUN [LFTA_LEGAL, COST LOW] cos(float); 
519         float FUN [LFTA_LEGAL, COST LOW] tan(float); 
520         float FUN [LFTA_LEGAL, COST LOW] asin(float); 
521         float FUN [LFTA_LEGAL, COST LOW] acos(float); 
522         float FUN [LFTA_LEGAL, COST LOW] atan(float); 
523         float FUN [LFTA_LEGAL, COST LOW] log(float); 
524         float FUN [LFTA_LEGAL, COST LOW] log2(float); 
525         float FUN [LFTA_LEGAL, COST LOW] log10(float); 
526         float FUN [LFTA_LEGAL, COST LOW] ceil(float); 
527         float FUN [LFTA_LEGAL, COST LOW] floor(float); 
528         float FUN [LFTA_LEGAL, COST LOW] fmod(float); 
529         float FUN [LFTA_LEGAL, COST LOW] trunc(float); 
530
531
532
533 ///////////////////////////////////////////////////////////
534 //          Convert an IPv4 address 
535 ///////////////////////////////////////////////////////////
536
537
538     uint FUN [PARTIAL,COST HIGH] strtoi(string);
539         IP FUN [PARTIAL,COST HIGH] strtoip(string); 
540
541 //      for constant strings - faster at runtime
542         uint FUN [LFTA_LEGAL,COST LOW] strtoi_c(string HANDLE);
543         IP FUN [LFTA_LEGAL,COST LOW] strtoip_c(string HANDLE); 
544
545
546 ///////////////////////////////////////////////////////////
547 //          Compute running sum
548 ///////////////////////////////////////////////////////////
549
550
551
552     ullong UDAF [RUNNING, SUBAGGR moving_sum_lfta, SUPERAGGR super_moving_sum_udaf ] moving_sum_udaf fstring12 (uint, uint);
553
554         uint EXTR moving_sum moving_sum_udaf moving_sum_extract (uint,uint);
555         uint FUN  [COST LOW] moving_sum_extract(ullong);
556
557         float EXTR moving_sum_exp moving_sum_udaf moving_sum_extract_exp (uint,uint, float);
558         float FUN  [COST LOW]  moving_sum_extract_exp(ullong, float);
559
560         ullong UDAF [RUNNING] super_moving_sum_udaf fstring12 (ullong);
561         ullong UDAF moving_sum_lfta fstring8 (uint, uint);
562
563
564 ///////////////////////////////////////////////////////////
565 //               Compute the average of 
566 //              all positive numbers 
567 ///////////////////////////////////////////////////////////
568
569         float UDAF POSAVG fstring16(float);
570
571
572 ///////////////////////////////////////////////////////////
573 //               Simple average example 
574 ///////////////////////////////////////////////////////////
575
576         float EXTR extr_avg avg_udaf extr_avg_fcn (uint);
577         float FUN extr_avg_fcn (string);
578         string UDAF[SUBAGGR avg_udaf_lfta, SUPERAGGR avg_udaf_hfta] avg_udaf fstring12 (uint);
579         string UDAF avg_udaf_hfta fstring12 (string);
580         string UDAF avg_udaf_lfta fstring12 (uint);
581
582 ///////////////////////////////////////////////////////////
583 //               SAMPLING 
584 ///////////////////////////////////////////////////////////
585
586         fstring100 STATE smart_sampling_state;
587         int SFUN packet_count smart_sampling_state ();
588         float SFUN gamma smart_sampling_state ();
589         int SFUN do_clean_count smart_sampling_state ();
590         int SFUN init_threshold smart_sampling_state ();
591         int SFUN delay smart_sampling_state();
592         int SFUN newly_closed smart_sampling_state();
593
594 ///////////////////////////////////////////////////////////
595 //               Manku Heavy Hitter 
596 ///////////////////////////////////////////////////////////
597
598  
599         fstring20 STATE manku_hh_state;
600         BOOL SFUN local_count manku_hh_state (UINT);
601         int SFUN current_bucket manku_hh_state ();
602
603 ///////////////////////////////////////////////////////////
604 //         Flips approximate quantile
605 ///////////////////////////////////////////////////////////
606
607         uint EXTR quantile_of quant_udaf_hfta0 extr_quant_hfta0_fcn (uint, float);
608         uint  FUN [COST LOW] extr_quant_hfta0_fcn(string, float);
609         uint EXTR median_of quant_udaf_hfta0 extr_med_hfta0_fcn (uint);
610         uint  FUN [COST LOW] extr_med_hfta0_fcn(string);
611         uint EXTR qspace_of quant_udaf_hfta0 extr_quant_hfta0_space (uint);
612         uint  FUN [COST LOW] extr_quant_hfta0_space(string);
613         string UDAF [SUBAGGR quant_udaf_lfta3, SUPERAGGR quant_udaf_hfta3] quant_udaf_hfta0 fstring16 (uint);
614         string UDAF quant_udaf_hfta3 fstring16 (string);
615         string UDAF quant_udaf_lfta3 fstring6600 (uint);
616
617 ///////////////////////////////////////////////////////////
618 //               FIRST and LAST aggregation funciton
619 //      Should be replaced by builtins
620 ///////////////////////////////////////////////////////////
621
622 // FIRST
623         uint UDAF [RUNNING, SUBAGGR FIRST_lfta, SUPERAGGR FIRST_hfta] FIRST uint (uint);
624         uint UDAF [RUNNING] FIRST_hfta uint (uint);
625         uint UDAF [RUNNING] FIRST_lfta uint (uint);
626
627         int UDAF [RUNNING, SUBAGGR FIRST_INT_lfta, SUPERAGGR FIRST_INT_hfta] FIRST int (int);
628         int UDAF [RUNNING] FIRST_INT_hfta int (int);
629         int UDAF [RUNNING] FIRST_INT_lfta int (int);
630
631         ullong UDAF [RUNNING, SUBAGGR FIRST_ULL_lfta, SUPERAGGR FIRST_ULL_hfta] FIRST ullong (ullong);
632         ullong UDAF [RUNNING] FIRST_ULL_hfta ullong (ullong);
633         ullong UDAF [RUNNING] FIRST_ULL_lfta ullong (ullong);
634
635         llong UDAF [RUNNING, SUBAGGR FIRST_LL_lfta, SUPERAGGR FIRST_LL_hfta] FIRST llong (llong);
636         llong UDAF [RUNNING] FIRST_LL_hfta llong (llong);
637         llong UDAF [RUNNING] FIRST_LL_lfta llong (llong);
638
639         IP UDAF [RUNNING, SUBAGGR FIRST_lfta, SUPERAGGR FIRST_hfta] FIRST IP (IP);
640         IP UDAF [RUNNING] FIRST_hfta IP (IP);
641         IP UDAF [RUNNING] FIRST_lfta IP (IP);
642
643         string UDAF [RUNNING, SUBAGGR FIRST_STR_lfta, SUPERAGGR FIRST_STR_hfta] FIRST string (string);
644         string UDAF [RUNNING] FIRST_STR_hfta string (string);
645         string UDAF [RUNNING] FIRST_STR_lfta string (string);
646
647
648 // LAST
649         uint UDAF [RUNNING, SUBAGGR LAST_lfta, SUPERAGGR LAST_hfta] LAST uint (uint);
650         uint UDAF [RUNNING] LAST_hfta uint (uint);
651         uint UDAF [RUNNING] LAST_lfta uint (uint);
652
653         int UDAF [RUNNING, SUBAGGR LAST_INT_lfta, SUPERAGGR LAST_INT_hfta] LAST int (int);
654         int UDAF [RUNNING] LAST_INT_hfta int (int);
655         int UDAF [RUNNING] LAST_INT_lfta int (int);
656
657         ullong UDAF [RUNNING, SUBAGGR LAST_ULL_lfta, SUPERAGGR LAST_ULL_hfta] LAST ullong (ullong);
658         ullong UDAF [RUNNING] LAST_ULL_hfta ullong (ullong);
659         ullong UDAF [RUNNING] LAST_ULL_lfta ullong (ullong);
660
661         llong UDAF [RUNNING, SUBAGGR LAST_LL_lfta, SUPERAGGR LAST_LL_hfta] LAST llong (llong);
662         llong UDAF [RUNNING] LAST_LL_hfta llong (llong);
663         llong UDAF [RUNNING] LAST_LL_lfta llong (llong);
664
665         IP UDAF [RUNNING, SUBAGGR LAST_lfta, SUPERAGGR LAST_hfta] LAST IP (IP);
666         IP UDAF [RUNNING] LAST_hfta IP (IP);
667         IP UDAF [RUNNING] LAST_lfta IP (IP);
668
669         string UDAF [RUNNING, SUBAGGR LAST_STR_lfta, SUPERAGGR LAST_STR_hfta] LAST string (string);
670         string UDAF [RUNNING] LAST_STR_hfta string (string);
671         string UDAF [RUNNING] LAST_STR_lfta string (string);
672
673
674 ////////////////////////////////////////////////////////////
675 //      count_diff aggregation
676 //      count the # times the payload is different from the previous value
677 /////////////////////////////////////////////////////////////
678
679         uint UDAF [SUBAGGR count_diff_lfta_ui, SUPERAGGR count_diff_hfta] count_diff fstring12 (uint);
680         uint UDAF  count_diff_hfta fstring12 (string);
681         string UDAF  count_diff_lfta_ui fstring20 (uint);
682
683         uint UDAF [SUBAGGR count_diff_lfta_i, SUPERAGGR count_diff_hfta] count_diff fstring12 (int);
684         string UDAF  count_diff_lfta_i fstring20 (int);
685
686         uint UDAF [SUBAGGR count_diff_lfta_ul, SUPERAGGR count_diff_hfta] count_diff fstring12 (ullong);
687         string UDAF  count_diff_lfta_ul fstring20 (ullong);
688
689         uint UDAF [SUBAGGR count_diff_lfta_l, SUPERAGGR count_diff_hfta] count_diff fstring12 (llong);
690         string UDAF  count_diff_lfta_l fstring20 (llong);
691
692         uint UDAF [SUBAGGR count_diff_lfta_s, SUPERAGGR count_diff_hfta] count_diff fstring12 (string);
693         string UDAF  count_diff_lfta_s fstring20 (string);
694
695
696 ////////////////////////////////////////////////////////////////
697 //      string aggregation via catenation
698 //////////////////////////////////////////////////////
699
700         string UDAF [HFTA_ONLY] CAT_aggr fstring8 (string, string);
701
702 ///////////////////////////////////////////////////////////
703 //               integer array aggregation function
704 //      We are going to store 4 values in LFTA in fixed size buffer
705 //      plus one byte for array length (17 bytes total)
706 //      HFTA will combine partial aggregates
707 //              This seems to create a string with a comma-separated list of the uints
708 ///////////////////////////////////////////////////////////
709
710         string UDAF [RUNNING, SUBAGGR running_array_aggr_lfta, SUPERAGGR running_array_aggr_hfta] running_array_aggr string (uint);
711         string UDAF [RUNNING] running_array_aggr_hfta string (string);
712         string UDAF [RUNNING] running_array_aggr_lfta fstring17 (uint);
713         
714 //////////////////////////////////////////////////////////
715 //      Mapping functions
716 //      Should eventually be replaced by watchlist join ?
717 //////////////////////////////////
718         string FUN [HFTA_ONLY, COST EXPENSIVE] int_to_string_map(llong, string HANDLE);
719         string FUN [HFTA_ONLY, COST EXPENSIVE] int_to_string_map(ullong, string HANDLE);
720         string FUN [HFTA_ONLY, COST EXPENSIVE] int_to_string_map(int, string HANDLE);
721         string FUN [HFTA_ONLY, COST EXPENSIVE] int_to_string_map(uint, string HANDLE);
722
723 //////////////////////////////////////////////////////////
724 //      time-averaged aggregate.
725 //      time_avg(sample, ts, window_size)
726         float UDAF [HFTA_ONLY, RUNNING] time_avg fstring44 (uint, llong, llong) ;
727         float UDAF [HFTA_ONLY, RUNNING] time_avg fstring44 (int, llong, llong) ;
728         float UDAF [HFTA_ONLY, RUNNING] time_avg fstring44 (ullong, llong, llong) ;
729         float UDAF [HFTA_ONLY, RUNNING] time_avg fstring44 (llong, llong, llong) ;
730         float UDAF [HFTA_ONLY, RUNNING] time_avg fstring44 (float, llong, llong) ;
731
732 // ------------------------------------------------------------
733 //              running_sum_max : get the running sum of an int,
734 //              be able to report this sum and also its max value
735 //              during the time window
736
737         llong EXTR running_sum run_sum_max extr_running_sum (uint);
738         llong EXTR running_sum run_sum_max extr_running_sum (int);
739         llong EXTR running_sum run_sum_max extr_running_sum (llong);
740         llong EXTR running_sum run_sum_max extr_running_sum (ullong);
741         llong FUN [COST LOW] extr_running_sum(string);
742         llong EXTR running_sum_max run_sum_max extr_running_sum_max (uint);
743         llong EXTR running_sum_max run_sum_max extr_running_sum_max (int);
744         llong EXTR running_sum_max run_sum_max extr_running_sum_max (llong);
745         llong EXTR running_sum_max run_sum_max extr_running_sum_max (ullong);
746         llong FUN [COST LOW] extr_running_sum_max(string);
747         string UDAF [HFTA_ONLY, RUNNING] run_sum_max fstring16 (uint);
748         string UDAF [HFTA_ONLY, RUNNING] run_sum_max fstring16 (int);
749         string UDAF [HFTA_ONLY, RUNNING] run_sum_max fstring16 (ullong);
750         string UDAF [HFTA_ONLY, RUNNING] run_sum_max fstring16 (llong);
751