[Midnightbsd-cvs] src: contrib/bc: Remove GNU bc/dc from contrib.

archite at midnightbsd.org archite at midnightbsd.org
Sat Aug 25 14:54:01 EDT 2007


Log Message:
-----------
Remove GNU bc/dc from contrib.

Removed Files:
-------------
    src/contrib/bc:
        AUTHORS
        ChangeLog
        FAQ
        FREEBSD-upgrade
        INSTALL
        Makefile.am
        Makefile.in
        NEWS
        README
        acconfig.h
        aclocal.m4
        config.h.in
        configure
        configure.in
        install-sh
        missing
        mkinstalldirs
        stamp-h.in
    src/contrib/bc/Examples:
        ckbook.b
        pi.b
        primes.b
        twins.b
    src/contrib/bc/Test:
        BUG.bc
        array.b
        arrayp.b
        aryprm.b
        atan.b
        checklib.b
        div.b
        exp.b
        fact.b
        jn.b
        ln.b
        mul.b
        raise.b
        signum
        sine.b
        sqrt.b
        sqrt1.b
        sqrt2.b
        testfn.b
        timetest
    src/contrib/bc/bc:
        Makefile.am
        Makefile.in
        bc.y
        bcdefs.h
        const.h
        execute.c
        fix-libmath_h
        global.c
        global.h
        libmath.b
        libmath.h
        load.c
        main.c
        proto.h
        sbc.y
        scan.l
        storage.c
        util.c
    src/contrib/bc/dc:
        Makefile.am
        Makefile.in
        array.c
        dc-proto.h
        dc-regdef.h
        dc.c
        dc.h
        eval.c
        misc.c
        numeric.c
        stack.c
        string.c
    src/contrib/bc/doc:
        Makefile.am
        Makefile.in
        bc.1
        bc.texi
        dc.1
        dc.texi
    src/contrib/bc/h:
        number.h
    src/contrib/bc/lib:
        Makefile.am
        Makefile.in
        number.c
        testmul.c
        vfprintf.c

