1/* const.h: Constants for bc. */ 2 3/* This file is part of GNU bc. 4 Copyright (C) 1991, 1992, 1993, 1994, 1997 Free Software Foundation, Inc. 5 6 This program is free software; you can redistribute it and/or modify 7 it under the terms of the GNU General Public License as published by 8 the Free Software Foundation; either version 2 of the License , or 9 (at your option) any later version. 10 11 This program is distributed in the hope that it will be useful, 12 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 GNU General Public License for more details. 15 16 You should have received a copy of the GNU General Public License 17 along with this program; see the file COPYING. If not, write to 18 The Free Software Foundation, Inc. 19 59 Temple Place, Suite 330 20 Boston, MA 02111 USA 21 22 You may contact the author by: 23 e-mail: philnelson@acm.org 24 us-mail: Philip A. Nelson 25 Computer Science Department, 9062 26 Western Washington University 27 Bellingham, WA 98226-9062 28 29*************************************************************************/ 30 31 32/* Define INT_MAX and LONG_MAX if not defined. Assuming 32 bits... */ 33 34#ifndef INT_MAX 35#define INT_MAX 0x7FFFFFFF 36#endif 37#ifndef LONG_MAX 38#define LONG_MAX 0x7FFFFFFF 39#endif 40 41 42/* Define constants in some reasonable size. The next 4 constants are 43 POSIX constants. */ 44 45#ifdef BC_BASE_MAX 46 /* <limits.h> on a POSIX.2 system may have defined these. Override. */ 47# undef BC_BASE_MAX 48# undef BC_SCALE_MAX 49# undef BC_STRING_MAX 50# undef BC_DIM_MAX 51#endif 52 53#define BC_BASE_MAX INT_MAX 54#define BC_SCALE_MAX INT_MAX 55#define BC_STRING_MAX INT_MAX 56 57 58/* Definitions for arrays. */ 59 60#define BC_DIM_MAX 65535 /* this should be NODE_SIZE^NODE_DEPTH-1 */ 61 62#define NODE_SIZE 16 /* Must be a power of 2. */ 63#define NODE_MASK 0xf /* Must be NODE_SIZE-1. */ 64#define NODE_SHIFT 4 /* Number of 1 bits in NODE_MASK. */ 65#define NODE_DEPTH 4 66 67 68/* Other BC limits defined but not part of POSIX. */ 69 70#define BC_LABEL_GROUP 64 71#define BC_LABEL_LOG 6 72#define BC_START_SIZE 1024 /* Initial code body size. */ 73 74/* Maximum number of variables, arrays and functions and the 75 allocation increment for the dynamic arrays. */ 76 77#define MAX_STORE 32767 78#define STORE_INCR 32 79 80/* Other interesting constants. */ 81 82#define FALSE 0 83#define TRUE 1 84 85/* for use with lookup (). */ 86#define SIMPLE 0 87#define ARRAY 1 88#define FUNCT 2 89#define FUNCTDEF 3 90 91#define EXTERN extern 92#ifdef __STDC__ 93#define CONST const 94#define VOID void 95#else 96#define CONST 97#define VOID 98#endif 99