From e3ff5fffdc13045e4205925eb6e54db143b50246 Mon Sep 17 00:00:00 2001 From: Aleksey Bragin Date: Fri, 7 Aug 2009 20:15:12 +0000 Subject: [PATCH] - Sync WIDL and ole32 with Wine-1.1.23, w/o syncing rpcrt4. Credits go to Christoph for helping out with this sync. Tested with rpcrt4_winetests and MS Office 2003 setup. svn path=/trunk/; revision=42480 --- reactos/ReactOS-generic.rbuild | 1 + reactos/base/services/eventlog/rpc.c | 2 +- reactos/base/services/rpcss/irotp.c | 2 +- reactos/base/services/umpnpmgr/umpnpmgr.c | 2 +- reactos/base/services/wlansvc/rpcserver.c | 2 +- reactos/base/system/services/rpcserver.c | 2 +- reactos/dll/win32/advapi32/service/rpc.c | 2 +- reactos/dll/win32/lsasrv/lsasrv.c | 2 +- reactos/dll/win32/ole32/moniker.c | 2 +- reactos/dll/win32/ole32/stg_stream.c | 10 + reactos/dll/win32/ole32/storage32.c | 39 +- reactos/dll/win32/ole32/storage32.h | 2 + reactos/dll/win32/ole32/usrmarshal.c | 2 +- reactos/dll/win32/oleaut32/variant.c | 2 +- reactos/dll/win32/rpcrt4/ndr_ole.c | 2 +- reactos/dll/win32/rpcrt4/rpc_epmap.c | 2 +- reactos/dll/win32/setupapi/rpc.c | 2 +- reactos/dll/win32/wlanapi/main.c | 2 +- reactos/include/psdk/objbase.h | 8 +- reactos/include/psdk/objidl.idl | 2 +- reactos/include/psdk/ole2.h | 3 + reactos/include/psdk/rpcdce.h | 6 + reactos/include/psdk/rpcndr.h | 16 +- reactos/include/reactos/wine/port.h | 10 +- reactos/tools/widl/client.c | 9 +- reactos/tools/widl/expr.c | 145 +- reactos/tools/widl/hash.c | 3 +- reactos/tools/widl/hash.h | 8 +- reactos/tools/widl/header.c | 201 +- reactos/tools/widl/header.h | 8 +- reactos/tools/widl/parser.l | 1 - reactos/tools/widl/parser.tab.c | 5434 +++++++++++---------- reactos/tools/widl/parser.tab.h | 270 +- reactos/tools/widl/parser.y | 566 +-- reactos/tools/widl/parser.yy.c | 1 - reactos/tools/widl/proxy.c | 102 +- reactos/tools/widl/server.c | 31 +- reactos/tools/widl/typegen.c | 2161 ++++---- reactos/tools/widl/typegen.h | 36 +- reactos/tools/widl/typelib.c | 146 +- reactos/tools/widl/typetree.c | 197 +- reactos/tools/widl/typetree.h | 58 +- reactos/tools/widl/widl.c | 139 +- reactos/tools/widl/widl.h | 1 - reactos/tools/widl/widltypes.h | 130 +- reactos/tools/widl/write_msft.c | 107 +- 46 files changed, 5460 insertions(+), 4419 deletions(-) diff --git a/reactos/ReactOS-generic.rbuild b/reactos/ReactOS-generic.rbuild index 350956d36b9..455d991e1bb 100644 --- a/reactos/ReactOS-generic.rbuild +++ b/reactos/ReactOS-generic.rbuild @@ -91,6 +91,7 @@ -Wno-non-virtual-dtor -gstabs+ -gstabs+ + --win32 diff --git a/reactos/base/services/eventlog/rpc.c b/reactos/base/services/eventlog/rpc.c index 7952edcbdcf..e5e4e4da66f 100644 --- a/reactos/base/services/eventlog/rpc.c +++ b/reactos/base/services/eventlog/rpc.c @@ -660,7 +660,7 @@ NTSTATUS ElfrReportEventAndSourceW( } -void __RPC_FAR *__RPC_USER midl_user_allocate(size_t len) +void __RPC_FAR *__RPC_USER midl_user_allocate(SIZE_T len) { return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len); } diff --git a/reactos/base/services/rpcss/irotp.c b/reactos/base/services/rpcss/irotp.c index 00b282e8465..f766beb5766 100644 --- a/reactos/base/services/rpcss/irotp.c +++ b/reactos/base/services/rpcss/irotp.c @@ -368,7 +368,7 @@ void __RPC_USER IrotContextHandle_rundown(IrotContextHandle ctxt_handle) rot_entry_release(rot_entry); } -void * __RPC_USER MIDL_user_allocate(size_t size) +void * __RPC_USER MIDL_user_allocate(SIZE_T size) { return HeapAlloc(GetProcessHeap(), 0, size); } diff --git a/reactos/base/services/umpnpmgr/umpnpmgr.c b/reactos/base/services/umpnpmgr/umpnpmgr.c index 2d4603cba6c..55e9a0a74e6 100644 --- a/reactos/base/services/umpnpmgr/umpnpmgr.c +++ b/reactos/base/services/umpnpmgr/umpnpmgr.c @@ -135,7 +135,7 @@ RpcServerThread(LPVOID lpParameter) } -void __RPC_FAR * __RPC_USER midl_user_allocate(size_t len) +void __RPC_FAR * __RPC_USER midl_user_allocate(SIZE_T len) { return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len); } diff --git a/reactos/base/services/wlansvc/rpcserver.c b/reactos/base/services/wlansvc/rpcserver.c index 012dfaeee11..b6475257b5e 100644 --- a/reactos/base/services/wlansvc/rpcserver.c +++ b/reactos/base/services/wlansvc/rpcserver.c @@ -525,7 +525,7 @@ DWORD _RpcGetSecuritySettings( return ERROR_CALL_NOT_IMPLEMENTED; } -void __RPC_FAR * __RPC_USER midl_user_allocate(size_t len) +void __RPC_FAR * __RPC_USER midl_user_allocate(SIZE_T len) { return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len); } diff --git a/reactos/base/system/services/rpcserver.c b/reactos/base/system/services/rpcserver.c index ae7405a00b4..6dcfe57e596 100644 --- a/reactos/base/system/services/rpcserver.c +++ b/reactos/base/system/services/rpcserver.c @@ -5084,7 +5084,7 @@ DWORD RFunction55( } -void __RPC_FAR * __RPC_USER midl_user_allocate(size_t len) +void __RPC_FAR * __RPC_USER midl_user_allocate(SIZE_T len) { return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len); } diff --git a/reactos/dll/win32/advapi32/service/rpc.c b/reactos/dll/win32/advapi32/service/rpc.c index 8f73560028e..2ee75ab508e 100644 --- a/reactos/dll/win32/advapi32/service/rpc.c +++ b/reactos/dll/win32/advapi32/service/rpc.c @@ -12,7 +12,7 @@ void __RPC_FAR * __RPC_USER -midl_user_allocate(size_t len) +midl_user_allocate(SIZE_T len) { return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len); } diff --git a/reactos/dll/win32/lsasrv/lsasrv.c b/reactos/dll/win32/lsasrv/lsasrv.c index 8481f80b646..088da34437b 100644 --- a/reactos/dll/win32/lsasrv/lsasrv.c +++ b/reactos/dll/win32/lsasrv/lsasrv.c @@ -51,7 +51,7 @@ LsapInitLsa(VOID) } -void __RPC_FAR * __RPC_USER midl_user_allocate(size_t len) +void __RPC_FAR * __RPC_USER midl_user_allocate(SIZE_T len) { return RtlAllocateHeap(RtlGetProcessHeap(), HEAP_ZERO_MEMORY, len); } diff --git a/reactos/dll/win32/ole32/moniker.c b/reactos/dll/win32/ole32/moniker.c index 9ef82b5ff59..f65fe8fe728 100644 --- a/reactos/dll/win32/ole32/moniker.c +++ b/reactos/dll/win32/ole32/moniker.c @@ -1660,7 +1660,7 @@ HRESULT MonikerMarshal_Create(IMoniker *inner, IUnknown **outer) return S_OK; } -void * __RPC_USER MIDL_user_allocate(size_t size) +void * __RPC_USER MIDL_user_allocate(SIZE_T size) { return HeapAlloc(GetProcessHeap(), 0, size); } diff --git a/reactos/dll/win32/ole32/stg_stream.c b/reactos/dll/win32/ole32/stg_stream.c index d0e06134ec1..9acd4145191 100644 --- a/reactos/dll/win32/ole32/stg_stream.c +++ b/reactos/dll/win32/ole32/stg_stream.c @@ -575,6 +575,10 @@ static HRESULT WINAPI StgStreamImpl_SetSize( return STG_E_ACCESSDENIED; } + /* In simple mode keep the stream size above the small block limit */ + if (This->parentStorage->ancestorStorage->base.openFlags & STGM_SIMPLE) + libNewSize.u.LowPart = max(libNewSize.u.LowPart, LIMIT_TO_USE_SMALL_BLOCK); + if (This->streamSize.u.LowPart == libNewSize.u.LowPart) return S_OK; @@ -841,12 +845,18 @@ static HRESULT WINAPI StgStreamImpl_Stat( if (readSuccessful) { + StorageImpl *root = This->parentStorage->ancestorStorage; + StorageUtl_CopyPropertyToSTATSTG(pstatstg, &curProperty, grfStatFlag); pstatstg->grfMode = This->grfMode; + /* In simple create mode cbSize is the current pos */ + if((root->base.openFlags & STGM_SIMPLE) && root->create) + pstatstg->cbSize = This->currentPosition; + return S_OK; } diff --git a/reactos/dll/win32/ole32/storage32.c b/reactos/dll/win32/ole32/storage32.c index 748eac8048a..212c1ff965f 100644 --- a/reactos/dll/win32/ole32/storage32.c +++ b/reactos/dll/win32/ole32/storage32.c @@ -979,6 +979,10 @@ static HRESULT WINAPI StorageBaseImpl_CreateStream( (grfMode & STGM_TRANSACTED)) return STG_E_INVALIDFUNCTION; + /* Can't create a stream on read-only storage */ + if ( STGM_ACCESS_MODE( This->openFlags ) == STGM_READ ) + return STG_E_ACCESSDENIED; + /* * Check that we're compatible with the parent's storage mode * if not in transacted mode @@ -988,6 +992,9 @@ static HRESULT WINAPI StorageBaseImpl_CreateStream( return STG_E_ACCESSDENIED; } + if(This->ancestorStorage->base.openFlags & STGM_SIMPLE) + if(grfMode & STGM_CREATE) return STG_E_INVALIDFLAG; + /* * Initialize the out parameter */ @@ -1226,8 +1233,13 @@ static HRESULT WINAPI StorageImpl_CreateStorage( /* * An element with this name already exists */ - if (STGM_CREATE_MODE(grfMode) == STGM_CREATE) - IStorage_DestroyElement(iface, pwcsName); + if (STGM_CREATE_MODE(grfMode) == STGM_CREATE && + STGM_ACCESS_MODE(This->base.openFlags) != STGM_READ) + { + hr = IStorage_DestroyElement(iface, pwcsName); + if (FAILED(hr)) + return hr; + } else { WARN("file already exists\n"); @@ -1792,6 +1804,9 @@ static HRESULT WINAPI StorageImpl_DestroyElement( if (pwcsName==NULL) return STG_E_INVALIDPOINTER; + if ( STGM_ACCESS_MODE( This->base.openFlags ) == STGM_READ ) + return STG_E_ACCESSDENIED; + /* * Create a property enumeration to search the property with the given name */ @@ -2383,7 +2398,7 @@ static HRESULT StorageImpl_Construct( ILockBytes* pLkbyt, DWORD openFlags, BOOL fileBased, - BOOL fileCreate) + BOOL create) { HRESULT hr = S_OK; StgProperty currentProperty; @@ -2395,19 +2410,13 @@ static HRESULT StorageImpl_Construct( memset(This, 0, sizeof(StorageImpl)); - /* - * Initialize stream list - */ - list_init(&This->base.strmHead); - /* - * Initialize the virtual function table. - */ This->base.lpVtbl = &Storage32Impl_Vtbl; This->base.pssVtbl = &IPropertySetStorage_Vtbl; This->base.v_destructor = StorageImpl_Destroy; This->base.openFlags = (openFlags & ~STGM_CREATE); + This->create = create; /* * This is the top-level storage so initialize the ancestor pointer @@ -2415,14 +2424,8 @@ static HRESULT StorageImpl_Construct( */ This->base.ancestorStorage = This; - /* - * Initialize the physical support of the storage. - */ This->hFile = hFile; - /* - * Store copy of file path. - */ if(pwcsName) { This->pwcsName = HeapAlloc(GetProcessHeap(), 0, (lstrlenW(pwcsName)+1)*sizeof(WCHAR)); @@ -2445,7 +2448,7 @@ static HRESULT StorageImpl_Construct( if (This->bigBlockFile == 0) return E_FAIL; - if (fileCreate) + if (create) { ULARGE_INTEGER size; BYTE bigBlockBuffer[BIG_BLOCK_SIZE]; @@ -2526,7 +2529,7 @@ static HRESULT StorageImpl_Construct( /* * Write the root property (memory only) */ - if (fileCreate) + if (create) { StgProperty rootProp; /* diff --git a/reactos/dll/win32/ole32/storage32.h b/reactos/dll/win32/ole32/storage32.h index 1e42afb69a8..4be0631eb7a 100644 --- a/reactos/dll/win32/ole32/storage32.h +++ b/reactos/dll/win32/ole32/storage32.h @@ -255,6 +255,8 @@ struct StorageImpl */ HANDLE hFile; /* Physical support for the Docfile */ LPOLESTR pwcsName; /* Full path of the document file */ + BOOL create; /* Was the storage created or opened. + The behaviour of STGM_SIMPLE depends on this */ /* FIXME: should this be in Storage32BaseImpl ? */ WCHAR filename[PROPERTY_NAME_BUFFER_LEN]; diff --git a/reactos/dll/win32/ole32/usrmarshal.c b/reactos/dll/win32/ole32/usrmarshal.c index 46fba8b9213..f180f42f8ca 100644 --- a/reactos/dll/win32/ole32/usrmarshal.c +++ b/reactos/dll/win32/ole32/usrmarshal.c @@ -307,7 +307,7 @@ static unsigned char * handle_UserUnmarshal(ULONG *pFlags, unsigned char *pBuffe RemotableHandle *remhandle = (RemotableHandle *)pBuffer; if (remhandle->fContext != WDT_INPROC_CALL) RaiseException(RPC_X_BAD_STUB_DATA, 0, 0, NULL); - *handle = (HANDLE)remhandle->u.hInproc; + *handle = (HANDLE)(LONG_PTR)remhandle->u.hInproc; return pBuffer + sizeof(RemotableHandle); } diff --git a/reactos/dll/win32/oleaut32/variant.c b/reactos/dll/win32/oleaut32/variant.c index 909cf8a830c..37965f8ed53 100644 --- a/reactos/dll/win32/oleaut32/variant.c +++ b/reactos/dll/win32/oleaut32/variant.c @@ -3009,7 +3009,7 @@ HRESULT WINAPI VarAnd(LPVARIANT left, LPVARIANT right, LPVARIANT result) { /* * Special cases for when left variant is VT_NULL - * (NULL & 0 = NULL, NULL & value = value) + * (VT_NULL & 0 = VT_NULL, VT_NULL & value = value) */ if (leftvt == VT_NULL) { diff --git a/reactos/dll/win32/rpcrt4/ndr_ole.c b/reactos/dll/win32/rpcrt4/ndr_ole.c index 729ab0b9f1e..a3264e70122 100644 --- a/reactos/dll/win32/rpcrt4/ndr_ole.c +++ b/reactos/dll/win32/rpcrt4/ndr_ole.c @@ -354,7 +354,7 @@ void WINAPI NdrInterfacePointerFree(PMIDL_STUB_MESSAGE pStubMsg, /*********************************************************************** * NdrOleAllocate [RPCRT4.@] */ -void * WINAPI NdrOleAllocate(size_t Size) +void * WINAPI NdrOleAllocate(SIZE_T Size) { if (!LoadCOM()) return NULL; return COM_MemAlloc(Size); diff --git a/reactos/dll/win32/rpcrt4/rpc_epmap.c b/reactos/dll/win32/rpcrt4/rpc_epmap.c index 544ad74bf69..286ffbf9973 100644 --- a/reactos/dll/win32/rpcrt4/rpc_epmap.c +++ b/reactos/dll/win32/rpcrt4/rpc_epmap.c @@ -596,7 +596,7 @@ RPC_STATUS WINAPI TowerConstruct( return RPC_S_OK; } -void __RPC_FAR * __RPC_USER MIDL_user_allocate(size_t len) +void __RPC_FAR * __RPC_USER MIDL_user_allocate(SIZE_T len) { return HeapAlloc(GetProcessHeap(), 0, len); } diff --git a/reactos/dll/win32/setupapi/rpc.c b/reactos/dll/win32/setupapi/rpc.c index 71ff8842570..3d55315ec6d 100644 --- a/reactos/dll/win32/setupapi/rpc.c +++ b/reactos/dll/win32/setupapi/rpc.c @@ -111,7 +111,7 @@ PnpUnbindLocalBindingHandle(VOID) void __RPC_FAR * __RPC_USER -midl_user_allocate(size_t len) +midl_user_allocate(SIZE_T len) { return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len); } diff --git a/reactos/dll/win32/wlanapi/main.c b/reactos/dll/win32/wlanapi/main.c index fbde40253f2..2b013338e8d 100644 --- a/reactos/dll/win32/wlanapi/main.c +++ b/reactos/dll/win32/wlanapi/main.c @@ -198,7 +198,7 @@ WlanScan(IN HANDLE hClientHandle, } void __RPC_FAR * __RPC_USER -midl_user_allocate(size_t len) +midl_user_allocate(SIZE_T len) { return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len); } diff --git a/reactos/include/psdk/objbase.h b/reactos/include/psdk/objbase.h index 40f370c4a0f..a5bfe187963 100644 --- a/reactos/include/psdk/objbase.h +++ b/reactos/include/psdk/objbase.h @@ -331,6 +331,7 @@ HINSTANCE WINAPI CoLoadLibrary(LPOLESTR lpszLibName, BOOL bAutoFree); void WINAPI CoFreeAllLibraries(void); void WINAPI CoFreeLibrary(HINSTANCE hLibrary); void WINAPI CoFreeUnusedLibraries(void); +void WINAPI CoFreeUnusedLibrariesEx(DWORD dwUnloadDelay, DWORD dwReserved); HRESULT WINAPI CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv); HRESULT WINAPI CoCreateInstanceEx(REFCLSID rclsid, @@ -344,13 +345,15 @@ HRESULT WINAPI CoGetInstanceFromFile(COSERVERINFO* pServerInfo, CLSID* pClsid, I HRESULT WINAPI CoGetInstanceFromIStorage(COSERVERINFO* pServerInfo, CLSID* pClsid, IUnknown* punkOuter, DWORD dwClsCtx, IStorage* pstg, DWORD dwCount, MULTI_QI* pResults); HRESULT WINAPI CoGetMalloc(DWORD dwMemContext, LPMALLOC* lpMalloc); -LPVOID WINAPI CoTaskMemAlloc(ULONG size); +LPVOID WINAPI CoTaskMemAlloc(ULONG size) __WINE_ALLOC_SIZE(1); void WINAPI CoTaskMemFree(LPVOID ptr); LPVOID WINAPI CoTaskMemRealloc(LPVOID ptr, ULONG size); HRESULT WINAPI CoRegisterMallocSpy(LPMALLOCSPY pMallocSpy); HRESULT WINAPI CoRevokeMallocSpy(void); +HRESULT WINAPI CoGetContextToken( ULONG_PTR *token ); + /* class registration flags; passed to CoRegisterClassObject */ typedef enum tagREGCLS { @@ -390,9 +393,10 @@ BOOL WINAPI CoIsHandlerConnected(LPUNKNOWN pUnk); /* security */ HRESULT WINAPI CoInitializeSecurity(PSECURITY_DESCRIPTOR pSecDesc, LONG cAuthSvc, SOLE_AUTHENTICATION_SERVICE* asAuthSvc, void* pReserved1, DWORD dwAuthnLevel, DWORD dwImpLevel, void* pReserved2, DWORD dwCapabilities, void* pReserved3); HRESULT WINAPI CoGetCallContext(REFIID riid, void** ppInterface); +HRESULT WINAPI CoSwitchCallContext(IUnknown *pContext, IUnknown **ppOldContext); HRESULT WINAPI CoQueryAuthenticationServices(DWORD* pcAuthSvc, SOLE_AUTHENTICATION_SERVICE** asAuthSvc); -HRESULT WINAPI CoQueryProxyBlanket(IUnknown* pProxy, DWORD* pwAuthnSvc, DWORD* pAuthzSvc, OLECHAR** pServerPrincName, DWORD* pAuthnLevel, DWORD* pImpLevel, RPC_AUTH_IDENTITY_HANDLE* pAuthInfo, DWORD* pCapabilites); +HRESULT WINAPI CoQueryProxyBlanket(IUnknown* pProxy, DWORD* pwAuthnSvc, DWORD* pAuthzSvc, OLECHAR** pServerPrincName, DWORD* pAuthnLevel, DWORD* pImpLevel, RPC_AUTH_IDENTITY_HANDLE* pAuthInfo, DWORD* pCapabilities); HRESULT WINAPI CoSetProxyBlanket(IUnknown* pProxy, DWORD dwAuthnSvc, DWORD dwAuthzSvc, OLECHAR* pServerPrincName, DWORD dwAuthnLevel, DWORD dwImpLevel, RPC_AUTH_IDENTITY_HANDLE pAuthInfo, DWORD dwCapabilities); HRESULT WINAPI CoCopyProxy(IUnknown* pProxy, IUnknown** ppCopy); diff --git a/reactos/include/psdk/objidl.idl b/reactos/include/psdk/objidl.idl index fb34c20f2e4..536e3d3470d 100644 --- a/reactos/include/psdk/objidl.idl +++ b/reactos/include/psdk/objidl.idl @@ -2442,7 +2442,7 @@ interface IContext : IUnknown [in] CPFLAGS flags, [in] IUnknown *pUnk); - HRESULT RemovePropert( + HRESULT RemoveProperty( [in] REFGUID policyId); HRESULT GetProperty( diff --git a/reactos/include/psdk/ole2.h b/reactos/include/psdk/ole2.h index a92c2f4ee0e..cc75afdf14c 100644 --- a/reactos/include/psdk/ole2.h +++ b/reactos/include/psdk/ole2.h @@ -122,6 +122,9 @@ HRESULT WINAPI WriteFmtUserTypeStg(LPSTORAGE pstg, CLIPFORMAT cf, LPOLESTR l HRESULT WINAPI OleTranslateAccelerator (LPOLEINPLACEFRAME lpFrame, LPOLEINPLACEFRAMEINFO lpFrameInfo, struct tagMSG* lpmsg); HRESULT WINAPI OleCreateFromData(LPDATAOBJECT pSrcDataObj, REFIID riid, DWORD renderopt, LPFORMATETC pFormatEtc, LPOLECLIENTSITE pClientSite, LPSTORAGE pStg, LPVOID* ppvObj); +HRESULT WINAPI OleCreateFromDataEx(LPDATAOBJECT pSrcDataObj, REFIID riid, DWORD dwFlags, DWORD renderopt, ULONG num_formats, + DWORD *adv_flags, LPFORMATETC fmts, IAdviseSink *sink, DWORD *conns, + LPOLECLIENTSITE pClientSite, LPSTORAGE pStg, LPVOID* ppvObj); HRESULT WINAPI OleCreateDefaultHandler(REFCLSID clsid, LPUNKNOWN pUnkOuter, REFIID riid, diff --git a/reactos/include/psdk/rpcdce.h b/reactos/include/psdk/rpcdce.h index 2d287ae0c9c..9486a35f1f5 100644 --- a/reactos/include/psdk/rpcdce.h +++ b/reactos/include/psdk/rpcdce.h @@ -393,6 +393,9 @@ RPCRTAPI RPC_STATUS RPC_ENTRY RpcMgmtSetCancelTimeout(LONG); RPCRTAPI RPC_STATUS RPC_ENTRY RpcMgmtWaitServerListen( void ); +RPCRTAPI RPC_STATUS RPC_ENTRY + RpcMgmtInqStats( RPC_BINDING_HANDLE Binding, RPC_STATS_VECTOR **Statistics ); + RPCRTAPI RPC_STATUS RPC_ENTRY RpcMgmtStopServerListening( RPC_BINDING_HANDLE Binding ); @@ -412,6 +415,9 @@ RPCRTAPI RPC_STATUS RPC_ENTRY RPCRTAPI RPC_STATUS RPC_ENTRY RpcMgmtSetServerStackSize( ULONG ThreadStackSize ); +RPCRTAPI RPC_STATUS RPC_ENTRY +RpcMgmtStatsVectorFree( RPC_STATS_VECTOR **StatsVector ); + RPCRTAPI RPC_STATUS RPC_ENTRY RpcServerRegisterIf( RPC_IF_HANDLE IfSpec, UUID* MgrTypeUuid, RPC_MGR_EPV* MgrEpv ); diff --git a/reactos/include/psdk/rpcndr.h b/reactos/include/psdk/rpcndr.h index 862e957202d..ed1425982b0 100644 --- a/reactos/include/psdk/rpcndr.h +++ b/reactos/include/psdk/rpcndr.h @@ -177,7 +177,6 @@ typedef struct _NDR_PIPE_MESSAGE *PNDR_PIPE_MESSAGE; typedef struct _NDR_ASYNC_MESSAGE *PNDR_ASYNC_MESSAGE; typedef struct _NDR_CORRELATION_INFO *PNDR_CORRELATION_INFO; -#include typedef struct _MIDL_STUB_MESSAGE { PRPC_MESSAGE RpcMsg; @@ -202,7 +201,7 @@ typedef struct _MIDL_STUB_MESSAGE ULONG_PTR MaxCount; ULONG Offset; ULONG ActualCount; - void * (__WINE_ALLOC_SIZE(1) __RPC_API *pfnAllocate)(size_t); + void * (__WINE_ALLOC_SIZE(1) __RPC_API *pfnAllocate)(SIZE_T); void (__RPC_API *pfnFree)(void *); unsigned char *StackTop; unsigned char *pPresentedType; @@ -254,7 +253,6 @@ typedef struct _MIDL_STUB_MESSAGE INT_PTR Reserved51_4; INT_PTR Reserved51_5; } MIDL_STUB_MESSAGE, *PMIDL_STUB_MESSAGE; -#include typedef void * (__RPC_API * GENERIC_BINDING_ROUTINE)(void *); typedef void (__RPC_API * GENERIC_UNBIND_ROUTINE)(void *, unsigned char *); @@ -329,7 +327,7 @@ typedef struct _USER_MARSHAL_CB typedef struct _MALLOC_FREE_STRUCT { - void * (__WINE_ALLOC_SIZE(1) __RPC_USER *pfnAllocate)(size_t); + void * (__WINE_ALLOC_SIZE(1) __RPC_USER *pfnAllocate)(SIZE_T); void (__RPC_USER *pfnFree)(void *); } MALLOC_FREE_STRUCT; @@ -342,7 +340,7 @@ typedef struct _COMM_FAULT_OFFSETS typedef struct _MIDL_STUB_DESC { void *RpcInterfaceInformation; - void * (__WINE_ALLOC_SIZE(1) __RPC_API *pfnAllocate)(size_t); + void * (__WINE_ALLOC_SIZE(1) __RPC_API *pfnAllocate)(SIZE_T); void (__RPC_API *pfnFree)(void *); union { handle_t *pAutoHandle; @@ -481,7 +479,7 @@ typedef struct _NDR_USER_MARSHAL_INFO_LEVEL1 { void *Buffer; ULONG BufferSize; - void * (__WINE_ALLOC_SIZE(1) __RPC_API *pfnAllocate)(size_t); + void * (__WINE_ALLOC_SIZE(1) __RPC_API *pfnAllocate)(SIZE_T); void (__RPC_API *pfnFree)(void *); struct IRpcChannelBuffer *pRpcChannelBuffer; ULONG_PTR Reserved[5]; @@ -685,7 +683,7 @@ RPCRTAPI RPC_STATUS RPC_ENTRY ULONG *pFaultStatus, RPC_STATUS Status_ ); RPCRTAPI void* RPC_ENTRY - NdrOleAllocate( size_t Size ) __WINE_ALLOC_SIZE(1); + NdrOleAllocate( SIZE_T Size ) __WINE_ALLOC_SIZE(1); RPCRTAPI void RPC_ENTRY NdrOleFree( void* NodeToFree ); @@ -746,11 +744,11 @@ RPCRTAPI void RPC_ENTRY RPCRTAPI void RPC_ENTRY NdrRpcSmSetClientToOsf( PMIDL_STUB_MESSAGE pMessage ); RPCRTAPI void * RPC_ENTRY - NdrRpcSmClientAllocate( size_t Size ) __WINE_ALLOC_SIZE(1); + NdrRpcSmClientAllocate( SIZE_T Size ) __WINE_ALLOC_SIZE(1); RPCRTAPI void RPC_ENTRY NdrRpcSmClientFree( void *NodeToFree ); RPCRTAPI void * RPC_ENTRY - NdrRpcSsDefaultAllocate( size_t Size ) __WINE_ALLOC_SIZE(1); + NdrRpcSsDefaultAllocate( SIZE_T Size ) __WINE_ALLOC_SIZE(1); RPCRTAPI void RPC_ENTRY NdrRpcSsDefaultFree( void *NodeToFree ); diff --git a/reactos/include/reactos/wine/port.h b/reactos/include/reactos/wine/port.h index 95319c33697..1e7e9475eae 100644 --- a/reactos/include/reactos/wine/port.h +++ b/reactos/include/reactos/wine/port.h @@ -150,14 +150,16 @@ struct statfs; /* Macros to define assembler functions somewhat portably */ -#ifdef __GNUC__ +#if defined(__GNUC__) && !defined(__INTERIX) && !defined(__MINGW32__) && !defined(__CYGWIN__) && !defined(__APPLE__) # define __ASM_GLOBAL_FUNC(name,code) \ - __asm__( ".align 4\n\t" \ + __asm__( ".text\n\t" \ + ".align 4\n\t" \ ".globl " __ASM_NAME(#name) "\n\t" \ __ASM_FUNC(#name) "\n" \ __ASM_NAME(#name) ":\n\t" \ - code ); -#else /* __GNUC__ */ + code \ + "\n\t.previous" ); +#else /* defined(__GNUC__) && !defined(__MINGW32__) && !defined(__APPLE__) */ # define __ASM_GLOBAL_FUNC(name,code) \ void __asm_dummy_##name(void) { \ asm( ".align 4\n\t" \ diff --git a/reactos/tools/widl/client.c b/reactos/tools/widl/client.c index a23e298491c..b683a14b315 100644 --- a/reactos/tools/widl/client.c +++ b/reactos/tools/widl/client.c @@ -41,6 +41,7 @@ static FILE* client; static int indent = 0; +static void print_client( const char *format, ... ) __attribute__((format (printf, 1, 2))); static void print_client( const char *format, ... ) { va_list va; @@ -166,7 +167,7 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset) /* declare return value '_RetVal' */ if (!is_void(type_function_get_rettype(func->type))) { - print_client(""); + print_client("%s", ""); write_type_decl_left(client, type_function_get_rettype(func->type)); fprintf(client, " _RetVal;\n"); } @@ -387,7 +388,7 @@ static void write_stubdescriptor(type_t *iface, int expr_eval_routines) static void write_clientinterfacedecl(type_t *iface) { - unsigned long ver = get_attrv(iface->attrs, ATTR_VERSION); + unsigned int ver = get_attrv(iface->attrs, ATTR_VERSION); const UUID *uuid = get_attrp(iface->attrs, ATTR_UUID); const str_list_t *endpoints = get_attrp(iface->attrs, ATTR_ENDPOINT); @@ -397,7 +398,7 @@ static void write_clientinterfacedecl(type_t *iface) print_client("{\n"); indent++; print_client("sizeof(RPC_CLIENT_INTERFACE),\n"); - print_client("{{0x%08lx,0x%04x,0x%04x,{0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x}},{%d,%d}},\n", + print_client("{{0x%08x,0x%04x,0x%04x,{0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x}},{%d,%d}},\n", uuid->Data1, uuid->Data2, uuid->Data3, uuid->Data4[0], uuid->Data4[1], uuid->Data4[2], uuid->Data4[3], uuid->Data4[4], uuid->Data4[5], uuid->Data4[6], uuid->Data4[7], MAJORVERSION(ver), MINORVERSION(ver)); @@ -468,7 +469,7 @@ static void write_client_ifaces(const statement_list_t *stmts, int expr_eval_rou const statement_t *stmt; if (stmts) LIST_FOR_EACH_ENTRY( stmt, stmts, const statement_t, entry ) { - if (stmt->type == STMT_TYPE && stmt->u.type->type == RPC_FC_IP) + if (stmt->type == STMT_TYPE && type_get_type(stmt->u.type) == TYPE_INTERFACE) { int has_func = 0; const statement_t *stmt2; diff --git a/reactos/tools/widl/expr.c b/reactos/tools/widl/expr.c index 7717da3f7bf..405b5def1b6 100644 --- a/reactos/tools/widl/expr.c +++ b/reactos/tools/widl/expr.c @@ -33,6 +33,10 @@ #include "expr.h" #include "header.h" #include "typetree.h" +#include "typegen.h" + +static int is_integer_type(const type_t *type); +static int is_float_type(const type_t *type); expr_t *make_expr(enum expr_type type) { @@ -105,38 +109,17 @@ expr_t *make_exprt(enum expr_type type, type_t *tref, expr_t *expr) e->ref = expr; e->u.tref = tref; e->is_const = FALSE; - /* check for cast of constant expression */ if (type == EXPR_SIZEOF) { - switch (tref->type) + /* only do this for types that should be the same on all platforms */ + if (is_integer_type(tref) || is_float_type(tref)) { - case RPC_FC_BYTE: - case RPC_FC_CHAR: - case RPC_FC_SMALL: - case RPC_FC_USMALL: + unsigned int align = 0; e->is_const = TRUE; - e->cval = 1; - break; - case RPC_FC_WCHAR: - case RPC_FC_USHORT: - case RPC_FC_SHORT: - e->is_const = TRUE; - e->cval = 2; - break; - case RPC_FC_LONG: - case RPC_FC_ULONG: - case RPC_FC_FLOAT: - case RPC_FC_ERROR_STATUS_T: - e->is_const = TRUE; - e->cval = 4; - break; - case RPC_FC_HYPER: - case RPC_FC_DOUBLE: - e->is_const = TRUE; - e->cval = 8; - break; + e->cval = type_memsize(tref, &align); } } + /* check for cast of constant expression */ if (type == EXPR_CAST && expr->is_const) { e->is_const = TRUE; @@ -302,34 +285,44 @@ struct expression_type static int is_integer_type(const type_t *type) { - switch (type->type) + switch (type_get_type(type)) { - case RPC_FC_BYTE: - case RPC_FC_CHAR: - case RPC_FC_SMALL: - case RPC_FC_USMALL: - case RPC_FC_WCHAR: - case RPC_FC_SHORT: - case RPC_FC_USHORT: - case RPC_FC_LONG: - case RPC_FC_ULONG: - case RPC_FC_INT3264: - case RPC_FC_UINT3264: - case RPC_FC_HYPER: - case RPC_FC_ENUM16: - case RPC_FC_ENUM32: + case TYPE_ENUM: return TRUE; + case TYPE_BASIC: + switch (type_basic_get_type(type)) + { + case TYPE_BASIC_INT8: + case TYPE_BASIC_INT16: + case TYPE_BASIC_INT32: + case TYPE_BASIC_INT64: + case TYPE_BASIC_INT: + case TYPE_BASIC_CHAR: + case TYPE_BASIC_HYPER: + case TYPE_BASIC_BYTE: + case TYPE_BASIC_WCHAR: + case TYPE_BASIC_ERROR_STATUS_T: + return TRUE; + default: + return FALSE; + } default: return FALSE; } } +static int is_float_type(const type_t *type) +{ + return (type_get_type(type) == TYPE_BASIC && + (type_basic_get_type(type) == TYPE_BASIC_FLOAT || + type_basic_get_type(type) == TYPE_BASIC_DOUBLE)); +} + static void check_scalar_type(const struct expr_loc *expr_loc, const type_t *cont_type, const type_t *type) { if (!cont_type || (!is_integer_type(type) && !is_ptr(type) && - type->type != RPC_FC_FLOAT && - type->type != RPC_FC_DOUBLE)) + !is_float_type(type))) error_loc_info(&expr_loc->v->loc_info, "scalar type required in expression%s%s\n", expr_loc->attr ? " for attribute " : "", expr_loc->attr ? expr_loc->attr : ""); @@ -338,9 +331,7 @@ static void check_scalar_type(const struct expr_loc *expr_loc, static void check_arithmetic_type(const struct expr_loc *expr_loc, const type_t *cont_type, const type_t *type) { - if (!cont_type || (!is_integer_type(type) && - type->type != RPC_FC_FLOAT && - type->type != RPC_FC_DOUBLE)) + if (!cont_type || (!is_integer_type(type) && !is_float_type(type))) error_loc_info(&expr_loc->v->loc_info, "arithmetic type required in expression%s%s\n", expr_loc->attr ? " for attribute " : "", expr_loc->attr ? expr_loc->attr : ""); @@ -365,12 +356,33 @@ static type_t *find_identifier(const char *identifier, const type_t *cont_type, if (cont_type) { - if (cont_type->type == RPC_FC_FUNCTION) + switch (type_get_type(cont_type)) + { + case TYPE_FUNCTION: fields = type_function_get_args(cont_type); - else if (is_struct(cont_type->type)) + break; + case TYPE_STRUCT: fields = type_struct_get_fields(cont_type); - else if (is_union(cont_type->type)) + break; + case TYPE_UNION: + case TYPE_ENCAPSULATED_UNION: fields = type_union_get_cases(cont_type); + break; + case TYPE_VOID: + case TYPE_BASIC: + case TYPE_ENUM: + case TYPE_MODULE: + case TYPE_COCLASS: + case TYPE_INTERFACE: + case TYPE_POINTER: + case TYPE_ARRAY: + /* nothing to do */ + break; + case TYPE_ALIAS: + /* shouldn't get here because of using type_get_type above */ + assert(0); + break; + } } if (fields) LIST_FOR_EACH_ENTRY( field, fields, const var_t, entry ) @@ -390,6 +402,19 @@ static type_t *find_identifier(const char *identifier, const type_t *cont_type, return type; } +static int is_valid_member_operand(const type_t *type) +{ + switch (type_get_type(type)) + { + case TYPE_STRUCT: + case TYPE_UNION: + case TYPE_ENUM: + return TRUE; + default: + return FALSE; + } +} + static struct expression_type resolve_expression(const struct expr_loc *expr_loc, const type_t *cont_type, const expr_t *e) @@ -407,22 +432,22 @@ static struct expression_type resolve_expression(const struct expr_loc *expr_loc case EXPR_TRUEFALSE: result.is_variable = FALSE; result.is_temporary = FALSE; - result.type = find_type("int", 0); + result.type = type_new_int(TYPE_BASIC_INT, 0); break; case EXPR_STRLIT: result.is_variable = FALSE; result.is_temporary = TRUE; - result.type = make_type(RPC_FC_RP, find_type("char", 0)); + result.type = type_new_pointer(RPC_FC_UP, type_new_int(TYPE_BASIC_CHAR, 0), NULL); break; case EXPR_WSTRLIT: result.is_variable = FALSE; result.is_temporary = TRUE; - result.type = make_type(RPC_FC_RP, find_type("wchar_t", 0)); + result.type = type_new_pointer(RPC_FC_UP, type_new_int(TYPE_BASIC_WCHAR, 0), NULL); break; case EXPR_DOUBLE: result.is_variable = FALSE; - result.is_temporary = FALSE; - result.type = find_type("double", 0); + result.is_temporary = TRUE; + result.type = type_new_basic(TYPE_BASIC_DOUBLE); break; case EXPR_IDENTIFIER: { @@ -443,7 +468,7 @@ static struct expression_type resolve_expression(const struct expr_loc *expr_loc check_scalar_type(expr_loc, cont_type, result.type); result.is_variable = FALSE; result.is_temporary = FALSE; - result.type = find_type("int", 0); + result.type = type_new_int(TYPE_BASIC_INT, 0); break; case EXPR_NOT: result = resolve_expression(expr_loc, cont_type, e->ref); @@ -464,14 +489,14 @@ static struct expression_type resolve_expression(const struct expr_loc *expr_loc expr_loc->attr ? expr_loc->attr : ""); result.is_variable = FALSE; result.is_temporary = TRUE; - result.type = make_type(RPC_FC_RP, result.type); + result.type = type_new_pointer(RPC_FC_UP, result.type, NULL); break; case EXPR_PPTR: result = resolve_expression(expr_loc, cont_type, e->ref); if (result.type && is_ptr(result.type)) result.type = type_pointer_get_ref(result.type); else if(result.type && is_array(result.type) - && !result.type->declarray) + && type_array_is_decl_as_ptr(result.type)) result.type = type_array_get_element(result.type); else error_loc_info(&expr_loc->v->loc_info, "dereference operator applied to non-pointer type in expression%s%s\n", @@ -485,7 +510,7 @@ static struct expression_type resolve_expression(const struct expr_loc *expr_loc case EXPR_SIZEOF: result.is_variable = FALSE; result.is_temporary = FALSE; - result.type = find_type("int", 0); + result.type = type_new_int(TYPE_BASIC_INT, 0); break; case EXPR_SHL: case EXPR_SHR: @@ -523,12 +548,12 @@ static struct expression_type resolve_expression(const struct expr_loc *expr_loc check_scalar_type(expr_loc, cont_type, result_right.type); result.is_variable = FALSE; result.is_temporary = FALSE; - result.type = find_type("int", 0); + result.type = type_new_int(TYPE_BASIC_INT, 0); break; } case EXPR_MEMBER: result = resolve_expression(expr_loc, cont_type, e->ref); - if (result.type && (is_struct(result.type->type) || is_union(result.type->type) || result.type->type == RPC_FC_ENUM16 || result.type->type == RPC_FC_ENUM32)) + if (result.type && is_valid_member_operand(result.type)) result = resolve_expression(expr_loc, result.type, e->u.ext); else error_loc_info(&expr_loc->v->loc_info, "'.' or '->' operator applied to a type that isn't a structure, union or enumeration in expression%s%s\n", diff --git a/reactos/tools/widl/hash.c b/reactos/tools/widl/hash.c index da900576713..06a4f0cb720 100644 --- a/reactos/tools/widl/hash.c +++ b/reactos/tools/widl/hash.c @@ -23,6 +23,7 @@ #include +#include "widltypes.h" #include "hash.h" static const unsigned char Lookup_16[128 * 3] = { @@ -500,7 +501,7 @@ static const unsigned char Lookup_224[128 * 3] = { * skind and lcid, while the low word is based on a repeated string * hash of skind/str. */ -unsigned long lhash_val_of_name_sys( syskind_t skind, LCID lcid, LPCSTR lpStr) +unsigned int lhash_val_of_name_sys( syskind_t skind, LCID lcid, LPCSTR lpStr) { ULONG nOffset, nMask = skind == SYS_MAC ? 1 : 0; ULONG nHiWord, nLoWord = 0x0deadbee; diff --git a/reactos/tools/widl/hash.h b/reactos/tools/widl/hash.h index bb787abab83..3c2fd2914bf 100644 --- a/reactos/tools/widl/hash.h +++ b/reactos/tools/widl/hash.h @@ -22,12 +22,6 @@ #ifndef __WIDL_HASH_H #define __WIDL_HASH_H -typedef enum tag_syskind_t { - SYS_WIN16 = 0, - SYS_WIN32, - SYS_MAC -} syskind_t; - -extern unsigned long lhash_val_of_name_sys( syskind_t skind, LCID lcid, LPCSTR lpStr); +extern unsigned int lhash_val_of_name_sys( syskind_t skind, LCID lcid, LPCSTR lpStr); #endif diff --git a/reactos/tools/widl/header.c b/reactos/tools/widl/header.c index b7a3ff3a41b..94ed1a929bf 100644 --- a/reactos/tools/widl/header.c +++ b/reactos/tools/widl/header.c @@ -149,7 +149,7 @@ static void write_field(FILE *h, var_t *v) if (!v) return; if (v->type) { indent(h, 0); - write_type_def_or_decl(h, v->type, TRUE, "%s", v->name); + write_type_def_or_decl(h, v->type, TRUE, v->name); fprintf(h, ";\n"); } } @@ -183,7 +183,7 @@ static void write_enums(FILE *h, var_list_t *enums) int needs_space_after(type_t *t) { return (type_is_alias(t) || - (!is_ptr(t) && (!is_conformant_array(t) || t->declarray || (is_array(t) && t->name)))); + (!is_ptr(t) && (!is_array(t) || !type_array_is_decl_as_ptr(t) || t->name))); } void write_type_left(FILE *h, type_t *t, int declonly) @@ -191,21 +191,13 @@ void write_type_left(FILE *h, type_t *t, int declonly) if (!h) return; if (is_attr(t->attrs, ATTR_CONST) && - (type_is_alias(t) || t->declarray || !is_ptr(t))) + (type_is_alias(t) || !is_ptr(t))) fprintf(h, "const "); if (type_is_alias(t)) fprintf(h, "%s", t->name); - else if (t->declarray) write_type_left(h, type_array_get_element(t), declonly); else { - if (t->sign > 0) fprintf(h, "signed "); - else if (t->sign < 0) fprintf(h, "unsigned "); - - if (is_array(t) && !t->name) { - write_type_left(h, type_array_get_element(t), declonly); - fprintf(h, "%s*", needs_space_after(type_array_get_element(t)) ? " " : ""); - } else switch (t->type) { - case RPC_FC_ENUM16: - case RPC_FC_ENUM32: + switch (type_get_type_detect_alias(t)) { + case TYPE_ENUM: if (!declonly && t->defined && !t->written) { if (t->name) fprintf(h, "enum %s {\n", t->name); else fprintf(h, "enum {\n"); @@ -217,19 +209,14 @@ void write_type_left(FILE *h, type_t *t, int declonly) } else fprintf(h, "enum %s", t->name ? t->name : ""); break; - case RPC_FC_STRUCT: - case RPC_FC_CVSTRUCT: - case RPC_FC_CPSTRUCT: - case RPC_FC_CSTRUCT: - case RPC_FC_PSTRUCT: - case RPC_FC_BOGUS_STRUCT: - case RPC_FC_ENCAPSULATED_UNION: + case TYPE_STRUCT: + case TYPE_ENCAPSULATED_UNION: if (!declonly && t->defined && !t->written) { if (t->name) fprintf(h, "struct %s {\n", t->name); else fprintf(h, "struct {\n"); t->written = TRUE; indentation++; - if (t->type == RPC_FC_ENCAPSULATED_UNION) + if (type_get_type(t) != TYPE_STRUCT) write_fields(h, type_encapsulated_union_get_fields(t)); else write_fields(h, type_struct_get_fields(t)); @@ -238,7 +225,7 @@ void write_type_left(FILE *h, type_t *t, int declonly) } else fprintf(h, "struct %s", t->name ? t->name : ""); break; - case RPC_FC_NON_ENCAPSULATED_UNION: + case TYPE_UNION: if (!declonly && t->defined && !t->written) { if (t->name) fprintf(h, "union %s {\n", t->name); else fprintf(h, "union {\n"); @@ -250,16 +237,68 @@ void write_type_left(FILE *h, type_t *t, int declonly) } else fprintf(h, "union %s", t->name ? t->name : ""); break; - case RPC_FC_RP: - case RPC_FC_UP: - case RPC_FC_FP: - case RPC_FC_OP: + case TYPE_POINTER: write_type_left(h, type_pointer_get_ref(t), declonly); fprintf(h, "%s*", needs_space_after(type_pointer_get_ref(t)) ? " " : ""); if (is_attr(t->attrs, ATTR_CONST)) fprintf(h, "const "); break; - default: + case TYPE_ARRAY: + if (t->name && type_array_is_decl_as_ptr(t)) + fprintf(h, "%s", t->name); + else + { + write_type_left(h, type_array_get_element(t), declonly); + if (type_array_is_decl_as_ptr(t)) + fprintf(h, "%s*", needs_space_after(type_array_get_element(t)) ? " " : ""); + } + break; + case TYPE_BASIC: + if (type_basic_get_type(t) != TYPE_BASIC_INT32 && + type_basic_get_type(t) != TYPE_BASIC_HYPER) + { + if (type_basic_get_sign(t) < 0) fprintf(h, "signed "); + else if (type_basic_get_sign(t) > 0) fprintf(h, "unsigned "); + } + switch (type_basic_get_type(t)) + { + case TYPE_BASIC_INT8: fprintf(h, "small"); break; + case TYPE_BASIC_INT16: fprintf(h, "short"); break; + case TYPE_BASIC_INT: fprintf(h, "int"); break; + case TYPE_BASIC_INT64: fprintf(h, "__int64"); break; + case TYPE_BASIC_BYTE: fprintf(h, "byte"); break; + case TYPE_BASIC_CHAR: fprintf(h, "char"); break; + case TYPE_BASIC_WCHAR: fprintf(h, "wchar_t"); break; + case TYPE_BASIC_FLOAT: fprintf(h, "float"); break; + case TYPE_BASIC_DOUBLE: fprintf(h, "double"); break; + case TYPE_BASIC_ERROR_STATUS_T: fprintf(h, "error_status_t"); break; + case TYPE_BASIC_HANDLE: fprintf(h, "handle_t"); break; + case TYPE_BASIC_INT32: + if (type_basic_get_sign(t) > 0) + fprintf(h, "ULONG"); + else + fprintf(h, "LONG"); + break; + case TYPE_BASIC_HYPER: + if (type_basic_get_sign(t) > 0) + fprintf(h, "MIDL_uhyper"); + else + fprintf(h, "hyper"); + break; + } + break; + case TYPE_INTERFACE: + case TYPE_MODULE: + case TYPE_COCLASS: fprintf(h, "%s", t->name); + break; + case TYPE_VOID: + fprintf(h, "void"); + break; + case TYPE_ALIAS: + case TYPE_FUNCTION: + /* handled elsewhere */ + assert(0); + break; } } } @@ -268,18 +307,19 @@ void write_type_right(FILE *h, type_t *t, int is_field) { if (!h) return; - if (t->declarray) { + if (type_get_type(t) == TYPE_ARRAY && !type_array_is_decl_as_ptr(t)) { if (is_conformant_array(t)) { fprintf(h, "[%s]", is_field ? "1" : ""); t = type_array_get_element(t); } - for ( ; t->declarray; t = type_array_get_element(t)) - fprintf(h, "[%lu]", type_array_get_dim(t)); + for ( ; + type_get_type(t) == TYPE_ARRAY && !type_array_is_decl_as_ptr(t); + t = type_array_get_element(t)) + fprintf(h, "[%u]", type_array_get_dim(t)); } } -void write_type_v(FILE *h, type_t *t, int is_field, int declonly, - const char *fmt, va_list args) +static void write_type_v(FILE *h, type_t *t, int is_field, int declonly, const char *name) { type_t *pt; int ptr_level = 0; @@ -289,7 +329,7 @@ void write_type_v(FILE *h, type_t *t, int is_field, int declonly, for (pt = t; is_ptr(pt); pt = type_pointer_get_ref(pt), ptr_level++) ; - if (pt->type == RPC_FC_FUNCTION) { + if (type_get_type_detect_alias(pt) == TYPE_FUNCTION) { int i; const char *callconv = get_attrp(pt->attrs, ATTR_CALLCONV); if (!callconv) callconv = ""; @@ -302,12 +342,10 @@ void write_type_v(FILE *h, type_t *t, int is_field, int declonly, fputc('*', h); } else write_type_left(h, t, declonly); - if (fmt) { - if (needs_space_after(t)) - fputc(' ', h); - vfprintf(h, fmt, args); - } - if (pt->type == RPC_FC_FUNCTION) { + + if (name) fprintf(h, "%s%s", needs_space_after(t) ? " " : "", name ); + + if (type_get_type_detect_alias(pt) == TYPE_FUNCTION) { if (ptr_level) fputc(')', h); fputc('(', h); write_args(h, type_function_get_args(pt), NULL, 0, FALSE); @@ -316,20 +354,14 @@ void write_type_v(FILE *h, type_t *t, int is_field, int declonly, write_type_right(h, t, is_field); } -void write_type_def_or_decl(FILE *f, type_t *t, int field, const char *fmt, ...) +void write_type_def_or_decl(FILE *f, type_t *t, int field, const char *name) { - va_list args; - va_start(args, fmt); - write_type_v(f, t, field, FALSE, fmt, args); - va_end(args); + write_type_v(f, t, field, FALSE, name); } -void write_type_decl(FILE *f, type_t *t, const char *fmt, ...) +void write_type_decl(FILE *f, type_t *t, const char *name) { - va_list args; - va_start(args, fmt); - write_type_v(f, t, FALSE, TRUE, fmt, args); - va_end(args); + write_type_v(f, t, FALSE, TRUE, name); } void write_type_decl_left(FILE *f, type_t *t) @@ -389,7 +421,9 @@ void check_for_additional_prototype_types(const var_list_t *list) /* don't carry on parsing fields within this type */ break; } - if (type->type != RPC_FC_BIND_PRIMITIVE && is_attr(type->attrs, ATTR_HANDLE)) { + if ((type_get_type(type) != TYPE_BASIC || + type_basic_get_type(type) != TYPE_BASIC_HANDLE) && + is_attr(type->attrs, ATTR_HANDLE)) { if (!generic_handle_registered(name)) { generic_handle_t *gh = xmalloc(sizeof(*gh)); @@ -412,13 +446,22 @@ void check_for_additional_prototype_types(const var_list_t *list) } else if (type_is_complete(type)) { - var_list_t *vars = NULL; - if (type->type == RPC_FC_ENUM16 || type->type == RPC_FC_ENUM32) + var_list_t *vars; + switch (type_get_type_detect_alias(type)) + { + case TYPE_ENUM: vars = type_enum_get_values(type); - else if (is_struct(type->type)) + break; + case TYPE_STRUCT: vars = type_struct_get_fields(type); - else if (is_union(type->type)) + break; + case TYPE_UNION: vars = type_union_get_cases(type); + break; + default: + vars = NULL; + break; + } check_for_additional_prototype_types(vars); } @@ -471,7 +514,7 @@ static void write_generic_handle_routines(FILE *header) static void write_typedef(FILE *header, type_t *type) { fprintf(header, "typedef "); - write_type_def_or_decl(header, type_alias_get_aliasee(type), FALSE, "%s", type->name); + write_type_def_or_decl(header, type_alias_get_aliasee(type), FALSE, type->name); fprintf(header, ";\n"); } @@ -515,7 +558,7 @@ static void write_declaration(FILE *header, const var_t *v) fprintf(header, "extern "); break; } - write_type_def_or_decl(header, v->type, FALSE, "%s", v->name); + write_type_def_or_decl(header, v->type, FALSE, v->name); fprintf(header, ";\n\n"); } } @@ -537,26 +580,24 @@ const var_t* get_explicit_handle_var(const var_t *func) return NULL; LIST_FOR_EACH_ENTRY( var, type_get_function_args(func->type), const var_t, entry ) - if (var->type->type == RPC_FC_BIND_PRIMITIVE) + { + const type_t *type = var->type; + if (type_get_type(type) == TYPE_BASIC && type_basic_get_type(type) == TYPE_BASIC_HANDLE) return var; + } return NULL; } const type_t* get_explicit_generic_handle_type(const var_t* var) { - const type_t *t = var->type; - - if (t->type == RPC_FC_BIND_PRIMITIVE) - return NULL; - - if (!is_ptr(t) && is_attr(t->attrs, ATTR_HANDLE)) - return t; - else - for (; is_ptr(t); t = t->ref) - if (t->type != RPC_FC_BIND_PRIMITIVE && is_attr(t->attrs, ATTR_HANDLE)) - return t; - + const type_t *t; + for (t = var->type; + is_ptr(t) || type_is_alias(t); + t = type_is_alias(t) ? type_alias_get_aliasee(t) : type_pointer_get_ref(t)) + if ((type_get_type_detect_alias(t) != TYPE_BASIC || type_basic_get_type(t) != TYPE_BASIC_HANDLE) && + is_attr(t->attrs, ATTR_HANDLE)) + return t; return NULL; } @@ -685,7 +726,7 @@ void write_args(FILE *h, const var_list_t *args, const char *name, int method, i } else fprintf(h, ","); } - write_type_decl(h, arg->type, "%s", arg->name); + write_type_decl(h, arg->type, arg->name); count++; } if (do_indent) indentation--; @@ -808,7 +849,7 @@ static void write_locals(FILE *fp, const type_t *iface, int body) fprintf(fp, " %s\n", comment); if (rt->name && strcmp(rt->name, "HRESULT") == 0) fprintf(fp, " return E_NOTIMPL;\n"); - else if (rt->type) { + else if (type_get_type(rt) != TYPE_VOID) { fprintf(fp, " "); write_type_decl(fp, rt, "rv"); fprintf(fp, ";\n"); @@ -841,7 +882,7 @@ static void write_local_stubs_stmts(FILE *local_stubs, const statement_list_t *s const statement_t *stmt; if (stmts) LIST_FOR_EACH_ENTRY( stmt, stmts, const statement_t, entry ) { - if (stmt->type == STMT_TYPE && stmt->u.type->type == RPC_FC_IP) + if (stmt->type == STMT_TYPE && type_get_type(stmt->u.type) == TYPE_INTERFACE) write_locals(local_stubs, stmt->u.type, TRUE); else if (stmt->type == STMT_LIBRARY) write_local_stubs_stmts(local_stubs, stmt->u.lib->stmts); @@ -998,7 +1039,7 @@ static void write_rpc_interface_start(FILE *header, const type_t *iface) if (!allocate_written) { allocate_written = 1; - fprintf(header, "void * __RPC_USER MIDL_user_allocate(size_t);\n"); + fprintf(header, "void * __RPC_USER MIDL_user_allocate(SIZE_T);\n"); fprintf(header, "void __RPC_USER MIDL_user_free(void *);\n\n"); } @@ -1064,7 +1105,7 @@ static void write_imports(FILE *header, const statement_list_t *stmts) switch (stmt->type) { case STMT_TYPE: - if (stmt->u.type->type == RPC_FC_IP) + if (type_get_type(stmt->u.type) == TYPE_INTERFACE) write_imports(header, type_iface_get_stmts(stmt->u.type)); break; case STMT_TYPEREF: @@ -1095,12 +1136,12 @@ static void write_forward_decls(FILE *header, const statement_list_t *stmts) switch (stmt->type) { case STMT_TYPE: - if (stmt->u.type->type == RPC_FC_IP) + if (type_get_type(stmt->u.type) == TYPE_INTERFACE) { if (is_object(stmt->u.type->attrs) || is_attr(stmt->u.type->attrs, ATTR_DISPINTERFACE)) write_forward(header, stmt->u.type); } - else if (stmt->u.type->type == RPC_FC_COCLASS) + else if (type_get_type(stmt->u.type) == TYPE_COCLASS) write_coclass_forward(header, stmt->u.type); break; case STMT_TYPEREF: @@ -1129,7 +1170,7 @@ static void write_header_stmts(FILE *header, const statement_list_t *stmts, cons switch (stmt->type) { case STMT_TYPE: - if (stmt->u.type->type == RPC_FC_IP) + if (type_get_type(stmt->u.type) == TYPE_INTERFACE) { type_t *iface = stmt->u.type; if (is_attr(stmt->u.type->attrs, ATTR_DISPINTERFACE) || is_object(stmt->u.type->attrs)) @@ -1145,7 +1186,7 @@ static void write_header_stmts(FILE *header, const statement_list_t *stmts, cons write_rpc_interface_end(header, iface); } } - else if (stmt->u.type->type == RPC_FC_COCLASS) + else if (type_get_type(stmt->u.type) == TYPE_COCLASS) write_coclass(header, stmt->u.type); else { @@ -1156,7 +1197,7 @@ static void write_header_stmts(FILE *header, const statement_list_t *stmts, cons case STMT_TYPEREF: /* FIXME: shouldn't write out forward declarations for undefined * interfaces but a number of our IDL files depend on this */ - if (stmt->u.type->type == RPC_FC_IP && !stmt->u.type->written) + if (type_get_type(stmt->u.type) == TYPE_INTERFACE && !stmt->u.type->written) write_forward(header, stmt->u.type); break; case STMT_IMPORTLIB: @@ -1181,7 +1222,7 @@ static void write_header_stmts(FILE *header, const statement_list_t *stmts, cons fprintf(header, "%s\n", stmt->u.str); break; case STMT_DECLARATION: - if (iface && stmt->u.var->type->type == RPC_FC_FUNCTION) + if (iface && type_get_type(stmt->u.var->type) == TYPE_FUNCTION) { if (!ignore_funcs) { diff --git a/reactos/tools/widl/header.h b/reactos/tools/widl/header.h index 6ac7cb0ae65..d4b3b88f32e 100644 --- a/reactos/tools/widl/header.h +++ b/reactos/tools/widl/header.h @@ -34,8 +34,8 @@ extern int is_declptr(const type_t *t); extern const char* get_name(const var_t *v); extern void write_type_left(FILE *h, type_t *t, int declonly); extern void write_type_right(FILE *h, type_t *t, int is_field); -extern void write_type_def_or_decl(FILE *h, type_t *t, int is_field, const char *fmt, ...); -extern void write_type_decl(FILE *f, type_t *t, const char *fmt, ...); +extern void write_type_def_or_decl(FILE *h, type_t *t, int is_field, const char *name); +extern void write_type_decl(FILE *f, type_t *t, const char *name); extern void write_type_decl_left(FILE *f, type_t *t); extern int needs_space_after(type_t *t); extern int is_object(const attr_list_t *list); @@ -75,7 +75,9 @@ static inline int is_string_type(const attr_list_t *attrs, const type_t *type) static inline int is_context_handle(const type_t *type) { const type_t *t; - for (t = type; is_ptr(t); t = type_pointer_get_ref(t)) + for (t = type; + is_ptr(t) || type_is_alias(t); + t = type_is_alias(t) ? type_alias_get_aliasee(t) : type_pointer_get_ref(t)) if (is_attr(t->attrs, ATTR_CONTEXTHANDLE)) return 1; return 0; diff --git a/reactos/tools/widl/parser.l b/reactos/tools/widl/parser.l index dba27ea7387..55a73c75be1 100644 --- a/reactos/tools/widl/parser.l +++ b/reactos/tools/widl/parser.l @@ -341,7 +341,6 @@ static const struct keyword attr_keywords[] = {"requestedit", tREQUESTEDIT}, {"restricted", tRESTRICTED}, {"retval", tRETVAL}, - {"single", tSINGLE}, {"size_is", tSIZEIS}, {"source", tSOURCE}, {"strict_context_handle", tSTRICTCONTEXTHANDLE}, diff --git a/reactos/tools/widl/parser.tab.c b/reactos/tools/widl/parser.tab.c index 931ecb9ef91..3117fa1c89f 100644 --- a/reactos/tools/widl/parser.tab.c +++ b/reactos/tools/widl/parser.tab.c @@ -1,30 +1,39 @@ -/* A Bison parser, made by GNU Bison 2.1. */ -/* Skeleton parser for Yacc-like parsing with Bison, - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. +/* A Bison parser, made by GNU Bison 2.4.1. */ - This program is free software; you can redistribute it and/or modify +/* Skeleton implementation for Bison's Yacc-like parsers in C + + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 + Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. - + the Free Software Foundation, either version 3 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 General Public License for more details. - + You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. */ + along with this program. If not, see . */ -/* As a special exception, when this file is copied by Bison into a - Bison output file, you may use that output file without restriction. - This special exception was added by the Free Software Foundation - in version 1.24 of Bison. */ +/* As a special exception, you may create a larger work that contains + part or all of the Bison parser skeleton and distribute that work + under terms of your choice, so long as that work isn't itself a + parser generator using the skeleton or a modified version thereof + as a parser skeleton. Alternatively, if you modify or redistribute + the parser skeleton itself, you may (at your option) remove this + special exception, which will cause the skeleton and the resulting + Bison output files to be licensed under the GNU General Public + License without this special exception. + + This special exception was added by the Free Software Foundation in + version 2.2 of Bison. */ -/* Written by Richard Stallman by simplifying the original so called - ``semantic'' parser. */ +/* C LALR(1) parser skeleton written by Richard Stallman, by + simplifying the original so-called "semantic" parser. */ /* All symbols defined below should begin with yy or YY, to avoid infringing on user name space. This should be done even for local @@ -37,7 +46,7 @@ #define YYBISON 1 /* Bison version. */ -#define YYBISON_VERSION "2.1" +#define YYBISON_VERSION "2.4.1" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -45,17 +54,205 @@ /* Pure parsers. */ #define YYPURE 0 +/* Push parsers. */ +#define YYPUSH 0 + +/* Pull parsers. */ +#define YYPULL 1 + /* Using locations. */ #define YYLSP_NEEDED 0 /* Substitute the variable and function names. */ -#define yyparse parser_parse -#define yylex parser_lex -#define yyerror parser_error -#define yylval parser_lval -#define yychar parser_char -#define yydebug parser_debug -#define yynerrs parser_nerrs +#define yyparse parser_parse +#define yylex parser_lex +#define yyerror parser_error +#define yylval parser_lval +#define yychar parser_char +#define yydebug parser_debug +#define yynerrs parser_nerrs + + +/* Copy the first part of user declarations. */ + +/* Line 189 of yacc.c */ +#line 1 "parser.y" + +/* + * IDL Compiler + * + * Copyright 2002 Ove Kaaven + * Copyright 2006-2008 Robert Shearman + * + * This library 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 library 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 library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include "config.h" + +#include +#include +#include +#include +#include +#include + +#include "widl.h" +#include "utils.h" +#include "parser.h" +#include "header.h" +#include "typelib.h" +#include "typegen.h" +#include "expr.h" +#include "typetree.h" + +#if defined(YYBYACC) + /* Berkeley yacc (byacc) doesn't seem to know about these */ + /* Some *BSD supplied versions do define these though */ +# ifndef YYEMPTY +# define YYEMPTY (-1) /* Empty lookahead value of yychar */ +# endif +# ifndef YYLEX +# define YYLEX yylex() +# endif + +#elif defined(YYBISON) + /* Bison was used for original development */ + /* #define YYEMPTY -2 */ + /* #define YYLEX yylex() */ + +#else + /* No yacc we know yet */ +# if !defined(YYEMPTY) || !defined(YYLEX) +# error Yacc version/type unknown. This version needs to be verified for settings of YYEMPTY and YYLEX. +# elif defined(__GNUC__) /* gcc defines the #warning directive */ +# warning Yacc version/type unknown. It defines YYEMPTY and YYLEX, but is not tested + /* #else we just take a chance that it works... */ +# endif +#endif + +#define YYERROR_VERBOSE + +static unsigned char pointer_default = RPC_FC_UP; +static int is_object_interface = FALSE; + +typedef struct list typelist_t; +struct typenode { + type_t *type; + struct list entry; +}; + +struct _import_t +{ + char *name; + int import_performed; +}; + +typedef struct _decl_spec_t +{ + type_t *type; + attr_list_t *attrs; + enum storage_class stgclass; +} decl_spec_t; + +typelist_t incomplete_types = LIST_INIT(incomplete_types); + +static void fix_incomplete(void); +static void fix_incomplete_types(type_t *complete_type); + +static str_list_t *append_str(str_list_t *list, char *str); +static attr_list_t *append_attr(attr_list_t *list, attr_t *attr); +static attr_list_t *append_attr_list(attr_list_t *new_list, attr_list_t *old_list); +static decl_spec_t *make_decl_spec(type_t *type, decl_spec_t *left, decl_spec_t *right, attr_t *attr, enum storage_class stgclass); +static attr_t *make_attr(enum attr_type type); +static attr_t *make_attrv(enum attr_type type, unsigned long val); +static attr_t *make_attrp(enum attr_type type, void *val); +static expr_list_t *append_expr(expr_list_t *list, expr_t *expr); +static array_dims_t *append_array(array_dims_t *list, expr_t *expr); +static void set_type(var_t *v, decl_spec_t *decl_spec, const declarator_t *decl, int top); +static var_list_t *set_var_types(attr_list_t *attrs, decl_spec_t *decl_spec, declarator_list_t *decls); +static ifref_list_t *append_ifref(ifref_list_t *list, ifref_t *iface); +static ifref_t *make_ifref(type_t *iface); +static var_list_t *append_var_list(var_list_t *list, var_list_t *vars); +static declarator_list_t *append_declarator(declarator_list_t *list, declarator_t *p); +static declarator_t *make_declarator(var_t *var); +static func_list_t *append_func(func_list_t *list, func_t *func); +static func_t *make_func(var_t *def); +static type_t *make_safearray(type_t *type); +static typelib_t *make_library(const char *name, const attr_list_t *attrs); +static type_t *append_ptrchain_type(type_t *ptrchain, type_t *type); + +static type_t *reg_typedefs(decl_spec_t *decl_spec, var_list_t *names, attr_list_t *attrs); +static type_t *find_type_or_error(const char *name, int t); +static type_t *find_type_or_error2(char *name, int t); + +static var_t *reg_const(var_t *var); + +static char *gen_name(void); +static void check_arg(var_t *arg); +static void check_statements(const statement_list_t *stmts, int is_inside_library); +static void check_all_user_types(const statement_list_t *stmts); +static attr_list_t *check_iface_attrs(const char *name, attr_list_t *attrs); +static attr_list_t *check_function_attrs(const char *name, attr_list_t *attrs); +static attr_list_t *check_typedef_attrs(attr_list_t *attrs); +static attr_list_t *check_enum_attrs(attr_list_t *attrs); +static attr_list_t *check_struct_attrs(attr_list_t *attrs); +static attr_list_t *check_union_attrs(attr_list_t *attrs); +static attr_list_t *check_field_attrs(const char *name, attr_list_t *attrs); +static attr_list_t *check_library_attrs(const char *name, attr_list_t *attrs); +static attr_list_t *check_dispiface_attrs(const char *name, attr_list_t *attrs); +static attr_list_t *check_module_attrs(const char *name, attr_list_t *attrs); +static attr_list_t *check_coclass_attrs(const char *name, attr_list_t *attrs); +const char *get_attr_display_name(enum attr_type type); +static void add_explicit_handle_if_necessary(var_t *func); +static void check_def(const type_t *t); + +static statement_t *make_statement(enum statement_type type); +static statement_t *make_statement_type_decl(type_t *type); +static statement_t *make_statement_reference(type_t *type); +static statement_t *make_statement_declaration(var_t *var); +static statement_t *make_statement_library(typelib_t *typelib); +static statement_t *make_statement_cppquote(const char *str); +static statement_t *make_statement_importlib(const char *str); +static statement_t *make_statement_module(type_t *type); +static statement_t *make_statement_typedef(var_list_t *names); +static statement_t *make_statement_import(const char *str); +static statement_t *make_statement_typedef(var_list_t *names); +static statement_list_t *append_statement(statement_list_t *list, statement_t *stmt); + + + +/* Line 189 of yacc.c */ +#line 238 "parser.tab.c" + +/* Enabling traces. */ +#ifndef YYDEBUG +# define YYDEBUG 0 +#endif + +/* Enabling verbose error messages. */ +#ifdef YYERROR_VERBOSE +# undef YYERROR_VERBOSE +# define YYERROR_VERBOSE 1 +#else +# define YYERROR_VERBOSE 0 +#endif + +/* Enabling the token table. */ +#ifndef YYTOKEN_TABLE +# define YYTOKEN_TABLE 0 +#endif /* Tokens. */ @@ -182,392 +379,48 @@ tSAFEARRAY = 373, tSHORT = 374, tSIGNED = 375, - tSINGLE = 376, - tSIZEIS = 377, - tSIZEOF = 378, - tSMALL = 379, - tSOURCE = 380, - tSTATIC = 381, - tSTDCALL = 382, - tSTRICTCONTEXTHANDLE = 383, - tSTRING = 384, - tSTRUCT = 385, - tSWITCH = 386, - tSWITCHIS = 387, - tSWITCHTYPE = 388, - tTRANSMITAS = 389, - tTRUE = 390, - tTYPEDEF = 391, - tUNION = 392, - tUNIQUE = 393, - tUNSIGNED = 394, - tUUID = 395, - tV1ENUM = 396, - tVARARG = 397, - tVERSION = 398, - tVOID = 399, - tWCHAR = 400, - tWIREMARSHAL = 401, - ADDRESSOF = 402, - NEG = 403, - POS = 404, - PPTR = 405, - CAST = 406 + tSIZEIS = 376, + tSIZEOF = 377, + tSMALL = 378, + tSOURCE = 379, + tSTATIC = 380, + tSTDCALL = 381, + tSTRICTCONTEXTHANDLE = 382, + tSTRING = 383, + tSTRUCT = 384, + tSWITCH = 385, + tSWITCHIS = 386, + tSWITCHTYPE = 387, + tTRANSMITAS = 388, + tTRUE = 389, + tTYPEDEF = 390, + tUNION = 391, + tUNIQUE = 392, + tUNSIGNED = 393, + tUUID = 394, + tV1ENUM = 395, + tVARARG = 396, + tVERSION = 397, + tVOID = 398, + tWCHAR = 399, + tWIREMARSHAL = 400, + ADDRESSOF = 401, + NEG = 402, + POS = 403, + PPTR = 404, + CAST = 405 }; #endif -/* Tokens. */ -#define aIDENTIFIER 258 -#define aKNOWNTYPE 259 -#define aNUM 260 -#define aHEXNUM 261 -#define aDOUBLE 262 -#define aSTRING 263 -#define aWSTRING 264 -#define aUUID 265 -#define aEOF 266 -#define SHL 267 -#define SHR 268 -#define MEMBERPTR 269 -#define EQUALITY 270 -#define INEQUALITY 271 -#define GREATEREQUAL 272 -#define LESSEQUAL 273 -#define LOGICALOR 274 -#define LOGICALAND 275 -#define tAGGREGATABLE 276 -#define tALLOCATE 277 -#define tAPPOBJECT 278 -#define tASYNC 279 -#define tASYNCUUID 280 -#define tAUTOHANDLE 281 -#define tBINDABLE 282 -#define tBOOLEAN 283 -#define tBROADCAST 284 -#define tBYTE 285 -#define tBYTECOUNT 286 -#define tCALLAS 287 -#define tCALLBACK 288 -#define tCASE 289 -#define tCDECL 290 -#define tCHAR 291 -#define tCOCLASS 292 -#define tCODE 293 -#define tCOMMSTATUS 294 -#define tCONST 295 -#define tCONTEXTHANDLE 296 -#define tCONTEXTHANDLENOSERIALIZE 297 -#define tCONTEXTHANDLESERIALIZE 298 -#define tCONTROL 299 -#define tCPPQUOTE 300 -#define tDEFAULT 301 -#define tDEFAULTCOLLELEM 302 -#define tDEFAULTVALUE 303 -#define tDEFAULTVTABLE 304 -#define tDISPLAYBIND 305 -#define tDISPINTERFACE 306 -#define tDLLNAME 307 -#define tDOUBLE 308 -#define tDUAL 309 -#define tENDPOINT 310 -#define tENTRY 311 -#define tENUM 312 -#define tERRORSTATUST 313 -#define tEXPLICITHANDLE 314 -#define tEXTERN 315 -#define tFALSE 316 -#define tFASTCALL 317 -#define tFLOAT 318 -#define tHANDLE 319 -#define tHANDLET 320 -#define tHELPCONTEXT 321 -#define tHELPFILE 322 -#define tHELPSTRING 323 -#define tHELPSTRINGCONTEXT 324 -#define tHELPSTRINGDLL 325 -#define tHIDDEN 326 -#define tHYPER 327 -#define tID 328 -#define tIDEMPOTENT 329 -#define tIIDIS 330 -#define tIMMEDIATEBIND 331 -#define tIMPLICITHANDLE 332 -#define tIMPORT 333 -#define tIMPORTLIB 334 -#define tIN 335 -#define tIN_LINE 336 -#define tINLINE 337 -#define tINPUTSYNC 338 -#define tINT 339 -#define tINT64 340 -#define tINTERFACE 341 -#define tLCID 342 -#define tLENGTHIS 343 -#define tLIBRARY 344 -#define tLOCAL 345 -#define tLONG 346 -#define tMETHODS 347 -#define tMODULE 348 -#define tNONBROWSABLE 349 -#define tNONCREATABLE 350 -#define tNONEXTENSIBLE 351 -#define tNULL 352 -#define tOBJECT 353 -#define tODL 354 -#define tOLEAUTOMATION 355 -#define tOPTIONAL 356 -#define tOUT 357 -#define tPASCAL 358 -#define tPOINTERDEFAULT 359 -#define tPROPERTIES 360 -#define tPROPGET 361 -#define tPROPPUT 362 -#define tPROPPUTREF 363 -#define tPTR 364 -#define tPUBLIC 365 -#define tRANGE 366 -#define tREADONLY 367 -#define tREF 368 -#define tREGISTER 369 -#define tREQUESTEDIT 370 -#define tRESTRICTED 371 -#define tRETVAL 372 -#define tSAFEARRAY 373 -#define tSHORT 374 -#define tSIGNED 375 -#define tSINGLE 376 -#define tSIZEIS 377 -#define tSIZEOF 378 -#define tSMALL 379 -#define tSOURCE 380 -#define tSTATIC 381 -#define tSTDCALL 382 -#define tSTRICTCONTEXTHANDLE 383 -#define tSTRING 384 -#define tSTRUCT 385 -#define tSWITCH 386 -#define tSWITCHIS 387 -#define tSWITCHTYPE 388 -#define tTRANSMITAS 389 -#define tTRUE 390 -#define tTYPEDEF 391 -#define tUNION 392 -#define tUNIQUE 393 -#define tUNSIGNED 394 -#define tUUID 395 -#define tV1ENUM 396 -#define tVARARG 397 -#define tVERSION 398 -#define tVOID 399 -#define tWCHAR 400 -#define tWIREMARSHAL 401 -#define ADDRESSOF 402 -#define NEG 403 -#define POS 404 -#define PPTR 405 -#define CAST 406 - -/* Copy the first part of user declarations. */ -#line 1 "parser.y" - -/* - * IDL Compiler - * - * Copyright 2002 Ove Kaaven - * Copyright 2006-2008 Robert Shearman - * - * This library 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 library 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 library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA - */ - -#include "config.h" - -#include -#include -#include -#include -#include -#include -#ifdef HAVE_ALLOCA_H -#include -#endif - -#include "widl.h" -#include "utils.h" -#include "parser.h" -#include "header.h" -#include "typelib.h" -#include "typegen.h" -#include "expr.h" -#include "typetree.h" - -#if defined(YYBYACC) - /* Berkeley yacc (byacc) doesn't seem to know about these */ - /* Some *BSD supplied versions do define these though */ -# ifndef YYEMPTY -# define YYEMPTY (-1) /* Empty lookahead value of yychar */ -# endif -# ifndef YYLEX -# define YYLEX yylex() -# endif - -#elif defined(YYBISON) - /* Bison was used for original development */ - /* #define YYEMPTY -2 */ - /* #define YYLEX yylex() */ - -#else - /* No yacc we know yet */ -# if !defined(YYEMPTY) || !defined(YYLEX) -# error Yacc version/type unknown. This version needs to be verified for settings of YYEMPTY and YYLEX. -# elif defined(__GNUC__) /* gcc defines the #warning directive */ -# warning Yacc version/type unknown. It defines YYEMPTY and YYLEX, but is not tested - /* #else we just take a chance that it works... */ -# endif -#endif - -#define YYERROR_VERBOSE - -unsigned char pointer_default = RPC_FC_UP; -static int is_object_interface = FALSE; - -typedef struct list typelist_t; -struct typenode { - type_t *type; - struct list entry; -}; - -struct _import_t +#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED +typedef union YYSTYPE { - char *name; - int import_performed; -}; -typedef struct _decl_spec_t -{ - type_t *type; - attr_list_t *attrs; - enum storage_class stgclass; -} decl_spec_t; +/* Line 214 of yacc.c */ +#line 156 "parser.y" -typelist_t incomplete_types = LIST_INIT(incomplete_types); - -static void add_incomplete(type_t *t); -static void fix_incomplete(void); -static void fix_incomplete_types(type_t *complete_type); - -static str_list_t *append_str(str_list_t *list, char *str); -static attr_list_t *append_attr(attr_list_t *list, attr_t *attr); -static attr_list_t *append_attr_list(attr_list_t *new_list, attr_list_t *old_list); -static decl_spec_t *make_decl_spec(type_t *type, decl_spec_t *left, decl_spec_t *right, attr_t *attr, enum storage_class stgclass); -static attr_t *make_attr(enum attr_type type); -static attr_t *make_attrv(enum attr_type type, unsigned long val); -static attr_t *make_attrp(enum attr_type type, void *val); -static expr_list_t *append_expr(expr_list_t *list, expr_t *expr); -static array_dims_t *append_array(array_dims_t *list, expr_t *expr); -static void set_type(var_t *v, decl_spec_t *decl_spec, const declarator_t *decl, int top); -static var_list_t *set_var_types(attr_list_t *attrs, decl_spec_t *decl_spec, declarator_list_t *decls); -static ifref_list_t *append_ifref(ifref_list_t *list, ifref_t *iface); -static ifref_t *make_ifref(type_t *iface); -static var_list_t *append_var(var_list_t *list, var_t *var); -static var_list_t *append_var_list(var_list_t *list, var_list_t *vars); -static var_t *make_var(char *name); -static declarator_list_t *append_declarator(declarator_list_t *list, declarator_t *p); -static declarator_t *make_declarator(var_t *var); -static func_list_t *append_func(func_list_t *list, func_t *func); -static func_t *make_func(var_t *def); -static type_t *make_class(char *name); -static type_t *make_safearray(type_t *type); -static type_t *make_builtin(char *name); -static type_t *make_int(int sign); -static typelib_t *make_library(const char *name, const attr_list_t *attrs); -static type_t *append_ptrchain_type(type_t *ptrchain, type_t *type); - -static type_t *type_new_enum(char *name, var_list_t *enums); -static type_t *type_new_struct(char *name, int defined, var_list_t *fields); -static type_t *type_new_nonencapsulated_union(char *name, var_list_t *fields); -static type_t *type_new_encapsulated_union(char *name, var_t *switch_field, var_t *union_field, var_list_t *cases); - -static type_t *reg_type(type_t *type, const char *name, int t); -static type_t *reg_typedefs(decl_spec_t *decl_spec, var_list_t *names, attr_list_t *attrs); -static type_t *find_type_or_error(const char *name, int t); -static type_t *find_type_or_error2(char *name, int t); -static type_t *get_type(unsigned char type, char *name, int t); - -static var_t *reg_const(var_t *var); - -static char *gen_name(void); -static void check_arg(var_t *arg); -static void check_statements(const statement_list_t *stmts, int is_inside_library); -static void check_all_user_types(const statement_list_t *stmts); -static attr_list_t *check_iface_attrs(const char *name, attr_list_t *attrs); -static attr_list_t *check_function_attrs(const char *name, attr_list_t *attrs); -static attr_list_t *check_typedef_attrs(attr_list_t *attrs); -static attr_list_t *check_enum_attrs(attr_list_t *attrs); -static attr_list_t *check_struct_attrs(attr_list_t *attrs); -static attr_list_t *check_union_attrs(attr_list_t *attrs); -static attr_list_t *check_field_attrs(const char *name, attr_list_t *attrs); -static attr_list_t *check_library_attrs(const char *name, attr_list_t *attrs); -static attr_list_t *check_dispiface_attrs(const char *name, attr_list_t *attrs); -static attr_list_t *check_module_attrs(const char *name, attr_list_t *attrs); -static attr_list_t *check_coclass_attrs(const char *name, attr_list_t *attrs); -const char *get_attr_display_name(enum attr_type type); -static void add_explicit_handle_if_necessary(var_t *func); -static void check_def(const type_t *t); - -static statement_t *make_statement(enum statement_type type); -static statement_t *make_statement_type_decl(type_t *type); -static statement_t *make_statement_reference(type_t *type); -static statement_t *make_statement_declaration(var_t *var); -static statement_t *make_statement_library(typelib_t *typelib); -static statement_t *make_statement_cppquote(const char *str); -static statement_t *make_statement_importlib(const char *str); -static statement_t *make_statement_module(type_t *type); -static statement_t *make_statement_typedef(var_list_t *names); -static statement_t *make_statement_import(const char *str); -static statement_t *make_statement_typedef(var_list_t *names); -static statement_list_t *append_statement(statement_list_t *list, statement_t *stmt); - -#define tsENUM 1 -#define tsSTRUCT 2 -#define tsUNION 3 - - - -/* Enabling traces. */ -#ifndef YYDEBUG -# define YYDEBUG 0 -#endif - -/* Enabling verbose error messages. */ -#ifdef YYERROR_VERBOSE -# undef YYERROR_VERBOSE -# define YYERROR_VERBOSE 1 -#else -# define YYERROR_VERBOSE 0 -#endif - -/* Enabling the token table. */ -#ifndef YYTOKEN_TABLE -# define YYTOKEN_TABLE 0 -#endif - -#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) -#line 176 "parser.y" -typedef union YYSTYPE { attr_t *attr; attr_list_t *attr_list; str_list_t *str_list; @@ -594,36 +447,71 @@ typedef union YYSTYPE { struct _import_t *import; struct _decl_spec_t *declspec; enum storage_class stgclass; + + + +/* Line 214 of yacc.c */ +#line 455 "parser.tab.c" } YYSTYPE; -/* Line 196 of yacc.c. */ -#line 600 "parser.tab.c" +# define YYSTYPE_IS_TRIVIAL 1 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 -# define YYSTYPE_IS_TRIVIAL 1 #endif - /* Copy the second part of user declarations. */ -/* Line 219 of yacc.c. */ -#line 612 "parser.tab.c" +/* Line 264 of yacc.c */ +#line 467 "parser.tab.c" -#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__) -# define YYSIZE_T __SIZE_TYPE__ +#ifdef short +# undef short #endif -#if ! defined (YYSIZE_T) && defined (size_t) -# define YYSIZE_T size_t + +#ifdef YYTYPE_UINT8 +typedef YYTYPE_UINT8 yytype_uint8; +#else +typedef unsigned char yytype_uint8; #endif -#if ! defined (YYSIZE_T) && (defined (__STDC__) || defined (__cplusplus)) -# include /* INFRINGES ON USER NAME SPACE */ -# define YYSIZE_T size_t + +#ifdef YYTYPE_INT8 +typedef YYTYPE_INT8 yytype_int8; +#elif (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +typedef signed char yytype_int8; +#else +typedef short int yytype_int8; #endif -#if ! defined (YYSIZE_T) -# define YYSIZE_T unsigned int + +#ifdef YYTYPE_UINT16 +typedef YYTYPE_UINT16 yytype_uint16; +#else +typedef unsigned short int yytype_uint16; #endif +#ifdef YYTYPE_INT16 +typedef YYTYPE_INT16 yytype_int16; +#else +typedef short int yytype_int16; +#endif + +#ifndef YYSIZE_T +# ifdef __SIZE_TYPE__ +# define YYSIZE_T __SIZE_TYPE__ +# elif defined size_t +# define YYSIZE_T size_t +# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +# include /* INFRINGES ON USER NAME SPACE */ +# define YYSIZE_T size_t +# else +# define YYSIZE_T unsigned int +# endif +#endif + +#define YYSIZE_MAXIMUM ((YYSIZE_T) -1) + #ifndef YY_ # if YYENABLE_NLS # if ENABLE_NLS @@ -636,7 +524,32 @@ typedef union YYSTYPE { # endif #endif -#if ! defined (yyoverflow) || YYERROR_VERBOSE +/* Suppress unused-variable warnings by "using" E. */ +#if ! defined lint || defined __GNUC__ +# define YYUSE(e) ((void) (e)) +#else +# define YYUSE(e) /* empty */ +#endif + +/* Identity function, used to suppress warnings about constant conditions. */ +#ifndef lint +# define YYID(n) (n) +#else +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static int +YYID (int yyi) +#else +static int +YYID (yyi) + int yyi; +#endif +{ + return yyi; +} +#endif + +#if ! defined yyoverflow || YYERROR_VERBOSE /* The parser invokes alloca or malloc; define the necessary symbols. */ @@ -644,66 +557,78 @@ typedef union YYSTYPE { # if YYSTACK_USE_ALLOCA # ifdef __GNUC__ # define YYSTACK_ALLOC __builtin_alloca +# elif defined __BUILTIN_VA_ARG_INCR +# include /* INFRINGES ON USER NAME SPACE */ +# elif defined _AIX +# define YYSTACK_ALLOC __alloca +# elif defined _MSC_VER +# include /* INFRINGES ON USER NAME SPACE */ +# define alloca _alloca # else # define YYSTACK_ALLOC alloca -# if defined (__STDC__) || defined (__cplusplus) +# if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) # include /* INFRINGES ON USER NAME SPACE */ -# define YYINCLUDED_STDLIB_H +# ifndef _STDLIB_H +# define _STDLIB_H 1 +# endif # endif # endif # endif # endif # ifdef YYSTACK_ALLOC - /* Pacify GCC's `empty if-body' warning. */ -# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) + /* Pacify GCC's `empty if-body' warning. */ +# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0)) # ifndef YYSTACK_ALLOC_MAXIMUM /* The OS might guarantee only one guard page at the bottom of the stack, and a page size can be as small as 4096 bytes. So we cannot safely invoke alloca (N) if N exceeds 4096. Use a slightly smaller number to allow for a few compiler-allocated temporary stack slots. */ -# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2005 */ +# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ # endif # else # define YYSTACK_ALLOC YYMALLOC # define YYSTACK_FREE YYFREE # ifndef YYSTACK_ALLOC_MAXIMUM -# define YYSTACK_ALLOC_MAXIMUM ((YYSIZE_T) -1) +# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM # endif -# ifdef __cplusplus -extern "C" { +# if (defined __cplusplus && ! defined _STDLIB_H \ + && ! ((defined YYMALLOC || defined malloc) \ + && (defined YYFREE || defined free))) +# include /* INFRINGES ON USER NAME SPACE */ +# ifndef _STDLIB_H +# define _STDLIB_H 1 +# endif # endif # ifndef YYMALLOC # define YYMALLOC malloc -# if (! defined (malloc) && ! defined (YYINCLUDED_STDLIB_H) \ - && (defined (__STDC__) || defined (__cplusplus))) +# if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ # endif # endif # ifndef YYFREE # define YYFREE free -# if (! defined (free) && ! defined (YYINCLUDED_STDLIB_H) \ - && (defined (__STDC__) || defined (__cplusplus))) +# if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) void free (void *); /* INFRINGES ON USER NAME SPACE */ # endif # endif -# ifdef __cplusplus -} -# endif # endif -#endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */ +#endif /* ! defined yyoverflow || YYERROR_VERBOSE */ -#if (! defined (yyoverflow) \ - && (! defined (__cplusplus) \ - || (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL))) +#if (! defined yyoverflow \ + && (! defined __cplusplus \ + || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) /* A type that is properly aligned for any stack member. */ union yyalloc { - short int yyss; - YYSTYPE yyvs; - }; + yytype_int16 yyss_alloc; + YYSTYPE yyvs_alloc; +}; /* The size of the maximum gap between one aligned stack and the next. */ # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) @@ -711,13 +636,13 @@ union yyalloc /* The size of an array large to enough to hold all stacks, each with N elements. */ # define YYSTACK_BYTES(N) \ - ((N) * (sizeof (short int) + sizeof (YYSTYPE)) \ + ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ + YYSTACK_GAP_MAXIMUM) /* Copy COUNT objects from FROM to TO. The source and destination do not overlap. */ # ifndef YYCOPY -# if defined (__GNUC__) && 1 < __GNUC__ +# if defined __GNUC__ && 1 < __GNUC__ # define YYCOPY(To, From, Count) \ __builtin_memcpy (To, From, (Count) * sizeof (*(From))) # else @@ -728,7 +653,7 @@ union yyalloc for (yyi = 0; yyi < (Count); yyi++) \ (To)[yyi] = (From)[yyi]; \ } \ - while (0) + while (YYID (0)) # endif # endif @@ -737,62 +662,56 @@ union yyalloc elements in the stack, and YYPTR gives the new location of the stack. Advance YYPTR to a properly aligned location for the next stack. */ -# define YYSTACK_RELOCATE(Stack) \ +# define YYSTACK_RELOCATE(Stack_alloc, Stack) \ do \ { \ YYSIZE_T yynewbytes; \ - YYCOPY (&yyptr->Stack, Stack, yysize); \ - Stack = &yyptr->Stack; \ + YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ + Stack = &yyptr->Stack_alloc; \ yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ yyptr += yynewbytes / sizeof (*yyptr); \ } \ - while (0) + while (YYID (0)) #endif -#if defined (__STDC__) || defined (__cplusplus) - typedef signed char yysigned_char; -#else - typedef short int yysigned_char; -#endif - -/* YYFINAL -- State number of the termination state. */ +/* YYFINAL -- State number of the termination state. */ #define YYFINAL 3 /* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 2034 +#define YYLAST 1996 -/* YYNTOKENS -- Number of terminals. */ -#define YYNTOKENS 176 -/* YYNNTS -- Number of nonterminals. */ +/* YYNTOKENS -- Number of terminals. */ +#define YYNTOKENS 175 +/* YYNNTS -- Number of nonterminals. */ #define YYNNTS 88 -/* YYNRULES -- Number of rules. */ -#define YYNRULES 312 -/* YYNRULES -- Number of states. */ -#define YYNSTATES 548 +/* YYNRULES -- Number of rules. */ +#define YYNRULES 311 +/* YYNRULES -- Number of states. */ +#define YYNSTATES 547 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ #define YYUNDEFTOK 2 -#define YYMAXUTOK 406 +#define YYMAXUTOK 405 #define YYTRANSLATE(YYX) \ ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ -static const unsigned char yytranslate[] = +static const yytype_uint8 yytranslate[] = { 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 160, 2, 2, 2, 159, 152, 2, - 171, 172, 157, 156, 147, 155, 167, 158, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 149, 170, - 153, 175, 154, 148, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 159, 2, 2, 2, 158, 151, 2, + 170, 171, 156, 155, 146, 154, 166, 157, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 148, 169, + 152, 174, 153, 147, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 168, 2, 169, 151, 2, 2, 2, 2, 2, + 2, 167, 2, 168, 150, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 173, 150, 174, 161, 2, 2, 2, + 2, 2, 2, 172, 149, 173, 160, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, @@ -820,13 +739,13 @@ static const unsigned char yytranslate[] = 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, - 145, 146, 162, 163, 164, 165, 166 + 145, 161, 162, 163, 164, 165 }; #if YYDEBUG /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in YYRHS. */ -static const unsigned short int yyprhs[] = +static const yytype_uint16 yyprhs[] = { 0, 0, 3, 5, 6, 9, 12, 16, 19, 22, 25, 28, 29, 32, 35, 39, 42, 45, 48, 51, @@ -851,158 +770,158 @@ static const unsigned short int yyprhs[] = 609, 613, 616, 619, 620, 623, 626, 628, 632, 636, 640, 643, 644, 646, 647, 649, 651, 653, 655, 657, 659, 661, 664, 667, 669, 671, 673, 675, 677, 679, - 681, 682, 684, 686, 689, 691, 694, 697, 699, 701, - 704, 707, 710, 716, 717, 720, 723, 726, 729, 732, - 735, 739, 742, 746, 752, 758, 759, 762, 765, 768, - 771, 778, 787, 790, 793, 796, 799, 802, 805, 811, - 813, 815, 817, 819, 821, 822, 825, 828, 832, 833, - 835, 838, 841, 844, 848, 851, 853, 855, 859, 862, - 867, 869, 873, 875, 879, 881, 883, 885, 891, 893, - 895, 897, 899, 902, 904, 907, 909, 912, 917, 922, - 928, 939, 941 + 680, 682, 684, 687, 689, 692, 695, 697, 699, 702, + 705, 708, 714, 715, 718, 721, 724, 727, 730, 733, + 737, 740, 744, 750, 756, 757, 760, 763, 766, 769, + 776, 785, 788, 791, 794, 797, 800, 803, 809, 811, + 813, 815, 817, 819, 820, 823, 826, 830, 831, 833, + 836, 839, 842, 846, 849, 851, 853, 857, 860, 865, + 867, 871, 873, 877, 879, 881, 883, 889, 891, 893, + 895, 897, 900, 902, 905, 907, 910, 915, 920, 926, + 937, 939 }; -/* YYRHS -- A `-1'-separated list of the rules' RHS. */ -static const short int yyrhs[] = +/* YYRHS -- A `-1'-separated list of the rules' RHS. */ +static const yytype_int16 yyrhs[] = { - 177, 0, -1, 178, -1, -1, 178, 243, -1, 178, - 242, -1, 178, 229, 170, -1, 178, 231, -1, 178, - 246, -1, 178, 190, -1, 178, 182, -1, -1, 179, - 243, -1, 179, 242, -1, 179, 229, 170, -1, 179, - 231, -1, 179, 246, -1, 179, 182, -1, 179, 187, - -1, 179, 190, -1, -1, 180, 182, -1, -1, 170, - -1, 184, -1, 183, 170, -1, 222, 170, -1, 186, - -1, 261, 170, -1, 208, -1, 259, -1, 262, -1, - 197, 208, -1, 197, 259, -1, 197, 262, -1, 45, - 171, 8, 172, -1, 78, 8, 170, -1, 185, 179, - 11, -1, 79, 171, 8, 172, 181, -1, 89, 3, - -1, 197, 188, 173, -1, 189, 179, 174, 181, -1, - -1, 193, -1, 144, -1, 194, -1, 193, 147, 194, - -1, 192, -1, 197, 251, 254, -1, 251, 254, -1, - 168, 210, 169, -1, 168, 157, 169, -1, -1, 197, - -1, 168, 198, 169, -1, 200, -1, 198, 147, 200, - -1, 198, 169, 168, 200, -1, 8, -1, 199, 147, + 176, 0, -1, 177, -1, -1, 177, 242, -1, 177, + 241, -1, 177, 228, 169, -1, 177, 230, -1, 177, + 245, -1, 177, 189, -1, 177, 181, -1, -1, 178, + 242, -1, 178, 241, -1, 178, 228, 169, -1, 178, + 230, -1, 178, 245, -1, 178, 181, -1, 178, 186, + -1, 178, 189, -1, -1, 179, 181, -1, -1, 169, + -1, 183, -1, 182, 169, -1, 221, 169, -1, 185, + -1, 260, 169, -1, 207, -1, 258, -1, 261, -1, + 196, 207, -1, 196, 258, -1, 196, 261, -1, 45, + 170, 8, 171, -1, 78, 8, 169, -1, 184, 178, + 11, -1, 79, 170, 8, 171, 180, -1, 89, 3, + -1, 196, 187, 172, -1, 188, 178, 173, 180, -1, + -1, 192, -1, 143, -1, 193, -1, 192, 146, 193, + -1, 191, -1, 196, 250, 253, -1, 250, 253, -1, + 167, 209, 168, -1, 167, 156, 168, -1, -1, 196, + -1, 167, 197, 168, -1, 199, -1, 197, 146, 199, + -1, 197, 168, 167, 199, -1, 8, -1, 198, 146, 8, -1, -1, 21, -1, 23, -1, 24, -1, 26, - -1, 27, -1, 29, -1, 32, 171, 225, 172, -1, - 34, 171, 212, 172, -1, 41, -1, 42, -1, 43, - -1, 44, -1, 46, -1, 47, -1, 48, 171, 214, - 172, -1, 49, -1, 50, -1, 52, 171, 8, 172, - -1, 54, -1, 55, 171, 199, 172, -1, 56, 171, - 214, 172, -1, 59, -1, 64, -1, 66, 171, 213, - 172, -1, 67, 171, 8, 172, -1, 68, 171, 8, - 172, -1, 69, 171, 213, 172, -1, 70, 171, 8, - 172, -1, 71, -1, 73, 171, 213, 172, -1, 74, - -1, 75, 171, 211, 172, -1, 76, -1, 77, 171, - 65, 3, 172, -1, 80, -1, 83, -1, 88, 171, - 209, 172, -1, 87, 171, 213, 172, -1, 90, -1, + -1, 27, -1, 29, -1, 32, 170, 224, 171, -1, + 34, 170, 211, 171, -1, 41, -1, 42, -1, 43, + -1, 44, -1, 46, -1, 47, -1, 48, 170, 213, + 171, -1, 49, -1, 50, -1, 52, 170, 8, 171, + -1, 54, -1, 55, 170, 198, 171, -1, 56, 170, + 213, 171, -1, 59, -1, 64, -1, 66, 170, 212, + 171, -1, 67, 170, 8, 171, -1, 68, 170, 8, + 171, -1, 69, 170, 212, 171, -1, 70, 170, 8, + 171, -1, 71, -1, 73, 170, 212, 171, -1, 74, + -1, 75, 170, 210, 171, -1, 76, -1, 77, 170, + 65, 3, 171, -1, 80, -1, 83, -1, 88, 170, + 208, 171, -1, 87, 170, 212, 171, -1, 90, -1, 94, -1, 95, -1, 96, -1, 98, -1, 99, -1, - 100, -1, 101, -1, 102, -1, 104, 171, 258, 172, + 100, -1, 101, -1, 102, -1, 104, 170, 257, 171, -1, 106, -1, 107, -1, 108, -1, 110, -1, 111, - 171, 213, 147, 213, 172, -1, 112, -1, 115, -1, - 116, -1, 117, -1, 122, 171, 209, 172, -1, 125, - -1, 128, -1, 129, -1, 132, 171, 211, 172, -1, - 133, 171, 260, 172, -1, 134, 171, 260, 172, -1, - 140, 171, 201, 172, -1, 141, -1, 142, -1, 143, - 171, 263, 172, -1, 146, 171, 260, 172, -1, 258, + 170, 212, 146, 212, 171, -1, 112, -1, 115, -1, + 116, -1, 117, -1, 121, 170, 208, 171, -1, 124, + -1, 127, -1, 128, -1, 131, 170, 210, 171, -1, + 132, 170, 259, 171, -1, 133, 170, 259, 171, -1, + 139, 170, 200, 171, -1, 140, -1, 141, -1, 142, + 170, 262, 171, -1, 145, 170, 259, 171, -1, 257, -1, 10, -1, 8, -1, 35, -1, 62, -1, 103, - -1, 127, -1, -1, 203, 204, -1, 34, 213, 149, - 219, -1, 46, 149, 219, -1, -1, 206, 147, -1, - 206, -1, 207, -1, 206, 147, 207, -1, 225, 175, - 213, -1, 225, -1, 57, 224, 173, 205, 174, -1, - 210, -1, 209, 147, 210, -1, -1, 211, -1, 5, - -1, 6, -1, 7, -1, 61, -1, 97, -1, 135, - -1, 8, -1, 9, -1, 3, -1, 211, 148, 211, - 149, 211, -1, 211, 19, 211, -1, 211, 20, 211, - -1, 211, 150, 211, -1, 211, 151, 211, -1, 211, - 152, 211, -1, 211, 15, 211, -1, 211, 16, 211, - -1, 211, 154, 211, -1, 211, 153, 211, -1, 211, - 17, 211, -1, 211, 18, 211, -1, 211, 12, 211, - -1, 211, 13, 211, -1, 211, 156, 211, -1, 211, - 155, 211, -1, 211, 159, 211, -1, 211, 157, 211, - -1, 211, 158, 211, -1, 160, 211, -1, 161, 211, - -1, 156, 211, -1, 155, 211, -1, 152, 211, -1, - 157, 211, -1, 211, 14, 3, -1, 211, 167, 3, - -1, 171, 260, 172, 211, -1, 123, 171, 260, 172, - -1, 211, 168, 211, 169, -1, 171, 211, 172, -1, - 213, -1, 212, 147, 213, -1, 211, -1, 211, -1, - -1, 215, 216, -1, 196, 251, 256, 170, -1, 196, - 262, 170, -1, 220, 170, -1, 197, 170, -1, -1, - 218, 217, -1, 220, 170, -1, 170, -1, 196, 251, - 254, -1, 196, 251, 254, -1, 197, 251, 257, -1, - 251, 257, -1, -1, 225, -1, -1, 3, -1, 4, - -1, 3, -1, 4, -1, 30, -1, 145, -1, 228, - -1, 120, 228, -1, 139, 228, -1, 139, -1, 63, - -1, 121, -1, 53, -1, 28, -1, 58, -1, 65, - -1, -1, 84, -1, 84, -1, 119, 227, -1, 124, - -1, 91, 227, -1, 72, 227, -1, 85, -1, 36, - -1, 37, 3, -1, 37, 4, -1, 197, 229, -1, - 230, 173, 232, 174, 181, -1, -1, 232, 233, -1, - 196, 243, -1, 51, 3, -1, 51, 4, -1, 197, - 234, -1, 105, 149, -1, 236, 220, 170, -1, 92, - 149, -1, 237, 221, 170, -1, 235, 173, 236, 237, - 174, -1, 235, 173, 240, 170, 174, -1, -1, 149, - 4, -1, 86, 3, -1, 86, 4, -1, 197, 240, - -1, 241, 239, 173, 180, 174, 181, -1, 241, 149, - 3, 173, 186, 180, 174, 181, -1, 238, 181, -1, - 240, 170, -1, 234, 170, -1, 93, 3, -1, 93, - 4, -1, 197, 244, -1, 245, 173, 180, 174, 181, - -1, 60, -1, 126, -1, 114, -1, 82, -1, 40, - -1, -1, 250, 249, -1, 260, 252, -1, 253, 260, - 252, -1, -1, 253, -1, 249, 252, -1, 248, 252, - -1, 247, 252, -1, 157, 250, 254, -1, 202, 254, - -1, 255, -1, 225, -1, 171, 254, 172, -1, 255, - 195, -1, 255, 171, 191, 172, -1, 254, -1, 256, - 147, 254, -1, 254, -1, 254, 175, 214, -1, 113, - -1, 138, -1, 109, -1, 130, 224, 173, 215, 174, - -1, 144, -1, 4, -1, 226, -1, 208, -1, 57, - 3, -1, 259, -1, 130, 3, -1, 262, -1, 137, - 3, -1, 118, 171, 260, 172, -1, 136, 196, 251, - 256, -1, 137, 224, 173, 218, 174, -1, 137, 224, - 131, 171, 220, 172, 223, 173, 203, 174, -1, 5, - -1, 5, 167, 5, -1 + -1, 126, -1, -1, 202, 203, -1, 34, 212, 148, + 218, -1, 46, 148, 218, -1, -1, 205, 146, -1, + 205, -1, 206, -1, 205, 146, 206, -1, 224, 174, + 212, -1, 224, -1, 57, 223, 172, 204, 173, -1, + 209, -1, 208, 146, 209, -1, -1, 210, -1, 5, + -1, 6, -1, 7, -1, 61, -1, 97, -1, 134, + -1, 8, -1, 9, -1, 3, -1, 210, 147, 210, + 148, 210, -1, 210, 19, 210, -1, 210, 20, 210, + -1, 210, 149, 210, -1, 210, 150, 210, -1, 210, + 151, 210, -1, 210, 15, 210, -1, 210, 16, 210, + -1, 210, 153, 210, -1, 210, 152, 210, -1, 210, + 17, 210, -1, 210, 18, 210, -1, 210, 12, 210, + -1, 210, 13, 210, -1, 210, 155, 210, -1, 210, + 154, 210, -1, 210, 158, 210, -1, 210, 156, 210, + -1, 210, 157, 210, -1, 159, 210, -1, 160, 210, + -1, 155, 210, -1, 154, 210, -1, 151, 210, -1, + 156, 210, -1, 210, 14, 3, -1, 210, 166, 3, + -1, 170, 259, 171, 210, -1, 122, 170, 259, 171, + -1, 210, 167, 210, 168, -1, 170, 210, 171, -1, + 212, -1, 211, 146, 212, -1, 210, -1, 210, -1, + -1, 214, 215, -1, 195, 250, 255, 169, -1, 195, + 261, 169, -1, 219, 169, -1, 196, 169, -1, -1, + 217, 216, -1, 219, 169, -1, 169, -1, 195, 250, + 253, -1, 195, 250, 253, -1, 196, 250, 256, -1, + 250, 256, -1, -1, 224, -1, -1, 3, -1, 4, + -1, 3, -1, 4, -1, 30, -1, 144, -1, 227, + -1, 120, 227, -1, 138, 227, -1, 138, -1, 63, + -1, 53, -1, 28, -1, 58, -1, 65, -1, -1, + 84, -1, 84, -1, 119, 226, -1, 123, -1, 91, + 226, -1, 72, 226, -1, 85, -1, 36, -1, 37, + 3, -1, 37, 4, -1, 196, 228, -1, 229, 172, + 231, 173, 180, -1, -1, 231, 232, -1, 195, 242, + -1, 51, 3, -1, 51, 4, -1, 196, 233, -1, + 105, 148, -1, 235, 219, 169, -1, 92, 148, -1, + 236, 220, 169, -1, 234, 172, 235, 236, 173, -1, + 234, 172, 239, 169, 173, -1, -1, 148, 4, -1, + 86, 3, -1, 86, 4, -1, 196, 239, -1, 240, + 238, 172, 179, 173, 180, -1, 240, 148, 3, 172, + 185, 179, 173, 180, -1, 237, 180, -1, 239, 169, + -1, 233, 169, -1, 93, 3, -1, 93, 4, -1, + 196, 243, -1, 244, 172, 179, 173, 180, -1, 60, + -1, 125, -1, 114, -1, 82, -1, 40, -1, -1, + 249, 248, -1, 259, 251, -1, 252, 259, 251, -1, + -1, 252, -1, 248, 251, -1, 247, 251, -1, 246, + 251, -1, 156, 249, 253, -1, 201, 253, -1, 254, + -1, 224, -1, 170, 253, 171, -1, 254, 194, -1, + 254, 170, 190, 171, -1, 253, -1, 255, 146, 253, + -1, 253, -1, 253, 174, 213, -1, 113, -1, 137, + -1, 109, -1, 129, 223, 172, 214, 173, -1, 143, + -1, 4, -1, 225, -1, 207, -1, 57, 3, -1, + 258, -1, 129, 3, -1, 261, -1, 136, 3, -1, + 118, 170, 259, 171, -1, 135, 195, 250, 255, -1, + 136, 223, 172, 217, 173, -1, 136, 223, 130, 170, + 219, 171, 222, 172, 202, 173, -1, 5, -1, 5, + 166, 5, -1 }; /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ -static const unsigned short int yyrline[] = +static const yytype_uint16 yyrline[] = { - 0, 347, 347, 360, 361, 362, 363, 366, 369, 370, - 371, 374, 375, 376, 377, 378, 381, 382, 383, 384, - 387, 388, 391, 392, 396, 397, 398, 399, 400, 404, - 405, 406, 407, 408, 409, 412, 414, 422, 428, 432, - 434, 438, 445, 446, 449, 452, 453, 454, 458, 465, - 473, 474, 477, 478, 482, 485, 486, 487, 490, 491, - 494, 495, 496, 497, 498, 499, 500, 501, 502, 503, - 504, 505, 506, 507, 508, 509, 510, 511, 512, 513, - 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, - 524, 525, 526, 527, 528, 529, 530, 531, 532, 533, - 534, 535, 536, 537, 538, 539, 540, 541, 542, 543, - 544, 545, 546, 547, 551, 552, 553, 554, 555, 556, - 557, 558, 559, 560, 561, 562, 563, 564, 565, 566, - 567, 571, 572, 577, 578, 579, 580, 583, 584, 587, - 591, 597, 598, 599, 602, 606, 615, 619, 624, 627, - 628, 641, 642, 645, 646, 647, 648, 649, 650, 651, - 652, 653, 654, 655, 656, 657, 658, 659, 660, 661, - 662, 663, 664, 665, 666, 667, 668, 669, 670, 671, - 672, 673, 674, 675, 676, 677, 678, 679, 680, 681, - 682, 683, 684, 687, 688, 691, 697, 703, 704, 707, - 712, 719, 720, 723, 724, 728, 729, 732, 740, 749, - 755, 761, 762, 765, 766, 767, 770, 772, 775, 776, - 777, 778, 779, 795, 796, 797, 798, 799, 800, 801, - 804, 805, 808, 809, 810, 811, 812, 813, 814, 817, - 818, 826, 832, 836, 837, 841, 844, 845, 848, 858, - 859, 862, 863, 866, 872, 878, 879, 882, 883, 886, - 897, 904, 910, 914, 915, 918, 919, 922, 927, 934, - 935, 936, 940, 944, 947, 948, 951, 952, 956, 957, - 961, 962, 963, 967, 969, 970, 974, 975, 976, 977, - 984, 985, 989, 990, 994, 995, 996, 999, 1002, 1003, - 1004, 1005, 1006, 1007, 1008, 1009, 1010, 1011, 1014, 1020, - 1022, 1028, 1029 + 0, 326, 326, 339, 340, 341, 342, 345, 348, 349, + 350, 353, 354, 355, 356, 357, 360, 361, 362, 363, + 366, 367, 370, 371, 375, 376, 377, 378, 379, 383, + 384, 385, 386, 387, 388, 391, 393, 401, 407, 411, + 413, 417, 424, 425, 428, 431, 432, 433, 437, 444, + 452, 453, 456, 457, 461, 464, 465, 466, 469, 470, + 473, 474, 475, 476, 477, 478, 479, 480, 481, 482, + 483, 484, 485, 486, 487, 488, 489, 490, 491, 492, + 493, 494, 495, 496, 497, 498, 499, 500, 501, 502, + 503, 504, 505, 506, 507, 508, 509, 510, 511, 512, + 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, + 523, 524, 525, 526, 530, 531, 532, 533, 534, 535, + 536, 537, 538, 539, 540, 541, 542, 543, 544, 545, + 546, 550, 551, 556, 557, 558, 559, 562, 563, 566, + 570, 576, 577, 578, 581, 585, 594, 598, 603, 606, + 607, 620, 621, 624, 625, 626, 627, 628, 629, 630, + 631, 632, 633, 634, 635, 636, 637, 638, 639, 640, + 641, 642, 643, 644, 645, 646, 647, 648, 649, 650, + 651, 652, 653, 654, 655, 656, 657, 658, 659, 660, + 661, 662, 663, 666, 667, 670, 676, 682, 683, 686, + 691, 698, 699, 702, 703, 707, 708, 711, 719, 728, + 734, 740, 741, 744, 745, 746, 749, 751, 754, 755, + 756, 757, 758, 759, 760, 761, 762, 763, 764, 767, + 768, 771, 772, 773, 774, 775, 776, 777, 780, 781, + 789, 795, 799, 800, 804, 807, 808, 811, 821, 822, + 825, 826, 829, 835, 841, 842, 845, 846, 849, 860, + 867, 873, 877, 878, 881, 882, 885, 890, 897, 898, + 899, 903, 907, 910, 911, 914, 915, 919, 920, 924, + 925, 926, 930, 932, 933, 937, 938, 939, 940, 947, + 948, 952, 953, 957, 958, 959, 962, 965, 966, 967, + 968, 969, 970, 971, 972, 973, 974, 977, 983, 985, + 991, 992 }; #endif #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. - First, the terminals, then, starting at YYNTOKENS, nonterminals. */ + First, the terminals, then, starting at YYNTOKENS, nonterminals. */ static const char *const yytname[] = { "$end", "error", "$undefined", "aIDENTIFIER", "aKNOWNTYPE", "aNUM", @@ -1027,29 +946,29 @@ static const char *const yytname[] = "tOPTIONAL", "tOUT", "tPASCAL", "tPOINTERDEFAULT", "tPROPERTIES", "tPROPGET", "tPROPPUT", "tPROPPUTREF", "tPTR", "tPUBLIC", "tRANGE", "tREADONLY", "tREF", "tREGISTER", "tREQUESTEDIT", "tRESTRICTED", - "tRETVAL", "tSAFEARRAY", "tSHORT", "tSIGNED", "tSINGLE", "tSIZEIS", - "tSIZEOF", "tSMALL", "tSOURCE", "tSTATIC", "tSTDCALL", - "tSTRICTCONTEXTHANDLE", "tSTRING", "tSTRUCT", "tSWITCH", "tSWITCHIS", - "tSWITCHTYPE", "tTRANSMITAS", "tTRUE", "tTYPEDEF", "tUNION", "tUNIQUE", - "tUNSIGNED", "tUUID", "tV1ENUM", "tVARARG", "tVERSION", "tVOID", - "tWCHAR", "tWIREMARSHAL", "','", "'?'", "':'", "'|'", "'^'", "'&'", - "'<'", "'>'", "'-'", "'+'", "'*'", "'/'", "'%'", "'!'", "'~'", - "ADDRESSOF", "NEG", "POS", "PPTR", "CAST", "'.'", "'['", "']'", "';'", - "'('", "')'", "'{'", "'}'", "'='", "$accept", "input", "gbl_statements", - "imp_statements", "int_statements", "semicolon_opt", "statement", - "typedecl", "cppquote", "import_start", "import", "importlib", - "libraryhdr", "library_start", "librarydef", "m_args", "no_args", "args", - "arg", "array", "m_attributes", "attributes", "attrib_list", "str_list", - "attribute", "uuid_string", "callconv", "cases", "case", "enums", - "enum_list", "enum", "enumdef", "m_exprs", "m_expr", "expr", - "expr_list_int_const", "expr_int_const", "expr_const", "fields", "field", - "ne_union_field", "ne_union_fields", "union_field", "s_field", "funcdef", - "declaration", "m_ident", "t_ident", "ident", "base_type", "m_int", - "int_std", "coclass", "coclasshdr", "coclassdef", "coclass_ints", - "coclass_int", "dispinterface", "dispinterfacehdr", "dispint_props", - "dispint_meths", "dispinterfacedef", "inherit", "interface", - "interfacehdr", "interfacedef", "interfacedec", "module", "modulehdr", - "moduledef", "storage_cls_spec", "function_specifier", "type_qualifier", + "tRETVAL", "tSAFEARRAY", "tSHORT", "tSIGNED", "tSIZEIS", "tSIZEOF", + "tSMALL", "tSOURCE", "tSTATIC", "tSTDCALL", "tSTRICTCONTEXTHANDLE", + "tSTRING", "tSTRUCT", "tSWITCH", "tSWITCHIS", "tSWITCHTYPE", + "tTRANSMITAS", "tTRUE", "tTYPEDEF", "tUNION", "tUNIQUE", "tUNSIGNED", + "tUUID", "tV1ENUM", "tVARARG", "tVERSION", "tVOID", "tWCHAR", + "tWIREMARSHAL", "','", "'?'", "':'", "'|'", "'^'", "'&'", "'<'", "'>'", + "'-'", "'+'", "'*'", "'/'", "'%'", "'!'", "'~'", "ADDRESSOF", "NEG", + "POS", "PPTR", "CAST", "'.'", "'['", "']'", "';'", "'('", "')'", "'{'", + "'}'", "'='", "$accept", "input", "gbl_statements", "imp_statements", + "int_statements", "semicolon_opt", "statement", "typedecl", "cppquote", + "import_start", "import", "importlib", "libraryhdr", "library_start", + "librarydef", "m_args", "no_args", "args", "arg", "array", + "m_attributes", "attributes", "attrib_list", "str_list", "attribute", + "uuid_string", "callconv", "cases", "case", "enums", "enum_list", "enum", + "enumdef", "m_exprs", "m_expr", "expr", "expr_list_int_const", + "expr_int_const", "expr_const", "fields", "field", "ne_union_field", + "ne_union_fields", "union_field", "s_field", "funcdef", "declaration", + "m_ident", "t_ident", "ident", "base_type", "m_int", "int_std", + "coclass", "coclasshdr", "coclassdef", "coclass_ints", "coclass_int", + "dispinterface", "dispinterfacehdr", "dispint_props", "dispint_meths", + "dispinterfacedef", "inherit", "interface", "interfacehdr", + "interfacedef", "interfacedec", "module", "modulehdr", "moduledef", + "storage_cls_spec", "function_specifier", "type_qualifier", "m_type_qual_list", "decl_spec", "m_decl_spec_no_type", "decl_spec_no_type", "declarator", "direct_declarator", "declarator_list", "init_declarator", "pointer_type", "structdef", @@ -1060,7 +979,7 @@ static const char *const yytname[] = # ifdef YYPRINT /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to token YYLEX-NUM. */ -static const unsigned short int yytoknum[] = +static const yytype_uint16 yytoknum[] = { 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, @@ -1076,52 +995,52 @@ static const unsigned short int yytoknum[] = 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, - 395, 396, 397, 398, 399, 400, 401, 44, 63, 58, - 124, 94, 38, 60, 62, 45, 43, 42, 47, 37, - 33, 126, 402, 403, 404, 405, 406, 46, 91, 93, - 59, 40, 41, 123, 125, 61 + 395, 396, 397, 398, 399, 400, 44, 63, 58, 124, + 94, 38, 60, 62, 45, 43, 42, 47, 37, 33, + 126, 401, 402, 403, 404, 405, 46, 91, 93, 59, + 40, 41, 123, 125, 61 }; # endif /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ -static const unsigned short int yyr1[] = +static const yytype_uint16 yyr1[] = { - 0, 176, 177, 178, 178, 178, 178, 178, 178, 178, - 178, 179, 179, 179, 179, 179, 179, 179, 179, 179, - 180, 180, 181, 181, 182, 182, 182, 182, 182, 183, - 183, 183, 183, 183, 183, 184, 185, 186, 187, 188, - 189, 190, 191, 191, 192, 193, 193, 193, 194, 194, - 195, 195, 196, 196, 197, 198, 198, 198, 199, 199, - 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, - 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, - 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, - 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, - 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, - 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, - 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, - 200, 201, 201, 202, 202, 202, 202, 203, 203, 204, - 204, 205, 205, 205, 206, 206, 207, 207, 208, 209, - 209, 210, 210, 211, 211, 211, 211, 211, 211, 211, - 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, - 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, - 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, - 211, 211, 211, 212, 212, 213, 214, 215, 215, 216, - 216, 217, 217, 218, 218, 219, 219, 220, 221, 222, - 222, 223, 223, 224, 224, 224, 225, 225, 226, 226, - 226, 226, 226, 226, 226, 226, 226, 226, 226, 226, - 227, 227, 228, 228, 228, 228, 228, 228, 228, 229, - 229, 230, 231, 232, 232, 233, 234, 234, 235, 236, - 236, 237, 237, 238, 238, 239, 239, 240, 240, 241, - 242, 242, 242, 243, 243, 244, 244, 245, 246, 247, - 247, 247, 248, 249, 250, 250, 251, 251, 252, 252, - 253, 253, 253, 254, 254, 254, 255, 255, 255, 255, - 256, 256, 257, 257, 258, 258, 258, 259, 260, 260, - 260, 260, 260, 260, 260, 260, 260, 260, 261, 262, - 262, 263, 263 + 0, 175, 176, 177, 177, 177, 177, 177, 177, 177, + 177, 178, 178, 178, 178, 178, 178, 178, 178, 178, + 179, 179, 180, 180, 181, 181, 181, 181, 181, 182, + 182, 182, 182, 182, 182, 183, 184, 185, 186, 187, + 188, 189, 190, 190, 191, 192, 192, 192, 193, 193, + 194, 194, 195, 195, 196, 197, 197, 197, 198, 198, + 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, + 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, + 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, + 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, + 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, + 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, + 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, + 199, 200, 200, 201, 201, 201, 201, 202, 202, 203, + 203, 204, 204, 204, 205, 205, 206, 206, 207, 208, + 208, 209, 209, 210, 210, 210, 210, 210, 210, 210, + 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, + 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, + 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, + 210, 210, 210, 211, 211, 212, 213, 214, 214, 215, + 215, 216, 216, 217, 217, 218, 218, 219, 220, 221, + 221, 222, 222, 223, 223, 223, 224, 224, 225, 225, + 225, 225, 225, 225, 225, 225, 225, 225, 225, 226, + 226, 227, 227, 227, 227, 227, 227, 227, 228, 228, + 229, 230, 231, 231, 232, 233, 233, 234, 235, 235, + 236, 236, 237, 237, 238, 238, 239, 239, 240, 241, + 241, 241, 242, 242, 243, 243, 244, 245, 246, 246, + 246, 247, 248, 249, 249, 250, 250, 251, 251, 252, + 252, 252, 253, 253, 253, 254, 254, 254, 254, 255, + 255, 256, 256, 257, 257, 257, 258, 259, 259, 259, + 259, 259, 259, 259, 259, 259, 259, 260, 261, 261, + 262, 262 }; /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ -static const unsigned char yyr2[] = +static const yytype_uint8 yyr2[] = { 0, 2, 1, 0, 2, 2, 3, 2, 2, 2, 2, 0, 2, 2, 3, 2, 2, 2, 2, 2, @@ -1145,168 +1064,168 @@ static const unsigned char yyr2[] = 4, 4, 3, 1, 3, 1, 1, 0, 2, 4, 3, 2, 2, 0, 2, 2, 1, 3, 3, 3, 2, 0, 1, 0, 1, 1, 1, 1, 1, 1, - 1, 2, 2, 1, 1, 1, 1, 1, 1, 1, - 0, 1, 1, 2, 1, 2, 2, 1, 1, 2, - 2, 2, 5, 0, 2, 2, 2, 2, 2, 2, - 3, 2, 3, 5, 5, 0, 2, 2, 2, 2, - 6, 8, 2, 2, 2, 2, 2, 2, 5, 1, - 1, 1, 1, 1, 0, 2, 2, 3, 0, 1, - 2, 2, 2, 3, 2, 1, 1, 3, 2, 4, - 1, 3, 1, 3, 1, 1, 1, 5, 1, 1, - 1, 1, 2, 1, 2, 1, 2, 4, 4, 5, - 10, 1, 3 + 1, 2, 2, 1, 1, 1, 1, 1, 1, 0, + 1, 1, 2, 1, 2, 2, 1, 1, 2, 2, + 2, 5, 0, 2, 2, 2, 2, 2, 2, 3, + 2, 3, 5, 5, 0, 2, 2, 2, 2, 6, + 8, 2, 2, 2, 2, 2, 2, 5, 1, 1, + 1, 1, 1, 0, 2, 2, 3, 0, 1, 2, + 2, 2, 3, 2, 1, 1, 3, 2, 4, 1, + 3, 1, 3, 1, 1, 1, 5, 1, 1, 1, + 1, 2, 1, 2, 1, 2, 4, 4, 5, 10, + 1, 3 }; /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state STATE-NUM when YYTABLE doesn't specify something else to do. Zero means the default is an error. */ -static const unsigned short int yydefact[] = +static const yytype_uint16 yydefact[] = { - 3, 0, 2, 1, 299, 227, 218, 238, 0, 273, - 0, 0, 226, 213, 228, 269, 224, 229, 230, 0, - 272, 232, 237, 0, 230, 271, 0, 230, 0, 225, - 234, 270, 213, 52, 213, 223, 298, 219, 60, 10, - 0, 24, 11, 27, 11, 9, 0, 301, 0, 300, - 220, 0, 0, 7, 0, 0, 22, 0, 255, 5, - 4, 0, 8, 278, 278, 278, 0, 0, 303, 278, - 0, 305, 239, 240, 0, 246, 247, 302, 215, 0, - 231, 236, 0, 257, 258, 235, 0, 233, 221, 304, - 0, 0, 53, 306, 0, 222, 61, 62, 63, 64, - 65, 66, 0, 0, 69, 70, 71, 72, 73, 74, - 0, 76, 77, 0, 79, 0, 0, 82, 83, 0, - 0, 0, 0, 0, 89, 0, 91, 0, 93, 0, - 95, 96, 0, 0, 99, 100, 101, 102, 103, 104, - 105, 106, 107, 0, 109, 110, 111, 296, 112, 0, - 114, 294, 115, 116, 117, 0, 119, 120, 121, 0, - 0, 0, 295, 0, 126, 127, 0, 0, 0, 55, - 130, 25, 0, 0, 0, 0, 0, 301, 241, 248, - 259, 267, 0, 303, 305, 26, 6, 243, 264, 0, - 23, 262, 263, 0, 0, 20, 282, 279, 281, 280, - 216, 217, 133, 134, 135, 136, 274, 0, 0, 286, - 292, 285, 210, 301, 303, 278, 305, 276, 28, 0, - 141, 36, 0, 197, 0, 0, 203, 0, 0, 0, + 3, 0, 2, 1, 298, 226, 218, 237, 0, 272, + 0, 0, 225, 213, 227, 268, 224, 228, 229, 0, + 271, 231, 236, 0, 229, 270, 0, 229, 0, 233, + 269, 213, 52, 213, 223, 297, 219, 60, 10, 0, + 24, 11, 27, 11, 9, 0, 300, 0, 299, 220, + 0, 0, 7, 0, 0, 22, 0, 254, 5, 4, + 0, 8, 277, 277, 277, 0, 0, 302, 277, 0, + 304, 238, 239, 0, 245, 246, 301, 215, 0, 230, + 235, 0, 256, 257, 234, 0, 232, 221, 303, 0, + 0, 53, 305, 0, 222, 61, 62, 63, 64, 65, + 66, 0, 0, 69, 70, 71, 72, 73, 74, 0, + 76, 77, 0, 79, 0, 0, 82, 83, 0, 0, + 0, 0, 0, 89, 0, 91, 0, 93, 0, 95, + 96, 0, 0, 99, 100, 101, 102, 103, 104, 105, + 106, 107, 0, 109, 110, 111, 295, 112, 0, 114, + 293, 115, 116, 117, 0, 119, 120, 121, 0, 0, + 0, 294, 0, 126, 127, 0, 0, 0, 55, 130, + 25, 0, 0, 0, 0, 0, 300, 240, 247, 258, + 266, 0, 302, 304, 26, 6, 242, 263, 0, 23, + 261, 262, 0, 0, 20, 281, 278, 280, 279, 216, + 217, 133, 134, 135, 136, 273, 0, 0, 285, 291, + 284, 210, 300, 302, 277, 304, 275, 28, 0, 141, + 36, 0, 197, 0, 0, 203, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 151, 0, 0, 151, 0, 0, 0, 0, - 0, 0, 60, 54, 37, 0, 17, 18, 19, 0, - 15, 13, 12, 16, 22, 39, 265, 266, 40, 209, - 52, 0, 52, 0, 0, 256, 20, 0, 0, 0, - 284, 0, 151, 42, 288, 277, 35, 0, 143, 144, - 147, 307, 52, 290, 308, 52, 52, 0, 161, 153, - 154, 155, 159, 160, 156, 157, 0, 158, 0, 0, - 0, 0, 0, 0, 0, 195, 0, 193, 196, 0, - 0, 58, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 149, 152, 0, 0, 0, 0, - 0, 0, 132, 131, 0, 311, 0, 0, 56, 60, - 0, 14, 41, 22, 0, 244, 249, 0, 0, 0, - 52, 0, 0, 0, 22, 21, 0, 275, 283, 287, - 293, 0, 0, 298, 0, 47, 43, 45, 0, 0, - 148, 142, 0, 297, 0, 198, 0, 0, 309, 53, - 204, 0, 67, 0, 185, 184, 183, 186, 181, 182, + 0, 151, 0, 0, 151, 0, 0, 0, 0, 0, + 0, 60, 54, 37, 0, 17, 18, 19, 0, 15, + 13, 12, 16, 22, 39, 264, 265, 40, 209, 52, + 0, 52, 0, 0, 255, 20, 0, 0, 0, 283, + 0, 151, 42, 287, 276, 35, 0, 143, 144, 147, + 306, 52, 289, 307, 52, 52, 0, 161, 153, 154, + 155, 159, 160, 156, 157, 0, 158, 0, 0, 0, + 0, 0, 0, 0, 195, 0, 193, 196, 0, 0, + 58, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 149, 152, 0, 0, 0, 0, 0, + 0, 132, 131, 0, 310, 0, 0, 56, 60, 0, + 14, 41, 22, 0, 243, 248, 0, 0, 0, 52, + 0, 0, 0, 22, 21, 0, 274, 282, 286, 292, + 0, 0, 297, 0, 47, 43, 45, 0, 0, 148, + 142, 0, 296, 0, 198, 0, 0, 308, 53, 204, + 0, 67, 0, 185, 184, 183, 186, 181, 182, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 68, 75, 78, 0, 80, - 81, 84, 85, 86, 87, 88, 90, 92, 0, 98, - 151, 97, 108, 0, 118, 122, 123, 124, 125, 0, - 128, 129, 57, 0, 242, 245, 251, 0, 250, 253, - 0, 0, 254, 20, 22, 268, 51, 50, 289, 0, - 0, 49, 145, 146, 0, 305, 291, 211, 202, 201, - 0, 192, 0, 174, 175, 187, 168, 169, 172, 173, - 163, 164, 0, 165, 166, 167, 171, 170, 177, 176, - 179, 180, 178, 188, 0, 194, 59, 94, 150, 0, - 312, 22, 207, 0, 252, 0, 260, 46, 48, 0, - 200, 0, 212, 190, 189, 0, 191, 113, 38, 208, - 22, 199, 137, 162, 261, 0, 0, 0, 310, 138, - 0, 52, 52, 206, 140, 0, 139, 205 + 0, 0, 0, 0, 68, 75, 78, 0, 80, 81, + 84, 85, 86, 87, 88, 90, 92, 0, 98, 151, + 97, 108, 0, 118, 122, 123, 124, 125, 0, 128, + 129, 57, 0, 241, 244, 250, 0, 249, 252, 0, + 0, 253, 20, 22, 267, 51, 50, 288, 0, 0, + 49, 145, 146, 0, 304, 290, 211, 202, 201, 0, + 192, 0, 174, 175, 187, 168, 169, 172, 173, 163, + 164, 0, 165, 166, 167, 171, 170, 177, 176, 179, + 180, 178, 188, 0, 194, 59, 94, 150, 0, 311, + 22, 207, 0, 251, 0, 259, 46, 48, 0, 200, + 0, 212, 190, 189, 0, 191, 113, 38, 208, 22, + 199, 137, 162, 260, 0, 0, 0, 309, 138, 0, + 52, 52, 206, 140, 0, 139, 205 }; -/* YYDEFGOTO[NTERM-NUM]. */ -static const short int yydefgoto[] = +/* YYDEFGOTO[NTERM-NUM]. */ +static const yytype_int16 yydefgoto[] = { - -1, 1, 2, 172, 277, 191, 365, 40, 41, 42, - 43, 257, 176, 44, 258, 374, 375, 376, 377, 284, - 358, 92, 168, 322, 169, 344, 208, 535, 539, 287, - 288, 289, 213, 333, 334, 315, 316, 317, 319, 292, - 385, 390, 296, 544, 545, 461, 48, 521, 79, 209, - 49, 81, 50, 259, 52, 260, 270, 355, 54, 55, - 272, 360, 56, 194, 57, 58, 261, 262, 181, 61, - 263, 63, 64, 65, 278, 66, 196, 67, 210, 211, - 294, 212, 170, 214, 69, 70, 216, 346 + -1, 1, 2, 171, 276, 190, 364, 39, 40, 41, + 42, 256, 175, 43, 257, 373, 374, 375, 376, 283, + 357, 91, 167, 321, 168, 343, 207, 534, 538, 286, + 287, 288, 212, 332, 333, 314, 315, 316, 318, 291, + 384, 389, 295, 543, 544, 460, 47, 520, 78, 208, + 48, 80, 49, 258, 51, 259, 269, 354, 53, 54, + 271, 359, 55, 193, 56, 57, 260, 261, 180, 60, + 262, 62, 63, 64, 277, 65, 195, 66, 209, 210, + 293, 211, 169, 213, 68, 69, 215, 345 }; /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */ -#define YYPACT_NINF -265 -static const short int yypact[] = +#define YYPACT_NINF -269 +static const yytype_int16 yypact[] = { - -265, 38, 1016, -265, -265, -265, -265, -265, 133, -265, - -118, 135, -265, 138, -265, -265, -265, -265, -26, 63, - -265, -265, -265, 140, -26, -265, -44, -26, -3, -265, - -265, -265, 142, -57, 144, -3, -265, -265, 1888, -265, - -8, -265, -265, -265, -265, -265, 1650, 21, 23, -265, - -265, 26, -23, -265, 28, -14, 30, 31, 55, -265, - -265, 32, -265, -4, -4, -4, 114, 1763, 33, -4, - 42, 43, -265, -265, 212, -265, -265, 49, -265, 51, - -265, -265, 57, -265, -265, -265, 1763, -265, -265, 49, - 58, 1693, -265, -94, -89, -265, -265, -265, -265, -265, - -265, -265, 66, 67, -265, -265, -265, -265, -265, -265, - 68, -265, -265, 72, -265, 75, 86, -265, -265, 87, - 89, 90, 92, 93, -265, 94, -265, 96, -265, 99, - -265, -265, 103, 109, -265, -265, -265, -265, -265, -265, - -265, -265, -265, 111, -265, -265, -265, -265, -265, 113, - -265, -265, -265, -265, -265, 115, -265, -265, -265, 116, - 117, 118, -265, 119, -265, -265, 120, 121, -72, -265, - -265, -265, 921, 405, 225, 149, 76, 123, -265, -265, - -265, -265, 114, 132, 134, -265, -265, -265, -265, 19, - -265, -265, -265, 151, 130, -265, -265, -265, -265, -265, - -265, -265, -265, -265, -265, -265, -265, 114, 114, -265, - 73, -85, -265, -265, -265, -4, -265, -265, -265, 141, - 154, -265, 146, -265, 114, 136, -265, 154, 95, 95, - 297, 298, 95, 95, 308, 311, 95, 314, 95, 95, - 258, 95, 95, -62, 95, 95, 95, 1763, 1763, 122, - 319, 1763, 1888, 158, -265, 156, -265, -265, -265, 159, - -265, -265, -265, -265, 30, -265, -265, -265, -265, -265, - -48, 179, -60, 161, 160, -265, -265, 500, 37, 162, - -265, 95, 446, 1091, -265, -265, -265, 170, 188, -265, - 171, -265, -45, -265, 189, -57, -43, 173, -265, -265, - -265, -265, -265, -265, -265, -265, 176, -265, 95, 95, - 95, 95, 95, 95, 785, 1386, -82, -265, 1386, 177, - 180, -265, -80, 182, 184, 185, 187, 190, 192, 195, - 1225, 345, 198, -79, -265, 1386, 199, 208, -77, 1268, - 201, 202, -265, -265, 203, 193, 204, 205, -265, 1888, - 370, -265, -265, 30, -12, -265, -265, 230, 1693, 210, - -40, 207, 304, 595, 30, -265, 1693, -265, -265, -265, - -265, 54, 214, -53, 213, -265, 239, -265, 1693, 114, - -265, 154, 95, -265, 1693, -265, 114, 215, -265, 218, - -265, 221, -265, 1763, 1, 1, 1, 1, 1, 1, - 1291, 240, 95, 95, 408, 95, 95, 95, 95, 95, - 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, - 95, 95, 410, 95, 95, -265, -265, -265, 406, -265, - -265, -265, -265, -265, -265, -265, -265, -265, 243, -265, - 95, -265, -265, 95, -265, -265, -265, -265, -265, 411, - -265, -265, -265, 245, -265, -265, -265, 114, -265, -265, - 1693, 248, -265, -265, 30, -265, -265, -265, -265, 1134, - 114, -265, -265, -265, 114, 250, -265, 154, -265, -265, - 249, -265, 95, 183, 183, -265, 534, 534, 153, 153, - 1493, 1416, 1336, 1439, 1462, 1509, 153, 153, 77, 77, - 1, 1, 1, -265, 1314, -265, -265, -265, -265, 251, - -265, 30, -265, 114, -265, 690, -265, -265, -265, -81, - -265, 252, -265, -265, 1, 95, -265, -265, -265, -265, - 30, -265, -265, 1386, -265, -11, 95, 273, -265, -265, - 275, -83, -83, -265, -265, 256, -265, -265 + -269, 42, 1015, -269, -269, -269, -269, -269, 82, -269, + -118, 125, -269, 127, -269, -269, -269, -269, -14, 88, + -269, -269, -269, 129, -14, -269, -70, -14, 253, -269, + -269, 131, -64, 134, 253, -269, -269, 1851, -269, -22, + -269, -269, -269, -269, -269, 1607, -21, -20, -269, -269, + -19, -58, -269, -17, -18, -10, -8, 5, -269, -269, + -4, -269, -5, -5, -5, 255, 1727, -7, -5, 28, + 30, -269, -269, 147, -269, -269, 20, -269, 26, -269, + -269, 43, -269, -269, -269, 1727, -269, -269, 20, 31, + 1684, -269, -96, -94, -269, -269, -269, -269, -269, -269, + -269, 41, 46, -269, -269, -269, -269, -269, -269, 50, + -269, -269, 53, -269, 56, 59, -269, -269, 63, 64, + 65, 67, 73, -269, 76, -269, 77, -269, 84, -269, + -269, 95, 96, -269, -269, -269, -269, -269, -269, -269, + -269, -269, 99, -269, -269, -269, -269, -269, 100, -269, + -269, -269, -269, -269, 103, -269, -269, -269, 111, 113, + 114, -269, 115, -269, -269, 116, 117, -93, -269, -269, + -269, 921, 404, 161, 136, 58, 119, -269, -269, -269, + -269, 255, 122, 123, -269, -269, -269, -269, -6, -269, + -269, -269, 139, 91, -269, -269, -269, -269, -269, -269, + -269, -269, -269, -269, -269, -269, 255, 255, -269, 128, + -129, -269, -269, -269, -5, -269, -269, -269, -15, 141, + -269, 130, -269, 255, 133, -269, 141, 85, 85, 296, + 297, 85, 85, 298, 304, 85, 307, 85, 85, 251, + 85, 85, -55, 85, 85, 85, 1727, 1727, 102, 317, + 1727, 1851, 156, -269, 154, -269, -269, -269, 157, -269, + -269, -269, -269, -10, -269, -269, -269, -269, -269, -66, + 179, -69, 159, 158, -269, -269, 498, 101, 160, -269, + 85, 867, 1109, -269, -269, -269, 163, 183, -269, 166, + -269, -56, -269, 188, -64, -54, 170, -269, -269, -269, + -269, -269, -269, -269, -269, 172, -269, 85, 85, 85, + 85, 85, 85, 780, 1402, -106, -269, 1402, 174, 175, + -269, -102, 176, 177, 178, 180, 181, 182, 184, 1189, + 340, 185, -90, -269, 1402, 190, 204, -82, 1242, 192, + 195, -269, -269, 198, 193, 199, 202, -269, 1851, 366, + -269, -269, -10, -12, -269, -269, 227, 1684, 208, -51, + 205, 301, 592, -10, -269, 1684, -269, -269, -269, -269, + 54, 212, -74, 211, -269, 238, -269, 1684, 255, -269, + 141, 85, -269, 1684, -269, 255, 214, -269, 217, -269, + 218, -269, 1727, 34, 34, 34, 34, 34, 34, 1292, + 219, 85, 85, 407, 85, 85, 85, 85, 85, 85, + 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, + 85, 409, 85, 85, -269, -269, -269, 405, -269, -269, + -269, -269, -269, -269, -269, -269, -269, 243, -269, 85, + -269, -269, 85, -269, -269, -269, -269, -269, 411, -269, + -269, -269, 246, -269, -269, -269, 255, -269, -269, 1684, + 249, -269, -269, -10, -269, -269, -269, -269, 1159, 255, + -269, -269, -269, 255, 250, -269, 141, -269, -269, 252, + -269, 85, 94, 94, -269, 1114, 1114, 153, 153, 1368, + 1439, 1349, 1420, 1462, 1496, 153, 153, 29, 29, 34, + 34, 34, -269, 1315, -269, -269, -269, -269, 256, -269, + -10, -269, 255, -269, 686, -269, -269, -269, -67, -269, + 248, -269, -269, 34, 85, -269, -269, -269, -269, -10, + -269, -269, 1402, -269, -16, 85, 273, -269, -269, 274, + -43, -43, -269, -269, 259, -269, -269 }; /* YYPGOTO[NTERM-NUM]. */ -static const short int yypgoto[] = +static const yytype_int16 yypgoto[] = { - -265, -265, -265, 385, -264, -257, 11, -265, -265, -265, - 69, -265, -265, -265, 428, -265, -265, -265, -37, -265, - -30, -2, -265, -265, -235, -265, -265, -265, -265, -265, - -265, 53, 2, 191, -255, -13, -265, -222, -208, -265, - -265, -265, -265, -105, -241, -265, -265, -265, 101, -199, - -265, 85, 78, 18, -265, 436, -265, -265, 393, -265, - -265, -265, -265, -265, -28, -265, 438, -1, -265, -265, - 441, -265, -265, 166, -265, -41, -35, -20, -198, -265, - -27, 264, 216, 6, -61, -265, 0, -265 + -269, -269, -269, 386, -268, -257, 8, -269, -269, -269, + 69, -269, -269, -269, 429, -269, -269, -269, -35, -269, + -27, -2, -269, -269, -230, -269, -269, -269, -269, -269, + -269, 55, 2, 194, -264, -13, -269, -221, -207, -269, + -269, -269, -269, -105, -245, -269, -269, -269, 92, -199, + -269, 60, 93, 23, -269, 435, -269, -269, 394, -269, + -269, -269, -269, -269, -30, -269, 440, 1, -269, -269, + 441, -269, -269, 168, -269, -44, 3, -31, -194, -269, + -26, 265, 206, 6, -57, -269, 0, -269 }; /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If @@ -1314,481 +1233,473 @@ static const short int yypgoto[] = number is the opposite. If zero, do what YYDEFACT says. If YYTABLE_NINF, syntax error. */ #define YYTABLE_NINF -215 -static const short int yytable[] = +static const yytype_int16 yytable[] = { - 46, 60, 71, 91, 47, 182, 215, 352, 68, 279, - 280, 324, 363, 39, 327, 404, 329, 348, 180, 332, - 51, 290, 337, 536, 323, 222, 293, 372, 297, 198, - 199, 359, 357, 7, 217, 537, 9, -214, 3, 11, - 200, 201, 225, 197, 197, 197, 184, 147, 177, 197, - 224, 151, 183, 74, 387, 391, 15, 298, 80, 299, - 300, 301, 302, 303, 178, 424, 386, 428, 440, 18, - 440, 82, 202, 370, 23, 252, 162, 9, 20, -214, - 368, 21, 22, 282, 226, 38, 283, 543, 24, 531, - 425, 404, 429, 441, -44, 444, 454, 253, 298, 203, - 299, 300, 301, 302, 303, 23, 88, 465, 38, 85, - 25, 38, 87, 95, 452, 304, 27, 200, 201, -44, - 38, 30, 31, 38, 271, 38, 353, 86, 38, 383, - 342, 388, 343, 90, 459, 94, 72, 73, 75, 76, - 204, 77, 78, 83, 84, 89, 78, 93, 78, 202, - 187, 305, 266, 267, 274, 275, 304, 200, 201, 189, - 473, 273, 171, 538, 205, 402, 403, 404, 422, 423, - 46, 46, 71, 71, 47, 47, 203, 306, 68, 68, - 285, 471, 290, 256, 256, 508, 340, 341, 476, 307, - 347, -29, 305, 185, 206, 197, 186, 404, 188, 515, - 190, 192, 505, -30, 193, 195, 308, 516, 207, 309, - 310, 311, 218, -31, 312, 313, 318, 204, 306, 318, - 219, 509, -214, 466, 220, 314, 330, 221, 265, 335, - 307, 223, 335, 339, 419, 420, 421, 227, 228, 229, - 354, 205, 379, 230, 422, 423, 231, 308, 281, 268, - 309, 310, 311, 401, 528, 312, 313, 232, 233, 512, - 234, 235, 384, 236, 237, 238, 314, 239, 318, 335, - 240, 206, 518, 534, 241, 366, 293, 71, 522, 47, - 242, 378, 243, 68, 244, 207, 245, 246, 247, 248, - 249, 250, 251, -32, 389, 394, 395, 396, 397, 398, - 399, 400, -33, 276, -34, 320, 321, 295, 417, 418, - 419, 420, 421, 286, 540, 529, 325, 457, 291, 326, - 422, 423, 328, 331, 345, 182, 349, 350, 356, 351, - 460, 361, 480, 362, 369, 381, 386, 470, 417, 418, - 419, 420, 421, 474, 380, 392, 382, 393, 438, 426, - 422, 423, 427, 455, 430, 443, 431, 432, 397, 433, - 449, 366, 434, 71, 435, 47, 184, 436, 177, 68, - 439, 442, 183, 446, 447, 448, 450, 451, 453, 456, - 458, 462, 19, 467, 475, 468, 469, 477, 478, 483, - 484, 479, 486, 487, 488, 489, 490, 491, 492, 493, - 494, 495, 496, 497, 498, 499, 500, 501, 502, 4, - 504, 485, 482, 503, 506, 507, 510, 511, 514, 513, - 520, 523, 541, 527, 542, 532, 547, 335, 379, 173, - 45, 463, 517, 5, 472, 6, 338, 546, 53, 179, - 59, 7, 8, 62, 367, 9, 269, 519, 0, 298, - 10, 299, 300, 301, 302, 303, 11, 0, 12, 336, - 0, 0, 13, 14, 0, 15, 0, 378, 16, 524, - 17, 0, 0, 0, 0, 0, 0, 18, 0, 0, - 0, 0, 0, 19, 255, 0, 0, 20, 0, 21, - 22, 23, 0, 0, 0, 0, 24, 0, 0, 0, - 0, 0, 0, 0, 4, 0, 0, 304, 0, 0, - 0, 0, 533, 366, 0, 71, 0, 47, 0, 25, - 0, 68, 0, 26, 27, 28, 29, 0, 5, 30, - 6, 31, 0, 0, 0, 32, 7, 0, 0, 0, - 9, 33, 34, 305, 35, 10, 402, 403, 404, 36, - 37, 407, 408, 12, 0, 0, 0, 13, 14, 0, - 15, 0, 0, 16, 0, 17, 0, 0, 0, 306, - 0, 0, 18, 38, 0, 0, 0, 0, 19, 264, - 0, 307, 20, 0, 21, 22, 0, 0, 0, 0, - 0, 24, 0, 0, 0, 0, 0, 0, 308, 4, - 0, 309, 310, 371, 0, 0, 312, 313, 0, 0, - 0, 0, 0, 0, 25, 0, 0, 314, 26, 27, - 28, 29, 0, 5, 30, 6, 31, 0, 0, 0, - 32, 7, 0, 0, 0, 9, 33, 34, 0, 35, - 10, 0, 0, 0, 36, 37, 0, 0, 12, 0, - 0, 0, 13, 14, 0, 15, 0, 0, 16, 0, - 17, 0, 0, 0, 0, 0, 0, 18, 38, 0, - 0, 0, 0, 19, 364, 0, 0, 20, 0, 21, - 22, 0, 0, 0, 0, 0, 24, 415, 416, 417, - 418, 419, 420, 421, 4, 0, 0, 0, 0, 0, - 0, 422, 423, 0, 0, 0, 0, 0, 0, 25, - 0, 0, 0, 26, 27, 28, 29, 0, 5, 30, - 6, 31, 0, 0, 0, 32, 7, 0, 0, 0, - 9, 33, 34, 0, 35, 10, 0, 0, 0, 36, - 37, 0, 0, 12, 0, 0, 0, 13, 14, 0, - 15, 0, 0, 16, 0, 17, 0, 0, 0, 0, - 0, 0, 18, 38, 0, 0, 0, 0, 19, 464, - 0, 0, 20, 0, 21, 22, 0, 0, 0, 0, - 0, 24, 0, 0, 0, 0, 0, 0, 298, 4, - 299, 300, 301, 302, 303, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 25, 0, 0, 0, 26, 27, - 28, 29, 0, 5, 30, 6, 31, 0, 0, 0, - 32, 7, 0, 0, 0, 0, 33, 34, 0, 35, - 0, 0, 0, 0, 36, 37, 0, 0, 12, 0, - 0, 0, 13, 14, 0, 0, 304, 0, 16, 0, - 17, 0, 0, 0, 0, 0, 0, 18, 38, 0, - 0, 0, 0, 0, 530, 0, 0, 0, 0, 21, - 22, 0, 0, 0, 0, 0, 24, 0, 0, 0, - 0, 0, 305, 0, 0, 0, 0, 0, 0, 0, + 45, 181, 70, 59, 46, 90, 351, 362, 67, 214, + 38, 323, 278, 279, 326, 179, 328, 371, 535, 331, + 289, 347, 336, 356, 322, 50, 358, 296, 221, 292, + 536, 196, 196, 196, -214, 9, 224, 196, 281, 11, + 423, 282, 3, 403, 427, 183, 223, 176, 403, 386, + 390, 182, 73, 251, 146, 15, 439, 297, 150, 298, + 299, 300, 301, 302, 439, 424, 197, 198, 177, 428, + 79, 216, -44, 369, 23, 252, -214, 20, 225, 385, + 23, 440, 161, 367, 84, 71, 72, 86, 297, 443, + 298, 299, 300, 301, 302, 453, 81, -44, 37, 270, + 85, 37, 530, 37, 199, 200, 464, 352, 403, 25, + 341, 37, 342, 37, 186, 303, 37, 382, 451, 387, + 30, 87, 458, 89, 37, 93, 542, 94, 74, 75, + 76, 77, 82, 83, 88, 77, 201, 92, 77, 265, + 266, 9, 273, 274, 199, 200, 303, 170, -29, 184, + 185, 304, 187, 192, 188, 218, 285, 537, 272, 189, + 472, 191, -30, 202, 264, 401, 402, 403, 194, 45, + 45, 70, 70, 46, 46, 507, 305, 67, 67, 255, + 255, 289, 304, 196, 470, 418, 419, 420, 306, 339, + 340, 475, -214, 346, 514, 421, 422, 217, 219, -31, + 421, 422, 504, 222, 203, 307, 515, 305, 308, 309, + 310, 226, 220, 311, 312, 317, 227, 284, 317, 306, + 228, 508, 465, 229, 313, 329, 230, 204, 334, 231, + 267, 334, 338, 232, 233, 234, 307, 235, 378, 308, + 309, 310, 353, 236, 311, 312, 237, 238, 416, 417, + 418, 419, 420, 527, 239, 313, 400, 205, 199, 200, + 421, 422, 511, 275, 383, 240, 241, 317, 334, 242, + 243, 206, 533, 244, 365, 517, 70, 521, 46, 292, + 377, 245, 67, 246, 247, 248, 249, 250, -32, 7, + 201, -33, -34, 388, 393, 394, 395, 396, 397, 398, + 399, 290, 280, 294, 319, 320, 324, 416, 417, 418, + 419, 420, 325, 456, 539, 327, 330, 202, 528, 421, + 422, 181, 344, 348, 349, 18, 350, 355, 360, 380, + 361, 368, 459, 469, 385, 479, 379, 21, 22, 473, + 381, 391, 392, 437, 24, 425, 426, 429, 430, 431, + 442, 432, 433, 434, 454, 435, 438, 396, 203, 448, + 365, 441, 70, 445, 46, 183, 446, 176, 67, 447, + 449, 182, 27, 450, 452, 455, 29, 457, 461, 19, + 466, 204, 467, 474, 468, 476, 477, 478, 482, 483, + 481, 485, 486, 487, 488, 489, 490, 491, 492, 493, + 494, 495, 496, 497, 498, 499, 500, 501, 4, 503, + 484, 205, 502, 505, 506, 512, 509, 510, 513, 519, + 531, 540, 541, 522, 378, 206, 334, 526, 546, 172, + 462, 44, 5, 516, 6, 471, 545, 52, 337, 178, + 7, 8, 58, 61, 9, 366, 268, 518, 335, 10, + 0, 0, 0, 0, 0, 11, 0, 12, 0, 0, + 0, 13, 14, 0, 15, 0, 377, 16, 523, 17, + 0, 0, 0, 0, 0, 0, 18, 0, 0, 0, + 0, 0, 19, 254, 0, 0, 20, 0, 21, 22, + 23, 0, 0, 0, 0, 24, 0, 0, 0, 0, + 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, + 0, 532, 365, 0, 70, 0, 46, 0, 25, 0, + 67, 0, 26, 27, 28, 0, 5, 29, 6, 30, + 0, 0, 0, 31, 7, 0, 0, 0, 9, 32, + 33, 0, 34, 10, 0, 0, 0, 35, 36, 0, + 0, 12, 0, 0, 0, 13, 14, 0, 15, 0, + 0, 16, 0, 17, 0, 0, 0, 0, 0, 0, + 18, 37, 0, 0, 0, 0, 19, 263, 0, 0, + 20, 0, 21, 22, 0, 0, 0, 0, 0, 24, + 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 26, 27, 28, 29, 0, 306, 30, - 0, 0, 0, 0, 0, 32, 0, 0, 0, 0, - 307, 0, 34, 0, 35, 4, 0, 0, 0, 36, - 37, 0, 254, 0, 0, 0, 0, 308, 0, 0, - 309, 310, 311, 0, 0, 312, 313, 0, 0, 5, - 0, 6, 0, 0, 0, 0, 314, 7, 8, 0, - 0, 9, 0, 0, 0, 0, 10, 0, 0, 0, - 0, 0, 11, 0, 12, 0, 0, 0, 13, 14, - 0, 15, 0, 0, 16, 0, 17, 0, 0, 0, - 0, 0, 0, 18, 0, 0, 0, 0, 0, 19, - 255, 0, 0, 20, 0, 21, 22, 23, 0, 0, - 0, 0, 24, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 25, 0, 0, 0, 26, 27, 28, 0, + 5, 29, 6, 30, 0, 0, 0, 31, 7, 0, + 0, 0, 9, 32, 33, 0, 34, 10, 0, 0, + 0, 35, 36, 0, 0, 12, 0, 0, 0, 13, + 14, 0, 15, 0, 0, 16, 0, 17, 0, 0, + 0, 0, 0, 0, 18, 37, 0, 0, 0, 0, + 19, 363, 0, 0, 20, 0, 21, 22, 0, 0, + 0, 0, 0, 24, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 25, 0, 0, 0, 26, - 27, 28, 29, 0, 5, 30, 6, 31, 0, 0, - 0, 32, 7, 8, 0, 0, 9, 33, 34, 0, - 35, 10, 0, 0, 0, 36, 37, 11, 0, 12, + 0, 0, 0, 0, 0, 0, 25, 0, 0, 0, + 26, 27, 28, 0, 5, 29, 6, 30, 0, 0, + 0, 31, 7, 0, 0, 0, 9, 32, 33, 0, + 34, 10, 0, 0, 0, 35, 36, 0, 0, 12, 0, 0, 0, 13, 14, 0, 15, 0, 0, 16, - 0, 17, 0, 0, 0, 0, 0, 0, 18, 38, - 0, 0, 0, 0, 19, 4, 0, 0, 20, 0, - 21, 22, 23, 0, 0, 0, 0, 24, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, - 0, 6, 0, 0, 0, 0, 0, 7, 0, 0, - 25, 9, 0, 0, 26, 27, 28, 29, 4, 0, - 30, 0, 31, 0, 12, 0, 32, 0, 13, 14, - 0, 15, 33, 34, 16, 35, 17, 0, 0, 0, - 36, 37, 5, 18, 6, 0, 0, 0, 0, 0, - 7, 0, 0, 20, 9, 21, 22, 0, 0, 0, - 0, 0, 24, 0, 38, 0, 0, 12, 0, 0, - 0, 13, 14, 0, 15, 0, 0, 16, 0, 17, - 0, 0, 0, 0, 0, 25, 18, 0, 0, 26, - 27, 28, 29, 0, 0, 30, 20, 31, 21, 22, - 0, 32, 0, 0, 0, 24, 0, 0, 34, 0, - 35, 0, 0, 0, 0, 373, 37, 402, 403, 404, - 405, 406, 407, 408, 409, 410, 0, 0, 25, 0, - 0, 0, 26, 27, 28, 29, 0, 0, 30, 38, - 31, 0, 0, 0, 32, 0, 0, 0, 0, 0, - 0, 34, 0, 35, 0, 0, 0, 0, 36, 37, - 402, 403, 404, 405, 406, 407, 408, 409, 410, 0, + 0, 17, 0, 0, 0, 0, 0, 0, 18, 37, + 0, 0, 0, 0, 19, 463, 0, 0, 20, 0, + 21, 22, 0, 0, 0, 0, 0, 24, 0, 0, + 0, 0, 0, 297, 4, 298, 299, 300, 301, 302, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 38, 402, 403, 404, 405, 406, 407, 408, - 409, 410, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 402, 403, 404, 405, - 406, 407, 408, 409, 410, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 402, 403, - 404, 405, 406, 407, 408, 409, 410, 0, 0, 0, + 25, 0, 0, 0, 26, 27, 28, 0, 5, 29, + 6, 30, 0, 0, 0, 31, 7, 0, 0, 0, + 0, 32, 33, 0, 34, 0, 0, 0, 0, 35, + 36, 0, 0, 12, 0, 0, 0, 13, 14, 0, + 0, 303, 0, 16, 0, 17, 0, 0, 0, 0, + 0, 0, 18, 37, 0, 0, 0, 0, 0, 529, + 0, 0, 0, 0, 21, 22, 0, 0, 0, 0, + 297, 24, 298, 299, 300, 301, 302, 304, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 411, 0, 412, 413, 414, 415, 416, - 417, 418, 419, 420, 421, 0, 0, 0, 0, 0, - 0, 0, 422, 423, 0, 0, 0, 437, 402, 403, - 404, 405, 406, 407, 408, 409, 410, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 411, 0, 412, 413, - 414, 415, 416, 417, 418, 419, 420, 421, 402, 403, - 404, 405, 406, 407, 408, 422, 423, 0, 0, 411, - 445, 412, 413, 414, 415, 416, 417, 418, 419, 420, - 421, 402, 403, 404, 405, 406, 407, 408, 422, 423, - 0, 0, 411, 481, 412, 413, 414, 415, 416, 417, - 418, 419, 420, 421, 402, 403, 404, 405, 406, 407, - 408, 422, 423, 526, 411, 525, 412, 413, 414, 415, - 416, 417, 418, 419, 420, 421, 0, 0, 0, 0, - 0, 0, 0, 422, 423, 402, 403, 404, 405, 406, - 407, 408, 0, 410, 0, 0, 0, 0, 0, 0, - 0, 402, 403, 404, 405, 406, 407, 408, 0, 0, - 0, 0, 0, 0, 411, 0, 412, 413, 414, 415, - 416, 417, 418, 419, 420, 421, 0, 0, 0, 0, - 0, 0, 0, 422, 423, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 412, 413, 414, 415, - 416, 417, 418, 419, 420, 421, 0, 0, 0, 0, - 0, 0, 0, 422, 423, 0, 0, 0, 0, 0, - 413, 414, 415, 416, 417, 418, 419, 420, 421, 0, - 0, 0, 0, 0, 0, 0, 422, 423, 0, 0, - 0, 0, 0, 0, 414, 415, 416, 417, 418, 419, - 420, 421, 0, 0, 0, 0, 0, 0, 0, 422, - 423, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 412, 413, 414, 415, 416, 417, 418, - 419, 420, 421, 0, 4, 0, 0, 0, 0, 0, - 422, 423, 415, 416, 417, 418, 419, 420, 421, 0, - 0, 0, 0, 0, 0, 0, 422, 423, 5, 0, - 6, 0, 0, 0, 0, 0, 7, 8, 0, 0, - 9, 0, 0, 0, 0, 0, 0, 4, 0, 0, - 0, 11, 0, 12, 0, 0, 0, 13, 14, 0, - 15, 0, 0, 16, 0, 17, 0, 0, 0, 0, - 0, 5, 18, 6, 0, 0, 0, 0, 0, 7, - 0, 0, 20, 9, 21, 22, 23, 0, 0, 174, - 0, 24, 0, 175, 0, 0, 12, 0, 0, 0, - 13, 14, 0, 15, 0, 0, 16, 0, 17, 0, - 0, 0, 0, 0, 25, 18, 0, 4, 26, 27, - 28, 29, 0, 0, 30, 20, 31, 21, 22, 0, - 32, 0, 0, 0, 24, 0, 0, 34, 0, 35, - 0, 5, 0, 6, 36, 37, 0, 0, 0, 7, - 0, 0, 0, 0, 0, 0, 0, 25, 0, 0, - 0, 26, 27, 28, 29, 0, 12, 30, 0, 31, - 13, 14, 0, 32, 0, 0, 16, 0, 17, 0, - 34, 0, 35, 0, 0, 18, 0, 36, 37, 0, - 0, 0, 0, 0, 0, 0, 0, 21, 22, 0, - 0, 0, 0, 0, 24, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 26, 27, + 28, 0, 305, 29, 0, 0, 0, 0, 0, 31, + 0, 0, 0, 0, 306, 0, 33, 0, 34, 0, + 0, 0, 0, 35, 36, 4, 0, 0, 303, 0, + 0, 307, 253, 0, 308, 309, 310, 0, 0, 311, + 312, 0, 0, 0, 0, 0, 0, 0, 0, 5, + 313, 6, 0, 0, 0, 0, 0, 7, 8, 0, + 0, 9, 0, 0, 304, 0, 10, 0, 0, 0, + 0, 0, 11, 0, 12, 0, 0, 0, 13, 14, + 0, 15, 0, 0, 16, 0, 17, 0, 0, 305, + 0, 0, 0, 18, 0, 0, 0, 0, 0, 19, + 254, 306, 0, 20, 0, 21, 22, 23, 0, 0, + 0, 0, 24, 0, 0, 0, 0, 0, 307, 4, + 0, 308, 309, 370, 0, 0, 311, 312, 0, 0, + 0, 0, 0, 0, 0, 25, 0, 313, 0, 26, + 27, 28, 0, 5, 29, 6, 30, 0, 0, 0, + 31, 7, 8, 0, 0, 9, 32, 33, 0, 34, + 10, 0, 0, 0, 35, 36, 11, 0, 12, 0, + 0, 0, 13, 14, 0, 15, 0, 0, 16, 0, + 17, 0, 0, 0, 0, 0, 0, 18, 37, 0, + 0, 0, 0, 19, 0, 0, 0, 20, 0, 21, + 22, 23, 0, 0, 0, 0, 24, 0, 0, 0, + 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 401, 402, 403, 25, + 0, 406, 407, 26, 27, 28, 0, 5, 29, 6, + 30, 0, 0, 0, 31, 7, 0, 0, 0, 9, + 32, 33, 0, 34, 0, 0, 0, 0, 35, 36, + 0, 0, 12, 4, 0, 0, 13, 14, 0, 15, + 0, 0, 16, 0, 17, 0, 0, 0, 0, 0, + 0, 18, 37, 0, 0, 0, 0, 5, 0, 6, + 0, 20, 0, 21, 22, 7, 0, 0, 0, 9, + 24, 401, 402, 403, 404, 405, 406, 407, 408, 409, + 0, 0, 12, 0, 0, 0, 13, 14, 0, 15, + 0, 0, 16, 25, 17, 0, 0, 26, 27, 28, + 0, 18, 29, 0, 30, 0, 0, 0, 31, 0, + 0, 20, 0, 21, 22, 33, 0, 34, 0, 0, + 24, 0, 372, 36, 401, 402, 403, 404, 405, 406, + 407, 408, 409, 0, 0, 0, 414, 415, 416, 417, + 418, 419, 420, 25, 0, 0, 37, 26, 27, 28, + 421, 422, 29, 0, 30, 0, 0, 0, 31, 0, + 0, 0, 0, 0, 0, 33, 0, 34, 0, 0, + 0, 0, 35, 36, 401, 402, 403, 404, 405, 406, + 407, 408, 409, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 37, 401, 402, 403, + 404, 405, 406, 407, 408, 409, 410, 0, 411, 412, + 413, 414, 415, 416, 417, 418, 419, 420, 0, 0, + 0, 0, 0, 0, 0, 421, 422, 0, 0, 0, + 436, 401, 402, 403, 404, 405, 406, 407, 408, 409, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 401, 402, 403, 404, 405, 406, 407, 0, 409, 410, + 0, 411, 412, 413, 414, 415, 416, 417, 418, 419, + 420, 0, 0, 0, 0, 0, 0, 0, 421, 422, + 0, 0, 0, 444, 401, 402, 403, 404, 405, 406, + 407, 408, 409, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 401, 402, 403, 404, 405, 406, 407, 410, + 0, 411, 412, 413, 414, 415, 416, 417, 418, 419, + 420, 401, 402, 403, 404, 405, 406, 407, 421, 422, + 0, 0, 410, 480, 411, 412, 413, 414, 415, 416, + 417, 418, 419, 420, 401, 402, 403, 404, 405, 406, + 407, 421, 422, 525, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 410, 524, 411, 412, + 413, 414, 415, 416, 417, 418, 419, 420, 401, 402, + 403, 404, 405, 406, 407, 421, 422, 411, 412, 413, + 414, 415, 416, 417, 418, 419, 420, 0, 0, 0, + 0, 0, 0, 0, 421, 422, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 410, + 0, 411, 412, 413, 414, 415, 416, 417, 418, 419, + 420, 0, 0, 0, 0, 0, 0, 0, 421, 422, + 412, 413, 414, 415, 416, 417, 418, 419, 420, 0, + 0, 0, 0, 0, 0, 0, 421, 422, 411, 412, + 413, 414, 415, 416, 417, 418, 419, 420, 0, 0, + 0, 0, 0, 0, 0, 421, 422, 0, 0, 0, + 0, 4, 0, 413, 414, 415, 416, 417, 418, 419, + 420, 0, 0, 0, 0, 0, 0, 0, 421, 422, + 0, 0, 0, 0, 0, 5, 0, 6, 0, 0, + 0, 0, 0, 7, 8, 0, 0, 9, 414, 415, + 416, 417, 418, 419, 420, 0, 0, 0, 11, 0, + 12, 0, 421, 422, 13, 14, 0, 15, 0, 0, + 16, 0, 17, 0, 0, 0, 0, 0, 0, 18, + 0, 0, 0, 0, 0, 0, 0, 0, 4, 20, + 0, 21, 22, 23, 0, 0, 173, 0, 24, 0, + 174, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 5, 0, 6, 0, 0, 0, 0, 0, + 7, 25, 0, 0, 9, 26, 27, 28, 0, 0, + 29, 4, 30, 0, 0, 0, 31, 12, 0, 0, + 0, 13, 14, 33, 15, 34, 0, 16, 0, 17, + 35, 36, 0, 0, 0, 5, 18, 6, 0, 0, + 0, 0, 0, 7, 0, 0, 20, 0, 21, 22, + 0, 0, 0, 0, 0, 24, 0, 0, 0, 0, + 12, 0, 0, 0, 13, 14, 0, 0, 0, 0, + 16, 0, 17, 0, 0, 0, 0, 0, 25, 18, + 0, 0, 26, 27, 28, 0, 0, 29, 0, 30, + 0, 21, 22, 31, 0, 0, 0, 0, 24, 0, + 33, 0, 34, 0, 0, 0, 0, 35, 36, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 26, 27, 28, 29, 0, 0, 30, 0, 0, - 0, 0, 0, 32, 0, 0, 0, 0, 0, 0, - 34, 0, 35, 0, 0, 0, 0, 36, 37, 96, - 0, 97, 98, 0, 99, 100, 0, 101, 0, 0, - 102, 0, 103, 0, 0, 0, 0, 0, 0, 104, - 105, 106, 107, 0, 108, 109, 110, 111, 112, 0, - 113, 0, 114, 115, 116, 0, 0, 117, 0, 0, - 0, 0, 118, 0, 119, 120, 121, 122, 123, 124, - 0, 125, 126, 127, 128, 129, 0, 0, 130, 0, - 0, 131, 0, 0, 0, 132, 133, 0, 134, 0, - 0, 0, 135, 136, 137, 0, 138, 139, 140, 141, - 142, 0, 143, 0, 144, 145, 146, 147, 148, 149, - 150, 151, 0, 152, 153, 154, 0, 0, 0, 0, - 155, 0, 0, 156, 0, 0, 157, 158, 0, 0, - 159, 160, 161, 0, 0, 0, 162, 0, 163, 164, - 165, 166, 0, 0, 167 + 0, 0, 0, 0, 0, 26, 27, 28, 0, 0, + 29, 0, 0, 0, 0, 0, 31, 0, 0, 0, + 0, 0, 0, 33, 0, 34, 0, 0, 0, 0, + 35, 36, 95, 0, 96, 97, 0, 98, 99, 0, + 100, 0, 0, 101, 0, 102, 0, 0, 0, 0, + 0, 0, 103, 104, 105, 106, 0, 107, 108, 109, + 110, 111, 0, 112, 0, 113, 114, 115, 0, 0, + 116, 0, 0, 0, 0, 117, 0, 118, 119, 120, + 121, 122, 123, 0, 124, 125, 126, 127, 128, 0, + 0, 129, 0, 0, 130, 0, 0, 0, 131, 132, + 0, 133, 0, 0, 0, 134, 135, 136, 0, 137, + 138, 139, 140, 141, 0, 142, 0, 143, 144, 145, + 146, 147, 148, 149, 150, 0, 151, 152, 153, 0, + 0, 0, 154, 0, 0, 155, 0, 0, 156, 157, + 0, 0, 158, 159, 160, 0, 0, 0, 161, 0, + 162, 163, 164, 165, 0, 0, 166 }; -static const short int yycheck[] = +static const yytype_int16 yycheck[] = { - 2, 2, 2, 33, 2, 46, 67, 264, 2, 207, - 208, 233, 276, 2, 236, 14, 238, 252, 46, 241, - 2, 220, 244, 34, 232, 86, 224, 282, 227, 64, - 65, 272, 92, 36, 69, 46, 40, 131, 0, 51, - 3, 4, 131, 63, 64, 65, 46, 109, 46, 69, - 91, 113, 46, 171, 295, 296, 60, 3, 84, 5, - 6, 7, 8, 9, 46, 147, 147, 147, 147, 72, - 147, 8, 35, 281, 86, 147, 138, 40, 82, 173, - 278, 84, 85, 168, 173, 168, 171, 170, 91, 170, - 172, 14, 172, 172, 147, 172, 353, 169, 3, 62, - 5, 6, 7, 8, 9, 86, 28, 364, 168, 24, - 114, 168, 27, 35, 349, 61, 119, 3, 4, 172, - 168, 124, 126, 168, 105, 168, 174, 171, 168, 174, - 8, 174, 10, 32, 174, 34, 3, 4, 3, 4, - 103, 3, 4, 3, 4, 3, 4, 3, 4, 35, - 173, 97, 3, 4, 3, 4, 61, 3, 4, 173, - 382, 189, 170, 174, 127, 12, 13, 14, 167, 168, - 172, 173, 172, 173, 172, 173, 62, 123, 172, 173, - 215, 379, 381, 172, 173, 440, 247, 248, 386, 135, - 251, 170, 97, 170, 157, 215, 170, 14, 170, 463, - 170, 170, 424, 170, 149, 173, 152, 464, 171, 155, - 156, 157, 170, 170, 160, 161, 229, 103, 123, 232, - 8, 443, 173, 169, 173, 171, 239, 170, 3, 242, - 135, 173, 245, 246, 157, 158, 159, 171, 171, 171, - 270, 127, 283, 171, 167, 168, 171, 152, 175, 173, - 155, 156, 157, 314, 511, 160, 161, 171, 171, 457, - 171, 171, 292, 171, 171, 171, 171, 171, 281, 282, - 171, 157, 470, 530, 171, 277, 474, 277, 477, 277, - 171, 283, 171, 277, 171, 171, 171, 171, 171, 171, - 171, 171, 171, 170, 296, 308, 309, 310, 311, 312, - 313, 314, 170, 173, 170, 8, 8, 171, 155, 156, - 157, 158, 159, 172, 536, 513, 8, 358, 172, 8, - 167, 168, 8, 65, 5, 366, 168, 171, 149, 170, - 360, 170, 393, 173, 172, 147, 147, 378, 155, 156, - 157, 158, 159, 384, 174, 172, 175, 171, 3, 172, - 167, 168, 172, 354, 172, 147, 172, 172, 371, 172, - 167, 363, 172, 363, 172, 363, 366, 172, 366, 363, - 172, 172, 366, 172, 172, 172, 172, 172, 8, 149, - 170, 174, 78, 169, 384, 172, 147, 172, 170, 402, - 403, 170, 405, 406, 407, 408, 409, 410, 411, 412, - 413, 414, 415, 416, 417, 418, 419, 420, 421, 4, - 423, 3, 172, 3, 8, 172, 5, 172, 170, 460, - 170, 172, 149, 172, 149, 173, 170, 440, 469, 44, - 2, 362, 469, 28, 381, 30, 245, 542, 2, 46, - 2, 36, 37, 2, 278, 40, 182, 474, -1, 3, - 45, 5, 6, 7, 8, 9, 51, -1, 53, 243, - -1, -1, 57, 58, -1, 60, -1, 469, 63, 482, - 65, -1, -1, -1, -1, -1, -1, 72, -1, -1, - -1, -1, -1, 78, 79, -1, -1, 82, -1, 84, - 85, 86, -1, -1, -1, -1, 91, -1, -1, -1, - -1, -1, -1, -1, 4, -1, -1, 61, -1, -1, - -1, -1, 525, 515, -1, 515, -1, 515, -1, 114, - -1, 515, -1, 118, 119, 120, 121, -1, 28, 124, - 30, 126, -1, -1, -1, 130, 36, -1, -1, -1, - 40, 136, 137, 97, 139, 45, 12, 13, 14, 144, - 145, 17, 18, 53, -1, -1, -1, 57, 58, -1, - 60, -1, -1, 63, -1, 65, -1, -1, -1, 123, - -1, -1, 72, 168, -1, -1, -1, -1, 78, 174, - -1, 135, 82, -1, 84, 85, -1, -1, -1, -1, - -1, 91, -1, -1, -1, -1, -1, -1, 152, 4, - -1, 155, 156, 157, -1, -1, 160, 161, -1, -1, - -1, -1, -1, -1, 114, -1, -1, 171, 118, 119, - 120, 121, -1, 28, 124, 30, 126, -1, -1, -1, - 130, 36, -1, -1, -1, 40, 136, 137, -1, 139, - 45, -1, -1, -1, 144, 145, -1, -1, 53, -1, - -1, -1, 57, 58, -1, 60, -1, -1, 63, -1, - 65, -1, -1, -1, -1, -1, -1, 72, 168, -1, - -1, -1, -1, 78, 174, -1, -1, 82, -1, 84, - 85, -1, -1, -1, -1, -1, 91, 153, 154, 155, - 156, 157, 158, 159, 4, -1, -1, -1, -1, -1, - -1, 167, 168, -1, -1, -1, -1, -1, -1, 114, - -1, -1, -1, 118, 119, 120, 121, -1, 28, 124, - 30, 126, -1, -1, -1, 130, 36, -1, -1, -1, - 40, 136, 137, -1, 139, 45, -1, -1, -1, 144, - 145, -1, -1, 53, -1, -1, -1, 57, 58, -1, - 60, -1, -1, 63, -1, 65, -1, -1, -1, -1, - -1, -1, 72, 168, -1, -1, -1, -1, 78, 174, - -1, -1, 82, -1, 84, 85, -1, -1, -1, -1, - -1, 91, -1, -1, -1, -1, -1, -1, 3, 4, - 5, 6, 7, 8, 9, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 114, -1, -1, -1, 118, 119, - 120, 121, -1, 28, 124, 30, 126, -1, -1, -1, - 130, 36, -1, -1, -1, -1, 136, 137, -1, 139, - -1, -1, -1, -1, 144, 145, -1, -1, 53, -1, - -1, -1, 57, 58, -1, -1, 61, -1, 63, -1, - 65, -1, -1, -1, -1, -1, -1, 72, 168, -1, - -1, -1, -1, -1, 174, -1, -1, -1, -1, 84, - 85, -1, -1, -1, -1, -1, 91, -1, -1, -1, - -1, -1, 97, -1, -1, -1, -1, -1, -1, -1, + 2, 45, 2, 2, 2, 32, 263, 275, 2, 66, + 2, 232, 206, 207, 235, 45, 237, 281, 34, 240, + 219, 251, 243, 92, 231, 2, 271, 226, 85, 223, + 46, 62, 63, 64, 130, 40, 130, 68, 167, 51, + 146, 170, 0, 14, 146, 45, 90, 45, 14, 294, + 295, 45, 170, 146, 109, 60, 146, 3, 113, 5, + 6, 7, 8, 9, 146, 171, 63, 64, 45, 171, + 84, 68, 146, 280, 86, 168, 172, 82, 172, 146, + 86, 171, 137, 277, 24, 3, 4, 27, 3, 171, + 5, 6, 7, 8, 9, 352, 8, 171, 167, 105, + 170, 167, 169, 167, 3, 4, 363, 173, 14, 114, + 8, 167, 10, 167, 172, 61, 167, 173, 348, 173, + 125, 28, 173, 31, 167, 33, 169, 34, 3, 4, + 3, 4, 3, 4, 3, 4, 35, 3, 4, 3, + 4, 40, 3, 4, 3, 4, 61, 169, 169, 169, + 169, 97, 169, 148, 172, 8, 171, 173, 188, 169, + 381, 169, 169, 62, 3, 12, 13, 14, 172, 171, + 172, 171, 172, 171, 172, 439, 122, 171, 172, 171, + 172, 380, 97, 214, 378, 156, 157, 158, 134, 246, + 247, 385, 172, 250, 462, 166, 167, 169, 172, 169, + 166, 167, 423, 172, 103, 151, 463, 122, 154, 155, + 156, 170, 169, 159, 160, 228, 170, 214, 231, 134, + 170, 442, 168, 170, 170, 238, 170, 126, 241, 170, + 172, 244, 245, 170, 170, 170, 151, 170, 282, 154, + 155, 156, 269, 170, 159, 160, 170, 170, 154, 155, + 156, 157, 158, 510, 170, 170, 313, 156, 3, 4, + 166, 167, 456, 172, 291, 170, 170, 280, 281, 170, + 170, 170, 529, 170, 276, 469, 276, 476, 276, 473, + 282, 170, 276, 170, 170, 170, 170, 170, 169, 36, + 35, 169, 169, 295, 307, 308, 309, 310, 311, 312, + 313, 171, 174, 170, 8, 8, 8, 154, 155, 156, + 157, 158, 8, 357, 535, 8, 65, 62, 512, 166, + 167, 365, 5, 167, 170, 72, 169, 148, 169, 146, + 172, 171, 359, 377, 146, 392, 173, 84, 85, 383, + 174, 171, 170, 3, 91, 171, 171, 171, 171, 171, + 146, 171, 171, 171, 353, 171, 171, 370, 103, 166, + 362, 171, 362, 171, 362, 365, 171, 365, 362, 171, + 171, 365, 119, 171, 8, 148, 123, 169, 173, 78, + 168, 126, 171, 383, 146, 171, 169, 169, 401, 402, + 171, 404, 405, 406, 407, 408, 409, 410, 411, 412, + 413, 414, 415, 416, 417, 418, 419, 420, 4, 422, + 3, 156, 3, 8, 171, 459, 5, 171, 169, 169, + 172, 148, 148, 171, 468, 170, 439, 171, 169, 43, + 361, 2, 28, 468, 30, 380, 541, 2, 244, 45, + 36, 37, 2, 2, 40, 277, 181, 473, 242, 45, + -1, -1, -1, -1, -1, 51, -1, 53, -1, -1, + -1, 57, 58, -1, 60, -1, 468, 63, 481, 65, + -1, -1, -1, -1, -1, -1, 72, -1, -1, -1, + -1, -1, 78, 79, -1, -1, 82, -1, 84, 85, + 86, -1, -1, -1, -1, 91, -1, -1, -1, -1, + -1, -1, 4, -1, -1, -1, -1, -1, -1, -1, + -1, 524, 514, -1, 514, -1, 514, -1, 114, -1, + 514, -1, 118, 119, 120, -1, 28, 123, 30, 125, + -1, -1, -1, 129, 36, -1, -1, -1, 40, 135, + 136, -1, 138, 45, -1, -1, -1, 143, 144, -1, + -1, 53, -1, -1, -1, 57, 58, -1, 60, -1, + -1, 63, -1, 65, -1, -1, -1, -1, -1, -1, + 72, 167, -1, -1, -1, -1, 78, 173, -1, -1, + 82, -1, 84, 85, -1, -1, -1, -1, -1, 91, + -1, -1, -1, -1, -1, -1, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 118, 119, 120, 121, -1, 123, 124, - -1, -1, -1, -1, -1, 130, -1, -1, -1, -1, - 135, -1, 137, -1, 139, 4, -1, -1, -1, 144, - 145, -1, 11, -1, -1, -1, -1, 152, -1, -1, - 155, 156, 157, -1, -1, 160, 161, -1, -1, 28, - -1, 30, -1, -1, -1, -1, 171, 36, 37, -1, - -1, 40, -1, -1, -1, -1, 45, -1, -1, -1, - -1, -1, 51, -1, 53, -1, -1, -1, 57, 58, - -1, 60, -1, -1, 63, -1, 65, -1, -1, -1, - -1, -1, -1, 72, -1, -1, -1, -1, -1, 78, - 79, -1, -1, 82, -1, 84, 85, 86, -1, -1, - -1, -1, 91, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 114, -1, -1, -1, 118, 119, 120, -1, + 28, 123, 30, 125, -1, -1, -1, 129, 36, -1, + -1, -1, 40, 135, 136, -1, 138, 45, -1, -1, + -1, 143, 144, -1, -1, 53, -1, -1, -1, 57, + 58, -1, 60, -1, -1, 63, -1, 65, -1, -1, + -1, -1, -1, -1, 72, 167, -1, -1, -1, -1, + 78, 173, -1, -1, 82, -1, 84, 85, -1, -1, + -1, -1, -1, 91, -1, -1, -1, -1, -1, -1, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 114, -1, -1, -1, 118, - 119, 120, 121, -1, 28, 124, 30, 126, -1, -1, - -1, 130, 36, 37, -1, -1, 40, 136, 137, -1, - 139, 45, -1, -1, -1, 144, 145, 51, -1, 53, + -1, -1, -1, -1, -1, -1, 114, -1, -1, -1, + 118, 119, 120, -1, 28, 123, 30, 125, -1, -1, + -1, 129, 36, -1, -1, -1, 40, 135, 136, -1, + 138, 45, -1, -1, -1, 143, 144, -1, -1, 53, -1, -1, -1, 57, 58, -1, 60, -1, -1, 63, - -1, 65, -1, -1, -1, -1, -1, -1, 72, 168, - -1, -1, -1, -1, 78, 4, -1, -1, 82, -1, - 84, 85, 86, -1, -1, -1, -1, 91, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 28, - -1, 30, -1, -1, -1, -1, -1, 36, -1, -1, - 114, 40, -1, -1, 118, 119, 120, 121, 4, -1, - 124, -1, 126, -1, 53, -1, 130, -1, 57, 58, - -1, 60, 136, 137, 63, 139, 65, -1, -1, -1, - 144, 145, 28, 72, 30, -1, -1, -1, -1, -1, - 36, -1, -1, 82, 40, 84, 85, -1, -1, -1, - -1, -1, 91, -1, 168, -1, -1, 53, -1, -1, - -1, 57, 58, -1, 60, -1, -1, 63, -1, 65, - -1, -1, -1, -1, -1, 114, 72, -1, -1, 118, - 119, 120, 121, -1, -1, 124, 82, 126, 84, 85, - -1, 130, -1, -1, -1, 91, -1, -1, 137, -1, - 139, -1, -1, -1, -1, 144, 145, 12, 13, 14, - 15, 16, 17, 18, 19, 20, -1, -1, 114, -1, - -1, -1, 118, 119, 120, 121, -1, -1, 124, 168, - 126, -1, -1, -1, 130, -1, -1, -1, -1, -1, - -1, 137, -1, 139, -1, -1, -1, -1, 144, 145, - 12, 13, 14, 15, 16, 17, 18, 19, 20, -1, + -1, 65, -1, -1, -1, -1, -1, -1, 72, 167, + -1, -1, -1, -1, 78, 173, -1, -1, 82, -1, + 84, 85, -1, -1, -1, -1, -1, 91, -1, -1, + -1, -1, -1, 3, 4, 5, 6, 7, 8, 9, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 168, 12, 13, 14, 15, 16, 17, 18, - 19, 20, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 12, 13, 14, 15, - 16, 17, 18, 19, 20, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 12, 13, - 14, 15, 16, 17, 18, 19, 20, -1, -1, -1, + 114, -1, -1, -1, 118, 119, 120, -1, 28, 123, + 30, 125, -1, -1, -1, 129, 36, -1, -1, -1, + -1, 135, 136, -1, 138, -1, -1, -1, -1, 143, + 144, -1, -1, 53, -1, -1, -1, 57, 58, -1, + -1, 61, -1, 63, -1, 65, -1, -1, -1, -1, + -1, -1, 72, 167, -1, -1, -1, -1, -1, 173, + -1, -1, -1, -1, 84, 85, -1, -1, -1, -1, + 3, 91, 5, 6, 7, 8, 9, 97, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 148, -1, 150, 151, 152, 153, 154, - 155, 156, 157, 158, 159, -1, -1, -1, -1, -1, - -1, -1, 167, 168, -1, -1, -1, 172, 12, 13, - 14, 15, 16, 17, 18, 19, 20, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 148, -1, 150, 151, - 152, 153, 154, 155, 156, 157, 158, 159, 12, 13, - 14, 15, 16, 17, 18, 167, 168, -1, -1, 148, - 172, 150, 151, 152, 153, 154, 155, 156, 157, 158, - 159, 12, 13, 14, 15, 16, 17, 18, 167, 168, - -1, -1, 148, 172, 150, 151, 152, 153, 154, 155, - 156, 157, 158, 159, 12, 13, 14, 15, 16, 17, - 18, 167, 168, 169, 148, 149, 150, 151, 152, 153, - 154, 155, 156, 157, 158, 159, -1, -1, -1, -1, - -1, -1, -1, 167, 168, 12, 13, 14, 15, 16, - 17, 18, -1, 20, -1, -1, -1, -1, -1, -1, - -1, 12, 13, 14, 15, 16, 17, 18, -1, -1, - -1, -1, -1, -1, 148, -1, 150, 151, 152, 153, - 154, 155, 156, 157, 158, 159, -1, -1, -1, -1, - -1, -1, -1, 167, 168, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 150, 151, 152, 153, - 154, 155, 156, 157, 158, 159, -1, -1, -1, -1, - -1, -1, -1, 167, 168, -1, -1, -1, -1, -1, - 151, 152, 153, 154, 155, 156, 157, 158, 159, -1, - -1, -1, -1, -1, -1, -1, 167, 168, -1, -1, - -1, -1, -1, -1, 152, 153, 154, 155, 156, 157, - 158, 159, -1, -1, -1, -1, -1, -1, -1, 167, - 168, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 150, 151, 152, 153, 154, 155, 156, - 157, 158, 159, -1, 4, -1, -1, -1, -1, -1, - 167, 168, 153, 154, 155, 156, 157, 158, 159, -1, - -1, -1, -1, -1, -1, -1, 167, 168, 28, -1, - 30, -1, -1, -1, -1, -1, 36, 37, -1, -1, - 40, -1, -1, -1, -1, -1, -1, 4, -1, -1, - -1, 51, -1, 53, -1, -1, -1, 57, 58, -1, - 60, -1, -1, 63, -1, 65, -1, -1, -1, -1, - -1, 28, 72, 30, -1, -1, -1, -1, -1, 36, - -1, -1, 82, 40, 84, 85, 86, -1, -1, 89, - -1, 91, -1, 93, -1, -1, 53, -1, -1, -1, - 57, 58, -1, 60, -1, -1, 63, -1, 65, -1, - -1, -1, -1, -1, 114, 72, -1, 4, 118, 119, - 120, 121, -1, -1, 124, 82, 126, 84, 85, -1, - 130, -1, -1, -1, 91, -1, -1, 137, -1, 139, - -1, 28, -1, 30, 144, 145, -1, -1, -1, 36, - -1, -1, -1, -1, -1, -1, -1, 114, -1, -1, - -1, 118, 119, 120, 121, -1, 53, 124, -1, 126, - 57, 58, -1, 130, -1, -1, 63, -1, 65, -1, - 137, -1, 139, -1, -1, 72, -1, 144, 145, -1, - -1, -1, -1, -1, -1, -1, -1, 84, 85, -1, - -1, -1, -1, -1, 91, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 118, 119, + 120, -1, 122, 123, -1, -1, -1, -1, -1, 129, + -1, -1, -1, -1, 134, -1, 136, -1, 138, -1, + -1, -1, -1, 143, 144, 4, -1, -1, 61, -1, + -1, 151, 11, -1, 154, 155, 156, -1, -1, 159, + 160, -1, -1, -1, -1, -1, -1, -1, -1, 28, + 170, 30, -1, -1, -1, -1, -1, 36, 37, -1, + -1, 40, -1, -1, 97, -1, 45, -1, -1, -1, + -1, -1, 51, -1, 53, -1, -1, -1, 57, 58, + -1, 60, -1, -1, 63, -1, 65, -1, -1, 122, + -1, -1, -1, 72, -1, -1, -1, -1, -1, 78, + 79, 134, -1, 82, -1, 84, 85, 86, -1, -1, + -1, -1, 91, -1, -1, -1, -1, -1, 151, 4, + -1, 154, 155, 156, -1, -1, 159, 160, -1, -1, + -1, -1, -1, -1, -1, 114, -1, 170, -1, 118, + 119, 120, -1, 28, 123, 30, 125, -1, -1, -1, + 129, 36, 37, -1, -1, 40, 135, 136, -1, 138, + 45, -1, -1, -1, 143, 144, 51, -1, 53, -1, + -1, -1, 57, 58, -1, 60, -1, -1, 63, -1, + 65, -1, -1, -1, -1, -1, -1, 72, 167, -1, + -1, -1, -1, 78, -1, -1, -1, 82, -1, 84, + 85, 86, -1, -1, -1, -1, 91, -1, -1, -1, + -1, -1, -1, 4, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 12, 13, 14, 114, + -1, 17, 18, 118, 119, 120, -1, 28, 123, 30, + 125, -1, -1, -1, 129, 36, -1, -1, -1, 40, + 135, 136, -1, 138, -1, -1, -1, -1, 143, 144, + -1, -1, 53, 4, -1, -1, 57, 58, -1, 60, + -1, -1, 63, -1, 65, -1, -1, -1, -1, -1, + -1, 72, 167, -1, -1, -1, -1, 28, -1, 30, + -1, 82, -1, 84, 85, 36, -1, -1, -1, 40, + 91, 12, 13, 14, 15, 16, 17, 18, 19, 20, + -1, -1, 53, -1, -1, -1, 57, 58, -1, 60, + -1, -1, 63, 114, 65, -1, -1, 118, 119, 120, + -1, 72, 123, -1, 125, -1, -1, -1, 129, -1, + -1, 82, -1, 84, 85, 136, -1, 138, -1, -1, + 91, -1, 143, 144, 12, 13, 14, 15, 16, 17, + 18, 19, 20, -1, -1, -1, 152, 153, 154, 155, + 156, 157, 158, 114, -1, -1, 167, 118, 119, 120, + 166, 167, 123, -1, 125, -1, -1, -1, 129, -1, + -1, -1, -1, -1, -1, 136, -1, 138, -1, -1, + -1, -1, 143, 144, 12, 13, 14, 15, 16, 17, + 18, 19, 20, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 167, 12, 13, 14, + 15, 16, 17, 18, 19, 20, 147, -1, 149, 150, + 151, 152, 153, 154, 155, 156, 157, 158, -1, -1, + -1, -1, -1, -1, -1, 166, 167, -1, -1, -1, + 171, 12, 13, 14, 15, 16, 17, 18, 19, 20, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 12, 13, 14, 15, 16, 17, 18, -1, 20, 147, + -1, 149, 150, 151, 152, 153, 154, 155, 156, 157, + 158, -1, -1, -1, -1, -1, -1, -1, 166, 167, + -1, -1, -1, 171, 12, 13, 14, 15, 16, 17, + 18, 19, 20, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 12, 13, 14, 15, 16, 17, 18, 147, + -1, 149, 150, 151, 152, 153, 154, 155, 156, 157, + 158, 12, 13, 14, 15, 16, 17, 18, 166, 167, + -1, -1, 147, 171, 149, 150, 151, 152, 153, 154, + 155, 156, 157, 158, 12, 13, 14, 15, 16, 17, + 18, 166, 167, 168, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 147, 148, 149, 150, + 151, 152, 153, 154, 155, 156, 157, 158, 12, 13, + 14, 15, 16, 17, 18, 166, 167, 149, 150, 151, + 152, 153, 154, 155, 156, 157, 158, -1, -1, -1, + -1, -1, -1, -1, 166, 167, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 147, + -1, 149, 150, 151, 152, 153, 154, 155, 156, 157, + 158, -1, -1, -1, -1, -1, -1, -1, 166, 167, + 150, 151, 152, 153, 154, 155, 156, 157, 158, -1, + -1, -1, -1, -1, -1, -1, 166, 167, 149, 150, + 151, 152, 153, 154, 155, 156, 157, 158, -1, -1, + -1, -1, -1, -1, -1, 166, 167, -1, -1, -1, + -1, 4, -1, 151, 152, 153, 154, 155, 156, 157, + 158, -1, -1, -1, -1, -1, -1, -1, 166, 167, + -1, -1, -1, -1, -1, 28, -1, 30, -1, -1, + -1, -1, -1, 36, 37, -1, -1, 40, 152, 153, + 154, 155, 156, 157, 158, -1, -1, -1, 51, -1, + 53, -1, 166, 167, 57, 58, -1, 60, -1, -1, + 63, -1, 65, -1, -1, -1, -1, -1, -1, 72, + -1, -1, -1, -1, -1, -1, -1, -1, 4, 82, + -1, 84, 85, 86, -1, -1, 89, -1, 91, -1, + 93, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 28, -1, 30, -1, -1, -1, -1, -1, + 36, 114, -1, -1, 40, 118, 119, 120, -1, -1, + 123, 4, 125, -1, -1, -1, 129, 53, -1, -1, + -1, 57, 58, 136, 60, 138, -1, 63, -1, 65, + 143, 144, -1, -1, -1, 28, 72, 30, -1, -1, + -1, -1, -1, 36, -1, -1, 82, -1, 84, 85, + -1, -1, -1, -1, -1, 91, -1, -1, -1, -1, + 53, -1, -1, -1, 57, 58, -1, -1, -1, -1, + 63, -1, 65, -1, -1, -1, -1, -1, 114, 72, + -1, -1, 118, 119, 120, -1, -1, 123, -1, 125, + -1, 84, 85, 129, -1, -1, -1, -1, 91, -1, + 136, -1, 138, -1, -1, -1, -1, 143, 144, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 118, 119, 120, 121, -1, -1, 124, -1, -1, - -1, -1, -1, 130, -1, -1, -1, -1, -1, -1, - 137, -1, 139, -1, -1, -1, -1, 144, 145, 21, - -1, 23, 24, -1, 26, 27, -1, 29, -1, -1, - 32, -1, 34, -1, -1, -1, -1, -1, -1, 41, - 42, 43, 44, -1, 46, 47, 48, 49, 50, -1, - 52, -1, 54, 55, 56, -1, -1, 59, -1, -1, - -1, -1, 64, -1, 66, 67, 68, 69, 70, 71, - -1, 73, 74, 75, 76, 77, -1, -1, 80, -1, - -1, 83, -1, -1, -1, 87, 88, -1, 90, -1, - -1, -1, 94, 95, 96, -1, 98, 99, 100, 101, - 102, -1, 104, -1, 106, 107, 108, 109, 110, 111, - 112, 113, -1, 115, 116, 117, -1, -1, -1, -1, - 122, -1, -1, 125, -1, -1, 128, 129, -1, -1, - 132, 133, 134, -1, -1, -1, 138, -1, 140, 141, - 142, 143, -1, -1, 146 + -1, -1, -1, -1, -1, 118, 119, 120, -1, -1, + 123, -1, -1, -1, -1, -1, 129, -1, -1, -1, + -1, -1, -1, 136, -1, 138, -1, -1, -1, -1, + 143, 144, 21, -1, 23, 24, -1, 26, 27, -1, + 29, -1, -1, 32, -1, 34, -1, -1, -1, -1, + -1, -1, 41, 42, 43, 44, -1, 46, 47, 48, + 49, 50, -1, 52, -1, 54, 55, 56, -1, -1, + 59, -1, -1, -1, -1, 64, -1, 66, 67, 68, + 69, 70, 71, -1, 73, 74, 75, 76, 77, -1, + -1, 80, -1, -1, 83, -1, -1, -1, 87, 88, + -1, 90, -1, -1, -1, 94, 95, 96, -1, 98, + 99, 100, 101, 102, -1, 104, -1, 106, 107, 108, + 109, 110, 111, 112, 113, -1, 115, 116, 117, -1, + -1, -1, 121, -1, -1, 124, -1, -1, 127, 128, + -1, -1, 131, 132, 133, -1, -1, -1, 137, -1, + 139, 140, 141, 142, -1, -1, 145 }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing symbol of state STATE-NUM. */ -static const unsigned short int yystos[] = +static const yytype_uint16 yystos[] = { - 0, 177, 178, 0, 4, 28, 30, 36, 37, 40, + 0, 176, 177, 0, 4, 28, 30, 36, 37, 40, 45, 51, 53, 57, 58, 60, 63, 65, 72, 78, - 82, 84, 85, 86, 91, 114, 118, 119, 120, 121, - 124, 126, 130, 136, 137, 139, 144, 145, 168, 182, - 183, 184, 185, 186, 189, 190, 197, 208, 222, 226, - 228, 229, 230, 231, 234, 235, 238, 240, 241, 242, - 243, 245, 246, 247, 248, 249, 251, 253, 259, 260, - 261, 262, 3, 4, 171, 3, 4, 3, 4, 224, - 84, 227, 8, 3, 4, 227, 171, 227, 228, 3, - 224, 196, 197, 3, 224, 228, 21, 23, 24, 26, - 27, 29, 32, 34, 41, 42, 43, 44, 46, 47, - 48, 49, 50, 52, 54, 55, 56, 59, 64, 66, - 67, 68, 69, 70, 71, 73, 74, 75, 76, 77, - 80, 83, 87, 88, 90, 94, 95, 96, 98, 99, - 100, 101, 102, 104, 106, 107, 108, 109, 110, 111, - 112, 113, 115, 116, 117, 122, 125, 128, 129, 132, - 133, 134, 138, 140, 141, 142, 143, 146, 198, 200, - 258, 170, 179, 179, 89, 93, 188, 208, 229, 234, - 240, 244, 251, 259, 262, 170, 170, 173, 170, 173, - 170, 181, 170, 149, 239, 173, 252, 253, 252, 252, - 3, 4, 35, 62, 103, 127, 157, 171, 202, 225, - 254, 255, 257, 208, 259, 260, 262, 252, 170, 8, - 173, 170, 260, 173, 251, 131, 173, 171, 171, 171, - 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, - 171, 171, 171, 171, 171, 171, 171, 171, 171, 171, - 171, 171, 147, 169, 11, 79, 182, 187, 190, 229, - 231, 242, 243, 246, 174, 3, 3, 4, 173, 257, - 232, 105, 236, 240, 3, 4, 173, 180, 250, 254, - 254, 175, 168, 171, 195, 252, 172, 205, 206, 207, - 225, 172, 215, 254, 256, 171, 218, 225, 3, 5, - 6, 7, 8, 9, 61, 97, 123, 135, 152, 155, - 156, 157, 160, 161, 171, 211, 212, 213, 211, 214, - 8, 8, 199, 214, 213, 8, 8, 213, 8, 213, - 211, 65, 213, 209, 210, 211, 258, 213, 209, 211, - 260, 260, 8, 10, 201, 5, 263, 260, 200, 168, - 171, 170, 181, 174, 196, 233, 149, 92, 196, 220, - 237, 170, 173, 180, 174, 182, 197, 249, 254, 172, - 214, 157, 210, 144, 191, 192, 193, 194, 197, 251, - 174, 147, 175, 174, 196, 216, 147, 220, 174, 197, - 217, 220, 172, 171, 211, 211, 211, 211, 211, 211, - 211, 260, 12, 13, 14, 15, 16, 17, 18, 19, - 20, 148, 150, 151, 152, 153, 154, 155, 156, 157, - 158, 159, 167, 168, 147, 172, 172, 172, 147, 172, - 172, 172, 172, 172, 172, 172, 172, 172, 3, 172, - 147, 172, 172, 147, 172, 172, 172, 172, 172, 167, - 172, 172, 200, 8, 181, 243, 149, 251, 170, 174, - 196, 221, 174, 186, 174, 181, 169, 169, 172, 147, - 251, 254, 207, 213, 251, 262, 254, 172, 170, 170, - 260, 172, 172, 211, 211, 3, 211, 211, 211, 211, - 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, - 211, 211, 211, 3, 211, 213, 8, 172, 210, 213, - 5, 172, 254, 251, 170, 180, 181, 194, 254, 256, - 170, 223, 225, 172, 211, 149, 169, 172, 181, 254, - 174, 170, 173, 211, 181, 203, 34, 46, 174, 204, - 213, 149, 149, 170, 219, 220, 219, 170 + 82, 84, 85, 86, 91, 114, 118, 119, 120, 123, + 125, 129, 135, 136, 138, 143, 144, 167, 181, 182, + 183, 184, 185, 188, 189, 196, 207, 221, 225, 227, + 228, 229, 230, 233, 234, 237, 239, 240, 241, 242, + 244, 245, 246, 247, 248, 250, 252, 258, 259, 260, + 261, 3, 4, 170, 3, 4, 3, 4, 223, 84, + 226, 8, 3, 4, 226, 170, 226, 227, 3, 223, + 195, 196, 3, 223, 227, 21, 23, 24, 26, 27, + 29, 32, 34, 41, 42, 43, 44, 46, 47, 48, + 49, 50, 52, 54, 55, 56, 59, 64, 66, 67, + 68, 69, 70, 71, 73, 74, 75, 76, 77, 80, + 83, 87, 88, 90, 94, 95, 96, 98, 99, 100, + 101, 102, 104, 106, 107, 108, 109, 110, 111, 112, + 113, 115, 116, 117, 121, 124, 127, 128, 131, 132, + 133, 137, 139, 140, 141, 142, 145, 197, 199, 257, + 169, 178, 178, 89, 93, 187, 207, 228, 233, 239, + 243, 250, 258, 261, 169, 169, 172, 169, 172, 169, + 180, 169, 148, 238, 172, 251, 252, 251, 251, 3, + 4, 35, 62, 103, 126, 156, 170, 201, 224, 253, + 254, 256, 207, 258, 259, 261, 251, 169, 8, 172, + 169, 259, 172, 250, 130, 172, 170, 170, 170, 170, + 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, + 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, + 170, 146, 168, 11, 79, 181, 186, 189, 228, 230, + 241, 242, 245, 173, 3, 3, 4, 172, 256, 231, + 105, 235, 239, 3, 4, 172, 179, 249, 253, 253, + 174, 167, 170, 194, 251, 171, 204, 205, 206, 224, + 171, 214, 253, 255, 170, 217, 224, 3, 5, 6, + 7, 8, 9, 61, 97, 122, 134, 151, 154, 155, + 156, 159, 160, 170, 210, 211, 212, 210, 213, 8, + 8, 198, 213, 212, 8, 8, 212, 8, 212, 210, + 65, 212, 208, 209, 210, 257, 212, 208, 210, 259, + 259, 8, 10, 200, 5, 262, 259, 199, 167, 170, + 169, 180, 173, 195, 232, 148, 92, 195, 219, 236, + 169, 172, 179, 173, 181, 196, 248, 253, 171, 213, + 156, 209, 143, 190, 191, 192, 193, 196, 250, 173, + 146, 174, 173, 195, 215, 146, 219, 173, 196, 216, + 219, 171, 170, 210, 210, 210, 210, 210, 210, 210, + 259, 12, 13, 14, 15, 16, 17, 18, 19, 20, + 147, 149, 150, 151, 152, 153, 154, 155, 156, 157, + 158, 166, 167, 146, 171, 171, 171, 146, 171, 171, + 171, 171, 171, 171, 171, 171, 171, 3, 171, 146, + 171, 171, 146, 171, 171, 171, 171, 171, 166, 171, + 171, 199, 8, 180, 242, 148, 250, 169, 173, 195, + 220, 173, 185, 173, 180, 168, 168, 171, 146, 250, + 253, 206, 212, 250, 261, 253, 171, 169, 169, 259, + 171, 171, 210, 210, 3, 210, 210, 210, 210, 210, + 210, 210, 210, 210, 210, 210, 210, 210, 210, 210, + 210, 210, 3, 210, 212, 8, 171, 209, 212, 5, + 171, 253, 250, 169, 179, 180, 193, 253, 255, 169, + 222, 224, 171, 210, 148, 168, 171, 180, 253, 173, + 169, 172, 210, 180, 202, 34, 46, 173, 203, 212, + 148, 148, 169, 218, 219, 218, 169 }; #define yyerrok (yyerrstatus = 0) @@ -1816,7 +1727,7 @@ do \ yychar = (Token); \ yylval = (Value); \ yytoken = YYTRANSLATE (yychar); \ - YYPOPSTACK; \ + YYPOPSTACK (1); \ goto yybackup; \ } \ else \ @@ -1824,7 +1735,7 @@ do \ yyerror (YY_("syntax error: cannot back up")); \ YYERROR; \ } \ -while (0) +while (YYID (0)) #define YYTERROR 1 @@ -1839,7 +1750,7 @@ while (0) #ifndef YYLLOC_DEFAULT # define YYLLOC_DEFAULT(Current, Rhs, N) \ do \ - if (N) \ + if (YYID (N)) \ { \ (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ @@ -1853,7 +1764,7 @@ while (0) (Current).first_column = (Current).last_column = \ YYRHSLOC (Rhs, 0).last_column; \ } \ - while (0) + while (YYID (0)) #endif @@ -1865,8 +1776,8 @@ while (0) # if YYLTYPE_IS_TRIVIAL # define YY_LOCATION_PRINT(File, Loc) \ fprintf (File, "%d.%d-%d.%d", \ - (Loc).first_line, (Loc).first_column, \ - (Loc).last_line, (Loc).last_column) + (Loc).first_line, (Loc).first_column, \ + (Loc).last_line, (Loc).last_column) # else # define YY_LOCATION_PRINT(File, Loc) ((void) 0) # endif @@ -1893,37 +1804,100 @@ while (0) do { \ if (yydebug) \ YYFPRINTF Args; \ -} while (0) +} while (YYID (0)) -# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ -do { \ - if (yydebug) \ - { \ - YYFPRINTF (stderr, "%s ", Title); \ - yysymprint (stderr, \ - Type, Value); \ - YYFPRINTF (stderr, "\n"); \ - } \ -} while (0) +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ +do { \ + if (yydebug) \ + { \ + YYFPRINTF (stderr, "%s ", Title); \ + yy_symbol_print (stderr, \ + Type, Value); \ + YYFPRINTF (stderr, "\n"); \ + } \ +} while (YYID (0)) + + +/*--------------------------------. +| Print this symbol on YYOUTPUT. | +`--------------------------------*/ + +/*ARGSUSED*/ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static void +yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) +#else +static void +yy_symbol_value_print (yyoutput, yytype, yyvaluep) + FILE *yyoutput; + int yytype; + YYSTYPE const * const yyvaluep; +#endif +{ + if (!yyvaluep) + return; +# ifdef YYPRINT + if (yytype < YYNTOKENS) + YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); +# else + YYUSE (yyoutput); +# endif + switch (yytype) + { + default: + break; + } +} + + +/*--------------------------------. +| Print this symbol on YYOUTPUT. | +`--------------------------------*/ + +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static void +yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) +#else +static void +yy_symbol_print (yyoutput, yytype, yyvaluep) + FILE *yyoutput; + int yytype; + YYSTYPE const * const yyvaluep; +#endif +{ + if (yytype < YYNTOKENS) + YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); + else + YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); + + yy_symbol_value_print (yyoutput, yytype, yyvaluep); + YYFPRINTF (yyoutput, ")"); +} /*------------------------------------------------------------------. | yy_stack_print -- Print the state stack from its BOTTOM up to its | | TOP (included). | `------------------------------------------------------------------*/ -#if defined (__STDC__) || defined (__cplusplus) +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) static void -yy_stack_print (short int *bottom, short int *top) +yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) #else static void -yy_stack_print (bottom, top) - short int *bottom; - short int *top; +yy_stack_print (yybottom, yytop) + yytype_int16 *yybottom; + yytype_int16 *yytop; #endif { YYFPRINTF (stderr, "Stack now"); - for (/* Nothing. */; bottom <= top; ++bottom) - YYFPRINTF (stderr, " %d", *bottom); + for (; yybottom <= yytop; yybottom++) + { + int yybot = *yybottom; + YYFPRINTF (stderr, " %d", yybot); + } YYFPRINTF (stderr, "\n"); } @@ -1931,37 +1905,45 @@ yy_stack_print (bottom, top) do { \ if (yydebug) \ yy_stack_print ((Bottom), (Top)); \ -} while (0) +} while (YYID (0)) /*------------------------------------------------. | Report that the YYRULE is going to be reduced. | `------------------------------------------------*/ -#if defined (__STDC__) || defined (__cplusplus) +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) static void -yy_reduce_print (int yyrule) +yy_reduce_print (YYSTYPE *yyvsp, int yyrule) #else static void -yy_reduce_print (yyrule) +yy_reduce_print (yyvsp, yyrule) + YYSTYPE *yyvsp; int yyrule; #endif { + int yynrhs = yyr2[yyrule]; int yyi; unsigned long int yylno = yyrline[yyrule]; - YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu), ", - yyrule - 1, yylno); - /* Print the symbols being reduced, and their result. */ - for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++) - YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]); - YYFPRINTF (stderr, "-> %s\n", yytname[yyr1[yyrule]]); + YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", + yyrule - 1, yylno); + /* The symbols being reduced. */ + for (yyi = 0; yyi < yynrhs; yyi++) + { + YYFPRINTF (stderr, " $%d = ", yyi + 1); + yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], + &(yyvsp[(yyi + 1) - (yynrhs)]) + ); + YYFPRINTF (stderr, "\n"); + } } # define YY_REDUCE_PRINT(Rule) \ do { \ if (yydebug) \ - yy_reduce_print (Rule); \ -} while (0) + yy_reduce_print (yyvsp, Rule); \ +} while (YYID (0)) /* Nonzero means print parse trace. It is left uninitialized so that multiple parsers can coexist. */ @@ -1995,42 +1977,44 @@ int yydebug; #if YYERROR_VERBOSE # ifndef yystrlen -# if defined (__GLIBC__) && defined (_STRING_H) +# if defined __GLIBC__ && defined _STRING_H # define yystrlen strlen # else /* Return the length of YYSTR. */ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) static YYSIZE_T -# if defined (__STDC__) || defined (__cplusplus) yystrlen (const char *yystr) -# else +#else +static YYSIZE_T yystrlen (yystr) - const char *yystr; -# endif + const char *yystr; +#endif { - const char *yys = yystr; - - while (*yys++ != '\0') + YYSIZE_T yylen; + for (yylen = 0; yystr[yylen]; yylen++) continue; - - return yys - yystr - 1; + return yylen; } # endif # endif # ifndef yystpcpy -# if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE) +# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE # define yystpcpy stpcpy # else /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in YYDEST. */ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) static char * -# if defined (__STDC__) || defined (__cplusplus) yystpcpy (char *yydest, const char *yysrc) -# else +#else +static char * yystpcpy (yydest, yysrc) - char *yydest; - const char *yysrc; -# endif + char *yydest; + const char *yysrc; +#endif { char *yyd = yydest; const char *yys = yysrc; @@ -2056,7 +2040,7 @@ yytnamerr (char *yyres, const char *yystr) { if (*yystr == '"') { - size_t yyn = 0; + YYSIZE_T yyn = 0; char const *yyp = yystr; for (;;) @@ -2091,53 +2075,123 @@ yytnamerr (char *yyres, const char *yystr) } # endif -#endif /* YYERROR_VERBOSE */ +/* Copy into YYRESULT an error message about the unexpected token + YYCHAR while in state YYSTATE. Return the number of bytes copied, + including the terminating null byte. If YYRESULT is null, do not + copy anything; just return the number of bytes that would be + copied. As a special case, return 0 if an ordinary "syntax error" + message will do. Return YYSIZE_MAXIMUM if overflow occurs during + size calculation. */ +static YYSIZE_T +yysyntax_error (char *yyresult, int yystate, int yychar) +{ + int yyn = yypact[yystate]; + if (! (YYPACT_NINF < yyn && yyn <= YYLAST)) + return 0; + else + { + int yytype = YYTRANSLATE (yychar); + YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); + YYSIZE_T yysize = yysize0; + YYSIZE_T yysize1; + int yysize_overflow = 0; + enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; + char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; + int yyx; + +# if 0 + /* This is so xgettext sees the translatable formats that are + constructed on the fly. */ + YY_("syntax error, unexpected %s"); + YY_("syntax error, unexpected %s, expecting %s"); + YY_("syntax error, unexpected %s, expecting %s or %s"); + YY_("syntax error, unexpected %s, expecting %s or %s or %s"); + YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); +# endif + char *yyfmt; + char const *yyf; + static char const yyunexpected[] = "syntax error, unexpected %s"; + static char const yyexpecting[] = ", expecting %s"; + static char const yyor[] = " or %s"; + char yyformat[sizeof yyunexpected + + sizeof yyexpecting - 1 + + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) + * (sizeof yyor - 1))]; + char const *yyprefix = yyexpecting; + + /* Start YYX at -YYN if negative to avoid negative indexes in + YYCHECK. */ + int yyxbegin = yyn < 0 ? -yyn : 0; + + /* Stay within bounds of both yycheck and yytname. */ + int yychecklim = YYLAST - yyn + 1; + int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; + int yycount = 1; + + yyarg[0] = yytname[yytype]; + yyfmt = yystpcpy (yyformat, yyunexpected); + + for (yyx = yyxbegin; yyx < yyxend; ++yyx) + if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) + { + if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) + { + yycount = 1; + yysize = yysize0; + yyformat[sizeof yyunexpected - 1] = '\0'; + break; + } + yyarg[yycount++] = yytname[yyx]; + yysize1 = yysize + yytnamerr (0, yytname[yyx]); + yysize_overflow |= (yysize1 < yysize); + yysize = yysize1; + yyfmt = yystpcpy (yyfmt, yyprefix); + yyprefix = yyor; + } + + yyf = YY_(yyformat); + yysize1 = yysize + yystrlen (yyf); + yysize_overflow |= (yysize1 < yysize); + yysize = yysize1; + + if (yysize_overflow) + return YYSIZE_MAXIMUM; + + if (yyresult) + { + /* Avoid sprintf, as that infringes on the user's name space. + Don't have undefined behavior even if the translation + produced a string with the wrong number of "%s"s. */ + char *yyp = yyresult; + int yyi = 0; + while ((*yyp = *yyf) != '\0') + { + if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) + { + yyp += yytnamerr (yyp, yyarg[yyi++]); + yyf += 2; + } + else + { + yyp++; + yyf++; + } + } + } + return yysize; + } +} +#endif /* YYERROR_VERBOSE */ -#if YYDEBUG -/*--------------------------------. -| Print this symbol on YYOUTPUT. | -`--------------------------------*/ - -#if defined (__STDC__) || defined (__cplusplus) -static void -yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep) -#else -static void -yysymprint (yyoutput, yytype, yyvaluep) - FILE *yyoutput; - int yytype; - YYSTYPE *yyvaluep; -#endif -{ - /* Pacify ``unused variable'' warnings. */ - (void) yyvaluep; - - if (yytype < YYNTOKENS) - YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); - else - YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); - - -# ifdef YYPRINT - if (yytype < YYNTOKENS) - YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); -# endif - switch (yytype) - { - default: - break; - } - YYFPRINTF (yyoutput, ")"); -} - -#endif /* ! YYDEBUG */ /*-----------------------------------------------. | Release the memory associated to this symbol. | `-----------------------------------------------*/ -#if defined (__STDC__) || defined (__cplusplus) +/*ARGSUSED*/ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) static void yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) #else @@ -2148,8 +2202,7 @@ yydestruct (yymsg, yytype, yyvaluep) YYSTYPE *yyvaluep; #endif { - /* Pacify ``unused variable'' warnings. */ - (void) yyvaluep; + YYUSE (yyvaluep); if (!yymsg) yymsg = "Deleting"; @@ -2159,21 +2212,19 @@ yydestruct (yymsg, yytype, yyvaluep) { default: - break; + break; } } - /* Prevent warnings from -Wmissing-prototypes. */ - #ifdef YYPARSE_PARAM -# if defined (__STDC__) || defined (__cplusplus) +#if defined __STDC__ || defined __cplusplus int yyparse (void *YYPARSE_PARAM); -# else +#else int yyparse (); -# endif +#endif #else /* ! YYPARSE_PARAM */ -#if defined (__STDC__) || defined (__cplusplus) +#if defined __STDC__ || defined __cplusplus int yyparse (void); #else int yyparse (); @@ -2181,11 +2232,10 @@ int yyparse (); #endif /* ! YYPARSE_PARAM */ - -/* The look-ahead symbol. */ +/* The lookahead symbol. */ int yychar; -/* The semantic value of the look-ahead symbol. */ +/* The semantic value of the lookahead symbol. */ YYSTYPE yylval; /* Number of syntax errors so far. */ @@ -2193,82 +2243,94 @@ int yynerrs; -/*----------. -| yyparse. | -`----------*/ +/*-------------------------. +| yyparse or yypush_parse. | +`-------------------------*/ #ifdef YYPARSE_PARAM -# if defined (__STDC__) || defined (__cplusplus) -int yyparse (void *YYPARSE_PARAM) -# else -int yyparse (YYPARSE_PARAM) - void *YYPARSE_PARAM; -# endif +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +int +yyparse (void *YYPARSE_PARAM) +#else +int +yyparse (YYPARSE_PARAM) + void *YYPARSE_PARAM; +#endif #else /* ! YYPARSE_PARAM */ -#if defined (__STDC__) || defined (__cplusplus) +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) int yyparse (void) #else int yyparse () - ; + #endif #endif { - - int yystate; + + + int yystate; + /* Number of tokens to shift before error messages enabled. */ + int yyerrstatus; + + /* The stacks and their tools: + `yyss': related to states. + `yyvs': related to semantic values. + + Refer to the stacks thru separate pointers, to allow yyoverflow + to reallocate them elsewhere. */ + + /* The state stack. */ + yytype_int16 yyssa[YYINITDEPTH]; + yytype_int16 *yyss; + yytype_int16 *yyssp; + + /* The semantic value stack. */ + YYSTYPE yyvsa[YYINITDEPTH]; + YYSTYPE *yyvs; + YYSTYPE *yyvsp; + + YYSIZE_T yystacksize; + int yyn; int yyresult; - /* Number of tokens to shift before error messages enabled. */ - int yyerrstatus; - /* Look-ahead token as an internal (translated) token number. */ - int yytoken = 0; - - /* Three stacks and their tools: - `yyss': related to states, - `yyvs': related to semantic values, - `yyls': related to locations. - - Refer to the stacks thru separate pointers, to allow yyoverflow - to reallocate them elsewhere. */ - - /* The state stack. */ - short int yyssa[YYINITDEPTH]; - short int *yyss = yyssa; - short int *yyssp; - - /* The semantic value stack. */ - YYSTYPE yyvsa[YYINITDEPTH]; - YYSTYPE *yyvs = yyvsa; - YYSTYPE *yyvsp; - - - -#define YYPOPSTACK (yyvsp--, yyssp--) - - YYSIZE_T yystacksize = YYINITDEPTH; - + /* Lookahead token as an internal (translated) token number. */ + int yytoken; /* The variables used to return semantic value and location from the action routines. */ YYSTYPE yyval; +#if YYERROR_VERBOSE + /* Buffer for error messages, and its allocated size. */ + char yymsgbuf[128]; + char *yymsg = yymsgbuf; + YYSIZE_T yymsg_alloc = sizeof yymsgbuf; +#endif - /* When reducing, the number of symbols on the RHS of the reduced - rule. */ - int yylen; +#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) + + /* The number of symbols on the RHS of the reduced rule. + Keep to zero when no symbol should be popped. */ + int yylen = 0; + + yytoken = 0; + yyss = yyssa; + yyvs = yyvsa; + yystacksize = YYINITDEPTH; YYDPRINTF ((stderr, "Starting parse\n")); yystate = 0; yyerrstatus = 0; yynerrs = 0; - yychar = YYEMPTY; /* Cause a token to be read. */ + yychar = YYEMPTY; /* Cause a token to be read. */ /* Initialize stack pointers. Waste one element of value and location stack so that they stay on the same level as the state stack. The wasted elements are never initialized. */ - yyssp = yyss; yyvsp = yyvs; @@ -2279,8 +2341,7 @@ yyparse () `------------------------------------------------------------*/ yynewstate: /* In all cases, when you get here, the value and location stacks - have just been pushed. so pushing a state here evens the stacks. - */ + have just been pushed. So pushing a state here evens the stacks. */ yyssp++; yysetstate: @@ -2293,12 +2354,11 @@ yyparse () #ifdef yyoverflow { - /* Give user a chance to reallocate the stack. Use copies of + /* Give user a chance to reallocate the stack. Use copies of these so that the &'s don't force the real ones into memory. */ YYSTYPE *yyvs1 = yyvs; - short int *yyss1 = yyss; - + yytype_int16 *yyss1 = yyss; /* Each stack pointer address is followed by the size of the data in use in that stack, in bytes. This used to be a @@ -2307,7 +2367,6 @@ yyparse () yyoverflow (YY_("memory exhausted"), &yyss1, yysize * sizeof (*yyssp), &yyvs1, yysize * sizeof (*yyvsp), - &yystacksize); yyss = yyss1; @@ -2325,14 +2384,13 @@ yyparse () yystacksize = YYMAXDEPTH; { - short int *yyss1 = yyss; + yytype_int16 *yyss1 = yyss; union yyalloc *yyptr = (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); if (! yyptr) goto yyexhaustedlab; - YYSTACK_RELOCATE (yyss); - YYSTACK_RELOCATE (yyvs); - + YYSTACK_RELOCATE (yyss_alloc, yyss); + YYSTACK_RELOCATE (yyvs_alloc, yyvs); # undef YYSTACK_RELOCATE if (yyss1 != yyssa) YYSTACK_FREE (yyss1); @@ -2343,7 +2401,6 @@ yyparse () yyssp = yyss + yysize - 1; yyvsp = yyvs + yysize - 1; - YYDPRINTF ((stderr, "Stack size increased to %lu\n", (unsigned long int) yystacksize)); @@ -2353,6 +2410,9 @@ yyparse () YYDPRINTF ((stderr, "Entering state %d\n", yystate)); + if (yystate == YYFINAL) + YYACCEPT; + goto yybackup; /*-----------. @@ -2360,19 +2420,17 @@ yyparse () `-----------*/ yybackup: -/* Do appropriate processing given the current state. */ -/* Read a look-ahead token if we need one and don't already have one. */ -/* yyresume: */ - - /* First try to decide what to do without reference to look-ahead token. */ + /* Do appropriate processing given the current state. Read a + lookahead token if we need one and don't already have one. */ + /* First try to decide what to do without reference to lookahead token. */ yyn = yypact[yystate]; if (yyn == YYPACT_NINF) goto yydefault; - /* Not known => get a look-ahead token if don't already have one. */ + /* Not known => get a lookahead token if don't already have one. */ - /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */ + /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ if (yychar == YYEMPTY) { YYDPRINTF ((stderr, "Reading a token: ")); @@ -2404,25 +2462,20 @@ yybackup: goto yyreduce; } - if (yyn == YYFINAL) - YYACCEPT; - - /* Shift the look-ahead token. */ - YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); - - /* Discard the token being shifted unless it is eof. */ - if (yychar != YYEOF) - yychar = YYEMPTY; - - *++yyvsp = yylval; - - /* Count tokens shifted since error; after three, turn off error status. */ if (yyerrstatus) yyerrstatus--; + /* Shift the lookahead token. */ + YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); + + /* Discard the shifted token. */ + yychar = YYEMPTY; + yystate = yyn; + *++yyvsp = yylval; + goto yynewstate; @@ -2458,1640 +2511,2204 @@ yyreduce: switch (yyn) { case 2: -#line 347 "parser.y" + +/* Line 1455 of yacc.c */ +#line 326 "parser.y" { fix_incomplete(); - check_statements((yyvsp[0].stmt_list), FALSE); - check_all_user_types((yyvsp[0].stmt_list)); - write_header((yyvsp[0].stmt_list)); - write_id_data((yyvsp[0].stmt_list)); - write_proxies((yyvsp[0].stmt_list)); - write_client((yyvsp[0].stmt_list)); - write_server((yyvsp[0].stmt_list)); - write_dlldata((yyvsp[0].stmt_list)); - write_local_stubs((yyvsp[0].stmt_list)); + check_statements((yyvsp[(1) - (1)].stmt_list), FALSE); + check_all_user_types((yyvsp[(1) - (1)].stmt_list)); + write_header((yyvsp[(1) - (1)].stmt_list)); + write_id_data((yyvsp[(1) - (1)].stmt_list)); + write_proxies((yyvsp[(1) - (1)].stmt_list)); + write_client((yyvsp[(1) - (1)].stmt_list)); + write_server((yyvsp[(1) - (1)].stmt_list)); + write_dlldata((yyvsp[(1) - (1)].stmt_list)); + write_local_stubs((yyvsp[(1) - (1)].stmt_list)); ;} break; case 3: -#line 360 "parser.y" + +/* Line 1455 of yacc.c */ +#line 339 "parser.y" { (yyval.stmt_list) = NULL; ;} break; case 4: -#line 361 "parser.y" - { (yyval.stmt_list) = append_statement((yyvsp[-1].stmt_list), make_statement_reference((yyvsp[0].type))); ;} + +/* Line 1455 of yacc.c */ +#line 340 "parser.y" + { (yyval.stmt_list) = append_statement((yyvsp[(1) - (2)].stmt_list), make_statement_reference((yyvsp[(2) - (2)].type))); ;} break; case 5: -#line 362 "parser.y" - { (yyval.stmt_list) = append_statement((yyvsp[-1].stmt_list), make_statement_type_decl((yyvsp[0].type))); ;} + +/* Line 1455 of yacc.c */ +#line 341 "parser.y" + { (yyval.stmt_list) = append_statement((yyvsp[(1) - (2)].stmt_list), make_statement_type_decl((yyvsp[(2) - (2)].type))); ;} break; case 6: -#line 363 "parser.y" - { (yyval.stmt_list) = (yyvsp[-2].stmt_list); - reg_type((yyvsp[-1].type), (yyvsp[-1].type)->name, 0); + +/* Line 1455 of yacc.c */ +#line 342 "parser.y" + { (yyval.stmt_list) = (yyvsp[(1) - (3)].stmt_list); + reg_type((yyvsp[(2) - (3)].type), (yyvsp[(2) - (3)].type)->name, 0); ;} break; case 7: -#line 366 "parser.y" - { (yyval.stmt_list) = append_statement((yyvsp[-1].stmt_list), make_statement_type_decl((yyvsp[0].type))); - reg_type((yyvsp[0].type), (yyvsp[0].type)->name, 0); + +/* Line 1455 of yacc.c */ +#line 345 "parser.y" + { (yyval.stmt_list) = append_statement((yyvsp[(1) - (2)].stmt_list), make_statement_type_decl((yyvsp[(2) - (2)].type))); + reg_type((yyvsp[(2) - (2)].type), (yyvsp[(2) - (2)].type)->name, 0); ;} break; case 8: -#line 369 "parser.y" - { (yyval.stmt_list) = append_statement((yyvsp[-1].stmt_list), make_statement_module((yyvsp[0].type))); ;} + +/* Line 1455 of yacc.c */ +#line 348 "parser.y" + { (yyval.stmt_list) = append_statement((yyvsp[(1) - (2)].stmt_list), make_statement_module((yyvsp[(2) - (2)].type))); ;} break; case 9: -#line 370 "parser.y" - { (yyval.stmt_list) = append_statement((yyvsp[-1].stmt_list), make_statement_library((yyvsp[0].typelib))); ;} + +/* Line 1455 of yacc.c */ +#line 349 "parser.y" + { (yyval.stmt_list) = append_statement((yyvsp[(1) - (2)].stmt_list), make_statement_library((yyvsp[(2) - (2)].typelib))); ;} break; case 10: -#line 371 "parser.y" - { (yyval.stmt_list) = append_statement((yyvsp[-1].stmt_list), (yyvsp[0].statement)); ;} + +/* Line 1455 of yacc.c */ +#line 350 "parser.y" + { (yyval.stmt_list) = append_statement((yyvsp[(1) - (2)].stmt_list), (yyvsp[(2) - (2)].statement)); ;} break; case 11: -#line 374 "parser.y" + +/* Line 1455 of yacc.c */ +#line 353 "parser.y" { (yyval.stmt_list) = NULL; ;} break; case 12: -#line 375 "parser.y" - { (yyval.stmt_list) = append_statement((yyvsp[-1].stmt_list), make_statement_reference((yyvsp[0].type))); ;} + +/* Line 1455 of yacc.c */ +#line 354 "parser.y" + { (yyval.stmt_list) = append_statement((yyvsp[(1) - (2)].stmt_list), make_statement_reference((yyvsp[(2) - (2)].type))); ;} break; case 13: -#line 376 "parser.y" - { (yyval.stmt_list) = append_statement((yyvsp[-1].stmt_list), make_statement_type_decl((yyvsp[0].type))); ;} + +/* Line 1455 of yacc.c */ +#line 355 "parser.y" + { (yyval.stmt_list) = append_statement((yyvsp[(1) - (2)].stmt_list), make_statement_type_decl((yyvsp[(2) - (2)].type))); ;} break; case 14: -#line 377 "parser.y" - { (yyval.stmt_list) = (yyvsp[-2].stmt_list); reg_type((yyvsp[-1].type), (yyvsp[-1].type)->name, 0); ;} + +/* Line 1455 of yacc.c */ +#line 356 "parser.y" + { (yyval.stmt_list) = (yyvsp[(1) - (3)].stmt_list); reg_type((yyvsp[(2) - (3)].type), (yyvsp[(2) - (3)].type)->name, 0); ;} break; case 15: -#line 378 "parser.y" - { (yyval.stmt_list) = append_statement((yyvsp[-1].stmt_list), make_statement_type_decl((yyvsp[0].type))); - reg_type((yyvsp[0].type), (yyvsp[0].type)->name, 0); + +/* Line 1455 of yacc.c */ +#line 357 "parser.y" + { (yyval.stmt_list) = append_statement((yyvsp[(1) - (2)].stmt_list), make_statement_type_decl((yyvsp[(2) - (2)].type))); + reg_type((yyvsp[(2) - (2)].type), (yyvsp[(2) - (2)].type)->name, 0); ;} break; case 16: -#line 381 "parser.y" - { (yyval.stmt_list) = append_statement((yyvsp[-1].stmt_list), make_statement_module((yyvsp[0].type))); ;} + +/* Line 1455 of yacc.c */ +#line 360 "parser.y" + { (yyval.stmt_list) = append_statement((yyvsp[(1) - (2)].stmt_list), make_statement_module((yyvsp[(2) - (2)].type))); ;} break; case 17: -#line 382 "parser.y" - { (yyval.stmt_list) = append_statement((yyvsp[-1].stmt_list), (yyvsp[0].statement)); ;} + +/* Line 1455 of yacc.c */ +#line 361 "parser.y" + { (yyval.stmt_list) = append_statement((yyvsp[(1) - (2)].stmt_list), (yyvsp[(2) - (2)].statement)); ;} break; case 18: -#line 383 "parser.y" - { (yyval.stmt_list) = append_statement((yyvsp[-1].stmt_list), make_statement_importlib((yyvsp[0].str))); ;} + +/* Line 1455 of yacc.c */ +#line 362 "parser.y" + { (yyval.stmt_list) = append_statement((yyvsp[(1) - (2)].stmt_list), make_statement_importlib((yyvsp[(2) - (2)].str))); ;} break; case 19: -#line 384 "parser.y" - { (yyval.stmt_list) = append_statement((yyvsp[-1].stmt_list), make_statement_library((yyvsp[0].typelib))); ;} + +/* Line 1455 of yacc.c */ +#line 363 "parser.y" + { (yyval.stmt_list) = append_statement((yyvsp[(1) - (2)].stmt_list), make_statement_library((yyvsp[(2) - (2)].typelib))); ;} break; case 20: -#line 387 "parser.y" + +/* Line 1455 of yacc.c */ +#line 366 "parser.y" { (yyval.stmt_list) = NULL; ;} break; case 21: -#line 388 "parser.y" - { (yyval.stmt_list) = append_statement((yyvsp[-1].stmt_list), (yyvsp[0].statement)); ;} + +/* Line 1455 of yacc.c */ +#line 367 "parser.y" + { (yyval.stmt_list) = append_statement((yyvsp[(1) - (2)].stmt_list), (yyvsp[(2) - (2)].statement)); ;} break; case 24: -#line 396 "parser.y" - { (yyval.statement) = make_statement_cppquote((yyvsp[0].str)); ;} + +/* Line 1455 of yacc.c */ +#line 375 "parser.y" + { (yyval.statement) = make_statement_cppquote((yyvsp[(1) - (1)].str)); ;} break; case 25: -#line 397 "parser.y" - { (yyval.statement) = make_statement_type_decl((yyvsp[-1].type)); ;} + +/* Line 1455 of yacc.c */ +#line 376 "parser.y" + { (yyval.statement) = make_statement_type_decl((yyvsp[(1) - (2)].type)); ;} break; case 26: -#line 398 "parser.y" - { (yyval.statement) = make_statement_declaration((yyvsp[-1].var)); ;} + +/* Line 1455 of yacc.c */ +#line 377 "parser.y" + { (yyval.statement) = make_statement_declaration((yyvsp[(1) - (2)].var)); ;} break; case 27: -#line 399 "parser.y" - { (yyval.statement) = make_statement_import((yyvsp[0].str)); ;} + +/* Line 1455 of yacc.c */ +#line 378 "parser.y" + { (yyval.statement) = make_statement_import((yyvsp[(1) - (1)].str)); ;} break; case 28: -#line 400 "parser.y" - { (yyval.statement) = (yyvsp[-1].statement); ;} + +/* Line 1455 of yacc.c */ +#line 379 "parser.y" + { (yyval.statement) = (yyvsp[(1) - (2)].statement); ;} break; case 32: -#line 407 "parser.y" - { (yyval.type) = (yyvsp[0].type); (yyval.type)->attrs = check_enum_attrs((yyvsp[-1].attr_list)); ;} + +/* Line 1455 of yacc.c */ +#line 386 "parser.y" + { (yyval.type) = (yyvsp[(2) - (2)].type); (yyval.type)->attrs = check_enum_attrs((yyvsp[(1) - (2)].attr_list)); ;} break; case 33: -#line 408 "parser.y" - { (yyval.type) = (yyvsp[0].type); (yyval.type)->attrs = check_struct_attrs((yyvsp[-1].attr_list)); ;} + +/* Line 1455 of yacc.c */ +#line 387 "parser.y" + { (yyval.type) = (yyvsp[(2) - (2)].type); (yyval.type)->attrs = check_struct_attrs((yyvsp[(1) - (2)].attr_list)); ;} break; case 34: -#line 409 "parser.y" - { (yyval.type) = (yyvsp[0].type); (yyval.type)->attrs = check_union_attrs((yyvsp[-1].attr_list)); ;} + +/* Line 1455 of yacc.c */ +#line 388 "parser.y" + { (yyval.type) = (yyvsp[(2) - (2)].type); (yyval.type)->attrs = check_union_attrs((yyvsp[(1) - (2)].attr_list)); ;} break; case 35: -#line 412 "parser.y" - { (yyval.str) = (yyvsp[-1].str); ;} + +/* Line 1455 of yacc.c */ +#line 391 "parser.y" + { (yyval.str) = (yyvsp[(3) - (4)].str); ;} break; case 36: -#line 414 "parser.y" + +/* Line 1455 of yacc.c */ +#line 393 "parser.y" { assert(yychar == YYEMPTY); (yyval.import) = xmalloc(sizeof(struct _import_t)); - (yyval.import)->name = (yyvsp[-1].str); - (yyval.import)->import_performed = do_import((yyvsp[-1].str)); + (yyval.import)->name = (yyvsp[(2) - (3)].str); + (yyval.import)->import_performed = do_import((yyvsp[(2) - (3)].str)); if (!(yyval.import)->import_performed) yychar = aEOF; ;} break; case 37: -#line 422 "parser.y" - { (yyval.str) = (yyvsp[-2].import)->name; - if ((yyvsp[-2].import)->import_performed) pop_import(); - free((yyvsp[-2].import)); + +/* Line 1455 of yacc.c */ +#line 401 "parser.y" + { (yyval.str) = (yyvsp[(1) - (3)].import)->name; + if ((yyvsp[(1) - (3)].import)->import_performed) pop_import(); + free((yyvsp[(1) - (3)].import)); ;} break; case 38: -#line 429 "parser.y" - { (yyval.str) = (yyvsp[-2].str); if(!parse_only) add_importlib((yyvsp[-2].str)); ;} + +/* Line 1455 of yacc.c */ +#line 408 "parser.y" + { (yyval.str) = (yyvsp[(3) - (5)].str); if(!parse_only) add_importlib((yyvsp[(3) - (5)].str)); ;} break; case 39: -#line 432 "parser.y" - { (yyval.str) = (yyvsp[0].str); ;} + +/* Line 1455 of yacc.c */ +#line 411 "parser.y" + { (yyval.str) = (yyvsp[(2) - (2)].str); ;} break; case 40: -#line 434 "parser.y" - { (yyval.typelib) = make_library((yyvsp[-1].str), check_library_attrs((yyvsp[-1].str), (yyvsp[-2].attr_list))); + +/* Line 1455 of yacc.c */ +#line 413 "parser.y" + { (yyval.typelib) = make_library((yyvsp[(2) - (3)].str), check_library_attrs((yyvsp[(2) - (3)].str), (yyvsp[(1) - (3)].attr_list))); if (!parse_only) start_typelib((yyval.typelib)); ;} break; case 41: -#line 439 "parser.y" - { (yyval.typelib) = (yyvsp[-3].typelib); - (yyval.typelib)->stmts = (yyvsp[-2].stmt_list); + +/* Line 1455 of yacc.c */ +#line 418 "parser.y" + { (yyval.typelib) = (yyvsp[(1) - (4)].typelib); + (yyval.typelib)->stmts = (yyvsp[(2) - (4)].stmt_list); if (!parse_only) end_typelib(); ;} break; case 42: -#line 445 "parser.y" + +/* Line 1455 of yacc.c */ +#line 424 "parser.y" { (yyval.var_list) = NULL; ;} break; case 44: -#line 449 "parser.y" + +/* Line 1455 of yacc.c */ +#line 428 "parser.y" { (yyval.var_list) = NULL; ;} break; case 45: -#line 452 "parser.y" - { check_arg((yyvsp[0].var)); (yyval.var_list) = append_var( NULL, (yyvsp[0].var) ); ;} + +/* Line 1455 of yacc.c */ +#line 431 "parser.y" + { check_arg((yyvsp[(1) - (1)].var)); (yyval.var_list) = append_var( NULL, (yyvsp[(1) - (1)].var) ); ;} break; case 46: -#line 453 "parser.y" - { check_arg((yyvsp[0].var)); (yyval.var_list) = append_var( (yyvsp[-2].var_list), (yyvsp[0].var)); ;} + +/* Line 1455 of yacc.c */ +#line 432 "parser.y" + { check_arg((yyvsp[(3) - (3)].var)); (yyval.var_list) = append_var( (yyvsp[(1) - (3)].var_list), (yyvsp[(3) - (3)].var)); ;} break; case 48: -#line 458 "parser.y" - { (yyval.var) = (yyvsp[0].declarator)->var; - (yyval.var)->attrs = (yyvsp[-2].attr_list); - if ((yyvsp[-1].declspec)->stgclass != STG_NONE && (yyvsp[-1].declspec)->stgclass != STG_REGISTER) + +/* Line 1455 of yacc.c */ +#line 437 "parser.y" + { (yyval.var) = (yyvsp[(3) - (3)].declarator)->var; + (yyval.var)->attrs = (yyvsp[(1) - (3)].attr_list); + if ((yyvsp[(2) - (3)].declspec)->stgclass != STG_NONE && (yyvsp[(2) - (3)].declspec)->stgclass != STG_REGISTER) error_loc("invalid storage class for function parameter\n"); - set_type((yyval.var), (yyvsp[-1].declspec), (yyvsp[0].declarator), TRUE); - free((yyvsp[0].declarator)); + set_type((yyval.var), (yyvsp[(2) - (3)].declspec), (yyvsp[(3) - (3)].declarator), TRUE); + free((yyvsp[(3) - (3)].declarator)); ;} break; case 49: -#line 465 "parser.y" - { (yyval.var) = (yyvsp[0].declarator)->var; - if ((yyvsp[-1].declspec)->stgclass != STG_NONE && (yyvsp[-1].declspec)->stgclass != STG_REGISTER) + +/* Line 1455 of yacc.c */ +#line 444 "parser.y" + { (yyval.var) = (yyvsp[(2) - (2)].declarator)->var; + if ((yyvsp[(1) - (2)].declspec)->stgclass != STG_NONE && (yyvsp[(1) - (2)].declspec)->stgclass != STG_REGISTER) error_loc("invalid storage class for function parameter\n"); - set_type((yyval.var), (yyvsp[-1].declspec), (yyvsp[0].declarator), TRUE); - free((yyvsp[0].declarator)); + set_type((yyval.var), (yyvsp[(1) - (2)].declspec), (yyvsp[(2) - (2)].declarator), TRUE); + free((yyvsp[(2) - (2)].declarator)); ;} break; case 50: -#line 473 "parser.y" - { (yyval.expr) = (yyvsp[-1].expr); ;} + +/* Line 1455 of yacc.c */ +#line 452 "parser.y" + { (yyval.expr) = (yyvsp[(2) - (3)].expr); ;} break; case 51: -#line 474 "parser.y" + +/* Line 1455 of yacc.c */ +#line 453 "parser.y" { (yyval.expr) = make_expr(EXPR_VOID); ;} break; case 52: -#line 477 "parser.y" + +/* Line 1455 of yacc.c */ +#line 456 "parser.y" { (yyval.attr_list) = NULL; ;} break; case 54: -#line 482 "parser.y" - { (yyval.attr_list) = (yyvsp[-1].attr_list); ;} + +/* Line 1455 of yacc.c */ +#line 461 "parser.y" + { (yyval.attr_list) = (yyvsp[(2) - (3)].attr_list); ;} break; case 55: -#line 485 "parser.y" - { (yyval.attr_list) = append_attr( NULL, (yyvsp[0].attr) ); ;} + +/* Line 1455 of yacc.c */ +#line 464 "parser.y" + { (yyval.attr_list) = append_attr( NULL, (yyvsp[(1) - (1)].attr) ); ;} break; case 56: -#line 486 "parser.y" - { (yyval.attr_list) = append_attr( (yyvsp[-2].attr_list), (yyvsp[0].attr) ); ;} + +/* Line 1455 of yacc.c */ +#line 465 "parser.y" + { (yyval.attr_list) = append_attr( (yyvsp[(1) - (3)].attr_list), (yyvsp[(3) - (3)].attr) ); ;} break; case 57: -#line 487 "parser.y" - { (yyval.attr_list) = append_attr( (yyvsp[-3].attr_list), (yyvsp[0].attr) ); ;} + +/* Line 1455 of yacc.c */ +#line 466 "parser.y" + { (yyval.attr_list) = append_attr( (yyvsp[(1) - (4)].attr_list), (yyvsp[(4) - (4)].attr) ); ;} break; case 58: -#line 490 "parser.y" - { (yyval.str_list) = append_str( NULL, (yyvsp[0].str) ); ;} + +/* Line 1455 of yacc.c */ +#line 469 "parser.y" + { (yyval.str_list) = append_str( NULL, (yyvsp[(1) - (1)].str) ); ;} break; case 59: -#line 491 "parser.y" - { (yyval.str_list) = append_str( (yyvsp[-2].str_list), (yyvsp[0].str) ); ;} + +/* Line 1455 of yacc.c */ +#line 470 "parser.y" + { (yyval.str_list) = append_str( (yyvsp[(1) - (3)].str_list), (yyvsp[(3) - (3)].str) ); ;} break; case 60: -#line 494 "parser.y" + +/* Line 1455 of yacc.c */ +#line 473 "parser.y" { (yyval.attr) = NULL; ;} break; case 61: -#line 495 "parser.y" + +/* Line 1455 of yacc.c */ +#line 474 "parser.y" { (yyval.attr) = make_attr(ATTR_AGGREGATABLE); ;} break; case 62: -#line 496 "parser.y" + +/* Line 1455 of yacc.c */ +#line 475 "parser.y" { (yyval.attr) = make_attr(ATTR_APPOBJECT); ;} break; case 63: -#line 497 "parser.y" + +/* Line 1455 of yacc.c */ +#line 476 "parser.y" { (yyval.attr) = make_attr(ATTR_ASYNC); ;} break; case 64: -#line 498 "parser.y" + +/* Line 1455 of yacc.c */ +#line 477 "parser.y" { (yyval.attr) = make_attr(ATTR_AUTO_HANDLE); ;} break; case 65: -#line 499 "parser.y" + +/* Line 1455 of yacc.c */ +#line 478 "parser.y" { (yyval.attr) = make_attr(ATTR_BINDABLE); ;} break; case 66: -#line 500 "parser.y" + +/* Line 1455 of yacc.c */ +#line 479 "parser.y" { (yyval.attr) = make_attr(ATTR_BROADCAST); ;} break; case 67: -#line 501 "parser.y" - { (yyval.attr) = make_attrp(ATTR_CALLAS, (yyvsp[-1].var)); ;} + +/* Line 1455 of yacc.c */ +#line 480 "parser.y" + { (yyval.attr) = make_attrp(ATTR_CALLAS, (yyvsp[(3) - (4)].var)); ;} break; case 68: -#line 502 "parser.y" - { (yyval.attr) = make_attrp(ATTR_CASE, (yyvsp[-1].expr_list)); ;} + +/* Line 1455 of yacc.c */ +#line 481 "parser.y" + { (yyval.attr) = make_attrp(ATTR_CASE, (yyvsp[(3) - (4)].expr_list)); ;} break; case 69: -#line 503 "parser.y" + +/* Line 1455 of yacc.c */ +#line 482 "parser.y" { (yyval.attr) = make_attrv(ATTR_CONTEXTHANDLE, 0); ;} break; case 70: -#line 504 "parser.y" + +/* Line 1455 of yacc.c */ +#line 483 "parser.y" { (yyval.attr) = make_attrv(ATTR_CONTEXTHANDLE, 0); /* RPC_CONTEXT_HANDLE_DONT_SERIALIZE */ ;} break; case 71: -#line 505 "parser.y" + +/* Line 1455 of yacc.c */ +#line 484 "parser.y" { (yyval.attr) = make_attrv(ATTR_CONTEXTHANDLE, 0); /* RPC_CONTEXT_HANDLE_SERIALIZE */ ;} break; case 72: -#line 506 "parser.y" + +/* Line 1455 of yacc.c */ +#line 485 "parser.y" { (yyval.attr) = make_attr(ATTR_CONTROL); ;} break; case 73: -#line 507 "parser.y" + +/* Line 1455 of yacc.c */ +#line 486 "parser.y" { (yyval.attr) = make_attr(ATTR_DEFAULT); ;} break; case 74: -#line 508 "parser.y" + +/* Line 1455 of yacc.c */ +#line 487 "parser.y" { (yyval.attr) = make_attr(ATTR_DEFAULTCOLLELEM); ;} break; case 75: -#line 509 "parser.y" - { (yyval.attr) = make_attrp(ATTR_DEFAULTVALUE, (yyvsp[-1].expr)); ;} + +/* Line 1455 of yacc.c */ +#line 488 "parser.y" + { (yyval.attr) = make_attrp(ATTR_DEFAULTVALUE, (yyvsp[(3) - (4)].expr)); ;} break; case 76: -#line 510 "parser.y" + +/* Line 1455 of yacc.c */ +#line 489 "parser.y" { (yyval.attr) = make_attr(ATTR_DEFAULTVTABLE); ;} break; case 77: -#line 511 "parser.y" + +/* Line 1455 of yacc.c */ +#line 490 "parser.y" { (yyval.attr) = make_attr(ATTR_DISPLAYBIND); ;} break; case 78: -#line 512 "parser.y" - { (yyval.attr) = make_attrp(ATTR_DLLNAME, (yyvsp[-1].str)); ;} + +/* Line 1455 of yacc.c */ +#line 491 "parser.y" + { (yyval.attr) = make_attrp(ATTR_DLLNAME, (yyvsp[(3) - (4)].str)); ;} break; case 79: -#line 513 "parser.y" + +/* Line 1455 of yacc.c */ +#line 492 "parser.y" { (yyval.attr) = make_attr(ATTR_DUAL); ;} break; case 80: -#line 514 "parser.y" - { (yyval.attr) = make_attrp(ATTR_ENDPOINT, (yyvsp[-1].str_list)); ;} + +/* Line 1455 of yacc.c */ +#line 493 "parser.y" + { (yyval.attr) = make_attrp(ATTR_ENDPOINT, (yyvsp[(3) - (4)].str_list)); ;} break; case 81: -#line 515 "parser.y" - { (yyval.attr) = make_attrp(ATTR_ENTRY, (yyvsp[-1].expr)); ;} + +/* Line 1455 of yacc.c */ +#line 494 "parser.y" + { (yyval.attr) = make_attrp(ATTR_ENTRY, (yyvsp[(3) - (4)].expr)); ;} break; case 82: -#line 516 "parser.y" + +/* Line 1455 of yacc.c */ +#line 495 "parser.y" { (yyval.attr) = make_attr(ATTR_EXPLICIT_HANDLE); ;} break; case 83: -#line 517 "parser.y" + +/* Line 1455 of yacc.c */ +#line 496 "parser.y" { (yyval.attr) = make_attr(ATTR_HANDLE); ;} break; case 84: -#line 518 "parser.y" - { (yyval.attr) = make_attrp(ATTR_HELPCONTEXT, (yyvsp[-1].expr)); ;} + +/* Line 1455 of yacc.c */ +#line 497 "parser.y" + { (yyval.attr) = make_attrp(ATTR_HELPCONTEXT, (yyvsp[(3) - (4)].expr)); ;} break; case 85: -#line 519 "parser.y" - { (yyval.attr) = make_attrp(ATTR_HELPFILE, (yyvsp[-1].str)); ;} + +/* Line 1455 of yacc.c */ +#line 498 "parser.y" + { (yyval.attr) = make_attrp(ATTR_HELPFILE, (yyvsp[(3) - (4)].str)); ;} break; case 86: -#line 520 "parser.y" - { (yyval.attr) = make_attrp(ATTR_HELPSTRING, (yyvsp[-1].str)); ;} + +/* Line 1455 of yacc.c */ +#line 499 "parser.y" + { (yyval.attr) = make_attrp(ATTR_HELPSTRING, (yyvsp[(3) - (4)].str)); ;} break; case 87: -#line 521 "parser.y" - { (yyval.attr) = make_attrp(ATTR_HELPSTRINGCONTEXT, (yyvsp[-1].expr)); ;} + +/* Line 1455 of yacc.c */ +#line 500 "parser.y" + { (yyval.attr) = make_attrp(ATTR_HELPSTRINGCONTEXT, (yyvsp[(3) - (4)].expr)); ;} break; case 88: -#line 522 "parser.y" - { (yyval.attr) = make_attrp(ATTR_HELPSTRINGDLL, (yyvsp[-1].str)); ;} + +/* Line 1455 of yacc.c */ +#line 501 "parser.y" + { (yyval.attr) = make_attrp(ATTR_HELPSTRINGDLL, (yyvsp[(3) - (4)].str)); ;} break; case 89: -#line 523 "parser.y" + +/* Line 1455 of yacc.c */ +#line 502 "parser.y" { (yyval.attr) = make_attr(ATTR_HIDDEN); ;} break; case 90: -#line 524 "parser.y" - { (yyval.attr) = make_attrp(ATTR_ID, (yyvsp[-1].expr)); ;} + +/* Line 1455 of yacc.c */ +#line 503 "parser.y" + { (yyval.attr) = make_attrp(ATTR_ID, (yyvsp[(3) - (4)].expr)); ;} break; case 91: -#line 525 "parser.y" + +/* Line 1455 of yacc.c */ +#line 504 "parser.y" { (yyval.attr) = make_attr(ATTR_IDEMPOTENT); ;} break; case 92: -#line 526 "parser.y" - { (yyval.attr) = make_attrp(ATTR_IIDIS, (yyvsp[-1].expr)); ;} + +/* Line 1455 of yacc.c */ +#line 505 "parser.y" + { (yyval.attr) = make_attrp(ATTR_IIDIS, (yyvsp[(3) - (4)].expr)); ;} break; case 93: -#line 527 "parser.y" + +/* Line 1455 of yacc.c */ +#line 506 "parser.y" { (yyval.attr) = make_attr(ATTR_IMMEDIATEBIND); ;} break; case 94: -#line 528 "parser.y" - { (yyval.attr) = make_attrp(ATTR_IMPLICIT_HANDLE, (yyvsp[-1].str)); ;} + +/* Line 1455 of yacc.c */ +#line 507 "parser.y" + { (yyval.attr) = make_attrp(ATTR_IMPLICIT_HANDLE, (yyvsp[(4) - (5)].str)); ;} break; case 95: -#line 529 "parser.y" + +/* Line 1455 of yacc.c */ +#line 508 "parser.y" { (yyval.attr) = make_attr(ATTR_IN); ;} break; case 96: -#line 530 "parser.y" + +/* Line 1455 of yacc.c */ +#line 509 "parser.y" { (yyval.attr) = make_attr(ATTR_INPUTSYNC); ;} break; case 97: -#line 531 "parser.y" - { (yyval.attr) = make_attrp(ATTR_LENGTHIS, (yyvsp[-1].expr_list)); ;} + +/* Line 1455 of yacc.c */ +#line 510 "parser.y" + { (yyval.attr) = make_attrp(ATTR_LENGTHIS, (yyvsp[(3) - (4)].expr_list)); ;} break; case 98: -#line 532 "parser.y" - { (yyval.attr) = make_attrp(ATTR_LIBLCID, (yyvsp[-1].expr)); ;} + +/* Line 1455 of yacc.c */ +#line 511 "parser.y" + { (yyval.attr) = make_attrp(ATTR_LIBLCID, (yyvsp[(3) - (4)].expr)); ;} break; case 99: -#line 533 "parser.y" + +/* Line 1455 of yacc.c */ +#line 512 "parser.y" { (yyval.attr) = make_attr(ATTR_LOCAL); ;} break; case 100: -#line 534 "parser.y" + +/* Line 1455 of yacc.c */ +#line 513 "parser.y" { (yyval.attr) = make_attr(ATTR_NONBROWSABLE); ;} break; case 101: -#line 535 "parser.y" + +/* Line 1455 of yacc.c */ +#line 514 "parser.y" { (yyval.attr) = make_attr(ATTR_NONCREATABLE); ;} break; case 102: -#line 536 "parser.y" + +/* Line 1455 of yacc.c */ +#line 515 "parser.y" { (yyval.attr) = make_attr(ATTR_NONEXTENSIBLE); ;} break; case 103: -#line 537 "parser.y" + +/* Line 1455 of yacc.c */ +#line 516 "parser.y" { (yyval.attr) = make_attr(ATTR_OBJECT); ;} break; case 104: -#line 538 "parser.y" + +/* Line 1455 of yacc.c */ +#line 517 "parser.y" { (yyval.attr) = make_attr(ATTR_ODL); ;} break; case 105: -#line 539 "parser.y" + +/* Line 1455 of yacc.c */ +#line 518 "parser.y" { (yyval.attr) = make_attr(ATTR_OLEAUTOMATION); ;} break; case 106: -#line 540 "parser.y" + +/* Line 1455 of yacc.c */ +#line 519 "parser.y" { (yyval.attr) = make_attr(ATTR_OPTIONAL); ;} break; case 107: -#line 541 "parser.y" + +/* Line 1455 of yacc.c */ +#line 520 "parser.y" { (yyval.attr) = make_attr(ATTR_OUT); ;} break; case 108: -#line 542 "parser.y" - { (yyval.attr) = make_attrv(ATTR_POINTERDEFAULT, (yyvsp[-1].num)); ;} + +/* Line 1455 of yacc.c */ +#line 521 "parser.y" + { (yyval.attr) = make_attrv(ATTR_POINTERDEFAULT, (yyvsp[(3) - (4)].num)); ;} break; case 109: -#line 543 "parser.y" + +/* Line 1455 of yacc.c */ +#line 522 "parser.y" { (yyval.attr) = make_attr(ATTR_PROPGET); ;} break; case 110: -#line 544 "parser.y" + +/* Line 1455 of yacc.c */ +#line 523 "parser.y" { (yyval.attr) = make_attr(ATTR_PROPPUT); ;} break; case 111: -#line 545 "parser.y" + +/* Line 1455 of yacc.c */ +#line 524 "parser.y" { (yyval.attr) = make_attr(ATTR_PROPPUTREF); ;} break; case 112: -#line 546 "parser.y" + +/* Line 1455 of yacc.c */ +#line 525 "parser.y" { (yyval.attr) = make_attr(ATTR_PUBLIC); ;} break; case 113: -#line 548 "parser.y" - { expr_list_t *list = append_expr( NULL, (yyvsp[-3].expr) ); - list = append_expr( list, (yyvsp[-1].expr) ); + +/* Line 1455 of yacc.c */ +#line 527 "parser.y" + { expr_list_t *list = append_expr( NULL, (yyvsp[(3) - (6)].expr) ); + list = append_expr( list, (yyvsp[(5) - (6)].expr) ); (yyval.attr) = make_attrp(ATTR_RANGE, list); ;} break; case 114: -#line 551 "parser.y" + +/* Line 1455 of yacc.c */ +#line 530 "parser.y" { (yyval.attr) = make_attr(ATTR_READONLY); ;} break; case 115: -#line 552 "parser.y" + +/* Line 1455 of yacc.c */ +#line 531 "parser.y" { (yyval.attr) = make_attr(ATTR_REQUESTEDIT); ;} break; case 116: -#line 553 "parser.y" + +/* Line 1455 of yacc.c */ +#line 532 "parser.y" { (yyval.attr) = make_attr(ATTR_RESTRICTED); ;} break; case 117: -#line 554 "parser.y" + +/* Line 1455 of yacc.c */ +#line 533 "parser.y" { (yyval.attr) = make_attr(ATTR_RETVAL); ;} break; case 118: -#line 555 "parser.y" - { (yyval.attr) = make_attrp(ATTR_SIZEIS, (yyvsp[-1].expr_list)); ;} + +/* Line 1455 of yacc.c */ +#line 534 "parser.y" + { (yyval.attr) = make_attrp(ATTR_SIZEIS, (yyvsp[(3) - (4)].expr_list)); ;} break; case 119: -#line 556 "parser.y" + +/* Line 1455 of yacc.c */ +#line 535 "parser.y" { (yyval.attr) = make_attr(ATTR_SOURCE); ;} break; case 120: -#line 557 "parser.y" + +/* Line 1455 of yacc.c */ +#line 536 "parser.y" { (yyval.attr) = make_attr(ATTR_STRICTCONTEXTHANDLE); ;} break; case 121: -#line 558 "parser.y" + +/* Line 1455 of yacc.c */ +#line 537 "parser.y" { (yyval.attr) = make_attr(ATTR_STRING); ;} break; case 122: -#line 559 "parser.y" - { (yyval.attr) = make_attrp(ATTR_SWITCHIS, (yyvsp[-1].expr)); ;} + +/* Line 1455 of yacc.c */ +#line 538 "parser.y" + { (yyval.attr) = make_attrp(ATTR_SWITCHIS, (yyvsp[(3) - (4)].expr)); ;} break; case 123: -#line 560 "parser.y" - { (yyval.attr) = make_attrp(ATTR_SWITCHTYPE, (yyvsp[-1].type)); ;} + +/* Line 1455 of yacc.c */ +#line 539 "parser.y" + { (yyval.attr) = make_attrp(ATTR_SWITCHTYPE, (yyvsp[(3) - (4)].type)); ;} break; case 124: -#line 561 "parser.y" - { (yyval.attr) = make_attrp(ATTR_TRANSMITAS, (yyvsp[-1].type)); ;} + +/* Line 1455 of yacc.c */ +#line 540 "parser.y" + { (yyval.attr) = make_attrp(ATTR_TRANSMITAS, (yyvsp[(3) - (4)].type)); ;} break; case 125: -#line 562 "parser.y" - { (yyval.attr) = make_attrp(ATTR_UUID, (yyvsp[-1].uuid)); ;} + +/* Line 1455 of yacc.c */ +#line 541 "parser.y" + { (yyval.attr) = make_attrp(ATTR_UUID, (yyvsp[(3) - (4)].uuid)); ;} break; case 126: -#line 563 "parser.y" + +/* Line 1455 of yacc.c */ +#line 542 "parser.y" { (yyval.attr) = make_attr(ATTR_V1ENUM); ;} break; case 127: -#line 564 "parser.y" + +/* Line 1455 of yacc.c */ +#line 543 "parser.y" { (yyval.attr) = make_attr(ATTR_VARARG); ;} break; case 128: -#line 565 "parser.y" - { (yyval.attr) = make_attrv(ATTR_VERSION, (yyvsp[-1].num)); ;} + +/* Line 1455 of yacc.c */ +#line 544 "parser.y" + { (yyval.attr) = make_attrv(ATTR_VERSION, (yyvsp[(3) - (4)].num)); ;} break; case 129: -#line 566 "parser.y" - { (yyval.attr) = make_attrp(ATTR_WIREMARSHAL, (yyvsp[-1].type)); ;} + +/* Line 1455 of yacc.c */ +#line 545 "parser.y" + { (yyval.attr) = make_attrp(ATTR_WIREMARSHAL, (yyvsp[(3) - (4)].type)); ;} break; case 130: -#line 567 "parser.y" - { (yyval.attr) = make_attrv(ATTR_POINTERTYPE, (yyvsp[0].num)); ;} + +/* Line 1455 of yacc.c */ +#line 546 "parser.y" + { (yyval.attr) = make_attrv(ATTR_POINTERTYPE, (yyvsp[(1) - (1)].num)); ;} break; case 132: -#line 572 "parser.y" - { if (!is_valid_uuid((yyvsp[0].str))) - error_loc("invalid UUID: %s\n", (yyvsp[0].str)); - (yyval.uuid) = parse_uuid((yyvsp[0].str)); ;} + +/* Line 1455 of yacc.c */ +#line 551 "parser.y" + { if (!is_valid_uuid((yyvsp[(1) - (1)].str))) + error_loc("invalid UUID: %s\n", (yyvsp[(1) - (1)].str)); + (yyval.uuid) = parse_uuid((yyvsp[(1) - (1)].str)); ;} break; case 133: -#line 577 "parser.y" - { (yyval.str) = (yyvsp[0].str); ;} + +/* Line 1455 of yacc.c */ +#line 556 "parser.y" + { (yyval.str) = (yyvsp[(1) - (1)].str); ;} break; case 134: -#line 578 "parser.y" - { (yyval.str) = (yyvsp[0].str); ;} + +/* Line 1455 of yacc.c */ +#line 557 "parser.y" + { (yyval.str) = (yyvsp[(1) - (1)].str); ;} break; case 135: -#line 579 "parser.y" - { (yyval.str) = (yyvsp[0].str); ;} + +/* Line 1455 of yacc.c */ +#line 558 "parser.y" + { (yyval.str) = (yyvsp[(1) - (1)].str); ;} break; case 136: -#line 580 "parser.y" - { (yyval.str) = (yyvsp[0].str); ;} + +/* Line 1455 of yacc.c */ +#line 559 "parser.y" + { (yyval.str) = (yyvsp[(1) - (1)].str); ;} break; case 137: -#line 583 "parser.y" + +/* Line 1455 of yacc.c */ +#line 562 "parser.y" { (yyval.var_list) = NULL; ;} break; case 138: -#line 584 "parser.y" - { (yyval.var_list) = append_var( (yyvsp[-1].var_list), (yyvsp[0].var) ); ;} + +/* Line 1455 of yacc.c */ +#line 563 "parser.y" + { (yyval.var_list) = append_var( (yyvsp[(1) - (2)].var_list), (yyvsp[(2) - (2)].var) ); ;} break; case 139: -#line 587 "parser.y" - { attr_t *a = make_attrp(ATTR_CASE, append_expr( NULL, (yyvsp[-2].expr) )); - (yyval.var) = (yyvsp[0].var); if (!(yyval.var)) (yyval.var) = make_var(NULL); + +/* Line 1455 of yacc.c */ +#line 566 "parser.y" + { attr_t *a = make_attrp(ATTR_CASE, append_expr( NULL, (yyvsp[(2) - (4)].expr) )); + (yyval.var) = (yyvsp[(4) - (4)].var); if (!(yyval.var)) (yyval.var) = make_var(NULL); (yyval.var)->attrs = append_attr( (yyval.var)->attrs, a ); ;} break; case 140: -#line 591 "parser.y" + +/* Line 1455 of yacc.c */ +#line 570 "parser.y" { attr_t *a = make_attr(ATTR_DEFAULT); - (yyval.var) = (yyvsp[0].var); if (!(yyval.var)) (yyval.var) = make_var(NULL); + (yyval.var) = (yyvsp[(3) - (3)].var); if (!(yyval.var)) (yyval.var) = make_var(NULL); (yyval.var)->attrs = append_attr( (yyval.var)->attrs, a ); ;} break; case 141: -#line 597 "parser.y" + +/* Line 1455 of yacc.c */ +#line 576 "parser.y" { (yyval.var_list) = NULL; ;} break; case 142: -#line 598 "parser.y" - { (yyval.var_list) = (yyvsp[-1].var_list); ;} + +/* Line 1455 of yacc.c */ +#line 577 "parser.y" + { (yyval.var_list) = (yyvsp[(1) - (2)].var_list); ;} break; case 144: -#line 602 "parser.y" - { if (!(yyvsp[0].var)->eval) - (yyvsp[0].var)->eval = make_exprl(EXPR_NUM, 0 /* default for first enum entry */); - (yyval.var_list) = append_var( NULL, (yyvsp[0].var) ); + +/* Line 1455 of yacc.c */ +#line 581 "parser.y" + { if (!(yyvsp[(1) - (1)].var)->eval) + (yyvsp[(1) - (1)].var)->eval = make_exprl(EXPR_NUM, 0 /* default for first enum entry */); + (yyval.var_list) = append_var( NULL, (yyvsp[(1) - (1)].var) ); ;} break; case 145: -#line 606 "parser.y" - { if (!(yyvsp[0].var)->eval) + +/* Line 1455 of yacc.c */ +#line 585 "parser.y" + { if (!(yyvsp[(3) - (3)].var)->eval) { var_t *last = LIST_ENTRY( list_tail((yyval.var_list)), var_t, entry ); - (yyvsp[0].var)->eval = make_exprl(EXPR_NUM, last->eval->cval + 1); + (yyvsp[(3) - (3)].var)->eval = make_exprl(EXPR_NUM, last->eval->cval + 1); } - (yyval.var_list) = append_var( (yyvsp[-2].var_list), (yyvsp[0].var) ); + (yyval.var_list) = append_var( (yyvsp[(1) - (3)].var_list), (yyvsp[(3) - (3)].var) ); ;} break; case 146: -#line 615 "parser.y" - { (yyval.var) = reg_const((yyvsp[-2].var)); - (yyval.var)->eval = (yyvsp[0].expr); - (yyval.var)->type = make_int(0); + +/* Line 1455 of yacc.c */ +#line 594 "parser.y" + { (yyval.var) = reg_const((yyvsp[(1) - (3)].var)); + (yyval.var)->eval = (yyvsp[(3) - (3)].expr); + (yyval.var)->type = type_new_int(TYPE_BASIC_INT, 0); ;} break; case 147: -#line 619 "parser.y" - { (yyval.var) = reg_const((yyvsp[0].var)); - (yyval.var)->type = make_int(0); + +/* Line 1455 of yacc.c */ +#line 598 "parser.y" + { (yyval.var) = reg_const((yyvsp[(1) - (1)].var)); + (yyval.var)->type = type_new_int(TYPE_BASIC_INT, 0); ;} break; case 148: -#line 624 "parser.y" - { (yyval.type) = type_new_enum((yyvsp[-3].str), (yyvsp[-1].var_list)); ;} + +/* Line 1455 of yacc.c */ +#line 603 "parser.y" + { (yyval.type) = type_new_enum((yyvsp[(2) - (5)].str), TRUE, (yyvsp[(4) - (5)].var_list)); ;} break; case 149: -#line 627 "parser.y" - { (yyval.expr_list) = append_expr( NULL, (yyvsp[0].expr) ); ;} + +/* Line 1455 of yacc.c */ +#line 606 "parser.y" + { (yyval.expr_list) = append_expr( NULL, (yyvsp[(1) - (1)].expr) ); ;} break; case 150: -#line 628 "parser.y" - { (yyval.expr_list) = append_expr( (yyvsp[-2].expr_list), (yyvsp[0].expr) ); ;} + +/* Line 1455 of yacc.c */ +#line 607 "parser.y" + { (yyval.expr_list) = append_expr( (yyvsp[(1) - (3)].expr_list), (yyvsp[(3) - (3)].expr) ); ;} break; case 151: -#line 641 "parser.y" + +/* Line 1455 of yacc.c */ +#line 620 "parser.y" { (yyval.expr) = make_expr(EXPR_VOID); ;} break; case 153: -#line 645 "parser.y" - { (yyval.expr) = make_exprl(EXPR_NUM, (yyvsp[0].num)); ;} + +/* Line 1455 of yacc.c */ +#line 624 "parser.y" + { (yyval.expr) = make_exprl(EXPR_NUM, (yyvsp[(1) - (1)].num)); ;} break; case 154: -#line 646 "parser.y" - { (yyval.expr) = make_exprl(EXPR_HEXNUM, (yyvsp[0].num)); ;} + +/* Line 1455 of yacc.c */ +#line 625 "parser.y" + { (yyval.expr) = make_exprl(EXPR_HEXNUM, (yyvsp[(1) - (1)].num)); ;} break; case 155: -#line 647 "parser.y" - { (yyval.expr) = make_exprd(EXPR_DOUBLE, (yyvsp[0].dbl)); ;} + +/* Line 1455 of yacc.c */ +#line 626 "parser.y" + { (yyval.expr) = make_exprd(EXPR_DOUBLE, (yyvsp[(1) - (1)].dbl)); ;} break; case 156: -#line 648 "parser.y" + +/* Line 1455 of yacc.c */ +#line 627 "parser.y" { (yyval.expr) = make_exprl(EXPR_TRUEFALSE, 0); ;} break; case 157: -#line 649 "parser.y" + +/* Line 1455 of yacc.c */ +#line 628 "parser.y" { (yyval.expr) = make_exprl(EXPR_NUM, 0); ;} break; case 158: -#line 650 "parser.y" + +/* Line 1455 of yacc.c */ +#line 629 "parser.y" { (yyval.expr) = make_exprl(EXPR_TRUEFALSE, 1); ;} break; case 159: -#line 651 "parser.y" - { (yyval.expr) = make_exprs(EXPR_STRLIT, (yyvsp[0].str)); ;} + +/* Line 1455 of yacc.c */ +#line 630 "parser.y" + { (yyval.expr) = make_exprs(EXPR_STRLIT, (yyvsp[(1) - (1)].str)); ;} break; case 160: -#line 652 "parser.y" - { (yyval.expr) = make_exprs(EXPR_WSTRLIT, (yyvsp[0].str)); ;} + +/* Line 1455 of yacc.c */ +#line 631 "parser.y" + { (yyval.expr) = make_exprs(EXPR_WSTRLIT, (yyvsp[(1) - (1)].str)); ;} break; case 161: -#line 653 "parser.y" - { (yyval.expr) = make_exprs(EXPR_IDENTIFIER, (yyvsp[0].str)); ;} + +/* Line 1455 of yacc.c */ +#line 632 "parser.y" + { (yyval.expr) = make_exprs(EXPR_IDENTIFIER, (yyvsp[(1) - (1)].str)); ;} break; case 162: -#line 654 "parser.y" - { (yyval.expr) = make_expr3(EXPR_COND, (yyvsp[-4].expr), (yyvsp[-2].expr), (yyvsp[0].expr)); ;} + +/* Line 1455 of yacc.c */ +#line 633 "parser.y" + { (yyval.expr) = make_expr3(EXPR_COND, (yyvsp[(1) - (5)].expr), (yyvsp[(3) - (5)].expr), (yyvsp[(5) - (5)].expr)); ;} break; case 163: -#line 655 "parser.y" - { (yyval.expr) = make_expr2(EXPR_LOGOR, (yyvsp[-2].expr), (yyvsp[0].expr)); ;} + +/* Line 1455 of yacc.c */ +#line 634 "parser.y" + { (yyval.expr) = make_expr2(EXPR_LOGOR, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;} break; case 164: -#line 656 "parser.y" - { (yyval.expr) = make_expr2(EXPR_LOGAND, (yyvsp[-2].expr), (yyvsp[0].expr)); ;} + +/* Line 1455 of yacc.c */ +#line 635 "parser.y" + { (yyval.expr) = make_expr2(EXPR_LOGAND, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;} break; case 165: -#line 657 "parser.y" - { (yyval.expr) = make_expr2(EXPR_OR , (yyvsp[-2].expr), (yyvsp[0].expr)); ;} + +/* Line 1455 of yacc.c */ +#line 636 "parser.y" + { (yyval.expr) = make_expr2(EXPR_OR , (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;} break; case 166: -#line 658 "parser.y" - { (yyval.expr) = make_expr2(EXPR_XOR, (yyvsp[-2].expr), (yyvsp[0].expr)); ;} + +/* Line 1455 of yacc.c */ +#line 637 "parser.y" + { (yyval.expr) = make_expr2(EXPR_XOR, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;} break; case 167: -#line 659 "parser.y" - { (yyval.expr) = make_expr2(EXPR_AND, (yyvsp[-2].expr), (yyvsp[0].expr)); ;} + +/* Line 1455 of yacc.c */ +#line 638 "parser.y" + { (yyval.expr) = make_expr2(EXPR_AND, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;} break; case 168: -#line 660 "parser.y" - { (yyval.expr) = make_expr2(EXPR_EQUALITY, (yyvsp[-2].expr), (yyvsp[0].expr)); ;} + +/* Line 1455 of yacc.c */ +#line 639 "parser.y" + { (yyval.expr) = make_expr2(EXPR_EQUALITY, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;} break; case 169: -#line 661 "parser.y" - { (yyval.expr) = make_expr2(EXPR_INEQUALITY, (yyvsp[-2].expr), (yyvsp[0].expr)); ;} + +/* Line 1455 of yacc.c */ +#line 640 "parser.y" + { (yyval.expr) = make_expr2(EXPR_INEQUALITY, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;} break; case 170: -#line 662 "parser.y" - { (yyval.expr) = make_expr2(EXPR_GTR, (yyvsp[-2].expr), (yyvsp[0].expr)); ;} + +/* Line 1455 of yacc.c */ +#line 641 "parser.y" + { (yyval.expr) = make_expr2(EXPR_GTR, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;} break; case 171: -#line 663 "parser.y" - { (yyval.expr) = make_expr2(EXPR_LESS, (yyvsp[-2].expr), (yyvsp[0].expr)); ;} + +/* Line 1455 of yacc.c */ +#line 642 "parser.y" + { (yyval.expr) = make_expr2(EXPR_LESS, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;} break; case 172: -#line 664 "parser.y" - { (yyval.expr) = make_expr2(EXPR_GTREQL, (yyvsp[-2].expr), (yyvsp[0].expr)); ;} + +/* Line 1455 of yacc.c */ +#line 643 "parser.y" + { (yyval.expr) = make_expr2(EXPR_GTREQL, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;} break; case 173: -#line 665 "parser.y" - { (yyval.expr) = make_expr2(EXPR_LESSEQL, (yyvsp[-2].expr), (yyvsp[0].expr)); ;} + +/* Line 1455 of yacc.c */ +#line 644 "parser.y" + { (yyval.expr) = make_expr2(EXPR_LESSEQL, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;} break; case 174: -#line 666 "parser.y" - { (yyval.expr) = make_expr2(EXPR_SHL, (yyvsp[-2].expr), (yyvsp[0].expr)); ;} + +/* Line 1455 of yacc.c */ +#line 645 "parser.y" + { (yyval.expr) = make_expr2(EXPR_SHL, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;} break; case 175: -#line 667 "parser.y" - { (yyval.expr) = make_expr2(EXPR_SHR, (yyvsp[-2].expr), (yyvsp[0].expr)); ;} + +/* Line 1455 of yacc.c */ +#line 646 "parser.y" + { (yyval.expr) = make_expr2(EXPR_SHR, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;} break; case 176: -#line 668 "parser.y" - { (yyval.expr) = make_expr2(EXPR_ADD, (yyvsp[-2].expr), (yyvsp[0].expr)); ;} + +/* Line 1455 of yacc.c */ +#line 647 "parser.y" + { (yyval.expr) = make_expr2(EXPR_ADD, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;} break; case 177: -#line 669 "parser.y" - { (yyval.expr) = make_expr2(EXPR_SUB, (yyvsp[-2].expr), (yyvsp[0].expr)); ;} + +/* Line 1455 of yacc.c */ +#line 648 "parser.y" + { (yyval.expr) = make_expr2(EXPR_SUB, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;} break; case 178: -#line 670 "parser.y" - { (yyval.expr) = make_expr2(EXPR_MOD, (yyvsp[-2].expr), (yyvsp[0].expr)); ;} + +/* Line 1455 of yacc.c */ +#line 649 "parser.y" + { (yyval.expr) = make_expr2(EXPR_MOD, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;} break; case 179: -#line 671 "parser.y" - { (yyval.expr) = make_expr2(EXPR_MUL, (yyvsp[-2].expr), (yyvsp[0].expr)); ;} + +/* Line 1455 of yacc.c */ +#line 650 "parser.y" + { (yyval.expr) = make_expr2(EXPR_MUL, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;} break; case 180: -#line 672 "parser.y" - { (yyval.expr) = make_expr2(EXPR_DIV, (yyvsp[-2].expr), (yyvsp[0].expr)); ;} + +/* Line 1455 of yacc.c */ +#line 651 "parser.y" + { (yyval.expr) = make_expr2(EXPR_DIV, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;} break; case 181: -#line 673 "parser.y" - { (yyval.expr) = make_expr1(EXPR_LOGNOT, (yyvsp[0].expr)); ;} + +/* Line 1455 of yacc.c */ +#line 652 "parser.y" + { (yyval.expr) = make_expr1(EXPR_LOGNOT, (yyvsp[(2) - (2)].expr)); ;} break; case 182: -#line 674 "parser.y" - { (yyval.expr) = make_expr1(EXPR_NOT, (yyvsp[0].expr)); ;} + +/* Line 1455 of yacc.c */ +#line 653 "parser.y" + { (yyval.expr) = make_expr1(EXPR_NOT, (yyvsp[(2) - (2)].expr)); ;} break; case 183: -#line 675 "parser.y" - { (yyval.expr) = make_expr1(EXPR_POS, (yyvsp[0].expr)); ;} + +/* Line 1455 of yacc.c */ +#line 654 "parser.y" + { (yyval.expr) = make_expr1(EXPR_POS, (yyvsp[(2) - (2)].expr)); ;} break; case 184: -#line 676 "parser.y" - { (yyval.expr) = make_expr1(EXPR_NEG, (yyvsp[0].expr)); ;} + +/* Line 1455 of yacc.c */ +#line 655 "parser.y" + { (yyval.expr) = make_expr1(EXPR_NEG, (yyvsp[(2) - (2)].expr)); ;} break; case 185: -#line 677 "parser.y" - { (yyval.expr) = make_expr1(EXPR_ADDRESSOF, (yyvsp[0].expr)); ;} + +/* Line 1455 of yacc.c */ +#line 656 "parser.y" + { (yyval.expr) = make_expr1(EXPR_ADDRESSOF, (yyvsp[(2) - (2)].expr)); ;} break; case 186: -#line 678 "parser.y" - { (yyval.expr) = make_expr1(EXPR_PPTR, (yyvsp[0].expr)); ;} + +/* Line 1455 of yacc.c */ +#line 657 "parser.y" + { (yyval.expr) = make_expr1(EXPR_PPTR, (yyvsp[(2) - (2)].expr)); ;} break; case 187: -#line 679 "parser.y" - { (yyval.expr) = make_expr2(EXPR_MEMBER, make_expr1(EXPR_PPTR, (yyvsp[-2].expr)), make_exprs(EXPR_IDENTIFIER, (yyvsp[0].str))); ;} + +/* Line 1455 of yacc.c */ +#line 658 "parser.y" + { (yyval.expr) = make_expr2(EXPR_MEMBER, make_expr1(EXPR_PPTR, (yyvsp[(1) - (3)].expr)), make_exprs(EXPR_IDENTIFIER, (yyvsp[(3) - (3)].str))); ;} break; case 188: -#line 680 "parser.y" - { (yyval.expr) = make_expr2(EXPR_MEMBER, (yyvsp[-2].expr), make_exprs(EXPR_IDENTIFIER, (yyvsp[0].str))); ;} + +/* Line 1455 of yacc.c */ +#line 659 "parser.y" + { (yyval.expr) = make_expr2(EXPR_MEMBER, (yyvsp[(1) - (3)].expr), make_exprs(EXPR_IDENTIFIER, (yyvsp[(3) - (3)].str))); ;} break; case 189: -#line 681 "parser.y" - { (yyval.expr) = make_exprt(EXPR_CAST, (yyvsp[-2].type), (yyvsp[0].expr)); ;} + +/* Line 1455 of yacc.c */ +#line 660 "parser.y" + { (yyval.expr) = make_exprt(EXPR_CAST, (yyvsp[(2) - (4)].type), (yyvsp[(4) - (4)].expr)); ;} break; case 190: -#line 682 "parser.y" - { (yyval.expr) = make_exprt(EXPR_SIZEOF, (yyvsp[-1].type), NULL); ;} + +/* Line 1455 of yacc.c */ +#line 661 "parser.y" + { (yyval.expr) = make_exprt(EXPR_SIZEOF, (yyvsp[(3) - (4)].type), NULL); ;} break; case 191: -#line 683 "parser.y" - { (yyval.expr) = make_expr2(EXPR_ARRAY, (yyvsp[-3].expr), (yyvsp[-1].expr)); ;} + +/* Line 1455 of yacc.c */ +#line 662 "parser.y" + { (yyval.expr) = make_expr2(EXPR_ARRAY, (yyvsp[(1) - (4)].expr), (yyvsp[(3) - (4)].expr)); ;} break; case 192: -#line 684 "parser.y" - { (yyval.expr) = (yyvsp[-1].expr); ;} + +/* Line 1455 of yacc.c */ +#line 663 "parser.y" + { (yyval.expr) = (yyvsp[(2) - (3)].expr); ;} break; case 193: -#line 687 "parser.y" - { (yyval.expr_list) = append_expr( NULL, (yyvsp[0].expr) ); ;} + +/* Line 1455 of yacc.c */ +#line 666 "parser.y" + { (yyval.expr_list) = append_expr( NULL, (yyvsp[(1) - (1)].expr) ); ;} break; case 194: -#line 688 "parser.y" - { (yyval.expr_list) = append_expr( (yyvsp[-2].expr_list), (yyvsp[0].expr) ); ;} + +/* Line 1455 of yacc.c */ +#line 667 "parser.y" + { (yyval.expr_list) = append_expr( (yyvsp[(1) - (3)].expr_list), (yyvsp[(3) - (3)].expr) ); ;} break; case 195: -#line 691 "parser.y" - { (yyval.expr) = (yyvsp[0].expr); + +/* Line 1455 of yacc.c */ +#line 670 "parser.y" + { (yyval.expr) = (yyvsp[(1) - (1)].expr); if (!(yyval.expr)->is_const) error_loc("expression is not an integer constant\n"); ;} break; case 196: -#line 697 "parser.y" - { (yyval.expr) = (yyvsp[0].expr); + +/* Line 1455 of yacc.c */ +#line 676 "parser.y" + { (yyval.expr) = (yyvsp[(1) - (1)].expr); if (!(yyval.expr)->is_const && (yyval.expr)->type != EXPR_STRLIT && (yyval.expr)->type != EXPR_WSTRLIT) error_loc("expression is not constant\n"); ;} break; case 197: -#line 703 "parser.y" + +/* Line 1455 of yacc.c */ +#line 682 "parser.y" { (yyval.var_list) = NULL; ;} break; case 198: -#line 704 "parser.y" - { (yyval.var_list) = append_var_list((yyvsp[-1].var_list), (yyvsp[0].var_list)); ;} + +/* Line 1455 of yacc.c */ +#line 683 "parser.y" + { (yyval.var_list) = append_var_list((yyvsp[(1) - (2)].var_list), (yyvsp[(2) - (2)].var_list)); ;} break; case 199: -#line 708 "parser.y" - { const char *first = LIST_ENTRY(list_head((yyvsp[-1].declarator_list)), declarator_t, entry)->var->name; - check_field_attrs(first, (yyvsp[-3].attr_list)); - (yyval.var_list) = set_var_types((yyvsp[-3].attr_list), (yyvsp[-2].declspec), (yyvsp[-1].declarator_list)); + +/* Line 1455 of yacc.c */ +#line 687 "parser.y" + { const char *first = LIST_ENTRY(list_head((yyvsp[(3) - (4)].declarator_list)), declarator_t, entry)->var->name; + check_field_attrs(first, (yyvsp[(1) - (4)].attr_list)); + (yyval.var_list) = set_var_types((yyvsp[(1) - (4)].attr_list), (yyvsp[(2) - (4)].declspec), (yyvsp[(3) - (4)].declarator_list)); ;} break; case 200: -#line 712 "parser.y" + +/* Line 1455 of yacc.c */ +#line 691 "parser.y" { var_t *v = make_var(NULL); - v->type = (yyvsp[-1].type); v->attrs = (yyvsp[-2].attr_list); + v->type = (yyvsp[(2) - (3)].type); v->attrs = (yyvsp[(1) - (3)].attr_list); (yyval.var_list) = append_var(NULL, v); ;} break; case 201: -#line 719 "parser.y" - { (yyval.var) = (yyvsp[-1].var); ;} + +/* Line 1455 of yacc.c */ +#line 698 "parser.y" + { (yyval.var) = (yyvsp[(1) - (2)].var); ;} break; case 202: -#line 720 "parser.y" - { (yyval.var) = make_var(NULL); (yyval.var)->attrs = (yyvsp[-1].attr_list); ;} + +/* Line 1455 of yacc.c */ +#line 699 "parser.y" + { (yyval.var) = make_var(NULL); (yyval.var)->attrs = (yyvsp[(1) - (2)].attr_list); ;} break; case 203: -#line 723 "parser.y" + +/* Line 1455 of yacc.c */ +#line 702 "parser.y" { (yyval.var_list) = NULL; ;} break; case 204: -#line 724 "parser.y" - { (yyval.var_list) = append_var( (yyvsp[-1].var_list), (yyvsp[0].var) ); ;} + +/* Line 1455 of yacc.c */ +#line 703 "parser.y" + { (yyval.var_list) = append_var( (yyvsp[(1) - (2)].var_list), (yyvsp[(2) - (2)].var) ); ;} break; case 205: -#line 728 "parser.y" - { (yyval.var) = (yyvsp[-1].var); ;} + +/* Line 1455 of yacc.c */ +#line 707 "parser.y" + { (yyval.var) = (yyvsp[(1) - (2)].var); ;} break; case 206: -#line 729 "parser.y" + +/* Line 1455 of yacc.c */ +#line 708 "parser.y" { (yyval.var) = NULL; ;} break; case 207: -#line 732 "parser.y" - { (yyval.var) = (yyvsp[0].declarator)->var; - (yyval.var)->attrs = check_field_attrs((yyval.var)->name, (yyvsp[-2].attr_list)); - set_type((yyval.var), (yyvsp[-1].declspec), (yyvsp[0].declarator), FALSE); - free((yyvsp[0].declarator)); + +/* Line 1455 of yacc.c */ +#line 711 "parser.y" + { (yyval.var) = (yyvsp[(3) - (3)].declarator)->var; + (yyval.var)->attrs = check_field_attrs((yyval.var)->name, (yyvsp[(1) - (3)].attr_list)); + set_type((yyval.var), (yyvsp[(2) - (3)].declspec), (yyvsp[(3) - (3)].declarator), FALSE); + free((yyvsp[(3) - (3)].declarator)); ;} break; case 208: -#line 740 "parser.y" - { var_t *v = (yyvsp[0].declarator)->var; - v->attrs = check_function_attrs(v->name, (yyvsp[-2].attr_list)); - set_type(v, (yyvsp[-1].declspec), (yyvsp[0].declarator), FALSE); - free((yyvsp[0].declarator)); + +/* Line 1455 of yacc.c */ +#line 719 "parser.y" + { var_t *v = (yyvsp[(3) - (3)].declarator)->var; + v->attrs = check_function_attrs(v->name, (yyvsp[(1) - (3)].attr_list)); + set_type(v, (yyvsp[(2) - (3)].declspec), (yyvsp[(3) - (3)].declarator), FALSE); + free((yyvsp[(3) - (3)].declarator)); (yyval.func) = make_func(v); ;} break; case 209: -#line 750 "parser.y" - { (yyval.var) = (yyvsp[0].declarator)->var; - (yyval.var)->attrs = (yyvsp[-2].attr_list); - set_type((yyval.var), (yyvsp[-1].declspec), (yyvsp[0].declarator), FALSE); - free((yyvsp[0].declarator)); + +/* Line 1455 of yacc.c */ +#line 729 "parser.y" + { (yyval.var) = (yyvsp[(3) - (3)].declarator)->var; + (yyval.var)->attrs = (yyvsp[(1) - (3)].attr_list); + set_type((yyval.var), (yyvsp[(2) - (3)].declspec), (yyvsp[(3) - (3)].declarator), FALSE); + free((yyvsp[(3) - (3)].declarator)); ;} break; case 210: -#line 755 "parser.y" - { (yyval.var) = (yyvsp[0].declarator)->var; - set_type((yyval.var), (yyvsp[-1].declspec), (yyvsp[0].declarator), FALSE); - free((yyvsp[0].declarator)); + +/* Line 1455 of yacc.c */ +#line 734 "parser.y" + { (yyval.var) = (yyvsp[(2) - (2)].declarator)->var; + set_type((yyval.var), (yyvsp[(1) - (2)].declspec), (yyvsp[(2) - (2)].declarator), FALSE); + free((yyvsp[(2) - (2)].declarator)); ;} break; case 211: -#line 761 "parser.y" + +/* Line 1455 of yacc.c */ +#line 740 "parser.y" { (yyval.var) = NULL; ;} break; case 213: -#line 765 "parser.y" + +/* Line 1455 of yacc.c */ +#line 744 "parser.y" { (yyval.str) = NULL; ;} break; case 214: -#line 766 "parser.y" - { (yyval.str) = (yyvsp[0].str); ;} + +/* Line 1455 of yacc.c */ +#line 745 "parser.y" + { (yyval.str) = (yyvsp[(1) - (1)].str); ;} break; case 215: -#line 767 "parser.y" - { (yyval.str) = (yyvsp[0].str); ;} + +/* Line 1455 of yacc.c */ +#line 746 "parser.y" + { (yyval.str) = (yyvsp[(1) - (1)].str); ;} break; case 216: -#line 770 "parser.y" - { (yyval.var) = make_var((yyvsp[0].str)); ;} + +/* Line 1455 of yacc.c */ +#line 749 "parser.y" + { (yyval.var) = make_var((yyvsp[(1) - (1)].str)); ;} break; case 217: -#line 772 "parser.y" - { (yyval.var) = make_var((yyvsp[0].str)); ;} + +/* Line 1455 of yacc.c */ +#line 751 "parser.y" + { (yyval.var) = make_var((yyvsp[(1) - (1)].str)); ;} break; case 218: -#line 775 "parser.y" - { (yyval.type) = make_builtin((yyvsp[0].str)); ;} + +/* Line 1455 of yacc.c */ +#line 754 "parser.y" + { (yyval.type) = find_type_or_error((yyvsp[(1) - (1)].str), 0); ;} break; case 219: -#line 776 "parser.y" - { (yyval.type) = make_builtin((yyvsp[0].str)); ;} + +/* Line 1455 of yacc.c */ +#line 755 "parser.y" + { (yyval.type) = find_type_or_error((yyvsp[(1) - (1)].str), 0); ;} break; case 221: -#line 778 "parser.y" - { (yyval.type) = (yyvsp[0].type); (yyval.type)->sign = 1; ;} + +/* Line 1455 of yacc.c */ +#line 757 "parser.y" + { (yyval.type) = type_new_int(type_basic_get_type((yyvsp[(2) - (2)].type)), -1); ;} break; case 222: -#line 779 "parser.y" - { (yyval.type) = (yyvsp[0].type); (yyval.type)->sign = -1; - switch ((yyval.type)->type) { - case RPC_FC_CHAR: break; - case RPC_FC_SMALL: (yyval.type)->type = RPC_FC_USMALL; break; - case RPC_FC_SHORT: (yyval.type)->type = RPC_FC_USHORT; break; - case RPC_FC_LONG: (yyval.type)->type = RPC_FC_ULONG; break; - case RPC_FC_HYPER: - if ((yyval.type)->name[0] == 'h') /* hyper, as opposed to __int64 */ - { - (yyval.type) = type_new_alias((yyval.type), "MIDL_uhyper"); - (yyval.type)->sign = 0; - } - break; - default: break; - } - ;} + +/* Line 1455 of yacc.c */ +#line 758 "parser.y" + { (yyval.type) = type_new_int(type_basic_get_type((yyvsp[(2) - (2)].type)), 1); ;} break; case 223: -#line 795 "parser.y" - { (yyval.type) = make_int(-1); ;} + +/* Line 1455 of yacc.c */ +#line 759 "parser.y" + { (yyval.type) = type_new_int(TYPE_BASIC_INT, 1); ;} break; case 224: -#line 796 "parser.y" - { (yyval.type) = make_builtin((yyvsp[0].str)); ;} + +/* Line 1455 of yacc.c */ +#line 760 "parser.y" + { (yyval.type) = find_type_or_error((yyvsp[(1) - (1)].str), 0); ;} break; case 225: -#line 797 "parser.y" - { (yyval.type) = find_type("float", 0); ;} + +/* Line 1455 of yacc.c */ +#line 761 "parser.y" + { (yyval.type) = find_type_or_error((yyvsp[(1) - (1)].str), 0); ;} break; case 226: -#line 798 "parser.y" - { (yyval.type) = make_builtin((yyvsp[0].str)); ;} + +/* Line 1455 of yacc.c */ +#line 762 "parser.y" + { (yyval.type) = find_type_or_error((yyvsp[(1) - (1)].str), 0); ;} break; case 227: -#line 799 "parser.y" - { (yyval.type) = make_builtin((yyvsp[0].str)); ;} + +/* Line 1455 of yacc.c */ +#line 763 "parser.y" + { (yyval.type) = find_type_or_error((yyvsp[(1) - (1)].str), 0); ;} break; case 228: -#line 800 "parser.y" - { (yyval.type) = make_builtin((yyvsp[0].str)); ;} + +/* Line 1455 of yacc.c */ +#line 764 "parser.y" + { (yyval.type) = find_type_or_error((yyvsp[(1) - (1)].str), 0); ;} break; - case 229: -#line 801 "parser.y" - { (yyval.type) = make_builtin((yyvsp[0].str)); ;} + case 231: + +/* Line 1455 of yacc.c */ +#line 771 "parser.y" + { (yyval.type) = type_new_int(TYPE_BASIC_INT, 0); ;} break; case 232: -#line 808 "parser.y" - { (yyval.type) = make_builtin((yyvsp[0].str)); ;} + +/* Line 1455 of yacc.c */ +#line 772 "parser.y" + { (yyval.type) = type_new_int(TYPE_BASIC_INT16, 0); ;} break; case 233: -#line 809 "parser.y" - { (yyval.type) = make_builtin((yyvsp[-1].str)); ;} + +/* Line 1455 of yacc.c */ +#line 773 "parser.y" + { (yyval.type) = type_new_int(TYPE_BASIC_INT8, 0); ;} break; case 234: -#line 810 "parser.y" - { (yyval.type) = make_builtin((yyvsp[0].str)); ;} + +/* Line 1455 of yacc.c */ +#line 774 "parser.y" + { (yyval.type) = type_new_int(TYPE_BASIC_INT32, 0); ;} break; case 235: -#line 811 "parser.y" - { (yyval.type) = make_builtin((yyvsp[-1].str)); ;} + +/* Line 1455 of yacc.c */ +#line 775 "parser.y" + { (yyval.type) = type_new_int(TYPE_BASIC_HYPER, 0); ;} break; case 236: -#line 812 "parser.y" - { (yyval.type) = make_builtin((yyvsp[-1].str)); ;} + +/* Line 1455 of yacc.c */ +#line 776 "parser.y" + { (yyval.type) = type_new_int(TYPE_BASIC_INT64, 0); ;} break; case 237: -#line 813 "parser.y" - { (yyval.type) = make_builtin((yyvsp[0].str)); ;} + +/* Line 1455 of yacc.c */ +#line 777 "parser.y" + { (yyval.type) = type_new_int(TYPE_BASIC_CHAR, 0); ;} break; case 238: -#line 814 "parser.y" - { (yyval.type) = make_builtin((yyvsp[0].str)); ;} + +/* Line 1455 of yacc.c */ +#line 780 "parser.y" + { (yyval.type) = type_new_coclass((yyvsp[(2) - (2)].str)); ;} break; case 239: -#line 817 "parser.y" - { (yyval.type) = make_class((yyvsp[0].str)); ;} - break; - case 240: -#line 818 "parser.y" - { (yyval.type) = find_type((yyvsp[0].str), 0); - if ((yyval.type)->type != RPC_FC_COCLASS) +/* Line 1455 of yacc.c */ +#line 781 "parser.y" + { (yyval.type) = find_type((yyvsp[(2) - (2)].str), 0); + if (type_get_type_detect_alias((yyval.type)) != TYPE_COCLASS) error_loc("%s was not declared a coclass at %s:%d\n", - (yyvsp[0].str), (yyval.type)->loc_info.input_name, + (yyvsp[(2) - (2)].str), (yyval.type)->loc_info.input_name, (yyval.type)->loc_info.line_number); ;} break; - case 241: -#line 826 "parser.y" - { (yyval.type) = (yyvsp[0].type); + case 240: + +/* Line 1455 of yacc.c */ +#line 789 "parser.y" + { (yyval.type) = (yyvsp[(2) - (2)].type); check_def((yyval.type)); - (yyval.type)->attrs = check_coclass_attrs((yyvsp[0].type)->name, (yyvsp[-1].attr_list)); + (yyval.type)->attrs = check_coclass_attrs((yyvsp[(2) - (2)].type)->name, (yyvsp[(1) - (2)].attr_list)); ;} break; - case 242: -#line 833 "parser.y" - { (yyval.type) = type_coclass_define((yyvsp[-4].type), (yyvsp[-2].ifref_list)); ;} + case 241: + +/* Line 1455 of yacc.c */ +#line 796 "parser.y" + { (yyval.type) = type_coclass_define((yyvsp[(1) - (5)].type), (yyvsp[(3) - (5)].ifref_list)); ;} break; - case 243: -#line 836 "parser.y" + case 242: + +/* Line 1455 of yacc.c */ +#line 799 "parser.y" { (yyval.ifref_list) = NULL; ;} break; + case 243: + +/* Line 1455 of yacc.c */ +#line 800 "parser.y" + { (yyval.ifref_list) = append_ifref( (yyvsp[(1) - (2)].ifref_list), (yyvsp[(2) - (2)].ifref) ); ;} + break; + case 244: -#line 837 "parser.y" - { (yyval.ifref_list) = append_ifref( (yyvsp[-1].ifref_list), (yyvsp[0].ifref) ); ;} + +/* Line 1455 of yacc.c */ +#line 804 "parser.y" + { (yyval.ifref) = make_ifref((yyvsp[(2) - (2)].type)); (yyval.ifref)->attrs = (yyvsp[(1) - (2)].attr_list); ;} break; case 245: -#line 841 "parser.y" - { (yyval.ifref) = make_ifref((yyvsp[0].type)); (yyval.ifref)->attrs = (yyvsp[-1].attr_list); ;} + +/* Line 1455 of yacc.c */ +#line 807 "parser.y" + { (yyval.type) = get_type(TYPE_INTERFACE, (yyvsp[(2) - (2)].str), 0); ;} break; case 246: -#line 844 "parser.y" - { (yyval.type) = get_type(RPC_FC_IP, (yyvsp[0].str), 0); ;} + +/* Line 1455 of yacc.c */ +#line 808 "parser.y" + { (yyval.type) = get_type(TYPE_INTERFACE, (yyvsp[(2) - (2)].str), 0); ;} break; case 247: -#line 845 "parser.y" - { (yyval.type) = get_type(RPC_FC_IP, (yyvsp[0].str), 0); ;} - break; - case 248: -#line 848 "parser.y" +/* Line 1455 of yacc.c */ +#line 811 "parser.y" { attr_t *attrs; is_object_interface = TRUE; - (yyval.type) = (yyvsp[0].type); + (yyval.type) = (yyvsp[(2) - (2)].type); check_def((yyval.type)); attrs = make_attr(ATTR_DISPINTERFACE); - (yyval.type)->attrs = append_attr( check_dispiface_attrs((yyvsp[0].type)->name, (yyvsp[-1].attr_list)), attrs ); + (yyval.type)->attrs = append_attr( check_dispiface_attrs((yyvsp[(2) - (2)].type)->name, (yyvsp[(1) - (2)].attr_list)), attrs ); (yyval.type)->defined = TRUE; ;} break; - case 249: -#line 858 "parser.y" + case 248: + +/* Line 1455 of yacc.c */ +#line 821 "parser.y" { (yyval.var_list) = NULL; ;} break; - case 250: -#line 859 "parser.y" - { (yyval.var_list) = append_var( (yyvsp[-2].var_list), (yyvsp[-1].var) ); ;} + case 249: + +/* Line 1455 of yacc.c */ +#line 822 "parser.y" + { (yyval.var_list) = append_var( (yyvsp[(1) - (3)].var_list), (yyvsp[(2) - (3)].var) ); ;} break; - case 251: -#line 862 "parser.y" + case 250: + +/* Line 1455 of yacc.c */ +#line 825 "parser.y" { (yyval.stmt_list) = NULL; ;} break; + case 251: + +/* Line 1455 of yacc.c */ +#line 826 "parser.y" + { (yyval.stmt_list) = append_func( (yyvsp[(1) - (3)].stmt_list), (yyvsp[(2) - (3)].func) ); ;} + break; + case 252: -#line 863 "parser.y" - { (yyval.stmt_list) = append_func( (yyvsp[-2].stmt_list), (yyvsp[-1].func) ); ;} + +/* Line 1455 of yacc.c */ +#line 832 "parser.y" + { (yyval.type) = (yyvsp[(1) - (5)].type); + type_dispinterface_define((yyval.type), (yyvsp[(3) - (5)].var_list), (yyvsp[(4) - (5)].stmt_list)); + ;} break; case 253: -#line 869 "parser.y" - { (yyval.type) = (yyvsp[-4].type); - type_dispinterface_define((yyval.type), (yyvsp[-2].var_list), (yyvsp[-1].stmt_list)); + +/* Line 1455 of yacc.c */ +#line 836 "parser.y" + { (yyval.type) = (yyvsp[(1) - (5)].type); + type_dispinterface_define_from_iface((yyval.type), (yyvsp[(3) - (5)].type)); ;} break; case 254: -#line 873 "parser.y" - { (yyval.type) = (yyvsp[-4].type); - type_dispinterface_define_from_iface((yyval.type), (yyvsp[-2].type)); - ;} - break; - case 255: -#line 878 "parser.y" +/* Line 1455 of yacc.c */ +#line 841 "parser.y" { (yyval.type) = NULL; ;} break; + case 255: + +/* Line 1455 of yacc.c */ +#line 842 "parser.y" + { (yyval.type) = find_type_or_error2((yyvsp[(2) - (2)].str), 0); ;} + break; + case 256: -#line 879 "parser.y" - { (yyval.type) = find_type_or_error2((yyvsp[0].str), 0); ;} + +/* Line 1455 of yacc.c */ +#line 845 "parser.y" + { (yyval.type) = get_type(TYPE_INTERFACE, (yyvsp[(2) - (2)].str), 0); ;} break; case 257: -#line 882 "parser.y" - { (yyval.type) = get_type(RPC_FC_IP, (yyvsp[0].str), 0); ;} + +/* Line 1455 of yacc.c */ +#line 846 "parser.y" + { (yyval.type) = get_type(TYPE_INTERFACE, (yyvsp[(2) - (2)].str), 0); ;} break; case 258: -#line 883 "parser.y" - { (yyval.type) = get_type(RPC_FC_IP, (yyvsp[0].str), 0); ;} + +/* Line 1455 of yacc.c */ +#line 849 "parser.y" + { (yyval.ifinfo).interface = (yyvsp[(2) - (2)].type); + (yyval.ifinfo).old_pointer_default = pointer_default; + if (is_attr((yyvsp[(1) - (2)].attr_list), ATTR_POINTERDEFAULT)) + pointer_default = get_attrv((yyvsp[(1) - (2)].attr_list), ATTR_POINTERDEFAULT); + is_object_interface = is_object((yyvsp[(1) - (2)].attr_list)); + check_def((yyvsp[(2) - (2)].type)); + (yyvsp[(2) - (2)].type)->attrs = check_iface_attrs((yyvsp[(2) - (2)].type)->name, (yyvsp[(1) - (2)].attr_list)); + (yyvsp[(2) - (2)].type)->defined = TRUE; + ;} break; case 259: -#line 886 "parser.y" - { (yyval.ifinfo).interface = (yyvsp[0].type); - (yyval.ifinfo).old_pointer_default = pointer_default; - if (is_attr((yyvsp[-1].attr_list), ATTR_POINTERDEFAULT)) - pointer_default = get_attrv((yyvsp[-1].attr_list), ATTR_POINTERDEFAULT); - is_object_interface = is_object((yyvsp[-1].attr_list)); - check_def((yyvsp[0].type)); - (yyvsp[0].type)->attrs = check_iface_attrs((yyvsp[0].type)->name, (yyvsp[-1].attr_list)); - (yyvsp[0].type)->defined = TRUE; + +/* Line 1455 of yacc.c */ +#line 861 "parser.y" + { (yyval.type) = (yyvsp[(1) - (6)].ifinfo).interface; + type_interface_define((yyval.type), (yyvsp[(2) - (6)].type), (yyvsp[(4) - (6)].stmt_list)); + pointer_default = (yyvsp[(1) - (6)].ifinfo).old_pointer_default; ;} break; case 260: -#line 898 "parser.y" - { (yyval.type) = (yyvsp[-5].ifinfo).interface; - type_interface_define((yyval.type), (yyvsp[-4].type), (yyvsp[-2].stmt_list)); - pointer_default = (yyvsp[-5].ifinfo).old_pointer_default; + +/* Line 1455 of yacc.c */ +#line 869 "parser.y" + { (yyval.type) = (yyvsp[(1) - (8)].ifinfo).interface; + type_interface_define((yyval.type), find_type_or_error2((yyvsp[(3) - (8)].str), 0), (yyvsp[(6) - (8)].stmt_list)); + pointer_default = (yyvsp[(1) - (8)].ifinfo).old_pointer_default; ;} break; case 261: -#line 906 "parser.y" - { (yyval.type) = (yyvsp[-7].ifinfo).interface; - type_interface_define((yyval.type), find_type_or_error2((yyvsp[-5].str), 0), (yyvsp[-2].stmt_list)); - pointer_default = (yyvsp[-7].ifinfo).old_pointer_default; - ;} + +/* Line 1455 of yacc.c */ +#line 873 "parser.y" + { (yyval.type) = (yyvsp[(1) - (2)].type); ;} break; case 262: -#line 910 "parser.y" - { (yyval.type) = (yyvsp[-1].type); ;} + +/* Line 1455 of yacc.c */ +#line 877 "parser.y" + { (yyval.type) = (yyvsp[(1) - (2)].type); ;} break; case 263: -#line 914 "parser.y" - { (yyval.type) = (yyvsp[-1].type); ;} + +/* Line 1455 of yacc.c */ +#line 878 "parser.y" + { (yyval.type) = (yyvsp[(1) - (2)].type); ;} break; case 264: -#line 915 "parser.y" - { (yyval.type) = (yyvsp[-1].type); ;} + +/* Line 1455 of yacc.c */ +#line 881 "parser.y" + { (yyval.type) = type_new_module((yyvsp[(2) - (2)].str)); ;} break; case 265: -#line 918 "parser.y" - { (yyval.type) = type_new_module((yyvsp[0].str)); ;} + +/* Line 1455 of yacc.c */ +#line 882 "parser.y" + { (yyval.type) = type_new_module((yyvsp[(2) - (2)].str)); ;} break; case 266: -#line 919 "parser.y" - { (yyval.type) = type_new_module((yyvsp[0].str)); ;} + +/* Line 1455 of yacc.c */ +#line 885 "parser.y" + { (yyval.type) = (yyvsp[(2) - (2)].type); + (yyval.type)->attrs = check_module_attrs((yyvsp[(2) - (2)].type)->name, (yyvsp[(1) - (2)].attr_list)); + ;} break; case 267: -#line 922 "parser.y" - { (yyval.type) = (yyvsp[0].type); - (yyval.type)->attrs = check_module_attrs((yyvsp[0].type)->name, (yyvsp[-1].attr_list)); + +/* Line 1455 of yacc.c */ +#line 891 "parser.y" + { (yyval.type) = (yyvsp[(1) - (5)].type); + type_module_define((yyval.type), (yyvsp[(3) - (5)].stmt_list)); ;} break; case 268: -#line 928 "parser.y" - { (yyval.type) = (yyvsp[-4].type); - type_module_define((yyval.type), (yyvsp[-2].stmt_list)); - ;} - break; - case 269: -#line 934 "parser.y" +/* Line 1455 of yacc.c */ +#line 897 "parser.y" { (yyval.stgclass) = STG_EXTERN; ;} break; - case 270: -#line 935 "parser.y" + case 269: + +/* Line 1455 of yacc.c */ +#line 898 "parser.y" { (yyval.stgclass) = STG_STATIC; ;} break; - case 271: -#line 936 "parser.y" + case 270: + +/* Line 1455 of yacc.c */ +#line 899 "parser.y" { (yyval.stgclass) = STG_REGISTER; ;} break; - case 272: -#line 940 "parser.y" + case 271: + +/* Line 1455 of yacc.c */ +#line 903 "parser.y" { (yyval.attr) = make_attr(ATTR_INLINE); ;} break; - case 273: -#line 944 "parser.y" + case 272: + +/* Line 1455 of yacc.c */ +#line 907 "parser.y" { (yyval.attr) = make_attr(ATTR_CONST); ;} break; - case 274: -#line 947 "parser.y" + case 273: + +/* Line 1455 of yacc.c */ +#line 910 "parser.y" { (yyval.attr_list) = NULL; ;} break; + case 274: + +/* Line 1455 of yacc.c */ +#line 911 "parser.y" + { (yyval.attr_list) = append_attr((yyvsp[(1) - (2)].attr_list), (yyvsp[(2) - (2)].attr)); ;} + break; + case 275: -#line 948 "parser.y" - { (yyval.attr_list) = append_attr((yyvsp[-1].attr_list), (yyvsp[0].attr)); ;} + +/* Line 1455 of yacc.c */ +#line 914 "parser.y" + { (yyval.declspec) = make_decl_spec((yyvsp[(1) - (2)].type), (yyvsp[(2) - (2)].declspec), NULL, NULL, STG_NONE); ;} break; case 276: -#line 951 "parser.y" - { (yyval.declspec) = make_decl_spec((yyvsp[-1].type), (yyvsp[0].declspec), NULL, NULL, STG_NONE); ;} + +/* Line 1455 of yacc.c */ +#line 916 "parser.y" + { (yyval.declspec) = make_decl_spec((yyvsp[(2) - (3)].type), (yyvsp[(1) - (3)].declspec), (yyvsp[(3) - (3)].declspec), NULL, STG_NONE); ;} break; case 277: -#line 953 "parser.y" - { (yyval.declspec) = make_decl_spec((yyvsp[-1].type), (yyvsp[-2].declspec), (yyvsp[0].declspec), NULL, STG_NONE); ;} - break; - case 278: -#line 956 "parser.y" +/* Line 1455 of yacc.c */ +#line 919 "parser.y" { (yyval.declspec) = NULL; ;} break; + case 279: + +/* Line 1455 of yacc.c */ +#line 924 "parser.y" + { (yyval.declspec) = make_decl_spec(NULL, (yyvsp[(2) - (2)].declspec), NULL, (yyvsp[(1) - (2)].attr), STG_NONE); ;} + break; + case 280: -#line 961 "parser.y" - { (yyval.declspec) = make_decl_spec(NULL, (yyvsp[0].declspec), NULL, (yyvsp[-1].attr), STG_NONE); ;} + +/* Line 1455 of yacc.c */ +#line 925 "parser.y" + { (yyval.declspec) = make_decl_spec(NULL, (yyvsp[(2) - (2)].declspec), NULL, (yyvsp[(1) - (2)].attr), STG_NONE); ;} break; case 281: -#line 962 "parser.y" - { (yyval.declspec) = make_decl_spec(NULL, (yyvsp[0].declspec), NULL, (yyvsp[-1].attr), STG_NONE); ;} + +/* Line 1455 of yacc.c */ +#line 926 "parser.y" + { (yyval.declspec) = make_decl_spec(NULL, (yyvsp[(2) - (2)].declspec), NULL, NULL, (yyvsp[(1) - (2)].stgclass)); ;} break; case 282: -#line 963 "parser.y" - { (yyval.declspec) = make_decl_spec(NULL, (yyvsp[0].declspec), NULL, NULL, (yyvsp[-1].stgclass)); ;} + +/* Line 1455 of yacc.c */ +#line 931 "parser.y" + { (yyval.declarator) = (yyvsp[(3) - (3)].declarator); (yyval.declarator)->type = append_ptrchain_type((yyval.declarator)->type, type_new_pointer(pointer_default, NULL, (yyvsp[(2) - (3)].attr_list))); ;} break; case 283: -#line 968 "parser.y" - { (yyval.declarator) = (yyvsp[0].declarator); (yyval.declarator)->type = append_ptrchain_type((yyval.declarator)->type, type_new_pointer(NULL, (yyvsp[-1].attr_list))); ;} + +/* Line 1455 of yacc.c */ +#line 932 "parser.y" + { (yyval.declarator) = (yyvsp[(2) - (2)].declarator); (yyval.declarator)->type->attrs = append_attr((yyval.declarator)->type->attrs, make_attrp(ATTR_CALLCONV, (yyvsp[(1) - (2)].str))); ;} break; - case 284: -#line 969 "parser.y" - { (yyval.declarator) = (yyvsp[0].declarator); (yyval.declarator)->type->attrs = append_attr((yyval.declarator)->type->attrs, make_attrp(ATTR_CALLCONV, (yyvsp[-1].str))); ;} + case 285: + +/* Line 1455 of yacc.c */ +#line 937 "parser.y" + { (yyval.declarator) = make_declarator((yyvsp[(1) - (1)].var)); ;} break; case 286: -#line 974 "parser.y" - { (yyval.declarator) = make_declarator((yyvsp[0].var)); ;} + +/* Line 1455 of yacc.c */ +#line 938 "parser.y" + { (yyval.declarator) = (yyvsp[(2) - (3)].declarator); ;} break; case 287: -#line 975 "parser.y" - { (yyval.declarator) = (yyvsp[-1].declarator); ;} + +/* Line 1455 of yacc.c */ +#line 939 "parser.y" + { (yyval.declarator) = (yyvsp[(1) - (2)].declarator); (yyval.declarator)->array = append_array((yyval.declarator)->array, (yyvsp[(2) - (2)].expr)); ;} break; case 288: -#line 976 "parser.y" - { (yyval.declarator) = (yyvsp[-1].declarator); (yyval.declarator)->array = append_array((yyval.declarator)->array, (yyvsp[0].expr)); ;} - break; - case 289: -#line 977 "parser.y" - { (yyval.declarator) = (yyvsp[-3].declarator); - (yyval.declarator)->func_type = append_ptrchain_type((yyval.declarator)->type, type_new_function((yyvsp[-1].var_list))); +/* Line 1455 of yacc.c */ +#line 940 "parser.y" + { (yyval.declarator) = (yyvsp[(1) - (4)].declarator); + (yyval.declarator)->func_type = append_ptrchain_type((yyval.declarator)->type, type_new_function((yyvsp[(3) - (4)].var_list))); (yyval.declarator)->type = NULL; ;} break; + case 289: + +/* Line 1455 of yacc.c */ +#line 947 "parser.y" + { (yyval.declarator_list) = append_declarator( NULL, (yyvsp[(1) - (1)].declarator) ); ;} + break; + case 290: -#line 984 "parser.y" - { (yyval.declarator_list) = append_declarator( NULL, (yyvsp[0].declarator) ); ;} + +/* Line 1455 of yacc.c */ +#line 948 "parser.y" + { (yyval.declarator_list) = append_declarator( (yyvsp[(1) - (3)].declarator_list), (yyvsp[(3) - (3)].declarator) ); ;} break; case 291: -#line 985 "parser.y" - { (yyval.declarator_list) = append_declarator( (yyvsp[-2].declarator_list), (yyvsp[0].declarator) ); ;} + +/* Line 1455 of yacc.c */ +#line 952 "parser.y" + { (yyval.declarator) = (yyvsp[(1) - (1)].declarator); ;} break; case 292: -#line 989 "parser.y" - { (yyval.declarator) = (yyvsp[0].declarator); ;} + +/* Line 1455 of yacc.c */ +#line 953 "parser.y" + { (yyval.declarator) = (yyvsp[(1) - (3)].declarator); (yyvsp[(1) - (3)].declarator)->var->eval = (yyvsp[(3) - (3)].expr); ;} break; case 293: -#line 990 "parser.y" - { (yyval.declarator) = (yyvsp[-2].declarator); (yyvsp[-2].declarator)->var->eval = (yyvsp[0].expr); ;} - break; - case 294: -#line 994 "parser.y" +/* Line 1455 of yacc.c */ +#line 957 "parser.y" { (yyval.num) = RPC_FC_RP; ;} break; - case 295: -#line 995 "parser.y" + case 294: + +/* Line 1455 of yacc.c */ +#line 958 "parser.y" { (yyval.num) = RPC_FC_UP; ;} break; - case 296: -#line 996 "parser.y" + case 295: + +/* Line 1455 of yacc.c */ +#line 959 "parser.y" { (yyval.num) = RPC_FC_FP; ;} break; + case 296: + +/* Line 1455 of yacc.c */ +#line 962 "parser.y" + { (yyval.type) = type_new_struct((yyvsp[(2) - (5)].str), TRUE, (yyvsp[(4) - (5)].var_list)); ;} + break; + case 297: -#line 999 "parser.y" - { (yyval.type) = type_new_struct((yyvsp[-3].str), TRUE, (yyvsp[-1].var_list)); ;} + +/* Line 1455 of yacc.c */ +#line 965 "parser.y" + { (yyval.type) = type_new_void(); ;} break; case 298: -#line 1002 "parser.y" - { (yyval.type) = find_type_or_error("void", 0); ;} + +/* Line 1455 of yacc.c */ +#line 966 "parser.y" + { (yyval.type) = find_type_or_error((yyvsp[(1) - (1)].str), 0); ;} break; case 299: -#line 1003 "parser.y" - { (yyval.type) = find_type_or_error((yyvsp[0].str), 0); ;} + +/* Line 1455 of yacc.c */ +#line 967 "parser.y" + { (yyval.type) = (yyvsp[(1) - (1)].type); ;} break; case 300: -#line 1004 "parser.y" - { (yyval.type) = (yyvsp[0].type); ;} + +/* Line 1455 of yacc.c */ +#line 968 "parser.y" + { (yyval.type) = (yyvsp[(1) - (1)].type); ;} break; case 301: -#line 1005 "parser.y" - { (yyval.type) = (yyvsp[0].type); ;} + +/* Line 1455 of yacc.c */ +#line 969 "parser.y" + { (yyval.type) = type_new_enum((yyvsp[(2) - (2)].str), FALSE, NULL); ;} break; case 302: -#line 1006 "parser.y" - { (yyval.type) = find_type_or_error2((yyvsp[0].str), tsENUM); ;} + +/* Line 1455 of yacc.c */ +#line 970 "parser.y" + { (yyval.type) = (yyvsp[(1) - (1)].type); ;} break; case 303: -#line 1007 "parser.y" - { (yyval.type) = (yyvsp[0].type); ;} + +/* Line 1455 of yacc.c */ +#line 971 "parser.y" + { (yyval.type) = type_new_struct((yyvsp[(2) - (2)].str), FALSE, NULL); ;} break; case 304: -#line 1008 "parser.y" - { (yyval.type) = type_new_struct((yyvsp[0].str), FALSE, NULL); ;} + +/* Line 1455 of yacc.c */ +#line 972 "parser.y" + { (yyval.type) = (yyvsp[(1) - (1)].type); ;} break; case 305: -#line 1009 "parser.y" - { (yyval.type) = (yyvsp[0].type); ;} + +/* Line 1455 of yacc.c */ +#line 973 "parser.y" + { (yyval.type) = type_new_nonencapsulated_union((yyvsp[(2) - (2)].str), FALSE, NULL); ;} break; case 306: -#line 1010 "parser.y" - { (yyval.type) = find_type_or_error2((yyvsp[0].str), tsUNION); ;} + +/* Line 1455 of yacc.c */ +#line 974 "parser.y" + { (yyval.type) = make_safearray((yyvsp[(3) - (4)].type)); ;} break; case 307: -#line 1011 "parser.y" - { (yyval.type) = make_safearray((yyvsp[-1].type)); ;} - break; - case 308: -#line 1015 "parser.y" - { reg_typedefs((yyvsp[-1].declspec), (yyvsp[0].declarator_list), check_typedef_attrs((yyvsp[-2].attr_list))); - (yyval.statement) = make_statement_typedef((yyvsp[0].declarator_list)); +/* Line 1455 of yacc.c */ +#line 978 "parser.y" + { reg_typedefs((yyvsp[(3) - (4)].declspec), (yyvsp[(4) - (4)].declarator_list), check_typedef_attrs((yyvsp[(2) - (4)].attr_list))); + (yyval.statement) = make_statement_typedef((yyvsp[(4) - (4)].declarator_list)); ;} break; + case 308: + +/* Line 1455 of yacc.c */ +#line 984 "parser.y" + { (yyval.type) = type_new_nonencapsulated_union((yyvsp[(2) - (5)].str), TRUE, (yyvsp[(4) - (5)].var_list)); ;} + break; + case 309: -#line 1021 "parser.y" - { (yyval.type) = type_new_nonencapsulated_union((yyvsp[-3].str), (yyvsp[-1].var_list)); ;} + +/* Line 1455 of yacc.c */ +#line 987 "parser.y" + { (yyval.type) = type_new_encapsulated_union((yyvsp[(2) - (10)].str), (yyvsp[(5) - (10)].var), (yyvsp[(7) - (10)].var), (yyvsp[(9) - (10)].var_list)); ;} break; case 310: -#line 1024 "parser.y" - { (yyval.type) = type_new_encapsulated_union((yyvsp[-8].str), (yyvsp[-5].var), (yyvsp[-3].var), (yyvsp[-1].var_list)); ;} + +/* Line 1455 of yacc.c */ +#line 991 "parser.y" + { (yyval.num) = MAKEVERSION((yyvsp[(1) - (1)].num), 0); ;} break; case 311: -#line 1028 "parser.y" - { (yyval.num) = MAKEVERSION((yyvsp[0].num), 0); ;} - break; - case 312: -#line 1029 "parser.y" - { (yyval.num) = MAKEVERSION((yyvsp[-2].num), (yyvsp[0].num)); ;} +/* Line 1455 of yacc.c */ +#line 992 "parser.y" + { (yyval.num) = MAKEVERSION((yyvsp[(1) - (3)].num), (yyvsp[(3) - (3)].num)); ;} break; + +/* Line 1455 of yacc.c */ +#line 4702 "parser.tab.c" default: break; } + YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); -/* Line 1126 of yacc.c. */ -#line 4085 "parser.tab.c" - - yyvsp -= yylen; - yyssp -= yylen; - - + YYPOPSTACK (yylen); + yylen = 0; YY_STACK_PRINT (yyss, yyssp); *++yyvsp = yyval; - /* Now `shift' the result of the reduction. Determine what state that goes to, based on the state we popped back to and the rule number reduced by. */ @@ -4115,133 +4732,65 @@ yyerrlab: if (!yyerrstatus) { ++yynerrs; -#if YYERROR_VERBOSE - yyn = yypact[yystate]; - - if (YYPACT_NINF < yyn && yyn < YYLAST) - { - int yytype = YYTRANSLATE (yychar); - YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); - YYSIZE_T yysize = yysize0; - YYSIZE_T yysize1; - int yysize_overflow = 0; - char *yymsg = 0; -# define YYERROR_VERBOSE_ARGS_MAXIMUM 5 - char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; - int yyx; - -#if 0 - /* This is so xgettext sees the translatable formats that are - constructed on the fly. */ - YY_("syntax error, unexpected %s"); - YY_("syntax error, unexpected %s, expecting %s"); - YY_("syntax error, unexpected %s, expecting %s or %s"); - YY_("syntax error, unexpected %s, expecting %s or %s or %s"); - YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); -#endif - char *yyfmt; - char const *yyf; - static char const yyunexpected[] = "syntax error, unexpected %s"; - static char const yyexpecting[] = ", expecting %s"; - static char const yyor[] = " or %s"; - char yyformat[sizeof yyunexpected - + sizeof yyexpecting - 1 - + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) - * (sizeof yyor - 1))]; - char const *yyprefix = yyexpecting; - - /* Start YYX at -YYN if negative to avoid negative indexes in - YYCHECK. */ - int yyxbegin = yyn < 0 ? -yyn : 0; - - /* Stay within bounds of both yycheck and yytname. */ - int yychecklim = YYLAST - yyn; - int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; - int yycount = 1; - - yyarg[0] = yytname[yytype]; - yyfmt = yystpcpy (yyformat, yyunexpected); - - for (yyx = yyxbegin; yyx < yyxend; ++yyx) - if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) - { - if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) - { - yycount = 1; - yysize = yysize0; - yyformat[sizeof yyunexpected - 1] = '\0'; - break; - } - yyarg[yycount++] = yytname[yyx]; - yysize1 = yysize + yytnamerr (0, yytname[yyx]); - yysize_overflow |= yysize1 < yysize; - yysize = yysize1; - yyfmt = yystpcpy (yyfmt, yyprefix); - yyprefix = yyor; - } - - yyf = YY_(yyformat); - yysize1 = yysize + yystrlen (yyf); - yysize_overflow |= yysize1 < yysize; - yysize = yysize1; - - if (!yysize_overflow && yysize <= YYSTACK_ALLOC_MAXIMUM) - yymsg = (char *) YYSTACK_ALLOC (yysize); - if (yymsg) - { - /* Avoid sprintf, as that infringes on the user's name space. - Don't have undefined behavior even if the translation - produced a string with the wrong number of "%s"s. */ - char *yyp = yymsg; - int yyi = 0; - while ((*yyp = *yyf)) - { - if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) - { - yyp += yytnamerr (yyp, yyarg[yyi++]); - yyf += 2; - } - else - { - yyp++; - yyf++; - } - } - yyerror (yymsg); +#if ! YYERROR_VERBOSE + yyerror (YY_("syntax error")); +#else + { + YYSIZE_T yysize = yysyntax_error (0, yystate, yychar); + if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM) + { + YYSIZE_T yyalloc = 2 * yysize; + if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM)) + yyalloc = YYSTACK_ALLOC_MAXIMUM; + if (yymsg != yymsgbuf) YYSTACK_FREE (yymsg); - } - else - { - yyerror (YY_("syntax error")); + yymsg = (char *) YYSTACK_ALLOC (yyalloc); + if (yymsg) + yymsg_alloc = yyalloc; + else + { + yymsg = yymsgbuf; + yymsg_alloc = sizeof yymsgbuf; + } + } + + if (0 < yysize && yysize <= yymsg_alloc) + { + (void) yysyntax_error (yymsg, yystate, yychar); + yyerror (yymsg); + } + else + { + yyerror (YY_("syntax error")); + if (yysize != 0) goto yyexhaustedlab; - } - } - else -#endif /* YYERROR_VERBOSE */ - yyerror (YY_("syntax error")); + } + } +#endif } if (yyerrstatus == 3) { - /* If just tried and failed to reuse look-ahead token after an + /* If just tried and failed to reuse lookahead token after an error, discard it. */ if (yychar <= YYEOF) - { + { /* Return failure if at end of input. */ if (yychar == YYEOF) YYABORT; - } + } else { - yydestruct ("Error: discarding", yytoken, &yylval); + yydestruct ("Error: discarding", + yytoken, &yylval); yychar = YYEMPTY; } } - /* Else will try to reuse look-ahead token after shifting the error + /* Else will try to reuse lookahead token after shifting the error token. */ goto yyerrlab1; @@ -4254,11 +4803,14 @@ yyerrorlab: /* Pacify compilers like GCC when the user code never invokes YYERROR and the label yyerrorlab therefore never appears in user code. */ - if (0) + if (/*CONSTCOND*/ 0) goto yyerrorlab; -yyvsp -= yylen; - yyssp -= yylen; + /* Do not reclaim the symbols of the rule which action triggered + this YYERROR. */ + YYPOPSTACK (yylen); + yylen = 0; + YY_STACK_PRINT (yyss, yyssp); yystate = *yyssp; goto yyerrlab1; @@ -4288,19 +4840,17 @@ yyerrlab1: YYABORT; - yydestruct ("Error: popping", yystos[yystate], yyvsp); - YYPOPSTACK; + yydestruct ("Error: popping", + yystos[yystate], yyvsp); + YYPOPSTACK (1); yystate = *yyssp; YY_STACK_PRINT (yyss, yyssp); } - if (yyn == YYFINAL) - YYACCEPT; - *++yyvsp = yylval; - /* Shift the error token. */ + /* Shift the error token. */ YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); yystate = yyn; @@ -4321,7 +4871,7 @@ yyabortlab: yyresult = 1; goto yyreturn; -#ifndef yyoverflow +#if !defined(yyoverflow) || YYERROR_VERBOSE /*-------------------------------------------------. | yyexhaustedlab -- memory exhaustion comes here. | `-------------------------------------------------*/ @@ -4332,69 +4882,57 @@ yyexhaustedlab: #endif yyreturn: - if (yychar != YYEOF && yychar != YYEMPTY) + if (yychar != YYEMPTY) yydestruct ("Cleanup: discarding lookahead", yytoken, &yylval); + /* Do not reclaim the symbols of the rule which action triggered + this YYABORT or YYACCEPT. */ + YYPOPSTACK (yylen); + YY_STACK_PRINT (yyss, yyssp); while (yyssp != yyss) { yydestruct ("Cleanup: popping", yystos[*yyssp], yyvsp); - YYPOPSTACK; + YYPOPSTACK (1); } #ifndef yyoverflow if (yyss != yyssa) YYSTACK_FREE (yyss); #endif - return yyresult; +#if YYERROR_VERBOSE + if (yymsg != yymsgbuf) + YYSTACK_FREE (yymsg); +#endif + /* Make sure YYID is used. */ + return YYID (yyresult); } -#line 1032 "parser.y" + +/* Line 1675 of yacc.c */ +#line 995 "parser.y" -static void decl_builtin(const char *name, unsigned char type) +static void decl_builtin_basic(const char *name, enum type_basic_type type) { - type_t *t = make_type(type, NULL); - t->name = xstrdup(name); + type_t *t = type_new_basic(type); reg_type(t, name, 0); } -static type_t *make_builtin(char *name) +static void decl_builtin_alias(const char *name, type_t *t) { - /* NAME is strdup'd in the lexer */ - type_t *t = duptype(find_type_or_error(name, 0), 0); - t->name = name; - return t; -} - -static type_t *make_int(int sign) -{ - type_t *t = duptype(find_type_or_error("int", 0), 1); - - t->sign = sign; - if (sign < 0) - t->type = t->type == RPC_FC_LONG ? RPC_FC_ULONG : RPC_FC_USHORT; - - return t; + reg_type(type_new_alias(t, name), name, 0); } void init_types(void) { - decl_builtin("void", 0); - decl_builtin("byte", RPC_FC_BYTE); - decl_builtin("wchar_t", RPC_FC_WCHAR); - decl_builtin("int", RPC_FC_LONG); /* win32 */ - decl_builtin("short", RPC_FC_SHORT); - decl_builtin("small", RPC_FC_SMALL); - decl_builtin("long", RPC_FC_LONG); - decl_builtin("hyper", RPC_FC_HYPER); - decl_builtin("__int64", RPC_FC_HYPER); - decl_builtin("char", RPC_FC_CHAR); - decl_builtin("float", RPC_FC_FLOAT); - decl_builtin("double", RPC_FC_DOUBLE); - decl_builtin("boolean", RPC_FC_BYTE); - decl_builtin("error_status_t", RPC_FC_ERROR_STATUS_T); - decl_builtin("handle_t", RPC_FC_BIND_PRIMITIVE); + decl_builtin_basic("byte", TYPE_BASIC_BYTE); + decl_builtin_basic("wchar_t", TYPE_BASIC_WCHAR); + decl_builtin_basic("float", TYPE_BASIC_FLOAT); + decl_builtin_basic("double", TYPE_BASIC_DOUBLE); + decl_builtin_basic("error_status_t", TYPE_BASIC_ERROR_STATUS_T); + decl_builtin_basic("handle_t", TYPE_BASIC_HANDLE); + decl_builtin_alias("boolean", type_new_basic(TYPE_BASIC_BYTE)); } static str_list_t *append_str(str_list_t *list, char *str) @@ -4607,98 +5145,6 @@ void clear_all_offsets(void) node->data.typestring_offset = node->data.ptrdesc = 0; } -type_t *make_type(unsigned char type, type_t *ref) -{ - type_t *t = alloc_type(); - t->name = NULL; - t->type = type; - t->ref = ref; - t->attrs = NULL; - t->orig = NULL; - memset(&t->details, 0, sizeof(t->details)); - t->typestring_offset = 0; - t->ptrdesc = 0; - t->declarray = FALSE; - t->ignore = (parse_only != 0); - t->sign = 0; - t->defined = FALSE; - t->written = FALSE; - t->user_types_registered = FALSE; - t->tfswrite = FALSE; - t->checked = FALSE; - t->is_alias = FALSE; - t->typelib_idx = -1; - init_loc_info(&t->loc_info); - return t; -} - -static type_t *type_new_enum(char *name, var_list_t *enums) -{ - type_t *t = get_type(RPC_FC_ENUM16, name, tsENUM); - if (enums) - { - t->details.enumeration = xmalloc(sizeof(*t->details.enumeration)); - t->details.enumeration->enums = enums; - } - else - t->details.enumeration = NULL; - t->defined = TRUE; - return t; -} - -static type_t *type_new_struct(char *name, int defined, var_list_t *fields) -{ - type_t *tag_type = name ? find_type(name, tsSTRUCT) : NULL; - type_t *t = make_type(RPC_FC_STRUCT, NULL); - t->name = name; - if (defined || (tag_type && tag_type->details.structure)) - { - if (tag_type && tag_type->details.structure) - { - t->details.structure = tag_type->details.structure; - t->type = tag_type->type; - } - else if (defined) - { - t->details.structure = xmalloc(sizeof(*t->details.structure)); - t->details.structure->fields = fields; - t->defined = TRUE; - } - } - if (name) - { - if (fields) - reg_type(t, name, tsSTRUCT); - else - add_incomplete(t); - } - return t; -} - -static type_t *type_new_nonencapsulated_union(char *name, var_list_t *fields) -{ - type_t *t = get_type(RPC_FC_NON_ENCAPSULATED_UNION, name, tsUNION); - t->details.structure = xmalloc(sizeof(*t->details.structure)); - t->details.structure->fields = fields; - t->defined = TRUE; - return t; -} - -static type_t *type_new_encapsulated_union(char *name, var_t *switch_field, var_t *union_field, var_list_t *cases) -{ - type_t *t = get_type(RPC_FC_ENCAPSULATED_UNION, name, tsUNION); - if (!union_field) union_field = make_var( xstrdup("tagged_union") ); - union_field->type = make_type(RPC_FC_NON_ENCAPSULATED_UNION, NULL); - union_field->type->details.structure = xmalloc(sizeof(*union_field->type->details.structure)); - union_field->type->details.structure->fields = cases; - union_field->type->defined = TRUE; - t->details.structure = xmalloc(sizeof(*t->details.structure)); - t->details.structure->fields = append_var( NULL, switch_field ); - t->details.structure->fields = append_var( t->details.structure->fields, union_field ); - t->defined = TRUE; - return t; -} - static void type_function_add_head_arg(type_t *type, var_t *arg) { if (!type->details.function->args) @@ -4714,9 +5160,10 @@ static type_t *append_ptrchain_type(type_t *ptrchain, type_t *type) type_t *ptrchain_type; if (!ptrchain) return type; - for (ptrchain_type = ptrchain; ptrchain_type->ref; ptrchain_type = ptrchain_type->ref) + for (ptrchain_type = ptrchain; type_pointer_get_ref(ptrchain_type); ptrchain_type = type_pointer_get_ref(ptrchain_type)) ; - ptrchain_type->ref = type; + assert(ptrchain_type->type_type == TYPE_POINTER); + ptrchain_type->details.pointer.ref = type; return ptrchain; } @@ -4750,9 +5197,8 @@ static void set_type(var_t *v, decl_spec_t *decl_spec, const declarator_t *decl, v->type = append_ptrchain_type(decl ? decl->type : NULL, type); v->stgclass = decl_spec->stgclass; - /* the highest level of pointer specified should default to the var's ptr attr - * or (RPC_FC_RP if not specified and it's a top level ptr), not - * pointer_default so we need to fix that up here */ + /* check for pointer attribute being applied to non-pointer, non-array + * type */ if (!arr) { int ptr_attr = get_attrv(v->attrs, ATTR_POINTERTYPE); @@ -4768,11 +5214,21 @@ static void set_type(var_t *v, decl_spec_t *decl_spec, const declarator_t *decl, else break; } - if (ptr && is_ptr(ptr) && (ptr_attr || top)) + if (is_ptr(ptr)) { - /* duplicate type to avoid changing original type */ - *pt = duptype(*pt, 1); - (*pt)->type = ptr_attr ? ptr_attr : RPC_FC_RP; + if (ptr_attr && ptr_attr != RPC_FC_UP && + type_get_type(type_pointer_get_ref(ptr)) == TYPE_INTERFACE) + warning_loc_info(&v->loc_info, + "%s: pointer attribute applied to interface " + "pointer type has no effect\n", v->name); + if (!ptr_attr && top && (*pt)->details.pointer.def_fc != RPC_FC_RP) + { + /* FIXME: this is a horrible hack to cope with the issue that we + * store an offset to the typeformat string in the type object, but + * two typeformat strings may be written depending on whether the + * pointer is a toplevel parameter or not */ + *pt = duptype(*pt, 1); + } } else if (ptr_attr) error_loc("%s: pointer attribute applied to non-pointer type\n", v->name); @@ -4784,9 +5240,7 @@ static void set_type(var_t *v, decl_spec_t *decl_spec, const declarator_t *decl, if (is_attr(v->attrs, ATTR_V1ENUM)) { - if (v->type->type == RPC_FC_ENUM16) - v->type->type = RPC_FC_ENUM32; - else + if (type_get_type_detect_alias(v->type) != TYPE_ENUM) error_loc("'%s': [v1_enum] attribute applied to non-enum type\n", v->name); } @@ -4806,18 +5260,19 @@ static void set_type(var_t *v, decl_spec_t *decl_spec, const declarator_t *decl, if (0) { unsigned int align = 0; - size_t size = type_memsize(v->type, &align); + unsigned int size = type_memsize(v->type, &align); - if (0xffffffffuL / size < (unsigned long) dim->cval) + if (0xffffffffu / size < dim->cval) error_loc("%s: total array size is too large\n", v->name); } } else sizeless = TRUE; - *ptype = type_new_array(NULL, *ptype, TRUE, + *ptype = type_new_array(NULL, *ptype, FALSE, dim->is_const ? dim->cval : 0, - dim->is_const ? NULL : dim, NULL); + dim->is_const ? NULL : dim, NULL, + pointer_default); } ptype = &v->type; @@ -4831,18 +5286,21 @@ static void set_type(var_t *v, decl_spec_t *decl_spec, const declarator_t *decl, error_loc("%s: cannot specify size_is for a fixed sized array\n", v->name); else *ptype = type_new_array((*ptype)->name, - type_array_get_element(*ptype), TRUE, - 0, dim, NULL); + type_array_get_element(*ptype), FALSE, + 0, dim, NULL, 0); } else if (is_ptr(*ptype)) - *ptype = type_new_array((*ptype)->name, type_pointer_get_ref(*ptype), FALSE, - 0, dim, NULL); + *ptype = type_new_array((*ptype)->name, type_pointer_get_ref(*ptype), TRUE, + 0, dim, NULL, pointer_default); else error_loc("%s: size_is attribute applied to illegal type\n", v->name); } - ptype = &(*ptype)->ref; - if (*ptype == NULL) + if (is_ptr(*ptype)) + ptype = &(*ptype)->details.pointer.ref; + else if (is_array(*ptype)) + ptype = &(*ptype)->details.array.elem; + else error_loc("%s: too many expressions in size_is attribute\n", v->name); } @@ -4855,17 +5313,20 @@ static void set_type(var_t *v, decl_spec_t *decl_spec, const declarator_t *decl, { *ptype = type_new_array((*ptype)->name, type_array_get_element(*ptype), - (*ptype)->declarray, + type_array_is_decl_as_ptr(*ptype), type_array_get_dim(*ptype), type_array_get_conformance(*ptype), - dim); + dim, type_array_get_ptr_default_fc(*ptype)); } else error_loc("%s: length_is attribute applied to illegal type\n", v->name); } - ptype = &(*ptype)->ref; - if (*ptype == NULL) + if (is_ptr(*ptype)) + ptype = &(*ptype)->details.pointer.ref; + else if (is_array(*ptype)) + ptype = &(*ptype)->details.array.elem; + else error_loc("%s: too many expressions in length_is attribute\n", v->name); } @@ -4879,8 +5340,8 @@ static void set_type(var_t *v, decl_spec_t *decl_spec, const declarator_t *decl, v->type = func_type; for (ft = v->type; is_ptr(ft); ft = type_pointer_get_ref(ft)) ; - assert(ft->type == RPC_FC_FUNCTION); - ft->ref = return_type; + assert(type_get_type_detect_alias(ft) == TYPE_FUNCTION); + ft->details.function->rettype = return_type; /* move calling convention attribute, if present, from pointer nodes to * function node */ for (t = v->type; is_ptr(t); t = type_pointer_get_ref(t)) @@ -4938,7 +5399,7 @@ static ifref_t *make_ifref(type_t *iface) return l; } -static var_list_t *append_var(var_list_t *list, var_t *var) +var_list_t *append_var(var_list_t *list, var_t *var) { if (!var) return list; if (!list) @@ -4962,7 +5423,7 @@ static var_list_t *append_var_list(var_list_t *list, var_list_t *vars) return list; } -static var_t *make_var(char *name) +var_t *make_var(char *name) { var_t *v = xmalloc(sizeof(var_t)); v->name = name; @@ -5014,18 +5475,10 @@ static func_t *make_func(var_t *def) return f; } -static type_t *make_class(char *name) -{ - type_t *c = make_type(RPC_FC_COCLASS, NULL); - c->name = name; - return c; -} - static type_t *make_safearray(type_t *type) { - type_t *sa = find_type_or_error("SAFEARRAY", 0); - sa->ref = type; - return make_type(pointer_default, sa); + return type_new_array(NULL, type_new_alias(type, "SAFEARRAY"), TRUE, 0, + NULL, NULL, RPC_FC_RP); } static typelib_t *make_library(const char *name, const attr_list_t *attrs) @@ -5063,7 +5516,7 @@ struct rtype { struct rtype *type_hash[HASHMAX]; -static type_t *reg_type(type_t *type, const char *name, int t) +type_t *reg_type(type_t *type, const char *name, int t) { struct rtype *nt; int hash; @@ -5085,10 +5538,13 @@ static type_t *reg_type(type_t *type, const char *name, int t) static int is_incomplete(const type_t *t) { - return !t->defined && (is_struct(t->type) || is_union(t->type)); + return !t->defined && + (type_get_type_detect_alias(t) == TYPE_STRUCT || + type_get_type_detect_alias(t) == TYPE_UNION || + type_get_type_detect_alias(t) == TYPE_ENCAPSULATED_UNION); } -static void add_incomplete(type_t *t) +void add_incomplete(type_t *t) { struct typenode *tn = xmalloc(sizeof *tn); tn->type = t; @@ -5100,7 +5556,9 @@ static void fix_type(type_t *t) if (type_is_alias(t) && is_incomplete(t)) { type_t *ot = type_alias_get_aliasee(t); fix_type(ot); - if (is_struct(ot->type) || is_union(ot->type)) + if (type_get_type_detect_alias(ot) == TYPE_STRUCT || + type_get_type_detect_alias(ot) == TYPE_UNION || + type_get_type_detect_alias(ot) == TYPE_ENCAPSULATED_UNION) t->details.structure = ot->details.structure; t->defined = ot->defined; } @@ -5123,12 +5581,9 @@ static void fix_incomplete_types(type_t *complete_type) LIST_FOR_EACH_ENTRY_SAFE(tn, next, &incomplete_types, struct typenode, entry) { - if (((is_struct(complete_type->type) && is_struct(tn->type->type)) || - (is_union(complete_type->type) && is_union(tn->type->type))) && - !strcmp(complete_type->name, tn->type->name)) + if (type_is_equal(complete_type, tn->type)) { tn->type->details.structure = complete_type->details.structure; - tn->type->type = complete_type->type; list_remove(&tn->entry); free(tn); } @@ -5144,13 +5599,14 @@ static type_t *reg_typedefs(decl_spec_t *decl_spec, declarator_list_t *decls, at if (is_str) { type_t *t = decl_spec->type; - unsigned char c; while (is_ptr(t)) t = type_pointer_get_ref(t); - c = t->type; - if (c != RPC_FC_CHAR && c != RPC_FC_BYTE && c != RPC_FC_WCHAR) + if (type_get_type(t) != TYPE_BASIC && + (get_basic_fc(t) != RPC_FC_CHAR && + get_basic_fc(t) != RPC_FC_BYTE && + get_basic_fc(t) != RPC_FC_WCHAR)) { decl = LIST_ENTRY( list_head( decls ), const declarator_t, entry ); error_loc("'%s': [string] attribute is only valid on 'char', 'byte', or 'wchar_t' pointers and arrays\n", @@ -5161,8 +5617,10 @@ static type_t *reg_typedefs(decl_spec_t *decl_spec, declarator_list_t *decls, at /* We must generate names for tagless enum, struct or union. Typedef-ing a tagless enum, struct or union means we want the typedef to be included in a library hence the public attribute. */ - if ((type->type == RPC_FC_ENUM16 || type->type == RPC_FC_ENUM32 || - is_struct(type->type) || is_union(type->type)) && + if ((type_get_type_detect_alias(type) == TYPE_ENUM || + type_get_type_detect_alias(type) == TYPE_STRUCT || + type_get_type_detect_alias(type) == TYPE_UNION || + type_get_type_detect_alias(type) == TYPE_ENCAPSULATED_UNION) && !type->name && !parse_only) { if (! is_attr(attrs, ATTR_PUBLIC)) @@ -5229,7 +5687,7 @@ int is_type(const char *name) return find_type(name, 0) != NULL; } -static type_t *get_type(unsigned char type, char *name, int t) +type_t *get_type(enum type_type type, char *name, int t) { type_t *tp; if (name) { @@ -5239,7 +5697,7 @@ static type_t *get_type(unsigned char type, char *name, int t) return tp; } } - tp = make_type(type, NULL); + tp = make_type(type); tp->name = name; if (!name) return tp; return reg_type(tp, name, t); @@ -5441,7 +5899,7 @@ static void check_arg(var_t *arg) const type_t *t = arg->type; const attr_t *attr; - if (t->type == 0 && ! is_var_ptr(arg)) + if (type_get_type(t) == TYPE_VOID) error_loc("argument '%s' has void type\n", arg->name); if (arg->attrs) @@ -5574,23 +6032,44 @@ static attr_list_t *check_coclass_attrs(const char *name, attr_list_t *attrs) static int is_allowed_conf_type(const type_t *type) { - switch (type->type) + switch (type_get_type(type)) { - case RPC_FC_CHAR: - case RPC_FC_SMALL: - case RPC_FC_BYTE: - case RPC_FC_USMALL: - case RPC_FC_WCHAR: - case RPC_FC_SHORT: - case RPC_FC_ENUM16: - case RPC_FC_USHORT: - case RPC_FC_LONG: - case RPC_FC_ENUM32: - case RPC_FC_ULONG: + case TYPE_ENUM: return TRUE; - default: + case TYPE_BASIC: + switch (type_basic_get_type(type)) + { + case TYPE_BASIC_INT8: + case TYPE_BASIC_INT16: + case TYPE_BASIC_INT32: + case TYPE_BASIC_INT64: + case TYPE_BASIC_INT: + case TYPE_BASIC_CHAR: + case TYPE_BASIC_HYPER: + case TYPE_BASIC_BYTE: + case TYPE_BASIC_WCHAR: + case TYPE_BASIC_ERROR_STATUS_T: + return TRUE; + default: + return FALSE; + } + case TYPE_ALIAS: + /* shouldn't get here because of type_get_type call above */ + assert(0); + /* fall through */ + case TYPE_STRUCT: + case TYPE_UNION: + case TYPE_ENCAPSULATED_UNION: + case TYPE_ARRAY: + case TYPE_POINTER: + case TYPE_VOID: + case TYPE_MODULE: + case TYPE_COCLASS: + case TYPE_FUNCTION: + case TYPE_INTERFACE: return FALSE; } + return FALSE; } static int is_ptr_guid_type(const type_t *type) @@ -5630,16 +6109,26 @@ static void check_field_common(const type_t *container_type, const char *container_name, const var_t *arg) { type_t *type = arg->type; - int is_wire_marshal = 0; - int is_context_handle = 0; + int more_to_do; const char *container_type_name = NULL; - if (is_struct(container_type->type)) + switch (type_get_type_detect_alias(type)) + { + case TYPE_STRUCT: container_type_name = "struct"; - else if (is_union(container_type->type)) + break; + case TYPE_UNION: container_type_name = "union"; - else if (container_type->type == RPC_FC_FUNCTION) + break; + case TYPE_ENCAPSULATED_UNION: + container_type_name = "encapsulated union"; + break; + case TYPE_FUNCTION: container_type_name = "function"; + break; + default: + break; + } if (is_attr(arg->attrs, ATTR_LENGTHIS) && (is_attr(arg->attrs, ATTR_STRING) || is_aliaschain_attr(arg->type, ATTR_STRING))) @@ -5687,35 +6176,56 @@ static void check_field_common(const type_t *container_type, } } - /* get fundamental type for the argument */ - for (;;) + do { - if (is_attr(type->attrs, ATTR_WIREMARSHAL)) - { - is_wire_marshal = 1; - break; - } - if (is_attr(type->attrs, ATTR_CONTEXTHANDLE)) - { - is_context_handle = 1; - break; - } - if (type_is_alias(type)) - type = type_alias_get_aliasee(type); - else if (is_ptr(type)) - type = type_pointer_get_ref(type); - else if (is_array(type)) - type = type_array_get_element(type); - else - break; - } + more_to_do = FALSE; - if (type->type == 0 && !is_attr(arg->attrs, ATTR_IIDIS) && !is_wire_marshal && !is_context_handle) - error_loc_info(&arg->loc_info, "parameter \'%s\' of %s \'%s\' cannot derive from void *\n", arg->name, container_type_name, container_name); - else if (type->type == RPC_FC_FUNCTION) - error_loc_info(&arg->loc_info, "parameter \'%s\' of %s \'%s\' cannot be a function pointer\n", arg->name, container_type_name, container_name); - else if (!is_wire_marshal && (is_struct(type->type) || is_union(type->type))) - check_remoting_fields(arg, type); + switch (typegen_detect_type(type, arg->attrs, TDT_IGNORE_STRINGS)) + { + case TGT_STRUCT: + case TGT_UNION: + check_remoting_fields(arg, type); + break; + case TGT_INVALID: + switch (type_get_type(type)) + { + case TYPE_VOID: + error_loc_info(&arg->loc_info, "parameter \'%s\' of %s \'%s\' cannot derive from void *\n", + arg->name, container_type_name, container_name); + break; + case TYPE_FUNCTION: + error_loc_info(&arg->loc_info, "parameter \'%s\' of %s \'%s\' cannot be a function pointer\n", + arg->name, container_type_name, container_name); + break; + case TYPE_COCLASS: + case TYPE_INTERFACE: + case TYPE_MODULE: + /* FIXME */ + break; + default: + break; + } + case TGT_CTXT_HANDLE: + case TGT_CTXT_HANDLE_POINTER: + /* FIXME */ + break; + case TGT_POINTER: + type = type_pointer_get_ref(type); + more_to_do = TRUE; + break; + case TGT_ARRAY: + type = type_array_get_element(type); + more_to_do = TRUE; + break; + case TGT_USER_TYPE: + case TGT_STRING: + case TGT_IFACE_POINTER: + case TGT_BASIC: + case TGT_ENUM: + /* nothing to do */ + break; + } + } while (more_to_do); } static void check_remoting_fields(const var_t *var, type_t *type) @@ -5730,14 +6240,14 @@ static void check_remoting_fields(const var_t *var, type_t *type) type->checked = TRUE; - if (is_struct(type->type)) + if (type_get_type(type) == TYPE_STRUCT) { if (type_is_complete(type)) fields = type_struct_get_fields(type); else error_loc_info(&var->loc_info, "undefined type declaration %s\n", type->name); } - else if (is_union(type->type)) + else if (type_get_type(type) == TYPE_UNION || type_get_type(type) == TYPE_ENCAPSULATED_UNION) fields = type_union_get_cases(type); if (fields) LIST_FOR_EACH_ENTRY( field, fields, const var_t, entry ) @@ -5752,36 +6262,37 @@ static void check_remoting_args(const var_t *func) if (func->type->details.function->args) LIST_FOR_EACH_ENTRY( arg, func->type->details.function->args, const var_t, entry ) { - int ptr_level = 0; const type_t *type = arg->type; - /* get pointer level and fundamental type for the argument */ - for (;;) - { - if (is_attr(type->attrs, ATTR_WIREMARSHAL)) - break; - if (is_attr(type->attrs, ATTR_CONTEXTHANDLE)) - break; - if (type_is_alias(type)) - type = type_alias_get_aliasee(type); - else if (is_ptr(type)) - { - ptr_level++; - type = type_pointer_get_ref(type); - } - else - break; - } - /* check that [out] parameters have enough pointer levels */ if (is_attr(arg->attrs, ATTR_OUT)) { - if (!is_array(type)) + switch (typegen_detect_type(type, arg->attrs, TDT_ALL_TYPES)) { - if (!ptr_level) - error_loc_info(&arg->loc_info, "out parameter \'%s\' of function \'%s\' is not a pointer\n", arg->name, funcname); - if (type->type == RPC_FC_IP && ptr_level == 1) - error_loc_info(&arg->loc_info, "out interface pointer \'%s\' of function \'%s\' is not a double pointer\n", arg->name, funcname); + case TGT_BASIC: + case TGT_ENUM: + case TGT_STRUCT: + case TGT_UNION: + case TGT_CTXT_HANDLE: + case TGT_USER_TYPE: + error_loc_info(&arg->loc_info, "out parameter \'%s\' of function \'%s\' is not a pointer\n", arg->name, funcname); + break; + case TGT_IFACE_POINTER: + error_loc_info(&arg->loc_info, "out interface pointer \'%s\' of function \'%s\' is not a double pointer\n", arg->name, funcname); + break; + case TGT_STRING: + if (!is_array(type)) + { + /* FIXME */ + } + break; + case TGT_INVALID: + /* already error'd before we get here */ + case TGT_CTXT_HANDLE_POINTER: + case TGT_POINTER: + case TGT_ARRAY: + /* OK */ + break; } } @@ -5847,7 +6358,7 @@ static void check_statements(const statement_list_t *stmts, int is_inside_librar { if (stmt->type == STMT_LIBRARY) check_statements(stmt->u.lib->stmts, TRUE); - else if (stmt->type == STMT_TYPE && stmt->u.type->type == RPC_FC_IP) + else if (stmt->type == STMT_TYPE && type_get_type(stmt->u.type) == TYPE_INTERFACE) check_functions(stmt->u.type, is_inside_library); } } @@ -5860,7 +6371,7 @@ static void check_all_user_types(const statement_list_t *stmts) { if (stmt->type == STMT_LIBRARY) check_all_user_types(stmt->u.lib->stmts); - else if (stmt->type == STMT_TYPE && stmt->u.type->type == RPC_FC_IP && + else if (stmt->type == STMT_TYPE && type_get_type(stmt->u.type) == TYPE_INTERFACE && !is_local(stmt->u.type->attrs)) { const statement_t *stmt_func; @@ -5921,8 +6432,9 @@ static statement_t *make_statement_declaration(var_t *var) if (var->eval) reg_const(var); } - else if ((var->stgclass == STG_NONE || var->stgclass == STG_REGISTER) && - var->type->type != RPC_FC_FUNCTION) + else if (type_get_type(var->type) == TYPE_FUNCTION) + check_function_attrs(var->name, var->attrs); + else if (var->stgclass == STG_NONE || var->stgclass == STG_REGISTER) error_loc("instantiation of data is illegal\n"); return stmt; } diff --git a/reactos/tools/widl/parser.tab.h b/reactos/tools/widl/parser.tab.h index b47f0acafb6..f1d74806377 100644 --- a/reactos/tools/widl/parser.tab.h +++ b/reactos/tools/widl/parser.tab.h @@ -1,27 +1,37 @@ -/* A Bison parser, made by GNU Bison 2.1. */ -/* Skeleton parser for Yacc-like parsing with Bison, - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. +/* A Bison parser, made by GNU Bison 2.4.1. */ - This program is free software; you can redistribute it and/or modify +/* Skeleton interface for Bison's Yacc-like parsers in C + + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 + Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. - + the Free Software Foundation, either version 3 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 General Public License for more details. - + You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. */ + along with this program. If not, see . */ + +/* As a special exception, you may create a larger work that contains + part or all of the Bison parser skeleton and distribute that work + under terms of your choice, so long as that work isn't itself a + parser generator using the skeleton or a modified version thereof + as a parser skeleton. Alternatively, if you modify or redistribute + the parser skeleton itself, you may (at your option) remove this + special exception, which will cause the skeleton and the resulting + Bison output files to be licensed under the GNU General Public + License without this special exception. + + This special exception was added by the Free Software Foundation in + version 2.2 of Bison. */ -/* As a special exception, when this file is copied by Bison into a - Bison output file, you may use that output file without restriction. - This special exception was added by the Free Software Foundation - in version 1.24 of Bison. */ /* Tokens. */ #ifndef YYTOKENTYPE @@ -147,196 +157,48 @@ tSAFEARRAY = 373, tSHORT = 374, tSIGNED = 375, - tSINGLE = 376, - tSIZEIS = 377, - tSIZEOF = 378, - tSMALL = 379, - tSOURCE = 380, - tSTATIC = 381, - tSTDCALL = 382, - tSTRICTCONTEXTHANDLE = 383, - tSTRING = 384, - tSTRUCT = 385, - tSWITCH = 386, - tSWITCHIS = 387, - tSWITCHTYPE = 388, - tTRANSMITAS = 389, - tTRUE = 390, - tTYPEDEF = 391, - tUNION = 392, - tUNIQUE = 393, - tUNSIGNED = 394, - tUUID = 395, - tV1ENUM = 396, - tVARARG = 397, - tVERSION = 398, - tVOID = 399, - tWCHAR = 400, - tWIREMARSHAL = 401, - ADDRESSOF = 402, - NEG = 403, - POS = 404, - PPTR = 405, - CAST = 406 + tSIZEIS = 376, + tSIZEOF = 377, + tSMALL = 378, + tSOURCE = 379, + tSTATIC = 380, + tSTDCALL = 381, + tSTRICTCONTEXTHANDLE = 382, + tSTRING = 383, + tSTRUCT = 384, + tSWITCH = 385, + tSWITCHIS = 386, + tSWITCHTYPE = 387, + tTRANSMITAS = 388, + tTRUE = 389, + tTYPEDEF = 390, + tUNION = 391, + tUNIQUE = 392, + tUNSIGNED = 393, + tUUID = 394, + tV1ENUM = 395, + tVARARG = 396, + tVERSION = 397, + tVOID = 398, + tWCHAR = 399, + tWIREMARSHAL = 400, + ADDRESSOF = 401, + NEG = 402, + POS = 403, + PPTR = 404, + CAST = 405 }; #endif -/* Tokens. */ -#define aIDENTIFIER 258 -#define aKNOWNTYPE 259 -#define aNUM 260 -#define aHEXNUM 261 -#define aDOUBLE 262 -#define aSTRING 263 -#define aWSTRING 264 -#define aUUID 265 -#define aEOF 266 -#define SHL 267 -#define SHR 268 -#define MEMBERPTR 269 -#define EQUALITY 270 -#define INEQUALITY 271 -#define GREATEREQUAL 272 -#define LESSEQUAL 273 -#define LOGICALOR 274 -#define LOGICALAND 275 -#define tAGGREGATABLE 276 -#define tALLOCATE 277 -#define tAPPOBJECT 278 -#define tASYNC 279 -#define tASYNCUUID 280 -#define tAUTOHANDLE 281 -#define tBINDABLE 282 -#define tBOOLEAN 283 -#define tBROADCAST 284 -#define tBYTE 285 -#define tBYTECOUNT 286 -#define tCALLAS 287 -#define tCALLBACK 288 -#define tCASE 289 -#define tCDECL 290 -#define tCHAR 291 -#define tCOCLASS 292 -#define tCODE 293 -#define tCOMMSTATUS 294 -#define tCONST 295 -#define tCONTEXTHANDLE 296 -#define tCONTEXTHANDLENOSERIALIZE 297 -#define tCONTEXTHANDLESERIALIZE 298 -#define tCONTROL 299 -#define tCPPQUOTE 300 -#define tDEFAULT 301 -#define tDEFAULTCOLLELEM 302 -#define tDEFAULTVALUE 303 -#define tDEFAULTVTABLE 304 -#define tDISPLAYBIND 305 -#define tDISPINTERFACE 306 -#define tDLLNAME 307 -#define tDOUBLE 308 -#define tDUAL 309 -#define tENDPOINT 310 -#define tENTRY 311 -#define tENUM 312 -#define tERRORSTATUST 313 -#define tEXPLICITHANDLE 314 -#define tEXTERN 315 -#define tFALSE 316 -#define tFASTCALL 317 -#define tFLOAT 318 -#define tHANDLE 319 -#define tHANDLET 320 -#define tHELPCONTEXT 321 -#define tHELPFILE 322 -#define tHELPSTRING 323 -#define tHELPSTRINGCONTEXT 324 -#define tHELPSTRINGDLL 325 -#define tHIDDEN 326 -#define tHYPER 327 -#define tID 328 -#define tIDEMPOTENT 329 -#define tIIDIS 330 -#define tIMMEDIATEBIND 331 -#define tIMPLICITHANDLE 332 -#define tIMPORT 333 -#define tIMPORTLIB 334 -#define tIN 335 -#define tIN_LINE 336 -#define tINLINE 337 -#define tINPUTSYNC 338 -#define tINT 339 -#define tINT64 340 -#define tINTERFACE 341 -#define tLCID 342 -#define tLENGTHIS 343 -#define tLIBRARY 344 -#define tLOCAL 345 -#define tLONG 346 -#define tMETHODS 347 -#define tMODULE 348 -#define tNONBROWSABLE 349 -#define tNONCREATABLE 350 -#define tNONEXTENSIBLE 351 -#define tNULL 352 -#define tOBJECT 353 -#define tODL 354 -#define tOLEAUTOMATION 355 -#define tOPTIONAL 356 -#define tOUT 357 -#define tPASCAL 358 -#define tPOINTERDEFAULT 359 -#define tPROPERTIES 360 -#define tPROPGET 361 -#define tPROPPUT 362 -#define tPROPPUTREF 363 -#define tPTR 364 -#define tPUBLIC 365 -#define tRANGE 366 -#define tREADONLY 367 -#define tREF 368 -#define tREGISTER 369 -#define tREQUESTEDIT 370 -#define tRESTRICTED 371 -#define tRETVAL 372 -#define tSAFEARRAY 373 -#define tSHORT 374 -#define tSIGNED 375 -#define tSINGLE 376 -#define tSIZEIS 377 -#define tSIZEOF 378 -#define tSMALL 379 -#define tSOURCE 380 -#define tSTATIC 381 -#define tSTDCALL 382 -#define tSTRICTCONTEXTHANDLE 383 -#define tSTRING 384 -#define tSTRUCT 385 -#define tSWITCH 386 -#define tSWITCHIS 387 -#define tSWITCHTYPE 388 -#define tTRANSMITAS 389 -#define tTRUE 390 -#define tTYPEDEF 391 -#define tUNION 392 -#define tUNIQUE 393 -#define tUNSIGNED 394 -#define tUUID 395 -#define tV1ENUM 396 -#define tVARARG 397 -#define tVERSION 398 -#define tVOID 399 -#define tWCHAR 400 -#define tWIREMARSHAL 401 -#define ADDRESSOF 402 -#define NEG 403 -#define POS 404 -#define PPTR 405 -#define CAST 406 +#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED +typedef union YYSTYPE +{ + +/* Line 1676 of yacc.c */ +#line 156 "parser.y" -#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) -#line 176 "parser.y" -typedef union YYSTYPE { attr_t *attr; attr_list_t *attr_list; str_list_t *str_list; @@ -363,15 +225,17 @@ typedef union YYSTYPE { struct _import_t *import; struct _decl_spec_t *declspec; enum storage_class stgclass; + + + +/* Line 1676 of yacc.c */ +#line 233 "parser.tab.h" } YYSTYPE; -/* Line 1447 of yacc.c. */ -#line 369 "parser.tab.h" +# define YYSTYPE_IS_TRIVIAL 1 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 -# define YYSTYPE_IS_TRIVIAL 1 #endif extern YYSTYPE parser_lval; - diff --git a/reactos/tools/widl/parser.y b/reactos/tools/widl/parser.y index 91036ab42f0..7fe373ceb53 100644 --- a/reactos/tools/widl/parser.y +++ b/reactos/tools/widl/parser.y @@ -28,9 +28,6 @@ #include #include #include -#ifdef HAVE_ALLOCA_H -#include -#endif #include "widl.h" #include "utils.h" @@ -68,7 +65,7 @@ #define YYERROR_VERBOSE -unsigned char pointer_default = RPC_FC_UP; +static unsigned char pointer_default = RPC_FC_UP; static int is_object_interface = FALSE; typedef struct list typelist_t; @@ -92,7 +89,6 @@ typedef struct _decl_spec_t typelist_t incomplete_types = LIST_INIT(incomplete_types); -static void add_incomplete(type_t *t); static void fix_incomplete(void); static void fix_incomplete_types(type_t *complete_type); @@ -109,30 +105,18 @@ static void set_type(var_t *v, decl_spec_t *decl_spec, const declarator_t *decl, static var_list_t *set_var_types(attr_list_t *attrs, decl_spec_t *decl_spec, declarator_list_t *decls); static ifref_list_t *append_ifref(ifref_list_t *list, ifref_t *iface); static ifref_t *make_ifref(type_t *iface); -static var_list_t *append_var(var_list_t *list, var_t *var); static var_list_t *append_var_list(var_list_t *list, var_list_t *vars); -static var_t *make_var(char *name); static declarator_list_t *append_declarator(declarator_list_t *list, declarator_t *p); static declarator_t *make_declarator(var_t *var); static func_list_t *append_func(func_list_t *list, func_t *func); static func_t *make_func(var_t *def); -static type_t *make_class(char *name); static type_t *make_safearray(type_t *type); -static type_t *make_builtin(char *name); -static type_t *make_int(int sign); static typelib_t *make_library(const char *name, const attr_list_t *attrs); static type_t *append_ptrchain_type(type_t *ptrchain, type_t *type); -static type_t *type_new_enum(char *name, var_list_t *enums); -static type_t *type_new_struct(char *name, int defined, var_list_t *fields); -static type_t *type_new_nonencapsulated_union(char *name, var_list_t *fields); -static type_t *type_new_encapsulated_union(char *name, var_t *switch_field, var_t *union_field, var_list_t *cases); - -static type_t *reg_type(type_t *type, const char *name, int t); static type_t *reg_typedefs(decl_spec_t *decl_spec, var_list_t *names, attr_list_t *attrs); static type_t *find_type_or_error(const char *name, int t); static type_t *find_type_or_error2(char *name, int t); -static type_t *get_type(unsigned char type, char *name, int t); static var_t *reg_const(var_t *var); @@ -168,10 +152,6 @@ static statement_t *make_statement_import(const char *str); static statement_t *make_statement_typedef(var_list_t *names); static statement_list_t *append_statement(statement_list_t *list, statement_t *stmt); -#define tsENUM 1 -#define tsSTRUCT 2 -#define tsUNION 3 - %} %union { attr_t *attr; @@ -274,7 +254,6 @@ static statement_list_t *append_statement(statement_list_t *list, statement_t *s %token tSAFEARRAY %token tSHORT %token tSIGNED -%token tSINGLE %token tSIZEIS tSIZEOF %token tSMALL %token tSOURCE @@ -614,14 +593,14 @@ enum_list: enum { if (!$1->eval) enum: ident '=' expr_int_const { $$ = reg_const($1); $$->eval = $3; - $$->type = make_int(0); + $$->type = type_new_int(TYPE_BASIC_INT, 0); } | ident { $$ = reg_const($1); - $$->type = make_int(0); + $$->type = type_new_int(TYPE_BASIC_INT, 0); } ; -enumdef: tENUM t_ident '{' enums '}' { $$ = type_new_enum($2, $4); } +enumdef: tENUM t_ident '{' enums '}' { $$ = type_new_enum($2, TRUE, $4); } ; m_exprs: m_expr { $$ = append_expr( NULL, $1 ); } @@ -772,51 +751,35 @@ ident: aIDENTIFIER { $$ = make_var($1); } | aKNOWNTYPE { $$ = make_var($1); } ; -base_type: tBYTE { $$ = make_builtin($1); } - | tWCHAR { $$ = make_builtin($1); } +base_type: tBYTE { $$ = find_type_or_error($1, 0); } + | tWCHAR { $$ = find_type_or_error($1, 0); } | int_std - | tSIGNED int_std { $$ = $2; $$->sign = 1; } - | tUNSIGNED int_std { $$ = $2; $$->sign = -1; - switch ($$->type) { - case RPC_FC_CHAR: break; - case RPC_FC_SMALL: $$->type = RPC_FC_USMALL; break; - case RPC_FC_SHORT: $$->type = RPC_FC_USHORT; break; - case RPC_FC_LONG: $$->type = RPC_FC_ULONG; break; - case RPC_FC_HYPER: - if ($$->name[0] == 'h') /* hyper, as opposed to __int64 */ - { - $$ = type_new_alias($$, "MIDL_uhyper"); - $$->sign = 0; - } - break; - default: break; - } - } - | tUNSIGNED { $$ = make_int(-1); } - | tFLOAT { $$ = make_builtin($1); } - | tSINGLE { $$ = find_type("float", 0); } - | tDOUBLE { $$ = make_builtin($1); } - | tBOOLEAN { $$ = make_builtin($1); } - | tERRORSTATUST { $$ = make_builtin($1); } - | tHANDLET { $$ = make_builtin($1); } + | tSIGNED int_std { $$ = type_new_int(type_basic_get_type($2), -1); } + | tUNSIGNED int_std { $$ = type_new_int(type_basic_get_type($2), 1); } + | tUNSIGNED { $$ = type_new_int(TYPE_BASIC_INT, 1); } + | tFLOAT { $$ = find_type_or_error($1, 0); } + | tDOUBLE { $$ = find_type_or_error($1, 0); } + | tBOOLEAN { $$ = find_type_or_error($1, 0); } + | tERRORSTATUST { $$ = find_type_or_error($1, 0); } + | tHANDLET { $$ = find_type_or_error($1, 0); } ; m_int: | tINT ; -int_std: tINT { $$ = make_builtin($1); } - | tSHORT m_int { $$ = make_builtin($1); } - | tSMALL { $$ = make_builtin($1); } - | tLONG m_int { $$ = make_builtin($1); } - | tHYPER m_int { $$ = make_builtin($1); } - | tINT64 { $$ = make_builtin($1); } - | tCHAR { $$ = make_builtin($1); } +int_std: tINT { $$ = type_new_int(TYPE_BASIC_INT, 0); } + | tSHORT m_int { $$ = type_new_int(TYPE_BASIC_INT16, 0); } + | tSMALL { $$ = type_new_int(TYPE_BASIC_INT8, 0); } + | tLONG m_int { $$ = type_new_int(TYPE_BASIC_INT32, 0); } + | tHYPER m_int { $$ = type_new_int(TYPE_BASIC_HYPER, 0); } + | tINT64 { $$ = type_new_int(TYPE_BASIC_INT64, 0); } + | tCHAR { $$ = type_new_int(TYPE_BASIC_CHAR, 0); } ; -coclass: tCOCLASS aIDENTIFIER { $$ = make_class($2); } +coclass: tCOCLASS aIDENTIFIER { $$ = type_new_coclass($2); } | tCOCLASS aKNOWNTYPE { $$ = find_type($2, 0); - if ($$->type != RPC_FC_COCLASS) + if (type_get_type_detect_alias($$) != TYPE_COCLASS) error_loc("%s was not declared a coclass at %s:%d\n", $2, $$->loc_info.input_name, $$->loc_info.line_number); @@ -841,8 +804,8 @@ coclass_int: m_attributes interfacedec { $$ = make_ifref($2); $$->attrs = $1; } ; -dispinterface: tDISPINTERFACE aIDENTIFIER { $$ = get_type(RPC_FC_IP, $2, 0); } - | tDISPINTERFACE aKNOWNTYPE { $$ = get_type(RPC_FC_IP, $2, 0); } +dispinterface: tDISPINTERFACE aIDENTIFIER { $$ = get_type(TYPE_INTERFACE, $2, 0); } + | tDISPINTERFACE aKNOWNTYPE { $$ = get_type(TYPE_INTERFACE, $2, 0); } ; dispinterfacehdr: attributes dispinterface { attr_t *attrs; @@ -879,8 +842,8 @@ inherit: { $$ = NULL; } | ':' aKNOWNTYPE { $$ = find_type_or_error2($2, 0); } ; -interface: tINTERFACE aIDENTIFIER { $$ = get_type(RPC_FC_IP, $2, 0); } - | tINTERFACE aKNOWNTYPE { $$ = get_type(RPC_FC_IP, $2, 0); } +interface: tINTERFACE aIDENTIFIER { $$ = get_type(TYPE_INTERFACE, $2, 0); } + | tINTERFACE aKNOWNTYPE { $$ = get_type(TYPE_INTERFACE, $2, 0); } ; interfacehdr: attributes interface { $$.interface = $2; @@ -965,7 +928,7 @@ decl_spec_no_type: declarator: '*' m_type_qual_list declarator %prec PPTR - { $$ = $3; $$->type = append_ptrchain_type($$->type, type_new_pointer(NULL, $2)); } + { $$ = $3; $$->type = append_ptrchain_type($$->type, type_new_pointer(pointer_default, NULL, $2)); } | callconv declarator { $$ = $2; $$->type->attrs = append_attr($$->type->attrs, make_attrp(ATTR_CALLCONV, $1)); } | direct_declarator ; @@ -999,15 +962,15 @@ pointer_type: structdef: tSTRUCT t_ident '{' fields '}' { $$ = type_new_struct($2, TRUE, $4); } ; -type: tVOID { $$ = find_type_or_error("void", 0); } +type: tVOID { $$ = type_new_void(); } | aKNOWNTYPE { $$ = find_type_or_error($1, 0); } | base_type { $$ = $1; } | enumdef { $$ = $1; } - | tENUM aIDENTIFIER { $$ = find_type_or_error2($2, tsENUM); } + | tENUM aIDENTIFIER { $$ = type_new_enum($2, FALSE, NULL); } | structdef { $$ = $1; } | tSTRUCT aIDENTIFIER { $$ = type_new_struct($2, FALSE, NULL); } | uniondef { $$ = $1; } - | tUNION aIDENTIFIER { $$ = find_type_or_error2($2, tsUNION); } + | tUNION aIDENTIFIER { $$ = type_new_nonencapsulated_union($2, FALSE, NULL); } | tSAFEARRAY '(' type ')' { $$ = make_safearray($3); } ; @@ -1018,7 +981,7 @@ typedef: tTYPEDEF m_attributes decl_spec declarator_list ; uniondef: tUNION t_ident '{' ne_union_fields '}' - { $$ = type_new_nonencapsulated_union($2, $4); } + { $$ = type_new_nonencapsulated_union($2, TRUE, $4); } | tUNION t_ident tSWITCH '(' s_field ')' m_ident '{' cases '}' { $$ = type_new_encapsulated_union($2, $5, $7, $9); } @@ -1031,49 +994,26 @@ version: %% -static void decl_builtin(const char *name, unsigned char type) +static void decl_builtin_basic(const char *name, enum type_basic_type type) { - type_t *t = make_type(type, NULL); - t->name = xstrdup(name); + type_t *t = type_new_basic(type); reg_type(t, name, 0); } -static type_t *make_builtin(char *name) +static void decl_builtin_alias(const char *name, type_t *t) { - /* NAME is strdup'd in the lexer */ - type_t *t = duptype(find_type_or_error(name, 0), 0); - t->name = name; - return t; -} - -static type_t *make_int(int sign) -{ - type_t *t = duptype(find_type_or_error("int", 0), 1); - - t->sign = sign; - if (sign < 0) - t->type = t->type == RPC_FC_LONG ? RPC_FC_ULONG : RPC_FC_USHORT; - - return t; + reg_type(type_new_alias(t, name), name, 0); } void init_types(void) { - decl_builtin("void", 0); - decl_builtin("byte", RPC_FC_BYTE); - decl_builtin("wchar_t", RPC_FC_WCHAR); - decl_builtin("int", RPC_FC_LONG); /* win32 */ - decl_builtin("short", RPC_FC_SHORT); - decl_builtin("small", RPC_FC_SMALL); - decl_builtin("long", RPC_FC_LONG); - decl_builtin("hyper", RPC_FC_HYPER); - decl_builtin("__int64", RPC_FC_HYPER); - decl_builtin("char", RPC_FC_CHAR); - decl_builtin("float", RPC_FC_FLOAT); - decl_builtin("double", RPC_FC_DOUBLE); - decl_builtin("boolean", RPC_FC_BYTE); - decl_builtin("error_status_t", RPC_FC_ERROR_STATUS_T); - decl_builtin("handle_t", RPC_FC_BIND_PRIMITIVE); + decl_builtin_basic("byte", TYPE_BASIC_BYTE); + decl_builtin_basic("wchar_t", TYPE_BASIC_WCHAR); + decl_builtin_basic("float", TYPE_BASIC_FLOAT); + decl_builtin_basic("double", TYPE_BASIC_DOUBLE); + decl_builtin_basic("error_status_t", TYPE_BASIC_ERROR_STATUS_T); + decl_builtin_basic("handle_t", TYPE_BASIC_HANDLE); + decl_builtin_alias("boolean", type_new_basic(TYPE_BASIC_BYTE)); } static str_list_t *append_str(str_list_t *list, char *str) @@ -1286,98 +1226,6 @@ void clear_all_offsets(void) node->data.typestring_offset = node->data.ptrdesc = 0; } -type_t *make_type(unsigned char type, type_t *ref) -{ - type_t *t = alloc_type(); - t->name = NULL; - t->type = type; - t->ref = ref; - t->attrs = NULL; - t->orig = NULL; - memset(&t->details, 0, sizeof(t->details)); - t->typestring_offset = 0; - t->ptrdesc = 0; - t->declarray = FALSE; - t->ignore = (parse_only != 0); - t->sign = 0; - t->defined = FALSE; - t->written = FALSE; - t->user_types_registered = FALSE; - t->tfswrite = FALSE; - t->checked = FALSE; - t->is_alias = FALSE; - t->typelib_idx = -1; - init_loc_info(&t->loc_info); - return t; -} - -static type_t *type_new_enum(char *name, var_list_t *enums) -{ - type_t *t = get_type(RPC_FC_ENUM16, name, tsENUM); - if (enums) - { - t->details.enumeration = xmalloc(sizeof(*t->details.enumeration)); - t->details.enumeration->enums = enums; - } - else - t->details.enumeration = NULL; - t->defined = TRUE; - return t; -} - -static type_t *type_new_struct(char *name, int defined, var_list_t *fields) -{ - type_t *tag_type = name ? find_type(name, tsSTRUCT) : NULL; - type_t *t = make_type(RPC_FC_STRUCT, NULL); - t->name = name; - if (defined || (tag_type && tag_type->details.structure)) - { - if (tag_type && tag_type->details.structure) - { - t->details.structure = tag_type->details.structure; - t->type = tag_type->type; - } - else if (defined) - { - t->details.structure = xmalloc(sizeof(*t->details.structure)); - t->details.structure->fields = fields; - t->defined = TRUE; - } - } - if (name) - { - if (fields) - reg_type(t, name, tsSTRUCT); - else - add_incomplete(t); - } - return t; -} - -static type_t *type_new_nonencapsulated_union(char *name, var_list_t *fields) -{ - type_t *t = get_type(RPC_FC_NON_ENCAPSULATED_UNION, name, tsUNION); - t->details.structure = xmalloc(sizeof(*t->details.structure)); - t->details.structure->fields = fields; - t->defined = TRUE; - return t; -} - -static type_t *type_new_encapsulated_union(char *name, var_t *switch_field, var_t *union_field, var_list_t *cases) -{ - type_t *t = get_type(RPC_FC_ENCAPSULATED_UNION, name, tsUNION); - if (!union_field) union_field = make_var( xstrdup("tagged_union") ); - union_field->type = make_type(RPC_FC_NON_ENCAPSULATED_UNION, NULL); - union_field->type->details.structure = xmalloc(sizeof(*union_field->type->details.structure)); - union_field->type->details.structure->fields = cases; - union_field->type->defined = TRUE; - t->details.structure = xmalloc(sizeof(*t->details.structure)); - t->details.structure->fields = append_var( NULL, switch_field ); - t->details.structure->fields = append_var( t->details.structure->fields, union_field ); - t->defined = TRUE; - return t; -} - static void type_function_add_head_arg(type_t *type, var_t *arg) { if (!type->details.function->args) @@ -1393,9 +1241,10 @@ static type_t *append_ptrchain_type(type_t *ptrchain, type_t *type) type_t *ptrchain_type; if (!ptrchain) return type; - for (ptrchain_type = ptrchain; ptrchain_type->ref; ptrchain_type = ptrchain_type->ref) + for (ptrchain_type = ptrchain; type_pointer_get_ref(ptrchain_type); ptrchain_type = type_pointer_get_ref(ptrchain_type)) ; - ptrchain_type->ref = type; + assert(ptrchain_type->type_type == TYPE_POINTER); + ptrchain_type->details.pointer.ref = type; return ptrchain; } @@ -1429,9 +1278,8 @@ static void set_type(var_t *v, decl_spec_t *decl_spec, const declarator_t *decl, v->type = append_ptrchain_type(decl ? decl->type : NULL, type); v->stgclass = decl_spec->stgclass; - /* the highest level of pointer specified should default to the var's ptr attr - * or (RPC_FC_RP if not specified and it's a top level ptr), not - * pointer_default so we need to fix that up here */ + /* check for pointer attribute being applied to non-pointer, non-array + * type */ if (!arr) { int ptr_attr = get_attrv(v->attrs, ATTR_POINTERTYPE); @@ -1447,11 +1295,21 @@ static void set_type(var_t *v, decl_spec_t *decl_spec, const declarator_t *decl, else break; } - if (ptr && is_ptr(ptr) && (ptr_attr || top)) + if (is_ptr(ptr)) { - /* duplicate type to avoid changing original type */ - *pt = duptype(*pt, 1); - (*pt)->type = ptr_attr ? ptr_attr : RPC_FC_RP; + if (ptr_attr && ptr_attr != RPC_FC_UP && + type_get_type(type_pointer_get_ref(ptr)) == TYPE_INTERFACE) + warning_loc_info(&v->loc_info, + "%s: pointer attribute applied to interface " + "pointer type has no effect\n", v->name); + if (!ptr_attr && top && (*pt)->details.pointer.def_fc != RPC_FC_RP) + { + /* FIXME: this is a horrible hack to cope with the issue that we + * store an offset to the typeformat string in the type object, but + * two typeformat strings may be written depending on whether the + * pointer is a toplevel parameter or not */ + *pt = duptype(*pt, 1); + } } else if (ptr_attr) error_loc("%s: pointer attribute applied to non-pointer type\n", v->name); @@ -1463,9 +1321,7 @@ static void set_type(var_t *v, decl_spec_t *decl_spec, const declarator_t *decl, if (is_attr(v->attrs, ATTR_V1ENUM)) { - if (v->type->type == RPC_FC_ENUM16) - v->type->type = RPC_FC_ENUM32; - else + if (type_get_type_detect_alias(v->type) != TYPE_ENUM) error_loc("'%s': [v1_enum] attribute applied to non-enum type\n", v->name); } @@ -1485,18 +1341,19 @@ static void set_type(var_t *v, decl_spec_t *decl_spec, const declarator_t *decl, if (0) { unsigned int align = 0; - size_t size = type_memsize(v->type, &align); + unsigned int size = type_memsize(v->type, &align); - if (0xffffffffuL / size < (unsigned long) dim->cval) + if (0xffffffffu / size < dim->cval) error_loc("%s: total array size is too large\n", v->name); } } else sizeless = TRUE; - *ptype = type_new_array(NULL, *ptype, TRUE, + *ptype = type_new_array(NULL, *ptype, FALSE, dim->is_const ? dim->cval : 0, - dim->is_const ? NULL : dim, NULL); + dim->is_const ? NULL : dim, NULL, + pointer_default); } ptype = &v->type; @@ -1510,18 +1367,21 @@ static void set_type(var_t *v, decl_spec_t *decl_spec, const declarator_t *decl, error_loc("%s: cannot specify size_is for a fixed sized array\n", v->name); else *ptype = type_new_array((*ptype)->name, - type_array_get_element(*ptype), TRUE, - 0, dim, NULL); + type_array_get_element(*ptype), FALSE, + 0, dim, NULL, 0); } else if (is_ptr(*ptype)) - *ptype = type_new_array((*ptype)->name, type_pointer_get_ref(*ptype), FALSE, - 0, dim, NULL); + *ptype = type_new_array((*ptype)->name, type_pointer_get_ref(*ptype), TRUE, + 0, dim, NULL, pointer_default); else error_loc("%s: size_is attribute applied to illegal type\n", v->name); } - ptype = &(*ptype)->ref; - if (*ptype == NULL) + if (is_ptr(*ptype)) + ptype = &(*ptype)->details.pointer.ref; + else if (is_array(*ptype)) + ptype = &(*ptype)->details.array.elem; + else error_loc("%s: too many expressions in size_is attribute\n", v->name); } @@ -1534,17 +1394,20 @@ static void set_type(var_t *v, decl_spec_t *decl_spec, const declarator_t *decl, { *ptype = type_new_array((*ptype)->name, type_array_get_element(*ptype), - (*ptype)->declarray, + type_array_is_decl_as_ptr(*ptype), type_array_get_dim(*ptype), type_array_get_conformance(*ptype), - dim); + dim, type_array_get_ptr_default_fc(*ptype)); } else error_loc("%s: length_is attribute applied to illegal type\n", v->name); } - ptype = &(*ptype)->ref; - if (*ptype == NULL) + if (is_ptr(*ptype)) + ptype = &(*ptype)->details.pointer.ref; + else if (is_array(*ptype)) + ptype = &(*ptype)->details.array.elem; + else error_loc("%s: too many expressions in length_is attribute\n", v->name); } @@ -1558,8 +1421,8 @@ static void set_type(var_t *v, decl_spec_t *decl_spec, const declarator_t *decl, v->type = func_type; for (ft = v->type; is_ptr(ft); ft = type_pointer_get_ref(ft)) ; - assert(ft->type == RPC_FC_FUNCTION); - ft->ref = return_type; + assert(type_get_type_detect_alias(ft) == TYPE_FUNCTION); + ft->details.function->rettype = return_type; /* move calling convention attribute, if present, from pointer nodes to * function node */ for (t = v->type; is_ptr(t); t = type_pointer_get_ref(t)) @@ -1617,7 +1480,7 @@ static ifref_t *make_ifref(type_t *iface) return l; } -static var_list_t *append_var(var_list_t *list, var_t *var) +var_list_t *append_var(var_list_t *list, var_t *var) { if (!var) return list; if (!list) @@ -1641,7 +1504,7 @@ static var_list_t *append_var_list(var_list_t *list, var_list_t *vars) return list; } -static var_t *make_var(char *name) +var_t *make_var(char *name) { var_t *v = xmalloc(sizeof(var_t)); v->name = name; @@ -1693,18 +1556,10 @@ static func_t *make_func(var_t *def) return f; } -static type_t *make_class(char *name) -{ - type_t *c = make_type(RPC_FC_COCLASS, NULL); - c->name = name; - return c; -} - static type_t *make_safearray(type_t *type) { - type_t *sa = find_type_or_error("SAFEARRAY", 0); - sa->ref = type; - return make_type(pointer_default, sa); + return type_new_array(NULL, type_new_alias(type, "SAFEARRAY"), TRUE, 0, + NULL, NULL, RPC_FC_RP); } static typelib_t *make_library(const char *name, const attr_list_t *attrs) @@ -1742,7 +1597,7 @@ struct rtype { struct rtype *type_hash[HASHMAX]; -static type_t *reg_type(type_t *type, const char *name, int t) +type_t *reg_type(type_t *type, const char *name, int t) { struct rtype *nt; int hash; @@ -1764,10 +1619,13 @@ static type_t *reg_type(type_t *type, const char *name, int t) static int is_incomplete(const type_t *t) { - return !t->defined && (is_struct(t->type) || is_union(t->type)); + return !t->defined && + (type_get_type_detect_alias(t) == TYPE_STRUCT || + type_get_type_detect_alias(t) == TYPE_UNION || + type_get_type_detect_alias(t) == TYPE_ENCAPSULATED_UNION); } -static void add_incomplete(type_t *t) +void add_incomplete(type_t *t) { struct typenode *tn = xmalloc(sizeof *tn); tn->type = t; @@ -1779,7 +1637,9 @@ static void fix_type(type_t *t) if (type_is_alias(t) && is_incomplete(t)) { type_t *ot = type_alias_get_aliasee(t); fix_type(ot); - if (is_struct(ot->type) || is_union(ot->type)) + if (type_get_type_detect_alias(ot) == TYPE_STRUCT || + type_get_type_detect_alias(ot) == TYPE_UNION || + type_get_type_detect_alias(ot) == TYPE_ENCAPSULATED_UNION) t->details.structure = ot->details.structure; t->defined = ot->defined; } @@ -1802,12 +1662,9 @@ static void fix_incomplete_types(type_t *complete_type) LIST_FOR_EACH_ENTRY_SAFE(tn, next, &incomplete_types, struct typenode, entry) { - if (((is_struct(complete_type->type) && is_struct(tn->type->type)) || - (is_union(complete_type->type) && is_union(tn->type->type))) && - !strcmp(complete_type->name, tn->type->name)) + if (type_is_equal(complete_type, tn->type)) { tn->type->details.structure = complete_type->details.structure; - tn->type->type = complete_type->type; list_remove(&tn->entry); free(tn); } @@ -1823,13 +1680,14 @@ static type_t *reg_typedefs(decl_spec_t *decl_spec, declarator_list_t *decls, at if (is_str) { type_t *t = decl_spec->type; - unsigned char c; while (is_ptr(t)) t = type_pointer_get_ref(t); - c = t->type; - if (c != RPC_FC_CHAR && c != RPC_FC_BYTE && c != RPC_FC_WCHAR) + if (type_get_type(t) != TYPE_BASIC && + (get_basic_fc(t) != RPC_FC_CHAR && + get_basic_fc(t) != RPC_FC_BYTE && + get_basic_fc(t) != RPC_FC_WCHAR)) { decl = LIST_ENTRY( list_head( decls ), const declarator_t, entry ); error_loc("'%s': [string] attribute is only valid on 'char', 'byte', or 'wchar_t' pointers and arrays\n", @@ -1840,8 +1698,10 @@ static type_t *reg_typedefs(decl_spec_t *decl_spec, declarator_list_t *decls, at /* We must generate names for tagless enum, struct or union. Typedef-ing a tagless enum, struct or union means we want the typedef to be included in a library hence the public attribute. */ - if ((type->type == RPC_FC_ENUM16 || type->type == RPC_FC_ENUM32 || - is_struct(type->type) || is_union(type->type)) && + if ((type_get_type_detect_alias(type) == TYPE_ENUM || + type_get_type_detect_alias(type) == TYPE_STRUCT || + type_get_type_detect_alias(type) == TYPE_UNION || + type_get_type_detect_alias(type) == TYPE_ENCAPSULATED_UNION) && !type->name && !parse_only) { if (! is_attr(attrs, ATTR_PUBLIC)) @@ -1908,7 +1768,7 @@ int is_type(const char *name) return find_type(name, 0) != NULL; } -static type_t *get_type(unsigned char type, char *name, int t) +type_t *get_type(enum type_type type, char *name, int t) { type_t *tp; if (name) { @@ -1918,7 +1778,7 @@ static type_t *get_type(unsigned char type, char *name, int t) return tp; } } - tp = make_type(type, NULL); + tp = make_type(type); tp->name = name; if (!name) return tp; return reg_type(tp, name, t); @@ -2120,7 +1980,7 @@ static void check_arg(var_t *arg) const type_t *t = arg->type; const attr_t *attr; - if (t->type == 0 && ! is_var_ptr(arg)) + if (type_get_type(t) == TYPE_VOID) error_loc("argument '%s' has void type\n", arg->name); if (arg->attrs) @@ -2253,23 +2113,44 @@ static attr_list_t *check_coclass_attrs(const char *name, attr_list_t *attrs) static int is_allowed_conf_type(const type_t *type) { - switch (type->type) + switch (type_get_type(type)) { - case RPC_FC_CHAR: - case RPC_FC_SMALL: - case RPC_FC_BYTE: - case RPC_FC_USMALL: - case RPC_FC_WCHAR: - case RPC_FC_SHORT: - case RPC_FC_ENUM16: - case RPC_FC_USHORT: - case RPC_FC_LONG: - case RPC_FC_ENUM32: - case RPC_FC_ULONG: + case TYPE_ENUM: return TRUE; - default: + case TYPE_BASIC: + switch (type_basic_get_type(type)) + { + case TYPE_BASIC_INT8: + case TYPE_BASIC_INT16: + case TYPE_BASIC_INT32: + case TYPE_BASIC_INT64: + case TYPE_BASIC_INT: + case TYPE_BASIC_CHAR: + case TYPE_BASIC_HYPER: + case TYPE_BASIC_BYTE: + case TYPE_BASIC_WCHAR: + case TYPE_BASIC_ERROR_STATUS_T: + return TRUE; + default: + return FALSE; + } + case TYPE_ALIAS: + /* shouldn't get here because of type_get_type call above */ + assert(0); + /* fall through */ + case TYPE_STRUCT: + case TYPE_UNION: + case TYPE_ENCAPSULATED_UNION: + case TYPE_ARRAY: + case TYPE_POINTER: + case TYPE_VOID: + case TYPE_MODULE: + case TYPE_COCLASS: + case TYPE_FUNCTION: + case TYPE_INTERFACE: return FALSE; } + return FALSE; } static int is_ptr_guid_type(const type_t *type) @@ -2309,16 +2190,26 @@ static void check_field_common(const type_t *container_type, const char *container_name, const var_t *arg) { type_t *type = arg->type; - int is_wire_marshal = 0; - int is_context_handle = 0; + int more_to_do; const char *container_type_name = NULL; - if (is_struct(container_type->type)) + switch (type_get_type_detect_alias(type)) + { + case TYPE_STRUCT: container_type_name = "struct"; - else if (is_union(container_type->type)) + break; + case TYPE_UNION: container_type_name = "union"; - else if (container_type->type == RPC_FC_FUNCTION) + break; + case TYPE_ENCAPSULATED_UNION: + container_type_name = "encapsulated union"; + break; + case TYPE_FUNCTION: container_type_name = "function"; + break; + default: + break; + } if (is_attr(arg->attrs, ATTR_LENGTHIS) && (is_attr(arg->attrs, ATTR_STRING) || is_aliaschain_attr(arg->type, ATTR_STRING))) @@ -2366,35 +2257,56 @@ static void check_field_common(const type_t *container_type, } } - /* get fundamental type for the argument */ - for (;;) + do { - if (is_attr(type->attrs, ATTR_WIREMARSHAL)) - { - is_wire_marshal = 1; - break; - } - if (is_attr(type->attrs, ATTR_CONTEXTHANDLE)) - { - is_context_handle = 1; - break; - } - if (type_is_alias(type)) - type = type_alias_get_aliasee(type); - else if (is_ptr(type)) - type = type_pointer_get_ref(type); - else if (is_array(type)) - type = type_array_get_element(type); - else - break; - } + more_to_do = FALSE; - if (type->type == 0 && !is_attr(arg->attrs, ATTR_IIDIS) && !is_wire_marshal && !is_context_handle) - error_loc_info(&arg->loc_info, "parameter \'%s\' of %s \'%s\' cannot derive from void *\n", arg->name, container_type_name, container_name); - else if (type->type == RPC_FC_FUNCTION) - error_loc_info(&arg->loc_info, "parameter \'%s\' of %s \'%s\' cannot be a function pointer\n", arg->name, container_type_name, container_name); - else if (!is_wire_marshal && (is_struct(type->type) || is_union(type->type))) - check_remoting_fields(arg, type); + switch (typegen_detect_type(type, arg->attrs, TDT_IGNORE_STRINGS)) + { + case TGT_STRUCT: + case TGT_UNION: + check_remoting_fields(arg, type); + break; + case TGT_INVALID: + switch (type_get_type(type)) + { + case TYPE_VOID: + error_loc_info(&arg->loc_info, "parameter \'%s\' of %s \'%s\' cannot derive from void *\n", + arg->name, container_type_name, container_name); + break; + case TYPE_FUNCTION: + error_loc_info(&arg->loc_info, "parameter \'%s\' of %s \'%s\' cannot be a function pointer\n", + arg->name, container_type_name, container_name); + break; + case TYPE_COCLASS: + case TYPE_INTERFACE: + case TYPE_MODULE: + /* FIXME */ + break; + default: + break; + } + case TGT_CTXT_HANDLE: + case TGT_CTXT_HANDLE_POINTER: + /* FIXME */ + break; + case TGT_POINTER: + type = type_pointer_get_ref(type); + more_to_do = TRUE; + break; + case TGT_ARRAY: + type = type_array_get_element(type); + more_to_do = TRUE; + break; + case TGT_USER_TYPE: + case TGT_STRING: + case TGT_IFACE_POINTER: + case TGT_BASIC: + case TGT_ENUM: + /* nothing to do */ + break; + } + } while (more_to_do); } static void check_remoting_fields(const var_t *var, type_t *type) @@ -2409,14 +2321,14 @@ static void check_remoting_fields(const var_t *var, type_t *type) type->checked = TRUE; - if (is_struct(type->type)) + if (type_get_type(type) == TYPE_STRUCT) { if (type_is_complete(type)) fields = type_struct_get_fields(type); else error_loc_info(&var->loc_info, "undefined type declaration %s\n", type->name); } - else if (is_union(type->type)) + else if (type_get_type(type) == TYPE_UNION || type_get_type(type) == TYPE_ENCAPSULATED_UNION) fields = type_union_get_cases(type); if (fields) LIST_FOR_EACH_ENTRY( field, fields, const var_t, entry ) @@ -2431,36 +2343,37 @@ static void check_remoting_args(const var_t *func) if (func->type->details.function->args) LIST_FOR_EACH_ENTRY( arg, func->type->details.function->args, const var_t, entry ) { - int ptr_level = 0; const type_t *type = arg->type; - /* get pointer level and fundamental type for the argument */ - for (;;) - { - if (is_attr(type->attrs, ATTR_WIREMARSHAL)) - break; - if (is_attr(type->attrs, ATTR_CONTEXTHANDLE)) - break; - if (type_is_alias(type)) - type = type_alias_get_aliasee(type); - else if (is_ptr(type)) - { - ptr_level++; - type = type_pointer_get_ref(type); - } - else - break; - } - /* check that [out] parameters have enough pointer levels */ if (is_attr(arg->attrs, ATTR_OUT)) { - if (!is_array(type)) + switch (typegen_detect_type(type, arg->attrs, TDT_ALL_TYPES)) { - if (!ptr_level) - error_loc_info(&arg->loc_info, "out parameter \'%s\' of function \'%s\' is not a pointer\n", arg->name, funcname); - if (type->type == RPC_FC_IP && ptr_level == 1) - error_loc_info(&arg->loc_info, "out interface pointer \'%s\' of function \'%s\' is not a double pointer\n", arg->name, funcname); + case TGT_BASIC: + case TGT_ENUM: + case TGT_STRUCT: + case TGT_UNION: + case TGT_CTXT_HANDLE: + case TGT_USER_TYPE: + error_loc_info(&arg->loc_info, "out parameter \'%s\' of function \'%s\' is not a pointer\n", arg->name, funcname); + break; + case TGT_IFACE_POINTER: + error_loc_info(&arg->loc_info, "out interface pointer \'%s\' of function \'%s\' is not a double pointer\n", arg->name, funcname); + break; + case TGT_STRING: + if (!is_array(type)) + { + /* FIXME */ + } + break; + case TGT_INVALID: + /* already error'd before we get here */ + case TGT_CTXT_HANDLE_POINTER: + case TGT_POINTER: + case TGT_ARRAY: + /* OK */ + break; } } @@ -2526,7 +2439,7 @@ static void check_statements(const statement_list_t *stmts, int is_inside_librar { if (stmt->type == STMT_LIBRARY) check_statements(stmt->u.lib->stmts, TRUE); - else if (stmt->type == STMT_TYPE && stmt->u.type->type == RPC_FC_IP) + else if (stmt->type == STMT_TYPE && type_get_type(stmt->u.type) == TYPE_INTERFACE) check_functions(stmt->u.type, is_inside_library); } } @@ -2539,7 +2452,7 @@ static void check_all_user_types(const statement_list_t *stmts) { if (stmt->type == STMT_LIBRARY) check_all_user_types(stmt->u.lib->stmts); - else if (stmt->type == STMT_TYPE && stmt->u.type->type == RPC_FC_IP && + else if (stmt->type == STMT_TYPE && type_get_type(stmt->u.type) == TYPE_INTERFACE && !is_local(stmt->u.type->attrs)) { const statement_t *stmt_func; @@ -2600,8 +2513,9 @@ static statement_t *make_statement_declaration(var_t *var) if (var->eval) reg_const(var); } - else if ((var->stgclass == STG_NONE || var->stgclass == STG_REGISTER) && - var->type->type != RPC_FC_FUNCTION) + else if (type_get_type(var->type) == TYPE_FUNCTION) + check_function_attrs(var->name, var->attrs); + else if (var->stgclass == STG_NONE || var->stgclass == STG_REGISTER) error_loc("instantiation of data is illegal\n"); return stmt; } diff --git a/reactos/tools/widl/parser.yy.c b/reactos/tools/widl/parser.yy.c index 677f9e36271..57c4cd90667 100644 --- a/reactos/tools/widl/parser.yy.c +++ b/reactos/tools/widl/parser.yy.c @@ -2140,7 +2140,6 @@ static const struct keyword attr_keywords[] = {"requestedit", tREQUESTEDIT}, {"restricted", tRESTRICTED}, {"retval", tRETVAL}, - {"single", tSINGLE}, {"size_is", tSIZEIS}, {"source", tSOURCE}, {"strict_context_handle", tSTRICTCONTEXTHANDLE}, diff --git a/reactos/tools/widl/proxy.c b/reactos/tools/widl/proxy.c index f2a24130cff..b8ccdaccd08 100644 --- a/reactos/tools/widl/proxy.c +++ b/reactos/tools/widl/proxy.c @@ -50,6 +50,7 @@ static int indent = 0; /* FIXME: support generation of stubless proxies */ +static void print_proxy( const char *format, ... ) __attribute__((format (printf, 1, 2))); static void print_proxy( const char *format, ... ) { va_list va; @@ -122,12 +123,10 @@ static void init_proxy(const statement_list_t *stmts) print_proxy( " void *This;\n"); print_proxy( "};\n"); print_proxy( "\n"); - print_proxy("#ifndef USE_COMPILER_EXCEPTIONS\n"); print_proxy("static int __proxy_filter( struct __proxy_frame *__frame )\n"); print_proxy( "{\n"); print_proxy( " return (__frame->_StubMsg.dwStubPhase != PROXY_SENDRECEIVE);\n"); print_proxy( "}\n"); - print_proxy("#endif /* USE_COMPILER_EXCEPTIONS */\n"); print_proxy( "\n"); } @@ -154,44 +153,17 @@ int is_var_ptr(const var_t *v) int cant_be_null(const var_t *v) { - /* Search backwards for the most recent pointer attribute. */ - const attr_list_t *attrs = v->attrs; - const type_t *type = v->type; - - /* context handles have their own checking so they can be null for the - * purposes of null ref pointer checking */ - if (is_aliaschain_attr(type, ATTR_CONTEXTHANDLE)) - return 0; - - if (is_user_type(type)) - return 0; - - if (!attrs && is_ptr(type)) - { - attrs = type->attrs; - type = type_pointer_get_ref(type); - } - - while (attrs) - { - int t = get_attrv(attrs, ATTR_POINTERTYPE); - - if (t == RPC_FC_FP || t == RPC_FC_OP || t == RPC_FC_UP) - return 0; - - if (t == RPC_FC_RP) - return 1; - - if (is_ptr(type)) + switch (typegen_detect_type(v->type, v->attrs, TDT_IGNORE_STRINGS)) { - attrs = type->attrs; - type = type_pointer_get_ref(type); + case TGT_ARRAY: + case TGT_POINTER: + return (get_pointer_fc(v->type, v->attrs, TRUE) == RPC_FC_RP); + case TGT_CTXT_HANDLE_POINTER: + return TRUE; + default: + return 0; } - else - attrs = NULL; - } - return 1; /* Default is RPC_FC_RP. */ } static int need_delegation(const type_t *iface) @@ -253,22 +225,18 @@ static void free_variable( const var_t *arg, const char *local_var_prefix ) return; } - switch( type->type ) + switch (typegen_detect_type(type, arg->attrs, TDT_IGNORE_STRINGS)) { - case RPC_FC_BYTE: - case RPC_FC_CHAR: - case RPC_FC_WCHAR: - case RPC_FC_SHORT: - case RPC_FC_USHORT: - case RPC_FC_ENUM16: - case RPC_FC_LONG: - case RPC_FC_ULONG: - case RPC_FC_ENUM32: - case RPC_FC_STRUCT: + case TGT_ENUM: + case TGT_BASIC: break; - case RPC_FC_FP: - case RPC_FC_IP: + case TGT_STRUCT: + if (get_struct_fc(type) != RPC_FC_STRUCT) + print_proxy("/* FIXME: %s code for %s struct type 0x%x missing */\n", __FUNCTION__, arg->name, get_struct_fc(type) ); + break; + + case TGT_IFACE_POINTER: iid = get_attrp( arg->attrs, ATTR_IIDIS ); if( iid ) { @@ -276,13 +244,20 @@ static void free_variable( const var_t *arg, const char *local_var_prefix ) write_expr(proxy, iid, 1, 1, NULL, NULL, local_var_prefix); print_proxy( ";\n\n" ); } - print_proxy( "NdrClearOutParameters( &__frame->_StubMsg, "); - fprintf(proxy, "&__MIDL_TypeFormatString.Format[%u], ", type_offset ); - fprintf(proxy, "(void*)%s );\n", arg->name ); + /* fall through */ + case TGT_POINTER: + if (get_pointer_fc(type, arg->attrs, TRUE) == RPC_FC_FP) + { + print_proxy( "NdrClearOutParameters( &__frame->_StubMsg, "); + fprintf(proxy, "&__MIDL_TypeFormatString.Format[%u], ", type_offset ); + fprintf(proxy, "(void*)%s );\n", arg->name ); + } + else + print_proxy("/* FIXME: %s code for %s type %d missing */\n", __FUNCTION__, arg->name, type_get_type(type) ); break; default: - print_proxy("/* FIXME: %s code for %s type %d missing */\n", __FUNCTION__, arg->name, type->type ); + print_proxy("/* FIXME: %s code for %s type %d missing */\n", __FUNCTION__, arg->name, type_get_type(type) ); } } @@ -327,9 +302,9 @@ static void gen_proxy(type_t *iface, const var_t *func, int idx, print_proxy( "struct __proxy_frame __f, * const __frame = &__f;\n" ); /* local variables */ if (has_ret) { - print_proxy( "" ); + print_proxy( "%s", "" ); write_type_decl_left(proxy, type_function_get_rettype(func->type)); - print_proxy(" _RetVal;\n"); + print_proxy( " _RetVal;\n"); } print_proxy( "RPC_MESSAGE _RpcMessage;\n" ); if (has_ret) { @@ -483,8 +458,7 @@ static void gen_stub(type_t *iface, const var_t *func, const char *cas, print_proxy("*_pdwStubPhase = STUB_CALL_SERVER;\n"); fprintf(proxy, "\n"); - print_proxy(""); - if (has_ret) fprintf(proxy, "__frame->_RetVal = "); + print_proxy( "%s", has_ret ? "__frame->_RetVal = " : "" ); if (cas) fprintf(proxy, "%s_%s_Stub", iface->name, cas); else fprintf(proxy, "__frame->_This->lpVtbl->%s", get_name(func)); fprintf(proxy, "(__frame->_This"); @@ -492,7 +466,7 @@ static void gen_stub(type_t *iface, const var_t *func, const char *cas, if (type_get_function_args(func->type)) { LIST_FOR_EACH_ENTRY( arg, type_get_function_args(func->type), const var_t, entry ) - fprintf(proxy, ", %s__frame->%s", arg->type->declarray ? "*" : "", arg->name); + fprintf(proxy, ", %s__frame->%s", is_array(arg->type) && !type_array_is_decl_as_ptr(arg->type) ? "*" :"" , arg->name); } fprintf(proxy, ");\n"); fprintf(proxy, "\n"); @@ -653,7 +627,7 @@ static void write_proxy(type_t *iface, unsigned int *proc_offset) print_proxy( "static const CINTERFACE_PROXY_VTABLE(%d) _%sProxyVtbl =\n", count, iface->name); print_proxy( "{\n"); indent++; - print_proxy( "{\n", iface->name); + print_proxy( "{\n"); indent++; print_proxy( "&IID_%s,\n", iface->name); indent--; @@ -688,7 +662,7 @@ static void write_proxy(type_t *iface, unsigned int *proc_offset) print_proxy( "%d,\n", count); print_proxy( "&%s_table[-3],\n", iface->name); indent--; - print_proxy( "},\n", iface->name); + print_proxy( "},\n"); print_proxy( "{\n"); indent++; print_proxy( "CStdStubBuffer_%s\n", need_delegation_indirect(iface) ? "DELEGATING_METHODS" : "METHODS"); @@ -711,7 +685,7 @@ static int does_any_iface(const statement_list_t *stmts, type_pred_t pred) if (does_any_iface(stmt->u.lib->stmts, pred)) return TRUE; } - else if (stmt->type == STMT_TYPE && stmt->u.type->type == RPC_FC_IP) + else if (stmt->type == STMT_TYPE && type_get_type(stmt->u.type) == TYPE_INTERFACE) { if (pred(stmt->u.type)) return TRUE; @@ -748,7 +722,7 @@ static void write_proxy_stmts(const statement_list_t *stmts, unsigned int *proc_ { if (stmt->type == STMT_LIBRARY) write_proxy_stmts(stmt->u.lib->stmts, proc_offset); - else if (stmt->type == STMT_TYPE && stmt->u.type->type == RPC_FC_IP) + else if (stmt->type == STMT_TYPE && type_get_type(stmt->u.type) == TYPE_INTERFACE) { if (need_proxy(stmt->u.type)) write_proxy(stmt->u.type, proc_offset); @@ -774,7 +748,7 @@ static void build_iface_list( const statement_list_t *stmts, type_t **ifaces[], { if (stmt->type == STMT_LIBRARY) build_iface_list(stmt->u.lib->stmts, ifaces, count); - else if (stmt->type == STMT_TYPE && stmt->u.type->type == RPC_FC_IP) + else if (stmt->type == STMT_TYPE && type_get_type(stmt->u.type) == TYPE_INTERFACE) { type_t *iface = stmt->u.type; if (type_iface_get_inherit(iface) && need_proxy(iface)) diff --git a/reactos/tools/widl/server.c b/reactos/tools/widl/server.c index c631b2dd856..fd648993913 100644 --- a/reactos/tools/widl/server.c +++ b/reactos/tools/widl/server.c @@ -40,6 +40,7 @@ static FILE* server; static int indent = 0; +static void print_server(const char *format, ...) __attribute__((format (printf, 1, 2))); static void print_server(const char *format, ...) { va_list va; @@ -79,6 +80,9 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset) indent++; write_remoting_arguments(server, indent, func, "__frame->", PASS_OUT, PHASE_FREE); + if (!is_void(type_function_get_rettype(func->type))) + write_remoting_arguments(server, indent, func, "__frame->", PASS_RETURN, PHASE_FREE); + if (has_full_pointer) write_full_pointer_free(server, indent, func); @@ -155,11 +159,9 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset) assign_stub_out_args(server, indent, func, "__frame->"); /* Call the real server function */ - if (!is_void(type_function_get_rettype(func->type))) - print_server("__frame->_RetVal = "); - else - print_server(""); - fprintf(server, "%s%s", prefix_server, get_name(func)); + print_server("%s%s%s", + is_void(type_function_get_rettype(func->type)) ? "" : "__frame->_RetVal = ", + prefix_server, get_name(func)); if (type_get_function_args(func->type)) { @@ -186,7 +188,7 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset) } else { - print_server("%s__frame->%s", var->type->declarray ? "*" : "", var->name); + print_server("%s__frame->%s", is_array(var->type) && !type_array_is_decl_as_ptr(var->type) ? "*" : "", var->name); } } fprintf(server, ");\n"); @@ -248,8 +250,8 @@ static void write_function_stubs(type_t *iface, unsigned int *proc_offset) static void write_dispatchtable(type_t *iface) { - unsigned long ver = get_attrv(iface->attrs, ATTR_VERSION); - unsigned long method_count = 0; + unsigned int ver = get_attrv(iface->attrs, ATTR_VERSION); + unsigned int method_count = 0; const statement_t *stmt; print_server("static RPC_DISPATCH_FUNCTION %s_table[] =\n", iface->name); @@ -323,7 +325,7 @@ static void write_stubdescriptor(type_t *iface, int expr_eval_routines) static void write_serverinterfacedecl(type_t *iface) { - unsigned long ver = get_attrv(iface->attrs, ATTR_VERSION); + unsigned int ver = get_attrv(iface->attrs, ATTR_VERSION); UUID *uuid = get_attrp(iface->attrs, ATTR_UUID); const str_list_t *endpoints = get_attrp(iface->attrs, ATTR_ENDPOINT); @@ -335,7 +337,7 @@ static void write_serverinterfacedecl(type_t *iface) print_server("{\n"); indent++; print_server("sizeof(RPC_SERVER_INTERFACE),\n"); - print_server("{{0x%08lx,0x%04x,0x%04x,{0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x}},{%d,%d}},\n", + print_server("{{0x%08x,0x%04x,0x%04x,{0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x,0x%02x}},{%d,%d}},\n", uuid->Data1, uuid->Data2, uuid->Data3, uuid->Data4[0], uuid->Data4[1], uuid->Data4[2], uuid->Data4[3], uuid->Data4[4], uuid->Data4[5], uuid->Data4[6], uuid->Data4[7], MAJORVERSION(ver), MINORVERSION(ver)); @@ -390,12 +392,13 @@ static void init_server(void) print_server(" MIDL_STUB_MESSAGE _StubMsg;\n"); print_server("};\n"); print_server("\n"); - print_server("#ifndef USE_COMPILER_EXCEPTIONS\n"); print_server("static int __server_filter( struct __server_frame *__frame )\n"); print_server( "{\n"); - print_server( " return RPC_BAD_STUB_DATA_EXCEPTION_FILTER;\n"); + print_server( " return (__frame->code == STATUS_ACCESS_VIOLATION) ||\n"); + print_server( " (__frame->code == STATUS_DATATYPE_MISALIGNMENT) ||\n"); + print_server( " (__frame->code == RPC_X_BAD_STUB_DATA) ||\n"); + print_server( " (__frame->code == RPC_S_INVALID_BOUND);\n"); print_server( "}\n"); - print_server("#endif /* USE_COMPILER_EXCEPTIONS */\n"); print_server( "\n"); } @@ -407,7 +410,7 @@ static void write_server_stmts(const statement_list_t *stmts, int expr_eval_rout { if (stmt->type == STMT_LIBRARY) write_server_stmts(stmt->u.lib->stmts, expr_eval_routines, proc_offset); - else if (stmt->type == STMT_TYPE && stmt->u.type->type == RPC_FC_IP) + else if (stmt->type == STMT_TYPE && type_get_type(stmt->u.type) == TYPE_INTERFACE) { type_t *iface = stmt->u.type; if (!need_stub(iface)) diff --git a/reactos/tools/widl/typegen.c b/reactos/tools/widl/typegen.c index 599e2fe70d1..1b7c79d8eaf 100644 --- a/reactos/tools/widl/typegen.c +++ b/reactos/tools/widl/typegen.c @@ -59,13 +59,13 @@ struct expr_eval_routine const expr_t *expr; }; -static size_t fields_memsize(const var_list_t *fields, unsigned int *align); -static size_t write_struct_tfs(FILE *file, type_t *type, const char *name, unsigned int *tfsoff); +static unsigned int fields_memsize(const var_list_t *fields, unsigned int *align); +static unsigned int write_struct_tfs(FILE *file, type_t *type, const char *name, unsigned int *tfsoff); static int write_embedded_types(FILE *file, const attr_list_t *attrs, type_t *type, const char *name, int write_ptr, unsigned int *tfsoff); static const var_t *find_array_or_string_in_struct(const type_t *type); -static size_t write_string_tfs(FILE *file, const attr_list_t *attrs, - type_t *type, +static unsigned int write_string_tfs(FILE *file, const attr_list_t *attrs, + type_t *type, int toplevel_param, const char *name, unsigned int *typestring_offset); const char *string_of_type(unsigned char type) @@ -120,16 +120,107 @@ const char *string_of_type(unsigned char type) } } -static unsigned char get_pointer_fc(const type_t *type) +unsigned char get_basic_fc(const type_t *type) { - assert(is_ptr(type)); - /* FIXME: see corresponding hack in set_type - we shouldn't be getting - * the pointer type from an alias, rather determining it from the - * position */ - return type->type; + int sign = type_basic_get_sign(type); + switch (type_basic_get_type(type)) + { + case TYPE_BASIC_INT8: return (sign <= 0 ? RPC_FC_SMALL : RPC_FC_USMALL); + case TYPE_BASIC_INT16: return (sign <= 0 ? RPC_FC_SHORT : RPC_FC_USHORT); + case TYPE_BASIC_INT32: return (sign <= 0 ? RPC_FC_LONG : RPC_FC_ULONG); + case TYPE_BASIC_INT64: return RPC_FC_HYPER; + case TYPE_BASIC_INT: return (sign <= 0 ? RPC_FC_LONG : RPC_FC_ULONG); + case TYPE_BASIC_BYTE: return RPC_FC_BYTE; + case TYPE_BASIC_CHAR: return RPC_FC_CHAR; + case TYPE_BASIC_WCHAR: return RPC_FC_WCHAR; + case TYPE_BASIC_HYPER: return RPC_FC_HYPER; + case TYPE_BASIC_FLOAT: return RPC_FC_FLOAT; + case TYPE_BASIC_DOUBLE: return RPC_FC_DOUBLE; + case TYPE_BASIC_ERROR_STATUS_T: return RPC_FC_ERROR_STATUS_T; + case TYPE_BASIC_HANDLE: return RPC_FC_BIND_PRIMITIVE; + default: return 0; + } } -static int get_struct_type(const type_t *type) +unsigned char get_pointer_fc(const type_t *type, const attr_list_t *attrs, int toplevel_param) +{ + const type_t *t; + int pointer_type; + + assert(is_ptr(type) || is_array(type)); + + pointer_type = get_attrv(attrs, ATTR_POINTERTYPE); + if (pointer_type) + return pointer_type; + + for (t = type; type_is_alias(t); t = type_alias_get_aliasee(t)) + { + pointer_type = get_attrv(t->attrs, ATTR_POINTERTYPE); + if (pointer_type) + return pointer_type; + } + + if (toplevel_param) + return RPC_FC_RP; + else if (is_ptr(type)) + return type_pointer_get_default_fc(type); + else + return type_array_get_ptr_default_fc(type); +} + +static unsigned char get_enum_fc(const type_t *type) +{ + assert(type_get_type(type) == TYPE_ENUM); + if (is_aliaschain_attr(type, ATTR_V1ENUM)) + return RPC_FC_ENUM32; + else + return RPC_FC_ENUM16; +} + +enum typegen_type typegen_detect_type(const type_t *type, const attr_list_t *attrs, unsigned int flags) +{ + if (is_user_type(type)) + return TGT_USER_TYPE; + + if (is_aliaschain_attr(type, ATTR_CONTEXTHANDLE)) + return TGT_CTXT_HANDLE; + + if (!(flags & TDT_IGNORE_STRINGS) && is_string_type(attrs, type)) + return TGT_STRING; + + switch (type_get_type(type)) + { + case TYPE_BASIC: + return TGT_BASIC; + case TYPE_ENUM: + return TGT_ENUM; + case TYPE_POINTER: + if (type_get_type(type_pointer_get_ref(type)) == TYPE_INTERFACE || + (type_get_type(type_pointer_get_ref(type)) == TYPE_VOID && is_attr(attrs, ATTR_IIDIS))) + return TGT_IFACE_POINTER; + else if (is_aliaschain_attr(type_pointer_get_ref(type), ATTR_CONTEXTHANDLE)) + return TGT_CTXT_HANDLE_POINTER; + else + return TGT_POINTER; + case TYPE_STRUCT: + return TGT_STRUCT; + case TYPE_ENCAPSULATED_UNION: + case TYPE_UNION: + return TGT_UNION; + case TYPE_ARRAY: + return TGT_ARRAY; + case TYPE_FUNCTION: + case TYPE_COCLASS: + case TYPE_INTERFACE: + case TYPE_MODULE: + case TYPE_VOID: + case TYPE_ALIAS: + break; + } + return TGT_INVALID; +} + +unsigned char get_struct_fc(const type_t *type) { int has_pointer = 0; int has_conformance = 0; @@ -137,8 +228,6 @@ static int get_struct_type(const type_t *type) var_t *field; var_list_t *fields; - if (type->type != RPC_FC_STRUCT) return type->type; - fields = type_struct_get_fields(type); if (get_padding(fields)) @@ -147,15 +236,15 @@ static int get_struct_type(const type_t *type) if (fields) LIST_FOR_EACH_ENTRY( field, fields, var_t, entry ) { type_t *t = field->type; + enum typegen_type typegen_type; - if (is_user_type(t)) - return RPC_FC_BOGUS_STRUCT; + typegen_type = typegen_detect_type(t, field->attrs, TDT_IGNORE_STRINGS); - if (field->type->declarray) + if (typegen_type == TGT_ARRAY && !type_array_is_decl_as_ptr(t)) { if (is_string_type(field->attrs, field->type)) { - if (is_conformant_array(field->type)) + if (is_conformant_array(t)) has_conformance = 1; has_variance = 1; continue; @@ -167,114 +256,86 @@ static int get_struct_type(const type_t *type) if (type_array_has_conformance(field->type)) { has_conformance = 1; - if (field->type->declarray && list_next(fields, &field->entry)) + if (list_next(fields, &field->entry)) error_loc("field '%s' deriving from a conformant array must be the last field in the structure\n", field->name); } - if (type_array_has_variance(field->type)) + if (type_array_has_variance(t)) has_variance = 1; - t = type_array_get_element(field->type); + t = type_array_get_element(t); + typegen_type = typegen_detect_type(t, field->attrs, TDT_IGNORE_STRINGS); } - switch (get_struct_type(t)) + switch (typegen_type) { - /* - * RPC_FC_BYTE, RPC_FC_STRUCT, etc - * Simple types don't effect the type of struct. - * A struct containing a simple struct is still a simple struct. - * So long as we can block copy the data, we return RPC_FC_STRUCT. - */ - case 0: /* void pointer */ - case RPC_FC_BYTE: - case RPC_FC_CHAR: - case RPC_FC_SMALL: - case RPC_FC_USMALL: - case RPC_FC_WCHAR: - case RPC_FC_SHORT: - case RPC_FC_USHORT: - case RPC_FC_LONG: - case RPC_FC_ULONG: - case RPC_FC_INT3264: - case RPC_FC_UINT3264: - case RPC_FC_HYPER: - case RPC_FC_FLOAT: - case RPC_FC_DOUBLE: - case RPC_FC_STRUCT: - case RPC_FC_ENUM32: - break; - - case RPC_FC_RP: - return RPC_FC_BOGUS_STRUCT; - - case RPC_FC_UP: - case RPC_FC_FP: - case RPC_FC_OP: - if (pointer_size != 4) + case TGT_USER_TYPE: + case TGT_IFACE_POINTER: return RPC_FC_BOGUS_STRUCT; - /* pointers to interfaces aren't really pointers and have to be - * marshalled specially so they make the structure complex */ - if (type_pointer_get_ref(t)->type == RPC_FC_IP) + case TGT_BASIC: + break; + case TGT_ENUM: + if (get_enum_fc(t) == RPC_FC_ENUM16) + return RPC_FC_BOGUS_STRUCT; + break; + case TGT_POINTER: + case TGT_ARRAY: + if (get_pointer_fc(t, field->attrs, FALSE) == RPC_FC_RP || pointer_size != 4) + return RPC_FC_BOGUS_STRUCT; + has_pointer = 1; + break; + case TGT_UNION: return RPC_FC_BOGUS_STRUCT; - has_pointer = 1; - break; - - case RPC_FC_SMFARRAY: - case RPC_FC_LGFARRAY: - case RPC_FC_SMVARRAY: - case RPC_FC_LGVARRAY: - case RPC_FC_CARRAY: - case RPC_FC_CVARRAY: - case RPC_FC_BOGUS_ARRAY: + case TGT_STRUCT: { - unsigned int ptr_type = get_attrv(field->attrs, ATTR_POINTERTYPE); - if (!ptr_type || ptr_type == RPC_FC_RP) - return RPC_FC_BOGUS_STRUCT; - else if (pointer_size != 4) - return RPC_FC_BOGUS_STRUCT; - has_pointer = 1; - break; + unsigned char fc = get_struct_fc(t); + switch (fc) + { + case RPC_FC_STRUCT: + break; + case RPC_FC_CVSTRUCT: + has_conformance = 1; + has_variance = 1; + has_pointer = 1; + break; + + case RPC_FC_CPSTRUCT: + has_conformance = 1; + if (list_next( fields, &field->entry )) + error_loc("field '%s' deriving from a conformant array must be the last field in the structure\n", + field->name); + has_pointer = 1; + break; + + case RPC_FC_CSTRUCT: + has_conformance = 1; + if (list_next( fields, &field->entry )) + error_loc("field '%s' deriving from a conformant array must be the last field in the structure\n", + field->name); + break; + + case RPC_FC_PSTRUCT: + has_pointer = 1; + break; + + default: + error_loc("Unknown struct member %s with type (0x%02x)\n", field->name, fc); + /* fallthru - treat it as complex */ + + /* as soon as we see one of these these members, it's bogus... */ + case RPC_FC_BOGUS_STRUCT: + return RPC_FC_BOGUS_STRUCT; + } + break; } - - /* - * Propagate member attributes - * a struct should be at least as complex as its member - */ - case RPC_FC_CVSTRUCT: - has_conformance = 1; - has_variance = 1; - has_pointer = 1; - break; - - case RPC_FC_CPSTRUCT: - has_conformance = 1; - if (list_next( fields, &field->entry )) - error_loc("field '%s' deriving from a conformant array must be the last field in the structure\n", - field->name); - has_pointer = 1; - break; - - case RPC_FC_CSTRUCT: - has_conformance = 1; - if (list_next( fields, &field->entry )) - error_loc("field '%s' deriving from a conformant array must be the last field in the structure\n", - field->name); - break; - - case RPC_FC_PSTRUCT: - has_pointer = 1; - break; - - default: - error_loc("Unknown struct member %s with type (0x%02x)\n", field->name, t->type); - /* fallthru - treat it as complex */ - - /* as soon as we see one of these these members, it's bogus... */ - case RPC_FC_ENCAPSULATED_UNION: - case RPC_FC_NON_ENCAPSULATED_UNION: - case RPC_FC_BOGUS_STRUCT: - case RPC_FC_ENUM16: - return RPC_FC_BOGUS_STRUCT; + case TGT_STRING: + /* shouldn't get here because of TDT_IGNORE_STRINGS above. fall through */ + case TGT_INVALID: + case TGT_CTXT_HANDLE: + case TGT_CTXT_HANDLE_POINTER: + /* checking after parsing should mean that we don't get here. if we do, + * it's a checker bug */ + assert(0); } } @@ -294,22 +355,19 @@ static int get_struct_type(const type_t *type) return RPC_FC_STRUCT; } -static unsigned char get_array_type(const type_t *type) +unsigned char get_array_fc(const type_t *type) { unsigned char fc; const expr_t *size_is; const type_t *elem_type; - if (!is_array(type)) - return type->type; - elem_type = type_array_get_element(type); size_is = type_array_get_conformance(type); if (!size_is) { unsigned int align = 0; - size_t size = type_memsize(elem_type, &align); + unsigned int size = type_memsize(elem_type, &align); if (size * type_array_get_dim(type) > 0xffffuL) fc = RPC_FC_LGFARRAY; else @@ -328,33 +386,44 @@ static unsigned char get_array_type(const type_t *type) fc = RPC_FC_CVARRAY; } - if (is_user_type(elem_type)) - fc = RPC_FC_BOGUS_ARRAY; - else if (is_struct(elem_type->type)) + switch (typegen_detect_type(elem_type, NULL, TDT_IGNORE_STRINGS)) { - switch (get_struct_type(elem_type)) + case TGT_USER_TYPE: + fc = RPC_FC_BOGUS_ARRAY; + break; + case TGT_STRUCT: + switch (get_struct_fc(elem_type)) { case RPC_FC_BOGUS_STRUCT: fc = RPC_FC_BOGUS_ARRAY; break; } - } - else if (elem_type->type == RPC_FC_ENUM16) - { + break; + case TGT_ENUM: /* is 16-bit enum - if so, wire size differs from mem size and so * the array cannot be block copied, which means the array is complex */ + if (get_enum_fc(elem_type) == RPC_FC_ENUM16) + fc = RPC_FC_BOGUS_ARRAY; + break; + case TGT_UNION: + case TGT_IFACE_POINTER: fc = RPC_FC_BOGUS_ARRAY; - } - else if (is_union(elem_type->type)) - fc = RPC_FC_BOGUS_ARRAY; - else if (is_ptr(elem_type)) - { + break; + case TGT_POINTER: /* ref pointers cannot just be block copied. unique pointers to * interfaces need special treatment. either case means the array is * complex */ - if (get_pointer_fc(elem_type) == RPC_FC_RP || - type_pointer_get_ref(elem_type)->type == RPC_FC_IP) + if (get_pointer_fc(elem_type, NULL, FALSE) == RPC_FC_RP) fc = RPC_FC_BOGUS_ARRAY; + break; + case TGT_BASIC: + case TGT_CTXT_HANDLE: + case TGT_CTXT_HANDLE_POINTER: + case TGT_STRING: + case TGT_INVALID: + case TGT_ARRAY: + /* nothing to do for everything else */ + break; } return fc; @@ -378,40 +447,22 @@ int is_struct(unsigned char type) static int is_non_complex_struct(const type_t *type) { - switch (get_struct_type(type)) - { - case RPC_FC_STRUCT: - case RPC_FC_PSTRUCT: - case RPC_FC_CSTRUCT: - case RPC_FC_CPSTRUCT: - case RPC_FC_CVSTRUCT: - return 1; - default: - return 0; - } -} - -int is_union(unsigned char type) -{ - switch (type) - { - case RPC_FC_ENCAPSULATED_UNION: - case RPC_FC_NON_ENCAPSULATED_UNION: - return 1; - default: - return 0; - } + return (type_get_type(type) == TYPE_STRUCT && + get_struct_fc(type) != RPC_FC_BOGUS_STRUCT); } static int type_has_pointers(const type_t *type) { - if (is_user_type(type)) + switch (typegen_detect_type(type, NULL, TDT_IGNORE_STRINGS)) + { + case TGT_USER_TYPE: return FALSE; - else if (is_ptr(type)) + case TGT_POINTER: return TRUE; - else if (is_array(type)) + case TGT_ARRAY: + /* FIXME: array can be pointer */ return type_has_pointers(type_array_get_element(type)); - else if (is_struct(type->type)) + case TGT_STRUCT: { var_list_t *fields = type_struct_get_fields(type); const var_t *field; @@ -420,8 +471,9 @@ static int type_has_pointers(const type_t *type) if (type_has_pointers(field->type)) return TRUE; } + break; } - else if (is_union(type->type)) + case TGT_UNION: { var_list_t *fields; const var_t *field; @@ -431,41 +483,69 @@ static int type_has_pointers(const type_t *type) if (field->type && type_has_pointers(field->type)) return TRUE; } + break; + } + case TGT_CTXT_HANDLE: + case TGT_CTXT_HANDLE_POINTER: + case TGT_STRING: + case TGT_IFACE_POINTER: + case TGT_BASIC: + case TGT_ENUM: + case TGT_INVALID: + break; } return FALSE; } -static int type_has_full_pointer(const type_t *type) +static int type_has_full_pointer(const type_t *type, const attr_list_t *attrs, + int toplevel_param) { - if (is_user_type(type)) + switch (typegen_detect_type(type, NULL, TDT_IGNORE_STRINGS)) + { + case TGT_USER_TYPE: return FALSE; - else if (type->type == RPC_FC_FP) - return TRUE; - else if (is_ptr(type)) - return FALSE; - else if (is_array(type)) - return type_has_full_pointer(type_array_get_element(type)); - else if (is_struct(type->type)) + case TGT_POINTER: + if (get_pointer_fc(type, attrs, toplevel_param) == RPC_FC_FP) + return TRUE; + else + return FALSE; + case TGT_ARRAY: + if (get_pointer_fc(type, attrs, toplevel_param) == RPC_FC_FP) + return TRUE; + else + return type_has_full_pointer(type_array_get_element(type), NULL, FALSE); + case TGT_STRUCT: { var_list_t *fields = type_struct_get_fields(type); const var_t *field; if (fields) LIST_FOR_EACH_ENTRY( field, fields, const var_t, entry ) { - if (type_has_full_pointer(field->type)) + if (type_has_full_pointer(field->type, field->attrs, FALSE)) return TRUE; } + break; } - else if (is_union(type->type)) + case TGT_UNION: { var_list_t *fields; const var_t *field; fields = type_union_get_cases(type); if (fields) LIST_FOR_EACH_ENTRY( field, fields, const var_t, entry ) { - if (field->type && type_has_full_pointer(field->type)) + if (field->type && type_has_full_pointer(field->type, field->attrs, FALSE)) return TRUE; } + break; + } + case TGT_CTXT_HANDLE: + case TGT_CTXT_HANDLE_POINTER: + case TGT_STRING: + case TGT_IFACE_POINTER: + case TGT_BASIC: + case TGT_ENUM: + case TGT_INVALID: + break; } return FALSE; @@ -528,15 +608,25 @@ int is_user_type(const type_t *t) static int is_embedded_complex(const type_t *type) { - unsigned char tc = type->type; - return is_struct(tc) || is_union(tc) || is_array(type) || is_user_type(type) - || (is_ptr(type) && type_pointer_get_ref(type)->type == RPC_FC_IP); + switch (typegen_detect_type(type, NULL, TDT_ALL_TYPES)) + { + case TGT_USER_TYPE: + case TGT_STRUCT: + case TGT_UNION: + case TGT_ARRAY: + case TGT_IFACE_POINTER: + return TRUE; + default: + return FALSE; + } } static const char *get_context_handle_type_name(const type_t *type) { const type_t *t; - for (t = type; is_ptr(t); t = type_pointer_get_ref(t)) + for (t = type; + is_ptr(t) || type_is_alias(t); + t = type_is_alias(t) ? type_alias_get_aliasee(t) : type_pointer_get_ref(t)) if (is_attr(t->attrs, ATTR_CONTEXTHANDLE)) return t->name; assert(0); @@ -551,6 +641,7 @@ static const char *get_context_handle_type_name(const type_t *type) } \ while (0) +static void print_file(FILE *file, int indent, const char *format, ...) __attribute__((format (printf, 3, 4))); static void print_file(FILE *file, int indent, const char *format, ...) { va_list va; @@ -628,77 +719,54 @@ void write_formatstringsdecl(FILE *f, int indent, const statement_list_t *stmts, print_file(f, indent, "\n"); } -static inline int is_base_type(unsigned char type) -{ - switch (type) - { - case RPC_FC_BYTE: - case RPC_FC_CHAR: - case RPC_FC_USMALL: - case RPC_FC_SMALL: - case RPC_FC_WCHAR: - case RPC_FC_USHORT: - case RPC_FC_SHORT: - case RPC_FC_ULONG: - case RPC_FC_LONG: - case RPC_FC_HYPER: - case RPC_FC_IGNORE: - case RPC_FC_FLOAT: - case RPC_FC_DOUBLE: - case RPC_FC_ENUM16: - case RPC_FC_ENUM32: - case RPC_FC_ERROR_STATUS_T: - case RPC_FC_BIND_PRIMITIVE: - return TRUE; - - default: - return FALSE; - } -} - int decl_indirect(const type_t *t) { - return is_user_type(t) - || (!is_base_type(t->type) - && !is_ptr(t) - && !is_array(t)); + if (is_user_type(t)) + return TRUE; + return (type_get_type(t) != TYPE_BASIC && + type_get_type(t) != TYPE_ENUM && + type_get_type(t) != TYPE_POINTER && + type_get_type(t) != TYPE_ARRAY); } -static size_t write_procformatstring_type(FILE *file, int indent, - const char *name, - const type_t *type, - const attr_list_t *attrs, - int is_return) +static unsigned int write_procformatstring_type(FILE *file, int indent, + const char *name, + const type_t *type, + const attr_list_t *attrs, + int is_return) { - size_t size; + unsigned int size; int is_in = is_attr(attrs, ATTR_IN); int is_out = is_attr(attrs, ATTR_OUT); if (!is_in && !is_out) is_in = TRUE; - if (!type->declarray && is_base_type(type->type)) + if (type_get_type(type) == TYPE_BASIC || + type_get_type(type) == TYPE_ENUM) { + unsigned char fc; + if (is_return) print_file(file, indent, "0x53, /* FC_RETURN_PARAM_BASETYPE */\n"); else print_file(file, indent, "0x4e, /* FC_IN_PARAM_BASETYPE */\n"); - if (type->type == RPC_FC_BIND_PRIMITIVE) + if (type_get_type(type) == TYPE_ENUM) { - print_file(file, indent, "0x%02x, /* FC_IGNORE */\n", RPC_FC_IGNORE); - size = 2; /* includes param type prefix */ - } - else if (is_base_type(type->type)) - { - print_file(file, indent, "0x%02x, /* %s */\n", type->type, string_of_type(type->type)); - size = 2; /* includes param type prefix */ + fc = get_enum_fc(type); } else { - error("Unknown/unsupported type: %s (0x%02x)\n", name, type->type); - size = 0; + fc = get_basic_fc(type); + + if (fc == RPC_FC_BIND_PRIMITIVE) + fc = RPC_FC_IGNORE; } + + print_file(file, indent, "0x%02x, /* %s */\n", + fc, string_of_type(fc)); + size = 2; /* includes param type prefix */ } else { @@ -712,7 +780,7 @@ static size_t write_procformatstring_type(FILE *file, int indent, print_file(file, indent, "0x4d, /* FC_IN_PARAM */\n"); print_file(file, indent, "0x01,\n"); - print_file(file, indent, "NdrFcShort(0x%x),\n", type->typestring_offset); + print_file(file, indent, "NdrFcShort(0x%hx),\n", type->typestring_offset); size = 4; /* includes param type prefix */ } return size; @@ -723,7 +791,7 @@ static void write_procformatstring_stmts(FILE *file, int indent, const statement const statement_t *stmt; if (stmts) LIST_FOR_EACH_ENTRY( stmt, stmts, const statement_t, entry ) { - if (stmt->type == STMT_TYPE && stmt->u.type->type == RPC_FC_IP) + if (stmt->type == STMT_TYPE && type_get_type(stmt->u.type) == TYPE_INTERFACE) { const statement_t *stmt_func; if (!pred(stmt->u.type)) @@ -776,22 +844,42 @@ void write_procformatstring(FILE *file, const statement_list_t *stmts, type_pred print_file(file, indent, "\n"); } -static int write_base_type(FILE *file, unsigned char fc, unsigned int *typestring_offset) +static int write_base_type(FILE *file, const type_t *type, int convert_to_signed_type, unsigned int *typestring_offset) { - if (is_base_type(fc)) + unsigned char fc; + + if (type_get_type(type) == TYPE_BASIC) + fc = get_basic_fc(type); + else if (type_get_type(type) == TYPE_ENUM) + fc = get_enum_fc(type); + else + return 0; + + if (convert_to_signed_type) { - print_file(file, 2, "0x%02x,\t/* %s */\n", fc, string_of_type(fc)); - *typestring_offset += 1; - return 1; + switch(fc) + { + case RPC_FC_USMALL: + fc = RPC_FC_SMALL; + break; + case RPC_FC_USHORT: + fc = RPC_FC_SHORT; + break; + case RPC_FC_ULONG: + fc = RPC_FC_LONG; + break; + } } - return 0; + print_file(file, 2, "0x%02x,\t/* %s */\n", fc, string_of_type(fc)); + *typestring_offset += 1; + return 1; } /* write conformance / variance descriptor */ -static size_t write_conf_or_var_desc(FILE *file, const type_t *structure, - unsigned int baseoff, const type_t *type, - const expr_t *expr) +static unsigned int write_conf_or_var_desc(FILE *file, const type_t *structure, + unsigned int baseoff, const type_t *type, + const expr_t *expr) { unsigned char operator_type = 0; unsigned char conftype = RPC_FC_NORMAL_CONFORMANCE; @@ -824,13 +912,13 @@ static size_t write_conf_or_var_desc(FILE *file, const type_t *structure, print_file(file, 2, "0x%x, /* Corr desc: constant, val = %ld */\n", RPC_FC_CONSTANT_CONFORMANCE, expr->cval); - print_file(file, 2, "0x%x,\n", expr->cval & ~USHRT_MAX); - print_file(file, 2, "NdrFcShort(0x%x),\n", expr->cval & USHRT_MAX); + print_file(file, 2, "0x%lx,\n", expr->cval >> 16); + print_file(file, 2, "NdrFcShort(0x%hx),\n", (unsigned short)expr->cval); return 4; } - if (is_ptr(type) || (is_array(type) && !type->declarray)) + if (is_ptr(type) || (is_array(type) && type_array_is_decl_as_ptr(type))) { conftype = RPC_FC_POINTER_CONFORMANCE; conftype_string = "field pointer, "; @@ -883,9 +971,8 @@ static size_t write_conf_or_var_desc(FILE *file, const type_t *structure, if (subexpr->type == EXPR_IDENTIFIER) { const type_t *correlation_variable = NULL; - unsigned char correlation_variable_type; unsigned char param_type = 0; - size_t offset = 0; + unsigned int offset = 0; const var_t *var; var_list_t *fields = type_struct_get_fields(structure); @@ -907,42 +994,55 @@ static size_t write_conf_or_var_desc(FILE *file, const type_t *structure, correlation_variable = expr_resolve_type(NULL, structure, expr); offset -= baseoff; - correlation_variable_type = correlation_variable->type; - switch (correlation_variable_type) + if (type_get_type(correlation_variable) == TYPE_BASIC) { - case RPC_FC_CHAR: - case RPC_FC_SMALL: - param_type = RPC_FC_SMALL; - break; - case RPC_FC_BYTE: - case RPC_FC_USMALL: - param_type = RPC_FC_USMALL; - break; - case RPC_FC_WCHAR: - case RPC_FC_SHORT: - case RPC_FC_ENUM16: - param_type = RPC_FC_SHORT; - break; - case RPC_FC_USHORT: - param_type = RPC_FC_USHORT; - break; - case RPC_FC_LONG: - case RPC_FC_ENUM32: - param_type = RPC_FC_LONG; - break; - case RPC_FC_ULONG: - param_type = RPC_FC_ULONG; - break; - default: - error("write_conf_or_var_desc: conformance variable type not supported 0x%x\n", - correlation_variable_type); + switch (get_basic_fc(correlation_variable)) + { + case RPC_FC_CHAR: + case RPC_FC_SMALL: + param_type = RPC_FC_SMALL; + break; + case RPC_FC_BYTE: + case RPC_FC_USMALL: + param_type = RPC_FC_USMALL; + break; + case RPC_FC_WCHAR: + case RPC_FC_SHORT: + param_type = RPC_FC_SHORT; + break; + case RPC_FC_USHORT: + param_type = RPC_FC_USHORT; + break; + case RPC_FC_LONG: + param_type = RPC_FC_LONG; + break; + case RPC_FC_ULONG: + param_type = RPC_FC_ULONG; + break; + default: + error("write_conf_or_var_desc: conformance variable type not supported 0x%x\n", + get_basic_fc(correlation_variable)); + } + } + else if (type_get_type(correlation_variable) == TYPE_ENUM) + { + if (get_enum_fc(correlation_variable) == RPC_FC_ENUM32) + param_type = RPC_FC_LONG; + else + param_type = RPC_FC_SHORT; + } + else + { + error("write_conf_or_var_desc: non-arithmetic type used as correlation variable %s\n", + subexpr->u.sval); + return 0; } print_file(file, 2, "0x%x, /* Corr desc: %s%s */\n", conftype | param_type, conftype_string, string_of_type(param_type)); print_file(file, 2, "0x%x, /* %s */\n", operator_type, operator_string); - print_file(file, 2, "NdrFcShort(0x%x), /* offset = %d */\n", + print_file(file, 2, "NdrFcShort(0x%hx),\t/* offset = %d */\n", offset, offset); } else @@ -976,22 +1076,22 @@ static size_t write_conf_or_var_desc(FILE *file, const type_t *structure, print_file(file, 2, "0x%x, /* Corr desc: %s */\n", conftype, conftype_string); print_file(file, 2, "0x%x, /* %s */\n", RPC_FC_CALLBACK, "FC_CALLBACK"); - print_file(file, 2, "NdrFcShort(0x%x), /* %u */\n", callback_offset, callback_offset); + print_file(file, 2, "NdrFcShort(0x%hx),\t/* %u */\n", callback_offset, callback_offset); } return 4; } -static size_t fields_memsize(const var_list_t *fields, unsigned int *align) +static unsigned int fields_memsize(const var_list_t *fields, unsigned int *align) { int have_align = FALSE; - size_t size = 0; + unsigned int size = 0; const var_t *v; if (!fields) return 0; LIST_FOR_EACH_ENTRY( v, fields, const var_t, entry ) { unsigned int falign = 0; - size_t fsize = type_memsize(v->type, &falign); + unsigned int fsize = type_memsize(v->type, &falign); if (!have_align) { *align = falign; @@ -1005,9 +1105,9 @@ static size_t fields_memsize(const var_list_t *fields, unsigned int *align) return size; } -static size_t union_memsize(const var_list_t *fields, unsigned int *pmaxa) +static unsigned int union_memsize(const var_list_t *fields, unsigned int *pmaxa) { - size_t size, maxs = 0; + unsigned int size, maxs = 0; unsigned int align = *pmaxa; const var_t *v; @@ -1038,7 +1138,7 @@ int get_padding(const var_list_t *fields) { type_t *ft = f->type; unsigned int align = 0; - size_t size = type_memsize(ft, &align); + unsigned int size = type_memsize(ft, &align); if (salign == -1) salign = align; offset = ROUND_SIZE(offset, align); @@ -1048,76 +1148,105 @@ int get_padding(const var_list_t *fields) return ROUNDING(offset, salign); } -size_t type_memsize(const type_t *t, unsigned int *align) +unsigned int type_memsize(const type_t *t, unsigned int *align) { - size_t size = 0; + unsigned int size = 0; - if (type_is_alias(t)) - size = type_memsize(type_alias_get_aliasee(t), align); - else if (t->declarray && is_conformant_array(t)) - { - type_memsize(type_array_get_element(t), align); - size = 0; - } - else if (is_ptr(t) || is_conformant_array(t)) + switch (type_get_type(t)) { + case TYPE_BASIC: + switch (get_basic_fc(t)) + { + case RPC_FC_BYTE: + case RPC_FC_CHAR: + case RPC_FC_USMALL: + case RPC_FC_SMALL: + size = 1; + if (size > *align) *align = size; + break; + case RPC_FC_WCHAR: + case RPC_FC_USHORT: + case RPC_FC_SHORT: + size = 2; + if (size > *align) *align = size; + break; + case RPC_FC_ULONG: + case RPC_FC_LONG: + case RPC_FC_ERROR_STATUS_T: + case RPC_FC_FLOAT: + size = 4; + if (size > *align) *align = size; + break; + case RPC_FC_HYPER: + case RPC_FC_DOUBLE: + size = 8; + if (size > *align) *align = size; + break; + default: + error("type_memsize: Unknown type 0x%x\n", get_basic_fc(t)); + size = 0; + } + break; + case TYPE_ENUM: + switch (get_enum_fc(t)) + { + case RPC_FC_ENUM32: + size = 4; + if (size > *align) *align = size; + break; + case RPC_FC_ENUM16: + size = 2; + if (size > *align) *align = size; + break; + default: + error("type_memsize: Unknown enum type\n"); + size = 0; + } + break; + case TYPE_STRUCT: + size = fields_memsize(type_struct_get_fields(t), align); + break; + case TYPE_ENCAPSULATED_UNION: + size = fields_memsize(type_encapsulated_union_get_fields(t), align); + break; + case TYPE_UNION: + size = union_memsize(type_union_get_cases(t), align); + break; + case TYPE_POINTER: assert( pointer_size ); size = pointer_size; if (size > *align) *align = size; - } - else switch (t->type) - { - case RPC_FC_BYTE: - case RPC_FC_CHAR: - case RPC_FC_USMALL: - case RPC_FC_SMALL: - size = 1; - if (size > *align) *align = size; break; - case RPC_FC_WCHAR: - case RPC_FC_USHORT: - case RPC_FC_SHORT: - case RPC_FC_ENUM16: - size = 2; - if (size > *align) *align = size; + case TYPE_ARRAY: + if (!type_array_is_decl_as_ptr(t)) + { + if (is_conformant_array(t)) + { + type_memsize(type_array_get_element(t), align); + size = 0; + } + else + size = type_array_get_dim(t) * + type_memsize(type_array_get_element(t), align); + } + else /* declared as a pointer */ + { + assert( pointer_size ); + size = pointer_size; + if (size > *align) *align = size; + } break; - case RPC_FC_ULONG: - case RPC_FC_LONG: - case RPC_FC_ERROR_STATUS_T: - case RPC_FC_ENUM32: - case RPC_FC_FLOAT: - size = 4; - if (size > *align) *align = size; - break; - case RPC_FC_HYPER: - case RPC_FC_DOUBLE: - size = 8; - if (size > *align) *align = size; - break; - case RPC_FC_STRUCT: - case RPC_FC_CVSTRUCT: - case RPC_FC_CPSTRUCT: - case RPC_FC_CSTRUCT: - case RPC_FC_PSTRUCT: - case RPC_FC_BOGUS_STRUCT: - size = fields_memsize(type_struct_get_fields(t), align); - break; - case RPC_FC_ENCAPSULATED_UNION: - size = fields_memsize(type_encapsulated_union_get_fields(t), align); - break; - case RPC_FC_NON_ENCAPSULATED_UNION: - size = union_memsize(type_union_get_cases(t), align); - break; - case RPC_FC_SMFARRAY: - case RPC_FC_LGFARRAY: - case RPC_FC_SMVARRAY: - case RPC_FC_LGVARRAY: - case RPC_FC_BOGUS_ARRAY: - size = type_array_get_dim(t) * type_memsize(type_array_get_element(t), align); - break; - default: - error("type_memsize: Unknown type 0x%x\n", t->type); - size = 0; + case TYPE_INTERFACE: + case TYPE_ALIAS: + case TYPE_VOID: + case TYPE_COCLASS: + case TYPE_MODULE: + case TYPE_FUNCTION: + /* these types should not be encountered here due to language + * restrictions (interface, void, coclass, module), logical + * restrictions (alias - due to type_get_type call above) or + * checking restrictions (function). */ + assert(0); } return size; @@ -1126,12 +1255,12 @@ size_t type_memsize(const type_t *t, unsigned int *align) int is_full_pointer_function(const var_t *func) { const var_t *var; - if (type_has_full_pointer(type_function_get_rettype(func->type))) + if (type_has_full_pointer(type_function_get_rettype(func->type), func->attrs, TRUE)) return TRUE; if (!type_get_function_args(func->type)) return FALSE; LIST_FOR_EACH_ENTRY( var, type_get_function_args(func->type), const var_t, entry ) - if (type_has_full_pointer( var->type )) + if (type_has_full_pointer( var->type, var->attrs, TRUE )) return TRUE; return FALSE; } @@ -1149,28 +1278,70 @@ void write_full_pointer_free(FILE *file, int indent, const var_t *func) fprintf(file, "\n"); } -static unsigned int write_nonsimple_pointer(FILE *file, const type_t *type, size_t offset) +static unsigned int write_nonsimple_pointer(FILE *file, const attr_list_t *attrs, + const type_t *type, + int toplevel_param, + unsigned int offset, + unsigned int *typeformat_offset) { - short absoff = type_pointer_get_ref(type)->typestring_offset; - short reloff = absoff - (offset + 2); - int ptr_attr = is_ptr(type_pointer_get_ref(type)) ? 0x10 : 0x0; + unsigned int start_offset = *typeformat_offset; + short reloff = offset - (*typeformat_offset + 2); + int in_attr, out_attr; + int pointer_type; + unsigned char flags = 0; - print_file(file, 2, "0x%02x, 0x%x,\t/* %s */\n", - type->type, ptr_attr, string_of_type(type->type)); - print_file(file, 2, "NdrFcShort(0x%hx),\t/* Offset= %hd (%hd) */\n", - reloff, reloff, absoff); - return 4; + pointer_type = get_pointer_fc(type, attrs, toplevel_param); + + in_attr = is_attr(attrs, ATTR_IN); + out_attr = is_attr(attrs, ATTR_OUT); + if (!in_attr && !out_attr) in_attr = 1; + + if (out_attr && !in_attr && pointer_type == RPC_FC_RP) + flags |= RPC_FC_P_ONSTACK; + + if (is_ptr(type) && !last_ptr(type)) + flags |= RPC_FC_P_DEREF; + + print_file(file, 2, "0x%x, 0x%x,\t\t/* %s", + pointer_type, + flags, + string_of_type(pointer_type)); + if (file) + { + if (flags & RPC_FC_P_ONSTACK) + fprintf(file, " [allocated_on_stack]"); + if (flags & RPC_FC_P_DEREF) + fprintf(file, " [pointer_deref]"); + fprintf(file, " */\n"); + } + + print_file(file, 2, "NdrFcShort(0x%hx),\t/* Offset= %hd (%u) */\n", reloff, reloff, offset); + *typeformat_offset += 4; + + return start_offset; } -static unsigned int write_simple_pointer(FILE *file, const type_t *type) +static unsigned int write_simple_pointer(FILE *file, const attr_list_t *attrs, const type_t *type, int toplevel_param) { - unsigned char fc = type_pointer_get_ref(type)->type; + unsigned char fc; + unsigned char pointer_fc; + const type_t *ref; + /* for historical reasons, write_simple_pointer also handled string types, * but no longer does. catch bad uses of the function with this check */ - if (is_string_type(type->attrs, type)) + if (is_string_type(attrs, type)) error("write_simple_pointer: can't handle type %s which is a string type\n", type->name); - print_file(file, 2, "0x%02x, 0x8,\t/* %s [simple_pointer] */\n", - type->type, string_of_type(type->type)); + + pointer_fc = get_pointer_fc(type, attrs, toplevel_param); + + ref = type_pointer_get_ref(type); + if (type_get_type(ref) == TYPE_ENUM) + fc = get_enum_fc(ref); + else + fc = get_basic_fc(ref); + + print_file(file, 2, "0x%02x, 0x%x,\t/* %s [simple_pointer] */\n", + pointer_fc, RPC_FC_P_SIMPLEPOINTER, string_of_type(pointer_fc)); print_file(file, 2, "0x%02x,\t/* %s */\n", fc, string_of_type(fc)); print_file(file, 2, "0x5c,\t/* FC_PAD */\n"); return 4; @@ -1183,17 +1354,25 @@ static void print_start_tfs_comment(FILE *file, type_t *t, unsigned int tfsoff) print_file(file, 0, ") */\n"); } -static size_t write_pointer_tfs(FILE *file, type_t *type, unsigned int *typestring_offset) +static unsigned int write_pointer_tfs(FILE *file, const attr_list_t *attrs, + type_t *type, int toplevel_param, + unsigned int *typestring_offset) { unsigned int offset = *typestring_offset; + type_t *ref = type_pointer_get_ref(type); print_start_tfs_comment(file, type, offset); update_tfsoff(type, offset, file); - if (type_pointer_get_ref(type)->typestring_offset) - *typestring_offset += write_nonsimple_pointer(file, type, offset); - else if (is_base_type(type_pointer_get_ref(type)->type)) - *typestring_offset += write_simple_pointer(file, type); + if (ref->typestring_offset) + write_nonsimple_pointer(file, attrs, type, + toplevel_param, + type_pointer_get_ref(type)->typestring_offset, + typestring_offset); + else if (type_get_type(ref) == TYPE_BASIC || + type_get_type(ref) == TYPE_ENUM) + *typestring_offset += write_simple_pointer(file, attrs, type, + toplevel_param); return offset; } @@ -1207,8 +1386,9 @@ static int user_type_has_variable_size(const type_t *t) { if (is_ptr(t)) return TRUE; - else - switch (get_struct_type(t)) + else if (type_get_type(t) == TYPE_STRUCT) + { + switch (get_struct_fc(t)) { case RPC_FC_PSTRUCT: case RPC_FC_CSTRUCT: @@ -1216,6 +1396,7 @@ static int user_type_has_variable_size(const type_t *t) case RPC_FC_CVSTRUCT: return TRUE; } + } /* Note: Since this only applies to user types, we can't have a conformant array here, and strings should get filed under pointer in this case. */ return FALSE; @@ -1227,18 +1408,26 @@ static void write_user_tfs(FILE *file, type_t *type, unsigned int *tfsoff) unsigned int align = 0, ualign = 0; const char *name = NULL; type_t *utype = get_user_type(type, &name); - size_t usize = user_type_has_variable_size(utype) ? 0 : type_memsize(utype, &ualign); - size_t size = type_memsize(type, &align); + unsigned int usize = user_type_has_variable_size(utype) ? 0 : type_memsize(utype, &ualign); + unsigned int size = type_memsize(type, &align); unsigned short funoff = user_type_offset(name); short reloff; guard_rec(type); - if (is_base_type(utype->type)) + if (type_get_type(utype) == TYPE_BASIC || + type_get_type(utype) == TYPE_ENUM) { + unsigned char fc; + + if (type_get_type(utype) == TYPE_ENUM) + fc = get_enum_fc(utype); + else + fc = get_basic_fc(utype); + absoff = *tfsoff; print_start_tfs_comment(file, utype, absoff); - print_file(file, 2, "0x%x,\t/* %s */\n", utype->type, string_of_type(utype->type)); + print_file(file, 2, "0x%x,\t/* %s */\n", fc, string_of_type(fc)); print_file(file, 2, "0x5c,\t/* FC_PAD */\n"); *tfsoff += 2; } @@ -1249,9 +1438,9 @@ static void write_user_tfs(FILE *file, type_t *type, unsigned int *tfsoff) absoff = utype->typestring_offset; } - if (utype->type == RPC_FC_RP) + if (type_get_type(utype) == TYPE_POINTER && get_pointer_fc(utype, NULL, FALSE) == RPC_FC_RP) flags = 0x40; - else if (utype->type == RPC_FC_UP) + else if (type_get_type(utype) == TYPE_POINTER && get_pointer_fc(utype, NULL, FALSE) == RPC_FC_UP) flags = 0x80; else flags = 0; @@ -1263,39 +1452,25 @@ static void write_user_tfs(FILE *file, type_t *type, unsigned int *tfsoff) print_file(file, 2, "0x%x,\t/* Alignment= %d, Flags= %02x */\n", flags | (align - 1), align - 1, flags); print_file(file, 2, "NdrFcShort(0x%hx),\t/* Function offset= %hu */\n", funoff, funoff); - print_file(file, 2, "NdrFcShort(0x%lx),\t/* %lu */\n", size, size); - print_file(file, 2, "NdrFcShort(0x%lx),\t/* %lu */\n", usize, usize); + print_file(file, 2, "NdrFcShort(0x%hx),\t/* %u */\n", size, size); + print_file(file, 2, "NdrFcShort(0x%hx),\t/* %u */\n", usize, usize); *tfsoff += 8; reloff = absoff - *tfsoff; - print_file(file, 2, "NdrFcShort(0x%hx),\t/* Offset= %hd (%lu) */\n", reloff, reloff, absoff); + print_file(file, 2, "NdrFcShort(0x%hx),\t/* Offset= %hd (%u) */\n", reloff, reloff, absoff); *tfsoff += 2; } -static inline unsigned char make_signed(unsigned char fc) -{ - switch(fc) - { - case RPC_FC_USMALL: - return RPC_FC_SMALL; - case RPC_FC_USHORT: - return RPC_FC_SHORT; - case RPC_FC_ULONG: - return RPC_FC_LONG; - default: - return fc; - } -} - static void write_member_type(FILE *file, const type_t *cont, - const attr_list_t *attrs, const type_t *type, - unsigned int *corroff, unsigned int *tfsoff) + int cont_is_complex, const attr_list_t *attrs, + const type_t *type, unsigned int *corroff, + unsigned int *tfsoff) { if (is_embedded_complex(type) && !is_conformant_array(type)) { - size_t absoff; + unsigned int absoff; short reloff; - if (is_union(type->type) && is_attr(attrs, ATTR_SWITCHIS)) + if (type_get_type(type) == TYPE_UNION && is_attr(attrs, ATTR_SWITCHIS)) { absoff = *corroff; *corroff += 8; @@ -1309,20 +1484,18 @@ static void write_member_type(FILE *file, const type_t *cont, print_file(file, 2, "0x4c,\t/* FC_EMBEDDED_COMPLEX */\n"); /* FIXME: actually compute necessary padding */ print_file(file, 2, "0x0,\t/* FIXME: padding */\n"); - print_file(file, 2, "NdrFcShort(0x%hx),\t/* Offset= %hd (%lu) */\n", + print_file(file, 2, "NdrFcShort(0x%hx),\t/* Offset= %hd (%u) */\n", reloff, reloff, absoff); *tfsoff += 4; } else if (is_ptr(type) || is_conformant_array(type)) { - unsigned char fc = (get_struct_type(cont) == RPC_FC_BOGUS_STRUCT - ? RPC_FC_POINTER - : RPC_FC_LONG); + unsigned char fc = cont_is_complex ? RPC_FC_POINTER : RPC_FC_LONG; print_file(file, 2, "0x%x,\t/* %s */\n", fc, string_of_type(fc)); *tfsoff += 1; } - else if (!write_base_type(file, make_signed(type->type), tfsoff)) - error("Unsupported member type 0x%x\n", type->type); + else if (!write_base_type(file, type, TRUE, tfsoff)) + error("Unsupported member type %d\n", type_get_type(type)); } static void write_end(FILE *file, unsigned int *tfsoff) @@ -1346,12 +1519,12 @@ static void write_descriptors(FILE *file, type_t *type, unsigned int *tfsoff) { unsigned int align = 0; type_t *ft = f->type; - if (is_union(ft->type) && is_attr(f->attrs, ATTR_SWITCHIS)) + if (type_get_type(ft) == TYPE_UNION && is_attr(f->attrs, ATTR_SWITCHIS)) { unsigned int absoff = ft->typestring_offset; short reloff = absoff - (*tfsoff + 6); print_file(file, 0, "/* %d */\n", *tfsoff); - print_file(file, 2, "0x%x,\t/* %s */\n", ft->type, string_of_type(ft->type)); + print_file(file, 2, "0x%x,\t/* FC_NON_ENCAPSULATED_UNION */\n", RPC_FC_NON_ENCAPSULATED_UNION); print_file(file, 2, "0x%x,\t/* FIXME: always FC_LONG */\n", RPC_FC_LONG); write_conf_or_var_desc(file, current_structure, offset, ft, get_attrp(f->attrs, ATTR_SWITCHIS)); @@ -1366,41 +1539,41 @@ static void write_descriptors(FILE *file, type_t *type, unsigned int *tfsoff) } static int write_no_repeat_pointer_descriptions( - FILE *file, type_t *type, - size_t *offset_in_memory, size_t *offset_in_buffer, + FILE *file, const attr_list_t *attrs, type_t *type, + unsigned int *offset_in_memory, unsigned int *offset_in_buffer, unsigned int *typestring_offset) { int written = 0; unsigned int align; - if (is_ptr(type) || (!type->declarray && is_conformant_array(type))) + if (is_ptr(type) || + (is_conformant_array(type) && type_array_is_decl_as_ptr(type))) { - size_t memsize; + unsigned int memsize; print_file(file, 2, "0x%02x, /* FC_NO_REPEAT */\n", RPC_FC_NO_REPEAT); print_file(file, 2, "0x%02x, /* FC_PAD */\n", RPC_FC_PAD); /* pointer instance */ - print_file(file, 2, "NdrFcShort(0x%x), /* Memory offset = %d */\n", *offset_in_memory, *offset_in_memory); - print_file(file, 2, "NdrFcShort(0x%x), /* Buffer offset = %d */\n", *offset_in_buffer, *offset_in_buffer); + print_file(file, 2, "NdrFcShort(0x%hx),\t/* Memory offset = %d */\n", *offset_in_memory, *offset_in_memory); + print_file(file, 2, "NdrFcShort(0x%hx),\t/* Buffer offset = %d */\n", *offset_in_buffer, *offset_in_buffer); *typestring_offset += 6; if (is_ptr(type)) { - if (is_string_type(type->attrs, type)) - write_string_tfs(file, NULL, type, NULL, typestring_offset); + if (is_string_type(attrs, type)) + write_string_tfs(file, attrs, type, FALSE, NULL, typestring_offset); else - write_pointer_tfs(file, type, typestring_offset); + write_pointer_tfs(file, attrs, type, FALSE, typestring_offset); } else { - unsigned absoff = type->typestring_offset; - short reloff = absoff - (*typestring_offset + 2); - /* FIXME: get pointer attributes from field */ - print_file(file, 2, "0x%02x, 0x0,\t/* %s */\n", RPC_FC_UP, "FC_UP"); - print_file(file, 2, "NdrFcShort(0x%hx),\t/* Offset= %hd (%u) */\n", - reloff, reloff, absoff); - *typestring_offset += 4; + unsigned int offset = type->typestring_offset; + /* skip over the pointer that is written for strings, since a + * pointer has to be written in-place here */ + if (is_string_type(attrs, type)) + offset += 4; + write_nonsimple_pointer(file, attrs, type, FALSE, offset, typestring_offset); } align = 0; @@ -1420,7 +1593,7 @@ static int write_no_repeat_pointer_descriptions( { if (offset_in_memory && offset_in_buffer) { - size_t padding; + unsigned int padding; align = 0; type_memsize(v->type, &align); padding = ROUNDING(*offset_in_memory, align); @@ -1428,13 +1601,13 @@ static int write_no_repeat_pointer_descriptions( *offset_in_buffer += padding; } written += write_no_repeat_pointer_descriptions( - file, v->type, + file, v->attrs, v->type, offset_in_memory, offset_in_buffer, typestring_offset); } } else { - size_t memsize; + unsigned int memsize; align = 0; memsize = type_memsize(type, &align); *offset_in_memory += memsize; @@ -1448,22 +1621,24 @@ static int write_no_repeat_pointer_descriptions( static int write_pointer_description_offsets( FILE *file, const attr_list_t *attrs, type_t *type, - size_t *offset_in_memory, size_t *offset_in_buffer, + unsigned int *offset_in_memory, unsigned int *offset_in_buffer, unsigned int *typestring_offset) { int written = 0; unsigned int align; - if (is_ptr(type) && type_pointer_get_ref(type)->type != RPC_FC_IP) + if (is_ptr(type) && type_get_type(type_pointer_get_ref(type)) != TYPE_INTERFACE) { + type_t *ref = type_pointer_get_ref(type); + if (offset_in_memory && offset_in_buffer) { - size_t memsize; + unsigned int memsize; /* pointer instance */ /* FIXME: sometimes from end of structure, sometimes from beginning */ - print_file(file, 2, "NdrFcShort(0x%x), /* Memory offset = %d */\n", *offset_in_memory, *offset_in_memory); - print_file(file, 2, "NdrFcShort(0x%x), /* Buffer offset = %d */\n", *offset_in_buffer, *offset_in_buffer); + print_file(file, 2, "NdrFcShort(0x%hx),\t/* Memory offset = %d */\n", *offset_in_memory, *offset_in_memory); + print_file(file, 2, "NdrFcShort(0x%hx),\t/* Buffer offset = %d */\n", *offset_in_buffer, *offset_in_buffer); align = 0; memsize = type_memsize(type, &align); @@ -1475,10 +1650,9 @@ static int write_pointer_description_offsets( *typestring_offset += 4; if (is_string_type(attrs, type)) - write_string_tfs(file, NULL, type, NULL, typestring_offset); - else if (processed(type_pointer_get_ref(type)) || - is_base_type(type_pointer_get_ref(type)->type)) - write_pointer_tfs(file, type, typestring_offset); + write_string_tfs(file, attrs, type, FALSE, NULL, typestring_offset); + else if (processed(ref) || type_get_type(ref) == TYPE_BASIC || type_get_type(ref) == TYPE_ENUM) + write_pointer_tfs(file, attrs, type, FALSE, typestring_offset); else error("write_pointer_description_offsets: type format string unknown\n"); @@ -1499,7 +1673,7 @@ static int write_pointer_description_offsets( { if (offset_in_memory && offset_in_buffer) { - size_t padding; + unsigned int padding; align = 0; type_memsize(v->type, &align); padding = ROUNDING(*offset_in_memory, align); @@ -1515,7 +1689,7 @@ static int write_pointer_description_offsets( { if (offset_in_memory && offset_in_buffer) { - size_t memsize; + unsigned int memsize; align = 0; memsize = type_memsize(type, &align); *offset_in_memory += memsize; @@ -1532,14 +1706,14 @@ static int write_pointer_description_offsets( * it is the number of type format characters written */ static int write_fixed_array_pointer_descriptions( FILE *file, const attr_list_t *attrs, type_t *type, - size_t *offset_in_memory, size_t *offset_in_buffer, + unsigned int *offset_in_memory, unsigned int *offset_in_buffer, unsigned int *typestring_offset) { unsigned int align; int pointer_count = 0; - int real_type = get_array_type( type ); - if (real_type == RPC_FC_SMFARRAY || real_type == RPC_FC_LGFARRAY) + if (type_get_type(type) == TYPE_ARRAY && + !type_array_has_conformance(type) && !type_array_has_variance(type)) { unsigned int temp = 0; /* unfortunately, this needs to be done in two passes to avoid @@ -1549,18 +1723,18 @@ static int write_fixed_array_pointer_descriptions( if (pointer_count > 0) { unsigned int increment_size; - size_t offset_of_array_pointer_mem = 0; - size_t offset_of_array_pointer_buf = 0; + unsigned int offset_of_array_pointer_mem = 0; + unsigned int offset_of_array_pointer_buf = 0; align = 0; increment_size = type_memsize(type_array_get_element(type), &align); print_file(file, 2, "0x%02x, /* FC_FIXED_REPEAT */\n", RPC_FC_FIXED_REPEAT); print_file(file, 2, "0x%02x, /* FC_PAD */\n", RPC_FC_PAD); - print_file(file, 2, "NdrFcShort(0x%x), /* Iterations = %d */\n", type_array_get_dim(type), type_array_get_dim(type)); - print_file(file, 2, "NdrFcShort(0x%x), /* Increment = %d */\n", increment_size, increment_size); - print_file(file, 2, "NdrFcShort(0x%x), /* Offset to array = %d */\n", *offset_in_memory, *offset_in_memory); - print_file(file, 2, "NdrFcShort(0x%x), /* Number of pointers = %d */\n", pointer_count, pointer_count); + print_file(file, 2, "NdrFcShort(0x%hx),\t/* Iterations = %d */\n", type_array_get_dim(type), type_array_get_dim(type)); + print_file(file, 2, "NdrFcShort(0x%hx),\t/* Increment = %d */\n", increment_size, increment_size); + print_file(file, 2, "NdrFcShort(0x%hx),\t/* Offset to array = %d */\n", *offset_in_memory, *offset_in_memory); + print_file(file, 2, "NdrFcShort(0x%hx),\t/* Number of pointers = %d */\n", pointer_count, pointer_count); *typestring_offset += 10; pointer_count = write_pointer_description_offsets( @@ -1568,14 +1742,14 @@ static int write_fixed_array_pointer_descriptions( &offset_of_array_pointer_buf, typestring_offset); } } - else if (is_struct(type->type)) + else if (type_get_type(type) == TYPE_STRUCT) { const var_t *v; LIST_FOR_EACH_ENTRY( v, type_struct_get_fields(type), const var_t, entry ) { if (offset_in_memory && offset_in_buffer) { - size_t padding; + unsigned int padding; align = 0; type_memsize(v->type, &align); padding = ROUNDING(*offset_in_memory, align); @@ -1591,7 +1765,7 @@ static int write_fixed_array_pointer_descriptions( { if (offset_in_memory && offset_in_buffer) { - size_t memsize; + unsigned int memsize; align = 0; memsize = type_memsize(type, &align); *offset_in_memory += memsize; @@ -1608,7 +1782,7 @@ static int write_fixed_array_pointer_descriptions( * it is the number of type format characters written */ static int write_conformant_array_pointer_descriptions( FILE *file, const attr_list_t *attrs, type_t *type, - size_t offset_in_memory, unsigned int *typestring_offset) + unsigned int offset_in_memory, unsigned int *typestring_offset) { unsigned int align; int pointer_count = 0; @@ -1623,8 +1797,8 @@ static int write_conformant_array_pointer_descriptions( if (pointer_count > 0) { unsigned int increment_size; - size_t offset_of_array_pointer_mem = offset_in_memory; - size_t offset_of_array_pointer_buf = offset_in_memory; + unsigned int offset_of_array_pointer_mem = offset_in_memory; + unsigned int offset_of_array_pointer_buf = offset_in_memory; align = 0; increment_size = type_memsize(type_array_get_element(type), &align); @@ -1634,9 +1808,9 @@ static int write_conformant_array_pointer_descriptions( print_file(file, 2, "0x%02x, /* FC_VARIABLE_REPEAT */\n", RPC_FC_VARIABLE_REPEAT); print_file(file, 2, "0x%02x, /* FC_FIXED_OFFSET */\n", RPC_FC_FIXED_OFFSET); - print_file(file, 2, "NdrFcShort(0x%x), /* Increment = %d */\n", increment_size, increment_size); - print_file(file, 2, "NdrFcShort(0x%x), /* Offset to array = %d */\n", offset_in_memory, offset_in_memory); - print_file(file, 2, "NdrFcShort(0x%x), /* Number of pointers = %d */\n", pointer_count, pointer_count); + print_file(file, 2, "NdrFcShort(0x%hx),\t/* Increment = %d */\n", increment_size, increment_size); + print_file(file, 2, "NdrFcShort(0x%hx),\t/* Offset to array = %d */\n", offset_in_memory, offset_in_memory); + print_file(file, 2, "NdrFcShort(0x%hx),\t/* Number of pointers = %d */\n", pointer_count, pointer_count); *typestring_offset += 8; pointer_count = write_pointer_description_offsets( @@ -1653,7 +1827,7 @@ static int write_conformant_array_pointer_descriptions( * it is the number of type format characters written */ static int write_varying_array_pointer_descriptions( FILE *file, const attr_list_t *attrs, type_t *type, - size_t *offset_in_memory, size_t *offset_in_buffer, + unsigned int *offset_in_memory, unsigned int *offset_in_buffer, unsigned int *typestring_offset) { unsigned int align; @@ -1678,9 +1852,9 @@ static int write_varying_array_pointer_descriptions( print_file(file, 2, "0x%02x, /* FC_VARIABLE_REPEAT */\n", RPC_FC_VARIABLE_REPEAT); print_file(file, 2, "0x%02x, /* FC_VARIABLE_OFFSET */\n", RPC_FC_VARIABLE_OFFSET); - print_file(file, 2, "NdrFcShort(0x%x), /* Increment = %d */\n", increment_size, increment_size); - print_file(file, 2, "NdrFcShort(0x%x), /* Offset to array = %d */\n", *offset_in_memory, *offset_in_memory); - print_file(file, 2, "NdrFcShort(0x%x), /* Number of pointers = %d */\n", pointer_count, pointer_count); + print_file(file, 2, "NdrFcShort(0x%hx),\t/* Increment = %d */\n", increment_size, increment_size); + print_file(file, 2, "NdrFcShort(0x%hx),\t/* Offset to array = %d */\n", *offset_in_memory, *offset_in_memory); + print_file(file, 2, "NdrFcShort(0x%hx),\t/* Number of pointers = %d */\n", pointer_count, pointer_count); *typestring_offset += 8; pointer_count = write_pointer_description_offsets( @@ -1688,14 +1862,14 @@ static int write_varying_array_pointer_descriptions( offset_in_buffer, typestring_offset); } } - else if (is_struct(type->type)) + else if (type_get_type(type) == TYPE_STRUCT) { const var_t *v; LIST_FOR_EACH_ENTRY( v, type_struct_get_fields(type), const var_t, entry ) { if (offset_in_memory && offset_in_buffer) { - size_t padding; + unsigned int padding; if (is_array(v->type) && type_array_has_variance(v->type)) { @@ -1719,7 +1893,7 @@ static int write_varying_array_pointer_descriptions( { if (offset_in_memory && offset_in_buffer) { - size_t memsize; + unsigned int memsize; align = 0; memsize = type_memsize(type, &align); *offset_in_memory += memsize; @@ -1735,8 +1909,8 @@ static int write_varying_array_pointer_descriptions( static void write_pointer_description(FILE *file, type_t *type, unsigned int *typestring_offset) { - size_t offset_in_buffer; - size_t offset_in_memory; + unsigned int offset_in_buffer; + unsigned int offset_in_memory; /* pass 1: search for single instance of a pointer (i.e. don't descend * into arrays) */ @@ -1745,7 +1919,7 @@ static void write_pointer_description(FILE *file, type_t *type, offset_in_memory = 0; offset_in_buffer = 0; write_no_repeat_pointer_descriptions( - file, type, + file, NULL, type, &offset_in_memory, &offset_in_buffer, typestring_offset); } @@ -1758,10 +1932,12 @@ static void write_pointer_description(FILE *file, type_t *type, /* pass 3: search for pointers in conformant only arrays (but don't descend * into conformant varying or varying arrays) */ - if ((!type->declarray || !current_structure) && is_conformant_array(type)) + if (is_conformant_array(type) && + (type_array_is_decl_as_ptr(type) || !current_structure)) write_conformant_array_pointer_descriptions( file, NULL, type, 0, typestring_offset); - else if (get_struct_type(type) == RPC_FC_CPSTRUCT) + else if (type_get_type(type) == TYPE_STRUCT && + get_struct_fc(type) == RPC_FC_CPSTRUCT) { unsigned int align = 0; type_t *carray = find_array_or_string_in_struct(type)->type; @@ -1781,20 +1957,24 @@ static void write_pointer_description(FILE *file, type_t *type, int is_declptr(const type_t *t) { - return is_ptr(t) || (is_conformant_array(t) && !t->declarray); + return is_ptr(t) || (type_get_type(t) == TYPE_ARRAY && type_array_is_decl_as_ptr(t)); } -static size_t write_string_tfs(FILE *file, const attr_list_t *attrs, - type_t *type, - const char *name, unsigned int *typestring_offset) +static unsigned int write_string_tfs(FILE *file, const attr_list_t *attrs, + type_t *type, int toplevel_param, + const char *name, unsigned int *typestring_offset) { - size_t start_offset; + unsigned int start_offset; unsigned char rtype; + type_t *elem_type; + + start_offset = *typestring_offset; + update_tfsoff(type, start_offset, file); if (is_declptr(type)) { unsigned char flag = is_conformant_array(type) ? 0 : RPC_FC_P_SIMPLEPOINTER; - int pointer_type = is_ptr(type) ? type->type : get_attrv(attrs, ATTR_POINTERTYPE); + int pointer_type = get_pointer_fc(type, attrs, toplevel_param); if (!pointer_type) pointer_type = RPC_FC_RP; print_start_tfs_comment(file, type, *typestring_offset); @@ -1809,37 +1989,41 @@ static size_t write_string_tfs(FILE *file, const attr_list_t *attrs, } } - start_offset = *typestring_offset; - update_tfsoff(type, start_offset, file); - if (is_array(type)) - rtype = type_array_get_element(type)->type; + elem_type = type_array_get_element(type); else - rtype = type_pointer_get_ref(type)->type; + elem_type = type_pointer_get_ref(type); + if (type_get_type(elem_type) != TYPE_BASIC) + { + error("write_string_tfs: Unimplemented for non-basic type %s\n", name); + return start_offset; + } + + rtype = get_basic_fc(elem_type); if ((rtype != RPC_FC_BYTE) && (rtype != RPC_FC_CHAR) && (rtype != RPC_FC_WCHAR)) { error("write_string_tfs: Unimplemented for type 0x%x of name: %s\n", rtype, name); return start_offset; } - if (type->declarray && !is_conformant_array(type)) + if (type_get_type(type) == TYPE_ARRAY && !type_array_has_conformance(type)) { - unsigned long dim = type_array_get_dim(type); + unsigned int dim = type_array_get_dim(type); /* FIXME: multi-dimensional array */ - if (0xffffuL < dim) - error("array size for parameter %s exceeds %u bytes by %lu bytes\n", + if (0xffffu < dim) + error("array size for parameter %s exceeds %u bytes by %u bytes\n", name, 0xffffu, dim - 0xffffu); - if (rtype == RPC_FC_CHAR) - WRITE_FCTYPE(file, FC_CSTRING, *typestring_offset); - else + if (rtype == RPC_FC_WCHAR) WRITE_FCTYPE(file, FC_WSTRING, *typestring_offset); + else + WRITE_FCTYPE(file, FC_CSTRING, *typestring_offset); print_file(file, 2, "0x%x, /* FC_PAD */\n", RPC_FC_PAD); *typestring_offset += 2; - print_file(file, 2, "NdrFcShort(0x%x), /* %d */\n", dim, dim); + print_file(file, 2, "NdrFcShort(0x%hx),\t/* %d */\n", dim, dim); *typestring_offset += 2; return start_offset; @@ -1848,16 +2032,16 @@ static size_t write_string_tfs(FILE *file, const attr_list_t *attrs, { unsigned int align = 0; - if (rtype == RPC_FC_CHAR) - WRITE_FCTYPE(file, FC_C_CSTRING, *typestring_offset); - else + if (rtype == RPC_FC_WCHAR) WRITE_FCTYPE(file, FC_C_WSTRING, *typestring_offset); + else + WRITE_FCTYPE(file, FC_C_CSTRING, *typestring_offset); print_file(file, 2, "0x%x, /* FC_STRING_SIZED */\n", RPC_FC_STRING_SIZED); *typestring_offset += 2; *typestring_offset += write_conf_or_var_desc( file, current_structure, - (type->declarray && current_structure + (!type_array_is_decl_as_ptr(type) && current_structure ? type_memsize(current_structure, &align) : 0), type, type_array_get_conformance(type)); @@ -1877,19 +2061,19 @@ static size_t write_string_tfs(FILE *file, const attr_list_t *attrs, } } -static size_t write_array_tfs(FILE *file, const attr_list_t *attrs, type_t *type, - const char *name, unsigned int *typestring_offset) +static unsigned int write_array_tfs(FILE *file, const attr_list_t *attrs, type_t *type, + const char *name, unsigned int *typestring_offset) { const expr_t *length_is = type_array_get_variance(type); const expr_t *size_is = type_array_get_conformance(type); unsigned int align = 0; - size_t size; - size_t start_offset; - int real_type; + unsigned int size; + unsigned int start_offset; + unsigned char fc; int has_pointer; int pointer_type = get_attrv(attrs, ATTR_POINTERTYPE); unsigned int baseoff - = type->declarray && current_structure + = !type_array_is_decl_as_ptr(type) && current_structure ? type_memsize(current_structure, &align) : 0; @@ -1903,26 +2087,26 @@ static size_t write_array_tfs(FILE *file, const attr_list_t *attrs, type_t *type align = 0; size = type_memsize((is_conformant_array(type) ? type_array_get_element(type) : type), &align); - real_type = get_array_type( type ); + fc = get_array_fc(type); start_offset = *typestring_offset; update_tfsoff(type, start_offset, file); print_start_tfs_comment(file, type, start_offset); - print_file(file, 2, "0x%02x,\t/* %s */\n", real_type, string_of_type(real_type)); + print_file(file, 2, "0x%02x,\t/* %s */\n", fc, string_of_type(fc)); print_file(file, 2, "0x%x,\t/* %d */\n", align - 1, align - 1); *typestring_offset += 2; align = 0; - if (real_type != RPC_FC_BOGUS_ARRAY) + if (fc != RPC_FC_BOGUS_ARRAY) { - if (real_type == RPC_FC_LGFARRAY || real_type == RPC_FC_LGVARRAY) + if (fc == RPC_FC_LGFARRAY || fc == RPC_FC_LGVARRAY) { - print_file(file, 2, "NdrFcLong(0x%x),\t/* %lu */\n", size, size); + print_file(file, 2, "NdrFcLong(0x%x),\t/* %u */\n", size, size); *typestring_offset += 4; } else { - print_file(file, 2, "NdrFcShort(0x%x),\t/* %lu */\n", size, size); + print_file(file, 2, "NdrFcShort(0x%hx),\t/* %u */\n", size, size); *typestring_offset += 2; } @@ -1931,24 +2115,24 @@ static size_t write_array_tfs(FILE *file, const attr_list_t *attrs, type_t *type += write_conf_or_var_desc(file, current_structure, baseoff, type, size_is); - if (real_type == RPC_FC_SMVARRAY || real_type == RPC_FC_LGVARRAY) + if (fc == RPC_FC_SMVARRAY || fc == RPC_FC_LGVARRAY) { unsigned int elalign = 0; - size_t elsize = type_memsize(type_array_get_element(type), &elalign); - unsigned long dim = type_array_get_dim(type); + unsigned int elsize = type_memsize(type_array_get_element(type), &elalign); + unsigned int dim = type_array_get_dim(type); - if (real_type == RPC_FC_LGVARRAY) + if (fc == RPC_FC_LGVARRAY) { - print_file(file, 2, "NdrFcLong(0x%x),\t/* %lu */\n", dim, dim); + print_file(file, 2, "NdrFcLong(0x%x),\t/* %u */\n", dim, dim); *typestring_offset += 4; } else { - print_file(file, 2, "NdrFcShort(0x%x),\t/* %lu */\n", dim, dim); + print_file(file, 2, "NdrFcShort(0x%hx),\t/* %u */\n", dim, dim); *typestring_offset += 2; } - print_file(file, 2, "NdrFcShort(0x%x),\t/* %lu */\n", elsize, elsize); + print_file(file, 2, "NdrFcShort(0x%hx),\t/* %u */\n", elsize, elsize); *typestring_offset += 2; } @@ -1957,7 +2141,7 @@ static size_t write_array_tfs(FILE *file, const attr_list_t *attrs, type_t *type += write_conf_or_var_desc(file, current_structure, baseoff, type, length_is); - if (has_pointer && (!type->declarray || !current_structure)) + if (has_pointer && (type_array_is_decl_as_ptr(type) || !current_structure)) { print_file(file, 2, "0x%x, /* FC_PP */\n", RPC_FC_PP); print_file(file, 2, "0x%x, /* FC_PAD */\n", RPC_FC_PAD); @@ -1967,13 +2151,13 @@ static size_t write_array_tfs(FILE *file, const attr_list_t *attrs, type_t *type *typestring_offset += 1; } - write_member_type(file, type, NULL, type_array_get_element(type), NULL, typestring_offset); + write_member_type(file, type, FALSE, NULL, type_array_get_element(type), NULL, typestring_offset); write_end(file, typestring_offset); } else { unsigned int dim = size_is ? 0 : type_array_get_dim(type); - print_file(file, 2, "NdrFcShort(0x%x),\t/* %u */\n", dim, dim); + print_file(file, 2, "NdrFcShort(0x%hx),\t/* %u */\n", dim, dim); *typestring_offset += 2; *typestring_offset += write_conf_or_var_desc(file, current_structure, baseoff, @@ -1981,7 +2165,7 @@ static size_t write_array_tfs(FILE *file, const attr_list_t *attrs, type_t *type *typestring_offset += write_conf_or_var_desc(file, current_structure, baseoff, type, length_is); - write_member_type(file, type, NULL, type_array_get_element(type), NULL, typestring_offset); + write_member_type(file, type, TRUE, NULL, type_array_get_element(type), NULL, typestring_offset); write_end(file, typestring_offset); } @@ -1993,7 +2177,6 @@ static const var_t *find_array_or_string_in_struct(const type_t *type) const var_list_t *fields = type_struct_get_fields(type); const var_t *last_field; const type_t *ft; - int real_type; if (!fields || list_empty(fields)) return NULL; @@ -2001,18 +2184,18 @@ static const var_t *find_array_or_string_in_struct(const type_t *type) last_field = LIST_ENTRY( list_tail(fields), const var_t, entry ); ft = last_field->type; - if (ft->declarray && is_conformant_array(ft)) + if (is_conformant_array(ft) && !type_array_is_decl_as_ptr(ft)) return last_field; - real_type = get_struct_type( type ); - if (real_type == RPC_FC_CSTRUCT || real_type == RPC_FC_CPSTRUCT || real_type == RPC_FC_CVSTRUCT) + if (type_get_type(ft) == TYPE_STRUCT) return find_array_or_string_in_struct(ft); else return NULL; } static void write_struct_members(FILE *file, const type_t *type, - unsigned int *corroff, unsigned int *typestring_offset) + int is_complex, unsigned int *corroff, + unsigned int *typestring_offset) { const var_t *field; unsigned short offset = 0; @@ -2023,10 +2206,10 @@ static void write_struct_members(FILE *file, const type_t *type, if (fields) LIST_FOR_EACH_ENTRY( field, fields, const var_t, entry ) { type_t *ft = field->type; - if (!ft->declarray || !is_conformant_array(ft)) + if (!is_conformant_array(ft) || type_array_is_decl_as_ptr(ft)) { unsigned int align = 0; - size_t size = type_memsize(ft, &align); + unsigned int size = type_memsize(ft, &align); if (salign == -1) salign = align; if ((align - 1) & offset) @@ -2041,13 +2224,13 @@ static void write_struct_members(FILE *file, const type_t *type, fc = RPC_FC_ALIGNM8; break; default: - error("write_struct_members: cannot align type %d\n", ft->type); + error("write_struct_members: cannot align type %d\n", type_get_type(ft)); } print_file(file, 2, "0x%x,\t/* %s */\n", fc, string_of_type(fc)); offset = ROUND_SIZE(offset, align); *typestring_offset += 1; } - write_member_type(file, type, field->attrs, field->type, corroff, + write_member_type(file, type, is_complex, field->attrs, field->type, corroff, typestring_offset); offset += size; } @@ -2065,19 +2248,19 @@ static void write_struct_members(FILE *file, const type_t *type, write_end(file, typestring_offset); } -static size_t write_struct_tfs(FILE *file, type_t *type, - const char *name, unsigned int *tfsoff) +static unsigned int write_struct_tfs(FILE *file, type_t *type, + const char *name, unsigned int *tfsoff) { const type_t *save_current_structure = current_structure; unsigned int total_size; const var_t *array; - size_t start_offset; - size_t array_offset; + unsigned int start_offset; + unsigned int array_offset; int has_pointers = 0; unsigned int align = 0; unsigned int corroff; var_t *f; - int real_type = get_struct_type( type ); + unsigned char fc = get_struct_fc(type); var_list_t *fields = type_struct_get_fields(type); guard_rec(type); @@ -2097,7 +2280,7 @@ static size_t write_struct_tfs(FILE *file, type_t *type, if (array && !processed(array->type)) array_offset = is_string_type(array->attrs, array->type) - ? write_string_tfs(file, array->attrs, array->type, array->name, tfsoff) + ? write_string_tfs(file, array->attrs, array->type, FALSE, array->name, tfsoff) : write_array_tfs(file, array->attrs, array->type, array->name, tfsoff); corroff = *tfsoff; @@ -2106,40 +2289,41 @@ static size_t write_struct_tfs(FILE *file, type_t *type, start_offset = *tfsoff; update_tfsoff(type, start_offset, file); print_start_tfs_comment(file, type, start_offset); - print_file(file, 2, "0x%x,\t/* %s */\n", real_type, string_of_type(real_type)); + print_file(file, 2, "0x%x,\t/* %s */\n", fc, string_of_type(fc)); print_file(file, 2, "0x%x,\t/* %d */\n", align - 1, align - 1); - print_file(file, 2, "NdrFcShort(0x%x),\t/* %d */\n", total_size, total_size); + print_file(file, 2, "NdrFcShort(0x%hx),\t/* %d */\n", total_size, total_size); *tfsoff += 4; if (array) { unsigned int absoff = array->type->typestring_offset; short reloff = absoff - *tfsoff; - print_file(file, 2, "NdrFcShort(0x%hx),\t/* Offset= %hd (%lu) */\n", + print_file(file, 2, "NdrFcShort(0x%hx),\t/* Offset= %hd (%u) */\n", reloff, reloff, absoff); *tfsoff += 2; } - else if (real_type == RPC_FC_BOGUS_STRUCT) + else if (fc == RPC_FC_BOGUS_STRUCT) { print_file(file, 2, "NdrFcShort(0x0),\n"); *tfsoff += 2; } - if (real_type == RPC_FC_BOGUS_STRUCT) + if (fc == RPC_FC_BOGUS_STRUCT) { /* On the sizing pass, type->ptrdesc may be zero, but it's ok as nothing is written to file yet. On the actual writing pass, this will have been updated. */ - unsigned int absoff = type->ptrdesc ? type->ptrdesc : *tfsoff; + unsigned int absoff = type_get_real_type(type)->ptrdesc ? + type_get_real_type(type)->ptrdesc : *tfsoff; int reloff = absoff - *tfsoff; assert( reloff >= 0 ); - print_file(file, 2, "NdrFcShort(0x%x),\t/* Offset= %d (%u) */\n", + print_file(file, 2, "NdrFcShort(0x%hx),\t/* Offset= %d (%u) */\n", reloff, reloff, absoff); *tfsoff += 2; } - else if ((real_type == RPC_FC_PSTRUCT) || - (real_type == RPC_FC_CPSTRUCT) || - (real_type == RPC_FC_CVSTRUCT && has_pointers)) + else if ((fc == RPC_FC_PSTRUCT) || + (fc == RPC_FC_CPSTRUCT) || + (fc == RPC_FC_CVSTRUCT && has_pointers)) { print_file(file, 2, "0x%x, /* FC_PP */\n", RPC_FC_PP); print_file(file, 2, "0x%x, /* FC_PAD */\n", RPC_FC_PAD); @@ -2149,117 +2333,93 @@ static size_t write_struct_tfs(FILE *file, type_t *type, *tfsoff += 1; } - write_struct_members(file, type, &corroff, tfsoff); + write_struct_members(file, type, fc == RPC_FC_BOGUS_STRUCT, &corroff, + tfsoff); - if (real_type == RPC_FC_BOGUS_STRUCT) + if (fc == RPC_FC_BOGUS_STRUCT) { const var_t *f; - type->ptrdesc = *tfsoff; + type_get_real_type(type)->ptrdesc = *tfsoff; if (fields) LIST_FOR_EACH_ENTRY(f, fields, const var_t, entry) { type_t *ft = f->type; if (is_ptr(ft)) { if (is_string_type(f->attrs, ft)) - write_string_tfs(file, f->attrs, ft, f->name, tfsoff); + write_string_tfs(file, f->attrs, ft, FALSE, f->name, tfsoff); else - write_pointer_tfs(file, ft, tfsoff); + write_pointer_tfs(file, f->attrs, ft, FALSE, tfsoff); } - else if (!ft->declarray && is_conformant_array(ft)) + else if (type_get_type(ft) == TYPE_ARRAY && type_array_is_decl_as_ptr(ft)) { - unsigned int absoff = ft->typestring_offset; - short reloff = absoff - (*tfsoff + 2); - int ptr_type = get_attrv(f->attrs, ATTR_POINTERTYPE); - /* FIXME: We need to store pointer attributes for arrays - so we don't lose pointer_default info. */ - if (ptr_type == 0) - ptr_type = RPC_FC_UP; + unsigned int offset; + print_file(file, 0, "/* %d */\n", *tfsoff); - print_file(file, 2, "0x%x, 0x0,\t/* %s */\n", ptr_type, - string_of_type(ptr_type)); - print_file(file, 2, "NdrFcShort(0x%hx),\t/* Offset= %hd (%u) */\n", - reloff, reloff, absoff); - *tfsoff += 4; + + offset = ft->typestring_offset; + /* skip over the pointer that is written for strings, since a + * pointer has to be written in-place here */ + if (is_string_type(f->attrs, ft)) + offset += 4; + write_nonsimple_pointer(file, f->attrs, ft, FALSE, offset, tfsoff); } } - if (type->ptrdesc == *tfsoff) - type->ptrdesc = 0; + if (type_get_real_type(type)->ptrdesc == *tfsoff) + type_get_real_type(type)->ptrdesc = 0; } current_structure = save_current_structure; return start_offset; } -static size_t write_pointer_only_tfs(FILE *file, const attr_list_t *attrs, int pointer_type, - unsigned char flags, size_t offset, - unsigned int *typeformat_offset) -{ - size_t start_offset = *typeformat_offset; - short reloff = offset - (*typeformat_offset + 2); - int in_attr, out_attr; - in_attr = is_attr(attrs, ATTR_IN); - out_attr = is_attr(attrs, ATTR_OUT); - if (!in_attr && !out_attr) in_attr = 1; - - if (out_attr && !in_attr && pointer_type == RPC_FC_RP) - flags |= 0x04; - - print_file(file, 2, "0x%x, 0x%x,\t\t/* %s", - pointer_type, - flags, - string_of_type(pointer_type)); - if (file) - { - if (flags & 0x04) - fprintf(file, " [allocated_on_stack]"); - if (flags & 0x10) - fprintf(file, " [pointer_deref]"); - fprintf(file, " */\n"); - } - - print_file(file, 2, "NdrFcShort(0x%x),\t/* %d */\n", reloff, offset); - *typeformat_offset += 4; - - return start_offset; -} - static void write_branch_type(FILE *file, const type_t *t, unsigned int *tfsoff) { if (t == NULL) { print_file(file, 2, "NdrFcShort(0x0),\t/* No type */\n"); } - else if (is_base_type(t->type)) - { - print_file(file, 2, "NdrFcShort(0x80%02x),\t/* Simple arm type: %s */\n", - t->type, string_of_type(t->type)); - } - else if (t->typestring_offset) - { - short reloff = t->typestring_offset - *tfsoff; - print_file(file, 2, "NdrFcShort(0x%x),\t/* Offset= %d (%d) */\n", - reloff, reloff, t->typestring_offset); - } else - error("write_branch_type: type unimplemented (0x%x)\n", t->type); + { + if (type_get_type(t) == TYPE_BASIC || type_get_type(t) == TYPE_ENUM) + { + unsigned char fc; + if (type_get_type(t) == TYPE_BASIC) + fc = get_basic_fc(t); + else + fc = get_enum_fc(t); + print_file(file, 2, "NdrFcShort(0x80%02x),\t/* Simple arm type: %s */\n", + fc, string_of_type(fc)); + } + else if (t->typestring_offset) + { + short reloff = t->typestring_offset - *tfsoff; + print_file(file, 2, "NdrFcShort(0x%hx),\t/* Offset= %d (%d) */\n", + reloff, reloff, t->typestring_offset); + } + else + error("write_branch_type: type unimplemented %d\n", type_get_type(t)); + } *tfsoff += 2; } -static size_t write_union_tfs(FILE *file, type_t *type, unsigned int *tfsoff) +static unsigned int write_union_tfs(FILE *file, type_t *type, unsigned int *tfsoff) { - unsigned int align = 0; + unsigned int align; unsigned int start_offset; - size_t size = type_memsize(type, &align); + unsigned int size; var_list_t *fields; - size_t nbranch = 0; + unsigned int nbranch = 0; type_t *deftype = NULL; short nodeftype = 0xffff; var_t *f; guard_rec(type); + align = 0; + size = type_memsize(type, &align); + fields = type_union_get_cases(type); if (fields) LIST_FOR_EACH_ENTRY(f, fields, var_t, entry) @@ -2274,63 +2434,85 @@ static size_t write_union_tfs(FILE *file, type_t *type, unsigned int *tfsoff) start_offset = *tfsoff; update_tfsoff(type, start_offset, file); print_start_tfs_comment(file, type, start_offset); - if (type->type == RPC_FC_ENCAPSULATED_UNION) + if (type_get_type(type) == TYPE_ENCAPSULATED_UNION) { const var_t *sv = type_union_get_switch_value(type); const type_t *st = sv->type; + unsigned char fc; - switch (st->type) + if (type_get_type(st) == TYPE_BASIC) { - case RPC_FC_CHAR: - case RPC_FC_SMALL: - case RPC_FC_USMALL: - case RPC_FC_SHORT: - case RPC_FC_USHORT: - case RPC_FC_LONG: - case RPC_FC_ULONG: - case RPC_FC_ENUM16: - case RPC_FC_ENUM32: - print_file(file, 2, "0x%x,\t/* %s */\n", type->type, string_of_type(type->type)); - print_file(file, 2, "0x%x,\t/* Switch type= %s */\n", - 0x40 | st->type, string_of_type(st->type)); - *tfsoff += 2; - break; - default: - error("union switch type must be an integer, char, or enum\n"); + switch (get_basic_fc(st)) + { + case RPC_FC_CHAR: + case RPC_FC_SMALL: + case RPC_FC_BYTE: + case RPC_FC_USMALL: + case RPC_FC_WCHAR: + case RPC_FC_SHORT: + case RPC_FC_USHORT: + case RPC_FC_LONG: + case RPC_FC_ULONG: + fc = get_basic_fc(st); + break; + default: + fc = 0; + error("union switch type must be an integer, char, or enum\n"); + } } + else if (type_get_type(st) == TYPE_ENUM) + fc = get_enum_fc(st); + else + error("union switch type must be an integer, char, or enum\n"); + + print_file(file, 2, "0x%x,\t/* FC_ENCAPSULATED_UNION */\n", RPC_FC_ENCAPSULATED_UNION); + print_file(file, 2, "0x%x,\t/* Switch type= %s */\n", + 0x40 | fc, string_of_type(fc)); + *tfsoff += 2; } else if (is_attr(type->attrs, ATTR_SWITCHTYPE)) { static const expr_t dummy_expr; /* FIXME */ const type_t *st = get_attrp(type->attrs, ATTR_SWITCHTYPE); + unsigned char fc; - switch (st->type) + if (type_get_type(st) == TYPE_BASIC) { - case RPC_FC_CHAR: - case RPC_FC_SMALL: - case RPC_FC_USMALL: - case RPC_FC_SHORT: - case RPC_FC_USHORT: - case RPC_FC_LONG: - case RPC_FC_ULONG: - case RPC_FC_ENUM16: - case RPC_FC_ENUM32: - print_file(file, 2, "0x%x,\t/* %s */\n", type->type, string_of_type(type->type)); - print_file(file, 2, "0x%x,\t/* Switch type= %s */\n", - st->type, string_of_type(st->type)); - *tfsoff += 2; - break; - default: - error("union switch type must be an integer, char, or enum\n"); + switch (get_basic_fc(st)) + { + case RPC_FC_CHAR: + case RPC_FC_SMALL: + case RPC_FC_USMALL: + case RPC_FC_SHORT: + case RPC_FC_USHORT: + case RPC_FC_LONG: + case RPC_FC_ULONG: + case RPC_FC_ENUM16: + case RPC_FC_ENUM32: + fc = get_basic_fc(st); + break; + default: + fc = 0; + error("union switch type must be an integer, char, or enum\n"); + } } + else if (type_get_type(st) == TYPE_ENUM) + fc = get_enum_fc(st); + else + error("union switch type must be an integer, char, or enum\n"); + + print_file(file, 2, "0x%x,\t/* FC_NON_ENCAPSULATED_UNION */\n", RPC_FC_NON_ENCAPSULATED_UNION); + print_file(file, 2, "0x%x,\t/* Switch type= %s */\n", + fc, string_of_type(fc)); + *tfsoff += 2; *tfsoff += write_conf_or_var_desc(file, NULL, *tfsoff, st, &dummy_expr ); print_file(file, 2, "NdrFcShort(0x2),\t/* Offset= 2 (%u) */\n", *tfsoff + 2); *tfsoff += 2; } - print_file(file, 2, "NdrFcShort(0x%x),\t/* %d */\n", size, size); - print_file(file, 2, "NdrFcShort(0x%x),\t/* %d */\n", nbranch, nbranch); + print_file(file, 2, "NdrFcShort(0x%hx),\t/* %d */\n", size, size); + print_file(file, 2, "NdrFcShort(0x%hx),\t/* %d */\n", nbranch, nbranch); *tfsoff += 4; if (fields) LIST_FOR_EACH_ENTRY(f, fields, var_t, entry) @@ -2348,7 +2530,7 @@ static size_t write_union_tfs(FILE *file, type_t *type, unsigned int *tfsoff) /* MIDL doesn't check for duplicate cases, even though that seems like a reasonable thing to do, it just dumps them to the TFS like we're going to do here. */ - print_file(file, 2, "NdrFcLong(0x%x),\t/* %d */\n", c->cval, c->cval); + print_file(file, 2, "NdrFcLong(0x%lx),\t/* %ld */\n", c->cval, c->cval); *tfsoff += 4; write_branch_type(file, ft, tfsoff); } @@ -2369,18 +2551,18 @@ static size_t write_union_tfs(FILE *file, type_t *type, unsigned int *tfsoff) } else { - print_file(file, 2, "NdrFcShort(0x%x),\n", nodeftype); + print_file(file, 2, "NdrFcShort(0x%hx),\n", nodeftype); *tfsoff += 2; } return start_offset; } -static size_t write_ip_tfs(FILE *file, const attr_list_t *attrs, type_t *type, - unsigned int *typeformat_offset) +static unsigned int write_ip_tfs(FILE *file, const attr_list_t *attrs, type_t *type, + unsigned int *typeformat_offset) { - size_t i; - size_t start_offset = *typeformat_offset; + unsigned int i; + unsigned int start_offset = *typeformat_offset; expr_t *iid = get_attrp(attrs, ATTR_IIDIS); if (iid) @@ -2402,7 +2584,7 @@ static size_t write_ip_tfs(FILE *file, const attr_list_t *attrs, type_t *type, print_start_tfs_comment(file, type, start_offset); print_file(file, 2, "0x2f,\t/* FC_IP */\n"); print_file(file, 2, "0x5a,\t/* FC_CONSTANT_IID */\n"); - print_file(file, 2, "NdrFcLong(0x%08lx),\n", uuid->Data1); + print_file(file, 2, "NdrFcLong(0x%08x),\n", uuid->Data1); print_file(file, 2, "NdrFcShort(0x%04x),\n", uuid->Data2); print_file(file, 2, "NdrFcShort(0x%04x),\n", uuid->Data3); for (i = 0; i < 8; ++i) @@ -2416,11 +2598,11 @@ static size_t write_ip_tfs(FILE *file, const attr_list_t *attrs, type_t *type, return start_offset; } -static size_t write_contexthandle_tfs(FILE *file, const type_t *type, - const var_t *var, - unsigned int *typeformat_offset) +static unsigned int write_contexthandle_tfs(FILE *file, const type_t *type, + const var_t *var, + unsigned int *typeformat_offset) { - size_t start_offset = *typeformat_offset; + unsigned int start_offset = *typeformat_offset; unsigned char flags = 0; if (is_attr(current_iface->attrs, ATTR_STRICTCONTEXTHANDLE)) @@ -2464,39 +2646,30 @@ static size_t write_contexthandle_tfs(FILE *file, const type_t *type, return start_offset; } -static size_t write_typeformatstring_var(FILE *file, int indent, const var_t *func, - type_t *type, const var_t *var, - unsigned int *typeformat_offset) +static unsigned int write_typeformatstring_var(FILE *file, int indent, const var_t *func, + type_t *type, const var_t *var, + int toplevel_param, + unsigned int *typeformat_offset) { - size_t offset; + unsigned int offset; - if (is_context_handle(type)) - return write_contexthandle_tfs(file, type, var, typeformat_offset); - - if (is_user_type(type)) + switch (typegen_detect_type(type, var->attrs, TDT_ALL_TYPES)) { + case TGT_CTXT_HANDLE: + case TGT_CTXT_HANDLE_POINTER: + return write_contexthandle_tfs(file, type, var, typeformat_offset); + case TGT_USER_TYPE: write_user_tfs(file, type, typeformat_offset); return type->typestring_offset; - } - - if (is_string_type(var->attrs, type)) - return write_string_tfs(file, var->attrs, type, var->name, typeformat_offset); - - if (is_array(type)) + case TGT_STRING: + return write_string_tfs(file, var->attrs, type, toplevel_param, var->name, typeformat_offset); + case TGT_ARRAY: { int ptr_type; - size_t off; + unsigned int off; off = write_array_tfs(file, var->attrs, type, var->name, typeformat_offset); - ptr_type = get_attrv(var->attrs, ATTR_POINTERTYPE); - /* Top level pointers to conformant arrays may be handled specially - since we can bypass the pointer, but if the array is buried - beneath another pointer (e.g., "[size_is(,n)] int **p" then we - always need to write the pointer. */ - if (!ptr_type && var->type != type) - /* FIXME: This should use pointer_default, but the information - isn't kept around for arrays. */ - ptr_type = RPC_FC_UP; - if (ptr_type && ptr_type != RPC_FC_RP) + ptr_type = get_pointer_fc(type, var->attrs, toplevel_param); + if (ptr_type != RPC_FC_RP) { unsigned int absoff = type->typestring_offset; short reloff = absoff - (*typeformat_offset + 2); @@ -2510,73 +2683,68 @@ static size_t write_typeformatstring_var(FILE *file, int indent, const var_t *fu } return off; } - - if (!is_ptr(type)) - { - /* basic types don't need a type format string */ - if (is_base_type(type->type)) - return 0; - + case TGT_STRUCT: if (processed(type)) return type->typestring_offset; - - switch (type->type) + return write_struct_tfs(file, type, var->name, typeformat_offset); + case TGT_UNION: + if (processed(type)) return type->typestring_offset; + return write_union_tfs(file, type, typeformat_offset); + case TGT_ENUM: + case TGT_BASIC: + /* nothing to do */ + return 0; + case TGT_IFACE_POINTER: + return write_ip_tfs(file, var->attrs, type, typeformat_offset); + case TGT_POINTER: + if (last_ptr(type)) { - case RPC_FC_STRUCT: - case RPC_FC_PSTRUCT: - case RPC_FC_CSTRUCT: - case RPC_FC_CPSTRUCT: - case RPC_FC_CVSTRUCT: - case RPC_FC_BOGUS_STRUCT: - return write_struct_tfs(file, type, var->name, typeformat_offset); - case RPC_FC_ENCAPSULATED_UNION: - case RPC_FC_NON_ENCAPSULATED_UNION: - return write_union_tfs(file, type, typeformat_offset); - case RPC_FC_IGNORE: - case RPC_FC_BIND_PRIMITIVE: - /* nothing to do */ - return 0; - default: - error("write_typeformatstring_var: Unsupported type 0x%x for variable %s\n", type->type, var->name); + size_t start_offset = *typeformat_offset; + int in_attr = is_attr(var->attrs, ATTR_IN); + int out_attr = is_attr(var->attrs, ATTR_OUT); + const type_t *ref = type_pointer_get_ref(type); + + switch (typegen_detect_type(ref, NULL, TDT_ALL_TYPES)) + { + /* special case for pointers to base types */ + case TGT_BASIC: + case TGT_ENUM: + { + unsigned char fc; + + if (type_get_type(ref) == TYPE_ENUM) + fc = get_enum_fc(ref); + else + fc = get_basic_fc(ref); + + print_file(file, indent, "0x%x, 0x%x, /* %s %s[simple_pointer] */\n", + get_pointer_fc(type, var->attrs, toplevel_param), + (!in_attr && out_attr) ? 0x0C : 0x08, + string_of_type(get_pointer_fc(type, var->attrs, toplevel_param)), + (!in_attr && out_attr) ? "[allocated_on_stack] " : ""); + print_file(file, indent, "0x%02x, /* %s */\n", + fc, string_of_type(fc)); + print_file(file, indent, "0x5c, /* FC_PAD */\n"); + *typeformat_offset += 4; + return start_offset; + } + default: + break; + } } + + offset = write_typeformatstring_var(file, indent, func, + type_pointer_get_ref(type), var, + FALSE, typeformat_offset); + if (file) + fprintf(file, "/* %2u */\n", *typeformat_offset); + return write_nonsimple_pointer(file, var->attrs, type, + toplevel_param, + offset, typeformat_offset); + case TGT_INVALID: + break; } - else if (last_ptr(type)) - { - size_t start_offset = *typeformat_offset; - int in_attr = is_attr(var->attrs, ATTR_IN); - int out_attr = is_attr(var->attrs, ATTR_OUT); - const type_t *base = type_pointer_get_ref(type); - - if (base->type == RPC_FC_IP - || (base->type == 0 - && is_attr(var->attrs, ATTR_IIDIS))) - { - return write_ip_tfs(file, var->attrs, type, typeformat_offset); - } - - /* special case for pointers to base types */ - if (is_base_type(base->type)) - { - print_file(file, indent, "0x%x, 0x%x, /* %s %s[simple_pointer] */\n", - type->type, (!in_attr && out_attr) ? 0x0C : 0x08, - string_of_type(type->type), - (!in_attr && out_attr) ? "[allocated_on_stack] " : ""); - print_file(file, indent, "0x%02x, /* %s */\n", base->type, string_of_type(base->type)); - print_file(file, indent, "0x5c, /* FC_PAD */\n"); - *typeformat_offset += 4; - return start_offset; - } - } - - assert(is_ptr(type)); - - offset = write_typeformatstring_var(file, indent, func, - type_pointer_get_ref(type), var, - typeformat_offset); - if (file) - fprintf(file, "/* %2u */\n", *typeformat_offset); - return write_pointer_only_tfs(file, var->attrs, type->type, - !last_ptr(type) ? 0x10 : 0, - offset, typeformat_offset); + error("invalid type %s for var %s\n", type->name, var->name); + return 0; } static int write_embedded_types(FILE *file, const attr_list_t *attrs, type_t *type, @@ -2584,62 +2752,63 @@ static int write_embedded_types(FILE *file, const attr_list_t *attrs, type_t *ty { int retmask = 0; - if (is_user_type(type)) + switch (typegen_detect_type(type, attrs, TDT_ALL_TYPES)) { + case TGT_USER_TYPE: write_user_tfs(file, type, tfsoff); - } - else if (is_string_type(attrs, type)) - { - write_string_tfs(file, attrs, type, name, tfsoff); - } - else if (is_ptr(type)) + break; + case TGT_STRING: + write_string_tfs(file, attrs, type, FALSE, name, tfsoff); + break; + case TGT_IFACE_POINTER: + write_ip_tfs(file, attrs, type, tfsoff); + break; + case TGT_POINTER: { type_t *ref = type_pointer_get_ref(type); - if (ref->type == RPC_FC_IP - || (ref->type == 0 - && is_attr(attrs, ATTR_IIDIS))) - { - write_ip_tfs(file, attrs, type, tfsoff); - } - else - { - if (!processed(ref) && !is_base_type(ref->type)) - retmask |= write_embedded_types(file, NULL, ref, name, TRUE, tfsoff); + if (!processed(ref) && type_get_type(ref) != TYPE_BASIC) + retmask |= write_embedded_types(file, NULL, ref, name, TRUE, tfsoff); - if (write_ptr) - write_pointer_tfs(file, type, tfsoff); + if (write_ptr) + write_pointer_tfs(file, attrs, type, FALSE, tfsoff); - retmask |= 1; + retmask |= 1; + break; + } + case TGT_ARRAY: + /* conformant arrays and strings are handled specially */ + if (!is_conformant_array(type) || type_array_is_decl_as_ptr(type) ) + { + write_array_tfs(file, attrs, type, name, tfsoff); + if (is_conformant_array(type)) + retmask |= 1; } - } - else if (type->declarray && is_conformant_array(type)) - ; /* conformant arrays and strings are handled specially */ - else if (is_array(type)) - { - write_array_tfs(file, attrs, type, name, tfsoff); - if (is_conformant_array(type)) - retmask |= 1; - } - else if (is_struct(type->type)) - { + break; + case TGT_STRUCT: if (!processed(type)) write_struct_tfs(file, type, name, tfsoff); - } - else if (is_union(type->type)) - { + break; + case TGT_UNION: if (!processed(type)) write_union_tfs(file, type, tfsoff); + break; + case TGT_ENUM: + case TGT_BASIC: + /* nothing to do */ + break; + case TGT_CTXT_HANDLE: + case TGT_CTXT_HANDLE_POINTER: + case TGT_INVALID: + error("invalid type %s for var %s\n", type->name, name); + break; } - else if (!is_base_type(type->type)) - error("write_embedded_types: unknown embedded type for %s (0x%x)\n", - name, type->type); return retmask; } -static size_t process_tfs_stmts(FILE *file, const statement_list_t *stmts, - type_pred_t pred, unsigned int *typeformat_offset) +static unsigned int process_tfs_stmts(FILE *file, const statement_list_t *stmts, + type_pred_t pred, unsigned int *typeformat_offset) { const var_t *var; const statement_t *stmt; @@ -2654,7 +2823,7 @@ static size_t process_tfs_stmts(FILE *file, const statement_list_t *stmts, process_tfs_stmts(file, stmt->u.lib->stmts, pred, typeformat_offset); continue; } - else if (stmt->type != STMT_TYPE || stmt->u.type->type != RPC_FC_IP) + else if (stmt->type != STMT_TYPE || type_get_type(stmt->u.type) != TYPE_INTERFACE) continue; iface = stmt->u.type; @@ -2675,7 +2844,7 @@ static size_t process_tfs_stmts(FILE *file, const statement_list_t *stmts, write_typeformatstring_var( file, 2, NULL, type_function_get_rettype(func->type), - &v, typeformat_offset), + &v, FALSE, typeformat_offset), file); } @@ -2686,7 +2855,7 @@ static size_t process_tfs_stmts(FILE *file, const statement_list_t *stmts, var->type, write_typeformatstring_var( file, 2, func, var->type, var, - typeformat_offset), + TRUE, typeformat_offset), file); } } @@ -2694,7 +2863,7 @@ static size_t process_tfs_stmts(FILE *file, const statement_list_t *stmts, return *typeformat_offset + 1; } -static size_t process_tfs(FILE *file, const statement_list_t *stmts, type_pred_t pred) +static unsigned int process_tfs(FILE *file, const statement_list_t *stmts, type_pred_t pred) { unsigned int typeformat_offset = 2; @@ -2726,19 +2895,19 @@ void write_typeformatstring(FILE *file, const statement_list_t *stmts, type_pred } static unsigned int get_required_buffer_size_type( - const type_t *type, const char *name, unsigned int *alignment) + const type_t *type, const char *name, const attr_list_t *attrs, int toplevel_param, unsigned int *alignment) { - const char *uname; - const type_t *utype; - *alignment = 0; - if ((utype = get_user_type(type, &uname))) + switch (typegen_detect_type(type, NULL, TDT_IGNORE_STRINGS)) { - return get_required_buffer_size_type(utype, uname, alignment); + case TGT_USER_TYPE: + { + const char *uname; + const type_t *utype = get_user_type(type, &uname); + return get_required_buffer_size_type(utype, uname, NULL, FALSE, alignment); } - else - { - switch (get_struct_type(type)) + case TGT_BASIC: + switch (get_basic_fc(type)) { case RPC_FC_BYTE: case RPC_FC_CHAR: @@ -2750,13 +2919,11 @@ static unsigned int get_required_buffer_size_type( case RPC_FC_WCHAR: case RPC_FC_USHORT: case RPC_FC_SHORT: - case RPC_FC_ENUM16: *alignment = 4; return 2; case RPC_FC_ULONG: case RPC_FC_LONG: - case RPC_FC_ENUM32: case RPC_FC_FLOAT: case RPC_FC_ERROR_STATUS_T: *alignment = 4; @@ -2771,25 +2938,69 @@ static unsigned int get_required_buffer_size_type( case RPC_FC_BIND_PRIMITIVE: return 0; - case RPC_FC_STRUCT: - if (!type_struct_get_fields(type)) return 0; - return fields_memsize(type_struct_get_fields(type), alignment); - - case RPC_FC_RP: - { - const type_t *ref = type_pointer_get_ref(type); - return is_base_type( ref->type ) || get_struct_type(ref) == RPC_FC_STRUCT ? - get_required_buffer_size_type( ref, name, alignment ) : 0; - } - - case RPC_FC_SMFARRAY: - case RPC_FC_LGFARRAY: - return type_array_get_dim(type) * get_required_buffer_size_type(type_array_get_element(type), name, alignment); - default: + error("get_required_buffer_size: unknown basic type 0x%02x\n", + get_basic_fc(type)); return 0; } + break; + + case TGT_ENUM: + switch (get_enum_fc(type)) + { + case RPC_FC_ENUM32: + *alignment = 4; + return 4; + case RPC_FC_ENUM16: + *alignment = 4; + return 2; + } + break; + + case TGT_STRUCT: + if (get_struct_fc(type) == RPC_FC_STRUCT) + { + if (!type_struct_get_fields(type)) return 0; + return fields_memsize(type_struct_get_fields(type), alignment); + } + break; + + case TGT_POINTER: + if (get_pointer_fc(type, attrs, toplevel_param) == RPC_FC_RP) + { + const type_t *ref = type_pointer_get_ref(type); + switch (typegen_detect_type(ref, NULL, TDT_ALL_TYPES)) + { + case TGT_BASIC: + case TGT_ENUM: + return get_required_buffer_size_type( ref, name, NULL, FALSE, alignment ); + case TGT_STRUCT: + if (get_struct_fc(ref) == RPC_FC_STRUCT) + return get_required_buffer_size_type( ref, name, NULL, FALSE, alignment ); + break; + case TGT_USER_TYPE: + case TGT_CTXT_HANDLE: + case TGT_CTXT_HANDLE_POINTER: + case TGT_STRING: + case TGT_POINTER: + case TGT_ARRAY: + case TGT_IFACE_POINTER: + case TGT_UNION: + case TGT_INVALID: + break; + } + } + break; + + case TGT_ARRAY: + /* FIXME: depends on pointer type */ + return type_array_get_dim(type) * + get_required_buffer_size_type(type_array_get_element(type), name, NULL, FALSE, alignment); + + default: + break; } + return 0; } static unsigned int get_required_buffer_size(const var_t *var, unsigned int *alignment, enum pass pass) @@ -2813,7 +3024,7 @@ static unsigned int get_required_buffer_size(const var_t *var, unsigned int *ali if (!is_string_type(var->attrs, var->type)) return get_required_buffer_size_type(var->type, var->name, - alignment); + var->attrs, TRUE, alignment); } return 0; } @@ -2889,16 +3100,30 @@ void print_phase_basetype(FILE *file, int indent, const char *local_var_prefix, type_t *type = var->type; unsigned int size; unsigned int alignment = 0; - unsigned char rtype; + const type_t *ref; /* no work to do for other phases, buffer sizing is done elsewhere */ if (phase != PHASE_MARSHAL && phase != PHASE_UNMARSHAL) return; - rtype = is_ptr(type) ? type_pointer_get_ref(type)->type : type->type; - - switch (rtype) + ref = is_ptr(type) ? type_pointer_get_ref(type) : type; + if (type_get_type(ref) == TYPE_ENUM) { + if (get_enum_fc(ref) == RPC_FC_ENUM32) + { + size = 4; + alignment = 4; + } + else /* RPC_FC_ENUM16 */ + { + size = 2; + alignment = 2; + } + } + else + { + switch (get_basic_fc(ref)) + { case RPC_FC_BYTE: case RPC_FC_CHAR: case RPC_FC_SMALL: @@ -2910,14 +3135,12 @@ void print_phase_basetype(FILE *file, int indent, const char *local_var_prefix, case RPC_FC_WCHAR: case RPC_FC_USHORT: case RPC_FC_SHORT: - case RPC_FC_ENUM16: size = 2; alignment = 2; break; case RPC_FC_ULONG: case RPC_FC_LONG: - case RPC_FC_ENUM32: case RPC_FC_FLOAT: case RPC_FC_ERROR_STATUS_T: size = 4; @@ -2936,8 +3159,10 @@ void print_phase_basetype(FILE *file, int indent, const char *local_var_prefix, return; default: - error("print_phase_basetype: Unsupported type: %s (0x%02x, ptr_level: 0)\n", var->name, rtype); + error("print_phase_basetype: Unsupported type: %s (0x%02x, ptr_level: 0)\n", + var->name, get_basic_fc(ref)); size = 0; + } } if (phase == PHASE_MARSHAL) @@ -2964,11 +3189,9 @@ void print_phase_basetype(FILE *file, int indent, const char *local_var_prefix, print_file(file, indent, "{\n"); print_file(file, indent + 1, "RpcRaiseException(RPC_X_BAD_STUB_DATA);\n"); print_file(file, indent, "}\n"); - if (pass == PASS_IN || pass == PASS_RETURN) - print_file(file, indent, ""); - else - print_file(file, indent, "*"); - fprintf(file, "%s%s", local_var_prefix, varname); + print_file(file, indent, "%s%s%s", + (pass == PASS_IN || pass == PASS_RETURN) ? "" : "*", + local_var_prefix, varname); if (pass == PASS_IN && is_ptr(type)) fprintf(file, " = ("); else @@ -3018,7 +3241,9 @@ static void write_parameter_conf_or_var_exprs(FILE *file, int indent, const char break; else if (is_attr(type->attrs, ATTR_CONTEXTHANDLE)) break; - else if (is_array(type) || is_string_type(var->attrs, type)) + else if (type_is_alias(type)) + type = type_alias_get_aliasee(type); + else if (is_array(type)) { if (is_conformance_needed_for_phase(phase) && is_array(type)) { @@ -3038,7 +3263,7 @@ static void write_parameter_conf_or_var_exprs(FILE *file, int indent, const char } break; } - else if (type->type == RPC_FC_NON_ENCAPSULATED_UNION) + else if (type_get_type(type) == TYPE_UNION) { if (is_conformance_needed_for_phase(phase)) { @@ -3048,7 +3273,7 @@ static void write_parameter_conf_or_var_exprs(FILE *file, int indent, const char } break; } - else if (type->type == RPC_FC_IP || is_void(type)) + else if (type_get_type(type) == TYPE_INTERFACE || is_void(type)) { expr_t *iid; @@ -3072,12 +3297,12 @@ static void write_remoting_arg(FILE *file, int indent, const var_t *func, const { int in_attr, out_attr, pointer_type; const type_t *type = var->type; - unsigned char rtype; - size_t start_offset = type->typestring_offset; + unsigned int start_offset = type->typestring_offset; - pointer_type = get_attrv(var->attrs, ATTR_POINTERTYPE); - if (!pointer_type) - pointer_type = RPC_FC_RP; + if (is_ptr(type) || is_array(type)) + pointer_type = get_pointer_fc(type, var->attrs, pass != PASS_RETURN); + else + pointer_type = 0; in_attr = is_attr(var->attrs, ATTR_IN); out_attr = is_attr(var->attrs, ATTR_OUT); @@ -3098,10 +3323,11 @@ static void write_remoting_arg(FILE *file, int indent, const var_t *func, const } write_parameter_conf_or_var_exprs(file, indent, local_var_prefix, phase, var); - rtype = get_struct_type(type); - if (is_context_handle(type)) + switch (typegen_detect_type(type, var->attrs, TDT_ALL_TYPES)) { + case TGT_CTXT_HANDLE: + case TGT_CTXT_HANDLE_POINTER: if (phase == PHASE_MARSHAL) { if (pass == PASS_IN) @@ -3142,29 +3368,51 @@ static void write_remoting_arg(FILE *file, int indent, const var_t *func, const print_file(file, indent + 1, "(PFORMAT_STRING)&__MIDL_TypeFormatString.Format[%d]);\n", start_offset); } } - } - else if (is_user_type(var->type)) - { + break; + case TGT_USER_TYPE: print_phase_function(file, indent, "UserMarshal", local_var_prefix, phase, var, start_offset); - } - else if (is_string_type(var->attrs, var->type)) - { - if (is_array(type) && !is_conformant_array(type)) - print_phase_function(file, indent, "NonConformantString", local_var_prefix, - phase, var, start_offset); - else + break; + case TGT_STRING: + if (phase == PHASE_FREE || pass == PASS_RETURN || + pointer_type != RPC_FC_RP) { - if (phase == PHASE_FREE || pass == PASS_RETURN || pointer_type == RPC_FC_UP) - print_phase_function(file, indent, "Pointer", local_var_prefix, phase, var, - start_offset - (is_conformant_array(type) ? 4 : 2)); - else - print_phase_function(file, indent, "ConformantString", local_var_prefix, + if (pointer_type == RPC_FC_RP && phase == PHASE_FREE && + !in_attr && is_conformant_array(type)) + { + print_file(file, indent, "if (%s%s)\n", local_var_prefix, var->name); + indent++; + print_file(file, indent, "__frame->_StubMsg.pfnFree(%s%s);\n", local_var_prefix, var->name); + } + /* strings returned are assumed to be global and hence don't + * need freeing */ + else if (is_declptr(type) && + !(phase == PHASE_FREE && pass == PASS_RETURN)) + print_phase_function(file, indent, "Pointer", local_var_prefix, phase, var, start_offset); } - } - else if (is_array(type)) + else + { + unsigned int real_start_offset = start_offset; + /* skip over pointer description straight to string description */ + if (is_declptr(type)) + { + if (is_conformant_array(type)) + real_start_offset += 4; + else + real_start_offset += 2; + } + if (is_array(type) && !is_conformant_array(type)) + print_phase_function(file, indent, "NonConformantString", + local_var_prefix, phase, var, + real_start_offset); + else + print_phase_function(file, indent, "ConformantString", local_var_prefix, + phase, var, real_start_offset); + } + break; + case TGT_ARRAY: { - unsigned char tc = get_array_type( type ); + unsigned char tc = get_array_fc(type); const char *array_type = "FixedArray"; /* We already have the size_is expression since it's at the @@ -3204,17 +3452,33 @@ static void write_remoting_arg(FILE *file, int indent, const var_t *func, const print_file(file, indent, "__frame->_StubMsg.pfnFree(%s%s);\n", local_var_prefix, var->name); } } + break; } - else if (!is_ptr(var->type) && is_base_type(rtype)) - { - if (phase != PHASE_FREE) + case TGT_BASIC: + if (phase == PHASE_MARSHAL || phase == PHASE_UNMARSHAL) print_phase_basetype(file, indent, local_var_prefix, phase, pass, var, var->name); - } - else if (!is_ptr(var->type)) - { - switch (rtype) + break; + case TGT_ENUM: + if (phase == PHASE_MARSHAL || phase == PHASE_UNMARSHAL) + { + if (phase == PHASE_MARSHAL) + print_file(file, indent, "NdrSimpleTypeMarshall(\n"); + else + print_file(file, indent, "NdrSimpleTypeUnmarshall(\n"); + print_file(file, indent+1, "&__frame->_StubMsg,\n"); + print_file(file, indent+1, "(unsigned char *)&%s%s,\n", + local_var_prefix, + var->name); + print_file(file, indent+1, "0x%02x /* %s */);\n", get_enum_fc(type), string_of_type(get_enum_fc(type))); + } + break; + case TGT_STRUCT: + switch (get_struct_fc(type)) { case RPC_FC_STRUCT: + if (phase == PHASE_MARSHAL || phase == PHASE_UNMARSHAL) + print_phase_function(file, indent, "SimpleStruct", local_var_prefix, phase, var, start_offset); + break; case RPC_FC_PSTRUCT: print_phase_function(file, indent, "SimpleStruct", local_var_prefix, phase, var, start_offset); break; @@ -3229,32 +3493,130 @@ static void write_remoting_arg(FILE *file, int indent, const var_t *func, const print_phase_function(file, indent, "ComplexStruct", local_var_prefix, phase, var, start_offset); break; default: - error("write_remoting_arguments: Unsupported type: %s (0x%02x)\n", var->name, rtype); + error("write_remoting_arguments: Unsupported type: %s (0x%02x)\n", var->name, get_struct_fc(type)); } + break; + case TGT_UNION: + { + const char *union_type = NULL; + + if (type_get_type(type) == TYPE_UNION) + union_type = "NonEncapsulatedUnion"; + else if (type_get_type(type) == TYPE_ENCAPSULATED_UNION) + union_type = "EncapsulatedUnion"; + + print_phase_function(file, indent, union_type, local_var_prefix, + phase, var, start_offset); + break; } - else + case TGT_POINTER: { const type_t *ref = type_pointer_get_ref(type); - if (type->type == RPC_FC_RP && is_base_type(ref->type)) + if (pointer_type == RPC_FC_RP && !is_user_type(ref)) switch (type_get_type(ref)) { - if (phase != PHASE_FREE) + case TYPE_BASIC: + /* base types have known sizes, so don't need a sizing pass + * and don't have any memory to free and so don't need a + * freeing pass */ + if (phase == PHASE_MARSHAL || phase == PHASE_UNMARSHAL) print_phase_basetype(file, indent, local_var_prefix, phase, pass, var, var->name); - } - else if (type->type == RPC_FC_RP && get_struct_type(ref) == RPC_FC_STRUCT && - !is_user_type(ref)) + break; + case TYPE_ENUM: + /* base types have known sizes, so don't need a sizing pass + * and don't have any memory to free and so don't need a + * freeing pass */ + if (phase == PHASE_MARSHAL || phase == PHASE_UNMARSHAL) + print_phase_function(file, indent, "Pointer", local_var_prefix, phase, var, start_offset); + break; + case TYPE_STRUCT: { - if (phase != PHASE_BUFFERSIZE && phase != PHASE_FREE) - print_phase_function(file, indent, "SimpleStruct", - local_var_prefix, phase, var, - ref->typestring_offset); + const char *struct_type = NULL; + switch (get_struct_fc(ref)) + { + case RPC_FC_STRUCT: + /* simple structs have known sizes, so don't need a sizing + * pass and don't have any memory to free and so don't + * need a freeing pass */ + if (phase == PHASE_MARSHAL || phase == PHASE_UNMARSHAL) + struct_type = "SimpleStruct"; + else if (phase == PHASE_FREE && pass == PASS_RETURN) + { + print_file(file, indent, "if (%s%s)\n", local_var_prefix, var->name); + indent++; + print_file(file, indent, "__frame->_StubMsg.pfnFree(%s%s);\n", local_var_prefix, var->name); + indent--; + } + break; + case RPC_FC_PSTRUCT: + struct_type = "SimpleStruct"; + break; + case RPC_FC_CSTRUCT: + case RPC_FC_CPSTRUCT: + struct_type = "ConformantStruct"; + break; + case RPC_FC_CVSTRUCT: + struct_type = "ConformantVaryingStruct"; + break; + case RPC_FC_BOGUS_STRUCT: + struct_type = "ComplexStruct"; + break; + default: + error("write_remoting_arguments: Unsupported type: %s (0x%02x)\n", var->name, get_struct_fc(ref)); + } + + if (struct_type) + { + if (phase == PHASE_FREE) + struct_type = "Pointer"; + else + start_offset = ref->typestring_offset; + print_phase_function(file, indent, struct_type, local_var_prefix, phase, var, start_offset); + } + break; + } + case TYPE_UNION: + case TYPE_ENCAPSULATED_UNION: + { + const char *union_type = NULL; + if (phase == PHASE_FREE) + union_type = "Pointer"; + else + { + if (type_get_type(ref) == TYPE_UNION) + union_type = "NonEncapsulatedUnion"; + else if (type_get_type(ref) == TYPE_ENCAPSULATED_UNION) + union_type = "EncapsulatedUnion"; + + start_offset = ref->typestring_offset; + } + + print_phase_function(file, indent, union_type, local_var_prefix, + phase, var, start_offset); + break; + } + case TYPE_POINTER: + case TYPE_ARRAY: + print_phase_function(file, indent, "Pointer", local_var_prefix, phase, var, start_offset); + break; + case TYPE_VOID: + case TYPE_ALIAS: + case TYPE_MODULE: + case TYPE_COCLASS: + case TYPE_FUNCTION: + case TYPE_INTERFACE: + assert(0); + break; } else - { - if (ref->type == RPC_FC_IP) - print_phase_function(file, indent, "InterfacePointer", local_var_prefix, phase, var, start_offset); - else - print_phase_function(file, indent, "Pointer", local_var_prefix, phase, var, start_offset); - } + print_phase_function(file, indent, "Pointer", local_var_prefix, phase, var, start_offset); + break; + } + case TGT_IFACE_POINTER: + print_phase_function(file, indent, "InterfacePointer", local_var_prefix, phase, var, start_offset); + break; + case TGT_INVALID: + assert(0); + break; } fprintf(file, "\n"); } @@ -3288,16 +3650,16 @@ void write_remoting_arguments(FILE *file, int indent, const var_t *func, const c } -size_t get_size_procformatstring_type(const char *name, const type_t *type, const attr_list_t *attrs) +unsigned int get_size_procformatstring_type(const char *name, const type_t *type, const attr_list_t *attrs) { return write_procformatstring_type(NULL, 0, name, type, attrs, FALSE); } -size_t get_size_procformatstring_func(const var_t *func) +unsigned int get_size_procformatstring_func(const var_t *func) { const var_t *var; - size_t size = 0; + unsigned int size = 0; /* argument list size */ if (type_get_function_args(func->type)) @@ -3313,10 +3675,10 @@ size_t get_size_procformatstring_func(const var_t *func) return size; } -size_t get_size_procformatstring(const statement_list_t *stmts, type_pred_t pred) +unsigned int get_size_procformatstring(const statement_list_t *stmts, type_pred_t pred) { const statement_t *stmt; - size_t size = 1; + unsigned int size = 1; if (stmts) LIST_FOR_EACH_ENTRY( stmt, stmts, const statement_t, entry ) { @@ -3328,7 +3690,7 @@ size_t get_size_procformatstring(const statement_list_t *stmts, type_pred_t pred size += get_size_procformatstring(stmt->u.lib->stmts, pred) - 1; continue; } - else if (stmt->type != STMT_TYPE || stmt->u.type->type != RPC_FC_IP) + else if (stmt->type != STMT_TYPE || type_get_type(stmt->u.type) != TYPE_INTERFACE) continue; iface = stmt->u.type; @@ -3345,7 +3707,7 @@ size_t get_size_procformatstring(const statement_list_t *stmts, type_pred_t pred return size; } -size_t get_size_typeformatstring(const statement_list_t *stmts, type_pred_t pred) +unsigned int get_size_typeformatstring(const statement_list_t *stmts, type_pred_t pred) { set_all_tfswrite(FALSE); return process_tfs(NULL, stmts, pred); @@ -3360,7 +3722,7 @@ void declare_stub_args( FILE *file, int indent, const var_t *func ) /* declare return value '_RetVal' */ if (!is_void(type_function_get_rettype(func->type))) { - print_file(file, indent, ""); + print_file(file, indent, "%s", ""); write_type_decl_left(file, type_function_get_rettype(func->type)); fprintf(file, " _RetVal;\n"); } @@ -3370,8 +3732,6 @@ void declare_stub_args( FILE *file, int indent, const var_t *func ) LIST_FOR_EACH_ENTRY( var, type_get_function_args(func->type), const var_t, entry ) { - int is_string = is_string_type(var->attrs, var->type); - in_attr = is_attr(var->attrs, ATTR_IN); out_attr = is_attr(var->attrs, ATTR_OUT); if (!out_attr && !in_attr) @@ -3381,22 +3741,26 @@ void declare_stub_args( FILE *file, int indent, const var_t *func ) print_file(file, indent, "NDR_SCONTEXT %s;\n", var->name); else { - if (!in_attr && !is_conformant_array(var->type) && !is_string) + if (!in_attr && !is_conformant_array(var->type)) { type_t *type_to_print; - print_file(file, indent, ""); - if (var->type->declarray) + char name[16]; + print_file(file, indent, "%s", ""); + if (type_get_type(var->type) == TYPE_ARRAY && + !type_array_is_decl_as_ptr(var->type)) type_to_print = var->type; else type_to_print = type_pointer_get_ref(var->type); - write_type_decl(file, type_to_print, "_W%u", i++); + sprintf(name, "_W%u", i++); + write_type_decl(file, type_to_print, name); fprintf(file, ";\n"); } - print_file(file, indent, ""); + print_file(file, indent, "%s", ""); write_type_decl_left(file, var->type); fprintf(file, " "); - if (var->type->declarray) { + if (type_get_type(var->type) == TYPE_ARRAY && + !type_array_is_decl_as_ptr(var->type)) { fprintf(file, "(*%s)", var->name); } else fprintf(file, "%s", var->name); @@ -3421,7 +3785,6 @@ void assign_stub_out_args( FILE *file, int indent, const var_t *func, const char LIST_FOR_EACH_ENTRY( var, type_get_function_args(func->type), const var_t, entry ) { - int is_string = is_string_type(var->attrs, var->type); in_attr = is_attr(var->attrs, ATTR_IN); out_attr = is_attr(var->attrs, ATTR_OUT); if (!out_attr && !in_attr) @@ -3456,11 +3819,28 @@ void assign_stub_out_args( FILE *file, int indent, const var_t *func, const char size = type_memsize(type, &align); fprintf(file, "%u);\n", size); } - else if (!is_string) + else { fprintf(file, " = &%s_W%u;\n", local_var_prefix, i); - if (is_ptr(var->type) && !last_ptr(var->type)) + switch (typegen_detect_type(type_pointer_get_ref(var->type), var->attrs, TDT_IGNORE_STRINGS)) + { + case TGT_BASIC: + case TGT_ENUM: + case TGT_POINTER: print_file(file, indent, "%s_W%u = 0;\n", local_var_prefix, i); + break; + case TGT_STRUCT: + case TGT_UNION: + case TGT_USER_TYPE: + case TGT_IFACE_POINTER: + case TGT_ARRAY: + case TGT_CTXT_HANDLE: + case TGT_CTXT_HANDLE_POINTER: + case TGT_INVALID: + case TGT_STRING: + /* not initialised */ + break; + } i++; } @@ -3685,8 +4065,11 @@ void write_exceptions( FILE *file ) fprintf( file, "\n"); fprintf( file, "#else /* USE_COMPILER_EXCEPTIONS */\n"); fprintf( file, "\n"); - fprintf( file, "#define RpcExceptionInit(filter_func,finally_func) do {} while(0)\n"); - fprintf( file, "#define __DECL_EXCEPTION_FRAME\n"); + fprintf( file, "#define RpcExceptionInit(filter_func,finally_func) \\\n"); + fprintf( file, " do { (void)(filter_func); } while(0)\n"); + fprintf( file, "\n"); + fprintf( file, "#define __DECL_EXCEPTION_FRAME \\\n"); + fprintf( file, " DWORD code;\n"); fprintf( file, "\n"); fprintf( file, "#endif /* USE_COMPILER_EXCEPTIONS */\n"); } diff --git a/reactos/tools/widl/typegen.h b/reactos/tools/widl/typegen.h index b2c48df1993..8c8ba11da64 100644 --- a/reactos/tools/widl/typegen.h +++ b/reactos/tools/widl/typegen.h @@ -36,6 +36,28 @@ enum remoting_phase PHASE_FREE }; +enum typegen_detect_flags +{ + TDT_ALL_TYPES = 1 << 0, + TDT_IGNORE_STRINGS = 1 << 1, +}; + +enum typegen_type +{ + TGT_INVALID, + TGT_USER_TYPE, + TGT_CTXT_HANDLE, + TGT_CTXT_HANDLE_POINTER, + TGT_STRING, + TGT_POINTER, + TGT_ARRAY, + TGT_IFACE_POINTER, + TGT_BASIC, + TGT_ENUM, + TGT_STRUCT, + TGT_UNION, +}; + typedef int (*type_pred_t)(const type_t *); void write_formatstringsdecl(FILE *f, int indent, const statement_list_t *stmts, type_pred_t pred); @@ -45,10 +67,10 @@ void print_phase_basetype(FILE *file, int indent, const char *local_var_prefix, enum pass pass, const var_t *var, const char *varname); void write_remoting_arguments(FILE *file, int indent, const var_t *func, const char *local_var_prefix, enum pass pass, enum remoting_phase phase); -size_t get_size_procformatstring_type(const char *name, const type_t *type, const attr_list_t *attrs); -size_t get_size_procformatstring_func(const var_t *func); -size_t get_size_procformatstring(const statement_list_t *stmts, type_pred_t pred); -size_t get_size_typeformatstring(const statement_list_t *stmts, type_pred_t pred); +unsigned int get_size_procformatstring_type(const char *name, const type_t *type, const attr_list_t *attrs); +unsigned int get_size_procformatstring_func(const var_t *func); +unsigned int get_size_procformatstring(const statement_list_t *stmts, type_pred_t pred); +unsigned int get_size_typeformatstring(const statement_list_t *stmts, type_pred_t pred); void assign_stub_out_args( FILE *file, int indent, const var_t *func, const char *local_var_prefix ); void declare_stub_args( FILE *file, int indent, const var_t *func ); int write_expr_eval_routines(FILE *file, const char *iface); @@ -56,7 +78,7 @@ void write_expr_eval_routine_list(FILE *file, const char *iface); void write_user_quad_list(FILE *file); void write_endpoints( FILE *f, const char *prefix, const str_list_t *list ); void write_exceptions( FILE *file ); -size_t type_memsize(const type_t *t, unsigned int *align); +unsigned int type_memsize(const type_t *t, unsigned int *align); int decl_indirect(const type_t *t); void write_parameters_init(FILE *file, int indent, const var_t *func, const char *local_var_prefix); void print(FILE *file, int indent, const char *format, va_list ap); @@ -66,3 +88,7 @@ expr_t *get_size_is_expr(const type_t *t, const char *name); int is_full_pointer_function(const var_t *func); void write_full_pointer_init(FILE *file, int indent, const var_t *func, int is_server); void write_full_pointer_free(FILE *file, int indent, const var_t *func); +unsigned char get_basic_fc(const type_t *type); +unsigned char get_pointer_fc(const type_t *type, const attr_list_t *attrs, int toplevel_param); +unsigned char get_struct_fc(const type_t *type); +enum typegen_type typegen_detect_type(const type_t *type, const attr_list_t *attrs, unsigned int flags); diff --git a/reactos/tools/widl/typelib.c b/reactos/tools/widl/typelib.c index 08a8ee253dd..a27202f7173 100644 --- a/reactos/tools/widl/typelib.c +++ b/reactos/tools/widl/typelib.c @@ -108,17 +108,20 @@ static unsigned short builtin_vt(const type_t *t) } if (is_string_type (t->attrs, t)) { - unsigned char fc; + const type_t *elem_type; if (is_array(t)) - fc = type_array_get_element(t)->type; + elem_type = type_array_get_element(t); else - fc = type_pointer_get_ref(t)->type; - switch (fc) + elem_type = type_pointer_get_ref(t); + if (type_get_type(elem_type) == TYPE_BASIC) + { + switch (type_basic_get_type(elem_type)) { - case RPC_FC_CHAR: return VT_LPSTR; - case RPC_FC_WCHAR: return VT_LPWSTR; + case TYPE_BASIC_CHAR: return VT_LPSTR; + case TYPE_BASIC_WCHAR: return VT_LPWSTR; default: break; } + } } return 0; } @@ -142,74 +145,89 @@ unsigned short get_type_vt(type_t *t) if (type_is_alias(t) && is_attr(t->attrs, ATTR_PUBLIC)) return VT_USERDEFINED; - switch (t->type) { - case RPC_FC_BYTE: - case RPC_FC_USMALL: - return VT_UI1; - case RPC_FC_CHAR: - case RPC_FC_SMALL: - return VT_I1; - case RPC_FC_WCHAR: - return VT_I2; /* mktyplib seems to parse wchar_t as short */ - case RPC_FC_SHORT: - return VT_I2; - case RPC_FC_USHORT: - return VT_UI2; - case RPC_FC_LONG: - if (match(t->name, "int")) return VT_INT; - return VT_I4; - case RPC_FC_ULONG: - if (match(t->name, "int")) return VT_UINT; - return VT_UI4; - case RPC_FC_HYPER: - if (t->sign < 0) return VT_UI8; - if (match(t->name, "MIDL_uhyper")) return VT_UI8; - return VT_I8; - case RPC_FC_FLOAT: - return VT_R4; - case RPC_FC_DOUBLE: - return VT_R8; - case RPC_FC_RP: - case RPC_FC_UP: - case RPC_FC_OP: - case RPC_FC_FP: - case RPC_FC_SMFARRAY: - case RPC_FC_LGFARRAY: - case RPC_FC_SMVARRAY: - case RPC_FC_LGVARRAY: - case RPC_FC_CARRAY: - case RPC_FC_CVARRAY: - case RPC_FC_BOGUS_ARRAY: - if(t->ref) - { - if (match(t->ref->name, "SAFEARRAY")) - return VT_SAFEARRAY; - return VT_PTR; + switch (type_get_type(t)) { + case TYPE_BASIC: + switch (type_basic_get_type(t)) { + case TYPE_BASIC_BYTE: + return VT_UI1; + case TYPE_BASIC_CHAR: + case TYPE_BASIC_INT8: + if (type_basic_get_sign(t) > 0) + return VT_UI1; + else + return VT_I1; + case TYPE_BASIC_WCHAR: + return VT_I2; /* mktyplib seems to parse wchar_t as short */ + case TYPE_BASIC_INT16: + if (type_basic_get_sign(t) > 0) + return VT_UI2; + else + return VT_I2; + case TYPE_BASIC_INT: + if (type_basic_get_sign(t) > 0) + return VT_UINT; + else + return VT_INT; + case TYPE_BASIC_INT32: + case TYPE_BASIC_ERROR_STATUS_T: + if (type_basic_get_sign(t) > 0) + return VT_UI4; + else + return VT_I4; + case TYPE_BASIC_INT64: + case TYPE_BASIC_HYPER: + if (type_basic_get_sign(t) > 0) + return VT_UI8; + else + return VT_I8; + case TYPE_BASIC_FLOAT: + return VT_R4; + case TYPE_BASIC_DOUBLE: + return VT_R8; + case TYPE_BASIC_HANDLE: + error("handles can't be used in typelibs\n"); } - - error("get_type_vt: unknown-deref-type: %d\n", t->ref->type); break; - case RPC_FC_IP: + + case TYPE_POINTER: + return VT_PTR; + + case TYPE_ARRAY: + if (type_array_is_decl_as_ptr(t)) + { + if (match(type_array_get_element(t)->name, "SAFEARRAY")) + return VT_SAFEARRAY; + } + else + error("get_type_vt: array types not supported\n"); + return VT_PTR; + + case TYPE_INTERFACE: if(match(t->name, "IUnknown")) return VT_UNKNOWN; if(match(t->name, "IDispatch")) return VT_DISPATCH; return VT_USERDEFINED; - case RPC_FC_ENUM16: - case RPC_FC_STRUCT: - case RPC_FC_PSTRUCT: - case RPC_FC_CSTRUCT: - case RPC_FC_CPSTRUCT: - case RPC_FC_CVSTRUCT: - case RPC_FC_BOGUS_STRUCT: - case RPC_FC_COCLASS: - case RPC_FC_MODULE: + case TYPE_ENUM: + case TYPE_STRUCT: + case TYPE_COCLASS: + case TYPE_MODULE: + case TYPE_UNION: + case TYPE_ENCAPSULATED_UNION: return VT_USERDEFINED; - case 0: + + case TYPE_VOID: return VT_VOID; - default: - error("get_type_vt: unknown type: 0x%02x\n", t->type); + + case TYPE_ALIAS: + /* aliases should be filtered out by the type_get_type call above */ + assert(0); + break; + + case TYPE_FUNCTION: + error("get_type_vt: functions not supported\n"); + break; } return 0; } diff --git a/reactos/tools/widl/typetree.c b/reactos/tools/widl/typetree.c index 5591ce6de21..4359d924ba0 100644 --- a/reactos/tools/widl/typetree.c +++ b/reactos/tools/widl/typetree.c @@ -22,6 +22,7 @@ #include #include +#include #include "widl.h" #include "utils.h" @@ -40,18 +41,42 @@ type_t *duptype(type_t *t, int dupname) return d; } +type_t *make_type(enum type_type type) +{ + type_t *t = alloc_type(); + t->name = NULL; + t->type_type = type; + t->attrs = NULL; + t->orig = NULL; + memset(&t->details, 0, sizeof(t->details)); + t->typestring_offset = 0; + t->ptrdesc = 0; + t->ignore = (parse_only != 0); + t->defined = FALSE; + t->written = FALSE; + t->user_types_registered = FALSE; + t->tfswrite = FALSE; + t->checked = FALSE; + t->is_alias = FALSE; + t->typelib_idx = -1; + init_loc_info(&t->loc_info); + return t; +} + type_t *type_new_function(var_list_t *args) { - type_t *t = make_type(RPC_FC_FUNCTION, NULL); + type_t *t = make_type(TYPE_FUNCTION); t->details.function = xmalloc(sizeof(*t->details.function)); t->details.function->args = args; t->details.function->idx = -1; return t; } -type_t *type_new_pointer(type_t *ref, attr_list_t *attrs) +type_t *type_new_pointer(unsigned char pointer_default, type_t *ref, attr_list_t *attrs) { - type_t *t = make_type(pointer_default, ref); + type_t *t = make_type(TYPE_POINTER); + t->details.pointer.def_fc = pointer_default; + t->details.pointer.ref = ref; t->attrs = attrs; return t; } @@ -62,9 +87,10 @@ type_t *type_new_alias(type_t *t, const char *name) a->name = xstrdup(name); a->attrs = NULL; - a->declarray = FALSE; a->orig = t; a->is_alias = TRUE; + /* for pointer types */ + a->details = t->details; init_loc_info(&a->loc_info); return a; @@ -72,23 +98,153 @@ type_t *type_new_alias(type_t *t, const char *name) type_t *type_new_module(char *name) { - type_t *type = make_type(RPC_FC_MODULE, NULL); + type_t *type = get_type(TYPE_MODULE, name, 0); + if (type->type_type != TYPE_MODULE || type->defined) + error_loc("%s: redefinition error; original definition was at %s:%d\n", + type->name, type->loc_info.input_name, type->loc_info.line_number); type->name = name; - /* FIXME: register type to detect multiple definitions */ return type; } -type_t *type_new_array(const char *name, type_t *element, int declarray, - unsigned long dim, expr_t *size_is, expr_t *length_is) +type_t *type_new_coclass(char *name) { - type_t *t = make_type(RPC_FC_LGFARRAY, element); + type_t *type = get_type(TYPE_COCLASS, name, 0); + if (type->type_type != TYPE_COCLASS || type->defined) + error_loc("%s: redefinition error; original definition was at %s:%d\n", + type->name, type->loc_info.input_name, type->loc_info.line_number); + type->name = name; + return type; +} + + +type_t *type_new_array(const char *name, type_t *element, int declptr, + unsigned int dim, expr_t *size_is, expr_t *length_is, + unsigned char ptr_default_fc) +{ + type_t *t = make_type(TYPE_ARRAY); if (name) t->name = xstrdup(name); - t->declarray = declarray; + t->details.array.declptr = declptr; t->details.array.length_is = length_is; if (size_is) t->details.array.size_is = size_is; else t->details.array.dim = dim; + t->details.array.elem = element; + t->details.array.ptr_def_fc = ptr_default_fc; + return t; +} + +type_t *type_new_basic(enum type_basic_type basic_type) +{ + type_t *t = make_type(TYPE_BASIC); + t->details.basic.type = basic_type; + t->details.basic.sign = 0; + return t; +} + +type_t *type_new_int(enum type_basic_type basic_type, int sign) +{ + static type_t *int_types[TYPE_BASIC_INT_MAX+1][3]; + + assert(basic_type <= TYPE_BASIC_INT_MAX); + + /* map sign { -1, 0, 1 } -> { 0, 1, 2 } */ + if (!int_types[basic_type][sign + 1]) + { + int_types[basic_type][sign + 1] = type_new_basic(basic_type); + int_types[basic_type][sign + 1]->details.basic.sign = sign; + } + return int_types[basic_type][sign + 1]; +} + +type_t *type_new_void(void) +{ + static type_t *void_type = NULL; + if (!void_type) + void_type = make_type(TYPE_VOID); + return void_type; +} + +type_t *type_new_enum(const char *name, int defined, var_list_t *enums) +{ + type_t *tag_type = name ? find_type(name, tsENUM) : NULL; + type_t *t = make_type(TYPE_ENUM); + t->name = name; + + if (tag_type && tag_type->details.enumeration) + t->details.enumeration = tag_type->details.enumeration; + else if (defined) + { + t->details.enumeration = xmalloc(sizeof(*t->details.enumeration)); + t->details.enumeration->enums = enums; + t->defined = TRUE; + } + + if (name) + { + if (defined) + reg_type(t, name, tsENUM); + else + add_incomplete(t); + } + return t; +} + +type_t *type_new_struct(char *name, int defined, var_list_t *fields) +{ + type_t *tag_type = name ? find_type(name, tsSTRUCT) : NULL; + type_t *t = make_type(TYPE_STRUCT); + t->name = name; + if (tag_type && tag_type->details.structure) + t->details.structure = tag_type->details.structure; + else if (defined) + { + t->details.structure = xmalloc(sizeof(*t->details.structure)); + t->details.structure->fields = fields; + t->defined = TRUE; + } + if (name) + { + if (defined) + reg_type(t, name, tsSTRUCT); + else + add_incomplete(t); + } + return t; +} + +type_t *type_new_nonencapsulated_union(const char *name, int defined, var_list_t *fields) +{ + type_t *tag_type = name ? find_type(name, tsUNION) : NULL; + type_t *t = make_type(TYPE_UNION); + t->name = name; + if (tag_type && tag_type->details.structure) + t->details.structure = tag_type->details.structure; + else if (defined) + { + t->details.structure = xmalloc(sizeof(*t->details.structure)); + t->details.structure->fields = fields; + t->defined = TRUE; + } + if (name) + { + if (defined) + reg_type(t, name, tsUNION); + else + add_incomplete(t); + } + return t; +} + +type_t *type_new_encapsulated_union(char *name, var_t *switch_field, var_t *union_field, var_list_t *cases) +{ + type_t *t = get_type(TYPE_ENCAPSULATED_UNION, name, tsUNION); + if (!union_field) union_field = make_var( xstrdup("tagged_union") ); + union_field->type = type_new_nonencapsulated_union(NULL, TRUE, cases); + t->details.structure = xmalloc(sizeof(*t->details.structure)); + t->details.structure->fields = append_var( NULL, switch_field ); + t->details.structure->fields = append_var( t->details.structure->fields, union_field ); + t->defined = TRUE; return t; } @@ -117,23 +273,23 @@ static int compute_method_indexes(type_t *iface) void type_interface_define(type_t *iface, type_t *inherit, statement_list_t *stmts) { - iface->ref = inherit; iface->details.iface = xmalloc(sizeof(*iface->details.iface)); iface->details.iface->disp_props = NULL; iface->details.iface->disp_methods = NULL; iface->details.iface->stmts = stmts; + iface->details.iface->inherit = inherit; iface->defined = TRUE; compute_method_indexes(iface); } void type_dispinterface_define(type_t *iface, var_list_t *props, func_list_t *methods) { - iface->ref = find_type("IDispatch", 0); - if (!iface->ref) error_loc("IDispatch is undefined\n"); iface->details.iface = xmalloc(sizeof(*iface->details.iface)); iface->details.iface->disp_props = props; iface->details.iface->disp_methods = methods; iface->details.iface->stmts = NULL; + iface->details.iface->inherit = find_type("IDispatch", 0); + if (!iface->details.iface->inherit) error_loc("IDispatch is undefined\n"); iface->defined = TRUE; compute_method_indexes(iface); } @@ -158,3 +314,18 @@ type_t *type_coclass_define(type_t *coclass, ifref_list_t *ifaces) coclass->defined = TRUE; return coclass; } + +int type_is_equal(const type_t *type1, const type_t *type2) +{ + if (type_get_type_detect_alias(type1) != type_get_type_detect_alias(type2)) + return FALSE; + + if (type1->name && type2->name) + return !strcmp(type1->name, type2->name); + else if ((!type1->name && type2->name) || (type1->name && !type2->name)) + return FALSE; + + /* FIXME: do deep inspection of types to determine if they are equal */ + + return FALSE; +} diff --git a/reactos/tools/widl/typetree.h b/reactos/tools/widl/typetree.h index cf018521af2..fb0401b87a6 100644 --- a/reactos/tools/widl/typetree.h +++ b/reactos/tools/widl/typetree.h @@ -25,16 +25,26 @@ #define WIDL_TYPE_TREE_H type_t *type_new_function(var_list_t *args); -type_t *type_new_pointer(type_t *ref, attr_list_t *attrs); +type_t *type_new_pointer(unsigned char pointer_default, type_t *ref, attr_list_t *attrs); type_t *type_new_alias(type_t *t, const char *name); type_t *type_new_module(char *name); -type_t *type_new_array(const char *name, type_t *element, int declarray, - unsigned long dim, expr_t *size_is, expr_t *length_is); +type_t *type_new_array(const char *name, type_t *element, int declptr, + unsigned int dim, expr_t *size_is, expr_t *length_is, + unsigned char ptr_default_fc); +type_t *type_new_basic(enum type_basic_type basic_type); +type_t *type_new_int(enum type_basic_type basic_type, int sign); +type_t *type_new_void(void); +type_t *type_new_coclass(char *name); +type_t *type_new_enum(const char *name, int defined, var_list_t *enums); +type_t *type_new_struct(char *name, int defined, var_list_t *fields); +type_t *type_new_nonencapsulated_union(const char *name, int defined, var_list_t *fields); +type_t *type_new_encapsulated_union(char *name, var_t *switch_field, var_t *union_field, var_list_t *cases); void type_interface_define(type_t *iface, type_t *inherit, statement_list_t *stmts); void type_dispinterface_define(type_t *iface, var_list_t *props, func_list_t *methods); void type_dispinterface_define_from_iface(type_t *dispiface, type_t *iface); void type_module_define(type_t *module, statement_list_t *stmts); type_t *type_coclass_define(type_t *coclass, ifref_list_t *ifaces); +int type_is_equal(const type_t *type1, const type_t *type2); /* FIXME: shouldn't need to export this */ type_t *duptype(type_t *t, int dupname); @@ -53,11 +63,18 @@ static inline enum type_type type_get_type(const type_t *type) return type_get_type_detect_alias(type_get_real_type(type)); } -static inline unsigned char type_basic_get_fc(const type_t *type) +static inline enum type_basic_type type_basic_get_type(const type_t *type) { type = type_get_real_type(type); assert(type_get_type(type) == TYPE_BASIC); - return type->type; + return type->details.basic.type; +} + +static inline int type_basic_get_sign(const type_t *type) +{ + type = type_get_real_type(type); + assert(type_get_type(type) == TYPE_BASIC); + return type->details.basic.sign; } static inline var_list_t *type_struct_get_fields(const type_t *type) @@ -78,7 +95,7 @@ static inline type_t *type_function_get_rettype(const type_t *type) { type = type_get_real_type(type); assert(type_get_type(type) == TYPE_FUNCTION); - return type->ref; + return type->details.function->rettype; } static inline var_list_t *type_enum_get_values(const type_t *type) @@ -130,7 +147,7 @@ static inline type_t *type_iface_get_inherit(const type_t *type) { type = type_get_real_type(type); assert(type_get_type(type) == TYPE_INTERFACE); - return type->ref; + return type->details.iface->inherit; } static inline var_list_t *type_dispiface_get_props(const type_t *type) @@ -192,7 +209,7 @@ static inline int type_array_has_variance(const type_t *type) return (type->details.array.length_is != NULL); } -static inline unsigned long type_array_get_dim(const type_t *type) +static inline unsigned int type_array_get_dim(const type_t *type) { type = type_get_real_type(type); assert(type_get_type(type) == TYPE_ARRAY); @@ -217,7 +234,21 @@ static inline type_t *type_array_get_element(const type_t *type) { type = type_get_real_type(type); assert(type_get_type(type) == TYPE_ARRAY); - return type->ref; + return type->details.array.elem; +} + +static inline int type_array_is_decl_as_ptr(const type_t *type) +{ + type = type_get_real_type(type); + assert(type_get_type(type) == TYPE_ARRAY); + return type->details.array.declptr; +} + +static inline unsigned char type_array_get_ptr_default_fc(const type_t *type) +{ + type = type_get_real_type(type); + assert(type_get_type(type) == TYPE_ARRAY); + return type->details.array.ptr_def_fc; } static inline int type_is_alias(const type_t *type) @@ -242,7 +273,14 @@ static inline type_t *type_pointer_get_ref(const type_t *type) { type = type_get_real_type(type); assert(type_get_type(type) == TYPE_POINTER); - return type->ref; + return type->details.pointer.ref; +} + +static inline unsigned char type_pointer_get_default_fc(const type_t *type) +{ + type = type_get_real_type(type); + assert(type_get_type(type) == TYPE_POINTER); + return type->details.pointer.def_fc; } #endif /* WIDL_TYPE_TREE_H */ diff --git a/reactos/tools/widl/widl.c b/reactos/tools/widl/widl.c index ab1572611b3..98e7a510fed 100644 --- a/reactos/tools/widl/widl.c +++ b/reactos/tools/widl/widl.c @@ -53,33 +53,35 @@ static const char usage[] = "Usage: widl [options...] infile.idl\n" " or: widl [options...] --dlldata-only name1 [name2...]\n" -" -c Generate client stub\n" -" -C file Name of client stub file (default is infile_c.c)\n" -" -d n Set debug level to 'n'\n" -" -D id[=val] Define preprocessor identifier id=val\n" -" --dlldata=file Name of the dlldata file (default is dlldata.c)\n" -" -E Preprocess only\n" -" -h Generate headers\n" -" -H file Name of header file (default is infile.h)\n" -" -I path Set include search dir to path (multiple -I allowed)\n" -" --local-stubs=file Write empty stubs for call_as/local methods to file\n" -" -N Do not preprocess input\n" -" --oldnames Use old naming conventions\n" -" -p Generate proxy\n" -" -P file Name of proxy file (default is infile_p.c)\n" -" --prefix-all=p Prefix names of client stubs / server functions with 'p'\n" +" -b arch Set the target architecture\n" +" -c Generate client stub\n" +" -C file Name of client stub file (default is infile_c.c)\n" +" -d n Set debug level to 'n'\n" +" -D id[=val] Define preprocessor identifier id=val\n" +" --dlldata=file Name of the dlldata file (default is dlldata.c)\n" +" -E Preprocess only\n" +" -h Generate headers\n" +" -H file Name of header file (default is infile.h)\n" +" -I path Set include search dir to path (multiple -I allowed)\n" +" --local-stubs=file Write empty stubs for call_as/local methods to file\n" +" -m32, -m64 Set the kind of typelib to build (Win32 or Win64)\n" +" -N Do not preprocess input\n" +" --oldnames Use old naming conventions\n" +" -p Generate proxy\n" +" -P file Name of proxy file (default is infile_p.c)\n" +" --prefix-all=p Prefix names of client stubs / server functions with 'p'\n" " --prefix-client=p Prefix names of client stubs with 'p'\n" " --prefix-server=p Prefix names of server functions with 'p'\n" -" -s Generate server stub\n" -" -S file Name of server stub file (default is infile_s.c)\n" -" -t Generate typelib\n" -" -T file Name of typelib file (default is infile.tlb)\n" -" -u Generate interface identifiers file\n" -" -U file Name of interface identifiers file (default is infile_i.c)\n" -" -V Print version and exit\n" -" -W Enable pedantic warnings\n" -" --win32 Only generate 32-bit code\n" -" --win64 Only generate 64-bit code\n" +" -s Generate server stub\n" +" -S file Name of server stub file (default is infile_s.c)\n" +" -t Generate typelib\n" +" -T file Name of typelib file (default is infile.tlb)\n" +" -u Generate interface identifiers file\n" +" -U file Name of interface identifiers file (default is infile_i.c)\n" +" -V Print version and exit\n" +" -W Enable pedantic warnings\n" +" --win32 Only generate 32-bit code\n" +" --win64 Only generate 64-bit code\n" "Debug level 'n' is a bitmask with following meaning:\n" " * 0x01 Tell which resource is parsed (verbose mode)\n" " * 0x02 Dump internal structures\n" @@ -92,7 +94,6 @@ static const char usage[] = static const char version_string[] = "Wine IDL Compiler version " PACKAGE_VERSION "\n" "Copyright 2002 Ove Kaaven\n"; -int win32 = 1; int debuglevel = DEBUGLEVEL_NONE; int parser_debug, yy_flex_debug; @@ -135,6 +136,7 @@ FILE *header; FILE *idfile; size_t pointer_size = 0; +syskind_t typelib_kind = sizeof(void*) == 8 ? SYS_WIN64 : SYS_WIN32; time_t now; @@ -151,7 +153,7 @@ enum { }; static const char short_options[] = - "cC:d:D:EhH:I:NpP:sS:tT:uU:VW"; + "b:cC:d:D:EhH:I:m:NpP:sS:tT:uU:VW"; static const struct option long_options[] = { { "dlldata", 1, 0, DLLDATA_OPTION }, { "dlldata-only", 0, 0, DLLDATA_ONLY_OPTION }, @@ -196,6 +198,75 @@ static char *dup_basename_token(const char *name, const char *ext) return ret; } +static void add_widl_version_define(void) +{ + unsigned int version; + const char *p = PACKAGE_VERSION; + + /* major */ + version = atoi(p) * 0x10000; + p = strchr(p, '.'); + + /* minor */ + if (p) + { + version += atoi(p + 1) * 0x100; + p = strchr(p + 1, '.'); + } + + /* build */ + if (p) + version += atoi(p + 1); + + if (version != 0) + { + char version_str[11]; + snprintf(version_str, sizeof(version_str), "0x%x", version); + wpp_add_define("__WIDL__", version_str); + } + else + wpp_add_define("__WIDL__", NULL); +} + +/* set the target platform */ +static void set_target( const char *target ) +{ + static const struct + { + const char *name; + syskind_t kind; + } cpu_names[] = + { + { "i386", SYS_WIN32 }, + { "i486", SYS_WIN32 }, + { "i586", SYS_WIN32 }, + { "i686", SYS_WIN32 }, + { "i786", SYS_WIN32 }, + { "x86_64", SYS_WIN64 }, + { "sparc", SYS_WIN32 }, + { "alpha", SYS_WIN32 }, + { "powerpc", SYS_WIN32 } + }; + + unsigned int i; + char *p, *spec = xstrdup( target ); + + /* target specification is in the form CPU-MANUFACTURER-OS or CPU-MANUFACTURER-KERNEL-OS */ + + if (!(p = strchr( spec, '-' ))) error( "Invalid target specification '%s'\n", target ); + *p++ = 0; + for (i = 0; i < sizeof(cpu_names)/sizeof(cpu_names[0]); i++) + { + if (!strcmp( cpu_names[i].name, spec )) + { + typelib_kind = cpu_names[i].kind; + free( spec ); + return; + } + } + error( "Unrecognized CPU '%s'\n", spec ); +} + /* clean things up when aborting on a signal */ static void exit_on_signal( int sig ) { @@ -349,7 +420,7 @@ static void write_id_data_stmts(const statement_list_t *stmts) if (stmt->type == STMT_TYPE) { const type_t *type = stmt->u.type; - if (type->type == RPC_FC_IP) + if (type_get_type(type) == TYPE_INTERFACE) { const UUID *uuid; if (!is_object(type->attrs) && !is_attr(type->attrs, ATTR_DISPINTERFACE)) @@ -358,7 +429,7 @@ static void write_id_data_stmts(const statement_list_t *stmts) write_guid(idfile, is_attr(type->attrs, ATTR_DISPINTERFACE) ? "DIID" : "IID", type->name, uuid); } - else if (type->type == RPC_FC_COCLASS) + else if (type_get_type(type) == TYPE_COCLASS) { const UUID *uuid = get_attrp(type->attrs, ATTR_UUID); write_guid(idfile, "CLSID", type->name, uuid); @@ -450,6 +521,9 @@ int main(int argc,char *argv[]) do_win32 = 0; do_win64 = 1; break; + case 'b': + set_target( optarg ); + break; case 'c': do_everything = 0; do_client = 1; @@ -477,6 +551,11 @@ int main(int argc,char *argv[]) case 'I': wpp_add_include_path(optarg); break; + case 'm': + if (!strcmp( optarg, "32" )) typelib_kind = SYS_WIN32; + else if (!strcmp( optarg, "64" )) typelib_kind = SYS_WIN64; + else error( "Invalid -m argument '%s'\n", optarg ); + break; case 'N': no_preprocess = 1; break; @@ -596,7 +675,7 @@ int main(int argc,char *argv[]) if (do_client) client_token = dup_basename_token(client_name,"_c.c"); if (do_server) server_token = dup_basename_token(server_name,"_s.c"); - wpp_add_cmdline_define("__WIDL__"); + add_widl_version_define(); atexit(rm_tempfile); if (!no_preprocess) diff --git a/reactos/tools/widl/widl.h b/reactos/tools/widl/widl.h index d8c945ff524..e34e64bc7dd 100644 --- a/reactos/tools/widl/widl.h +++ b/reactos/tools/widl/widl.h @@ -34,7 +34,6 @@ extern int debuglevel; #define DEBUGLEVEL_PPLEX 0x0010 #define DEBUGLEVEL_PPTRACE 0x0020 -extern int win32; extern int pedantic; extern int do_everything; extern int do_header; diff --git a/reactos/tools/widl/widltypes.h b/reactos/tools/widl/widltypes.h index 85a3ad30ca7..70c5d25a91c 100644 --- a/reactos/tools/widl/widltypes.h +++ b/reactos/tools/widl/widltypes.h @@ -230,6 +230,27 @@ enum statement_type STMT_CPPQUOTE }; +enum type_basic_type +{ + TYPE_BASIC_INT8 = 1, + TYPE_BASIC_INT16, + TYPE_BASIC_INT32, + TYPE_BASIC_INT64, + TYPE_BASIC_INT, + TYPE_BASIC_CHAR, + TYPE_BASIC_HYPER, + TYPE_BASIC_BYTE, + TYPE_BASIC_WCHAR, + TYPE_BASIC_FLOAT, + TYPE_BASIC_DOUBLE, + TYPE_BASIC_ERROR_STATUS_T, + TYPE_BASIC_HANDLE, +}; + +#define TYPE_BASIC_MAX TYPE_BASIC_HANDLE +#define TYPE_BASIC_INT_MIN TYPE_BASIC_INT8 +#define TYPE_BASIC_INT_MAX TYPE_BASIC_HYPER + struct _loc_info_t { const char *input_name; @@ -283,6 +304,7 @@ struct enumeration_details struct func_details { var_list_t *args; + struct _type_t *rettype; int idx; }; @@ -291,6 +313,7 @@ struct iface_details statement_list_t *stmts; func_list_t *disp_methods; var_list_t *disp_props; + struct _type_t *inherit; }; struct module_details @@ -301,8 +324,12 @@ struct module_details struct array_details { - unsigned long dim; - expr_t *size_is, *length_is; + expr_t *size_is; + expr_t *length_is; + struct _type_t *elem; + unsigned int dim; + unsigned char ptr_def_fc; + unsigned char declptr; /* if declared as a pointer */ }; struct coclass_details @@ -310,6 +337,18 @@ struct coclass_details ifref_list_t *ifaces; }; +struct basic_details +{ + enum type_basic_type type; + int sign; +}; + +struct pointer_details +{ + struct _type_t *ref; + unsigned char def_fc; +}; + enum type_type { TYPE_VOID, @@ -329,8 +368,7 @@ enum type_type struct _type_t { const char *name; - unsigned char type; - struct _type_t *ref; + enum type_type type_type; attr_list_t *attrs; union { @@ -341,13 +379,14 @@ struct _type_t { struct module_details *module; struct array_details array; struct coclass_details coclass; + struct basic_details basic; + struct pointer_details pointer; } details; type_t *orig; /* dup'd types */ unsigned int typestring_offset; unsigned int ptrdesc; /* used for complex structs */ int typelib_idx; loc_info_t loc_info; - unsigned int declarray : 1; /* if declared as an array */ unsigned int ignore : 1; unsigned int defined : 1; unsigned int written : 1; @@ -355,7 +394,6 @@ struct _type_t { unsigned int tfswrite : 1; /* if the type needs to be written to the TFS */ unsigned int checked : 1; unsigned int is_alias : 1; /* is the type an alias? */ - int sign : 2; }; struct _var_t { @@ -458,8 +496,14 @@ struct _statement_t { } u; }; -extern unsigned char pointer_default; +typedef enum { + SYS_WIN16, + SYS_WIN32, + SYS_MAC, + SYS_WIN64 +} syskind_t; +extern syskind_t typelib_kind; extern user_type_list_t user_type_list; void check_for_additional_prototype_types(const var_list_t *list); @@ -475,9 +519,19 @@ int cant_be_null(const var_t *v); int is_struct(unsigned char tc); int is_union(unsigned char tc); +#define tsENUM 1 +#define tsSTRUCT 2 +#define tsUNION 3 + var_t *find_const(const char *name, int f); type_t *find_type(const char *name, int t); -type_t *make_type(unsigned char type, type_t *ref); +type_t *make_type(enum type_type type); +type_t *get_type(enum type_type type, char *name, int t); +type_t *reg_type(type_t *type, const char *name, int t); +void add_incomplete(type_t *t); + +var_t *make_var(char *name); +var_list_t *append_var(var_list_t *list, var_t *var); void init_loc_info(loc_info_t *); @@ -490,65 +544,7 @@ static inline enum type_type type_get_type_detect_alias(const type_t *type) { if (type->is_alias) return TYPE_ALIAS; - switch (type->type) - { - case 0: - return TYPE_VOID; - case RPC_FC_BYTE: - case RPC_FC_CHAR: - case RPC_FC_USMALL: - case RPC_FC_SMALL: - case RPC_FC_WCHAR: - case RPC_FC_USHORT: - case RPC_FC_SHORT: - case RPC_FC_ULONG: - case RPC_FC_LONG: - case RPC_FC_HYPER: - case RPC_FC_IGNORE: - case RPC_FC_FLOAT: - case RPC_FC_DOUBLE: - case RPC_FC_ERROR_STATUS_T: - case RPC_FC_BIND_PRIMITIVE: - return TYPE_BASIC; - case RPC_FC_ENUM16: - case RPC_FC_ENUM32: - return TYPE_ENUM; - case RPC_FC_RP: - case RPC_FC_UP: - case RPC_FC_FP: - case RPC_FC_OP: - return TYPE_POINTER; - case RPC_FC_STRUCT: - case RPC_FC_PSTRUCT: - case RPC_FC_CSTRUCT: - case RPC_FC_CPSTRUCT: - case RPC_FC_CVSTRUCT: - case RPC_FC_BOGUS_STRUCT: - return TYPE_STRUCT; - case RPC_FC_ENCAPSULATED_UNION: - return TYPE_ENCAPSULATED_UNION; - case RPC_FC_NON_ENCAPSULATED_UNION: - return TYPE_UNION; - case RPC_FC_SMFARRAY: - case RPC_FC_LGFARRAY: - case RPC_FC_SMVARRAY: - case RPC_FC_LGVARRAY: - case RPC_FC_CARRAY: - case RPC_FC_CVARRAY: - case RPC_FC_BOGUS_ARRAY: - return TYPE_ARRAY; - case RPC_FC_FUNCTION: - return TYPE_FUNCTION; - case RPC_FC_COCLASS: - return TYPE_COCLASS; - case RPC_FC_IP: - return TYPE_INTERFACE; - case RPC_FC_MODULE: - return TYPE_MODULE; - default: - assert(0); - return 0; - } + return type->type_type; } #define STATEMENTS_FOR_EACH_FUNC(stmt, stmts) \ diff --git a/reactos/tools/widl/write_msft.c b/reactos/tools/widl/write_msft.c index b74c562119b..a53f4545c01 100644 --- a/reactos/tools/widl/write_msft.c +++ b/reactos/tools/widl/write_msft.c @@ -43,7 +43,7 @@ #include #include -#include "widltypes.h" +#include "widl.h" #include "typelib.h" #include "typelib_struct.h" #include "utils.h" @@ -929,18 +929,10 @@ static int encode_type( case VT_SAFEARRAY: { - int next_vt; + type_t *element_type = type_alias_get_aliasee(type_array_get_element(type)); + int next_vt = get_type_vt(element_type); - /* skip over SAFEARRAY type straight to element type */ - type = type->ref; - - for(next_vt = 0; type->ref; type = type->ref) { - next_vt = get_type_vt(type->ref); - if (next_vt != 0) - break; - } - - encode_type(typelib, next_vt, type->ref, &target_type, NULL, NULL, &child_size); + encode_type(typelib, next_vt, type_alias_get_aliasee(type_array_get_element(type)), &target_type, NULL, NULL, &child_size); for (typeoffset = 0; typeoffset < typelib->typelib_segdir[MSFT_SEG_TYPEDESC].length; typeoffset += 8) { typedata = (void *)&typelib->typelib_segment_data[MSFT_SEG_TYPEDESC][typeoffset]; @@ -981,34 +973,27 @@ static int encode_type( while (type->typelib_idx < 0 && type_is_alias(type) && !is_attr(type->attrs, ATTR_PUBLIC)) type = type_alias_get_aliasee(type); - chat("encode_type: VT_USERDEFINED - type %p name = %s type->type %d idx %d\n", type, - type->name, type->type, type->typelib_idx); + chat("encode_type: VT_USERDEFINED - type %p name = %s real type %d idx %d\n", type, + type->name, type_get_type(type), type->typelib_idx); if(type->typelib_idx == -1) { chat("encode_type: trying to ref not added type\n"); - switch(type->type) { - case RPC_FC_STRUCT: - case RPC_FC_PSTRUCT: - case RPC_FC_CSTRUCT: - case RPC_FC_CPSTRUCT: - case RPC_FC_CVSTRUCT: - case RPC_FC_BOGUS_STRUCT: + switch (type_get_type(type)) { + case TYPE_STRUCT: add_structure_typeinfo(typelib, type); break; - case RPC_FC_IP: + case TYPE_INTERFACE: add_interface_typeinfo(typelib, type); break; - case RPC_FC_ENUM16: + case TYPE_ENUM: add_enum_typeinfo(typelib, type); break; - case RPC_FC_COCLASS: + case TYPE_COCLASS: add_coclass_typeinfo(typelib, type); break; - case 0: - error("encode_type: VT_USERDEFINED - can't yet add typedef's on the fly\n"); - break; default: - error("encode_type: VT_USERDEFINED - unhandled type %d\n", type->type); + error("encode_type: VT_USERDEFINED - unhandled type %d\n", + type_get_type(type)); } } @@ -1045,8 +1030,7 @@ static int encode_type( static void dump_type(type_t *t) { - chat("dump_type: %p name %s type %d ref %p attrs %p\n", t, t->name, t->type, t->ref, t->attrs); - if(t->ref) dump_type(t->ref); + chat("dump_type: %p name %s type %d attrs %p\n", t, t->name, type_get_type(t), t->attrs); } static int encode_var( @@ -1070,29 +1054,33 @@ static int encode_var( if (!decoded_size) decoded_size = &scratch; *decoded_size = 0; - chat("encode_var: var %p type %p type->name %s type->ref %p\n", - var, type, type->name ? type->name : "NULL", type->ref); + chat("encode_var: var %p type %p type->name %s\n", + var, type, type->name ? type->name : "NULL"); - if (type->declarray) { + if (is_array(type) && !type_array_is_decl_as_ptr(type)) { int num_dims, elements = 1, arrayoffset; type_t *atype; int *arraydata; num_dims = 0; - for (atype = type; atype->declarray; atype = type_array_get_element(atype)) + for (atype = type; + is_array(atype) && !type_array_is_decl_as_ptr(atype); + atype = type_array_get_element(atype)) ++num_dims; chat("array with %d dimensions\n", num_dims); encode_var(typelib, atype, var, &target_type, width, alignment, NULL); - arrayoffset = ctl2_alloc_segment(typelib, MSFT_SEG_ARRAYDESC, (2 + 2 * num_dims) * sizeof(long), 0); + arrayoffset = ctl2_alloc_segment(typelib, MSFT_SEG_ARRAYDESC, (2 + 2 * num_dims) * sizeof(int), 0); arraydata = (void *)&typelib->typelib_segment_data[MSFT_SEG_ARRAYDESC][arrayoffset]; arraydata[0] = target_type; arraydata[1] = num_dims; - arraydata[1] |= ((num_dims * 2 * sizeof(long)) << 16); + arraydata[1] |= ((num_dims * 2 * sizeof(int)) << 16); arraydata += 2; - for (atype = type; atype->declarray; atype = type_array_get_element(atype)) + for (atype = type; + is_array(atype) && !type_array_is_decl_as_ptr(atype); + atype = type_array_get_element(atype)) { arraydata[0] = type_array_get_dim(atype); arraydata[1] = 0; @@ -1480,7 +1468,7 @@ static HRESULT add_func_desc(msft_typeinfo_t* typeinfo, var_t *func, int index) { int vt; expr_t *expr = (expr_t *)attr->u.pval; - if (arg->type->type == RPC_FC_ENUM16) + if (type_get_type(arg->type) == TYPE_ENUM) vt = VT_INT; else vt = get_type_vt(arg->type); @@ -1553,7 +1541,7 @@ static HRESULT add_func_desc(msft_typeinfo_t* typeinfo, var_t *func, int index) /* adjust size of VTBL */ if(funckind != 0x3 /* FUNC_STATIC */) - typeinfo->typeinfo->cbSizeVft += 4; + typeinfo->typeinfo->cbSizeVft += pointer_size; /* Increment the number of function elements */ typeinfo->typeinfo->cElement += 1; @@ -2041,7 +2029,7 @@ static void add_interface_typeinfo(msft_typelib_t *typelib, type_t *interface) } } msft_typeinfo->typeinfo->datatype2 = num_funcs << 16 | num_parents; - msft_typeinfo->typeinfo->cbSizeVft = num_funcs * 4; + msft_typeinfo->typeinfo->cbSizeVft = num_funcs * pointer_size; STATEMENTS_FOR_EACH_FUNC( stmt_func, type_iface_get_stmts(interface) ) { var_t *func = stmt_func->u.var; @@ -2209,42 +2197,25 @@ static void add_module_typeinfo(msft_typelib_t *typelib, type_t *module) static void add_type_typeinfo(msft_typelib_t *typelib, type_t *type) { - switch (type->type) { - case RPC_FC_IP: + switch (type_get_type(type)) { + case TYPE_INTERFACE: add_interface_typeinfo(typelib, type); break; - case RPC_FC_STRUCT: + case TYPE_STRUCT: add_structure_typeinfo(typelib, type); break; - case RPC_FC_ENUM16: - case RPC_FC_ENUM32: + case TYPE_ENUM: add_enum_typeinfo(typelib, type); break; - case RPC_FC_COCLASS: + case TYPE_COCLASS: add_coclass_typeinfo(typelib, type); break; - case RPC_FC_BYTE: - case RPC_FC_CHAR: - case RPC_FC_USMALL: - case RPC_FC_SMALL: - case RPC_FC_WCHAR: - case RPC_FC_USHORT: - case RPC_FC_SHORT: - case RPC_FC_ULONG: - case RPC_FC_LONG: - case RPC_FC_HYPER: - case RPC_FC_IGNORE: - case RPC_FC_FLOAT: - case RPC_FC_DOUBLE: - case RPC_FC_ERROR_STATUS_T: - case RPC_FC_BIND_PRIMITIVE: - case RPC_FC_RP: - case RPC_FC_UP: - case RPC_FC_OP: - case RPC_FC_FP: + case TYPE_BASIC: + case TYPE_POINTER: break; default: - error("add_entry: unhandled type 0x%x for %s\n", type->type, type->name); + error("add_entry: unhandled type 0x%x for %s\n", + type_get_type(type), type->name); break; } } @@ -2566,6 +2537,8 @@ int create_msft_typelib(typelib_t *typelib) GUID midl_time_guid = {0xde77ba63,0x517c,0x11d1,{0xa2,0xda,0x00,0x00,0xf8,0x77,0x3c,0xe9}}; GUID midl_version_guid = {0xde77ba64,0x517c,0x11d1,{0xa2,0xda,0x00,0x00,0xf8,0x77,0x3c,0xe9}}; + pointer_size = (typelib_kind == SYS_WIN64) ? 8 : 4; + msft = xmalloc(sizeof(*msft)); memset(msft, 0, sizeof(*msft)); msft->typelib = typelib; @@ -2573,7 +2546,7 @@ int create_msft_typelib(typelib_t *typelib) ctl2_init_header(msft); ctl2_init_segdir(msft); - msft->typelib_header.varflags |= SYS_WIN32; + msft->typelib_header.varflags |= typelib_kind; /* * The following two calls return an offset or -1 if out of memory. We