示例#1
0
文件: util.c 项目: gaorlov/DAAS
void util_LoadNote (char *note)
{
    char info[256];
    int i;

    i = 1;
    FillBytes (note, 0, 256, 0x00);
    ReadLine (fileHandle.analysis, info, 255); /* ========== */
    while (i)
    {
        ReadLine (fileHandle.analysis, info, 255);
        i = CompareBytes ("==========", 0, info, 0, 10, 0);
        if (i) Fmt (note, "%s[a]<%s\n", info);
    }
}
示例#2
0
/*----------------------------------------------------------------------------
------------------------------------------------------------------------------
.	Función: 	 GRA_Strcat
. 	Descripcion: Concatena todos los elementos que se pasaron como argumento a
.				 la función. Esto aplica únicamente para datos tipo string.
.	Argumentos:	 int iNoElementos | Contiene el número de elementos tipo
.									string que se han enviado.
.   Retorno:	 Apuntador tipo string
------------------------------------------------------------------------------
----------------------------------------------------------------------------*/
char *GRA_Strcat(int iNoElementos, ...)
{
	va_list pa;
	char	*pcCadena;
	static char	cSalida[6000];
	int		i=0;
	
	
	FillBytes(cSalida,0,6000,0);
	va_start(pa, iNoElementos);
	
	for (i=0;i<iNoElementos;i++)
	{
		pcCadena = va_arg(pa,char*);
		strcat(cSalida,pcCadena);
	}
	return cSalida;
}
示例#3
0
int CVIFUNC mouth_MakeIdleCommand (char ** command, double amp, double DCOffset,
								   double freq)
// Takes frequency in MHz, Offset V, Ampl Vpp
{
	int err=0;
	char buf[255];
	int pos=0;
	
	freq*=1000000.0;					// Convert to Hertz
	FillBytes (buf, 0, 255, 0);
	pos=Fmt(buf,"%s<OFFS %f;AMPL %fVP;FREQ %f",DCOffset,amp,freq);
	if (pos<0) {
		err=-1;
		command=0;
		goto Error;
	}
	(*command)=StrDup((char *)&buf);
	
Error:
	return (err?-1:0);
}
示例#4
0
/*		by the hint machine.	 		 */
static perTransformation  * TTHintTransformAllocation(  perFont * aPerFont )
{
	perVariation * aPerVari=&aPerFont->theVary	;			/* Specify the context as a variation */
	fsg_SplineKey		key;			/* Scaler internal execution state */
	tt_int32	       	perTransBlockSize;
	perTransformation*	theTrans;
 	tt_int32		sbitSpaceSize = 0,sbitHeadSize = 0;
	perTransformation   *localPerTransform;
 	tt_int32 cvtBytes, storageBytes, twilightBytes;
 	scalerError		theScalerResult= scalerError_NoError;
        tt_int32 stackBytes;
   
     
	/*  Allocate necessary storage.
	 	Also, setup pointers to each of the buffers. The tthinting/GX version
	 		Did'nt setup the pointers (only offsets. Why? Because in GX
	 		pointer blocks move around and need to be reset at various times.	 
	*/
		InitTheKeyByVary(&key, aPerVari);

#ifdef SBIT_SUPPORT
			sbitSpaceSize = (TheFont(&key)->usefulBitmaps)? sbit_CalculateTransformSpaceNeeded(&memContext): 0;
			sbitHeadSize = (TheFont(&key)->usefulBitmaps)? sizeof(sbitTransHeader): 0;
#endif
 	 	perTransBlockSize = 
	 	   sizeof(perTransformation)
				+(cvtBytes =  TheFont(&key)->cvtCount * (tt_int32)sizeof(F26Dot6))
				+(storageBytes=  TheFont(&key)->storageSize)
				+(twilightBytes=  TheFont(&key)->twilightZoneSize)
				+(stackBytes=  TheFont(&key)->stackSize)
				+ sbitSpaceSize
				+ sbitHeadSize;
		/*theTrans->twilightBytes=twilightBytes;  // MTE: we need these to clear to zero. */
#ifdef check_cvt_access_direction
			size += TheFont(&key)->cvtCount * sizeof(char);
#endif
				
	 	theTrans = (perTransformation*) 
	 		GetPerFontMemory( key.theFont, perTransBlockSize);
	     theTrans->storageBytes=storageBytes; /* MTE: we need these to clear to zero. */

	    theTrans->xPerVaryContext = (struct	perVariation * )aPerVari;
 	 	theTrans->scaledCvt.offset = sizeof(perTransformation);
		theTrans->storage.offset =  theTrans->scaledCvt.offset + cvtBytes;
 		theTrans->stackZone.offset = theTrans->storage.offset + storageBytes;
				theTrans->stackBytes=stackBytes;
		theTrans->twilightZone.offset = theTrans->stackZone.offset + stackBytes;
		theTrans->sbit.offset = theTrans->twilightZone.offset + twilightBytes;
		theTrans->sbitHead.offset = theTrans->sbit.offset + sbitSpaceSize;

#ifdef check_cvt_access_direction
				theTrans->cvtFlags.offset = theTrans->sbitHead.offset + sbitHeadSize;
				FillBytes((char*)theTrans + theTrans->cvtFlags.offset, TheFont(&key)->cvtCount, 0);
#endif
	
		
	 	/* MTE: now setup the pointers, because they will not change. */
 		/*		We use new data structures so that the debugger can access the values. */
  				theTrans->scaledCvt.ptr
  						=theTrans->scaledCvtTransPtr 
  									= (F26Dot6 *)( (char *) theTrans + theTrans->scaledCvt.offset);
  									
   				theTrans->storage.ptr
  						=theTrans->storageTransPtr
  									= (F26Dot6 *)( (char *)  theTrans + theTrans->storage.offset);
  									
 	   			theTrans->twilightZone.ptr
  						=theTrans->twilightTransPtr
  									=(F26Dot6 *) ( (char *) theTrans + theTrans->twilightZone.offset);
  			
 	   			theTrans->stackZone.ptr
  						=theTrans->stackTransPtr
  									=(F26Dot6 *)( (char *)  theTrans + theTrans->stackZone.offset);

 				/* Setup the remaining allocations. */
  				theTrans->sbit.ptr = (char*)theTrans + theTrans->sbit.offset;
				theTrans->sbitHead.ptr = (char*)theTrans + theTrans->sbitHead.offset;
#ifdef check_cvt_access_direction
					theTrans->cvtFlags.ptr = (char*)t + t->cvtFlags.offset;
#endif
						
	return( theTrans );		/* return new font cookie. */
 }
