Thread: [Com0com-cvs] com0com/setup params.cpp, 1.8, 1.9 params.h, 1.4, 1.5 setup.cpp, 1.20, 1.21
The virtual serial port driver for Windows.
Brought to you by:
vfrolov
From: Vyacheslav F. <vf...@us...> - 2007-10-19 16:09:58
|
Update of /cvsroot/com0com/com0com/setup In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv3020 Modified Files: params.cpp params.h setup.cpp Log Message: Implemented --detail-prms option Index: params.h =================================================================== RCS file: /cvsroot/com0com/com0com/setup/params.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** params.h 3 Jul 2007 14:39:49 -0000 1.4 --- params.h 19 Oct 2007 16:09:55 -0000 1.5 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.5 2007/10/19 16:09:55 vfrolov + * Implemented --detail-prms option + * * Revision 1.4 2007/07/03 14:39:49 vfrolov * Implemented pinout customization *************** *** 46,50 **** LONG Save(); BOOL ParseParametersStr(const char *pParameters); ! BOOL FillParametersStr(char *pParameters, int size); BOOL FillPortName(char *pPortName, int size); BOOL Changed() const { return maskChanged != 0; } --- 49,53 ---- LONG Save(); BOOL ParseParametersStr(const char *pParameters); ! BOOL FillParametersStr(char *pParameters, int size, BOOL detail); BOOL FillPortName(char *pPortName, int size); BOOL Changed() const { return maskChanged != 0; } *************** *** 56,60 **** BOOL SetPortName(const char *pNewPortName); DWORD *GetDwPtr(DWORD bit); - const char *GetBitName(DWORD bit); BOOL SetFlag(const char *pNewVal, DWORD bit); BOOL SetPin(const char *pNewVal, DWORD bit); --- 59,62 ---- Index: params.cpp =================================================================== RCS file: /cvsroot/com0com/com0com/setup/params.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** params.cpp 20 Sep 2007 12:43:03 -0000 1.8 --- params.cpp 19 Oct 2007 16:09:55 -0000 1.9 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.9 2007/10/19 16:09:55 vfrolov + * Implemented --detail-prms option + * * Revision 1.8 2007/09/20 12:43:03 vfrolov * Added parameters string length check *************** *** 148,152 **** } /////////////////////////////////////////////////////////////// ! const char *PortParameters::GetBitName(DWORD bit) { switch (bit) { --- 151,180 ---- } /////////////////////////////////////////////////////////////// ! static const DWORD *GetDwPtrDefault(DWORD bit) ! { ! static const DWORD emuBR = C0C_DEFAULT_EMUBR; ! static const DWORD emuOverrun = C0C_DEFAULT_EMUOVERRUN; ! static const DWORD plugInMode = C0C_DEFAULT_PLUGINMODE; ! static const DWORD exclusiveMode = C0C_DEFAULT_EXCLUSIVEMODE; ! static const DWORD pinCTS = C0C_DEFAULT_PIN_CTS; ! static const DWORD pinDSR = C0C_DEFAULT_PIN_DSR; ! static const DWORD pinDCD = C0C_DEFAULT_PIN_DCD; ! static const DWORD pinRI = C0C_DEFAULT_PIN_RI; ! ! switch (bit) { ! case m_emuBR: return &emuBR; ! case m_emuOverrun: return &emuOverrun; ! case m_plugInMode: return &plugInMode; ! case m_exclusiveMode: return &exclusiveMode; ! case m_pinCTS: return &pinCTS; ! case m_pinDSR: return &pinDSR; ! case m_pinDCD: return &pinDCD; ! case m_pinRI: return &pinRI; ! } ! ! return NULL; ! } ! /////////////////////////////////////////////////////////////// ! static const char *GetBitName(DWORD bit) { switch (bit) { *************** *** 582,590 **** } /////////////////////////////////////////////////////////////// ! BOOL PortParameters::FillParametersStr(char *pParameters, int size) { int len; ! len = SNPRINTF(pParameters, size, "PortName=%s", (maskExplicit & m_portName) ? (portName) : "-"); if (len < 0) --- 610,619 ---- } /////////////////////////////////////////////////////////////// ! BOOL PortParameters::FillParametersStr(char *pParameters, int size, BOOL detail) { int len; ! len = SNPRINTF(pParameters, size, "PortName=%s", ! (maskExplicit & m_portName) ? portName : (detail ? phPortName : "-")); if (len < 0) *************** *** 598,607 **** for (i = 0 ; i < sizeof(flagBits)/sizeof(flagBits[0]) ; i++) { DWORD bit = flagBits[i]; ! if ((maskExplicit & bit) != 0) { ! DWORD *pFlag = GetDwPtr(bit); ! const char *pName = GetBitName(bit); ! if (pFlag == NULL || pName == NULL) continue; --- 627,644 ---- for (i = 0 ; i < sizeof(flagBits)/sizeof(flagBits[0]) ; i++) { DWORD bit = flagBits[i]; + const char *pName = GetBitName(bit); ! if (pName) { ! const DWORD *pFlag; ! if ((maskExplicit & bit) != 0) ! pFlag = GetDwPtr(bit); ! else ! if (detail) ! pFlag = GetDwPtrDefault(bit); ! else ! continue; ! ! if (pFlag == NULL) continue; *************** *** 618,627 **** for (i = 0 ; i < sizeof(pinBits)/sizeof(pinBits[0]) ; i++) { DWORD bit = pinBits[i]; ! if ((maskExplicit & bit) != 0) { ! DWORD *pPin = GetDwPtr(bit); ! const char *pName = GetBitName(bit); ! if (pPin == NULL || pName == NULL) continue; --- 655,672 ---- for (i = 0 ; i < sizeof(pinBits)/sizeof(pinBits[0]) ; i++) { DWORD bit = pinBits[i]; + const char *pName = GetBitName(bit); ! if (pName) { ! const DWORD *pPin; ! if ((maskExplicit & bit) != 0) ! pPin = GetDwPtr(bit); ! else ! if (detail) ! pPin = GetDwPtrDefault(bit); ! else ! continue; ! ! if (pPin == NULL) continue; Index: setup.cpp =================================================================== RCS file: /cvsroot/com0com/com0com/setup/setup.cpp,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** setup.cpp 15 Oct 2007 13:49:04 -0000 1.20 --- setup.cpp 19 Oct 2007 16:09:55 -0000 1.21 *************** *** 20,23 **** --- 20,26 ---- * * $Log$ + * Revision 1.21 2007/10/19 16:09:55 vfrolov + * Implemented --detail-prms option + * * Revision 1.20 2007/10/15 13:49:04 vfrolov * Added entry point MainA *************** *** 111,114 **** --- 114,119 ---- /////////////////////////////////////////////////////////////// + static BOOL detailPrms = FALSE; + /////////////////////////////////////////////////////////////// static BOOL IsValidPortNum(int num) { *************** *** 323,329 **** LONG err = portParameters.Load(); ! char buf[100]; ! portParameters.FillParametersStr(buf, sizeof(buf)/sizeof(buf[0])); Trace(" %s %s\n", phPortName, buf); --- 328,334 ---- LONG err = portParameters.Load(); ! char buf[200]; ! portParameters.FillParametersStr(buf, sizeof(buf)/sizeof(buf[0]), detailPrms); Trace(" %s %s\n", phPortName, buf); *************** *** 345,349 **** if (err == ERROR_SUCCESS) { ! portParameters.FillParametersStr(buf, sizeof(buf)/sizeof(buf[0])); Trace("change %s %s\n", phPortName, buf); --- 350,354 ---- if (err == ERROR_SUCCESS) { ! portParameters.FillParametersStr(buf, sizeof(buf)/sizeof(buf[0]), detailPrms); Trace("change %s %s\n", phPortName, buf); *************** *** 650,656 **** } ! char buf[100]; ! portParameters.FillParametersStr(buf, sizeof(buf)/sizeof(buf[0])); Trace(" %s %s\n", phPortName, buf); --- 655,661 ---- } ! char buf[200]; ! portParameters.FillParametersStr(buf, sizeof(buf)/sizeof(buf[0]), detailPrms); Trace(" %s %s\n", phPortName, buf); *************** *** 905,908 **** --- 910,914 ---- "Options:\n" " --output <file> - file for output, default is console\n" + " --detail-prms - show detailed parameters\n" ); ConsoleWrite( *************** *** 980,983 **** --- 986,991 ---- return 1; + detailPrms = FALSE; + while (argc > 1) { if (*argv[1] != '-') *************** *** 990,994 **** argv += 2; argc -= 2; ! } else { ConsoleWrite("Invalid option %s\n", argv[1]); return 1; --- 998,1009 ---- argv += 2; argc -= 2; ! } ! else ! if (!strcmp(argv[1], "--detail-prms")) { ! detailPrms = TRUE; ! argv++; ! argc--; ! } ! else { ConsoleWrite("Invalid option %s\n", argv[1]); return 1; |