1989-02-07 11:04:05 +00:00
|
|
|
/*
|
|
|
|
* (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
|
|
|
|
* See the copyright notice in the ACK home directory, in the file "Copyright".
|
|
|
|
*/
|
1994-06-27 08:03:14 +00:00
|
|
|
/* $Id$ */
|
1989-02-07 11:04:05 +00:00
|
|
|
/* COMPILER ARITHMETIC */
|
|
|
|
|
|
|
|
/* Normally the compiler does its internal arithmetics in longs
|
|
|
|
native to the source machine, which is always good for local
|
|
|
|
compilations, and generally OK too for cross compilations
|
|
|
|
downwards and sidewards. For upwards cross compilation and
|
|
|
|
to save storage on small machines, SPECIAL_ARITHMETICS will
|
|
|
|
be handy.
|
|
|
|
*/
|
2019-02-18 16:42:15 +00:00
|
|
|
#ifndef ARITH_H_
|
|
|
|
#define ARITH_H_
|
1989-02-07 11:04:05 +00:00
|
|
|
|
2013-05-12 19:45:55 +00:00
|
|
|
#include "parameters.h"
|
1989-02-07 11:04:05 +00:00
|
|
|
|
|
|
|
#ifndef SPECIAL_ARITHMETICS
|
|
|
|
|
2019-02-18 16:42:15 +00:00
|
|
|
#include <em_arith.h> /* obtain definition of "arith" */
|
|
|
|
#include <flt_arith.h>
|
1989-02-07 11:04:05 +00:00
|
|
|
|
1991-12-17 13:12:22 +00:00
|
|
|
#else /* SPECIAL_ARITHMETICS */
|
1989-02-07 11:04:05 +00:00
|
|
|
|
|
|
|
/* All preprocessor arithmetic should be done in longs.
|
|
|
|
*/
|
|
|
|
#define arith long /* dummy */
|
|
|
|
|
1991-12-17 13:12:22 +00:00
|
|
|
#endif /* SPECIAL_ARITHMETICS */
|
1989-09-19 16:13:23 +00:00
|
|
|
|
2019-02-18 16:42:15 +00:00
|
|
|
struct expr;
|
|
|
|
struct type;
|
|
|
|
|
1989-09-19 16:13:23 +00:00
|
|
|
#define arith_size (sizeof(arith))
|
|
|
|
#define arith_sign ((arith) 1 << (arith_size * 8 - 1))
|
|
|
|
#define max_arith (~arith_sign)
|
2019-02-18 16:42:15 +00:00
|
|
|
|
|
|
|
void arithbalance(register struct expr **e1p, int oper, register struct expr **e2p);
|
|
|
|
void relbalance(register struct expr **e1p, int oper, register struct expr **e2p);
|
|
|
|
void ch3pointer(struct expr **expp, int oper, register struct type *tp);
|
|
|
|
int any2arith(register struct expr **expp, register int oper);
|
|
|
|
void erroneous2int(struct expr **expp);
|
|
|
|
struct expr *arith2arith(struct type *tp, int oper, register struct expr *expr);
|
|
|
|
int int2int(struct expr **expp, register struct type *tp);
|
|
|
|
void int2float(register struct expr **expp, struct type *tp);
|
|
|
|
void float2int(struct expr **expp, struct type *tp);
|
|
|
|
void float2float(register struct expr **expp, struct type *tp);
|
|
|
|
void array2pointer(register struct expr *exp);
|
|
|
|
void function2pointer(register struct expr *exp);
|
|
|
|
void string2pointer(register struct expr *ex);
|
|
|
|
void opnd2integral(register struct expr **expp, int oper);
|
|
|
|
void opnd2logical(register struct expr **expp, int oper);
|
|
|
|
void opnd2test(register struct expr **expp, int oper);
|
|
|
|
void any2opnd(register struct expr **expp, int oper);
|
|
|
|
void any2parameter(register struct expr **expp);
|
|
|
|
void field2arith(register struct expr **expp);
|
|
|
|
void switch_sign_fp(register struct expr *expr);
|
|
|
|
|
|
|
|
#endif /* ARITH_H_ */
|