Merge from vendor branch LIBSTDC++:
[dragonfly.git] / contrib / bc / h / global.h
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, 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 /* The current break level's lable. */
31 EXTERN int break_label;
32
33 /* The current if statement's else label or label after else. */
34 EXTERN int if_label;
35
36 /* The current for statement label for continuing the loop. */
37 EXTERN int continue_label;
38
39 /* Next available label number. */
40 EXTERN int next_label;
41
42 /* Byte code character storage.  Used in many places for generation of code. */
43 EXTERN char genstr[80];
44
45 /* Count of characters printed to the output in compile_only mode. */
46 EXTERN int out_count;
47
48 /* Have we generated any code since the last initialization of the code
49    generator.  */
50 EXTERN char did_gen;
51
52 /* Is this run an interactive execution.  (Is stdin a terminal?) */
53 EXTERN char interactive;
54
55 /* Just generate the byte code.  -c flag. */
56 EXTERN int compile_only;
57
58 /* Load the standard math functions.  -l flag. */
59 EXTERN int use_math;
60
61 /* Give a warning on use of any non-standard feature (non-POSIX).  -w flag. */
62 EXTERN int warn_not_std;
63
64 /* Accept POSIX bc only!  -s flag. */
65 EXTERN int std_only;
66
67 /* Don't print the banner at start up.  -q flag. */
68 EXTERN int quiet;
69
70 /* The list of file names to process. */
71 EXTERN file_node *file_names;
72
73 /* The name of the current file being processed. */
74 EXTERN char *file_name;
75
76 /* Is the current file a named file or standard input? */
77 EXTERN char   is_std_in;
78
79 /* global variables for the bc machine. All will be dynamic in size.*/
80 /* Function storage. main is (0) and functions (1-f_count) */
81
82 EXTERN bc_function *functions;
83 EXTERN char **f_names;
84 EXTERN int  f_count;
85
86 /* Variable stoarge and reverse names. */
87
88 EXTERN bc_var **variables;
89 EXTERN char **v_names;
90 EXTERN int  v_count;
91
92 /* Array Variable storage and reverse names. */
93
94 EXTERN bc_var_array **arrays;
95 EXTERN char **a_names;
96 EXTERN int  a_count;
97
98 /* Execution stack. */
99 EXTERN estack_rec *ex_stack;
100
101 /* Function return stack. */
102 EXTERN fstack_rec *fn_stack;
103
104 /* Current ibase, obase, scale, and n_history (if needed). */
105 EXTERN int i_base;
106 EXTERN int o_base;
107 EXTERN int scale;
108 #ifdef READLINE
109 EXTERN int n_history;
110 #endif
111
112 /* "Condition code" -- false (0) or true (1) */
113 EXTERN char c_code;
114
115 /* Records the number of the runtime error. */
116 EXTERN char runtime_error;
117
118 /* Holds the current location of execution. */
119 EXTERN program_counter pc;
120
121 /* For POSIX bc, this is just for number output, not strings. */
122 EXTERN int out_col;
123
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;
127
128 /* Input Line numbers and other error information. */
129 EXTERN int line_no;
130 EXTERN int had_error;
131
132 /* For larger identifiers, a tree, and how many "storage" locations
133    have been allocated. */
134
135 EXTERN int next_array;
136 EXTERN int next_func;
137 EXTERN int next_var;
138
139 EXTERN id_rec *name_tree;
140
141 /* defined in number.c */
142 extern bc_num _zero_;
143 extern bc_num _one_;
144
145 /* For use with getopt.  Do not declare them here.*/
146 extern int optind;
147