yanera_postfix.h

Go to the documentation of this file.
00001 /*==============================================================================
00002 Copyright 2006 Thad Harroun, Kevin Yager
00003 
00004 This file is part of "yanera 2.0".
00005 
00006 "yanera 2.0" is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.
00007 
00008 "yanera 2.0" is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
00009 
00010 You should have received a copy of the GNU General Public License along with "yanera 2.0"; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 
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   MISC
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   NUMBER_STRING
00111 ==============================================================================*/
00112 void append_number_string(char c);
00113 void stop_number_string(yanera_postfix *pq);
00114 /*==============================================================================
00115  POSTFIX_QUEUE
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  OPERATOR_STACK
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   EVALUATION_STACK
00137 ==============================================================================*/
00138 void initizlize_evaluation_stack(void);
00139 void push_evaluation_stack(double d);
00140 double pop_evaluation_stack(void);
00141 
00142 

Generated on Thu May 29 10:56:33 2008 by  doxygen 1.5.5