Luca Jel
/
mbed5a_testy
sdsd
Fork of mbed5a_testy by
command_decoder.h@2:0fcc9b85c8f6, 2017-06-20 (annotated)
- Committer:
- deerjelen
- Date:
- Tue Jun 20 16:02:06 2017 +0000
- Revision:
- 2:0fcc9b85c8f6
- Parent:
- 1:b8d65b5745d1
xcx
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Robsonik16 | 0:e69a0b7f4b41 | 1 | |
Robsonik16 | 0:e69a0b7f4b41 | 2 | enum KeywordCode {CALLIB,GOTO,STEP,ID}; |
Robsonik16 | 0:e69a0b7f4b41 | 3 | enum TokenType { KEYWORD, NUMBER, STRING}; |
Robsonik16 | 0:e69a0b7f4b41 | 4 | |
Robsonik16 | 0:e69a0b7f4b41 | 5 | #define MAX_TOKEN_NR 2 |
Robsonik16 | 0:e69a0b7f4b41 | 6 | #define MAX_KEYWORD_STRING_LTH 15 |
Robsonik16 | 0:e69a0b7f4b41 | 7 | #define MAX_KEYWORD_NR 4 |
Robsonik16 | 0:e69a0b7f4b41 | 8 | |
Robsonik16 | 0:e69a0b7f4b41 | 9 | union TokenValue |
Robsonik16 | 0:e69a0b7f4b41 | 10 | { |
Robsonik16 | 0:e69a0b7f4b41 | 11 | enum KeywordCode eKeyword; |
Robsonik16 | 0:e69a0b7f4b41 | 12 | unsigned int uiNumber; |
Robsonik16 | 0:e69a0b7f4b41 | 13 | char *pcString; |
Robsonik16 | 0:e69a0b7f4b41 | 14 | }; |
Robsonik16 | 0:e69a0b7f4b41 | 15 | |
Robsonik16 | 0:e69a0b7f4b41 | 16 | struct Token |
Robsonik16 | 0:e69a0b7f4b41 | 17 | { |
Robsonik16 | 0:e69a0b7f4b41 | 18 | enum TokenType eType; |
Robsonik16 | 0:e69a0b7f4b41 | 19 | union TokenValue uValue; |
Robsonik16 | 0:e69a0b7f4b41 | 20 | }; |
Robsonik16 | 0:e69a0b7f4b41 | 21 | |
Robsonik16 | 0:e69a0b7f4b41 | 22 | struct Keyword |
Robsonik16 | 0:e69a0b7f4b41 | 23 | { |
Robsonik16 | 0:e69a0b7f4b41 | 24 | enum KeywordCode eCode; |
Robsonik16 | 0:e69a0b7f4b41 | 25 | char cString[MAX_KEYWORD_STRING_LTH + 1]; |
Robsonik16 | 0:e69a0b7f4b41 | 26 | }; |
Robsonik16 | 0:e69a0b7f4b41 | 27 | |
Robsonik16 | 0:e69a0b7f4b41 | 28 | |
Robsonik16 | 0:e69a0b7f4b41 | 29 | extern struct Keyword asKeywordList[MAX_KEYWORD_NR]; |
Robsonik16 | 0:e69a0b7f4b41 | 30 | extern struct Token asToken[MAX_TOKEN_NR]; |
Robsonik16 | 0:e69a0b7f4b41 | 31 | extern unsigned char ucTokenNr; |
Robsonik16 | 0:e69a0b7f4b41 | 32 | |
Robsonik16 | 0:e69a0b7f4b41 | 33 | void DecodeMsg(char *pcString); |