Doxygen Source Code Documentation
parser.h File Reference
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
#include <ctype.h>
#include "f2c.h"
Go to the source code of this file.
Data Structures | |
struct | PARSER_code |
Defines | |
#define | MAX_PARCODE 9999 |
Functions | |
void | PARSER_set_printout (int) |
PARSER_code * | PARSER_generate_code (char *) |
double | PARSER_evaluate_one (PARSER_code *, double atoz[]) |
void | PARSER_evaluate_vector (PARSER_code *pc, double *atoz[], int nv, double vout[]) |
int | PARSER_has_symbol (char *sym, PARSER_code *pc) |
void | PARSER_mark_symbols (PARSER_code *pc, int *sl) |
int | PARSER_1deval (char *, int, float, float, float *) |
Define Documentation
|
|
Function Documentation
|
Definition at line 170 of file parser_int.c. References dt, free, PARSER_evaluate_one(), PARSER_generate_code(), PARSER_has_symbol(), and vec.
00171 { 00172 PARSER_code * pcode = NULL ; 00173 char sym[4] ; 00174 double atoz[26] ; 00175 int ii , kvar ; 00176 00177 if( expr == NULL || nt <= 0 || vec == NULL ) return 0 ; /* bad */ 00178 00179 pcode = PARSER_generate_code( expr ) ; /* compile */ 00180 if( pcode == NULL ) return 0 ; /* bad news */ 00181 00182 kvar = -1 ; /* find symbol */ 00183 for( ii=0 ; ii < 26 ; ii++ ){ 00184 sym[0] = 'A' + ii ; sym[1] = '\0' ; 00185 if( PARSER_has_symbol(sym,pcode) ){ kvar = ii ; break ; } 00186 } 00187 00188 for( ii=0 ; ii < 26 ; ii++ ) atoz[ii] = 0.0 ; /* initialize */ 00189 00190 if( kvar >= 0 ){ /* the normal case */ 00191 for( ii=0 ; ii < nt ; ii++ ){ 00192 atoz[kvar] = tz + ii*dt ; 00193 vec[ii] = PARSER_evaluate_one( pcode , atoz ) ; 00194 } 00195 } else { /* no variable found! */ 00196 vec[0] = PARSER_evaluate_one( pcode , atoz ) ; 00197 for( ii=1 ; ii < nt ; ii++ ) vec[ii] = vec[0] ; 00198 } 00199 00200 free(pcode) ; return 1 ; 00201 } |
|
Definition at line 65 of file parser_int.c. References PARSER_code::c_code, PARSER_code::num_code, and pareval_(). Referenced by basis_expr(), DT_read_opts(), EDIT_filter_volume(), F1D_chainfunc(), main(), MRG_read_opts(), PARSER_1deval(), PARSER_strtod(), RCREND_evaluate(), REND_evaluate(), RT_registration_3D_onevol(), set_node_list_data(), and waveform_EXPR().
00066 { 00067 integer num_code ; 00068 double value ; 00069 00070 if( pc == NULL || pc->num_code <= 0 ) return 0.0 ; 00071 00072 num_code = (integer) pc->num_code ; 00073 00074 value = (double) pareval_( &num_code, pc->c_code, 00075 (doublereal *) atoz , (ftnlen) 8 ) ; 00076 return value ; 00077 } |
|
Definition at line 129 of file parser_int.c. References PARSER_code::c_code, PARSER_code::num_code, and parevec_(). Referenced by EDT_calcmask(), EXP0D_worker(), F2D_chainfunc(), main(), RCREND_cutout_blobs(), and REND_cutout_blobs().
00131 { 00132 integer num_code , nvar , ivar , lvec , ldvec ; 00133 00134 if( pc == NULL || pc->num_code <= 0 ) return ; 00135 00136 num_code = (integer) pc->num_code ; 00137 lvec = (integer) nv ; 00138 00139 parevec_( &num_code , pc->c_code , 00140 (doublereal *) atoz[0] , (doublereal *) atoz[1] , 00141 (doublereal *) atoz[2] , (doublereal *) atoz[3] , 00142 (doublereal *) atoz[4] , (doublereal *) atoz[5] , 00143 (doublereal *) atoz[6] , (doublereal *) atoz[7] , 00144 (doublereal *) atoz[8] , (doublereal *) atoz[9] , 00145 (doublereal *) atoz[10] , (doublereal *) atoz[11] , 00146 (doublereal *) atoz[12] , (doublereal *) atoz[13] , 00147 (doublereal *) atoz[14] , (doublereal *) atoz[15] , 00148 (doublereal *) atoz[16] , (doublereal *) atoz[17] , 00149 (doublereal *) atoz[18] , (doublereal *) atoz[19] , 00150 (doublereal *) atoz[20] , (doublereal *) atoz[21] , 00151 (doublereal *) atoz[22] , (doublereal *) atoz[23] , 00152 (doublereal *) atoz[24] , (doublereal *) atoz[25] , 00153 &lvec , (doublereal *) vout , (ftnlen) 8 ) ; 00154 00155 return ; 00156 } |
|
Definition at line 24 of file parser_int.c. References AFMALL, PARSER_code::c_code, free, malloc, PARSER_code::num_code, and parser_(). Referenced by basis_parser(), CALC_read_opts(), DT_read_opts(), EDIT_filter_volume(), EXP0D_main(), F1D_main(), F2D_main(), main(), MRG_read_opts(), PARSER_1deval(), PARSER_strtod(), Process_Options(), RCREND_cutout_blobs(), RCREND_evaluate(), REND_cutout_blobs(), REND_evaluate(), RT_parser_init(), and validate_options().
00025 { 00026 logical pr ; 00027 integer num_code ; 00028 int nexp ; 00029 PARSER_code * pc ; 00030 char *exp,cc ; int ii,jj ; /* 22 Jul 2003 */ 00031 00032 if( expression == NULL ) return NULL ; 00033 nexp = strlen( expression ) ; 00034 if( nexp == 0 ) return NULL ; 00035 00036 /* 22 Jul 2003: copy into local string, tossing bad stuff */ 00037 00038 exp = AFMALL(char, nexp+4) ; 00039 for( ii=jj=0 ; ii < nexp ; ii++ ){ 00040 cc = expression[ii] ; 00041 if( !isspace(cc) && !iscntrl(cc) ) exp[jj++] = cc ; 00042 } 00043 exp[jj] = '\0' ; 00044 nexp = strlen(exp) ; if( nexp == 0 ) return NULL ; 00045 00046 pc = (PARSER_code *) malloc( sizeof(PARSER_code) ) ; 00047 00048 pr = (printout) ? TRUE_ : FALSE_ ; 00049 00050 parser_( exp, &pr, &num_code, pc->c_code, (ftnlen) nexp, (ftnlen) 8 ) ; 00051 00052 free(exp) ; /* 22 Jul 2003 */ 00053 00054 if( num_code <= 0 ){ free(pc) ; return NULL ; } 00055 00056 pc->num_code = (int) num_code ; 00057 return pc ; 00058 } |
|
Definition at line 87 of file parser_int.c. References PARSER_code::c_code, hassym_(), and PARSER_code::num_code. Referenced by basis_parser(), DT_read_opts(), main(), PARSER_1deval(), PARSER_mark_symbols(), and Process_Options().
00088 { 00089 int hh ; 00090 char sss[8] ; 00091 integer num_code ; 00092 00093 if( !isalpha(sym[0]) ) return 0 ; /* not alphabetic */ 00094 00095 sss[0] = toupper(sym[0]) ; sss[1] = '\0' ; /* uppercase it */ 00096 00097 num_code = (integer) pc->num_code ; 00098 00099 hh = (int) hassym_( sss , &num_code , pc->c_code , 00100 (ftnlen) 8 , (ftnlen) 8 ) ; 00101 00102 return hh ; 00103 } |
|
Definition at line 105 of file parser_int.c. References PARSER_has_symbol(). Referenced by CALC_read_opts(), F1D_chainfunc(), F1D_main(), F2D_chainfunc(), F2D_main(), MRG_read_opts(), RT_parser_init(), and validate_options().
00106 { 00107 int ii ; 00108 static char abet[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" ; 00109 00110 if( pc == NULL || sl == NULL ) return ; 00111 00112 for( ii=0 ; ii < 26 ; ii++ ) 00113 sl[ii] = PARSER_has_symbol( abet+ii , pc ) ; 00114 00115 return ; 00116 } |
|
Definition at line 15 of file parser_int.c. Referenced by basis_parser(), CALC_read_opts(), RT_parser_init(), and validate_options().
|