- view: text
- select for diffs
Sun Jan 7 17:22:13 1996 UTC
(25 years, 5 months ago) by anton
CVS tags: v0-4-0
added more.fs for people with old terminals.
WORDS and SEE now now respect the terminal size.
a lot of reordering in the Makefile, approaching the GNU standards.
factored NAME>STRING out of many words.
use AC_DECL_SYS_SIGLIST test in configure.in.
removed emitcounter (it was not used anyway).
SYSTEM now unpreps and repreps the terminal.
fixed byg in prims2x.fs.
added NEEDS, ?CSP, !CSP.
1: \ Forth output paging add-on (like more(1))
3: \ Copyright (C) 1996 Free Software Foundation, Inc.
5: \ This file is part of Gforth.
7: \ Gforth is free software; you can redistribute it and/or
8: \ modify it under the terms of the GNU General Public License
9: \ as published by the Free Software Foundation; either version 2
10: \ of the License, or (at your option) any later version.
12: \ This program is distributed in the hope that it will be useful,
13: \ but WITHOUT ANY WARRANTY; without even the implied warranty of
14: \ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15: \ GNU General Public License for more details.
17: \ You should have received a copy of the GNU General Public License
18: \ along with this program; if not, write to the Free Software
19: \ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22: \ This add-on is for those poor souls whose terminals cannot scroll
23: \ back but who want to read the output of 'words' at their leisure.
25: \ currently this is very primitive: it just counts newlines, and only
26: \ allows continuing for another page (and of course, terminating
27: \ processing by sending a signal (^C))
29: \ Some things to do:
30: \ allow continuing for one line (Enter)
31: \ count lines produced by wraparound (note tabs and backspaces)
32: \ allow continuing silently
33: \ fancy features like searching, scrollback etc.
35: \ one more-or-less simple way to achieve all this is to
36: \ popen("less","w") and output there. Before getting the next `key`,
37: \ we would perform a pclose. This idea due to Marcel Hendrix.
39: require termsize.fs
41: variable last-#lines 0 last-#lines !
43: :noname ( -- c )
44: 1 last-#lines !
45: defers key ;
46: is key
48: :noname ( c -- )
49: dup defers emit
50: #lf =
52: 1 last-#lines +!
53: last-#lines @ rows >=
55: ." ... more ?" key drop 10 backspaces 10 spaces 10 backspaces
57: endif ;
58: is emit
60: :noname ( c-addr u -- )
63: I c@ emit
64: LOOP ;
65: is type