Sync to trunk (r44371)
authorSamuel Serapion <samuel.serapion@gmail.com>
Thu, 3 Dec 2009 07:28:23 +0000 (07:28 +0000)
committerSamuel Serapion <samuel.serapion@gmail.com>
Thu, 3 Dec 2009 07:28:23 +0000 (07:28 +0000)
svn path=/branches/ros-amd64-bringup/; revision=44373

54 files changed:
reactos/Makefile
reactos/ReactOS-amd64.rbuild
reactos/ReactOS-arm.rbuild
reactos/ReactOS-i386.rbuild
reactos/config-amd64.template.rbuild
reactos/rosbuild.bat [new file with mode: 0644]
reactos/subsystems/ntvdm/ntvdm.rbuild
reactos/subsystems/win/winsrv/winsrv.rbuild
reactos/subsystems/win32/csrss/win32csr/win32csr.rbuild
reactos/subsystems/win32/win32k/include/driver.h
reactos/subsystems/win32/win32k/include/msgqueue.h
reactos/subsystems/win32/win32k/ldr/loader.c
reactos/subsystems/win32/win32k/ntuser/class.c
reactos/subsystems/win32/win32k/ntuser/clipboard.c
reactos/subsystems/win32/win32k/ntuser/focus.c
reactos/subsystems/win32/win32k/ntuser/kbdlayout.c
reactos/subsystems/win32/win32k/ntuser/keyboard.c
reactos/subsystems/win32/win32k/ntuser/message.c
reactos/subsystems/win32/win32k/ntuser/msgqueue.c
reactos/subsystems/win32/win32k/objects/text.c
reactos/subsystems/win32/win32k/win32k.pspec
reactos/subsystems/win32/win32k/win32k.rbuild
reactos/tools/rbuild/backend/codeblocks/codeblocks.cpp
reactos/tools/rbuild/backend/mingw/linkers/ld.mak
reactos/tools/rbuild/backend/mingw/mingw.cpp
reactos/tools/rbuild/backend/mingw/mingw.h
reactos/tools/rbuild/backend/mingw/modulehandler.cpp
reactos/tools/rbuild/backend/mingw/modulehandler.h
reactos/tools/rbuild/backend/mingw/rules.mak
reactos/tools/rbuild/backend/msvc/msvc.cpp
reactos/tools/rbuild/backend/msvc/msvc.h
reactos/tools/rbuild/backend/msvc/vcprojmaker.cpp
reactos/tools/rbuild/backend/msvc/vcxprojmaker.cpp [new file with mode: 0644]
reactos/tools/rbuild/module.cpp
reactos/tools/rbuild/rbuild.h
reactos/tools/rbuild/rbuild.mak
reactos/tools/rbuild/rbuild.sln
reactos/tools/rbuild/rbuild.vcproj
reactos/tools/rsym/log2lines.c
reactos/tools/widl/expr.c
reactos/tools/widl/expr.h
reactos/tools/widl/header.c
reactos/tools/widl/parser.l
reactos/tools/widl/parser.tab.c
reactos/tools/widl/parser.tab.h
reactos/tools/widl/parser.y
reactos/tools/widl/parser.yy.c
reactos/tools/widl/typegen.c
reactos/tools/widl/typegen.h
reactos/tools/widl/typelib.c
reactos/tools/widl/typelib.h
reactos/tools/widl/typetree.c
reactos/tools/widl/typetree.h
reactos/tools/widl/widltypes.h

index 24d724a..cea61c9 100644 (file)
@@ -152,6 +152,11 @@ $(error ReactOS's makefiles use GNU Make 3.80+ features, you have $(MAKE_VERSION
 endif
 # END of code borrowed from GMSL ( http://gmsl.sourceforge.net/ )
 
+define NL
+
+
+endef
+
 .PHONY: all
 .PHONY: clean
 .PHONY: world
@@ -234,7 +239,7 @@ ifeq ($(HALFVERBOSEECHO),yes)
   ECHO_CVTRES  =@echo $(QUOTE)[CVTRES]   $@$(QUOTE)
   ECHO_WIDL    =@echo $(QUOTE)[WIDL]     $@$(QUOTE)
   ECHO_BIN2RES =@echo $(QUOTE)[BIN2RES]  $<$(QUOTE)
-  ECHO_DLLTOOL =@echo $(QUOTE)[DLLTOOL]  $@$(QUOTE)
+  ECHO_IMPLIB  =@echo $(QUOTE)[IMPLIB]   $@$(QUOTE)
   ECHO_LD      =@echo $(QUOTE)[LD]       $@$(QUOTE)
   ECHO_HOSTLD  =@echo $(QUOTE)[HOST-LD]  $@$(QUOTE)
   ECHO_LINK    =@echo $(QUOTE)[LINK]     $@$(QUOTE)
@@ -242,6 +247,7 @@ ifeq ($(HALFVERBOSEECHO),yes)
   ECHO_OBJDUMP =@echo $(QUOTE)[OBJDUMP]  $@$(QUOTE)
   ECHO_RBUILD  =@echo $(QUOTE)[RBUILD]   $@$(QUOTE)
   ECHO_RSYM    =@echo $(QUOTE)[RSYM]     $@$(QUOTE)
+  ECHO_PEFIXUP =@echo $(QUOTE)[PEFIXUP]  $@$(QUOTE)
   ECHO_WMC     =@echo $(QUOTE)[WMC]      $@$(QUOTE)
   ECHO_NCI     =@echo $(QUOTE)[NCI]      $@$(QUOTE)
   ECHO_CABMAN  =@echo $(QUOTE)[CABMAN]   $<$(QUOTE)
@@ -253,6 +259,7 @@ ifeq ($(HALFVERBOSEECHO),yes)
   ECHO_STRIP   =@echo $(QUOTE)[STRIP]    $@$(QUOTE)
   ECHO_RGENSTAT=@echo $(QUOTE)[RGENSTAT] $@$(QUOTE)
   ECHO_DEPENDS =@echo $(QUOTE)[DEPENDS]  $<$(QUOTE)
+  ECHO_RSP     =@echo $(QUOTE)[RSP]      $@$(QUOTE)
 else
   ECHO_CP      =
   ECHO_MKDIR   =
@@ -272,7 +279,7 @@ else
   ECHO_CVTRES  =
   ECHO_WIDL    =
   ECHO_BIN2RES =
-  ECHO_DLLTOOL =
+  ECHO_IMPLIB  =
   ECHO_LD      =
   ECHO_HOSTLD  =
   ECHO_NM      =
@@ -290,6 +297,7 @@ else
   ECHO_STRIP   =
   ECHO_RGENSTAT=
   ECHO_DEPENDS =
+  ECHO_RSP     =
 endif
 
 # Set host compiler/linker
@@ -521,6 +529,11 @@ msvc9: $(ROS_BUILDENGINE)
        $(ECHO_RBUILD)
        $(Q)$(ROS_BUILDENGINE) $(RBUILD_FLAGS) $(ROS_RBUILDFLAGS) -vs9.00 -voversionconfiguration msvc
 
+.PHONY: msvc10
+msvc10: $(ROS_BUILDENGINE)
+       $(ECHO_RBUILD)
+       $(Q)$(ROS_BUILDENGINE) $(RBUILD_FLAGS) $(ROS_RBUILDFLAGS) -vs10.00 -voversionconfiguration msvc
+
 .PHONY: msvc6_clean
 msvc6_clean: $(ROS_BUILDENGINE)
        $(ECHO_RBUILD)
@@ -546,6 +559,11 @@ msvc9_clean: $(ROS_BUILDENGINE)
        $(ECHO_RBUILD)
        $(Q)$(ROS_BUILDENGINE) $(RBUILD_FLAGS) $(ROS_RBUILDFLAGS) -c -vs9.00 -voversionconfiguration msvc
 
+.PHONY: msvc10_clean
+msvc10_clean: $(ROS_BUILDENGINE)
+       $(ECHO_RBUILD)
+       $(Q)$(ROS_BUILDENGINE) $(RBUILD_FLAGS) $(ROS_RBUILDFLAGS) -c -vs10.00 -voversionconfiguration msvc
+
 .PHONY: msvc_clean
 msvc_clean: $(ROS_BUILDENGINE)
        $(ECHO_RBUILD)
index 207317c..a733993 100644 (file)
@@ -20,7 +20,6 @@
        <property name="PLATFORM" value="PC"/>
        <property name="usewrc" value="false"/>
        <property name="WINEBUILD_FLAGS" value="--kill-at"/>
-       <property name="NTOSKRNL_SHARED" value="-shared"/>
 
        <if property="OPTIMIZE" value="1">
                <compilerflag>-Os</compilerflag>
        <compilerflag>-Wno-multichar</compilerflag>
        <compilerflag>-Wno-format</compilerflag>
        <!-- compilerflag>-H</compilerflag>    enable this for header traces -->
+
+       <group linkerset="ld">
        <linkerflag>-disable-stdcall-fixup</linkerflag>
        <linkerflag>-static</linkerflag>
        <linkerflag>--unique=.eh_frame</linkerflag>
+       <linkerflag>-file-alignment=0x1000</linkerflag>
+       <linkerflag>-section-alignment=0x1000</linkerflag>
+       </group>
 
 <!-- Here starts <xi:include href="ReactOS-generic.rbuild" /> -->
 
                        <xi:include href="drivers/ksfilter/directory.rbuild" />
                </directory>
 
-               <!-- directory name="multimedia">
+               <directory name="multimedia">
                        <xi:include href="drivers/multimedia/directory.rbuild" />
-               </directory -->
+               </directory >
 
                <directory name="network">
                        <xi:include href="drivers/network/directory.rbuild" />
                        <xi:include href="drivers/setup/directory.rbuild" />
                </directory>
                <directory name="storage">
-            <xi:include href="drivers/storage/directory.rbuild" />
+                               <xi:include href="drivers/storage/directory.rbuild" />
                </directory>
                <directory name="usb">  
                        <xi:include href="drivers/usb/directory.rbuild" />
                                <xi:include href="lib/3rdparty/zlib/zlib.rbuild" />
                        </directory>
                </directory>
+               <if property="USERMODE" value="1">
+               <directory name="atl">
+                       <xi:include href="lib/atl/atl.rbuild" />
+               </directory>
+               </if>
                <directory name="sdk">
                        <xi:include href="lib/sdk/sdk.rbuild" />
                </directory>
index de897e8..a17eaf2 100644 (file)
@@ -16,7 +16,6 @@
     
     <define name="USE_COMPILER_EXCEPTIONS" />
     
-    <property name="NTOSKRNL_SHARED" value="-file-alignment=0x1000 -section-alignment=0x1000 -shared"/>
     <property name="WINEBUILD_FLAGS" value="--kill-at"/>
         
     <include>include/reactos/arm</include>
@@ -38,6 +37,8 @@
        <group linkerset="ld">
         <linkerflag>--strip-debug</linkerflag> <!-- INVESTIGATE -->
         <linkerflag>-static</linkerflag> <!-- INVESTIGATE -->
+               <linkerflag>-file-alignment=0x1000</linkerflag>
+               <linkerflag>-section-alignment=0x1000</linkerflag>
        </group>
 
        <directory name="media">
index 6f295ee..b6fc035 100644 (file)
@@ -16,7 +16,6 @@
 
        <define name="USE_COMPILER_EXCEPTIONS" />
 
-       <property name="NTOSKRNL_SHARED" value="-file-alignment=0x1000 -section-alignment=0x1000 -shared"/>
        <property name="PLATFORM" value="PC"/>
 
        <group compilerset="gcc">
@@ -30,6 +29,8 @@
 
        <group linkerset="ld">
                <linkerflag>-disable-stdcall-fixup</linkerflag>
+               <linkerflag>-file-alignment=0x1000</linkerflag>
+               <linkerflag>-section-alignment=0x1000</linkerflag>
        </group>
 
        <directory name="base">
index b884fec..e3ab754 100644 (file)
@@ -65,7 +65,7 @@
        enable this (except they/you purchased a license from the patent owner).
        This settings is disabled (0) by default.
 -->
-<property name="NSWPAT" value="1" />
+<property name="NSWPAT" value="0" />
 
 <!--
        Whether to compile with the KD protocol. This will disable support for KDBG
diff --git a/reactos/rosbuild.bat b/reactos/rosbuild.bat
new file mode 100644 (file)
index 0000000..21f814b
--- /dev/null
@@ -0,0 +1,117 @@
+::
+:: This script is called from the Makefile command line within Visual Studio using the following parameters:
+::
+::             %1 - $(build)
+::             %2 - $(target)
+::
+:: Examples:
+::
+::             Call build.bat build ntoskrnl
+::             Call build.bat clean win32k
+::
+
+@echo off
+
+if "%1"=="" goto :err_params
+if "%2"=="" goto :err_params
+
+
+:: Get the RosBE path... ::
+
+:: Set the command we'll use to check if RosBE exists
+set _IS_ROSBE_INSTALLED_COMMAND="reg query "HKCU\Software\Microsoft\Windows\CurrentVersion\Uninstall\ReactOS Build Environment for Windows" /v UninstallString"
+
+:: Check the key actually exists !!!!FIXME: Why is this returning 'The system cannot find the path specified.'!!!!
+%_IS_ROSBE_INSTALLED_COMMAND%
+IF NOT errorlevel 0 goto :err_no_rosbe
+
+:: This is a bit hackish. What we do is look for REG_SZ which is the second token on the second line and dump it into i
+:: We then assign all remaining text to the next variable in the sequence, which is j. This leaves us with the path
+for /F "tokens=2,* skip=1 delims=\ " %%i in ('%_IS_ROSBE_INSTALLED_COMMAND%') do (
+    set _ROSBE_UNINSTALL_PATH_=%%j
+)
+
+
+:: Now strip the file name from the end of the path and we should have our RosBE install directory
+set _ROSBE_PATH_DIR=
+set _ROSBE_PATH_=
+for %%i in ("%_ROSBE_UNINSTALL_PATH_%") do set _ROSBE_PATH_DIR=%%~di
+for %%i in ("%_ROSBE_UNINSTALL_PATH_%") do set "_ROSBE_PATH_=%%~pi"
+set "_ROSBE_FULL_PATH_=%_ROSBE_PATH_DIR%%_ROSBE_PATH_%"
+::echo RosBE insall path = %_ROSBE_FULL_PATH_%
+
+:: Set the path which contains our build tools
+set _ROSBE_BIN_PATH=%_ROSBE_FULL_PATH_%i386\bin
+
+:: Add the path to the search path
+path=%path%;%_ROSBE_BIN_PATH%
+
+:: Set the make path
+set _MAKE_COMMAND=""
+if exist "%_ROSBE_BIN_PATH%\mingw32-make.exe" (
+    set _MAKE_COMMAND=mingw32-make.exe
+)
+if exist "%_ROSBE_BIN_PATH%\make.exe" (
+    set _MAKE_COMMAND=make.exe
+)
+if %_MAKE_COMMAND% == "" (
+    goto err_no_make
+)
+
+:: This file is located in the source root
+set _ROS_SOURCE_ROOT=%~dp0
+
+:: Change the current dir to the source root
+cd %_ROS_SOURCE_ROOT%
+
+:: Run the requested build task
+if "%1" == "build" (
+    goto :build
+) 
+if "%1" == "rebuild" (
+    goto clean
+)
+if "%1" == "clean" (
+    goto :clean
+)
+goto :err_params
+
+:clean
+echo.
+echo Cleaning...
+echo.
+call "%_MAKE_COMMAND%" -j 1 %2%_clean
+
+if "%1" == "rebuild" (
+    goto :build
+)
+
+goto :exit
+
+:build
+echo.
+echo Building...
+echo.
+call "%_MAKE_COMMAND%" -j 1 %2%
+
+goto :exit
+
+:err_no_make
+echo.
+echo Cannot find  a make executable
+goto :err_no_rosbe
+
+:err_no_rosbe
+echo.
+echo You need to have RosBE installed to use this configuration
+echo.
+exit 1
+
+:err_params
+echo. 
+echo Invalid parameters required, Check your command line.
+echo.
+exit 2
+
+:exit
+echo.
index b291042..24cd31e 100644 (file)
@@ -3,7 +3,6 @@
 <module name="ntvdm" type="win32cui" installbase="system32" installname="ntvdm.exe">
        <include base="ntvdm">.</include>
        <library>ntdll</library>
-       <library>kernel32</library>
        <library>user32</library>
        <library>gdi32</library>
        <library>advapi32</library>
index 05077cd..7d681c9 100644 (file)
@@ -6,7 +6,6 @@
        <include base="csr">include</include>
        <library>ntdll</library>
        <library>csrsrv</library>
-       <library>kernel32</library>
        <library>user32</library>
        <library>gdi32</library>
        <file>dllmain.c</file>
index 967e483..7a14f63 100644 (file)
@@ -9,7 +9,6 @@
        <include base="console">.</include>
        <compilerflag compilerset="gcc">-fms-extensions</compilerflag>
        <library>ntdll</library>
-       <library>kernel32</library>
        <library>user32</library>
        <library>gdi32</library>
        <library>advapi32</library>
index 8c5e09a..04cd33b 100644 (file)
@@ -4,11 +4,13 @@
 
 #include <winddi.h>
 
-
-
-
-
-
+typedef struct _DRIVERS
+{
+       LIST_ENTRY ListEntry;
+    PVOID SectionPointer;
+    PVOID BaseAddress;
+       UNICODE_STRING DriverName;
+}DRIVERS, *PDRIVERS;
 
 BOOL  DRIVER_RegisterDriver(LPCWSTR  Name, PFN_DrvEnableDriver  EnableDriver);
 PFN_DrvEnableDriver DRIVER_FindExistingDDIDriver(LPCWSTR  Name);
index 234d0b5..5094b7f 100644 (file)
@@ -188,7 +188,7 @@ co_IntSendMessageTimeout(HWND hWnd,
 LRESULT FASTCALL
 IntDispatchMessage(MSG* Msg);
 BOOL FASTCALL
-IntTranslateKbdMessage(LPMSG lpMsg, HKL dwhkl);
+IntTranslateKbdMessage(LPMSG lpMsg, UINT flags);
 
 VOID FASTCALL
 co_MsqPostKeyboardMessage(UINT uMsg, WPARAM wParam, LPARAM lParam);
index 945b0f4..33b9e07 100644 (file)
 #include <debug.h>
 
 
-typedef struct _DRIVERS
-{
-       LIST_ENTRY ListEntry;
-       HANDLE ImageHandle;
-       UNICODE_STRING DriverName;
-}DRIVERS, *PDRIVERS;
-
 extern LIST_ENTRY GlobalDriverListHead;
 
+
 /*
  * Blatantly stolen from ldr/utils.c in ntdll.  I can't link ntdll from
  * here, though.
@@ -180,7 +174,7 @@ EngFindImageProcAddress(IN HANDLE Module,
       return NULL;
     }
   RtlInitAnsiString(&ProcNameString, ProcName);
-  Status = LdrGetProcedureAddress(Module,
+  Status = LdrGetProcedureAddress(((PDRIVERS)Module)->BaseAddress,
                                  &ProcNameString,
                                  0,
                                  &Function);
@@ -199,8 +193,8 @@ HANDLE
 APIENTRY
 EngLoadImage (LPWSTR DriverName)
 {
-       HANDLE hImageHandle = NULL;
        SYSTEM_GDI_DRIVER_INFORMATION GdiDriverInfo;
+       PDRIVERS DriverInfo = NULL;
        NTSTATUS Status;
 
        RtlInitUnicodeString(&GdiDriverInfo.DriverName, DriverName);
@@ -213,14 +207,14 @@ EngLoadImage (LPWSTR DriverName)
                {
                        Current = CONTAINING_RECORD(CurrentEntry, DRIVERS, ListEntry);
                        if( Current && (0 == RtlCompareUnicodeString(&GdiDriverInfo.DriverName, &Current->DriverName, FALSE)) ) {
-                               hImageHandle = Current->ImageHandle;
+                               DriverInfo = Current;
                                break;
                        }
                        CurrentEntry = CurrentEntry->Flink;
                };
        }
 
-       if( !hImageHandle )
+       if( !DriverInfo )
        {
                /* the driver was not loaded before, so let's do that */
                Status = ZwSetSystemInformation(SystemLoadGdiDriverInformation, &GdiDriverInfo, sizeof(SYSTEM_GDI_DRIVER_INFORMATION));
@@ -228,19 +222,18 @@ EngLoadImage (LPWSTR DriverName)
                        DPRINT1("ZwSetSystemInformation failed with Status 0x%lx\n", Status);
                }
                else {
-            PDRIVERS DriverInfo;
-                       hImageHandle = (HANDLE)GdiDriverInfo.ImageAddress;
                        DriverInfo = ExAllocatePool(PagedPool, sizeof(DRIVERS));
                        DriverInfo->DriverName.MaximumLength = GdiDriverInfo.DriverName.MaximumLength;
                        DriverInfo->DriverName.Length = GdiDriverInfo.DriverName.Length;
                        DriverInfo->DriverName.Buffer = ExAllocatePool(PagedPool, GdiDriverInfo.DriverName.MaximumLength);
                        RtlCopyUnicodeString(&DriverInfo->DriverName, &GdiDriverInfo.DriverName);
-                       DriverInfo->ImageHandle = hImageHandle;
+                       DriverInfo->SectionPointer = GdiDriverInfo.SectionPointer;
+            DriverInfo->BaseAddress = GdiDriverInfo.ImageAddress;
                        InsertHeadList(&GlobalDriverListHead, &DriverInfo->ListEntry);
                }
        }
 
-       return hImageHandle;
+       return DriverInfo;
 }
 
 VOID
@@ -248,11 +241,12 @@ APIENTRY
 EngUnloadImage ( IN HANDLE hModule )
 {
   NTSTATUS Status;
+  PDRIVERS DriverInfo = (PDRIVERS)hModule;
 
   DPRINT("hModule 0x%x\n", hModule);
 
   Status = ZwSetSystemInformation(SystemUnloadGdiDriverInformation,
-    &hModule, sizeof(HANDLE));
+    DriverInfo->SectionPointer, sizeof(PVOID));
 
   if(!NT_SUCCESS(Status))
   {
@@ -261,28 +255,10 @@ EngUnloadImage ( IN HANDLE hModule )
   }
   else
   {
-         /* remove from the list */
-         if( !IsListEmpty(&GlobalDriverListHead) )
-         {
-                 PLIST_ENTRY CurrentEntry = GlobalDriverListHead.Flink;
-                 PDRIVERS Current;
-                 /* probably the driver was already loaded, let's try to find it out */
-                 while( CurrentEntry != &GlobalDriverListHead )
-                 {
-                         Current = CONTAINING_RECORD(CurrentEntry, DRIVERS, ListEntry);
-
-                         if( Current ) {
-                                 if(Current->ImageHandle == hModule) {
-                                         ExFreePool(Current->DriverName.Buffer);
-                                         RemoveEntryList(&Current->ListEntry);
-                                         ExFreePool(Current);
-                                         break;
+    ExFreePool(DriverInfo->DriverName.Buffer);
+    RemoveEntryList(&DriverInfo->ListEntry);
+    ExFreePool(DriverInfo);
                                  }
                          }
-                         CurrentEntry = CurrentEntry->Flink;
-                 };
-         }
-  }
-}
 
 /* EOF */
index 4052593..9c2f672 100644 (file)
@@ -1154,7 +1154,7 @@ IntGetClassAtom(IN PUNICODE_STRING ClassName,
                              &pi->pclsPrivateList,
                              Link);
         if (Class != NULL)
-        {
+        {  DPRINT("Step 1: 0x%x\n",Class );
             goto FoundClass;
         }
 
@@ -1165,7 +1165,7 @@ IntGetClassAtom(IN PUNICODE_STRING ClassName,
                              &pi->pclsPublicList,
                              Link);
         if (Class != NULL)
-        {
+        { DPRINT("Step 2: 0x%x 0x%x\n",Class, Class->hModule);
             goto FoundClass;
         }
 
@@ -1175,7 +1175,7 @@ IntGetClassAtom(IN PUNICODE_STRING ClassName,
                              &pi->pclsPrivateList,
                              Link);
         if (Class != NULL)
-        {
+        { DPRINT("Step 3: 0x%x\n",Class );
             goto FoundClass;
         }
 
@@ -1188,7 +1188,7 @@ IntGetClassAtom(IN PUNICODE_STRING ClassName,
         {
             SetLastWin32Error(ERROR_CLASS_DOES_NOT_EXIST);
             return (RTL_ATOM)0;
-        }
+        }else{DPRINT("Step 4: 0x%x\n",Class );}
 
 FoundClass:
         *BaseClass = Class;
@@ -2402,6 +2402,7 @@ InvalidParameter:
 
    if (Ret)
    {
+      DPRINT("GetClassInfo(%wZ, 0x%x)\n", ClassName, hInstance);
       ClassAtom = IntGetClassAtom( &SafeClassName,
                                     hInstance,
                                     ppi,
index 3d1f1af..52b54d5 100644 (file)
@@ -581,10 +581,10 @@ NtUserEmptyClipboard(VOID)
     return ret;
 }
 
-HANDLE APIENTRY
+DWORD_PTR APIENTRY
 NtUserGetClipboardData(UINT uFormat, PVOID pBuffer)
 {
-    HANDLE ret = NULL;
+    DWORD_PTR ret = 0;
 
     UserEnterShared();
 
@@ -607,7 +607,7 @@ NtUserGetClipboardData(UINT uFormat, PVOID pBuffer)
                         co_IntSendMessage(ClipboardOwnerWindow->hSelf, WM_RENDERFORMAT, (WPARAM)uFormat, 0);
                         data = intIsFormatAvailable(uFormat);
                         ASSERT(data->size);
-                        ret = (HANDLE)(ULONG_PTR)data->size;
+                        ret = data->size;
                     }
                 }
                 else
@@ -618,12 +618,12 @@ NtUserGetClipboardData(UINT uFormat, PVOID pBuffer)
                     }
 
                 }
-                ret = (HANDLE)(ULONG_PTR)data->size;
+                ret = data->size;
             }
             else
             {
                 /* there is no data in this format */
-                //ret = (HANDLE)FALSE;
+                //ret = FALSE;
             }
         }
         else
@@ -646,12 +646,12 @@ NtUserGetClipboardData(UINT uFormat, PVOID pBuffer)
                             PCLIPBOARDELEMENT data = intIsFormatAvailable(CF_DIB);
                             if (data)
                             {
-                                ret = renderBITMAPfromDIB(data->hData);
+                                ret = (DWORD_PTR)renderBITMAPfromDIB(data->hData);
                             }
                         }
                         else
                         {
-                            ret = (HANDLE)pBuffer;
+                            ret = (DWORD_PTR)pBuffer;
 
                             _SEH2_TRY
                             {
@@ -660,7 +660,7 @@ NtUserGetClipboardData(UINT uFormat, PVOID pBuffer)
                             }
                             _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
                             {
-                                ret = NULL;
+                                ret = 0;
                             }
                             _SEH2_END
 
@@ -669,7 +669,7 @@ NtUserGetClipboardData(UINT uFormat, PVOID pBuffer)
                     }
                     else
                     {
-                        ret = (HANDLE)pBuffer;
+                        ret = (DWORD_PTR)pBuffer;
 
                         _SEH2_TRY
                         {
@@ -678,7 +678,7 @@ NtUserGetClipboardData(UINT uFormat, PVOID pBuffer)
                         }
                         _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
                         {
-                            ret = NULL;
+                            ret = 0;
                         }
                         _SEH2_END
                     }
index dd2fd4d..3614b73 100644 (file)
@@ -77,8 +77,10 @@ co_IntSendActivateMessages(HWND hWndPrev, HWND hWnd, BOOL MouseActivate)
       /* Send palette messages */
       if (co_IntPostOrSendMessage(hWnd, WM_QUERYNEWPALETTE, 0, 0))
       {
-         co_IntPostOrSendMessage(HWND_BROADCAST, WM_PALETTEISCHANGING,
-                                 (WPARAM)hWnd, 0);
+         UserPostMessage( HWND_BROADCAST,
+                          WM_PALETTEISCHANGING,
+                         (WPARAM)hWnd,
+                          0);
       }
 
       if (UserGetWindow(hWnd, GW_HWNDPREV) != NULL)
index d524cef..ec07d34 100644 (file)
@@ -163,7 +163,7 @@ static BOOL UserLoadKbdDll(WCHAR *wsKLID,
       DPRINT("Loaded %wZ\n", &FullLayoutPath);
 
       RtlInitAnsiString( &kbdProcedureName, "KbdLayerDescriptor" );
-      LdrGetProcedureAddress((PVOID)*phModule,
+      LdrGetProcedureAddress((*(PDRIVERS*)phModule)->BaseAddress,
                              &kbdProcedureName,
                              0,
                              (PVOID*)&layerDescGetFn);
index 40372a6..6291886 100644 (file)
@@ -419,7 +419,7 @@ CLEANUP:
 
 BOOL FASTCALL
 IntTranslateKbdMessage(LPMSG lpMsg,
-                       HKL dwhkl)
+                       UINT Flags)
 {
    PTHREADINFO pti;
    static INT dead_char = 0;
index 10342d1..f3644c0 100644 (file)
@@ -335,6 +335,9 @@ IntDispatchMessage(PMSG pMsg)
   LARGE_INTEGER TickCount;
   LONG Time;
   LRESULT retval;
+  PMSGMEMORY MsgMemoryEntry;
+  INT lParamBufferSize;
+  LPARAM lParamPacked;
   PWINDOW_OBJECT Window = NULL;
 
   if (pMsg->hwnd)
@@ -376,9 +379,37 @@ IntDispatchMessage(PMSG pMsg)
      }
   }
   // Need a window!
-  if (!Window) return 0;
+  if ( !Window || !Window->Wnd ) return 0;
 
-  retval = co_IntPostOrSendMessage(pMsg->hwnd, pMsg->message, pMsg->wParam, pMsg->lParam);
+  /* See if this message type is present in the table */
+  MsgMemoryEntry = FindMsgMemory(pMsg->message);
+  if ( !MsgMemoryEntry )
+  {
+     lParamBufferSize = -1;
+  }
+  else
+  {
+     lParamBufferSize = MsgMemorySize(MsgMemoryEntry, pMsg->wParam, pMsg->lParam);
+  }
+
+  if (! NT_SUCCESS(PackParam(&lParamPacked, pMsg->message, pMsg->wParam, pMsg->lParam)))
+  {
+     DPRINT1("Failed to pack message parameters\n");
+     return 0;
+  }
+
+  retval = co_IntCallWindowProc( Window->Wnd->lpfnWndProc,
+                                !Window->Wnd->Unicode,
+                                 pMsg->hwnd,
+                                 pMsg->message,
+                                 pMsg->wParam,
+                                 lParamPacked,
+                                 lParamBufferSize);
+
+  if (! NT_SUCCESS(UnpackParam(lParamPacked, pMsg->message, pMsg->wParam, pMsg->lParam)))
+  {
+     DPRINT1("Failed to unpack message parameters\n");
+  }
 
   if (pMsg->message == WM_PAINT)
   {
@@ -482,7 +513,7 @@ NtUserDispatchMessage(PMSG UnsafeMsgInfo)
 
 BOOL APIENTRY
 NtUserTranslateMessage(LPMSG lpMsg,
-                       HKL dwhkl)
+                       UINT Flags)
 {
    NTSTATUS Status;
    MSG SafeMsg;
@@ -498,7 +529,7 @@ NtUserTranslateMessage(LPMSG lpMsg,
       RETURN( FALSE);
    }
 
-   RETURN( IntTranslateKbdMessage(&SafeMsg, dwhkl));
+   RETURN( IntTranslateKbdMessage(&SafeMsg, Flags));
 
 CLEANUP:
    DPRINT("Leave NtUserTranslateMessage: ret=%i\n",_ret_);
@@ -1324,7 +1355,7 @@ UserPostThreadMessage( DWORD idThread,
    if( Status == STATUS_SUCCESS )
    {
       pThread = (PTHREADINFO)peThread->Tcb.Win32Thread;
-      if( !pThread || !pThread->MessageQueue )
+      if( !pThread || !pThread->MessageQueue || (pThread->TIF_flags & TIF_INCLEANUP))
       {
          ObDereferenceObject( peThread );
          return FALSE;
@@ -1370,7 +1401,6 @@ UserPostMessage(HWND Wnd,
                                     wParam,
                                     lParam);
 
-   pti = PsGetCurrentThreadWin32Thread();
    if (Wnd == HWND_BROADCAST)
    {
       HWND *List;
@@ -1392,10 +1422,18 @@ UserPostMessage(HWND Wnd,
       PWINDOW_OBJECT Window;
 
       Window = UserGetWindowObject(Wnd);
-      if (NULL == Window)
+      if ( !Window || !Window->Wnd )
       {
          return FALSE;
       }
+
+      pti = Window->Wnd->head.pti;
+      if ( pti->TIF_flags & TIF_INCLEANUP )
+      {
+         DPRINT1("Attempted to post message to window 0x%x when the thread is in cleanup!\n", Wnd);
+         return FALSE;
+      }
+
       if(Window->Status & WINDOWSTATUS_DESTROYING)
       {
          DPRINT1("Attempted to post message to window 0x%x that is being destroyed!\n", Wnd);
@@ -1761,6 +1799,9 @@ co_IntDoSendMessage(HWND hWnd,
       Info.Ansi = !Window->Wnd->Unicode;
       Info.Proc = Window->Wnd->lpfnWndProc;
 
+      // Make the call from here if CALLWNDPROC or CALLWNDPROCRET are hooked
+      // or just do it in User32!
+
       IntCallWndProcRet( Window, hWnd, Msg, wParam, lParam, &Result);
    }
    else
index e1f69d8..0fbcc9a 100644 (file)
@@ -462,7 +462,7 @@ co_MsqTranslateMouseMessage(PUSER_MESSAGE_QUEUE MessageQueue, PWINDOW_OBJECT Win
 
    *ScreenPoint = Message->Msg.pt;
 
-   if((Window != NULL && (int)Window != 1 && CaptureWindow->hSelf != Window->hSelf) ||
+   if((Window != NULL && PtrToInt(Window) != 1 && CaptureWindow->hSelf != Window->hSelf) ||
          ((FilterLow != 0 || FilterHigh != 0) && (Msg < FilterLow || Msg > FilterHigh)))
    {
       /* Reject the message because it doesn't match the filter */
@@ -1383,7 +1383,7 @@ co_MsqFindMessage(IN PUSER_MESSAGE_QUEUE MessageQueue,
    {
       CurrentMessage = CONTAINING_RECORD(CurrentEntry, USER_MESSAGE,
                                          ListEntry);
-      if ((!Window || (int)Window == 1 || Window->hSelf == CurrentMessage->Msg.hwnd) &&
+      if ((!Window || PtrToInt(Window) == 1 || Window->hSelf == CurrentMessage->Msg.hwnd) &&
             ((MsgFilterLow == 0 && MsgFilterHigh == 0) ||
              (MsgFilterLow <= CurrentMessage->Msg.message &&
               MsgFilterHigh >= CurrentMessage->Msg.message)))
@@ -1997,7 +1997,7 @@ MsqGetFirstTimerExpiry(PUSER_MESSAGE_QUEUE MessageQueue,
       Timer = CONTAINING_RECORD(MessageQueue->TimerListHead.Flink,
                                 TIMER_ENTRY, ListEntry);
       EnumEntry = EnumEntry->Flink;
-      if ((NULL == WndFilter || (int)WndFilter == 1 || Timer->Wnd == WndFilter->hSelf) &&
+      if ((NULL == WndFilter || PtrToInt(WndFilter) == 1 || Timer->Wnd == WndFilter->hSelf) &&
             ((MsgFilterMin == 0 && MsgFilterMax == 0) ||
              (MsgFilterMin <= Timer->Msg &&
               Timer->Msg <= MsgFilterMax)))
index 1fdd636..14376a1 100644 (file)
 
 /** Functions *****************************************************************/
 
+/*
+   flOpts :
+   GetTextExtentPoint32W = 0
+   GetTextExtentPointW   = 1
+ */
 BOOL
 FASTCALL
 GreGetTextExtentW(
@@ -65,6 +70,12 @@ GreGetTextExtentW(
   return Result;
 } 
 
+
+/*
+   fl :
+   GetTextExtentExPointW = 0 and everything else that uses this.
+   GetTextExtentExPointI = 1
+ */
 BOOL
 FASTCALL
 GreGetTextExtentExW(
@@ -235,6 +246,12 @@ NtGdiGetTextCharsetInfo(
   return Ret;
 }
 
+
+/*
+   fl :
+   GetTextExtentExPointW = 0 and everything else that uses this.
+   GetTextExtentExPointI = 1
+ */
 W32KAPI
 BOOL
 APIENTRY
@@ -389,6 +406,12 @@ NtGdiGetTextExtentExW(
   return TRUE;
 }
 
+
+/*
+   flOpts :
+   GetTextExtentPoint32W = 0
+   GetTextExtentPointW   = 1
+ */
 BOOL
 APIENTRY
 NtGdiGetTextExtent(HDC hdc,
index bd2a06e..6afc371 100644 (file)
@@ -1,4 +1,3 @@
-#include "include/reactos/msvctarget.h"
 #undef i386
 
 @ stdcall -arch=i386 FLOATOBJ_AddFloatObj(ptr ptr) FLOATOBJ_Add
index 5ccf818..8b5303c 100644 (file)
@@ -1,10 +1,17 @@
 <?xml version="1.0"?>
 <!DOCTYPE group SYSTEM "../../../tools/rbuild/project.dtd">
 <group>
-<module name="win32k_base" type="objectlibrary" allowwarnings="true">
-       <include base="win32k_base">.</include>
-       <include base="win32k_base">include</include>
-       <include base="win32k_base" root="intermediate">.</include>
+<module name="win32k" type="kernelmodedriver" installbase="system32" installname="win32k.sys" crt="libcntpr" allowwarnings="true">
+       <importlibrary definition="win32k.pspec" />
+       <library>pseh</library>
+       <library>ntoskrnl</library>
+       <library>hal</library>
+       <library>ftfd</library>
+       <library>dxguid</library>
+       <file>win32k.rc</file>
+       <include base="win32k">.</include>
+       <include base="win32k">include</include>
+       <include base="win32k" root="intermediate">.</include>
        <include base="ntoskrnl">include</include>
        <include base="freetype">include</include>
        <include base="ReactOS">include/reactos/subsys</include>
        <!-- See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38054#c7 -->
        <compilerflag compilerset="gcc">-fno-unit-at-a-time</compilerflag>
 </module>
-<module name="win32k" type="kernelmodedriver" installbase="system32" installname="win32k.sys" crt="libcntpr">
-       <importlibrary definition="win32k.pspec" />
-       <library>win32k_base</library>
-       <library>pseh</library>
-       <library>ntoskrnl</library>
-       <library>hal</library>
-       <library>ftfd</library>
-       <library>dxguid</library>
-       <file>win32k.rc</file>
-</module>
 </group>
index 74479a8..b1fb3f1 100644 (file)
@@ -598,7 +598,7 @@ CBBackend::_generate_cbproj ( const Module& module )
 
                if ( sys )
                {
-                       fprintf ( OUT, "\t\t\t\t\t<Add option=\"-Wl,--entry,%s%s\" />\r\n", "_", module.GetEntryPoint(false) == "" ? "DriverEntry@8" : module.GetEntryPoint(false).c_str ());
+                       fprintf ( OUT, "\t\t\t\t\t<Add option=\"-Wl,--entry,%s%s\" />\r\n", "_", module.GetEntryPoint() == "" ? "DriverEntry@8" : module.GetEntryPoint().c_str ());
                        fprintf ( OUT, "\t\t\t\t\t<Add option=\"-Wl,--image-base,%s\" />\r\n", baseaddr == "" ? "0x10000" : baseaddr.c_str () );
                        fprintf ( OUT, "\t\t\t\t\t<Add option=\"-nostartfiles -Wl,--nostdlib\" />\r\n" );
                }
@@ -623,7 +623,7 @@ CBBackend::_generate_cbproj ( const Module& module )
                }
                else if ( dll )
                {
-                       fprintf ( OUT, "\t\t\t\t\t<Add option=\"-Wl,--entry,%s%s\" />\r\n", "_", module.GetEntryPoint(false).c_str () );
+                       fprintf ( OUT, "\t\t\t\t\t<Add option=\"-Wl,--entry,%s%s\" />\r\n", "_", module.GetEntryPoint().c_str () );
                        fprintf ( OUT, "\t\t\t\t\t<Add option=\"-Wl,--image-base,%s\" />\r\n", baseaddr == "" ? "0x40000" : baseaddr.c_str () );
 
                        if ( module.type == Win32DLL)
index a8de2ed..dbba33e 100644 (file)
@@ -1,32 +1,83 @@
-#~ #(module, objs, deps, ldflags, output, libs, subsys, entry, base, falign, salign)
-#~ define RBUILD_LINK
-
-#~ $(5) ${call RBUILD_output_dir,$(5)}$$(SEP)$(basename $(notdir $(5))).map: $(2) $(3) $(6) | ${call RBUILD_dir,$(5)}
-       #~ $$(ECHO_CC)
-       #~ $${ld} -subsystem=$(7) -entry=$(8) -base=$(9) -file-alignment=$(10) -section-alignment=$(11) $(2) $(6) ${call RBUILD_ldflags,$(1),$(4)} -o $(5)
-#~ ifeq ($(ROS_BUILDMAP),full)
-       #~ $$(ECHO_OBJDUMP)
-       #~ $${objdump} -d -S $$@ > ${call RBUILD_output_dir,$(5)}$$(SEP)$(basename $(notdir $(5))).map
-#~ else
-#~ ifeq ($(ROS_BUILDMAP),yes)
-       #~ $$(ECHO_NM)
-       #~ $${nm} --numeric-sort $$@ > ${call RBUILD_output_dir,$(5)}$$(SEP)$(basename $(notdir $(5))).map
-#~ endif
-#~ endif
-#~ ifeq ($(ROS_BUILDNOSTRIP),yes)
-       #~ $$(ECHO_CP)
-       #~ $${cp} $(5) $(basename $(5)).nostrip$(suffix $(5)) 1>$(NUL)
-#~ endif
-#~ ifneq ($(ROS_GENERATE_RSYM),no)
-       #~ $$(ECHO_RSYM)
-       #~ $$(Q)$$(rsym_TARGET) $$@ $$@
-#~ endif
-#~ ifeq ($(ROS_LEAN_AND_MEAN),yes)
-       #~ $$(ECHO_STRIP)
-       #~ $${strip} -s -x -X $$@
-#~ endif
-
-#~ endef
-
-#~ #(module, dependencies, ldflags, subsys, entry, base, falign, salign)
-#~ RBUILD_LINK_RULE=${call RBUILD_LINK,$(1),$(1)_OBJS,$(2),$(3),$(1)_TARGET,$(1)_LIBS,$(4),$(5),$(6),$(7),$(8)}
+LDFLAG_DLL:=-shared
+LDFLAG_DRIVER:=-shared --subsystem=native
+LDFLAG_NOSTDLIB:=-nostartfiles -nostdlib
+LDFLAG_CONSOLE:=--subsystem=console
+LDFLAG_WINDOWS:=--subsystem=windows
+LDFLAG_NATIVE:=--subsystem=native
+
+#~ #(module, objs, deps, ldflags, output, def, libs, entry, base)
+#(module, objs, deps, ldflags, output, def, libs, entry, base, extralibs)
+define RBUILD_LINK
+
+ifneq ($(6),)
+${call RBUILD_intermediate_dir,$(5)}$$(SEP)lib${call RBUILD_name,$(5)}.a: $(6) | ${call RBUILD_intermediate_path,$(5)}
+       $$(ECHO_IMPLIB)
+       $${dlltool} --def $(6) --kill-at --output-lib=$$@
+
+${call RBUILD_intermediate_dir,$(5)}$$(SEP)lib${call RBUILD_name,$(5)}.delayimp.a: $(6) | ${call RBUILD_intermediate_path,$(5)}
+       $$(ECHO_IMPLIB)
+       $${dlltool} --def $(6) --kill-at --output-delaylib=$$@
+
+${call RBUILD_intermediate_path_noext,$(5)}.exp: $(6) | ${call RBUILD_intermediate_path,$(5)}
+       $$(ECHO_IMPLIB)
+       $${dlltool} --def $(6) --kill-at --output-exp=$$@
+
+$(1)_CLEANFILES+=\
+       ${call RBUILD_intermediate_dir,$(5)}$$(SEP)lib$(notdir $(5)).a \
+       ${call RBUILD_intermediate_dir,$(5)}$$(SEP)lib$(notdir $(5)).delayimp.a \
+       ${call RBUILD_intermediate_path_noext,$(5)}.exp
+endif
+
+# TODO: refactor this out of here and into rules.mak
+${call RBUILD_intermediate_dir,$(5)}$$(SEP)$(1)_objs.rsp: $(2) $$(if $(6),${call RBUILD_intermediate_path_noext,$(5)}.exp) $(3) | ${call RBUILD_intermediate_dir,$(5)}
+       $$(ECHO_RSP)
+       -@$${rm} $$@ 2>$$(NUL)
+       $${cp} $$(NUL) $$@ >$$(NUL)
+       $$(foreach obj,$(2) $$(if $(6),${call RBUILD_intermediate_path_noext,$(5)}.exp),$$(Q)echo $$(QUOTE)$$(subst \,\\,$$(obj))$$(QUOTE)>>$$@$$(NL))
+
+$(1)_CLEANFILES+=${call RBUILD_intermediate_dir,$(5)}$$(SEP)$(1)_objs.rsp
+
+$(5): ${call RBUILD_intermediate_dir,$(5)}$$(SEP)$(1)_objs.rsp $(7) $(3) $$(RSYM_TARGET) $$(PEFIXUP_TARGET) | ${call RBUILD_dir,$(5)}
+       $$(ECHO_LD)
+#~     $${ld} --entry=$(8) --image-base=$(9) @${call RBUILD_intermediate_dir,$(5)}$$(SEP)$(1)_objs.rsp $(7) ${call RBUILD_ldflags,$(1),$(4)} -o $$@
+       $${ld} --entry=$(8) --image-base=$(9) @${call RBUILD_intermediate_dir,$(5)}$$(SEP)$(1)_objs.rsp $(10) $(7) $(10) ${call RBUILD_ldflags,$(1),$(4)} -o $$@
+ifneq ($(or $(6),$$(MODULETYPE$$($(1)_TYPE)_KMODE)),)
+       $$(ECHO_PEFIXUP)
+       $$(Q)$$(PEFIXUP_TARGET) $$@ $(if $(6),-exports) $$(if $$(MODULETYPE$($(1)_TYPE)_KMODE),-sections)
+endif
+ifeq ($(ROS_BUILDMAP),full)
+       $$(ECHO_OBJDUMP)
+       $${objdump} -d -S $$@ > ${call RBUILD_output_path_noext,$(5)}.map
+else
+ifeq ($(ROS_BUILDMAP),yes)
+       $$(ECHO_NM)
+       $${nm} --numeric-sort $$@ > ${call RBUILD_output_path_noext,$(5)}.map
+endif
+endif
+ifeq ($(ROS_BUILDNOSTRIP),yes)
+       $$(ECHO_CP)
+       $${cp} $(5) $(basename $(5)).nostrip$(suffix $(5)) 1>$(NUL)
+endif
+ifneq ($(ROS_GENERATE_RSYM),no)
+       $$(ECHO_RSYM)
+       $$(Q)$$(RSYM_TARGET) $$@ $$@
+endif
+ifeq ($(ROS_LEAN_AND_MEAN),yes)
+       $$(ECHO_STRIP)
+       $${strip} -s -x -X $$@
+endif
+
+ifneq ($(ROS_BUILDMAP),)
+$(1)_CLEANFILES+=${call RBUILD_output_path_noext,$(5)}.map
+endif
+
+ifeq ($(ROS_BUILDNOSTRIP),yes)
+$(1)_CLEANFILES+=$(basename $(5)).nostrip$(suffix $(5))
+endif
+
+endef
+
+#~ #(module, def, deps, ldflags, libs, entry, base)
+#~ RBUILD_LINK_RULE=${call RBUILD_LINK,$(1),$(value $(1)_OBJS),$(3),$(4),$(value $(1)_TARGET),$(2),$(5) $(value $(1)_LIBS) $(5),$(6),$(7)}
+#(module, def, deps, ldflags, libs, entry, base, extralibs)
+RBUILD_LINK_RULE=${call RBUILD_LINK,$(1),$(value $(1)_OBJS),$(3),$(4),$(value $(1)_TARGET),$(2),$(value $(1)_LIBS),$(6),$(7),$(5)}
index dd7fb47..aa4c3fe 100644 (file)
@@ -38,16 +38,16 @@ const struct ModuleHandlerInformations ModuleHandlerInformations[] = {
        { HostTrue, "", "", "" }, // BuildTool
        { HostFalse, "", "", "" }, // StaticLibrary
        { HostFalse, "", "", "" }, // ObjectLibrary
-       { HostFalse, "", "", "" }, // Kernel
-       { HostFalse, "", "", "" }, // KernelModeDLL
-       { HostFalse, "-D__NTDRIVER__", "", "" }, // KernelModeDriver
-       { HostFalse, "", "", "" }, // NativeDLL
-       { HostFalse, "-D__NTAPP__", "", "" }, // NativeCUI
-       { HostFalse, "", "", "" }, // Win32DLL
-       { HostFalse, "", "", "" }, // Win32OCX
-       { HostFalse, "", "", "" }, // Win32CUI
-       { HostFalse, "", "", "" }, // Win32GUI
-       { HostFalse, "", "", "-nostartfiles -nostdlib" }, // BootLoader
+       { HostFalse, "", "", "$(LDFLAG_DRIVER)" }, // Kernel
+       { HostFalse, "", "", "$(LDFLAG_DRIVER)" }, // KernelModeDLL
+       { HostFalse, "-D__NTDRIVER__", "", "$(LDFLAG_DRIVER)" }, // KernelModeDriver
+       { HostFalse, "", "", "$(LDFLAG_DLL)" }, // NativeDLL
+       { HostFalse, "-D__NTAPP__", "", "$(LDFLAG_NATIVE)" }, // NativeCUI
+       { HostFalse, "", "", "$(LDFLAG_DLL)" }, // Win32DLL
+       { HostFalse, "", "", "$(LDFLAG_DLL)" }, // Win32OCX
+       { HostFalse, "", "", "$(LDFLAG_CONSOLE)" }, // Win32CUI
+       { HostFalse, "", "", "$(LDFLAG_WINDOWS)" }, // Win32GUI
+       { HostFalse, "", "", "" }, // BootLoader
        { HostFalse, "", "-f bin", "" }, // BootSector
        { HostFalse, "", "", "" }, // Iso
        { HostFalse, "", "", "" }, // LiveIso
@@ -55,8 +55,8 @@ const struct ModuleHandlerInformations ModuleHandlerInformations[] = {
        { HostFalse, "", "", "" }, // RpcServer
        { HostFalse, "", "", "" }, // RpcClient
        { HostFalse, "", "", "" }, // Alias
-       { HostFalse, "", "", "-nostartfiles -nostdlib" }, // BootProgram
-       { HostFalse, "", "", "" }, // Win32SCR
+       { HostFalse, "", "", "" }, // BootProgram
+       { HostFalse, "", "", "$(LDFLAG_WINDOWS)" }, // Win32SCR
        { HostFalse, "", "", "" }, // IdlHeader
        { HostFalse, "", "", "" }, // IdlInterface
        { HostFalse, "", "", "" }, // EmbeddedTypeLib
@@ -64,7 +64,7 @@ const struct ModuleHandlerInformations ModuleHandlerInformations[] = {
        { HostFalse, "", "", "" }, // RpcProxy
        { HostTrue, "", "", "" }, // HostStaticLibrary
        { HostFalse, "", "", "" }, // Cabinet
-       { HostFalse, "", "", "" }, // KeyboardLayout
+       { HostFalse, "", "", "$(LDFLAG_DLL)" }, // KeyboardLayout
        { HostFalse, "", "", "" }, // MessageHeader
 };
 
@@ -413,17 +413,17 @@ MingwBackend::GenerateGlobalProperties (
 }
 
 string
-MingwBackend::GenerateProjectLFLAGS () const
+MingwBackend::GenerateProjectLDFLAGS () const
 {
-       string lflags;
+       string ldflags;
        for ( size_t i = 0; i < ProjectNode.linkerFlags.size (); i++ )
        {
                LinkerFlag& linkerFlag = *ProjectNode.linkerFlags[i];
-               if ( lflags.length () > 0 )
-                       lflags += " ";
-               lflags += linkerFlag.flag;
+               if ( ldflags.length () > 0 )
+                       ldflags += " ";
+               ldflags += linkerFlag.flag;
        }
-       return lflags;
+       return ldflags;
 }
 
 void
@@ -478,24 +478,21 @@ MingwBackend::GenerateGlobalVariables () const
 
                // Would be nice to have our own C++ runtime
                fputs ( "BUILTIN_CXXINCLUDES+= $(TARGET_CPPFLAGS)\n", fMakefile );
-       }
 
-       // Because RosBE gcc is built to suck
-       fputs ( "BUILTIN_HOST_CINCLUDES+= $(HOST_CFLAGS)\n", fMakefile );
-       fputs ( "BUILTIN_HOST_CPPINCLUDES+= $(HOST_CFLAGS)\n", fMakefile );
-       fputs ( "BUILTIN_HOST_CXXINCLUDES+= $(HOST_CPPFLAGS)\n", fMakefile );
+               fprintf ( fMakefile, "PROJECT_CCLIBS := \"$(shell ${TARGET_CC} -print-libgcc-file-name)\"\n" );
+               fprintf ( fMakefile, "PROJECT_CXXLIBS := \"$(shell ${TARGET_CPP} -print-file-name=libstdc++.a)\" \"$(shell ${TARGET_CPP} -print-file-name=libgcc.a)\" \"$(shell ${TARGET_CPP} -print-file-name=libmingw32.a)\" \"$(shell ${TARGET_CPP} -print-file-name=libmingwex.a)\" \"$(shell ${TARGET_CPP} -print-file-name=libcoldname.a)\"\n" );
+
+               /* hack to get libgcc_eh.a, should check mingw version or something */
+               if (Environment::GetArch() == "amd64")
+               {
+                       fprintf ( fMakefile, "PROJECT_LPPFLAGS += $(shell ${TARGET_CPP} -print-file-name=libgcc_eh.a)\n" );
+               }
+       }
 
        MingwModuleHandler::GenerateParameters ( "PROJECT", "+=", ProjectNode.non_if_data );
        MingwModuleHandler::GenerateParameters ( "PROJECT_HOST", "+=", ProjectNode.host_non_if_data );
 
-       // TODO: linker flags
-       fprintf ( fMakefile, "PROJECT_LFLAGS := '$(shell ${TARGET_CC} -print-libgcc-file-name)' %s\n", GenerateProjectLFLAGS ().c_str () );
-       fprintf ( fMakefile, "PROJECT_LPPFLAGS := '$(shell ${TARGET_CPP} -print-file-name=libstdc++.a)' '$(shell ${TARGET_CPP} -print-file-name=libgcc.a)' '$(shell ${TARGET_CPP} -print-file-name=libmingw32.a)' '$(shell ${TARGET_CPP} -print-file-name=libmingwex.a)'\n" );
-       /* hack to get libgcc_eh.a, should check mingw version or something */
-       if (Environment::GetArch() == "amd64")
-       {
-           fprintf ( fMakefile, "PROJECT_LPPFLAGS += '$(shell ${TARGET_CPP} -print-file-name=libgcc_eh.a)'\n" );
-       }
+       fprintf ( fMakefile, "PROJECT_LDFLAGS := %s\n", GenerateProjectLDFLAGS ().c_str () );
 
        // TODO: use symbolic names for module types
        for ( size_t i = 0; i < sizeof(ModuleHandlerInformations) / sizeof(ModuleHandlerInformations[0]); ++ i )
@@ -509,25 +506,37 @@ MingwBackend::GenerateGlobalVariables () const
                                                  ModuleHandlerInformations[i].cflags );
                }
 
-               if ( ModuleHandlerInformations[i].cflags && ModuleHandlerInformations[i].cflags[0] )
+               if ( ModuleHandlerInformations[i].nasmflags && ModuleHandlerInformations[i].nasmflags[0] )
                {
                                fprintf ( fMakefile,
                                                  "MODULETYPE%d_%sFLAGS:=%s\n",
                                                  (int)i,
-                                                 "CXX",
-                                                 ModuleHandlerInformations[i].cflags );
+                                                 "NASM",
+                                                 ModuleHandlerInformations[i].nasmflags );
                }
 
-               if ( ModuleHandlerInformations[i].nasmflags && ModuleHandlerInformations[i].nasmflags[0] )
+               if ( ModuleHandlerInformations[i].linkerflags && ModuleHandlerInformations[i].linkerflags[0] )
                {
                                fprintf ( fMakefile,
                                                  "MODULETYPE%d_%sFLAGS:=%s\n",
                                                  (int)i,
-                                                 "NASM",
-                                                 ModuleHandlerInformations[i].nasmflags );
+                                                 "LD",
+                                                 ModuleHandlerInformations[i].linkerflags );
                }
        }
 
+       fprintf ( fMakefile,
+                         "MODULETYPE%d_KMODE:=yes\n",
+                         (int)Kernel );
+
+       fprintf ( fMakefile,
+                         "MODULETYPE%d_KMODE:=yes\n",
+                         (int)KernelModeDLL );
+
+       fprintf ( fMakefile,
+                         "MODULETYPE%d_KMODE:=yes\n",
+                         (int)KernelModeDriver );
+
        fprintf ( fMakefile, "\n" );
 }
 
index d7bd6fc..c4331b9 100644 (file)
@@ -66,7 +66,7 @@ private:
        void GenerateHeader () const;
        void GenerateGlobalProperties ( const char* assignmentOperation,
                                                                          const IfableData& data ) const;
-       std::string GenerateProjectLFLAGS () const;
+       std::string GenerateProjectLDFLAGS () const;
        void GenerateDirectories ();
        void GenerateGlobalVariables () const;
        bool IncludeInAllTarget ( const Module& module ) const;
index 6960c0a..174e696 100644 (file)
@@ -290,9 +290,7 @@ MingwModuleHandler::GetModuleArchiveFilename () const
 {
        if ( IsStaticLibrary ( module ) )
                return GetTargetFilename ( module, NULL );
-       return new FileLocation ( IntermediateDirectory,
-                                 module.output->relative_path,
-                                 ReplaceExtension ( module.name, ".temp.a" ) );
+       return NULL;
 }
 
 /*static*/ bool
@@ -518,6 +516,9 @@ MingwModuleHandler::GenerateCleanTarget () const
        }
        fprintf ( fMakefile, " 2>$(NUL)\n" );
 
+       // Clean files generated by external rules
+       fprintf ( fMakefile, "\t-@${rm} $(%s_CLEANFILES) 2>$(NUL)\n", module.name.c_str() );
+
        if( ProxyMakefile::GenerateProxyMakefile(module) )
        {
                DirectoryLocation root;
@@ -1359,25 +1360,6 @@ MingwModuleHandler::GenerateBuildMapCode ( const FileLocation *mapTarget )
                  "endif\n" );
 }
 
-void
-MingwModuleHandler::GenerateBuildNonSymbolStrippedCode ()
-{
-       fprintf ( fMakefile, "# BUILD NO STRIP CODE\n" );
-
-       fprintf ( fMakefile,
-                 "ifeq ($(ROS_BUILDNOSTRIP),yes)\n" );
-
-       FileLocation nostripFilename ( OutputDirectory,
-                                      module.output->relative_path,
-                                      GetBasename ( module.output->name ) + ".nostrip" + GetExtension ( *module.output ) );
-       CLEAN_FILE ( nostripFilename );
-
-       OutputCopyCommand ( *module.output, nostripFilename );
-
-       fprintf ( fMakefile,
-                 "endif\n" );
-}
-
 void
 MergeStringVector ( const Backend* backend,
                     const vector<FileLocation>& input,
@@ -1438,168 +1420,69 @@ MingwModuleHandler::GenerateCleanObjectsAsYouGoCode () const
 }
 
 void
-MingwModuleHandler::GenerateRunRsymCode () const
-{
-       fprintf ( fMakefile, "# RUN RSYM CODE\n" );
-       fprintf ( fMakefile,
-             "ifneq ($(ROS_GENERATE_RSYM),no)\n" );
-       fprintf ( fMakefile,
-                 "\t$(ECHO_RSYM)\n" );
-       fprintf ( fMakefile,
-                 "\t$(Q)$(RSYM_TARGET) $@ $@\n\n" );
-       fprintf ( fMakefile,
-             "endif\n" );
-}
-
-void
-MingwModuleHandler::GenerateRunStripCode () const
-{
-       fprintf ( fMakefile, "# RUN STRIP CODE\n" );
-       fprintf ( fMakefile,
-                 "ifeq ($(ROS_LEAN_AND_MEAN),yes)\n" );
-       fprintf ( fMakefile,
-                 "\t$(ECHO_STRIP)\n" );
-       fprintf ( fMakefile,
-                 "\t${strip} -s -x -X $@\n\n" );
-       fprintf ( fMakefile,
-                 "endif\n" );
-}
-
-void
-MingwModuleHandler::GenerateLinkerCommand (
-       const string& dependencies,
-       const string& linkerParameters,
-       const string& pefixupParameters )
+MingwModuleHandler::GenerateLinkerCommand () const
 {
-       const FileLocation *target_file = GetTargetFilename ( module, NULL );
-       const FileLocation *definitionFilename = GetDefinitionFilename ();
-       string linker = "${ld}";
-       string objectsMacro = GetObjectsMacro ( module );
-       string libsMacro = GetLibsMacro ();
+       string definitionFilename;
 
-       fprintf ( fMakefile, "# LINKER COMMAND\n" );
+       const FileLocation *DefinitionFilename = GetDefinitionFilename ();
 
-       string target_macro ( GetTargetMacro ( module ) );
-       string target_folder ( backend->GetFullPath ( *target_file ) );
+       if ( DefinitionFilename ) {
+               definitionFilename = backend->GetFullName (*DefinitionFilename);
+               delete DefinitionFilename;
+}
 
        string linkerScriptArgument;
-       if ( module.linkerScript != NULL )
+       if ( module.linkerScript != NULL ) {
+               if ( module.project.configuration.Linker == GnuLd )
                        linkerScriptArgument = ssprintf ( " -T %s", backend->GetFullName ( *module.linkerScript->file ).c_str () );
                else
-               linkerScriptArgument = "";
-
-       /* check if we need to add default C++ libraries, ie if we have
-        * a C++ user-mode module without the -nostdlib linker flag
-        */
-       bool link_defaultlibs = module.cplusplus &&
-                               linkerParameters.find ("-nostdlib") == string::npos &&
-                               !(module.type == KernelModeDLL || module.type == KernelModeDriver);
-
-       if ( !module.HasImportLibrary() )
-       {
-               fprintf ( fMakefile,
-                       "%s: %s %s $(RSYM_TARGET) $(PEFIXUP_TARGET) | %s\n",
-                       target_macro.c_str (),
-                       definitionFilename ? backend->GetFullName ( *definitionFilename ).c_str () : "",
-                       dependencies.c_str (),
-                       target_folder.c_str () );
-               fprintf ( fMakefile, "\t$(ECHO_LD)\n" );
+                       fprintf ( stderr,
+                                         "Linker doesn't support linker scripts: linker script %s ignored for module %s\n",
+                                         backend->GetFullName ( *module.linkerScript->file ).c_str (),
+                                         module.name.c_str() );
+       }
+
+       string extraLibraries;
+       if ( ModuleHandlerInformations[module.type].DefaultHost == HostFalse ) {
+               if ( module.cplusplus ) {
+                       switch ( module.type )
+       {
+                       case Win32DLL:
+                       case Win32OCX:
+                       case Win32CUI:
+                       case Win32GUI:
+                       case Win32SCR:
+                               extraLibraries = "$$(PROJECT_CXXLIBS)";
+                               break;
 
-               fprintf ( fMakefile,
-                         "\t%s %s%s %s %s %s %s -o %s\n",
-                         linker.c_str (),
-                         linkerParameters.c_str (),
-                         linkerScriptArgument.c_str (),
-                         objectsMacro.c_str (),
-                         link_defaultlibs ? "$(PROJECT_LPPFLAGS) " : "",
-                         libsMacro.c_str (),
-                         GetLinkerMacro ().c_str (),
-                         target_macro.c_str () );
+                       default:
+                               extraLibraries = "$$(PROJECT_CCLIBS)";
+                               break;
+       }
+               } else
+                       extraLibraries = "$$(PROJECT_CCLIBS)";
        }
-       else
-       {
-               FileLocation temp_exp ( IntermediateDirectory,
-                                       module.output->relative_path,
-                                       module.name + ".exp" );
-               CLEAN_FILE ( temp_exp );
-
-               fprintf ( fMakefile,
-                       "%s: %s | %s\n",
-                       backend->GetFullName ( temp_exp ).c_str (),
-                       definitionFilename ? backend->GetFullName ( *definitionFilename ).c_str () : "",
-                       backend->GetFullPath ( temp_exp ).c_str () );
-               fprintf ( fMakefile, "\t$(ECHO_DLLTOOL)\n" );
-
-               fprintf ( fMakefile,
-                         "\t${dlltool} --dllname %s --def %s --output-exp $@%s%s\n",
-                         module.GetDllName ().c_str (),
-                         definitionFilename ? backend->GetFullName ( *definitionFilename ).c_str () : "",
-                         module.mangledSymbols ? "" : " --kill-at",
-                         module.underscoreSymbols ? " --add-underscore" : "" );
 
-               fprintf ( fMakefile,
-                       "%s: %s %s $(RSYM_TARGET) $(PEFIXUP_TARGET) | %s\n",
-                       target_macro.c_str (),
-                       backend->GetFullName ( temp_exp ).c_str (),
-                       dependencies.c_str (),
-                       target_folder.c_str () );
-               fprintf ( fMakefile, "\t$(ECHO_LD)\n" );
+       delete PassThruCacheDirectory ( new FileLocation ( module.output->directory, module.output->relative_path, "" ) );
+       delete PassThruCacheDirectory ( new FileLocation ( IntermediateDirectory, module.output->relative_path, "" ) );
 
                fprintf ( fMakefile,
-                         "\t%s %s%s %s %s %s %s %s -o %s\n",
-
-                         linker.c_str (),
-                         linkerParameters.c_str (),
+                         "$(eval $(call RBUILD_LINK_RULE,%s,%s,%s,%s,%s,%s,%s))\n",
+                         module.name.c_str(),
+                         definitionFilename.c_str(),
+                         module.xmlbuildFile.c_str(),
                          linkerScriptArgument.c_str (),
-                         backend->GetFullName ( temp_exp ).c_str (),
-                         objectsMacro.c_str (),
-                         link_defaultlibs ? "$(PROJECT_LPPFLAGS) " : "",
-                         libsMacro.c_str (),
-                         GetLinkerMacro ().c_str (),
-                         target_macro.c_str () );
-
-               fprintf ( fMakefile,
-                         "\t$(Q)$(PEFIXUP_TARGET) %s -exports%s\n",
-                         target_macro.c_str (),
-                         pefixupParameters.c_str() );
+                         extraLibraries.c_str(),
+                         module.GetEntryPoint().c_str(),
+                         module.baseaddress.c_str() );
        }
 
-       GenerateBuildMapCode ();
-       GenerateBuildNonSymbolStrippedCode ();
-       GenerateRunRsymCode ();
-       GenerateRunStripCode ();
-       GenerateCleanObjectsAsYouGoCode ();
-
-       if ( definitionFilename )
-               delete definitionFilename;
-       delete target_file;
-}
-
-void
-MingwModuleHandler::GeneratePhonyTarget() const
-{
-       string targetMacro ( GetTargetMacro ( module ) );
-       const FileLocation *target_file = GetTargetFilename ( module, NULL );
-
-       fprintf ( fMakefile, "# PHONY TARGET\n" );
-       fprintf ( fMakefile,
-                 ".PHONY: %s\n\n",
-                 targetMacro.c_str ());
-       fprintf ( fMakefile, "%s: | %s\n",
-                 targetMacro.c_str (),
-                 backend->GetFullPath ( *target_file ).c_str () );
-
-       delete target_file;
-}
-
 void
 MingwModuleHandler::GenerateObjectFileTargets ( const IfableData& data )
 {
        size_t i;
        string moduleDependencies;
 
-       fprintf ( fMakefile, "# OBJECT FILE TARGETS\n" );
-
        const vector<CompilationUnit*>& compilationUnits = data.compilationUnits;
        for ( i = 0; i < compilationUnits.size (); i++ )
        {
@@ -1642,8 +1525,6 @@ MingwModuleHandler::GenerateObjectFileTargets ( const IfableData& data )
 void
 MingwModuleHandler::GenerateObjectFileTargets ()
 {
-       fprintf ( fMakefile, "# OBJECT FILE TARGETS\n" );
-
        if ( module.pch && use_pch )
        {
 
@@ -1660,12 +1541,9 @@ MingwModuleHandler::GenerateObjectFileTargets ()
                        pchCxxRule.Execute ( fMakefile, backend, module, module.pch->file, clean_files, dependencies );
                else
                        pchRule.Execute ( fMakefile, backend, module, module.pch->file, clean_files, dependencies );
-
-               fprintf ( fMakefile, "\n" );
        }
 
        GenerateObjectFileTargets ( module.non_if_data );
-       fprintf ( fMakefile, "\n" );
 }
 
 /* caller needs to delete the returned object */
@@ -1673,6 +1551,10 @@ const FileLocation*
 MingwModuleHandler::GenerateArchiveTarget ()
 {
        const FileLocation *archiveFilename = GetModuleArchiveFilename ();
+
+       if ( archiveFilename == NULL )
+               return NULL;
+
        const FileLocation *definitionFilename = GetDefinitionFilename ();
 
        fprintf ( fMakefile, "# ARCHIVE TARGET\n" );
@@ -1687,11 +1569,8 @@ MingwModuleHandler::GenerateArchiveTarget ()
                                                  backend->GetFullName ( *definitionFilename ).c_str () );
 
                fprintf ( fMakefile,
-                         "\t${dlltool} --dllname %s --def %s --output-lib $@%s%s\n",
-                         module.GetDllName ().c_str (),
-                         backend->GetFullName ( *definitionFilename ).c_str (),
-                         module.mangledSymbols ? "" : " --kill-at",
-                         module.underscoreSymbols ? " --add-underscore" : "" );
+                         "\t${dlltool} --def %s --kill-at --output-lib $@\n",
+                         backend->GetFullName ( *definitionFilename ).c_str () );
        }
        else
                arRule1.Execute ( fMakefile, backend, module, archiveFilename, clean_files );
@@ -1727,7 +1606,7 @@ MingwModuleHandler::GetLibsMacro () const
 string
 MingwModuleHandler::GetLinkerMacro () const
 {
-       return ssprintf ( "$(%s_LFLAGS)",
+       return ssprintf ( "$(%s_LDFLAGS)",
                          module.name.c_str () );
 }
 
@@ -1842,7 +1721,7 @@ MingwModuleHandler::GenerateOtherMacros ()
 {
        set<const Define *> used_defs;
 
-       linkerflagsMacro = ssprintf ("%s_LFLAGS", module.name.c_str ());
+       linkerflagsMacro = ssprintf ("%s_LDFLAGS", module.name.c_str ());
        libsMacro = ssprintf("%s_LIBS", module.name.c_str ());
 
        const FileLocation * pchPath = GetPrecompiledHeaderPath ();
@@ -1897,28 +1776,6 @@ MingwModuleHandler::GenerateOtherMacros ()
 
        GenerateParameters ( module.name.c_str(), "+=", module.non_if_data );
 
-       const char *linkerflags = ModuleHandlerInformations[module.type].linkerflags;
-       if ( strlen( linkerflags ) > 0 )
-       {
-               fprintf ( fMakefile,
-                         "%s += %s\n\n",
-                         linkerflagsMacro.c_str (),
-                         linkerflags );
-       }
-
-       // FIXME: make rules for linker, move standard flags there
-       if ( ModuleHandlerInformations[module.type].DefaultHost == HostFalse )
-       {
-               if ( module.cplusplus )
-                       fprintf ( fMakefile,
-                                         "%s+= $(PROJECT_LPPFLAGS)\n\n",
-                                         linkerflagsMacro.c_str () );
-               else
-                       fprintf ( fMakefile,
-                                         "%s+= $(PROJECT_LFLAGS)\n\n",
-                                         linkerflagsMacro.c_str () );
-       }
-
        GenerateMacros (
                "+=",
                module.non_if_data,
@@ -1957,6 +1814,8 @@ MingwModuleHandler::GenerateRules ()
        if ( !ReferenceObjects ( module ) )
        {
                const FileLocation* ar_target = GenerateArchiveTarget ();
+
+               if ( ar_target )
                delete ar_target;
        }
 
@@ -2158,61 +2017,6 @@ MingwModuleHandler::GetDefinitionFilename () const
        }
 }
 
-void
-MingwModuleHandler::GenerateImportLibraryTarget (
-       const FileLocation *defFilename,
-       const FileLocation *library_target,
-       bool delayimp)
-{
-       string empty = "tools" + sSep + "rbuild" + sSep + "empty.def";
-
-       fprintf ( fMakefile, "# IMPORT LIBRARY RULE\n" );
-
-       fprintf ( fMakefile, "%s:",
-                 backend->GetFullName ( *library_target ).c_str () );
-
-       if ( defFilename )
-       {
-               fprintf ( fMakefile, " %s",
-                         backend->GetFullName ( *defFilename ).c_str () );
-       }
-
-       fprintf ( fMakefile, " | %s\n",
-                 backend->GetFullPath ( *library_target ).c_str () );
-
-       fprintf ( fMakefile, "\t$(ECHO_DLLTOOL)\n" );
-
-       fprintf ( fMakefile,
-                 "\t${dlltool} --dllname %s --def %s %s %s%s%s\n\n",
-                 module.GetDllName ().c_str (),
-                 defFilename ? backend->GetFullName ( *defFilename ).c_str ()
-                             : empty.c_str (),
-                 delayimp ? "--output-delaylib" : "--output-lib",
-                 backend->GetFullName ( *library_target ).c_str (),
-                 module.mangledSymbols ? "" : " --kill-at",
-                 module.underscoreSymbols ? " --add-underscore" : "" );
-}
-
-void
-MingwModuleHandler::GenerateImportLibraryTargetIfNeeded ()
-{
-       if ( module.importLibrary != NULL )
-       {
-               const FileLocation *library_target = GetImportLibraryFilename ( module, &clean_files, false );
-               const FileLocation *delayimp_target = GetImportLibraryFilename ( module, &clean_files, true );
-               const FileLocation *defFilename = GetDefinitionFilename ();
-
-               GenerateImportLibraryTarget(defFilename, library_target, false);
-               GenerateImportLibraryTarget(defFilename, delayimp_target, true);
-
-               if ( defFilename )
-                       delete defFilename;
-               delete library_target;
-               delete delayimp_target;
-
-       }
-}
-
 void
 MingwModuleHandler::GetSpecObjectDependencies (
        vector<FileLocation>& dependencies,
@@ -2402,31 +2206,9 @@ MingwKernelModuleHandler::Process ()
 void
 MingwKernelModuleHandler::GenerateKernelModuleTarget ()
 {
-       string targetMacro ( GetTargetMacro ( module ) );
-       string workingDirectory = GetWorkingDirectory ( );
-       string libsMacro = GetLibsMacro ();
-
-       GenerateImportLibraryTargetIfNeeded ();
-
-       if ( module.non_if_data.compilationUnits.size () > 0 )
-       {
                GenerateRules ();
-
-               string dependencies = libsMacro + " " + objectsMacro;
-
-               string linkerParameters = ssprintf ( "-subsystem=native -entry=%s -image-base=%s",
-                                                    module.GetEntryPoint(!(Environment::GetArch() == "arm")).c_str (),
-                                                    module.baseaddress.c_str () );
-
-               GenerateLinkerCommand ( dependencies,
-                                       linkerParameters + " $(NTOSKRNL_SHARED)",
-                                       " -sections" );
-       }
-       else
-       {
-               GeneratePhonyTarget();
+       GenerateLinkerCommand ();
        }
-}
 
 
 MingwKernelModeDLLModuleHandler::MingwKernelModeDLLModuleHandler (
@@ -2453,30 +2235,9 @@ MingwKernelModeDLLModuleHandler::Process ()
 void
 MingwKernelModeDLLModuleHandler::GenerateKernelModeDLLModuleTarget ()
 {
-       string targetMacro ( GetTargetMacro ( module ) );
-       string workingDirectory = GetWorkingDirectory ();
-       string libsMacro = GetLibsMacro ();
-
-       GenerateImportLibraryTargetIfNeeded ();
-
-       if ( module.non_if_data.compilationUnits.size () > 0 )
-       {
                GenerateRules ();
-
-               string dependencies = libsMacro + " " + objectsMacro;
-
-               string linkerParameters = ssprintf ( "-subsystem=native -entry=%s -image-base=%s -file-alignment=0x1000 -section-alignment=0x1000 -shared",
-                                                    module.GetEntryPoint(!(Environment::GetArch() == "arm")).c_str (),
-                                                    module.baseaddress.c_str () );
-               GenerateLinkerCommand ( dependencies,
-                                       linkerParameters,
-                                       " -sections" );
+       GenerateLinkerCommand ();
        }
-       else
-       {
-               GeneratePhonyTarget();
-       }
-}
 
 
 MingwNativeDLLModuleHandler::MingwNativeDLLModuleHandler (
@@ -2502,30 +2263,9 @@ MingwNativeDLLModuleHandler::Process ()
 void
 MingwNativeDLLModuleHandler::GenerateNativeDLLModuleTarget ()
 {
-       string targetMacro ( GetTargetMacro (module) );
-       string workingDirectory = GetWorkingDirectory ( );
-       string libsMacro = GetLibsMacro ();
-
-       GenerateImportLibraryTargetIfNeeded ();
-
-       if ( module.non_if_data.compilationUnits.size () > 0 )
-       {
                GenerateRules ();
-
-               string dependencies = libsMacro + " " + objectsMacro;
-
-               string linkerParameters = ssprintf ( "-subsystem=native -entry=%s -image-base=%s -file-alignment=0x1000 -section-alignment=0x1000 -shared",
-                                                    module.GetEntryPoint(!(Environment::GetArch() == "arm")).c_str (),
-                                                    module.baseaddress.c_str () );
-               GenerateLinkerCommand ( dependencies,
-                                       linkerParameters,
-                                       "" );
-       }
-       else
-       {
-               GeneratePhonyTarget();
+       GenerateLinkerCommand ();
        }
-}
 
 
 MingwNativeCUIModuleHandler::MingwNativeCUIModuleHandler (
@@ -2551,30 +2291,9 @@ MingwNativeCUIModuleHandler::Process ()
 void
 MingwNativeCUIModuleHandler::GenerateNativeCUIModuleTarget ()
 {
-       string targetMacro ( GetTargetMacro (module) );
-       string workingDirectory = GetWorkingDirectory ( );
-       string libsMacro = GetLibsMacro ();
-
-       GenerateImportLibraryTargetIfNeeded ();
-
-       if ( module.non_if_data.compilationUnits.size () > 0 )
-       {
                GenerateRules ();
-
-               string dependencies = libsMacro + " " + objectsMacro;
-
-               string linkerParameters = ssprintf ( "-subsystem=native -entry=%s -image-base=%s -file-alignment=0x1000 -section-alignment=0x1000",
-                                                    module.GetEntryPoint(!(Environment::GetArch() == "arm")).c_str (),
-                                                    module.baseaddress.c_str () );
-               GenerateLinkerCommand ( dependencies,
-                                       linkerParameters,
-                                       "" );
-       }
-       else
-       {
-               GeneratePhonyTarget();
+       GenerateLinkerCommand ();
        }
-}
 
 
 MingwWin32DLLModuleHandler::MingwWin32DLLModuleHandler (
@@ -2641,30 +2360,9 @@ MingwWin32DLLModuleHandler::Process ()
 void
 MingwWin32DLLModuleHandler::GenerateWin32DLLModuleTarget ()
 {
-       string targetMacro ( GetTargetMacro (module) );
-       string workingDirectory = GetWorkingDirectory ( );
-       string libsMacro = GetLibsMacro ();
-
-       GenerateImportLibraryTargetIfNeeded ();
-
-       if ( module.non_if_data.compilationUnits.size () > 0 )
-       {
                GenerateRules ();
-
-               string dependencies = libsMacro + " " + objectsMacro;
-
-               string linkerParameters = ssprintf ( "-subsystem=console -entry=%s -image-base=%s -file-alignment=0x1000 -section-alignment=0x1000 -shared",
-                                                    module.GetEntryPoint(!(Environment::GetArch() == "arm")).c_str (),
-                                                    module.baseaddress.c_str () );
-               GenerateLinkerCommand ( dependencies,
-                                       linkerParameters,
-                                       "" );
-       }
-       else
-       {
-               GeneratePhonyTarget();
+       GenerateLinkerCommand ();
        }
-}
 
 
 void
@@ -2682,30 +2380,9 @@ MingwWin32OCXModuleHandler::Process ()
 void
 MingwWin32OCXModuleHandler::GenerateWin32OCXModuleTarget ()
 {
-       string targetMacro ( GetTargetMacro (module) );
-       string workingDirectory = GetWorkingDirectory ( );
-       string libsMacro = GetLibsMacro ();
-
-       GenerateImportLibraryTargetIfNeeded ();
-
-       if ( module.non_if_data.compilationUnits.size () > 0 )
-       {
                GenerateRules ();
-
-               string dependencies = libsMacro + " " + objectsMacro;
-
-               string linkerParameters = ssprintf ( "-subsystem=console -entry=%s -image-base=%s -file-alignment=0x1000 -section-alignment=0x1000 -shared",
-                                                    module.GetEntryPoint(!(Environment::GetArch() == "arm")).c_str (),
-                                                    module.baseaddress.c_str () );
-               GenerateLinkerCommand ( dependencies,
-                                       linkerParameters,
-                                       "" );
+       GenerateLinkerCommand ();
        }
-       else
-       {
-               GeneratePhonyTarget();
-       }
-}
 
 
 MingwWin32CUIModuleHandler::MingwWin32CUIModuleHandler (
@@ -2730,30 +2407,9 @@ MingwWin32CUIModuleHandler::Process ()
 void
 MingwWin32CUIModuleHandler::GenerateWin32CUIModuleTarget ()
 {
-       string targetMacro ( GetTargetMacro (module) );
-       string workingDirectory = GetWorkingDirectory ( );
-       string libsMacro = GetLibsMacro ();
-
-       GenerateImportLibraryTargetIfNeeded ();
-
-       if ( module.non_if_data.compilationUnits.size () > 0 )
-       {
                GenerateRules ();
-
-               string dependencies = libsMacro + " " + objectsMacro;
-
-               string linkerParameters = ssprintf ( "-subsystem=console -entry=%s -image-base=%s -file-alignment=0x1000 -section-alignment=0x1000",
-                                                    module.GetEntryPoint(!(Environment::GetArch() == "arm")).c_str (),
-                                                    module.baseaddress.c_str () );
-               GenerateLinkerCommand ( dependencies,
-                                       linkerParameters,
-                                       "" );
-       }
-       else
-       {
-               GeneratePhonyTarget();
+       GenerateLinkerCommand ();
        }
-}
 
 
 MingwWin32GUIModuleHandler::MingwWin32GUIModuleHandler (
@@ -2778,30 +2434,9 @@ MingwWin32GUIModuleHandler::Process ()
 void
 MingwWin32GUIModuleHandler::GenerateWin32GUIModuleTarget ()
 {
-       string targetMacro ( GetTargetMacro (module) );
-       string workingDirectory = GetWorkingDirectory ( );
-       string libsMacro = GetLibsMacro ();
-
-       GenerateImportLibraryTargetIfNeeded ();
-
-       if ( module.non_if_data.compilationUnits.size () > 0 )
-       {
                GenerateRules ();
-
-               string dependencies = libsMacro + " " + objectsMacro;
-
-               string linkerParameters = ssprintf ( "-subsystem=windows -entry=%s -image-base=%s -file-alignment=0x1000 -section-alignment=0x1000",
-                                                    module.GetEntryPoint(!(Environment::GetArch() == "arm")).c_str (),
-                                                    module.baseaddress.c_str () );
-               GenerateLinkerCommand ( dependencies,
-                                       linkerParameters,
-                                       "" );
-       }
-       else
-       {
-               GeneratePhonyTarget();
+       GenerateLinkerCommand ();
        }
-}
 
 
 MingwBootLoaderModuleHandler::MingwBootLoaderModuleHandler (
@@ -2845,7 +2480,7 @@ MingwBootLoaderModuleHandler::GenerateBootLoaderModuleTarget ()
        if (Environment::GetArch() == "arm")
        {
                fprintf ( fMakefile,
-                        "\t${gcc} -Wl,--subsystem,native -o %s %s %s %s\n",
+                        "\t${gcc} -Wl,--subsystem,native -o %s %s %s %s -nostartfiles -nostdlib\n",
                         backend->GetFullName ( junk_tmp ).c_str (),
                         objectsMacro.c_str (),
                         libsMacro.c_str (),
@@ -2854,7 +2489,7 @@ MingwBootLoaderModuleHandler::GenerateBootLoaderModuleTarget ()
        else
        {
                fprintf ( fMakefile,
-                        "\t${gcc} -Wl,--subsystem,native -Wl,-Ttext,0x8000 -o %s %s %s %s\n",
+                        "\t${gcc} -Wl,--subsystem,native -Wl,-Ttext,0x8000 -o %s %s %s %s -nostartfiles -nostdlib\n",
                         backend->GetFullName ( junk_tmp ).c_str (),
                         objectsMacro.c_str (),
                         libsMacro.c_str (),
@@ -3400,30 +3035,9 @@ MingwTestModuleHandler::GetModuleSpecificCompilationUnits ( vector<CompilationUn
 void
 MingwTestModuleHandler::GenerateTestModuleTarget ()
 {
-       string targetMacro ( GetTargetMacro ( module ) );
-       string workingDirectory = GetWorkingDirectory ( );
-       string libsMacro = GetLibsMacro ();
-
-       GenerateImportLibraryTargetIfNeeded ();
-
-       if ( module.non_if_data.compilationUnits.size () > 0 )
-       {
                GenerateRules ();
-
-               string dependencies = libsMacro + " " + objectsMacro;
-
-               string linkerParameters = ssprintf ( "-subsystem=console -entry=%s -image-base=%s -file-alignment=0x1000 -section-alignment=0x1000",
-                                                    module.GetEntryPoint(!(Environment::GetArch() == "arm")).c_str (),
-                                                    module.baseaddress.c_str () );
-               GenerateLinkerCommand ( dependencies,
-                                       linkerParameters,
-                                       "" );
-       }
-       else
-       {
-               GeneratePhonyTarget();
+       GenerateLinkerCommand ();
        }
-}
 
 
 MingwAliasModuleHandler::MingwAliasModuleHandler (
index 57aaad2..b068717 100644 (file)
@@ -113,15 +113,9 @@ protected:
        std::string GetLinkerMacro () const;
        static std::string GetDebugFormat ();
        void GenerateCleanObjectsAsYouGoCode () const;
-       void GenerateRunRsymCode () const;
-       void GenerateRunStripCode () const;
-       void GenerateLinkerCommand ( const std::string& dependencies,
-                                    const std::string& linkerParameters,
-                                    const std::string& pefixupParameters );
-       void GeneratePhonyTarget() const;
+       void GenerateLinkerCommand () const;
        void GenerateBuildMapCode ( const FileLocation *mapTarget = NULL );
        void GenerateRules ();
-       void GenerateImportLibraryTarget (const FileLocation *defFilename, const FileLocation *library_target, bool delayimp);
        void GenerateImportLibraryTargetIfNeeded ();
        void GetDefinitionDependencies ( std::vector<FileLocation>& dependencies ) const;
        std::string GetLinkingDependencies () const;
index 9b9cc8c..40e30f7 100644 (file)
@@ -19,7 +19,7 @@ RBUILD_intermediate_dir=${call RBUILD_fullpath,$(value INTERMEDIATE)$(SEP)$(dir
 RBUILD_output_dir=${call RBUILD_fullpath,$(value OUTPUT)$(SEP)$(dir ${call RBUILD_strip_prefixes,$(1)})}
 
 #(source)
-RBUILD_source_name=$(basename $(notdir $(1)))
+RBUILD_name=$(basename $(notdir $(1)))
 
 #(source)
 RBUILD_dir=${call RBUILD_fullpath,$(dir ${call RBUILD_compress_prefixes,$(1)})}
index 31c638a..08c0479 100644 (file)
@@ -70,6 +70,7 @@ void MSVCBackend::Process()
        m_configurations.push_back ( new MSVCConfiguration( Debug ));
        m_configurations.push_back ( new MSVCConfiguration( Release ));
        m_configurations.push_back ( new MSVCConfiguration( Speed ));
+       m_configurations.push_back ( new MSVCConfiguration( RosBuild ));
 
        if (!only_msvc_headers)
        {
@@ -123,6 +124,8 @@ void MSVCBackend::ProcessModules()
 
                if (configuration.VSProjectVersion == "6.00")
                        _generate_dsp ( module );
+               else if (configuration.VSProjectVersion == "10.00")
+                       _generate_vcxproj ( module );
                else
                        _generate_vcproj ( module );
        }
@@ -285,10 +288,12 @@ std::string MSVCBackend::_get_vc_dir ( void ) const
                return "vc70";
        else if ( configuration.VSProjectVersion == "7.10" )
                return "vc71";
-       else if ( configuration.VSProjectVersion == "9.00" )
-               return "vc9";
-       else /* must be VS2005 */
+       else if ( configuration.VSProjectVersion == "8.00" )
                return "vc8";
+       else if ( configuration.VSProjectVersion == "10.00" )
+               return "vc10";
+       else /* default to VS2008 */
+               return "vc9";
 
 
 }
index 19845f6..8f3f3a8 100644 (file)
@@ -25,6 +25,7 @@
 
 #include "../backend.h"
 
+
 class FileUnit
 {
        public:
@@ -34,9 +35,28 @@ class FileUnit
 
 enum OptimizationType
 {
+       RosBuild,
        Debug,
        Release,
-       Speed
+       Speed,
+};
+
+enum ConfigurationType
+{
+       ConfigUnknown,
+       ConfigApp,
+       ConfigDll,
+       ConfigEmpty,
+       ConfigLib
+};
+
+enum BinaryType
+{
+       BinUnknown,
+       Lib,
+       Dll,
+       Exe,
+       Sys
 };
 
 enum HeadersType
@@ -123,7 +143,23 @@ class MSVCBackend : public Backend
 
                std::string _get_vc_dir ( void ) const;
 
+               // These are used in both _generate_vcproj and _generate_standard_configuration
+               std::vector<std::string> header_files;
+               std::vector<std::string> includes;
+               std::vector<std::string> includes_ros;
+               std::vector<std::string> libraries;
+               std::set<std::string> common_defines;
+               std::string baseaddr;
+
+               void _generate_standard_configuration(
+                       FILE* OUT,
+                       const Module& module,
+                       const MSVCConfiguration& cfg,
+                       BinaryType binaryType );
+               void _generate_makefile_configuration( FILE* OUT, const Module& module, const MSVCConfiguration& cfg );
+
                void _generate_vcproj ( const Module& module );
+               void _generate_vcxproj ( const Module& module );
 
                void _generate_sln_header ( FILE* OUT );
                void _generate_sln_footer ( FILE* OUT );
index 21595b6..1d304c6 100644 (file)
@@ -3,6 +3,7 @@
  * Copyright (C) 2005 Royce Mitchell III
  * Copyright (C) 2006 Hervé Poussineau
  * Copyright (C) 2006 Christoph von Wittich
+ * Copyright (C) 2009 Ged Murphy
  *
  * 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
@@ -71,6 +72,8 @@ MSVCConfiguration::MSVCConfiguration ( const OptimizationType optimization, cons
                        this->name = "Release" + headers_name;
                else if ( optimization == Speed )
                        this->name = "Speed" + headers_name;
+               else if ( optimization == RosBuild )
+                       this->name = "RosBuild";
                else
                        this->name = "Unknown" + headers_name;
        }
@@ -84,7 +87,13 @@ MSVCBackend::_generate_vcproj ( const Module& module )
        string vcproj_file = VcprojFileName(module);
        string computername;
        string username;
-       string intermediatedir = "";
+
+       // make sure the containers are empty
+       header_files.clear();
+       includes.clear();
+       includes_ros.clear();
+       libraries.clear();
+       common_defines.clear();
 
        if (getenv ( "USERNAME" ) != NULL)
                username = getenv ( "USERNAME" );
@@ -101,13 +110,6 @@ MSVCBackend::_generate_vcproj ( const Module& module )
        printf ( "Creating MSVC.NET project: '%s'\n", vcproj_file.c_str() );
        FILE* OUT = fopen ( vcproj_file.c_str(), "wb" );
 
-       vector<string> imports;
-       string module_type = GetExtension(*module.output);
-       bool lib = (module.type == ObjectLibrary) || (module.type == RpcClient) ||(module.type == RpcServer) || (module_type == ".lib") || (module_type == ".a");
-       bool dll = (module_type == ".dll") || (module_type == ".cpl");
-       bool exe = (module_type == ".exe") || (module_type == ".scr");
-       bool sys = (module_type == ".sys");
-
        string path_basedir = module.GetPathToBaseDir ();
        string intenv = Environment::GetIntermediatePath ();
        string outenv = Environment::GetOutputPath ();
@@ -115,7 +117,6 @@ MSVCBackend::_generate_vcproj ( const Module& module )
        string intdir;
        string vcdir;
 
-
        if ( intenv == "obj-i386" )
                intdir = path_basedir + "obj-i386"; /* append relative dir from project dir */
        else
@@ -130,19 +131,14 @@ MSVCBackend::_generate_vcproj ( const Module& module )
        {
                vcdir = DEF_SSEP + _get_vc_dir();
        }
-       // TODO FIXME - need more checks here for 'sys' and possibly 'drv'?
 
-       bool console = exe && (module.type == Win32CUI);
        bool include_idl = false;
 
-       vector<string> source_files, resource_files, header_files, includes, includes_ros, libraries;
-       StringSet common_defines;
+       vector<string> source_files, resource_files;
        vector<const IfableData*> ifs_list;
        ifs_list.push_back ( &module.project.non_if_data );
        ifs_list.push_back ( &module.non_if_data );
 
-       string baseaddr;
-
        while ( ifs_list.size() )
        {
                const IfableData& data = *ifs_list.back();
@@ -245,20 +241,289 @@ MSVCBackend::_generate_vcproj ( const Module& module )
        fprintf ( OUT, "\t\t\tName=\"Win32\"/>\r\n" );
        fprintf ( OUT, "\t</Platforms>\r\n" );
 
-       //fprintf ( OUT, "\t<ToolFiles>\r\n" );
-       //fprintf ( OUT, "\t\t<ToolFile\r\n" );
+       // Set the binary type
+       string module_type = GetExtension(*module.output);
+       BinaryType binaryType;
+       if ((module.type == ObjectLibrary) || (module.type == RpcClient) ||(module.type == RpcServer) || (module_type == ".lib") || (module_type == ".a"))
+               binaryType = Lib;
+       else if ((module_type == ".dll") || (module_type == ".cpl"))
+               binaryType = Dll;
+       else if ((module_type == ".exe") || (module_type == ".scr"))
+               binaryType = Exe;
+       else if (module_type == ".sys")
+               binaryType = Sys;
+       else
+               binaryType = BinUnknown;
+
+       // Write out all the configurations
+       fprintf ( OUT, "\t<Configurations>\r\n" );
+       for ( size_t icfg = 0; icfg < m_configurations.size(); icfg++ )
+       {
+               const MSVCConfiguration& cfg = *m_configurations[icfg];
+
+               if ( cfg.optimization == RosBuild )
+               {
+                       _generate_makefile_configuration( OUT, module, cfg );
+               }
+               else
+               {
+                       _generate_standard_configuration( OUT, module, cfg, binaryType );
+               }
+       }
+       fprintf ( OUT, "\t</Configurations>\r\n" );
 
-       //string path = Path::RelativeFromDirectory ( ProjectNode.name, module.GetBasePath() );
-       //path.erase(path.find(ProjectNode.name, 0), ProjectNode.name.size() + 1);
+       // Write out the project files
+       fprintf ( OUT, "\t<Files>\r\n" );
 
-       //fprintf ( OUT, "\t\t\tRelativePath=\"%sgccasm.rules\"/>\r\n", path.c_str() );
-       //fprintf ( OUT, "\t</ToolFiles>\r\n" );
+       // Source files
+       fprintf ( OUT, "\t\t<Filter\r\n" );
+       fprintf ( OUT, "\t\t\tName=\"Source Files\"\r\n" );
+       fprintf ( OUT, "\t\t\tFilter=\"cpp;c;cxx;rc;def;r;odl;idl;hpj;bat;S\">\r\n" );
 
-       int n = 0;
+       std::sort(source_files.begin(), source_files.end(), SortFilesAscending());
+       vector<string> last_folder;
+       vector<string> split_path;
+       string indent_tab("\t\t\t");
 
-       std::string output_dir;
-       string importLib;
+       for ( size_t isrcfile = 0; isrcfile < source_files.size(); isrcfile++ )
+       {
+               string source_file = DosSeparator(source_files[isrcfile]);
+
+               Path::Split(split_path, source_file, false);
+               size_t same_folder_index = 0;
+               for ( size_t ifolder = 0; ifolder < last_folder.size(); ifolder++ )
+               {
+                       if ( ifolder < split_path.size() && last_folder[ifolder] == split_path[ifolder] )
+                               ++same_folder_index;
+                       else
+                               break;
+               }
+
+               if ( same_folder_index < split_path.size() || last_folder.size() > split_path.size() )
+               {
+                       int tabStart = 1;
+                       if ( split_path.size() > last_folder.size() )
+                       {
+                               for ( size_t ifolder = last_folder.size(); ifolder < split_path.size(); ifolder++ )
+                                       indent_tab.push_back('\t');
+                               tabStart = split_path.size() - last_folder.size() + 1;
+                       }
+                       else if ( split_path.size() < last_folder.size() )
+                       {
+                               indent_tab.resize( split_path.size() + 3 );
+                               tabStart = split_path.size() - last_folder.size() + 1;
+                       }
+
+                       for ( size_t ifolder = last_folder.size(), itab = tabStart; ifolder > same_folder_index; ifolder--, itab++ )
+                       {
+                               fprintf ( OUT, "%s</Filter>\r\n", indent_tab.substr(0, indent_tab.size() - itab).c_str() );
+                       }
+
+                       for ( size_t ifolder = same_folder_index, itab = split_path.size() - same_folder_index; ifolder < split_path.size(); ifolder++, itab-- )
+                       {
+                               const string tab = indent_tab.substr(0, indent_tab.size() - itab);
+                               fprintf ( OUT, "%s<Filter\r\n", tab.c_str() );
+                               fprintf ( OUT, "%s\tName=\"%s\">\r\n", tab.c_str(), split_path[ifolder].c_str() );
+                       }
+
+                       last_folder = split_path;
+               }
+
+               fprintf ( OUT, "%s<File\r\n", indent_tab.c_str() );
+               fprintf ( OUT, "%s\tRelativePath=\"%s\">\r\n", indent_tab.c_str(), source_file.c_str() );
+
+               for ( size_t iconfig = 0; iconfig < m_configurations.size(); iconfig++ )
+               {
+                       const MSVCConfiguration& config = *m_configurations[iconfig];
+
+                       if (( isrcfile == 0 ) && ( module.pch != NULL ))
+                       {
+                               /* little hack to speed up PCH */
+                               fprintf ( OUT, "%s\t<FileConfiguration\r\n", indent_tab.c_str() );
+                               fprintf ( OUT, "%s\t\tName=\"", indent_tab.c_str() );
+                               fprintf ( OUT, config.name.c_str() );
+                               fprintf ( OUT, "|Win32\">\r\n" );
+                               fprintf ( OUT, "%s\t\t<Tool\r\n", indent_tab.c_str() );
+                               fprintf ( OUT, "%s\t\t\tName=\"VCCLCompilerTool\"\r\n", indent_tab.c_str() );
+                               fprintf ( OUT, "%s\t\t\tUsePrecompiledHeader=\"1\"/>\r\n", indent_tab.c_str() );
+                               fprintf ( OUT, "%s\t</FileConfiguration>\r\n", indent_tab.c_str() );
+                       }
+
+                       //if (configuration.VSProjectVersion < "8.00") {
+                               if ((source_file.find(".idl") != string::npos) || ((source_file.find(".asm") != string::npos || tolower(source_file.at(source_file.size() - 1)) == 's')))
+                               {
+                                       fprintf ( OUT, "%s\t<FileConfiguration\r\n", indent_tab.c_str() );
+                                       fprintf ( OUT, "%s\t\tName=\"", indent_tab.c_str() );
+                                       fprintf ( OUT, config.name.c_str() );
+                                       fprintf ( OUT, "|Win32\">\r\n" );
+                                       fprintf ( OUT, "%s\t\t<Tool\r\n", indent_tab.c_str() );
+                                       if (source_file.find(".idl") != string::npos)
+                                       {
+                                               string src = source_file.substr (0, source_file.find(".idl"));
+
+                                               if ( src.find (".\\") != string::npos )
+                                                       src.erase (0, 2);
+
+                                               fprintf ( OUT, "%s\t\t\tName=\"VCCustomBuildTool\"\r\n", indent_tab.c_str() );
+
+                                               if ( module.type == RpcClient )
+                                               {
+                                                       fprintf ( OUT, "%s\t\t\tCommandLine=\"midl.exe /cstub %s_c.c /header %s_c.h /server none &quot;$(InputPath)&quot; /out &quot;$(IntDir)&quot;", indent_tab.c_str(), src.c_str (), src.c_str () );
+                                                       fprintf ( OUT, "&#x0D;&#x0A;");
+                                                       fprintf ( OUT, "cl.exe /Od /D &quot;WIN32&quot; /D &quot;_DEBUG&quot; /D &quot;_WINDOWS&quot; /D &quot;_WIN32_WINNT=0x502&quot; /D &quot;_UNICODE&quot; /D &quot;UNICODE&quot; /Gm /EHsc /RTC1 /MDd /Fo&quot;$(IntDir)\\%s.obj&quot; /W3 /c /Wp64 /ZI /TC &quot;$(IntDir)\\%s_c.c&quot; /nologo /errorReport:prompt", src.c_str (), src.c_str () );
+                                               }
+                                               else
+                                               {
+                                                       fprintf ( OUT, "%s\t\t\tCommandLine=\"midl.exe /sstub %s_s.c /header %s_s.h /client none &quot;$(InputPath)&quot; /out &quot;$(IntDir)&quot;", indent_tab.c_str(), src.c_str (), src.c_str () );
+                                                       fprintf ( OUT, "&#x0D;&#x0A;");
+                                                       fprintf ( OUT, "cl.exe /Od /D &quot;WIN32&quot; /D &quot;_DEBUG&quot; /D &quot;_WINDOWS&quot; /D &quot;_WIN32_WINNT=0x502&quot; /D &quot;_UNICODE&quot; /D &quot;UNICODE&quot; /Gm /EHsc /RTC1 /MDd /Fo&quot;$(IntDir)\\%s.obj&quot; /W3 /c /Wp64 /ZI /TC &quot;$(IntDir)\\%s_s.c&quot; /nologo /errorReport:prompt", src.c_str (), src.c_str () );
+
+                                               }
+                                               fprintf ( OUT, "&#x0D;&#x0A;");
+                                               fprintf ( OUT, "lib.exe /OUT:&quot;$(OutDir)\\%s.lib&quot; &quot;$(IntDir)\\%s.obj&quot;&#x0D;&#x0A;\"\r\n", module.name.c_str (), src.c_str () );
+                                               fprintf ( OUT, "%s\t\t\tOutputs=\"$(IntDir)\\$(InputName).obj\"/>\r\n", indent_tab.c_str() );
+                                       }
+                                       else if ((source_file.find(".asm") != string::npos))
+                                       {
+                                               fprintf ( OUT, "%s\t\t\tName=\"VCCustomBuildTool\"\r\n", indent_tab.c_str() );
+                                               fprintf ( OUT, "%s\t\t\tCommandLine=\"nasmw $(InputPath) -f coff -o &quot;$(OutDir)\\$(InputName).obj&quot;\"\r\n", indent_tab.c_str() );
+                                               fprintf ( OUT, "%s\t\t\tOutputs=\"$(OutDir)\\$(InputName).obj\"/>\r\n", indent_tab.c_str() );
+                                       }
+                                       else if ((tolower(source_file.at(source_file.size() - 1)) == 's'))
+                                       {
+                                               fprintf ( OUT, "%s\t\t\tName=\"VCCustomBuildTool\"\r\n", indent_tab.c_str() );
+                                               fprintf ( OUT, "%s\t\t\tCommandLine=\"cl /E &quot;$(InputPath)&quot; %s /D__ASM__ | as -o &quot;$(OutDir)\\$(InputName).obj&quot;\"\r\n", indent_tab.c_str(), include_string.c_str() );
+                                               fprintf ( OUT, "%s\t\t\tOutputs=\"$(OutDir)\\$(InputName).obj\"/>\r\n", indent_tab.c_str() );
+                                       }
+                                       fprintf ( OUT, "%s\t</FileConfiguration>\r\n", indent_tab.c_str() );
+                               }
+                       //}
+               }
+               fprintf ( OUT, "%s</File>\r\n", indent_tab.c_str() );
+       }
+
+       for ( size_t ifolder = last_folder.size(); ifolder > 0; ifolder-- )
+       {
+               indent_tab.resize( ifolder + 2 );
+               fprintf ( OUT, "%s</Filter>\r\n", indent_tab.c_str() );
+       }
+
+       fprintf ( OUT, "\t\t</Filter>\r\n" );
+
+       // Header files
+       fprintf ( OUT, "\t\t<Filter\r\n" );
+       fprintf ( OUT, "\t\t\tName=\"Header Files\"\r\n" );
+       fprintf ( OUT, "\t\t\tFilter=\"h;hpp;hxx;hm;inl\">\r\n" );
+       for ( i = 0; i < header_files.size(); i++ )
+       {
+               const string& header_file = header_files[i];
+               fprintf ( OUT, "\t\t\t<File\r\n" );
+               fprintf ( OUT, "\t\t\t\tRelativePath=\"%s\">\r\n", header_file.c_str() );
+               fprintf ( OUT, "\t\t\t</File>\r\n" );
+       }
+       fprintf ( OUT, "\t\t</Filter>\r\n" );
+
+       // Resource files
+       fprintf ( OUT, "\t\t<Filter\r\n" );
+       fprintf ( OUT, "\t\t\tName=\"Resource Files\"\r\n" );
+       fprintf ( OUT, "\t\t\tFilter=\"ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe\">\r\n" );
+       for ( i = 0; i < resource_files.size(); i++ )
+       {
+               const string& resource_file = resource_files[i];
+               fprintf ( OUT, "\t\t\t<File\r\n" );
+               fprintf ( OUT, "\t\t\t\tRelativePath=\"%s\">\r\n", resource_file.c_str() );
+               fprintf ( OUT, "\t\t\t</File>\r\n" );
+       }
+       fprintf ( OUT, "\t\t</Filter>\r\n" );
+
+       fprintf ( OUT, "\t</Files>\r\n" );
+       fprintf ( OUT, "\t<Globals>\r\n" );
+       fprintf ( OUT, "\t</Globals>\r\n" );
+       fprintf ( OUT, "</VisualStudioProject>\r\n" );
+       fclose ( OUT );
+
+#if 0
+       /* User configuration file */
+       if (vcproj_file_user != "")
+       {
+               OUT = fopen ( vcproj_file_user.c_str(), "wb" );
+               fprintf ( OUT, "<?xml version=\"1.0\" encoding = \"Windows-1252\"?>\r\n" );
+               fprintf ( OUT, "<VisualStudioUserFile\r\n" );
+               fprintf ( OUT, "\tProjectType=\"Visual C++\"\r\n" );
+               fprintf ( OUT, "\tVersion=\"%s\"\r\n", configuration.VSProjectVersion.c_str() );
+               fprintf ( OUT, "\tShowAllFiles=\"false\"\r\n" );
+               fprintf ( OUT, "\t>\r\n" );
+
+               fprintf ( OUT, "\t<Configurations>\r\n" );
+               for ( size_t icfg = 0; icfg < m_configurations.size(); icfg++ )
+               {
+                       const MSVCConfiguration& cfg = *m_configurations[icfg];
+                       fprintf ( OUT, "\t\t<Configuration\r\n" );
+                       fprintf ( OUT, "\t\t\tName=\"%s|Win32\"\r\n", cfg.name.c_str() );
+                       fprintf ( OUT, "\t\t\t>\r\n" );
+                       fprintf ( OUT, "\t\t\t<DebugSettings\r\n" );
+                       if ( module_type == ".cpl" )
+                       {
+                               fprintf ( OUT, "\t\t\t\tCommand=\"rundll32.exe\"\r\n" );
+                               fprintf ( OUT, "\t\t\t\tCommandArguments=\" shell32,Control_RunDLL &quot;$(TargetPath)&quot;,@\"\r\n" );
+                       }
+                       else
+                       {
+                               fprintf ( OUT, "\t\t\t\tCommand=\"$(TargetPath)\"\r\n" );
+                               fprintf ( OUT, "\t\t\t\tCommandArguments=\"\"\r\n" );
+                       }
+                       fprintf ( OUT, "\t\t\t\tAttach=\"false\"\r\n" );
+                       fprintf ( OUT, "\t\t\t\tDebuggerType=\"3\"\r\n" );
+                       fprintf ( OUT, "\t\t\t\tRemote=\"1\"\r\n" );
+                       string remote_machine = "\t\t\t\tRemoteMachine=\"" + computername + "\"\r\n";
+                       fprintf ( OUT, remote_machine.c_str() );
+                       fprintf ( OUT, "\t\t\t\tRemoteCommand=\"\"\r\n" );
+                       fprintf ( OUT, "\t\t\t\tHttpUrl=\"\"\r\n" );
+                       fprintf ( OUT, "\t\t\t\tPDBPath=\"\"\r\n" );
+                       fprintf ( OUT, "\t\t\t\tSQLDebugging=\"\"\r\n" );
+                       fprintf ( OUT, "\t\t\t\tEnvironment=\"\"\r\n" );
+                       fprintf ( OUT, "\t\t\t\tEnvironmentMerge=\"true\"\r\n" );
+                       fprintf ( OUT, "\t\t\t\tDebuggerFlavor=\"\"\r\n" );
+                       fprintf ( OUT, "\t\t\t\tMPIRunCommand=\"\"\r\n" );
+                       fprintf ( OUT, "\t\t\t\tMPIRunArguments=\"\"\r\n" );
+                       fprintf ( OUT, "\t\t\t\tMPIRunWorkingDirectory=\"\"\r\n" );
+                       fprintf ( OUT, "\t\t\t\tApplicationCommand=\"\"\r\n" );
+                       fprintf ( OUT, "\t\t\t\tApplicationArguments=\"\"\r\n" );
+                       fprintf ( OUT, "\t\t\t\tShimCommand=\"\"\r\n" );
+                       fprintf ( OUT, "\t\t\t\tMPIAcceptMode=\"\"\r\n" );
+                       fprintf ( OUT, "\t\t\t\tMPIAcceptFilter=\"\"\r\n" );
+                       fprintf ( OUT, "\t\t\t/>\r\n" );
+                       fprintf ( OUT, "\t\t</Configuration>\r\n" );
+               }
+               fprintf ( OUT, "\t</Configurations>\r\n" );
+               fprintf ( OUT, "</VisualStudioUserFile>\r\n" );
+               fclose ( OUT );
+       }
+#endif
+}
+
+void MSVCBackend::_generate_standard_configuration( FILE* OUT,
+                                                                                                       const Module& module,
+                                                                                                       const MSVCConfiguration& cfg,
+                                                                                                       BinaryType binaryType )
+{
+       string path_basedir = module.GetPathToBaseDir ();
+       string intenv = Environment::GetIntermediatePath ();
+       string outenv = Environment::GetOutputPath ();
+       string outdir;
+       string intdir;
+       string vcdir;
+
+       bool debug = ( cfg.optimization == Debug );
+       bool release = ( cfg.optimization == Release );
+       bool speed = ( cfg.optimization == Speed );
+
+       bool include_idl = false;
+       string include_string;
 
+       size_t i;
+       string intermediatedir = "";
+       string importLib;
        // don't do the work m_configurations.size() times
        if (module.importLibrary != NULL)
        {
@@ -269,14 +534,34 @@ MSVCBackend::_generate_vcproj ( const Module& module )
                                module.output->relative_path );
        }
 
-       fprintf ( OUT, "\t<Configurations>\r\n" );
-       for ( size_t icfg = 0; icfg < m_configurations.size(); icfg++ )
-       {
-               const MSVCConfiguration& cfg = *m_configurations[icfg];
+       string module_type = GetExtension(*module.output);
+       
+       // Set the configuration type for this config
+       ConfigurationType CfgType;
+       if ( binaryType == Exe )
+               CfgType = ConfigApp;
+       else if ( binaryType == Lib )
+               CfgType = ConfigLib;
+       else if ( binaryType == Dll || binaryType == Sys )
+               CfgType = ConfigDll;
+       else
+               CfgType = ConfigUnknown;
+
+
+       if ( intenv == "obj-i386" )
+               intdir = path_basedir + "obj-i386"; /* append relative dir from project dir */
+       else
+               intdir = intenv;
+
+       if ( outenv == "output-i386" )
+               outdir = path_basedir + "output-i386";
+       else
+               outdir = outenv;
 
-               bool debug = ( cfg.optimization == Debug );
-               bool release = ( cfg.optimization == Release );
-               bool speed = ( cfg.optimization == Speed );
+       if ( configuration.UseVSVersionInPath )
+       {
+               vcdir = DEF_SSEP + _get_vc_dir();
+       }
 
                fprintf ( OUT, "\t\t<Configuration\r\n" );
                fprintf ( OUT, "\t\t\tName=\"%s|Win32\"\r\n", cfg.name.c_str() );
@@ -292,11 +577,13 @@ MSVCBackend::_generate_vcproj ( const Module& module )
                        fprintf ( OUT, "\t\t\tIntermediateDirectory=\"%s\\%s%s\"\r\n", intdir.c_str (), module.output->relative_path.c_str (), vcdir.c_str () );
                }
 
-               fprintf ( OUT, "\t\t\tConfigurationType=\"%d\"\r\n", exe ? 1 : dll ? 2 : lib ? 4 : -1 );
-               fprintf ( OUT, "\t\t\tCharacterSet=\"2\">\r\n" );
+       fprintf ( OUT, "\t\t\tConfigurationType=\"%d\"\r\n", CfgType );
+       fprintf ( OUT, "\t\t\tCharacterSet=\"2\"\r\n" );
+       fprintf ( OUT, "\t\t\t>\r\n" );
 
                fprintf ( OUT, "\t\t\t<Tool\r\n" );
                fprintf ( OUT, "\t\t\t\tName=\"VCCLCompilerTool\"\r\n" );
+
                fprintf ( OUT, "\t\t\t\tOptimization=\"%d\"\r\n", release ? 2 : 0 );
 
                fprintf ( OUT, "\t\t\t\tAdditionalIncludeDirectories=\"" );
@@ -383,7 +670,7 @@ MSVCBackend::_generate_vcproj ( const Module& module )
                        defines.insert ( "STDCALL=__stdcall" );
                }
 
-               if ( lib || exe )
+       if ( binaryType == Lib || binaryType == Exe )
                {
                        defines.insert ( "_LIB" );
                }
@@ -457,7 +744,7 @@ MSVCBackend::_generate_vcproj ( const Module& module )
                fprintf ( OUT, "\t\t\t<Tool\r\n" );
                fprintf ( OUT, "\t\t\t\tName=\"VCCustomBuildTool\"/>\r\n" );
 
-               if ( lib )
+       if ( binaryType == Lib )
                {
                        fprintf ( OUT, "\t\t\t<Tool\r\n" );
                        fprintf ( OUT, "\t\t\t\tName=\"VCLibrarianTool\"\r\n" );
@@ -467,7 +754,7 @@ MSVCBackend::_generate_vcproj ( const Module& module )
                {
                        fprintf ( OUT, "\t\t\t<Tool\r\n" );
                        fprintf ( OUT, "\t\t\t\tName=\"VCLinkerTool\"\r\n" );
-                       if (module.GetEntryPoint(false) == "0" && sys == false)
+               if (module.GetEntryPoint() == "0" && binaryType != Sys )
                                fprintf ( OUT, "AdditionalOptions=\"/noentry\"" );
 
                        if (configuration.VSProjectVersion == "9.00")
@@ -538,9 +825,9 @@ MSVCBackend::_generate_vcproj ( const Module& module )
                        if ( debug )
                                fprintf ( OUT, "\t\t\t\tProgramDatabaseFile=\"$(OutDir)/%s.pdb\"\r\n", module.name.c_str() );
 
-                       if ( sys )
+               if ( binaryType == Sys )
                        {
-                               if (module.GetEntryPoint(false) == "0")
+                       if (module.GetEntryPoint() == "0")
                                        fprintf ( OUT, "\t\t\t\tAdditionalOptions=\" /noentry /ALIGN:0x20 /SECTION:INIT,D /IGNORE:4001,4037,4039,4065,4070,4078,4087,4089,4096\"\r\n" );
                                else
                                        fprintf ( OUT, "\t\t\t\tAdditionalOptions=\" /ALIGN:0x20 /SECTION:INIT,D /IGNORE:4001,4037,4039,4065,4070,4078,4087,4089,4096\"\r\n" );
@@ -548,10 +835,10 @@ MSVCBackend::_generate_vcproj ( const Module& module )
                                fprintf ( OUT, "\t\t\t\tGenerateManifest=\"FALSE\"\r\n" );
                                fprintf ( OUT, "\t\t\t\tSubSystem=\"%d\"\r\n", 3 );
                                fprintf ( OUT, "\t\t\t\tDriver=\"%d\"\r\n", 1 );
-                               fprintf ( OUT, "\t\t\t\tEntryPointSymbol=\"%s\"\r\n", module.GetEntryPoint(false) == "" ? "DriverEntry" : module.GetEntryPoint(false).c_str ());
+                       fprintf ( OUT, "\t\t\t\tEntryPointSymbol=\"%s\"\r\n", module.GetEntryPoint() == "" ? "DriverEntry" : module.GetEntryPoint().c_str ());
                                fprintf ( OUT, "\t\t\t\tBaseAddress=\"%s\"\r\n", baseaddr == "" ? "0x10000" : baseaddr.c_str ());
                        }
-                       else if ( exe )
+               else if ( binaryType == Exe )
                        {
                                if ( module.type == Kernel )
                                {
@@ -578,21 +865,21 @@ MSVCBackend::_generate_vcproj ( const Module& module )
                                        {
                                                fprintf ( OUT, "\t\t\t\tIgnoreAllDefaultLibraries=\"TRUE\"\r\n" );
                                        }
-                                       fprintf ( OUT, "\t\t\t\tSubSystem=\"%d\"\r\n", console ? 1 : 2 );
+                               fprintf ( OUT, "\t\t\t\tSubSystem=\"%d\"\r\n", 2 );
                                }
                        }
-                       else if ( dll )
+               else if ( binaryType == Dll )
                        {
-                               if (module.GetEntryPoint(false) == "0")
+                       if (module.GetEntryPoint() == "0")
                                        fprintf ( OUT, "\t\t\t\tEntryPointSymbol=\"\"\r\n" );
                                else
                                {
                                        // get rid of DllMain@12 because MSVC needs to link to _DllMainCRTStartup@12
                                        // when using CRT
-                                       if (module.GetEntryPoint(false) == "DllMain@12")
+                               if (module.GetEntryPoint() == "DllMain@12")
                                                fprintf ( OUT, "\t\t\t\tEntryPointSymbol=\"\"\r\n" );
                                        else
-                                               fprintf ( OUT, "\t\t\t\tEntryPointSymbol=\"%s\"\r\n", module.GetEntryPoint(false).c_str ());
+                                       fprintf ( OUT, "\t\t\t\tEntryPointSymbol=\"%s\"\r\n", module.GetEntryPoint().c_str ());
                                }
                                fprintf ( OUT, "\t\t\t\tBaseAddress=\"%s\"\r\n", baseaddr == "" ? "0x40000" : baseaddr.c_str ());
                                if ( use_msvcrt_lib )
@@ -651,238 +938,71 @@ MSVCBackend::_generate_vcproj ( const Module& module )
                fprintf ( OUT, "\t\t\t<Tool\r\n" );
                fprintf ( OUT, "\t\t\t\tName=\"VCWebDeploymentTool\"/>\r\n" );
                fprintf ( OUT, "\t\t</Configuration>\r\n" );
-
-               n++;
        }
-       fprintf ( OUT, "\t</Configurations>\r\n" );
 
-       fprintf ( OUT, "\t<Files>\r\n" );
 
-       // Source files
-       fprintf ( OUT, "\t\t<Filter\r\n" );
-       fprintf ( OUT, "\t\t\tName=\"Source Files\"\r\n" );
-       fprintf ( OUT, "\t\t\tFilter=\"cpp;c;cxx;rc;def;r;odl;idl;hpj;bat;S\">\r\n" );
+void
+MSVCBackend::_generate_makefile_configuration( FILE* OUT, const Module& module, const MSVCConfiguration& cfg )
+{
+       string path_basedir = module.GetPathToBaseDir ();
+       string intenv = Environment::GetIntermediatePath ();
+       string outenv = Environment::GetOutputPath ();
 
-       std::sort(source_files.begin(), source_files.end(), SortFilesAscending());
-       vector<string> last_folder;
-       vector<string> split_path;
-       string indent_tab("\t\t\t");
+       string outdir;
+       string intdir;
+       string vcdir;
 
-       for ( size_t isrcfile = 0; isrcfile < source_files.size(); isrcfile++ )
-       {
-               string source_file = DosSeparator(source_files[isrcfile]);
 
-               Path::Split(split_path, source_file, false);
-               size_t same_folder_index = 0;
-               for ( size_t ifolder = 0; ifolder < last_folder.size(); ifolder++ )
-               {
-                       if ( ifolder < split_path.size() && last_folder[ifolder] == split_path[ifolder] )
-                               ++same_folder_index;
+       if ( intenv == "obj-i386" )
+               intdir = path_basedir + "obj-i386"; /* append relative dir from project dir */
                        else
-                               break;
-               }
-
-               if ( same_folder_index < split_path.size() || last_folder.size() > split_path.size() )
-               {
-                       int tabStart = 1;
-                       if ( split_path.size() > last_folder.size() )
-                       {
-                               for ( size_t ifolder = last_folder.size(); ifolder < split_path.size(); ifolder++ )
-                                       indent_tab.push_back('\t');
-                               tabStart = split_path.size() - last_folder.size() + 1;
-                       }
-                       else if ( split_path.size() < last_folder.size() )
-                       {
-                               indent_tab.resize( split_path.size() + 3 );
-                               tabStart = split_path.size() - last_folder.size() + 1;
-                       }
+               intdir = intenv;
 
-                       for ( size_t ifolder = last_folder.size(), itab = tabStart; ifolder > same_folder_index; ifolder--, itab++ )
-                       {
-                               fprintf ( OUT, "%s</Filter>\r\n", indent_tab.substr(0, indent_tab.size() - itab).c_str() );
-                       }
+       if ( outenv == "output-i386" )
+               outdir = path_basedir + "output-i386";
+       else
+               outdir = outenv;
 
-                       for ( size_t ifolder = same_folder_index, itab = split_path.size() - same_folder_index; ifolder < split_path.size(); ifolder++, itab-- )
+       if ( configuration.UseVSVersionInPath )
                        {
-                               const string tab = indent_tab.substr(0, indent_tab.size() - itab);
-                               fprintf ( OUT, "%s<Filter\r\n", tab.c_str() );
-                               fprintf ( OUT, "%s\tName=\"%s\">\r\n", tab.c_str(), split_path[ifolder].c_str() );
+               vcdir = DEF_SSEP + _get_vc_dir();
                        }
 
-                       last_folder = split_path;
-               }
-
-               fprintf ( OUT, "%s<File\r\n", indent_tab.c_str() );
-               fprintf ( OUT, "%s\tRelativePath=\"%s\">\r\n", indent_tab.c_str(), source_file.c_str() );
+       fprintf ( OUT, "\t\t<Configuration\r\n" );
+       fprintf ( OUT, "\t\t\tName=\"%s|Win32\"\r\n", cfg.name.c_str() );
 
-               for ( size_t iconfig = 0; iconfig < m_configurations.size(); iconfig++ )
+       if ( configuration.UseConfigurationInPath )
                {
-                       const MSVCConfiguration& config = *m_configurations[iconfig];
-
-                       if (( isrcfile == 0 ) && ( module.pch != NULL ))
-                       {
-                               /* little hack to speed up PCH */
-                               fprintf ( OUT, "%s\t<FileConfiguration\r\n", indent_tab.c_str() );
-                               fprintf ( OUT, "%s\t\tName=\"", indent_tab.c_str() );
-                               fprintf ( OUT, config.name.c_str() );
-                               fprintf ( OUT, "|Win32\">\r\n" );
-                               fprintf ( OUT, "%s\t\t<Tool\r\n", indent_tab.c_str() );
-                               fprintf ( OUT, "%s\t\t\tName=\"VCCLCompilerTool\"\r\n", indent_tab.c_str() );
-                               fprintf ( OUT, "%s\t\t\tUsePrecompiledHeader=\"1\"/>\r\n", indent_tab.c_str() );
-                               fprintf ( OUT, "%s\t</FileConfiguration>\r\n", indent_tab.c_str() );
+               fprintf ( OUT, "\t\t\tOutputDirectory=\"%s\\%s\\%s\"\r\n", outdir.c_str (), module.output->relative_path.c_str (), cfg.name.c_str() );
+               fprintf ( OUT, "\t\t\tIntermediateDirectory=\"%s\\%s\\%s\"\r\n", intdir.c_str (), module.output->relative_path.c_str (), cfg.name.c_str() );
                        }
-
-                       //if (configuration.VSProjectVersion < "8.00") {
-                               if ((source_file.find(".idl") != string::npos) || ((source_file.find(".asm") != string::npos || tolower(source_file.at(source_file.size() - 1)) == 's')))
-                               {
-                                       fprintf ( OUT, "%s\t<FileConfiguration\r\n", indent_tab.c_str() );
-                                       fprintf ( OUT, "%s\t\tName=\"", indent_tab.c_str() );
-                                       fprintf ( OUT, config.name.c_str() );
-                                       fprintf ( OUT, "|Win32\">\r\n" );
-                                       fprintf ( OUT, "%s\t\t<Tool\r\n", indent_tab.c_str() );
-                                       if (source_file.find(".idl") != string::npos)
-                                       {
-                                               string src = source_file.substr (0, source_file.find(".idl"));
-
-                                               if ( src.find (".\\") != string::npos )
-                                                       src.erase (0, 2);
-
-                                               fprintf ( OUT, "%s\t\t\tName=\"VCCustomBuildTool\"\r\n", indent_tab.c_str() );
-
-                                               if ( module.type == RpcClient )
-                                               {
-                                                       fprintf ( OUT, "%s\t\t\tCommandLine=\"midl.exe /cstub %s_c.c /header %s_c.h /server none &quot;$(InputPath)&quot; /out &quot;$(IntDir)&quot;", indent_tab.c_str(), src.c_str (), src.c_str () );
-                                                       fprintf ( OUT, "&#x0D;&#x0A;");
-                                                       fprintf ( OUT, "cl.exe /Od /D &quot;WIN32&quot; /D &quot;_DEBUG&quot; /D &quot;_WINDOWS&quot; /D &quot;_WIN32_WINNT=0x502&quot; /D &quot;_UNICODE&quot; /D &quot;UNICODE&quot; /Gm /EHsc /RTC1 /MDd /Fo&quot;$(IntDir)\\%s.obj&quot; /W3 /c /Wp64 /ZI /TC &quot;$(IntDir)\\%s_c.c&quot; /nologo /errorReport:prompt", src.c_str (), src.c_str () );
-                                               }
                                                else
                                                {
-                                                       fprintf ( OUT, "%s\t\t\tCommandLine=\"midl.exe /sstub %s_s.c /header %s_s.h /client none &quot;$(InputPath)&quot; /out &quot;$(IntDir)&quot;", indent_tab.c_str(), src.c_str (), src.c_str () );
-                                                       fprintf ( OUT, "&#x0D;&#x0A;");
-                                                       fprintf ( OUT, "cl.exe /Od /D &quot;WIN32&quot; /D &quot;_DEBUG&quot; /D &quot;_WINDOWS&quot; /D &quot;_WIN32_WINNT=0x502&quot; /D &quot;_UNICODE&quot; /D &quot;UNICODE&quot; /Gm /EHsc /RTC1 /MDd /Fo&quot;$(IntDir)\\%s.obj&quot; /W3 /c /Wp64 /ZI /TC &quot;$(IntDir)\\%s_s.c&quot; /nologo /errorReport:prompt", src.c_str (), src.c_str () );
-
+               fprintf ( OUT, "\t\t\tOutputDirectory=\"%s\\%s\"\r\n", outdir.c_str (), module.output->relative_path.c_str () );
+               fprintf ( OUT, "\t\t\tIntermediateDirectory=\"%s\\%s\"\r\n", intdir.c_str (), module.output->relative_path.c_str () );
                                                }
-                                               fprintf ( OUT, "&#x0D;&#x0A;");
-                                               fprintf ( OUT, "lib.exe /OUT:&quot;$(OutDir)\\%s.lib&quot; &quot;$(IntDir)\\%s.obj&quot;&#x0D;&#x0A;\"\r\n", module.name.c_str (), src.c_str () );
-                                               fprintf ( OUT, "%s\t\t\tOutputs=\"$(IntDir)\\$(InputName).obj\"/>\r\n", indent_tab.c_str() );
-                                       }
-                                       else if ((source_file.find(".asm") != string::npos))
-                                       {
-                                               fprintf ( OUT, "%s\t\t\tName=\"VCCustomBuildTool\"\r\n", indent_tab.c_str() );
-                                               fprintf ( OUT, "%s\t\t\tCommandLine=\"nasmw $(InputPath) -f coff -o &quot;$(OutDir)\\$(InputName).obj&quot;\"\r\n", indent_tab.c_str() );
-                                               fprintf ( OUT, "%s\t\t\tOutputs=\"$(OutDir)\\$(InputName).obj\"/>\r\n", indent_tab.c_str() );
-                                       }
-                                       else if ((tolower(source_file.at(source_file.size() - 1)) == 's'))
-                                       {
-                                               fprintf ( OUT, "%s\t\t\tName=\"VCCustomBuildTool\"\r\n", indent_tab.c_str() );
-                                               fprintf ( OUT, "%s\t\t\tCommandLine=\"cl /E &quot;$(InputPath)&quot; %s /D__ASM__ | as -o &quot;$(OutDir)\\$(InputName).obj&quot;\"\r\n", indent_tab.c_str(), include_string.c_str() );
-                                               fprintf ( OUT, "%s\t\t\tOutputs=\"$(OutDir)\\$(InputName).obj\"/>\r\n", indent_tab.c_str() );
-                                       }
-                                       fprintf ( OUT, "%s\t</FileConfiguration>\r\n", indent_tab.c_str() );
-                               }
-                       //}
-               }
-               fprintf ( OUT, "%s</File>\r\n", indent_tab.c_str() );
-       }
-
-       for ( size_t ifolder = last_folder.size(); ifolder > 0; ifolder-- )
-       {
-               indent_tab.resize( ifolder + 2 );
-               fprintf ( OUT, "%s</Filter>\r\n", indent_tab.c_str() );
-       }
 
-       fprintf ( OUT, "\t\t</Filter>\r\n" );
+       fprintf ( OUT, "\t\t\tConfigurationType=\"0\"\r\n");
+       fprintf ( OUT, "\t\t\t>\r\n" );
 
-       // Header files
-       fprintf ( OUT, "\t\t<Filter\r\n" );
-       fprintf ( OUT, "\t\t\tName=\"Header Files\"\r\n" );
-       fprintf ( OUT, "\t\t\tFilter=\"h;hpp;hxx;hm;inl\">\r\n" );
-       for ( i = 0; i < header_files.size(); i++ )
-       {
-               const string& header_file = header_files[i];
-               fprintf ( OUT, "\t\t\t<File\r\n" );
-               fprintf ( OUT, "\t\t\t\tRelativePath=\"%s\">\r\n", header_file.c_str() );
-               fprintf ( OUT, "\t\t\t</File>\r\n" );
-       }
-       fprintf ( OUT, "\t\t</Filter>\r\n" );
+       fprintf ( OUT, "\t\t\t<Tool\r\n" );
 
-       // Resource files
-       fprintf ( OUT, "\t\t<Filter\r\n" );
-       fprintf ( OUT, "\t\t\tName=\"Resource Files\"\r\n" );
-       fprintf ( OUT, "\t\t\tFilter=\"ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe\">\r\n" );
-       for ( i = 0; i < resource_files.size(); i++ )
-       {
-               const string& resource_file = resource_files[i];
-               fprintf ( OUT, "\t\t\t<File\r\n" );
-               fprintf ( OUT, "\t\t\t\tRelativePath=\"%s\">\r\n", resource_file.c_str() );
-               fprintf ( OUT, "\t\t\t</File>\r\n" );
-       }
-       fprintf ( OUT, "\t\t</Filter>\r\n" );
+       fprintf ( OUT, "\t\t\t\tName=\"VCNMakeTool\"\r\n" );
+       fprintf ( OUT, "\t\t\t\tBuildCommandLine=\"%srosbuild.bat build %s\"\r\n", path_basedir.c_str (), module.name.c_str ());
+       fprintf ( OUT, "\t\t\t\tReBuildCommandLine=\"%srosbuild.bat rebuild %s\"\r\n", path_basedir.c_str (), module.name.c_str ());
+       fprintf ( OUT, "\t\t\t\tCleanCommandLine=\"%srosbuild.bat clean %s\"\r\n", path_basedir.c_str (), module.name.c_str ());
+       fprintf ( OUT, "\t\t\t\tOutput=\"\"\r\n");
+       fprintf ( OUT, "\t\t\t\tPreprocessorDefinitions=\"\"\r\n");
+       fprintf ( OUT, "\t\t\t\tIncludeSearchPath=\"\"\r\n");
+       fprintf ( OUT, "\t\t\t\tForcedIncludes=\"\"\r\n");
+       fprintf ( OUT, "\t\t\t\tAssemblySearchPath=\"\"\r\n");
+       fprintf ( OUT, "\t\t\t\tForcedUsingAssemblies=\"\"\r\n");
+       fprintf ( OUT, "\t\t\t\tCompileAsManaged=\"\"\r\n");
 
-       fprintf ( OUT, "\t</Files>\r\n" );
-       fprintf ( OUT, "\t<Globals>\r\n" );
-       fprintf ( OUT, "\t</Globals>\r\n" );
-       fprintf ( OUT, "</VisualStudioProject>\r\n" );
-       fclose ( OUT );
-
-       /* User configuration file */
-       if (vcproj_file_user != "")
-       {
-               OUT = fopen ( vcproj_file_user.c_str(), "wb" );
-               fprintf ( OUT, "<?xml version=\"1.0\" encoding = \"Windows-1252\"?>\r\n" );
-               fprintf ( OUT, "<VisualStudioUserFile\r\n" );
-               fprintf ( OUT, "\tProjectType=\"Visual C++\"\r\n" );
-               fprintf ( OUT, "\tVersion=\"%s\"\r\n", configuration.VSProjectVersion.c_str() );
-               fprintf ( OUT, "\tShowAllFiles=\"false\"\r\n" );
-               fprintf ( OUT, "\t>\r\n" );
-
-               fprintf ( OUT, "\t<Configurations>\r\n" );
-               for ( size_t icfg = 0; icfg < m_configurations.size(); icfg++ )
-               {
-                       const MSVCConfiguration& cfg = *m_configurations[icfg];
-                       fprintf ( OUT, "\t\t<Configuration\r\n" );
-                       fprintf ( OUT, "\t\t\tName=\"%s|Win32\"\r\n", cfg.name.c_str() );
-                       fprintf ( OUT, "\t\t\t>\r\n" );
-                       fprintf ( OUT, "\t\t\t<DebugSettings\r\n" );
-                       if ( module_type == ".cpl" )
-                       {
-                               fprintf ( OUT, "\t\t\t\tCommand=\"rundll32.exe\"\r\n" );
-                               fprintf ( OUT, "\t\t\t\tCommandArguments=\" shell32,Control_RunDLL &quot;$(TargetPath)&quot;,@\"\r\n" );
-                       }
-                       else
-                       {
-                               fprintf ( OUT, "\t\t\t\tCommand=\"$(TargetPath)\"\r\n" );
-                               fprintf ( OUT, "\t\t\t\tCommandArguments=\"\"\r\n" );
-                       }
-                       fprintf ( OUT, "\t\t\t\tAttach=\"false\"\r\n" );
-                       fprintf ( OUT, "\t\t\t\tDebuggerType=\"3\"\r\n" );
-                       fprintf ( OUT, "\t\t\t\tRemote=\"1\"\r\n" );
-                       string remote_machine = "\t\t\t\tRemoteMachine=\"" + computername + "\"\r\n";
-                       fprintf ( OUT, remote_machine.c_str() );
-                       fprintf ( OUT, "\t\t\t\tRemoteCommand=\"\"\r\n" );
-                       fprintf ( OUT, "\t\t\t\tHttpUrl=\"\"\r\n" );
-                       fprintf ( OUT, "\t\t\t\tPDBPath=\"\"\r\n" );
-                       fprintf ( OUT, "\t\t\t\tSQLDebugging=\"\"\r\n" );
-                       fprintf ( OUT, "\t\t\t\tEnvironment=\"\"\r\n" );
-                       fprintf ( OUT, "\t\t\t\tEnvironmentMerge=\"true\"\r\n" );
-                       fprintf ( OUT, "\t\t\t\tDebuggerFlavor=\"\"\r\n" );
-                       fprintf ( OUT, "\t\t\t\tMPIRunCommand=\"\"\r\n" );
-                       fprintf ( OUT, "\t\t\t\tMPIRunArguments=\"\"\r\n" );
-                       fprintf ( OUT, "\t\t\t\tMPIRunWorkingDirectory=\"\"\r\n" );
-                       fprintf ( OUT, "\t\t\t\tApplicationCommand=\"\"\r\n" );
-                       fprintf ( OUT, "\t\t\t\tApplicationArguments=\"\"\r\n" );
-                       fprintf ( OUT, "\t\t\t\tShimCommand=\"\"\r\n" );
-                       fprintf ( OUT, "\t\t\t\tMPIAcceptMode=\"\"\r\n" );
-                       fprintf ( OUT, "\t\t\t\tMPIAcceptFilter=\"\"\r\n" );
                        fprintf ( OUT, "\t\t\t/>\r\n" );
                        fprintf ( OUT, "\t\t</Configuration>\r\n" );
                }
-               fprintf ( OUT, "\t</Configurations>\r\n" );
-               fprintf ( OUT, "</VisualStudioUserFile>\r\n" );
-               fclose ( OUT );
-       }
 
-}
 
 std::string
 MSVCBackend::_strip_gcc_deffile(std::string Filename, std::string sourcedir, std::string objdir)
@@ -969,6 +1089,9 @@ MSVCBackend::_get_solution_version ( void )
        else if (configuration.VSProjectVersion == "9.00")
                version = "10.00";
 
+       else if (configuration.VSProjectVersion == "10.00")
+               version = "11.00";
+
        return version;
 }
 
@@ -992,6 +1115,9 @@ MSVCBackend::_get_studio_version ( void )
        else if (configuration.VSProjectVersion == "9.00")
                version = "2008";
 
+       else if (configuration.VSProjectVersion == "10.00")
+               version = "2010";
+
        return version;
 }
 
@@ -1037,11 +1163,12 @@ void
 MSVCBackend::_generate_sln_footer ( FILE* OUT )
 {
        fprintf ( OUT, "Global\r\n" );
-       fprintf ( OUT, "\tGlobalSection(SolutionConfiguration) = preSolution\r\n" );
+       fprintf ( OUT, "\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\r\n" );
        for ( size_t i = 0; i < m_configurations.size(); i++ )
                fprintf ( OUT, "\t\t%s = %s\r\n", m_configurations[i]->name.c_str(), m_configurations[i]->name.c_str() );
        fprintf ( OUT, "\tEndGlobalSection\r\n" );
-       fprintf ( OUT, "\tGlobalSection(ProjectConfiguration) = postSolution\r\n" );
+
+       fprintf ( OUT, "\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\r\n" );
        for( std::map<std::string, Module*>::const_iterator p = ProjectNode.modules.begin(); p != ProjectNode.modules.end(); ++ p )
        {
                Module& module = *p->second;
@@ -1049,18 +1176,18 @@ MSVCBackend::_generate_sln_footer ( FILE* OUT )
                _generate_sln_configurations ( OUT, guid.c_str() );
        }
        fprintf ( OUT, "\tEndGlobalSection\r\n" );
+/*
        fprintf ( OUT, "\tGlobalSection(ExtensibilityGlobals) = postSolution\r\n" );
        fprintf ( OUT, "\tEndGlobalSection\r\n" );
        fprintf ( OUT, "\tGlobalSection(ExtensibilityAddIns) = postSolution\r\n" );
        fprintf ( OUT, "\tEndGlobalSection\r\n" );
-
+*/
        if (configuration.VSProjectVersion == "7.00") {
                fprintf ( OUT, "\tGlobalSection(ProjectDependencies) = postSolution\r\n" );
                //FIXME: Add dependencies for VS 2002
                fprintf ( OUT, "\tEndGlobalSection\r\n" );
        }
-
-       if (configuration.VSProjectVersion == "8.00") {
+       else {
                fprintf ( OUT, "\tGlobalSection(SolutionProperties) = preSolution\r\n" );
                fprintf ( OUT, "\t\tHideSolutionNode = FALSE\r\n" );
                fprintf ( OUT, "\tEndGlobalSection\r\n" );
diff --git a/reactos/tools/rbuild/backend/msvc/vcxprojmaker.cpp b/reactos/tools/rbuild/backend/msvc/vcxprojmaker.cpp
new file mode 100644 (file)
index 0000000..c8d9fc0
--- /dev/null
@@ -0,0 +1,177 @@
+/*
+ * Copyright (C) 2009 Ged Murphy
+ *
+ * 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 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.
+ */
+
+#include <string>
+#include <vector>
+#include <set>
+#include <algorithm>
+#include <fstream>
+#include <iostream>
+
+#include <stdio.h>
+
+#include "msvc.h"
+
+using std::string;
+using std::vector;
+using std::set;
+
+typedef set<string> StringSet;
+
+#ifdef OUT
+#undef OUT
+#endif//OUT
+
+void
+MSVCBackend::_generate_vcxproj ( const Module& module )
+{
+       size_t i;
+
+       string vcproj_file = VcprojFileName(module);
+       string computername;
+       string username;
+       string intermediatedir = "";
+
+       if (getenv ( "USERNAME" ) != NULL)
+               username = getenv ( "USERNAME" );
+       if (getenv ( "COMPUTERNAME" ) != NULL)
+               computername = getenv ( "COMPUTERNAME" );
+       else if (getenv ( "HOSTNAME" ) != NULL)
+               computername = getenv ( "HOSTNAME" );
+
+       printf ( "Creating MSVC project: '%s'\n", vcproj_file.c_str() );
+       FILE* OUT = fopen ( vcproj_file.c_str(), "wb" );
+
+       string path_basedir = module.GetPathToBaseDir ();
+       string intenv = Environment::GetIntermediatePath ();
+       string outenv = Environment::GetOutputPath ();
+       string outdir;
+       string intdir;
+       string vcdir;
+
+       if ( intenv == "obj-i386" )
+               intdir = path_basedir + "obj-i386"; /* append relative dir from project dir */
+       else
+               intdir = intenv;
+
+       if ( outenv == "output-i386" )
+               outdir = path_basedir + "output-i386";
+       else
+               outdir = outenv;
+
+       if ( configuration.UseVSVersionInPath )
+       {
+               vcdir = DEF_SSEP + _get_vc_dir();
+       }
+
+
+
+       bool include_idl = false;
+
+       vector<string> source_files, resource_files;
+       vector<const IfableData*> ifs_list;
+       ifs_list.push_back ( &module.project.non_if_data );
+       ifs_list.push_back ( &module.non_if_data );
+
+       while ( ifs_list.size() )
+       {
+               const IfableData& data = *ifs_list.back();
+               ifs_list.pop_back();
+               const vector<File*>& files = data.files;
+               for ( i = 0; i < files.size(); i++ )
+               {
+                       if (files[i]->file.directory != SourceDirectory)
+                               continue;
+
+                       // We want the full path here for directory support later on
+                       string path = Path::RelativeFromDirectory (
+                               files[i]->file.relative_path,
+                               module.output->relative_path );
+                       string file = path + std::string("\\") + files[i]->file.name;
+
+                       if ( !stricmp ( Right(file,3).c_str(), ".rc" ) )
+                               resource_files.push_back ( file );
+                       else if ( !stricmp ( Right(file,2).c_str(), ".h" ) )
+                               header_files.push_back ( file );
+                       else
+                               source_files.push_back ( file );
+               }
+               const vector<Include*>& incs = data.includes;
+               for ( i = 0; i < incs.size(); i++ )
+               {
+                       string path = Path::RelativeFromDirectory (
+                               incs[i]->directory->relative_path,
+                               module.output->relative_path );
+                       if ( module.type != RpcServer && module.type != RpcClient )
+                       {
+                               if ( path.find ("/include/reactos/idl") != string::npos)
+                               {
+                                       include_idl = true;
+                                       continue;
+                               }
+                       }
+                       // switch between general headers and ros headers
+                       if ( !strncmp(incs[i]->directory->relative_path.c_str(), "include\\crt", 11 ) ||
+                            !strncmp(incs[i]->directory->relative_path.c_str(), "include\\ddk", 11 ) ||
+                            !strncmp(incs[i]->directory->relative_path.c_str(), "include\\GL", 10 ) ||
+                            !strncmp(incs[i]->directory->relative_path.c_str(), "include\\psdk", 12 ) ||
+                            !strncmp(incs[i]->directory->relative_path.c_str(), "include\\reactos\\wine", 20 ) )
+                       {
+                               if (strncmp(incs[i]->directory->relative_path.c_str(), "include\\crt", 11 ))
+                                       // not crt include
+                                       includes_ros.push_back ( path );
+                       }
+                       else
+                       {
+                               includes.push_back ( path );
+                       }
+               }
+               const vector<Library*>& libs = data.libraries;
+               for ( i = 0; i < libs.size(); i++ )
+               {
+                       string libpath = outdir + "\\" + libs[i]->importedModule->output->relative_path + "\\" + _get_vc_dir() + "\\---\\" + libs[i]->name + ".lib";
+                       libraries.push_back ( libpath );
+               }
+               const vector<Define*>& defs = data.defines;
+               for ( i = 0; i < defs.size(); i++ )
+               {
+                       if ( defs[i]->backend != "" && defs[i]->backend != "msvc" )
+                               continue;
+
+                       if ( defs[i]->value[0] )
+                               common_defines.insert( defs[i]->name + "=" + defs[i]->value );
+                       else
+                               common_defines.insert( defs[i]->name );
+               }
+               for ( std::map<std::string, Property*>::const_iterator p = data.properties.begin(); p != data.properties.end(); ++ p )
+               {
+                       Property& prop = *p->second;
+                       if ( strstr ( module.baseaddress.c_str(), prop.name.c_str() ) )
+                               baseaddr = prop.value;
+               }
+       }
+       /* include intermediate path for reactos.rc */
+       string version = intdir + "\\include";
+       includes.push_back (version);
+       version += "\\reactos";
+       includes.push_back (version);
+
+       string include_string;
+
+       fprintf ( OUT, "<?xml version=\"1.0\" encoding = \"Windows-1252\"?>\r\n" );
+}
index a20e848..dd59e0b 100644 (file)
@@ -343,14 +343,6 @@ Module::Module ( const Project& project,
        else
                baseaddress = GetDefaultModuleBaseaddress ();
 
-       mangledSymbols = GetBooleanAttribute ( moduleNode, "mangledsymbols" );
-
-       att = moduleNode.GetAttribute ( "underscoresymbols", false );
-       if ( att != NULL )
-               underscoreSymbols = att->value == "true";
-       else
-               underscoreSymbols = false;
-
        isStartupLib = GetBooleanAttribute ( moduleNode, "isstartuplib" );
        isCRT = GetBooleanAttribute ( moduleNode, "iscrt", GetDefaultModuleIsCRT () );
 
@@ -1359,12 +1351,13 @@ Module::GetInvocationTarget ( const int index ) const
 }
 
 string
-Module::GetEntryPoint(bool leadingUnderscore) const
+Module::GetEntryPoint() const
 {
        string result = "";
        if (entrypoint == "0" || entrypoint == "0x0")
                return "0";
-       if (leadingUnderscore)
+       
+       if (Environment::GetArch() != "arm")
                result = "_";
 
        result += entrypoint;
@@ -1874,10 +1867,6 @@ ImportLibrary::ImportLibrary ( const Project& project,
 
        if ( dllname )
                this->dllname = dllname->value;
-       else if ( module->type == StaticLibrary || module->type == HostStaticLibrary )
-               throw XMLInvalidBuildFileException (
-                   node.location,
-                   "<importlibrary> dllname attribute required." );
 
        size_t index = definition->value.find_last_of ( "/\\" );
        if ( index == string::npos )
index 6d70f3a..f8ae933 100644 (file)
@@ -378,8 +378,6 @@ public:
        ImportLibrary* delayImportLibrary;
        Metadata* metadata;
        Bootsector* bootSector;
-       bool mangledSymbols;
-       bool underscoreSymbols;
        bool isUnicode;
        bool isDefaultEntryPoint;
        Bootstrap* bootstrap;
@@ -420,7 +418,7 @@ public:
        bool IsDLL () const;
        std::string GetPathWithPrefix ( const std::string& prefix ) const; // "path/prefixfoo.exe"
        std::string GetPathToBaseDir() const; // "../" offset to rootdirectory
-       std::string GetEntryPoint(bool leadingUnderscore) const;
+       std::string GetEntryPoint() const;
        void GetTargets ( string_list& ) const;
        std::string GetInvocationTarget ( const int index ) const;
        bool HasFileWithExtension ( const IfableData&, const std::string& extension ) const;
index 1a39364..c05e9e1 100644 (file)
@@ -229,6 +229,7 @@ RBUILD_BACKEND_MSVC_BASE_SOURCES = $(addprefix $(RBUILD_MSVC_BASE_), \
        msvc.cpp \
        msvcmaker.cpp \
        vcprojmaker.cpp \
+       vcxprojmaker.cpp \
        )
 
 RBUILD_BACKEND_SOURCES = \
@@ -530,6 +531,10 @@ $(RBUILD_MSVC_INT_)vcprojmaker.o: $(RBUILD_MSVC_BASE_)vcprojmaker.cpp $(RBUILD_H
        $(ECHO_HOSTCC)
        ${host_gpp} $(RBUILD_HOST_CXXFLAGS) -c $< -o $@
 
+$(RBUILD_MSVC_INT_)vcxprojmaker.o: $(RBUILD_MSVC_BASE_)vcxprojmaker.cpp $(RBUILD_HEADERS) | $(RBUILD_MSVC_INT)
+       $(ECHO_HOSTCC)
+       ${host_gpp} $(RBUILD_HOST_CXXFLAGS) -c $< -o $@
+
 $(RBUILD_TEST_TARGET): $(RBUILD_TEST_OBJECTS) $(INFLIB_HOST_OBJECTS) $(RBUILD_HEADERS) | $(RBUILD_OUT)
        $(ECHO_HOSTLD)
        ${host_gpp} $(RBUILD_TEST_OBJECTS) $(INFLIB_HOST_OBJECTS) $(RBUILD_HOST_LFLAGS) -o $@
index 0f91643..01a7baa 100644 (file)
@@ -1,5 +1,5 @@
-Microsoft Visual Studio Solution File, Format Version 9.00\r
-# Visual Studio 2005\r
+Microsoft Visual Studio Solution File, Format Version 10.00\r
+# Visual Studio 2008\r
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "rbuild", "rbuild.vcproj", "{D9305AFB-499E-49F1-A865-99DD7E19E762}"\r
 EndProject\r
 Global\r
index 1e800a4..59f90ad 100644 (file)
@@ -1,10 +1,11 @@
 <?xml version="1.0" encoding="Windows-1252"?>\r
 <VisualStudioProject\r
        ProjectType="Visual C++"\r
-       Version="8,00"\r
+       Version="9.00"\r
        Name="rbuild"\r
        ProjectGUID="{D9305AFB-499E-49F1-A865-99DD7E19E762}"\r
        RootNamespace="rbuild"\r
+       TargetFrameworkVersion="131072"\r
        >\r
        <Platforms>\r
                <Platform\r
@@ -75,6 +76,8 @@
                                SuppressStartupBanner="true"\r
                                ProgramDatabaseFile=".\Release/rbuild.pdb"\r
                                SubSystem="1"\r
+                               RandomizedBaseAddress="1"\r
+                               DataExecutionPrevention="0"\r
                                TargetMachine="1"\r
                        />\r
                        <Tool\r
@@ -95,9 +98,6 @@
                        <Tool\r
                                Name="VCAppVerifierTool"\r
                        />\r
-                       <Tool\r
-                               Name="VCWebDeploymentTool"\r
-                       />\r
                        <Tool\r
                                Name="VCPostBuildEventTool"\r
                        />\r
                                GenerateDebugInformation="true"\r
                                ProgramDatabaseFile=".\Debug/rbuild.pdb"\r
                                SubSystem="1"\r
+                               RandomizedBaseAddress="1"\r
+                               DataExecutionPrevention="0"\r
                                TargetMachine="1"\r
                        />\r
                        <Tool\r
                        <Tool\r
                                Name="VCAppVerifierTool"\r
                        />\r
-                       <Tool\r
-                               Name="VCWebDeploymentTool"\r
-                       />\r
                        <Tool\r
                                Name="VCPostBuildEventTool"\r
                        />\r
                                                />\r
                                        </FileConfiguration>\r
                                </File>\r
+                               <File\r
+                                       RelativePath=".\backend\msvc\vcxprojmaker.cpp"\r
+                                       >\r
+                               </File>\r
                        </Filter>\r
                        <Filter\r
                                Name="mingw"\r
index d79d5cc..39a3d36 100644 (file)
@@ -1,14 +1,6 @@
 /*
- * Usage: log2lines [-cd:fFhmrv] [<exefile> <offset>]
- * Try log2lines -h
- *
- * This is a tool and is compiled using the host compiler,
- * i.e. on Linux gcc and not mingw-gcc (cross-compiler).
- * Therefore we can't include SDK headers and we have to
- * duplicate some definitions here.
- * Also note that the internal functions are "old C-style",
- * returning an int, where a return of 0 means success and
- * non-zero is failure.
+ * ReactOS log2lines
+ * Written by Jan Roeloffzen
  */
 
 #include <stdio.h>
 
 #include "rsym.h"
 
-#define LOG2LINES_VERSION   "1.1"
+#define LOG2LINES_VERSION   "1.5"
 
 #define INVALID_BASE    0xFFFFFFFFL
 
 #define DEF_OPT_DIR     "output-i386"
+#define SOURCES_ENV     "_ROSBE_ROSSOURCEDIR"
 
 #if defined (__DJGPP__) || defined (__WIN32__)
 
 #define CP_FMT          CP_CMD "%s %s > " DEV_NULL
 
 #define CMD_7Z          "7z"
+//#define UNZIP_FMT_7Z    "%s e -y %s -o%s > " DEV_NULL
+#define UNZIP_FMT_7Z    "%s e -y %s -o%s"
 #define UNZIP_FMT       "%s x -y -r %s -o%s > " DEV_NULL
 #define UNZIP_FMT_CAB \
 "%s x -y -r %s" PATH_STR "reactos" PATH_STR "reactos.cab -o%s" PATH_STR "reactos" PATH_STR "reactos > " DEV_NULL
 
 #define LINESIZE        1024
+#define NAMESIZE        80
+
+#define log(outFile, fmt, ...)                          \
+    {                                                   \
+        fprintf(outFile, fmt, ##__VA_ARGS__);           \
+        if (logFile)                                    \
+            fprintf(logFile, fmt, ##__VA_ARGS__);       \
+    }
 
 struct entry_struct
 {
@@ -84,17 +87,31 @@ struct summ_struct
     int     redo;
     int     skipped;
     int     diff;
+    int majordiff;
     int     offset_errors;
     int     total;
 };
 
+struct lineinfo_struct
+{
+    int     valid; 
+    char    file1[LINESIZE];
+    char    func1[NAMESIZE];
+    int     nr1;
+    char    file2[LINESIZE];
+    char    func2[NAMESIZE];
+    int     nr2;
+};
+
 typedef struct cache_struct CACHE;
 typedef struct summ_struct  SUMM;
+typedef struct lineinfo_struct LINEINFO;
 
 static CACHE    cache;
 static SUMM     summ;
+static LINEINFO lastLine;
 
-static char *optchars  = "bcd:fFhl:mMrstTuUvz:";
+static char *optchars  = "bcd:fFhl:mMrsS:tTuUvz:";
 static int opt_buffered= 0;         // -b
 static int opt_help    = 0;         // -h
 static int opt_force   = 0;         // -f
@@ -105,6 +122,7 @@ static int opt_mark    = 0;         // -m
 static int opt_Mark    = 0;         // -M
 static int opt_raw     = 0;         // -r
 static int opt_stats   = 0;         // -s
+static int opt_Source  = 0;         // -S
 static int opt_twice   = 0;         // -t
 static int opt_Twice   = 0;         // -T
 static int opt_undo    = 0;         // -u
@@ -118,6 +136,63 @@ static FILE *logFile   = NULL;
 static char *cache_name;
 static char *tmp_name;
 
+static char sources_path[LINESIZE];
+
+static void
+clearLastLine(void)
+{
+    memset(&lastLine, 0, sizeof(LINEINFO));
+}
+
+static void
+log_file(FILE *outFile, char *fileName, int max )
+{
+    int i = 0, min = 0;
+    char s[LINESIZE];
+    char p[LINESIZE];
+    FILE *src;
+
+    strcpy(p, sources_path);
+    strcat(p, fileName);
+    if ((src = fopen(p, "r")))
+    {
+        min = max - opt_Source;
+        min = (min < 0) ? 0 : min;
+        while (i < max && fgets(s, LINESIZE, src))
+        {
+            if (i >= min)
+                log(outFile, "| %4.4d  %s", i + 1, s);
+            i++;
+        }
+        fclose(src);
+    }
+    else if (opt_verbose)
+        fprintf(stderr, "Can't open: %s (check " SOURCES_ENV ")\n", p);
+}
+
+static void
+logSource(FILE *outFile)
+{
+    log_file(outFile, lastLine.file1, lastLine.nr1);
+    if (lastLine.nr2)
+    {
+        log(outFile, "| ---- [%u] ----\n", lastLine.nr2);
+        log_file(outFile, lastLine.file2, lastLine.nr2);
+    }
+}
+
+static void
+reportSource(FILE *outFile)
+{
+    if (!opt_Source)
+        return;
+    if (lastLine.valid)
+    {
+        logSource(outFile);
+    }
+    clearLastLine();
+}
+
 static char *
 basename(char *path)
 {
@@ -152,7 +227,7 @@ find_rossym_section(PIMAGE_FILE_HEADER PEFileHeader, PIMAGE_SECTION_HEADER PESec
 }
 
 static PROSSYM_ENTRY
-find_offset(void *data, size_t offset, char *toString)
+find_offset(void *data, size_t offset)
 {
     PSYMBOLFILE_HEADER RosSymHeader = (PSYMBOLFILE_HEADER) data;
     PROSSYM_ENTRY Entries = (PROSSYM_ENTRY) ((char *)data + RosSymHeader->SymbolsOffset);
@@ -180,61 +255,96 @@ print_offset(void *data, size_t offset, char *toString)
     PSYMBOLFILE_HEADER RosSymHeader = (PSYMBOLFILE_HEADER) data;
     PROSSYM_ENTRY e = NULL;
     PROSSYM_ENTRY e2 = NULL;
+    int bFileOffsetChanged = 0;
+    char fmt[LINESIZE];
     char *Strings = (char *)data + RosSymHeader->StringsOffset;
 
-    
-    e = find_offset(data, offset, toString);
+    fmt[0] = '\0';
+    e = find_offset(data, offset);
     if (opt_twice)
     {
-        e2 = find_offset(data, offset-1, toString);
+        e2 = find_offset(data, offset - 1);
         
         if (  e == e2 )
             e2 = NULL;
+        else
+            summ.diff++;
 
         if ( opt_Twice &&  e2 )
         {
             e = e2;
             e2 = NULL;
-            /* replaced (transparantly), but update stats: */
-            summ.diff ++;
+            /* replaced (transparantly), but updated stats */
         }
     }
     if ( e || e2 )
     {
+        strcpy(lastLine.file1, &Strings[e->FileOffset]);
+        strcpy(lastLine.func1, &Strings[e->FunctionOffset]);
+        lastLine.nr1 = e->SourceLine;
+        lastLine.valid = 1;
+        if (e2)
+        {
+            strcpy(lastLine.file2, &Strings[e2->FileOffset]);
+            strcpy(lastLine.func2, &Strings[e2->FunctionOffset]);
+            lastLine.nr2 = e2->SourceLine;
+            bFileOffsetChanged = e->FileOffset != e2->FileOffset;
+            if (e->FileOffset != e2->FileOffset || e->FunctionOffset != e2->FunctionOffset)
+                summ.majordiff++;
+
+            /*
+            * - "%.0s" displays nothing, but processes argument
+            * - bFileOffsetChanged implies always display 2nd SourceLine even if the same
+            * - also for FunctionOffset
+            */
+            strcat(fmt, "%s");
+            if (bFileOffsetChanged)
+                strcat(fmt, "[%s]");
+            else
+                strcat(fmt, "%.0s");
+
+            strcat(fmt, ":%u");
+            if (e->SourceLine != e2->SourceLine || bFileOffsetChanged)
+                strcat(fmt, "[%u]");
+            else
+                strcat(fmt, "%.0u");
+
+            strcat(fmt, " (%s");
+            if (e->FunctionOffset != e2->FunctionOffset || bFileOffsetChanged)
+                strcat(fmt, "[%s])");
+            else
+                strcat(fmt, "%.0s)");
+
         if (toString)
         {  // put in toString if provided
-            if ( e2 )
-            {
-                snprintf(toString, LINESIZE, "%s:%u (%s) [%s:%u (%s)]",
+                snprintf(toString, LINESIZE, fmt,
                          &Strings[e->FileOffset],
+                    &Strings[e2->FileOffset],
                          (unsigned int)e->SourceLine,
+                    (unsigned int)e2->SourceLine,
                          &Strings[e->FunctionOffset],
-                         &Strings[e2->FileOffset],
-                         (unsigned int)e2->SourceLine,
                          &Strings[e2->FunctionOffset]);
-                summ.diff ++;
             }
             else
             {
-                snprintf(toString, LINESIZE, "%s:%u (%s)",
+                strcat(fmt, "\n");
+                printf(fmt,
                          &Strings[e->FileOffset],
+                    &Strings[e2->FileOffset],
                          (unsigned int)e->SourceLine,
-                         &Strings[e->FunctionOffset]);
+                    (unsigned int)e2->SourceLine,
+                    &Strings[e->FunctionOffset],
+                    &Strings[e2->FunctionOffset]);
             }
-            return 0;
         }
         else
-        {  // to stdout
-            if ( e2 )
             {
-                printf("%s:%u (%s) [%s:%u (%s)]\n",
+            if (toString)
+            {   // put in toString if provided
+                snprintf(toString, LINESIZE, "%s:%u (%s)",
                        &Strings[e->FileOffset],
                        (unsigned int)e->SourceLine,
-                       &Strings[e->FunctionOffset],
-                       &Strings[e2->FileOffset],
-                       (unsigned int)e2->SourceLine,
-                       &Strings[e2->FunctionOffset]);
-                summ.diff ++;
+                    &Strings[e->FunctionOffset]);
             }
             else
             {
@@ -243,14 +353,14 @@ print_offset(void *data, size_t offset, char *toString)
                        (unsigned int)e->SourceLine,
                        &Strings[e->FunctionOffset]);
             }
+        }
             return 0;
         }
-    }
     return 1;
 }
 
 static int
-process_data(const void *FileData, size_t FileSize, size_t offset, char *toString)
+process_data(const void *FileData, size_t offset, char *toString)
 {
     PIMAGE_DOS_HEADER PEDosHeader;
     PIMAGE_FILE_HEADER PEFileHeader;
@@ -309,10 +419,9 @@ process_data(const void *FileData, size_t FileSize, size_t offset, char *toStrin
     return res;
 }
 
-static long
-my_atoi(const char *a)
+static const char *
+getFmt(const char *a)
 {
-    int i = 0;
     const char *fmt = "%x";
 
     if (*a == '0')
@@ -332,10 +441,26 @@ my_atoi(const char *a)
             break;
         }
     }
-    sscanf(a, fmt, &i);
+    return fmt;
+}
+
+static long
+my_atoi(const char *a)
+{
+    int i = 0;
+    sscanf(a, getFmt(a), &i);
     return i;
 }
 
+static int
+isOffset(const char *a)
+{
+    int i = 0;
+    if (strchr(a, '.'))
+        return 0;
+    return sscanf(a, getFmt(a), &i);
+}
+
 static int
 file_exists(char *name)
 {
@@ -387,7 +512,7 @@ process_file(const char *file_name, size_t offset, char *toString)
     }
     else
     {
-        res = process_data(FileData, FileSize, offset, toString);
+        res = process_data(FileData, offset, toString);
         free(FileData);
     }
     return res;
@@ -408,7 +533,7 @@ get_ImageBase(char *fname, size_t *ImageBase)
     fr = fopen(fname, "rb");
     if (!fr)
     {
-        if (opt_verbose)
+        if (opt_verbose > 2)
             fprintf(stderr, "get_ImageBase, cannot open '%s' (%s)\n", fname, strerror(errno));
         return 1;
     }
@@ -453,8 +578,8 @@ get_ImageBase(char *fname, size_t *ImageBase)
     }
 
     /* Check if it's really an IMAGE_OPTIONAL_HEADER we are interested in */
-    if ((PEOptHeader.Magic != IMAGE_NT_OPTIONAL_HDR32_MAGIC) &&
-        (PEOptHeader.Magic != IMAGE_NT_OPTIONAL_HDR64_MAGIC))
+    if (PEOptHeader.Magic != IMAGE_NT_OPTIONAL_HDR32_MAGIC &&
+        PEOptHeader.Magic != IMAGE_NT_OPTIONAL_HDR64_MAGIC)
     {
         if (opt_verbose > 1)
             fprintf(stderr, "get_ImageBase %s, not an IMAGE_NT_OPTIONAL_HDR<32|64>\n", fname);
@@ -680,7 +805,7 @@ create_cache(int force, int skipImageBase)
                 if (*Fname == '\n')
                     *Fname = '\0';
 
-                while ((Fname > Line) && (*Fname != PATH_CHAR))
+                while (Fname > Line && *Fname != PATH_CHAR)
                     Fname--;
                 if (*Fname == PATH_CHAR)
                     Fname++;
@@ -786,9 +911,19 @@ translate_line(FILE *outFile, char *Line, char *path, char *LineOut)
 
     if (!*Line)
         return;
+
     res = 1;
     mark = "";
     s = remove_mark(Line);
+    if (opt_undo)
+    {
+        /* Strip all lines added by this tool: */
+        char buf[NAMESIZE];
+        if (sscanf(s, "| %s", buf) == 1)
+            if (buf[0] == '0' || strcmp(buf, "----") == 0 || atoi(buf))
+                res = 0;
+    }
+
     sep = strchr(s, ':');
     if (sep)
     {
@@ -800,23 +935,19 @@ translate_line(FILE *outFile, char *Line, char *path, char *LineOut)
             {
                 tail = strchr(s, '>');
                 tail = tail ? tail-1 : tail;
-                if (tail && (tail[0] == ')') && (tail[1] == '>') )
+                if (tail && tail[0] == ')' && tail[1] == '>')
                 {
                     res = 0;
                     tail += 2;
                     mark = opt_mark ? "* " : "";
                     if (opt_redo && !(res = translate_file(path, offset, LineOut)))
                     {
-                        fprintf(outFile, "%s<%s:%x (%s)>%s", mark, path, offset, LineOut, tail);
-                        if (logFile)
-                            fprintf(logFile, "%s<%s:%x (%s)>%s", mark, path, offset, LineOut, tail);
+                        log(outFile, "%s<%s:%x (%s)>%s", mark, path, offset, LineOut, tail);
                         summ.redo ++;
                     }
                     else
                     {
-                        fprintf(outFile, "%s<%s:%x>%s", mark, path, offset, tail);
-                        if (logFile)
-                            fprintf(logFile, "%s<%s:%x>%s", mark, path, offset, tail);
+                        log(outFile, "%s<%s:%x>%s", mark, path, offset, tail);
                         summ.undo ++;
                     }
                 }
@@ -837,9 +968,7 @@ translate_line(FILE *outFile, char *Line, char *path, char *LineOut)
                 if (!(res = translate_file(path, offset, LineOut)))
                 {
                     mark = opt_mark ? "* " : "";
-                    fprintf(outFile, "%s<%s:%x (%s)>%s", mark, path, offset, LineOut, tail);
-                    if (logFile)
-                        fprintf(logFile, "%s<%s:%x (%s)>%s", mark, path, offset, LineOut, tail);
+                    log(outFile, "%s<%s:%x (%s)>%s", mark, path, offset, LineOut, tail);
                     summ.translated ++;
                 }
                 else
@@ -855,9 +984,7 @@ translate_line(FILE *outFile, char *Line, char *path, char *LineOut)
     {
         if (sep)
             *sep = ':';  // restore because not translated
-        fprintf(outFile, "%s%s", mark, s);  // just copy
-        if (logFile)
-            fprintf(logFile, "%s%s", mark, s);  // just copy
+        log(outFile, "%s%s", mark, s);
     }
     memset(Line, '\0', LINESIZE);  // flushed
 }
@@ -873,6 +1000,7 @@ print_summary(FILE * outFile)
         fprintf(outFile, "Retranslated: %d\n", summ.redo);
         fprintf(outFile, "Skipped:      %d\n", summ.skipped);
         fprintf(outFile, "Differ:       %d\n", summ.diff);
+        fprintf(outFile, "Differ (function/source): %d\n", summ.majordiff);
         fprintf(outFile, "Offset error: %d\n", summ.offset_errors);
         fprintf(outFile, "Total:        %d\n", summ.total);
         fprintf(outFile, "-------------------------------\n");
@@ -909,6 +1037,7 @@ translate_files(FILE * inFile, FILE * outFile)
                         translate_line(outFile, Line, path, LineOut);
                         i = 0;
                         translate_char(c, outFile);
+                        reportSource(outFile);
                         break;
                     case '<':
                         i = 0;
@@ -927,7 +1056,6 @@ translate_files(FILE * inFile, FILE * outFile)
                                 translate_line(outFile, Line, path, LineOut);
                                 translate_char(c, outFile);
                             }
-                            i = 0;
                         }
                         else
                         {
@@ -968,12 +1096,11 @@ translate_files(FILE * inFile, FILE * outFile)
                 if (!opt_raw)
                 {
                     translate_line(outFile, Line, path, LineOut);
+                    reportSource(outFile);
                 }
                 else
                 {
-                    fprintf(outFile, "%s", Line);  // just copy
-                    if (logFile)
-                        fprintf(logFile, "%s", Line);  // just copy
+                    log(outFile, "%s", Line);
                 }
             }
         }
@@ -993,7 +1120,10 @@ translate_files(FILE * inFile, FILE * outFile)
 static char *verboseUsage =
 "\n"
 "Description:\n"
-"  When <exefile> <offset> are given, log2lines works just like raddr2line\n"
+"  When <exefile> <offset> are given, log2lines works like raddr2line:\n"
+"      - The <exefile> <offset> combination can be repeated\n"
+"      - Also, <offset> can be repeated for each <exefile>\n"
+"      - NOTE: some of the options below will have no effect in this form.\n"
 "  Otherwise it reads stdin and tries to translate lines of the form:\n"
 "  <IMAGENAME:ADDRESS>\n\n"
 "  The result is written to stdout.\n"
@@ -1008,7 +1138,9 @@ static char *verboseUsage =
 "  -d <directory>|<ISO image>\n"
 "       Directory to scan for images. (Do not append a '" PATH_STR "')\n"
 "       This option also takes an ISO image as argument:\n"
-"       - The image is recognized by the '.iso' extension.\n"
+"       - The image is recognized by the '.iso' or '.7z' extension.\n"
+"       - NOTE: The '.7z' and extracted '.iso' basenames must be identical,\n"
+"         which is normally true for Reactos trunk builds.\n"
 "       - The image will be unpacked to a directory with the same name.\n"
 "       - The embedded reactos.cab file will also be unpacked.\n"
 "       - Combined with -f the file will be re-unpacked.\n"
@@ -1031,21 +1163,31 @@ static char *verboseUsage =
 "       - Retranslated: Lines retranslated. See -U option\n"
 "       - Skipped:      Lines not translated.\n"
 "       - Differ:       Lines where (addr-1) info differs. See -tT options\n"
+"       - Differ(func/src):Lines where also function or source info differ.\n"
 "       - Offset error: Image exists, but error retrieving offset info.\n"
 "       - Total:        Total number of lines attempted to translate.\n"
 "       Also some version info is displayed.\n\n"
-"  -t   Translate twice. The address itself and for (address - 1)\n"
-"       Display extra filename and linenumber between [..] if they differ\n\n"
-"  -T   As -t, but the original filename+linenumber gets replaced\n\n"
+"  -S <context>\n"
+"       Source lines. Display up to <context> lines until linenumber.\n"
+"       The environment variable _ROSBE_ROSSOURCEDIR should be correctly set.\n"
+"       For a reliable result, these sources should be up to date with\n"
+"       the revision you test.\n"
+"       Can be combined with -tT.\n"
+"       Implies -U. Retranslation needed for retrieving source info.\n\n"
+"  -t   Translate twice. The address itself and for (address - 1).\n"
+"       Show extra filename, func and linenumber between [..] if they differ\n"
+"       So if only the linenumbers differ, then only show the extra\n"
+"       linenumber.\n\n"
+"  -T   As -t, but show only filename+func+linenumber for (address - 1.)\n\n"
 "  -u   Undo translations.\n"
 "       Lines are translated back (reverted) to the form <IMAGENAME:ADDRESS>\n"
-"       Overrides console mode -c.\n\n"
+"       Also removes all lines previously added by this tool (see -S)\n\n"
 "  -U   Undo and reprocess.\n"
 "       Reverted to the form <IMAGENAME:ADDRESS>, and then retranslated\n"
-"       Overrides console mode -c, implies -u.\n\n"
+"       Implies -u.\n\n"
 "  -v   Show detailed errors and tracing.\n"
 "       Repeating this option adds more verbosity.\n"
-"       Default: only (major) errors\n" "\n\n"
+"       Default: only (major) errors\n\n"
 "  -z <path to 7z>\n"
 "       Specify path to 7z. See also option -d.\n"
 "       Default: '7z'\n"
@@ -1061,14 +1203,30 @@ static char *verboseUsage =
 "  Use kdbg debugger to send output to logfile:\n"
 "       log2lines < \\\\.\\pipe\\kdbg > dbg.log\n\n"
 "  Re-translate a debug log:\n"
-"       log2lines -d bootcd-38701-dbg.iso < bugxxxx.log\n\n"
+"       log2lines -U -d bootcd-38701-dbg.iso < bugxxxx.log\n\n"
+"  Re-translate a debug log. Specify a 7z file, which wil be decompressed.\n"
+"  Also check for (address) - (address - 1) differences:\n"
+"       log2lines -U -t -d bootcd-38701-dbg.7z < bugxxxx.log\n"
+"  This would generate loglines like:\n"
+"       '<ntdll.dll:60f1 (dll/ntdll/ldr/utils.c:337[331] (LdrPEStartup))>'\n\n"
+"  The following command line invocations are equivalent:\n"
+"       log2lines msi.dll 2e35d msi.dll 2235 msiexec.exe 30a8 msiexec.exe 2e89\n"
+"       log2lines msi.dll 2e35d 2235 msiexec.exe 30a8 2e89\n\n"
+"  Generate source lines from backtrace ('bt') output. Show 2 lines of context:\n"
+"       log2lines -S 2 -d bootcd-38701-dbg.7z < bugxxxx.log\n"
+"       <msiexec.exe:2e89 (lib/3rdparty/mingw/crtexe.c:259 (__tmainCRTStartup))>\n"
+"       | 0258  #else\n"
+"       | 0259      mainret = main (\n"
+"       <msiexec.exe:2fad (lib/3rdparty/mingw/crtexe.c:160 (WinMainCRTStartup))>\n"
+"       | 0159    return __tmainCRTStartup ();\n"
+"       | 0160  }\n"
 "\n";
 
 static void
 usage(int verbose)
 {
     fprintf(stderr, "log2lines " LOG2LINES_VERSION "\n\n");
-    fprintf(stderr, "Usage: log2lines [-%s] [<exefile> <offset>]\n", optchars);
+    fprintf(stderr, "Usage: log2lines -%s {<exefile> <offset> {<offset>}}\n", optchars);
     if (verbose)
     {
         fprintf(stderr, "%s", verboseUsage);
@@ -1135,10 +1293,51 @@ unpack_iso(char *dir, char *iso)
 static int
 check_directory(int force)
 {
+    char Line[LINESIZE];
     char freeldr_path[MAX_PATH];
     char iso_path[MAX_PATH];
+    char compressed_7z_path[MAX_PATH];
+    char *check_iso;
+    char *check_dir;
+
+    check_iso = strrchr(opt_dir, '.');
+    if (check_iso && PATHCMP(check_iso, ".7z") == 0)
+    {
+        if (opt_verbose)
+            fprintf(stderr, "Uncompressing 7z image: %s\n", opt_dir);
+
+        // First attempt to decompress to a .iso image
+        strcpy(compressed_7z_path, opt_dir);
+        if ((check_dir = strrchr(compressed_7z_path, PATH_CHAR)))
+        {
+            *check_dir = '\0';
+        }
+        else
+            strcpy(compressed_7z_path, "."); // default to current dir
+
+        sprintf(Line, UNZIP_FMT_7Z, opt_7z, opt_dir, compressed_7z_path);
+
+        /* This of course only works if the .7z and .iso basenames are identical
+         * which is normally true for our trunk builds:
+         */
+        strcpy(check_iso, ".iso");
+        if (!file_exists(opt_dir) || force)
+        {
+            if (system(Line) < 0)
+            {
+                fprintf(stderr, "\nCannot decompress to iso image %s\n", opt_dir);
+                if (opt_verbose)
+                    fprintf(stderr, "Failed to execute: '%s'\n", Line);
+                return 2;
+            }
+        }
+        else
+        {
+            if (opt_verbose > 1)
+                fprintf(stderr, "%s already decompressed\n", opt_dir);
+        }
+    }
 
-    char *check_iso = strrchr(opt_dir, '.');
     if (check_iso && PATHCMP(check_iso, ".iso") == 0)
     {
         if (opt_verbose)
@@ -1185,6 +1384,14 @@ main(int argc, const char **argv)
     int opt;
     int optCount = 0;
     int i;
+    char *s;
+
+    strcpy(sources_path, "");
+    if ((s = getenv(SOURCES_ENV)))
+    {
+        strcpy(sources_path, s);
+        strcat(sources_path, PATH_STR);
+    }
 
     strcpy(opt_scanned, "");
     for (i=1; i<argc; i++)
@@ -1197,6 +1404,7 @@ main(int argc, const char **argv)
     strcpy(opt_7z, CMD_7Z);
 
     memset(&summ, 0, sizeof(SUMM));
+    clearLastLine();
 
     while (-1 != (opt = getopt(argc, (char **const)argv, optchars)))
     {
@@ -1218,7 +1426,7 @@ main(int argc, const char **argv)
         case 'h':
             opt_help++;
             usage(1);
-            exit(0);
+            return 0;
             break;
         case 'F':
             opt_exit++;
@@ -1240,6 +1448,10 @@ main(int argc, const char **argv)
         case 's':
             opt_stats++;
             break;
+        case 'S':
+            optCount++;
+            opt_Source = atoi(optarg);
+            break;
         case 't':
             opt_twice++;
             break;
@@ -1263,27 +1475,24 @@ main(int argc, const char **argv)
             break;
         default:
             usage(0);
-            exit(2);
+            return 2;
             break;
         }
         optCount++;
     }
-    if (opt_undo)
-        opt_console = 0;
-
-    argc -= optCount;
-    if (argc != 1 && argc != 3)
+    if (opt_Source)
     {
-        usage(0);
-        exit(1);
+        /* need to retranslate for source info: */
+        opt_undo++;
+        opt_redo++;
     }
-
+    argc -= optCount;
     if (check_directory(opt_force))
-        exit(3);
+        return 3;
 
     create_cache(opt_force, 0);
     if (opt_exit)
-        exit(0);
+        return 0;
 
     read_cache();
 
@@ -1308,13 +1517,40 @@ main(int argc, const char **argv)
         else
         {
             fprintf(stderr, "Could not open logfile %s (%s)\n", opt_logFile, strerror(errno));
-            exit(2);
+            return 2;
+        }
+    }
 
+    if (argc > 1)
+    {   // translate {<exefile> <offset>}
+        int i = 1;
+        const char *base = NULL;
+        const char *offset = NULL;
+        while (i < argc)
+        {
+            offset = argv[optCount + i++];
+            if (isOffset(offset))
+            {
+                if (base)
+                {
+                    if (opt_verbose > 1)
+                        fprintf(stderr, "translating %s %s\n", base, offset);
+                    translate_file(base, my_atoi(offset), NULL);
+                    reportSource(stdout);
         }
+                else
+                {
+                    fprintf(stderr, "<exefile> expected\n");
+                    res = 3;
+                    break;
     }
-    if (argc == 3)
-    {  // translate <exefile> <offset>
-        translate_file(argv[optCount + 1], my_atoi(argv[optCount + 2]), NULL);
+    }
+    else
+            {
+                // Must be exefile
+                base = offset;
+            }
+        }
     }
     else
     {  // translate logging from stdin
@@ -1323,5 +1559,6 @@ main(int argc, const char **argv)
 
     if (logFile)
         fclose(logFile);
+
     return res;
 }
index 405b5de..b528376 100644 (file)
@@ -101,9 +101,16 @@ expr_t *make_exprs(enum expr_type type, char *val)
     return e;
 }
 
-expr_t *make_exprt(enum expr_type type, type_t *tref, expr_t *expr)
+expr_t *make_exprt(enum expr_type type, var_t *var, expr_t *expr)
 {
     expr_t *e;
+    type_t *tref;
+
+    if (var->stgclass != STG_NONE && var->stgclass != STG_REGISTER)
+        error_loc("invalid storage class for type expression\n");
+
+    tref = var->type;
+
     e = xmalloc(sizeof(expr_t));
     e->type = type;
     e->ref = expr;
@@ -125,6 +132,7 @@ expr_t *make_exprt(enum expr_type type, type_t *tref, expr_t *expr)
         e->is_const = TRUE;
         e->cval = expr->cval;
     }
+    free(var);
     return e;
 }
 
@@ -297,15 +305,19 @@ static int is_integer_type(const type_t *type)
         case TYPE_BASIC_INT32:
         case TYPE_BASIC_INT64:
         case TYPE_BASIC_INT:
+        case TYPE_BASIC_INT3264:
         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:
+        case TYPE_BASIC_FLOAT:
+        case TYPE_BASIC_DOUBLE:
+        case TYPE_BASIC_HANDLE:
             return FALSE;
         }
+        return FALSE;
     default:
         return FALSE;
     }
@@ -376,6 +388,7 @@ static type_t *find_identifier(const char *identifier, const type_t *cont_type,
         case TYPE_INTERFACE:
         case TYPE_POINTER:
         case TYPE_ARRAY:
+        case TYPE_BITFIELD:
             /* nothing to do */
             break;
         case TYPE_ALIAS:
index 31ce31d..e16975a 100644 (file)
@@ -29,7 +29,7 @@ extern expr_t *make_expr(enum expr_type type);
 extern expr_t *make_exprl(enum expr_type type, long val);
 extern expr_t *make_exprd(enum expr_type type, double val);
 extern expr_t *make_exprs(enum expr_type type, char *val);
-extern expr_t *make_exprt(enum expr_type type, type_t *tref, expr_t *expr);
+extern expr_t *make_exprt(enum expr_type type, var_t *var, expr_t *expr);
 extern expr_t *make_expr1(enum expr_type type, expr_t *expr);
 extern expr_t *make_expr2(enum expr_type type, expr_t *exp1, expr_t *exp2);
 extern expr_t *make_expr3(enum expr_type type, expr_t *expr1, expr_t *expr2, expr_t *expr3);
index b6b7be8..9c8e3b2 100644 (file)
@@ -265,6 +265,7 @@ void write_type_left(FILE *h, type_t *t, int declonly)
         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_INT3264: fprintf(h, "__int3264"); 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;
@@ -294,6 +295,9 @@ void write_type_left(FILE *h, type_t *t, int declonly)
       case TYPE_VOID:
         fprintf(h, "void");
         break;
+      case TYPE_BITFIELD:
+        write_type_left(h, type_bitfield_get_field(t), declonly);
+        break;
       case TYPE_ALIAS:
       case TYPE_FUNCTION:
         /* handled elsewhere */
@@ -307,8 +311,13 @@ void write_type_right(FILE *h, type_t *t, int is_field)
 {
   if (!h) return;
 
-  if (type_get_type(t) == TYPE_ARRAY && !type_array_is_decl_as_ptr(t)) {
-    if (is_conformant_array(t)) {
+  switch (type_get_type(t))
+  {
+  case TYPE_ARRAY:
+    if (!type_array_is_decl_as_ptr(t))
+    {
+      if (is_conformant_array(t))
+      {
       fprintf(h, "[%s]", is_field ? "1" : "");
       t = type_array_get_element(t);
     }
@@ -317,15 +326,34 @@ void write_type_right(FILE *h, type_t *t, int is_field)
          t = type_array_get_element(t))
       fprintf(h, "[%u]", type_array_get_dim(t));
   }
+    break;
+  case TYPE_BITFIELD:
+    fprintf(h, " : %lu", type_bitfield_get_bits(t)->cval);
+    break;
+  case TYPE_VOID:
+  case TYPE_BASIC:
+  case TYPE_ENUM:
+  case TYPE_STRUCT:
+  case TYPE_ENCAPSULATED_UNION:
+  case TYPE_UNION:
+  case TYPE_ALIAS:
+  case TYPE_MODULE:
+  case TYPE_COCLASS:
+  case TYPE_FUNCTION:
+  case TYPE_INTERFACE:
+  case TYPE_POINTER:
+    break;
+}
 }
 
 static void write_type_v(FILE *h, type_t *t, int is_field, int declonly, const char *name)
 {
-  type_t *pt;
+  type_t *pt = NULL;
   int ptr_level = 0;
 
   if (!h) return;
 
+  if (t) {
   for (pt = t; is_ptr(pt); pt = type_pointer_get_ref(pt), ptr_level++)
     ;
 
@@ -342,9 +370,11 @@ static void write_type_v(FILE *h, type_t *t, int is_field, int declonly, const c
       fputc('*', h);
   } else
     write_type_left(h, t, declonly);
+  }
 
-  if (name) fprintf(h, "%s%s", needs_space_after(t) ? " " : "", name );
+  if (name) fprintf(h, "%s%s", !t || needs_space_after(t) ? " " : "", name );
 
+  if (t) {
   if (type_get_type_detect_alias(pt) == TYPE_FUNCTION) {
     const var_list_t *args = type_function_get_args(pt);
 
@@ -358,6 +388,7 @@ static void write_type_v(FILE *h, type_t *t, int is_field, int declonly, const c
   } else
     write_type_right(h, t, is_field);
 }
+}
 
 void write_type_def_or_decl(FILE *f, type_t *t, int field, const char *name)
 {
index 55a73c7..f509cb1 100644 (file)
@@ -193,6 +193,7 @@ SAFEARRAY{ws}*/\(   return tSAFEARRAY;
 <INITIAL,ATTR>\<=      return LESSEQUAL;
 <INITIAL,ATTR>\|\|     return LOGICALOR;
 <INITIAL,ATTR>&&       return LOGICALAND;
+<INITIAL,ATTR>\.\.\.   return ELLIPSIS;
 <INITIAL,ATTR>.                return yytext[0];
 <<EOF>>                        {
                                if (import_stack_ptr)
@@ -220,6 +221,7 @@ static const struct keyword keywords[] = {
        {"TRUE",                        tTRUE},
        {"__cdecl",                     tCDECL},
        {"__fastcall",                  tFASTCALL},
+       {"__int3264",                   tINT3264},
        {"__int64",                     tINT64},
        {"__pascal",                    tPASCAL},
        {"__stdcall",                   tSTDCALL},
@@ -279,6 +281,7 @@ static const struct keyword attr_keywords[] =
 {
         {"aggregatable",                tAGGREGATABLE},
         {"allocate",                    tALLOCATE},
+        {"annotation",                  tANNOTATION},
         {"appobject",                   tAPPOBJECT},
         {"async",                       tASYNC},
         {"async_uuid",                  tASYNCUUID},
index c5962de..2ed6178 100644 (file)
@@ -180,7 +180,7 @@ 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_t *declare_var(attr_list_t *attrs, 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);
@@ -200,7 +200,7 @@ 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_arg_attrs(const 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);
@@ -279,136 +279,139 @@ static statement_list_t *append_statement(statement_list_t *list, statement_t *s
      LESSEQUAL = 273,
      LOGICALOR = 274,
      LOGICALAND = 275,
-     tAGGREGATABLE = 276,
-     tALLOCATE = 277,
-     tAPPOBJECT = 278,
-     tASYNC = 279,
-     tASYNCUUID = 280,
-     tAUTOHANDLE = 281,
-     tBINDABLE = 282,
-     tBOOLEAN = 283,
-     tBROADCAST = 284,
-     tBYTE = 285,
-     tBYTECOUNT = 286,
-     tCALLAS = 287,
-     tCALLBACK = 288,
-     tCASE = 289,
-     tCDECL = 290,
-     tCHAR = 291,
-     tCOCLASS = 292,
-     tCODE = 293,
-     tCOMMSTATUS = 294,
-     tCONST = 295,
-     tCONTEXTHANDLE = 296,
-     tCONTEXTHANDLENOSERIALIZE = 297,
-     tCONTEXTHANDLESERIALIZE = 298,
-     tCONTROL = 299,
-     tCPPQUOTE = 300,
-     tDEFAULT = 301,
-     tDEFAULTCOLLELEM = 302,
-     tDEFAULTVALUE = 303,
-     tDEFAULTVTABLE = 304,
-     tDISPLAYBIND = 305,
-     tDISPINTERFACE = 306,
-     tDLLNAME = 307,
-     tDOUBLE = 308,
-     tDUAL = 309,
-     tENDPOINT = 310,
-     tENTRY = 311,
-     tENUM = 312,
-     tERRORSTATUST = 313,
-     tEXPLICITHANDLE = 314,
-     tEXTERN = 315,
-     tFALSE = 316,
-     tFASTCALL = 317,
-     tFLOAT = 318,
-     tHANDLE = 319,
-     tHANDLET = 320,
-     tHELPCONTEXT = 321,
-     tHELPFILE = 322,
-     tHELPSTRING = 323,
-     tHELPSTRINGCONTEXT = 324,
-     tHELPSTRINGDLL = 325,
-     tHIDDEN = 326,
-     tHYPER = 327,
-     tID = 328,
-     tIDEMPOTENT = 329,
-     tIIDIS = 330,
-     tIMMEDIATEBIND = 331,
-     tIMPLICITHANDLE = 332,
-     tIMPORT = 333,
-     tIMPORTLIB = 334,
-     tIN = 335,
-     tIN_LINE = 336,
-     tINLINE = 337,
-     tINPUTSYNC = 338,
-     tINT = 339,
-     tINT64 = 340,
-     tINTERFACE = 341,
-     tLCID = 342,
-     tLENGTHIS = 343,
-     tLIBRARY = 344,
-     tLOCAL = 345,
-     tLONG = 346,
-     tMETHODS = 347,
-     tMODULE = 348,
-     tNONBROWSABLE = 349,
-     tNONCREATABLE = 350,
-     tNONEXTENSIBLE = 351,
-     tNULL = 352,
-     tOBJECT = 353,
-     tODL = 354,
-     tOLEAUTOMATION = 355,
-     tOPTIONAL = 356,
-     tOUT = 357,
-     tPASCAL = 358,
-     tPOINTERDEFAULT = 359,
-     tPROPERTIES = 360,
-     tPROPGET = 361,
-     tPROPPUT = 362,
-     tPROPPUTREF = 363,
-     tPTR = 364,
-     tPUBLIC = 365,
-     tRANGE = 366,
-     tREADONLY = 367,
-     tREF = 368,
-     tREGISTER = 369,
-     tREQUESTEDIT = 370,
-     tRESTRICTED = 371,
-     tRETVAL = 372,
-     tSAFEARRAY = 373,
-     tSHORT = 374,
-     tSIGNED = 375,
-     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
+     ELLIPSIS = 276,
+     tAGGREGATABLE = 277,
+     tALLOCATE = 278,
+     tANNOTATION = 279,
+     tAPPOBJECT = 280,
+     tASYNC = 281,
+     tASYNCUUID = 282,
+     tAUTOHANDLE = 283,
+     tBINDABLE = 284,
+     tBOOLEAN = 285,
+     tBROADCAST = 286,
+     tBYTE = 287,
+     tBYTECOUNT = 288,
+     tCALLAS = 289,
+     tCALLBACK = 290,
+     tCASE = 291,
+     tCDECL = 292,
+     tCHAR = 293,
+     tCOCLASS = 294,
+     tCODE = 295,
+     tCOMMSTATUS = 296,
+     tCONST = 297,
+     tCONTEXTHANDLE = 298,
+     tCONTEXTHANDLENOSERIALIZE = 299,
+     tCONTEXTHANDLESERIALIZE = 300,
+     tCONTROL = 301,
+     tCPPQUOTE = 302,
+     tDEFAULT = 303,
+     tDEFAULTCOLLELEM = 304,
+     tDEFAULTVALUE = 305,
+     tDEFAULTVTABLE = 306,
+     tDISPLAYBIND = 307,
+     tDISPINTERFACE = 308,
+     tDLLNAME = 309,
+     tDOUBLE = 310,
+     tDUAL = 311,
+     tENDPOINT = 312,
+     tENTRY = 313,
+     tENUM = 314,
+     tERRORSTATUST = 315,
+     tEXPLICITHANDLE = 316,
+     tEXTERN = 317,
+     tFALSE = 318,
+     tFASTCALL = 319,
+     tFLOAT = 320,
+     tHANDLE = 321,
+     tHANDLET = 322,
+     tHELPCONTEXT = 323,
+     tHELPFILE = 324,
+     tHELPSTRING = 325,
+     tHELPSTRINGCONTEXT = 326,
+     tHELPSTRINGDLL = 327,
+     tHIDDEN = 328,
+     tHYPER = 329,
+     tID = 330,
+     tIDEMPOTENT = 331,
+     tIIDIS = 332,
+     tIMMEDIATEBIND = 333,
+     tIMPLICITHANDLE = 334,
+     tIMPORT = 335,
+     tIMPORTLIB = 336,
+     tIN = 337,
+     tIN_LINE = 338,
+     tINLINE = 339,
+     tINPUTSYNC = 340,
+     tINT = 341,
+     tINT3264 = 342,
+     tINT64 = 343,
+     tINTERFACE = 344,
+     tLCID = 345,
+     tLENGTHIS = 346,
+     tLIBRARY = 347,
+     tLOCAL = 348,
+     tLONG = 349,
+     tMETHODS = 350,
+     tMODULE = 351,
+     tNONBROWSABLE = 352,
+     tNONCREATABLE = 353,
+     tNONEXTENSIBLE = 354,
+     tNULL = 355,
+     tOBJECT = 356,
+     tODL = 357,
+     tOLEAUTOMATION = 358,
+     tOPTIONAL = 359,
+     tOUT = 360,
+     tPASCAL = 361,
+     tPOINTERDEFAULT = 362,
+     tPROPERTIES = 363,
+     tPROPGET = 364,
+     tPROPPUT = 365,
+     tPROPPUTREF = 366,
+     tPTR = 367,
+     tPUBLIC = 368,
+     tRANGE = 369,
+     tREADONLY = 370,
+     tREF = 371,
+     tREGISTER = 372,
+     tREQUESTEDIT = 373,
+     tRESTRICTED = 374,
+     tRETVAL = 375,
+     tSAFEARRAY = 376,
+     tSHORT = 377,
+     tSIGNED = 378,
+     tSIZEIS = 379,
+     tSIZEOF = 380,
+     tSMALL = 381,
+     tSOURCE = 382,
+     tSTATIC = 383,
+     tSTDCALL = 384,
+     tSTRICTCONTEXTHANDLE = 385,
+     tSTRING = 386,
+     tSTRUCT = 387,
+     tSWITCH = 388,
+     tSWITCHIS = 389,
+     tSWITCHTYPE = 390,
+     tTRANSMITAS = 391,
+     tTRUE = 392,
+     tTYPEDEF = 393,
+     tUNION = 394,
+     tUNIQUE = 395,
+     tUNSIGNED = 396,
+     tUUID = 397,
+     tV1ENUM = 398,
+     tVARARG = 399,
+     tVERSION = 400,
+     tVOID = 401,
+     tWCHAR = 402,
+     tWIREMARSHAL = 403,
+     ADDRESSOF = 404,
+     NEG = 405,
+     POS = 406,
+     PPTR = 407,
+     CAST = 408
    };
 #endif
 
@@ -451,7 +454,7 @@ typedef union YYSTYPE
 
 
 /* Line 214 of yacc.c  */
-#line 455 "parser.tab.c"
+#line 458 "parser.tab.c"
 } YYSTYPE;
 # define YYSTYPE_IS_TRIVIAL 1
 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
@@ -463,7 +466,7 @@ typedef union YYSTYPE
 
 
 /* Line 264 of yacc.c  */
-#line 467 "parser.tab.c"
+#line 470 "parser.tab.c"
 
 #ifdef short
 # undef short
@@ -678,20 +681,20 @@ union yyalloc
 /* YYFINAL -- State number of the termination state.  */
 #define YYFINAL  3
 /* YYLAST -- Last index in YYTABLE.  */
-#define YYLAST   1996
+#define YYLAST   2392
 
 /* YYNTOKENS -- Number of terminals.  */
-#define YYNTOKENS  175
+#define YYNTOKENS  178
 /* YYNNTS -- Number of nonterminals.  */
-#define YYNNTS  88
+#define YYNNTS  99
 /* YYNRULES -- Number of rules.  */
-#define YYNRULES  312
+#define YYNRULES  344
 /* YYNRULES -- Number of states.  */
-#define YYNSTATES  547
+#define YYNSTATES  606
 
 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX.  */
 #define YYUNDEFTOK  2
-#define YYMAXUTOK   405
+#define YYMAXUTOK   408
 
 #define YYTRANSLATE(YYX)                                               \
   ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
@@ -702,16 +705,16 @@ 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,   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,   162,     2,     2,     2,   161,   154,     2,
+     173,   174,   159,   158,   149,   157,   169,   160,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,   151,   172,
+     155,   177,   156,   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,   167,     2,   168,   150,     2,     2,     2,     2,     2,
+       2,   170,     2,   171,   153,     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,   172,   149,   173,   160,     2,     2,     2,
+       2,     2,     2,   175,   152,   176,   163,     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,
@@ -739,7 +742,7 @@ static const yytype_uint8 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,   161,   162,   163,   164,   165
+     145,   146,   147,   148,   164,   165,   166,   167,   168
 };
 
 #if YYDEBUG
@@ -751,171 +754,187 @@ static const yytype_uint16 yyprhs[] =
       25,    28,    29,    32,    35,    39,    42,    45,    48,    51,
       54,    55,    58,    59,    61,    63,    66,    69,    71,    74,
       76,    78,    80,    83,    86,    89,    94,    98,   102,   108,
-     111,   115,   120,   121,   123,   125,   127,   131,   133,   137,
-     140,   144,   148,   149,   151,   155,   157,   161,   166,   168,
-     172,   173,   175,   177,   179,   181,   183,   185,   190,   195,
-     197,   199,   201,   203,   205,   207,   212,   214,   216,   221,
-     223,   228,   233,   235,   237,   242,   247,   252,   257,   262,
-     264,   269,   271,   276,   278,   284,   286,   288,   293,   298,
-     300,   302,   304,   306,   308,   310,   312,   314,   316,   318,
-     323,   325,   327,   329,   331,   338,   340,   342,   344,   346,
-     351,   353,   355,   357,   362,   367,   372,   377,   379,   381,
-     386,   391,   393,   395,   397,   399,   401,   403,   405,   406,
-     409,   414,   418,   419,   422,   424,   426,   430,   434,   436,
-     442,   444,   448,   449,   451,   453,   455,   457,   459,   461,
-     463,   465,   467,   469,   475,   479,   483,   487,   491,   495,
-     499,   503,   507,   511,   515,   519,   523,   527,   531,   535,
-     539,   543,   547,   550,   553,   556,   559,   562,   565,   569,
-     573,   578,   583,   588,   592,   594,   598,   600,   602,   603,
-     606,   611,   615,   618,   621,   622,   625,   628,   630,   634,
-     638,   642,   645,   646,   648,   649,   651,   653,   655,   657,
-     659,   661,   663,   666,   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
+     111,   115,   120,   121,   123,   125,   129,   131,   135,   139,
+     142,   146,   150,   151,   153,   157,   159,   163,   168,   170,
+     174,   175,   177,   182,   184,   186,   188,   190,   192,   197,
+     202,   204,   206,   208,   210,   212,   214,   219,   221,   223,
+     228,   230,   235,   240,   242,   244,   249,   254,   259,   264,
+     269,   271,   276,   278,   283,   285,   291,   293,   295,   300,
+     305,   307,   309,   311,   313,   315,   317,   319,   321,   323,
+     325,   330,   332,   334,   336,   338,   345,   347,   349,   351,
+     353,   358,   360,   362,   364,   369,   374,   379,   384,   386,
+     388,   393,   398,   400,   402,   404,   406,   408,   410,   412,
+     413,   416,   421,   425,   426,   429,   431,   433,   437,   441,
+     443,   449,   451,   455,   456,   458,   460,   462,   464,   466,
+     468,   470,   472,   474,   476,   482,   486,   490,   494,   498,
+     502,   506,   510,   514,   518,   522,   526,   530,   534,   538,
+     542,   546,   550,   554,   557,   560,   563,   566,   569,   572,
+     576,   580,   586,   592,   597,   601,   603,   607,   609,   611,
+     612,   615,   620,   624,   627,   630,   631,   634,   637,   639,
+     643,   647,   651,   654,   655,   657,   658,   660,   662,   664,
+     666,   668,   670,   672,   675,   678,   680,   682,   684,   686,
+     688,   690,   691,   693,   695,   698,   700,   703,   706,   708,
+     710,   712,   715,   718,   721,   727,   728,   731,   734,   737,
+     740,   743,   746,   750,   753,   757,   763,   769,   770,   773,
+     776,   779,   782,   789,   798,   801,   804,   807,   810,   813,
+     816,   822,   824,   826,   828,   830,   832,   833,   836,   839,
+     843,   844,   846,   849,   852,   855,   859,   862,   864,   866,
+     870,   873,   878,   882,   885,   887,   891,   894,   895,   897,
+     901,   904,   906,   910,   915,   919,   922,   924,   928,   931,
+     932,   934,   936,   940,   943,   945,   949,   954,   956,   960,
+     961,   964,   967,   969,   973,   975,   979,   981,   983,   985,
+     991,   993,   995,   997,   999,  1002,  1004,  1007,  1009,  1012,
+    1017,  1022,  1028,  1039,  1041
 };
 
 /* YYRHS -- A `-1'-separated list of the rules' RHS.  */
 static const yytype_int16 yyrhs[] =
 {
-     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,   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,    87,    -1,
-      90,    -1,    94,    -1,    95,    -1,    96,    -1,    98,    -1,
-      99,    -1,   100,    -1,   101,    -1,   102,    -1,   104,   170,
-     257,   171,    -1,   106,    -1,   107,    -1,   108,    -1,   110,
-      -1,   111,   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,   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
+     179,     0,    -1,   180,    -1,    -1,   180,   245,    -1,   180,
+     244,    -1,   180,   231,   172,    -1,   180,   233,    -1,   180,
+     248,    -1,   180,   192,    -1,   180,   184,    -1,    -1,   181,
+     245,    -1,   181,   244,    -1,   181,   231,   172,    -1,   181,
+     233,    -1,   181,   248,    -1,   181,   184,    -1,   181,   189,
+      -1,   181,   192,    -1,    -1,   182,   184,    -1,    -1,   172,
+      -1,   186,    -1,   185,   172,    -1,   224,   172,    -1,   188,
+      -1,   274,   172,    -1,   210,    -1,   272,    -1,   275,    -1,
+     199,   210,    -1,   199,   272,    -1,   199,   275,    -1,    47,
+     173,     8,   174,    -1,    80,     8,   172,    -1,   187,   181,
+      11,    -1,    81,   173,     8,   174,   183,    -1,    92,     3,
+      -1,   199,   190,   175,    -1,   191,   181,   176,   183,    -1,
+      -1,   195,    -1,   196,    -1,   194,   149,   196,    -1,   194,
+      -1,   194,   149,    21,    -1,   199,   253,   264,    -1,   253,
+     264,    -1,   170,   212,   171,    -1,   170,   159,   171,    -1,
+      -1,   199,    -1,   170,   200,   171,    -1,   202,    -1,   200,
+     149,   202,    -1,   200,   171,   170,   202,    -1,     8,    -1,
+     201,   149,     8,    -1,    -1,    22,    -1,    24,   173,     8,
+     174,    -1,    25,    -1,    26,    -1,    28,    -1,    29,    -1,
+      31,    -1,    34,   173,   227,   174,    -1,    36,   173,   214,
+     174,    -1,    43,    -1,    44,    -1,    45,    -1,    46,    -1,
+      48,    -1,    49,    -1,    50,   173,   216,   174,    -1,    51,
+      -1,    52,    -1,    54,   173,     8,   174,    -1,    56,    -1,
+      57,   173,   201,   174,    -1,    58,   173,   216,   174,    -1,
+      61,    -1,    66,    -1,    68,   173,   215,   174,    -1,    69,
+     173,     8,   174,    -1,    70,   173,     8,   174,    -1,    71,
+     173,   215,   174,    -1,    72,   173,     8,   174,    -1,    73,
+      -1,    75,   173,   215,   174,    -1,    76,    -1,    77,   173,
+     213,   174,    -1,    78,    -1,    79,   173,    67,     3,   174,
+      -1,    82,    -1,    85,    -1,    91,   173,   211,   174,    -1,
+      90,   173,   215,   174,    -1,    90,    -1,    93,    -1,    97,
+      -1,    98,    -1,    99,    -1,   101,    -1,   102,    -1,   103,
+      -1,   104,    -1,   105,    -1,   107,   173,   271,   174,    -1,
+     109,    -1,   110,    -1,   111,    -1,   113,    -1,   114,   173,
+     215,   149,   215,   174,    -1,   115,    -1,   118,    -1,   119,
+      -1,   120,    -1,   124,   173,   211,   174,    -1,   127,    -1,
+     130,    -1,   131,    -1,   134,   173,   213,   174,    -1,   135,
+     173,   273,   174,    -1,   136,   173,   273,   174,    -1,   142,
+     173,   203,   174,    -1,   143,    -1,   144,    -1,   145,   173,
+     276,   174,    -1,   148,   173,   273,   174,    -1,   271,    -1,
+      10,    -1,     8,    -1,    37,    -1,    64,    -1,   106,    -1,
+     129,    -1,    -1,   205,   206,    -1,    36,   215,   151,   221,
+      -1,    48,   151,   221,    -1,    -1,   208,   149,    -1,   208,
+      -1,   209,    -1,   208,   149,   209,    -1,   227,   177,   215,
+      -1,   227,    -1,    59,   226,   175,   207,   176,    -1,   212,
+      -1,   211,   149,   212,    -1,    -1,   213,    -1,     5,    -1,
+       6,    -1,     7,    -1,    63,    -1,   100,    -1,   137,    -1,
+       8,    -1,     9,    -1,     3,    -1,   213,   150,   213,   151,
+     213,    -1,   213,    19,   213,    -1,   213,    20,   213,    -1,
+     213,   152,   213,    -1,   213,   153,   213,    -1,   213,   154,
+     213,    -1,   213,    15,   213,    -1,   213,    16,   213,    -1,
+     213,   156,   213,    -1,   213,   155,   213,    -1,   213,    17,
+     213,    -1,   213,    18,   213,    -1,   213,    12,   213,    -1,
+     213,    13,   213,    -1,   213,   158,   213,    -1,   213,   157,
+     213,    -1,   213,   161,   213,    -1,   213,   159,   213,    -1,
+     213,   160,   213,    -1,   162,   213,    -1,   163,   213,    -1,
+     158,   213,    -1,   157,   213,    -1,   154,   213,    -1,   159,
+     213,    -1,   213,    14,     3,    -1,   213,   169,     3,    -1,
+     173,   253,   260,   174,   213,    -1,   125,   173,   253,   260,
+     174,    -1,   213,   170,   213,   171,    -1,   173,   213,   174,
+      -1,   215,    -1,   214,   149,   215,    -1,   213,    -1,   213,
+      -1,    -1,   217,   218,    -1,   198,   253,   269,   172,    -1,
+     198,   275,   172,    -1,   222,   172,    -1,   199,   172,    -1,
+      -1,   220,   219,    -1,   222,   172,    -1,   172,    -1,   198,
+     253,   256,    -1,   198,   253,   256,    -1,   199,   253,   270,
+      -1,   253,   270,    -1,    -1,   227,    -1,    -1,     3,    -1,
+       4,    -1,     3,    -1,     4,    -1,    32,    -1,   147,    -1,
+     230,    -1,   123,   230,    -1,   141,   230,    -1,   141,    -1,
+      65,    -1,    55,    -1,    30,    -1,    60,    -1,    67,    -1,
+      -1,    86,    -1,    86,    -1,   122,   229,    -1,   126,    -1,
+      94,   229,    -1,    74,   229,    -1,    88,    -1,    38,    -1,
+      87,    -1,    39,     3,    -1,    39,     4,    -1,   199,   231,
+      -1,   232,   175,   234,   176,   183,    -1,    -1,   234,   235,
+      -1,   198,   245,    -1,    53,     3,    -1,    53,     4,    -1,
+     199,   236,    -1,   108,   151,    -1,   238,   222,   172,    -1,
+      95,   151,    -1,   239,   223,   172,    -1,   237,   175,   238,
+     239,   176,    -1,   237,   175,   242,   172,   176,    -1,    -1,
+     151,     4,    -1,    89,     3,    -1,    89,     4,    -1,   199,
+     242,    -1,   243,   241,   175,   182,   176,   183,    -1,   243,
+     151,     3,   175,   188,   182,   176,   183,    -1,   240,   183,
+      -1,   242,   172,    -1,   236,   172,    -1,    96,     3,    -1,
+      96,     4,    -1,   199,   246,    -1,   247,   175,   182,   176,
+     183,    -1,    62,    -1,   128,    -1,   117,    -1,    84,    -1,
+      42,    -1,    -1,   252,   251,    -1,   273,   254,    -1,   255,
+     273,   254,    -1,    -1,   255,    -1,   251,   254,    -1,   250,
+     254,    -1,   249,   254,    -1,   159,   252,   256,    -1,   204,
+     256,    -1,   257,    -1,   227,    -1,   173,   256,   174,    -1,
+     257,   197,    -1,   257,   173,   193,   174,    -1,   159,   252,
+     260,    -1,   204,   260,    -1,   261,    -1,   159,   252,   264,
+      -1,   204,   264,    -1,    -1,   258,    -1,   173,   259,   174,
+      -1,   261,   197,    -1,   197,    -1,   173,   193,   174,    -1,
+     261,   173,   193,   174,    -1,   159,   252,   264,    -1,   204,
+     264,    -1,   265,    -1,   159,   252,   264,    -1,   204,   264,
+      -1,    -1,   262,    -1,   227,    -1,   173,   263,   174,    -1,
+     265,   197,    -1,   197,    -1,   173,   193,   174,    -1,   265,
+     173,   193,   174,    -1,   256,    -1,   266,   149,   256,    -1,
+      -1,   151,   216,    -1,   262,   267,    -1,   268,    -1,   269,
+     149,   268,    -1,   256,    -1,   256,   177,   216,    -1,   116,
+      -1,   140,    -1,   112,    -1,   132,   226,   175,   217,   176,
+      -1,   146,    -1,     4,    -1,   228,    -1,   210,    -1,    59,
+       3,    -1,   272,    -1,   132,     3,    -1,   275,    -1,   139,
+       3,    -1,   121,   173,   273,   174,    -1,   138,   198,   253,
+     266,    -1,   139,   226,   175,   220,   176,    -1,   139,   226,
+     133,   173,   222,   174,   225,   175,   205,   176,    -1,     5,
+      -1,     5,   169,     5,    -1
 };
 
 /* YYRLINE[YYN] -- source line where rule number YYN was defined.  */
 static const yytype_uint16 yyrline[] =
 {
-       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,   527,   531,   532,   533,   534,   535,
-     536,   537,   538,   539,   540,   541,   542,   543,   544,   545,
-     546,   547,   551,   552,   557,   558,   559,   560,   563,   564,
-     567,   571,   577,   578,   579,   582,   586,   595,   599,   604,
-     607,   608,   621,   622,   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,   664,   667,   668,   671,   677,   683,   684,
-     687,   692,   699,   700,   703,   704,   708,   709,   712,   720,
-     729,   735,   741,   742,   745,   746,   747,   750,   752,   755,
-     756,   757,   758,   759,   760,   761,   762,   763,   764,   765,
-     768,   769,   772,   773,   774,   775,   776,   777,   778,   781,
-     782,   790,   796,   800,   801,   805,   808,   809,   812,   822,
-     823,   826,   827,   830,   836,   842,   843,   846,   847,   850,
-     861,   868,   874,   878,   879,   882,   883,   886,   891,   898,
-     899,   900,   904,   908,   911,   912,   915,   916,   920,   921,
-     925,   926,   927,   931,   933,   934,   938,   939,   940,   941,
-     948,   949,   953,   954,   958,   959,   960,   963,   966,   967,
-     968,   969,   970,   971,   972,   973,   974,   975,   978,   984,
-     986,   992,   993
+       0,   330,   330,   343,   344,   345,   346,   349,   352,   353,
+     354,   357,   358,   359,   360,   361,   364,   365,   366,   367,
+     370,   371,   374,   375,   379,   380,   381,   382,   383,   387,
+     388,   389,   390,   391,   392,   395,   397,   405,   411,   415,
+     417,   421,   428,   429,   432,   433,   436,   437,   441,   446,
+     453,   454,   457,   458,   462,   465,   466,   467,   470,   471,
+     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,   527,   528,   529,   533,   534,   535,   536,
+     537,   538,   539,   540,   541,   542,   543,   544,   545,   546,
+     547,   548,   549,   553,   554,   559,   560,   561,   562,   565,
+     566,   569,   573,   579,   580,   581,   584,   588,   597,   601,
+     606,   609,   610,   623,   624,   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,   665,   667,   668,   671,   672,   675,   681,   687,
+     688,   691,   696,   703,   704,   707,   708,   712,   713,   716,
+     723,   732,   736,   741,   742,   745,   746,   747,   750,   752,
+     755,   756,   757,   758,   759,   760,   761,   762,   763,   764,
+     765,   768,   769,   772,   773,   774,   775,   776,   777,   778,
+     779,   782,   783,   791,   797,   801,   802,   806,   809,   810,
+     813,   823,   824,   827,   828,   831,   837,   843,   844,   847,
+     848,   851,   862,   869,   875,   879,   880,   883,   884,   887,
+     892,   899,   900,   901,   905,   909,   912,   913,   916,   917,
+     921,   922,   926,   927,   928,   932,   934,   935,   939,   940,
+     941,   942,   950,   952,   953,   958,   960,   964,   965,   970,
+     971,   972,   973,   978,   987,   989,   990,   995,   997,  1001,
+    1002,  1009,  1010,  1011,  1012,  1013,  1018,  1026,  1027,  1030,
+    1031,  1034,  1041,  1042,  1047,  1048,  1052,  1053,  1054,  1057,
+    1060,  1061,  1062,  1063,  1064,  1065,  1066,  1067,  1068,  1069,
+    1072,  1078,  1080,  1086,  1087
 };
 #endif
 
@@ -927,12 +946,13 @@ static const char *const yytname[] =
   "$end", "error", "$undefined", "aIDENTIFIER", "aKNOWNTYPE", "aNUM",
   "aHEXNUM", "aDOUBLE", "aSTRING", "aWSTRING", "aUUID", "aEOF", "SHL",
   "SHR", "MEMBERPTR", "EQUALITY", "INEQUALITY", "GREATEREQUAL",
-  "LESSEQUAL", "LOGICALOR", "LOGICALAND", "tAGGREGATABLE", "tALLOCATE",
-  "tAPPOBJECT", "tASYNC", "tASYNCUUID", "tAUTOHANDLE", "tBINDABLE",
-  "tBOOLEAN", "tBROADCAST", "tBYTE", "tBYTECOUNT", "tCALLAS", "tCALLBACK",
-  "tCASE", "tCDECL", "tCHAR", "tCOCLASS", "tCODE", "tCOMMSTATUS", "tCONST",
-  "tCONTEXTHANDLE", "tCONTEXTHANDLENOSERIALIZE", "tCONTEXTHANDLESERIALIZE",
-  "tCONTROL", "tCPPQUOTE", "tDEFAULT", "tDEFAULTCOLLELEM", "tDEFAULTVALUE",
+  "LESSEQUAL", "LOGICALOR", "LOGICALAND", "ELLIPSIS", "tAGGREGATABLE",
+  "tALLOCATE", "tANNOTATION", "tAPPOBJECT", "tASYNC", "tASYNCUUID",
+  "tAUTOHANDLE", "tBINDABLE", "tBOOLEAN", "tBROADCAST", "tBYTE",
+  "tBYTECOUNT", "tCALLAS", "tCALLBACK", "tCASE", "tCDECL", "tCHAR",
+  "tCOCLASS", "tCODE", "tCOMMSTATUS", "tCONST", "tCONTEXTHANDLE",
+  "tCONTEXTHANDLENOSERIALIZE", "tCONTEXTHANDLESERIALIZE", "tCONTROL",
+  "tCPPQUOTE", "tDEFAULT", "tDEFAULTCOLLELEM", "tDEFAULTVALUE",
   "tDEFAULTVTABLE", "tDISPLAYBIND", "tDISPINTERFACE", "tDLLNAME",
   "tDOUBLE", "tDUAL", "tENDPOINT", "tENTRY", "tENUM", "tERRORSTATUST",
   "tEXPLICITHANDLE", "tEXTERN", "tFALSE", "tFASTCALL", "tFLOAT", "tHANDLE",
@@ -940,38 +960,42 @@ static const char *const yytname[] =
   "tHELPSTRINGCONTEXT", "tHELPSTRINGDLL", "tHIDDEN", "tHYPER", "tID",
   "tIDEMPOTENT", "tIIDIS", "tIMMEDIATEBIND", "tIMPLICITHANDLE", "tIMPORT",
   "tIMPORTLIB", "tIN", "tIN_LINE", "tINLINE", "tINPUTSYNC", "tINT",
-  "tINT64", "tINTERFACE", "tLCID", "tLENGTHIS", "tLIBRARY", "tLOCAL",
-  "tLONG", "tMETHODS", "tMODULE", "tNONBROWSABLE", "tNONCREATABLE",
-  "tNONEXTENSIBLE", "tNULL", "tOBJECT", "tODL", "tOLEAUTOMATION",
-  "tOPTIONAL", "tOUT", "tPASCAL", "tPOINTERDEFAULT", "tPROPERTIES",
-  "tPROPGET", "tPROPPUT", "tPROPPUTREF", "tPTR", "tPUBLIC", "tRANGE",
-  "tREADONLY", "tREF", "tREGISTER", "tREQUESTEDIT", "tRESTRICTED",
-  "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",
+  "tINT3264", "tINT64", "tINTERFACE", "tLCID", "tLENGTHIS", "tLIBRARY",
+  "tLOCAL", "tLONG", "tMETHODS", "tMODULE", "tNONBROWSABLE",
+  "tNONCREATABLE", "tNONEXTENSIBLE", "tNULL", "tOBJECT", "tODL",
+  "tOLEAUTOMATION", "tOPTIONAL", "tOUT", "tPASCAL", "tPOINTERDEFAULT",
+  "tPROPERTIES", "tPROPGET", "tPROPPUT", "tPROPPUTREF", "tPTR", "tPUBLIC",
+  "tRANGE", "tREADONLY", "tREF", "tREGISTER", "tREQUESTEDIT",
+  "tRESTRICTED", "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", "arg_list",
+  "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",
+  "abstract_declarator", "abstract_declarator_no_direct",
+  "m_abstract_declarator", "abstract_direct_declarator", "any_declarator",
+  "any_declarator_no_direct", "m_any_declarator", "any_direct_declarator",
+  "declarator_list", "m_bitfield", "struct_declarator",
+  "struct_declarator_list", "init_declarator", "pointer_type", "structdef",
   "type", "typedef", "uniondef", "version", 0
 };
 #endif
@@ -995,48 +1019,51 @@ static const yytype_uint16 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,    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
+     395,   396,   397,   398,   399,   400,   401,   402,   403,    44,
+      63,    58,   124,    94,    38,    60,    62,    45,    43,    42,
+      47,    37,    33,   126,   404,   405,   406,   407,   408,    46,
+      91,    93,    59,    40,    41,   123,   125,    61
 };
 # endif
 
 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
 static const yytype_uint16 yyr1[] =
 {
-       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,   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
+       0,   178,   179,   180,   180,   180,   180,   180,   180,   180,
+     180,   181,   181,   181,   181,   181,   181,   181,   181,   181,
+     182,   182,   183,   183,   184,   184,   184,   184,   184,   185,
+     185,   185,   185,   185,   185,   186,   187,   188,   189,   190,
+     191,   192,   193,   193,   194,   194,   195,   195,   196,   196,
+     197,   197,   198,   198,   199,   200,   200,   200,   201,   201,
+     202,   202,   202,   202,   202,   202,   202,   202,   202,   202,
+     202,   202,   202,   202,   202,   202,   202,   202,   202,   202,
+     202,   202,   202,   202,   202,   202,   202,   202,   202,   202,
+     202,   202,   202,   202,   202,   202,   202,   202,   202,   202,
+     202,   202,   202,   202,   202,   202,   202,   202,   202,   202,
+     202,   202,   202,   202,   202,   202,   202,   202,   202,   202,
+     202,   202,   202,   202,   202,   202,   202,   202,   202,   202,
+     202,   202,   202,   203,   203,   204,   204,   204,   204,   205,
+     205,   206,   206,   207,   207,   207,   208,   208,   209,   209,
+     210,   211,   211,   212,   212,   213,   213,   213,   213,   213,
+     213,   213,   213,   213,   213,   213,   213,   213,   213,   213,
+     213,   213,   213,   213,   213,   213,   213,   213,   213,   213,
+     213,   213,   213,   213,   213,   213,   213,   213,   213,   213,
+     213,   213,   213,   213,   213,   214,   214,   215,   216,   217,
+     217,   218,   218,   219,   219,   220,   220,   221,   221,   222,
+     223,   224,   224,   225,   225,   226,   226,   226,   227,   227,
+     228,   228,   228,   228,   228,   228,   228,   228,   228,   228,
+     228,   229,   229,   230,   230,   230,   230,   230,   230,   230,
+     230,   231,   231,   232,   233,   234,   234,   235,   236,   236,
+     237,   238,   238,   239,   239,   240,   240,   241,   241,   242,
+     242,   243,   244,   244,   244,   245,   245,   246,   246,   247,
+     248,   249,   249,   249,   250,   251,   252,   252,   253,   253,
+     254,   254,   255,   255,   255,   256,   256,   256,   257,   257,
+     257,   257,   258,   258,   258,   259,   259,   260,   260,   261,
+     261,   261,   261,   261,   262,   262,   262,   263,   263,   264,
+     264,   265,   265,   265,   265,   265,   265,   266,   266,   267,
+     267,   268,   269,   269,   270,   270,   271,   271,   271,   272,
+     273,   273,   273,   273,   273,   273,   273,   273,   273,   273,
+     274,   275,   275,   276,   276
 };
 
 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN.  */
@@ -1046,34 +1073,37 @@ static const yytype_uint8 yyr2[] =
        2,     0,     2,     2,     3,     2,     2,     2,     2,     2,
        0,     2,     0,     1,     1,     2,     2,     1,     2,     1,
        1,     1,     2,     2,     2,     4,     3,     3,     5,     2,
-       3,     4,     0,     1,     1,     1,     3,     1,     3,     2,
+       3,     4,     0,     1,     1,     3,     1,     3,     3,     2,
        3,     3,     0,     1,     3,     1,     3,     4,     1,     3,
-       0,     1,     1,     1,     1,     1,     1,     4,     4,     1,
-       1,     1,     1,     1,     1,     4,     1,     1,     4,     1,
-       4,     4,     1,     1,     4,     4,     4,     4,     4,     1,
-       4,     1,     4,     1,     5,     1,     1,     4,     4,     1,
-       1,     1,     1,     1,     1,     1,     1,     1,     1,     4,
-       1,     1,     1,     1,     6,     1,     1,     1,     1,     4,
-       1,     1,     1,     4,     4,     4,     4,     1,     1,     4,
-       4,     1,     1,     1,     1,     1,     1,     1,     0,     2,
-       4,     3,     0,     2,     1,     1,     3,     3,     1,     5,
-       1,     3,     0,     1,     1,     1,     1,     1,     1,     1,
-       1,     1,     1,     5,     3,     3,     3,     3,     3,     3,
+       0,     1,     4,     1,     1,     1,     1,     1,     4,     4,
+       1,     1,     1,     1,     1,     1,     4,     1,     1,     4,
+       1,     4,     4,     1,     1,     4,     4,     4,     4,     4,
+       1,     4,     1,     4,     1,     5,     1,     1,     4,     4,
+       1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
+       4,     1,     1,     1,     1,     6,     1,     1,     1,     1,
+       4,     1,     1,     1,     4,     4,     4,     4,     1,     1,
+       4,     4,     1,     1,     1,     1,     1,     1,     1,     0,
+       2,     4,     3,     0,     2,     1,     1,     3,     3,     1,
+       5,     1,     3,     0,     1,     1,     1,     1,     1,     1,
+       1,     1,     1,     1,     5,     3,     3,     3,     3,     3,
        3,     3,     3,     3,     3,     3,     3,     3,     3,     3,
-       3,     3,     2,     2,     2,     2,     2,     2,     3,     3,
-       4,     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,
-       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
+       3,     3,     3,     2,     2,     2,     2,     2,     2,     3,
+       3,     5,     5,     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,     0,     1,     1,     2,     1,     2,     2,     1,     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,     3,     2,     1,     3,     2,     0,     1,     3,
+       2,     1,     3,     4,     3,     2,     1,     3,     2,     0,
+       1,     1,     3,     2,     1,     3,     4,     1,     3,     0,
+       2,     2,     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
@@ -1081,625 +1111,725 @@ static const yytype_uint8 yyr2[] =
    means the default is an error.  */
 static const yytype_uint16 yydefact[] =
 {
-       3,     0,     2,     1,   299,   227,   219,   238,     0,   273,
-       0,     0,   226,   214,   228,   269,   225,   229,   230,     0,
-     272,   232,   237,     0,   230,   271,     0,   230,     0,   234,
-     270,   214,    52,   214,   224,   298,   220,    60,    10,     0,
-      24,    11,    27,    11,     9,     0,   301,     0,   300,   221,
-       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,   216,     0,   231,
-     236,     0,   257,   258,   235,     0,   233,   222,   304,     0,
-       0,    53,   306,     0,   223,    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,    99,     0,   100,   101,   102,   103,   104,   105,   106,
-     107,   108,     0,   110,   111,   112,   296,   113,     0,   115,
-     294,   116,   117,   118,     0,   120,   121,   122,     0,     0,
-       0,   295,     0,   127,   128,     0,     0,     0,    55,   131,
-      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,   217,
-     218,   134,   135,   136,   137,   274,     0,     0,   286,   292,
-     285,   211,   301,   303,   278,   305,   276,    28,     0,   142,
-      36,     0,   198,     0,     0,   204,     0,     0,     0,     0,
-       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
-       0,   152,     0,     0,   152,     0,     0,     0,     0,     0,
-       0,    60,    54,    37,     0,    17,    18,    19,     0,    15,
-      13,    12,    16,    22,    39,   265,   266,    40,   210,    52,
-       0,    52,     0,     0,   256,    20,     0,     0,     0,   284,
-       0,   152,    42,   288,   277,    35,     0,   144,   145,   148,
-     307,    52,   290,   308,    52,    52,     0,   162,   154,   155,
-     156,   160,   161,   157,   158,     0,   159,     0,     0,     0,
-       0,     0,     0,     0,   196,     0,   194,   197,     0,     0,
-      58,     0,     0,     0,     0,     0,     0,     0,     0,     0,
-       0,     0,     0,   150,   153,     0,     0,     0,     0,     0,
-       0,   133,   132,     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,   149,
-     143,     0,   297,     0,   199,     0,     0,   309,    53,   205,
-       0,    67,     0,   186,   185,   184,   187,   182,   183,     0,
+       3,     0,     2,     1,   331,   228,   220,   239,     0,   275,
+       0,     0,   227,   215,   229,   271,   226,   230,   231,     0,
+     274,   233,   240,   238,     0,   231,   273,     0,   231,     0,
+     235,   272,   215,    52,   215,   225,   330,   221,    60,    10,
+       0,    24,    11,    27,    11,     9,     0,   333,     0,   332,
+     222,     0,     0,     7,     0,     0,    22,     0,   257,     5,
+       4,     0,     8,   280,   280,   280,     0,     0,   335,   280,
+       0,   337,   241,   242,     0,   248,   249,   334,   217,     0,
+     232,   237,     0,   259,   260,   236,     0,   234,   223,   336,
+       0,     0,    53,   338,     0,   224,    61,     0,    63,    64,
+      65,    66,    67,     0,     0,    70,    71,    72,    73,    74,
+      75,     0,    77,    78,     0,    80,     0,     0,    83,    84,
+       0,     0,     0,     0,     0,    90,     0,    92,     0,    94,
+       0,    96,    97,   100,     0,   101,   102,   103,   104,   105,
+     106,   107,   108,   109,     0,   111,   112,   113,   328,   114,
+       0,   116,   326,   117,   118,   119,     0,   121,   122,   123,
+       0,     0,     0,   327,     0,   128,   129,     0,     0,     0,
+      55,   132,    25,     0,     0,     0,     0,     0,   333,   243,
+     250,   261,   269,     0,   335,   337,    26,     6,   245,   266,
+       0,    23,   264,   265,     0,     0,    20,   284,   281,   283,
+     282,   218,   219,   135,   136,   137,   138,   276,     0,     0,
+     288,   324,   287,   212,   333,   335,   280,   337,   278,    28,
+       0,   143,    36,     0,   199,     0,     0,   205,     0,     0,
        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
+       0,     0,     0,     0,   153,     0,     0,   153,     0,     0,
+       0,     0,     0,     0,    60,    54,    37,     0,    17,    18,
+      19,     0,    15,    13,    12,    16,    22,    39,   267,   268,
+      40,   211,    52,     0,    52,     0,     0,   258,    20,     0,
+       0,     0,   286,     0,   153,    42,   290,   279,    35,     0,
+     145,   146,   149,   339,    52,   317,   340,    52,    52,     0,
+       0,   163,   155,   156,   157,   161,   162,   158,   159,     0,
+     160,     0,     0,     0,     0,     0,     0,     0,   197,     0,
+     195,   198,     0,     0,    58,     0,     0,     0,     0,     0,
+       0,     0,     0,     0,     0,     0,     0,   151,   154,     0,
+       0,     0,     0,     0,     0,   134,   133,     0,   343,     0,
+       0,    56,    60,     0,    14,    41,    22,     0,   246,   251,
+       0,     0,     0,    52,     0,     0,     0,    22,    21,     0,
+     277,   285,   289,   325,     0,     0,     0,    46,    43,    44,
+       0,   309,   150,   144,     0,   329,     0,   200,     0,     0,
+     341,    53,   206,     0,    62,    68,     0,   187,   186,   185,
+     188,   183,   184,     0,   297,     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,   152,
-      97,   109,     0,   119,   123,   124,   125,   126,     0,   129,
-     130,    57,     0,   242,   245,   251,     0,   250,   253,     0,
-       0,   254,    20,    22,   268,    51,    50,   289,     0,     0,
-      49,   146,   147,     0,   305,   291,   212,   203,   202,     0,
-     193,     0,   175,   176,   188,   169,   170,   173,   174,   164,
-     165,     0,   166,   167,   168,   172,   171,   178,   177,   180,
-     181,   179,   189,     0,   195,    59,    94,   151,     0,   312,
-      22,   208,     0,   252,     0,   260,    46,    48,     0,   201,
-       0,   213,   191,   190,     0,   192,   114,    38,   209,    22,
-     200,   138,   163,   261,     0,     0,     0,   310,   139,     0,
-      52,    52,   207,   141,     0,   140,   206
+       0,     0,     0,     0,     0,     0,     0,     0,    69,    76,
+      79,     0,    81,    82,    85,    86,    87,    88,    89,    91,
+      93,     0,    99,   153,    98,   110,     0,   120,   124,   125,
+     126,   127,     0,   130,   131,    57,     0,   244,   247,   253,
+       0,   252,   255,     0,     0,   256,    20,    22,   270,    51,
+      50,   291,     0,   309,   276,    42,   314,   309,   311,   310,
+      49,   306,   147,   148,     0,   337,   318,   213,   204,   203,
+     297,   194,   276,    42,   301,   297,   298,     0,   294,   176,
+     177,   189,   170,   171,   174,   175,   165,   166,     0,   167,
+     168,   169,   173,   172,   179,   178,   181,   182,   180,   190,
+       0,   196,    59,    95,   152,     0,   344,    22,   209,     0,
+     254,     0,   262,    47,    45,    48,   309,   276,     0,   309,
+       0,   305,    42,   313,   319,   322,     0,   202,     0,   214,
+       0,   297,   276,     0,   309,     0,   293,     0,    42,   300,
+       0,   193,   115,    38,   210,    22,   304,   309,   315,   308,
+     312,     0,     0,   321,     0,   201,   139,   192,   292,   309,
+     302,   296,   299,   191,     0,   164,   263,   307,   316,   320,
+     323,     0,   295,   303,     0,     0,   342,   140,     0,    52,
+      52,   208,   142,     0,   141,   207
 };
 
 /* YYDEFGOTO[NTERM-NUM].  */
 static const yytype_int16 yydefgoto[] =
 {
-      -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
+      -1,     1,     2,   173,   279,   192,   368,    40,    41,    42,
+      43,   259,   177,    44,   260,   376,   377,   378,   379,   476,
+     361,    92,   169,   325,   170,   347,   477,   591,   597,   289,
+     290,   291,   214,   336,   337,   318,   319,   320,   322,   294,
+     387,   392,   298,   602,   603,   464,    48,   548,    79,   478,
+      49,    81,    50,   261,    52,   262,   272,   358,    54,    55,
+     274,   363,    56,   195,    57,    58,   263,   264,   182,    61,
+     265,    63,    64,    65,   280,    66,   197,    67,   211,   212,
+     496,   555,   497,   498,   479,   540,   480,   481,   296,   573,
+     545,   546,   213,   171,   215,    69,    70,   217,   349
 };
 
 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
    STATE-NUM.  */
-#define YYPACT_NINF -269
+#define YYPACT_NINF -472
 static const yytype_int16 yypact[] =
 {
-    -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
+    -472,    38,  1206,  -472,  -472,  -472,  -472,  -472,    75,  -472,
+     -86,   228,  -472,   238,  -472,  -472,  -472,  -472,    28,   101,
+    -472,  -472,  -472,  -472,   265,    28,  -472,   -23,    28,   408,
+    -472,  -472,   271,    -3,   287,   408,  -472,  -472,  2244,  -472,
+      25,  -472,  -472,  -472,  -472,  -472,  1982,    34,    47,  -472,
+    -472,    52,    54,  -472,    73,    61,   106,   110,    62,  -472,
+    -472,    97,  -472,    31,    31,    31,   114,  2135,   123,    31,
+     133,   135,  -472,  -472,   218,  -472,  -472,   126,  -472,   142,
+    -472,  -472,   146,  -472,  -472,  -472,  2135,  -472,  -472,   126,
+     148,  2060,  -472,   -99,   -89,  -472,  -472,   151,  -472,  -472,
+    -472,  -472,  -472,   153,   154,  -472,  -472,  -472,  -472,  -472,
+    -472,   156,  -472,  -472,   157,  -472,   159,   160,  -472,  -472,
+     161,   162,   163,   165,   167,  -472,   169,  -472,   173,  -472,
+     174,  -472,  -472,   185,   187,  -472,  -472,  -472,  -472,  -472,
+    -472,  -472,  -472,  -472,   192,  -472,  -472,  -472,  -472,  -472,
+     194,  -472,  -472,  -472,  -472,  -472,   201,  -472,  -472,  -472,
+     210,   212,   214,  -472,   215,  -472,  -472,   216,   219,   -79,
+    -472,  -472,  -472,  1111,   425,   334,   290,   224,   230,  -472,
+    -472,  -472,  -472,   114,   233,   235,  -472,  -472,  -472,  -472,
+      24,  -472,  -472,  -472,   296,   225,  -472,  -472,  -472,  -472,
+    -472,  -472,  -472,  -472,  -472,  -472,  -472,  -472,   114,   114,
+    -472,   229,   -26,  -472,  -472,  -472,    31,  -472,  -472,  -472,
+     236,   312,  -472,   237,  -472,   114,   242,  -472,   400,   312,
+     967,   967,   401,   409,   967,   967,   410,   411,   967,   413,
+     967,   967,   349,   967,   967,   -21,   967,   967,   967,  2135,
+    2135,   129,   418,  2135,  2244,   254,  -472,   260,  -472,  -472,
+    -472,   263,  -472,  -472,  -472,  -472,   106,  -472,  -472,  -472,
+    -472,  -472,  -145,   285,   -65,   266,   264,  -472,  -472,   520,
+      64,   268,  -472,   967,   974,  1552,  -472,  -472,  -472,   269,
+     292,  -472,   272,  -472,   -54,  -472,   294,    -3,   -36,   270,
+     274,  -472,  -472,  -472,  -472,  -472,  -472,  -472,  -472,   277,
+    -472,   967,   967,   967,   967,   967,   967,   805,  1801,  -125,
+    -472,  1801,   279,   280,  -472,  -110,   282,   284,   286,   288,
+     291,   295,   297,  1557,   448,   300,  -109,  -472,  1801,   301,
+     310,   -72,  1615,   302,   303,  -472,  -472,   305,   299,   307,
+     309,  -472,  2244,   453,  -472,  -472,   106,     1,  -472,  -472,
+     335,  2060,   321,   -34,   322,   417,   615,   106,  -472,  2060,
+    -472,  -472,  -472,  -472,   895,   329,   330,   354,  -472,  -472,
+    2060,    57,  -472,   312,   967,  -472,  2060,  -472,   114,   333,
+    -472,   336,  -472,   338,  -472,  -472,  2060,    18,    18,    18,
+      18,    18,    18,  1638,   267,   967,   967,   512,   967,   967,
+     967,   967,   967,   967,   967,   967,   967,   967,   967,   967,
+     967,   967,   967,   967,   967,   513,   967,   967,  -472,  -472,
+    -472,   510,  -472,  -472,  -472,  -472,  -472,  -472,  -472,  -472,
+    -472,   346,  -472,   967,  -472,  -472,   967,  -472,  -472,  -472,
+    -472,  -472,   516,  -472,  -472,  -472,   348,  -472,  -472,  -472,
+     114,  -472,  -472,  2060,   351,  -472,  -472,   106,  -472,  -472,
+    -472,  -472,  1474,    57,  -472,  1318,  -472,    57,  -472,  -472,
+    -472,    41,  -472,  -472,    57,   353,  -472,   312,  -472,  -472,
+     267,  -472,  -472,  1396,  -472,   267,  -472,   352,    48,   193,
+     193,  -472,   221,   221,   152,   152,  1688,  1765,  1742,  1819,
+    1838,  1870,   152,   152,   234,   234,    18,    18,    18,  -472,
+    1720,  -472,  -472,  -472,  -472,   358,  -472,   106,  -472,   114,
+    -472,   710,  -472,  -472,  -472,  -472,    32,  -472,   361,    57,
+     362,  -472,  1552,  -472,   376,  -472,   -45,  -472,   363,  -472,
+     365,   255,  -472,   367,    57,   369,  -472,   967,  1552,  -472,
+     967,  -472,  -472,  -472,  -472,   106,  -472,    32,  -472,  -472,
+    -472,   370,   967,  -472,    57,  -472,  -472,  -472,  -472,    32,
+    -472,  -472,  -472,    18,   371,  1801,  -472,  -472,  -472,  -472,
+    -472,    23,  -472,  -472,   967,   377,  -472,  -472,   398,    20,
+      20,  -472,  -472,   382,  -472,  -472
 };
 
 /* YYPGOTO[NTERM-NUM].  */
 static const yytype_int16 yypgoto[] =
 {
-    -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
+    -472,  -472,  -472,   511,  -271,  -257,    10,  -472,  -472,  -472,
+     195,  -472,  -472,  -472,   557,  -409,  -472,  -472,    89,  -192,
+      -6,    -2,  -472,  -472,  -244,  -472,   -63,  -472,  -472,  -472,
+    -472,   182,     2,   323,  -261,  -159,  -472,  -224,  -228,  -472,
+    -472,  -472,  -472,   -32,  -167,  -472,  -472,  -472,   164,   -40,
+    -472,   200,   100,    51,  -472,   567,  -472,  -472,   527,  -472,
+    -472,  -472,  -472,  -472,   -13,  -472,   572,    -1,  -472,  -472,
+     574,  -472,  -472,  -265,  -411,   -41,    -7,   -22,  -180,  -472,
+    -472,  -472,  -439,  -472,  -471,  -472,  -456,  -472,  -472,  -472,
+       3,  -472,   395,   339,     6,   -49,  -472,     0,  -472
 };
 
 /* YYTABLE[YYPACT[STATE-NUM]].  What to do in state STATE-NUM.  If
    positive, shift that token.  If negative, reduce the rule which
    number is the opposite.  If zero, do what YYDEFACT says.
    If YYTABLE_NINF, syntax error.  */
-#define YYTABLE_NINF -216
+#define YYTABLE_NINF -217
 static const yytype_int16 yytable[] =
 {
-      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,  -215,     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,  -215,    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,  -215,   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,
+      46,    60,    71,   209,    47,   183,   326,   366,    68,   355,
+     351,   327,    39,   544,   330,   370,   332,   535,   216,   335,
+     286,   541,   340,   375,   427,    38,   210,    91,   281,   282,
+     360,   356,   407,   181,  -216,   201,   202,   223,     3,   431,
+     443,   198,   198,   198,   226,   295,   185,   198,   178,   428,
+     225,   550,   184,    51,    11,   373,   556,   199,   200,   594,
+     201,   202,   218,   536,   432,   444,   538,   201,   202,   203,
+     254,   595,   321,     9,     9,   321,  -216,   443,    72,    73,
+     566,   551,   333,   569,   553,   338,   227,    74,   338,   342,
+      24,   148,   255,    15,   203,   152,   204,   179,   581,   457,
+     371,   203,   447,   544,   574,    38,     9,   362,   455,    82,
+     468,   587,   578,    24,    80,    20,    38,   201,   202,   163,
+     209,   204,   385,   592,   321,   338,   567,   575,   204,    88,
+     389,   393,   273,   571,    38,    95,    38,   345,   205,   346,
+     390,   579,   462,   210,   284,   209,   209,   285,    26,   584,
+      86,   203,   397,   398,   399,   400,   401,   402,   403,    31,
+     483,   206,   209,   205,   405,   406,   407,    38,   210,   210,
+     205,    46,    46,    71,    71,    47,    47,   275,   204,    68,
+      68,   292,   524,   258,   258,   210,   206,   425,   426,   300,
+      38,   474,   601,   206,   198,   531,    90,   172,    94,   596,
+     343,   344,   284,   521,   350,   475,   -29,   407,   486,   287,
+     532,   284,   494,   194,   542,   400,   474,   209,   284,   186,
+     205,   558,   525,   207,   187,    85,   220,   284,    87,   188,
+     475,    75,    76,   405,   406,   407,   190,   208,   410,   411,
+     210,    77,    78,   206,   381,   189,   499,   500,   407,   502,
+     503,   504,   505,   506,   507,   508,   509,   510,   511,   512,
+     513,   514,   515,   516,   517,   518,   357,   520,    83,    84,
+     563,   370,   196,   207,    89,    78,   404,   369,   191,    71,
+     528,    47,   193,   380,   338,    68,   370,   208,   386,   543,
+      93,    78,   203,   268,   269,   -30,   391,     9,   494,   276,
+     277,  -216,   370,   494,   203,   219,   559,   -31,   586,   420,
+     421,   422,   423,   424,   370,   201,   202,   221,   222,   204,
+     460,   425,   426,   224,   228,   209,   229,   230,   183,   231,
+     232,   204,   233,   234,   235,   236,   237,   267,   238,   473,
+     239,   495,   240,   292,   589,   484,   241,   242,   210,   564,
+     420,   421,   422,   423,   424,   490,   458,   463,   243,   494,
+     244,   205,   425,   426,   369,   245,    71,   246,    47,   185,
+     598,   178,    68,   205,   247,   184,   418,   419,   420,   421,
+     422,   423,   424,   248,   206,   249,   485,   250,   251,   252,
+     425,   426,   253,   422,   423,   424,   206,   209,   583,   270,
+     278,   585,   -32,   425,   426,   -33,   283,   -34,   299,   323,
+     288,   293,   539,   321,   492,   297,   334,   324,   328,   329,
+     210,   331,   529,   348,   352,   284,   492,   495,   493,     4,
+     554,   381,   495,   353,   381,   354,   359,   284,   364,   365,
+     493,   383,   372,   388,   394,   382,     7,   549,   395,   384,
+     396,   441,   381,   429,   430,     5,   433,     6,   434,   446,
+     435,   456,   436,     7,     8,   437,   209,     9,   452,   438,
+     380,   439,    10,   380,   442,   445,   449,   450,    11,   451,
+      12,   453,    18,   454,    13,    14,   459,    15,   495,   210,
+      16,   380,    17,   461,    21,    22,    23,    19,   465,    18,
+     470,   381,    25,   472,   471,    19,   257,   487,   488,    20,
+     489,    21,    22,    23,    24,   501,   519,   381,   522,    25,
+     523,   526,   527,   530,     4,   547,   557,   572,   599,   369,
+      28,    71,   562,    47,    30,   568,   570,    68,   576,   577,
+     380,   580,    26,   582,   588,   593,    27,    28,    29,   600,
+       5,    30,     6,    31,   605,   174,   380,    32,     7,    45,
+     466,   534,     9,    33,    34,   482,    35,    10,   604,    53,
+     341,    36,    37,   180,    59,    12,    62,   590,   271,    13,
+      14,     0,    15,     0,   339,    16,     0,    17,     0,     0,
+       0,     0,     0,     0,    18,    38,     0,     0,     0,     0,
+      19,   266,     0,     0,    20,     0,    21,    22,    23,     0,
+       0,     0,     0,     0,    25,     0,     0,     0,     0,     4,
+       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
+       0,     0,     0,     0,     0,     0,     0,    26,     0,     0,
+       0,    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,   367,     0,     0,    20,
+       0,    21,    22,    23,     0,     0,     0,     0,     0,    25,
+       0,     0,     0,     0,     4,     0,     0,     0,     0,     0,
        0,     0,     0,     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,
+       0,     0,    26,     0,     0,     0,    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,    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,
+       0,     0,     0,     0,    18,    38,     0,     0,     0,     0,
+      19,   467,     0,     0,    20,     0,    21,    22,    23,     0,
+       0,     0,     0,     0,    25,     0,     0,     0,   301,     4,
+     302,   303,   304,   305,   306,     0,     0,     0,     0,     0,
+       0,     0,     0,     0,     0,     0,     0,    26,     0,     0,
+       0,    27,    28,    29,     0,     5,    30,     6,    31,     0,
+       0,     0,    32,     7,     0,     0,     0,     9,    33,    34,
+       0,    35,     0,     0,     0,     0,    36,    37,     0,     0,
+      12,     0,     0,     0,    13,    14,     0,    15,   307,     0,
+      16,     0,    17,     0,     0,     0,     0,     0,     0,    18,
+      38,     0,     0,     0,     0,     0,   565,     0,     0,    20,
+       0,    21,    22,    23,     0,     0,     0,     0,   301,    25,
+     302,   303,   304,   305,   306,   308,     0,     0,     0,     0,
+       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
+       0,     0,    26,     0,     0,     0,    27,    28,    29,     0,
+     309,    30,     0,    31,     0,     0,     0,    32,     0,     0,
+       0,     0,   310,     0,    34,     0,    35,     0,     0,     0,
+       0,    36,    37,     0,     0,     0,     0,     0,   307,   311,
+       0,     0,   312,   313,   314,     0,     0,   315,   316,     0,
+     301,     0,   302,   303,   304,   305,   306,   301,   317,   302,
+     303,   304,   305,   306,     0,     0,     0,     0,     0,     0,
+       0,     0,     0,     0,     0,   308,     0,     0,     0,     0,
+       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
+       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
+     309,     0,     0,     0,     0,     0,     0,     0,     0,     0,
+     307,     0,   310,     0,     0,     0,     0,   307,     0,     0,
+       0,     0,     0,     0,     0,     0,     0,     0,     0,   311,
+       0,     0,   312,   313,   314,     0,     0,   315,   316,     0,
+       0,     0,     0,     0,     0,     0,   469,   308,   317,     0,
+       0,     0,     0,     0,   308,     0,     0,     0,     0,     0,
+       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
+       0,     0,   309,     0,     0,     0,     0,     0,     0,   309,
+       0,     0,     0,     0,   310,     0,     0,     0,     0,     0,
+       0,   310,     0,     0,     0,     4,     0,     0,     0,     0,
+       0,   311,   256,     0,   312,   313,   314,     0,   311,   315,
+     316,   312,   313,   374,     0,     0,   315,   316,     0,     0,
+     317,     5,     0,     6,     0,     0,     0,   317,     0,     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,   257,     0,     0,    20,     0,    21,    22,    23,
+      24,     0,     0,     0,     0,    25,     0,     0,     0,     0,
        4,     0,     0,     0,     0,     0,     0,     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,   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,    26,     0,
+       0,     0,    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,    13,    14,     0,    15,     0,
+       0,    16,     0,    17,     0,     0,     0,     0,     0,     0,
+      18,    38,     0,     0,     0,     0,    19,     0,     0,     0,
+      20,     0,    21,    22,    23,    24,     0,     0,     0,     0,
+      25,     0,     0,     0,     0,     0,     0,     0,     0,     0,
+       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
+       0,     0,     4,    26,     0,     0,     0,    27,    28,    29,
+       0,     0,    30,     0,    31,     0,     0,     0,    32,     0,
+       0,     0,     0,     0,    33,    34,     0,    35,     5,     0,
+       6,     0,    36,    37,     0,   203,     7,     0,     0,     0,
+       9,     0,     0,     0,     0,     0,     0,     0,     0,     0,
+       0,     0,     0,    12,     0,     0,    38,    13,    14,     0,
+      15,     0,   204,    16,     0,    17,     0,     0,     0,     0,
+       0,     0,    18,     0,     0,     0,     0,     0,     0,     0,
+       4,     0,    20,     0,    21,    22,    23,     0,     0,     0,
+       0,     0,    25,     0,     0,     0,     0,     0,     0,     0,
+       0,     0,     0,     0,   205,     0,     5,     0,     6,     0,
+       0,     0,     0,   203,     7,    26,     0,     0,     9,    27,
+      28,    29,     0,     0,    30,     0,    31,   206,     0,     0,
+      32,    12,     0,     0,     0,    13,    14,    34,    15,    35,
+     204,    16,     0,    17,    36,    37,     0,     0,     0,     0,
+      18,     0,     0,     0,     0,     0,     0,   537,     4,     0,
+      20,     0,    21,    22,    23,     0,     0,     0,    38,     0,
+      25,     0,     0,     0,     0,   533,     0,     0,     0,     0,
+       0,     0,   205,     0,     5,     0,     6,     0,     0,     0,
+       0,     0,     7,    26,     0,     0,     9,    27,    28,    29,
+       0,     0,    30,     0,    31,   206,     0,     0,    32,    12,
+       0,     0,     0,    13,    14,    34,    15,    35,     0,    16,
+       0,    17,    36,    37,     0,     0,     0,     0,    18,     0,
+       0,     0,     0,     0,     0,   552,     4,     0,    20,     0,
+      21,    22,    23,     0,     0,     0,    38,     0,    25,   405,
+     406,   407,   408,   409,   410,   411,   412,   413,     0,     0,
+       0,     0,     5,     0,     6,     0,     0,     0,     0,     0,
+       7,    26,     0,     0,     9,    27,    28,    29,     0,     0,
+      30,     0,    31,     0,     0,     0,    32,    12,     0,     0,
+       0,    13,    14,    34,    15,    35,     0,    16,     0,    17,
+      36,    37,     0,     0,     0,     0,    18,   405,   406,   407,
+     408,   409,   410,   411,   412,   413,    20,     0,    21,    22,
+      23,     0,     0,     0,    38,     0,    25,     0,     0,     0,
+     405,   406,   407,   408,   409,   410,   411,   412,   413,     0,
+       0,     0,     0,     0,     0,     0,     0,     0,     0,    26,
+       0,     0,     0,    27,    28,    29,     0,     0,    30,     0,
+      31,     0,     0,     0,    32,     0,     0,     0,     0,     0,
+       0,    34,     0,    35,     0,     0,     0,     0,    36,    37,
+     405,   406,   407,   408,   409,   410,   411,   414,   413,   415,
+     416,   417,   418,   419,   420,   421,   422,   423,   424,     0,
+       0,     0,    38,     0,     0,     0,   425,   426,     0,     0,
+       0,   440,   405,   406,   407,   408,   409,   410,   411,   412,
+     413,     0,     0,     0,     0,     0,     0,     0,     0,     0,
+       0,     0,     0,     0,   405,   406,   407,   408,   409,   410,
+     411,   412,   413,     0,     0,   414,     0,   415,   416,   417,
+     418,   419,   420,   421,   422,   423,   424,   405,   406,   407,
+     408,   409,   410,   411,   425,   426,     0,     0,   414,   448,
+     415,   416,   417,   418,   419,   420,   421,   422,   423,   424,
+       0,     0,     0,     0,     0,     0,     0,   425,   426,     0,
+       0,     0,   491,   405,   406,   407,   408,   409,   410,   411,
+     412,   413,     0,     0,     0,     0,     0,     0,     0,     0,
+       0,   405,   406,   407,   408,   409,   410,   411,     0,     0,
+     415,   416,   417,   418,   419,   420,   421,   422,   423,   424,
+     405,   406,   407,   408,   409,   410,   411,   425,   426,     0,
        0,     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,
-       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,
+     414,     0,   415,   416,   417,   418,   419,   420,   421,   422,
+     423,   424,   405,   406,   407,   408,   409,   410,   411,   425,
+     426,   561,   414,   560,   415,   416,   417,   418,   419,   420,
+     421,   422,   423,   424,     0,     0,     0,     0,     0,     0,
+       0,   425,   426,     0,     0,     0,     0,   415,   416,   417,
+     418,   419,   420,   421,   422,   423,   424,     0,     0,     0,
+       0,     0,     0,     0,   425,   426,     0,     0,     0,     0,
        0,     0,     0,     0,     0,     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,   414,     0,   415,   416,   417,   418,   419,   420,   421,
+     422,   423,   424,     0,     0,     0,     0,     0,     0,     0,
+     425,   426,   416,   417,   418,   419,   420,   421,   422,   423,
+     424,     0,     0,     0,     0,     0,     4,     0,   425,   426,
+       0,     0,   417,   418,   419,   420,   421,   422,   423,   424,
+       0,     0,     0,     0,     0,     0,     0,   425,   426,     0,
+       0,     0,     5,     0,     6,     0,     0,     0,     0,     0,
+       7,     8,     0,     0,     9,   418,   419,   420,   421,   422,
+     423,   424,     0,     0,     0,    11,     0,    12,     0,   425,
+     426,    13,    14,     0,    15,     0,     0,    16,     0,    17,
+       0,     0,     0,     0,     0,     0,    18,     0,     0,     0,
+       0,     0,     0,     0,     4,     0,    20,     0,    21,    22,
+      23,    24,     0,     0,   175,     0,    25,     0,   176,     0,
        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,
+       5,     0,     6,     0,     0,     0,     0,     0,     7,    26,
+       0,     0,     9,    27,    28,    29,     0,     0,    30,     0,
+      31,     0,     0,     0,    32,    12,     0,     0,     0,    13,
+      14,    34,    15,    35,     0,    16,     0,    17,    36,    37,
+       0,     0,     0,     0,    18,     0,     0,     0,     0,     4,
+       0,     0,     0,     0,    20,     0,    21,    22,    23,     0,
+       0,     0,     0,     0,    25,     0,     0,     0,     0,     0,
        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,     7,     0,     0,     0,    26,     0,     0,
+       0,    27,    28,    29,     0,     0,    30,     0,    31,     0,
+      12,     0,    32,     0,    13,    14,     0,     0,     0,    34,
+      16,    35,    17,     0,     0,     0,    36,    37,     0,    18,
+       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
+       0,    21,    22,    23,     0,     0,     0,     0,     0,    25,
        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
-       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
+       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
+       0,     0,     0,     0,     0,     0,    27,    28,    29,     0,
+       0,    30,     0,     0,     0,     0,    96,    32,    97,    98,
+      99,     0,   100,   101,    34,   102,    35,     0,   103,     0,
+     104,    36,    37,     0,     0,     0,     0,   105,   106,   107,
+     108,     0,   109,   110,   111,   112,   113,     0,   114,     0,
+     115,   116,   117,     0,     0,   118,     0,     0,     0,     0,
+     119,     0,   120,   121,   122,   123,   124,   125,     0,   126,
+     127,   128,   129,   130,     0,     0,   131,     0,     0,   132,
+       0,     0,     0,     0,   133,   134,     0,   135,     0,     0,
+       0,   136,   137,   138,     0,   139,   140,   141,   142,   143,
+       0,   144,     0,   145,   146,   147,   148,   149,   150,   151,
+     152,     0,   153,   154,   155,     0,     0,     0,   156,     0,
+       0,   157,     0,     0,   158,   159,     0,     0,   160,   161,
+     162,     0,     0,     0,   163,     0,   164,   165,   166,   167,
+       0,     0,   168
 };
 
 static const yytype_int16 yycheck[] =
 {
-       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,
+       2,     2,     2,    66,     2,    46,   234,   278,     2,   266,
+     254,   235,     2,   484,   238,   280,   240,   473,    67,   243,
+     212,   477,   246,   284,   149,   170,    66,    33,   208,   209,
+      95,   176,    14,    46,   133,     3,     4,    86,     0,   149,
+     149,    63,    64,    65,   133,   225,    46,    69,    46,   174,
+      91,   490,    46,     2,    53,   283,   495,    64,    65,    36,
+       3,     4,    69,   474,   174,   174,   475,     3,     4,    37,
+     149,    48,   231,    42,    42,   234,   175,   149,     3,     4,
+     536,   492,   241,   539,   493,   244,   175,   173,   247,   248,
+      89,   112,   171,    62,    37,   116,    64,    46,   554,   356,
+     280,    37,   174,   574,   149,   170,    42,   274,   352,     8,
+     367,   567,   551,    89,    86,    84,   170,     3,     4,   140,
+     183,    64,   176,   579,   283,   284,   537,   172,    64,    29,
+     297,   298,   108,   542,   170,    35,   170,     8,   106,    10,
+     176,   552,   176,   183,   170,   208,   209,   173,   117,   558,
+     173,    37,   311,   312,   313,   314,   315,   316,   317,   128,
+     384,   129,   225,   106,    12,    13,    14,   170,   208,   209,
+     106,   173,   174,   173,   174,   173,   174,   190,    64,   173,
+     174,   221,   443,   173,   174,   225,   129,   169,   170,   229,
+     170,   159,   172,   129,   216,   466,    32,   172,    34,   176,
+     249,   250,   170,   427,   253,   173,   172,    14,   388,   216,
+     467,   170,   404,   151,   173,   374,   159,   280,   170,   172,
+     106,   173,   446,   159,   172,    25,     8,   170,    28,   175,
+     173,     3,     4,    12,    13,    14,   175,   173,    17,    18,
+     280,     3,     4,   129,   285,   172,   405,   406,    14,   408,
+     409,   410,   411,   412,   413,   414,   415,   416,   417,   418,
+     419,   420,   421,   422,   423,   424,   272,   426,     3,     4,
+     527,   536,   175,   159,     3,     4,   317,   279,   172,   279,
+     460,   279,   172,   285,   443,   279,   551,   173,   294,   481,
+       3,     4,    37,     3,     4,   172,   298,    42,   490,     3,
+       4,   175,   567,   495,    37,   172,   498,   172,   565,   157,
+     158,   159,   160,   161,   579,     3,     4,   175,   172,    64,
+     361,   169,   170,   175,   173,   388,   173,   173,   369,   173,
+     173,    64,   173,   173,   173,   173,   173,     3,   173,   380,
+     173,   404,   173,   383,   572,   386,   173,   173,   388,   529,
+     157,   158,   159,   160,   161,   396,   357,   363,   173,   551,
+     173,   106,   169,   170,   366,   173,   366,   173,   366,   369,
+     594,   369,   366,   106,   173,   369,   155,   156,   157,   158,
+     159,   160,   161,   173,   129,   173,   386,   173,   173,   173,
+     169,   170,   173,   159,   160,   161,   129,   460,   557,   175,
+     175,   560,   172,   169,   170,   172,   177,   172,     8,     8,
+     174,   174,   475,   572,   159,   173,    67,     8,     8,     8,
+     460,     8,   463,     5,   170,   170,   159,   490,   173,     4,
+     493,   472,   495,   173,   475,   172,   151,   170,   172,   175,
+     173,   149,   174,   149,   174,   176,    38,   487,   174,   177,
+     173,     3,   493,   174,   174,    30,   174,    32,   174,   149,
+     174,     8,   174,    38,    39,   174,   529,    42,   169,   174,
+     472,   174,    47,   475,   174,   174,   174,   174,    53,   174,
+      55,   174,    74,   174,    59,    60,   151,    62,   551,   529,
+      65,   493,    67,   172,    86,    87,    88,    80,   176,    74,
+     171,   542,    94,   149,   174,    80,    81,   174,   172,    84,
+     172,    86,    87,    88,    89,     3,     3,   558,     8,    94,
+     174,     5,   174,   172,     4,   172,   174,   151,   151,   531,
+     122,   531,   174,   531,   126,   174,   174,   531,   175,   174,
+     542,   174,   117,   174,   174,   174,   121,   122,   123,   151,
+      30,   126,    32,   128,   172,    44,   558,   132,    38,     2,
+     365,   472,    42,   138,   139,   383,   141,    47,   600,     2,
+     247,   146,   147,    46,     2,    55,     2,   574,   183,    59,
+      60,    -1,    62,    -1,   245,    65,    -1,    67,    -1,    -1,
+      -1,    -1,    -1,    -1,    74,   170,    -1,    -1,    -1,    -1,
+      80,   176,    -1,    -1,    84,    -1,    86,    87,    88,    -1,
+      -1,    -1,    -1,    -1,    94,    -1,    -1,    -1,    -1,     4,
+      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+      -1,    -1,    -1,    -1,    -1,    -1,    -1,   117,    -1,    -1,
+      -1,   121,   122,   123,    -1,    30,   126,    32,   128,    -1,
+      -1,    -1,   132,    38,    -1,    -1,    -1,    42,   138,   139,
+      -1,   141,    47,    -1,    -1,    -1,   146,   147,    -1,    -1,
+      55,    -1,    -1,    -1,    59,    60,    -1,    62,    -1,    -1,
+      65,    -1,    67,    -1,    -1,    -1,    -1,    -1,    -1,    74,
+     170,    -1,    -1,    -1,    -1,    80,   176,    -1,    -1,    84,
+      -1,    86,    87,    88,    -1,    -1,    -1,    -1,    -1,    94,
+      -1,    -1,    -1,    -1,     4,    -1,    -1,    -1,    -1,    -1,
       -1,    -1,    -1,    -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,
+      -1,    -1,   117,    -1,    -1,    -1,   121,   122,   123,    -1,
+      30,   126,    32,   128,    -1,    -1,    -1,   132,    38,    -1,
+      -1,    -1,    42,   138,   139,    -1,   141,    47,    -1,    -1,
+      -1,   146,   147,    -1,    -1,    55,    -1,    -1,    -1,    59,
+      60,    -1,    62,    -1,    -1,    65,    -1,    67,    -1,    -1,
+      -1,    -1,    -1,    -1,    74,   170,    -1,    -1,    -1,    -1,
+      80,   176,    -1,    -1,    84,    -1,    86,    87,    88,    -1,
+      -1,    -1,    -1,    -1,    94,    -1,    -1,    -1,     3,     4,
+       5,     6,     7,     8,     9,    -1,    -1,    -1,    -1,    -1,
+      -1,    -1,    -1,    -1,    -1,    -1,    -1,   117,    -1,    -1,
+      -1,   121,   122,   123,    -1,    30,   126,    32,   128,    -1,
+      -1,    -1,   132,    38,    -1,    -1,    -1,    42,   138,   139,
+      -1,   141,    -1,    -1,    -1,    -1,   146,   147,    -1,    -1,
+      55,    -1,    -1,    -1,    59,    60,    -1,    62,    63,    -1,
+      65,    -1,    67,    -1,    -1,    -1,    -1,    -1,    -1,    74,
+     170,    -1,    -1,    -1,    -1,    -1,   176,    -1,    -1,    84,
+      -1,    86,    87,    88,    -1,    -1,    -1,    -1,     3,    94,
+       5,     6,     7,     8,     9,   100,    -1,    -1,    -1,    -1,
+      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+      -1,    -1,   117,    -1,    -1,    -1,   121,   122,   123,    -1,
+     125,   126,    -1,   128,    -1,    -1,    -1,   132,    -1,    -1,
+      -1,    -1,   137,    -1,   139,    -1,   141,    -1,    -1,    -1,
+      -1,   146,   147,    -1,    -1,    -1,    -1,    -1,    63,   154,
+      -1,    -1,   157,   158,   159,    -1,    -1,   162,   163,    -1,
+       3,    -1,     5,     6,     7,     8,     9,     3,   173,     5,
+       6,     7,     8,     9,    -1,    -1,    -1,    -1,    -1,    -1,
+      -1,    -1,    -1,    -1,    -1,   100,    -1,    -1,    -1,    -1,
+      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+     125,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+      63,    -1,   137,    -1,    -1,    -1,    -1,    63,    -1,    -1,
+      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,   154,
+      -1,    -1,   157,   158,   159,    -1,    -1,   162,   163,    -1,
+      -1,    -1,    -1,    -1,    -1,    -1,   171,   100,   173,    -1,
+      -1,    -1,    -1,    -1,   100,    -1,    -1,    -1,    -1,    -1,
+      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+      -1,    -1,   125,    -1,    -1,    -1,    -1,    -1,    -1,   125,
+      -1,    -1,    -1,    -1,   137,    -1,    -1,    -1,    -1,    -1,
+      -1,   137,    -1,    -1,    -1,     4,    -1,    -1,    -1,    -1,
+      -1,   154,    11,    -1,   157,   158,   159,    -1,   154,   162,
+     163,   157,   158,   159,    -1,    -1,   162,   163,    -1,    -1,
+     173,    30,    -1,    32,    -1,    -1,    -1,   173,    -1,    38,
+      39,    -1,    -1,    42,    -1,    -1,    -1,    -1,    47,    -1,
+      -1,    -1,    -1,    -1,    53,    -1,    55,    -1,    -1,    -1,
+      59,    60,    -1,    62,    -1,    -1,    65,    -1,    67,    -1,
+      -1,    -1,    -1,    -1,    -1,    74,    -1,    -1,    -1,    -1,
+      -1,    80,    81,    -1,    -1,    84,    -1,    86,    87,    88,
+      89,    -1,    -1,    -1,    -1,    94,    -1,    -1,    -1,    -1,
        4,    -1,    -1,    -1,    -1,    -1,    -1,    -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,     3,     4,     5,     6,     7,     8,     9,
+      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,   117,    -1,
+      -1,    -1,   121,   122,   123,    -1,    30,   126,    32,   128,
+      -1,    -1,    -1,   132,    38,    39,    -1,    -1,    42,   138,
+     139,    -1,   141,    47,    -1,    -1,    -1,   146,   147,    53,
+      -1,    55,    -1,    -1,    -1,    59,    60,    -1,    62,    -1,
+      -1,    65,    -1,    67,    -1,    -1,    -1,    -1,    -1,    -1,
+      74,   170,    -1,    -1,    -1,    -1,    80,    -1,    -1,    -1,
+      84,    -1,    86,    87,    88,    89,    -1,    -1,    -1,    -1,
+      94,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
       -1,    -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,
-      -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,     4,   117,    -1,    -1,    -1,   121,   122,   123,
+      -1,    -1,   126,    -1,   128,    -1,    -1,    -1,   132,    -1,
+      -1,    -1,    -1,    -1,   138,   139,    -1,   141,    30,    -1,
+      32,    -1,   146,   147,    -1,    37,    38,    -1,    -1,    -1,
+      42,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+      -1,    -1,    -1,    55,    -1,    -1,   170,    59,    60,    -1,
+      62,    -1,    64,    65,    -1,    67,    -1,    -1,    -1,    -1,
+      -1,    -1,    74,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+       4,    -1,    84,    -1,    86,    87,    88,    -1,    -1,    -1,
+      -1,    -1,    94,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+      -1,    -1,    -1,    -1,   106,    -1,    30,    -1,    32,    -1,
+      -1,    -1,    -1,    37,    38,   117,    -1,    -1,    42,   121,
+     122,   123,    -1,    -1,   126,    -1,   128,   129,    -1,    -1,
+     132,    55,    -1,    -1,    -1,    59,    60,   139,    62,   141,
+      64,    65,    -1,    67,   146,   147,    -1,    -1,    -1,    -1,
+      74,    -1,    -1,    -1,    -1,    -1,    -1,   159,     4,    -1,
+      84,    -1,    86,    87,    88,    -1,    -1,    -1,   170,    -1,
+      94,    -1,    -1,    -1,    -1,    21,    -1,    -1,    -1,    -1,
+      -1,    -1,   106,    -1,    30,    -1,    32,    -1,    -1,    -1,
+      -1,    -1,    38,   117,    -1,    -1,    42,   121,   122,   123,
+      -1,    -1,   126,    -1,   128,   129,    -1,    -1,   132,    55,
+      -1,    -1,    -1,    59,    60,   139,    62,   141,    -1,    65,
+      -1,    67,   146,   147,    -1,    -1,    -1,    -1,    74,    -1,
+      -1,    -1,    -1,    -1,    -1,   159,     4,    -1,    84,    -1,
+      86,    87,    88,    -1,    -1,    -1,   170,    -1,    94,    12,
+      13,    14,    15,    16,    17,    18,    19,    20,    -1,    -1,
+      -1,    -1,    30,    -1,    32,    -1,    -1,    -1,    -1,    -1,
+      38,   117,    -1,    -1,    42,   121,   122,   123,    -1,    -1,
+     126,    -1,   128,    -1,    -1,    -1,   132,    55,    -1,    -1,
+      -1,    59,    60,   139,    62,   141,    -1,    65,    -1,    67,
+     146,   147,    -1,    -1,    -1,    -1,    74,    12,    13,    14,
+      15,    16,    17,    18,    19,    20,    84,    -1,    86,    87,
+      88,    -1,    -1,    -1,   170,    -1,    94,    -1,    -1,    -1,
+      12,    13,    14,    15,    16,    17,    18,    19,    20,    -1,
+      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,   117,
+      -1,    -1,    -1,   121,   122,   123,    -1,    -1,   126,    -1,
+     128,    -1,    -1,    -1,   132,    -1,    -1,    -1,    -1,    -1,
+      -1,   139,    -1,   141,    -1,    -1,    -1,    -1,   146,   147,
+      12,    13,    14,    15,    16,    17,    18,   150,    20,   152,
+     153,   154,   155,   156,   157,   158,   159,   160,   161,    -1,
+      -1,    -1,   170,    -1,    -1,    -1,   169,   170,    -1,    -1,
+      -1,   174,    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,   150,    -1,   152,   153,   154,
+     155,   156,   157,   158,   159,   160,   161,    12,    13,    14,
+      15,    16,    17,    18,   169,   170,    -1,    -1,   150,   174,
+     152,   153,   154,   155,   156,   157,   158,   159,   160,   161,
+      -1,    -1,    -1,    -1,    -1,    -1,    -1,   169,   170,    -1,
+      -1,    -1,   174,    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,    -1,    -1,
+     152,   153,   154,   155,   156,   157,   158,   159,   160,   161,
+      12,    13,    14,    15,    16,    17,    18,   169,   170,    -1,
       -1,    -1,    -1,    -1,    -1,    -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,
+     150,    -1,   152,   153,   154,   155,   156,   157,   158,   159,
+     160,   161,    12,    13,    14,    15,    16,    17,    18,   169,
+     170,   171,   150,   151,   152,   153,   154,   155,   156,   157,
+     158,   159,   160,   161,    -1,    -1,    -1,    -1,    -1,    -1,
+      -1,   169,   170,    -1,    -1,    -1,    -1,   152,   153,   154,
+     155,   156,   157,   158,   159,   160,   161,    -1,    -1,    -1,
+      -1,    -1,    -1,    -1,   169,   170,    -1,    -1,    -1,    -1,
       -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,   150,    -1,   152,   153,   154,   155,   156,   157,   158,
+     159,   160,   161,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+     169,   170,   153,   154,   155,   156,   157,   158,   159,   160,
+     161,    -1,    -1,    -1,    -1,    -1,     4,    -1,   169,   170,
+      -1,    -1,   154,   155,   156,   157,   158,   159,   160,   161,
+      -1,    -1,    -1,    -1,    -1,    -1,    -1,   169,   170,    -1,
+      -1,    -1,    30,    -1,    32,    -1,    -1,    -1,    -1,    -1,
+      38,    39,    -1,    -1,    42,   155,   156,   157,   158,   159,
+     160,   161,    -1,    -1,    -1,    53,    -1,    55,    -1,   169,
+     170,    59,    60,    -1,    62,    -1,    -1,    65,    -1,    67,
+      -1,    -1,    -1,    -1,    -1,    -1,    74,    -1,    -1,    -1,
+      -1,    -1,    -1,    -1,     4,    -1,    84,    -1,    86,    87,
+      88,    89,    -1,    -1,    92,    -1,    94,    -1,    96,    -1,
       -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-      -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
+      30,    -1,    32,    -1,    -1,    -1,    -1,    -1,    38,   117,
+      -1,    -1,    42,   121,   122,   123,    -1,    -1,   126,    -1,
+     128,    -1,    -1,    -1,   132,    55,    -1,    -1,    -1,    59,
+      60,   139,    62,   141,    -1,    65,    -1,    67,   146,   147,
+      -1,    -1,    -1,    -1,    74,    -1,    -1,    -1,    -1,     4,
+      -1,    -1,    -1,    -1,    84,    -1,    86,    87,    88,    -1,
+      -1,    -1,    -1,    -1,    94,    -1,    -1,    -1,    -1,    -1,
+      -1,    -1,    -1,    -1,    -1,    30,    -1,    32,    -1,    -1,
+      -1,    -1,    -1,    38,    -1,    -1,    -1,   117,    -1,    -1,
+      -1,   121,   122,   123,    -1,    -1,   126,    -1,   128,    -1,
+      55,    -1,   132,    -1,    59,    60,    -1,    -1,    -1,   139,
+      65,   141,    67,    -1,    -1,    -1,   146,   147,    -1,    74,
+      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+      -1,    86,    87,    88,    -1,    -1,    -1,    -1,    -1,    94,
+      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+      -1,    -1,    -1,    -1,    -1,    -1,   121,   122,   123,    -1,
+      -1,   126,    -1,    -1,    -1,    -1,    22,   132,    24,    25,
+      26,    -1,    28,    29,   139,    31,   141,    -1,    34,    -1,
+      36,   146,   147,    -1,    -1,    -1,    -1,    43,    44,    45,
+      46,    -1,    48,    49,    50,    51,    52,    -1,    54,    -1,
+      56,    57,    58,    -1,    -1,    61,    -1,    -1,    -1,    -1,
+      66,    -1,    68,    69,    70,    71,    72,    73,    -1,    75,
+      76,    77,    78,    79,    -1,    -1,    82,    -1,    -1,    85,
+      -1,    -1,    -1,    -1,    90,    91,    -1,    93,    -1,    -1,
+      -1,    97,    98,    99,    -1,   101,   102,   103,   104,   105,
+      -1,   107,    -1,   109,   110,   111,   112,   113,   114,   115,
+     116,    -1,   118,   119,   120,    -1,    -1,    -1,   124,    -1,
+      -1,   127,    -1,    -1,   130,   131,    -1,    -1,   134,   135,
+     136,    -1,    -1,    -1,   140,    -1,   142,   143,   144,   145,
+      -1,    -1,   148
 };
 
 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
    symbol of state STATE-NUM.  */
 static const yytype_uint16 yystos[] =
 {
-       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,   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
+       0,   179,   180,     0,     4,    30,    32,    38,    39,    42,
+      47,    53,    55,    59,    60,    62,    65,    67,    74,    80,
+      84,    86,    87,    88,    89,    94,   117,   121,   122,   123,
+     126,   128,   132,   138,   139,   141,   146,   147,   170,   184,
+     185,   186,   187,   188,   191,   192,   199,   210,   224,   228,
+     230,   231,   232,   233,   236,   237,   240,   242,   243,   244,
+     245,   247,   248,   249,   250,   251,   253,   255,   272,   273,
+     274,   275,     3,     4,   173,     3,     4,     3,     4,   226,
+      86,   229,     8,     3,     4,   229,   173,   229,   230,     3,
+     226,   198,   199,     3,   226,   230,    22,    24,    25,    26,
+      28,    29,    31,    34,    36,    43,    44,    45,    46,    48,
+      49,    50,    51,    52,    54,    56,    57,    58,    61,    66,
+      68,    69,    70,    71,    72,    73,    75,    76,    77,    78,
+      79,    82,    85,    90,    91,    93,    97,    98,    99,   101,
+     102,   103,   104,   105,   107,   109,   110,   111,   112,   113,
+     114,   115,   116,   118,   119,   120,   124,   127,   130,   131,
+     134,   135,   136,   140,   142,   143,   144,   145,   148,   200,
+     202,   271,   172,   181,   181,    92,    96,   190,   210,   231,
+     236,   242,   246,   253,   272,   275,   172,   172,   175,   172,
+     175,   172,   183,   172,   151,   241,   175,   254,   255,   254,
+     254,     3,     4,    37,    64,   106,   129,   159,   173,   204,
+     227,   256,   257,   270,   210,   272,   273,   275,   254,   172,
+       8,   175,   172,   273,   175,   253,   133,   175,   173,   173,
+     173,   173,   173,   173,   173,   173,   173,   173,   173,   173,
+     173,   173,   173,   173,   173,   173,   173,   173,   173,   173,
+     173,   173,   173,   173,   149,   171,    11,    81,   184,   189,
+     192,   231,   233,   244,   245,   248,   176,     3,     3,     4,
+     175,   270,   234,   108,   238,   242,     3,     4,   175,   182,
+     252,   256,   256,   177,   170,   173,   197,   254,   174,   207,
+     208,   209,   227,   174,   217,   256,   266,   173,   220,     8,
+     227,     3,     5,     6,     7,     8,     9,    63,   100,   125,
+     137,   154,   157,   158,   159,   162,   163,   173,   213,   214,
+     215,   213,   216,     8,     8,   201,   216,   215,     8,     8,
+     215,     8,   215,   213,    67,   215,   211,   212,   213,   271,
+     215,   211,   213,   273,   273,     8,    10,   203,     5,   276,
+     273,   202,   170,   173,   172,   183,   176,   198,   235,   151,
+      95,   198,   222,   239,   172,   175,   182,   176,   184,   199,
+     251,   256,   174,   216,   159,   212,   193,   194,   195,   196,
+     199,   253,   176,   149,   177,   176,   198,   218,   149,   222,
+     176,   199,   219,   222,   174,   174,   173,   213,   213,   213,
+     213,   213,   213,   213,   253,    12,    13,    14,    15,    16,
+      17,    18,    19,    20,   150,   152,   153,   154,   155,   156,
+     157,   158,   159,   160,   161,   169,   170,   149,   174,   174,
+     174,   149,   174,   174,   174,   174,   174,   174,   174,   174,
+     174,     3,   174,   149,   174,   174,   149,   174,   174,   174,
+     174,   174,   169,   174,   174,   202,     8,   183,   245,   151,
+     253,   172,   176,   198,   223,   176,   188,   176,   183,   171,
+     171,   174,   149,   253,   159,   173,   197,   204,   227,   262,
+     264,   265,   209,   215,   253,   275,   256,   174,   172,   172,
+     253,   174,   159,   173,   197,   204,   258,   260,   261,   213,
+     213,     3,   213,   213,   213,   213,   213,   213,   213,   213,
+     213,   213,   213,   213,   213,   213,   213,   213,   213,     3,
+     213,   215,     8,   174,   212,   215,     5,   174,   256,   253,
+     172,   182,   183,    21,   196,   264,   252,   159,   193,   204,
+     263,   264,   173,   197,   262,   268,   269,   172,   225,   227,
+     260,   252,   159,   193,   204,   259,   260,   174,   173,   197,
+     151,   171,   174,   183,   256,   176,   264,   252,   174,   264,
+     174,   193,   151,   267,   149,   172,   175,   174,   260,   252,
+     174,   264,   174,   213,   193,   213,   183,   264,   174,   216,
+     268,   205,   264,   174,    36,    48,   176,   206,   215,   151,
+     151,   172,   221,   222,   221,   172
 };
 
 #define yyerrok                (yyerrstatus = 0)
@@ -2513,7 +2643,7 @@ yyreduce:
         case 2:
 
 /* Line 1455 of yacc.c  */
-#line 326 "parser.y"
+#line 330 "parser.y"
     { fix_incomplete();
                                                  check_statements((yyvsp[(1) - (1)].stmt_list), FALSE);
                                                  check_all_user_types((yyvsp[(1) - (1)].stmt_list));
@@ -2530,28 +2660,28 @@ yyreduce:
   case 3:
 
 /* Line 1455 of yacc.c  */
-#line 339 "parser.y"
+#line 343 "parser.y"
     { (yyval.stmt_list) = NULL; ;}
     break;
 
   case 4:
 
 /* Line 1455 of yacc.c  */
-#line 340 "parser.y"
+#line 344 "parser.y"
     { (yyval.stmt_list) = append_statement((yyvsp[(1) - (2)].stmt_list), make_statement_reference((yyvsp[(2) - (2)].type))); ;}
     break;
 
   case 5:
 
 /* Line 1455 of yacc.c  */
-#line 341 "parser.y"
+#line 345 "parser.y"
     { (yyval.stmt_list) = append_statement((yyvsp[(1) - (2)].stmt_list), make_statement_type_decl((yyvsp[(2) - (2)].type))); ;}
     break;
 
   case 6:
 
 /* Line 1455 of yacc.c  */
-#line 342 "parser.y"
+#line 346 "parser.y"
     { (yyval.stmt_list) = (yyvsp[(1) - (3)].stmt_list);
                                                  reg_type((yyvsp[(2) - (3)].type), (yyvsp[(2) - (3)].type)->name, 0);
                                                ;}
@@ -2560,7 +2690,7 @@ yyreduce:
   case 7:
 
 /* Line 1455 of yacc.c  */
-#line 345 "parser.y"
+#line 349 "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);
                                                ;}
@@ -2569,56 +2699,56 @@ yyreduce:
   case 8:
 
 /* Line 1455 of yacc.c  */
-#line 348 "parser.y"
+#line 352 "parser.y"
     { (yyval.stmt_list) = append_statement((yyvsp[(1) - (2)].stmt_list), make_statement_module((yyvsp[(2) - (2)].type))); ;}
     break;
 
   case 9:
 
 /* Line 1455 of yacc.c  */
-#line 349 "parser.y"
+#line 353 "parser.y"
     { (yyval.stmt_list) = append_statement((yyvsp[(1) - (2)].stmt_list), make_statement_library((yyvsp[(2) - (2)].typelib))); ;}
     break;
 
   case 10:
 
 /* Line 1455 of yacc.c  */
-#line 350 "parser.y"
+#line 354 "parser.y"
     { (yyval.stmt_list) = append_statement((yyvsp[(1) - (2)].stmt_list), (yyvsp[(2) - (2)].statement)); ;}
     break;
 
   case 11:
 
 /* Line 1455 of yacc.c  */
-#line 353 "parser.y"
+#line 357 "parser.y"
     { (yyval.stmt_list) = NULL; ;}
     break;
 
   case 12:
 
 /* Line 1455 of yacc.c  */
-#line 354 "parser.y"
+#line 358 "parser.y"
     { (yyval.stmt_list) = append_statement((yyvsp[(1) - (2)].stmt_list), make_statement_reference((yyvsp[(2) - (2)].type))); ;}
     break;
 
   case 13:
 
 /* Line 1455 of yacc.c  */
-#line 355 "parser.y"
+#line 359 "parser.y"
     { (yyval.stmt_list) = append_statement((yyvsp[(1) - (2)].stmt_list), make_statement_type_decl((yyvsp[(2) - (2)].type))); ;}
     break;
 
   case 14:
 
 /* Line 1455 of yacc.c  */
-#line 356 "parser.y"
+#line 360 "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 1455 of yacc.c  */
-#line 357 "parser.y"
+#line 361 "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);
                                                ;}
@@ -2627,112 +2757,112 @@ yyreduce:
   case 16:
 
 /* Line 1455 of yacc.c  */
-#line 360 "parser.y"
+#line 364 "parser.y"
     { (yyval.stmt_list) = append_statement((yyvsp[(1) - (2)].stmt_list), make_statement_module((yyvsp[(2) - (2)].type))); ;}
     break;
 
   case 17:
 
 /* Line 1455 of yacc.c  */
-#line 361 "parser.y"
+#line 365 "parser.y"
     { (yyval.stmt_list) = append_statement((yyvsp[(1) - (2)].stmt_list), (yyvsp[(2) - (2)].statement)); ;}
     break;
 
   case 18:
 
 /* Line 1455 of yacc.c  */
-#line 362 "parser.y"
+#line 366 "parser.y"
     { (yyval.stmt_list) = append_statement((yyvsp[(1) - (2)].stmt_list), make_statement_importlib((yyvsp[(2) - (2)].str))); ;}
     break;
 
   case 19:
 
 /* Line 1455 of yacc.c  */
-#line 363 "parser.y"
+#line 367 "parser.y"
     { (yyval.stmt_list) = append_statement((yyvsp[(1) - (2)].stmt_list), make_statement_library((yyvsp[(2) - (2)].typelib))); ;}
     break;
 
   case 20:
 
 /* Line 1455 of yacc.c  */
-#line 366 "parser.y"
+#line 370 "parser.y"
     { (yyval.stmt_list) = NULL; ;}
     break;
 
   case 21:
 
 /* Line 1455 of yacc.c  */
-#line 367 "parser.y"
+#line 371 "parser.y"
     { (yyval.stmt_list) = append_statement((yyvsp[(1) - (2)].stmt_list), (yyvsp[(2) - (2)].statement)); ;}
     break;
 
   case 24:
 
 /* Line 1455 of yacc.c  */
-#line 375 "parser.y"
+#line 379 "parser.y"
     { (yyval.statement) = make_statement_cppquote((yyvsp[(1) - (1)].str)); ;}
     break;
 
   case 25:
 
 /* Line 1455 of yacc.c  */
-#line 376 "parser.y"
+#line 380 "parser.y"
     { (yyval.statement) = make_statement_type_decl((yyvsp[(1) - (2)].type)); ;}
     break;
 
   case 26:
 
 /* Line 1455 of yacc.c  */
-#line 377 "parser.y"
+#line 381 "parser.y"
     { (yyval.statement) = make_statement_declaration((yyvsp[(1) - (2)].var)); ;}
     break;
 
   case 27:
 
 /* Line 1455 of yacc.c  */
-#line 378 "parser.y"
+#line 382 "parser.y"
     { (yyval.statement) = make_statement_import((yyvsp[(1) - (1)].str)); ;}
     break;
 
   case 28:
 
 /* Line 1455 of yacc.c  */
-#line 379 "parser.y"
+#line 383 "parser.y"
     { (yyval.statement) = (yyvsp[(1) - (2)].statement); ;}
     break;
 
   case 32:
 
 /* Line 1455 of yacc.c  */
-#line 386 "parser.y"
+#line 390 "parser.y"
     { (yyval.type) = (yyvsp[(2) - (2)].type); (yyval.type)->attrs = check_enum_attrs((yyvsp[(1) - (2)].attr_list)); ;}
     break;
 
   case 33:
 
 /* Line 1455 of yacc.c  */
-#line 387 "parser.y"
+#line 391 "parser.y"
     { (yyval.type) = (yyvsp[(2) - (2)].type); (yyval.type)->attrs = check_struct_attrs((yyvsp[(1) - (2)].attr_list)); ;}
     break;
 
   case 34:
 
 /* Line 1455 of yacc.c  */
-#line 388 "parser.y"
+#line 392 "parser.y"
     { (yyval.type) = (yyvsp[(2) - (2)].type); (yyval.type)->attrs = check_union_attrs((yyvsp[(1) - (2)].attr_list)); ;}
     break;
 
   case 35:
 
 /* Line 1455 of yacc.c  */
-#line 391 "parser.y"
+#line 395 "parser.y"
     { (yyval.str) = (yyvsp[(3) - (4)].str); ;}
     break;
 
   case 36:
 
 /* Line 1455 of yacc.c  */
-#line 393 "parser.y"
+#line 397 "parser.y"
     { assert(yychar == YYEMPTY);
                                                  (yyval.import) = xmalloc(sizeof(struct _import_t));
                                                  (yyval.import)->name = (yyvsp[(2) - (3)].str);
@@ -2744,7 +2874,7 @@ yyreduce:
   case 37:
 
 /* Line 1455 of yacc.c  */
-#line 401 "parser.y"
+#line 405 "parser.y"
     { (yyval.str) = (yyvsp[(1) - (3)].import)->name;
                                                  if ((yyvsp[(1) - (3)].import)->import_performed) pop_import();
                                                  free((yyvsp[(1) - (3)].import));
@@ -2754,21 +2884,21 @@ yyreduce:
   case 38:
 
 /* Line 1455 of yacc.c  */
-#line 408 "parser.y"
+#line 412 "parser.y"
     { (yyval.str) = (yyvsp[(3) - (5)].str); if(!parse_only) add_importlib((yyvsp[(3) - (5)].str)); ;}
     break;
 
   case 39:
 
 /* Line 1455 of yacc.c  */
-#line 411 "parser.y"
+#line 415 "parser.y"
     { (yyval.str) = (yyvsp[(2) - (2)].str); ;}
     break;
 
   case 40:
 
 /* Line 1455 of yacc.c  */
-#line 413 "parser.y"
+#line 417 "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));
                                                ;}
@@ -2777,7 +2907,7 @@ yyreduce:
   case 41:
 
 /* Line 1455 of yacc.c  */
-#line 418 "parser.y"
+#line 422 "parser.y"
     { (yyval.typelib) = (yyvsp[(1) - (4)].typelib);
                                                  (yyval.typelib)->stmts = (yyvsp[(2) - (4)].stmt_list);
                                                  if (!parse_only) end_typelib();
@@ -2787,724 +2917,728 @@ yyreduce:
   case 42:
 
 /* Line 1455 of yacc.c  */
-#line 424 "parser.y"
+#line 428 "parser.y"
     { (yyval.var_list) = NULL; ;}
     break;
 
   case 44:
 
 /* Line 1455 of yacc.c  */
-#line 428 "parser.y"
-    { (yyval.var_list) = NULL; ;}
+#line 432 "parser.y"
+    { check_arg_attrs((yyvsp[(1) - (1)].var)); (yyval.var_list) = append_var( NULL, (yyvsp[(1) - (1)].var) ); ;}
     break;
 
   case 45:
 
 /* 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) ); ;}
+#line 433 "parser.y"
+    { check_arg_attrs((yyvsp[(3) - (3)].var)); (yyval.var_list) = append_var( (yyvsp[(1) - (3)].var_list), (yyvsp[(3) - (3)].var) ); ;}
     break;
 
-  case 46:
+  case 47:
 
 /* 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)); ;}
+#line 437 "parser.y"
+    { (yyval.var_list) = append_var( (yyvsp[(1) - (3)].var_list), make_var(strdup("...")) ); ;}
     break;
 
   case 48:
 
 /* 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)
+#line 441 "parser.y"
+    { 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[(2) - (3)].declspec), (yyvsp[(3) - (3)].declarator), TRUE);
-                                                 free((yyvsp[(3) - (3)].declarator));
+                                                 (yyval.var) = declare_var((yyvsp[(1) - (3)].attr_list), (yyvsp[(2) - (3)].declspec), (yyvsp[(3) - (3)].declarator), TRUE);
+                                                 free((yyvsp[(2) - (3)].declspec)); free((yyvsp[(3) - (3)].declarator));
                                                ;}
     break;
 
   case 49:
 
 /* 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)
+#line 446 "parser.y"
+    { 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) - (2)].declspec), (yyvsp[(2) - (2)].declarator), TRUE);
-                                                 free((yyvsp[(2) - (2)].declarator));
+                                                 (yyval.var) = declare_var(NULL, (yyvsp[(1) - (2)].declspec), (yyvsp[(2) - (2)].declarator), TRUE);
+                                                 free((yyvsp[(1) - (2)].declspec)); free((yyvsp[(2) - (2)].declarator));
                                                ;}
     break;
 
   case 50:
 
 /* Line 1455 of yacc.c  */
-#line 452 "parser.y"
+#line 453 "parser.y"
     { (yyval.expr) = (yyvsp[(2) - (3)].expr); ;}
     break;
 
   case 51:
 
 /* Line 1455 of yacc.c  */
-#line 453 "parser.y"
+#line 454 "parser.y"
     { (yyval.expr) = make_expr(EXPR_VOID); ;}
     break;
 
   case 52:
 
 /* Line 1455 of yacc.c  */
-#line 456 "parser.y"
+#line 457 "parser.y"
     { (yyval.attr_list) = NULL; ;}
     break;
 
   case 54:
 
 /* Line 1455 of yacc.c  */
-#line 461 "parser.y"
+#line 462 "parser.y"
     { (yyval.attr_list) = (yyvsp[(2) - (3)].attr_list); ;}
     break;
 
   case 55:
 
 /* Line 1455 of yacc.c  */
-#line 464 "parser.y"
+#line 465 "parser.y"
     { (yyval.attr_list) = append_attr( NULL, (yyvsp[(1) - (1)].attr) ); ;}
     break;
 
   case 56:
 
 /* Line 1455 of yacc.c  */
-#line 465 "parser.y"
+#line 466 "parser.y"
     { (yyval.attr_list) = append_attr( (yyvsp[(1) - (3)].attr_list), (yyvsp[(3) - (3)].attr) ); ;}
     break;
 
   case 57:
 
 /* Line 1455 of yacc.c  */
-#line 466 "parser.y"
+#line 467 "parser.y"
     { (yyval.attr_list) = append_attr( (yyvsp[(1) - (4)].attr_list), (yyvsp[(4) - (4)].attr) ); ;}
     break;
 
   case 58:
 
 /* Line 1455 of yacc.c  */
-#line 469 "parser.y"
+#line 470 "parser.y"
     { (yyval.str_list) = append_str( NULL, (yyvsp[(1) - (1)].str) ); ;}
     break;
 
   case 59:
 
 /* Line 1455 of yacc.c  */
-#line 470 "parser.y"
+#line 471 "parser.y"
     { (yyval.str_list) = append_str( (yyvsp[(1) - (3)].str_list), (yyvsp[(3) - (3)].str) ); ;}
     break;
 
   case 60:
 
 /* Line 1455 of yacc.c  */
-#line 473 "parser.y"
+#line 474 "parser.y"
     { (yyval.attr) = NULL; ;}
     break;
 
   case 61:
 
 /* Line 1455 of yacc.c  */
-#line 474 "parser.y"
+#line 475 "parser.y"
     { (yyval.attr) = make_attr(ATTR_AGGREGATABLE); ;}
     break;
 
   case 62:
 
 /* Line 1455 of yacc.c  */
-#line 475 "parser.y"
-    { (yyval.attr) = make_attr(ATTR_APPOBJECT); ;}
+#line 476 "parser.y"
+    { (yyval.attr) = make_attrp(ATTR_ANNOTATION, (yyvsp[(3) - (4)].str)); ;}
     break;
 
   case 63:
 
 /* Line 1455 of yacc.c  */
-#line 476 "parser.y"
-    { (yyval.attr) = make_attr(ATTR_ASYNC); ;}
+#line 477 "parser.y"
+    { (yyval.attr) = make_attr(ATTR_APPOBJECT); ;}
     break;
 
   case 64:
 
 /* Line 1455 of yacc.c  */
-#line 477 "parser.y"
-    { (yyval.attr) = make_attr(ATTR_AUTO_HANDLE); ;}
+#line 478 "parser.y"
+    { (yyval.attr) = make_attr(ATTR_ASYNC); ;}
     break;
 
   case 65:
 
 /* Line 1455 of yacc.c  */
-#line 478 "parser.y"
-    { (yyval.attr) = make_attr(ATTR_BINDABLE); ;}
+#line 479 "parser.y"
+    { (yyval.attr) = make_attr(ATTR_AUTO_HANDLE); ;}
     break;
 
   case 66:
 
 /* Line 1455 of yacc.c  */
-#line 479 "parser.y"
-    { (yyval.attr) = make_attr(ATTR_BROADCAST); ;}
+#line 480 "parser.y"
+    { (yyval.attr) = make_attr(ATTR_BINDABLE); ;}
     break;
 
   case 67:
 
 /* Line 1455 of yacc.c  */
-#line 480 "parser.y"
-    { (yyval.attr) = make_attrp(ATTR_CALLAS, (yyvsp[(3) - (4)].var)); ;}
+#line 481 "parser.y"
+    { (yyval.attr) = make_attr(ATTR_BROADCAST); ;}
     break;
 
   case 68:
 
 /* Line 1455 of yacc.c  */
-#line 481 "parser.y"
-    { (yyval.attr) = make_attrp(ATTR_CASE, (yyvsp[(3) - (4)].expr_list)); ;}
+#line 482 "parser.y"
+    { (yyval.attr) = make_attrp(ATTR_CALLAS, (yyvsp[(3) - (4)].var)); ;}
     break;
 
   case 69:
 
 /* Line 1455 of yacc.c  */
-#line 482 "parser.y"
-    { (yyval.attr) = make_attrv(ATTR_CONTEXTHANDLE, 0); ;}
+#line 483 "parser.y"
+    { (yyval.attr) = make_attrp(ATTR_CASE, (yyvsp[(3) - (4)].expr_list)); ;}
     break;
 
   case 70:
 
 /* Line 1455 of yacc.c  */
-#line 483 "parser.y"
-    { (yyval.attr) = make_attrv(ATTR_CONTEXTHANDLE, 0); /* RPC_CONTEXT_HANDLE_DONT_SERIALIZE */ ;}
+#line 484 "parser.y"
+    { (yyval.attr) = make_attrv(ATTR_CONTEXTHANDLE, 0); ;}
     break;
 
   case 71:
 
 /* Line 1455 of yacc.c  */
-#line 484 "parser.y"
-    { (yyval.attr) = make_attrv(ATTR_CONTEXTHANDLE, 0); /* RPC_CONTEXT_HANDLE_SERIALIZE */ ;}
+#line 485 "parser.y"
+    { (yyval.attr) = make_attrv(ATTR_CONTEXTHANDLE, 0); /* RPC_CONTEXT_HANDLE_DONT_SERIALIZE */ ;}
     break;
 
   case 72:
 
 /* Line 1455 of yacc.c  */
-#line 485 "parser.y"
-    { (yyval.attr) = make_attr(ATTR_CONTROL); ;}
+#line 486 "parser.y"
+    { (yyval.attr) = make_attrv(ATTR_CONTEXTHANDLE, 0); /* RPC_CONTEXT_HANDLE_SERIALIZE */ ;}
     break;
 
   case 73:
 
 /* Line 1455 of yacc.c  */
-#line 486 "parser.y"
-    { (yyval.attr) = make_attr(ATTR_DEFAULT); ;}
+#line 487 "parser.y"
+    { (yyval.attr) = make_attr(ATTR_CONTROL); ;}
     break;
 
   case 74:
 
 /* Line 1455 of yacc.c  */
-#line 487 "parser.y"
-    { (yyval.attr) = make_attr(ATTR_DEFAULTCOLLELEM); ;}
+#line 488 "parser.y"
+    { (yyval.attr) = make_attr(ATTR_DEFAULT); ;}
     break;
 
   case 75:
 
 /* Line 1455 of yacc.c  */
-#line 488 "parser.y"
-    { (yyval.attr) = make_attrp(ATTR_DEFAULTVALUE, (yyvsp[(3) - (4)].expr)); ;}
+#line 489 "parser.y"
+    { (yyval.attr) = make_attr(ATTR_DEFAULTCOLLELEM); ;}
     break;
 
   case 76:
 
 /* Line 1455 of yacc.c  */
-#line 489 "parser.y"
-    { (yyval.attr) = make_attr(ATTR_DEFAULTVTABLE); ;}
+#line 490 "parser.y"
+    { (yyval.attr) = make_attrp(ATTR_DEFAULTVALUE, (yyvsp[(3) - (4)].expr)); ;}
     break;
 
   case 77:
 
 /* Line 1455 of yacc.c  */
-#line 490 "parser.y"
-    { (yyval.attr) = make_attr(ATTR_DISPLAYBIND); ;}
+#line 491 "parser.y"
+    { (yyval.attr) = make_attr(ATTR_DEFAULTVTABLE); ;}
     break;
 
   case 78:
 
 /* Line 1455 of yacc.c  */
-#line 491 "parser.y"
-    { (yyval.attr) = make_attrp(ATTR_DLLNAME, (yyvsp[(3) - (4)].str)); ;}
+#line 492 "parser.y"
+    { (yyval.attr) = make_attr(ATTR_DISPLAYBIND); ;}
     break;
 
   case 79:
 
 /* Line 1455 of yacc.c  */
-#line 492 "parser.y"
-    { (yyval.attr) = make_attr(ATTR_DUAL); ;}
+#line 493 "parser.y"
+    { (yyval.attr) = make_attrp(ATTR_DLLNAME, (yyvsp[(3) - (4)].str)); ;}
     break;
 
   case 80:
 
 /* Line 1455 of yacc.c  */
-#line 493 "parser.y"
-    { (yyval.attr) = make_attrp(ATTR_ENDPOINT, (yyvsp[(3) - (4)].str_list)); ;}
+#line 494 "parser.y"
+    { (yyval.attr) = make_attr(ATTR_DUAL); ;}
     break;
 
   case 81:
 
 /* Line 1455 of yacc.c  */
-#line 494 "parser.y"
-    { (yyval.attr) = make_attrp(ATTR_ENTRY, (yyvsp[(3) - (4)].expr)); ;}
+#line 495 "parser.y"
+    { (yyval.attr) = make_attrp(ATTR_ENDPOINT, (yyvsp[(3) - (4)].str_list)); ;}
     break;
 
   case 82:
 
 /* Line 1455 of yacc.c  */
-#line 495 "parser.y"
-    { (yyval.attr) = make_attr(ATTR_EXPLICIT_HANDLE); ;}
+#line 496 "parser.y"
+    { (yyval.attr) = make_attrp(ATTR_ENTRY, (yyvsp[(3) - (4)].expr)); ;}
     break;
 
   case 83:
 
 /* Line 1455 of yacc.c  */
-#line 496 "parser.y"
-    { (yyval.attr) = make_attr(ATTR_HANDLE); ;}
+#line 497 "parser.y"
+    { (yyval.attr) = make_attr(ATTR_EXPLICIT_HANDLE); ;}
     break;
 
   case 84:
 
 /* Line 1455 of yacc.c  */
-#line 497 "parser.y"
-    { (yyval.attr) = make_attrp(ATTR_HELPCONTEXT, (yyvsp[(3) - (4)].expr)); ;}
+#line 498 "parser.y"
+    { (yyval.attr) = make_attr(ATTR_HANDLE); ;}
     break;
 
   case 85:
 
 /* Line 1455 of yacc.c  */
-#line 498 "parser.y"
-    { (yyval.attr) = make_attrp(ATTR_HELPFILE, (yyvsp[(3) - (4)].str)); ;}
+#line 499 "parser.y"
+    { (yyval.attr) = make_attrp(ATTR_HELPCONTEXT, (yyvsp[(3) - (4)].expr)); ;}
     break;
 
   case 86:
 
 /* Line 1455 of yacc.c  */
-#line 499 "parser.y"
-    { (yyval.attr) = make_attrp(ATTR_HELPSTRING, (yyvsp[(3) - (4)].str)); ;}
+#line 500 "parser.y"
+    { (yyval.attr) = make_attrp(ATTR_HELPFILE, (yyvsp[(3) - (4)].str)); ;}
     break;
 
   case 87:
 
 /* Line 1455 of yacc.c  */
-#line 500 "parser.y"
-    { (yyval.attr) = make_attrp(ATTR_HELPSTRINGCONTEXT, (yyvsp[(3) - (4)].expr)); ;}
+#line 501 "parser.y"
+    { (yyval.attr) = make_attrp(ATTR_HELPSTRING, (yyvsp[(3) - (4)].str)); ;}
     break;
 
   case 88:
 
 /* Line 1455 of yacc.c  */
-#line 501 "parser.y"
-    { (yyval.attr) = make_attrp(ATTR_HELPSTRINGDLL, (yyvsp[(3) - (4)].str)); ;}
+#line 502 "parser.y"
+    { (yyval.attr) = make_attrp(ATTR_HELPSTRINGCONTEXT, (yyvsp[(3) - (4)].expr)); ;}
     break;
 
   case 89:
 
 /* Line 1455 of yacc.c  */
-#line 502 "parser.y"
-    { (yyval.attr) = make_attr(ATTR_HIDDEN); ;}
+#line 503 "parser.y"
+    { (yyval.attr) = make_attrp(ATTR_HELPSTRINGDLL, (yyvsp[(3) - (4)].str)); ;}
     break;
 
   case 90:
 
 /* Line 1455 of yacc.c  */
-#line 503 "parser.y"
-    { (yyval.attr) = make_attrp(ATTR_ID, (yyvsp[(3) - (4)].expr)); ;}
+#line 504 "parser.y"
+    { (yyval.attr) = make_attr(ATTR_HIDDEN); ;}
     break;
 
   case 91:
 
 /* Line 1455 of yacc.c  */
-#line 504 "parser.y"
-    { (yyval.attr) = make_attr(ATTR_IDEMPOTENT); ;}
+#line 505 "parser.y"
+    { (yyval.attr) = make_attrp(ATTR_ID, (yyvsp[(3) - (4)].expr)); ;}
     break;
 
   case 92:
 
 /* Line 1455 of yacc.c  */
-#line 505 "parser.y"
-    { (yyval.attr) = make_attrp(ATTR_IIDIS, (yyvsp[(3) - (4)].expr)); ;}
+#line 506 "parser.y"
+    { (yyval.attr) = make_attr(ATTR_IDEMPOTENT); ;}
     break;
 
   case 93:
 
 /* Line 1455 of yacc.c  */
-#line 506 "parser.y"
-    { (yyval.attr) = make_attr(ATTR_IMMEDIATEBIND); ;}
+#line 507 "parser.y"
+    { (yyval.attr) = make_attrp(ATTR_IIDIS, (yyvsp[(3) - (4)].expr)); ;}
     break;
 
   case 94:
 
 /* Line 1455 of yacc.c  */
-#line 507 "parser.y"
-    { (yyval.attr) = make_attrp(ATTR_IMPLICIT_HANDLE, (yyvsp[(4) - (5)].str)); ;}
+#line 508 "parser.y"
+    { (yyval.attr) = make_attr(ATTR_IMMEDIATEBIND); ;}
     break;
 
   case 95:
 
 /* Line 1455 of yacc.c  */
-#line 508 "parser.y"
-    { (yyval.attr) = make_attr(ATTR_IN); ;}
+#line 509 "parser.y"
+    { (yyval.attr) = make_attrp(ATTR_IMPLICIT_HANDLE, (yyvsp[(4) - (5)].str)); ;}
     break;
 
   case 96:
 
 /* Line 1455 of yacc.c  */
-#line 509 "parser.y"
-    { (yyval.attr) = make_attr(ATTR_INPUTSYNC); ;}
+#line 510 "parser.y"
+    { (yyval.attr) = make_attr(ATTR_IN); ;}
     break;
 
   case 97:
 
 /* Line 1455 of yacc.c  */
-#line 510 "parser.y"
-    { (yyval.attr) = make_attrp(ATTR_LENGTHIS, (yyvsp[(3) - (4)].expr_list)); ;}
+#line 511 "parser.y"
+    { (yyval.attr) = make_attr(ATTR_INPUTSYNC); ;}
     break;
 
   case 98:
 
 /* Line 1455 of yacc.c  */
-#line 511 "parser.y"
-    { (yyval.attr) = make_attrp(ATTR_LIBLCID, (yyvsp[(3) - (4)].expr)); ;}
+#line 512 "parser.y"
+    { (yyval.attr) = make_attrp(ATTR_LENGTHIS, (yyvsp[(3) - (4)].expr_list)); ;}
     break;
 
   case 99:
 
 /* Line 1455 of yacc.c  */
-#line 512 "parser.y"
-    { (yyval.attr) = make_attr(ATTR_PARAMLCID); ;}
+#line 513 "parser.y"
+    { (yyval.attr) = make_attrp(ATTR_LIBLCID, (yyvsp[(3) - (4)].expr)); ;}
     break;
 
   case 100:
 
 /* Line 1455 of yacc.c  */
-#line 513 "parser.y"
-    { (yyval.attr) = make_attr(ATTR_LOCAL); ;}
+#line 514 "parser.y"
+    { (yyval.attr) = make_attr(ATTR_PARAMLCID); ;}
     break;
 
   case 101:
 
 /* Line 1455 of yacc.c  */
-#line 514 "parser.y"
-    { (yyval.attr) = make_attr(ATTR_NONBROWSABLE); ;}
+#line 515 "parser.y"
+    { (yyval.attr) = make_attr(ATTR_LOCAL); ;}
     break;
 
   case 102:
 
 /* Line 1455 of yacc.c  */
-#line 515 "parser.y"
-    { (yyval.attr) = make_attr(ATTR_NONCREATABLE); ;}
+#line 516 "parser.y"
+    { (yyval.attr) = make_attr(ATTR_NONBROWSABLE); ;}
     break;
 
   case 103:
 
 /* Line 1455 of yacc.c  */
-#line 516 "parser.y"
-    { (yyval.attr) = make_attr(ATTR_NONEXTENSIBLE); ;}
+#line 517 "parser.y"
+    { (yyval.attr) = make_attr(ATTR_NONCREATABLE); ;}
     break;
 
   case 104:
 
 /* Line 1455 of yacc.c  */
-#line 517 "parser.y"
-    { (yyval.attr) = make_attr(ATTR_OBJECT); ;}
+#line 518 "parser.y"
+    { (yyval.attr) = make_attr(ATTR_NONEXTENSIBLE); ;}
     break;
 
   case 105:
 
 /* Line 1455 of yacc.c  */
-#line 518 "parser.y"
-    { (yyval.attr) = make_attr(ATTR_ODL); ;}
+#line 519 "parser.y"
+    { (yyval.attr) = make_attr(ATTR_OBJECT); ;}
     break;
 
   case 106:
 
 /* Line 1455 of yacc.c  */
-#line 519 "parser.y"
-    { (yyval.attr) = make_attr(ATTR_OLEAUTOMATION); ;}
+#line 520 "parser.y"
+    { (yyval.attr) = make_attr(ATTR_ODL); ;}
     break;
 
   case 107:
 
 /* Line 1455 of yacc.c  */
-#line 520 "parser.y"
-    { (yyval.attr) = make_attr(ATTR_OPTIONAL); ;}
+#line 521 "parser.y"
+    { (yyval.attr) = make_attr(ATTR_OLEAUTOMATION); ;}
     break;
 
   case 108:
 
 /* Line 1455 of yacc.c  */
-#line 521 "parser.y"
-    { (yyval.attr) = make_attr(ATTR_OUT); ;}
+#line 522 "parser.y"
+    { (yyval.attr) = make_attr(ATTR_OPTIONAL); ;}
     break;
 
   case 109:
 
 /* Line 1455 of yacc.c  */
-#line 522 "parser.y"
-    { (yyval.attr) = make_attrv(ATTR_POINTERDEFAULT, (yyvsp[(3) - (4)].num)); ;}
+#line 523 "parser.y"
+    { (yyval.attr) = make_attr(ATTR_OUT); ;}
     break;
 
   case 110:
 
 /* Line 1455 of yacc.c  */
-#line 523 "parser.y"
-    { (yyval.attr) = make_attr(ATTR_PROPGET); ;}
+#line 524 "parser.y"
+    { (yyval.attr) = make_attrv(ATTR_POINTERDEFAULT, (yyvsp[(3) - (4)].num)); ;}
     break;
 
   case 111:
 
 /* Line 1455 of yacc.c  */
-#line 524 "parser.y"
-    { (yyval.attr) = make_attr(ATTR_PROPPUT); ;}
+#line 525 "parser.y"
+    { (yyval.attr) = make_attr(ATTR_PROPGET); ;}
     break;
 
   case 112:
 
 /* Line 1455 of yacc.c  */
-#line 525 "parser.y"
-    { (yyval.attr) = make_attr(ATTR_PROPPUTREF); ;}
+#line 526 "parser.y"
+    { (yyval.attr) = make_attr(ATTR_PROPPUT); ;}
     break;
 
   case 113:
 
 /* Line 1455 of yacc.c  */
-#line 526 "parser.y"
-    { (yyval.attr) = make_attr(ATTR_PUBLIC); ;}
+#line 527 "parser.y"
+    { (yyval.attr) = make_attr(ATTR_PROPPUTREF); ;}
     break;
 
   case 114:
 
 /* Line 1455 of yacc.c  */
 #line 528 "parser.y"
+    { (yyval.attr) = make_attr(ATTR_PUBLIC); ;}
+    break;
+
+  case 115:
+
+/* Line 1455 of yacc.c  */
+#line 530 "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 115:
+  case 116:
 
 /* Line 1455 of yacc.c  */
-#line 531 "parser.y"
+#line 533 "parser.y"
     { (yyval.attr) = make_attr(ATTR_READONLY); ;}
     break;
 
-  case 116:
+  case 117:
 
 /* Line 1455 of yacc.c  */
-#line 532 "parser.y"
+#line 534 "parser.y"
     { (yyval.attr) = make_attr(ATTR_REQUESTEDIT); ;}
     break;
 
-  case 117:
+  case 118:
 
 /* Line 1455 of yacc.c  */
-#line 533 "parser.y"
+#line 535 "parser.y"
     { (yyval.attr) = make_attr(ATTR_RESTRICTED); ;}
     break;
 
-  case 118:
+  case 119:
 
 /* Line 1455 of yacc.c  */
-#line 534 "parser.y"
+#line 536 "parser.y"
     { (yyval.attr) = make_attr(ATTR_RETVAL); ;}
     break;
 
-  case 119:
+  case 120:
 
 /* Line 1455 of yacc.c  */
-#line 535 "parser.y"
+#line 537 "parser.y"
     { (yyval.attr) = make_attrp(ATTR_SIZEIS, (yyvsp[(3) - (4)].expr_list)); ;}
     break;
 
-  case 120:
+  case 121:
 
 /* Line 1455 of yacc.c  */
-#line 536 "parser.y"
+#line 538 "parser.y"
     { (yyval.attr) = make_attr(ATTR_SOURCE); ;}
     break;
 
-  case 121:
+  case 122:
 
 /* Line 1455 of yacc.c  */
-#line 537 "parser.y"
+#line 539 "parser.y"
     { (yyval.attr) = make_attr(ATTR_STRICTCONTEXTHANDLE); ;}
     break;
 
-  case 122:
+  case 123:
 
 /* Line 1455 of yacc.c  */
-#line 538 "parser.y"
+#line 540 "parser.y"
     { (yyval.attr) = make_attr(ATTR_STRING); ;}
     break;
 
-  case 123:
+  case 124:
 
 /* Line 1455 of yacc.c  */
-#line 539 "parser.y"
+#line 541 "parser.y"
     { (yyval.attr) = make_attrp(ATTR_SWITCHIS, (yyvsp[(3) - (4)].expr)); ;}
     break;
 
-  case 124:
+  case 125:
 
 /* Line 1455 of yacc.c  */
-#line 540 "parser.y"
+#line 542 "parser.y"
     { (yyval.attr) = make_attrp(ATTR_SWITCHTYPE, (yyvsp[(3) - (4)].type)); ;}
     break;
 
-  case 125:
+  case 126:
 
 /* Line 1455 of yacc.c  */
-#line 541 "parser.y"
+#line 543 "parser.y"
     { (yyval.attr) = make_attrp(ATTR_TRANSMITAS, (yyvsp[(3) - (4)].type)); ;}
     break;
 
-  case 126:
+  case 127:
 
 /* Line 1455 of yacc.c  */
-#line 542 "parser.y"
+#line 544 "parser.y"
     { (yyval.attr) = make_attrp(ATTR_UUID, (yyvsp[(3) - (4)].uuid)); ;}
     break;
 
-  case 127:
+  case 128:
 
 /* Line 1455 of yacc.c  */
-#line 543 "parser.y"
+#line 545 "parser.y"
     { (yyval.attr) = make_attr(ATTR_V1ENUM); ;}
     break;
 
-  case 128:
+  case 129:
 
 /* Line 1455 of yacc.c  */
-#line 544 "parser.y"
+#line 546 "parser.y"
     { (yyval.attr) = make_attr(ATTR_VARARG); ;}
     break;
 
-  case 129:
+  case 130:
 
 /* Line 1455 of yacc.c  */
-#line 545 "parser.y"
+#line 547 "parser.y"
     { (yyval.attr) = make_attrv(ATTR_VERSION, (yyvsp[(3) - (4)].num)); ;}
     break;
 
-  case 130:
+  case 131:
 
 /* Line 1455 of yacc.c  */
-#line 546 "parser.y"
+#line 548 "parser.y"
     { (yyval.attr) = make_attrp(ATTR_WIREMARSHAL, (yyvsp[(3) - (4)].type)); ;}
     break;
 
-  case 131:
+  case 132:
 
 /* Line 1455 of yacc.c  */
-#line 547 "parser.y"
+#line 549 "parser.y"
     { (yyval.attr) = make_attrv(ATTR_POINTERTYPE, (yyvsp[(1) - (1)].num)); ;}
     break;
 
-  case 133:
+  case 134:
 
 /* Line 1455 of yacc.c  */
-#line 552 "parser.y"
+#line 554 "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 134:
+  case 135:
 
 /* Line 1455 of yacc.c  */
-#line 557 "parser.y"
+#line 559 "parser.y"
     { (yyval.str) = (yyvsp[(1) - (1)].str); ;}
     break;
 
-  case 135:
+  case 136:
 
 /* Line 1455 of yacc.c  */
-#line 558 "parser.y"
+#line 560 "parser.y"
     { (yyval.str) = (yyvsp[(1) - (1)].str); ;}
     break;
 
-  case 136:
+  case 137:
 
 /* Line 1455 of yacc.c  */
-#line 559 "parser.y"
+#line 561 "parser.y"
     { (yyval.str) = (yyvsp[(1) - (1)].str); ;}
     break;
 
-  case 137:
+  case 138:
 
 /* Line 1455 of yacc.c  */
-#line 560 "parser.y"
+#line 562 "parser.y"
     { (yyval.str) = (yyvsp[(1) - (1)].str); ;}
     break;
 
-  case 138:
+  case 139:
 
 /* Line 1455 of yacc.c  */
-#line 563 "parser.y"
+#line 565 "parser.y"
     { (yyval.var_list) = NULL; ;}
     break;
 
-  case 139:
+  case 140:
 
 /* Line 1455 of yacc.c  */
-#line 564 "parser.y"
+#line 566 "parser.y"
     { (yyval.var_list) = append_var( (yyvsp[(1) - (2)].var_list), (yyvsp[(2) - (2)].var) ); ;}
     break;
 
-  case 140:
+  case 141:
 
 /* Line 1455 of yacc.c  */
-#line 567 "parser.y"
+#line 569 "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 141:
+  case 142:
 
 /* Line 1455 of yacc.c  */
-#line 571 "parser.y"
+#line 573 "parser.y"
     { attr_t *a = make_attr(ATTR_DEFAULT);
                                                  (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 142:
+  case 143:
 
 /* Line 1455 of yacc.c  */
-#line 577 "parser.y"
+#line 579 "parser.y"
     { (yyval.var_list) = NULL; ;}
     break;
 
-  case 143:
+  case 144:
 
 /* Line 1455 of yacc.c  */
-#line 578 "parser.y"
+#line 580 "parser.y"
     { (yyval.var_list) = (yyvsp[(1) - (2)].var_list); ;}
     break;
 
-  case 145:
+  case 146:
 
 /* Line 1455 of yacc.c  */
-#line 582 "parser.y"
+#line 584 "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 146:
+  case 147:
 
 /* Line 1455 of yacc.c  */
-#line 586 "parser.y"
+#line 588 "parser.y"
     { if (!(yyvsp[(3) - (3)].var)->eval)
                                                   {
                                                     var_t *last = LIST_ENTRY( list_tail((yyval.var_list)), var_t, entry );
@@ -3514,659 +3648,662 @@ yyreduce:
                                                ;}
     break;
 
-  case 147:
+  case 148:
 
 /* Line 1455 of yacc.c  */
-#line 595 "parser.y"
+#line 597 "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 148:
+  case 149:
 
 /* Line 1455 of yacc.c  */
-#line 599 "parser.y"
+#line 601 "parser.y"
     { (yyval.var) = reg_const((yyvsp[(1) - (1)].var));
                                                   (yyval.var)->type = type_new_int(TYPE_BASIC_INT, 0);
                                                ;}
     break;
 
-  case 149:
+  case 150:
 
 /* Line 1455 of yacc.c  */
-#line 604 "parser.y"
+#line 606 "parser.y"
     { (yyval.type) = type_new_enum((yyvsp[(2) - (5)].str), TRUE, (yyvsp[(4) - (5)].var_list)); ;}
     break;
 
-  case 150:
+  case 151:
 
 /* Line 1455 of yacc.c  */
-#line 607 "parser.y"
+#line 609 "parser.y"
     { (yyval.expr_list) = append_expr( NULL, (yyvsp[(1) - (1)].expr) ); ;}
     break;
 
-  case 151:
+  case 152:
 
 /* Line 1455 of yacc.c  */
-#line 608 "parser.y"
+#line 610 "parser.y"
     { (yyval.expr_list) = append_expr( (yyvsp[(1) - (3)].expr_list), (yyvsp[(3) - (3)].expr) ); ;}
     break;
 
-  case 152:
+  case 153:
 
 /* Line 1455 of yacc.c  */
-#line 621 "parser.y"
+#line 623 "parser.y"
     { (yyval.expr) = make_expr(EXPR_VOID); ;}
     break;
 
-  case 154:
+  case 155:
 
 /* Line 1455 of yacc.c  */
-#line 625 "parser.y"
+#line 627 "parser.y"
     { (yyval.expr) = make_exprl(EXPR_NUM, (yyvsp[(1) - (1)].num)); ;}
     break;
 
-  case 155:
+  case 156:
 
 /* Line 1455 of yacc.c  */
-#line 626 "parser.y"
+#line 628 "parser.y"
     { (yyval.expr) = make_exprl(EXPR_HEXNUM, (yyvsp[(1) - (1)].num)); ;}
     break;
 
-  case 156:
+  case 157:
 
 /* Line 1455 of yacc.c  */
-#line 627 "parser.y"
+#line 629 "parser.y"
     { (yyval.expr) = make_exprd(EXPR_DOUBLE, (yyvsp[(1) - (1)].dbl)); ;}
     break;
 
-  case 157:
+  case 158:
 
 /* Line 1455 of yacc.c  */
-#line 628 "parser.y"
+#line 630 "parser.y"
     { (yyval.expr) = make_exprl(EXPR_TRUEFALSE, 0); ;}
     break;
 
-  case 158:
+  case 159:
 
 /* Line 1455 of yacc.c  */
-#line 629 "parser.y"
+#line 631 "parser.y"
     { (yyval.expr) = make_exprl(EXPR_NUM, 0); ;}
     break;
 
-  case 159:
+  case 160:
 
 /* Line 1455 of yacc.c  */
-#line 630 "parser.y"
+#line 632 "parser.y"
     { (yyval.expr) = make_exprl(EXPR_TRUEFALSE, 1); ;}
     break;
 
-  case 160:
+  case 161:
 
 /* Line 1455 of yacc.c  */
-#line 631 "parser.y"
+#line 633 "parser.y"
     { (yyval.expr) = make_exprs(EXPR_STRLIT, (yyvsp[(1) - (1)].str)); ;}
     break;
 
-  case 161:
+  case 162:
 
 /* Line 1455 of yacc.c  */
-#line 632 "parser.y"
+#line 634 "parser.y"
     { (yyval.expr) = make_exprs(EXPR_WSTRLIT, (yyvsp[(1) - (1)].str)); ;}
     break;
 
-  case 162:
+  case 163:
 
 /* Line 1455 of yacc.c  */
-#line 633 "parser.y"
+#line 635 "parser.y"
     { (yyval.expr) = make_exprs(EXPR_IDENTIFIER, (yyvsp[(1) - (1)].str)); ;}
     break;
 
-  case 163:
+  case 164:
 
 /* Line 1455 of yacc.c  */
-#line 634 "parser.y"
+#line 636 "parser.y"
     { (yyval.expr) = make_expr3(EXPR_COND, (yyvsp[(1) - (5)].expr), (yyvsp[(3) - (5)].expr), (yyvsp[(5) - (5)].expr)); ;}
     break;
 
-  case 164:
+  case 165:
 
 /* Line 1455 of yacc.c  */
-#line 635 "parser.y"
+#line 637 "parser.y"
     { (yyval.expr) = make_expr2(EXPR_LOGOR, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;}
     break;
 
-  case 165:
+  case 166:
 
 /* Line 1455 of yacc.c  */
-#line 636 "parser.y"
+#line 638 "parser.y"
     { (yyval.expr) = make_expr2(EXPR_LOGAND, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;}
     break;
 
-  case 166:
+  case 167:
 
 /* Line 1455 of yacc.c  */
-#line 637 "parser.y"
+#line 639 "parser.y"
     { (yyval.expr) = make_expr2(EXPR_OR , (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;}
     break;
 
-  case 167:
+  case 168:
 
 /* Line 1455 of yacc.c  */
-#line 638 "parser.y"
+#line 640 "parser.y"
     { (yyval.expr) = make_expr2(EXPR_XOR, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;}
     break;
 
-  case 168:
+  case 169:
 
 /* Line 1455 of yacc.c  */
-#line 639 "parser.y"
+#line 641 "parser.y"
     { (yyval.expr) = make_expr2(EXPR_AND, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;}
     break;
 
-  case 169:
+  case 170:
 
 /* Line 1455 of yacc.c  */
-#line 640 "parser.y"
+#line 642 "parser.y"
     { (yyval.expr) = make_expr2(EXPR_EQUALITY, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;}
     break;
 
-  case 170:
+  case 171:
 
 /* Line 1455 of yacc.c  */
-#line 641 "parser.y"
+#line 643 "parser.y"
     { (yyval.expr) = make_expr2(EXPR_INEQUALITY, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;}
     break;
 
-  case 171:
+  case 172:
 
 /* Line 1455 of yacc.c  */
-#line 642 "parser.y"
+#line 644 "parser.y"
     { (yyval.expr) = make_expr2(EXPR_GTR, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;}
     break;
 
-  case 172:
+  case 173:
 
 /* Line 1455 of yacc.c  */
-#line 643 "parser.y"
+#line 645 "parser.y"
     { (yyval.expr) = make_expr2(EXPR_LESS, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;}
     break;
 
-  case 173:
+  case 174:
 
 /* Line 1455 of yacc.c  */
-#line 644 "parser.y"
+#line 646 "parser.y"
     { (yyval.expr) = make_expr2(EXPR_GTREQL, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;}
     break;
 
-  case 174:
+  case 175:
 
 /* Line 1455 of yacc.c  */
-#line 645 "parser.y"
+#line 647 "parser.y"
     { (yyval.expr) = make_expr2(EXPR_LESSEQL, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;}
     break;
 
-  case 175:
+  case 176:
 
 /* Line 1455 of yacc.c  */
-#line 646 "parser.y"
+#line 648 "parser.y"
     { (yyval.expr) = make_expr2(EXPR_SHL, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;}
     break;
 
-  case 176:
+  case 177:
 
 /* Line 1455 of yacc.c  */
-#line 647 "parser.y"
+#line 649 "parser.y"
     { (yyval.expr) = make_expr2(EXPR_SHR, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;}
     break;
 
-  case 177:
+  case 178:
 
 /* Line 1455 of yacc.c  */
-#line 648 "parser.y"
+#line 650 "parser.y"
     { (yyval.expr) = make_expr2(EXPR_ADD, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;}
     break;
 
-  case 178:
+  case 179:
 
 /* Line 1455 of yacc.c  */
-#line 649 "parser.y"
+#line 651 "parser.y"
     { (yyval.expr) = make_expr2(EXPR_SUB, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;}
     break;
 
-  case 179:
+  case 180:
 
 /* Line 1455 of yacc.c  */
-#line 650 "parser.y"
+#line 652 "parser.y"
     { (yyval.expr) = make_expr2(EXPR_MOD, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;}
     break;
 
-  case 180:
+  case 181:
 
 /* Line 1455 of yacc.c  */
-#line 651 "parser.y"
+#line 653 "parser.y"
     { (yyval.expr) = make_expr2(EXPR_MUL, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;}
     break;
 
-  case 181:
+  case 182:
 
 /* Line 1455 of yacc.c  */
-#line 652 "parser.y"
+#line 654 "parser.y"
     { (yyval.expr) = make_expr2(EXPR_DIV, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;}
     break;
 
-  case 182:
+  case 183:
 
 /* Line 1455 of yacc.c  */
-#line 653 "parser.y"
+#line 655 "parser.y"
     { (yyval.expr) = make_expr1(EXPR_LOGNOT, (yyvsp[(2) - (2)].expr)); ;}
     break;
 
-  case 183:
+  case 184:
 
 /* Line 1455 of yacc.c  */
-#line 654 "parser.y"
+#line 656 "parser.y"
     { (yyval.expr) = make_expr1(EXPR_NOT, (yyvsp[(2) - (2)].expr)); ;}
     break;
 
-  case 184:
+  case 185:
 
 /* Line 1455 of yacc.c  */
-#line 655 "parser.y"
+#line 657 "parser.y"
     { (yyval.expr) = make_expr1(EXPR_POS, (yyvsp[(2) - (2)].expr)); ;}
     break;
 
-  case 185:
+  case 186:
 
 /* Line 1455 of yacc.c  */
-#line 656 "parser.y"
+#line 658 "parser.y"
     { (yyval.expr) = make_expr1(EXPR_NEG, (yyvsp[(2) - (2)].expr)); ;}
     break;
 
-  case 186:
+  case 187:
 
 /* Line 1455 of yacc.c  */
-#line 657 "parser.y"
+#line 659 "parser.y"
     { (yyval.expr) = make_expr1(EXPR_ADDRESSOF, (yyvsp[(2) - (2)].expr)); ;}
     break;
 
-  case 187:
+  case 188:
 
 /* Line 1455 of yacc.c  */
-#line 658 "parser.y"
+#line 660 "parser.y"
     { (yyval.expr) = make_expr1(EXPR_PPTR, (yyvsp[(2) - (2)].expr)); ;}
     break;
 
-  case 188:
+  case 189:
 
 /* Line 1455 of yacc.c  */
-#line 659 "parser.y"
+#line 661 "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 189:
+  case 190:
 
 /* Line 1455 of yacc.c  */
-#line 660 "parser.y"
+#line 662 "parser.y"
     { (yyval.expr) = make_expr2(EXPR_MEMBER, (yyvsp[(1) - (3)].expr), make_exprs(EXPR_IDENTIFIER, (yyvsp[(3) - (3)].str))); ;}
     break;
 
-  case 190:
+  case 191:
 
 /* Line 1455 of yacc.c  */
-#line 661 "parser.y"
-    { (yyval.expr) = make_exprt(EXPR_CAST, (yyvsp[(2) - (4)].type), (yyvsp[(4) - (4)].expr)); ;}
+#line 664 "parser.y"
+    { (yyval.expr) = make_exprt(EXPR_CAST, declare_var(NULL, (yyvsp[(2) - (5)].declspec), (yyvsp[(3) - (5)].declarator), 0), (yyvsp[(5) - (5)].expr)); free((yyvsp[(2) - (5)].declspec)); free((yyvsp[(3) - (5)].declarator)); ;}
     break;
 
-  case 191:
+  case 192:
 
 /* Line 1455 of yacc.c  */
-#line 662 "parser.y"
-    { (yyval.expr) = make_exprt(EXPR_SIZEOF, (yyvsp[(3) - (4)].type), NULL); ;}
+#line 666 "parser.y"
+    { (yyval.expr) = make_exprt(EXPR_SIZEOF, declare_var(NULL, (yyvsp[(3) - (5)].declspec), (yyvsp[(4) - (5)].declarator), 0), NULL); free((yyvsp[(3) - (5)].declspec)); free((yyvsp[(4) - (5)].declarator)); ;}
     break;
 
-  case 192:
+  case 193:
 
 /* Line 1455 of yacc.c  */
-#line 663 "parser.y"
+#line 667 "parser.y"
     { (yyval.expr) = make_expr2(EXPR_ARRAY, (yyvsp[(1) - (4)].expr), (yyvsp[(3) - (4)].expr)); ;}
     break;
 
-  case 193:
+  case 194:
 
 /* Line 1455 of yacc.c  */
-#line 664 "parser.y"
+#line 668 "parser.y"
     { (yyval.expr) = (yyvsp[(2) - (3)].expr); ;}
     break;
 
-  case 194:
+  case 195:
 
 /* Line 1455 of yacc.c  */
-#line 667 "parser.y"
+#line 671 "parser.y"
     { (yyval.expr_list) = append_expr( NULL, (yyvsp[(1) - (1)].expr) ); ;}
     break;
 
-  case 195:
+  case 196:
 
 /* Line 1455 of yacc.c  */
-#line 668 "parser.y"
+#line 672 "parser.y"
     { (yyval.expr_list) = append_expr( (yyvsp[(1) - (3)].expr_list), (yyvsp[(3) - (3)].expr) ); ;}
     break;
 
-  case 196:
+  case 197:
 
 /* Line 1455 of yacc.c  */
-#line 671 "parser.y"
+#line 675 "parser.y"
     { (yyval.expr) = (yyvsp[(1) - (1)].expr);
                                                  if (!(yyval.expr)->is_const)
                                                      error_loc("expression is not an integer constant\n");
                                                ;}
     break;
 
-  case 197:
+  case 198:
 
 /* Line 1455 of yacc.c  */
-#line 677 "parser.y"
+#line 681 "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 198:
+  case 199:
 
 /* Line 1455 of yacc.c  */
-#line 683 "parser.y"
+#line 687 "parser.y"
     { (yyval.var_list) = NULL; ;}
     break;
 
-  case 199:
+  case 200:
 
 /* Line 1455 of yacc.c  */
-#line 684 "parser.y"
+#line 688 "parser.y"
     { (yyval.var_list) = append_var_list((yyvsp[(1) - (2)].var_list), (yyvsp[(2) - (2)].var_list)); ;}
     break;
 
-  case 200:
+  case 201:
 
 /* Line 1455 of yacc.c  */
-#line 688 "parser.y"
+#line 692 "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 201:
+  case 202:
 
 /* Line 1455 of yacc.c  */
-#line 692 "parser.y"
+#line 696 "parser.y"
     { var_t *v = make_var(NULL);
                                                  v->type = (yyvsp[(2) - (3)].type); v->attrs = (yyvsp[(1) - (3)].attr_list);
                                                  (yyval.var_list) = append_var(NULL, v);
                                                ;}
     break;
 
-  case 202:
+  case 203:
 
 /* Line 1455 of yacc.c  */
-#line 699 "parser.y"
+#line 703 "parser.y"
     { (yyval.var) = (yyvsp[(1) - (2)].var); ;}
     break;
 
-  case 203:
+  case 204:
 
 /* Line 1455 of yacc.c  */
-#line 700 "parser.y"
+#line 704 "parser.y"
     { (yyval.var) = make_var(NULL); (yyval.var)->attrs = (yyvsp[(1) - (2)].attr_list); ;}
     break;
 
-  case 204:
+  case 205:
 
 /* Line 1455 of yacc.c  */
-#line 703 "parser.y"
+#line 707 "parser.y"
     { (yyval.var_list) = NULL; ;}
     break;
 
-  case 205:
+  case 206:
 
 /* Line 1455 of yacc.c  */
-#line 704 "parser.y"
+#line 708 "parser.y"
     { (yyval.var_list) = append_var( (yyvsp[(1) - (2)].var_list), (yyvsp[(2) - (2)].var) ); ;}
     break;
 
-  case 206:
+  case 207:
 
 /* Line 1455 of yacc.c  */
-#line 708 "parser.y"
+#line 712 "parser.y"
     { (yyval.var) = (yyvsp[(1) - (2)].var); ;}
     break;
 
-  case 207:
+  case 208:
 
 /* Line 1455 of yacc.c  */
-#line 709 "parser.y"
+#line 713 "parser.y"
     { (yyval.var) = NULL; ;}
     break;
 
-  case 208:
+  case 209:
 
 /* Line 1455 of yacc.c  */
-#line 712 "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);
+#line 716 "parser.y"
+    { (yyval.var) = declare_var(check_field_attrs((yyvsp[(3) - (3)].declarator)->var->name, (yyvsp[(1) - (3)].attr_list)),
+                                                               (yyvsp[(2) - (3)].declspec), (yyvsp[(3) - (3)].declarator), FALSE);
                                                  free((yyvsp[(3) - (3)].declarator));
                                                ;}
     break;
 
-  case 209:
+  case 210:
 
 /* Line 1455 of yacc.c  */
-#line 720 "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);
+#line 723 "parser.y"
+    { var_t *v;
+                                                 v = declare_var(check_function_attrs((yyvsp[(3) - (3)].declarator)->var->name, (yyvsp[(1) - (3)].attr_list)),
+                                                              (yyvsp[(2) - (3)].declspec), (yyvsp[(3) - (3)].declarator), FALSE);
                                                  free((yyvsp[(3) - (3)].declarator));
                                                  (yyval.func) = make_func(v);
                                                ;}
     break;
 
-  case 210:
+  case 211:
 
 /* Line 1455 of yacc.c  */
-#line 730 "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);
+#line 733 "parser.y"
+    { (yyval.var) = declare_var((yyvsp[(1) - (3)].attr_list), (yyvsp[(2) - (3)].declspec), (yyvsp[(3) - (3)].declarator), FALSE);
                                                  free((yyvsp[(3) - (3)].declarator));
                                                ;}
     break;
 
-  case 211:
+  case 212:
 
 /* Line 1455 of yacc.c  */
-#line 735 "parser.y"
-    { (yyval.var) = (yyvsp[(2) - (2)].declarator)->var;
-                                                 set_type((yyval.var), (yyvsp[(1) - (2)].declspec), (yyvsp[(2) - (2)].declarator), FALSE);
+#line 736 "parser.y"
+    { (yyval.var) = declare_var(NULL, (yyvsp[(1) - (2)].declspec), (yyvsp[(2) - (2)].declarator), FALSE);
                                                  free((yyvsp[(2) - (2)].declarator));
                                                ;}
     break;
 
-  case 212:
+  case 213:
 
 /* Line 1455 of yacc.c  */
 #line 741 "parser.y"
     { (yyval.var) = NULL; ;}
     break;
 
-  case 214:
+  case 215:
 
 /* Line 1455 of yacc.c  */
 #line 745 "parser.y"
     { (yyval.str) = NULL; ;}
     break;
 
-  case 215:
+  case 216:
 
 /* Line 1455 of yacc.c  */
 #line 746 "parser.y"
     { (yyval.str) = (yyvsp[(1) - (1)].str); ;}
     break;
 
-  case 216:
+  case 217:
 
 /* Line 1455 of yacc.c  */
 #line 747 "parser.y"
     { (yyval.str) = (yyvsp[(1) - (1)].str); ;}
     break;
 
-  case 217:
+  case 218:
 
 /* Line 1455 of yacc.c  */
 #line 750 "parser.y"
     { (yyval.var) = make_var((yyvsp[(1) - (1)].str)); ;}
     break;
 
-  case 218:
+  case 219:
 
 /* Line 1455 of yacc.c  */
 #line 752 "parser.y"
     { (yyval.var) = make_var((yyvsp[(1) - (1)].str)); ;}
     break;
 
-  case 219:
+  case 220:
 
 /* Line 1455 of yacc.c  */
 #line 755 "parser.y"
     { (yyval.type) = find_type_or_error((yyvsp[(1) - (1)].str), 0); ;}
     break;
 
-  case 220:
+  case 221:
 
 /* Line 1455 of yacc.c  */
 #line 756 "parser.y"
     { (yyval.type) = find_type_or_error((yyvsp[(1) - (1)].str), 0); ;}
     break;
 
-  case 222:
+  case 223:
 
 /* 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:
+  case 224:
 
 /* Line 1455 of yacc.c  */
 #line 759 "parser.y"
     { (yyval.type) = type_new_int(type_basic_get_type((yyvsp[(2) - (2)].type)), 1); ;}
     break;
 
-  case 224:
+  case 225:
 
 /* Line 1455 of yacc.c  */
 #line 760 "parser.y"
     { (yyval.type) = type_new_int(TYPE_BASIC_INT, 1); ;}
     break;
 
-  case 225:
+  case 226:
 
 /* Line 1455 of yacc.c  */
 #line 761 "parser.y"
     { (yyval.type) = find_type_or_error((yyvsp[(1) - (1)].str), 0); ;}
     break;
 
-  case 226:
+  case 227:
 
 /* Line 1455 of yacc.c  */
 #line 762 "parser.y"
     { (yyval.type) = find_type_or_error((yyvsp[(1) - (1)].str), 0); ;}
     break;
 
-  case 227:
+  case 228:
 
 /* Line 1455 of yacc.c  */
 #line 763 "parser.y"
     { (yyval.type) = find_type_or_error((yyvsp[(1) - (1)].str), 0); ;}
     break;
 
-  case 228:
+  case 229:
 
 /* Line 1455 of yacc.c  */
 #line 764 "parser.y"
     { (yyval.type) = find_type_or_error((yyvsp[(1) - (1)].str), 0); ;}
     break;
 
-  case 229:
+  case 230:
 
 /* Line 1455 of yacc.c  */
 #line 765 "parser.y"
     { (yyval.type) = find_type_or_error((yyvsp[(1) - (1)].str), 0); ;}
     break;
 
-  case 232:
+  case 233:
 
 /* Line 1455 of yacc.c  */
 #line 772 "parser.y"
     { (yyval.type) = type_new_int(TYPE_BASIC_INT, 0); ;}
     break;
 
-  case 233:
+  case 234:
 
 /* Line 1455 of yacc.c  */
 #line 773 "parser.y"
     { (yyval.type) = type_new_int(TYPE_BASIC_INT16, 0); ;}
     break;
 
-  case 234:
+  case 235:
 
 /* Line 1455 of yacc.c  */
 #line 774 "parser.y"
     { (yyval.type) = type_new_int(TYPE_BASIC_INT8, 0); ;}
     break;
 
-  case 235:
+  case 236:
 
 /* Line 1455 of yacc.c  */
 #line 775 "parser.y"
     { (yyval.type) = type_new_int(TYPE_BASIC_INT32, 0); ;}
     break;
 
-  case 236:
+  case 237:
 
 /* Line 1455 of yacc.c  */
 #line 776 "parser.y"
     { (yyval.type) = type_new_int(TYPE_BASIC_HYPER, 0); ;}
     break;
 
-  case 237:
+  case 238:
 
 /* Line 1455 of yacc.c  */
 #line 777 "parser.y"
     { (yyval.type) = type_new_int(TYPE_BASIC_INT64, 0); ;}
     break;
 
-  case 238:
+  case 239:
 
 /* Line 1455 of yacc.c  */
 #line 778 "parser.y"
     { (yyval.type) = type_new_int(TYPE_BASIC_CHAR, 0); ;}
     break;
 
-  case 239:
+  case 240:
 
 /* Line 1455 of yacc.c  */
-#line 781 "parser.y"
-    { (yyval.type) = type_new_coclass((yyvsp[(2) - (2)].str)); ;}
+#line 779 "parser.y"
+    { (yyval.type) = type_new_int(TYPE_BASIC_INT3264, 0); ;}
     break;
 
-  case 240:
+  case 241:
 
 /* Line 1455 of yacc.c  */
 #line 782 "parser.y"
+    { (yyval.type) = type_new_coclass((yyvsp[(2) - (2)].str)); ;}
+    break;
+
+  case 242:
+
+/* Line 1455 of yacc.c  */
+#line 783 "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",
@@ -4175,62 +4312,62 @@ yyreduce:
                                                ;}
     break;
 
-  case 241:
+  case 243:
 
 /* Line 1455 of yacc.c  */
-#line 790 "parser.y"
+#line 791 "parser.y"
     { (yyval.type) = (yyvsp[(2) - (2)].type);
                                                  check_def((yyval.type));
                                                  (yyval.type)->attrs = check_coclass_attrs((yyvsp[(2) - (2)].type)->name, (yyvsp[(1) - (2)].attr_list));
                                                ;}
     break;
 
-  case 242:
+  case 244:
 
 /* Line 1455 of yacc.c  */
-#line 797 "parser.y"
+#line 798 "parser.y"
     { (yyval.type) = type_coclass_define((yyvsp[(1) - (5)].type), (yyvsp[(3) - (5)].ifref_list)); ;}
     break;
 
-  case 243:
+  case 245:
 
 /* Line 1455 of yacc.c  */
-#line 800 "parser.y"
+#line 801 "parser.y"
     { (yyval.ifref_list) = NULL; ;}
     break;
 
-  case 244:
+  case 246:
 
 /* Line 1455 of yacc.c  */
-#line 801 "parser.y"
+#line 802 "parser.y"
     { (yyval.ifref_list) = append_ifref( (yyvsp[(1) - (2)].ifref_list), (yyvsp[(2) - (2)].ifref) ); ;}
     break;
 
-  case 245:
+  case 247:
 
 /* Line 1455 of yacc.c  */
-#line 805 "parser.y"
+#line 806 "parser.y"
     { (yyval.ifref) = make_ifref((yyvsp[(2) - (2)].type)); (yyval.ifref)->attrs = (yyvsp[(1) - (2)].attr_list); ;}
     break;
 
-  case 246:
+  case 248:
 
 /* Line 1455 of yacc.c  */
-#line 808 "parser.y"
+#line 809 "parser.y"
     { (yyval.type) = get_type(TYPE_INTERFACE, (yyvsp[(2) - (2)].str), 0); ;}
     break;
 
-  case 247:
+  case 249:
 
 /* Line 1455 of yacc.c  */
-#line 809 "parser.y"
+#line 810 "parser.y"
     { (yyval.type) = get_type(TYPE_INTERFACE, (yyvsp[(2) - (2)].str), 0); ;}
     break;
 
-  case 248:
+  case 250:
 
 /* Line 1455 of yacc.c  */
-#line 812 "parser.y"
+#line 813 "parser.y"
     { attr_t *attrs;
                                                  is_object_interface = TRUE;
                                                  (yyval.type) = (yyvsp[(2) - (2)].type);
@@ -4241,471 +4378,668 @@ yyreduce:
                                                ;}
     break;
 
-  case 249:
+  case 251:
 
 /* Line 1455 of yacc.c  */
-#line 822 "parser.y"
+#line 823 "parser.y"
     { (yyval.var_list) = NULL; ;}
     break;
 
-  case 250:
+  case 252:
 
 /* Line 1455 of yacc.c  */
-#line 823 "parser.y"
+#line 824 "parser.y"
     { (yyval.var_list) = append_var( (yyvsp[(1) - (3)].var_list), (yyvsp[(2) - (3)].var) ); ;}
     break;
 
-  case 251:
+  case 253:
 
 /* Line 1455 of yacc.c  */
-#line 826 "parser.y"
+#line 827 "parser.y"
     { (yyval.stmt_list) = NULL; ;}
     break;
 
-  case 252:
+  case 254:
 
 /* Line 1455 of yacc.c  */
-#line 827 "parser.y"
+#line 828 "parser.y"
     { (yyval.stmt_list) = append_func( (yyvsp[(1) - (3)].stmt_list), (yyvsp[(2) - (3)].func) ); ;}
     break;
 
-  case 253:
+  case 255:
 
 /* Line 1455 of yacc.c  */
-#line 833 "parser.y"
+#line 834 "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 254:
+  case 256:
 
 /* Line 1455 of yacc.c  */
-#line 837 "parser.y"
+#line 838 "parser.y"
     { (yyval.type) = (yyvsp[(1) - (5)].type);
                                                  type_dispinterface_define_from_iface((yyval.type), (yyvsp[(3) - (5)].type));
                                                ;}
     break;
 
-  case 255:
+  case 257:
 
 /* Line 1455 of yacc.c  */
-#line 842 "parser.y"
+#line 843 "parser.y"
     { (yyval.type) = NULL; ;}
     break;
 
-  case 256:
+  case 258:
 
 /* Line 1455 of yacc.c  */
-#line 843 "parser.y"
+#line 844 "parser.y"
     { (yyval.type) = find_type_or_error2((yyvsp[(2) - (2)].str), 0); ;}
     break;
 
-  case 257:
+  case 259:
 
 /* Line 1455 of yacc.c  */
-#line 846 "parser.y"
+#line 847 "parser.y"
     { (yyval.type) = get_type(TYPE_INTERFACE, (yyvsp[(2) - (2)].str), 0); ;}
     break;
 
-  case 258:
+  case 260:
 
 /* Line 1455 of yacc.c  */
-#line 847 "parser.y"
+#line 848 "parser.y"
     { (yyval.type) = get_type(TYPE_INTERFACE, (yyvsp[(2) - (2)].str), 0); ;}
     break;
 
-  case 259:
+  case 261:
+
+/* Line 1455 of yacc.c  */
+#line 851 "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 262:
+
+/* Line 1455 of yacc.c  */
+#line 863 "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 263:
+
+/* Line 1455 of yacc.c  */
+#line 871 "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 264:
+
+/* Line 1455 of yacc.c  */
+#line 875 "parser.y"
+    { (yyval.type) = (yyvsp[(1) - (2)].type); ;}
+    break;
+
+  case 265:
+
+/* Line 1455 of yacc.c  */
+#line 879 "parser.y"
+    { (yyval.type) = (yyvsp[(1) - (2)].type); ;}
+    break;
+
+  case 266:
+
+/* Line 1455 of yacc.c  */
+#line 880 "parser.y"
+    { (yyval.type) = (yyvsp[(1) - (2)].type); ;}
+    break;
+
+  case 267:
+
+/* Line 1455 of yacc.c  */
+#line 883 "parser.y"
+    { (yyval.type) = type_new_module((yyvsp[(2) - (2)].str)); ;}
+    break;
+
+  case 268:
+
+/* Line 1455 of yacc.c  */
+#line 884 "parser.y"
+    { (yyval.type) = type_new_module((yyvsp[(2) - (2)].str)); ;}
+    break;
+
+  case 269:
+
+/* Line 1455 of yacc.c  */
+#line 887 "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 270:
+
+/* Line 1455 of yacc.c  */
+#line 893 "parser.y"
+    { (yyval.type) = (yyvsp[(1) - (5)].type);
+                                                  type_module_define((yyval.type), (yyvsp[(3) - (5)].stmt_list));
+                                               ;}
+    break;
+
+  case 271:
+
+/* Line 1455 of yacc.c  */
+#line 899 "parser.y"
+    { (yyval.stgclass) = STG_EXTERN; ;}
+    break;
+
+  case 272:
+
+/* Line 1455 of yacc.c  */
+#line 900 "parser.y"
+    { (yyval.stgclass) = STG_STATIC; ;}
+    break;
+
+  case 273:
+
+/* Line 1455 of yacc.c  */
+#line 901 "parser.y"
+    { (yyval.stgclass) = STG_REGISTER; ;}
+    break;
+
+  case 274:
+
+/* Line 1455 of yacc.c  */
+#line 905 "parser.y"
+    { (yyval.attr) = make_attr(ATTR_INLINE); ;}
+    break;
+
+  case 275:
+
+/* Line 1455 of yacc.c  */
+#line 909 "parser.y"
+    { (yyval.attr) = make_attr(ATTR_CONST); ;}
+    break;
+
+  case 276:
+
+/* Line 1455 of yacc.c  */
+#line 912 "parser.y"
+    { (yyval.attr_list) = NULL; ;}
+    break;
+
+  case 277:
+
+/* Line 1455 of yacc.c  */
+#line 913 "parser.y"
+    { (yyval.attr_list) = append_attr((yyvsp[(1) - (2)].attr_list), (yyvsp[(2) - (2)].attr)); ;}
+    break;
+
+  case 278:
+
+/* Line 1455 of yacc.c  */
+#line 916 "parser.y"
+    { (yyval.declspec) = make_decl_spec((yyvsp[(1) - (2)].type), (yyvsp[(2) - (2)].declspec), NULL, NULL, STG_NONE); ;}
+    break;
+
+  case 279:
+
+/* Line 1455 of yacc.c  */
+#line 918 "parser.y"
+    { (yyval.declspec) = make_decl_spec((yyvsp[(2) - (3)].type), (yyvsp[(1) - (3)].declspec), (yyvsp[(3) - (3)].declspec), NULL, STG_NONE); ;}
+    break;
+
+  case 280:
+
+/* Line 1455 of yacc.c  */
+#line 921 "parser.y"
+    { (yyval.declspec) = NULL; ;}
+    break;
+
+  case 282:
+
+/* Line 1455 of yacc.c  */
+#line 926 "parser.y"
+    { (yyval.declspec) = make_decl_spec(NULL, (yyvsp[(2) - (2)].declspec), NULL, (yyvsp[(1) - (2)].attr), STG_NONE); ;}
+    break;
+
+  case 283:
+
+/* Line 1455 of yacc.c  */
+#line 927 "parser.y"
+    { (yyval.declspec) = make_decl_spec(NULL, (yyvsp[(2) - (2)].declspec), NULL, (yyvsp[(1) - (2)].attr), STG_NONE); ;}
+    break;
+
+  case 284:
+
+/* Line 1455 of yacc.c  */
+#line 928 "parser.y"
+    { (yyval.declspec) = make_decl_spec(NULL, (yyvsp[(2) - (2)].declspec), NULL, NULL, (yyvsp[(1) - (2)].stgclass)); ;}
+    break;
+
+  case 285:
+
+/* Line 1455 of yacc.c  */
+#line 933 "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 286:
+
+/* Line 1455 of yacc.c  */
+#line 934 "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 288:
+
+/* Line 1455 of yacc.c  */
+#line 939 "parser.y"
+    { (yyval.declarator) = make_declarator((yyvsp[(1) - (1)].var)); ;}
+    break;
+
+  case 289:
 
 /* Line 1455 of yacc.c  */
-#line 850 "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;
-                                               ;}
+#line 940 "parser.y"
+    { (yyval.declarator) = (yyvsp[(2) - (3)].declarator); ;}
     break;
 
-  case 260:
+  case 290:
 
 /* Line 1455 of yacc.c  */
-#line 862 "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;
-                                               ;}
+#line 941 "parser.y"
+    { (yyval.declarator) = (yyvsp[(1) - (2)].declarator); (yyval.declarator)->array = append_array((yyval.declarator)->array, (yyvsp[(2) - (2)].expr)); ;}
     break;
 
-  case 261:
+  case 291:
 
 /* Line 1455 of yacc.c  */
-#line 870 "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;
+#line 942 "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 262:
+  case 292:
 
 /* Line 1455 of yacc.c  */
-#line 874 "parser.y"
-    { (yyval.type) = (yyvsp[(1) - (2)].type); ;}
+#line 951 "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 263:
+  case 293:
 
 /* Line 1455 of yacc.c  */
-#line 878 "parser.y"
-    { (yyval.type) = (yyvsp[(1) - (2)].type); ;}
+#line 952 "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 264:
+  case 295:
 
 /* Line 1455 of yacc.c  */
-#line 879 "parser.y"
-    { (yyval.type) = (yyvsp[(1) - (2)].type); ;}
+#line 959 "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 265:
+  case 296:
 
 /* Line 1455 of yacc.c  */
-#line 882 "parser.y"
-    { (yyval.type) = type_new_module((yyvsp[(2) - (2)].str)); ;}
+#line 960 "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 266:
+  case 297:
 
 /* Line 1455 of yacc.c  */
-#line 883 "parser.y"
-    { (yyval.type) = type_new_module((yyvsp[(2) - (2)].str)); ;}
+#line 964 "parser.y"
+    { (yyval.declarator) = make_declarator(NULL); ;}
     break;
 
-  case 267:
+  case 299:
 
 /* Line 1455 of yacc.c  */
-#line 886 "parser.y"
-    { (yyval.type) = (yyvsp[(2) - (2)].type);
-                                                 (yyval.type)->attrs = check_module_attrs((yyvsp[(2) - (2)].type)->name, (yyvsp[(1) - (2)].attr_list));
-                                               ;}
+#line 970 "parser.y"
+    { (yyval.declarator) = (yyvsp[(2) - (3)].declarator); ;}
     break;
 
-  case 268:
+  case 300:
 
 /* Line 1455 of yacc.c  */
-#line 892 "parser.y"
-    { (yyval.type) = (yyvsp[(1) - (5)].type);
-                                                  type_module_define((yyval.type), (yyvsp[(3) - (5)].stmt_list));
-                                               ;}
+#line 971 "parser.y"
+    { (yyval.declarator) = (yyvsp[(1) - (2)].declarator); (yyval.declarator)->array = append_array((yyval.declarator)->array, (yyvsp[(2) - (2)].expr)); ;}
     break;
 
-  case 269:
+  case 301:
 
 /* Line 1455 of yacc.c  */
-#line 898 "parser.y"
-    { (yyval.stgclass) = STG_EXTERN; ;}
+#line 972 "parser.y"
+    { (yyval.declarator) = make_declarator(NULL); (yyval.declarator)->array = append_array((yyval.declarator)->array, (yyvsp[(1) - (1)].expr)); ;}
     break;
 
-  case 270:
+  case 302:
 
 /* Line 1455 of yacc.c  */
-#line 899 "parser.y"
-    { (yyval.stgclass) = STG_STATIC; ;}
+#line 974 "parser.y"
+    { (yyval.declarator) = make_declarator(NULL);
+                                                 (yyval.declarator)->func_type = append_ptrchain_type((yyval.declarator)->type, type_new_function((yyvsp[(2) - (3)].var_list)));
+                                                 (yyval.declarator)->type = NULL;
+                                               ;}
     break;
 
-  case 271:
+  case 303:
 
 /* Line 1455 of yacc.c  */
-#line 900 "parser.y"
-    { (yyval.stgclass) = STG_REGISTER; ;}
+#line 979 "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 272:
+  case 304:
 
 /* Line 1455 of yacc.c  */
-#line 904 "parser.y"
-    { (yyval.attr) = make_attr(ATTR_INLINE); ;}
+#line 988 "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 273:
+  case 305:
 
 /* Line 1455 of yacc.c  */
-#line 908 "parser.y"
-    { (yyval.attr) = make_attr(ATTR_CONST); ;}
+#line 989 "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 274:
+  case 307:
 
 /* Line 1455 of yacc.c  */
-#line 911 "parser.y"
-    { (yyval.attr_list) = NULL; ;}
+#line 996 "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 275:
+  case 308:
 
 /* Line 1455 of yacc.c  */
-#line 912 "parser.y"
-    { (yyval.attr_list) = append_attr((yyvsp[(1) - (2)].attr_list), (yyvsp[(2) - (2)].attr)); ;}
+#line 997 "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 276:
+  case 309:
 
 /* Line 1455 of yacc.c  */
-#line 915 "parser.y"
-    { (yyval.declspec) = make_decl_spec((yyvsp[(1) - (2)].type), (yyvsp[(2) - (2)].declspec), NULL, NULL, STG_NONE); ;}
+#line 1001 "parser.y"
+    { (yyval.declarator) = make_declarator(NULL); ;}
     break;
 
-  case 277:
+  case 311:
 
 /* Line 1455 of yacc.c  */
-#line 917 "parser.y"
-    { (yyval.declspec) = make_decl_spec((yyvsp[(2) - (3)].type), (yyvsp[(1) - (3)].declspec), (yyvsp[(3) - (3)].declspec), NULL, STG_NONE); ;}
+#line 1009 "parser.y"
+    { (yyval.declarator) = make_declarator((yyvsp[(1) - (1)].var)); ;}
     break;
 
-  case 278:
+  case 312:
 
 /* Line 1455 of yacc.c  */
-#line 920 "parser.y"
-    { (yyval.declspec) = NULL; ;}
+#line 1010 "parser.y"
+    { (yyval.declarator) = (yyvsp[(2) - (3)].declarator); ;}
     break;
 
-  case 280:
+  case 313:
 
 /* 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); ;}
+#line 1011 "parser.y"
+    { (yyval.declarator) = (yyvsp[(1) - (2)].declarator); (yyval.declarator)->array = append_array((yyval.declarator)->array, (yyvsp[(2) - (2)].expr)); ;}
     break;
 
-  case 281:
+  case 314:
 
 /* Line 1455 of yacc.c  */
-#line 926 "parser.y"
-    { (yyval.declspec) = make_decl_spec(NULL, (yyvsp[(2) - (2)].declspec), NULL, (yyvsp[(1) - (2)].attr), STG_NONE); ;}
+#line 1012 "parser.y"
+    { (yyval.declarator) = make_declarator(NULL); (yyval.declarator)->array = append_array((yyval.declarator)->array, (yyvsp[(1) - (1)].expr)); ;}
     break;
 
-  case 282:
+  case 315:
 
 /* Line 1455 of yacc.c  */
-#line 927 "parser.y"
-    { (yyval.declspec) = make_decl_spec(NULL, (yyvsp[(2) - (2)].declspec), NULL, NULL, (yyvsp[(1) - (2)].stgclass)); ;}
+#line 1014 "parser.y"
+    { (yyval.declarator) = make_declarator(NULL);
+                                                 (yyval.declarator)->func_type = append_ptrchain_type((yyval.declarator)->type, type_new_function((yyvsp[(2) - (3)].var_list)));
+                                                 (yyval.declarator)->type = NULL;
+                                               ;}
     break;
 
-  case 283:
+  case 316:
 
 /* Line 1455 of yacc.c  */
-#line 932 "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))); ;}
+#line 1019 "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 284:
+  case 317:
 
 /* Line 1455 of yacc.c  */
-#line 933 "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))); ;}
+#line 1026 "parser.y"
+    { (yyval.declarator_list) = append_declarator( NULL, (yyvsp[(1) - (1)].declarator) ); ;}
     break;
 
-  case 286:
+  case 318:
 
 /* Line 1455 of yacc.c  */
-#line 938 "parser.y"
-    { (yyval.declarator) = make_declarator((yyvsp[(1) - (1)].var)); ;}
+#line 1027 "parser.y"
+    { (yyval.declarator_list) = append_declarator( (yyvsp[(1) - (3)].declarator_list), (yyvsp[(3) - (3)].declarator) ); ;}
     break;
 
-  case 287:
+  case 319:
 
 /* Line 1455 of yacc.c  */
-#line 939 "parser.y"
-    { (yyval.declarator) = (yyvsp[(2) - (3)].declarator); ;}
+#line 1030 "parser.y"
+    { (yyval.expr) = NULL; ;}
     break;
 
-  case 288:
+  case 320:
 
 /* Line 1455 of yacc.c  */
-#line 940 "parser.y"
-    { (yyval.declarator) = (yyvsp[(1) - (2)].declarator); (yyval.declarator)->array = append_array((yyval.declarator)->array, (yyvsp[(2) - (2)].expr)); ;}
+#line 1031 "parser.y"
+    { (yyval.expr) = (yyvsp[(2) - (2)].expr); ;}
     break;
 
-  case 289:
+  case 321:
 
 /* Line 1455 of yacc.c  */
-#line 941 "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;
+#line 1034 "parser.y"
+    { (yyval.declarator) = (yyvsp[(1) - (2)].declarator); (yyval.declarator)->bits = (yyvsp[(2) - (2)].expr);
+                                                 if (!(yyval.declarator)->bits && !(yyval.declarator)->var->name)
+                                                   error_loc("unnamed fields are not allowed");
                                                ;}
     break;
 
-  case 290:
+  case 322:
 
 /* Line 1455 of yacc.c  */
-#line 948 "parser.y"
+#line 1041 "parser.y"
     { (yyval.declarator_list) = append_declarator( NULL, (yyvsp[(1) - (1)].declarator) ); ;}
     break;
 
-  case 291:
+  case 323:
 
 /* Line 1455 of yacc.c  */
-#line 949 "parser.y"
+#line 1043 "parser.y"
     { (yyval.declarator_list) = append_declarator( (yyvsp[(1) - (3)].declarator_list), (yyvsp[(3) - (3)].declarator) ); ;}
     break;
 
-  case 292:
+  case 324:
 
 /* Line 1455 of yacc.c  */
-#line 953 "parser.y"
+#line 1047 "parser.y"
     { (yyval.declarator) = (yyvsp[(1) - (1)].declarator); ;}
     break;
 
-  case 293:
+  case 325:
 
 /* Line 1455 of yacc.c  */
-#line 954 "parser.y"
+#line 1048 "parser.y"
     { (yyval.declarator) = (yyvsp[(1) - (3)].declarator); (yyvsp[(1) - (3)].declarator)->var->eval = (yyvsp[(3) - (3)].expr); ;}
     break;
 
-  case 294:
+  case 326:
 
 /* Line 1455 of yacc.c  */
-#line 958 "parser.y"
+#line 1052 "parser.y"
     { (yyval.num) = RPC_FC_RP; ;}
     break;
 
-  case 295:
+  case 327:
 
 /* Line 1455 of yacc.c  */
-#line 959 "parser.y"
+#line 1053 "parser.y"
     { (yyval.num) = RPC_FC_UP; ;}
     break;
 
-  case 296:
+  case 328:
 
 /* Line 1455 of yacc.c  */
-#line 960 "parser.y"
+#line 1054 "parser.y"
     { (yyval.num) = RPC_FC_FP; ;}
     break;
 
-  case 297:
+  case 329:
 
 /* Line 1455 of yacc.c  */
-#line 963 "parser.y"
+#line 1057 "parser.y"
     { (yyval.type) = type_new_struct((yyvsp[(2) - (5)].str), TRUE, (yyvsp[(4) - (5)].var_list)); ;}
     break;
 
-  case 298:
+  case 330:
 
 /* Line 1455 of yacc.c  */
-#line 966 "parser.y"
+#line 1060 "parser.y"
     { (yyval.type) = type_new_void(); ;}
     break;
 
-  case 299:
+  case 331:
 
 /* Line 1455 of yacc.c  */
-#line 967 "parser.y"
+#line 1061 "parser.y"
     { (yyval.type) = find_type_or_error((yyvsp[(1) - (1)].str), 0); ;}
     break;
 
-  case 300:
+  case 332:
 
 /* Line 1455 of yacc.c  */
-#line 968 "parser.y"
+#line 1062 "parser.y"
     { (yyval.type) = (yyvsp[(1) - (1)].type); ;}
     break;
 
-  case 301:
+  case 333:
 
 /* Line 1455 of yacc.c  */
-#line 969 "parser.y"
+#line 1063 "parser.y"
     { (yyval.type) = (yyvsp[(1) - (1)].type); ;}
     break;
 
-  case 302:
+  case 334:
 
 /* Line 1455 of yacc.c  */
-#line 970 "parser.y"
+#line 1064 "parser.y"
     { (yyval.type) = type_new_enum((yyvsp[(2) - (2)].str), FALSE, NULL); ;}
     break;
 
-  case 303:
+  case 335:
 
 /* Line 1455 of yacc.c  */
-#line 971 "parser.y"
+#line 1065 "parser.y"
     { (yyval.type) = (yyvsp[(1) - (1)].type); ;}
     break;
 
-  case 304:
+  case 336:
 
 /* Line 1455 of yacc.c  */
-#line 972 "parser.y"
+#line 1066 "parser.y"
     { (yyval.type) = type_new_struct((yyvsp[(2) - (2)].str), FALSE, NULL); ;}
     break;
 
-  case 305:
+  case 337:
 
 /* Line 1455 of yacc.c  */
-#line 973 "parser.y"
+#line 1067 "parser.y"
     { (yyval.type) = (yyvsp[(1) - (1)].type); ;}
     break;
 
-  case 306:
+  case 338:
 
 /* Line 1455 of yacc.c  */
-#line 974 "parser.y"
+#line 1068 "parser.y"
     { (yyval.type) = type_new_nonencapsulated_union((yyvsp[(2) - (2)].str), FALSE, NULL); ;}
     break;
 
-  case 307:
+  case 339:
 
 /* Line 1455 of yacc.c  */
-#line 975 "parser.y"
+#line 1069 "parser.y"
     { (yyval.type) = make_safearray((yyvsp[(3) - (4)].type)); ;}
     break;
 
-  case 308:
+  case 340:
 
 /* Line 1455 of yacc.c  */
-#line 979 "parser.y"
+#line 1073 "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 309:
+  case 341:
 
 /* Line 1455 of yacc.c  */
-#line 985 "parser.y"
+#line 1079 "parser.y"
     { (yyval.type) = type_new_nonencapsulated_union((yyvsp[(2) - (5)].str), TRUE, (yyvsp[(4) - (5)].var_list)); ;}
     break;
 
-  case 310:
+  case 342:
 
 /* Line 1455 of yacc.c  */
-#line 988 "parser.y"
+#line 1082 "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 311:
+  case 343:
 
 /* Line 1455 of yacc.c  */
-#line 992 "parser.y"
+#line 1086 "parser.y"
     { (yyval.num) = MAKEVERSION((yyvsp[(1) - (1)].num), 0); ;}
     break;
 
-  case 312:
+  case 344:
 
 /* Line 1455 of yacc.c  */
-#line 993 "parser.y"
+#line 1087 "parser.y"
     { (yyval.num) = MAKEVERSION((yyvsp[(1) - (3)].num), (yyvsp[(3) - (3)].num)); ;}
     break;
 
 
 
 /* Line 1455 of yacc.c  */
-#line 4709 "parser.tab.c"
+#line 5043 "parser.tab.c"
       default: break;
     }
   YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
@@ -4917,7 +5251,7 @@ yyreturn:
 
 
 /* Line 1675 of yacc.c  */
-#line 996 "parser.y"
+#line 1090 "parser.y"
 
 
 static void decl_builtin_basic(const char *name, enum type_basic_type type)
@@ -5162,6 +5496,38 @@ static void type_function_add_head_arg(type_t *type, var_t *arg)
     list_add_head( type->details.function->args, &arg->entry );
 }
 
+static int is_allowed_range_type(const type_t *type)
+{
+    switch (type_get_type(type))
+    {
+    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_INT3264:
+        case TYPE_BASIC_BYTE:
+        case TYPE_BASIC_CHAR:
+        case TYPE_BASIC_WCHAR:
+        case TYPE_BASIC_HYPER:
+            return TRUE;
+        case TYPE_BASIC_FLOAT:
+        case TYPE_BASIC_DOUBLE:
+        case TYPE_BASIC_ERROR_STATUS_T:
+        case TYPE_BASIC_HANDLE:
+            return FALSE;
+        }
+        return FALSE;
+    default:
+        return FALSE;
+    }
+}
+
 static type_t *append_ptrchain_type(type_t *ptrchain, type_t *type)
 {
   type_t *ptrchain_type;
@@ -5174,11 +5540,12 @@ static type_t *append_ptrchain_type(type_t *ptrchain, type_t *type)
   return ptrchain;
 }
 
-static void set_type(var_t *v, decl_spec_t *decl_spec, const declarator_t *decl,
+static var_t *declare_var(attr_list_t *attrs, decl_spec_t *decl_spec, const declarator_t *decl,
                      int top)
 {
-  expr_list_t *sizes = get_attrp(v->attrs, ATTR_SIZEIS);
-  expr_list_t *lengs = get_attrp(v->attrs, ATTR_LENGTHIS);
+  var_t *v = decl->var;
+  expr_list_t *sizes = get_attrp(attrs, ATTR_SIZEIS);
+  expr_list_t *lengs = get_attrp(attrs, ATTR_LENGTHIS);
   int sizeless;
   expr_t *dim;
   type_t **ptype;
@@ -5203,6 +5570,7 @@ static void set_type(var_t *v, decl_spec_t *decl_spec, const declarator_t *decl,
   /* add type onto the end of the pointers in pident->type */
   v->type = append_ptrchain_type(decl ? decl->type : NULL, type);
   v->stgclass = decl_spec->stgclass;
+  v->attrs = attrs;
 
   /* check for pointer attribute being applied to non-pointer, non-array
    * type */
@@ -5241,16 +5609,37 @@ static void set_type(var_t *v, decl_spec_t *decl_spec, const declarator_t *decl,
        error_loc("%s: pointer attribute applied to non-pointer type\n", v->name);
   }
 
-  if (is_attr(v->attrs, ATTR_STRING) && !is_ptr(v->type) && !arr)
+  if (is_attr(v->attrs, ATTR_STRING))
+  {
+    type_t *t = type;
+
+    if (!is_ptr(v->type) && !arr)
     error_loc("'%s': [string] attribute applied to non-pointer, non-array type\n",
               v->name);
 
+    while (is_ptr(t))
+      t = type_pointer_get_ref(t);
+
+    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))
+    {
+      error_loc("'%s': [string] attribute is only valid on 'char', 'byte', or 'wchar_t' pointers and arrays\n",
+                v->name);
+    }
+  }
+
   if (is_attr(v->attrs, ATTR_V1ENUM))
   {
     if (type_get_type_detect_alias(v->type) != TYPE_ENUM)
       error_loc("'%s': [v1_enum] attribute applied to non-enum type\n", v->name);
   }
 
+  if (is_attr(v->attrs, ATTR_RANGE) && !is_allowed_range_type(v->type))
+    error_loc("'%s': [range] attribute applied to non-integer type\n",
+              v->name);
+
   ptype = &v->type;
   sizeless = FALSE;
   if (arr) LIST_FOR_EACH_ENTRY_REV(dim, arr, expr_t, entry)
@@ -5367,6 +5756,11 @@ static void set_type(var_t *v, decl_spec_t *decl_spec, const declarator_t *decl,
       if (is_attr(t->attrs, ATTR_CALLCONV))
         error_loc("calling convention applied to non-function-pointer type\n");
   }
+
+  if (decl->bits)
+    v->type = type_new_bitfield(v->type, decl->bits);
+
+  return v;
 }
 
 static var_list_t *set_var_types(attr_list_t *attrs, decl_spec_t *decl_spec, declarator_list_t *decls)
@@ -5376,13 +5770,11 @@ static var_list_t *set_var_types(attr_list_t *attrs, decl_spec_t *decl_spec, dec
 
   LIST_FOR_EACH_ENTRY_SAFE( decl, next, decls, declarator_t, entry )
   {
-    var_t *var = decl->var;
-
-    var->attrs = attrs;
-    set_type(var, decl_spec, decl, 0);
+    var_t *var = declare_var(attrs, decl_spec, decl, 0);
     var_list = append_var(var_list, var);
     free(decl);
   }
+  free(decl_spec);
   return var_list;
 }
 
@@ -5456,10 +5848,11 @@ static declarator_list_t *append_declarator(declarator_list_t *list, declarator_
 static declarator_t *make_declarator(var_t *var)
 {
   declarator_t *d = xmalloc(sizeof(*d));
-  d->var = var;
+  d->var = var ? var : make_var(NULL);
   d->type = NULL;
   d->func_type = NULL;
   d->array = NULL;
+  d->bits = NULL;
   return d;
 }
 
@@ -5600,27 +5993,8 @@ static void fix_incomplete_types(type_t *complete_type)
 static type_t *reg_typedefs(decl_spec_t *decl_spec, declarator_list_t *decls, attr_list_t *attrs)
 {
   const declarator_t *decl;
-  int is_str = is_attr(attrs, ATTR_STRING);
   type_t *type = decl_spec->type;
 
-  if (is_str)
-  {
-    type_t *t = decl_spec->type;
-
-    while (is_ptr(t))
-      t = type_pointer_get_ref(t);
-
-    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",
-              decl->var->name);
-    }
-  }
-
   /* 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.  */
@@ -5639,20 +6013,18 @@ static type_t *reg_typedefs(decl_spec_t *decl_spec, declarator_list_t *decls, at
 
   LIST_FOR_EACH_ENTRY( decl, decls, const declarator_t, entry )
   {
-    var_t *name = decl->var;
 
-    if (name->name) {
+    if (decl->var->name) {
       type_t *cur;
+      var_t *name;
 
-      cur = find_type(name->name, 0);
+      cur = find_type(decl->var->name, 0);
       if (cur)
           error_loc("%s: redefinition error; original definition was at %s:%d\n",
                     cur->name, cur->loc_info.input_name,
                     cur->loc_info.line_number);
 
-      /* set the attributes to allow set_type to do some checks on them */
-      name->attrs = attrs;
-      set_type(name, decl_spec, decl, 0);
+      name = declare_var(attrs, decl_spec, decl, 0);
       cur = type_new_alias(name->type, name->name);
       cur->attrs = attrs;
 
@@ -5797,6 +6169,7 @@ struct allowed_attr allowed_attr[] =
 {
     /* attr                        { D ACF I Fn ARG T En St Un Fi  L  DI M  C  <display name> } */
     /* ATTR_AGGREGATABLE */        { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, "aggregatable" },
+    /* ATTR_ANNOTATION */          { 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, "annotation" },
     /* ATTR_APPOBJECT */           { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, "appobject" },
     /* ATTR_ASYNC */               { 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "async" },
     /* ATTR_AUTO_HANDLE */         { 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "auto_handle" },
@@ -5902,14 +6275,10 @@ static attr_list_t *check_function_attrs(const char *name, attr_list_t *attrs)
   return attrs;
 }
 
-static void check_arg(var_t *arg)
+static void check_arg_attrs(const var_t *arg)
 {
-  const type_t *t = arg->type;
   const attr_t *attr;
 
-  if (type_get_type(t) == TYPE_VOID)
-    error_loc("argument '%s' has void type\n", arg->name);
-
   if (arg->attrs)
   {
     LIST_FOR_EACH_ENTRY(attr, arg->attrs, const attr_t, entry)
@@ -6075,6 +6444,7 @@ static int is_allowed_conf_type(const type_t *type)
     case TYPE_COCLASS:
     case TYPE_FUNCTION:
     case TYPE_INTERFACE:
+    case TYPE_BITFIELD:
         return FALSE;
     }
     return FALSE;
@@ -6118,24 +6488,30 @@ static void check_field_common(const type_t *container_type,
 {
     type_t *type = arg->type;
     int more_to_do;
-    const char *container_type_name = NULL;
+    const char *container_type_name;
+    const char *var_type;
 
-    switch (type_get_type_detect_alias(type))
+    switch (type_get_type(container_type))
     {
     case TYPE_STRUCT:
         container_type_name = "struct";
+        var_type = "field";
         break;
     case TYPE_UNION:
         container_type_name = "union";
+        var_type = "arm";
         break;
     case TYPE_ENCAPSULATED_UNION:
         container_type_name = "encapsulated union";
+        var_type = "arm";
         break;
     case TYPE_FUNCTION:
         container_type_name = "function";
+        var_type = "parameter";
         break;
     default:
-        break;
+        /* should be no other container types */
+        assert(0);
     }
 
     if (is_attr(arg->attrs, ATTR_LENGTHIS) &&
@@ -6195,28 +6571,48 @@ static void check_field_common(const type_t *container_type,
             check_remoting_fields(arg, type);
             break;
         case TGT_INVALID:
+        {
+            const char *reason = "is 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);
+                reason = "cannot derive from void *";
                 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);
+                reason = "cannot be a function pointer";
+                break;
+            case TYPE_BITFIELD:
+                reason = "cannot be a bit-field";
                 break;
             case TYPE_COCLASS:
+                reason = "cannot be a class";
+                break;
             case TYPE_INTERFACE:
+                reason = "cannot be a non-pointer to an interface";
+                break;
             case TYPE_MODULE:
-                /* FIXME */
+                reason = "cannot be a module";
                 break;
             default:
                 break;
             }
+            error_loc_info(&arg->loc_info, "%s \'%s\' of %s \'%s\' %s\n",
+                           var_type, arg->name, container_type_name, container_name, reason);
+            break;
+        }
         case TGT_CTXT_HANDLE:
         case TGT_CTXT_HANDLE_POINTER:
             /* FIXME */
             break;
+        case TGT_STRING:
+        {
+            const type_t *t = type;
+            while (is_ptr(t))
+                t = type_pointer_get_ref(t);
+            if (is_aliaschain_attr(t, ATTR_RANGE))
+                warning_loc_info(&arg->loc_info, "%s: range not verified for a string of ranged types\n", arg->name);
+            break;
+        }
         case TGT_POINTER:
             type = type_pointer_get_ref(type);
             more_to_do = TRUE;
@@ -6226,10 +6622,10 @@ static void check_field_common(const type_t *container_type,
             more_to_do = TRUE;
             break;
         case TGT_USER_TYPE:
-        case TGT_STRING:
         case TGT_IFACE_POINTER:
         case TGT_BASIC:
         case TGT_ENUM:
+        case TGT_RANGE:
             /* nothing to do */
             break;
         }
@@ -6279,6 +6675,7 @@ static void check_remoting_args(const var_t *func)
             {
             case TGT_BASIC:
             case TGT_ENUM:
+            case TGT_RANGE:
             case TGT_STRUCT:
             case TGT_UNION:
             case TGT_CTXT_HANDLE:
@@ -6306,6 +6703,16 @@ static void check_remoting_args(const var_t *func)
 
         check_field_common(func->type, funcname, arg);
     }
+
+    if (type_get_type(type_function_get_rettype(func->type)) != TYPE_VOID)
+    {
+        var_t var;
+        var = *func;
+        var.type = type_function_get_rettype(func->type);
+        var.name = xstrdup("return value");
+        check_field_common(func->type, funcname, &var);
+        free(var.name);
+}
 }
 
 static void add_explicit_handle_if_necessary(var_t *func)
index f1d7480..73f6993 100644 (file)
      LESSEQUAL = 273,
      LOGICALOR = 274,
      LOGICALAND = 275,
-     tAGGREGATABLE = 276,
-     tALLOCATE = 277,
-     tAPPOBJECT = 278,
-     tASYNC = 279,
-     tASYNCUUID = 280,
-     tAUTOHANDLE = 281,
-     tBINDABLE = 282,
-     tBOOLEAN = 283,
-     tBROADCAST = 284,
-     tBYTE = 285,
-     tBYTECOUNT = 286,
-     tCALLAS = 287,
-     tCALLBACK = 288,
-     tCASE = 289,
-     tCDECL = 290,
-     tCHAR = 291,
-     tCOCLASS = 292,
-     tCODE = 293,
-     tCOMMSTATUS = 294,
-     tCONST = 295,
-     tCONTEXTHANDLE = 296,
-     tCONTEXTHANDLENOSERIALIZE = 297,
-     tCONTEXTHANDLESERIALIZE = 298,
-     tCONTROL = 299,
-     tCPPQUOTE = 300,
-     tDEFAULT = 301,
-     tDEFAULTCOLLELEM = 302,
-     tDEFAULTVALUE = 303,
-     tDEFAULTVTABLE = 304,
-     tDISPLAYBIND = 305,
-     tDISPINTERFACE = 306,
-     tDLLNAME = 307,
-     tDOUBLE = 308,
-     tDUAL = 309,
-     tENDPOINT = 310,
-     tENTRY = 311,
-     tENUM = 312,
-     tERRORSTATUST = 313,
-     tEXPLICITHANDLE = 314,
-     tEXTERN = 315,
-     tFALSE = 316,
-     tFASTCALL = 317,
-     tFLOAT = 318,
-     tHANDLE = 319,
-     tHANDLET = 320,
-     tHELPCONTEXT = 321,
-     tHELPFILE = 322,
-     tHELPSTRING = 323,
-     tHELPSTRINGCONTEXT = 324,
-     tHELPSTRINGDLL = 325,
-     tHIDDEN = 326,
-     tHYPER = 327,
-     tID = 328,
-     tIDEMPOTENT = 329,
-     tIIDIS = 330,
-     tIMMEDIATEBIND = 331,
-     tIMPLICITHANDLE = 332,
-     tIMPORT = 333,
-     tIMPORTLIB = 334,
-     tIN = 335,
-     tIN_LINE = 336,
-     tINLINE = 337,
-     tINPUTSYNC = 338,
-     tINT = 339,
-     tINT64 = 340,
-     tINTERFACE = 341,
-     tLCID = 342,
-     tLENGTHIS = 343,
-     tLIBRARY = 344,
-     tLOCAL = 345,
-     tLONG = 346,
-     tMETHODS = 347,
-     tMODULE = 348,
-     tNONBROWSABLE = 349,
-     tNONCREATABLE = 350,
-     tNONEXTENSIBLE = 351,
-     tNULL = 352,
-     tOBJECT = 353,
-     tODL = 354,
-     tOLEAUTOMATION = 355,
-     tOPTIONAL = 356,
-     tOUT = 357,
-     tPASCAL = 358,
-     tPOINTERDEFAULT = 359,
-     tPROPERTIES = 360,
-     tPROPGET = 361,
-     tPROPPUT = 362,
-     tPROPPUTREF = 363,
-     tPTR = 364,
-     tPUBLIC = 365,
-     tRANGE = 366,
-     tREADONLY = 367,
-     tREF = 368,
-     tREGISTER = 369,
-     tREQUESTEDIT = 370,
-     tRESTRICTED = 371,
-     tRETVAL = 372,
-     tSAFEARRAY = 373,
-     tSHORT = 374,
-     tSIGNED = 375,
-     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
+     ELLIPSIS = 276,
+     tAGGREGATABLE = 277,
+     tALLOCATE = 278,
+     tANNOTATION = 279,
+     tAPPOBJECT = 280,
+     tASYNC = 281,
+     tASYNCUUID = 282,
+     tAUTOHANDLE = 283,
+     tBINDABLE = 284,
+     tBOOLEAN = 285,
+     tBROADCAST = 286,
+     tBYTE = 287,
+     tBYTECOUNT = 288,
+     tCALLAS = 289,
+     tCALLBACK = 290,
+     tCASE = 291,
+     tCDECL = 292,
+     tCHAR = 293,
+     tCOCLASS = 294,
+     tCODE = 295,
+     tCOMMSTATUS = 296,
+     tCONST = 297,
+     tCONTEXTHANDLE = 298,
+     tCONTEXTHANDLENOSERIALIZE = 299,
+     tCONTEXTHANDLESERIALIZE = 300,
+     tCONTROL = 301,
+     tCPPQUOTE = 302,
+     tDEFAULT = 303,
+     tDEFAULTCOLLELEM = 304,
+     tDEFAULTVALUE = 305,
+     tDEFAULTVTABLE = 306,
+     tDISPLAYBIND = 307,
+     tDISPINTERFACE = 308,
+     tDLLNAME = 309,
+     tDOUBLE = 310,
+     tDUAL = 311,
+     tENDPOINT = 312,
+     tENTRY = 313,
+     tENUM = 314,
+     tERRORSTATUST = 315,
+     tEXPLICITHANDLE = 316,
+     tEXTERN = 317,
+     tFALSE = 318,
+     tFASTCALL = 319,
+     tFLOAT = 320,
+     tHANDLE = 321,
+     tHANDLET = 322,
+     tHELPCONTEXT = 323,
+     tHELPFILE = 324,
+     tHELPSTRING = 325,
+     tHELPSTRINGCONTEXT = 326,
+     tHELPSTRINGDLL = 327,
+     tHIDDEN = 328,
+     tHYPER = 329,
+     tID = 330,
+     tIDEMPOTENT = 331,
+     tIIDIS = 332,
+     tIMMEDIATEBIND = 333,
+     tIMPLICITHANDLE = 334,
+     tIMPORT = 335,
+     tIMPORTLIB = 336,
+     tIN = 337,
+     tIN_LINE = 338,
+     tINLINE = 339,
+     tINPUTSYNC = 340,
+     tINT = 341,
+     tINT3264 = 342,
+     tINT64 = 343,
+     tINTERFACE = 344,
+     tLCID = 345,
+     tLENGTHIS = 346,
+     tLIBRARY = 347,
+     tLOCAL = 348,
+     tLONG = 349,
+     tMETHODS = 350,
+     tMODULE = 351,
+     tNONBROWSABLE = 352,
+     tNONCREATABLE = 353,
+     tNONEXTENSIBLE = 354,
+     tNULL = 355,
+     tOBJECT = 356,
+     tODL = 357,
+     tOLEAUTOMATION = 358,
+     tOPTIONAL = 359,
+     tOUT = 360,
+     tPASCAL = 361,
+     tPOINTERDEFAULT = 362,
+     tPROPERTIES = 363,
+     tPROPGET = 364,
+     tPROPPUT = 365,
+     tPROPPUTREF = 366,
+     tPTR = 367,
+     tPUBLIC = 368,
+     tRANGE = 369,
+     tREADONLY = 370,
+     tREF = 371,
+     tREGISTER = 372,
+     tREQUESTEDIT = 373,
+     tRESTRICTED = 374,
+     tRETVAL = 375,
+     tSAFEARRAY = 376,
+     tSHORT = 377,
+     tSIGNED = 378,
+     tSIZEIS = 379,
+     tSIZEOF = 380,
+     tSMALL = 381,
+     tSOURCE = 382,
+     tSTATIC = 383,
+     tSTDCALL = 384,
+     tSTRICTCONTEXTHANDLE = 385,
+     tSTRING = 386,
+     tSTRUCT = 387,
+     tSWITCH = 388,
+     tSWITCHIS = 389,
+     tSWITCHTYPE = 390,
+     tTRANSMITAS = 391,
+     tTRUE = 392,
+     tTYPEDEF = 393,
+     tUNION = 394,
+     tUNIQUE = 395,
+     tUNSIGNED = 396,
+     tUUID = 397,
+     tV1ENUM = 398,
+     tVARARG = 399,
+     tVERSION = 400,
+     tVOID = 401,
+     tWCHAR = 402,
+     tWIREMARSHAL = 403,
+     ADDRESSOF = 404,
+     NEG = 405,
+     POS = 406,
+     PPTR = 407,
+     CAST = 408
    };
 #endif
 
@@ -229,7 +232,7 @@ typedef union YYSTYPE
 
 
 /* Line 1676 of yacc.c  */
-#line 233 "parser.tab.h"
+#line 236 "parser.tab.h"
 } YYSTYPE;
 # define YYSTYPE_IS_TRIVIAL 1
 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
index c2f1abc..f18c10f 100644 (file)
@@ -101,7 +101,7 @@ 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_t *declare_var(attr_list_t *attrs, 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);
@@ -121,7 +121,7 @@ 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_arg_attrs(const 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);
@@ -194,7 +194,8 @@ static statement_list_t *append_statement(statement_list_t *list, statement_t *s
 %token EQUALITY INEQUALITY
 %token GREATEREQUAL LESSEQUAL
 %token LOGICALOR LOGICALAND
-%token tAGGREGATABLE tALLOCATE tAPPOBJECT tASYNC tASYNCUUID
+%token ELLIPSIS
+%token tAGGREGATABLE tALLOCATE tANNOTATION tAPPOBJECT tASYNC tASYNCUUID
 %token tAUTOHANDLE tBINDABLE tBOOLEAN tBROADCAST tBYTE tBYTECOUNT
 %token tCALLAS tCALLBACK tCASE tCDECL tCHAR tCOCLASS tCODE tCOMMSTATUS
 %token tCONST tCONTEXTHANDLE tCONTEXTHANDLENOSERIALIZE
@@ -224,7 +225,7 @@ static statement_list_t *append_statement(statement_list_t *list, statement_t *s
 %token tIMPORT tIMPORTLIB
 %token tIN tIN_LINE tINLINE
 %token tINPUTSYNC
-%token tINT tINT64
+%token tINT tINT3264 tINT64
 %token tINTERFACE
 %token tLCID
 %token tLENGTHIS tLIBRARY
@@ -278,7 +279,7 @@ static statement_list_t *append_statement(statement_list_t *list, statement_t *s
 %type <attr> attribute type_qualifier function_specifier
 %type <attr_list> m_attributes attributes attrib_list m_type_qual_list
 %type <str_list> str_list
-%type <expr> m_expr expr expr_const expr_int_const array
+%type <expr> m_expr expr expr_const expr_int_const array m_bitfield
 %type <expr_list> m_exprs /* exprs expr_list */ expr_list_int_const
 %type <ifinfo> interfacehdr
 %type <stgclass> storage_cls_spec
@@ -292,10 +293,13 @@ static statement_list_t *append_statement(statement_list_t *list, statement_t *s
 %type <ifref> coclass_int
 %type <ifref_list> coclass_ints
 %type <var> arg ne_union_field union_field s_field case enum declaration
-%type <var_list> m_args no_args args fields ne_union_fields cases enums enum_list dispint_props field
+%type <var_list> m_args arg_list args
+%type <var_list> fields ne_union_fields cases enums enum_list dispint_props field
 %type <var> m_ident ident
-%type <declarator> declarator direct_declarator init_declarator
-%type <declarator_list> declarator_list
+%type <declarator> declarator direct_declarator init_declarator struct_declarator
+%type <declarator> m_any_declarator any_declarator any_declarator_no_direct any_direct_declarator
+%type <declarator> m_abstract_declarator abstract_declarator abstract_declarator_no_direct abstract_direct_declarator
+%type <declarator_list> declarator_list struct_declarator_list
 %type <func> funcdef
 %type <type> coclass coclasshdr coclassdef
 %type <num> pointer_type version
@@ -425,27 +429,24 @@ m_args:                                           { $$ = NULL; }
        | args
        ;
 
-no_args:  tVOID                                        { $$ = NULL; }
+arg_list: arg                                  { check_arg_attrs($1); $$ = append_var( NULL, $1 ); }
+       | arg_list ',' arg                      { check_arg_attrs($3); $$ = append_var( $1, $3 ); }
        ;
 
-args:    arg                                   { check_arg($1); $$ = append_var( NULL, $1 ); }
-       | args ',' arg                          { check_arg($3); $$ = append_var( $1, $3); }
-       | no_args
+args:    arg_list
+       | arg_list ',' ELLIPSIS                 { $$ = append_var( $1, make_var(strdup("...")) ); }
        ;
 
 /* split into two rules to get bison to resolve a tVOID conflict */
-arg:     attributes decl_spec declarator       { $$ = $3->var;
-                                                 $$->attrs = $1;
-                                                 if ($2->stgclass != STG_NONE && $2->stgclass != STG_REGISTER)
+arg:     attributes decl_spec m_any_declarator { if ($2->stgclass != STG_NONE && $2->stgclass != STG_REGISTER)
                                                    error_loc("invalid storage class for function parameter\n");
-                                                 set_type($$, $2, $3, TRUE);
-                                                 free($3);
+                                                 $$ = declare_var($1, $2, $3, TRUE);
+                                                 free($2); free($3);
                                                }
-       | decl_spec declarator                  { $$ = $2->var;
-                                                 if ($1->stgclass != STG_NONE && $1->stgclass != STG_REGISTER)
+       | decl_spec m_any_declarator            { if ($1->stgclass != STG_NONE && $1->stgclass != STG_REGISTER)
                                                    error_loc("invalid storage class for function parameter\n");
-                                                 set_type($$, $1, $2, TRUE);
-                                                 free($2);
+                                                 $$ = declare_var(NULL, $1, $2, TRUE);
+                                                 free($1); free($2);
                                                }
        ;
 
@@ -472,6 +473,7 @@ str_list: aSTRING                               { $$ = append_str( NULL, $1 ); }
 
 attribute:                                     { $$ = NULL; }
        | tAGGREGATABLE                         { $$ = make_attr(ATTR_AGGREGATABLE); }
+       | tANNOTATION '(' aSTRING ')'           { $$ = make_attrp(ATTR_ANNOTATION, $3); }
        | tAPPOBJECT                            { $$ = make_attr(ATTR_APPOBJECT); }
        | tASYNC                                { $$ = make_attr(ATTR_ASYNC); }
        | tAUTOHANDLE                           { $$ = make_attr(ATTR_AUTO_HANDLE); }
@@ -658,8 +660,10 @@ expr:        aNUM                                  { $$ = make_exprl(EXPR_NUM, $1); }
        | '*' expr %prec PPTR                   { $$ = make_expr1(EXPR_PPTR, $2); }
        | expr MEMBERPTR aIDENTIFIER            { $$ = make_expr2(EXPR_MEMBER, make_expr1(EXPR_PPTR, $1), make_exprs(EXPR_IDENTIFIER, $3)); }
        | expr '.' aIDENTIFIER                  { $$ = make_expr2(EXPR_MEMBER, $1, make_exprs(EXPR_IDENTIFIER, $3)); }
-       | '(' type ')' expr %prec CAST          { $$ = make_exprt(EXPR_CAST, $2, $4); }
-       | tSIZEOF '(' type ')'                  { $$ = make_exprt(EXPR_SIZEOF, $3, NULL); }
+       | '(' decl_spec m_abstract_declarator ')' expr %prec CAST
+                                               { $$ = make_exprt(EXPR_CAST, declare_var(NULL, $2, $3, 0), $5); free($2); free($3); }
+       | tSIZEOF '(' decl_spec m_abstract_declarator ')'
+                                               { $$ = make_exprt(EXPR_SIZEOF, declare_var(NULL, $3, $4, 0), NULL); free($3); free($4); }
        | expr '[' expr ']'                     { $$ = make_expr2(EXPR_ARRAY, $1, $3); }
        | '(' expr ')'                          { $$ = $2; }
        ;
@@ -684,7 +688,7 @@ fields:                                             { $$ = NULL; }
        | fields field                          { $$ = append_var_list($1, $2); }
        ;
 
-field:   m_attributes decl_spec declarator_list ';'
+field:   m_attributes decl_spec struct_declarator_list ';'
                                                { const char *first = LIST_ENTRY(list_head($3), declarator_t, entry)->var->name;
                                                  check_field_attrs(first, $1);
                                                  $$ = set_var_types($1, $2, $3);
@@ -709,17 +713,16 @@ union_field:
        | ';'                                   { $$ = NULL; }
         ;
 
-s_field:  m_attributes decl_spec declarator    { $$ = $3->var;
-                                                 $$->attrs = check_field_attrs($$->name, $1);
-                                                 set_type($$, $2, $3, FALSE);
+s_field:  m_attributes decl_spec declarator    { $$ = declare_var(check_field_attrs($3->var->name, $1),
+                                                               $2, $3, FALSE);
                                                  free($3);
                                                }
        ;
 
 funcdef:
-         m_attributes decl_spec declarator     { var_t *v = $3->var;
-                                                 v->attrs = check_function_attrs(v->name, $1);
-                                                 set_type(v, $2, $3, FALSE);
+         m_attributes decl_spec declarator     { var_t *v;
+                                                 v = declare_var(check_function_attrs($3->var->name, $1),
+                                                              $2, $3, FALSE);
                                                  free($3);
                                                  $$ = make_func(v);
                                                }
@@ -727,13 +730,10 @@ funcdef:
 
 declaration:
          attributes decl_spec init_declarator
-                                               { $$ = $3->var;
-                                                 $$->attrs = $1;
-                                                 set_type($$, $2, $3, FALSE);
+                                               { $$ = declare_var($1, $2, $3, FALSE);
                                                  free($3);
                                                }
-       | decl_spec init_declarator             { $$ = $2->var;
-                                                 set_type($$, $1, $2, FALSE);
+       | decl_spec init_declarator             { $$ = declare_var(NULL, $1, $2, FALSE);
                                                  free($2);
                                                }
        ;
@@ -776,6 +776,7 @@ int_std:  tINT                                      { $$ = type_new_int(TYPE_BASIC_INT, 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); }
+       | tINT3264                              { $$ = type_new_int(TYPE_BASIC_INT3264, 0); }
        ;
 
 coclass:  tCOCLASS aIDENTIFIER                 { $$ = type_new_coclass($2); }
@@ -944,11 +945,104 @@ direct_declarator:
                                                }
        ;
 
+/* abstract declarator */
+abstract_declarator:
+         '*' m_type_qual_list m_abstract_declarator %prec PPTR
+                                               { $$ = $3; $$->type = append_ptrchain_type($$->type, type_new_pointer(pointer_default, NULL, $2)); }
+       | callconv m_abstract_declarator        { $$ = $2; $$->type->attrs = append_attr($$->type->attrs, make_attrp(ATTR_CALLCONV, $1)); }
+       | abstract_direct_declarator
+       ;
+
+/* abstract declarator without accepting direct declarator */
+abstract_declarator_no_direct:
+         '*' m_type_qual_list m_any_declarator %prec PPTR
+                                               { $$ = $3; $$->type = append_ptrchain_type($$->type, type_new_pointer(pointer_default, NULL, $2)); }
+       | callconv m_any_declarator             { $$ = $2; $$->type->attrs = append_attr($$->type->attrs, make_attrp(ATTR_CALLCONV, $1)); }
+       ;
+
+/* abstract declarator or empty */
+m_abstract_declarator:                                 { $$ = make_declarator(NULL); }
+       | abstract_declarator
+       ;
+
+/* abstract direct declarator */
+abstract_direct_declarator:
+         '(' abstract_declarator_no_direct ')' { $$ = $2; }
+       | abstract_direct_declarator array      { $$ = $1; $$->array = append_array($$->array, $2); }
+       | array                                 { $$ = make_declarator(NULL); $$->array = append_array($$->array, $1); }
+       | '(' m_args ')'
+                                               { $$ = make_declarator(NULL);
+                                                 $$->func_type = append_ptrchain_type($$->type, type_new_function($2));
+                                                 $$->type = NULL;
+                                               }
+       | abstract_direct_declarator '(' m_args ')'
+                                               { $$ = $1;
+                                                 $$->func_type = append_ptrchain_type($$->type, type_new_function($3));
+                                                 $$->type = NULL;
+                                               }
+       ;
+
+/* abstract or non-abstract declarator */
+any_declarator:
+         '*' m_type_qual_list m_any_declarator %prec PPTR
+                                               { $$ = $3; $$->type = append_ptrchain_type($$->type, type_new_pointer(pointer_default, NULL, $2)); }
+       | callconv m_any_declarator             { $$ = $2; $$->type->attrs = append_attr($$->type->attrs, make_attrp(ATTR_CALLCONV, $1)); }
+       | any_direct_declarator
+       ;
+
+/* abstract or non-abstract declarator without accepting direct declarator */
+any_declarator_no_direct:
+         '*' m_type_qual_list m_any_declarator %prec PPTR
+                                               { $$ = $3; $$->type = append_ptrchain_type($$->type, type_new_pointer(pointer_default, NULL, $2)); }
+       | callconv m_any_declarator             { $$ = $2; $$->type->attrs = append_attr($$->type->attrs, make_attrp(ATTR_CALLCONV, $1)); }
+       ;
+
+/* abstract or non-abstract declarator or empty */
+m_any_declarator:                              { $$ = make_declarator(NULL); }
+       | any_declarator
+       ;
+
+/* abstract or non-abstract direct declarator. note: direct declarators
+ * aren't accepted inside brackets to avoid ambiguity with the rule for
+ * function arguments */
+any_direct_declarator:
+         ident                                 { $$ = make_declarator($1); }
+       | '(' any_declarator_no_direct ')'      { $$ = $2; }
+       | any_direct_declarator array           { $$ = $1; $$->array = append_array($$->array, $2); }
+       | array                                 { $$ = make_declarator(NULL); $$->array = append_array($$->array, $1); }
+       | '(' m_args ')'
+                                               { $$ = make_declarator(NULL);
+                                                 $$->func_type = append_ptrchain_type($$->type, type_new_function($2));
+                                                 $$->type = NULL;
+                                               }
+       | any_direct_declarator '(' m_args ')'
+                                               { $$ = $1;
+                                                 $$->func_type = append_ptrchain_type($$->type, type_new_function($3));
+                                                 $$->type = NULL;
+                                               }
+       ;
+
 declarator_list:
          declarator                            { $$ = append_declarator( NULL, $1 ); }
        | declarator_list ',' declarator        { $$ = append_declarator( $1, $3 ); }
        ;
 
+m_bitfield:                                    { $$ = NULL; }
+       | ':' expr_const                        { $$ = $2; }
+       ;
+
+struct_declarator: any_declarator m_bitfield   { $$ = $1; $$->bits = $2;
+                                                 if (!$$->bits && !$$->var->name)
+                                                   error_loc("unnamed fields are not allowed");
+                                               }
+       ;
+
+struct_declarator_list:
+         struct_declarator                     { $$ = append_declarator( NULL, $1 ); }
+       | struct_declarator_list ',' struct_declarator
+                                               { $$ = append_declarator( $1, $3 ); }
+       ;
+
 init_declarator:
          declarator                            { $$ = $1; }
        | declarator '=' expr_const             { $$ = $1; $1->var->eval = $3; }
@@ -1237,6 +1331,38 @@ static void type_function_add_head_arg(type_t *type, var_t *arg)
     list_add_head( type->details.function->args, &arg->entry );
 }
 
+static int is_allowed_range_type(const type_t *type)
+{
+    switch (type_get_type(type))
+    {
+    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_INT3264:
+        case TYPE_BASIC_BYTE:
+        case TYPE_BASIC_CHAR:
+        case TYPE_BASIC_WCHAR:
+        case TYPE_BASIC_HYPER:
+            return TRUE;
+        case TYPE_BASIC_FLOAT:
+        case TYPE_BASIC_DOUBLE:
+        case TYPE_BASIC_ERROR_STATUS_T:
+        case TYPE_BASIC_HANDLE:
+            return FALSE;
+        }
+        return FALSE;
+    default:
+        return FALSE;
+    }
+}
+
 static type_t *append_ptrchain_type(type_t *ptrchain, type_t *type)
 {
   type_t *ptrchain_type;
@@ -1249,11 +1375,12 @@ static type_t *append_ptrchain_type(type_t *ptrchain, type_t *type)
   return ptrchain;
 }
 
-static void set_type(var_t *v, decl_spec_t *decl_spec, const declarator_t *decl,
+static var_t *declare_var(attr_list_t *attrs, decl_spec_t *decl_spec, const declarator_t *decl,
                      int top)
 {
-  expr_list_t *sizes = get_attrp(v->attrs, ATTR_SIZEIS);
-  expr_list_t *lengs = get_attrp(v->attrs, ATTR_LENGTHIS);
+  var_t *v = decl->var;
+  expr_list_t *sizes = get_attrp(attrs, ATTR_SIZEIS);
+  expr_list_t *lengs = get_attrp(attrs, ATTR_LENGTHIS);
   int sizeless;
   expr_t *dim;
   type_t **ptype;
@@ -1278,6 +1405,7 @@ static void set_type(var_t *v, decl_spec_t *decl_spec, const declarator_t *decl,
   /* add type onto the end of the pointers in pident->type */
   v->type = append_ptrchain_type(decl ? decl->type : NULL, type);
   v->stgclass = decl_spec->stgclass;
+  v->attrs = attrs;
 
   /* check for pointer attribute being applied to non-pointer, non-array
    * type */
@@ -1316,16 +1444,37 @@ static void set_type(var_t *v, decl_spec_t *decl_spec, const declarator_t *decl,
        error_loc("%s: pointer attribute applied to non-pointer type\n", v->name);
   }
 
-  if (is_attr(v->attrs, ATTR_STRING) && !is_ptr(v->type) && !arr)
+  if (is_attr(v->attrs, ATTR_STRING))
+  {
+    type_t *t = type;
+
+    if (!is_ptr(v->type) && !arr)
     error_loc("'%s': [string] attribute applied to non-pointer, non-array type\n",
               v->name);
 
+    while (is_ptr(t))
+      t = type_pointer_get_ref(t);
+
+    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))
+    {
+      error_loc("'%s': [string] attribute is only valid on 'char', 'byte', or 'wchar_t' pointers and arrays\n",
+                v->name);
+    }
+  }
+
   if (is_attr(v->attrs, ATTR_V1ENUM))
   {
     if (type_get_type_detect_alias(v->type) != TYPE_ENUM)
       error_loc("'%s': [v1_enum] attribute applied to non-enum type\n", v->name);
   }
 
+  if (is_attr(v->attrs, ATTR_RANGE) && !is_allowed_range_type(v->type))
+    error_loc("'%s': [range] attribute applied to non-integer type\n",
+              v->name);
+
   ptype = &v->type;
   sizeless = FALSE;
   if (arr) LIST_FOR_EACH_ENTRY_REV(dim, arr, expr_t, entry)
@@ -1442,6 +1591,11 @@ static void set_type(var_t *v, decl_spec_t *decl_spec, const declarator_t *decl,
       if (is_attr(t->attrs, ATTR_CALLCONV))
         error_loc("calling convention applied to non-function-pointer type\n");
   }
+
+  if (decl->bits)
+    v->type = type_new_bitfield(v->type, decl->bits);
+
+  return v;
 }
 
 static var_list_t *set_var_types(attr_list_t *attrs, decl_spec_t *decl_spec, declarator_list_t *decls)
@@ -1451,13 +1605,11 @@ static var_list_t *set_var_types(attr_list_t *attrs, decl_spec_t *decl_spec, dec
 
   LIST_FOR_EACH_ENTRY_SAFE( decl, next, decls, declarator_t, entry )
   {
-    var_t *var = decl->var;
-
-    var->attrs = attrs;
-    set_type(var, decl_spec, decl, 0);
+    var_t *var = declare_var(attrs, decl_spec, decl, 0);
     var_list = append_var(var_list, var);
     free(decl);
   }
+  free(decl_spec);
   return var_list;
 }
 
@@ -1531,10 +1683,11 @@ static declarator_list_t *append_declarator(declarator_list_t *list, declarator_
 static declarator_t *make_declarator(var_t *var)
 {
   declarator_t *d = xmalloc(sizeof(*d));
-  d->var = var;
+  d->var = var ? var : make_var(NULL);
   d->type = NULL;
   d->func_type = NULL;
   d->array = NULL;
+  d->bits = NULL;
   return d;
 }
 
@@ -1675,27 +1828,8 @@ static void fix_incomplete_types(type_t *complete_type)
 static type_t *reg_typedefs(decl_spec_t *decl_spec, declarator_list_t *decls, attr_list_t *attrs)
 {
   const declarator_t *decl;
-  int is_str = is_attr(attrs, ATTR_STRING);
   type_t *type = decl_spec->type;
 
-  if (is_str)
-  {
-    type_t *t = decl_spec->type;
-
-    while (is_ptr(t))
-      t = type_pointer_get_ref(t);
-
-    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",
-              decl->var->name);
-    }
-  }
-
   /* 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.  */
@@ -1714,20 +1848,18 @@ static type_t *reg_typedefs(decl_spec_t *decl_spec, declarator_list_t *decls, at
 
   LIST_FOR_EACH_ENTRY( decl, decls, const declarator_t, entry )
   {
-    var_t *name = decl->var;
 
-    if (name->name) {
+    if (decl->var->name) {
       type_t *cur;
+      var_t *name;
 
-      cur = find_type(name->name, 0);
+      cur = find_type(decl->var->name, 0);
       if (cur)
           error_loc("%s: redefinition error; original definition was at %s:%d\n",
                     cur->name, cur->loc_info.input_name,
                     cur->loc_info.line_number);
 
-      /* set the attributes to allow set_type to do some checks on them */
-      name->attrs = attrs;
-      set_type(name, decl_spec, decl, 0);
+      name = declare_var(attrs, decl_spec, decl, 0);
       cur = type_new_alias(name->type, name->name);
       cur->attrs = attrs;
 
@@ -1872,6 +2004,7 @@ struct allowed_attr allowed_attr[] =
 {
     /* attr                        { D ACF I Fn ARG T En St Un Fi  L  DI M  C  <display name> } */
     /* ATTR_AGGREGATABLE */        { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, "aggregatable" },
+    /* ATTR_ANNOTATION */          { 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, "annotation" },
     /* ATTR_APPOBJECT */           { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, "appobject" },
     /* ATTR_ASYNC */               { 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "async" },
     /* ATTR_AUTO_HANDLE */         { 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "auto_handle" },
@@ -1977,14 +2110,10 @@ static attr_list_t *check_function_attrs(const char *name, attr_list_t *attrs)
   return attrs;
 }
 
-static void check_arg(var_t *arg)
+static void check_arg_attrs(const var_t *arg)
 {
-  const type_t *t = arg->type;
   const attr_t *attr;
 
-  if (type_get_type(t) == TYPE_VOID)
-    error_loc("argument '%s' has void type\n", arg->name);
-
   if (arg->attrs)
   {
     LIST_FOR_EACH_ENTRY(attr, arg->attrs, const attr_t, entry)
@@ -2150,6 +2279,7 @@ static int is_allowed_conf_type(const type_t *type)
     case TYPE_COCLASS:
     case TYPE_FUNCTION:
     case TYPE_INTERFACE:
+    case TYPE_BITFIELD:
         return FALSE;
     }
     return FALSE;
@@ -2193,24 +2323,30 @@ static void check_field_common(const type_t *container_type,
 {
     type_t *type = arg->type;
     int more_to_do;
-    const char *container_type_name = NULL;
+    const char *container_type_name;
+    const char *var_type;
 
-    switch (type_get_type_detect_alias(type))
+    switch (type_get_type(container_type))
     {
     case TYPE_STRUCT:
         container_type_name = "struct";
+        var_type = "field";
         break;
     case TYPE_UNION:
         container_type_name = "union";
+        var_type = "arm";
         break;
     case TYPE_ENCAPSULATED_UNION:
         container_type_name = "encapsulated union";
+        var_type = "arm";
         break;
     case TYPE_FUNCTION:
         container_type_name = "function";
+        var_type = "parameter";
         break;
     default:
-        break;
+        /* should be no other container types */
+        assert(0);
     }
 
     if (is_attr(arg->attrs, ATTR_LENGTHIS) &&
@@ -2270,28 +2406,48 @@ static void check_field_common(const type_t *container_type,
             check_remoting_fields(arg, type);
             break;
         case TGT_INVALID:
+        {
+            const char *reason = "is 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);
+                reason = "cannot derive from void *";
                 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);
+                reason = "cannot be a function pointer";
+                break;
+            case TYPE_BITFIELD:
+                reason = "cannot be a bit-field";
                 break;
             case TYPE_COCLASS:
+                reason = "cannot be a class";
+                break;
             case TYPE_INTERFACE:
+                reason = "cannot be a non-pointer to an interface";
+                break;
             case TYPE_MODULE:
-                /* FIXME */
+                reason = "cannot be a module";
                 break;
             default:
                 break;
             }
+            error_loc_info(&arg->loc_info, "%s \'%s\' of %s \'%s\' %s\n",
+                           var_type, arg->name, container_type_name, container_name, reason);
+            break;
+        }
         case TGT_CTXT_HANDLE:
         case TGT_CTXT_HANDLE_POINTER:
             /* FIXME */
             break;
+        case TGT_STRING:
+        {
+            const type_t *t = type;
+            while (is_ptr(t))
+                t = type_pointer_get_ref(t);
+            if (is_aliaschain_attr(t, ATTR_RANGE))
+                warning_loc_info(&arg->loc_info, "%s: range not verified for a string of ranged types\n", arg->name);
+            break;
+        }
         case TGT_POINTER:
             type = type_pointer_get_ref(type);
             more_to_do = TRUE;
@@ -2301,10 +2457,10 @@ static void check_field_common(const type_t *container_type,
             more_to_do = TRUE;
             break;
         case TGT_USER_TYPE:
-        case TGT_STRING:
         case TGT_IFACE_POINTER:
         case TGT_BASIC:
         case TGT_ENUM:
+        case TGT_RANGE:
             /* nothing to do */
             break;
         }
@@ -2354,6 +2510,7 @@ static void check_remoting_args(const var_t *func)
             {
             case TGT_BASIC:
             case TGT_ENUM:
+            case TGT_RANGE:
             case TGT_STRUCT:
             case TGT_UNION:
             case TGT_CTXT_HANDLE:
@@ -2381,6 +2538,16 @@ static void check_remoting_args(const var_t *func)
 
         check_field_common(func->type, funcname, arg);
     }
+
+    if (type_get_type(type_function_get_rettype(func->type)) != TYPE_VOID)
+    {
+        var_t var;
+        var = *func;
+        var.type = type_function_get_rettype(func->type);
+        var.name = xstrdup("return value");
+        check_field_common(func->type, funcname, &var);
+        free(var.name);
+}
 }
 
 static void add_explicit_handle_if_necessary(var_t *func)
index 57c4cd9..9cb425c 100644 (file)
@@ -301,25 +301,26 @@ static void yy_fatal_error YY_PROTO(( yyconst char msg[] ));
        *yy_cp = '\0'; \
        yy_c_buf_p = yy_cp;
 
-#define YY_NUM_RULES 32
-#define YY_END_OF_BUFFER 33
-static yyconst short int yy_accept[139] =
+#define YY_NUM_RULES 33
+#define YY_END_OF_BUFFER 34
+static yyconst short int yy_accept[142] =
     {   0,
         0,    0,    0,    0,    0,    0,    0,    0,    2,    2,
-       33,   31,   21,   20,   31,    3,   31,   31,   16,   16,
-       31,   31,   31,   19,   19,   19,   11,   31,   21,    1,
-       10,   32,    4,   10,    6,   16,   16,   13,   13,   13,
-       12,    2,   26,   30,   24,    0,   16,   16,   16,    0,
-       22,   28,   25,   27,   23,   19,    5,   19,   29,    0,
-        1,    1,    9,    8,    7,   16,    0,   13,   13,    2,
-       17,   16,   16,   15,   19,   16,    0,   13,    0,   15,
-       15,   19,   16,    0,   13,    0,   17,   15,   15,   19,
-       16,    0,   13,   19,   16,    0,   13,   19,   16,    0,
-
-       13,   19,   16,    0,   13,   19,    0,   16,    0,   18,
+       34,   32,   21,   20,   32,    3,   32,   32,   32,   16,
+       16,   32,   32,   32,   19,   19,   19,   11,   32,   21,
+        1,   10,   33,    4,   10,    6,   16,   16,   13,   13,
+       13,   12,    2,   26,   30,   24,    0,    0,   16,   16,
+       16,    0,   22,   28,   25,   27,   23,   19,    5,   19,
+       29,    0,    1,    1,    9,    8,    7,   16,    0,   13,
+       13,    2,   31,   17,   16,   16,   15,   19,   16,    0,
+       13,    0,   15,   15,   19,   16,    0,   13,    0,   17,
+       15,   15,   19,   16,    0,   13,   19,   16,    0,   13,
+
+       19,   16,    0,   13,   19,   16,    0,   13,   19,    0,
+       16,    0,   18,    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,    0,
-        0,    0,    0,    0,    0,    0,   14,    0
+        0,    0,    0,    0,    0,    0,    0,    0,    0,   14,
+        0
     } ;
 
 static yyconst int yy_ec[256] =
@@ -362,112 +363,112 @@ static yyconst int yy_meta[36] =
         3,    4,    4,    4,    1
     } ;
 
-static yyconst short int yy_base[175] =
+static yyconst short int yy_base[178] =
     {   0,
-        0,   34,   34,   38,   39,   42,   71,   44,  268,  267,
-      265,  491,  491,  491,  249,  491,  256,  241,   96,   22,
-       37,  241,   38,    0,  250,  237,  491,  218,   53,  249,
-      491,  491,  491,   33,  491,  119,   23,  142,  165,  245,
-      491,    0,  491,  491,  491,   48,    0,   33,   88,    0,
-      491,  491,  491,  491,  491,    0,  491,  228,  491,   63,
-      241,  240,  491,  491,  491,  185,    0,  207,    0,    0,
-      104,  491,  491,  124,  222,  227,    0,  249,  102,   94,
-      102,  220,  269,    0,  291,  113,  168,  491,  491,  213,
-      311,    0,  333,  212,  353,    0,  375,  217,  395,    0,
-
-      417,  206,  439,  222,  221,   62,    0,  220,  140,  491,
-        0,    0,    0,  219,    0,    0,    0,    0,  218,    0,
-        0,    0,    0,  213,    0,    0,    0,    0,    0,    0,
-        0,    0,    0,    0,    0,    0,  491,  491,  472,  476,
-      478,  482,  486,  219,  218,  212,  211,  210,  209,  208,
-      206,  205,  203,  198,  197,  192,  191,  190,  189,  188,
-      187,  186,  185,  183,  176,  169,  168,  167,  155,  144,
-      140,  137,  130,  110
+        0,   34,   34,   38,   39,   42,   71,   44,  270,  269,
+      271,  491,  491,  491,  255,  491,  258,  248,  252,   96,
+       22,   37,  242,   38,    0,  251,  238,  491,  219,   53,
+      251,  491,  491,  491,   33,  491,  119,   23,  142,  165,
+      246,  491,    0,  491,  491,  491,  239,   48,    0,   33,
+       88,    0,  491,  491,  491,  491,  491,    0,  491,  228,
+      491,   63,  241,  240,  491,  491,  491,  185,    0,  207,
+        0,    0,  491,  104,  491,  491,  124,  222,  227,    0,
+      249,  102,   94,  102,  220,  269,    0,  291,  113,  168,
+      491,  491,  213,  311,    0,  333,  212,  353,    0,  375,
+
+      217,  395,    0,  417,  206,  439,  222,  221,   62,    0,
+      220,  140,  491,    0,    0,    0,  219,    0,    0,    0,
+        0,  218,    0,    0,    0,    0,  213,    0,    0,    0,
+        0,    0,    0,    0,    0,    0,    0,    0,    0,  491,
+      491,  472,  476,  478,  482,  486,  219,  218,  212,  211,
+      210,  209,  208,  206,  205,  203,  198,  197,  192,  191,
+      190,  189,  188,  187,  186,  185,  183,  176,  169,  168,
+      167,  155,  144,  140,  137,  130,  110
     } ;
 
-static yyconst short int yy_def[175] =
+static yyconst short int yy_def[178] =
     {   0,
-      138,    1,  139,  139,  139,  139,  138,    7,  140,  140,
-      138,  138,  138,  138,  138,  138,  138,  138,  138,   19,
-      138,  138,  138,  141,  141,  141,  138,  138,  138,  138,
-      138,  138,  138,  142,  138,  138,   36,  138,   38,   39,
-      138,  143,  138,  138,  138,  138,   20,  138,  138,  144,
-      138,  138,  138,  138,  138,  141,  138,  141,  138,  138,
-      138,  138,  138,  138,  138,  138,  145,   39,   39,  143,
-      138,  138,  138,  144,  141,  138,  146,   39,  138,  138,
-      138,  141,  138,  147,   39,  138,  138,  138,  138,  141,
-      138,  148,   39,  141,  138,  149,   39,  141,  138,  150,
-
-       39,  141,  138,  138,   39,  141,  151,  103,  138,  138,
-      152,  153,  154,  138,  155,  156,  157,  158,  138,  159,
-      160,  161,  162,  138,  163,  164,  165,  166,  167,  168,
-      169,  170,  171,  172,  173,  174,  138,    0,  138,  138,
-      138,  138,  138,  138,  138,  138,  138,  138,  138,  138,
-      138,  138,  138,  138,  138,  138,  138,  138,  138,  138,
-      138,  138,  138,  138,  138,  138,  138,  138,  138,  138,
-      138,  138,  138,  138
+      141,    1,  142,  142,  142,  142,  141,    7,  143,  143,
+      141,  141,  141,  141,  141,  141,  141,  141,  141,  141,
+       20,  141,  141,  141,  144,  144,  144,  141,  141,  141,
+      141,  141,  141,  141,  145,  141,  141,   37,  141,   39,
+       40,  141,  146,  141,  141,  141,  141,  141,   21,  141,
+      141,  147,  141,  141,  141,  141,  141,  144,  141,  144,
+      141,  141,  141,  141,  141,  141,  141,  141,  148,   40,
+       40,  146,  141,  141,  141,  141,  147,  144,  141,  149,
+       40,  141,  141,  141,  144,  141,  150,   40,  141,  141,
+      141,  141,  144,  141,  151,   40,  144,  141,  152,   40,
+
+      144,  141,  153,   40,  144,  141,  141,   40,  144,  154,
+      106,  141,  141,  155,  156,  157,  141,  158,  159,  160,
+      161,  141,  162,  163,  164,  165,  141,  166,  167,  168,
+      169,  170,  171,  172,  173,  174,  175,  176,  177,  141,
+        0,  141,  141,  141,  141,  141,  141,  141,  141,  141,
+      141,  141,  141,  141,  141,  141,  141,  141,  141,  141,
+      141,  141,  141,  141,  141,  141,  141,  141,  141,  141,
+      141,  141,  141,  141,  141,  141,  141
     } ;
 
 static yyconst short int yy_nxt[527] =
     {   0,
        12,   13,   14,   15,   16,   12,   17,   12,   12,   18,
-       12,   19,   20,   21,   22,   23,   24,   24,   24,   24,
-       24,   25,   24,   26,   24,   24,   24,   27,   12,   12,
-       24,   24,   24,   24,   28,   29,   32,   64,   33,   30,
-       32,   32,   33,   35,   32,   29,   35,  138,  138,   30,
-       51,   52,   54,   55,   60,  138,  138,   72,   61,   71,
-       71,   65,   34,  109,   60,   72,   34,   34,   61,  110,
-       34,   12,   13,   14,   15,   16,   12,   17,   12,   12,
-       18,   12,   36,   37,   21,   22,   23,   38,   38,   38,
-       38,   39,   40,   39,   39,   39,   39,   39,   27,   12,
-
-       41,   38,   39,   39,   39,   28,   46,   47,   47,   73,
-       86,   86,  137,   87,   87,   71,   71,   48,   88,   73,
-       49,   50,   79,   89,   87,   87,   88,   48,   49,   50,
-       66,   66,  136,   89,   79,   67,   67,   67,   67,  135,
-       48,  109,  134,   49,   50,   80,  133,  110,   81,   67,
-       48,   49,   50,   68,   68,   80,   81,  132,   68,   68,
-       68,   68,   69,   69,   69,   69,   69,   69,   69,  131,
-      130,  129,   68,   69,   69,   69,   69,   69,  128,   87,
-       87,   69,   69,   69,   69,  127,   79,  126,  124,  123,
-      122,  121,  119,  118,  117,   69,   76,   76,   79,  116,
-
-      114,   77,   77,   77,   77,  113,   48,  112,  111,   49,
-      104,  100,   96,   92,   84,   77,   48,   49,   78,   78,
-       77,   74,  125,   78,   78,   78,   78,  120,  115,  138,
-      107,  107,  106,  102,   98,   94,   90,   78,   83,   83,
-       82,   62,   62,   84,   84,   84,   84,   75,   48,   57,
-       62,   49,   59,   58,   57,   53,   45,   84,   48,   49,
-       85,   85,   44,   43,  138,   85,   85,   85,   85,   32,
-       32,  138,  138,  138,  138,  138,  138,  138,  138,   85,
-       91,   91,  138,  138,  138,   92,   92,   92,   92,  138,
-       48,  138,  138,   49,  138,  138,  138,  138,  138,   92,
-
-       48,   49,   93,   93,  138,  138,  138,   93,   93,   93,
-       93,  138,  138,  138,  138,  138,  138,  138,  138,  138,
-      138,   93,   95,   95,  138,  138,  138,   96,   96,   96,
-       96,  138,   48,  138,  138,   49,  138,  138,  138,  138,
-      138,   96,   48,   49,   97,   97,  138,  138,  138,   97,
-       97,   97,   97,  138,  138,  138,  138,  138,  138,  138,
-      138,  138,  138,   97,   99,   99,  138,  138,  138,  100,
-      100,  100,  100,  138,   48,  138,  138,   49,  138,  138,
-      138,  138,  138,  100,   48,   49,  101,  101,  138,  138,
-      138,  101,  101,  101,  101,  138,  138,  138,  138,  138,
-
-      138,  138,  138,  138,  138,  101,  103,  103,  138,  138,
-      138,  104,  104,  104,  104,  138,   48,  138,  138,   49,
-      138,  138,  138,  138,  138,  104,   48,   49,  105,  105,
-      138,  138,  138,  105,  105,  105,  105,  138,  138,  138,
-      138,  138,  138,  138,  138,  138,  138,  105,  107,  138,
-      108,  108,  138,  138,  138,  138,  138,  138,  138,  138,
-       48,  138,  138,   49,  138,  138,  138,  138,  138,  138,
-       48,   49,   31,   31,   31,   31,   42,   42,   42,   42,
-       56,   56,   63,  138,   63,   63,   70,  138,   70,   70,
-       11,  138,  138,  138,  138,  138,  138,  138,  138,  138,
-
-      138,  138,  138,  138,  138,  138,  138,  138,  138,  138,
-      138,  138,  138,  138,  138,  138,  138,  138,  138,  138,
-      138,  138,  138,  138,  138,  138
+       19,   20,   21,   22,   23,   24,   25,   25,   25,   25,
+       25,   26,   25,   27,   25,   25,   25,   28,   12,   12,
+       25,   25,   25,   25,   29,   30,   33,   66,   34,   31,
+       33,   33,   34,   36,   33,   30,   36,  141,  141,   31,
+       53,   54,   56,   57,   62,  141,  141,   75,   63,   74,
+       74,   67,   35,  112,   62,   75,   35,   35,   63,  113,
+       35,   12,   13,   14,   15,   16,   12,   17,   12,   12,
+       18,   19,   37,   38,   22,   23,   24,   39,   39,   39,
+       39,   40,   41,   40,   40,   40,   40,   40,   28,   12,
+
+       42,   39,   40,   40,   40,   29,   48,   49,   49,   76,
+       89,   89,  140,   90,   90,   74,   74,   50,   91,   76,
+       51,   52,   82,   92,   90,   90,   91,   50,   51,   52,
+       68,   68,  139,   92,   82,   69,   69,   69,   69,  138,
+       50,  112,  137,   51,   52,   83,  136,  113,   84,   69,
+       50,   51,   52,   70,   70,   83,   84,  135,   70,   70,
+       70,   70,   71,   71,   71,   71,   71,   71,   71,  134,
+      133,  132,   70,   71,   71,   71,   71,   71,  131,   90,
+       90,   71,   71,   71,   71,  130,   82,  129,  127,  126,
+      125,  124,  122,  121,  120,   71,   79,   79,   82,  119,
+
+      117,   80,   80,   80,   80,  116,   50,  115,  114,   51,
+      107,  103,   99,   95,   87,   80,   50,   51,   81,   81,
+       80,   77,  128,   81,   81,   81,   81,  123,  118,  141,
+      110,  110,  109,  105,  101,   97,   93,   81,   86,   86,
+       85,   64,   64,   87,   87,   87,   87,   78,   50,   73,
+       59,   51,   64,   61,   60,   59,   55,   87,   50,   51,
+       88,   88,   47,   46,   45,   88,   88,   88,   88,   44,
+      141,   33,   33,  141,  141,  141,  141,  141,  141,   88,
+       94,   94,  141,  141,  141,   95,   95,   95,   95,  141,
+       50,  141,  141,   51,  141,  141,  141,  141,  141,   95,
+
+       50,   51,   96,   96,  141,  141,  141,   96,   96,   96,
+       96,  141,  141,  141,  141,  141,  141,  141,  141,  141,
+      141,   96,   98,   98,  141,  141,  141,   99,   99,   99,
+       99,  141,   50,  141,  141,   51,  141,  141,  141,  141,
+      141,   99,   50,   51,  100,  100,  141,  141,  141,  100,
+      100,  100,  100,  141,  141,  141,  141,  141,  141,  141,
+      141,  141,  141,  100,  102,  102,  141,  141,  141,  103,
+      103,  103,  103,  141,   50,  141,  141,   51,  141,  141,
+      141,  141,  141,  103,   50,   51,  104,  104,  141,  141,
+      141,  104,  104,  104,  104,  141,  141,  141,  141,  141,
+
+      141,  141,  141,  141,  141,  104,  106,  106,  141,  141,
+      141,  107,  107,  107,  107,  141,   50,  141,  141,   51,
+      141,  141,  141,  141,  141,  107,   50,   51,  108,  108,
+      141,  141,  141,  108,  108,  108,  108,  141,  141,  141,
+      141,  141,  141,  141,  141,  141,  141,  108,  110,  141,
+      111,  111,  141,  141,  141,  141,  141,  141,  141,  141,
+       50,  141,  141,   51,  141,  141,  141,  141,  141,  141,
+       50,   51,   32,   32,   32,   32,   43,   43,   43,   43,
+       58,   58,   65,  141,   65,   65,   72,  141,   72,   72,
+       11,  141,  141,  141,  141,  141,  141,  141,  141,  141,
+
+      141,  141,  141,  141,  141,  141,  141,  141,  141,  141,
+      141,  141,  141,  141,  141,  141,  141,  141,  141,  141,
+      141,  141,  141,  141,  141,  141
     } ;
 
 static yyconst short int yy_chk[527] =
@@ -475,61 +476,61 @@ static yyconst short int yy_chk[527] =
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1,    2,    3,   34,    3,    2,
-        4,    5,    4,    5,    6,    8,    6,   20,   37,    8,
-       21,   21,   23,   23,   29,   20,   37,   48,   29,   46,
-       46,   34,    3,  106,   60,   48,    4,    5,   60,  106,
+        1,    1,    1,    1,    1,    2,    3,   35,    3,    2,
+        4,    5,    4,    5,    6,    8,    6,   21,   38,    8,
+       22,   22,   24,   24,   30,   21,   38,   50,   30,   48,
+       48,   35,    3,  109,   62,   50,    4,    5,   62,  109,
         6,    7,    7,    7,    7,    7,    7,    7,    7,    7,
         7,    7,    7,    7,    7,    7,    7,    7,    7,    7,
         7,    7,    7,    7,    7,    7,    7,    7,    7,    7,
 
-        7,    7,    7,    7,    7,    7,   19,   19,   19,   49,
-       79,   79,  174,   79,   79,   71,   71,   19,   80,   49,
-       19,   19,   71,   81,   86,   86,   80,   19,   19,   19,
-       36,   36,  173,   81,   71,   36,   36,   36,   36,  172,
-       36,  109,  171,   36,   36,   74,  170,  109,   74,   36,
-       36,   36,   36,   38,   38,   74,   74,  169,   38,   38,
-       38,   38,   38,   38,   38,   38,   38,   38,   38,  168,
-      167,  166,   38,   38,   38,   38,   39,   39,  165,   87,
-       87,   39,   39,   39,   39,  164,   87,  163,  162,  161,
-      160,  159,  158,  157,  156,   39,   66,   66,   87,  155,
-
-      154,   66,   66,   66,   66,  153,   66,  152,  151,   66,
-      150,  149,  148,  147,  146,   66,   66,   66,   68,   68,
-      145,  144,  124,   68,   68,   68,   68,  119,  114,  108,
-      105,  104,  102,   98,   94,   90,   82,   68,   76,   76,
-       75,   62,   61,   76,   76,   76,   76,   58,   76,   40,
-       30,   76,   28,   26,   25,   22,   18,   76,   76,   76,
-       78,   78,   17,   15,   11,   78,   78,   78,   78,   10,
-        9,    0,    0,    0,    0,    0,    0,    0,    0,   78,
-       83,   83,    0,    0,    0,   83,   83,   83,   83,    0,
-       83,    0,    0,   83,    0,    0,    0,    0,    0,   83,
-
-       83,   83,   85,   85,    0,    0,    0,   85,   85,   85,
-       85,    0,    0,    0,    0,    0,    0,    0,    0,    0,
-        0,   85,   91,   91,    0,    0,    0,   91,   91,   91,
-       91,    0,   91,    0,    0,   91,    0,    0,    0,    0,
-        0,   91,   91,   91,   93,   93,    0,    0,    0,   93,
-       93,   93,   93,    0,    0,    0,    0,    0,    0,    0,
-        0,    0,    0,   93,   95,   95,    0,    0,    0,   95,
-       95,   95,   95,    0,   95,    0,    0,   95,    0,    0,
-        0,    0,    0,   95,   95,   95,   97,   97,    0,    0,
-        0,   97,   97,   97,   97,    0,    0,    0,    0,    0,
-
-        0,    0,    0,    0,    0,   97,   99,   99,    0,    0,
-        0,   99,   99,   99,   99,    0,   99,    0,    0,   99,
-        0,    0,    0,    0,    0,   99,   99,   99,  101,  101,
-        0,    0,    0,  101,  101,  101,  101,    0,    0,    0,
-        0,    0,    0,    0,    0,    0,    0,  101,  103,    0,
-      103,  103,    0,    0,    0,    0,    0,    0,    0,    0,
-      103,    0,    0,  103,    0,    0,    0,    0,    0,    0,
-      103,  103,  139,  139,  139,  139,  140,  140,  140,  140,
-      141,  141,  142,    0,  142,  142,  143,    0,  143,  143,
-      138,  138,  138,  138,  138,  138,  138,  138,  138,  138,
-
-      138,  138,  138,  138,  138,  138,  138,  138,  138,  138,
-      138,  138,  138,  138,  138,  138,  138,  138,  138,  138,
-      138,  138,  138,  138,  138,  138
+        7,    7,    7,    7,    7,    7,   20,   20,   20,   51,
+       82,   82,  177,   82,   82,   74,   74,   20,   83,   51,
+       20,   20,   74,   84,   89,   89,   83,   20,   20,   20,
+       37,   37,  176,   84,   74,   37,   37,   37,   37,  175,
+       37,  112,  174,   37,   37,   77,  173,  112,   77,   37,
+       37,   37,   37,   39,   39,   77,   77,  172,   39,   39,
+       39,   39,   39,   39,   39,   39,   39,   39,   39,  171,
+      170,  169,   39,   39,   39,   39,   40,   40,  168,   90,
+       90,   40,   40,   40,   40,  167,   90,  166,  165,  164,
+      163,  162,  161,  160,  159,   40,   68,   68,   90,  158,
+
+      157,   68,   68,   68,   68,  156,   68,  155,  154,   68,
+      153,  152,  151,  150,  149,   68,   68,   68,   70,   70,
+      148,  147,  127,   70,   70,   70,   70,  122,  117,  111,
+      108,  107,  105,  101,   97,   93,   85,   70,   79,   79,
+       78,   64,   63,   79,   79,   79,   79,   60,   79,   47,
+       41,   79,   31,   29,   27,   26,   23,   79,   79,   79,
+       81,   81,   19,   18,   17,   81,   81,   81,   81,   15,
+       11,   10,    9,    0,    0,    0,    0,    0,    0,   81,
+       86,   86,    0,    0,    0,   86,   86,   86,   86,    0,
+       86,    0,    0,   86,    0,    0,    0,    0,    0,   86,
+
+       86,   86,   88,   88,    0,    0,    0,   88,   88,   88,
+       88,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+        0,   88,   94,   94,    0,    0,    0,   94,   94,   94,
+       94,    0,   94,    0,    0,   94,    0,    0,    0,    0,
+        0,   94,   94,   94,   96,   96,    0,    0,    0,   96,
+       96,   96,   96,    0,    0,    0,    0,    0,    0,    0,
+        0,    0,    0,   96,   98,   98,    0,    0,    0,   98,
+       98,   98,   98,    0,   98,    0,    0,   98,    0,    0,
+        0,    0,    0,   98,   98,   98,  100,  100,    0,    0,
+        0,  100,  100,  100,  100,    0,    0,    0,    0,    0,
+
+        0,    0,    0,    0,    0,  100,  102,  102,    0,    0,
+        0,  102,  102,  102,  102,    0,  102,    0,    0,  102,
+        0,    0,    0,    0,    0,  102,  102,  102,  104,  104,
+        0,    0,    0,  104,  104,  104,  104,    0,    0,    0,
+        0,    0,    0,    0,    0,    0,    0,  104,  106,    0,
+      106,  106,    0,    0,    0,    0,    0,    0,    0,    0,
+      106,    0,    0,  106,    0,    0,    0,    0,    0,    0,
+      106,  106,  142,  142,  142,  142,  143,  143,  143,  143,
+      144,  144,  145,    0,  145,  145,  146,    0,  146,  146,
+      141,  141,  141,  141,  141,  141,  141,  141,  141,  141,
+
+      141,  141,  141,  141,  141,  141,  141,  141,  141,  141,
+      141,  141,  141,  141,  141,  141,  141,  141,  141,  141,
+      141,  141,  141,  141,  141,  141
     } ;
 
 static yy_state_type yy_last_accepting_state;
@@ -661,7 +662,7 @@ UUID *parse_uuid(const char *u)
  * The flexer starts here
  **************************************************************************
  */
-#line 665 "parser.yy.c"
+#line 666 "parser.yy.c"
 
 /* Macros after this point can all be overridden by user definitions in
  * section 1.
@@ -817,7 +818,7 @@ YY_DECL
 
 #line 127 "parser.l"
 
-#line 821 "parser.yy.c"
+#line 822 "parser.yy.c"
 
        if ( yy_init )
                {
@@ -869,7 +870,7 @@ yy_match:
                        while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
                                {
                                yy_current_state = (int) yy_def[yy_current_state];
-                               if ( yy_current_state >= 139 )
+                               if ( yy_current_state >= 142 )
                                        yy_c = yy_meta[(unsigned int) yy_c];
                                }
                        yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
@@ -1092,6 +1093,11 @@ return LOGICALAND;
 case 31:
 YY_RULE_SETUP
 #line 196 "parser.l"
+return ELLIPSIS;
+       YY_BREAK
+case 32:
+YY_RULE_SETUP
+#line 197 "parser.l"
 return yytext[0];
        YY_BREAK
 case YY_STATE_EOF(INITIAL):
@@ -1099,19 +1105,19 @@ case YY_STATE_EOF(QUOTE):
 case YY_STATE_EOF(WSTRQUOTE):
 case YY_STATE_EOF(ATTR):
 case YY_STATE_EOF(PP_LINE):
-#line 197 "parser.l"
+#line 198 "parser.l"
 {
                                if (import_stack_ptr)
                                        return aEOF;
                                else yyterminate();
                        }
        YY_BREAK
-case 32:
+case 33:
 YY_RULE_SETUP
-#line 202 "parser.l"
+#line 203 "parser.l"
 ECHO;
        YY_BREAK
-#line 1115 "parser.yy.c"
+#line 1121 "parser.yy.c"
 
        case YY_END_OF_BUFFER:
                {
@@ -1402,7 +1408,7 @@ static yy_state_type yy_get_previous_state()
                while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
                        {
                        yy_current_state = (int) yy_def[yy_current_state];
-                       if ( yy_current_state >= 139 )
+                       if ( yy_current_state >= 142 )
                                yy_c = yy_meta[(unsigned int) yy_c];
                        }
                yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
@@ -1437,11 +1443,11 @@ yy_state_type yy_current_state;
        while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
                {
                yy_current_state = (int) yy_def[yy_current_state];
-               if ( yy_current_state >= 139 )
+               if ( yy_current_state >= 142 )
                        yy_c = yy_meta[(unsigned int) yy_c];
                }
        yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
-       yy_is_jam = (yy_current_state == 138);
+       yy_is_jam = (yy_current_state == 141);
 
        return yy_is_jam ? 0 : yy_current_state;
        }
@@ -1997,7 +2003,7 @@ int main()
        return 0;
        }
 #endif
-#line 202 "parser.l"
+#line 203 "parser.l"
 
 
 #ifndef parser_wrap
@@ -2019,6 +2025,7 @@ static const struct keyword keywords[] = {
        {"TRUE",                        tTRUE},
        {"__cdecl",                     tCDECL},
        {"__fastcall",                  tFASTCALL},
+       {"__int3264",                   tINT3264},
        {"__int64",                     tINT64},
        {"__pascal",                    tPASCAL},
        {"__stdcall",                   tSTDCALL},
@@ -2078,6 +2085,7 @@ static const struct keyword attr_keywords[] =
 {
         {"aggregatable",                tAGGREGATABLE},
         {"allocate",                    tALLOCATE},
+        {"annotation",                  tANNOTATION},
         {"appobject",                   tAPPOBJECT},
         {"async",                       tASYNC},
         {"async_uuid",                  tASYNCUUID},
index b41dcbe..9072033 100644 (file)
@@ -116,12 +116,27 @@ const char *string_of_type(unsigned char type)
     case RPC_FC_C_WSTRING: return "FC_C_WSTRING";
     case RPC_FC_CSTRING: return "FC_CSTRING";
     case RPC_FC_WSTRING: return "FC_WSTRING";
+    case RPC_FC_INT3264: return "FC_INT3264";
+    case RPC_FC_UINT3264: return "FC_UINT3264";
     default:
         error("string_of_type: unknown type 0x%02x\n", type);
         return NULL;
     }
 }
 
+static void *get_aliaschain_attrp(const type_t *type, enum attr_type attr)
+{
+    const type_t *t = type;
+    for (;;)
+    {
+        if (is_attr(t->attrs, attr))
+            return get_attrp(t->attrs, attr);
+        else if (type_is_alias(t))
+            t = type_alias_get_aliasee(t);
+        else return 0;
+    }
+}
+
 unsigned char get_basic_fc(const type_t *type)
 {
     int sign = type_basic_get_sign(type);
@@ -132,6 +147,7 @@ unsigned char get_basic_fc(const type_t *type)
     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_INT3264: return (sign <= 0 ? RPC_FC_INT3264 : RPC_FC_UINT3264);
     case TYPE_BASIC_BYTE: return RPC_FC_BYTE;
     case TYPE_BASIC_CHAR: return RPC_FC_CHAR;
     case TYPE_BASIC_WCHAR: return RPC_FC_WCHAR;
@@ -140,8 +156,8 @@ unsigned char get_basic_fc(const type_t *type)
     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;
     }
+    return 0;
 }
 
 static inline unsigned int clamp_align(unsigned int align)
@@ -200,8 +216,14 @@ enum typegen_type typegen_detect_type(const type_t *type, const attr_list_t *att
     switch (type_get_type(type))
     {
     case TYPE_BASIC:
+        if (!(flags & TDT_IGNORE_RANGES) &&
+            (is_attr(attrs, ATTR_RANGE) || is_aliaschain_attr(type, ATTR_RANGE)))
+            return TGT_RANGE;
         return TGT_BASIC;
     case TYPE_ENUM:
+        if (!(flags & TDT_IGNORE_RANGES) &&
+            (is_attr(attrs, ATTR_RANGE) || is_aliaschain_attr(type, ATTR_RANGE)))
+            return TGT_RANGE;
         return TGT_ENUM;
     case TYPE_POINTER:
         if (type_get_type(type_pointer_get_ref(type)) == TYPE_INTERFACE ||
@@ -224,69 +246,12 @@ enum typegen_type typegen_detect_type(const type_t *type, const attr_list_t *att
     case TYPE_MODULE:
     case TYPE_VOID:
     case TYPE_ALIAS:
+    case TYPE_BITFIELD:
         break;
     }
     return TGT_INVALID;
 }
 
-static type_t *get_user_type(const type_t *t, const char **pname);
-
-static int type_contains_iface(const type_t *type)
-{
-  enum typegen_type typegen_type;
-  var_list_t *fields;
-  const var_t *field;
-
-  typegen_type = typegen_detect_type(type, type->attrs, TDT_IGNORE_STRINGS);
-
-  switch(typegen_type)
-  {
-  case TGT_USER_TYPE:
-    return type_contains_iface(get_user_type(type, NULL));
-
-  case TGT_BASIC:
-  case TGT_ENUM:
-    return FALSE;
-
-  case TGT_POINTER:
-    return type_contains_iface(type_pointer_get_ref(type));
-
-  case TGT_ARRAY:
-    return type_contains_iface(type_array_get_element(type));
-
-  case TGT_IFACE_POINTER:
-    return TRUE;
-
-  case TGT_STRUCT:
-    fields = type_struct_get_fields(type);
-    if (fields) LIST_FOR_EACH_ENTRY( field, fields, const var_t, entry )
-    {
-      if(type_contains_iface(field->type))
-        return TRUE;
-    }
-    return FALSE;
-
-  case TGT_UNION:
-    fields = type_union_get_cases(type);
-    if (fields) LIST_FOR_EACH_ENTRY( field, fields, const var_t, entry )
-    {
-      if(field->type && type_contains_iface(field->type))
-        return TRUE;
-    }
-    return FALSE;
-
-    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);
-  }
-  return FALSE;
-}
-
 unsigned char get_struct_fc(const type_t *type)
 {
   int has_pointer = 0;
@@ -340,15 +305,15 @@ unsigned char get_struct_fc(const type_t *type)
     case TGT_IFACE_POINTER:
         return RPC_FC_BOGUS_STRUCT;
     case TGT_BASIC:
+        if (type_basic_get_type(t) == TYPE_BASIC_INT3264 && pointer_size != 4)
+            return RPC_FC_BOGUS_STRUCT;
         break;
     case TGT_ENUM:
         if (get_enum_fc(t) == RPC_FC_ENUM16)
             return RPC_FC_BOGUS_STRUCT;
         break;
-    case TGT_ARRAY:
-        if(type_contains_iface(type_array_get_element(t)))
-            return RPC_FC_BOGUS_STRUCT;
     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;
@@ -397,6 +362,8 @@ unsigned char get_struct_fc(const type_t *type)
         }
         break;
     }
+    case TGT_RANGE:
+        return RPC_FC_BOGUS_STRUCT;
     case TGT_STRING:
         /* shouldn't get here because of TDT_IGNORE_STRINGS above. fall through */
     case TGT_INVALID:
@@ -460,6 +427,11 @@ unsigned char get_array_fc(const type_t *type)
     case TGT_USER_TYPE:
         fc = RPC_FC_BOGUS_ARRAY;
         break;
+    case TGT_BASIC:
+        if (type_basic_get_type(elem_type) == TYPE_BASIC_INT3264 &&
+            pointer_size != 4)
+            fc = RPC_FC_BOGUS_ARRAY;
+        break;
     case TGT_STRUCT:
         switch (get_struct_fc(elem_type))
         {
@@ -485,7 +457,9 @@ unsigned char get_array_fc(const type_t *type)
         if (get_pointer_fc(elem_type, NULL, FALSE) == RPC_FC_RP || pointer_size != 4)
             fc = RPC_FC_BOGUS_ARRAY;
         break;
-    case TGT_BASIC:
+    case TGT_RANGE:
+        fc = RPC_FC_BOGUS_ARRAY;
+        break;
     case TGT_CTXT_HANDLE:
     case TGT_CTXT_HANDLE_POINTER:
     case TGT_STRING:
@@ -559,6 +533,7 @@ static int type_has_pointers(const type_t *type)
     case TGT_IFACE_POINTER:
     case TGT_BASIC:
     case TGT_ENUM:
+    case TGT_RANGE:
     case TGT_INVALID:
         break;
     }
@@ -612,6 +587,7 @@ static int type_has_full_pointer(const type_t *type, const attr_list_t *attrs,
     case TGT_IFACE_POINTER:
     case TGT_BASIC:
     case TGT_ENUM:
+    case TGT_RANGE:
     case TGT_INVALID:
         break;
     }
@@ -1258,6 +1234,12 @@ unsigned int type_memsize(const type_t *t, unsigned int *align)
             size = 8;
             if (size > *align) *align = size;
             break;
+        case RPC_FC_INT3264:
+        case RPC_FC_UINT3264:
+            assert( pointer_size );
+            size = pointer_size;
+            if (size > *align) *align = size;
+            break;
         default:
             error("type_memsize: Unknown type 0x%x\n", get_basic_fc(t));
             size = 0;
@@ -1315,10 +1297,11 @@ unsigned int type_memsize(const type_t *t, unsigned int *align)
     case TYPE_COCLASS:
     case TYPE_MODULE:
     case TYPE_FUNCTION:
+    case TYPE_BITFIELD:
         /* 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). */
+         * checking restrictions (function, bitfield). */
         assert(0);
     }
 
@@ -2737,6 +2720,33 @@ static unsigned int write_contexthandle_tfs(FILE *file, const type_t *type,
     return start_offset;
 }
 
+static unsigned int write_range_tfs(FILE *file, const attr_list_t *attrs,
+                                    type_t *type, expr_list_t *range_list,
+                                    unsigned int *typeformat_offset)
+{
+    unsigned char fc;
+    unsigned int start_offset = *typeformat_offset;
+    const expr_t *range_min = LIST_ENTRY(list_head(range_list), const expr_t, entry);
+    const expr_t *range_max = LIST_ENTRY(list_next(range_list, list_head(range_list)), const expr_t, entry);
+
+    if (type_get_type(type) == TYPE_BASIC)
+        fc = get_basic_fc(type);
+    else
+        fc = get_enum_fc(type);
+
+    /* fc must fit in lower 4-bits of 8-bit field below */
+    assert(fc <= 0xf);
+
+    print_file(file, 0, "/* %u */\n", *typeformat_offset);
+    print_file(file, 2, "0x%x,\t/* FC_RANGE */\n", RPC_FC_RANGE);
+    print_file(file, 2, "0x%x,\t/* %s */\n", fc, string_of_type(fc));
+    print_file(file, 2, "NdrFcLong(0x%lx),\t/* %lu */\n", range_min->cval, range_min->cval);
+    print_file(file, 2, "NdrFcLong(0x%lx),\t/* %lu */\n", range_max->cval, range_max->cval);
+    *typeformat_offset += 10;
+
+    return start_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,
@@ -2784,6 +2794,13 @@ static unsigned int write_typeformatstring_var(FILE *file, int indent, const var
     case TGT_BASIC:
         /* nothing to do */
         return 0;
+    case TGT_RANGE:
+    {
+        expr_list_t *range_list = get_attrp(var->attrs, ATTR_RANGE);
+        if (!range_list)
+            range_list = get_aliaschain_attrp(type, ATTR_RANGE);
+        return write_range_tfs(file, var->attrs, type, range_list, typeformat_offset);
+    }
     case TGT_IFACE_POINTER:
         return write_ip_tfs(file, var->attrs, type, typeformat_offset);
     case TGT_POINTER:
@@ -2888,6 +2905,14 @@ static int write_embedded_types(FILE *file, const attr_list_t *attrs, type_t *ty
     case TGT_BASIC:
         /* nothing to do */
         break;
+    case TGT_RANGE:
+    {
+        expr_list_t *range_list = get_attrp(attrs, ATTR_RANGE);
+        if (!range_list)
+            range_list = get_aliaschain_attrp(type, ATTR_RANGE);
+        write_range_tfs(file, attrs, type, range_list, tfsoff);
+        break;
+    }
     case TGT_CTXT_HANDLE:
     case TGT_CTXT_HANDLE_POINTER:
     case TGT_INVALID:
@@ -2989,7 +3014,7 @@ static unsigned int get_required_buffer_size_type(
     const type_t *type, const char *name, const attr_list_t *attrs, int toplevel_param, unsigned int *alignment)
 {
     *alignment = 0;
-    switch (typegen_detect_type(type, NULL, TDT_IGNORE_STRINGS))
+    switch (typegen_detect_type(type, NULL, TDT_IGNORE_STRINGS|TDT_IGNORE_RANGES))
     {
     case TGT_USER_TYPE:
     {
@@ -3025,6 +3050,12 @@ static unsigned int get_required_buffer_size_type(
             *alignment = 8;
             return 8;
 
+        case RPC_FC_INT3264:
+        case RPC_FC_UINT3264:
+            assert( pointer_size );
+            *alignment = pointer_size;
+            return pointer_size;
+
         case RPC_FC_IGNORE:
         case RPC_FC_BIND_PRIMITIVE:
             return 0;
@@ -3064,6 +3095,7 @@ static unsigned int get_required_buffer_size_type(
             {
             case TGT_BASIC:
             case TGT_ENUM:
+            case TGT_RANGE:
                 return get_required_buffer_size_type( ref, name, NULL, FALSE, alignment );
             case TGT_STRUCT:
                 if (get_struct_fc(ref) == RPC_FC_STRUCT)
@@ -3191,28 +3223,36 @@ 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;
-    const type_t *ref;
 
     /* no work to do for other phases, buffer sizing is done elsewhere */
     if (phase != PHASE_MARSHAL && phase != PHASE_UNMARSHAL)
         return;
 
-    ref = is_ptr(type) ? type_pointer_get_ref(type) : type;
-    if (type_get_type(ref) == TYPE_ENUM)
+    if (type_get_type(type) == TYPE_ENUM ||
+        (type_get_type(type) == TYPE_BASIC &&
+         type_basic_get_type(type) == TYPE_BASIC_INT3264 &&
+         pointer_size != 4))
     {
-        if (get_enum_fc(ref) == RPC_FC_ENUM32)
-        {
-            size = 4;
-            alignment = 4;
-        }
-        else /* RPC_FC_ENUM16 */
-        {
-            size = 2;
-            alignment = 2;
+        unsigned char fc;
+
+        if (type_get_type(type) == TYPE_ENUM)
+            fc = get_enum_fc(type);
+        else
+            fc = get_basic_fc(type);
+
+        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", fc, string_of_type(fc));
         }
-    }
     else
     {
+        const type_t *ref = is_ptr(type) ? type_pointer_get_ref(type) : type;
         switch (get_basic_fc(ref))
         {
         case RPC_FC_BYTE:
@@ -3234,6 +3274,9 @@ void print_phase_basetype(FILE *file, int indent, const char *local_var_prefix,
         case RPC_FC_LONG:
         case RPC_FC_FLOAT:
         case RPC_FC_ERROR_STATUS_T:
+        /* pointer_size must be 4 if we got here in these two cases */
+        case RPC_FC_INT3264:
+        case RPC_FC_UINT3264:
             size = 4;
             alignment = 4;
             break;
@@ -3254,7 +3297,6 @@ void print_phase_basetype(FILE *file, int indent, const char *local_var_prefix,
                   var->name, get_basic_fc(ref));
             size = 0;
         }
-    }
 
     if (phase == PHASE_MARSHAL)
         print_file(file, indent, "MIDL_memset(__frame->_StubMsg.Buffer, 0, (0x%x - (ULONG_PTR)__frame->_StubMsg.Buffer) & 0x%x);\n", alignment, alignment - 1);
@@ -3295,6 +3337,7 @@ void print_phase_basetype(FILE *file, int indent, const char *local_var_prefix,
     write_type_decl(file, is_ptr(type) ? type_pointer_get_ref(type) : type, NULL);
     fprintf(file, ");\n");
 }
+}
 
 /* returns whether the MaxCount, Offset or ActualCount members need to be
  * filled in for the specified phase */
@@ -3546,21 +3589,33 @@ static void write_remoting_arg(FILE *file, int indent, const var_t *func, const
         break;
     }
     case TGT_BASIC:
-        if (phase == PHASE_MARSHAL || phase == PHASE_UNMARSHAL)
             print_phase_basetype(file, indent, local_var_prefix, phase, pass, var, var->name);
         break;
     case TGT_ENUM:
-        if (phase == PHASE_MARSHAL || phase == PHASE_UNMARSHAL)
+        print_phase_basetype(file, indent, local_var_prefix, phase, pass, var, var->name);
+        break;
+    case TGT_RANGE:
+        print_phase_basetype(file, indent, local_var_prefix, phase, pass, var, var->name);
+        /* Note: this goes beyond what MIDL does - it only supports arguments
+         * with the [range] attribute in Oicf mode */
+        if (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)));
+            const expr_t *range_min;
+            const expr_t *range_max;
+            expr_list_t *range_list = get_attrp(var->attrs, ATTR_RANGE);
+            if (!range_list)
+                range_list = get_aliaschain_attrp(type, ATTR_RANGE);
+            range_min = LIST_ENTRY(list_head(range_list), const expr_t, entry);
+            range_max = LIST_ENTRY(list_next(range_list, list_head(range_list)), const expr_t, entry);
+
+            print_file(file, indent, "if ((%s%s < (", local_var_prefix, var->name);
+            write_type_decl(file, var->type, NULL);
+            fprintf(file, ")0x%lx) || (%s%s > (", range_min->cval, local_var_prefix, var->name);
+            write_type_decl(file, var->type, NULL);
+            fprintf(file, ")0x%lx))\n", range_max->cval);
+            print_file(file, indent, "{\n");
+            print_file(file, indent+1, "RpcRaiseException(RPC_S_INVALID_BOUND);\n");
+            print_file(file, indent, "}\n");
         }
         break;
     case TGT_STRUCT:
@@ -3603,23 +3658,19 @@ static void write_remoting_arg(FILE *file, int indent, const var_t *func, const
     case TGT_POINTER:
     {
         const type_t *ref = type_pointer_get_ref(type);
-        if (pointer_type == RPC_FC_RP && !is_user_type(ref)) switch (type_get_type(ref))
+        if (pointer_type == RPC_FC_RP) switch (typegen_detect_type(ref, NULL, TDT_ALL_TYPES))
         {
-        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)
+        case TGT_BASIC:
                 print_phase_basetype(file, indent, local_var_prefix, phase, pass, var, var->name);
             break;
-        case TYPE_ENUM:
+        case TGT_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:
+        case TGT_STRUCT:
         {
             const char *struct_type = NULL;
             switch (get_struct_fc(ref))
@@ -3665,8 +3716,7 @@ static void write_remoting_arg(FILE *file, int indent, const var_t *func, const
             }
             break;
         }
-        case TYPE_UNION:
-        case TYPE_ENCAPSULATED_UNION:
+        case TGT_UNION:
         {
             const char *union_type = NULL;
             if (phase == PHASE_FREE)
@@ -3685,16 +3735,17 @@ static void write_remoting_arg(FILE *file, int indent, const var_t *func, const
                                  phase, var, start_offset);
             break;
         }
-        case TYPE_POINTER:
-        case TYPE_ARRAY:
+        case TGT_STRING:
+        case TGT_POINTER:
+        case TGT_ARRAY:
+        case TGT_RANGE:
+        case TGT_IFACE_POINTER:
+        case TGT_USER_TYPE:
+        case TGT_CTXT_HANDLE:
+        case TGT_CTXT_HANDLE_POINTER:
             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:
+        case TGT_INVALID:
             assert(0);
             break;
         }
@@ -3918,6 +3969,7 @@ void assign_stub_out_args( FILE *file, int indent, const var_t *func, const char
                 case TGT_BASIC:
                 case TGT_ENUM:
                 case TGT_POINTER:
+                case TGT_RANGE:
                     print_file(file, indent, "%s_W%u = 0;\n", local_var_prefix, i);
                     break;
                 case TGT_STRUCT:
index 8c8ba11..2b2e65d 100644 (file)
@@ -40,6 +40,7 @@ enum typegen_detect_flags
 {
     TDT_ALL_TYPES =      1 << 0,
     TDT_IGNORE_STRINGS = 1 << 1,
+    TDT_IGNORE_RANGES =  1 << 2,
 };
 
 enum typegen_type
@@ -56,6 +57,7 @@ enum typegen_type
     TGT_ENUM,
     TGT_STRUCT,
     TGT_UNION,
+    TGT_RANGE,
 };
 
 typedef int (*type_pred_t)(const type_t *);
index a27202f..ce099c8 100644 (file)
@@ -180,6 +180,21 @@ unsigned short get_type_vt(type_t *t)
         return VT_UI8;
       else
         return VT_I8;
+    case TYPE_BASIC_INT3264:
+      if (typelib_kind == SYS_WIN64)
+      {
+        if (type_basic_get_sign(t) > 0)
+          return VT_UI8;
+        else
+          return VT_I8;
+      }
+      else
+      {
+        if (type_basic_get_sign(t) > 0)
+          return VT_UI4;
+        else
+          return VT_I4;
+      }
     case TYPE_BASIC_FLOAT:
       return VT_R4;
     case TYPE_BASIC_DOUBLE:
@@ -228,6 +243,10 @@ unsigned short get_type_vt(type_t *t)
   case TYPE_FUNCTION:
     error("get_type_vt: functions not supported\n");
     break;
+
+  case TYPE_BITFIELD:
+    error("get_type_vt: bitfields not supported\n");
+    break;
   }
   return 0;
 }
index 58bad43..18e6cdb 100644 (file)
@@ -61,6 +61,8 @@ enum VARENUM {
     VT_LPSTR = 30,
     VT_LPWSTR = 31,
     VT_RECORD = 36,
+    VT_INT_PTR = 37,
+    VT_UINT_PTR = 38,
     VT_FILETIME = 64,
     VT_BLOB = 65,
     VT_STREAM = 66,
@@ -70,6 +72,7 @@ enum VARENUM {
     VT_BLOB_OBJECT = 70,
     VT_CF = 71,
     VT_CLSID = 72,
+    VT_VERSIONED_STREAM = 73,
     VT_BSTR_BLOB = 0xfff,
     VT_VECTOR = 0x1000,
     VT_ARRAY = 0x2000,
index 4359d92..a60e757 100644 (file)
@@ -63,9 +63,63 @@ type_t *make_type(enum type_type type)
     return t;
 }
 
+static const var_t *find_arg(const var_list_t *args, const char *name)
+{
+    const var_t *arg;
+
+    if (args) LIST_FOR_EACH_ENTRY(arg, args, const var_t, entry)
+    {
+        if (arg->name && !strcmp(name, arg->name))
+            return arg;
+    }
+
+    return NULL;
+}
+
 type_t *type_new_function(var_list_t *args)
 {
-    type_t *t = make_type(TYPE_FUNCTION);
+    var_t *arg;
+    type_t *t;
+    unsigned int i = 0;
+
+    if (args)
+    {
+        arg = LIST_ENTRY(list_head(args), var_t, entry);
+        if (list_count(args) == 1 && !arg->name && arg->type && type_get_type(arg->type) == TYPE_VOID)
+        {
+            list_remove(&arg->entry);
+            free(arg);
+            free(args);
+            args = NULL;
+        }
+    }
+    if (args) LIST_FOR_EACH_ENTRY(arg, args, var_t, entry)
+    {
+        if (arg->type && type_get_type(arg->type) == TYPE_VOID)
+            error_loc("argument '%s' has void type\n", arg->name);
+        if (!arg->name)
+        {
+            if (i > 26 * 26)
+                error_loc("too many unnamed arguments\n");
+            else
+            {
+                int unique;
+                do
+                {
+                    char name[3];
+                    name[0] = i > 26 ? 'a' + i / 26 : 'a' + i;
+                    name[1] = i > 26 ? 'a' + i % 26 : 0;
+                    name[2] = 0;
+                    unique = !find_arg(args, name);
+                    if (unique)
+                        arg->name = xstrdup(name);
+                    i++;
+                } while (!unique);
+            }
+        }
+    }
+
+    t = make_type(TYPE_FUNCTION);
     t->details.function = xmalloc(sizeof(*t->details.function));
     t->details.function->args = args;
     t->details.function->idx = -1;
@@ -248,6 +302,56 @@ type_t *type_new_encapsulated_union(char *name, var_t *switch_field, var_t *unio
     return t;
 }
 
+static int is_valid_bitfield_type(const type_t *type)
+{
+    switch (type_get_type(type))
+    {
+    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_INT3264:
+        case TYPE_BASIC_CHAR:
+        case TYPE_BASIC_HYPER:
+        case TYPE_BASIC_BYTE:
+        case TYPE_BASIC_WCHAR:
+        case TYPE_BASIC_ERROR_STATUS_T:
+            return TRUE;
+        case TYPE_BASIC_FLOAT:
+        case TYPE_BASIC_DOUBLE:
+        case TYPE_BASIC_HANDLE:
+            return FALSE;
+        }
+        return FALSE;
+    default:
+        return FALSE;
+    }
+}
+
+type_t *type_new_bitfield(type_t *field, const expr_t *bits)
+{
+    type_t *t;
+
+    if (!is_valid_bitfield_type(field))
+        error_loc("bit-field has invalid type\n");
+
+    if (bits->cval < 0)
+        error_loc("negative width for bit-field\n");
+
+    /* FIXME: validate bits->cval <= memsize(field) * 8 */
+
+    t = make_type(TYPE_BITFIELD);
+    t->details.bitfield.field = field;
+    t->details.bitfield.bits = bits;
+    return t;
+}
+
 static int compute_method_indexes(type_t *iface)
 {
     int idx;
index fb0401b..591406b 100644 (file)
@@ -39,6 +39,7 @@ 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);
+type_t *type_new_bitfield(type_t *field_type, const expr_t *bits);
 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);
@@ -190,6 +191,7 @@ static inline int type_is_complete(const type_t *type)
     case TYPE_COCLASS:
     case TYPE_POINTER:
     case TYPE_ARRAY:
+    case TYPE_BITFIELD:
         return TRUE;
     }
     return FALSE;
@@ -283,4 +285,18 @@ static inline unsigned char type_pointer_get_default_fc(const type_t *type)
     return type->details.pointer.def_fc;
 }
 
+static inline type_t *type_bitfield_get_field(const type_t *type)
+{
+    type = type_get_real_type(type);
+    assert(type_get_type(type) == TYPE_BITFIELD);
+    return type->details.bitfield.field;
+}
+
+static inline const expr_t *type_bitfield_get_bits(const type_t *type)
+{
+    type = type_get_real_type(type);
+    assert(type_get_type(type) == TYPE_BITFIELD);
+    return type->details.bitfield.bits;
+}
+
 #endif /* WIDL_TYPE_TREE_H */
index 2f1e9f7..f0afce4 100644 (file)
@@ -81,6 +81,7 @@ typedef struct list statement_list_t;
 enum attr_type
 {
     ATTR_AGGREGATABLE,
+    ATTR_ANNOTATION,
     ATTR_APPOBJECT,
     ATTR_ASYNC,
     ATTR_AUTO_HANDLE,
@@ -238,6 +239,7 @@ enum type_basic_type
     TYPE_BASIC_INT32,
     TYPE_BASIC_INT64,
     TYPE_BASIC_INT,
+    TYPE_BASIC_INT3264,
     TYPE_BASIC_CHAR,
     TYPE_BASIC_HYPER,
     TYPE_BASIC_BYTE,
@@ -350,6 +352,12 @@ struct pointer_details
   unsigned char def_fc;
 };
 
+struct bitfield_details
+{
+  struct _type_t *field;
+  const expr_t *bits;
+};
+
 enum type_type
 {
     TYPE_VOID,
@@ -365,6 +373,7 @@ enum type_type
     TYPE_INTERFACE,
     TYPE_POINTER,
     TYPE_ARRAY,
+    TYPE_BITFIELD,
 };
 
 struct _type_t {
@@ -382,6 +391,7 @@ struct _type_t {
     struct coclass_details coclass;
     struct basic_details basic;
     struct pointer_details pointer;
+    struct bitfield_details bitfield;
   } details;
   type_t *orig;                   /* dup'd types */
   unsigned int typestring_offset;
@@ -415,6 +425,7 @@ struct _declarator_t {
   type_t *type;
   type_t *func_type;
   array_dims_t *array;
+  expr_t *bits;
 
   /* parser-internal */
   struct list entry;