/* Copyright (C) 1994 by Thomas Glen Smith. All Rights Reserved. */
/* execmonk - APL2 V1.0.0 **********************************************
* Called from execmonj when rite is of type APLAPL, and it's a scalar. *
***********************************************************************/
#define INCLUDES APLCB+APLDERIV
#include "includes.h"
Aplcb execmonk(ptype,arg,ep,rite,axisp)
deriv_type ptype;
void *arg;
sub_dyad ep;
Aplcb rite;
int *axisp;
{
Aplcopy; Errstop; Getcb; Temp;
extern int aplerr;
Aplcb *ib,*ob,out,tb;
int i;
i = rite->aplcount;
if (0 == i)
return(errstop(0,NULL,rite,temp(aplcopy(rite))));
out = getcb(NULL,rite->aplcount,APLAPL+APLTEMP,rite->aplrank,NULL);
if (out) {
ib = rite->aplptr.aplapl;
ob = out->aplptr.aplapl;
while (i-- && aplerr == 0) {
*ob++ = tb = (axisp == NULL) ?
ep.moa(arg,*ib++) :
ep.mox(*ib++,*axisp);
if (tb != NULL) tb->aplflags -= APLTEMP;
}
}
return(errstop(0,NULL,rite,out));
}