Changeset 26220
- Timestamp:
- Nov 20, 2009, 3:21:14 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/20091113/psastro/src/psastroLoadRefstars.c
r24805 r26220 50 50 return false; 51 51 } 52 53 // the name in the recipe may be one of: 54 // (A) the actual directory name 55 // (B) a reference to the name in the PSASTRO.CATDIRS folder in site.config 56 // (C) a reference to a folder in the PSASTRO.CATDIRS folder in site.config, containing multiple copy locations 52 57 char *catdir_virtual = psMetadataLookupStr(&status, catdirs, catdir_recipe); 58 59 psMetadata *catdir_folder = psMetadataLookupMetadata(&status, catdirs, catdir_recipe); 60 if (catdir_folder) { 61 // randomly choose one of the entries 62 psLogMsg ("psastro", 3, "choosing catdir_folder\n"); 63 int nEntry = catdir_folder->list->n; 64 65 psRandom *rng = psRandomAlloc(PS_RANDOM_TAUS); 66 double frnd = psRandomUniform(rng); 67 int entry = PS_MIN(nEntry - 1, PS_MAX(0, nEntry * frnd)); 68 psFree(rng); 69 70 psMetadataItem *item = psListGet(catdir_folder->list, entry); 71 if (item->type != PS_DATA_STRING) { 72 psError(PSASTRO_ERR_CONFIG, true, "Invalid entry in PSASTRO.CATDIR folder: %s\n", item->name); 73 return false; 74 } 75 catdir_virtual = item->data.str; 76 } 77 53 78 char *catdir = (catdir_virtual == NULL) ? catdir_recipe : catdir_virtual; 54 79 … … 56 81 psString CATDIR = pmConfigConvertFilename(catdir, config, false, false); // Resolved filename 57 82 PS_ASSERT (CATDIR, NULL); 83 84 psLogMsg ("psastro", 3, "looking up reference objects in %s\n", CATDIR); 58 85 59 86 char *getstarCommand = psStringCopy(psMetadataLookupStr(NULL, recipe, "DVO.GETSTAR"));
Note:
See TracChangeset
for help on using the changeset viewer.
