Преглед изворни кода

Remove BROWSE and CASE

With the Visual Editor, BROWSE is of dubious value. Even before that,
it was of dubious value. It's the only user of the CASE word, which
is also of dubious value: too complicated for its own good.

The CMD pattern used in VE is much better.
master
Virgil Dupras пре 3 година
родитељ
комит
7a5744a4c3
8 измењених фајлова са 1 додато и 75 уклоњено
  1. +1
    -11
      blk/100
  2. +0
    -16
      blk/101
  3. +0
    -2
      blk/102
  4. +0
    -12
      blk/105
  5. +0
    -1
      blk/152
  6. +0
    -9
      blk/153
  7. +0
    -9
      blk/154
  8. +0
    -15
      tests/cvm/test_flow.fs

+ 1
- 11
blk/100 Прегледај датотеку

@@ -3,14 +3,4 @@ Block editor
This is an application to conveniently browse the contents of
the disk blocks and edit them. You can load it with "105 LOAD".

Browse mode: If you execute BROWSE, the Forth interpreter is
replaced by browser's loop. Typing "Q" quits the browser.

In this mode, typing a decimal number followed by space or
return lists the contents of that block. B for previous block,
N for next.

When not in browse mode, your prompt is a regular Forth prompt
with editor words loaded.

(cont.)
See doc/ed.txt

+ 0
- 16
blk/101 Прегледај датотеку

@@ -1,16 +0,0 @@
There are two buffers, IBUF (insert buffer) and FBUF (find
buffer). They are used as a typing target for the actions
described below. They both have a peculiar logic: when typing
is expected to fill a buffer, an empty value means "reuse
previous value". For example, typing "I foo I " inserts
"foofoo".

T ( n -- ): select line n for editing.
P xxx: put typed IBUF on selected line.
U xxx: insert typed IBUF on selected line.
F xxx: find typed FBUF in block, starting from current
position+1. If not found, don't move.
i xxx: insert typed IBUF at cursor. "i" is to avoid shadowing
core word "I".
Y: Copy n characters after cursor into IBUF, n being length of
FBUF. (cont.)

+ 0
- 2
blk/102 Прегледај датотеку

@@ -1,2 +0,0 @@
X ( n -- ): Delete X chars after cursor and place in IBUF.
E: Run X with n = length of FBUF.

+ 0
- 12
blk/105 Прегледај датотеку

@@ -1,14 +1,2 @@
'? CASE NOT [IF] 48 49 LOADR+ [THEN] DROP ( B153-154 )
'? FILL NOT [IF] 50 LOAD+ [THEN] DROP ( B155 )
1 7 LOADR+
: BROWSE
0 ACC ! L
BEGIN
KEY CASE
'Q' OF EXIT ENDOF
'B' OF B ENDOF
'N' OF N ENDOF
_NUM
ENDCASE
AGAIN
;

+ 0
- 1
blk/152 Прегледај датотеку

@@ -1,3 +1,2 @@
'? CASE NOT [IF] 1 2 LOADR+ [THEN] DROP ( from '? )
'? FILL NOT [IF] 3 LOAD+ [THEN] DROP
'? WIPE NOT [IF] 5 LOAD+ [THEN] DROP

+ 0
- 9
blk/153 Прегледај датотеку

@@ -1,9 +0,0 @@
( During a CASE, the stack grows by 1 at each ENDOF so that
we can fill all those ENDOF branching addrs. So that we
know when to stop, we put a 0 on PSP. That's our stopgap. )
: CASE 0 ; IMMEDIATE
: OF
COMPILE OVER COMPILE =
[COMPILE] IF COMPILE DROP
; IMMEDIATE
: ENDOF [COMPILE] ELSE ; IMMEDIATE

+ 0
- 9
blk/154 Прегледај датотеку

@@ -1,9 +0,0 @@
( At this point, we have something like "0 e1 e2 e3 val". We
want to drop val, and then call THEN as long as we don't
hit 0. )
: ENDCASE
BEGIN
?DUP NOT IF EXIT THEN
[COMPILE] THEN
AGAIN
; IMMEDIATE

+ 0
- 15
tests/cvm/test_flow.fs Прегледај датотеку

@@ -1,15 +0,0 @@
152 LOAD ( extra )
: foo
CASE
'X' OF 42 ENDOF
0x12 OF 43 ENDOF
255 OF 44 ENDOF
1+
ENDCASE
;

'X' foo 42 #eq
0x12 foo 43 #eq
255 foo 44 #eq
254 foo 255 #eq
'S S0 #eq

Loading…
Откажи
Сачувај