aboutsummaryrefslogtreecommitdiff
path: root/sys/osb/strpak.f
diff options
context:
space:
mode:
authorJoe Hunkeler <jhunkeler@gmail.com>2015-08-11 16:51:37 -0400
committerJoe Hunkeler <jhunkeler@gmail.com>2015-08-11 16:51:37 -0400
commit40e5a5811c6ffce9b0974e93cdd927cbcf60c157 (patch)
tree4464880c571602d54f6ae114729bf62a89518057 /sys/osb/strpak.f
downloadiraf-osx-40e5a5811c6ffce9b0974e93cdd927cbcf60c157.tar.gz
Repatch (from linux) of OSX IRAF
Diffstat (limited to 'sys/osb/strpak.f')
-rw-r--r--sys/osb/strpak.f29
1 files changed, 29 insertions, 0 deletions
diff --git a/sys/osb/strpak.f b/sys/osb/strpak.f
new file mode 100644
index 00000000..8c66f6f0
--- /dev/null
+++ b/sys/osb/strpak.f
@@ -0,0 +1,29 @@
+c STRPAK -- Pack an SPP character string into a C string, i.e., a sequence
+c of characters stored one per byte, delimited by EOS='\0'. The operation
+c may be performed in place. This version assumes that the host character
+c set is ASCII and hence no lookup table reference to map character sets is
+c needed. If this is not the case, code must be added to convert to the host
+c character set.
+c
+c N.B.: If sizeof(XCHAR)=1, XEOS=EOS, and the host character set is ASCII,
+c and the operation is being performed in place, then this procedure should
+c do nothing.
+c
+c N.B.: This code ASSUMES that XCHAR is implemented as INTEGER*2 and that
+c both XEOS and EOS are 0.
+
+ subroutine strpak (instr, outstr, maxch)
+
+ integer*2 instr(*), ch, EOS
+ character*1 outstr(*)
+ integer maxch
+ parameter (EOS=0)
+ integer i
+
+ do 10 i = 1, maxch
+ ch = instr(i)
+ outstr(i) = char (ch)
+ if (ch .eq. EOS) return
+ 10 continue
+ outstr(maxch+1) = char (EOS)
+ end