File indexing completed on 2025-02-21 10:05:30
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029 #ifndef CERN_QP_COMMAND
0030 #define CERN_QP_COMMAND
0031
0032 #include <stdio.h>
0033
0034
0035 #include "qp_query.h"
0036 #include "qp_value.h"
0037 #include "smap.h"
0038
0039
0040 #define HFILL_BSIZE 2048
0041 #define PRINTFUN_SIZE 35
0042 #define MAX_MAP_STRINGS 512
0043
0044
0045 typedef float (*CvtFun)( void *, void * );
0046 typedef struct _cvt_call_back_ {
0047 CvtFun f;
0048 void * d;
0049 } CvtCallBack;
0050
0051 typedef void (*PrintFun)( String, void * );
0052
0053
0054 #if 0
0055 typedef struct _print_call_back_ {
0056 PrintFun f;
0057 void * d;
0058 } PrintCallBack;
0059 #endif
0060
0061
0062
0063 typedef void (*TableCallBack)( int * );
0064
0065
0066 typedef enum _cmd_type_ {
0067 CMD_NULL,
0068 CMD_MINMAX,
0069 CMD_MINMAXAVG,
0070 CMD_VFILL,
0071 CMD_HFILL1,
0072 CMD_HFILL2,
0073 CMD_SCAT2,
0074 CMD_SCAT3,
0075 CMD_SCAT4,
0076 CMD_GOURAUD,
0077 CMD_LOOP,
0078 CMD_DUMP,
0079 CMD_SCAN,
0080 CMD_SPIDERSCAN
0081 } CmdType;
0082
0083
0084 typedef struct _extreme_ {
0085 DataType dtyp;
0086 Uval min;
0087 Uval max;
0088 SMap sm;
0089 } Extreme;
0090
0091 typedef struct _extremeavg_ {
0092 DataType dtyp;
0093 Uval min;
0094 Uval max;
0095 double avg;
0096 SMap sm;
0097 } ExtremeAvg;
0098
0099
0100 #if 0
0101 typedef struct _qp_cmd_null_ {
0102
0103
0104 } QPCmdNull;
0105 #endif
0106
0107
0108 typedef struct _qp_cmd_minmax_ {
0109
0110
0111 bool has_events;
0112 int n;
0113 Extreme *el;
0114 } QPCmdMinMax;
0115
0116
0117 typedef struct _qp_cmd_minmaxavg_ {
0118
0119
0120 bool has_events;
0121 int n;
0122 int evt_count;
0123 ExtremeAvg *el;
0124 } QPCmdMinMaxAvg;
0125
0126
0127 #if 0
0128 typedef struct _qp_cmd_vfill_ {
0129
0130
0131 } QPCmdVFill;
0132 #endif
0133
0134
0135 typedef struct _qp_cmd_hfill1_ {
0136
0137 int idh;
0138
0139 int n;
0140 float *x;
0141 float *w;
0142 CvtCallBack cvt_x;
0143 int step_x;
0144 } QPCmdHFill1;
0145
0146
0147 typedef struct _qp_cmd_hfill2_ {
0148
0149 int idh;
0150
0151 CvtCallBack cvt_x;
0152 int step_x;
0153 CvtCallBack cvt_y;
0154 int step_y;
0155 } QPCmdHFill2;
0156
0157
0158 typedef struct _qp_cmd_scat2_ {
0159
0160 int idh;
0161 bool line;
0162 bool logx;
0163 bool logy;
0164
0165 int n;
0166 int *ievt;
0167 float *x;
0168 float *y;
0169 CvtCallBack cvt_x;
0170 int step_x;
0171 CvtCallBack cvt_y;
0172 int step_y;
0173 } QPCmdScat2;
0174
0175
0176 typedef struct _qp_cmd_scat3_ {
0177
0178 bool line;
0179 bool logx;
0180 bool logy;
0181 bool logz;
0182
0183 int n;
0184 int *ievt;
0185 float *x;
0186 float *y;
0187 float *z;
0188 CvtCallBack cvt_x;
0189 int step_x;
0190 CvtCallBack cvt_y;
0191 int step_y;
0192 CvtCallBack cvt_z;
0193 int step_z;
0194 } QPCmdScat3;
0195
0196
0197 typedef struct _qp_cmd_scat4_ {
0198
0199 bool line;
0200 float col_min;
0201 float col_max;
0202 bool logx;
0203 bool logy;
0204 bool logz;
0205
0206 int n;
0207 int *ievt;
0208 float *x;
0209 float *y;
0210 float *z;
0211 float *c;
0212 CvtCallBack cvt_x;
0213 int step_x;
0214 CvtCallBack cvt_y;
0215 int step_y;
0216 CvtCallBack cvt_z;
0217 int step_z;
0218 CvtCallBack cvt_c;
0219 int step_c;
0220 } QPCmdScat4;
0221
0222
0223 typedef struct _qp_cmd_gouraud_ {
0224
0225 bool logx;
0226 bool logy;
0227 bool logz;
0228
0229 float min[3];
0230 float max[3];
0231 float s[3];
0232 int nx;
0233 int ny;
0234 int nz;
0235 float dx;
0236 float dy;
0237 float dz;
0238 float *x;
0239 float *y;
0240 float *z;
0241 float *value;
0242 CvtCallBack cvt_x;
0243 int step_x;
0244 CvtCallBack cvt_y;
0245 int step_y;
0246 CvtCallBack cvt_z;
0247 int step_z;
0248 } QPCmdGouraud;
0249
0250 #if 0
0251 typedef struct _qp_cmd_loop_ {
0252
0253
0254 } QPCmdLoop;
0255 #endif
0256
0257
0258 typedef struct _qp_cmd_dump_ {
0259
0260 FILE * fp;
0261 String sep1;
0262 String sep2;
0263
0264 PrintFun f[MAX_EXPRS];
0265 } QPCmdDump;
0266
0267
0268 typedef struct _qp_cmd_scan_ {
0269
0270 bool pawpp;
0271
0272 TableCallBack matlab;
0273 TableCallBack matrow;
0274 PrintFun f[MAX_EXPRS];
0275 int fw[MAX_EXPRS];
0276 String sep;
0277 String title;
0278 String buf;
0279 int max_line;
0280 int cur_line;
0281 bool no_prompt;
0282 bool evt_count;
0283 } QPCmdScan;
0284
0285 typedef struct _qp_cmd_spider_scan_ {
0286
0287
0288 CvtCallBack cvt[MAX_EXPRS];
0289 float min[MAX_EXPRS];
0290 float max[MAX_EXPRS];
0291 float avg[MAX_EXPRS];
0292 int t_code[MAX_EXPRS];
0293 float saved[8];
0294
0295 float rzone;
0296 char *expr_str;
0297 int max_line;
0298 int cur_line;
0299 bool no_prompt;
0300 int evt_count;
0301 int spider_type;
0302 bool use_average;
0303 } QPCmdSpiderScan;
0304
0305
0306 typedef struct _qp_cmd_ {
0307 CmdType command;
0308
0309
0310 union {
0311 #if 0
0312 QPCmdNull null;
0313 #endif
0314 QPCmdMinMax minmax;
0315 QPCmdMinMaxAvg minmaxavg;
0316 #if 0
0317 QPCmdVFill vfill;
0318 #endif
0319 QPCmdHFill1 hfill1;
0320 QPCmdHFill2 hfill2;
0321 QPCmdScat2 scat2;
0322 QPCmdScat3 scat3;
0323 QPCmdScat4 scat4;
0324 QPCmdGouraud gouraud;
0325 #if 0
0326 QPCmdLoop loop;
0327 #endif
0328 QPCmdDump dump;
0329 QPCmdScan scan;
0330 QPCmdSpiderScan sp_scan;
0331 } u;
0332
0333 } QPCmd;
0334
0335
0336 extern int const datatype_width[];
0337
0338
0339 QPCmd *
0340 qpcmd_new( CmdType cmd );
0341
0342 void
0343 qpcmd_free( QPCmd * cmd );
0344
0345 void
0346 qpcmd_getminmax( QPCmd * cmd, int i, float * min, float * max );
0347
0348 void
0349 qpcmd_getminmaxavg( QPCmd * cmd, int i, float * min, float * max , float * avg );
0350
0351 SMap
0352 qpcmd_labels( QPCmd * cmd, int i );
0353
0354
0355 CvtCallBack
0356 datatype_to_cvtcallback( DataType dtype, void * cbd );
0357
0358 PrintFun
0359 datatype_to_printfun( DataType dtype );
0360
0361 PrintFun
0362 datatype_to_dumpfun( DataType dtype );
0363
0364 int
0365 datatype_to_typecode( DataType dtype);
0366
0367 #endif
0368