1 /* BEGIN INCLUDE FILE tc_input_buffer_.incl.pl1 BIM May 1981 */
 2 
 3 
 4 /****^  HISTORY COMMENTS:
 5   1) change(88-09-28,LJAdams), approve(88-09-28,MCR8001),
 6      audit(88-10-06,Farley), install(88-10-07,MR12.2-1148):
 7      Added structures needed to reallocate additional storage for the data and
 8      control buffers.
 9                                                    END HISTORY COMMENTS */
10 
11 
12 /* format: style2,linecom,^indnoniterdo,indcomtxt,^inditerdo,dclind5,idind25 */
13 /* INTERNAL INTERFACE */
14 
15 /* The input buffer is maintained as two parallel sliding windows.
16    One contains actual data characters, and the other control bits
17    associated with each character. A "data character" may be a
18    serial mark, if the MARK_CONTROL bit is set.
19 
20    When the input buffer gets too full, the data is copied back
21    wards over dead data to make new space. Routines that remember
22    positions in the buffer must remember them as relative offsets
23    rather than pointers, so that the buffer can be compacted.
24 
25    This is possible because no data can be "killed" that has an
26    outstanding mark after it. thus nothing between the beginning
27    of the valid window and the first mark can be Killed
28    while that mark is not killed, so that the position of the first
29    valid character cannot move forward while any async
30    operation is in progress.
31 */
32 
33      declare 1 control_entry          based unaligned,
34                2 mark                 bit (1) unaligned,
35                2 echoed               bit (1) unaligned,
36                2 end_of_info          bit (1) unaligned,
37                2 deleted              bit (1) unaligned,    /* already used */
38                2 pad                  bit (5) unaligned;    /* reserved */
39 
40 /* Use these on string (control_entry) */
41 
42      declare (
43              NORMAL_CONTROL           initial ("000000000"b),
44              MARK_CONTROL             initial ("100000000"b),
45              ECHOED_CONTROL           initial ("010000000"b),
46              END_OF_INFO_CONTROL      initial ("001000000"b),
47              DELETED_CONTROL          initial ("000100000"b)
48              )                        bit (9) unaligned internal static options (constant);
49 
50 
51      declare 1 data_bits              based unaligned,
52                2 pad_1                bit (1) unaligned,
53                2 pad_2                bit (1) unaligned,
54                2 character            bit (7) unaligned;    /* we might represent special chars */
55 
56      declare 1 data_char              based unaligned,
57                2 character            character (1) unaligned;
58 
59      declare 1 data_mark              based unaligned,
60                2 mark_number          fixed bin (9) unsigned unaligned;
61 
62 
63      declare input_buffer_ptr         pointer;
64 
65      declare 1 input_buffer           aligned based (input_buffer_ptr),
66                2 buffer_length        fixed bin (21),
67                2 control_ptr          pointer,              /* start of ctl buffer */
68                2 data_ptr             pointer,              /* start of data buffer */
69                2 n_valid              fixed bin (21),       /* this is index (byte (bin (END_OF_INFO_CONTROL)) - 1 in the buffer */
70                2 n_chars_valid        fixed bin (21),       /* n nondeleted normal chars */
71                                                             /* The next two pointer must be maintained in sync !!! */
72                2 n_shifts             fixed bin;            /* meter compactions */
73 
74      declare 1 control_buffer         unaligned based (input_buffer.control_ptr)
75                                       dimension (input_buffer.buffer_length) like control_entry;
76 
77      declare control_buffer_as_chars  unaligned based (input_buffer.control_ptr) character (input_buffer.buffer_length);
78      ;
79 
80      declare 1 data_buffer            unaligned based (input_buffer.data_ptr) dimension (input_buffer.buffer_length)
81                                       like data_char;
82 
83      declare data_buffer_as_chars     unaligned based (input_buffer.data_ptr) character (input_buffer.buffer_length);
84 
85 
86      declare new_buf_size              fixed bin (21);
87 
88      declare new_data_buf_ptr          pointer;
89 
90      declare 1 new_data_buf            unaligned based (new_data_buf_ptr)
91                                        dimension (new_buf_size) like data_char;
92 
93      declare new_control_buf_ptr       pointer;
94 
95      declare 1 new_control_buf         unaligned based (new_control_buf_ptr)
96                                        dimension (new_buf_size) like control_entry;
97 
98      declare temp_data                 char(new_buf_size) based;
99 /* END INCLUDE FILE tc_input_buffer_ */