# libutils

Updated: 8/3/2020, 5:48:21 PM
Created: 8/3/2020, 5:48:21 PM
Last Updated By: Patrick Payne
Read Time: 1 minute(s)

Tags: terminal independence

The libutils shared library is provided to enable users to develop terminal independent code to handle keyboard input. For example:

* Include key definitions
INCLUDE jCmdKeys.h
* Initialize command key strings
CALL CommandInit
TimeOut = 150 ;* Set timeout value deciseconds
ECHO OFF
LOOP
    * Get Next Command Value
    CALL CommandNext(RetNo, RetString, TimeOut)
    * RetNo should match numbers in include/header file
    BEGIN CASE
        CASE RetNo = cmd_cursor_up
           CRT "Cursor up"
        CASE RetNo = cmd_cursor_down
           CRT "Cursor down"
        CASE RetNo = cmd_cursor_left
           CRT "Cursor left"
        CASE RetNo = cmd_cursor_right
           CRT "Cursor right"
        CASE RetNo = cmd_alpha_numeric
           CRT "Alpanumeric
        CASE RetNo = cmd_timeout
           CRT "Timeout"
           BREAK
    END CASE
    * Output the actual string returned
    CRT "RetString : " : OCONV(RetString,"MCP.")
REPEAT
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28

Back to Tools