-------------- next part --------------
--- contrib/bc/bc/util.c
+++ /dev/null
@@ -1,873 +0,0 @@
-/* util.c: Utility routines for bc. */
-
-/*  This file is part of GNU bc.
-    Copyright (C) 1991-1994, 1997, 2000 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, Inc.
-      59 Temple Place, Suite 330
-      Boston, MA 02111 USA
-
-    You may contact the author by:
-       e-mail:  philnelson at acm.org
-      us-mail:  Philip A. Nelson
-                Computer Science Department, 9062
-                Western Washington University
-                Bellingham, WA 98226-9062
-       
-*************************************************************************/
-
-
-#include "bcdefs.h"
-#ifndef VARARGS
-#include <stdarg.h>
-#else
-#include <varargs.h>
-#endif
-#include "global.h"
-#include "proto.h"
-
-
-/* strcopyof mallocs new memory and copies a string to to the new
-   memory. */
-
-char *
-strcopyof (str)
-     char *str;
-{
-  char *temp;
-
-  temp = (char *) bc_malloc (strlen (str)+1);
-  return (strcpy (temp,str));
-}
-
-
-/* nextarg adds another value to the list of arguments. */
-
-arg_list *
-nextarg (args, val, is_var)
-     arg_list *args;
-     int val;
-     int is_var;
-{ arg_list *temp;
-
-  temp = (arg_list *) bc_malloc (sizeof (arg_list));
-  temp->av_name = val;
-  temp->arg_is_var = is_var;
-  temp->next = args;
- 
-  return (temp);
-}
-
-
-/* For generate, we must produce a string in the form
-    "val,val,...,val".  We also need a couple of static variables
-   for retaining old generated strings.  It also uses a recursive
-   function that builds the string. */
-
-static char *arglist1 = NULL, *arglist2 = NULL;
-
-
-/* make_arg_str does the actual construction of the argument string.
-   ARGS is the pointer to the list and LEN is the maximum number of
-   characters needed.  1 char is the minimum needed. 
- */
-
-_PROTOTYPE (static char *make_arg_str, (arg_list *args, int len));
-
-static char *
-make_arg_str (args, len)
-      arg_list *args;
-      int len;
-{
-  char *temp;
-  char sval[20];
-
-  /* Recursive call. */
-  if (args != NULL)
-    temp = make_arg_str (args->next, len+12);
-  else
-    {
-      temp = (char *) bc_malloc (len);
-      *temp = 0;
-      return temp;
-    }
-
-  /* Add the current number to the end of the string. */
-  if (args->arg_is_var)
-    if (len != 1) 
-      sprintf (sval, "*%d,", args->av_name);
-    else
-      sprintf (sval, "*%d", args->av_name);
-  else
-    if (len != 1) 
-      sprintf (sval, "%d,", args->av_name);
-    else
-      sprintf (sval, "%d", args->av_name);
-  temp = strcat (temp, sval);
-  return (temp);
-}
-
-char *
-arg_str (args)
-     arg_list *args;
-{
-  if (arglist2 != NULL) 
-    free (arglist2);
-  arglist2 = arglist1;
-  arglist1 = make_arg_str (args, 1);
-  return (arglist1);
-}
-
-char *
-call_str (args)
-     arg_list *args;
-{
-  arg_list *temp;
-  int       arg_count;
-  int       ix;
-  
-  if (arglist2 != NULL) 
-    free (arglist2);
-  arglist2 = arglist1;
-
-  /* Count the number of args and add the 0's and 1's. */
-  for (temp = args, arg_count = 0; temp != NULL; temp = temp->next)
-    arg_count++;
-  arglist1 = (char *) bc_malloc(arg_count+1);
-  for (temp = args, ix=0; temp != NULL; temp = temp->next)
-    arglist1[ix++] = ( temp->av_name ? '1' : '0');
-  arglist1[ix] = 0;
-      
-  return (arglist1);
-}
-
-/* free_args frees an argument list ARGS. */
-
-void
-free_args (args)
-      arg_list *args;
-{ 
-  arg_list *temp;
- 
-  temp = args;
-  while (temp != NULL)
-    {
-      args = args->next;
-      free (temp);
-      temp = args;
-    }
-}
-
-
-/* Check for valid parameter (PARAMS) and auto (AUTOS) lists.
-   There must be no duplicates any where.  Also, this is where
-   warnings are generated for array parameters. */
-
-void
-check_params ( params, autos )
-     arg_list *params, *autos;
-{
-  arg_list *tmp1, *tmp2;
-
-  /* Check for duplicate parameters. */
-  if (params != NULL)
-    {
-      tmp1 = params;
-      while (tmp1 != NULL)
-	{
-	  tmp2 = tmp1->next;
-	  while (tmp2 != NULL)
-	    {
-	      if (tmp2->av_name == tmp1->av_name) 
-		yyerror ("duplicate parameter names");
-	      tmp2 = tmp2->next;
-	    }
-	  if (tmp1->arg_is_var)
-	    warn ("Variable array parameter");
-	  tmp1 = tmp1->next;
-	}
-    }
-
-  /* Check for duplicate autos. */
-  if (autos != NULL)
-    {
-      tmp1 = autos;
-      while (tmp1 != NULL)
-	{
-	  tmp2 = tmp1->next;
-	  while (tmp2 != NULL)
-	    {
-	      if (tmp2->av_name == tmp1->av_name) 
-		yyerror ("duplicate auto variable names");
-	      tmp2 = tmp2->next;
-	    }
-	  if (tmp1->arg_is_var)
-	    yyerror ("* not allowed here");
-	  tmp1 = tmp1->next;
-	}
-    }
-
-  /* Check for duplicate between parameters and autos. */
-  if ((params != NULL) && (autos != NULL))
-    {
-      tmp1 = params;
-      while (tmp1 != NULL)
-	{
-	  tmp2 = autos;
-	  while (tmp2 != NULL)
-	    {
-	      if (tmp2->av_name == tmp1->av_name) 
-		yyerror ("variable in both parameter and auto lists");
-	      tmp2 = tmp2->next;
-	    }
-	  tmp1 = tmp1->next;
-	}
-    }
-}
-
-
-/* Initialize the code generator the parser. */
-
-void
-init_gen ()
-{
-  /* Get things ready. */
-  break_label = 0;
-  continue_label = 0;
-  next_label  = 1;
-  out_count = 2;
-  if (compile_only) 
-    printf ("@i");
-  else
-    init_load ();
-  had_error = FALSE;
-  did_gen = FALSE;
-}
-
-
-/* generate code STR for the machine. */
-
-void
-generate (str)
-      char *str;
-{
-  did_gen = TRUE;
-  if (compile_only)
-    {
-      printf ("%s",str);
-      out_count += strlen(str);
-      if (out_count > 60)
-	{
-	  printf ("\n");
-	  out_count = 0;
-	}
-    }
-  else
-    load_code (str);
-}
-
-
-/* Execute the current code as loaded. */
-
-void
-run_code()
-{
-  /* If no compile errors run the current code. */
-  if (!had_error && did_gen)
-    {
-      if (compile_only)
-	{
-	  printf ("@r\n"); 
-	  out_count = 0;
-	}
-      else
-	execute ();
-    }
-
-  /* Reinitialize the code generation and machine. */
-  if (did_gen)
-    init_gen();
-  else
-    had_error = FALSE;
-}
-
-
-/* Output routines: Write a character CH to the standard output.
-   It keeps track of the number of characters output and may
-   break the output with a "\<cr>".  Always used for numbers. */
-
-void
-out_char (ch)
-     int ch;
-{
-  if (ch == '\n')
-    {
-      out_col = 0;
-      putchar ('\n');
-    }
-  else
-    {
-      out_col++;
-      if (out_col == line_size-1)
-	{
-	  putchar ('\\');
-	  putchar ('\n');
-	  out_col = 1;
-	}
-      putchar (ch);
-    }
-}
-
-/* Output routines: Write a character CH to the standard output.
-   It keeps track of the number of characters output and may
-   break the output with a "\<cr>".  This one is for strings.
-   In POSIX bc, strings are not broken across lines. */
-
-void
-out_schar (ch)
-     int ch;
-{
-  if (ch == '\n')
-    {
-      out_col = 0;
-      putchar ('\n');
-    }
-  else
-    {
-      if (!std_only)
-	{
-	  out_col++;
-	  if (out_col == line_size-1)
-	    {
-	      putchar ('\\');
-	      putchar ('\n');
-	      out_col = 1;
-	    }
-	}
-      putchar (ch);
-    }
-}
-
-
-/* The following are "Symbol Table" routines for the parser. */
-
-/*  find_id returns a pointer to node in TREE that has the correct
-    ID.  If there is no node in TREE with ID, NULL is returned. */
-
-id_rec *
-find_id (tree, id)
-     id_rec *tree;
-     char   *id;
-{
-  int cmp_result;
-  
-  /* Check for an empty tree. */
-  if (tree == NULL)
-    return NULL;
-
-  /* Recursively search the tree. */
-  cmp_result = strcmp (id, tree->id);
-  if (cmp_result == 0)
-    return tree;  /* This is the item. */
-  else if (cmp_result < 0)
-    return find_id (tree->left, id);
-  else
-    return find_id (tree->right, id);  
-}
-
-
-/* insert_id_rec inserts a NEW_ID rec into the tree whose ROOT is
-   provided.  insert_id_rec returns TRUE if the tree height from
-   ROOT down is increased otherwise it returns FALSE.  This is a
-   recursive balanced binary tree insertion algorithm. */
-
-int insert_id_rec (root, new_id)
-     id_rec **root;
-     id_rec *new_id;
-{
-  id_rec *A, *B;
-
-  /* If root is NULL, this where it is to be inserted. */
-  if (*root == NULL)
-    {
-      *root = new_id;
-      new_id->left = NULL;
-      new_id->right = NULL;
-      new_id->balance = 0;
-      return (TRUE);
-    }
-
-  /* We need to search for a leaf. */
-  if (strcmp (new_id->id, (*root)->id) < 0)
-    {
-      /* Insert it on the left. */
-      if (insert_id_rec (&((*root)->left), new_id))
-	{
-	  /* The height increased. */
-	  (*root)->balance --;
-	  
-      switch ((*root)->balance)
-	{
-	case  0:  /* no height increase. */
-	  return (FALSE);
-	case -1:  /* height increase. */
-	  return (FALSE);
-	case -2:  /* we need to do a rebalancing act. */
-	  A = *root;
-	  B = (*root)->left;
-	  if (B->balance <= 0)
-	    {
-	      /* Single Rotate. */
-	      A->left = B->right;
-	      B->right = A;
-	      *root = B;
-	      A->balance = 0;
-	      B->balance = 0;
-	    }
-	  else
-	    {
-	      /* Double Rotate. */
-	      *root = B->right;
-	      B->right = (*root)->left;
-	      A->left = (*root)->right;
-	      (*root)->left = B;
-	      (*root)->right = A;
-	      switch ((*root)->balance)
-		{
-		case -1:
-		  A->balance = 1;
-		  B->balance = 0;
-		  break;
-		case  0:
-		  A->balance = 0;
-		  B->balance = 0;
-		  break;
-		case  1:
-		  A->balance = 0;
-		  B->balance = -1;
-		  break;
-		}
-	      (*root)->balance = 0;
-	    }
-	}     
-	} 
-    }
-  else
-    {
-      /* Insert it on the right. */
-      if (insert_id_rec (&((*root)->right), new_id))
-	{
-	  /* The height increased. */
-	  (*root)->balance ++;
-	  switch ((*root)->balance)
-	    {
-	    case 0:  /* no height increase. */
-	      return (FALSE);
-	    case 1:  /* height increase. */
-	      return (FALSE);
-	    case 2:  /* we need to do a rebalancing act. */
-	      A = *root;
-	      B = (*root)->right;
-	      if (B->balance >= 0)
-		{
-		  /* Single Rotate. */
-		  A->right = B->left;
-		  B->left = A;
-		  *root = B;
-		  A->balance = 0;
-		  B->balance = 0;
-		}
-	      else
-		{
-		  /* Double Rotate. */
-		  *root = B->left;
-		  B->left = (*root)->right;
-		  A->right = (*root)->left;
-		  (*root)->left = A;
-		  (*root)->right = B;
-		  switch ((*root)->balance)
-		    {
-		    case -1:
-		      A->balance = 0;
-		      B->balance = 1;
-		      break;
-		    case  0:
-		      A->balance = 0;
-		      B->balance = 0;
-		      break;
-		    case  1:
-		      A->balance = -1;
-		      B->balance = 0;
-		      break;
-		    }
-		  (*root)->balance = 0;
-		}
-	    }     
-	} 
-    }
-  
-  /* If we fall through to here, the tree did not grow in height. */
-  return (FALSE);
-}
-
-
-/* Initialize variables for the symbol table tree. */
-
-void
-init_tree()
-{
-  name_tree  = NULL;
-  next_array = 1;
-  next_func  = 1;
-  /* 0 => ibase, 1 => obase, 2 => scale, 3 => history, 4 => last. */
-  next_var   = 5;
-}
-
-
-/* Lookup routines for symbol table names. */
-
-int
-lookup (name, namekind)
-     char *name;
-     int  namekind;
-{
-  id_rec *id;
-
-  /* Warn about non-standard name. */
-  if (strlen(name) != 1)
-    warn ("multiple letter name - %s", name);
-
-  /* Look for the id. */
-  id = find_id (name_tree, name);
-  if (id == NULL)
-    {
-      /* We need to make a new item. */
-      id = (id_rec *) bc_malloc (sizeof (id_rec));
-      id->id = strcopyof (name);
-      id->a_name = 0;
-      id->f_name = 0;
-      id->v_name = 0;
-      insert_id_rec (&name_tree, id);
-    }
-
-  /* Return the correct value. */
-  switch (namekind)
-    {
-      
-    case ARRAY:
-      /* ARRAY variable numbers are returned as negative numbers. */
-      if (id->a_name != 0)
-	{
-	  free (name);
-	  return (-id->a_name);
-	}
-      id->a_name = next_array++;
-      a_names[id->a_name] = name;
-      if (id->a_name < MAX_STORE)
-	{
-	  if (id->a_name >= a_count)
-	    more_arrays ();
-	  return (-id->a_name);
-	}
-      yyerror ("Too many array variables");
-      exit (1);
-
-    case FUNCT:
-    case FUNCTDEF:
-      if (id->f_name != 0)
-	{
-	  free(name);
-	  /* Check to see if we are redefining a math lib function. */ 
-	  if (use_math && namekind == FUNCTDEF && id->f_name <= 6)
-	    id->f_name = next_func++;
-	  return (id->f_name);
-	}
-      id->f_name = next_func++;
-      f_names[id->f_name] = name;
-      if (id->f_name < MAX_STORE)
-	{
-	  if (id->f_name >= f_count)
-	    more_functions ();
-	  return (id->f_name);
-	}
-      yyerror ("Too many functions");
-      exit (1);
-
-    case SIMPLE:
-      if (id->v_name != 0)
-	{
-	  free(name);
-	  return (id->v_name);
-	}
-      id->v_name = next_var++;
-      v_names[id->v_name - 1] = name;
-      if (id->v_name <= MAX_STORE)
-	{
-	  if (id->v_name >= v_count)
-	    more_variables ();
-	  return (id->v_name);
-	}
-      yyerror ("Too many variables");
-      exit (1);
-    }
-
-  yyerror ("End of util.c/lookup() reached.  Please report this bug.");
-  exit (1);
-  /* not reached */
-}
-
-
-/* Print the welcome banner. */
-
-void 
-welcome()
-{
-  printf ("This is free software with ABSOLUTELY NO WARRANTY.\n");
-  printf ("For details type `warranty'. \n");
-}
-
-/* Print out the version information. */
-void
-show_bc_version()
-{
-  printf("%s %s\n%s\n", PACKAGE, VERSION, BC_COPYRIGHT);
-}
-
-
-/* Print out the warranty information. */
-
-void 
-warranty(prefix)
-     char *prefix;
-{
-  printf ("\n%s", prefix);
-  show_bc_version ();
-  printf ("\n"
-"    This program is free software; you can redistribute it and/or modify\n"
-"    it under the terms of the GNU General Public License as published by\n"
-"    the Free Software Foundation; either version 2 of the License , or\n"
-"    (at your option) any later version.\n\n"
-"    This program is distributed in the hope that it will be useful,\n"
-"    but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
-"    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n"
-"    GNU General Public License for more details.\n\n"
-"    You should have received a copy of the GNU General Public License\n"
-"    along with this program. If not, write to\n\n"
-"       The Free Software Foundation, Inc.\n"
-"       59 Temple Place, Suite 330\n"
-"       Boston, MA 02111, USA.\n\n");
-}
-
-/* Print out the limits of this program. */
-
-void
-limits()
-{
-  printf ("BC_BASE_MAX     = %d\n",  BC_BASE_MAX);
-  printf ("BC_DIM_MAX      = %ld\n", (long) BC_DIM_MAX);
-  printf ("BC_SCALE_MAX    = %d\n",  BC_SCALE_MAX);
-  printf ("BC_STRING_MAX   = %d\n",  BC_STRING_MAX);
-  printf ("MAX Exponent    = %ld\n", (long) LONG_MAX);
-  printf ("Number of vars  = %ld\n", (long) MAX_STORE);
-#ifdef OLD_EQ_OP
-  printf ("Old assignment operatiors are valid. (=-, =+, ...)\n");
-#endif 
-}
-
-/* bc_malloc will check the return value so all other places do not
-   have to do it!  SIZE is the number of bytes to allocate. */
-
-char *
-bc_malloc (size)
-     int size;
-{
-  char *ptr;
-
-  ptr = (char *) malloc (size);
-  if (ptr == NULL)
-    out_of_memory ();
-
-  return ptr;
-}
-
-
-/* The following routines are error routines for various problems. */
-
-/* Malloc could not get enought memory. */
-
-void
-out_of_memory()
-{
-  fprintf (stderr, "Fatal error: Out of memory for malloc.\n");
-  exit (1);
-}
-
-
-
-/* The standard yyerror routine.  Built with variable number of argumnets. */
-
-#ifndef VARARGS
-#ifdef __STDC__
-void
-yyerror (char *str, ...)
-#else
-void
-yyerror (str)
-     char *str;
-#endif
-#else
-void
-yyerror (str, va_alist)
-     char *str;
-#endif
-{
-  char *name;
-  va_list args;
-
-#ifndef VARARGS   
-   va_start (args, str);
-#else
-   va_start (args);
-#endif
-  if (is_std_in)
-    name = "(standard_in)";
-  else
-    name = file_name;
-  fprintf (stderr,"%s %d: ",name,line_no);
-  vfprintf (stderr, str, args);
-  fprintf (stderr, "\n");
-  had_error = TRUE;
-  va_end (args);
-}
-
-
-/* The routine to produce warnings about non-standard features
-   found during parsing. */
-
-#ifndef VARARGS
-#ifdef __STDC__
-void 
-warn (char *mesg, ...)
-#else
-void
-warn (mesg)
-     char *mesg;
-#endif
-#else
-void
-warn (mesg, va_alist)
-     char *mesg;
-#endif
-{
-  char *name;
-  va_list args;
-
-#ifndef VARARGS   
-  va_start (args, mesg);
-#else
-  va_start (args);
-#endif
-  if (std_only)
-    {
-      if (is_std_in)
-	name = "(standard_in)";
-      else
-	name = file_name;
-      fprintf (stderr,"%s %d: ",name,line_no);
-      vfprintf (stderr, mesg, args);
-      fprintf (stderr, "\n");
-      had_error = TRUE;
-    }
-  else
-    if (warn_not_std)
-      {
-	if (is_std_in)
-	  name = "(standard_in)";
-	else
-	  name = file_name;
-	fprintf (stderr,"%s %d: (Warning) ",name,line_no);
-	vfprintf (stderr, mesg, args);
-	fprintf (stderr, "\n");
-      }
-  va_end (args);
-}
-
-/* Runtime error will  print a message and stop the machine. */
-
-#ifndef VARARGS
-#ifdef __STDC__
-void
-rt_error (char *mesg, ...)
-#else
-void
-rt_error (mesg)
-     char *mesg;
-#endif
-#else
-void
-rt_error (mesg, va_alist)
-     char *mesg;
-#endif
-{
-  va_list args;
-
-  fprintf (stderr, "Runtime error (func=%s, adr=%d): ",
-	   f_names[pc.pc_func], pc.pc_addr);
-#ifndef VARARGS   
-  va_start (args, mesg);
-#else
-  va_start (args);
-#endif
-  vfprintf (stderr, mesg, args);
-  va_end (args);
-  
-  fprintf (stderr, "\n");
-  runtime_error = TRUE;
-}
-
-
-/* A runtime warning tells of some action taken by the processor that
-   may change the program execution but was not enough of a problem
-   to stop the execution. */
-
-#ifndef VARARGS
-#ifdef __STDC__
-void
-rt_warn (char *mesg, ...)
-#else
-void
-rt_warn (mesg)
-     char *mesg;
-#endif
-#else
-void
-rt_warn (mesg, va_alist)
-     char *mesg;
-#endif
-{
-  va_list args;
-
-  fprintf (stderr, "Runtime warning (func=%s, adr=%d): ",
-	   f_names[pc.pc_func], pc.pc_addr);
-#ifndef VARARGS   
-  va_start (args, mesg);
-#else
-  va_start (args);
-#endif
-  vfprintf (stderr, mesg, args);
-  va_end (args);
-
-  fprintf (stderr, "\n");
-}
--- contrib/bc/bc/Makefile.in
+++ /dev/null
@@ -1,345 +0,0 @@
-# Makefile.in generated automatically by automake 1.4 from Makefile.am
-
-# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
-# This Makefile.in is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
-# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
-# PARTICULAR PURPOSE.
-
-
-SHELL = @SHELL@
-
-srcdir = @srcdir@
-top_srcdir = @top_srcdir@
-VPATH = @srcdir@
-prefix = @prefix@
-exec_prefix = @exec_prefix@
-
-bindir = @bindir@
-sbindir = @sbindir@
-libexecdir = @libexecdir@
-datadir = @datadir@
-sysconfdir = @sysconfdir@
-sharedstatedir = @sharedstatedir@
-localstatedir = @localstatedir@
-libdir = @libdir@
-infodir = @infodir@
-mandir = @mandir@
-includedir = @includedir@
-oldincludedir = /usr/include
-
-DESTDIR =
-
-pkgdatadir = $(datadir)/@PACKAGE@
-pkglibdir = $(libdir)/@PACKAGE@
-pkgincludedir = $(includedir)/@PACKAGE@
-
-top_builddir = ..
-
-ACLOCAL = @ACLOCAL@
-AUTOCONF = @AUTOCONF@
-AUTOMAKE = @AUTOMAKE@
-AUTOHEADER = @AUTOHEADER@
-
-INSTALL = @INSTALL@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS)
-INSTALL_DATA = @INSTALL_DATA@
-INSTALL_SCRIPT = @INSTALL_SCRIPT@
-transform = @program_transform_name@
-
-NORMAL_INSTALL = :
-PRE_INSTALL = :
-POST_INSTALL = :
-NORMAL_UNINSTALL = :
-PRE_UNINSTALL = :
-POST_UNINSTALL = :
-CC = @CC@
-LEX = @LEX@
-MAKEINFO = @MAKEINFO@
-PACKAGE = @PACKAGE@
-RANLIB = @RANLIB@
-READLINELIB = @READLINELIB@
-VERSION = @VERSION@
-YACC = @YACC@
-
-bin_PROGRAMS = bc
-
-bc_SOURCES = main.c bc.y scan.l execute.c load.c storage.c util.c global.c
-
-EXTRA_DIST = bc.h bcdefs.h const.h fix-libmath_h global.h libmath.b proto.h              sbc.y
-
-noinst_HEADERS = libmath.h
-
-DISTCLEANFILES = sbc sbc.c sbc.h
-
-MAINTAINERCLEANFILES = Makefile.in libmath.h bc.c bc.h scan.c
-
-INCLUDES = -I$(srcdir) -I$(srcdir)/../h
-LIBBC = ../lib/libbc.a
-LIBL = @LEXLIB@
-LDADD = $(LIBBC) $(LIBL) @READLINELIB@
-
-YFLAGS = -d
-
-CFLAGS = @CFLAGS@ -Wall -funsigned-char
-
-fbcOBJ = main.o bc.o scan.o execute.o global.o load.o storage.o util.o
-
-sbcOBJ = main.o sbc.o scan.o execute.o global.o load.o storage.o util.o
-mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
-CONFIG_HEADER = ../config.h
-CONFIG_CLEAN_FILES = 
-PROGRAMS =  $(bin_PROGRAMS)
-
-
-DEFS = @DEFS@ -I. -I$(srcdir) -I..
-CPPFLAGS = @CPPFLAGS@
-LDFLAGS = @LDFLAGS@
-LIBS = @LIBS@
-bc_OBJECTS =  main.o bc.o scan.o execute.o load.o storage.o util.o \
-global.o
-bc_LDADD = $(LDADD)
-bc_DEPENDENCIES =  ../lib/libbc.a
-bc_LDFLAGS = 
-LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
-LEXLIB = @LEXLIB@
-COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
-CCLD = $(CC)
-LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@
-HEADERS =  $(noinst_HEADERS)
-
-DIST_COMMON =  Makefile.am Makefile.in bc.c scan.c
-
-
-DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
-
-TAR = tar
-GZIP_ENV = --best
-SOURCES = $(bc_SOURCES)
-OBJECTS = $(bc_OBJECTS)
-
-all: all-redirect
-.SUFFIXES:
-.SUFFIXES: .S .c .l .o .s .y
-$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) 
-	cd $(top_srcdir) && $(AUTOMAKE) --gnu --include-deps bc/Makefile
-
-Makefile: $(srcdir)/Makefile.in  $(top_builddir)/config.status
-	cd $(top_builddir) \
-	  && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
-
-
-mostlyclean-binPROGRAMS:
-
-clean-binPROGRAMS:
-	-test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
-
-distclean-binPROGRAMS:
-
-maintainer-clean-binPROGRAMS:
-
-install-binPROGRAMS: $(bin_PROGRAMS)
-	@$(NORMAL_INSTALL)
-	$(mkinstalldirs) $(DESTDIR)$(bindir)
-	@list='$(bin_PROGRAMS)'; for p in $$list; do \
-	  if test -f $$p; then \
-	    echo "  $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`"; \
-	     $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \
-	  else :; fi; \
-	done
-
-uninstall-binPROGRAMS:
-	@$(NORMAL_UNINSTALL)
-	list='$(bin_PROGRAMS)'; for p in $$list; do \
-	  rm -f $(DESTDIR)$(bindir)/`echo $$p|sed 's/$(EXEEXT)$$//'|sed '$(transform)'|sed 's/$$/$(EXEEXT)/'`; \
-	done
-
-.c.o:
-	$(COMPILE) -c $<
-
-.s.o:
-	$(COMPILE) -c $<
-
-.S.o:
-	$(COMPILE) -c $<
-
-mostlyclean-compile:
-	-rm -f *.o core *.core
-
-clean-compile:
-
-distclean-compile:
-	-rm -f *.tab.c
-
-maintainer-clean-compile:
-
-bc: $(bc_OBJECTS) $(bc_DEPENDENCIES)
-	@rm -f bc
-	$(LINK) $(bc_LDFLAGS) $(bc_OBJECTS) $(bc_LDADD) $(LIBS)
-.l.c:
-	$(LEX) $(AM_LFLAGS) $(LFLAGS) $< && mv $(LEX_OUTPUT_ROOT).c $@
-.y.c:
-	$(YACC) $(AM_YFLAGS) $(YFLAGS) $< && mv y.tab.c $*.c
-	if test -f y.tab.h; then \
-	if cmp -s y.tab.h $*.h; then rm -f y.tab.h; else mv y.tab.h $*.h; fi; \
-	else :; fi
-bc.h: bc.c
-
-
-tags: TAGS
-
-ID: $(HEADERS) $(SOURCES) $(LISP)
-	list='$(SOURCES) $(HEADERS)'; \
-	unique=`for i in $$list; do echo $$i; done | \
-	  awk '    { files[$$0] = 1; } \
-	       END { for (i in files) print i; }'`; \
-	here=`pwd` && cd $(srcdir) \
-	  && mkid -f$$here/ID $$unique $(LISP)
-
-TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) $(LISP)
-	tags=; \
-	here=`pwd`; \
-	list='$(SOURCES) $(HEADERS)'; \
-	unique=`for i in $$list; do echo $$i; done | \
-	  awk '    { files[$$0] = 1; } \
-	       END { for (i in files) print i; }'`; \
-	test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
-	  || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags  $$unique $(LISP) -o $$here/TAGS)
-
-mostlyclean-tags:
-
-clean-tags:
-
-distclean-tags:
-	-rm -f TAGS ID
-
-maintainer-clean-tags:
-
-distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
-
-subdir = bc
-
-distdir: $(DISTFILES)
-	@for file in $(DISTFILES); do \
-	  d=$(srcdir); \
-	  if test -d $$d/$$file; then \
-	    cp -pr $$/$$file $(distdir)/$$file; \
-	  else \
-	    test -f $(distdir)/$$file \
-	    || ln $$d/$$file $(distdir)/$$file 2> /dev/null \
-	    || cp -p $$d/$$file $(distdir)/$$file || :; \
-	  fi; \
-	done
-bc.o: bc.c bcdefs.h ../config.h const.h ../h/number.h global.h proto.h
-execute.o: execute.c bcdefs.h ../config.h const.h ../h/number.h global.h \
-	proto.h
-global.o: global.c bcdefs.h ../config.h const.h ../h/number.h global.h \
-	libmath.h
-load.o: load.c bcdefs.h ../config.h const.h ../h/number.h global.h \
-	proto.h
-main.o: main.c bcdefs.h ../config.h const.h ../h/number.h global.h \
-	proto.h ../h/getopt.h
-scan.o: scan.c bcdefs.h ../config.h const.h ../h/number.h bc.h global.h \
-	proto.h
-storage.o: storage.c bcdefs.h ../config.h const.h ../h/number.h global.h \
-	proto.h
-util.o: util.c bcdefs.h ../config.h const.h ../h/number.h global.h \
-	proto.h
-
-info-am:
-info: info-am
-dvi-am:
-dvi: dvi-am
-check-am: all-am
-check: check-am
-installcheck-am:
-installcheck: installcheck-am
-install-exec-am: install-binPROGRAMS
-install-exec: install-exec-am
-
-install-data-am:
-install-data: install-data-am
-
-install-am: all-am
-	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
-install: install-am
-uninstall-am: uninstall-binPROGRAMS
-uninstall: uninstall-am
-all-am: Makefile $(PROGRAMS) $(HEADERS)
-all-redirect: all-am
-install-strip:
-	$(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
-installdirs:
-	$(mkinstalldirs)  $(DESTDIR)$(bindir)
-
-
-mostlyclean-generic:
-
-clean-generic:
-
-distclean-generic:
-	-rm -f Makefile $(CONFIG_CLEAN_FILES)
-	-rm -f config.cache config.log stamp-h stamp-h[0-9]*
-	-test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES)
-
-maintainer-clean-generic:
-	-test -z "scanlbchbcc$(MAINTAINERCLEANFILES)" || rm -f scanl bch bcc $(MAINTAINERCLEANFILES)
-mostlyclean-am:  mostlyclean-binPROGRAMS mostlyclean-compile \
-		mostlyclean-tags mostlyclean-generic
-
-mostlyclean: mostlyclean-am
-
-clean-am:  clean-binPROGRAMS clean-compile clean-tags clean-generic \
-		mostlyclean-am
-
-clean: clean-am
-
-distclean-am:  distclean-binPROGRAMS distclean-compile distclean-tags \
-		distclean-generic clean-am
-
-distclean: distclean-am
-
-maintainer-clean-am:  maintainer-clean-binPROGRAMS \
-		maintainer-clean-compile maintainer-clean-tags \
-		maintainer-clean-generic distclean-am
-	@echo "This command is intended for maintainers to use;"
-	@echo "it deletes files that may require special tools to rebuild."
-
-maintainer-clean: maintainer-clean-am
-
-.PHONY: mostlyclean-binPROGRAMS distclean-binPROGRAMS clean-binPROGRAMS \
-maintainer-clean-binPROGRAMS uninstall-binPROGRAMS install-binPROGRAMS \
-mostlyclean-compile distclean-compile clean-compile \
-maintainer-clean-compile tags mostlyclean-tags distclean-tags \
-clean-tags maintainer-clean-tags distdir info-am info dvi-am dvi check \
-check-am installcheck-am installcheck install-exec-am install-exec \
-install-data-am install-data install-am install uninstall-am uninstall \
-all-redirect all-am all installdirs mostlyclean-generic \
-distclean-generic clean-generic maintainer-clean-generic clean \
-mostlyclean distclean maintainer-clean
-
-
-$(PROGRAMS): $(LIBBC)
-
-scan.o: bc.h
-global.o: libmath.h
-
-libmath.h: libmath.b
-	echo '{0}' > libmath.h
-	$(MAKE) fbc
-	./fbc -c $(srcdir)/libmath.b </dev/null >libmath.h
-	$(srcdir)/fix-libmath_h
-	rm -f ./fbc
-fbc: $(fbcOBJ)
-	$(LINK) $(fbcOBJ) $(LIBBC) $(LIBL) $(READLINELIB) $(LIBS)
-sbc.o: sbc.c
-sbc: $(sbcOBJ)
-	$(LINK) $(sbcOBJ) $(LIBBC) $(LIBL) $(READLINELIB) $(LIBS)
-
-# Tell versions [3.59,3.63) of GNU make to not export all variables.
-# Otherwise a system limit (for SysV at least) may be exceeded.
-.NOEXPORT:
--- contrib/bc/bc/main.c
+++ /dev/null
@@ -1,358 +0,0 @@
-/* main.c: The main program for bc.  */
-
-/*  This file is part of GNU bc.
-    Copyright (C) 1991-1994, 1997, 1998, 2000 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, Inc.
-      59 Temple Place, Suite 330
-      Boston, MA 02111 USA
-
-    You may contact the author by:
-       e-mail:  philnelson at acm.org
-      us-mail:  Philip A. Nelson
-                Computer Science Department, 9062
-                Western Washington University
-                Bellingham, WA 98226-9062
-
-$FreeBSD: src/contrib/bc/bc/main.c,v 1.6 2004/02/17 00:53:50 ache Exp $
-       
-*************************************************************************/
-
-#include "bcdefs.h"
-#include <signal.h>
-#include "global.h"
-#include "proto.h"
-#include "getopt.h"
-
-
-/* Variables for processing multiple files. */
-static char first_file;
-
-/* Points to the last node in the file name list for easy adding. */
-static file_node *last = NULL;
-
-/* long option support */
-static struct option long_options[] =
-{
-  {"compile",  0, &compile_only, TRUE},
-  {"help",     0, 0,             'h'},
-  {"interactive", 0, 0,          'i'},
-  {"mathlib",  0, &use_math,     TRUE},
-  {"quiet",    0, &quiet,        TRUE},
-  {"standard", 0, &std_only,     TRUE},
-  {"version",  0, 0,             'v'},
-  {"warn",     0, &warn_not_std, TRUE},
-
-  {0, 0, 0, 0}
-};
-
-
-void
-usage (char *progname)
-{
-  printf ("usage: %s [options] [file ...]\n%s%s%s%s%s%s%s", progname,
-          "  -h  --help         print this usage and exit\n",
-	  "  -i  --interactive  force interactive mode\n",
-	  "  -l  --mathlib      use the predefine math routnes\n",
-	  "  -q  --quiet        don't print initial banner\n",
-	  "  -s  --standard     non-standard bc constructs are errors\n",
-	  "  -w  --warn         warn about non-standard bc constructs\n",
-	  "  -v  --version      print version information and exit\n");
-}
-
-
-void
-parse_args (argc, argv)
-     int argc;
-     char **argv;
-{
-  int optch;
-  int long_index;
-  file_node *temp;
-
-  /* Force getopt to initialize.  Depends on GNU getopt. */
-  optind = 0;
-
-  /* Parse the command line */
-  while (1)
-    {
-      optch = getopt_long (argc, argv, "chilqswv", long_options, &long_index);
-
-      if (optch == EOF)  /* End of arguments. */
-	break;
-
-      switch (optch)
-	{
-	case 'c':  /* compile only */
-	  compile_only = TRUE;
-	  break;
-
-	case 'h':  /* help */
-	  usage(argv[0]);
-	  exit (0);
-	  break;
-
-	case 'i':  /* force interactive */
-	  interactive = TRUE;
-	  break;
-
-	case 'l':  /* math lib */
-	  use_math = TRUE;
-	  break;
-
-	case 'q':  /* quiet mode */
-	  quiet = TRUE;
-	  break;
-
-	case 's':  /* Non standard features give errors. */
-	  std_only = TRUE;
-	  break;
-
-	case 'v':  /* Print the version. */
-	  show_bc_version ();
-	  exit (0);
-	  break;
-
-	case 'w':  /* Non standard features give warnings. */
-	  warn_not_std = TRUE;
-	  break;
-
-	case 0:
-	  /* long options */
-	  break;
-
-	default:
-	  usage(argv[0]);
-	  exit (1);
-	}
-    }
-
-  /* Add file names to a list of files to process. */
-  while (optind < argc)
-    {
-      temp = (file_node *) bc_malloc(sizeof(file_node));
-      temp->name = argv[optind];
-      temp->next = NULL;
-      if (last == NULL)
-	file_names = temp;
-      else
-	last->next = temp;
-      last = temp;
-      optind++;
-    }
-}
-
-/* The main program for bc. */
-int
-main (argc, argv)
-     int argc;
-     char *argv[];
-{
-  char *env_value;
-  char *env_argv[30];
-  int   env_argc;
-  
-  /* Initialize many variables. */
-  compile_only = FALSE;
-  use_math = FALSE;
-  warn_not_std = FALSE;
-  std_only = FALSE;
-  if (isatty(0) && isatty(1)) 
-    interactive = TRUE;
-  else
-    interactive = FALSE;
-  quiet = FALSE;
-  file_names = NULL;
-
-#ifdef HAVE_SETVBUF
-  /* attempt to simplify interaction with applications such as emacs */
-  (void) setvbuf(stdout, NULL, _IOLBF, 0);
-#endif
-
-  /* Environment arguments. */
-  env_value = getenv ("BC_ENV_ARGS");
-  if (env_value != NULL)
-    {
-      env_argc = 1;
-      env_argv[0] = "BC_ENV_ARGS";
-      while (*env_value != 0)
-	{
-	  if (*env_value != ' ')
-	    {
-	      env_argv[env_argc++] = env_value;
-	      while (*env_value != ' ' && *env_value != 0)
-		env_value++;
-	      if (*env_value != 0)
-		{
-		  *env_value = 0;
-		  env_value++;
-		}
-	    }
-	  else
-	    env_value++;
-	}
-      parse_args (env_argc, env_argv);
-    }
-
-  /* Command line arguments. */
-  parse_args (argc, argv);
-
-  /* Other environment processing. */
-  if (getenv ("POSIXLY_CORRECT") != NULL)
-    std_only = TRUE;
-
-  env_value = getenv ("BC_LINE_LENGTH");
-  if (env_value != NULL)
-    {
-      line_size = atoi (env_value);
-      if (line_size < 2)
-	line_size = 70;
-    }
-  else
-    line_size = 70;
-
-  /* Initialize the machine.  */
-  init_storage();
-  init_load();
-
-  /* Set up interrupts to print a message. */
-  if (interactive)
-    signal (SIGINT, use_quit);
-
-  /* Initialize the front end. */
-  init_tree();
-  init_gen ();
-  is_std_in = FALSE;
-  first_file = TRUE;
-  if (!open_new_file ())
-    exit (1);
-
-#if defined(LIBEDIT)
-  if (interactive) {
-    /* Enable libedit support. */
-    edit = el_init ("bc", stdin, stdout, stderr);
-    hist = history_init();
-    el_set (edit, EL_EDITOR, "emacs");
-    el_set (edit, EL_HIST, history, hist);
-    el_set (edit, EL_PROMPT, null_prompt);
-    el_source (edit, NULL);
-    history (hist, &histev, H_SETSIZE, INT_MAX);
-  }
-#endif
-
-#if defined(READLINE)
-  if (interactive) {
-    /* Readline support.  Set both application name and input file. */
-    rl_readline_name = "bc";
-    rl_instream = stdin;
-    using_history ();
-  }
-#endif
-
-  /* Do the parse. */
-  yyparse ();
-
-  /* End the compile only output with a newline. */
-  if (compile_only)
-    printf ("\n");
-
-  exit (0);
-}
-
-
-/* This is the function that opens all the files. 
-   It returns TRUE if the file was opened, otherwise
-   it returns FALSE. */
-
-int
-open_new_file ()
-{
-  FILE *new_file;
-  file_node *temp;
-
-  /* Set the line number. */
-  line_no = 1;
-
-  /* Check to see if we are done. */
-  if (is_std_in) return (FALSE);
-
-  /* Open the other files. */
-  if (use_math && first_file)
-    {
-      /* Load the code from a precompiled version of the math libarary. */
-      extern char *libmath[];
-      char **mstr;
-      char tmp;
-      /* These MUST be in the order of first mention of each function.
-	 That is why "a" comes before "c" even though "a" is defined after
-	 after "c".  "a" is used in "s"! */
-      tmp = lookup ("e", FUNCT);
-      tmp = lookup ("l", FUNCT);
-      tmp = lookup ("s", FUNCT);
-      tmp = lookup ("a", FUNCT);
-      tmp = lookup ("c", FUNCT);
-      tmp = lookup ("j", FUNCT);
-      mstr = libmath;
-      while (*mstr) {
-           load_code (*mstr);
-	   mstr++;
-      }
-    }
-  
-  /* One of the argv values. */
-  if (file_names != NULL)
-    {
-      new_file = fopen (file_names->name, "r");
-      if (new_file != NULL)
-	{
-	  new_yy_file (new_file);
-	  temp = file_names;
-	  file_name  = temp->name;
-	  file_names = temp->next;
-	  free (temp);
-	  return TRUE;
-	}
-      fprintf (stderr, "File %s is unavailable.\n", file_names->name);
-      exit (1);
-    }
-  
-  /* If we fall through to here, we should return stdin. */
-  new_yy_file (stdin);
-  is_std_in = TRUE;
-  return TRUE;
-}
-
-
-/* Set yyin to the new file. */
-
-void
-new_yy_file (file)
-     FILE *file;
-{
-  if (!first_file) fclose (yyin);
-  yyin = file;
-  first_file = FALSE;
-}
-
-
-/* Message to use quit.  */
-
-void
-use_quit (sig)
-     int sig;
-{
-  printf ("\n(interrupt) use quit to exit.\n");
-  signal (SIGINT, use_quit);
-}
--- contrib/bc/bc/proto.h
+++ /dev/null
@@ -1,148 +0,0 @@
-/* proto.h: Prototype function definitions for "external" functions. */
-
-/*  This file is part of GNU bc.
-    Copyright (C) 1991-1994, 1997, 2000 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, Inc.
-      59 Temple Place, Suite 330
-      Boston, MA 02111 USA
-
-    You may contact the author by:
-       e-mail:  philnelson at acm.org
-      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(void out_schar, (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 show_bc_version, (void));
-_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 open_new_file, (void));
-_PROTOTYPE(void new_yy_file, (FILE *file));
-_PROTOTYPE(void use_quit, (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)); 
-
-#if defined(LIBEDIT)
-/* The *?*&^ prompt function */
-_PROTOTYPE(char *null_prompt, (EditLine *));
-#endif
-
-/* Other things... */
-#ifndef HAVE_UNISTD_H
-_PROTOTYPE (int getopt, (int, char *[], CONST char *));
-#endif
--- contrib/bc/bc/execute.c
+++ /dev/null
@@ -1,788 +0,0 @@
-/* execute.c - run a bc program. */
-
-/*  This file is part of GNU bc.
-    Copyright (C) 1991-1994, 1997, 2000 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, Inc.
-      59 Temple Place, Suite 330
-      Boston, MA 02111 USA
-
-    You may contact the author by:
-       e-mail:  philnelson at acm.org
-      us-mail:  Philip A. Nelson
-                Computer Science Department, 9062
-                Western Washington University
-                Bellingham, WA 98226-9062
-       
-*************************************************************************/
-
-#include "bcdefs.h"
-#include <signal.h>
-#include "global.h"
-#include "proto.h"
-
-
-/* The SIGINT interrupt handling routine. */
-
-int had_sigint;
-
-void
-stop_execution (sig)
-     int sig;
-{
-  had_sigint = TRUE;
-  printf ("\n");
-  rt_error ("interrupted execution");
-}
-
-
-/* Get the current byte and advance the PC counter. */
-
-unsigned char
-byte (pc)
-     program_counter *pc;
-{
-  return (functions[pc->pc_func].f_body[pc->pc_addr++]);
-}
-
-
-/* The routine that actually runs the machine. */
-
-void
-execute ()
-{
-  int label_num, l_gp, l_off;
-  bc_label_group *gp;
-  
-  char inst, ch;
-  int  new_func;
-  int  var_name;
-
-  int const_base;
-
-  bc_num temp_num;
-  arg_list *auto_list;
-
-  /* Initialize this run... */
-  pc.pc_func = 0;
-  pc.pc_addr = 0;
-  runtime_error = FALSE;
-  bc_init_num (&temp_num);
-
-  /* Set up the interrupt mechanism for an interactive session. */
-  if (interactive)
-    {
-      signal (SIGINT, stop_execution);
-      had_sigint = FALSE;
-    }
-   
-  while (pc.pc_addr < functions[pc.pc_func].f_code_size && !runtime_error)
-    {
-      inst = byte(&pc);
-
-#if DEBUG > 3
-      { /* Print out address and the stack before each instruction.*/
-	int depth; estack_rec *temp = ex_stack;
-	
-	printf ("func=%d addr=%d inst=%c\n",pc.pc_func, pc.pc_addr, inst);
-	if (temp == NULL) printf ("empty stack.\n", inst);
-	else
-	  {
-	    depth = 1;
-	    while (temp != NULL)
-	      {
-		printf ("  %d = ", depth);
-		bc_out_num (temp->s_num, 10, out_char, std_only);
-		depth++;
-		temp = temp->s_next;
-	      }
-	    out_char ('\n');
-	  }
-      }
-#endif
-
-    switch ( inst )
-      {
-
-      case 'A' : /* increment array variable (Add one). */
-	var_name = byte(&pc);
-	if ((var_name & 0x80) != 0)
-	  var_name = ((var_name & 0x7f) << 8) + byte(&pc);
-	incr_array (var_name);
-	break;
-
-      case 'B' : /* Branch to a label if TOS != 0. Remove value on TOS. */
-      case 'Z' : /* Branch to a label if TOS == 0. Remove value on TOS. */
-	c_code = !bc_is_zero (ex_stack->s_num);
-	pop ();
-      case 'J' : /* Jump to a label. */
-	label_num = byte(&pc);  /* Low order bits first. */
-	label_num += byte(&pc) << 8;
-	if (inst == 'J' || (inst == 'B' && c_code)
-	    || (inst == 'Z' && !c_code)) {
-	  gp = functions[pc.pc_func].f_label;
-	  l_gp  = label_num >> BC_LABEL_LOG;
-	  l_off = label_num % BC_LABEL_GROUP;
-	  while (l_gp-- > 0) gp = gp->l_next;
-	  pc.pc_addr = gp->l_adrs[l_off];
-	}
-	break;
-
-      case 'C' : /* Call a function. */
-	/* Get the function number. */
-	new_func = byte(&pc);
-	if ((new_func & 0x80) != 0) 
-	  new_func = ((new_func & 0x7f) << 8) + byte(&pc);
-
-	/* Check to make sure it is defined. */
-	if (!functions[new_func].f_defined)
-	  {
-	    rt_error ("Function %s not defined.", f_names[new_func]);
-	    break;
-	  }
-
-	/* Check and push parameters. */
-	process_params (&pc, new_func);
-
-	/* Push auto variables. */
-	for (auto_list = functions[new_func].f_autos;
-	     auto_list != NULL;
-	     auto_list = auto_list->next)
-	  auto_var (auto_list->av_name);
-
-	/* Push pc and ibase. */
-	fpush (pc.pc_func);
-	fpush (pc.pc_addr);
-	fpush (i_base);
-
-	/* Reset pc to start of function. */
-	pc.pc_func = new_func;
-	pc.pc_addr = 0;
-	break;
-
-      case 'D' : /* Duplicate top of stack */
-	push_copy (ex_stack->s_num);
-	break;
-
-      case 'K' : /* Push a constant */
-	/* Get the input base and convert it to a bc number. */
-	if (pc.pc_func == 0) 
-	  const_base = i_base;
-	else
-	  const_base = fn_stack->s_val;
-	if (const_base == 10)
-	  push_b10_const (&pc);
-	else
-	  push_constant (prog_char, const_base);
-	break;
-
-      case 'L' : /* load array variable */
-	var_name = byte(&pc);
-	if ((var_name & 0x80) != 0)
-	  var_name = ((var_name & 0x7f) << 8) + byte(&pc);
-	load_array (var_name);
-	break;
-
-      case 'M' : /* decrement array variable (Minus!) */
-	var_name = byte(&pc);
-	if ((var_name & 0x80) != 0)
-	  var_name = ((var_name & 0x7f) << 8) + byte(&pc);
-	decr_array (var_name);
-	break;
-
-      case 'O' : /* Write a string to the output with processing. */
-	while ((ch = byte(&pc)) != '"')
-	  if (ch != '\\')
-	    out_schar (ch);
-	  else
-	    {
-	      ch = byte(&pc);
-	      if (ch == '"') break;
-	      switch (ch)
-		{
-		case 'a':  out_schar (007); break;
-		case 'b':  out_schar ('\b'); break;
-		case 'f':  out_schar ('\f'); break;
-		case 'n':  out_schar ('\n'); break;
-		case 'q':  out_schar ('"'); break;
-		case 'r':  out_schar ('\r'); break;
-		case 't':  out_schar ('\t'); break;
-		case '\\': out_schar ('\\'); break;
-		default:  break;
-		}
-	    }
-	fflush (stdout);
-	break;
-
-      case 'R' : /* Return from function */
-	if (pc.pc_func != 0)
-	  {
-	    /* "Pop" autos and parameters. */
-	    pop_vars(functions[pc.pc_func].f_autos);
-	    pop_vars(functions[pc.pc_func].f_params);
-	    /* reset the pc. */
-	    fpop ();
-	    pc.pc_addr = fpop ();
-	    pc.pc_func = fpop ();
-	  }
-	else
-	  rt_error ("Return from main program.");
-	break;
-
-      case 'S' : /* store array variable */
-	var_name = byte(&pc);
-	if ((var_name & 0x80) != 0)
-	  var_name = ((var_name & 0x7f ) << 8) + byte(&pc);
-	store_array (var_name);
-	break;
-
-      case 'T' : /* Test tos for zero */
-	c_code = bc_is_zero (ex_stack->s_num);
-	assign (c_code);
-	break;
-
-      case 'W' : /* Write the value on the top of the stack. */
-      case 'P' : /* Write the value on the top of the stack.  No newline. */
-	bc_out_num (ex_stack->s_num, o_base, out_char, std_only);
-	if (inst == 'W') out_char ('\n');
-	store_var (4);  /* Special variable "last". */
-	fflush (stdout);
-	pop ();
-	break;
-
-      case 'c' : /* Call special function. */
-	new_func = byte(&pc);
-
-      switch (new_func)
-	{
-	case 'L':  /* Length function. */
-	  /* For the number 0.xxxx,  0 is not significant. */
-	  if (ex_stack->s_num->n_len == 1 &&
-	      ex_stack->s_num->n_scale != 0 &&
-	      ex_stack->s_num->n_value[0] == 0 )
-	    bc_int2num (&ex_stack->s_num, ex_stack->s_num->n_scale);
-	  else
-	    bc_int2num (&ex_stack->s_num, ex_stack->s_num->n_len
-		     + ex_stack->s_num->n_scale);
-	  break;
-		
-	case 'S':  /* Scale function. */ 
-	  bc_int2num (&ex_stack->s_num, ex_stack->s_num->n_scale);
-	  break;
-
-	case 'R':  /* Square Root function. */
-	  if (!bc_sqrt (&ex_stack->s_num, scale))
-	    rt_error ("Square root of a negative number");
-	  break;
-
-	case 'I': /* Read function. */
-	  push_constant (input_char, i_base);
-	  break;
-	}
-	break;
-
-      case 'd' : /* Decrement number */
-	var_name = byte(&pc);
-	if ((var_name & 0x80) != 0)
-	  var_name = ((var_name & 0x7f) << 8) + byte(&pc);
-	decr_var (var_name);
-	break;
-      
-      case 'h' : /* Halt the machine. */
-	exit (0);
-
-      case 'i' : /* increment number */
-	var_name = byte(&pc);
-	if ((var_name & 0x80) != 0)
-	  var_name = ((var_name & 0x7f) << 8) + byte(&pc);
-	incr_var (var_name);
-	break;
-
-      case 'l' : /* load variable */
-	var_name = byte(&pc);
-	if ((var_name & 0x80) != 0)
-	  var_name = ((var_name & 0x7f) << 8) + byte(&pc);
-	load_var (var_name);
-	break;
-
-      case 'n' : /* Negate top of stack. */
-	bc_sub (_zero_, ex_stack->s_num, &ex_stack->s_num, 0);
-	break;
-
-      case 'p' : /* Pop the execution stack. */
-	pop ();
-	break;
-
-      case 's' : /* store variable */
-	var_name = byte(&pc);
-	if ((var_name & 0x80) != 0)
-	  var_name = ((var_name & 0x7f) << 8) + byte(&pc);
-	store_var (var_name);
-	break;
-
-      case 'w' : /* Write a string to the output. */
-	while ((ch = byte(&pc)) != '"') out_schar (ch);
-	fflush (stdout);
-	break;
-		   
-      case 'x' : /* Exchange Top of Stack with the one under the tos. */
-	if (check_stack(2)) {
-	  bc_num temp = ex_stack->s_num;
-	  ex_stack->s_num = ex_stack->s_next->s_num;
-	  ex_stack->s_next->s_num = temp;
-	}
-	break;
-
-      case '0' : /* Load Constant 0. */
-	push_copy (_zero_);
-	break;
-
-      case '1' : /* Load Constant 0. */
-	push_copy (_one_);
-	break;
-
-      case '!' : /* Negate the boolean value on top of the stack. */
-	c_code = bc_is_zero (ex_stack->s_num);
-	assign (c_code);
-	break;
-
-      case '&' : /* compare greater than */
-	if (check_stack(2))
-	  {
-	    c_code = !bc_is_zero (ex_stack->s_next->s_num)
-	      && !bc_is_zero (ex_stack->s_num);
-	    pop ();
-	    assign (c_code);
-	  }
-	break;
-
-      case '|' : /* compare greater than */
-	if (check_stack(2))
-	  {
-	    c_code = !bc_is_zero (ex_stack->s_next->s_num)
-	      || !bc_is_zero (ex_stack->s_num);
-	    pop ();
-	    assign (c_code);
-	  }
-	break;
-
-      case '+' : /* add */
-	if (check_stack(2))
-	  {
-	    bc_add (ex_stack->s_next->s_num, ex_stack->s_num, &temp_num, 0);
-	    pop();
-	    pop();
-	    push_num (temp_num);
-	    bc_init_num (&temp_num);
-	  }
-	break;
-
-      case '-' : /* subtract */
-	if (check_stack(2))
-	  {
-	    bc_sub (ex_stack->s_next->s_num, ex_stack->s_num, &temp_num, 0);
-	    pop();
-	    pop();
-	    push_num (temp_num);
-	    bc_init_num (&temp_num);
-	  }
-	break;
-
-      case '*' : /* multiply */
-	if (check_stack(2))
-	  {
-	    bc_multiply (ex_stack->s_next->s_num, ex_stack->s_num,
-			 &temp_num, scale);
-	    pop();
-	    pop();
-	    push_num (temp_num);
-	    bc_init_num (&temp_num);
-	  }
-	break;
-
-      case '/' : /* divide */
-	if (check_stack(2))
-	  {
-	    if (bc_divide (ex_stack->s_next->s_num,
-			   ex_stack->s_num, &temp_num, scale) == 0)
-	      {
-		pop();
-		pop();
-		push_num (temp_num);
-		bc_init_num (&temp_num);
-	      }
-	    else
-	      rt_error ("Divide by zero");
-	  }
-	break;
-
-      case '%' : /* remainder */
-	if (check_stack(2))
-	  {
-	    if (bc_is_zero (ex_stack->s_num))
-	      rt_error ("Modulo by zero");
-	    else
-	      {
-		bc_modulo (ex_stack->s_next->s_num,
-			   ex_stack->s_num, &temp_num, scale);
-		pop();
-		pop();
-		push_num (temp_num);
-		bc_init_num (&temp_num);
-	      }
-	  }
-	break;
-
-      case '^' : /* raise */
-	if (check_stack(2))
-	  {
-	    bc_raise (ex_stack->s_next->s_num,
-		      ex_stack->s_num, &temp_num, scale);
-	    if (bc_is_zero (ex_stack->s_next->s_num) && bc_is_neg (ex_stack->s_num))
-	      rt_error ("divide by zero");
-	    pop();
-	    pop();
-	    push_num (temp_num);
-	    bc_init_num (&temp_num);
-	  }
-	break;
-
-      case '=' : /* compare equal */
-	if (check_stack(2))
-	  {
-	    c_code = bc_compare (ex_stack->s_next->s_num,
-				 ex_stack->s_num) == 0;
-	    pop ();
-	    assign (c_code);
-	  }
-	break;
-
-      case '#' : /* compare not equal */
-	if (check_stack(2))
-	  {
-	    c_code = bc_compare (ex_stack->s_next->s_num,
-				 ex_stack->s_num) != 0;
-	    pop ();
-	    assign (c_code);
-	  }
-	break;
-
-      case '<' : /* compare less than */
-	if (check_stack(2))
-	  {
-	    c_code = bc_compare (ex_stack->s_next->s_num,
-				 ex_stack->s_num) == -1;
-	    pop ();
-	    assign (c_code);
-	  }
-	break;
-
-      case '{' : /* compare less than or equal */
-	if (check_stack(2))
-	  {
-	    c_code = bc_compare (ex_stack->s_next->s_num,
-				 ex_stack->s_num) <= 0;
-	    pop ();
-	    assign (c_code);
-	  }
-	break;
-
-      case '>' : /* compare greater than */
-	if (check_stack(2))
-	  {
-	    c_code = bc_compare (ex_stack->s_next->s_num,
-				 ex_stack->s_num) == 1;
-	    pop ();
-	    assign (c_code);
-	  }
-	break;
-
-      case '}' : /* compare greater than or equal */
-	if (check_stack(2))
-	  {
-	    c_code = bc_compare (ex_stack->s_next->s_num,
-				 ex_stack->s_num) >= 0;
-	    pop ();
-	    assign (c_code);
-	  }
-	break;
-
-	default  : /* error! */
-	  rt_error ("bad instruction: inst=%c", inst);
-      }
-    }
-
-  /* Clean up the function stack and pop all autos/parameters. */
-  while (pc.pc_func != 0)
-    {
-      pop_vars(functions[pc.pc_func].f_autos);
-      pop_vars(functions[pc.pc_func].f_params);
-      fpop ();
-      pc.pc_addr = fpop ();
-      pc.pc_func = fpop ();
-    }
-
-  /* Clean up the execution stack. */ 
-  while (ex_stack != NULL) pop();
-
-  /* Clean up the interrupt stuff. */
-  if (interactive)
-    {
-      signal (SIGINT, use_quit);
-      if (had_sigint)
-	printf ("Interruption completed.\n");
-    }
-}
-
-
-/* Prog_char gets another byte from the program.  It is used for
-   conversion of text constants in the code to numbers. */
-
-char
-prog_char ()
-{
-  return byte(&pc);
-}
-
-
-/* Read a character from the standard input.  This function is used
-   by the "read" function. */
-
-char
-input_char ()
-{
-  char in_ch;
-  
-  /* Get a character from the standard input for the read function. */
-  in_ch = getchar();
-
-  /* Check for a \ quoted newline. */
-  if (in_ch == '\\')
-    {
-      in_ch = getchar();
-      if (in_ch == '\n')
-	in_ch = getchar();
-    }
-
-  /* Classify and preprocess the input character. */
-  if (isdigit((int)in_ch))
-    return (in_ch - '0');
-  if (in_ch >= 'A' && in_ch <= 'F')
-    return (in_ch + 10 - 'A');
-  if (in_ch >= 'a' && in_ch <= 'f')
-    return (in_ch + 10 - 'a');
-  if (in_ch == '.' || in_ch == '+' || in_ch == '-')
-    return (in_ch);
-  if (in_ch <= ' ')
-    return (' ');
-  
-  return (':');
-}
-
-
-/* Push_constant converts a sequence of input characters as returned
-   by IN_CHAR into a number.  The number is pushed onto the execution
-   stack.  The number is converted as a number in base CONV_BASE. */
-
-void
-push_constant (in_char, conv_base)
-   char (*in_char)(VOID);
-   int conv_base;
-{
-  int digits;
-  bc_num build, temp, result, mult, divisor;
-  char  in_ch, first_ch;
-  char  negative;
-
-  /* Initialize all bc numbers */
-  bc_init_num (&temp);
-  bc_init_num (&result);
-  bc_init_num (&mult);
-  build = bc_copy_num (_zero_);
-  negative = FALSE;
-
-  /* The conversion base. */
-  bc_int2num (&mult, conv_base);
-  
-  /* Get things ready. */
-  in_ch = in_char();
-  while (in_ch == ' ')
-    in_ch = in_char();
-
-  if (in_ch == '+')
-    in_ch = in_char();
-  else
-    if (in_ch == '-')
-      {
-	negative = TRUE;
-	in_ch = in_char();
-      }
-
-  /* Check for the special case of a single digit. */
-  if (in_ch < 16)
-    {
-      first_ch = in_ch;
-      in_ch = in_char();
-      if (in_ch < 16 && first_ch >= conv_base)
-	first_ch = conv_base - 1;
-      bc_int2num (&build, (int) first_ch);
-    }
-
-  /* Convert the integer part. */
-  while (in_ch < 16)
-    {
-      if (in_ch < 16 && in_ch >= conv_base) in_ch = conv_base-1;
-      bc_multiply (build, mult, &result, 0);
-      bc_int2num (&temp, (int) in_ch);
-      bc_add (result, temp, &build, 0);
-      in_ch = in_char();
-    }
-  if (in_ch == '.')
-    {
-      in_ch = in_char();
-      if (in_ch >= conv_base) in_ch = conv_base-1;
-      bc_free_num (&result);
-      bc_free_num (&temp);
-      divisor = bc_copy_num (_one_);
-      result = bc_copy_num (_zero_);
-      digits = 0;
-      while (in_ch < 16)
-	{
-	  bc_multiply (result, mult, &result, 0);
-	  bc_int2num (&temp, (int) in_ch);
-	  bc_add (result, temp, &result, 0);
-	  bc_multiply (divisor, mult, &divisor, 0);
-	  digits++;
-	  in_ch = in_char();
-	  if (in_ch < 16 && in_ch >= conv_base) in_ch = conv_base-1;
-	}
-      bc_divide (result, divisor, &result, digits);
-      bc_add (build, result, &build, 0);
-    }
-  
-  /* Final work.  */
-  if (negative)
-    bc_sub (_zero_, build, &build, 0);
-
-  push_num (build);
-  bc_free_num (&temp);
-  bc_free_num (&result);
-  bc_free_num (&mult);
-}
-
-
-/* When converting base 10 constants from the program, we use this
-   more efficient way to convert them to numbers.  PC tells where
-   the constant starts and is expected to be advanced to after
-   the constant. */
-
-void
-push_b10_const (pc)
-     program_counter *pc;
-{
-  bc_num build;
-  program_counter look_pc;
-  int kdigits, kscale;
-  char inchar;
-  char *ptr;
-  
-  /* Count the digits and get things ready. */
-  look_pc = *pc;
-  kdigits = 0;
-  kscale  = 0;
-  inchar = byte (&look_pc);
-  while (inchar != '.' && inchar != ':')
-    {
-      kdigits++;
-      inchar = byte(&look_pc);
-    }
-  if (inchar == '.' )
-    {
-      inchar = byte(&look_pc);
-      while (inchar != ':')
-	{
-	  kscale++;
-	  inchar = byte(&look_pc);
-	}
-    }
-
-  /* Get the first character again and move the pc. */
-  inchar = byte(pc);
-  
-  /* Secial cases of 0, 1, and A-F single inputs. */
-  if (kdigits == 1 && kscale == 0)
-    {
-      if (inchar == 0)
-	{
-	  push_copy (_zero_);
-	  inchar = byte(pc);
-	  return;
-	}
-      if (inchar == 1) {
-      push_copy (_one_);
-      inchar = byte(pc);
-      return;
-    }
-    if (inchar > 9)
-      {
-	bc_init_num (&build);
-	bc_int2num (&build, inchar);
-	push_num (build);
-	inchar = byte(pc);
-	return;
-      }
-    }
-
-  /* Build the new number. */
-  if (kdigits == 0)
-    {
-      build = bc_new_num (1,kscale);
-      ptr = build->n_value;
-      *ptr++ = 0;
-    }
-  else
-    {
-      build = bc_new_num (kdigits,kscale);
-      ptr = build->n_value;
-    }
-
-  while (inchar != ':')
-    {
-      if (inchar != '.')
-	{
-	  if (inchar > 9)
-	    *ptr++ = 9;
-	  else
-	    *ptr++ = inchar;
-	}
-      inchar = byte(pc);
-    }
-  push_num (build);
-}
-
-
-/* Put the correct value on the stack for C_CODE.  Frees TOS num. */
-
-void
-assign (c_code)
-     char c_code;
-{
-  bc_free_num (&ex_stack->s_num);
-  if (c_code)
-    ex_stack->s_num = bc_copy_num (_one_);
-  else
-    ex_stack->s_num = bc_copy_num (_zero_);
-}
-
--- contrib/bc/bc/bc.y
+++ /dev/null
@@ -1,654 +0,0 @@
-%{
-/* bc.y: The grammar for a POSIX compatable bc processor with some
-         extensions to the language. */
-
-/*  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, Inc.
-      59 Temple Place, Suite 330
-      Boston, MA 02111 USA
-
-    You may contact the author by:
-       e-mail:  philnelson at acm.org
-      us-mail:  Philip A. Nelson
-                Computer Science Department, 9062
-                Western Washington University
-                Bellingham, WA 98226-9062
-       
-*************************************************************************/
-
-#include "bcdefs.h"
-#include "global.h"
-#include "proto.h"
-%}
-
-%start program
-
-%union {
-	char	 *s_value;
-	char	  c_value;
-	int	  i_value;
-	arg_list *a_value;
-       }
-
-/* Extensions over POSIX bc.
-   a) NAME was LETTER.  This grammar allows longer names.
-      Single letter names will still work.
-   b) Relational_expression allowed only one comparison.
-      This grammar has added boolean expressions with
-      && (and) || (or) and ! (not) and allowed all of them in
-      full expressions.
-   c) Added an else to the if.
-   d) Call by variable array parameters
-   e) read() procedure that reads a number under program control from stdin.
-   f) halt statement that halts the the program under program control.  It
-      is an executed statement.
-   g) continue statement for for loops.
-   h) optional expressions in the for loop.
-   i) print statement to print multiple numbers per line.
-   j) warranty statement to print an extended warranty notice.
-   j) limits statement to print the processor's limits.
-*/
-
-%token <i_value> ENDOFLINE AND OR NOT
-%token <s_value> STRING NAME NUMBER
-/*     '-', '+' are tokens themselves		*/
-/*     '=', '+=',  '-=', '*=', '/=', '%=', '^=' */
-%token <c_value> ASSIGN_OP
-/*     '==', '<=', '>=', '!=', '<', '>' 	*/
-%token <s_value> REL_OP
-/*     '++', '--' 				*/
-%token <c_value> INCR_DECR
-/*     'define', 'break', 'quit', 'length' 	*/
-%token <i_value> Define    Break    Quit    Length
-/*     'return', 'for', 'if', 'while', 'sqrt', 'else' 	*/
-%token <i_value> Return    For    If    While    Sqrt   Else
-/*     'scale', 'ibase', 'obase', 'auto', 'read' 	*/
-%token <i_value> Scale    Ibase    Obase    Auto  Read
-/*     'warranty', 'halt', 'last', 'continue', 'print', 'limits'   */
-%token <i_value> Warranty, Halt, Last, Continue, Print, Limits
-/*     'history' */
-%token <i_value> UNARY_MINUS HistoryVar
-
-/* Types of all other things. */
-%type <i_value> expression return_expression named_expression opt_expression
-%type <c_value> '+' '-' '*' '/' '%' 
-%type <a_value> opt_parameter_list opt_auto_define_list define_list
-%type <a_value> opt_argument_list argument_list
-%type <i_value> program input_item semicolon_list statement_list
-%type <i_value> statement function statement_or_error required_eol
-
-/* precedence */
-%left OR
-%left AND
-%nonassoc NOT
-%left REL_OP
-%right ASSIGN_OP
-%left '+' '-'
-%left '*' '/' '%'
-%right '^'
-%nonassoc UNARY_MINUS
-%nonassoc INCR_DECR
-
-%%
-program			: /* empty */
-			    {
-			      $$ = 0;
-			      if (interactive && !quiet)
-				{
-				  show_bc_version ();
-				  welcome ();
-				}
-			    }
-			| program input_item
-			;
-input_item		: semicolon_list ENDOFLINE
-			    { run_code (); }
-			| function
-			    { run_code (); }
-			| error ENDOFLINE
-			    {
-			      yyerrok;
-			      init_gen ();
-			    }
-			;
-opt_newline		: /* empty */
-			| ENDOFLINE
-			    { warn ("newline not allowed"); }
-			;
-semicolon_list		: /* empty */
-			    { $$ = 0; }
-			| statement_or_error
-			| semicolon_list ';' statement_or_error
-			| semicolon_list ';'
-			;
-statement_list		: /* empty */
-			    { $$ = 0; }
-			| statement_or_error
-			| statement_list ENDOFLINE
-			| statement_list ENDOFLINE statement_or_error
-			| statement_list ';'
-			| statement_list ';' statement
-			;
-statement_or_error	: statement
-  			| error statement
-			    { $$ = $2; }
-			;
-statement 		: Warranty
-			    { warranty (""); }
-			| Limits
-			    { limits (); }
-			| expression
-			    {
-			      if ($1 & 2)
-				warn ("comparison in expression");
-			      if ($1 & 1)
-				generate ("W");
-			      else 
-				generate ("p");
-			    }
-			| STRING
-			    {
-			      $$ = 0;
-			      generate ("w");
-			      generate ($1);
-			      free ($1);
-			    }
-			| Break
-			    {
-			      if (break_label == 0)
-				yyerror ("Break outside a for/while");
-			      else
-				{
-				  sprintf (genstr, "J%1d:", break_label);
-				  generate (genstr);
-				}
-			    }
-			| Continue
-			    {
-			      warn ("Continue statement");
-			      if (continue_label == 0)
-				yyerror ("Continue outside a for");
-			      else
-				{
-				  sprintf (genstr, "J%1d:", continue_label);
-				  generate (genstr);
-				}
-			    }
-			| Quit
-			    { exit (0); }
-			| Halt
-			    { generate ("h"); }
-			| Return return_expression
-			    { generate ("R"); }
-			| For 
-			    {
-			      $1 = break_label; 
-			      break_label = next_label++;
-			    }
-			  '(' opt_expression ';'
-			    {
-			      if ($4 & 2)
-				warn ("Comparison in first for expression");
-			      if ($4 >= 0)
-				generate ("p");
-			      $4 = next_label++;
-			      sprintf (genstr, "N%1d:", $4);
-			      generate (genstr);
-			    }
-			  opt_expression ';'
-			    {
-			      if ($7 < 0) generate ("1");
-			      $7 = next_label++;
-			      sprintf (genstr, "B%1d:J%1d:", $7, break_label);
-			      generate (genstr);
-			      $<i_value>$ = continue_label;
-			      continue_label = next_label++;
-			      sprintf (genstr, "N%1d:", continue_label);
-			      generate (genstr);
-			    }
-			  opt_expression ')'
-			    {
-			      if ($10 & 2 )
-				warn ("Comparison in third for expression");
-			      if ($10 & 16)
-				sprintf (genstr, "J%1d:N%1d:", $4, $7);
-			      else
-				sprintf (genstr, "pJ%1d:N%1d:", $4, $7);
-			      generate (genstr);
-			    }
-			  opt_newline statement
-			    {
-			      sprintf (genstr, "J%1d:N%1d:",
-				       continue_label, break_label);
-			      generate (genstr);
-			      break_label = $1;
-			      continue_label = $<i_value>9;
-			    }
-			| If '(' expression ')' 
-			    {
-			      $3 = if_label;
-			      if_label = next_label++;
-			      sprintf (genstr, "Z%1d:", if_label);
-			      generate (genstr);
-			    }
-			  opt_newline statement  opt_else
-			    {
-			      sprintf (genstr, "N%1d:", if_label); 
-			      generate (genstr);
-			      if_label = $3;
-			    }
-			| While 
-			    {
-			      $1 = next_label++;
-			      sprintf (genstr, "N%1d:", $1);
-			      generate (genstr);
-			    }
-			'(' expression 
-			    {
-			      $4 = break_label; 
-			      break_label = next_label++;
-			      sprintf (genstr, "Z%1d:", break_label);
-			      generate (genstr);
-			    }
-			')' opt_newline statement
-			    {
-			      sprintf (genstr, "J%1d:N%1d:", $1, break_label);
-			      generate (genstr);
-			      break_label = $4;
-			    }
-			| '{' statement_list '}'
-			    { $$ = 0; }
-			| Print
-			    {  warn ("print statement"); }
-			  print_list
-			;
-print_list		: print_element
- 			| print_element ',' print_list
-			;
-print_element		: STRING
-			    {
-			      generate ("O");
-			      generate ($1);
-			      free ($1);
-			    }
-			| expression
-			    { generate ("P"); }
- 			;
-opt_else		: /* nothing */
-			| Else 
-			    {
-			      warn ("else clause in if statement");
-			      $1 = next_label++;
-			      sprintf (genstr, "J%d:N%1d:", $1, if_label); 
-			      generate (genstr);
-			      if_label = $1;
-			    }
-			  opt_newline statement
-function 		: Define NAME '(' opt_parameter_list ')' opt_newline
-     			  '{' required_eol opt_auto_define_list 
-			    {
-			      /* Check auto list against parameter list? */
-			      check_params ($4,$9);
-			      sprintf (genstr, "F%d,%s.%s[",
-				       lookup($2,FUNCTDEF), 
-				       arg_str ($4), arg_str ($9));
-			      generate (genstr);
-			      free_args ($4);
-			      free_args ($9);
-			      $1 = next_label;
-			      next_label = 1;
-			    }
-			  statement_list /* ENDOFLINE */ '}'
-			    {
-			      generate ("0R]");
-			      next_label = $1;
-			    }
-			;
-opt_parameter_list	: /* empty */ 
-			    { $$ = NULL; }
-			| define_list
-			;
-opt_auto_define_list 	: /* empty */ 
-			    { $$ = NULL; }
-			| Auto define_list ENDOFLINE
-			    { $$ = $2; } 
-			| Auto define_list ';'
-			    { $$ = $2; } 
-			;
-define_list 		: NAME
-			    { $$ = nextarg (NULL, lookup ($1,SIMPLE), FALSE);}
-			| NAME '[' ']'
-			    { $$ = nextarg (NULL, lookup ($1,ARRAY), FALSE); }
-			| '*' NAME '[' ']'
-			    { $$ = nextarg (NULL, lookup ($2,ARRAY), TRUE); }
-			| define_list ',' NAME
-			    { $$ = nextarg ($1, lookup ($3,SIMPLE), FALSE); }
-			| define_list ',' NAME '[' ']'
-			    { $$ = nextarg ($1, lookup ($3,ARRAY), FALSE); }
-			| define_list ',' '*' NAME '[' ']'
-			    { $$ = nextarg ($1, lookup ($4,ARRAY), TRUE); }
-			;
-opt_argument_list	: /* empty */
-			    { $$ = NULL; }
-			| argument_list
-			;
-argument_list 		: expression
-			    {
-			      if ($1 & 2) warn ("comparison in argument");
-			      $$ = nextarg (NULL,0,FALSE);
-			    }
-			| NAME '[' ']'
-			    {
-			      sprintf (genstr, "K%d:", -lookup ($1,ARRAY));
-			      generate (genstr);
-			      $$ = nextarg (NULL,1,FALSE);
-			    }
-			| argument_list ',' expression
-			    {
-			      if ($3 & 2) warn ("comparison in argument");
-			      $$ = nextarg ($1,0,FALSE);
-			    }
-			| argument_list ',' NAME '[' ']'
-			    {
-			      sprintf (genstr, "K%d:", -lookup ($3,ARRAY));
-			      generate (genstr);
-			      $$ = nextarg ($1,1,FALSE);
-			    }
-			;
-
-/* Expression lval meanings!  (Bits mean something!)
- *  0 => Top op is assignment.
- *  1 => Top op is not assignment.
- *  2 => Comparison is somewhere in expression.
- *  4 => Expression is in parenthesis.
- * 16 => Empty optional expression.
- */
-
-opt_expression 		: /* empty */
-			    {
-			      $$ = 16;
-			      warn ("Missing expression in for statement");
-			    }
-			| expression
-			;
-return_expression	: /* empty */
-			    {
-			      $$ = 0;
-			      generate ("0");
-			    }
-			| expression
-			    {
-			      if ($1 & 2)
-				warn ("comparison in return expresion");
-			      if (!($1 & 4))
-				warn ("return expression requires parenthesis");
-			    }
-			;
-expression		:  named_expression ASSIGN_OP 
-			    {
-			      if ($2 != '=')
-				{
-				  if ($1 < 0)
-				    sprintf (genstr, "DL%d:", -$1);
-				  else
-				    sprintf (genstr, "l%d:", $1);
-				  generate (genstr);
-				}
-			    }
-			  expression
-			    {
-			      if ($4 & 2) warn("comparison in assignment");
-			      if ($2 != '=')
-				{
-				  sprintf (genstr, "%c", $2);
-				  generate (genstr);
-				}
-			      if ($1 < 0)
-				sprintf (genstr, "S%d:", -$1);
-			      else
-				sprintf (genstr, "s%d:", $1);
-			      generate (genstr);
-			      $$ = 0;
-			    }
-			;
-			| expression AND 
-			    {
-			      warn("&& operator");
-			      $2 = next_label++;
-			      sprintf (genstr, "DZ%d:p", $2);
-			      generate (genstr);
-			    }
-			  expression
-			    {
-			      sprintf (genstr, "DZ%d:p1N%d:", $2, $2);
-			      generate (genstr);
-			      $$ = ($1 | $4) & ~4;
-			    }
-			| expression OR
-			    {
-			      warn("|| operator");
-			      $2 = next_label++;
-			      sprintf (genstr, "B%d:", $2);
-			      generate (genstr);
-			    }
-			  expression
- 			    {
-			      int tmplab;
-			      tmplab = next_label++;
-			      sprintf (genstr, "B%d:0J%d:N%d:1N%d:",
-				       $2, tmplab, $2, tmplab);
-			      generate (genstr);
-			      $$ = ($1 | $4) & ~4;
-			    }
-			| NOT expression
-			    {
-			      $$ = $2 & ~4;
-			      warn("! operator");
-			      generate ("!");
-			    }
-			| expression REL_OP expression
-			    {
-			      $$ = 3;
-			      switch (*($2))
-				{
-				case '=':
-				  generate ("=");
-				  break;
-
-				case '!':
-				  generate ("#");
-				  break;
-
-				case '<':
-				  if ($2[1] == '=')
-				    generate ("{");
-				  else
-				    generate ("<");
-				  break;
-
-				case '>':
-				  if ($2[1] == '=')
-				    generate ("}");
-				  else
-				    generate (">");
-				  break;
-				}
-			    }
-			| expression '+' expression
-			    {
-			      generate ("+");
-			      $$ = ($1 | $3) & ~4;
-			    }
-			| expression '-' expression
-			    {
-			      generate ("-");
-			      $$ = ($1 | $3) & ~4;
-			    }
-			| expression '*' expression
-			    {
-			      generate ("*");
-			      $$ = ($1 | $3) & ~4;
-			    }
-			| expression '/' expression
-			    {
-			      generate ("/");
-			      $$ = ($1 | $3) & ~4;
-			    }
-			| expression '%' expression
-			    {
-			      generate ("%");
-			      $$ = ($1 | $3) & ~4;
-			    }
-			| expression '^' expression
-			    {
-			      generate ("^");
-			      $$ = ($1 | $3) & ~4;
-			    }
-			| '-' expression  %prec UNARY_MINUS
-			    {
-			      generate ("n");
-			      $$ = $2 & ~4;
-			    }
-			| named_expression
-			    {
-			      $$ = 1;
-			      if ($1 < 0)
-				sprintf (genstr, "L%d:", -$1);
-			      else
-				sprintf (genstr, "l%d:", $1);
-			      generate (genstr);
-			    }
-			| NUMBER
-			    {
-			      int len = strlen($1);
-			      $$ = 1;
-			      if (len == 1 && *$1 == '0')
-				generate ("0");
-			      else if (len == 1 && *$1 == '1')
-				generate ("1");
-			      else
-				{
-				  generate ("K");
-				  generate ($1);
-				  generate (":");
-				}
-			      free ($1);
-			    }
-			| '(' expression ')'
-			    { $$ = $2 | 5; }
-			| NAME '(' opt_argument_list ')'
-			    {
-			      $$ = 1;
-			      if ($3 != NULL)
-				{ 
-				  sprintf (genstr, "C%d,%s:",
-					   lookup ($1,FUNCT),
-					   call_str ($3));
-				  free_args ($3);
-				}
-			      else
-				{
-				  sprintf (genstr, "C%d:", lookup ($1,FUNCT));
-				}
-			      generate (genstr);
-			    }
-			| INCR_DECR named_expression
-			    {
-			      $$ = 1;
-			      if ($2 < 0)
-				{
-				  if ($1 == '+')
-				    sprintf (genstr, "DA%d:L%d:", -$2, -$2);
-				  else
-				    sprintf (genstr, "DM%d:L%d:", -$2, -$2);
-				}
-			      else
-				{
-				  if ($1 == '+')
-				    sprintf (genstr, "i%d:l%d:", $2, $2);
-				  else
-				    sprintf (genstr, "d%d:l%d:", $2, $2);
-				}
-			      generate (genstr);
-			    }
-			| named_expression INCR_DECR
-			    {
-			      $$ = 1;
-			      if ($1 < 0)
-				{
-				  sprintf (genstr, "DL%d:x", -$1);
-				  generate (genstr); 
-				  if ($2 == '+')
-				    sprintf (genstr, "A%d:", -$1);
-				  else
-				      sprintf (genstr, "M%d:", -$1);
-				}
-			      else
-				{
-				  sprintf (genstr, "l%d:", $1);
-				  generate (genstr);
-				  if ($2 == '+')
-				    sprintf (genstr, "i%d:", $1);
-				  else
-				    sprintf (genstr, "d%d:", $1);
-				}
-			      generate (genstr);
-			    }
-			| Length '(' expression ')'
-			    { generate ("cL"); $$ = 1;}
-			| Sqrt '(' expression ')'
-			    { generate ("cR"); $$ = 1;}
-			| Scale '(' expression ')'
-			    { generate ("cS"); $$ = 1;}
-			| Read '(' ')'
-			    {
-			      warn ("read function");
-			      generate ("cI"); $$ = 1;
-			    }
-			;
-named_expression	: NAME
-			    { $$ = lookup($1,SIMPLE); }
-			| NAME '[' expression ']'
-			    {
-			      if ($3 > 1) warn("comparison in subscript");
-			      $$ = lookup($1,ARRAY);
-			    }
-			| Ibase
-			    { $$ = 0; }
-			| Obase
-			    { $$ = 1; }
-			| Scale
-			    { $$ = 2; }
-			| HistoryVar
-			    { $$ = 3;
-			      warn ("History variable");
-			    }
-			| Last
-			    { $$ = 4;
-			      warn ("Last variable");
-			    }
-			;
-
-
-required_eol		: { warn ("End of line required"); }
-			| ENDOFLINE
-			| required_eol ENDOFLINE
-			  { warn ("Too many end of lines"); }
-			;
-
-%%
-
--- contrib/bc/bc/load.c
+++ /dev/null
@@ -1,351 +0,0 @@
-/* load.c:  This code "loads" code into the code segments. */
-
-/*  This file is part of GNU bc.
-    Copyright (C) 1991-1994, 1997, 2000 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, Inc.
-      59 Temple Place, Suite 330
-      Boston, MA 02111 USA
-
-    You may contact the author by:
-       e-mail:  philnelson at acm.org
-      us-mail:  Philip A. Nelson
-                Computer Science Department, 9062
-                Western Washington University
-                Bellingham, WA 98226-9062
-       
-*************************************************************************/
-
-#include "bcdefs.h"
-#include "global.h"
-#include "proto.h"
-
-/* Load variables. */
-
-program_counter load_adr;
-char load_str;
-char load_const;
-
-/* Initialize the load sequence. */
-void
-init_load ()
-{
-  clear_func(0);
-  load_adr.pc_func = 0;
-  load_adr.pc_addr = 0;
-  load_str = FALSE;
-  load_const = FALSE;
-}
-
-/* addbyte adds one BYTE to the current code segment. */
-void
-addbyte (byte)
-     char byte;
-{
-  int pc;
-  bc_function *f;
-  char *new_body;
-
-  /* If there was an error, don't continue. */
-  if (had_error) return;
-
-  /* Calculate the segment and offset. */
-  pc = load_adr.pc_addr++;
-  f = &functions[load_adr.pc_func];
-
-  if (pc >= f->f_body_size)
-    {
-      f->f_body_size *= 2;
-      new_body = (char *) bc_malloc (f->f_body_size);
-      memcpy(new_body, f->f_body, f->f_body_size/2);
-      free (f->f_body);
-      f->f_body = new_body;
-    }
-
-  /* Store the byte. */
-  f->f_body[pc] = byte;
-  f->f_code_size++;
-}
-
-
-/* Define a label LAB to be the current program counter. */
-
-void
-def_label (lab)
-     long lab;
-{
-  bc_label_group *temp;
-  int group, offset, func;
-    
-  /* Get things ready. */
-  group = lab >> BC_LABEL_LOG;
-  offset = lab % BC_LABEL_GROUP;
-  func = load_adr.pc_func;
-  
-  /* Make sure there is at least one label group. */
-  if (functions[func].f_label == NULL)
-    {
-      functions[func].f_label = 
-	(bc_label_group *) bc_malloc (sizeof(bc_label_group));
-      functions[func].f_label->l_next = NULL;
-    }
-
-  /* Add the label group. */
-  temp = functions[func].f_label;
-  while (group > 0)
-    {
-      if (temp->l_next == NULL)
-	{
-	  temp->l_next = (bc_label_group *) bc_malloc (sizeof(bc_label_group));
-	  temp->l_next->l_next = NULL;
-	}
-      temp = temp->l_next;
-      group --;
-    }
-
-  /* Define it! */
-  temp->l_adrs [offset] = load_adr.pc_addr;
-}
-
-/* Several instructions have integers in the code.  They
-   are all known to be legal longs.  So, no error code
-   is added.  STR is the pointer to the load string and
-   must be moved to the last non-digit character. */
-
-long
-long_val (str)
-     char **str;
-{ int  val = 0;
-  char neg = FALSE;
-
-  if (**str == '-')
-    {
-      neg = TRUE;
-      (*str)++;
-    }
-  while (isdigit((int)(**str))) 
-    val = val*10 + *(*str)++ - '0';
-
-  if (neg)
-    return -val;
-  else
-    return val;
-}
-
-
-/* load_code loads the CODE into the machine. */
-
-void
-load_code (code)
-     char *code;
-{
-  char *str;
-  long  ap_name;	/* auto or parameter name. */
-  long  label_no;
-  long  vaf_name;	/* variable, array or function number. */
-  long  func;
-  static program_counter save_adr;
-
-  /* Initialize. */
-  str = code;
-   
-  /* Scan the code. */
-  while (*str != 0)
-    {
-      /* If there was an error, don't continue. */
-      if (had_error) return;
-
-      if (load_str)
-	{
-	  if (*str == '"') load_str = FALSE;
-	  addbyte (*str++);
-	}
-      else
-	if (load_const)
-	  {
-	    if (*str == '\n') 
-	      str++;
-	    else
-	      {
-		if (*str == ':')
-		  {
-		    load_const = FALSE;
-		    addbyte (*str++);
-		  }
-		else
-		  if (*str == '.')
-		    addbyte (*str++);
-		  else
-		    if (*str >= 'A')
-		      addbyte (*str++ + 10 - 'A');
-		    else
-		      addbyte (*str++ - '0');
-	      }
-	  }
-	else
-	  {
-	    switch (*str)
-	      {
-
-	      case '"':	/* Starts a string. */
-		load_str = TRUE;
-		break;
-
-	      case 'N': /* A label */
-		str++;
-		label_no = long_val (&str);
-		def_label (label_no);
-		break;
-
-	      case 'B':  /* Branch to label. */
-	      case 'J':  /* Jump to label. */
-	      case 'Z':  /* Branch Zero to label. */
-		addbyte(*str++);
-		label_no = long_val (&str);
-		if (label_no > 65535L)
-		  {  /* Better message? */
-		    fprintf (stderr,"Program too big.\n");
-		    exit(1);
-		  }
-		addbyte ( (char) (label_no & 0xFF));
-		addbyte ( (char) (label_no >> 8));
-		break;
-
-	      case 'F':  /* A function, get the name and initialize it. */
-		str++;
-		func = long_val (&str);
-		clear_func (func);
-#if DEBUG > 2
-		printf ("Loading function number %d\n", func);
-#endif
-		/* get the parameters */
-		while (*str++ != '.')
-		  {
-		    if (*str == '.')
-		      {
-			str++;
-			break;
-		      }
-		    if (*str == '*')
-		      {
-			str++;
-			ap_name = long_val (&str);
-#if DEBUG > 2
-			printf ("var parameter number %d\n", ap_name);
-#endif
-			functions[(int)func].f_params = 
-			  nextarg (functions[(int)func].f_params, ap_name,
-				   TRUE);
-		      }
-		    else
-		      {
-			ap_name = long_val (&str);
-#if DEBUG > 2
-			printf ("parameter number %d\n", ap_name);
-#endif
-			functions[(int)func].f_params = 
-			  nextarg (functions[(int)func].f_params, ap_name,
-				   FALSE);
-		      }
-		  }
-
-		/* get the auto vars */
-		while (*str != '[')
-		  {
-		    if (*str == ',') str++;
-		    ap_name = long_val (&str);
-#if DEBUG > 2
-		    printf ("auto number %d\n", ap_name);
-#endif
-		    functions[(int)func].f_autos = 
-		      nextarg (functions[(int)func].f_autos, ap_name, FALSE);
-		  }
-		save_adr = load_adr;
-		load_adr.pc_func = func;
-		load_adr.pc_addr = 0;
-		break;
-		
-	      case ']':  /* A function end */
-		functions[load_adr.pc_func].f_defined = TRUE;
-		load_adr = save_adr;
-		break;
-
-	      case 'C':  /* Call a function. */
-		addbyte (*str++);
-		func = long_val (&str);
-		if (func < 128)
-		  addbyte ( (char) func);
-		else
-		  {
-		    addbyte (((func >> 8) & 0xff) | 0x80);
-		    addbyte (func & 0xff);
-		  }
-		if (*str == ',') str++;
-		while (*str != ':')
-		  addbyte (*str++);
-		addbyte (':');
-		break;
-		
-	      case 'c':  /* Call a special function. */
-		addbyte (*str++);
-		addbyte (*str);
-		break;
-
-	      case 'K':  /* A constant.... may have an "F" in it. */
-		addbyte (*str);
-		load_const = TRUE;
-		break;
-
-	      case 'd':  /* Decrement. */
-	      case 'i':  /* Increment. */
-	      case 'l':  /* Load. */
-	      case 's':  /* Store. */
-	      case 'A':  /* Array Increment */
-	      case 'M':  /* Array Decrement */
-	      case 'L':  /* Array Load */
-	      case 'S':  /* Array Store */
-		addbyte (*str++);
-		vaf_name = long_val (&str);
-		if (vaf_name < 128)
-		  addbyte (vaf_name);
-		else
-		  {
-		    addbyte (((vaf_name >> 8) & 0xff) | 0x80);
-		    addbyte (vaf_name & 0xff);
-		  }
-		break;
-
-	      case '@':  /* A command! */
-		switch (*(++str))
-		  {
-		  case 'i':
-		    init_load ();
-		    break;
-		  case 'r':
-		    execute ();
-		    break;
-		  } 
-		break;
-
-	      case '\n':  /* Ignore the newlines */
-		break;
-		
-	      default:   /* Anything else */
-		addbyte (*str);	   
-	      }
-	    str++;
-	  }
-    }
-}
--- contrib/bc/bc/global.c
+++ /dev/null
@@ -1,42 +0,0 @@
-/* global.c:  This defines the global variables. */
-
-/*  This file is part of GNU bc.
-    Copyright (C) 1991-1994, 1997, 2000 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, Inc.
-      59 Temple Place, Suite 330
-      Boston, MA 02111 USA
-
-    You may contact the author by:
-       e-mail:  philnelson at acm.org
-      us-mail:  Philip A. Nelson
-                Computer Science Department, 9062
-                Western Washington University
-                Bellingham, WA 98226-9062
-       
-*************************************************************************/
-
-#include "bcdefs.h"
-
-/* Since we want to define them here, we use the following define. */
-#undef EXTERN
-#define EXTERN
-
-/* Define all the global variables for bc. */
-#include "global.h"
-
-CONST char *libmath[] = 
-#include "libmath.h"
-;
--- contrib/bc/bc/fix-libmath_h
+++ /dev/null
@@ -1,9 +0,0 @@
-ed libmath.h <<EOS-EOS
-1,1s/^/{"/
-1,\$s/\$/",/
-2,\$s/^/"/
-\$,\$d
-\$,\$s/,\$/,0}/
-w
-q
-EOS-EOS
--- contrib/bc/bc/scan.l
+++ /dev/null
@@ -1,374 +0,0 @@
-%{
-/* $FreeBSD: src/contrib/bc/bc/scan.l,v 1.6 2001/04/11 04:07:38 ache Exp $ */
-/* scan.l: the (f)lex description file for the scanner. */
-
-/*  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, Inc.
-      59 Temple Place, Suite 330
-      Boston, MA 02111 USA
-
-    You may contact the author by:
-       e-mail:  philnelson at acm.org
-      us-mail:  Philip A. Nelson
-                Computer Science Department, 9062
-                Western Washington University
-                Bellingham, WA 98226-9062
-       
-*************************************************************************/
-
-#include "bcdefs.h"
-#include "bc.h"
-#include "global.h"
-#include "proto.h"
-#include <errno.h>
-
-/* Using flex, we can ask for a smaller input buffer.  With lex, this
-   does nothing! */
-
-#ifdef SMALL_BUF
-#undef YY_READ_BUF_SIZE
-#define YY_READ_BUF_SIZE 512
-#endif
-
-/* Force . as last for now. */
-#define DOT_IS_LAST
-
-/* We want to define our own yywrap. */
-#undef yywrap
-_PROTOTYPE(int yywrap, (void));
-
-#if defined(LIBEDIT)
-/* Support for the BSD libedit with history for
-   nicer input on the interactive part of input. */
-
-#include <histedit.h>
-
-/* Have input call the following function. */
-#undef  YY_INPUT
-#define YY_INPUT(buf,result,max_size) \
-		bcel_input((char *)buf, &result, max_size)
-
-/* Variables to help interface editline with bc. */
-static const char *bcel_line = (char *)NULL;
-static int   bcel_len = 0;
-
-
-/* Required to get rid of that ugly ? default prompt! */
-char *
-null_prompt (EditLine *el)
-{
-  return "";
-}
-
-
-/* bcel_input puts upto MAX characters into BUF with the number put in
-   BUF placed in *RESULT.  If the yy input file is the same as
-   stdin, use editline.  Otherwise, just read it.
-*/
-
-static void
-bcel_input (buf, result, max)
-	char *buf;
-	int  *result;
-	int   max;
-{
-  if (!edit || yyin != stdin)
-    {
-      while ( (*result = read( fileno(yyin), buf, max )) < 0 )
-        if (errno != EINTR)
-	  {
-	    yyerror( "read() in flex scanner failed" );
-	    exit (1);
-	  }
-      return;
-    }
-
-  /* Do we need a new string? */
-  if (bcel_len == 0)
-    {
-      bcel_line = el_gets(edit, &bcel_len);
-      if (bcel_line == NULL) {
-	/* end of file */
-	*result = 0;
-	bcel_len = 0;
-	return;
-      }
-      if (bcel_len != 0)
-	history (hist, &histev, H_ENTER, bcel_line); 
-      fflush (stdout);
-    }
-
-  if (bcel_len <= max)
-    {
-      strncpy (buf, bcel_line, bcel_len);
-      *result = bcel_len;
-      bcel_len = 0;
-    }
-  else
-    {
-      strncpy (buf, bcel_line, max);
-      *result = max;
-      bcel_line += max;
-      bcel_len -= max;
-    }
-}
-#endif
-
-#ifdef READLINE
-/* Support for the readline and history libraries.  This allows
-   nicer input on the interactive part of input. */
-
-/* Have input call the following function. */
-#undef  YY_INPUT
-#define YY_INPUT(buf,result,max_size) \
-		rl_input((char *)buf, &result, max_size)
-
-/* Variables to help interface readline with bc. */
-static char *rl_line = (char *)NULL;
-static char *rl_start = (char *)NULL;
-static int   rl_len = 0;
-
-/* Definitions for readline access. */
-extern FILE *rl_instream;
-
-/* rl_input puts upto MAX characters into BUF with the number put in
-   BUF placed in *RESULT.  If the yy input file is the same as
-   rl_instream (stdin), use readline.  Otherwise, just read it.
-*/
-
-static void
-rl_input (buf, result, max)
-	char *buf;
-	int  *result;
-	int   max;
-{
-  if (yyin != rl_instream)
-    {
-      while ( (*result = read( fileno(yyin), buf, max )) < 0 )
-        if (errno != EINTR)
-	  {
-	    yyerror( "read() in flex scanner failed" );
-	    exit (1);
-	  }
-      return;
-    }
-
-  /* Do we need a new string? */
-  if (rl_len == 0)
-    {
-      if (rl_start)
-	free(rl_start);
-      rl_start = readline ("");
-      if (rl_start == NULL) {
-	/* end of file */
-	*result = 0;
-	rl_len = 0;
-	return;
-      }
-      rl_line = rl_start;
-      rl_len = strlen (rl_line)+1;
-      if (rl_len != 1)
-	add_history (rl_line); 
-      rl_line[rl_len-1] = '\n';
-      fflush (stdout);
-    }
-
-  if (rl_len <= max)
-    {
-      strncpy (buf, rl_line, rl_len);
-      *result = rl_len;
-      rl_len = 0;
-    }
-  else
-    {
-      strncpy (buf, rl_line, max);
-      *result = max;
-      rl_line += max;
-      rl_len -= max;
-    }
-}
-#endif
-
-#if !defined(READLINE) && !defined(LIBEDIT)
-
-/* MINIX returns from read with < 0 if SIGINT is  encountered.
-   In flex, we can redefine YY_INPUT to the following.  In lex, this
-   does nothing! */
-#undef  YY_INPUT
-#define YY_INPUT(buf,result,max_size) \
-	while ( (result = read( fileno(yyin), (char *) buf, max_size )) < 0 ) \
-	    if (errno != EINTR) \
-		YY_FATAL_ERROR( "read() in flex scanner failed" );
-#endif
-
-%}
-DIGIT [0-9A-F]
-LETTER [a-z]
-%s slcomment
-%%
-"#"		{
- 		  if (!std_only)
-		    BEGIN(slcomment);
- 		  else
-		    yyerror ("illegal character: #");
-		}
-<slcomment>[^\n]* { BEGIN(INITIAL); }
-<slcomment>"\n" { line_no++; BEGIN(INITIAL); return(ENDOFLINE); }
-define return(Define);
-break  return(Break);
-quit   return(Quit);
-length return(Length);
-return return(Return);
-for    return(For);
-if     return(If);
-while  return(While);
-sqrt   return(Sqrt);
-scale  return(Scale);
-ibase  return(Ibase);
-obase  return(Obase);
-auto   return(Auto);
-else   return(Else);
-read   return(Read);
-halt   return(Halt);
-last   return(Last);
-history {
-#if defined(READLINE) || defined(LIBEDIT)
-	  return(HistoryVar);
-#else
-	  yylval.s_value = strcopyof(yytext); return(NAME);
-#endif
-	}
-
-warranty return(Warranty);
-continue return(Continue);
-print  return(Print);
-limits return(Limits);
-"." {
-#ifdef DOT_IS_LAST
-       return(Last);
-#else
-       yyerror ("illegal character: %s",yytext);
-#endif
-    }
-"+"|"-"|";"|"("|")"|"{"|"}"|"["|"]"|","|"^" { yylval.c_value = yytext[0]; 
-					      return((int)yytext[0]); }
-&& { return(AND); }
-\|\| { return(OR); }
-"!" { return(NOT); }
-"*"|"/"|"%" { yylval.c_value = yytext[0]; return((int)yytext[0]); }
-"="|\+=|-=|\*=|\/=|%=|\^=  { yylval.c_value = yytext[0]; return(ASSIGN_OP); }
-=\+|=-|=\*|=\/|=%|=\^  { 
-#ifdef OLD_EQ_OP
-			 char warn_save;
-			 warn_save = warn_not_std;
-			 warn_not_std = TRUE;
-			 warn ("Old fashioned =<op>");
-			 warn_not_std = warn_save;
-			 yylval.c_value = yytext[1];
-#else
-			 yylval.c_value = '=';
-			 yyless (1);
-#endif
-			 return(ASSIGN_OP);
-		       }
-==|\<=|\>=|\!=|"<"|">" { yylval.s_value = strcopyof(yytext); return(REL_OP); }
-\+\+|-- { yylval.c_value = yytext[0]; return(INCR_DECR); }
-"\n" { line_no++; return(ENDOFLINE); }
-\\\n {  line_no++;  /* ignore a "quoted" newline */ }
-[ \t]+  { /* ignore spaces and tabs */ }
-"/*"  {
-	int c;
-
-	for (;;)
-	  {
-	    while ( ((c=input()) != '*') && (c != EOF)) 
-	      /* eat it */
-	      if (c == '\n') line_no++;
-	    if (c == '*')
- 	      {
-		while ( (c=input()) == '*') /* eat it*/;
-		if (c == '/') break; /* at end of comment */
-		if (c == '\n') line_no++;
-	      }
-	    if (c == EOF)
-	      {
-		fprintf (stderr,"EOF encountered in a comment.\n");
-		break;
-	      }
-	  }
-      }
-[a-z][a-z0-9_]* { yylval.s_value = strcopyof(yytext); return(NAME); }
-\"[^\"]*\"  {
- 	      unsigned char *look;
-	      int count = 0;
-	      yylval.s_value = strcopyof(yytext);
-	      for (look = yytext; *look != 0; look++)
-		{
-		  if (*look == '\n') line_no++;
-		  if (*look == '"')  count++;
-		}
-	      if (count != 2) yyerror ("NUL character in string.");
-	      return(STRING);
-	    }
-{DIGIT}({DIGIT}|\\\n)*("."({DIGIT}|\\\n)*)?|"."(\\\n)*{DIGIT}({DIGIT}|\\\n)* {
-	      unsigned char *src, *dst;
-	      int len;
-	      /* remove a trailing decimal point. */
-	      len = strlen(yytext);
-	      if (yytext[len-1] == '.')
-	        yytext[len-1] = 0;
-	      /* remove leading zeros. */
-	      src = yytext;
-	      dst = yytext;
-	      while (*src == '0') src++;
-	      if (*src == 0) src--;
-	      /* Copy strings removing the newlines. */
-	      while (*src != 0)
-		{
-	          if (*src == '\\')
-		    {
-		      src++; src++;
-		      line_no++;
-		    }
-		  else
-		    *dst++ = *src++;
-	        }
-	      *dst = 0;
-	      yylval.s_value = strcopyof(yytext); 
-	      return(NUMBER);
-	    }
-.       {
-	  if (yytext[0] < ' ')
-	    yyerror ("illegal character: ^%c",yytext[0] + '@');
-	  else
-	    if (yytext[0] > '~')
-	      yyerror ("illegal character: \\%03o", (int) yytext[0]);
-	    else
-	      yyerror ("illegal character: %s",yytext);
-	}
-%%
-
-
-
-/* This is the way to get multiple files input into lex. */
-
-int
-yywrap()
-{
-  if (!open_new_file ()) return (1);	/* EOF on standard in. */
-  return (0);				/* We have more input. */
-}
--- contrib/bc/bc/global.h
+++ /dev/null
@@ -1,154 +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, Inc.
-      59 Temple Place, Suite 330
-      Boston, MA 02111 USA
-
-    You may contact the author by:
-       e-mail:  philnelson at acm.org
-      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;
-#if defined(READLINE) || defined(LIBEDIT)
-EXTERN int n_history;
-#endif
-
-#if defined(LIBEDIT)
-/* LIBEDIT data */
-EditLine *edit;
-History  *hist;
-HistEvent histev;
-#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;
-
-/* For use with getopt.  Do not declare them here.*/
-extern int optind;
-
-/* Access to the yy input file.  Defined in scan.c. */
-extern FILE *yyin;
--- contrib/bc/bc/storage.c
+++ /dev/null
@@ -1,1067 +0,0 @@
-/* storage.c:  Code and data storage manipulations.  This includes labels. */
-
-/*  This file is part of GNU bc.
-    Copyright (C) 1991-1994, 1997, 2000 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, Inc.
-      59 Temple Place, Suite 330
-      Boston, MA 02111 USA
-
-    You may contact the author by:
-       e-mail:  philnelson at acm.org
-      us-mail:  Philip A. Nelson
-                Computer Science Department, 9062
-                Western Washington University
-                Bellingham, WA 98226-9062
-       
-*************************************************************************/
-
-#include "bcdefs.h"
-#include "global.h"
-#include "proto.h"
-
-
-/* Initialize the storage at the beginning of the run. */
-
-void
-init_storage ()
-{
-
-  /* Functions: we start with none and ask for more. */
-  f_count = 0;
-  more_functions ();
-  f_names[0] = "(main)";
-
-  /* Variables. */
-  v_count = 0;
-  more_variables ();
-  
-  /* Arrays. */
-  a_count = 0;
-  more_arrays ();
-
-  /* Other things... */
-  ex_stack = NULL;
-  fn_stack = NULL;
-  i_base = 10;
-  o_base = 10;
-  scale  = 0;
-#if defined(READLINE) || defined(LIBEDIT)
-  n_history = -1;	
-#endif
-  c_code = FALSE;
-  bc_init_numbers();
-}
-
-/* Three functions for increasing the number of functions, variables, or
-   arrays that are needed.  This adds another 32 of the requested object. */
-
-void
-more_functions (VOID)
-{
-  int old_count;
-  int indx;
-  bc_function *old_f;
-  bc_function *f;
-  char **old_names;
-
-  /* Save old information. */
-  old_count = f_count;
-  old_f = functions;
-  old_names = f_names;
-
-  /* Add a fixed amount and allocate new space. */
-  f_count += STORE_INCR;
-  functions = (bc_function *) bc_malloc (f_count*sizeof (bc_function));
-  f_names = (char **) bc_malloc (f_count*sizeof (char *));
-
-  /* Copy old ones. */
-  for (indx = 0; indx < old_count; indx++)
-    {
-      functions[indx] = old_f[indx];
-      f_names[indx] = old_names[indx];
-    }
-
-  /* Initialize the new ones. */
-  for (; indx < f_count; indx++)
-    {
-      f = &functions[indx];
-      f->f_defined = FALSE;
-      f->f_body = (char *) bc_malloc (BC_START_SIZE);
-      f->f_body_size = BC_START_SIZE;
-      f->f_code_size = 0;
-      f->f_label = NULL;
-      f->f_autos = NULL;
-      f->f_params = NULL;
-    }
-
-  /* Free the old elements. */
-  if (old_count != 0)
-    {
-      free (old_f);
-      free (old_names);
-    }
-}
-
-void
-more_variables ()
-{
-  int indx;
-  int old_count;
-  bc_var **old_var;
-  char **old_names;
-
-  /* Save the old values. */
-  old_count = v_count;
-  old_var = variables;
-  old_names = v_names;
-
-  /* Increment by a fixed amount and allocate. */
-  v_count += STORE_INCR;
-  variables = (bc_var **) bc_malloc (v_count*sizeof(bc_var *));
-  v_names = (char **) bc_malloc (v_count*sizeof(char *));
-
-  /* Copy the old variables. */
-  for (indx = 3; indx < old_count; indx++)
-    variables[indx] = old_var[indx];
-
-  /* Initialize the new elements. */
-  for (; indx < v_count; indx++)
-    variables[indx] = NULL;
-
-  /* Free the old elements. */
-  if (old_count != 0)
-    {
-      free (old_var);
-      free (old_names);
-    }
-}
-
-void
-more_arrays ()
-{
-  int indx;
-  int old_count;
-  bc_var_array **old_ary;
-  char **old_names;
-
-  /* Save the old values. */
-  old_count = a_count;
-  old_ary = arrays;
-  old_names = a_names;
-
-  /* Increment by a fixed amount and allocate. */
-  a_count += STORE_INCR;
-  arrays = (bc_var_array **) bc_malloc (a_count*sizeof(bc_var_array *));
-  a_names = (char **) bc_malloc (a_count*sizeof(char *));
-
-  /* Copy the old arrays. */
-  for (indx = 1; indx < old_count; indx++)
-    arrays[indx] = old_ary[indx];
-
-
-  /* Initialize the new elements. */
-  for (; indx < v_count; indx++)
-    arrays[indx] = NULL;
-
-  /* Free the old elements. */
-  if (old_count != 0)
-    {
-      free (old_ary);
-      free (old_names);
-    }
-}
-
-
-/* clear_func clears out function FUNC and makes it ready to redefine. */
-
-void
-clear_func (func)
-     int func;
-{
-  bc_function *f;
-  bc_label_group *lg;
-
-  /* Set the pointer to the function. */
-  f = &functions[func];
-  f->f_defined = FALSE;
-  /* XXX restore f_body to initial size??? */
-  f->f_code_size = 0;
-  if (f->f_autos != NULL)
-    {
-      free_args (f->f_autos);
-      f->f_autos = NULL;
-    }
-  if (f->f_params != NULL)
-    {
-      free_args (f->f_params);
-      f->f_params = NULL;
-    }
-  while (f->f_label != NULL)
-    {
-      lg = f->f_label->l_next;
-      free (f->f_label);
-      f->f_label = lg;
-    }
-}
-
-
-/*  Pop the function execution stack and return the top. */
-
-int
-fpop()
-{
-  fstack_rec *temp;
-  int retval;
-  
-  if (fn_stack != NULL)
-    {
-      temp = fn_stack;
-      fn_stack = temp->s_next;
-      retval = temp->s_val;
-      free (temp);
-    }
-  else
-    {
-      retval = 0;
-      rt_error ("function stack underflow, contact maintainer.");
-    }
-  return (retval);
-}
-
-
-/* Push VAL on to the function stack. */
-
-void
-fpush (val)
-     int val;
-{
-  fstack_rec *temp;
-  
-  temp = (fstack_rec *) bc_malloc (sizeof (fstack_rec));
-  temp->s_next = fn_stack;
-  temp->s_val = val;
-  fn_stack = temp;
-}
-
-
-/* Pop and discard the top element of the regular execution stack. */
-
-void
-pop ()
-{
-  estack_rec *temp;
-  
-  if (ex_stack != NULL)
-    {
-      temp = ex_stack;
-      ex_stack = temp->s_next;
-      bc_free_num (&temp->s_num);
-      free (temp);
-    }
-}
-
-
-/* Push a copy of NUM on to the regular execution stack. */
-
-void
-push_copy (num)
-     bc_num num;
-{
-  estack_rec *temp;
-
-  temp = (estack_rec *) bc_malloc (sizeof (estack_rec));
-  temp->s_num = bc_copy_num (num);
-  temp->s_next = ex_stack;
-  ex_stack = temp;
-}
-
-
-/* Push NUM on to the regular execution stack.  Do NOT push a copy. */
-
-void
-push_num (num)
-     bc_num num;
-{
-  estack_rec *temp;
-
-  temp = (estack_rec *) bc_malloc (sizeof (estack_rec));
-  temp->s_num = num;
-  temp->s_next = ex_stack;
-  ex_stack = temp;
-}
-
-
-/* Make sure the ex_stack has at least DEPTH elements on it.
-   Return TRUE if it has at least DEPTH elements, otherwise
-   return FALSE. */
-
-char
-check_stack (depth)
-     int depth;
-{
-  estack_rec *temp;
-
-  temp = ex_stack;
-  while ((temp != NULL) && (depth > 0))
-    {
-      temp = temp->s_next;
-      depth--;
-    }
-  if (depth > 0)
-    {
-      rt_error ("Stack error.");
-      return FALSE;
-    }
-  return TRUE;
-}
-
-
-/* The following routines manipulate simple variables and
-   array variables. */
-
-/* get_var returns a pointer to the variable VAR_NAME.  If one does not
-   exist, one is created. */
-
-bc_var *
-get_var (var_name)
-     int var_name;
-{
-  bc_var *var_ptr;
-
-  var_ptr = variables[var_name];
-  if (var_ptr == NULL)
-    {
-      var_ptr = variables[var_name] = (bc_var *) bc_malloc (sizeof (bc_var));
-      bc_init_num (&var_ptr->v_value);
-    }
-  return var_ptr;
-}
-
-
-/* get_array_num returns the address of the bc_num in the array
-   structure.  If more structure is requried to get to the index,
-   this routine does the work to create that structure. VAR_INDEX
-   is a zero based index into the arrays storage array. INDEX is
-   the index into the bc array. */
-
-bc_num *
-get_array_num (var_index, index)
-     int var_index;
-     long  index;
-{
-  bc_var_array *ary_ptr;
-  bc_array *a_var;
-  bc_array_node *temp;
-  int log, ix, ix1;
-  int sub [NODE_DEPTH];
-
-  /* Get the array entry. */
-  ary_ptr = arrays[var_index];
-  if (ary_ptr == NULL)
-    {
-      ary_ptr = arrays[var_index] =
-	(bc_var_array *) bc_malloc (sizeof (bc_var_array));
-      ary_ptr->a_value = NULL;
-      ary_ptr->a_next = NULL;
-      ary_ptr->a_param = FALSE;
-    }
-
-  a_var = ary_ptr->a_value;
-  if (a_var == NULL) {
-    a_var = ary_ptr->a_value = (bc_array *) bc_malloc (sizeof (bc_array));
-    a_var->a_tree = NULL;
-    a_var->a_depth = 0;
-  }
-
-  /* Get the index variable. */
-  sub[0] = index & NODE_MASK;
-  ix = index >> NODE_SHIFT;
-  log = 1;
-  while (ix > 0 || log < a_var->a_depth)
-    {
-      sub[log] = ix & NODE_MASK;
-      ix >>= NODE_SHIFT;
-      log++;
-    }
-  
-  /* Build any tree that is necessary. */
-  while (log > a_var->a_depth)
-    {
-      temp = (bc_array_node *) bc_malloc (sizeof(bc_array_node));
-      if (a_var->a_depth != 0)
-	{
-	  temp->n_items.n_down[0] = a_var->a_tree;
-	  for (ix=1; ix < NODE_SIZE; ix++)
-	    temp->n_items.n_down[ix] = NULL;
-	}
-      else
-	{
-	  for (ix=0; ix < NODE_SIZE; ix++)
-	    temp->n_items.n_num[ix] = bc_copy_num(_zero_);
-	}
-      a_var->a_tree = temp;
-      a_var->a_depth++;
-    }
-  
-  /* Find the indexed variable. */
-  temp = a_var->a_tree;
-  while ( log-- > 1)
-    {
-      ix1 = sub[log];
-      if (temp->n_items.n_down[ix1] == NULL)
-	{
-	  temp->n_items.n_down[ix1] =
-	    (bc_array_node *) bc_malloc (sizeof(bc_array_node));
-	  temp = temp->n_items.n_down[ix1];
-	  if (log > 1)
-	    for (ix=0; ix < NODE_SIZE; ix++)
-	      temp->n_items.n_down[ix] = NULL;
-	  else
-	    for (ix=0; ix < NODE_SIZE; ix++)
-	      temp->n_items.n_num[ix] = bc_copy_num(_zero_);
-	}
-      else
-	temp = temp->n_items.n_down[ix1];
-    }
-  
-  /* Return the address of the indexed variable. */
-  return &(temp->n_items.n_num[sub[0]]);
-}
-
-
-/* Store the top of the execution stack into VAR_NAME.  
-   This includes the special variables ibase, obase, and scale. */
-
-void
-store_var (var_name)
-     int var_name;
-{
-  bc_var *var_ptr;
-  long temp;
-  char toobig;
-
-  if (var_name > 3)
-    {
-      /* It is a simple variable. */
-      var_ptr = get_var (var_name);
-      if (var_ptr != NULL)
-	{
-	  bc_free_num(&var_ptr->v_value);
-	  var_ptr->v_value = bc_copy_num (ex_stack->s_num);
-	}
-    }
-  else
-    {
-      /* It is a special variable... */
-      toobig = FALSE;
-      temp = 0;
-      if (bc_is_neg (ex_stack->s_num))
-	{
-	  switch (var_name)
-	    {
-	    case 0:
-	      rt_warn ("negative ibase, set to 2");
-	      temp = 2;
-	      break;
-	    case 1:
-	      rt_warn ("negative obase, set to 2");
-	      temp = 2;
-	      break;
-	    case 2:
-	      rt_warn ("negative scale, set to 0");
-	      temp = 0;
-	      break;
-#if defined(READLINE) || defined(LIBEDIT)
-	    case 3:
-	      temp = -1;
-	      break;
-#endif
-	    }
-	}
-      else
-	{
-	  temp = bc_num2long (ex_stack->s_num);
-	  if (!bc_is_zero (ex_stack->s_num) && temp == 0)
-	    toobig = TRUE;
-	}
-      switch (var_name)
-	{
-	case 0:
-	  if (temp < 2 && !toobig)
-	    {
-	      i_base = 2;
-	      rt_warn ("ibase too small, set to 2");
-	    }
-	  else
-	    if (temp > 16 || toobig)
-	      {
-		i_base = 16;
-		rt_warn ("ibase too large, set to 16");
-	      }
-	    else
-	      i_base = (int) temp;
-	  break;
-
-	case 1:
-	  if (temp < 2 && !toobig)
-	    {
-	      o_base = 2;
-	      rt_warn ("obase too small, set to 2");
-	    }
-	  else
-	    if (temp > BC_BASE_MAX || toobig)
-	      {
-		o_base = BC_BASE_MAX;
-		rt_warn ("obase too large, set to %d", BC_BASE_MAX);
-	      }
-	    else
-	      o_base = (int) temp;
-	  break;
-
-	case 2:
-	  /*  WARNING:  The following if statement may generate a compiler
-	      warning if INT_MAX == LONG_MAX.  This is NOT a problem. */
-	  if (temp > BC_SCALE_MAX || toobig )
-	    {
-	      scale = BC_SCALE_MAX;
-	      rt_warn ("scale too large, set to %d", BC_SCALE_MAX);
-	    }
-	  else
-	    scale = (int) temp;
-	  break;
-
-#if defined(READLINE) || defined(LIBEDIT)
-	case 3:
-	  if (toobig)
-	    {
-	      temp = -1;
-	      rt_warn ("history too large, set to unlimited");
-	      UNLIMIT_HISTORY;
-	    }
-	  else
-	    {
-	      n_history = temp;
-	      if (temp < 0)
-		UNLIMIT_HISTORY;
-	      else
-		HISTORY_SIZE(n_history);
-	    }
-#endif
-	}
-    }
-}
-
-
-/* Store the top of the execution stack into array VAR_NAME. 
-   VAR_NAME is the name of an array, and the next to the top
-   of stack for the index into the array. */
-
-void
-store_array (var_name)
-     int var_name;
-{
-  bc_num *num_ptr;
-  long index;
-
-  if (!check_stack(2)) return;
-  index = bc_num2long (ex_stack->s_next->s_num);
-  if (index < 0 || index > BC_DIM_MAX ||
-      (index == 0 && !bc_is_zero(ex_stack->s_next->s_num))) 
-    rt_error ("Array %s subscript out of bounds.", a_names[var_name]);
-  else
-    {
-      num_ptr = get_array_num (var_name, index);
-      if (num_ptr != NULL)
-	{
-	  bc_free_num (num_ptr);
-	  *num_ptr = bc_copy_num (ex_stack->s_num);
-	  bc_free_num (&ex_stack->s_next->s_num);
-	  ex_stack->s_next->s_num = ex_stack->s_num;
-	  bc_init_num (&ex_stack->s_num);
-	  pop();
-	}
-    }
-}
-
-
-/*  Load a copy of VAR_NAME on to the execution stack.  This includes
-    the special variables ibase, obase and scale.  */
-
-void
-load_var (var_name)
-     int var_name;
-{
-  bc_var *var_ptr;
-
-  switch (var_name)
-    {
-
-    case 0:
-      /* Special variable ibase. */
-      push_copy (_zero_);
-      bc_int2num (&ex_stack->s_num, i_base);
-      break;
-
-    case 1:
-      /* Special variable obase. */
-      push_copy (_zero_);
-      bc_int2num (&ex_stack->s_num, o_base);
-      break;
-
-    case 2:
-      /* Special variable scale. */
-      push_copy (_zero_);
-      bc_int2num (&ex_stack->s_num, scale);
-      break;
-
-#if defined(READLINE) || defined(LIBEDIT)
-    case 3:
-      /* Special variable history. */
-      push_copy (_zero_);
-      bc_int2num (&ex_stack->s_num, n_history);
-      break;
-#endif
-
-    default:
-      /* It is a simple variable. */
-      var_ptr = variables[var_name];
-      if (var_ptr != NULL)
-	push_copy (var_ptr->v_value);
-      else
-	push_copy (_zero_);
-    }
-}
-
-
-/*  Load a copy of VAR_NAME on to the execution stack.  This includes
-    the special variables ibase, obase and scale.  */
-
-void
-load_array (var_name)
-     int var_name;
-{
-  bc_num *num_ptr;
-  long   index;
-
-  if (!check_stack(1)) return;
-  index = bc_num2long (ex_stack->s_num);
-  if (index < 0 || index > BC_DIM_MAX ||
-     (index == 0 && !bc_is_zero(ex_stack->s_num))) 
-    rt_error ("Array %s subscript out of bounds.", a_names[var_name]);
-  else
-    {
-      num_ptr = get_array_num (var_name, index);
-      if (num_ptr != NULL)
-	{
-	  pop();
-	  push_copy (*num_ptr);
-	}
-    }
-}
-
-
-/* Decrement VAR_NAME by one.  This includes the special variables
-   ibase, obase, and scale. */
-
-void
-decr_var (var_name)
-     int var_name;
-{
-  bc_var *var_ptr;
-
-  switch (var_name)
-    {
-
-    case 0: /* ibase */
-      if (i_base > 2)
-	i_base--;
-      else
-	rt_warn ("ibase too small in --");
-      break;
-      
-    case 1: /* obase */
-      if (o_base > 2)
-	o_base--;
-      else
-	rt_warn ("obase too small in --");
-      break;
-
-    case 2: /* scale */
-      if (scale > 0)
-	scale--;
-      else
-	rt_warn ("scale can not be negative in -- ");
-      break;
-
-#if defined(READLINE) || defined(LIBEDIT)
-    case 3: /* history */
-      n_history--;
-      if (n_history >= 0)
-	HISTORY_SIZE(n_history);
-      else
-	{
-	  n_history = -1;
-	  rt_warn ("history is negative, set to unlimited");
-	  UNLIMIT_HISTORY;
-	}
-#endif
-
-    default: /* It is a simple variable. */
-      var_ptr = get_var (var_name);
-      if (var_ptr != NULL)
-	bc_sub (var_ptr->v_value,_one_,&var_ptr->v_value, 0);
-    }
-}
-
-
-/* Decrement VAR_NAME by one.  VAR_NAME is an array, and the top of
-   the execution stack is the index and it is popped off the stack. */
-
-void
-decr_array (var_name)
-     int var_name;
-{
-  bc_num *num_ptr;
-  long   index;
-
-  /* It is an array variable. */
-  if (!check_stack (1)) return;
-  index = bc_num2long (ex_stack->s_num);
-  if (index < 0 || index > BC_DIM_MAX ||
-     (index == 0 && !bc_is_zero (ex_stack->s_num))) 
-    rt_error ("Array %s subscript out of bounds.", a_names[var_name]);
-  else
-    {
-      num_ptr = get_array_num (var_name, index);
-      if (num_ptr != NULL)
-	{
-	  pop ();
-	  bc_sub (*num_ptr, _one_, num_ptr, 0);
-	}
-    }
-}
-
-
-/* Increment VAR_NAME by one.  This includes the special variables
-   ibase, obase, and scale. */
-
-void
-incr_var (var_name)
-     int var_name;
-{
-  bc_var *var_ptr;
-
-  switch (var_name)
-    {
-
-    case 0: /* ibase */
-      if (i_base < 16)
-	i_base++;
-      else
-	rt_warn ("ibase too big in ++");
-      break;
-
-    case 1: /* obase */
-      if (o_base < BC_BASE_MAX)
-	o_base++;
-      else
-	rt_warn ("obase too big in ++");
-      break;
-
-    case 2:
-      if (scale < BC_SCALE_MAX)
-	scale++;
-      else
-	rt_warn ("Scale too big in ++");
-      break;
-
-#if defined(READLINE) || defined(LIBEDIT)
-    case 3: /* history */
-      n_history++;
-      if (n_history > 0)
-	HISTORY_SIZE(n_history);
-      else
-	{
-	  n_history = -1;
-	  rt_warn ("history set to unlimited");
-	  UNLIMIT_HISTORY;
-	}
-#endif
-
-    default:  /* It is a simple variable. */
-      var_ptr = get_var (var_name);
-      if (var_ptr != NULL)
-	bc_add (var_ptr->v_value, _one_, &var_ptr->v_value, 0);
-
-    }
-}
-
-
-/* Increment VAR_NAME by one.  VAR_NAME is an array and top of
-   execution stack is the index and is popped off the stack. */
-
-void
-incr_array (var_name)
-     int var_name;
-{
-  bc_num *num_ptr;
-  long   index;
-
-  if (!check_stack (1)) return;
-  index = bc_num2long (ex_stack->s_num);
-  if (index < 0 || index > BC_DIM_MAX ||
-      (index == 0 && !bc_is_zero (ex_stack->s_num))) 
-    rt_error ("Array %s subscript out of bounds.", a_names[var_name]);
-  else
-    {
-      num_ptr = get_array_num (var_name, index);
-      if (num_ptr != NULL)
-	{
-	  pop ();
-	  bc_add (*num_ptr, _one_, num_ptr, 0);
-	}
-    }
-}
-
-
-/* Routines for processing autos variables and parameters. */
-
-/* NAME is an auto variable that needs to be pushed on its stack. */
-
-void
-auto_var (name)
-     int name;
-{
-  bc_var *v_temp;
-  bc_var_array *a_temp;
-  int ix;
-
-  if (name > 0)
-    {
-      /* A simple variable. */
-      ix = name;
-      v_temp = (bc_var *) bc_malloc (sizeof (bc_var));
-      v_temp->v_next = va