/*
*******************************************************************************
*
-* Copyright (C) 1998-2006, International Business Machines
+* Copyright (C) 1998-2011, International Business Machines
* Corporation and others. All Rights Reserved.
*
*******************************************************************************
return parsePos + skipped;
}
+#define UPRINTF_SYMBOL_BUFFER_SIZE 8
+
static int32_t
u_scanf_scientific_handler(UFILE *input,
u_scanf_spec_info *info,
int32_t parsePos = 0;
int32_t skipped;
UErrorCode status = U_ZERO_ERROR;
+ UChar srcExpBuf[UPRINTF_SYMBOL_BUFFER_SIZE];
+ int32_t srcLen, expLen;
+ UChar expBuf[UPRINTF_SYMBOL_BUFFER_SIZE];
/* skip all ws in the input */
if(format == 0)
return 0;
+ /* set the appropriate flags on the formatter */
+
+ srcLen = unum_getSymbol(format,
+ UNUM_EXPONENTIAL_SYMBOL,
+ srcExpBuf,
+ sizeof(srcExpBuf),
+ &status);
+
+ /* Upper/lower case the e */
+ if (info->fSpec == (UChar)0x65 /* e */) {
+ expLen = u_strToLower(expBuf, (int32_t)sizeof(expBuf),
+ srcExpBuf, srcLen,
+ input->str.fBundle.fLocale,
+ &status);
+ }
+ else {
+ expLen = u_strToUpper(expBuf, (int32_t)sizeof(expBuf),
+ srcExpBuf, srcLen,
+ input->str.fBundle.fLocale,
+ &status);
+ }
+
+ unum_setSymbol(format,
+ UNUM_EXPONENTIAL_SYMBOL,
+ expBuf,
+ expLen,
+ &status);
+
+
+
+
/* Skip the positive prefix. ICU normally can't handle this due to strict parsing. */
skipped += u_scanf_skip_leading_positive_sign(input, format, &status);
double num;
UNumberFormat *format;
int32_t parsePos = 0;
- int32_t skipped;
UErrorCode status = U_ZERO_ERROR;
/* skip all ws in the input */
- skipped = u_scanf_skip_leading_ws(input, info->fPadChar);
+ u_scanf_skip_leading_ws(input, info->fPadChar);
/* fill the input's internal buffer */
ufile_fill_uchar_buffer(input);
return 0;
/* Skip the positive prefix. ICU normally can't handle this due to strict parsing. */
- skipped += u_scanf_skip_leading_positive_sign(input, format, &status);
+ u_scanf_skip_leading_positive_sign(input, format, &status);
/* parse the number */
num = unum_parseDouble(format, input->str.fPos, len, &parsePos, &status);