From fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4 Mon Sep 17 00:00:00 2001 From: Joseph Hunkeler Date: Wed, 8 Jul 2015 20:46:52 -0400 Subject: Initial commit --- sys/gio/ncarutil/sysint/gbytes.x | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 sys/gio/ncarutil/sysint/gbytes.x (limited to 'sys/gio/ncarutil/sysint/gbytes.x') diff --git a/sys/gio/ncarutil/sysint/gbytes.x b/sys/gio/ncarutil/sysint/gbytes.x new file mode 100644 index 00000000..b129ffbc --- /dev/null +++ b/sys/gio/ncarutil/sysint/gbytes.x @@ -0,0 +1,30 @@ +# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc. + +# GBYTES -- Locally implemented bit unpacker for the NCAR extended metacode +# translator. 3 may 84 cliff stoll +# Required for the ncar/gks vdi metacode generator. +# +# Essentially this routine accepts an array which is a packed series of bits. +# [array BUFIN], and unpacks them into an array [array BUFOUT]. Received +# integer INDEX is the beginning bit in BUFIN where information is to be +# placed. INDEX is zero indexed. Received integer argument SIZE is the +# number of bits in each "information packet". Received argument SKIP is the +# number of bits to skip between bit packets. For more info, see page 4 of +# the NCAR "Implementaton details for the new metafile translator, version 1.0" + +procedure gbytes (bufin, bufout, index, size, skip, count) + +int bufout[ARB], bufin[ARB], index, size, skip, count +int pack +int offset +int bitupk() # Iraf function to unpack bits + +begin + for (pack = 1; pack <= count ; pack = pack+1) { + # Offset is a bit offset into the input buffer bufin. + # (offset is 1- indexed; INDEX is zero indexed) + + offset = (size + skip) * (pack - 1) + index + 1 + bufout(pack) = bitupk(bufin, offset, size) + } +end -- cgit