auto-sync

This commit is contained in:
rusEfi 2014-11-18 15:03:12 -06:00
parent af1e1c3d1e
commit 2e4c6c6f76
4 changed files with 11 additions and 8 deletions

View File

@ -243,7 +243,7 @@ le_action_e parseAction(const char * line) {
static char parsingBuffer[64];
LEElement * parseExpression(LEElementPool *pool, const char * line) {
LEElement *LEElementPool::parseExpression(const char * line) {
LEElement *first = NULL;
LEElement *last = NULL;
@ -258,7 +258,7 @@ LEElement * parseExpression(LEElementPool *pool, const char * line) {
return first;
}
LEElement *n = pool->next();
LEElement *n = next();
if (isNumeric(parsingBuffer)) {
n->init(LE_NUMERIC_VALUE, atoff(parsingBuffer));
@ -288,11 +288,14 @@ LEElement * parseExpression(LEElementPool *pool, const char * line) {
#if (EFI_PROD_CODE || EFI_SIMULATOR)
static void eval(char *line, Engine *engine) {
evalPool.reset();
evalPool.parseExpression(line);
}
void initEval(Engine *engine) {
addConsoleActionSP("evan", (VoidCharPtrVoidPtr)eval, engine);
addConsoleActionSP("eval", (VoidCharPtrVoidPtr)eval, engine);
}
#endif

View File

@ -59,6 +59,7 @@ public:
LEElement *pool;
LEElement *next();
void reset();
LEElement * parseExpression(const char * line);
private:
int index;
int size;
@ -99,7 +100,6 @@ public:
const char *getNextToken(const char *line, char *buffer);
bool isNumeric(const char* line);
le_action_e parseAction(const char * line);
LEElement * parseExpression(LEElementPool *pool, const char * line);
void initEval(Engine *engine);
#endif /* LOGIC_EXPRESSION_H_ */

View File

@ -400,7 +400,7 @@ void initEngineContoller(Engine *engine) {
#endif
#if EFI_FUEL_PUMP
fuelPumpLogic = parseExpression(&lePool, FUEL_PUMP_LOGIC);
fuelPumpLogic = lePool.parseExpression(FUEL_PUMP_LOGIC);
#endif
addConsoleAction("analoginfo", printAnalogInfo);

View File

@ -62,7 +62,7 @@ static void testParsing(void) {
LEElementPool pool(thepool, TEST_POOL_SIZE);
LEElement *element;
element = parseExpression(&pool, "1 3 AND not");
element = pool.parseExpression("1 3 AND not");
assertTrue(element != NULL);
assertEquals(element->action, LE_NUMERIC_VALUE);
@ -86,7 +86,7 @@ static void testExpression(const char *line, float expected) {
LEElement thepool[TEST_POOL_SIZE];
LEElementPool pool(thepool, TEST_POOL_SIZE);
pool.reset();
LEElement * element = parseExpression(&pool, line);
LEElement * element = pool.parseExpression(line);
print("Parsing [%s]", line);
assertTrueM("Not NULL expected", element != NULL);
LECalculator c;
@ -148,7 +148,7 @@ void testLogicExpressions(void) {
pool.reset();
LEElement *element;
element = parseExpression(&pool, "fan no_such_method");
element = pool.parseExpression("fan no_such_method");
assertTrueM("NULL expected", element == NULL);