diff options
Diffstat (limited to 'vo/votools/gasplib/rdxy.x')
-rw-r--r-- | vo/votools/gasplib/rdxy.x | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/vo/votools/gasplib/rdxy.x b/vo/votools/gasplib/rdxy.x new file mode 100644 index 00000000..360f9cd0 --- /dev/null +++ b/vo/votools/gasplib/rdxy.x @@ -0,0 +1,43 @@ +include <mach.h> + +# RDXY -- procedure to get (x,y) pixel values from a line. +# The line can have any number of columns but only up to 162 +# characters per line. +# +procedure rdxy (line, icol, x, y) + +char line[SZ_LINE] # input line with (x,y) in it +int icol[2] # X, Y column numbers within the line +double x # X pixel value +double y # Y pixel value + +pointer sp, pp +int i, ip, ic, ctowrd(), ctod() +int maxcol, nchar + +begin + + # find the right most column to read from buffer + maxcol = max (icol[1], icol[2]) + + call smark (sp) + call salloc (pp, maxcol*MAX_DIGITS, TY_CHAR) + + ip = 1 + ic = pp + do i = 1, maxcol { + nchar = ctowrd (line, ip, Memc[ic], MAX_DIGITS) + # store word in equal length array + call amovkc (" ", Memc[ic+nchar], MAX_DIGITS-nchar) + Memc[ic+MAX_DIGITS] = EOS + ic = ic + MAX_DIGITS+1 + } + + # get the output parameters + + nchar = ctod (Memc[pp], (icol(1)-1)*(MAX_DIGITS+1)+1, x) + nchar = ctod (Memc[pp], (icol(2)-1)*(MAX_DIGITS+1)+1, y) + + call sfree (sp) + +end |