Annotation of gforth/kernel/saccept.fs, revision 1.17
1.1 anton 1: \ a very simple accept approach
2:
1.16 anton 3: \ Copyright (C) 1995,1996,1997,1998,1999,2000,2003,2006,2007 Free Software Foundation, Inc.
1.1 anton 4:
5: \ This file is part of Gforth.
6:
7: \ Gforth is free software; you can redistribute it and/or
8: \ modify it under the terms of the GNU General Public License
1.15 anton 9: \ as published by the Free Software Foundation, either version 3
1.1 anton 10: \ of the License, or (at your option) any later version.
11:
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.
16:
17: \ You should have received a copy of the GNU General Public License
1.15 anton 18: \ along with this program. If not, see http://www.gnu.org/licenses/.
1.1 anton 19:
1.4 jwilke 20: require ./io.fs
21:
1.10 pazsan 22: \ : xon $11 emit ;
23: \ : xoff $13 emit ;
24:
1.12 pazsan 25: Variable eof
26: Variable echo -1 echo !
27:
1.2 pazsan 28: : accept ( adr len -- len )
1.12 pazsan 29: ( xon ) over + over ( start end pnt ) eof off
1.1 anton 30: BEGIN
1.2 pazsan 31: key dup #del = IF drop #bs THEN
1.1 anton 32: dup bl u<
1.12 pazsan 33: IF
34: dup #cr = over #lf = or IF
35: echo @ IF space THEN drop nip swap - ( xoff ) EXIT THEN
36: dup #eof = IF eof on THEN
1.13 pazsan 37: #bs = IF 2 pick over <>
1.12 pazsan 38: IF 1 chars -
39: echo @ IF #bs emit bl emit #bs emit THEN
40: ELSE echo @ IF bell THEN THEN THEN
41: ELSE >r 2dup <> IF r>
42: echo @ IF dup emit THEN
43: over c! char+ ELSE r> drop bell THEN
1.1 anton 44: THEN
45: AGAIN ;
46:
1.17 ! pazsan 47: : refill-loop ( -- )
! 48: BEGIN 3 emit refill WHILE interpret REPEAT ;
! 49: : included ( addr u -- )
! 50: 2 emit dup $20 + emit type
! 51: echo @ IF
! 52: echo off ['] refill-loop catch
! 53: dup IF 4 emit THEN echo on throw
! 54: THEN ;
! 55: : include ( "file" -- ) parse-name included ;
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>