Blame bc/global.h

Packit 70b277
/*  This file is part of GNU bc.
Packit 70b277
Packit 70b277
    Copyright (C) 1991-1994, 1997, 2006, 2008, 2012-2017 Free Software Foundation, Inc.
Packit 70b277
Packit 70b277
    This program is free software; you can redistribute it and/or modify
Packit 70b277
    it under the terms of the GNU General Public License as published by
Packit 70b277
    the Free Software Foundation; either version 3 of the License , or
Packit 70b277
    (at your option) any later version.
Packit 70b277
Packit 70b277
    This program is distributed in the hope that it will be useful,
Packit 70b277
    but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 70b277
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Packit 70b277
    GNU General Public License for more details.
Packit 70b277
Packit 70b277
    You should have received a copy of the GNU General Public License
Packit 70b277
    along with this program; see the file COPYING.  If not, see
Packit 70b277
    <http://www.gnu.org/licenses>.
Packit 70b277
Packit 70b277
    You may contact the author by:
Packit 70b277
       e-mail:  philnelson@acm.org
Packit 70b277
      us-mail:  Philip A. Nelson
Packit 70b277
                Computer Science Department, 9062
Packit 70b277
                Western Washington University
Packit 70b277
                Bellingham, WA 98226-9062
Packit 70b277
       
Packit 70b277
*************************************************************************/
Packit 70b277
Packit 70b277
/* global.h:  The global variables for bc.  */
Packit 70b277
Packit 70b277
/* The current break level's label. */
Packit 70b277
EXTERN int break_label;
Packit 70b277
Packit 70b277
/* The current if statement's else label or label after else. */
Packit 70b277
EXTERN int if_label;
Packit 70b277
Packit 70b277
/* The current for statement label for continuing the loop. */
Packit 70b277
EXTERN int continue_label;
Packit 70b277
Packit 70b277
/* Next available label number. */
Packit 70b277
EXTERN int next_label;
Packit 70b277
Packit 70b277
/* Byte code character storage.  Used in many places for generation of code. */
Packit 70b277
EXTERN char  *genstr  INIT(NULL);
Packit 70b277
EXTERN int    genlen  INIT(0);
Packit 70b277
Packit 70b277
/* Count of characters printed to the output in compile_only mode. */
Packit 70b277
EXTERN int out_count;
Packit 70b277
Packit 70b277
/* Have we generated any code since the last initialization of the code
Packit 70b277
   generator.  */
Packit 70b277
EXTERN char did_gen;
Packit 70b277
Packit 70b277
/* Is this run an interactive execution.  (Is stdin a terminal?) */
Packit 70b277
EXTERN char interactive  INIT(FALSE);
Packit 70b277
Packit 70b277
/* Just generate the byte code.  -c flag. */
Packit 70b277
EXTERN int compile_only INIT(FALSE);
Packit 70b277
Packit 70b277
/* Load the standard math functions.  -l flag. */
Packit 70b277
EXTERN int use_math  INIT(FALSE);
Packit 70b277
Packit 70b277
/* Give a warning on use of any non-standard feature (non-POSIX).  -w flag. */
Packit 70b277
EXTERN int warn_not_std  INIT(FALSE);
Packit 70b277
Packit 70b277
/* Accept POSIX bc only!  -s flag. */
Packit 70b277
EXTERN int std_only  INIT(FALSE);
Packit 70b277
Packit 70b277
/* Don't print the banner at start up.  -q flag. */
Packit 70b277
EXTERN int quiet  INIT(FALSE);
Packit 70b277
Packit 70b277
/* The list of file names to process. */
Packit 70b277
EXTERN file_node *file_names  INIT(NULL);
Packit 70b277
Packit 70b277
/* The name of the current file being processed. */
Packit 70b277
EXTERN char *file_name;
Packit 70b277
Packit 70b277
/* Is the current file a named file or standard input? */
Packit 70b277
EXTERN char   is_std_in;
Packit 70b277
Packit 70b277
/* global variables for the bc machine. All will be dynamic in size.*/
Packit 70b277
/* Function storage. main is (0) and functions (1-f_count) */
Packit 70b277
Packit 70b277
EXTERN bc_function *functions;
Packit 70b277
EXTERN char **f_names;
Packit 70b277
EXTERN int  f_count;
Packit 70b277
Packit 70b277
/* Variable stoarge and reverse names. */
Packit 70b277
Packit 70b277
EXTERN bc_var **variables;
Packit 70b277
EXTERN char **v_names;
Packit 70b277
EXTERN int  v_count;
Packit 70b277
Packit 70b277
/* Array Variable storage and reverse names. */
Packit 70b277
Packit 70b277
EXTERN bc_var_array **arrays;
Packit 70b277
EXTERN char **a_names;
Packit 70b277
EXTERN int  a_count;
Packit 70b277
Packit 70b277
/* Execution stack. */
Packit 70b277
EXTERN estack_rec *ex_stack;
Packit 70b277
Packit 70b277
/* Function return stack. */
Packit 70b277
EXTERN fstack_rec *fn_stack;
Packit 70b277
Packit 70b277
/* Current ibase, obase, scale, and n_history (if needed). */
Packit 70b277
EXTERN int i_base;
Packit 70b277
EXTERN int o_base;
Packit 70b277
EXTERN int scale;
Packit 70b277
#if defined(READLINE) || defined(LIBEDIT)
Packit 70b277
EXTERN int n_history;
Packit 70b277
#endif
Packit 70b277
Packit 70b277
#if defined(LIBEDIT)
Packit 70b277
/* LIBEDIT data */
Packit 70b277
EditLine *edit INIT(NULL);
Packit 70b277
History  *hist;
Packit 70b277
HistEvent histev;
Packit 70b277
#endif
Packit 70b277
Packit 70b277
/* "Condition code" -- false (0) or true (1) */
Packit 70b277
EXTERN char c_code;
Packit 70b277
Packit 70b277
/* Records the number of the runtime error. */
Packit 70b277
EXTERN char runtime_error;
Packit 70b277
Packit 70b277
/* Holds the current location of execution. */
Packit 70b277
EXTERN program_counter pc;
Packit 70b277
Packit 70b277
/* For POSIX bc, this is just for number output, not strings. */
Packit 70b277
EXTERN int out_col;
Packit 70b277
Packit 70b277
/* Keeps track of the current number of characters per output line.
Packit 70b277
   This includes the \n at the end of the line. */
Packit 70b277
EXTERN int line_size;
Packit 70b277
Packit 70b277
/* Input Line numbers and other error information. */
Packit 70b277
EXTERN int line_no;
Packit 70b277
EXTERN int had_error;
Packit 70b277
Packit 70b277
/* For larger identifiers, a tree, and how many "storage" locations
Packit 70b277
   have been allocated. */
Packit 70b277
Packit 70b277
EXTERN int next_array;
Packit 70b277
EXTERN int next_func;
Packit 70b277
EXTERN int next_var;
Packit 70b277
Packit 70b277
EXTERN id_rec *name_tree;
Packit 70b277
Packit 70b277
/* For use with getopt.  Do not declare them here.*/
Packit 70b277
extern int optind;
Packit 70b277
Packit 70b277
/* Access to the yy input file.  Defined in scan.c. */
Packit 70b277
extern FILE *yyin;
Packit 70b277
Packit 70b277
/* Access to libmath */
Packit 70b277
extern CONST char *libmath[];