auto-sync

This commit is contained in:
rusEfi 2014-10-04 10:03:38 -05:00
parent c6cde9ee30
commit a629132ef1
5 changed files with 39 additions and 4 deletions

View File

@ -131,3 +131,23 @@ void LEElementPool::reset() {
LEElement *LEElementPool::next() {
return &pool[index++];
}
const char *processToken(const char *line, char *buffer) {
while (line[0] != 0 && line[0] == ' ') {
line++;
}
if (line[0] == 0) {
return NULL;
}
int tokenLen = indexOf(line, ' ');
if (tokenLen == -1) {
// no space - the whole remaining line is the token
strcpy(buffer, line);
return line + strlen(buffer);
}
strncpy(buffer, line, tokenLen);
buffer[tokenLen] = 0;
line += tokenLen;
return line;
}

View File

@ -72,4 +72,6 @@ private:
FLStack<float, MAX_STACK_DEPTH> stack;
};
const char *processToken(const char *line, char *buffer);
#endif /* LOGIC_EXPRESSION_H_ */

View File

@ -241,5 +241,5 @@ void firmwareError(const char *fmt, ...) {
}
int getRusEfiVersion(void) {
return 20141003;
return 20141004;
}

View File

@ -132,7 +132,7 @@ int main(void) {
testFLStack();
// resizeMap();
printf("Success 20131003\r\n");
printf("Success 20131004\r\n");
return EXIT_SUCCESS;
}

View File

@ -10,10 +10,25 @@
#include "main.h"
#include "test_logic_expression.h"
#include "logic_expression.h"
#include "cli_registry.h"
void testLogicExpressions(void) {
printf("*************************************************** testLogicExpressions\r\n");
char buffer[64];
const char *ptr;
ptr = processToken(" hello ", buffer);
assertTrue(strEqual("hello", buffer));
ptr = processToken("hello", buffer);
assertTrue(strEqual("hello", buffer));
ptr = processToken(" hello world ", buffer);
assertTrue(strEqual("hello", buffer));
ptr = processToken(ptr, buffer);
assertTrue(strEqual("world", buffer));
LECalculator c;
LEElement value1;
@ -22,7 +37,6 @@ void testLogicExpressions(void) {
assertEqualsM("123", 123.0, c.getValue());
LEElement value2;
value2.init(LE_NUMERIC_VALUE, 321.0);
c.add(&value2);
@ -61,7 +75,6 @@ void testLogicExpressions(void) {
e = pool.next();
e->init(LE_OPERATOR_OR);
/**
* fan = (not fan && coolant > 90) OR (fan && coolant > 85)
* fan = fan NOT coolant 90 AND more fan coolant 85 more AND OR