IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 23748


Ignore:
Timestamp:
Apr 8, 2009, 12:31:09 PM (17 years ago)
Author:
Paul Price
Message:

Adding LOG and TRACE to list of files written in the RUN metadata.

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

Legend:

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

    r23574 r23748  
    551551                psWarning("Unable to resolve log destination: %s --- ignored", logDest);
    552552            } else {
     553                pmConfigRunFilenameAddWrite(config, "LOG", logDest);
    553554                config->logFD = psMessageDestination(resolved);
    554555            }
     
    609610                psWarning("Unable to resolve trace destination: %s --- ignored", traceDest);
    610611            } else {
     612                pmConfigRunFilenameAddWrite(config, "TRACE", traceDest);
    611613                config->traceFD = psMessageDestination(resolved);
    612614            }
  • trunk/psModules/src/config/pmConfigRun.c

    r23447 r23748  
    4141// Add a file to a nominated metadata in the RUN information
    4242static bool configRunFileAdd(pmConfig *config, // Configuration
    43                              const pmFPAfile *file, // File to add
     43                             const char *description, // Description of file
     44                             const char *name, // Name of file
    4445                             const char *target // Name of metadata to which to add
    4546                             )
    4647{
    4748    PS_ASSERT_PTR_NON_NULL(config, false);
    48     PS_ASSERT_PTR_NON_NULL(file, false);
     49    PS_ASSERT_STRING_NON_EMPTY(description, false);
     50    PS_ASSERT_STRING_NON_EMPTY(name, false);
     51    PS_ASSERT_STRING_NON_EMPTY(target, false);
    4952
    5053    psMetadata *run = configRun(config);// RUN information
     
    5356    psAssert(files, "Require list of files");
    5457
    55     const char *name = file->name;      // Name of symbolic file
    56     const char *value = file->origname ? file->origname : file->filename; // The file (system) name
    57 
    5858    psString regex = NULL;              // Regular expression for iteration
    59     psStringAppend(&regex, "^%s$", name);
     59    psStringAppend(&regex, "^%s$", description);
    6060    psMetadataIterator *iter = psMetadataIteratorAlloc(files, PS_LIST_HEAD, regex);
    6161    psFree(regex);
     
    6363    while ((item = psMetadataGetAndIncrement(iter))) {
    6464        psAssert(item->type == PS_DATA_STRING, "We only put STRING types here.");
    65         if (strcmp(item->data.str, value) == 0) {
     65        if (strcmp(item->data.str, name) == 0) {
    6666            // It's already present
    6767            psFree(iter);
     
    7171    psFree(iter);
    7272
    73     return psMetadataAddStr(files, PS_LIST_TAIL, name, PS_META_DUPLICATE_OK, NULL, value);
     73    return psMetadataAddStr(files, PS_LIST_TAIL, description, PS_META_DUPLICATE_OK, NULL, name);
    7474}
    7575
     
    7979    PS_ASSERT_PTR_NON_NULL(file, false);
    8080
    81     return configRunFileAdd(config, file, "FILES.INPUT");
     81    return configRunFileAdd(config, file->name, file->origname ? file->origname : file->filename,
     82                            "FILES.INPUT");
     83}
     84
     85bool pmConfigRunFilenameAddRead(pmConfig *config, const char *description, const char *name)
     86{
     87    PS_ASSERT_PTR_NON_NULL(config, false);
     88    PS_ASSERT_STRING_NON_EMPTY(description, false);
     89    PS_ASSERT_STRING_NON_EMPTY(name, false);
     90
     91    return configRunFileAdd(config, description, name, "FILES.INPUT");
    8292}
    8393
     
    8797    PS_ASSERT_PTR_NON_NULL(file, false);
    8898
    89     return configRunFileAdd(config, file, "FILES.OUTPUT");
     99    return configRunFileAdd(config, file->name, file->origname ? file->origname : file->filename,
     100                            "FILES.OUTPUT");
     101}
     102
     103bool pmConfigRunFilenameAddWrite(pmConfig *config, const char *description, const char *name)
     104{
     105    PS_ASSERT_PTR_NON_NULL(config, false);
     106    PS_ASSERT_STRING_NON_EMPTY(description, false);
     107    PS_ASSERT_STRING_NON_EMPTY(name, false);
     108
     109    return configRunFileAdd(config, description, name, "FILES.OUTPUT");
    90110}
    91111
  • trunk/psModules/src/config/pmConfigRun.h

    r23447 r23748  
    1212    );
    1313
     14/// Add a filename to the list of files read in the run-time information
     15bool pmConfigRunFilenameAddRead(
     16    pmConfig *config,                   ///< Configuration
     17    const char *description,            ///< Description of file
     18    const char *name                    ///< Name of file
     19    );
     20
    1421/// Add a file to the list of files written in the run-time information
    1522bool pmConfigRunFileAddWrite(
    1623    pmConfig *config,                   ///< Configuration
    1724    const pmFPAfile *file               ///< File to add
     25    );
     26
     27
     28/// Add a filename to the list of files written in the run-time information
     29bool pmConfigRunFilenameAddWrite(
     30    pmConfig *config,                   ///< Configuration
     31    const char *description,            ///< Description of file
     32    const char *name                    ///< Name of file
    1833    );
    1934
Note: See TracChangeset for help on using the changeset viewer.