NO

Author Topic: bison flex skeleton Add-In  (Read 4628 times)

Offline TimoVJL

  • Global Moderator
  • Member
  • *****
  • Posts: 2115
bison flex skeleton Add-In
« on: July 18, 2015, 03:28:19 PM »
Code: [Select]
#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;
}
*/
May the source be with you

Offline frankie

  • Global Moderator
  • Member
  • *****
  • Posts: 2113
Re: bison flex skeleton Add-In
« Reply #1 on: July 18, 2015, 03:42:52 PM »
Usefull!
I made it by hand...
"It is better to be hated for what you are than to be loved for what you are not." - Andre Gide