/*Copyright (C) 1992, 1995 by Thomas Glen Smith. All Rights Reserved.*/ /* shape APL2 V1.0.0 *************************************************** * Shape yields a vector of the dimensions of its argument, e.g. if * * it's a matrix having three rows and four columns, shape will return a* * vector containing 3 4. If the argument to shape is a scalar, i.e. * * rank is 0, an empty vector is returned. * ***********************************************************************/ #define INCLUDES APLCB #include "includes.h" Aplcb shape(rite) Aplcb rite; { Getcb; Errinit; Errstop; Intcopy; int *dimin,*dimptr,i,*ip; Aplcb out; if (errinit()) return(errstop(0,NULL,rite,NULL)); out = getcb(NULL,rite->aplrank,APLTEMP+APLINT,1,NULL); if (rite->aplrank) /* input isn't scalar */ dimptr=intcopy(out->aplptr.aplint,rite->apldim,rite->aplrank,1); /* out data is input dimensions */ return(errstop(0,NULL,rite,out)); }