Metropoli BBS
VIEWER: nwisea.c MODE: TEXT (ASCII)
/* Copyright (C) 1993 by Thomas Glen Smith.	All Rights Reserved. */
/* nwisea APL2 V1.0.0 **************************************************
* Called from nwisec to complete nwise processing. Labs is guaranteed  *
* to be greater than 1, the input and output data types either match,  *
* or the input is APLCHAR, output is APLINT, code is EQNE, and labs is *
* 2.  Input is not nested.                                             *
***********************************************************************/
#define INCLUDES APLCB
#include "includes.h"
typedef void (*Pep)(void*,void*,void*);
Aplcb nwisea(pep,rite,lef,labs,datacnt,outype,axis,axicnt,naxicnt,botcnt,
topcnt)
Pep pep;
Aplcb rite;
int lef,labs,datacnt,outype,axis,axicnt,naxicnt,botcnt,topcnt;
{
	Chrcopy; Getcb; Intcopy;
     Aplcb nwiseb(Aplcb,int,int,int,int);
	extern int aplerr;
	Aplcb out=NULL;
	int bump,i,*ip,j,k,m;
	char *icp,*jcp,*kcp,*ocp,*wcp;

	out = nwiseb(rite,datacnt,outype,axis,naxicnt);
	if (out->aplcount == 0) return(out); /* all done */
     bump = botcnt * rite->aplsize;
     if (lef < 0) bump = -bump;
	for (i = 0; i < topcnt; i++) {
		icp=rite->aplptr.aplchar+(i*botcnt* axicnt)*rite->aplsize;
		jcp=out->aplptr.aplchar +(i*botcnt*naxicnt)*out->aplsize;
		for (j = 0; j < botcnt; j++)
			for (m = naxicnt; m > 0; m--) {
				kcp=icp+(j+(axicnt-m)*botcnt)*rite->aplsize;
               	ocp=jcp+(j+(naxicnt-m)*botcnt)*out->aplsize;
                    if (lef < 0) kcp += (labs - 1) * bump;
                    wcp=chrcopy(ocp,kcp,rite->aplsize,1);
				for (k = 1; k < labs; k++) {
                    	kcp -= bump;
                    	(*pep)(kcp, ocp, ocp);
                    }
			}
	}
	return(out);
}
[ RETURN TO DIRECTORY ]