diff options
author | Joe Hunkeler <jhunkeler@gmail.com> | 2015-08-11 16:51:37 -0400 |
---|---|---|
committer | Joe Hunkeler <jhunkeler@gmail.com> | 2015-08-11 16:51:37 -0400 |
commit | 40e5a5811c6ffce9b0974e93cdd927cbcf60c157 (patch) | |
tree | 4464880c571602d54f6ae114729bf62a89518057 /sys/osb/chrpak.c | |
download | iraf-osx-40e5a5811c6ffce9b0974e93cdd927cbcf60c157.tar.gz |
Repatch (from linux) of OSX IRAF
Diffstat (limited to 'sys/osb/chrpak.c')
-rw-r--r-- | sys/osb/chrpak.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/sys/osb/chrpak.c b/sys/osb/chrpak.c new file mode 100644 index 00000000..3a1356a8 --- /dev/null +++ b/sys/osb/chrpak.c @@ -0,0 +1,28 @@ +/* Copyright(c) 1986 Association of Universities for Research in Astronomy Inc. + */ + +#define import_spp +#define import_knames +#include <iraf.h> + +/* CHRPAK -- Pack a counted string of XCHAR into bytes. This routine does not + * know about EOS terminators. The input and output arrays may be the same. + * Note that while XCHAR is signed, the signedness of the C char is unspecified, + * hence we pack the chars in unsigned bytes, dealing explicitly with any + * negative values. + */ +CHRPAK (a, a_off, b, b_off, nchars) +XCHAR *a, *b; +XINT *a_off, *b_off, *nchars; +{ + register XCHAR *ip; + register unsigned char *op; + register int n, ch; + + ip = &a[*a_off-1]; + op = &((unsigned char *)b)[*b_off-1]; + n = *nchars; + + while (--n >= 0) + *op++ = ((ch = *ip++) >= 0) ? ch : ch + 256; +} |