本文整理汇总了C++中processCommand函数的典型用法代码示例。如果您正苦于以下问题:C++ processCommand函数的具体用法?C++ processCommand怎么用?C++ processCommand使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了processCommand函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ctsimtext_main
int
ctsimtext_main (int argc, char * argv[])
{
int iReturn = 0;
if (argc > 1 && (strcmp(s_szProgramName, fileBasename (argv[0])) == 0 || strcmp(s_szProgramName2, fileBasename (argv[0])) == 0 || strcmp(s_szProgramName3, fileBasename (argv[0])) == 0)) {
argv++;
argc--;
iReturn = processCommand (argc, argv);
} else if (argc >= 1 && ! (strcmp(s_szProgramName, fileBasename (argv[0])) == 0 || strcmp(s_szProgramName2, fileBasename (argv[0])) == 0 || strcmp(s_szProgramName3, fileBasename (argv[0])) == 0)) {
iReturn = processCommand (argc, argv);
} else {
s_bInteractive = true;
char szPrompt[] = "CTSim> ";
std::cout << "CTSim Text Shell";
#ifdef VERSION
std::cout << ", Version " << VERSION;
#endif
std::cout << " (Type \"quit\" to end)\n\n";
while (1) {
#ifdef HAVE_READLINE
char* pszInputLine = readline (szPrompt);
if (! pszInputLine)
break;
if (*pszInputLine != EOS)
add_history (pszInputLine);
#else // DONT_HAVE_READLINE
static const int s_MaxLineLength = 1024;
char* pszInputLine = new char [s_MaxLineLength+1];
std::cout << szPrompt;
std::cin.getline (pszInputLine, s_MaxLineLength);
#ifdef DEBUG
std::cout << "#" << pszInputLine << "#\n";
#endif
std::cout << std::flush;
std::cout << "\n";
#endif // DONT_HAVE_READLINE
if (strncasecmp (pszInputLine, "quit", 4) == 0)
break;
convertStringToArgcv (pszInputLine, &argc, &argv);
#ifdef DEBUG
for (int i = 0; i < argc; i++)
std::cout << "Token " << i << ": " << argv[i] << "\n";
#endif
iReturn = processCommand (argc, argv);
delete pszInputLine;
}
}
return iReturn;
}
示例2: main
void main (void)
{
DDRB = 0xff;
PORTB = 0;
initUart(9600, 0);
#ifdef DEBUG
printHelp(NULL);
#endif
// initialize the 16-bit timer
TCCR1A = _BV(COM1A1);
TCCR1B |= TIMER1_CLOCKSOURCE;
TIMSK = _BV (TOIE1);
memset(info, 0, sizeof(struct LED_INFO) * 8);
process = force = 0;
sei ();
while(1)
{
if(UCSRA & (1 << RXC))
processCommand();
}
}
示例3: main
int main(int argc, char** argv){
GraphDiscription modelJets, bunchGraph, graphTemplate;
ImageList *modelImages, *novelImages;
JetMasks masks;
Arguments args;
srand(time(NULL));
processCommand(argc, argv, &args);
/* build masks */
masks = readMasksFile(args.masksFile);
modelImages = getImageNames(args.modelFile, NULL);
novelImages = getImageNames(args.novelFile, NULL);
graphTemplate = readGraphDiscription(makePath(args.graphDir,modelImages->filename));
/* extract model jets */
modelJets = extractModelJets(modelImages, args.imageDir, args.graphDir, masks);
/* build jet bunch */
/* bunchGraph = buildBunchGraph(modelJets, args.distance, args.bunchSize); */
bunchGraph = modelJets;
/* locate features in novel image */
locateNovelFeatures(novelImages, graphTemplate, bunchGraph, masks, args.imageDir, args.outputDir, args.dispEst);
return 0;
}
示例4: while
bool MeetAndroid::receive(){
uint8_t lastByte;
boolean timeout = false;
while(!timeout)
{
while(Serial.available() > 0)
{
lastByte = Serial.read();
if(lastByte == abord){
flush();
}
else if(lastByte == ack){
processCommand();
flush();
}
else if(bufferCount < ByteBufferLenght){
buffer[bufferCount] = lastByte;
bufferCount++;
}
else return false;
}
if(Serial.available() <= 0 && !timeout){
if(waitTime > 0) delayMicroseconds(waitTime);
if(Serial.available() <= 0) timeout = true;
}
}
return timeout;
}
示例5: usart_gogo
/*usart code*/
void usart_gogo(){
if(checkUSARTflag_up()){
usart_data = receiveByte_up();
usart_data &= 0x3F; //Maska ut kommandot
processCommand(usart_data);
}
}
示例6: main
int main( void ) {
// initalise UART
uart_init( UART_BAUD_RATE );
statusLed_init( );
// flash status LED for a bit
statusLed_orange( );
delay_ms( 500 );
statusLed_green( );
// uart_getc should block until data received
uart_setBlocking( true );
while ( 1 ) {
// main loop of the programmer
if ( uart_hasData( ) ) {
unsigned char cmd = uart_getc( );
processCommand( cmd );
}
}
return 0;
}
示例7: while
std::string Transaction::processLine(const std::string& line) {
const char* delims = " \t";
bool last = false;
// TODO Handle quotes. Double and single per bash?
std::string::size_type pos = line.find_first_not_of(delims);
if (pos == std::string::npos) {
// Whitespace only.
return "";
}
vector<std::string> args;
while (!last) {
std::string::size_type nextPos = line.find_first_of(delims, pos);
if (nextPos == std::string::npos) {
nextPos = line.length();
last = true;
}
std::string part = line.substr(pos, nextPos - pos);
args.push_back(part);
if (!last) {
pos = line.find_first_not_of(delims, nextPos);
if (pos == std::string::npos) {
last = true;
}
}
}
return processCommand(args);
}
示例8: SCPI_Parse
/**
* Parse one command line
* @param context
* @param data - complete command line
* @param len - command line length
* @return 1 if the last evaluated command was found
*/
int SCPI_Parse(scpi_t * context, char * data, size_t len) {
int result = 0;
const char * cmdline_end = data + len;
char * cmdline_ptr = data;
size_t cmd_len;
size_t cmdline_len;
char * cmdline_ptr_prev = NULL;
size_t cmd_len_prev = 0;
if (context == NULL) {
return -1;
}
while (cmdline_ptr < cmdline_end) {
result = 0;
cmd_len = cmdTerminatorPos(cmdline_ptr, cmdline_end - cmdline_ptr);
if (cmd_len > 0) {
composeCompoundCommand(cmdline_ptr_prev, cmd_len_prev,
&cmdline_ptr, &cmd_len);
cmdline_len = cmdlineSeparatorPos(cmdline_ptr, cmdline_end - cmdline_ptr);
if(findCommand(context, cmdline_ptr, cmdline_len, cmd_len)) {
processCommand(context);
result = 1;
cmdline_ptr_prev = cmdline_ptr;
cmd_len_prev = cmd_len;
} else {
SCPI_ErrorPush(context, SCPI_ERROR_UNDEFINED_HEADER);
}
}
cmdline_ptr += skipCmdLine(cmdline_ptr, cmdline_end - cmdline_ptr);
cmdline_ptr += skipWhitespace(cmdline_ptr, cmdline_end - cmdline_ptr);
}
return result;
}
示例9: appendFileMotionStats
int appendFileMotionStats(char * filename,struct motionStats *st,struct InputParserC * ipc,unsigned int startAtFrame)
{
char line [512]={0};
fprintf(stderr,"Opening file %s\n",filename);
FILE * fp = fopen(filename,"r");
if (fp == 0 ) { fprintf(stderr,"Cannot open stream %s \n",filename); return 0; }
while (!feof(fp))
{
//We get a new line out of the file
int readOpResult = (fgets(line,512,fp)!=0);
if ( readOpResult != 0 )
{
//We tokenize it
unsigned int words_count = InputParser_SeperateWords(ipc,line,0);
if ( words_count > 0 )
{
processCommand(ipc,st,line,words_count,startAtFrame);
} // End of line containing tokens
} //End of getting a line while reading the file
}
fclose(fp);
return 1;
}
示例10: main
int main(int argc, char *argv[])
{
initialize();
getCommandLineArgs(argc, argv);
processCommand(stdin);
return 0;
}
示例11: QString
void Programmanalisator::ProgramEinladen(QTextDocument* dok)
{
LBL_lin.clear();
LBL_rep.clear();
LBL_call.clear();
int Nstr = dok->lineCount();
for (int i=0; i<(dok->lineCount()); i++ ) {
QString* Kadr= new QString(dok->findBlockByLineNumber(i).text());
int Res = processCommand(Kadr, i);
if (Res<0) {
QString str1=tr("Ошибка: Строка: ")+QString::number(i); // ошибка - выдадим сообщение
errorMessage(str1);
} else if (Res>0) {
i=LBL_lin[I1];
qDebug()<<"linie"<<I1;
}
int progress=(int)(((i+1)*100)/Nstr);
qDebug()<<progress<<"%";
emit Progress(progress);
delete Kadr;
}
emit fertig();
}
示例12: portTASK_FUNCTION
/*******************************************************************************
* TzCtrl
*
* Task for receiving commands from Tracealyzer and for recorder diagnostics.
*
******************************************************************************/
static portTASK_FUNCTION( TzCtrl, pvParameters )
{
TracealyzerCommandType msg;
int bytes = 0;
while (1)
{
bytes = 0;
TRC_STREAM_PORT_READ_DATA(&msg, sizeof(TracealyzerCommandType), &bytes);
if (bytes != 0)
{
if (bytes == sizeof(TracealyzerCommandType))
{
if (isValidCommand(&msg))
{
processCommand(&msg); /* Start or Stop currently... */
}
}
}
do
{
bytes = 0;
TRC_STREAM_PORT_PERIODIC_SEND_DATA(&bytes);
}
while (bytes != 0);
CheckRecorderStatus();
vTaskDelay(TRC_CTRL_TASK_DELAY); /* 10ms */
}
}
示例13: checkReceive
void checkReceive(char letter) {
// Starts new received word when start character arrives
if (letter == START) {
rcvData.currentIndex = 0;
rcvData.message[rcvData.currentIndex] = letter;
rcvData.currentIndex++;
return;
}
// More than 8 bytes without an end byte
if (rcvData.currentIndex > 7) {
rcvData.currentIndex = 0;
return;
}
// Stores current letter in word
rcvData.message[rcvData.currentIndex] = letter;
// Indicates word has been properly assembled
if (letter == END && rcvData.currentIndex == 7) {
rcvData.currentIndex = 0;
// Sends message out
processCommand();
}
rcvData.currentIndex++;
}
示例14: memset
bool StreamBase::checkCommandQueue() {
if ( sd >= 0 ) {
CmdMsg msg;
memset(&msg, 0, sizeof(msg));
int nbytes = recvfrom(sd, &msg, sizeof(msg), MSG_DONTWAIT, 0, 0);
if ( nbytes < 0 ) {
if ( errno != EAGAIN ) {
Error("recvfrom(), errno = %d, error = %s", errno, strerror(errno));
return false;
}
}
//else if ( (nbytes != sizeof(msg)) )
//{
//Error( "Partial message received, expected %d bytes, got %d", sizeof(msg), nbytes );
//}
else {
Debug(2, "Message length is (%d)", nbytes);
processCommand(&msg);
return true;
}
} else {
Warning("No sd in checkCommandQueue, comms not open?");
}
return false;
}
示例15: SCPI_Parse
/**
* Parse one command line
* @param context
* @param data - complete command line
* @param len - command line length
* @return 1 if the last evaluated command was found
*/
int SCPI_Parse(scpi_t * context, const char * data, size_t len) {
int result = 0;
const char * cmdline_end = data + len;
const char * cmdline_ptr = data;
size_t cmd_len;
size_t cmdline_len;
if (context == NULL) {
return -1;
}
while (cmdline_ptr < cmdline_end) {
result = 0;
cmd_len = cmdTerminatorPos(cmdline_ptr, cmdline_end - cmdline_ptr);
cmdline_len = cmdlineSeparatorPos(cmdline_ptr, cmdline_end - cmdline_ptr);
if (cmd_len > 0) {
if(findCommand(context, cmdline_ptr, cmdline_len, cmd_len)) {
processCommand(context);
result = 1;
} else {
SCPI_ErrorPush(context, SCPI_ERROR_UNDEFINED_HEADER);
}
}
cmdline_ptr = cmdlineNext(cmdline_ptr, cmdline_end - cmdline_ptr);
}
return result;
}