示例#1
0
// Main Debugger Loop
void Debugger::enter() {
	// TODO: Having three I/O methods #ifdef-ed in this file is not the
	// cleanest approach to this...

#ifndef USE_TEXT_CONSOLE
	if (_firstTime) {
		DebugPrintf("Debugger started, type 'exit' to return to the game.\n");
		DebugPrintf("Type 'help' to see a little list of commands and variables.\n");
		_firstTime = false;
	}

	if (_errStr) {
		DebugPrintf("ERROR: %s\n\n", _errStr);
		free(_errStr);
		_errStr = NULL;
	}

	_debuggerDialog->runModal();
#else
	printf("Debugger entered, please switch to this console for input.\n");

#ifdef USE_READLINE
	// TODO: add support for saving/loading history?

	g_readline_debugger = this;
	rl_completion_entry_function = &readline_completionFunction;

	char *line_read = 0;
	do {
		free(line_read);
		line_read = readline("debug> ");

		if (line_read && line_read[0])
			add_history(line_read);

	} while (line_read && parseCommand(line_read));

	free(line_read);
	line_read = 0;

#else
	int i;
	char buf[256];

	do {
		printf("debug> ");
		if (!fgets(buf, sizeof(buf), stdin))
			return;

		i = strlen(buf);
		while (i > 0 && buf[i - 1] == '\n')
			buf[--i] = 0;

		if (i == 0)
			continue;
	} while (parseCommand(buf));
#endif

#endif
}
示例#2
0
//Pipe function to allow piping between two programs.
void pipe(const std::string command, std::chrono::duration<double>& totalTime){
	char** argv1;
	char** argv2;

	//Getting two char** argv's from the one already made, 
	//splitting it by the '|' character/argument in argv.
	std::string command1 = "";
	std::string command2 = "";
	std::stringstream ss;
	ss.str(command);
	getline(ss, command1, '|');
	getline(ss, command2);
	parseCommand(command1, argv1);
	parseCommand(command2, argv2);
	
	//Constants setup
	const int PIPE_COUNT = 2;
	const int PIPE_READ_END = 0;
	const int PIPE_WRITE_END = 1;
	const int STDIN = 0;
	const int STDOUT = 1;
	
	//Pipe creation
	int pids[PIPE_COUNT];
	pipe(pids);
	
	//Duplicate stdout and stdin to use to connect the 
	//ends back together later
	int savedStdout = dup(STDOUT);
	int savedStdin = dup(STDIN);
	
	//First process: put the pipe's write end in place of stdout.
	pid_t pid1 = fork();
	if (pid1 == 0){
		dup2(pids[PIPE_WRITE_END], STDOUT);
		runAndTimeChildProcess(argv1[0], argv1, totalTime);
		exit(111);
	}
	//Second process: put the pipe's read end in place of stdin, 
	//and close the pipe's write end to tell 2nd process no more 
	//data is coming for it to read.
	pid_t pid2 = fork();
	if (pid2 == 0){
		dup2(pids[PIPE_READ_END], STDIN);
		close(pids[PIPE_WRITE_END]);
		runAndTimeChildProcess(argv2[0], argv2, totalTime);
		exit(111);
	}
	int status;
	waitpid(pid1, &status, 0);
	close(pids[PIPE_WRITE_END]);
	close(pids[PIPE_READ_END]);
	waitpid(pid2, &status, 0);
	
	dup2(savedStdout, STDOUT);
	dup2(savedStdin, STDIN);

}
示例#3
0
文件: udpser.cpp 项目: rlyspn/U_FTP
int main(int argc, char*argv[]){

    string test = "PUT:fileName:DATA";
    int t = parseCommand(test);
    string data = listen(PORT);
    int command = parseCommand(data);
    if(command == PUT){
        string fileName = getFileName(data);
        string dataToWrite = getData(data);
        writeFile(fileName, dataToWrite);
    }
    return 0;
}
示例#4
0
int connectionReceiveCommand(connection *con) {
	int socketFD = con->tArgs->socketFD;
	command *cmd = con->cmd;
	error *err = con->err;

	// if (cmd->args != NULL) {
	// 	free(cmd->args);
	// 	cmd->args = NULL;
	// }
	destroyCommandArgs(cmd);

	printf("\n>====== Waiting to receive command from client...\n");

	char buf[BUFSIZE];
	memset(buf, 0, BUFSIZE);

	int term;
	if (messageReceive(socketFD, buf, &(con->dataBytes), &(con->data), &term)) {
		if (term) {
			ERROR(err, E_EXIT);
		} else {
			ERROR(err, E_MSG);
		}

		return 1;
	}

	return parseCommand(buf, cmd, err);
}
示例#5
0
void ClientThread::run()
{
    QTcpSocket tcpSocket;
    if (!tcpSocket.setSocketDescriptor(m_socketDescriptor)) {
        qWarning() << ":(((";
        emit error(tcpSocket.error());
        return;
    }

    m_running = true;

    QString command, response;

    // Send greetings
    tcpSocket.write("OK MPD 0.12.2\n");

    while (m_running && (tcpSocket.state() == QAbstractSocket::ConnectedState)) {
        m_running = tcpSocket.waitForReadyRead();   // Wait for command, 
                                                    // if none is received until timeout
                                                    // (default 30 seconds, stop running).

        command = QString(tcpSocket.readLine()).trimmed();
       
        qDebug() << command;

        tcpSocket.write(parseCommand(command).toLocal8Bit());
    }

    tcpSocket.disconnectFromHost();
}
示例#6
0
void browsers::CellBrowser::OnWXOpenCell(wxCommandEvent& event)
{
   _activeStructure = top_structure = RBcellID;
   wxString cmd; 
   cmd << wxT("opencell(\"") << GetItemText(RBcellID) <<wxT("\");");
   parseCommand(cmd);
}
示例#7
0
CMD *parseCommand(token **lstHead)
{
	CMD *cmd = parseAndOr(lstHead);
	if(cmd->type == ERROR)
	{
		//propagate an error
		return cmd;
	}

	//check to make sure that end of linked list not reached
	if(cmd && *lstHead && ((*lstHead)->type == SEP_END || 
							(*lstHead)->type == SEP_BG))
	{
		CMD *andorCMD = cmd;
		cmd = mallocCMD();
		cmd->type = (*lstHead)->type;
		cmd->left = andorCMD;
		*lstHead = (*lstHead)->next;
		if(*lstHead)
		{
			cmd->right = parseCommand(lstHead);
			if(cmd->right->type == ERROR)
			{
				//propagate along an error
				return cmd->right;
			}
		}
	}
	return cmd;
}
示例#8
0
static void handleCommand(char *command) {
	commandinfo *cinfo = parseCommand(command, MSG_OUTGOING);

	switch (cinfo->command) {
		case C_QUIT:
			cleanup(0);
			break;

		case C_SYNACK:
			sendMessage(sock, "ACK");
			break;

		case C_GET:
			if (cinfo->param == P_POSTS) {
				sendMessage(sock, command);
			} else if (cinfo->param == P_POST) {
				sendMessage(sock, command);
			}
			break;

		default:
			sendMessage(sock, command);
			break;
	}

	freeCommandInfo(cinfo);
}
//Ingresa un string que puede ser tanto un comando, una variable o un literal
//por lo que se procesa y devuelve resuelto, si corresponde, en formato de lista
std::vector<std::string> InterpreteLISP::procesarComandoLISP(
		const std::string &input) const {
	std::vector<std::string> comando;
	std::string palabra;
	if (input.empty()) return comando;
	if (input.at(0) =='(') {
		//el string ingresado es comando LISP
		comando = parseCommand(input);

		std::string nombreFuncion;
		nombreFuncion = comando.front();
		comando.erase(comando.begin());
		FuncionLISP* funcion = (*funcionesAmbiente)[nombreFuncion];
		comando = funcion->resolver(comando, *this);
	} else {
		//el string ingresado es un simbolo
		if ((*variablesAmbiente)[input] != NULL) {
			//el simbolo es una variable definida anteriormente
			return *((*variablesAmbiente)[input])->getVariable();
		} else {
			//el simbolo ingresado es un literal
			comando.push_back(input);
		}
	}
	return comando;
}
示例#10
0
文件: netdev.c 项目: Fat-Zer/tdebase
void printNetDevSentBytes(const char *cmd)
{
	int i;
	char **retval;
	
	retval = parseCommand(cmd);
	
	if (retval == NULL)
		return;

	for (i = 0; i < NetDevCnt; i++) {
		if (!strcmp(NetDevs[i].name, retval[0])) {
			if (!strncmp(retval[1], "data", 4))
				fprintf(CurrentClient, "%lu", (u_long)((NetDevs[i].sentBytes - NetDevsOld[i].sentBytes) / (1024 * elapsed)));
			if (!strncmp(retval[1], "packets", 7))
				fprintf(CurrentClient, "%lu", (u_long)((NetDevs[i].sentPacks - NetDevsOld[i].sentPacks) / elapsed));
			if (!strncmp(retval[1], "errors", 6))
				fprintf(CurrentClient, "%lu", (u_long)((NetDevs[i].sentErrs - NetDevsOld[i].sentErrs) / elapsed));
			if (!strncmp(retval[1], "multicast", 9))
				fprintf(CurrentClient, "%lu", (u_long)((NetDevs[i].sentMulticast - NetDevsOld[i].sentMulticast) / elapsed));
			if (!strncmp(retval[1], "collisions", 10))
				fprintf(CurrentClient, "%lu", (u_long)((NetDevs[i].sentColls - NetDevsOld[i].sentColls) / elapsed));
		}
	}
	free(retval[0]);
	free(retval[1]);
	free(retval);

	fprintf(CurrentClient, "\n");
}
示例#11
0
文件: Client.cpp 项目: jrasm91/cs360
void Client::listen() {
	string line;
	string response = "";
	string request = "";

	cout << "% ";

	// loop to handle user interface
	while (getline(cin,line)) {
		request = parseCommand(line);
		if(request.size() == 0){
			cout << "% ";
			continue;
		}
		bool success = sendRequest(request);
		// break if an error occurred
		if (not success)
			break;
		// get a response
		success = getResponse();
		// break if an error occurred
		if (not success)
			break;
		cout << "% ";

	}
	close(server_);
}
示例#12
0
void parseByte (int newByte)  // parse an incoming commandbyte from serial interface, perform command if valid
{
   static uint8_t cmdlen=0;
  
   if (CimParserActive)
          parse_CIM_protocol(newByte);   // handle AsTeRICS CIM protocol messages !
   else
   {
      switch (readstate) {
        case 0: 
                if ((newByte=='A') || (newByte=='a')) readstate++;
                if (newByte=='@') { readstate++; CimParserActive=1; }  // switch to AsTeRICS CIM protocol parser
             break;
        case 1: 
                if ((newByte=='T') || (newByte=='t')) readstate++; else readstate=0;
            break;
        case 2: 
                if ((newByte=='\r') || (newByte=='\n'))  // AT reply: "OK" 
                {  Serial.println("OK");  readstate=0; }
                else if (newByte==' ') { cmdlen=0; readstate++; } 
                else goto err;
            break;
        case 3: 
                if ((newByte=='\r') || (newByte=='\n') || (cmdlen>=MAX_CMDLEN-1))
                {  tmpstring[cmdlen]=0;  parseCommand(tmpstring); 
                  readstate=0; }
                else tmpstring[cmdlen++]=newByte;
            break;   
        default: err: Serial.println("?");readstate=0;
      }
   }
}
// Checked: 2009-12-27 (RLVa-1.1.0k) | Modified: RLVa-1.1.0k
RlvCommand::RlvCommand(const LLUUID& idObj, const std::string& strCommand)
	: m_idObj(idObj), m_eBehaviour(RLV_BHVR_UNKNOWN), m_fStrict(false), m_eParamType(RLV_TYPE_UNKNOWN)
{
	if ((m_fValid = parseCommand(strCommand, m_strBehaviour, m_strOption, m_strParam)))
	{
		S32 nTemp = 0;
		if ( ("n" == m_strParam) || ("add" == m_strParam) )
			m_eParamType = RLV_TYPE_ADD;
		else if ( ("y" == m_strParam) || ("rem" == m_strParam) )
			m_eParamType = RLV_TYPE_REMOVE;
		else if (m_strBehaviour == "clear")						// clear is the odd one out so just make it its own type
			m_eParamType = RLV_TYPE_CLEAR;
		else if ("force" == m_strParam)
			m_eParamType = RLV_TYPE_FORCE;
		else if (LLStringUtil::convertToS32(m_strParam, nTemp))	// Assume it's a reply command if we can convert <param> to an S32
			m_eParamType = RLV_TYPE_REPLY;
		else
		{
			m_eParamType = RLV_TYPE_UNKNOWN;
			m_fValid = false;
		}
	}

	if (!m_fValid)
	{
		m_strBehaviour = m_strOption = m_strParam = "";
		return;
	}

	// HACK: all those @addoutfit* synonyms are rather tedious (and error-prone) to deal with so replace them their @attach* equivalent
	if ( (RLV_TYPE_FORCE == m_eParamType) && (0 == m_strBehaviour.find("addoutfit")) )
		m_strBehaviour.replace(0, 9, "attach");
	m_eBehaviour = getBehaviourFromString(m_strBehaviour, &m_fStrict);
}
示例#14
0
void Client::readClient() {
    //qDebug()<<"Client::readClient";
    QTcpSocket* socket = (QTcpSocket*)sender();
    QByteArray buffer=socket->readLine();
    QString response=parseCommand(QString(buffer));
    socket->write(response.toLatin1());
}
示例#15
0
int Programmanalisator::processCommand(QString* Kadr, int LNum)
{
    int Typ=parseCommand(Kadr, LNum); // анализируем кадр

    if (Typ<0) {

        return -1;
    }

    switch (Typ) { // выдача сигнала по результатам команды
    case BULK_FORM1 : break;
    case BULK_FORM2 : emit Kommand(BULK_FORM2, Q1, Q2, Q3, Q4, Q5, Q6, 0);
                      break;
    case FRES_X     : emit Kommand(FRES_X,Q1,0,0,0,0,0,0);
                      break;
    case FRES_Y     : emit Kommand(FRES_Y,Q1,0,0,0,0,0,0);
                      break;
    case FRES_Z     : emit Kommand(FRES_Z,Q1,0,0,0,0,0,0);
                      break;
    case FRES_IX    : emit Kommand(FRES_IX,Q1,0,0,0,0,0,0);
                      break;
    case FRES_IY    : emit Kommand(FRES_IY,Q1,0,0,0,0,0,0);
                      break;
    case FRES_IZ    : emit Kommand(FRES_IZ,Q1,0,0,0,0,0,0);
                      break;
    case TOOL_CALL  : emit Kommand(TOOL_CALL,0,0,0,0,0,0,I1);
                      break;
    case LBL_CALL   : return I1;
                      break;
    default : break;

    }
    return 0;
}
void prvCommsTask(void *pvParameters)
{
    pvParameters = pvParameters;

    static uint8_t line[80];
    static uint8_t characterPosition = 0;

    initGlobals();

/* Timer to cause outgoing communications to cease if nothing received for 10
seconds */
    lapseCommsTimer = xTimerCreate("Lapse Comms",10000,pdFALSE,0,lapseCommsCallback);

    while(1)
    {
/* Build a command line string before actioning. The task will block
indefinitely waiting for input. */
        char character;
        xQueueReceive(commsReceiveQueue,&character,portMAX_DELAY);
        if ((character == 0x0D) || (character == 0x0A) || (characterPosition > 78))
        {
            if (lapseCommsTimer != NULL) xTimerReset(lapseCommsTimer,0);
            line[characterPosition] = 0;
            characterPosition = 0;
            parseCommand(line);
        }
        else line[characterPosition++] = character;
    }
}
示例#17
0
void parseByte (int newByte)  // parse an incoming commandbyte from serial interface, perform command if valid
{
  static uint8_t state=0;
  static uint8_t cmdlen=0;
 
  switch (state) {
    case 0: 
            if ((newByte=='A') || (newByte=='a')) state++;
         break;
    case 1: 
            if ((newByte=='T') || (newByte=='t')) state++; else state=0;
        break;
    case 2: 
            if ((newByte==13) || (newByte==10))
            {  Serial.println("OK");  state=0; }
            else if (newByte==' ') { cmdlen=0; state++; } 
            else goto err;
        break;
    case 3: 
            if ((newByte==13) || (newByte==10) || (cmdlen>=MAX_CMDLEN-1))
            {  cmdstring[cmdlen]=0;  parseCommand(cmdstring); 
              state=0; }
            else cmdstring[cmdlen++]=newByte;
        break;   
    default: err: Serial.println("?");state=0;
  }
}
示例#18
0
void ArgumentParser::parse(const QStringList& args)
{
    ArgumentScanner scanner;
    scanner.scan(args);
    const auto tokens = scanner.tokens();

    int i = 0;
    do
    {
        if (int tokensConsumed = parseCommand(tokens, i))
        {
            i += tokensConsumed;
            continue;
        }

        if (int tokensConsumed = parseLongOption(tokens, i))
        {
            i += tokensConsumed;
            continue;
        }

        if (int tokensConsumed = parseShortOption(tokens, i))
        {
            i += tokensConsumed;
            continue;
        }

        i += parseOther(tokens, i);
    } while (i < tokens.size());
}
示例#19
0
文件: parser.cpp 项目: dunk8888/Cube4
byte parser(
  char       *message,
  byte        length,
  bytecode_t *bytecode) {

  byte errorCode = 0;
  byte position = 0;

  skipWhitespace(message, length, & position);

  command_t *command;

  errorCode = parseCommand(message, length, & position, & command);

  if (errorCode == 0) {
    skipWhitespace(message, length, & position);

    errorCode =
      (command->parser)(message, length, & position, command, bytecode);

    if (errorCode == 0) {
      skipWhitespace(message, length, & position);
    }
  }

  return(errorCode);
}
示例#20
0
void SpellManager::invokeSpell(const TextCommand *const spell,
                               const Being *const target)
{
    if (!chatWindow || !spell || !target)
        return;
    chatWindow->localChatInput(parseCommand(spell->getCommand(), target));
}
示例#21
0
文件: vim.c 项目: Cognoscan/ctags
static boolean parseVimLine (const unsigned char *line)
{
	boolean readNextLine = TRUE;

	if ( (!strncmp ((const char*) line, "comp", (size_t) 4) == 0) && 
			(!strncmp ((const char*) line, "comc", (size_t) 4) == 0) && 
			(strncmp ((const char*) line, "com", (size_t) 3) == 0) )
	{
		readNextLine = parseCommand(line);
		/* TODO - Handle parseCommand returning FALSE */
	}

	if (isMap(line))
	{
		parseMap(line);
	}

	if (strncmp ((const char*) line, "fu", (size_t) 2) == 0)
	{
		parseFunction(line);
	}

	if	(strncmp ((const char*) line, "aug", (size_t) 3) == 0)
	{
		parseAutogroup(line);
	}

	if ( strncmp ((const char*) line, "let", (size_t) 3) == 0 )
	{
		parseLet(line);
	}

	return readNextLine;
}
示例#22
0
void SpellManager::invokeCommand(const std::string &command,
                                 const Being *const target)
{
    if (!chatWindow)
        return;
    chatWindow->localChatInput(parseCommand(command, target));
}
示例#23
0
文件: main.cpp 项目: app/ananas-labs
int main(int argc, char** argv)
{
	aLog::init("c:\\file.log",aLog::MT_DEBUG);
	printf("dwd1\n");
	if(argc <=1) 
	{
		showError("", invalid_usage);
		return 1;
	}
	printf("dwd\n");
	QStringList args;
	fillArgsFromArgv(&args, argv, argc);
	QString command = parseCommand(&args);
	if(!isValidCommand(command))
	{
		showError(command, invalid_command);
		return 1;
	}
	QString argument = parseArgument(&args);
	if(!isValidArgument(argument))
	{
		showError(argument, invalid_argument);
		return 2;
	}
	QStringList options;
	parseOptions(&args, &options);
	removeInvalidOptions(&options);
	int res = doAction(command, argument, &options);
	aLog::close();
	return res;
} 
示例#24
0
文件: vim.c 项目: Monits/ctags
static boolean parseVimLine (const unsigned char *line, int infunction)
{
	boolean readNextLine = TRUE;

	if (wordMatchLen (line, "command", 3))
	{
		readNextLine = parseCommand(line);
		/* TODO - Handle parseCommand returning FALSE */
	}

	else if (isMap(line))
	{
		parseMap(skipWord(line));
	}

	else if (wordMatchLen (line, "function", 2))
	{
		parseFunction(skipWord(line));
	}

	else if	(wordMatchLen (line, "augroup", 3))
	{
		parseAutogroup(skipWord(line));
	}

	else if (wordMatchLen (line, "let", 3))
	{
		parseLet(skipWord(line), infunction);
	}

	return readNextLine;
}
示例#25
0
文件: asm.c 项目: KrowosDogg/iLab
tCommandWithOperands parseCommandText(tLine command_text, tDatabase label_values)
{
    char cmd_name[MAX_COMMAND_LENGTH];
    sscanf(command_text.str, "%s", cmd_name);
    tCommand cmd = parseCommand(cmd_name);
    tCommandWithOperands command_with_operands = {cmd, {0, 0}, {0, 0}};
    int operands_number = getOperandsNumberForCommandType(cmd.type);
    if (operands_number == 0)
        return command_with_operands;
    else if (operands_number == 1)
    {
        char operand_name[MAX_OPERAND_LEXEM_LENGTH];
        sscanf(command_text.str, "%s %s", cmd_name, operand_name);
        tOperand op = parseLabelOperand(operand_name, label_values);
        command_with_operands.left = op;
    }
    else if (operands_number == 2)
    {
        char operand1_name[MAX_OPERAND_LEXEM_LENGTH], operand2_name[MAX_OPERAND_LEXEM_LENGTH];
        *strchr(command_text.str, ',') = ' '; //FIXME: HARDCORE in source code...
        sscanf(command_text.str, "%s %s %s", cmd_name, operand1_name, operand2_name);
        tOperand op1 = parseLabelOperand(operand1_name, label_values);
        command_with_operands.left = op1;
        tOperand op2 = parseLabelOperand(operand2_name, label_values);
        command_with_operands.right = op2;
    }
    else //exception
    {
        printf("Wrong number of operands!!!\n");
        exit(-1);
    }
    return command_with_operands;
}
示例#26
0
文件: shell.c 项目: nehaljwani/shell
/**
 * printInfo:
 * @pid: process id of the process whose information is to be printed
 *
 * The function prints the information available fot a certain process. The
 * information includes name, pid, status, virtual memory size, and executable
 * path (only for the shell)
 */
