-/* A C++ error reporting function. */
-void
-AT_NAME_PREFIX::parser::error (const location_type& l, const std::string& m)
-{
- (void) l;
- std::cerr << AT_LOCATION_IF([l << ": " << ])m << std::endl;
-}
-
-/* A C++ yyparse that simulates the C signature. */
-int
-yyparse (AT_PARAM_IF([semantic_value *result, int *count]))
-{
- AT_NAME_PREFIX::parser parser[]AT_PARAM_IF([ (result, count)]);
-#if YYDEBUG
- parser.set_debug_level (1);
-#endif
- return parser.parse ();
-}
-],
-[/* A C error reporting function. */
-static void
-yyerror (AT_YYERROR_ARG_LOC_IF([YYLTYPE *llocp, ])
- AT_PARAM_IF([semantic_value *result, int *count, ])
- const char *s)
-{
-AT_PARAM_IF([(void) result; (void) count;])
-AT_YYERROR_SEES_LOC_IF([
- fprintf (stderr, "%d.%d",
- AT_LOC_FIRST_LINE, AT_LOC_FIRST_COLUMN);
- if (AT_LOC_FIRST_LINE != AT_LOC_LAST_LINE)
- fprintf (stderr, "-%d.%d",
- AT_LOC_LAST_LINE, AT_LOC_LAST_COLUMN - 1);
- else if (AT_LOC_FIRST_COLUMN != AT_LOC_LAST_COLUMN - 1)
- fprintf (stderr, "-%d",
- AT_LOC_LAST_COLUMN - 1);
- fprintf (stderr, ": ");])
- fprintf (stderr, "%s\n", s);
-}])[
-
-]AT_DEFINES_IF(, [AT_CALC_LEX])[
-
-static int
-power (int base, int exponent)
-{
- int res = 1;
- if (exponent < 0)
- exit (3);
- for (/* Niente */; exponent; --exponent)
- res *= base;
- return res;
-}
-
-
-/* A C main function. */
-int
-main (int argc, const char **argv)
-{
- semantic_value result = 0;
- int count = 0;
- int status;
-
- /* This used to be alarm (10), but that isn't enough time for
- a July 1995 vintage DEC Alphastation 200 4/100 system,
- according to Nelson H. F. Beebe. 100 seconds is enough. */
- alarm (100);
-
- if (argc == 2)
- input = fopen (argv[1], "r");
- else
- input = stdin;
-
- if (!input)
- {
- perror (argv[1]);
- return 3;
- }
-
-]AT_SKEL_CC_IF([], [m4_bmatch([$4], [%debug],
-[ yydebug = 1;])])[
- status = yyparse (]AT_PARAM_IF([[&result, &count]])[);
- if (fclose (input))
- perror ("fclose");
- if (global_result != result)
- abort ();
- if (global_count != count)
- abort ();
- return status;
-}
-]])