Changeset 16170 for trunk/ippTools/src/stacktool.c
- Timestamp:
- Jan 20, 2008, 3:48:37 PM (18 years ago)
- File:
-
- 1 edited
-
trunk/ippTools/src/stacktool.c (modified) (13 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippTools/src/stacktool.c
r15376 r16170 95 95 96 96 // required options 97 bool status = false; 98 psString workdir = psMetadataLookupStr(&status, config->args, "-workdir"); 99 if (!status) { 100 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -workdir"); 101 return false; 102 } 103 if (!workdir) { 104 psError(PS_ERR_UNKNOWN, true, "-workdir is required"); 105 return false; 106 } 107 108 psString skycell_id = psMetadataLookupStr(&status, config->args, "-skycell_id"); 109 if (!status) { 110 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -skycell_id"); 111 return false; 112 } 113 if (!skycell_id) { 114 psError(PS_ERR_UNKNOWN, true, "-skycell_id is required"); 115 return false; 116 } 117 118 psString tess_id = psMetadataLookupStr(&status, config->args, "-tess_id"); 119 if (!status) { 120 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -tess_id"); 121 return false; 122 } 123 if (!tess_id) { 124 psError(PS_ERR_UNKNOWN, true, "-tess_id is required"); 125 return false; 126 } 97 PXOPT_LOOKUP_STR(workdir, config->args, "-workdir", true, false); 98 PXOPT_LOOKUP_STR(skycell_id, config->args, "-skycell_id", true, false); 99 PXOPT_LOOKUP_STR(tess_id, config->args, "-tess_id", true, false); 100 101 // default 102 PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false); 103 PXOPT_LOOKUP_TIME(registered, config->args, "-registered", false, false); 127 104 128 105 // we have to support multipe exp_ids … … 132 109 psError(PS_ERR_UNKNOWN, true, "-warp_id is required"); 133 110 return false; 134 }135 136 psTime *registered = NULL;137 {138 psString registeredStr = psMetadataLookupStr(&status, config->args, "-registered");139 if (!status) {140 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -registered");141 return false;142 }143 // pass through NULL as this is an optional field144 if (registeredStr) {145 registered = psTimeFromISO(registeredStr, PS_TIME_UTC);146 } else {147 registered = NULL;148 }149 111 } 150 112 … … 158 120 tess_id 159 121 ); 160 psFree(registered);161 122 if (!run) { 162 123 psError(PS_ERR_UNKNOWN, false, "failed to alloc stackRun object"); … … 210 171 } 211 172 212 bool simple = false;213 {214 bool status = false;215 simple = psMetadataLookupBool(&status, config->args, "-simple");216 if (!status) {217 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -simple");218 psFree(run);219 return false;220 }221 }222 223 173 if (!stackRunPrintObject(stdout, run, !simple)) { 224 174 psError(PS_ERR_UNKNOWN, false, "failed to print object"); … … 237 187 PS_ASSERT_PTR_NON_NULL(config, false); 238 188 239 bool status = false; 240 psString stack_id = psMetadataLookupStr(&status, config->args, "-stack_id"); 241 if (!status) { 242 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -stack_id"); 243 return false; 244 } 245 if (!stack_id) { 246 psError(PS_ERR_UNKNOWN, true, "-stack_id is required"); 247 return false; 248 } 249 250 psString state = psMetadataLookupStr(&status, config->args, "-state"); 251 if (!status) { 252 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -state"); 253 return false; 254 } 255 if (!state) { 256 psError(PS_ERR_UNKNOWN, true, "-state is required"); 257 return false; 258 } 189 PXOPT_LOOKUP_STR(stack_id, config->args, "-stack_id", true, false); 190 PXOPT_LOOKUP_STR(state, config->args, "-state", true, false); 259 191 260 192 if (state) { … … 271 203 PS_ASSERT_PTR_NON_NULL(config, false); 272 204 273 bool status = false; 274 psString stack_id = psMetadataLookupStr(&status, config->args, "-stack_id"); 275 if (!status) { 276 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -stack_id"); 277 return false; 278 } 279 if (!stack_id) { 280 psError(PS_ERR_UNKNOWN, true, "-stack_id is required"); 281 return false; 282 283 } 284 285 psString warp_id = psMetadataLookupStr(&status, config->args, "-warp_id"); 286 if (!status) { 287 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -warp_id"); 288 return false; 289 } 290 if (!warp_id) { 291 psError(PS_ERR_UNKNOWN, true, "-warp_id is required"); 292 return false; 293 } 294 205 PXOPT_LOOKUP_STR(stack_id, config->args, "-stack_id", true, false); 206 PXOPT_LOOKUP_STR(warp_id, config->args, "-warp_id", true, false); 295 207 296 208 // XXX need to validate the warp_id here … … 313 225 PS_ASSERT_PTR_NON_NULL(config, false); 314 226 315 bool status = false; 316 psU64 limit = psMetadataLookupU64(&status, config->args, "-limit"); 317 if (!status) { 318 psError(PXTOOLS_ERR_PROG, false, "failed to lookup value for -limit"); 319 return false; 320 } 227 PXOPT_LOOKUP_U64(limit, config->args, "-limit", false, false); 228 PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false); 321 229 322 230 psString query = pxDataGet("stacktool_inputskyfile.sql"); … … 366 274 } 367 275 368 bool simple = false;369 {370 bool status = false;371 simple = psMetadataLookupBool(&status, config->args, "-simple");372 if (!status) {373 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -simple");374 return false;375 }376 }377 378 276 if (psArrayLength(output)) { 379 277 if (!convertIdToStr(output)) { … … 401 299 PS_ASSERT_PTR_NON_NULL(config, false); 402 300 403 bool status = false; 404 psU64 limit = psMetadataLookupU64(&status, config->args, "-limit"); 405 if (!status) { 406 psError(PXTOOLS_ERR_PROG, false, "failed to lookup value for -limit"); 407 return false; 408 } 301 PXOPT_LOOKUP_U64(limit, config->args, "-limit", false, false); 302 PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false); 409 303 410 304 psString query = pxDataGet("stacktool_tosum.sql"); … … 454 348 } 455 349 456 bool simple = false;457 {458 bool status = false;459 simple = psMetadataLookupBool(&status, config->args, "-simple");460 if (!status) {461 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -simple");462 return false;463 }464 }465 466 350 if (psArrayLength(output)) { 467 351 if (!convertIdToStr(output)) { … … 489 373 PS_ASSERT_PTR_NON_NULL(config, false); 490 374 491 bool status = false; 492 psString stack_id = psMetadataLookupStr(&status, config->args, "-stack_id"); 493 if (!status) { 494 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -stack_id"); 495 return false; 496 } 497 if (!stack_id) { 498 psError(PS_ERR_UNKNOWN, true, "-stack_id is required"); 499 return false; 500 501 } 502 503 psString uri = psMetadataLookupStr(&status, config->args, "-uri"); 504 if (!status) { 505 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -uri"); 506 return false; 507 } 508 509 psString path_base = psMetadataLookupStr(&status, config->args, "-path_base"); 510 if (!status) { 511 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -path_base"); 512 return false; 513 } 375 // required 376 PXOPT_LOOKUP_STR(stack_id, config->args, "-stack_id", true, false); 514 377 515 378 // optional 516 psF64 bg = psMetadataLookupF64(&status, config->args, "-bg"); 517 if (!status) { 518 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -bg"); 519 return false; 520 } 521 522 psF64 bg_stdev = psMetadataLookupF64(&status, config->args, "-bg_stdev"); 523 if (!status) { 524 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -bg_stdev"); 525 return false; 526 } 527 528 psF64 good_frac = psMetadataLookupF64(&status, config->args, "-good_frac"); 529 if (!status) { 530 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -good_frac"); 531 return false; 532 } 379 PXOPT_LOOKUP_STR(uri, config->args, "-uri", false, false); 380 PXOPT_LOOKUP_STR(path_base, config->args, "-path_base", false, false); 381 PXOPT_LOOKUP_F64(bg, config->args, "-bg", false, false); 382 PXOPT_LOOKUP_F64(bg_stdev, config->args, "-bg_stdev", false, false); 383 PXOPT_LOOKUP_F64(good_frac, config->args, "-good_frac", false, false); 533 384 534 385 // default values 535 psS16 code = psMetadataLookupS16(&status, config->args, "-code"); 536 if (!status) { 537 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -code"); 538 return false; 539 } 386 PXOPT_LOOKUP_S16(code, config->args, "-code", false, false); 540 387 541 388 if (!psDBTransaction(config->dbh)) { … … 585 432 PS_ASSERT_PTR_NON_NULL(config, false); 586 433 587 bool status = false; 588 psU64 limit = psMetadataLookupU64(&status, config->args, "-limit"); 589 if (!status) { 590 psError(PXTOOLS_ERR_PROG, false, "failed to lookup value for -limit"); 591 return false; 592 } 434 PXOPT_LOOKUP_U64(limit, config->args, "-limit", false, false); 435 PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false); 593 436 594 437 psString query = pxDataGet("stacktool_sumskyfile.sql"); … … 638 481 } 639 482 640 bool simple = false;641 {642 bool status = false;643 simple = psMetadataLookupBool(&status, config->args, "-simple");644 if (!status) {645 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -simple");646 return false;647 }648 }649 650 483 if (psArrayLength(output)) { 651 484 if (!convertIdToStr(output)) {
Note:
See TracChangeset
for help on using the changeset viewer.
