 |
Commander-API
V0.2A
Commander-API is a C API, that interprets character-based commands
|
Go to the documentation of this file.
10 #ifndef INTERPRETER_H_
11 #define INTERPRETER_H_
19 #define COMMANDER_API_VERSION "V0.2A"
27 #define ARDUINO_PLATFORM
29 #ifdef ARDUINO_PLATFORM
46 #define INTERPRETER_BUFFER_SIZE 30
63 #define NUM_OF_API_FUNCS 4
71 #define INTERPRETER_DBG printf
77 #define ARDUINP_PRINTF_BUFF_SIZE 150
79 #ifdef ARDUINO_PLATFORM
80 #undef INTERPRETER_DBG
81 #define INTERPRETER_DBG arduino_printf
90 #define INTERPRETER_PRINTF printf
92 #ifdef ARDUINO_PLATFORM
93 #undef INTERPRETER_PRINTF
94 #define INTERPRETER_PRINTF arduino_printf
109 void(*
func)(
char*,int(*resp_fn)(
const char*, ...));
201 void execute(
char *cmd,
int(*resp_fn)(
const char*, ...) );
struct API_t API_t
Structure for command data.
const char ** name
Definition: interpreter.h:107
Structure for command data.
Definition: interpreter.h:102
void optimise_api_tree(API_t *head)
Tree optimizer.
Definition: interpreter.c:369
uint16_t find_api_index_by_place(uint16_t place)
Finds an element in API tree by alphabetical order.
Definition: interpreter.c:324
void(* func)(char *, int(*resp_fn)(const char *,...))
Definition: interpreter.h:109
uint16_t place
Definition: interpreter.h:104
struct API_t * left
Definition: interpreter.h:105
void recursive_optimiser(int32_t start_index, int32_t stop_index)
Recorsive Optinizer function.
Definition: interpreter.c:402
void index_apis_in_order(API_t *head)
Indexes all elements in the tree.
Definition: interpreter.c:257
const char ** desc
Definition: interpreter.h:108
void print_apis_in_order(API_t *head)
Prints your commands.
Definition: interpreter.c:302
void init_interpreter(void)
This is the initialization function.
Definition: interpreter.c:139
int arduino_printf(const char *fmt,...)
If you use Arduino environment you have to include Arduino.h.
void execute(char *cmd, int(*resp_fn)(const char *,...))
Execution function.
Definition: interpreter.c:427
void recursive_indexer(API_t *head)
Indexes all elements in the tree.
Definition: interpreter.c:275
struct API_t * right
Definition: interpreter.h:106
void swap_api_elements(uint16_t index, uint16_t place)
Swap two elements in API tree.
Definition: interpreter.c:346
void add_interpreter_command(const char **name, const char **desc, void(*func)(char *, int(*resp_fn)(const char *,...)))
This command is used to add a new command to the interpreter.
Definition: interpreter.c:180