IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 10422


Ignore:
Timestamp:
Dec 3, 2006, 4:14:09 PM (19 years ago)
Author:
magnier
Message:

updated pmConfigReadRecipes to implement config inheritence

Location:
trunk/psModules/src/config
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/config/pmConfig.c

    r10421 r10422  
    44 *  @author EAM (IfA)
    55 *
    6  *  @version $Revision: 1.55 $ $Name: not supported by cvs2svn $
    7  *  @date $Date: 2006-12-03 18:48:10 $
     6 *  @version $Revision: 1.56 $ $Name: not supported by cvs2svn $
     7 *  @date $Date: 2006-12-04 02:14:09 $
    88 *
    99 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    5454    config->cameraName = NULL;
    5555    config->recipes = psMetadataAlloc();
    56     config->recipesRead = P_PM_RECIPE_SOURCE_NONE;
     56    config->recipesRead = PM_RECIPE_SOURCE_NONE;
    5757    config->recipesSource = psMetadataAlloc();
    5858    config->arguments = psMetadataAlloc();
     
    6060    config->argc = argc;
    6161    config->argv = argv;
     62    config->defaultRecipe = NULL;
    6263    config->workdir = NULL;
    6364
     
    205206
    206207
    207 pmConfig *pmConfigRead(int *argc, char **argv)
     208pmConfig *pmConfigRead(int *argc, char **argv, char *defaultRecipe)
    208209{
    209210    PS_ASSERT_PTR_NON_NULL(argc, NULL);
     
    212213
    213214    pmConfig *config = pmConfigAlloc(argc, argv); // The configuration, containing site, camera and recipes
     215    config->defaultRecipe = defaultRecipe;
    214216
    215217    //
     
    365367            // expanded in the future to do files, and perhaps even sockets.
    366368            if (!psTraceSetDestination(psMessageDestination(traceDest))) {
    367                 psLogMsg(__func__, PS_LOG_WARN, "Unable to set trace destination to %s\n",
    368                          config->argv[argNum]);
     369                psLogMsg(__func__, PS_LOG_WARN, "Unable to set trace destination to %s\n", traceDest);
     370
    369371            }
    370372        }
     
    442444
    443445    // Load the recipes from the camera file, if appropriate
    444     if(!pmConfigReadRecipes(config)) {
     446    if(!pmConfigReadRecipes(config, PM_RECIPE_SOURCE_SITE | PM_RECIPE_SOURCE_CAMERA)) {
    445447        psError(PS_ERR_IO, false, "Failed to read recipes from camera file");
    446448        psFree(config);
    447449        return NULL;
    448450    }
     451
     452    // load command-line options of the form -recipe NAME RECIPE
     453    pmConfigLoadRecipeArguments (config);
     454
     455    // read in command-line options to specific recipe values
     456    pmConfigLoadRecipeOptions (config, "-D");
     457    pmConfigLoadRecipeOptions (config, "-Di");
     458    pmConfigLoadRecipeOptions (config, "-Df");
     459    pmConfigLoadRecipeOptions (config, "-Db");
    449460
    450461    psErrorClear();   // we may have failed to find some items in the metadata
     
    606617
    607618        // Now we have the camera, we can read the recipes
    608         pmConfigReadRecipes(config);
     619        pmConfigReadRecipes(config, PM_RECIPE_SOURCE_CAMERA | PM_RECIPE_SOURCE_CL);
    609620
    610621        return format;
     
    650661
    651662
    652 // Load the recipes
     663// Load the recipes: each time we load a specific recipe, it overrides the metadata
     664// entries for an existing recipe metadata
    653665static bool loadRecipes(pmConfig *config, // The configuration into which to read the recipes
    654666                        psMetadata *source, // The source configuration, from which to read the filenames
    655                         p_pmRecipeSource sourceType, // The source type
     667                        pmRecipeSource sourceType, // The source type
    656668                        const char *sourceName // The name of the source, for error messages
    657669                       )
     
    660672
    661673    if (!source) {
    662         #if 0
    663         psLogMsg(__func__, PS_LOG_WARN, "The %s has not been read --- cannot read recipes from this "
    664                  "location.\n", sourceName);
    665         #endif
    666 
     674        psTrace("psModules.pmConfig", 4, "The %s has not been read --- cannot read recipes from this "
     675                "location.\n", sourceName);
    667676        config->recipesRead &= ~sourceType;
    668677        return false;
     
    672681    psMetadata *recipes = psMetadataLookupMetadata(&mdok, source, "RECIPES"); // The list of recipes
    673682    if (!mdok || !recipes) {
    674         psLogMsg(__func__, PS_LOG_WARN, "RECIPES in the %s is not of type METADATA --- ignored\n",
     683        psLogMsg("psModules.pmConfig", PS_LOG_WARN, "RECIPES in the %s is not of type METADATA --- ignored\n",
    675684                 sourceName);
    676685        config->recipesRead &= ~sourceType;
    677686        return false;
    678687    }
     688
     689    // for sourceType == SITE | CAMERA, RECIPES contains a list of files to be read (pmConfigFileRead)
     690    // for sourceType == CL, RECIPES contains a list of metadata already loaded
    679691
    680692    // Copy the filenames to the target from the "RECIPES" in the source.
     
    686698        while ((fileItem = psMetadataGetAndIncrement(recipesIter)))
    687699        {
    688             if (fileItem->type != PS_DATA_STRING) {
    689                 psLogMsg(__func__, PS_LOG_WARN, "Recipe %s from %s is not of type STR --- ignored.\n",
    690                          fileItem->name, sourceName);
    691                 continue;
    692             }
    693 
    694             // Check to see if it's currently defined
    695             int check = psMetadataLookupS32(&mdok, config->recipesSource, fileItem->name);
    696             if (mdok && check > sourceType) {
    697                 // It's already defined with a higher priority
    698                 continue;
    699             }
    700             psString comment = psStringCopy("Recipe added at ");
    701             psStringAppend(&comment, "%s from %s", sourceName, (char*)fileItem->data.V);
    702             psMetadataAddS32(config->recipesSource, PS_LIST_TAIL, fileItem->name,
    703                              PS_META_REPLACE, comment, sourceType);
    704             psFree(comment);
    705 
    706             // Read the recipe
    707             psMetadata *recipe = NULL;      // Recipe from file
    708             if (pmConfigFileRead(&recipe, fileItem->data.V, "recipe")) {
    709                 psMetadataAdd(config->recipes, PS_LIST_TAIL, fileItem->name,
    710                               PS_DATA_METADATA | PS_META_REPLACE, fileItem->comment, recipe);
    711             } else {
    712                 psError(PS_ERR_IO, false, "Failed to read recipe");
    713 
    714                 psFree(recipe);  // Drop reference
    715                 psFree(recipesIter);
    716 
    717                 return false;
    718             }
    719             psFree(recipe);                 // Drop reference
     700            psMetadata *recipe = NULL;
     701            psMetadata *current = NULL;
     702
     703            switch (sourceType) {
     704            case PM_RECIPE_SOURCE_SITE:
     705            case PM_RECIPE_SOURCE_CAMERA:
     706                // type mismatch is a serious error
     707                if (fileItem->type != PS_DATA_STRING) {
     708                    psAbort ("pmConfig", "%s in %s RECIPES is not of type STR", fileItem->name, sourceName);
     709                }
     710
     711                // Check to see if it's currently defined
     712                // XXX EAM : I think this check is now not needed?
     713                int check = psMetadataLookupS32(&mdok, config->recipesSource, fileItem->name);
     714                if (mdok && check > sourceType) {
     715                    // It's already defined with a higher priority
     716                    continue;
     717                }
     718                psString comment = psStringCopy("Recipe added at ");
     719                psStringAppend(&comment, "%s from %s", sourceName, (char*)fileItem->data.V);
     720                psTrace ("psModules.pmConfig", 3, comment);
     721                psMetadataAddS32(config->recipesSource, PS_LIST_TAIL, fileItem->name,
     722                                 PS_META_REPLACE, comment, sourceType);
     723                psFree(comment);
     724
     725                // Read the recipe file.
     726                if (!pmConfigFileRead(&recipe, fileItem->data.V, "recipe")) {
     727                    psError(PS_ERR_IO, false, "Failed to read recipe");
     728                    psFree(recipe);  // Drop reference
     729                    psFree(recipesIter);
     730                    return false;
     731                }
     732                break;
     733
     734            case PM_RECIPE_SOURCE_CL:
     735                // type mismatch is a serious error
     736                if (fileItem->type != PS_DATA_METADATA) {
     737                    psAbort ("pmConfig", "%s in %s RECIPES is not of type METADATA", fileItem->name, sourceName);
     738                }
     739                // increment the ref counter to protect the data
     740                recipe = psMemIncrRefCounter (fileItem->data.V);
     741                break;
     742
     743            default:
     744                psAbort ("pmConfig", "unknown sourceType");
     745            }
     746
     747            // if this named recipe exists, supplement it
     748            current = psMetadataLookupMetadata (NULL, config->recipes, fileItem->name);
     749            if (current) {
     750                psMemIncrRefCounter (current);
     751            }
     752            current = psMetadataCopy (current, recipe);
     753            psMetadataAdd(config->recipes, PS_LIST_TAIL, fileItem->name, PS_DATA_METADATA | PS_META_REPLACE, fileItem->comment, current);
     754            psFree(recipe);  // Drop reference
     755            psFree(current);  // Drop reference
    720756        }
    721757        psFree(recipesIter);
     
    729765        while ((sourceItem = psMetadataGetAndIncrement(recipesIter))) {
    730766            assert(sourceItem->type == PS_TYPE_S32); // It should be this type: we put it in ourselves
    731             if (sourceItem->data.S32 == P_PM_RECIPE_SOURCE_SYMBOLIC) {
     767            if (sourceItem->data.S32 == PM_RECIPE_SOURCE_SYMBOLIC) {
    732768                const char *linkName = sourceItem->comment; // The name of the link
    733769                psMetadata *linkSource = psMetadataLookupMetadata(&mdok, config->recipes, linkName); // The source
     
    748784}
    749785
    750 
    751 bool pmConfigReadRecipes(pmConfig *config)
     786// this function may be called several times.  it attempts to load the recipe data from one of
     787// three locations: config->site, config->camera, and config->argv we cannot read the recipes
     788// from config->camera until a camera has been read BUT, the argv recipes must override the
     789// camera and site recipes.
     790bool pmConfigReadRecipes(pmConfig *config, pmRecipeSource source)
    752791{
    753792    PS_ASSERT_PTR_NON_NULL(config, false);
     
    757796    }
    758797
    759     bool mdok = true;                   // Status of MD lookup
    760 
    761798    // Read the recipe file names from the site configuration and camera configuration
    762     if (config->site && !(config->recipesRead & P_PM_RECIPE_SOURCE_SITE)) {
    763         if(!loadRecipes(config, config->site, P_PM_RECIPE_SOURCE_SITE, "site configuration")) {
    764             psError(PS_ERR_IO, false, "Failed to read recipes from site config");
    765             #if 0     // see comment at end of routine
    766 
    767             return false;
    768             #endif
    769 
    770         }
    771     }
    772     if (config->camera && !(config->recipesRead & P_PM_RECIPE_SOURCE_CAMERA)) {
    773         if (!loadRecipes(config, config->camera, P_PM_RECIPE_SOURCE_CAMERA, "camera configuration")) {
    774             psError(PS_ERR_IO, false, "Failed to read recipes from camera config");
    775             #if 0     // see comment at end of routine
    776 
    777             return false;
    778             #endif
    779 
    780         }
    781     }
    782 
    783     if (!(config->recipesRead & P_PM_RECIPE_SOURCE_CL)) {
    784         // Go through the command-line arguments
    785         int argNum; // Argument number for "-recipe"
    786         while ((argNum = psArgumentGet(*config->argc, config->argv, "-recipe")) > 0) {
    787             psArgumentRemove(argNum, config->argc, config->argv);
    788             if (argNum + 1 >= *config->argc) {
    789                 psLogMsg(__func__, PS_LOG_WARN, "-recipe command-line switch provided without the "
    790                          "required recipe and source --- ignored.\n");
    791                 if (argNum == *config->argc) {
    792                     // Remove the single last argument (we required two, they gave us one)
    793                     psArgumentRemove(argNum, config->argc, config->argv);
    794                 }
    795                 continue;
    796             }
    797 
    798             const char *recipeName = psStringCopy(config->argv[argNum]); // Name of the recipe
    799             psArgumentRemove(argNum, config->argc, config->argv);
    800             const char *recipeSource = psStringCopy(config->argv[argNum]); // Source of the recipe
    801             psArgumentRemove(argNum, config->argc, config->argv);
    802 
    803             // Command-line has the highest priority, so we don't have to check to see if it's already there
    804 
    805             // Is the source a symbolic reference?
    806             psMetadata *extant = psMetadataLookupMetadata(&mdok, config->recipes,
    807                                  recipeSource); // Does it exist?
    808             if (mdok && extant) {
    809                 psString comment = psStringCopy("Recipe added from command line as symbolic link to ");
    810                 psStringAppend(&comment, "%s", recipeSource);
    811                 psMetadataAdd(config->recipes, PS_LIST_TAIL, recipeName, PS_DATA_METADATA | PS_META_REPLACE,
    812                               comment, extant);
    813                 psFree(comment);
    814                 // Put the source in the comment, so we can retrieve it again if we need it
    815                 psMetadataAddS32(config->recipesSource, PS_LIST_TAIL, recipeName, PS_META_REPLACE,
    816                                  recipeSource, P_PM_RECIPE_SOURCE_SYMBOLIC);
    817 
    818             } else if (access(recipeSource, R_OK) == 0) {
    819                 // The source is a file
    820                 psMetadata *recipe = NULL;      // Recipe from file
    821                 if (pmConfigFileRead(&recipe, recipeSource, "recipe")) {
    822                     psString comment = psStringCopy("Recipe added at command line from ");
    823                     psStringAppend(&comment, "%s", recipeSource);
    824                     psMetadataAdd(config->recipes, PS_LIST_TAIL, recipeName,
    825                                   PS_DATA_METADATA | PS_META_REPLACE, comment, recipe);
    826                     psFree(comment);
    827                     psFree(recipe);                 // Drop reference
    828                     psMetadataAddS32(config->recipesSource, PS_LIST_TAIL, recipeName, PS_META_REPLACE,
    829                                      "Recipe added from command line", P_PM_RECIPE_SOURCE_CL);
    830                 }
    831             } else {
    832                 // Assume it's a symbolic reference to something that's not yet read in
    833                 psMetadataAddS32(config->recipesSource, PS_LIST_TAIL, recipeName, PS_META_REPLACE,
    834                                  recipeSource, P_PM_RECIPE_SOURCE_SYMBOLIC);
    835             }
    836             psFree(recipeName);
    837             psFree(recipeSource);
    838         } // Iterating through the command-line arguments
    839         config->recipesRead |= P_PM_RECIPE_SOURCE_CL;
     799    // XXX EAM : I think it should be an error for config->site:recipes not to exist
     800    // for now, keep this as a warning
     801    if (config->site && (source & PM_RECIPE_SOURCE_SITE)) {
     802        if (!loadRecipes(config, config->site, PM_RECIPE_SOURCE_SITE, "site configuration")) {
     803            psLogMsg ("psModules.pmConfig", PS_LOG_WARN, "Failed to read recipes from site config");
     804        } else {
     805            psTrace ("psModules.pmConfig", 3, "read recipes from site config");
     806        }
     807    }
     808
     809    // camera-specific recipes are not required : note the absence with a message
     810    // camera-specific recipes may be read for a specified camera (in pmConfigRead) or
     811    // for an identified camera (in pmConfigCameraFormatFromHeader).  the second
     812    // set should not override the first set
     813    if (config->camera && (source & PM_RECIPE_SOURCE_CAMERA) && !(config->recipesRead & PM_RECIPE_SOURCE_CAMERA)) {
     814        if (!loadRecipes(config, config->camera, PM_RECIPE_SOURCE_CAMERA, "camera configuration")) {
     815            psLogMsg ("psModules.pmConfig", PS_LOG_DETAIL, "no recipe supplied by camera config");
     816        } else {
     817            psTrace ("psModules.pmConfig", 3, "read recipes from camera config");
     818        }
     819    }
     820
     821    // apply recipes loaded into config->arguments based on command-line arguments
     822    if (config->arguments && (source & PM_RECIPE_SOURCE_CL)) {
     823        if (!loadRecipes(config, config->arguments, PM_RECIPE_SOURCE_CL, "command-line arguments")) {
     824            psLogMsg ("psModules.pmConfig", PS_LOG_DETAIL, "no recipe supplied on command-line arguments");
     825        } else {
     826            psTrace ("psModules.pmConfig", 3, "read recipes from command-line arguments");
     827        }
    840828    }
    841829    /*
     
    10691057    return newName;
    10701058}
     1059
     1060// search for options of the form -D KEY VALUE or -D RECIPE:KEY VALUE
     1061bool pmConfigLoadRecipeOptions (pmConfig *config, char *flag)
     1062{
     1063
     1064    int argNum;
     1065
     1066    // save the recipes onto config->arguments:RECIPES
     1067    psMetadata *recipes = psMetadataLookupMetadata(NULL, config->arguments, "RECIPES");
     1068    if (!recipes) {
     1069        recipes = psMetadataAlloc ();
     1070        psMetadataAddPtr (config->arguments, PS_LIST_TAIL, "RECIPES",  PS_DATA_METADATA, "", recipes);
     1071    } else {
     1072        psMemIncrRefCounter (recipes); // so we can free options below if not allocated here
     1073    }
     1074
     1075    // -D key value (all added as string)
     1076    while ((argNum = psArgumentGet (*config->argc, config->argv, flag))) {
     1077        psArgumentRemove (argNum, config->argc, config->argv);
     1078
     1079        // do we have enough arguments?
     1080        if (argNum + 1 >= *config->argc) {
     1081            psError(PS_ERR_IO, true, "insufficient parameters for command-line argument -D");
     1082            return false;
     1083        }
     1084
     1085        // is a target recipe specified?
     1086        char *recipeName = NULL;
     1087        char *key;
     1088        psArray *words = psStringSplitArray(config->argv[argNum], ":", false);
     1089        switch (words->n) {
     1090        case 1:
     1091            recipeName = config->defaultRecipe;
     1092            if (!config->defaultRecipe) {
     1093                psError(PS_ERR_IO, true, "syntax error in parameter: no default recipe available; must specify recipe");
     1094                return false;
     1095            }
     1096            key = words->data[0];
     1097            break;
     1098        case 2:
     1099            recipeName = words->data[0];
     1100            key = words->data[1];
     1101            break;
     1102        default:
     1103            psError(PS_ERR_IO, true, "syntax error in parameter");
     1104            return false;
     1105        }
     1106
     1107        // if this recipe is already defined in recipes, supplement
     1108        psMetadata *recipe = psMetadataLookupMetadata(NULL, recipes, recipeName);
     1109        if (!recipe) {
     1110            recipe = psMetadataAlloc ();
     1111            psMetadataAddPtr (recipes, PS_LIST_TAIL, recipeName,  PS_DATA_METADATA, "", recipe);
     1112        } else {
     1113            psMemIncrRefCounter (recipe); // so we can free recipe below if not allocated here
     1114        }
     1115
     1116        bool valid = false;
     1117        if (!strcmp (flag, "-D")) {
     1118            psMetadataAddStr (recipe, PS_LIST_TAIL, key, PS_META_REPLACE, "", config->argv[argNum+1]);
     1119            valid = true;
     1120        }
     1121        if (!strcmp (flag, "-Di")) {
     1122            psMetadataAddS32 (recipe, PS_LIST_TAIL, key, PS_META_REPLACE, "", atoi(config->argv[argNum+1]));
     1123            valid = true;
     1124        }
     1125        if (!strcmp (flag, "-Df")) {
     1126            psMetadataAddF32 (recipe, PS_LIST_TAIL, key, PS_META_REPLACE, "", atof(config->argv[argNum+1]));
     1127            valid = true;
     1128        }
     1129        if (!strcmp (flag, "-Db")) {
     1130            if (!strcasecmp (config->argv[argNum+1], "true")) {
     1131                psMetadataAddBool (recipe, PS_LIST_TAIL, key, PS_META_REPLACE, "", true);
     1132            } else {
     1133                psMetadataAddBool (recipe, PS_LIST_TAIL, key, PS_META_REPLACE, "", false);
     1134            }
     1135            valid = true;
     1136        }
     1137        psFree (words);
     1138        psFree (recipe);
     1139        assert (valid);  // flag may be: -D, -Df, -Di, -Db
     1140
     1141        psArgumentRemove (argNum, config->argc, config->argv);
     1142        psArgumentRemove (argNum, config->argc, config->argv);
     1143    }
     1144    psFree (recipes);
     1145    return true;
     1146}
     1147
     1148// examine command-line arguments for -recipe KEY VALUE
     1149// if VALUE is an existing file, read as metadata and save on config->arguments with name = KEY
     1150// if VALUE is not an exiting file, it is a symbolic lookup.  ???
     1151bool pmConfigLoadRecipeArguments (pmConfig *config)
     1152{
     1153
     1154    // Go through the command-line arguments
     1155    int argNum; // Argument number for "-recipe"
     1156    while ((argNum = psArgumentGet(*config->argc, config->argv, "-recipe")) > 0) {
     1157        psArgumentRemove(argNum, config->argc, config->argv);
     1158        if (argNum + 1 >= *config->argc) {
     1159            psError(PS_ERR_IO, false, "-recipe command-line switch provided without the required recipe and source\n");
     1160            return false;
     1161        }
     1162
     1163        const char *recipeName = psStringCopy(config->argv[argNum]); // Name of the recipe
     1164        psArgumentRemove(argNum, config->argc, config->argv);
     1165        const char *recipeSource = psStringCopy(config->argv[argNum]); // Source of the recipe
     1166        psArgumentRemove(argNum, config->argc, config->argv);
     1167
     1168        if (access(recipeSource, R_OK) == 0) {
     1169            // The source is a file: load onto config->arguments
     1170            // save the recipes onto config->arguments:RECIPES
     1171            psMetadata *recipes = psMetadataLookupMetadata(NULL, config->arguments, "RECIPES");
     1172            if (!recipes) {
     1173                recipes = psMetadataAlloc ();
     1174                psMetadataAddPtr (config->arguments, PS_LIST_TAIL, "RECIPES",  PS_DATA_METADATA, "", recipes);
     1175            } else {
     1176                psMemIncrRefCounter (recipes); // so we can free options below if not allocated here
     1177            }
     1178
     1179            psMetadata *recipe = NULL;      // Recipe from file
     1180            if (pmConfigFileRead(&recipe, recipeSource, "recipe")) {
     1181                psString comment = psStringCopy("Recipe added at command line from ");
     1182                psStringAppend(&comment, "%s", recipeSource);
     1183                psMetadataAdd(recipes, PS_LIST_TAIL, recipeName, PS_DATA_METADATA | PS_META_REPLACE, comment, recipe);
     1184                psFree(comment);
     1185                psFree(recipe);                 // Drop reference
     1186            } else {
     1187                psAbort ("pmConfig.c", "error reading config file %s\n", recipeSource);
     1188            }
     1189            psFree (recipes);
     1190        } else {
     1191            // Assume it's a symbolic reference to something that's not yet read in
     1192            psMetadataAddS32(config->recipesSource, PS_LIST_TAIL, recipeName, PS_META_REPLACE,
     1193                             recipeSource, PM_RECIPE_SOURCE_SYMBOLIC);
     1194        }
     1195        psTrace ("psModules.pmConfig", 3, "read recipe %s from %s", recipeName, recipeSource);
     1196        psFree(recipeName);
     1197        psFree(recipeSource);
     1198    } // Iterating through the command-line arguments
     1199
     1200    return true;
     1201}
     1202
     1203# if (0)
     1204
     1205    // Is the source a symbolic reference?
     1206    // XXX EAM : need to be careful about hierachy and overrides
     1207    psMetadata *extant = psMetadataLookupMetadata(&mdok, config->recipes, recipeSource); // Does it exist?
     1208if (mdok && extant)
     1209{
     1210    psString comment = psStringCopy("Recipe added from command line as symbolic link to ");
     1211    psStringAppend(&comment, "%s", recipeSource);
     1212    psMetadataAdd(config->recipes, PS_LIST_TAIL, recipeName, PS_DATA_METADATA | PS_META_REPLACE,
     1213                  comment, extant);
     1214    psFree(comment);
     1215    // Put the source in the comment, so we can retrieve it again if we need it
     1216    psMetadataAddS32(config->recipesSource, PS_LIST_TAIL, recipeName, PS_META_REPLACE,
     1217                     recipeSource, PM_RECIPE_SOURCE_SYMBOLIC);
     1218
     1219} else
     1220
     1221    # endif
     1222
  • trunk/psModules/src/config/pmConfig.h

    r10421 r10422  
    99/// @author Eugene Magnier, IfA
    1010///
    11 /// @version $Revision: 1.19 $ $Name: not supported by cvs2svn $
    12 /// @date $Date: 2006-12-03 18:48:10 $
     11/// @version $Revision: 1.20 $ $Name: not supported by cvs2svn $
     12/// @date $Date: 2006-12-04 02:14:09 $
    1313///
    1414/// Copyright 2005-2006 Institute for Astronomy, University of Hawaii
     
    2828/// psModules --- there is no need for the user to know about it.
    2929typedef enum {
    30     P_PM_RECIPE_SOURCE_NONE        = 0x00, ///< None yet
    31     P_PM_RECIPE_SOURCE_SITE        = 0x01, ///< Site configuration
    32     P_PM_RECIPE_SOURCE_CAMERA      = 0x02, ///< Camera configuration
    33     P_PM_RECIPE_SOURCE_CL          = 0x04, ///< Command-line
    34     P_PM_RECIPE_SOURCE_SYMBOLIC    = 0x14, ///< Symbolic link, specified on command-line
    35     P_PM_RECIPE_SOURCE_ALL         = 0xff  ///< All sources
    36 } p_pmRecipeSource;
     30    PM_RECIPE_SOURCE_NONE        = 0x00, ///< None yet
     31    PM_RECIPE_SOURCE_SITE        = 0x01, ///< Site configuration
     32    PM_RECIPE_SOURCE_CAMERA      = 0x02, ///< Camera configuration
     33    PM_RECIPE_SOURCE_CL          = 0x04, ///< Command-line
     34    PM_RECIPE_SOURCE_SYMBOLIC    = 0x14, ///< Symbolic link, specified on command-line
     35    PM_RECIPE_SOURCE_ALL         = 0xff  ///< All sources
     36} pmRecipeSource;
    3737
    3838/// Configuration information
     
    5252    int *argc;                          ///< Number of command-line arguments
    5353    char **argv;                        ///< Command-line arguments (raw version)
     54    char *defaultRecipe;  ///< name of top-level recipe for this program
    5455    // Private members
    55     p_pmRecipeSource recipesRead;       ///< Which recipe sources have been read
     56    pmRecipeSource recipesRead;       ///< Which recipe sources have been read
    5657    psMetadata *recipesSource;          ///< Where each recipe came from
    5758}
     
    8182/// psLib log, trace and time setups are also performed if specified in the site configuration.
    8283pmConfig *pmConfigRead(int *argc,       ///< Number of command-line arguments
    83                        char **argv      ///< Array of command-line arguments
     84                       char **argv, ///< Array of command-line arguments
     85                       char *defaultRecipe ///< name of top-level recipe for this program
    8486                      );
    8587
     
    122124/// Attempt to read recipes from the sources that are available but have not already been read.  Having read a
    123125/// recipe, attempt to resolve symbolic links that were specified on the command line.
    124 bool pmConfigReadRecipes(pmConfig *config ///< Configuration
     126bool pmConfigReadRecipes(pmConfig *config, ///< Configuration
     127                         pmRecipeSource source ///< desired sources for recipes
    125128                        );
    126129
     
    164167psString pmConfigConvertFilename (char *filename, pmConfig *config);
    165168
     169
     170bool pmConfigLoadRecipeArguments (pmConfig *config);
     171bool pmConfigLoadRecipeOptions (pmConfig *config, char *flag);
     172
    166173#endif
Note: See TracChangeset for help on using the changeset viewer.