Exemplo n.º 1
0
Arquivo: BREW.cpp Projeto: Cruel/SFGUI
BREW::BREW()
{
	ResetProperties();
}
Exemplo n.º 2
0
BREW::BREW() :
	Engine()
{
	ResetProperties();
}
Exemplo n.º 3
0
Packet::Packet() 
{ 
  pmt = NULL;
  ResetProperties(true);
}
Exemplo n.º 4
0
int main (int argc, char**argv)
{
	int32_t first_Error = 0;
	ResetProperties();
	UpdateNumberOfRawAndColomn();
	// check error
	if (argc < 2) {
		printf("You set more than 3 argument at the commande line\n");
		usage();
		return -1;
	}
	bool directCheckFiles = false;
	int basicIDParsing = 1;
	if (0==strcmp("-d",argv[1])) {
		basicIDParsing++;
		directCheckFiles = true;
	}
	// one file
	if (basicIDParsing+1 <= argc) {
		strcpy(fileProp[0].name, argv[basicIDParsing]);
		fileProp[0].availlable = true;
	}
	// a second file
	if (basicIDParsing+2 <= argc) {
		strcpy(fileProp[1].name, argv[basicIDParsing+1]);
		fileProp[1].availlable = true;
	}
	// open the files
	OpenFiles();
	
	// user requested to have the direct error ID of the file...
	if (directCheckFiles==true) {
		
		float dividor = 1;
		int32_t maxSlot = (fileProp[0].slotSize>fileProp[1].slotSize)?fileProp[0].slotSize:fileProp[1].slotSize;
		if (0!=maxSlot) {
			dividor = maxSlot;
		}
		
		int32_t idError = findFirstDiff();
		int minSizeFile = ((fileProp[0].size<fileProp[1].size)?fileProp[0].size:fileProp[1].size) - abs(getPaddingOffsetFile());
		if (minSizeFile<=idError) {
			printf(" --- slot=%3d nb frame=%d", (int32_t)dividor, (int32_t)(idError/dividor));
			CloseFiles();
			// 0 : no error
			return 0;
		} else {
			int32_t sizeElement = 1;
			showTypeSize_te tmpType = getTypeSize();
			switch(tmpType)
			{
				default:
				case SHOW_TYPE_SIZE_8:
					sizeElement = 1;
					break;
				case SHOW_TYPE_SIZE_16:
					sizeElement = 2;
					break;
				case SHOW_TYPE_SIZE_FLOAT:
				case SHOW_TYPE_SIZE_32:
					sizeElement = 4;
					break;
				case SHOW_TYPE_SIZE_DOUBLE:
				case SHOW_TYPE_SIZE_64:
					sizeElement = 8;
					break;
			}
			int32_t elementIDError = idError/sizeElement;
			float frameRatio = (float)elementIDError/dividor;
			int32_t idFrame = frameRatio;
			int32_t idFrameElement = (frameRatio-idFrame)*dividor;
			printf("%9d / frame=%9.2f ==> frame=%5d element=%5d slot=%3d", elementIDError, frameRatio, idFrame, idFrameElement, (int32_t)dividor);
			CloseFiles();
			return idError;
		}
	}
	// rendre la lecture des données non canonique
	system("stty -icanon");
	// supression de l'écho des caractères
	system("stty -echo");
	// enable mouse event ...
	printf(MOUSE_REPORTING_ENABLE);
	// hide cursor ...
	printf(CURSOR_DISPLAY_DISABLE);
	system("clear");
	CleanDisplay();


	int ret = 0;
	pthread_t HangleThreadDisplay;

	ret = pthread_create ( & HangleThreadDisplay, NULL, threadDisplay, NULL );
	if (! ret)
	{
		while (1)
		{
			int32_t inputValue;
			inputValue = getc(stdin);
			switch(inputValue)
			{
				case 'q':
				case 'Q':
					goto exit_programme;
					break;
				//case 0x1B:
				case '\e':
					inputValue = getc (stdin);
					//printf("\n get data : 0x%08x ..... : \n", (unsigned int)inputValue);
					// [ == 0x5B
					if (inputValue == '[')
					{
						inputValue = getc (stdin);
						char charValue = inputValue;
						// printf("\n get data : 0x%08x ..... : \\e[%c\n", (unsigned int)inputValue, charValue);
						if (    charValue == 'A' //0x41 ==> UP
						     || charValue == 'B' //0x42 ==> DOWN
						     || charValue == 'C' //0x43 ==> RIGHT
						     || charValue == 'D' //0x44 ==> LEFT
						   )
						{
							//printf("\n get data :\\e[%c ==> MoveKey \n", charValue);
							if (charValue == 'A') {
								upDownOfsetFile(-5);
							} else if ( charValue == 'B') {
								upDownOfsetFile(5);
							} else if ( charValue == 'C') {
								upDownOfsetFile((GetNumberOfRaw()-NB_HEARDER_RAW));
							} else if ( charValue == 'D') {
								upDownOfsetFile(-(GetNumberOfRaw()-NB_HEARDER_RAW));
							}
						} else if (charValue == 'M' ) { //0x4d ==> mouse
							//printf("\n get data :\\e[%c ==> Mouse \n", charValue);
							int32_t button = getc(stdin);
							int32_t xPos = getc(stdin);
							xPos -= 0x20;
							int32_t yPos = getc(stdin);
							yPos -= 0x20;
							
							int32_t bt=0;
							switch (button) {
								case 97:
									bt = 4;
									break;
								case 96:
									bt = 5;
									break;
								case 32:
									bt = 1;
									break;
								case 33:
									bt = 3;
									break;
							}
							//printf("     bt=%#x=%d \n", button, bt);
							//printf("     x=%d y=%d\n", xPos, yPos);
							if (bt == 4) {
								upDownOfsetFile(5);
							} else if (bt == 5) {
								upDownOfsetFile(-5);
							}
						}
					}
					
					break;
				// change the type of interpretation the file
				case 't':
				case 'T':
					nextType();
					break;
				// change the size of showing the file
				case 's':
				case 'S':
					nextTypeSize();
					break;
				// find the first ERROR
				case 'f':
				case 'F':
					// try to find the first error...
					first_Error = findFirstDiff();
					setOfsetFile((first_Error/16)*16 - 128);
					needRedraw();
					break;
				// find the first ERROR
				case 'a':
				case 'A':
					setOfsetFile(0);
					break;
				// go to the end of the file (File 1 and next File 2)
				case 'z':
				case 'Z':
					{
						UpdateFilesSize();
						static bool whichElement = false;
						if (whichElement == false) {
							whichElement = true;
							setOfsetFile((fileProp[0].size/16)*16 - 256);
						} else {
							whichElement = false;
							setOfsetFile((fileProp[1].size/16)*16 - 256);
						}
					}
					break;
				// Reload the 2 files
				case 'r':
				case 'R':
					CloseFiles();
					UpdateNumberOfRawAndColomn();
					CleanDisplay();
					OpenFiles();
					needRedraw();
					break;
				// Display Slot mode :
				case 'j':
				case 'J':
					setSlotDisplayMode((getSlotDisplayMode()==true)?false:true);
					needRedraw();
					break;
				case 'U':
					setSlotSize(getSlotSize()-9);
				case 'u':
					setSlotSize(getSlotSize()-1);
					needRedraw();
					break;
				case 'I':
					setSlotSize(getSlotSize()+9);
				case 'i':
					setSlotSize(getSlotSize()+1);
					needRedraw();
					break;
				case 'k':
				case 'K':
					setSlotSize(0);
					setSlotDisplayMode(false);
					needRedraw();
					break;
				// Add padding offset between left an right file
				case 'o':
					displayPaddingOffset(-1);
					break;
				case 'O':
					displayPaddingOffset(-16);
					break;
				case 'p':
					displayPaddingOffset(1);
					break;
				case 'P':
					displayPaddingOffset(16);
					break;
				// Clear the padding
				case 'm':
				case 'M':
					displayPaddingOffsetClear();
					break;
				case 'c':
				case 'C':
					AutoSetPadding();
					break;
				case 'h':
				case 'H':
					setHelpDisplay((getHelpDisplay()==true)?false:true);
					needRedraw();
					break;
			}
		}
	} else {