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/osb/strpak.f | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 sys/osb/strpak.f (limited to 'sys/osb/strpak.f') 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 -- cgit