Changeset 9790
- Timestamp:
- Oct 30, 2006, 11:56:09 AM (20 years ago)
- Location:
- trunk/ippTools
- Files:
-
- 6 edited
-
configure.ac (modified) (1 diff)
-
src/camtool.c (modified) (6 diffs)
-
src/camtool.h (modified) (1 diff)
-
src/camtoolConfig.c (modified) (2 diffs)
-
src/chiptool.c (modified) (1 diff)
-
src/pxtables.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippTools/configure.ac
r9764 r9790 16 16 PKG_CHECK_MODULES([PSLIB], [pslib >= 0.12.99]) 17 17 PKG_CHECK_MODULES([PSMODULES], [psmodules >= 0.12.0]) 18 PKG_CHECK_MODULES([IPPDB], [ippdb >= 0.0.5 2])18 PKG_CHECK_MODULES([IPPDB], [ippdb >= 0.0.53]) 19 19 20 20 AC_PROG_PERL_MODULES( -
trunk/ippTools/src/camtool.c
r9392 r9790 30 30 static bool pendingimfileMode(pxConfig *config); 31 31 static bool addprocessedexpMode(pxConfig *config); 32 static bool blockMode(pxConfig *config); 33 static bool maskedMode(pxConfig *config); 34 static bool unblockMode(pxConfig *config); 32 35 33 36 # define MODECASE(caseName, func) \ … … 48 51 MODECASE(P3TOOL_MODE_PENDINGIMFILE, pendingimfileMode); 49 52 MODECASE(P3TOOL_MODE_ADDPROCESSEDEXP, addprocessedexpMode); 53 MODECASE(P3TOOL_MODE_BLOCK, blockMode); 54 MODECASE(P3TOOL_MODE_MASKED, maskedMode); 55 MODECASE(P3TOOL_MODE_UNBLOCK, unblockMode); 50 56 default: 51 57 psAbort(argv[0], "invalid option (this should not happen)"); … … 76 82 " LEFT JOIN p3ProcessedExp" 77 83 " USING(exp_tag)" 84 " LEFT JOIN p3Mask" 85 " ON p3PendingExp.label = p3Mask.label" 78 86 " WHERE" 79 87 " p3ProcessedExp.exp_tag IS NULL" 88 " AND p3Mask.label IS NULL" 80 89 ); 81 90 … … 132 141 133 142 psString query = psStringCopy( 134 "SELECT p2ProcessedImfile.*" 135 " FROM p3PendingExp" 136 " JOIN p2ProcessedImfile" 137 " USING(exp_tag, p2_version)" 143 "SELECT p2ProcessedImfile.*" 144 " FROM p3PendingExp" 145 " JOIN p2ProcessedImfile" 146 " USING(exp_tag, p2_version)" 147 " LEFT JOIN p3ProcessedExp" 148 " USING(exp_tag)" 149 " LEFT JOIN p3Mask" 150 " ON p3PendingExp.label = p3Mask.label" 151 " WHERE" 152 " p3ProcessedExp.exp_tag IS NULL" 153 " AND p3Mask.label IS NULL" 138 154 ); 139 155 … … 349 365 zp_stdev, 350 366 pendingRow->p2_version, 351 pendingRow->p3_version 367 pendingRow->p3_version, 368 pendingRow->label 352 369 ); 353 370 psFree(pendingRow); … … 364 381 return true; 365 382 } 383 384 static bool blockMode(pxConfig *config) 385 { 386 PS_ASSERT_PTR_NON_NULL(config, false); 387 388 bool status = false; 389 psString label = psMetadataLookupStr(&status, config->args, "-label"); 390 if (!status) { 391 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -label"); 392 return false; 393 } 394 if (!label) { 395 psError(PS_ERR_UNKNOWN, true, "-label is required"); 396 return false; 397 } 398 399 if (!p3MaskInsert(config->dbh, label)) { 400 psError(PS_ERR_UNKNOWN, false, "database error"); 401 return false; 402 } 403 404 return true; 405 } 406 407 static bool maskedMode(pxConfig *config) 408 { 409 PS_ASSERT_PTR_NON_NULL(config, false); 410 411 psString query = psStringCopy("SELECT * FROM p3Mask"); 412 413 if (!p_psDBRunQuery(config->dbh, query)) { 414 psError(PS_ERR_UNKNOWN, false, "database error"); 415 psFree(query); 416 return false; 417 } 418 psFree(query); 419 420 psArray *output = p_psDBFetchResult(config->dbh); 421 if (!output) { 422 psError(PS_ERR_UNKNOWN, false, "database error"); 423 return false; 424 } 425 if (!psArrayLength(output)) { 426 // XXX check psError here 427 psError(PS_ERR_UNKNOWN, false, "no p3Mask rows found"); 428 psFree(output); 429 return true; 430 } 431 432 bool simple = false; 433 { 434 bool status = false; 435 simple = psMetadataLookupBool(&status, config->args, "-simple"); 436 if (!status) { 437 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -simple"); 438 return false; 439 } 440 } 441 442 // negative simple so the default is true 443 if (!ippdbPrintMetadatas(stdout, output, "p3Mask", !simple)) { 444 psError(PS_ERR_UNKNOWN, false, "failed to print array"); 445 psFree(output); 446 return false; 447 } 448 449 psFree(output); 450 451 return true; 452 } 453 454 static bool unblockMode(pxConfig *config) 455 { 456 PS_ASSERT_PTR_NON_NULL(config, false); 457 458 bool status = false; 459 psString label = psMetadataLookupStr(&status, config->args, "-label"); 460 if (!status) { 461 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -label"); 462 return false; 463 } 464 if (!label) { 465 psError(PS_ERR_UNKNOWN, true, "-label is required"); 466 return false; 467 } 468 469 char *query = "DELETE FROM p3Mask WHERE label = '%s'"; 470 471 if (!p_psDBRunQuery(config->dbh, query, label)) { 472 psError(PS_ERR_UNKNOWN, false, "database error"); 473 psFree(query); 474 return false; 475 } 476 477 return true; 478 } -
trunk/ippTools/src/camtool.h
r9392 r9790 28 28 P3TOOL_MODE_PENDINGIMFILE, 29 29 P3TOOL_MODE_ADDPROCESSEDEXP, 30 P3TOOL_MODE_BLOCK, 31 P3TOOL_MODE_MASKED, 32 P3TOOL_MODE_UNBLOCK 30 33 } p3toolMode; 31 34 -
trunk/ippTools/src/camtoolConfig.c
r9392 r9790 93 93 "define banana 2", NULL); 94 94 95 // -block 96 psMetadata *blockArgs = psMetadataAlloc(); 97 psMetadataAddStr(blockArgs, PS_LIST_TAIL, "-label", 0, 98 "name of a label to mask out", NULL); 99 100 // -masked 101 psMetadata *maskedArgs = psMetadataAlloc(); 102 psMetadataAddBool(maskedArgs, PS_LIST_TAIL, "-simple", 0, 103 "use the simple output format", false); 104 105 // -unblock 106 psMetadata *unblockArgs = psMetadataAlloc(); 107 psMetadataAddStr(unblockArgs, PS_LIST_TAIL, "-label", 0, 108 "name of a label to unmask", NULL); 109 95 110 #define PXTOOL_MODE(option, modeval, argset) \ 96 111 { \ … … 116 131 PXTOOL_MODE("-pendingimfile",P3TOOL_MODE_PENDINGIMFILE,pendingimfileArgs); 117 132 PXTOOL_MODE("-addprocessedexp", P3TOOL_MODE_ADDPROCESSEDEXP, addprocessedexpArgs); 133 PXTOOL_MODE("-block", P3TOOL_MODE_BLOCK, blockArgs); 134 PXTOOL_MODE("-masked", P3TOOL_MODE_MASKED, maskedArgs); 135 PXTOOL_MODE("-unblock", P3TOOL_MODE_UNBLOCK, unblockArgs); 118 136 119 137 bool argErr = false; -
trunk/ippTools/src/chiptool.c
r9765 r9790 711 711 pendingExp->exp_tag, 712 712 pendingExp->p1_version, 713 pendingExp->p2_version 713 pendingExp->p2_version, 714 pendingExp->label 714 715 ); 715 716 } -
trunk/ippTools/src/pxtables.c
r9764 r9790 60 60 CREATE_TABLE(p3PendingExpCreateTable); 61 61 CREATE_TABLE(p3ProcessedExpCreateTable); 62 CREATE_TABLE(p3MaskCreateTable); 62 63 CREATE_TABLE(detRunCreateTable); 63 64 CREATE_TABLE(detInputExpCreateTable); … … 119 120 DROP_TABLE(p3PendingExpDropTable); 120 121 DROP_TABLE(p3ProcessedExpDropTable); 122 DROP_TABLE(p3MaskDropTable); 121 123 DROP_TABLE(detRunDropTable); 122 124 DROP_TABLE(detInputExpDropTable);
Note:
See TracChangeset
for help on using the changeset viewer.
