#include <ctype.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
|
enum | {
HALT,
ADD,
SUB,
MULT,
DIV,
AND,
OR,
GT,
GE,
EQ,
NE,
LT,
LE,
NEG,
NOT,
CONST,
VAR,
ABS,
FLOOR,
SIN,
COS,
TAN,
ASIN,
ACOS,
ATAN,
PITOK,
DEGRAD,
RADDEG,
LOG,
LOG10,
EXP,
SQRT,
POW,
ATAN2
} |
|
|
static int | precedence [] = { 0, 5, 5, 6, 6, 2, 1, 4, 4, 3, 3, 4, 4 } |
|
static double | stack [MAX_STACK] |
|
static double * | sp |
|
static int | program [MAX_PROG] |
|
static int * | pc |
|
static Var | vars [MAX_OPX] |
|
static int | nvars |
|
static double | consts [MAX_OPX] |
|
static int | nconsts |
|
static int | parens_nest |
|
static char * | err_msg |
|
static char * | cexpr |
|
static char * | lcexpr |
|
◆ COMMA
◆ ERR
◆ LPAREN
◆ MAX_OPX
#define MAX_OPX 64 /* max number of operands */ |
◆ MAX_PROG
◆ MAX_STACK
◆ MAXFLDLEN
#define MAXFLDLEN 64 /* longest allowed operand name */ |
◆ OP_MASK
◆ OP_SHIFT
◆ RPAREN
◆ UNI_PREC
#define UNI_PREC 7 /* unary ops have highest precedence */ |
◆ anonymous enum
Enumerator |
---|
HALT | |
ADD | |
SUB | |
MULT | |
DIV | |
AND | |
OR | |
GT | |
GE | |
EQ | |
NE | |
LT | |
LE | |
NEG | |
NOT | |
CONST | |
VAR | |
ABS | |
FLOOR | |
SIN | |
COS | |
TAN | |
ASIN | |
ACOS | |
ATAN | |
PITOK | |
DEGRAD | |
RADDEG | |
LOG | |
LOG10 | |
EXP | |
SQRT | |
POW | |
ATAN2 | |
◆ allOperandsSet()
◆ chk_funcs()
static int chk_funcs |
( |
void |
| ) |
|
|
static |
◆ compile()
static int compile |
( |
int |
prec | ) |
|
|
static |
◆ compileExpr()
int compileExpr |
( |
char * |
exp, |
|
|
char * |
errbuf |
|
) |
| |
◆ compiler_log()
void compiler_log |
( |
char * |
name, |
|
|
double |
value |
|
) |
| |
◆ evalExpr()
int evalExpr |
( |
double * |
vp, |
|
|
char * |
errbuf |
|
) |
| |
◆ execute()
static int execute |
( |
double * |
result | ) |
|
|
static |
◆ getAllOperands()
int getAllOperands |
( |
char *** |
ops | ) |
|
◆ getSetOperands()
int getSetOperands |
( |
char *** |
ops | ) |
|
◆ getUnsetOperands()
int getUnsetOperands |
( |
char *** |
ops | ) |
|
◆ next_token()
static int next_token |
( |
void |
| ) |
|
|
static |
◆ parse_fieldname() [1/2]
static int parse_fieldname |
( |
char |
name[], |
|
|
int |
len |
|
) |
| |
|
static |
◆ parse_fieldname() [2/2]
static int parse_fieldname |
( |
name |
, |
|
|
int |
len |
|
) |
| |
|
static |
◆ setOperand()
int setOperand |
( |
char * |
name, |
|
|
double |
valu |
|
) |
| |
◆ skip_double()
static void skip_double |
( |
void |
| ) |
|
|
static |
◆ cexpr
◆ consts
◆ err_msg
◆ lcexpr
◆ nconsts
◆ nvars
◆ parens_nest
◆ pc
◆ precedence
int precedence[] = { 0, 5, 5, 6, 6, 2, 1, 4, 4, 3, 3, 4, 4 } |
|
static |
◆ program
◆ sp
◆ stack
◆ vars