//----------------------------------------------------------------------------//
//                                                                            //
// ***************** DO NOT MODIFY THIS FILE ******************************** //
//                                                                            //
//----------------------------------------------------------------------------//

#define MAXINFOSLOTSIZE		255
#define MAXDATABASES		9
#define MAXDEVICES			999
#define MAXRTRNAMESIZE		16
#define MAXRTRNAMESIZE_2	255

#define MAXPANELS	32						// maximum number of ripcored panels
#define MAXTIMERS	64						// maximun number of ripcored timers

#define APPLCORE_STRING	256			// maximum size of an applcore string

#define TOD_TIMER			1           // time of day timer identifier

typedef char aString[ APPLCORE_STRING ];	// two generic types of "applcore" style variables
typedef int aInt;
typedef char* paString;
typedef int* paInt;


#ifdef __cplusplus
extern "C"
{
#endif

#pragma warning ( disable: 4786 )

// References to external, global variables
#ifndef MAINPROG
extern HWND hDlg[MAXPANELS+1];		// window handle of the 32 dialogs
extern HWND hWnd;							// main window handle
extern HINSTANCE hInstance;			// instance handle of this application
extern aString sDate;					// set when timer 1 is running
extern aString sTime; 					// set when timer 1 is running
extern HWND hCSI;							// handle of the CSI window
extern int iWorkstation;				// workstation number (as got from applcore or csi.ini

#endif 

typedef struct _LPBNCSREVERTIVE
{
	char cDeviceType;
	WORD wDevice;
	WORD wIndex;
	WORD wInfo;
	char szInfo[ MAXINFOSLOTSIZE ];
	BYTE bType;							// whether revertive or database change  (0=REVERTIVE, 1 = DB CHANGE)
	WORD wDatabase;
} BNCSREVERTIVE, far * LPBNCSREVERTIVE, *PBNCSREVERTIVE;


/*
// CSI Revertive structure
struct Revertive
{
	char cDeviceType;
	WORD wDevice;
	WORD wIndex;
	WORD wInfo;
	char lpszInfo[ MAXINFOSLOTSIZE ];
};
*/

//----------------------------------------------------------------------------//
// local function definitions                                                 //
//----------------------------------------------------------------------------//
void fnStartup( char * );
void fnCommand( aInt , aInt );
void fnClosedown( void );
void fnWakeup( void );
void fnSleep( void );
void fnTimer( aInt );
void fnRevertive( LPBNCSREVERTIVE );
void fnDatabase( aInt , aInt , aInt);

//----------------------------------------------------------------------------//
// "applcore" function definitions                                            //
//----------------------------------------------------------------------------//
//-----------------//
// audio functions //
//-----------------//
void aAudioBeep( aInt );
#define aAB(a) aAudioBeep(a)

//------------------//
// bitmap functions //
//------------------//
aInt aBitmapPut( char *, aInt , aInt , aInt , aInt );
#define aBP(a,b,c,d,e) aBitmapPut(a,b,c,d,e)

//------------------------//
// registration functions //
//------------------------//
aInt aRR( aInt wDevice, aInt wMin, aInt wMax );
#define aGR(a,b,c) aRR(a,b,c)
#define aIR(a,b,c) aRR(a,b,c)

aInt aRU( aInt wDevice );
#define aGU( a ) aRouterUnregister( a )

//---------------------//
// executive functions //
//---------------------//
aInt aExecutiveApplication( char *, char *);
#define aEA(a,b) aExecutiveApplication(a,b)
aInt aExecutiveTimer( aInt , aInt );
#define aET(a,b) aExecutiveTimer(a,b)
//void aExecutiveCaption( BOOL );
//#define aEC(a) aExecutiveCaption(a)
aInt aExecutiveBackpanel( aInt , aInt , aInt , char * );
#define aEB(a,b,c,d) aExecutiveBackpanel(a,b,c,d)
//void aExecutiveQuit( aInt );
//#define aEQ(a) aExecutiveQuit(a)
//void aExecutiveFile( char *, char *, char *, BOOL , char * );
///#define aEF(a,b,c,d,e) aExecutiveFile(a,b,c,d,e)

aInt  aExecutiveCaption( BOOL );
#define aEC(a) aExecutiveCaption(a)
aInt aExecutiveQuit( aInt );
#define aEQ(a) aExecutiveQuit(a)
aInt aExecutiveFile( paString , paString , paString , BOOL , paString  );
#define aEF(a,b,c,d,e) aExecutiveFile(a,b,c,d,e)


//-------------------//
// control functions //
//-------------------//
aInt aControlText( char *, aInt , aInt , aInt );
#define aCT(a,b,c,d) aControlText(a,b,c,d)
aInt aControlMove( aInt , aInt , aInt , aInt );
#define aCM(a,b,c,d) aControlMove(a,b,c,d)
aInt aControlName( aInt , aInt , aInt , aInt , aInt , aInt );
#define aCN(a,b,c,d,e,f) aControlName(a,b,c,d,e,f)
aInt aControlEnable( aInt , aInt );
#define aCE(a,b) aControlEnable(a,b)
aInt aControlDisable( aInt , aInt );
#define aCD(a,b) aControlDisable(a,b)
aInt aControlIDChange( aInt , aInt, aInt );
#define aCI(a,b,c) aControlIDChange(a,b,c)

aInt aWorkstationTest( aInt wDevice , aInt wMin , aInt wMax , aInt *wResult );
#define aWT(a,b,c,d) aWorkstationTest(a,b,c,d)
aInt aWorkstationEnable( void );
#define aWE() aWorkstationEnable(w,x,y,z)
aInt aWorkstationDisable( void );
#define aWD() aWorkstationDisable()
aInt aWorkstationFlush( aInt wDevice );
#define aWF(a) aWorkstationFlush(a)
aInt aDeviceGet( aInt wDevice , aInt wIndex , char * szResult , aInt *wResult );
#define aDG(w,x,y,z) aDeviceGet(w,x,y,z)


//----------------------//
// infodriver functions //
//----------------------//
aInt aInfoPoll( aInt , aInt , aInt );
#define aIP(a,b,c) aInfoPoll(a,b,c)
aInt aInfoQuery( aInt , aInt , aInt );
#define aIQ(a,b,c) aInfoQuery(a,b,c)
aInt aInfoWrite( aInt , char *, aInt );
#define aIW(a,b,c) aInfoWrite(a,b,c)
aInt aInfoUnregister( aInt );
#define aIU(a) aInfoUnregister(a)

//---------------//
// gpi functions //
//---------------//
aInt aGPIPoll( aInt wDevice, aInt wMin, aInt wMax );
#define aGP(a,b,c) aGPIPoll(a,b,c)
aInt aGPISwitch( aInt wDevice, aInt wIndex , aInt fState);
#define aGS(a,b,c) aGPISwitch(a,b,c)
aInt aGPIQuery( aInt wDevice, aInt wMin, aInt wMax );
#define aGQ(a,b,c) aGPIQuery(a,b,c)

//-------------------//
// listbox functions //
//-------------------//
aInt aListClear( aInt , aInt );
#define aLC(x,y) aListClear(x,y)
aInt aListDelete( aInt , aInt );
#define aLD(x,y) aListDelete(x,y)
aInt aListErase( char *, aInt , aInt );
#define aLE(x,y,z) aListErase(x,y,z)
aInt aListFind( char *, aInt , aInt , aInt * );
#define aLF(w,x,y,z) aListFind(w,x,y,z)
aInt aListGet( aInt , aInt , char *, aInt * );
#define aLG(w,x,y,z) aListGet(w,x,y,z)
aInt aListQuantity( aInt iPanelNo , aInt iID , aInt *puLen );
#define aLQ(w,x,y) aListQuantity(w,x,y)

aInt aListItem( BOOL , aInt , aInt , aInt );
#define aLI(w,x,y,z) aListItem(w,x,y,z)

aInt aListLoad( char *, aInt , aInt , aInt , aInt );
#define aLL(v,w,x,y,z) aListLoad(v,w,x,y,z)
aInt aListPut( char *, aInt , aInt );
#define aLP(x,y,z) aListPut(x,y,z)
aInt aListRouter( aInt , aInt , aInt , aInt , aInt , aInt );
#define aLR(u,v,w,x,y,z) aListRouter(u,v,w,x,y,z)
aInt aListSave( char *, aInt , aInt );
#define aLS(x,y,z) aListSave(x,y,z)
aInt aNumberPut( int , aInt , aInt );
#define aNP(x,y,z) aNumberPut(x,y,z);

//------------------//
// memory functions //
//------------------//
aInt aMemoryRead( char *filename, char *mem, int iSize );
#define aMR(x,y,z) aMemoryRead(x,y,z);
aInt aMemoryWrite( char *filename, char *mem, int iSize );
#define aMW(x,y,z) aMemoryWrite(x,y,z);

//-----------------//
// panel functions //
//-----------------//
aInt aPanelShow( aInt );
#define aPS(a) aPanelShow(a)
aInt aPanelRemove( aInt );
#define aPR(a) aPanelRemove(a)
aInt aPanelDestroy( aInt );
#define aPD(a) aPanelDestroy(a)
aInt aPanelInitialise( aInt );
#define aPI(a) aPanelInitialise(a)
aInt aExecutiveHide( BOOL, aInt );
#define aEH(a,b) aExecutiveHide(a,b)

//------------------//
// router functions //
//------------------//
aInt aRouterRegister( aInt , aInt , aInt );
#define aRR(a,b,c) aRouterRegister(a,b,c)
aInt aRouterPoll( aInt , aInt , aInt );
#define aRP(a,b,c) aRouterPoll(a,b,c)
aInt aRouterQuery( aInt wDevice, aInt wMin, aInt wMax );
#define aRQ(a,b,c) aRouterQuery(a,b,c)
aInt aRouterCrosspoint( aInt , aInt , aInt , char *);
#define aRC(a,b,c,d) aRouterCrosspoint(a,b,c,d)
aInt aRouterIndex( aInt , aInt , LPSTR , aInt *);
#define aRI(a,b,c,d) aRouterIndex(a,b,c,d)
aInt aRouterName( aInt , aInt , aInt , char *);
#define aRN(a,b,c,d) aRouterName(a,b,c,d)
aInt aRouterModify( aInt wDevice, aInt wDatabaseNo, aInt wIndex , char *szName, aInt fFlag);
#define aRM(a,b,c,d,e) aRouterModify(a,b,c,d,e)

//----------------//
// text functions //
//----------------//
aInt aTextCopy( aInt , aInt , aInt , aInt );
#define aTC(a,b,c,d) aTextCopy(a,b,c,d)
aInt aTextGet( aInt , aInt , char *);
#define aTG(a,b,c) aTextGet(a,b,c)
aInt aTextPut( char *, aInt , aInt );
#define aTP(a,b,c) aTextPut(a,b,c)
aInt aTextMove( aInt , aInt , aInt , aInt );
#define aTM(a,b,c,d) aTextMove(a,b,c,d)
aInt aTextDivide(char *name, char *delim, char *, char *);
#define aTD(a,b,c,d) aTextDivide(a,b,c,d)
aInt aTextSplit(char *name, char *delim, int *, aInt );
#define aTS(a,b,c,d) aTextSplit(a,b,c,d)

//------------------//
// string functions //
//------------------//
aInt aStringDate( paString , aInt , paString , paInt , paInt , paInt );
#define aSD(a,b,c,d,e,f) aStringDate(a,b,c,d,e,f)
//----------------------------------------------------------------------------//
// database definitions                                                       //
//----------------------------------------------------------------------------//
#define SOURCE	0
#define DEST 	1
#define DB0		0
#define DB1		1
#define DB2		2
#define DB3		3
#define DB4		4
#define DB5		5
#define DB6 	6
#define DB7		7
#define DB8		8
#define DB9		9

//----------------------------------------------------------------------------//
// "applcore" functions error messages                                        //
//----------------------------------------------------------------------------//
#define aERR_BADHDLG				1
#define aERR_NOSUCHCNTRL		2
#define aERR_BADHDC				3
#define aERR_BADBITMAP			4
#define aERR_CONTROLNOTFOUND	5
#define aERR_BADPANEL			6
#define aERR_BADRANGE			7
#define aERR_BADDATABASENO		8
#define aERR_BADDEVICENO		9
#define aERR_CANTFINDAPP		10
#define aERR_BADPARAMPOINTER	11
#define aERR_BADINDEX			12
#define aERR_NOINDEX				13
#define aERR_FILENOTFOUND		14
#define aERR_ENDOFFILE			15
#define aERR_PANELNOACTIVE		16
#define aERR_BADTIMER			17
#define aERR_CANTCREATEDLG		18
#define aERR_BADCONTROL			19
#define aERR_BADPARAMPOINTER1	99

void fnEnableRawCallBack( void ( *fnCallback)( HWND hPnlDlg, UINT message, WPARAM wParam, LPARAM lParam  ) );

#ifdef __cplusplus
}
#endif
