dmusic: Move the common parts of DMObject to a generic implementation.

This commit is contained in:
Michael Stefaniuc 2014-06-12 11:10:24 +02:00 committed by Alexandre Julliard
parent cb2b15921d
commit 02ed47fa3c
5 changed files with 214 additions and 133 deletions

View File

@ -5,6 +5,7 @@ C_SRCS = \
buffer.c \ buffer.c \
clock.c \ clock.c \
collection.c \ collection.c \
dmobject.c \
dmusic.c \ dmusic.c \
dmusic_main.c \ dmusic_main.c \
download.c \ download.c \

View File

@ -19,6 +19,7 @@
*/ */
#include "dmusic_private.h" #include "dmusic_private.h"
#include "dmobject.h"
WINE_DEFAULT_DEBUG_CHANNEL(dmusic); WINE_DEFAULT_DEBUG_CHANNEL(dmusic);
WINE_DECLARE_DEBUG_CHANNEL(dmfile); WINE_DECLARE_DEBUG_CHANNEL(dmfile);
@ -28,8 +29,7 @@ WINE_DECLARE_DEBUG_CHANNEL(dmfile);
*/ */
typedef struct IDirectMusicCollectionImpl { typedef struct IDirectMusicCollectionImpl {
IDirectMusicCollection IDirectMusicCollection_iface; IDirectMusicCollection IDirectMusicCollection_iface;
IDirectMusicObject IDirectMusicObject_iface; struct dmobject dmobj;
IPersistStream IPersistStream_iface;
LONG ref; LONG ref;
/* IDirectMusicCollectionImpl fields */ /* IDirectMusicCollectionImpl fields */
IStream *pStm; /* stream from which we load collection and later instruments */ IStream *pStm; /* stream from which we load collection and later instruments */
@ -50,14 +50,14 @@ static inline IDirectMusicCollectionImpl *impl_from_IDirectMusicCollection(IDire
return CONTAINING_RECORD(iface, IDirectMusicCollectionImpl, IDirectMusicCollection_iface); return CONTAINING_RECORD(iface, IDirectMusicCollectionImpl, IDirectMusicCollection_iface);
} }
static inline IDirectMusicCollectionImpl *impl_from_IDirectMusicObject(IDirectMusicObject *iface) static inline struct dmobject *impl_from_IDirectMusicObject(IDirectMusicObject *iface)
{ {
return CONTAINING_RECORD(iface, IDirectMusicCollectionImpl, IDirectMusicObject_iface); return CONTAINING_RECORD(iface, struct dmobject, IDirectMusicObject_iface);
} }
static inline IDirectMusicCollectionImpl *impl_from_IPersistStream(IPersistStream *iface) static inline IDirectMusicCollectionImpl *impl_from_IPersistStream(IPersistStream *iface)
{ {
return CONTAINING_RECORD(iface, IDirectMusicCollectionImpl, IPersistStream_iface); return CONTAINING_RECORD(iface, IDirectMusicCollectionImpl, dmobj.IPersistStream_iface);
} }
/* IDirectMusicCollectionImpl IUnknown part: */ /* IDirectMusicCollectionImpl IUnknown part: */
@ -72,9 +72,9 @@ static HRESULT WINAPI IDirectMusicCollectionImpl_IDirectMusicCollection_QueryInt
if (IsEqualIID(riid, &IID_IUnknown) || IsEqualIID(riid, &IID_IDirectMusicCollection)) if (IsEqualIID(riid, &IID_IUnknown) || IsEqualIID(riid, &IID_IDirectMusicCollection))
*ret_iface = iface; *ret_iface = iface;
else if (IsEqualIID(riid, &IID_IDirectMusicObject)) else if (IsEqualIID(riid, &IID_IDirectMusicObject))
*ret_iface = &This->IDirectMusicObject_iface; *ret_iface = &This->dmobj.IDirectMusicObject_iface;
else if (IsEqualIID(riid, &IID_IPersistStream)) else if (IsEqualIID(riid, &IID_IPersistStream))
*ret_iface = &This->IPersistStream_iface; *ret_iface = &This->dmobj.IPersistStream_iface;
else else
{ {
WARN("(%p/%p)->(%s, %p): not found\n", iface, This, debugstr_dmguid(riid), ret_iface); WARN("(%p/%p)->(%s, %p): not found\n", iface, This, debugstr_dmguid(riid), ret_iface);
@ -174,88 +174,6 @@ static const IDirectMusicCollectionVtbl DirectMusicCollection_Collection_Vtbl =
}; };
/* IDirectMusicCollectionImpl IDirectMusicObject part: */ /* IDirectMusicCollectionImpl IDirectMusicObject part: */
static HRESULT WINAPI IDirectMusicCollectionImpl_IDirectMusicObject_QueryInterface(LPDIRECTMUSICOBJECT iface, REFIID riid, LPVOID *ret_iface)
{
IDirectMusicCollectionImpl *This = impl_from_IDirectMusicObject(iface);
return IDirectMusicCollection_QueryInterface(&This->IDirectMusicCollection_iface, riid, ret_iface);
}
static ULONG WINAPI IDirectMusicCollectionImpl_IDirectMusicObject_AddRef(LPDIRECTMUSICOBJECT iface)
{
IDirectMusicCollectionImpl *This = impl_from_IDirectMusicObject(iface);
return IDirectMusicCollection_AddRef(&This->IDirectMusicCollection_iface);
}
static ULONG WINAPI IDirectMusicCollectionImpl_IDirectMusicObject_Release(LPDIRECTMUSICOBJECT iface)
{
IDirectMusicCollectionImpl *This = impl_from_IDirectMusicObject(iface);
return IDirectMusicCollection_Release(&This->IDirectMusicCollection_iface);
}
static HRESULT WINAPI IDirectMusicCollectionImpl_IDirectMusicObject_GetDescriptor(LPDIRECTMUSICOBJECT iface, LPDMUS_OBJECTDESC pDesc)
{
IDirectMusicCollectionImpl *This = impl_from_IDirectMusicObject(iface);
TRACE("(%p/%p)->(%p)\n", iface, This, pDesc);
if (!pDesc)
return E_POINTER;
memcpy (pDesc, This->pDesc, This->pDesc->dwSize);
return S_OK;
}
static HRESULT WINAPI IDirectMusicCollectionImpl_IDirectMusicObject_SetDescriptor(LPDIRECTMUSICOBJECT iface, LPDMUS_OBJECTDESC pDesc)
{
IDirectMusicCollectionImpl *This = impl_from_IDirectMusicObject(iface);
HRESULT ret = S_OK;
TRACE("(%p, %p)\n", iface, pDesc);
if (!pDesc)
return E_POINTER;
if (TRACE_ON(dmusic))
{
TRACE("Setting descriptor:\n");
dump_DMUS_OBJECTDESC(pDesc);
}
/* According to MSDN, we should copy only given values, not whole struct */
if (pDesc->dwValidData & DMUS_OBJ_OBJECT)
This->pDesc->guidObject = pDesc->guidObject;
if (pDesc->dwValidData & DMUS_OBJ_CLASS)
{
pDesc->dwValidData &= ~DMUS_OBJ_CLASS;
ret = S_FALSE;
}
if (pDesc->dwValidData & DMUS_OBJ_NAME)
lstrcpynW(This->pDesc->wszName, pDesc->wszName, DMUS_MAX_NAME);
if (pDesc->dwValidData & DMUS_OBJ_CATEGORY)
lstrcpynW(This->pDesc->wszCategory, pDesc->wszCategory, DMUS_MAX_CATEGORY);
if (pDesc->dwValidData & DMUS_OBJ_FILENAME)
lstrcpynW(This->pDesc->wszFileName, pDesc->wszFileName, DMUS_MAX_FILENAME);
if (pDesc->dwValidData & DMUS_OBJ_VERSION)
This->pDesc->vVersion = pDesc->vVersion;
if (pDesc->dwValidData & DMUS_OBJ_DATE)
This->pDesc->ftDate = pDesc->ftDate;
if (pDesc->dwValidData & DMUS_OBJ_MEMORY) {
This->pDesc->llMemLength = pDesc->llMemLength;
memcpy (This->pDesc->pbMemData, pDesc->pbMemData, pDesc->llMemLength);
}
if (pDesc->dwValidData & DMUS_OBJ_STREAM) {
/* according to MSDN, we copy the stream */
IStream_Clone (pDesc->pStream, &This->pDesc->pStream);
}
/* add new flags */
This->pDesc->dwValidData |= pDesc->dwValidData;
return ret;
}
static HRESULT read_from_stream(IStream *stream, void *data, ULONG size) static HRESULT read_from_stream(IStream *stream, void *data, ULONG size)
{ {
ULONG read; ULONG read;
@ -276,7 +194,7 @@ static HRESULT read_from_stream(IStream *stream, void *data, ULONG size)
static HRESULT WINAPI IDirectMusicCollectionImpl_IDirectMusicObject_ParseDescriptor(LPDIRECTMUSICOBJECT iface, LPSTREAM stream, LPDMUS_OBJECTDESC desc) static HRESULT WINAPI IDirectMusicCollectionImpl_IDirectMusicObject_ParseDescriptor(LPDIRECTMUSICOBJECT iface, LPSTREAM stream, LPDMUS_OBJECTDESC desc)
{ {
IDirectMusicCollectionImpl *This = impl_from_IDirectMusicObject(iface); struct dmobject *This = impl_from_IDirectMusicObject(iface);
DMUS_PRIVATE_CHUNK chunk; DMUS_PRIVATE_CHUNK chunk;
DWORD StreamSize, StreamCount, ListSize[1], ListCount[1]; DWORD StreamSize, StreamCount, ListSize[1], ListCount[1];
LARGE_INTEGER liMove; /* used when skipping chunks */ LARGE_INTEGER liMove; /* used when skipping chunks */
@ -286,7 +204,7 @@ static HRESULT WINAPI IDirectMusicCollectionImpl_IDirectMusicObject_ParseDescrip
/* FIXME: should this be determined from stream? */ /* FIXME: should this be determined from stream? */
desc->dwValidData |= DMUS_OBJ_CLASS; desc->dwValidData |= DMUS_OBJ_CLASS;
desc->guidClass = This->pDesc->guidClass; desc->guidClass = This->desc.guidClass;
hr = read_from_stream(stream, &chunk, sizeof(FOURCC) + sizeof(DWORD)); hr = read_from_stream(stream, &chunk, sizeof(FOURCC) + sizeof(DWORD));
if (FAILED(hr)) if (FAILED(hr))
@ -462,34 +380,16 @@ static HRESULT WINAPI IDirectMusicCollectionImpl_IDirectMusicObject_ParseDescrip
return S_OK; return S_OK;
} }
static const IDirectMusicObjectVtbl DirectMusicCollection_Object_Vtbl = { static const IDirectMusicObjectVtbl dmobject_vtbl = {
IDirectMusicCollectionImpl_IDirectMusicObject_QueryInterface, dmobj_IDirectMusicObject_QueryInterface,
IDirectMusicCollectionImpl_IDirectMusicObject_AddRef, dmobj_IDirectMusicObject_AddRef,
IDirectMusicCollectionImpl_IDirectMusicObject_Release, dmobj_IDirectMusicObject_Release,
IDirectMusicCollectionImpl_IDirectMusicObject_GetDescriptor, dmobj_IDirectMusicObject_GetDescriptor,
IDirectMusicCollectionImpl_IDirectMusicObject_SetDescriptor, dmobj_IDirectMusicObject_SetDescriptor,
IDirectMusicCollectionImpl_IDirectMusicObject_ParseDescriptor IDirectMusicCollectionImpl_IDirectMusicObject_ParseDescriptor
}; };
/* IDirectMusicCollectionImpl IPersistStream part: */ /* IDirectMusicCollectionImpl IPersistStream part: */
static HRESULT WINAPI IDirectMusicCollectionImpl_IPersistStream_QueryInterface(LPPERSISTSTREAM iface, REFIID riid, LPVOID *ret_iface)
{
IDirectMusicCollectionImpl *This = impl_from_IPersistStream(iface);
return IDirectMusicCollection_QueryInterface(&This->IDirectMusicCollection_iface, riid, ret_iface);
}
static ULONG WINAPI IDirectMusicCollectionImpl_IPersistStream_AddRef (LPPERSISTSTREAM iface)
{
IDirectMusicCollectionImpl *This = impl_from_IPersistStream(iface);
return IDirectMusicCollection_AddRef(&This->IDirectMusicCollection_iface);
}
static ULONG WINAPI IDirectMusicCollectionImpl_IPersistStream_Release (LPPERSISTSTREAM iface)
{
IDirectMusicCollectionImpl *This = impl_from_IPersistStream(iface);
return IDirectMusicCollection_Release(&This->IDirectMusicCollection_iface);
}
static HRESULT WINAPI IDirectMusicCollectionImpl_IPersistStream_GetClassID(LPPERSISTSTREAM iface, CLSID* pClassID) static HRESULT WINAPI IDirectMusicCollectionImpl_IPersistStream_GetClassID(LPPERSISTSTREAM iface, CLSID* pClassID)
{ {
return E_NOTIMPL; return E_NOTIMPL;
@ -813,10 +713,10 @@ static HRESULT WINAPI IDirectMusicCollectionImpl_IPersistStream_GetSizeMax(LPPER
return E_NOTIMPL; return E_NOTIMPL;
} }
static const IPersistStreamVtbl DirectMusicCollection_PersistStream_Vtbl = { static const IPersistStreamVtbl persiststream_vtbl = {
IDirectMusicCollectionImpl_IPersistStream_QueryInterface, dmobj_IPersistStream_QueryInterface,
IDirectMusicCollectionImpl_IPersistStream_AddRef, dmobj_IPersistStream_AddRef,
IDirectMusicCollectionImpl_IPersistStream_Release, dmobj_IPersistStream_Release,
IDirectMusicCollectionImpl_IPersistStream_GetClassID, IDirectMusicCollectionImpl_IPersistStream_GetClassID,
IDirectMusicCollectionImpl_IPersistStream_IsDirty, IDirectMusicCollectionImpl_IPersistStream_IsDirty,
IDirectMusicCollectionImpl_IPersistStream_Load, IDirectMusicCollectionImpl_IPersistStream_Load,
@ -825,7 +725,6 @@ static const IPersistStreamVtbl DirectMusicCollection_PersistStream_Vtbl = {
}; };
/* for ClassFactory */
HRESULT WINAPI DMUSIC_CreateDirectMusicCollectionImpl(LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter) HRESULT WINAPI DMUSIC_CreateDirectMusicCollectionImpl(LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter)
{ {
IDirectMusicCollectionImpl* obj; IDirectMusicCollectionImpl* obj;
@ -840,13 +739,13 @@ HRESULT WINAPI DMUSIC_CreateDirectMusicCollectionImpl(LPCGUID lpcGUID, LPVOID* p
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
obj->IDirectMusicCollection_iface.lpVtbl = &DirectMusicCollection_Collection_Vtbl; obj->IDirectMusicCollection_iface.lpVtbl = &DirectMusicCollection_Collection_Vtbl;
obj->IDirectMusicObject_iface.lpVtbl = &DirectMusicCollection_Object_Vtbl;
obj->IPersistStream_iface.lpVtbl = &DirectMusicCollection_PersistStream_Vtbl;
obj->pDesc = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(DMUS_OBJECTDESC));
DM_STRUCT_INIT(obj->pDesc);
obj->pDesc->dwValidData |= DMUS_OBJ_CLASS;
obj->pDesc->guidClass = CLSID_DirectMusicCollection;
obj->ref = 1; obj->ref = 1;
dmobject_init(&obj->dmobj, &CLSID_DirectMusicCollection,
(IUnknown*)&obj->IDirectMusicCollection_iface);
obj->dmobj.IDirectMusicObject_iface.lpVtbl = &dmobject_vtbl;
obj->dmobj.IPersistStream_iface.lpVtbl = &persiststream_vtbl;
obj->pDesc = &obj->dmobj.desc;
list_init (&obj->Instruments); list_init (&obj->Instruments);
DMUSIC_LockModule(); DMUSIC_LockModule();

144
dlls/dmusic/dmobject.c Normal file
View File

@ -0,0 +1,144 @@
/*
* Base IDirectMusicObject Implementation
*
* Copyright (C) 2003-2004 Rok Mandeljc
* Copyright (C) 2014 Michael Stefaniuc
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#define COBJMACROS
#include "objbase.h"
#include "dmusici.h"
#include "dmobject.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(dmobj);
/* Generic IDirectMusicObject methods */
static inline struct dmobject *impl_from_IDirectMusicObject(IDirectMusicObject *iface)
{
return CONTAINING_RECORD(iface, struct dmobject, IDirectMusicObject_iface);
}
HRESULT WINAPI dmobj_IDirectMusicObject_QueryInterface(IDirectMusicObject *iface, REFIID riid,
void **ret_iface)
{
struct dmobject *This = impl_from_IDirectMusicObject(iface);
return IUnknown_QueryInterface(This->outer_unk, riid, ret_iface);
}
ULONG WINAPI dmobj_IDirectMusicObject_AddRef(IDirectMusicObject *iface)
{
struct dmobject *This = impl_from_IDirectMusicObject(iface);
return IUnknown_AddRef(This->outer_unk);
}
ULONG WINAPI dmobj_IDirectMusicObject_Release(IDirectMusicObject *iface)
{
struct dmobject *This = impl_from_IDirectMusicObject(iface);
return IUnknown_Release(This->outer_unk);
}
HRESULT WINAPI dmobj_IDirectMusicObject_GetDescriptor(IDirectMusicObject *iface,
DMUS_OBJECTDESC *desc)
{
struct dmobject *This = impl_from_IDirectMusicObject(iface);
TRACE("(%p/%p)->(%p)\n", iface, This, desc);
if (!desc)
return E_POINTER;
memcpy(desc, &This->desc, This->desc.dwSize);
return S_OK;
}
HRESULT WINAPI dmobj_IDirectMusicObject_SetDescriptor(IDirectMusicObject *iface,
DMUS_OBJECTDESC *desc)
{
struct dmobject *This = impl_from_IDirectMusicObject(iface);
HRESULT ret = S_OK;
TRACE("(%p, %p)\n", iface, desc);
if (!desc)
return E_POINTER;
/* Immutable property */
if (desc->dwValidData & DMUS_OBJ_CLASS)
{
desc->dwValidData &= ~DMUS_OBJ_CLASS;
ret = S_FALSE;
}
/* Set only valid fields */
if (desc->dwValidData & DMUS_OBJ_OBJECT)
This->desc.guidObject = desc->guidObject;
if (desc->dwValidData & DMUS_OBJ_NAME)
lstrcpynW(This->desc.wszName, desc->wszName, DMUS_MAX_NAME);
if (desc->dwValidData & DMUS_OBJ_CATEGORY)
lstrcpynW(This->desc.wszCategory, desc->wszCategory, DMUS_MAX_CATEGORY);
if (desc->dwValidData & DMUS_OBJ_FILENAME)
lstrcpynW(This->desc.wszFileName, desc->wszFileName, DMUS_MAX_FILENAME);
if (desc->dwValidData & DMUS_OBJ_VERSION)
This->desc.vVersion = desc->vVersion;
if (desc->dwValidData & DMUS_OBJ_DATE)
This->desc.ftDate = desc->ftDate;
if (desc->dwValidData & DMUS_OBJ_MEMORY) {
This->desc.llMemLength = desc->llMemLength;
memcpy(This->desc.pbMemData, desc->pbMemData, desc->llMemLength);
}
if (desc->dwValidData & DMUS_OBJ_STREAM)
IStream_Clone(desc->pStream, &This->desc.pStream);
This->desc.dwValidData |= desc->dwValidData;
return ret;
}
/* Generic IPersistStream methods */
static inline struct dmobject *impl_from_IPersistStream(IPersistStream *iface)
{
return CONTAINING_RECORD(iface, struct dmobject, IPersistStream_iface);
}
HRESULT WINAPI dmobj_IPersistStream_QueryInterface(IPersistStream *iface, REFIID riid,
void **ret_iface)
{
struct dmobject *This = impl_from_IPersistStream(iface);
return IUnknown_QueryInterface(This->outer_unk, riid, ret_iface);
}
ULONG WINAPI dmobj_IPersistStream_AddRef(IPersistStream *iface)
{
struct dmobject *This = impl_from_IPersistStream(iface);
return IUnknown_AddRef(This->outer_unk);
}
ULONG WINAPI dmobj_IPersistStream_Release(IPersistStream *iface)
{
struct dmobject *This = impl_from_IPersistStream(iface);
return IUnknown_Release(This->outer_unk);
}
void dmobject_init(struct dmobject *dmobj, const GUID *class, IUnknown *outer_unk)
{
dmobj->outer_unk = outer_unk;
dmobj->desc.dwSize = sizeof(dmobj->desc);
dmobj->desc.dwValidData = DMUS_OBJ_CLASS;
dmobj->desc.guidClass = *class;
}

44
dlls/dmusic/dmobject.h Normal file
View File

@ -0,0 +1,44 @@
/*
* Base IDirectMusicObject Implementation
*
* Copyright (C) 2014 Michael Stefaniuc
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
struct dmobject {
IDirectMusicObject IDirectMusicObject_iface;
IPersistStream IPersistStream_iface;
IUnknown *outer_unk;
DMUS_OBJECTDESC desc;
};
void dmobject_init(struct dmobject *dmobj, const GUID *class, IUnknown *outer_unk) DECLSPEC_HIDDEN;
/* Generic IDirectMusicObject methods */
HRESULT WINAPI dmobj_IDirectMusicObject_QueryInterface(IDirectMusicObject *iface, REFIID riid,
void **ret_iface) DECLSPEC_HIDDEN;
ULONG WINAPI dmobj_IDirectMusicObject_AddRef(IDirectMusicObject *iface) DECLSPEC_HIDDEN;
ULONG WINAPI dmobj_IDirectMusicObject_Release(IDirectMusicObject *iface) DECLSPEC_HIDDEN;
HRESULT WINAPI dmobj_IDirectMusicObject_GetDescriptor(IDirectMusicObject *iface,
DMUS_OBJECTDESC *desc) DECLSPEC_HIDDEN;
HRESULT WINAPI dmobj_IDirectMusicObject_SetDescriptor(IDirectMusicObject *iface,
DMUS_OBJECTDESC *desc) DECLSPEC_HIDDEN;
/* Generic IPersistStream methods */
HRESULT WINAPI dmobj_IPersistStream_QueryInterface(IPersistStream *iface, REFIID riid,
void **ret_iface) DECLSPEC_HIDDEN;
ULONG WINAPI dmobj_IPersistStream_AddRef(IPersistStream *iface) DECLSPEC_HIDDEN;
ULONG WINAPI dmobj_IPersistStream_Release(IPersistStream *iface) DECLSPEC_HIDDEN;

View File

@ -269,13 +269,6 @@ typedef struct {
const char* name; const char* name;
} guid_info; } guid_info;
/* used for initialising structs (primarily for DMUS_OBJECTDESC) */
#define DM_STRUCT_INIT(x) \
do { \
memset((x), 0, sizeof(*(x))); \
(x)->dwSize = sizeof(*x); \
} while (0)
#define FE(x) { x, #x } #define FE(x) { x, #x }
#define GE(x) { &x, #x } #define GE(x) { &x, #x }