version 1.8, 2004/12/07 19:34:20
|
version 1.9, 2004/12/10 07:09:28
|
|
|
if (!isdigit(*p)) | if (!isdigit(*p)) |
{ | { |
MessageLoaderParms mload(String("CQL.CQLUtilities.INVALID_NUM_FORMAT"), | MessageLoaderParms mload(String("CQL.CQLUtilities.INVALID_NUM_FORMAT"), |
String("String $0 must begin with a decimal character following an optional sign"), |
String("String '$0' is badly formed. It must be of the form; [+][0-9]*"), |
stringNum); | stringNum); |
throw CQLRuntimeException(mload); | throw CQLRuntimeException(mload); |
} | } |
|
|
if (*p && (*p != 'b') && (*p != 'B')) | if (*p && (*p != 'b') && (*p != 'B')) |
{ | { |
MessageLoaderParms mload(String("CQL.CQLUtilities.INVALID_BIN_CHAR"), | MessageLoaderParms mload(String("CQL.CQLUtilities.INVALID_BIN_CHAR"), |
String("String $0 has a non-binary digit character"), |
String("Character '$0' in string '$1' is not a binary digit."), |
stringNum); |
String(p, 1), stringNum); |
throw CQLRuntimeException(mload); | throw CQLRuntimeException(mload); |
} | } |
| |
|
|
if (!*p) | if (!*p) |
{ | { |
MessageLoaderParms mload(String("CQL.CQLUtilities.INVALID_HEX_FORMAT"), | MessageLoaderParms mload(String("CQL.CQLUtilities.INVALID_HEX_FORMAT"), |
String("String $0 needs a hexadecimal digit character following '0x'"), |
String("String '$0' needs a hexadecimal digit character following '0x'"), |
stringNum); | stringNum); |
throw CQLRuntimeException(mload); | throw CQLRuntimeException(mload); |
} | } |
|
|
if (*p) | if (*p) |
{ | { |
MessageLoaderParms mload(String("CQL.CQLUtilities.INVALID_HEX_CHAR"), | MessageLoaderParms mload(String("CQL.CQLUtilities.INVALID_HEX_CHAR"), |
String("String $0 has a non-hexidecimal digit character"), |
String("Character '$0' in string '$1' is not a hexidecimal digit."), |
stringNum); |
String(p, 1), stringNum); |
throw CQLRuntimeException(mload); | throw CQLRuntimeException(mload); |
} | } |
| |
|
|
if (*p) | if (*p) |
{ | { |
MessageLoaderParms mload(String("CQL.CQLUtilities.INVALID_DECIMAL_CHAR"), | MessageLoaderParms mload(String("CQL.CQLUtilities.INVALID_DECIMAL_CHAR"), |
String("String $0 has a non-decimal digit character $1"), |
String("Character '$0' in string '$1' is not a decimal digit."), |
stringNum, String(p)); |
String(p, 1), stringNum); |
throw CQLRuntimeException(mload); | throw CQLRuntimeException(mload); |
} | } |
| |
|
|
if (!isdigit(*p)) | if (!isdigit(*p)) |
{ | { |
MessageLoaderParms mload(String("CQL.CQLUtilities.INVALID_NUM_FORMAT"), | MessageLoaderParms mload(String("CQL.CQLUtilities.INVALID_NUM_FORMAT"), |
String("String $0 must begin with a decimal character following an optional sign"), |
String("String '$0' is badly formed. It must be of the form; [+-][0-9]*"), |
stringNum); | stringNum); |
throw CQLRuntimeException(mload); | throw CQLRuntimeException(mload); |
} | } |
|
|
if (*p && (*p != 'b') && (*p != 'B')) | if (*p && (*p != 'b') && (*p != 'B')) |
{ | { |
MessageLoaderParms mload(String("CQL.CQLUtilities.INVALID_BIN_CHAR"), | MessageLoaderParms mload(String("CQL.CQLUtilities.INVALID_BIN_CHAR"), |
String("String $0 has a non-binary digit character"), |
String("Character '$0' in string '$1' is not a binary digit."), |
stringNum); |
String(p, 1), stringNum); |
throw CQLRuntimeException(mload); | throw CQLRuntimeException(mload); |
} | } |
| |
|
|
// Skip over the "0x" | // Skip over the "0x" |
p+=2; | p+=2; |
| |
// At least one hexadecimal digit is required |
// At least one hexidecimal digit is required |
if (!*p) | if (!*p) |
{ | { |
MessageLoaderParms mload(String("CQL.CQLUtilities.INVALID_HEX_FORMAT"), | MessageLoaderParms mload(String("CQL.CQLUtilities.INVALID_HEX_FORMAT"), |
String("String $0 needs a hexadecimal digit character following '0x'"), |
String("String '$0' needs a hexidecimal digit character following '0x'"), |
stringNum); | stringNum); |
throw CQLRuntimeException(mload); | throw CQLRuntimeException(mload); |
} | } |
|
|
x = x - newDigit; | x = x - newDigit; |
} | } |
| |
// If we found a non-hexadecimal digit, report an error |
// If we found a non-hexidecimal digit, report an error |
if (*p) | if (*p) |
{ | { |
MessageLoaderParms mload(String("CQL.CQLUtilities.INVALID_HEX_CHAR"), | MessageLoaderParms mload(String("CQL.CQLUtilities.INVALID_HEX_CHAR"), |
String("String $0 has a non-hexidecimal digit character"), |
String("Character '$0' in string '$1' is not a hexidecimal digit."), |
stringNum); |
String(p, 1), stringNum); |
throw CQLRuntimeException(mload); | throw CQLRuntimeException(mload); |
} | } |
| |
|
|
if (*p) | if (*p) |
{ | { |
MessageLoaderParms mload(String("CQL.CQLUtilities.INVALID_DECIMAL_CHAR"), | MessageLoaderParms mload(String("CQL.CQLUtilities.INVALID_DECIMAL_CHAR"), |
String("String $0 has a non-decimal digit character $1"), |
String("Character '$0' in string '$1' is not a decimal digit."), |
stringNum, String(p)); |
String(p, 1), stringNum); |
throw CQLRuntimeException(mload); | throw CQLRuntimeException(mload); |
} | } |
| |
|
|
if (!isdigit(*p++)) | if (!isdigit(*p++)) |
{ | { |
MessageLoaderParms mload(String("CQL.CQLUtilities.INVALID_CHAR_POST_DOT"), | MessageLoaderParms mload(String("CQL.CQLUtilities.INVALID_CHAR_POST_DOT"), |
String("String $0 must have a digit character following the decimal point."), |
String("String '$0' must have a digit character following the decimal point."), |
stringNum); | stringNum); |
throw CQLRuntimeException(mload); | throw CQLRuntimeException(mload); |
} | } |
|
|
p++; | p++; |
| |
// If there is an exponent now: | // If there is an exponent now: |
|
|
if (*p) | if (*p) |
{ | { |
// Test exponent: | // Test exponent: |
|
|
if (*p != 'e' && *p != 'E') | if (*p != 'e' && *p != 'E') |
{ | { |
MessageLoaderParms mload(String("CQL.CQLUtilities.INVALID_REAL_CHAR"), | MessageLoaderParms mload(String("CQL.CQLUtilities.INVALID_REAL_CHAR"), |
String("String $0 contains an invalid character for a real number."), |
String("Character '$0' in string '$1` is invalid for a real number."), |
stringNum); |
String(p-1, 1), stringNum); |
throw CQLRuntimeException(mload); | throw CQLRuntimeException(mload); |
} | } |
|
|
p++; | p++; |
| |
// Skip optional sign: | // Skip optional sign: |
|
|
p++; | p++; |
| |
// One or more digits required: | // One or more digits required: |
|
|
if (!isdigit(*p++)) | if (!isdigit(*p++)) |
{ | { |
MessageLoaderParms mload(String("CQL.CQLUtilities.INVALID_REAL_EXP"), | MessageLoaderParms mload(String("CQL.CQLUtilities.INVALID_REAL_EXP"), |
String("String $0 must have a digit following the exponent symbol."), |
String("String '$0' has an badly formed exponent. It must be of the form [eE][+-][0-9]*.. Character '$1' is invalid."), |
stringNum); |
stringNum, String(p, 1)); |
throw CQLRuntimeException(mload); | throw CQLRuntimeException(mload); |
} | } |
| |
|
|
{ | { |
// printf("This is char # %d\n", p - pStart); | // printf("This is char # %d\n", p - pStart); |
MessageLoaderParms mload(String("CQL.CQLUtilities.INVALID_DECIMAL_CHAR"), | MessageLoaderParms mload(String("CQL.CQLUtilities.INVALID_DECIMAL_CHAR"), |
String("String $0 has a non-decimal digit character $1"), |
String("Character '$0' in string '$1' is not a decimal digit."), |
stringNum, |
String(p-1, 1), stringNum); |
String(p)); |
|
throw CQLRuntimeException(mload); | throw CQLRuntimeException(mload); |
} | } |
// | // |
|
|
throw CQLRuntimeException(mload); | throw CQLRuntimeException(mload); |
} | } |
PEG_METHOD_EXIT(); | PEG_METHOD_EXIT(); |
printf("String %s = %.16e\n", (const char *)stringNum.getCString(), x); |
// printf("String %s = %.16e\n", (const char *)stringNum.getCString(), x); |
// printf("Num %e = \n", x); |
|
return x; | return x; |
} | } |
| |