1 /* global.h: The global variables for bc. */
3 /* This file is part of GNU bc.
4 Copyright (C) 1991, 1992, 1993, 1994, 1997 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 *************************************************************************/
30 /* The current break level's lable. */
31 EXTERN
int break_label
;
33 /* The current if statement's else label or label after else. */
36 /* The current for statement label for continuing the loop. */
37 EXTERN
int continue_label
;
39 /* Next available label number. */
40 EXTERN
int next_label
;
42 /* Byte code character storage. Used in many places for generation of code. */
43 EXTERN
char genstr
[80];
45 /* Count of characters printed to the output in compile_only mode. */
48 /* Have we generated any code since the last initialization of the code
52 /* Is this run an interactive execution. (Is stdin a terminal?) */
53 EXTERN
char interactive
;
55 /* Just generate the byte code. -c flag. */
56 EXTERN
int compile_only
;
58 /* Load the standard math functions. -l flag. */
61 /* Give a warning on use of any non-standard feature (non-POSIX). -w flag. */
62 EXTERN
int warn_not_std
;
64 /* Accept POSIX bc only! -s flag. */
67 /* Don't print the banner at start up. -q flag. */
70 /* The list of file names to process. */
71 EXTERN file_node
*file_names
;
73 /* The name of the current file being processed. */
74 EXTERN
char *file_name
;
76 /* Is the current file a named file or standard input? */
77 EXTERN
char is_std_in
;
79 /* global variables for the bc machine. All will be dynamic in size.*/
80 /* Function storage. main is (0) and functions (1-f_count) */
82 EXTERN bc_function
*functions
;
83 EXTERN
char **f_names
;
86 /* Variable stoarge and reverse names. */
88 EXTERN bc_var
**variables
;
89 EXTERN
char **v_names
;
92 /* Array Variable storage and reverse names. */
94 EXTERN bc_var_array
**arrays
;
95 EXTERN
char **a_names
;
98 /* Execution stack. */
99 EXTERN estack_rec
*ex_stack
;
101 /* Function return stack. */
102 EXTERN fstack_rec
*fn_stack
;
104 /* Current ibase, obase, scale, and n_history (if needed). */
109 EXTERN
int n_history
;
112 /* "Condition code" -- false (0) or true (1) */
115 /* Records the number of the runtime error. */
116 EXTERN
char runtime_error
;
118 /* Holds the current location of execution. */
119 EXTERN program_counter pc
;
121 /* For POSIX bc, this is just for number output, not strings. */
124 /* Keeps track of the current number of characters per output line.
125 This includes the \n at the end of the line. */
126 EXTERN
int line_size
;
128 /* Input Line numbers and other error information. */
130 EXTERN
int had_error
;
132 /* For larger identifiers, a tree, and how many "storage" locations
133 have been allocated. */
135 EXTERN
int next_array
;
136 EXTERN
int next_func
;
139 EXTERN id_rec
*name_tree
;
141 /* defined in number.c */
142 extern bc_num _zero_
;
145 /* For use with getopt. Do not declare them here.*/