]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MINICERN/packlib/zebra/fq/fzocv.F
Bugfix in AliPoints2Memory
[u/mrichter/AliRoot.git] / MINICERN / packlib / zebra / fq / fzocv.F
CommitLineData
fe4da5cc 1*
2* $Id$
3*
4* $Log$
5* Revision 1.2 1996/04/18 16:10:46 mclareni
6* Incorporate changes from J.Zoll for version 3.77
7*
8* Revision 1.1.1.1 1996/03/06 10:47:11 mclareni
9* Zebra
10*
11*
12#include "zebra/pilot.h"
13#if !defined(CERNLIB_FQXISN)
14 SUBROUTINE FZOCV (MS,MT)
15
16C- Convert for output with copy
17C- from source in native to target in exchange data format
18
19#include "zebra/quest.inc"
20#include "zebra/mzioc.inc"
21C-------------- End CDE --------------
22 DIMENSION MS(99), MT(99)
23
24 DOUBLE PRECISION THDB
25 DIMENSION THIS(2)
26 EQUIVALENCE (THDB,THIS)
27 EQUIVALENCE (ITHA,THA,THIS(1)), (ITHB,THB,THIS(2))
28
29C---- Conversion Control in /MZIOC/ :
30
31C- for a given call translation source MS -> target MT is done
32C- either for a complete batch of NWFOTT words
33C- if NWFODN.EQ.0 and NWFOAV.GE.NWFOTT
34
35C- or for the first instalment of a batch of NWFOTT words
36C- if NWFODN.EQ.0 and NWFOAV.LT.NWFOTT
37
38C- or for a new instalment of N=MIN(NWFOAV,NWFOTT-NWFODN)
39C- words, if NWFODN.NE.0
40
41C- * marks words to be initialized by the caller
42C- only for the call at the beginning of a new batch
43C-
44C- NWFOAV number of words available in the buffer to receive
45C- the result
46C- set by the caller whenever a new lot of data
47C- becomes available for conversion (new buffer)
48C- counted down by FZOCV
49C- * NWFOTT total number of words in the batch to be done,
50C- maybe in several instalments
51C- * NWFODN number of words in the batch already done
52C- set to zero by the caller at start of batch
53C- (in fact MZIOCR sets it to zero)
54C- NWFORE n.w. remaining to be done for the pending batch
55C- set by FZOCV, zero if end of batch
56C-
57C- IFOCON remembers the last conversion problem
58C- (1) error code if -ve, expected type if +ve
59C- (2) location of the word
60C- (3) content of the word
61
62C- MFOSAV
63C- (1+2) saves type and word-count for re-entry
64
65C- * JFOEND position of last sector plus 1
66C- * JFOREP position of repeat sector descr.
67C- JFOCUR position of current sector description
68
69C- * MFO(JFO+1) t= sector type as in format
70C- * +2) c= word count as in format
71C- c > 0 : no. of words
72C- c = 0 : dynamic sector
73C- c < 0 : indefinite sector, rest of the bank
74
75C- JMT # of words done so far for the current call
76C- JMS # of words done so far for the current batch
77
78#include "fzocvd1.inc"
79#include "fzocvd2.inc"
80
81
82 JMT = 0
83 IF (NWFODN.NE.0) GO TO 30
84
85 NWFORE = NWFOTT
86 JMTEX = MIN (NWFORE,NWFOAV)
87
88 JMS = 0
89 JFOCUR = 0
90 IFOCON(1) = 0
91
92C------ Start next sector
93
94 21 ITYPE = MFO(JFOCUR+1)
95 IF (ITYPE.EQ.7) GO TO 24
96 NWSEC = MFO(JFOCUR+2)
97 IF (NWSEC) 22, 23, 31
98
99C-- Rest of the bank
100
101 22 NWSEC = NWFORE
102 GO TO 31
103
104C-- Dynamic sector
105
106 23 IWORD = MS(JMS+1)
107 NWSEC = IWORD
108 GO TO 25
109
110C-- Self-describing sector
111
112 24 IWORD = MS(JMS+1)
113 ITYPE = MOD (IWORD,16)
114 NWSEC = IWORD/16
115
116 25 MT(JMT+1) = IWORD
117 JMT = JMT + 1
118 JMS = JMS + 1
119 NWFORE = NWFORE - 1
120
121 IF (ITYPE.GE.8) GO TO 27
122 IF (NWSEC.EQ.0) GO TO 29
123 IF (NWSEC.GT.0) GO TO 31
124
125C-- Faulty sector control word
126
127 27 IFOCON(1) = -1
128 IFOCON(2) = JMS
129 IFOCON(3) = IWORD
130
131C-- Rest of the bank is unused
132
133 29 ITYPE = 0
134 NWSEC = NWFORE
135 GO TO 31
136
137C-- RE-ENTRY TO CONTINUE
138
139 30 JMTEX = MIN (NWFORE,NWFOAV)
140 JMS = NWFODN
141 ITYPE = MFOSAV(1)
142 NWSEC = MFOSAV(2)
143
144C------ CONVERSION LOOPS
145
146 31 NWDO = MIN (NWSEC,JMTEX-JMT)
147 IF (NWDO.EQ.0) GO TO 801
148 IF (ITYPE.LE.0) GO TO 91
149 GO TO (101,201,301,401,501,101,101), ITYPE
150
151C-- Rest of the bank unused
152
153 91 CALL VZERO (MT(JMT+1),NWDO)
154 JMS = JMS + NWDO
155 JMT = JMT + NWDO
156 GO TO 801
157
158C-- B - bit strings
159
160C-- I - integers
161
162#include "fzocvfi.inc"
163* Ignoring t=pass
164
165C-- F - floating
166
167#include "fzocvff.inc"
168* Ignoring t=pass
169
170C-- D - double precision
171
172 401 NDPN = (NWDO+1) / 2
173 NWDODB = NDPN * 2
174#include "fzocvfd.inc"
175 IF (NWDODB.EQ.NWDO) GO TO 801
176 IF (NWDODB.GT.NWSEC) GO TO 471
177 IF (NWDODB.GT.NWFORE) GO TO 471
178 NWDO = NWDODB
179 GO TO 801
180
181C-- Error : odd number of double-precision words
182
183 471 JMS = JMS - 1
184 JMT = JMT - 1
185 IFOCON(1) = -2
186 IFOCON(2) = JMS
187 IFOCON(3) = NWDO
188 GO TO 801
189
190C-- H - hollerith
191
192 501 CONTINUE
193#include "fzocvfh.inc"
194* Ignoring t=pass
195
196C---- COPY AS IS
197
198#include "fzocvjf.inc"
199 201 CONTINUE
200 101 CONTINUE
201#include "fzocvfai.inc"
202
203C------ END OF SECTOR
204
205 801 NWFORE = NWFOTT - JMS
206 IF (JMT.GE.JMTEX) GO TO 804
207 JFOCUR = JFOCUR + 2
208 IF (JFOCUR.LT.JFOEND) GO TO 21
209 JFOCUR = JFOREP
210 GO TO 21
211
212C-- Data or buffer exhausted
213
214 804 IQUEST(1) = JMT
215 NWFOAV = NWFOAV - JMT
216 IF (NWFORE.EQ.0) RETURN
217
218C-- Ready for re-entry
219
220 NWFODN = JMS
221 MFOSAV(1) = ITYPE
222 MFOSAV(2) = NWSEC - NWDO
223 RETURN
224 END
225* ==================================================
226#include "zebra/qcardl.inc"
227#endif