auto-sync
This commit is contained in:
parent
bb165822f3
commit
e6f9d4b98a
|
@ -9,6 +9,7 @@
|
|||
#ifndef FL_STACK_H_
|
||||
#define FL_STACK_H_
|
||||
|
||||
#include "main.h"
|
||||
#include "error_handling.h"
|
||||
|
||||
template<typename T, int MAXSIZE>
|
||||
|
@ -43,6 +44,11 @@ void FLStack<T, MAXSIZE>::reset() {
|
|||
|
||||
template<typename T, int MAXSIZE>
|
||||
void FLStack<T, MAXSIZE>::push(T value) {
|
||||
if(index >= MAXSIZE) {
|
||||
firmwareError("FLstack overflow");
|
||||
return;
|
||||
//warning()
|
||||
}
|
||||
values[index++] = value;
|
||||
}
|
||||
|
||||
|
@ -56,6 +62,7 @@ T FLStack<T, MAXSIZE>::pop() {
|
|||
|
||||
template<typename T, int MAXSIZE>
|
||||
T FLStack<T, MAXSIZE>::get(int index) {
|
||||
efiAssert(index >= 0 && index < MAXSIZE, "FLget", values[0]);
|
||||
return values[index];
|
||||
}
|
||||
|
||||
|
|
|
@ -296,7 +296,10 @@ bool isNumeric(const char* line) {
|
|||
return line[0] >= '0' && line[0] <= '9';
|
||||
}
|
||||
|
||||
const char *getNextToken(const char *line, char *buffer) {
|
||||
/**
|
||||
* @return pointer at the position after the consumed token, null if no token consumed
|
||||
*/
|
||||
const char *getNextToken(const char *line, char *buffer, const int bufferSize) {
|
||||
while (line[0] != 0 && line[0] == ' ') {
|
||||
line++;
|
||||
}
|
||||
|
@ -306,9 +309,9 @@ const char *getNextToken(const char *line, char *buffer) {
|
|||
int tokenLen = indexOf(line, ' ');
|
||||
if (tokenLen == -1) {
|
||||
// no space - the whole remaining line is the token
|
||||
strcpy(buffer, line);
|
||||
return line + strlen(buffer);
|
||||
tokenLen = strlen(line);
|
||||
}
|
||||
efiAssert(tokenLen < bufferSize, "token overflow", NULL);
|
||||
strncpy(buffer, line, tokenLen);
|
||||
buffer[tokenLen] = 0;
|
||||
line += tokenLen;
|
||||
|
@ -334,7 +337,7 @@ LEElement *LEElementPool::parseExpression(const char * line) {
|
|||
LEElement *last = NULL;
|
||||
|
||||
while (true) {
|
||||
line = getNextToken(line, parsingBuffer);
|
||||
line = getNextToken(line, parsingBuffer, sizeof(parsingBuffer));
|
||||
|
||||
if (line == NULL) {
|
||||
/**
|
||||
|
|
|
@ -109,7 +109,7 @@ public:
|
|||
*
|
||||
* @return pointer after the token
|
||||
*/
|
||||
const char *getNextToken(const char *line, char *buffer);
|
||||
const char *getNextToken(const char *line, char *buffer, const int bufferSize);
|
||||
bool isNumeric(const char* line);
|
||||
le_action_e parseAction(const char * line);
|
||||
|
||||
|
|
|
@ -32,7 +32,9 @@ EXTERN_ENGINE;
|
|||
#define CHART_RESET_DELAY 1
|
||||
#define MAX_ICU_COUNT 5
|
||||
|
||||
#if EFI_WAVE_CHART || defined(__DOXYGEN__)
|
||||
extern WaveChart waveChart;
|
||||
#endif
|
||||
extern bool hasFirmwareErrorFlag;
|
||||
|
||||
/**
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
#include "global.h"
|
||||
|
||||
#if EFI_WAVE_CHART
|
||||
#if EFI_WAVE_CHART || defined(__DOXYGEN__)
|
||||
#include "datalogging.h"
|
||||
|
||||
/**
|
||||
|
|
|
@ -27,19 +27,10 @@ typedef struct {
|
|||
IntListenerArray periodListeners;
|
||||
} WaveReaderHw;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif /* __cplusplus */
|
||||
|
||||
void initWaveAnalyzerDriver(WaveReaderHw *hw, brain_pin_e brainPin);
|
||||
void startInputDriver(WaveReaderHw *hw, bool isActiveHigh);
|
||||
ICUDriver * getInputCaptureDriver(brain_pin_e hwPin);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* WAVE_ANALYZER_HW_H_ */
|
||||
|
|
|
@ -46,15 +46,15 @@ static void testParsing(void) {
|
|||
assertFalse(strEqualCaseInsensitive("hello", "HElo2"));
|
||||
|
||||
const char *ptr;
|
||||
ptr = getNextToken(" hello ", buffer);
|
||||
ptr = getNextToken(" hello ", buffer, sizeof(buffer));
|
||||
assertTrue(strEqual("hello", buffer));
|
||||
|
||||
ptr = getNextToken("hello", buffer);
|
||||
ptr = getNextToken("hello", buffer, sizeof(buffer));
|
||||
assertTrue(strEqual("hello", buffer));
|
||||
|
||||
ptr = getNextToken(" hello world ", buffer);
|
||||
ptr = getNextToken(" hello world ", buffer, sizeof(buffer));
|
||||
assertTrue(strEqual("hello", buffer));
|
||||
ptr = getNextToken(ptr, buffer);
|
||||
ptr = getNextToken(ptr, buffer, sizeof(buffer));
|
||||
assertTrue(strEqual("world", buffer));
|
||||
|
||||
assertTrue(isNumeric("123"));
|
||||
|
|
Loading…
Reference in New Issue