Commit dff8de63 authored by Eric Pouech's avatar Eric Pouech Committed by Alexandre Julliard

- added support plug-in DLLs for winhelp

- added preliminary support for plug-in callback into winhelp - rewrote all the macros accordingly (macro entry-point has to have WINAPI calling convention) - some fixes for embedded images decompression - misc cleanups
parent 2003c7ab
...@@ -8,10 +8,11 @@ IMPORTS = comdlg32 shell32 user32 gdi32 kernel32 ...@@ -8,10 +8,11 @@ IMPORTS = comdlg32 shell32 user32 gdi32 kernel32
PROGRAMS = hlp2sgml PROGRAMS = hlp2sgml
C_SRCS = \ C_SRCS = \
winhelp.c \ callback.c \
hlpfile.c \ hlpfile.c \
macro.c \ macro.c \
string.c string.c \
winhelp.c
EXTRA_SRCS = macro.lex.l EXTRA_SRCS = macro.lex.l
EXTRA_OBJS = @LEX_OUTPUT_ROOT@.o EXTRA_OBJS = @LEX_OUTPUT_ROOT@.o
......
/*
* Help Viewer - DLL callback into WineHelp
*
* Copyright 2004 Eric Pouech
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <stdio.h>
#include "windows.h"
#include "winhelp.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(winhelp);
static WORD CALLBACK WHD_GetFSError(void)
{
WINE_FIXME("()\n");
return 0;
}
static HANDLE CALLBACK WHD_Open(LPSTR name, BYTE flags)
{
unsigned mode = 0;
WINE_FIXME("(%s %x)\n", wine_dbgstr_a(name), flags);
switch (flags)
{
case 0: mode = GENERIC_READ | GENERIC_WRITE; break;
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,
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
}
static WORD CALLBACK WHD_Close(HANDLE fs)
{
WINE_FIXME("(%p)\n", fs);
CloseHandle(fs);
return 0;
}
static HANDLE CALLBACK WHD_OpenBag(HANDLE fs, LPSTR name, BYTE flags)
{
WINE_FIXME("(%p %s %x)\n", fs, name, flags);
return NULL;
}
static HANDLE CALLBACK WHD_CloseBag(HANDLE bag)
{
WINE_FIXME("()\n");
return NULL;
}
static LONG CALLBACK WHD_ReadBag(HANDLE bag, BYTE* ptr, LONG len)
{
WINE_FIXME("()\n");
return 0;
}
static LONG CALLBACK WHD_TellBag(HANDLE bag)
{
WINE_FIXME("()\n");
return 0;
}
static LONG CALLBACK WHD_SeekBag(HANDLE bag, LONG offset, WORD whence)
{
WINE_FIXME("()\n");
return 0;
}
static BOOL CALLBACK WHD_IsEofBag(HANDLE bag)
{
WINE_FIXME("()\n");
return FALSE;
}
static LONG CALLBACK WHD_SizeBag(HANDLE bag)
{
WINE_FIXME("()\n");
return 0;
}
static BOOL CALLBACK WHD_Access(HANDLE fs, LPSTR name, BYTE flags)
{
WINE_FIXME("()\n");
return FALSE;
}
static WORD CALLBACK WHD_LLInfoFromBag(HANDLE bag, WORD opt, LPWORD p1, LPLONG p2, LPLONG p3)
{
WINE_FIXME("()\n");
return 0;
}
static WORD CALLBACK WHD_LLInfoFromFile(HANDLE fs, LPSTR name, WORD opt, LPWORD p1, LPLONG p2, LPLONG p3)
{
WINE_FIXME("()\n");
return 0;
}
static void CALLBACK WHD_Error(int err)
{
WINE_FIXME("()\n");
}
static void CALLBACK WHD_ErrorString(LPSTR err)
{
WINE_FIXME("()\n");
}
static LONG CALLBACK WHD_GetInfo(WORD what, HWND hnd)
{
LONG ret = 0;
WINE_TRACE("(%x %p)\n", what, hnd);
switch (what)
{
case 0: break;
case 1: /* instance */ ret = (LONG)Globals.hInstance; break;
case 3: /* current window */ ret = (LONG)Globals.active_win->hMainWnd; break;
case 2: /* main window */
case 4: /* handle to opened file */
case 5: /* foreground color */
case 6: /* background color */
case 7: /* topic number */
case 8: /* current opened file name */
WINE_FIXME("NIY %u\n", what);
break;
default:
WINE_FIXME("Undocumented %u\n", what);
break;
}
return ret;
}
static LONG CALLBACK WHD_API(LPSTR x, WORD xx, DWORD xxx)
{
WINE_FIXME("()\n");
return 0;
}
FARPROC Callbacks[] =
{
(FARPROC)WHD_GetFSError,
(FARPROC)WHD_Open,
(FARPROC)WHD_Close,
(FARPROC)WHD_OpenBag,
(FARPROC)WHD_CloseBag,
(FARPROC)WHD_ReadBag,
(FARPROC)WHD_TellBag,
(FARPROC)WHD_SeekBag,
(FARPROC)WHD_IsEofBag,
(FARPROC)WHD_SizeBag,
(FARPROC)WHD_Access,
(FARPROC)WHD_LLInfoFromBag,
(FARPROC)WHD_LLInfoFromFile,
(FARPROC)WHD_Error,
(FARPROC)WHD_ErrorString,
(FARPROC)WHD_GetInfo,
(FARPROC)WHD_API
};
...@@ -91,11 +91,12 @@ static BOOL HLPFILE_Uncompress3(char*, const char*, const BYTE*, const BYTE*); ...@@ -91,11 +91,12 @@ static BOOL HLPFILE_Uncompress3(char*, const char*, const BYTE*, const BYTE*);
static void HLPFILE_UncompressRLE(const BYTE* src, const BYTE* end, BYTE** dst, unsigned dstsz); static void HLPFILE_UncompressRLE(const BYTE* src, const BYTE* end, BYTE** dst, unsigned dstsz);
static BOOL HLPFILE_ReadFont(HLPFILE* hlpfile); static BOOL HLPFILE_ReadFont(HLPFILE* hlpfile);
#if 0
/*********************************************************************** /***********************************************************************
* *
* HLPFILE_PageByNumber * HLPFILE_PageByNumber
*/ */
HLPFILE_PAGE *HLPFILE_PageByNumber(LPCSTR lpszPath, UINT wNum) static HLPFILE_PAGE *HLPFILE_PageByNumber(LPCSTR lpszPath, UINT wNum)
{ {
HLPFILE_PAGE *page; HLPFILE_PAGE *page;
HLPFILE *hlpfile = HLPFILE_ReadHlpFile(lpszPath); HLPFILE *hlpfile = HLPFILE_ReadHlpFile(lpszPath);
...@@ -110,6 +111,7 @@ HLPFILE_PAGE *HLPFILE_PageByNumber(LPCSTR lpszPath, UINT wNum) ...@@ -110,6 +111,7 @@ HLPFILE_PAGE *HLPFILE_PageByNumber(LPCSTR lpszPath, UINT wNum)
return page; return page;
} }
#endif
/* FIXME: /* FIXME:
* this finds the page containing the offset. The offset can either * this finds the page containing the offset. The offset can either
...@@ -534,7 +536,7 @@ static BYTE* HLPFILE_DecompressGfx(BYTE* src, unsigned csz, unsigned sz, BYTE ...@@ -534,7 +536,7 @@ static BYTE* HLPFILE_DecompressGfx(BYTE* src, unsigned csz, unsigned sz, BYTE
if (!dst) return NULL; if (!dst) return NULL;
HLPFILE_UncompressRLE(src, src + csz, &tmp, sz); HLPFILE_UncompressRLE(src, src + csz, &tmp, sz);
if (tmp - dst != sz) if (tmp - dst != sz)
WINE_FIXME("Bogus gfx sizes (RunLen): %u/%u\n", tmp - dst, sz); WINE_WARN("Bogus gfx sizes (RunLen): %u/%u\n", tmp - dst, sz);
break; break;
case 2: /* LZ77 */ case 2: /* LZ77 */
sz77 = HLPFILE_UncompressedLZ77_Size(src, src + csz); sz77 = HLPFILE_UncompressedLZ77_Size(src, src + csz);
...@@ -671,7 +673,7 @@ static BOOL HLPFILE_LoadMetaFile(BYTE* beg, BYTE pack, HLPFILE_PARAGRAPH* pa ...@@ -671,7 +673,7 @@ static BOOL HLPFILE_LoadMetaFile(BYTE* beg, BYTE pack, HLPFILE_PARAGRAPH* pa
hsoff = GET_UINT(ptr, 4); hsoff = GET_UINT(ptr, 4);
ptr += 8; ptr += 8;
WINE_FIXME("sz=%lu csz=%lu (%ld,%ld) offs=%lu/%u,%lu\n", WINE_TRACE("sz=%lu csz=%lu (%ld,%ld) offs=%lu/%u,%lu\n",
size, csize, mfp.xExt, mfp.yExt, off, ptr - beg, hsoff); size, csize, mfp.xExt, mfp.yExt, off, ptr - beg, hsoff);
bits = HLPFILE_DecompressGfx(beg + off, csize, size, pack); bits = HLPFILE_DecompressGfx(beg + off, csize, size, pack);
...@@ -1785,10 +1787,10 @@ static void HLPFILE_UncompressRLE(const BYTE* src, const BYTE* end, BYTE** dst, ...@@ -1785,10 +1787,10 @@ static void HLPFILE_UncompressRLE(const BYTE* src, const BYTE* end, BYTE** dst,
while (src < end) while (src < end)
{ {
ch = *src++; ch = *src++;
if (!(ch & 0x7F)) continue;
if (ch & 0x80) if (ch & 0x80)
{ {
ch &= 0x7F; ch &= 0x7F;
if (ch == 0) WINE_FIXME("Null length 1, next is %u\n", *src);
if ((*dst) + ch < sdst) if ((*dst) + ch < sdst)
memcpy(*dst, src, ch); memcpy(*dst, src, ch);
src += ch; src += ch;
...@@ -1796,18 +1798,13 @@ static void HLPFILE_UncompressRLE(const BYTE* src, const BYTE* end, BYTE** dst, ...@@ -1796,18 +1798,13 @@ static void HLPFILE_UncompressRLE(const BYTE* src, const BYTE* end, BYTE** dst,
else else
{ {
if ((*dst) + ch < sdst) if ((*dst) + ch < sdst)
memset(*dst, (char)*src, ch); memset(*dst, (char)*src++, ch);
src++;
if (ch == 0)
{
WINE_FIXME("Null length 2, next is %u\n", *src);
}
} }
*dst += ch; *dst += ch;
} }
if (*dst != sdst) if (*dst != sdst)
WINE_FIXME("Buffer X-flow: d(%u) instead of d(%u)\n", WINE_WARN("Buffer X-flow: d(%u) instead of d(%u)\n",
*dst - (sdst - dstsz), dstsz); *dst - (sdst - dstsz), dstsz);
} }
/****************************************************************** /******************************************************************
......
...@@ -37,7 +37,7 @@ struct MacroDesc { ...@@ -37,7 +37,7 @@ struct MacroDesc {
char* alias; char* alias;
BOOL isBool; BOOL isBool;
char* arguments; char* arguments;
void (*fn)(); FARPROC fn;
}; };
/* types: /* types:
...@@ -48,97 +48,97 @@ struct MacroDesc { ...@@ -48,97 +48,97 @@ struct MacroDesc {
*/ */
static struct MacroDesc MACRO_Builtins[] = { static struct MacroDesc MACRO_Builtins[] = {
{"About", NULL, 0, "", MACRO_About}, {"About", NULL, 0, "", (FARPROC)MACRO_About},
{"AddAccelerator", "AA", 0, "UUS", MACRO_AddAccelerator}, {"AddAccelerator", "AA", 0, "UUS", (FARPROC)MACRO_AddAccelerator},
{"ALink", "AL", 0, "SUS", MACRO_ALink}, {"ALink", "AL", 0, "SUS", (FARPROC)MACRO_ALink},
{"Annotate", NULL, 0, "", MACRO_Annotate}, {"Annotate", NULL, 0, "", (FARPROC)MACRO_Annotate},
{"AppendItem", NULL, 0, "SSSS", MACRO_AppendItem}, {"AppendItem", NULL, 0, "SSSS", (FARPROC)MACRO_AppendItem},
{"Back", NULL, 0, "", MACRO_Back}, {"Back", NULL, 0, "", (FARPROC)MACRO_Back},
{"BackFlush", "BF", 0, "", MACRO_BackFlush}, {"BackFlush", "BF", 0, "", (FARPROC)MACRO_BackFlush},
{"BookmarkDefine", NULL, 0, "", MACRO_BookmarkDefine}, {"BookmarkDefine", NULL, 0, "", (FARPROC)MACRO_BookmarkDefine},
{"BookmarkMore", NULL, 0, "", MACRO_BookmarkMore}, {"BookmarkMore", NULL, 0, "", (FARPROC)MACRO_BookmarkMore},
{"BrowseButtons", NULL, 0, "", MACRO_BrowseButtons}, {"BrowseButtons", NULL, 0, "", (FARPROC)MACRO_BrowseButtons},
{"ChangeButtonBinding", "CBB",0, "SS", MACRO_ChangeButtonBinding}, {"ChangeButtonBinding", "CBB",0, "SS", (FARPROC)MACRO_ChangeButtonBinding},
{"ChangeEnable", "CE", 0, "SS", MACRO_ChangeEnable}, {"ChangeEnable", "CE", 0, "SS", (FARPROC)MACRO_ChangeEnable},
{"ChangeItemBinding", "CIB",0, "SS", MACRO_ChangeItemBinding}, {"ChangeItemBinding", "CIB",0, "SS", (FARPROC)MACRO_ChangeItemBinding},
{"CheckItem", "CI", 0, "S", MACRO_CheckItem}, {"CheckItem", "CI", 0, "S", (FARPROC)MACRO_CheckItem},
{"CloseSecondarys", "CS", 0, "", MACRO_CloseSecondarys}, {"CloseSecondarys", "CS", 0, "", (FARPROC)MACRO_CloseSecondarys},
{"CloseWindow", "CW", 0, "S", MACRO_CloseWindow}, {"CloseWindow", "CW", 0, "S", (FARPROC)MACRO_CloseWindow},
{"Compare", NULL, 0, "S", MACRO_Compare}, {"Compare", NULL, 0, "S", (FARPROC)MACRO_Compare},
{"Contents", NULL, 0, "", MACRO_Contents}, {"Contents", NULL, 0, "", (FARPROC)MACRO_Contents},
{"ControlPanel", NULL, 0, "SSU", MACRO_ControlPanel}, {"ControlPanel", NULL, 0, "SSU", (FARPROC)MACRO_ControlPanel},
{"CopyDialog", NULL, 0, "", MACRO_CopyDialog}, {"CopyDialog", NULL, 0, "", (FARPROC)MACRO_CopyDialog},
{"CopyTopic", "CT", 0, "", MACRO_CopyTopic}, {"CopyTopic", "CT", 0, "", (FARPROC)MACRO_CopyTopic},
{"CreateButton", "CB", 0, "SSS", MACRO_CreateButton}, {"CreateButton", "CB", 0, "SSS", (FARPROC)MACRO_CreateButton},
{"DeleteItem", NULL, 0, "S", MACRO_DeleteItem}, {"DeleteItem", NULL, 0, "S", (FARPROC)MACRO_DeleteItem},
{"DeleteMark", NULL, 0, "S", MACRO_DeleteMark}, {"DeleteMark", NULL, 0, "S", (FARPROC)MACRO_DeleteMark},
{"DestroyButton", NULL, 0, "S", MACRO_DestroyButton}, {"DestroyButton", NULL, 0, "S", (FARPROC)MACRO_DestroyButton},
{"DisableButton", "DB", 0, "S", MACRO_DisableButton}, {"DisableButton", "DB", 0, "S", (FARPROC)MACRO_DisableButton},
{"DisableItem", "DI", 0, "S", MACRO_DisableItem}, {"DisableItem", "DI", 0, "S", (FARPROC)MACRO_DisableItem},
{"EnableButton", "EB", 0, "S", MACRO_EnableButton}, {"EnableButton", "EB", 0, "S", (FARPROC)MACRO_EnableButton},
{"EnableItem", "EI", 0, "S", MACRO_EnableItem}, {"EnableItem", "EI", 0, "S", (FARPROC)MACRO_EnableItem},
{"EndMPrint", NULL, 0, "", MACRO_EndMPrint}, {"EndMPrint", NULL, 0, "", (FARPROC)MACRO_EndMPrint},
{"ExecFile", "EF", 0, "SSUS", MACRO_ExecFile}, {"ExecFile", "EF", 0, "SSUS", (FARPROC)MACRO_ExecFile},
{"ExecProgram", "EP", 0, "SU", MACRO_ExecProgram}, {"ExecProgram", "EP", 0, "SU", (FARPROC)MACRO_ExecProgram},
{"Exit", NULL, 0, "", MACRO_Exit}, {"Exit", NULL, 0, "", (FARPROC)MACRO_Exit},
{"ExtAbleItem", NULL, 0, "SU", MACRO_ExtAbleItem}, {"ExtAbleItem", NULL, 0, "SU", (FARPROC)MACRO_ExtAbleItem},
{"ExtInsertItem", NULL, 0, "SSSSUU", MACRO_ExtInsertItem}, {"ExtInsertItem", NULL, 0, "SSSSUU", (FARPROC)MACRO_ExtInsertItem},
{"ExtInsertMenu", NULL, 0, "SSSUU", MACRO_ExtInsertMenu}, {"ExtInsertMenu", NULL, 0, "SSSUU", (FARPROC)MACRO_ExtInsertMenu},
{"FileExist", "FE", 1, "S", (void (*)())MACRO_FileExist}, {"FileExist", "FE", 1, "S", (FARPROC)MACRO_FileExist},
{"FileOpen", "FO", 0, "", MACRO_FileOpen}, {"FileOpen", "FO", 0, "", (FARPROC)MACRO_FileOpen},
{"Find", NULL, 0, "", MACRO_Find}, {"Find", NULL, 0, "", (FARPROC)MACRO_Find},
{"Finder", "FD", 0, "", MACRO_Finder}, {"Finder", "FD", 0, "", (FARPROC)MACRO_Finder},
{"FloatingMenu", NULL, 0, "", MACRO_FloatingMenu}, {"FloatingMenu", NULL, 0, "", (FARPROC)MACRO_FloatingMenu},
{"Flush", "FH", 0, "", MACRO_Flush}, {"Flush", "FH", 0, "", (FARPROC)MACRO_Flush},
{"FocusWindow", NULL, 0, "S", MACRO_FocusWindow}, {"FocusWindow", NULL, 0, "S", (FARPROC)MACRO_FocusWindow},
{"Generate", NULL, 0, "SUU", MACRO_Generate}, {"Generate", NULL, 0, "SUU", (FARPROC)MACRO_Generate},
{"GotoMark", NULL, 0, "S", MACRO_GotoMark}, {"GotoMark", NULL, 0, "S", (FARPROC)MACRO_GotoMark},
{"HelpOn", NULL, 0, "", MACRO_HelpOn}, {"HelpOn", NULL, 0, "", (FARPROC)MACRO_HelpOn},
{"HelpOnTop", NULL, 0, "", MACRO_HelpOnTop}, {"HelpOnTop", NULL, 0, "", (FARPROC)MACRO_HelpOnTop},
{"History", NULL, 0, "", MACRO_History}, {"History", NULL, 0, "", (FARPROC)MACRO_History},
{"InitMPrint", NULL, 1, "", (void (*)())MACRO_InitMPrint}, {"InitMPrint", NULL, 1, "", (FARPROC)MACRO_InitMPrint},
{"InsertItem", NULL, 0, "SSSSU", MACRO_InsertItem}, {"InsertItem", NULL, 0, "SSSSU", (FARPROC)MACRO_InsertItem},
{"InsertMenu", NULL, 0, "SSU", MACRO_InsertMenu}, {"InsertMenu", NULL, 0, "SSU", (FARPROC)MACRO_InsertMenu},
{"IfThen", "IF", 0, "BS", MACRO_IfThen}, {"IfThen", "IF", 0, "BS", (FARPROC)MACRO_IfThen},
{"IfThenElse", "IE", 0, "BSS", MACRO_IfThenElse}, {"IfThenElse", "IE", 0, "BSS", (FARPROC)MACRO_IfThenElse},
{"IsBook", NULL, 1, "", (void (*)())MACRO_IsBook}, {"IsBook", NULL, 1, "", (FARPROC)MACRO_IsBook},
{"IsMark", NULL, 1, "S", (void (*)())MACRO_IsMark}, {"IsMark", NULL, 1, "S", (FARPROC)MACRO_IsMark},
{"IsNotMark", "NM", 1, "S", (void (*)())MACRO_IsNotMark}, {"IsNotMark", "NM", 1, "S", (FARPROC)MACRO_IsNotMark},
{"JumpContents", NULL, 0, "SS", MACRO_JumpContents}, {"JumpContents", NULL, 0, "SS", (FARPROC)MACRO_JumpContents},
{"JumpContext", "JC", 0, "SSU", MACRO_JumpContext}, {"JumpContext", "JC", 0, "SSU", (FARPROC)MACRO_JumpContext},
{"JumpHash", "JH", 0, "SSU", MACRO_JumpHash}, {"JumpHash", "JH", 0, "SSU", (FARPROC)MACRO_JumpHash},
{"JumpHelpOn", NULL, 0, "", MACRO_JumpHelpOn}, {"JumpHelpOn", NULL, 0, "", (FARPROC)MACRO_JumpHelpOn},
{"JumpID", "JI", 0, "SSS", MACRO_JumpID}, {"JumpID", "JI", 0, "SSS", (FARPROC)MACRO_JumpID},
{"JumpKeyword", "JK", 0, "SSS", MACRO_JumpKeyword}, {"JumpKeyword", "JK", 0, "SSS", (FARPROC)MACRO_JumpKeyword},
{"KLink", "KL", 0, "SUSS", MACRO_KLink}, {"KLink", "KL", 0, "SUSS", (FARPROC)MACRO_KLink},
{"Menu", "MU", 0, "", MACRO_Menu}, {"Menu", "MU", 0, "", (FARPROC)MACRO_Menu},
{"MPrintHash", NULL, 0, "U", MACRO_MPrintHash}, {"MPrintHash", NULL, 0, "U", (FARPROC)MACRO_MPrintHash},
{"MPrintID", NULL, 0, "S", MACRO_MPrintID}, {"MPrintID", NULL, 0, "S", (FARPROC)MACRO_MPrintID},
{"Next", NULL, 0, "", MACRO_Next}, {"Next", NULL, 0, "", (FARPROC)MACRO_Next},
{"NoShow", NULL, 0, "", MACRO_NoShow}, {"NoShow", NULL, 0, "", (FARPROC)MACRO_NoShow},
{"PopupContext", "PC", 0, "SU", MACRO_PopupContext}, {"PopupContext", "PC", 0, "SU", (FARPROC)MACRO_PopupContext},
{"PopupHash", NULL, 0, "SU", MACRO_PopupHash}, {"PopupHash", NULL, 0, "SU", (FARPROC)MACRO_PopupHash},
{"PopupId", "PI", 0, "SS", MACRO_PopupId}, {"PopupId", "PI", 0, "SS", (FARPROC)MACRO_PopupId},
{"PositionWindow", "PW", 0, "IIUUUS", MACRO_PositionWindow}, {"PositionWindow", "PW", 0, "IIUUUS", (FARPROC)MACRO_PositionWindow},
{"Prev", NULL, 0, "", MACRO_Prev}, {"Prev", NULL, 0, "", (FARPROC)MACRO_Prev},
{"Print", NULL, 0, "", MACRO_Print}, {"Print", NULL, 0, "", (FARPROC)MACRO_Print},
{"PrinterSetup", NULL, 0, "", MACRO_PrinterSetup}, {"PrinterSetup", NULL, 0, "", (FARPROC)MACRO_PrinterSetup},
{"RegisterRoutine", "RR", 0, "SSS", MACRO_RegisterRoutine}, {"RegisterRoutine", "RR", 0, "SSS", (FARPROC)MACRO_RegisterRoutine},
{"RemoveAccelerator", "RA", 0, "UU", MACRO_RemoveAccelerator}, {"RemoveAccelerator", "RA", 0, "UU", (FARPROC)MACRO_RemoveAccelerator},
{"ResetMenu", NULL, 0, "", MACRO_ResetMenu}, {"ResetMenu", NULL, 0, "", (FARPROC)MACRO_ResetMenu},
{"SaveMark", NULL, 0, "S", MACRO_SaveMark}, {"SaveMark", NULL, 0, "S", (FARPROC)MACRO_SaveMark},
{"Search", NULL, 0, "", MACRO_Search}, {"Search", NULL, 0, "", (FARPROC)MACRO_Search},
{"SetContents", NULL, 0, "SU", MACRO_SetContents}, {"SetContents", NULL, 0, "SU", (FARPROC)MACRO_SetContents},
{"SetHelpOnFile", NULL, 0, "S", MACRO_SetHelpOnFile}, {"SetHelpOnFile", NULL, 0, "S", (FARPROC)MACRO_SetHelpOnFile},
{"SetPopupColor", "SPC",0, "UUU", MACRO_SetPopupColor}, {"SetPopupColor", "SPC",0, "UUU", (FARPROC)MACRO_SetPopupColor},
{"ShellExecute", "SE", 0, "SSUUSS", MACRO_ShellExecute}, {"ShellExecute", "SE", 0, "SSUUSS", (FARPROC)MACRO_ShellExecute},
{"ShortCut", "SH", 0, "SSUUS", MACRO_ShortCut}, {"ShortCut", "SH", 0, "SSUUS", (FARPROC)MACRO_ShortCut},
{"TCard", NULL, 0, "U", MACRO_TCard}, {"TCard", NULL, 0, "U", (FARPROC)MACRO_TCard},
{"Test", NULL, 0, "U", MACRO_Test}, {"Test", NULL, 0, "U", (FARPROC)MACRO_Test},
{"TestALink", NULL, 1, "S", (void (*)())MACRO_TestALink}, {"TestALink", NULL, 1, "S", (FARPROC)MACRO_TestALink},
{"TestKLink", NULL, 1, "S", (void (*)())MACRO_TestKLink}, {"TestKLink", NULL, 1, "S", (FARPROC)MACRO_TestKLink},
{"UncheckItem", "UI", 0, "S", MACRO_UncheckItem}, {"UncheckItem", "UI", 0, "S", (FARPROC)MACRO_UncheckItem},
{"UpdateWindow", "UW", 0, "SS", MACRO_UpdateWindow}, {"UpdateWindow", "UW", 0, "SS", (FARPROC)MACRO_UpdateWindow},
{NULL, NULL, 0, NULL, NULL} {NULL, NULL, 0, NULL, NULL}
}; };
...@@ -154,16 +154,8 @@ static int MACRO_DoLookUp(struct MacroDesc* start, const char* name, struct lexr ...@@ -154,16 +154,8 @@ static int MACRO_DoLookUp(struct MacroDesc* start, const char* name, struct lexr
if (strcasecmp(md->name, name) == 0 || (md->alias != NULL && strcasecmp(md->alias, name) == 0)) if (strcasecmp(md->name, name) == 0 || (md->alias != NULL && strcasecmp(md->alias, name) == 0))
{ {
lr->proto = md->arguments; lr->proto = md->arguments;
if (md->isBool) lr->function = md->fn;
{ return md->isBool ? BOOL_FUNCTION : VOID_FUNCTION;
lr->bool_function = (BOOL (*)())md->fn;
return BOOL_FUNCTION;
}
else
{
lr->void_function = md->fn;
return VOID_FUNCTION;
}
} }
} }
return EMPTY; return EMPTY;
...@@ -184,7 +176,7 @@ int MACRO_Lookup(const char* name, struct lexret* lr) ...@@ -184,7 +176,7 @@ int MACRO_Lookup(const char* name, struct lexret* lr)
/******* helper functions *******/ /******* helper functions *******/
WINHELP_BUTTON** MACRO_LookupButton(WINHELP_WINDOW* win, LPCSTR name) static WINHELP_BUTTON** MACRO_LookupButton(WINHELP_WINDOW* win, LPCSTR name)
{ {
WINHELP_BUTTON** b; WINHELP_BUTTON** b;
...@@ -195,32 +187,32 @@ WINHELP_BUTTON** MACRO_LookupButton(WINHELP_WINDOW* win, LPCSTR name) ...@@ -195,32 +187,32 @@ WINHELP_BUTTON** MACRO_LookupButton(WINHELP_WINDOW* win, LPCSTR name)
/******* real macro implementation *******/ /******* real macro implementation *******/
void MACRO_About(void) void CALLBACK MACRO_About(void)
{ {
WINE_FIXME("()\n"); WINE_FIXME("()\n");
} }
void MACRO_AddAccelerator(LONG u1, LONG u2, LPCSTR str) void CALLBACK MACRO_AddAccelerator(LONG u1, LONG u2, LPCSTR str)
{ {
WINE_FIXME("(%lu, %lu, \"%s\")\n", u1, u2, str); WINE_FIXME("(%lu, %lu, \"%s\")\n", u1, u2, str);
} }
void MACRO_ALink(LPCSTR str1, LONG u, LPCSTR str2) void CALLBACK MACRO_ALink(LPCSTR str1, LONG u, LPCSTR str2)
{ {
WINE_FIXME("(\"%s\", %lu, \"%s\")\n", str1, u, str2); WINE_FIXME("(\"%s\", %lu, \"%s\")\n", str1, u, str2);
} }
void MACRO_Annotate(void) void CALLBACK MACRO_Annotate(void)
{ {
WINE_FIXME("()\n"); WINE_FIXME("()\n");
} }
void MACRO_AppendItem(LPCSTR str1, LPCSTR str2, LPCSTR str3, LPCSTR str4) void CALLBACK MACRO_AppendItem(LPCSTR str1, LPCSTR str2, LPCSTR str3, LPCSTR str4)
{ {
WINE_FIXME("(\"%s\", \"%s\", \"%s\", \"%s\")\n", str1, str2, str3, str4); WINE_FIXME("(\"%s\", \"%s\", \"%s\", \"%s\")\n", str1, str2, str3, str4);
} }
void MACRO_Back(void) void CALLBACK MACRO_Back(void)
{ {
WINHELP_WINDOW* win = Globals.active_win; WINHELP_WINDOW* win = Globals.active_win;
...@@ -231,7 +223,7 @@ void MACRO_Back(void) ...@@ -231,7 +223,7 @@ void MACRO_Back(void)
win->info, SW_SHOW); win->info, SW_SHOW);
} }
void MACRO_BackFlush(void) void CALLBACK MACRO_BackFlush(void)
{ {
WINHELP_WINDOW* win = Globals.active_win; WINHELP_WINDOW* win = Globals.active_win;
...@@ -250,17 +242,17 @@ void MACRO_BackFlush(void) ...@@ -250,17 +242,17 @@ void MACRO_BackFlush(void)
} }
} }
void MACRO_BookmarkDefine(void) void CALLBACK MACRO_BookmarkDefine(void)
{ {
WINE_FIXME("()\n"); WINE_FIXME("()\n");
} }
void MACRO_BookmarkMore(void) void CALLBACK MACRO_BookmarkMore(void)
{ {
WINE_FIXME("()\n"); WINE_FIXME("()\n");
} }
void MACRO_BrowseButtons(void) void CALLBACK MACRO_BrowseButtons(void)
{ {
WINE_TRACE("()\n"); WINE_TRACE("()\n");
...@@ -268,7 +260,7 @@ void MACRO_BrowseButtons(void) ...@@ -268,7 +260,7 @@ void MACRO_BrowseButtons(void)
MACRO_CreateButton("BTN_NEXT", "&>>", "Next()"); MACRO_CreateButton("BTN_NEXT", "&>>", "Next()");
} }
void MACRO_ChangeButtonBinding(LPCSTR id, LPCSTR macro) void CALLBACK MACRO_ChangeButtonBinding(LPCSTR id, LPCSTR macro)
{ {
WINHELP_WINDOW* win = Globals.active_win; WINHELP_WINDOW* win = Globals.active_win;
WINHELP_BUTTON* button; WINHELP_BUTTON* button;
...@@ -293,15 +285,15 @@ void MACRO_ChangeButtonBinding(LPCSTR id, LPCSTR macro) ...@@ -293,15 +285,15 @@ void MACRO_ChangeButtonBinding(LPCSTR id, LPCSTR macro)
ptr = (char*)button + sizeof(WINHELP_BUTTON); ptr = (char*)button + sizeof(WINHELP_BUTTON);
lstrcpy(ptr, (LPSTR) id); lstrcpy(ptr, id);
button->lpszID = ptr; button->lpszID = ptr;
ptr += lstrlen(id) + 1; ptr += lstrlen(id) + 1;
lstrcpy(ptr, (LPSTR) (*b)->lpszName); lstrcpy(ptr, (*b)->lpszName);
button->lpszName = ptr; button->lpszName = ptr;
ptr += lstrlen((*b)->lpszName) + 1; ptr += lstrlen((*b)->lpszName) + 1;
lstrcpy(ptr, (LPSTR) macro); lstrcpy(ptr, macro);
button->lpszMacro = ptr; button->lpszMacro = ptr;
*b = button; *b = button;
...@@ -309,7 +301,7 @@ void MACRO_ChangeButtonBinding(LPCSTR id, LPCSTR macro) ...@@ -309,7 +301,7 @@ void MACRO_ChangeButtonBinding(LPCSTR id, LPCSTR macro)
SendMessage(win->hMainWnd, WM_USER, 0, 0); SendMessage(win->hMainWnd, WM_USER, 0, 0);
} }
void MACRO_ChangeEnable(LPCSTR id, LPCSTR macro) void CALLBACK MACRO_ChangeEnable(LPCSTR id, LPCSTR macro)
{ {
WINE_TRACE("(\"%s\", \"%s\")\n", id, macro); WINE_TRACE("(\"%s\", \"%s\")\n", id, macro);
...@@ -317,17 +309,17 @@ void MACRO_ChangeEnable(LPCSTR id, LPCSTR macro) ...@@ -317,17 +309,17 @@ void MACRO_ChangeEnable(LPCSTR id, LPCSTR macro)
MACRO_EnableButton(id); MACRO_EnableButton(id);
} }
void MACRO_ChangeItemBinding(LPCSTR str1, LPCSTR str2) void CALLBACK MACRO_ChangeItemBinding(LPCSTR str1, LPCSTR str2)
{ {
WINE_FIXME("(\"%s\", \"%s\")\n", str1, str2); WINE_FIXME("(\"%s\", \"%s\")\n", str1, str2);
} }
void MACRO_CheckItem(LPCSTR str) void CALLBACK MACRO_CheckItem(LPCSTR str)
{ {
WINE_FIXME("(\"%s\")\n", str); WINE_FIXME("(\"%s\")\n", str);
} }
void MACRO_CloseSecondarys(void) void CALLBACK MACRO_CloseSecondarys(void)
{ {
WINHELP_WINDOW *win; WINHELP_WINDOW *win;
...@@ -337,7 +329,7 @@ void MACRO_CloseSecondarys(void) ...@@ -337,7 +329,7 @@ void MACRO_CloseSecondarys(void)
DestroyWindow(win->hMainWnd); DestroyWindow(win->hMainWnd);
} }
void MACRO_CloseWindow(LPCSTR lpszWindow) void CALLBACK MACRO_CloseWindow(LPCSTR lpszWindow)
{ {
WINHELP_WINDOW *win; WINHELP_WINDOW *win;
...@@ -350,12 +342,12 @@ void MACRO_CloseWindow(LPCSTR lpszWindow) ...@@ -350,12 +342,12 @@ void MACRO_CloseWindow(LPCSTR lpszWindow)
DestroyWindow(win->hMainWnd); DestroyWindow(win->hMainWnd);
} }
void MACRO_Compare(LPCSTR str) void CALLBACK MACRO_Compare(LPCSTR str)
{ {
WINE_FIXME("(\"%s\")\n", str); WINE_FIXME("(\"%s\")\n", str);
} }
void MACRO_Contents(void) void CALLBACK MACRO_Contents(void)
{ {
WINE_TRACE("()\n"); WINE_TRACE("()\n");
...@@ -363,22 +355,22 @@ void MACRO_Contents(void) ...@@ -363,22 +355,22 @@ void MACRO_Contents(void)
MACRO_JumpContents(Globals.active_win->page->file->lpszPath, NULL); MACRO_JumpContents(Globals.active_win->page->file->lpszPath, NULL);
} }
void MACRO_ControlPanel(LPCSTR str1, LPCSTR str2, LONG u) void CALLBACK MACRO_ControlPanel(LPCSTR str1, LPCSTR str2, LONG u)
{ {
WINE_FIXME("(\"%s\", \"%s\", %lu)\n", str1, str2, u); WINE_FIXME("(\"%s\", \"%s\", %lu)\n", str1, str2, u);
} }
void MACRO_CopyDialog(void) void CALLBACK MACRO_CopyDialog(void)
{ {
WINE_FIXME("()\n"); WINE_FIXME("()\n");
} }
void MACRO_CopyTopic(void) void CALLBACK MACRO_CopyTopic(void)
{ {
WINE_FIXME("()\n"); WINE_FIXME("()\n");
} }
void MACRO_CreateButton(LPCSTR id, LPCSTR name, LPCSTR macro) void CALLBACK MACRO_CreateButton(LPCSTR id, LPCSTR name, LPCSTR macro)
{ {
WINHELP_WINDOW *win = Globals.active_win; WINHELP_WINDOW *win = Globals.active_win;
WINHELP_BUTTON *button, **b; WINHELP_BUTTON *button, **b;
...@@ -397,15 +389,15 @@ void MACRO_CreateButton(LPCSTR id, LPCSTR name, LPCSTR macro) ...@@ -397,15 +389,15 @@ void MACRO_CreateButton(LPCSTR id, LPCSTR name, LPCSTR macro)
ptr = (char*)button + sizeof(WINHELP_BUTTON); ptr = (char*)button + sizeof(WINHELP_BUTTON);
lstrcpy(ptr, (LPSTR) id); lstrcpy(ptr, id);
button->lpszID = ptr; button->lpszID = ptr;
ptr += lstrlen(id) + 1; ptr += lstrlen(id) + 1;
lstrcpy(ptr, (LPSTR) name); lstrcpy(ptr, name);
button->lpszName = ptr; button->lpszName = ptr;
ptr += lstrlen(name) + 1; ptr += lstrlen(name) + 1;
lstrcpy(ptr, (LPSTR) macro); lstrcpy(ptr, macro);
button->lpszMacro = ptr; button->lpszMacro = ptr;
button->wParam = WH_FIRST_BUTTON; button->wParam = WH_FIRST_BUTTON;
...@@ -416,22 +408,22 @@ void MACRO_CreateButton(LPCSTR id, LPCSTR name, LPCSTR macro) ...@@ -416,22 +408,22 @@ void MACRO_CreateButton(LPCSTR id, LPCSTR name, LPCSTR macro)
SendMessage(win->hMainWnd, WM_USER, 0, 0); SendMessage(win->hMainWnd, WM_USER, 0, 0);
} }
void MACRO_DeleteItem(LPCSTR str) void CALLBACK MACRO_DeleteItem(LPCSTR str)
{ {
WINE_FIXME("(\"%s\")\n", str); WINE_FIXME("(\"%s\")\n", str);
} }
void MACRO_DeleteMark(LPCSTR str) void CALLBACK MACRO_DeleteMark(LPCSTR str)
{ {
WINE_FIXME("(\"%s\")\n", str); WINE_FIXME("(\"%s\")\n", str);
} }
void MACRO_DestroyButton(LPCSTR str) void CALLBACK MACRO_DestroyButton(LPCSTR str)
{ {
WINE_FIXME("(\"%s\")\n", str); WINE_FIXME("(\"%s\")\n", str);
} }
void MACRO_DisableButton(LPCSTR id) void CALLBACK MACRO_DisableButton(LPCSTR id)
{ {
WINHELP_BUTTON** b; WINHELP_BUTTON** b;
...@@ -443,12 +435,12 @@ void MACRO_DisableButton(LPCSTR id) ...@@ -443,12 +435,12 @@ void MACRO_DisableButton(LPCSTR id)
EnableWindow((*b)->hWnd, FALSE); EnableWindow((*b)->hWnd, FALSE);
} }
void MACRO_DisableItem(LPCSTR str) void CALLBACK MACRO_DisableItem(LPCSTR str)
{ {
WINE_FIXME("(\"%s\")\n", str); WINE_FIXME("(\"%s\")\n", str);
} }
void MACRO_EnableButton(LPCSTR id) void CALLBACK MACRO_EnableButton(LPCSTR id)
{ {
WINHELP_BUTTON** b; WINHELP_BUTTON** b;
...@@ -460,27 +452,27 @@ void MACRO_EnableButton(LPCSTR id) ...@@ -460,27 +452,27 @@ void MACRO_EnableButton(LPCSTR id)
EnableWindow((*b)->hWnd, TRUE); EnableWindow((*b)->hWnd, TRUE);
} }
void MACRO_EnableItem(LPCSTR str) void CALLBACK MACRO_EnableItem(LPCSTR str)
{ {
WINE_FIXME("(\"%s\")\n", str); WINE_FIXME("(\"%s\")\n", str);
} }
void MACRO_EndMPrint(void) void CALLBACK MACRO_EndMPrint(void)
{ {
WINE_FIXME("()\n"); WINE_FIXME("()\n");
} }
void MACRO_ExecFile(LPCSTR str1, LPCSTR str2, LONG u, LPCSTR str3) void CALLBACK MACRO_ExecFile(LPCSTR str1, LPCSTR str2, LONG u, LPCSTR str3)
{ {
WINE_FIXME("(\"%s\", \"%s\", %lu, \"%s\")\n", str1, str2, u, str3); WINE_FIXME("(\"%s\", \"%s\", %lu, \"%s\")\n", str1, str2, u, str3);
} }
void MACRO_ExecProgram(LPCSTR str, LONG u) void CALLBACK MACRO_ExecProgram(LPCSTR str, LONG u)
{ {
WINE_FIXME("(\"%s\", %lu)\n", str, u); WINE_FIXME("(\"%s\", %lu)\n", str, u);
} }
void MACRO_Exit(void) void CALLBACK MACRO_Exit(void)
{ {
WINE_TRACE("()\n"); WINE_TRACE("()\n");
...@@ -488,28 +480,28 @@ void MACRO_Exit(void) ...@@ -488,28 +480,28 @@ void MACRO_Exit(void)
DestroyWindow(Globals.win_list->hMainWnd); DestroyWindow(Globals.win_list->hMainWnd);
} }
void MACRO_ExtAbleItem(LPCSTR str, LONG u) void CALLBACK MACRO_ExtAbleItem(LPCSTR str, LONG u)
{ {
WINE_FIXME("(\"%s\", %lu)\n", str, u); WINE_FIXME("(\"%s\", %lu)\n", str, u);
} }
void MACRO_ExtInsertItem(LPCSTR str1, LPCSTR str2, LPCSTR str3, LPCSTR str4, LONG u1, LONG u2) void CALLBACK MACRO_ExtInsertItem(LPCSTR str1, LPCSTR str2, LPCSTR str3, LPCSTR str4, LONG u1, LONG u2)
{ {
WINE_FIXME("(\"%s\", \"%s\", \"%s\", \"%s\", %lu, %lu)\n", str1, str2, str3, str4, u1, u2); WINE_FIXME("(\"%s\", \"%s\", \"%s\", \"%s\", %lu, %lu)\n", str1, str2, str3, str4, u1, u2);
} }
void MACRO_ExtInsertMenu(LPCSTR str1, LPCSTR str2, LPCSTR str3, LONG u1, LONG u2) void CALLBACK MACRO_ExtInsertMenu(LPCSTR str1, LPCSTR str2, LPCSTR str3, LONG u1, LONG u2)
{ {
WINE_FIXME("(\"%s\", \"%s\", \"%s\", %lu, %lu)\n", str1, str2, str3, u1, u2); WINE_FIXME("(\"%s\", \"%s\", \"%s\", %lu, %lu)\n", str1, str2, str3, u1, u2);
} }
BOOL MACRO_FileExist(LPCSTR str) BOOL CALLBACK MACRO_FileExist(LPCSTR str)
{ {
WINE_TRACE("(\"%s\")\n", str); WINE_TRACE("(\"%s\")\n", str);
return GetFileAttributes(str) != INVALID_FILE_ATTRIBUTES; return GetFileAttributes(str) != INVALID_FILE_ATTRIBUTES;
} }
void MACRO_FileOpen(void) void CALLBACK MACRO_FileOpen(void)
{ {
OPENFILENAME openfilename; OPENFILENAME openfilename;
CHAR szPath[MAX_PATHNAME_LEN]; CHAR szPath[MAX_PATHNAME_LEN];
...@@ -563,27 +555,27 @@ void MACRO_FileOpen(void) ...@@ -563,27 +555,27 @@ void MACRO_FileOpen(void)
} }
} }
void MACRO_Find(void) void CALLBACK MACRO_Find(void)
{ {
WINE_FIXME("()\n"); WINE_FIXME("()\n");
} }
void MACRO_Finder(void) void CALLBACK MACRO_Finder(void)
{ {
WINE_FIXME("()\n"); WINE_FIXME("()\n");
} }
void MACRO_FloatingMenu(void) void CALLBACK MACRO_FloatingMenu(void)
{ {
WINE_FIXME("()\n"); WINE_FIXME("()\n");
} }
void MACRO_Flush(void) void CALLBACK MACRO_Flush(void)
{ {
WINE_FIXME("()\n"); WINE_FIXME("()\n");
} }
void MACRO_FocusWindow(LPCSTR lpszWindow) void CALLBACK MACRO_FocusWindow(LPCSTR lpszWindow)
{ {
WINHELP_WINDOW *win; WINHELP_WINDOW *win;
...@@ -596,28 +588,28 @@ void MACRO_FocusWindow(LPCSTR lpszWindow) ...@@ -596,28 +588,28 @@ void MACRO_FocusWindow(LPCSTR lpszWindow)
SetFocus(win->hMainWnd); SetFocus(win->hMainWnd);
} }
void MACRO_Generate(LPCSTR str, LONG w, LONG l) void CALLBACK MACRO_Generate(LPCSTR str, LONG w, LONG l)
{ {
WINE_FIXME("(\"%s\", %lx, %lx)\n", str, w, l); WINE_FIXME("(\"%s\", %lx, %lx)\n", str, w, l);
} }
void MACRO_GotoMark(LPCSTR str) void CALLBACK MACRO_GotoMark(LPCSTR str)
{ {
WINE_FIXME("(\"%s\")\n", str); WINE_FIXME("(\"%s\")\n", str);
} }
void MACRO_HelpOn(void) void CALLBACK MACRO_HelpOn(void)
{ {
WINE_TRACE("()\n"); WINE_TRACE("()\n");
MACRO_JumpContents((Globals.wVersion > 4) ? "winhelp32.hlp" : "winhelp.hlp", NULL); MACRO_JumpContents((Globals.wVersion > 4) ? "winhelp32.hlp" : "winhelp.hlp", NULL);
} }
void MACRO_HelpOnTop(void) void CALLBACK MACRO_HelpOnTop(void)
{ {
WINE_FIXME("()\n"); WINE_FIXME("()\n");
} }
void MACRO_History(void) void CALLBACK MACRO_History(void)
{ {
WINE_TRACE("()\n"); WINE_TRACE("()\n");
...@@ -629,51 +621,51 @@ void MACRO_History(void) ...@@ -629,51 +621,51 @@ void MACRO_History(void)
} }
} }
void MACRO_IfThen(BOOL b, LPCSTR t) void CALLBACK MACRO_IfThen(BOOL b, LPCSTR t)
{ {
if (b) MACRO_ExecuteMacro(t); if (b) MACRO_ExecuteMacro(t);
} }
void MACRO_IfThenElse(BOOL b, LPCSTR t, LPCSTR f) void CALLBACK MACRO_IfThenElse(BOOL b, LPCSTR t, LPCSTR f)
{ {
if (b) MACRO_ExecuteMacro(t); else MACRO_ExecuteMacro(f); if (b) MACRO_ExecuteMacro(t); else MACRO_ExecuteMacro(f);
} }
BOOL MACRO_InitMPrint(void) BOOL CALLBACK MACRO_InitMPrint(void)
{ {
WINE_FIXME("()\n"); WINE_FIXME("()\n");
return FALSE; return FALSE;
} }
void MACRO_InsertItem(LPCSTR str1, LPCSTR str2, LPCSTR str3, LPCSTR str4, LONG u) void CALLBACK MACRO_InsertItem(LPCSTR str1, LPCSTR str2, LPCSTR str3, LPCSTR str4, LONG u)
{ {
WINE_FIXME("(\"%s\", \"%s\", \"%s\", \"%s\", %lu)\n", str1, str2, str3, str4, u); WINE_FIXME("(\"%s\", \"%s\", \"%s\", \"%s\", %lu)\n", str1, str2, str3, str4, u);
} }
void MACRO_InsertMenu(LPCSTR str1, LPCSTR str2, LONG u) void CALLBACK MACRO_InsertMenu(LPCSTR str1, LPCSTR str2, LONG u)
{ {
WINE_FIXME("(\"%s\", \"%s\", %lu)\n", str1, str2, u); WINE_FIXME("(\"%s\", \"%s\", %lu)\n", str1, str2, u);
} }
BOOL MACRO_IsBook(void) BOOL CALLBACK MACRO_IsBook(void)
{ {
WINE_TRACE("()\n"); WINE_TRACE("()\n");
return Globals.isBook; return Globals.isBook;
} }
BOOL MACRO_IsMark(LPCSTR str) BOOL CALLBACK MACRO_IsMark(LPCSTR str)
{ {
WINE_FIXME("(\"%s\")\n", str); WINE_FIXME("(\"%s\")\n", str);
return FALSE; return FALSE;
} }
BOOL MACRO_IsNotMark(LPCSTR str) BOOL CALLBACK MACRO_IsNotMark(LPCSTR str)
{ {
WINE_FIXME("(\"%s\")\n", str); WINE_FIXME("(\"%s\")\n", str);
return TRUE; return TRUE;
} }
void MACRO_JumpContents(LPCSTR lpszPath, LPCSTR lpszWindow) void CALLBACK MACRO_JumpContents(LPCSTR lpszPath, LPCSTR lpszWindow)
{ {
HLPFILE* hlpfile; HLPFILE* hlpfile;
...@@ -684,13 +676,13 @@ void MACRO_JumpContents(LPCSTR lpszPath, LPCSTR lpszWindow) ...@@ -684,13 +676,13 @@ void MACRO_JumpContents(LPCSTR lpszPath, LPCSTR lpszWindow)
SW_NORMAL); SW_NORMAL);
} }
void MACRO_JumpContext(LPCSTR lpszPath, LPCSTR lpszWindow, LONG context) void CALLBACK MACRO_JumpContext(LPCSTR lpszPath, LPCSTR lpszWindow, LONG context)
{ {
WINE_FIXME("(\"%s\", \"%s\", %ld)semi-stub\n", lpszPath, lpszWindow, context); WINE_FIXME("(\"%s\", \"%s\", %ld)semi-stub\n", lpszPath, lpszWindow, context);
return MACRO_JumpContents(lpszPath, lpszWindow); return MACRO_JumpContents(lpszPath, lpszWindow);
} }
void MACRO_JumpHash(LPCSTR lpszPath, LPCSTR lpszWindow, LONG lHash) void CALLBACK MACRO_JumpHash(LPCSTR lpszPath, LPCSTR lpszWindow, LONG lHash)
{ {
HLPFILE* hlpfile; HLPFILE* hlpfile;
...@@ -701,7 +693,7 @@ void MACRO_JumpHash(LPCSTR lpszPath, LPCSTR lpszWindow, LONG lHash) ...@@ -701,7 +693,7 @@ void MACRO_JumpHash(LPCSTR lpszPath, LPCSTR lpszWindow, LONG lHash)
SW_NORMAL); SW_NORMAL);
} }
void MACRO_JumpHelpOn(void) void CALLBACK MACRO_JumpHelpOn(void)
{ {
WINE_FIXME("()\n"); WINE_FIXME("()\n");
} }
...@@ -709,38 +701,38 @@ void MACRO_JumpHelpOn(void) ...@@ -709,38 +701,38 @@ void MACRO_JumpHelpOn(void)
/* FIXME: those two macros are wrong /* FIXME: those two macros are wrong
* they should only contain 2 strings, path & window are coded as path>window * they should only contain 2 strings, path & window are coded as path>window
*/ */
void MACRO_JumpID(LPCSTR lpszPath, LPCSTR lpszWindow, LPCSTR topic_id) void CALLBACK MACRO_JumpID(LPCSTR lpszPath, LPCSTR lpszWindow, LPCSTR topic_id)
{ {
WINE_TRACE("(\"%s\", \"%s\", \"%s\")\n", lpszPath, lpszWindow, topic_id); WINE_TRACE("(\"%s\", \"%s\", \"%s\")\n", lpszPath, lpszWindow, topic_id);
MACRO_JumpHash(lpszPath, lpszWindow, HLPFILE_Hash(topic_id)); MACRO_JumpHash(lpszPath, lpszWindow, HLPFILE_Hash(topic_id));
} }
void MACRO_JumpKeyword(LPCSTR lpszPath, LPCSTR lpszWindow, LPCSTR keyword) void CALLBACK MACRO_JumpKeyword(LPCSTR lpszPath, LPCSTR lpszWindow, LPCSTR keyword)
{ {
WINE_FIXME("(\"%s\", \"%s\", \"%s\")\n", lpszPath, lpszWindow, keyword); WINE_FIXME("(\"%s\", \"%s\", \"%s\")\n", lpszPath, lpszWindow, keyword);
} }
void MACRO_KLink(LPCSTR str1, LONG u, LPCSTR str2, LPCSTR str3) void CALLBACK MACRO_KLink(LPCSTR str1, LONG u, LPCSTR str2, LPCSTR str3)
{ {
WINE_FIXME("(\"%s\", %lu, \"%s\", \"%s\")\n", str1, u, str2, str3); WINE_FIXME("(\"%s\", %lu, \"%s\", \"%s\")\n", str1, u, str2, str3);
} }
void MACRO_Menu(void) void CALLBACK MACRO_Menu(void)
{ {
WINE_FIXME("()\n"); WINE_FIXME("()\n");
} }
void MACRO_MPrintHash(LONG u) void CALLBACK MACRO_MPrintHash(LONG u)
{ {
WINE_FIXME("(%lu)\n", u); WINE_FIXME("(%lu)\n", u);
} }
void MACRO_MPrintID(LPCSTR str) void CALLBACK MACRO_MPrintID(LPCSTR str)
{ {
WINE_FIXME("(\"%s\")\n", str); WINE_FIXME("(\"%s\")\n", str);
} }
void MACRO_Next(void) void CALLBACK MACRO_Next(void)
{ {
HLPFILE_PAGE* page; HLPFILE_PAGE* page;
...@@ -754,32 +746,32 @@ void MACRO_Next(void) ...@@ -754,32 +746,32 @@ void MACRO_Next(void)
} }
} }
void MACRO_NoShow(void) void CALLBACK MACRO_NoShow(void)
{ {
WINE_FIXME("()\n"); WINE_FIXME("()\n");
} }
void MACRO_PopupContext(LPCSTR str, LONG u) void CALLBACK MACRO_PopupContext(LPCSTR str, LONG u)
{ {
WINE_FIXME("(\"%s\", %lu)\n", str, u); WINE_FIXME("(\"%s\", %lu)\n", str, u);
} }
void MACRO_PopupHash(LPCSTR str, LONG u) void CALLBACK MACRO_PopupHash(LPCSTR str, LONG u)
{ {
WINE_FIXME("(\"%s\", %lu)\n", str, u); WINE_FIXME("(\"%s\", %lu)\n", str, u);
} }
void MACRO_PopupId(LPCSTR str1, LPCSTR str2) void CALLBACK MACRO_PopupId(LPCSTR str1, LPCSTR str2)
{ {
WINE_FIXME("(\"%s\", \"%s\")\n", str1, str2); WINE_FIXME("(\"%s\", \"%s\")\n", str1, str2);
} }
void MACRO_PositionWindow(LONG i1, LONG i2, LONG u1, LONG u2, LONG u3, LPCSTR str) void CALLBACK MACRO_PositionWindow(LONG i1, LONG i2, LONG u1, LONG u2, LONG u3, LPCSTR str)
{ {
WINE_FIXME("(%li, %li, %lu, %lu, %lu, \"%s\")\n", i1, i2, u1, u2, u3, str); WINE_FIXME("(%li, %li, %lu, %lu, %lu, \"%s\")\n", i1, i2, u1, u2, u3, str);
} }
void MACRO_Prev(void) void CALLBACK MACRO_Prev(void)
{ {
HLPFILE_PAGE* page; HLPFILE_PAGE* page;
...@@ -793,7 +785,7 @@ void MACRO_Prev(void) ...@@ -793,7 +785,7 @@ void MACRO_Prev(void)
} }
} }
void MACRO_Print(void) void CALLBACK MACRO_Print(void)
{ {
PRINTDLG printer; PRINTDLG printer;
...@@ -824,33 +816,62 @@ void MACRO_Print(void) ...@@ -824,33 +816,62 @@ void MACRO_Print(void)
} }
} }
void MACRO_PrinterSetup(void) void CALLBACK MACRO_PrinterSetup(void)
{ {
WINE_FIXME("()\n"); WINE_FIXME("()\n");
} }
void MACRO_RegisterRoutine(LPCSTR dll, LPCSTR proc, LPCSTR args) void CALLBACK MACRO_RegisterRoutine(LPCSTR dll_name, LPCSTR proc, LPCSTR args)
{ {
HANDLE hLib; FARPROC fn = NULL;
void (*fn)(); int size;
int size; WINHELP_DLL* dll;
WINE_TRACE("(\"%s\", \"%s\", \"%s\")\n", dll, proc, args); WINE_TRACE("(\"%s\", \"%s\", \"%s\")\n", dll_name, proc, args);
if ((hLib = LoadLibrary(dll)) == NULL) /* FIXME: are the registered DLLs global or linked to the current file ???
* We assume globals (as we did for macros, but is this really the case ???)
*/
for (dll = Globals.dlls; dll; dll = dll->next)
{ {
/* FIXME: internationalisation for error messages */ if (!strcmp(dll->name, dll_name)) break;
WINE_FIXME("Cannot find dll %s\n", dll); }
fn = NULL; if (!dll)
{
HANDLE hLib = LoadLibrary(dll_name);
/* FIXME: the library will not be unloaded until exit of program
* We don't send the DW_TERM message
*/
WINE_TRACE("Loading %s\n", dll_name);
/* FIXME: should look in the directory where current hlpfile
* is loaded from
*/
if (hLib == NULL)
{
/* FIXME: internationalisation for error messages */
WINE_FIXME("Cannot find dll %s\n", dll_name);
}
else if ((dll = HeapAlloc(GetProcessHeap(), 0, sizeof(*dll))))
{
dll->hLib = hLib;
dll->name = strdup(dll_name); /* FIXME */
dll->next = Globals.dlls;
Globals.dlls = dll;
dll->handler = (WINHELP_LDLLHandler)GetProcAddress(dll->hLib, "LDLLHandler");
dll->class = dll->handler ? (dll->handler)(DW_WHATMSG, 0, 0) : DC_NOMSG;
WINE_TRACE("Got class %lx for DLL %s\n", dll->class, dll_name);
if (dll->class & DC_INITTERM) dll->handler(DW_INIT, 0, 0);
if (dll->class & DC_CALLBACKS) dll->handler(DW_CALLBACKS, (DWORD)Callbacks, 0);
}
else WINE_WARN("OOM\n");
} }
else if (!(fn = (void (*)())GetProcAddress(hLib, proc))) if (dll && !(fn = GetProcAddress(dll->hLib, proc)))
{ {
/* FIXME: internationalisation for error messages */ /* FIXME: internationalisation for error messages */
WINE_FIXME("Cannot find proc %s in dll %s\n", dll, proc); WINE_FIXME("Cannot find proc %s in dll %s\n", dll_name, proc);
fn = NULL;
} }
/* FIXME: the library will not be unloaded until exit of program */
size = ++MACRO_NumLoaded * sizeof(struct MacroDesc); size = ++MACRO_NumLoaded * sizeof(struct MacroDesc);
if (!MACRO_Loaded) MACRO_Loaded = HeapAlloc(GetProcessHeap(), 0, size); if (!MACRO_Loaded) MACRO_Loaded = HeapAlloc(GetProcessHeap(), 0, size);
else MACRO_Loaded = HeapReAlloc(GetProcessHeap(), 0, MACRO_Loaded, size); else MACRO_Loaded = HeapReAlloc(GetProcessHeap(), 0, MACRO_Loaded, size);
...@@ -859,81 +880,82 @@ void MACRO_RegisterRoutine(LPCSTR dll, LPCSTR proc, LPCSTR args) ...@@ -859,81 +880,82 @@ void MACRO_RegisterRoutine(LPCSTR dll, LPCSTR proc, LPCSTR args)
MACRO_Loaded[MACRO_NumLoaded - 1].isBool = 0; MACRO_Loaded[MACRO_NumLoaded - 1].isBool = 0;
MACRO_Loaded[MACRO_NumLoaded - 1].arguments = strdup(args); /* FIXME */ MACRO_Loaded[MACRO_NumLoaded - 1].arguments = strdup(args); /* FIXME */
MACRO_Loaded[MACRO_NumLoaded - 1].fn = fn; MACRO_Loaded[MACRO_NumLoaded - 1].fn = fn;
WINE_TRACE("Added %s(%s) at %p\n", proc, args, fn);
} }
void MACRO_RemoveAccelerator(LONG u1, LONG u2) void CALLBACK MACRO_RemoveAccelerator(LONG u1, LONG u2)
{ {
WINE_FIXME("(%lu, %lu)\n", u1, u2); WINE_FIXME("(%lu, %lu)\n", u1, u2);
} }
void MACRO_ResetMenu(void) void CALLBACK MACRO_ResetMenu(void)
{ {
WINE_FIXME("()\n"); WINE_FIXME("()\n");
} }
void MACRO_SaveMark(LPCSTR str) void CALLBACK MACRO_SaveMark(LPCSTR str)
{ {
WINE_FIXME("(\"%s\")\n", str); WINE_FIXME("(\"%s\")\n", str);
} }
void MACRO_Search(void) void CALLBACK MACRO_Search(void)
{ {
WINE_FIXME("()\n"); WINE_FIXME("()\n");
} }
void MACRO_SetContents(LPCSTR str, LONG u) void CALLBACK MACRO_SetContents(LPCSTR str, LONG u)
{ {
WINE_FIXME("(\"%s\", %lu)\n", str, u); WINE_FIXME("(\"%s\", %lu)\n", str, u);
} }
void MACRO_SetHelpOnFile(LPCSTR str) void CALLBACK MACRO_SetHelpOnFile(LPCSTR str)
{ {
WINE_FIXME("(\"%s\")\n", str); WINE_FIXME("(\"%s\")\n", str);
} }
void MACRO_SetPopupColor(LONG u1, LONG u2, LONG u3) void CALLBACK MACRO_SetPopupColor(LONG u1, LONG u2, LONG u3)
{ {
WINE_FIXME("(%lu, %lu, %lu)\n", u1, u2, u3); WINE_FIXME("(%lu, %lu, %lu)\n", u1, u2, u3);
} }
void MACRO_ShellExecute(LPCSTR str1, LPCSTR str2, LONG u1, LONG u2, LPCSTR str3, LPCSTR str4) void CALLBACK MACRO_ShellExecute(LPCSTR str1, LPCSTR str2, LONG u1, LONG u2, LPCSTR str3, LPCSTR str4)
{ {
WINE_FIXME("(\"%s\", \"%s\", %lu, %lu, \"%s\", \"%s\")\n", str1, str2, u1, u2, str3, str4); WINE_FIXME("(\"%s\", \"%s\", %lu, %lu, \"%s\", \"%s\")\n", str1, str2, u1, u2, str3, str4);
} }
void MACRO_ShortCut(LPCSTR str1, LPCSTR str2, LONG w, LONG l, LPCSTR str) void CALLBACK MACRO_ShortCut(LPCSTR str1, LPCSTR str2, LONG w, LONG l, LPCSTR str)
{ {
WINE_FIXME("(\"%s\", \"%s\", %lx, %lx, \"%s\")\n", str1, str2, w, l, str); WINE_FIXME("(\"%s\", \"%s\", %lx, %lx, \"%s\")\n", str1, str2, w, l, str);
} }
void MACRO_TCard(LONG u) void CALLBACK MACRO_TCard(LONG u)
{ {
WINE_FIXME("(%lu)\n", u); WINE_FIXME("(%lu)\n", u);
} }
void MACRO_Test(LONG u) void CALLBACK MACRO_Test(LONG u)
{ {
WINE_FIXME("(%lu)\n", u); WINE_FIXME("(%lu)\n", u);
} }
BOOL MACRO_TestALink(LPCSTR str) BOOL CALLBACK MACRO_TestALink(LPCSTR str)
{ {
WINE_FIXME("(\"%s\")\n", str); WINE_FIXME("(\"%s\")\n", str);
return FALSE; return FALSE;
} }
BOOL MACRO_TestKLink(LPCSTR str) BOOL CALLBACK MACRO_TestKLink(LPCSTR str)
{ {
WINE_FIXME("(\"%s\")\n", str); WINE_FIXME("(\"%s\")\n", str);
return FALSE; return FALSE;
} }
void MACRO_UncheckItem(LPCSTR str) void CALLBACK MACRO_UncheckItem(LPCSTR str)
{ {
WINE_FIXME("(\"%s\")\n", str); WINE_FIXME("(\"%s\")\n", str);
} }
void MACRO_UpdateWindow(LPCSTR str1, LPCSTR str2) void CALLBACK MACRO_UpdateWindow(LPCSTR str1, LPCSTR str2)
{ {
WINE_FIXME("(\"%s\", \"%s\")\n", str1, str2); WINE_FIXME("(\"%s\", \"%s\")\n", str1, str2);
} }
...@@ -29,8 +29,7 @@ struct lexret { ...@@ -29,8 +29,7 @@ struct lexret {
BOOL bool; BOOL bool;
LONG integer; LONG integer;
LPCSTR string; LPCSTR string;
BOOL (*bool_function)(); FARPROC function;
void (*void_function)();
}; };
extern struct lexret yylval; extern struct lexret yylval;
...@@ -39,97 +38,97 @@ BOOL MACRO_ExecuteMacro(LPCSTR); ...@@ -39,97 +38,97 @@ BOOL MACRO_ExecuteMacro(LPCSTR);
int MACRO_Lookup(const char* name, struct lexret* lr); int MACRO_Lookup(const char* name, struct lexret* lr);
enum token_types {EMPTY, VOID_FUNCTION, BOOL_FUNCTION, INTEGER, STRING, IDENTIFIER}; enum token_types {EMPTY, VOID_FUNCTION, BOOL_FUNCTION, INTEGER, STRING, IDENTIFIER};
void MACRO_About(void); void CALLBACK MACRO_About(void);
void MACRO_AddAccelerator(LONG, LONG, LPCSTR); void CALLBACK MACRO_AddAccelerator(LONG, LONG, LPCSTR);
void MACRO_ALink(LPCSTR, LONG, LPCSTR); void CALLBACK MACRO_ALink(LPCSTR, LONG, LPCSTR);
void MACRO_Annotate(void); void CALLBACK MACRO_Annotate(void);
void MACRO_AppendItem(LPCSTR, LPCSTR, LPCSTR, LPCSTR); void CALLBACK MACRO_AppendItem(LPCSTR, LPCSTR, LPCSTR, LPCSTR);
void MACRO_Back(void); void CALLBACK MACRO_Back(void);
void MACRO_BackFlush(void); void CALLBACK MACRO_BackFlush(void);
void MACRO_BookmarkDefine(void); void CALLBACK MACRO_BookmarkDefine(void);
void MACRO_BookmarkMore(void); void CALLBACK MACRO_BookmarkMore(void);
void MACRO_BrowseButtons(void); void CALLBACK MACRO_BrowseButtons(void);
void MACRO_ChangeButtonBinding(LPCSTR, LPCSTR); void CALLBACK MACRO_ChangeButtonBinding(LPCSTR, LPCSTR);
void MACRO_ChangeEnable(LPCSTR, LPCSTR); void CALLBACK MACRO_ChangeEnable(LPCSTR, LPCSTR);
void MACRO_ChangeItemBinding(LPCSTR, LPCSTR); void CALLBACK MACRO_ChangeItemBinding(LPCSTR, LPCSTR);
void MACRO_CheckItem(LPCSTR); void CALLBACK MACRO_CheckItem(LPCSTR);
void MACRO_CloseSecondarys(void); void CALLBACK MACRO_CloseSecondarys(void);
void MACRO_CloseWindow(LPCSTR); void CALLBACK MACRO_CloseWindow(LPCSTR);
void MACRO_Compare(LPCSTR); void CALLBACK MACRO_Compare(LPCSTR);
void MACRO_Contents(void); void CALLBACK MACRO_Contents(void);
void MACRO_ControlPanel(LPCSTR, LPCSTR, LONG); void CALLBACK MACRO_ControlPanel(LPCSTR, LPCSTR, LONG);
void MACRO_CopyDialog(void); void CALLBACK MACRO_CopyDialog(void);
void MACRO_CopyTopic(void); void CALLBACK MACRO_CopyTopic(void);
void MACRO_CreateButton(LPCSTR, LPCSTR, LPCSTR); void CALLBACK MACRO_CreateButton(LPCSTR, LPCSTR, LPCSTR);
void MACRO_DeleteItem(LPCSTR); void CALLBACK MACRO_DeleteItem(LPCSTR);
void MACRO_DeleteMark(LPCSTR); void CALLBACK MACRO_DeleteMark(LPCSTR);
void MACRO_DestroyButton(LPCSTR); void CALLBACK MACRO_DestroyButton(LPCSTR);
void MACRO_DisableButton(LPCSTR); void CALLBACK MACRO_DisableButton(LPCSTR);
void MACRO_DisableItem(LPCSTR); void CALLBACK MACRO_DisableItem(LPCSTR);
void MACRO_EnableButton(LPCSTR); void CALLBACK MACRO_EnableButton(LPCSTR);
void MACRO_EnableItem(LPCSTR); void CALLBACK MACRO_EnableItem(LPCSTR);
void MACRO_EndMPrint(void); void CALLBACK MACRO_EndMPrint(void);
void MACRO_ExecFile(LPCSTR, LPCSTR, LONG, LPCSTR); void CALLBACK MACRO_ExecFile(LPCSTR, LPCSTR, LONG, LPCSTR);
void MACRO_ExecProgram(LPCSTR, LONG); void CALLBACK MACRO_ExecProgram(LPCSTR, LONG);
void MACRO_Exit(void); void CALLBACK MACRO_Exit(void);
void MACRO_ExtAbleItem(LPCSTR, LONG); void CALLBACK MACRO_ExtAbleItem(LPCSTR, LONG);
void MACRO_ExtInsertItem(LPCSTR, LPCSTR, LPCSTR, LPCSTR, LONG, LONG); void CALLBACK MACRO_ExtInsertItem(LPCSTR, LPCSTR, LPCSTR, LPCSTR, LONG, LONG);
void MACRO_ExtInsertMenu(LPCSTR, LPCSTR, LPCSTR, LONG, LONG); void CALLBACK MACRO_ExtInsertMenu(LPCSTR, LPCSTR, LPCSTR, LONG, LONG);
BOOL MACRO_FileExist(LPCSTR); BOOL CALLBACK MACRO_FileExist(LPCSTR);
void MACRO_FileOpen(void); void CALLBACK MACRO_FileOpen(void);
void MACRO_Find(void); void CALLBACK MACRO_Find(void);
void MACRO_Finder(void); void CALLBACK MACRO_Finder(void);
void MACRO_FloatingMenu(void); void CALLBACK MACRO_FloatingMenu(void);
void MACRO_Flush(void); void CALLBACK MACRO_Flush(void);
void MACRO_FocusWindow(LPCSTR); void CALLBACK MACRO_FocusWindow(LPCSTR);
void MACRO_Generate(LPCSTR, LONG, LONG); void CALLBACK MACRO_Generate(LPCSTR, LONG, LONG);
void MACRO_GotoMark(LPCSTR); void CALLBACK MACRO_GotoMark(LPCSTR);
void MACRO_HelpOn(void); void CALLBACK MACRO_HelpOn(void);
void MACRO_HelpOnTop(void); void CALLBACK MACRO_HelpOnTop(void);
void MACRO_History(void); void CALLBACK MACRO_History(void);
void MACRO_IfThen(BOOL, LPCSTR); void CALLBACK MACRO_IfThen(BOOL, LPCSTR);
void MACRO_IfThenElse(BOOL, LPCSTR, LPCSTR); void CALLBACK MACRO_IfThenElse(BOOL, LPCSTR, LPCSTR);
BOOL MACRO_InitMPrint(void); BOOL CALLBACK MACRO_InitMPrint(void);
void MACRO_InsertItem(LPCSTR, LPCSTR, LPCSTR, LPCSTR, LONG); void CALLBACK MACRO_InsertItem(LPCSTR, LPCSTR, LPCSTR, LPCSTR, LONG);
void MACRO_InsertMenu(LPCSTR, LPCSTR, LONG); void CALLBACK MACRO_InsertMenu(LPCSTR, LPCSTR, LONG);
BOOL MACRO_IsBook(void); BOOL CALLBACK MACRO_IsBook(void);
BOOL MACRO_IsMark(LPCSTR); BOOL CALLBACK MACRO_IsMark(LPCSTR);
BOOL MACRO_IsNotMark(LPCSTR); BOOL CALLBACK MACRO_IsNotMark(LPCSTR);
void MACRO_JumpContents(LPCSTR, LPCSTR); void CALLBACK MACRO_JumpContents(LPCSTR, LPCSTR);
void MACRO_JumpContext(LPCSTR, LPCSTR, LONG); void CALLBACK MACRO_JumpContext(LPCSTR, LPCSTR, LONG);
void MACRO_JumpHash(LPCSTR, LPCSTR, LONG); void CALLBACK MACRO_JumpHash(LPCSTR, LPCSTR, LONG);
void MACRO_JumpHelpOn(void); void CALLBACK MACRO_JumpHelpOn(void);
void MACRO_JumpID(LPCSTR, LPCSTR, LPCSTR); void CALLBACK MACRO_JumpID(LPCSTR, LPCSTR, LPCSTR);
void MACRO_JumpKeyword(LPCSTR, LPCSTR, LPCSTR); void CALLBACK MACRO_JumpKeyword(LPCSTR, LPCSTR, LPCSTR);
void MACRO_KLink(LPCSTR, LONG, LPCSTR, LPCSTR); void CALLBACK MACRO_KLink(LPCSTR, LONG, LPCSTR, LPCSTR);
void MACRO_Menu(void); void CALLBACK MACRO_Menu(void);
void MACRO_MPrintHash(LONG); void CALLBACK MACRO_MPrintHash(LONG);
void MACRO_MPrintID(LPCSTR); void CALLBACK MACRO_MPrintID(LPCSTR);
void MACRO_Next(void); void CALLBACK MACRO_Next(void);
void MACRO_NoShow(void); void CALLBACK MACRO_NoShow(void);
void MACRO_PopupContext(LPCSTR, LONG); void CALLBACK MACRO_PopupContext(LPCSTR, LONG);
void MACRO_PopupHash(LPCSTR, LONG); void CALLBACK MACRO_PopupHash(LPCSTR, LONG);
void MACRO_PopupId(LPCSTR, LPCSTR); void CALLBACK MACRO_PopupId(LPCSTR, LPCSTR);
void MACRO_PositionWindow(LONG, LONG, LONG, LONG, LONG, LPCSTR); void CALLBACK MACRO_PositionWindow(LONG, LONG, LONG, LONG, LONG, LPCSTR);
void MACRO_Prev(void); void CALLBACK MACRO_Prev(void);
void MACRO_Print(void); void CALLBACK MACRO_Print(void);
void MACRO_PrinterSetup(void); void CALLBACK MACRO_PrinterSetup(void);
void MACRO_RegisterRoutine(LPCSTR, LPCSTR, LPCSTR); void CALLBACK MACRO_RegisterRoutine(LPCSTR, LPCSTR, LPCSTR);
void MACRO_RemoveAccelerator(LONG, LONG); void CALLBACK MACRO_RemoveAccelerator(LONG, LONG);
void MACRO_ResetMenu(void); void CALLBACK MACRO_ResetMenu(void);
void MACRO_SaveMark(LPCSTR); void CALLBACK MACRO_SaveMark(LPCSTR);
void MACRO_Search(void); void CALLBACK MACRO_Search(void);
void MACRO_SetContents(LPCSTR, LONG); void CALLBACK MACRO_SetContents(LPCSTR, LONG);
void MACRO_SetHelpOnFile(LPCSTR); void CALLBACK MACRO_SetHelpOnFile(LPCSTR);
void MACRO_SetPopupColor(LONG, LONG, LONG); void CALLBACK MACRO_SetPopupColor(LONG, LONG, LONG);
void MACRO_ShellExecute(LPCSTR, LPCSTR, LONG, LONG, LPCSTR, LPCSTR); void CALLBACK MACRO_ShellExecute(LPCSTR, LPCSTR, LONG, LONG, LPCSTR, LPCSTR);
void MACRO_ShortCut(LPCSTR, LPCSTR, LONG, LONG, LPCSTR); void CALLBACK MACRO_ShortCut(LPCSTR, LPCSTR, LONG, LONG, LPCSTR);
void MACRO_TCard(LONG); void CALLBACK MACRO_TCard(LONG);
void MACRO_Test(LONG); void CALLBACK MACRO_Test(LONG);
BOOL MACRO_TestALink(LPCSTR); BOOL CALLBACK MACRO_TestALink(LPCSTR);
BOOL MACRO_TestKLink(LPCSTR); BOOL CALLBACK MACRO_TestKLink(LPCSTR);
void MACRO_UncheckItem(LPCSTR); void CALLBACK MACRO_UncheckItem(LPCSTR);
void MACRO_UpdateWindow(LPCSTR, LPCSTR); void CALLBACK MACRO_UpdateWindow(LPCSTR, LPCSTR);
/* Local Variables: */ /* Local Variables: */
/* c-file-style: "GNU" */ /* c-file-style: "GNU" */
......
...@@ -132,7 +132,7 @@ static const char* ts(int t) ...@@ -132,7 +132,7 @@ static const char* ts(int t)
} }
} }
static int MACRO_CallBoolFunc(BOOL (*fn)(), const char* args, void** ret); static int MACRO_CallBoolFunc(FARPROC fn, const char* args, void** ret);
/****************************************************************** /******************************************************************
* MACRO_CheckArgs * MACRO_CheckArgs
...@@ -173,7 +173,7 @@ static int MACRO_CheckArgs(void* pa[], unsigned max, const char* args) ...@@ -173,7 +173,7 @@ static int MACRO_CheckArgs(void* pa[], unsigned max, const char* args)
case 'B': case 'B':
if (t != BOOL_FUNCTION) if (t != BOOL_FUNCTION)
{WINE_WARN("missing B\n");return -1;} {WINE_WARN("missing B\n");return -1;}
if (MACRO_CallBoolFunc(yylval.bool_function, yylval.proto, &pa[idx]) == 0) if (MACRO_CallBoolFunc(yylval.function, yylval.proto, &pa[idx]) == 0)
return -1; return -1;
break; break;
default: default:
...@@ -196,7 +196,7 @@ static int MACRO_CheckArgs(void* pa[], unsigned max, const char* args) ...@@ -196,7 +196,7 @@ static int MACRO_CheckArgs(void* pa[], unsigned max, const char* args)
* Invokes boolean function fn, which arguments are defined by args * Invokes boolean function fn, which arguments are defined by args
* stores bool result into ret * stores bool result into ret
*/ */
static int MACRO_CallBoolFunc(BOOL (*fn)(), const char* args, void** ret) static int MACRO_CallBoolFunc(FARPROC fn, const char* args, void** ret)
{ {
void* pa[2]; void* pa[2];
int idx = MACRO_CheckArgs(pa, sizeof(pa)/sizeof(pa[0]), args); int idx = MACRO_CheckArgs(pa, sizeof(pa)/sizeof(pa[0]), args);
...@@ -221,7 +221,7 @@ static int MACRO_CallBoolFunc(BOOL (*fn)(), const char* args, void** ret) ...@@ -221,7 +221,7 @@ static int MACRO_CallBoolFunc(BOOL (*fn)(), const char* args, void** ret)
* *
* *
*/ */
static int MACRO_CallVoidFunc(void (*fn)(), const char* args) static int MACRO_CallVoidFunc(FARPROC fn, const char* args)
{ {
void* pa[6]; void* pa[6];
int idx = MACRO_CheckArgs(pa, sizeof(pa)/sizeof(pa[0]), args); int idx = MACRO_CheckArgs(pa, sizeof(pa)/sizeof(pa[0]), args);
...@@ -229,7 +229,7 @@ static int MACRO_CallVoidFunc(void (*fn)(), const char* args) ...@@ -229,7 +229,7 @@ static int MACRO_CallVoidFunc(void (*fn)(), const char* args)
if (idx == -1) return 0; if (idx == -1) return 0;
if (!fn) return 1; if (!fn) return 1;
WINE_TRACE("calling with %u pmts\n", idx); WINE_TRACE("calling %p with %u pmts\n", fn, idx);
switch (idx) switch (idx)
{ {
...@@ -260,7 +260,7 @@ BOOL MACRO_ExecuteMacro(LPCSTR macro) ...@@ -260,7 +260,7 @@ BOOL MACRO_ExecuteMacro(LPCSTR macro)
{ {
case VOID_FUNCTION: case VOID_FUNCTION:
WINE_TRACE("got type void func(%s)\n", yylval.proto); WINE_TRACE("got type void func(%s)\n", yylval.proto);
MACRO_CallVoidFunc(yylval.void_function, yylval.proto); MACRO_CallVoidFunc(yylval.function, yylval.proto);
break; break;
case BOOL_FUNCTION: case BOOL_FUNCTION:
WINE_WARN("got type bool func(%s)\n", yylval.proto); WINE_WARN("got type bool func(%s)\n", yylval.proto);
......
...@@ -54,7 +54,7 @@ static void WINHELP_DeleteWindow(WINHELP_WINDOW*); ...@@ -54,7 +54,7 @@ static void WINHELP_DeleteWindow(WINHELP_WINDOW*);
static void WINHELP_SetupText(HWND hWnd); static void WINHELP_SetupText(HWND hWnd);
static WINHELP_LINE_PART* WINHELP_IsOverLink(WINHELP_WINDOW*, WPARAM, LPARAM); static WINHELP_LINE_PART* WINHELP_IsOverLink(WINHELP_WINDOW*, WPARAM, LPARAM);
WINHELP_GLOBALS Globals = {3, 0, 0, 0, 1, 0, 0, NULL}; WINHELP_GLOBALS Globals = {3, NULL, NULL, 0, TRUE, NULL, NULL, NULL, NULL};
/*********************************************************************** /***********************************************************************
* *
...@@ -129,7 +129,7 @@ HLPFILE_WINDOWINFO* WINHELP_GetWindowInfo(HLPFILE* hlpfile, LPCSTR name) ...@@ -129,7 +129,7 @@ HLPFILE_WINDOWINFO* WINHELP_GetWindowInfo(HLPFILE* hlpfile, LPCSTR name)
* *
* *
*/ */
HLPFILE_WINDOWINFO* WINHELP_GetPopupWindowInfo(HLPFILE* hlpfile, HWND hParentWnd, POINT* mouse) static HLPFILE_WINDOWINFO* WINHELP_GetPopupWindowInfo(HLPFILE* hlpfile, HWND hParentWnd, POINT* mouse)
{ {
static HLPFILE_WINDOWINFO wi; static HLPFILE_WINDOWINFO wi;
...@@ -165,6 +165,7 @@ int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE prev, LPSTR cmdline, int show) ...@@ -165,6 +165,7 @@ int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE prev, LPSTR cmdline, int show)
LONG lHash = 0; LONG lHash = 0;
HLPFILE* hlpfile; HLPFILE* hlpfile;
CHAR* quote; CHAR* quote;
WINHELP_DLL* dll;
Globals.hInstance = hInstance; Globals.hInstance = hInstance;
...@@ -205,7 +206,12 @@ int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE prev, LPSTR cmdline, int show) ...@@ -205,7 +206,12 @@ int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE prev, LPSTR cmdline, int show)
} }
/* Create primary window */ /* Create primary window */
WINHELP_RegisterWinClasses(); if (!WINHELP_RegisterWinClasses())
{
WINE_FIXME("Couldn't register classes\n");
return 0;
}
if (*cmdline) if (*cmdline)
{ {
if ((*cmdline == '"') && (quote = strchr(cmdline+1, '"'))) if ((*cmdline == '"') && (quote = strchr(cmdline+1, '"')))
...@@ -226,6 +232,10 @@ int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE prev, LPSTR cmdline, int show) ...@@ -226,6 +232,10 @@ int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE prev, LPSTR cmdline, int show)
TranslateMessage(&msg); TranslateMessage(&msg);
DispatchMessage(&msg); DispatchMessage(&msg);
} }
for (dll = Globals.dlls; dll; dll = dll->next)
{
if (dll->class & DC_INITTERM) dll->handler(DW_TERM, 0, 0);
}
return 0; return 0;
} }
...@@ -473,7 +483,7 @@ BOOL WINHELP_CreateHelpWindow(HLPFILE_PAGE* page, HLPFILE_WINDOWINFO* wi, ...@@ -473,7 +483,7 @@ BOOL WINHELP_CreateHelpWindow(HLPFILE_PAGE* page, HLPFILE_WINDOWINFO* wi,
sizeof(WINHELP_WINDOW) + strlen(wi->name) + 1); sizeof(WINHELP_WINDOW) + strlen(wi->name) + 1);
if (!win) return FALSE; if (!win) return FALSE;
win->next = Globals.win_list; win->next = Globals.win_list;
Globals.win_list = win; Globals.win_list = win;
win->lpszName = (char*)win + sizeof(WINHELP_WINDOW); win->lpszName = (char*)win + sizeof(WINHELP_WINDOW);
...@@ -544,9 +554,10 @@ BOOL WINHELP_CreateHelpWindow(HLPFILE_PAGE* page, HLPFILE_WINDOWINFO* wi, ...@@ -544,9 +554,10 @@ BOOL WINHELP_CreateHelpWindow(HLPFILE_PAGE* page, HLPFILE_WINDOWINFO* wi,
} }
hWnd = CreateWindow(bPopup ? TEXT_WIN_CLASS_NAME : MAIN_WIN_CLASS_NAME, hWnd = CreateWindow(bPopup ? TEXT_WIN_CLASS_NAME : MAIN_WIN_CLASS_NAME,
wi->caption, wi->win_style, wi->caption,
bPrimary ? WS_OVERLAPPEDWINDOW : wi->win_style,
wi->origin.x, wi->origin.y, wi->size.cx, wi->size.cy, wi->origin.x, wi->origin.y, wi->size.cx, wi->size.cy,
0, bPrimary ? LoadMenu(Globals.hInstance, MAKEINTRESOURCE(MAIN_MENU)) : 0, NULL, bPrimary ? LoadMenu(Globals.hInstance, MAKEINTRESOURCE(MAIN_MENU)) : 0,
Globals.hInstance, win); Globals.hInstance, win);
ShowWindow(hWnd, nCmdShow); ShowWindow(hWnd, nCmdShow);
...@@ -965,7 +976,7 @@ static LRESULT CALLBACK WINHELP_TextWndProc(HWND hWnd, UINT msg, WPARAM wParam, ...@@ -965,7 +976,7 @@ static LRESULT CALLBACK WINHELP_TextWndProc(HWND hWnd, UINT msg, WPARAM wParam,
if (CurPos > Max) if (CurPos > Max)
CurPos = Max; CurPos = Max;
else if (CurPos < Min) else if (CurPos < Min)
CurPos = Min; CurPos = Min;
dy = GetScrollPos(hWnd, SB_VERT) - CurPos; dy = GetScrollPos(hWnd, SB_VERT) - CurPos;
SetScrollPos(hWnd, SB_VERT, CurPos, TRUE); SetScrollPos(hWnd, SB_VERT, CurPos, TRUE);
ScrollWindow(hWnd, 0, dy, NULL, NULL); ScrollWindow(hWnd, 0, dy, NULL, NULL);
......
...@@ -122,6 +122,36 @@ typedef struct tagWinHelp ...@@ -122,6 +122,36 @@ typedef struct tagWinHelp
struct tagWinHelp* next; struct tagWinHelp* next;
} WINHELP_WINDOW; } WINHELP_WINDOW;
#define DC_NOMSG 0x00000000
#define DC_MINMAX 0x00000001
#define DC_INITTERM 0x00000002
#define DC_JUMP 0x00000004
#define DC_ACTIVATE 0x00000008
#define DC_CALLBACKS 0x00000010
#define DW_NOTUSED 0
#define DW_WHATMSG 1
#define DW_MINMAX 2
#define DW_SIZE 3
#define DW_INIT 4
#define DW_TERM 5
#define DW_STARTJUMP 6
#define DW_ENDJUMP 7
#define DW_CHGFILE 8
#define DW_ACTIVATE 9
#define DW_CALLBACKS 10
typedef long (CALLBACK *WINHELP_LDLLHandler)(WORD, LONG, LONG);
typedef struct tagDll
{
HANDLE hLib;
const char* name;
WINHELP_LDLLHandler handler;
DWORD class;
struct tagDll* next;
} WINHELP_DLL;
typedef struct typedef struct
{ {
UINT wVersion; UINT wVersion;
...@@ -132,9 +162,11 @@ typedef struct ...@@ -132,9 +162,11 @@ typedef struct
WINHELP_WINDOW* active_win; WINHELP_WINDOW* active_win;
WINHELP_WINDOW* win_list; WINHELP_WINDOW* win_list;
WNDPROC button_proc; WNDPROC button_proc;
WINHELP_DLL* dlls;
} WINHELP_GLOBALS; } WINHELP_GLOBALS;
extern WINHELP_GLOBALS Globals; extern WINHELP_GLOBALS Globals;
extern FARPROC Callbacks[];
BOOL WINHELP_CreateHelpWindowByHash(HLPFILE*, LONG, HLPFILE_WINDOWINFO*, int); BOOL WINHELP_CreateHelpWindowByHash(HLPFILE*, LONG, HLPFILE_WINDOWINFO*, int);
BOOL WINHELP_CreateHelpWindow(HLPFILE_PAGE*, HLPFILE_WINDOWINFO*, int); BOOL WINHELP_CreateHelpWindow(HLPFILE_PAGE*, HLPFILE_WINDOWINFO*, int);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment