Nut/OS  4.10.3
API Reference
edline.h File Reference
#include <compiler.h>
#include <stdint.h>
Include dependency graph for edline.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  _EDITHISTORY
 Line input history. More...
struct  _EDLINE
 Edit line information structure. More...

Typedefs

typedef struct _EDITHISTORY EDITHISTORY
 Line input history.
typedef int(* EDLINEGET )(void *)
 Input routine type.
typedef int(* EDLINEPUT )(void *, int)
 Output routine type.
typedef int(* EDLINEMAP )(int, int *)
 Character mapping routine type.
typedef struct _EDLINE EDLINE
 Edit line information structure.

Functions

EDLINEEdLineOpen (uint16_t mode)
 Open a line editor.
void EdLineClose (EDLINE *el)
 Close a line editor.
int EdLineRead (EDLINE *el, char *buf, int siz)
 Read a line.
EDITHISTORYEditHistoryCreate (int siz)
 Create an editor history table.
void EditHistoryDestroy (EDITHISTORY *hist)
 Create an editor history table.
void EditHistorySet (EDITHISTORY *hist, int idx, char *buf)
 Replace the specified history table entry.
int EditHistoryGet (EDITHISTORY *hist, int idx, char *buf, int siz)
 Retrieve the specified history table entry.
void EditHistoryInsert (EDITHISTORY *hist, int idx, char *buf)
 Insert a new history table entry at the specified position.
void EdLineRegisterKeymap (EDLINE *el, EDLINEMAP map)
 Register a key mapping routine.
int EdLineKeyMap (int key, int *seq)
 Default key mapping routine.
int EdLineKeyMapVt100 (int key, int *seq)
 Optional VT100 key mapping routine.
void EdLineRegisterInput (EDLINE *el, EDLINEGET get, void *iparm)
 Register an input routine.
void EdLineRegisterOutput (EDLINE *el, EDLINEPUT put, void *oparm)
 Register an output routine.

Edit mode flags

Used when calling EdLineOpen to enable specific line editor features.

#define EDIT_MODE_ECHO   0x0001
 Enables echoing of input characters.
#define EDIT_MODE_BINARY   0x0002
 Enables binary mode (currently unused).
#define EDIT_MODE_HISTORY   0x0004
 Enables input line history.

Line editor input commands

Special keys which are interpreted by the editor as commands.

#define EDIT_KEY_IGNORE   0x00
 No operation. Default is Ctrl-@.
#define EDIT_KEY_HOME   0x01
 Move cursor to line begin. Default is Ctrl-A.
#define EDIT_KEY_LEFT   0x02
 Move cursor left. Default is Ctrl-B.
#define EDIT_KEY_END   0x05
 Move cursor to line end. Default is Ctrl-E.
#define EDIT_KEY_RIGHT   0x06
 Move cursor right. Default is Ctrl-F.
#define EDIT_KEY_REMOVE   0x08
 Delete left character. Default is Ctrl-H.
#define EDIT_KEY_ENTER   0x0a
 Confirm input. Default is Ctrl-J.
#define EDIT_KEY_UP   0x12
 History upwards. Default is Ctrl-R.
#define EDIT_KEY_DOWN   0x16
 History downwards. Default is Ctrl-V.
#define EDIT_KEY_RESTORE   0x1b
 Restore default. Default is ESC.

Line editor output commands

Special characters used by the editor to update the output.

#define EDIT_CHAR_SPACE   ' '
 Clear character right.
#define EDIT_CHAR_BACKSPACE   '\b'
 Move cursor left.
#define EDIT_CHAR_ALARM   '\a'
 Invoke audible alarm.
#define EDIT_STR_EOL   "\r\n"
 Terminate input.