1 /*  START OF:       input_history_data.incl.pl1               *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  * */
  2 
  3 /****^  HISTORY COMMENTS:
  4   1) change(2016-03-27,GDixon), approve(2016-06-12,MCR10013),
  5      audit(2016-06-12,Swenson):
  6      Initial version of data structure for the input_history_.pl1 I/O module.
  7   2) change(2016-05-09,GDixon), approve(2016-06-12,MCR10013),
  8      audit(2016-06-12,Swenson):
  9      Adds new elements to ihData supporting input_history_ version 2 functions.
 10   3) change(2016-05-16,GDixon), approve(2016-06-12,MCR10013),
 11      audit(2016-06-12,Swenson):
 12      Adds new elements to ihData supporting input_history_ version 3 functions.
 13                                                    END HISTORY COMMENTS */
 14 
 15   dcl   ihDataP ptr;
 16   dcl  1 ihData aligned based(ihDataP),
 17 
 18        2 ioModule,                                          /* I/O module data required by iox_.                      */
 19          3 history_iocbP ptr,                               /* Pointer to input_history_ IOCB (often user_i/o)        */
 20                                                             /*  Identifies IOCB that owns this attach data structure. */
 21          3 source_iocbP ptr,                                /* Pointer to source (window_io_) IOCB                    */
 22                                                             /*  Our stream routines use it to get/put terminal chars. */
 23          3 source_is_window_io_ bit(1) aligned,             /* Flag indicating source is attached to window_io_.      */
 24                                                             /*  This permits adding input line editing requests to    */
 25                                                             /*  search/edit/re-enter lines from the history file.     */
 26          3 ioModulePad fixed bin,
 27          3 attach_descrip char(128) var,                    /* input_history_ I/O attach description.                 */
 28          3 open_descrip char(32) var,                       /* input_history_ open description.                       */
 29 
 30        2 hist,                                              /* Captured input lines (The History)                     */
 31 
 32          3 attachOpt,                                       /* History segment description from attach options.       */
 33            4 path_dir char(168) unal,                       /*  - directory containing this segment.                  */
 34            4 path_ename char(32) unal,                      /*  - entryname of this segment.                          */
 35            4 limit_linesN fixed bin(21),                    /*  - desired max lines kepts in this segment.            */
 36                                                             /*     - Actual lines may be greater, as we limit data    */
 37                                                             /*       movement within segment to 1 page at a time.     */
 38            4 attachOptPad fixed bin,
 39 
 40          3 segmentData,                                     /* Physical information about the history segment.        */
 41            4 segLockP ptr,                                  /*  - history lock segment (for permanent history)        */
 42            4 segP ptr,                                      /*  - baseptr of containing history segment.              */
 43            4 bc fixed bin(24),                              /*  - length of this segment (in bits).                   */
 44            4 segL fixed bin(21),                            /*  - length of this segment (in characters).             */
 45            4 linesN fixed bin(21),                          /*  - length of this segment (in lines).                  */
 46            4 scrollableL fixed bin(21),                     /*  - length of first page (in chars).                    */
 47                                                             /*     Note that if final scrollable line starts on first */
 48                                                             /*     page, and extends onto subsequent page(s),         */
 49                                                             /*     scrollableL include all characters of this line.   */
 50            4 scrollable_linesN fixed bin(21),               /*  - length of first page of this segment (in lines).    */
 51            4 extraLineL fixed bin(21),                      /*  - if >0: length of window_io_ editor line appended    */
 52                                                             /*    temporarily to History Segment.                     */
 53                                                             /*    Should be >0 only when in our XXX_search requests.  */
 54            4 flags aligned,
 55              5 permanent bit(1) unaligned,                  /*  - TRUE = permanent history segment; FALSE = temporary */
 56              5 debug bit(1) aligned,                        /*  - TRUE = trace operations on history segment.         */
 57              5 flags_pad bit(70) unaligned,
 58 
 59        2 edit,                                              /* Line editor request data saved between calls from the  */
 60                                                             /* window_io_ line editor.                                */
 61          3 currentLine aligned like historyLinePosition,    /*  - If linesFromEnd ^= 0, then this is history line     */
 62                                                             /*     when the prior editing request returned.           */
 63                                                             /*     Otherwise, it does not contain meaningful data.    */
 64                                                             /*      - Each time the window_io_ line editor returns an */
 65                                                             /*        input line (in iox_$get_line call), currentLine */
 66                                                             /*        is reset to END_OF_HISTORY.                     */
 67          3 whenEditing,                                     /*  Data valid only which running in an editor request.   */
 68            4 workingLine aligned like historyLinePosition,  /*  - This is position data used while an editing         */
 69                                                             /*     function runs.  It is constructed by editing fcn   */
 70                                                             /*     support routines.  Just before editing function    */
 71                                                             /*     returns, it is moved to currentLine.               */
 72            4 origEditorBuffer char(512) var,                /*  - Contents of line_editor_info.buffer when a history  */
 73                                                             /*     editing request first used in this invocation of   */
 74                                                             /*     the window line editor.  May need this to restore  */
 75                                                             /*     what user started typing before deciding to look   */
 76                                                             /*     back at prior input lines.  (^N eventually         */
 77                                                             /*     positions beyond end of History Segment, at which  */
 78                                                             /*     time this original buffer is given back to editor. */
 79            4 origCursorI fixed bin(21),                     /*  - Cursor position in line_editor_info.buffer when     */
 80                                                             /*     history edit request starts.                       */
 81 
 82        2 savedKeyBindingsP ptr;                             /* window_io_ line editor key bindings to be restored at  */
 83                                                             /*  detach time.                                          */
 84 
 85   dcl 1 historyLinePosition,                                /* Location identifier for lines in History Segment.      */
 86       2 linesFromEnd fixed bin(21),                         /* = 0  positioned just after last line in history seg.   */
 87                                                             /*      (at EOF, lineP may not be set)                    */
 88                                                             /* =-1  positioned at last (possibly incomplete) line.    */
 89                                                             /* =-2  positioned at 2nd-to-last,  (complete) line       */
 90                                                             /*      (Lines deemed "complete" when a line(-fragment)   */
 91                                                             /*       ending with NL is read via iox_$get_line.)       */
 92       2 lineL fixed bin(21),                                /* Length of this history line (not including any NL)     */
 93       2 lineP ptr,                                          /* Pointer to start of this history line.                 */
 94       2 cursorI fixed bin(21),                              /* Base_1 index of cursor within the line:                */
 95                                                             /*   assert: 0 < cursorI <= lineL+1   (AFTER end-of-line) */
 96       2 matchL fixed bin(21);                               /* Length of most recent matched string in this line.     */
 97                                                             /*   = 0, when line reached via ^P or ^N.                 */
 98                                   /* NOTE:  If lineI is the Base_1 index of line within entire History Segment, then  */
 99                                   /*          assert: lineI = hist.segmentData.linesN + linesFromEnd + 1              */
