diff --git a/reactos/base/applications/winhlp32/CMakeLists.txt b/reactos/base/applications/winhlp32/CMakeLists.txt index 2c7e0600c03..f4c6f67122e 100644 --- a/reactos/base/applications/winhlp32/CMakeLists.txt +++ b/reactos/base/applications/winhlp32/CMakeLists.txt @@ -11,14 +11,11 @@ list(APPEND SOURCE callback.c hlpfile.c macro.c + macro.lex.yy.c string.c - winhelp.c - lex.yy.c) - -add_executable(winhlp32 - ${SOURCE} - rsrc.rc) + winhelp.c) +add_executable(winhlp32 ${SOURCE} rsrc.rc) set_module_type(winhlp32 win32gui) target_link_libraries(winhlp32 wine) add_importlibs(winhlp32 user32 gdi32 shell32 comctl32 comdlg32 msvcrt kernel32 ntdll) diff --git a/reactos/base/applications/winhlp32/callback.c b/reactos/base/applications/winhlp32/callback.c index 69f0d900ded..4c95a106cce 100644 --- a/reactos/base/applications/winhlp32/callback.c +++ b/reactos/base/applications/winhlp32/callback.c @@ -45,7 +45,7 @@ static HANDLE CALLBACK WHD_Open(LPSTR name, BYTE flags) case 2: mode = GENERIC_READ; break; default: WINE_FIXME("Undocumented flags %x\n", flags); } - return CreateFile(name, mode, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, + return CreateFileA(name, mode, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); } diff --git a/reactos/base/applications/winhlp32/hlpfile.c b/reactos/base/applications/winhlp32/hlpfile.c index 52672bf5e02..fbde82e9d6c 100644 --- a/reactos/base/applications/winhlp32/hlpfile.c +++ b/reactos/base/applications/winhlp32/hlpfile.c @@ -711,7 +711,7 @@ static BOOL HLPFILE_RtfAddText(struct RtfData* rd, const char* str) } for (last = p = str; *p; p++) { - if (*p < 0) /* escape non ASCII chars */ + if (*p & 0x80) /* escape non-ASCII chars */ { static char xx[8]; rlen = sprintf(xx, "\\'%x", *(const BYTE*)p); @@ -901,7 +901,7 @@ static BOOL HLPFILE_RtfAddTransparentBitmap(struct RtfData* rd, const BITMAPINFO DeleteDC(hdcMem); /* we create the bitmap on the fly */ - hdcEMF = CreateEnhMetaFile(NULL, NULL, NULL, NULL); + hdcEMF = CreateEnhMetaFileW(NULL, NULL, NULL, NULL); hdcMem = CreateCompatibleDC(hdcEMF); /* sets to RGB(0,0,0) the transparent bits in final bitmap */ @@ -1366,14 +1366,14 @@ static BOOL HLPFILE_BrowseParagraph(HLPFILE_PAGE* page, struct RtfData* rd, BYTE brdr = *format++; short w; - if (brdr & 0x01 && !HLPFILE_RtfAddControl(rd, "\\box")) goto done; - if (brdr & 0x02 && !HLPFILE_RtfAddControl(rd, "\\brdrt")) goto done; - if (brdr & 0x04 && !HLPFILE_RtfAddControl(rd, "\\brdrl")) goto done; - if (brdr & 0x08 && !HLPFILE_RtfAddControl(rd, "\\brdrb")) goto done; - if (brdr & 0x10 && !HLPFILE_RtfAddControl(rd, "\\brdrr")) goto done; - if (brdr & 0x20 && !HLPFILE_RtfAddControl(rd, "\\brdrth")) goto done; + if ((brdr & 0x01) && !HLPFILE_RtfAddControl(rd, "\\box")) goto done; + if ((brdr & 0x02) && !HLPFILE_RtfAddControl(rd, "\\brdrt")) goto done; + if ((brdr & 0x04) && !HLPFILE_RtfAddControl(rd, "\\brdrl")) goto done; + if ((brdr & 0x08) && !HLPFILE_RtfAddControl(rd, "\\brdrb")) goto done; + if ((brdr & 0x10) && !HLPFILE_RtfAddControl(rd, "\\brdrr")) goto done; + if ((brdr & 0x20) && !HLPFILE_RtfAddControl(rd, "\\brdrth")) goto done; if (!(brdr & 0x20) && !HLPFILE_RtfAddControl(rd, "\\brdrs")) goto done; - if (brdr & 0x40 && !HLPFILE_RtfAddControl(rd, "\\brdrdb")) goto done; + if ((brdr & 0x40) && !HLPFILE_RtfAddControl(rd, "\\brdrdb")) goto done; /* 0x80: unknown */ w = GET_SHORT(format, 0); format += 2; @@ -1526,7 +1526,6 @@ static BOOL HLPFILE_BrowseParagraph(HLPFILE_PAGE* page, struct RtfData* rd, case 0x88: { BYTE type = format[1]; - LONG size; /* FIXME: we don't use 'BYTE pos = (*format - 0x86);' for the image position */ format += 2; @@ -1536,7 +1535,7 @@ static BOOL HLPFILE_BrowseParagraph(HLPFILE_PAGE* page, struct RtfData* rd, { case 0x22: fetch_ushort(&format); /* hot spot */ - /* fall thru */ + /* fall through */ case 0x03: switch (GET_SHORT(format, 0)) { @@ -1584,7 +1583,7 @@ static BOOL HLPFILE_BrowseParagraph(HLPFILE_PAGE* page, struct RtfData* rd, case 0x8C: if (!HLPFILE_RtfAddControl(rd, "\\_")) goto done; - /* FIXME: it could be that hypen is also in input stream !! */ + /* FIXME: it could be that hyphen is also in input stream !! */ format += 1; rd->char_pos++; break; @@ -1873,9 +1872,9 @@ static BOOL HLPFILE_ReadFont(HLPFILE* hlpfile) hlpfile->fonts[i].LogFont.lfEscapement = 0; hlpfile->fonts[i].LogFont.lfOrientation = 0; hlpfile->fonts[i].LogFont.lfWeight = (flag & 1) ? 700 : 400; - hlpfile->fonts[i].LogFont.lfItalic = (flag & 2) ? TRUE : FALSE; - hlpfile->fonts[i].LogFont.lfUnderline = (flag & 4) ? TRUE : FALSE; - hlpfile->fonts[i].LogFont.lfStrikeOut = (flag & 8) ? TRUE : FALSE; + hlpfile->fonts[i].LogFont.lfItalic = (flag & 2) != 0; + hlpfile->fonts[i].LogFont.lfUnderline = (flag & 4) != 0; + hlpfile->fonts[i].LogFont.lfStrikeOut = (flag & 8) != 0; hlpfile->fonts[i].LogFont.lfCharSet = hlpfile->charset; hlpfile->fonts[i].LogFont.lfOutPrecision = OUT_DEFAULT_PRECIS; hlpfile->fonts[i].LogFont.lfClipPrecision = CLIP_DEFAULT_PRECIS; @@ -2013,7 +2012,7 @@ static BOOL HLPFILE_SystemCommands(HLPFILE* hlpfile) hlpfile->lpszTitle = HeapAlloc(GetProcessHeap(), 0, strlen(str) + 1); if (!hlpfile->lpszTitle) return FALSE; - lstrcpy(hlpfile->lpszTitle, str); + strcpy(hlpfile->lpszTitle, str); WINE_TRACE("Title: %s\n", hlpfile->lpszTitle); /* Nothing more to parse */ return TRUE; @@ -2027,7 +2026,7 @@ static BOOL HLPFILE_SystemCommands(HLPFILE* hlpfile) if (hlpfile->lpszTitle) {WINE_WARN("title\n"); break;} hlpfile->lpszTitle = HeapAlloc(GetProcessHeap(), 0, strlen(str) + 1); if (!hlpfile->lpszTitle) return FALSE; - lstrcpy(hlpfile->lpszTitle, str); + strcpy(hlpfile->lpszTitle, str); WINE_TRACE("Title: %s\n", hlpfile->lpszTitle); break; @@ -2035,7 +2034,7 @@ static BOOL HLPFILE_SystemCommands(HLPFILE* hlpfile) if (hlpfile->lpszCopyright) {WINE_WARN("copyright\n"); break;} hlpfile->lpszCopyright = HeapAlloc(GetProcessHeap(), 0, strlen(str) + 1); if (!hlpfile->lpszCopyright) return FALSE; - lstrcpy(hlpfile->lpszCopyright, str); + strcpy(hlpfile->lpszCopyright, str); WINE_TRACE("Copyright: %s\n", hlpfile->lpszCopyright); break; @@ -2046,10 +2045,10 @@ static BOOL HLPFILE_SystemCommands(HLPFILE* hlpfile) break; case 4: - macro = HeapAlloc(GetProcessHeap(), 0, sizeof(HLPFILE_MACRO) + lstrlen(str) + 1); + macro = HeapAlloc(GetProcessHeap(), 0, sizeof(HLPFILE_MACRO) + strlen(str) + 1); if (!macro) break; p = (char*)macro + sizeof(HLPFILE_MACRO); - lstrcpy(p, str); + strcpy(p, str); macro->lpszMacro = p; macro->next = 0; for (m = &hlpfile->first_macro; *m; m = &(*m)->next); @@ -2077,9 +2076,9 @@ static BOOL HLPFILE_SystemCommands(HLPFILE* hlpfile) if (hlpfile->windows) { - unsigned flags = GET_USHORT(ptr, 4); HLPFILE_WINDOWINFO* wi = &hlpfile->windows[hlpfile->numWindows - 1]; + flags = GET_USHORT(ptr, 4); if (flags & 0x0001) strcpy(wi->type, &str[2]); else wi->type[0] = '\0'; if (flags & 0x0002) strcpy(wi->name, &str[12]); @@ -2357,14 +2356,14 @@ static BOOL HLPFILE_Uncompress_Phrases40(HLPFILE* hlpfile) INT dec_size, cpr_size; BYTE *buf_idx, *end_idx; BYTE *buf_phs, *end_phs; - LONG* ptr, mask = 0; + ULONG* ptr, mask = 0; unsigned int i; unsigned short bc, n; if (!HLPFILE_FindSubFile(hlpfile, "|PhrIndex", &buf_idx, &end_idx) || !HLPFILE_FindSubFile(hlpfile, "|PhrImage", &buf_phs, &end_phs)) return FALSE; - ptr = (LONG*)(buf_idx + 9 + 28); + ptr = (ULONG*)(buf_idx + 9 + 28); bc = GET_USHORT(buf_idx, 9 + 24) & 0x0F; num = hlpfile->num_phrases = GET_USHORT(buf_idx, 9 + 4); @@ -2399,9 +2398,10 @@ static BOOL HLPFILE_Uncompress_Phrases40(HLPFILE* hlpfile) return FALSE; } -#define getbit() (ptr += (mask < 0), mask = mask*2 + (mask<=0), (*ptr & mask) != 0) +#define getbit() ((mask <<= 1) ? (*ptr & mask) != 0: (*++ptr & (mask=1)) != 0) hlpfile->phrases_offsets[0] = 0; + ptr--; /* as we'll first increment ptr because mask is 0 on first getbit() call */ for (i = 0; i < num; i++) { for (n = 1; getbit(); n += 1 << bc); @@ -2645,7 +2645,6 @@ static BOOL HLPFILE_DoReadHlpFile(HLPFILE *hlpfile, LPCSTR lpszPath) if (!HLPFILE_Uncompress_Topic(hlpfile)) return FALSE; if (!HLPFILE_ReadFont(hlpfile)) return FALSE; - buf = hlpfile->topic_map[0]; old_index = -1; offs = 0; do @@ -2733,7 +2732,7 @@ HLPFILE *HLPFILE_ReadHlpFile(LPCSTR lpszPath) } hlpfile = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, - sizeof(HLPFILE) + lstrlen(lpszPath) + 1); + sizeof(HLPFILE) + strlen(lpszPath) + 1); if (!hlpfile) return 0; hlpfile->lpszPath = (char*)hlpfile + sizeof(HLPFILE); diff --git a/reactos/base/applications/winhlp32/hlpfile.h b/reactos/base/applications/winhlp32/hlpfile.h index f2c5b12fd28..6b2e28a4f37 100644 --- a/reactos/base/applications/winhlp32/hlpfile.h +++ b/reactos/base/applications/winhlp32/hlpfile.h @@ -90,7 +90,7 @@ typedef struct typedef struct { - LOGFONT LogFont; + LOGFONTA LogFont; HFONT hFont; COLORREF color; } HLPFILE_FONT; diff --git a/reactos/base/applications/winhlp32/macro.c b/reactos/base/applications/winhlp32/macro.c index d75eaf64e74..a44393fd8d4 100644 --- a/reactos/base/applications/winhlp32/macro.c +++ b/reactos/base/applications/winhlp32/macro.c @@ -61,7 +61,7 @@ static WINHELP_BUTTON** MACRO_LookupButton(WINHELP_WINDOW* win, LPCSTR na WINHELP_BUTTON** b; for (b = &win->first_button; *b; b = &(*b)->next) - if (!lstrcmpi(name, (*b)->lpszID)) break; + if (!lstrcmpiA(name, (*b)->lpszID)) break; return b; } @@ -79,7 +79,7 @@ void CALLBACK MACRO_CreateButton(LPCSTR id, LPCSTR name, LPCSTR macro) WINE_TRACE("(\"%s\", \"%s\", %s)\n", id, name, macro); - size = sizeof(WINHELP_BUTTON) + lstrlen(id) + lstrlen(name) + lstrlen(macro) + 3; + size = sizeof(WINHELP_BUTTON) + strlen(id) + strlen(name) + strlen(macro) + 3; button = HeapAlloc(GetProcessHeap(), 0, size); if (!button) return; @@ -89,15 +89,15 @@ void CALLBACK MACRO_CreateButton(LPCSTR id, LPCSTR name, LPCSTR macro) ptr = (char*)button + sizeof(WINHELP_BUTTON); - lstrcpy(ptr, id); + strcpy(ptr, id); button->lpszID = ptr; - ptr += lstrlen(id) + 1; + ptr += strlen(id) + 1; - lstrcpy(ptr, name); + strcpy(ptr, name); button->lpszName = ptr; - ptr += lstrlen(name) + 1; + ptr += strlen(name) + 1; - lstrcpy(ptr, macro); + strcpy(ptr, macro); button->lpszMacro = ptr; button->wParam = WH_FIRST_BUTTON; @@ -236,8 +236,8 @@ static void CALLBACK MACRO_ChangeButtonBinding(LPCSTR id, LPCSTR macro) b = MACRO_LookupButton(win, id); if (!*b) {WINE_FIXME("Couldn't find button '%s'\n", id); return;} - size = sizeof(WINHELP_BUTTON) + lstrlen(id) + - lstrlen((*b)->lpszName) + lstrlen(macro) + 3; + size = sizeof(WINHELP_BUTTON) + strlen(id) + + strlen((*b)->lpszName) + strlen(macro) + 3; button = HeapAlloc(GetProcessHeap(), 0, size); if (!button) return; @@ -248,15 +248,15 @@ static void CALLBACK MACRO_ChangeButtonBinding(LPCSTR id, LPCSTR macro) ptr = (char*)button + sizeof(WINHELP_BUTTON); - lstrcpy(ptr, id); + strcpy(ptr, id); button->lpszID = ptr; - ptr += lstrlen(id) + 1; + ptr += strlen(id) + 1; - lstrcpy(ptr, (*b)->lpszName); + strcpy(ptr, (*b)->lpszName); button->lpszName = ptr; - ptr += lstrlen((*b)->lpszName) + 1; + ptr += strlen((*b)->lpszName) + 1; - lstrcpy(ptr, macro); + strcpy(ptr, macro); button->lpszMacro = ptr; *b = button; @@ -291,7 +291,7 @@ static void CALLBACK MACRO_CloseSecondarys(void) for (win = Globals.win_list; win; win = next) { next = win->next; - if (lstrcmpi(win->info->name, "main")) + if (lstrcmpiA(win->info->name, "main")) WINHELP_ReleaseWindow(win); } } @@ -308,7 +308,7 @@ static void CALLBACK MACRO_CloseWindow(LPCSTR lpszWindow) for (win = Globals.win_list; win; win = next) { next = win->next; - if (!lstrcmpi(win->info->name, lpszWindow)) + if (!lstrcmpiA(win->info->name, lpszWindow)) WINHELP_ReleaseWindow(win); } } @@ -415,7 +415,7 @@ static void CALLBACK MACRO_ExtInsertMenu(LPCSTR str1, LPCSTR str2, LPCSTR str3, static BOOL CALLBACK MACRO_FileExist(LPCSTR str) { WINE_TRACE("(\"%s\")\n", str); - return GetFileAttributes(str) != INVALID_FILE_ATTRIBUTES; + return GetFileAttributesA(str) != INVALID_FILE_ATTRIBUTES; } void CALLBACK MACRO_FileOpen(void) @@ -457,7 +457,7 @@ static void CALLBACK MACRO_FocusWindow(LPCSTR lpszWindow) if (!lpszWindow || !lpszWindow[0]) lpszWindow = "main"; for (win = Globals.win_list; win; win = win->next) - if (!lstrcmpi(win->info->name, lpszWindow)) + if (!lstrcmpiA(win->info->name, lpszWindow)) SetFocus(win->hMainWnd); } @@ -488,7 +488,29 @@ void CALLBACK MACRO_HelpOn(void) void CALLBACK MACRO_HelpOnTop(void) { - WINE_FIXME("()\n"); + static BOOL on_top = FALSE; + WINHELP_WINDOW *win; + HWND main_wnd = NULL; + HMENU menu; + + for (win = Globals.win_list; win; win = win->next) + if (!lstrcmpiA(win->info->name, "main")) + main_wnd = win->hMainWnd; + if (!main_wnd) + { + WINE_ERR("could not find the main window!\n"); + return; + } + menu = GetMenu(main_wnd); + + on_top = !on_top; + if (on_top) { + CheckMenuItem(menu, MNID_HELP_HELPTOP, MF_BYCOMMAND|MF_CHECKED); + SetWindowPos(main_wnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE); + } else { + CheckMenuItem(menu, MNID_HELP_HELPTOP, MF_BYCOMMAND|MF_UNCHECKED); + SetWindowPos(main_wnd, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE); + } } void CALLBACK MACRO_History(void) @@ -497,7 +519,7 @@ void CALLBACK MACRO_History(void) if (Globals.active_win && !Globals.active_win->hHistoryWnd) { - HWND hWnd = CreateWindow(HISTORY_WIN_CLASS_NAME, "History", WS_OVERLAPPEDWINDOW, + HWND hWnd = CreateWindowA(HISTORY_WIN_CLASS_NAME, "History", WS_OVERLAPPEDWINDOW, 0, 0, 0, 0, 0, 0, Globals.hInstance, Globals.active_win); ShowWindow(hWnd, SW_NORMAL); } @@ -553,11 +575,11 @@ void CALLBACK MACRO_JumpContext(LPCSTR lpszPath, LPCSTR lpszWindow, LONG context HLPFILE* hlpfile; WINE_TRACE("(\"%s\", \"%s\", %d)\n", lpszPath, lpszWindow, context); - hlpfile = WINHELP_LookupHelpFile(lpszPath); - /* Some madness: what user calls 'context', hlpfile calls 'map' */ - WINHELP_OpenHelpWindow(HLPFILE_PageByMap, hlpfile, context, - WINHELP_GetWindowInfo(hlpfile, lpszWindow), - SW_NORMAL); + if ((hlpfile = WINHELP_LookupHelpFile(lpszPath))) + /* Some madness: what user calls 'context', hlpfile calls 'map' */ + WINHELP_OpenHelpWindow(HLPFILE_PageByMap, hlpfile, context, + WINHELP_GetWindowInfo(hlpfile, lpszWindow), + SW_NORMAL); } void CALLBACK MACRO_JumpHash(LPCSTR lpszPath, LPCSTR lpszWindow, LONG lHash) @@ -569,9 +591,10 @@ void CALLBACK MACRO_JumpHash(LPCSTR lpszPath, LPCSTR lpszWindow, LONG lHash) hlpfile = MACRO_CurrentWindow()->page->file; else hlpfile = WINHELP_LookupHelpFile(lpszPath); - WINHELP_OpenHelpWindow(HLPFILE_PageByHash, hlpfile, lHash, - WINHELP_GetWindowInfo(hlpfile, lpszWindow), - SW_NORMAL); + if (hlpfile) + WINHELP_OpenHelpWindow(HLPFILE_PageByHash, hlpfile, lHash, + WINHELP_GetWindowInfo(hlpfile, lpszWindow), + SW_NORMAL); } static void CALLBACK MACRO_JumpHelpOn(void) @@ -691,7 +714,7 @@ static void CALLBACK MACRO_Prev(void) void CALLBACK MACRO_Print(void) { - PRINTDLG printer; + PRINTDLGW printer; WINE_TRACE("()\n"); @@ -715,7 +738,7 @@ void CALLBACK MACRO_Print(void) printer.hPrintTemplate = 0; printer.hSetupTemplate = 0; - if (PrintDlgA(&printer)) { + if (PrintDlgW(&printer)) { WINE_FIXME("Print()\n"); } } @@ -742,7 +765,7 @@ static void CALLBACK MACRO_RegisterRoutine(LPCSTR dll_name, LPCSTR proc, LPCSTR } if (!dll) { - HANDLE hLib = LoadLibrary(dll_name); + HANDLE hLib = LoadLibraryA(dll_name); /* FIXME: the library will not be unloaded until exit of program * We don't send the DW_TERM message @@ -1006,6 +1029,32 @@ int MACRO_Lookup(const char* name, struct lexret* lr) return ret; if (MACRO_Loaded && (ret = MACRO_DoLookUp(MACRO_Loaded, name, lr, MACRO_NumLoaded)) != EMPTY) return ret; + if (!strcmp(name, "hwndApp")) + { + WINHELP_WINDOW* win; + lr->integer = 0; + for (win = Globals.win_list; win; win = win->next) + { + if (!strcmp(win->info->name, "main")) + { + lr->integer = (LONG_PTR)win->hMainWnd; + break; + } + } + return INTEGER; + } + if (!strcmp(name, "hwndContext")) + { + lr->integer = Globals.active_win ? + (LONG_PTR)Globals.active_win->hMainWnd : 0; + return INTEGER; + } + if (!strcmp(name, "qchPath") || !strcmp(name, "qError") || !strcmp(name, "lTopicNo") || + !strcmp(name, "hfs") || !strcmp(name, "coForeground") || !strcmp(name, "coBackground")) + { + WINE_FIXME("keyword %s not substituted in macro parsing\n", name); + return EMPTY; + } lr->string = name; return IDENTIFIER; diff --git a/reactos/base/applications/winhlp32/macro.lex.l b/reactos/base/applications/winhlp32/macro.lex.l index f2780ee1ebb..4d679e1d20c 100644 --- a/reactos/base/applications/winhlp32/macro.lex.l +++ b/reactos/base/applications/winhlp32/macro.lex.l @@ -20,17 +20,14 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ %} -%option noinput nounput interactive 8bit +%option noinput nounput never-interactive 8bit %x quote %{ #include "config.h" #include #include -#ifndef HAVE_UNISTD_H #define YY_NO_UNISTD_H -#endif - #include "windef.h" #include "winbase.h" #include "wingdi.h" diff --git a/reactos/base/applications/winhlp32/lex.yy.c b/reactos/base/applications/winhlp32/macro.lex.yy.c similarity index 57% rename from reactos/base/applications/winhlp32/lex.yy.c rename to reactos/base/applications/winhlp32/macro.lex.yy.c index 31ddca9ef08..1f9a5e30eca 100644 --- a/reactos/base/applications/winhlp32/lex.yy.c +++ b/reactos/base/applications/winhlp32/macro.lex.yy.c @@ -1,67 +1,114 @@ -/* A lexical scanner generated by flex */ +#line 2 "macro.lex.yy.c" -/* Scanner skeleton version: - * $Header: /home/daffy/u0/vern/flex/RCS/flex.skl,v 2.91 96/09/10 16:58:48 vern Exp $ - */ +#line 4 "macro.lex.yy.c" + +#define YY_INT_ALIGNED short int + +/* A lexical scanner generated by flex */ #define FLEX_SCANNER #define YY_FLEX_MAJOR_VERSION 2 #define YY_FLEX_MINOR_VERSION 5 +#define YY_FLEX_SUBMINOR_VERSION 35 +#if YY_FLEX_SUBMINOR_VERSION > 0 +#define FLEX_BETA +#endif +/* First, we deal with platform-specific or compiler-specific issues. */ + +/* begin standard C headers. */ #include +#include +#include +#include +/* end standard C headers. */ -/* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */ -#ifdef c_plusplus -#ifndef __cplusplus -#define __cplusplus -#endif +/* flex integer type definitions */ + +#ifndef FLEXINT_H +#define FLEXINT_H + +/* C99 systems have . Non-C99 systems may or may not. */ + +#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + +/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, + * if you want the limit (max/min) macros for int types. + */ +#ifndef __STDC_LIMIT_MACROS +#define __STDC_LIMIT_MACROS 1 #endif +#include +typedef int8_t flex_int8_t; +typedef uint8_t flex_uint8_t; +typedef int16_t flex_int16_t; +typedef uint16_t flex_uint16_t; +typedef int32_t flex_int32_t; +typedef uint32_t flex_uint32_t; +#else +typedef signed char flex_int8_t; +typedef short int flex_int16_t; +typedef int flex_int32_t; +typedef unsigned char flex_uint8_t; +typedef unsigned short int flex_uint16_t; +typedef unsigned int flex_uint32_t; + +/* Limits of integral types. */ +#ifndef INT8_MIN +#define INT8_MIN (-128) +#endif +#ifndef INT16_MIN +#define INT16_MIN (-32767-1) +#endif +#ifndef INT32_MIN +#define INT32_MIN (-2147483647-1) +#endif +#ifndef INT8_MAX +#define INT8_MAX (127) +#endif +#ifndef INT16_MAX +#define INT16_MAX (32767) +#endif +#ifndef INT32_MAX +#define INT32_MAX (2147483647) +#endif +#ifndef UINT8_MAX +#define UINT8_MAX (255U) +#endif +#ifndef UINT16_MAX +#define UINT16_MAX (65535U) +#endif +#ifndef UINT32_MAX +#define UINT32_MAX (4294967295U) +#endif + +#endif /* ! C99 */ + +#endif /* ! FLEXINT_H */ #ifdef __cplusplus -#include -#include - -/* Use prototypes in function declarations. */ -#define YY_USE_PROTOS - /* The "const" storage-class-modifier is valid. */ #define YY_USE_CONST #else /* ! __cplusplus */ -#if __STDC__ +/* C99 requires __STDC__ to be defined as 1. */ +#if defined (__STDC__) -#define YY_USE_PROTOS #define YY_USE_CONST -#endif /* __STDC__ */ +#endif /* defined (__STDC__) */ #endif /* ! __cplusplus */ -#ifdef __TURBOC__ - #pragma warn -rch - #pragma warn -use -#include -#include -#define YY_USE_CONST -#define YY_USE_PROTOS -#endif - #ifdef YY_USE_CONST #define yyconst const #else #define yyconst #endif - -#ifdef YY_USE_PROTOS -#define YY_PROTO(proto) proto -#else -#define YY_PROTO(proto) () -#endif - /* Returned upon end-of-file. */ #define YY_NULL 0 @@ -76,71 +123,78 @@ * but we do it the disgusting crufty way forced on us by the ()-less * definition of BEGIN. */ -#define BEGIN yy_start = 1 + 2 * +#define BEGIN (yy_start) = 1 + 2 * /* Translate the current start state into a value that can be later handed * to BEGIN to return to the state. The YYSTATE alias is for lex * compatibility. */ -#define YY_START ((yy_start - 1) / 2) +#define YY_START (((yy_start) - 1) / 2) #define YYSTATE YY_START /* Action number for EOF rule of a given start state. */ #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) /* Special action meaning "start processing a new file". */ -#define YY_NEW_FILE yyrestart( yyin ) +#define YY_NEW_FILE yyrestart(yyin ) #define YY_END_OF_BUFFER_CHAR 0 /* Size of default input buffer. */ +#ifndef YY_BUF_SIZE +#ifdef __ia64__ +/* On IA-64, the buffer size is 16k, not 8k. + * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. + * Ditto for the __ia64__ case accordingly. + */ +#define YY_BUF_SIZE 32768 +#else #define YY_BUF_SIZE 16384 +#endif /* __ia64__ */ +#endif +/* The state buf must be large enough to hold one state per character in the main buffer. + */ +#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type)) + +#ifndef YY_TYPEDEF_YY_BUFFER_STATE +#define YY_TYPEDEF_YY_BUFFER_STATE typedef struct yy_buffer_state *YY_BUFFER_STATE; +#endif extern int yyleng; + extern FILE *yyin, *yyout; #define EOB_ACT_CONTINUE_SCAN 0 #define EOB_ACT_END_OF_FILE 1 #define EOB_ACT_LAST_MATCH 2 -/* The funky do-while in the following #define is used to turn the definition - * int a single C statement (which needs a semi-colon terminator). This - * avoids problems with code like: - * - * if ( condition_holds ) - * yyless( 5 ); - * else - * do_something_else(); - * - * Prior to using the do-while the compiler would get upset at the - * "else" because it interpreted the "if" statement as being all - * done when it reached the ';' after the yyless() call. - */ - -/* Return all but the first 'n' matched characters back to the input stream. */ - + #define YY_LESS_LINENO(n) + +/* Return all but the first "n" matched characters back to the input stream. */ #define yyless(n) \ do \ { \ /* Undo effects of setting up yytext. */ \ - *yy_cp = yy_hold_char; \ + int yyless_macro_arg = (n); \ + YY_LESS_LINENO(yyless_macro_arg);\ + *yy_cp = (yy_hold_char); \ YY_RESTORE_YY_MORE_OFFSET \ - yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \ + (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ YY_DO_BEFORE_ACTION; /* set up yytext again */ \ } \ while ( 0 ) -#define unput(c) yyunput( c, yytext_ptr ) - -/* The following is because we cannot portably get our hands on size_t - * (without autoconf's help, which isn't available because we want - * flex-generated scanners to compile on their own). - */ -typedef unsigned int yy_size_t; +#define unput(c) yyunput( c, (yytext_ptr) ) +#ifndef YY_TYPEDEF_YY_SIZE_T +#define YY_TYPEDEF_YY_SIZE_T +typedef size_t yy_size_t; +#endif +#ifndef YY_STRUCT_YY_BUFFER_STATE +#define YY_STRUCT_YY_BUFFER_STATE struct yy_buffer_state { FILE *yy_input_file; @@ -177,12 +231,16 @@ struct yy_buffer_state */ int yy_at_bol; + int yy_bs_lineno; /**< The line count. */ + int yy_bs_column; /**< The column count. */ + /* Whether to try to fill the input buffer when we reach the * end of it. */ int yy_fill_buffer; int yy_buffer_status; + #define YY_BUFFER_NEW 0 #define YY_BUFFER_NORMAL 1 /* When an EOF's been seen but there's still some text to process @@ -196,28 +254,38 @@ struct yy_buffer_state * just pointing yyin at a new input file. */ #define YY_BUFFER_EOF_PENDING 2 - }; -static YY_BUFFER_STATE yy_current_buffer = 0; + }; +#endif /* !YY_STRUCT_YY_BUFFER_STATE */ + +/* Stack of input buffers. */ +static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */ +static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */ +static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ /* We provide macros for accessing buffer states in case in the * future we want to put the buffer states in a more general * "scanner state". + * + * Returns the top of the stack, or NULL. */ -#define YY_CURRENT_BUFFER yy_current_buffer +#define YY_CURRENT_BUFFER ( (yy_buffer_stack) \ + ? (yy_buffer_stack)[(yy_buffer_stack_top)] \ + : NULL) +/* Same as previous macro, but useful when we know that the buffer stack is not + * NULL or when we need an lvalue. For internal use only. + */ +#define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)] /* yy_hold_char holds the character lost when yytext is formed. */ static char yy_hold_char; - static int yy_n_chars; /* number of characters read into yy_ch_buf */ - - int yyleng; /* Points to current character in buffer. */ static char *yy_c_buf_p = (char *) 0; -static int yy_init = 1; /* whether we need to initialize */ +static int yy_init = 0; /* whether we need to initialize */ static int yy_start = 0; /* start state number */ /* Flag which is used to allow yywrap()'s to do buffer switches @@ -225,73 +293,99 @@ static int yy_start = 0; /* start state number */ */ static int yy_did_buffer_switch_on_eof; -void yyrestart YY_PROTO(( FILE *input_file )); +void yyrestart (FILE *input_file ); +void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ); +YY_BUFFER_STATE yy_create_buffer (FILE *file,int size ); +void yy_delete_buffer (YY_BUFFER_STATE b ); +void yy_flush_buffer (YY_BUFFER_STATE b ); +void yypush_buffer_state (YY_BUFFER_STATE new_buffer ); +void yypop_buffer_state (void ); -void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer )); -void yy_load_buffer_state YY_PROTO(( void )); -YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size )); -void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b )); -void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file )); -void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b )); -#define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer ) +static void yyensure_buffer_stack (void ); +static void yy_load_buffer_state (void ); +static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file ); -YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size )); -YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *yy_str )); -YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len )); +#define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER ) -static void *yy_flex_alloc YY_PROTO(( yy_size_t )); -static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t )); -static void yy_flex_free YY_PROTO(( void * )); +YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size ); +YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str ); +YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,int len ); + +void *yyalloc (yy_size_t ); +void *yyrealloc (void *,yy_size_t ); +void yyfree (void * ); #define yy_new_buffer yy_create_buffer #define yy_set_interactive(is_interactive) \ { \ - if ( ! yy_current_buffer ) \ - yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ - yy_current_buffer->yy_is_interactive = is_interactive; \ + if ( ! YY_CURRENT_BUFFER ){ \ + yyensure_buffer_stack (); \ + YY_CURRENT_BUFFER_LVALUE = \ + yy_create_buffer(yyin,YY_BUF_SIZE ); \ + } \ + YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ } #define yy_set_bol(at_bol) \ { \ - if ( ! yy_current_buffer ) \ - yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ - yy_current_buffer->yy_at_bol = at_bol; \ + if ( ! YY_CURRENT_BUFFER ){\ + yyensure_buffer_stack (); \ + YY_CURRENT_BUFFER_LVALUE = \ + yy_create_buffer(yyin,YY_BUF_SIZE ); \ + } \ + YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ } -#define YY_AT_BOL() (yy_current_buffer->yy_at_bol) +#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) + +/* Begin user sect3 */ typedef unsigned char YY_CHAR; + FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0; + typedef int yy_state_type; + +extern int yylineno; + +int yylineno = 1; + extern char *yytext; #define yytext_ptr yytext -static yy_state_type yy_get_previous_state YY_PROTO(( void )); -static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state )); -static int yy_get_next_buffer YY_PROTO(( void )); -static void yy_fatal_error YY_PROTO(( yyconst char msg[] )); +static yy_state_type yy_get_previous_state (void ); +static yy_state_type yy_try_NUL_trans (yy_state_type current_state ); +static int yy_get_next_buffer (void ); +static void yy_fatal_error (yyconst char msg[] ); /* Done after the current pattern has been matched and before the * corresponding action - sets up yytext. */ #define YY_DO_BEFORE_ACTION \ - yytext_ptr = yy_bp; \ - yyleng = (int) (yy_cp - yy_bp); \ - yy_hold_char = *yy_cp; \ + (yytext_ptr) = yy_bp; \ + yyleng = (size_t) (yy_cp - yy_bp); \ + (yy_hold_char) = *yy_cp; \ *yy_cp = '\0'; \ - yy_c_buf_p = yy_cp; + (yy_c_buf_p) = yy_cp; #define YY_NUM_RULES 14 #define YY_END_OF_BUFFER 15 -static yyconst short int yy_accept[28] = +/* This struct is not used in this scanner, + but its presence is necessary. */ +struct yy_trans_info + { + flex_int32_t yy_verify; + flex_int32_t yy_nxt; + }; +static yyconst flex_int16_t yy_accept[28] = { 0, 0, 0, 0, 0, 15, 13, 14, 12, 5, 6, 13, 1, 1, 3, 4, 10, 8, 9, 10, 7, 1, 1, 0, 3, 11, 2, 0 } ; -static yyconst int yy_ec[256] = +static yyconst flex_int32_t yy_ec[256] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, @@ -323,13 +417,13 @@ static yyconst int yy_ec[256] = 1, 1, 1, 1, 1 } ; -static yyconst int yy_meta[15] = +static yyconst flex_int32_t yy_meta[15] = { 0, 1, 2, 1, 1, 1, 1, 3, 3, 4, 5, 1, 4, 1, 6 } ; -static yyconst short int yy_base[33] = +static yyconst flex_int16_t yy_base[33] = { 0, 0, 0, 13, 25, 25, 62, 62, 62, 62, 62, 12, 13, 14, 0, 62, 62, 62, 62, 0, 62, @@ -337,7 +431,7 @@ static yyconst short int yy_base[33] = 51, 55 } ; -static yyconst short int yy_def[33] = +static yyconst flex_int16_t yy_def[33] = { 0, 27, 1, 28, 28, 27, 27, 27, 27, 27, 27, 27, 29, 27, 30, 27, 27, 27, 27, 31, 27, @@ -345,7 +439,7 @@ static yyconst short int yy_def[33] = 27, 27 } ; -static yyconst short int yy_nxt[77] = +static yyconst flex_int16_t yy_nxt[77] = { 0, 6, 7, 8, 9, 10, 11, 12, 13, 14, 14, 6, 6, 15, 14, 7, 23, 17, 18, 21, 22, @@ -357,7 +451,7 @@ static yyconst short int yy_nxt[77] = 27, 27, 27, 27, 27, 27 } ; -static yyconst short int yy_chk[77] = +static yyconst flex_int16_t yy_chk[77] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 21, 3, 3, 11, 11, @@ -372,6 +466,9 @@ static yyconst short int yy_chk[77] = static yy_state_type yy_last_accepting_state; static char *yy_last_accepting_cpos; +extern int yy_flex_debug; +int yy_flex_debug = 0; + /* The intent behind this definition is that it'll catch * any uses of REJECT which flex missed. */ @@ -380,9 +477,8 @@ static char *yy_last_accepting_cpos; #define YY_MORE_ADJ 0 #define YY_RESTORE_YY_MORE_OFFSET char *yytext; -#line 1 ".\\macro.lex.l" -#define INITIAL 0 -#line 2 ".\\macro.lex.l" +#line 1 "macro.lex.l" +#line 2 "macro.lex.l" /* * Help Viewer * @@ -404,18 +500,13 @@ char *yytext; * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ #define YY_NO_INPUT 1 -#define YY_NO_UNPUT 1 -#define quote 1 -#line 26 ".\\macro.lex.l" +#line 26 "macro.lex.l" #include "config.h" #include #include -#ifndef HAVE_UNISTD_H #define YY_NO_UNISTD_H -#endif - #include "windef.h" #include "winbase.h" #include "wingdi.h" @@ -442,7 +533,53 @@ struct lexret yylval; #define YY_INPUT(buf,result,max_size)\ if ((result = *lex_data->macroptr ? 1 : 0)) buf[0] = *lex_data->macroptr++; -#line 446 "lex.yy.c" +#line 537 "macro.lex.yy.c" + +#define INITIAL 0 +#define quote 1 + +#ifndef YY_NO_UNISTD_H +/* Special case for "unistd.h", since it is non-ANSI. We include it way + * down here because we want the user's section 1 to have been scanned first. + * The user has a chance to override it with an option. + */ +#include +#endif + +#ifndef YY_EXTRA_TYPE +#define YY_EXTRA_TYPE void * +#endif + +static int yy_init_globals (void ); + +/* Accessor methods to globals. + These are made visible to non-reentrant scanners for convenience. */ + +int yylex_destroy (void ); + +int yyget_debug (void ); + +void yyset_debug (int debug_flag ); + +YY_EXTRA_TYPE yyget_extra (void ); + +void yyset_extra (YY_EXTRA_TYPE user_defined ); + +FILE *yyget_in (void ); + +void yyset_in (FILE * in_str ); + +FILE *yyget_out (void ); + +void yyset_out (FILE * out_str ); + +int yyget_leng (void ); + +char *yyget_text (void ); + +int yyget_lineno (void ); + +void yyset_lineno (int line_number ); /* Macros after this point can all be overridden by user definitions in * section 1. @@ -450,79 +587,46 @@ struct lexret yylval; #ifndef YY_SKIP_YYWRAP #ifdef __cplusplus -extern "C" int yywrap YY_PROTO(( void )); +extern "C" int yywrap (void ); #else -extern int yywrap YY_PROTO(( void )); +extern int yywrap (void ); #endif #endif -#ifndef YY_NO_UNPUT -static void yyunput YY_PROTO(( int c, char *buf_ptr )); -#endif - #ifndef yytext_ptr -static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int )); +static void yy_flex_strncpy (char *,yyconst char *,int ); #endif #ifdef YY_NEED_STRLEN -static int yy_flex_strlen YY_PROTO(( yyconst char * )); +static int yy_flex_strlen (yyconst char * ); #endif #ifndef YY_NO_INPUT + #ifdef __cplusplus -static int yyinput YY_PROTO(( void )); +static int yyinput (void ); #else -static int input YY_PROTO(( void )); -#endif +static int input (void ); #endif -#if YY_STACK_USED -static int yy_start_stack_ptr = 0; -static int yy_start_stack_depth = 0; -static int *yy_start_stack = 0; -#ifndef YY_NO_PUSH_STATE -static void yy_push_state YY_PROTO(( int new_state )); -#endif -#ifndef YY_NO_POP_STATE -static void yy_pop_state YY_PROTO(( void )); -#endif -#ifndef YY_NO_TOP_STATE -static int yy_top_state YY_PROTO(( void )); -#endif - -#else -#define YY_NO_PUSH_STATE 1 -#define YY_NO_POP_STATE 1 -#define YY_NO_TOP_STATE 1 -#endif - -#ifdef YY_MALLOC_DECL -YY_MALLOC_DECL -#else -#if __STDC__ -#ifndef __cplusplus -#include -#endif -#else -/* Just try to get by without declaring the routines. This will fail - * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int) - * or sizeof(void*) != sizeof(int). - */ -#endif #endif /* Amount of stuff to slurp up with each read. */ #ifndef YY_READ_BUF_SIZE +#ifdef __ia64__ +/* On IA-64, the buffer size is 16k, not 8k */ +#define YY_READ_BUF_SIZE 16384 +#else #define YY_READ_BUF_SIZE 8192 +#endif /* __ia64__ */ #endif /* Copy whatever the last rule matched to the standard output. */ - #ifndef ECHO /* This used to be an fputs(), but since the string might contain NUL's, * we now use fwrite(). */ -#define ECHO (void) fwrite( yytext, yyleng, 1, yyout ) +#define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0) #endif /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, @@ -530,9 +634,10 @@ YY_MALLOC_DECL */ #ifndef YY_INPUT #define YY_INPUT(buf,result,max_size) \ - if ( yy_current_buffer->yy_is_interactive ) \ + if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ { \ - int c = '*', n; \ + int c = '*'; \ + size_t n; \ for ( n = 0; n < max_size && \ (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ buf[n] = (char) c; \ @@ -542,9 +647,22 @@ YY_MALLOC_DECL YY_FATAL_ERROR( "input in flex scanner failed" ); \ result = n; \ } \ - else if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \ - && ferror( yyin ) ) \ - YY_FATAL_ERROR( "input in flex scanner failed" ); + else \ + { \ + errno=0; \ + while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \ + { \ + if( errno != EINTR) \ + { \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + break; \ + } \ + errno=0; \ + clearerr(yyin); \ + } \ + }\ +\ + #endif /* No semi-colon after return; correct usage is to write "yyterminate();" - @@ -565,12 +683,18 @@ YY_MALLOC_DECL #define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) #endif +/* end tables serialization structures and prototypes */ + /* Default declaration of generated scanner - a define so the user can * easily add parameters. */ #ifndef YY_DECL -#define YY_DECL int yylex YY_PROTO(( void )) -#endif +#define YY_DECL_IS_OURS 1 + +extern int yylex (void); + +#define YY_DECL int yylex (void) +#endif /* !YY_DECL */ /* Code executed at the beginning of each rule, after yytext and yyleng * have been set up. @@ -587,27 +711,29 @@ YY_MALLOC_DECL #define YY_RULE_SETUP \ YY_USER_ACTION +/** The main scanner function which does all the work. + */ YY_DECL - { +{ register yy_state_type yy_current_state; register char *yy_cp, *yy_bp; register int yy_act; - -#line 61 ".\\macro.lex.l" + +#line 58 "macro.lex.l" -#line 600 "lex.yy.c" +#line 726 "macro.lex.yy.c" - if ( yy_init ) + if ( !(yy_init) ) { - yy_init = 0; + (yy_init) = 1; #ifdef YY_USER_INIT YY_USER_INIT; #endif - if ( ! yy_start ) - yy_start = 1; /* first start state */ + if ( ! (yy_start) ) + (yy_start) = 1; /* first start state */ if ( ! yyin ) yyin = stdin; @@ -615,34 +741,36 @@ YY_DECL if ( ! yyout ) yyout = stdout; - if ( ! yy_current_buffer ) - yy_current_buffer = - yy_create_buffer( yyin, YY_BUF_SIZE ); + if ( ! YY_CURRENT_BUFFER ) { + yyensure_buffer_stack (); + YY_CURRENT_BUFFER_LVALUE = + yy_create_buffer(yyin,YY_BUF_SIZE ); + } - yy_load_buffer_state(); + yy_load_buffer_state( ); } while ( 1 ) /* loops until end-of-file is reached */ { - yy_cp = yy_c_buf_p; + yy_cp = (yy_c_buf_p); /* Support of yytext. */ - *yy_cp = yy_hold_char; + *yy_cp = (yy_hold_char); /* yy_bp points to the position in yy_ch_buf of the start of * the current run. */ yy_bp = yy_cp; - yy_current_state = yy_start; + yy_current_state = (yy_start); yy_match: do { register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; if ( yy_accept[yy_current_state] ) { - yy_last_accepting_state = yy_current_state; - yy_last_accepting_cpos = yy_cp; + (yy_last_accepting_state) = yy_current_state; + (yy_last_accepting_cpos) = yy_cp; } while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { @@ -653,60 +781,54 @@ yy_match: yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; ++yy_cp; } - while ( yy_base[yy_current_state] != 62 ); + while ( yy_current_state != 27 ); + yy_cp = (yy_last_accepting_cpos); + yy_current_state = (yy_last_accepting_state); yy_find_action: yy_act = yy_accept[yy_current_state]; - if ( yy_act == 0 ) - { /* have to back up */ - yy_cp = yy_last_accepting_cpos; - yy_current_state = yy_last_accepting_state; - yy_act = yy_accept[yy_current_state]; - } YY_DO_BEFORE_ACTION; - do_action: /* This label is used only to access EOF actions. */ - switch ( yy_act ) { /* beginning of action switch */ case 0: /* must back up */ /* undo the effects of YY_DO_BEFORE_ACTION */ - *yy_cp = yy_hold_char; - yy_cp = yy_last_accepting_cpos; - yy_current_state = yy_last_accepting_state; + *yy_cp = (yy_hold_char); + yy_cp = (yy_last_accepting_cpos); + yy_current_state = (yy_last_accepting_state); goto yy_find_action; case 1: YY_RULE_SETUP -#line 63 ".\\macro.lex.l" +#line 60 "macro.lex.l" yylval.integer = strtol(yytext, NULL, 10); return INTEGER; YY_BREAK case 2: YY_RULE_SETUP -#line 64 ".\\macro.lex.l" +#line 61 "macro.lex.l" yylval.integer = strtol(yytext, NULL, 16); return INTEGER; YY_BREAK case 3: YY_RULE_SETUP -#line 66 ".\\macro.lex.l" +#line 63 "macro.lex.l" return MACRO_Lookup(yytext, &yylval); YY_BREAK case 4: -#line 69 ".\\macro.lex.l" +#line 66 "macro.lex.l" case 5: -#line 70 ".\\macro.lex.l" +#line 67 "macro.lex.l" case 6: -#line 71 ".\\macro.lex.l" +#line 68 "macro.lex.l" case 7: -#line 72 ".\\macro.lex.l" +#line 69 "macro.lex.l" case 8: -#line 73 ".\\macro.lex.l" +#line 70 "macro.lex.l" case 9: YY_RULE_SETUP -#line 73 ".\\macro.lex.l" +#line 70 "macro.lex.l" { if (lex_data->quote_stk_idx == 0 || (yytext[0] == '\"' && lex_data->quote_stack[lex_data->quote_stk_idx - 1] != '\"') || @@ -741,60 +863,60 @@ YY_RULE_SETUP YY_BREAK case 10: YY_RULE_SETUP -#line 105 ".\\macro.lex.l" +#line 102 "macro.lex.l" *lex_data->strptr++ = yytext[0]; YY_BREAK case 11: YY_RULE_SETUP -#line 106 ".\\macro.lex.l" +#line 103 "macro.lex.l" *lex_data->strptr++ = yytext[1]; YY_BREAK case YY_STATE_EOF(quote): -#line 107 ".\\macro.lex.l" +#line 104 "macro.lex.l" return 0; YY_BREAK case 12: YY_RULE_SETUP -#line 109 ".\\macro.lex.l" +#line 106 "macro.lex.l" YY_BREAK case 13: YY_RULE_SETUP -#line 110 ".\\macro.lex.l" +#line 107 "macro.lex.l" return yytext[0]; YY_BREAK case 14: YY_RULE_SETUP -#line 111 ".\\macro.lex.l" +#line 108 "macro.lex.l" ECHO; YY_BREAK -#line 772 "lex.yy.c" +#line 894 "macro.lex.yy.c" case YY_STATE_EOF(INITIAL): yyterminate(); case YY_END_OF_BUFFER: { /* Amount of text matched not including the EOB char. */ - int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1; + int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1; /* Undo the effects of YY_DO_BEFORE_ACTION. */ - *yy_cp = yy_hold_char; + *yy_cp = (yy_hold_char); YY_RESTORE_YY_MORE_OFFSET - if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW ) + if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) { /* We're scanning a new file or input source. It's * possible that this happened because the user * just pointed yyin at a new source and called * yylex(). If so, then we have to assure - * consistency between yy_current_buffer and our + * consistency between YY_CURRENT_BUFFER and our * globals. Here is the right place to do so, because * this is the first action (other than possibly a * back-up) that will match for the new input source. */ - yy_n_chars = yy_current_buffer->yy_n_chars; - yy_current_buffer->yy_input_file = yyin; - yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL; + (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; + YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin; + YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; } /* Note that here we test for yy_c_buf_p "<=" to the position @@ -804,13 +926,13 @@ case YY_STATE_EOF(INITIAL): * end-of-buffer state). Contrast this with the test * in input(). */ - if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] ) + if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) { /* This was really a NUL. */ yy_state_type yy_next_state; - yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text; + (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; - yy_current_state = yy_get_previous_state(); + yy_current_state = yy_get_previous_state( ); /* Okay, we're now positioned to make the NUL * transition. We couldn't have @@ -823,30 +945,31 @@ case YY_STATE_EOF(INITIAL): yy_next_state = yy_try_NUL_trans( yy_current_state ); - yy_bp = yytext_ptr + YY_MORE_ADJ; + yy_bp = (yytext_ptr) + YY_MORE_ADJ; if ( yy_next_state ) { /* Consume the NUL. */ - yy_cp = ++yy_c_buf_p; + yy_cp = ++(yy_c_buf_p); yy_current_state = yy_next_state; goto yy_match; } else { - yy_cp = yy_c_buf_p; + yy_cp = (yy_last_accepting_cpos); + yy_current_state = (yy_last_accepting_state); goto yy_find_action; } } - else switch ( yy_get_next_buffer() ) + else switch ( yy_get_next_buffer( ) ) { case EOB_ACT_END_OF_FILE: { - yy_did_buffer_switch_on_eof = 0; + (yy_did_buffer_switch_on_eof) = 0; - if ( yywrap() ) + if ( yywrap( ) ) { /* Note: because we've taken care in * yy_get_next_buffer() to have set up @@ -857,7 +980,7 @@ case YY_STATE_EOF(INITIAL): * YY_NULL, it'll still work - another * YY_NULL will get returned. */ - yy_c_buf_p = yytext_ptr + YY_MORE_ADJ; + (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ; yy_act = YY_STATE_EOF(YY_START); goto do_action; @@ -865,30 +988,30 @@ case YY_STATE_EOF(INITIAL): else { - if ( ! yy_did_buffer_switch_on_eof ) + if ( ! (yy_did_buffer_switch_on_eof) ) YY_NEW_FILE; } break; } case EOB_ACT_CONTINUE_SCAN: - yy_c_buf_p = - yytext_ptr + yy_amount_of_matched_text; + (yy_c_buf_p) = + (yytext_ptr) + yy_amount_of_matched_text; - yy_current_state = yy_get_previous_state(); + yy_current_state = yy_get_previous_state( ); - yy_cp = yy_c_buf_p; - yy_bp = yytext_ptr + YY_MORE_ADJ; + yy_cp = (yy_c_buf_p); + yy_bp = (yytext_ptr) + YY_MORE_ADJ; goto yy_match; case EOB_ACT_LAST_MATCH: - yy_c_buf_p = - &yy_current_buffer->yy_ch_buf[yy_n_chars]; + (yy_c_buf_p) = + &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)]; - yy_current_state = yy_get_previous_state(); + yy_current_state = yy_get_previous_state( ); - yy_cp = yy_c_buf_p; - yy_bp = yytext_ptr + YY_MORE_ADJ; + yy_cp = (yy_c_buf_p); + yy_bp = (yytext_ptr) + YY_MORE_ADJ; goto yy_find_action; } break; @@ -899,8 +1022,7 @@ case YY_STATE_EOF(INITIAL): "fatal flex scanner internal error--no action found" ); } /* end of action switch */ } /* end of scanning one token */ - } /* end of yylex */ - +} /* end of yylex */ /* yy_get_next_buffer - try to read in a new buffer * @@ -909,21 +1031,20 @@ case YY_STATE_EOF(INITIAL): * EOB_ACT_CONTINUE_SCAN - continue scanning from current position * EOB_ACT_END_OF_FILE - end of file */ - -static int yy_get_next_buffer() - { - register char *dest = yy_current_buffer->yy_ch_buf; - register char *source = yytext_ptr; +static int yy_get_next_buffer (void) +{ + register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; + register char *source = (yytext_ptr); register int number_to_move, i; int ret_val; - if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] ) + if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) YY_FATAL_ERROR( "fatal flex scanner internal error--end of buffer missed" ); - if ( yy_current_buffer->yy_fill_buffer == 0 ) + if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) { /* Don't try to fill the buffer, so this is an EOF. */ - if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 ) + if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 ) { /* We matched a single character, the EOB, so * treat this as a final EOF. @@ -943,34 +1064,30 @@ static int yy_get_next_buffer() /* Try to read more data. */ /* First move last chars to start of buffer. */ - number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1; + number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1; for ( i = 0; i < number_to_move; ++i ) *(dest++) = *(source++); - if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING ) + if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) /* don't do the read, it's not guaranteed to return an EOF, * just force an EOF */ - yy_current_buffer->yy_n_chars = yy_n_chars = 0; + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0; else { - int num_to_read = - yy_current_buffer->yy_buf_size - number_to_move - 1; + int num_to_read = + YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; while ( num_to_read <= 0 ) { /* Not enough room in the buffer - grow it. */ -#ifdef YY_USES_REJECT - YY_FATAL_ERROR( -"input buffer overflow, can't enlarge buffer because scanner uses REJECT" ); -#else /* just a shorter name for the current buffer */ - YY_BUFFER_STATE b = yy_current_buffer; + YY_BUFFER_STATE b = YY_CURRENT_BUFFER; int yy_c_buf_p_offset = - (int) (yy_c_buf_p - b->yy_ch_buf); + (int) ((yy_c_buf_p) - b->yy_ch_buf); if ( b->yy_is_our_buffer ) { @@ -983,8 +1100,7 @@ static int yy_get_next_buffer() b->yy_ch_buf = (char *) /* Include room in for 2 EOB chars. */ - yy_flex_realloc( (void *) b->yy_ch_buf, - b->yy_buf_size + 2 ); + yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ); } else /* Can't grow it, we don't own it. */ @@ -994,35 +1110,35 @@ static int yy_get_next_buffer() YY_FATAL_ERROR( "fatal error - scanner input buffer overflow" ); - yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset]; + (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset]; - num_to_read = yy_current_buffer->yy_buf_size - + num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; -#endif + } if ( num_to_read > YY_READ_BUF_SIZE ) num_to_read = YY_READ_BUF_SIZE; /* Read in more data. */ - YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]), - yy_n_chars, num_to_read ); + YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), + (yy_n_chars), (size_t) num_to_read ); - yy_current_buffer->yy_n_chars = yy_n_chars; + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); } - if ( yy_n_chars == 0 ) + if ( (yy_n_chars) == 0 ) { if ( number_to_move == YY_MORE_ADJ ) { ret_val = EOB_ACT_END_OF_FILE; - yyrestart( yyin ); + yyrestart(yyin ); } else { ret_val = EOB_ACT_LAST_MATCH; - yy_current_buffer->yy_buffer_status = + YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_EOF_PENDING; } } @@ -1030,32 +1146,39 @@ static int yy_get_next_buffer() else ret_val = EOB_ACT_CONTINUE_SCAN; - yy_n_chars += number_to_move; - yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR; - yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR; - - yytext_ptr = &yy_current_buffer->yy_ch_buf[0]; - - return ret_val; + if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { + /* Extend the array by 50%, plus the number we really need. */ + yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ); + if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); } + (yy_n_chars) += number_to_move; + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; + + (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; + + return ret_val; +} /* yy_get_previous_state - get the state just before the EOB char was reached */ -static yy_state_type yy_get_previous_state() - { + static yy_state_type yy_get_previous_state (void) +{ register yy_state_type yy_current_state; register char *yy_cp; + + yy_current_state = (yy_start); - yy_current_state = yy_start; - - for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp ) + for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) { register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); if ( yy_accept[yy_current_state] ) { - yy_last_accepting_state = yy_current_state; - yy_last_accepting_cpos = yy_cp; + (yy_last_accepting_state) = yy_current_state; + (yy_last_accepting_cpos) = yy_cp; } while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { @@ -1067,30 +1190,23 @@ static yy_state_type yy_get_previous_state() } return yy_current_state; - } - +} /* yy_try_NUL_trans - try to make a transition on the NUL character * * synopsis * next_state = yy_try_NUL_trans( current_state ); */ - -#ifdef YY_USE_PROTOS -static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state ) -#else -static yy_state_type yy_try_NUL_trans( yy_current_state ) -yy_state_type yy_current_state; -#endif - { + static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) +{ register int yy_is_jam; - register char *yy_cp = yy_c_buf_p; + register char *yy_cp = (yy_c_buf_p); register YY_CHAR yy_c = 1; if ( yy_accept[yy_current_state] ) { - yy_last_accepting_state = yy_current_state; - yy_last_accepting_cpos = yy_cp; + (yy_last_accepting_state) = yy_current_state; + (yy_last_accepting_cpos) = yy_cp; } while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { @@ -1102,80 +1218,36 @@ yy_state_type yy_current_state; yy_is_jam = (yy_current_state == 27); return yy_is_jam ? 0 : yy_current_state; - } - - -#ifndef YY_NO_UNPUT -#ifdef YY_USE_PROTOS -static void yyunput( int c, register char *yy_bp ) -#else -static void yyunput( c, yy_bp ) -int c; -register char *yy_bp; -#endif - { - register char *yy_cp = yy_c_buf_p; - - /* undo effects of setting up yytext */ - *yy_cp = yy_hold_char; - - if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) - { /* need to shift things up to make room */ - /* +2 for EOB chars. */ - register int number_to_move = yy_n_chars + 2; - register char *dest = &yy_current_buffer->yy_ch_buf[ - yy_current_buffer->yy_buf_size + 2]; - register char *source = - &yy_current_buffer->yy_ch_buf[number_to_move]; - - while ( source > yy_current_buffer->yy_ch_buf ) - *--dest = *--source; - - yy_cp += (int) (dest - source); - yy_bp += (int) (dest - source); - yy_current_buffer->yy_n_chars = - yy_n_chars = yy_current_buffer->yy_buf_size; - - if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) - YY_FATAL_ERROR( "flex scanner push-back overflow" ); - } - - *--yy_cp = (char) c; - - - yytext_ptr = yy_bp; - yy_hold_char = *yy_cp; - yy_c_buf_p = yy_cp; - } -#endif /* ifndef YY_NO_UNPUT */ - +} +#ifndef YY_NO_INPUT #ifdef __cplusplus -static int yyinput() + static int yyinput (void) #else -static int input() + static int input (void) #endif - { + +{ int c; + + *(yy_c_buf_p) = (yy_hold_char); - *yy_c_buf_p = yy_hold_char; - - if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR ) + if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR ) { /* yy_c_buf_p now points to the character we want to return. * If this occurs *before* the EOB characters, then it's a * valid NUL; if not, then we've hit the end of the buffer. */ - if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] ) + if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) /* This was really a NUL. */ - *yy_c_buf_p = '\0'; + *(yy_c_buf_p) = '\0'; else { /* need more input */ - int offset = yy_c_buf_p - yytext_ptr; - ++yy_c_buf_p; + int offset = (yy_c_buf_p) - (yytext_ptr); + ++(yy_c_buf_p); - switch ( yy_get_next_buffer() ) + switch ( yy_get_next_buffer( ) ) { case EOB_ACT_LAST_MATCH: /* This happens because yy_g_n_b() @@ -1189,16 +1261,16 @@ static int input() */ /* Reset buffer status. */ - yyrestart( yyin ); + yyrestart(yyin ); - /* fall through */ + /*FALLTHROUGH*/ case EOB_ACT_END_OF_FILE: { - if ( yywrap() ) + if ( yywrap( ) ) return EOF; - if ( ! yy_did_buffer_switch_on_eof ) + if ( ! (yy_did_buffer_switch_on_eof) ) YY_NEW_FILE; #ifdef __cplusplus return yyinput(); @@ -1208,90 +1280,92 @@ static int input() } case EOB_ACT_CONTINUE_SCAN: - yy_c_buf_p = yytext_ptr + offset; + (yy_c_buf_p) = (yytext_ptr) + offset; break; } } } - c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */ - *yy_c_buf_p = '\0'; /* preserve yytext */ - yy_hold_char = *++yy_c_buf_p; - + c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */ + *(yy_c_buf_p) = '\0'; /* preserve yytext */ + (yy_hold_char) = *++(yy_c_buf_p); return c; +} +#endif /* ifndef YY_NO_INPUT */ + +/** Immediately switch to a different input stream. + * @param input_file A readable stream. + * + * @note This function does not reset the start condition to @c INITIAL . + */ + void yyrestart (FILE * input_file ) +{ + + if ( ! YY_CURRENT_BUFFER ){ + yyensure_buffer_stack (); + YY_CURRENT_BUFFER_LVALUE = + yy_create_buffer(yyin,YY_BUF_SIZE ); } + yy_init_buffer(YY_CURRENT_BUFFER,input_file ); + yy_load_buffer_state( ); +} -#ifdef YY_USE_PROTOS -void yyrestart( FILE *input_file ) -#else -void yyrestart( input_file ) -FILE *input_file; -#endif - { - if ( ! yy_current_buffer ) - yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); - - yy_init_buffer( yy_current_buffer, input_file ); - yy_load_buffer_state(); - } - - -#ifdef YY_USE_PROTOS -void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer ) -#else -void yy_switch_to_buffer( new_buffer ) -YY_BUFFER_STATE new_buffer; -#endif - { - if ( yy_current_buffer == new_buffer ) +/** Switch to a different input buffer. + * @param new_buffer The new input buffer. + * + */ + void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ) +{ + + /* TODO. We should be able to replace this entire function body + * with + * yypop_buffer_state(); + * yypush_buffer_state(new_buffer); + */ + yyensure_buffer_stack (); + if ( YY_CURRENT_BUFFER == new_buffer ) return; - if ( yy_current_buffer ) + if ( YY_CURRENT_BUFFER ) { /* Flush out information for old buffer. */ - *yy_c_buf_p = yy_hold_char; - yy_current_buffer->yy_buf_pos = yy_c_buf_p; - yy_current_buffer->yy_n_chars = yy_n_chars; + *(yy_c_buf_p) = (yy_hold_char); + YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); } - yy_current_buffer = new_buffer; - yy_load_buffer_state(); + YY_CURRENT_BUFFER_LVALUE = new_buffer; + yy_load_buffer_state( ); /* We don't actually know whether we did this switch during * EOF (yywrap()) processing, but the only time this flag * is looked at is after yywrap() is called, so it's safe * to go ahead and always set it. */ - yy_did_buffer_switch_on_eof = 1; - } + (yy_did_buffer_switch_on_eof) = 1; +} +static void yy_load_buffer_state (void) +{ + (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; + (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; + yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; + (yy_hold_char) = *(yy_c_buf_p); +} -#ifdef YY_USE_PROTOS -void yy_load_buffer_state( void ) -#else -void yy_load_buffer_state() -#endif - { - yy_n_chars = yy_current_buffer->yy_n_chars; - yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos; - yyin = yy_current_buffer->yy_input_file; - yy_hold_char = *yy_c_buf_p; - } - - -#ifdef YY_USE_PROTOS -YY_BUFFER_STATE yy_create_buffer( FILE *file, int size ) -#else -YY_BUFFER_STATE yy_create_buffer( file, size ) -FILE *file; -int size; -#endif - { +/** Allocate and initialize an input buffer state. + * @param file A readable stream. + * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. + * + * @return the allocated buffer state. + */ + YY_BUFFER_STATE yy_create_buffer (FILE * file, int size ) +{ YY_BUFFER_STATE b; - - b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); + + b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ); if ( ! b ) YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); @@ -1300,80 +1374,71 @@ int size; /* yy_ch_buf has to be 2 characters longer than the size given because * we need to put in 2 end-of-buffer characters. */ - b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 ); + b->yy_ch_buf = (char *) yyalloc(b->yy_buf_size + 2 ); if ( ! b->yy_ch_buf ) YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); b->yy_is_our_buffer = 1; - yy_init_buffer( b, file ); + yy_init_buffer(b,file ); return b; - } +} - -#ifdef YY_USE_PROTOS -void yy_delete_buffer( YY_BUFFER_STATE b ) -#else -void yy_delete_buffer( b ) -YY_BUFFER_STATE b; -#endif - { +/** Destroy the buffer. + * @param b a buffer created with yy_create_buffer() + * + */ + void yy_delete_buffer (YY_BUFFER_STATE b ) +{ + if ( ! b ) return; - if ( b == yy_current_buffer ) - yy_current_buffer = (YY_BUFFER_STATE) 0; + if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ + YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; if ( b->yy_is_our_buffer ) - yy_flex_free( (void *) b->yy_ch_buf ); + yyfree((void *) b->yy_ch_buf ); - yy_flex_free( (void *) b ); - } + yyfree((void *) b ); +} +/* Initializes or reinitializes a buffer. + * This function is sometimes called more than once on the same buffer, + * such as during a yyrestart() or at EOF. + */ + static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file ) -#ifndef YY_ALWAYS_INTERACTIVE -#ifndef YY_NEVER_INTERACTIVE -extern int isatty YY_PROTO(( int )); -#endif -#endif - -#ifdef YY_USE_PROTOS -void yy_init_buffer( YY_BUFFER_STATE b, FILE *file ) -#else -void yy_init_buffer( b, file ) -YY_BUFFER_STATE b; -FILE *file; -#endif - - - { - yy_flush_buffer( b ); +{ + int oerrno = errno; + + yy_flush_buffer(b ); b->yy_input_file = file; b->yy_fill_buffer = 1; -#if YY_ALWAYS_INTERACTIVE - b->yy_is_interactive = 1; -#else -#if YY_NEVER_INTERACTIVE - b->yy_is_interactive = 0; -#else - b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; -#endif -#endif - } + /* If b is the current buffer, then yy_init_buffer was _probably_ + * called from yyrestart() or through yy_get_next_buffer. + * In that case, we don't want to reset the lineno or column. + */ + if (b != YY_CURRENT_BUFFER){ + b->yy_bs_lineno = 1; + b->yy_bs_column = 0; + } + b->yy_is_interactive = 0; + + errno = oerrno; +} -#ifdef YY_USE_PROTOS -void yy_flush_buffer( YY_BUFFER_STATE b ) -#else -void yy_flush_buffer( b ) -YY_BUFFER_STATE b; -#endif - - { - if ( ! b ) +/** Discard all buffered characters. On the next scan, YY_INPUT will be called. + * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. + * + */ + void yy_flush_buffer (YY_BUFFER_STATE b ) +{ + if ( ! b ) return; b->yy_n_chars = 0; @@ -1390,29 +1455,125 @@ YY_BUFFER_STATE b; b->yy_at_bol = 1; b->yy_buffer_status = YY_BUFFER_NEW; - if ( b == yy_current_buffer ) - yy_load_buffer_state(); + if ( b == YY_CURRENT_BUFFER ) + yy_load_buffer_state( ); +} + +/** Pushes the new state onto the stack. The new state becomes + * the current state. This function will allocate the stack + * if necessary. + * @param new_buffer The new state. + * + */ +void yypush_buffer_state (YY_BUFFER_STATE new_buffer ) +{ + if (new_buffer == NULL) + return; + + yyensure_buffer_stack(); + + /* This block is copied from yy_switch_to_buffer. */ + if ( YY_CURRENT_BUFFER ) + { + /* Flush out information for old buffer. */ + *(yy_c_buf_p) = (yy_hold_char); + YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); + } + + /* Only push if top exists. Otherwise, replace top. */ + if (YY_CURRENT_BUFFER) + (yy_buffer_stack_top)++; + YY_CURRENT_BUFFER_LVALUE = new_buffer; + + /* copied from yy_switch_to_buffer. */ + yy_load_buffer_state( ); + (yy_did_buffer_switch_on_eof) = 1; +} + +/** Removes and deletes the top of the stack, if present. + * The next element becomes the new top. + * + */ +void yypop_buffer_state (void) +{ + if (!YY_CURRENT_BUFFER) + return; + + yy_delete_buffer(YY_CURRENT_BUFFER ); + YY_CURRENT_BUFFER_LVALUE = NULL; + if ((yy_buffer_stack_top) > 0) + --(yy_buffer_stack_top); + + if (YY_CURRENT_BUFFER) { + yy_load_buffer_state( ); + (yy_did_buffer_switch_on_eof) = 1; + } +} + +/* Allocates the stack if it does not exist. + * Guarantees space for at least one push. + */ +static void yyensure_buffer_stack (void) +{ + int num_to_alloc; + + if (!(yy_buffer_stack)) { + + /* First allocation is just for 2 elements, since we don't know if this + * scanner will even need a stack. We use 2 instead of 1 to avoid an + * immediate realloc on the next call. + */ + num_to_alloc = 1; + (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc + (num_to_alloc * sizeof(struct yy_buffer_state*) + ); + if ( ! (yy_buffer_stack) ) + YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); + + memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); + + (yy_buffer_stack_max) = num_to_alloc; + (yy_buffer_stack_top) = 0; + return; } + if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){ -#ifndef YY_NO_SCAN_BUFFER -#ifdef YY_USE_PROTOS -YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size ) -#else -YY_BUFFER_STATE yy_scan_buffer( base, size ) -char *base; -yy_size_t size; -#endif - { + /* Increase the buffer to prepare for a possible push. */ + int grow_size = 8 /* arbitrary grow size */; + + num_to_alloc = (yy_buffer_stack_max) + grow_size; + (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc + ((yy_buffer_stack), + num_to_alloc * sizeof(struct yy_buffer_state*) + ); + if ( ! (yy_buffer_stack) ) + YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); + + /* zero only the new slots.*/ + memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); + (yy_buffer_stack_max) = num_to_alloc; + } +} + +/** Setup the input buffer state to scan directly from a user-specified character buffer. + * @param base the character buffer + * @param size the size in bytes of the character buffer + * + * @return the newly allocated buffer state object. + */ +YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size ) +{ YY_BUFFER_STATE b; - + if ( size < 2 || base[size-2] != YY_END_OF_BUFFER_CHAR || base[size-1] != YY_END_OF_BUFFER_CHAR ) /* They forgot to leave room for the EOB's. */ return 0; - b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); + b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ); if ( ! b ) YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); @@ -1426,56 +1587,51 @@ yy_size_t size; b->yy_fill_buffer = 0; b->yy_buffer_status = YY_BUFFER_NEW; - yy_switch_to_buffer( b ); + yy_switch_to_buffer(b ); return b; - } -#endif +} +/** Setup the input buffer state to scan a string. The next call to yylex() will + * scan from a @e copy of @a str. + * @param yystr a NUL-terminated string to scan + * + * @return the newly allocated buffer state object. + * @note If you want to scan bytes that may contain NUL values, then use + * yy_scan_bytes() instead. + */ +YY_BUFFER_STATE yy_scan_string (yyconst char * yystr ) +{ + + return yy_scan_bytes(yystr,strlen(yystr) ); +} -#ifndef YY_NO_SCAN_STRING -#ifdef YY_USE_PROTOS -YY_BUFFER_STATE yy_scan_string( yyconst char *yy_str ) -#else -YY_BUFFER_STATE yy_scan_string( yy_str ) -yyconst char *yy_str; -#endif - { - int len; - for ( len = 0; yy_str[len]; ++len ) - ; - - return yy_scan_bytes( yy_str, len ); - } -#endif - - -#ifndef YY_NO_SCAN_BYTES -#ifdef YY_USE_PROTOS -YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len ) -#else -YY_BUFFER_STATE yy_scan_bytes( bytes, len ) -yyconst char *bytes; -int len; -#endif - { +/** Setup the input buffer state to scan the given bytes. The next call to yylex() will + * scan from a @e copy of @a bytes. + * @param yybytes the byte buffer to scan + * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. + * + * @return the newly allocated buffer state object. + */ +YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, int _yybytes_len ) +{ YY_BUFFER_STATE b; char *buf; yy_size_t n; int i; - + /* Get memory for full buffer, including space for trailing EOB's. */ - n = len + 2; - buf = (char *) yy_flex_alloc( n ); + n = _yybytes_len + 2; + buf = (char *) yyalloc(n ); if ( ! buf ) YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); - for ( i = 0; i < len; ++i ) - buf[i] = bytes[i]; + for ( i = 0; i < _yybytes_len; ++i ) + buf[i] = yybytes[i]; - buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR; + buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; - b = yy_scan_buffer( buf, n ); + b = yy_scan_buffer(buf,n ); if ( ! b ) YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); @@ -1485,78 +1641,17 @@ int len; b->yy_is_our_buffer = 1; return b; - } -#endif - - -#ifndef YY_NO_PUSH_STATE -#ifdef YY_USE_PROTOS -static void yy_push_state( int new_state ) -#else -static void yy_push_state( new_state ) -int new_state; -#endif - { - if ( yy_start_stack_ptr >= yy_start_stack_depth ) - { - yy_size_t new_size; - - yy_start_stack_depth += YY_START_STACK_INCR; - new_size = yy_start_stack_depth * sizeof( int ); - - if ( ! yy_start_stack ) - yy_start_stack = (int *) yy_flex_alloc( new_size ); - - else - yy_start_stack = (int *) yy_flex_realloc( - (void *) yy_start_stack, new_size ); - - if ( ! yy_start_stack ) - YY_FATAL_ERROR( - "out of memory expanding start-condition stack" ); - } - - yy_start_stack[yy_start_stack_ptr++] = YY_START; - - BEGIN(new_state); - } -#endif - - -#ifndef YY_NO_POP_STATE -static void yy_pop_state() - { - if ( --yy_start_stack_ptr < 0 ) - YY_FATAL_ERROR( "start-condition stack underflow" ); - - BEGIN(yy_start_stack[yy_start_stack_ptr]); - } -#endif - - -#ifndef YY_NO_TOP_STATE -static int yy_top_state() - { - return yy_start_stack[yy_start_stack_ptr - 1]; - } -#endif +} #ifndef YY_EXIT_FAILURE #define YY_EXIT_FAILURE 2 #endif -#ifdef YY_USE_PROTOS -static void yy_fatal_error( yyconst char msg[] ) -#else -static void yy_fatal_error( msg ) -char msg[]; -#endif - { - (void) fprintf( stderr, "%s\n", msg ); +static void yy_fatal_error (yyconst char* msg ) +{ + (void) fprintf( stderr, "%s\n", msg ); exit( YY_EXIT_FAILURE ); - } - - +} /* Redefine yyless() so it works in section 3 code. */ @@ -1565,68 +1660,177 @@ char msg[]; do \ { \ /* Undo effects of setting up yytext. */ \ - yytext[yyleng] = yy_hold_char; \ - yy_c_buf_p = yytext + n; \ - yy_hold_char = *yy_c_buf_p; \ - *yy_c_buf_p = '\0'; \ - yyleng = n; \ + int yyless_macro_arg = (n); \ + YY_LESS_LINENO(yyless_macro_arg);\ + yytext[yyleng] = (yy_hold_char); \ + (yy_c_buf_p) = yytext + yyless_macro_arg; \ + (yy_hold_char) = *(yy_c_buf_p); \ + *(yy_c_buf_p) = '\0'; \ + yyleng = yyless_macro_arg; \ } \ while ( 0 ) +/* Accessor methods (get/set functions) to struct members. */ -/* Internal utility routines. */ +/** Get the current line number. + * + */ +int yyget_lineno (void) +{ + + return yylineno; +} + +/** Get the input stream. + * + */ +FILE *yyget_in (void) +{ + return yyin; +} + +/** Get the output stream. + * + */ +FILE *yyget_out (void) +{ + return yyout; +} + +/** Get the length of the current token. + * + */ +int yyget_leng (void) +{ + return yyleng; +} + +/** Get the current token. + * + */ + +char *yyget_text (void) +{ + return yytext; +} + +/** Set the current line number. + * @param line_number + * + */ +void yyset_lineno (int line_number ) +{ + + yylineno = line_number; +} + +/** Set the input stream. This does not discard the current + * input buffer. + * @param in_str A readable stream. + * + * @see yy_switch_to_buffer + */ +void yyset_in (FILE * in_str ) +{ + yyin = in_str ; +} + +void yyset_out (FILE * out_str ) +{ + yyout = out_str ; +} + +int yyget_debug (void) +{ + return yy_flex_debug; +} + +void yyset_debug (int bdebug ) +{ + yy_flex_debug = bdebug ; +} + +static int yy_init_globals (void) +{ + /* Initialization is the same as for the non-reentrant scanner. + * This function is called from yylex_destroy(), so don't allocate here. + */ + + (yy_buffer_stack) = 0; + (yy_buffer_stack_top) = 0; + (yy_buffer_stack_max) = 0; + (yy_c_buf_p) = (char *) 0; + (yy_init) = 0; + (yy_start) = 0; + +/* Defined in main.c */ +#ifdef YY_STDINIT + yyin = stdin; + yyout = stdout; +#else + yyin = (FILE *) 0; + yyout = (FILE *) 0; +#endif + + /* For future reference: Set errno on error, since we are called by + * yylex_init() + */ + return 0; +} + +/* yylex_destroy is for both reentrant and non-reentrant scanners. */ +int yylex_destroy (void) +{ + + /* Pop the buffer stack, destroying each element. */ + while(YY_CURRENT_BUFFER){ + yy_delete_buffer(YY_CURRENT_BUFFER ); + YY_CURRENT_BUFFER_LVALUE = NULL; + yypop_buffer_state(); + } + + /* Destroy the stack itself. */ + yyfree((yy_buffer_stack) ); + (yy_buffer_stack) = NULL; + + /* Reset the globals. This is important in a non-reentrant scanner so the next time + * yylex() is called, initialization will occur. */ + yy_init_globals( ); + + return 0; +} + +/* + * Internal utility routines. + */ #ifndef yytext_ptr -#ifdef YY_USE_PROTOS -static void yy_flex_strncpy( char *s1, yyconst char *s2, int n ) -#else -static void yy_flex_strncpy( s1, s2, n ) -char *s1; -yyconst char *s2; -int n; -#endif - { +static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) +{ register int i; for ( i = 0; i < n; ++i ) s1[i] = s2[i]; - } +} #endif #ifdef YY_NEED_STRLEN -#ifdef YY_USE_PROTOS -static int yy_flex_strlen( yyconst char *s ) -#else -static int yy_flex_strlen( s ) -yyconst char *s; -#endif - { +static int yy_flex_strlen (yyconst char * s ) +{ register int n; for ( n = 0; s[n]; ++n ) ; return n; - } +} #endif - -#ifdef YY_USE_PROTOS -static void *yy_flex_alloc( yy_size_t size ) -#else -static void *yy_flex_alloc( size ) -yy_size_t size; -#endif - { +void *yyalloc (yy_size_t size ) +{ return (void *) malloc( size ); - } +} -#ifdef YY_USE_PROTOS -static void *yy_flex_realloc( void *ptr, yy_size_t size ) -#else -static void *yy_flex_realloc( ptr, size ) -void *ptr; -yy_size_t size; -#endif - { +void *yyrealloc (void * ptr, yy_size_t size ) +{ /* The cast to (char *) in the following accommodates both * implementations that use char* generic pointers, and those * that use void* generic pointers. It works with the latter @@ -1635,26 +1839,17 @@ yy_size_t size; * as though doing an assignment. */ return (void *) realloc( (char *) ptr, size ); - } +} -#ifdef YY_USE_PROTOS -static void yy_flex_free( void *ptr ) -#else -static void yy_flex_free( ptr ) -void *ptr; -#endif - { - free( ptr ); - } +void yyfree (void * ptr ) +{ + free( (char *) ptr ); /* see yyrealloc() for (char *) cast */ +} + +#define YYTABLES_NAME "yytables" + +#line 108 "macro.lex.l" -#if YY_MAIN -int main() - { - yylex(); - return 0; - } -#endif -#line 111 ".\\macro.lex.l" #if 0 @@ -1921,3 +2116,4 @@ WINHELP_WINDOW* MACRO_CurrentWindow(void) #ifndef yywrap int yywrap(void) { return 1; } #endif + diff --git a/reactos/base/applications/winhlp32/winhelp.c b/reactos/base/applications/winhlp32/winhelp.c index 64c11070f7a..0c08e02d2a6 100644 --- a/reactos/base/applications/winhlp32/winhelp.c +++ b/reactos/base/applications/winhlp32/winhelp.c @@ -58,15 +58,15 @@ WINHELP_GLOBALS Globals = {3, NULL, TRUE, NULL, NULL, NULL, NULL, NULL, {{{NULL, */ static void WINHELP_InitFonts(HWND hWnd) { - WINHELP_WINDOW *win = (WINHELP_WINDOW*) GetWindowLongPtr(hWnd, 0); - LOGFONT logfontlist[] = { - {-10, 0, 0, 0, 400, 0, 0, 0, DEFAULT_CHARSET, 0, 0, 0, 32, "Helv"}, - {-12, 0, 0, 0, 700, 0, 0, 0, DEFAULT_CHARSET, 0, 0, 0, 32, "Helv"}, - {-12, 0, 0, 0, 700, 0, 0, 0, DEFAULT_CHARSET, 0, 0, 0, 32, "Helv"}, - {-12, 0, 0, 0, 400, 0, 0, 0, DEFAULT_CHARSET, 0, 0, 0, 32, "Helv"}, - {-12, 0, 0, 0, 700, 0, 0, 0, DEFAULT_CHARSET, 0, 0, 0, 32, "Helv"}, - {-10, 0, 0, 0, 700, 0, 0, 0, DEFAULT_CHARSET, 0, 0, 0, 32, "Helv"}, - { -8, 0, 0, 0, 400, 0, 0, 0, DEFAULT_CHARSET, 0, 0, 0, 32, "Helv"}}; + WINHELP_WINDOW *win = (WINHELP_WINDOW*) GetWindowLongPtrW(hWnd, 0); + LOGFONTW logfontlist[] = { + {-10, 0, 0, 0, 400, 0, 0, 0, DEFAULT_CHARSET, 0, 0, 0, 32, {'H','e','l','v',0}}, + {-12, 0, 0, 0, 700, 0, 0, 0, DEFAULT_CHARSET, 0, 0, 0, 32, {'H','e','l','v',0}}, + {-12, 0, 0, 0, 700, 0, 0, 0, DEFAULT_CHARSET, 0, 0, 0, 32, {'H','e','l','v',0}}, + {-12, 0, 0, 0, 400, 0, 0, 0, DEFAULT_CHARSET, 0, 0, 0, 32, {'H','e','l','v',0}}, + {-12, 0, 0, 0, 700, 0, 0, 0, DEFAULT_CHARSET, 0, 0, 0, 32, {'H','e','l','v',0}}, + {-10, 0, 0, 0, 700, 0, 0, 0, DEFAULT_CHARSET, 0, 0, 0, 32, {'H','e','l','v',0}}, + { -8, 0, 0, 0, 400, 0, 0, 0, DEFAULT_CHARSET, 0, 0, 0, 32, {'H','e','l','v',0}}}; #define FONTS_LEN (sizeof(logfontlist)/sizeof(*logfontlist)) static HFONT fonts[FONTS_LEN]; @@ -81,7 +81,7 @@ static void WINHELP_InitFonts(HWND hWnd) for (i = 0; i < FONTS_LEN; i++) { - fonts[i] = CreateFontIndirect(&logfontlist[i]); + fonts[i] = CreateFontIndirectW(&logfontlist[i]); } init = 1; @@ -104,12 +104,13 @@ static DWORD CALLBACK WINHELP_RtfStreamIn(DWORD_PTR cookie, BYTE* buff, static void WINHELP_SetupText(HWND hTextWnd, WINHELP_WINDOW* win, ULONG relative) { + static const WCHAR emptyW[1]; /* At first clear area - needed by EM_POSFROMCHAR/EM_SETSCROLLPOS */ - SendMessage(hTextWnd, WM_SETTEXT, 0, (LPARAM)""); - SendMessage(hTextWnd, WM_SETREDRAW, FALSE, 0); - SendMessage(hTextWnd, EM_SETBKGNDCOLOR, 0, (LPARAM)win->info->sr_color); + SendMessageW(hTextWnd, WM_SETTEXT, 0, (LPARAM)emptyW); + SendMessageW(hTextWnd, WM_SETREDRAW, FALSE, 0); + SendMessageW(hTextWnd, EM_SETBKGNDCOLOR, 0, (LPARAM)win->info->sr_color); /* set word-wrap to window size (undocumented) */ - SendMessage(hTextWnd, EM_SETTARGETDEVICE, 0, 0); + SendMessageW(hTextWnd, EM_SETTARGETDEVICE, 0, 0); if (win->page) { struct RtfData rd; @@ -131,11 +132,11 @@ static void WINHELP_SetupText(HWND hTextWnd, WINHELP_WINDOW* win, ULONG relative } /* FIXME: else leaking potentially the rd.first_link chain */ HeapFree(GetProcessHeap(), 0, rd.data); - SendMessage(hTextWnd, EM_POSFROMCHAR, (WPARAM)&ptl, cp ? cp - 1 : 0); + SendMessageW(hTextWnd, EM_POSFROMCHAR, (WPARAM)&ptl, cp ? cp - 1 : 0); pt.x = 0; pt.y = ptl.y; - SendMessage(hTextWnd, EM_SETSCROLLPOS, 0, (LPARAM)&pt); + SendMessageW(hTextWnd, EM_SETSCROLLPOS, 0, (LPARAM)&pt); } - SendMessage(hTextWnd, WM_SETREDRAW, TRUE, 0); + SendMessageW(hTextWnd, WM_SETREDRAW, TRUE, 0); RedrawWindow(hTextWnd, NULL, NULL, RDW_FRAME|RDW_INVALIDATE); } @@ -145,28 +146,28 @@ static void WINHELP_SetupText(HWND hTextWnd, WINHELP_WINDOW* win, ULONG relative */ BOOL WINHELP_GetOpenFileName(LPSTR lpszFile, int len) { - OPENFILENAME openfilename; + OPENFILENAMEA openfilename; CHAR szDir[MAX_PATH]; CHAR szzFilter[2 * MAX_STRING_LEN + 100]; LPSTR p = szzFilter; WINE_TRACE("()\n"); - LoadString(Globals.hInstance, STID_HELP_FILES_HLP, p, MAX_STRING_LEN); + LoadStringA(Globals.hInstance, STID_HELP_FILES_HLP, p, MAX_STRING_LEN); p += strlen(p) + 1; - lstrcpy(p, "*.hlp"); + strcpy(p, "*.hlp"); p += strlen(p) + 1; - LoadString(Globals.hInstance, STID_ALL_FILES, p, MAX_STRING_LEN); + LoadStringA(Globals.hInstance, STID_ALL_FILES, p, MAX_STRING_LEN); p += strlen(p) + 1; - lstrcpy(p, "*.*"); + strcpy(p, "*.*"); p += strlen(p) + 1; *p = '\0'; - GetCurrentDirectory(sizeof(szDir), szDir); + GetCurrentDirectoryA(sizeof(szDir), szDir); lpszFile[0]='\0'; - openfilename.lStructSize = sizeof(OPENFILENAME); + openfilename.lStructSize = sizeof(openfilename); openfilename.hwndOwner = (Globals.active_win ? Globals.active_win->hMainWnd : 0); openfilename.hInstance = Globals.hInstance; openfilename.lpstrFilter = szzFilter; @@ -187,7 +188,7 @@ BOOL WINHELP_GetOpenFileName(LPSTR lpszFile, int len) openfilename.lpfnHook = 0; openfilename.lpTemplateName = 0; - return GetOpenFileName(&openfilename); + return GetOpenFileNameA(&openfilename); } /*********************************************************************** @@ -199,10 +200,10 @@ static INT WINHELP_MessageBoxIDS_s(UINT ids_text, LPCSTR str, UINT ids_title, WO CHAR text[MAX_STRING_LEN]; CHAR newtext[MAX_STRING_LEN + MAX_PATH]; - LoadString(Globals.hInstance, ids_text, text, sizeof(text)); - wsprintf(newtext, text, str); + LoadStringA(Globals.hInstance, ids_text, text, sizeof(text)); + wsprintfA(newtext, text, str); - return MessageBox(0, newtext, MAKEINTRESOURCE(ids_title), type); + return MessageBoxA(0, newtext, MAKEINTRESOURCEA(ids_title), type); } /*********************************************************************** @@ -230,8 +231,8 @@ HLPFILE* WINHELP_LookupHelpFile(LPCSTR lpszFile) /* * FIXME: Should we swap conditions? */ - if (!SearchPath(NULL, lpszFile, ".hlp", MAX_PATH, szFullName, NULL) && - !SearchPath(szAddPath, lpszFile, ".hlp", MAX_PATH, szFullName, NULL)) + if (!SearchPathA(NULL, lpszFile, ".hlp", MAX_PATH, szFullName, NULL) && + !SearchPathA(szAddPath, lpszFile, ".hlp", MAX_PATH, szFullName, NULL)) { if (WINHELP_MessageBoxIDS_s(STID_FILE_NOT_FOUND_s, lpszFile, STID_WHERROR, MB_YESNO|MB_ICONQUESTION) != IDYES) @@ -261,7 +262,7 @@ HLPFILE_WINDOWINFO* WINHELP_GetWindowInfo(HLPFILE* hlpfile, LPCSTR name) if (hlpfile) for (i = 0; i < hlpfile->numWindows; i++) - if (!lstrcmpi(hlpfile->windows[i].name, name)) + if (!lstrcmpiA(hlpfile->windows[i].name, name)) return &hlpfile->windows[i]; if (strcmp(name, "main") != 0) @@ -277,12 +278,12 @@ HLPFILE_WINDOWINFO* WINHELP_GetWindowInfo(HLPFILE* hlpfile, LPCSTR name) if (hlpfile && hlpfile->lpszTitle[0]) { char tmp[128]; - LoadString(Globals.hInstance, STID_WINE_HELP, tmp, sizeof(tmp)); + LoadStringA(Globals.hInstance, STID_WINE_HELP, tmp, sizeof(tmp)); snprintf(mwi.caption, sizeof(mwi.caption), "%s %s - %s", hlpfile->lpszTitle, tmp, hlpfile->lpszPath); } else - LoadString(Globals.hInstance, STID_WINE_HELP, mwi.caption, sizeof(mwi.caption)); + LoadStringA(Globals.hInstance, STID_WINE_HELP, mwi.caption, sizeof(mwi.caption)); mwi.origin.x = mwi.origin.y = mwi.size.cx = mwi.size.cy = CW_USEDEFAULT; mwi.style = SW_SHOW; mwi.win_style = WS_OVERLAPPEDWINDOW; @@ -551,7 +552,7 @@ static void WINHELP_DeleteWindow(WINHELP_WINDOW* win) break; } } - bExit = (Globals.wVersion >= 4 && !lstrcmpi(win->info->name, "main")); + bExit = (Globals.wVersion >= 4 && !lstrcmpiA(win->info->name, "main")); if (Globals.active_win == win) { @@ -564,8 +565,7 @@ static void WINHELP_DeleteWindow(WINHELP_WINDOW* win) Globals.active_popup = NULL; hTextWnd = GetDlgItem(win->hMainWnd, CTL_ID_TEXT); - SetWindowLongPtr(hTextWnd, GWLP_WNDPROC, - (LONG_PTR)win->origRicheditWndProc); + SetWindowLongPtrA(hTextWnd, GWLP_WNDPROC, (LONG_PTR)win->origRicheditWndProc); WINHELP_DeleteButtons(win); @@ -671,7 +671,7 @@ static HLPFILE_LINK* WINHELP_FindLink(WINHELP_WINDOW* win, LPARAM pos) static LRESULT CALLBACK WINHELP_RicheditWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { - WINHELP_WINDOW *win = (WINHELP_WINDOW*) GetWindowLongPtr(GetParent(hWnd), 0); + WINHELP_WINDOW *win = (WINHELP_WINDOW*) GetWindowLongPtrW(GetParent(hWnd), 0); DWORD messagePos; POINT pt; switch(msg) @@ -703,14 +703,14 @@ BOOL WINHELP_CreateHelpWindow(WINHELP_WNDPAGE* wpage, int nCmdShow, BOOL remembe HICON hIcon; HWND hTextWnd = NULL; - bPrimary = !lstrcmpi(wpage->wininfo->name, "main"); + bPrimary = !lstrcmpiA(wpage->wininfo->name, "main"); bPopup = !bPrimary && (wpage->wininfo->win_style & WS_POPUP); if (!bPopup) { for (win = Globals.win_list; win; win = win->next) { - if (!lstrcmpi(win->info->name, wpage->wininfo->name)) + if (!lstrcmpiA(win->info->name, wpage->wininfo->name)) { if (win->page == wpage->page && win->info == wpage->wininfo) { @@ -722,7 +722,7 @@ BOOL WINHELP_CreateHelpWindow(WINHELP_WNDPAGE* wpage, int nCmdShow, BOOL remembe } WINHELP_DeleteButtons(win); bReUsed = TRUE; - SetWindowText(win->hMainWnd, WINHELP_GetCaption(wpage)); + SetWindowTextA(win->hMainWnd, WINHELP_GetCaption(wpage)); if (win->info != wpage->wininfo) { POINT pt = {0, 0}; @@ -793,43 +793,43 @@ BOOL WINHELP_CreateHelpWindow(WINHELP_WNDPAGE* wpage, int nCmdShow, BOOL remembe { CHAR buffer[MAX_STRING_LEN]; - LoadString(Globals.hInstance, STID_CONTENTS, buffer, sizeof(buffer)); + LoadStringA(Globals.hInstance, STID_CONTENTS, buffer, sizeof(buffer)); MACRO_CreateButton("BTN_CONTENTS", buffer, "Contents()"); - LoadString(Globals.hInstance, STID_INDEX, buffer, sizeof(buffer)); + LoadStringA(Globals.hInstance, STID_INDEX, buffer, sizeof(buffer)); MACRO_CreateButton("BTN_INDEX", buffer, "Finder()"); - LoadString(Globals.hInstance, STID_BACK, buffer, sizeof(buffer)); + LoadStringA(Globals.hInstance, STID_BACK, buffer, sizeof(buffer)); MACRO_CreateButton("BTN_BACK", buffer, "Back()"); if (win->back.index <= 1) MACRO_DisableButton("BTN_BACK"); } if (!bReUsed) { - win->hMainWnd = CreateWindowEx((bPopup) ? WS_EX_TOOLWINDOW : 0, MAIN_WIN_CLASS_NAME, + win->hMainWnd = CreateWindowExA((bPopup) ? WS_EX_TOOLWINDOW : 0, MAIN_WIN_CLASS_NAME, WINHELP_GetCaption(wpage), bPrimary ? WS_OVERLAPPEDWINDOW : wpage->wininfo->win_style, wpage->wininfo->origin.x, wpage->wininfo->origin.y, wpage->wininfo->size.cx, wpage->wininfo->size.cy, bPopup ? Globals.active_win->hMainWnd : NULL, - bPrimary ? LoadMenu(Globals.hInstance, MAKEINTRESOURCE(MAIN_MENU)) : 0, + bPrimary ? LoadMenuW(Globals.hInstance, MAKEINTRESOURCEW(MAIN_MENU)) : 0, Globals.hInstance, win); if (!bPopup) /* Create button box and text Window */ - CreateWindow(BUTTON_BOX_WIN_CLASS_NAME, "", WS_CHILD | WS_VISIBLE, + CreateWindowA(BUTTON_BOX_WIN_CLASS_NAME, "", WS_CHILD | WS_VISIBLE, 0, 0, 0, 0, win->hMainWnd, (HMENU)CTL_ID_BUTTON, Globals.hInstance, NULL); - hTextWnd = CreateWindow(RICHEDIT_CLASS, NULL, + hTextWnd = CreateWindowA(RICHEDIT_CLASS20A, NULL, ES_MULTILINE | ES_READONLY | WS_CHILD | WS_HSCROLL | WS_VSCROLL | WS_VISIBLE, 0, 0, 0, 0, win->hMainWnd, (HMENU)CTL_ID_TEXT, Globals.hInstance, NULL); - SendMessage(hTextWnd, EM_SETEVENTMASK, 0, - SendMessage(hTextWnd, EM_GETEVENTMASK, 0, 0) | ENM_MOUSEEVENTS); - win->origRicheditWndProc = (WNDPROC)SetWindowLongPtr(hTextWnd, GWLP_WNDPROC, + SendMessageW(hTextWnd, EM_SETEVENTMASK, 0, + SendMessageW(hTextWnd, EM_GETEVENTMASK, 0, 0) | ENM_MOUSEEVENTS); + win->origRicheditWndProc = (WNDPROC)SetWindowLongPtrA(hTextWnd, GWLP_WNDPROC, (LONG_PTR)WINHELP_RicheditWndProc); } hIcon = (wpage->page) ? wpage->page->file->hIcon : NULL; - if (!hIcon) hIcon = LoadImage(Globals.hInstance, MAKEINTRESOURCE(IDI_WINHELP), IMAGE_ICON, + if (!hIcon) hIcon = LoadImageW(Globals.hInstance, MAKEINTRESOURCEW(IDI_WINHELP), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), LR_SHARED); - SendMessage(win->hMainWnd, WM_SETICON, ICON_SMALL, (DWORD_PTR)hIcon); + SendMessageW(win->hMainWnd, WM_SETICON, ICON_SMALL, (DWORD_PTR)hIcon); /* Initialize file specific pushbuttons */ if (!(wpage->wininfo->win_style & WS_POPUP) && wpage->page) @@ -846,22 +846,22 @@ BOOL WINHELP_CreateHelpWindow(WINHELP_WNDPAGE* wpage, int nCmdShow, BOOL remembe */ for (win = Globals.win_list; win; win = win->next) { - if (!lstrcmpi(win->info->name, wpage->wininfo->name)) break; + if (!lstrcmpiA(win->info->name, wpage->wininfo->name)) break; } if (!win || !WINHELP_ReleaseWindow(win)) return TRUE; if (bPopup) { - DWORD mask = SendMessage(hTextWnd, EM_GETEVENTMASK, 0, 0); + DWORD mask = SendMessageW(hTextWnd, EM_GETEVENTMASK, 0, 0); win->font_scale = Globals.active_win->font_scale; WINHELP_SetupText(hTextWnd, win, wpage->relative); /* we need the window to be shown for richedit to compute the size */ ShowWindow(win->hMainWnd, nCmdShow); - SendMessage(hTextWnd, EM_SETEVENTMASK, 0, mask | ENM_REQUESTRESIZE); - SendMessage(hTextWnd, EM_REQUESTRESIZE, 0, 0); - SendMessage(hTextWnd, EM_SETEVENTMASK, 0, mask); + SendMessageW(hTextWnd, EM_SETEVENTMASK, 0, mask | ENM_REQUESTRESIZE); + SendMessageW(hTextWnd, EM_REQUESTRESIZE, 0, 0); + SendMessageW(hTextWnd, EM_SETEVENTMASK, 0, mask); } else { @@ -1009,11 +1009,11 @@ static LRESULT CALLBACK WINHELP_ButtonWndProc(HWND hWnd, UINT msg, WPARAM wParam case VK_PRIOR: case VK_NEXT: case VK_ESCAPE: - return SendMessage(GetParent(hWnd), msg, wParam, lParam); + return SendMessageA(GetParent(hWnd), msg, wParam, lParam); } } - return CallWindowProc(Globals.button_proc, hWnd, msg, wParam, lParam); + return CallWindowProcA(Globals.button_proc, hWnd, msg, wParam, lParam); } /*********************************************************************** @@ -1034,7 +1034,7 @@ static LRESULT CALLBACK WINHELP_ButtonBoxWndProc(HWND hWnd, UINT msg, WPARAM wPa { case WM_WINDOWPOSCHANGING: winpos = (WINDOWPOS*) lParam; - win = (WINHELP_WINDOW*) GetWindowLongPtr(GetParent(hWnd), 0); + win = (WINHELP_WINDOW*) GetWindowLongPtrW(GetParent(hWnd), 0); /* Update buttons */ button_size.cx = 0; @@ -1045,7 +1045,7 @@ static LRESULT CALLBACK WINHELP_ButtonBoxWndProc(HWND hWnd, UINT msg, WPARAM wPa SIZE textsize; if (!button->hWnd) { - button->hWnd = CreateWindow(STRING_BUTTON, button->lpszName, + button->hWnd = CreateWindowA(STRING_BUTTON, button->lpszName, WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON, 0, 0, 0, 0, hWnd, (HMENU) button->wParam, @@ -1055,21 +1055,20 @@ static LRESULT CALLBACK WINHELP_ButtonBoxWndProc(HWND hWnd, UINT msg, WPARAM wPa if (Globals.button_proc == NULL) { NONCLIENTMETRICSW ncm; - Globals.button_proc = (WNDPROC) GetWindowLongPtr(button->hWnd, GWLP_WNDPROC); + Globals.button_proc = (WNDPROC) GetWindowLongPtrA(button->hWnd, GWLP_WNDPROC); ncm.cbSize = sizeof(NONCLIENTMETRICSW); SystemParametersInfoW(SPI_GETNONCLIENTMETRICS, sizeof(NONCLIENTMETRICSW), &ncm, 0); Globals.hButtonFont = CreateFontIndirectW(&ncm.lfMenuFont); } - SetWindowLongPtr(button->hWnd, GWLP_WNDPROC, (LONG_PTR) WINHELP_ButtonWndProc); + SetWindowLongPtrA(button->hWnd, GWLP_WNDPROC, (LONG_PTR) WINHELP_ButtonWndProc); if (Globals.hButtonFont) - SendMessage(button->hWnd, WM_SETFONT, (WPARAM)Globals.hButtonFont, TRUE); + SendMessageW(button->hWnd, WM_SETFONT, (WPARAM)Globals.hButtonFont, TRUE); } } hDc = GetDC(button->hWnd); - GetTextExtentPoint(hDc, button->lpszName, - lstrlen(button->lpszName), &textsize); + GetTextExtentPointA(hDc, button->lpszName, strlen(button->lpszName), &textsize); ReleaseDC(button->hWnd, hDc); button_size.cx = max(button_size.cx, textsize.cx + BUTTON_CX); @@ -1091,7 +1090,7 @@ static LRESULT CALLBACK WINHELP_ButtonBoxWndProc(HWND hWnd, UINT msg, WPARAM wPa break; case WM_COMMAND: - SendMessage(GetParent(hWnd), msg, wParam, lParam); + SendMessageW(GetParent(hWnd), msg, wParam, lParam); break; case WM_KEYDOWN: @@ -1102,12 +1101,12 @@ static LRESULT CALLBACK WINHELP_ButtonBoxWndProc(HWND hWnd, UINT msg, WPARAM wPa case VK_PRIOR: case VK_NEXT: case VK_ESCAPE: - return SendMessage(GetParent(hWnd), msg, wParam, lParam); + return SendMessageA(GetParent(hWnd), msg, wParam, lParam); } break; } - return DefWindowProc(hWnd, msg, wParam, lParam); + return DefWindowProcA(hWnd, msg, wParam, lParam); } /****************************************************************** @@ -1120,26 +1119,26 @@ static LRESULT CALLBACK WINHELP_HistoryWndProc(HWND hWnd, UINT msg, WPARAM wPara WINHELP_WINDOW* win; PAINTSTRUCT ps; HDC hDc; - TEXTMETRIC tm; + TEXTMETRICW tm; unsigned int i; RECT r; switch (msg) { case WM_NCCREATE: - win = (WINHELP_WINDOW*)((LPCREATESTRUCT)lParam)->lpCreateParams; - SetWindowLongPtr(hWnd, 0, (ULONG_PTR)win); + win = (WINHELP_WINDOW*)((LPCREATESTRUCTA)lParam)->lpCreateParams; + SetWindowLongPtrW(hWnd, 0, (ULONG_PTR)win); win->hHistoryWnd = hWnd; break; case WM_CREATE: - win = (WINHELP_WINDOW*) GetWindowLongPtr(hWnd, 0); + win = (WINHELP_WINDOW*) GetWindowLongPtrW(hWnd, 0); hDc = GetDC(hWnd); - GetTextMetrics(hDc, &tm); + GetTextMetricsW(hDc, &tm); GetWindowRect(hWnd, &r); r.right = r.left + 30 * tm.tmAveCharWidth; r.bottom = r.top + (sizeof(Globals.history.set) / sizeof(Globals.history.set[0])) * tm.tmHeight; - AdjustWindowRect(&r, GetWindowLong(hWnd, GWL_STYLE), FALSE); + AdjustWindowRect(&r, GetWindowLongW(hWnd, GWL_STYLE), FALSE); if (r.left < 0) {r.right -= r.left; r.left = 0;} if (r.top < 0) {r.bottom -= r.top; r.top = 0;} @@ -1147,9 +1146,9 @@ static LRESULT CALLBACK WINHELP_HistoryWndProc(HWND hWnd, UINT msg, WPARAM wPara ReleaseDC(hWnd, hDc); break; case WM_LBUTTONDOWN: - win = (WINHELP_WINDOW*) GetWindowLongPtr(hWnd, 0); + win = (WINHELP_WINDOW*) GetWindowLongPtrW(hWnd, 0); hDc = GetDC(hWnd); - GetTextMetrics(hDc, &tm); + GetTextMetricsW(hDc, &tm); i = HIWORD(lParam) / tm.tmHeight; if (i < Globals.history.index) WINHELP_CreateHelpWindow(&Globals.history.set[i], SW_SHOW, TRUE); @@ -1157,14 +1156,14 @@ static LRESULT CALLBACK WINHELP_HistoryWndProc(HWND hWnd, UINT msg, WPARAM wPara break; case WM_PAINT: hDc = BeginPaint(hWnd, &ps); - win = (WINHELP_WINDOW*) GetWindowLongPtr(hWnd, 0); - GetTextMetrics(hDc, &tm); + win = (WINHELP_WINDOW*) GetWindowLongPtrW(hWnd, 0); + GetTextMetricsW(hDc, &tm); for (i = 0; i < Globals.history.index; i++) { if (Globals.history.set[i].page->file == Globals.active_win->page->file) { - TextOut(hDc, 0, i * tm.tmHeight, + TextOutA(hDc, 0, i * tm.tmHeight, Globals.history.set[i].page->lpszTitle, strlen(Globals.history.set[i].page->lpszTitle)); } @@ -1183,20 +1182,19 @@ static LRESULT CALLBACK WINHELP_HistoryWndProc(HWND hWnd, UINT msg, WPARAM wPara if (len > sizeof(buffer)) len = sizeof(buffer); memcpy(buffer, ptr1, len); if (len < sizeof(buffer)) buffer[len++] = ':'; - strncpy(&buffer[len], Globals.history.set[i].page->lpszTitle, sizeof(buffer) - len); - buffer[sizeof(buffer) - 1] = '\0'; - TextOut(hDc, 0, i * tm.tmHeight, buffer, strlen(buffer)); + lstrcpynA(&buffer[len], Globals.history.set[i].page->lpszTitle, sizeof(buffer) - len); + TextOutA(hDc, 0, i * tm.tmHeight, buffer, strlen(buffer)); } } EndPaint(hWnd, &ps); break; case WM_DESTROY: - win = (WINHELP_WINDOW*) GetWindowLongPtr(hWnd, 0); + win = (WINHELP_WINDOW*) GetWindowLongPtrW(hWnd, 0); if (hWnd == win->hHistoryWnd) win->hHistoryWnd = 0; break; } - return DefWindowProc(hWnd, msg, wParam, lParam); + return DefWindowProcA(hWnd, msg, wParam, lParam); } /************************************************************************** @@ -1211,9 +1209,9 @@ static void cb_KWBTree(void *p, void **next, void *cookie) int count; WINE_TRACE("Adding '%s' to search list\n", (char *)p); - SendMessage(hListWnd, LB_INSERTSTRING, -1, (LPARAM)p); - count = SendMessage(hListWnd, LB_GETCOUNT, 0, 0); - SendMessage(hListWnd, LB_SETITEMDATA, count-1, (LPARAM)p); + SendMessageA(hListWnd, LB_INSERTSTRING, -1, (LPARAM)p); + count = SendMessageW(hListWnd, LB_GETCOUNT, 0, 0); + SendMessageW(hListWnd, LB_SETITEMDATA, count-1, (LPARAM)p); *next = (char*)p + strlen((char*)p) + 7; } @@ -1236,7 +1234,7 @@ static INT_PTR CALLBACK WINHELP_IndexDlgProc(HWND hWnd, UINT msg, WPARAM wParam, switch (msg) { case WM_INITDIALOG: - id = (struct index_data*)((PROPSHEETPAGE*)lParam)->lParam; + id = (struct index_data*)((PROPSHEETPAGEA*)lParam)->lParam; HLPFILE_BPTreeEnum(id->hlpfile->kwbtree, cb_KWBTree, GetDlgItem(hWnd, IDC_INDEXLIST)); id->jump = FALSE; @@ -1247,7 +1245,7 @@ static INT_PTR CALLBACK WINHELP_IndexDlgProc(HWND hWnd, UINT msg, WPARAM wParam, { case LBN_DBLCLK: if (LOWORD(wParam) == IDC_INDEXLIST) - SendMessage(GetParent(hWnd), PSM_PRESSBUTTON, PSBTN_OK, 0); + SendMessageW(GetParent(hWnd), PSM_PRESSBUTTON, PSBTN_OK, 0); break; } break; @@ -1255,31 +1253,30 @@ static INT_PTR CALLBACK WINHELP_IndexDlgProc(HWND hWnd, UINT msg, WPARAM wParam, switch (((NMHDR*)lParam)->code) { case PSN_APPLY: - sel = SendDlgItemMessage(hWnd, IDC_INDEXLIST, LB_GETCURSEL, 0, 0); + sel = SendDlgItemMessageW(hWnd, IDC_INDEXLIST, LB_GETCURSEL, 0, 0); if (sel != LB_ERR) { BYTE *p; int count; - p = (BYTE*)SendDlgItemMessage(hWnd, IDC_INDEXLIST, - LB_GETITEMDATA, sel, 0); + p = (BYTE*)SendDlgItemMessageW(hWnd, IDC_INDEXLIST, LB_GETITEMDATA, sel, 0); count = *(short*)((char *)p + strlen((char *)p) + 1); if (count > 1) { - MessageBox(hWnd, "count > 1 not supported yet", "Error", MB_OK | MB_ICONSTOP); - SetWindowLongPtr(hWnd, DWLP_MSGRESULT, PSNRET_INVALID); + MessageBoxA(hWnd, "count > 1 not supported yet", "Error", MB_OK | MB_ICONSTOP); + SetWindowLongPtrW(hWnd, DWLP_MSGRESULT, PSNRET_INVALID); return TRUE; } id->offset = *(ULONG*)((char *)p + strlen((char *)p) + 3); id->offset = *(long*)(id->hlpfile->kwdata + id->offset + 9); if (id->offset == 0xFFFFFFFF) { - MessageBox(hWnd, "macro keywords not supported yet", "Error", MB_OK | MB_ICONSTOP); - SetWindowLongPtr(hWnd, DWLP_MSGRESULT, PSNRET_INVALID); + MessageBoxA(hWnd, "macro keywords not supported yet", "Error", MB_OK | MB_ICONSTOP); + SetWindowLongPtrW(hWnd, DWLP_MSGRESULT, PSNRET_INVALID); return TRUE; } id->jump = TRUE; - SetWindowLongPtr(hWnd, DWLP_MSGRESULT, PSNRET_NOERROR); + SetWindowLongPtrW(hWnd, DWLP_MSGRESULT, PSNRET_NOERROR); } return TRUE; default: @@ -1306,7 +1303,7 @@ static INT_PTR CALLBACK WINHELP_SearchDlgProc(HWND hWnd, UINT msg, WPARAM wParam switch (((NMHDR*)lParam)->code) { case PSN_APPLY: - SetWindowLongPtr(hWnd, DWLP_MSGRESULT, PSNRET_NOERROR); + SetWindowLongPtrW(hWnd, DWLP_MSGRESULT, PSNRET_NOERROR); return TRUE; default: return FALSE; @@ -1334,20 +1331,20 @@ static LRESULT CALLBACK WINHELP_MainWndProc(HWND hWnd, UINT msg, WPARAM wParam, switch (msg) { case WM_NCCREATE: - win = (WINHELP_WINDOW*) ((LPCREATESTRUCT) lParam)->lpCreateParams; - SetWindowLongPtr(hWnd, 0, (ULONG_PTR) win); + win = (WINHELP_WINDOW*) ((LPCREATESTRUCTA) lParam)->lpCreateParams; + SetWindowLongPtrW(hWnd, 0, (ULONG_PTR) win); if (!win->page && Globals.isBook) - PostMessage(hWnd, WM_COMMAND, MNID_FILE_OPEN, 0); + PostMessageW(hWnd, WM_COMMAND, MNID_FILE_OPEN, 0); win->hMainWnd = hWnd; break; case WM_WINDOWPOSCHANGED: - WINHELP_LayoutMainWindow((WINHELP_WINDOW*) GetWindowLongPtr(hWnd, 0)); + WINHELP_LayoutMainWindow((WINHELP_WINDOW*) GetWindowLongPtrW(hWnd, 0)); break; case WM_COMMAND: - win = (WINHELP_WINDOW*) GetWindowLongPtr(hWnd, 0); - switch (wParam) + win = (WINHELP_WINDOW*) GetWindowLongPtrW(hWnd, 0); + switch (LOWORD(wParam)) { /* Menu FILE */ case MNID_FILE_OPEN: MACRO_FileOpen(); break; @@ -1357,7 +1354,7 @@ static LRESULT CALLBACK WINHELP_MainWndProc(HWND hWnd, UINT msg, WPARAM wParam, /* Menu EDIT */ case MNID_EDIT_COPYDLG: - SendMessage(GetDlgItem(hWnd, CTL_ID_TEXT), WM_COPY, 0, 0); + SendDlgItemMessageW(hWnd, CTL_ID_TEXT, WM_COPY, 0, 0); break; case MNID_EDIT_ANNOTATE:MACRO_Annotate(); break; @@ -1376,7 +1373,7 @@ static LRESULT CALLBACK WINHELP_MainWndProc(HWND hWnd, UINT msg, WPARAM wParam, case MNID_OPTS_HISTORY: MACRO_History(); break; case MNID_OPTS_FONTS_SMALL: case MNID_CTXT_FONTS_SMALL: - win = (WINHELP_WINDOW*) GetWindowLongPtr(hWnd, 0); + win = (WINHELP_WINDOW*) GetWindowLongPtrW(hWnd, 0); if (win->font_scale != 0) { win->font_scale = 0; @@ -1385,7 +1382,7 @@ static LRESULT CALLBACK WINHELP_MainWndProc(HWND hWnd, UINT msg, WPARAM wParam, break; case MNID_OPTS_FONTS_NORMAL: case MNID_CTXT_FONTS_NORMAL: - win = (WINHELP_WINDOW*) GetWindowLongPtr(hWnd, 0); + win = (WINHELP_WINDOW*) GetWindowLongPtrW(hWnd, 0); if (win->font_scale != 1) { win->font_scale = 1; @@ -1394,22 +1391,13 @@ static LRESULT CALLBACK WINHELP_MainWndProc(HWND hWnd, UINT msg, WPARAM wParam, break; case MNID_OPTS_FONTS_LARGE: case MNID_CTXT_FONTS_LARGE: - win = (WINHELP_WINDOW*) GetWindowLongPtr(hWnd, 0); + win = (WINHELP_WINDOW*) GetWindowLongPtrW(hWnd, 0); if (win->font_scale != 2) { win->font_scale = 2; WINHELP_SetupText(GetDlgItem(hWnd, CTL_ID_TEXT), win, 0 /* FIXME */); } break; - case MNID_OPTS_HELP_DEFAULT: - case MNID_OPTS_HELP_VISIBLE: - case MNID_OPTS_HELP_NONVISIBLE: - case MNID_OPTS_SYSTEM_COLORS: - case MNID_CTXT_HELP_DEFAULT: - case MNID_CTXT_HELP_VISIBLE: - case MNID_CTXT_HELP_NONVISIBLE: - case MNID_CTXT_SYSTEM_COLORS: - /* FIXME: NIY */ default: /* Buttons */ @@ -1418,8 +1406,8 @@ static LRESULT CALLBACK WINHELP_MainWndProc(HWND hWnd, UINT msg, WPARAM wParam, if (button) MACRO_ExecuteMacro(win, button->lpszMacro); else if (!HIWORD(wParam)) - MessageBox(0, MAKEINTRESOURCE(STID_NOT_IMPLEMENTED), - MAKEINTRESOURCE(STID_WHERROR), MB_OK); + MessageBoxW(0, MAKEINTRESOURCEW(STID_NOT_IMPLEMENTED), + MAKEINTRESOURCEW(STID_WHERROR), MB_OK); break; } break; @@ -1432,28 +1420,28 @@ static LRESULT CALLBACK WINHELP_MainWndProc(HWND hWnd, UINT msg, WPARAM wParam, case WM_CHAR: if (wParam == 3) { - SendMessage(GetDlgItem(hWnd, CTL_ID_TEXT), WM_COPY, 0, 0); + SendDlgItemMessageW(hWnd, CTL_ID_TEXT, WM_COPY, 0, 0); return 0; } break; case WM_KEYDOWN: - win = (WINHELP_WINDOW*) GetWindowLongPtr(hWnd, 0); + win = (WINHELP_WINDOW*) GetWindowLongPtrW(hWnd, 0); hTextWnd = GetDlgItem(win->hMainWnd, CTL_ID_TEXT); switch (wParam) { case VK_UP: - SendMessage(hTextWnd, EM_SCROLL, SB_LINEUP, 0); + SendMessageW(hTextWnd, EM_SCROLL, SB_LINEUP, 0); return 0; case VK_DOWN: - SendMessage(hTextWnd, EM_SCROLL, SB_LINEDOWN, 0); + SendMessageW(hTextWnd, EM_SCROLL, SB_LINEDOWN, 0); return 0; case VK_PRIOR: - SendMessage(hTextWnd, EM_SCROLL, SB_PAGEUP, 0); + SendMessageW(hTextWnd, EM_SCROLL, SB_PAGEUP, 0); return 0; case VK_NEXT: - SendMessage(hTextWnd, EM_SCROLL, SB_PAGEDOWN, 0); + SendMessageW(hTextWnd, EM_SCROLL, SB_PAGEDOWN, 0); return 0; case VK_ESCAPE: MACRO_Exit(); @@ -1475,15 +1463,15 @@ static LRESULT CALLBACK WINHELP_MainWndProc(HWND hWnd, UINT msg, WPARAM wParam, { case WM_KEYUP: if (msgf->wParam == VK_ESCAPE) - WINHELP_ReleaseWindow((WINHELP_WINDOW*)GetWindowLongPtr(hWnd, 0)); + WINHELP_ReleaseWindow((WINHELP_WINDOW*)GetWindowLongPtrW(hWnd, 0)); break; case WM_RBUTTONDOWN: { HMENU hMenu; POINT pt; - win = (WINHELP_WINDOW*) GetWindowLongPtr(hWnd, 0); - hMenu = LoadMenu(Globals.hInstance, (LPSTR)CONTEXT_MENU); + win = (WINHELP_WINDOW*) GetWindowLongPtrW(hWnd, 0); + hMenu = LoadMenuW(Globals.hInstance, MAKEINTRESOURCEW(CONTEXT_MENU)); switch (win->font_scale) { case 0: @@ -1492,6 +1480,7 @@ static LRESULT CALLBACK WINHELP_MainWndProc(HWND hWnd, UINT msg, WPARAM wParam, break; default: WINE_FIXME("Unsupported %d\n", win->font_scale); + /* fall through */ case 1: CheckMenuItem(hMenu, MNID_CTXT_FONTS_NORMAL, MF_BYCOMMAND|MF_CHECKED); @@ -1510,7 +1499,7 @@ static LRESULT CALLBACK WINHELP_MainWndProc(HWND hWnd, UINT msg, WPARAM wParam, } break; default: - return WINHELP_HandleTextMouse((WINHELP_WINDOW*)GetWindowLongPtr(hWnd, 0), + return WINHELP_HandleTextMouse((WINHELP_WINDOW*)GetWindowLongPtrW(hWnd, 0), msgf->msg, msgf->lParam); } } @@ -1518,8 +1507,8 @@ static LRESULT CALLBACK WINHELP_MainWndProc(HWND hWnd, UINT msg, WPARAM wParam, case EN_REQUESTRESIZE: rc = ((REQRESIZE*)lParam)->rc; - win = (WINHELP_WINDOW*) GetWindowLongPtr(hWnd, 0); - AdjustWindowRect(&rc, GetWindowLong(win->hMainWnd, GWL_STYLE), + win = (WINHELP_WINDOW*) GetWindowLongPtrW(hWnd, 0); + AdjustWindowRect(&rc, GetWindowLongW(win->hMainWnd, GWL_STYLE), FALSE); SetWindowPos(win->hMainWnd, HWND_TOP, 0, 0, rc.right - rc.left, rc.bottom - rc.top, @@ -1531,7 +1520,7 @@ static LRESULT CALLBACK WINHELP_MainWndProc(HWND hWnd, UINT msg, WPARAM wParam, break; case WM_INITMENUPOPUP: - win = (WINHELP_WINDOW*) GetWindowLongPtr(hWnd, 0); + win = (WINHELP_WINDOW*) GetWindowLongPtrW(hWnd, 0); CheckMenuItem((HMENU)wParam, MNID_OPTS_FONTS_SMALL, MF_BYCOMMAND | (win->font_scale == 0) ? MF_CHECKED : 0); CheckMenuItem((HMENU)wParam, MNID_OPTS_FONTS_NORMAL, @@ -1540,11 +1529,11 @@ static LRESULT CALLBACK WINHELP_MainWndProc(HWND hWnd, UINT msg, WPARAM wParam, MF_BYCOMMAND | (win->font_scale == 2) ? MF_CHECKED : 0); break; case WM_DESTROY: - win = (WINHELP_WINDOW*) GetWindowLongPtr(hWnd, 0); + win = (WINHELP_WINDOW*) GetWindowLongPtrW(hWnd, 0); WINHELP_DeleteWindow(win); break; } - return DefWindowProc(hWnd, msg, wParam, lParam); + return DefWindowProcA(hWnd, msg, wParam, lParam); } /************************************************************************** @@ -1556,8 +1545,8 @@ static LRESULT CALLBACK WINHELP_MainWndProc(HWND hWnd, UINT msg, WPARAM wParam, BOOL WINHELP_CreateIndexWindow(BOOL is_search) { HPROPSHEETPAGE psPage[3]; - PROPSHEETPAGE psp; - PROPSHEETHEADER psHead; + PROPSHEETPAGEA psp; + PROPSHEETHEADERA psHead; struct index_data id; char buf[256]; @@ -1580,20 +1569,20 @@ BOOL WINHELP_CreateIndexWindow(BOOL is_search) psp.dwFlags = 0; psp.hInstance = Globals.hInstance; - psp.u.pszTemplate = MAKEINTRESOURCE(IDD_INDEX); + psp.u.pszTemplate = MAKEINTRESOURCEA(IDD_INDEX); psp.lParam = (LPARAM)&id; psp.pfnDlgProc = WINHELP_IndexDlgProc; - psPage[0] = CreatePropertySheetPage(&psp); + psPage[0] = CreatePropertySheetPageA(&psp); - psp.u.pszTemplate = MAKEINTRESOURCE(IDD_SEARCH); + psp.u.pszTemplate = MAKEINTRESOURCEA(IDD_SEARCH); psp.lParam = (LPARAM)&id; psp.pfnDlgProc = WINHELP_SearchDlgProc; - psPage[1] = CreatePropertySheetPage(&psp); + psPage[1] = CreatePropertySheetPageA(&psp); memset(&psHead, 0, sizeof(psHead)); psHead.dwSize = sizeof(psHead); - LoadString(Globals.hInstance, STID_PSH_INDEX, buf, sizeof(buf)); + LoadStringA(Globals.hInstance, STID_PSH_INDEX, buf, sizeof(buf)); strcat(buf, Globals.active_win->info->caption); psHead.pszCaption = buf; @@ -1603,7 +1592,7 @@ BOOL WINHELP_CreateIndexWindow(BOOL is_search) psHead.u3.phpage = psPage; psHead.dwFlags = PSH_NOAPPLYNOW; - PropertySheet(&psHead); + PropertySheetA(&psHead); if (id.jump) { WINE_TRACE("got %d as an offset\n", id.offset); @@ -1619,7 +1608,7 @@ BOOL WINHELP_CreateIndexWindow(BOOL is_search) */ static BOOL WINHELP_RegisterWinClasses(void) { - WNDCLASSEX class_main, class_button_box, class_history; + WNDCLASSEXA class_main, class_button_box, class_history; class_main.cbSize = sizeof(class_main); class_main.style = CS_HREDRAW | CS_VREDRAW; @@ -1627,12 +1616,12 @@ static BOOL WINHELP_RegisterWinClasses(void) class_main.cbClsExtra = 0; class_main.cbWndExtra = sizeof(WINHELP_WINDOW *); class_main.hInstance = Globals.hInstance; - class_main.hIcon = LoadIcon(Globals.hInstance, MAKEINTRESOURCE(IDI_WINHELP)); - class_main.hCursor = LoadCursor(0, IDC_ARROW); + class_main.hIcon = LoadIconW(Globals.hInstance, MAKEINTRESOURCEW(IDI_WINHELP)); + class_main.hCursor = LoadCursorW(0, (LPWSTR)IDC_ARROW); class_main.hbrBackground = (HBRUSH)(COLOR_WINDOW+1); class_main.lpszMenuName = 0; class_main.lpszClassName = MAIN_WIN_CLASS_NAME; - class_main.hIconSm = LoadImage(Globals.hInstance, MAKEINTRESOURCE(IDI_WINHELP), IMAGE_ICON, + class_main.hIconSm = LoadImageW(Globals.hInstance, MAKEINTRESOURCEW(IDI_WINHELP), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), LR_SHARED); @@ -1646,9 +1635,9 @@ static BOOL WINHELP_RegisterWinClasses(void) class_history.lpfnWndProc = WINHELP_HistoryWndProc; class_history.lpszClassName = HISTORY_WIN_CLASS_NAME; - return (RegisterClassEx(&class_main) && - RegisterClassEx(&class_button_box) && - RegisterClassEx(&class_history)); + return (RegisterClassExA(&class_main) && + RegisterClassExA(&class_button_box) && + RegisterClassExA(&class_history)); } /*********************************************************************** @@ -1663,12 +1652,13 @@ int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE prev, LPSTR cmdline, int show) static CHAR default_wndname[] = "main"; LPSTR wndname = default_wndname; WINHELP_DLL* dll; + HACCEL hAccel; Globals.hInstance = hInstance; - if (LoadLibrary("riched20.dll") == NULL) - return MessageBox(0, MAKEINTRESOURCE(STID_NO_RICHEDIT), - MAKEINTRESOURCE(STID_WHERROR), MB_OK); + if (LoadLibraryA("riched20.dll") == NULL) + return MessageBoxW(0, MAKEINTRESOURCEW(STID_NO_RICHEDIT), + MAKEINTRESOURCEW(STID_WHERROR), MB_OK); /* Get options */ while (*cmdline && (*cmdline == ' ' || *cmdline == '-')) @@ -1734,10 +1724,15 @@ int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE prev, LPSTR cmdline, int show) WINHELP_GetWindowInfo(hlpfile, wndname), show); /* Message loop */ - while ((Globals.win_list || Globals.active_popup) && GetMessage(&msg, 0, 0, 0)) + hAccel = LoadAcceleratorsW(hInstance, MAKEINTRESOURCEW(MAIN_ACCEL)); + while ((Globals.win_list || Globals.active_popup) && GetMessageW(&msg, 0, 0, 0)) { - TranslateMessage(&msg); - DispatchMessage(&msg); + HWND hWnd = Globals.active_win ? Globals.active_win->hMainWnd : NULL; + if (!TranslateAcceleratorW(hWnd, hAccel, &msg)) + { + TranslateMessage(&msg); + DispatchMessageW(&msg); + } } for (dll = Globals.dlls; dll; dll = dll->next) { diff --git a/reactos/base/applications/winhlp32/winhelp_res.h b/reactos/base/applications/winhlp32/winhelp_res.h index 09c42913e21..9c8324dab62 100644 --- a/reactos/base/applications/winhlp32/winhelp_res.h +++ b/reactos/base/applications/winhlp32/winhelp_res.h @@ -36,6 +36,7 @@ #define MAIN_MENU 0xF000 #define CONTEXT_MENU 0xF001 +#define MAIN_ACCEL 0xF002 #define STID_WINE_HELP 0x120 #define STID_WHERROR 0x121 diff --git a/reactos/media/doc/README.WINE b/reactos/media/doc/README.WINE index 384e7829bb1..5573737ee3b 100644 --- a/reactos/media/doc/README.WINE +++ b/reactos/media/doc/README.WINE @@ -215,7 +215,7 @@ reactos/base/applications/iexplore # Autosync reactos/base/applications/notepad # Forked at Wine-20041201 reactos/base/applications/reg # Autosync reactos/base/applications/regedit # Out of sync -reactos/base/applications/winhlp32 # Autosync +reactos/base/applications/winhlp32 # Synced to Wine-1.5.26 reactos/base/applications/wordpad # Autosync reactos/base/services/rpcss # Synced to Wine-20081105 reactos/base/system/expand # Autosync