/* Copyright (C) 1993 by Thomas Glen Smith. All Rights Reserved. */
/* enlistb APL2 V1.0.0 *************************************************
* Called by enlist to assign data to the result. *
***********************************************************************/
#define INCLUDES APLCB
#include "includes.h"
char *enlistb(totype, tosize, to, rite)
int totype;
int tosize;
char *to;
Aplcb rite;
{
Dtacopy; Getcb;
extern int aplerr;
char *enlistb(int, int, char *, Aplcb);
Aplcb *cb, wrk;
int i,thistype;
char *from;
thistype = rite->aplflags & (APLMASK + APLAPL);
if (thistype == APLAPL)
for( cb = rite->aplptr.aplapl, i = rite->aplcount; i; i--, cb++)
to = enlistb(totype, tosize, to, *cb);
else for( i = rite->aplcount, from = rite->aplptr.aplchar;
i; i--, from += rite->aplsize, to += tosize) {
if (totype == APLAPL) {
*(Aplcb *)to = wrk = getcb(NULL,1,thistype,0,NULL);
if (aplerr) return;
dtacopy(wrk->aplptr.aplchar, from, 1, 1, thistype);
}
else if (totype == thistype)
dtacopy(to, from, 1, 1, thistype);
else if (totype == APLCPLX) {
if (thistype == APLINT)
*(double *)to = *(int *)from;
else *(double *)to = *(double *)from;
*(((double *)to) + 1) = 0e0;
}
else *(double *)to = *(int *)from;
}
return(to);
}