/* Copyright (C) 1993 by Thomas Glen Smith. All Rights Reserved. */
/* execindy APL2 V1.0.0 ************************************************
* Called from execindx to set up the indices array. *
***********************************************************************/
#define INCLUDES APLTOKEN+APLCB
#include "includes.h"
Aplcb execindy(ixtok,rank)
Apltoken ixtok; /* token for indices */
int rank;
{
Errstop; Execgetp; Getcb; Pop;
extern int aplerr;
Aplcb indices,*ixout;
Apltoken ixnxt;
int i;
indices = getcb(NULL,rank,APLAPL + APLTEMP + APLINDX,1,NULL);
if (aplerr == 0) {
ixout = indices->aplptr.aplapl;
for ( i = rank; i > 0; i--) {
if ( aplerr == 0 && NULL ==
(ixnxt = pop(&(ixtok->token_ptr.token_stack))))
aplerr = 9; /* invalid axis */
if (aplerr)
*ixout++ = NULL;
else *ixout++ = execgetp(ixnxt);
}
if (NULL != ixtok->token_ptr.token_stack && aplerr == 0)
aplerr = 9; /* invalid axis */
}
return(errstop(0,NULL,NULL,indices));
}