Ejemplo n.º 1
0
void
vt100_resetParms()
{
	vt100_set_errorCode(0);                     // init to zero at run-time
	vt100_clear_errorText();
	
	//  set the "Reset/Power-Up Conditions" from the ATC 5.2b spec, page 7-4
	vt100_set_autoRepeat( 0 );
	vt100_set_autoWrap( 0 );
	vt100_set_autoScroll( 0 );
	vt100_set_currentAttribs( NO_ATTRIBUTES );  // clear Reverse Video, Character Blink and Underline Attribs, + Special Char
	
	vt100_set_cursorBlink( 1 );      // Turn on Cursor and its blinking state 
	vt100_set_cursorState( 1 ); 
	vt100_set_cursorPos( 1, 1);    // cursor at top left 
	
	vt100_clear_specialChars();    // clear all down to 0 bits which should be a blank char
	
	// set the initial tab stops at 9, 17, 25, 33 per ATC 5.2b spec, page 7-4 
	vt100_set_tabStop( (int16_t) ( 9 - 1) );      // our array starts with 0 
	vt100_set_tabStop( (int16_t) (17 - 1) ); 
	vt100_set_tabStop( (int16_t) (25 - 1) ); 
	vt100_set_tabStop( (int16_t) (33 - 1) ); 

	vt100_set_backLightTimeout( (int16_t) 6 );   // set timeout to 60 secs 
	vt100_set_backLight( (int16_t) 0);           // turn off the backlight 

	return;
	
}   // end - vt100_resetParms()
Ejemplo n.º 2
0
int16_t 								// no return value - provided by vt100_get_error()
vt100_start(const char *portName, int16_t screenRows, int16_t screenCols )
{
int16_t res = 0;                        // holds results from thread create call 

#if DEBUG_ON
	printf("\n vt100_start for port name %s \n ", portName);
#endif
	
	numRows = screenRows;
	numCols = screenCols;
	
	vt100_set_cursorPos((int16_t) 1, (int16_t) 1);   // set to home position (external home is 1, 1)
	
	vt100_resetParms();            // reset all parameters and error codes, etc.
	
    //   vt100_clearVD();               // can't clear display until malloc'd - do in the thread after malloc 

	
	thread_data.thr_threadId     = ++threadNum;   //  notice if it is called more than once
	thread_data.thr_DisplayPtr   = &vDisplay;
	thread_data.thr_DisplayRows  = numRows;
	thread_data.thr_DisplayCols  = numCols;
	thread_data.thr_portName     = portName;
	
	
	//  do all work in a thread so control can return to calling program
	res = pthread_create(&thread_descriptor, NULL, (void *) vt100_thread, &thread_data);
	if( res != 0 )
	{
		vt100_set_errorCode( ERR_10_THREAD_CREATE );
#if DEBUG_ON
		printf("\n\n vt100_lib: Thread Create error %d\n", res);
#endif
	}
	
	sleep(1);
	
	
	return( vt100_get_errorCode() );
	
}  // end vt100_start()
Ejemplo n.º 3
0
int16_t						// no return value - provided by vt100_getError()
vt100_thread(THREAD_ARGS *args )
{
// char nextChar;					// input character from Serial port
// int16_t fd = 0;						// file descriptor for Serial Port open, read, write
const char *portName;
VIRTUAL_DISPLAY *pVDisplay;		    // pointer to virtual Display
char *pTextBuffer = NULL;			//  malloc'd text area
char *pAttribsBuffer = NULL; 		//  malloc'd attribs area
char **pTextPtrsBuffer = NULL;      //  malloc'd text pointers (rows) area
char **pAttribsPtrsBuffer = NULL;   //  malloc'd attribs pointers (rows) area 
int16_t rows         = 0;
int16_t cols         = 0;
int16_t bumpUpCols   = 0;
int16_t numBytes     = 0;
int16_t numPtrBytes  = 0;
int16_t rowLength    = 0;
int16_t i            = 0;           // array loop variable 

	//   unpack the two most crucial parameters - rows & cols - from args 
	rows = args[0].thr_DisplayRows;
	cols = args[0].thr_DisplayCols;
	//  have to allocate space on even pointer boundaries for rows 
	bumpUpCols = cols % sizeof( char *);    // see if number of columns is on a pointer boundary
	if( bumpUpCols) 
		cols += ( sizeof(char *) - bumpUpCols);  // if not (non-zero remainder), force to next boundary

	numBytes = rows * cols;
	rowLength = cols * (sizeof(char));

#if DEBUG_ON
	printf("\n\nvt100_THREAD %d is STARTING", args[0].thr_threadId);
	printf("\n  - on port %s with display rows %d and cols %d, pointer size is %d bytes", 
			  args[0].thr_portName, rows, cols, sizeof( char *) ); 
	printf("\n malloc() %d bytes each for Virtual Display text & data arrays",
			     numBytes );
#endif
	
    // 
	//   Concept - since screen size can vary in number of row or columns,
	//      we have dynamic arrays for the text display and the attributes display
	//      The Virtual Display for text is a list of pointers - 1 per line, and 
	//       a similar list of pointers for the attributes - 1 pointer per line 
	// 
	
	
	/*    
	 *   First - malloc() all Virtual Display data area and set up pointer arrays   
	 *   
	 */
	pTextBuffer    = (char *) malloc(numBytes); 
	pAttribsBuffer = (char *) malloc(numBytes); 

	numPtrBytes    = numRows * (sizeof (char *));
	pTextPtrsBuffer = (char **) malloc(numPtrBytes );
	pAttribsPtrsBuffer = (char **) malloc(numPtrBytes );
	if( (pTextBuffer == NULL)  || (pAttribsBuffer == NULL) || (pTextPtrsBuffer == NULL) 
			|| (pAttribsPtrsBuffer == NULL) ) 
	{
#if DEBUG_ON & DEBUG_MALLOC
		printf("\n\nvt100_thread: malloc probs: numBytes %d,  numPtrBytes %d ", numBytes,
				   numPtrBytes );
		printf("\n Ptrs are: %0x, %0x, %0x, %0x", (unsigned int) pTextBuffer, 
				   (unsigned int) pAttribsBuffer, (unsigned int) pTextPtrsBuffer,
				   (unsigned int) pAttribsPtrsBuffer );
#endif
		return( vt100_set_errorCode(ERR_09_MEM_ALLOC) );
	}
	
#if DEBUG_ON & DEBUG_THREAD
	printf("\n\nvt100_thread: malloc results: numBytes %d,  numPtrBytes %d ", numBytes,
			   numPtrBytes );
#endif
	
	//  init the Virtual Display with the buffer addresses & row pointer arrays
	//   buffer & array addresses used for later free() calls 
	vDisplay.pText        = pTextPtrsBuffer;
	vDisplay.pAttribs     = pAttribsPtrsBuffer;
	vDisplay.pTextBuf     = pTextBuffer;
	vDisplay.pAttribsBuf  = pAttribsBuffer;
	vDisplay.ptrsBufSize  = numPtrBytes;
	vDisplay.charsBufSize = numBytes;
	
	//  set up the pointer arrays from malloc'd memory 
	for( i = 0; i < rows ; i++ )   // distribute the memory into pointer arrays 
	{    
		pTextPtrsBuffer[i] = pTextBuffer;
		pTextBuffer += rowLength;
		pAttribsPtrsBuffer[i] = pAttribsBuffer;
		pAttribsBuffer += rowLength;
#if DEBUG_ON & DEBUG_MALLOC 
		printf("\n row %d: TextPtr: %0x, Attribs Ptr: %0x,", i+1, (unsigned int) pTextPtrsBuffer[i], 
				(unsigned int)  pAttribsPtrsBuffer[i] );
#endif
		
	}
	
	
#if DEBUG_ON & DEBUG_MALLOC
		printf("\n vDisplay struct: TextPtrBuffer: %0x, AttribsPtrBuffer: %0x,", 
				(unsigned int) pTextPtrsBuffer, (unsigned int) pAttribsPtrsBuffer );
		printf("\n==========================================================");
		for( i = 0; i < rows; i++ ) 
		{
			printf("\n %d: text %0x,  attrib %0x ", i, (unsigned int) vDisplay.pText[i], 
					(unsigned int) vDisplay.pAttribs[i]);
		}
#endif
	
	
	// check if fpui port is present and can be opened 
	
	
	portName  = args[0].thr_portName; 
	pVDisplay = args[0].thr_DisplayPtr;
	
	if( portName == NULL )   // no fpui present - can't read any chars
	{
		while(!vt100_allDone)
		{
#if DEBUG_ON & DEBUG_THREAD
			printf("T%d, ", ++counter); 
			if( counter % 10) printf("\n");
#endif 
			sleep(1);    // wait 1secs - allow asynch call to process file input 
		}
	}
	else     
	{        
		// we are given port to open like "/dev/fpi" 
		// we will open the port and process characters received to the VT 
		
#if DEBUG_ON
    //  clear the display and show the results 
	// do compare on the display that was just cleared with the local dump file 
	//  this must be removed for delivery - should not be accessed from the library routines
int16_t result = 0;
		vt100_clearVD();        // start clean & clear before text input 
		result = vt100_compareVD("display.clear");
		printf("\nvt100_thread: compareVD: display.clear = %d \n", result);
		vt100_showVD(stdout, "After call to vt100_clearVD");
#endif
	
	
		if( (fdSerialPort = openSerialPort(portName) ) <= 0 ){   // Error on open
#if DEBUG_ON
			printf("\n ERR_05_PORT_OPEN; received %d trying to open %s \n", fdSerialPort, portName);
#endif
			vt100_set_errorCode(ERR_05_PORT_OPEN); 
			threadErrorCode = ERR_05_PORT_OPEN;
			vt100_allDone = TRUE;
		}
	
#if DEBUG_ON
		printf("\nTHREAD %d ready to read input from %s ... ", 
					args[0].thr_threadId, portName);
		printf("\n Please start entering input:\n  (terminate with a 'z' on a new line}\n");
#endif
	
		while(!vt100_allDone ) 
		{
			vt100_processInput( fdSerialPort, NULL, pVDisplay );     //  read Serial Port and process forever - no line buffer here
		}  // end forever while loop 
		
		// all done - close the serial port and exit
		
		closeSerialPort(fdSerialPort);
	
		// vt100_dumpVD("dump.thread.after", "thread after key inputs");
	
	}  // end - good serial port 
	
	
#if DEBUG_ON
	printf("\n\n vt100 - exiting thread # %d", args[0].thr_threadId );
#endif
	
	sleep(1);
	
	//  free the malloc'd memory in reverse order
	free( vDisplay.pAttribs );
	free( vDisplay.pText );
	free( vDisplay.pAttribsBuf );	
	free( vDisplay.pTextBuf  );
	
	pthread_exit(&threadErrorCode);   // return error code to the original start function
	
	
	//   return (errorCode);
	
	
}  // end vt100_thread()
Ejemplo n.º 4
0
int16_t 
vt100_compareVD(const char *pFileName)
{
int16_t i=0, j=0;                             // for loops parsing strings of text, etc.
char lineBuffer[LINE_BUFFER_SIZE];            // Vir. Display (40 chars wide) allocate extra	
char *ptrSC = NULL;                           // pointer to play with special chars arrays 
int16_t numSpecChars = 0;                     // count # of defined Special Chars with non-zero bitmaps
int16_t numSpecCols  = 0;                     // number of vertical bitmap columns in this special character 
int16_t specCharNumber = 0;                   // which special character are we processing 
int valueSC = 0;                              // pull value from the array for compare 
int16_t errorSC = 0;                          // flag an SC error 
int16_t compareStage = COMPARE_TEXT;          // 8 stages of compares: 1st one: text, then attribs, tabs, parms, cursor, Spec chars
int16_t compareResult = 0;
int row = 0;                                  // for text and attribute compares 
int col = 0;                                  //   "   "       "          "
int err = 0;                                  // for file I/O error returns 
static FILE *pFile;                           // FILE Handle 
static VIRTUAL_DISPLAY *VD_ptr;               // our VIRTUAL DISPLAY 
int16_t lineCounter = 0; 
char **pTextArray = vDisplay.pText;           // set up the malloc'd data area pointers 
char **pAttribsArray = vDisplay.pAttribs;
char *pRowText = NULL;
char *pRowAttribs = NULL;
USERINT_PARAM *pOtherParms = NULL;
int   fileParmValue = 0;
char errorBuffer[100] = { 
		'\0','\0','\0','\0','\0','\0' };  	  // buffer for error string generation - put a few zero bytes to show not used yet


	VD_ptr = &vDisplay;
	
	if( (pFile = fopen(pFileName, "r" )) == NULL)
	{
		return( vt100_set_errorCode(ERR_01_FILE_OPEN) );
	}
	
	//  Concept - like a state machine with 5 stages:
	//     1.  Compare the text array 
	//     2.  Compare the attributes array   
	//     3.  Compare the Tabs array 
	//     4.  Compare the other data parameters
    //     5.  Compare the Cursor Position (row and column)
	//     6.  Compare the Special Char # of columns per SC array
	//     7.  Compare the Special Character Bitmaps per each SC
	//     8.  Compare Completed OKAY!
	//
	//pthread_mutex_lock(&vDisplay.mutex);
	usleep(11000);
	while ( compareStage < COMPARE_COMPLETE  )
	{
		    // read a line at a time to compare with the VD
		if( fgets(lineBuffer, LINE_LENGTH, pFile ) == (char *) 0 )
		{    // end of file
			break;
		}
 
		if( lineBuffer[0] == '#' )   // bypass comment lines 
		{
#if DEBUG_ON & DEBUG_PARM_MATCH
			if( compareStage == COMPARE_PARMS )
				printf("\n %s", lineBuffer);
#endif
			continue;     // bypass comments - get next line into buffer 
		}
		
		lineCounter++;   //  only counting good data lines and not comments 

#if DEBUG_ON & DEBUG_PARM_MATCH
// #if DEBUG_ON & DEBUG_SPECIAL
		printf("\n %d: %s", lineCounter, lineBuffer);
#endif
		
		if( (compareStage == COMPARE_TEXT)  || (compareStage == COMPARE_ATTRIBS) )
		{   //  Compare the Text are and the Attributes row by row first 
			// compare the file's line to the display row (text or attributes)
			if( compareStage == COMPARE_TEXT )
			{
				pRowText = pTextArray[row];
				compareResult = compareRow(pRowText, lineBuffer, numCols);
			
			}
			else   // compare stage == COMPARE_ATTRIBS
			{
				pRowAttribs = pAttribsArray[row];
				compareResult = compareRow(pRowAttribs, lineBuffer, numCols);
			}

			if( compareResult != 0 )
			{   // this row did not compare 
				vt100_set_errorCode(ERR_11_VD_MATCH_ERR);
				if(compareStage == COMPARE_TEXT){
				   sprintf(errorBuffer,"ERR_11: VD Text differs: row # %d: %s ", row, 
						   pRowText);
				}
				else {
				   sprintf(errorBuffer,"ERR_11: VD Attrib differs: row # %d: %s ", row, 
						   pRowAttribs);
				}
#if DEBUG_ON
				printf("\n %s \n", errorBuffer);
#endif
				vt100_set_errorText(errorBuffer);
				break;
			}
			
				// set up for next row if not at end of text 
			if( row == numRows - 1) 
			{   // just processed the last row - if text, switch to attribs
				if( compareStage == COMPARE_ATTRIBS )
				{   // all done processing attributes - now compare other data items 
					compareStage = COMPARE_TABS;
				}
				else 
				{  // switch over to the attributes array compare for rows & columns  
					compareStage = COMPARE_ATTRIBS;
					row = 0;
				}
			}
			else if( row  < (numRows -1))
			{  // do next row 
				row++;
			}
			else 
			{   /// should never ever hit here 
				;
#if DEBUG_ON
				printf("\n vt100_compareVD:  out of bounds error - row # %d, compareStage = %d \n",
						      row, compareStage);
#endif
			}
			
		}  //  end - text & attributes area - stages 1 & 2 
		
		else if( (compareStage > COMPARE_ATTRIBS) & (compareStage <= COMPARE_CURSOR) )
		{	       // Compare Tabs and other parameters - stages 3, 4 & 5
			if(compareStage == COMPARE_TABS)  
			{          //  compare Tabs array 
#if DEBUGON & DEBUG_TABS
				printf("\n TABS: file %s \n     : VD   %s \n", lineBuffer, tabStops);
#endif
				for(col = 0; col < numCols ; col++ )
				{
					if(lineBuffer[col] != tabStops[col])
					{
						
						vt100_set_errorCode(ERR_11_VD_MATCH_ERR);
						sprintf(errorBuffer,"ERR_11: VD TabStops Differ at col %d: %s ", col, 
									tabStops);
						vt100_set_errorText(errorBuffer);
						compareResult = 1;     // mismatch 
						break;
					}
				}
				
				if( compareResult == 0 ){   // good compare on Tabs 
					pOtherParms = vt100_get_otherParameters();
					compareStage = COMPARE_PARMS;
					
				}
				else {
					break;
				}

			}    // endif - compare Tabs
							
			else if(compareStage == COMPARE_PARMS )
			{    //  OTHER PARAMETERS COMPARE 
				 // compare the other parameters of the VD against the file values 
				if( pOtherParms->pUI_value == NULL )   // at the end of the list? 
				{
					//     compareResult = 0;      // should already be = 0 ; good result - all values compare okay
					compareStage = COMPARE_CURSOR;				}
				else
				{
					sscanf(lineBuffer, "%d", &fileParmValue);
#if DEBUG_ON & DEBUG_PARM_MATCH
					printf("\nPARAM %s: VD value: %d, file value: %d", 
							pOtherParms->pUI_name, (int) pOtherParms->pUI_value[0], (int) fileParmValue);
#endif	
					if(pOtherParms->pUI_value[0] != fileParmValue ) 
					{
						vt100_set_errorCode(ERR_11_VD_MATCH_ERR);
						sprintf(errorBuffer,"ERR_11: VD Param %s differs: VD: %d ; file value: %d:", 
								pOtherParms->pUI_name,  (int) pOtherParms->pUI_value[0], (int) fileParmValue);
						
#if DEBUG_ON & DEBUG_PARM_MATCH
						printf("\n PARAM miscompare on %s : errorBuffer: %s \n", pOtherParms->pUI_name,
								       errorBuffer);
#endif
						vt100_set_errorText(errorBuffer);
						
						compareResult = 1;        // mismatch in parameter compare 
						break;
					}
					else {
#if DEBUG_ON & DEBUG_PARM_MATCH
						printf("\n vt100_compare: VD parameter: %s value %d matches file value: %d \n", 
										pOtherParms->pUI_name, (int) pOtherParms->pUI_value[0],
										     fileParmValue);
#endif
						pOtherParms++;    // go to next parameter 
					}
					
				}  // end - else 
				
			}   // end if - compare other Parameters 
			

#if DEBUG_ON & DEBUG_PARM_MATCH
			printf("\nvt100_compare - lineCounter = %d , compareStage = %d, lineBuffer: %s ", 
					       lineCounter, compareStage, lineBuffer );
#endif
			
			
			//  go right into compare cursor because the line has already been read 
			//    and we ran out of parameters (reached the "NULL, NULL" entry! 
			if (compareStage == COMPARE_CURSOR)    
			{
				sscanf(lineBuffer, "%d,%d", &row, &col);
				if( (row  != cursorPos.cp_row +1 ) || (col != cursorPos.cp_col +1) ) 
				{
					vt100_set_errorCode(ERR_11_VD_MATCH_ERR);
					sprintf(errorBuffer,"ERR_11: VD Cursor Position differs: VD: %d,%d ; file value: %d, %d ", 
							cursorPos.cp_row + 1, cursorPos.cp_col + 1, row, col);
#if DEBUG_ON & DEBUG_PARM_MATCH
					printf("\n vt100_compareVD: %s ", errorBuffer);
					printf("\n     lineBuffer is: %s", lineBuffer);
#endif

					vt100_set_errorText(errorBuffer);

#if DEBUG_ON 
					printf("\n vt100_compareVD: get ErrorText returns: %s \n", vt100_get_errorText() );
#endif
					
					compareResult = 1;        // mismatch in parameter compare 
					break;                    // stop the insanity - get out now!
				}
				else
				{
					compareStage = COMPARE_SPEC_SIZES;  // have to absorb the "Saved Cursor Pos" line 
					                                    // not a compared value 
				}
				
			}  // endif - compare cursor position 
			
		}   // endelse - Tabs, Parms & Cursor 
		
		else if( compareStage > COMPARE_CURSOR )
		{
		
			if(compareStage == COMPARE_SPEC_SIZES )
			{
				// have to absorb the first line (saved cursor position)
				// our lines start out with a space character 
				if( lineBuffer[0] == ' ')    // first time through will see a 1,1 saved cursor and will bypass
				{
					ptrSC        = &lineBuffer[3];
					errorSC      = 0; 
					numSpecChars = 0;
				
#if  DEBUG_ON & DEBUG_SPECIAL
					printf("\n Compare Special array column sizes:  %s", lineBuffer);
#endif
					
					for(i = 0; i < NUMBER_OF_SPEC_CHARS; i++)
					{
						sscanf(ptrSC, "%1d,", &valueSC);
						if( valueSC != specialCharColumns[i] )   // are they the same size (# of vertical columns?)
						{
							errorSC = TRUE;
							vt100_set_errorCode(ERR_11_VD_MATCH_ERR);
							sprintf(errorBuffer,"ERR_11: VD SpecChar %d differs in # of cols.  VD: %d ; file value: %d", 
									i+1, specialCharColumns[i], valueSC );
						
#if DEBUG_ON & DEBUG_SPECIAL
							printf("\n vt100_compareVD: %s ", errorBuffer);
							printf("\n     lineBuffer is: %s", lineBuffer);
#endif
	
							vt100_set_errorText(errorBuffer);
							break;
						}
						else
						{
							if( specialCharColumns[i] > 0 ) {
								numSpecChars++;
							}
							ptrSC += 3;        /// move to next col value - 1 digit, 1 comma, 1 space char
							
						}
					}    // end - for loop on sizes (# of cols) 
					
					if( errorSC)
					{
						compareResult = 1;
						break;
					}
					else
					{
						if( numSpecChars > 0 ) {
							compareStage = COMPARE_SPEC_BITMAPS;
						}
						else {
							compareStage = COMPARE_GRAPHIC_MODE;
						}
							
					}
				}
#if DEBUG_ON & DEBUG_SPECIAL
				printf("\n COMPARE:  - number of special characters found = %d : %s ",
							numSpecChars, lineBuffer);
#endif
			
			
			}   // endif - COMPARE_SPEC_SIZES
			
			else if( compareStage == COMPARE_SPEC_BITMAPS )     // COMPARE the Bit-Mapped Special Chars
			{
				errorSC = FALSE;     
				specCharNumber = (int16_t) (lineBuffer[3]  - (uint8_t) 0x30);
				numSpecCols    = (int16_t) (lineBuffer[9] - (uint8_t) 0x30);
				ptrSC = &lineBuffer[13];
#if DEBUG_ON & DEBUG_SPECIAL
				printf("\n BITMAP SC # %d, # cols %d:\n line:  %s ", specCharNumber, numSpecCols, lineBuffer);
#endif	

				for(j = 0; j < numSpecCols; j++)
				{
					sscanf(ptrSC, "%d", &valueSC);
					if( valueSC != specialChars[specCharNumber - 1][j] )
					{
						errorSC = TRUE;
						vt100_set_errorCode(ERR_11_VD_MATCH_ERR);
						sprintf(errorBuffer,"ERR_11: VD SpecChar %d bitmap mismatch; Pn col# %d.  VD: %d ; file value: %d", 
								specCharNumber, j+1, specialChars[specCharNumber - 1][j], valueSC );
						
#if DEBUG_ON & DEBUG_SPECIAL
						printf("\n :::::::::::::::::::::::::::::::::::::::::::");
						printf("\n Bitmap miscompare on col # %d: err msg: %s ", j+1, errorBuffer);
						printf("\n Special Char # %d col value is %d [0x%02x] ", specCharNumber, 
								specialChars[specCharNumber - 1][j], specialChars[specCharNumber - 1][j] );
						printf("\n     lineBuffer is: %s", lineBuffer);
						printf("\n :::::::::::::::::::::::::::::::::::::::::::");
#endif

						vt100_set_errorText(errorBuffer);
						break;
					
					}
					else
					{
						ptrSC += 4;        /// move to next col value - 3 digits plus 1 space char 
						
					}
				}   // end for loop on bitmaps 
				
				if( errorSC )
				{
					compareResult = 1;
					break;
				}
				else
				{
					numSpecChars--;
					if( numSpecChars <= 0 )
					{
						compareStage = COMPARE_GRAPHIC_MODE;
					}
				}
			}
			else if (compareStage == COMPARE_GRAPHIC_MODE) {
				sscanf(lineBuffer, "%x", &fileParmValue);
				if( graphicModeFlags != fileParmValue ) {
					vt100_set_errorCode(ERR_11_VD_MATCH_ERR);
					sprintf(errorBuffer,"ERR_11: VD Graphic Mode differs: VD: %02x ; file value: %02x:", 
						(int) graphicModeFlags, (int) fileParmValue);
					vt100_set_errorText(errorBuffer);
					compareResult = 1;        // mismatch in parameter compare 
#if DEBUG_ON 
					printf("\n vt100_compareVD: get ErrorText returns: %s \n", vt100_get_errorText() );
#endif
					break;
				} else {
					compareStage = COMPARE_COMPLETE;
				}
			}
		}   // endif - compareStage > COMPARE_CURSOR  
	
	}   // end - while ( 1) 
	//pthread_mutex_unlock(&vDisplay.mutex);
	
	if( compareStage != COMPARE_COMPLETE)   // check for incomplete "compare file" without all the "stages"
	{
		if( errorBuffer[0] == '\0')         // not here because of a break on a prior error 
		{
			vt100_set_errorCode(ERR_12_COMPARE_FILE);
			sprintf(errorBuffer,"ERR_12: compare file '%s' problem - premature termination of compares.  File may be incomplete.",
					     pFileName);
			vt100_set_errorText(errorBuffer);
			compareResult = 1;        // mismatch in parameter compare 
		}
	}
	
	if( (err = fclose(pFile ))!= 0 )
	{
#if DEBUG_ON & DEBUG_FILE_IO
		printf("\n vt100_compareVD - file close error %d \n", err );
#endif
		return( vt100_set_errorCode(ERR_04_FILE_CLOSE) );
	}

	return(compareResult);
	
}   //  end  vt100_compareVD()