1 /* bcdefs.h: The single file to include all constants and type definitions. */
3 /* This file is part of bc written for MINIX.
4 Copyright (C) 1991, 1992 Free Software Foundation, Inc.
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.
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.
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.
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
27 *************************************************************************/
29 /* Include the configuration file. */
32 /* Standard includes for all files. */
34 #include <sys/types.h>
45 /* Include the other definitions. */
50 /* These definitions define all the structures used in
51 code and data storage. This includes the representation of
52 labels. The "guiding" principle is to make structures that
53 take a minimum of space when unused but can be built to contain
54 the full structures. */
56 /* Labels are first. Labels are generated sequentially in functions
57 and full code. They just "point" to a single bye in the code. The
58 "address" is the byte number. The byte number is used to get an
59 actual character pointer. */
61 typedef struct bc_label_group
63 long l_adrs
[ BC_LABEL_GROUP
];
64 struct bc_label_group
*l_next
;
68 /* Each function has its own code segments and labels. There can be
69 no jumps between functions so labels are unique to a function. */
71 typedef struct arg_list
74 struct arg_list
*next
;
79 char f_defined
; /* Is this function defined yet. */
80 char *f_body
[BC_MAX_SEGS
];
82 bc_label_group
*f_label
;
94 /* Variables are "pushable" (auto) and thus we need a stack mechanism.
95 This is built into the variable record. */
100 struct bc_var
*v_next
;
104 /* bc arrays can also be "auto" variables and thus need the same
105 kind of stacking mechanisms. */
107 typedef struct bc_array_node
111 bc_num n_num
[NODE_SIZE
];
112 struct bc_array_node
*n_down
[NODE_SIZE
];
116 typedef struct bc_array
118 bc_array_node
*a_tree
;
122 typedef struct bc_var_array
126 struct bc_var_array
*a_next
;
130 /* For the stacks, execution and function, we need records to allow
131 for arbitrary size. */
133 typedef struct estack_rec
{
135 struct estack_rec
*s_next
;
138 typedef struct fstack_rec
{
140 struct fstack_rec
*s_next
;
144 /* The following are for the name tree. */
146 typedef struct id_rec
{
147 char *id
; /* The program name. */
148 /* A name == 0 => nothing assigned yet. */
149 int a_name
; /* The array variable name (number). */
150 int f_name
; /* The function name (number). */
151 int v_name
; /* The variable name (number). */
152 short balance
; /* For the balanced tree. */
153 struct id_rec
*left
, *right
; /* Tree pointers. */