auto-sync
This commit is contained in:
parent
fffd151b67
commit
129f14cbcc
|
@ -241,5 +241,5 @@ void firmwareError(const char *fmt, ...) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int getRusEfiVersion(void) {
|
int getRusEfiVersion(void) {
|
||||||
return 20141009;
|
return 20141011;
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,8 @@
|
||||||
*
|
*
|
||||||
* TODO: there is too much copy-paste here, this class needs some refactoring :)
|
* TODO: there is too much copy-paste here, this class needs some refactoring :)
|
||||||
*
|
*
|
||||||
|
* see testConsoleLogic()
|
||||||
|
*
|
||||||
* @date Nov 15, 2012
|
* @date Nov 15, 2012
|
||||||
* @author Andrey Belomutskiy, (c) 2012-2014
|
* @author Andrey Belomutskiy, (c) 2012-2014
|
||||||
*/
|
*/
|
||||||
|
@ -151,6 +153,10 @@ static void echo(int value) {
|
||||||
print("got value: %d\r\n", value);
|
print("got value: %d\r\n", value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int findEndOfToken(const char *line) {
|
||||||
|
return indexOf(line, ' ');
|
||||||
|
}
|
||||||
|
|
||||||
void handleActionWithParameter(TokenCallback *current, char *parameter) {
|
void handleActionWithParameter(TokenCallback *current, char *parameter) {
|
||||||
if (current->parameterType == STRING_PARAMETER) {
|
if (current->parameterType == STRING_PARAMETER) {
|
||||||
VoidCharPtr callbackS = (VoidCharPtr) current->callback;
|
VoidCharPtr callbackS = (VoidCharPtr) current->callback;
|
||||||
|
@ -160,7 +166,7 @@ void handleActionWithParameter(TokenCallback *current, char *parameter) {
|
||||||
|
|
||||||
// todo: refactor this hell!
|
// todo: refactor this hell!
|
||||||
if (current->parameterType == STRING2_PARAMETER || current->parameterType == STRING2_PARAMETER_P) {
|
if (current->parameterType == STRING2_PARAMETER || current->parameterType == STRING2_PARAMETER_P) {
|
||||||
int spaceIndex = indexOf(parameter, ' ');
|
int spaceIndex = findEndOfToken(parameter);
|
||||||
if (spaceIndex == -1) {
|
if (spaceIndex == -1) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -181,7 +187,7 @@ void handleActionWithParameter(TokenCallback *current, char *parameter) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (current->parameterType == STRING3_PARAMETER) {
|
if (current->parameterType == STRING3_PARAMETER) {
|
||||||
int spaceIndex = indexOf(parameter, ' ');
|
int spaceIndex = findEndOfToken(parameter);
|
||||||
if (spaceIndex == -1) {
|
if (spaceIndex == -1) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -189,7 +195,7 @@ void handleActionWithParameter(TokenCallback *current, char *parameter) {
|
||||||
char * param0 = parameter;
|
char * param0 = parameter;
|
||||||
|
|
||||||
parameter += spaceIndex + 1;
|
parameter += spaceIndex + 1;
|
||||||
spaceIndex = indexOf(parameter, ' ');
|
spaceIndex = findEndOfToken(parameter);
|
||||||
if (spaceIndex == -1)
|
if (spaceIndex == -1)
|
||||||
return;
|
return;
|
||||||
parameter[spaceIndex] = 0;
|
parameter[spaceIndex] = 0;
|
||||||
|
@ -205,7 +211,7 @@ void handleActionWithParameter(TokenCallback *current, char *parameter) {
|
||||||
|
|
||||||
// todo: refactor this hell!
|
// todo: refactor this hell!
|
||||||
if (current->parameterType == STRING5_PARAMETER) {
|
if (current->parameterType == STRING5_PARAMETER) {
|
||||||
int spaceIndex = indexOf(parameter, ' ');
|
int spaceIndex = findEndOfToken(parameter);
|
||||||
if (spaceIndex == -1) {
|
if (spaceIndex == -1) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -213,21 +219,21 @@ void handleActionWithParameter(TokenCallback *current, char *parameter) {
|
||||||
char * param0 = parameter;
|
char * param0 = parameter;
|
||||||
|
|
||||||
parameter += spaceIndex + 1;
|
parameter += spaceIndex + 1;
|
||||||
spaceIndex = indexOf(parameter, ' ');
|
spaceIndex = findEndOfToken(parameter);
|
||||||
if (spaceIndex == -1)
|
if (spaceIndex == -1)
|
||||||
return;
|
return;
|
||||||
parameter[spaceIndex] = 0;
|
parameter[spaceIndex] = 0;
|
||||||
char * param1 = parameter;
|
char * param1 = parameter;
|
||||||
|
|
||||||
parameter += spaceIndex + 1;
|
parameter += spaceIndex + 1;
|
||||||
spaceIndex = indexOf(parameter, ' ');
|
spaceIndex = findEndOfToken(parameter);
|
||||||
if (spaceIndex == -1)
|
if (spaceIndex == -1)
|
||||||
return;
|
return;
|
||||||
parameter[spaceIndex] = 0;
|
parameter[spaceIndex] = 0;
|
||||||
char * param2 = parameter;
|
char * param2 = parameter;
|
||||||
|
|
||||||
parameter += spaceIndex + 1;
|
parameter += spaceIndex + 1;
|
||||||
spaceIndex = indexOf(parameter, ' ');
|
spaceIndex = findEndOfToken(parameter);
|
||||||
if (spaceIndex == -1)
|
if (spaceIndex == -1)
|
||||||
return;
|
return;
|
||||||
parameter[spaceIndex] = 0;
|
parameter[spaceIndex] = 0;
|
||||||
|
@ -243,7 +249,7 @@ void handleActionWithParameter(TokenCallback *current, char *parameter) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (current->parameterType == TWO_INTS_PARAMETER) {
|
if (current->parameterType == TWO_INTS_PARAMETER) {
|
||||||
int spaceIndex = indexOf(parameter, ' ');
|
int spaceIndex = findEndOfToken(parameter);
|
||||||
if (spaceIndex == -1)
|
if (spaceIndex == -1)
|
||||||
return;
|
return;
|
||||||
parameter[spaceIndex] = 0;
|
parameter[spaceIndex] = 0;
|
||||||
|
@ -277,7 +283,7 @@ void handleActionWithParameter(TokenCallback *current, char *parameter) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (current->parameterType == FLOAT_FLOAT_PARAMETER) {
|
if (current->parameterType == FLOAT_FLOAT_PARAMETER) {
|
||||||
int spaceIndex = indexOf(parameter, ' ');
|
int spaceIndex = findEndOfToken(parameter);
|
||||||
if (spaceIndex == -1)
|
if (spaceIndex == -1)
|
||||||
return;
|
return;
|
||||||
parameter[spaceIndex] = 0;
|
parameter[spaceIndex] = 0;
|
||||||
|
@ -390,7 +396,7 @@ static bool handleConsoleLineInternal(char *line, int lineLength) {
|
||||||
TokenCallback *current = &consoleActions[i];
|
TokenCallback *current = &consoleActions[i];
|
||||||
if (strEqual(line, current->token)) {
|
if (strEqual(line, current->token)) {
|
||||||
handleActionWithParameter(current, ptr);
|
handleActionWithParameter(current, ptr);
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,7 +68,7 @@ bool startsWith(const char *line, const char *prefix) {
|
||||||
|
|
||||||
int indexOf(const char *string, char ch) {
|
int indexOf(const char *string, char ch) {
|
||||||
// todo: there should be a standard function for this
|
// todo: there should be a standard function for this
|
||||||
// todo: on the other hand MISRA wants us not to use standart headers
|
// todo: on the other hand MISRA wants us not to use standard headers
|
||||||
int len = efiStrlen(string);
|
int len = efiStrlen(string);
|
||||||
for (int i = 0; i < len; i++) {
|
for (int i = 0; i < len; i++) {
|
||||||
if (string[i] == ch) {
|
if (string[i] == ch) {
|
||||||
|
|
Loading…
Reference in New Issue