<!-- Forthmacs Formatter generated HTML output -->
<html>
<head>
<title>Terminal Control</title>
</head>
<body>
<h1>Terminal Control</h1>
<hr>
<p>
This chapter lists the words for performing terminal operations such as moving 
the cursor, inserting or deleting lines, etc.  When writing programs you are 
advised to use only these user interface words.  
<p>
<p>
<h2>User interface words</h2>
<p>
 <code><A href="_smal_AG#246"> left </A></code> moves the cursor one character 
to the left 
<p>
 <code><A href="_smal_AS#2b2"> right </A></code> Moves the cursor one character 
to the right 
<p>
 <code><A href="_smal_BD#31b"> up </A></code> moves the cursor one line up 
<p>
 <code><A href="_smal_BG#1ce"> down </A></code> moves the cursor one line down 
<p>
 <code><A href="_smal_BW#23e"> kill-line </A></code> erases from the cursor to 
the end of the line 
<p>
 <code><A href="_smal_BX#23f"> kill-screen </A></code> erases from the cursor to 
the end of the screen 
<p>
 <code><A href="_smal_BH#22f"> insert-line </A></code> inserts a blank line at 
the cursor position 
<p>
 <code><A href="_smal_AL#1bb"> delete-line </A></code> deletes the line the 
cursor is on 
<p>
 <code><A href="_smal_AG#1e6"> erase-screen </A></code> erases the entire screen 
<p>
 <code><A href="_smal_AK#15a"> beep </A></code> rings the bell 
<p>
 <code><A href="_smal_AA#1b0"> dark </A></code> switches to inverse video 
<p>
 <code><A href="_smal_AJ#249"> light </A></code> switches to normal video 
<p>
 <code><A href="_smal_AF#155"> at </A></code> moves the cursor to a specified 
line and column 
<p>
 <code><A href="_smal_AG#156"> at? </A></code> gets the current output-cursor 
position 
<p>
 <code><A href="_smal_BH#7f"> #lines </A></code> returns the number of lines on 
the screen 
<p>
 <code><A href="_smal_BD#7b"> #columns </A></code> returns the number of columns 
on the screen 
<p>
 <code><A href="_smal_BM#1a4"> cursor-off </A></code> 
<p>
 <code><A href="_smal_BN#1a5"> cursor-on </A></code> 
<p>
 <code><A href="_smal_BQ#268"> marked </A></code> switches to 'marked' output 
i.e.  red-on-white by default.  
<p>
<p>
<h2>Terminals</h2>
<p>
All user interface terminal words are deferred via the  <code><A href="_smal_BK#2f2"> terminal: </A></code> 
definition itself.  This allowes support for lots of different output devices, 
serial interfaces, WIMP environment, text windows, VT220 devices can all be 
supported and are very easy to switch between.  
<p>
Just have a look at the defining of a WISE terminal <em>extend.terminal.wyse</em> 
: 
<p>
<p><pre>
    only forth also terminals definitions
    terminal: wyse
    prototype dumb
    for (right         ctl F ;
    for (at            esc Y   swap bl + (emit  bl + (emit  ;
    for (insert-char   esc q    (emit  esc r  ;
    for (delete-char   esc W ;
    for (kill-line     esc K ;
    for (kill-screen   esc k ;
    for (insert-line   esc M ;
    for (delete-line   esc l ;
    for (erase-screen  ctl L ;
    for dark           ctl N ;
    for light          ctl O ;
    : wyse-vp  wyse ;  : wv wyse ;
    only forth also terminals also forth definitions
    : wyse wyse ;
    only forth also definitions
</pre><p>
<p>
After this you only have to call 
<br><code>    wise</code><br>
and all the user interface words all call the wyse functions.  
<p>
NOTE: The  <code><A href="_smal_BK#2f2"> terminal: </A></code> will later also 
include the windowing functions.  All existing software should also run in the 
WIMP environment, the new functions won't be used in the text environment.  
<p>
</body>
</html>
