#define UNICODE
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <addin.h>
// Locals.
static HANDLE g_hmod = NULL;
// Function prototypes.
//static USHORT Parser(USHORT, PCTSTR, int, ADDIN_PARSE_POINT [], PINT);
BOOL WINAPI DllMain(HANDLE hDLL, DWORD dwReason, LPVOID lpReserved)
{
if (dwReason == DLL_PROCESS_ATTACH)
g_hmod = hDLL;
return TRUE;
}
ADDINAPI BOOL WINAPI AddInMain(HWND hwnd, ADDIN_EVENT eEvent)
{
switch (eEvent)
{
case AIE_APP_CREATE:
{
ADDIN_ADD_FILE_TYPE AddFile = {0};
/* Define a new file type in the IDE */
AddFile.cbSize = sizeof(AddFile);
AddFile.pszDescription = TEXT("Bison grammar");
AddFile.pszExtension = TEXT("y"); /* support *.y grammar files */
//AddFile.pfnParser = Parser;
AddFile.pszShells = TEXT("bison.exe --no-lines -o %|fF.c $!\0");
if (!AddIn_AddFileType(hwnd, &AddFile))
return FALSE;
AddFile.pszDescription = TEXT("Flex lexer");
AddFile.pszExtension = TEXT("l"); /* support *.l lexer files */
//AddFile.pfnParser = Parser;
AddFile.pszShells = TEXT("flex.exe -o%|fF.c $!\0");
if (!AddIn_AddFileType(hwnd, &AddFile))
return FALSE;
return TRUE;
}
default:
return TRUE;
}
}
/*
static USHORT Parser(USHORT usCookie, PCTSTR pszText, int cchText, ADDIN_PARSE_POINT aPoints[], PINT pcPoints)
{
return usCookie;
}
*/