Beispiel #1
0
static int
getInputValue(void)
{
    int		success = 0;

    if (_cmdHave) {
        static int      initialized = 0;

        if (initialized) {
            if (_cmdWant == NULL) {
                /*
                 * Multiple, prompt-driven conversions desired.
                 */
                success = 1;
            }
            else {
                /*
                 * Single, previous, command-line-driven conversion desired.
                 */
                success = 0;
            	_exitStatus = EXIT_SUCCESS;
            }
        }
        else {
            success = decodeInput(_cmdHave);
            initialized = 1;
        }
    }
    else {
        for (;;) {
            char    buf[sizeof(_haveUnitSpec)];
            int	nbytes = getSpec("You have: ", buf, sizeof(buf));

            if (nbytes < 0)
                break;

            if (nbytes > 0) {
                success = decodeInput(buf);

                if (success)
                    break;
            }
        }
    }

    return success;
}
Beispiel #2
0
/********************************************************
 * Runs each cycle and stores any keys that are pressed *
 * ******************************************************/
int getInput(chip8* myChip8)
{
	// gets character pressed and decoded it into it's coresponding position in the input array
	int c = decodeInput(getch());

	// if c == -1 that means we read in a charcter that is not mapped, ignore reading in anything
	// this cycle if it's not -1 go to the position in the input array and set it to 1
	if(c != -1){	
		(*myChip8).input[c] = 1;
	}

	return 1;
}
Beispiel #3
0
CProcessInstance* CDecodeFlowContext::readInstanceOfContextProcess ( const QDomElement& data, CProcessContext* processContext )
{
  CProcessInstance* processInstance = NULL; 
  bool bOk = true;
  QDomElement id = data.firstChildElement("id");
  QDomElement name = data.firstChildElement("name");
  QDomElement hasChanged = data.firstChildElement("hasChanged");
  QDomElement implements = data.firstChildElement("implements");
  int implementsID;
  CProcessImplementation* implementsProcess = NULL;  
  
  if (!id.isNull() && !name.isNull() && !hasChanged.isNull() && !implements.isNull())
  {
    processInstance = new CProcessInstance();
    processInstance->setID(id.text().toInt());
    processInstance->setName(name.text());
    processInstance->setNameHasChanged(hasChanged.text().toInt());
 
    implementsID = implements.attribute("id").toInt();
    implementsProcess = m_pItemFactory->getProcessFactory()->getImplementationProcess(implementsID);
    if (implementsProcess != NULL) //shall not be null because exist always for a context diagram ToCheck
      processInstance->setImplementedProcess(implementsProcess);
    else
    {
      delete processInstance;
      processInstance = NULL;
    }

    //read input flow list
    QDomElement inputList = data.firstChildElement("input-list");
    CDecodeInputOutputListOfProcessInstance decodeInput(processContext, processInstance, true);
    
    bOk = decodeInput.searchInXmlList(inputList, "input", &decodeInput);
    if (bOk)
    {
      //read output flow list
      QDomElement outputList = data.firstChildElement("output-list");
      CDecodeInputOutputListOfProcessInstance decodeOutput(processContext, processInstance, false);
      bOk = decodeOutput.searchInXmlList(outputList, "output", &decodeOutput);
    }
    
    if (!bOk)
    {
      delete processInstance;
      processInstance = NULL;
    }
    
  }
  return processInstance;
}
Beispiel #4
0
QString KCmdLineArgs::appName()
{
   if (!s->appName) return QString();
   return s->decodeInput(s->appName);
}