Ignore DSR/DTR flow control in DCB. termios doesn't support it.
[wine] / dlls / ddraw / ddcomimpl.h
1 /* A few helpful macros for implementing COM objects.
2  *
3  * Copyright 2000 TransGaming Technologies Inc.
4  */
5
6 #include <stddef.h>
7
8 /* Generates the name for a vtable pointer for a given interface. */
9 /* The canonical name for a single interface is "lpVtbl". */
10 #define ICOM_VFIELD_MULTI_NAME2(iface) ITF_##iface
11 #define ICOM_VFIELD_MULTI_NAME(iface) ICOM_VFIELD_MULTI_NAME2(iface)
12
13 /* Declares a vtable pointer field in an implementation. */
14 #define ICOM_VFIELD_MULTI(iface) \
15         iface ICOM_VFIELD_MULTI_NAME(iface)
16
17 /* Returns the offset of a vtable pointer within an implementation object. */
18 #define ICOM_VFIELD_OFFSET(impltype, iface) \
19         offsetof(impltype, ICOM_VFIELD_MULTI_NAME(iface))
20
21 /* Given an interface pointer, returns the implementation pointer. */
22 #define ICOM_OBJECT(impltype, ifacename, ifaceptr)              \
23         (impltype*)((ifaceptr) == NULL ? NULL                   \
24                   : (char*)(ifaceptr) - ICOM_VFIELD_OFFSET(impltype,ifacename))
25
26 #define ICOM_THIS_FROM(impltype, ifacename, ifaceptr) \
27         impltype* This = ICOM_OBJECT(impltype, ifacename, ifaceptr)
28
29 /* Given an object and interface name, returns a pointer to that interface. */
30 #define ICOM_INTERFACE(implobj, iface) \
31         (&((implobj)->ICOM_VFIELD_MULTI_NAME(iface)))
32
33 #define ICOM_INIT_INTERFACE(implobj, ifacename, vtblname) \
34         do { \
35           (implobj)->ICOM_VFIELD_MULTI_NAME(ifacename).lpVtbl = &(vtblname); \
36         } while (0)
37
38 #define COM_INTERFACE_CAST(impltype, ifnamefrom, ifnameto, ifaceptr)    \
39         ICOM_INTERFACE(ICOM_OBJECT(impltype, ifnamefrom, ifaceptr), ifnameto)