[Gmp-commit] /var/hg/gmp: Remove generated file from repo.

mercurial at gmplib.org mercurial at gmplib.org
Sat Dec 29 13:27:06 CET 2012


details:   /var/hg/gmp/rev/986d7f6dab98
changeset: 15220:986d7f6dab98
user:      Torbjorn Granlund <tege at gmplib.org>
date:      Sat Dec 29 13:26:56 2012 +0100
description:
Remove generated file from repo.

diffstat:

 ChangeLog            |     6 +
 demos/calc/calc.c    |  1656 ------------------------------------------------
 demos/calc/calc.h    |    43 -
 demos/calc/calclex.c |  1704 --------------------------------------------------
 4 files changed, 6 insertions(+), 3403 deletions(-)

diffs (truncated from 3428 to 300 lines):

diff -r 6760e00f9a70 -r 986d7f6dab98 ChangeLog
--- a/ChangeLog	Thu Dec 27 17:32:08 2012 +0100
+++ b/ChangeLog	Sat Dec 29 13:26:56 2012 +0100
@@ -1,3 +1,9 @@
+2012-12-29  Torbjorn Granlund  <tege at gmplib.org>
+
+	* demos/calc/calc.c: Remove generated file from repo.
+	* demos/calc/calc.h: Likewise.
+	* demos/calc/calclex.c: Likewise.
+
 2012-12-27  Torbjorn Granlund  <tege at gmplib.org>
 
 	* mpn/generic/get_d.c: Complete rewrite of non-IEEE code.
