NCEPLIBS-w3emc  2.11.0
w3ai18.f
Go to the documentation of this file.
1 C> @file
2 C> @brief Line builder subroutine.
3 C> @author Robert Allard @date 1974-02-01
4 
5 C> Build a line of information composed of user specified
6 C> character strings.
7 C>
8 C> Program history log:
9 C> - Robert Allard 1974-02-02
10 C> - Ralph Jones 1984-07-05 Recompile
11 C> - Ralph Jones 1996-08-06 Convert from ibm370 assembler to fortran
12 C> for the cray, workstations, and pc's.
13 C>
14 C> @param[in] ITEM Character string to be added to line array.
15 C> @param[in] I1 Number of character strings to be added to line array.
16 C> @param[in] I2 Number of characters per string to add to line.
17 C> @param[in] L Character length of line to be built (2.le.l.le.256).
18 C> @param[in] K Number of blkank characters to precede a character
19 C> string (0.le.k.le.256).
20 C> @param[inout] N (in) Pointer set equal to 0 when beginning a line.
21 C> (out) Character count, error indicator.
22 C> @param[out] LINE Array in which character string are placed while
23 C> building aline; must be of type integer.
24 C>
25 C> Exit states:
26 C> - N = -1 Character string will not fit in the line array;
27 C> otherwise, each time a chacter string is added
28 C> to the line, n is incremented by (i2 + k).
29 C>
30 C> @note Each character string included in the item array must
31 C> start on a full word boundary and be equal in length.
32 C> Each successive string must start on the nest fullword
33 C> boundary following the end of the previous string.
34 C> On a cray this is 8.
35 C>
36 C> @note The dimensions of the item array should be at least the
37 C> value of (i1*(i2+j))/4, where the integer j is in the
38 C> range 0.le.j.le.3 and the sum (i2+j) is 4 or a multiple
39 C> of 4. On a cray this is 8 or a multiple of 8. On a cray
40 C> (i1*(i2+j))/8, range is 0.le.j.le.7
41 C>
42 C> @note The maximum dimension of line is 64 word or 256 bytes.
43 C> On a cray it is 32 words or 256 bytes.
44 C>
45 C> @note The user should set n = 0 each time a line is stated to
46 C> tell w3ai18 to fill the line array with blank characters.
47 C> Each time a character string is added to the line, the
48 C> variable (n) is incremented by (i2 + k). If a character
49 C> string will not fit in the line array, w3ai18 sets n = -1
50 C> and returns to the user. The user will not be able to
51 C> program a recovery procedure for the line being full if
52 C> more than one character string is in the item array.
53 C>
54 C> @author Robert Allard @date 1974-02-01
55  SUBROUTINE w3ai18(ITEM,I1,I2,LINE,L,K,N)
56 C
57  CHARACTER * (*) LINE
58  CHARACTER * (*) ITEM
59 C
60  SAVE
61 C
62 C TEST WORD LENGTH, LW WILL BE 4 OR 8 BYTES
63 C
64  CALL w3fi01(lw)
65 C
66 C BAIL OUT IF NEGATIVE
67 C
68  IF (n.LT.0) RETURN
69 C
70 C FILL LINE WITH BLANK CHAACTERS
71 C
72  IF (n.EQ.0) THEN
73  DO i = 1,l
74  line(i:i) = ' '
75  END DO
76  END IF
77  IF (i1.EQ.1) THEN
78  j = 0
79  IF ((i2+k+n).GT.l) GO TO 200
80  line(k+n+1:k+n+i2) = item(1:i2)
81  n = i2+k+n
82  RETURN
83  ELSE
84  jj = mod(i2, lw)
85  IF (jj.EQ.0) THEN
86  j = 0
87  ELSE
88  j = lw - jj
89  END IF
90  IF ((i2+k+n).GT.l) GO TO 200
91  line(k+n+1:k+n+i2) = item(1:i2)
92  n = i2+k+n
93  DO i = 1,i1-1
94  IF ((i2+k+n).GT.l) GO TO 200
95  line(k+n+1:k+n+i2) = item((i2+j)*i+1:(i2+j)*i+i2)
96  n = i2+k+n
97  END DO
98  RETURN
99  END IF
100  200 CONTINUE
101  n = -1
102  RETURN
103  END
subroutine w3ai18(ITEM, I1, I2, LINE, L, K, N)
Build a line of information composed of user specified character strings.
Definition: w3ai18.f:56
subroutine w3fi01(LW)
Determines the number of bytes in a full word for the particular machine (IBM or cray).
Definition: w3fi01.f:19