Polishing the CSV and Language Parser(s).

This commit is contained in:
2021-08-09 08:34:49 -07:00
parent 1f3f23a76e
commit 68986fd108
12 changed files with 382 additions and 149 deletions

View File

@ -78,4 +78,12 @@ void arraySortUint8(uint8_t *array, int32_t length) {
}
int32_t _arraySorterUint8(const void* left, const void* right) {
return *((uint8_t *)left) - *((uint8_t *)right);
}
int32_t arrayFindString(char **array, int32_t arrayLength, char *value) {
int32_t i;
for(i = 0; i < arrayLength; i++) {
if(strcmp(array[i], value) == 0) return i;
}
return -1;
}

View File

@ -89,4 +89,14 @@ int32_t _arraySorterInt32(const void *left, const void* right);
*/
void arraySortUint8(uint8_t *array, int32_t length);
/** Internal uint8_t array sorter. */
int32_t _arraySorterUint8(const void* left, const void* right);
int32_t _arraySorterUint8(const void* left, const void* right);
/**
* Find the index of a string within a string array. (Array of char pointers).
*
* @param array Array to check
* @param arrayLength Length of th earray.
* @param value The value to search for.
* @return The index that the strings exists within the array.
*/
int32_t arrayFindString(char **array, int32_t arrayLength, char *value);