1/* global.h:  The global variables for bc.  */
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, Inc.
19      59 Temple Place, Suite 330
20      Boston, MA 02111 USA
21
22    You may contact the author by:
23       e-mail:  philnelson@acm.org
24      us-mail:  Philip A. Nelson
25                Computer Science Department, 9062
26                Western Washington University
27                Bellingham, WA 98226-9062
28
29*************************************************************************/
30
31
32/* The current break level's lable. */
33EXTERN int break_label;
34
35/* The current if statement's else label or label after else. */
36EXTERN int if_label;
37
38/* The current for statement label for continuing the loop. */
39EXTERN int continue_label;
40
41/* Next available label number. */
42EXTERN int next_label;
43
44/* Byte code character storage.  Used in many places for generation of code. */
45EXTERN char genstr[80];
46
47/* Count of characters printed to the output in compile_only mode. */
48EXTERN int out_count;
49
50/* Have we generated any code since the last initialization of the code
51   generator.  */
52EXTERN char did_gen;
53
54/* Is this run an interactive execution.  (Is stdin a terminal?) */
55EXTERN char interactive;
56
57/* Just generate the byte code.  -c flag. */
58EXTERN int compile_only;
59
60/* Load the standard math functions.  -l flag. */
61EXTERN int use_math;
62
63/* Give a warning on use of any non-standard feature (non-POSIX).  -w flag. */
64EXTERN int warn_not_std;
65
66/* Accept POSIX bc only!  -s flag. */
67EXTERN int std_only;
68
69/* Don't print the banner at start up.  -q flag. */
70EXTERN int quiet;
71
72/* The list of file names to process. */
73EXTERN file_node *file_names;
74
75/* The name of the current file being processed. */
76EXTERN char *file_name;
77
78/* Is the current file a named file or standard input? */
79EXTERN char   is_std_in;
80
81/* global variables for the bc machine. All will be dynamic in size.*/
82/* Function storage. main is (0) and functions (1-f_count) */
83
84EXTERN bc_function *functions;
85EXTERN char **f_names;
86EXTERN int  f_count;
87
88/* Variable stoarge and reverse names. */
89
90EXTERN bc_var **variables;
91EXTERN char **v_names;
92EXTERN int  v_count;
93
94/* Array Variable storage and reverse names. */
95
96EXTERN bc_var_array **arrays;
97EXTERN char **a_names;
98EXTERN int  a_count;
99
100/* Execution stack. */
101EXTERN estack_rec *ex_stack;
102
103/* Function return stack. */
104EXTERN fstack_rec *fn_stack;
105
106/* Current ibase, obase, scale, and n_history (if needed). */
107EXTERN int i_base;
108EXTERN int o_base;
109EXTERN int scale;
110#if defined(READLINE) || defined(LIBEDIT)
111EXTERN int n_history;
112#endif
113
114#if defined(LIBEDIT)
115/* LIBEDIT data */
116EditLine *edit;
117History  *hist;
118HistEvent histev;
119#endif
120
121/* "Condition code" -- false (0) or true (1) */
122EXTERN char c_code;
123
124/* Records the number of the runtime error. */
125EXTERN char runtime_error;
126
127/* Holds the current location of execution. */
128EXTERN program_counter pc;
129
130/* For POSIX bc, this is just for number output, not strings. */
131EXTERN int out_col;
132
133/* Keeps track of the current number of characters per output line.
134   This includes the \n at the end of the line. */
135EXTERN int line_size;
136
137/* Input Line numbers and other error information. */
138EXTERN int line_no;
139EXTERN int had_error;
140
141/* For larger identifiers, a tree, and how many "storage" locations
142   have been allocated. */
143
144EXTERN int next_array;
145EXTERN int next_func;
146EXTERN int next_var;
147
148EXTERN id_rec *name_tree;
149
150/* For use with getopt.  Do not declare them here.*/
151extern int optind;
152
153/* Access to the yy input file.  Defined in scan.c. */
154extern FILE *yyin;
155