Changeset 16733 for trunk/ippTools/src/warptool.c
- Timestamp:
- Feb 28, 2008, 3:06:02 PM (18 years ago)
- File:
-
- 1 edited
-
trunk/ippTools/src/warptool.c (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippTools/src/warptool.c
r16253 r16733 33 33 34 34 static psS64 definerunMode(pxConfig *config); 35 static bool runoneMode(pxConfig *config);36 35 static bool updaterunMode(pxConfig *config); 37 static bool addinputexpMode(pxConfig *config);38 36 static bool expMode(pxConfig *config); 39 37 static bool imfileMode(pxConfig *config); … … 69 67 switch (config->mode) { 70 68 MODECASE(WARPTOOL_MODE_DEFINERUN, definerunMode); 71 MODECASE(WARPTOOL_MODE_RUNONE, runoneMode);72 69 MODECASE(WARPTOOL_MODE_UPDATERUN, updaterunMode); 73 MODECASE(WARPTOOL_MODE_ADDINPUTEXP, addinputexpMode);74 70 MODECASE(WARPTOOL_MODE_EXP, expMode); 75 71 MODECASE(WARPTOOL_MODE_IMFILE, imfileMode); … … 108 104 109 105 // required options 106 PXOPT_LOOKUP_STR(cam_id, config->args, "-cam_id", true, false); 110 107 PXOPT_LOOKUP_STR(mode, config->args, "-mode", true, false); 111 108 // check mode … … 122 119 123 120 // default 121 PXOPT_LOOKUP_TIME(registered, config->args, "-registered", false, false); 122 PXOPT_LOOKUP_BOOL(magiced, config->args, "-magiced", false); 124 123 PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false); 125 PXOPT_LOOKUP_TIME(registered, config->args, "-registered", false, false);126 124 127 125 warpRunRow *warpRun = warpRunRowAlloc( 128 126 0, // ID 127 (psS64)atoll(cam_id), 129 128 mode, 130 129 "reg", // state … … 134 133 tess_id, 135 134 end_stage, 136 registered 135 registered, 136 magiced 137 137 ); 138 138 if (!warpRun) { … … 161 161 } 162 162 163 static bool runoneMode(pxConfig *config)164 {165 PS_ASSERT_PTR_NON_NULL(config, false);166 167 if (!psDBTransaction(config->dbh)) {168 psError(PS_ERR_UNKNOWN, false, "database error");169 return false;170 }171 172 psS64 warp_id = definerunMode(config);173 if (!warp_id) {174 // rollback175 if (!psDBRollback(config->dbh)) {176 psError(PS_ERR_UNKNOWN, false, "database error");177 }178 psError(PS_ERR_UNKNOWN, false, "failed to define warpRun");179 return false;180 }181 182 psString warp_id_str = psDBIntToString(warp_id);183 if (!psMetadataAddStr(config->args, PS_LIST_TAIL, "-warp_id", 0, NULL, warp_id_str)) {184 // rollback185 if (!psDBRollback(config->dbh)) {186 psError(PS_ERR_UNKNOWN, false, "database error");187 }188 psError(PS_ERR_UNKNOWN, false, "failed to add item warp_id");189 psFree(warp_id_str);190 return false;191 }192 psFree(warp_id_str);193 194 if (!addinputexpMode(config)) {195 // rollback196 if (!psDBRollback(config->dbh)) {197 psError(PS_ERR_UNKNOWN, false, "database error");198 }199 psError(PS_ERR_UNKNOWN, false, "failed to add cam_id to warpRun");200 return false;201 }202 if (!pxwarpRunSetState(config, warp_id, "run")) {203 // rollback204 if (!psDBRollback(config->dbh)) {205 psError(PS_ERR_UNKNOWN, false, "database error");206 }207 psError(PS_ERR_UNKNOWN, false, "failed to set warpRun.state to run");208 return false;209 }210 211 // point of no return212 if (!psDBCommit(config->dbh)) {213 psError(PS_ERR_UNKNOWN, false, "database error");214 return false;215 }216 217 return true;218 }219 163 220 164 static bool updaterunMode(pxConfig *config) … … 228 172 // set detRun.state to state 229 173 return pxwarpRunSetState(config, (psS64)atoll(warp_id), state); 230 }231 232 return true;233 }234 235 236 static bool addinputexpMode(pxConfig *config)237 {238 PS_ASSERT_PTR_NON_NULL(config, false);239 240 PXOPT_LOOKUP_STR(warp_id, config->args, "-warp_id", true, false);241 PXOPT_LOOKUP_STR(cam_id, config->args, "-cam_id", true, false);242 243 // defaults to false244 PXOPT_LOOKUP_BOOL(magiced, config->args, "-magiced", false);245 246 if (!warpInputExpInsert(config->dbh,247 (psS64)atoll(warp_id),248 (psS64)atoll(cam_id),249 magiced250 )) {251 psError(PS_ERR_UNKNOWN, false, "database error");252 return false;253 174 } 254 175
Note:
See TracChangeset
for help on using the changeset viewer.
