diff options
author | peter <peter@FreeBSD.org> | 2001-11-04 06:20:02 +0000 |
---|---|---|
committer | peter <peter@FreeBSD.org> | 2001-11-04 06:20:02 +0000 |
commit | 7463429fd40639833e50379b37b876aca788495c (patch) | |
tree | 41126b00032f971d1ddf261856da5350d44b9335 /contrib/bc/h | |
parent | 25ccde64e70426c9f01780231c5af9e5b8920f7a (diff) | |
download | FreeBSD-src-7463429fd40639833e50379b37b876aca788495c.zip FreeBSD-src-7463429fd40639833e50379b37b876aca788495c.tar.gz |
Remove files that were not part of the bc-1.06 import.
Diffstat (limited to 'contrib/bc/h')
-rw-r--r-- | contrib/bc/h/bcdefs.h | 166 | ||||
-rw-r--r-- | contrib/bc/h/const.h | 101 | ||||
-rw-r--r-- | contrib/bc/h/global.h | 147 | ||||
-rw-r--r-- | contrib/bc/h/proto.h | 171 | ||||
-rw-r--r-- | contrib/bc/h/version.h | 28 |
5 files changed, 0 insertions, 613 deletions
diff --git a/contrib/bc/h/bcdefs.h b/contrib/bc/h/bcdefs.h deleted file mode 100644 index 0e51b2b..0000000 --- a/contrib/bc/h/bcdefs.h +++ /dev/null @@ -1,166 +0,0 @@ -/* bcdefs.h: The single file to include all constants and type definitions. */ - -/* This file is part of GNU bc. - Copyright (C) 1991, 1992, 1993, 1994, 1997 Free Software Foundation, Inc. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License , or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; see the file COPYING. If not, write to - the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - - You may contact the author by: - e-mail: phil@cs.wwu.edu - us-mail: Philip A. Nelson - Computer Science Department, 9062 - Western Washington University - Bellingham, WA 98226-9062 - -*************************************************************************/ - -/* Include the configuration file. */ -#include "config.h" - -/* Standard includes for all files. */ -#include <stdio.h> -#include <sys/types.h> -#include <ctype.h> -#ifdef HAVE_STRINGS_H -#include <strings.h> -#else -#include <string.h> -#endif -#ifdef HAVE_LIMITS_H -#include <limits.h> -#endif - -/* Include the other definitions. */ -#include "const.h" -#include "number.h" - - -/* These definitions define all the structures used in - code and data storage. This includes the representation of - labels. The "guiding" principle is to make structures that - take a minimum of space when unused but can be built to contain - the full structures. */ - -/* Labels are first. Labels are generated sequentially in functions - and full code. They just "point" to a single bye in the code. The - "address" is the byte number. The byte number is used to get an - actual character pointer. */ - -typedef struct bc_label_group - { - long l_adrs [ BC_LABEL_GROUP ]; - struct bc_label_group *l_next; - } bc_label_group; - -/* Argument list. Recorded in the function so arguments can - be checked at call time. */ - -typedef struct arg_list - { - int av_name; - int arg_is_var; /* Extension ... variable parameters. */ - struct arg_list *next; - } arg_list; - -/* Each function has its own code segments and labels. There can be - no jumps between functions so labels are unique to a function. */ - -typedef struct - { - char f_defined; /* Is this function defined yet. */ - char *f_body[BC_MAX_SEGS]; - int f_code_size; - bc_label_group *f_label; - arg_list *f_params; - arg_list *f_autos; - } bc_function; - -/* Code addresses. */ -typedef struct { - int pc_func; - int pc_addr; - } program_counter; - - -/* Variables are "pushable" (auto) and thus we need a stack mechanism. - This is built into the variable record. */ - -typedef struct bc_var - { - bc_num v_value; - struct bc_var *v_next; - } bc_var; - - -/* bc arrays can also be "auto" variables and thus need the same - kind of stacking mechanisms. */ - -typedef struct bc_array_node - { - union - { - bc_num n_num [NODE_SIZE]; - struct bc_array_node *n_down [NODE_SIZE]; - } n_items; - } bc_array_node; - -typedef struct bc_array - { - bc_array_node *a_tree; - short a_depth; - } bc_array; - -typedef struct bc_var_array - { - bc_array *a_value; - char a_param; - struct bc_var_array *a_next; - } bc_var_array; - - -/* For the stacks, execution and function, we need records to allow - for arbitrary size. */ - -typedef struct estack_rec { - bc_num s_num; - struct estack_rec *s_next; -} estack_rec; - -typedef struct fstack_rec { - int s_val; - struct fstack_rec *s_next; -} fstack_rec; - - -/* The following are for the name tree. */ - -typedef struct id_rec { - char *id; /* The program name. */ - /* A name == 0 => nothing assigned yet. */ - int a_name; /* The array variable name (number). */ - int f_name; /* The function name (number). */ - int v_name; /* The variable name (number). */ - short balance; /* For the balanced tree. */ - struct id_rec *left, *right; /* Tree pointers. */ -} id_rec; - - -/* A list of files to process. */ - -typedef struct file_node { - char *name; - struct file_node *next; -} file_node; - diff --git a/contrib/bc/h/const.h b/contrib/bc/h/const.h deleted file mode 100644 index 1ed1465..0000000 --- a/contrib/bc/h/const.h +++ /dev/null @@ -1,101 +0,0 @@ -/* const.h: Constants for bc. */ - -/* This file is part of GNU bc. - Copyright (C) 1991, 1992, 1993, 1994, 1997 Free Software Foundation, Inc. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License , or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; see the file COPYING. If not, write to - the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - - You may contact the author by: - e-mail: phil@cs.wwu.edu - us-mail: Philip A. Nelson - Computer Science Department, 9062 - Western Washington University - Bellingham, WA 98226-9062 - -*************************************************************************/ - - -/* Define INT_MAX and LONG_MAX if not defined. Assuming 32 bits... */ - -#ifndef INT_MAX -#define INT_MAX 0x7FFFFFFF -#endif -#ifndef LONG_MAX -#define LONG_MAX 0x7FFFFFFF -#endif - - -/* Define constants in some reasonable size. The next 4 constants are - POSIX constants. */ - -#ifdef BC_BASE_MAX - /* <limits.h> on a POSIX.2 system may have defined these. Override. */ -# undef BC_BASE_MAX -# undef BC_SCALE_MAX -# undef BC_STRING_MAX -# undef BC_DIM_MAX -#endif - -#define BC_BASE_MAX INT_MAX -#define BC_SCALE_MAX INT_MAX -#define BC_STRING_MAX INT_MAX - - -/* Definitions for arrays. */ - -#define BC_DIM_MAX 65535 /* this should be NODE_SIZE^NODE_DEPTH-1 */ - -#define NODE_SIZE 16 /* Must be a power of 2. */ -#define NODE_MASK 0xf /* Must be NODE_SIZE-1. */ -#define NODE_SHIFT 4 /* Number of 1 bits in NODE_MASK. */ -#define NODE_DEPTH 4 - - -/* Other BC limits defined but not part of POSIX. */ - -#define BC_LABEL_GROUP 64 -#define BC_LABEL_LOG 6 -#define BC_MAX_SEGS 16 /* Code segments. */ -#define BC_SEG_SIZE 1024 -#define BC_SEG_LOG 10 - -/* Maximum number of variables, arrays and functions and the - allocation increment for the dynamic arrays. */ - -#define MAX_STORE 32767 -#define STORE_INCR 32 - -/* Other interesting constants. */ - -#define FALSE 0 -#define TRUE 1 - -/* for use with lookup (). */ -#define SIMPLE 0 -#define ARRAY 1 -#define FUNCT 2 -#define FUNCTDEF 3 - -#define EXTERN extern -#ifdef __STDC__ -#define CONST const -#define VOID void -#else -#define CONST -#define VOID -#endif - -/* Include the version definition. */ -#include "version.h" diff --git a/contrib/bc/h/global.h b/contrib/bc/h/global.h deleted file mode 100644 index bc431dc..0000000 --- a/contrib/bc/h/global.h +++ /dev/null @@ -1,147 +0,0 @@ -/* global.h: The global variables for bc. */ - -/* This file is part of GNU bc. - Copyright (C) 1991, 1992, 1993, 1994, 1997 Free Software Foundation, Inc. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License , or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; see the file COPYING. If not, write to - the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - - You may contact the author by: - e-mail: phil@cs.wwu.edu - us-mail: Philip A. Nelson - Computer Science Department, 9062 - Western Washington University - Bellingham, WA 98226-9062 - -*************************************************************************/ - - -/* The current break level's lable. */ -EXTERN int break_label; - -/* The current if statement's else label or label after else. */ -EXTERN int if_label; - -/* The current for statement label for continuing the loop. */ -EXTERN int continue_label; - -/* Next available label number. */ -EXTERN int next_label; - -/* Byte code character storage. Used in many places for generation of code. */ -EXTERN char genstr[80]; - -/* Count of characters printed to the output in compile_only mode. */ -EXTERN int out_count; - -/* Have we generated any code since the last initialization of the code - generator. */ -EXTERN char did_gen; - -/* Is this run an interactive execution. (Is stdin a terminal?) */ -EXTERN char interactive; - -/* Just generate the byte code. -c flag. */ -EXTERN int compile_only; - -/* Load the standard math functions. -l flag. */ -EXTERN int use_math; - -/* Give a warning on use of any non-standard feature (non-POSIX). -w flag. */ -EXTERN int warn_not_std; - -/* Accept POSIX bc only! -s flag. */ -EXTERN int std_only; - -/* Don't print the banner at start up. -q flag. */ -EXTERN int quiet; - -/* The list of file names to process. */ -EXTERN file_node *file_names; - -/* The name of the current file being processed. */ -EXTERN char *file_name; - -/* Is the current file a named file or standard input? */ -EXTERN char is_std_in; - -/* global variables for the bc machine. All will be dynamic in size.*/ -/* Function storage. main is (0) and functions (1-f_count) */ - -EXTERN bc_function *functions; -EXTERN char **f_names; -EXTERN int f_count; - -/* Variable stoarge and reverse names. */ - -EXTERN bc_var **variables; -EXTERN char **v_names; -EXTERN int v_count; - -/* Array Variable storage and reverse names. */ - -EXTERN bc_var_array **arrays; -EXTERN char **a_names; -EXTERN int a_count; - -/* Execution stack. */ -EXTERN estack_rec *ex_stack; - -/* Function return stack. */ -EXTERN fstack_rec *fn_stack; - -/* Current ibase, obase, scale, and n_history (if needed). */ -EXTERN int i_base; -EXTERN int o_base; -EXTERN int scale; -#ifdef READLINE -EXTERN int n_history; -#endif - -/* "Condition code" -- false (0) or true (1) */ -EXTERN char c_code; - -/* Records the number of the runtime error. */ -EXTERN char runtime_error; - -/* Holds the current location of execution. */ -EXTERN program_counter pc; - -/* For POSIX bc, this is just for number output, not strings. */ -EXTERN int out_col; - -/* Keeps track of the current number of characters per output line. - This includes the \n at the end of the line. */ -EXTERN int line_size; - -/* Input Line numbers and other error information. */ -EXTERN int line_no; -EXTERN int had_error; - -/* For larger identifiers, a tree, and how many "storage" locations - have been allocated. */ - -EXTERN int next_array; -EXTERN int next_func; -EXTERN int next_var; - -EXTERN id_rec *name_tree; - -/* defined in number.c */ -extern bc_num _zero_; -extern bc_num _one_; - -/* For use with getopt. Do not declare them here.*/ -extern int optind; - diff --git a/contrib/bc/h/proto.h b/contrib/bc/h/proto.h deleted file mode 100644 index 016a166..0000000 --- a/contrib/bc/h/proto.h +++ /dev/null @@ -1,171 +0,0 @@ -/* proto.h: Prototype function definitions for "external" functions. */ - -/* This file is part of GNU bc. - Copyright (C) 1991, 1992, 1993, 1994, 1997 Free Software Foundation, Inc. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License , or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; see the file COPYING. If not, write to - the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - - You may contact the author by: - e-mail: phil@cs.wwu.edu - us-mail: Philip A. Nelson - Computer Science Department, 9062 - Western Washington University - Bellingham, WA 98226-9062 - -*************************************************************************/ - -/* For the pc version using k&r ACK. (minix1.5 and earlier.) */ -#ifdef SHORTNAMES -#define init_numbers i_numbers -#define push_constant push__constant -#define load_const in_load_const -#define yy_get_next_buffer yyget_next_buffer -#define yy_init_buffer yyinit_buffer -#define yy_last_accepting_state yylast_accepting_state -#define arglist1 arg1list -#endif - -/* Include the standard library header files. */ -#ifdef HAVE_UNISTD_H -#include <unistd.h> -#endif -#ifdef HAVE_STDLIB_H -#include <stdlib.h> -#endif - -/* Define the _PROTOTYPE macro if it is needed. */ - -#ifndef _PROTOTYPE -#ifdef __STDC__ -#define _PROTOTYPE(func, args) func args -#else -#define _PROTOTYPE(func, args) func() -#endif -#endif - -/* From execute.c */ -_PROTOTYPE(void stop_execution, (int)); -_PROTOTYPE(unsigned char byte, (program_counter *pc)); -_PROTOTYPE(void execute, (void)); -_PROTOTYPE(char prog_char, (void)); -_PROTOTYPE(char input_char, (void)); -_PROTOTYPE(void push_constant, (char (*in_char)(void), int conv_base)); -_PROTOTYPE(void push_b10_const, (program_counter *pc)); -_PROTOTYPE(void assign, (int c_code)); - -/* From util.c */ -_PROTOTYPE(char *strcopyof, (char *str)); -_PROTOTYPE(arg_list *nextarg, (arg_list *args, int val, int is_var)); -_PROTOTYPE(char *arg_str, (arg_list *args)); -_PROTOTYPE(char *call_str, (arg_list *args)); -_PROTOTYPE(void free_args, (arg_list *args)); -_PROTOTYPE(void check_params, (arg_list *params, arg_list *autos)); -_PROTOTYPE(void init_gen, (void)); -_PROTOTYPE(void generate, (char *str)); -_PROTOTYPE(void run_code, (void)); -_PROTOTYPE(void out_char, (int ch)); -_PROTOTYPE(id_rec *find_id, (id_rec *tree, char *id)); -_PROTOTYPE(int insert_id_rec, (id_rec **root, id_rec *new_id)); -_PROTOTYPE(void init_tree, (void)); -_PROTOTYPE(int lookup, (char *name, int namekind)); -_PROTOTYPE(char *bc_malloc, (int)); -_PROTOTYPE(void out_of_memory, (void)); -_PROTOTYPE(void welcome, (void)); -_PROTOTYPE(void warranty, (char *)); -_PROTOTYPE(void limits, (void)); -_PROTOTYPE(void yyerror, (char *str ,...)); -_PROTOTYPE(void warn, (char *mesg ,...)); -_PROTOTYPE(void rt_error, (char *mesg ,...)); -_PROTOTYPE(void rt_warn, (char *mesg ,...)); - -/* From load.c */ -_PROTOTYPE(void init_load, (void)); -_PROTOTYPE(void addbyte, (int byte)); -_PROTOTYPE(void def_label, (long lab)); -_PROTOTYPE(long long_val, (char **str)); -_PROTOTYPE(void load_code, (char *code)); - -/* From main.c */ -_PROTOTYPE(int main, (int argc , char *argv [])); -_PROTOTYPE(int open_new_file, (void)); -_PROTOTYPE(void new_yy_file, (FILE *file)); -_PROTOTYPE(void use_quit, (int)); - -/* From number.c */ -_PROTOTYPE(void free_num, (bc_num *num)); -_PROTOTYPE(bc_num new_num, (int length, int scale)); -_PROTOTYPE(void init_numbers, (void)); -_PROTOTYPE(bc_num copy_num, (bc_num num)); -_PROTOTYPE(void init_num, (bc_num *num)); -_PROTOTYPE(void str2num, (bc_num *num, char *str, int scale)); -_PROTOTYPE(char *num2str, (bc_num num)); -_PROTOTYPE(void int2num, (bc_num *num, int val)); -_PROTOTYPE(long num2long, (bc_num num)); -_PROTOTYPE(int bc_compare, (bc_num n1, bc_num n2)); -_PROTOTYPE(char is_zero, (bc_num num)); -_PROTOTYPE(char is_neg, (bc_num num)); -_PROTOTYPE(void bc_add, (bc_num n1, bc_num n2, bc_num *result, int scale_min)); -_PROTOTYPE(void bc_sub, (bc_num n1, bc_num n2, bc_num *result, int scale_min)); -_PROTOTYPE(void bc_multiply, (bc_num n1, bc_num n2, bc_num *prod, int scale)); -_PROTOTYPE(int bc_divide, (bc_num n1, bc_num n2, bc_num *quot, int scale)); -_PROTOTYPE(int bc_modulo, - (bc_num num1, bc_num num2, bc_num *result, int scale)); -_PROTOTYPE(int bc_divmod, - (bc_num num1, bc_num num2, bc_num *quot, bc_num *rem, int scale)); -_PROTOTYPE(int bc_raisemod, - (bc_num base, bc_num expo, bc_num mod, bc_num *result, int scale)); -_PROTOTYPE(void bc_raise, - (bc_num num1, bc_num num2, bc_num *result, int scale)); -_PROTOTYPE(int bc_sqrt, (bc_num *num, int scale)); -_PROTOTYPE(void out_long, (long val, int size, int space, - void (*out_char)(int))); -_PROTOTYPE(void out_num, (bc_num num, int o_base, void (* out_char)(int))); - - -/* From storage.c */ -_PROTOTYPE(void init_storage, (void)); -_PROTOTYPE(void more_functions, (void)); -_PROTOTYPE(void more_variables, (void)); -_PROTOTYPE(void more_arrays, (void)); -_PROTOTYPE(void clear_func, (int func )); -_PROTOTYPE(int fpop, (void)); -_PROTOTYPE(void fpush, (int val )); -_PROTOTYPE(void pop, (void)); -_PROTOTYPE(void push_copy, (bc_num num )); -_PROTOTYPE(void push_num, (bc_num num )); -_PROTOTYPE(char check_stack, (int depth )); -_PROTOTYPE(bc_var *get_var, (int var_name )); -_PROTOTYPE(bc_num *get_array_num, (int var_index, long index )); -_PROTOTYPE(void store_var, (int var_name )); -_PROTOTYPE(void store_array, (int var_name )); -_PROTOTYPE(void load_var, (int var_name )); -_PROTOTYPE(void load_array, (int var_name )); -_PROTOTYPE(void decr_var, (int var_name )); -_PROTOTYPE(void decr_array, (int var_name )); -_PROTOTYPE(void incr_var, (int var_name )); -_PROTOTYPE(void incr_array, (int var_name )); -_PROTOTYPE(void auto_var, (int name )); -_PROTOTYPE(void free_a_tree, (bc_array_node *root, int depth )); -_PROTOTYPE(void pop_vars, (arg_list *list )); -_PROTOTYPE(void process_params, (program_counter *pc, int func )); - -/* For the scanner and parser.... */ -_PROTOTYPE(int yyparse, (void)); -_PROTOTYPE(int yylex, (void)); - -/* Other things... */ -#ifndef HAVE_UNISTD_H -_PROTOTYPE (int getopt, (int, char *[], CONST char *)); -#endif diff --git a/contrib/bc/h/version.h b/contrib/bc/h/version.h deleted file mode 100644 index b98222f..0000000 --- a/contrib/bc/h/version.h +++ /dev/null @@ -1,28 +0,0 @@ -/* version.h: version information for GNU bc and GNU dc */ - -/* This file is part of GNU bc and GNU dc. - * Copyright (C) 1994, 1997, 1998 Free Software Foundation, Inc. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, you can either send email to this - * program's author (see below) or write to: The Free Software Foundation, - * Inc.; 675 Mass Ave. Cambridge, MA 02139, USA. - */ - -#define BC_VERSION \ -"bc 1.05\n\ -Copyright 1991, 1992, 1993, 1994, 1997, 1998 Free Software Foundation, Inc." - -#define DC_VERSION \ -"dc 1.2 (GNU bc 1.05)\n\ -Copyright 1994, 1997, 1998 Free Software Foundation, Inc." |