46 lines
890 B
C
46 lines
890 B
C
#ifndef CLI_h
|
|
#define CLI_h
|
|
|
|
#include <stdbool.h>
|
|
|
|
#include <config.h>
|
|
#define HISTORY
|
|
|
|
#include "../CMDList/CMDList.h"
|
|
#include "../FIFOBuff/FIFOBuffChar.h"
|
|
#ifdef HISTORY
|
|
#include "../History/history.h"
|
|
#endif
|
|
|
|
typedef int (*CLI_charOutFn)(const char* c);
|
|
typedef enum {
|
|
CLI_State_Default,
|
|
CLI_State_Esc,
|
|
CLI_State_ANSIVT100
|
|
} CLI_State_t;
|
|
|
|
typedef struct CLI {
|
|
CLI_charOutFn CLI_charOut;
|
|
CMDList_t* CMDList;
|
|
FIFOBuffChar_t* FIFO;
|
|
#ifdef HISTORY
|
|
History_t* History;
|
|
#endif
|
|
CLI_State_t CLI_State;
|
|
} CLI_t;
|
|
|
|
// initilize and register the lineout print function
|
|
CLI_t CLI_init(CLI_charOutFn lineOut, CMDList_t* cmdList);
|
|
bool CLI_deinit(CLI_t* cli);
|
|
|
|
#ifdef HISTORY
|
|
extern void CLI_PrintHistory(CLI_t* cli);
|
|
#endif
|
|
|
|
// to recive a single caracter
|
|
bool CLI_charIn(CLI_t* cli, char c);
|
|
void CLI_charOut_save(CLI_t* cli, char ch);
|
|
void CLI_stringOut(CLI_t* cli, char* str);
|
|
|
|
|
|
#endif |