void InitOptions(bool console, char *path) { FILE *fp; strcat(inipath, getAmaPath()); strcat(inipath, AMAINI); fp = fopen(inipath, "r"); if (fp == NULL) { int k = 0; inipath[0] = '\0'; if(path) { strcpy(inipath, path); k = strlen(inipath); while(k > 0 && inipath[k-1] != '\\' && inipath[k-1] != '/') k--; } strcpy(inipath+k, AMAINI); fp = fopen(inipath, "r"); } if(fp) { char line[stringsize], *words[4]; while(fgets(line, sizeof(line), fp)) if(FindWords(line, words, 4) >= 4 && strcmp(words[0], "||") == 0 && strcmp(words[2], "=") == 0) SetOption(words[1], words[3]); fclose(fp); } if(!console) { SetOption("ConPromptMulti", ">>> "); SetOption("ConPromptSingle", "> "); } }
wxSTEditorOptions::wxSTEditorOptions(long editor_opt, long splitter_opt, long notebook_opt, long frame_opt, long config_opt, const wxString& defaultFileName, const wxString& defaultFilePath, const wxString& defaultFileExt ) { m_refData = new wxSTEditorOptions_RefData(); SetOptionInt(STE_OPTION_EDITOR, editor_opt); SetOptionInt(STE_OPTION_SPLITTER, splitter_opt); SetOptionInt(STE_OPTION_NOTEBOOK, notebook_opt); SetOptionInt(STE_OPTION_FRAME, frame_opt); SetOptionInt(STE_OPTION_CONFIG, config_opt); SetOptionInt(STE_OPTION_FINDREPLACE, STE_FR_DEFAULT_OPTIONS); SetOption(STE_OPTION_DEFAULT_FILENAME, defaultFileName); SetOption(STE_OPTION_DEFAULT_FILEPATH, defaultFilePath); SetOption(STE_OPTION_DEFAULT_FILEEXTS, defaultFileExt); SetOption(STE_OPTION_CFGPATH_BASE, wxT("/wxSTEditor")); SetOption(STE_OPTION_CFGPATH_PREFS, wxT("Preferences")); SetOption(STE_OPTION_CFGPATH_STYLES, wxT("Styles")); SetOption(STE_OPTION_CFGPATH_LANGS, wxT("Languages")); SetOption(STE_OPTION_CFGPATH_FRAME, wxT("Frame")); SetOption(STE_OPTION_CFGPATH_FILEHISTORY, wxT("RecentFiles")); SetOption(STE_OPTION_CFGPATH_FINDREPLACE, wxT("FindReplace")); SetUseGlobalPrefsStylesLangs(); SetFindReplaceData(&s_wxSTEditor_FindData, true); SetMenuManager(new wxSTEditorMenuManager(0, 0, STE_MENU_EDIT_DEFAULT, 0, 0, 0, STE_MENU_PREFS_DEFAULT, 0, 0, 0), false); //maks }
int vStrXPrintf ( StrXPrintfFunc outFunc, void *outParm, const prog_char *fmt, va_list args ) { Parameters p; char controlChar; p.numOutputChars = 0; p.outFunc = outFunc; p.outParm = outParm; controlChar = pgm_read_byte( fmt++ ); while ( controlChar != '\0' ) { if ( controlChar == '%' ) { short precision = -1; short longArg = 0; short base = 0; controlChar = pgm_read_byte( fmt++ ); p.minFieldWidth = 0; p.leadingZeros = 0; p.options = NO_OPTION; SetOption( &p, RIGHT_JUSTIFY ); /* * Process [flags] */ if ( controlChar == '-' ) { ClearOption( &p, RIGHT_JUSTIFY ); controlChar = pgm_read_byte( fmt++ ); } if ( controlChar == '0' ) { SetOption( &p, ZERO_PAD ); controlChar = pgm_read_byte( fmt++ ); } /* * Process [width] */ if ( controlChar == '*' ) { p.minFieldWidth = (short)va_arg( args, int ); controlChar = pgm_read_byte( fmt++ ); } else { while (( '0' <= controlChar ) && ( controlChar <= '9' ))
void EXPECT_CALLHttpServer() { EXPECT_CALL(m_HttpServer, AddReference()).WillRepeatedly(testing::Return(1)); EXPECT_CALL(m_HttpServer, ReleaseReference()).WillRepeatedly(testing::Return(1)); EXPECT_CALL(m_HttpServer, OpenWithSink(testing::_)).WillRepeatedly(testing::Return(CM_OK)); EXPECT_CALL(m_HttpServer, Disconnect(testing::_)).WillRepeatedly(testing::Return(CM_OK)); EXPECT_CALL(m_HttpServer, SendData(testing::_, testing::_)).WillRepeatedly(testing::Return(CM_OK)); EXPECT_CALL(m_HttpServer, GetRequestHeader(testing::_, testing::_)).WillRepeatedly(testing::Return(CM_OK)); EXPECT_CALL(m_HttpServer, SetOrAddResponseHeader(testing::_, testing::_)).WillRepeatedly(testing::Return(CM_OK)); EXPECT_CALL(m_HttpServer, SetOption(testing::_, testing::_)).WillRepeatedly(testing::Return(CM_OK)); EXPECT_CALL(m_HttpServer, GetOption(testing::_, testing::_)).WillRepeatedly(testing::Return(CM_OK)); EXPECT_CALL(m_HttpServer2, AddReference()).WillRepeatedly(testing::Return(1)); EXPECT_CALL(m_HttpServer2, ReleaseReference()).WillRepeatedly(testing::Return(1)); EXPECT_CALL(m_HttpServer2, OpenWithSink(testing::_)).WillRepeatedly(testing::Return(CM_OK)); EXPECT_CALL(m_HttpServer2, Disconnect(testing::_)).WillRepeatedly(testing::Return(CM_OK)); EXPECT_CALL(m_HttpServer2, SendData(testing::_, testing::_)).WillRepeatedly(testing::Return(CM_OK)); EXPECT_CALL(m_HttpServer2, GetRequestHeader(testing::_, testing::_)).WillRepeatedly(testing::Return(CM_OK)); EXPECT_CALL(m_HttpServer2, SetOrAddResponseHeader(testing::_, testing::_)).WillRepeatedly(testing::Return(CM_OK)); EXPECT_CALL(m_HttpServer2, SetOption(testing::_, testing::_)).WillRepeatedly(testing::Return(CM_OK)); EXPECT_CALL(m_HttpServer2, GetOption(testing::_, testing::_)).WillRepeatedly(testing::Return(CM_OK)); }
void Configure(SerialSettings& arSettings, boost::asio::serial_port& arPort) { //Set all the various options SetOption(arPort,ConvertBaud(arSettings.mBaud)); SetOption(arPort,ConvertDataBits(arSettings.mDataBits)); SetOption(arPort,ConvertParity(arSettings.mParity)); SetOption(arPort,ConvertStopBits(arSettings.mStopBits)); SetOption(arPort,ConvertFlow(arSettings.mFlowType)); // Hardwired to NONE currently }
void Compiler:: DoOption(int argc, char * argv [], const char * const option, const E_OPTION value, const bool par) { // Loop through all the // given switches to // find the one we want int i = 0; while (i != argc) { if (!strcmp(argv[i], option)) { // Found the option if (par) { // Has a parameter ++i; if (i < argc) { // Given one if (argv[i][0] == '-') { // Another option Message::Send(Message::INVALID_PARAMETER, option); } else { SetOption(value, argv[i]); // Could return here // But they may decide // to do more. ++i; } } else { // No parameter given Message::Send(Message::MISSING_PARAMETER, option); } } else { // No parameter required SetOption(value, ""); ++i; } } else { ++i; } } }
void V4L2encRecorder::SetOptionsFromProfile(RecordingProfile *profile, const QString &videodev, const QString &audiodev, const QString &vbidev) { LOG(VB_GENERAL, LOG_INFO, LOC + "SetOptionsFromProfile() -- begin"); //debugging (void)audiodev; (void)vbidev; SetOption("videodevice", videodev); SetOption("vbidevice", vbidev); SetOption("audiodevice", audiodev); SetOption("tvformat", gCoreContext->GetSetting("TVFormat")); SetOption("vbiformat", gCoreContext->GetSetting("VbiFormat")); SetIntOption(profile, "mpeg2bitratemode"); SetIntOption(profile, "mpeg2bitrate"); SetIntOption(profile, "mpeg2maxbitrate"); SetStrOption(profile, "mpeg2streamtype"); SetStrOption(profile, "mpeg2aspectratio"); SetStrOption(profile, "mpeg2language"); SetIntOption(profile, "samplerate"); SetStrOption(profile, "mpeg2audtype"); SetIntOption(profile, "audbitratemode"); SetIntOption(profile, "mpeg2audbitratel1"); SetIntOption(profile, "mpeg2audbitratel2"); SetIntOption(profile, "mpeg2audbitratel3"); SetIntOption(profile, "mpeg2audvolume"); SetIntOption(profile, "width"); SetIntOption(profile, "height"); SetIntOption(profile, "low_mpegbitratemode"); SetIntOption(profile, "low_mpegavgbitrate"); SetIntOption(profile, "low_mpegpeakbitrate"); SetIntOption(profile, "medium_mpegbitratemode"); SetIntOption(profile, "medium_mpegavgbitrate"); SetIntOption(profile, "medium_mpegpeakbitrate"); SetIntOption(profile, "high_mpegbitratemode"); SetIntOption(profile, "high_mpegavgbitrate"); SetIntOption(profile, "high_mpegpeakbitrate"); SetStrOption(profile, "audiocodec"); LOG(VB_GENERAL, LOG_INFO, LOC + "SetOptionsFromProfile -- end"); // debugging }
BOOL DM::DiskMaster::SetDefaultOption(DM::DM_OPTION *dm_option) { assert(dm_option); assert(opened); InitializeOptionWithDefaultValues(dm_option); return SetOption(dm_option); }
BOOL CEnCommandLineInfo::SetOption(LPCTSTR szFlag, DWORD dwParam) { CString sParam; sParam.Format(_T("%d"), dwParam); return SetOption(szFlag, sParam); }
BOOL CCLITerminal::LocalDoOption(CLISESSION *pSession, int nOption, BOOL bEnable, BOOL bRemote) { BOOL bWill = bEnable; if (pSession->nLocalOptions[nOption] == bEnable) return TRUE; switch(nOption) { case TELOPT_BINARY : case TELOPT_ECHO : SetOption(pSession, nOption, bEnable); break; case TELOPT_SGA : break; default : bWill = FALSE; break; } if ((pSession->nLocalOptions[nOption] != bWill) || bRemote) { unsigned char msg[3]; msg[0] = IAC; msg[1] = bWill ? WILL : WONT; msg[2] = nOption; WriteStream(pSession, (char *)msg, 3); pSession->nLocalOptions[nOption] = bWill; } return (bWill == bEnable) ? TRUE : FALSE; }
BOOL CCLITerminal::RemoteDoOption(CLISESSION *pSession, int nOption, BOOL bEnable, BOOL bRemote) { BOOL doFlag = bEnable; if (pSession->nRemoteOptions[nOption] == bEnable) return TRUE; switch(nOption) { case TELOPT_BINARY : case TELOPT_ECHO : SetOption(pSession, nOption, bEnable); break; case TELOPT_SGA : break; default : doFlag = FALSE; break; } if ((pSession->nRemoteOptions[nOption] != doFlag) || bRemote) { unsigned char msg[3]; msg[0] = IAC; msg[1] = doFlag ? DO : DONT; msg[2] = nOption; WriteStream(pSession, (char *)msg, 3); pSession->nRemoteOptions[nOption] = doFlag; } return (doFlag == bEnable) ? TRUE : FALSE; }
int JackNetUnixSocket::SetTimeOut ( int us ) { jack_log ( "JackNetUnixSocket::SetTimeout %d usecs", us ); //negative timeout, or exceding 10s, return if ( ( us < 0 ) || ( us > 10000000 ) ) return SOCKET_ERROR; struct timeval timeout; //less than 1sec if ( us < 1000000 ) { timeout.tv_sec = 0; timeout.tv_usec = us; } //more than 1sec else { float sec = static_cast<float> ( us ) / 1000000.f; timeout.tv_sec = ( int ) sec; float usec = ( sec - static_cast<float> ( timeout.tv_sec ) ) * 1000000; timeout.tv_usec = ( int ) usec; } return SetOption ( SOL_SOCKET, SO_RCVTIMEO, &timeout, sizeof ( timeout ) ); }
int JackNetUnixSocket::JoinMCastGroup ( const char* ip ) { struct ip_mreq multicast_req; inet_aton ( ip, &multicast_req.imr_multiaddr ); multicast_req.imr_interface.s_addr = htonl ( INADDR_ANY ); return SetOption ( IPPROTO_IP, IP_ADD_MEMBERSHIP, &multicast_req, sizeof ( multicast_req ) ); }
bool COptions::SetOption(unsigned int nID, wxString value) { if (nID >= OPTIONS_NUM) return false; if (options[nID].type != string) { long tmp; if (!value.ToLong(&tmp)) return false; return SetOption(nID, tmp); } Validate(nID, value); if (m_optionsCache[nID].strValue == value) { // Nothing to do return true; } m_optionsCache[nID].strValue = value; if (m_pXmlFile && options[nID].flags == normal) { SetXmlValue(nID, value); if (!m_save_timer.IsRunning()) m_save_timer.Start(15000, true); } COptionChangeEventHandler::DoNotify(nID); return true; }
//________________________________________________________________ void KVFlowTensor::init_KVFlowTensor() { // PRIVATE method // Private initialisation method called by all constructors. // All member initialisations should be done here. // // You should also (if your variable calculates several different quantities) // set up a correspondance between named values and index number // using method SetNameIndex(const Char_t*,Int_t) // in order for GetValue(const Char_t*) to work correctly. // The index numbers should be the same as in your getvalue_int(Int_t) method. fType = KVVarGlob::kOneBody; // this is a 1-body variable // reference frame = "CM" // weight = NRKE [non-relativistic kinetic energy] (1/2m) SetFrame("CM"); SetOption("weight", "NRKE"); fTensor.Zero(); SetNameIndex("FlowAngle", kFlowAngle); SetNameIndex("KinFlowRatio13", kKinFlowRatio13); SetNameIndex("KinFlowRatio23", kKinFlowRatio23); SetNameIndex("PhiReacPlane", kPhiReacPlane); SetNameIndex("SqueezeAngle", kSqueezeAngle); SetNameIndex("SqueezeRatio", kSqueezeRatio); SetNameIndex("NumberParts", kNumberParts); }
bool COptions::SetOption(unsigned int nID, wxString value) { if (nID >= OPTIONS_NUM) return false; if (options[nID].type != string) { long tmp; if (!value.ToLong(&tmp)) return false; return SetOption(nID, tmp); } Validate(nID, value); m_optionsCache[nID].cached = true; m_optionsCache[nID].strValue = value; if (m_pXmlFile && !options[nID].internal) { SetXmlValue(nID, value); if (!m_save_timer.IsRunning()) m_save_timer.Start(15000, true); } return true; }
bool Options::Save () { const char *pcszPath = OSD::MakeFilePath(MFP_SETTINGS, OPTIONS_FILE); // Open the options file for writing, fail if we can't FILE* hfOptions = fopen(pcszPath, "wb"); if (!hfOptions) return false; // Some settings shouldn't be saved SetOption(speed, 100); // Loop through each option to write out for (OPTION* p = aOptions ; p->pcszName ; p++) { switch (p->nType) { case OT_BOOL: fprintf(hfOptions, "%s=%s\r\n", p->pcszName, *p->pf ? "Yes" : "No"); break; case OT_INT: fprintf(hfOptions, "%s=%d\r\n", p->pcszName, *p->pn); break; case OT_STRING: fprintf(hfOptions, "%s=%s\r\n", p->pcszName, p->ppsz); break; } } fclose(hfOptions); return true; }
TDSPMultiEcho::TDSPMultiEcho(char *name, char *opt, UInt_t numecho, Double_t sRate, Double_t maxdoppler) { fListOfEchos = new TList(); fListOfEchos->SetOwner(); // Causes Tlist to manage the desctructor of its elements fTaus = new TArrayD(); fDiscreteTaus = new TArrayI(); fDoppler = new TArrayD(); fPhase = new TArrayD(); fModelGroup = 0; // No Model fNumEchos = numecho; SetName(name); SetNumEchos(50); SetSymbolRate(sRate); SetMaxDoppler(maxdoppler); SetOverSampling(1); SetNumSlices(40); fFilter = new TDSPVector(1); fFilter->Element(0)=1.; SetCarrierFrequencyGHz(5.2); // 5.2GHz fHaveRepresentation=kFALSE; fHaveImpulseResponse=kFALSE; fRandomPhases=kTRUE; fImpulseResponse=NULL; fTransferFunction=NULL; fScatteringFunction=NULL; SetOption(opt); }
int JackNetWinSocket::JoinMCastGroup(const char* ip) { struct ip_mreq multicast_req; multicast_req.imr_multiaddr.s_addr = inet_addr(ip); multicast_req.imr_interface.s_addr = htonl(INADDR_ANY); //12 is IP_ADD_MEMBERSHIP in winsock2 (differs from winsock1...) return SetOption(IPPROTO_IP, 12, &multicast_req, sizeof(multicast_req)); }
int BNetEndpoint::SetReuseAddr(bool enable) { if (fSocket < 0 && _SetupSocket() != B_OK) return fStatus; int onoff = (int) enable; return SetOption(SO_REUSEADDR, SOL_SOCKET, &onoff, sizeof(onoff)); }
void COptions::InitSettingsDir() { wxFileName fn; wxString dir(GetOption(OPTION_DEFAULT_SETTINGSDIR)); if (!dir.empty()) { wxStringTokenizer tokenizer(dir, _T("/\\"), wxTOKEN_RET_EMPTY_ALL); dir = _T(""); while (tokenizer.HasMoreTokens()) { wxString token = tokenizer.GetNextToken(); if (token[0] == '$') { if (token[1] == '$') token = token.Mid(1); else { wxString value; if (wxGetEnv(token.Mid(1), &value)) token = value; } } dir += token; const wxChar delimiter = tokenizer.GetLastDelimiter(); if (delimiter) dir += delimiter; } fn = wxFileName(dir, _T("")); fn.Normalize(wxPATH_NORM_ALL, wxGetApp().GetDefaultsDir()); } else { #ifdef __WXMSW__ wxChar buffer[MAX_PATH * 2 + 1]; if (SUCCEEDED(SHGetFolderPath(0, CSIDL_APPDATA, 0, SHGFP_TYPE_CURRENT, buffer))) { fn = wxFileName(buffer, _T("")); fn.AppendDir(_T("FileZilla")); } else { // Fall back to directory where the executable is if (GetModuleFileName(0, buffer, MAX_PATH * 2)) fn = buffer; } #else fn = wxFileName(wxGetHomeDir(), _T("")); fn.AppendDir(_T(".filezilla")); #endif } if (!fn.DirExists()) wxMkdir(fn.GetPath(), 0700); SetOption(OPTION_DEFAULT_SETTINGSDIR, fn.GetPath()); }
void wxOptionValue::SetOption(const wxString &name, bool update, const wxChar *format, ...) { va_list argptr; va_start(argptr, format); wxString s; s.PrintfV(format, argptr); va_end(argptr); SetOption(name, s, update); }
BOOL DM::DiskMaster::Open() { Close(); Initialize(); if (CmdCheckReady()) if (opened = CmdBoardOn()) if (SetOption(&option)) return opened; return (opened = FALSE); }
void Socket::SetReuseAddress(bool enabled) { #if defined(OS_WINDOWS) DWORD isEnabled = enabled ? TRUE : FALSE; #else std::int32_t isEnabled = enabled ? 1 : 0; #endif SetOption(SOL_SOCKET, SO_REUSEADDR, reinterpret_cast<const std::int8_t *>(&isEnabled), sizeof(isEnabled)); }
void Socket::SetNoDelay(bool enabled) { #if defined(OS_WINDOWS) BOOL isEnabled = enabled ? TRUE : FALSE; #else std::int32_t isEnabled = enabled ? 1 : 0; #endif SetOption(IPPROTO_TCP, TCP_NODELAY, reinterpret_cast<const std::int8_t *>(&isEnabled), sizeof(isEnabled)); }
void Socket::SetOOBInline(bool enabled) { #if defined(OS_WINDOWS) DWORD isEnabled = enabled ? TRUE : FALSE; #else std::int32_t isEnabled = enabled ? 1 : 0; #endif SetOption(SOL_SOCKET, SO_OOBINLINE, reinterpret_cast<const std::int8_t *>(&isEnabled), sizeof(isEnabled)); }
HX_RESULT CHXClientSocket::DoClientSockInit() { // Init() or full ctor must be called first HX_ASSERT(m_family != HX_SOCK_FAMILY_NONE); HX_ASSERT(m_type != HX_SOCK_TYPE_NONE); HX_RESULT hr = InitSelector(); if (FAILED(hr)) { return hr; } // Configure default client-specific socket options... // XXXLCM These defaults may be more appropriately configured in higher-level code // where the actual needs of the socket are better known. For example, will // all UDP sockets on the client need large receive buffers? // // By default the socket will allocate a default-sized buffer to read into, then set // the buffer size to the amount actually read in after the underlying socket read is // completed. In that case the extra buffer space is not freed--the size associated with // the buffer is merely adjusted. This option forces a copy so we conserve memory at the // expense of an extra copy for each read. // HXBOOL bCopySocketReadBuffers = TRUE; ReadPrefBOOL( m_punkContext, "CopySocketReadBuffers", bCopySocketReadBuffers ); if( bCopySocketReadBuffers ) { SetOption(HX_SOCKOPT_APP_READBUF_ALLOC, HX_SOCK_READBUF_SIZE_COPY); } else { SetOption(HX_SOCKOPT_APP_READBUF_ALLOC, HX_SOCK_READBUF_SIZE_DEFAULT); } //SetOption(HX_SOCKOPT_APP_BUFFER_TYPE, HX_SOCKBUF_TIMESTAMPED); InitPerReadBufSize(); InitRcvBufSize(); return HXR_OK; }
void init_stemmer() { /* Initialize options */ UnSetOption(print_affixes); SetOption(change_case); UnSetOption(tag_output); UnSetOption(fspec); state = any; read_verbstem("third-party/morpha/verbstem.list"); }
//local loop********************************************************************************************************* int JackNetWinSocket::SetLocalLoop() { //char disable = 0; /* see http://msdn.microsoft.com/en-us/library/aa916098.aspx Default value is TRUE. When TRUE, data that is sent from the local interface to the multicast group to which the socket is joined, including data sent from the same socket, will be echoed to its receive buffer. */ char disable = 1; return SetOption(IPPROTO_IP, IP_MULTICAST_LOOP, &disable, sizeof(disable)); }
Bool CZmq::Init(Int32 iType) { A_Exception(m_pHandle == 0); m_iType = iType; m_pHandle = zmq_socket(g_ZmqManager->GetZmqCtx(), m_iType); if (m_pHandle) { Int32 iLinger = 0; if (!SetOption(ZMQ_LINGER, &iLinger, sizeof(iLinger))) return false; Int32 iTimeout = HZMQ_TIMEOUT; if (!SetOption(ZMQ_RCVTIMEO, &iTimeout, sizeof(iTimeout)) || !SetOption(ZMQ_SNDTIMEO, &iTimeout, sizeof(iTimeout)) ) return false; } return m_pHandle != 0; }