示例#5
0
void TTScalerTTHintTran(
 	 const scalerTransform *theTransform,	/* Specify a Input Transformation? */
	 perFont *aPerFont,						/* Specify the context  */
 	 perTransformation  *theTrans 			/* point to transform block. */
 	) 	 
{
	perVariation * aPerVari=&aPerFont->theVary	;			/* Specify the context as a variation */
	fsg_SplineKey		key;			/* Scaler internal execution state */
   	perTransformation   *localPerTransform;
      
  	InitTheKeyByVary(&key, aPerVari);
  	FillBytes((char*)theTrans + theTrans->twilightZone.offset, TheFont(&key)->twilightZoneSize, 0);
	/* MTE: Setup some flags and control variables */
	/*	make a guess as to what they should be.. */
 	theTrans->executeInstructions	= true; 
 			/* MTE: always true? BitTestToBoolean(theTransform->flags & applyHintsTransform); */
	theTrans->returnDeviceMetrics= false; 
			/* MTE: always false??BitTestToBoolean(theTransform->flags & deviceMetricsTransform); */
	theTrans->preProgramRan 	= false;
	theTrans->cvtHasBeenScaled 	= false;
	theTrans->verticalOrientation = false; 
		/*  MTE: What should this be?BitTestToBoolean(theTransform->flags & verticalTransform); */
	theTrans->methodToBeUsedIfPossible = outlineWillBeUsed;
	theTrans->methodToBeUsedOtherwise = outlineWillBeUsed;

	/*
	 *	Set baseMap to the concatenation of pointSize € resolution € userMatrix
	*/
	theTrans->pointSize = theTransform->pointSize;
	theTrans->pixelDiameter	= Magnitude(theTransform->spotSize.x, theTransform->spotSize.y);
		
    ResetMapping(&theTrans->stretchTransform);
    theTrans->stretchTransform.map[0][0] = 
        MultiplyDivide(theTransform->pointSize, theTransform->resolution.x, FIXEDPOINTSPERINCH);
    theTrans->stretchTransform.map[1][1] = 
        MultiplyDivide(theTransform->pointSize, theTransform->resolution.y, FIXEDPOINTSPERINCH);
    if (TheFont(&key)->fontFlags & USE_INTEGER_SCALING) {
        theTrans->stretchTransform.map[0][0] = RoundedFixed(theTrans->stretchTransform.map[0][0]);
        theTrans->stretchTransform.map[1][1] = RoundedFixed(theTrans->stretchTransform.map[1][1]);
    }

    MapMapping(&theTrans->stretchTransform,( const gxMapping *) theTransform->fontMatrixPtr );
    theTrans->globalGS.localParBlock.scanControl = DEFAULT_DROPOUT_MODE;

	if (theTrans->executeInstructions)
	{	
		boolean b1,b2,b2a;
		int theMinVal,minFix;

        /* We assume that transform here has only positive stretch
           (no rotation, skew or flips allowed at this point).

           Note that hinting code does NOT apply this transform to outline.
           It assumes that outline is already scaled and uses transform for reference. */

 	 	theMinVal = TheFont(&key)->minimumPixPerEm; 
 	 	if (theMinVal> kMinimumPPEMWhereHintsStillWork) 
		    theMinVal=kMinimumPPEMWhereHintsStillWork ;  
		minFix=ff(theMinVal)-(0x8000L); /* adjust for fixed point rounding. */
		if (			/* MTE: no perspective, ever ! MxFlags(&theTrans->transState.baseMap) == 	perspectiveState || */
            (theTrans->stretchTransform.map[0][0] < minFix )
					||
            (theTrans->stretchTransform.map[1][1] < minFix)
           )
        {
            /* turnOffHinting: */
				theTrans->globalGS.localParBlock.scanControl = 0x101ff;					/* hard-code dropout control ON */
				theTrans->returnDeviceMetrics = theTrans->executeInstructions = false;	/* Do nothing. */
                /* Note: hinting will be reenabled as soon as we update 
                   t->ttd and call TTScalerTTHintTran() */
 				goto exit;
			}
			
		 	theTrans->globalGS.instrDefCount 	= TheFont(&key)->IDefCount;
			theTrans->globalGS.pointSize		= FixedRound(theTrans->pointSize);
#ifdef use_engine_characteristics_in_hints
				theTrans->globalGS.engine[kGreyEngineDistance]	= 0;
				theTrans->globalGS.engine[kBlackEngineDistance]	= FixedToF26Dot6( (FIXEDSQRT2 - theTrans->pixelDiameter) );
				theTrans->globalGS.engine[kWhiteEngineDistance]	= -theTrans->globalGS.engine[kBlackEngineDistance];
				theTrans->globalGS.engine[kIllegalEngineDistance]	= 0;
#endif
			theTrans->globalGS.variationCoordCount			= TheFont(&key)->axisCount;
			theTrans->globalGS.hasVariationCoord			= TheVari(&key)->hasStyleCoord;
			
            {
                register fixed scaleX = theTrans->stretchTransform.map[0][0];
                register fixed scaleY = theTrans->stretchTransform.map[1][1];
				theTrans->globalGS.cvtScale =/*  MTE: Maximum(scaleX, scaleY); */
						scaleX>scaleY ? scaleX :scaleY;
			}
			SetGlobalGSDefaults(&theTrans->globalGS);  	 
 	}
   exit:;
  }
