Compare commits
No commits in common. "5076864bc2eab29832457f94c59cb6ae43c6bb31" and "5225520669e4667a8c6d6e0efd1a94b7d8fde6bc" have entirely different histories.
5076864bc2
...
5225520669
@ -1,6 +1,6 @@
|
|||||||
#include "CFGFileParser.h"
|
#include "CFGFileParser.h"
|
||||||
|
|
||||||
CFGFileParser::CFGFileParser(SDCardManager &sdCardManager, const char *file):AbstractParser(file), _state(LINE_BREAK), _type(PARAMETER), _quotedParameter(false), _quotedValue(false), _sdCardManager(sdCardManager)
|
CFGFileParser::CFGFileParser(SDCardManager &sdCardManager, const char *file):AbstractParser(file), _state(INIT), _type(PARAMETER), _quotedParameter(false), _quotedValue(false), _sdCardManager(sdCardManager)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -22,7 +22,7 @@ void *CFGFileParser::parseFile()
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
_state = LINE_BREAK;
|
_state = INIT;
|
||||||
while(file.available())
|
while(file.available())
|
||||||
{
|
{
|
||||||
readChar = (char)file.read();
|
readChar = (char)file.read();
|
||||||
@ -30,6 +30,24 @@ void *CFGFileParser::parseFile()
|
|||||||
//Do work
|
//Do work
|
||||||
switch(_state)
|
switch(_state)
|
||||||
{
|
{
|
||||||
|
case INIT:
|
||||||
|
if(readChar == '#') _state = COMMENT_SECTION;
|
||||||
|
else if((readChar >= 65 && readChar <= 90) || (readChar >= 97 && readChar <= 122) || (readChar >= 48 && readChar <= 57))
|
||||||
|
{
|
||||||
|
_state = PARAM_SECTION;
|
||||||
|
parsedParameter = addChar(parsedParameter, readChar);
|
||||||
|
if(parsedParameter == NULL)
|
||||||
|
_state = ERROR;
|
||||||
|
//printf("%c",readChar);
|
||||||
|
}
|
||||||
|
else if(readChar == '\'')
|
||||||
|
{
|
||||||
|
_state = OPENING_QUOTE;
|
||||||
|
_type = PARAMETER;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
_state = ERROR;
|
||||||
|
break;
|
||||||
case COMMENT_SECTION:
|
case COMMENT_SECTION:
|
||||||
if(readChar == '\r' || readChar == '\n') _state = LINE_BREAK;
|
if(readChar == '\r' || readChar == '\n') _state = LINE_BREAK;
|
||||||
break;
|
break;
|
||||||
@ -37,7 +55,7 @@ void *CFGFileParser::parseFile()
|
|||||||
if(readChar == '#')
|
if(readChar == '#')
|
||||||
_state = COMMENT_SECTION;
|
_state = COMMENT_SECTION;
|
||||||
else if(readChar == '\r' || readChar == '\n') _state = LINE_BREAK;
|
else if(readChar == '\r' || readChar == '\n') _state = LINE_BREAK;
|
||||||
else if((readChar >= 65 && readChar <= 90) || (readChar >= 97 && readChar <= 122) || (readChar >= 48 && readChar <= 57) || readChar == '-' || readChar == '_')
|
else if((readChar >= 65 && readChar <= 90) || (readChar >= 97 && readChar <= 122) || (readChar >= 48 && readChar <= 57))
|
||||||
{
|
{
|
||||||
_state = PARAM_SECTION;
|
_state = PARAM_SECTION;
|
||||||
//printf("%c",readChar);
|
//printf("%c",readChar);
|
||||||
@ -71,7 +89,7 @@ void *CFGFileParser::parseFile()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(readChar == ' ') _state = PARAM_SECTION;
|
else if(readChar == ' ') _state = PARAM_SECTION;
|
||||||
else if((readChar >= 65 && readChar <= 90) || (readChar >= 97 && readChar <= 122) || readChar == '_' || readChar == '-' || (readChar >= 48 && readChar <= 57))
|
else if((readChar >= 65 && readChar <= 90) || (readChar >= 97 && readChar <= 122) || readChar == '_' || (readChar >= 48 && readChar <= 57))
|
||||||
{
|
{
|
||||||
if(_type == PARAMETER)
|
if(_type == PARAMETER)
|
||||||
{
|
{
|
||||||
@ -99,7 +117,7 @@ void *CFGFileParser::parseFile()
|
|||||||
else
|
else
|
||||||
_quotedValue = true;
|
_quotedValue = true;
|
||||||
}
|
}
|
||||||
else if((readChar >= 65 && readChar <= 90) || (readChar >= 97 && readChar <= 122) || readChar == ' ' || readChar == '_' || readChar == '-' || (readChar >= 48 && readChar <= 57))
|
else if((readChar >= 65 && readChar <= 90) || (readChar >= 97 && readChar <= 122) || readChar == ' ' || readChar == '_' || (readChar >= 48 && readChar <= 57))
|
||||||
{
|
{
|
||||||
//printf("%c",readChar);
|
//printf("%c",readChar);
|
||||||
if(_type == PARAMETER)
|
if(_type == PARAMETER)
|
||||||
@ -122,7 +140,7 @@ void *CFGFileParser::parseFile()
|
|||||||
_type = VALUE;
|
_type = VALUE;
|
||||||
if(readChar == '\'')_state = OPENING_QUOTE;
|
if(readChar == '\'')_state = OPENING_QUOTE;
|
||||||
else if(readChar == ' ') _state = PARAM_SECTION;
|
else if(readChar == ' ') _state = PARAM_SECTION;
|
||||||
else if((readChar >= 65 && readChar <= 90) || (readChar >= 97 && readChar <= 122) || (readChar >= 48 && readChar <= 57) || readChar == '-' || readChar == '_')
|
else if((readChar >= 65 && readChar <= 90) || (readChar >= 97 && readChar <= 122) || (readChar >= 48 && readChar <= 57))
|
||||||
{
|
{
|
||||||
_state = PARAM_SECTION;
|
_state = PARAM_SECTION;
|
||||||
|
|
||||||
|
@ -35,7 +35,5 @@
|
|||||||
#define SOFT_VERSION "1.6.3" //Added a new api call to get nearby wifi access points
|
#define SOFT_VERSION "1.6.3" //Added a new api call to get nearby wifi access points
|
||||||
#define SOFT_VERSION "1.6.4" //Added the forceRefresh() method to the ScreenManager Object
|
#define SOFT_VERSION "1.6.4" //Added the forceRefresh() method to the ScreenManager Object
|
||||||
#define SOFT_VERSION "1.6.5" //Removed the sd card mount and unmount api calls, replaced with the sdCardAction api call which takes a parameter (does the same thing)
|
#define SOFT_VERSION "1.6.5" //Removed the sd card mount and unmount api calls, replaced with the sdCardAction api call which takes a parameter (does the same thing)
|
||||||
#define SOFT_VERSION "1.6.6" //Removed useless INIT state that was like the LINE_BREAK state and added '-' as an allowed PARAM and VALUE character
|
|
||||||
|
|
||||||
|
|
||||||
#endif //VERSIONS_H
|
#endif //VERSIONS_H
|
||||||
|
Loading…
Reference in New Issue
Block a user