VOID CMMControlThread::InputCommand() { DWORD dwRet; char szInputBuf[64] = { 0 }; Usage(); while (::gets_s(szInputBuf)) { std::string strInput = szInputBuf; if (strInput.size() < 5) { if (strInput.find("stop") || strInput.find("STOP")) { dwRet = CheckInputData(strInput, 2); if (dwRet != E_RET_SUCCESS) { ::memset(szInputBuf, 0x00, sizeof(szInputBuf)); continue; } } SetCommand(strInput); } else { if (strInput.find("start") || strInput.find("START")) { dwRet = CheckInputData(strInput, 1); if (dwRet != E_RET_SUCCESS) { ::memset(szInputBuf, 0x00, sizeof(szInputBuf)); continue; } SetCommand(strInput); } } Usage(); ::memset(szInputBuf, 0x00, sizeof(szInputBuf)); } }
static int UserMoniter() { char command[100]; int action = -1, target = -1, param1 = -1, param2 = -1, value; int con_per_worker; int res; char c; command_t cmd; MonitorUsage(); while (1) { int count = 0; printf("user_moniter>>"); scanf("%s", command); sscanf(command,"%d:%d:%d:%d",&action, &target, ¶m1, ¶m2); if (action == -1 || target == -1 || param1 == -1 || param2 == -1) { MonitorUsage(); continue; } con_per_worker = param2 / worker; SetCommand(cmd, action, target, param1, con_per_worker); while (count < worker - 1) { res = write(pipe_fd[count][1],&cmd, sizeof(command_t)); sys_assert(res, "write, user_moniter"); count++; } SetCommand(cmd, action, target, param1, param2 - (worker - 1) * con_per_worker); res = write(pipe_fd[count][1],&cmd, sizeof(command_t)); sys_assert(res, "write, user_moniter"); } }
/** \fn MythSystemLegacy::setCommand(const QString &command) * \brief Resets an existing MythSystemLegacy object to a new command */ void MythSystemLegacy::SetCommand(const QString &command, uint flags) { if (flags & kMSRunShell) { SetCommand(command, QStringList(), flags); } else { QString abscommand; QStringList args; if (!d->ParseShell(command, abscommand, args)) { LOG(VB_GENERAL, LOG_ERR, QString("MythSystemLegacy(%1) command not understood") .arg(command)); m_status = GENERIC_EXIT_INVALID_CMDLINE; return; } SetCommand(abscommand, args, flags); } if (m_settings["UseStdin"]) m_stdbuff[0].open(QIODevice::WriteOnly); if (m_settings["UseStdout"]) m_stdbuff[1].open(QIODevice::ReadOnly); if (m_settings["UseStderr"]) m_stdbuff[2].open(QIODevice::ReadOnly); }
void CEffectVis::MakeChange(ROWINDEX row, int y) //----------------------------------------------- { if(!m_pSndFile->Patterns.IsValidPat(m_nPattern)) return; ModCommand &m = *m_pSndFile->Patterns[m_nPattern].GetpModCommand(row, m_nChan); switch (m_nAction) { case kAction_FillFX: // Only set command if there isn't a command already at this row and it's not a PC note if (!GetCommand(row) && !IsPcNote(row)) { SetCommand(row, effectInfo.GetEffectFromIndex(m_nFillEffect)); } // Always set param SetParamFromY(row, y); break; case kAction_OverwriteFX: // Always set command and param. Blows away any PC notes. SetCommand(row, effectInfo.GetEffectFromIndex(m_nFillEffect)); SetParamFromY(row, y); break; case kAction_FillPC: // Fill only empty slots with PC notes - leave other slots alone. if (m.IsEmpty()) { SetPcNote(row); } // Always set param SetParamFromY(row, y); break; case kAction_OverwritePC: // Always convert to PC Note and set param value SetPcNote(row); SetParamFromY(row, y); break; case kAction_Preserve: if (GetCommand(row) || IsPcNote(row)) { // Only set param if we have an effect type or if this is a PC note. // Never change the effect type. SetParamFromY(row, y); } break; } m_pModDoc->SetModified(); m_pModDoc->UpdateAllViews(nullptr, PatternHint(m_nPattern).Data()); }
void CVSRunner::Export(const wxString& repo, const wxString& module, const wxString& dir, const wxString& cwd, const wxString& rev) { SetCommand("export:release"); //SetTarget("*" + cwd + dir); wxString cmd(" -z6 -d " + Q(repo) + "export -f -r" + Q(rev) + "-d" + Q(dir) + Q(module)); Run(cmd, cwd); }
void GDBPlot2DCommand::UpdateRange ( const JIndex curveIndex, const JInteger min, const JInteger max ) { CMPlot2DCommand::UpdateRange(curveIndex, min, max); JString cmd = "set print pretty off\nset print array off\n" "set print repeats 0\nset width 0\n"; for (JInteger i=min; i<=max; i++) { cmd += "print "; cmd += GetDirector()->GetXExpression(curveIndex, i); cmd.AppendCharacter('\n'); cmd += "print "; cmd += GetDirector()->GetYExpression(curveIndex, i); cmd.AppendCharacter('\n'); } SetCommand(cmd); }
ShortcutsSpec::ShortcutsSpec(BMessage* from) : CLVListItem(0, false, false, _height), fCommand(NULL), fTextOffset(0), fBitmap(ICON_BITMAP_RECT, ICON_BITMAP_SPACE), fLastBitmapName(NULL), fBitmapValid(false), fCursorPtsValid(false) { const char* temp; if (from->FindString("command", &temp) != B_NO_ERROR) { printf(CLASS); printf(" Error, no command string in archive BMessage!\n"); temp = ""; } SetCommand(temp); if (from->FindInt32("key", (int32*) &fKey) != B_NO_ERROR) { printf(CLASS); printf(" Error, no key int32 in archive BMessage!\n"); } for (int i = 0; i < NUM_META_COLUMNS; i++) if (from->FindInt32("mcidx", i, (int32*)&fMetaCellStateIndex[i]) != B_NO_ERROR) { printf(CLASS); printf(" Error, no modifiers int32 in archive BMessage!\n"); } }
ShortcutsSpec::ShortcutsSpec(BMessage* from) : BRow(), fCommand(NULL), fBitmap(ICON_BITMAP_RECT, ICON_BITMAP_SPACE), fLastBitmapName(NULL), fBitmapValid(false), fCursorPtsValid(false) { const char* temp; if (from->FindString("command", &temp) != B_NO_ERROR) { printf(CLASS); printf(" Error, no command string in archive BMessage!\n"); temp = ""; } SetCommand(temp); if (from->FindInt32("key", (int32*) &fKey) != B_NO_ERROR) { printf(CLASS); printf(" Error, no key int32 in archive BMessage!\n"); } for (int i = 0; i < NUM_META_COLUMNS; i++) if (from->FindInt32("mcidx", i, (int32*)&fMetaCellStateIndex[i]) != B_NO_ERROR) { printf(CLASS); printf(" Error, no modifiers int32 in archive BMessage!\n"); } for (int i = 0; i <= STRING_COLUMN_INDEX; i++) SetField(new BStringField(GetCellText(i)), i); }
void CVSRunner::Checkout(const wxString& proto, const wxString& repo, const wxString& module, const wxString& workingdir, const wxString& user, const wxString& revision) { SetCommand("checkout"); //SetTarget(workingdir); wxString cmd("-z6 -d " + repo + " checkout -d" + Q(workingdir)+ (revision.IsEmpty() ? "" : " -r" + Q(revision)) + Q(module)); Run(cmd); }
MythSystem::MythSystem(const QString &command, uint flags) { setObjectName(QString("MythSystem(%1)").arg(command)); m_semReady.release(1); // initialize initializePrivate(); SetCommand(command, flags); }
MythSystem::MythSystem(const QString &command, const QStringList &args, uint flags) { m_semReady.release(1); // initialize initializePrivate(); SetCommand(command, args, flags); }
/** HID class driver callback function for the processing of HID reports from the host. */ void CALLBACK_HID_Device_ProcessHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, const uint8_t ReportID, const uint8_t ReportType, const void* ReportData, const uint16_t ReportSize) { uint8_t* Data = (uint8_t*)ReportData; //get the data out of the function for later use for (int i=0; i<ConfigSize; i++) { input_data[i] = Data[i]; } //Determine which function to call based on the package-id switch(input_data[0]) { case 0x00: ConfigRequest(); break; case 0x01: SetCommand(); break; case 0x02: DataRequest(); break; case 0x03: ErrorRequest(); break; default: ReturnError(0x01); break; } return; }
logical CommandLine :: Copy (CommandLine *cmd_line ) { int32 i = 0; logical term = NO; ResetCommand(); while ( parm_list[i] ) parm_list[i++] = NULL; file_handle = NULL; cmd_name = NULL; cmd_list = NULL; entry_points = NULL; echo = NO; top_cmdline = cmd_line->get_top_cmdline(); condition = NULL; type = cmd_line->get_type(); if ( cmd_line->get_cmd_name() ) cmd_name = strdup(cmd_line->get_cmd_name()); SetCommand(cmd_line->get_command()); // type_function.SetInstance(this); return(term); }
CommandObject::CommandObject(CommunicationID uRequestID, char* pCommand) { SetCommand(pCommand); m_requestID = uRequestID; m_eContentType = CONTENT_REQUEST; m_eResponseState = NO_RESPONSE; }
VOID CManagerThread::CheckControlCommand(ControlCommand &refControlCommand) { GetCommand(refControlCommand); // ControlCommand is initialized ControlCommand controlCommand = ""; SetCommand(controlCommand); }
void CVSRunner::Update(const wxString& target, const wxString& revision, const wxString& date) { SetCommand("CVS-update"); SetTarget(target); wxFileName fn(target); wxString file = wxDirExists(target) ? "" : Q(fn.GetFullName()); wxString cmd(" -z6 update " + file + (revision.IsEmpty() ? "" : " -r" + Q(revision)) + (date.IsEmpty() ? "" : " -D" + Q(date))); Run(cmd, fn.GetPath(wxPATH_GET_VOLUME)); }
void CVSRunner::Diff(const wxString& target) { SetCommand("CVS-diff"); //SetTarget(target); wxFileName fn(target); wxString file = Q(fn.GetFullName()); wxString cmd(" -z6 diff " + file); Run(cmd, fn.GetPath(wxPATH_GET_VOLUME)); }
void CVSRunner::Login(const wxString& proto, const wxString& repo, const wxString& user, const wxString& pass) { // FIXME: this has to be changed to respect new meaning of repo // cvs -d :pserver:bach:[email protected]:/usr/local/cvsroot login //SetTarget(""); SetCommand("CVS-login"); wxString cmd("-z6 -d " + proto + user + ":" + pass + "@" + repo + " login"); RunBlocking(cmd); }
void CommanderFromFile::Main() { sleep(30); if (command_ == NONE) { FILE *F; char buf[CR_BUFF_SIZE]; commander_mutex_.Lock(); F = fopen(file_name_.c_str(), "rw"); if(F) { if(fgets(buf, CR_BUFF_SIZE - 1, F)) { char* eol = strchr(buf, '\n'); if (eol != NULL) *eol = '\0'; if(strstr(buf, CL_PAUSE)) { log_status("Setting command to PAUSE."); command_ = PAUSE; algo_.SetNumThreads(0); SetCommand(); } else if(strstr(buf, CL_RESUME)) { log_status("Setting command to RESUME."); command_ = RESUME; algo_.ResumeThreads(); SetCommand(); } else if (strstr(buf, CL_SET_NUM_THREADS)) { log_status("Setting command to SET_NUM_THREADS."); command_ = SET_NUM_THREADS; string tmp = strstr(buf, CL_SET_NUM_THREADS); if(tmp.length()>=sizeof(CL_SET_NUM_THREADS)) { attributes_ = tmp.substr(sizeof(CL_SET_NUM_THREADS)); } else { attributes_ = ""; } algo_.SetNumThreads(atoi(attributes_.c_str())); SetCommand(); } else { log_warn("unknown command."); } } fclose(F); remove(file_name_.c_str()); } commander_mutex_.Unlock(); } }
void CVSRunner::Commit(const wxString& target, const wxString& message) { SetCommand("CVS-commit"); //SetTarget(target); TempFile msg(message); wxFileName fn(target); wxString file = wxDirExists(target) ? "" : Q(fn.GetFullName()); wxString cmd(" -z6 commit " + file + " -F " + Q(msg.name)); Run(cmd, fn.GetPath(wxPATH_GET_VOLUME)); }
JVMPlot2DCommand::JVMPlot2DCommand ( CMPlot2DDir* dir, JArray<JFloat>* x, JArray<JFloat>* y ) : CMPlot2DCommand(dir, x, y) { SetCommand("NOP"); }
/** \fn MythSystem::setCommand(const QString &command) * \brief Resets an existing MythSystem object to a new command */ void MythSystem::SetCommand(const QString &command, uint flags) { if (flags & kMSRunShell) SetCommand(command, QStringList(), flags); else { QString abscommand; QStringList args; if (!d->ParseShell(command, abscommand, args)) { LOG(VB_GENERAL, LOG_ERR, QString("MythSystem(%1) command not understood") .arg(command)); m_status = GENERIC_EXIT_INVALID_CMDLINE; return; } SetCommand(abscommand, args, flags); } }
SelectionWindow::SelectionWindow(BMessenger& target, uint32 command) : BWindow(BScreen().Frame(), "Area Window", window_type(1026), B_ASYNCHRONOUS_CONTROLS|B_NOT_RESIZABLE|B_NOT_CLOSABLE|B_NOT_ZOOMABLE) { fView = new SelectionView(Bounds(), "Selection view"); AddChild(fView); SetTarget(target); SetCommand(command); }
GDBVarCommand::GDBVarCommand ( const JCharacter* origCmd ) : CMVarCommand() { JString cmd = "set print pretty off\nset print array off\n" "set print repeats 0\nset width 0\n"; cmd += origCmd; SetCommand(cmd); }
func InitializePlayer(iPlr) { // Basismuschel suchen var pBase = FindObject(TRTS, GetX(GetCrew(iPlr,0)), GetY(GetCrew(iPlr,0)), -1, -1); // Material erzeugen for (var i = 0; i < 5; ++i) pBase->CreateContents(CNKT); for (var i = 0; i < 3; ++i) pBase->CreateContents(LNKT); // Zusätzliche Clonks sollen gleich in der Muschel Schutz suchen for (var i = 0; i < GetCrewCount(); ++i) if (i > 0) SetCommand(GetCrew(iPlr,i), "Enter", pBase); }
void PresetExecSlow(void) { if ( gPresetCommand == kNone ) return; if ( gPresetCommand != kPresetCW && gPresetCommand != kPresetCCW && gPresetCommand != kPresetExec ) return; if ( abs(gCurrentHeading - gPresetHeading) < 5 ) return; // do nothing uint8_t cmd; // if ( abs(gCurrentHeading - gPresetHeading) < 5 ) // cmd = kNone; // else cmd = GetDirection( gCurrentHeading, gPresetHeading ); switch ( cmd ) { case kTurnCW: LED_PORT |= LED_RIGHT; SetCommand( kTurnCW ); break; case kTurnCCW: LED_PORT |= LED_LEFT; SetCommand( kTurnCCW ); break; case kStop: case kNone: default: SetCommand( kStop ); gPresetCommand = kPresetNone; // both PRESET LEDs off LED_PORT &= ~(LED_LEFT | LED_RIGHT); } }
ShortcutsSpec::ShortcutsSpec(const char* cmd) : BRow(), fCommand(NULL), fBitmap(ICON_BITMAP_RECT, ICON_BITMAP_SPACE), fLastBitmapName(NULL), fBitmapValid(false), fKey(0), fCursorPtsValid(false) { for (int i = 0; i < NUM_META_COLUMNS; i++) fMetaCellStateIndex[i] = 0; SetCommand(cmd); }
private func Activity() { var pBait; // Ein Köder in der Nähe? if (pBait=FindObject(0,-1000,-1250,2000,1500, OCF_InLiquid(), "Bait" ) ) // Schwarze Fische sind nicht wählerisch SetCommand(this(),"Follow",pBait); // Schwimmverhalten if (!GBackLiquid (0, -8)) return (SetComDir (COMD_Down ())); if (Random(2)) return(1); if (SEqual(GetAction(),"Walk")) WalkDir(); if (Not( SEqual(GetAction(),"Swim") )) return(1); if (Random(2)) return(TurnRight(),SetComDir(COMD_Right())); return(TurnLeft(),SetComDir(COMD_Left())); }
int FocalPoint::OnCommand(MM::PropertyBase* pProp, MM::ActionType eAct) { if (eAct == MM::BeforeGet) { pProp->Set(commandState_.c_str()); } else if (eAct == MM::AfterSet) { std::string command; pProp->Get(command); return SetCommand(command == g_Local ? g_Local : g_Remote); } return DEVICE_OK; }
//***************************************************************************************** void CBCGPUserTool::Serialize (CArchive& ar) { CObject::Serialize (ar); if (ar.IsLoading ()) { ar >> m_strLabel; CString strCmd; ar >> strCmd; SetCommand (strCmd); ar >> m_strArguments; ar >> m_strInitialDirectory; ar >> m_uiCmdId; }