void __fastcall TQRigSyncMain::Timer1Timer(TObject *Sender) { static bool inTimer = false; if (inTimer) { return; } inTimer = true; try { float freq = qs1r->getFrequency(0); Label1->Caption = String(freq); static long lastFreq = -1; long lfreq = (long)freq; if ( lfreq != lastFreq ) { RPCPubSub::publish( "SecondRX", "Frequency", makeStr(lfreq), psPublished ); lastFreq = lfreq; } } catch (const Ice::Exception& ex) { ShowMessage(ex.what()); } catch (const char* msg) { ShowMessage(msg); } inTimer = false; }
//--------------------------------------------------------------------------- void TSingleLogFrame::closeContest() { if ( TContestApp::getContestApp() ) { RPCPubSub::publish( "ContestLog", contest->publishedName, makeStr( 0 ), psRevoked ); TContestApp::getContestApp() ->closeFile( contest ); contest = 0; } }
void addSymbol(const char *name, type_t type) { // fprintf(stderr, "addSymbol begin\n"); int hash = strHash(name); int pos = hash; while (symbol_table[pos].valid) { pos = (pos + 1) % ID_MAX; if (pos == hash) { attrError("Too many variables"); return; } } symbol_table[pos].valid = 1; symbol_table[pos].type = type; symbol_table[pos].name = makeStr(name); // fprintf(stderr, "Saving %s to position %d\n", name, hash); // fprintf(stderr, "addSymbol succeeded\n"); }
void __fastcall TSingleLogFrame::PublishTimerTimer( TObject */*Sender*/ ) { LoggerContestLog * ct = dynamic_cast<LoggerContestLog *>( contest ); if ( ct && ct->isMinosFile() && !ct->isReadOnly() && !ct->isPostEntry() ) { int stanzaCount = contest->getStanzaCount(); if ( lastStanzaCount != stanzaCount ) { // publish this contest details - what to use? // category LoggerContestLog // name filename(?) // value stanzaCount RPCPubSub::publish( "ContestLog", contest->publishedName, makeStr( stanzaCount ), psPublished ); lastStanzaCount = stanzaCount; } } }
bool reg1test::exportTest( HANDLE expfd ) { // export current contest as REG1TEST writer wr( expfd ); char lbuff[ 1024 ]; wr.lwrite( "[REG1TEST;1]" ); // First the header info // calc mult count int ltot = 0; int nctry = 0; int ndistrict = 0; int nlocs = 0; if ( ct->countryMult.getValue() ) { ltot += ct->nctry ; nctry = ct->nctry; } if ( ct->districtMult.getValue() ) { ltot += ct->ndistrict; ndistrict = ct->ndistrict; } if ( ct->locMult.getValue() ) { ltot += ct->nlocs; nlocs = ct->nlocs; } if ( ltot == 0 ) ltot = 1; std::vector <std::string> remarks; remarks.push_back( ct->entCondx1.getValue() ); remarks.push_back( ct->entCondx2.getValue() ); remarks.push_back( ct->entCondx3.getValue() ); remarks.push_back( ct->entCondx4.getValue() ); int nvalid = 0; // valid QSOs int nlines = 0; // QSO records for ( unsigned int i = 0; i < ct->ctList.size(); i++ ) { BaseContact *dct = ct->ctList[ i ]; ContestContact *cct = dynamic_cast<ContestContact *>( dct ); // Extract comments for "Remarks" section cct->addReg1TestComment( remarks ); if ( cct->contactFlags.getValue() & ( LOCAL_COMMENT | COMMENT_ONLY | DONT_PRINT ) ) continue; nlines++; if ( cct->contactScore.getValue() > 0 ) nvalid++; } // get the best DX contact BaseContact *bestdx = ct->getBestDX(); /* // build the list of main operators std::set <std::string> op1list; for ( LogIterator i = ct->ctList.begin(); i != ct->ctList.end(); i++ ) { op1list.insert( ( *i ) ->op1.getValue() ); } */ linelist[ ( int ) TName ] = reg1testLine( "TName", ct->name.getValue() /*, "Contest Name"*/ ), linelist[ ( int ) TdDate ] = reg1testLine( "TDate", ct->dateRange( DTGFULL ) /*, "Start Date;End Date"*/ ); linelist[ ( int ) PCall ] = reg1testLine( "PCall", ct->mycall.fullCall.getValue() /*, "Callsign Used"*/ ); linelist[ ( int ) PWWLo ] = reg1testLine( "PWWLo", ct->myloc.loc.getValue() /*, "Locator Used"*/ ); linelist[ ( int ) PExch ] = reg1testLine( "PExch", ct->location.getValue() /*, "Exchange Used"*/ ); linelist[ ( int ) PAdr1 ] = reg1testLine( "PAdr1", ct->sqth1.getValue() /*, "Address line 1/2 of station"*/ ); linelist[ ( int ) PAdr2 ] = reg1testLine( "PAdr2", ct->sqth2.getValue() /*, "Address line 2/2 of station"*/ ); linelist[ ( int ) PSect ] = reg1testLine( "PSect", ct->entSect.getValue() /*, "Section Entered"*/ ); linelist[ ( int ) PBand ] = reg1testLine( "PBand", ct->band.getValue() /*, "Band Used"*/ ); linelist[ ( int ) PClub ] = reg1testLine( "PClub", ct->entrant.getValue() /*, "Name of club/group"*/ ); linelist[ ( int ) RName ] = reg1testLine( "RName", ct->entName.getValue() /*, "Name of responsible operator"*/ ); linelist[ ( int ) RCall ] = reg1testLine( "RCall", ct->entCall.getValue() /*, "Callsign of responsible operator"*/ ); linelist[ ( int ) RAdr1 ] = reg1testLine( "RAdr1", ct->entAddr1.getValue() /*, "Address line 1/2 of responsible operator"*/ ); linelist[ ( int ) RAdr2 ] = reg1testLine( "RAdr2", ct->entAddr2.getValue() /*, "Address line 2/2 of responsible operator"*/ ); linelist[ ( int ) RCity ] = reg1testLine( "RCity", ct->entCity.getValue() /*, "City of responsible operator"*/ ); linelist[ ( int ) RPoCo ] = reg1testLine( "RPoCo", ct->entPostCode.getValue() /*, "Post Code of responsible operator"*/ ); linelist[ ( int ) RCoun ] = reg1testLine( "RCoun", ct->entCountry.getValue() /*, "Country of responsible operator"*/ ); linelist[ ( int ) RPhon ] = reg1testLine( "RPhon", ct->entPhone.getValue() /*, "Phone no. of responsible operator"*/ ); linelist[ ( int ) RHBBS ] = reg1testLine( "RHBBS", ct->entEMail.getValue() /*, "EMAIL address of responsible operator"*/ ); linelist[ ( int ) MOpe1 ] = reg1testLine( "MOpe1", ct->ops1.getValue() /*, "Operators line 1/2"*/ ); linelist[ ( int ) MOpe2 ] = reg1testLine( "MOpe2", ct->ops2.getValue() /*, "Operators line 2/2"*/ ); linelist[ ( int ) STXEq ] = reg1testLine( "STXEq", ct->entTx.getValue() /*, "TX Equipment"*/ ); linelist[ ( int ) SPowe ] = reg1testLine( "SPowe", ct->power.getValue() /*, "TX Power (W)"*/ ); linelist[ ( int ) SRXEq ] = reg1testLine( "SRXEq", ct->entRx.getValue() /*, "RX Equipment"*/ ); linelist[ ( int ) SAnte ] = reg1testLine( "SAnte", ct->entAnt.getValue() /*, "Antenna"*/ ); linelist[ ( int ) SAntH ] = reg1testLine( "SAntH", ct->entAGL.getValue() + ";" + ct->entASL.getValue() /*, "Antenna Height agl;height asl"*/ ); linelist[ ( int ) CQSOs ] = reg1testLine( "CQSOs", makeStr( nvalid ) + ";1" /*, "Claimed no. of valid QSOs;Band multiplier"*/ ); linelist[ ( int ) CQSOP ] = reg1testLine( "CQSOP", makeStr( ct->contestScore ) ); /*, "Claimed no. of QSO points"*/ linelist[ ( int ) CWWLs ] = reg1testLine( "CWWLs", makeStr( nlocs ) + ";0;1" ); /*, "Claimed no. of WWLs;Bonus per new WWL;WWL multiplier"*/ linelist[ ( int ) CWWLB ] = reg1testLine( "CWWLB", "0" ); /*, "Claimed no. of WWL bonus points"*/ linelist[ ( int ) CExcs ] = reg1testLine( "CExcs", makeStr( ndistrict ) + ";0;1" ); /*, "Claimed no. of exchanges; Bonus for each new exchange; Exchange Multiplier"*/ linelist[ ( int ) CExcB ] = reg1testLine( "CExcB", "0" ); /*, "Claimed no. of exchange bonus points"*/ linelist[ ( int ) CDXCs ] = reg1testLine( "CDXCs", makeStr( nctry ) + ";0;1" ); /*, "Claimed no. of DXCCs; Bonus for each new DXCC;DXCC multiplier"*/ linelist[ ( int ) CDXCB ] = reg1testLine( "CDXCB", "0" ); /*, "Claimed no of DXCC bonus points"*/ linelist[ ( int ) CToSc ] = reg1testLine( "CToSc", makeStr( ct->contestScore * ltot ) ); /*, "Claimed total score"*/ linelist[ ( int ) CODXC ] = reg1testLine( "CODXC", bestdx ? ( ( bestdx->cs.fullCall.getValue() + ";" + bestdx->loc.loc.getValue() + ";" + makeStr( bestdx->contactScore.getValue() ).c_str() ).c_str() ) : ";;" ); /*, "(Best DX) Callsign; Locator; Distance"*/ for ( int i = 0; i < LineCount; i++ ) { sprintf( lbuff, "%s=%s", linelist[ i ].prefix.c_str(), linelist[ i ].data.c_str() ); wr.lwrite( lbuff ); } /* [Remarks]Remarks identifier F Remarks lines */ wr.lwrite( "[Remarks]" ); for ( unsigned int i = 0; i < remarks.size(); i++ ) { wr.lwrite( remarks[ i ].c_str() ); } TMyRCVersion RCVersion; RCVersion.initialise(); String ProductName = RCVersion.ProductName; String Version = RCVersion.FileVersion; String pver = "Produced by " + ProductName + " version " + Version; wr.lwrite( pver.c_str() ); /* [QSORecords;Number of QSO records following]QSO records identifier;number of QSO records following */ sprintf( lbuff, "[QSORecords;%d]", nlines ); wr.lwrite( lbuff ); // and then the contact list for ( unsigned int i = 0; i < ct->ctList.size(); i++ ) { BaseContact *dct = ct->ctList[ i ]; ContestContact *cct = dynamic_cast<ContestContact *>( dct ); if ( cct->contactFlags.getValue() & ( LOCAL_COMMENT | COMMENT_ONLY | DONT_PRINT ) ) { // should all COMMENT_ONLY records go into remarks? // and also comments on individual QSOs? continue; } std::string sbuff; cct->getReg1TestText( sbuff ); // lbuff if "bsize" = 256 if ( sbuff.length() == 0 ) continue; trimr( sbuff ); // No need to pad to 250!! wr.lwrite( sbuff.c_str() ); } return true; }
bool baseRunApp( const std::string &commandLine, const std::string ¶ms, const std::string &rundir, std::string &outfname, bool wait, bool minimise ) { STARTUPINFO StartInfo; StartInfo.hStdInput = 0; StartInfo.hStdOutput = 0; StartInfo.hStdError = 0; char appFName[ 255 ]; int nLen = 0; nLen = ::GetModuleFileName( HInstance, appFName, 255 ); appFName[ nLen ] = '\0'; String fname = ExtractFilePath( appFName ); fname += "TraceLog\\Runapp_"; String progname = ExtractFileName( commandLine.c_str() ); progname = progname.SubString( 1, progname.Pos( "." ) - 1 ); std::string outFileName = ( fname + progname + ".log" ).c_str() ; // use the system defined TEMP directory std::string inFileName = "%TEMP%\\NullInput.txt"; char cline[ 1024 ]; DWORD cnt = ExpandEnvironmentStrings( inFileName.c_str(), cline, 1023 ); if ( !cnt ) { logMessage( std::string( fname.c_str() ), std::string( "Error Expanding Environment Strings in " ) + inFileName + lastError() ); outfname = outFileName.c_str(); return false; } cline[ cnt ] = 0; inFileName = cline; PROCESS_INFORMATION ProcessInformation; memset( &StartInfo, 0, sizeof( STARTUPINFO ) ); StartInfo.cb = sizeof( STARTUPINFO ); StartInfo.dwFlags = STARTF_USESTDHANDLES | STARTF_USESHOWWINDOW; StartInfo.wShowWindow = ( minimise ? SW_MINIMIZE : SW_NORMAL ); SECURITY_ATTRIBUTES outsa; outsa.nLength = sizeof( outsa ); outsa.lpSecurityDescriptor = 0; outsa.bInheritHandle = TRUE; StartInfo.hStdOutput = CreateFile( outFileName.c_str(), GENERIC_WRITE | GENERIC_READ, FILE_SHARE_WRITE | FILE_SHARE_READ, &outsa, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_WRITE_THROUGH, 0 ); if ( StartInfo.hStdOutput == INVALID_HANDLE_VALUE ) { logMessage( std::string( fname.c_str() ), std::string( "Error opening output file " ) + outFileName.c_str() + " : " + lastError() ); logMessage( std::string( fname.c_str() ), std::string( "Current directory is " ) + GetCurrentDir().c_str() ); outfname = outFileName.c_str(); return false; } logMessage( std::string( fname.c_str() ), std::string( "Output file is " ) + outFileName ); SECURITY_ATTRIBUTES insa; insa.nLength = sizeof( insa ); insa.lpSecurityDescriptor = 0; insa.bInheritHandle = TRUE; StartInfo.hStdInput = CreateFile( inFileName.c_str(), GENERIC_READ, FILE_SHARE_READ, &insa, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0 ); if ( StartInfo.hStdInput == INVALID_HANDLE_VALUE ) { logMessage( std::string( fname.c_str() ), std::string( "Error opening input file " ) + inFileName.c_str() + " : " + lastError() ); logMessage( std::string( fname.c_str() ), std::string( "Current directory is " ) + GetCurrentDir().c_str() ); outfname = outFileName.c_str(); return false; } // StdErr is a duplicate of StdOut BOOL cret = DuplicateHandle( GetCurrentProcess(), // handle to process with handle to duplicate StartInfo.hStdOutput, // handle to duplicate GetCurrentProcess(), // handle to process to duplicate to &StartInfo.hStdError, // pointer to duplicate handle 0, // access for duplicate handle TRUE, // handle inheritance flag DUPLICATE_SAME_ACCESS // optional actions ); if ( !cret ) { logMessage( std::string( fname.c_str() ), std::string( "Error duplicating handle for StdErr : " ) + lastError() ); outfname = outFileName.c_str(); return false; } std::string cmdl = commandLine; if ( params.size() ) { cmdl += " " + params; } cnt = ExpandEnvironmentStrings( cmdl.c_str(), cline, 1023 ); if ( !cnt ) { logMessage( std::string( fname.c_str() ), std::string( "Error Expanding Environment Strings in " ) + cmdl + lastError() ); outfname = outFileName.c_str(); return false; } cline[ cnt ] = 0; // All of our handles get passed on. cret = CreateProcess( 0, // pointer to name of executable module cline, // pointer to command line string - NOT CONST! 0, // pointer to process security attributes 0, // pointer to thread security attributes TRUE, // handle inheritance flag - must be true to assign even the standard handles CREATE_DEFAULT_ERROR_MODE, // creation flags 0, // pointer to new environment block ( rundir.size() ? rundir.c_str() : 0 ), // pointer to current directory name &StartInfo, // pointer to STARTUPINFO &ProcessInformation // pointer to PROCESS_INFORMATION ); // close all the handles - they are now given to the child process if ( StartInfo.hStdInput != INVALID_HANDLE_VALUE ) CloseHandle( StartInfo.hStdInput ); if ( StartInfo.hStdError != INVALID_HANDLE_VALUE ) CloseHandle( StartInfo.hStdError ); if ( StartInfo.hStdOutput != INVALID_HANDLE_VALUE ) CloseHandle( StartInfo.hStdOutput ); if ( !cret ) { logMessage( std::string( fname.c_str() ), std::string( "Error running <" ) + commandLine + "> : " + lastError() ); outfname = outFileName.c_str(); return false; } DWORD exitstat = 1; if ( wait ) { // we need to look at a closedown flag as well... WaitForSingleObject( ProcessInformation.hProcess, INFINITE ); if ( !GetExitCodeProcess( ProcessInformation.hProcess, &exitstat ) ) { logMessage( std::string( outfname ), std::string( "Unable to get process exit status" ) + lastError() ); } } CloseHandle( ProcessInformation.hThread ); CloseHandle( ProcessInformation.hProcess ); if ( wait ) { logMessage( std::string( fname.c_str() ), std::string( "Exit status was " ) + makeStr( exitstat ) ); } outfname = outFileName.c_str(); return true; }
ProfileEntry::ProfileEntry( int id, const char *n, bool d, const char *h ) : id( id ), name( n ), bdefaultval( d ), sdefaultval( makeStr( d ) ), hint( h ), pt( petBool ) {}
ProfileEntry::ProfileEntry( int id, const char *n, int d, const char *h ) : id( id ), name( n ), idefaultval( d ), sdefaultval( makeStr( d ) ), hint( h ), pt( petInteger ) {}