build_dll
This commit is contained in:
parent
20ce758528
commit
5bc866cf3e
21
.gitignore
vendored
Normal file
21
.gitignore
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
# Build results
|
||||
[Bb]in/
|
||||
.bin/
|
||||
[Dd]ebug/
|
||||
[Rr]elease/
|
||||
[Rr]eleases/
|
||||
[Oo]bj/
|
||||
[Oo]ut/
|
||||
[Ll]og/
|
||||
[Ll]ogs/
|
||||
|
||||
# IDE files
|
||||
.vs/
|
||||
.vscode/
|
||||
.vshistory/
|
||||
.idea/
|
||||
.editorconfig
|
||||
*.user
|
||||
|
||||
#backups
|
||||
.old*/
|
||||
@ -1,5 +1,5 @@
|
||||
#if __cplusplus
|
||||
extern "c" {
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#pragma once
|
||||
@ -8,14 +8,19 @@ extern "c" {
|
||||
|
||||
//parses text to binary values
|
||||
Hashtable* DtsodV24_deserialize(char* text);
|
||||
|
||||
//creates text representation of dtsod
|
||||
char* DtsodV24_serialize(Hashtable* dtsod);
|
||||
|
||||
//returns value or UniNull if key not found
|
||||
Unitype DtsodV24_get(Hashtable* dtsod, char* key);
|
||||
|
||||
//adds or sets value
|
||||
void DtsodV24_addOrSet(Hashtable* dtsod, char* key, Unitype value);
|
||||
|
||||
//checks for dtsod contains value or dont
|
||||
bool DtsodV24_contains(Hashtable* dtsod, char* key);
|
||||
|
||||
//replaces value with UniNull if key exists in dtsod
|
||||
bool DtsodV24_remove(Hashtable* dtsod, char* key);
|
||||
|
||||
|
||||
44
Makefile
44
Makefile
@ -1,33 +1,45 @@
|
||||
SRC=$(wildcard [^tests]**/*.c)
|
||||
TESTS=$(wildcard tests/*c) $(wildcard tests/**/*.c)
|
||||
OUTDIR=.bin
|
||||
OUTFILE=$(OUTDIR)/kerep_test.com
|
||||
CMP=gcc
|
||||
all: clear_c build test
|
||||
|
||||
all: clear_c clear_bin build_test build_dll
|
||||
|
||||
clear_c:
|
||||
clear
|
||||
|
||||
clear_bin:
|
||||
@echo -e '\e[96m--------------[clear_bin]--------------\e[0m'
|
||||
touch $(OUTDIR)/_.com
|
||||
rm $(OUTDIR)/*.com
|
||||
rm -rf $(OUTDIR)
|
||||
mkdir $(OUTDIR)
|
||||
|
||||
clang: CMP=clang
|
||||
clang: all
|
||||
|
||||
CMPARGS= -Wall -Wno-discarded-qualifiers $(SRC) $(TESTS) -o $(OUTFILE)
|
||||
build:
|
||||
@echo -e '\n\e[96m----------------[build]----------------\e[0m'
|
||||
@mkdir -p $(OUTDIR)
|
||||
$(CMP) -O1 -flto $(CMPARGS)
|
||||
build_dbg:
|
||||
@echo -e '\n\e[96m--------------[build_dbg]--------------\e[0m'
|
||||
@mkdir -p $(OUTDIR)
|
||||
$(CMP) -O0 -g $(CMPARGS).dbg
|
||||
TEST_FILE=$(OUTDIR)/kerep_test.com
|
||||
TEST_ARGS= -Wall -Wno-discarded-qualifiers $(SRC) $(TESTS) -o $(TEST_FILE)
|
||||
OPT_ARGS= -O1 -flto
|
||||
build_test:
|
||||
@echo -e '\n\e[96m----------------[build_test]----------------\e[0m'
|
||||
$(CMP) $(OPT_ARGS) $(TEST_ARGS)
|
||||
|
||||
build_test_dbg:
|
||||
@echo -e '\n\e[96m--------------[build_test_dbg]--------------\e[0m'
|
||||
$(CMP) -O0 -g $(TEST_ARGS).dbg
|
||||
|
||||
test:
|
||||
@echo -e '\n\e[96m----------------[test]-----------------\e[0m'
|
||||
$(OUTFILE)
|
||||
valgrind: clear_c build_dbg
|
||||
$(TEST_FILE)
|
||||
|
||||
valgrind: clear_c build_test_dbg
|
||||
@echo -e '\n\e[96m--------------[valgrind]---------------\e[0m'
|
||||
valgrind -s --read-var-info=yes --track-origins=yes --fullpath-after=kerep/ \
|
||||
--leak-check=full --show-leak-kinds=all $(OUTFILE).dbg
|
||||
--leak-check=full --show-leak-kinds=all $(TEST_FILE).dbg
|
||||
|
||||
DLL_FILE=$(OUTDIR)/kerep.dll
|
||||
DLL_ARGS= -Wall -Wno-discarded-qualifiers \
|
||||
-fPIC -shared -Wl,-soname,kerep.dll \
|
||||
$(SRC) $(TESTS) -o $(DLL_FILE)
|
||||
build_dll:
|
||||
@echo -e '\n\e[96m-------------[build_dll]---------------\e[0m'
|
||||
$(CMP) $(OPT_ARGS) $(DLL_ARGS)
|
||||
|
||||
@ -29,7 +29,6 @@ int8 typesize(my_type type);
|
||||
|
||||
// can store any base type
|
||||
typedef struct Unitype{
|
||||
my_type type;
|
||||
union {
|
||||
int64 Int64;
|
||||
uint64 UInt64;
|
||||
@ -38,11 +37,12 @@ typedef struct Unitype{
|
||||
bool Bool;
|
||||
void* VoidPtr;
|
||||
};
|
||||
my_type type;
|
||||
} Unitype;
|
||||
|
||||
static const Unitype UniNull={Null,.VoidPtr=NULL};
|
||||
static const Unitype UniTrue={Bool,.Bool=true};
|
||||
static const Unitype UniFalse={Bool,.Bool=false};
|
||||
static const Unitype UniNull={.VoidPtr=NULL,.type=Null};
|
||||
static const Unitype UniTrue={.Bool=true,.type=Bool};
|
||||
static const Unitype UniFalse={.Bool=false,.type=Bool};
|
||||
|
||||
#define Uni(TYPE,VAL) (Unitype){.type=TYPE,.TYPE=VAL}
|
||||
#define UniPtr(TYPE,VAL) (Unitype){.type=TYPE,.VoidPtr=VAL}
|
||||
|
||||
13
tests/main.c
13
tests/main.c
@ -1,11 +1,20 @@
|
||||
#include "../base/base.h"
|
||||
#include "tests.h"
|
||||
|
||||
#include "../Hashtable/KeyValuePair.h"
|
||||
|
||||
KeyValuePair test_marshalling(char* text){
|
||||
//printf("<%s>\n", text);
|
||||
Unitype u={.VoidPtr=text,.type=CharPtr};
|
||||
KeyValuePair msg={"message",u};
|
||||
return msg;
|
||||
}
|
||||
|
||||
void test_all(){
|
||||
/* test_searchtree();
|
||||
test_searchtree();
|
||||
test_autoarr();
|
||||
test_hashtable();
|
||||
test_string(); */
|
||||
test_string();
|
||||
test_dtsod();
|
||||
printf("\e[96m---------------------------------------\e[0m\n");
|
||||
}
|
||||
|
||||
13
tests/test_marshalling.h
Normal file
13
tests/test_marshalling.h
Normal file
@ -0,0 +1,13 @@
|
||||
#pragma once
|
||||
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "../Hashtable/KeyValuePair.h"
|
||||
|
||||
KeyValuePair test_marshalling(char* text);
|
||||
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif
|
||||
@ -8,4 +8,4 @@ void test_searchtree();
|
||||
void test_autoarr();
|
||||
void test_hashtable();
|
||||
void test_string();
|
||||
void test_dtsod();
|
||||
void test_dtsod();
|
||||
Loading…
Reference in New Issue
Block a user