project structure changed for clion
This commit is contained in:
parent
703bd4bef4
commit
c6c70c6fcc
1
.gitignore
vendored
1
.gitignore
vendored
@ -6,7 +6,6 @@ obj/
|
|||||||
.vs/
|
.vs/
|
||||||
.vscode/
|
.vscode/
|
||||||
.vshistory/
|
.vshistory/
|
||||||
.idea/
|
|
||||||
.editorconfig
|
.editorconfig
|
||||||
*.user
|
*.user
|
||||||
|
|
||||||
|
|||||||
8
.idea/.gitignore
vendored
Normal file
8
.idea/.gitignore
vendored
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
# Default ignored files
|
||||||
|
/shelf/
|
||||||
|
/workspace.xml
|
||||||
|
# Editor-based HTTP Client requests
|
||||||
|
/httpRequests/
|
||||||
|
# Datasource local storage ignored files
|
||||||
|
/dataSources/
|
||||||
|
/dataSources.local.xml
|
||||||
12
.idea/inspectionProfiles/Project_Default.xml
Normal file
12
.idea/inspectionProfiles/Project_Default.xml
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
<component name="InspectionProjectProfileManager">
|
||||||
|
<profile version="1.0">
|
||||||
|
<option name="myName" value="Project Default" />
|
||||||
|
<inspection_tool class="GrazieInspection" enabled="false" level="TYPO" enabled_by_default="false" />
|
||||||
|
<inspection_tool class="LanguageDetectionInspection" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||||
|
<inspection_tool class="SpellCheckingInspection" enabled="false" level="TYPO" enabled_by_default="false">
|
||||||
|
<option name="processCode" value="true" />
|
||||||
|
<option name="processLiterals" value="true" />
|
||||||
|
<option name="processComments" value="true" />
|
||||||
|
</inspection_tool>
|
||||||
|
</profile>
|
||||||
|
</component>
|
||||||
31
.idea/misc.xml
Normal file
31
.idea/misc.xml
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="CidrRootsConfiguration">
|
||||||
|
<sourceRoots>
|
||||||
|
<file path="$PROJECT_DIR$/src" />
|
||||||
|
<file path="$PROJECT_DIR$/tests" />
|
||||||
|
</sourceRoots>
|
||||||
|
<excludeRoots>
|
||||||
|
<file path="$PROJECT_DIR$/.vscode" />
|
||||||
|
<file path="$PROJECT_DIR$/bin" />
|
||||||
|
</excludeRoots>
|
||||||
|
</component>
|
||||||
|
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||||
|
<component name="MakefileSettings">
|
||||||
|
<option name="linkedExternalProjectsSettings">
|
||||||
|
<MakefileProjectSettings>
|
||||||
|
<option name="buildOptions" value=" " />
|
||||||
|
<option name="buildTarget" value="build_lib" />
|
||||||
|
<option name="cleanTarget" value="clear_bin" />
|
||||||
|
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||||
|
<option name="modules">
|
||||||
|
<set>
|
||||||
|
<option value="$PROJECT_DIR$" />
|
||||||
|
</set>
|
||||||
|
</option>
|
||||||
|
<option name="version" value="2" />
|
||||||
|
</MakefileProjectSettings>
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
|
<component name="MakefileWorkspace" PROJECT_DIR="$PROJECT_DIR$" />
|
||||||
|
</project>
|
||||||
6
.idea/vcs.xml
Normal file
6
.idea/vcs.xml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="VcsDirectoryMappings">
|
||||||
|
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
23
Makefile
23
Makefile
@ -1,10 +1,10 @@
|
|||||||
SRC=$(wildcard [^tests]**/*.c)
|
SRC=$(wildcard src/**/*.c) $(wildcard src/*.c)
|
||||||
TESTS=$(wildcard tests/*c) $(wildcard tests/**/*.c)
|
TESTS=$(wildcard tests/*c) $(wildcard tests/**/*.c)
|
||||||
|
|
||||||
OUTDIR=bin
|
OUTDIR=bin
|
||||||
CMP=gcc
|
CMP=gcc
|
||||||
OPT_ARGS=-O2 -flto
|
OPT_ARGS=-O2 -std=c17
|
||||||
WARN_ARGS=-Wall -Wno-discarded-qualifiers -std=c17
|
WARN_ARGS=-Wall -Wno-discarded-qualifiers
|
||||||
|
|
||||||
all: clear_c clear_bin build_test build_lib
|
all: clear_c clear_bin build_test build_lib
|
||||||
|
|
||||||
@ -26,11 +26,11 @@ clang: all
|
|||||||
TEST_FILE=kerep_test.com
|
TEST_FILE=kerep_test.com
|
||||||
TEST_ARGS=$(WARN_ARGS) $(SRC) $(TESTS) -o $(OUTDIR)/$(TEST_FILE)
|
TEST_ARGS=$(WARN_ARGS) $(SRC) $(TESTS) -o $(OUTDIR)/$(TEST_FILE)
|
||||||
|
|
||||||
build_test:
|
build_test:
|
||||||
@echo -e '\n\e[96m-------------[build_test]-------------\e[0m'
|
@echo -e '\n\e[96m-------------[build_test]-------------\e[0m'
|
||||||
$(CMP) $(OPT_ARGS) $(TEST_ARGS)
|
$(CMP) $(OPT_ARGS) $(TEST_ARGS)
|
||||||
|
|
||||||
build_test_dbg:
|
build_test_dbg:
|
||||||
@echo -e '\n\e[96m-----------[build_test_dbg]-----------\e[0m'
|
@echo -e '\n\e[96m-----------[build_test_dbg]-----------\e[0m'
|
||||||
$(CMP) -g -O0 $(TEST_ARGS).dbg
|
$(CMP) -g -O0 $(TEST_ARGS).dbg
|
||||||
|
|
||||||
@ -39,7 +39,7 @@ LIB_ARGS=$(OPT_ARGS) $(WARN_ARGS)\
|
|||||||
$(SRC) tests/test_marshalling.c
|
$(SRC) tests/test_marshalling.c
|
||||||
LIB_FILE=kerep.so
|
LIB_FILE=kerep.so
|
||||||
|
|
||||||
build_lib:
|
build_lib:
|
||||||
@echo -e '\n\e[96m-------------[build_lib]--------------\e[0m'
|
@echo -e '\n\e[96m-------------[build_lib]--------------\e[0m'
|
||||||
$(CMP) $(LIB_ARGS) -o $(OUTDIR)/$(LIB_FILE)
|
$(CMP) $(LIB_ARGS) -o $(OUTDIR)/$(LIB_FILE)
|
||||||
|
|
||||||
@ -47,12 +47,17 @@ build_lib:
|
|||||||
###### Run tasks #######
|
###### Run tasks #######
|
||||||
######################################
|
######################################
|
||||||
test: clear_c build_test
|
test: clear_c build_test
|
||||||
@echo -e '\n\e[96m-------------[build_test]-------------\e[0m'
|
@echo -e '\n\e[96m----------------[test]----------------\e[0m'
|
||||||
tabs 4
|
@tabs 4
|
||||||
|
$(OUTDIR)/$(TEST_FILE)
|
||||||
|
|
||||||
|
test_dbg: clear_c build_test
|
||||||
|
@echo -e '\n\e[96m--------------[test_dbg]--------------\e[0m'
|
||||||
|
@tabs 4
|
||||||
$(OUTDIR)/$(TEST_FILE)
|
$(OUTDIR)/$(TEST_FILE)
|
||||||
|
|
||||||
valgrind: clear_c build_test_dbg
|
valgrind: clear_c build_test_dbg
|
||||||
@echo -e '\n\e[96m--------------[valgrind]--------------\e[0m'
|
@echo -e '\n\e[96m--------------[valgrind]--------------\e[0m'
|
||||||
tabs 4
|
@tabs 4
|
||||||
valgrind -s --read-var-info=yes --track-origins=yes --fullpath-after=kerep/ \
|
valgrind -s --read-var-info=yes --track-origins=yes --fullpath-after=kerep/ \
|
||||||
--leak-check=full --show-leak-kinds=all $(OUTDIR)/$(TEST_FILE).dbg
|
--leak-check=full --show-leak-kinds=all $(OUTDIR)/$(TEST_FILE).dbg
|
||||||
|
|||||||
@ -39,7 +39,7 @@ void Hashtable_expand(Hashtable* ht){
|
|||||||
uint32 arlen=Autoarr_length(ar);
|
uint32 arlen=Autoarr_length(ar);
|
||||||
for(uint16 k=0;k<arlen;k++){
|
for(uint16 k=0;k<arlen;k++){
|
||||||
KVPair p=Autoarr_get(ar,k);
|
KVPair p=Autoarr_get(ar,k);
|
||||||
uint16 newrown=hash32(p.key)%HT_HEIGHTS[ht->hein];
|
uint16 newrown=ihash(p.key)%HT_HEIGHTS[ht->hein];
|
||||||
Autoarr(KVPair)* newar=newrows[newrown];
|
Autoarr(KVPair)* newar=newrows[newrown];
|
||||||
Autoarr_add(newar,p);
|
Autoarr_add(newar,p);
|
||||||
}
|
}
|
||||||
@ -53,7 +53,7 @@ void Hashtable_expand(Hashtable* ht){
|
|||||||
}
|
}
|
||||||
|
|
||||||
Autoarr(KVPair)* getrow(Hashtable* ht, char* key, bool can_expand){
|
Autoarr(KVPair)* getrow(Hashtable* ht, char* key, bool can_expand){
|
||||||
uint32 hash=hash32(key);
|
uint32 hash=ihash(key);
|
||||||
Autoarr(KVPair)* ar=ht->rows[hash%HT_HEIGHTS[ht->hein]];
|
Autoarr(KVPair)* ar=ht->rows[hash%HT_HEIGHTS[ht->hein]];
|
||||||
if(can_expand && Autoarr_length(ar)==Autoarr_max_length(ar))
|
if(can_expand && Autoarr_length(ar)==Autoarr_max_length(ar))
|
||||||
optime("expand",1,(Hashtable_expand(ht)));
|
optime("expand",1,(Hashtable_expand(ht)));
|
||||||
@ -1,13 +1,13 @@
|
|||||||
#include "hash.h"
|
#include "hash.h"
|
||||||
|
|
||||||
uint32 hash32(char *str){
|
uint32 ihash(char *str){
|
||||||
uint32 hash=5381;
|
uint32 hash=5381;
|
||||||
for (char c=*str;c;c=*(++str))
|
for (char c=*str;c;c=*(++str))
|
||||||
hash=((hash<<5)+hash)+c;
|
hash=((hash<<5)+hash)+c;
|
||||||
return hash;
|
return hash;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64 hash64(char* str){
|
uint64 lhash(char* str){
|
||||||
uint64 hash = 0;
|
uint64 hash = 0;
|
||||||
for (char c=*str;c;c=*(++str))
|
for (char c=*str;c;c=*(++str))
|
||||||
hash=c+(hash<<6)+(hash<<16)-hash;
|
hash=c+(hash<<6)+(hash<<16)-hash;
|
||||||
@ -7,9 +7,9 @@ extern "C" {
|
|||||||
#include "../base/base.h"
|
#include "../base/base.h"
|
||||||
|
|
||||||
// djb2 hash function from http:// www.cse.yorku.ca/~oz/hash.html
|
// djb2 hash function from http:// www.cse.yorku.ca/~oz/hash.html
|
||||||
uint32 hash32(char *str);
|
uint32 ihash(char *str);
|
||||||
// sdbm hash function
|
// sdbm hash function
|
||||||
uint64 hash64(char* str);
|
uint64 lhash(char* str);
|
||||||
|
|
||||||
#if __cplusplus
|
#if __cplusplus
|
||||||
}
|
}
|
||||||
@ -5,7 +5,7 @@ extern "C" {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "../Autoarr/Autoarr.h"
|
#include "../Autoarr/Autoarr.h"
|
||||||
#include "../String/string.h"
|
#include "string.h"
|
||||||
|
|
||||||
declare_Autoarr(string)
|
declare_Autoarr(string)
|
||||||
|
|
||||||
@ -1,4 +1,4 @@
|
|||||||
#include "../String/string.h"
|
#include "string.h"
|
||||||
|
|
||||||
// copies str content to new char pointer value (adding '\0' at the end)
|
// copies str content to new char pointer value (adding '\0' at the end)
|
||||||
char* string_extract(string str){
|
char* string_extract(string str){
|
||||||
@ -42,10 +42,12 @@ void Maybe_free(Maybe e){
|
|||||||
free(e.errmsg);
|
free(e.errmsg);
|
||||||
Unitype_free(e.value);
|
Unitype_free(e.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void printMaybe(Maybe e){
|
void printMaybe(Maybe e){
|
||||||
if(e.errmsg) printf("%s\n",e.errmsg);
|
if(e.errmsg) printf("%s\n",e.errmsg);
|
||||||
else printuni(e.value);
|
else printuni(e.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
char* __doNothing(char* a) {return a;}
|
char* __doNothing(char* a) {return a;}
|
||||||
char* __unknownErr() {return "UNKNOWN ERROR";}
|
|
||||||
|
char* __unknownErr() {return "UNKNOWN ERROR";}
|
||||||
@ -57,7 +57,7 @@ char* __unknownErr( );
|
|||||||
#define tryLast(_funcCall, _rezult) Maybe _rezult=_funcCall; if(_rezult.errmsg){\
|
#define tryLast(_funcCall, _rezult) Maybe _rezult=_funcCall; if(_rezult.errmsg){\
|
||||||
_rezult.errmsg=__extendErrMsg(_rezult.errmsg, __FILE__,__LINE__,__func__);\
|
_rezult.errmsg=__extendErrMsg(_rezult.errmsg, __FILE__,__LINE__,__func__);\
|
||||||
__EXIT(_rezult.errmsg);\
|
__EXIT(_rezult.errmsg);\
|
||||||
}else
|
}else
|
||||||
|
|
||||||
#if __cplusplus
|
#if __cplusplus
|
||||||
}
|
}
|
||||||
@ -1,5 +1,5 @@
|
|||||||
#include "tests.h"
|
#include "tests.h"
|
||||||
#include "../Autoarr/Autoarr.h"
|
#include "../src/Autoarr/Autoarr.h"
|
||||||
|
|
||||||
static void printautoarr(Autoarr(uint16)* ar){
|
static void printautoarr(Autoarr(uint16)* ar){
|
||||||
printf("\e[94mAutoarr(uint16): "
|
printf("\e[94mAutoarr(uint16): "
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
#include "tests.h"
|
#include "tests.h"
|
||||||
#include "../DtsodParser/DtsodV24.h"
|
#include "../src/DtsodParser/DtsodV24.h"
|
||||||
|
|
||||||
const char text[]=
|
const char text[]=
|
||||||
"list_of_lists: [ [\"sss\"]];"
|
"list_of_lists: [ [\"sss\"]];"
|
||||||
@ -33,7 +33,7 @@ void print_dtsod(Hashtable* dtsod){
|
|||||||
}
|
}
|
||||||
|
|
||||||
void test_dtsod(){
|
void test_dtsod(){
|
||||||
optime(__func__,1,({
|
//optime(__func__,1,({
|
||||||
printf("\e[96m-------------[test_dtsod]-------------\n");
|
printf("\e[96m-------------[test_dtsod]-------------\n");
|
||||||
Hashtable* dtsod;
|
Hashtable* dtsod;
|
||||||
char* s;
|
char* s;
|
||||||
@ -61,5 +61,5 @@ void test_dtsod(){
|
|||||||
}));
|
}));
|
||||||
|
|
||||||
free(s);
|
free(s);
|
||||||
}));
|
//}));
|
||||||
}
|
}
|
||||||
@ -1,5 +1,5 @@
|
|||||||
#include "tests.h"
|
#include "tests.h"
|
||||||
#include "../Hashtable/Hashtable.h"
|
#include "../src/Hashtable/Hashtable.h"
|
||||||
|
|
||||||
void print_hashtable(Hashtable* ht){
|
void print_hashtable(Hashtable* ht){
|
||||||
printf("\e[94mHashtable: "
|
printf("\e[94mHashtable: "
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
#include "../Hashtable/KeyValuePair.h"
|
#include "../src/Hashtable/KeyValuePair.h"
|
||||||
|
|
||||||
EXPORT void CALL test_marshalling(char* text, KVPair** kptr){
|
EXPORT void CALL test_marshalling(char* text, KVPair** kptr){
|
||||||
KVPair* k=malloc(sizeof(KVPair));
|
KVPair* k=malloc(sizeof(KVPair));
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
#include "tests.h"
|
#include "tests.h"
|
||||||
#include "../SearchTree/SearchTree.h"
|
#include "../src/SearchTree/SearchTree.h"
|
||||||
|
|
||||||
void printstnode(STNode* node){
|
void printstnode(STNode* node){
|
||||||
printf("\e[94mSTNode: "
|
printf("\e[94mSTNode: "
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
#include "tests.h"
|
#include "tests.h"
|
||||||
#include "../String/string.h"
|
#include "../src/String/string.h"
|
||||||
|
|
||||||
void test_string(){
|
void test_string(){
|
||||||
optime(__func__,1,({
|
optime(__func__,1,({
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "../base/base.h"
|
#include "../src/base/base.h"
|
||||||
|
|
||||||
void printuni(Unitype v);
|
void printuni(Unitype v);
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user