2001-03-21 06:35:30 +08:00
|
|
|
#ifndef COM_H
|
|
|
|
#define COM_H
|
|
|
|
|
|
|
|
#if PHP_WIN32
|
|
|
|
|
2001-08-14 07:39:11 +08:00
|
|
|
BEGIN_EXTERN_C()
|
|
|
|
|
|
|
|
#include <oleauto.h>
|
2001-03-21 06:35:30 +08:00
|
|
|
|
2001-06-12 07:05:32 +08:00
|
|
|
typedef struct comval_ {
|
2001-06-25 05:09:17 +08:00
|
|
|
#ifdef _DEBUG
|
|
|
|
int resourceindex;
|
|
|
|
#endif
|
2001-06-12 07:05:32 +08:00
|
|
|
BOOL typelib;
|
|
|
|
BOOL enumeration;
|
|
|
|
int refcount;
|
2001-03-21 06:35:30 +08:00
|
|
|
struct {
|
|
|
|
IDispatch *dispatch;
|
|
|
|
ITypeInfo *typeinfo;
|
2001-06-12 07:05:32 +08:00
|
|
|
IEnumVARIANT *enumvariant;
|
2001-03-21 06:35:30 +08:00
|
|
|
} i;
|
2002-05-22 02:58:11 +08:00
|
|
|
IDispatch *sinkdispatch;
|
|
|
|
GUID sinkid;
|
|
|
|
DWORD sinkcookie;
|
2001-06-12 07:05:32 +08:00
|
|
|
} comval;
|
|
|
|
|
2001-08-14 07:39:11 +08:00
|
|
|
END_EXTERN_C()
|
|
|
|
|
2001-06-25 05:09:17 +08:00
|
|
|
#define ZVAL_COM(z,o) { \
|
2002-05-20 23:35:57 +08:00
|
|
|
zval *handle = NULL; \
|
|
|
|
ZVAL_COM_EX(z,o,handle) \
|
|
|
|
}
|
|
|
|
|
|
|
|
#define ZVAL_COM_EX(z,o,handle) { \
|
2001-08-12 12:31:14 +08:00
|
|
|
HashTable *properties; \
|
2001-06-25 05:09:17 +08:00
|
|
|
\
|
2001-08-12 12:31:14 +08:00
|
|
|
ALLOC_HASHTABLE(properties); \
|
|
|
|
zend_hash_init(properties, 0, NULL, ZVAL_PTR_DTOR, 0); \
|
2001-06-25 05:09:17 +08:00
|
|
|
\
|
2002-05-20 23:35:57 +08:00
|
|
|
if (handle == NULL) { \
|
|
|
|
MAKE_STD_ZVAL(handle); \
|
|
|
|
} \
|
2002-05-22 02:58:11 +08:00
|
|
|
ZVAL_RESOURCE(handle, zend_list_insert((o), IS_COM)); \
|
2001-06-25 05:09:17 +08:00
|
|
|
\
|
2001-07-29 03:23:21 +08:00
|
|
|
zval_copy_ctor(handle); \
|
2001-08-12 12:31:14 +08:00
|
|
|
zend_hash_index_update(properties, 0, &handle, sizeof(zval *), NULL); \
|
2001-08-14 07:39:11 +08:00
|
|
|
object_and_properties_init(z, &COM_class_entry, properties); \
|
2001-06-25 05:09:17 +08:00
|
|
|
}
|
|
|
|
|
2001-08-14 07:39:11 +08:00
|
|
|
#define RETVAL_COM(o) ZVAL_COM(&return_value, o);
|
2001-06-25 05:09:17 +08:00
|
|
|
#define RETURN_COM(o) RETVAL_COM(o) \
|
|
|
|
return;
|
|
|
|
|
2002-05-22 02:58:11 +08:00
|
|
|
#define ALLOC_COM(z) (z) = (comval *) ecalloc(1, sizeof(comval)); \
|
2001-08-14 07:39:11 +08:00
|
|
|
C_REFCOUNT(z) = 0;
|
|
|
|
|
2002-04-27 02:20:45 +08:00
|
|
|
#define FREE_COM(z) php_COM_destruct(z TSRMLS_CC);
|
2001-08-14 07:39:11 +08:00
|
|
|
|
2001-06-25 05:09:17 +08:00
|
|
|
#define IS_COM php_COM_get_le_comval()
|
2001-06-12 07:05:32 +08:00
|
|
|
|
|
|
|
#define C_HASTLIB(x) ((x)->typelib)
|
|
|
|
#define C_HASENUM(x) ((x)->enumeration)
|
2001-06-25 05:09:17 +08:00
|
|
|
#define C_REFCOUNT(x) ((x)->refcount)
|
|
|
|
#define C_ISREFD(x) C_REFCOUNT(x)
|
|
|
|
|
|
|
|
#define C_ADDREF(x) (++((x)->refcount))
|
|
|
|
#define C_RELEASE(x) (--((x)->refcount))
|
2001-06-12 07:05:32 +08:00
|
|
|
|
2001-06-25 05:09:17 +08:00
|
|
|
#define C_DISPATCH(x) ((x)->i.dispatch)
|
|
|
|
#define C_TYPEINFO(x) ((x)->i.typeinfo)
|
2001-06-12 07:05:32 +08:00
|
|
|
#define C_ENUMVARIANT(x) ((x)->i.enumvariant)
|
|
|
|
|
|
|
|
#define C_DISPATCH_VT(x) (C_DISPATCH(x)->lpVtbl)
|
|
|
|
#define C_TYPEINFO_VT(x) (C_TYPEINFO(x)->lpVtbl)
|
|
|
|
#define C_ENUMVARIANT_VT(x) (C_ENUMVARIANT(x)->lpVtbl)
|
|
|
|
|
2001-03-21 06:35:30 +08:00
|
|
|
#endif /* PHP_WIN32 */
|
|
|
|
|
|
|
|
#endif /* COM_H */
|