1 /* $NetBSD: proto.h,v 1.2 2017/04/10 15:13:22 christos Exp $ */ 2 3 /* 4 * Copyright (C) 1991-1994, 1997, 2006, 2008, 2012-2017 Free Software Foundation, Inc. 5 * Copyright (C) 2016-2017 Philip A. Nelson. 6 * All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without 9 * modification, are permitted provided that the following conditions 10 * are met: 11 * 12 * 1. Redistributions of source code must retain the above copyright 13 * notice, this list of conditions and the following disclaimer. 14 * 2. Redistributions in binary form must reproduce the above copyright 15 * notice, this list of conditions and the following disclaimer in the 16 * documentation and/or other materials provided with the distribution. 17 * 3. The names Philip A. Nelson and Free Software Foundation may not be 18 * used to endorse or promote products derived from this software 19 * without specific prior written permission. 20 * 21 * THIS SOFTWARE IS PROVIDED BY PHILIP A. NELSON ``AS IS'' AND ANY EXPRESS OR 22 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 23 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 24 * IN NO EVENT SHALL PHILIP A. NELSON OR THE FREE SOFTWARE FOUNDATION BE 25 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 31 * THE POSSIBILITY OF SUCH DAMAGE. 32 */ 33 34 /* proto.h: Prototype function definitions for "external" functions. */ 35 36 /* For the pc version using k&r ACK. (minix1.5 and earlier.) */ 37 #ifdef SHORTNAMES 38 #define init_numbers i_numbers 39 #define push_constant push__constant 40 #define load_const in_load_const 41 #define yy_get_next_buffer yyget_next_buffer 42 #define yy_init_buffer yyinit_buffer 43 #define yy_last_accepting_state yylast_accepting_state 44 #define arglist1 arg1list 45 #endif 46 47 /* Include the standard library header files. */ 48 #ifdef HAVE_UNISTD_H 49 #include <unistd.h> 50 #endif 51 #ifdef HAVE_STDLIB_H 52 #include <stdlib.h> 53 #endif 54 55 /* From execute.c */ 56 void stop_execution (int); 57 unsigned char byte (program_counter *pc_); 58 void execute (void); 59 int prog_char (void); 60 int input_char (void); 61 void push_constant (int (*in_char)(void), int conv_base); 62 void push_b10_const (program_counter *pc_); 63 void assign (char code); 64 65 /* From util.c */ 66 char *strcopyof (const char *str); 67 arg_list *nextarg (arg_list *args, int val, int is_var); 68 char *arg_str (arg_list *args); 69 char *call_str (arg_list *args); 70 void free_args (arg_list *args); 71 void check_params (arg_list *params, arg_list *autos); 72 void set_genstr_size (int); 73 void init_gen (void); 74 void generate (const char *str); 75 void run_code (void); 76 void out_char (int ch); 77 void out_schar (int ch); 78 id_rec *find_id (id_rec *tree, const char *id); 79 int insert_id_rec (id_rec **root, id_rec *new_id); 80 void init_tree (void); 81 int lookup (char *name, int namekind); 82 void *bc_malloc (size_t); 83 void out_of_memory (void) __attribute__((__noreturn__)); 84 void welcome (void); 85 void warranty (const char *); 86 void show_bc_version (void); 87 void limits (void); 88 void yyerror (const char *str, ...) 89 __attribute__((__format__ (__printf__, 1, 2))); 90 void ct_warn (const char *mesg, ...) 91 __attribute__((__format__ (__printf__, 1, 2))); 92 void rt_error (const char *mesg, ...) 93 __attribute__((__format__ (__printf__, 1, 2))); 94 void rt_warn (const char *mesg, ...) 95 __attribute__((__format__ (__printf__, 1, 2))); 96 void bc_exit (int) __attribute__((__noreturn__)); 97 98 /* From load.c */ 99 void init_load (void); 100 void addbyte (unsigned char thebyte); 101 void def_label (unsigned long lab); 102 long long_val (const char **str); 103 void load_code (const char *code); 104 105 /* From main.c */ 106 int open_new_file (void); 107 void new_yy_file (FILE *file); 108 void use_quit (int) __attribute__((__noreturn__)); 109 110 /* From storage.c */ 111 void init_storage (void); 112 void more_functions (void); 113 void more_variables (void); 114 void more_arrays (void); 115 void clear_func (int func); 116 int fpop (void); 117 void fpush (int val); 118 void pop (void); 119 void push_copy (bc_num num); 120 void push_num (bc_num num); 121 char check_stack (int depth); 122 bc_var *get_var (int var_name); 123 bc_num *get_array_num (int var_index, unsigned long _index_); 124 void store_var (int var_name); 125 void store_array (int var_name); 126 void load_var (int var_name); 127 void load_array (int var_name); 128 void decr_var (int var_name); 129 void decr_array (int var_name); 130 void incr_var (int var_name); 131 void incr_array (int var_name); 132 void auto_var (int name); 133 void free_a_tree (bc_array_node *root, int depth); 134 void pop_vars (arg_list *list); 135 void process_params (program_counter *_pc_, int func); 136 137 /* For the scanner and parser.... */ 138 int yyparse (void); 139 int yylex (void); 140 141 #if defined(LIBEDIT) 142 /* The *?*&^ prompt function */ 143 char *null_prompt (EditLine *); 144 #endif 145 146 /* Other things... */ 147 #ifndef HAVE_UNISTD_H 148 (int getopt (int, char *[], CONST char *); 149 #endif 150