www.pudn.com > helpview.zip > Macroeng.h, change:1997-10-15,size:5989b


/* 
  
Copyright 1997 Willows Software, Inc.  
 
This library is free software; you can redistribute it and/or 
modify it under the terms of the GNU Library General Public License as 
published by the Free Software Foundation; either version 2 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 
Library General Public License for more details. 
 
You should have received a copy of the GNU Library General Public 
License along with this library; see the file COPYING.LIB.  If 
not, write to the Free Software Foundation, Inc., 675 Mass Ave, 
Cambridge, MA 02139, USA. 
 
*/ 
 
/************************************************************************* 
* 
* MACROENG.H 
* Macro engine support routines.      
* 
* Author: Paul E. Kissel 
* 
**************************************************************************/ 
 
#ifndef MACROENG_H 
#define MACROENG_H 
 
/*********************************** 
** 
**  System Includes 
** 
***********************************/ 
#include <windows.h> 
 
 
/*********************************** 
** 
**  App. Includes 
** 
***********************************/ 
#include <stdlib.h> 
 
 
/*********************************** 
** 
**  Shared Defines 
** 
***********************************/ 
 
/* Handle to an instance of the macro engine. */ 
typedef HGLOBAL HMACROENGINE; 
 
/* Return value of a macro. */ 
typedef union tagMACRORETVAL 
{ 
  DWORD dwValue; 
  char * StringPtr; 
} 
MACRORETVAL; 
typedef MACRORETVAL * MACRORETVALPTR; 
  
/* Macro implementation callback function. */ 
typedef BOOL ( CALLBACK * MACROFUNCPTR )( HMACROENGINE hMacroEngine, void * UserDefinedDataPtr, HGLOBAL hMacroData, MACRORETVAL * MacroRetValPtr ); 
 
/* Used in call to GetNextMacroArg(). */ 
typedef void * VOIDPTR; 
typedef VOIDPTR * PTRVOIDPTR; 
 
/* Variable argument callback function. */ 
typedef BOOL ( CALLBACK * VARHANDLERFUNCPTR ) ( HWND hErrorWnd, LPSTR ArgumentPtr, LPARAM lParam, PTRVOIDPTR PtrDataPtr, WORD wBufferSize, WORD * wDataSize, BOOL * bWasErrorPtr ); 
 
/*  
** A macro table entry contains information 
** for one macro that is in a macro table. 
*/ 
typedef struct tagMACROTABLEENTRY 
{ 
  char * MacroNamePtr; 
  MACROFUNCPTR MacroFuncPtr; 
  HGLOBAL      hMacroData; 
}  
MACROTABLEENTRY; 
typedef MACROTABLEENTRY * MACROTABLEENTRYPTR; 
 
typedef enum  
{ 
  MACRO_NEARSTRING,           /* Argument is a quoted string - quotes will be removed. */ 
  MACRO_FARSTRING,            /* Argument is a quoted string - quotes will be removed. */ 
  MACRO_UNSIGNEDSHORTINT,     /* UINT, WORD, WPARAM */ 
  MACRO_UNSIGNEDLONGINT,      /* DWORD */ 
  MACRO_SIGNEDSHORTINT,       /* BOOL */ 
  MACRO_SIGNEDLONGINT         /* LONG, LPARAM, LRESULT */ 
} 
MACROARGTYPE; 
 
 
/*  
** Maximum length of a macro string  
** including the terminating NULL character. 
*/ 
#define MAX_MACRO_STRING    513 
 
/*  
** Maximum length of a macro table's name  
** including the terminating NULL character.  
*/ 
#define MAX_TABLE_NAME      30 
 
/*  
** Maximum length of a application specific 
** buffer of data that is associated with 
** a registered table (including the terminating  
** NULL character).  
*/ 
#define MAX_APP_DATA        _MAX_PATH 
 
 
/* This table name is reserved and cannot be used. */ 
#define RESERVED_TABLE_NAME  "RESERVED_TABLE_NAME" 
 
/*  
** This table name can be registered and loaded and 
** contains default system macros.  
*/ 
#define SYSTEM_TABLE_NAME  "SYSTEM_TABLE_NAME" 
 
/* Callback function to determine if a registerd table should be unregistered. */ 
typedef BOOL ( CALLBACK * UNREGTABLEPROC )( char * szTableName, char * szAppData, LPARAM lParam ); 
 
 
 
/*********************************** 
** 
**  Shared Function Prototypes 
** 
***********************************/ 
 
HMACROENGINE __declspec(dllexport) StartMacroEngine( HWND hErrorWnd ); 
void __declspec(dllexport) StopMacroEngine( HMACROENGINE * hMacroEnginePtr ); 
 
BOOL __declspec(dllexport) RegisterMacroTable 
(  
  HWND hErrorWnd, 
  HMACROENGINE hMacroEngine, 
  char * szTableName,  
  WORD wNumMacros, 
  MACROTABLEENTRYPTR MacroTableEntryPtr, 
  char * szAppData 
); 
 
BOOL __declspec(dllexport) UnregisterMacroTable 
(  
  HMACROENGINE hMacroEngine, 
  char * szTableName 
); 
 
void UnregMacroTablesQuery 
(  
  HMACROENGINE hMacroEngine, 
  UNREGTABLEPROC UnregTableProc,  
  LPARAM lParam  
); 
 
BOOL __declspec(dllexport) LoadMacroTable 
(  
  HWND hErrorWnd, 
  HMACROENGINE hMacroEngine, 
  char * szTableName  
); 
 
BOOL __declspec(dllexport) UnloadMacroTable 
(  
  HMACROENGINE hMacroEngine, 
  char * szTableName  
); 
 
BOOL __declspec(dllexport) ExecuteMacro 
(  
  HWND hErrorWnd, 
  HMACROENGINE hMacroEngine, 
  char * MacroStringPtr, 
  MACRORETVAL * MacroRetValPtr, 
  void * UserDefinedDataPtr, 
  BOOL bShowError 
); 
 
BOOL __declspec(dllexport) GetNextMacroArg  
( 
  HWND hErrorWnd,                /* Parent window for error message box. */ 
  HMACROENGINE hMacroEngine,     /* Handle to engine. */ 
  PTRVOIDPTR PtrDataPtr,         /* Place in which to save data. */ 
  MACROARGTYPE MacroArgType,     /* Type of data that it is. */ 
  WORD wBufferSize,              /* Size of string buffer (including null-char) if  
                                    string argument is being retrieved. */ 
  WORD * wDataSizePtr,     /* Size, in bytes, of the data found. If it is a string, the 
                                    string's teriminating NULL character is included 
                                    in the number. */ 
  VARHANDLERFUNCPTR VarHandlerProc,  /* Call back procedure to handle variable processing. */ 
  LPARAM VarHandlerProcData,      /* Application specific data for variable processing. */ 
  void * UserDefinedDataPtr  /* Application specific macro processing data. */ 
); 
 
#endif