Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
f9bca5ea
Commit
f9bca5ea
authored
Nov 25, 2003
by
Jon Griffiths
Committed by
Alexandre Julliard
Nov 25, 2003
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Macros for dumping a variants type and flags.
Fix the date inlines. Round negative numbers with fractional parts > 0.5 correctly.
parent
f68ec6fc
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
53 additions
and
17 deletions
+53
-17
variant.h
dlls/oleaut32/variant.h
+53
-17
No files found.
dlls/oleaut32/variant.h
View file @
f9bca5ea
...
@@ -24,6 +24,24 @@
...
@@ -24,6 +24,24 @@
#include "oleauto.h"
#include "oleauto.h"
#include <math.h>
#include <math.h>
/* Get just the type from a variant pointer */
#define V_TYPE(v) (V_VT((v)) & VT_TYPEMASK)
/* Flags set in V_VT, other than the actual type value */
#define VT_EXTRA_TYPE (VT_VECTOR|VT_ARRAY|VT_BYREF|VT_RESERVED)
/* Get the extra flags from a variant pointer */
#define V_EXTRA_TYPE(v) (V_VT((v)) & VT_EXTRA_TYPE)
extern
const
char
*
wine_vtypes
[];
#define debugstr_vt(v) (((v)&VT_TYPEMASK) <= VT_CLSID ? wine_vtypes[((v)&VT_TYPEMASK)] : \
((v)&VT_TYPEMASK) == VT_BSTR_BLOB ? "VT_BSTR_BLOB": "Invalid")
#define debugstr_VT(v) (!(v) ? "(null)" : debugstr_vt(V_TYPE((v))))
extern
const
char
*
wine_vflags
[];
#define debugstr_vf(v) (wine_vflags[((v)&VT_EXTRA_TYPE)>>12])
#define debugstr_VF(v) (!(v) ? "(null)" : debugstr_vf(V_EXTRA_TYPE(v)))
/* Size constraints */
/* Size constraints */
#define I1_MAX 0x7f
#define I1_MAX 0x7f
#define I1_MIN ((-I1_MAX)-1)
#define I1_MIN ((-I1_MAX)-1)
...
@@ -48,7 +66,7 @@
...
@@ -48,7 +66,7 @@
#define R8_MAX 1.79769313486231470e+308
#define R8_MAX 1.79769313486231470e+308
#define R8_MIN 4.94065645841246544e-324
#define R8_MIN 4.94065645841246544e-324
/* Value of sign for a positive number */
/* Value of sign for a positive
decimal
number */
#define DECIMAL_POS 0
#define DECIMAL_POS 0
/* Native headers don't change the union ordering for DECIMAL sign/scale (duh).
/* Native headers don't change the union ordering for DECIMAL sign/scale (duh).
...
@@ -74,7 +92,7 @@
...
@@ -74,7 +92,7 @@
#define DEC_MAX_SCALE 28
/* Maximum scale for a decimal */
#define DEC_MAX_SCALE 28
/* Maximum scale for a decimal */
/* Inline return type */
/* Inline return type */
#define RETTYP inline static HRESULT
#define RETTYP inline static HRESULT
/* Simple compiler cast from one type to another */
/* Simple compiler cast from one type to another */
#define SIMPLE(dest, src, func) RETTYP _##func(src in, dest* out) { \
#define SIMPLE(dest, src, func) RETTYP _##func(src in, dest* out) { \
...
@@ -297,10 +315,15 @@ BOOLFUNC(double,VarBoolFromR8);
...
@@ -297,10 +315,15 @@ BOOLFUNC(double,VarBoolFromR8);
#define _VarBoolFromDisp(disp,lcid,out) VARIANT_FromDisp(disp, lcid, (BYTE*)out, VT_BOOL)
#define _VarBoolFromDisp(disp,lcid,out) VARIANT_FromDisp(disp, lcid, (BYTE*)out, VT_BOOL)
#define _VarBoolFromDec VarBoolFromDec
#define _VarBoolFromDec VarBoolFromDec
/* Internal flags for low level conversion functions */
#define VAR_BOOLONOFF 0x0400
/* Convert bool to "On"/"Off" */
#define VAR_BOOLYESNO 0x0800
/* Convert bool to "Yes"/"No" */
#define VAR_NEGATIVE 0x1000
/* Number is negative */
/* DECIMAL */
/* DECIMAL */
#define _VarDecFromUI1 VarDecFromUI4
#define _VarDecFromUI1 VarDecFromUI4
#define _VarDecFromI2 VarDecFromI4
#define _VarDecFromI2 VarDecFromI4
#define _VarDecFromR4 VarDecFromR
8
#define _VarDecFromR4 VarDecFromR
4
#define _VarDecFromR8 VarDecFromR8
#define _VarDecFromR8 VarDecFromR8
#define _VarDecFromCy VarDecFromCy
#define _VarDecFromCy VarDecFromCy
#define _VarDecFromDate(dt,out) VarDecFromR8((double)dt,out)
#define _VarDecFromDate(dt,out) VarDecFromR8((double)dt,out)
...
@@ -336,21 +359,33 @@ RETTYP _VarCyFromI8(LONG64 i, CY* o) {
...
@@ -336,21 +359,33 @@ RETTYP _VarCyFromI8(LONG64 i, CY* o) {
#define _VarCyFromUI8 VarCyFromR8
#define _VarCyFromUI8 VarCyFromR8
/* DATE */
/* DATE */
#define _VarDateFromUI1 VarDateFromR8
#define _VarDateFromUI1 _VarR8FromUI1
#define _VarDateFromI2 VarDateFromR8
#define _VarDateFromI2 _VarR8FromI2
#define _VarDateFromR4 VarDateFromR8
#define _VarDateFromR4 _VarDateFromR8
#define _VarDateFromR8 VarDateFromR8
RETTYP
_VarDateFromR8
(
double
i
,
DATE
*
o
)
{
#define _VarDateFromCy VarDateFromCy
if
(
i
<=
(
DATE_MIN
-
1
.
0
)
||
i
>=
(
DATE_MAX
+
1
.
0
))
return
DISP_E_OVERFLOW
;
*
o
=
(
DATE
)
i
;
return
S_OK
;
}
#define _VarDateFromCy _VarR8FromCy
#define _VarDateFromStr VarDateFromStr
#define _VarDateFromStr VarDateFromStr
#define _VarDateFromDisp(disp,lcid,out) VARIANT_FromDisp(disp, lcid, out, VT_DATE)
#define _VarDateFromDisp(disp,lcid,out) VARIANT_FromDisp(disp, lcid, out, VT_DATE)
#define _VarDateFromBool VarDateFromR8
#define _VarDateFromBool _VarR8FromBool
#define _VarDateFromI1 VarDateFromR8
#define _VarDateFromI1 _VarR8FromI1
#define _VarDateFromUI2 VarDateFromR8
#define _VarDateFromUI2 _VarR8FromUI2
#define _VarDateFromI4 VarDateFromR8
#define _VarDateFromI4 _VarDateFromR8
#define _VarDateFromUI4 VarDateFromR8
#define _VarDateFromUI4 _VarDateFromR8
#define _VarDateFromDec VarDateFromDec
#define _VarDateFromDec _VarR8FromDec
#define _VarDateFromI8 VarDateFromR8
RETTYP
_VarDateFromI8
(
LONG64
i
,
DATE
*
o
)
{
#define _VarDateFromUI8 VarDateFromR8
if
(
i
<
DATE_MIN
||
i
>
DATE_MAX
)
return
DISP_E_OVERFLOW
;
*
o
=
(
DATE
)
i
;
return
S_OK
;
}
RETTYP
_VarDateFromUI8
(
ULONG64
i
,
DATE
*
o
)
{
if
(
i
>
DATE_MAX
)
return
DISP_E_OVERFLOW
;
*
o
=
(
DATE
)
i
;
return
S_OK
;
}
/* BSTR */
/* BSTR */
#define _VarBstrFromUI1 VarBstrFromUI4
#define _VarBstrFromUI1 VarBstrFromUI4
...
@@ -373,7 +408,8 @@ RETTYP _VarCyFromI8(LONG64 i, CY* o) {
...
@@ -373,7 +408,8 @@ RETTYP _VarCyFromI8(LONG64 i, CY* o) {
* rounding according to the 'dutch' convention.
* rounding according to the 'dutch' convention.
*/
*/
#define OLEAUT32_DutchRound(typ, value, res) do { \
#define OLEAUT32_DutchRound(typ, value, res) do { \
double whole = floor((double)value), fract = (double)value - whole; \
double whole = (double)value < 0 ? ceil((double)value) : floor((double)value); \
double fract = (double)value - whole; \
if (fract > 0.5) res = (typ)whole + (typ)1; \
if (fract > 0.5) res = (typ)whole + (typ)1; \
else if (fract == 0.5) { typ is_odd = (typ)whole & 1; res = whole + is_odd; } \
else if (fract == 0.5) { typ is_odd = (typ)whole & 1; res = whole + is_odd; } \
else if (fract >= 0.0) res = (typ)whole; \
else if (fract >= 0.0) res = (typ)whole; \
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment