Chapter 24. Terminal Handling with S-Lang


The S-Lang library, written by John E. Davis, provides midlevel access to terminals. It encapsulates all the low-level terminal handling through a set of routines that allow direct access to the video terminal and automatically handle scrolling and color. Although little direct support for windows is present and no widgets (or controls) are available in the S-Lang library, S-Lang provides a suitable base for such services.[1]

[1] One of the authors of this book has written a higher-level windowing toolkit based on S-Lang called newt, which is included with most Linux distributions.

S-Lang is also available under DOS, which makes it attractive for applications that must be built for both Unix and DOS platforms. John E. Davis based his jed editor on S-Lang, allowing it to work on a wide variety of platforms, including DOS.

S-Lang's terminal handling abilities fall into two categories. First, it provides a set of functions for reading keystrokes from the terminal in a controlled manner. Second, it provides routines for full-screen output to the terminal. These routines hide many terminal capabilities from the programmer but still take advantage of each terminal's abilities.[2] This chapter discusses how to use S-Lang in each of these capacities and ends with an example program that uses both.

[2] As described by the terminfo database.


    Linux Application Development
    Linux Application Development (paperback) (2nd Edition)
    ISBN: 0321563220
    EAN: 2147483647
    Year: 2003
    Pages: 168 © 2008-2017.
    If you may any questions please contact us: