@group
%@{
#include <stdio.h> /* For printf, etc. */
+ #include <math.h> /* For pow, used in the grammar. */
#include "calc.h" /* Contains definition of `symrec'. */
int yylex (void);
void yyerror (char const *);
@end group
@group
-#include <math.h> /* Math functions, cos(), sin(), etc. */
struct init const arith_fncts[] =
@{
@{ "atan", atan @},
else if (!(yyin = fopen (file.c_str (), "r")))
@{
error (std::string ("cannot open ") + file + ": " + strerror(errno));
- exit (1);
+ exit (EXIT_FAILURE);
@}
@}
{
yyin = fopen (file, "r");
if (!yyin)
- exit (2);
+ {
+ perror ("fopen");
+ exit (EXIT_FAILURE);
+ }
/* One token only. */
yylex ();
if (fclose (yyin) != 0)
- exit (3);
+ {
+ perror ("fclose");
+ exit (EXIT_FAILURE);
+ }
return 0;
}