100 
101 
102   dcl 1 END_OF_HISTORY aligned int static options(constant),/* Special historyLinePosition that denotes start of a    */
103       2 linesFromEnd fixed bin(21) init(0),                 /*  window_io_ line editor invocation.  ih_get_line sets  */
104       2 lineL fixed bin(21)        init(0),                 /*  ihData.currentLine = END_OF_HISTORY each time a line  */
105       2 lineP ptr                  init(null()),            /*  (fragment) is read by the process.                    */
106       2 cursorI fixed bin(21)      init(1),
107       2 matchL fixed bin(21)       init(0);
108 
109   dcl 1 searchStackItem aligned,                            /* Item in the line editor request searchStack.           */
110       2 dir fixed bin(1),                                   /*  - search direction: -1 = REVERSE; +1 = FORWARD        */
111       2 search char(40) var,                                /*  - current searchString for the incremental search.    */
112       2 pos like historyLinePosition;                       /*  - position after search succeeded.                    */
113 
114   dcl 1 hLockSeg aligned based (ihData.hist.segmentData.segLockP),
115       2 lock_descriptor char(80),
116       2 history_path char(168),
117       2 lock_sentinel char(12),
118       2 lock_word bit(36),
119       2 lock_terminator char(28);
120 
121   dcl  hLockSegDESCRIPTOR char(80) aligned int static options(constant)
122           init("Please do not modify or delete this segment.
123 It contains the lock word for:
124     ");
125   dcl  hLockSegSENTINEL_LOCKED char(12) aligned int static options(constant) init("
126 
127    Lock:  ");
128   dcl  hLockSegSENTINEL_UNLOCKED char(12) aligned int static options(constant) init("
129 
130 Unlocked  ");
131   dcl  hLockSegTERMINATOR char(28) aligned int static options(constant) init("
132           ________________
133 ");
134 /*  END OF:         input_history_data.incl.pl1               *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  *  * */