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
PROGRAMS = hlp2sgml
C_SRCS = \
winhelp.c \
callback.c \
hlpfile.c \
macro.c \
string.c
string.c \
winhelp.c
EXTRA_SRCS = macro.lex.l
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*);
static void HLPFILE_UncompressRLE(const BYTE* src, const BYTE* end, BYTE** dst, unsigned dstsz);
static BOOL HLPFILE_ReadFont(HLPFILE* hlpfile);
#if 0
/***********************************************************************
*
* HLPFILE_PageByNumber
*/
HLPFILE_PAGE *HLPFILE_PageByNumber(LPCSTR lpszPath, UINT wNum)
static HLPFILE_PAGE *HLPFILE_PageByNumber(LPCSTR lpszPath, UINT wNum)
{
HLPFILE_PAGE *page;
HLPFILE *hlpfile = HLPFILE_ReadHlpFile(lpszPath);
......@@ -110,6 +111,7 @@ HLPFILE_PAGE *HLPFILE_PageByNumber(LPCSTR lpszPath, UINT wNum)
return page;
}
#endif
/* FIXME:
* 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
if (!dst) return NULL;
HLPFILE_UncompressRLE(src, src + csz, &tmp, 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;
case 2: /* LZ77 */
sz77 = HLPFILE_UncompressedLZ77_Size(src, src + csz);
......@@ -671,7 +673,7 @@ static BOOL HLPFILE_LoadMetaFile(BYTE* beg, BYTE pack, HLPFILE_PARAGRAPH* pa
hsoff = GET_UINT(ptr, 4);
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);
bits = HLPFILE_DecompressGfx(beg + off, csize, size, pack);
......@@ -1785,10 +1787,10 @@ static void HLPFILE_UncompressRLE(const BYTE* src, const BYTE* end, BYTE** dst,
while (src < end)
{
ch = *src++;
if (!(ch & 0x7F)) continue;
if (ch & 0x80)
{
ch &= 0x7F;
if (ch == 0) WINE_FIXME("Null length 1, next is %u\n", *src);
if ((*dst) + ch < sdst)
memcpy(*dst, src, ch);
src += ch;
......@@ -1796,18 +1798,13 @@ static void HLPFILE_UncompressRLE(const BYTE* src, const BYTE* end, BYTE** dst,
else
{
if ((*dst) + ch < sdst)
memset(*dst, (char)*src, ch);
src++;
if (ch == 0)
{
WINE_FIXME("Null length 2, next is %u\n", *src);
}
memset(*dst, (char)*src++, ch);
}
*dst += ch;
}
if (*dst != sdst)
WINE_FIXME("Buffer X-flow: d(%u) instead of d(%u)\n",
*dst - (sdst - dstsz), dstsz);
WINE_WARN("Buffer X-flow: d(%u) instead of d(%u)\n",
*dst - (sdst - dstsz), dstsz);
}
/******************************************************************
......
......@@ -37,7 +37,7 @@ struct MacroDesc {
char* alias;
BOOL isBool;
char* arguments;
void (*fn)();
FARPROC fn;
};
/* types:
......@@ -48,97 +48,97 @@ struct MacroDesc {
*/
static struct MacroDesc MACRO_Builtins[] = {
{"About", NULL, 0, "", MACRO_About},
{"AddAccelerator", "AA", 0, "UUS", MACRO_AddAccelerator},
{"ALink", "AL", 0, "SUS", MACRO_ALink},
{"Annotate", NULL, 0, "", MACRO_Annotate},
{"AppendItem", NULL, 0, "SSSS", MACRO_AppendItem},
{"Back", NULL, 0, "", MACRO_Back},
{"BackFlush", "BF", 0, "", MACRO_BackFlush},
{"BookmarkDefine", NULL, 0, "", MACRO_BookmarkDefine},
{"BookmarkMore", NULL, 0, "", MACRO_BookmarkMore},
{"BrowseButtons", NULL, 0, "", MACRO_BrowseButtons},
{"ChangeButtonBinding", "CBB",0, "SS", MACRO_ChangeButtonBinding},
{"ChangeEnable", "CE", 0, "SS", MACRO_ChangeEnable},
{"ChangeItemBinding", "CIB",0, "SS", MACRO_ChangeItemBinding},
{"CheckItem", "CI", 0, "S", MACRO_CheckItem},
{"CloseSecondarys", "CS", 0, "", MACRO_CloseSecondarys},
{"CloseWindow", "CW", 0, "S", MACRO_CloseWindow},
{"Compare", NULL, 0, "S", MACRO_Compare},
{"Contents", NULL, 0, "", MACRO_Contents},
{"ControlPanel", NULL, 0, "SSU", MACRO_ControlPanel},
{"CopyDialog", NULL, 0, "", MACRO_CopyDialog},
{"CopyTopic", "CT", 0, "", MACRO_CopyTopic},
{"CreateButton", "CB", 0, "SSS", MACRO_CreateButton},
{"DeleteItem", NULL, 0, "S", MACRO_DeleteItem},
{"DeleteMark", NULL, 0, "S", MACRO_DeleteMark},
{"DestroyButton", NULL, 0, "S", MACRO_DestroyButton},
{"DisableButton", "DB", 0, "S", MACRO_DisableButton},
{"DisableItem", "DI", 0, "S", MACRO_DisableItem},
{"EnableButton", "EB", 0, "S", MACRO_EnableButton},
{"EnableItem", "EI", 0, "S", MACRO_EnableItem},
{"EndMPrint", NULL, 0, "", MACRO_EndMPrint},
{"ExecFile", "EF", 0, "SSUS", MACRO_ExecFile},
{"ExecProgram", "EP", 0, "SU", MACRO_ExecProgram},
{"Exit", NULL, 0, "", MACRO_Exit},
{"ExtAbleItem", NULL, 0, "SU", MACRO_ExtAbleItem},
{"ExtInsertItem", NULL, 0, "SSSSUU", MACRO_ExtInsertItem},
{"ExtInsertMenu", NULL, 0, "SSSUU", MACRO_ExtInsertMenu},
{"FileExist", "FE", 1, "S", (void (*)())MACRO_FileExist},
{"FileOpen", "FO", 0, "", MACRO_FileOpen},
{"Find", NULL, 0, "", MACRO_Find},
{"Finder", "FD", 0, "", MACRO_Finder},
{"FloatingMenu", NULL, 0, "", MACRO_FloatingMenu},
{"Flush", "FH", 0, "", MACRO_Flush},
{"FocusWindow", NULL, 0, "S", MACRO_FocusWindow},
{"Generate", NULL, 0, "SUU", MACRO_Generate},
{"GotoMark", NULL, 0, "S", MACRO_GotoMark},
{"HelpOn", NULL, 0, "", MACRO_HelpOn},
{"HelpOnTop", NULL, 0, "", MACRO_HelpOnTop},
{"History", NULL, 0, "", MACRO_History},
{"InitMPrint", NULL, 1, "", (void (*)())MACRO_InitMPrint},
{"InsertItem", NULL, 0, "SSSSU", MACRO_InsertItem},
{"InsertMenu", NULL, 0, "SSU", MACRO_InsertMenu},
{"IfThen", "IF", 0, "BS", MACRO_IfThen},
{"IfThenElse", "IE", 0, "BSS", MACRO_IfThenElse},
{"IsBook", NULL, 1, "", (void (*)())MACRO_IsBook},
{"IsMark", NULL, 1, "S", (void (*)())MACRO_IsMark},
{"IsNotMark", "NM", 1, "S", (void (*)())MACRO_IsNotMark},
{"JumpContents", NULL, 0, "SS", MACRO_JumpContents},
{"JumpContext", "JC", 0, "SSU", MACRO_JumpContext},
{"JumpHash", "JH", 0, "SSU", MACRO_JumpHash},
{"JumpHelpOn", NULL, 0, "", MACRO_JumpHelpOn},
{"JumpID", "JI", 0, "SSS", MACRO_JumpID},
{"JumpKeyword", "JK", 0, "SSS", MACRO_JumpKeyword},
{"KLink", "KL", 0, "SUSS", MACRO_KLink},
{"Menu", "MU", 0, "", MACRO_Menu},
{"MPrintHash", NULL, 0, "U", MACRO_MPrintHash},
{"MPrintID", NULL, 0, "S", MACRO_MPrintID},
{"Next", NULL, 0, "", MACRO_Next},
{"NoShow", NULL, 0, "", MACRO_NoShow},
{"PopupContext", "PC", 0, "SU", MACRO_PopupContext},
{"PopupHash", NULL, 0, "SU", MACRO_PopupHash},
{"PopupId", "PI", 0, "SS", MACRO_PopupId},
{"PositionWindow", "PW", 0, "IIUUUS", MACRO_PositionWindow},
{"Prev", NULL, 0, "", MACRO_Prev},
{"Print", NULL, 0, "", MACRO_Print},
{"PrinterSetup", NULL, 0, "", MACRO_PrinterSetup},
{"RegisterRoutine", "RR", 0, "SSS", MACRO_RegisterRoutine},
{"RemoveAccelerator", "RA", 0, "UU", MACRO_RemoveAccelerator},
{"ResetMenu", NULL, 0, "", MACRO_ResetMenu},
{"SaveMark", NULL, 0, "S", MACRO_SaveMark},
{"Search", NULL, 0, "", MACRO_Search},
{"SetContents", NULL, 0, "SU", MACRO_SetContents},
{"SetHelpOnFile", NULL, 0, "S", MACRO_SetHelpOnFile},
{"SetPopupColor", "SPC",0, "UUU", MACRO_SetPopupColor},
{"ShellExecute", "SE", 0, "SSUUSS", MACRO_ShellExecute},
{"ShortCut", "SH", 0, "SSUUS", MACRO_ShortCut},
{"TCard", NULL, 0, "U", MACRO_TCard},
{"Test", NULL, 0, "U", MACRO_Test},
{"TestALink", NULL, 1, "S", (void (*)())MACRO_TestALink},
{"TestKLink", NULL, 1, "S", (void (*)())MACRO_TestKLink},
{"UncheckItem", "UI", 0, "S", MACRO_UncheckItem},
{"UpdateWindow", "UW", 0, "SS", MACRO_UpdateWindow},
{"About", NULL, 0, "", (FARPROC)MACRO_About},
{"AddAccelerator", "AA", 0, "UUS", (FARPROC)MACRO_AddAccelerator},
{"ALink", "AL", 0, "SUS", (FARPROC)MACRO_ALink},
{"Annotate", NULL, 0, "", (FARPROC)MACRO_Annotate},
{"AppendItem", NULL, 0, "SSSS", (FARPROC)MACRO_AppendItem},
{"Back", NULL, 0, "", (FARPROC)MACRO_Back},
{"BackFlush", "BF", 0, "", (FARPROC)MACRO_BackFlush},
{"BookmarkDefine", NULL, 0, "", (FARPROC)MACRO_BookmarkDefine},
{"BookmarkMore", NULL, 0, "", (FARPROC)MACRO_BookmarkMore},
{"BrowseButtons", NULL, 0, "", (FARPROC)MACRO_BrowseButtons},
{"ChangeButtonBinding", "CBB",0, "SS", (FARPROC)MACRO_ChangeButtonBinding},
{"ChangeEnable", "CE", 0, "SS", (FARPROC)MACRO_ChangeEnable},
{"ChangeItemBinding", "CIB",0, "SS", (FARPROC)MACRO_ChangeItemBinding},
{"CheckItem", "CI", 0, "S", (FARPROC)MACRO_CheckItem},
{"CloseSecondarys", "CS", 0, "", (FARPROC)MACRO_CloseSecondarys},
{"CloseWindow", "CW", 0, "S", (FARPROC)MACRO_CloseWindow},
{"Compare", NULL, 0, "S", (FARPROC)MACRO_Compare},
{"Contents", NULL, 0, "", (FARPROC)MACRO_Contents},
{"ControlPanel", NULL, 0, "SSU", (FARPROC)MACRO_ControlPanel},
{"CopyDialog", NULL, 0, "", (FARPROC)MACRO_CopyDialog},
{"CopyTopic", "CT", 0, "", (FARPROC)MACRO_CopyTopic},
{"CreateButton", "CB", 0, "SSS", (FARPROC)MACRO_CreateButton},
{"DeleteItem", NULL, 0, "S", (FARPROC)MACRO_DeleteItem},
{"DeleteMark", NULL, 0, "S", (FARPROC)MACRO_DeleteMark},
{"DestroyButton", NULL, 0, "S", (FARPROC)MACRO_DestroyButton},
{"DisableButton", "DB", 0, "S", (FARPROC)MACRO_DisableButton},
{"DisableItem", "DI", 0, "S", (FARPROC)MACRO_DisableItem},
{"EnableButton", "EB", 0, "S", (FARPROC)MACRO_EnableButton},
{"EnableItem", "EI", 0, "S", (FARPROC)MACRO_EnableItem},
{"EndMPrint", NULL, 0, "", (FARPROC)MACRO_EndMPrint},
{"ExecFile", "EF", 0, "SSUS", (FARPROC)MACRO_ExecFile},
{"ExecProgram", "EP", 0, "SU", (FARPROC)MACRO_ExecProgram},
{"Exit", NULL, 0, "", (FARPROC)MACRO_Exit},
{"ExtAbleItem", NULL, 0, "SU", (FARPROC)MACRO_ExtAbleItem},
{"ExtInsertItem", NULL, 0, "SSSSUU", (FARPROC)MACRO_ExtInsertItem},
{"ExtInsertMenu", NULL, 0, "SSSUU", (FARPROC)MACRO_ExtInsertMenu},
{"FileExist", "FE", 1, "S", (FARPROC)MACRO_FileExist},
{"FileOpen", "FO", 0, "", (FARPROC)MACRO_FileOpen},
{"Find", NULL, 0, "", (FARPROC)MACRO_Find},
{"Finder", "FD", 0, "", (FARPROC)MACRO_Finder},
{"FloatingMenu", NULL, 0, "", (FARPROC)MACRO_FloatingMenu},
{"Flush", "FH", 0, "", (FARPROC)MACRO_Flush},
{"FocusWindow", NULL, 0, "S", (FARPROC)MACRO_FocusWindow},
{"Generate", NULL, 0, "SUU", (FARPROC)MACRO_Generate},
{"GotoMark", NULL, 0, "S", (FARPROC)MACRO_GotoMark},
{"HelpOn", NULL, 0, "", (FARPROC)MACRO_HelpOn},
{"HelpOnTop", NULL, 0, "", (FARPROC)MACRO_HelpOnTop},
{"History", NULL, 0, "", (FARPROC)MACRO_History},
{"InitMPrint", NULL, 1, "", (FARPROC)MACRO_InitMPrint},
{"InsertItem", NULL, 0, "SSSSU", (FARPROC)MACRO_InsertItem},
{"InsertMenu", NULL, 0, "SSU", (FARPROC)MACRO_InsertMenu},
{"IfThen", "IF", 0, "BS", (FARPROC)MACRO_IfThen},
{"IfThenElse", "IE", 0, "BSS", (FARPROC)MACRO_IfThenElse},
{"IsBook", NULL, 1, "", (FARPROC)MACRO_IsBook},
{"IsMark", NULL, 1, "S", (FARPROC)MACRO_IsMark},
{"IsNotMark", "NM", 1, "S", (FARPROC)MACRO_IsNotMark},
{"JumpContents", NULL, 0, "SS", (FARPROC)MACRO_JumpContents},
{"JumpContext", "JC", 0, "SSU", (FARPROC)MACRO_JumpContext},
{"JumpHash", "JH", 0, "SSU", (FARPROC)MACRO_JumpHash},
{"JumpHelpOn", NULL, 0, "", (FARPROC)MACRO_JumpHelpOn},
{"JumpID", "JI", 0, "SSS", (FARPROC)MACRO_JumpID},
{"JumpKeyword", "JK", 0, "SSS", (FARPROC)MACRO_JumpKeyword},
{"KLink", "KL", 0, "SUSS", (FARPROC)MACRO_KLink},
{"Menu", "MU", 0, "", (FARPROC)MACRO_Menu},
{"MPrintHash", NULL, 0, "U", (FARPROC)MACRO_MPrintHash},
{"MPrintID", NULL, 0, "S", (FARPROC)MACRO_MPrintID},
{"Next", NULL, 0, "", (FARPROC)MACRO_Next},
{"NoShow", NULL, 0, "", (FARPROC)MACRO_NoShow},
{"PopupContext", "PC", 0, "SU", (FARPROC)MACRO_PopupContext},
{"PopupHash", NULL, 0, "SU", (FARPROC)MACRO_PopupHash},
{"PopupId", "PI", 0, "SS", (FARPROC)MACRO_PopupId},
{"PositionWindow", "PW", 0, "IIUUUS", (FARPROC)MACRO_PositionWindow},
{"Prev", NULL, 0, "", (FARPROC)MACRO_Prev},
{"Print", NULL, 0, "", (FARPROC)MACRO_Print},
{"PrinterSetup", NULL, 0, "", (FARPROC)MACRO_PrinterSetup},
{"RegisterRoutine", "RR", 0, "SSS", (FARPROC)MACRO_RegisterRoutine},
{"RemoveAccelerator", "RA", 0, "UU", (FARPROC)MACRO_RemoveAccelerator},
{"ResetMenu", NULL, 0, "", (FARPROC)MACRO_ResetMenu},
{"SaveMark", NULL, 0, "S", (FARPROC)MACRO_SaveMark},
{"Search", NULL, 0, "", (FARPROC)MACRO_Search},
{"SetContents", NULL, 0, "SU", (FARPROC)MACRO_SetContents},
{"SetHelpOnFile", NULL, 0, "S", (FARPROC)MACRO_SetHelpOnFile},
{"SetPopupColor", "SPC",0, "UUU", (FARPROC)MACRO_SetPopupColor},
{"ShellExecute", "SE", 0, "SSUUSS", (FARPROC)MACRO_ShellExecute},
{"ShortCut", "SH", 0, "SSUUS", (FARPROC)MACRO_ShortCut},
{"TCard", NULL, 0, "U", (FARPROC)MACRO_TCard},
{"Test", NULL, 0, "U", (FARPROC)MACRO_Test},
{"TestALink", NULL, 1, "S", (FARPROC)MACRO_TestALink},
{"TestKLink", NULL, 1, "S", (FARPROC)MACRO_TestKLink},
{"UncheckItem", "UI", 0, "S", (FARPROC)MACRO_UncheckItem},
{"UpdateWindow", "UW", 0, "SS", (FARPROC)MACRO_UpdateWindow},
{NULL, NULL, 0, NULL, NULL}
};
......@@ -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))
{
lr->proto = md->arguments;
if (md->isBool)
{
lr->bool_function = (BOOL (*)())md->fn;
return BOOL_FUNCTION;
}
else
{
lr->void_function = md->fn;
return VOID_FUNCTION;
}
lr->function = md->fn;
return md->isBool ? BOOL_FUNCTION : VOID_FUNCTION;
}
}
return EMPTY;
......@@ -184,7 +176,7 @@ int MACRO_Lookup(const char* name, struct lexret* lr)
/******* helper functions *******/
WINHELP_BUTTON** MACRO_LookupButton(WINHELP_WINDOW* win, LPCSTR name)
static WINHELP_BUTTON** MACRO_LookupButton(WINHELP_WINDOW* win, LPCSTR name)
{
WINHELP_BUTTON** b;
......@@ -195,32 +187,32 @@ WINHELP_BUTTON** MACRO_LookupButton(WINHELP_WINDOW* win, LPCSTR name)
/******* real macro implementation *******/
void MACRO_About(void)
void CALLBACK MACRO_About(void)
{
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);
}
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);
}
void MACRO_Annotate(void)
void CALLBACK MACRO_Annotate(void)
{
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);
}
void MACRO_Back(void)
void CALLBACK MACRO_Back(void)
{
WINHELP_WINDOW* win = Globals.active_win;
......@@ -231,7 +223,7 @@ void MACRO_Back(void)
win->info, SW_SHOW);
}
void MACRO_BackFlush(void)
void CALLBACK MACRO_BackFlush(void)
{
WINHELP_WINDOW* win = Globals.active_win;
......@@ -250,17 +242,17 @@ void MACRO_BackFlush(void)
}
}
void MACRO_BookmarkDefine(void)
void CALLBACK MACRO_BookmarkDefine(void)
{
WINE_FIXME("()\n");
}
void MACRO_BookmarkMore(void)
void CALLBACK MACRO_BookmarkMore(void)
{
WINE_FIXME("()\n");
}
void MACRO_BrowseButtons(void)
void CALLBACK MACRO_BrowseButtons(void)
{
WINE_TRACE("()\n");
......@@ -268,7 +260,7 @@ void MACRO_BrowseButtons(void)
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_BUTTON* button;
......@@ -293,15 +285,15 @@ void MACRO_ChangeButtonBinding(LPCSTR id, LPCSTR macro)
ptr = (char*)button + sizeof(WINHELP_BUTTON);
lstrcpy(ptr, (LPSTR) id);
lstrcpy(ptr, id);
button->lpszID = ptr;
ptr += lstrlen(id) + 1;
lstrcpy(ptr, (LPSTR) (*b)->lpszName);
lstrcpy(ptr, (*b)->lpszName);
button->lpszName = ptr;
ptr += lstrlen((*b)->lpszName) + 1;
lstrcpy(ptr, (LPSTR) macro);
lstrcpy(ptr, macro);
button->lpszMacro = ptr;
*b = button;
......@@ -309,7 +301,7 @@ void MACRO_ChangeButtonBinding(LPCSTR id, LPCSTR macro)
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);
......@@ -317,17 +309,17 @@ void MACRO_ChangeEnable(LPCSTR id, LPCSTR macro)
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);
}
void MACRO_CheckItem(LPCSTR str)
void CALLBACK MACRO_CheckItem(LPCSTR str)
{
WINE_FIXME("(\"%s\")\n", str);
}
void MACRO_CloseSecondarys(void)
void CALLBACK MACRO_CloseSecondarys(void)
{
WINHELP_WINDOW *win;
......@@ -337,7 +329,7 @@ void MACRO_CloseSecondarys(void)
DestroyWindow(win->hMainWnd);
}
void MACRO_CloseWindow(LPCSTR lpszWindow)
void CALLBACK MACRO_CloseWindow(LPCSTR lpszWindow)
{
WINHELP_WINDOW *win;
......@@ -350,12 +342,12 @@ void MACRO_CloseWindow(LPCSTR lpszWindow)
DestroyWindow(win->hMainWnd);
}
void MACRO_Compare(LPCSTR str)
void CALLBACK MACRO_Compare(LPCSTR str)
{
WINE_FIXME("(\"%s\")\n", str);
}
void MACRO_Contents(void)
void CALLBACK MACRO_Contents(void)
{
WINE_TRACE("()\n");
......@@ -363,22 +355,22 @@ void MACRO_Contents(void)
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);
}
void MACRO_CopyDialog(void)
void CALLBACK MACRO_CopyDialog(void)
{
WINE_FIXME("()\n");
}
void MACRO_CopyTopic(void)
void CALLBACK MACRO_CopyTopic(void)
{
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_BUTTON *button, **b;
......@@ -397,15 +389,15 @@ void MACRO_CreateButton(LPCSTR id, LPCSTR name, LPCSTR macro)
ptr = (char*)button + sizeof(WINHELP_BUTTON);
lstrcpy(ptr, (LPSTR) id);
lstrcpy(ptr, id);
button->lpszID = ptr;
ptr += lstrlen(id) + 1;
lstrcpy(ptr, (LPSTR) name);
lstrcpy(ptr, name);
button->lpszName = ptr;
ptr += lstrlen(name) + 1;
lstrcpy(ptr, (LPSTR) macro);
lstrcpy(ptr, macro);
button->lpszMacro = ptr;
button->wParam = WH_FIRST_BUTTON;
......@@ -416,22 +408,22 @@ void MACRO_CreateButton(LPCSTR id, LPCSTR name, LPCSTR macro)
SendMessage(win->hMainWnd, WM_USER, 0, 0);
}
void MACRO_DeleteItem(LPCSTR str)
void CALLBACK MACRO_DeleteItem(LPCSTR str)
{
WINE_FIXME("(\"%s\")\n", str);
}
void MACRO_DeleteMark(LPCSTR str)
void CALLBACK MACRO_DeleteMark(LPCSTR str)
{
WINE_FIXME("(\"%s\")\n", str);
}
void MACRO_DestroyButton(LPCSTR str)
void CALLBACK MACRO_DestroyButton(LPCSTR str)
{
WINE_FIXME("(\"%s\")\n", str);
}
void MACRO_DisableButton(LPCSTR id)
void CALLBACK MACRO_DisableButton(LPCSTR id)
{
WINHELP_BUTTON** b;
......@@ -443,12 +435,12 @@ void MACRO_DisableButton(LPCSTR id)
EnableWindow((*b)->hWnd, FALSE);
}
void MACRO_DisableItem(LPCSTR str)
void CALLBACK MACRO_DisableItem(LPCSTR str)
{
WINE_FIXME("(\"%s\")\n", str);
}
void MACRO_EnableButton(LPCSTR id)
void CALLBACK MACRO_EnableButton(LPCSTR id)
{
WINHELP_BUTTON** b;
......@@ -460,27 +452,27 @@ void MACRO_EnableButton(LPCSTR id)
EnableWindow((*b)->hWnd, TRUE);
}
void MACRO_EnableItem(LPCSTR str)
void CALLBACK MACRO_EnableItem(LPCSTR str)
{
WINE_FIXME("(\"%s\")\n", str);
}
void MACRO_EndMPrint(void)
void CALLBACK MACRO_EndMPrint(void)
{
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);
}
void MACRO_ExecProgram(LPCSTR str, LONG u)
void CALLBACK MACRO_ExecProgram(LPCSTR str, LONG u)
{
WINE_FIXME("(\"%s\", %lu)\n", str, u);
}
void MACRO_Exit(void)
void CALLBACK MACRO_Exit(void)
{
WINE_TRACE("()\n");
......@@ -488,28 +480,28 @@ void MACRO_Exit(void)
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);
}
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);
}
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);
}
BOOL MACRO_FileExist(LPCSTR str)
BOOL CALLBACK MACRO_FileExist(LPCSTR str)
{
WINE_TRACE("(\"%s\")\n", str);
return GetFileAttributes(str) != INVALID_FILE_ATTRIBUTES;
}
void MACRO_FileOpen(void)
void CALLBACK MACRO_FileOpen(void)
{
OPENFILENAME openfilename;
CHAR szPath[MAX_PATHNAME_LEN];
......@@ -563,27 +555,27 @@ void MACRO_FileOpen(void)
}
}
void MACRO_Find(void)
void CALLBACK MACRO_Find(void)
{
WINE_FIXME("()\n");
}
void MACRO_Finder(void)
void CALLBACK MACRO_Finder(void)
{
WINE_FIXME("()\n");
}
void MACRO_FloatingMenu(void)
void CALLBACK MACRO_FloatingMenu(void)
{
WINE_FIXME("()\n");
}
void MACRO_Flush(void)
void CALLBACK MACRO_Flush(void)
{
WINE_FIXME("()\n");
}
void MACRO_FocusWindow(LPCSTR lpszWindow)
void CALLBACK MACRO_FocusWindow(LPCSTR lpszWindow)
{
WINHELP_WINDOW *win;
......@@ -596,28 +588,28 @@ void MACRO_FocusWindow(LPCSTR lpszWindow)
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);
}
void MACRO_GotoMark(LPCSTR str)
void CALLBACK MACRO_GotoMark(LPCSTR str)
{
WINE_FIXME("(\"%s\")\n", str);
}
void MACRO_HelpOn(void)
void CALLBACK MACRO_HelpOn(void)
{
WINE_TRACE("()\n");
MACRO_JumpContents((Globals.wVersion > 4) ? "winhelp32.hlp" : "winhelp.hlp", NULL);
}
void MACRO_HelpOnTop(void)
void CALLBACK MACRO_HelpOnTop(void)
{
WINE_FIXME("()\n");
}
void MACRO_History(void)
void CALLBACK MACRO_History(void)
{
WINE_TRACE("()\n");
......@@ -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);
}
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);
}
BOOL MACRO_InitMPrint(void)
BOOL CALLBACK MACRO_InitMPrint(void)
{
WINE_FIXME("()\n");
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);
}
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);
}
BOOL MACRO_IsBook(void)
BOOL CALLBACK MACRO_IsBook(void)
{
WINE_TRACE("()\n");
return Globals.isBook;
}
BOOL MACRO_IsMark(LPCSTR str)
BOOL CALLBACK MACRO_IsMark(LPCSTR str)
{
WINE_FIXME("(\"%s\")\n", str);
return FALSE;
}
BOOL MACRO_IsNotMark(LPCSTR str)
BOOL CALLBACK MACRO_IsNotMark(LPCSTR str)
{
WINE_FIXME("(\"%s\")\n", str);
return TRUE;
}
void MACRO_JumpContents(LPCSTR lpszPath, LPCSTR lpszWindow)
void CALLBACK MACRO_JumpContents(LPCSTR lpszPath, LPCSTR lpszWindow)
{
HLPFILE* hlpfile;
......@@ -684,13 +676,13 @@ void MACRO_JumpContents(LPCSTR lpszPath, LPCSTR lpszWindow)
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);
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;
......@@ -701,7 +693,7 @@ void MACRO_JumpHash(LPCSTR lpszPath, LPCSTR lpszWindow, LONG lHash)
SW_NORMAL);
}
void MACRO_JumpHelpOn(void)
void CALLBACK MACRO_JumpHelpOn(void)
{
WINE_FIXME("()\n");
}
......@@ -709,38 +701,38 @@ void MACRO_JumpHelpOn(void)
/* FIXME: those two macros are wrong
* 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);
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);
}
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);
}
void MACRO_Menu(void)
void CALLBACK MACRO_Menu(void)
{
WINE_FIXME("()\n");
}
void MACRO_MPrintHash(LONG u)
void CALLBACK MACRO_MPrintHash(LONG u)
{
WINE_FIXME("(%lu)\n", u);
}
void MACRO_MPrintID(LPCSTR str)
void CALLBACK MACRO_MPrintID(LPCSTR str)
{
WINE_FIXME("(\"%s\")\n", str);
}
void MACRO_Next(void)
void CALLBACK MACRO_Next(void)
{
HLPFILE_PAGE* page;
......@@ -754,32 +746,32 @@ void MACRO_Next(void)
}
}
void MACRO_NoShow(void)
void CALLBACK MACRO_NoShow(void)
{
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);
}
void MACRO_PopupHash(LPCSTR str, LONG u)
void CALLBACK MACRO_PopupHash(LPCSTR str, LONG 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);
}
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);
}
void MACRO_Prev(void)
void CALLBACK MACRO_Prev(void)
{
HLPFILE_PAGE* page;
......@@ -793,7 +785,7 @@ void MACRO_Prev(void)
}
}
void MACRO_Print(void)
void CALLBACK MACRO_Print(void)
{
PRINTDLG printer;
......@@ -824,33 +816,62 @@ void MACRO_Print(void)
}
}
void MACRO_PrinterSetup(void)
void CALLBACK MACRO_PrinterSetup(void)
{
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;
void (*fn)();
int size;
FARPROC fn = NULL;
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 */
WINE_FIXME("Cannot find dll %s\n", dll);
fn = NULL;
if (!strcmp(dll->name, dll_name)) break;
}
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 */
WINE_FIXME("Cannot find proc %s in dll %s\n", dll, proc);
fn = NULL;
WINE_FIXME("Cannot find proc %s in dll %s\n", dll_name, proc);
}
/* FIXME: the library will not be unloaded until exit of program */
size = ++MACRO_NumLoaded * sizeof(struct MacroDesc);
if (!MACRO_Loaded) MACRO_Loaded = HeapAlloc(GetProcessHeap(), 0, size);
else MACRO_Loaded = HeapReAlloc(GetProcessHeap(), 0, MACRO_Loaded, size);
......@@ -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].arguments = strdup(args); /* FIXME */
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);
}
void MACRO_ResetMenu(void)
void CALLBACK MACRO_ResetMenu(void)
{
WINE_FIXME("()\n");
}
void MACRO_SaveMark(LPCSTR str)
void CALLBACK MACRO_SaveMark(LPCSTR str)
{
WINE_FIXME("(\"%s\")\n", str);
}
void MACRO_Search(void)
void CALLBACK MACRO_Search(void)
{
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);
}
void MACRO_SetHelpOnFile(LPCSTR str)
void CALLBACK MACRO_SetHelpOnFile(LPCSTR 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);
}
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);
}
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);
}
void MACRO_TCard(LONG u)
void CALLBACK MACRO_TCard(LONG u)
{
WINE_FIXME("(%lu)\n", u);
}
void MACRO_Test(LONG u)
void CALLBACK MACRO_Test(LONG u)
{
WINE_FIXME("(%lu)\n", u);
}
BOOL MACRO_TestALink(LPCSTR str)
BOOL CALLBACK MACRO_TestALink(LPCSTR str)
{
WINE_FIXME("(\"%s\")\n", str);
return FALSE;
}
BOOL MACRO_TestKLink(LPCSTR str)
BOOL CALLBACK MACRO_TestKLink(LPCSTR str)
{
WINE_FIXME("(\"%s\")\n", str);
return FALSE;
}
void MACRO_UncheckItem(LPCSTR str)
void CALLBACK MACRO_UncheckItem(LPCSTR 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);
}
......@@ -29,8 +29,7 @@ struct lexret {
BOOL bool;
LONG integer;
LPCSTR string;
BOOL (*bool_function)();
void (*void_function)();
FARPROC function;
};
extern struct lexret yylval;
......@@ -39,97 +38,97 @@ BOOL MACRO_ExecuteMacro(LPCSTR);
int MACRO_Lookup(const char* name, struct lexret* lr);
enum token_types {EMPTY, VOID_FUNCTION, BOOL_FUNCTION, INTEGER, STRING, IDENTIFIER};
void MACRO_About(void);
void MACRO_AddAccelerator(LONG, LONG, LPCSTR);
void MACRO_ALink(LPCSTR, LONG, LPCSTR);
void MACRO_Annotate(void);
void MACRO_AppendItem(LPCSTR, LPCSTR, LPCSTR, LPCSTR);
void MACRO_Back(void);
void MACRO_BackFlush(void);
void MACRO_BookmarkDefine(void);
void MACRO_BookmarkMore(void);
void MACRO_BrowseButtons(void);
void MACRO_ChangeButtonBinding(LPCSTR, LPCSTR);
void MACRO_ChangeEnable(LPCSTR, LPCSTR);
void MACRO_ChangeItemBinding(LPCSTR, LPCSTR);
void MACRO_CheckItem(LPCSTR);
void MACRO_CloseSecondarys(void);
void MACRO_CloseWindow(LPCSTR);
void MACRO_Compare(LPCSTR);
void MACRO_Contents(void);
void MACRO_ControlPanel(LPCSTR, LPCSTR, LONG);
void MACRO_CopyDialog(void);
void MACRO_CopyTopic(void);
void MACRO_CreateButton(LPCSTR, LPCSTR, LPCSTR);
void MACRO_DeleteItem(LPCSTR);
void MACRO_DeleteMark(LPCSTR);
void MACRO_DestroyButton(LPCSTR);
void MACRO_DisableButton(LPCSTR);
void MACRO_DisableItem(LPCSTR);
void MACRO_EnableButton(LPCSTR);
void MACRO_EnableItem(LPCSTR);
void MACRO_EndMPrint(void);
void MACRO_ExecFile(LPCSTR, LPCSTR, LONG, LPCSTR);
void MACRO_ExecProgram(LPCSTR, LONG);
void MACRO_Exit(void);
void MACRO_ExtAbleItem(LPCSTR, LONG);
void MACRO_ExtInsertItem(LPCSTR, LPCSTR, LPCSTR, LPCSTR, LONG, LONG);
void MACRO_ExtInsertMenu(LPCSTR, LPCSTR, LPCSTR, LONG, LONG);
BOOL MACRO_FileExist(LPCSTR);
void MACRO_FileOpen(void);
void MACRO_Find(void);
void MACRO_Finder(void);
void MACRO_FloatingMenu(void);
void MACRO_Flush(void);
void MACRO_FocusWindow(LPCSTR);
void MACRO_Generate(LPCSTR, LONG, LONG);
void MACRO_GotoMark(LPCSTR);
void MACRO_HelpOn(void);
void MACRO_HelpOnTop(void);
void MACRO_History(void);
void MACRO_IfThen(BOOL, LPCSTR);
void MACRO_IfThenElse(BOOL, LPCSTR, LPCSTR);
BOOL MACRO_InitMPrint(void);
void MACRO_InsertItem(LPCSTR, LPCSTR, LPCSTR, LPCSTR, LONG);
void MACRO_InsertMenu(LPCSTR, LPCSTR, LONG);
BOOL MACRO_IsBook(void);
BOOL MACRO_IsMark(LPCSTR);
BOOL MACRO_IsNotMark(LPCSTR);
void MACRO_JumpContents(LPCSTR, LPCSTR);
void MACRO_JumpContext(LPCSTR, LPCSTR, LONG);
void MACRO_JumpHash(LPCSTR, LPCSTR, LONG);
void MACRO_JumpHelpOn(void);
void MACRO_JumpID(LPCSTR, LPCSTR, LPCSTR);
void MACRO_JumpKeyword(LPCSTR, LPCSTR, LPCSTR);
void MACRO_KLink(LPCSTR, LONG, LPCSTR, LPCSTR);
void MACRO_Menu(void);
void MACRO_MPrintHash(LONG);
void MACRO_MPrintID(LPCSTR);
void MACRO_Next(void);
void MACRO_NoShow(void);
void MACRO_PopupContext(LPCSTR, LONG);
void MACRO_PopupHash(LPCSTR, LONG);
void MACRO_PopupId(LPCSTR, LPCSTR);
void MACRO_PositionWindow(LONG, LONG, LONG, LONG, LONG, LPCSTR);
void MACRO_Prev(void);
void MACRO_Print(void);
void MACRO_PrinterSetup(void);
void MACRO_RegisterRoutine(LPCSTR, LPCSTR, LPCSTR);
void MACRO_RemoveAccelerator(LONG, LONG);
void MACRO_ResetMenu(void);
void MACRO_SaveMark(LPCSTR);
void MACRO_Search(void);
void MACRO_SetContents(LPCSTR, LONG);
void MACRO_SetHelpOnFile(LPCSTR);
void MACRO_SetPopupColor(LONG, LONG, LONG);
void MACRO_ShellExecute(LPCSTR, LPCSTR, LONG, LONG, LPCSTR, LPCSTR);
void MACRO_ShortCut(LPCSTR, LPCSTR, LONG, LONG, LPCSTR);
void MACRO_TCard(LONG);
void MACRO_Test(LONG);
BOOL MACRO_TestALink(LPCSTR);
BOOL MACRO_TestKLink(LPCSTR);
void MACRO_UncheckItem(LPCSTR);
void MACRO_UpdateWindow(LPCSTR, LPCSTR);
void CALLBACK MACRO_About(void);
void CALLBACK MACRO_AddAccelerator(LONG, LONG, LPCSTR);
void CALLBACK MACRO_ALink(LPCSTR, LONG, LPCSTR);
void CALLBACK MACRO_Annotate(void);
void CALLBACK MACRO_AppendItem(LPCSTR, LPCSTR, LPCSTR, LPCSTR);
void CALLBACK MACRO_Back(void);
void CALLBACK MACRO_BackFlush(void);
void CALLBACK MACRO_BookmarkDefine(void);
void CALLBACK MACRO_BookmarkMore(void);
void CALLBACK MACRO_BrowseButtons(void);
void CALLBACK MACRO_ChangeButtonBinding(LPCSTR, LPCSTR);
void CALLBACK MACRO_ChangeEnable(LPCSTR, LPCSTR);
void CALLBACK MACRO_ChangeItemBinding(LPCSTR, LPCSTR);
void CALLBACK MACRO_CheckItem(LPCSTR);
void CALLBACK MACRO_CloseSecondarys(void);
void CALLBACK MACRO_CloseWindow(LPCSTR);
void CALLBACK MACRO_Compare(LPCSTR);
void CALLBACK MACRO_Contents(void);
void CALLBACK MACRO_ControlPanel(LPCSTR, LPCSTR, LONG);
void CALLBACK MACRO_CopyDialog(void);
void CALLBACK MACRO_CopyTopic(void);
void CALLBACK MACRO_CreateButton(LPCSTR, LPCSTR, LPCSTR);
void CALLBACK MACRO_DeleteItem(LPCSTR);
void CALLBACK MACRO_DeleteMark(LPCSTR);
void CALLBACK MACRO_DestroyButton(LPCSTR);
void CALLBACK MACRO_DisableButton(LPCSTR);
void CALLBACK MACRO_DisableItem(LPCSTR);
void CALLBACK MACRO_EnableButton(LPCSTR);
void CALLBACK MACRO_EnableItem(LPCSTR);
void CALLBACK MACRO_EndMPrint(void);
void CALLBACK MACRO_ExecFile(LPCSTR, LPCSTR, LONG, LPCSTR);
void CALLBACK MACRO_ExecProgram(LPCSTR, LONG);
void CALLBACK MACRO_Exit(void);
void CALLBACK MACRO_ExtAbleItem(LPCSTR, LONG);
void CALLBACK MACRO_ExtInsertItem(LPCSTR, LPCSTR, LPCSTR, LPCSTR, LONG, LONG);
void CALLBACK MACRO_ExtInsertMenu(LPCSTR, LPCSTR, LPCSTR, LONG, LONG);
BOOL CALLBACK MACRO_FileExist(LPCSTR);
void CALLBACK MACRO_FileOpen(void);
void CALLBACK MACRO_Find(void);
void CALLBACK MACRO_Finder(void);
void CALLBACK MACRO_FloatingMenu(void);
void CALLBACK MACRO_Flush(void);
void CALLBACK MACRO_FocusWindow(LPCSTR);
void CALLBACK MACRO_Generate(LPCSTR, LONG, LONG);
void CALLBACK MACRO_GotoMark(LPCSTR);
void CALLBACK MACRO_HelpOn(void);
void CALLBACK MACRO_HelpOnTop(void);
void CALLBACK MACRO_History(void);
void CALLBACK MACRO_IfThen(BOOL, LPCSTR);
void CALLBACK MACRO_IfThenElse(BOOL, LPCSTR, LPCSTR);
BOOL CALLBACK MACRO_InitMPrint(void);
void CALLBACK MACRO_InsertItem(LPCSTR, LPCSTR, LPCSTR, LPCSTR, LONG);
void CALLBACK MACRO_InsertMenu(LPCSTR, LPCSTR, LONG);
BOOL CALLBACK MACRO_IsBook(void);
BOOL CALLBACK MACRO_IsMark(LPCSTR);
BOOL CALLBACK MACRO_IsNotMark(LPCSTR);
void CALLBACK MACRO_JumpContents(LPCSTR, LPCSTR);
void CALLBACK MACRO_JumpContext(LPCSTR, LPCSTR, LONG);
void CALLBACK MACRO_JumpHash(LPCSTR, LPCSTR, LONG);
void CALLBACK MACRO_JumpHelpOn(void);
void CALLBACK MACRO_JumpID(LPCSTR, LPCSTR, LPCSTR);
void CALLBACK MACRO_JumpKeyword(LPCSTR, LPCSTR, LPCSTR);
void CALLBACK MACRO_KLink(LPCSTR, LONG, LPCSTR, LPCSTR);
void CALLBACK MACRO_Menu(void);
void CALLBACK MACRO_MPrintHash(LONG);
void CALLBACK MACRO_MPrintID(LPCSTR);
void CALLBACK MACRO_Next(void);
void CALLBACK MACRO_NoShow(void);
void CALLBACK MACRO_PopupContext(LPCSTR, LONG);
void CALLBACK MACRO_PopupHash(LPCSTR, LONG);
void CALLBACK MACRO_PopupId(LPCSTR, LPCSTR);
void CALLBACK MACRO_PositionWindow(LONG, LONG, LONG, LONG, LONG, LPCSTR);
void CALLBACK MACRO_Prev(void);
void CALLBACK MACRO_Print(void);
void CALLBACK MACRO_PrinterSetup(void);
void CALLBACK MACRO_RegisterRoutine(LPCSTR, LPCSTR, LPCSTR);
void CALLBACK MACRO_RemoveAccelerator(LONG, LONG);
void CALLBACK MACRO_ResetMenu(void);
void CALLBACK MACRO_SaveMark(LPCSTR);
void CALLBACK MACRO_Search(void);
void CALLBACK MACRO_SetContents(LPCSTR, LONG);
void CALLBACK MACRO_SetHelpOnFile(LPCSTR);
void CALLBACK MACRO_SetPopupColor(LONG, LONG, LONG);
void CALLBACK MACRO_ShellExecute(LPCSTR, LPCSTR, LONG, LONG, LPCSTR, LPCSTR);
void CALLBACK MACRO_ShortCut(LPCSTR, LPCSTR, LONG, LONG, LPCSTR);
void CALLBACK MACRO_TCard(LONG);
void CALLBACK MACRO_Test(LONG);
BOOL CALLBACK MACRO_TestALink(LPCSTR);
BOOL CALLBACK MACRO_TestKLink(LPCSTR);
void CALLBACK MACRO_UncheckItem(LPCSTR);
void CALLBACK MACRO_UpdateWindow(LPCSTR, LPCSTR);
/* Local Variables: */
/* c-file-style: "GNU" */
......
......@@ -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
......@@ -173,7 +173,7 @@ static int MACRO_CheckArgs(void* pa[], unsigned max, const char* args)
case 'B':
if (t != BOOL_FUNCTION)
{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;
break;
default:
......@@ -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
* 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];
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)
*
*
*/
static int MACRO_CallVoidFunc(void (*fn)(), const char* args)
static int MACRO_CallVoidFunc(FARPROC fn, const char* args)
{
void* pa[6];
int idx = MACRO_CheckArgs(pa, sizeof(pa)/sizeof(pa[0]), args);
......@@ -229,7 +229,7 @@ static int MACRO_CallVoidFunc(void (*fn)(), const char* args)
if (idx == -1) return 0;
if (!fn) return 1;
WINE_TRACE("calling with %u pmts\n", idx);
WINE_TRACE("calling %p with %u pmts\n", fn, idx);
switch (idx)
{
......@@ -260,7 +260,7 @@ BOOL MACRO_ExecuteMacro(LPCSTR macro)
{
case VOID_FUNCTION:
WINE_TRACE("got type void func(%s)\n", yylval.proto);
MACRO_CallVoidFunc(yylval.void_function, yylval.proto);
MACRO_CallVoidFunc(yylval.function, yylval.proto);
break;
case BOOL_FUNCTION:
WINE_WARN("got type bool func(%s)\n", yylval.proto);
......
......@@ -54,7 +54,7 @@ static void WINHELP_DeleteWindow(WINHELP_WINDOW*);
static void WINHELP_SetupText(HWND hWnd);
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)
*
*
*/
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;
......@@ -165,6 +165,7 @@ int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE prev, LPSTR cmdline, int show)
LONG lHash = 0;
HLPFILE* hlpfile;
CHAR* quote;
WINHELP_DLL* dll;
Globals.hInstance = hInstance;
......@@ -205,7 +206,12 @@ int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE prev, LPSTR cmdline, int show)
}
/* Create primary window */
WINHELP_RegisterWinClasses();
if (!WINHELP_RegisterWinClasses())
{
WINE_FIXME("Couldn't register classes\n");
return 0;
}
if (*cmdline)
{
if ((*cmdline == '"') && (quote = strchr(cmdline+1, '"')))
......@@ -226,6 +232,10 @@ int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE prev, LPSTR cmdline, int show)
TranslateMessage(&msg);
DispatchMessage(&msg);
}
for (dll = Globals.dlls; dll; dll = dll->next)
{
if (dll->class & DC_INITTERM) dll->handler(DW_TERM, 0, 0);
}
return 0;
}
......@@ -473,7 +483,7 @@ BOOL WINHELP_CreateHelpWindow(HLPFILE_PAGE* page, HLPFILE_WINDOWINFO* wi,
sizeof(WINHELP_WINDOW) + strlen(wi->name) + 1);
if (!win) return FALSE;
win->next = Globals.win_list;
win->next = Globals.win_list;
Globals.win_list = win;
win->lpszName = (char*)win + sizeof(WINHELP_WINDOW);
......@@ -544,9 +554,10 @@ BOOL WINHELP_CreateHelpWindow(HLPFILE_PAGE* page, HLPFILE_WINDOWINFO* wi,
}
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,
0, bPrimary ? LoadMenu(Globals.hInstance, MAKEINTRESOURCE(MAIN_MENU)) : 0,
NULL, bPrimary ? LoadMenu(Globals.hInstance, MAKEINTRESOURCE(MAIN_MENU)) : 0,
Globals.hInstance, win);
ShowWindow(hWnd, nCmdShow);
......@@ -965,7 +976,7 @@ static LRESULT CALLBACK WINHELP_TextWndProc(HWND hWnd, UINT msg, WPARAM wParam,
if (CurPos > Max)
CurPos = Max;
else if (CurPos < Min)
CurPos = Min;
CurPos = Min;
dy = GetScrollPos(hWnd, SB_VERT) - CurPos;
SetScrollPos(hWnd, SB_VERT, CurPos, TRUE);
ScrollWindow(hWnd, 0, dy, NULL, NULL);
......
......@@ -122,6 +122,36 @@ typedef struct tagWinHelp
struct tagWinHelp* next;
} 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
{
UINT wVersion;
......@@ -132,9 +162,11 @@ typedef struct
WINHELP_WINDOW* active_win;
WINHELP_WINDOW* win_list;
WNDPROC button_proc;
WINHELP_DLL* dlls;
} WINHELP_GLOBALS;
extern WINHELP_GLOBALS Globals;
extern FARPROC Callbacks[];
BOOL WINHELP_CreateHelpWindowByHash(HLPFILE*, LONG, 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