Changeset 5462 for trunk/archive/scripts/src/phase2/psAdditionals.c
- Timestamp:
- Nov 2, 2005, 3:30:32 PM (21 years ago)
- File:
-
- 1 edited
-
trunk/archive/scripts/src/phase2/psAdditionals.c (modified) (11 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/archive/scripts/src/phase2/psAdditionals.c
r5104 r5462 15 15 psError(PS_ERR_IO, true, "Couldn't find %s in the metadata.\n"); 16 16 } 17 } else if (item->type != PS_ META_META) {17 } else if (item->type != PS_DATA_METADATA) { 18 18 // The value at the key isn't metadata 19 19 if (status) { 20 20 *status = false; 21 21 } else { 22 psLogMsg(__func__, PS_LOG_WARN, "%s isn't of type PS_ META_META, as expected.\n");22 psLogMsg(__func__, PS_LOG_WARN, "%s isn't of type PS_DATA_METADATA, as expected.\n"); 23 23 } 24 24 value = NULL; … … 45 45 psError(PS_ERR_IO, true, "Couldn't find %s in the metadata.\n"); 46 46 } 47 } else if (item->type != PS_ META_STR) {47 } else if (item->type != PS_DATA_STRING) { 48 48 // The value at the key isn't of the desired type 49 49 if (status) { 50 50 *status = false; 51 51 } else { 52 psLogMsg(__func__, PS_LOG_WARN, "%s isn't of type PS_ META_STR, as expected.\n");52 psLogMsg(__func__, PS_LOG_WARN, "%s isn't of type PS_DATA_STRING, as expected.\n"); 53 53 } 54 54 value = NULL; … … 79 79 printf(": "); 80 80 switch (item->type) { 81 case PS_ META_STR:81 case PS_DATA_STRING: 82 82 printf("%s", item->data.V); 83 83 break; 84 case PS_ META_BOOL:84 case PS_DATA_BOOL: 85 85 if (item->data.B) { 86 86 printf("True"); … … 89 89 } 90 90 break; 91 case PS_ META_S32:91 case PS_DATA_S32: 92 92 printf("%d", item->data.S32); 93 93 break; 94 case PS_ META_F32:94 case PS_DATA_F32: 95 95 printf("%f", item->data.F32); 96 96 break; 97 case PS_ META_F64:97 case PS_DATA_F64: 98 98 printf("%f", item->data.F64); 99 99 break; 100 case PS_ META_META:100 case PS_DATA_METADATA: 101 101 printf("\n"); 102 102 psMetadataPrint(item->data.V, level + 1); … … 200 200 switch(item->type) { 201 201 // Only doing a representative set of types 202 case PS_ META_S32:202 case PS_DATA_S32: 203 203 newItem = psMetadataItemAlloc(item->name, item->type, item->comment, atoi(argv[argnum])); 204 204 psArgumentRemove(argnum, argc, argv); 205 205 break; 206 case PS_ META_F32:206 case PS_DATA_F32: 207 207 newItem = psMetadataItemAlloc(item->name, item->type, item->comment, atof(argv[argnum])); 208 208 psArgumentRemove(argnum, argc, argv); 209 209 break; 210 case PS_ META_BOOL:210 case PS_DATA_BOOL: 211 211 // Turn option on; no optional argument to remove 212 212 newItem = psMetadataItemAlloc(item->name, item->type, item->comment, true); 213 213 break; 214 214 // XXX: Include the other numerical types 215 case PS_ META_STR:215 case PS_DATA_STRING: 216 216 { 217 217 //psString string = psStringCopy(argv[argnum]); // Get the argument into PS memory management … … 250 250 if (argItem) { 251 251 psArgumentRemove(i, argc, argv); // Remove the switch 252 if (argItem->type != PS_ META_MULTI) {253 if (argItem->type != PS_ META_BOOL && *argc < i + 1) {252 if (argItem->type != PS_DATA_METADATA_MULTI) { 253 if (argItem->type != PS_DATA_BOOL && *argc < i + 1) { 254 254 psError(PS_ERR_IO, true, "Required argument for %s is missing.\n", argItem->name); 255 255 // XXX: Cleanup before returning … … 318 318 switch (oldItem->type) { 319 319 // Only doing a representative set of types 320 case PS_ META_S32:320 case PS_DATA_S32: 321 321 oldItem->data.S32 = newItem->data.S32; 322 322 break; 323 case PS_ META_F32:323 case PS_DATA_F32: 324 324 oldItem->data.F32 = newItem->data.F32; 325 325 break; 326 case PS_ META_BOOL:326 case PS_DATA_BOOL: 327 327 oldItem->data.B = newItem->data.B; 328 328 break; 329 329 // XXX: Include the other numerical types 330 case PS_ META_STR:330 case PS_DATA_STRING: 331 331 psFree(oldItem->data.V); 332 332 oldItem->data.V = psMemIncrRefCounter(newItem->data.V); 333 333 break; 334 case PS_ META_MULTI:334 case PS_DATA_METADATA_MULTI: 335 335 { 336 336 psList *newMulti = psMemIncrRefCounter(newItem->data.V); // The new list of MULTI … … 347 347 switch (oldMultiItem->type) { 348 348 // Only doing a representative set of types 349 case PS_ META_S32:349 case PS_DATA_S32: 350 350 oldItem->data.S32 = newItem->data.S32; 351 351 break; 352 case PS_ META_F32:352 case PS_DATA_F32: 353 353 oldItem->data.F32 = newItem->data.F32; 354 354 break; 355 355 // XXX: Include the other numerical types 356 case PS_ META_STR:356 case PS_DATA_STRING: 357 357 psFree(oldItem->data.V); 358 358 oldItem->data.V = psMemIncrRefCounter(newItem->data.V); … … 385 385 switch (arg->type) { 386 386 // Only doing a representative set of types 387 case PS_ META_S32:387 case PS_DATA_S32: 388 388 return arg->data.S32 >= 0 ? (int)log10f((float)arg->data.S32) + 1 : 389 389 (int)log10f(-(float)arg->data.S32) + 2; 390 390 // XXX: Other numerical types 391 case PS_ META_F32:391 case PS_DATA_F32: 392 392 return arg->data.F32 >= 0 ? 12 : 13; // -d.dddddde?dd 393 case PS_ META_F64:393 case PS_DATA_F64: 394 394 return arg->data.F64 >= 0 ? 12 : 13; // -d.dddddde?dd 395 case PS_ META_BOOL:395 case PS_DATA_BOOL: 396 396 return arg->data.B ? 4 : 5; 397 case PS_ META_STR:397 case PS_DATA_STRING: 398 398 return strlen(arg->data.V); 399 399 default: … … 450 450 switch (argItem->type) { 451 451 // Only doing a representative set of types 452 case PS_ META_S32:452 case PS_DATA_S32: 453 453 printf("%d", argItem->data.S32); 454 454 break; 455 455 // XXX: Other numerical types 456 case PS_ META_F32:456 case PS_DATA_F32: 457 457 printf("%.6e", argItem->data.F32); 458 458 break; 459 case PS_ META_F64:459 case PS_DATA_F64: 460 460 printf("%.6e", argItem->data.F64); 461 461 break; 462 case PS_ META_BOOL:462 case PS_DATA_BOOL: 463 463 if (argItem->data.B) { 464 464 printf("TRUE"); … … 467 467 } 468 468 break; 469 case PS_ META_STR:469 case PS_DATA_STRING: 470 470 printf("%s", argItem->data.V); 471 471 break;
Note:
See TracChangeset
for help on using the changeset viewer.
