Changeset 6417 for trunk/ippTools/src/regtoolConfig.c
- Timestamp:
- Feb 9, 2006, 4:43:17 PM (20 years ago)
- File:
-
- 1 edited
-
trunk/ippTools/src/regtoolConfig.c (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippTools/src/regtoolConfig.c
r6368 r6417 7 7 8 8 if (! pmConfigRead(&config->site, &config->camera, &config->recipe, &argc, argv, RECIPE)) { 9 psError StackPrint(stderr, "Can't find site configuration!\n");9 psError(PS_ERR_UNKNOWN, false, "Can't find site configuration!\n"); 10 10 exit(EXIT_FAILURE); 11 11 } 12 13 // Parse other command-line arguments14 psMetadata *arguments = psMetadataAlloc(); // The arguments, with default values15 12 16 13 int N; … … 19 16 psArgumentRemove (N, &argc, argv); 20 17 if (config->mode) { 21 ps Abort (argv[0], "only one mode selection is allowed");18 psError(PS_ERR_UNKNOWN, true, "only one mode selection is allowed"); 22 19 } 23 20 config->mode = PX_MODE_PENDING; … … 26 23 psArgumentRemove (N, &argc, argv); 27 24 if (config->mode) { 28 ps Abort (argv[0], "only one mode selection is allowed");25 psError(PS_ERR_UNKNOWN, true, "only one mode selection is allowed"); 29 26 } 30 27 config->mode = PX_MODE_UPDATE; … … 32 29 33 30 // paul's argument parsing convention requires: -key value 34 psMetadataAddStr(arguments, PS_LIST_TAIL, "-pending", 0, "examine pending image table, write ppImage output", ""); 35 psMetadataAddStr(arguments, PS_LIST_TAIL, "-update", 0, "update pending image table", ""); 31 // Parse other command-line arguments 32 psMetadata *args = psMetadataAlloc(); 33 psMetadataAddStr(args , PS_LIST_TAIL, "-pending", 0, 34 "examine pending image table, write ppImage output", ""); 35 psMetadataAddStr(args , PS_LIST_TAIL, "-update", 0, 36 "update pending image table", ""); 36 37 37 38 38 39 // -pending search 39 psMetadataAddStr(arguments, PS_LIST_TAIL, "-exp_id", 0, "define exposure ID", ""); 40 psMetadataAddStr(arguments, PS_LIST_TAIL, "-inst", 0, "define camera of interest", ""); 41 psMetadataAddStr(arguments, PS_LIST_TAIL, "-telescope", 0, "define camera of interest", ""); 42 psMetadataAddStr(arguments, PS_LIST_TAIL, "-exp_type", 0, "define class", ""); 43 psMetadataAddStr(arguments, PS_LIST_TAIL, "-class", 0, "define class", ""); 40 psMetadata *pendingArgs = psMetadataAlloc(); 41 psMetadataAddStr(pendingArgs, PS_LIST_TAIL, "-exp_id", 0, 42 "define exposure ID", ""); 43 psMetadataAddStr(pendingArgs, PS_LIST_TAIL, "-inst", 0, 44 "define camera of interest", ""); 45 psMetadataAddStr(pendingArgs, PS_LIST_TAIL, "-telescope", 0, 46 "define camera of interest", ""); 47 psMetadataAddStr(pendingArgs, PS_LIST_TAIL, "-exp_type", 0, 48 "define class", ""); 49 psMetadataAddStr(pendingArgs, PS_LIST_TAIL, "-class", 0, 50 "define class", ""); 51 44 52 45 53 // -update inputs 46 // psMetadataAddStr(arguments, PS_LIST_TAIL, "-exp_id", 0, "define class", ""); 47 psMetadataAddStr(arguments, PS_LIST_TAIL, "-filter", 0, "define filter of interest", ""); 48 psMetadataAddStr(arguments, PS_LIST_TAIL, "-stat", 0, "define URL", ""); 49 psMetadataAddStr(arguments, PS_LIST_TAIL, "-recipe", 0, "define URL", ""); 50 psMetadataAddStr(arguments, PS_LIST_TAIL, "-mosiac", 0, "define URL", ""); 54 psMetadata *updateArgs = psMetadataAlloc(); 55 psMetadataAddStr(updateArgs, PS_LIST_TAIL, "-exp_id", 0, 56 "define class", ""); 57 psMetadataAddStr(updateArgs, PS_LIST_TAIL, "-filter", 0, 58 "define filter of interest", ""); 59 psMetadataAddStr(updateArgs, PS_LIST_TAIL, "-stat", 0, 60 "define URL", ""); 61 psMetadataAddStr(updateArgs, PS_LIST_TAIL, "-recipe", 0, 62 "define URL", ""); 63 psMetadataAddStr(updateArgs, PS_LIST_TAIL, "-mosiac", 0, 64 "define URL", ""); 51 65 66 bool argErr = false; 52 67 if (config->mode == PX_MODE_NONE) { 53 fprintf (stderr, "search mode not specified\n"); 54 psArgumentHelp(arguments); 55 psFree(arguments); 68 argErr = true; 69 fprintf (stderr, "mode argument is required\n"); 70 } else if (! psArgumentParse(args, &argc, argv) || argc != 1) { 71 argErr = true; 72 fprintf (stderr, "error parsing arguments\n"); 73 } 74 75 if (argErr) { 76 printf("\nPan-STARRS Phase 0 Search Tool\n"); 77 printf("Usage: %s <mode> [<options>]\n\n", argv[0]); 78 printf(" <mode> : -pending | -update\n\n"); 79 fprintf (stdout, "-pending "); 80 psArgumentHelp(pendingArgs); 81 fprintf (stdout, "-update "); 82 psArgumentHelp(updateArgs); 83 psFree(args); 84 psFree(pendingArgs); 85 psFree(updateArgs); 56 86 exit(EXIT_FAILURE); 57 87 } 58 59 if (! psArgumentParse(arguments, &argc, argv) || argc != 1) {60 printf("\nPan-STARRS Phase 2 Search Tool\n\n");61 printf("Usage: %s [mode] [options]\n\n", argv[0]);62 printf(" [mode] : -quick | -define | -pending | -donee\n\n");63 psArgumentHelp(arguments);64 psFree(arguments);65 exit(EXIT_FAILURE);66 }67 68 bool status;69 config->camera_name = psMetadataLookupStr(&status, arguments,70 "-inst");71 config->filter = psMetadataLookupStr(&status, arguments, "-filter");72 config->exp_id = psMetadataLookupStr(&status, arguments, "-exp_id");73 config->class = psMetadataLookupStr(&status, arguments, "-class");74 config->class_id = psMetadataLookupStr(&status, arguments,75 "-class_id");76 config->url = psMetadataLookupStr(&status, arguments, "-url");77 88 78 89 // XXX why is "" being returned when -[foo] isn't specified? … … 82 93 } 83 94 84 EMPTY_TO_NULL_STRING(config->camera_name); 85 EMPTY_TO_NULL_STRING(config->filter); 86 EMPTY_TO_NULL_STRING(config->exp_id); 87 EMPTY_TO_NULL_STRING(config->class); 88 EMPTY_TO_NULL_STRING(config->class_id); 89 EMPTY_TO_NULL_STRING(config->url); 95 switch (config->mode) { 96 bool status; 97 case PX_MODE_PENDING: 98 // -exp_id 99 config->exp_id = psMetadataLookupStr(&status, args, "-exp_id"); 100 psMemIncrRefCounter(config->exp_id); 101 EMPTY_TO_NULL_STRING(config->exp_id); 102 // -inst 103 config->camera_name = psMetadataLookupStr(&status, args, "-inst"); 104 psMemIncrRefCounter(config->camera_name); 105 EMPTY_TO_NULL_STRING(config->camera_name); 106 // -telescope 107 config->camera_name = psMetadataLookupStr(&status, args, 108 "-telescope"); 109 psMemIncrRefCounter(config->telescope); 110 EMPTY_TO_NULL_STRING(config->telescope); 111 // -exp_type 112 config->class = psMetadataLookupStr(&status, args, "-exp_type"); 113 psMemIncrRefCounter(config->exp_type); 114 EMPTY_TO_NULL_STRING(config->exp_type); 115 // -class 116 config->class = psMetadataLookupStr(&status, args, "-class"); 117 psMemIncrRefCounter(config->class); 118 EMPTY_TO_NULL_STRING(config->class); 119 break; 120 case PX_MODE_UPDATE: 121 // -exp_id 122 config->exp_id = psMetadataLookupStr(&status, args, "-exp_id"); 123 psMemIncrRefCounter(config->exp_id); 124 EMPTY_TO_NULL_STRING(config->exp_id); 125 // -filter 126 config->filter = psMetadataLookupStr(&status, args, "-filter"); 127 psMemIncrRefCounter(config->filter); 128 EMPTY_TO_NULL_STRING(config->filter); 129 130 break; 131 default: 132 psAbort(argv[0], "invalid option (this should not happen)"); 133 } 134 135 psFree(args); 136 psFree(pendingArgs); 137 psFree(updateArgs); 138 90 139 91 140 psMetadata *where = psMetadataAlloc(); … … 132 181 133 182 134 // add the input and output images to the arg uments list135 //psMetadataAddStr (arg uments, PS_LIST_TAIL, "-output", 0, "Name of the output image", argv[1]);183 // add the input and output images to the args list 184 //psMetadataAddStr (args, PS_LIST_TAIL, "-output", 0, "Name of the output image", argv[1]); 136 185 137 186 // define Database handle, if used
Note:
See TracChangeset
for help on using the changeset viewer.
