Merge 14551:14980 from trunk
authorCasper Hornstrup <chorns@users.sourceforge.net>
Thu, 5 May 2005 19:15:25 +0000 (19:15 +0000)
committerCasper Hornstrup <chorns@users.sourceforge.net>
Thu, 5 May 2005 19:15:25 +0000 (19:15 +0000)
svn path=/branches/xmlbuildsystem/; revision=15017

40 files changed:
1  2 
reactos/apps/utils/net/finger/net.c
reactos/drivers/dd/serial/devctrl.c
reactos/drivers/dd/serial/pnp.c
reactos/drivers/input/directory.xml
reactos/drivers/input/i8042prt/i8042prt.xml
reactos/drivers/input/kbdclass/kbdclass.xml
reactos/drivers/net/tcpip/tcpip/main.c
reactos/drivers/video/displays/vga/objects/copybits.c
reactos/hal/hal/hal.c
reactos/hal/halx86/generic/adapter.c
reactos/hal/halx86/generic/spinlock.c
reactos/include/idl/idl.xml
reactos/lib/advapi32/advapi32.xml
reactos/lib/cpl/intl/intl.xml
reactos/lib/cpl/intl/locale.c
reactos/lib/directory.xml
reactos/lib/iphlpapi/ifenum_reactos.c
reactos/lib/msi/msi.xml
reactos/lib/ntdll/ntdll.xml
reactos/lib/rtl/rtl.xml
reactos/lib/wininet/wininet.xml
reactos/ntoskrnl/io/deviface.c
reactos/ntoskrnl/io/pnpnotify.c
reactos/ntoskrnl/kd/wrappers/gdbstub.c
reactos/ntoskrnl/ntoskrnl.xml
reactos/services/eventlog/eventlog.c
reactos/services/umpnpmgr/umpnpmgr.c
reactos/subsys/system/cmd/cmd.xml
reactos/subsys/system/explorer/taskbar/startmenu.cpp
reactos/subsys/system/services/services.xml
reactos/subsys/system/usetup/usetup.xml
reactos/subsys/win32k/main/dllmain.c
reactos/tools/cabman/cabinet.cxx
reactos/tools/rbuild/backend/mingw/modulehandler.cpp
reactos/tools/rbuild/backend/mingw/modulehandler.h
reactos/tools/rbuild/module.cpp
reactos/tools/rbuild/rbuild.h
reactos/tools/winebuild/main.c
reactos/tools/wrc/parser.y
reactos/tools/wrc/y.tab.c

   * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   */
 -
 -#ifndef lint
 -static char sccsid[] = "@(#)net.c     8.4 (Berkeley) 4/28/95";
 -#endif /* not lint */
--
  #include <sys/types.h>
  #include <winsock2.h>
  #include "unistd.h"
@@@ -195,6 -200,7 +200,7 @@@ SerialGetPerfStats(IN PIRP pIrp
        PSERIAL_DEVICE_EXTENSION pDeviceExtension;
        pDeviceExtension = (PSERIAL_DEVICE_EXTENSION)
                IoGetCurrentIrpStackLocation(pIrp)->DeviceObject->DeviceExtension;
 -      ASSERT(DeviceExtension);
++      ASSERT(pDeviceExtension);
        /*
         * we assume buffer is big enough to hold SerialPerfStats structure
         * caller must verify this
@@@ -26,12 -26,14 +26,14 @@@ SerialAddDeviceInternal
        NTSTATUS Status;
        WCHAR DeviceNameBuffer[32];
        UNICODE_STRING DeviceName;
-       //UNICODE_STRING SymbolicLinkName;
        static ULONG DeviceNumber = 0;
        static ULONG ComPortNumber = 1;
+       
        DPRINT("Serial: SerialAddDeviceInternal called\n");
-    
+       
 -      ASSERT(DeviceObject);
++      ASSERT(DriverObject);
+       ASSERT(Pdo);
+       
        /* Create new device object */
        swprintf(DeviceNameBuffer, L"\\Device\\Serial%lu", DeviceNumber);
        RtlInitUnicodeString(&DeviceName, DeviceNameBuffer);
index 19e345a,0000000..b4a50d0
mode 100644,000000..100644
--- /dev/null
@@@ -1,12 -1,0 +1,12 @@@
- <directory name="keyboard">\r
-       <xi:include href="keyboard/keyboard.xml" />\r
++<directory name="i8042prt">\r
++      <xi:include href="i8042prt/i8042prt.xml" />\r
++</directory>\r
++<directory name="kbdclass">\r
++      <xi:include href="kbdclass/kbdclass.xml" />\r
 +</directory>\r
 +<directory name="mouclass">\r
 +      <xi:include href="mouclass/mouclass.xml" />\r
 +</directory>\r
- <directory name="psaux">\r
-       <xi:include href="psaux/psaux.xml" />\r
- </directory>\r
 +<directory name="sermouse">\r
 +      <xi:include href="sermouse/sermouse.xml" />\r
 +</directory>\r
index 0000000,0000000..0a19173
new file mode 100644 (file)
--- /dev/null
--- /dev/null
@@@ -1,0 -1,0 +1,13 @@@
++<module name="i8042prt" type="kernelmodedriver" installbase="system32/drivers" installname="i8042prt.sys">
++      <bootstrap base="reactos" />
++      <include base="i8042prt">.</include>
++      <define name="__USE_W32API" />
++      <library>ntoskrnl</library>
++      <library>hal</library>
++      <file>i8042prt.c</file>
++      <file>keyboard.c</file>
++      <file>mouse.c</file>
++      <file>ps2pp.c</file>
++      <file>registry.c</file>
++      <file>i8042prt.rc</file>
++</module>
index 0000000,0000000..b0c8348
new file mode 100644 (file)
--- /dev/null
--- /dev/null
@@@ -1,0 -1,0 +1,9 @@@
++<module name="kbdclass" type="kernelmodedriver" installbase="system32/drivers" installname="kbdclass.sys">
++      <bootstrap base="reactos" />
++      <include base="kbdclass">.</include>
++      <define name="__USE_W32API" />
++      <library>ntoskrnl</library>
++      <library>hal</library>
++      <file>kbdclass.c</file>
++      <file>kbdclass.rc</file>
++</module>
@@@ -1,7 -1,7 +1,5 @@@
  #include "../vgaddi.h"
  #include "../vgavideo/vgavideo.h"
--
--#define DBG
  #include <debug.h>
  
  BOOL STDCALL
Simple merge
@@@ -19,6 -19,6 +19,9 @@@
  #include <internal/debug.h>
  #include <hal.h>
  
++/* Hmm, needed for KDBG := 1. Why? */
++#undef KeGetCurrentIrql
++
  /* FUNCTIONS *****************************************************************/
  
  /* NOTE: IoAllocateAdapterChannel in NTOSKRNL.EXE */
@@@ -21,6 -21,6 +21,9 @@@
  
  #include <internal/debug.h>
  
++/* Hmm, needed for KDBG := 1. Why? */
++#undef KeGetCurrentIrql
++
  /* FUNCTIONS ***************************************************************/
  
  VOID STDCALL
index 57f5d45,0000000..3febc40
mode 100644,000000..100644
--- /dev/null
@@@ -1,12 -1,0 +1,24 @@@
 +<module name="pnp_server" type="rpcserver">
 +      <include base="ReactOS">.</include>
 +      <include base="ReactOS">w32api/include</include>
 +      <define name="_X86_" />
 +      <file>pnp.idl</file>
 +</module>
 +<module name="pnp_client" type="rpcclient">
 +      <include base="ReactOS">.</include>
 +      <include base="ReactOS">w32api/include</include>
 +      <define name="_X86_" />
 +      <file>pnp.idl</file>
 +</module>
++<module name="scm_server" type="rpcserver">
++      <include base="ReactOS">.</include>
++      <include base="ReactOS">w32api/include</include>
++      <define name="_X86_" />
++      <file switches="-o">svcctl.idl</file>
++</module>
++<module name="scm_client" type="rpcclient">
++      <include base="ReactOS">.</include>
++      <include base="ReactOS">w32api/include</include>
++      <define name="_X86_" />
++      <file switches="-o">svcctl.idl</file>
++</module>
index b80dbfd,0000000..e7d5b0b
mode 100644,000000..100644
--- /dev/null
@@@ -1,49 -1,0 +1,52 @@@
 +<module name="advapi32" type="win32dll" baseaddress="${BASEADDRESS_ADVAPI32}"  installbase="system32" installname="advapi32.dll">\r
 +      <importlibrary definition="advapi32.def" />\r
 +      <include base="advapi32">.</include>\r
++      <include base="ReactOS">include/idl</include>\r
 +      <define name="__USE_W32API" />\r
 +      <define name="WINVER">0x600</define>\r
 +      <define name="_WIN32_IE">0x0500</define>\r
 +      <define name="_WIN32_WINNT">0x0501</define>\r
++      <library>scm_client</library>\r
 +      <library>ntdll</library>\r
 +      <library>kernel32</library>\r
++      <library>rpcrt4</library>\r
 +      <pch>advapi32.h</pch>\r
 +      <directory name="crypt">\r
 +              <file>crypt.c</file>\r
 +              <file>crypt_des.c</file>\r
 +              <file>crypt_lmhash.c</file>\r
 +              <file>crypt_md4.c</file>\r
 +              <file>crypt_md5.c</file>\r
 +              <file>crypt_sha.c</file>\r
 +      </directory>\r
 +      <directory name="misc">\r
 +              <file>dllmain.c</file>\r
 +              <file>hwprofiles.c</file>\r
 +              <file>logon.c</file>\r
 +              <file>shutdown.c</file>\r
 +              <file>sysfunc.c</file>\r
 +      </directory>\r
 +      <directory name="reg">\r
 +              <file>reg.c</file>\r
 +      </directory>\r
 +      <directory name="sec">\r
 +              <file>ac.c</file>\r
 +              <file>audit.c</file>\r
 +              <file>lsa.c</file>\r
 +              <file>misc.c</file>\r
 +              <file>sec.c</file>\r
 +              <file>sid.c</file>\r
 +              <file>trustee.c</file>\r
 +      </directory>\r
 +      <directory name="service">\r
 +              <file>eventlog.c</file>\r
 +              <file>scm.c</file>\r
 +              <file>sctrl.c</file>\r
 +              <file>undoc.c</file>\r
 +      </directory>\r
 +      <directory name="token">\r
 +              <file>privilege.c</file>\r
 +              <file>token.c</file>\r
 +      </directory>\r
 +      <file>advapi32.rc</file>\r
 +</module>\r
index cc89345,0000000..2ffa77e
mode 100644,000000..100644
--- /dev/null
@@@ -1,21 -1,0 +1,21 @@@
- <module name="intl" type="win32dll" extension=".cpl" baseaddress="${BASEADDRESS_INTL}" installbase="system32" installname="intl.cpl">\r
++<module name="intl" type="win32dll" extension=".cpl" baseaddress="${BASEADDRESS_INTL}" installbase="system32" installname="intl.cpl" usewrc="false">\r
 +      <importlibrary definition="intl.def" />\r
 +      <include base="intl">.</include>\r
 +      <define name="UNICODE" />\r
 +      <define name="_UNICODE" />\r
 +      <define name="__REACTOS__" />\r
 +      <define name="__USE_W32API" />\r
 +      <define name="_WIN32_IE">0x600</define>\r
 +      <define name="_WIN32_WINNT">0x501</define>\r
 +      <library>kernel32</library>\r
 +      <library>user32</library>\r
 +      <library>comctl32</library>\r
 +      <file>currency.c</file>\r
 +      <file>date.c</file>\r
 +      <file>general.c</file>\r
 +      <file>intl.c</file>\r
 +      <file>locale.c</file>\r
 +      <file>numbers.c</file>\r
 +      <file>time.c</file>\r
 +      <file>intl.rc</file>\r
 +</module>\r
@@@ -292,16 -125,59 +125,59 @@@ LocalePageProc(HWND hwndDlg
               WPARAM wParam,
               LPARAM lParam)
  {
-   switch(uMsg)
-   {
-     case WM_INITDIALOG:
-       CreateTimeZoneList();
-       ShowTimeZoneList(GetDlgItem(hwndDlg, IDC_LANGUAGELIST));
+       switch(uMsg)
+       {
+       case WM_INITDIALOG:
+               CreateLanguagesList(GetDlgItem(hwndDlg, IDC_LANGUAGELIST));
+               break;
+       case WM_COMMAND:
+               switch (LOWORD(wParam))
+               {
+               case IDC_LANGUAGELIST:
+                       if (HIWORD(wParam) == CBN_SELCHANGE)
+                       {
+                               PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
+                       }
+                       break;
+               }
+               break;
  
-       break;
-   }
-   return FALSE;
+       case WM_NOTIFY:
+               {
+                       LPNMHDR lpnm = (LPNMHDR)lParam;
+                       if (lpnm->code == PSN_APPLY)
+                       {
+                               // Apply changes
+                               LCID NewLcid;
+                               int iCurSel;
+                               char tmp[100];
+                               // Acquire new value
+                               iCurSel = SendMessageW(hList,
+                                       CB_GETCURSEL,
+                                       0,
+                                       0);
+                               if (iCurSel == CB_ERR)
+                                       break;
+                               NewLcid = SendMessageW(hList,
+                                       CB_GETITEMDATA,
+                                       iCurSel,
+                                       0);
+                               if (NewLcid == CB_ERR)
+                                       break;
+                               //TOOD: Actually set new locale
 -                              sprintf(tmp, "%x, cursel=%d", NewLcid, iCurSel);
++                              sprintf(tmp, "%lx, cursel=%d", NewLcid, iCurSel);
+                               MessageBoxA(hwndDlg, tmp, "debug", MB_OK);
+                       }
+               }
+               break;
+       }
+       return FALSE;
  }
  
  
index 05fd22a,0000000..a8ce08f
mode 100644,000000..100644
--- /dev/null
@@@ -1,285 -1,0 +1,291 @@@
 +<directory name="acledit">\r
 +      <xi:include href="acledit/acledit.xml" />\r
 +</directory>\r
 +<directory name="aclui">\r
 +      <xi:include href="aclui/aclui.xml" />\r
 +</directory>\r
 +<directory name="adns">\r
 +      <xi:include href="adns/adns.xml" />\r
 +</directory>\r
 +<directory name="advapi32">\r
 +      <xi:include href="advapi32/advapi32.xml" />\r
 +</directory>\r
 +<directory name="advpack">\r
 +      <xi:include href="advpack/advpack.xml" />\r
 +</directory>\r
 +<directory name="cabinet">\r
 +      <xi:include href="cabinet/cabinet.xml" />\r
 +</directory>\r
 +<directory name="cards">\r
 +      <xi:include href="cards/cards.xml" />\r
 +</directory>\r
 +<directory name="comctl32">\r
 +      <xi:include href="comctl32/comctl32.xml" />\r
 +</directory>\r
 +<directory name="comdlg32">\r
 +      <xi:include href="comdlg32/comdlg32.xml" />\r
 +</directory>\r
 +<directory name="cpl">\r
 +      <xi:include href="cpl/directory.xml" />\r
 +</directory>\r
 +<directory name="crt">\r
 +      <xi:include href="crt/crt.xml" />\r
 +</directory>\r
 +<directory name="crtdll">\r
 +      <xi:include href="crtdll/crtdll.xml" />\r
 +</directory>\r
 +<directory name="dbghelp">\r
 +      <xi:include href="dbghelp/dbghelp.xml" />\r
 +</directory>\r
 +<directory name="devenum">\r
 +      <xi:include href="devenum/devenum.xml" />\r
 +</directory>\r
 +<directory name="dinput">\r
 +      <xi:include href="dinput/dinput.xml" />\r
 +</directory>\r
 +<directory name="dinput8">\r
 +      <xi:include href="dinput8/dinput8.xml" />\r
 +</directory>\r
 +<directory name="dnsapi">\r
 +      <xi:include href="dnsapi/dnsapi.xml" />\r
 +</directory>\r
 +<directory name="dsound">\r
 +      <xi:include href="dsound/dsound.xml" />\r
 +</directory>\r
 +<directory name="dxdiagn">\r
 +      <xi:include href="dxdiagn/dxdiagn.xml" />\r
 +</directory>\r
 +<directory name="dxguid">\r
 +      <xi:include href="dxguid/dxguid.xml" />\r
 +</directory>\r
 +<directory name="epsapi">\r
 +      <xi:include href="epsapi/epsapi.xml" />\r
 +</directory>\r
 +<directory name="expat">\r
 +      <xi:include href="expat/expat.xml" />\r
 +</directory>\r
 +<directory name="fmifs">\r
 +      <xi:include href="fmifs/fmifs.xml" />\r
 +</directory>\r
 +<directory name="freetype">\r
 +      <xi:include href="freetype/freetype.xml" />\r
 +</directory>\r
 +<directory name="fslib">\r
 +      <xi:include href="fslib/directory.xml" />\r
 +</directory>\r
 +<directory name="gdi32">\r
 +      <xi:include href="gdi32/gdi32.xml" />\r
 +</directory>\r
 +<directory name="gdiplus">\r
 +      <xi:include href="gdiplus/gdiplus.xml" />\r
 +</directory>\r
 +<directory name="glu32">\r
 +      <xi:include href="glu32/glu32.xml" />\r
 +</directory>\r
 +<directory name="imagehlp">\r
 +      <xi:include href="imagehlp/imagehlp.xml" />\r
 +</directory>\r
 +<directory name="imm32">\r
 +      <xi:include href="imm32/imm32.xml" />\r
 +</directory>\r
 +<directory name="iphlpapi">\r
 +      <xi:include href="iphlpapi/iphlpapi.xml" />\r
 +</directory>\r
 +<directory name="kbdda">\r
 +      <xi:include href="kbdda/kbdda.xml" />\r
 +</directory>\r
 +<directory name="kbddv">\r
 +      <xi:include href="kbddv/kbddv.xml" />\r
 +</directory>\r
 +<directory name="kbdes">\r
 +      <xi:include href="kbdes/kbdes.xml" />\r
 +</directory>\r
 +<directory name="kbdfr">\r
 +      <xi:include href="kbdfr/kbdfr.xml" />\r
 +</directory>\r
 +<directory name="kbdgr">\r
 +      <xi:include href="kbdgr/kbdgr.xml" />\r
 +</directory>\r
++<directory name="kbdru">\r
++      <xi:include href="kbdru/kbdru.xml" />\r
++</directory>\r
 +<directory name="kbdse">\r
 +      <xi:include href="kbdse/kbdse.xml" />\r
 +</directory>\r
++<directory name="kbdsg">\r
++      <xi:include href="kbdsg/kbdsg.xml" />\r
++</directory>\r
 +<directory name="kbduk">\r
 +      <xi:include href="kbduk/kbduk.xml" />\r
 +</directory>\r
 +<directory name="kbdus">\r
 +      <xi:include href="kbdus/kbdus.xml" />\r
 +</directory>\r
 +<directory name="kernel32">\r
 +      <xi:include href="kernel32/kernel32.xml" />\r
 +</directory>\r
 +<directory name="kjs">\r
 +      <xi:include href="kjs/kjs.xml" />\r
 +</directory>\r
 +<directory name="libwine">\r
 +      <xi:include href="libwine/libwine.xml" />\r
 +</directory>\r
 +<directory name="lzexpand">\r
 +      <xi:include href="lzexpand/lz32.xml" />\r
 +</directory>\r
 +<directory name="mesa32">\r
 +      <xi:include href="mesa32/mesa32.xml" />\r
 +</directory>\r
 +<directory name="midimap">\r
 +      <xi:include href="midimap/midimap.xml" />\r
 +</directory>\r
 +<directory name="mmdrv">\r
 +      <xi:include href="mmdrv/mmdrv.xml" />\r
 +</directory>\r
 +<directory name="mpr">\r
 +      <xi:include href="mpr/mpr.xml" />\r
 +</directory>\r
 +<directory name="msacm">\r
 +      <xi:include href="msacm/msacm32.xml" />\r
 +</directory>\r
 +<directory name="msafd">\r
 +      <xi:include href="msafd/msafd.xml" />\r
 +</directory>\r
 +<directory name="msgina">\r
 +      <xi:include href="msgina/msgina.xml" />\r
 +</directory>\r
 +<directory name="msi">\r
 +      <xi:include href="msi/msi.xml" />\r
 +</directory>\r
 +<directory name="msimg32">\r
 +      <xi:include href="msimg32/msimg32.xml" />\r
 +</directory>\r
 +<directory name="msvcrt">\r
 +      <xi:include href="msvcrt/msvcrt.xml" />\r
 +</directory>\r
 +<directory name="msvcrt20">\r
 +      <xi:include href="msvcrt20/msvcrt20.xml" />\r
 +</directory>\r
 +<directory name="netapi32">\r
 +      <xi:include href="netapi32/netapi32.xml" />\r
 +</directory>\r
 +<directory name="ntdll">\r
 +      <xi:include href="ntdll/ntdll.xml" />\r
 +</directory>\r
 +<directory name="ole32">\r
 +      <xi:include href="ole32/ole32.xml" />\r
 +</directory>\r
 +<directory name="oleaut32">\r
 +      <xi:include href="oleaut32/oleaut32.xml" />\r
 +</directory>\r
 +<directory name="olepro32">\r
 +      <xi:include href="olepro32/olepro32.xml" />\r
 +</directory>\r
 +<directory name="opengl32">\r
 +      <xi:include href="opengl32/opengl32.xml" />\r
 +</directory>\r
 +<directory name="psapi">\r
 +      <xi:include href="psapi/psapi.xml" />\r
 +</directory>\r
 +<directory name="pseh">\r
 +      <xi:include href="pseh/pseh.xml" />\r
 +</directory>\r
 +<directory name="richedit">\r
 +      <xi:include href="richedit/riched32.xml" />\r
 +</directory>\r
 +<directory name="riched20">\r
 +      <xi:include href="riched20/riched20.xml" />\r
 +</directory>\r
 +<directory name="rosrtl">\r
 +      <xi:include href="rosrtl/rosrtl.xml" />\r
 +</directory>\r
 +<directory name="rossym">\r
 +      <xi:include href="rossym/rossym.xml" />\r
 +</directory>\r
 +<directory name="rpcrt4">\r
 +      <xi:include href="rpcrt4/rpcrt4.xml" />\r
 +</directory>\r
 +<directory name="rtl">\r
 +      <xi:include href="rtl/rtl.xml" />\r
 +</directory>\r
 +<directory name="samlib">\r
 +      <xi:include href="samlib/samlib.xml" />\r
 +</directory>\r
 +<directory name="secur32">\r
 +      <xi:include href="secur32/secur32.xml" />\r
 +</directory>\r
 +<directory name="serialui">\r
 +      <xi:include href="serialui/serialui.xml" />\r
 +</directory>\r
 +<directory name="setupapi">\r
 +      <xi:include href="setupapi/setupapi.xml" />\r
 +</directory>\r
 +<directory name="shdocvw">\r
 +      <xi:include href="shdocvw/shdocvw.xml" />\r
 +</directory>\r
 +<directory name="shell32">\r
 +      <xi:include href="shell32/shell32.xml" />\r
 +</directory>\r
 +<directory name="shlwapi">\r
 +      <xi:include href="shlwapi/shlwapi.xml" />\r
 +</directory>\r
 +<directory name="snmpapi">\r
 +      <xi:include href="snmpapi/snmpapi.xml" />\r
 +</directory>\r
 +<directory name="smdll">\r
 +      <xi:include href="smdll/smdll.xml" />\r
 +</directory>\r
 +<directory name="smlib">\r
 +      <xi:include href="smlib/smlib.xml" />\r
 +</directory>\r
 +<directory name="string">\r
 +      <xi:include href="string/string.xml" />\r
 +</directory>\r
 +<directory name="strmiids">\r
 +      <xi:include href="strmiids/strmiids.xml" />\r
 +</directory>\r
 +<directory name="syssetup">\r
 +      <xi:include href="syssetup/syssetup.xml" />\r
 +</directory>\r
 +<directory name="twain">\r
 +      <xi:include href="twain/twain_32.xml" />\r
 +</directory>\r
 +<directory name="urlmon">\r
 +      <xi:include href="urlmon/urlmon.xml" />\r
 +</directory>\r
 +<directory name="user32">\r
 +      <xi:include href="user32/user32.xml" />\r
 +</directory>\r
 +<directory name="userenv">\r
 +      <xi:include href="userenv/userenv.xml" />\r
 +</directory>\r
 +<directory name="uuid">\r
 +      <xi:include href="uuid/uuid.xml" />\r
 +</directory>\r
 +<directory name="version">\r
 +      <xi:include href="version/version.xml" />\r
 +</directory>\r
 +<directory name="wininet">\r
 +      <xi:include href="wininet/wininet.xml" />\r
 +</directory>\r
 +<directory name="winmm">\r
 +      <xi:include href="winmm/winmm.xml" />\r
 +</directory>\r
 +<directory name="winspool">\r
 +      <xi:include href="winspool/winspool.xml" />\r
 +</directory>\r
 +<directory name="ws2_32">\r
 +      <xi:include href="ws2_32/ws2_32.xml" />\r
 +</directory>\r
 +<directory name="ws2help">\r
 +      <xi:include href="ws2help/ws2help.xml" />\r
 +</directory>\r
 +<directory name="wshirda">\r
 +      <xi:include href="wshirda/wshirda.xml" />\r
 +</directory>\r
 +<directory name="wsock32">\r
 +      <xi:include href="wsock32/wsock32.xml" />\r
 +</directory>\r
 +<directory name="zlib">\r
 +      <xi:include href="zlib/zlib.xml" />\r
 +</directory>\r
Simple merge
index 1514fca,0000000..221c50f
mode 100644,000000..100644
--- /dev/null
@@@ -1,52 -1,0 +1,53 @@@
 +<module name="msi" type="win32dll" baseaddress="${BASEADDRESS_MSI}" installbase="system32" installname="msi.dll" warnings="true">
 +      <importlibrary definition="msi.spec.def" />
 +      <include base="msi">.</include>
 +      <include base="ReactOS">include/wine</include>
 +      <define name="__REACTOS__" />
 +      <define name="__USE_W32API" />
 +      <define name="_WIN32_IE">0x600</define>
 +      <define name="_WIN32_WINNT">0x501</define>
 +      <define name="WINVER">0x501</define>
 +      <library>wine</library>
 +      <library>uuid</library>
 +      <library>ntdll</library>
 +      <library>kernel32</library>
 +      <library>user32</library>
 +      <library>gdi32</library>
 +      <library>advapi32</library>
 +      <library>shell32</library>
 +      <library>winmm</library>
 +      <library>cabinet</library>
 +      <library>ole32</library>
 +      <library>oleaut32</library>
 +      <library>version</library>
 +      <file>action.c</file>
 +      <file>appsearch.c</file>
 +      <file>cond.tab.c</file>
 +      <file>create.c</file>
 +      <file>custom.c</file>
++      <file>database.c</file>
 +      <file>delete.c</file>
 +      <file>dialog.c</file>
 +      <file>distinct.c</file>
 +      <file>format.c</file>
 +      <file>handle.c</file>
 +      <file>insert.c</file>
 +      <file>msi.c</file>
 +      <file>msiquery.c</file>
 +      <file>order.c</file>
 +      <file>package.c</file>
 +      <file>preview.c</file>
 +      <file>record.c</file>
 +      <file>registry.c</file>
 +      <file>regsvr.c</file>
 +      <file>select.c</file>
 +      <file>sql.tab.c</file>
 +      <file>string.c</file>
 +      <file>suminfo.c</file>
 +      <file>table.c</file>
 +      <file>tokenize.c</file>
 +      <file>update.c</file>
 +      <file>where.c</file>
 +      <file>msi.spec</file>
 +      <file>msi.rc</file>
 +</module>
index fcb08f1,0000000..96ac96c
mode 100644,000000..100644
--- /dev/null
@@@ -1,107 -1,0 +1,96 @@@
-                       <file>alldiv.s</file>\r
-                       <file>allmul.s</file>\r
-                       <file>allrem.s</file>\r
-                       <file>allshl.s</file>\r
-                       <file>allshr.s</file>\r
-                       <file>aulldiv.s</file>\r
-                       <file>aullrem.s</file>\r
-                       <file>aullshr.s</file>\r
-                       <file>exception.c</file>\r
-                       <file>float.c</file>\r
 +<module name="ntdll" type="nativedll" baseaddress="${BASEADDRESS_NTDLL}" installbase="system32" installname="ntdll.dll">\r
 +      <bootstrap base="reactos/system32" />\r
 +      <importlibrary definition="def/ntdll.def" />\r
 +      <define name="__NTDLL__" />\r
 +      <define name="_DISABLE_TIDENTS" />\r
 +      <library>rtl</library>\r
 +      <library>rosrtl</library>\r
 +      <library>string</library>\r
 +      <linkerflag>-lgcc</linkerflag>\r
 +      <directory name="csr">\r
 +              <file>capture.c</file>\r
 +              <file>lpc.c</file>\r
 +              <file>probe.c</file>\r
 +              <file>thread.c</file>\r
 +      </directory>\r
 +      <directory name="dbg">\r
 +              <file>brkpoint.c</file>\r
 +              <file>debug.c</file>\r
 +              <file>print.c</file>\r
 +      </directory>\r
 +      <directory name="ldr">\r
 +              <file>entry.S</file>\r
 +              <file>res.c</file>\r
 +              <file>startup.c</file>\r
 +              <file>utils.c</file>\r
 +      </directory>\r
 +      <directory name="main">\r
 +              <file>dllmain.c</file>\r
 +      </directory>\r
 +      <directory name="rtl">\r
 +              <directory name="i386">\r
-               <file>access.c</file>\r
 +                      <file>ftol.c</file>\r
 +              </directory>\r
 +              <file>apc.c</file>\r
 +              <file>atom.c</file>\r
 +              <file>callback.c</file>\r
 +              <file>crc32.c</file>\r
 +              <file>critical.c</file>\r
 +              <file>dbgbuffer.c</file>\r
 +              <file>exception.c</file>\r
 +              <file>handle.c</file>\r
 +              <file>intrlck.c</file>\r
 +              <file>libsupp.c</file>\r
 +              <file>math.c</file>\r
 +              <file>message.c</file>\r
 +              <file>misc.c</file>\r
 +              <file>path.c</file>\r
 +              <file>process.c</file>\r
 +              <file>propvar.c</file>\r
 +              <file>rangelist.c</file>\r
 +              <file>resource.c</file>\r
 +              <file>teb.c</file>\r
 +              <file>timerqueue.c</file>\r
 +      </directory>\r
 +      <directory name="stdio">\r
 +              <file>sprintf.c</file>\r
 +              <file>sscanf.c</file>\r
 +              <file>swprintf.c</file>\r
 +      </directory>\r
 +      <directory name="stdlib">\r
 +              <file>abs.c</file>\r
 +              <file>atoi64.c</file>\r
 +              <file>atoi.c</file>\r
 +              <file>atol.c</file>\r
 +              <file>bsearch.c</file>\r
 +              <file>itoa.c</file>\r
 +              <file>itow.c</file>\r
 +              <file>labs.c</file>\r
 +              <file>lfind.c</file>\r
 +              <file>mbstowcs.c</file>\r
 +              <file>splitp.c</file>\r
 +              <file>strtol.c</file>\r
 +              <file>strtoul.c</file>\r
 +              <file>wcstol.c</file>\r
 +              <file>wcstombs.c</file>\r
 +              <file>wcstoul.c</file>\r
 +              <file>wtoi64.c</file>\r
 +              <file>wtoi.c</file>\r
 +              <file>wtol.c</file>\r
 +      </directory>\r
 +      <directory name="string">\r
 +              <file>ctype.c</file>\r
 +              <file>memicmp.c</file>\r
 +              <file>stricmp.c</file>\r
 +              <file>strlwr.c</file>\r
 +              <file>strnicmp.c</file>\r
 +              <file>strpbrk.c</file>\r
 +              <file>strstr.c</file>\r
 +              <file>strupr.c</file>\r
 +              <file>wstring.c</file>\r
 +      </directory>\r
 +      <directory name="def">\r
 +              <file>ntdll.rc</file>\r
 +      </directory>\r
 +      <file>napi.S</file>\r
 +</module>\r
index 9a68976,0000000..189d288
mode 100644,000000..100644
--- /dev/null
@@@ -1,39 -1,0 +1,48 @@@
 +<module name="rtl" type="staticlibrary">\r
 +      <directory name="i386">\r
++              <file>allshl.s</file>\r
++              <file>aulldiv.s</file>\r
++              <file>aullrem.s</file>\r
++              <file>allshr.s</file>\r
++              <file>allmul.s</file>\r
++              <file>aullshr.s</file>\r
++              <file>alldiv.s</file>\r
++              <file>allrem.s</file>\r
 +              <file>chkstk.s</file>\r
 +              <file>except.s</file>\r
 +              <file>exception.c</file>\r
 +      </directory>\r
++      <file>access.c</file>\r
 +      <file>acl.c</file>\r
 +      <file>bit.c</file>\r
 +      <file>bitmap.c</file>\r
 +      <file>bootdata.c</file>\r
 +      <file>compress.c</file>\r
 +      <file>dos8dot3.c</file>\r
 +      <file>encode.c</file>\r
 +      <file>env.c</file>\r
 +      <file>error.c</file>\r
 +      <file>exception.c</file>\r
 +      <file>generictable.c</file>\r
 +      <file>heap.c</file>\r
 +      <file>image.c</file>\r
 +      <file>largeint.c</file>\r
 +      <file>luid.c</file>\r
 +      <file>mem.c</file>\r
 +      <file>network.c</file>\r
 +      <file>nls.c</file>\r
 +      <file>ppb.c</file>\r
 +      <file>process.c</file>\r
 +      <file>random.c</file>\r
 +      <file>registry.c</file>\r
 +      <file>sd.c</file>\r
 +      <file>security.c</file>\r
 +      <file>sid.c</file>\r
 +      <file>splaytree.c</file>\r
 +      <file>thread.c</file>\r
 +      <file>time.c</file>\r
 +      <file>timezone.c</file>\r
 +      <file>unicode.c</file>\r
 +      <file>unicodeprefix.c</file>\r
 +      <file>version.c</file>\r
 +</module>\r
index 0000000,0000000..cf0a497
new file mode 100644 (file)
--- /dev/null
--- /dev/null
@@@ -1,0 -1,0 +1,34 @@@
++<module name="wininet" type="win32dll" baseaddress="${BASEADDRESS_WININET}" installbase="system32" installname="wininet.dll" warnings="true">
++      <importlibrary definition="wininet.spec.def" />
++      <include base="wininet">.</include>
++      <include base="ReactOS">include/wine</include>
++      <define name="UNICODE" />
++      <define name="_UNICODE" />
++      <define name="__REACTOS__" />
++      <define name="__USE_W32API" />
++      <define name="_WIN32_IE">0x600</define>
++      <define name="_WIN32_WINNT">0x501</define>
++      <define name="WINVER">0x501</define>
++      <library>wine</library>
++      <library>ntdll</library>
++      <library>kernel32</library>
++      <library>user32</library>
++      <library>advapi32</library>
++      <library>shell32</library>
++      <library>shlwapi</library>
++      <library>mpr</library>
++      <library>ws2_32</library>
++      <file>cookie.c</file>
++      <file>dialogs.c</file>
++      <file>ftp.c</file>
++      <file>gopher.c</file>
++      <file>http.c</file>
++      <file>internet.c</file>
++      <file>netconnection.c</file>
++      <file>urlcache.c</file>
++      <file>utility.c</file>
++      <file>wininet_main.c</file>
++      <file>rsrc.rc</file>
++      <file>version.rc</file>
++      <file>wininet.spec</file>
++</module>
Simple merge
Simple merge
@@@ -150,19 -165,68 +165,19 @@@ static CPU_REGISTER GspRegisters[NUMREG
    { 4, FIELD_OFFSET (KTRAP_FRAME_X86, Fs), FIELD_OFFSET (CONTEXT, SegFs), TRUE },
    { 4, FIELD_OFFSET (KTRAP_FRAME_X86, Gs), FIELD_OFFSET (CONTEXT, SegGs), TRUE }
  };
- static PCHAR GspThreadStates[THREAD_STATE_MAX] =
- {
-   "Initialized",  /* THREAD_STATE_INITIALIZED */
-   "Ready",        /* THREAD_STATE_READY */
-   "Running",      /* THREAD_STATE_RUNNING */
-   "Suspended",    /* THREAD_STATE_SUSPENDED */
-   "Frozen",       /* THREAD_STATE_FROZEN */
-   "Terminated 1", /* THREAD_STATE_TERMINATED_1 */
-   "Terminated 2", /* THREAD_STATE_TERMINATED_2 */
-   "Blocked"       /* THREAD_STATE_BLOCKED */
+                                                                                 
+ static PCHAR GspThreadStates[DeferredReady+1] =
+ { "Initialized", 
+   "Ready", 
+   "Running",
+   "Standby", 
+   "Terminated", 
+   "Waiting",
+   "Transition", 
+   "DeferredReady" 
  };
  
 -char *
 -strtok(char *s, const char *delim)
 -{
 -  const char *spanp;
 -  int c, sc;
 -  char *tok;
 -  static char *last;
 -
 -
 -  if (s == NULL && (s = last) == NULL)
 -    return (NULL);
 -
 -  /*
 -   * Skip (span) leading delimiters (s += strspn(s, delim), sort of).
 -   */
 - cont:
 -  c = *s++;
 -  for (spanp = delim; (sc = *spanp++) != 0;) {
 -    if (c == sc)
 -      goto cont;
 -  }
 -
 -  if (c == 0) {                       /* no non-delimiter characters */
 -    last = NULL;
 -    return (NULL);
 -  }
 -  tok = s - 1;
 -
 -  /*
 -   * Scan token (scan for delimiters: s += strcspn(s, delim), sort of).
 -   * Note that delim must have one NUL; we stop if we see that, too.
 -   */
 -  for (;;) {
 -    c = *s++;
 -    spanp = delim;
 -    do {
 -      if ((sc = *spanp++) == c) {
 -      if (c == 0)
 -        s = NULL;
 -      else
 -        s[-1] = 0;
 -      last = s;
 -      return (tok);
 -      }
 -    } while (sc != 0);
 -  }
 -  /* NOTREACHED */
 -}
 -
  LONG
  HexValue (CHAR ch)
  {
index d9aa917,0000000..50a97cb
mode 100644,000000..100644
--- /dev/null
@@@ -1,367 -1,0 +1,348 @@@
-                               <file>bthread.S</file>\r
 +<module name="ntoskrnl" type="kernel" installbase="system32" installname="ntoskrnl.exe">\r
 +      <bootstrap base="reactos" />\r
 +      <importlibrary definition="ntoskrnl.def" />\r
 +      <define name="_SEH_NO_NATIVE_NLG" />\r
 +      <define name="_DISABLE_TIDENTS" />\r
 +      <define name="__NTOSKRNL__" />\r
 +      <define name="__3GB__" />\r
 +      <include base="kjs">include</include>\r
 +      <include base="ntoskrnl">include</include>\r
 +      <library>csq</library>\r
 +      <library>hal</library>\r
 +      <library>kjs</library>\r
 +      <library>pseh</library>\r
 +      <library>rtl</library>\r
 +      <library>rosrtl</library>\r
 +      <library>string</library>\r
 +      <library>rossym</library>\r
 +      <directory name="include">\r
 +              <pch>ntoskrnl.h</pch>\r
 +      </directory>\r
 +      <directory name="ke">\r
 +              <if property="ARCH" value="i386">\r
 +                      <directory name="i386">\r
 +                              <file first="true">main.S</file>\r
 +                              <file>bios.c</file>\r
 +                              <file>brkpoint.c</file>\r
-                               <file>i386-mcount.S</file>\r
++                              <file>ctxswitch.S</file>\r
 +                              <file>exp.c</file>\r
 +                              <file>fpu.c</file>\r
 +                              <file>gdt.c</file>\r
-                               <file>tskswitch.S</file>\r
 +                              <file>idt.c</file>\r
 +                              <file>irq.c</file>\r
 +                              <file>irqhand.s</file>\r
 +                              <file>kernel.c</file>\r
 +                              <file>ldt.c</file>\r
 +                              <file>stkswitch.S</file>\r
 +                              <file>syscall.S</file>\r
 +                              <file>thread.c</file>\r
 +                              <file>tlbflush.S</file>\r
 +                              <file>trap.s</file>\r
-       <directory name="dbg">\r
 +                              <file>tss.c</file>\r
 +                              <file>usercall.S</file>\r
 +                              <file>usertrap.c</file>\r
 +                              <file>v86m.c</file>\r
 +                              <file>v86m_sup.S</file>\r
 +                              <file>vdm.c</file>\r
 +                      </directory>\r
 +              </if>\r
 +              <file>apc.c</file>\r
 +              <file>bug.c</file>\r
 +              <file>catch.c</file>\r
 +              <file>clock.c</file>\r
 +              <file>device.c</file>\r
 +              <file>dpc.c</file>\r
 +              <file>event.c</file>\r
++              <file>gate.c</file>\r
 +              <file>gmutex.c</file>\r
 +              <file>ipi.c</file>\r
 +              <file>kqueue.c</file>\r
 +              <file>kthread.c</file>\r
 +              <file>main.c</file>\r
 +              <file>mutex.c</file>\r
 +              <file>process.c</file>\r
 +              <file>profile.c</file>\r
 +              <file>queue.c</file>\r
 +              <file>sem.c</file>\r
 +              <file>spinlock.c</file>\r
 +              <file>timer.c</file>\r
 +              <file>usercall.c</file>\r
 +              <file>wait.c</file>\r
 +      </directory>\r
 +      <directory name="cc">\r
 +              <file>cacheman.c</file>\r
 +              <file>copy.c</file>\r
 +              <file>fs.c</file>\r
 +              <file>mdl.c</file>\r
 +              <file>pin.c</file>\r
 +              <file>view.c</file>\r
 +      </directory>\r
 +      <directory name="cm">\r
 +              <file>import.c</file>\r
 +              <file>ntfunc.c</file>\r
 +              <file>regfile.c</file>\r
 +              <file>registry.c</file>\r
 +              <file>regobj.c</file>\r
 +      </directory>\r
-                       <file>rdebug.c</file>\r
++      <directory name="kdbg">\r
 +              <if property="ARCH" value="i386">\r
 +                      <directory name="i386">\r
 +                              <if property="KDBG" value="1">\r
 +                                      <group>\r
 +                                              <file>i386-dis.c</file>\r
 +                                              <file>kdb_help.S</file>\r
++                                              <file>longjmp.S</file>\r
++                                              <file>setjmp.S</file>\r
 +                                      </group>\r
 +                              </if>\r
 +                      </directory>\r
 +              </if>\r
 +              <if property="KDBG" value="1">\r
 +                      <file>kdb.c</file>\r
++                      <file>kdb_cli.c</file>\r
++                      <file>kdb_expr.c</file>\r
 +                      <file>kdb_keyboard.c</file>\r
 +                      <file>kdb_serial.c</file>\r
-                       <file>profile.c</file>\r
++                      <file>kdb_string.c</file>\r
 +              </if>\r
 +              <if property="DBG_OR_KDBG" value="true">\r
 +                      <file>kdb_symbols.c</file>\r
-               <file>dbgctrl.c</file>\r
-               <file>errinfo.c</file>\r
-               <file>print.c</file>\r
-               <file>user.c</file>\r
 +              </if>\r
-               <file>buildirp.c</file>\r
-               <file>cancel.c</file>\r
-               <file>cleanup.c</file>\r
-               <file>cntrller.c</file>\r
-               <file>create.c</file>\r
++      </directory>\r
++      <directory name="dbgk">\r
++              <file>dbgkutil.c</file>\r
++              <file>debug.c</file>\r
 +      </directory>\r
 +      <directory name="ex">\r
 +              <if property="ARCH" value="i386">\r
 +                      <directory name="i386">\r
 +                              <file>interlck.c</file>\r
 +                      </directory>\r
 +              </if>\r
 +              <file>callback.c</file>\r
++              <file>dbgctrl.c</file>\r
 +              <file>error.c</file>\r
 +              <file>event.c</file>\r
 +              <file>evtpair.c</file>\r
 +              <file>fmutex.c</file>\r
 +              <file>handle.c</file>\r
 +              <file>init.c</file>\r
 +              <file>interlck.c</file>\r
 +              <file>list.c</file>\r
 +              <file>lookas.c</file>\r
 +              <file>mutant.c</file>\r
 +              <file>power.c</file>\r
 +              <file>profile.c</file>\r
 +              <file>resource.c</file>\r
 +              <file>rundown.c</file>\r
 +              <file>sem.c</file>\r
 +              <file>synch.c</file>\r
 +              <file>sysinfo.c</file>\r
 +              <file>time.c</file>\r
 +              <file>timer.c</file>\r
 +              <file>util.c</file>\r
 +              <file>uuid.c</file>\r
 +              <file>win32k.c</file>\r
 +              <file>work.c</file>\r
 +              <file>zone.c</file>\r
 +              <file>zw.S</file>\r
 +      </directory>\r
 +      <directory name="fs">\r
 +              <file>dbcsname.c</file>\r
 +              <file>filelock.c</file>\r
 +              <file>mcb.c</file>\r
 +              <file>mdl.c</file>\r
 +              <file>name.c</file>\r
 +              <file>notify.c</file>\r
 +              <file>oplock.c</file>\r
 +              <file>pool.c</file>\r
 +              <file>tunnel.c</file>\r
 +              <file>unc.c</file>\r
 +              <file>util.c</file>\r
 +      </directory>\r
 +      <directory name="inbv">\r
 +              <file>inbv.c</file>\r
 +      </directory>\r
 +      <directory name="io">\r
 +              <file>adapter.c</file>\r
 +              <file>arcname.c</file>\r
 +              <file>bootlog.c</file>\r
-               <file>dir.c</file>\r
++              <file>controller.c</file>\r
 +              <file>device.c</file>\r
 +              <file>deviface.c</file>\r
-               <file>errlog.c</file>\r
++              <file>disk.c</file>\r
 +              <file>driver.c</file>\r
 +              <file>efi.c</file>\r
-               <file>flush.c</file>\r
 +              <file>error.c</file>\r
 +              <file>event.c</file>\r
 +              <file>file.c</file>\r
-               <file>ioctrl.c</file>\r
 +              <file>fs.c</file>\r
 +              <file>iocomp.c</file>\r
-               <file>lock.c</file>\r
-               <file>mailslot.c</file>\r
 +              <file>iomgr.c</file>\r
 +              <file>iowork.c</file>\r
 +              <file>irp.c</file>\r
 +              <file>irq.c</file>\r
-               <file>npipe.c</file>\r
-               <file>page.c</file>\r
-               <file>parttab.c</file>\r
 +              <file>mdl.c</file>\r
-               <file>process.c</file>\r
-               <file>queue.c</file>\r
 +              <file>plugplay.c</file>\r
 +              <file>pnpdma.c</file>\r
 +              <file>pnpmgr.c</file>\r
 +              <file>pnpnotify.c</file>\r
 +              <file>pnpreport.c</file>\r
 +              <file>pnproot.c</file>\r
-               <file>rw.c</file>\r
 +              <file>rawfs.c</file>\r
 +              <file>remlock.c</file>\r
 +              <file>resource.c</file>\r
-               <file>shutdown.c</file>\r
 +              <file>share.c</file>\r
-               <file>wdm.c</file>\r
 +              <file>symlink.c</file>\r
 +              <file>timer.c</file>\r
 +              <file>vpb.c</file>\r
-               <file>xhaldisp.c</file>\r
-               <file>xhaldrv.c</file>\r
 +              <file>wmi.c</file>\r
-               <file>dlog.c</file>\r
-               <file>gdbstub.c</file>\r
-               <file>kdebug.c</file>\r
-               <file>mda.c</file>\r
-               <file>service.c</file>\r
 +      </directory>\r
 +      <directory name="kd">\r
-               <file>create.c</file>\r
++              <directory name="wrappers">\r
++                      <file>bochs.c</file>\r
++                      <file>gdbstub.c</file>\r
++              </directory>\r
++              <file>kdinit.c</file>\r
++              <file>kdio.c</file>\r
++              <file>kdmain.c</file>\r
 +      </directory>\r
 +      <directory name="ldr">\r
 +              <file>init.c</file>\r
 +              <file>loader.c</file>\r
 +              <file>resource.c</file>\r
 +              <file>rtl.c</file>\r
 +              <file>sysdll.c</file>\r
 +              <file>userldr.c</file>\r
 +      </directory>\r
 +      <directory name="lpc">\r
 +              <file>close.c</file>\r
 +              <file>complete.c</file>\r
 +              <file>connect.c</file>\r
 +              <file>create.c</file>\r
 +              <file>listen.c</file>\r
 +              <file>port.c</file>\r
 +              <file>query.c</file>\r
 +              <file>queue.c</file>\r
 +              <file>receive.c</file>\r
 +              <file>reply.c</file>\r
 +              <file>send.c</file>\r
 +      </directory>\r
 +      <directory name="mm">\r
 +              <if property="ARCH" value="i386">\r
 +                      <directory name="i386">\r
 +                              <file>memsafe.s</file>\r
 +                              <file>page.c</file>\r
 +                              <file>pfault.c</file>\r
 +                      </directory>\r
 +              </if>\r
 +              <file>anonmem.c</file>\r
 +              <file>aspace.c</file>\r
 +              <file>balance.c</file>\r
 +              <file>cont.c</file>\r
 +              <file>drvlck.c</file>\r
 +              <file>elf32.c</file>\r
 +              <file>elf64.c</file>\r
 +              <file>freelist.c</file>\r
 +              <file>iospace.c</file>\r
 +              <file>kmap.c</file>\r
 +              <file>marea.c</file>\r
 +              <file>mdl.c</file>\r
 +              <file>mm.c</file>\r
++              <file>process.c</file>\r
 +              <file>mminit.c</file>\r
 +              <file>mpw.c</file>\r
 +              <file>ncache.c</file>\r
 +              <file>npool.c</file>\r
 +              <file>pagefile.c</file>\r
 +              <file>pageop.c</file>\r
 +              <file>pager.c</file>\r
 +              <file>pagfault.c</file>\r
 +              <file>paging.c</file>\r
 +              <file>pe.c</file>\r
 +              <file>physical.c</file>\r
 +              <file>pool.c</file>\r
 +              <file>ppool.c</file>\r
 +              <file>region.c</file>\r
 +              <file>rmap.c</file>\r
 +              <file>section.c</file>\r
 +              <file>verifier.c</file>\r
 +              <file>virtual.c</file>\r
 +              <file>wset.c</file>\r
 +      </directory>\r
 +      <directory name="ob">\r
 +              <file>dirobj.c</file>\r
 +              <file>handle.c</file>\r
 +              <file>namespc.c</file>\r
 +              <file>ntobj.c</file>\r
 +              <file>object.c</file>\r
 +              <file>sdcache.c</file>\r
 +              <file>security.c</file>\r
 +              <file>symlink.c</file>\r
 +              <file>wait.c</file>\r
 +      </directory>\r
 +      <directory name="po">\r
 +              <file>power.c</file>\r
 +      </directory>\r
 +      <directory name="ps">\r
 +              <if property="ARCH" value="i386">\r
 +                      <directory name="i386">\r
 +                              <file>continue.c</file>\r
 +                      </directory>\r
 +              </if>\r
 +              <file>cid.c</file>\r
-                               <file>alldiv.s</file>\r
-                               <file>allmul.s</file>\r
-                               <file>allrem.s</file>\r
-                               <file>allshl.s</file>\r
-                               <file>allshr.s</file>\r
-                               <file>aulldiv.s</file>\r
-                               <file>aullrem.s</file>\r
-                               <file>aullshr.s</file>\r
 +              <file>debug.c</file>\r
 +              <file>idle.c</file>\r
 +              <file>job.c</file>\r
 +              <file>kill.c</file>\r
 +              <file>locale.c</file>\r
++              <file>notify.c</file>\r
 +              <file>process.c</file>\r
 +              <file>psmgr.c</file>\r
 +              <file>query.c</file>\r
++              <file>quota.c</file>\r
 +              <file>security.c</file>\r
 +              <file>suspend.c</file>\r
 +              <file>thread.c</file>\r
 +              <file>win32.c</file>\r
 +      </directory>\r
 +      <directory name="rtl">\r
 +              <if property="ARCH" value="i386">\r
 +                      <directory name="i386">\r
 +                              <file>exception.c</file>\r
 +                              <file>seh.s</file>\r
 +                      </directory>\r
 +              </if>\r
 +              <file>atom.c</file>\r
 +              <file>capture.c</file>\r
 +              <file>ctype.c</file>\r
++              <file>debug.c</file>\r
 +              <file>handle.c</file>\r
 +              <file>libsupp.c</file>\r
 +              <file>message.c</file>\r
 +              <file>misc.c</file>\r
 +              <file>nls.c</file>\r
 +              <file>purecall.c</file>\r
 +              <file>rangelist.c</file>\r
 +              <file>regio.c</file>\r
 +              <file>sprintf.c</file>\r
 +              <file>stdlib.c</file>\r
 +              <file>string.c</file>\r
 +              <file>strtok.c</file>\r
 +              <file>swprintf.c</file>\r
 +              <file>wstring.c</file>\r
 +      </directory>\r
 +      <directory name="se">\r
 +              <file>access.c</file>\r
 +              <file>acl.c</file>\r
 +              <file>audit.c</file>\r
 +              <file>lsa.c</file>\r
 +              <file>luid.c</file>\r
 +              <file>priv.c</file>\r
 +              <file>sd.c</file>\r
 +              <file>semgr.c</file>\r
 +              <file>sid.c</file>\r
 +              <file>token.c</file>\r
 +      </directory>\r
 +      <file>ntoskrnl.rc</file>\r
 +</module>\r
@@@ -36,7 -36,7 +36,6 @@@
  
  #include "eventlog.h"
  
--#define DBG
  #define NDEBUG
  #include <debug.h>
  
@@@ -38,9 -38,9 +38,8 @@@
  #include <rpc.h>\r
  #include <rpcdce.h>\r
  \r
 -#include "pnp.h"\r
 +#include "pnp_s.h"\r
  \r
--#define DBG\r
  #define NDEBUG\r
  #include <debug.h>\r
  \r
index 2f372fd,0000000..66e4a9d
mode 100644,000000..100644
--- /dev/null
@@@ -1,63 -1,0 +1,63 @@@
- <module name="cmd" type="win32cui" installbase="system32" installname="cmd.exe">\r
++<module name="cmd" type="win32cui" installbase="system32" installname="cmd.exe" usewrc="false">\r
 +      <include base="ReactOS">include/wine</include>\r
 +      <include base="cmd">.</include>\r
 +      <define name="__USE_W32API" />\r
 +      <define name="ANONYMOUSUNIONS" />\r
 +      <define name="_WIN32_WINNT">0x0501</define>\r
 +      <library>kernel32</library>\r
 +      <pch>precomp.h</pch>\r
 +      <file>alias.c</file>\r
 +      <file>attrib.c</file>\r
 +      <file>batch.c</file>\r
 +      <file>beep.c</file>\r
 +      <file>call.c</file>\r
 +      <file>chcp.c</file>\r
 +      <file>choice.c</file>\r
 +      <file>cls.c</file>\r
 +      <file>cmd.c</file>\r
 +      <file>cmdinput.c</file>\r
 +      <file>cmdtable.c</file>\r
 +      <file>color.c</file>\r
 +      <file>console.c</file>\r
 +      <file>copy.c</file>\r
 +      <file>date.c</file>\r
 +      <file>del.c</file>\r
 +      <file>delay.c</file>\r
 +      <file>dir.c</file>\r
 +      <file>dirstack.c</file>\r
 +      <file>echo.c</file>\r
 +      <file>error.c</file>\r
 +      <file>filecomp.c</file>\r
 +      <file>for.c</file>\r
 +      <file>free.c</file>\r
 +      <file>goto.c</file>\r
 +      <file>history.c</file>\r
 +      <file>if.c</file>\r
 +      <file>internal.c</file>\r
 +      <file>label.c</file>\r
 +      <file>locale.c</file>\r
 +      <file>memory.c</file>\r
 +      <file>misc.c</file>\r
 +      <file>move.c</file>\r
 +      <file>msgbox.c</file>\r
 +      <file>path.c</file>\r
 +      <file>pause.c</file>\r
 +      <file>prompt.c</file>\r
 +      <file>redir.c</file>\r
 +      <file>ren.c</file>\r
 +      <file>screen.c</file>\r
 +      <file>set.c</file>\r
 +      <file>shift.c</file>\r
 +      <file>start.c</file>\r
 +      <file>strtoclr.c</file>\r
 +      <file>time.c</file>\r
 +      <file>timer.c</file>\r
 +      <file>title.c</file>\r
 +      <file>type.c</file>\r
 +      <file>ver.c</file>\r
 +      <file>verify.c</file>\r
 +      <file>vol.c</file>\r
 +      <file>where.c</file>\r
 +      <file>window.c</file>\r
 +      <file>cmd.rc</file>\r
 +</module>\r
index 46004e1,0000000..8073ff8
mode 100644,000000..100644
--- /dev/null
@@@ -1,11 -1,0 +1,17 @@@
-       <file>services.c</file>\r
 +<module name="services" type="win32cui">\r
 +      <include base="services">.</include>\r
++      <include base="ReactOS">include/idl</include>\r
 +      <define name="__USE_W32API" />\r
++      <define name="UNICODE" />\r
++      <define name="_UNICODE" />\r
++      <library>scm_server</library>\r
 +      <library>ntdll</library>\r
 +      <library>kernel32</library>\r
 +      <library>user32</library>\r
 +      <library>advapi32</library>\r
++      <library>rpcrt4</library>\r
 +      <file>database.c</file>\r
++      <file>rpcserver.c</file>\r
++      <file>services.c</file>\r
 +      <file>services.rc</file>\r
 +</module>\r
index 68b920b,0000000..98a1a31
mode 100644,000000..100644
--- /dev/null
@@@ -1,28 -1,0 +1,29 @@@
 +<module name="usetup" type="nativecui" installbase="system32" installname="usetup.exe" warnings="true">\r
 +      <bootstrap base="reactos/system32" nameoncd="smss.exe" />\r
 +      <include base="usetup">.</include>\r
 +      <include base="zlib">.</include>\r
 +      <define name="_DISABLE_TIDENTS" />\r
 +      <linkerflag>-lgcc</linkerflag>\r
 +      <library>zlib</library>\r
 +      <library>vfatlib</library>\r
 +      <library>ntdll</library>\r
 +      <pch>precomp.h</pch>\r
 +      <file>bootsup.c</file>\r
 +      <file>cabinet.c</file>\r
 +      <file>console.c</file>\r
 +      <file>drivesup.c</file>\r
 +      <file>filequeue.c</file>\r
 +      <file>filesup.c</file>\r
 +      <file>format.c</file>\r
 +      <file>fslist.c</file>\r
 +      <file>genlist.c</file>\r
 +      <file>infcache.c</file>\r
 +      <file>inicache.c</file>\r
++      <file>keytrans.c</file>\r
 +      <file>partlist.c</file>\r
 +      <file>progress.c</file>\r
 +      <file>registry.c</file>\r
 +      <file>settings.c</file>\r
 +      <file>usetup.c</file>\r
 +      <file>usetup.rc</file>\r
 +</module>\r
Simple merge
Simple merge
index d18cf9e,0000000..a8c0c49
mode 100644,000000..100644
--- /dev/null
@@@ -1,2912 -1,0 +1,2919 @@@
-       const string& sourceFilename,\r
 +#include "../../pch.h"\r
 +#include <assert.h>\r
 +\r
 +#include "../../rbuild.h"\r
 +#include "mingw.h"\r
 +#include "modulehandler.h"\r
 +\r
 +using std::string;\r
 +using std::vector;\r
 +\r
 +#define CLEAN_FILE(f) clean_files.push_back ( f );\r
 +\r
 +static string ros_temp = "$(TEMPORARY)";\r
 +MingwBackend*\r
 +MingwModuleHandler::backend = NULL;\r
 +FILE*\r
 +MingwModuleHandler::fMakefile = NULL;\r
 +bool\r
 +MingwModuleHandler::use_pch = false;\r
 +\r
 +string\r
 +PrefixFilename (\r
 +      const string& filename,\r
 +      const string& prefix )\r
 +{\r
 +      if ( !prefix.length() )\r
 +              return filename;\r
 +      string out;\r
 +      const char* pfilename = filename.c_str();\r
 +      const char* p1 = strrchr ( pfilename, '/' );\r
 +      const char* p2 = strrchr ( pfilename, '\\' );\r
 +      if ( p1 || p2 )\r
 +      {\r
 +              if ( p2 > p1 )\r
 +                      p1 = p2;\r
 +              out += string(pfilename,p1-pfilename) + CSEP;\r
 +              pfilename = p1 + 1;\r
 +      }\r
 +      out += prefix + pfilename;\r
 +      return out;\r
 +}\r
 +\r
 +string\r
 +GetTargetMacro ( const Module& module, bool with_dollar )\r
 +{\r
 +      string s ( module.name );\r
 +      strupr ( &s[0] );\r
 +      s += "_TARGET";\r
 +      if ( with_dollar )\r
 +              return ssprintf ( "$(%s)", s.c_str() );\r
 +      return s;\r
 +}\r
 +\r
 +MingwModuleHandler::MingwModuleHandler (\r
 +      const Module& module_ )\r
 +\r
 +      : module(module_)\r
 +{\r
 +}\r
 +\r
 +MingwModuleHandler::~MingwModuleHandler()\r
 +{\r
 +}\r
 +\r
 +/*static*/ void\r
 +MingwModuleHandler::SetBackend ( MingwBackend* backend_ )\r
 +{\r
 +      backend = backend_;\r
 +}\r
 +\r
 +/*static*/ void\r
 +MingwModuleHandler::SetMakefile ( FILE* f )\r
 +{\r
 +      fMakefile = f;\r
 +}\r
 +\r
 +/*static*/ void\r
 +MingwModuleHandler::SetUsePch ( bool b )\r
 +{\r
 +      use_pch = b;\r
 +}\r
 +\r
 +/* static*/ string\r
 +MingwModuleHandler::RemoveVariables ( string path)\r
 +{\r
 +      size_t i = path.find ( '$' );\r
 +      if ( i != string::npos )\r
 +      {\r
 +              size_t j = path.find ( ')', i );\r
 +              if ( j != string::npos )\r
 +              {\r
 +                      if ( j + 2 < path.length () && path[j + 1] == CSEP )\r
 +                              return path.substr ( j + 2);\r
 +                      else\r
 +                              return path.substr ( j + 1);\r
 +              }\r
 +      }\r
 +      return path;\r
 +}\r
 +\r
 +/*static*/ string\r
 +MingwModuleHandler::PassThruCacheDirectory (\r
 +      const string &file,\r
 +      Directory* directoryTree )\r
 +{\r
 +      string directory ( GetDirectory ( RemoveVariables ( file ) ) );\r
 +      string generatedFilesDirectory = backend->AddDirectoryTarget ( directory,\r
 +                                                                     directoryTree );\r
 +      if ( directory.find ( generatedFilesDirectory ) != string::npos )\r
 +              /* This path already includes the generated files directory variable */\r
 +              return file;\r
 +      else\r
 +              return generatedFilesDirectory + SSEP + file;\r
 +}\r
 +\r
 +/*static*/ string\r
 +MingwModuleHandler::GetTargetFilename (\r
 +      const Module& module,\r
 +      string_list* pclean_files )\r
 +{\r
 +      string target = PassThruCacheDirectory (\r
 +              NormalizeFilename ( module.GetPath () ),\r
 +              backend->outputDirectory );\r
 +      if ( pclean_files )\r
 +      {\r
 +              string_list& clean_files = *pclean_files;\r
 +              CLEAN_FILE ( target );\r
 +      }\r
 +      return target;\r
 +}\r
 +\r
 +/*static*/ string\r
 +MingwModuleHandler::GetImportLibraryFilename (\r
 +      const Module& module,\r
 +      string_list* pclean_files )\r
 +{\r
 +      string target = PassThruCacheDirectory (\r
 +              NormalizeFilename ( module.GetDependencyPath () ),\r
 +              backend->outputDirectory );\r
 +      if ( pclean_files )\r
 +      {\r
 +              string_list& clean_files = *pclean_files;\r
 +              CLEAN_FILE ( target );\r
 +      }\r
 +      return target;\r
 +}\r
 +\r
 +/*static*/ MingwModuleHandler*\r
 +MingwModuleHandler::InstanciateHandler (\r
 +      const Module& module,\r
 +      MingwBackend* backend )\r
 +{\r
 +      MingwModuleHandler* handler;\r
 +      switch ( module.type )\r
 +      {\r
 +              case BuildTool:\r
 +                      handler = new MingwBuildToolModuleHandler ( module );\r
 +                      break;\r
 +              case StaticLibrary:\r
 +                      handler = new MingwStaticLibraryModuleHandler ( module );\r
 +                      break;\r
 +              case ObjectLibrary:\r
 +                      handler = new MingwObjectLibraryModuleHandler ( module );\r
 +                      break;\r
 +              case Kernel:\r
 +                      handler = new MingwKernelModuleHandler ( module );\r
 +                      break;\r
 +              case NativeCUI:\r
 +                      handler = new MingwNativeCUIModuleHandler ( module );\r
 +                      break;\r
 +              case Win32CUI:\r
 +                      handler = new MingwWin32CUIModuleHandler ( module );\r
 +                      break;\r
 +              case Win32GUI:\r
 +                      handler = new MingwWin32GUIModuleHandler ( module );\r
 +                      break;\r
 +              case KernelModeDLL:\r
 +                      handler = new MingwKernelModeDLLModuleHandler ( module );\r
 +                      break;\r
 +              case NativeDLL:\r
 +                      handler = new MingwNativeDLLModuleHandler ( module );\r
 +                      break;\r
 +              case Win32DLL:\r
 +                      handler = new MingwWin32DLLModuleHandler ( module );\r
 +                      break;\r
 +              case KernelModeDriver:\r
 +                      handler = new MingwKernelModeDriverModuleHandler ( module );\r
 +                      break;\r
 +              case BootLoader:\r
 +                      handler = new MingwBootLoaderModuleHandler ( module );\r
 +                      break;\r
 +              case BootSector:\r
 +                      handler = new MingwBootSectorModuleHandler ( module );\r
 +                      break;\r
 +              case Iso:\r
 +                      handler = new MingwIsoModuleHandler ( module );\r
 +                      break;\r
 +              case LiveIso:\r
 +                      handler = new MingwLiveIsoModuleHandler ( module );\r
 +                      break;\r
 +              case Test:\r
 +                      handler = new MingwTestModuleHandler ( module );\r
 +                      break;\r
 +              case RpcServer:\r
 +                      handler = new MingwRpcServerModuleHandler ( module );\r
 +                      break;\r
 +              case RpcClient:\r
 +                      handler = new MingwRpcClientModuleHandler ( module );\r
 +                      break;\r
 +              default:\r
 +                      throw UnknownModuleTypeException (\r
 +                              module.node.location,\r
 +                              module.type );\r
 +                      break;\r
 +      }\r
 +      return handler;\r
 +}\r
 +\r
 +string\r
 +MingwModuleHandler::GetWorkingDirectory () const\r
 +{\r
 +      return ".";\r
 +}\r
 +\r
 +string\r
 +MingwModuleHandler::GetBasename ( const string& filename ) const\r
 +{\r
 +      size_t index = filename.find_last_of ( '.' );\r
 +      if ( index != string::npos )\r
 +              return filename.substr ( 0, index );\r
 +      return "";\r
 +}\r
 +\r
 +string\r
 +MingwModuleHandler::GetActualSourceFilename (\r
 +      const string& filename ) const\r
 +{\r
 +      string extension = GetExtension ( filename );\r
 +      if ( extension == ".spec" || extension == ".SPEC" )\r
 +      {\r
 +              string basename = GetBasename ( filename );\r
 +              return PassThruCacheDirectory ( NormalizeFilename ( basename + ".stubs.c" ),\r
 +                                              backend->intermediateDirectory );\r
 +      }\r
 +      else if ( extension == ".idl" || extension == ".IDL" )\r
 +      {\r
 +              string basename = GetBasename ( filename );\r
 +              string newname;\r
 +              if ( module.type == RpcServer )\r
 +                      newname = basename + "_s.c";\r
 +              else\r
 +                      newname = basename + "_c.c";\r
 +              return PassThruCacheDirectory ( NormalizeFilename ( newname ),\r
 +                                              backend->intermediateDirectory );\r
 +      }\r
 +      else\r
 +              return filename;\r
 +}\r
 +\r
 +string\r
 +MingwModuleHandler::GetModuleArchiveFilename () const\r
 +{\r
 +      if ( module.type == StaticLibrary )\r
 +              return GetTargetFilename ( module, NULL );\r
 +      return PassThruCacheDirectory ( ReplaceExtension (\r
 +              NormalizeFilename ( module.GetPath () ),\r
 +              ".temp.a" ),\r
 +              backend->intermediateDirectory );\r
 +}\r
 +\r
 +bool\r
 +MingwModuleHandler::IsGeneratedFile ( const File& file ) const\r
 +{\r
 +      string extension = GetExtension ( file.name );\r
 +      return ( extension == ".spec" || extension == ".SPEC" );\r
 +}\r
 +\r
 +/*static*/ bool\r
 +MingwModuleHandler::ReferenceObjects (\r
 +      const Module& module )\r
 +{\r
 +      if ( module.type == ObjectLibrary )\r
 +              return true;\r
 +      if ( module.type == RpcServer )\r
 +              return true;\r
 +      if ( module.type == RpcClient )\r
 +              return true;\r
 +      return false;\r
 +}\r
 +\r
 +string\r
 +MingwModuleHandler::GetImportLibraryDependency (\r
 +      const Module& importedModule )\r
 +{\r
 +      string dep;\r
 +      if ( ReferenceObjects ( importedModule ) )\r
 +              dep = GetTargetMacro ( importedModule );\r
 +      else\r
 +              dep = GetImportLibraryFilename ( importedModule, NULL );\r
 +      return dep;\r
 +}\r
 +\r
 +void\r
 +MingwModuleHandler::GetTargets ( const Module& dependencyModule,\r
 +                                   string_list& targets )\r
 +{\r
 +      if ( dependencyModule.invocations.size () > 0 )\r
 +      {\r
 +              for ( size_t i = 0; i < dependencyModule.invocations.size (); i++ )\r
 +              {\r
 +                      Invoke& invoke = *dependencyModule.invocations[i];\r
 +                      invoke.GetTargets ( targets );\r
 +              }\r
 +      }\r
 +      else\r
 +              targets.push_back ( GetImportLibraryDependency ( dependencyModule ) );\r
 +}\r
 +\r
 +void\r
 +MingwModuleHandler::GetModuleDependencies (\r
 +      string_list& dependencies )\r
 +{\r
 +      size_t iend = module.dependencies.size ();\r
 +\r
 +      if ( iend == 0 )\r
 +              return;\r
 +      \r
 +      for ( size_t i = 0; i < iend; i++ )\r
 +      {\r
 +              const Dependency& dependency = *module.dependencies[i];\r
 +              const Module& dependencyModule = *dependency.dependencyModule;\r
 +              GetTargets ( dependencyModule,\r
 +                           dependencies );\r
 +      }\r
 +      GetDefinitionDependencies ( dependencies );\r
 +}\r
 +\r
 +void\r
 +MingwModuleHandler::GetSourceFilenames (\r
 +      string_list& list,\r
 +      bool includeGeneratedFiles ) const\r
 +{\r
 +      size_t i;\r
 +\r
 +      const vector<File*>& files = module.non_if_data.files;\r
 +      for ( i = 0; i < files.size (); i++ )\r
 +      {\r
 +              if ( includeGeneratedFiles || !IsGeneratedFile ( *files[i] ) )\r
 +              {\r
 +                      list.push_back (\r
 +                              GetActualSourceFilename ( files[i]->name ) );\r
 +              }\r
 +      }\r
 +      // intentionally make a copy so that we can append more work in\r
 +      // the middle of processing without having to go recursive\r
 +      vector<If*> v = module.non_if_data.ifs;\r
 +      for ( i = 0; i < v.size (); i++ )\r
 +      {\r
 +              size_t j;\r
 +              If& rIf = *v[i];\r
 +              // check for sub-ifs to add to list\r
 +              const vector<If*>& ifs = rIf.data.ifs;\r
 +              for ( j = 0; j < ifs.size (); j++ )\r
 +                      v.push_back ( ifs[j] );\r
 +              const vector<File*>& files = rIf.data.files;\r
 +              for ( j = 0; j < files.size (); j++ )\r
 +              {\r
 +                      File& file = *files[j];\r
 +                      if ( includeGeneratedFiles || !IsGeneratedFile ( file ) )\r
 +                      {\r
 +                              list.push_back (\r
 +                                      GetActualSourceFilename ( file.name ) );\r
 +                      }\r
 +              }\r
 +      }\r
 +}\r
 +\r
 +void\r
 +MingwModuleHandler::GetSourceFilenamesWithoutGeneratedFiles (\r
 +      string_list& list ) const\r
 +{\r
 +      GetSourceFilenames ( list, false );\r
 +}\r
 +\r
 +string\r
 +MingwModuleHandler::GetObjectFilename (\r
 +      const string& sourceFilename,\r
 +      string_list* pclean_files ) const\r
 +{\r
 +      Directory* directoryTree;\r
 +\r
 +      string newExtension;\r
 +      string extension = GetExtension ( sourceFilename );\r
 +      if ( extension == ".rc" || extension == ".RC" )\r
 +              newExtension = ".coff";\r
 +      else if ( extension == ".spec" || extension == ".SPEC" )\r
 +              newExtension = ".stubs.o";\r
 +      else if ( extension == ".idl" || extension == ".IDL" )\r
 +      {\r
 +              if ( module.type == RpcServer )\r
 +                      newExtension = "_s.o";\r
 +              else\r
 +                      newExtension = "_c.o";\r
 +      }\r
 +      else\r
 +              newExtension = ".o";\r
 +      \r
 +      if ( module.type == BootSector )\r
 +              directoryTree = backend->outputDirectory;\r
 +      else\r
 +              directoryTree = backend->intermediateDirectory;\r
 +\r
 +      string obj_file = PassThruCacheDirectory (\r
 +              NormalizeFilename ( ReplaceExtension (\r
 +                      RemoveVariables ( sourceFilename ),\r
 +                                        newExtension ) ),\r
 +                      directoryTree );\r
 +      if ( pclean_files )\r
 +      {\r
 +              string_list& clean_files = *pclean_files;\r
 +              CLEAN_FILE ( obj_file );\r
 +      }\r
 +      return obj_file;\r
 +}\r
 +\r
 +void\r
 +MingwModuleHandler::GenerateCleanTarget () const\r
 +{\r
 +      if ( 0 == clean_files.size() )\r
 +              return;\r
 +      fprintf ( fMakefile, ".PHONY: %s_clean\n", module.name.c_str() );\r
 +      fprintf ( fMakefile, "%s_clean:\n\t-@${rm}", module.name.c_str() );\r
 +      for ( size_t i = 0; i < clean_files.size(); i++ )\r
 +      {\r
 +              if ( 9==((i+1)%10) )\r
 +                      fprintf ( fMakefile, " 2>$(NUL)\n\t-@${rm}" );\r
 +              fprintf ( fMakefile, " %s", clean_files[i].c_str() );\r
 +      }\r
 +      fprintf ( fMakefile, " 2>$(NUL)\n" );\r
 +      fprintf ( fMakefile, "clean: %s_clean\n\n", module.name.c_str() );\r
 +}\r
 +\r
 +string\r
 +MingwModuleHandler::GetObjectFilenames ()\r
 +{\r
 +      const vector<File*>& files = module.non_if_data.files;\r
 +      if ( files.size () == 0 )\r
 +              return "";\r
 +      \r
 +      string objectFilenames ( "" );\r
 +      for ( size_t i = 0; i < files.size (); i++ )\r
 +      {\r
 +              if ( objectFilenames.size () > 0 )\r
 +                      objectFilenames += " ";\r
 +              objectFilenames +=\r
 +                      GetObjectFilename ( files[i]->name, NULL );\r
 +      }\r
 +      return objectFilenames;\r
 +}\r
 +\r
 +string\r
 +MingwModuleHandler::GenerateGccDefineParametersFromVector (\r
 +      const vector<Define*>& defines ) const\r
 +{\r
 +      string parameters;\r
 +      for ( size_t i = 0; i < defines.size (); i++ )\r
 +      {\r
 +              Define& define = *defines[i];\r
 +              if (parameters.length () > 0)\r
 +                      parameters += " ";\r
 +              parameters += "-D";\r
 +              parameters += define.name;\r
 +              if (define.value.length () > 0)\r
 +              {\r
 +                      parameters += "=";\r
 +                      parameters += define.value;\r
 +              }\r
 +      }\r
 +      return parameters;\r
 +}\r
 +\r
 +string\r
 +MingwModuleHandler::GenerateGccDefineParameters () const\r
 +{\r
 +      string parameters = GenerateGccDefineParametersFromVector ( module.project.non_if_data.defines );\r
 +      string s = GenerateGccDefineParametersFromVector ( module.non_if_data.defines );\r
 +      if ( s.length () > 0 )\r
 +      {\r
 +              parameters += " ";\r
 +              parameters += s;\r
 +      }\r
 +      return parameters;\r
 +}\r
 +\r
 +string\r
 +MingwModuleHandler::ConcatenatePaths (\r
 +      const string& path1,\r
 +      const string& path2 ) const\r
 +{\r
 +      if ( ( path1.length () == 0 ) || ( path1 == "." ) || ( path1 == "./" ) )\r
 +              return path2;\r
 +      if ( path1[path1.length ()] == CSEP )\r
 +              return path1 + path2;\r
 +      else\r
 +              return path1 + CSEP + path2;\r
 +}\r
 +\r
 +string\r
 +MingwModuleHandler::GenerateGccIncludeParametersFromVector ( const vector<Include*>& includes ) const\r
 +{\r
 +      string parameters;\r
 +      for ( size_t i = 0; i < includes.size (); i++ )\r
 +      {\r
 +              Include& include = *includes[i];\r
 +              if ( parameters.length () > 0 )\r
 +                      parameters += " ";\r
 +              parameters += "-I" + include.directory;\r
 +      }\r
 +      return parameters;\r
 +}\r
 +\r
 +string\r
 +MingwModuleHandler::GenerateGccIncludeParameters () const\r
 +{\r
 +      string parameters = GenerateGccIncludeParametersFromVector ( module.non_if_data.includes );\r
 +      string s = GenerateGccIncludeParametersFromVector ( module.project.non_if_data.includes );\r
 +      if ( s.length () > 0 )\r
 +      {\r
 +              parameters += " ";\r
 +              parameters += s;\r
 +      }\r
 +      return parameters;\r
 +}\r
 +\r
 +\r
 +string\r
 +MingwModuleHandler::GenerateCompilerParametersFromVector ( const vector<CompilerFlag*>& compilerFlags ) const\r
 +{\r
 +      string parameters;\r
 +      for ( size_t i = 0; i < compilerFlags.size (); i++ )\r
 +      {\r
 +              CompilerFlag& compilerFlag = *compilerFlags[i];\r
 +              if ( parameters.length () > 0 )\r
 +                      parameters += " ";\r
 +              parameters += compilerFlag.flag;\r
 +      }\r
 +      return parameters;\r
 +}\r
 +\r
 +string\r
 +MingwModuleHandler::GenerateLinkerParametersFromVector ( const vector<LinkerFlag*>& linkerFlags ) const\r
 +{\r
 +      string parameters;\r
 +      for ( size_t i = 0; i < linkerFlags.size (); i++ )\r
 +      {\r
 +              LinkerFlag& linkerFlag = *linkerFlags[i];\r
 +              if ( parameters.length () > 0 )\r
 +                      parameters += " ";\r
 +              parameters += linkerFlag.flag;\r
 +      }\r
 +      return parameters;\r
 +}\r
 +\r
 +string\r
 +MingwModuleHandler::GenerateImportLibraryDependenciesFromVector (\r
 +      const vector<Library*>& libraries )\r
 +{\r
 +      string dependencies ( "" );\r
 +      int wrap_count = 0;\r
 +      for ( size_t i = 0; i < libraries.size (); i++ )\r
 +      {\r
 +              if ( wrap_count++ == 5 )\r
 +                      dependencies += " \\\n\t\t", wrap_count = 0;\r
 +              else if ( dependencies.size () > 0 )\r
 +                      dependencies += " ";\r
 +              dependencies += GetImportLibraryDependency ( *libraries[i]->imported_module );\r
 +      }\r
 +      return dependencies;\r
 +}\r
 +\r
 +string\r
 +MingwModuleHandler::GenerateLinkerParameters () const\r
 +{\r
 +      return GenerateLinkerParametersFromVector ( module.linkerFlags );\r
 +}\r
 +\r
 +void\r
 +MingwModuleHandler::GenerateMacro (\r
 +      const char* assignmentOperation,\r
 +      const string& macro,\r
 +      const IfableData& data,\r
 +      const vector<CompilerFlag*>* compilerFlags )\r
 +{\r
 +      size_t i;\r
 +\r
 +      fprintf (\r
 +              fMakefile,\r
 +              "%s %s",\r
 +              macro.c_str(),\r
 +              assignmentOperation );\r
 +      \r
 +      if ( compilerFlags != NULL )\r
 +      {\r
 +              string compilerParameters = GenerateCompilerParametersFromVector ( *compilerFlags );\r
 +              if ( compilerParameters.size () > 0 )\r
 +              {\r
 +                      fprintf (\r
 +                              fMakefile,\r
 +                              " %s",\r
 +                              compilerParameters.c_str () );\r
 +              }\r
 +      }\r
 +\r
 +      for ( i = 0; i < data.includes.size(); i++ )\r
 +      {\r
 +              fprintf (\r
 +                      fMakefile,\r
 +                      " -I%s",\r
 +                      data.includes[i]->directory.c_str() );\r
 +      }\r
 +      for ( i = 0; i < data.defines.size(); i++ )\r
 +      {\r
 +              Define& d = *data.defines[i];\r
 +              fprintf (\r
 +                      fMakefile,\r
 +                      " -D%s",\r
 +                      d.name.c_str() );\r
 +              if ( d.value.size() )\r
 +                      fprintf (\r
 +                              fMakefile,\r
 +                              "=%s",\r
 +                              d.value.c_str() );\r
 +      }\r
 +      fprintf ( fMakefile, "\n" );\r
 +}\r
 +\r
 +void\r
 +MingwModuleHandler::GenerateMacros (\r
 +      const char* assignmentOperation,\r
 +      const IfableData& data,\r
 +      const vector<CompilerFlag*>* compilerFlags,\r
 +      const vector<LinkerFlag*>* linkerFlags )\r
 +{\r
 +      size_t i;\r
 +\r
 +      if ( data.includes.size () > 0 || data.defines.size () > 0 )\r
 +      {\r
 +              GenerateMacro ( assignmentOperation,\r
 +                              cflagsMacro,\r
 +                              data,\r
 +                              compilerFlags );\r
 +              GenerateMacro ( assignmentOperation,\r
 +                              windresflagsMacro,\r
 +                              data,\r
 +                              compilerFlags );\r
 +      }\r
 +      \r
 +      if ( linkerFlags != NULL )\r
 +      {\r
 +              string linkerParameters = GenerateLinkerParametersFromVector ( *linkerFlags );\r
 +              if ( linkerParameters.size () > 0 )\r
 +              {\r
 +                      fprintf (\r
 +                              fMakefile,\r
 +                              "%s %s %s\n",\r
 +                              linkerflagsMacro.c_str (),\r
 +                              assignmentOperation,\r
 +                              linkerParameters.c_str() );\r
 +              }\r
 +      }\r
 +\r
 +      if ( data.libraries.size () > 0 )\r
 +      {\r
 +              string deps = GenerateImportLibraryDependenciesFromVector ( data.libraries );\r
 +              if ( deps.size () > 0 )\r
 +              {\r
 +                      fprintf (\r
 +                              fMakefile,\r
 +                              "%s %s %s\n",\r
 +                              libsMacro.c_str(),\r
 +                              assignmentOperation,\r
 +                              deps.c_str() );\r
 +              }\r
 +      }\r
 +\r
 +      const vector<If*>& ifs = data.ifs;\r
 +      for ( i = 0; i < ifs.size(); i++ )\r
 +      {\r
 +              If& rIf = *ifs[i];\r
 +              if ( rIf.data.defines.size()\r
 +                      || rIf.data.includes.size()\r
 +                      || rIf.data.libraries.size()\r
 +                      || rIf.data.files.size()\r
 +                      || rIf.data.ifs.size() )\r
 +              {\r
 +                      fprintf (\r
 +                              fMakefile,\r
 +                              "ifeq (\"$(%s)\",\"%s\")\n",\r
 +                              rIf.property.c_str(),\r
 +                              rIf.value.c_str() );\r
 +                      GenerateMacros (\r
 +                              "+=",\r
 +                              rIf.data,\r
 +                              NULL,\r
 +                              NULL );\r
 +                      fprintf ( \r
 +                              fMakefile,\r
 +                              "endif\n\n" );\r
 +              }\r
 +      }\r
 +}\r
 +\r
 +void\r
 +MingwModuleHandler::GenerateObjectMacros (\r
 +      const char* assignmentOperation,\r
 +      const IfableData& data,\r
 +      const vector<CompilerFlag*>* compilerFlags,\r
 +      const vector<LinkerFlag*>* linkerFlags )\r
 +{\r
 +      size_t i;\r
 +\r
 +      const vector<File*>& files = data.files;\r
 +      if ( files.size () > 0 )\r
 +      {\r
 +              for ( i = 0; i < files.size (); i++ )\r
 +              {\r
 +                      File& file = *files[i];\r
 +                      if ( file.first )\r
 +                      {\r
 +                              fprintf ( fMakefile,\r
 +                                      "%s := %s $(%s)\n",\r
 +                                      objectsMacro.c_str(),\r
 +                                      GetObjectFilename (\r
 +                                              file.name, NULL ).c_str (),\r
 +                                      objectsMacro.c_str() );\r
 +                      }\r
 +              }\r
 +              fprintf (\r
 +                      fMakefile,\r
 +                      "%s %s",\r
 +                      objectsMacro.c_str (),\r
 +                      assignmentOperation );\r
 +              for ( i = 0; i < files.size(); i++ )\r
 +              {\r
 +                      File& file = *files[i];\r
 +                      if ( !file.first )\r
 +                      {\r
 +                              fprintf (\r
 +                                      fMakefile,\r
 +                                      "%s%s",\r
 +                                      ( i%10 == 9 ? " \\\n\t" : " " ),\r
 +                                      GetObjectFilename (\r
 +                                              file.name, NULL ).c_str () );\r
 +                      }\r
 +              }\r
 +              fprintf ( fMakefile, "\n" );\r
 +      }\r
 +\r
 +      const vector<If*>& ifs = data.ifs;\r
 +      for ( i = 0; i < ifs.size(); i++ )\r
 +      {\r
 +              If& rIf = *ifs[i];\r
 +              if ( rIf.data.defines.size()\r
 +                      || rIf.data.includes.size()\r
 +                      || rIf.data.libraries.size()\r
 +                      || rIf.data.files.size()\r
 +                      || rIf.data.ifs.size() )\r
 +              {\r
 +                      fprintf (\r
 +                              fMakefile,\r
 +                              "ifeq (\"$(%s)\",\"%s\")\n",\r
 +                              rIf.property.c_str(),\r
 +                              rIf.value.c_str() );\r
 +                      GenerateObjectMacros (\r
 +                              "+=",\r
 +                              rIf.data,\r
 +                              NULL,\r
 +                              NULL );\r
 +                      fprintf ( \r
 +                              fMakefile,\r
 +                              "endif\n\n" );\r
 +              }\r
 +      }\r
 +}\r
 +\r
 +void\r
 +MingwModuleHandler::GenerateGccCommand (\r
 +      const string& sourceFilename,\r
 +      const string& cc,\r
 +      const string& cflagsMacro )\r
 +{\r
 +      string dependencies = sourceFilename;\r
 +      if ( module.pch && use_pch )\r
 +              dependencies += " " + module.pch->header + ".gch";\r
 +      \r
 +      /* WIDL generated headers may be used */\r
 +      dependencies += " " + GetLinkingDependenciesMacro ();\r
 +      dependencies += " " + NormalizeFilename ( module.xmlbuildFile );\r
 +\r
 +      string objectFilename = GetObjectFilename (\r
 +              sourceFilename, &clean_files );\r
 +      fprintf ( fMakefile,\r
 +                "%s: %s | %s\n",\r
 +                objectFilename.c_str (),\r
 +                dependencies.c_str (),\r
 +                GetDirectory ( objectFilename ).c_str () );\r
 +      fprintf ( fMakefile, "\t$(ECHO_CC)\n" );\r
 +      fprintf ( fMakefile,\r
 +               "\t%s -c $< -o $@ %s\n",\r
 +               cc.c_str (),\r
 +               cflagsMacro.c_str () );\r
 +}\r
 +\r
 +void\r
 +MingwModuleHandler::GenerateGccAssemblerCommand (\r
 +      const string& sourceFilename,\r
 +      const string& cc,\r
 +      const string& cflagsMacro )\r
 +{\r
 +      string dependencies = sourceFilename;\r
 +      dependencies += " " + NormalizeFilename ( module.xmlbuildFile );\r
 +      string objectFilename = GetObjectFilename (\r
 +              sourceFilename, &clean_files );\r
 +      fprintf ( fMakefile,\r
 +                "%s: %s | %s\n",\r
 +                objectFilename.c_str (),\r
 +                dependencies.c_str (),\r
 +                GetDirectory ( objectFilename ).c_str () );\r
 +      fprintf ( fMakefile, "\t$(ECHO_GAS)\n" );\r
 +      fprintf ( fMakefile,\r
 +                "\t%s -x assembler-with-cpp -c $< -o $@ -D__ASM__ %s\n",\r
 +                cc.c_str (),\r
 +                cflagsMacro.c_str () );\r
 +}\r
 +\r
 +void\r
 +MingwModuleHandler::GenerateNasmCommand (\r
 +      const string& sourceFilename,\r
 +      const string& nasmflagsMacro )\r
 +{\r
 +      string dependencies = sourceFilename;\r
 +      dependencies += " " + NormalizeFilename ( module.xmlbuildFile );\r
 +      string objectFilename = GetObjectFilename (\r
 +              sourceFilename, &clean_files );\r
 +      fprintf ( fMakefile,\r
 +                "%s: %s | %s\n",\r
 +                objectFilename.c_str (),\r
 +                dependencies.c_str (),\r
 +                GetDirectory ( objectFilename ).c_str () );\r
 +      fprintf ( fMakefile, "\t$(ECHO_NASM)\n" );\r
 +      fprintf ( fMakefile,\r
 +                "\t%s -f win32 $< -o $@ %s\n",\r
 +                "$(Q)nasm",\r
 +                nasmflagsMacro.c_str () );\r
 +}\r
 +\r
 +void\r
 +MingwModuleHandler::GenerateWindresCommand (\r
 +      const string& sourceFilename,\r
 +      const string& windresflagsMacro )\r
 +{\r
 +      string dependencies = sourceFilename;\r
 +      dependencies += " " + NormalizeFilename ( module.xmlbuildFile );\r
 +      string objectFilename =\r
 +              GetObjectFilename ( sourceFilename, &clean_files );\r
 +      string rciFilename = ros_temp + module.name + ".rci.tmp";\r
 +      string resFilename = ros_temp + module.name + ".res.tmp";\r
 +      if ( module.useWRC )\r
 +      {\r
 +              fprintf ( fMakefile,\r
 +                        "%s: %s $(WRC_TARGET) | %s\n",\r
 +                        objectFilename.c_str (),\r
 +                        dependencies.c_str (),\r
 +                        GetDirectory ( objectFilename ).c_str () );\r
 +              fprintf ( fMakefile, "\t$(ECHO_WRC)\n" );\r
 +              fprintf ( fMakefile,\r
 +                       "\t${gcc} -xc -E -DRC_INVOKED ${%s} %s > %s\n",\r
 +                       windresflagsMacro.c_str (),\r
 +                       sourceFilename.c_str (),\r
 +                       rciFilename.c_str () );\r
 +              fprintf ( fMakefile,\r
 +                       "\t$(Q)$(WRC_TARGET) ${%s} %s %s\n",\r
 +                       windresflagsMacro.c_str (),\r
 +                       rciFilename.c_str (),\r
 +                       resFilename.c_str () );\r
 +              fprintf ( fMakefile,\r
 +                       "\t-@${rm} %s 2>$(NUL)\n",\r
 +                       rciFilename.c_str () );\r
 +              fprintf ( fMakefile,\r
 +                       "\t${windres} %s -o $@\n",\r
 +                       resFilename.c_str () );\r
 +              fprintf ( fMakefile,\r
 +                       "\t-@${rm} %s 2>$(NUL)\n",\r
 +                       resFilename.c_str () );\r
 +      }\r
 +      else\r
 +      {\r
 +              fprintf ( fMakefile,\r
 +                        "%s: %s $(WRC_TARGET) | %s\n",\r
 +                        objectFilename.c_str (),\r
 +                        dependencies.c_str (),\r
 +                        GetDirectory ( objectFilename ).c_str () );\r
 +              fprintf ( fMakefile, "\t$(ECHO_WRC)\n" );\r
 +              fprintf ( fMakefile,\r
 +                       "\t${windres} $(%s) %s -o $@\n",\r
 +                       windresflagsMacro.c_str (),\r
 +                       sourceFilename.c_str () );\r
 +      }\r
 +}\r
 +\r
 +void\r
 +MingwModuleHandler::GenerateWinebuildCommands (\r
 +      const string& sourceFilename )\r
 +{\r
 +      string dependencies = sourceFilename;\r
 +      dependencies += " " + NormalizeFilename ( module.xmlbuildFile );\r
 +\r
 +      string basename = GetBasename ( sourceFilename );\r
 +      string def_file = PassThruCacheDirectory (\r
 +              basename + ".spec.def",\r
 +              backend->intermediateDirectory );\r
 +      CLEAN_FILE(def_file);\r
 +\r
 +      string stub_file = PassThruCacheDirectory (\r
 +              basename + ".stubs.c",\r
 +              backend->intermediateDirectory );\r
 +      CLEAN_FILE(stub_file)\r
 +\r
 +      fprintf ( fMakefile,\r
 +                "%s: %s $(WINEBUILD_TARGET)\n",\r
 +                def_file.c_str (),\r
 +                dependencies.c_str () );\r
 +      fprintf ( fMakefile, "\t$(ECHO_WINEBLD)\n" );\r
 +      fprintf ( fMakefile,\r
 +                "\t%s --def=%s -o %s\n",\r
 +                "$(Q)$(WINEBUILD_TARGET)",\r
 +                sourceFilename.c_str (),\r
 +                def_file.c_str () );\r
 +\r
 +      fprintf ( fMakefile,\r
 +                "%s: %s $(WINEBUILD_TARGET)\n",\r
 +                stub_file.c_str (),\r
 +                sourceFilename.c_str () );\r
 +      fprintf ( fMakefile, "\t$(ECHO_WINEBLD)\n" );\r
 +      fprintf ( fMakefile,\r
 +                "\t%s --pedll=%s -o %s\n",\r
 +                "$(Q)$(WINEBUILD_TARGET)",\r
 +                sourceFilename.c_str (),\r
 +                stub_file.c_str () );\r
 +}\r
 +\r
++string\r
++MingwModuleHandler::GetWidlFlags ( const File& file )\r
++{\r
++      return file.switches;\r
++}\r
++              \r
 +void\r
 +MingwModuleHandler::GenerateWidlCommandsServer (\r
-       string dependencies = sourceFilename;\r
++      const File& file,\r
 +      const string& widlflagsMacro )\r
 +{\r
-       string basename = GetBasename ( sourceFilename );\r
++      string dependencies = file.name;\r
 +      dependencies += " " + NormalizeFilename ( module.xmlbuildFile );\r
 +\r
-                 "\t%s %s -h -H %s -s -S %s %s\n",\r
++      string basename = GetBasename ( file.name );\r
 +\r
 +      /*string generatedHeaderFilename = PassThruCacheDirectory (\r
 +              basename + ".h",\r
 +              backend->intermediateDirectory );\r
 +      CLEAN_FILE(generatedHeaderFilename);\r
 +      */\r
 +      string generatedHeaderFilename = basename + "_s.h";\r
 +      CLEAN_FILE(generatedHeaderFilename);\r
 +\r
 +      string generatedServerFilename = PassThruCacheDirectory (\r
 +              basename + "_s.c",\r
 +              backend->intermediateDirectory );\r
 +      CLEAN_FILE(generatedServerFilename);\r
 +\r
 +      fprintf ( fMakefile,\r
 +                "%s %s: %s $(WIDL_TARGET) | %s\n",\r
 +                generatedServerFilename.c_str (),\r
 +                generatedHeaderFilename.c_str (),\r
 +                dependencies.c_str (),\r
 +                GetDirectory ( generatedServerFilename ).c_str () );\r
 +      fprintf ( fMakefile, "\t$(ECHO_WIDL)\n" );\r
 +      fprintf ( fMakefile,\r
-                 sourceFilename.c_str () );\r
++                "\t%s %s %s -h -H %s -s -S %s %s\n",\r
 +                "$(Q)$(WIDL_TARGET)",\r
++                GetWidlFlags ( file ).c_str (),\r
 +                widlflagsMacro.c_str (),\r
 +                generatedHeaderFilename.c_str (),\r
 +                generatedServerFilename.c_str (),\r
-       const string& sourceFilename,\r
++                file.name.c_str () );\r
 +}\r
 +\r
 +void\r
 +MingwModuleHandler::GenerateWidlCommandsClient (\r
-       string dependencies = sourceFilename;\r
++      const File& file,\r
 +      const string& widlflagsMacro )\r
 +{\r
-       string basename = GetBasename ( sourceFilename );\r
++      string dependencies = file.name;\r
 +      dependencies += " " + NormalizeFilename ( module.xmlbuildFile );\r
 +\r
-                 "\t%s %s -h -H %s -c -C %s %s\n",\r
++      string basename = GetBasename ( file.name );\r
 +\r
 +      /*string generatedHeaderFilename = PassThruCacheDirectory (\r
 +              basename + ".h",\r
 +              backend->intermediateDirectory );\r
 +      CLEAN_FILE(generatedHeaderFilename);\r
 +      */\r
 +      string generatedHeaderFilename = basename + "_c.h";\r
 +      CLEAN_FILE(generatedHeaderFilename);\r
 +\r
 +      string generatedClientFilename = PassThruCacheDirectory (\r
 +              basename + "_c.c",\r
 +              backend->intermediateDirectory );\r
 +      CLEAN_FILE(generatedClientFilename);\r
 +\r
 +      fprintf ( fMakefile,\r
 +                "%s %s: %s $(WIDL_TARGET) | %s\n",\r
 +                generatedClientFilename.c_str (),\r
 +                generatedHeaderFilename.c_str (),\r
 +                dependencies.c_str (),\r
 +                GetDirectory ( generatedClientFilename ).c_str () );\r
 +      fprintf ( fMakefile, "\t$(ECHO_WIDL)\n" );\r
 +      fprintf ( fMakefile,\r
-                 sourceFilename.c_str () );\r
++                "\t%s %s %s -h -H %s -c -C %s %s\n",\r
 +                "$(Q)$(WIDL_TARGET)",\r
++                GetWidlFlags ( file ).c_str (),\r
 +                widlflagsMacro.c_str (),\r
 +                generatedHeaderFilename.c_str (),\r
 +                generatedClientFilename.c_str (),\r
-       const string& sourceFilename,\r
++                file.name.c_str () );\r
 +}\r
 +\r
 +void\r
 +MingwModuleHandler::GenerateWidlCommands (\r
-               GenerateWidlCommandsServer ( sourceFilename,\r
++      const File& file,\r
 +      const string& widlflagsMacro )\r
 +{\r
 +      if ( module.type == RpcServer )\r
-               GenerateWidlCommandsClient ( sourceFilename,\r
++              GenerateWidlCommandsServer ( file,\r
 +                                           widlflagsMacro );\r
 +      else\r
-       const string& sourceFilename,\r
++              GenerateWidlCommandsClient ( file,\r
 +                                           widlflagsMacro );\r
 +}\r
 +\r
 +void\r
 +MingwModuleHandler::GenerateCommands (\r
-       string extension = GetExtension ( sourceFilename );\r
++      const File& file,\r
 +      const string& cc,\r
 +      const string& cppc,\r
 +      const string& cflagsMacro,\r
 +      const string& nasmflagsMacro,\r
 +      const string& windresflagsMacro,\r
 +      const string& widlflagsMacro )\r
 +{\r
-               GenerateGccCommand ( sourceFilename,\r
++      string extension = GetExtension ( file.name );\r
 +      if ( extension == ".c" || extension == ".C" )\r
 +      {\r
-               GenerateGccCommand ( sourceFilename,\r
++              GenerateGccCommand ( file.name,\r
 +                                   cc,\r
 +                                   cflagsMacro );\r
 +              return;\r
 +      }\r
 +      else if ( extension == ".cc" || extension == ".CC" ||\r
 +                extension == ".cpp" || extension == ".CPP" ||\r
 +                extension == ".cxx" || extension == ".CXX" )\r
 +      {\r
-               GenerateGccAssemblerCommand ( sourceFilename,\r
++              GenerateGccCommand ( file.name,\r
 +                                   cppc,\r
 +                                   cflagsMacro );\r
 +              return;\r
 +      }\r
 +      else if ( extension == ".s" || extension == ".S" )\r
 +      {\r
-               GenerateNasmCommand ( sourceFilename,\r
++              GenerateGccAssemblerCommand ( file.name,\r
 +                                            cc,\r
 +                                            cflagsMacro );\r
 +              return;\r
 +      }\r
 +      else if ( extension == ".asm" || extension == ".ASM" )\r
 +      {\r
-               GenerateWindresCommand ( sourceFilename,\r
++              GenerateNasmCommand ( file.name,\r
 +                                    nasmflagsMacro );\r
 +              return;\r
 +      }\r
 +      else if ( extension == ".rc" || extension == ".RC" )\r
 +      {\r
-               GenerateWinebuildCommands ( sourceFilename );\r
-               GenerateGccCommand ( GetActualSourceFilename ( sourceFilename ),\r
++              GenerateWindresCommand ( file.name,\r
 +                                       windresflagsMacro );\r
 +              return;\r
 +      }\r
 +      else if ( extension == ".spec" || extension == ".SPEC" )\r
 +      {\r
-               GenerateWidlCommands ( sourceFilename,\r
++              GenerateWinebuildCommands ( file.name );\r
++              GenerateGccCommand ( GetActualSourceFilename ( file.name ),\r
 +                                   cc,\r
 +                                   cflagsMacro );\r
 +              return;\r
 +      }\r
 +      else if ( extension == ".idl" || extension == ".IDL" )\r
 +      {\r
-               GenerateGccCommand ( GetActualSourceFilename ( sourceFilename ),\r
++              GenerateWidlCommands ( file,\r
 +                                     widlflagsMacro );\r
-                                         sourceFilename.c_str () );\r
++              GenerateGccCommand ( GetActualSourceFilename ( file.name ),\r
 +                                   cc,\r
 +                                   cflagsMacro );\r
 +              return;\r
 +      }\r
 +\r
 +      throw InvalidOperationException ( __FILE__,\r
 +                                        __LINE__,\r
 +                                        "Unsupported filename extension '%s' in file '%s'",\r
 +                                        extension.c_str (),\r
-               string sourceFilename = files[i]->name;\r
-               GenerateCommands ( sourceFilename,\r
++                                        file.name.c_str () );\r
 +}\r
 +\r
 +void\r
 +MingwModuleHandler::GenerateBuildMapCode ()\r
 +{\r
 +      fprintf ( fMakefile,\r
 +                "ifeq ($(ROS_BUILDMAP),full)\n" );\r
 +\r
 +      string mapFilename = PassThruCacheDirectory (\r
 +              GetBasename ( module.GetPath () ) + ".map",\r
 +              backend->outputDirectory );\r
 +      CLEAN_FILE ( mapFilename );\r
 +      \r
 +      fprintf ( fMakefile,\r
 +                "\t$(ECHO_OBJDUMP)\n" );\r
 +      fprintf ( fMakefile,\r
 +                "\t$(Q)${objdump} -d -S $@ > %s\n",\r
 +                mapFilename.c_str () );\r
 +\r
 +      fprintf ( fMakefile,\r
 +                "else\n" );\r
 +      fprintf ( fMakefile,\r
 +                "ifeq ($(ROS_BUILDMAP),yes)\n" );\r
 +\r
 +      fprintf ( fMakefile,\r
 +                "\t$(ECHO_NM)\n" );\r
 +      fprintf ( fMakefile,\r
 +                "\t$(Q)${nm} --numeric-sort $@ > %s\n",\r
 +                mapFilename.c_str () );\r
 +\r
 +      fprintf ( fMakefile,\r
 +                "endif\n" );\r
 +\r
 +      fprintf ( fMakefile,\r
 +                "endif\n" );\r
 +}\r
 +\r
 +void\r
 +MingwModuleHandler::GenerateBuildNonSymbolStrippedCode ()\r
 +{\r
 +      fprintf ( fMakefile,\r
 +                "ifeq ($(ROS_BUILDNOSTRIP),yes)\n" );\r
 +\r
 +      string filename = module.GetPath ();\r
 +      string outputFilename = PassThruCacheDirectory (\r
 +              filename,\r
 +              backend->outputDirectory );\r
 +      string nostripFilename = PassThruCacheDirectory (\r
 +              GetBasename ( filename ) + ".nostrip" + GetExtension ( filename ),\r
 +              backend->outputDirectory );\r
 +      CLEAN_FILE ( nostripFilename );\r
 +      \r
 +      fprintf ( fMakefile,\r
 +                "\t$(ECHO_CP)\n" );\r
 +      fprintf ( fMakefile,\r
 +                        "\t${cp} %s %s 1>$(NUL)\n",\r
 +                        outputFilename.c_str (),\r
 +                nostripFilename.c_str () );\r
 +      \r
 +      fprintf ( fMakefile,\r
 +                "endif\n" );\r
 +}\r
 +\r
 +void\r
 +MergeStringVector ( const vector<string>& input,\r
 +                      vector<string>& output )\r
 +{\r
 +      int wrap_at = 25;\r
 +      string s;\r
 +      int wrap_count = -1;\r
 +      for ( size_t i = 0; i < input.size (); i++ )\r
 +      {\r
 +              if ( input[i].size () == 0 )\r
 +                      continue;\r
 +              if ( wrap_count++ == wrap_at )\r
 +              {\r
 +                      output.push_back ( s );\r
 +                      s = "";\r
 +                      wrap_count = 0;\r
 +              }\r
 +              else if ( s.size () > 0)\r
 +                      s += " ";\r
 +              s += input[i];\r
 +      }\r
 +      if ( s.length () > 0 )\r
 +              output.push_back ( s );\r
 +}\r
 +\r
 +void\r
 +MingwModuleHandler::GetObjectsVector ( const IfableData& data,\r
 +                                       vector<string>& objectFiles ) const\r
 +{\r
 +      for ( size_t i = 0; i < data.files.size (); i++ )\r
 +      {\r
 +              File& file = *data.files[i];\r
 +              objectFiles.push_back ( GetObjectFilename ( file.name, NULL ) );\r
 +      }\r
 +}\r
 +\r
 +void\r
 +MingwModuleHandler::GenerateCleanObjectsAsYouGoCode () const\r
 +{\r
 +      if ( backend->cleanAsYouGo )\r
 +      {\r
 +              vector<string> objectFiles;\r
 +              GetObjectsVector ( module.non_if_data,\r
 +                           objectFiles );\r
 +              vector<string> lines;\r
 +              MergeStringVector ( objectFiles,\r
 +                              lines );\r
 +              for ( size_t i = 0; i < lines.size (); i++ )\r
 +              {\r
 +                      fprintf ( fMakefile,\r
 +                                "\t-@${rm} %s 2>$(NUL)\n",\r
 +                                lines[i].c_str () );\r
 +              }\r
 +      }\r
 +}\r
 +\r
 +void\r
 +MingwModuleHandler::GenerateLinkerCommand (\r
 +      const string& dependencies,\r
 +      const string& linker,\r
 +      const string& linkerParameters,\r
 +      const string& objectsMacro,\r
 +      const string& libsMacro )\r
 +{\r
 +      string target ( GetTargetMacro ( module ) );\r
 +      string target_folder ( GetDirectory ( GetTargetFilename ( module, NULL ) ) );\r
 +\r
 +      fprintf ( fMakefile,\r
 +              "%s: %s $(RSYM_TARGET) | %s\n",\r
 +              target.c_str (),\r
 +              dependencies.c_str (),\r
 +              target_folder.c_str () );\r
 +      fprintf ( fMakefile, "\t$(ECHO_LD)\n" );\r
 +      string targetName ( module.GetTargetName () );\r
 +      if ( module.importLibrary != NULL )\r
 +      {\r
 +              string base_tmp = ros_temp + module.name + ".base.tmp";\r
 +              CLEAN_FILE ( base_tmp );\r
 +              string junk_tmp = ros_temp + module.name + ".junk.tmp";\r
 +              CLEAN_FILE ( junk_tmp );\r
 +              string temp_exp = ros_temp + module.name + ".temp.exp";\r
 +              CLEAN_FILE ( temp_exp );\r
 +              string def_file = GetDefinitionFilename ();\r
 +\r
 +              fprintf ( fMakefile,\r
 +                        "\t%s %s -Wl,--base-file,%s -o %s %s %s %s\n",\r
 +                        linker.c_str (),\r
 +                        linkerParameters.c_str (),\r
 +                        base_tmp.c_str (),\r
 +                        junk_tmp.c_str (),\r
 +                        objectsMacro.c_str (),\r
 +                        libsMacro.c_str (),\r
 +                        GetLinkerMacro ().c_str () );\r
 +\r
 +              fprintf ( fMakefile,\r
 +                        "\t-@${rm} %s 2>$(NUL)\n",\r
 +                        junk_tmp.c_str () );\r
 +\r
 +              string killAt = module.mangledSymbols ? "" : "--kill-at";\r
 +              fprintf ( fMakefile,\r
 +                        "\t${dlltool} --dllname %s --base-file %s --def %s --output-exp %s %s\n",\r
 +                        targetName.c_str (),\r
 +                        base_tmp.c_str (),\r
 +                        def_file.c_str (),\r
 +                        temp_exp.c_str (),\r
 +                        killAt.c_str () );\r
 +\r
 +              fprintf ( fMakefile,\r
 +                        "\t-@${rm} %s 2>$(NUL)\n",\r
 +                        base_tmp.c_str () );\r
 +\r
 +              fprintf ( fMakefile,\r
 +                        "\t%s %s %s -o %s %s %s %s\n",\r
 +                        linker.c_str (),\r
 +                        linkerParameters.c_str (),\r
 +                        temp_exp.c_str (),\r
 +                        target.c_str (),\r
 +                        objectsMacro.c_str (),\r
 +                        libsMacro.c_str (),\r
 +                        GetLinkerMacro ().c_str () );\r
 +\r
 +              fprintf ( fMakefile,\r
 +                        "\t-@${rm} %s 2>$(NUL)\n",\r
 +                        temp_exp.c_str () );\r
 +              \r
 +              GenerateCleanObjectsAsYouGoCode ();\r
 +      }\r
 +      else\r
 +      {\r
 +              fprintf ( fMakefile,\r
 +                        "\t%s %s -o %s %s %s %s\n",\r
 +                        linker.c_str (),\r
 +                        linkerParameters.c_str (),\r
 +                        target.c_str (),\r
 +                        objectsMacro.c_str (),\r
 +                        libsMacro.c_str (),\r
 +                        GetLinkerMacro ().c_str () );\r
 +\r
 +              GenerateCleanObjectsAsYouGoCode ();\r
 +      }\r
 +\r
 +      GenerateBuildMapCode ();\r
 +\r
 +      GenerateBuildNonSymbolStrippedCode ();\r
 +\r
 +      fprintf ( fMakefile,\r
 +                "\t$(ECHO_RSYM)\n" );\r
 +      fprintf ( fMakefile,\r
 +                "\t$(Q)$(RSYM_TARGET) $@ $@\n\n" );\r
 +}\r
 +\r
 +void\r
 +MingwModuleHandler::GeneratePhonyTarget() const\r
 +{\r
 +      string targetMacro ( GetTargetMacro(module) );\r
 +      fprintf ( fMakefile, ".PHONY: %s\n\n",\r
 +                targetMacro.c_str ());\r
 +      fprintf ( fMakefile, "%s: | %s\n",\r
 +                targetMacro.c_str (),\r
 +                GetDirectory(GetTargetFilename(module,NULL)).c_str () );\r
 +}\r
 +\r
 +void\r
 +MingwModuleHandler::GenerateObjectFileTargets (\r
 +      const IfableData& data,\r
 +      const string& cc,\r
 +      const string& cppc,\r
 +      const string& cflagsMacro,\r
 +      const string& nasmflagsMacro,\r
 +      const string& windresflagsMacro,\r
 +      const string& widlflagsMacro )\r
 +{\r
 +      size_t i;\r
 +      \r
 +      const vector<File*>& files = data.files;\r
 +      for ( i = 0; i < files.size (); i++ )\r
 +      {\r
++              GenerateCommands ( *files[i],\r
 +                                 cc,\r
 +                                 cppc,\r
 +                                 cflagsMacro,\r
 +                                 nasmflagsMacro,\r
 +                                 windresflagsMacro,\r
 +                                 widlflagsMacro );\r
 +              fprintf ( fMakefile,\r
 +                        "\n" );\r
 +      }\r
 +\r
 +      const vector<If*>& ifs = data.ifs;\r
 +      for ( i = 0; i < ifs.size(); i++ )\r
 +      {\r
 +              GenerateObjectFileTargets ( ifs[i]->data,\r
 +                                          cc,\r
 +                                          cppc,\r
 +                                          cflagsMacro,\r
 +                                          nasmflagsMacro,\r
 +                                          windresflagsMacro,\r
 +                                          widlflagsMacro );\r
 +      }\r
 +}\r
 +\r
 +void\r
 +MingwModuleHandler::GenerateObjectFileTargets (\r
 +      const string& cc,\r
 +      const string& cppc,\r
 +      const string& cflagsMacro,\r
 +      const string& nasmflagsMacro,\r
 +      const string& windresflagsMacro,\r
 +      const string& widlflagsMacro )\r
 +{\r
 +      if ( module.pch )\r
 +      {\r
 +              const string& pch_file = module.pch->header;\r
 +              string gch_file = pch_file + ".gch";\r
 +              CLEAN_FILE(gch_file);\r
 +              if ( use_pch )\r
 +              {\r
 +                      fprintf (\r
 +                              fMakefile,\r
 +                              "%s: %s\n",\r
 +                              gch_file.c_str(),\r
 +                              pch_file.c_str() );\r
 +                      fprintf ( fMakefile, "\t$(ECHO_PCH)\n" );\r
 +                      fprintf (\r
 +                              fMakefile,\r
 +                              "\t%s -o %s %s -g %s\n\n",\r
 +                              ( module.cplusplus ? cppc.c_str() : cc.c_str() ),\r
 +                              gch_file.c_str(),\r
 +                              cflagsMacro.c_str(),\r
 +                              pch_file.c_str() );\r
 +              }\r
 +      }\r
 +\r
 +      GenerateObjectFileTargets ( module.non_if_data,\r
 +                                  cc,\r
 +                                  cppc,\r
 +                                  cflagsMacro,\r
 +                                  nasmflagsMacro,\r
 +                                  windresflagsMacro,\r
 +                                  widlflagsMacro );\r
 +      fprintf ( fMakefile, "\n" );\r
 +}\r
 +\r
 +string\r
 +MingwModuleHandler::GenerateArchiveTarget ( const string& ar,\r
 +                                            const string& objs_macro ) const\r
 +{\r
 +      string archiveFilename ( GetModuleArchiveFilename () );\r
 +      \r
 +      fprintf ( fMakefile,\r
 +                "%s: %s | %s\n",\r
 +                archiveFilename.c_str (),\r
 +                objs_macro.c_str (),\r
 +                GetDirectory(archiveFilename).c_str() );\r
 +\r
 +      fprintf ( fMakefile, "\t$(ECHO_AR)\n" );\r
 +\r
 +      fprintf ( fMakefile,\r
 +                "\t%s -rc $@ %s\n",\r
 +                ar.c_str (),\r
 +                objs_macro.c_str ());\r
 +\r
 +      GenerateCleanObjectsAsYouGoCode ();\r
 +\r
 +      fprintf ( fMakefile, "\n" );\r
 +\r
 +      return archiveFilename;\r
 +}\r
 +\r
 +string\r
 +MingwModuleHandler::GetCFlagsMacro () const\r
 +{\r
 +      return ssprintf ( "$(%s_CFLAGS)",\r
 +                        module.name.c_str () );\r
 +}\r
 +\r
 +/*static*/ string\r
 +MingwModuleHandler::GetObjectsMacro ( const Module& module )\r
 +{\r
 +      return ssprintf ( "$(%s_OBJS)",\r
 +                        module.name.c_str () );\r
 +}\r
 +\r
 +string\r
 +MingwModuleHandler::GetLinkingDependenciesMacro () const\r
 +{\r
 +      return ssprintf ( "$(%s_LINKDEPS)", module.name.c_str () );\r
 +}\r
 +\r
 +string\r
 +MingwModuleHandler::GetLibsMacro () const\r
 +{\r
 +      return ssprintf ( "$(%s_LIBS)", module.name.c_str () );\r
 +}\r
 +\r
 +string\r
 +MingwModuleHandler::GetLinkerMacro () const\r
 +{\r
 +      return ssprintf ( "$(%s_LFLAGS)",\r
 +                        module.name.c_str () );\r
 +}\r
 +\r
 +string\r
 +MingwModuleHandler::GetModuleTargets ( const Module& module )\r
 +{\r
 +      if ( ReferenceObjects ( module ) )\r
 +              return GetObjectsMacro ( module );\r
 +      else\r
 +              return GetTargetFilename ( module, NULL );\r
 +}\r
 +\r
 +void\r
 +MingwModuleHandler::GenerateObjectMacro ()\r
 +{\r
 +      objectsMacro = ssprintf ("%s_OBJS", module.name.c_str ());\r
 +\r
 +      GenerateObjectMacros (\r
 +              "=",\r
 +              module.non_if_data,\r
 +              &module.compilerFlags,\r
 +              &module.linkerFlags );\r
 +\r
 +      // future references to the macro will be to get its values\r
 +      objectsMacro = ssprintf ("$(%s)", objectsMacro.c_str ());\r
 +}\r
 +\r
 +void\r
 +MingwModuleHandler::GenerateTargetMacro ()\r
 +{\r
 +      fprintf ( fMakefile,\r
 +              "%s := %s\n",\r
 +              GetTargetMacro ( module, false ).c_str (),\r
 +              GetModuleTargets ( module ).c_str () );\r
 +}\r
 +\r
 +void\r
 +MingwModuleHandler::GenerateOtherMacros ()\r
 +{\r
 +      cflagsMacro = ssprintf ("%s_CFLAGS", module.name.c_str ());\r
 +      nasmflagsMacro = ssprintf ("%s_NASMFLAGS", module.name.c_str ());\r
 +      windresflagsMacro = ssprintf ("%s_RCFLAGS", module.name.c_str ());\r
 +      widlflagsMacro = ssprintf ("%s_WIDLFLAGS", module.name.c_str ());\r
 +      linkerflagsMacro = ssprintf ("%s_LFLAGS", module.name.c_str ());\r
 +      libsMacro = ssprintf("%s_LIBS", module.name.c_str ());\r
 +      linkDepsMacro = ssprintf ("%s_LINKDEPS", module.name.c_str ());\r
 +\r
 +      GenerateMacros (\r
 +              "=",\r
 +              module.non_if_data,\r
 +              &module.compilerFlags,\r
 +              &module.linkerFlags );\r
 +\r
 +      if ( module.importLibrary )\r
 +      {\r
 +              string_list s;\r
 +              const vector<File*>& files = module.non_if_data.files;\r
 +              for ( size_t i = 0; i < files.size (); i++ )\r
 +              {\r
 +                      File& file = *files[i];\r
 +                      string extension = GetExtension ( file.name );\r
 +                      if ( extension == ".spec" || extension == ".SPEC" )\r
 +                              GetSpecObjectDependencies ( s, file.name );\r
 +              }\r
 +              if ( s.size () > 0 )\r
 +              {\r
 +                      fprintf (\r
 +                              fMakefile,\r
 +                              "%s +=",\r
 +                              linkDepsMacro.c_str() );\r
 +                      for ( size_t i = 0; i < s.size(); i++ )\r
 +                              fprintf ( fMakefile,\r
 +                                        " %s",\r
 +                                        s[i].c_str () );\r
 +                      fprintf ( fMakefile, "\n" );\r
 +              }\r
 +      }\r
 +\r
 +      string globalCflags = "-g";\r
 +      if ( backend->usePipe )\r
 +              globalCflags += " -pipe";\r
 +      if ( !module.enableWarnings )\r
 +              globalCflags += " -Werror";\r
 +      \r
 +      fprintf (\r
 +              fMakefile,\r
 +              "%s += $(PROJECT_CFLAGS) %s\n",\r
 +              cflagsMacro.c_str (),\r
 +              globalCflags.c_str () );\r
 +\r
 +      fprintf (\r
 +              fMakefile,\r
 +              "%s += $(PROJECT_RCFLAGS)\n",\r
 +              windresflagsMacro.c_str () );\r
 +\r
 +      fprintf (\r
 +              fMakefile,\r
 +              "%s += $(PROJECT_WIDLFLAGS)\n",\r
 +              widlflagsMacro.c_str () );\r
 +\r
 +      fprintf (\r
 +              fMakefile,\r
 +              "%s_LFLAGS += $(PROJECT_LFLAGS) -g\n",\r
 +              module.name.c_str () );\r
 +\r
 +      fprintf (\r
 +              fMakefile,\r
 +              "%s += $(%s)\n",\r
 +              linkDepsMacro.c_str (),\r
 +              libsMacro.c_str () );\r
 +\r
 +      string cflags = TypeSpecificCFlags();\r
 +      if ( cflags.size() > 0 )\r
 +      {\r
 +              fprintf ( fMakefile,\r
 +                        "%s += %s\n\n",\r
 +                        cflagsMacro.c_str (),\r
 +                        cflags.c_str () );\r
 +      }\r
 +\r
 +      string nasmflags = TypeSpecificNasmFlags();\r
 +      if ( nasmflags.size () > 0 )\r
 +      {\r
 +              fprintf ( fMakefile,\r
 +                        "%s += %s\n\n",\r
 +                        nasmflagsMacro.c_str (),\r
 +                        nasmflags.c_str () );\r
 +      }\r
 +\r
 +      string linkerflags = TypeSpecificLinkerFlags();\r
 +      if ( linkerflags.size() > 0 )\r
 +      {\r
 +              fprintf ( fMakefile,\r
 +                        "%s += %s\n\n",\r
 +                        linkerflagsMacro.c_str (),\r
 +                        linkerflags.c_str () );\r
 +      }\r
 +\r
 +      fprintf ( fMakefile, "\n\n" );\r
 +\r
 +      // future references to the macros will be to get their values\r
 +      cflagsMacro = ssprintf ("$(%s)", cflagsMacro.c_str ());\r
 +      nasmflagsMacro = ssprintf ("$(%s)", nasmflagsMacro.c_str ());\r
 +      widlflagsMacro = ssprintf ("$(%s)", widlflagsMacro.c_str ());\r
 +}\r
 +\r
 +void\r
 +MingwModuleHandler::GenerateRules ()\r
 +{\r
 +      string cc = ( module.host == HostTrue ? "${host_gcc}" : "${gcc}" );\r
 +      string cppc = ( module.host == HostTrue ? "${host_gpp}" : "${gpp}" );\r
 +      string ar = ( module.host == HostTrue ? "${host_ar}" : "${ar}" );\r
 +\r
 +      string targetMacro = GetTargetMacro ( module );\r
 +\r
 +      CLEAN_FILE ( targetMacro );\r
 +\r
 +      // generate phony target for module name\r
 +      fprintf ( fMakefile, ".PHONY: %s\n",\r
 +              module.name.c_str () );\r
 +      fprintf ( fMakefile, "%s: %s\n\n",\r
 +              module.name.c_str (),\r
 +              GetTargetMacro ( module ).c_str () );\r
 +\r
 +      if ( !ReferenceObjects ( module ) )\r
 +      {\r
 +              string ar_target ( GenerateArchiveTarget ( ar, objectsMacro ) );\r
 +              if ( targetMacro != ar_target )\r
 +              {\r
 +                      CLEAN_FILE ( ar_target );\r
 +              }\r
 +      }\r
 +\r
 +      GenerateObjectFileTargets ( cc,\r
 +                                                              cppc,\r
 +                                                              cflagsMacro,\r
 +                                                              nasmflagsMacro,\r
 +                                                              windresflagsMacro,\r
 +                                                          widlflagsMacro );\r
 +}\r
 +\r
 +void\r
 +MingwModuleHandler::GetInvocationDependencies (\r
 +      const Module& module,\r
 +      string_list& dependencies )\r
 +{\r
 +      for ( size_t i = 0; i < module.invocations.size (); i++ )\r
 +      {\r
 +              Invoke& invoke = *module.invocations[i];\r
 +              if ( invoke.invokeModule == &module )\r
 +                      /* Protect against circular dependencies */\r
 +                      continue;\r
 +              invoke.GetTargets ( dependencies );\r
 +      }\r
 +}\r
 +\r
 +void\r
 +MingwModuleHandler::GenerateInvocations () const\r
 +{\r
 +      if ( module.invocations.size () == 0 )\r
 +              return;\r
 +      \r
 +      size_t iend = module.invocations.size ();\r
 +      for ( size_t i = 0; i < iend; i++ )\r
 +      {\r
 +              const Invoke& invoke = *module.invocations[i];\r
 +\r
 +              if ( invoke.invokeModule->type != BuildTool )\r
 +              {\r
 +                      throw InvalidBuildFileException ( module.node.location,\r
 +                                                        "Only modules of type buildtool can be invoked." );\r
 +              }\r
 +\r
 +              string invokeTarget = module.GetInvocationTarget ( i );\r
 +              string_list invoke_targets;\r
 +              assert ( invoke_targets.size() );\r
 +              invoke.GetTargets ( invoke_targets );\r
 +              fprintf ( fMakefile,\r
 +                        ".PHONY: %s\n\n",\r
 +                        invokeTarget.c_str () );\r
 +              fprintf ( fMakefile,\r
 +                        "%s:",\r
 +                        invokeTarget.c_str () );\r
 +              size_t j, jend = invoke_targets.size();\r
 +              for ( j = 0; j < jend; j++ )\r
 +              {\r
 +                      fprintf ( fMakefile,\r
 +                                " %s",\r
 +                                invoke_targets[i].c_str () );\r
 +              }\r
 +              fprintf ( fMakefile, "\n\n%s", invoke_targets[0].c_str () );\r
 +              for ( j = 1; j < jend; j++ )\r
 +                      fprintf ( fMakefile,\r
 +                                " %s",\r
 +                                invoke_targets[i].c_str () );\r
 +              fprintf ( fMakefile,\r
 +                        ": %s\n",\r
 +                        NormalizeFilename ( invoke.invokeModule->GetPath () ).c_str () );\r
 +              fprintf ( fMakefile, "\t$(ECHO_INVOKE)\n" );\r
 +              fprintf ( fMakefile,\r
 +                        "\t%s %s\n\n",\r
 +                        NormalizeFilename ( invoke.invokeModule->GetPath () ).c_str (),\r
 +                        invoke.GetParameters ().c_str () );\r
 +      }\r
 +}\r
 +\r
 +string\r
 +MingwModuleHandler::GetPreconditionDependenciesName () const\r
 +{\r
 +      return module.name + "_precondition";\r
 +}\r
 +\r
 +void\r
 +MingwModuleHandler::GetDefaultDependencies (\r
 +      string_list& dependencies ) const\r
 +{\r
 +      /* Avoid circular dependency */\r
 +      if ( module.type != BuildTool\r
 +              && module.name != "zlib"\r
 +              && module.name != "hostzlib" )\r
 +\r
 +              dependencies.push_back ( "$(INIT)" );\r
 +}\r
 +\r
 +void\r
 +MingwModuleHandler::GeneratePreconditionDependencies ()\r
 +{\r
 +      string preconditionDependenciesName = GetPreconditionDependenciesName ();\r
 +      string_list sourceFilenames;\r
 +      GetSourceFilenamesWithoutGeneratedFiles ( sourceFilenames );\r
 +      string_list dependencies;\r
 +      GetDefaultDependencies ( dependencies );\r
 +      GetModuleDependencies ( dependencies );\r
 +\r
 +      GetInvocationDependencies ( module, dependencies );\r
 +      \r
 +      if ( dependencies.size() )\r
 +      {\r
 +              fprintf ( fMakefile,\r
 +                        "%s =",\r
 +                        preconditionDependenciesName.c_str () );\r
 +              for ( size_t i = 0; i < dependencies.size(); i++ )\r
 +                      fprintf ( fMakefile,\r
 +                                " %s",\r
 +                                dependencies[i].c_str () );\r
 +              fprintf ( fMakefile, "\n\n" );\r
 +      }\r
 +\r
 +      for ( size_t i = 0; i < sourceFilenames.size(); i++ )\r
 +      {\r
 +              fprintf ( fMakefile,\r
 +                        "%s: ${%s}\n",\r
 +                        sourceFilenames[i].c_str(),\r
 +                        preconditionDependenciesName.c_str ());\r
 +      }\r
 +      fprintf ( fMakefile, "\n" );\r
 +}\r
 +\r
 +bool\r
 +MingwModuleHandler::IsWineModule () const\r
 +{\r
 +      if ( module.importLibrary == NULL)\r
 +              return false;\r
 +\r
 +      size_t index = module.importLibrary->definition.rfind ( ".spec.def" );\r
 +      return ( index != string::npos );\r
 +}\r
 +\r
 +string\r
 +MingwModuleHandler::GetDefinitionFilename () const\r
 +{\r
 +      string defFilename = module.GetBasePath () + SSEP + module.importLibrary->definition;\r
 +      if ( IsWineModule () )\r
 +              return PassThruCacheDirectory ( NormalizeFilename ( defFilename ),\r
 +                                              backend->intermediateDirectory );\r
 +      else\r
 +              return defFilename;\r
 +}\r
 +\r
 +void\r
 +MingwModuleHandler::GenerateImportLibraryTargetIfNeeded ()\r
 +{\r
 +      if ( module.importLibrary != NULL )\r
 +      {\r
 +              string library_target (\r
 +                      GetImportLibraryFilename ( module, &clean_files ) );\r
 +\r
 +              string_list deps;\r
 +              GetDefinitionDependencies ( deps );\r
 +\r
 +              fprintf ( fMakefile, "# IMPORT LIBRARY RULE:\n" );\r
 +\r
 +              fprintf ( fMakefile, "%s:",\r
 +                        library_target.c_str () );\r
 +\r
 +              size_t i, iend = deps.size();\r
 +              for ( i = 0; i < iend; i++ )\r
 +                      fprintf ( fMakefile, " %s",\r
 +                                deps[i].c_str () );\r
 +\r
 +              fprintf ( fMakefile, " | %s\n",\r
 +                        GetDirectory ( GetTargetFilename ( module, NULL ) ).c_str () );\r
 +\r
 +              fprintf ( fMakefile, "\t$(ECHO_DLLTOOL)\n" );\r
 +\r
 +              string killAt = module.mangledSymbols ? "" : "--kill-at";\r
 +              fprintf ( fMakefile,\r
 +                        "\t${dlltool} --dllname %s --def %s --output-lib %s %s\n\n",\r
 +                        module.GetTargetName ().c_str (),\r
 +                        GetDefinitionFilename ().c_str (),\r
 +                        library_target.c_str (),\r
 +                        killAt.c_str () );\r
 +      }\r
 +}\r
 +\r
 +void\r
 +MingwModuleHandler::GetSpecObjectDependencies (\r
 +      string_list& dependencies,\r
 +      const string& filename ) const\r
 +{\r
 +      string basename = GetBasename ( filename );\r
 +      string defDependency = PassThruCacheDirectory (\r
 +              NormalizeFilename ( basename + ".spec.def" ),\r
 +              backend->intermediateDirectory );\r
 +      dependencies.push_back ( defDependency );\r
 +      string stubsDependency = PassThruCacheDirectory (\r
 +              NormalizeFilename ( basename + ".stubs.c" ),\r
 +              backend->intermediateDirectory );\r
 +      dependencies.push_back ( stubsDependency );\r
 +}\r
 +\r
 +void\r
 +MingwModuleHandler::GetWidlObjectDependencies (\r
 +      string_list& dependencies,\r
 +      const string& filename ) const\r
 +{\r
 +      string basename = GetBasename ( filename );\r
 +      string serverDependency = PassThruCacheDirectory (\r
 +              NormalizeFilename ( basename + "_s.c" ),\r
 +              backend->intermediateDirectory );\r
 +      dependencies.push_back ( serverDependency );\r
 +}\r
 +\r
 +void\r
 +MingwModuleHandler::GetDefinitionDependencies (\r
 +      string_list& dependencies ) const\r
 +{\r
 +      string dkNkmLibNoFixup = "dk/nkm/lib";\r
 +      const vector<File*>& files = module.non_if_data.files;\r
 +      for ( size_t i = 0; i < files.size (); i++ )\r
 +      {\r
 +              File& file = *files[i];\r
 +              string extension = GetExtension ( file.name );\r
 +              if ( extension == ".spec" || extension == ".SPEC" )\r
 +              {\r
 +                      GetSpecObjectDependencies ( dependencies, file.name );\r
 +              }\r
 +              if ( extension == ".idl" || extension == ".IDL" )\r
 +              {\r
 +                      GetWidlObjectDependencies ( dependencies, file.name );\r
 +              }\r
 +      }\r
 +}\r
 +\r
 +\r
 +MingwBuildToolModuleHandler::MingwBuildToolModuleHandler ( const Module& module_ )\r
 +      : MingwModuleHandler ( module_ )\r
 +{\r
 +}\r
 +\r
 +void\r
 +MingwBuildToolModuleHandler::Process ()\r
 +{\r
 +      GenerateBuildToolModuleTarget ();\r
 +}\r
 +\r
 +void\r
 +MingwBuildToolModuleHandler::GenerateBuildToolModuleTarget ()\r
 +{\r
 +      string targetMacro ( GetTargetMacro (module) );\r
 +      string objectsMacro = GetObjectsMacro ( module );\r
 +      string linkDepsMacro = GetLinkingDependenciesMacro ();\r
 +      string libsMacro = GetLibsMacro ();\r
 +\r
 +      GenerateRules ();\r
 +\r
 +      string linker;\r
 +      if ( module.cplusplus )\r
 +              linker = "${host_gpp}";\r
 +      else\r
 +              linker = "${host_gcc}";\r
 +      \r
 +      fprintf ( fMakefile, "%s: %s %s | %s\n",\r
 +                targetMacro.c_str (),\r
 +                objectsMacro.c_str (),\r
 +                linkDepsMacro.c_str (),\r
 +                GetDirectory(GetTargetFilename(module,NULL)).c_str () );\r
 +      fprintf ( fMakefile, "\t$(ECHO_LD)\n" );\r
 +      fprintf ( fMakefile,\r
 +                "\t%s %s -o $@ %s %s\n\n",\r
 +                linker.c_str (),\r
 +                GetLinkerMacro ().c_str (),\r
 +                objectsMacro.c_str (),\r
 +                libsMacro.c_str () );\r
 +}\r
 +\r
 +\r
 +MingwKernelModuleHandler::MingwKernelModuleHandler (\r
 +      const Module& module_ )\r
 +\r
 +      : MingwModuleHandler ( module_ )\r
 +{\r
 +}\r
 +\r
 +void\r
 +MingwKernelModuleHandler::Process ()\r
 +{\r
 +      GenerateKernelModuleTarget ();\r
 +}\r
 +\r
 +void\r
 +MingwKernelModuleHandler::GenerateKernelModuleTarget ()\r
 +{\r
 +      string targetName ( module.GetTargetName () ); // i.e. "ntoskrnl.exe"\r
 +      string targetMacro ( GetTargetMacro ( module ) ); // i.e. "$(NTOSKRNL_TARGET)"\r
 +      string workingDirectory = GetWorkingDirectory ();\r
 +      string objectsMacro = GetObjectsMacro ( module );\r
 +      string linkDepsMacro = GetLinkingDependenciesMacro ();\r
 +      string libsMacro = GetLibsMacro ();\r
 +      string base_tmp = ros_temp + module.name + ".base.tmp";\r
 +      CLEAN_FILE ( base_tmp );\r
 +      string junk_tmp = ros_temp + module.name + ".junk.tmp";\r
 +      CLEAN_FILE ( junk_tmp );\r
 +      string temp_exp = ros_temp + module.name + ".temp.exp";\r
 +      CLEAN_FILE ( temp_exp );\r
 +      string gccOptions = ssprintf ("-Wl,-T,%s" SSEP "ntoskrnl.lnk -Wl,--subsystem,native -Wl,--entry,%s -Wl,--image-base,%s -Wl,--file-alignment,0x1000 -Wl,--section-alignment,0x1000 -nostartfiles -mdll",\r
 +                                    module.GetBasePath ().c_str (),\r
 +                                    module.entrypoint.c_str (),\r
 +                                    module.baseaddress.c_str () );\r
 +\r
 +      GenerateRules ();\r
 +\r
 +      GenerateImportLibraryTargetIfNeeded ();\r
 +\r
 +      fprintf ( fMakefile, "%s: %s %s $(RSYM_TARGET) | %s\n",\r
 +                targetMacro.c_str (),\r
 +                objectsMacro.c_str (),\r
 +                linkDepsMacro.c_str (),\r
 +                GetDirectory(GetTargetFilename(module,NULL)).c_str () );\r
 +      fprintf ( fMakefile, "\t$(ECHO_LD)\n" );\r
 +      fprintf ( fMakefile,\r
 +                "\t${gcc} %s %s -Wl,--base-file,%s -o %s %s %s\n",\r
 +                GetLinkerMacro ().c_str (),\r
 +                gccOptions.c_str (),\r
 +                base_tmp.c_str (),\r
 +                junk_tmp.c_str (),\r
 +                objectsMacro.c_str (),\r
 +                linkDepsMacro.c_str () );\r
 +      fprintf ( fMakefile,\r
 +                "\t-@${rm} %s 2>$(NUL)\n",\r
 +                junk_tmp.c_str () );\r
 +      string killAt = module.mangledSymbols ? "" : "--kill-at";\r
 +      fprintf ( fMakefile,\r
 +                "\t${dlltool} --dllname %s --base-file %s --def ntoskrnl/ntoskrnl.def --output-exp %s %s\n",\r
 +                targetName.c_str (),\r
 +                base_tmp.c_str (),\r
 +                temp_exp.c_str (),\r
 +                killAt.c_str () );\r
 +      fprintf ( fMakefile,\r
 +                "\t-@${rm} %s 2>$(NUL)\n",\r
 +                base_tmp.c_str () );\r
 +      fprintf ( fMakefile,\r
 +                "\t${gcc} %s %s -Wl,%s -o $@ %s %s\n",\r
 +                GetLinkerMacro ().c_str (),\r
 +                gccOptions.c_str (),\r
 +                temp_exp.c_str (),\r
 +                objectsMacro.c_str (),\r
 +                linkDepsMacro.c_str () );\r
 +      fprintf ( fMakefile,\r
 +                "\t-@${rm} %s 2>$(NUL)\n",\r
 +                temp_exp.c_str () );\r
 +      fprintf ( fMakefile, "\t$(ECHO_RSYM)\n" );\r
 +      fprintf ( fMakefile,\r
 +                "\t$(Q)$(RSYM_TARGET) $@ $@\n\n" );\r
 +}\r
 +\r
 +\r
 +MingwStaticLibraryModuleHandler::MingwStaticLibraryModuleHandler (\r
 +      const Module& module_ )\r
 +\r
 +      : MingwModuleHandler ( module_ )\r
 +{\r
 +}\r
 +\r
 +void\r
 +MingwStaticLibraryModuleHandler::Process ()\r
 +{\r
 +      GenerateStaticLibraryModuleTarget ();\r
 +}\r
 +\r
 +void\r
 +MingwStaticLibraryModuleHandler::GenerateStaticLibraryModuleTarget ()\r
 +{\r
 +      GenerateRules ();\r
 +}\r
 +\r
 +\r
 +MingwObjectLibraryModuleHandler::MingwObjectLibraryModuleHandler (\r
 +      const Module& module_ )\r
 +\r
 +      : MingwModuleHandler ( module_ )\r
 +{\r
 +}\r
 +\r
 +void\r
 +MingwObjectLibraryModuleHandler::Process ()\r
 +{\r
 +      GenerateObjectLibraryModuleTarget ();\r
 +}\r
 +\r
 +void\r
 +MingwObjectLibraryModuleHandler::GenerateObjectLibraryModuleTarget ()\r
 +{\r
 +      GenerateRules ();\r
 +}\r
 +\r
 +\r
 +MingwKernelModeDLLModuleHandler::MingwKernelModeDLLModuleHandler (\r
 +      const Module& module_ )\r
 +\r
 +      : MingwModuleHandler ( module_ )\r
 +{\r
 +}\r
 +\r
 +void\r
 +MingwKernelModeDLLModuleHandler::Process ()\r
 +{\r
 +      GenerateKernelModeDLLModuleTarget ();\r
 +}\r
 +\r
 +void\r
 +MingwKernelModeDLLModuleHandler::GenerateKernelModeDLLModuleTarget ()\r
 +{\r
 +      string targetMacro ( GetTargetMacro ( module ) );\r
 +      string workingDirectory = GetWorkingDirectory ( );\r
 +      string objectsMacro = GetObjectsMacro ( module );\r
 +      string linkDepsMacro = GetLinkingDependenciesMacro ();\r
 +      string libsMacro = GetLibsMacro ();\r
 +\r
 +      GenerateImportLibraryTargetIfNeeded ();\r
 +\r
 +      if ( module.non_if_data.files.size () > 0 )\r
 +      {\r
 +              GenerateRules ();\r
 +\r
 +              string dependencies = linkDepsMacro + " " + objectsMacro;\r
 +\r
 +              string linkerParameters = ssprintf ( "-Wl,--subsystem,native -Wl,--entry,%s -Wl,--image-base,%s -Wl,--file-alignment,0x1000 -Wl,--section-alignment,0x1000 -nostartfiles -mdll",\r
 +                                                   module.entrypoint.c_str (),\r
 +                                                   module.baseaddress.c_str () );\r
 +              GenerateLinkerCommand ( dependencies,\r
 +                                      "${gcc}",\r
 +                                      linkerParameters,\r
 +                                      objectsMacro,\r
 +                                      libsMacro );\r
 +      }\r
 +      else\r
 +      {\r
 +              GeneratePhonyTarget();\r
 +      }\r
 +}\r
 +\r
 +\r
 +MingwKernelModeDriverModuleHandler::MingwKernelModeDriverModuleHandler (\r
 +      const Module& module_ )\r
 +\r
 +      : MingwModuleHandler ( module_ )\r
 +{\r
 +}\r
 +\r
 +void\r
 +MingwKernelModeDriverModuleHandler::Process ()\r
 +{\r
 +      GenerateKernelModeDriverModuleTarget ();\r
 +}\r
 +\r
 +\r
 +void\r
 +MingwKernelModeDriverModuleHandler::GenerateKernelModeDriverModuleTarget ()\r
 +{\r
 +      string targetMacro ( GetTargetMacro (module) );\r
 +      string workingDirectory = GetWorkingDirectory ();\r
 +      string objectsMacro = GetObjectsMacro ( module );\r
 +      string linkDepsMacro = GetLinkingDependenciesMacro ();\r
 +      string libsMacro = GetLibsMacro ();\r
 +\r
 +      GenerateImportLibraryTargetIfNeeded ();\r
 +\r
 +      if ( module.non_if_data.files.size () > 0 )\r
 +      {\r
 +              GenerateRules ();\r
 +\r
 +              string dependencies = linkDepsMacro + " " + objectsMacro;\r
 +\r
 +              string linkerParameters = ssprintf ( "-Wl,--subsystem,native -Wl,--entry,%s -Wl,--image-base,%s -Wl,--file-alignment,0x1000 -Wl,--section-alignment,0x1000 -nostartfiles -mdll",\r
 +                                                   module.entrypoint.c_str (),\r
 +                                                   module.baseaddress.c_str () );\r
 +              GenerateLinkerCommand ( dependencies,\r
 +                                      "${gcc}",\r
 +                                      linkerParameters,\r
 +                                      objectsMacro,\r
 +                                      libsMacro );\r
 +      }\r
 +      else\r
 +      {\r
 +              GeneratePhonyTarget();\r
 +      }\r
 +}\r
 +\r
 +\r
 +MingwNativeDLLModuleHandler::MingwNativeDLLModuleHandler (\r
 +      const Module& module_ )\r
 +\r
 +      : MingwModuleHandler ( module_ )\r
 +{\r
 +}\r
 +\r
 +void\r
 +MingwNativeDLLModuleHandler::Process ()\r
 +{\r
 +      GenerateNativeDLLModuleTarget ();\r
 +}\r
 +\r
 +void\r
 +MingwNativeDLLModuleHandler::GenerateNativeDLLModuleTarget ()\r
 +{\r
 +      string targetMacro ( GetTargetMacro (module) );\r
 +      string workingDirectory = GetWorkingDirectory ( );\r
 +      string objectsMacro = GetObjectsMacro ( module );\r
 +      string linkDepsMacro = GetLinkingDependenciesMacro ();\r
 +      string libsMacro = GetLibsMacro ();\r
 +      \r
 +      GenerateImportLibraryTargetIfNeeded ();\r
 +\r
 +      if ( module.non_if_data.files.size () > 0 )\r
 +      {\r
 +              GenerateRules ();\r
 +\r
 +              string dependencies = linkDepsMacro + " " + objectsMacro;\r
 +\r
 +              string linkerParameters = ssprintf ( "-Wl,--subsystem,native -Wl,--entry,%s -Wl,--image-base,%s -Wl,--file-alignment,0x1000 -Wl,--section-alignment,0x1000 -nostartfiles -nostdlib -mdll",\r
 +                                                   module.entrypoint.c_str (),\r
 +                                                   module.baseaddress.c_str () );\r
 +              GenerateLinkerCommand ( dependencies,\r
 +                                      "${gcc}",\r
 +                                      linkerParameters,\r
 +                                      objectsMacro,\r
 +                                      libsMacro );\r
 +      }\r
 +      else\r
 +      {\r
 +              GeneratePhonyTarget();\r
 +      }\r
 +}\r
 +\r
 +\r
 +MingwNativeCUIModuleHandler::MingwNativeCUIModuleHandler (\r
 +      const Module& module_ )\r
 +\r
 +      : MingwModuleHandler ( module_ )\r
 +{\r
 +}\r
 +\r
 +void\r
 +MingwNativeCUIModuleHandler::Process ()\r
 +{\r
 +      GenerateNativeCUIModuleTarget ();\r
 +}\r
 +\r
 +void\r
 +MingwNativeCUIModuleHandler::GenerateNativeCUIModuleTarget ()\r
 +{\r
 +      string targetMacro ( GetTargetMacro (module) );\r
 +      string workingDirectory = GetWorkingDirectory ( );\r
 +      string objectsMacro = GetObjectsMacro ( module );\r
 +      string linkDepsMacro = GetLinkingDependenciesMacro ();\r
 +      string libsMacro = GetLibsMacro ();\r
 +      \r
 +      GenerateImportLibraryTargetIfNeeded ();\r
 +\r
 +      if ( module.non_if_data.files.size () > 0 )\r
 +      {\r
 +              GenerateRules ();\r
 +\r
 +              string dependencies = linkDepsMacro + " " + objectsMacro;\r
 +\r
 +              string linkerParameters = ssprintf ( "-Wl,--subsystem,native -Wl,--entry,%s -Wl,--image-base,%s -Wl,--file-alignment,0x1000 -Wl,--section-alignment,0x1000 -nostartfiles -nostdlib",\r
 +                                                   module.entrypoint.c_str (),\r
 +                                                   module.baseaddress.c_str () );\r
 +              GenerateLinkerCommand ( dependencies,\r
 +                                      "${gcc}",\r
 +                                      linkerParameters,\r
 +                                      objectsMacro,\r
 +                                      libsMacro );\r
 +      }\r
 +      else\r
 +      {\r
 +              GeneratePhonyTarget();\r
 +      }\r
 +}\r
 +\r
 +\r
 +MingwWin32DLLModuleHandler::MingwWin32DLLModuleHandler (\r
 +      const Module& module_ )\r
 +\r
 +      : MingwModuleHandler ( module_ )\r
 +{\r
 +}\r
 +\r
 +void\r
 +MingwWin32DLLModuleHandler::Process ()\r
 +{\r
 +      GenerateExtractWineDLLResourcesTarget ();\r
 +      GenerateWin32DLLModuleTarget ();\r
 +}\r
 +\r
 +void\r
 +MingwWin32DLLModuleHandler::GenerateExtractWineDLLResourcesTarget ()\r
 +{\r
 +      fprintf ( fMakefile, ".PHONY: %s_extractresources\n\n",\r
 +                module.name.c_str () );\r
 +      fprintf ( fMakefile, "%s_extractresources: $(BIN2RES_TARGET)\n",\r
 +                module.name.c_str () );\r
 +      const vector<File*>& files = module.non_if_data.files;\r
 +      for ( size_t i = 0; i < files.size (); i++ )\r
 +      {\r
 +              File& file = *files[i];\r
 +              string extension = GetExtension ( file.name );\r
 +              if ( extension == ".rc" || extension == ".RC" )\r
 +              {\r
 +                      string resource = NormalizeFilename ( file.name );\r
 +                      fprintf ( fMakefile, "\t$(ECHO_BIN2RES)\n" );\r
 +                      fprintf ( fMakefile, "\t@:echo ${bin2res} -f -x %s\n",\r
 +                                resource.c_str () );\r
 +              }\r
 +      }\r
 +      fprintf ( fMakefile, "\n");\r
 +}\r
 +\r
 +void\r
 +MingwWin32DLLModuleHandler::GenerateWin32DLLModuleTarget ()\r
 +{\r
 +      string targetMacro ( GetTargetMacro (module) );\r
 +      string workingDirectory = GetWorkingDirectory ( );\r
 +      string objectsMacro = GetObjectsMacro ( module );\r
 +      string linkDepsMacro = GetLinkingDependenciesMacro ();\r
 +      string libsMacro = GetLibsMacro ();\r
 +\r
 +      GenerateImportLibraryTargetIfNeeded ();\r
 +\r
 +      if ( module.non_if_data.files.size () > 0 )\r
 +      {\r
 +              GenerateRules ();\r
 +\r
 +              string dependencies = linkDepsMacro + " " + objectsMacro;\r
 +\r
 +              string linker;\r
 +              if ( module.cplusplus )\r
 +                      linker = "${gpp}";\r
 +              else\r
 +                      linker = "${gcc}";\r
 +\r
 +              string linkerParameters = ssprintf ( "-Wl,--subsystem,console -Wl,--entry,%s -Wl,--image-base,%s -Wl,--file-alignment,0x1000 -Wl,--section-alignment,0x1000 -mdll",\r
 +                                                   module.entrypoint.c_str (),\r
 +                                                   module.baseaddress.c_str () );\r
 +              GenerateLinkerCommand ( dependencies,\r
 +                                      linker,\r
 +                                      linkerParameters,\r
 +                                      objectsMacro,\r
 +                                      libsMacro );\r
 +      }\r
 +      else\r
 +      {\r
 +              GeneratePhonyTarget();\r
 +      }\r
 +}\r
 +\r
 +\r
 +MingwWin32CUIModuleHandler::MingwWin32CUIModuleHandler (\r
 +      const Module& module_ )\r
 +\r
 +      : MingwModuleHandler ( module_ )\r
 +{\r
 +}\r
 +\r
 +void\r
 +MingwWin32CUIModuleHandler::Process ()\r
 +{\r
 +      GenerateWin32CUIModuleTarget ();\r
 +}\r
 +\r
 +void\r
 +MingwWin32CUIModuleHandler::GenerateWin32CUIModuleTarget ()\r
 +{\r
 +      string targetMacro ( GetTargetMacro (module) );\r
 +      string workingDirectory = GetWorkingDirectory ( );\r
 +      string objectsMacro = GetObjectsMacro ( module );\r
 +      string linkDepsMacro = GetLinkingDependenciesMacro ();\r
 +      string libsMacro = GetLibsMacro ();\r
 +\r
 +      GenerateImportLibraryTargetIfNeeded ();\r
 +\r
 +      if ( module.non_if_data.files.size () > 0 )\r
 +      {\r
 +              GenerateRules ();\r
 +\r
 +              string dependencies = linkDepsMacro + " " + objectsMacro;\r
 +\r
 +              string linker;\r
 +              if ( module.cplusplus )\r
 +                      linker = "${gpp}";\r
 +              else\r
 +                      linker = "${gcc}";\r
 +\r
 +              string linkerParameters = ssprintf ( "-Wl,--subsystem,console -Wl,--entry,%s -Wl,--image-base,%s -Wl,--file-alignment,0x1000 -Wl,--section-alignment,0x1000",\r
 +                                                   module.entrypoint.c_str (),\r
 +                                                   module.baseaddress.c_str () );\r
 +              GenerateLinkerCommand ( dependencies,\r
 +                                      linker,\r
 +                                      linkerParameters,\r
 +                                      objectsMacro,\r
 +                                      libsMacro );\r
 +      }\r
 +      else\r
 +      {\r
 +              GeneratePhonyTarget();\r
 +      }\r
 +}\r
 +\r
 +\r
 +MingwWin32GUIModuleHandler::MingwWin32GUIModuleHandler (\r
 +      const Module& module_ )\r
 +\r
 +      : MingwModuleHandler ( module_ )\r
 +{\r
 +}\r
 +\r
 +void\r
 +MingwWin32GUIModuleHandler::Process ()\r
 +{\r
 +      GenerateWin32GUIModuleTarget ();\r
 +}\r
 +\r
 +void\r
 +MingwWin32GUIModuleHandler::GenerateWin32GUIModuleTarget ()\r
 +{\r
 +      string targetMacro ( GetTargetMacro (module) );\r
 +      string workingDirectory = GetWorkingDirectory ( );\r
 +      string objectsMacro = GetObjectsMacro ( module );\r
 +      string linkDepsMacro = GetLinkingDependenciesMacro ();\r
 +      string libsMacro = GetLibsMacro ();\r
 +\r
 +      GenerateImportLibraryTargetIfNeeded ();\r
 +\r
 +      if ( module.non_if_data.files.size () > 0 )\r
 +      {\r
 +              GenerateRules ();\r
 +\r
 +              string dependencies = linkDepsMacro + " " + objectsMacro;\r
 +\r
 +              string linker;\r
 +              if ( module.cplusplus )\r
 +                      linker = "${gpp}";\r
 +              else\r
 +                      linker = "${gcc}";\r
 +\r
 +              string linkerParameters = ssprintf ( "-Wl,--subsystem,windows -Wl,--entry,%s -Wl,--image-base,%s -Wl,--file-alignment,0x1000 -Wl,--section-alignment,0x1000",\r
 +                                                   module.entrypoint.c_str (),\r
 +                                                   module.baseaddress.c_str () );\r
 +              GenerateLinkerCommand ( dependencies,\r
 +                                      linker,\r
 +                                      linkerParameters,\r
 +                                      objectsMacro,\r
 +                                      libsMacro );\r
 +      }\r
 +      else\r
 +      {\r
 +              GeneratePhonyTarget();\r
 +      }\r
 +}\r
 +\r
 +\r
 +MingwBootLoaderModuleHandler::MingwBootLoaderModuleHandler (\r
 +      const Module& module_ )\r
 +\r
 +      : MingwModuleHandler ( module_ )\r
 +{\r
 +}\r
 +\r
 +void\r
 +MingwBootLoaderModuleHandler::Process ()\r
 +{\r
 +      GenerateBootLoaderModuleTarget ();\r
 +}\r
 +\r
 +void\r
 +MingwBootLoaderModuleHandler::GenerateBootLoaderModuleTarget ()\r
 +{\r
 +      string targetName ( module.GetTargetName () );\r
 +      string targetMacro ( GetTargetMacro (module) );\r
 +      string workingDirectory = GetWorkingDirectory ();\r
 +      string junk_tmp = ros_temp + module.name + ".junk.tmp";\r
 +      CLEAN_FILE ( junk_tmp );\r
 +      string objectsMacro = GetObjectsMacro ( module );\r
 +      string linkDepsMacro = GetLinkingDependenciesMacro ();\r
 +      string libsMacro = GetLibsMacro ();\r
 +\r
 +      GenerateRules ();\r
 +\r
 +      fprintf ( fMakefile, "%s: %s %s | %s\n",\r
 +                targetMacro.c_str (),\r
 +                objectsMacro.c_str (),\r
 +                linkDepsMacro.c_str (),\r
 +                GetDirectory(GetTargetFilename(module,NULL)).c_str () );\r
 +\r
 +      fprintf ( fMakefile, "\t$(ECHO_LD)\n" );\r
 +\r
 +      fprintf ( fMakefile,\r
 +                "\t${ld} %s -N -Ttext=0x8000 -o %s %s %s\n",\r
 +                GetLinkerMacro ().c_str (),\r
 +                junk_tmp.c_str (),\r
 +                objectsMacro.c_str (),\r
 +                linkDepsMacro.c_str () );\r
 +      fprintf ( fMakefile,\r
 +                "\t${objcopy} -O binary %s $@\n",\r
 +                junk_tmp.c_str () );\r
 +      fprintf ( fMakefile,\r
 +                "\t-@${rm} %s 2>$(NUL)\n",\r
 +                junk_tmp.c_str () );\r
 +}\r
 +\r
 +\r
 +MingwBootSectorModuleHandler::MingwBootSectorModuleHandler (\r
 +      const Module& module_ )\r
 +\r
 +      : MingwModuleHandler ( module_ )\r
 +{\r
 +}\r
 +\r
 +void\r
 +MingwBootSectorModuleHandler::Process ()\r
 +{\r
 +      GenerateBootSectorModuleTarget ();\r
 +}\r
 +\r
 +void\r
 +MingwBootSectorModuleHandler::GenerateBootSectorModuleTarget ()\r
 +{\r
 +      string objectsMacro = GetObjectsMacro ( module );\r
 +\r
 +      GenerateRules ();\r
 +\r
 +      fprintf ( fMakefile, ".PHONY: %s\n\n",\r
 +                module.name.c_str ());\r
 +      fprintf ( fMakefile,\r
 +                "%s: %s\n",\r
 +                module.name.c_str (),\r
 +                objectsMacro.c_str () );\r
 +}\r
 +\r
 +\r
 +MingwIsoModuleHandler::MingwIsoModuleHandler (\r
 +      const Module& module_ )\r
 +\r
 +      : MingwModuleHandler ( module_ )\r
 +{\r
 +}\r
 +\r
 +void\r
 +MingwIsoModuleHandler::Process ()\r
 +{\r
 +      GenerateIsoModuleTarget ();\r
 +}\r
 +\r
 +void\r
 +MingwIsoModuleHandler::OutputBootstrapfileCopyCommands (\r
 +      const string& bootcdDirectory )\r
 +{\r
 +      for ( size_t i = 0; i < module.project.modules.size (); i++ )\r
 +      {\r
 +              const Module& m = *module.project.modules[i];\r
 +              if ( m.bootstrap != NULL )\r
 +              {\r
 +                      string sourceFilename = PassThruCacheDirectory (\r
 +                              NormalizeFilename ( m.GetPath () ),\r
 +                              backend->outputDirectory );\r
 +                      string targetFilenameNoFixup ( bootcdDirectory + SSEP + m.bootstrap->base + SSEP + m.bootstrap->nameoncd );\r
 +                      string targetFilename = MingwModuleHandler::PassThruCacheDirectory (\r
 +                              NormalizeFilename ( targetFilenameNoFixup ),\r
 +                              backend->outputDirectory );\r
 +                      fprintf ( fMakefile,\r
 +                                "\t$(ECHO_CP)\n" );\r
 +                      fprintf ( fMakefile,\r
 +                                "\t${cp} %s %s 1>$(NUL)\n",\r
 +                                sourceFilename.c_str (),\r
 +                                targetFilename.c_str () );\r
 +              }\r
 +      }\r
 +}\r
 +\r
 +void\r
 +MingwIsoModuleHandler::OutputCdfileCopyCommands (\r
 +      const string& bootcdDirectory )\r
 +{\r
 +      for ( size_t i = 0; i < module.project.cdfiles.size (); i++ )\r
 +      {\r
 +              const CDFile& cdfile = *module.project.cdfiles[i];\r
 +              string targetFilenameNoFixup = bootcdDirectory + SSEP + cdfile.base + SSEP + cdfile.nameoncd;\r
 +              string targetFilename = MingwModuleHandler::PassThruCacheDirectory (\r
 +                      NormalizeFilename ( targetFilenameNoFixup ),\r
 +                      backend->outputDirectory );\r
 +              fprintf ( fMakefile,\r
 +                        "\t$(ECHO_CP)\n" );\r
 +              fprintf ( fMakefile,\r
 +                        "\t${cp} %s %s 1>$(NUL)\n",\r
 +                        cdfile.GetPath ().c_str (),\r
 +                        targetFilename.c_str () );\r
 +      }\r
 +}\r
 +\r
 +string\r
 +MingwIsoModuleHandler::GetBootstrapCdDirectories ( const string& bootcdDirectory )\r
 +{\r
 +      string directories;\r
 +      for ( size_t i = 0; i < module.project.modules.size (); i++ )\r
 +      {\r
 +              const Module& m = *module.project.modules[i];\r
 +              if ( m.bootstrap != NULL )\r
 +              {\r
 +                      string targetDirectory ( bootcdDirectory + SSEP + m.bootstrap->base );\r
 +                      if ( directories.size () > 0 )\r
 +                              directories += " ";\r
 +                      directories += PassThruCacheDirectory (\r
 +                              NormalizeFilename ( targetDirectory ),\r
 +                              backend->outputDirectory );\r
 +              }\r
 +      }\r
 +      return directories;\r
 +}\r
 +\r
 +string\r
 +MingwIsoModuleHandler::GetNonModuleCdDirectories ( const string& bootcdDirectory )\r
 +{\r
 +      string directories;\r
 +      for ( size_t i = 0; i < module.project.cdfiles.size (); i++ )\r
 +      {\r
 +              const CDFile& cdfile = *module.project.cdfiles[i];\r
 +              string targetDirectory ( bootcdDirectory + SSEP + cdfile.base );\r
 +              if ( directories.size () > 0 )\r
 +                      directories += " ";\r
 +              directories += PassThruCacheDirectory (\r
 +                      NormalizeFilename ( targetDirectory ),\r
 +                      backend->outputDirectory );\r
 +      }\r
 +      return directories;\r
 +}\r
 +\r
 +string\r
 +MingwIsoModuleHandler::GetCdDirectories ( const string& bootcdDirectory )\r
 +{\r
 +      string directories = GetBootstrapCdDirectories ( bootcdDirectory );\r
 +      directories += " " + GetNonModuleCdDirectories ( bootcdDirectory );\r
 +      return directories;\r
 +}\r
 +\r
 +void\r
 +MingwIsoModuleHandler::GetBootstrapCdFiles (\r
 +      vector<string>& out ) const\r
 +{\r
 +      for ( size_t i = 0; i < module.project.modules.size (); i++ )\r
 +      {\r
 +              const Module& m = *module.project.modules[i];\r
 +              if ( m.bootstrap != NULL )\r
 +              {\r
 +                      string filename = PassThruCacheDirectory (\r
 +                              NormalizeFilename ( m.GetPath () ),\r
 +                              backend->outputDirectory );\r
 +                      out.push_back ( filename );\r
 +              }\r
 +      }\r
 +}\r
 +\r
 +void\r
 +MingwIsoModuleHandler::GetNonModuleCdFiles (\r
 +      vector<string>& out ) const\r
 +{\r
 +      for ( size_t i = 0; i < module.project.cdfiles.size (); i++ )\r
 +      {\r
 +              const CDFile& cdfile = *module.project.cdfiles[i];\r
 +              out.push_back ( cdfile.GetPath () );\r
 +      }\r
 +}\r
 +\r
 +void\r
 +MingwIsoModuleHandler::GetCdFiles (\r
 +      vector<string>& out ) const\r
 +{\r
 +      GetBootstrapCdFiles ( out );\r
 +      GetNonModuleCdFiles ( out );\r
 +}\r
 +\r
 +void\r
 +MingwIsoModuleHandler::GenerateIsoModuleTarget ()\r
 +{\r
 +      string bootcdDirectory = "cd";\r
 +      string bootcd = PassThruCacheDirectory (\r
 +              NormalizeFilename ( bootcdDirectory + SSEP ),\r
 +              backend->outputDirectory );\r
 +      string isoboot = PassThruCacheDirectory (\r
 +              NormalizeFilename ( "boot" SSEP "freeldr" SSEP "bootsect" SSEP "isoboot.o" ),\r
 +              backend->outputDirectory );\r
 +      string bootcdReactosNoFixup = bootcdDirectory + SSEP "reactos";\r
 +      string bootcdReactos = PassThruCacheDirectory (\r
 +              NormalizeFilename ( bootcdReactosNoFixup + SSEP ),\r
 +              backend->outputDirectory );\r
 +      CLEAN_FILE ( bootcdReactos );\r
 +      string reactosInf = PassThruCacheDirectory (\r
 +              NormalizeFilename ( bootcdReactosNoFixup + SSEP "reactos.inf" ),\r
 +              backend->outputDirectory );\r
 +      string reactosDff = NormalizeFilename ( "bootdata" SSEP "packages" SSEP "reactos.dff" );\r
 +      string cdDirectories = GetCdDirectories ( bootcdDirectory );\r
 +      vector<string> vCdFiles;\r
 +      GetCdFiles ( vCdFiles );\r
 +      string cdFiles = v2s ( vCdFiles, 5 );\r
 +\r
 +      fprintf ( fMakefile, ".PHONY: %s\n\n",\r
 +                module.name.c_str ());\r
 +      fprintf ( fMakefile,\r
 +                "%s: all %s %s %s %s $(CABMAN_TARGET) $(CDMAKE_TARGET)\n",\r
 +                module.name.c_str (),\r
 +                isoboot.c_str (),\r
 +                bootcdReactos.c_str (),\r
 +                cdDirectories.c_str (),\r
 +                cdFiles.c_str () );\r
 +      fprintf ( fMakefile, "\t$(ECHO_CABMAN)\n" );\r
 +      fprintf ( fMakefile,\r
 +                "\t$(Q)$(CABMAN_TARGET) -C %s -L %s -I -P $(OUTPUT)\n",\r
 +                reactosDff.c_str (),\r
 +                bootcdReactos.c_str () );\r
 +      fprintf ( fMakefile,\r
 +                "\t$(Q)$(CABMAN_TARGET) -C %s -RC %s -L %s -N -P $(OUTPUT)\n",\r
 +                reactosDff.c_str (),\r
 +                reactosInf.c_str (),\r
 +                bootcdReactos.c_str ());\r
 +      fprintf ( fMakefile,\r
 +                "\t-@${rm} %s 2>$(NUL)\n",\r
 +                reactosInf.c_str () );\r
 +      OutputBootstrapfileCopyCommands ( bootcdDirectory );\r
 +      OutputCdfileCopyCommands ( bootcdDirectory );\r
 +      fprintf ( fMakefile, "\t$(ECHO_CDMAKE)\n" );\r
 +      fprintf ( fMakefile,\r
 +                "\t$(Q)$(CDMAKE_TARGET) -v -m -b %s %s REACTOS ReactOS.iso\n",\r
 +                isoboot.c_str (),\r
 +                bootcd.c_str () );\r
 +      fprintf ( fMakefile,\r
 +                "\n" );\r
 +}\r
 +\r
 +\r
 +MingwLiveIsoModuleHandler::MingwLiveIsoModuleHandler (\r
 +      const Module& module_ )\r
 +\r
 +      : MingwModuleHandler ( module_ )\r
 +{\r
 +}\r
 +\r
 +void\r
 +MingwLiveIsoModuleHandler::Process ()\r
 +{\r
 +      GenerateLiveIsoModuleTarget ();\r
 +}\r
 +\r
 +void\r
 +MingwLiveIsoModuleHandler::CreateDirectory ( const string& directory )\r
 +{\r
 +      string normalizedDirectory = MingwModuleHandler::PassThruCacheDirectory (\r
 +              NormalizeFilename ( directory ) + SSEP,\r
 +              backend->outputDirectory );\r
 +}\r
 +\r
 +void\r
 +MingwLiveIsoModuleHandler::OutputCopyCommand ( const string& sourceFilename,\r
 +                                                 const string& targetFilename,\r
 +                                                 const string& targetDirectory )\r
 +{\r
 +      string normalizedTargetFilename = MingwModuleHandler::PassThruCacheDirectory (\r
 +              NormalizeFilename ( targetDirectory + SSEP + targetFilename ),\r
 +              backend->outputDirectory );\r
 +      fprintf ( fMakefile,\r
 +                "\t$(ECHO_CP)\n" );\r
 +      fprintf ( fMakefile,\r
 +                "\t${cp} %s %s 1>$(NUL)\n",\r
 +                sourceFilename.c_str (),\r
 +                normalizedTargetFilename.c_str () );\r
 +}\r
 +\r
 +void\r
 +MingwLiveIsoModuleHandler::OutputModuleCopyCommands ( string& livecdDirectory,\r
 +                                                        string& reactosDirectory )\r
 +{\r
 +      for ( size_t i = 0; i < module.project.modules.size (); i++ )\r
 +      {\r
 +              const Module& m = *module.project.modules[i];\r
 +              if ( m.installName.length () > 0 )\r
 +              {\r
 +                      string sourceFilename = MingwModuleHandler::PassThruCacheDirectory (\r
 +                              NormalizeFilename ( m.GetPath () ),\r
 +                              backend->outputDirectory );\r
 +                      OutputCopyCommand ( sourceFilename,\r
 +                                      m.installName,\r
 +                                      livecdDirectory + SSEP + reactosDirectory + SSEP + m.installBase );\r
 +              }\r
 +      }\r
 +}\r
 +\r
 +void\r
 +MingwLiveIsoModuleHandler::OutputNonModuleCopyCommands ( string& livecdDirectory,\r
 +                                                           string& reactosDirectory )\r
 +{\r
 +      for ( size_t i = 0; i < module.project.installfiles.size (); i++ )\r
 +      {\r
 +              const InstallFile& installfile = *module.project.installfiles[i];\r
 +              OutputCopyCommand ( installfile.GetPath (),\r
 +                              installfile.newname,\r
 +                              livecdDirectory + SSEP + reactosDirectory + SSEP + installfile.base );\r
 +      }\r
 +}\r
 +\r
 +void\r
 +MingwLiveIsoModuleHandler::OutputProfilesDirectoryCommands ( string& livecdDirectory )\r
 +{\r
 +      CreateDirectory ( livecdDirectory + SSEP "Profiles" );\r
 +      CreateDirectory ( livecdDirectory + SSEP "Profiles" SSEP "All Users") ;\r
 +      CreateDirectory ( livecdDirectory + SSEP "Profiles" SSEP "All Users" SSEP "Desktop" );\r
 +      CreateDirectory ( livecdDirectory + SSEP "Profiles" SSEP "Default User" );\r
 +      CreateDirectory ( livecdDirectory + SSEP "Profiles" SSEP "Default User" SSEP "Desktop" );\r
 +      CreateDirectory ( livecdDirectory + SSEP "Profiles" SSEP "Default User" SSEP "My Documents" );\r
 +\r
 +      string livecdIni = "bootdata" SSEP "livecd.ini";\r
 +      OutputCopyCommand ( livecdIni,\r
 +                        "freeldr.ini",\r
 +                        livecdDirectory );\r
 +}\r
 +\r
 +void\r
 +MingwLiveIsoModuleHandler::OutputLoaderCommands ( string& livecdDirectory )\r
 +{\r
 +      string freeldr = PassThruCacheDirectory (\r
 +              NormalizeFilename ( "boot" SSEP "freeldr" SSEP "freeldr" SSEP "freeldr.sys" ),\r
 +              backend->outputDirectory );\r
 +      CreateDirectory ( livecdDirectory + SSEP "loader" );\r
 +      OutputCopyCommand ( freeldr,\r
 +                        "setupldr.sys",\r
 +                        livecdDirectory + SSEP + "loader" );\r
 +}\r
 +\r
 +void\r
 +MingwLiveIsoModuleHandler::OutputRegistryCommands ( string& livecdDirectory )\r
 +{\r
 +      string reactosSystem32ConfigDirectory = NormalizeFilename (\r
 +              MingwModuleHandler::PassThruCacheDirectory (\r
 +              livecdDirectory + SSEP "reactos" SSEP "system32" SSEP "config" SSEP,\r
 +              backend->outputDirectory ) );\r
 +      fprintf ( fMakefile,\r
 +                "\t$(ECHO_MKHIVE)\n" );\r
 +      fprintf ( fMakefile,\r
 +                "\t$(MKHIVE_TARGET) bootdata %s bootdata" SSEP "livecd.inf bootdata" SSEP "hiveinst.inf\n",\r
 +                reactosSystem32ConfigDirectory.c_str () );\r
 +}\r
 +\r
 +void\r
 +MingwLiveIsoModuleHandler::GenerateLiveIsoModuleTarget ()\r
 +{\r
 +      string livecdDirectory = "livecd";\r
 +      string livecd = PassThruCacheDirectory (\r
 +              NormalizeFilename ( livecdDirectory + SSEP ),\r
 +              backend->outputDirectory );\r
 +      string isoboot = PassThruCacheDirectory (\r
 +              NormalizeFilename ( "boot" SSEP "freeldr" SSEP "bootsect" SSEP "isoboot.o" ),\r
 +              backend->outputDirectory );\r
 +      string reactosDirectory = "reactos";\r
 +      string livecdReactosNoFixup = livecdDirectory + SSEP + reactosDirectory;\r
 +      string livecdReactos = NormalizeFilename ( PassThruCacheDirectory (\r
 +              NormalizeFilename ( livecdReactosNoFixup + SSEP ),\r
 +              backend->outputDirectory ) );\r
 +      CLEAN_FILE ( livecdReactos );\r
 +\r
 +      fprintf ( fMakefile, ".PHONY: %s\n\n",\r
 +                module.name.c_str ());\r
 +      fprintf ( fMakefile,\r
 +                "%s: all %s %s $(MKHIVE_TARGET) $(CDMAKE_TARGET)\n",\r
 +                module.name.c_str (),\r
 +                isoboot.c_str (),\r
 +                livecdReactos.c_str () );\r
 +      OutputModuleCopyCommands ( livecdDirectory,\r
 +                                 reactosDirectory );\r
 +      OutputNonModuleCopyCommands ( livecdDirectory,\r
 +                                    reactosDirectory );\r
 +      OutputProfilesDirectoryCommands ( livecdDirectory );\r
 +      OutputLoaderCommands ( livecdDirectory );\r
 +      OutputRegistryCommands ( livecdDirectory );\r
 +      fprintf ( fMakefile, "\t$(ECHO_CDMAKE)\n" );\r
 +      fprintf ( fMakefile,\r
 +                "\t$(Q)$(CDMAKE_TARGET) -v -m -j -b %s %s REACTOS ReactOS-LiveCD.iso\n",\r
 +                isoboot.c_str (),\r
 +                livecd.c_str () );\r
 +      fprintf ( fMakefile,\r
 +                "\n" );\r
 +}\r
 +\r
 +\r
 +MingwTestModuleHandler::MingwTestModuleHandler (\r
 +      const Module& module_ )\r
 +\r
 +      : MingwModuleHandler ( module_ )\r
 +{\r
 +}\r
 +\r
 +void\r
 +MingwTestModuleHandler::Process ()\r
 +{\r
 +      GenerateTestModuleTarget ();\r
 +}\r
 +\r
 +void\r
 +MingwTestModuleHandler::GenerateTestModuleTarget ()\r
 +{\r
 +      string targetMacro ( GetTargetMacro ( module ) );\r
 +      string workingDirectory = GetWorkingDirectory ( );\r
 +      string objectsMacro = GetObjectsMacro ( module );\r
 +      string linkDepsMacro = GetLinkingDependenciesMacro ();\r
 +      string libsMacro = GetLibsMacro ();\r
 +\r
 +      GenerateImportLibraryTargetIfNeeded ();\r
 +\r
 +      if ( module.non_if_data.files.size () > 0 )\r
 +      {\r
 +              GenerateRules ();\r
 +\r
 +              string dependencies = linkDepsMacro + " " + objectsMacro;\r
 +\r
 +              string linker;\r
 +              if ( module.cplusplus )\r
 +                      linker = "${gpp}";\r
 +              else\r
 +                      linker = "${gcc}";\r
 +\r
 +              string linkerParameters = ssprintf ( "-Wl,--subsystem,console -Wl,--entry,%s -Wl,--image-base,%s -Wl,--file-alignment,0x1000 -Wl,--section-alignment,0x1000",\r
 +                                                   module.entrypoint.c_str (),\r
 +                                                   module.baseaddress.c_str () );\r
 +              GenerateLinkerCommand ( dependencies,\r
 +                                      linker,\r
 +                                      linkerParameters,\r
 +                                      objectsMacro,\r
 +                                      libsMacro );\r
 +      }\r
 +      else\r
 +      {\r
 +              GeneratePhonyTarget();\r
 +      }\r
 +}\r
 +\r
 +\r
 +MingwRpcServerModuleHandler::MingwRpcServerModuleHandler (\r
 +      const Module& module_ )\r
 +\r
 +      : MingwModuleHandler ( module_ )\r
 +{\r
 +}\r
 +\r
 +void\r
 +MingwRpcServerModuleHandler::Process ()\r
 +{\r
 +      GenerateRules ();\r
 +}\r
 +\r
 +MingwRpcClientModuleHandler::MingwRpcClientModuleHandler (\r
 +      const Module& module_ )\r
 +\r
 +      : MingwModuleHandler ( module_ )\r
 +{\r
 +}\r
 +\r
 +void\r
 +MingwRpcClientModuleHandler::Process ()\r
 +{\r
 +      GenerateRules ();\r
 +}\r
index 8b63e48,0000000..567d4ac
mode 100644,000000..100644
--- /dev/null
@@@ -1,411 -1,0 +1,412 @@@
-               const std::string& sourceFilename,\r
 +#ifndef MINGW_MODULEHANDLER_H\r
 +#define MINGW_MODULEHANDLER_H\r
 +\r
 +#include "../backend.h"\r
 +#include "mingw.h"\r
 +\r
 +class MingwBackend;\r
 +\r
 +extern std::string\r
 +GetTargetMacro ( const Module&, bool with_dollar = true );\r
 +\r
 +extern std::string\r
 +PrefixFilename (\r
 +      const std::string& filename,\r
 +      const std::string& prefix );\r
 +\r
 +class MingwModuleHandler\r
 +{\r
 +public:\r
 +      MingwModuleHandler ( const Module& module_ );\r
 +      virtual ~MingwModuleHandler();\r
 +\r
 +      static void SetBackend ( MingwBackend* backend_ );\r
 +      static void SetMakefile ( FILE* f );\r
 +      static void SetUsePch ( bool use_pch );\r
 +\r
 +      static std::string PassThruCacheDirectory (\r
 +              const std::string &f,\r
 +              Directory* directoryTree );\r
 +\r
 +      static std::string GetTargetFilename (\r
 +              const Module& module,\r
 +              string_list* pclean_files );\r
 +\r
 +      static std::string\r
 +      GetImportLibraryFilename (\r
 +              const Module& module,\r
 +              string_list* pclean_files );\r
 +\r
 +      std::string GetModuleTargets ( const Module& module );\r
 +      void GetObjectsVector ( const IfableData& data,\r
 +                              std::vector<std::string>& objectFiles ) const;\r
 +      void GenerateObjectMacro();\r
 +      void GenerateTargetMacro();\r
 +      void GenerateOtherMacros();\r
 +\r
 +      static MingwModuleHandler* InstanciateHandler ( const Module& module_,\r
 +                                                      MingwBackend* backend_ );\r
 +      virtual HostType DefaultHost() = 0;\r
 +      void GeneratePreconditionDependencies ();\r
 +      virtual void Process () = 0;\r
 +      virtual std::string TypeSpecificCFlags() { return ""; }\r
 +      virtual std::string TypeSpecificNasmFlags() { return ""; }\r
 +      virtual std::string TypeSpecificLinkerFlags() { return ""; }\r
 +      void GenerateInvocations () const;\r
 +      void GenerateCleanTarget () const;\r
 +      static bool ReferenceObjects ( const Module& module );\r
 +protected:\r
 +      std::string GetWorkingDirectory () const;\r
 +      std::string GetBasename ( const std::string& filename ) const;\r
 +      std::string GetActualSourceFilename ( const std::string& filename ) const;\r
 +      std::string GetModuleArchiveFilename () const;\r
 +      bool IsGeneratedFile ( const File& file ) const;\r
 +      std::string GetImportLibraryDependency ( const Module& importedModule );\r
 +      void GetTargets ( const Module& dependencyModule,\r
 +                        string_list& targets );\r
 +      void GetModuleDependencies ( string_list& dependencies );\r
 +      std::string GetAllDependencies () const;\r
 +      void GetSourceFilenames ( string_list& list, bool includeGeneratedFiles = true ) const;\r
 +      void GetSourceFilenamesWithoutGeneratedFiles ( string_list& list ) const;\r
 +      std::string GetObjectFilename ( const std::string& sourceFilename,\r
 +                                      string_list* pclean_files ) const;\r
 +\r
 +      std::string GetObjectFilenames ();\r
 +      \r
 +      std::string GetPreconditionDependenciesName () const;\r
 +      std::string GetCFlagsMacro () const;\r
 +      static std::string GetObjectsMacro ( const Module& );\r
 +      std::string GetLinkingDependenciesMacro () const;\r
 +      std::string GetLibsMacro () const;\r
 +      std::string GetLinkerMacro () const;\r
 +      void GenerateCleanObjectsAsYouGoCode () const;\r
 +      void GenerateLinkerCommand ( const std::string& dependencies,\r
 +                                   const std::string& linker,\r
 +                                   const std::string& linkerParameters,\r
 +                                   const std::string& objectsMacro,\r
 +                                   const std::string& libsMacro );\r
 +      void GeneratePhonyTarget() const;\r
 +      void GenerateRules ();\r
 +      void GenerateImportLibraryTargetIfNeeded ();\r
 +      void GetDefinitionDependencies ( string_list& dependencies ) const;\r
 +      std::string GetLinkingDependencies () const;\r
 +      static MingwBackend* backend;\r
 +      static FILE* fMakefile;\r
 +      static bool use_pch;\r
 +private:\r
 +      std::string ConcatenatePaths ( const std::string& path1,\r
 +                                     const std::string& path2 ) const;\r
 +      std::string GenerateGccDefineParametersFromVector ( const std::vector<Define*>& defines ) const;\r
 +      std::string GenerateGccDefineParameters () const;\r
 +      std::string GenerateGccIncludeParametersFromVector ( const std::vector<Include*>& includes ) const;\r
 +      std::string GenerateCompilerParametersFromVector ( const std::vector<CompilerFlag*>& compilerFlags ) const;\r
 +      std::string GenerateLinkerParametersFromVector ( const std::vector<LinkerFlag*>& linkerFlags ) const;\r
 +      std::string GenerateImportLibraryDependenciesFromVector ( const std::vector<Library*>& libraries );\r
 +      std::string GenerateLinkerParameters () const;\r
 +      void GenerateMacro ( const char* assignmentOperation,\r
 +                           const std::string& macro,\r
 +                           const IfableData& data,\r
 +                           const std::vector<CompilerFlag*>* compilerFlags );\r
 +      void GenerateMacros ( const char* op,\r
 +                            const IfableData& data,\r
 +                            const std::vector<CompilerFlag*>* compilerFlags,\r
 +                            const std::vector<LinkerFlag*>* linkerFlags );\r
 +      void GenerateObjectMacros ( const char* assignmentOperation,\r
 +                                  const IfableData& data,\r
 +                                  const std::vector<CompilerFlag*>* compilerFlags,\r
 +                                  const std::vector<LinkerFlag*>* linkerFlags );\r
 +      std::string GenerateGccIncludeParameters () const;\r
 +      std::string GenerateGccParameters () const;\r
 +      std::string GenerateNasmParameters () const;\r
 +      void GenerateGccCommand ( const std::string& sourceFilename,\r
 +                                const std::string& cc,\r
 +                                const std::string& cflagsMacro );\r
 +      void GenerateGccAssemblerCommand ( const std::string& sourceFilename,\r
 +                                         const std::string& cc,\r
 +                                         const std::string& cflagsMacro );\r
 +      void GenerateNasmCommand ( const std::string& sourceFilename,\r
 +                                 const std::string& nasmflagsMacro );\r
 +      void GenerateWindresCommand ( const std::string& sourceFilename,\r
 +                                    const std::string& windresflagsMacro );\r
 +      void GenerateWinebuildCommands ( const std::string& sourceFilename );\r
++      std::string GetWidlFlags ( const File& file );\r
 +      void GenerateWidlCommandsServer (\r
-               const std::string& sourceFilename,\r
++              const File& file,\r
 +              const std::string& widlflagsMacro );\r
 +      void GenerateWidlCommandsClient (\r
-       void GenerateWidlCommands ( const std::string& sourceFilename,\r
++              const File& file,\r
 +              const std::string& widlflagsMacro );\r
-       void GenerateCommands ( const std::string& sourceFilename,\r
++      void GenerateWidlCommands ( const File& file,\r
 +                                  const std::string& widlflagsMacro );\r
++      void GenerateCommands ( const File& file,\r
 +                              const std::string& cc,\r
 +                              const std::string& cppc,\r
 +                              const std::string& cflagsMacro,\r
 +                              const std::string& nasmflagsMacro,\r
 +                              const std::string& windresflagsMacro,\r
 +                              const std::string& widlflagsMacro );\r
 +      void GenerateObjectFileTargets ( const IfableData& data,\r
 +                                       const std::string& cc,\r
 +                                       const std::string& cppc,\r
 +                                       const std::string& cflagsMacro,\r
 +                                       const std::string& nasmflagsMacro,\r
 +                                       const std::string& windresflagsMacro,\r
 +                                       const std::string& widlflagsMacro );\r
 +      void GenerateObjectFileTargets ( const std::string& cc,\r
 +                                       const std::string& cppc,\r
 +                                       const std::string& cflagsMacro,\r
 +                                       const std::string& nasmflagsMacro,\r
 +                                       const std::string& windresflagsMacro,\r
 +                                       const std::string& widlflagsMacro );\r
 +      std::string GenerateArchiveTarget ( const std::string& ar,\r
 +                                          const std::string& objs_macro ) const;\r
 +      void GetSpecObjectDependencies ( string_list& dependencies,\r
 +                                       const std::string& filename ) const;\r
 +      void GetWidlObjectDependencies ( string_list& dependencies,\r
 +                                       const std::string& filename ) const;\r
 +      void GetDefaultDependencies ( string_list& dependencies ) const;\r
 +      void GetInvocationDependencies ( const Module& module, string_list& dependencies );\r
 +      bool IsWineModule () const;\r
 +      std::string GetDefinitionFilename () const;\r
 +      static std::string RemoveVariables ( std::string path);\r
 +      void GenerateBuildMapCode ();\r
 +      void GenerateBuildNonSymbolStrippedCode ();\r
 +public:\r
 +      const Module& module;\r
 +      string_list clean_files;\r
 +      std::string cflagsMacro;\r
 +      std::string nasmflagsMacro;\r
 +      std::string windresflagsMacro;\r
 +      std::string widlflagsMacro;\r
 +      std::string linkerflagsMacro;\r
 +      std::string objectsMacro;\r
 +      std::string libsMacro;\r
 +      std::string linkDepsMacro;\r
 +};\r
 +\r
 +\r
 +class MingwBuildToolModuleHandler : public MingwModuleHandler\r
 +{\r
 +public:\r
 +      MingwBuildToolModuleHandler ( const Module& module );\r
 +      virtual HostType DefaultHost() { return HostTrue; }\r
 +      virtual void Process ();\r
 +private:\r
 +      void GenerateBuildToolModuleTarget ();\r
 +};\r
 +\r
 +\r
 +class MingwKernelModuleHandler : public MingwModuleHandler\r
 +{\r
 +public:\r
 +      MingwKernelModuleHandler ( const Module& module );\r
 +      virtual HostType DefaultHost() { return HostFalse; }\r
 +      virtual void Process ();\r
 +      std::string TypeSpecificCFlags() { return "-D_SEH_NO_NATIVE_NLG"; }\r
 +private:\r
 +      void GenerateKernelModuleTarget ();\r
 +};\r
 +\r
 +\r
 +class MingwStaticLibraryModuleHandler : public MingwModuleHandler\r
 +{\r
 +public:\r
 +      MingwStaticLibraryModuleHandler ( const Module& module );\r
 +      virtual HostType DefaultHost() { return HostFalse; }\r
 +      virtual void Process ();\r
 +private:\r
 +      void GenerateStaticLibraryModuleTarget ();\r
 +};\r
 +\r
 +\r
 +class MingwObjectLibraryModuleHandler : public MingwModuleHandler\r
 +{\r
 +public:\r
 +      MingwObjectLibraryModuleHandler ( const Module& module );\r
 +      virtual HostType DefaultHost() { return HostFalse; }\r
 +      virtual void Process ();\r
 +private:\r
 +      void GenerateObjectLibraryModuleTarget ();\r
 +};\r
 +\r
 +\r
 +class MingwKernelModeDLLModuleHandler : public MingwModuleHandler\r
 +{\r
 +public:\r
 +      MingwKernelModeDLLModuleHandler ( const Module& module );\r
 +      virtual HostType DefaultHost() { return HostFalse; }\r
 +      virtual void Process ();\r
 +      std::string TypeSpecificCFlags() { return "-D_SEH_NO_NATIVE_NLG"; }\r
 +      std::string TypeSpecificLinkerFlags() { return "-nostartfiles -nostdlib"; }\r
 +private:\r
 +      void GenerateKernelModeDLLModuleTarget ();\r
 +};\r
 +\r
 +\r
 +class MingwKernelModeDriverModuleHandler : public MingwModuleHandler\r
 +{\r
 +public:\r
 +      MingwKernelModeDriverModuleHandler ( const Module& module );\r
 +      virtual HostType DefaultHost() { return HostFalse; }\r
 +      virtual void Process ();\r
 +      std::string TypeSpecificCFlags() { return "-D__NTDRIVER__ -D_SEH_NO_NATIVE_NLG"; }\r
 +      std::string TypeSpecificLinkerFlags() { return "-nostartfiles -nostdlib"; }\r
 +private:\r
 +      void GenerateKernelModeDriverModuleTarget ();\r
 +};\r
 +\r
 +\r
 +class MingwNativeDLLModuleHandler : public MingwModuleHandler\r
 +{\r
 +public:\r
 +      MingwNativeDLLModuleHandler ( const Module& module );\r
 +      virtual HostType DefaultHost() { return HostFalse; }\r
 +      virtual void Process ();\r
 +      std::string TypeSpecificCFlags() { return "-D_SEH_NO_NATIVE_NLG"; }\r
 +      std::string TypeSpecificLinkerFlags() { return "-nostartfiles -nostdlib"; }\r
 +private:\r
 +      void GenerateNativeDLLModuleTarget ();\r
 +};\r
 +\r
 +\r
 +class MingwNativeCUIModuleHandler : public MingwModuleHandler\r
 +{\r
 +public:\r
 +      MingwNativeCUIModuleHandler ( const Module& module );\r
 +      virtual HostType DefaultHost() { return HostFalse; }\r
 +      virtual void Process ();\r
 +      std::string TypeSpecificCFlags() { return "-D__NTAPP__ -D_SEH_NO_NATIVE_NLG"; }\r
 +      std::string TypeSpecificLinkerFlags() { return "-nostartfiles -nostdlib"; }\r
 +private:\r
 +      void GenerateNativeCUIModuleTarget ();\r
 +};\r
 +\r
 +\r
 +class MingwWin32DLLModuleHandler : public MingwModuleHandler\r
 +{\r
 +public:\r
 +      MingwWin32DLLModuleHandler ( const Module& module );\r
 +      virtual HostType DefaultHost() { return HostFalse; }\r
 +      virtual void Process ();\r
 +private:\r
 +      void GenerateExtractWineDLLResourcesTarget ();\r
 +      void GenerateWin32DLLModuleTarget ();\r
 +};\r
 +\r
 +\r
 +class MingwWin32CUIModuleHandler : public MingwModuleHandler\r
 +{\r
 +public:\r
 +      MingwWin32CUIModuleHandler ( const Module& module );\r
 +      virtual HostType DefaultHost() { return HostFalse; }\r
 +      virtual void Process ();\r
 +private:\r
 +      void GenerateWin32CUIModuleTarget ();\r
 +};\r
 +\r
 +\r
 +class MingwWin32GUIModuleHandler : public MingwModuleHandler\r
 +{\r
 +public:\r
 +      MingwWin32GUIModuleHandler ( const Module& module );\r
 +      virtual HostType DefaultHost() { return HostFalse; }\r
 +      virtual void Process ();\r
 +private:\r
 +      void GenerateWin32GUIModuleTarget ();\r
 +};\r
 +\r
 +\r
 +class MingwBootLoaderModuleHandler : public MingwModuleHandler\r
 +{\r
 +public:\r
 +      MingwBootLoaderModuleHandler ( const Module& module );\r
 +      virtual HostType DefaultHost() { return HostFalse; }\r
 +      virtual void Process ();\r
 +      std::string TypeSpecificLinkerFlags() { return "-nostartfiles -nostdlib"; }\r
 +private:\r
 +      void GenerateBootLoaderModuleTarget ();\r
 +};\r
 +\r
 +\r
 +class MingwBootSectorModuleHandler : public MingwModuleHandler\r
 +{\r
 +public:\r
 +      MingwBootSectorModuleHandler ( const Module& module );\r
 +      virtual HostType DefaultHost() { return HostFalse; }\r
 +      virtual void Process ();\r
 +      std::string TypeSpecificNasmFlags() { return "-f bin"; }\r
 +private:\r
 +      void GenerateBootSectorModuleTarget ();\r
 +};\r
 +\r
 +\r
 +class MingwIsoModuleHandler : public MingwModuleHandler\r
 +{\r
 +public:\r
 +      MingwIsoModuleHandler ( const Module& module );\r
 +      virtual HostType DefaultHost() { return HostFalse; }\r
 +      virtual void Process ();\r
 +private:\r
 +      void GenerateIsoModuleTarget ();\r
 +      std::string GetBootstrapCdDirectories ( const std::string& bootcdDirectory );\r
 +      std::string GetNonModuleCdDirectories ( const std::string& bootcdDirectory );\r
 +      std::string GetCdDirectories ( const std::string& bootcdDirectory );\r
 +      void GetBootstrapCdFiles ( std::vector<std::string>& out ) const;\r
 +      void GetNonModuleCdFiles ( std::vector<std::string>& out ) const;\r
 +      void GetCdFiles ( std::vector<std::string>& out ) const;\r
 +      void OutputBootstrapfileCopyCommands ( const std::string& bootcdDirectory );\r
 +      void OutputCdfileCopyCommands ( const std::string& bootcdDirectory );\r
 +};\r
 +\r
 +\r
 +class MingwLiveIsoModuleHandler : public MingwModuleHandler\r
 +{\r
 +public:\r
 +      MingwLiveIsoModuleHandler ( const Module& module );\r
 +      virtual HostType DefaultHost() { return HostFalse; }\r
 +      virtual void Process ();\r
 +private:\r
 +      void GenerateLiveIsoModuleTarget ();\r
 +      void CreateDirectory ( const std::string& directory );\r
 +      void OutputCopyCommand ( const std::string& sourceFilename,\r
 +                               const std::string& targetFilename,\r
 +                               const std::string& targetDirectory );\r
 +      void OutputModuleCopyCommands ( std::string& livecdDirectory,\r
 +                                      std::string& livecdReactos );\r
 +      void OutputNonModuleCopyCommands ( std::string& livecdDirectory,\r
 +                                         std::string& livecdReactos );\r
 +      void OutputProfilesDirectoryCommands ( std::string& livecdDirectory );\r
 +      void OutputLoaderCommands ( std::string& livecdDirectory );\r
 +      void OutputRegistryCommands ( std::string& livecdDirectory );\r
 +};\r
 +\r
 +\r
 +class MingwTestModuleHandler : public MingwModuleHandler\r
 +{\r
 +public:\r
 +      MingwTestModuleHandler ( const Module& module );\r
 +      virtual HostType DefaultHost() { return HostFalse; }\r
 +      virtual void Process ();\r
 +private:\r
 +      void GenerateTestModuleTarget ();\r
 +};\r
 +\r
 +\r
 +class MingwRpcServerModuleHandler : public MingwModuleHandler\r
 +{\r
 +public:\r
 +      MingwRpcServerModuleHandler ( const Module& module );\r
 +      virtual HostType DefaultHost() { return HostFalse; }\r
 +      virtual void Process ();\r
 +};\r
 +\r
 +\r
 +class MingwRpcClientModuleHandler : public MingwModuleHandler\r
 +{\r
 +public:\r
 +      MingwRpcClientModuleHandler ( const Module& module );\r
 +      virtual HostType DefaultHost() { return HostFalse; }\r
 +      virtual void Process ();\r
 +};\r
 +\r
 +#endif /* MINGW_MODULEHANDLER_H */\r
index 2260fa2,0000000..26422d2
mode 100644,000000..100644
--- /dev/null
@@@ -1,961 -1,0 +1,970 @@@
-               if ( att )\r
 +#include "pch.h"\r
 +#include <assert.h>\r
 +\r
 +#include "rbuild.h"\r
 +\r
 +using std::string;\r
 +using std::vector;\r
 +\r
 +string\r
 +FixSeparator ( const string& s )\r
 +{\r
 +      string s2(s);\r
 +      char* p = strchr ( &s2[0], CBAD_SEP );\r
 +      while ( p )\r
 +      {\r
 +              *p++ = CSEP;\r
 +              p = strchr ( p, CBAD_SEP );\r
 +      }\r
 +      return s2;\r
 +}\r
 +\r
 +string\r
 +ReplaceExtension (\r
 +      const string& filename,\r
 +      const string& newExtension )\r
 +{\r
 +      size_t index = filename.find_last_of ( '/' );\r
 +      if ( index == string::npos )\r
 +              index = 0;\r
 +      size_t index2 = filename.find_last_of ( '\\' );\r
 +      if ( index2 != string::npos && index2 > index )\r
 +              index = index2;\r
 +      string tmp = filename.substr( index /*, filename.size() - index*/ );\r
 +      size_t ext_index = tmp.find_last_of( '.' );\r
 +      if ( ext_index != string::npos )\r
 +              return filename.substr ( 0, index + ext_index ) + newExtension;\r
 +      return filename + newExtension;\r
 +}\r
 +\r
 +string\r
 +GetSubPath (\r
 +      const string& location,\r
 +      const string& path,\r
 +      const string& att_value )\r
 +{\r
 +      if ( !att_value.size() )\r
 +              throw InvalidBuildFileException (\r
 +                      location,\r
 +                      "<directory> tag has empty 'name' attribute" );\r
 +      if ( strpbrk ( att_value.c_str (), "/\\?*:<>|" ) )\r
 +              throw InvalidBuildFileException (\r
 +                      location,\r
 +                      "<directory> tag has invalid characters in 'name' attribute" );\r
 +      if ( !path.size() )\r
 +              return att_value;\r
 +      return FixSeparator(path + CSEP + att_value);\r
 +}\r
 +\r
 +string\r
 +GetExtension ( const string& filename )\r
 +{\r
 +      size_t index = filename.find_last_of ( '/' );\r
 +      if (index == string::npos) index = 0;\r
 +      string tmp = filename.substr( index, filename.size() - index );\r
 +      size_t ext_index = tmp.find_last_of( '.' );\r
 +      if (ext_index != string::npos) \r
 +              return filename.substr ( index + ext_index, filename.size() );\r
 +      return "";\r
 +}\r
 +\r
 +string\r
 +GetDirectory ( const string& filename )\r
 +{\r
 +      size_t index = filename.find_last_of ( CSEP );\r
 +      if ( index == string::npos )\r
 +              return filename;\r
 +      else\r
 +              return filename.substr ( 0, index );\r
 +}\r
 +\r
 +string\r
 +NormalizeFilename ( const string& filename )\r
 +{\r
 +      Path path;\r
 +      string normalizedPath = path.Fixup ( filename, true );\r
 +      string relativeNormalizedPath = path.RelativeFromWorkingDirectory ( normalizedPath );\r
 +      return FixSeparator ( relativeNormalizedPath );\r
 +}\r
 +\r
 +IfableData::~IfableData()\r
 +{\r
 +      size_t i;\r
 +      for ( i = 0; i < files.size(); i++ )\r
 +              delete files[i];\r
 +      for ( i = 0; i < includes.size(); i++ )\r
 +              delete includes[i];\r
 +      for ( i = 0; i < defines.size(); i++ )\r
 +              delete defines[i];\r
 +      for ( i = 0; i < libraries.size(); i++ )\r
 +              delete libraries[i];\r
 +      for ( i = 0; i < properties.size(); i++ )\r
 +              delete properties[i];\r
 +      for ( i = 0; i < ifs.size(); i++ )\r
 +              delete ifs[i];\r
 +}\r
 +\r
 +void IfableData::ProcessXML ()\r
 +{\r
 +      size_t i;\r
 +      for ( i = 0; i < files.size (); i++ )\r
 +              files[i]->ProcessXML ();\r
 +      for ( i = 0; i < includes.size (); i++ )\r
 +              includes[i]->ProcessXML ();\r
 +      for ( i = 0; i < defines.size (); i++ )\r
 +              defines[i]->ProcessXML ();\r
 +      for ( i = 0; i < libraries.size (); i++ )\r
 +              libraries[i]->ProcessXML ();\r
 +      for ( i = 0; i < properties.size(); i++ )\r
 +              properties[i]->ProcessXML ();\r
 +      for ( i = 0; i < ifs.size (); i++ )\r
 +              ifs[i]->ProcessXML ();\r
 +}\r
 +\r
 +Module::Module ( const Project& project,\r
 +                 const XMLElement& moduleNode,\r
 +                 const string& modulePath )\r
 +      : project (project),\r
 +        node (moduleNode),\r
 +        importLibrary (NULL),\r
 +        bootstrap (NULL),\r
 +        pch (NULL),\r
 +        cplusplus (false),\r
 +        host (HostDefault)\r
 +{\r
 +      if ( node.name != "module" )\r
 +              throw InvalidOperationException ( __FILE__,\r
 +                                                __LINE__,\r
 +                                                "Module created with non-<module> node" );\r
 +\r
 +      xmlbuildFile = Path::RelativeFromWorkingDirectory ( moduleNode.xmlFile->filename() );\r
 +\r
 +      path = FixSeparator ( modulePath );\r
 +\r
 +      const XMLAttribute* att = moduleNode.GetAttribute ( "name", true );\r
 +      assert(att);\r
 +      name = att->value;\r
 +\r
 +      att = moduleNode.GetAttribute ( "type", true );\r
 +      assert(att);\r
 +      type = GetModuleType ( node.location, *att );\r
 +\r
 +      att = moduleNode.GetAttribute ( "extension", false );\r
 +      if ( att != NULL )\r
 +              extension = att->value;\r
 +      else\r
 +              extension = GetDefaultModuleExtension ();\r
 +\r
 +      att = moduleNode.GetAttribute ( "entrypoint", false );\r
 +      if ( att != NULL )\r
 +              entrypoint = att->value;\r
 +      else\r
 +              entrypoint = GetDefaultModuleEntrypoint ();\r
 +\r
 +      att = moduleNode.GetAttribute ( "baseaddress", false );\r
 +      if ( att != NULL )\r
 +              baseaddress = att->value;\r
 +      else\r
 +              baseaddress = GetDefaultModuleBaseaddress ();\r
 +\r
 +      att = moduleNode.GetAttribute ( "mangledsymbols", false );\r
 +      if ( att != NULL )\r
 +      {\r
 +              const char* p = att->value.c_str();\r
 +              if ( !stricmp ( p, "true" ) || !stricmp ( p, "yes" ) )\r
 +                      mangledSymbols = true;\r
 +              else if ( !stricmp ( p, "false" ) || !stricmp ( p, "no" ) )\r
 +                      mangledSymbols = false;\r
 +              else\r
 +              {\r
 +                      throw InvalidAttributeValueException (\r
 +                              moduleNode.location,\r
 +                              "mangledsymbols",\r
 +                              att->value );\r
 +              }\r
 +      }\r
 +      else\r
 +              mangledSymbols = false;\r
 +\r
 +      att = moduleNode.GetAttribute ( "host", false );\r
 +      if ( att != NULL )\r
 +      {\r
 +              const char* p = att->value.c_str();\r
 +              if ( !stricmp ( p, "true" ) || !stricmp ( p, "yes" ) )\r
 +                      host = HostTrue;\r
 +              else if ( !stricmp ( p, "false" ) || !stricmp ( p, "no" ) )\r
 +                      host = HostFalse;\r
 +              else\r
 +              {\r
 +                      throw InvalidAttributeValueException (\r
 +                              moduleNode.location,\r
 +                              "host",\r
 +                              att->value );\r
 +              }\r
 +      }\r
 +\r
 +      att = moduleNode.GetAttribute ( "prefix", false );\r
 +      if ( att != NULL )\r
 +              prefix = att->value;\r
 +\r
 +      att = moduleNode.GetAttribute ( "installbase", false );\r
 +      if ( att != NULL )\r
 +              installBase = att->value;\r
 +      else\r
 +              installBase = "";\r
 +\r
 +      att = moduleNode.GetAttribute ( "installname", false );\r
 +      if ( att != NULL )\r
 +              installName = att->value;\r
 +      else\r
 +              installName = "";\r
 +      \r
 +      att = moduleNode.GetAttribute ( "usewrc", false );\r
 +      if ( att != NULL )\r
 +              useWRC = att->value == "true";\r
 +      else\r
 +              useWRC = true;\r
 +\r
 +      att = moduleNode.GetAttribute ( "warnings", false );\r
 +      if ( att != NULL )\r
 +              enableWarnings = att->value == "true";\r
 +      else\r
 +              enableWarnings = false;\r
 +}\r
 +\r
 +Module::~Module ()\r
 +{\r
 +      size_t i;\r
 +      for ( i = 0; i < invocations.size(); i++ )\r
 +              delete invocations[i];\r
 +      for ( i = 0; i < dependencies.size(); i++ )\r
 +              delete dependencies[i];\r
 +      for ( i = 0; i < compilerFlags.size(); i++ )\r
 +              delete compilerFlags[i];\r
 +      for ( i = 0; i < linkerFlags.size(); i++ )\r
 +              delete linkerFlags[i];\r
 +      for ( i = 0; i < stubbedComponents.size(); i++ )\r
 +              delete stubbedComponents[i];\r
 +      if ( pch )\r
 +              delete pch;\r
 +}\r
 +\r
 +void\r
 +Module::ProcessXML()\r
 +{\r
 +      size_t i;\r
 +      for ( i = 0; i < node.subElements.size(); i++ )\r
 +              ProcessXMLSubElement ( *node.subElements[i], path );\r
 +      for ( i = 0; i < invocations.size(); i++ )\r
 +              invocations[i]->ProcessXML ();\r
 +      for ( i = 0; i < dependencies.size(); i++ )\r
 +              dependencies[i]->ProcessXML ();\r
 +      for ( i = 0; i < compilerFlags.size(); i++ )\r
 +              compilerFlags[i]->ProcessXML();\r
 +      for ( i = 0; i < linkerFlags.size(); i++ )\r
 +              linkerFlags[i]->ProcessXML();\r
 +      for ( i = 0; i < stubbedComponents.size(); i++ )\r
 +              stubbedComponents[i]->ProcessXML();\r
 +      non_if_data.ProcessXML();\r
 +      if ( pch )\r
 +              pch->ProcessXML();\r
 +}\r
 +\r
 +void\r
 +Module::ProcessXMLSubElement ( const XMLElement& e,\r
 +                               const string& path,\r
 +                               If* pIf /*= NULL*/ )\r
 +{\r
 +      bool subs_invalid = false;\r
 +      string subpath ( path );\r
 +      if ( e.name == "file" && e.value.size () > 0 )\r
 +      {\r
 +              bool first = false;\r
 +              const XMLAttribute* att = e.GetAttribute ( "first", false );\r
-               File* pFile = new File ( FixSeparator ( path + CSEP + e.value ), first );\r
++              if ( att != NULL )\r
 +              {\r
 +                      if ( !stricmp ( att->value.c_str(), "true" ) )\r
 +                              first = true;\r
 +                      else if ( stricmp ( att->value.c_str(), "false" ) )\r
 +                              throw InvalidBuildFileException (\r
 +                                      e.location,\r
 +                                      "attribute 'first' of <file> element can only be 'true' or 'false'" );\r
 +              }\r
++              string switches = "";\r
++              att = e.GetAttribute ( "switches", false );\r
++              if ( att != NULL )\r
++                      switches = att->value;\r
 +              if ( !cplusplus )\r
 +              {\r
 +                      // check for c++ file\r
 +                      string ext = GetExtension ( e.value );\r
 +                      if ( !stricmp ( ext.c_str(), ".cpp" ) )\r
 +                              cplusplus = true;\r
 +                      else if ( !stricmp ( ext.c_str(), ".cc" ) )\r
 +                              cplusplus = true;\r
 +                      else if ( !stricmp ( ext.c_str(), ".cxx" ) )\r
 +                              cplusplus = true;\r
 +              }\r
- File::File ( const string& _name, bool _first )\r
-       : name(_name), first(_first)\r
++              File* pFile = new File ( FixSeparator ( path + CSEP + e.value ),\r
++                                       first,\r
++                                       switches );\r
 +              if ( pIf )\r
 +                      pIf->data.files.push_back ( pFile );\r
 +              else\r
 +                      non_if_data.files.push_back ( pFile );\r
 +              subs_invalid = true;\r
 +      }\r
 +      else if ( e.name == "library" && e.value.size () )\r
 +      {\r
 +              Library* pLibrary = new Library ( e, *this, e.value );\r
 +              if ( pIf )\r
 +                      pIf->data.libraries.push_back ( pLibrary );\r
 +              else\r
 +                      non_if_data.libraries.push_back ( pLibrary );\r
 +              subs_invalid = true;\r
 +      }\r
 +      else if ( e.name == "directory" )\r
 +      {\r
 +              const XMLAttribute* att = e.GetAttribute ( "name", true );\r
 +              assert(att);\r
 +              subpath = GetSubPath ( e.location, path, att->value );\r
 +      }\r
 +      else if ( e.name == "include" )\r
 +      {\r
 +              Include* include = new Include ( project, this, e );\r
 +              if ( pIf )\r
 +                      pIf->data.includes.push_back ( include );\r
 +              else\r
 +                      non_if_data.includes.push_back ( include );\r
 +              subs_invalid = true;\r
 +      }\r
 +      else if ( e.name == "define" )\r
 +      {\r
 +              Define* pDefine = new Define ( project, this, e );\r
 +              if ( pIf )\r
 +                      pIf->data.defines.push_back ( pDefine );\r
 +              else\r
 +                      non_if_data.defines.push_back ( pDefine );\r
 +              subs_invalid = true;\r
 +      }\r
 +      else if ( e.name == "invoke" )\r
 +      {\r
 +              if ( pIf )\r
 +                      throw InvalidBuildFileException (\r
 +                              e.location,\r
 +                              "<invoke> is not a valid sub-element of <if>" );\r
 +              invocations.push_back ( new Invoke ( e, *this ) );\r
 +              subs_invalid = false;\r
 +      }\r
 +      else if ( e.name == "dependency" )\r
 +      {\r
 +              if ( pIf )\r
 +                      throw InvalidBuildFileException (\r
 +                              e.location,\r
 +                              "<dependency> is not a valid sub-element of <if>" );\r
 +              dependencies.push_back ( new Dependency ( e, *this ) );\r
 +              subs_invalid = true;\r
 +      }\r
 +      else if ( e.name == "importlibrary" )\r
 +      {\r
 +              if ( pIf )\r
 +                      throw InvalidBuildFileException (\r
 +                              e.location,\r
 +                              "<importlibrary> is not a valid sub-element of <if>" );\r
 +              if ( importLibrary )\r
 +                      throw InvalidBuildFileException (\r
 +                              e.location,\r
 +                              "Only one <importlibrary> is valid per module" );\r
 +              importLibrary = new ImportLibrary ( e, *this );\r
 +              subs_invalid = true;\r
 +      }\r
 +      else if ( e.name == "if" )\r
 +      {\r
 +              If* pOldIf = pIf;\r
 +              pIf = new If ( e, project, this );\r
 +              if ( pOldIf )\r
 +                      pOldIf->data.ifs.push_back ( pIf );\r
 +              else\r
 +                      non_if_data.ifs.push_back ( pIf );\r
 +              subs_invalid = false;\r
 +      }\r
 +      else if ( e.name == "compilerflag" )\r
 +      {\r
 +              compilerFlags.push_back ( new CompilerFlag ( project, this, e ) );\r
 +              subs_invalid = true;\r
 +      }\r
 +      else if ( e.name == "linkerflag" )\r
 +      {\r
 +              linkerFlags.push_back ( new LinkerFlag ( project, this, e ) );\r
 +              subs_invalid = true;\r
 +      }\r
 +      else if ( e.name == "component" )\r
 +      {\r
 +              stubbedComponents.push_back ( new StubbedComponent ( this, e ) );\r
 +              subs_invalid = false;\r
 +      }\r
 +      else if ( e.name == "property" )\r
 +      {\r
 +              throw InvalidBuildFileException (\r
 +                      e.location,\r
 +                      "<property> is not a valid sub-element of <module>" );\r
 +      }\r
 +      else if ( e.name == "bootstrap" )\r
 +      {\r
 +              bootstrap = new Bootstrap ( project, this, e );\r
 +              subs_invalid = true;\r
 +      }\r
 +      else if ( e.name == "pch" )\r
 +      {\r
 +              if ( pIf )\r
 +                      throw InvalidBuildFileException (\r
 +                              e.location,\r
 +                              "<pch> is not a valid sub-element of <if>" );\r
 +              if ( pch )\r
 +                      throw InvalidBuildFileException (\r
 +                              e.location,\r
 +                              "Only one <pch> is valid per module" );\r
 +              pch = new PchFile (\r
 +                      e, *this, FixSeparator ( path + CSEP + e.value ) );\r
 +              subs_invalid = true;\r
 +      }\r
 +      if ( subs_invalid && e.subElements.size() > 0 )\r
 +              throw InvalidBuildFileException (\r
 +                      e.location,\r
 +                      "<%s> cannot have sub-elements",\r
 +                      e.name.c_str() );\r
 +      for ( size_t i = 0; i < e.subElements.size (); i++ )\r
 +              ProcessXMLSubElement ( *e.subElements[i], subpath, pIf );\r
 +}\r
 +\r
 +ModuleType\r
 +Module::GetModuleType ( const string& location, const XMLAttribute& attribute )\r
 +{\r
 +      if ( attribute.value == "buildtool" )\r
 +              return BuildTool;\r
 +      if ( attribute.value == "staticlibrary" )\r
 +              return StaticLibrary;\r
 +      if ( attribute.value == "objectlibrary" )\r
 +              return ObjectLibrary;\r
 +      if ( attribute.value == "kernel" )\r
 +              return Kernel;\r
 +      if ( attribute.value == "kernelmodedll" )\r
 +              return KernelModeDLL;\r
 +      if ( attribute.value == "kernelmodedriver" )\r
 +              return KernelModeDriver;\r
 +      if ( attribute.value == "nativedll" )\r
 +              return NativeDLL;\r
 +      if ( attribute.value == "nativecui" )\r
 +              return NativeCUI;\r
 +      if ( attribute.value == "win32dll" )\r
 +              return Win32DLL;\r
 +      if ( attribute.value == "win32cui" )\r
 +              return Win32CUI;\r
 +      if ( attribute.value == "win32gui" )\r
 +              return Win32GUI;\r
 +      if ( attribute.value == "bootloader" )\r
 +              return BootLoader;\r
 +      if ( attribute.value == "bootsector" )\r
 +              return BootSector;\r
 +      if ( attribute.value == "iso" )\r
 +              return Iso;\r
 +      if ( attribute.value == "liveiso" )\r
 +              return LiveIso;\r
 +      if ( attribute.value == "test" )\r
 +              return Test;\r
 +      if ( attribute.value == "rpcserver" )\r
 +              return RpcServer;\r
 +      if ( attribute.value == "rpcclient" )\r
 +              return RpcClient;\r
 +      throw InvalidAttributeValueException ( location,\r
 +                                             attribute.name,\r
 +                                             attribute.value );\r
 +}\r
 +\r
 +string\r
 +Module::GetDefaultModuleExtension () const\r
 +{\r
 +      switch (type)\r
 +      {\r
 +              case BuildTool:\r
 +                      return EXEPOSTFIX;\r
 +              case StaticLibrary:\r
 +                      return ".a";\r
 +              case ObjectLibrary:\r
 +                      return ".o";\r
 +              case Kernel:\r
 +              case NativeCUI:\r
 +              case Win32CUI:\r
 +              case Win32GUI:\r
 +                      return ".exe";\r
 +              case KernelModeDLL:\r
 +              case NativeDLL:\r
 +              case Win32DLL:\r
 +                      return ".dll";\r
 +              case KernelModeDriver:\r
 +              case BootLoader:\r
 +                      return ".sys";\r
 +              case BootSector:\r
 +                      return ".o";\r
 +              case Iso:\r
 +              case LiveIso:\r
 +                      return ".iso";\r
 +              case Test:\r
 +                      return ".exe";\r
 +              case RpcServer:\r
 +                      return ".o";\r
 +              case RpcClient:\r
 +                      return ".o";\r
 +      }\r
 +      throw InvalidOperationException ( __FILE__,\r
 +                                        __LINE__ );\r
 +}\r
 +\r
 +string\r
 +Module::GetDefaultModuleEntrypoint () const\r
 +{\r
 +      switch (type)\r
 +      {\r
 +              case Kernel:\r
 +                      return "_NtProcessStartup";\r
 +              case KernelModeDLL:\r
 +                      return "_DriverEntry@8";\r
 +              case NativeDLL:\r
 +                      return "_DllMainCRTStartup@12";\r
 +              case NativeCUI:\r
 +                      return "_NtProcessStartup@4";\r
 +              case Win32DLL:\r
 +                      return "_DllMain@12";\r
 +              case Win32CUI:\r
 +              case Test:\r
 +                      return "_mainCRTStartup";\r
 +              case Win32GUI:\r
 +                      return "_WinMainCRTStartup";\r
 +              case KernelModeDriver:\r
 +                      return "_DriverEntry@8";\r
 +              case BuildTool:\r
 +              case StaticLibrary:\r
 +              case ObjectLibrary:\r
 +              case BootLoader:\r
 +              case BootSector:\r
 +              case Iso:\r
 +              case LiveIso:\r
 +              case RpcServer:\r
 +              case RpcClient:\r
 +                      return "";\r
 +      }\r
 +      throw InvalidOperationException ( __FILE__,\r
 +                                        __LINE__ );\r
 +}\r
 +\r
 +string\r
 +Module::GetDefaultModuleBaseaddress () const\r
 +{\r
 +      switch (type)\r
 +      {\r
 +              case Kernel:\r
 +                      return "0xc0000000";\r
 +              case KernelModeDLL:\r
 +                      return "0x10000";\r
 +              case NativeDLL:\r
 +                      return "0x10000";\r
 +              case NativeCUI:\r
 +                      return "0x10000";\r
 +              case Win32DLL:\r
 +                      return "0x10000";\r
 +              case Win32CUI:\r
 +              case Test:\r
 +                      return "0x00400000";\r
 +              case Win32GUI:\r
 +                      return "0x00400000";\r
 +              case KernelModeDriver:\r
 +                      return "0x10000";\r
 +              case BuildTool:\r
 +              case StaticLibrary:\r
 +              case ObjectLibrary:\r
 +              case BootLoader:\r
 +              case BootSector:\r
 +              case Iso:\r
 +              case LiveIso:\r
 +              case RpcServer:\r
 +              case RpcClient:\r
 +                      return "";\r
 +      }\r
 +      throw InvalidOperationException ( __FILE__,\r
 +                                        __LINE__ );\r
 +}\r
 +\r
 +bool\r
 +Module::HasImportLibrary () const\r
 +{\r
 +      return importLibrary != NULL;\r
 +}\r
 +\r
 +string\r
 +Module::GetTargetName () const\r
 +{\r
 +      return name + extension;\r
 +}\r
 +\r
 +string\r
 +Module::GetDependencyPath () const\r
 +{\r
 +      if ( HasImportLibrary () )\r
 +      {\r
 +              return ReplaceExtension ( GetPath(), ".a" );\r
 +      }\r
 +      else\r
 +              return GetPath();\r
 +}\r
 +\r
 +string\r
 +Module::GetBasePath () const\r
 +{\r
 +      return path;\r
 +}\r
 +\r
 +string\r
 +Module::GetPath () const\r
 +{\r
 +      if ( path.length() > 0 )\r
 +              return path + CSEP + GetTargetName ();\r
 +      else\r
 +              return GetTargetName ();\r
 +}\r
 +\r
 +string\r
 +Module::GetPathWithPrefix ( const string& prefix ) const\r
 +{\r
 +      return path + CSEP + prefix + GetTargetName ();\r
 +}\r
 +\r
 +string\r
 +Module::GetInvocationTarget ( const int index ) const\r
 +{\r
 +      return ssprintf ( "%s_invoke_%d",\r
 +                        name.c_str (),\r
 +                        index );\r
 +}\r
 +\r
 +bool\r
 +Module::HasFileWithExtension (\r
 +      const IfableData& data,\r
 +      const std::string& extension ) const\r
 +{\r
 +      size_t i;\r
 +      for ( i = 0; i < data.files.size (); i++ )\r
 +      {\r
 +              File& file = *data.files[i];\r
 +              string file_ext = GetExtension ( file.name );\r
 +              if ( !stricmp ( file_ext.c_str (), extension.c_str () ) )\r
 +                      return true;\r
 +      }\r
 +      for ( i = 0; i < data.ifs.size (); i++ )\r
 +      {\r
 +              if ( HasFileWithExtension ( data.ifs[i]->data, extension ) )\r
 +                      return true;\r
 +      }\r
 +      return false;\r
 +}\r
 +\r
 +void\r
 +Module::InvokeModule () const\r
 +{\r
 +      for ( size_t i = 0; i < invocations.size (); i++ )\r
 +      {\r
 +              Invoke& invoke = *invocations[i];\r
 +              string command = invoke.invokeModule->GetPath () + " " + invoke.GetParameters ();\r
 +              printf ( "Executing '%s'\n\n", command.c_str () );\r
 +              int exitcode = system ( command.c_str () );\r
 +              if ( exitcode != 0 )\r
 +                      throw InvocationFailedException ( command,\r
 +                                                        exitcode );\r
 +      }\r
 +}\r
 +\r
 +\r
++File::File ( const string& _name, bool _first,\r
++             std::string _switches )\r
++      : name(_name),\r
++        first(_first),\r
++        switches(_switches)\r
 +{\r
 +}\r
 +\r
 +void\r
 +File::ProcessXML()\r
 +{\r
 +}\r
 +\r
 +\r
 +Library::Library ( const XMLElement& _node,\r
 +                   const Module& _module,\r
 +                   const string& _name )\r
 +      : node(_node),\r
 +        module(_module),\r
 +        name(_name),\r
 +        imported_module(_module.project.LocateModule(_name))\r
 +{\r
 +      if ( module.name == name )\r
 +              throw InvalidBuildFileException (\r
 +                      node.location,\r
 +                      "module '%s' cannot link against itself",\r
 +                      name.c_str() );\r
 +      if ( !imported_module )\r
 +              throw InvalidBuildFileException (\r
 +                      node.location,\r
 +                      "module '%s' trying to import non-existant module '%s'",\r
 +                      module.name.c_str(),\r
 +                      name.c_str() );\r
 +}\r
 +\r
 +void\r
 +Library::ProcessXML()\r
 +{\r
 +      if ( !module.project.LocateModule ( name ) )\r
 +              throw InvalidBuildFileException (\r
 +                      node.location,\r
 +                      "module '%s' is trying to link against non-existant module '%s'",\r
 +                      module.name.c_str(),\r
 +                      name.c_str() );\r
 +}\r
 +\r
 +\r
 +Invoke::Invoke ( const XMLElement& _node,\r
 +                 const Module& _module )\r
 +      : node (_node),\r
 +        module (_module)\r
 +{\r
 +}\r
 +\r
 +void\r
 +Invoke::ProcessXML()\r
 +{\r
 +      const XMLAttribute* att = node.GetAttribute ( "module", false );\r
 +      if (att == NULL)\r
 +              invokeModule = &module;\r
 +      else\r
 +      {\r
 +              invokeModule = module.project.LocateModule ( att->value );\r
 +              if ( invokeModule == NULL )\r
 +                      throw InvalidBuildFileException (\r
 +                              node.location,\r
 +                              "module '%s' is trying to invoke non-existant module '%s'",\r
 +                              module.name.c_str(),\r
 +                              att->value.c_str() );\r
 +      }\r
 +\r
 +      for ( size_t i = 0; i < node.subElements.size (); i++ )\r
 +              ProcessXMLSubElement ( *node.subElements[i] );\r
 +}\r
 +\r
 +void\r
 +Invoke::ProcessXMLSubElement ( const XMLElement& e )\r
 +{\r
 +      bool subs_invalid = false;\r
 +      if ( e.name == "input" )\r
 +      {\r
 +              for ( size_t i = 0; i < e.subElements.size (); i++ )\r
 +                      ProcessXMLSubElementInput ( *e.subElements[i] );\r
 +      }\r
 +      else if ( e.name == "output" )\r
 +      {\r
 +              for ( size_t i = 0; i < e.subElements.size (); i++ )\r
 +                      ProcessXMLSubElementOutput ( *e.subElements[i] );\r
 +      }\r
 +      if ( subs_invalid && e.subElements.size() > 0 )\r
 +              throw InvalidBuildFileException ( e.location,\r
 +                                                "<%s> cannot have sub-elements",\r
 +                                                e.name.c_str() );\r
 +}\r
 +\r
 +void\r
 +Invoke::ProcessXMLSubElementInput ( const XMLElement& e )\r
 +{\r
 +      bool subs_invalid = false;\r
 +      if ( e.name == "inputfile" && e.value.size () > 0 )\r
 +      {\r
 +              input.push_back ( new InvokeFile ( e, FixSeparator ( module.path + CSEP + e.value ) ) );\r
 +              subs_invalid = true;\r
 +      }\r
 +      if ( subs_invalid && e.subElements.size() > 0 )\r
 +              throw InvalidBuildFileException ( e.location,\r
 +                                                "<%s> cannot have sub-elements",\r
 +                                                e.name.c_str() );\r
 +}\r
 +\r
 +void\r
 +Invoke::ProcessXMLSubElementOutput ( const XMLElement& e )\r
 +{\r
 +      bool subs_invalid = false;\r
 +      if ( e.name == "outputfile" && e.value.size () > 0 )\r
 +      {\r
 +              output.push_back ( new InvokeFile ( e, FixSeparator ( module.path + CSEP + e.value ) ) );\r
 +              subs_invalid = true;\r
 +      }\r
 +      if ( subs_invalid && e.subElements.size() > 0 )\r
 +              throw InvalidBuildFileException (\r
 +                      e.location,\r
 +                      "<%s> cannot have sub-elements",\r
 +                      e.name.c_str() );\r
 +}\r
 +\r
 +void\r
 +Invoke::GetTargets ( string_list& targets ) const\r
 +{\r
 +      for ( size_t i = 0; i < output.size (); i++ )\r
 +      {\r
 +              InvokeFile& file = *output[i];\r
 +              targets.push_back ( NormalizeFilename ( file.name ) );\r
 +      }\r
 +}\r
 +\r
 +string\r
 +Invoke::GetParameters () const\r
 +{\r
 +      string parameters ( "" );\r
 +      size_t i;\r
 +      for ( i = 0; i < output.size (); i++ )\r
 +      {\r
 +              if ( parameters.length () > 0)\r
 +                      parameters += " ";\r
 +              InvokeFile& invokeFile = *output[i];\r
 +              if ( invokeFile.switches.length () > 0 )\r
 +              {\r
 +                      parameters += invokeFile.switches + " ";\r
 +              }\r
 +              parameters += invokeFile.name;\r
 +      }\r
 +\r
 +      for ( i = 0; i < input.size (); i++ )\r
 +      {\r
 +              if ( parameters.length () > 0 )\r
 +                      parameters += " ";\r
 +              InvokeFile& invokeFile = *input[i];\r
 +              if ( invokeFile.switches.length () > 0 )\r
 +              {\r
 +                      parameters += invokeFile.switches;\r
 +                      parameters += " ";\r
 +              }\r
 +              parameters += invokeFile.name ;\r
 +      }\r
 +\r
 +      return parameters;\r
 +}\r
 +\r
 +\r
 +InvokeFile::InvokeFile ( const XMLElement& _node,\r
 +                         const string& _name )\r
 +      : node (_node),\r
 +      name (_name)\r
 +{\r
 +      const XMLAttribute* att = _node.GetAttribute ( "switches", false );\r
 +      if (att != NULL)\r
 +              switches = att->value;\r
 +      else\r
 +              switches = "";\r
 +}\r
 +\r
 +void\r
 +InvokeFile::ProcessXML()\r
 +{\r
 +}\r
 +\r
 +\r
 +Dependency::Dependency ( const XMLElement& _node,\r
 +                         const Module& _module )\r
 +      : node (_node),\r
 +        module (_module),\r
 +        dependencyModule (NULL)\r
 +{\r
 +}\r
 +\r
 +void\r
 +Dependency::ProcessXML()\r
 +{\r
 +      dependencyModule = module.project.LocateModule ( node.value );\r
 +      if ( dependencyModule == NULL )\r
 +              throw InvalidBuildFileException ( node.location,\r
 +                                                "module '%s' depend on non-existant module '%s'",\r
 +                                                module.name.c_str(),\r
 +                                                node.value.c_str() );\r
 +}\r
 +\r
 +\r
 +ImportLibrary::ImportLibrary ( const XMLElement& _node,\r
 +                               const Module& _module )\r
 +      : node (_node),\r
 +        module (_module)\r
 +{\r
 +      const XMLAttribute* att = _node.GetAttribute ( "basename", false );\r
 +      if (att != NULL)\r
 +              basename = att->value;\r
 +      else\r
 +              basename = module.name;\r
 +\r
 +      att = _node.GetAttribute ( "definition", true );\r
 +      assert (att);\r
 +      definition = FixSeparator(att->value);\r
 +}\r
 +\r
 +\r
 +If::If ( const XMLElement& node_,\r
 +         const Project& project_,\r
 +         const Module* module_ )\r
 +      : node(node_), project(project_), module(module_)\r
 +{\r
 +      const XMLAttribute* att;\r
 +\r
 +      att = node.GetAttribute ( "property", true );\r
 +      assert(att);\r
 +      property = att->value;\r
 +\r
 +      att = node.GetAttribute ( "value", true );\r
 +      assert(att);\r
 +      value = att->value;\r
 +}\r
 +\r
 +If::~If ()\r
 +{\r
 +}\r
 +\r
 +void\r
 +If::ProcessXML()\r
 +{\r
 +}\r
 +\r
 +\r
 +Property::Property ( const XMLElement& node_,\r
 +                     const Project& project_,\r
 +                     const Module* module_ )\r
 +      : node(node_), project(project_), module(module_)\r
 +{\r
 +      const XMLAttribute* att;\r
 +\r
 +      att = node.GetAttribute ( "name", true );\r
 +      assert(att);\r
 +      name = att->value;\r
 +\r
 +      att = node.GetAttribute ( "value", true );\r
 +      assert(att);\r
 +      value = att->value;\r
 +}\r
 +\r
 +void\r
 +Property::ProcessXML()\r
 +{\r
 +}\r
 +\r
 +\r
 +PchFile::PchFile (\r
 +      const XMLElement& node_,\r
 +      const Module& module_,\r
 +      const string& header_ )\r
 +      : node(node_), module(module_), header(header_)\r
 +{\r
 +}\r
 +\r
 +void\r
 +PchFile::ProcessXML()\r
 +{\r
 +}\r
index f14cc2d,0000000..88d8838
mode 100644,000000..100644
--- /dev/null
@@@ -1,616 -1,0 +1,619 @@@
-       File ( const std::string& _name, bool _first );\r
 +#ifndef __RBUILD_H\r
 +#define __RBUILD_H\r
 +\r
 +#include "pch.h"\r
 +\r
 +#ifdef WIN32\r
 +#include <direct.h>\r
 +#include <io.h>\r
 +#endif/*WIN32*/\r
 +#include <sys/stat.h>\r
 +#include <time.h>\r
 +#ifdef _MSC_VER\r
 +#include <sys/utime.h>\r
 +#else/*_MSC_VER*/\r
 +#include <utime.h>\r
 +#ifdef WIN32\r
 +#include <process.h>\r
 +#endif/*WIN32*/\r
 +#endif/*_MSC_VER*/\r
 +\r
 +#include "ssprintf.h"\r
 +#include "exception.h"\r
 +#include "XML.h"\r
 +\r
 +typedef std::vector<std::string> string_list;\r
 +\r
 +#ifdef WIN32\r
 +#define EXEPREFIX ""\r
 +#define EXEPOSTFIX ".exe"\r
 +#define CSEP '\\'\r
 +#define CBAD_SEP '/'\r
 +#define SSEP "\\"\r
 +#define SBAD_SEP "/"\r
 +#else\r
 +#define EXEPREFIX "./"\r
 +#define EXEPOSTFIX ""\r
 +#define CSEP '/'\r
 +#define CBAD_SEP '\\'\r
 +#define SSEP "/"\r
 +#define SBAD_SEP "\\"\r
 +#endif\r
 +\r
 +class Project;\r
 +class IfableData;\r
 +class Module;\r
 +class Include;\r
 +class Define;\r
 +class File;\r
 +class Library;\r
 +class Invoke;\r
 +class InvokeFile;\r
 +class Dependency;\r
 +class ImportLibrary;\r
 +class If;\r
 +class CompilerFlag;\r
 +class LinkerFlag;\r
 +class Property;\r
 +class AutomaticDependency;\r
 +class Bootstrap;\r
 +class CDFile;\r
 +class InstallFile;\r
 +class PchFile;\r
 +class StubbedComponent;\r
 +class StubbedSymbol;\r
 +\r
 +class SourceFileTest;\r
 +\r
 +class IfableData\r
 +{\r
 +public:\r
 +      std::vector<File*> files;\r
 +      std::vector<Include*> includes;\r
 +      std::vector<Define*> defines;\r
 +      std::vector<Library*> libraries;\r
 +      std::vector<Property*> properties;\r
 +      std::vector<If*> ifs;\r
 +\r
 +      ~IfableData();\r
 +      void ProcessXML();\r
 +};\r
 +\r
 +class Project\r
 +{\r
 +      std::string xmlfile;\r
 +      XMLElement *node, *head;\r
 +public:\r
 +      std::string name;\r
 +      std::string makefile;\r
 +      XMLIncludes xmlbuildfiles;\r
 +      std::vector<Module*> modules;\r
 +      std::vector<LinkerFlag*> linkerFlags;\r
 +      std::vector<CDFile*> cdfiles;\r
 +      std::vector<InstallFile*> installfiles;\r
 +      IfableData non_if_data;\r
 +\r
 +      Project ( const std::string& filename );\r
 +      ~Project ();\r
 +      void WriteConfigurationFile ();\r
 +      void ExecuteInvocations ();\r
 +      void ProcessXML ( const std::string& path );\r
 +      Module* LocateModule ( const std::string& name );\r
 +      const Module* LocateModule ( const std::string& name ) const;\r
 +      std::string GetProjectFilename () const;\r
 +private:\r
 +      const Property* LookupProperty ( const std::string& name ) const;\r
 +      void SetConfigurationOption ( char* s,\r
 +                                    std::string name,\r
 +                                    std::string* alternativeName );\r
 +      void SetConfigurationOption ( char* s,\r
 +                                    std::string name );\r
 +      void WriteIfChanged ( char* outbuf,\r
 +                            std::string filename );\r
 +      void ReadXml ();\r
 +      void ProcessXMLSubElement ( const XMLElement& e,\r
 +                                  const std::string& path,\r
 +                                  If* pIf = NULL );\r
 +\r
 +      // disable copy semantics\r
 +      Project ( const Project& );\r
 +      Project& operator = ( const Project& );\r
 +};\r
 +\r
 +\r
 +enum ModuleType\r
 +{\r
 +      BuildTool,\r
 +      StaticLibrary,\r
 +      ObjectLibrary,\r
 +      Kernel,\r
 +      KernelModeDLL,\r
 +      KernelModeDriver,\r
 +      NativeDLL,\r
 +      NativeCUI,\r
 +      Win32DLL,\r
 +      Win32CUI,\r
 +      Win32GUI,\r
 +      BootLoader,\r
 +      BootSector,\r
 +      Iso,\r
 +      LiveIso,\r
 +      Test,\r
 +      RpcServer,\r
 +      RpcClient\r
 +};\r
 +\r
 +enum HostType\r
 +{\r
 +      HostFalse,\r
 +      HostDefault,\r
 +      HostTrue\r
 +};\r
 +\r
 +class Module\r
 +{\r
 +public:\r
 +      const Project& project;\r
 +      const XMLElement& node;\r
 +      std::string xmlbuildFile;\r
 +      std::string name;\r
 +      std::string extension;\r
 +      std::string entrypoint;\r
 +      std::string baseaddress;\r
 +      std::string path;\r
 +      ModuleType type;\r
 +      ImportLibrary* importLibrary;\r
 +      bool mangledSymbols;\r
 +      Bootstrap* bootstrap;\r
 +      IfableData non_if_data;\r
 +      std::vector<Invoke*> invocations;\r
 +      std::vector<Dependency*> dependencies;\r
 +      std::vector<CompilerFlag*> compilerFlags;\r
 +      std::vector<LinkerFlag*> linkerFlags;\r
 +      std::vector<StubbedComponent*> stubbedComponents;\r
 +      PchFile* pch;\r
 +      bool cplusplus;\r
 +      std::string prefix;\r
 +      HostType host;\r
 +      std::string installBase;\r
 +      std::string installName;\r
 +      bool useWRC;\r
 +      bool enableWarnings;\r
 +\r
 +      Module ( const Project& project,\r
 +               const XMLElement& moduleNode,\r
 +               const std::string& modulePath );\r
 +      ~Module ();\r
 +      ModuleType GetModuleType ( const std::string& location,\r
 +                                 const XMLAttribute& attribute );\r
 +      bool HasImportLibrary () const;\r
 +      std::string GetTargetName () const;\r
 +      std::string GetDependencyPath () const;\r
 +      std::string GetBasePath () const;\r
 +      std::string GetPath () const;\r
 +      std::string GetPathWithPrefix ( const std::string& prefix ) const;\r
 +      void GetTargets ( string_list& ) const;\r
 +      std::string GetInvocationTarget ( const int index ) const;\r
 +      bool HasFileWithExtension ( const IfableData&, const std::string& extension ) const;\r
 +      void InvokeModule () const;\r
 +      void ProcessXML ();\r
 +private:\r
 +      std::string GetDefaultModuleExtension () const;\r
 +      std::string GetDefaultModuleEntrypoint () const;\r
 +      std::string GetDefaultModuleBaseaddress () const;\r
 +      void ProcessXMLSubElement ( const XMLElement& e,\r
 +                                  const std::string& path,\r
 +                                  If* pIf = NULL );\r
 +};\r
 +\r
 +\r
 +class Include\r
 +{\r
 +public:\r
 +      const Project& project;\r
 +      const Module* module;\r
 +      const XMLElement& node;\r
 +      std::string directory;\r
 +      std::string basePath;\r
 +\r
 +      Include ( const Project& project,\r
 +                const XMLElement& includeNode );\r
 +      Include ( const Project& project,\r
 +                const Module* module,\r
 +                const XMLElement& includeNode );\r
 +      ~Include ();\r
 +      void ProcessXML();\r
 +private:\r
 +      void Initialize();\r
 +};\r
 +\r
 +\r
 +class Define\r
 +{\r
 +public:\r
 +      const Project& project;\r
 +      const Module* module;\r
 +      const XMLElement& node;\r
 +      std::string name;\r
 +      std::string value;\r
 +\r
 +      Define ( const Project& project,\r
 +               const XMLElement& defineNode );\r
 +      Define ( const Project& project,\r
 +               const Module* module,\r
 +               const XMLElement& defineNode );\r
 +      ~Define();\r
 +      void ProcessXML();\r
 +private:\r
 +      void Initialize();\r
 +};\r
 +\r
 +\r
 +class File\r
 +{\r
 +public:\r
 +      std::string name;\r
 +      bool first;\r
++      std::string switches;\r
 +\r
++      File ( const std::string& _name,\r
++             bool _first,\r
++             std::string _switches );\r
 +\r
 +      void ProcessXML();\r
 +};\r
 +\r
 +\r
 +class Library\r
 +{\r
 +public:\r
 +      const XMLElement& node;\r
 +      const Module& module;\r
 +      std::string name;\r
 +      const Module* imported_module;\r
 +\r
 +      Library ( const XMLElement& _node,\r
 +                const Module& _module,\r
 +                const std::string& _name );\r
 +\r
 +      void ProcessXML();\r
 +};\r
 +\r
 +\r
 +class Invoke\r
 +{\r
 +public:\r
 +      const XMLElement& node;\r
 +      const Module& module;\r
 +      const Module* invokeModule;\r
 +      std::vector<InvokeFile*> input;\r
 +      std::vector<InvokeFile*> output;\r
 +\r
 +      Invoke ( const XMLElement& _node,\r
 +               const Module& _module );\r
 +\r
 +      void ProcessXML();\r
 +      void GetTargets ( string_list& targets ) const;\r
 +      std::string GetParameters () const;\r
 +private:\r
 +      void ProcessXMLSubElement ( const XMLElement& e );\r
 +      void ProcessXMLSubElementInput ( const XMLElement& e );\r
 +      void ProcessXMLSubElementOutput ( const XMLElement& e );\r
 +};\r
 +\r
 +\r
 +class InvokeFile\r
 +{\r
 +public:\r
 +      const XMLElement& node;\r
 +      std::string name;\r
 +      std::string switches;\r
 +\r
 +      InvokeFile ( const XMLElement& _node,\r
 +                   const std::string& _name );\r
 +\r
 +      void ProcessXML ();\r
 +};\r
 +\r
 +\r
 +class Dependency\r
 +{\r
 +public:\r
 +      const XMLElement& node;\r
 +      const Module& module;\r
 +      const Module* dependencyModule;\r
 +\r
 +      Dependency ( const XMLElement& _node,\r
 +                   const Module& _module );\r
 +\r
 +      void ProcessXML();\r
 +};\r
 +\r
 +\r
 +class ImportLibrary\r
 +{\r
 +public:\r
 +      const XMLElement& node;\r
 +      const Module& module;\r
 +      std::string basename;\r
 +      std::string definition;\r
 +\r
 +      ImportLibrary ( const XMLElement& _node,\r
 +                      const Module& module );\r
 +\r
 +      void ProcessXML ();\r
 +};\r
 +\r
 +\r
 +class If\r
 +{\r
 +public:\r
 +      const XMLElement& node;\r
 +      const Project& project;\r
 +      const Module* module;\r
 +      std::string property, value;\r
 +      IfableData data;\r
 +\r
 +      If ( const XMLElement& node_,\r
 +           const Project& project_,\r
 +           const Module* module_ );\r
 +      ~If();\r
 +\r
 +      void ProcessXML();\r
 +};\r
 +\r
 +\r
 +class CompilerFlag\r
 +{\r
 +public:\r
 +      const Project& project;\r
 +      const Module* module;\r
 +      const XMLElement& node;\r
 +      std::string flag;\r
 +\r
 +      CompilerFlag ( const Project& project,\r
 +                     const XMLElement& compilerFlagNode );\r
 +      CompilerFlag ( const Project& project,\r
 +                     const Module* module,\r
 +                     const XMLElement& compilerFlagNode );\r
 +      ~CompilerFlag ();\r
 +      void ProcessXML();\r
 +private:\r
 +      void Initialize();\r
 +};\r
 +\r
 +\r
 +class LinkerFlag\r
 +{\r
 +public:\r
 +      const Project& project;\r
 +      const Module* module;\r
 +      const XMLElement& node;\r
 +      std::string flag;\r
 +\r
 +      LinkerFlag ( const Project& project,\r
 +                   const XMLElement& linkerFlagNode );\r
 +      LinkerFlag ( const Project& project,\r
 +                   const Module* module,\r
 +                   const XMLElement& linkerFlagNode );\r
 +      ~LinkerFlag ();\r
 +      void ProcessXML();\r
 +private:\r
 +      void Initialize();\r
 +};\r
 +\r
 +\r
 +class Property\r
 +{\r
 +public:\r
 +      const XMLElement& node;\r
 +      const Project& project;\r
 +      const Module* module;\r
 +      std::string name, value;\r
 +\r
 +      Property ( const XMLElement& node_,\r
 +                 const Project& project_,\r
 +                 const Module* module_ );\r
 +\r
 +      void ProcessXML();\r
 +};\r
 +\r
 +\r
 +class SourceFile\r
 +{\r
 +public:\r
 +      SourceFile ( AutomaticDependency* automaticDependency,\r
 +                   Module& module,\r
 +                   const std::string& filename,\r
 +                   SourceFile* parent,\r
 +                   bool isNonAutomaticDependency );\r
 +      SourceFile* ParseFile ( const std::string& normalizedFilename );\r
 +      void Parse ();\r
 +      std::string Location () const;\r
 +      std::vector<SourceFile*> files;\r
 +      AutomaticDependency* automaticDependency;\r
 +      Module& module;\r
 +      std::string filename;\r
 +      std::string filenamePart;\r
 +      std::string directoryPart;\r
 +      std::vector<SourceFile*> parents; /* List of files, this file is included from */\r
 +      bool isNonAutomaticDependency;\r
 +      std::string cachedDependencies;\r
 +      time_t lastWriteTime;\r
 +      time_t youngestLastWriteTime; /* Youngest last write time of this file and all children */\r
 +      SourceFile* youngestFile;\r
 +private:\r
 +      void GetDirectoryAndFilenameParts ();\r
 +      void Close ();\r
 +      void Open ();\r
 +      void SkipWhitespace ();\r
 +      bool ReadInclude ( std::string& filename,\r
 +                         bool& includeNext );\r
 +      bool IsIncludedFrom ( const std::string& normalizedFilename );\r
 +      SourceFile* GetParentSourceFile ();\r
 +      bool CanProcessFile ( const std::string& extension );\r
 +      bool IsParentOf ( const SourceFile* parent,\r
 +                        const SourceFile* child );\r
 +      std::string buf;\r
 +      const char *p;\r
 +      const char *end;\r
 +};\r
 +\r
 +\r
 +class AutomaticDependency\r
 +{\r
 +      friend class SourceFileTest;\r
 +public:\r
 +      const Project& project;\r
 +\r
 +      AutomaticDependency ( const Project& project );\r
 +      ~AutomaticDependency ();\r
 +      void Process ();\r
 +      std::string GetFilename ( const std::string& filename );\r
 +      bool LocateIncludedFile ( const std::string& directory,\r
 +                                const std::string& includedFilename,\r
 +                                std::string& resolvedFilename );\r
 +      bool LocateIncludedFile ( SourceFile* sourceFile,\r
 +                                Module& module,\r
 +                                const std::string& includedFilename,\r
 +                                bool includeNext,\r
 +                                std::string& resolvedFilename );\r
 +      SourceFile* RetrieveFromCacheOrParse ( Module& module,\r
 +                                             const std::string& filename,\r
 +                                             SourceFile* parentSourceFile );\r
 +      SourceFile* RetrieveFromCache ( const std::string& filename );\r
 +      void CheckAutomaticDependencies ( bool verbose );\r
 +      void CheckAutomaticDependenciesForFile ( SourceFile* sourceFile );\r
 +private:\r
 +      void ProcessModule ( Module& module );\r
 +      void ProcessFile ( Module& module,\r
 +                         const File& file );\r
 +      std::map<std::string, SourceFile*> sourcefile_map;\r
 +};\r
 +\r
 +\r
 +class Bootstrap\r
 +{\r
 +public:\r
 +      const Project& project;\r
 +      const Module* module;\r
 +      const XMLElement& node;\r
 +      std::string base;\r
 +      std::string nameoncd;\r
 +\r
 +      Bootstrap ( const Project& project,\r
 +                  const Module* module,\r
 +                  const XMLElement& bootstrapNode );\r
 +      ~Bootstrap ();\r
 +      void ProcessXML();\r
 +private:\r
 +      bool IsSupportedModuleType ( ModuleType type );\r
 +      void Initialize();\r
 +};\r
 +\r
 +\r
 +class CDFile\r
 +{\r
 +public:\r
 +      const Project& project;\r
 +      const XMLElement& node;\r
 +      std::string name;\r
 +      std::string base;\r
 +      std::string nameoncd;\r
 +      std::string path;\r
 +\r
 +      CDFile ( const Project& project,\r
 +               const XMLElement& bootstrapNode,\r
 +               const std::string& path );\r
 +      ~CDFile ();\r
 +      void ProcessXML();\r
 +      std::string GetPath () const;\r
 +};\r
 +\r
 +\r
 +class InstallFile\r
 +{\r
 +public:\r
 +      const Project& project;\r
 +      const XMLElement& node;\r
 +      std::string name;\r
 +      std::string base;\r
 +      std::string newname;\r
 +      std::string path;\r
 +\r
 +      InstallFile ( const Project& project,\r
 +                    const XMLElement& bootstrapNode,\r
 +                    const std::string& path );\r
 +      ~InstallFile ();\r
 +      void ProcessXML ();\r
 +      std::string GetPath () const;\r
 +};\r
 +\r
 +\r
 +class PchFile\r
 +{\r
 +public:\r
 +      const XMLElement& node;\r
 +      const Module& module;\r
 +      std::string header;\r
 +\r
 +      PchFile (\r
 +              const XMLElement& node,\r
 +              const Module& module,\r
 +              const std::string& header );\r
 +      void ProcessXML();\r
 +};\r
 +\r
 +\r
 +class StubbedComponent\r
 +{\r
 +public:\r
 +      const Module* module;\r
 +      const XMLElement& node;\r
 +      std::string name;\r
 +      std::vector<StubbedSymbol*> symbols;\r
 +\r
 +      StubbedComponent ( const Module* module_,\r
 +                         const XMLElement& stubbedComponentNode );\r
 +      ~StubbedComponent ();\r
 +      void ProcessXML ();\r
 +      void ProcessXMLSubElement ( const XMLElement& e );\r
 +};\r
 +\r
 +\r
 +class StubbedSymbol\r
 +{\r
 +public:\r
 +      const XMLElement& node;\r
 +      std::string symbol;\r
 +      std::string newname;\r
 +\r
 +      StubbedSymbol ( const XMLElement& stubbedSymbolNode );\r
 +      ~StubbedSymbol ();\r
 +      void ProcessXML();\r
 +};\r
 +\r
 +extern std::string\r
 +FixSeparator ( const std::string& s );\r
 +\r
 +extern std::string\r
 +ReplaceExtension (\r
 +      const std::string& filename,\r
 +      const std::string& newExtension );\r
 +\r
 +extern std::string\r
 +GetSubPath (\r
 +      const std::string& location,\r
 +      const std::string& path,\r
 +      const std::string& att_value );\r
 +\r
 +extern std::string\r
 +GetExtension ( const std::string& filename );\r
 +\r
 +extern std::string\r
 +GetDirectory ( const std::string& filename );\r
 +\r
 +extern std::string\r
 +NormalizeFilename ( const std::string& filename );\r
 +\r
 +#endif /* __RBUILD_H */\r
Simple merge
Simple merge
@@@ -521,139 -369,25 +521,139 @@@ typedef union YYSTYPE 
        style_pair_t    *styles;
        style_t         *style;
        ani_any_t       *ani;
 -} yystype;
 -# define YYSTYPE yystype
 +} YYSTYPE;
 +/* Line 191 of yacc.c.  */
 +#line 527 "y.tab.c"
 +# define yystype YYSTYPE /* obsolescent; will be withdrawn */
 +# define YYSTYPE_IS_DECLARED 1
  # define YYSTYPE_IS_TRIVIAL 1
  #endif
 -#ifndef YYDEBUG
 -# define YYDEBUG 1
 +
 +
 +
 +/* Copy the second part of user declarations.  */
 +
 +
 +/* Line 214 of yacc.c.  */
 +#line 539 "y.tab.c"
 +
 +#if ! defined (yyoverflow) || YYERROR_VERBOSE
 +
 +/* The parser invokes alloca or malloc; define the necessary symbols.  */
 +
 +# if YYSTACK_USE_ALLOCA
 +#  define YYSTACK_ALLOC alloca
 +# else
 +#  ifndef YYSTACK_USE_ALLOCA
 +#   if defined (alloca) || defined (_ALLOCA_H)
 +#    define YYSTACK_ALLOC alloca
 +#   else
 +#    ifdef __GNUC__
 +#     define YYSTACK_ALLOC __builtin_alloca
 +#    endif
 +#   endif
 +#  endif
 +# endif
 +
 +# ifdef YYSTACK_ALLOC
 +   /* Pacify GCC's `empty if-body' warning. */
 +#  define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
 +# else
 +#  if defined (__STDC__) || defined (__cplusplus)
 +#   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
 +#   define YYSIZE_T size_t
 +#  endif
 +#  define YYSTACK_ALLOC malloc
 +#  define YYSTACK_FREE free
 +# endif
 +#endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */
 +
 +
 +#if (! defined (yyoverflow) \
 +     && (! defined (__cplusplus) \
 +       || (YYSTYPE_IS_TRIVIAL)))
 +
 +/* A type that is properly aligned for any stack member.  */
 +union yyalloc
 +{
 +  short yyss;
 +  YYSTYPE yyvs;
 +  };
 +
 +/* The size of the maximum gap between one aligned stack and the next.  */
 +# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
 +
 +/* The size of an array large to enough to hold all stacks, each with
 +   N elements.  */
 +# define YYSTACK_BYTES(N) \
 +     ((N) * (sizeof (short) + sizeof (YYSTYPE))                               \
 +      + YYSTACK_GAP_MAXIMUM)
 +
 +/* Copy COUNT objects from FROM to TO.  The source and destination do
 +   not overlap.  */
 +# ifndef YYCOPY
 +#  if 1 < __GNUC__
 +#   define YYCOPY(To, From, Count) \
 +      __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
 +#  else
 +#   define YYCOPY(To, From, Count)            \
 +      do                                      \
 +      {                                       \
 +        register YYSIZE_T yyi;                \
 +        for (yyi = 0; yyi < (Count); yyi++)   \
 +          (To)[yyi] = (From)[yyi];            \
 +      }                                       \
 +      while (0)
 +#  endif
 +# endif
 +
 +/* Relocate STACK from its old location to the new one.  The
 +   local variables YYSIZE and YYSTACKSIZE give the old and new number of
 +   elements in the stack, and YYPTR gives the new location of the
 +   stack.  Advance YYPTR to a properly aligned location for the next
 +   stack.  */
 +# define YYSTACK_RELOCATE(Stack)                                      \
 +    do                                                                        \
 +      {                                                                       \
 +      YYSIZE_T yynewbytes;                                            \
 +      YYCOPY (&yyptr->Stack, Stack, yysize);                          \
 +      Stack = &yyptr->Stack;                                          \
 +      yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
 +      yyptr += yynewbytes / sizeof (*yyptr);                          \
 +      }                                                                       \
 +    while (0)
 +
 +#endif
 +
 +#if defined (__STDC__) || defined (__cplusplus)
 +   typedef signed char yysigned_char;
 +#else
 +   typedef short yysigned_char;
  #endif
  
- #define YYLAST   696
 +/* YYFINAL -- State number of the termination state. */
 +#define YYFINAL  3
 +/* YYLAST -- Last index in YYTABLE.  */
++#define YYLAST   669
  
 +/* YYNTOKENS -- Number of terminals. */
 +#define YYNTOKENS  96
 +/* YYNNTS -- Number of nonterminals. */
 +#define YYNNTS  82
 +/* YYNRULES -- Number of rules. */
 +#define YYNRULES  256
 +/* YYNRULES -- Number of states. */
 +#define YYNSTATES  570
  
 -#define       YYFINAL         568
 -#define       YYFLAG          -32768
 -#define       YYNTBASE        96
 +/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX.  */
 +#define YYUNDEFTOK  2
 +#define YYMAXUTOK   339
  
 -/* YYTRANSLATE(YYLEX) -- Bison token number corresponding to YYLEX. */
 -#define YYTRANSLATE(x) ((unsigned)(x) <= 338 ? yytranslate[x] : 177)
 +#define YYTRANSLATE(YYX)                                              \
 +  ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
  
 -/* YYTRANSLATE[YYLEX] -- Bison token number corresponding to YYLEX. */
 -static const char yytranslate[] =
 +/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX.  */
 +static const unsigned char yytranslate[] =
  {
         0,     2,     2,     2,     2,     2,     2,     2,     2,     2,
         2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  };
  
  #if YYDEBUG
 -static const short yyprhs[] =
 -{
 -       0,     0,     2,     3,     6,     9,    13,    17,    19,    20,
 -      26,    27,    29,    31,    33,    35,    37,    39,    41,    43,
 -      45,    47,    49,    51,    53,    55,    57,    59,    61,    63,
 -      65,    67,    69,    71,    73,    77,    81,    85,    89,    93,
 -      97,   101,   105,   109,   111,   113,   120,   121,   127,   133,
 -     134,   137,   139,   143,   145,   147,   149,   151,   153,   155,
 -     169,   170,   174,   178,   182,   185,   189,   193,   196,   199,
 -     202,   203,   207,   211,   215,   219,   223,   227,   231,   235,
 -     239,   243,   247,   251,   255,   259,   263,   267,   271,   282,
 -     295,   306,   307,   312,   319,   328,   346,   362,   367,   368,
 -     371,   376,   380,   384,   386,   389,   391,   393,   408,   409,
 -     413,   417,   421,   424,   427,   431,   435,   438,   441,   444,
 -     445,   449,   453,   457,   461,   465,   469,   473,   477,   481,
 -     485,   489,   493,   497,   501,   505,   509,   513,   524,   544,
 -     561,   576,   589,   590,   592,   593,   596,   606,   607,   610,
 -     615,   619,   620,   627,   631,   637,   638,   642,   646,   650,
 -     654,   658,   662,   667,   671,   672,   677,   681,   687,   688,
 -     691,   697,   704,   705,   708,   713,   720,   729,   734,   738,
 -     739,   744,   745,   747,   754,   755,   765,   775,   779,   783,
 -     787,   791,   795,   796,   799,   805,   806,   809,   811,   816,
 -     821,   823,   827,   837,   838,   842,   845,   846,   849,   852,
 -     854,   856,   858,   860,   862,   864,   866,   867,   870,   873,
 -     876,   881,   884,   887,   892,   894,   896,   899,   901,   904,
 -     906,   910,   914,   919,   923,   928,   932,   934,   936,   937,
 -     939,   941,   945,   949,   953,   957,   961,   965,   969,   972,
 -     975,   978,   982,   984,   987,   989
 +/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
 +   YYRHS.  */
 +static const unsigned short yyprhs[] =
 +{
 +       0,     0,     3,     5,     6,     9,    12,    16,    20,    22,
 +      23,    29,    30,    32,    34,    36,    38,    40,    42,    44,
 +      46,    48,    50,    52,    54,    56,    58,    60,    62,    64,
 +      66,    68,    70,    72,    74,    76,    80,    84,    88,    92,
 +      96,   100,   104,   108,   112,   114,   116,   123,   124,   130,
 +     136,   137,   140,   142,   146,   148,   150,   152,   154,   156,
 +     158,   172,   173,   177,   181,   185,   188,   192,   196,   199,
 +     202,   205,   206,   210,   214,   218,   222,   226,   230,   234,
 +     238,   242,   246,   250,   254,   258,   262,   266,   270,   274,
 +     285,   298,   309,   310,   315,   322,   331,   349,   365,   370,
 +     371,   374,   379,   383,   387,   389,   392,   394,   396,   411,
 +     412,   416,   420,   424,   427,   430,   434,   438,   441,   444,
 +     447,   448,   452,   456,   460,   464,   468,   472,   476,   480,
 +     484,   488,   492,   496,   500,   504,   508,   512,   516,   527,
 +     547,   564,   579,   592,   593,   595,   596,   599,   609,   610,
 +     613,   618,   622,   623,   630,   634,   640,   641,   645,   649,
 +     653,   657,   661,   665,   670,   674,   675,   680,   684,   690,
 +     691,   694,   700,   707,   708,   711,   716,   723,   732,   737,
 +     741,   742,   747,   748,   750,   757,   758,   768,   778,   782,
 +     786,   790,   794,   798,   799,   802,   808,   809,   812,   814,
 +     819,   824,   826,   830,   840,   841,   845,   848,   849,   852,
 +     855,   857,   859,   861,   863,   865,   867,   869,   870,   873,
 +     876,   879,   884,   887,   890,   895,   897,   899,   902,   904,
 +     907,   909,   913,   917,   922,   926,   931,   935,   937,   939,
 +     940,   942,   944,   948,   952,   956,   960,   964,   968,   972,
 +     975,   978,   981,   985,   987,   990,   992
  };
 +
 +/* YYRHS -- A `-1'-separated list of the rules' RHS. */
  static const short yyrhs[] =
  {
 -      97,     0,     0,    97,    98,     0,    97,     3,     0,   174,
 -     100,   103,     0,     7,   100,   103,     0,   150,     0,     0,
 -      64,    99,   174,    93,   174,     0,     0,   174,     0,     7,
 -       0,   101,     0,     6,     0,   115,     0,   105,     0,   106,
 -       0,   120,     0,   131,     0,   112,     0,   108,     0,   109,
 -       0,   107,     0,   141,     0,   145,     0,   110,     0,   111,
 -       0,   161,     0,   113,     0,   154,     0,     8,     0,     7,
 -       0,     6,     0,    11,   163,   172,     0,    12,   163,   172,
 -       0,    23,   163,   172,     0,    21,   163,   172,     0,    22,
 -     163,   172,     0,    17,   163,   172,     0,    18,   163,   172,
 -       0,    82,   163,   172,     0,   114,   163,   172,     0,     4,
 -       0,     7,     0,    10,   163,   166,    80,   116,    81,     0,
 -       0,   116,     6,    93,   174,   117,     0,   116,   174,    93,
 -     174,   117,     0,     0,    93,   118,     0,   119,     0,   118,
 -      93,   119,     0,    50,     0,    43,     0,    36,     0,    44,
 -       0,    45,     0,    46,     0,    13,   163,   174,    93,   174,
 -      93,   174,    93,   174,   121,    80,   122,    81,     0,     0,
 -     121,    62,   129,     0,   121,    61,   129,     0,   121,    59,
 -       6,     0,   121,   127,     0,   121,    58,   102,     0,   121,
 -      15,   101,     0,   121,   167,     0,   121,   168,     0,   121,
 -     169,     0,     0,   122,    36,   126,     0,   122,    37,   124,
 -       0,   122,    34,   124,     0,   122,    33,   124,     0,   122,
 -      35,   124,     0,   122,    27,   123,     0,   122,    28,   123,
 -       0,   122,    32,   123,     0,   122,    29,   123,     0,   122,
 -      30,   123,     0,   122,    24,   123,     0,   122,    31,   123,
 -       0,   122,    25,   123,     0,   122,    26,   123,     0,   122,
 -      40,   123,     0,   122,    39,   123,     0,   122,    38,   123,
 -       0,   122,    23,   102,   153,   174,    93,   174,    93,   174,
 -     125,     0,     6,   153,   174,    93,   174,    93,   174,    93,
 -     174,    93,   174,   128,     0,   174,    93,   174,    93,   174,
 -      93,   174,    93,   174,   128,     0,     0,    93,   174,    93,
 -     174,     0,    93,   174,    93,   174,    93,   129,     0,    93,
 -     174,    93,   174,    93,   129,    93,   129,     0,   102,   153,
 -     174,    93,   130,    93,   129,    93,   174,    93,   174,    93,
 -     174,    93,   174,    93,   129,     0,   102,   153,   174,    93,
 -     130,    93,   129,    93,   174,    93,   174,    93,   174,    93,
 -     174,     0,    21,   174,    93,     6,     0,     0,    93,   129,
 -       0,    93,   129,    93,   129,     0,   129,    83,   129,     0,
 -      94,   129,    95,     0,   176,     0,    91,   176,     0,   174,
 -       0,     6,     0,    14,   163,   174,    93,   174,    93,   174,
 -      93,   174,   138,   132,    80,   133,    81,     0,     0,   132,
 -      62,   129,     0,   132,    61,   129,     0,   132,    59,     6,
 -       0,   132,   127,     0,   132,   139,     0,   132,    58,   102,
 -       0,   132,    15,   101,     0,   132,   167,     0,   132,   168,
 -       0,   132,   169,     0,     0,   133,    36,   134,     0,   133,
 -      37,   136,     0,   133,    34,   136,     0,   133,    33,   136,
 -       0,   133,    35,   136,     0,   133,    27,   135,     0,   133,
 -      28,   135,     0,   133,    32,   135,     0,   133,    29,   135,
 -       0,   133,    30,   135,     0,   133,    24,   135,     0,   133,
 -      31,   135,     0,   133,    25,   135,     0,   133,    26,   135,
 -       0,   133,    40,   135,     0,   133,    39,   135,     0,   133,
 -      38,   135,     0,   133,    23,   102,   153,   174,    93,   174,
 -      93,   174,   125,     0,   102,   153,   174,    93,   130,    93,
 -     129,    93,   174,    93,   174,    93,   174,    93,   174,    93,
 -     129,   138,   137,     0,   102,   153,   174,    93,   130,    93,
 -     129,    93,   174,    93,   174,    93,   174,    93,   174,   137,
 -       0,     6,   153,   174,    93,   174,    93,   174,    93,   174,
 -      93,   174,   128,   138,   137,     0,   174,    93,   174,    93,
 -     174,    93,   174,    93,   174,   128,   138,   137,     0,     0,
 -     170,     0,     0,    93,   174,     0,    21,   174,    93,     6,
 -      93,   174,    93,   174,   140,     0,     0,    93,   174,     0,
 -      15,   163,   166,   142,     0,    80,   143,    81,     0,     0,
 -     143,    74,     6,   153,   174,   144,     0,   143,    74,    76,
 -       0,   143,    75,     6,   144,   142,     0,     0,   153,    48,
 -     144,     0,   153,    47,   144,     0,   153,    77,   144,     0,
 -     153,    49,   144,     0,   153,    72,   144,     0,   153,    73,
 -     144,     0,    16,   163,   166,   146,     0,    80,   147,    81,
 -       0,     0,   147,    74,     6,   148,     0,   147,    74,    76,
 -       0,   147,    75,     6,   149,   146,     0,     0,    93,   174,
 -       0,    93,   173,    93,   173,   144,     0,    93,   173,    93,
 -     173,    93,   174,     0,     0,    93,   174,     0,    93,   173,
 -      93,   174,     0,    93,   173,    93,   173,    93,   174,     0,
 -      93,   173,    93,   173,    93,   173,    93,   174,     0,   151,
 -      80,   152,    81,     0,    20,   163,   166,     0,     0,   152,
 -     174,   153,     6,     0,     0,    93,     0,    19,   163,   155,
 -      80,   156,    81,     0,     0,   155,    65,   174,    93,   174,
 -      93,   174,    93,   174,     0,   155,    66,   174,    93,   174,
 -      93,   174,    93,   174,     0,   155,    70,   174,     0,   155,
 -      67,   174,     0,   155,    68,   174,     0,   155,    69,   174,
 -       0,   155,    71,   174,     0,     0,   156,   157,     0,    41,
 -       6,    80,   158,    81,     0,     0,   158,   159,     0,   157,
 -       0,    42,     6,    93,     6,     0,    42,     6,    93,   160,
 -       0,   174,     0,   160,    93,   174,     0,    78,   163,   174,
 -      93,   174,   166,    80,   162,    81,     0,     0,   162,    79,
 -     174,     0,   162,    76,     0,     0,   163,   164,     0,   163,
 -     165,     0,    55,     0,    57,     0,    53,     0,    51,     0,
 -      54,     0,    56,     0,    52,     0,     0,   166,   167,     0,
 -     166,   168,     0,   166,   169,     0,    64,   174,    93,   174,
 -       0,    60,   174,     0,    63,   174,     0,   166,    80,   171,
 -      81,     0,     9,     0,     4,     0,    87,     4,     0,     5,
 -       0,    87,     5,     0,     6,     0,   171,   153,     9,     0,
 -     171,   153,     4,     0,   171,   153,    87,     4,     0,   171,
 -     153,     5,     0,   171,   153,    87,     5,     0,   171,   153,
 -       6,     0,   104,     0,   170,     0,     0,   174,     0,   175,
 -       0,   175,    86,   175,     0,   175,    87,   175,     0,   175,
 -      83,   175,     0,   175,    85,   175,     0,   175,    88,   175,
 -       0,   175,    89,   175,     0,   175,    84,   175,     0,    90,
 -     175,     0,    87,   175,     0,    86,   175,     0,    94,   175,
 -      95,     0,   176,     0,    91,   176,     0,     4,     0,     5,
 -       0
 +      97,     0,    -1,    98,    -1,    -1,    98,    99,    -1,    98,
 +       3,    -1,   175,   101,   104,    -1,     7,   101,   104,    -1,
 +     151,    -1,    -1,    64,   100,   175,    93,   175,    -1,    -1,
 +     175,    -1,     7,    -1,   102,    -1,     6,    -1,   116,    -1,
 +     106,    -1,   107,    -1,   121,    -1,   132,    -1,   113,    -1,
 +     109,    -1,   110,    -1,   108,    -1,   142,    -1,   146,    -1,
 +     111,    -1,   112,    -1,   162,    -1,   114,    -1,   155,    -1,
 +       8,    -1,     7,    -1,     6,    -1,    11,   164,   173,    -1,
 +      12,   164,   173,    -1,    23,   164,   173,    -1,    21,   164,
 +     173,    -1,    22,   164,   173,    -1,    17,   164,   173,    -1,
 +      18,   164,   173,    -1,    82,   164,   173,    -1,   115,   164,
 +     173,    -1,     4,    -1,     7,    -1,    10,   164,   167,    80,
 +     117,    81,    -1,    -1,   117,     6,    93,   175,   118,    -1,
 +     117,   175,    93,   175,   118,    -1,    -1,    93,   119,    -1,
 +     120,    -1,   119,    93,   120,    -1,    50,    -1,    43,    -1,
 +      36,    -1,    44,    -1,    45,    -1,    46,    -1,    13,   164,
 +     175,    93,   175,    93,   175,    93,   175,   122,    80,   123,
 +      81,    -1,    -1,   122,    62,   130,    -1,   122,    61,   130,
 +      -1,   122,    59,     6,    -1,   122,   128,    -1,   122,    58,
 +     103,    -1,   122,    15,   102,    -1,   122,   168,    -1,   122,
 +     169,    -1,   122,   170,    -1,    -1,   123,    36,   127,    -1,
 +     123,    37,   125,    -1,   123,    34,   125,    -1,   123,    33,
 +     125,    -1,   123,    35,   125,    -1,   123,    27,   124,    -1,
 +     123,    28,   124,    -1,   123,    32,   124,    -1,   123,    29,
 +     124,    -1,   123,    30,   124,    -1,   123,    24,   124,    -1,
 +     123,    31,   124,    -1,   123,    25,   124,    -1,   123,    26,
 +     124,    -1,   123,    40,   124,    -1,   123,    39,   124,    -1,
 +     123,    38,   124,    -1,   123,    23,   103,   154,   175,    93,
 +     175,    93,   175,   126,    -1,     6,   154,   175,    93,   175,
 +      93,   175,    93,   175,    93,   175,   129,    -1,   175,    93,
 +     175,    93,   175,    93,   175,    93,   175,   129,    -1,    -1,
 +      93,   175,    93,   175,    -1,    93,   175,    93,   175,    93,
 +     130,    -1,    93,   175,    93,   175,    93,   130,    93,   130,
 +      -1,   103,   154,   175,    93,   131,    93,   130,    93,   175,
 +      93,   175,    93,   175,    93,   175,    93,   130,    -1,   103,
 +     154,   175,    93,   131,    93,   130,    93,   175,    93,   175,
 +      93,   175,    93,   175,    -1,    21,   175,    93,     6,    -1,
 +      -1,    93,   130,    -1,    93,   130,    93,   130,    -1,   130,
 +      83,   130,    -1,    94,   130,    95,    -1,   176,    -1,    91,
 +     176,    -1,   175,    -1,     6,    -1,    14,   164,   175,    93,
 +     175,    93,   175,    93,   175,   139,   133,    80,   134,    81,
 +      -1,    -1,   133,    62,   130,    -1,   133,    61,   130,    -1,
 +     133,    59,     6,    -1,   133,   128,    -1,   133,   140,    -1,
 +     133,    58,   103,    -1,   133,    15,   102,    -1,   133,   168,
 +      -1,   133,   169,    -1,   133,   170,    -1,    -1,   134,    36,
 +     135,    -1,   134,    37,   137,    -1,   134,    34,   137,    -1,
 +     134,    33,   137,    -1,   134,    35,   137,    -1,   134,    27,
 +     136,    -1,   134,    28,   136,    -1,   134,    32,   136,    -1,
 +     134,    29,   136,    -1,   134,    30,   136,    -1,   134,    24,
 +     136,    -1,   134,    31,   136,    -1,   134,    25,   136,    -1,
 +     134,    26,   136,    -1,   134,    40,   136,    -1,   134,    39,
 +     136,    -1,   134,    38,   136,    -1,   134,    23,   103,   154,
 +     175,    93,   175,    93,   175,   126,    -1,   103,   154,   175,
 +      93,   131,    93,   130,    93,   175,    93,   175,    93,   175,
 +      93,   175,    93,   130,   139,   138,    -1,   103,   154,   175,
 +      93,   131,    93,   130,    93,   175,    93,   175,    93,   175,
 +      93,   175,   138,    -1,     6,   154,   175,    93,   175,    93,
 +     175,    93,   175,    93,   175,   129,   139,   138,    -1,   175,
 +      93,   175,    93,   175,    93,   175,    93,   175,   129,   139,
 +     138,    -1,    -1,   171,    -1,    -1,    93,   175,    -1,    21,
 +     175,    93,     6,    93,   175,    93,   175,   141,    -1,    -1,
 +      93,   175,    -1,    15,   164,   167,   143,    -1,    80,   144,
 +      81,    -1,    -1,   144,    74,     6,   154,   175,   145,    -1,
 +     144,    74,    76,    -1,   144,    75,     6,   145,   143,    -1,
-       -1,    93,    48,   145,    -1,    93,    47,   145,    -1,    93,
-       77,   145,    -1,    93,    49,   145,    -1,    93,    72,   145,
-       -1,    93,    73,   145,    -1,    16,   164,   167,   147,    -1,
++      -1,   154,    48,   145,    -1,   154,    47,   145,    -1,   154,
++      77,   145,    -1,   154,    49,   145,    -1,   154,    72,   145,
++      -1,   154,    73,   145,    -1,    16,   164,   167,   147,    -1,
 +      80,   148,    81,    -1,    -1,   148,    74,     6,   149,    -1,
 +     148,    74,    76,    -1,   148,    75,     6,   150,   147,    -1,
 +      -1,    93,   175,    -1,    93,   174,    93,   174,   145,    -1,
 +      93,   174,    93,   174,    93,   175,    -1,    -1,    93,   175,
 +      -1,    93,   174,    93,   175,    -1,    93,   174,    93,   174,
 +      93,   175,    -1,    93,   174,    93,   174,    93,   174,    93,
 +     175,    -1,   152,    80,   153,    81,    -1,    20,   164,   167,
 +      -1,    -1,   153,   175,   154,     6,    -1,    -1,    93,    -1,
 +      19,   164,   156,    80,   157,    81,    -1,    -1,   156,    65,
 +     175,    93,   175,    93,   175,    93,   175,    -1,   156,    66,
 +     175,    93,   175,    93,   175,    93,   175,    -1,   156,    70,
 +     175,    -1,   156,    67,   175,    -1,   156,    68,   175,    -1,
 +     156,    69,   175,    -1,   156,    71,   175,    -1,    -1,   157,
 +     158,    -1,    41,     6,    80,   159,    81,    -1,    -1,   159,
 +     160,    -1,   158,    -1,    42,     6,    93,     6,    -1,    42,
 +       6,    93,   161,    -1,   175,    -1,   161,    93,   175,    -1,
 +      78,   164,   175,    93,   175,   167,    80,   163,    81,    -1,
 +      -1,   163,    79,   175,    -1,   163,    76,    -1,    -1,   164,
 +     165,    -1,   164,   166,    -1,    55,    -1,    57,    -1,    53,
 +      -1,    51,    -1,    54,    -1,    56,    -1,    52,    -1,    -1,
 +     167,   168,    -1,   167,   169,    -1,   167,   170,    -1,    64,
 +     175,    93,   175,    -1,    60,   175,    -1,    63,   175,    -1,
 +     167,    80,   172,    81,    -1,     9,    -1,     4,    -1,    87,
 +       4,    -1,     5,    -1,    87,     5,    -1,     6,    -1,   172,
 +     154,     9,    -1,   172,   154,     4,    -1,   172,   154,    87,
 +       4,    -1,   172,   154,     5,    -1,   172,   154,    87,     5,
 +      -1,   172,   154,     6,    -1,   105,    -1,   171,    -1,    -1,
 +     175,    -1,   176,    -1,   176,    86,   176,    -1,   176,    87,
 +     176,    -1,   176,    83,   176,    -1,   176,    85,   176,    -1,
 +     176,    88,   176,    -1,   176,    89,   176,    -1,   176,    84,
 +     176,    -1,    90,   176,    -1,    87,   176,    -1,    86,   176,
 +      -1,    94,   176,    95,    -1,   177,    -1,    91,   177,    -1,
 +       4,    -1,     5,    -1
  };
  
 -#endif
 -
 -#if YYDEBUG
 -/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
 -static const short yyrline[] =
 -{
 -       0,   361,   395,   396,   466,   472,   484,   494,   502,   502,
 -     546,   552,   559,   569,   570,   579,   580,   581,   605,   606,
 -     612,   613,   614,   615,   639,   640,   646,   647,   648,   649,
 -     650,   654,   655,   656,   660,   664,   680,   702,   712,   720,
 -     728,   732,   736,   747,   752,   761,   785,   786,   787,   796,
 -     797,   800,   801,   804,   805,   806,   807,   808,   809,   814,
 -     849,   850,   851,   852,   853,   854,   855,   856,   857,   858,
 -     861,   862,   863,   864,   865,   866,   867,   868,   869,   870,
 -     872,   873,   874,   875,   876,   877,   878,   879,   881,   891,
 -     916,   937,   940,   945,   952,   963,   977,   992,   997,   998,
 -     999,  1003,  1004,  1005,  1006,  1010,  1015,  1023,  1067,  1068,
 -    1069,  1070,  1071,  1072,  1073,  1074,  1075,  1076,  1077,  1080,
 -    1081,  1082,  1083,  1084,  1085,  1086,  1087,  1088,  1089,  1091,
 -    1092,  1093,  1094,  1095,  1096,  1097,  1098,  1100,  1110,  1135,
 -    1151,  1179,  1202,  1203,  1206,  1207,  1211,  1218,  1219,  1223,
 -    1246,  1250,  1251,  1260,  1266,  1285,  1286,  1287,  1288,  1289,
 -    1290,  1291,  1295,  1320,  1324,  1325,  1341,  1347,  1367,  1368,
 -    1372,  1380,  1391,  1392,  1396,  1402,  1410,  1430,  1471,  1482,
 -    1483,  1517,  1518,  1523,  1539,  1540,  1550,  1560,  1567,  1574,
 -    1581,  1588,  1598,  1599,  1608,  1616,  1617,  1626,  1631,  1637,
 -    1646,  1647,  1651,  1677,  1678,  1683,  1692,  1693,  1703,  1718,
 -    1719,  1720,  1721,  1724,  1725,  1726,  1730,  1731,  1739,  1747,
 -    1765,  1772,  1776,  1780,  1795,  1796,  1797,  1798,  1799,  1800,
 -    1801,  1802,  1803,  1804,  1805,  1806,  1810,  1811,  1818,  1819,
 -    1823,  1826,  1827,  1828,  1829,  1830,  1831,  1832,  1833,  1834,
 -    1835,  1836,  1837,  1838,  1841,  1842
 +/* YYRLINE[YYN] -- source line where rule number YYN was defined.  */
 +static const unsigned short yyrline[] =
 +{
 +       0,   361,   361,   395,   396,   466,   472,   484,   494,   502,
 +     502,   546,   552,   559,   569,   570,   579,   580,   581,   605,
 +     606,   612,   613,   614,   615,   639,   640,   646,   647,   648,
 +     649,   650,   654,   655,   656,   660,   664,   680,   702,   712,
 +     720,   728,   732,   736,   747,   752,   761,   785,   786,   787,
 +     796,   797,   800,   801,   804,   805,   806,   807,   808,   809,
 +     814,   849,   850,   851,   852,   853,   854,   855,   856,   857,
 +     858,   861,   862,   863,   864,   865,   866,   867,   868,   869,
 +     870,   872,   873,   874,   875,   876,   877,   878,   879,   881,
 +     891,   916,   938,   940,   945,   952,   963,   977,   992,   997,
 +     998,   999,  1003,  1004,  1005,  1006,  1010,  1015,  1023,  1067,
 +    1068,  1069,  1070,  1071,  1072,  1073,  1074,  1075,  1076,  1077,
 +    1080,  1081,  1082,  1083,  1084,  1085,  1086,  1087,  1088,  1089,
 +    1091,  1092,  1093,  1094,  1095,  1096,  1097,  1098,  1100,  1110,
 +    1135,  1151,  1179,  1202,  1203,  1206,  1207,  1211,  1218,  1219,
 +    1223,  1246,  1250,  1251,  1260,  1266,  1285,  1286,  1287,  1288,
 +    1289,  1290,  1291,  1295,  1320,  1324,  1325,  1341,  1347,  1367,
 +    1368,  1372,  1380,  1391,  1392,  1396,  1402,  1410,  1430,  1471,
 +    1482,  1483,  1516,  1518,  1523,  1539,  1540,  1550,  1560,  1567,
 +    1574,  1581,  1588,  1598,  1599,  1608,  1616,  1617,  1626,  1631,
 +    1637,  1646,  1647,  1651,  1677,  1678,  1683,  1692,  1693,  1703,
 +    1718,  1719,  1720,  1721,  1724,  1725,  1726,  1730,  1731,  1739,
 +    1747,  1765,  1772,  1776,  1780,  1795,  1796,  1797,  1798,  1799,
 +    1800,  1801,  1802,  1803,  1804,  1805,  1806,  1810,  1811,  1818,
 +    1819,  1823,  1826,  1827,  1828,  1829,  1830,  1831,  1832,  1833,
 +    1834,  1835,  1836,  1837,  1838,  1841,  1842
  };
  #endif
  
@@@ -901,458 -635,502 +901,452 @@@ static const char *const yytname[] 
  };
  #endif
  
 -/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
 -static const short yyr1[] =
 -{
 -       0,    96,    97,    97,    97,    98,    98,    98,    99,    98,
 -     100,   101,   101,   102,   102,   103,   103,   103,   103,   103,
 -     103,   103,   103,   103,   103,   103,   103,   103,   103,   103,
 -     103,   104,   104,   104,   105,   106,   107,   108,   109,   110,
 -     111,   112,   113,   114,   114,   115,   116,   116,   116,   117,
 -     117,   118,   118,   119,   119,   119,   119,   119,   119,   120,
 -     121,   121,   121,   121,   121,   121,   121,   121,   121,   121,
 -     122,   122,   122,   122,   122,   122,   122,   122,   122,   122,
 -     122,   122,   122,   122,   122,   122,   122,   122,   122,   123,
 -     124,   125,   125,   125,   125,   126,   126,   127,   128,   128,
 -     128,   129,   129,   129,   129,   130,   130,   131,   132,   132,
 -     132,   132,   132,   132,   132,   132,   132,   132,   132,   133,
 +# ifdef YYPRINT
 +/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
 +   token YYLEX-NUM.  */
 +static const unsigned short yytoknum[] =
 +{
 +       0,   256,   257,   258,   259,   260,   261,   262,   263,   264,
 +     265,   266,   267,   268,   269,   270,   271,   272,   273,   274,
 +     275,   276,   277,   278,   279,   280,   281,   282,   283,   284,
 +     285,   286,   287,   288,   289,   290,   291,   292,   293,   294,
 +     295,   296,   297,   298,   299,   300,   301,   302,   303,   304,
 +     305,   306,   307,   308,   309,   310,   311,   312,   313,   314,
 +     315,   316,   317,   318,   319,   320,   321,   322,   323,   324,
 +     325,   326,   327,   328,   329,   330,   331,   332,   333,   334,
 +     335,   336,   337,   124,    94,    38,    43,    45,    42,    47,
 +     126,   338,   339,    44,    40,    41
 +};
 +# endif
 +
 +/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
 +static const unsigned char yyr1[] =
 +{
 +       0,    96,    97,    98,    98,    98,    99,    99,    99,   100,
 +      99,   101,   102,   102,   103,   103,   104,   104,   104,   104,
 +     104,   104,   104,   104,   104,   104,   104,   104,   104,   104,
 +     104,   104,   105,   105,   105,   106,   107,   108,   109,   110,
 +     111,   112,   113,   114,   115,   115,   116,   117,   117,   117,
 +     118,   118,   119,   119,   120,   120,   120,   120,   120,   120,
 +     121,   122,   122,   122,   122,   122,   122,   122,   122,   122,
 +     122,   123,   123,   123,   123,   123,   123,   123,   123,   123,
 +     123,   123,   123,   123,   123,   123,   123,   123,   123,   123,
 +     124,   125,   126,   126,   126,   126,   127,   127,   128,   129,
 +     129,   129,   130,   130,   130,   130,   131,   131,   132,   133,
       133,   133,   133,   133,   133,   133,   133,   133,   133,   133,
 -     133,   133,   133,   133,   133,   133,   133,   133,   134,   134,
 -     135,   136,   137,   137,   138,   138,   139,   140,   140,   141,
 -     142,   143,   143,   143,   143,   144,   144,   144,   144,   144,
 -     144,   144,   145,   146,   147,   147,   147,   147,   148,   148,
 -     148,   148,   149,   149,   149,   149,   149,   150,   151,   152,
 -     152,   153,   153,   154,   155,   155,   155,   155,   155,   155,
 -     155,   155,   156,   156,   157,   158,   158,   159,   159,   159,
 -     160,   160,   161,   162,   162,   162,   163,   163,   163,   164,
 -     164,   164,   164,   165,   165,   165,   166,   166,   166,   166,
 -     167,   168,   169,   170,   171,   171,   171,   171,   171,   171,
 -     171,   171,   171,   171,   171,   171,   172,   172,   173,   173,
 -     174,   175,   175,   175,   175,   175,   175,   175,   175,   175,
 -     175,   175,   175,   175,   176,   176
 +     134,   134,   134,   134,   134,   134,   134,   134,   134,   134,
 +     134,   134,   134,   134,   134,   134,   134,   134,   134,   135,
 +     135,   136,   137,   138,   138,   139,   139,   140,   141,   141,
 +     142,   143,   144,   144,   144,   144,   145,   145,   145,   145,
 +     145,   145,   145,   146,   147,   148,   148,   148,   148,   149,
 +     149,   149,   149,   150,   150,   150,   150,   150,   151,   152,
 +     153,   153,   154,   154,   155,   156,   156,   156,   156,   156,
 +     156,   156,   156,   157,   157,   158,   159,   159,   160,   160,
 +     160,   161,   161,   162,   163,   163,   163,   164,   164,   164,
 +     165,   165,   165,   165,   166,   166,   166,   167,   167,   167,
 +     167,   168,   169,   170,   171,   172,   172,   172,   172,   172,
 +     172,   172,   172,   172,   172,   172,   172,   173,   173,   174,
 +     174,   175,   176,   176,   176,   176,   176,   176,   176,   176,
 +     176,   176,   176,   176,   176,   177,   177
  };
  
 -/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
 -static const short yyr2[] =
 +/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN.  */
 +static const unsigned char yyr2[] =
  {
 -       0,     1,     0,     2,     2,     3,     3,     1,     0,     5,
 -       0,     1,     1,     1,     1,     1,     1,     1,     1,     1,
 +       0,     2,     1,     0,     2,     2,     3,     3,     1,     0,
 +       5,     0,     1,     1,     1,     1,     1,     1,     1,     1,
         1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
 -       1,     1,     1,     1,     3,     3,     3,     3,     3,     3,
 -       3,     3,     3,     1,     1,     6,     0,     5,     5,     0,
 -       2,     1,     3,     1,     1,     1,     1,     1,     1,    13,
 -       0,     3,     3,     3,     2,     3,     3,     2,     2,     2,
 +       1,     1,     1,     1,     1,     3,     3,     3,     3,     3,
 +       3,     3,     3,     3,     1,     1,     6,     0,     5,     5,
 +       0,     2,     1,     3,     1,     1,     1,     1,     1,     1,
 +      13,     0,     3,     3,     3,     2,     3,     3,     2,     2,
 +       2,     0,     3,     3,     3,     3,     3,     3,     3,     3,
 +       3,     3,     3,     3,     3,     3,     3,     3,     3,    10,
 +      12,    10,     0,     4,     6,     8,    17,    15,     4,     0,
 +       2,     4,     3,     3,     1,     2,     1,     1,    14,     0,
 +       3,     3,     3,     2,     2,     3,     3,     2,     2,     2,
         0,     3,     3,     3,     3,     3,     3,     3,     3,     3,
 -       3,     3,     3,     3,     3,     3,     3,     3,    10,    12,
 -      10,     0,     4,     6,     8,    17,    15,     4,     0,     2,
 -       4,     3,     3,     1,     2,     1,     1,    14,     0,     3,
 -       3,     3,     2,     2,     3,     3,     2,     2,     2,     0,
 -       3,     3,     3,     3,     3,     3,     3,     3,     3,     3,
 -       3,     3,     3,     3,     3,     3,     3,    10,    19,    16,
 -      14,    12,     0,     1,     0,     2,     9,     0,     2,     4,
 -       3,     0,     6,     3,     5,     0,     3,     3,     3,     3,
 -       3,     3,     4,     3,     0,     4,     3,     5,     0,     2,
 -       5,     6,     0,     2,     4,     6,     8,     4,     3,     0,
 -       4,     0,     1,     6,     0,     9,     9,     3,     3,     3,
 -       3,     3,     0,     2,     5,     0,     2,     1,     4,     4,
 -       1,     3,     9,     0,     3,     2,     0,     2,     2,     1,
 -       1,     1,     1,     1,     1,     1,     0,     2,     2,     2,
 -       4,     2,     2,     4,     1,     1,     2,     1,     2,     1,
 -       3,     3,     4,     3,     4,     3,     1,     1,     0,     1,
 -       1,     3,     3,     3,     3,     3,     3,     3,     2,     2,
 -       2,     3,     1,     2,     1,     1
 +       3,     3,     3,     3,     3,     3,     3,     3,    10,    19,
 +      16,    14,    12,     0,     1,     0,     2,     9,     0,     2,
 +       4,     3,     0,     6,     3,     5,     0,     3,     3,     3,
 +       3,     3,     3,     4,     3,     0,     4,     3,     5,     0,
 +       2,     5,     6,     0,     2,     4,     6,     8,     4,     3,
 +       0,     4,     0,     1,     6,     0,     9,     9,     3,     3,
 +       3,     3,     3,     0,     2,     5,     0,     2,     1,     4,
 +       4,     1,     3,     9,     0,     3,     2,     0,     2,     2,
 +       1,     1,     1,     1,     1,     1,     1,     0,     2,     2,
 +       2,     4,     2,     2,     4,     1,     1,     2,     1,     2,
 +       1,     3,     3,     4,     3,     4,     3,     1,     1,     0,
 +       1,     1,     3,     3,     3,     3,     3,     3,     3,     2,
 +       2,     2,     3,     1,     2,     1,     1
  };
  
 -/* YYDEFACT[S] -- default rule to reduce with in state S when YYTABLE
 -   doesn't specify something else to do.  Zero means the default is an
 -   error. */
 -static const short yydefact[] =
 -{
 -       2,     1,     4,   254,   255,    10,   206,     8,     0,     0,
 -       0,     0,     0,     3,     7,     0,    10,   240,   252,     0,
 -     216,     0,   250,   249,   248,   253,     0,   179,     0,     0,
 -       0,     0,     0,     0,     0,     0,    43,    44,   206,   206,
 -     206,   206,   206,   206,   206,   206,   206,   206,   206,   206,
 -     206,   206,   206,     6,    16,    17,    23,    21,    22,    26,
 -      27,    20,    29,   206,    15,    18,    19,    24,    25,    30,
 -      28,   212,   215,   211,   213,   209,   214,   210,   207,   208,
 -     178,     0,   251,     0,     5,   243,   247,   244,   241,   242,
 -     245,   246,   216,   216,   216,     0,     0,   216,   216,   216,
 -     216,   184,   216,   216,   216,     0,   216,   216,     0,     0,
 -       0,   217,   218,   219,     0,   177,   181,     0,    33,    32,
 -      31,   236,     0,   237,    34,    35,     0,     0,     0,     0,
 -      39,    40,     0,    37,    38,    36,     0,    41,    42,   221,
 -     222,     0,     9,   182,     0,    46,     0,     0,     0,   151,
 -     149,   164,   162,     0,     0,     0,     0,     0,     0,     0,
 -     192,     0,     0,   180,     0,   225,   227,   229,   224,     0,
 -     181,     0,     0,     0,     0,     0,     0,   188,   189,   190,
 -     187,   191,     0,   216,   220,     0,    45,     0,   226,   228,
 -     223,     0,     0,     0,     0,     0,   150,     0,     0,   163,
 -       0,     0,     0,   183,   193,     0,     0,     0,   231,   233,
 -     235,   230,     0,     0,     0,   181,   153,   181,   168,   166,
 -     172,     0,     0,     0,   203,    49,    49,   232,   234,     0,
 -       0,     0,     0,     0,   238,   165,   238,     0,     0,     0,
 -     195,     0,     0,    47,    48,    60,   144,   181,   154,   181,
 -     181,   181,   181,   181,   181,     0,   169,     0,   173,   167,
 -       0,     0,     0,   205,     0,   202,    55,    54,    56,    57,
 -      58,    53,    50,    51,     0,     0,   108,   152,   157,   156,
 -     159,   160,   161,   158,   238,   238,     0,     0,     0,   194,
 -     197,   196,   204,     0,     0,     0,     0,     0,     0,     0,
 -      70,    64,    67,    68,    69,   145,     0,   181,   239,     0,
 -     174,   185,   186,     0,    52,    12,    66,    11,     0,    14,
 -      13,    65,    63,     0,     0,    62,   103,    61,     0,     0,
 -       0,     0,     0,     0,     0,   119,   112,   113,   116,   117,
 -     118,   182,   170,   238,     0,     0,   104,     0,     0,     0,
 +/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
 +   STATE-NUM when YYTABLE doesn't specify something else to do.  Zero
 +   means the default is an error.  */
 +static const unsigned short yydefact[] =
 +{
 +       3,     0,     2,     1,     5,   255,   256,    11,   207,     9,
 +       0,     0,     0,     0,     0,     4,     8,     0,    11,   241,
 +     253,     0,   217,     0,   251,   250,   249,   254,     0,   180,
 +       0,     0,     0,     0,     0,     0,     0,     0,    44,    45,
 +     207,   207,   207,   207,   207,   207,   207,   207,   207,   207,
 +     207,   207,   207,   207,   207,     7,    17,    18,    24,    22,
 +      23,    27,    28,    21,    30,   207,    16,    19,    20,    25,
 +      26,    31,    29,   213,   216,   212,   214,   210,   215,   211,
 +     208,   209,   179,     0,   252,     0,     6,   244,   248,   245,
 +     242,   243,   246,   247,   217,   217,   217,     0,     0,   217,
 +     217,   217,   217,   185,   217,   217,   217,     0,   217,   217,
 +       0,     0,     0,   218,   219,   220,     0,   178,   182,     0,
 +      34,    33,    32,   237,     0,   238,    35,    36,     0,     0,
 +       0,     0,    40,    41,     0,    38,    39,    37,     0,    42,
 +      43,   222,   223,     0,    10,   183,     0,    47,     0,     0,
 +       0,   152,   150,   165,   163,     0,     0,     0,     0,     0,
 +       0,     0,   193,     0,     0,   181,     0,   226,   228,   230,
 +     225,     0,   182,     0,     0,     0,     0,     0,     0,   189,
 +     190,   191,   188,   192,     0,   217,   221,     0,    46,     0,
 +     227,   229,   224,     0,     0,     0,     0,     0,   151,     0,
 +       0,   164,     0,     0,     0,   184,   194,     0,     0,     0,
-      232,   234,   236,   231,     0,     0,     0,   182,   154,   156,
++     232,   234,   236,   231,     0,     0,     0,   182,   154,   182,
 +     169,   167,   173,     0,     0,     0,   204,    50,    50,   233,
 +     235,     0,     0,     0,     0,     0,   239,   166,   239,     0,
-        0,     0,   196,     0,     0,    48,    49,    61,   145,   156,
-      156,   156,   156,   156,   156,   156,   155,     0,   170,     0,
++       0,     0,   196,     0,     0,    48,    49,    61,   145,   182,
++     155,   182,   182,   182,   182,   182,   182,     0,   170,     0,
 +     174,   168,     0,     0,     0,   206,     0,   203,    56,    55,
 +      57,    58,    59,    54,    51,    52,     0,     0,   109,   153,
 +     158,   157,   160,   161,   162,   159,   239,   239,     0,     0,
 +       0,   195,   198,   197,   205,     0,     0,     0,     0,     0,
-        0,     0,    71,    65,    68,    69,    70,   146,     0,   156,
++       0,     0,    71,    65,    68,    69,    70,   146,     0,   182,
 +     240,     0,   175,   186,   187,     0,    53,    13,    67,    12,
 +       0,    15,    14,    66,    64,     0,     0,    63,   104,    62,
 +       0,     0,     0,     0,     0,     0,     0,   120,   113,   114,
-      117,   118,   119,     0,   171,   239,     0,     0,   105,   253,
++     117,   118,   119,   183,   171,   239,     0,     0,   105,   253,
 +       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,    59,   115,     0,
 -     114,   111,   110,   109,     0,   171,     0,   175,   198,   199,
 -     200,    97,   102,   101,   181,   181,    81,    83,    84,    76,
 -      77,    79,    80,    82,    78,    74,     0,    73,    75,   181,
 -      71,    72,    87,    86,    85,     0,     0,     0,     0,     0,
 +       0,    60,   116,     0,   115,   112,   111,   110,     0,   172,
 +       0,   176,   199,   200,   201,    98,   103,   102,   182,   182,
 +      82,    84,    85,    77,    78,    80,    81,    83,    79,    75,
 +       0,    74,    76,   182,    72,    73,    88,    87,    86,     0,
         0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
 -       0,     0,     0,     0,   107,     0,     0,     0,     0,     0,
 -       0,    97,   181,   181,   130,   132,   133,   125,   126,   128,
 -     129,   131,   127,   123,     0,   122,   124,   181,   120,   121,
 -     136,   135,   134,   176,   201,     0,     0,     0,     0,     0,
 +       0,     0,     0,     0,     0,     0,     0,     0,   108,     0,
 +       0,     0,     0,     0,     0,    98,   182,   182,   131,   133,
 +     134,   126,   127,   129,   130,   132,   128,   124,     0,   123,
 +     125,   182,   121,   122,   137,   136,   135,   177,   202,     0,
         0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
 -       0,     0,     0,     0,     0,     0,   106,     0,   105,     0,
 -       0,     0,     0,     0,     0,     0,     0,     0,   147,     0,
 -       0,     0,     0,    91,     0,     0,     0,     0,   146,     0,
 -       0,     0,     0,     0,    88,     0,     0,     0,   148,    91,
 -       0,     0,     0,     0,     0,    98,     0,   137,     0,     0,
 -       0,     0,     0,     0,    90,     0,     0,    98,     0,    92,
 -      98,    99,     0,     0,   144,     0,     0,    89,     0,     0,
 -      98,   142,     0,    93,   100,     0,   144,   141,   143,     0,
 -       0,     0,   142,     0,    94,    96,   140,     0,     0,   142,
 -      95,     0,   139,   144,   142,   138,     0,     0,     0
 +       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
 +     107,     0,   106,     0,     0,     0,     0,     0,     0,     0,
 +       0,     0,   148,     0,     0,     0,     0,    92,     0,     0,
 +       0,     0,   147,     0,     0,     0,     0,     0,    89,     0,
 +       0,     0,   149,    92,     0,     0,     0,     0,     0,    99,
 +       0,   138,     0,     0,     0,     0,     0,     0,    91,     0,
 +       0,    99,     0,    93,    99,   100,     0,     0,   145,     0,
 +       0,    90,     0,     0,    99,   143,     0,    94,   101,     0,
 +     145,   142,   144,     0,     0,     0,   143,     0,    95,    97,
 +     141,     0,     0,   143,    96,     0,   140,   145,   143,   139
  };
  
 +/* YYDEFGOTO[NTERM-NUM]. */
  static const short yydefgoto[] =
  {
 -     566,     1,    13,    21,    19,   320,   321,    53,   121,    54,
 -      55,    56,    57,    58,    59,    60,    61,    62,    63,    64,
 -     164,   243,   272,   273,    65,   274,   328,   386,   395,   504,
 -     400,   301,   524,   325,   477,    66,   306,   374,   448,   434,
 -     443,   547,   276,   337,   498,    67,   150,   173,   232,    68,
 -     152,   174,   235,   237,    14,    15,    83,   233,    69,   132,
 -     182,   204,   262,   291,   379,    70,   241,    20,    78,    79,
 -     122,   111,   112,   113,   123,   170,   124,   255,   317,    17,
 -      18
 +      -1,     1,     2,    15,    23,    21,   322,   323,    55,   123,
 +      56,    57,    58,    59,    60,    61,    62,    63,    64,    65,
 +      66,   166,   245,   274,   275,    67,   276,   330,   390,   399,
 +     508,   404,   303,   528,   327,   481,    68,   308,   378,   452,
-      438,   447,   551,   278,   339,   502,    69,   152,   175,   235,
-       70,   154,   176,   237,   239,    16,    17,    85,   146,    71,
++     438,   447,   551,   278,   339,   502,    69,   152,   175,   234,
++      70,   154,   176,   237,   239,    16,    17,    85,   235,    71,
 +     134,   184,   206,   264,   293,   383,    72,   243,    22,    80,
 +      81,   124,   113,   114,   115,   125,   172,   126,   257,   319,
 +      19,    20
  };
  
- #define YYPACT_NINF -523
 +/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
 +   STATE-NUM.  */
++#define YYPACT_NINF -399
  static const short yypact[] =
  {
-     -523,     5,    13,  -523,  -523,  -523,  -523,  -523,  -523,  -523,
-      284,   284,   284,    93,   284,  -523,  -523,   -69,  -523,   600,
-     -523,   392,   639,   284,  -523,  -523,  -523,  -523,   554,  -523,
-      392,   284,   284,   284,   284,   284,   284,   284,  -523,  -523,
-     -523,  -523,  -523,  -523,  -523,  -523,  -523,  -523,  -523,  -523,
-     -523,  -523,  -523,  -523,  -523,  -523,  -523,  -523,  -523,  -523,
-     -523,  -523,  -523,  -523,  -523,  -523,  -523,  -523,  -523,  -523,
-     -523,  -523,  -523,  -523,  -523,  -523,  -523,  -523,  -523,  -523,
-     -523,  -523,   122,   -66,  -523,   108,  -523,   391,   357,   138,
-       27,    27,  -523,  -523,   639,   524,   524,    33,    33,   639,
-      639,   524,   524,   639,   524,   524,   524,    33,   524,   524,
-      284,   284,   284,  -523,  -523,  -523,   284,  -523,   -58,   210,
-     -523,  -523,  -523,  -523,   242,  -523,  -523,  -523,    35,    42,
-      254,   273,  -523,  -523,   448,  -523,  -523,  -523,    50,  -523,
-     -523,  -523,  -523,    59,  -523,  -523,   159,  -523,    19,   284,
-      284,  -523,  -523,  -523,  -523,   284,   284,   284,   284,   284,
-      284,   284,  -523,   284,   284,  -523,   171,  -523,  -523,  -523,
-     -523,   267,   -67,    75,    78,   -10,   172,    88,   104,  -523,
-     -523,  -523,  -523,  -523,     1,  -523,  -523,   116,  -523,   121,
-     -523,  -523,  -523,    63,   284,   284,     0,   184,  -523,     2,
-      211,  -523,   284,   284,   231,  -523,  -523,   287,   284,   284,
-     -523,  -523,  -523,  -523,   311,   157,   162,   -58,  -523,   166,
-      167,  -523,   170,   176,   185,   203,  -523,   198,   198,  -523,
-     -523,   284,   284,   284,   131,   214,   284,  -523,   284,   221,
-      284,   284,  -523,   201,   405,  -523,  -523,  -523,   226,   166,
-      166,   166,   166,   166,   166,   166,  -523,   230,   233,   234,
-      233,  -523,   245,   246,    51,  -523,   284,  -523,  -523,  -523,
-     -523,  -523,  -523,  -523,   247,  -523,   376,   284,  -523,  -523,
-     -523,  -523,  -523,  -523,  -523,  -523,   284,   284,   284,   284,
-      325,  -523,  -523,  -523,  -523,   405,   206,   284,    39,   329,
-      294,   294,  -523,  -523,  -523,  -523,  -523,  -523,   432,   249,
-     -523,   256,   233,  -523,  -523,   259,  -523,  -523,  -523,  -523,
-      261,  -523,  -523,  -523,  -523,   284,   294,   265,   600,   265,
-      563,   206,   284,    39,   351,   294,   294,  -523,  -523,  -523,
-     -523,  -523,  -523,    97,  -523,   284,   217,   352,   391,  -523,
-       -4,   554,   294,    39,   353,   353,   353,   353,   353,   353,
-      353,   353,   353,   284,   284,   284,    39,   284,   353,   353,
-      353,  -523,  -523,   271,  -523,  -523,   265,   265,   581,  -523,
-      275,   233,  -523,   276,  -523,  -523,  -523,  -523,   -58,   -58,
-     -523,  -523,  -523,  -523,  -523,  -523,  -523,  -523,  -523,  -523,
-      286,  -523,  -523,   -58,  -523,  -523,  -523,  -523,  -523,   354,
-       39,   360,   360,   360,   360,   360,   360,   360,   360,   360,
-      284,   284,   284,    39,   284,   360,   360,   360,  -523,   284,
-      284,   284,   284,   284,   284,   289,   -58,   -58,  -523,  -523,
-     -523,  -523,  -523,  -523,  -523,  -523,  -523,  -523,   290,  -523,
-     -523,   -58,  -523,  -523,  -523,  -523,  -523,  -523,  -523,   293,
-      296,   297,   299,   284,   284,   284,   284,   284,   284,   284,
-      284,   238,   301,   302,   305,   307,   308,   319,   323,   324,
-     -523,   328,  -523,   284,   284,   284,   284,   238,   284,   284,
-      284,   294,   330,   331,   332,   333,   340,   359,   361,   364,
-      -64,   284,  -523,   284,   284,   284,   294,   284,  -523,   284,
-      284,   284,  -523,   359,   365,   366,   -23,   367,   378,   379,
-      380,  -523,   284,   284,   284,   284,   284,   294,  -523,   284,
-      396,   379,   404,   407,   379,   -20,   411,   284,   226,   284,
-      294,  -523,   294,   284,   379,   313,   413,    28,   265,   417,
-      226,  -523,  -523,   284,   294,   284,   313,   436,   265,   440,
-     -523,   284,   294,   152,   265,   294,  -523,    80,   313,  -523
 -  -32768,     6,-32768,-32768,-32768,-32768,-32768,-32768,   107,   107,
 -     107,    86,   107,-32768,-32768,   -39,-32768,   566,-32768,   285,
 -     605,   107,-32768,-32768,-32768,-32768,   553,-32768,   285,   107,
 -     107,   107,   107,   107,   107,   107,-32768,-32768,-32768,-32768,
 -  -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
 -  -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
 -  -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
 -  -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
 -     258,   -31,-32768,    54,-32768,   579,   368,   334,    28,    28,
 -  -32768,-32768,   605,   328,   328,    32,    32,   605,   605,   328,
 -     328,   605,   328,   328,   328,    32,   328,   328,   107,   107,
 -     107,-32768,-32768,-32768,   107,-32768,    10,     0,-32768,-32768,
 -  -32768,-32768,   110,-32768,-32768,-32768,    69,    72,   123,   180,
 -  -32768,-32768,   549,-32768,-32768,-32768,    78,-32768,-32768,-32768,
 -  -32768,    85,-32768,-32768,   108,-32768,    62,   107,   107,-32768,
 -  -32768,-32768,-32768,   107,   107,   107,   107,   107,   107,   107,
 -  -32768,   107,   107,-32768,    34,-32768,-32768,-32768,-32768,   264,
 -     -62,   102,   114,   206,   420,   125,   141,-32768,-32768,-32768,
 -  -32768,-32768,   -27,-32768,-32768,   143,-32768,   149,-32768,-32768,
 -  -32768,   204,   107,   107,    -4,   130,-32768,    -2,   210,-32768,
 -     107,   107,   221,-32768,-32768,   191,   107,   107,-32768,-32768,
 -  -32768,-32768,   274,   153,   157,    10,-32768,   -59,   189,-32768,
 -     195,   200,   212,    -5,-32768,   223,   223,-32768,-32768,   107,
 -     107,   107,    47,   341,   107,-32768,   107,   184,   107,   107,
 -  -32768,   446,   497,-32768,-32768,-32768,   224,    57,-32768,   435,
 -     435,   435,   435,   435,   435,   232,   233,   237,   233,-32768,
 -     239,   244,   -36,-32768,   107,-32768,-32768,-32768,-32768,-32768,
 -  -32768,-32768,   248,-32768,   251,   107,-32768,-32768,-32768,-32768,
 -  -32768,-32768,-32768,-32768,   107,   107,   107,   107,   267,-32768,
 -  -32768,-32768,-32768,   497,    94,   107,    43,   342,    11,    11,
 -  -32768,-32768,-32768,-32768,-32768,-32768,   312,   275,-32768,   254,
 -     233,-32768,-32768,   259,-32768,-32768,-32768,-32768,   260,-32768,
 -  -32768,-32768,-32768,    86,    11,   278,-32768,   278,   370,    94,
 -     107,    43,   351,    11,    11,-32768,-32768,-32768,-32768,-32768,
 -  -32768,   107,-32768,   107,   162,   358,-32768,   -18,    11,    43,
 -     359,   359,   359,   359,   359,   359,   359,   359,   359,   107,
 -     107,   107,    43,   107,   359,   359,   359,-32768,-32768,   273,
 -  -32768,-32768,   278,   278,   407,-32768,   284,   233,-32768,   293,
 -  -32768,-32768,-32768,-32768,    10,    10,-32768,-32768,-32768,-32768,
 -  -32768,-32768,-32768,-32768,-32768,-32768,   294,-32768,-32768,    10,
 -  -32768,-32768,-32768,-32768,-32768,   372,    43,   385,   385,   385,
 -     385,   385,   385,   385,   385,   385,   107,   107,   107,    43,
 -     107,   385,   385,   385,-32768,   107,   107,   107,   107,   107,
 -     107,   318,    10,    10,-32768,-32768,-32768,-32768,-32768,-32768,
 -  -32768,-32768,-32768,-32768,   319,-32768,-32768,    10,-32768,-32768,
 -  -32768,-32768,-32768,-32768,-32768,   374,   375,   383,   384,   107,
 -     107,   107,   107,   107,   107,   107,   107,   171,   393,   396,
 -     399,   400,   404,   410,   418,   419,-32768,   421,-32768,   107,
 -     107,   107,   107,   171,   107,   107,   107,    11,   433,   436,
 -     437,   438,   442,   443,   444,   452,    96,   107,-32768,   107,
 -     107,   107,    11,   107,-32768,   107,   107,   107,-32768,   443,
 -     453,   456,   119,   460,   462,   465,   475,-32768,   107,   107,
 -     107,   107,   107,    11,-32768,   107,   476,   465,   477,   479,
 -     465,   121,   483,   107,   224,   107,    11,-32768,    11,   107,
 -     465,   427,   484,   132,   278,   485,   224,-32768,-32768,   107,
 -      11,   107,   427,   487,   278,   488,-32768,   107,    11,    79,
 -     278,    11,-32768,   148,   427,-32768,   513,   539,-32768
++    -399,    11,    13,  -399,  -399,  -399,  -399,  -399,  -399,  -399,
++     207,   207,   207,    37,   207,  -399,  -399,   -66,  -399,   351,
++    -399,   363,   612,   207,  -399,  -399,  -399,  -399,   564,  -399,
++     363,   207,   207,   207,   207,   207,   207,   207,  -399,  -399,
++    -399,  -399,  -399,  -399,  -399,  -399,  -399,  -399,  -399,  -399,
++    -399,  -399,  -399,  -399,  -399,  -399,  -399,  -399,  -399,  -399,
++    -399,  -399,  -399,  -399,  -399,  -399,  -399,  -399,  -399,  -399,
++    -399,  -399,  -399,  -399,  -399,  -399,  -399,  -399,  -399,  -399,
++    -399,  -399,   361,   -46,  -399,   108,  -399,   445,   469,   311,
++      49,    49,  -399,  -399,   612,   282,   282,    33,    33,   612,
++     612,   282,   282,   612,   282,   282,   282,    33,   282,   282,
++     207,   207,   207,  -399,  -399,  -399,   207,  -399,   -15,    38,
++    -399,  -399,  -399,  -399,   182,  -399,  -399,  -399,     1,    28,
++     236,   243,  -399,  -399,   448,  -399,  -399,  -399,    42,  -399,
++    -399,  -399,  -399,    51,  -399,  -399,    75,  -399,    58,   207,
++     207,  -399,  -399,  -399,  -399,   207,   207,   207,   207,   207,
++     207,   207,  -399,   207,   207,  -399,    87,  -399,  -399,  -399,
++    -399,   138,   -21,    70,    74,   -62,    41,    98,   103,  -399,
++    -399,  -399,  -399,  -399,    30,  -399,  -399,   115,  -399,   117,
++    -399,  -399,  -399,    64,   207,   207,    -1,   209,  -399,     0,
++     213,  -399,   207,   207,   222,  -399,  -399,   268,   207,   207,
++    -399,  -399,  -399,  -399,   167,   123,   142,   -15,  -399,   -57,
++     144,  -399,   151,   159,   168,   100,  -399,   170,   170,  -399,
++    -399,   207,   207,   207,   194,   178,   207,  -399,   207,   200,
++     207,   207,  -399,    60,   500,  -399,  -399,  -399,   190,   276,
++    -399,   398,   398,   398,   398,   398,   398,   198,   217,   224,
++     217,  -399,   231,   234,   -33,  -399,   207,  -399,  -399,  -399,
++    -399,  -399,  -399,  -399,   249,  -399,   332,   207,  -399,  -399,
++    -399,  -399,  -399,  -399,  -399,  -399,   207,   207,   207,   207,
++     296,  -399,  -399,  -399,  -399,   500,   127,   207,    39,   305,
++     228,   228,  -399,  -399,  -399,  -399,  -399,  -399,   343,   419,
++    -399,   256,   217,  -399,  -399,   259,  -399,  -399,  -399,  -399,
++     261,  -399,  -399,  -399,  -399,   207,   228,   246,   351,   246,
++     563,   127,   207,    39,   354,   228,   228,  -399,  -399,  -399,
++    -399,  -399,  -399,   207,  -399,   207,   179,   360,   445,  -399,
++      93,   564,   228,    39,   362,   362,   362,   362,   362,   362,
++     362,   362,   362,   207,   207,   207,    39,   207,   362,   362,
++     362,  -399,  -399,   266,  -399,  -399,   246,   246,   581,  -399,
++     278,   217,  -399,   290,  -399,  -399,  -399,  -399,   -15,   -15,
++    -399,  -399,  -399,  -399,  -399,  -399,  -399,  -399,  -399,  -399,
++     294,  -399,  -399,   -15,  -399,  -399,  -399,  -399,  -399,   382,
++      39,   383,   383,   383,   383,   383,   383,   383,   383,   383,
++     207,   207,   207,    39,   207,   383,   383,   383,  -399,   207,
++     207,   207,   207,   207,   207,   317,   -15,   -15,  -399,  -399,
++    -399,  -399,  -399,  -399,  -399,  -399,  -399,  -399,   321,  -399,
++    -399,   -15,  -399,  -399,  -399,  -399,  -399,  -399,  -399,   322,
++     333,   349,   350,   207,   207,   207,   207,   207,   207,   207,
++     207,   218,   377,   387,   396,   397,   399,   402,   403,   404,
++    -399,   405,  -399,   207,   207,   207,   207,   218,   207,   207,
++     207,   228,   411,   413,   417,   432,   446,   447,   449,   455,
++     165,   207,  -399,   207,   207,   207,   228,   207,  -399,   207,
++     207,   207,  -399,   447,   456,   459,   166,   468,   478,   479,
++     480,  -399,   207,   207,   207,   207,   207,   228,  -399,   207,
++     482,   479,   486,   487,   479,   174,   488,   207,   190,   207,
++     228,  -399,   228,   207,   479,   353,   490,   188,   246,   491,
++     190,  -399,  -399,   207,   228,   207,   353,   538,   246,   539,
++    -399,   207,   228,    86,   246,   228,  -399,   189,   353,  -399
  };
  
 +/* YYPGOTO[NTERM-NUM].  */
  static const short yypgoto[] =
  {
-     -523,  -523,  -523,  -523,  -523,   369,  -283,  -292,   468,  -523,
-     -523,  -523,  -523,  -523,  -523,  -523,  -523,  -523,  -523,  -523,
-     -523,  -523,   306,  -523,   241,  -523,  -523,  -523,   295,  -116,
-       12,  -523,   232,  -522,  -286,    52,  -523,  -523,  -523,  -523,
-      255,  -112,  -328,  -416,  -523,  -523,  -523,   303,  -523,  -113,
-     -523,   304,  -523,  -523,  -523,  -523,  -523,  -523,  -170,  -523,
-     -523,  -523,   278,  -523,  -523,  -523,  -523,  -523,   582,  -523,
-     -523,   -19,  -272,  -269,  -214,  -396,  -523,   462,  -228,    -2,
 -  -32768,-32768,-32768,-32768,   590,  -276,  -180,   581,-32768,-32768,
 -  -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
 -  -32768,   381,-32768,   317,-32768,-32768,-32768,   209,  -333,   112,
 -  -32768,   320,  -505,  -291,   140,-32768,-32768,-32768,-32768,   190,
 -     134,  -483,  -517,-32768,-32768,-32768,   392,-32768,   -30,-32768,
 -     388,-32768,-32768,-32768,-32768,-32768,-32768,  -109,-32768,-32768,
 -  -32768,   371,-32768,-32768,-32768,-32768,-32768,   545,-32768,-32768,
 -     -19,  -262,  -251,  -250,  -213,-32768,   528,  -233,    -1,   440,
 -      21
++    -399,  -399,  -399,  -399,  -399,   426,  -292,  -163,   508,  -399,
++    -399,  -399,  -399,  -399,  -399,  -399,  -399,  -399,  -399,  -399,
++    -399,  -399,   248,  -399,   335,  -399,  -399,  -399,   208,    44,
++     121,  -399,   346,  -291,  -286,   153,  -399,  -399,  -399,  -399,
++     210,    53,  -381,  -398,  -399,  -399,  -399,   421,  -399,  -227,
++    -399,   418,  -399,  -399,  -399,  -399,  -399,  -399,  -111,  -399,
++    -399,  -399,   392,  -399,  -399,  -399,  -399,  -399,   406,  -399,
++    -399,   -20,  -273,  -211,  -148,  -359,  -399,   537,  -228,    -2,
 +      20,   -12
  };
  
 -
 -#define       YYLAST          668
 -
 -
 +/* 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 -241
  static const short yytable[] =
  {
-       18,    27,   193,    82,   304,     3,   217,   305,   220,   538,
-      259,    29,   541,   318,   192,   329,     4,     5,     6,   352,
-        7,    83,   550,   167,   168,   169,   145,   116,   170,   511,
-       24,    25,    26,     8,    28,   145,   340,     5,     6,   341,
-      350,   374,   204,     5,     6,   321,   317,   233,   372,   376,
 -      16,    80,   215,   257,   218,   202,   288,   144,   327,     2,
 -       3,     4,   302,     5,   202,     3,     4,   541,   316,   190,
 -      81,  -155,   534,   303,   304,   537,     6,   397,   398,   552,
 -     401,   143,    25,   347,   143,   546,     3,     4,     3,     4,
 -     185,    27,   372,   373,   338,   289,   564,     3,     4,   319,
 -     315,   307,   309,   368,   203,   339,   340,   383,     3,     4,
 -     108,   191,   114,   109,   110,   348,   165,   166,   167,   556,
 -       7,   168,   216,   117,   219,   240,   562,   382,   128,   129,
 -     145,   565,   116,    71,    72,    73,    74,    75,    76,    77,
 -       3,     4,     8,     9,   126,   127,    10,    11,     3,     4,
 -      12,   315,   323,   143,   136,   324,   231,   139,   140,   141,
 -     376,     3,     4,   142,   163,   186,    34,    35,     8,     9,
 -       8,     9,    10,    11,    10,    11,    12,   149,    12,     8,
 -       9,  -155,  -155,    10,    11,   115,   217,    12,  -155,  -216,
 -       8,     9,  -216,  -216,    10,    11,   171,   172,    12,   169,
 -     143,   370,   175,   176,   177,   178,   179,   180,   181,  -216,
 -     183,   184,   147,   187,   205,   148,     3,     4,   378,   384,
 -     108,   161,   561,   109,   110,     3,     4,   476,   162,   348,
 -       8,     9,   399,   108,    10,    11,   109,   110,    12,   507,
 -     146,   213,   214,     8,     9,   192,   496,    10,    11,   221,
 -     222,    12,   348,   149,   348,   225,   226,   193,   208,   209,
 -     210,   512,   520,   211,   538,   348,   220,   277,   200,   278,
 -     279,   280,   281,   282,   283,   550,   432,   223,   245,   246,
 -     247,   348,   531,   256,   201,   258,   206,   260,   261,   447,
 -     108,   275,   207,   109,   110,   543,   229,   544,     8,     9,
 -     230,   108,    10,    11,   109,   110,    12,     8,     9,   554,
 -     151,    10,    11,   292,   151,    12,   294,   560,   188,   189,
 -     563,   224,   295,   313,   305,   427,   428,   342,   227,   228,
 -     194,   195,   234,   308,   310,   311,   312,   196,   236,    36,
 -     430,   212,    37,   238,   318,    38,    39,    40,    41,    42,
 -      43,    44,    45,    46,    47,   239,    48,    49,    50,   296,
 -     297,   108,   298,   299,   109,   110,   242,   275,   108,   326,
 -     326,   109,   110,   460,   461,   284,  -239,   329,   548,   369,
 -     285,   300,   286,   330,   118,   119,   120,   287,   463,   548,
 -     375,   293,   377,   380,   346,   326,   548,   343,   322,  -155,
 -    -155,   548,   344,   345,   326,   326,  -155,   371,   396,   396,
 -     396,   348,   396,    51,   381,   385,   405,    52,   341,   326,
 -     331,   332,   108,   333,   334,   109,   110,   425,   431,    71,
 -      72,    73,    74,    75,    76,    77,   426,   429,   249,   250,
 -     251,   433,   335,   349,   350,   351,   352,   353,   354,   355,
 -     356,   357,   358,   359,   360,   361,   362,   363,   364,   365,
 -     366,   459,   462,   252,   253,   444,   444,   444,   254,   444,
 -      32,    33,    34,    35,   453,   454,   455,   456,   457,   458,
 -     406,   407,   408,   409,   410,   411,   412,   413,   414,   415,
 -     416,   417,   418,   419,   420,   421,   422,   423,    22,    23,
 -      24,   367,    26,    31,    32,    33,    34,    35,   468,   469,
 -     470,   471,   472,   473,   474,   475,   478,   464,   465,    85,
 -      86,    87,    88,    89,    90,    91,   466,   467,   488,   489,
 -     490,   491,   478,   493,   494,   495,   479,  -216,   424,   480,
 -    -216,  -216,   481,   482,   197,   198,   508,   483,   509,   510,
 -     511,   199,   513,   484,   514,   515,   516,  -216,   326,  -155,
 -    -155,   485,   486,   567,   487,  -155,  -155,   526,   527,   528,
 -     529,   530,   263,   326,   532,   264,   497,   265,   143,   499,
 -     500,   501,   540,   266,   542,   502,   503,   505,   545,   568,
 -     267,   268,   269,   270,   326,   506,   518,   271,   553,   519,
 -     555,   445,   446,   521,   449,   522,   559,   326,   523,   326,
 -     387,   388,   389,   390,   391,   392,   393,   394,   525,   533,
 -     535,   326,   536,   402,   403,   404,   539,   549,   551,   326,
 -     557,   558,   326,    92,    93,    94,    95,    96,    97,    98,
 -      99,   100,   101,   102,   103,   104,   105,   106,   435,   436,
 -     437,   438,   439,   440,   441,   442,    28,   244,   107,    84,
 -     314,   450,   451,   452,   153,   154,   155,   156,   157,   158,
 -     159,   517,   125,   492,   248,   259,   336,   130,   131,   160,
 -     133,   134,   135,   290,   137,   138,    29,    30,    31,    32,
 -      33,    34,    35,     0,     0,     0,     0,     0,    82,    29,
 -      30,    31,    32,    33,    34,    35,    71,    72,    73,    74,
 -      75,    76,    77,    30,    31,    32,    33,    34,    35
++      18,    27,    82,   304,   318,   217,   220,   146,   204,   290,
++     259,     3,   196,   197,    29,   329,     4,     5,     6,   198,
++       7,    83,   279,  -156,   280,   281,   282,   283,   284,   285,
++      24,    25,    26,     8,    28,   340,   145,     5,     6,   372,
++     350,     5,     6,     5,     6,   321,   317,   116,   291,   376,
 +     377,    87,    88,    89,    90,    91,    92,    93,   309,   311,
-      352,   388,   306,   352,   196,   197,   387,   210,   211,   212,
-      524,   198,   213,   542,   403,   119,   218,     9,   221,   352,
-      130,   131,   205,   118,    73,    74,    75,    76,    77,    78,
-       79,   386,   204,   290,   342,   128,   129,     5,     6,    10,
-       11,     5,     6,    12,    13,   138,   171,    14,   141,   142,
-      143,   352,     5,     6,   144,    36,    37,   380,   436,    10,
-       11,   554,   545,    12,    13,    10,    11,    14,   149,    12,
-       13,   451,   291,    14,   556,   150,   279,   280,   281,   282,
-      283,   284,   285,   163,   250,   251,   252,   173,   174,   552,
-      214,   568,   164,   177,   178,   179,   180,   181,   182,   183,
-      552,   185,   186,   352,   189,   165,   207,   552,   194,   253,
-      254,   195,   552,   277,   255,     5,     6,   187,   250,   251,
-      252,   202,   110,    10,    11,   111,   112,    12,    13,   117,
-      219,    14,   215,   216,    10,    11,   344,   203,    12,    13,
-      223,   224,    14,   253,   254,   500,   227,   228,   255,   208,
-        5,     6,  -217,   317,   209,  -217,  -217,   222,   431,   432,
-      516,     5,     6,   382,    34,    35,    36,    37,   560,   247,
-      248,   249,  -217,   434,   258,   566,   260,   225,   262,   263,
-      569,   535,     5,     6,   480,   565,   199,   200,   401,   402,
-      231,   405,   188,   201,   547,   232,   548,    10,    11,   234,
-      236,    12,    13,   238,   294,    14,   464,   465,   558,   240,
-      110,   190,   191,   111,   112,   307,   564,   265,   241,   567,
-      266,   467,   267,   242,   310,   312,   313,   314,     5,     6,
-      147,   244,    10,    11,   151,   320,    12,    13,     5,     6,
-       14,   153,   110,    10,    11,   111,   112,    12,    13,   449,
-      450,    14,   453,   349,   110,   229,   230,   111,   112,   277,
-      328,   328,   148,   286,    10,    11,  -240,   287,    12,    13,
-      373,   315,    14,   110,   151,   324,   111,   112,   288,   289,
-      295,   379,   343,   381,   384,   348,   351,   110,   352,   345,
-      111,   112,   346,   153,   347,   328,   328,   375,   385,   389,
-      435,   400,   400,   400,   409,   400,   437,   226,   429,   430,
-       10,    11,   328,  -217,    12,    13,  -217,  -217,    14,   433,
-       10,    11,   463,   466,    12,   325,   468,    30,   326,   469,
-      470,   296,   471,  -217,   483,   484,    38,   297,   485,    39,
-      486,   487,    40,    41,    42,    43,    44,    45,    46,    47,
-       48,    49,   488,    50,    51,    52,   489,   490,   448,   448,
-      448,   491,   448,   501,   503,   504,   505,   457,   458,   459,
-      460,   461,   462,   506,   298,   299,   110,   300,   301,   111,
-      112,   268,    33,    34,    35,    36,    37,   331,   269,   270,
-      271,   272,   507,   332,   509,   273,   302,   510,   522,   523,
-      525,   472,   473,   474,   475,   476,   477,   478,   479,   482,
-       53,   526,   527,   529,    54,    32,    33,    34,    35,    36,
-       37,   492,   493,   494,   495,   482,   497,   498,   499,   537,
-      333,   334,   110,   335,   336,   111,   112,   539,    86,   512,
-      540,   513,   514,   515,   543,   517,   553,   518,   519,   520,
-      555,   328,   337,   155,   156,   157,   158,   159,   160,   161,
-      530,   531,   532,   533,   534,   521,   328,   536,   162,   561,
-      120,   121,   122,   562,   246,   544,   316,   546,   256,   496,
-      338,   549,   292,   261,     0,     0,     0,   328,     0,     0,
-        0,   557,     0,   559,     0,     0,     0,     0,   127,   563,
-      328,     0,   328,   132,   133,     0,   135,   136,   137,     0,
-      139,   140,     0,     0,   328,    73,    74,    75,    76,    77,
-       78,    79,   328,     0,     0,   328,   353,   354,   355,   356,
++     192,   193,   167,   168,   169,   305,   387,   170,   210,   211,
++     212,   204,   145,   213,   119,   218,   221,     9,   145,   130,
++     131,   165,   344,   118,    73,    74,    75,    76,    77,    78,
++      79,     5,     6,   187,   149,   128,   129,   341,   110,    10,
++      11,   111,   112,    12,    13,   138,   233,    14,   141,   142,
++     143,   205,     5,     6,   144,   199,   200,   380,   147,    10,
++      11,   150,   201,    12,    13,    10,    11,    14,   306,    12,
++      13,     5,     6,    14,   317,   163,   265,    36,    37,   266,
++     545,   267,   190,   191,   164,   171,  -217,   173,   174,  -217,
++    -217,   214,   556,   177,   178,   179,   180,   181,   182,   183,
++     342,   185,   186,   194,   189,   207,  -217,   195,   188,   568,
++     374,   229,   230,    10,    11,   560,   352,    12,    13,   565,
++     242,    14,   566,     5,     6,   382,   552,   569,   386,   117,
++     388,   202,   215,   216,    10,    11,   203,   552,    12,    13,
++     223,   224,    14,   403,   552,   500,   227,   228,   208,   552,
++     209,     5,     6,    10,    11,   219,   231,    12,    13,   222,
++     516,    14,     5,     6,   480,   251,   252,   253,   225,   247,
++     248,   249,     5,     6,   258,   232,   260,   236,   262,   263,
++     538,   535,   110,   541,   238,   111,   112,   436,   352,   352,
++     254,   255,   240,   550,   547,   256,   548,   352,   511,   524,
++     451,   241,   148,   244,   294,    10,    11,   542,   558,    12,
++      13,   352,   352,    14,   151,   307,   564,   431,   432,   567,
++     153,   554,   277,   277,   310,   312,   313,   314,   120,   121,
++     122,   286,   434,    10,    11,   320,   110,    12,    13,   111,
++     112,    14,   315,   110,    10,    11,   111,   112,    12,    13,
++    -240,   324,    14,   349,    10,    11,   151,   287,    12,   325,
++     328,   328,   326,   153,   288,   464,   465,   289,   110,   352,
++     373,   111,   112,    73,    74,    75,    76,    77,    78,    79,
++     467,   379,   295,   381,   384,   348,   351,   296,   226,   345,
++    -156,  -156,   346,   297,   347,   328,   328,  -156,   331,   409,
++     375,   400,   400,   400,   332,   400,   385,    38,   389,   145,
++      39,   429,   328,    40,    41,    42,    43,    44,    45,    46,
++      47,    48,    49,   430,    50,    51,    52,   433,   435,   437,
++     298,   299,   110,   300,   301,   111,   112,    34,    35,    36,
++      37,   333,   334,   110,   335,   336,   111,   112,   401,   402,
++     463,   405,   302,  -217,   466,   468,  -217,  -217,   448,   448,
++     448,   110,   448,   337,   111,   112,   469,   457,   458,   459,
++     460,   461,   462,  -217,    31,    32,    33,    34,    35,    36,
++      37,    53,   470,   471,    30,    54,    94,    95,    96,    97,
++      98,    99,   100,   101,   102,   103,   104,   105,   106,   107,
++     108,   472,   473,   474,   475,   476,   477,   478,   479,   482,
++     483,   109,  -156,  -156,   449,   450,   246,   453,  -156,  -156,
++     484,   492,   493,   494,   495,   482,   497,   498,   499,   485,
++     486,   145,   487,  -156,  -156,   488,   489,   490,   491,   512,
++    -156,   513,   514,   515,   501,   517,   503,   518,   519,   520,
++     504,   328,   343,   155,   156,   157,   158,   159,   160,   161,
++     530,   531,   532,   533,   534,   505,   328,   536,   162,    32,
++      33,    34,    35,    36,    37,   544,   268,   546,    86,   506,
++     507,   549,   509,   269,   270,   271,   272,   328,   510,   522,
++     273,   557,   523,   559,    33,    34,    35,    36,    37,   563,
++     328,   525,   328,   391,   392,   393,   394,   395,   396,   397,
++     398,   526,   527,   529,   328,   537,   406,   407,   408,   539,
++     540,   543,   328,   553,   555,   328,   353,   354,   355,   356,
 +     357,   358,   359,   360,   361,   362,   363,   364,   365,   366,
 +     367,   368,   369,   370,   410,   411,   412,   413,   414,   415,
 +     416,   417,   418,   419,   420,   421,   422,   423,   424,   425,
-      426,   427,    94,    95,    96,    97,    98,    99,   100,   101,
-      102,   103,   104,   105,   106,   107,   108,    31,    32,    33,
-       34,    35,    36,    37,   371,     0,     0,   109,     0,    84,
-      391,   392,   393,   394,   395,   396,   397,   398,     0,     0,
-        0,     0,   428,   406,   407,   408,     0,   439,   440,   441,
-      442,   443,   444,   445,   446,     0,     0,     0,     0,     0,
-      454,   455,   456,    31,    32,    33,    34,    35,    36,    37,
-       73,    74,    75,    76,    77,    78,    79
++     426,   427,   439,   440,   441,   442,   443,   444,   445,   446,
++     316,   561,   562,   127,   521,   454,   455,   456,   132,   133,
++     496,   135,   136,   137,   371,   139,   140,    31,    32,    33,
++      34,    35,    36,    37,   338,   250,   292,   261,     0,    84,
++       0,     0,   428,    73,    74,    75,    76,    77,    78,    79
  };
  
  static const short yycheck[] =
  {
-        2,    13,   172,    22,   276,     0,     6,   276,     6,   531,
-      238,    80,   534,   296,    81,   301,     3,     4,     5,    83,
-        7,    23,   544,     4,     5,     6,    93,    93,     9,    93,
-       10,    11,    12,    20,    14,    93,   308,     4,     5,   308,
-      326,   333,    41,     4,     5,     6,     7,   217,   331,   335,
 -       1,    20,     6,   236,     6,    41,    42,   116,   299,     3,
 -       4,     5,   274,     7,    41,     4,     5,   534,   294,    81,
 -      21,    80,   527,   274,   274,   530,    20,   360,   361,   546,
 -     363,    93,    11,   324,    93,   540,     4,     5,     4,     5,
 -       6,    80,   333,   334,   306,    81,   563,     4,     5,     6,
 -       7,   284,   285,   329,    81,   306,   306,   348,     4,     5,
 -      60,   170,    93,    63,    64,    83,     4,     5,     6,   552,
 -      64,     9,    76,    92,    76,    80,   559,    95,    97,    98,
 -      80,   564,    83,    51,    52,    53,    54,    55,    56,    57,
 -       4,     5,    86,    87,    95,    96,    90,    91,     4,     5,
 -      94,     7,    91,    93,   105,    94,   215,   108,   109,   110,
 -     343,     4,     5,   114,     6,    81,    88,    89,    86,    87,
 -      86,    87,    90,    91,    90,    91,    94,    80,    94,    86,
 -      87,    74,    75,    90,    91,    81,     6,    94,    81,    60,
 -      86,    87,    63,    64,    90,    91,   147,   148,    94,    87,
 -      93,   331,   153,   154,   155,   156,   157,   158,   159,    80,
 -     161,   162,    93,   164,   183,    93,     4,     5,     6,   349,
 -      60,    93,    93,    63,    64,     4,     5,     6,    93,    83,
 -      86,    87,   362,    60,    90,    91,    63,    64,    94,    93,
 -      80,   192,   193,    86,    87,    93,   487,    90,    91,   200,
 -     201,    94,    83,    80,    83,   206,   207,    93,     4,     5,
 -       6,   502,    93,     9,    93,    83,     6,   247,    93,   249,
 -     250,   251,   252,   253,   254,    93,   406,     6,   229,   230,
 -     231,    83,   523,   234,    93,   236,    93,   238,   239,   419,
 -      60,    93,    93,    63,    64,   536,    93,   538,    86,    87,
 -      93,    60,    90,    91,    63,    64,    94,    86,    87,   550,
 -      80,    90,    91,   264,    80,    94,    15,   558,     4,     5,
 -     561,    80,    21,     6,   275,   384,   385,   307,     4,     5,
 -      74,    75,    93,   284,   285,   286,   287,    81,    93,     4,
 -     399,    87,     7,    93,   295,    10,    11,    12,    13,    14,
 -      15,    16,    17,    18,    19,    93,    21,    22,    23,    58,
 -      59,    60,    61,    62,    63,    64,    93,    93,    60,   298,
 -     299,    63,    64,   432,   433,    93,    93,    15,   541,   330,
 -      93,    80,    93,    21,     6,     7,     8,    93,   447,   552,
 -     341,    93,   343,   344,   323,   324,   559,    93,     6,    74,
 -      75,   564,    93,    93,   333,   334,    81,     6,   359,   360,
 -     361,    83,   363,    78,     6,     6,    93,    82,    93,   348,
 -      58,    59,    60,    61,    62,    63,    64,    93,     6,    51,
 -      52,    53,    54,    55,    56,    57,    93,    93,    47,    48,
 -      49,     6,    80,    23,    24,    25,    26,    27,    28,    29,
 -      30,    31,    32,    33,    34,    35,    36,    37,    38,    39,
 -      40,    93,    93,    72,    73,   416,   417,   418,    77,   420,
 -      86,    87,    88,    89,   425,   426,   427,   428,   429,   430,
 -      23,    24,    25,    26,    27,    28,    29,    30,    31,    32,
 -      33,    34,    35,    36,    37,    38,    39,    40,     8,     9,
 -      10,    81,    12,    85,    86,    87,    88,    89,   459,   460,
 -     461,   462,   463,   464,   465,   466,   467,    93,    93,    29,
 -      30,    31,    32,    33,    34,    35,    93,    93,   479,   480,
 -     481,   482,   483,   484,   485,   486,    93,    60,    81,    93,
 -      63,    64,    93,    93,    74,    75,   497,    93,   499,   500,
 -     501,    81,   503,    93,   505,   506,   507,    80,   487,    74,
 -      75,    93,    93,     0,    93,    80,    81,   518,   519,   520,
 -     521,   522,    76,   502,   525,    79,    93,    81,    93,    93,
 -      93,    93,   533,    36,   535,    93,    93,    93,   539,     0,
 -      43,    44,    45,    46,   523,    93,    93,    50,   549,    93,
 -     551,   417,   418,    93,   420,    93,   557,   536,    93,   538,
 -     351,   352,   353,   354,   355,   356,   357,   358,    93,    93,
 -      93,   550,    93,   364,   365,   366,    93,    93,    93,   558,
 -      93,    93,   561,    38,    39,    40,    41,    42,    43,    44,
 -      45,    46,    47,    48,    49,    50,    51,    52,   408,   409,
 -     410,   411,   412,   413,   414,   415,    16,   226,    63,    28,
 -     293,   421,   422,   423,    65,    66,    67,    68,    69,    70,
 -      71,   509,    94,   483,   232,   237,   306,    99,   100,    80,
 -     102,   103,   104,   262,   106,   107,    83,    84,    85,    86,
 -      87,    88,    89,    -1,    -1,    -1,    -1,    -1,    95,    83,
 -      84,    85,    86,    87,    88,    89,    51,    52,    53,    54,
 -      55,    56,    57,    84,    85,    86,    87,    88,    89
++       2,    13,    22,   276,   296,     6,     6,   118,    41,    42,
++     238,     0,    74,    75,    80,   301,     3,     4,     5,    81,
++       7,    23,   249,    80,   251,   252,   253,   254,   255,   256,
++      10,    11,    12,    20,    14,   308,    93,     4,     5,   331,
++     326,     4,     5,     4,     5,     6,     7,    93,    81,   335,
 +     336,    31,    32,    33,    34,    35,    36,    37,   286,   287,
-       83,   353,   276,    83,    74,    75,   352,     4,     5,     6,
-       93,    81,     9,    93,   366,    94,    76,    64,    76,    83,
-       99,   100,    81,    85,    51,    52,    53,    54,    55,    56,
-       57,    95,    41,    42,   308,    97,    98,     4,     5,    86,
-       87,     4,     5,    90,    91,   107,    87,    94,   110,   111,
-      112,    83,     4,     5,   116,    88,    89,   345,   410,    86,
-       87,    93,   538,    90,    91,    86,    87,    94,    93,    90,
-       91,   423,    81,    94,   550,    93,   249,   250,   251,   252,
-      253,   254,   255,    93,    47,    48,    49,   149,   150,   545,
-       87,   567,    93,   155,   156,   157,   158,   159,   160,   161,
-      556,   163,   164,    83,   166,     6,   185,   563,    93,    72,
-       73,    93,   568,    93,    77,     4,     5,     6,    47,    48,
-       49,    93,    60,    86,    87,    63,    64,    90,    91,    81,
-        6,    94,   194,   195,    86,    87,   309,    93,    90,    91,
-      202,   203,    94,    72,    73,   491,   208,   209,    77,    93,
-        4,     5,    60,     7,    93,    63,    64,     6,   388,   389,
-      506,     4,     5,     6,    86,    87,    88,    89,   556,   231,
-      232,   233,    80,   403,   236,   563,   238,     6,   240,   241,
-      568,   527,     4,     5,     6,    93,    74,    75,   364,   365,
-       93,   367,    81,    81,   540,    93,   542,    86,    87,    93,
-       93,    90,    91,    93,   266,    94,   436,   437,   554,    93,
-       60,     4,     5,    63,    64,   277,   562,    76,    93,   565,
-       79,   451,    81,    80,   286,   287,   288,   289,     4,     5,
-       80,    93,    86,    87,    80,   297,    90,    91,     4,     5,
-       94,    80,    60,    86,    87,    63,    64,    90,    91,   421,
-      422,    94,   424,   325,    60,     4,     5,    63,    64,    93,
-      300,   301,    80,    93,    86,    87,    93,    93,    90,    91,
-      332,     6,    94,    60,    80,     6,    63,    64,    93,    93,
-       93,   343,    93,   345,   346,   325,   326,    60,    83,    93,
-       63,    64,    93,    80,    93,   335,   336,     6,     6,     6,
-        6,   363,   364,   365,    93,   367,     6,    80,    93,    93,
-       86,    87,   352,    60,    90,    91,    63,    64,    94,    93,
-       86,    87,    93,    93,    90,    91,    93,    18,    94,    93,
-       93,    15,    93,    80,    93,    93,     4,    21,    93,     7,
-       93,    93,    10,    11,    12,    13,    14,    15,    16,    17,
-       18,    19,    93,    21,    22,    23,    93,    93,   420,   421,
-      422,    93,   424,    93,    93,    93,    93,   429,   430,   431,
-      432,   433,   434,    93,    58,    59,    60,    61,    62,    63,
-       64,    36,    85,    86,    87,    88,    89,    15,    43,    44,
-       45,    46,    93,    21,    93,    50,    80,    93,    93,    93,
-       93,   463,   464,   465,   466,   467,   468,   469,   470,   471,
-       78,    93,    93,    93,    82,    84,    85,    86,    87,    88,
-       89,   483,   484,   485,   486,   487,   488,   489,   490,    93,
-       58,    59,    60,    61,    62,    63,    64,    93,    30,   501,
-       93,   503,   504,   505,    93,   507,    93,   509,   510,   511,
-       93,   491,    80,    65,    66,    67,    68,    69,    70,    71,
-      522,   523,   524,   525,   526,   513,   506,   529,    80,    93,
-        6,     7,     8,    93,   228,   537,   295,   539,   235,   487,
-      308,   543,   264,   239,    -1,    -1,    -1,   527,    -1,    -1,
-       -1,   553,    -1,   555,    -1,    -1,    -1,    -1,    96,   561,
-      540,    -1,   542,   101,   102,    -1,   104,   105,   106,    -1,
-      108,   109,    -1,    -1,   554,    51,    52,    53,    54,    55,
-       56,    57,   562,    -1,    -1,   565,    23,    24,    25,    26,
++      81,   172,     4,     5,     6,   276,   352,     9,     4,     5,
++       6,    41,    93,     9,    94,    76,    76,    64,    93,    99,
++     100,     6,   309,    85,    51,    52,    53,    54,    55,    56,
++      57,     4,     5,     6,    93,    97,    98,   308,    60,    86,
++      87,    63,    64,    90,    91,   107,   217,    94,   110,   111,
++     112,    81,     4,     5,   116,    74,    75,   345,    80,    86,
++      87,    93,    81,    90,    91,    86,    87,    94,   276,    90,
++      91,     4,     5,    94,     7,    93,    76,    88,    89,    79,
++     538,    81,     4,     5,    93,    87,    60,   149,   150,    63,
++      64,    87,   550,   155,   156,   157,   158,   159,   160,   161,
++     308,   163,   164,    93,   166,   185,    80,    93,    81,   567,
++     333,     4,     5,    86,    87,   556,    83,    90,    91,    93,
++      80,    94,   563,     4,     5,     6,   545,   568,    95,    81,
++     353,    93,   194,   195,    86,    87,    93,   556,    90,    91,
++     202,   203,    94,   366,   563,   491,   208,   209,    93,   568,
++      93,     4,     5,    86,    87,     6,    93,    90,    91,     6,
++     506,    94,     4,     5,     6,    47,    48,    49,     6,   231,
++     232,   233,     4,     5,   236,    93,   238,    93,   240,   241,
++     531,   527,    60,   534,    93,    63,    64,   410,    83,    83,
++      72,    73,    93,   544,   540,    77,   542,    83,    93,    93,
++     423,    93,    80,    93,   266,    86,    87,    93,   554,    90,
++      91,    83,    83,    94,    80,   277,   562,   388,   389,   565,
++      80,    93,    93,    93,   286,   287,   288,   289,     6,     7,
++       8,    93,   403,    86,    87,   297,    60,    90,    91,    63,
++      64,    94,     6,    60,    86,    87,    63,    64,    90,    91,
++      93,     6,    94,   325,    86,    87,    80,    93,    90,    91,
++     300,   301,    94,    80,    93,   436,   437,    93,    60,    83,
++     332,    63,    64,    51,    52,    53,    54,    55,    56,    57,
++     451,   343,    93,   345,   346,   325,   326,    15,    80,    93,
++      74,    75,    93,    21,    93,   335,   336,    81,    15,    93,
++       6,   363,   364,   365,    21,   367,     6,     4,     6,    93,
++       7,    93,   352,    10,    11,    12,    13,    14,    15,    16,
++      17,    18,    19,    93,    21,    22,    23,    93,     6,     6,
++      58,    59,    60,    61,    62,    63,    64,    86,    87,    88,
++      89,    58,    59,    60,    61,    62,    63,    64,   364,   365,
++      93,   367,    80,    60,    93,    93,    63,    64,   420,   421,
++     422,    60,   424,    80,    63,    64,    93,   429,   430,   431,
++     432,   433,   434,    80,    83,    84,    85,    86,    87,    88,
++      89,    78,    93,    93,    18,    82,    40,    41,    42,    43,
++      44,    45,    46,    47,    48,    49,    50,    51,    52,    53,
++      54,   463,   464,   465,   466,   467,   468,   469,   470,   471,
++      93,    65,    74,    75,   421,   422,   228,   424,    80,    81,
++      93,   483,   484,   485,   486,   487,   488,   489,   490,    93,
++      93,    93,    93,    74,    75,    93,    93,    93,    93,   501,
++      81,   503,   504,   505,    93,   507,    93,   509,   510,   511,
++      93,   491,    93,    65,    66,    67,    68,    69,    70,    71,
++     522,   523,   524,   525,   526,    93,   506,   529,    80,    84,
++      85,    86,    87,    88,    89,   537,    36,   539,    30,    93,
++      93,   543,    93,    43,    44,    45,    46,   527,    93,    93,
++      50,   553,    93,   555,    85,    86,    87,    88,    89,   561,
++     540,    93,   542,   355,   356,   357,   358,   359,   360,   361,
++     362,    93,    93,    93,   554,    93,   368,   369,   370,    93,
++      93,    93,   562,    93,    93,   565,    23,    24,    25,    26,
 +      27,    28,    29,    30,    31,    32,    33,    34,    35,    36,
 +      37,    38,    39,    40,    23,    24,    25,    26,    27,    28,
 +      29,    30,    31,    32,    33,    34,    35,    36,    37,    38,
-       39,    40,    40,    41,    42,    43,    44,    45,    46,    47,
-       48,    49,    50,    51,    52,    53,    54,    83,    84,    85,
-       86,    87,    88,    89,    81,    -1,    -1,    65,    -1,    95,
-      355,   356,   357,   358,   359,   360,   361,   362,    -1,    -1,
-       -1,    -1,    81,   368,   369,   370,    -1,   412,   413,   414,
-      415,   416,   417,   418,   419,    -1,    -1,    -1,    -1,    -1,
-      425,   426,   427,    83,    84,    85,    86,    87,    88,    89,
-       51,    52,    53,    54,    55,    56,    57
++      39,    40,   412,   413,   414,   415,   416,   417,   418,   419,
++     295,    93,    93,    96,   513,   425,   426,   427,   101,   102,
++     487,   104,   105,   106,    81,   108,   109,    83,    84,    85,
++      86,    87,    88,    89,   308,   234,   264,   239,    -1,    95,
++      -1,    -1,    81,    51,    52,    53,    54,    55,    56,    57
  };
 -/* -*-C-*-  Note some compilers choke on comments on `#line' lines.  */
 -#line 3 "/usr/share/bison/bison.simple"
 -
 -/* Skeleton output parser for bison,
 -
 -   Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 Free Software
 -   Foundation, Inc.
 -
 -   This program is free software; you can redistribute it and/or modify
 -   it under the terms of the GNU General Public License as published by
 -   the Free Software Foundation; either version 2, or (at your option)
 -   any later version.
 -
 -   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., 59 Temple Place - Suite 330,
 -   Boston, MA 02111-1307, USA.  */
 -
 -/* As a special exception, when this file is copied by Bison into a
 -   Bison output file, you may use that output file without restriction.
 -   This special exception was added by the Free Software Foundation
 -   in version 1.24 of Bison.  */
 -
 -/* This is the parser code that is written into each bison parser when
 -   the %semantic_parser declaration is not specified in the grammar.
 -   It was written by Richard Stallman by simplifying the hairy parser
 -   used when %semantic_parser is specified.  */
 -
 -/* All symbols defined below should begin with yy or YY, to avoid
 -   infringing on user name space.  This should be done even for local
 -   variables, as they might otherwise be expanded by user macros.
 -   There are some unavoidable exceptions within include files to
 -   define necessary library symbols; they are noted "INFRINGES ON
 -   USER NAME SPACE" below.  */
 -
 -#if ! defined (yyoverflow) || defined (YYERROR_VERBOSE)
 -
 -/* The parser invokes alloca or malloc; define the necessary symbols.  */
 -
 -# if YYSTACK_USE_ALLOCA
 -#  define YYSTACK_ALLOC alloca
 -# else
 -#  ifndef YYSTACK_USE_ALLOCA
 -#   if defined (alloca) || defined (_ALLOCA_H)
 -#    define YYSTACK_ALLOC alloca
 -#   else
 -#    ifdef __GNUC__
 -#     define YYSTACK_ALLOC __builtin_alloca
 -#    endif
 -#   endif
 -#  endif
 -# endif
 -
 -# ifdef YYSTACK_ALLOC
 -   /* Pacify GCC's `empty if-body' warning. */
 -#  define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
 -# else
 -#  if defined (__STDC__) || defined (__cplusplus)
 -#   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
 -#   define YYSIZE_T size_t
 -#  endif
 -#  define YYSTACK_ALLOC malloc
 -#  define YYSTACK_FREE free
 -# endif
 -#endif /* ! defined (yyoverflow) || defined (YYERROR_VERBOSE) */
 -
 -
 -#if (! defined (yyoverflow) \
 -     && (! defined (__cplusplus) \
 -       || (YYLTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
 -
 -/* A type that is properly aligned for any stack member.  */
 -union yyalloc
 -{
 -  short yyss;
 -  YYSTYPE yyvs;
 -# if YYLSP_NEEDED
 -  YYLTYPE yyls;
 -# endif
 +/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
 +   symbol of state STATE-NUM.  */
 +static const unsigned char yystos[] =
 +{
 +       0,    97,    98,     0,     3,     4,     5,     7,    20,    64,
 +      86,    87,    90,    91,    94,    99,   151,   152,   175,   176,
 +     177,   101,   164,   100,   176,   176,   176,   177,   176,    80,
 +     101,    83,    84,    85,    86,    87,    88,    89,     4,     7,
 +      10,    11,    12,    13,    14,    15,    16,    17,    18,    19,
 +      21,    22,    23,    78,    82,   104,   106,   107,   108,   109,
 +     110,   111,   112,   113,   114,   115,   116,   121,   132,   142,
 +     146,   155,   162,    51,    52,    53,    54,    55,    56,    57,
 +     165,   166,   167,   175,    95,   153,   104,   176,   176,   176,
 +     176,   176,   176,   176,   164,   164,   164,   164,   164,   164,
 +     164,   164,   164,   164,   164,   164,   164,   164,   164,   164,
 +      60,    63,    64,   168,   169,   170,    93,    81,   175,   167,
 +       6,     7,     8,   105,   167,   171,   173,   173,   175,   175,
 +     167,   167,   173,   173,   156,   173,   173,   173,   175,   173,
 +     173,   175,   175,   175,   175,    93,   154,    80,    80,    93,
 +      93,    80,   143,    80,   147,    65,    66,    67,    68,    69,
 +      70,    71,    80,    93,    93,     6,   117,     4,     5,     6,
 +       9,    87,   172,   175,   175,   144,   148,   175,   175,   175,
 +     175,   175,   175,   175,   157,   175,   175,     6,    81,   175,
 +       4,     5,    81,   154,    93,    93,    74,    75,    81,    74,
 +      75,    81,    93,    93,    41,    81,   158,   167,    93,    93,
 +       4,     5,     6,     9,    87,   175,   175,     6,    76,     6,
 +       6,    76,     6,   175,   175,     6,    80,   175,   175,     4,
-        5,    93,    93,   154,    93,   145,    93,   149,    93,   150,
++       5,    93,    93,   154,   145,   154,    93,   149,    93,   150,
 +      93,    93,    80,   163,    93,   118,   118,   175,   175,   175,
-       47,    48,    49,    72,    73,    77,   143,   174,   175,   174,
++     143,    47,    48,    49,    72,    73,    77,   174,   175,   174,
 +     175,   147,   175,   175,   159,    76,    79,    81,    36,    43,
 +      44,    45,    46,    50,   119,   120,   122,    93,   139,   145,
 +     145,   145,   145,   145,   145,   145,    93,    93,    93,    93,
 +      42,    81,   158,   160,   175,    93,    15,    21,    58,    59,
 +      61,    62,    80,   128,   168,   169,   170,   175,   133,   174,
 +     175,   174,   175,   175,   175,     6,   120,     7,   102,   175,
 +     175,     6,   102,   103,     6,    91,    94,   130,   176,   130,
 +     123,    15,    21,    58,    59,    61,    62,    80,   128,   140,
 +     168,   169,   170,    93,   145,    93,    93,    93,   176,   177,
 +     130,   176,    83,    23,    24,    25,    26,    27,    28,    29,
 +      30,    31,    32,    33,    34,    35,    36,    37,    38,    39,
 +      40,    81,   102,   175,   103,     6,   130,   130,   134,   175,
 +     174,   175,     6,   161,   175,     6,    95,   130,   103,     6,
 +     124,   124,   124,   124,   124,   124,   124,   124,   124,   125,
 +     175,   125,   125,   103,   127,   125,   124,   124,   124,    93,
 +      23,    24,    25,    26,    27,    28,    29,    30,    31,    32,
 +      33,    34,    35,    36,    37,    38,    39,    40,    81,    93,
 +      93,   154,   154,    93,   154,     6,   103,     6,   136,   136,
 +     136,   136,   136,   136,   136,   136,   136,   137,   175,   137,
 +     137,   103,   135,   137,   136,   136,   136,   175,   175,   175,
 +     175,   175,   175,    93,   154,   154,    93,   154,    93,    93,
 +      93,    93,   175,   175,   175,   175,   175,   175,   175,   175,
 +       6,   131,   175,    93,    93,    93,    93,    93,    93,    93,
 +      93,    93,   175,   175,   175,   175,   131,   175,   175,   175,
 +     130,    93,   141,    93,    93,    93,    93,    93,   126,    93,
 +      93,    93,   175,   175,   175,   175,   130,   175,   175,   175,
 +     175,   126,    93,    93,    93,    93,    93,    93,   129,    93,
 +     175,   175,   175,   175,   175,   130,   175,    93,   129,    93,
 +      93,   129,    93,    93,   175,   139,   175,   130,   130,   175,
 +     129,   138,   171,    93,    93,    93,   139,   175,   130,   175,
 +     138,    93,    93,   175,   130,    93,   138,   130,   139,   138
  };
  
 -/* The size of the maximum gap between one aligned stack and the next.  */
 -# define YYSTACK_GAP_MAX (sizeof (union yyalloc) - 1)
 -
 -/* The size of an array large to enough to hold all stacks, each with
 -   N elements.  */
 -# if YYLSP_NEEDED
 -#  define YYSTACK_BYTES(N) \
 -     ((N) * (sizeof (short) + sizeof (YYSTYPE) + sizeof (YYLTYPE))    \
 -      + 2 * YYSTACK_GAP_MAX)
 -# else
 -#  define YYSTACK_BYTES(N) \
 -     ((N) * (sizeof (short) + sizeof (YYSTYPE))                               \
 -      + YYSTACK_GAP_MAX)
 -# endif
 -
 -/* Copy COUNT objects from FROM to TO.  The source and destination do
 -   not overlap.  */
 -# ifndef YYCOPY
 -#  if 1 < __GNUC__
 -#   define YYCOPY(To, From, Count) \
 -      __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
 -#  else
 -#   define YYCOPY(To, From, Count)            \
 -      do                                      \
 -      {                                       \
 -        register YYSIZE_T yyi;                \
 -        for (yyi = 0; yyi < (Count); yyi++)   \
 -          (To)[yyi] = (From)[yyi];            \
 -      }                                       \
 -      while (0)
 -#  endif
 -# endif
 -
 -/* Relocate STACK from its old location to the new one.  The
 -   local variables YYSIZE and YYSTACKSIZE give the old and new number of
 -   elements in the stack, and YYPTR gives the new location of the
 -   stack.  Advance YYPTR to a properly aligned location for the next
 -   stack.  */
 -# define YYSTACK_RELOCATE(Stack)                                      \
 -    do                                                                        \
 -      {                                                                       \
 -      YYSIZE_T yynewbytes;                                            \
 -      YYCOPY (&yyptr->Stack, Stack, yysize);                          \
 -      Stack = &yyptr->Stack;                                          \
 -      yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAX;   \
 -      yyptr += yynewbytes / sizeof (*yyptr);                          \
 -      }                                                                       \
 -    while (0)
 -
 -#endif
 -
 -
  #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
  # define YYSIZE_T __SIZE_TYPE__
  #endif
@@@ -3964,174 -3485,140 +3958,174 @@@ yyreduce
                        yyvsp[-1].raw->lvc.language = dup_language(currentlanguage);
  
                yyval.raw = yyvsp[-1].raw;
 -              }
 +              ;}
      break;
 -case 224:
 -#line 1795 "./parser.y"
 -{ yyval.raw = yyvsp[0].raw; }
 +
 +  case 225:
 +#line 1795 "parser.y"
 +    { yyval.raw = yyvsp[0].raw; ;}
      break;
 -case 225:
 -#line 1796 "./parser.y"
 -{ yyval.raw = int2raw_data(yyvsp[0].num); }
 +
 +  case 226:
 +#line 1796 "parser.y"
 +    { yyval.raw = int2raw_data(yyvsp[0].num); ;}
      break;
 -case 226:
 -#line 1797 "./parser.y"
 -{ yyval.raw = int2raw_data(-(yyvsp[0].num)); }
 +
 +  case 227:
 +#line 1797 "parser.y"
 +    { yyval.raw = int2raw_data(-(yyvsp[0].num)); ;}
      break;
 -case 227:
 -#line 1798 "./parser.y"
 -{ yyval.raw = long2raw_data(yyvsp[0].num); }
 +
 +  case 228:
 +#line 1798 "parser.y"
 +    { yyval.raw = long2raw_data(yyvsp[0].num); ;}
      break;
 -case 228:
 -#line 1799 "./parser.y"
 -{ yyval.raw = long2raw_data(-(yyvsp[0].num)); }
 +
 +  case 229:
 +#line 1799 "parser.y"
 +    { yyval.raw = long2raw_data(-(yyvsp[0].num)); ;}
      break;
 -case 229:
 -#line 1800 "./parser.y"
 -{ yyval.raw = str2raw_data(yyvsp[0].str); }
 +
 +  case 230:
 +#line 1800 "parser.y"
 +    { yyval.raw = str2raw_data(yyvsp[0].str); ;}
      break;
 -case 230:
 -#line 1801 "./parser.y"
 -{ yyval.raw = merge_raw_data(yyvsp[-2].raw, yyvsp[0].raw); free(yyvsp[0].raw->data); free(yyvsp[0].raw); }
 +
 +  case 231:
 +#line 1801 "parser.y"
 +    { yyval.raw = merge_raw_data(yyvsp[-2].raw, yyvsp[0].raw); free(yyvsp[0].raw->data); free(yyvsp[0].raw); ;}
      break;
 -case 231:
 -#line 1802 "./parser.y"
 -{ yyval.raw = merge_raw_data_int(yyvsp[-2].raw, yyvsp[0].num); }
 +
 +  case 232:
 +#line 1802 "parser.y"
 +    { yyval.raw = merge_raw_data_int(yyvsp[-2].raw, yyvsp[0].num); ;}
      break;
 -case 232:
 -#line 1803 "./parser.y"
 -{ yyval.raw = merge_raw_data_int(yyvsp[-3].raw, -(yyvsp[0].num)); }
 +
 +  case 233:
 +#line 1803 "parser.y"
 +    { yyval.raw = merge_raw_data_int(yyvsp[-3].raw, -(yyvsp[0].num)); ;}
      break;
 -case 233:
 -#line 1804 "./parser.y"
 -{ yyval.raw = merge_raw_data_long(yyvsp[-2].raw, yyvsp[0].num); }
 +
 +  case 234:
 +#line 1804 "parser.y"
 +    { yyval.raw = merge_raw_data_long(yyvsp[-2].raw, yyvsp[0].num); ;}
      break;
 -case 234:
 -#line 1805 "./parser.y"
 -{ yyval.raw = merge_raw_data_long(yyvsp[-3].raw, -(yyvsp[0].num)); }
 +
 +  case 235:
 +#line 1805 "parser.y"
 +    { yyval.raw = merge_raw_data_long(yyvsp[-3].raw, -(yyvsp[0].num)); ;}
      break;
 -case 235:
 -#line 1806 "./parser.y"
 -{ yyval.raw = merge_raw_data_str(yyvsp[-2].raw, yyvsp[0].str); }
 +
 +  case 236:
 +#line 1806 "parser.y"
 +    { yyval.raw = merge_raw_data_str(yyvsp[-2].raw, yyvsp[0].str); ;}
      break;
 -case 236:
 -#line 1810 "./parser.y"
 -{ yyval.raw = load_file(yyvsp[0].str,dup_language(currentlanguage)); }
 +
 +  case 237:
 +#line 1810 "parser.y"
 +    { yyval.raw = load_file(yyvsp[0].str,dup_language(currentlanguage)); ;}
      break;
 -case 237:
 -#line 1811 "./parser.y"
 -{ yyval.raw = yyvsp[0].raw; }
 +
 +  case 238:
 +#line 1811 "parser.y"
 +    { yyval.raw = yyvsp[0].raw; ;}
      break;
 -case 238:
 -#line 1818 "./parser.y"
 -{ yyval.iptr = 0; }
 +
 +  case 239:
 +#line 1818 "parser.y"
 +    { yyval.iptr = 0; ;}
      break;
 -case 239:
 -#line 1819 "./parser.y"
 -{ yyval.iptr = new_int(yyvsp[0].num); }
 +
 +  case 240:
 +#line 1819 "parser.y"
 +    { yyval.iptr = new_int(yyvsp[0].num); ;}
      break;
 -case 240:
 -#line 1823 "./parser.y"
 -{ yyval.num = (yyvsp[0].num); }
 +
 +  case 241:
 +#line 1823 "parser.y"
 +    { yyval.num = (yyvsp[0].num); ;}
      break;
 -case 241:
 -#line 1826 "./parser.y"
 -{ yyval.num = (yyvsp[-2].num) + (yyvsp[0].num); }
 +
 +  case 242:
 +#line 1826 "parser.y"
 +    { yyval.num = (yyvsp[-2].num) + (yyvsp[0].num); ;}
      break;
 -case 242:
 -#line 1827 "./parser.y"
 -{ yyval.num = (yyvsp[-2].num) - (yyvsp[0].num); }
 +
 +  case 243:
 +#line 1827 "parser.y"
 +    { yyval.num = (yyvsp[-2].num) - (yyvsp[0].num); ;}
      break;
 -case 243:
 -#line 1828 "./parser.y"
 -{ yyval.num = (yyvsp[-2].num) | (yyvsp[0].num); }
 +
 +  case 244:
 +#line 1828 "parser.y"
 +    { yyval.num = (yyvsp[-2].num) | (yyvsp[0].num); ;}
      break;
 -case 244:
 -#line 1829 "./parser.y"
 -{ yyval.num = (yyvsp[-2].num) & (yyvsp[0].num); }
 +
 +  case 245:
 +#line 1829 "parser.y"
 +    { yyval.num = (yyvsp[-2].num) & (yyvsp[0].num); ;}
      break;
 -case 245:
 -#line 1830 "./parser.y"
 -{ yyval.num = (yyvsp[-2].num) * (yyvsp[0].num); }
 +
 +  case 246:
 +#line 1830 "parser.y"
 +    { yyval.num = (yyvsp[-2].num) * (yyvsp[0].num); ;}
      break;
 -case 246:
 -#line 1831 "./parser.y"
 -{ yyval.num = (yyvsp[-2].num) / (yyvsp[0].num); }
 +
 +  case 247:
 +#line 1831 "parser.y"
 +    { yyval.num = (yyvsp[-2].num) / (yyvsp[0].num); ;}
      break;
 -case 247:
 -#line 1832 "./parser.y"
 -{ yyval.num = (yyvsp[-2].num) ^ (yyvsp[0].num); }
 +
 +  case 248:
 +#line 1832 "parser.y"
 +    { yyval.num = (yyvsp[-2].num) ^ (yyvsp[0].num); ;}
      break;
 -case 248:
 -#line 1833 "./parser.y"
 -{ yyval.num = ~(yyvsp[0].num); }
 +
 +  case 249:
 +#line 1833 "parser.y"
 +    { yyval.num = ~(yyvsp[0].num); ;}
      break;
 -case 249:
 -#line 1834 "./parser.y"
 -{ yyval.num = -(yyvsp[0].num); }
 +
 +  case 250:
 +#line 1834 "parser.y"
 +    { yyval.num = -(yyvsp[0].num); ;}
      break;
 -case 250:
 -#line 1835 "./parser.y"
 -{ yyval.num = yyvsp[0].num; }
 +
 +  case 251:
 +#line 1835 "parser.y"
 +    { yyval.num = yyvsp[0].num; ;}
      break;
 -case 251:
 -#line 1836 "./parser.y"
 -{ yyval.num = yyvsp[-1].num; }
 +
 +  case 252:
 +#line 1836 "parser.y"
 +    { yyval.num = yyvsp[-1].num; ;}
      break;
 -case 252:
 -#line 1837 "./parser.y"
 -{ yyval.num = yyvsp[0].num; }
 +
 +  case 253:
 +#line 1837 "parser.y"
 +    { yyval.num = yyvsp[0].num; ;}
      break;
 -case 253:
 -#line 1838 "./parser.y"
 -{ yyval.num = ~(yyvsp[0].num); }
 +
 +  case 254:
 +#line 1838 "parser.y"
 +    { yyval.num = ~(yyvsp[0].num); ;}
      break;
 -case 254:
 -#line 1841 "./parser.y"
 -{ yyval.num = yyvsp[0].num; }
 +
 +  case 255:
 +#line 1841 "parser.y"
 +    { yyval.num = yyvsp[0].num; ;}
      break;
 -case 255:
 -#line 1842 "./parser.y"
 -{ yyval.num = yyvsp[0].num; }
 +
 +  case 256:
 +#line 1842 "parser.y"
 +    { yyval.num = yyvsp[0].num; ;}
      break;
 -}
  
 -#line 705 "/usr/share/bison/bison.simple"
  
- #line 4135 "y.tab.c"
 +    }
 +
 +/* Line 999 of yacc.c.  */
++#line 4129 "y.tab.c"
  \f
    yyvsp -= yylen;
    yyssp -= yylen;