Rewrote macro engine for adding dynamic macro loading capability.

Wrote RegisterRoutine and IsBook macros.
This commit is contained in:
Eric Pouech 2002-11-15 01:34:57 +00:00 committed by Alexandre Julliard
parent bc71031240
commit 81b7b9126e
8 changed files with 634 additions and 525 deletions

View File

@ -4,5 +4,3 @@ lex.yy.c
rsrc.res
winhelp.exe.dbg.c
winhelp.exe.spec.c
y.tab.c
y.tab.h

View File

@ -14,8 +14,9 @@ C_SRCS = \
macro.c \
string.c
EXTRA_SRCS = macro.yacc.y macro.lex.l
EXTRA_OBJS = y.tab.o @LEX_OUTPUT_ROOT@.o
EXTRA_SRCS = macro.lex.l
EXTRA_OBJS = @LEX_OUTPUT_ROOT@.o
WRCFLAGS = -DWINELIB
RC_SRCS = rsrc.rc
@ -26,12 +27,7 @@ all: $(PROGRAMS)
hlp2sgml: hlp2sgml.o hlpfile.o
$(CC) -o hlp2sgml hlp2sgml.o hlpfile.o
y.tab.c y.tab.h: macro.yacc.y
$(YACC) -d -t $(SRCDIR)/macro.yacc.y
@LEX_OUTPUT_ROOT@.c: macro.lex.l
$(LEX) -8 -i $(SRCDIR)/macro.lex.l
@LEX_OUTPUT_ROOT@.o: y.tab.h
### Dependencies:

View File

