1*4afad3d8SPeter Avalos /* $OpenBSD: expr.c,v 1.18 2010/09/07 19:58:09 marco Exp $ */
2984263bcSMatthew Dillon /*
3*4afad3d8SPeter Avalos * Copyright (c) 2004 Marc Espie <espie@cvs.openbsd.org>
4984263bcSMatthew Dillon *
5*4afad3d8SPeter Avalos * Permission to use, copy, modify, and distribute this software for any
6*4afad3d8SPeter Avalos * purpose with or without fee is hereby granted, provided that the above
7*4afad3d8SPeter Avalos * copyright notice and this permission notice appear in all copies.
8984263bcSMatthew Dillon *
9*4afad3d8SPeter Avalos * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10*4afad3d8SPeter Avalos * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11*4afad3d8SPeter Avalos * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12*4afad3d8SPeter Avalos * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13*4afad3d8SPeter Avalos * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14*4afad3d8SPeter Avalos * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15*4afad3d8SPeter Avalos * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16984263bcSMatthew Dillon *
17*4afad3d8SPeter Avalos * $FreeBSD: src/usr.bin/m4/expr.c,v 1.19 2012/11/17 01:54:24 svnexp Exp $
18984263bcSMatthew Dillon */
19984263bcSMatthew Dillon
20*4afad3d8SPeter Avalos #include <stdint.h>
21984263bcSMatthew Dillon #include <stdio.h>
22*4afad3d8SPeter Avalos #include <stddef.h>
23984263bcSMatthew Dillon #include "mdef.h"
24984263bcSMatthew Dillon #include "extern.h"
25984263bcSMatthew Dillon
26*4afad3d8SPeter Avalos int32_t end_result;
27*4afad3d8SPeter Avalos static const char *copy_toeval;
28*4afad3d8SPeter Avalos int yyerror(const char *msg);
29984263bcSMatthew Dillon
30*4afad3d8SPeter Avalos extern void yy_scan_string(const char *);
31*4afad3d8SPeter Avalos extern int yyparse(void);
32984263bcSMatthew Dillon
33984263bcSMatthew Dillon int
yyerror(const char * msg)34*4afad3d8SPeter Avalos yyerror(const char *msg)
35984263bcSMatthew Dillon {
36*4afad3d8SPeter Avalos fprintf(stderr, "m4: %s in expr %s\n", msg, copy_toeval);
37*4afad3d8SPeter Avalos return(0);
38984263bcSMatthew Dillon }
39984263bcSMatthew Dillon
40*4afad3d8SPeter Avalos int
expr(const char * toeval)41*4afad3d8SPeter Avalos expr(const char *toeval)
42