1/* proto.h: Prototype function definitions for "external" functions. */
2
3/*  This file is part of GNU bc.
4    Copyright (C) 1991-1994, 1997, 2000 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/* For the pc version using k&r ACK. (minix1.5 and earlier.) */
32#ifdef SHORTNAMES
33#define init_numbers i_numbers
34#define push_constant push__constant
35#define load_const in_load_const
36#define yy_get_next_buffer yyget_next_buffer
37#define yy_init_buffer yyinit_buffer
38#define yy_last_accepting_state yylast_accepting_state
39#define arglist1 arg1list
40#endif
41
42/* Include the standard library header files. */
43#ifdef HAVE_UNISTD_H
44#include <unistd.h>
45#endif
46#ifdef HAVE_STDLIB_H
47#include <stdlib.h>
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, int is_var));
73_PROTOTYPE(char *arg_str, (arg_list *args));
74_PROTOTYPE(char *call_str, (arg_list *args));
75_PROTOTYPE(void free_args, (arg_list *args));
76_PROTOTYPE(void check_params, (arg_list *params, arg_list *autos));
77_PROTOTYPE(void init_gen, (void));
78_PROTOTYPE(void generate, (char *str));
79_PROTOTYPE(void run_code, (void));
80_PROTOTYPE(void out_char, (int ch));
81_PROTOTYPE(void out_schar, (int ch));
82_PROTOTYPE(id_rec *find_id, (id_rec *tree, char *id));
83_PROTOTYPE(int insert_id_rec, (id_rec **root, id_rec *new_id));
84_PROTOTYPE(void init_tree, (void));
85_PROTOTYPE(int lookup, (char *name, int namekind));
86_PROTOTYPE(char *bc_malloc, (int));
87_PROTOTYPE(void out_of_memory, (void));
88_PROTOTYPE(void welcome, (void));
89_PROTOTYPE(void warranty, (char *));
90_PROTOTYPE(void show_bc_version, (void));
91_PROTOTYPE(void limits, (void));
92_PROTOTYPE(void yyerror, (char *str ,...));
93_PROTOTYPE(void warn, (char *mesg ,...));
94_PROTOTYPE(void rt_error, (char *mesg ,...));
95_PROTOTYPE(void rt_warn, (char *mesg ,...));
96
97/* From load.c */
98_PROTOTYPE(void init_load, (void));
99_PROTOTYPE(void addbyte, (int byte));
100_PROTOTYPE(void def_label, (long lab));
101_PROTOTYPE(long long_val, (char **str));
102_PROTOTYPE(void load_code, (char *code));
103
104/* From main.c */
105_PROTOTYPE(int open_new_file, (void));
106_PROTOTYPE(void new_yy_file, (FILE *file));
107_PROTOTYPE(void use_quit, (int));
108
109/* From storage.c */
110_PROTOTYPE(void init_storage, (void));
111_PROTOTYPE(void more_functions, (void));
112_PROTOTYPE(void more_variables, (void));
113_PROTOTYPE(void more_arrays, (void));
114_PROTOTYPE(void clear_func, (int func ));
115_PROTOTYPE(int fpop, (void));
116_PROTOTYPE(void fpush, (int val ));
117_PROTOTYPE(void pop, (void));
118_PROTOTYPE(void push_copy, (bc_num num ));
119_PROTOTYPE(void push_num, (bc_num num ));
120_PROTOTYPE(char check_stack, (int depth ));
121_PROTOTYPE(bc_var *get_var, (int var_name ));
122_PROTOTYPE(bc_num *get_array_num, (int var_index, long index ));
123_PROTOTYPE(void store_var, (int var_name ));
124_PROTOTYPE(void store_array, (int var_name ));
125_PROTOTYPE(void load_var, (int var_name ));
126_PROTOTYPE(void load_array, (int var_name ));
127_PROTOTYPE(void decr_var, (int var_name ));
128_PROTOTYPE(void decr_array, (int var_name ));
129_PROTOTYPE(void incr_var, (int var_name ));
130_PROTOTYPE(void incr_array, (int var_name ));
131_PROTOTYPE(void auto_var, (int name ));
132_PROTOTYPE(void free_a_tree, (bc_array_node *root, int depth ));
133_PROTOTYPE(void pop_vars, (arg_list *list ));
134_PROTOTYPE(void process_params, (program_counter *pc, int func ));
135
136/* For the scanner and parser.... */
137_PROTOTYPE(int yyparse, (void));
138_PROTOTYPE(int yylex, (void));
139
140#if defined(LIBEDIT)
141/* The *?*&^ prompt function */
142_PROTOTYPE(char *null_prompt, (EditLine *));
143#endif
144
145/* Other things... */
146#ifndef HAVE_UNISTD_H
147_PROTOTYPE (int getopt, (int, char *[], CONST char *));
148#endif
149