# Copyright restrictions apply - see stsdas$copyright.stsdas # include "reloperr.h" define SZ_EXP 1000 define FROM_STRING "/\"[^\"]\"/'[^']'/{.eq.}/{.and.}/{.or.}\ /{.gt.}/{.ge.}/{.lt.}/{.le.}/{.not.}/{.ne.}/" # SELECT -- Select table rows according to expression # # This procedure evaluates a boolean expession for selected rows in a table. # If the expression is true and does not involve null elements, the index # of that row is kept in the index array. # # B.Simon 7-Oct-87 First Code # B.Simon 16-Dec-87 Changed to handle table subsets procedure select (tp, expr, nindex, index) pointer tp # i: Table descriptor char expr[ARB] # i: Algebraic expression used in selection int nindex # io: Number of rows selected int index[ARB] # io: Indices of selected rows #-- char ch pointer sp, oldexp, newexp, ic, aryptr, nulptr int fd, sd, jc, dtype, nary, iary int open(), stropen(), stridx() errchk open, stropen, tbl_eval string badtype "Expression is not boolean" string from FROM_STRING string to "/&/&/ ==/ \&\&/ ||/ >/ >=/