00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00032 enum operator_type{
00033 NONE,
00034 NUMBER,
00035 ORDINATE,
00036 PARAMETER,
00037 OPERATOR_MULTADD,
00038 OPERATOR_POWER,
00039 OPERATOR_UNARY,
00040 OPERATOR_FUNCTION,
00041 PARENTHESIS_OPEN,
00042 PARENTHESIS_CLOSE
00043 };
00044
00049 char *number_string;
00050
00056 struct evaluation_stack_element {
00057 double d;
00058 struct evaluation_stack_element *next;
00059 };
00065 struct evaluation_stack {
00066 unsigned short n;
00067 struct evaluation_stack_element *top;
00068 };
00074 struct evaluation_stack evaluation_stack;
00075
00082 struct operator_stack_element {
00083 short prec;
00084 enum operator_type type;
00085 char oper[4];
00086 struct operator_stack_element *next;
00087 };
00094 struct operator_stack {
00095 unsigned short n;
00096 struct operator_stack_element *top;
00097 };
00101 struct operator_stack operator_stack;
00102
00103
00104
00105 short parmindex(char c, char *parm_name);
00106 void parse_expression(yanera_postfix *pq, \
00107 char *expression, char *parm_name, short *parm);
00108 void parameter_decision(yanera_postfix *pq, const char c[4], short indx);
00109
00110
00111
00112 void append_number_string(char c);
00113 void stop_number_string(yanera_postfix *pq);
00114
00115
00116
00117 yanera_postfix *initizlize_postfix_queue(void);
00118 void enqueue_postfix_queue(yanera_postfix *pq, \
00119 const char *c, double d, short indx, short type);
00120 void print_postfix(yanera_postfix *pq, double x, double *params);
00121 double evaluate_postfix(yanera_postfix *pq, double z, double *params);
00122 void free_postfix_queue(yanera_postfix *pq);
00123
00124
00125
00126 void initizlize_operator_stack(void);
00127 struct operator_stack_element *operator_stack_element_new( \
00128 const char *oper, short prec,short type);
00129 void push_operator_stack(struct operator_stack_element *o);
00130 struct operator_stack_element *pop_operator_stack(void);
00131 short operator_stack_is_empty(void);
00132 short operator_stack_top_precedence(void);
00133 void operator_decision(yanera_postfix *pq, \
00134 const char oper[4], short prec, short type);
00135
00136
00137
00138 void initizlize_evaluation_stack(void);
00139 void push_evaluation_stack(double d);
00140 double pop_evaluation_stack(void);
00141
00142