[9] | 1 | /* proto.h: Prototype function definitions for "external" functions. */
|
---|
| 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 | /* For the pc version using k&r ACK. (minix1.5 and earlier.) */
|
---|
| 30 | #ifdef SHORTNAMES
|
---|
| 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
|
---|
| 38 | #endif
|
---|
| 39 |
|
---|
| 40 | /* Include the standard library header files. */
|
---|
| 41 | #ifndef NO_UNISTD
|
---|
| 42 | #include <unistd.h>
|
---|
| 43 | #endif
|
---|
| 44 | #ifndef NO_STDLIB
|
---|
| 45 | #ifdef __STDC__
|
---|
| 46 | #include <stdlib.h>
|
---|
| 47 | #endif
|
---|
| 48 | #endif
|
---|
| 49 |
|
---|
| 50 | /* Define the _PROTOTYPE macro if it is needed. */
|
---|
| 51 |
|
---|
| 52 | #ifndef _PROTOTYPE
|
---|
| 53 | #ifdef __STDC__
|
---|
| 54 | #define _PROTOTYPE(func, args) func args
|
---|
| 55 | #else
|
---|
| 56 | #define _PROTOTYPE(func, args) func()
|
---|
| 57 | #endif
|
---|
| 58 | #endif
|
---|
| 59 |
|
---|
| 60 | /* From execute.c */
|
---|
| 61 | _PROTOTYPE(void stop_execution, (int));
|
---|
| 62 | _PROTOTYPE(unsigned char byte, (program_counter *pc));
|
---|
| 63 | _PROTOTYPE(void execute, (void));
|
---|
| 64 | _PROTOTYPE(char prog_char, (void));
|
---|
| 65 | _PROTOTYPE(char input_char, (void));
|
---|
| 66 | _PROTOTYPE(void push_constant, (char (*in_char)(void), int conv_base));
|
---|
| 67 | _PROTOTYPE(void push_b10_const, (program_counter *pc));
|
---|
| 68 | _PROTOTYPE(void assign, (int c_code));
|
---|
| 69 |
|
---|
| 70 | /* From util.c */
|
---|
| 71 | _PROTOTYPE(char *strcopyof, (char *str));
|
---|
| 72 | _PROTOTYPE(arg_list *nextarg, (arg_list *args, int val));
|
---|
| 73 | _PROTOTYPE(char *arg_str, (arg_list *args, int));
|
---|
| 74 | _PROTOTYPE(void free_args, (arg_list *args));
|
---|
| 75 | _PROTOTYPE(void check_params, (arg_list *params, arg_list *autos));
|
---|
| 76 | _PROTOTYPE(void init_gen, (void));
|
---|
| 77 | _PROTOTYPE(void generate, (char *str));
|
---|
| 78 | _PROTOTYPE(void run_code, (void));
|
---|
| 79 | _PROTOTYPE(void out_char, (int ch));
|
---|
| 80 | _PROTOTYPE(id_rec *find_id, (id_rec *tree, char *id));
|
---|
| 81 | _PROTOTYPE(int insert_id_rec, (id_rec **root, id_rec *new_id));
|
---|
| 82 | _PROTOTYPE(void init_tree, (void));
|
---|
| 83 | _PROTOTYPE(int lookup, (char *name, int namekind));
|
---|
| 84 | _PROTOTYPE(char *bc_malloc, (int));
|
---|
| 85 | _PROTOTYPE(void out_of_memory, (void));
|
---|
| 86 | _PROTOTYPE(void welcome, (void));
|
---|
| 87 | _PROTOTYPE(void warranty, (char *));
|
---|
| 88 | _PROTOTYPE(void limits, (void));
|
---|
| 89 | _PROTOTYPE(void yyerror, (char *str ,...));
|
---|
| 90 | _PROTOTYPE(void warn, (char *mesg ,...));
|
---|
| 91 | _PROTOTYPE(void rt_error, (char *mesg ,...));
|
---|
| 92 | _PROTOTYPE(void rt_warn, (char *mesg ,...));
|
---|
| 93 |
|
---|
| 94 | /* From load.c */
|
---|
| 95 | _PROTOTYPE(void init_load, (void));
|
---|
| 96 | _PROTOTYPE(void addbyte, (int byte));
|
---|
| 97 | _PROTOTYPE(void def_label, (long lab));
|
---|
| 98 | _PROTOTYPE(long long_val, (char **str));
|
---|
| 99 | _PROTOTYPE(void load_code, (char *code));
|
---|
| 100 |
|
---|
| 101 | /* From main.c */
|
---|
| 102 | _PROTOTYPE(int main, (int argc , char *argv []));
|
---|
| 103 | _PROTOTYPE(int open_new_file, (void));
|
---|
| 104 | _PROTOTYPE(void new_yy_file, (FILE *file));
|
---|
| 105 | _PROTOTYPE(void use_quit, (int));
|
---|
| 106 |
|
---|
| 107 | /* From number.c */
|
---|
| 108 | _PROTOTYPE(void free_num, (bc_num *num));
|
---|
| 109 | _PROTOTYPE(bc_num new_num, (int length, int scale));
|
---|
| 110 | _PROTOTYPE(void init_numbers, (void));
|
---|
| 111 | _PROTOTYPE(bc_num copy_num, (bc_num num));
|
---|
| 112 | _PROTOTYPE(void init_num, (bc_num *num));
|
---|
| 113 | _PROTOTYPE(void str2num, (bc_num *num, char *str, int scale));
|
---|
| 114 | _PROTOTYPE(char *num2str, (bc_num num));
|
---|
| 115 | _PROTOTYPE(void int2num, (bc_num *num, int val));
|
---|
| 116 | _PROTOTYPE(long num2long, (bc_num num));
|
---|
| 117 | _PROTOTYPE(int bc_compare, (bc_num n1, bc_num n2));
|
---|
| 118 | _PROTOTYPE(char is_zero, (bc_num num));
|
---|
| 119 | _PROTOTYPE(char is_neg, (bc_num num));
|
---|
| 120 | _PROTOTYPE(void bc_add, (bc_num n1, bc_num n2, bc_num *result));
|
---|
| 121 | _PROTOTYPE(void bc_sub, (bc_num n1, bc_num n2, bc_num *result));
|
---|
| 122 | _PROTOTYPE(void bc_multiply, (bc_num n1, bc_num n2, bc_num *prod, int scale));
|
---|
| 123 | _PROTOTYPE(int bc_divide, (bc_num n1, bc_num n2, bc_num *quot, int scale));
|
---|
| 124 | _PROTOTYPE(int bc_modulo, (bc_num num1, bc_num num2, bc_num *result, int scale));
|
---|
| 125 | _PROTOTYPE(void bc_raise, (bc_num num1, bc_num num2, bc_num *result, int scale));
|
---|
| 126 | _PROTOTYPE(int bc_sqrt, (bc_num *num, int scale));
|
---|
| 127 | _PROTOTYPE(void out_long, (long val, int size, int space,
|
---|
| 128 | void (*out_char)(int)));
|
---|
| 129 | _PROTOTYPE(void out_num, (bc_num num, int o_base, void (* out_char)(int)));
|
---|
| 130 |
|
---|
| 131 |
|
---|
| 132 | /* From storage.c */
|
---|
| 133 | _PROTOTYPE(void init_storage, (void));
|
---|
| 134 | _PROTOTYPE(void more_functions, (void));
|
---|
| 135 | _PROTOTYPE(void more_variables, (void));
|
---|
| 136 | _PROTOTYPE(void more_arrays, (void));
|
---|
| 137 | _PROTOTYPE(void clear_func, (int func ));
|
---|
| 138 | _PROTOTYPE(int fpop, (void));
|
---|
| 139 | _PROTOTYPE(void fpush, (int val ));
|
---|
| 140 | _PROTOTYPE(void pop, (void));
|
---|
| 141 | _PROTOTYPE(void push_copy, (bc_num num ));
|
---|
| 142 | _PROTOTYPE(void push_num, (bc_num num ));
|
---|
| 143 | _PROTOTYPE(char check_stack, (int depth ));
|
---|
| 144 | _PROTOTYPE(bc_var *get_var, (int var_name ));
|
---|
| 145 | _PROTOTYPE(bc_num *get_array_num, (int var_index, long index ));
|
---|
| 146 | _PROTOTYPE(void store_var, (int var_name ));
|
---|
| 147 | _PROTOTYPE(void store_array, (int var_name ));
|
---|
| 148 | _PROTOTYPE(void load_var, (int var_name ));
|
---|
| 149 | _PROTOTYPE(void load_array, (int var_name ));
|
---|
| 150 | _PROTOTYPE(void decr_var, (int var_name ));
|
---|
| 151 | _PROTOTYPE(void decr_array, (int var_name ));
|
---|
| 152 | _PROTOTYPE(void incr_var, (int var_name ));
|
---|
| 153 | _PROTOTYPE(void incr_array, (int var_name ));
|
---|
| 154 | _PROTOTYPE(void auto_var, (int name ));
|
---|
| 155 | _PROTOTYPE(void free_a_tree, (bc_array_node *root, int depth ));
|
---|
| 156 | _PROTOTYPE(void pop_vars, (arg_list *list ));
|
---|
| 157 | _PROTOTYPE(void process_params, (program_counter *pc, int func ));
|
---|
| 158 |
|
---|
| 159 | /* For the scanner and parser.... */
|
---|
| 160 | _PROTOTYPE(int yyparse, (void));
|
---|
| 161 | _PROTOTYPE(int yylex, (void));
|
---|
| 162 |
|
---|