Changeset 5013
- Timestamp:
- Sep 12, 2005, 3:04:39 PM (21 years ago)
- Location:
- trunk/psLib
- Files:
-
- 2 edited
-
src/types/psMetadataConfig.c (modified) (5 diffs)
-
test/types/verified/tst_psMetadataIO.stderr (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/types/psMetadataConfig.c
r5011 r5013 10 10 * @author Eric Van Alst, MHPCC 11 11 * 12 * @version $Revision: 1.4 2$ $Name: not supported by cvs2svn $13 * @date $Date: 2005-09-1 2 23:40:01$12 * @version $Revision: 1.43 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2005-09-13 01:04:39 $ 14 14 * 15 15 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 250 250 251 251 return value; 252 } 253 254 /** Returns a psTime structure */ 255 static 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; 252 287 } 253 288 … … 717 752 psMetadata* tempMeta = NULL; 718 753 p_psParseLevelInfo* nextLevelInfo = NULL; 754 psTime *mTime; 755 psTimeType timeType; 719 756 720 757 // Get the metadata item type … … 774 811 } else if(!strncmp(strType, "METADATA", 8)) { 775 812 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; 776 816 } else { 777 817 // Search through user types … … 895 935 returnValue = false; 896 936 } 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); 897 958 break; 898 959 case PS_META_VEC: -
trunk/psLib/test/types/verified/tst_psMetadataIO.stderr
r4987 r5013 39 39 Failed to parse the value 'ccdd' of metadata item value2, type S32, on line 21 of test2.config. 40 40 <DATE><TIME>|<HOST>|E|parseLine (FILE:LINENO) 41 More than one '@' character not allowed. Found on line 2 4of test2.config.41 More than one '@' character not allowed. Found on line 27 of test2.config. 42 42 <DATE><TIME>|<HOST>|E|parseLine (FILE:LINENO) 43 Failed to read a metadata type on line 27of test2.config.43 Failed to read a metadata type on line 30 of test2.config. 44 44 <DATE><TIME>|<HOST>|E|parseLine (FILE:LINENO) 45 Specified type, CELL, on line 3 1of test2.config is already defined.45 Specified type, CELL, on line 34 of test2.config is already defined. 46 46 <DATE><TIME>|<HOST>|E|psMetadataAddItem (FILE:LINENO) 47 47 Duplicate metadata item name is not allowed. Use a psMetadataFlags option to allow such action. 48 48 <DATE><TIME>|<HOST>|E|parseLine (FILE:LINENO) 49 Metadata type 'NEWCELL', found on line 37of test2.config, is invalid.49 Metadata type 'NEWCELL', found on line 40 of test2.config, is invalid. 50 50 <DATE><TIME>|<HOST>|E|parseMetadataItem (FILE:LINENO) 51 Failed to read a metadata OURCELL on line 4 0of test2.config.51 Failed to read a metadata OURCELL on line 43 of test2.config. 52 52 <DATE><TIME>|<HOST>|E|parseLine (FILE:LINENO) 53 Metadata type 'NEWCELL1', found on line 4 3of test2.config, is invalid.53 Metadata type 'NEWCELL1', found on line 46 of test2.config, is invalid. 54 54 <DATE><TIME>|<HOST>|I|testMetadataParseConfig1 55 55 Following should generate error message
Note:
See TracChangeset
for help on using the changeset viewer.
