aboutsummaryrefslogtreecommitdiff
path: root/sys/osb/strpak.f
diff options
context:
space:
mode:
authorJoseph Hunkeler <jhunkeler@gmail.com>2015-07-08 20:46:52 -0400
committerJoseph Hunkeler <jhunkeler@gmail.com>2015-07-08 20:46:52 -0400
commitfa080de7afc95aa1c19a6e6fc0e0708ced2eadc4 (patch)
treebdda434976bc09c864f2e4fa6f16ba1952b1e555 /sys/osb/strpak.f
downloadiraf-linux-fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4.tar.gz
Initial commit
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