run GNU protoize
protect header files nuke some dead code regenerate configure script let silly code die
This commit is contained in:
45
expr.c
45
expr.c
@ -1,4 +1,4 @@
|
||||
/** $MirBSD: expr.c,v 1.6 2004/10/28 11:11:18 tg Exp $ */
|
||||
/** $MirBSD: expr.c,v 1.7 2004/10/28 11:53:41 tg Exp $ */
|
||||
/* $OpenBSD: expr.c,v 1.9 2003/10/22 07:40:38 jmc Exp $ */
|
||||
|
||||
/*
|
||||
@ -8,7 +8,7 @@
|
||||
#include "sh.h"
|
||||
#include <ctype.h>
|
||||
|
||||
__RCSID("$MirBSD: expr.c,v 1.6 2004/10/28 11:11:18 tg Exp $");
|
||||
__RCSID("$MirBSD: expr.c,v 1.7 2004/10/28 11:53:41 tg Exp $");
|
||||
|
||||
/* The order of these enums is constrained by the order of opinfo[] */
|
||||
enum token {
|
||||
@ -142,10 +142,7 @@ static struct tbl *intvar(Expr_state *es, struct tbl *vp);
|
||||
* parse and evaluate expression
|
||||
*/
|
||||
int
|
||||
evaluate(expr, rval, error_ok)
|
||||
const char *expr;
|
||||
long *rval;
|
||||
int error_ok;
|
||||
evaluate(const char *expr, long int *rval, int error_ok)
|
||||
{
|
||||
struct tbl v;
|
||||
int ret;
|
||||
@ -161,10 +158,7 @@ evaluate(expr, rval, error_ok)
|
||||
* parse and evaluate expression, storing result in vp.
|
||||
*/
|
||||
int
|
||||
v_evaluate(vp, expr, error_ok)
|
||||
struct tbl *vp;
|
||||
const char *expr;
|
||||
volatile int error_ok;
|
||||
v_evaluate(struct tbl *vp, const char *expr, volatile int error_ok)
|
||||
{
|
||||
struct tbl *v;
|
||||
Expr_state curstate;
|
||||
@ -193,12 +187,10 @@ v_evaluate(vp, expr, error_ok)
|
||||
}
|
||||
|
||||
token(es);
|
||||
#if 1 /* ifdef-out to disallow empty expressions to be treated as 0 */
|
||||
if (es->tok == END) {
|
||||
es->tok = LIT;
|
||||
es->val = tempvar();
|
||||
}
|
||||
#endif /* 0 */
|
||||
v = intvar(es, evalexpr(es, MAX_PREC));
|
||||
|
||||
if (es->tok != END)
|
||||
@ -216,10 +208,7 @@ v_evaluate(vp, expr, error_ok)
|
||||
}
|
||||
|
||||
static void
|
||||
evalerr(es, type, str)
|
||||
Expr_state *es;
|
||||
enum error_type type;
|
||||
const char *str;
|
||||
evalerr(Expr_state *es, enum error_type type, const char *str)
|
||||
{
|
||||
char tbuf[2];
|
||||
const char *s;
|
||||
@ -275,9 +264,7 @@ evalerr(es, type, str)
|
||||
}
|
||||
|
||||
static struct tbl *
|
||||
evalexpr(es, prec)
|
||||
Expr_state *es;
|
||||
enum prec prec;
|
||||
evalexpr(Expr_state *es, enum prec prec)
|
||||
{
|
||||
struct tbl *vl, UNINITIALIZED(*vr), *vasn;
|
||||
enum token op;
|
||||
@ -456,8 +443,7 @@ evalexpr(es, prec)
|
||||
}
|
||||
|
||||
static void
|
||||
token(es)
|
||||
Expr_state *es;
|
||||
token(Expr_state *es)
|
||||
{
|
||||
const char *cp;
|
||||
int c;
|
||||
@ -530,11 +516,7 @@ token(es)
|
||||
|
||||
/* Do a ++ or -- operation */
|
||||
static struct tbl *
|
||||
do_ppmm(es, op, vasn, is_prefix)
|
||||
Expr_state *es;
|
||||
enum token op;
|
||||
struct tbl *vasn;
|
||||
bool_t is_prefix;
|
||||
do_ppmm(Expr_state *es, enum token op, struct tbl *vasn, bool_t is_prefix)
|
||||
{
|
||||
struct tbl *vl;
|
||||
int oval;
|
||||
@ -554,10 +536,7 @@ do_ppmm(es, op, vasn, is_prefix)
|
||||
}
|
||||
|
||||
static void
|
||||
assign_check(es, op, vasn)
|
||||
Expr_state *es;
|
||||
enum token op;
|
||||
struct tbl *vasn;
|
||||
assign_check(Expr_state *es, enum token op, struct tbl *vasn)
|
||||
{
|
||||
if (vasn->name[0] == '\0' && !(vasn->flag & EXPRLVALUE))
|
||||
evalerr(es, ET_LVALUE, opinfo[(int) op].name);
|
||||
@ -566,7 +545,7 @@ assign_check(es, op, vasn)
|
||||
}
|
||||
|
||||
static struct tbl *
|
||||
tempvar()
|
||||
tempvar(void)
|
||||
{
|
||||
struct tbl *vp;
|
||||
|
||||
@ -581,9 +560,7 @@ tempvar()
|
||||
|
||||
/* cast (string) variable to temporary integer variable */
|
||||
static struct tbl *
|
||||
intvar(es, vp)
|
||||
Expr_state *es;
|
||||
struct tbl *vp;
|
||||
intvar(Expr_state *es, struct tbl *vp)
|
||||
{
|
||||
struct tbl *vq;
|
||||
|
||||
|
Reference in New Issue
Block a user