Exemplo n.º 1
0
void ProFakturiKorekcija::pressReturn()
{
    if(ui->pushButton_3->hasFocus())
    {
        procAddItem();
        showData();
    }
    if(ui->pushButton_6->hasFocus())
    {
        procDeleteItem();
        showData();
    }
    else if(ui->lineEdit->hasFocus())
    {
        emit signalGetKomintent("", (QWidget*)this);
    }
    else if(ui->lineEdit_2->hasFocus())
    {
        emit signalGetArtikal("", (QWidget*)this);
    }
    else
    {
        QKeyEvent *event = new QKeyEvent(QEvent::KeyPress, Qt::Key_Tab, Qt::NoModifier);
        QCoreApplication::postEvent(this, event);
    }
}
Exemplo n.º 2
0
void main_2()
{
	SeqList s,*l;
	DataType data = 8;
	l = &s;
//	s.length = 10; 
	printf("=================%d,%d \n",s.length,ListSize);
	InsertList(l,1,data);
	InsertList(l,2,18);
	InsertList(l,3,156);
	showData(l);
	InsertList(l,2,8888);
	showData(l);
}
Exemplo n.º 3
0
void TreeModel::checkDependentState(const QModelIndex dependee, Teuchos::RCP<Dependency> dependency){
	Dependency::Type type = dependency->getType();
	QModelIndex dependent;
	Teuchos::ParameterEntry *currentDependent;
	Dependency::ParameterParentMap dependents= dependency->getDependents();
	for(Dependency::ParameterParentMap::iterator it = dependents.begin(); it != dependents.end(); ++it ){ 
		currentDependent = it->second->getEntryPtr(it->first);
		dependent = findParameterEntryIndex(currentDependent, it->first);
		if(type == Dependency::NumberArrayLengthDep){
			redrawArray(dependent.sibling(dependent.row(),1));
		}
		else if(type == Dependency::VisualDep){
			Teuchos::RCP<VisualDependency> visDep = Teuchos::rcp_static_cast<VisualDependency>(dependency);
			visDep->isDependentVisible() ? emit showData(dependent.row(), dependent.parent()) :
					       emit hideData(dependent.row(), dependent.parent());
		}

		if(!hasValidValue(dependent)){
			QString message = "Because you recently modified the " + data(dependee, Qt::DisplayRole).toString() +
			" parameter, the valid values for the " + data(dependent, Qt::DisplayRole).toString() +
			" parameter have changed.\n\nPlease modify the " +  data(dependent,Qt::DisplayRole).toString() + " value.\n";
			emit badValue(dependent.sibling(dependent.row(), 1), message);
		}
	}
}
Exemplo n.º 4
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    monitor = new PortMonitor(this);
    //przyciski
    connect(ui->pushButtonConnect,SIGNAL(clicked()),monitor,SLOT(openSerialPort()));
    connect(ui->pushButtonPreferences,SIGNAL(clicked()),monitor->settings,SLOT(show()));
    connect(ui->pushButtonDisconnect,SIGNAL(clicked()),monitor,SLOT(closeSerialPort()));
    //sygnały wysyłane, przez monitor portu
    connect(monitor,SIGNAL(newDataArrived(QByteArray)),this,SLOT(showData(QByteArray)));
    connect(monitor,SIGNAL(newLeftVerticaTriggerValue(int)),ui->verticalSliderLeftVerticalTrigger,SLOT(setValue(int)));
    connect(monitor,SIGNAL(newLeftHorizontalTriggerValue(int)),ui->horizontalSliderLeftHorizontalTrigger,SLOT(setValue(int)));
    connect(monitor,SIGNAL(newRightVerticaTriggerValue(int)),ui->verticalSliderRightVerticalTrigger,SLOT(setValue(int)));
    connect(monitor,SIGNAL(newRightHorizontalTriggerValue(int)),ui->horizontalSliderRightHorizontalTrigger,SLOT(setValue(int)));
    connect(monitor,SIGNAL(newLeftTriggerString(QString)),ui->labelLeftTrigger,SLOT(setText(QString)));
    connect(monitor,SIGNAL(newRightTriggerString(QString)),ui->labelRightTrigger,SLOT(setText(QString)));
    //dostosowanie kontrolek
    ui->verticalSliderLeftVerticalTrigger->setMinimum(-100);
    ui->verticalSliderLeftVerticalTrigger->setMaximum(100);
    ui->verticalSliderRightVerticalTrigger->setMinimum(-100);
    ui->verticalSliderRightVerticalTrigger->setMaximum(100);
    ui->horizontalSliderLeftHorizontalTrigger->setMinimum(-100);
    ui->horizontalSliderLeftHorizontalTrigger->setMaximum(100);
    ui->horizontalSliderRightHorizontalTrigger->setMinimum(-100);
    ui->horizontalSliderRightHorizontalTrigger->setMaximum(100);
}
Exemplo n.º 5
0
int XJudgerMain::insertProblem(void){
	DataConfig -> Problem.push_back(new ProblemInfo);
	showData();
	MainViewData -> setCurrentItem(MainViewData -> topLevelItem(MainViewData -> topLevelItemCount() - 1));
	showProbCase();
	return 0;
}
Exemplo n.º 6
0
void main()
{
	ND* data = ZERO;
	int n, search, select;
	while(1){
		showMenu();
		printf("입 력 : "); scanf("%d", &n);
		if(n==1){
			inputData(&data);
		}else if(n==2){
			showData(data);
		}else if(n==3){
			printf("찾을 데이터 입력 : "); scanf("%d", &search);
			searchData(data, search);
		}else if(n==4){
			printf("삭제 할 데이터 입력 : "); scanf("%d", &select);
			selectDel(&data, select);
		}else if(n==5){

		}else if(n==6){

		}else if(n==7){

		}else if(n==8){
			printf("프로그램을 종료합니다.\n"); Sleep(1000); exit(1);
		}else{
			printf("잘못된 입력 입니다.\n"); system("pause");
		}
	}//while
}//main
Exemplo n.º 7
0
void BaseUrlHandler::URLDone ( const char* /*URL*/, void * data, unsigned int size, bool complete )
{
  int _playerId = _playerIds[0];
  _playerIds.erase(_playerIds.begin());

  if ( size > 1 && size < _max_data_size ) {
    std::string _data; 
    _data.append((char*)data, size);

    if (is_valid_status(_data))	{
      replace_v2(_data,"\r\n","\n");
      replace_v2(_data,"\r","\n");
      replace_v2(_data,"\n\n","\n \n");
      //dataList->tokenize(_data.c_str(), "\r\n");
      dataList->tokenize(_data.c_str(), "\n");
      showData(_playerId);

    }
    else {
      bz_sendTextMessage (BZ_SERVER, _playerId,"No valid data was received !");
      bz_sendTextMessage (BZ_SERVER, _playerId,"This points to a bug or misuse. Please contact the server admin.");
    }
  }
  else {
    bz_sendTextMessagef (BZ_SERVER, _playerId,"The received data size (%d) exceede the limit (%d)", size, _max_data_size);
    bz_sendTextMessage (BZ_SERVER, _playerId,"This points to a bug or misuse. Please contact the server admin.");
  }
}
Exemplo n.º 8
0
Arquivo: Mask3.cpp Projeto: nrj123/pvb
int show_mask3(PARAM *p)
{
DATA d;
char event[MAX_EVENT_LENGTH];
char text[MAX_EVENT_LENGTH];
int  i;

  pvDownloadFile(p,"homer.bmp.orig");
  pvDownloadFile(p,"homer.bmp.transp");
  pvDownloadFile(p,"homer2.bmp");
  defineMask(p);
  pvResize(p,ID_MAIN_WIDGET,1280,1024);
  memset(&d,0,sizeof(DATA));
  readData(&d); // from shared memory or out of database
  showData(p,&d);
  while(1)
  {
    pvPollEvent(p,event);
    switch(pvParseEvent(event, &i, text))
    {
      case NULL_EVENT:
        readData(&d); // from shared memory or out of database
        showData(p,&d);
        break;
      case BUTTON_EVENT:
        printf("BUTTON_EVENT id=%d\n",i);
        if(i == ID_BUTTON_MASK1) return 1;
        if(i == ID_BUTTON_MASK2) return 2;
        if(i == ID_BUTTON_MASK3) pvDownloadFile(p,"homer.bmp.orig");
        if(i == ID_PRINT)        pvPrint(p,ID_GRAPHIC);
        printf("BUTTON_EVENT done\n");
        break;
      case BUTTON_PRESSED_EVENT:
        printf("BUTTON_PRESSED_EVENT id=%d\n",i);
        break;
      case BUTTON_RELEASED_EVENT:
        printf("BUTTON_RELEASED_EVENT id=%d\n",i);
        break;
      case TEXT_EVENT:
        printf("TEXT_EVENT id=%d %s\n",i,text);
        break;
      default:
        printf("UNKNOWN_EVENT id=%d %s\n",i,text);
        break;
    }
  }
}
Exemplo n.º 9
0
void CCRLSocket::OnReceive(int nErrorCode) {
	static int counter(0);
	counter++;

	if (0 == nErrorCode) {

		static int i = 0;
		i++;

		int nRead(0);

		volatile int cbLeft(sizeof(MapDataPart)); // 4 Byte
		volatile int cbDataReceived(0);
		int cTimesRead(0);
		do {


			// Determine Socket State
			//nRead = Receive(mcbDataReceived, cbLeft);


#ifdef _SHOW_SOCKET_DEBUG

			/****** Print Socket status inorder to debug ****/
			CString msg;
			msg.Format(_T("Control Msg Recivced: %d"), counter);
			m_parent->SetDlgItemTextW(IDC_RECE_STATUS2, msg);
			m_parent->UpdateData(false);
			/**********************************************/

			if (cbLeft < 0) AfxMessageBox(_T("WTF occurred"));
#endif // _SHOW_SOCKET_DEBUG


			if (nRead == SOCKET_ERROR) {
				if (GetLastError() != WSAEWOULDBLOCK) {
					//AfxMessageBox(_T("Error occurred"));
					Close();
					// Trying to reconnect
					((CMapDataReceiverDlg*)m_parent)->DoLRFSocketConnect();
					return;
				}
				break;
			}


			cbLeft -= nRead;
			cbDataReceived += nRead;
			cTimesRead++;
		} while (cbLeft > 0 && cTimesRead < 50);
	}



	showData();

	CSocket::OnReceive(nErrorCode);
}
Exemplo n.º 10
0
void TreeModel::redrawArray(const QModelIndex arrayIndex){
	if(Teuchos::toString(itemEntry(arrayIndex)->getAny()).size() <= 2){
		emit hideData(arrayIndex.row(), arrayIndex.parent());
	}
	else{
		setData(arrayIndex, QString::fromStdString(Teuchos::toString(itemEntry(arrayIndex)->getAny())));
		emit showData(arrayIndex.row(), arrayIndex.parent());
	}
}
Exemplo n.º 11
0
void IntIspratniciVnes::pressReturn()
{
    if(ui->pushButton_6->hasFocus())
    {
        procDeleteItem();
        showData();
    }
    else if(ui->tableView->hasFocus())
    {
        if (!statusOpenEditor){
            OpenTablePersistentEditor(ui->tableView, m_index);
        }else{
            CloseTablePersistentEditor(ui->tableView, m_index);
        }
        statusOpenEditor = !statusOpenEditor;
    }

    else if(ui->komintent->hasFocus())
    {
        emit signalGetKomintent("", (QWidget*)this);
    }
    else if(ui->artikal->hasFocus())
    {
        emit signalGetArtikal("", (QWidget*)this);
    }
    else if(ui->pushButton_3->hasFocus())
    {
        if (procAddItem() == true){
        showData();
        ui->artikal->setFocus();
        }
    }

    else
    {
        if (statusOpenEditor){
            CloseTablePersistentEditor(ui->tableView, m_index);
            statusOpenEditor = !statusOpenEditor;

        }else{
            PressKeyTAB(this);
        }
    }
}
Exemplo n.º 12
0
int show_mask2(PARAM *p)
{
    DATA d;
    char event[MAX_EVENT_LENGTH];
    char text[MAX_EVENT_LENGTH];
    int  i;

    defineMask(p);
    pvDownloadFile(p,"k3b_success1.wav");
    pvPlaySound(p,"k3b_success1.wav");
    memset(&d,0,sizeof(DATA));
    readData(&d); // from shared memory or out of database
    showData(p,&d);
    while(1)
    {
        pvPollEvent(p,event);
        switch(pvParseEvent(event, &i, text))
        {
        case NULL_EVENT:
            readData(&d); // from shared memory or out of database
            showData(p,&d);
            break;
        case BUTTON_EVENT:
            printf("BUTTON_EVENT id=%d\n",i);
            if(i == ID_BUTTON_MASK1) return 1;
            if(i == ID_BUTTON_MASK2) return 2;
            if(i == ID_BUTTON_MASK3) return 3;
            break;
        case BUTTON_PRESSED_EVENT:
            printf("BUTTON_PRESSED_EVENT id=%d\n",i);
            break;
        case BUTTON_RELEASED_EVENT:
            printf("BUTTON_RELEASED_EVENT id=%d\n",i);
            break;
        case TEXT_EVENT:
            printf("TEXT_EVENT id=%d %s\n",i,text);
            break;
        default:
            printf("UNKNOWN_EVENT id=%d %s\n",i,text);
            break;
        }
    }
}
Exemplo n.º 13
0
void VClientWindow::on_connectButton_clicked(){
    ui->connectButton->setEnabled(false);
    client= new Client(ui->hostTextField->text(),ui->portSpin->value(),this);
    connect(client,SIGNAL(connected()),this,SLOT(setConnected()));
    connect(client, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(socketError(QAbstractSocket::SocketError)));

    client->connectToServer();
    connect(client, SIGNAL(showData()),this,SLOT(showData()));
    connect(client,SIGNAL(showImage(QImage)),screenShareview,SLOT(showImage(QImage)));
    connect(ui->inputTextField,SIGNAL(textChanged()),this,SLOT(commandtyped()));

    connect(ui->actionScreen_Sharing,SIGNAL(triggered()),client,SLOT(startScreenShare()));
    connect(screenShareview->getStopScreenShareButton(),SIGNAL(clicked()),this,SLOT(stopScreenShare()));
    connect(screenShareview->getSizeSlider(),SIGNAL(sliderReleased()),this,SLOT(sendScreenSize()));
    connect(screenShareview->getTimeSlider(),SIGNAL(sliderReleased()),this,SLOT(sendDelayTime()));
    connect(screenShareview->getGrayScaleBox(),SIGNAL(toggled(bool)),client,SLOT(sendGrayScale(bool)));


}
Exemplo n.º 14
0
void showData(ND* node)
{
	if(node == ZERO){
		printf("더 이상 출력할 데이터가 없습니다.\n");
		system("pause");
		return;
	}
	printf("데이터 출력 : %d \n", node->data);
	showData(node->link);
}
Exemplo n.º 15
0
int main()
{
	data_t  array[] ={34,15,17,8,1,5,3,8,6,9,88};
	int num = sizeof(array)/sizeof(int);
	
	int * p = malloc(sizeof(array));
	bzero(p, sizeof(array));
	memcpy(p, array, sizeof(array));
	
	showData(array, num);
	
	//bubble((void **)&p, num);  //Êý×é×öÊäÈëÊä³ö²ÎÊý»áÓÐÎÊÌ⣬ËùÒÔ¸ÄΪʹÓÃÄÚ´æ·ÖÅäµÄÖ¸Õ룬Õâ¿ÉÄܺÍÊý×éÊÇ·ÖÅäÔÚÕ»ÉϵÄÓйØ
	//insertion((void**)&p, num);
	//selection((void**)&p, num);
	merge_sort((void**)&p, num);
	
	showData(p, num);
	
	free(p);
	return 0;
}
Exemplo n.º 16
0
void PovratniciKorekcija::initProc(Povratnici_trans m_data)
{
    resFaktura = m_data.data1;
    ui->faktura_id->setText(resFaktura.dokument_id);
    ui->sifra_komintent->setText(resFaktura.komintent_id);
    ui->komintent->setText(resFaktura.komintent_naziv);

    resFakturaItems = m_data.data2;
    resFakturaItems_oldData = m_data.data2;
    showData();
    ui->artikal->setFocus();
}
Exemplo n.º 17
0
static SWITCH_UPDATE(SLEIC) {
#ifdef MAME_DEBUG
  static UINT8 data = 0;
#endif
  if (inports) {
    CORE_SETKEYSW(inports[CORE_COREINPORT], 0xff, 0);
  }
#ifdef MAME_DEBUG
  if      (keyboard_pressed_memory_repeat(KEYCODE_Z, 2))
    showData(data -= 16);
  else if (keyboard_pressed_memory_repeat(KEYCODE_X, 2))
    showData(--data);
  else if (keyboard_pressed_memory_repeat(KEYCODE_C, 2))
    showData(++data);
  else if (keyboard_pressed_memory_repeat(KEYCODE_V, 2))
    showData(data += 16);
  else if (keyboard_pressed_memory_repeat(KEYCODE_SPACE, 2)) {
	  OKIM6376_data_0_w(0, data);
	  OKIM6376_data_0_w(0, 0x10);
	}
#endif /* MAME_DEBUG */
}
Exemplo n.º 18
0
status showData_Shell(char *name, int k)
{
    kInitialize(k);
    if (showData(name) == ERROR)
    {
        printf("ERROR!");
        getchar();
        return ERROR;
    }
    printf("enter to exit:");
    getchar();
    return FINE;
}
Exemplo n.º 19
0
void IntIspratniciVnes::setFocusKomintent(komintentT t)
{
    ui->komintent->setFocus();
    ui->komintent->selectAll();
    ui->komintent->setText(t.naziv);
    ui->sifra_komintent->setText(t.sifra);
    resFaktura.komintent_id = t.sifra;
    resFaktura.komintent_naziv = t.naziv;
    for (int i = 0; i < resFakturaItems.count(); i++){\
        resFakturaItems[i].komintent_id = resFaktura.komintent_id;
    }
    showData();
    PressKeyTAB(this);
}
Exemplo n.º 20
0
int XJudgerMain::removeProblem(void){
	QModelIndex index = MainViewData -> currentIndex();
	if (index.isValid()){
		string title = index.data().toString().toAscii().data();
		if (title.substr(0, 9) == "Problem: ");
		else title = index.parent().data().toString().toAscii().data();
		title = title.substr(9, title.size() - 9);
		int probID = DataConfig -> getProblemID(title);
		DataConfig -> Problem.removeAt(probID);
	}
	showData();
	showProbCase();
	return 0;
}
Exemplo n.º 21
0
//
// re-calculate frequency response
//
void Plot::setDamp( double damping )
{
    const bool doReplot = autoReplot();
    setAutoReplot( false );

    const int ArraySize = 200;

    double frequency[ArraySize];
    double amplitude[ArraySize];
    double phase[ArraySize];

    // build frequency vector with logarithmic division
    logSpace( frequency, ArraySize, 0.01, 100 );

    int i3 = 1;
    double fmax = 1;
    double amax = -1000.0;

    for ( int i = 0; i < ArraySize; i++ )
    {
        double f = frequency[i];
        const ComplexNumber g =
            ComplexNumber( 1.0 ) / ComplexNumber( 1.0 - f * f, 2.0 * damping * f );

        amplitude[i] = 20.0 * log10( qSqrt( g.real() * g.real() + g.imag() * g.imag() ) );
        phase[i] = qAtan2( g.imag(), g.real() ) * ( 180.0 / M_PI );

        if ( ( i3 <= 1 ) && ( amplitude[i] < -3.0 ) )
            i3 = i;
        if ( amplitude[i] > amax )
        {
            amax = amplitude[i];
            fmax = frequency[i];
        }

    }

    double f3 = frequency[i3] - ( frequency[i3] - frequency[i3 - 1] )
        / ( amplitude[i3] - amplitude[i3 -1] ) * ( amplitude[i3] + 3 );

    showPeak( fmax, amax );
    show3dB( f3 );
    showData( frequency, amplitude, phase, ArraySize );

    setAutoReplot( doReplot );

    replot();
}
Exemplo n.º 22
0
void EngineExplorer::dataUpdated(const QString& source, const Plasma::DataEngine::Data& data)
{
    QList<QStandardItem*> items = m_dataModel->findItems(source, 0);

    if (items.isEmpty()) {
        return;
    }

    QStandardItem* parent = items.first();

    int rows = showData(parent, data);

    while (parent->rowCount() > rows) {
        parent->removeRow(rows);
    }
}
Exemplo n.º 23
0
int XJudgerMain::updateProblem(void){
	QModelIndex index = MainViewData -> currentIndex();
	if (!NoTextUpdate && index.isValid() && GroupViewProb -> isVisible()){
		string title = index.data().toString().toAscii().data();
		title = title.substr(9, title.size() - 9);
		int probID;
		probID = DataConfig -> getProblemID(title);
		ProblemInfo *prob = DataConfig -> Problem[probID];
		prob -> Input = TextInput -> toPlainText().toAscii().data();
		prob -> Output = TextOutput -> toPlainText().toAscii().data();
		prob -> Source = TextSource -> toPlainText().toAscii().data();
		prob -> Name = TextProbName -> toPlainText().toAscii().data();
		showData();
	}
	return 0;
}
Exemplo n.º 24
0
int XJudgerMain::insertTestCase(void){
	QModelIndex index = MainViewData -> currentIndex();
	if (index.isValid()){
		string title = index.data().toString().toAscii().data();
		if (title.substr(0, 9) == "Problem: ");
		else title = index.parent().data().toString().toAscii().data();
		title = title.substr(9, title.size() - 9);
		int probID = DataConfig -> getProblemID(title);
		DataConfig -> Problem[probID] -> TestCase.push_back(new TestCaseInfo);
		showData();
		MainViewData -> setItemExpanded(MainViewData -> topLevelItem(probID), 1);
		MainViewData -> setCurrentItem(MainViewData -> topLevelItem(probID) -> child(DataConfig -> Problem[probID] -> TestCase.size() - 1));
		showProbCase();
	}
	return 0;
}
Exemplo n.º 25
0
int XJudgerMain::removeTestCase(void){
	QTreeWidgetItem *item = MainViewData -> currentItem();
	if (item != NULL){
		string title = item -> data(0, 0).toString().toAscii().data();
		if (title.substr(0, 9) == "Problem: ") return 0;
		else title = item -> parent() -> data(0, 0).toString().toAscii().data();
		title = title.substr(9, title.size() - 9);
		int probID = DataConfig -> getProblemID(title);
		if (probID == -1) return 0;
		DataConfig -> Problem[probID] -> TestCase.removeAt(item -> parent() -> indexOfChild(item));
		showData();
		MainViewData -> setItemExpanded(MainViewData -> topLevelItem(probID), 1);
		MainViewData -> setCurrentItem(MainViewData -> topLevelItem(probID) -> child(DataConfig -> Problem[probID] -> TestCase.size() - 1));
		showProbCase();
	}
	return 0;
}
Exemplo n.º 26
0
int XJudgerMain::updateTestCase(void){
	QModelIndex index = MainViewData -> currentIndex();
	if (!NoTextUpdate && index.isValid() && GroupViewCase -> isVisible()){
		string title = index.data().toString().toAscii().data();
		int id, probID;
		sscanf(title.c_str(), "Test Case %d", &id); id --;
		string progTitle = index.parent().data().toString().toAscii().data();
		progTitle = progTitle.substr(9, progTitle.size() - 9);
		probID = DataConfig -> getProblemID(progTitle);
		TestCaseInfo *tCase = DataConfig -> Problem[probID] -> TestCase[id];
		tCase -> Input = TextCaseInput -> toPlainText().toAscii().data();
		tCase -> Output = TextCaseOutput -> toPlainText().toAscii().data();
		tCase -> TimeLimit = TextCaseTL -> toPlainText().toDouble();
		tCase -> MemoryLimit = TextCaseML -> toPlainText().toInt();
		tCase -> Score = TextCaseScore -> toPlainText().toDouble();
		showData();
	}
	return 0;
}
Exemplo n.º 27
0
int FireworkShowMenuComponent::handleObjectMenuSelect(SceneObject* sceneObject,
		CreatureObject* player, byte selectedID) const {

	if(!sceneObject->isASubChildOf(player))
		return 0;

	if (!sceneObject->isFireworkObject())
		return 0;

	if (!player->isPlayerCreature())
		return 0;

	if (player->getZone() == NULL)
		return 0;
	FireworkObject* firework = cast<FireworkObject*>(sceneObject);

	switch (selectedID) {
		case 20:
			firework->beginShowLaunch(player);
			break;
		case 68: // showData
			showData(player, firework);
			break;
		case 69: // Add Event
			addEvent(player, firework);
			break;
		case 70:  // Remove Event
			removeEvent(player, firework);
			break;
		case 71:  // Modify Event
			modifyEvent(player, firework);
			break;
		case 72:  // Reorder Show
			reorderShow(player, firework);
			break;
		default:
			return TangibleObjectMenuComponent::handleObjectMenuSelect(sceneObject,	player, selectedID);
		}
	return 0;
}
Exemplo n.º 28
0
int main(int argc, char * argv[]){
    if (argc < 2){ 
        printf("Incorrect usage: must enter filename\n");
        exit (1);
    }
    Graph g = readGraph(argv[1]);
    showGraph(g);
    printf("\n");

    // TASK 1
    printf("TASK 1\n");
    showGraphLabels(g);
    printf("\n");
    showData(g);
    printf("\n");
    
    // TASK 2
    printf("TASK 2\n");
    int *dfsOrdered = malloc(numV(g) * sizeof(Vertex));
    dfSearch2(g, dfsOrdered);
    int i;
    for(i=0;i< cnt;i++){
        Vertex v = dfsOrdered[i];
        showVertexData(g,v);
    }
    printf("\n");
    
    // TASK 3
    printf("TASK 3\n");
    printf("\nFlying all over the world\n");

    //Uncomment out this line when you get to task 3
    getFlights(g,dfsOrdered);
    
    free(dfsOrdered);    
    destroyGraph(g);    
    return 0;
}
// run
// Description: Runs the simulation
void Restaurant::run(void){
	TimeStamp::set(); // Setup timestamp for data writing

	setValues(); // Initialize default values and attempt to read config file

	int groups = 0;

	// Main loop
	while(timeRun <= totalTimeToRun){
		
		if(timeRun > 0 && timeRun % patronGroupArriveInterval == 0){ // If patron groups should arrive at the time interval

			(patronGroupMinArrive == 0) ? // Account for a 0 as the minimum
				groups = rand() % patronGroupMaxArrive :
				groups = rand() % patronGroupMinArrive + patronGroupMaxArrive;

			totalPatronGroups += groups;

			for(int i = 0; i < groups; i++){ // Add number of groups to arrive to line
				line.push_back(PatronFactory::newPatronGroup());
			}
		} // End generating new PatronGroups

		busTables(); // Remove finished PatronGroups
		seatLine(); // Seat PatronGroups from the line if possible

		if(timeRun > 0 && timeRun % updateInterval == 0){ // Check if data should be shown for the current time interval
			showData();
		}

		advanceTime(); // Advance time for all PatronGroups

	} // End main loop

	writeToOutput(); // Write data to output file

} // End run
Exemplo n.º 30
0
/**
 * @brief	Main routine for SPI example
 * @return	Does not return
 */
int main(void)
{
	uint16_t seed = 0;

	SystemCoreClockUpdate();
	Board_Init();

	/* SPI initialization */
	Init_SPI_PinMux();

	/* Initialize stopwatch driver so some event times can be measured */
	StopWatch_Init();

	/* Setup SPI controllers */
	setupMaster();
	setupSlave();

	/* Enable SPI controller interrupts */
	NVIC_EnableIRQ(LPC_SPIMASTERIRQNUM);
	NVIC_EnableIRQ(LPC_SPISLAVEIRQNUM);

	DEBUGSTR("SPI master/slave combined example\r\n");

	/* If you enable loopback mode and connect the master and slave controller's clock
	   and SSEL lines together, the master and slave will wrap data to each other */
	// Chip_SPIM_EnableLoopBack(LPC_SPIMASTERPORT);

	/* Loop forever */
	while (1) {
		/* Setup some data for transmit from master to slave and slave to master */
		seed = bufferInit(seed);

		/* Set slave transfer, this is only the initial transfer,
		   the callbacks can change this later */
		spiSlaveXfer.pTXData16 = slaveTXBuffer16;
		spiSlaveXfer.txCount = sizeof(slaveTXBuffer16) / sizeof(uint16_t);	/* Count is in transfer size */
		spiSlaveXfer.pRXData16 = slaveRXBuffer16;
		spiSlaveXfer.rxCount = sizeof(slaveRXBuffer16) / sizeof(uint16_t);	/* Count is in transfer size */

		/* Set master transfer, this is only the initial transfer,
		   the callbacks can change this later */
		spiMasterXfer.pTXData16 = masterTXBuffer16;	/* Use NULL to send 0x0 */
		spiMasterXfer.txCount = sizeof(masterTXBuffer16) / sizeof(uint16_t);/* Count is in transfer size */
		spiMasterXfer.pRXData16 = masterRXBuffer16;
		spiMasterXfer.rxCount = sizeof(masterRXBuffer16) / sizeof(uint16_t);/* Count is in transfer size */

		/* Setup master transfer options - 16 data bits per transfer, EOT, EOF */
		spiMasterXfer.options =
			SPI_TXCTL_FLEN(16) |		/* This must be enabled as a minimum, use 16 data bits */
			// SPI_TXCTL_EOT |			/* Enable this to assert and deassert SSEL for each individual byte/word, current slave functions for this example do not support this */
			// SPI_TXCTL_EOF |			/* Insert a delay between bytes/words as defined by frame delay time */
			// SPI_TXCTL_RXIGNORE |		/* Enable this to ignore incoming data, or set spiMasterXfer.pRXData16 to NULL to ignore RX data  */
			0;

		/* Transfer will terminate after current buffer is sent. If terminate is not set, the buffers
		   must be setup by the callbacks		*/
		spiMasterXfer.terminate = true;

		/* Use SPI select 0 */
		spiMasterXfer.sselNum = 0;

		/* Time master and slave transfers */
		masterTime = StopWatch_Start();

		/* Limitation: The call below 'pre-buffers' the initial slave transmit datum.
		   If this isn't pre-buffered, a slave transmit underflow will always occur
		   at slave assertion time for the initial transmit datum. The datum sent to the
		   master will be 0. This is ok as we are only using a single slave, but with multiple
		   slaves pre-buffering is not always an option and the master might need to toss the
		   first byte. */
		Chip_SPI_FlushFifos(LPC_SPIMASTERPORT);
		Chip_SPI_FlushFifos(LPC_SPISLAVEPORT);
		Chip_SPIS_PreBuffSlave(LPC_SPISLAVEPORT, &spiSlaveXfer);

		/* Start master transfer */
		Chip_SPIM_Xfer(LPC_SPIMASTERPORT, &spiMasterXfer);

		/* Sleep until transfers are complete */
		mEnd = sEnd = false;
		while ((mEnd == false) || (sEnd == false)) {
			__WFI();
		}

		/* Toggle LED */
		Board_LED_Toggle(0);

		/* Display some information about the transfer */
		Print_Val("\r\nTRANSFER COMPLETE: errors = 0x", errors);
		errors = 0;
		Print_Val("Master total transfer time in uS: 0x", StopWatch_TicksToUs(StopWatch_Elapsed(masterTime)));

		/* Show data */
		showData("Master TX data", masterTXBuffer16);
		showData("Master RX data", masterRXBuffer16);
		showData("Slave  TX data", slaveTXBuffer16);
		showData("Slave  RX data", slaveRXBuffer16);
	}
}