1 (* Copyright (C) DooM 2D:Forever Developers
2 *
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 3 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *)
16 {$MODE OBJFPC}
19 interface
34 // get last line
36 // move one line up; `sp` and `ep` MUST be valid values from previous call to `cbufLastLine()`
42 implementation
45 // ////////////////////////////////////////////////////////////////////////// //
46 //const ConBufSize = 64;
49 // each line in buffer ends with '\n'; we don't keep offsets or lengthes, as
50 // it's fairly easy to search in buffer, and drawing console is not a common
51 // thing, so it doesn't have to be superfast.
52 var
62 // ////////////////////////////////////////////////////////////////////////// //
63 {$IFDEF HEADLESS}
64 var
66 {$ENDIF}
68 var
71 begin
73 begin
74 {$IFDEF HEADLESS}
75 //write(stderr, 'CON: ');
77 begin
82 {$ENDIF}
86 begin
92 begin
93 // we have to make some room; delete top line for this
95 begin
109 begin
114 // ////////////////////////////////////////////////////////////////////////// //
115 // warning! don't modify conbuf while the range is active!
124 // ////////////////////////////////////////////////////////////////////////// //
126 var
128 begin
130 begin
133 exit;
138 begin
148 var
150 begin
153 if (pos = cbufhead) or (cbuf[pos] <> #10) then begin sp := cbufhead; ep := cbufhead+1; result := false; exit; end;
156 begin
167 begin
176 begin