home *** CD-ROM | disk | FTP | other *** search
/ Geek Gadgets 1 / ADE-1.bin / ade-dist / bc-1.03-base.tgz / bc-1.03-base.tar / fsf / bc / dc.h < prev    next >
C/C++ Source or Header  |  1994-08-08  |  2KB  |  82 lines

  1. /* 
  2.  * Header file for dc routines
  3.  *
  4.  * Copyright (C) 1994 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, or (at your option)
  9.  * 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; if not, you can either send email to this
  18.  * program's author (see below) or write to: The Free Software Foundation,
  19.  * Inc.; 675 Mass Ave. Cambridge, MA 02139, USA.
  20.  */
  21.  
  22. #ifndef DC_DEFS_H
  23. #define DC_DEFS_H
  24.  
  25. /* 'I' is a command, and bases 17 and 18 are quite
  26.  * unusual, so we limit ourselves to bases 2 to 16
  27.  */
  28. #define DC_IBASE_MAX    16
  29.  
  30. #define DC_SUCCESS        0
  31. #define DC_DOMAIN_ERROR    1
  32. #define DC_FAIL            2    /* generic failure */
  33.  
  34.  
  35. #ifndef __STDC__
  36. # define DC_PROTO(x)            ()
  37. # define DC_DECLVOID()            ()
  38. # define DC_DECLARG(arglist)    arglist
  39. # define DC_DECLSEP                ;
  40. # define DC_DECLEND                ;
  41. #else /* __STDC__ */
  42. # define DC_PROTO(x)            x
  43. # define DC_DECLVOID()            (void)
  44. # define DC_DECLARG(arglist)    (
  45. # define DC_DECLSEP                ,
  46. # define DC_DECLEND                )
  47. #endif /* __STDC__ */
  48.  
  49.  
  50. typedef enum {DC_FALSE, DC_TRUE} dc_boolean;
  51.  
  52.  
  53. /* type discriminant for dc_data */
  54. typedef enum {DC_UNINITIALIZED, DC_NUMBER, DC_STRING} dc_value_type;
  55.  
  56. /* generic pointer for information hiding */
  57. typedef void *Opaque;
  58.  
  59. /* only dc-math.c knows what dc_num's *really* look like */
  60. typedef Opaque dc_num;
  61.  
  62. /* only dc-string.c knows what dc_str's *really* look like */
  63. typedef Opaque dc_str;
  64.  
  65.  
  66. /* except for the two implementation-specific modules, all
  67.  * dc functions only know of this one generic type of object
  68.  */
  69. typedef struct {
  70.     dc_value_type dc_type;    /* discriminant for union */
  71.     union {
  72.         dc_num number;
  73.         dc_str string;
  74.     } v;
  75. } dc_data;
  76.  
  77.  
  78. /* This is dc's only global variable: */
  79. extern const char *progname;    /* basename of program invocation */
  80.  
  81. #endif /* not DC_DEFS_H */
  82.