@ -2,6 +2,7 @@
* Help Viewer
*
* Copyright 1996 Ulrich Schmid
* Copyright 2002 Eric Pouech
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@ -18,16 +19,171 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <stdio.h>
#include "windows.h"
#include "commdlg.h"
#include "winhelp.h"
#include "macro.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(winhelp);
/**************************************************/
/* Macro table */
/**************************************************/
struct MacroDesc {
char* name;
char* alias;
BOOL isBool;
char* arguments;
void (*fn)();
};
/* types:
* U: 32 bit unsigned int
* I: 32 bit signed int
* S: string
* v: unknown (32 bit entity)
*/
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},
{NULL, NULL, 0, NULL, NULL}
};
static struct MacroDesc*MACRO_Loaded /* = NULL */;
static unsigned MACRO_NumLoaded /* = 0 */;
static int MACRO_DoLookUp(struct MacroDesc* start, const char* name, struct lexret* lr, unsigned len)
{
struct MacroDesc* md;
for (md = start; md->name && len != 0; md++, len--)
{
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;
}
}
}
return EMPTY;
}
int MACRO_Lookup(const char* name, struct lexret* lr)
{
int ret;
if ((ret = MACRO_DoLookUp(MACRO_Builtins, name, lr, -1)) != EMPTY)
return ret;
if (MACRO_Loaded && (ret = MACRO_DoLookUp(MACRO_Loaded, name, lr, MACRO_NumLoaded)) != EMPTY)
return ret;
lr->string = name;
return IDENTIFIER;
}
/******* helper functions *******/
WINHELP_BUTTON** MACRO_LookupButton(WINHELP_WINDOW* win, LPCSTR name)
{
WINHELP_BUTTON** b;
@ -41,51 +197,53 @@ WINHELP_BUTTON** MACRO_LookupButton(WINHELP_WINDOW* win, LPCSTR name)
void MACRO_About(void)
{
WINE_FIXME("About()\n");
WINE_FIXME("()\n");
}
void MACRO_AddAccelerator(LONG u1, LONG u2, LPCSTR str)
{
WINE_FIXME("AddAccelerator(%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)
{
WINE_FIXME("ALink(\"%s\", %lu, \"%s\")\n", str1, u, str2);
WINE_FIXME("(\"%s\", %lu, \"%s\")\n", str1, u, str2);
}
void MACRO_Annotate(void)
{
WINE_FIXME("Annotate()\n");
WINE_FIXME("()\n");
}
void MACRO_AppendItem(LPCSTR str1, LPCSTR str2, LPCSTR str3, LPCSTR str4)
{
WINE_FIXME("AppendItem(\"%s\", \"%s\", \"%s\", \"%s\")\n", str1, str2, str3, str4);
WINE_FIXME("(\"%s\", \"%s\", \"%s\", \"%s\")\n", str1, str2, str3, str4);
}
void MACRO_Back(void)
{
WINE_FIXME("Back()\n");
WINE_FIXME("()\n");
}
void MACRO_BackFlush(void)
{
WINE_FIXME("BackFlush()\n");
WINE_FIXME("()\n");
}
void MACRO_BookmarkDefine(void)
{
WINE_FIXME("BookmarkDefine()\n");
WINE_FIXME("()\n");
}
void MACRO_BookmarkMore(void)
{
WINE_FIXME("BookmarkMore()\n");
WINE_FIXME("()\n");
}
void MACRO_BrowseButtons(void)
{
WINE_TRACE("()\n");
MACRO_CreateButton("BTN_PREV", "&<<", "Prev()");
MACRO_CreateButton("BTN_NEXT", "&>>", "Next()");
}
@ -98,6 +256,8 @@ void MACRO_ChangeButtonBinding(LPCSTR id, LPCSTR macro)
LONG size;
LPSTR ptr;
WINE_TRACE("(\"%s\", \"%s\")\n", id, macro);
b = MACRO_LookupButton(win, id);
if (!*b) {WINE_FIXME("Couldn't find button '%s'\n", id); return;}
@ -131,23 +291,27 @@ void MACRO_ChangeButtonBinding(LPCSTR id, LPCSTR macro)
void MACRO_ChangeEnable(LPCSTR id, LPCSTR macro)
{
WINE_TRACE("(\"%s\", \"%s\")\n", id, macro);
MACRO_ChangeButtonBinding(id, macro);
MACRO_EnableButton(id);
}
void MACRO_ChangeItemBinding(LPCSTR str1, LPCSTR str2)
{
WINE_FIXME("ChangeItemBinding(\"%s\", \"%s\")\n", str1, str2);
WINE_FIXME("(\"%s\", \"%s\")\n", str1, str2);
}
void MACRO_CheckItem(LPCSTR str)
{
WINE_FIXME("CheckItem(\"%s\")\n", str);
WINE_FIXME("(\"%s\")\n", str);
}
void MACRO_CloseSecondarys(void)
{
WINHELP_WINDOW *win;
WINE_TRACE("()\n");
for (win = Globals.win_list; win; win = win->next)
if (win->lpszName && lstrcmpi(win->lpszName, "main"))
DestroyWindow(win->hMainWnd);
@ -156,6 +320,9 @@ void MACRO_CloseSecondarys(void)
void MACRO_CloseWindow(LPCSTR lpszWindow)
{
WINHELP_WINDOW *win;
WINE_TRACE("(\"%s\")\n", lpszWindow);
if (!lpszWindow || !lpszWindow[0]) lpszWindow = "main";
for (win = Globals.win_list; win; win = win->next)
@ -165,28 +332,30 @@ void MACRO_CloseWindow(LPCSTR lpszWindow)
void MACRO_Compare(LPCSTR str)
{
WINE_FIXME("Compare(\"%s\")\n", str);
WINE_FIXME("(\"%s\")\n", str);
}
void MACRO_Contents(void)
{
WINE_TRACE("()\n");
if (Globals.active_win->page)
MACRO_JumpContents(Globals.active_win->page->file->lpszPath, NULL);
}
void MACRO_ControlPanel(LPCSTR str1, LPCSTR str2, LONG u)
{
WINE_FIXME("ControlPanel(\"%s\", \"%s\", %lu)\n", str1, str2, u);
WINE_FIXME("(\"%s\", \"%s\", %lu)\n", str1, str2, u);
}
void MACRO_CopyDialog(void)
{
WINE_FIXME("CopyDialog()\n");
WINE_FIXME("()\n");
}
void MACRO_CopyTopic(void)
{
WINE_FIXME("CopyTopic()\n");
WINE_FIXME("()\n");
}
void MACRO_CreateButton(LPCSTR id, LPCSTR name, LPCSTR macro)
@ -196,6 +365,8 @@ void MACRO_CreateButton(LPCSTR id, LPCSTR name, LPCSTR macro)
LONG size;
LPSTR ptr;
WINE_TRACE("(\"%s\", \"%s\", %s)\n", id, name, macro);
size = sizeof(WINHELP_BUTTON) + lstrlen(id) + lstrlen(name) + lstrlen(macro) + 3;
button = HeapAlloc(GetProcessHeap(), 0, size);
@ -227,23 +398,25 @@ void MACRO_CreateButton(LPCSTR id, LPCSTR name, LPCSTR macro)
void MACRO_DeleteItem(LPCSTR str)
{
WINE_FIXME("DeleteItem(\"%s\")\n", str);
WINE_FIXME("(\"%s\")\n", str);
}
void MACRO_DeleteMark(LPCSTR str)
{
WINE_FIXME("DeleteMark(\"%s\")\n", str);
WINE_FIXME("(\"%s\")\n", str);
}
void MACRO_DestroyButton(LPCSTR str)
{
WINE_FIXME("DestroyButton(\"%s\")\n", str);
WINE_FIXME("(\"%s\")\n", str);
}
void MACRO_DisableButton(LPCSTR id)
{
WINHELP_BUTTON** b;
WINE_FIXME("(\"%s\")\n", id);
b = MACRO_LookupButton(Globals.active_win, id);
if (!*b) {WINE_FIXME("Couldn't find button '%s'\n", id); return;}
@ -252,13 +425,15 @@ void MACRO_DisableButton(LPCSTR id)
void MACRO_DisableItem(LPCSTR str)
{
WINE_FIXME("DisableItem(\"%s\")\n", str);
WINE_FIXME("(\"%s\")\n", str);
}
void MACRO_EnableButton(LPCSTR id)
{
WINHELP_BUTTON** b;
WINE_TRACE("(\"%s\")\n", id);
b = MACRO_LookupButton(Globals.active_win, id);
if (!*b) {WINE_FIXME("Couldn't find button '%s'\n", id); return;}
@ -267,47 +442,50 @@ void MACRO_EnableButton(LPCSTR id)
void MACRO_EnableItem(LPCSTR str)
{
WINE_FIXME("EnableItem(\"%s\")\n", str);
WINE_FIXME("(\"%s\")\n", str);
}
void MACRO_EndMPrint(void)
{
WINE_FIXME("EndMPrint()\n");
WINE_FIXME("()\n");
}
void MACRO_ExecFile(LPCSTR str1, LPCSTR str2, LONG u, LPCSTR str3)
{
WINE_FIXME("ExecFile(\"%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)
{
WINE_FIXME("ExecProgram(\"%s\", %lu)\n", str, u);
WINE_FIXME("(\"%s\", %lu)\n", str, u);
}
void MACRO_Exit(void)
{
WINE_TRACE("()\n");
while (Globals.win_list)
DestroyWindow(Globals.win_list->hMainWnd);
}
void MACRO_ExtAbleItem(LPCSTR str, LONG u)
{
WINE_FIXME("ExtAbleItem(\"%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)
{
WINE_FIXME("ExtInsertItem(\"%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)
{
WINE_FIXME("ExtInsertMenu(\"%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)
{
WINE_TRACE("(\"%s\")\n", str);
return GetFileAttributes(str) != 0xFFFFFFFF;
}
@ -319,6 +497,8 @@ void MACRO_FileOpen(void)
CHAR szzFilter[2 * MAX_STRING_LEN + 100];
LPSTR p = szzFilter;
WINE_TRACE("()\n");
LoadString(Globals.hInstance, STID_HELP_FILES_HLP, p, MAX_STRING_LEN);
p += strlen(p) + 1;
lstrcpy(p, "*.hlp");
@ -360,171 +540,198 @@ void MACRO_FileOpen(void)
void MACRO_Find(void)
{
WINE_FIXME("Find()\n");
WINE_FIXME("()\n");
}
void MACRO_Finder(void)
{
WINE_FIXME("Finder()\n");
WINE_FIXME("()\n");
}
void MACRO_FloatingMenu(void)
{
WINE_FIXME("FloatingMenu()\n");
WINE_FIXME("()\n");
}
void MACRO_Flush(void)
{
WINE_FIXME("Flush()\n");
WINE_FIXME("()\n");
}
void MACRO_FocusWindow(LPCSTR str)
void MACRO_FocusWindow(LPCSTR lpszWindow)
{
WINE_FIXME("FocusWindow(\"%s\")\n", str);
WINHELP_WINDOW *win;
WINE_TRACE("(\"%s\")\n", lpszWindow);
if (!lpszWindow || !lpszWindow[0]) lpszWindow = "main";
for (win = Globals.win_list; win; win = win->next)
if (win->lpszName && !lstrcmpi(win->lpszName, lpszWindow))
SetFocus(win->hMainWnd);
}
void MACRO_Generate(LPCSTR str, WPARAM w, LPARAM l)
void MACRO_Generate(LPCSTR str, LONG w, LONG l)
{
WINE_FIXME("Generate(\"%s\", %x, %lx)\n", str, w, l);
WINE_FIXME("(\"%s\", %lx, %lx)\n", str, w, l);
}
void MACRO_GotoMark(LPCSTR str)
{
WINE_FIXME("GotoMark(\"%s\")\n", str);
WINE_FIXME("(\"%s\")\n", str);
}
void MACRO_HelpOn(void)
{
WINE_TRACE("()\n");
MACRO_JumpContents((Globals.wVersion > 4) ? "winhelp32.hlp" : "winhelp.hlp", NULL);
}
void MACRO_HelpOnTop(void)
{
WINE_FIXME("HelpOnTop()\n");
WINE_FIXME("()\n");
}
void MACRO_History(void)
{
WINE_FIXME("History()\n");
WINE_FIXME("()\n");
}
void MACRO_IfThen(BOOL b, LPCSTR t)
{
if (b) MACRO_ExecuteMacro(t);
}
void MACRO_IfThenElse(BOOL b, LPCSTR t, LPCSTR f)
{
if (b) MACRO_ExecuteMacro(t); else MACRO_ExecuteMacro(f);
}
BOOL MACRO_InitMPrint(void)
{
WINE_FIXME("InitMPrint()\n");
WINE_FIXME("()\n");
return FALSE;
}
void MACRO_InsertItem(LPCSTR str1, LPCSTR str2, LPCSTR str3, LPCSTR str4, LONG u)
{
WINE_FIXME("InsertItem(\"%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)
{
WINE_FIXME("InsertMenu(\"%s\", \"%s\", %lu)\n", str1, str2, u);
WINE_FIXME("(\"%s\", \"%s\", %lu)\n", str1, str2, u);
}
BOOL MACRO_IsBook(void)
{
WINE_FIXME("IsBook()\n");
return TRUE;
WINE_TRACE("()\n");
return Globals.isBook;
}
BOOL MACRO_IsMark(LPCSTR str)
{
WINE_FIXME("IsMark(\"%s\")\n", str);
WINE_FIXME("(\"%s\")\n", str);
return FALSE;
}
BOOL MACRO_IsNotMark(LPCSTR str)
{
WINE_FIXME("IsNotMark(\"%s\")\n", str);
WINE_FIXME("(\"%s\")\n", str);
return TRUE;
}
void MACRO_JumpContents(LPCSTR lpszPath, LPCSTR lpszWindow)
{
WINE_TRACE("(\"%s\", \"%s\")\n", lpszPath, lpszWindow);
WINHELP_CreateHelpWindowByHash(lpszPath, 0, lpszWindow, FALSE, 0, NULL, SW_NORMAL);
}
void MACRO_JumpContext(LPCSTR lpszPath, LPCSTR lpszWindow, LONG context)
{
WINE_FIXME("JumpContext(\"%s\", \"%s\", %lu)\n", lpszPath, lpszWindow, context);
WINE_FIXME("(\"%s\", \"%s\", %lu)\n", lpszPath, lpszWindow, context);
}
void MACRO_JumpHash(LPCSTR lpszPath, LPCSTR lpszWindow, LONG lHash)
{
WINE_TRACE("(\"%s\", \"%s\", %lu)\n", lpszPath, lpszWindow, lHash);
WINHELP_CreateHelpWindowByHash(lpszPath, lHash, lpszWindow, FALSE, 0, NULL, SW_NORMAL);
}
void MACRO_JumpHelpOn(void)
{
WINE_FIXME("JumpHelpOn()\n");
WINE_FIXME("()\n");
}
/* 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)
{
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)
{
WINE_FIXME("JumpKeyword(\"%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)
{
WINE_FIXME("KLink(\"%s\", %lu, \"%s\", \"%s\")\n", str1, u, str2, str3);
WINE_FIXME("(\"%s\", %lu, \"%s\", \"%s\")\n", str1, u, str2, str3);
}
void MACRO_Menu(void)
{
WINE_FIXME("Menu()\n");
WINE_FIXME("()\n");
}
void MACRO_MPrintHash(LONG u)
{
WINE_FIXME("MPrintHash(%lu)\n", u);
WINE_FIXME("(%lu)\n", u);
}
void MACRO_MPrintID(LPCSTR str)
{
WINE_FIXME("MPrintID(\"%s\")\n", str);
WINE_FIXME("(\"%s\")\n", str);
}
void MACRO_Next(void)
{
WINE_TRACE("()\n");
if (Globals.active_win->page->next)
WINHELP_CreateHelpWindowByPage(Globals.active_win->page->next, "main", FALSE, 0, NULL, SW_NORMAL);
}
void MACRO_NoShow(void)
{
WINE_FIXME("NoShow()\n");
WINE_FIXME("()\n");
}
void MACRO_PopupContext(LPCSTR str, LONG u)
{
WINE_FIXME("PopupContext(\"%s\", %lu)\n", str, u);
WINE_FIXME("(\"%s\", %lu)\n", str, u);
}
void MACRO_PopupHash(LPCSTR str, LONG u)
{
WINE_FIXME("PopupHash(\"%s\", %lu)\n", str, u);
WINE_FIXME("(\"%s\", %lu)\n", str, u);
}
void MACRO_PopupId(LPCSTR str1, LPCSTR str2)
{
WINE_FIXME("PopupId(\"%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)
{
WINE_FIXME("PositionWindow(%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)
{
WINE_TRACE("()\n");
if (Globals.active_win->page->prev)
WINHELP_CreateHelpWindowByPage(Globals.active_win->page->prev, "main", FALSE, 0, NULL, SW_NORMAL);
}
@ -533,6 +740,8 @@ void MACRO_Print(void)
{
PRINTDLG printer;
WINE_TRACE("()\n");
printer.lStructSize = sizeof(printer);
printer.hwndOwner = Globals.active_win->hMainWnd;
printer.hInstance = Globals.hInstance;
@ -560,87 +769,113 @@ void MACRO_Print(void)
void MACRO_PrinterSetup(void)
{
WINE_FIXME("PrinterSetup()\n");
WINE_FIXME("()\n");
}
void MACRO_RegisterRoutine(LPCSTR str1, LPCSTR str2, LPCSTR str3)
void MACRO_RegisterRoutine(LPCSTR dll, LPCSTR proc, LPCSTR args)
{
WINE_FIXME("RegisterRoutine(\"%s\", \"%s\", \"%s\")\n", str1, str2, str3);
HANDLE hLib;
void (*fn)();
WINE_TRACE("(\"%s\", \"%s\", \"%s\")\n", dll, proc, args);
if ((hLib = LoadLibrary(dll)) == NULL)
{
/* FIXME: internationalisation for error messages */
WINE_FIXME("Cannot find dll %s\n", dll);
fn = NULL;
}
else if (!(fn = (void (*)())GetProcAddress(hLib, proc)))
{
/* FIXME: internationalisation for error messages */
WINE_FIXME("Cannot find proc %s in dll %s\n", dll, proc);
fn = NULL;
}
/* FIXME: the library will not be unloaded until exit of program */
MACRO_Loaded = HeapReAlloc(GetProcessHeap(), 0, MACRO_Loaded,
++MACRO_NumLoaded * sizeof(struct MacroDesc));
MACRO_Loaded[MACRO_NumLoaded - 1].name = strdup(proc); /* FIXME */
MACRO_Loaded[MACRO_NumLoaded - 1].alias = NULL;
MACRO_Loaded[MACRO_NumLoaded - 1].isBool = 0;
MACRO_Loaded[MACRO_NumLoaded - 1].arguments = strdup(args); /* FIXME */
MACRO_Loaded[MACRO_NumLoaded - 1].fn = fn;
}
void MACRO_RemoveAccelerator(LONG u1, LONG u2)
{
WINE_FIXME("RemoveAccelerator(%lu, %lu)\n", u1, u2);
WINE_FIXME("(%lu, %lu)\n", u1, u2);
}
void MACRO_ResetMenu(void)
{
WINE_FIXME("ResetMenu()\n");
WINE_FIXME("()\n");
}
void MACRO_SaveMark(LPCSTR str)
{
WINE_FIXME("SaveMark(\"%s\")\n", str);
WINE_FIXME("(\"%s\")\n", str);
}
void MACRO_Search(void)
{
WINE_FIXME("Search()\n");
WINE_FIXME("()\n");
}
void MACRO_SetContents(LPCSTR str, LONG u)
{
WINE_FIXME("SetContents(\"%s\", %lu)\n", str, u);
WINE_FIXME("(\"%s\", %lu)\n", str, u);
}
void MACRO_SetHelpOnFile(LPCSTR str)
{
WINE_FIXME("SetHelpOnFile(\"%s\")\n", str);
WINE_FIXME("(\"%s\")\n", str);
}
void MACRO_SetPopupColor(LONG u1, LONG u2, LONG u3)
{
WINE_FIXME("SetPopupColor(%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)
{
WINE_FIXME("ShellExecute(\"%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, WPARAM w, LPARAM l, LPCSTR str)
void MACRO_ShortCut(LPCSTR str1, LPCSTR str2, LONG w, LONG l, LPCSTR str)
{
WINE_FIXME("ShortCut(\"%s\", \"%s\", %x, %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)
{
WINE_FIXME("TCard(%lu)\n", u);
WINE_FIXME("(%lu)\n", u);
}
void MACRO_Test(LONG u)
{
WINE_FIXME("Test(%lu)\n", u);
WINE_FIXME("(%lu)\n", u);
}
BOOL MACRO_TestALink(LPCSTR str)
{
WINE_FIXME("TestALink(\"%s\")\n", str);
WINE_FIXME("(\"%s\")\n", str);
return FALSE;
}
BOOL MACRO_TestKLink(LPCSTR str)
{
WINE_FIXME("TestKLink(\"%s\")\n", str);
WINE_FIXME("(\"%s\")\n", str);
return FALSE;
}
void MACRO_UncheckItem(LPCSTR str)
{
WINE_FIXME("UncheckItem(\"%s\")\n", str);
WINE_FIXME("(\"%s\")\n", str);
}
void MACRO_UpdateWindow(LPCSTR str1, LPCSTR str2)
{
WINE_FIXME("UpdateWindow(\"%s\", \"%s\")\n", str1, str2);
WINE_FIXME("(\"%s\", \"%s\")\n", str1, str2);
}

View File

@ -2,6 +2,7 @@
* Help Viewer
*
* Copyright 1996 Ulrich Schmid
* Copyright 2002 Eric Pouech
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@ -18,108 +19,115 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "winnt.h"
#include "windef.h"
#include "winbase.h"
#include "winuser.h"
#include "wingdi.h"
#include "shellapi.h"
VOID MACRO_ExecuteMacro(LPCSTR);
struct lexret {
LPCSTR proto;
BOOL bool;
LONG integer;
LPCSTR string;
BOOL (*bool_function)();
void (*void_function)();
};
INT yyparse(VOID);
INT yylex(VOID);
VOID yyerror(LPCSTR);
extern struct lexret yylval;
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_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, WPARAM, LPARAM);
VOID MACRO_GotoMark(LPCSTR);
VOID MACRO_HelpOn(VOID);
VOID MACRO_HelpOnTop(VOID);
VOID MACRO_History(VOID);
BOOL MACRO_InitMPrint(VOID);
VOID MACRO_InsertItem(LPCSTR, LPCSTR, LPCSTR, LPCSTR, LONG);
VOID MACRO_InsertMenu(LPCSTR, LPCSTR, LONG);
BOOL MACRO_IsBook(VOID);
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, WPARAM, LPARAM, LPCSTR);
VOID MACRO_TCard(LONG);
VOID MACRO_Test(LONG);
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 MACRO_UncheckItem(LPCSTR);
void MACRO_UpdateWindow(LPCSTR, LPCSTR);
/* Local Variables: */
/* c-file-style: "GNU" */

View File

@ -3,6 +3,7 @@
* Help Viewer
*
* Copyright 1996 Ulrich Schmid
* Copyright 2002 Eric Pouech
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@ -23,7 +24,6 @@
%{
#include <assert.h>
#include "macro.h"
#include "y.tab.h"
#include "wine/debug.h"
@ -33,6 +33,7 @@ static LPCSTR macroptr;
static LPSTR strptr;
static int quote_stack[32];
static int quote_stk_idx = 0;
struct lexret yylval;
#define YY_INPUT(buf,result,max_size)\
if ((result = *macroptr ? 1 : 0)) buf[0] = *macroptr++;
@ -40,145 +41,57 @@ static int quote_stk_idx = 0;
#define YY_NO_UNPUT
%}
%%
About yylval.void_function_void = MACRO_About; return VOID_FUNCTION_VOID;
AddAccelerator|AA yylval.void_function_2uint_string = MACRO_AddAccelerator; return VOID_FUNCTION_2UINT_STRING;
ALink|AL yylval.void_function_string_uint_string = MACRO_ALink; return VOID_FUNCTION_STRING_UINT_STRING;
Annotate yylval.void_function_void = MACRO_Annotate; return VOID_FUNCTION_VOID;
AppendItem yylval.void_function_4string = MACRO_AppendItem; return VOID_FUNCTION_4STRING;
Back yylval.void_function_void = MACRO_Back; return VOID_FUNCTION_VOID;
BackFlush|BF yylval.void_function_void = MACRO_BackFlush; return VOID_FUNCTION_VOID;
BookmarkDefine yylval.void_function_void = MACRO_BookmarkDefine; return VOID_FUNCTION_VOID;
BookmarkMore yylval.void_function_void = MACRO_BookmarkMore; return VOID_FUNCTION_VOID;
BrowseButtons yylval.void_function_void = MACRO_BrowseButtons; return VOID_FUNCTION_VOID;
ChangeButtonBinding|CBB yylval.void_function_2string = MACRO_ChangeButtonBinding; return VOID_FUNCTION_2STRING;
ChangeEnable|CE yylval.void_function_2string = MACRO_ChangeEnable; return VOID_FUNCTION_2STRING;
ChangeItemBinding|CIB yylval.void_function_2string = MACRO_ChangeItemBinding; return VOID_FUNCTION_2STRING;
CheckItem|CI yylval.void_function_string = MACRO_CheckItem; return VOID_FUNCTION_STRING;
CloseSecondarys|CS yylval.void_function_void = MACRO_CloseSecondarys; return VOID_FUNCTION_VOID;
CloseWindow|CW yylval.void_function_string = MACRO_CloseWindow; return VOID_FUNCTION_STRING;
Compare yylval.void_function_string = MACRO_Compare; return VOID_FUNCTION_STRING;
Contents yylval.void_function_void = MACRO_Contents; return VOID_FUNCTION_VOID;
ControlPanel yylval.void_function_2string_uint = MACRO_ControlPanel; return VOID_FUNCTION_2STRING_UINT;
CopyDialog yylval.void_function_void = MACRO_CopyDialog; return VOID_FUNCTION_VOID;
CopyTopic|CT yylval.void_function_void = MACRO_CopyTopic; return VOID_FUNCTION_VOID;
CreateButton|CB yylval.void_function_3string = MACRO_CreateButton; return VOID_FUNCTION_3STRING;
DeleteItem yylval.void_function_string = MACRO_DeleteItem; return VOID_FUNCTION_STRING;
DeleteMark yylval.void_function_string = MACRO_DeleteMark; return VOID_FUNCTION_STRING;
DestroyButton yylval.void_function_string = MACRO_DestroyButton; return VOID_FUNCTION_STRING;
DisableButton|DB yylval.void_function_string = MACRO_DisableButton; return VOID_FUNCTION_STRING;
DisableItem|DI yylval.void_function_string = MACRO_DisableItem; return VOID_FUNCTION_STRING;
EnableButton|EB yylval.void_function_string = MACRO_EnableButton; return VOID_FUNCTION_STRING;
EnableItem|EI yylval.void_function_string = MACRO_EnableItem; return VOID_FUNCTION_STRING;
EndMPrint yylval.void_function_void = MACRO_EndMPrint; return VOID_FUNCTION_VOID;
ExecFile|EF yylval.void_function_2string_uint_string = MACRO_ExecFile; return VOID_FUNCTION_2STRING_UINT_STRING;
ExecProgram|EP yylval.void_function_string_uint = MACRO_ExecProgram; return VOID_FUNCTION_STRING_UINT;
Exit yylval.void_function_void = MACRO_Exit; return VOID_FUNCTION_VOID;
ExtAbleItem yylval.void_function_string_uint = MACRO_ExtAbleItem; return VOID_FUNCTION_STRING_UINT;
ExtInsertItem yylval.void_function_4string_2uint = MACRO_ExtInsertItem; return VOID_FUNCTION_4STRING_2UINT;
ExtInsertMenu yylval.void_function_3string_2uint = MACRO_ExtInsertMenu; return VOID_FUNCTION_3STRING_2UINT;
FileExist|FE yylval.bool_function_string = MACRO_FileExist; return BOOL_FUNCTION_STRING;
FileOpen|FO yylval.void_function_void = MACRO_FileOpen; return VOID_FUNCTION_VOID;
Find yylval.void_function_void = MACRO_Find; return VOID_FUNCTION_VOID;
Finder|FD yylval.void_function_void = MACRO_Finder; return VOID_FUNCTION_VOID;
FloatingMenu yylval.void_function_void = MACRO_FloatingMenu; return VOID_FUNCTION_VOID;
Flush|FH yylval.void_function_void = MACRO_Flush; return VOID_FUNCTION_VOID;
FocusWindow yylval.void_function_string = MACRO_FocusWindow; return VOID_FUNCTION_STRING;
Generate yylval.void_function_string_wparam_lparam = MACRO_Generate; return VOID_FUNCTION_STRING_WPARAM_LPARAM;
GotoMark yylval.void_function_string = MACRO_GotoMark; return VOID_FUNCTION_STRING;
HelpOn yylval.void_function_void = MACRO_HelpOn; return VOID_FUNCTION_VOID;
HelpOnTop yylval.void_function_void = MACRO_HelpOnTop; return VOID_FUNCTION_VOID;
History yylval.void_function_void = MACRO_History; return VOID_FUNCTION_VOID;
IfThen|IF return IF_THEN;
IfThenElse|IE return IF_THEN_ELSE;
InitMPrint yylval.bool_function_void = MACRO_InitMPrint; return BOOL_FUNCTION_VOID;
InsertItem yylval.void_function_4string_uint = MACRO_InsertItem; return VOID_FUNCTION_4STRING_UINT;
InsertMenu yylval.void_function_2string_uint = MACRO_InsertMenu; return VOID_FUNCTION_2STRING_UINT;
IsBook yylval.bool_function_void = MACRO_IsBook; return BOOL_FUNCTION_VOID;
IsMark yylval.bool_function_string = MACRO_IsMark; return BOOL_FUNCTION_STRING;
IsNotMark|NM yylval.bool_function_string = MACRO_IsNotMark; return BOOL_FUNCTION_STRING;
JumpContents yylval.void_function_2string = MACRO_JumpContents; return VOID_FUNCTION_FILE_WIN;
JumpContext|JC yylval.void_function_2string_uint = MACRO_JumpContext; return VOID_FUNCTION_FILE_WIN_UINT;
JumpHash|JH yylval.void_function_2string_uint = MACRO_JumpHash; return VOID_FUNCTION_FILE_WIN_UINT;
JumpHelpOn yylval.void_function_void = MACRO_JumpHelpOn; return VOID_FUNCTION_VOID;
JumpID|JI yylval.void_function_3string = MACRO_JumpID; return VOID_FUNCTION_FILE_WIN_STRING;
JumpKeyword|JK yylval.void_function_3string = MACRO_JumpKeyword; return VOID_FUNCTION_FILE_WIN_STRING;
KLink|KL yylval.void_function_string_uint_2string = MACRO_KLink; return VOID_FUNCTION_STRING_UINT_2STRING;
Menu|MU yylval.void_function_void = MACRO_Menu; return VOID_FUNCTION_VOID;
MPrintHash yylval.void_function_uint = MACRO_MPrintHash; return VOID_FUNCTION_UINT;
MPrintID yylval.void_function_string = MACRO_MPrintID; return VOID_FUNCTION_STRING;
Next yylval.void_function_void = MACRO_Next; return VOID_FUNCTION_VOID;
NoShow yylval.void_function_void = MACRO_NoShow; return VOID_FUNCTION_VOID;
Not return NOT;
PopupContext|PC yylval.void_function_string_uint = MACRO_PopupContext; return VOID_FUNCTION_STRING_UINT;
PopupHash yylval.void_function_string_uint = MACRO_PopupHash; return VOID_FUNCTION_STRING_UINT;
PopupId|PI yylval.void_function_2string = MACRO_PopupId; return VOID_FUNCTION_2STRING;
PositionWindow|PW yylval.void_function_2int_3uint_string = MACRO_PositionWindow; return VOID_FUNCTION_2INT_3UINT_STRING;
Prev yylval.void_function_void = MACRO_Prev; return VOID_FUNCTION_VOID;
Print yylval.void_function_void = MACRO_Print; return VOID_FUNCTION_VOID;
PrinterSetup yylval.void_function_void = MACRO_PrinterSetup; return VOID_FUNCTION_VOID;
RegisterRoutine|RR yylval.void_function_3string = MACRO_RegisterRoutine; return VOID_FUNCTION_3STRING;
RemoveAccelerator|RA yylval.void_function_2uint = MACRO_RemoveAccelerator; return VOID_FUNCTION_2UINT;
ResetMenu yylval.void_function_void = MACRO_ResetMenu; return VOID_FUNCTION_VOID;
SaveMark yylval.void_function_string = MACRO_SaveMark; return VOID_FUNCTION_STRING;
Search yylval.void_function_void = MACRO_Search; return VOID_FUNCTION_VOID;
SetContents yylval.void_function_string_uint = MACRO_SetContents; return VOID_FUNCTION_STRING_UINT;
SetHelpOnFile yylval.void_function_string = MACRO_SetHelpOnFile; return VOID_FUNCTION_STRING;
SetPopupColor|SPC yylval.void_function_3uint = MACRO_SetPopupColor; return VOID_FUNCTION_3UINT;
ShellExecute|SE yylval.void_function_2string_2uint_2string = MACRO_ShellExecute; return VOID_FUNCTION_2STRING_2UINT_2STRING;
ShortCut|SH yylval.void_function_2string_wparam_lparam_string = MACRO_ShortCut; return VOID_FUNCTION_2STRING_WPARAM_LPARAM_STRING;
TCard yylval.void_function_uint = MACRO_TCard; return VOID_FUNCTION_UINT;
Test yylval.void_function_uint = MACRO_Test; return VOID_FUNCTION_UINT;
TestALink yylval.bool_function_string = MACRO_TestALink; return BOOL_FUNCTION_STRING;
TestKLink yylval.bool_function_string = MACRO_TestKLink; return BOOL_FUNCTION_STRING;
UncheckItem|UI yylval.void_function_string = MACRO_UncheckItem; return VOID_FUNCTION_STRING;
UpdateWindow|UW yylval.void_function_2string = MACRO_UpdateWindow; return VOID_FUNCTION_2STRING;
[-+]?[0-9]+ yylval.integer = strtol(yytext, NULL, 10); return INTEGER;
[-+]?[0-9]+ yylval.integer = strtol(yytext, NULL, 10); return INTEGER;
[-+]?0[xX][0-9a-f]+ yylval.integer = strtol(yytext, NULL, 16); return INTEGER;
[a-zA-Z][_0-9a-zA-Z]* return MACRO_Lookup(yytext, &yylval);
\` |
\" |
\' |
<quote>\` |
<quote>\" |
<quote>\' {
if (quote_stk_idx == 0 ||
(yytext[0] == '\"' && quote_stack[quote_stk_idx - 1] != '\"') ||
(yytext[0] == '`'))
{
/* opening a new one */
if (quote_stk_idx == 0)
{
strptr = HeapAlloc(GetProcessHeap(), 0, strlen(macroptr) + 1);
yylval.string = strptr;
BEGIN(quote);
}
else *strptr++ = yytext[0];
quote_stack[quote_stk_idx++] = yytext[0];
assert(quote_stk_idx < sizeof(quote_stack) / sizeof(quote_stack[0]));
}
else
{
if (yytext[0] == '`') assert(0);
/* close the current quote */
if (--quote_stk_idx == 0)
{
BEGIN INITIAL;
*strptr++ = '\0';
return tSTRING;
}
else *strptr++ = yytext[0];
}
}
\` |
\" |
\' |
<quote>\` |
<quote>\" |
<quote>\' {
if (quote_stk_idx == 0 ||
(yytext[0] == '\"' && quote_stack[quote_stk_idx - 1] != '\"') ||
(yytext[0] == '`'))
{
/* opening a new one */
if (quote_stk_idx == 0)
{
strptr = HeapAlloc(GetProcessHeap(), 0, strlen(macroptr) + 1);
yylval.string = strptr;
BEGIN(quote);
}
else *strptr++ = yytext[0];
quote_stack[quote_stk_idx++] = yytext[0];
assert(quote_stk_idx < sizeof(quote_stack) / sizeof(quote_stack[0]));
}
else
{
if (yytext[0] == '`') assert(0);
/* close the current quote */
if (--quote_stk_idx == 0)
{
BEGIN INITIAL;
*strptr++ = '\0';
return STRING;
}
else *strptr++ = yytext[0];
}
}
<quote>. *strptr++ = yytext[0];
<quote>\\. *strptr++ = yytext[1];
<quote><<EOF>> return 0;
<quote>. *strptr++ = yytext[0];
<quote>\\. *strptr++ = yytext[1];
<quote><<EOF>> return 0;
" "
. return yytext[0];
. return yytext[0];
%%
#if 0
/* all code for testing macros */
#include "winhelp.h"
static CHAR szTestMacro[256];
@ -193,20 +106,176 @@ static LRESULT CALLBACK MACRO_TestDialogProc(HWND hDlg, UINT msg, WPARAM wParam,
return FALSE;
}
void MACRO_ExecuteMacro(LPCSTR macro)
void macro_test(void)
{
WINE_TRACE("%s\n", wine_dbgstr_a(macro));
if (!lstrcmpi(macro, "MacroTest"))
WNDPROC lpfnDlg = MakeProcInstance(MACRO_TestDialogProc, Globals.hInstance);
DialogBox(Globals.hInstance, STRING_DIALOG_TEST, Globals.active_win->hMainWnd, (DLGPROC)lpfnDlg);
FreeProcInstance(lpfnDlg);
macro = szTestMacro;
}
#endif
/* small helper function for debug messages */
static const char* ts(int t)
{
static char c[2] = {0,0};
switch (t)
{
WNDPROC lpfnDlg = MakeProcInstance(MACRO_TestDialogProc, Globals.hInstance);
DialogBox(Globals.hInstance, STRING_DIALOG_TEST, Globals.active_win->hMainWnd, (DLGPROC)lpfnDlg);
FreeProcInstance(lpfnDlg);
macro = szTestMacro;
case EMPTY: return "EMPTY";
case VOID_FUNCTION: return "VOID_FUNCTION";
case BOOL_FUNCTION: return "BOOL_FUNCTION";
case INTEGER: return "INTEGER";
case STRING: return "STRING";
case IDENTIFIER: return "IDENTIFIER";
default: c[0] = (char)t; return c;
}
}
static int MACRO_CallBoolFunc(BOOL (*fn)(), const char* args, void** ret);
/******************************************************************
* MACRO_CheckArgs
*
* checks number of arguments against prototype, and stores arguments on
* stack pa for later call
* returns -1 on error, otherwise the number of pushed parameters
*/
static int MACRO_CheckArgs(void* pa[], unsigned max, const char* args)
{
int t;
int idx = 0;
WINE_TRACE("Checking %s\n", args);
if (yylex() != '(') {WINE_WARN("missing (\n");return -1;}
if (*args)
{
for (;;)
{
t = yylex();
WINE_TRACE("Got %s <=> %c\n", ts(t), *args);
switch (*args)
{
case 'S':
if (t != STRING)
{WINE_WARN("missing S\n");return -1;}
pa[idx] = (void*)yylval.string;
break;
case 'U':
case 'I':
if (t != INTEGER)
{WINE_WARN("missing U\n");return -1;}
pa[idx] = (void*)yylval.integer;
break;
case 'B':
if (t != BOOL_FUNCTION)
{WINE_WARN("missing B\n");return -1;}
if (MACRO_CallBoolFunc(yylval.bool_function, yylval.proto, &pa[idx]) == 0)
return -1;
break;
default:
WINE_WARN("unexpected %s while args is %c\n", ts(t), *args);
return -1;
}
idx++;
if (*++args == '\0') break;
if (yylex() != ',') {WINE_WARN("missing ,\n");return -1;}
if (idx == max) {WINE_FIXME("stack overflow (%d)\n", max);return -1;}
}
}
if (yylex() != ')') {WINE_WARN("missing )\n");return -1;}
return idx;
}
/******************************************************************
* MACRO_CallBoolFunc
*
* 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)
{
void* pa[2];
int idx = MACRO_CheckArgs(pa, sizeof(pa)/sizeof(pa[0]), args);
if (idx == -1) return 0;
if (!fn) return 1;
WINE_TRACE("calling with %u pmts\n", idx);
switch (idx)
{
case 0: *ret = (void*)(fn)(); break;
case 1: *ret = (void*)(fn)(pa[0]); break;
default: WINE_FIXME("NIY\n");
}
return 1;
}
/******************************************************************
* MACRO_CallVoidFunc
*
*
*/
static int MACRO_CallVoidFunc(void (*fn)(), const char* args)
{
void* pa[6];
int idx = MACRO_CheckArgs(pa, sizeof(pa)/sizeof(pa[0]), args);
if (idx == -1) return 0;
if (!fn) return 1;
WINE_TRACE("calling with %u pmts\n", idx);
switch (idx)
{
case 0: (fn)(); break;
case 1: (fn)(pa[0]); break;
case 2: (fn)(pa[0],pa[1]); break;
case 3: (fn)(pa[0],pa[1],pa[2]); break;
case 4: (fn)(pa[0],pa[1],pa[2],pa[3]); break;
case 5: (fn)(pa[0],pa[1],pa[2],pa[3],pa[4]); break;
case 6: (fn)(pa[0],pa[1],pa[2],pa[3],pa[4],pa[5]); break;
default: WINE_FIXME("NIY\n");
}
return 1;
}
BOOL MACRO_ExecuteMacro(LPCSTR macro)
{
int t;
WINE_TRACE("%s\n", wine_dbgstr_a(macro));
macroptr = macro;
yyparse();
while ((t = yylex()) != EMPTY)
{
switch (t)
{
case VOID_FUNCTION:
WINE_TRACE("got type void func(%s)\n", yylval.proto);
MACRO_CallVoidFunc(yylval.void_function, yylval.proto);
break;
case BOOL_FUNCTION:
WINE_WARN("got type bool func(%s)\n", yylval.proto);
break;
default:
WINE_WARN("got unexpected type %s\n", ts(t));
return 0;
}
switch (t = yylex())
{
case EMPTY: return 1;
case ';': break;
default: return 0;
}
}
if (strptr)
{
@ -214,19 +283,8 @@ void MACRO_ExecuteMacro(LPCSTR macro)
strptr = NULL;
}
quote_stk_idx = 0;
}
void yyerror(const char *s)
{
WINE_WARN("Error while parsing: %s\n", s);
BEGIN INITIAL;
yyrestart(yyin);
if (strptr)
{
HeapFree(GetProcessHeap(), 0, strptr);
strptr = NULL;
}
quote_stk_idx = 0;
return 1;
}
#ifndef yywrap

View File

@ -1,188 +0,0 @@
%{
/*
* Help Viewer
*
* Copyright 1996 Ulrich Schmid
*
* 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 <stdlib.h>
#include "macro.h"
static int skip = 0;
static LPSTR filename;
static LPSTR windowname;
%}
%union
{
BOOL bool;
LONG integer;
LPSTR string;
BOOL (*bool_function_void)(VOID);
BOOL (*bool_function_string)(LPCSTR);
VOID (*void_function_void)(VOID);
VOID (*void_function_uint)(LONG);
VOID (*void_function_string)(LPCSTR);
VOID (*void_function_2int_3uint_string)(LONG,LONG,LONG,LONG,LONG,LPCSTR);
VOID (*void_function_2string)(LPCSTR,LPCSTR);
VOID (*void_function_2string_2uint_2string)(LPCSTR,LPCSTR,LONG,LONG,LPCSTR,LPCSTR);
VOID (*void_function_2string_uint)(LPCSTR,LPCSTR,LONG);
VOID (*void_function_2string_uint_string)(LPCSTR,LPCSTR,LONG,LPCSTR);
VOID (*void_function_2string_wparam_lparam_string)(LPCSTR,LPCSTR,WPARAM,LPARAM,LPCSTR);
VOID (*void_function_2uint)(LONG,LONG);
VOID (*void_function_2uint_string)(LONG,LONG,LPCSTR);
VOID (*void_function_3string)(LPCSTR,LPCSTR,LPCSTR);
VOID (*void_function_3string_2uint)(LPCSTR,LPCSTR,LPCSTR,LONG,LONG);
VOID (*void_function_3uint)(LONG,LONG,LONG);
VOID (*void_function_4string)(LPCSTR,LPCSTR,LPCSTR,LPCSTR);
VOID (*void_function_4string_2uint)(LPCSTR,LPCSTR,LPCSTR,LPCSTR,LONG,LONG);
VOID (*void_function_4string_uint)(LPCSTR,LPCSTR,LPCSTR,LPCSTR,LONG);
VOID (*void_function_string_uint)(LPCSTR,LONG);
VOID (*void_function_string_uint_2string)(LPCSTR,LONG,LPCSTR,LPCSTR);
VOID (*void_function_string_uint_string)(LPCSTR,LONG,LPCSTR);
VOID (*void_function_string_wparam_lparam)(LPCSTR,WPARAM,LPARAM);
}
%token NOT
%token IF_THEN
%token IF_THEN_ELSE
%token <string> tSTRING
%token <integer> INTEGER
%token <bool_function_string> BOOL_FUNCTION_STRING
%token <bool_function_void> BOOL_FUNCTION_VOID
%token <void_function_2int_3uint_string> VOID_FUNCTION_2INT_3UINT_STRING
%token <void_function_2string> VOID_FUNCTION_2STRING
%token <void_function_2string_2uint_2string> VOID_FUNCTION_2STRING_2UINT_2STRING
%token <void_function_2string_uint> VOID_FUNCTION_2STRING_UINT
%token <void_function_2string_uint_string> VOID_FUNCTION_2STRING_UINT_STRING
%token <void_function_2string_wparam_lparam_string> VOID_FUNCTION_2STRING_WPARAM_LPARAM_STRING
%token <void_function_2uint> VOID_FUNCTION_2UINT
%token <void_function_2uint_string> VOID_FUNCTION_2UINT_STRING
%token <void_function_3string> VOID_FUNCTION_3STRING
%token <void_function_3string_2uint> VOID_FUNCTION_3STRING_2UINT
%token <void_function_3uint> VOID_FUNCTION_3UINT
%token <void_function_4string> VOID_FUNCTION_4STRING
%token <void_function_4string_2uint> VOID_FUNCTION_4STRING_2UINT
%token <void_function_4string_uint> VOID_FUNCTION_4STRING_UINT
%token <void_function_string> VOID_FUNCTION_STRING
%token <void_function_string_uint> VOID_FUNCTION_STRING_UINT
%token <void_function_string_uint_2string> VOID_FUNCTION_STRING_UINT_2STRING
%token <void_function_string_uint_string> VOID_FUNCTION_STRING_UINT_STRING
%token <void_function_string_wparam_lparam> VOID_FUNCTION_STRING_WPARAM_LPARAM
%token <void_function_uint> VOID_FUNCTION_UINT
%token <void_function_void> VOID_FUNCTION_VOID
%token <void_function_2string> VOID_FUNCTION_FILE_WIN
%token <void_function_3string> VOID_FUNCTION_FILE_WIN_STRING
%token <void_function_2string_uint> VOID_FUNCTION_FILE_WIN_UINT
%type <bool> bool_macro
%%
macrostring: macro |
macro macrosep macrostring ;
macrosep: ';' |
':' ;
macro: /* Empty */ |
IF_THEN '(' bool_macro ',' {if (!$3) skip++;}
macrostring ')' {if (!$3) skip--;} |
IF_THEN_ELSE '(' bool_macro ',' {if (!$3) skip++;}
macrostring ',' {if (!$3) skip--; else skip++;}
macrostring ')' {if ( $3) skip--;} |
VOID_FUNCTION_VOID
'(' ')'
{if (!skip) (*$1)();} |
VOID_FUNCTION_STRING
'(' tSTRING ')'
{if (!skip) (*$1)($3);} |
VOID_FUNCTION_2STRING
'(' tSTRING ',' tSTRING ')'
{if (!skip) (*$1)($3, $5);} |
VOID_FUNCTION_2STRING_UINT
'(' tSTRING ',' tSTRING ',' INTEGER ')'
{if (!skip) (*$1)($3, $5, $7);} |
VOID_FUNCTION_2STRING_UINT_STRING
'(' tSTRING ',' tSTRING ',' INTEGER ',' tSTRING ')'
{if (!skip) (*$1)($3, $5, $7, $9);} |
VOID_FUNCTION_2STRING_2UINT_2STRING
'(' tSTRING ',' tSTRING ',' INTEGER ',' INTEGER ',' tSTRING ',' tSTRING ')'
{if (!skip) (*$1)($3, $5, $7, $9, $11, $13);} |
VOID_FUNCTION_2STRING_WPARAM_LPARAM_STRING
'(' tSTRING ',' tSTRING ',' INTEGER ',' INTEGER ',' tSTRING ')'
{if (!skip) (*$1)($3, $5, $7, $9, $11);} |
VOID_FUNCTION_3STRING
'(' tSTRING ',' tSTRING ',' tSTRING ')'
{if (!skip) (*$1)($3, $5, $7);} |
VOID_FUNCTION_3STRING_2UINT
'(' tSTRING ',' tSTRING ',' tSTRING ',' INTEGER ',' INTEGER ')'
{if (!skip) (*$1)($3, $5, $7, $9, $11);} |
VOID_FUNCTION_4STRING
'(' tSTRING ',' tSTRING ',' tSTRING ',' tSTRING ')'
{if (!skip) (*$1)($3, $5, $7, $9);} |
VOID_FUNCTION_4STRING_UINT
'(' tSTRING ',' tSTRING ',' tSTRING ',' tSTRING ',' INTEGER')'
{if (!skip) (*$1)($3, $5, $7, $9, $11);} |
VOID_FUNCTION_4STRING_2UINT
'(' tSTRING ',' tSTRING ',' tSTRING ',' tSTRING ',' INTEGER ',' INTEGER')'
{if (!skip) (*$1)($3, $5, $7, $9, $11, $13);} |
VOID_FUNCTION_STRING_UINT
'(' tSTRING ',' INTEGER ')'
{if (!skip) (*$1)($3, $5);} |
VOID_FUNCTION_STRING_UINT_STRING
'(' tSTRING ',' INTEGER ',' tSTRING ')'
{if (!skip) (*$1)($3, $5, $7);} |
VOID_FUNCTION_STRING_UINT_2STRING
'(' tSTRING ',' INTEGER ',' tSTRING ',' tSTRING ')'
{if (!skip) (*$1)($3, $5, $7, $9);} |
VOID_FUNCTION_STRING_WPARAM_LPARAM
'(' tSTRING ',' INTEGER ',' INTEGER ')'
{if (!skip) (*$1)($3, $5, $7);} |
VOID_FUNCTION_UINT
'(' INTEGER ')'
{if (!skip) (*$1)($3);} |
VOID_FUNCTION_2UINT
'(' INTEGER ',' INTEGER ')'
{if (!skip) (*$1)($3, $5);} |
VOID_FUNCTION_2UINT_STRING
'(' INTEGER ',' INTEGER ',' tSTRING ')'
{if (!skip) (*$1)($3, $5, $7);} |
VOID_FUNCTION_3UINT
'(' INTEGER ',' INTEGER ',' INTEGER ')'
{if (!skip) (*$1)($3, $5, $7);} |
VOID_FUNCTION_2INT_3UINT_STRING
'(' INTEGER ',' INTEGER ',' INTEGER ',' INTEGER ',' INTEGER ',' tSTRING ')'
{if (!skip) (*$1)($3, $5, $7, $9, $11, $13);} |
VOID_FUNCTION_FILE_WIN
'(' file_win ')'
{if (!skip) (*$1)(filename, windowname);} |
VOID_FUNCTION_FILE_WIN_STRING
'(' file_win ',' tSTRING ')'
{if (!skip) (*$1)(filename, windowname, $5);} |
VOID_FUNCTION_FILE_WIN_UINT
'(' file_win ',' INTEGER ')'
{if (!skip) (*$1)(filename, windowname, $5);} ;
file_win: tSTRING
{
filename = windowname = $1;
while (*windowname && *windowname != '>') windowname++;
if (*windowname) *windowname++ = 0;
} ;
bool_macro: NOT '(' bool_macro ')' {$$ = ! $3;} |
tSTRING {$$ = MACRO_IsMark($1);} |
BOOL_FUNCTION_VOID '(' ')' {$$ = (*$1)();} |
BOOL_FUNCTION_STRING '(' tSTRING ')' {$$ = (*$1)($3);} ;

View File

@ -45,7 +45,7 @@ static void WINHELP_DeleteWindow(WINHELP_WINDOW*);
static void WINHELP_SetupText(HWND hWnd);
static WINHELP_LINE_PART* WINHELP_IsOverLink(HWND hWnd, WPARAM wParam, LPARAM lParam);
WINHELP_GLOBALS Globals = {3, 0, 0, 0, 0, 0};
WINHELP_GLOBALS Globals = {3, 0, 0, 0, 1, 0, 0};
static BOOL MacroTest = FALSE;
@ -91,6 +91,7 @@ int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE prev, LPSTR cmdline, int show)
case 'x':
show = SW_HIDE;
Globals.isBook = FALSE;
break;
default:

View File

@ -111,6 +111,7 @@ typedef struct
HANDLE hInstance;
HWND hPopupWnd;
UINT wStringTableOffset;
BOOL isBook;
WINHELP_WINDOW* active_win;
WINHELP_WINDOW* win_list;
} WINHELP_GLOBALS;
@ -122,13 +123,13 @@ BOOL WINHELP_CreateHelpWindowByPage(HLPFILE_PAGE*, LPCSTR, BOOL, HWND, LPPOINT,
INT WINHELP_MessageBoxIDS(UINT, UINT, WORD);
INT WINHELP_MessageBoxIDS_s(UINT, LPCSTR, UINT, WORD);
extern CHAR MAIN_WIN_CLASS_NAME[];
extern CHAR BUTTON_BOX_WIN_CLASS_NAME[];
extern CHAR TEXT_WIN_CLASS_NAME[];
extern CHAR SHADOW_WIN_CLASS_NAME[];
extern CHAR STRING_BUTTON[];
extern CHAR STRING_MENU_Xx[];
extern CHAR STRING_DIALOG_TEST[];
extern char MAIN_WIN_CLASS_NAME[];
extern char BUTTON_BOX_WIN_CLASS_NAME[];
extern char TEXT_WIN_CLASS_NAME[];
extern char SHADOW_WIN_CLASS_NAME[];
extern char STRING_BUTTON[];
extern char STRING_MENU_Xx[];
extern char STRING_DIALOG_TEST[];
#endif
/* Buttons */