xref: /386bsd/usr/src/usr.bin/bc/global.h (revision a2142627)
1 /* global.h:  The global variables for bc.  */
2 
3 /*  This file is part of bc written for MINIX.
4     Copyright (C) 1991, 1992 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 /* For the current "break level" and if statements. */
31 EXTERN int break_label;
32 EXTERN int if_label;
33 EXTERN int continue_label;
34 
35 /* Label numbers. */
36 EXTERN int next_label;
37 
38 /* Used for "code" generation. */
39 EXTERN char genstr[80];
40 EXTERN int out_count;
41 EXTERN char did_gen;
42 
43 /* Interactive and other flags. */
44 EXTERN char interactive;
45 EXTERN char compile_only;
46 EXTERN char use_math;
47 EXTERN char warn_not_std;
48 EXTERN char std_only;
49 
50 /* global variables for the bc machine. All will be dynamic in size.*/
51 /* Function storage. main is (0) and functions (1-f_count) */
52 
53 EXTERN bc_function *functions;
54 EXTERN char **f_names;
55 EXTERN int  f_count;
56 
57 /* Variable stoarge and reverse names. */
58 
59 EXTERN bc_var **variables;
60 EXTERN char **v_names;
61 EXTERN int  v_count;
62 
63 /* Array Variable storage and reverse names. */
64 
65 EXTERN bc_var_array **arrays;
66 EXTERN char **a_names;
67 EXTERN int  a_count;
68 
69 /* Execution stack. */
70 EXTERN estack_rec *ex_stack;
71 
72 /* Function return stack. */
73 EXTERN fstack_rec *fn_stack;
74 
75 /* Other "storage". */
76 EXTERN int i_base;
77 EXTERN int o_base;
78 EXTERN int scale;
79 EXTERN char c_code;
80 EXTERN int out_col;
81 EXTERN char runtime_error;
82 EXTERN program_counter pc;
83 
84 /* Input Line numbers and other error information. */
85 EXTERN int line_no;
86 EXTERN int had_error;
87 
88 /* For larger identifiers, a tree, and how many "storage" locations
89    have been allocated. */
90 
91 EXTERN int next_array;
92 EXTERN int next_func;
93 EXTERN int next_var;
94 
95 EXTERN id_rec *name_tree;
96 
97 /* For error message production */
98 EXTERN char **g_argv;
99 EXTERN int    g_argc;
100 EXTERN char   is_std_in;
101 
102 /* defined in number.c */
103 extern bc_num _zero_;
104 extern bc_num _one_;
105 
106 /* For use with getopt.  Do not declare them here.*/
107 extern int optind;
108 
109