// advanced_input_handling.h - useful input handling using
//                             callbacks and a dispatcher

#ifndef __advanced_input_handling_h__
#define __advanced_input_handling_h__

#define INPUT_DEBUG    0x04

#define MAX_LINE_LENGTH 1024
#define COMMAND_NOT_REGISTERED ELEMENT_NOT_EXISTING

void runInputLoop(void (*error_handler)(int error_type,
                                        void *special));
void stopInputLoop();
void addToDispatcher(unsigned char *command,
                     void (*command_destructor)(
                       void *command_str,
                       void (*error_handler)(int error_type,
                                             void *special)),
                     void (*handler)(
                       unsigned char *command,
                       unsigned char **params,
                       unsigned num_params),
                     void (*error_handler)(int error_type,
                                           void *special));

void setDefaultHandler(void (*handler)(unsigned char *command,
                                       unsigned char **params,
                                       unsigned num_params));

void removeFromDispatcher(unsigned char *command,
                          void (*error_handler)(int error_type,
                                                void *special));
void setPrompt(unsigned char *prompt,
               void (*destructor)(void *prompt,
                                  void (*error_handler)(
                                    int error_type,
                                    void *special)),
               void (*error_handler)(int error_type,
                                     void *special));

#endif // __advanced_input_handling_h__

