develop/Logical/Libraries/ac_invlib/ac_invparameter.c
char *find_value_constant( char *name, UINT value, ac_inv_DriveType drive_type )
{
	int index;
	static char s[20];
	char sign = 'u';

	acpireg *regs;

	switch( drive_type )
	{
		default: 	
			regs = p86reg; 
			break;
		
		case ACPiDriveType_P84: 
			regs = p84reg; 
			break;

		case ACPiDriveType_P74: 		
			regs = p74reg; 
			break;

		case ACPiDriveType_P76:
		case ACPiDriveType_P66: 	
			regs = p76reg; 
			break;
	}


	index = find_parameter( name, 0, 0, drive_type );
	if( index >= 0 )
	{
		int i = 0;
		sign = regs[index].sign;
		/* translate parameter value to enumeration constant */
		if( regs[index].enu )   /* are constants defined ? */
		{
			while( regs[index].enu[i].name )
			{
				if( regs[index].enu[i].value == value )
				{
					return( regs[index].enu[i].name );  /* return enumerated name */
				}
				++i;
			}
		}
	}
	if( sign == 'u' )
		m_ltoa( value , s, 10 );  /* return numeric value */
	else
		m_ltoa( (INT) value, s, 10 );
	return s; /* not found or no constant defined */

}
/* -----------------------------------------------------------------------------------
 	returns the enumerated name of the parameter's value
   -----------------------------------------------------------------------------------
*/
returns the enumerated name of the parameter's value
returns the enumerated name of the parameter ' s value
char *find_value_constant( char *name, UINT value, ac_inv_DriveType drive_type )
{
	int index;
	static char s[20];
	char sign = 'u';
	acpireg *regs;
	switch( drive_type )
	{
		default: 	
			regs = p86reg; 
			break;
		case ACPiDriveType_P84: 
			regs = p84reg; 
			break;
		case ACPiDriveType_P74: 		
			regs = p74reg; 
			break;
		case ACPiDriveType_P76:
		case ACPiDriveType_P66: 	
			regs = p76reg; 
			break;
	}
	index = find_parameter( name, 0, 0, drive_type );
	if( index >= 0 )
	{
		int i = 0;
		sign = regs[index].sign;
		if( regs[index].enu )   
		{
			while( regs[index].enu[i].name )
			{
				if( regs[index].enu[i].value == value )
				{
					return( regs[index].enu[i].name );  
				}
				++i;
			}
		}
	}
	if( sign == 'u' )
		m_ltoa( value , s, 10 );  
	else
		m_ltoa( (INT) value, s, 10 );
	return s; 
}
char * find_value_constant ( char * name , UINT value , ac_inv_DriveType drive_type ) { int index ; static char s [ 20 ] ; char sign = ' ' ; acpireg * regs ; switch ( drive_type ) { default : regs = p86reg ; break ; case ACPiDriveType_P84 : regs = p84reg ; break ; case ACPiDriveType_P74 : regs = p74reg ; break ; case ACPiDriveType_P76 : case ACPiDriveType_P66 : regs = p76reg ; break ; } index = find_parameter ( name , 0 , 0 , drive_type ) ; if ( index >= 0 ) { int i = 0 ; sign = regs [ index ] . sign ; if ( regs [ index ] . enu ) { while ( regs [ index ] . enu [ i ] . name ) { if ( regs [ index ] . enu [ i ] . value == value ) { return ( regs [ index ] . enu [ i ] . name ) ; } ++ i ; } } } if ( sign == ' ' ) m_ltoa ( value , s , 10 ) ; else m_ltoa ( ( INT ) value , s , 10 ) ; return s ; }
returns the enumerated name of the parameter's value
returns the enumerated name of the parameter ' s value
/* translate parameter value to enumeration constant */ /* are constants defined ? */ /* return enumerated name */ /* return numeric value */ /* not found or no constant defined */