5762818 [rkeene@sledge /home/rkeene/devel/old/bc-dos/h]$ cat -n number.h
 1 /* number.h: Arbitrary precision numbers header file. */
 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, 675 Mass Ave, Cambridge, MA 02139, USA.
19 
20     You may contact the author by:
21        e-mail:  phil@cs.wwu.edu
22       us-mail:  Philip A. Nelson
23                 Computer Science Department, 9062
24                 Western Washington University
25                 Bellingham, WA 98226-9062
26        
27 *************************************************************************/
28 
29 
30 typedef enum {PLUS, MINUS} sign;
31 
32 typedef struct
33     {
34       sign n_sign;
35       int  n_len;   /* The number of digits before the decimal point. */
36       int  n_scale; /* The number of digits after the decimal point. */
37       int  n_refs;      /* The number of pointers to this number. */
38       char n_value[1];  /* The storage. Not zero char terminated. It is 
39                    allocated with all other fields.  */
40     } bc_struct;
41 
42 typedef bc_struct *bc_num;
43 
44 /* The base used in storing the numbers in n_value above.
45    Currently this MUST be 10. */
46 
47 #define BASE 10
48 
49 /*  Some useful macros and constants. */
50 
51 #define CH_VAL(c)     (c - '0')
52 #define BCD_CHAR(d)   (d + '0')
53 
54 #ifdef MIN
55 #undef MIN
56 #undef MAX
57 #endif
58 #define MAX(a,b)      ((a)>(b)?(a):(b))
59 #define MIN(a,b)      ((a)>(b)?(b):(a))
60 #define ODD(a)        ((a)&1)
61 
62 #ifndef TRUE
63 #define TRUE 1
64 #define FALSE 0
65 #endif
5762819 [rkeene@sledge /home/rkeene/devel/old/bc-dos/h]$

Click here to go back to the directory listing.
Click here to download this file.
last modified: 1997-04-15 18:26:26