AcePerl
view release on metacpan or search on metacpan
acelib/arraysub.c view on Meta::CPAN
}
else
return FALSE ;
}
/*******************/
/* if found, removes entry and returns TRUE, else returns FALSE */
/* Requires both xin and xout to match */
BOOL assPairRemove (Associator a, void* xin, void* xout)
{ if (!assExists(a) || !xin || xin == moins_un) return FALSE ;
if (uAssFind (a, xin, 0))
while (uAssFindNext (a, xin, 0))
if (a->out[a->i] == xout)
{ a->in[a->i] = moins_un ;
assRemoved++ ;
return TRUE ;
}
return FALSE ;
}
/************************ dumpers ********************************/
/* lets you step through all members of the table */
BOOL uAssNext (Associator a, void* *pin, void* *pout)
{ int size ;
void *test ;
if (!assExists(a))
messcrash("uAssNext received a non existing associator") ;
size = 1 << a->m ;
if (!*pin)
a->i = -1 ;
else if (*pin != a->in[a->i])
{ messerror ("Non-consecutive call to assNext()") ;
return FALSE ;
}
while (++a->i < size)
{ test = a->in[a->i] ;
if (test && test != moins_un) /* not empty or deleted */
{ *pin = a->in[a->i] ;
if (pout)
*pout = a->out[a->i] ;
return TRUE ;
}
}
return FALSE ;
}
/*******************/
void assDump (Associator a)
{ int i ;
void **in, **out ;
char *cp0 = 0 ;
if (!assExists(a)) return ;
i = 1 << a->m ;
in = a->in - 1 ; out = a->out - 1 ;
/* keep stderr here since it is for debugging */
fprintf (stderr,"Associator %lx : %d pairs\n",(unsigned long)a,a->n) ;
while (in++, out++, i--)
if (*in && *in != moins_un) /* not empty or deleted */
fprintf (stderr,"%lx - %lx\n",
(long)((char*)(*in) - cp0),(long)( (char *)(*out) - cp0)) ;
}
/************************ end of file ********************************/
/**********************************************************************/
( run in 0.465 second using v1.01-cache-2.11-cpan-39bf76dae61 )