/*
 * Display the string where it does.
 */
void IDisplayer::display ( const CLog::TDisplayInfo& args, const char *message )
{
	_Mutex->enter();
	try
	{
		doDisplay( args, message );
	}
	catch (Exception &)
	{
		// silence
	}
	_Mutex->leave();
}
示例#2
0
int main(int argc, char *argv[])
{
    node *chars, *q=NULL, *root;
    int c;
    unsigned  mode;
    double offset;

    /* build huffman tree */
    chars = getCharCounts(argv[1]);
    q = orderInputQ(chars, q);
    root = buildTree(q);

    /* Display */
    if(argc!=2){
        fprintf(stderr, "incorrect usage, try eg"
                "./huffman textfile.txt");
        exit(1);
    }
    printf("\nenter number for layout type:\n");
    printf("0. Knuth, 1. pseudo-Reingold-Tilford\n");
    printf("(1 is not 100%% correct as RT but better ");
    printf("than Knuth in all cases I tried) :");

    while(scanf("%u", &mode)!=1 || mode > 1){
        printf("invalid choice, try again\n");

        do{/*clear out user input*/
            c=getchar();
        } while(c!='\n');
    }

    if(mode == 0){
        knuth_getCoords(root, 0);
    } else {
        rt_draw_1(root, 0);
        offset = rt_1_1_move_onscreen(root);
        root->offset = offset;
        root->x += offset;
        rt_2_petrify(root,0);
    }

    doDisplay(root);

    /*clear up other memory */
    freeTree(root);
    free(chars);

    return 0;
}
示例#3
0
GenGraphForm::GenGraphForm()
: currentTask(NULL), settingFilter(false)
{
    // signals and slots connections
    connect(browseButton, SIGNAL(clicked()), this, SLOT(doBrowse()));
    connect(exportButton, SIGNAL(clicked()), this, SLOT(doExport()));
    connect(displayButton, SIGNAL(clicked()), this, SLOT(doDisplay()));
    connect(closeButton, SIGNAL(clicked()), this, SLOT(doClose()));
    connect(filename, SIGNAL(textChanged(const QString&)), this, SLOT(change()));
    connect(presetFilter, SIGNAL(activated(const QString&)), this, SLOT(setFilter()));
    connect(showNodes, SIGNAL(toggled(bool)), this, SLOT(changeFilter()));
    connect(showObjects, SIGNAL(toggled(bool)), this, SLOT(changeFilter()));
    connect(showBehaviorModels, SIGNAL(toggled(bool)), this, SLOT(changeFilter()));
    connect(showCollisionModels, SIGNAL(toggled(bool)), this, SLOT(changeFilter()));
    connect(showVisualModels, SIGNAL(toggled(bool)), this, SLOT(changeFilter()));
    connect(showMappings, SIGNAL(toggled(bool)), this, SLOT(changeFilter()));
    connect(showContext, SIGNAL(toggled(bool)), this, SLOT(changeFilter()));
    connect(showCollisionPipeline, SIGNAL(toggled(bool)), this, SLOT(changeFilter()));
    connect(showSolvers, SIGNAL(toggled(bool)), this, SLOT(changeFilter()));
    connect(showMechanicalStates, SIGNAL(toggled(bool)), this, SLOT(changeFilter()));
    connect(showForceFields, SIGNAL(toggled(bool)), this, SLOT(changeFilter()));
    connect(showInteractionForceFields, SIGNAL(toggled(bool)), this, SLOT(changeFilter()));
    connect(showConstraints, SIGNAL(toggled(bool)), this, SLOT(changeFilter()));
    connect(showMass, SIGNAL(toggled(bool)), this, SLOT(changeFilter()));
    connect(showTopology, SIGNAL(toggled(bool)), this, SLOT(changeFilter()));
    connect(showMechanicalMappings, SIGNAL(toggled(bool)), this, SLOT(changeFilter()));

    // init preset filters
	{
		std::set<std::string>& filt = presetFilters["Full Graph"];
		filt.insert("showNodes");
		filt.insert("showObjects");
		filt.insert("showBehaviorModels");
		filt.insert("showCollisionModels");
		filt.insert("showVisualModels");
		filt.insert("showMappings");
		filt.insert("showContext");
		filt.insert("showCollisionPipeline");
		filt.insert("showSolvers");
		filt.insert("showMechanicalStates");
		filt.insert("showForceFields");
		filt.insert("showInteractionForceFields");
		filt.insert("showConstraints");
		filt.insert("showMass");
		filt.insert("showTopology");
		filt.insert("showMechanicalMappings");
	}
	{
		std::set<std::string>& filt = presetFilters["All Objects"];
		filt = presetFilters["Full Graph"];
		filt.erase("showNodes");
	}
	{
		std::set<std::string>& filt = presetFilters["All Nodes"];
		filt.insert("showNodes");
	}
	{
		std::set<std::string>& filt = presetFilters["Mechanical Graph"];
		filt = presetFilters["Full Graph"];
		filt.erase("showCollisionModels");
		filt.erase("showVisualModels");
		filt.erase("showMappings");
		filt.erase("showCollisionPipeline");
	}
	{
		std::set<std::string>& filt = presetFilters["Mechanical Objects"];
		filt = presetFilters["Mechanical Graph"];
		filt.erase("showNodes");
	}
	{
		std::set<std::string>& filt = presetFilters["Visual Graph"];
		filt.insert("showNodes");
		filt.insert("showObjects");
		filt.insert("showVisualModels");
	}
	{
		std::set<std::string>& filt = presetFilters["Visual Objects"];
		filt = presetFilters["Visual Graph"];
		filt.erase("showNodes");
	}
	{
		std::set<std::string>& filt = presetFilters["Collision Graph"];
		filt.insert("showNodes");
		filt.insert("showObjects");
		filt.insert("showCollisionModels");
		filt.insert("showCollisionPipeline");
	}
	{
		std::set<std::string>& filt = presetFilters["Collision Objects"];
		filt = presetFilters["Collision Graph"];
		filt.erase("showNodes");
	}
	{
		std::set<std::string>& filt = presetFilters["Collision Response Graph"];
		filt.insert("showNodes");
		filt.insert("showObjects");
		//filt.insert("showBehaviorModels");
		filt.insert("showCollisionModels");
		//filt.insert("showVisualModels");
		//filt.insert("showMappings");
		//filt.insert("showContext");
		//filt.insert("showCollisionPipeline");
		filt.insert("showSolvers");
		filt.insert("showMechanicalStates");
		//filt.insert("showForceFields");
		filt.insert("showInteractionForceFields");
		filt.insert("showConstraints");
		//filt.insert("showMass");
		//filt.insert("showTopology");
		filt.insert("showMechanicalMappings");
	}
	{
		std::set<std::string>& filt = presetFilters["Collision Response Objects"];
		filt = presetFilters["Collision Response Graph"];
		filt.erase("showNodes");
	}

}
示例#4
0
int main(void){
	//PORT mapping
	//On PORTD, we have the matrix the lines.
	//On PORTC, we have inputs, 2 buttons and the DCF and Time sensors
	//On PortB we have control over the shift registers and the DEBUG led!
	//		 76543210
	DDRC = 0b00000110;
	DDRD = 0b11111111;
	DDRB = 0b11111111;
	PORTC = 0b00111001;
	PORTD = 0;
	PORTB = 0;
	
	//Initialize Interrupt for timer0
	TCNT0 = 0xFC;
	TCCR0A = (1 << WGM01);
	TCCR0B = (0<<CS02)|(0<<CS01)|(1<<CS00);
	//TIMSK0 |= _BV(TOIE0);
	
	//Initialize Interrupt for timer1
	TCCR1A |= (0 << COM1A1) | (0 << COM1A0);
	TCCR1B |= (1 << WGM12) | (1 << CS11); // Set CTC and prescaler :8
	OCR1A = 0x61A7;
	TIMSK1 |= (1 << OCIE1A);
	sei();

	DEBUG_UIT();
	SPI_MasterInit();
	
	//SETFLAG(FLAG_STARTUP);
	
	uint16_t refreshCounter = 0;
	uint16_t ttCounter = 0;
	uint8_t tempCounter = 0;
	doDisplay(0);
    while(1) {
		if(CHECKFLAG(FLAG_REFRESHDISPLAY)){
			RESETFLAG(FLAG_REFRESHDISPLAY);
			refreshDisplay();
		}
		
		if(CHECKFLAG(FLAG_HANDLEBIT)){
			RESETFLAG(FLAG_HANDLEBIT);
			//DEBUG_AAN();
			//handleBit();
		}
		
		if(CHECKFLAG(FLAG_STARTUP)){
			//Do something nice..
			if(ttCounter == 4000){
				for(uint8_t display = 0;display <= MAX_DISPLAY; display++){
					for(uint8_t row = 0;row<=8;row++){
						if(display == (tempCounter / 5)){
							displays[display][row] = (3 << (tempCounter % 5));
						}else{
							displays[display][row] = 0;
						}
					}					
				}				
				tempCounter++;
				ttCounter=0;
				if(tempCounter == MAX_DISPLAY * 5){
					tempCounter=0;
				}
			}
			ttCounter++;
		}else{
		//if(secondCounter % 10 >= 8){
			/*if(CHECKFLAG(FLAG_READTEMP)){
				temperature = (uint16_t) ds1820_read();
				RESETFLAG(FLAG_READTEMP);
				//doDisplay(temperature);
			}else{*/
				showClock(12,34);
			//}			
		//}else{
			//showClock(currentTime.hours,currentTime.minutes);
		//}
		}
		
		if(refreshCounter == 20){
			SETFLAG(FLAG_REFRESHDISPLAY);
			refreshCounter = 0;
			//doDisplay(refreshCounter);
		}
		refreshCounter++;
		//doDisplay(refreshCounter);
    }
}
示例#5
0
int main (int argc, char **argv)
{
 int dbug=0;
 char *input;
 int ch;
 list *l = lst_create();

 if(argc ==2){
   if(argv[1][0] == '-' && argv[1][1] == 'd'){
     dbug = 1;  // ./a.out -d
     printf("\nDebug mode activated\n");
   }
 }
 
 printf ("Starting Restaurant Wait List Program\n\n");
 printf ("Enter command: ");

 while ((ch = getNextNWSChar ()) != EOF)
   {
    /* check for the various commands */
    if ('q' == ch)
      {
       printf ("Quitting Program\n");
       return (0);
      }
    else if ('?' == ch)
      {
       printCommands();
      }
    else if('a' == ch)
      {
       doAdd(l,dbug);
      } 
    else if('c' == ch)
      {
       doCallAhead(l,dbug);
      } 
    else if('w' == ch)
      {
       doWaiting(l,dbug);
      } 
    else if('r' == ch)
      {
       doRetrieve(l,dbug);
      } 
    else if('l' == ch)
      {
       doList(l,dbug);
      } 
    else if('d' == ch)
      {
       doDisplay(l,dbug);
      } 
    else
      {
       printf ("%c - in not a valid command\n", ch);
       printf ("For a list of valid commands, type ?\n");
       clearToEoln();
      }

    printf ("\nEnter command: ");
   }

 printf ("Quiting Program - EOF reached\n");
 lst_free(l,dbug);
 return 1;
}