Use 4 spaces for indentation.
authorHelmut Eller <eller.helmut@gmail.com>
Sat, 31 Dec 2016 08:53:11 +0000 (09:53 +0100)
committerHelmut Eller <eller.helmut@gmail.com>
Sat, 31 Dec 2016 08:53:11 +0000 (09:53 +0100)
* fth/save-input.fth (restore-column): Use ELSE instead of EXIT THEN.

fth/save-input.fth

index e966969..10f905a 100644 (file)
@@ -7,8 +7,10 @@ private{
 : save-buffer ( -- column source-id 2 ) >in @ source-id 2 ;
 
 : restore-column ( column -- flag )
 : save-buffer ( -- column source-id 2 ) >in @ source-id 2 ;
 
 : restore-column ( column -- flag )
-  source nip over < if drop true exit then
-  >in ! false
+    source nip over <
+    IF   drop  true
+    ELSE >in ! false
+    THEN
 ;
 
 \ Return the file-position of the beginning of the current line in
 ;
 
 \ Return the file-position of the beginning of the current line in
@@ -16,26 +18,26 @@ private{
 \ and that the current file-position is at an end-of-line (or
 \ end-of-file).
 : line-start-position ( -- ud )
 \ and that the current file-position is at an end-of-line (or
 \ end-of-file).
 : line-start-position ( -- ud )
-  source-id file-position throw
-  \ unless at end-of-file, subtract newline
-  source-id file-size throw 2over d= 0= if 1 s>d d- then
-  \ subtract line length
-  source nip s>d d-
+    source-id file-position throw
+    \ unless at end-of-file, subtract newline
+    source-id file-size throw 2over d= 0= IF 1 s>d d- THEN
+    \ subtract line length
+    source nip s>d d-
 ;
 
 : save-file ( column line filepos:ud source-id 5 -- )
 ;
 
 : save-file ( column line filepos:ud source-id 5 -- )
-  >in @
-  source-line-number@
-  line-start-position
-  source-id
-  5
+    >in @
+    source-line-number@
+    line-start-position
+    source-id
+    5
 ;
 
 : restore-file ( column line filepos:ud -- flag )
 ;
 
 : restore-file ( column line filepos:ud -- flag )
-  source-id reposition-file if 2drop true exit then
-  source-line-number!
-  refill 0= if drop true exit then
-  restore-column
+    source-id reposition-file  IF 2drop true exit THEN
+    refill                     0= IF 2drop true exit THEN
+    source-line-number!
+    restore-column
 ;
 
 : ndrop ( n*x n -- ) 0 ?do drop loop ;
 ;
 
 : ndrop ( n*x n -- ) 0 ?do drop loop ;
@@ -47,21 +49,21 @@ private{
 \ keyboard    >IN  SourceID=(0)   2
 \ file        >IN  lineNumber filePos  SourceID=(fileID) 5
 : SAVE-INPUT ( -- column {line filepos}? source-id n )
 \ keyboard    >IN  SourceID=(0)   2
 \ file        >IN  lineNumber filePos  SourceID=(fileID) 5
 : SAVE-INPUT ( -- column {line filepos}? source-id n )
-  source-id case
-    -1 of save-buffer endof
-    0  of save-buffer endof
-    drop save-file exit
-  endcase
+    source-id case
+       -1 of save-buffer endof
+       0  of save-buffer endof
+       drop save-file exit
+    endcase
 ;
 
 : RESTORE-INPUT ( column {line filepos}? source-id n -- flag )
 ;
 
 : RESTORE-INPUT ( column {line filepos}? source-id n -- flag )
-  over source-id <> if ndrop true exit then
-  drop
-  case
-    -1 of restore-column endof
-    0  of restore-column endof
-    drop restore-file exit
-  endcase
+    over source-id <> IF ndrop true exit THEN
+    drop
+    case
+       -1 of restore-column endof
+       0  of restore-column endof
+       drop restore-file exit
+    endcase
 ;
 
 privatize
 ;
 
 privatize