-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial commit, established some basic
- Loading branch information
Showing
4 changed files
with
101 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
PROGRAM = StringC | ||
FILES.c = test/StringCTest.c src/StringC.c ../lib/unity.c | ||
FILES.h = StringC.h ../lib/unity.h ../lib/unity_internals.h | ||
FILES.o = ${FILES.c:.c=.o} | ||
|
||
CC = gcc | ||
SFLAGS = -std=c99 | ||
GFLAGS = -g | ||
OFLAGS = -O0 | ||
DFLAGS = -I/src | ||
WFLAG1 = -Wall | ||
WFLAG2 = -Wextra | ||
WFLAG3 = -Werror | ||
WFLAG4 = -Wstrict-prototypes | ||
WFLAG5 = -Wmissing-prototypes | ||
WFLAGS = ${WFLAG1} ${WFLAG2} ${WFLAG3} ${WFLAG4} ${WFLAG5} | ||
UFLAGS = # Set on command line only | ||
|
||
CFLAGS = ${SFLAGS} ${GFLAGS} ${OFLAGS} ${WFLAGS} ${UFLAGS} ${DFLAGS} | ||
LDFLAGS = -lm | ||
LDLIBS = | ||
|
||
all: ${PROGRAM} | ||
|
||
${PROGRAM}: ${FILES.o} | ||
${CC} -o $@ ${CFLAGS} ${FILES.o} ${LDFLAGS} ${LDLIBS} | ||
|
||
StringCTest.o: ${FILES.h} | ||
StringC.o: ${FILES.h} | ||
unity.o: ${FILES.h} | ||
unity_internals.o: ${FILES.h} | ||
|
||
# If it exists, prog1.dSYM is a directory on macOS | ||
DEBRIS = a.out core *~ *.dSYM | ||
RM_FR = rm -fr | ||
|
||
clean: | ||
${RM_FR} ${FILES.o} ${PROGRAM} ${DEBRIS} test/StringCTest.o test/unity.o | ||
|
||
TEST = ./StringCTest | ||
|
||
test: | ||
${TEST} |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
/** | ||
* @file StringC.h | ||
* @author Kevin Pluas ([email protected]) | ||
* @brief Interface for StringC | ||
* @version 0.1 | ||
* @date 2023-05-07 | ||
* | ||
* @copyright Copyright (c) 2023 | ||
* | ||
*/ | ||
|
||
#include<stddef.h> | ||
|
||
#define NULL_CHAR '/0' | ||
|
||
/** | ||
* @brief The main container for our string object. | ||
* | ||
* @var StringC::length | ||
* The size/length of our string | ||
* | ||
* @var StringC::max_size | ||
* The maximum capacity of our string | ||
* | ||
* @var StringC::buff | ||
* The sequence of characters that actually define our StringC string | ||
* | ||
*/ | ||
typedef struct StringC { | ||
size_t length; | ||
size_t max_size; | ||
char *buff; | ||
}StringC; | ||
|
||
/** | ||
* @brief Initializes the StringC container | ||
* | ||
* @param inital_string The initial string that will be contained within StringC. Can be an empty string. | ||
* @return StringC* | ||
*/ | ||
StringC *StringC_init(const char *inital_string); | ||
|
||
/** | ||
* @brief Converts all alphabetical characters in a StringC string to its uppercase equivalent | ||
* | ||
* @param stringc A valid pointer to a StringC container | ||
* @return The converted string | ||
*/ | ||
char *StringC_to_upper(StringC *stringc); | ||
|
||
/** | ||
* @brief Converts all alphabetical characters in a StringC string to its lowercase equivalent | ||
* | ||
* @param stringc | ||
* @return char* | ||
*/ | ||
char *StringC_to_lower(StringC *stringc); | ||
|
Empty file.