-
Notifications
You must be signed in to change notification settings - Fork 1
/
parser.h
51 lines (44 loc) · 899 Bytes
/
parser.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/*
* Written 2014 by Bill Westfield (WestfW)
* Released to the public domain.
*/
#include "Arduino.h"
/*
* API
*/
uint8_t parseGetline(void);
uint8_t parseGetline_nb(void);
void parseReset(void);
char *parseToken(void);
int parseNumber();
int8_t parseKeyword(const char *keys);
/*
* Constants
*/
#define PARSER_LINELEN 80
#define PARSER_NOMATCH -1
#define PARSER_EOL -2
/*
* Internals
*/
char getcwait(void);
bool substrdcmp(char *cmd, char *line);
bool parseIsWhitespace(char c);
bool parseDelim(char c);
bool parserEOL();
char *tokcasecmp(char *tok, char * target);
#define TOUPPER(a) ((a >= 'a' && a <= 'z') ? (a & ~('a'-'A')) : a)
#define CTRL(x) (x-64)
#ifdef NOT_READY
class cmd_t {
private:
static cmd_t *head;
const char *text;
void *(*func)(char *);
cmd_t *next;
public:
cmd_t();
cmd_t(const char *t, void*(*f)(char *));
void dump();
};
#endif