[Com0com-cvs] hub4com/plugins/linectl filter.cpp, 1.10, 1.11 precomp.h, 1.1, 1.2
The virtual serial port driver for Windows.
Brought to you by:
vfrolov
From: Vyacheslav F. <vf...@us...> - 2009-02-02 15:21:48
|
Update of /cvsroot/com0com/hub4com/plugins/linectl In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv27344/plugins/linectl Modified Files: filter.cpp precomp.h Log Message: Optimized filter's API Index: precomp.h =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/linectl/precomp.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** precomp.h 30 Sep 2008 08:34:38 -0000 1.1 --- precomp.h 2 Feb 2009 15:21:42 -0000 1.2 *************** *** 2,6 **** * $Id$ * ! * Copyright (c) 2008 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify --- 2,6 ---- * $Id$ * ! * Copyright (c) 2008-2009 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.2 2009/02/02 15:21:42 vfrolov + * Optimized filter's API + * * Revision 1.1 2008/09/30 08:34:38 vfrolov * Initial revision *************** *** 31,35 **** #include <crtdbg.h> - #include <map> #include <iostream> --- 34,37 ---- Index: filter.cpp =================================================================== RCS file: /cvsroot/com0com/hub4com/plugins/linectl/filter.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** filter.cpp 22 Dec 2008 09:40:45 -0000 1.10 --- filter.cpp 2 Feb 2009 15:21:42 -0000 1.11 *************** *** 2,6 **** * $Id$ * ! * Copyright (c) 2008 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify --- 2,6 ---- * $Id$ * ! * Copyright (c) 2008-2009 Vyacheslav Frolov * * This program is free software; you can redistribute it and/or modify *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.11 2009/02/02 15:21:42 vfrolov + * Optimized filter's API + * * Revision 1.10 2008/12/22 09:40:45 vfrolov * Optimized message switching *************** *** 57,64 **** namespace FilterLineCtl { /////////////////////////////////////////////////////////////// ! static ROUTINE_MSG_INSERT_VAL *pMsgInsertVal = NULL; ! static ROUTINE_MSG_REPLACE_NONE *pMsgReplaceNone = NULL; ! static ROUTINE_PORT_NAME_A *pPortName = NULL; ! static ROUTINE_FILTER_NAME_A *pFilterName = NULL; /////////////////////////////////////////////////////////////// const char *GetParam(const char *pArg, const char *pPattern) --- 60,74 ---- namespace FilterLineCtl { /////////////////////////////////////////////////////////////// ! #ifndef _DEBUG ! #define DEBUG_PARAM(par) ! #else /* _DEBUG */ ! #define DEBUG_PARAM(par) par ! #endif /* _DEBUG */ ! /////////////////////////////////////////////////////////////// ! static ROUTINE_MSG_INSERT_VAL *pMsgInsertVal; ! static ROUTINE_MSG_REPLACE_NONE *pMsgReplaceNone; ! static ROUTINE_PORT_NAME_A *pPortName; ! static ROUTINE_FILTER_NAME_A *pFilterName; ! static ROUTINE_FILTERPORT *pFilterPort; /////////////////////////////////////////////////////////////// const char *GetParam(const char *pArg, const char *pPattern) *************** *** 83,89 **** class Filter : public Valid { public: ! Filter(int argc, const char *const argv[]); - void SetFilterName(const char *_pName) { pName = _pName; } const char *FilterName() const { return pName; } --- 93,98 ---- class Filter : public Valid { public: ! Filter(const char *pName, int argc, const char *const argv[]); const char *FilterName() const { return pName; } *************** *** 97,103 **** }; ! Filter::Filter(int argc, const char *const argv[]) ! : soOutMask(0), ! pName(NULL) { goInMask[0] = goInMask[1] = 0; --- 106,112 ---- }; ! Filter::Filter(const char *_pName, int argc, const char *const argv[]) ! : pName(_pName), ! soOutMask(0) { goInMask[0] = goInMask[1] = 0; *************** *** 207,218 **** /////////////////////////////////////////////////////////////// static HFILTER CALLBACK Create( HCONFIG /*hConfig*/, int argc, const char *const argv[]) { ! Filter *pFilter = new Filter(argc, argv); ! if (!pFilter) ! return NULL; if (!pFilter->IsValid()) { --- 216,232 ---- /////////////////////////////////////////////////////////////// static HFILTER CALLBACK Create( + HMASTERFILTER hMasterFilter, HCONFIG /*hConfig*/, int argc, const char *const argv[]) { ! _ASSERTE(hMasterFilter != NULL); ! Filter *pFilter = new Filter(pFilterName(hMasterFilter), argc, argv); ! ! if (!pFilter) { ! cerr << "No enough memory." << endl; ! exit(2); ! } if (!pFilter->IsValid()) { *************** *** 224,247 **** } /////////////////////////////////////////////////////////////// ! static BOOL CALLBACK Init( ! HFILTER hFilter, ! HMASTERFILTER hMasterFilter) { _ASSERTE(hFilter != NULL); - _ASSERTE(hMasterFilter != NULL); ! ((Filter *)hFilter)->SetFilterName(pFilterName(hMasterFilter)); ! return TRUE; } /////////////////////////////////////////////////////////////// static BOOL CALLBACK OutMethod( HFILTER hFilter, ! HMASTERPORT hFromPort, HMASTERPORT hToPort, HUB_MSG *pOutMsg) { _ASSERTE(hFilter != NULL); ! _ASSERTE(hFromPort != NULL); _ASSERTE(hToPort != NULL); _ASSERTE(pOutMsg != NULL); --- 238,275 ---- } /////////////////////////////////////////////////////////////// ! static void CALLBACK Delete( ! HFILTER hFilter) { _ASSERTE(hFilter != NULL); ! delete (Filter *)hFilter; ! } ! /////////////////////////////////////////////////////////////// ! static HFILTERINSTANCE CALLBACK CreateInstance( ! HMASTERFILTERINSTANCE hMasterFilterInstance) ! { ! _ASSERTE(hMasterFilterInstance != NULL); ! HMASTERPORT hMasterPort = pFilterPort(hMasterFilterInstance); ! ! _ASSERTE(hMasterPort != NULL); ! ! return (HFILTERINSTANCE)pPortName(hMasterPort); ! } ! /////////////////////////////////////////////////////////////// ! static void CALLBACK DeleteInstance( ! HFILTERINSTANCE DEBUG_PARAM(hFilterInstance)) ! { ! _ASSERTE(hFilterInstance != NULL); } /////////////////////////////////////////////////////////////// static BOOL CALLBACK OutMethod( HFILTER hFilter, ! HFILTERINSTANCE hFilterInstance, HMASTERPORT hToPort, HUB_MSG *pOutMsg) { _ASSERTE(hFilter != NULL); ! _ASSERTE(hFilterInstance != NULL); _ASSERTE(hToPort != NULL); _ASSERTE(pOutMsg != NULL); *************** *** 274,278 **** if (fail_options) { ! cerr << pPortName(hFromPort) << " WARNING: Requested by filter " << ((Filter *)hFilter)->FilterName() << " for port " << pPortName(hToPort) --- 302,306 ---- if (fail_options) { ! cerr << (const char *)hFilterInstance << " WARNING: Requested by filter " << ((Filter *)hFilter)->FilterName() << " for port " << pPortName(hToPort) *************** *** 346,350 **** NULL, // ConfigStop Create, ! Init, NULL, // InMethod OutMethod, --- 374,380 ---- NULL, // ConfigStop Create, ! Delete, ! CreateInstance, ! DeleteInstance, NULL, // InMethod OutMethod, *************** *** 363,367 **** !ROUTINE_IS_VALID(pHubRoutines, pMsgReplaceNone) || !ROUTINE_IS_VALID(pHubRoutines, pPortName) || ! !ROUTINE_IS_VALID(pHubRoutines, pFilterName)) { return NULL; --- 393,398 ---- !ROUTINE_IS_VALID(pHubRoutines, pMsgReplaceNone) || !ROUTINE_IS_VALID(pHubRoutines, pPortName) || ! !ROUTINE_IS_VALID(pHubRoutines, pFilterName) || ! !ROUTINE_IS_VALID(pHubRoutines, pFilterPort)) { return NULL; *************** *** 372,375 **** --- 403,407 ---- pPortName = pHubRoutines->pPortName; pFilterName = pHubRoutines->pFilterName; + pFilterPort = pHubRoutines->pFilterPort; return plugins; |