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
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
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 #ifdef HAVE_CONFIG_H
00075 # include <config.h>
00076 #endif
00077
00078
00085
00086
00089 #include <uves_dump.h>
00090
00091 #include <uves_msg.h>
00092 #include <uves_error.h>
00093
00094 #include <irplib_access.h>
00095 #include <cpl.h>
00096
00097
00109
00110 cpl_error_code
00111 uves_print_uves_propertylist(const uves_propertylist *pl, long low, long high)
00112 {
00113 const cpl_property *prop;
00114 long i = 0;
00115
00116 assure (0 <= low && high <= uves_propertylist_get_size(pl) && low <= high,
00117 CPL_ERROR_ILLEGAL_INPUT, "Illegal range");
00118
00119
00120 if (pl == NULL){
00121 uves_msg("NULL");
00122 }
00123 else if (uves_propertylist_is_empty(pl)) {
00124 uves_msg("[Empty property list]");
00125 }
00126 else
00127 for (i = low; i < high; i++)
00128 {
00129 prop = uves_propertylist_get_const(pl, i);
00130 check (uves_print_cpl_property(prop), "Error printing property");
00131 }
00132
00133 cleanup:
00134 return cpl_error_get_code();
00135 }
00136
00144
00145
00146 cpl_error_code
00147 uves_print_cpl_property(const cpl_property *prop)
00148 {
00149 cpl_type t;
00150
00151 if (prop == NULL)
00152 {
00153 uves_msg("NULL");
00154 }
00155 else
00156 {
00157
00158
00159
00160
00161
00162
00163
00164
00165 uves_msg("%s =", cpl_property_get_name(prop) != NULL ?
00166 cpl_property_get_name(prop) : "NULL");
00167
00168
00169
00170 check( t = cpl_property_get_type(prop), "Could not read property type");
00171
00172 switch(t & (~CPL_TYPE_FLAG_ARRAY))
00173 {
00174 case CPL_TYPE_CHAR:
00175 if (t & CPL_TYPE_FLAG_ARRAY)
00176 {
00177 uves_msg(" '%s'", cpl_property_get_string(prop) != NULL ?
00178 cpl_property_get_string(prop) : "NULL");
00179 }
00180 else
00181 {
00182 uves_msg(" %c", cpl_property_get_char(prop));
00183 }
00184 break;
00185 case CPL_TYPE_BOOL: if (cpl_property_get_bool(prop))
00186 {uves_msg(" true");}
00187 else
00188 {uves_msg(" false");}
00189 break;
00190 case CPL_TYPE_UCHAR: uves_msg(" %c", cpl_property_get_char(prop)); break;
00191 case CPL_TYPE_INT: uves_msg(" %d", cpl_property_get_int(prop)); break;
00192 case CPL_TYPE_UINT: uves_msg(" %d", cpl_property_get_int(prop)); break;
00193 case CPL_TYPE_LONG: uves_msg(" %ld", cpl_property_get_long(prop)); break;
00194 case CPL_TYPE_ULONG: uves_msg(" %ld", cpl_property_get_long(prop)); break;
00195 case CPL_TYPE_FLOAT: uves_msg(" %f", cpl_property_get_float(prop)); break;
00196 case CPL_TYPE_DOUBLE: uves_msg(" %f", cpl_property_get_double(prop));break;
00197 case CPL_TYPE_POINTER: uves_msg(" POINTER"); break;
00198 case CPL_TYPE_INVALID: uves_msg(" INVALID"); break;
00199 default: uves_msg(" unrecognized property"); break;
00200 }
00201
00202
00203 if (t & CPL_TYPE_FLAG_ARRAY){
00204 uves_msg(" (array size = %ld)", cpl_property_get_size(prop));
00205 }
00206
00207
00208 if (cpl_property_get_comment(prop) != NULL){
00209 uves_msg(" %s", cpl_property_get_comment(prop) != NULL ?
00210 cpl_property_get_comment(prop) : "NULL");
00211 }
00212 }
00213
00214 cleanup:
00215 return cpl_error_get_code();
00216 }
00217
00218
00226
00227 cpl_error_code
00228 uves_print_cpl_frameset(const cpl_frameset *frames)
00229 {
00230
00231
00232 if (frames == NULL)
00233 {
00234 uves_msg("NULL");
00235 }
00236 else
00237 {
00238 const cpl_frame *f = NULL;
00239 check( f = irplib_frameset_get_first_const(frames), "Error reading frameset");
00240
00241 if (f == NULL)
00242 {
00243 uves_msg("[Empty frame set]");
00244 }
00245 else
00246 {
00247 while(f != NULL)
00248 {
00249 check( uves_print_cpl_frame(f), "Could not print frame");
00250 check( f = irplib_frameset_get_next_const(frames),
00251 "Error reading frameset");
00252 }
00253 }
00254 }
00255
00256 cleanup:
00257 return cpl_error_get_code();
00258 }
00259
00260
00268
00269 cpl_error_code
00270 uves_print_cpl_frame(const cpl_frame *f)
00271 {
00272 if (f == NULL)
00273 {
00274 uves_msg("NULL");
00275 }
00276 else
00277 {
00278 const char *filename = cpl_frame_get_filename(f);
00279
00280 if (filename == NULL)
00281 {
00282 cpl_error_reset();
00283 filename = "Null";
00284 }
00285
00286 uves_msg("%-7s %-20s '%s'",
00287 uves_tostring_cpl_frame_group(cpl_frame_get_group(f)),
00288 cpl_frame_get_tag(f) != NULL ? cpl_frame_get_tag(f) : "Null",
00289 filename);
00290
00291 uves_msg_debug("type \t= %s", uves_tostring_cpl_frame_type (cpl_frame_get_type (f)));
00292 uves_msg_debug("group \t= %s", uves_tostring_cpl_frame_group(cpl_frame_get_group(f)));
00293 uves_msg_debug("level \t= %s", uves_tostring_cpl_frame_level(cpl_frame_get_level(f)));
00294 }
00295
00296 return cpl_error_get_code();
00297 }
00298
00299
00305
00306 const char *
00307 uves_tostring_cpl_frame_type(cpl_frame_type ft)
00308 {
00309 switch(ft)
00310 {
00311 case CPL_FRAME_TYPE_NONE: return "NONE"; break;
00312 case CPL_FRAME_TYPE_IMAGE: return "IMAGE"; break;
00313 case CPL_FRAME_TYPE_MATRIX: return "MATRIX"; break;
00314 case CPL_FRAME_TYPE_TABLE: return "TABLE"; break;
00315 default: return "unrecognized frame type";
00316 }
00317 }
00318
00319
00325
00326 const char *
00327 uves_tostring_cpl_frame_group(cpl_frame_group fg)
00328 {
00329 switch(fg)
00330 {
00331 case CPL_FRAME_GROUP_NONE: return "NONE"; break;
00332 case CPL_FRAME_GROUP_RAW: return CPL_FRAME_GROUP_RAW_ID; break;
00333 case CPL_FRAME_GROUP_CALIB: return CPL_FRAME_GROUP_CALIB_ID; break;
00334 case CPL_FRAME_GROUP_PRODUCT: return CPL_FRAME_GROUP_PRODUCT_ID; break;
00335 default:
00336 return "unrecognized frame group";
00337 }
00338 }
00339
00340
00346
00347 const char *
00348 uves_tostring_cpl_frame_level(cpl_frame_level fl)
00349 {
00350
00351 switch(fl)
00352 {
00353 case CPL_FRAME_LEVEL_NONE: return "NONE"; break;
00354 case CPL_FRAME_LEVEL_TEMPORARY: return "TEMPORARY"; break;
00355 case CPL_FRAME_LEVEL_INTERMEDIATE:return "INTERMEDIATE";break;
00356 case CPL_FRAME_LEVEL_FINAL: return "FINAL"; break;
00357 default: return "unrecognized frame level";
00358 }
00359 }
00360
00361
00362
00368
00369 const char *
00370 uves_tostring_cpl_type(cpl_type t)
00371 {
00372
00373
00374
00375
00376 if (!(t & CPL_TYPE_FLAG_ARRAY))
00377 switch(t & (~CPL_TYPE_FLAG_ARRAY))
00378 {
00379 case CPL_TYPE_CHAR: return "char"; break;
00380 case CPL_TYPE_UCHAR: return "uchar"; break;
00381 case CPL_TYPE_BOOL: return "boolean"; break;
00382 case CPL_TYPE_INT: return "int"; break;
00383 case CPL_TYPE_UINT: return "uint"; break;
00384 case CPL_TYPE_LONG: return "long"; break;
00385 case CPL_TYPE_ULONG: return "ulong"; break;
00386 case CPL_TYPE_FLOAT: return "float"; break;
00387 case CPL_TYPE_DOUBLE: return "double"; break;
00388 case CPL_TYPE_POINTER: return "pointer"; break;
00389
00390 case CPL_TYPE_INVALID: return "invalid"; break;
00391 default:
00392 return "unrecognized type";
00393 }
00394 else
00395 switch(t & (~CPL_TYPE_FLAG_ARRAY))
00396 {
00397 case CPL_TYPE_CHAR: return "string (char array)"; break;
00398 case CPL_TYPE_UCHAR: return "uchar array"; break;
00399 case CPL_TYPE_BOOL: return "boolean array"; break;
00400 case CPL_TYPE_INT: return "int array"; break;
00401 case CPL_TYPE_UINT: return "uint array"; break;
00402 case CPL_TYPE_LONG: return "long array"; break;
00403 case CPL_TYPE_ULONG: return "ulong array"; break;
00404 case CPL_TYPE_FLOAT: return "float array"; break;
00405 case CPL_TYPE_DOUBLE: return "double array"; break;
00406 case CPL_TYPE_POINTER: return "pointer array"; break;
00407
00408 case CPL_TYPE_INVALID: return "invalid (array)"; break;
00409 default:
00410 return "unrecognized type";
00411 }
00412 }