1 /* proto.h: Prototype function definitions for "external" functions. */
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 *************************************************************************/
29 /* For the pc version using k&r ACK. (minix1.5 and earlier.) */
31 #define init_numbers i_numbers
32 #define push_constant push__constant
33 #define load_const in_load_const
34 #define yy_get_next_buffer yyget_next_buffer
35 #define yy_init_buffer yyinit_buffer
36 #define yy_last_accepting_state yylast_accepting_state
37 #define arglist1 arg1list
40 /* Include the standard library header files. */
48 /* Define the _PROTOTYPE macro if it is needed. */
52 #define _PROTOTYPE(func, args) func args
54 #define _PROTOTYPE(func, args) func()
59 _PROTOTYPE(void stop_execution
, (int));
60 _PROTOTYPE(unsigned char byte
, (program_counter
*pc
));
61 _PROTOTYPE(void execute
, (void));
62 _PROTOTYPE(char prog_char
, (void));
63 _PROTOTYPE(char input_char
, (void));
64 _PROTOTYPE(void push_constant
, (char (*in_char
)(void), int conv_base
));
65 _PROTOTYPE(void push_b10_const
, (program_counter
*pc
));
66 _PROTOTYPE(void assign
, (int c_code
));
69 _PROTOTYPE(char *strcopyof
, (char *str
));
70 _PROTOTYPE(arg_list
*nextarg
, (arg_list
*args
, int val
, int is_var
));
71 _PROTOTYPE(char *arg_str
, (arg_list
*args
));
72 _PROTOTYPE(char *call_str
, (arg_list
*args
));
73 _PROTOTYPE(void free_args
, (arg_list
*args
));
74 _PROTOTYPE(void check_params
, (arg_list
*params
, arg_list
*autos
));
75 _PROTOTYPE(void init_gen
, (void));
76 _PROTOTYPE(void generate
, (char *str
));
77 _PROTOTYPE(void run_code
, (void));
78 _PROTOTYPE(void out_char
, (int ch
));
79 _PROTOTYPE(id_rec
*find_id
, (id_rec
*tree
, char *id
));
80 _PROTOTYPE(int insert_id_rec
, (id_rec
**root
, id_rec
*new_id
));
81 _PROTOTYPE(void init_tree
, (void));
82 _PROTOTYPE(int lookup
, (char *name
, int namekind
));
83 _PROTOTYPE(char *bc_malloc
, (int));
84 _PROTOTYPE(void out_of_memory
, (void));
85 _PROTOTYPE(void welcome
, (void));
86 _PROTOTYPE(void warranty
, (char *));
87 _PROTOTYPE(void limits
, (void));
88 _PROTOTYPE(void yyerror
, (char *str
,...));
89 _PROTOTYPE(void warn
, (char *mesg
,...));
90 _PROTOTYPE(void rt_error
, (char *mesg
,...));
91 _PROTOTYPE(void rt_warn
, (char *mesg
,...));
94 _PROTOTYPE(void init_load
, (void));
95 _PROTOTYPE(void addbyte
, (int byte
));
96 _PROTOTYPE(void def_label
, (long lab
));
97 _PROTOTYPE(long long_val
, (char **str
));
98 _PROTOTYPE(void load_code
, (char *code
));
101 _PROTOTYPE(int main
, (int argc
, char *argv
[]));
102 _PROTOTYPE(int open_new_file
, (void));
103 _PROTOTYPE(void new_yy_file
, (FILE *file
));
104 _PROTOTYPE(void use_quit
, (int));
107 _PROTOTYPE(void free_num
, (bc_num
*num
));
108 _PROTOTYPE(bc_num new_num
, (int length
, int scale
));
109 _PROTOTYPE(void init_numbers
, (void));
110 _PROTOTYPE(bc_num copy_num
, (bc_num num
));
111 _PROTOTYPE(void init_num
, (bc_num
*num
));
112 _PROTOTYPE(void str2num
, (bc_num
*num
, char *str
, int scale
));
113 _PROTOTYPE(char *num2str
, (bc_num num
));
114 _PROTOTYPE(void int2num
, (bc_num
*num
, int val
));
115 _PROTOTYPE(long num2long
, (bc_num num
));
116 _PROTOTYPE(int bc_compare
, (bc_num n1
, bc_num n2
));
117 _PROTOTYPE(char is_zero
, (bc_num num
));
118 _PROTOTYPE(char is_neg
, (bc_num num
));
119 _PROTOTYPE(void bc_add
, (bc_num n1
, bc_num n2
, bc_num
*result
, int scale_min
));
120 _PROTOTYPE(void bc_sub
, (bc_num n1
, bc_num n2
, bc_num
*result
, int scale_min
));
121 _PROTOTYPE(void bc_multiply
, (bc_num n1
, bc_num n2
, bc_num
*prod
, int scale
));
122 _PROTOTYPE(int bc_divide
, (bc_num n1
, bc_num n2
, bc_num
*quot
, int scale
));
123 _PROTOTYPE(int bc_modulo
,
124 (bc_num num1
, bc_num num2
, bc_num
*result
, int scale
));
125 _PROTOTYPE(int bc_divmod
,
126 (bc_num num1
, bc_num num2
, bc_num
*quot
, bc_num
*rem
, int scale
));
127 _PROTOTYPE(int bc_raisemod
,
128 (bc_num base
, bc_num expo
, bc_num mod
, bc_num
*result
, int scale
));
129 _PROTOTYPE(void bc_raise
,
130 (bc_num num1
, bc_num num2
, bc_num
*result
, int scale
));
131 _PROTOTYPE(int bc_sqrt
, (bc_num
*num
, int scale
));
132 _PROTOTYPE(void out_long
, (long val
, int size
, int space
,
133 void (*out_char
)(int)));
134 _PROTOTYPE(void out_num
, (bc_num num
, int o_base
, void (* out_char
)(int)));
138 _PROTOTYPE(void init_storage
, (void));
139 _PROTOTYPE(void more_functions
, (void));
140 _PROTOTYPE(void more_variables
, (void));
141 _PROTOTYPE(void more_arrays
, (void));
142 _PROTOTYPE(void clear_func
, (int func
));
143 _PROTOTYPE(int fpop
, (void));
144 _PROTOTYPE(void fpush
, (int val
));
145 _PROTOTYPE(void pop
, (void));
146 _PROTOTYPE(void push_copy
, (bc_num num
));
147 _PROTOTYPE(void push_num
, (bc_num num
));
148 _PROTOTYPE(char check_stack
, (int depth
));
149 _PROTOTYPE(bc_var
*get_var
, (int var_name
));
150 _PROTOTYPE(bc_num
*get_array_num
, (int var_index
, long index
));
151 _PROTOTYPE(void store_var
, (int var_name
));
152 _PROTOTYPE(void store_array
, (int var_name
));
153 _PROTOTYPE(void load_var
, (int var_name
));
154 _PROTOTYPE(void load_array
, (int var_name
));
155 _PROTOTYPE(void decr_var
, (int var_name
));
156 _PROTOTYPE(void decr_array
, (int var_name
));
157 _PROTOTYPE(void incr_var
, (int var_name
));
158 _PROTOTYPE(void incr_array
, (int var_name
));
159 _PROTOTYPE(void auto_var
, (int name
));
160 _PROTOTYPE(void free_a_tree
, (bc_array_node
*root
, int depth
));
161 _PROTOTYPE(void pop_vars
, (arg_list
*list
));
162 _PROTOTYPE(void process_params
, (program_counter
*pc
, int func
));
164 /* For the scanner and parser.... */
165 _PROTOTYPE(int yyparse
, (void));
166 _PROTOTYPE(int yylex
, (void));
168 /* Other things... */
169 #ifndef HAVE_UNISTD_H
170 _PROTOTYPE (int getopt
, (int, char *[], CONST
char *));