1 | /* |
2 | * This Source Code Form is subject to the terms of the Mozilla Public |
3 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
4 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. |
5 | * |
6 | * Copyright 1997 - July 2008 CWI, August 2008 - 2019 MonetDB B.V. |
7 | */ |
8 | |
9 | #ifndef _SQL_CAST_H_ |
10 | #define _SQL_CAST_H_ |
11 | |
12 | #define CAST_INTEGER_2_NUMERIC_2(T1,T2) \ |
13 | sql5_export str T1##_dec2_##T2(T2 *res, const int *s1, const T1 *v); \ |
14 | sql5_export str bat##T1##_dec2_##T2(bat *res, const int *s1, const bat *v); \ |
15 | sql5_export str T1##_dec2dec_##T2(T2 *res, const int *S1, const T1 *v, const int *d2, const int *S2); \ |
16 | sql5_export str bat##T1##_dec2dec_##T2(bat *res, const int *S1, const bat *v, const int *d2, const int *S2); \ |
17 | sql5_export str T1##_num2dec_##T2(T2 *res, const T1 *v, const int *d2, const int *s2); \ |
18 | sql5_export str bat##T1##_num2dec_##T2(bat *res, const bat *v, const int *d2, const int *s2); |
19 | |
20 | #ifdef HAVE_HGE |
21 | #define CAST_INTEGER_2_NUMERIC_2_hge(T1) CAST_INTEGER_2_NUMERIC_2(T1,hge) |
22 | #else |
23 | #define CAST_INTEGER_2_NUMERIC_2_hge(T1) |
24 | #endif |
25 | |
26 | #define CAST_INTEGER_2_NUMERIC_1(T1) \ |
27 | CAST_INTEGER_2_NUMERIC_2(T1,bte) \ |
28 | CAST_INTEGER_2_NUMERIC_2(T1,sht) \ |
29 | CAST_INTEGER_2_NUMERIC_2(T1,int) \ |
30 | CAST_INTEGER_2_NUMERIC_2(T1,lng) \ |
31 | CAST_INTEGER_2_NUMERIC_2_hge(T1) \ |
32 | CAST_INTEGER_2_NUMERIC_2(T1,flt) \ |
33 | CAST_INTEGER_2_NUMERIC_2(T1,dbl) |
34 | |
35 | CAST_INTEGER_2_NUMERIC_1(bte) |
36 | CAST_INTEGER_2_NUMERIC_1(sht) |
37 | CAST_INTEGER_2_NUMERIC_1(int) |
38 | CAST_INTEGER_2_NUMERIC_1(lng) |
39 | #ifdef HAVE_HGE |
40 | CAST_INTEGER_2_NUMERIC_1(hge) |
41 | #endif |
42 | |
43 | |
44 | #define CAST_FLOATINGPOINT_2_INTEGER_2(T1,T2) \ |
45 | sql5_export str T1##_num2dec_##T2(T2 *res, const T1 *v, const int *d2, const int *s2); \ |
46 | sql5_export str bat##T1##_num2dec_##T2(bat *res, const bat *v, const int *d2, const int *s2); |
47 | |
48 | #ifdef HAVE_HGE |
49 | #define CAST_FLOATINGPOINT_2_INTEGER_2_hge(T1) CAST_FLOATINGPOINT_2_INTEGER_2(T1,hge) |
50 | #else |
51 | #define CAST_FLOATINGPOINT_2_INTEGER_2_hge(T1) |
52 | #endif |
53 | |
54 | #define CAST_FLOATINGPOINT_2_INTEGER_1(T1) \ |
55 | CAST_FLOATINGPOINT_2_INTEGER_2(T1,bte) \ |
56 | CAST_FLOATINGPOINT_2_INTEGER_2(T1,sht) \ |
57 | CAST_FLOATINGPOINT_2_INTEGER_2(T1,int) \ |
58 | CAST_FLOATINGPOINT_2_INTEGER_2(T1,lng) \ |
59 | CAST_FLOATINGPOINT_2_INTEGER_2_hge(T1) |
60 | |
61 | CAST_FLOATINGPOINT_2_INTEGER_1(flt) |
62 | CAST_FLOATINGPOINT_2_INTEGER_1(dbl) |
63 | |
64 | #endif /* _SQL_CAST_H_ */ |
65 | |