/* Copyright (C) 1994 by Thomas Glen Smith. All Rights Reserved. */ /* axesok APL2 V1.0.0 ************************************************** * Called from disclosf, scalax, to test axes for valid values. * ***********************************************************************/ #define INCLUDES APLCB #include "includes.h" Aplcb axesok(axes,rank,maxv) Aplcb axes; int rank; /* required rank for axes */ int maxv; /* maximum value in axes */ { Endoper; Integer; extern int indxorg; extern int aplerr; int *ip,k; if (!(axes->aplflags & APLINT)) axes = integer(axes); if (axes == NULL) return(NULL); maxv -= (indxorg == 0); if (axes->aplcount != rank) { aplerr = 123; endoper(axes); return(NULL); /* axes bad */ } ip = axes->aplptr.aplint; while(rank--) { k = *ip++; /* next axes index */ if (k < indxorg || k > maxv) { aplerr = 123; endoper(axes); return(NULL); /* axes bad */ } } return(axes); /* axes ok */ }