1 | /* |
2 | * Legal Notice |
3 | * |
4 | * This document and associated source code (the "Work") is a part of a |
5 | * benchmark specification maintained by the TPC. |
6 | * |
7 | * The TPC reserves all right, title, and interest to the Work as provided |
8 | * under U.S. and international laws, including without limitation all patent |
9 | * and trademark rights therein. |
10 | * |
11 | * No Warranty |
12 | * |
13 | * 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION |
14 | * CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE |
15 | * AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER |
16 | * WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY, |
17 | * INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES, |
18 | * DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR |
19 | * PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF |
20 | * WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE. |
21 | * ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT, |
22 | * QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT |
23 | * WITH REGARD TO THE WORK. |
24 | * 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO |
25 | * ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE |
26 | * COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS |
27 | * OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT, |
28 | * INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY, |
29 | * OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT |
30 | * RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD |
31 | * ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. |
32 | * |
33 | * Contributors: |
34 | * Gradient Systems |
35 | */ |
36 | #ifndef DCOMP_H |
37 | #define DCOMP_H |
38 | |
39 | #include "config.h" |
40 | #include "porting.h" |
41 | #include "grammar.h" |
42 | #include "dist.h" |
43 | |
44 | /* |
45 | * query template grammar definition |
46 | */ |
47 | #define TKN_UNKNOWN 0 |
48 | #define TKN_CREATE 1 |
49 | #define TKN_WEIGHTS 2 |
50 | #define TKN_TYPES 3 |
51 | #define TKN_INCLUDE 4 |
52 | #define TKN_SET 5 |
53 | #define TKN_VARCHAR 6 |
54 | #define TKN_INT 7 |
55 | #define TKN_ADD 8 |
56 | #define TKN_DATE 9 |
57 | #define TKN_DECIMAL 10 |
58 | #define TKN_NAMES 11 |
59 | #define MAX_TOKEN 11 |
60 | |
61 | int ProcessDistribution(char *s, token_t *t); |
62 | int ProcessTypes(char *s, token_t *t); |
63 | int ProcessInclude(char *s, token_t *t); |
64 | int ProcessSet(char *s, token_t *t); |
65 | int ProcessAdd(char *s, token_t *t); |
66 | |
67 | #ifdef DECLARER |
68 | token_t dcomp_tokens[MAX_TOKEN + 2] = {{TKN_UNKNOWN, "" , NULL}, |
69 | {TKN_CREATE, "create" , ProcessDistribution}, |
70 | {TKN_WEIGHTS, "weights" , NULL}, |
71 | {TKN_TYPES, "types" , NULL}, |
72 | {TKN_INCLUDE, "#include" , ProcessInclude}, |
73 | {TKN_SET, "set" , ProcessSet}, |
74 | {TKN_VARCHAR, "varchar" , NULL}, |
75 | {TKN_INT, "int" , NULL}, |
76 | {TKN_ADD, "add" , ProcessAdd}, |
77 | {TKN_DATE, "date" , NULL}, |
78 | {TKN_DECIMAL, "decimal" , NULL}, |
79 | {TKN_NAMES, "names" , NULL}, |
80 | {-1, "" , NULL}}; |
81 | #else |
82 | extern token_t tokens[]; |
83 | #endif |
84 | |
85 | #endif /* DCOMP_H */ |
86 | |