|
Packit |
5c3484 |
Copyright 2001 Free Software Foundation, Inc.
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
This file is part of the GNU MP Library.
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
This program is free software; you can redistribute it and/or modify it under
|
|
Packit |
5c3484 |
the terms of the GNU General Public License as published by the Free Software
|
|
Packit |
5c3484 |
Foundation; either version 3 of the License, or (at your option) any later
|
|
Packit |
5c3484 |
version.
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
This program is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
Packit |
5c3484 |
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
|
Packit |
5c3484 |
PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
You should have received a copy of the GNU General Public License along with
|
|
Packit |
5c3484 |
this program. If not, see https://www.gnu.org/licenses/.
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
DEMONSTRATION CALCULATOR PROGRAM
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
This is a simple program, meant only to show one way to use GMP with yacc
|
|
Packit |
5c3484 |
and lex to make a calculator. Usage and comments on the implementation can
|
|
Packit |
5c3484 |
be found in calc.y.
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
Within a GMP build tree, the generated Makefile can be used to build the
|
|
Packit |
5c3484 |
program,
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
make calc
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
(or on a DOS system, "make calc.exe").
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
Elsewhere, once GMP has been installed, the program can be compiled with for
|
|
Packit |
5c3484 |
instance
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
gcc calc.c calclex.c -lgmp -o calc
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
Or if GNU readline is used then
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
gcc calc.c calclex.c calcread.c -lgmp -lreadline -o calc
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
(again, on a DOS system "-o calc.exe").
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
Readline support can be enabled or disabled in calc-config.h. That file is
|
|
Packit |
5c3484 |
created by the GMP ./configure based on the --with-readline option. The
|
|
Packit |
5c3484 |
default is --with-readline=detect, which means to use readline if available.
|
|
Packit |
5c3484 |
"yes" can be used to force it to be used, or "no" to not use it.
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
The supplied calc.c was generated by GNU bison, but a standard yacc should
|
|
Packit |
5c3484 |
work too.
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
The supplied calclex.c was generated by GNU flex, but a standard lex should
|
|
Packit |
5c3484 |
work too. The readline support may or may not work with a standard lex (see
|
|
Packit |
5c3484 |
comments with input() in calcread.c). Note also that a standard lex will
|
|
Packit |
5c3484 |
require its library "-ll" on the compile command line. "./configure" sets
|
|
Packit |
5c3484 |
this up in the GMP build tree Makefile.
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
|
|
Packit |
5c3484 |
----------------
|
|
Packit |
5c3484 |
Local variables:
|
|
Packit |
5c3484 |
mode: text
|
|
Packit |
5c3484 |
fill-column: 76
|
|
Packit |
5c3484 |
End:
|