Commit 4736cc8c authored by Marcus Meissner's avatar Marcus Meissner Committed by Alexandre Julliard

Implemented VarParseNumFromStr, VarNumFromParseNum.

parent 25765130
...@@ -52,8 +52,8 @@ debug_channels (ole typelib) ...@@ -52,8 +52,8 @@ debug_channels (ole typelib)
39 stdcall SafeArrayDestroyData(ptr) SafeArrayDestroyData 39 stdcall SafeArrayDestroyData(ptr) SafeArrayDestroyData
40 stdcall SafeArrayRedim(ptr ptr) SafeArrayRedim 40 stdcall SafeArrayRedim(ptr ptr) SafeArrayRedim
41 stub OACreateTypeLib2 41 stub OACreateTypeLib2
46 stub VarParseNumFromStr 46 stdcall VarParseNumFromStr(wstr long long ptr ptr) VarParseNumFromStr
47 stub VarNumFromParseNum 47 stdcall VarNumFromParseNum(ptr ptr long ptr) VarNumFromParseNum
48 stdcall VarI2FromUI1(long ptr) VarI2FromUI1 48 stdcall VarI2FromUI1(long ptr) VarI2FromUI1
49 stdcall VarI2FromI4(long ptr) VarI2FromI4 49 stdcall VarI2FromI4(long ptr) VarI2FromI4
50 stdcall VarI2FromR4(long ptr) VarI2FromR4 50 stdcall VarI2FromR4(long ptr) VarI2FromR4
......
...@@ -4331,6 +4331,74 @@ INT WINAPI DosDateTimeToVariantTime(USHORT wDosDate, USHORT wDosTime, ...@@ -4331,6 +4331,74 @@ INT WINAPI DosDateTimeToVariantTime(USHORT wDosDate, USHORT wDosTime,
return TmToDATE( &t, pvtime ); return TmToDATE( &t, pvtime );
} }
/**********************************************************************
* VarParseNumFromStr [OLEAUT32.46]
*/
HRESULT WINAPI VarParseNumFromStr(OLECHAR * strIn, LCID lcid, ULONG dwFlags,
NUMPARSE * pnumprs, BYTE * rgbDig)
{
int i,lastent=0;
int cDig;
FIXME("(%s,flags=%lx,....), partial stub!\n",debugstr_w(strIn),dwFlags);
FIXME("numparse: cDig=%d, InFlags=%lx\n",pnumprs->cDig,pnumprs->dwInFlags);
/* The other struct components are to be set by us */
memset(rgbDig,0,pnumprs->cDig);
cDig = 0;
for (i=0; strIn[i] ;i++) {
if ((strIn[i]>='0') && (strIn[i]<='9')) {
if (pnumprs->cDig > cDig) {
*(rgbDig++)=strIn[i]-'0';
cDig++;
lastent = i;
}
}
}
pnumprs->cDig = cDig;
/* FIXME: Just patching some values in */
pnumprs->nPwr10 = 0;
pnumprs->nBaseShift = 0;
pnumprs->cchUsed = lastent;
pnumprs->dwOutFlags = NUMPRS_DECIMAL;
return S_OK;
}
/**********************************************************************
* VarNumFromParseNum [OLEAUT32.47]
*/
HRESULT WINAPI VarNumFromParseNum(NUMPARSE * pnumprs, BYTE * rgbDig,
ULONG dwVtBits, VARIANT * pvar)
{
DWORD xint;
int i;
FIXME("(,dwVtBits=%lx,....), partial stub!\n",dwVtBits);
xint = 0;
for (i=0;i<pnumprs->cDig;i++)
xint = xint*10 + rgbDig[i];
VariantInit(pvar);
if (dwVtBits & VTBIT_I4) {
pvar->vt = VT_I4;
pvar->u.intVal = xint;
return S_OK;
}
if (dwVtBits & VTBIT_R8) {
pvar->vt = VT_R8;
pvar->u.dblVal = xint;
return S_OK;
} else {
FIXME("vtbitmask is unsupported %lx\n",dwVtBits);
return E_FAIL;
}
}
/********************************************************************** /**********************************************************************
* VariantTimeToDosDateTime [OLEAUT32.??] * VariantTimeToDosDateTime [OLEAUT32.??]
* Convert variant representation of time to the date and time representation * Convert variant representation of time to the date and time representation
......
...@@ -526,6 +526,47 @@ typedef struct { ...@@ -526,6 +526,47 @@ typedef struct {
USHORT wDayOfYear; USHORT wDayOfYear;
} UDATE; } UDATE;
typedef struct {
INT cDig;
ULONG dwInFlags;
ULONG dwOutFlags;
INT cchUsed;
INT nBaseShift;
INT nPwr10;
} NUMPARSE;
#define NUMPRS_LEADING_WHITE 0x0001
#define NUMPRS_TRAILING_WHITE 0x0002
#define NUMPRS_LEADING_PLUS 0x0004
#define NUMPRS_TRAILING_PLUS 0x0008
#define NUMPRS_LEADING_MINUS 0x0010
#define NUMPRS_TRAILING_MINUS 0x0020
#define NUMPRS_HEX_OCT 0x0040
#define NUMPRS_PARENS 0x0080
#define NUMPRS_DECIMAL 0x0100
#define NUMPRS_THOUSANDS 0x0200
#define NUMPRS_CURRENCY 0x0400
#define NUMPRS_EXPONENT 0x0800
#define NUMPRS_USE_ALL 0x1000
#define NUMPRS_STD 0x1FFF
#define NUMPRS_NEG 0x10000
#define NUMPRS_INEXACT 0x20000
#define VTBIT_I1 (1 << VT_I1)
#define VTBIT_UI1 (1 << VT_UI1)
#define VTBIT_I2 (1 << VT_I2)
#define VTBIT_UI2 (1 << VT_UI2)
#define VTBIT_I4 (1 << VT_I4)
#define VTBIT_UI4 (1 << VT_UI4)
#define VTBIT_R4 (1 << VT_R4)
#define VTBIT_R8 (1 << VT_R8)
#define VTBIT_CY (1 << VT_CY)
#define VTBIT_DECIMAL (1 << VT_DECIMAL)
HRESULT WINAPI VarParseNumFromStr(OLECHAR*,LCID,ULONG,NUMPARSE*,BYTE*);
HRESULT WINAPI VarNumFromParseNum(NUMPARSE*,BYTE*,ULONG,VARIANT*);
INT WINAPI DosDateTimeToVariantTime(USHORT,USHORT,DATE*); INT WINAPI DosDateTimeToVariantTime(USHORT,USHORT,DATE*);
INT WINAPI VariantTimeToDosDateTime(DATE, USHORT *, USHORT *); INT WINAPI VariantTimeToDosDateTime(DATE, USHORT *, USHORT *);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment