diff --git a/.cproject b/.cproject new file mode 100644 index 0000000..ff1665a --- /dev/null +++ b/.cproject @@ -0,0 +1,74 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + make + + all + true + true + true + + + make + + clean + true + true + true + + + + diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..8b3eb77 --- /dev/null +++ b/.gitignore @@ -0,0 +1,9 @@ +* + +!.gitignore +!Makefile +!**/ + +*.o +.settings/language.settings.xml +test/test_multicodec diff --git a/.project b/.project new file mode 100644 index 0000000..16bbb79 --- /dev/null +++ b/.project @@ -0,0 +1,27 @@ + + + c-multicodec + + + + + + org.eclipse.cdt.managedbuilder.core.genmakebuilder + clean,full,incremental, + + + + + org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder + full,incremental, + + + + + + org.eclipse.cdt.core.cnature + org.eclipse.cdt.core.ccnature + org.eclipse.cdt.managedbuilder.core.managedBuildNature + org.eclipse.cdt.managedbuilder.core.ScannerConfigNature + + diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..6cdc349 --- /dev/null +++ b/Makefile @@ -0,0 +1,7 @@ +clean: + cd test; make clean; + cd multicodec; make clean; + +all: + cd multicodec; make all; + cd test; make all; \ No newline at end of file diff --git a/multicodec/Makefile b/multicodec/Makefile new file mode 100644 index 0000000..0f50bed --- /dev/null +++ b/multicodec/Makefile @@ -0,0 +1,12 @@ +CC = gcc +CFLAGS = -O0 +DEPS = multicodec.h +OBJS = multicodec.o + +%.o: %.c $(DEPS) + $(CC) -c -o $@ $< $(CFLAGS) + +all: $(OBJS) + +clean: + rm -f multicodec.o \ No newline at end of file diff --git a/multicodec.c b/multicodec/multicodec.c similarity index 91% rename from multicodec.c rename to multicodec/multicodec.c index 6a9fe8f..0dd45b1 100644 --- a/multicodec.c +++ b/multicodec/multicodec.c @@ -1,9 +1,9 @@ #include "multicodec.h" int multicodec_encode(const char* codecName, char* inData, size_t inDataLength, char* outData, size_t maxOutDataLength) { - + return 0; } int multicodec_decode(char* inData, size_t inDataLength, char* outData, size_t maxOutDataLength) { - + return 0; } diff --git a/multicodec.h b/multicodec/multicodec.h similarity index 100% rename from multicodec.h rename to multicodec/multicodec.h diff --git a/test/Makefile b/test/Makefile new file mode 100644 index 0000000..894d5bc --- /dev/null +++ b/test/Makefile @@ -0,0 +1,17 @@ +CC = gcc +CFLAGS = -O0 +DEPS = ../multicodec/multicodec.h +OBJS = test_multicodec.o ../multicodec/multicodec.o + +%.o: %.c $(DEPS) + $(CC) -c -o $@ $< $(CFLAGS) + +test_multicodec: $(OBJS) + + $(CC) -o $@ $(OBJS) + +all: test_multicodec + +clean: + rm -f test_multicodec; + rm -f test_multicodec.o; \ No newline at end of file diff --git a/test/test_multicodec.c b/test/test_multicodec.c new file mode 100644 index 0000000..d5453c5 --- /dev/null +++ b/test/test_multicodec.c @@ -0,0 +1,25 @@ +#include "../multicodec/multicodec.h" + +#include + +int testEncode() { + char inData[10]; + char outData[15]; + multicodec_encode("ascii", inData, 10, outData, 15); + return 1; +} + +int testit(const char* name, int (*func)(void)) { + printf("Running function %s... ", name); + int retVal = func(); + if (retVal == 0) + printf("Success\n"); + else + printf("Failed\n"); + return 0; +} + +int main(int argc, char** argv) { + testit("testEncode", testEncode); + return 0; +}