//分析字符串
while( 1 )
{
switch ( *pSrc )
{
case '-' :
status = ( status == START ) ? MINUS : ERROR;
feeInfo.minus = ( status == MINUS ) ? 1 : 0;
break;
case '1' :
case '2' :
case '3' :
case '4' :
case '5' :
case '6' :
case '7' :
case '8' :
case '9' :
case '0' :
if ( *pSrc == '0' && status == ZEROINT )//|| status == START ) )
{
status = ERROR;
break;
}
if ( status == MINUS || status == START || status == INTEGER )
{
if ( *pSrc == '0' && ( status == MINUS || status == START ) )
status = ZEROINT;
else
status = INTEGER;
*pInt = (*pSrc) - 48;
++pInt;
++feeInfo.sizeInt;
}
else if ( status == DECIMAL || status == DECIMALfRACTION )
{
status = DECIMALfRACTION;
*pDec = (*pSrc) - 48;
++pDec;
++feeInfo.sizeDecimal;
}
else
{
status =ERROR;
}
break;
case '.' :
status = ( status == INTEGER || status == ZEROINT )
? DECIMAL : ERROR;
break;
case '' :
status = ( status == INTEGER || status == DECIMALfRACTION
|| status == ZEROINT ) ? END : ERROR;
break;
default :
status = ERROR;
}
if ( status == END )
break;
else if ( status == ERROR )
return NULL;