Metropoli BBS
VIEWER: vectors.c MODE: TEXT (ASCII)
/*Copyright (C) 1992, 1994 by Thomas Glen Smith.	All Rights Reserved.*/
/* vectors APL2 V1.0.0 *************************************************
* Called by vector.  Completes processing for vector.                  *
***********************************************************************/
#define INCLUDES APLCB+APLMEM
#include "includes.h"
#include "flist.h"
Aplcb vectors(datacnt, datatyp, pfhdr)
int datacnt, datatyp;
Flist *pfhdr;
{
	Getcb; Pop;
     Flist fcur;
	int i,*ip;
	double *fp;
	Aplcb out;

	out = getcb(NULL, datacnt, datatyp + APLTEMP, 1, NULL);
	if (out != NULL && datacnt)
     	switch(datatyp) {
	     	case APLCPLX:
	          case APLNUMB:
				fp = out->aplptr.apldata;
				while (NULL != (fcur = pop(pfhdr))) {
					if (fcur->swel) {
						*fp++	   = fcur->fel[0];
						if (datatyp == APLCPLX)
	                         	*fp++ = fcur->fel[1];
					}
					else *fp++ = fcur->iel;
					free(fcur);
				}
				break;
	          case APLINT: /* integer vector */
				ip = out->aplptr.aplint;
				while (NULL != (fcur = pop(pfhdr))) {
					*ip++ = fcur->iel;
					free(fcur);
				}
	               break;
	     	} /* end switch */
	return(out);
}
[ RETURN TO DIRECTORY ]