IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 5013


Ignore:
Timestamp:
Sep 12, 2005, 3:04:39 PM (21 years ago)
Author:
drobbin
Message:

added psTime input for psMetadataConfigParse (and tests)

Location:
trunk/psLib
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/types/psMetadataConfig.c

    r5011 r5013  
    1010*  @author Eric Van Alst, MHPCC
    1111*
    12 *  @version $Revision: 1.42 $ $Name: not supported by cvs2svn $
    13 *  @date $Date: 2005-09-12 23:40:01 $
     12*  @version $Revision: 1.43 $ $Name: not supported by cvs2svn $
     13*  @date $Date: 2005-09-13 01:04:39 $
    1414*
    1515*  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    250250
    251251    return value;
     252}
     253
     254/** Returns a psTime structure */
     255static psTime *parseTime(char *inString,
     256                         psTimeType tt,
     257                         psS32 *status)
     258{
     259    psTime *out;
     260    long sec = 0;
     261    unsigned int nsec = 0;
     262    char *end = NULL;
     263    out = psTimeAlloc(tt);
     264
     265    sec = strtol(inString, &end, 10);
     266    out->sec = sec;
     267    while (!strncmp(end, " ", 1))
     268        end++;
     269    inString = end;
     270    nsec = (unsigned int)strtoul(inString, &end, 10);
     271    out->nsec = nsec;
     272    if (out->sec == 0 && out->nsec == 0)
     273        *status = 1;
     274    while (!strncmp(end, " ", 1))
     275        end++;
     276    inString = end;
     277    if ( !strncmp(inString, "false", 10) || !strncmp(inString, "f", 10) ||
     278            !strncmp(inString, "FALSE", 10) || !strncmp(inString, " F", 10) )
     279        out->leapsecond = false;
     280    else if ( !strncmp(inString, "true", 10) || !strncmp(inString, "t", 10) ||
     281              !strncmp(inString, "TRUE", 10) || !strncmp(inString, "T", 10) )
     282        out->leapsecond = true;
     283    else {
     284        *status = 1;
     285    }
     286    return out;
    252287}
    253288
     
    717752    psMetadata*          tempMeta      = NULL;
    718753    p_psParseLevelInfo*  nextLevelInfo = NULL;
     754    psTime *mTime;
     755    psTimeType timeType;
    719756
    720757    // Get the metadata item type
     
    774811        } else if(!strncmp(strType, "METADATA", 8)) {
    775812            mdType = PS_META_META;
     813        } else if( !strncmp(strType, "PS_TIME_UTC", 12) || !strncmp(strType, "PS_TIME_TAI", 12)
     814                   || !strncmp(strType, "PS_TIME_UT1", 12) || !strncmp(strType, "PS_TIME_TT", 12)) {
     815            mdType = PS_META_TIME;
    776816        } else {
    777817            // Search through user types
     
    895935            returnValue = false;
    896936        }
     937        break;
     938    case PS_META_TIME:
     939        if( !strncmp(strType, "PS_TIME_UTC", 12) )
     940            timeType = PS_TIME_UTC;
     941        else if( !strncmp(strType, "PS_TIME_TAI", 12) )
     942            timeType = PS_TIME_TAI;
     943        else if( !strncmp(strType, "PS_TIME_UT1", 12) )
     944            timeType = PS_TIME_UT1;
     945        else if( !strncmp(strType, "PS_TIME_TT", 12) )
     946            timeType = PS_TIME_TT;
     947        mTime = parseTime(strValue, timeType, &status);
     948        if(!status) {
     949            addStatus = psMetadataAdd(md, PS_LIST_TAIL, keyName,
     950                                      mdType | flags,
     951                                      strComment, mTime);
     952        } else {
     953            psError(PS_ERR_IO, true, PS_ERRORTEXT_psMetadataIO_PARSE_FAILED, strValue, keyName,
     954                    strType, lineCount, fileName);
     955            returnValue = false;
     956        }
     957        psFree(mTime);
    897958        break;
    898959    case PS_META_VEC:
  • trunk/psLib/test/types/verified/tst_psMetadataIO.stderr

    r4987 r5013  
    3939    Failed to parse the value 'ccdd' of metadata item value2, type S32, on line 21 of test2.config.
    4040<DATE><TIME>|<HOST>|E|parseLine (FILE:LINENO)
    41     More than one '@' character not allowed.  Found on line 24 of test2.config.
     41    More than one '@' character not allowed.  Found on line 27 of test2.config.
    4242<DATE><TIME>|<HOST>|E|parseLine (FILE:LINENO)
    43     Failed to read a metadata type on line 27 of test2.config.
     43    Failed to read a metadata type on line 30 of test2.config.
    4444<DATE><TIME>|<HOST>|E|parseLine (FILE:LINENO)
    45     Specified type, CELL, on line 31 of test2.config is already defined.
     45    Specified type, CELL, on line 34 of test2.config is already defined.
    4646<DATE><TIME>|<HOST>|E|psMetadataAddItem (FILE:LINENO)
    4747    Duplicate metadata item name is not allowed.  Use a psMetadataFlags option to allow such action.
    4848<DATE><TIME>|<HOST>|E|parseLine (FILE:LINENO)
    49     Metadata type 'NEWCELL', found on line 37 of test2.config, is invalid.
     49    Metadata type 'NEWCELL', found on line 40 of test2.config, is invalid.
    5050<DATE><TIME>|<HOST>|E|parseMetadataItem (FILE:LINENO)
    51     Failed to read a metadata OURCELL on line 40 of test2.config.
     51    Failed to read a metadata OURCELL on line 43 of test2.config.
    5252<DATE><TIME>|<HOST>|E|parseLine (FILE:LINENO)
    53     Metadata type 'NEWCELL1', found on line 43 of test2.config, is invalid.
     53    Metadata type 'NEWCELL1', found on line 46 of test2.config, is invalid.
    5454<DATE><TIME>|<HOST>|I|testMetadataParseConfig1
    5555    Following should generate error message
Note: See TracChangeset for help on using the changeset viewer.