Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Help speed binary field conversion
Message
De
25/08/2005 23:39:27
 
 
À
25/08/2005 07:22:50
Information générale
Forum:
Visual FoxPro
Catégorie:
Client/serveur
Versions des environnements
Visual FoxPro:
VFP 7
Divers
Thread ID:
01043345
Message ID:
01044185
Vues:
15
Hi,

an FLL function like this should be unbeatable when it comes to performance .. not tested .. just converted from your posted code ..
void FuctionNameAsYouLikeIt(ParamBlk *parm)
{

	Value vRetVal;
	unsigned char *pInput, *pInputEnd, *pRetVal, *pRetValStart;

	vRetVal.ev_type = 'C';
	vRetVal.ev_handle = _AllocHand(parm->p[0].val.ev_length);
	if (!vRetVal.ev_handle)
		_Error(182); // insufficient memory

	_HLock(vRetVal.ev_handle);
	pRetValStart = pRetVal = _HandToPtr(vRetVal.ev_handle);
	_HLock(parm->p[0].val.ev_handle);
	pInput = _HandToPtr(parm->p[0].val.ev_handle);
	pInputEnd = pInput + parm->p[0].val.ev_length;

	while (pInput <= pInputEnd)
	{
		if (pInput[0] == '\\')
		{
			if (pInput[1] == '\\' || pInput[1] == '\'')
			{
				*pRetVal++ = pInput[1];
				pInput += 2;
				continue;
			}

			if (pInput[1] >= '0' && pInput[1] <= '7' && 
				pInput[2] >= '0' && pInput[2] <= '7' &&
				pInput[3] >= '0' && pInput[3] <= '7')
			{
				*pRetVal++ = (pInput[1] - '0') * 64	+ (pInput[2] - '0') * 8 + (pInput[1] - '0');
				pInput += 4;
				continue;
			}
		}
		*pRetVal++ = *pInput++;
	}

	_HUnLock(vRetVal.ev_handle);
	_HUnLock(parm->p[0].val.ev_handle);
	
	vRetVal.ev_length = pRetVal - pRetValStart;
	_RetVal(&vRetVal);
}
&& i think you know where this has to be placed ..
{"FunctionNameAsYouLikeItInFox", (FPFI) FunctionNameAsYouLikeIt, 1, "C"}

Regards
Christian
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform