1 | /*************************************** 2 | $Revision: 1.4 $ 3 | 4 | stubs.h - header file with things defined just to provisionally fix the TBDs. 5 | 6 | Status: NOT REVUED, TESTED, INCOMPLETE 7 | 8 | Design and implementation by: Marek Bukowy 9 | 10 | ******************/ /****************** 11 | Copyright (c) 1999 RIPE NCC 12 | 13 | All Rights Reserved 14 | 15 | Permission to use, copy, modify, and distribute this software and its 16 | documentation for any purpose and without fee is hereby granted, 17 | provided that the above copyright notice appear in all copies and that 18 | both that copyright notice and this permission notice appear in 19 | supporting documentation, and that the name of the author not be 20 | used in advertising or publicity pertaining to distribution of the 21 | software without specific, written prior permission. 22 | 23 | THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING 24 | ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS; IN NO EVENT SHALL 25 | AUTHOR BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY 26 | DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN 27 | AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 28 | OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 29 | ***************************************/ 30 | 31 | /* stubs: just defined to let the other thing compile. Use #define 32 | NOSTUBS to disable it. */ 33 | 34 | #ifndef _STUBS_H 35 | #define _STUBS_H 36 | 37 | #include <stdlib.h> 38 | #include <stdio.h> 39 | 40 | /* this is to allow user stubs in the code */ 41 | /* it will trigger an error when NOSTUBS is set */ 42 | 43 | #ifndef NOSTUBS 44 | #define STUB(a) do{a;}while(0) 45 | #else 46 | #define STUB(a) hey_here_is_a_stub_left=%^&*&@@@; 47 | #endif 48 | 49 | /* now these are predefined ones... */ 50 | 51 | #ifndef NOSTUBS 52 | 53 | /* for memcmp and strcmp */ 54 | #define CMP_EQUAL 0 55 | 56 | /* stub for those compilers (wrrrrrrr....) that can't do (struct != struct) */ 57 | #define STRUCT_EQUAL(a,b) (memcmp(&a, &b, sizeof(a)) == CMP_EQUAL) 58 | 59 | 60 | #define die do{ \ 61 | fprintf(stderr,"died: +%d %s\n",__LINE__, __FILE__);\ 62 | *((int*)NULL)=0; \ 63 | }while(0) 64 | 65 | #define dieif(a) if(a) { \ 66 | fprintf(stderr,"died on "#a" in: +%d %s\n",__LINE__, __FILE__);\ 67 | *((int*)NULL)=0; \ 68 | } 69 | 70 | 71 | #define SQL_TBLNAM_MAX 32 72 | 73 | 74 | /* struct to hold the table name. 75 | Wrapped in a struct to make it behave like a normal object (ref by 76 | value) 77 | 78 | in fact, this type should be made engine-dependent. 79 | */ 80 | 81 | typedef struct { 82 | char val[SQL_TBLNAM_MAX]; 83 | } sql_tblnam_t; 84 | 85 | /* who knows what key type we will really have in other engines */ 86 | typedef long sql_key_t; 87 | 88 | #define SQ_NOKEY 0L 89 | 90 | #endif /* NOSTUBS */ 91 | #endif /* _STUBS_H */