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