Blame bc/const.h

Packit 70b277
/*  This file is part of GNU bc.
Packit 70b277
Packit 70b277
    Copyright (C) 1991-1994, 1997, 2006, 2008, 2012-2017 Free Software Foundation, Inc.
Packit 70b277
Packit 70b277
    This program is free software; you can redistribute it and/or modify
Packit 70b277
    it under the terms of the GNU General Public License as published by
Packit 70b277
    the Free Software Foundation; either version 3 of the License , or
Packit 70b277
    (at your option) any later version.
Packit 70b277
Packit 70b277
    This program is distributed in the hope that it will be useful,
Packit 70b277
    but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 70b277
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Packit 70b277
    GNU General Public License for more details.
Packit 70b277
Packit 70b277
    You should have received a copy of the GNU General Public License
Packit 70b277
    along with this program; see the file COPYING.  If not, see
Packit 70b277
    <http://www.gnu.org/licenses>.
Packit 70b277
Packit 70b277
    You may contact the author by:
Packit 70b277
       e-mail:  philnelson@acm.org
Packit 70b277
      us-mail:  Philip A. Nelson
Packit 70b277
                Computer Science Department, 9062
Packit 70b277
                Western Washington University
Packit 70b277
                Bellingham, WA 98226-9062
Packit 70b277
       
Packit 70b277
*************************************************************************/
Packit 70b277
Packit 70b277
/* const.h: Constants for bc. */
Packit 70b277
Packit 70b277
/* Define INT_MAX and LONG_MAX if not defined.  Assuming 32 bits... */
Packit 70b277
Packit 70b277
#ifndef INT_MAX
Packit 70b277
#define INT_MAX 0x7FFFFFFF
Packit 70b277
#endif
Packit 70b277
#ifndef LONG_MAX
Packit 70b277
#define LONG_MAX 0x7FFFFFFF
Packit 70b277
#endif
Packit 70b277
Packit 70b277
Packit 70b277
/* Define constants in some reasonable size.  The next 4 constants are
Packit 70b277
   POSIX constants. */
Packit 70b277
Packit 70b277
#ifdef BC_BASE_MAX
Packit 70b277
  /* <limits.h> on a POSIX.2 system may have defined these.  Override. */
Packit 70b277
# undef BC_BASE_MAX
Packit 70b277
# undef BC_SCALE_MAX
Packit 70b277
# undef BC_STRING_MAX
Packit 70b277
# undef BC_DIM_MAX
Packit 70b277
#endif
Packit 70b277
Packit 70b277
#define BC_BASE_MAX   INT_MAX
Packit 70b277
#define BC_SCALE_MAX  INT_MAX
Packit 70b277
#define BC_STRING_MAX INT_MAX
Packit 70b277
Packit 70b277
Packit 70b277
/* Definitions for arrays. */
Packit 70b277
Packit 70b277
#define BC_DIM_MAX   16777215     /* this should be NODE_SIZE^NODE_DEPTH-1 */
Packit 70b277
Packit 70b277
#define   NODE_SIZE        64     /* Must be a power of 2. */
Packit 70b277
#define   NODE_MASK      0x3f     /* Must be NODE_SIZE-1. */
Packit 70b277
#define   NODE_SHIFT        6     /* Number of 1 bits in NODE_MASK. */
Packit 70b277
#define   NODE_DEPTH        4
Packit 70b277
Packit 70b277
Packit 70b277
/* Other BC limits defined but not part of POSIX. */
Packit 70b277
Packit 70b277
#define BC_LABEL_GROUP 64
Packit 70b277
#define BC_LABEL_LOG    6
Packit 70b277
#define BC_START_SIZE  1024	/* Initial code body size. */
Packit 70b277
Packit 70b277
/* Maximum number of variables, arrays and functions and the
Packit 70b277
   allocation increment for the dynamic arrays. */
Packit 70b277
Packit 70b277
#define MAX_STORE   32767
Packit 70b277
#define STORE_INCR     32
Packit 70b277
Packit 70b277
/* Other interesting constants. */
Packit 70b277
Packit 70b277
#define FALSE 0
Packit 70b277
#define TRUE  1
Packit 70b277
Packit 70b277
/* for use with lookup (). */
Packit 70b277
#define SIMPLE   0
Packit 70b277
#define ARRAY    1
Packit 70b277
#define FUNCT    2
Packit 70b277
#define FUNCTDEF 3
Packit 70b277
Packit 70b277
#ifdef __STDC__
Packit 70b277
#define CONST const
Packit 70b277
#define VOID  void
Packit 70b277
#else
Packit 70b277
#define CONST
Packit 70b277
#define VOID
Packit 70b277
#endif