/* Copyright (C) 1992 by Thomas Glen Smith. All Rights Reserved. */
/* comexpa APL2 V1.0.0 *************************************************
* Called by compress and expand to do initialization. *
***********************************************************************/
#define INCLUDES APLCB
#include "includes.h"
Aplcb comexpa(left,rite,paxis,paxicnt,pbotcnt,ptopcnt)
Aplcb left,rite;
int *paxis, /* Originally the axis rel 0. W/b set rel 1. */
*paxicnt, /* Set to count along the axis of rite. */
*pbotcnt, /* Set to count above the axis of rite. */
*ptopcnt; /* Set to count below the axis of rite. */
{
Axispre; Errinit; Errstop; Idyadic; Ine; Iscalar; Perm; Reshape;
Temp; Vectin;
extern int indxorg;
if (errinit())
return(errstop(0,left,NULL,NULL));
*paxis += (indxorg == 0); /* make axis relative 1 */
if (OK != axispre(rite,*paxis,paxicnt,pbotcnt,ptopcnt))
return(NULL);
left = vectin(left); /* ensure permanent vector of integers */
if (*paxicnt > 1 && left->aplcount == 1)
left = perm(reshape(iscalar(*paxicnt),temp(left)));
/* Expand scalars, 1-element vectors. */
return(left);
}