Changeset 10422
- Timestamp:
- Dec 3, 2006, 4:14:09 PM (19 years ago)
- Location:
- trunk/psModules/src/config
- Files:
-
- 2 edited
-
pmConfig.c (modified) (16 diffs)
-
pmConfig.h (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/config/pmConfig.c
r10421 r10422 4 4 * @author EAM (IfA) 5 5 * 6 * @version $Revision: 1.5 5$ $Name: not supported by cvs2svn $7 * @date $Date: 2006-12-0 3 18:48:10$6 * @version $Revision: 1.56 $ $Name: not supported by cvs2svn $ 7 * @date $Date: 2006-12-04 02:14:09 $ 8 8 * 9 9 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 54 54 config->cameraName = NULL; 55 55 config->recipes = psMetadataAlloc(); 56 config->recipesRead = P _PM_RECIPE_SOURCE_NONE;56 config->recipesRead = PM_RECIPE_SOURCE_NONE; 57 57 config->recipesSource = psMetadataAlloc(); 58 58 config->arguments = psMetadataAlloc(); … … 60 60 config->argc = argc; 61 61 config->argv = argv; 62 config->defaultRecipe = NULL; 62 63 config->workdir = NULL; 63 64 … … 205 206 206 207 207 pmConfig *pmConfigRead(int *argc, char **argv )208 pmConfig *pmConfigRead(int *argc, char **argv, char *defaultRecipe) 208 209 { 209 210 PS_ASSERT_PTR_NON_NULL(argc, NULL); … … 212 213 213 214 pmConfig *config = pmConfigAlloc(argc, argv); // The configuration, containing site, camera and recipes 215 config->defaultRecipe = defaultRecipe; 214 216 215 217 // … … 365 367 // expanded in the future to do files, and perhaps even sockets. 366 368 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 369 371 } 370 372 } … … 442 444 443 445 // 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)) { 445 447 psError(PS_ERR_IO, false, "Failed to read recipes from camera file"); 446 448 psFree(config); 447 449 return NULL; 448 450 } 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"); 449 460 450 461 psErrorClear(); // we may have failed to find some items in the metadata … … 606 617 607 618 // Now we have the camera, we can read the recipes 608 pmConfigReadRecipes(config );619 pmConfigReadRecipes(config, PM_RECIPE_SOURCE_CAMERA | PM_RECIPE_SOURCE_CL); 609 620 610 621 return format; … … 650 661 651 662 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 653 665 static bool loadRecipes(pmConfig *config, // The configuration into which to read the recipes 654 666 psMetadata *source, // The source configuration, from which to read the filenames 655 p _pmRecipeSource sourceType, // The source type667 pmRecipeSource sourceType, // The source type 656 668 const char *sourceName // The name of the source, for error messages 657 669 ) … … 660 672 661 673 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); 667 676 config->recipesRead &= ~sourceType; 668 677 return false; … … 672 681 psMetadata *recipes = psMetadataLookupMetadata(&mdok, source, "RECIPES"); // The list of recipes 673 682 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", 675 684 sourceName); 676 685 config->recipesRead &= ~sourceType; 677 686 return false; 678 687 } 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 679 691 680 692 // Copy the filenames to the target from the "RECIPES" in the source. … … 686 698 while ((fileItem = psMetadataGetAndIncrement(recipesIter))) 687 699 { 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 720 756 } 721 757 psFree(recipesIter); … … 729 765 while ((sourceItem = psMetadataGetAndIncrement(recipesIter))) { 730 766 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) { 732 768 const char *linkName = sourceItem->comment; // The name of the link 733 769 psMetadata *linkSource = psMetadataLookupMetadata(&mdok, config->recipes, linkName); // The source … … 748 784 } 749 785 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. 790 bool pmConfigReadRecipes(pmConfig *config, pmRecipeSource source) 752 791 { 753 792 PS_ASSERT_PTR_NON_NULL(config, false); … … 757 796 } 758 797 759 bool mdok = true; // Status of MD lookup760 761 798 // 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 } 840 828 } 841 829 /* … … 1069 1057 return newName; 1070 1058 } 1059 1060 // search for options of the form -D KEY VALUE or -D RECIPE:KEY VALUE 1061 bool 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. ??? 1151 bool 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? 1208 if (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 9 9 /// @author Eugene Magnier, IfA 10 10 /// 11 /// @version $Revision: 1. 19$ $Name: not supported by cvs2svn $12 /// @date $Date: 2006-12-0 3 18:48:10$11 /// @version $Revision: 1.20 $ $Name: not supported by cvs2svn $ 12 /// @date $Date: 2006-12-04 02:14:09 $ 13 13 /// 14 14 /// Copyright 2005-2006 Institute for Astronomy, University of Hawaii … … 28 28 /// psModules --- there is no need for the user to know about it. 29 29 typedef enum { 30 P _PM_RECIPE_SOURCE_NONE = 0x00, ///< None yet31 P _PM_RECIPE_SOURCE_SITE = 0x01, ///< Site configuration32 P _PM_RECIPE_SOURCE_CAMERA = 0x02, ///< Camera configuration33 P _PM_RECIPE_SOURCE_CL = 0x04, ///< Command-line34 P _PM_RECIPE_SOURCE_SYMBOLIC = 0x14, ///< Symbolic link, specified on command-line35 P _PM_RECIPE_SOURCE_ALL = 0xff ///< All sources36 } 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; 37 37 38 38 /// Configuration information … … 52 52 int *argc; ///< Number of command-line arguments 53 53 char **argv; ///< Command-line arguments (raw version) 54 char *defaultRecipe; ///< name of top-level recipe for this program 54 55 // Private members 55 p _pmRecipeSource recipesRead; ///< Which recipe sources have been read56 pmRecipeSource recipesRead; ///< Which recipe sources have been read 56 57 psMetadata *recipesSource; ///< Where each recipe came from 57 58 } … … 81 82 /// psLib log, trace and time setups are also performed if specified in the site configuration. 82 83 pmConfig *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 84 86 ); 85 87 … … 122 124 /// Attempt to read recipes from the sources that are available but have not already been read. Having read a 123 125 /// recipe, attempt to resolve symbolic links that were specified on the command line. 124 bool pmConfigReadRecipes(pmConfig *config ///< Configuration 126 bool pmConfigReadRecipes(pmConfig *config, ///< Configuration 127 pmRecipeSource source ///< desired sources for recipes 125 128 ); 126 129 … … 164 167 psString pmConfigConvertFilename (char *filename, pmConfig *config); 165 168 169 170 bool pmConfigLoadRecipeArguments (pmConfig *config); 171 bool pmConfigLoadRecipeOptions (pmConfig *config, char *flag); 172 166 173 #endif
Note:
See TracChangeset
for help on using the changeset viewer.
