00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #ifndef SCIMATH_FUNCEXPRDATA_H
00030 #define SCIMATH_FUNCEXPRDATA_H
00031
00032
00033 #include <casacore/casa/aips.h>
00034 #include <casacore/casa/BasicSL/String.h>
00035 #include <casacore/casa/stdmap.h>
00036
00037
00038 #include <casacore/casa/iosfwd.h>
00039
00040 namespace casacore {
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074 class FuncExprData {
00075 public:
00076
00077
00078 enum opTypes {
00079 NOP=0,
00080 UNAMIN,
00081 UNAPLUS,
00082 NON,
00083 POW,
00084 GTE,
00085 LTE,
00086 EQ,
00087 NEQ,
00088 OR,
00089 AND,
00090 CONDEX,
00091 CONDEX2,
00092 CONDEX3,
00093 ADD,
00094 SUB,
00095 MUL,
00096 DIV,
00097 LT,
00098 GT,
00099 CONST,
00100 PARAM,
00101 ARG,
00102 TOIMAG,
00103 LBRACE,
00104 RBRACE,
00105 LPAREN,
00106 RPAREN,
00107 LBR,
00108 RBR,
00109 COMMA,
00110 FINISH,
00111 GOTO,
00112 GOTOF,
00113 GOTOT,
00114 SIN,
00115 COS,
00116 ATAN,
00117 ATAN2,
00118 ASIN,
00119 ACOS,
00120 EXP,
00121 EXP10,
00122 EXP2,
00123 LOG,
00124 LOG10,
00125 LOG2,
00126 ERF,
00127 ERFC,
00128 PI,
00129 EE,
00130 ABS,
00131 FLOOR,
00132 CEIL,
00133 ROUND,
00134 INT,
00135 FRACT,
00136 SQRT,
00137 COMPLEX,
00138 REAL,
00139 IMAG,
00140 AMPL,
00141 PHASE,
00142
00143 NopTypes };
00144
00145
00146 enum opCategories {
00147
00148 UNA2, UNA1, BIN2, BIN1,
00149
00150 SPEC, FUNC,
00151
00152 NopCategories };
00153
00154 enum specAction {
00155 NONE,
00156
00157 SAVENV,
00158
00159 GOTOPC,
00160
00161 FINAL };
00162
00163 enum specPriority {
00164
00165
00166 RTLPRI = 44,
00167
00168 SPCPRI = 60,
00169
00170 FINPRI = 00 };
00171
00172
00173 struct ExprCompState {
00174
00175 uInt rpslow;
00176
00177 uInt nval;
00178
00179 uInt argcnt;
00180
00181 uInt pcptr;
00182 };
00183
00184
00185 struct ExprOperator {
00186
00187 opTypes code;
00188
00189 String name;
00190
00191 opCategories category;
00192
00193 uInt priority;
00194
00195 uInt narg;
00196
00197 uInt nmaxarg;
00198
00199 Int nresult;
00200
00201 Int info;
00202
00203 specAction special;
00204
00205 ExprCompState state;
00206 };
00207
00208
00209
00210 FuncExprData();
00211
00212
00213 ~FuncExprData() {}
00214
00215
00216
00217
00218 map<String, ExprOperator> &unary2() { return una2_p; }
00219 const map<String, ExprOperator> &unary2() const { return una2_p; }
00220 map<String, ExprOperator> &unary1() { return una1_p; }
00221 const map<String, ExprOperator> &unary1() const { return una1_p; }
00222 map<String, ExprOperator> &binary2() { return bin2_p; }
00223 const map<String, ExprOperator> &binary2() const { return bin2_p; }
00224 map<String, ExprOperator> &binary1() { return bin1_p; }
00225 const map<String, ExprOperator> &binary1() const { return bin1_p; }
00226 map<String, ExprOperator> &special() { return spop_p; }
00227 const map<String, ExprOperator> &special() const { return spop_p; }
00228 map<String, ExprOperator> &function() { return func_p; }
00229 const map<String, ExprOperator> &function() const { return func_p; }
00230
00231
00232 void print(ostream &os,
00233 const map<String, FuncExprData::ExprOperator> &m) const;
00234
00235 void print(ostream &os, const FuncExprData::ExprOperator &pos) const;
00236
00237 private:
00238
00239
00240 map<String, ExprOperator> una2_p;
00241
00242 map<String, ExprOperator> una1_p;
00243
00244 map<String, ExprOperator> bin2_p;
00245
00246 map<String, ExprOperator> bin1_p;
00247
00248 map<String, ExprOperator> spop_p;
00249
00250 map<String, ExprOperator> func_p;
00251
00252 map<opTypes, ExprOperator> allop_p;
00253 };
00254
00255
00256
00257
00258
00259
00260
00261 ostream &operator<<(ostream &os, const FuncExprData &ed);
00262
00263
00264
00265 }
00266
00267 #endif
00268
00269
00270