From: Casper Hornstrup Date: Thu, 5 May 2005 19:15:25 +0000 (+0000) Subject: Merge 14551:14980 from trunk X-Git-Tag: backups/xmlbuildsystem@15601~68 X-Git-Url: https://git.reactos.org/?p=reactos.git;a=commitdiff_plain;h=1fef01891cdb59b6ea8f9658eaa78a4daed70040 Merge 14551:14980 from trunk svn path=/branches/xmlbuildsystem/; revision=15017 --- 1fef01891cdb59b6ea8f9658eaa78a4daed70040 diff --cc reactos/apps/utils/net/finger/net.c index f007a79ccf2,ada9244631f..bb9c2c6107d --- a/reactos/apps/utils/net/finger/net.c +++ b/reactos/apps/utils/net/finger/net.c @@@ -33,7 -33,11 +33,6 @@@ * 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 #include #include "unistd.h" diff --cc reactos/drivers/dd/serial/devctrl.c index 72e8a5158f0,ee4c0bffc15..2f0f83c09e6 --- a/reactos/drivers/dd/serial/devctrl.c +++ b/reactos/drivers/dd/serial/devctrl.c @@@ -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 diff --cc reactos/drivers/dd/serial/pnp.c index 211f7ae4386,d990b685bcd..04e08f1af38 --- a/reactos/drivers/dd/serial/pnp.c +++ b/reactos/drivers/dd/serial/pnp.c @@@ -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); diff --cc reactos/drivers/input/directory.xml index 19e345a5aee,00000000000..b4a50d073e3 mode 100644,000000..100644 --- a/reactos/drivers/input/directory.xml +++ b/reactos/drivers/input/directory.xml @@@ -1,12 -1,0 +1,12 @@@ - - ++ ++ ++ ++ ++ + + + + - - - + + + diff --cc reactos/drivers/input/i8042prt/i8042prt.xml index 00000000000,00000000000..0a191737516 new file mode 100644 --- /dev/null +++ b/reactos/drivers/input/i8042prt/i8042prt.xml @@@ -1,0 -1,0 +1,13 @@@ ++ ++ ++ . ++ ++ ntoskrnl ++ hal ++ i8042prt.c ++ keyboard.c ++ mouse.c ++ ps2pp.c ++ registry.c ++ i8042prt.rc ++ diff --cc reactos/drivers/input/kbdclass/kbdclass.xml index 00000000000,00000000000..b0c834865d4 new file mode 100644 --- /dev/null +++ b/reactos/drivers/input/kbdclass/kbdclass.xml @@@ -1,0 -1,0 +1,9 @@@ ++ ++ ++ . ++ ++ ntoskrnl ++ hal ++ kbdclass.c ++ kbdclass.rc ++ diff --cc reactos/drivers/video/displays/vga/objects/copybits.c index ebd64c69b2f,ebd64c69b2f..7c274b01979 --- a/reactos/drivers/video/displays/vga/objects/copybits.c +++ b/reactos/drivers/video/displays/vga/objects/copybits.c @@@ -1,7 -1,7 +1,5 @@@ #include "../vgaddi.h" #include "../vgavideo/vgavideo.h" -- --#define DBG #include BOOL STDCALL diff --cc reactos/hal/halx86/generic/adapter.c index 5debe5d853c,5debe5d853c..80df33e4f17 --- a/reactos/hal/halx86/generic/adapter.c +++ b/reactos/hal/halx86/generic/adapter.c @@@ -19,6 -19,6 +19,9 @@@ #include #include ++/* Hmm, needed for KDBG := 1. Why? */ ++#undef KeGetCurrentIrql ++ /* FUNCTIONS *****************************************************************/ /* NOTE: IoAllocateAdapterChannel in NTOSKRNL.EXE */ diff --cc reactos/hal/halx86/generic/spinlock.c index 553e51c9d94,553e51c9d94..6d02d7c1c47 --- a/reactos/hal/halx86/generic/spinlock.c +++ b/reactos/hal/halx86/generic/spinlock.c @@@ -21,6 -21,6 +21,9 @@@ #include ++/* Hmm, needed for KDBG := 1. Why? */ ++#undef KeGetCurrentIrql ++ /* FUNCTIONS ***************************************************************/ VOID STDCALL diff --cc reactos/include/idl/idl.xml index 57f5d458fde,00000000000..3febc40eb56 mode 100644,000000..100644 --- a/reactos/include/idl/idl.xml +++ b/reactos/include/idl/idl.xml @@@ -1,12 -1,0 +1,24 @@@ + + . + w32api/include + + pnp.idl + + + . + w32api/include + + pnp.idl + ++ ++ . ++ w32api/include ++ ++ svcctl.idl ++ ++ ++ . ++ w32api/include ++ ++ svcctl.idl ++ diff --cc reactos/lib/advapi32/advapi32.xml index b80dbfdd701,00000000000..e7d5b0beaf6 mode 100644,000000..100644 --- a/reactos/lib/advapi32/advapi32.xml +++ b/reactos/lib/advapi32/advapi32.xml @@@ -1,49 -1,0 +1,52 @@@ + + + . ++ include/idl + + 0x600 + 0x0500 + 0x0501 ++ scm_client + ntdll + kernel32 ++ rpcrt4 + advapi32.h + + crypt.c + crypt_des.c + crypt_lmhash.c + crypt_md4.c + crypt_md5.c + crypt_sha.c + + + dllmain.c + hwprofiles.c + logon.c + shutdown.c + sysfunc.c + + + reg.c + + + ac.c + audit.c + lsa.c + misc.c + sec.c + sid.c + trustee.c + + + eventlog.c + scm.c + sctrl.c + undoc.c + + + privilege.c + token.c + + advapi32.rc + diff --cc reactos/lib/cpl/intl/intl.xml index cc89345b84c,00000000000..2ffa77ee084 mode 100644,000000..100644 --- a/reactos/lib/cpl/intl/intl.xml +++ b/reactos/lib/cpl/intl/intl.xml @@@ -1,21 -1,0 +1,21 @@@ - ++ + + . + + + + + 0x600 + 0x501 + kernel32 + user32 + comctl32 + currency.c + date.c + general.c + intl.c + locale.c + numbers.c + time.c + intl.rc + diff --cc reactos/lib/cpl/intl/locale.c index 86eecea69bb,87479c05a74..46118eab6b3 --- a/reactos/lib/cpl/intl/locale.c +++ b/reactos/lib/cpl/intl/locale.c @@@ -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; } diff --cc reactos/lib/directory.xml index 05fd22aa828,00000000000..a8ce08f18df mode 100644,000000..100644 --- a/reactos/lib/directory.xml +++ b/reactos/lib/directory.xml @@@ -1,285 -1,0 +1,291 @@@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ++ ++ ++ + + + ++ ++ ++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --cc reactos/lib/msi/msi.xml index 1514fca835d,00000000000..221c50fa42a mode 100644,000000..100644 --- a/reactos/lib/msi/msi.xml +++ b/reactos/lib/msi/msi.xml @@@ -1,52 -1,0 +1,53 @@@ + + + . + include/wine + + + 0x600 + 0x501 + 0x501 + wine + uuid + ntdll + kernel32 + user32 + gdi32 + advapi32 + shell32 + winmm + cabinet + ole32 + oleaut32 + version + action.c + appsearch.c + cond.tab.c + create.c + custom.c ++ database.c + delete.c + dialog.c + distinct.c + format.c + handle.c + insert.c + msi.c + msiquery.c + order.c + package.c + preview.c + record.c + registry.c + regsvr.c + select.c + sql.tab.c + string.c + suminfo.c + table.c + tokenize.c + update.c + where.c + msi.spec + msi.rc + diff --cc reactos/lib/ntdll/ntdll.xml index fcb08f18cd4,00000000000..96ac96c6f39 mode 100644,000000..100644 --- a/reactos/lib/ntdll/ntdll.xml +++ b/reactos/lib/ntdll/ntdll.xml @@@ -1,107 -1,0 +1,96 @@@ + + + + + + rtl + rosrtl + string + -lgcc + + capture.c + lpc.c + probe.c + thread.c + + + brkpoint.c + debug.c + print.c + + + entry.S + res.c + startup.c + utils.c + + + dllmain.c + + + - alldiv.s - allmul.s - allrem.s - allshl.s - allshr.s - aulldiv.s - aullrem.s - aullshr.s - exception.c - float.c + ftol.c + - access.c + apc.c + atom.c + callback.c + crc32.c + critical.c + dbgbuffer.c + exception.c + handle.c + intrlck.c + libsupp.c + math.c + message.c + misc.c + path.c + process.c + propvar.c + rangelist.c + resource.c + teb.c + timerqueue.c + + + sprintf.c + sscanf.c + swprintf.c + + + abs.c + atoi64.c + atoi.c + atol.c + bsearch.c + itoa.c + itow.c + labs.c + lfind.c + mbstowcs.c + splitp.c + strtol.c + strtoul.c + wcstol.c + wcstombs.c + wcstoul.c + wtoi64.c + wtoi.c + wtol.c + + + ctype.c + memicmp.c + stricmp.c + strlwr.c + strnicmp.c + strpbrk.c + strstr.c + strupr.c + wstring.c + + + ntdll.rc + + napi.S + diff --cc reactos/lib/rtl/rtl.xml index 9a689761b64,00000000000..189d2881222 mode 100644,000000..100644 --- a/reactos/lib/rtl/rtl.xml +++ b/reactos/lib/rtl/rtl.xml @@@ -1,39 -1,0 +1,48 @@@ + + ++ allshl.s ++ aulldiv.s ++ aullrem.s ++ allshr.s ++ allmul.s ++ aullshr.s ++ alldiv.s ++ allrem.s + chkstk.s + except.s + exception.c + ++ access.c + acl.c + bit.c + bitmap.c + bootdata.c + compress.c + dos8dot3.c + encode.c + env.c + error.c + exception.c + generictable.c + heap.c + image.c + largeint.c + luid.c + mem.c + network.c + nls.c + ppb.c + process.c + random.c + registry.c + sd.c + security.c + sid.c + splaytree.c + thread.c + time.c + timezone.c + unicode.c + unicodeprefix.c + version.c + diff --cc reactos/lib/wininet/wininet.xml index 00000000000,00000000000..cf0a497b46c new file mode 100644 --- /dev/null +++ b/reactos/lib/wininet/wininet.xml @@@ -1,0 -1,0 +1,34 @@@ ++ ++ ++ . ++ include/wine ++ ++ ++ ++ ++ 0x600 ++ 0x501 ++ 0x501 ++ wine ++ ntdll ++ kernel32 ++ user32 ++ advapi32 ++ shell32 ++ shlwapi ++ mpr ++ ws2_32 ++ cookie.c ++ dialogs.c ++ ftp.c ++ gopher.c ++ http.c ++ internet.c ++ netconnection.c ++ urlcache.c ++ utility.c ++ wininet_main.c ++ rsrc.rc ++ version.rc ++ wininet.spec ++ diff --cc reactos/ntoskrnl/kd/wrappers/gdbstub.c index 498ddb03636,1a1e47052b4..b74e401f063 --- a/reactos/ntoskrnl/kd/wrappers/gdbstub.c +++ b/reactos/ntoskrnl/kd/wrappers/gdbstub.c @@@ -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) { diff --cc reactos/ntoskrnl/ntoskrnl.xml index d9aa91760bb,00000000000..50a97cb71c8 mode 100644,000000..100644 --- a/reactos/ntoskrnl/ntoskrnl.xml +++ b/reactos/ntoskrnl/ntoskrnl.xml @@@ -1,367 -1,0 +1,348 @@@ + + + + + + + + include + include + csq + hal + kjs + pseh + rtl + rosrtl + string + rossym + + ntoskrnl.h + + + + + main.S + bios.c + brkpoint.c - bthread.S ++ ctxswitch.S + exp.c + fpu.c + gdt.c - i386-mcount.S + idt.c + irq.c + irqhand.s + kernel.c + ldt.c + stkswitch.S + syscall.S + thread.c + tlbflush.S + trap.s - tskswitch.S + tss.c + usercall.S + usertrap.c + v86m.c + v86m_sup.S + vdm.c + + + apc.c + bug.c + catch.c + clock.c + device.c + dpc.c + event.c ++ gate.c + gmutex.c + ipi.c + kqueue.c + kthread.c + main.c + mutex.c + process.c + profile.c + queue.c + sem.c + spinlock.c + timer.c + usercall.c + wait.c + + + cacheman.c + copy.c + fs.c + mdl.c + pin.c + view.c + + + import.c + ntfunc.c + regfile.c + registry.c + regobj.c + - ++ + + + + + i386-dis.c + kdb_help.S ++ longjmp.S ++ setjmp.S + + + + + + kdb.c ++ kdb_cli.c ++ kdb_expr.c + kdb_keyboard.c + kdb_serial.c - rdebug.c ++ kdb_string.c + + + kdb_symbols.c - profile.c + - dbgctrl.c - errinfo.c - print.c - user.c ++ ++ ++ dbgkutil.c ++ debug.c + + + + + interlck.c + + + callback.c ++ dbgctrl.c + error.c + event.c + evtpair.c + fmutex.c + handle.c + init.c + interlck.c + list.c + lookas.c + mutant.c + power.c + profile.c + resource.c + rundown.c + sem.c + synch.c + sysinfo.c + time.c + timer.c + util.c + uuid.c + win32k.c + work.c + zone.c + zw.S + + + dbcsname.c + filelock.c + mcb.c + mdl.c + name.c + notify.c + oplock.c + pool.c + tunnel.c + unc.c + util.c + + + inbv.c + + + adapter.c + arcname.c + bootlog.c - buildirp.c - cancel.c - cleanup.c - cntrller.c - create.c ++ controller.c + device.c + deviface.c - dir.c ++ disk.c + driver.c + efi.c - errlog.c + error.c + event.c + file.c - flush.c + fs.c + iocomp.c - ioctrl.c + iomgr.c + iowork.c + irp.c + irq.c - lock.c - mailslot.c + mdl.c - npipe.c - page.c - parttab.c + plugplay.c + pnpdma.c + pnpmgr.c + pnpnotify.c + pnpreport.c + pnproot.c - process.c - queue.c + rawfs.c + remlock.c + resource.c - rw.c + share.c - shutdown.c + symlink.c + timer.c + vpb.c - wdm.c + wmi.c - xhaldisp.c - xhaldrv.c + + - dlog.c - gdbstub.c - kdebug.c - mda.c - service.c ++ ++ bochs.c ++ gdbstub.c ++ ++ kdinit.c ++ kdio.c ++ kdmain.c + + + init.c + loader.c + resource.c + rtl.c + sysdll.c + userldr.c + + + close.c + complete.c + connect.c + create.c + listen.c + port.c + query.c + queue.c + receive.c + reply.c + send.c + + + + + memsafe.s + page.c + pfault.c + + + anonmem.c + aspace.c + balance.c + cont.c + drvlck.c + elf32.c + elf64.c + freelist.c + iospace.c + kmap.c + marea.c + mdl.c + mm.c ++ process.c + mminit.c + mpw.c + ncache.c + npool.c + pagefile.c + pageop.c + pager.c + pagfault.c + paging.c + pe.c + physical.c + pool.c + ppool.c + region.c + rmap.c + section.c + verifier.c + virtual.c + wset.c + + + dirobj.c + handle.c + namespc.c + ntobj.c + object.c + sdcache.c + security.c + symlink.c + wait.c + + + power.c + + + + + continue.c + + + cid.c - create.c + debug.c + idle.c + job.c + kill.c + locale.c ++ notify.c + process.c + psmgr.c + query.c ++ quota.c + security.c + suspend.c + thread.c + win32.c + + + + - alldiv.s - allmul.s - allrem.s - allshl.s - allshr.s - aulldiv.s - aullrem.s - aullshr.s + exception.c + seh.s + + + atom.c + capture.c + ctype.c ++ debug.c + handle.c + libsupp.c + message.c + misc.c + nls.c + purecall.c + rangelist.c + regio.c + sprintf.c + stdlib.c + string.c + strtok.c + swprintf.c + wstring.c + + + access.c + acl.c + audit.c + lsa.c + luid.c + priv.c + sd.c + semgr.c + sid.c + token.c + + ntoskrnl.rc + diff --cc reactos/services/eventlog/eventlog.c index 4da6ffcd263,4da6ffcd263..c5590fdbbf1 --- a/reactos/services/eventlog/eventlog.c +++ b/reactos/services/eventlog/eventlog.c @@@ -36,7 -36,7 +36,6 @@@ #include "eventlog.h" --#define DBG #define NDEBUG #include diff --cc reactos/services/umpnpmgr/umpnpmgr.c index a4b0b156595,f22ab5d3422..6781b497526 --- a/reactos/services/umpnpmgr/umpnpmgr.c +++ b/reactos/services/umpnpmgr/umpnpmgr.c @@@ -38,9 -38,9 +38,8 @@@ #include #include -#include "pnp.h" +#include "pnp_s.h" --#define DBG #define NDEBUG #include diff --cc reactos/subsys/system/cmd/cmd.xml index 2f372fdecc5,00000000000..66e4a9d0fa0 mode 100644,000000..100644 --- a/reactos/subsys/system/cmd/cmd.xml +++ b/reactos/subsys/system/cmd/cmd.xml @@@ -1,63 -1,0 +1,63 @@@ - ++ + include/wine + . + + + 0x0501 + kernel32 + precomp.h + alias.c + attrib.c + batch.c + beep.c + call.c + chcp.c + choice.c + cls.c + cmd.c + cmdinput.c + cmdtable.c + color.c + console.c + copy.c + date.c + del.c + delay.c + dir.c + dirstack.c + echo.c + error.c + filecomp.c + for.c + free.c + goto.c + history.c + if.c + internal.c + label.c + locale.c + memory.c + misc.c + move.c + msgbox.c + path.c + pause.c + prompt.c + redir.c + ren.c + screen.c + set.c + shift.c + start.c + strtoclr.c + time.c + timer.c + title.c + type.c + ver.c + verify.c + vol.c + where.c + window.c + cmd.rc + diff --cc reactos/subsys/system/services/services.xml index 46004e193ef,00000000000..8073ff8bf28 mode 100644,000000..100644 --- a/reactos/subsys/system/services/services.xml +++ b/reactos/subsys/system/services/services.xml @@@ -1,11 -1,0 +1,17 @@@ + + . ++ include/idl + ++ ++ ++ scm_server + ntdll + kernel32 + user32 + advapi32 - services.c ++ rpcrt4 + database.c ++ rpcserver.c ++ services.c + services.rc + diff --cc reactos/subsys/system/usetup/usetup.xml index 68b920bd0e3,00000000000..98a1a31ebe4 mode 100644,000000..100644 --- a/reactos/subsys/system/usetup/usetup.xml +++ b/reactos/subsys/system/usetup/usetup.xml @@@ -1,28 -1,0 +1,29 @@@ + + + . + . + + -lgcc + zlib + vfatlib + ntdll + precomp.h + bootsup.c + cabinet.c + console.c + drivesup.c + filequeue.c + filesup.c + format.c + fslist.c + genlist.c + infcache.c + inicache.c ++ keytrans.c + partlist.c + progress.c + registry.c + settings.c + usetup.c + usetup.rc + diff --cc reactos/tools/rbuild/backend/mingw/modulehandler.cpp index d18cf9eeee3,00000000000..a8c0c49da62 mode 100644,000000..100644 --- a/reactos/tools/rbuild/backend/mingw/modulehandler.cpp +++ b/reactos/tools/rbuild/backend/mingw/modulehandler.cpp @@@ -1,2912 -1,0 +1,2919 @@@ +#include "../../pch.h" +#include + +#include "../../rbuild.h" +#include "mingw.h" +#include "modulehandler.h" + +using std::string; +using std::vector; + +#define CLEAN_FILE(f) clean_files.push_back ( f ); + +static string ros_temp = "$(TEMPORARY)"; +MingwBackend* +MingwModuleHandler::backend = NULL; +FILE* +MingwModuleHandler::fMakefile = NULL; +bool +MingwModuleHandler::use_pch = false; + +string +PrefixFilename ( + const string& filename, + const string& prefix ) +{ + if ( !prefix.length() ) + return filename; + string out; + const char* pfilename = filename.c_str(); + const char* p1 = strrchr ( pfilename, '/' ); + const char* p2 = strrchr ( pfilename, '\\' ); + if ( p1 || p2 ) + { + if ( p2 > p1 ) + p1 = p2; + out += string(pfilename,p1-pfilename) + CSEP; + pfilename = p1 + 1; + } + out += prefix + pfilename; + return out; +} + +string +GetTargetMacro ( const Module& module, bool with_dollar ) +{ + string s ( module.name ); + strupr ( &s[0] ); + s += "_TARGET"; + if ( with_dollar ) + return ssprintf ( "$(%s)", s.c_str() ); + return s; +} + +MingwModuleHandler::MingwModuleHandler ( + const Module& module_ ) + + : module(module_) +{ +} + +MingwModuleHandler::~MingwModuleHandler() +{ +} + +/*static*/ void +MingwModuleHandler::SetBackend ( MingwBackend* backend_ ) +{ + backend = backend_; +} + +/*static*/ void +MingwModuleHandler::SetMakefile ( FILE* f ) +{ + fMakefile = f; +} + +/*static*/ void +MingwModuleHandler::SetUsePch ( bool b ) +{ + use_pch = b; +} + +/* static*/ string +MingwModuleHandler::RemoveVariables ( string path) +{ + size_t i = path.find ( '$' ); + if ( i != string::npos ) + { + size_t j = path.find ( ')', i ); + if ( j != string::npos ) + { + if ( j + 2 < path.length () && path[j + 1] == CSEP ) + return path.substr ( j + 2); + else + return path.substr ( j + 1); + } + } + return path; +} + +/*static*/ string +MingwModuleHandler::PassThruCacheDirectory ( + const string &file, + Directory* directoryTree ) +{ + string directory ( GetDirectory ( RemoveVariables ( file ) ) ); + string generatedFilesDirectory = backend->AddDirectoryTarget ( directory, + directoryTree ); + if ( directory.find ( generatedFilesDirectory ) != string::npos ) + /* This path already includes the generated files directory variable */ + return file; + else + return generatedFilesDirectory + SSEP + file; +} + +/*static*/ string +MingwModuleHandler::GetTargetFilename ( + const Module& module, + string_list* pclean_files ) +{ + string target = PassThruCacheDirectory ( + NormalizeFilename ( module.GetPath () ), + backend->outputDirectory ); + if ( pclean_files ) + { + string_list& clean_files = *pclean_files; + CLEAN_FILE ( target ); + } + return target; +} + +/*static*/ string +MingwModuleHandler::GetImportLibraryFilename ( + const Module& module, + string_list* pclean_files ) +{ + string target = PassThruCacheDirectory ( + NormalizeFilename ( module.GetDependencyPath () ), + backend->outputDirectory ); + if ( pclean_files ) + { + string_list& clean_files = *pclean_files; + CLEAN_FILE ( target ); + } + return target; +} + +/*static*/ MingwModuleHandler* +MingwModuleHandler::InstanciateHandler ( + const Module& module, + MingwBackend* backend ) +{ + MingwModuleHandler* handler; + switch ( module.type ) + { + case BuildTool: + handler = new MingwBuildToolModuleHandler ( module ); + break; + case StaticLibrary: + handler = new MingwStaticLibraryModuleHandler ( module ); + break; + case ObjectLibrary: + handler = new MingwObjectLibraryModuleHandler ( module ); + break; + case Kernel: + handler = new MingwKernelModuleHandler ( module ); + break; + case NativeCUI: + handler = new MingwNativeCUIModuleHandler ( module ); + break; + case Win32CUI: + handler = new MingwWin32CUIModuleHandler ( module ); + break; + case Win32GUI: + handler = new MingwWin32GUIModuleHandler ( module ); + break; + case KernelModeDLL: + handler = new MingwKernelModeDLLModuleHandler ( module ); + break; + case NativeDLL: + handler = new MingwNativeDLLModuleHandler ( module ); + break; + case Win32DLL: + handler = new MingwWin32DLLModuleHandler ( module ); + break; + case KernelModeDriver: + handler = new MingwKernelModeDriverModuleHandler ( module ); + break; + case BootLoader: + handler = new MingwBootLoaderModuleHandler ( module ); + break; + case BootSector: + handler = new MingwBootSectorModuleHandler ( module ); + break; + case Iso: + handler = new MingwIsoModuleHandler ( module ); + break; + case LiveIso: + handler = new MingwLiveIsoModuleHandler ( module ); + break; + case Test: + handler = new MingwTestModuleHandler ( module ); + break; + case RpcServer: + handler = new MingwRpcServerModuleHandler ( module ); + break; + case RpcClient: + handler = new MingwRpcClientModuleHandler ( module ); + break; + default: + throw UnknownModuleTypeException ( + module.node.location, + module.type ); + break; + } + return handler; +} + +string +MingwModuleHandler::GetWorkingDirectory () const +{ + return "."; +} + +string +MingwModuleHandler::GetBasename ( const string& filename ) const +{ + size_t index = filename.find_last_of ( '.' ); + if ( index != string::npos ) + return filename.substr ( 0, index ); + return ""; +} + +string +MingwModuleHandler::GetActualSourceFilename ( + const string& filename ) const +{ + string extension = GetExtension ( filename ); + if ( extension == ".spec" || extension == ".SPEC" ) + { + string basename = GetBasename ( filename ); + return PassThruCacheDirectory ( NormalizeFilename ( basename + ".stubs.c" ), + backend->intermediateDirectory ); + } + else if ( extension == ".idl" || extension == ".IDL" ) + { + string basename = GetBasename ( filename ); + string newname; + if ( module.type == RpcServer ) + newname = basename + "_s.c"; + else + newname = basename + "_c.c"; + return PassThruCacheDirectory ( NormalizeFilename ( newname ), + backend->intermediateDirectory ); + } + else + return filename; +} + +string +MingwModuleHandler::GetModuleArchiveFilename () const +{ + if ( module.type == StaticLibrary ) + return GetTargetFilename ( module, NULL ); + return PassThruCacheDirectory ( ReplaceExtension ( + NormalizeFilename ( module.GetPath () ), + ".temp.a" ), + backend->intermediateDirectory ); +} + +bool +MingwModuleHandler::IsGeneratedFile ( const File& file ) const +{ + string extension = GetExtension ( file.name ); + return ( extension == ".spec" || extension == ".SPEC" ); +} + +/*static*/ bool +MingwModuleHandler::ReferenceObjects ( + const Module& module ) +{ + if ( module.type == ObjectLibrary ) + return true; + if ( module.type == RpcServer ) + return true; + if ( module.type == RpcClient ) + return true; + return false; +} + +string +MingwModuleHandler::GetImportLibraryDependency ( + const Module& importedModule ) +{ + string dep; + if ( ReferenceObjects ( importedModule ) ) + dep = GetTargetMacro ( importedModule ); + else + dep = GetImportLibraryFilename ( importedModule, NULL ); + return dep; +} + +void +MingwModuleHandler::GetTargets ( const Module& dependencyModule, + string_list& targets ) +{ + if ( dependencyModule.invocations.size () > 0 ) + { + for ( size_t i = 0; i < dependencyModule.invocations.size (); i++ ) + { + Invoke& invoke = *dependencyModule.invocations[i]; + invoke.GetTargets ( targets ); + } + } + else + targets.push_back ( GetImportLibraryDependency ( dependencyModule ) ); +} + +void +MingwModuleHandler::GetModuleDependencies ( + string_list& dependencies ) +{ + size_t iend = module.dependencies.size (); + + if ( iend == 0 ) + return; + + for ( size_t i = 0; i < iend; i++ ) + { + const Dependency& dependency = *module.dependencies[i]; + const Module& dependencyModule = *dependency.dependencyModule; + GetTargets ( dependencyModule, + dependencies ); + } + GetDefinitionDependencies ( dependencies ); +} + +void +MingwModuleHandler::GetSourceFilenames ( + string_list& list, + bool includeGeneratedFiles ) const +{ + size_t i; + + const vector& files = module.non_if_data.files; + for ( i = 0; i < files.size (); i++ ) + { + if ( includeGeneratedFiles || !IsGeneratedFile ( *files[i] ) ) + { + list.push_back ( + GetActualSourceFilename ( files[i]->name ) ); + } + } + // intentionally make a copy so that we can append more work in + // the middle of processing without having to go recursive + vector v = module.non_if_data.ifs; + for ( i = 0; i < v.size (); i++ ) + { + size_t j; + If& rIf = *v[i]; + // check for sub-ifs to add to list + const vector& ifs = rIf.data.ifs; + for ( j = 0; j < ifs.size (); j++ ) + v.push_back ( ifs[j] ); + const vector& files = rIf.data.files; + for ( j = 0; j < files.size (); j++ ) + { + File& file = *files[j]; + if ( includeGeneratedFiles || !IsGeneratedFile ( file ) ) + { + list.push_back ( + GetActualSourceFilename ( file.name ) ); + } + } + } +} + +void +MingwModuleHandler::GetSourceFilenamesWithoutGeneratedFiles ( + string_list& list ) const +{ + GetSourceFilenames ( list, false ); +} + +string +MingwModuleHandler::GetObjectFilename ( + const string& sourceFilename, + string_list* pclean_files ) const +{ + Directory* directoryTree; + + string newExtension; + string extension = GetExtension ( sourceFilename ); + if ( extension == ".rc" || extension == ".RC" ) + newExtension = ".coff"; + else if ( extension == ".spec" || extension == ".SPEC" ) + newExtension = ".stubs.o"; + else if ( extension == ".idl" || extension == ".IDL" ) + { + if ( module.type == RpcServer ) + newExtension = "_s.o"; + else + newExtension = "_c.o"; + } + else + newExtension = ".o"; + + if ( module.type == BootSector ) + directoryTree = backend->outputDirectory; + else + directoryTree = backend->intermediateDirectory; + + string obj_file = PassThruCacheDirectory ( + NormalizeFilename ( ReplaceExtension ( + RemoveVariables ( sourceFilename ), + newExtension ) ), + directoryTree ); + if ( pclean_files ) + { + string_list& clean_files = *pclean_files; + CLEAN_FILE ( obj_file ); + } + return obj_file; +} + +void +MingwModuleHandler::GenerateCleanTarget () const +{ + if ( 0 == clean_files.size() ) + return; + fprintf ( fMakefile, ".PHONY: %s_clean\n", module.name.c_str() ); + fprintf ( fMakefile, "%s_clean:\n\t-@${rm}", module.name.c_str() ); + for ( size_t i = 0; i < clean_files.size(); i++ ) + { + if ( 9==((i+1)%10) ) + fprintf ( fMakefile, " 2>$(NUL)\n\t-@${rm}" ); + fprintf ( fMakefile, " %s", clean_files[i].c_str() ); + } + fprintf ( fMakefile, " 2>$(NUL)\n" ); + fprintf ( fMakefile, "clean: %s_clean\n\n", module.name.c_str() ); +} + +string +MingwModuleHandler::GetObjectFilenames () +{ + const vector& files = module.non_if_data.files; + if ( files.size () == 0 ) + return ""; + + string objectFilenames ( "" ); + for ( size_t i = 0; i < files.size (); i++ ) + { + if ( objectFilenames.size () > 0 ) + objectFilenames += " "; + objectFilenames += + GetObjectFilename ( files[i]->name, NULL ); + } + return objectFilenames; +} + +string +MingwModuleHandler::GenerateGccDefineParametersFromVector ( + const vector& defines ) const +{ + string parameters; + for ( size_t i = 0; i < defines.size (); i++ ) + { + Define& define = *defines[i]; + if (parameters.length () > 0) + parameters += " "; + parameters += "-D"; + parameters += define.name; + if (define.value.length () > 0) + { + parameters += "="; + parameters += define.value; + } + } + return parameters; +} + +string +MingwModuleHandler::GenerateGccDefineParameters () const +{ + string parameters = GenerateGccDefineParametersFromVector ( module.project.non_if_data.defines ); + string s = GenerateGccDefineParametersFromVector ( module.non_if_data.defines ); + if ( s.length () > 0 ) + { + parameters += " "; + parameters += s; + } + return parameters; +} + +string +MingwModuleHandler::ConcatenatePaths ( + const string& path1, + const string& path2 ) const +{ + if ( ( path1.length () == 0 ) || ( path1 == "." ) || ( path1 == "./" ) ) + return path2; + if ( path1[path1.length ()] == CSEP ) + return path1 + path2; + else + return path1 + CSEP + path2; +} + +string +MingwModuleHandler::GenerateGccIncludeParametersFromVector ( const vector& includes ) const +{ + string parameters; + for ( size_t i = 0; i < includes.size (); i++ ) + { + Include& include = *includes[i]; + if ( parameters.length () > 0 ) + parameters += " "; + parameters += "-I" + include.directory; + } + return parameters; +} + +string +MingwModuleHandler::GenerateGccIncludeParameters () const +{ + string parameters = GenerateGccIncludeParametersFromVector ( module.non_if_data.includes ); + string s = GenerateGccIncludeParametersFromVector ( module.project.non_if_data.includes ); + if ( s.length () > 0 ) + { + parameters += " "; + parameters += s; + } + return parameters; +} + + +string +MingwModuleHandler::GenerateCompilerParametersFromVector ( const vector& compilerFlags ) const +{ + string parameters; + for ( size_t i = 0; i < compilerFlags.size (); i++ ) + { + CompilerFlag& compilerFlag = *compilerFlags[i]; + if ( parameters.length () > 0 ) + parameters += " "; + parameters += compilerFlag.flag; + } + return parameters; +} + +string +MingwModuleHandler::GenerateLinkerParametersFromVector ( const vector& linkerFlags ) const +{ + string parameters; + for ( size_t i = 0; i < linkerFlags.size (); i++ ) + { + LinkerFlag& linkerFlag = *linkerFlags[i]; + if ( parameters.length () > 0 ) + parameters += " "; + parameters += linkerFlag.flag; + } + return parameters; +} + +string +MingwModuleHandler::GenerateImportLibraryDependenciesFromVector ( + const vector& libraries ) +{ + string dependencies ( "" ); + int wrap_count = 0; + for ( size_t i = 0; i < libraries.size (); i++ ) + { + if ( wrap_count++ == 5 ) + dependencies += " \\\n\t\t", wrap_count = 0; + else if ( dependencies.size () > 0 ) + dependencies += " "; + dependencies += GetImportLibraryDependency ( *libraries[i]->imported_module ); + } + return dependencies; +} + +string +MingwModuleHandler::GenerateLinkerParameters () const +{ + return GenerateLinkerParametersFromVector ( module.linkerFlags ); +} + +void +MingwModuleHandler::GenerateMacro ( + const char* assignmentOperation, + const string& macro, + const IfableData& data, + const vector* compilerFlags ) +{ + size_t i; + + fprintf ( + fMakefile, + "%s %s", + macro.c_str(), + assignmentOperation ); + + if ( compilerFlags != NULL ) + { + string compilerParameters = GenerateCompilerParametersFromVector ( *compilerFlags ); + if ( compilerParameters.size () > 0 ) + { + fprintf ( + fMakefile, + " %s", + compilerParameters.c_str () ); + } + } + + for ( i = 0; i < data.includes.size(); i++ ) + { + fprintf ( + fMakefile, + " -I%s", + data.includes[i]->directory.c_str() ); + } + for ( i = 0; i < data.defines.size(); i++ ) + { + Define& d = *data.defines[i]; + fprintf ( + fMakefile, + " -D%s", + d.name.c_str() ); + if ( d.value.size() ) + fprintf ( + fMakefile, + "=%s", + d.value.c_str() ); + } + fprintf ( fMakefile, "\n" ); +} + +void +MingwModuleHandler::GenerateMacros ( + const char* assignmentOperation, + const IfableData& data, + const vector* compilerFlags, + const vector* linkerFlags ) +{ + size_t i; + + if ( data.includes.size () > 0 || data.defines.size () > 0 ) + { + GenerateMacro ( assignmentOperation, + cflagsMacro, + data, + compilerFlags ); + GenerateMacro ( assignmentOperation, + windresflagsMacro, + data, + compilerFlags ); + } + + if ( linkerFlags != NULL ) + { + string linkerParameters = GenerateLinkerParametersFromVector ( *linkerFlags ); + if ( linkerParameters.size () > 0 ) + { + fprintf ( + fMakefile, + "%s %s %s\n", + linkerflagsMacro.c_str (), + assignmentOperation, + linkerParameters.c_str() ); + } + } + + if ( data.libraries.size () > 0 ) + { + string deps = GenerateImportLibraryDependenciesFromVector ( data.libraries ); + if ( deps.size () > 0 ) + { + fprintf ( + fMakefile, + "%s %s %s\n", + libsMacro.c_str(), + assignmentOperation, + deps.c_str() ); + } + } + + const vector& ifs = data.ifs; + for ( i = 0; i < ifs.size(); i++ ) + { + If& rIf = *ifs[i]; + if ( rIf.data.defines.size() + || rIf.data.includes.size() + || rIf.data.libraries.size() + || rIf.data.files.size() + || rIf.data.ifs.size() ) + { + fprintf ( + fMakefile, + "ifeq (\"$(%s)\",\"%s\")\n", + rIf.property.c_str(), + rIf.value.c_str() ); + GenerateMacros ( + "+=", + rIf.data, + NULL, + NULL ); + fprintf ( + fMakefile, + "endif\n\n" ); + } + } +} + +void +MingwModuleHandler::GenerateObjectMacros ( + const char* assignmentOperation, + const IfableData& data, + const vector* compilerFlags, + const vector* linkerFlags ) +{ + size_t i; + + const vector& files = data.files; + if ( files.size () > 0 ) + { + for ( i = 0; i < files.size (); i++ ) + { + File& file = *files[i]; + if ( file.first ) + { + fprintf ( fMakefile, + "%s := %s $(%s)\n", + objectsMacro.c_str(), + GetObjectFilename ( + file.name, NULL ).c_str (), + objectsMacro.c_str() ); + } + } + fprintf ( + fMakefile, + "%s %s", + objectsMacro.c_str (), + assignmentOperation ); + for ( i = 0; i < files.size(); i++ ) + { + File& file = *files[i]; + if ( !file.first ) + { + fprintf ( + fMakefile, + "%s%s", + ( i%10 == 9 ? " \\\n\t" : " " ), + GetObjectFilename ( + file.name, NULL ).c_str () ); + } + } + fprintf ( fMakefile, "\n" ); + } + + const vector& ifs = data.ifs; + for ( i = 0; i < ifs.size(); i++ ) + { + If& rIf = *ifs[i]; + if ( rIf.data.defines.size() + || rIf.data.includes.size() + || rIf.data.libraries.size() + || rIf.data.files.size() + || rIf.data.ifs.size() ) + { + fprintf ( + fMakefile, + "ifeq (\"$(%s)\",\"%s\")\n", + rIf.property.c_str(), + rIf.value.c_str() ); + GenerateObjectMacros ( + "+=", + rIf.data, + NULL, + NULL ); + fprintf ( + fMakefile, + "endif\n\n" ); + } + } +} + +void +MingwModuleHandler::GenerateGccCommand ( + const string& sourceFilename, + const string& cc, + const string& cflagsMacro ) +{ + string dependencies = sourceFilename; + if ( module.pch && use_pch ) + dependencies += " " + module.pch->header + ".gch"; + + /* WIDL generated headers may be used */ + dependencies += " " + GetLinkingDependenciesMacro (); + dependencies += " " + NormalizeFilename ( module.xmlbuildFile ); + + string objectFilename = GetObjectFilename ( + sourceFilename, &clean_files ); + fprintf ( fMakefile, + "%s: %s | %s\n", + objectFilename.c_str (), + dependencies.c_str (), + GetDirectory ( objectFilename ).c_str () ); + fprintf ( fMakefile, "\t$(ECHO_CC)\n" ); + fprintf ( fMakefile, + "\t%s -c $< -o $@ %s\n", + cc.c_str (), + cflagsMacro.c_str () ); +} + +void +MingwModuleHandler::GenerateGccAssemblerCommand ( + const string& sourceFilename, + const string& cc, + const string& cflagsMacro ) +{ + string dependencies = sourceFilename; + dependencies += " " + NormalizeFilename ( module.xmlbuildFile ); + string objectFilename = GetObjectFilename ( + sourceFilename, &clean_files ); + fprintf ( fMakefile, + "%s: %s | %s\n", + objectFilename.c_str (), + dependencies.c_str (), + GetDirectory ( objectFilename ).c_str () ); + fprintf ( fMakefile, "\t$(ECHO_GAS)\n" ); + fprintf ( fMakefile, + "\t%s -x assembler-with-cpp -c $< -o $@ -D__ASM__ %s\n", + cc.c_str (), + cflagsMacro.c_str () ); +} + +void +MingwModuleHandler::GenerateNasmCommand ( + const string& sourceFilename, + const string& nasmflagsMacro ) +{ + string dependencies = sourceFilename; + dependencies += " " + NormalizeFilename ( module.xmlbuildFile ); + string objectFilename = GetObjectFilename ( + sourceFilename, &clean_files ); + fprintf ( fMakefile, + "%s: %s | %s\n", + objectFilename.c_str (), + dependencies.c_str (), + GetDirectory ( objectFilename ).c_str () ); + fprintf ( fMakefile, "\t$(ECHO_NASM)\n" ); + fprintf ( fMakefile, + "\t%s -f win32 $< -o $@ %s\n", + "$(Q)nasm", + nasmflagsMacro.c_str () ); +} + +void +MingwModuleHandler::GenerateWindresCommand ( + const string& sourceFilename, + const string& windresflagsMacro ) +{ + string dependencies = sourceFilename; + dependencies += " " + NormalizeFilename ( module.xmlbuildFile ); + string objectFilename = + GetObjectFilename ( sourceFilename, &clean_files ); + string rciFilename = ros_temp + module.name + ".rci.tmp"; + string resFilename = ros_temp + module.name + ".res.tmp"; + if ( module.useWRC ) + { + fprintf ( fMakefile, + "%s: %s $(WRC_TARGET) | %s\n", + objectFilename.c_str (), + dependencies.c_str (), + GetDirectory ( objectFilename ).c_str () ); + fprintf ( fMakefile, "\t$(ECHO_WRC)\n" ); + fprintf ( fMakefile, + "\t${gcc} -xc -E -DRC_INVOKED ${%s} %s > %s\n", + windresflagsMacro.c_str (), + sourceFilename.c_str (), + rciFilename.c_str () ); + fprintf ( fMakefile, + "\t$(Q)$(WRC_TARGET) ${%s} %s %s\n", + windresflagsMacro.c_str (), + rciFilename.c_str (), + resFilename.c_str () ); + fprintf ( fMakefile, + "\t-@${rm} %s 2>$(NUL)\n", + rciFilename.c_str () ); + fprintf ( fMakefile, + "\t${windres} %s -o $@\n", + resFilename.c_str () ); + fprintf ( fMakefile, + "\t-@${rm} %s 2>$(NUL)\n", + resFilename.c_str () ); + } + else + { + fprintf ( fMakefile, + "%s: %s $(WRC_TARGET) | %s\n", + objectFilename.c_str (), + dependencies.c_str (), + GetDirectory ( objectFilename ).c_str () ); + fprintf ( fMakefile, "\t$(ECHO_WRC)\n" ); + fprintf ( fMakefile, + "\t${windres} $(%s) %s -o $@\n", + windresflagsMacro.c_str (), + sourceFilename.c_str () ); + } +} + +void +MingwModuleHandler::GenerateWinebuildCommands ( + const string& sourceFilename ) +{ + string dependencies = sourceFilename; + dependencies += " " + NormalizeFilename ( module.xmlbuildFile ); + + string basename = GetBasename ( sourceFilename ); + string def_file = PassThruCacheDirectory ( + basename + ".spec.def", + backend->intermediateDirectory ); + CLEAN_FILE(def_file); + + string stub_file = PassThruCacheDirectory ( + basename + ".stubs.c", + backend->intermediateDirectory ); + CLEAN_FILE(stub_file) + + fprintf ( fMakefile, + "%s: %s $(WINEBUILD_TARGET)\n", + def_file.c_str (), + dependencies.c_str () ); + fprintf ( fMakefile, "\t$(ECHO_WINEBLD)\n" ); + fprintf ( fMakefile, + "\t%s --def=%s -o %s\n", + "$(Q)$(WINEBUILD_TARGET)", + sourceFilename.c_str (), + def_file.c_str () ); + + fprintf ( fMakefile, + "%s: %s $(WINEBUILD_TARGET)\n", + stub_file.c_str (), + sourceFilename.c_str () ); + fprintf ( fMakefile, "\t$(ECHO_WINEBLD)\n" ); + fprintf ( fMakefile, + "\t%s --pedll=%s -o %s\n", + "$(Q)$(WINEBUILD_TARGET)", + sourceFilename.c_str (), + stub_file.c_str () ); +} + ++string ++MingwModuleHandler::GetWidlFlags ( const File& file ) ++{ ++ return file.switches; ++} ++ +void +MingwModuleHandler::GenerateWidlCommandsServer ( - const string& sourceFilename, ++ const File& file, + const string& widlflagsMacro ) +{ - string dependencies = sourceFilename; ++ string dependencies = file.name; + dependencies += " " + NormalizeFilename ( module.xmlbuildFile ); + - string basename = GetBasename ( sourceFilename ); ++ string basename = GetBasename ( file.name ); + + /*string generatedHeaderFilename = PassThruCacheDirectory ( + basename + ".h", + backend->intermediateDirectory ); + CLEAN_FILE(generatedHeaderFilename); + */ + string generatedHeaderFilename = basename + "_s.h"; + CLEAN_FILE(generatedHeaderFilename); + + string generatedServerFilename = PassThruCacheDirectory ( + basename + "_s.c", + backend->intermediateDirectory ); + CLEAN_FILE(generatedServerFilename); + + fprintf ( fMakefile, + "%s %s: %s $(WIDL_TARGET) | %s\n", + generatedServerFilename.c_str (), + generatedHeaderFilename.c_str (), + dependencies.c_str (), + GetDirectory ( generatedServerFilename ).c_str () ); + fprintf ( fMakefile, "\t$(ECHO_WIDL)\n" ); + fprintf ( fMakefile, - "\t%s %s -h -H %s -s -S %s %s\n", ++ "\t%s %s %s -h -H %s -s -S %s %s\n", + "$(Q)$(WIDL_TARGET)", ++ GetWidlFlags ( file ).c_str (), + widlflagsMacro.c_str (), + generatedHeaderFilename.c_str (), + generatedServerFilename.c_str (), - sourceFilename.c_str () ); ++ file.name.c_str () ); +} + +void +MingwModuleHandler::GenerateWidlCommandsClient ( - const string& sourceFilename, ++ const File& file, + const string& widlflagsMacro ) +{ - string dependencies = sourceFilename; ++ string dependencies = file.name; + dependencies += " " + NormalizeFilename ( module.xmlbuildFile ); + - string basename = GetBasename ( sourceFilename ); ++ string basename = GetBasename ( file.name ); + + /*string generatedHeaderFilename = PassThruCacheDirectory ( + basename + ".h", + backend->intermediateDirectory ); + CLEAN_FILE(generatedHeaderFilename); + */ + string generatedHeaderFilename = basename + "_c.h"; + CLEAN_FILE(generatedHeaderFilename); + + string generatedClientFilename = PassThruCacheDirectory ( + basename + "_c.c", + backend->intermediateDirectory ); + CLEAN_FILE(generatedClientFilename); + + fprintf ( fMakefile, + "%s %s: %s $(WIDL_TARGET) | %s\n", + generatedClientFilename.c_str (), + generatedHeaderFilename.c_str (), + dependencies.c_str (), + GetDirectory ( generatedClientFilename ).c_str () ); + fprintf ( fMakefile, "\t$(ECHO_WIDL)\n" ); + fprintf ( fMakefile, - "\t%s %s -h -H %s -c -C %s %s\n", ++ "\t%s %s %s -h -H %s -c -C %s %s\n", + "$(Q)$(WIDL_TARGET)", ++ GetWidlFlags ( file ).c_str (), + widlflagsMacro.c_str (), + generatedHeaderFilename.c_str (), + generatedClientFilename.c_str (), - sourceFilename.c_str () ); ++ file.name.c_str () ); +} + +void +MingwModuleHandler::GenerateWidlCommands ( - const string& sourceFilename, ++ const File& file, + const string& widlflagsMacro ) +{ + if ( module.type == RpcServer ) - GenerateWidlCommandsServer ( sourceFilename, ++ GenerateWidlCommandsServer ( file, + widlflagsMacro ); + else - GenerateWidlCommandsClient ( sourceFilename, ++ GenerateWidlCommandsClient ( file, + widlflagsMacro ); +} + +void +MingwModuleHandler::GenerateCommands ( - const string& sourceFilename, ++ const File& file, + const string& cc, + const string& cppc, + const string& cflagsMacro, + const string& nasmflagsMacro, + const string& windresflagsMacro, + const string& widlflagsMacro ) +{ - string extension = GetExtension ( sourceFilename ); ++ string extension = GetExtension ( file.name ); + if ( extension == ".c" || extension == ".C" ) + { - GenerateGccCommand ( sourceFilename, ++ GenerateGccCommand ( file.name, + cc, + cflagsMacro ); + return; + } + else if ( extension == ".cc" || extension == ".CC" || + extension == ".cpp" || extension == ".CPP" || + extension == ".cxx" || extension == ".CXX" ) + { - GenerateGccCommand ( sourceFilename, ++ GenerateGccCommand ( file.name, + cppc, + cflagsMacro ); + return; + } + else if ( extension == ".s" || extension == ".S" ) + { - GenerateGccAssemblerCommand ( sourceFilename, ++ GenerateGccAssemblerCommand ( file.name, + cc, + cflagsMacro ); + return; + } + else if ( extension == ".asm" || extension == ".ASM" ) + { - GenerateNasmCommand ( sourceFilename, ++ GenerateNasmCommand ( file.name, + nasmflagsMacro ); + return; + } + else if ( extension == ".rc" || extension == ".RC" ) + { - GenerateWindresCommand ( sourceFilename, ++ GenerateWindresCommand ( file.name, + windresflagsMacro ); + return; + } + else if ( extension == ".spec" || extension == ".SPEC" ) + { - GenerateWinebuildCommands ( sourceFilename ); - GenerateGccCommand ( GetActualSourceFilename ( sourceFilename ), ++ GenerateWinebuildCommands ( file.name ); ++ GenerateGccCommand ( GetActualSourceFilename ( file.name ), + cc, + cflagsMacro ); + return; + } + else if ( extension == ".idl" || extension == ".IDL" ) + { - GenerateWidlCommands ( sourceFilename, ++ GenerateWidlCommands ( file, + widlflagsMacro ); - GenerateGccCommand ( GetActualSourceFilename ( sourceFilename ), ++ GenerateGccCommand ( GetActualSourceFilename ( file.name ), + cc, + cflagsMacro ); + return; + } + + throw InvalidOperationException ( __FILE__, + __LINE__, + "Unsupported filename extension '%s' in file '%s'", + extension.c_str (), - sourceFilename.c_str () ); ++ file.name.c_str () ); +} + +void +MingwModuleHandler::GenerateBuildMapCode () +{ + fprintf ( fMakefile, + "ifeq ($(ROS_BUILDMAP),full)\n" ); + + string mapFilename = PassThruCacheDirectory ( + GetBasename ( module.GetPath () ) + ".map", + backend->outputDirectory ); + CLEAN_FILE ( mapFilename ); + + fprintf ( fMakefile, + "\t$(ECHO_OBJDUMP)\n" ); + fprintf ( fMakefile, + "\t$(Q)${objdump} -d -S $@ > %s\n", + mapFilename.c_str () ); + + fprintf ( fMakefile, + "else\n" ); + fprintf ( fMakefile, + "ifeq ($(ROS_BUILDMAP),yes)\n" ); + + fprintf ( fMakefile, + "\t$(ECHO_NM)\n" ); + fprintf ( fMakefile, + "\t$(Q)${nm} --numeric-sort $@ > %s\n", + mapFilename.c_str () ); + + fprintf ( fMakefile, + "endif\n" ); + + fprintf ( fMakefile, + "endif\n" ); +} + +void +MingwModuleHandler::GenerateBuildNonSymbolStrippedCode () +{ + fprintf ( fMakefile, + "ifeq ($(ROS_BUILDNOSTRIP),yes)\n" ); + + string filename = module.GetPath (); + string outputFilename = PassThruCacheDirectory ( + filename, + backend->outputDirectory ); + string nostripFilename = PassThruCacheDirectory ( + GetBasename ( filename ) + ".nostrip" + GetExtension ( filename ), + backend->outputDirectory ); + CLEAN_FILE ( nostripFilename ); + + fprintf ( fMakefile, + "\t$(ECHO_CP)\n" ); + fprintf ( fMakefile, + "\t${cp} %s %s 1>$(NUL)\n", + outputFilename.c_str (), + nostripFilename.c_str () ); + + fprintf ( fMakefile, + "endif\n" ); +} + +void +MergeStringVector ( const vector& input, + vector& output ) +{ + int wrap_at = 25; + string s; + int wrap_count = -1; + for ( size_t i = 0; i < input.size (); i++ ) + { + if ( input[i].size () == 0 ) + continue; + if ( wrap_count++ == wrap_at ) + { + output.push_back ( s ); + s = ""; + wrap_count = 0; + } + else if ( s.size () > 0) + s += " "; + s += input[i]; + } + if ( s.length () > 0 ) + output.push_back ( s ); +} + +void +MingwModuleHandler::GetObjectsVector ( const IfableData& data, + vector& objectFiles ) const +{ + for ( size_t i = 0; i < data.files.size (); i++ ) + { + File& file = *data.files[i]; + objectFiles.push_back ( GetObjectFilename ( file.name, NULL ) ); + } +} + +void +MingwModuleHandler::GenerateCleanObjectsAsYouGoCode () const +{ + if ( backend->cleanAsYouGo ) + { + vector objectFiles; + GetObjectsVector ( module.non_if_data, + objectFiles ); + vector lines; + MergeStringVector ( objectFiles, + lines ); + for ( size_t i = 0; i < lines.size (); i++ ) + { + fprintf ( fMakefile, + "\t-@${rm} %s 2>$(NUL)\n", + lines[i].c_str () ); + } + } +} + +void +MingwModuleHandler::GenerateLinkerCommand ( + const string& dependencies, + const string& linker, + const string& linkerParameters, + const string& objectsMacro, + const string& libsMacro ) +{ + string target ( GetTargetMacro ( module ) ); + string target_folder ( GetDirectory ( GetTargetFilename ( module, NULL ) ) ); + + fprintf ( fMakefile, + "%s: %s $(RSYM_TARGET) | %s\n", + target.c_str (), + dependencies.c_str (), + target_folder.c_str () ); + fprintf ( fMakefile, "\t$(ECHO_LD)\n" ); + string targetName ( module.GetTargetName () ); + if ( module.importLibrary != NULL ) + { + string base_tmp = ros_temp + module.name + ".base.tmp"; + CLEAN_FILE ( base_tmp ); + string junk_tmp = ros_temp + module.name + ".junk.tmp"; + CLEAN_FILE ( junk_tmp ); + string temp_exp = ros_temp + module.name + ".temp.exp"; + CLEAN_FILE ( temp_exp ); + string def_file = GetDefinitionFilename (); + + fprintf ( fMakefile, + "\t%s %s -Wl,--base-file,%s -o %s %s %s %s\n", + linker.c_str (), + linkerParameters.c_str (), + base_tmp.c_str (), + junk_tmp.c_str (), + objectsMacro.c_str (), + libsMacro.c_str (), + GetLinkerMacro ().c_str () ); + + fprintf ( fMakefile, + "\t-@${rm} %s 2>$(NUL)\n", + junk_tmp.c_str () ); + + string killAt = module.mangledSymbols ? "" : "--kill-at"; + fprintf ( fMakefile, + "\t${dlltool} --dllname %s --base-file %s --def %s --output-exp %s %s\n", + targetName.c_str (), + base_tmp.c_str (), + def_file.c_str (), + temp_exp.c_str (), + killAt.c_str () ); + + fprintf ( fMakefile, + "\t-@${rm} %s 2>$(NUL)\n", + base_tmp.c_str () ); + + fprintf ( fMakefile, + "\t%s %s %s -o %s %s %s %s\n", + linker.c_str (), + linkerParameters.c_str (), + temp_exp.c_str (), + target.c_str (), + objectsMacro.c_str (), + libsMacro.c_str (), + GetLinkerMacro ().c_str () ); + + fprintf ( fMakefile, + "\t-@${rm} %s 2>$(NUL)\n", + temp_exp.c_str () ); + + GenerateCleanObjectsAsYouGoCode (); + } + else + { + fprintf ( fMakefile, + "\t%s %s -o %s %s %s %s\n", + linker.c_str (), + linkerParameters.c_str (), + target.c_str (), + objectsMacro.c_str (), + libsMacro.c_str (), + GetLinkerMacro ().c_str () ); + + GenerateCleanObjectsAsYouGoCode (); + } + + GenerateBuildMapCode (); + + GenerateBuildNonSymbolStrippedCode (); + + fprintf ( fMakefile, + "\t$(ECHO_RSYM)\n" ); + fprintf ( fMakefile, + "\t$(Q)$(RSYM_TARGET) $@ $@\n\n" ); +} + +void +MingwModuleHandler::GeneratePhonyTarget() const +{ + string targetMacro ( GetTargetMacro(module) ); + fprintf ( fMakefile, ".PHONY: %s\n\n", + targetMacro.c_str ()); + fprintf ( fMakefile, "%s: | %s\n", + targetMacro.c_str (), + GetDirectory(GetTargetFilename(module,NULL)).c_str () ); +} + +void +MingwModuleHandler::GenerateObjectFileTargets ( + const IfableData& data, + const string& cc, + const string& cppc, + const string& cflagsMacro, + const string& nasmflagsMacro, + const string& windresflagsMacro, + const string& widlflagsMacro ) +{ + size_t i; + + const vector& files = data.files; + for ( i = 0; i < files.size (); i++ ) + { - string sourceFilename = files[i]->name; - GenerateCommands ( sourceFilename, ++ GenerateCommands ( *files[i], + cc, + cppc, + cflagsMacro, + nasmflagsMacro, + windresflagsMacro, + widlflagsMacro ); + fprintf ( fMakefile, + "\n" ); + } + + const vector& ifs = data.ifs; + for ( i = 0; i < ifs.size(); i++ ) + { + GenerateObjectFileTargets ( ifs[i]->data, + cc, + cppc, + cflagsMacro, + nasmflagsMacro, + windresflagsMacro, + widlflagsMacro ); + } +} + +void +MingwModuleHandler::GenerateObjectFileTargets ( + const string& cc, + const string& cppc, + const string& cflagsMacro, + const string& nasmflagsMacro, + const string& windresflagsMacro, + const string& widlflagsMacro ) +{ + if ( module.pch ) + { + const string& pch_file = module.pch->header; + string gch_file = pch_file + ".gch"; + CLEAN_FILE(gch_file); + if ( use_pch ) + { + fprintf ( + fMakefile, + "%s: %s\n", + gch_file.c_str(), + pch_file.c_str() ); + fprintf ( fMakefile, "\t$(ECHO_PCH)\n" ); + fprintf ( + fMakefile, + "\t%s -o %s %s -g %s\n\n", + ( module.cplusplus ? cppc.c_str() : cc.c_str() ), + gch_file.c_str(), + cflagsMacro.c_str(), + pch_file.c_str() ); + } + } + + GenerateObjectFileTargets ( module.non_if_data, + cc, + cppc, + cflagsMacro, + nasmflagsMacro, + windresflagsMacro, + widlflagsMacro ); + fprintf ( fMakefile, "\n" ); +} + +string +MingwModuleHandler::GenerateArchiveTarget ( const string& ar, + const string& objs_macro ) const +{ + string archiveFilename ( GetModuleArchiveFilename () ); + + fprintf ( fMakefile, + "%s: %s | %s\n", + archiveFilename.c_str (), + objs_macro.c_str (), + GetDirectory(archiveFilename).c_str() ); + + fprintf ( fMakefile, "\t$(ECHO_AR)\n" ); + + fprintf ( fMakefile, + "\t%s -rc $@ %s\n", + ar.c_str (), + objs_macro.c_str ()); + + GenerateCleanObjectsAsYouGoCode (); + + fprintf ( fMakefile, "\n" ); + + return archiveFilename; +} + +string +MingwModuleHandler::GetCFlagsMacro () const +{ + return ssprintf ( "$(%s_CFLAGS)", + module.name.c_str () ); +} + +/*static*/ string +MingwModuleHandler::GetObjectsMacro ( const Module& module ) +{ + return ssprintf ( "$(%s_OBJS)", + module.name.c_str () ); +} + +string +MingwModuleHandler::GetLinkingDependenciesMacro () const +{ + return ssprintf ( "$(%s_LINKDEPS)", module.name.c_str () ); +} + +string +MingwModuleHandler::GetLibsMacro () const +{ + return ssprintf ( "$(%s_LIBS)", module.name.c_str () ); +} + +string +MingwModuleHandler::GetLinkerMacro () const +{ + return ssprintf ( "$(%s_LFLAGS)", + module.name.c_str () ); +} + +string +MingwModuleHandler::GetModuleTargets ( const Module& module ) +{ + if ( ReferenceObjects ( module ) ) + return GetObjectsMacro ( module ); + else + return GetTargetFilename ( module, NULL ); +} + +void +MingwModuleHandler::GenerateObjectMacro () +{ + objectsMacro = ssprintf ("%s_OBJS", module.name.c_str ()); + + GenerateObjectMacros ( + "=", + module.non_if_data, + &module.compilerFlags, + &module.linkerFlags ); + + // future references to the macro will be to get its values + objectsMacro = ssprintf ("$(%s)", objectsMacro.c_str ()); +} + +void +MingwModuleHandler::GenerateTargetMacro () +{ + fprintf ( fMakefile, + "%s := %s\n", + GetTargetMacro ( module, false ).c_str (), + GetModuleTargets ( module ).c_str () ); +} + +void +MingwModuleHandler::GenerateOtherMacros () +{ + cflagsMacro = ssprintf ("%s_CFLAGS", module.name.c_str ()); + nasmflagsMacro = ssprintf ("%s_NASMFLAGS", module.name.c_str ()); + windresflagsMacro = ssprintf ("%s_RCFLAGS", module.name.c_str ()); + widlflagsMacro = ssprintf ("%s_WIDLFLAGS", module.name.c_str ()); + linkerflagsMacro = ssprintf ("%s_LFLAGS", module.name.c_str ()); + libsMacro = ssprintf("%s_LIBS", module.name.c_str ()); + linkDepsMacro = ssprintf ("%s_LINKDEPS", module.name.c_str ()); + + GenerateMacros ( + "=", + module.non_if_data, + &module.compilerFlags, + &module.linkerFlags ); + + if ( module.importLibrary ) + { + string_list s; + const vector& files = module.non_if_data.files; + for ( size_t i = 0; i < files.size (); i++ ) + { + File& file = *files[i]; + string extension = GetExtension ( file.name ); + if ( extension == ".spec" || extension == ".SPEC" ) + GetSpecObjectDependencies ( s, file.name ); + } + if ( s.size () > 0 ) + { + fprintf ( + fMakefile, + "%s +=", + linkDepsMacro.c_str() ); + for ( size_t i = 0; i < s.size(); i++ ) + fprintf ( fMakefile, + " %s", + s[i].c_str () ); + fprintf ( fMakefile, "\n" ); + } + } + + string globalCflags = "-g"; + if ( backend->usePipe ) + globalCflags += " -pipe"; + if ( !module.enableWarnings ) + globalCflags += " -Werror"; + + fprintf ( + fMakefile, + "%s += $(PROJECT_CFLAGS) %s\n", + cflagsMacro.c_str (), + globalCflags.c_str () ); + + fprintf ( + fMakefile, + "%s += $(PROJECT_RCFLAGS)\n", + windresflagsMacro.c_str () ); + + fprintf ( + fMakefile, + "%s += $(PROJECT_WIDLFLAGS)\n", + widlflagsMacro.c_str () ); + + fprintf ( + fMakefile, + "%s_LFLAGS += $(PROJECT_LFLAGS) -g\n", + module.name.c_str () ); + + fprintf ( + fMakefile, + "%s += $(%s)\n", + linkDepsMacro.c_str (), + libsMacro.c_str () ); + + string cflags = TypeSpecificCFlags(); + if ( cflags.size() > 0 ) + { + fprintf ( fMakefile, + "%s += %s\n\n", + cflagsMacro.c_str (), + cflags.c_str () ); + } + + string nasmflags = TypeSpecificNasmFlags(); + if ( nasmflags.size () > 0 ) + { + fprintf ( fMakefile, + "%s += %s\n\n", + nasmflagsMacro.c_str (), + nasmflags.c_str () ); + } + + string linkerflags = TypeSpecificLinkerFlags(); + if ( linkerflags.size() > 0 ) + { + fprintf ( fMakefile, + "%s += %s\n\n", + linkerflagsMacro.c_str (), + linkerflags.c_str () ); + } + + fprintf ( fMakefile, "\n\n" ); + + // future references to the macros will be to get their values + cflagsMacro = ssprintf ("$(%s)", cflagsMacro.c_str ()); + nasmflagsMacro = ssprintf ("$(%s)", nasmflagsMacro.c_str ()); + widlflagsMacro = ssprintf ("$(%s)", widlflagsMacro.c_str ()); +} + +void +MingwModuleHandler::GenerateRules () +{ + string cc = ( module.host == HostTrue ? "${host_gcc}" : "${gcc}" ); + string cppc = ( module.host == HostTrue ? "${host_gpp}" : "${gpp}" ); + string ar = ( module.host == HostTrue ? "${host_ar}" : "${ar}" ); + + string targetMacro = GetTargetMacro ( module ); + + CLEAN_FILE ( targetMacro ); + + // generate phony target for module name + fprintf ( fMakefile, ".PHONY: %s\n", + module.name.c_str () ); + fprintf ( fMakefile, "%s: %s\n\n", + module.name.c_str (), + GetTargetMacro ( module ).c_str () ); + + if ( !ReferenceObjects ( module ) ) + { + string ar_target ( GenerateArchiveTarget ( ar, objectsMacro ) ); + if ( targetMacro != ar_target ) + { + CLEAN_FILE ( ar_target ); + } + } + + GenerateObjectFileTargets ( cc, + cppc, + cflagsMacro, + nasmflagsMacro, + windresflagsMacro, + widlflagsMacro ); +} + +void +MingwModuleHandler::GetInvocationDependencies ( + const Module& module, + string_list& dependencies ) +{ + for ( size_t i = 0; i < module.invocations.size (); i++ ) + { + Invoke& invoke = *module.invocations[i]; + if ( invoke.invokeModule == &module ) + /* Protect against circular dependencies */ + continue; + invoke.GetTargets ( dependencies ); + } +} + +void +MingwModuleHandler::GenerateInvocations () const +{ + if ( module.invocations.size () == 0 ) + return; + + size_t iend = module.invocations.size (); + for ( size_t i = 0; i < iend; i++ ) + { + const Invoke& invoke = *module.invocations[i]; + + if ( invoke.invokeModule->type != BuildTool ) + { + throw InvalidBuildFileException ( module.node.location, + "Only modules of type buildtool can be invoked." ); + } + + string invokeTarget = module.GetInvocationTarget ( i ); + string_list invoke_targets; + assert ( invoke_targets.size() ); + invoke.GetTargets ( invoke_targets ); + fprintf ( fMakefile, + ".PHONY: %s\n\n", + invokeTarget.c_str () ); + fprintf ( fMakefile, + "%s:", + invokeTarget.c_str () ); + size_t j, jend = invoke_targets.size(); + for ( j = 0; j < jend; j++ ) + { + fprintf ( fMakefile, + " %s", + invoke_targets[i].c_str () ); + } + fprintf ( fMakefile, "\n\n%s", invoke_targets[0].c_str () ); + for ( j = 1; j < jend; j++ ) + fprintf ( fMakefile, + " %s", + invoke_targets[i].c_str () ); + fprintf ( fMakefile, + ": %s\n", + NormalizeFilename ( invoke.invokeModule->GetPath () ).c_str () ); + fprintf ( fMakefile, "\t$(ECHO_INVOKE)\n" ); + fprintf ( fMakefile, + "\t%s %s\n\n", + NormalizeFilename ( invoke.invokeModule->GetPath () ).c_str (), + invoke.GetParameters ().c_str () ); + } +} + +string +MingwModuleHandler::GetPreconditionDependenciesName () const +{ + return module.name + "_precondition"; +} + +void +MingwModuleHandler::GetDefaultDependencies ( + string_list& dependencies ) const +{ + /* Avoid circular dependency */ + if ( module.type != BuildTool + && module.name != "zlib" + && module.name != "hostzlib" ) + + dependencies.push_back ( "$(INIT)" ); +} + +void +MingwModuleHandler::GeneratePreconditionDependencies () +{ + string preconditionDependenciesName = GetPreconditionDependenciesName (); + string_list sourceFilenames; + GetSourceFilenamesWithoutGeneratedFiles ( sourceFilenames ); + string_list dependencies; + GetDefaultDependencies ( dependencies ); + GetModuleDependencies ( dependencies ); + + GetInvocationDependencies ( module, dependencies ); + + if ( dependencies.size() ) + { + fprintf ( fMakefile, + "%s =", + preconditionDependenciesName.c_str () ); + for ( size_t i = 0; i < dependencies.size(); i++ ) + fprintf ( fMakefile, + " %s", + dependencies[i].c_str () ); + fprintf ( fMakefile, "\n\n" ); + } + + for ( size_t i = 0; i < sourceFilenames.size(); i++ ) + { + fprintf ( fMakefile, + "%s: ${%s}\n", + sourceFilenames[i].c_str(), + preconditionDependenciesName.c_str ()); + } + fprintf ( fMakefile, "\n" ); +} + +bool +MingwModuleHandler::IsWineModule () const +{ + if ( module.importLibrary == NULL) + return false; + + size_t index = module.importLibrary->definition.rfind ( ".spec.def" ); + return ( index != string::npos ); +} + +string +MingwModuleHandler::GetDefinitionFilename () const +{ + string defFilename = module.GetBasePath () + SSEP + module.importLibrary->definition; + if ( IsWineModule () ) + return PassThruCacheDirectory ( NormalizeFilename ( defFilename ), + backend->intermediateDirectory ); + else + return defFilename; +} + +void +MingwModuleHandler::GenerateImportLibraryTargetIfNeeded () +{ + if ( module.importLibrary != NULL ) + { + string library_target ( + GetImportLibraryFilename ( module, &clean_files ) ); + + string_list deps; + GetDefinitionDependencies ( deps ); + + fprintf ( fMakefile, "# IMPORT LIBRARY RULE:\n" ); + + fprintf ( fMakefile, "%s:", + library_target.c_str () ); + + size_t i, iend = deps.size(); + for ( i = 0; i < iend; i++ ) + fprintf ( fMakefile, " %s", + deps[i].c_str () ); + + fprintf ( fMakefile, " | %s\n", + GetDirectory ( GetTargetFilename ( module, NULL ) ).c_str () ); + + fprintf ( fMakefile, "\t$(ECHO_DLLTOOL)\n" ); + + string killAt = module.mangledSymbols ? "" : "--kill-at"; + fprintf ( fMakefile, + "\t${dlltool} --dllname %s --def %s --output-lib %s %s\n\n", + module.GetTargetName ().c_str (), + GetDefinitionFilename ().c_str (), + library_target.c_str (), + killAt.c_str () ); + } +} + +void +MingwModuleHandler::GetSpecObjectDependencies ( + string_list& dependencies, + const string& filename ) const +{ + string basename = GetBasename ( filename ); + string defDependency = PassThruCacheDirectory ( + NormalizeFilename ( basename + ".spec.def" ), + backend->intermediateDirectory ); + dependencies.push_back ( defDependency ); + string stubsDependency = PassThruCacheDirectory ( + NormalizeFilename ( basename + ".stubs.c" ), + backend->intermediateDirectory ); + dependencies.push_back ( stubsDependency ); +} + +void +MingwModuleHandler::GetWidlObjectDependencies ( + string_list& dependencies, + const string& filename ) const +{ + string basename = GetBasename ( filename ); + string serverDependency = PassThruCacheDirectory ( + NormalizeFilename ( basename + "_s.c" ), + backend->intermediateDirectory ); + dependencies.push_back ( serverDependency ); +} + +void +MingwModuleHandler::GetDefinitionDependencies ( + string_list& dependencies ) const +{ + string dkNkmLibNoFixup = "dk/nkm/lib"; + const vector& files = module.non_if_data.files; + for ( size_t i = 0; i < files.size (); i++ ) + { + File& file = *files[i]; + string extension = GetExtension ( file.name ); + if ( extension == ".spec" || extension == ".SPEC" ) + { + GetSpecObjectDependencies ( dependencies, file.name ); + } + if ( extension == ".idl" || extension == ".IDL" ) + { + GetWidlObjectDependencies ( dependencies, file.name ); + } + } +} + + +MingwBuildToolModuleHandler::MingwBuildToolModuleHandler ( const Module& module_ ) + : MingwModuleHandler ( module_ ) +{ +} + +void +MingwBuildToolModuleHandler::Process () +{ + GenerateBuildToolModuleTarget (); +} + +void +MingwBuildToolModuleHandler::GenerateBuildToolModuleTarget () +{ + string targetMacro ( GetTargetMacro (module) ); + string objectsMacro = GetObjectsMacro ( module ); + string linkDepsMacro = GetLinkingDependenciesMacro (); + string libsMacro = GetLibsMacro (); + + GenerateRules (); + + string linker; + if ( module.cplusplus ) + linker = "${host_gpp}"; + else + linker = "${host_gcc}"; + + fprintf ( fMakefile, "%s: %s %s | %s\n", + targetMacro.c_str (), + objectsMacro.c_str (), + linkDepsMacro.c_str (), + GetDirectory(GetTargetFilename(module,NULL)).c_str () ); + fprintf ( fMakefile, "\t$(ECHO_LD)\n" ); + fprintf ( fMakefile, + "\t%s %s -o $@ %s %s\n\n", + linker.c_str (), + GetLinkerMacro ().c_str (), + objectsMacro.c_str (), + libsMacro.c_str () ); +} + + +MingwKernelModuleHandler::MingwKernelModuleHandler ( + const Module& module_ ) + + : MingwModuleHandler ( module_ ) +{ +} + +void +MingwKernelModuleHandler::Process () +{ + GenerateKernelModuleTarget (); +} + +void +MingwKernelModuleHandler::GenerateKernelModuleTarget () +{ + string targetName ( module.GetTargetName () ); // i.e. "ntoskrnl.exe" + string targetMacro ( GetTargetMacro ( module ) ); // i.e. "$(NTOSKRNL_TARGET)" + string workingDirectory = GetWorkingDirectory (); + string objectsMacro = GetObjectsMacro ( module ); + string linkDepsMacro = GetLinkingDependenciesMacro (); + string libsMacro = GetLibsMacro (); + string base_tmp = ros_temp + module.name + ".base.tmp"; + CLEAN_FILE ( base_tmp ); + string junk_tmp = ros_temp + module.name + ".junk.tmp"; + CLEAN_FILE ( junk_tmp ); + string temp_exp = ros_temp + module.name + ".temp.exp"; + CLEAN_FILE ( temp_exp ); + 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", + module.GetBasePath ().c_str (), + module.entrypoint.c_str (), + module.baseaddress.c_str () ); + + GenerateRules (); + + GenerateImportLibraryTargetIfNeeded (); + + fprintf ( fMakefile, "%s: %s %s $(RSYM_TARGET) | %s\n", + targetMacro.c_str (), + objectsMacro.c_str (), + linkDepsMacro.c_str (), + GetDirectory(GetTargetFilename(module,NULL)).c_str () ); + fprintf ( fMakefile, "\t$(ECHO_LD)\n" ); + fprintf ( fMakefile, + "\t${gcc} %s %s -Wl,--base-file,%s -o %s %s %s\n", + GetLinkerMacro ().c_str (), + gccOptions.c_str (), + base_tmp.c_str (), + junk_tmp.c_str (), + objectsMacro.c_str (), + linkDepsMacro.c_str () ); + fprintf ( fMakefile, + "\t-@${rm} %s 2>$(NUL)\n", + junk_tmp.c_str () ); + string killAt = module.mangledSymbols ? "" : "--kill-at"; + fprintf ( fMakefile, + "\t${dlltool} --dllname %s --base-file %s --def ntoskrnl/ntoskrnl.def --output-exp %s %s\n", + targetName.c_str (), + base_tmp.c_str (), + temp_exp.c_str (), + killAt.c_str () ); + fprintf ( fMakefile, + "\t-@${rm} %s 2>$(NUL)\n", + base_tmp.c_str () ); + fprintf ( fMakefile, + "\t${gcc} %s %s -Wl,%s -o $@ %s %s\n", + GetLinkerMacro ().c_str (), + gccOptions.c_str (), + temp_exp.c_str (), + objectsMacro.c_str (), + linkDepsMacro.c_str () ); + fprintf ( fMakefile, + "\t-@${rm} %s 2>$(NUL)\n", + temp_exp.c_str () ); + fprintf ( fMakefile, "\t$(ECHO_RSYM)\n" ); + fprintf ( fMakefile, + "\t$(Q)$(RSYM_TARGET) $@ $@\n\n" ); +} + + +MingwStaticLibraryModuleHandler::MingwStaticLibraryModuleHandler ( + const Module& module_ ) + + : MingwModuleHandler ( module_ ) +{ +} + +void +MingwStaticLibraryModuleHandler::Process () +{ + GenerateStaticLibraryModuleTarget (); +} + +void +MingwStaticLibraryModuleHandler::GenerateStaticLibraryModuleTarget () +{ + GenerateRules (); +} + + +MingwObjectLibraryModuleHandler::MingwObjectLibraryModuleHandler ( + const Module& module_ ) + + : MingwModuleHandler ( module_ ) +{ +} + +void +MingwObjectLibraryModuleHandler::Process () +{ + GenerateObjectLibraryModuleTarget (); +} + +void +MingwObjectLibraryModuleHandler::GenerateObjectLibraryModuleTarget () +{ + GenerateRules (); +} + + +MingwKernelModeDLLModuleHandler::MingwKernelModeDLLModuleHandler ( + const Module& module_ ) + + : MingwModuleHandler ( module_ ) +{ +} + +void +MingwKernelModeDLLModuleHandler::Process () +{ + GenerateKernelModeDLLModuleTarget (); +} + +void +MingwKernelModeDLLModuleHandler::GenerateKernelModeDLLModuleTarget () +{ + string targetMacro ( GetTargetMacro ( module ) ); + string workingDirectory = GetWorkingDirectory ( ); + string objectsMacro = GetObjectsMacro ( module ); + string linkDepsMacro = GetLinkingDependenciesMacro (); + string libsMacro = GetLibsMacro (); + + GenerateImportLibraryTargetIfNeeded (); + + if ( module.non_if_data.files.size () > 0 ) + { + GenerateRules (); + + string dependencies = linkDepsMacro + " " + objectsMacro; + + string linkerParameters = ssprintf ( "-Wl,--subsystem,native -Wl,--entry,%s -Wl,--image-base,%s -Wl,--file-alignment,0x1000 -Wl,--section-alignment,0x1000 -nostartfiles -mdll", + module.entrypoint.c_str (), + module.baseaddress.c_str () ); + GenerateLinkerCommand ( dependencies, + "${gcc}", + linkerParameters, + objectsMacro, + libsMacro ); + } + else + { + GeneratePhonyTarget(); + } +} + + +MingwKernelModeDriverModuleHandler::MingwKernelModeDriverModuleHandler ( + const Module& module_ ) + + : MingwModuleHandler ( module_ ) +{ +} + +void +MingwKernelModeDriverModuleHandler::Process () +{ + GenerateKernelModeDriverModuleTarget (); +} + + +void +MingwKernelModeDriverModuleHandler::GenerateKernelModeDriverModuleTarget () +{ + string targetMacro ( GetTargetMacro (module) ); + string workingDirectory = GetWorkingDirectory (); + string objectsMacro = GetObjectsMacro ( module ); + string linkDepsMacro = GetLinkingDependenciesMacro (); + string libsMacro = GetLibsMacro (); + + GenerateImportLibraryTargetIfNeeded (); + + if ( module.non_if_data.files.size () > 0 ) + { + GenerateRules (); + + string dependencies = linkDepsMacro + " " + objectsMacro; + + string linkerParameters = ssprintf ( "-Wl,--subsystem,native -Wl,--entry,%s -Wl,--image-base,%s -Wl,--file-alignment,0x1000 -Wl,--section-alignment,0x1000 -nostartfiles -mdll", + module.entrypoint.c_str (), + module.baseaddress.c_str () ); + GenerateLinkerCommand ( dependencies, + "${gcc}", + linkerParameters, + objectsMacro, + libsMacro ); + } + else + { + GeneratePhonyTarget(); + } +} + + +MingwNativeDLLModuleHandler::MingwNativeDLLModuleHandler ( + const Module& module_ ) + + : MingwModuleHandler ( module_ ) +{ +} + +void +MingwNativeDLLModuleHandler::Process () +{ + GenerateNativeDLLModuleTarget (); +} + +void +MingwNativeDLLModuleHandler::GenerateNativeDLLModuleTarget () +{ + string targetMacro ( GetTargetMacro (module) ); + string workingDirectory = GetWorkingDirectory ( ); + string objectsMacro = GetObjectsMacro ( module ); + string linkDepsMacro = GetLinkingDependenciesMacro (); + string libsMacro = GetLibsMacro (); + + GenerateImportLibraryTargetIfNeeded (); + + if ( module.non_if_data.files.size () > 0 ) + { + GenerateRules (); + + string dependencies = linkDepsMacro + " " + objectsMacro; + + string linkerParameters = ssprintf ( "-Wl,--subsystem,native -Wl,--entry,%s -Wl,--image-base,%s -Wl,--file-alignment,0x1000 -Wl,--section-alignment,0x1000 -nostartfiles -nostdlib -mdll", + module.entrypoint.c_str (), + module.baseaddress.c_str () ); + GenerateLinkerCommand ( dependencies, + "${gcc}", + linkerParameters, + objectsMacro, + libsMacro ); + } + else + { + GeneratePhonyTarget(); + } +} + + +MingwNativeCUIModuleHandler::MingwNativeCUIModuleHandler ( + const Module& module_ ) + + : MingwModuleHandler ( module_ ) +{ +} + +void +MingwNativeCUIModuleHandler::Process () +{ + GenerateNativeCUIModuleTarget (); +} + +void +MingwNativeCUIModuleHandler::GenerateNativeCUIModuleTarget () +{ + string targetMacro ( GetTargetMacro (module) ); + string workingDirectory = GetWorkingDirectory ( ); + string objectsMacro = GetObjectsMacro ( module ); + string linkDepsMacro = GetLinkingDependenciesMacro (); + string libsMacro = GetLibsMacro (); + + GenerateImportLibraryTargetIfNeeded (); + + if ( module.non_if_data.files.size () > 0 ) + { + GenerateRules (); + + string dependencies = linkDepsMacro + " " + objectsMacro; + + string linkerParameters = ssprintf ( "-Wl,--subsystem,native -Wl,--entry,%s -Wl,--image-base,%s -Wl,--file-alignment,0x1000 -Wl,--section-alignment,0x1000 -nostartfiles -nostdlib", + module.entrypoint.c_str (), + module.baseaddress.c_str () ); + GenerateLinkerCommand ( dependencies, + "${gcc}", + linkerParameters, + objectsMacro, + libsMacro ); + } + else + { + GeneratePhonyTarget(); + } +} + + +MingwWin32DLLModuleHandler::MingwWin32DLLModuleHandler ( + const Module& module_ ) + + : MingwModuleHandler ( module_ ) +{ +} + +void +MingwWin32DLLModuleHandler::Process () +{ + GenerateExtractWineDLLResourcesTarget (); + GenerateWin32DLLModuleTarget (); +} + +void +MingwWin32DLLModuleHandler::GenerateExtractWineDLLResourcesTarget () +{ + fprintf ( fMakefile, ".PHONY: %s_extractresources\n\n", + module.name.c_str () ); + fprintf ( fMakefile, "%s_extractresources: $(BIN2RES_TARGET)\n", + module.name.c_str () ); + const vector& files = module.non_if_data.files; + for ( size_t i = 0; i < files.size (); i++ ) + { + File& file = *files[i]; + string extension = GetExtension ( file.name ); + if ( extension == ".rc" || extension == ".RC" ) + { + string resource = NormalizeFilename ( file.name ); + fprintf ( fMakefile, "\t$(ECHO_BIN2RES)\n" ); + fprintf ( fMakefile, "\t@:echo ${bin2res} -f -x %s\n", + resource.c_str () ); + } + } + fprintf ( fMakefile, "\n"); +} + +void +MingwWin32DLLModuleHandler::GenerateWin32DLLModuleTarget () +{ + string targetMacro ( GetTargetMacro (module) ); + string workingDirectory = GetWorkingDirectory ( ); + string objectsMacro = GetObjectsMacro ( module ); + string linkDepsMacro = GetLinkingDependenciesMacro (); + string libsMacro = GetLibsMacro (); + + GenerateImportLibraryTargetIfNeeded (); + + if ( module.non_if_data.files.size () > 0 ) + { + GenerateRules (); + + string dependencies = linkDepsMacro + " " + objectsMacro; + + string linker; + if ( module.cplusplus ) + linker = "${gpp}"; + else + linker = "${gcc}"; + + string linkerParameters = ssprintf ( "-Wl,--subsystem,console -Wl,--entry,%s -Wl,--image-base,%s -Wl,--file-alignment,0x1000 -Wl,--section-alignment,0x1000 -mdll", + module.entrypoint.c_str (), + module.baseaddress.c_str () ); + GenerateLinkerCommand ( dependencies, + linker, + linkerParameters, + objectsMacro, + libsMacro ); + } + else + { + GeneratePhonyTarget(); + } +} + + +MingwWin32CUIModuleHandler::MingwWin32CUIModuleHandler ( + const Module& module_ ) + + : MingwModuleHandler ( module_ ) +{ +} + +void +MingwWin32CUIModuleHandler::Process () +{ + GenerateWin32CUIModuleTarget (); +} + +void +MingwWin32CUIModuleHandler::GenerateWin32CUIModuleTarget () +{ + string targetMacro ( GetTargetMacro (module) ); + string workingDirectory = GetWorkingDirectory ( ); + string objectsMacro = GetObjectsMacro ( module ); + string linkDepsMacro = GetLinkingDependenciesMacro (); + string libsMacro = GetLibsMacro (); + + GenerateImportLibraryTargetIfNeeded (); + + if ( module.non_if_data.files.size () > 0 ) + { + GenerateRules (); + + string dependencies = linkDepsMacro + " " + objectsMacro; + + string linker; + if ( module.cplusplus ) + linker = "${gpp}"; + else + linker = "${gcc}"; + + string linkerParameters = ssprintf ( "-Wl,--subsystem,console -Wl,--entry,%s -Wl,--image-base,%s -Wl,--file-alignment,0x1000 -Wl,--section-alignment,0x1000", + module.entrypoint.c_str (), + module.baseaddress.c_str () ); + GenerateLinkerCommand ( dependencies, + linker, + linkerParameters, + objectsMacro, + libsMacro ); + } + else + { + GeneratePhonyTarget(); + } +} + + +MingwWin32GUIModuleHandler::MingwWin32GUIModuleHandler ( + const Module& module_ ) + + : MingwModuleHandler ( module_ ) +{ +} + +void +MingwWin32GUIModuleHandler::Process () +{ + GenerateWin32GUIModuleTarget (); +} + +void +MingwWin32GUIModuleHandler::GenerateWin32GUIModuleTarget () +{ + string targetMacro ( GetTargetMacro (module) ); + string workingDirectory = GetWorkingDirectory ( ); + string objectsMacro = GetObjectsMacro ( module ); + string linkDepsMacro = GetLinkingDependenciesMacro (); + string libsMacro = GetLibsMacro (); + + GenerateImportLibraryTargetIfNeeded (); + + if ( module.non_if_data.files.size () > 0 ) + { + GenerateRules (); + + string dependencies = linkDepsMacro + " " + objectsMacro; + + string linker; + if ( module.cplusplus ) + linker = "${gpp}"; + else + linker = "${gcc}"; + + string linkerParameters = ssprintf ( "-Wl,--subsystem,windows -Wl,--entry,%s -Wl,--image-base,%s -Wl,--file-alignment,0x1000 -Wl,--section-alignment,0x1000", + module.entrypoint.c_str (), + module.baseaddress.c_str () ); + GenerateLinkerCommand ( dependencies, + linker, + linkerParameters, + objectsMacro, + libsMacro ); + } + else + { + GeneratePhonyTarget(); + } +} + + +MingwBootLoaderModuleHandler::MingwBootLoaderModuleHandler ( + const Module& module_ ) + + : MingwModuleHandler ( module_ ) +{ +} + +void +MingwBootLoaderModuleHandler::Process () +{ + GenerateBootLoaderModuleTarget (); +} + +void +MingwBootLoaderModuleHandler::GenerateBootLoaderModuleTarget () +{ + string targetName ( module.GetTargetName () ); + string targetMacro ( GetTargetMacro (module) ); + string workingDirectory = GetWorkingDirectory (); + string junk_tmp = ros_temp + module.name + ".junk.tmp"; + CLEAN_FILE ( junk_tmp ); + string objectsMacro = GetObjectsMacro ( module ); + string linkDepsMacro = GetLinkingDependenciesMacro (); + string libsMacro = GetLibsMacro (); + + GenerateRules (); + + fprintf ( fMakefile, "%s: %s %s | %s\n", + targetMacro.c_str (), + objectsMacro.c_str (), + linkDepsMacro.c_str (), + GetDirectory(GetTargetFilename(module,NULL)).c_str () ); + + fprintf ( fMakefile, "\t$(ECHO_LD)\n" ); + + fprintf ( fMakefile, + "\t${ld} %s -N -Ttext=0x8000 -o %s %s %s\n", + GetLinkerMacro ().c_str (), + junk_tmp.c_str (), + objectsMacro.c_str (), + linkDepsMacro.c_str () ); + fprintf ( fMakefile, + "\t${objcopy} -O binary %s $@\n", + junk_tmp.c_str () ); + fprintf ( fMakefile, + "\t-@${rm} %s 2>$(NUL)\n", + junk_tmp.c_str () ); +} + + +MingwBootSectorModuleHandler::MingwBootSectorModuleHandler ( + const Module& module_ ) + + : MingwModuleHandler ( module_ ) +{ +} + +void +MingwBootSectorModuleHandler::Process () +{ + GenerateBootSectorModuleTarget (); +} + +void +MingwBootSectorModuleHandler::GenerateBootSectorModuleTarget () +{ + string objectsMacro = GetObjectsMacro ( module ); + + GenerateRules (); + + fprintf ( fMakefile, ".PHONY: %s\n\n", + module.name.c_str ()); + fprintf ( fMakefile, + "%s: %s\n", + module.name.c_str (), + objectsMacro.c_str () ); +} + + +MingwIsoModuleHandler::MingwIsoModuleHandler ( + const Module& module_ ) + + : MingwModuleHandler ( module_ ) +{ +} + +void +MingwIsoModuleHandler::Process () +{ + GenerateIsoModuleTarget (); +} + +void +MingwIsoModuleHandler::OutputBootstrapfileCopyCommands ( + const string& bootcdDirectory ) +{ + for ( size_t i = 0; i < module.project.modules.size (); i++ ) + { + const Module& m = *module.project.modules[i]; + if ( m.bootstrap != NULL ) + { + string sourceFilename = PassThruCacheDirectory ( + NormalizeFilename ( m.GetPath () ), + backend->outputDirectory ); + string targetFilenameNoFixup ( bootcdDirectory + SSEP + m.bootstrap->base + SSEP + m.bootstrap->nameoncd ); + string targetFilename = MingwModuleHandler::PassThruCacheDirectory ( + NormalizeFilename ( targetFilenameNoFixup ), + backend->outputDirectory ); + fprintf ( fMakefile, + "\t$(ECHO_CP)\n" ); + fprintf ( fMakefile, + "\t${cp} %s %s 1>$(NUL)\n", + sourceFilename.c_str (), + targetFilename.c_str () ); + } + } +} + +void +MingwIsoModuleHandler::OutputCdfileCopyCommands ( + const string& bootcdDirectory ) +{ + for ( size_t i = 0; i < module.project.cdfiles.size (); i++ ) + { + const CDFile& cdfile = *module.project.cdfiles[i]; + string targetFilenameNoFixup = bootcdDirectory + SSEP + cdfile.base + SSEP + cdfile.nameoncd; + string targetFilename = MingwModuleHandler::PassThruCacheDirectory ( + NormalizeFilename ( targetFilenameNoFixup ), + backend->outputDirectory ); + fprintf ( fMakefile, + "\t$(ECHO_CP)\n" ); + fprintf ( fMakefile, + "\t${cp} %s %s 1>$(NUL)\n", + cdfile.GetPath ().c_str (), + targetFilename.c_str () ); + } +} + +string +MingwIsoModuleHandler::GetBootstrapCdDirectories ( const string& bootcdDirectory ) +{ + string directories; + for ( size_t i = 0; i < module.project.modules.size (); i++ ) + { + const Module& m = *module.project.modules[i]; + if ( m.bootstrap != NULL ) + { + string targetDirectory ( bootcdDirectory + SSEP + m.bootstrap->base ); + if ( directories.size () > 0 ) + directories += " "; + directories += PassThruCacheDirectory ( + NormalizeFilename ( targetDirectory ), + backend->outputDirectory ); + } + } + return directories; +} + +string +MingwIsoModuleHandler::GetNonModuleCdDirectories ( const string& bootcdDirectory ) +{ + string directories; + for ( size_t i = 0; i < module.project.cdfiles.size (); i++ ) + { + const CDFile& cdfile = *module.project.cdfiles[i]; + string targetDirectory ( bootcdDirectory + SSEP + cdfile.base ); + if ( directories.size () > 0 ) + directories += " "; + directories += PassThruCacheDirectory ( + NormalizeFilename ( targetDirectory ), + backend->outputDirectory ); + } + return directories; +} + +string +MingwIsoModuleHandler::GetCdDirectories ( const string& bootcdDirectory ) +{ + string directories = GetBootstrapCdDirectories ( bootcdDirectory ); + directories += " " + GetNonModuleCdDirectories ( bootcdDirectory ); + return directories; +} + +void +MingwIsoModuleHandler::GetBootstrapCdFiles ( + vector& out ) const +{ + for ( size_t i = 0; i < module.project.modules.size (); i++ ) + { + const Module& m = *module.project.modules[i]; + if ( m.bootstrap != NULL ) + { + string filename = PassThruCacheDirectory ( + NormalizeFilename ( m.GetPath () ), + backend->outputDirectory ); + out.push_back ( filename ); + } + } +} + +void +MingwIsoModuleHandler::GetNonModuleCdFiles ( + vector& out ) const +{ + for ( size_t i = 0; i < module.project.cdfiles.size (); i++ ) + { + const CDFile& cdfile = *module.project.cdfiles[i]; + out.push_back ( cdfile.GetPath () ); + } +} + +void +MingwIsoModuleHandler::GetCdFiles ( + vector& out ) const +{ + GetBootstrapCdFiles ( out ); + GetNonModuleCdFiles ( out ); +} + +void +MingwIsoModuleHandler::GenerateIsoModuleTarget () +{ + string bootcdDirectory = "cd"; + string bootcd = PassThruCacheDirectory ( + NormalizeFilename ( bootcdDirectory + SSEP ), + backend->outputDirectory ); + string isoboot = PassThruCacheDirectory ( + NormalizeFilename ( "boot" SSEP "freeldr" SSEP "bootsect" SSEP "isoboot.o" ), + backend->outputDirectory ); + string bootcdReactosNoFixup = bootcdDirectory + SSEP "reactos"; + string bootcdReactos = PassThruCacheDirectory ( + NormalizeFilename ( bootcdReactosNoFixup + SSEP ), + backend->outputDirectory ); + CLEAN_FILE ( bootcdReactos ); + string reactosInf = PassThruCacheDirectory ( + NormalizeFilename ( bootcdReactosNoFixup + SSEP "reactos.inf" ), + backend->outputDirectory ); + string reactosDff = NormalizeFilename ( "bootdata" SSEP "packages" SSEP "reactos.dff" ); + string cdDirectories = GetCdDirectories ( bootcdDirectory ); + vector vCdFiles; + GetCdFiles ( vCdFiles ); + string cdFiles = v2s ( vCdFiles, 5 ); + + fprintf ( fMakefile, ".PHONY: %s\n\n", + module.name.c_str ()); + fprintf ( fMakefile, + "%s: all %s %s %s %s $(CABMAN_TARGET) $(CDMAKE_TARGET)\n", + module.name.c_str (), + isoboot.c_str (), + bootcdReactos.c_str (), + cdDirectories.c_str (), + cdFiles.c_str () ); + fprintf ( fMakefile, "\t$(ECHO_CABMAN)\n" ); + fprintf ( fMakefile, + "\t$(Q)$(CABMAN_TARGET) -C %s -L %s -I -P $(OUTPUT)\n", + reactosDff.c_str (), + bootcdReactos.c_str () ); + fprintf ( fMakefile, + "\t$(Q)$(CABMAN_TARGET) -C %s -RC %s -L %s -N -P $(OUTPUT)\n", + reactosDff.c_str (), + reactosInf.c_str (), + bootcdReactos.c_str ()); + fprintf ( fMakefile, + "\t-@${rm} %s 2>$(NUL)\n", + reactosInf.c_str () ); + OutputBootstrapfileCopyCommands ( bootcdDirectory ); + OutputCdfileCopyCommands ( bootcdDirectory ); + fprintf ( fMakefile, "\t$(ECHO_CDMAKE)\n" ); + fprintf ( fMakefile, + "\t$(Q)$(CDMAKE_TARGET) -v -m -b %s %s REACTOS ReactOS.iso\n", + isoboot.c_str (), + bootcd.c_str () ); + fprintf ( fMakefile, + "\n" ); +} + + +MingwLiveIsoModuleHandler::MingwLiveIsoModuleHandler ( + const Module& module_ ) + + : MingwModuleHandler ( module_ ) +{ +} + +void +MingwLiveIsoModuleHandler::Process () +{ + GenerateLiveIsoModuleTarget (); +} + +void +MingwLiveIsoModuleHandler::CreateDirectory ( const string& directory ) +{ + string normalizedDirectory = MingwModuleHandler::PassThruCacheDirectory ( + NormalizeFilename ( directory ) + SSEP, + backend->outputDirectory ); +} + +void +MingwLiveIsoModuleHandler::OutputCopyCommand ( const string& sourceFilename, + const string& targetFilename, + const string& targetDirectory ) +{ + string normalizedTargetFilename = MingwModuleHandler::PassThruCacheDirectory ( + NormalizeFilename ( targetDirectory + SSEP + targetFilename ), + backend->outputDirectory ); + fprintf ( fMakefile, + "\t$(ECHO_CP)\n" ); + fprintf ( fMakefile, + "\t${cp} %s %s 1>$(NUL)\n", + sourceFilename.c_str (), + normalizedTargetFilename.c_str () ); +} + +void +MingwLiveIsoModuleHandler::OutputModuleCopyCommands ( string& livecdDirectory, + string& reactosDirectory ) +{ + for ( size_t i = 0; i < module.project.modules.size (); i++ ) + { + const Module& m = *module.project.modules[i]; + if ( m.installName.length () > 0 ) + { + string sourceFilename = MingwModuleHandler::PassThruCacheDirectory ( + NormalizeFilename ( m.GetPath () ), + backend->outputDirectory ); + OutputCopyCommand ( sourceFilename, + m.installName, + livecdDirectory + SSEP + reactosDirectory + SSEP + m.installBase ); + } + } +} + +void +MingwLiveIsoModuleHandler::OutputNonModuleCopyCommands ( string& livecdDirectory, + string& reactosDirectory ) +{ + for ( size_t i = 0; i < module.project.installfiles.size (); i++ ) + { + const InstallFile& installfile = *module.project.installfiles[i]; + OutputCopyCommand ( installfile.GetPath (), + installfile.newname, + livecdDirectory + SSEP + reactosDirectory + SSEP + installfile.base ); + } +} + +void +MingwLiveIsoModuleHandler::OutputProfilesDirectoryCommands ( string& livecdDirectory ) +{ + CreateDirectory ( livecdDirectory + SSEP "Profiles" ); + CreateDirectory ( livecdDirectory + SSEP "Profiles" SSEP "All Users") ; + CreateDirectory ( livecdDirectory + SSEP "Profiles" SSEP "All Users" SSEP "Desktop" ); + CreateDirectory ( livecdDirectory + SSEP "Profiles" SSEP "Default User" ); + CreateDirectory ( livecdDirectory + SSEP "Profiles" SSEP "Default User" SSEP "Desktop" ); + CreateDirectory ( livecdDirectory + SSEP "Profiles" SSEP "Default User" SSEP "My Documents" ); + + string livecdIni = "bootdata" SSEP "livecd.ini"; + OutputCopyCommand ( livecdIni, + "freeldr.ini", + livecdDirectory ); +} + +void +MingwLiveIsoModuleHandler::OutputLoaderCommands ( string& livecdDirectory ) +{ + string freeldr = PassThruCacheDirectory ( + NormalizeFilename ( "boot" SSEP "freeldr" SSEP "freeldr" SSEP "freeldr.sys" ), + backend->outputDirectory ); + CreateDirectory ( livecdDirectory + SSEP "loader" ); + OutputCopyCommand ( freeldr, + "setupldr.sys", + livecdDirectory + SSEP + "loader" ); +} + +void +MingwLiveIsoModuleHandler::OutputRegistryCommands ( string& livecdDirectory ) +{ + string reactosSystem32ConfigDirectory = NormalizeFilename ( + MingwModuleHandler::PassThruCacheDirectory ( + livecdDirectory + SSEP "reactos" SSEP "system32" SSEP "config" SSEP, + backend->outputDirectory ) ); + fprintf ( fMakefile, + "\t$(ECHO_MKHIVE)\n" ); + fprintf ( fMakefile, + "\t$(MKHIVE_TARGET) bootdata %s bootdata" SSEP "livecd.inf bootdata" SSEP "hiveinst.inf\n", + reactosSystem32ConfigDirectory.c_str () ); +} + +void +MingwLiveIsoModuleHandler::GenerateLiveIsoModuleTarget () +{ + string livecdDirectory = "livecd"; + string livecd = PassThruCacheDirectory ( + NormalizeFilename ( livecdDirectory + SSEP ), + backend->outputDirectory ); + string isoboot = PassThruCacheDirectory ( + NormalizeFilename ( "boot" SSEP "freeldr" SSEP "bootsect" SSEP "isoboot.o" ), + backend->outputDirectory ); + string reactosDirectory = "reactos"; + string livecdReactosNoFixup = livecdDirectory + SSEP + reactosDirectory; + string livecdReactos = NormalizeFilename ( PassThruCacheDirectory ( + NormalizeFilename ( livecdReactosNoFixup + SSEP ), + backend->outputDirectory ) ); + CLEAN_FILE ( livecdReactos ); + + fprintf ( fMakefile, ".PHONY: %s\n\n", + module.name.c_str ()); + fprintf ( fMakefile, + "%s: all %s %s $(MKHIVE_TARGET) $(CDMAKE_TARGET)\n", + module.name.c_str (), + isoboot.c_str (), + livecdReactos.c_str () ); + OutputModuleCopyCommands ( livecdDirectory, + reactosDirectory ); + OutputNonModuleCopyCommands ( livecdDirectory, + reactosDirectory ); + OutputProfilesDirectoryCommands ( livecdDirectory ); + OutputLoaderCommands ( livecdDirectory ); + OutputRegistryCommands ( livecdDirectory ); + fprintf ( fMakefile, "\t$(ECHO_CDMAKE)\n" ); + fprintf ( fMakefile, + "\t$(Q)$(CDMAKE_TARGET) -v -m -j -b %s %s REACTOS ReactOS-LiveCD.iso\n", + isoboot.c_str (), + livecd.c_str () ); + fprintf ( fMakefile, + "\n" ); +} + + +MingwTestModuleHandler::MingwTestModuleHandler ( + const Module& module_ ) + + : MingwModuleHandler ( module_ ) +{ +} + +void +MingwTestModuleHandler::Process () +{ + GenerateTestModuleTarget (); +} + +void +MingwTestModuleHandler::GenerateTestModuleTarget () +{ + string targetMacro ( GetTargetMacro ( module ) ); + string workingDirectory = GetWorkingDirectory ( ); + string objectsMacro = GetObjectsMacro ( module ); + string linkDepsMacro = GetLinkingDependenciesMacro (); + string libsMacro = GetLibsMacro (); + + GenerateImportLibraryTargetIfNeeded (); + + if ( module.non_if_data.files.size () > 0 ) + { + GenerateRules (); + + string dependencies = linkDepsMacro + " " + objectsMacro; + + string linker; + if ( module.cplusplus ) + linker = "${gpp}"; + else + linker = "${gcc}"; + + string linkerParameters = ssprintf ( "-Wl,--subsystem,console -Wl,--entry,%s -Wl,--image-base,%s -Wl,--file-alignment,0x1000 -Wl,--section-alignment,0x1000", + module.entrypoint.c_str (), + module.baseaddress.c_str () ); + GenerateLinkerCommand ( dependencies, + linker, + linkerParameters, + objectsMacro, + libsMacro ); + } + else + { + GeneratePhonyTarget(); + } +} + + +MingwRpcServerModuleHandler::MingwRpcServerModuleHandler ( + const Module& module_ ) + + : MingwModuleHandler ( module_ ) +{ +} + +void +MingwRpcServerModuleHandler::Process () +{ + GenerateRules (); +} + +MingwRpcClientModuleHandler::MingwRpcClientModuleHandler ( + const Module& module_ ) + + : MingwModuleHandler ( module_ ) +{ +} + +void +MingwRpcClientModuleHandler::Process () +{ + GenerateRules (); +} diff --cc reactos/tools/rbuild/backend/mingw/modulehandler.h index 8b63e489fd4,00000000000..567d4ac3f86 mode 100644,000000..100644 --- a/reactos/tools/rbuild/backend/mingw/modulehandler.h +++ b/reactos/tools/rbuild/backend/mingw/modulehandler.h @@@ -1,411 -1,0 +1,412 @@@ +#ifndef MINGW_MODULEHANDLER_H +#define MINGW_MODULEHANDLER_H + +#include "../backend.h" +#include "mingw.h" + +class MingwBackend; + +extern std::string +GetTargetMacro ( const Module&, bool with_dollar = true ); + +extern std::string +PrefixFilename ( + const std::string& filename, + const std::string& prefix ); + +class MingwModuleHandler +{ +public: + MingwModuleHandler ( const Module& module_ ); + virtual ~MingwModuleHandler(); + + static void SetBackend ( MingwBackend* backend_ ); + static void SetMakefile ( FILE* f ); + static void SetUsePch ( bool use_pch ); + + static std::string PassThruCacheDirectory ( + const std::string &f, + Directory* directoryTree ); + + static std::string GetTargetFilename ( + const Module& module, + string_list* pclean_files ); + + static std::string + GetImportLibraryFilename ( + const Module& module, + string_list* pclean_files ); + + std::string GetModuleTargets ( const Module& module ); + void GetObjectsVector ( const IfableData& data, + std::vector& objectFiles ) const; + void GenerateObjectMacro(); + void GenerateTargetMacro(); + void GenerateOtherMacros(); + + static MingwModuleHandler* InstanciateHandler ( const Module& module_, + MingwBackend* backend_ ); + virtual HostType DefaultHost() = 0; + void GeneratePreconditionDependencies (); + virtual void Process () = 0; + virtual std::string TypeSpecificCFlags() { return ""; } + virtual std::string TypeSpecificNasmFlags() { return ""; } + virtual std::string TypeSpecificLinkerFlags() { return ""; } + void GenerateInvocations () const; + void GenerateCleanTarget () const; + static bool ReferenceObjects ( const Module& module ); +protected: + std::string GetWorkingDirectory () const; + std::string GetBasename ( const std::string& filename ) const; + std::string GetActualSourceFilename ( const std::string& filename ) const; + std::string GetModuleArchiveFilename () const; + bool IsGeneratedFile ( const File& file ) const; + std::string GetImportLibraryDependency ( const Module& importedModule ); + void GetTargets ( const Module& dependencyModule, + string_list& targets ); + void GetModuleDependencies ( string_list& dependencies ); + std::string GetAllDependencies () const; + void GetSourceFilenames ( string_list& list, bool includeGeneratedFiles = true ) const; + void GetSourceFilenamesWithoutGeneratedFiles ( string_list& list ) const; + std::string GetObjectFilename ( const std::string& sourceFilename, + string_list* pclean_files ) const; + + std::string GetObjectFilenames (); + + std::string GetPreconditionDependenciesName () const; + std::string GetCFlagsMacro () const; + static std::string GetObjectsMacro ( const Module& ); + std::string GetLinkingDependenciesMacro () const; + std::string GetLibsMacro () const; + std::string GetLinkerMacro () const; + void GenerateCleanObjectsAsYouGoCode () const; + void GenerateLinkerCommand ( const std::string& dependencies, + const std::string& linker, + const std::string& linkerParameters, + const std::string& objectsMacro, + const std::string& libsMacro ); + void GeneratePhonyTarget() const; + void GenerateRules (); + void GenerateImportLibraryTargetIfNeeded (); + void GetDefinitionDependencies ( string_list& dependencies ) const; + std::string GetLinkingDependencies () const; + static MingwBackend* backend; + static FILE* fMakefile; + static bool use_pch; +private: + std::string ConcatenatePaths ( const std::string& path1, + const std::string& path2 ) const; + std::string GenerateGccDefineParametersFromVector ( const std::vector& defines ) const; + std::string GenerateGccDefineParameters () const; + std::string GenerateGccIncludeParametersFromVector ( const std::vector& includes ) const; + std::string GenerateCompilerParametersFromVector ( const std::vector& compilerFlags ) const; + std::string GenerateLinkerParametersFromVector ( const std::vector& linkerFlags ) const; + std::string GenerateImportLibraryDependenciesFromVector ( const std::vector& libraries ); + std::string GenerateLinkerParameters () const; + void GenerateMacro ( const char* assignmentOperation, + const std::string& macro, + const IfableData& data, + const std::vector* compilerFlags ); + void GenerateMacros ( const char* op, + const IfableData& data, + const std::vector* compilerFlags, + const std::vector* linkerFlags ); + void GenerateObjectMacros ( const char* assignmentOperation, + const IfableData& data, + const std::vector* compilerFlags, + const std::vector* linkerFlags ); + std::string GenerateGccIncludeParameters () const; + std::string GenerateGccParameters () const; + std::string GenerateNasmParameters () const; + void GenerateGccCommand ( const std::string& sourceFilename, + const std::string& cc, + const std::string& cflagsMacro ); + void GenerateGccAssemblerCommand ( const std::string& sourceFilename, + const std::string& cc, + const std::string& cflagsMacro ); + void GenerateNasmCommand ( const std::string& sourceFilename, + const std::string& nasmflagsMacro ); + void GenerateWindresCommand ( const std::string& sourceFilename, + const std::string& windresflagsMacro ); + void GenerateWinebuildCommands ( const std::string& sourceFilename ); ++ std::string GetWidlFlags ( const File& file ); + void GenerateWidlCommandsServer ( - const std::string& sourceFilename, ++ const File& file, + const std::string& widlflagsMacro ); + void GenerateWidlCommandsClient ( - const std::string& sourceFilename, ++ const File& file, + const std::string& widlflagsMacro ); - void GenerateWidlCommands ( const std::string& sourceFilename, ++ void GenerateWidlCommands ( const File& file, + const std::string& widlflagsMacro ); - void GenerateCommands ( const std::string& sourceFilename, ++ void GenerateCommands ( const File& file, + const std::string& cc, + const std::string& cppc, + const std::string& cflagsMacro, + const std::string& nasmflagsMacro, + const std::string& windresflagsMacro, + const std::string& widlflagsMacro ); + void GenerateObjectFileTargets ( const IfableData& data, + const std::string& cc, + const std::string& cppc, + const std::string& cflagsMacro, + const std::string& nasmflagsMacro, + const std::string& windresflagsMacro, + const std::string& widlflagsMacro ); + void GenerateObjectFileTargets ( const std::string& cc, + const std::string& cppc, + const std::string& cflagsMacro, + const std::string& nasmflagsMacro, + const std::string& windresflagsMacro, + const std::string& widlflagsMacro ); + std::string GenerateArchiveTarget ( const std::string& ar, + const std::string& objs_macro ) const; + void GetSpecObjectDependencies ( string_list& dependencies, + const std::string& filename ) const; + void GetWidlObjectDependencies ( string_list& dependencies, + const std::string& filename ) const; + void GetDefaultDependencies ( string_list& dependencies ) const; + void GetInvocationDependencies ( const Module& module, string_list& dependencies ); + bool IsWineModule () const; + std::string GetDefinitionFilename () const; + static std::string RemoveVariables ( std::string path); + void GenerateBuildMapCode (); + void GenerateBuildNonSymbolStrippedCode (); +public: + const Module& module; + string_list clean_files; + std::string cflagsMacro; + std::string nasmflagsMacro; + std::string windresflagsMacro; + std::string widlflagsMacro; + std::string linkerflagsMacro; + std::string objectsMacro; + std::string libsMacro; + std::string linkDepsMacro; +}; + + +class MingwBuildToolModuleHandler : public MingwModuleHandler +{ +public: + MingwBuildToolModuleHandler ( const Module& module ); + virtual HostType DefaultHost() { return HostTrue; } + virtual void Process (); +private: + void GenerateBuildToolModuleTarget (); +}; + + +class MingwKernelModuleHandler : public MingwModuleHandler +{ +public: + MingwKernelModuleHandler ( const Module& module ); + virtual HostType DefaultHost() { return HostFalse; } + virtual void Process (); + std::string TypeSpecificCFlags() { return "-D_SEH_NO_NATIVE_NLG"; } +private: + void GenerateKernelModuleTarget (); +}; + + +class MingwStaticLibraryModuleHandler : public MingwModuleHandler +{ +public: + MingwStaticLibraryModuleHandler ( const Module& module ); + virtual HostType DefaultHost() { return HostFalse; } + virtual void Process (); +private: + void GenerateStaticLibraryModuleTarget (); +}; + + +class MingwObjectLibraryModuleHandler : public MingwModuleHandler +{ +public: + MingwObjectLibraryModuleHandler ( const Module& module ); + virtual HostType DefaultHost() { return HostFalse; } + virtual void Process (); +private: + void GenerateObjectLibraryModuleTarget (); +}; + + +class MingwKernelModeDLLModuleHandler : public MingwModuleHandler +{ +public: + MingwKernelModeDLLModuleHandler ( const Module& module ); + virtual HostType DefaultHost() { return HostFalse; } + virtual void Process (); + std::string TypeSpecificCFlags() { return "-D_SEH_NO_NATIVE_NLG"; } + std::string TypeSpecificLinkerFlags() { return "-nostartfiles -nostdlib"; } +private: + void GenerateKernelModeDLLModuleTarget (); +}; + + +class MingwKernelModeDriverModuleHandler : public MingwModuleHandler +{ +public: + MingwKernelModeDriverModuleHandler ( const Module& module ); + virtual HostType DefaultHost() { return HostFalse; } + virtual void Process (); + std::string TypeSpecificCFlags() { return "-D__NTDRIVER__ -D_SEH_NO_NATIVE_NLG"; } + std::string TypeSpecificLinkerFlags() { return "-nostartfiles -nostdlib"; } +private: + void GenerateKernelModeDriverModuleTarget (); +}; + + +class MingwNativeDLLModuleHandler : public MingwModuleHandler +{ +public: + MingwNativeDLLModuleHandler ( const Module& module ); + virtual HostType DefaultHost() { return HostFalse; } + virtual void Process (); + std::string TypeSpecificCFlags() { return "-D_SEH_NO_NATIVE_NLG"; } + std::string TypeSpecificLinkerFlags() { return "-nostartfiles -nostdlib"; } +private: + void GenerateNativeDLLModuleTarget (); +}; + + +class MingwNativeCUIModuleHandler : public MingwModuleHandler +{ +public: + MingwNativeCUIModuleHandler ( const Module& module ); + virtual HostType DefaultHost() { return HostFalse; } + virtual void Process (); + std::string TypeSpecificCFlags() { return "-D__NTAPP__ -D_SEH_NO_NATIVE_NLG"; } + std::string TypeSpecificLinkerFlags() { return "-nostartfiles -nostdlib"; } +private: + void GenerateNativeCUIModuleTarget (); +}; + + +class MingwWin32DLLModuleHandler : public MingwModuleHandler +{ +public: + MingwWin32DLLModuleHandler ( const Module& module ); + virtual HostType DefaultHost() { return HostFalse; } + virtual void Process (); +private: + void GenerateExtractWineDLLResourcesTarget (); + void GenerateWin32DLLModuleTarget (); +}; + + +class MingwWin32CUIModuleHandler : public MingwModuleHandler +{ +public: + MingwWin32CUIModuleHandler ( const Module& module ); + virtual HostType DefaultHost() { return HostFalse; } + virtual void Process (); +private: + void GenerateWin32CUIModuleTarget (); +}; + + +class MingwWin32GUIModuleHandler : public MingwModuleHandler +{ +public: + MingwWin32GUIModuleHandler ( const Module& module ); + virtual HostType DefaultHost() { return HostFalse; } + virtual void Process (); +private: + void GenerateWin32GUIModuleTarget (); +}; + + +class MingwBootLoaderModuleHandler : public MingwModuleHandler +{ +public: + MingwBootLoaderModuleHandler ( const Module& module ); + virtual HostType DefaultHost() { return HostFalse; } + virtual void Process (); + std::string TypeSpecificLinkerFlags() { return "-nostartfiles -nostdlib"; } +private: + void GenerateBootLoaderModuleTarget (); +}; + + +class MingwBootSectorModuleHandler : public MingwModuleHandler +{ +public: + MingwBootSectorModuleHandler ( const Module& module ); + virtual HostType DefaultHost() { return HostFalse; } + virtual void Process (); + std::string TypeSpecificNasmFlags() { return "-f bin"; } +private: + void GenerateBootSectorModuleTarget (); +}; + + +class MingwIsoModuleHandler : public MingwModuleHandler +{ +public: + MingwIsoModuleHandler ( const Module& module ); + virtual HostType DefaultHost() { return HostFalse; } + virtual void Process (); +private: + void GenerateIsoModuleTarget (); + std::string GetBootstrapCdDirectories ( const std::string& bootcdDirectory ); + std::string GetNonModuleCdDirectories ( const std::string& bootcdDirectory ); + std::string GetCdDirectories ( const std::string& bootcdDirectory ); + void GetBootstrapCdFiles ( std::vector& out ) const; + void GetNonModuleCdFiles ( std::vector& out ) const; + void GetCdFiles ( std::vector& out ) const; + void OutputBootstrapfileCopyCommands ( const std::string& bootcdDirectory ); + void OutputCdfileCopyCommands ( const std::string& bootcdDirectory ); +}; + + +class MingwLiveIsoModuleHandler : public MingwModuleHandler +{ +public: + MingwLiveIsoModuleHandler ( const Module& module ); + virtual HostType DefaultHost() { return HostFalse; } + virtual void Process (); +private: + void GenerateLiveIsoModuleTarget (); + void CreateDirectory ( const std::string& directory ); + void OutputCopyCommand ( const std::string& sourceFilename, + const std::string& targetFilename, + const std::string& targetDirectory ); + void OutputModuleCopyCommands ( std::string& livecdDirectory, + std::string& livecdReactos ); + void OutputNonModuleCopyCommands ( std::string& livecdDirectory, + std::string& livecdReactos ); + void OutputProfilesDirectoryCommands ( std::string& livecdDirectory ); + void OutputLoaderCommands ( std::string& livecdDirectory ); + void OutputRegistryCommands ( std::string& livecdDirectory ); +}; + + +class MingwTestModuleHandler : public MingwModuleHandler +{ +public: + MingwTestModuleHandler ( const Module& module ); + virtual HostType DefaultHost() { return HostFalse; } + virtual void Process (); +private: + void GenerateTestModuleTarget (); +}; + + +class MingwRpcServerModuleHandler : public MingwModuleHandler +{ +public: + MingwRpcServerModuleHandler ( const Module& module ); + virtual HostType DefaultHost() { return HostFalse; } + virtual void Process (); +}; + + +class MingwRpcClientModuleHandler : public MingwModuleHandler +{ +public: + MingwRpcClientModuleHandler ( const Module& module ); + virtual HostType DefaultHost() { return HostFalse; } + virtual void Process (); +}; + +#endif /* MINGW_MODULEHANDLER_H */ diff --cc reactos/tools/rbuild/module.cpp index 2260fa2116d,00000000000..26422d2af86 mode 100644,000000..100644 --- a/reactos/tools/rbuild/module.cpp +++ b/reactos/tools/rbuild/module.cpp @@@ -1,961 -1,0 +1,970 @@@ +#include "pch.h" +#include + +#include "rbuild.h" + +using std::string; +using std::vector; + +string +FixSeparator ( const string& s ) +{ + string s2(s); + char* p = strchr ( &s2[0], CBAD_SEP ); + while ( p ) + { + *p++ = CSEP; + p = strchr ( p, CBAD_SEP ); + } + return s2; +} + +string +ReplaceExtension ( + const string& filename, + const string& newExtension ) +{ + size_t index = filename.find_last_of ( '/' ); + if ( index == string::npos ) + index = 0; + size_t index2 = filename.find_last_of ( '\\' ); + if ( index2 != string::npos && index2 > index ) + index = index2; + string tmp = filename.substr( index /*, filename.size() - index*/ ); + size_t ext_index = tmp.find_last_of( '.' ); + if ( ext_index != string::npos ) + return filename.substr ( 0, index + ext_index ) + newExtension; + return filename + newExtension; +} + +string +GetSubPath ( + const string& location, + const string& path, + const string& att_value ) +{ + if ( !att_value.size() ) + throw InvalidBuildFileException ( + location, + " tag has empty 'name' attribute" ); + if ( strpbrk ( att_value.c_str (), "/\\?*:<>|" ) ) + throw InvalidBuildFileException ( + location, + " tag has invalid characters in 'name' attribute" ); + if ( !path.size() ) + return att_value; + return FixSeparator(path + CSEP + att_value); +} + +string +GetExtension ( const string& filename ) +{ + size_t index = filename.find_last_of ( '/' ); + if (index == string::npos) index = 0; + string tmp = filename.substr( index, filename.size() - index ); + size_t ext_index = tmp.find_last_of( '.' ); + if (ext_index != string::npos) + return filename.substr ( index + ext_index, filename.size() ); + return ""; +} + +string +GetDirectory ( const string& filename ) +{ + size_t index = filename.find_last_of ( CSEP ); + if ( index == string::npos ) + return filename; + else + return filename.substr ( 0, index ); +} + +string +NormalizeFilename ( const string& filename ) +{ + Path path; + string normalizedPath = path.Fixup ( filename, true ); + string relativeNormalizedPath = path.RelativeFromWorkingDirectory ( normalizedPath ); + return FixSeparator ( relativeNormalizedPath ); +} + +IfableData::~IfableData() +{ + size_t i; + for ( i = 0; i < files.size(); i++ ) + delete files[i]; + for ( i = 0; i < includes.size(); i++ ) + delete includes[i]; + for ( i = 0; i < defines.size(); i++ ) + delete defines[i]; + for ( i = 0; i < libraries.size(); i++ ) + delete libraries[i]; + for ( i = 0; i < properties.size(); i++ ) + delete properties[i]; + for ( i = 0; i < ifs.size(); i++ ) + delete ifs[i]; +} + +void IfableData::ProcessXML () +{ + size_t i; + for ( i = 0; i < files.size (); i++ ) + files[i]->ProcessXML (); + for ( i = 0; i < includes.size (); i++ ) + includes[i]->ProcessXML (); + for ( i = 0; i < defines.size (); i++ ) + defines[i]->ProcessXML (); + for ( i = 0; i < libraries.size (); i++ ) + libraries[i]->ProcessXML (); + for ( i = 0; i < properties.size(); i++ ) + properties[i]->ProcessXML (); + for ( i = 0; i < ifs.size (); i++ ) + ifs[i]->ProcessXML (); +} + +Module::Module ( const Project& project, + const XMLElement& moduleNode, + const string& modulePath ) + : project (project), + node (moduleNode), + importLibrary (NULL), + bootstrap (NULL), + pch (NULL), + cplusplus (false), + host (HostDefault) +{ + if ( node.name != "module" ) + throw InvalidOperationException ( __FILE__, + __LINE__, + "Module created with non- node" ); + + xmlbuildFile = Path::RelativeFromWorkingDirectory ( moduleNode.xmlFile->filename() ); + + path = FixSeparator ( modulePath ); + + const XMLAttribute* att = moduleNode.GetAttribute ( "name", true ); + assert(att); + name = att->value; + + att = moduleNode.GetAttribute ( "type", true ); + assert(att); + type = GetModuleType ( node.location, *att ); + + att = moduleNode.GetAttribute ( "extension", false ); + if ( att != NULL ) + extension = att->value; + else + extension = GetDefaultModuleExtension (); + + att = moduleNode.GetAttribute ( "entrypoint", false ); + if ( att != NULL ) + entrypoint = att->value; + else + entrypoint = GetDefaultModuleEntrypoint (); + + att = moduleNode.GetAttribute ( "baseaddress", false ); + if ( att != NULL ) + baseaddress = att->value; + else + baseaddress = GetDefaultModuleBaseaddress (); + + att = moduleNode.GetAttribute ( "mangledsymbols", false ); + if ( att != NULL ) + { + const char* p = att->value.c_str(); + if ( !stricmp ( p, "true" ) || !stricmp ( p, "yes" ) ) + mangledSymbols = true; + else if ( !stricmp ( p, "false" ) || !stricmp ( p, "no" ) ) + mangledSymbols = false; + else + { + throw InvalidAttributeValueException ( + moduleNode.location, + "mangledsymbols", + att->value ); + } + } + else + mangledSymbols = false; + + att = moduleNode.GetAttribute ( "host", false ); + if ( att != NULL ) + { + const char* p = att->value.c_str(); + if ( !stricmp ( p, "true" ) || !stricmp ( p, "yes" ) ) + host = HostTrue; + else if ( !stricmp ( p, "false" ) || !stricmp ( p, "no" ) ) + host = HostFalse; + else + { + throw InvalidAttributeValueException ( + moduleNode.location, + "host", + att->value ); + } + } + + att = moduleNode.GetAttribute ( "prefix", false ); + if ( att != NULL ) + prefix = att->value; + + att = moduleNode.GetAttribute ( "installbase", false ); + if ( att != NULL ) + installBase = att->value; + else + installBase = ""; + + att = moduleNode.GetAttribute ( "installname", false ); + if ( att != NULL ) + installName = att->value; + else + installName = ""; + + att = moduleNode.GetAttribute ( "usewrc", false ); + if ( att != NULL ) + useWRC = att->value == "true"; + else + useWRC = true; + + att = moduleNode.GetAttribute ( "warnings", false ); + if ( att != NULL ) + enableWarnings = att->value == "true"; + else + enableWarnings = false; +} + +Module::~Module () +{ + size_t i; + for ( i = 0; i < invocations.size(); i++ ) + delete invocations[i]; + for ( i = 0; i < dependencies.size(); i++ ) + delete dependencies[i]; + for ( i = 0; i < compilerFlags.size(); i++ ) + delete compilerFlags[i]; + for ( i = 0; i < linkerFlags.size(); i++ ) + delete linkerFlags[i]; + for ( i = 0; i < stubbedComponents.size(); i++ ) + delete stubbedComponents[i]; + if ( pch ) + delete pch; +} + +void +Module::ProcessXML() +{ + size_t i; + for ( i = 0; i < node.subElements.size(); i++ ) + ProcessXMLSubElement ( *node.subElements[i], path ); + for ( i = 0; i < invocations.size(); i++ ) + invocations[i]->ProcessXML (); + for ( i = 0; i < dependencies.size(); i++ ) + dependencies[i]->ProcessXML (); + for ( i = 0; i < compilerFlags.size(); i++ ) + compilerFlags[i]->ProcessXML(); + for ( i = 0; i < linkerFlags.size(); i++ ) + linkerFlags[i]->ProcessXML(); + for ( i = 0; i < stubbedComponents.size(); i++ ) + stubbedComponents[i]->ProcessXML(); + non_if_data.ProcessXML(); + if ( pch ) + pch->ProcessXML(); +} + +void +Module::ProcessXMLSubElement ( const XMLElement& e, + const string& path, + If* pIf /*= NULL*/ ) +{ + bool subs_invalid = false; + string subpath ( path ); + if ( e.name == "file" && e.value.size () > 0 ) + { + bool first = false; + const XMLAttribute* att = e.GetAttribute ( "first", false ); - if ( att ) ++ if ( att != NULL ) + { + if ( !stricmp ( att->value.c_str(), "true" ) ) + first = true; + else if ( stricmp ( att->value.c_str(), "false" ) ) + throw InvalidBuildFileException ( + e.location, + "attribute 'first' of element can only be 'true' or 'false'" ); + } ++ string switches = ""; ++ att = e.GetAttribute ( "switches", false ); ++ if ( att != NULL ) ++ switches = att->value; + if ( !cplusplus ) + { + // check for c++ file + string ext = GetExtension ( e.value ); + if ( !stricmp ( ext.c_str(), ".cpp" ) ) + cplusplus = true; + else if ( !stricmp ( ext.c_str(), ".cc" ) ) + cplusplus = true; + else if ( !stricmp ( ext.c_str(), ".cxx" ) ) + cplusplus = true; + } - File* pFile = new File ( FixSeparator ( path + CSEP + e.value ), first ); ++ File* pFile = new File ( FixSeparator ( path + CSEP + e.value ), ++ first, ++ switches ); + if ( pIf ) + pIf->data.files.push_back ( pFile ); + else + non_if_data.files.push_back ( pFile ); + subs_invalid = true; + } + else if ( e.name == "library" && e.value.size () ) + { + Library* pLibrary = new Library ( e, *this, e.value ); + if ( pIf ) + pIf->data.libraries.push_back ( pLibrary ); + else + non_if_data.libraries.push_back ( pLibrary ); + subs_invalid = true; + } + else if ( e.name == "directory" ) + { + const XMLAttribute* att = e.GetAttribute ( "name", true ); + assert(att); + subpath = GetSubPath ( e.location, path, att->value ); + } + else if ( e.name == "include" ) + { + Include* include = new Include ( project, this, e ); + if ( pIf ) + pIf->data.includes.push_back ( include ); + else + non_if_data.includes.push_back ( include ); + subs_invalid = true; + } + else if ( e.name == "define" ) + { + Define* pDefine = new Define ( project, this, e ); + if ( pIf ) + pIf->data.defines.push_back ( pDefine ); + else + non_if_data.defines.push_back ( pDefine ); + subs_invalid = true; + } + else if ( e.name == "invoke" ) + { + if ( pIf ) + throw InvalidBuildFileException ( + e.location, + " is not a valid sub-element of " ); + invocations.push_back ( new Invoke ( e, *this ) ); + subs_invalid = false; + } + else if ( e.name == "dependency" ) + { + if ( pIf ) + throw InvalidBuildFileException ( + e.location, + " is not a valid sub-element of " ); + dependencies.push_back ( new Dependency ( e, *this ) ); + subs_invalid = true; + } + else if ( e.name == "importlibrary" ) + { + if ( pIf ) + throw InvalidBuildFileException ( + e.location, + " is not a valid sub-element of " ); + if ( importLibrary ) + throw InvalidBuildFileException ( + e.location, + "Only one is valid per module" ); + importLibrary = new ImportLibrary ( e, *this ); + subs_invalid = true; + } + else if ( e.name == "if" ) + { + If* pOldIf = pIf; + pIf = new If ( e, project, this ); + if ( pOldIf ) + pOldIf->data.ifs.push_back ( pIf ); + else + non_if_data.ifs.push_back ( pIf ); + subs_invalid = false; + } + else if ( e.name == "compilerflag" ) + { + compilerFlags.push_back ( new CompilerFlag ( project, this, e ) ); + subs_invalid = true; + } + else if ( e.name == "linkerflag" ) + { + linkerFlags.push_back ( new LinkerFlag ( project, this, e ) ); + subs_invalid = true; + } + else if ( e.name == "component" ) + { + stubbedComponents.push_back ( new StubbedComponent ( this, e ) ); + subs_invalid = false; + } + else if ( e.name == "property" ) + { + throw InvalidBuildFileException ( + e.location, + " is not a valid sub-element of " ); + } + else if ( e.name == "bootstrap" ) + { + bootstrap = new Bootstrap ( project, this, e ); + subs_invalid = true; + } + else if ( e.name == "pch" ) + { + if ( pIf ) + throw InvalidBuildFileException ( + e.location, + " is not a valid sub-element of " ); + if ( pch ) + throw InvalidBuildFileException ( + e.location, + "Only one is valid per module" ); + pch = new PchFile ( + e, *this, FixSeparator ( path + CSEP + e.value ) ); + subs_invalid = true; + } + if ( subs_invalid && e.subElements.size() > 0 ) + throw InvalidBuildFileException ( + e.location, + "<%s> cannot have sub-elements", + e.name.c_str() ); + for ( size_t i = 0; i < e.subElements.size (); i++ ) + ProcessXMLSubElement ( *e.subElements[i], subpath, pIf ); +} + +ModuleType +Module::GetModuleType ( const string& location, const XMLAttribute& attribute ) +{ + if ( attribute.value == "buildtool" ) + return BuildTool; + if ( attribute.value == "staticlibrary" ) + return StaticLibrary; + if ( attribute.value == "objectlibrary" ) + return ObjectLibrary; + if ( attribute.value == "kernel" ) + return Kernel; + if ( attribute.value == "kernelmodedll" ) + return KernelModeDLL; + if ( attribute.value == "kernelmodedriver" ) + return KernelModeDriver; + if ( attribute.value == "nativedll" ) + return NativeDLL; + if ( attribute.value == "nativecui" ) + return NativeCUI; + if ( attribute.value == "win32dll" ) + return Win32DLL; + if ( attribute.value == "win32cui" ) + return Win32CUI; + if ( attribute.value == "win32gui" ) + return Win32GUI; + if ( attribute.value == "bootloader" ) + return BootLoader; + if ( attribute.value == "bootsector" ) + return BootSector; + if ( attribute.value == "iso" ) + return Iso; + if ( attribute.value == "liveiso" ) + return LiveIso; + if ( attribute.value == "test" ) + return Test; + if ( attribute.value == "rpcserver" ) + return RpcServer; + if ( attribute.value == "rpcclient" ) + return RpcClient; + throw InvalidAttributeValueException ( location, + attribute.name, + attribute.value ); +} + +string +Module::GetDefaultModuleExtension () const +{ + switch (type) + { + case BuildTool: + return EXEPOSTFIX; + case StaticLibrary: + return ".a"; + case ObjectLibrary: + return ".o"; + case Kernel: + case NativeCUI: + case Win32CUI: + case Win32GUI: + return ".exe"; + case KernelModeDLL: + case NativeDLL: + case Win32DLL: + return ".dll"; + case KernelModeDriver: + case BootLoader: + return ".sys"; + case BootSector: + return ".o"; + case Iso: + case LiveIso: + return ".iso"; + case Test: + return ".exe"; + case RpcServer: + return ".o"; + case RpcClient: + return ".o"; + } + throw InvalidOperationException ( __FILE__, + __LINE__ ); +} + +string +Module::GetDefaultModuleEntrypoint () const +{ + switch (type) + { + case Kernel: + return "_NtProcessStartup"; + case KernelModeDLL: + return "_DriverEntry@8"; + case NativeDLL: + return "_DllMainCRTStartup@12"; + case NativeCUI: + return "_NtProcessStartup@4"; + case Win32DLL: + return "_DllMain@12"; + case Win32CUI: + case Test: + return "_mainCRTStartup"; + case Win32GUI: + return "_WinMainCRTStartup"; + case KernelModeDriver: + return "_DriverEntry@8"; + case BuildTool: + case StaticLibrary: + case ObjectLibrary: + case BootLoader: + case BootSector: + case Iso: + case LiveIso: + case RpcServer: + case RpcClient: + return ""; + } + throw InvalidOperationException ( __FILE__, + __LINE__ ); +} + +string +Module::GetDefaultModuleBaseaddress () const +{ + switch (type) + { + case Kernel: + return "0xc0000000"; + case KernelModeDLL: + return "0x10000"; + case NativeDLL: + return "0x10000"; + case NativeCUI: + return "0x10000"; + case Win32DLL: + return "0x10000"; + case Win32CUI: + case Test: + return "0x00400000"; + case Win32GUI: + return "0x00400000"; + case KernelModeDriver: + return "0x10000"; + case BuildTool: + case StaticLibrary: + case ObjectLibrary: + case BootLoader: + case BootSector: + case Iso: + case LiveIso: + case RpcServer: + case RpcClient: + return ""; + } + throw InvalidOperationException ( __FILE__, + __LINE__ ); +} + +bool +Module::HasImportLibrary () const +{ + return importLibrary != NULL; +} + +string +Module::GetTargetName () const +{ + return name + extension; +} + +string +Module::GetDependencyPath () const +{ + if ( HasImportLibrary () ) + { + return ReplaceExtension ( GetPath(), ".a" ); + } + else + return GetPath(); +} + +string +Module::GetBasePath () const +{ + return path; +} + +string +Module::GetPath () const +{ + if ( path.length() > 0 ) + return path + CSEP + GetTargetName (); + else + return GetTargetName (); +} + +string +Module::GetPathWithPrefix ( const string& prefix ) const +{ + return path + CSEP + prefix + GetTargetName (); +} + +string +Module::GetInvocationTarget ( const int index ) const +{ + return ssprintf ( "%s_invoke_%d", + name.c_str (), + index ); +} + +bool +Module::HasFileWithExtension ( + const IfableData& data, + const std::string& extension ) const +{ + size_t i; + for ( i = 0; i < data.files.size (); i++ ) + { + File& file = *data.files[i]; + string file_ext = GetExtension ( file.name ); + if ( !stricmp ( file_ext.c_str (), extension.c_str () ) ) + return true; + } + for ( i = 0; i < data.ifs.size (); i++ ) + { + if ( HasFileWithExtension ( data.ifs[i]->data, extension ) ) + return true; + } + return false; +} + +void +Module::InvokeModule () const +{ + for ( size_t i = 0; i < invocations.size (); i++ ) + { + Invoke& invoke = *invocations[i]; + string command = invoke.invokeModule->GetPath () + " " + invoke.GetParameters (); + printf ( "Executing '%s'\n\n", command.c_str () ); + int exitcode = system ( command.c_str () ); + if ( exitcode != 0 ) + throw InvocationFailedException ( command, + exitcode ); + } +} + + - File::File ( const string& _name, bool _first ) - : name(_name), first(_first) ++File::File ( const string& _name, bool _first, ++ std::string _switches ) ++ : name(_name), ++ first(_first), ++ switches(_switches) +{ +} + +void +File::ProcessXML() +{ +} + + +Library::Library ( const XMLElement& _node, + const Module& _module, + const string& _name ) + : node(_node), + module(_module), + name(_name), + imported_module(_module.project.LocateModule(_name)) +{ + if ( module.name == name ) + throw InvalidBuildFileException ( + node.location, + "module '%s' cannot link against itself", + name.c_str() ); + if ( !imported_module ) + throw InvalidBuildFileException ( + node.location, + "module '%s' trying to import non-existant module '%s'", + module.name.c_str(), + name.c_str() ); +} + +void +Library::ProcessXML() +{ + if ( !module.project.LocateModule ( name ) ) + throw InvalidBuildFileException ( + node.location, + "module '%s' is trying to link against non-existant module '%s'", + module.name.c_str(), + name.c_str() ); +} + + +Invoke::Invoke ( const XMLElement& _node, + const Module& _module ) + : node (_node), + module (_module) +{ +} + +void +Invoke::ProcessXML() +{ + const XMLAttribute* att = node.GetAttribute ( "module", false ); + if (att == NULL) + invokeModule = &module; + else + { + invokeModule = module.project.LocateModule ( att->value ); + if ( invokeModule == NULL ) + throw InvalidBuildFileException ( + node.location, + "module '%s' is trying to invoke non-existant module '%s'", + module.name.c_str(), + att->value.c_str() ); + } + + for ( size_t i = 0; i < node.subElements.size (); i++ ) + ProcessXMLSubElement ( *node.subElements[i] ); +} + +void +Invoke::ProcessXMLSubElement ( const XMLElement& e ) +{ + bool subs_invalid = false; + if ( e.name == "input" ) + { + for ( size_t i = 0; i < e.subElements.size (); i++ ) + ProcessXMLSubElementInput ( *e.subElements[i] ); + } + else if ( e.name == "output" ) + { + for ( size_t i = 0; i < e.subElements.size (); i++ ) + ProcessXMLSubElementOutput ( *e.subElements[i] ); + } + if ( subs_invalid && e.subElements.size() > 0 ) + throw InvalidBuildFileException ( e.location, + "<%s> cannot have sub-elements", + e.name.c_str() ); +} + +void +Invoke::ProcessXMLSubElementInput ( const XMLElement& e ) +{ + bool subs_invalid = false; + if ( e.name == "inputfile" && e.value.size () > 0 ) + { + input.push_back ( new InvokeFile ( e, FixSeparator ( module.path + CSEP + e.value ) ) ); + subs_invalid = true; + } + if ( subs_invalid && e.subElements.size() > 0 ) + throw InvalidBuildFileException ( e.location, + "<%s> cannot have sub-elements", + e.name.c_str() ); +} + +void +Invoke::ProcessXMLSubElementOutput ( const XMLElement& e ) +{ + bool subs_invalid = false; + if ( e.name == "outputfile" && e.value.size () > 0 ) + { + output.push_back ( new InvokeFile ( e, FixSeparator ( module.path + CSEP + e.value ) ) ); + subs_invalid = true; + } + if ( subs_invalid && e.subElements.size() > 0 ) + throw InvalidBuildFileException ( + e.location, + "<%s> cannot have sub-elements", + e.name.c_str() ); +} + +void +Invoke::GetTargets ( string_list& targets ) const +{ + for ( size_t i = 0; i < output.size (); i++ ) + { + InvokeFile& file = *output[i]; + targets.push_back ( NormalizeFilename ( file.name ) ); + } +} + +string +Invoke::GetParameters () const +{ + string parameters ( "" ); + size_t i; + for ( i = 0; i < output.size (); i++ ) + { + if ( parameters.length () > 0) + parameters += " "; + InvokeFile& invokeFile = *output[i]; + if ( invokeFile.switches.length () > 0 ) + { + parameters += invokeFile.switches + " "; + } + parameters += invokeFile.name; + } + + for ( i = 0; i < input.size (); i++ ) + { + if ( parameters.length () > 0 ) + parameters += " "; + InvokeFile& invokeFile = *input[i]; + if ( invokeFile.switches.length () > 0 ) + { + parameters += invokeFile.switches; + parameters += " "; + } + parameters += invokeFile.name ; + } + + return parameters; +} + + +InvokeFile::InvokeFile ( const XMLElement& _node, + const string& _name ) + : node (_node), + name (_name) +{ + const XMLAttribute* att = _node.GetAttribute ( "switches", false ); + if (att != NULL) + switches = att->value; + else + switches = ""; +} + +void +InvokeFile::ProcessXML() +{ +} + + +Dependency::Dependency ( const XMLElement& _node, + const Module& _module ) + : node (_node), + module (_module), + dependencyModule (NULL) +{ +} + +void +Dependency::ProcessXML() +{ + dependencyModule = module.project.LocateModule ( node.value ); + if ( dependencyModule == NULL ) + throw InvalidBuildFileException ( node.location, + "module '%s' depend on non-existant module '%s'", + module.name.c_str(), + node.value.c_str() ); +} + + +ImportLibrary::ImportLibrary ( const XMLElement& _node, + const Module& _module ) + : node (_node), + module (_module) +{ + const XMLAttribute* att = _node.GetAttribute ( "basename", false ); + if (att != NULL) + basename = att->value; + else + basename = module.name; + + att = _node.GetAttribute ( "definition", true ); + assert (att); + definition = FixSeparator(att->value); +} + + +If::If ( const XMLElement& node_, + const Project& project_, + const Module* module_ ) + : node(node_), project(project_), module(module_) +{ + const XMLAttribute* att; + + att = node.GetAttribute ( "property", true ); + assert(att); + property = att->value; + + att = node.GetAttribute ( "value", true ); + assert(att); + value = att->value; +} + +If::~If () +{ +} + +void +If::ProcessXML() +{ +} + + +Property::Property ( const XMLElement& node_, + const Project& project_, + const Module* module_ ) + : node(node_), project(project_), module(module_) +{ + const XMLAttribute* att; + + att = node.GetAttribute ( "name", true ); + assert(att); + name = att->value; + + att = node.GetAttribute ( "value", true ); + assert(att); + value = att->value; +} + +void +Property::ProcessXML() +{ +} + + +PchFile::PchFile ( + const XMLElement& node_, + const Module& module_, + const string& header_ ) + : node(node_), module(module_), header(header_) +{ +} + +void +PchFile::ProcessXML() +{ +} diff --cc reactos/tools/rbuild/rbuild.h index f14cc2ddcfe,00000000000..88d8838a3ef mode 100644,000000..100644 --- a/reactos/tools/rbuild/rbuild.h +++ b/reactos/tools/rbuild/rbuild.h @@@ -1,616 -1,0 +1,619 @@@ +#ifndef __RBUILD_H +#define __RBUILD_H + +#include "pch.h" + +#ifdef WIN32 +#include +#include +#endif/*WIN32*/ +#include +#include +#ifdef _MSC_VER +#include +#else/*_MSC_VER*/ +#include +#ifdef WIN32 +#include +#endif/*WIN32*/ +#endif/*_MSC_VER*/ + +#include "ssprintf.h" +#include "exception.h" +#include "XML.h" + +typedef std::vector string_list; + +#ifdef WIN32 +#define EXEPREFIX "" +#define EXEPOSTFIX ".exe" +#define CSEP '\\' +#define CBAD_SEP '/' +#define SSEP "\\" +#define SBAD_SEP "/" +#else +#define EXEPREFIX "./" +#define EXEPOSTFIX "" +#define CSEP '/' +#define CBAD_SEP '\\' +#define SSEP "/" +#define SBAD_SEP "\\" +#endif + +class Project; +class IfableData; +class Module; +class Include; +class Define; +class File; +class Library; +class Invoke; +class InvokeFile; +class Dependency; +class ImportLibrary; +class If; +class CompilerFlag; +class LinkerFlag; +class Property; +class AutomaticDependency; +class Bootstrap; +class CDFile; +class InstallFile; +class PchFile; +class StubbedComponent; +class StubbedSymbol; + +class SourceFileTest; + +class IfableData +{ +public: + std::vector files; + std::vector includes; + std::vector defines; + std::vector libraries; + std::vector properties; + std::vector ifs; + + ~IfableData(); + void ProcessXML(); +}; + +class Project +{ + std::string xmlfile; + XMLElement *node, *head; +public: + std::string name; + std::string makefile; + XMLIncludes xmlbuildfiles; + std::vector modules; + std::vector linkerFlags; + std::vector cdfiles; + std::vector installfiles; + IfableData non_if_data; + + Project ( const std::string& filename ); + ~Project (); + void WriteConfigurationFile (); + void ExecuteInvocations (); + void ProcessXML ( const std::string& path ); + Module* LocateModule ( const std::string& name ); + const Module* LocateModule ( const std::string& name ) const; + std::string GetProjectFilename () const; +private: + const Property* LookupProperty ( const std::string& name ) const; + void SetConfigurationOption ( char* s, + std::string name, + std::string* alternativeName ); + void SetConfigurationOption ( char* s, + std::string name ); + void WriteIfChanged ( char* outbuf, + std::string filename ); + void ReadXml (); + void ProcessXMLSubElement ( const XMLElement& e, + const std::string& path, + If* pIf = NULL ); + + // disable copy semantics + Project ( const Project& ); + Project& operator = ( const Project& ); +}; + + +enum ModuleType +{ + BuildTool, + StaticLibrary, + ObjectLibrary, + Kernel, + KernelModeDLL, + KernelModeDriver, + NativeDLL, + NativeCUI, + Win32DLL, + Win32CUI, + Win32GUI, + BootLoader, + BootSector, + Iso, + LiveIso, + Test, + RpcServer, + RpcClient +}; + +enum HostType +{ + HostFalse, + HostDefault, + HostTrue +}; + +class Module +{ +public: + const Project& project; + const XMLElement& node; + std::string xmlbuildFile; + std::string name; + std::string extension; + std::string entrypoint; + std::string baseaddress; + std::string path; + ModuleType type; + ImportLibrary* importLibrary; + bool mangledSymbols; + Bootstrap* bootstrap; + IfableData non_if_data; + std::vector invocations; + std::vector dependencies; + std::vector compilerFlags; + std::vector linkerFlags; + std::vector stubbedComponents; + PchFile* pch; + bool cplusplus; + std::string prefix; + HostType host; + std::string installBase; + std::string installName; + bool useWRC; + bool enableWarnings; + + Module ( const Project& project, + const XMLElement& moduleNode, + const std::string& modulePath ); + ~Module (); + ModuleType GetModuleType ( const std::string& location, + const XMLAttribute& attribute ); + bool HasImportLibrary () const; + std::string GetTargetName () const; + std::string GetDependencyPath () const; + std::string GetBasePath () const; + std::string GetPath () const; + std::string GetPathWithPrefix ( const std::string& prefix ) const; + void GetTargets ( string_list& ) const; + std::string GetInvocationTarget ( const int index ) const; + bool HasFileWithExtension ( const IfableData&, const std::string& extension ) const; + void InvokeModule () const; + void ProcessXML (); +private: + std::string GetDefaultModuleExtension () const; + std::string GetDefaultModuleEntrypoint () const; + std::string GetDefaultModuleBaseaddress () const; + void ProcessXMLSubElement ( const XMLElement& e, + const std::string& path, + If* pIf = NULL ); +}; + + +class Include +{ +public: + const Project& project; + const Module* module; + const XMLElement& node; + std::string directory; + std::string basePath; + + Include ( const Project& project, + const XMLElement& includeNode ); + Include ( const Project& project, + const Module* module, + const XMLElement& includeNode ); + ~Include (); + void ProcessXML(); +private: + void Initialize(); +}; + + +class Define +{ +public: + const Project& project; + const Module* module; + const XMLElement& node; + std::string name; + std::string value; + + Define ( const Project& project, + const XMLElement& defineNode ); + Define ( const Project& project, + const Module* module, + const XMLElement& defineNode ); + ~Define(); + void ProcessXML(); +private: + void Initialize(); +}; + + +class File +{ +public: + std::string name; + bool first; ++ std::string switches; + - File ( const std::string& _name, bool _first ); ++ File ( const std::string& _name, ++ bool _first, ++ std::string _switches ); + + void ProcessXML(); +}; + + +class Library +{ +public: + const XMLElement& node; + const Module& module; + std::string name; + const Module* imported_module; + + Library ( const XMLElement& _node, + const Module& _module, + const std::string& _name ); + + void ProcessXML(); +}; + + +class Invoke +{ +public: + const XMLElement& node; + const Module& module; + const Module* invokeModule; + std::vector input; + std::vector output; + + Invoke ( const XMLElement& _node, + const Module& _module ); + + void ProcessXML(); + void GetTargets ( string_list& targets ) const; + std::string GetParameters () const; +private: + void ProcessXMLSubElement ( const XMLElement& e ); + void ProcessXMLSubElementInput ( const XMLElement& e ); + void ProcessXMLSubElementOutput ( const XMLElement& e ); +}; + + +class InvokeFile +{ +public: + const XMLElement& node; + std::string name; + std::string switches; + + InvokeFile ( const XMLElement& _node, + const std::string& _name ); + + void ProcessXML (); +}; + + +class Dependency +{ +public: + const XMLElement& node; + const Module& module; + const Module* dependencyModule; + + Dependency ( const XMLElement& _node, + const Module& _module ); + + void ProcessXML(); +}; + + +class ImportLibrary +{ +public: + const XMLElement& node; + const Module& module; + std::string basename; + std::string definition; + + ImportLibrary ( const XMLElement& _node, + const Module& module ); + + void ProcessXML (); +}; + + +class If +{ +public: + const XMLElement& node; + const Project& project; + const Module* module; + std::string property, value; + IfableData data; + + If ( const XMLElement& node_, + const Project& project_, + const Module* module_ ); + ~If(); + + void ProcessXML(); +}; + + +class CompilerFlag +{ +public: + const Project& project; + const Module* module; + const XMLElement& node; + std::string flag; + + CompilerFlag ( const Project& project, + const XMLElement& compilerFlagNode ); + CompilerFlag ( const Project& project, + const Module* module, + const XMLElement& compilerFlagNode ); + ~CompilerFlag (); + void ProcessXML(); +private: + void Initialize(); +}; + + +class LinkerFlag +{ +public: + const Project& project; + const Module* module; + const XMLElement& node; + std::string flag; + + LinkerFlag ( const Project& project, + const XMLElement& linkerFlagNode ); + LinkerFlag ( const Project& project, + const Module* module, + const XMLElement& linkerFlagNode ); + ~LinkerFlag (); + void ProcessXML(); +private: + void Initialize(); +}; + + +class Property +{ +public: + const XMLElement& node; + const Project& project; + const Module* module; + std::string name, value; + + Property ( const XMLElement& node_, + const Project& project_, + const Module* module_ ); + + void ProcessXML(); +}; + + +class SourceFile +{ +public: + SourceFile ( AutomaticDependency* automaticDependency, + Module& module, + const std::string& filename, + SourceFile* parent, + bool isNonAutomaticDependency ); + SourceFile* ParseFile ( const std::string& normalizedFilename ); + void Parse (); + std::string Location () const; + std::vector files; + AutomaticDependency* automaticDependency; + Module& module; + std::string filename; + std::string filenamePart; + std::string directoryPart; + std::vector parents; /* List of files, this file is included from */ + bool isNonAutomaticDependency; + std::string cachedDependencies; + time_t lastWriteTime; + time_t youngestLastWriteTime; /* Youngest last write time of this file and all children */ + SourceFile* youngestFile; +private: + void GetDirectoryAndFilenameParts (); + void Close (); + void Open (); + void SkipWhitespace (); + bool ReadInclude ( std::string& filename, + bool& includeNext ); + bool IsIncludedFrom ( const std::string& normalizedFilename ); + SourceFile* GetParentSourceFile (); + bool CanProcessFile ( const std::string& extension ); + bool IsParentOf ( const SourceFile* parent, + const SourceFile* child ); + std::string buf; + const char *p; + const char *end; +}; + + +class AutomaticDependency +{ + friend class SourceFileTest; +public: + const Project& project; + + AutomaticDependency ( const Project& project ); + ~AutomaticDependency (); + void Process (); + std::string GetFilename ( const std::string& filename ); + bool LocateIncludedFile ( const std::string& directory, + const std::string& includedFilename, + std::string& resolvedFilename ); + bool LocateIncludedFile ( SourceFile* sourceFile, + Module& module, + const std::string& includedFilename, + bool includeNext, + std::string& resolvedFilename ); + SourceFile* RetrieveFromCacheOrParse ( Module& module, + const std::string& filename, + SourceFile* parentSourceFile ); + SourceFile* RetrieveFromCache ( const std::string& filename ); + void CheckAutomaticDependencies ( bool verbose ); + void CheckAutomaticDependenciesForFile ( SourceFile* sourceFile ); +private: + void ProcessModule ( Module& module ); + void ProcessFile ( Module& module, + const File& file ); + std::map sourcefile_map; +}; + + +class Bootstrap +{ +public: + const Project& project; + const Module* module; + const XMLElement& node; + std::string base; + std::string nameoncd; + + Bootstrap ( const Project& project, + const Module* module, + const XMLElement& bootstrapNode ); + ~Bootstrap (); + void ProcessXML(); +private: + bool IsSupportedModuleType ( ModuleType type ); + void Initialize(); +}; + + +class CDFile +{ +public: + const Project& project; + const XMLElement& node; + std::string name; + std::string base; + std::string nameoncd; + std::string path; + + CDFile ( const Project& project, + const XMLElement& bootstrapNode, + const std::string& path ); + ~CDFile (); + void ProcessXML(); + std::string GetPath () const; +}; + + +class InstallFile +{ +public: + const Project& project; + const XMLElement& node; + std::string name; + std::string base; + std::string newname; + std::string path; + + InstallFile ( const Project& project, + const XMLElement& bootstrapNode, + const std::string& path ); + ~InstallFile (); + void ProcessXML (); + std::string GetPath () const; +}; + + +class PchFile +{ +public: + const XMLElement& node; + const Module& module; + std::string header; + + PchFile ( + const XMLElement& node, + const Module& module, + const std::string& header ); + void ProcessXML(); +}; + + +class StubbedComponent +{ +public: + const Module* module; + const XMLElement& node; + std::string name; + std::vector symbols; + + StubbedComponent ( const Module* module_, + const XMLElement& stubbedComponentNode ); + ~StubbedComponent (); + void ProcessXML (); + void ProcessXMLSubElement ( const XMLElement& e ); +}; + + +class StubbedSymbol +{ +public: + const XMLElement& node; + std::string symbol; + std::string newname; + + StubbedSymbol ( const XMLElement& stubbedSymbolNode ); + ~StubbedSymbol (); + void ProcessXML(); +}; + +extern std::string +FixSeparator ( const std::string& s ); + +extern std::string +ReplaceExtension ( + const std::string& filename, + const std::string& newExtension ); + +extern std::string +GetSubPath ( + const std::string& location, + const std::string& path, + const std::string& att_value ); + +extern std::string +GetExtension ( const std::string& filename ); + +extern std::string +GetDirectory ( const std::string& filename ); + +extern std::string +NormalizeFilename ( const std::string& filename ); + +#endif /* __RBUILD_H */ diff --cc reactos/tools/wrc/y.tab.c index 0ad3f05174d,48e6246bce4..1905fbe9f84 --- a/reactos/tools/wrc/y.tab.c +++ b/reactos/tools/wrc/y.tab.c @@@ -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 /* 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 +/* YYFINAL -- State number of the termination state. */ +#define YYFINAL 3 +/* YYLAST -- Last index in YYTABLE. */ - #define YYLAST 696 ++#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, @@@ -692,172 -426,171 +692,172 @@@ }; #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 }; +/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing + STATE-NUM. */ - #define YYPACT_NINF -523 ++#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 /* 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 999 of yacc.c. */ - #line 4135 "y.tab.c" ++#line 4129 "y.tab.c" yyvsp -= yylen; yyssp -= yylen;