Getting Phase 6 almost complete

+- StringUtils.c, StringUtils.h
+- Phase6_Prep.c

Notes: Fix the substring functions. may be a problem with any of the substring functions.
This commit is contained in:
Charles Descamps 2024-01-07 21:22:07 -07:00
parent fd87d9a54d
commit cb03243373
3 changed files with 363 additions and 155 deletions

View file

@ -21,7 +21,7 @@ Function output/parameters: c-style string (char *)
Function output/returned: NONE
Device input/---: NONE
Device output/---: NONE
Dependencies: getStringLength
Dependencies: malloc, free, getStringLength
*/
void catString(char *outString, const char *inString);
@ -56,35 +56,6 @@ Dependencies: getStringLength
*/
void copyString(char *outString, const char *inString);
/*
Name: getStringLength
Process: gets length of string from start to NULL_CHAR ('\0')
Function input/parameters: c-style string (char *)
Function output/parameters: NONE
Function output/returned: length of string (int)
Device input/---: NONE
Device output/---: NONE
Dependencies: included by standard libraries
*/
int getStringLength(const char *stringIn);
/*
Name: getSubString
Process: captures sub string within larger string
between two inclusive indices.
returns empty string if either index is out of range,
assumes enough memory in dest string
Function input/parameters: c-style string (char *)
start and end indices (int)
Function output/parameters: c-style destination string (char *)
Function output/returned: NONE
Device input/---: NONE
Device output/---: NONE
Dependencies: getStringLength, malloc, copyString, free
*/
void getSubString(char *destStr, const char *sourceStr,
int startIndex, int endIndex);
/*
Name: findSubString
Process: linear search for given substring within another string
@ -98,47 +69,7 @@ Device input/---: NONE
Device output/---: NONE
Dependencies: getStringLength
*/
int findSubString();
/*
Name: strToLowerCase
Process: iterates through string, sets any uppercase letter to lowercase
equivalent, does not affect any letter with an upper/lower diff.
Function input/parameters: c-style source string (char *)
Function output/parameters: c-style dest string (char *)
Function output/returned: NONE
Device input/---: NONE
Device output/---: NONE
Dependencies: toLowerCase
*/
void strToLowerCase();
/*
Name: toLowerCase
Process: sets character to lowercase letter if uppercase letter,
returns character
Function input/parameters: character input (char)
Function output/parameters: NONE
Function output/returned: character output (char)
Device input/---: NONE
Device output/---: NONE
Dependencies: none
*/
char toLowerCase();
/*
Name: getStringToDelimiter
Process: captures a string from the input stream to a specified delimiter.
will consume the delimiter.
Function input/parameters: input stream (FILE *),
stops at specified character
Function output/parameters: c-style string (char *)
Function output/returned: success of operation (bool)
Device input/---: NONE
Device output/---: NONE
Dependencies: getStringConstrained
*/
bool getStringToDelimiter(FILE *inStream, char delimiter, char *capString);
int findSubString(const char *testStr, const char *searchSubStr);
/*
Name: getStringConstrained
@ -159,6 +90,32 @@ bool getStringConstrained(FILE *inStream, bool clearLeadingNonPrintable,
bool clearLeadingSpace, bool stopAtNonPrintable,
char delimiter, char *capString);
/*
Name: getStringLength
Process: gets length of string from start to NULL_CHAR ('\0')
Function input/parameters: c-style string (char *)
Function output/parameters: NONE
Function output/returned: length of string (int)
Device input/---: NONE
Device output/---: NONE
Dependencies: included by standard libraries
*/
int getStringLength(const char *stringIn);
/*
Name: getStringToDelimiter
Process: captures a string from the input stream to a specified delimiter.
will consume the delimiter.
Function input/parameters: input stream (FILE *),
stops at specified character
Function output/parameters: c-style string (char *)
Function output/returned: success of operation (bool)
Device input/---: NONE
Device output/---: NONE
Dependencies: getStringConstrained
*/
bool getStringToDelimiter(FILE *inStream, char delimiter, char *capString);
/*
Name: getStringToLineEnd
Process: captures a string from the input stream to the end of the line
@ -171,4 +128,47 @@ Dependencies: getStringConstrained
*/
bool getStringToLineEnd(FILE *inStream, char *capString);
/*
Name: getSubString
Process: captures sub string within larger string
between two inclusive indices.
returns empty string if either index is out of range,
assumes enough memory in dest string
Function input/parameters: c-style string (char *)
start and end indices (int)
Function output/parameters: c-style destination string (char *)
Function output/returned: NONE
Device input/---: NONE
Device output/---: NONE
Dependencies: getStringLength, malloc, copyString, free
*/
void getSubString(char *destStr, const char *sourceStr,
int startIndex, int endIndex);
/*
Name: strToLowerCase
Process: iterates through string, sets any uppercase letter to lowercase
equivalent, does not affect any letter with an upper/lower diff.
Function input/parameters: c-style source string (char *)
Function output/parameters: c-style dest string (char *)
Function output/returned: NONE
Device input/---: NONE
Device output/---: NONE
Dependencies: toLowerCase
*/
void strToLowerCase(char *outString, const char *inString);
/*
Name: toLowerCase
Process: sets character to lowercase letter if uppercase letter,
returns character
Function input/parameters: character input (char)
Function output/parameters: NONE
Function output/returned: character output (char)
Device input/---: NONE
Device output/---: NONE
Dependencies: none
*/
char toLowerCase(char testChar);
#endif // STRINGUTILSPREP