#
# This file deals with manipulating ascii `vectors' actually sets of variables
# whose names end with what would be the subscript, e.g. $v0, $v1, $v2, ...
# The dimension is given by $v_dimen
#
# The macros are:
# adelete	delete an ascii `vector'
# adimen	Print dimension of ascii `vector'
# apoints	Plot $1 against $2 with points with ascii vector $3. If $4
#		is provided, plot only those points for which it is true
# aprint	print ascii `vector'
# aread		Read an ascii column $2 into `vector' $1
#
adelete 1	# delete an ascii `vector'
		DO 2=0,$$1_dimen-1 {
		   DEFINE $1$2 DELETE
		}
		DEFINE $1_dimen DELETE
adimen	1	# Print dimension of ascii `vector'
		DEFINE 1 $1 echo Dimension: $$1_dimen
apoints	34	# Plot $1 against $2 with points with ascii vector $3. If $4
		# is provided, plot only those points for which it is true
		SET _x = $1 SET _y = $2 # may be expressions
		IF($?TeX_strings) {
		   DEFINE _font "\t\-3"
		} ELSE {
		   DEFINE _font "\\t\\-3"
		}
		IF($?4) {
		   SET _test = $4
		   DO 5=0,DIMEN(_x)-1 {
		      IF(_test[$5]) {
		         rel _x[$5] _y[$5] PUTLABEL 5 $_font""$$3$5
		      }
		   }
		   DELETE _test
		} ELSE {
		   DO 5=0,DIMEN(_x)-1 {
		      rel _x[$5] _y[$5] PUTLABEL 5 $_font""$$3$5
		   }
		}
		DELETE _x DELETE _y  DEFINE _font DELETE
aprint	1	# print ascii `vector'
		DEFINE 3 1
		DO 2=0,$$1_dimen-1 {
		   echo $$1$2
		   IF($2 - 20*INT($2/20) == 19) { 
		      DEFINE 3 ? { enter 1 for more? }
		      IF(WHATIS($3) > 0) { RETURN } # probably q
		      IF($3 == 0) { RETURN }
		   }
		}
aread	2	# Read an ascii column $2 into `vector' $1
		IF($_l1 == 0 && $_l2 == 0) { 
		   DEFINE 4 ($_l2-$_l1+1)
		} ELSE {
		   DEFINE 4 10000
		}
		DO 3 = 0,$4-1 {
		   DEFINE $1$3 DELETE
		   DEFINE 5 ($3+$_l1) DEFINE $1$3 READ $5 $2
		   IF($?$1$3 == 0) { 
		      DEFINE $1_dimen $3 
		      RETURN
		   }
		}
		DEFINE $1_dimen $4
