Lines Matching +full:data +full:- +full:lines

1 /*-
2 * SPDX-License-Identifier: BSD-3-Clause
4 * Copyright (c) 1999 Kazutaka YOKOTA <yokota@zodiac.mech.utsunomiya-u.ac.jp>
5 * Copyright (c) 1992-1998 Søren Schmidt
26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
78 = SC_MAX_HISTORY_SIZE - SC_HISTORY_SIZE*MAXCONS;
86 sc_alloc_history_buffer(scr_stat *scp, int lines, int prev_ysize, int wait) in sc_alloc_history_buffer() argument
90 * SC_HISTORY_SIZE lines or scp->ysize lines, whichever in sc_alloc_history_buffer()
98 int delta; /* lines to put back */ in sc_alloc_history_buffer()
100 if (lines <= 0) in sc_alloc_history_buffer()
101 lines = SC_HISTORY_SIZE; /* use the default value */ in sc_alloc_history_buffer()
104 lines = imax(lines, scp->ysize); in sc_alloc_history_buffer()
107 history = prev_history = scp->history; in sc_alloc_history_buffer()
108 scp->history = NULL; in sc_alloc_history_buffer()
110 /* calculate the amount of lines to put back to extra_history_size */ in sc_alloc_history_buffer()
116 delta = cur_lines - min_lines; in sc_alloc_history_buffer()
119 /* lines up to min_lines are always allowed. */ in sc_alloc_history_buffer()
120 min_lines = imax(SC_HISTORY_SIZE, scp->ysize); in sc_alloc_history_buffer()
121 if (lines > min_lines) { in sc_alloc_history_buffer()
122 if (lines - min_lines > extra_history_size + delta) { in sc_alloc_history_buffer()
123 /* too many lines are requested */ in sc_alloc_history_buffer()
124 scp->history = prev_history; in sc_alloc_history_buffer()
134 if (lines > min_lines) in sc_alloc_history_buffer()
135 extra_history_size -= lines - min_lines; in sc_alloc_history_buffer()
137 sc_vtb_init(history, VTB_RINGBUFFER, scp->xsize, lines, in sc_alloc_history_buffer()
140 sc_vtb_clear(history, scp->sc->scr_map[0x20], in sc_alloc_history_buffer()
144 scp->history_pos = sc_vtb_tail(history); in sc_alloc_history_buffer()
146 scp->history_pos = 0; in sc_alloc_history_buffer()
156 scp->history = history; in sc_alloc_history_buffer()
164 int lines; in copy_history() local
171 lines = sc_vtb_rows(from); in copy_history()
176 for (i = 0; i < lines; ++i) { in copy_history()
181 cols2 - cols)); in copy_history()
193 history = scp->history; in sc_free_history_buffer()
194 scp->history = NULL; in sc_free_history_buffer()
201 cur_lines - min_lines : 0; in sc_free_history_buffer()
211 sc_vtb_append(&scp->vtb, 0, scp->history, scp->xsize*scp->ysize); in sc_hist_save()
212 scp->history_pos = sc_vtb_tail(scp->history); in sc_hist_save()
221 if (scp->history_pos != sc_vtb_tail(scp->history)) { in sc_hist_restore()
222 scp->history_pos = sc_vtb_tail(scp->history); in sc_hist_restore()
228 sc_vtb_seek(scp->history, sc_vtb_pos(scp->history, in sc_hist_restore()
229 sc_vtb_tail(scp->history), in sc_hist_restore()
230 -scp->xsize*scp->ysize)); in sc_hist_restore()
234 /* copy screen-full of saved lines */
241 pos = scp->history_pos; in history_to_screen()
242 for (i = 1; i <= scp->ysize; ++i) { in history_to_screen()
243 pos = sc_vtb_pos(scp->history, pos, -scp->xsize); in history_to_screen()
244 sc_vtb_copy(scp->history, pos, in history_to_screen()
245 &scp->vtb, scp->xsize*(scp->ysize - i), in history_to_screen()
246 scp->xsize); in history_to_screen()
255 scp->history_pos = sc_vtb_tail(scp->history); in sc_hist_home()
263 scp->history_pos = sc_vtb_pos(scp->history, sc_vtb_tail(scp->history), in sc_hist_end()
264 scp->xsize*scp->ysize); in sc_hist_end()
272 if (sc_vtb_pos(scp->history, scp->history_pos, -(scp->xsize*scp->ysize)) in sc_hist_up_line()
273 == sc_vtb_tail(scp->history)) in sc_hist_up_line()
274 return -1; in sc_hist_up_line()
275 scp->history_pos = sc_vtb_pos(scp->history, scp->history_pos, in sc_hist_up_line()
276 -scp->xsize); in sc_hist_up_line()
285 if (scp->history_pos == sc_vtb_tail(scp->history)) in sc_hist_down_line()
286 return -1; in sc_hist_down_line()
287 scp->history_pos = sc_vtb_pos(scp->history, scp->history_pos, in sc_hist_down_line()
288 scp->xsize); in sc_hist_down_line()
294 sc_hist_ioctl(struct tty *tp, u_long cmd, caddr_t data, struct thread *td) in sc_hist_ioctl() argument
302 if (*(int *)data <= 0) in sc_hist_ioctl()
304 if (scp->status & BUFFER_SAVED) in sc_hist_ioctl()
306 DPRINTF(5, ("lines:%d, ysize:%d, pool:%d\n", in sc_hist_ioctl()
307 *(int *)data, scp->ysize, extra_history_size)); in sc_hist_ioctl()
309 imax(*(int *)data, scp->ysize), in sc_hist_ioctl()
310 scp->ysize, TRUE); in sc_hist_ioctl()
312 sc_vtb_rows(scp->history), extra_history_size)); in sc_hist_ioctl()
317 sc_vtb_clear(scp->history, scp->sc->scr_map[0x20], in sc_hist_ioctl()