void
printInfo(int pid) {
    char statFile[DIRECTORY_LEN_MAX];
    char statInfo[INFO_LEN_MAX];
    char **info = NULL;
    sprintf(statFile, "/proc/%d/stat", pid != -1 ? pid: getpid());
    FILE *fp = fopen(statFile, "r");
    if (!fp) {
        perror("fopen() error");
        return;
    }
    fgets(statInfo, INFO_LEN_MAX, fp);
    info = parseCommand(statInfo, " ");
    printf("Process ID\t--\t%s\n"
           "Process Name\t--\t%s\n"
           "Process Status\t--\t%s\n"
           "Virtual Memory Size\t--\t%s\n",
           info[0],
           info[1],
           info[2],
           info[22]);
   if (pid == -1)
       printf("Executable Path\t--\t%s\n", EXECPATH);
   stringListFree(info);
}
示例#27
0
void browsers::layerbrowser::OnActiveLayerM(wxCommandEvent&)
{
   word layno = getFirstSelected();
   wxString cmd;
   cmd << wxT("usinglayer(") << layno << wxT(");");
   parseCommand(cmd);
}
示例#28
0
int main(void)
{
	clock_setup();
	gpio_setup();
	usart_setup();
	spi_setup();
	buffer_init(send_buffer,BUFFER_SIZE);
	buffer_init(receive_buffer,BUFFER_SIZE);
	usart_enable_tx_interrupt(USART1);

/* Send a greeting message on USART1. */
	usart_print_string("SD Card SPI Mode Test\r\n");

	while (1)
	{
/* Command interface */
        if (buffer_input_available(receive_buffer))
        {
            char character = buffer_get(receive_buffer);
            if (character == 0x0D)
            {
                line[characterPosition] = 0;
                characterPosition = 0;
                parseCommand(line);
            }
            else line[characterPosition++] = character;
        }
	}

	return 0;
}
示例#29
0
void Player_AD::musicSeekTo(const uint position) {
	// This method is actually dangerous to use and should only be used for
	// loading save games because it does not set up anything like the engine
	// music timer or similar.
	_isSeeking = true;

	// Seek until the given position.
	while (_curOffset != position) {
		if (parseCommand()) {
			// We encountered an EOT command. This should not happen unless
			// we try to seek to an illegal position. In this case just abort
			// seeking.
			::debugC(3, DEBUG_SOUND, "AD illegal seek to %u", position);
			break;
		}
		parseVLQ();
	}

	_isSeeking = false;

	// Turn on all notes.
	for (int i = 0; i < ARRAYSIZE(_voiceChannels); ++i) {
		if (_voiceChannels[i].lastEvent != 0) {
			const int reg = 0xB0 + i;
			writeReg(reg, readReg(reg));
		}
	}
}
示例#30
0
void ConnectionParser::dataReceived() {
    while (mSocket->canReadLine()) {
        QString line = mSocket->readLine();
        QStringList parsedArray = splitRawLine(line, true);
        QString coreCommand = parsedArray.at(0);

        qDebug() << parsedArray;
        if (coreCommand == "PING") {
            mInternalSender->sendPong(parsedArray.at(1));
        } else if (coreCommand == "ERROR") {
            return;
        } else {
            QString command = parsedArray.at(1);

            bool numeric;
            int code = command.toInt(&numeric);
            if (numeric) {
                if (parseCode(parsedArray, code)) {
                    QObject::disconnect(mSocket, &QTcpSocket::readyRead,
                                        this, &ConnectionParser::dataReceived);
                    return;
                }
            } else {
                parseCommand(parsedArray, command);
            }
        }
    }
}