1 /******************************************** 2 sizes.h 3 copyright 2009-2014,2017 Thomas E. Dickey 4 copyright 1991-1995,2014. Michael D. Brennan 5 6 This is a source file for mawk, an implementation of 7 the AWK programming language. 8 9 Mawk is distributed without warranty under the terms of 10 the GNU General Public License, version 2, 1991. 11 ********************************************/ 12 13 /* 14 * $MawkId: sizes.h,v 1.11 2017/10/17 00:43:54 tom Exp $ 15 */ 16 17 /* sizes.h */ 18 19 #ifndef SIZES_H 20 #define SIZES_H 21 22 #include "config.h" 23 24 #ifndef MAX__INT 25 #include <limits.h> 26 #define MAX__INT INT_MAX 27 #define MAX__LONG LONG_MAX 28 #define MAX__UINT UINT_MAX 29 #endif /* MAX__INT */ 30 31 #if MAX__INT <= 0x7fff 32 #define SHORT_INTS 33 #define INT_FMT "%ld" 34 typedef long Int; 35 #define Max_Int MAX__LONG 36 #else 37 #define INT_FMT "%d" 38 typedef int Int; 39 #define Max_Int MAX__INT 40 #endif 41 42 #if MAX__UINT <= 0xffff 43 #define SHORT_UINTS 44 #define UINT_FMT "%lu" 45 typedef unsigned long UInt; 46 #define Max_UInt MAX__ULONG 47 #else 48 #define UINT_FMT "%u" 49 typedef unsigned UInt; 50 #define Max_UInt MAX__UINT 51 #endif 52 53 #define EVAL_STACK_SIZE 1024 /* initial size , can grow */ 54 55 /* 56 * FBANK_SZ, the number of fields at startup, must be a power of 2. 57 * 58 */ 59 #define FBANK_SZ 1024 60 #define FB_SHIFT 10 /* lg(FBANK_SZ) */ 61 62 /* 63 * hardwired limit on sprintf size, can be overridden with -Ws=xxx 64 * TBD to remove hard wired limit 65 */ 66 #define SPRINTF_LIMIT 8192 67 68 #define BUFFSZ 4096 69 /* starting buffer size for input files, grows if 70 necessary */ 71 72 #ifdef MSDOS 73 /* trade some space for IO speed */ 74 #undef BUFFSZ 75 #define BUFFSZ 8192 76 /* maximum input buffers that will fit in 64K */ 77 #define MAX_BUFFS ((int)(0x10000L/BUFFSZ) - 1) 78 #endif 79 80 #define HASH_PRIME 53 81 #define A_HASH_PRIME 199 82 83 #define MAX_COMPILE_ERRORS 5 /* quit if more than 4 errors */ 84 85 #endif /* SIZES_H */ 86