aboutsummaryrefslogtreecommitdiff
path: root/sys/osb/f77upk.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/f77upk.f
downloadiraf-osx-40e5a5811c6ffce9b0974e93cdd927cbcf60c157.tar.gz
Repatch (from linux) of OSX IRAF
Diffstat (limited to 'sys/osb/f77upk.f')
-rw-r--r--sys/osb/f77upk.f26
1 files changed, 26 insertions, 0 deletions
diff --git a/sys/osb/f77upk.f b/sys/osb/f77upk.f
new file mode 100644
index 00000000..fc875008
--- /dev/null
+++ b/sys/osb/f77upk.f
@@ -0,0 +1,26 @@
+c F77UPK -- Convert a Fortran 77 string into an SPP string. Unpack
+c each Fortran character into an SPP char and trim the blank padding
+c at the right.
+c
+ subroutine f77upk (f77str, sppstr, maxch)
+c
+ character*(*) f77str
+ integer*2 sppstr(*)
+ integer maxch
+ integer lastch, nchars, i
+ integer EOS, BLANK
+ parameter (EOS=0, BLANK=32)
+c
+c -- Unpack string.
+ nchars = min (maxch, len(f77str))
+ lastch = 0
+ do 10 i = 1, nchars
+ sppstr(i) = ichar (f77str(i:i))
+ if (sppstr(i) .gt. BLANK) lastch = i
+ 10 continue
+c
+c -- Add EOS delimiter to SPP string, trimming blank padding at right.
+ if (lastch .gt. maxch) lastch = maxch
+ sppstr(lastch+1) = EOS
+c
+ end