1// Licensed to the .NET Foundation under one or more agreements.
2// The .NET Foundation licenses this file to you under the MIT license.
3// See the LICENSE file in the project root for more information.
4//
5
6//
7// ===========================================================================
8// File: oleauto.h
9//
10// ===========================================================================
11// simplified oleauto.h for PAL
12
13#ifndef _OLEAUTO_H_
14#define _OLEAUTO_H_
15#include "oaidl.h"
16
17#ifndef BEGIN_INTERFACE
18#define BEGIN_INTERFACE
19#define END_INTERFACE
20#endif
21
22// OleAut's VT_CY and VT_DECIMAL declarations required by System.Decimal and System.Currency
23
24typedef struct {
25 INT cDig;
26 ULONG dwInFlags;
27 ULONG dwOutFlags;
28 INT cchUsed;
29 INT nBaseShift;
30 INT nPwr10;
31} NUMPARSE;
32
33#define NUMPRS_STD 0x1FFF
34
35/* flags used by both dwInFlags and dwOutFlags:
36 */
37#define NUMPRS_LEADING_WHITE 0x0001
38#define NUMPRS_TRAILING_WHITE 0x0002
39#define NUMPRS_LEADING_PLUS 0x0004
40#define NUMPRS_TRAILING_PLUS 0x0008
41#define NUMPRS_LEADING_MINUS 0x0010
42#define NUMPRS_TRAILING_MINUS 0x0020
43#define NUMPRS_HEX_OCT 0x0040
44#define NUMPRS_PARENS 0x0080
45#define NUMPRS_DECIMAL 0x0100
46#define NUMPRS_THOUSANDS 0x0200
47#define NUMPRS_CURRENCY 0x0400
48#define NUMPRS_EXPONENT 0x0800
49#define NUMPRS_USE_ALL 0x1000
50
51/* flags used by dwOutFlags only:
52 */
53#define NUMPRS_NEG 0x10000
54#define NUMPRS_INEXACT 0x20000
55/* flags used by VarNumFromParseNum to indicate acceptable result types:
56 */
57#define VTBIT_I1 (1 << VT_I1)
58#define VTBIT_UI1 (1 << VT_UI1)
59#define VTBIT_I2 (1 << VT_I2)
60#define VTBIT_UI2 (1 << VT_UI2)
61#define VTBIT_I4 (1 << VT_I4)
62#define VTBIT_UI4 (1 << VT_UI4)
63#define VTBIT_I8 (1 << VT_I8)
64#define VTBIT_UI8 (1 << VT_UI8)
65#define VTBIT_R4 (1 << VT_R4)
66#define VTBIT_R8 (1 << VT_R8)
67#define VTBIT_CY (1 << VT_CY)
68#define VTBIT_DECIMAL (1 << VT_DECIMAL)
69
70#define LOCALE_NOUSEROVERRIDE 0x80000000 /* OR in to avoid user override */
71/*
72 * Use NLS functions to format date, currency, time, and number.
73 */
74#ifndef LOCALE_USE_NLS
75#define LOCALE_USE_NLS 0x10000000
76#endif
77
78// Compare results for VarDecCmp. These are returned as a SUCCESS HResult.
79// Subtracting one gives the usual values of -1 for Less Than,
80// 0 for Equal To, +1 for Greater Than.
81//
82#define VARCMP_LT 0
83#define VARCMP_EQ 1
84#define VARCMP_GT 2
85#define VARCMP_NULL 3
86
87STDAPI VariantChangeType(VARIANTARG * pvargDest,
88 VARIANTARG * pvarSrc, USHORT wFlags, VARTYPE vt);
89
90STDAPI VarCyFromR4(FLOAT fltIn, CY * pcyOut);
91STDAPI VarCyFromR8(DOUBLE dblIn, CY * pcyOut);
92STDAPI VarCyFromDec(DECIMAL *pdecIn, CY *pcyOut);
93STDAPI VarCyAdd(CY cyLeft, CY cyRight, LPCY pcyResult);
94STDAPI VarCySub(CY cyLeft, CY cyRight, LPCY pcyResult);
95STDAPI VarCyMul(CY cyLeft, CY cyRight, LPCY pcyResult);
96STDAPI VarCyInt(CY cyIn, LPCY pcyResult);
97STDAPI VarCyRound(CY cyIn, INT cDecimals, LPCY pcyResult);
98STDAPI VarCyFix(CY cyIn, LPCY pcyResult);
99
100STDAPI VarR8FromCy(CY cyIn, DOUBLE * pdblOut);
101STDAPI VarR4FromCy(CY cyIn, FLOAT * pfltOut);
102
103STDAPI VarDecFromR4(FLOAT fltIn, DECIMAL *pdecOut);
104STDAPI VarDecFromR8(DOUBLE dblIn, DECIMAL *pdecOut);
105STDAPI VarDecFromCy(CY cyIn, DECIMAL *pdecOut);
106STDAPI VarDecAdd(LPDECIMAL pdecLeft, LPDECIMAL pdecRight, LPDECIMAL pdecResult);
107STDAPI VarDecSub(LPDECIMAL pdecLeft, LPDECIMAL pdecRight, LPDECIMAL pdecResult);
108STDAPI VarDecMul(LPDECIMAL pdecLeft, LPDECIMAL pdecRight, LPDECIMAL pdecResult);
109STDAPI VarDecDiv(LPDECIMAL pdecLeft, LPDECIMAL pdecRight, LPDECIMAL pdecResult);
110STDAPI VarDecCmp(LPDECIMAL pdecLeft, LPDECIMAL pdecRight);
111STDAPI VarDecInt(LPDECIMAL pdecIn, LPDECIMAL pdecResult);
112STDAPI VarDecRound(LPDECIMAL pdecIn, INT cDecimals, LPDECIMAL pdecResult);
113STDAPI VarDecFix(LPDECIMAL pdecIn, LPDECIMAL pdecResult);
114STDAPI VarDecNeg(LPDECIMAL pdecIn, LPDECIMAL pdecResult);
115STDAPI VarDecFromI4(LONG I4in, DECIMAL *pdecOut);
116STDAPI VarDecFromUI4(ULONG UI4in, DECIMAL *pdecOut);
117
118STDAPI VarI1FromDec(DECIMAL *pdecIn, CHAR *pI1In);
119STDAPI VarUI1FromDec(DECIMAL *pdecIn, BYTE *pUI1In);
120STDAPI VarI2FromDec(DECIMAL *pdecIn, SHORT *pI2In);
121STDAPI VarUI2FromDec(DECIMAL *pdecIn, USHORT *pUI2In);
122STDAPI VarI4FromDec(DECIMAL *pdecIn, LONG *pI4In);
123STDAPI VarUI4FromDec(DECIMAL *pdecIn, ULONG *pUI4In);
124STDAPI VarR8FromDec(DECIMAL *pdecIn, DOUBLE *pdblOut);
125STDAPI VarR4FromDec(DECIMAL *pdecIn, FLOAT *pfltOut);
126
127STDAPI VarI1FromR8(DOUBLE dblIn, CHAR *pcOut);
128STDAPI VarI2FromR8(DOUBLE dblIn, SHORT * psOut);
129STDAPI VarI4FromR8(DOUBLE dblIn, LONG * plOut);
130STDAPI VarUI1FromR8(DOUBLE dblIn, BYTE * pbOut);
131STDAPI VarUI2FromR8(DOUBLE dblIn, USHORT *puiOut);
132STDAPI VarUI4FromR8(DOUBLE dblIn, ULONG *pulOut);
133
134#endif // _OLEAUTO_H_
135