Skip to content

Commit

Permalink
Initial commit, established some basic
Browse files Browse the repository at this point in the history
  • Loading branch information
kpluas21 committed May 8, 2023
1 parent 3db94bd commit 4153bf8
Show file tree
Hide file tree
Showing 4 changed files with 101 additions and 0 deletions.
43 changes: 43 additions & 0 deletions Data_Structures/StringC/Makefile
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.
58 changes: 58 additions & 0 deletions Data_Structures/StringC/src/StringC.h
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.

0 comments on commit 4153bf8

Please sign in to comment.