Natural Tiny Shell (NT-Shell) library is a tiny shell library for a small embedded system. The interface is really simple. You should only know ntshell_execute in ntshell.h. So you can port it to any embedded system easily. Please enjoy your small embedded system with it. :)

Dependents:   NaturalTinyShell_TestProgram

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers vtparse.h Source File

vtparse.h

Go to the documentation of this file.
00001 /**
00002  * @file vtparse.h
00003  * @brief VTParse
00004  * @details
00005  * An implementation of Paul Williams' DEC compatible state machine parser
00006  * This code is in the public domain.
00007  * @author Joshua Haberman <joshua@reverberate.org>
00008  */
00009 
00010 #include "vtparse_table.h"
00011 
00012 #define MAX_INTERMEDIATE_CHARS 2
00013 #define ACTION(state_change) (vtparse_action_t)(state_change & 0x0F)
00014 #define STATE(state_change)  (vtparse_state_t)(state_change >> 4)
00015 
00016 struct vtparse;
00017 
00018 typedef void (*vtparse_callback_t)(struct vtparse*, vtparse_action_t, unsigned char);
00019 
00020 typedef struct vtparse {
00021     vtparse_state_t    state;
00022     vtparse_callback_t cb;
00023     unsigned char      intermediate_chars[MAX_INTERMEDIATE_CHARS+1];
00024     char               ignore_flagged;
00025     int                params[16];
00026     int                num_params;
00027     void*              user_data;
00028 } vtparse_t;
00029 
00030 void vtparse_init(vtparse_t *parser, vtparse_callback_t cb);
00031 void vtparse(vtparse_t *parser, unsigned char *data, int len);
00032