File: pack_f.f

package info (click to toggle)
libccp4 8.0.0-4
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 5,036 kB
  • sloc: ansic: 19,540; fortran: 18,766; sh: 11,561; makefile: 73
file content (253 lines) | stat: -rw-r--r-- 6,565 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
C
C     pack_f.f: (de)compress diffraction image files
C     Copyright (C) 1995  Jan P Abrahams
C
C     This library is free software: you can redistribute it and/or
C     modify it under the terms of the GNU Lesser General Public License
C     version 3, modified in accordance with the provisions of the 
C     license to address the requirements of UK law.
C 
C     You should have received a copy of the modified GNU Lesser General 
C     Public License along with this library.  If not, copies may be 
C     downloaded from http://www.ccp4.ac.uk/ccp4license.php
C 
C     This program is distributed in the hope that it will be useful,
C     but WITHOUT ANY WARRANTY; without even the implied warranty of
C     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
C     GNU Lesser General Public License for more details.
c
c
c
      subroutine pack_wordimage (data, x, y, filn)
c     =================================
c
c   Pack data stored in the array DATA with dimensions x * y in file FILN.
c
      implicit none
c
      character*(*) filn
      integer*4 x, y, j
      integer*2 data(x, y)
      integer*4 filnarray(1025)
c
c     ..
c     .. External C-routine
      external pack_wordimage_f

      do 10, j = 1, len(filn)
         if (filn(j:j) .ne. ' ') then
            filnarray(j) = ichar(filn(j:j))
         else
            filnarray(j) = 0
         endif
 10   continue
      filnarray(len(filn)   1) = 0
      call pack_wordimage_f(data, x, y, filnarray)
      return
      end

c*******************************************************************************
c
c
c
      subroutine v2pack_wordimage (data, x, y, filn)
c     =================================
c
c   Pack data stored in the array DATA with dimensions x * y in file FILN.
c
      implicit none
c
      character*(*) filn
      integer*4 x, y, j
      integer*2 data(x, y)
      integer*4 filnarray(1025)
c
c     ..
c     .. External C-routine
      external v2pack_wordimage_f

      do 10, j = 1, len(filn)
         if (filn(j:j) .ne. ' ') then
            filnarray(j) = ichar(filn(j:j))
         else
            filnarray(j) = 0
         endif
 10   continue
      filnarray(len(filn)   1) = 0
      call v2pack_wordimage_f(data, x, y, filnarray)
      return
      end

c*******************************************************************************
c
c
c
      subroutine pack_longimage (data, x, y, filn)
c     =================================
c
c   Pack data stored in the array DATA with dimensions x * y in file FILN.
c
      implicit none
c
      character*(*) filn
      integer*4 x, y, j
      integer*4 data(x, y)
      integer*4 filnarray(1025)
c
c     ..
c     .. External C-routine
      external pack_wordimage_f
c
      do 10, j = 1, len(filn)
         if (filn(j:j) .ne. ' ') then
            filnarray(j) = ichar(filn(j:j))
         else
            filnarray(j) = 0
         endif
 10   continue
      filnarray(len(filn)   1) = 0
      call pack_longimage_f(data, x, y, filnarray)
      return
      end

c*******************************************************************************
c
c
c
      subroutine v2pack_longimage (data, x, y, filn)
c     =================================
c
c   Pack data stored in the array DATA with dimensions x * y in file FILN.
c
      implicit none
c
      character*(*) filn
      integer*4 x, y, j
      integer*4 data(x, y)
      integer*4 filnarray(1025)
c
c     ..
c     .. External C-routine
      external v2pack_wordimage_f
c
      do 10, j = 1, len(filn)
         if (filn(j:j) .ne. ' ') then
            filnarray(j) = ichar(filn(j:j))
         else
            filnarray(j) = 0
         endif
 10   continue
      filnarray(len(filn)   1) = 0
      call v2pack_longimage_f(data, x, y, filnarray)
      return
      end

c*******************************************************************************
c
c
c
      subroutine readpack_word (data, filn)
c     =================================
c
c     Read a packed image from file 'filn' into array 'data'. If you want 
c     to generate the mirror-image, (interchange first and last stripes, etc.)
c     call "mirror_wordimg(data, nfast, nslow)", where nfast and nslow contain
c     the number of fast and slow indices, after reading the packed image.
c
      implicit none
c
      character*(*) filn
      integer*2 data, j
      integer*4 filnarray(1025)
c
c     ..
c     .. External C-routine
      external readpack_word_f
c
      do 10, j = 1, len(filn)
         if (filn(j:j) .ne. ' ') then
            filnarray(j) = ichar(filn(j:j))
         else
            filnarray(j) = 0
         endif
 10   continue
      filnarray(len(filn)   1) = 0
      call readpack_word_f(data, filnarray)
      return
      end

c*******************************************************************************
c
c
c
      subroutine readpack_long (data, filn)
c     =================================
c
c     Read a packed image from file 'filn' into array 'data'. If you want 
c     to generate the mirror-image, (interchange first and last stripes, etc.)
c     call "mirror_wordimg(data, nfast, nslow)", where nfast and nslow contain
c     the number of fast and slow indices, after reading the packed image.
c
      implicit none
c
      character*(*) filn
      integer*4 data, j
      integer*4 filnarray(1025)
c
c     ..
c     .. External C-routine
      external readpack_long_f
c
      do 10, j = 1, len(filn)
         if (filn(j:j) .ne. ' ') then
            filnarray(j) = ichar(filn(j:j))
         else
            filnarray(j) = 0
         endif
 10   continue
      filnarray(len(filn)   1) = 0
      call readpack_long_f(data, filnarray)
      return
      end

c*******************************************************************************
c
c
c
      subroutine imsiz (filn, x, y)
c     =================================
c
c     Determines the size of the the packed image "filename" after 
c     unpacking.The dimensions are returned in x and y. 
c     Read a packed image from file 'filn' into array 'data'.
c
      implicit none
c
      character*(*) filn
      integer*4 x, y, j
      integer*4 filnarray(1025)
c
c     ..
c     .. External C-routine
      external imsiz_f
c
      do 10, j = 1, len(filn)
         if (filn(j:j) .ne. ' ') then
            filnarray(j) = ichar(filn(j:j))
         else
            filnarray(j) = 0
         endif
 10   continue
      filnarray(len(filn)   1) = 0
      call imsiz_f(filnarray, x, y)
      return
      end

c*******************************************************************************