diff -r 6760e00f9a70 -r 986d7f6dab98 demos/calc/calc.c
--- a/demos/calc/calc.c	Thu Dec 27 17:32:08 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1656 +0,0 @@
-/* A Bison parser, made from calc.y
-   by GNU bison 1.34.  */
-
-#define YYBISON 1  /* Identify Bison output.  */
-
-# define	EOS	257
-# define	BAD	258
-# define	HELP	259
-# define	HEX	260
-# define	DECIMAL	261
-# define	QUIT	262
-# define	ABS	263
-# define	BIN	264
-# define	FIB	265
-# define	GCD	266
-# define	KRON	267
-# define	LCM	268
-# define	LUCNUM	269
-# define	NEXTPRIME	270
-# define	POWM	271
-# define	ROOT	272
-# define	SQRT	273
-# define	NUMBER	274
-# define	VARIABLE	275
-# define	LOR	276
-# define	LAND	277
-# define	EQ	278
-# define	NE	279
-# define	LE	280
-# define	GE	281
-# define	LSHIFT	282
-# define	RSHIFT	283
-# define	UMINUS	284
-
-#line 1 "calc.y"
-
-/* A simple integer desk calculator using yacc and gmp.
-
-Copyright 2000, 2001, 2002 Free Software Foundation, Inc.
-
-This file is part of the GNU MP Library.
-
-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 3 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.  If not, see http://www.gnu.org/licenses/.  */
-
-
-/* This is a simple program, meant only to show one way to use GMP for this
-   sort of thing.  There's few features, and error checking is minimal.
-   Standard input is read, calc_help() below shows the inputs accepted.
-
-   Expressions are evaluated as they're read.  If user defined functions
-   were wanted it'd be necessary to build a parse tree like pexpr.c does, or
-   a list of operations for a stack based evaluator.  That would also make
-   it possible to detect and optimize evaluations "mod m" like pexpr.c does.
-
-   A stack is used for intermediate values in the expression evaluation,
-   separate from the yacc parser stack.  This is simple, makes error
-   recovery easy, minimizes the junk around mpz calls in the rules, and
-   saves initializing or clearing "mpz_t"s during a calculation.  A
-   disadvantage though is that variables must be copied to the stack to be
-   worked on.  A more sophisticated calculator or language system might be
-   able to avoid that when executing a compiled or semi-compiled form.
-
-   Avoiding repeated initializing and clearing of "mpz_t"s is important.  In
-   this program the time spent parsing is obviously much greater than any
-   possible saving from this, but a proper calculator or language should
-   take some trouble over it.  Don't be surprised if an init/clear takes 3
-   or more times as long as a 10 limb addition, depending on the system (see
-   the mpz_init_realloc_clear example in tune/README).  */
-
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include "gmp.h"
-#define NO_CALC_H /* because it conflicts with normal calc.c stuff */
-#include "calc-common.h"
-
-
-#define numberof(x)  (sizeof (x) / sizeof ((x)[0]))
-
-
-void
-calc_help (void)
-{
-  printf ("Examples:\n");
-  printf ("    2+3*4        expressions are evaluated\n");
-  printf ("    x=5^6        variables a to z can be set and used\n");
-  printf ("Operators:\n");
-  printf ("    + - *        arithmetic\n");
-  printf ("    / %%          division and remainder (rounding towards negative infinity)\n");
-  printf ("    ^            exponentiation\n");
-  printf ("    !            factorial\n");
-  printf ("    << >>        left and right shifts\n");
-  printf ("    <= >= >      \\ comparisons, giving 1 if true, 0 if false\n");
-  printf ("    == != <      /\n");
-  printf ("    && ||        logical and/or, giving 1 if true, 0 if false\n");
-  printf ("Functions:\n");
-  printf ("    abs(n)       absolute value\n");
-  printf ("    bin(n,m)     binomial coefficient\n");
-  printf ("    fib(n)       fibonacci number\n");
-  printf ("    gcd(a,b,..)  greatest common divisor\n");
-  printf ("    kron(a,b)    kronecker symbol\n");
-  printf ("    lcm(a,b,..)  least common multiple\n");
-  printf ("    lucnum(n)    lucas number\n");
-  printf ("    nextprime(n) next prime after n\n");
-  printf ("    powm(b,e,m)  modulo powering, b^e%%m\n");
-  printf ("    root(n,r)    r-th root\n");
-  printf ("    sqrt(n)      square root\n");
-  printf ("Other:\n");
-  printf ("    hex          \\ set hex or decimal for input and output\n");
-  printf ("    decimal      /   (\"0x\" can be used for hex too)\n");
-  printf ("    quit         exit program (EOF works too)\n");
-  printf ("    ;            statements are separated with a ; or newline\n");
-  printf ("    \\            continue expressions with \\ before newline\n");
-  printf ("    # xxx        comments are # though to newline\n");
-  printf ("Hex numbers must be entered in upper case, to distinguish them from the\n");
-  printf ("variables a to f (like in bc).\n");
-}
-
-
-int  ibase = 0;
-int  obase = 10;
-
-
-/* The stack is a fixed size, which means there's a limit on the nesting
-   allowed in expressions.  A more sophisticated program could let it grow
-   dynamically.  */
-
-mpz_t    stack[100];
-mpz_ptr  sp = stack[0];
-
-#define CHECK_OVERFLOW()                                                  \
-  if (sp >= stack[numberof(stack)])                                       \
-    {                                                                     \
-      fprintf (stderr,                                                    \
-	       "Value stack overflow, too much nesting in expression\n"); \
-      YYERROR;                                                            \
-    }
-
-#define CHECK_EMPTY()                                                   \
-  if (sp != stack[0])                                                   \
-    {                                                                   \
-      fprintf (stderr, "Oops, expected the value stack to be empty\n"); \
-      sp = stack[0];                                                    \
-    }
-
-
-mpz_t  variable[26];
-
-#define CHECK_VARIABLE(var)                                             \
-  if ((var) < 0 || (var) >= numberof (variable))                        \
-    {                                                                   \
-      fprintf (stderr, "Oops, bad variable somehow: %d\n", var);        \
-      YYERROR;                                                          \
-    }
-
-
-#define CHECK_UI(name,z)                        \
-  if (! mpz_fits_ulong_p (z))                   \
-    {                                           \
-      fprintf (stderr, "%s too big\n", name);   \
-      YYERROR;                                  \
-    }
-
-
-#line 143 "calc.y"
-#ifndef YYSTYPE
-typedef union {
-  char  *str;
-  int   var;
-} yystype;
-# define YYSTYPE yystype
-#endif
-#ifndef YYDEBUG
-# define YYDEBUG 0
-#endif
-
-
-
-#define	YYFINAL		118
-#define	YYFLAG		-32768
-#define	YYNTBASE	44
-
-/* YYTRANSLATE(YYLEX) -- Bison token number corresponding to YYLEX. */
-#define YYTRANSLATE(x) ((unsigned)(x) <= 284 ? yytranslate[x] : 50)
-
-/* YYTRANSLATE[YYLEX] -- Bison token number corresponding to YYLEX. */
-static const char yytranslate[] =
-{
-       0,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,    39,     2,     2,     2,    36,     2,     2,
-      41,    42,    34,    32,    43,    33,     2,    35,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-      24,    40,    25,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,    38,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     1,     3,     4,     5,
-       6,     7,     8,     9,    10,    11,    12,    13,    14,    15,
-      16,    17,    18,    19,    20,    21,    22,    23,    26,    27,
-      28,    29,    30,    31,    37
-};
-
-#if YYDEBUG
-static const short yyprhs[] =
-{
-       0,     0,     2,     5,     8,    12,    15,    16,    18,    22,
-      24,    26,    28,    30,    34,    38,    42,    46,    50,    54,
-      58,    62,    66,    69,    72,    76,    80,    84,    88,    92,
-      96,   100,   104,   109,   116,   121,   126,   133,   138,   143,
-     148,   157,   164,   169,   171,   173,   175,   179,   181
-};
-static const short yyrhs[] =
-{
-      46,     0,    45,    46,     0,    46,     3,     0,    45,    46,
-       3,     0,     1,     3,     0,     0,    47,     0,    21,    40,
-      47,     0,     5,     0,     6,     0,     7,     0,     8,     0,
-      41,    47,    42,     0,    47,    32,    47,     0,    47,    33,
-      47,     0,    47,    34,    47,     0,    47,    35,    47,     0,
-      47,    36,    47,     0,    47,    38,    47,     0,    47,    30,
-      47,     0,    47,    31,    47,     0,    47,    39,     0,    33,
-      47,     0,    47,    24,    47,     0,    47,    28,    47,     0,
-      47,    26,    47,     0,    47,    27,    47,     0,    47,    29,
-      47,     0,    47,    25,    47,     0,    47,    23,    47,     0,
-      47,    22,    47,     0,     9,    41,    47,    42,     0,    10,
-      41,    47,    43,    47,    42,     0,    11,    41,    47,    42,
-       0,    12,    41,    48,    42,     0,    13,    41,    47,    43,
-      47,    42,     0,    14,    41,    49,    42,     0,    15,    41,
-      47,    42,     0,    16,    41,    47,    42,     0,    17,    41,
-      47,    43,    47,    43,    47,    42,     0,    18,    41,    47,
-      43,    47,    42,     0,    19,    41,    47,    42,     0,    21,
-       0,    20,     0,    47,     0,    48,    43,    47,     0,    47,
-       0,    49,    43,    47,     0
-};
-
-#endif
-
-#if YYDEBUG
-/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
-static const short yyrline[] =
-{
-       0,   167,   169,   171,   173,   174,   176,   178,   183,   189,
-     190,   191,   192,   197,   199,   200,   201,   202,   203,   204,
-     206,   208,   210,   212,   214,   215,   216,   217,   218,   219,
-     221,   222,   224,   225,   227,   229,   230,   232,   233,   235,
-     236,   237,   239,   241,   247,   257,   259,   261,   263
-};
-#endif
-
-
-#if (YYDEBUG) || defined YYERROR_VERBOSE
-
-/* YYTNAME[TOKEN_NUM] -- String name of the token TOKEN_NUM. */
-static const char *const yytname[] =
-{
-  "$", "error", "$undefined.", "EOS", "BAD", "HELP", "HEX", "DECIMAL",


More information about the gmp-commit mailing list