diff --git a/configmodel.c b/configmodel.c index 9bd570f..a4b6bca 100644 --- a/configmodel.c +++ b/configmodel.c @@ -1,8 +1,8 @@ #include "configmodel.h" #include "cregex/cregex.h" -#include "arraytypes/stringarray.h" -#include "arraytypes/linearray.h" +#include "containers/stringarray.h" +#include "containers/linearray.h" #include #include diff --git a/arraytypes/linearray.c b/containers/linearray.c similarity index 100% rename from arraytypes/linearray.c rename to containers/linearray.c diff --git a/arraytypes/linearray.h b/containers/linearray.h similarity index 100% rename from arraytypes/linearray.h rename to containers/linearray.h diff --git a/containers/linemap.c b/containers/linemap.c new file mode 100644 index 0000000..21d08ca --- /dev/null +++ b/containers/linemap.c @@ -0,0 +1,18 @@ +#include "linemap.h" +#include "linearray.h" + +LineMap LineMapNew() +{ + LineMap result = NewMap(CNTKIT_KEY_STRING, + CNTKIT_CAPACITY, 8, + CNTKIT_VALUESIZE, 4, + TAG_DONE); + + return result; +} + +VOID LineMapFree(LineMap map) +{ + // doesnt seem to delete contents + DeleteMap(map); +} diff --git a/containers/linemap.h b/containers/linemap.h new file mode 100644 index 0000000..e9682e8 --- /dev/null +++ b/containers/linemap.h @@ -0,0 +1,13 @@ +#ifndef __LINEMAP_H +#define __LINEMAP_H + +#include +#include +#include "configmodel.h" + +#define LineMap Map + +LineMap LineMapNew(VOID); + +VOID LineMapFree(LineMap map); +#endif \ No newline at end of file diff --git a/arraytypes/stringarray.c b/containers/stringarray.c similarity index 100% rename from arraytypes/stringarray.c rename to containers/stringarray.c diff --git a/arraytypes/stringarray.h b/containers/stringarray.h similarity index 100% rename from arraytypes/stringarray.h rename to containers/stringarray.h diff --git a/main.c b/main.c index 317a065..c4ee1a9 100644 --- a/main.c +++ b/main.c @@ -3,8 +3,8 @@ #include #include #define __NOLIBBASE__ -#include "arraytypes/stringarray.h" -#include "arraytypes/linearray.h" +#include "containers/stringarray.h" +#include "containers/linearray.h" #include "configmodel.h" #include @@ -16,24 +16,6 @@ char *stacksize = "$STACK:8192"; // only works when started from CLI struct Library *ContainerkitBase; -VOID ProcessFile(BPTR configFile) -{ - Array lineArray = NULL; - LINEPTR line = NULL; - - InitialisePatterns(); - lineArray = LineArrayNew(); - line = LineReadIncludingContinuation(configFile); - while( line != NULL ) - { -// Printf("successfully read line {%s}\n", LineGetRawText(line)); - LineArrayAppend(lineArray, line); - line = LineReadIncludingContinuation(configFile); - } - LineArrayFree(lineArray, TRUE); - ReleasePatterns(); -} - WORD DoTheWork(STRPTR filename) { WORD result = RETURN_OK; diff --git a/smakefile b/smakefile index 24fe566..032d25a 100644 --- a/smakefile +++ b/smakefile @@ -11,20 +11,20 @@ LIBS = lib:sc.lib lib:amiga.lib lib:debug.lib ############################################################################### -$(NAME) : main.o configmodel.o cregex/cregex.lib arraytypes/arraytypes.lib - slink lib:c.o main.o configmodel.o to $(NAME) noicons lib $(LIBS) cregex/cregex.lib arraytypes/arraytypes.lib $(LFLAGS) +$(NAME) : main.o configmodel.o cregex/cregex.lib containers/containers.lib + slink lib:c.o main.o configmodel.o to $(NAME) noicons lib $(LIBS) cregex/cregex.lib containers/containers.lib $(LFLAGS) cregex/cregex.lib : cregex/cregex_compile.o cregex/cregex_parse.o cregex/cregex_vm.o JOIN cregex/cregex_compile.o cregex/cregex_parse.o cregex/cregex_vm.o AS cregex/cregex.lib -arraytypes/arraytypes.lib : arraytypes/stringarray.o arraytypes/linearray.o - JOIN arraytypes/stringarray.o arraytypes/linearray.o AS arraytypes/arraytypes.lib +containers/containers.lib : containers/stringarray.o containers/linearray.o containers/linemap.o + JOIN containers/stringarray.o containers/linearray.o containers/linemap.o AS containers/containers.lib clean: delete \#?.o $(NAME) ALL QUIET cleanlibs: - delete arraytypes/arraytypes.lib arraytypes/\#?.o cregex/cregex.lib cregex/\#?.o ALL QUIET + delete containers/containers.lib containers/\#?.o cregex/cregex.lib cregex/\#?.o ALL QUIET ############################################################################### @@ -35,5 +35,6 @@ cregex/cregex_compile.o : cregex/cregex_compile.c cregex/cregex.h cregex/cregex_parse.o : cregex/cregex_parse.c cregex/cregex.h cregex/cregex_vm.o : cregex/cregex_vm.c cregex/cregex.h -arraytypes/stringarray.o : arraytypes/stringarray.c arraytypes/stringarray.h -arraytypes/linearray.o : arraytypes/linearray.c arraytypes/linearray.h +containers/stringarray.o : containers/stringarray.c containers/stringarray.h +containers/linearray.o : containers/linearray.c containers/linearray.h +containers/linemap.o : containers/linemap.c containers/linemap.h diff --git a/testconfig.cfg b/testconfig.cfg index 2989ba2..8be879c 100644 --- a/testconfig.cfg +++ b/testconfig.cfg @@ -1,7 +1,6 @@ #this is a comment [core] repositoryformatversion = 0 - ignorecase = true precomposeunicode = true [remote "origin.foo"] #this is also a coment @@ -15,5 +14,4 @@ [branch "config-file-parsing-from-book"] remote = origin merge = refs/heads/config-file-parsing-from-book - somekey = Alan Francis