static MidiEvPtr rcv1Byte (UDPStreamPtr f, Byte c) { Data(f->ptrCur)[f->index++] = c; if (f->next) { f->parse = f->next; f->next = 0; } else return parseComplete (f); return 0; }
static MidiEvPtr rcvLongLL (UDPStreamPtr f, Byte c) { long * lptr = (long *)f->data; f->length--; put(f->data, 3, 0, c); *f->longDst = *lptr; if (f->next) f->parse = f->next; else return parseComplete (f); return 0; }
static MidiEvPtr rcvShortLow (UDPStreamPtr f, Byte c) { short * sptr = (short *)f->data; f->length--; put(f->data, 1, 0, c); *f->shortDst = *sptr; if (f->next) f->parse = f->next; else return parseComplete (f); return 0; }
//_____________________________________________________________________________ static MidiEvPtr rcvChan (UDPStreamPtr f, Byte c) { // UDPParseMethodPtr next = f->rcv[EvType(f->ptrCur)]; // MidiEvPtr e = 0; f->length--; Chan(f->ptrCur) = c; if (!f->length) return parseComplete (f); f->parse = f->rcv[EvType(f->ptrCur)]; f->next = 0; return 0; }
void Compiler_Test::errors() { Compiler compiler; compiler.registerRule(new ParseNode("ARule", "'A'")); compiler.registerRule(new ParseNode("BRule", "'B'")); compiler.registerRule(new ParseNode("CRule", "'C'")); compiler.registerRule(new ParseNode("XRule", "'X'")); compiler.registerRule(new ParseNode("Test", " ( ARule ! CRule ) | ( BRule ! CRule ) $")); //parseComplete(&compiler, "Test", "AC"); try { parseComplete(&compiler, "Test", "AX"); } catch (RException ex) { System::out->println("Expected Ex: " + ex->getMessage()); } }
void AMPIC887ConsoleCommandParser::interpretCommandImplementation(const QString &command) { if(command == "quit") { emit quit(); } else if (command == "help") { emit help(); } else if( command == "status") { emit status(); } else if(command.startsWith("init")) { emit initializeControllerCommandIssued(); } else if(command.startsWith("activate")) { QStringList commandParts = command.split(" "); if(commandParts.count() == 1) { emit unknownCommand(QString("Cannot active a controller with no name specified.")); } else if(commandParts.count() > 2) { emit unknownCommand(QString("Cannot active more than one controller at a time.")); } else { emit activeControllerChangeRequested(commandParts.at(1)); } } else if (command.startsWith("STP")) { emit stopCommandIssued(); } else if(command.startsWith("HLT")) { emit haltCommandIssued(axesFromCommandString(command)); } else if(command.startsWith("HPA?")) { emit availableParametersCommandIssued(); } else if(command.startsWith("MST?")) { emit motionStatusCommandIssued(); } else if (command.startsWith("CCL?")) { emit commandLevelCommandIssued(); } else if (command.startsWith("POS?")) { emit currentPositionCommandIssued(axesFromCommandString(command)); } else if (command.startsWith("SCT?")) { emit cycleTimeCommandIssued(); } else if (command.startsWith("IDN?")) { emit deviceIdentificationCommandIssued(); } else if (command.startsWith("NLM?")) { emit lowSoftLimitCommandIssued(axesFromCommandString(command)); } else if (command.startsWith("PLM?")) { emit highSoftLimitCommandIssued(axesFromCommandString(command)); } else if (command.startsWith("LIM?")) { emit limitSwitchStatusCommandIssued(axesFromCommandString(command)); } else if (command.startsWith("TMN?")) { emit minPositionCommandIssued(axesFromCommandString(command)); } else if (command.startsWith("TMX?")) { emit maxPositionCommandIssued(axesFromCommandString(command)); } else if (command.startsWith("ONT?")) { emit onTargetCommandIssued(axesFromCommandString(command)); } else if (command.startsWith("SPI?")) { emit pivotPointCommandIssued(axesFromCommandString(command, AMPIC887AxisCollection::LinearAxes)); } else if (command.startsWith("MOV?")) { emit targetPositionCommandIssued(axesFromCommandString(command)); } else if (command.startsWith("PUN?")) { emit positionUnitsCommandIssued(axesFromCommandString(command)); } else if (command.startsWith("HDR?")) { emit availableRecorderOptionsCommandIssued(); } else if (command.startsWith("DRT?")) { emit recordTriggerCommandIssued(); } else if (command.startsWith("DRR?")) { handleDataRecordValuesInput(command); } else if (command.startsWith("DRC?")) { handleRecordConfigInput(command); } else if (command.startsWith("FRF?")) { emit referencedStateCommandIssued(axesFromCommandString(command)); } else if (command.startsWith("RTR?")) { emit recordRateCommandIssued(); } else if (command.startsWith("SVO?")) { emit servoModeCommandIssued(); } else if(command.startsWith("SSL?")) { emit softLimitStatusCommandIssued(axesFromCommandString(command)); } else if (command.startsWith("SST?")) { emit stepSizeCommandIssued(axesFromCommandString(command)); } else if (command.startsWith("VLS?")) { emit systemVelocityCommandIssued(); } else if(command.startsWith("MOV")) { bool parseSuccess = false; AMPIC887AxisMap<double> parsedArguments = axisMapFromCommandString(command, &parseSuccess); if(parseSuccess) { emit moveCommandIssued(parsedArguments); } } else if(command.startsWith("FRF")) { emit referenceMoveCommandIssued(axesFromCommandString(command)); } else if(command.startsWith("MVR")) { bool parseSuccess = false; AMPIC887AxisMap<double> parsedArguments = axisMapFromCommandString(command, &parseSuccess); if(parseSuccess) { emit moveRelativeCommandIssued(parsedArguments); } } else if(command.startsWith("CCL")) { handleSetCommandLevelInput(command); } else if (command.startsWith("SCT")) { bool parseSuccess = false; double parsedArgument = doubleValueFromCommandString(command, &parseSuccess); if(parseSuccess) { emit setCycleTimeCommandIssued(parsedArgument); } } else if (command.startsWith("PLM")) { bool parseSuccess = false; AMPIC887AxisMap<double> parsedArguments = axisMapFromCommandString(command, &parseSuccess); if(parseSuccess) { emit setHighSoftLimitsCommandIssued(parsedArguments); } } else if (command.startsWith("NLM")) { bool parseSuccess = false; AMPIC887AxisMap<double> parsedArguments = axisMapFromCommandString(command, &parseSuccess); if(parseSuccess) { emit setLowSoftLimitsCommandIssued(parsedArguments); } } else if (command.startsWith("SPI")) { bool parseSuccess = false; AMPIC887AxisMap<double> parsedArguments = axisMapFromCommandString(command, &parseSuccess); if(parseSuccess) { emit setPivotPointsCommandIssued(parsedArguments); } } else if (command.startsWith("DRT")) { handleSetRecordTriggerInput(command); } else if (command.startsWith("DRC")) { handleSetRecordConfigInput(command); } else if(command.startsWith("RTR")) { bool parseSuccess = false; double value = doubleValueFromCommandString(command, &parseSuccess); if(parseSuccess) { emit setRecordRateCommandIssued(value); } } else if (command.startsWith("SVO")) { bool parseSuccess = false; bool value = boolValueFromCommandString(command, &parseSuccess); if(parseSuccess) { emit setServoModeCommandIssued(value); } } else if (command.startsWith("SSL")) { handleSetSoftLimitStatusInput(command); } else if (command.startsWith("SST")) { bool parseSuccess = false; AMPIC887AxisMap<double> parsedArguments = axisMapFromCommandString(command, &parseSuccess); if(parseSuccess) { emit setStepSizesCommandIssued(parsedArguments); } } else if (command.startsWith("VLS")) { bool parseSuccess = false; double parsedArgument = doubleValueFromCommandString(command, &parseSuccess); if(parseSuccess) { emit setSystemVelocityCommandIssued(parsedArgument); } } else { emit unknownCommand("Command not recognized. Type 'help' to see a list of commands"); } if(command != "quit") { emit parseComplete(); } }
//_____________________________________________________________________________ // var length events parsing //_____________________________________________________________________________ static MidiEvPtr rcvVarLen (UDPStreamPtr f, Byte c) { f->length--; MidiAddField (f->ptrCur, c); return f->length ? 0 : parseComplete (f); }
static MidiEvPtr rcv0Byte (UDPStreamPtr f, Byte c) { // should never be reached return parseComplete (f); }