示例#6
0
int ENT_LimpiarDesplazamientoPrueba()
{
	FillBytes(cDesplazamientoPrueba,0,500,0);
	FillBytes(cNeutralActual,0,20,0);
	return 0;
}
示例#7
0
/*____________________________________________________________________________
	Fast fill routine.  Highly efficient for fills of as little as 16 bytes.
	
	Testing on PPC 604 shows that filling more than 4 bytes (one long) per loop
	iteration does not produce any measurable speed improvement.  That fact,
	coupled with the fact that using PGPByte fills, even on small chunks, is
	slow, means that unrolling it substantially is not a win.
  ____________________________________________________________________________*/
	void
pgpFillMemory(
	void *			buffer,
	const size_t	length,
	const uchar		fillChar)
{
	const PGPUInt32	kAlignSize			= sizeof(PGPUInt32);
	const PGPUInt32	kUnrollBytesPerIter	= 8;	/* must be power of 2 */
	uchar *			cur					= (uchar *)buffer;
	PGPUInt32		remaining			= length;
	
	pgpa((
		pgpaAddrValid(buffer, VoidAlign),
		pgpaAssert(length >= 0),
		pgpaAssert( length < 128 *1024UL * 1024UL )));
	
	if ( length >= kUnrollBytesPerIter )
	{
		PGPUInt32			fillPattern;
		PGPUInt32			oddballCount;
		PGPUInt32 *			curLong;
		PGPUInt32			numChunks;
		
		pgpAssert( length >= kAlignSize );
		
		/* create the fill pattern */
		pgpAssert( sizeof(fillPattern) == 4 * sizeof(fillChar) );
		fillPattern = fillChar;
		fillPattern |= (fillPattern << 8);
		fillPattern |= (fillPattern << 16);
		
		/* align address to kAlignSize PGPByte boundary */
		oddballCount	= kAlignSize - ( ((PGPUInt32)cur) % kAlignSize );
		pgpAssert( oddballCount <= remaining );
		FillBytes( cur, oddballCount, fillChar );
		remaining	-= oddballCount;
		cur			+= oddballCount;
		pgpAssert( remaining == 0 || (((PGPUInt32)cur) % kAlignSize) == 0 );
		
		/* fill all the chunks */
		curLong		= (PGPUInt32 *)cur;
		numChunks	= remaining / kUnrollBytesPerIter;
		while ( numChunks-- != 0 )
		{
			/* CAUTION:
				this loop must move a total of 'kUnrollBytesPerIter' bytes */
			*curLong++	= fillPattern;
			*curLong++	= fillPattern;
		}
		
		/* any remaining bytes get filled below... */
		cur			= (PGPByte *)curLong;
		remaining	&= ( kUnrollBytesPerIter - 1 );
	}
		
	FillBytes( cur, remaining, fillChar );
	
	/* verify that at least first and last bytes have been set properly */
	pgpAssert( length == 0 ||
		( ((PGPByte *)buffer)[ 0 ] == fillChar &&
		((PGPByte *)buffer)[ length - 1 ] == fillChar) );
}
示例#8
0
void FixLoadBsaTribunal()
{

        FillBytes(0x4785f7,0x38);//47AA37
        FillBytes(0x47861b,0xDC);
        FillBytes(0x47861C,0x90);
        FillBytes(0x47861D,0x90);
        FillBytes(0x47861E,0x90);
        FillBytes(0x47861F,0x90);
        FillBytes(0x478620,0x6A);
        FillBytes(0x478621,0x00);
        FillBytes(0x478628,0xE9);
        FillBytes(0x478629,0x80);
        FillBytes(0x47862A,0x00);
        FillBytes(0x47862B,0x00);
        FillBytes(0x47862C,0x00);
        FillBytes(0x4786a5,0x44);
        FillBytes(0x4786A8,0xE9);
        FillBytes(0x4786A9,0x65);
        FillBytes(0x4786AA,0xFF);
        FillBytes(0x4786AC,0xFF);
        FillBytes(0x4786AD,0x84);
        FillBytes(0x4786AE,0xC0);
        FillBytes(0x4786AF,0x75);
        FillBytes(0x4786B0,0x2C);
        FillBytes(0x4786B1,0xE9);
        FillBytes(0x4786B2,0x42);
        FillBytes(0x4786B3,0xFF);
        FillBytes(0x4786B4,0xFF);
        FillBytes(0x4786B5,0xFF);
        FillBytes(0x4786B6,0x90);
        FillBytes(0x4786B7,0x90);
        FillBytes(0x4786B8,0x90);
}
示例#9
0
void FixLoadBsaBM()
{

        FillBytes(0x47AA37,0x38);
        FillBytes(0x47AA5B,0xDC);
        FillBytes(0x47AA5C,0x90);
        FillBytes(0x47AA5D,0x90);
        FillBytes(0x47AA5E,0x90);
        FillBytes(0x47AA5F,0x90);
        FillBytes(0x47AA60,0x6A);
        FillBytes(0x47AA61,0x00);
        FillBytes(0x47AA68,0xE9);
        FillBytes(0x47AA69,0x80);
        FillBytes(0x47AA6A,0x00);
        FillBytes(0x47AA6B,0x00);
        FillBytes(0x47AA6C,0x00);
        FillBytes(0x47AAE5,0x44);
        FillBytes(0x47AAE8,0xE9);
        FillBytes(0x47AAE9,0x65);
        FillBytes(0x47AAEA,0xFF);
        FillBytes(0x47AAEC,0xFF);
        FillBytes(0x47AAED,0x84);
        FillBytes(0x47AAEE,0xC0);
        FillBytes(0x47AAEF,0x75);
        FillBytes(0x47AAF0,0x2C);
        FillBytes(0x47AAF1,0xE9);
        FillBytes(0x47AAF2,0x42);
        FillBytes(0x47AAF3,0xFF);
        FillBytes(0x47AAF4,0xFF);
        FillBytes(0x47AAF5,0xFF);
        FillBytes(0x47AAF6,0x90);
        FillBytes(0x47AAF7,0x90);
        FillBytes(0x47AAF8,0x90);
}
示例#10
0
void NoCDPatch()
{
  	if( mw_version == MW_BLOODMOON )
        {
         	FillBytes( 0x00416EC0, 0x74 );
         	FillBytes( 0x00416EC8, 0x74 );
         	FillBytes( 0x00416F43, 0x84 );
         	FillBytes( 0x00424D39, 0xB0 );
         	FillBytes( 0x00424D3A, 0x2E );
         	FillBytes( 0x00424D3B, 0x90 );
         	FillBytes( 0x00424D3C, 0x90 );
         	FillBytes( 0x00424D3D, 0x90 );
         	FillBytes( 0x00424EE0, 0xB0 );
         	FillBytes( 0x00424EE1, 0x2E );
         	FillBytes( 0x00424EE2, 0x90 );
         	FillBytes( 0x00424EE3, 0x90 );
         	FillBytes( 0x00424EE4, 0x90 );
         	FillBytes( 0x0077797A, 0x5C );
         	FillBytes( 0x007779AE, 0x5C );
        }
}
示例#11
0
int post(int run)
{
	int ret_val;
	int test_item, index;
	int byte_in_queue ;	 // old: int byte_in_queue ;
	char portname[6];
	//char hwID_limit[5] = {" "} ;  
	char pos_capture[3000]; 
	//char char_read ;
	double begin, end ;
	float testtime ;
	

	FillBytes(portname, 0, 5, 32) ;
	portname[5] = '\0' ;
	sprintf(portname,"COM%d",g_dev_serial_port) ;
	
	//test_item = InsertTestItem("RESET test", NULL, NULL, NULL, NULL); 
	
	ret_val = ConfirmMessage ("Turn unit back on", "Press the Power button and the Reset button. Did the three LEDs flash?"); 
	/********************************************************************************
	if (ret_val == YES)
	  
		UpdateTestItem(test_item, "RESET test", NULL, NULL, NULL, "PASS") ;
	else

		UpdateTestItem(test_item, "RESET test", NULL, NULL, NULL, "FAIL");  
		
	****************************************************************************/
	Delay(1.0) ;
	
	//test_item = InsertTestItem("Power On Self Test",NULL,NULL,NULL,NULL); 
	begin = Timer() ; 
	 
	FillBytes(pos_capture, 0, 2999, 32);
	pos_capture[2999] = '\0' ;
	test_item = InsertTestItem("Opening device port",NULL,NULL,NULL,NULL); 
	ret_val = OpenComConfig (g_dev_serial_port, portname, 115200, 0, 8, 1, 512, 512);
	if (ret_val < 0) 
	{
		UpdateTestItem(test_item, "Opening UUT port", "ERROR", NULL, NULL, "FAIL") ;
		return FAILURE ;
	}
	else
		UpdateTestItem(test_item, "Opening UUT port", NULL, NULL, NULL, "PASS") ; 
	if (!run)
    {
		ComWrtByte (1, 'n');
		
	}	
	else
	{
		ComWrtByte (1, 'Y'); 
		
		test_item = InsertTestItem("Power On Self Test",NULL,NULL,NULL,NULL); 
	
		SetComTime(g_dev_serial_port, 5.0) ;
		FlushInQ(g_dev_serial_port) ;
		FlushOutQ(g_dev_serial_port) ;
		//ComRd(g_dev_serial_port, pos_capture, 3000) ;
		for (index = 0; index < 2999; index++)
		{
			byte_in_queue = ComRdByte(g_dev_serial_port) ;
			if (byte_in_queue < 0) 
				break ;  // no more byte to read
			if ( (byte_in_queue == CR) || (byte_in_queue == LF) )
				pos_capture[index] = 32 ;
			else
				pos_capture[index] = (char) byte_in_queue;
		}	  // for all chars in COM buffer
	
	
		index = FindPattern(pos_capture, 0, -1, "failed", 0, 0) ;
		if (index > 0) 
		{
			   //test_item = InsertTestItem("Power On Self Test",NULL,NULL,NULL,"FAILED");  
			   UpdateTestItem(test_item,NULL,NULL,NULL,NULL,"FAIL"); 
			   return FAILURE ;
		} 
		else
				//test_item = InsertTestItem("Power On Self Test",NULL,NULL,NULL,"PASS"); 
				UpdateTestItem(test_item,NULL,NULL,NULL,NULL,"PASS"); 
	}   // else, perform post test
	
	return SUCCESS ;
}