visual studio project
This commit is contained in:
parent
5bc866cf3e
commit
c1d004f411
17
.gitignore
vendored
17
.gitignore
vendored
@ -1,13 +1,12 @@
|
||||
# Build results
|
||||
[Bb]in/
|
||||
bin/
|
||||
bin-*/
|
||||
.bin/
|
||||
[Dd]ebug/
|
||||
[Rr]elease/
|
||||
[Rr]eleases/
|
||||
[Oo]bj/
|
||||
[Oo]ut/
|
||||
[Ll]og/
|
||||
[Ll]ogs/
|
||||
obj/
|
||||
obj-*/
|
||||
log/
|
||||
logs/
|
||||
logs-*/
|
||||
|
||||
# IDE files
|
||||
.vs/
|
||||
@ -18,4 +17,4 @@
|
||||
*.user
|
||||
|
||||
#backups
|
||||
.old*/
|
||||
.old*/
|
||||
|
||||
@ -1,22 +1,26 @@
|
||||
#pragma once
|
||||
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "Autoarr_declare.h"
|
||||
#include "Autoarr_define.h"
|
||||
|
||||
declare_Autoarr(uint8)
|
||||
declare_Autoarr(int8)
|
||||
declare_Autoarr(uint16)
|
||||
declare_Autoarr(int16)
|
||||
declare_Autoarr(uint32)
|
||||
declare_Autoarr(int32)
|
||||
declare_Autoarr(uint64)
|
||||
declare_Autoarr(int64)
|
||||
declare_Autoarr(float)
|
||||
declare_Autoarr(double)
|
||||
declare_Autoarr(Unitype)
|
||||
declare_Autoarr(uint8)
|
||||
declare_Autoarr(int8)
|
||||
declare_Autoarr(uint16)
|
||||
declare_Autoarr(int16)
|
||||
declare_Autoarr(uint32)
|
||||
declare_Autoarr(int32)
|
||||
declare_Autoarr(uint64)
|
||||
declare_Autoarr(int64)
|
||||
declare_Autoarr(float)
|
||||
declare_Autoarr(double)
|
||||
declare_Autoarr(Unitype)
|
||||
|
||||
//right func to clear array of unitype values
|
||||
void Autoarr_Unitype_clear(Autoarr(Unitype)* ar);
|
||||
//right func to clear array of unitype values
|
||||
void Autoarr_Unitype_clear(Autoarr(Unitype)* ar);
|
||||
|
||||
#define Autoarr_foreach(ar,elem,codeblock)({\
|
||||
if(ar->blocks_count>0) {\
|
||||
@ -32,3 +36,7 @@ void Autoarr_Unitype_clear(Autoarr(Unitype)* ar);
|
||||
}\
|
||||
}\
|
||||
})
|
||||
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif
|
||||
@ -1,5 +1,9 @@
|
||||
#pragma once
|
||||
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "../base/base.h"
|
||||
|
||||
#define declare_Autoarr(type)\
|
||||
@ -50,7 +54,7 @@ Autoarr_##type __Autoarr_create_##type(uint16 max_blocks_count, uint16 max_block
|
||||
autoarr->max_block_length*(autoarr->blocks_count-1)+autoarr->block_length)
|
||||
#define Autoarr_max_length(autoarr)\
|
||||
(uint32)(autoarr->max_block_length*autoarr->max_blocks_count)
|
||||
|
||||
|
||||
#define Autoarr_remove(AR){\
|
||||
if(AR->block_length==1){\
|
||||
AR->blocks_count--;\
|
||||
@ -59,3 +63,7 @@ Autoarr_##type __Autoarr_create_##type(uint16 max_blocks_count, uint16 max_block
|
||||
}\
|
||||
else AR->block_length--;\
|
||||
}
|
||||
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif
|
||||
@ -1,5 +1,9 @@
|
||||
#pragma once
|
||||
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "../base/base.h"
|
||||
|
||||
#define define_Autoarr(type)\
|
||||
@ -62,3 +66,7 @@ Autoarr_##type __Autoarr_create_##type(uint16 max_blocks_count, uint16 max_block
|
||||
.functions=&__functions_list_##type\
|
||||
};\
|
||||
}
|
||||
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif
|
||||
@ -1,14 +1,22 @@
|
||||
#pragma once
|
||||
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "Autoarr.h"
|
||||
|
||||
typedef Autoarr(int8) StringBuilder;
|
||||
typedef Autoarr(int8) StringBuilder;
|
||||
|
||||
StringBuilder StringBuilder_create(uint16 max_blocks_count, uint16 max_block_length);
|
||||
void StringBuilder_append_char(StringBuilder* b, char c);
|
||||
void StringBuilder_append_cptr(StringBuilder* b, char* s);
|
||||
void StringBuilder_append_string(StringBuilder* b, string s);
|
||||
void StringBuilder_append_int64(StringBuilder* b, int64 a);
|
||||
void StringBuilder_append_uint64(StringBuilder* b, uint64 a);
|
||||
void StringBuilder_append_double(StringBuilder* b, double a);
|
||||
char* StringBuilder_build(StringBuilder* b);
|
||||
StringBuilder StringBuilder_create(uint16 max_blocks_count, uint16 max_block_length);
|
||||
void StringBuilder_append_char(StringBuilder* b, char c);
|
||||
void StringBuilder_append_cptr(StringBuilder* b, char* s);
|
||||
void StringBuilder_append_string(StringBuilder* b, string s);
|
||||
void StringBuilder_append_int64(StringBuilder* b, int64 a);
|
||||
void StringBuilder_append_uint64(StringBuilder* b, uint64 a);
|
||||
void StringBuilder_append_double(StringBuilder* b, double a);
|
||||
char* StringBuilder_build(StringBuilder* b);
|
||||
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif
|
||||
@ -1,9 +1,9 @@
|
||||
#pragma once
|
||||
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#pragma once
|
||||
#include "../base/base.h"
|
||||
#include "../Hashtable/Hashtable.h"
|
||||
|
||||
//parses text to binary values
|
||||
|
||||
@ -6,234 +6,259 @@
|
||||
#define STRB_BC 64
|
||||
#define STRB_BL 1024
|
||||
|
||||
Hashtable* __deserialize(char** _text, bool calledRecursively){
|
||||
Hashtable* dict=Hashtable_create();
|
||||
char* text=*_text;
|
||||
void __throw_wrongchar(char* file, int line, char* fname, char _c, char* _text) {
|
||||
char errBuf[]="unexpected <c> at:\n \""
|
||||
"00000000000000000000000000000000\"";
|
||||
errBuf[12]=_c;
|
||||
for (uint8 i=0; i < 32; i++)
|
||||
errBuf[i + 22]=*(_text - 16 + i);
|
||||
printf("\n\e[91m[%s:%d %s] throwed error: %s\n", file, line, fname, errBuf);
|
||||
exit(128);
|
||||
};
|
||||
#define throw_wrongchar(C) __throw_wrongchar(__FILE__,__LINE__,__func__,C, text)
|
||||
|
||||
|
||||
typedef struct DeserializeSharedData{
|
||||
char* sh_text;
|
||||
bool sh_partOfDollarList;
|
||||
bool sh_readingList;
|
||||
bool sh_calledRecursively;
|
||||
} DeserializeSharedData;
|
||||
#define text shared->sh_text
|
||||
#define partOfDollarList shared->sh_partOfDollarList
|
||||
#define readingList shared->sh_readingList
|
||||
#define calledRecursively shared->sh_calledRecursively
|
||||
|
||||
void __SkipComment(DeserializeSharedData* shared) {
|
||||
char c;
|
||||
bool partOfDollarList=false;
|
||||
bool readingList=false;
|
||||
while ((c=*++text) != '\n')
|
||||
if (!c) throw(ERR_ENDOFSTR);
|
||||
};
|
||||
#define SkipComment() __SkipComment(shared)
|
||||
|
||||
void __throw_wrongchar(char* file, int line, char* fname,char _c){
|
||||
char errBuf[]="unexpected <c> at:\n \""
|
||||
"00000000000000000000000000000000\"";
|
||||
errBuf[12]=_c;
|
||||
for(uint8 i=0;i<32;i++)
|
||||
errBuf[i+22]=*(text-16+i);
|
||||
printf("\n\e[91m[%s:%d %s] throwed error: %s\n",file,line,fname,errBuf);
|
||||
exit(128);
|
||||
string __ReadName(DeserializeSharedData* shared){
|
||||
char c;
|
||||
string nameStr={text,0};
|
||||
text--;
|
||||
while ((c=*++text)) switch (c){
|
||||
case ' ': case '\t':
|
||||
case '\r': case '\n':
|
||||
if(nameStr.length!=0)
|
||||
throw_wrongchar(c);
|
||||
nameStr.ptr++;
|
||||
break;
|
||||
case '=': case ';':
|
||||
case '\'': case '"':
|
||||
case '[': case ']':
|
||||
case '{':
|
||||
throw_wrongchar(c);
|
||||
break;
|
||||
case '#':
|
||||
SkipComment();
|
||||
if(nameStr.length!=0)
|
||||
throw_wrongchar(c);
|
||||
nameStr.ptr=text+1; //skips '\n'
|
||||
break;
|
||||
case '}':
|
||||
if(!calledRecursively) throw_wrongchar(c);
|
||||
if((*++text)!=';')
|
||||
throw_wrongchar(c);
|
||||
case ':':
|
||||
return nameStr;
|
||||
case '$':
|
||||
if(nameStr.length!=0)
|
||||
throw_wrongchar(c);
|
||||
nameStr.ptr++;
|
||||
partOfDollarList=true;
|
||||
break;
|
||||
default:
|
||||
nameStr.length++;
|
||||
break;
|
||||
}
|
||||
|
||||
if(nameStr.length>0) throw(ERR_ENDOFSTR);
|
||||
return nameStr;
|
||||
};
|
||||
#define ReadName() __ReadName(shared)
|
||||
|
||||
Hashtable* __deserialize(char** _text, bool _calledRecursively);
|
||||
Unitype __ReadValue(DeserializeSharedData* shared);
|
||||
#define ReadValue() __ReadValue(shared)
|
||||
|
||||
//returns part of <text> without quotes
|
||||
char* __ReadString(DeserializeSharedData* shared){
|
||||
char c;
|
||||
bool prevIsBackslash=false;
|
||||
StringBuilder _b=StringBuilder_create(STRB_BC,STRB_BL);
|
||||
StringBuilder* b=&_b;
|
||||
while ((c=*++text)){
|
||||
if(c=='"') {
|
||||
if(prevIsBackslash) {
|
||||
//replacing <\"> with <">
|
||||
Autoarr_remove(b);
|
||||
StringBuilder_append_char(b,c);
|
||||
}
|
||||
else {
|
||||
char* str=StringBuilder_build(b);
|
||||
Autoarr_clear(b);
|
||||
return str;
|
||||
}
|
||||
}
|
||||
else {
|
||||
prevIsBackslash= c=='\\' && !prevIsBackslash;
|
||||
StringBuilder_append_char(b,c);
|
||||
}
|
||||
}
|
||||
throw(ERR_ENDOFSTR);
|
||||
return NULL;
|
||||
};
|
||||
#define ReadString() __ReadString(shared)
|
||||
|
||||
Autoarr(Unitype)* __ReadList(DeserializeSharedData* shared){
|
||||
Autoarr(Unitype)* list=malloc(sizeof(Autoarr(Unitype)));
|
||||
*list=Autoarr_create(Unitype,ARR_BC,ARR_BL);
|
||||
readingList=true;
|
||||
while (true){
|
||||
Autoarr_add(list,ReadValue());
|
||||
if (!readingList) break;
|
||||
}
|
||||
return list;
|
||||
};
|
||||
#define ReadList() __ReadList(shared)
|
||||
|
||||
Unitype __ParseValue(DeserializeSharedData* shared, string str){
|
||||
//printf("\e[94m<\e[96m%s\e[94m>\n",string_cpToCptr(str));
|
||||
const string nullStr={"null",4};
|
||||
const string trueStr={"true",4};
|
||||
const string falseStr={"false",5};
|
||||
switch(*str.ptr){
|
||||
case 'n':
|
||||
if(string_compare(str,nullStr))
|
||||
return UniNull;
|
||||
else throw_wrongchar(*str.ptr);
|
||||
break;
|
||||
case 't':
|
||||
if(string_compare(str,trueStr))
|
||||
return UniTrue;
|
||||
else throw_wrongchar(*str.ptr);
|
||||
break;
|
||||
case 'f':
|
||||
if(string_compare(str,falseStr))
|
||||
return UniFalse;
|
||||
else throw_wrongchar(*str.ptr);
|
||||
break;
|
||||
default:
|
||||
switch(str.ptr[str.length-1]){
|
||||
case 'f': {
|
||||
char* _c=string_cpToCptr(str);
|
||||
Unitype rez=Uni(Double,strtod(_c,NULL));
|
||||
free(_c);
|
||||
return rez;
|
||||
}
|
||||
case 'u': {
|
||||
uint64 lu=0;
|
||||
char* _c=string_cpToCptr(str);
|
||||
sscanf(_c,"%lu",&lu);
|
||||
free(_c);
|
||||
return Uni(UInt64,lu);
|
||||
}
|
||||
case '0': case '1': case '2': case '3': case '4':
|
||||
case '5': case '6': case '7': case '8': case '9': {
|
||||
int64 li=0;
|
||||
char* _c=string_cpToCptr(str);
|
||||
if(sscanf(_c,"%li",&li)!=1){
|
||||
char err[64];
|
||||
sprintf(err,"can't parse to int: <%s>",_c);
|
||||
throw(err);
|
||||
}
|
||||
|
||||
free(_c);
|
||||
return Uni(Int64,li);
|
||||
}
|
||||
default:
|
||||
throw_wrongchar(str.ptr[str.length-1]);
|
||||
}
|
||||
}
|
||||
throw(ERR_ENDOFSTR);
|
||||
return UniNull;
|
||||
};
|
||||
#define ParseValue(str) __ParseValue(shared, str)
|
||||
|
||||
Unitype __ReadValue(DeserializeSharedData* shared){
|
||||
char c;
|
||||
string valueStr={text+1,0};
|
||||
Unitype value;
|
||||
while ((c=*++text)) switch (c){
|
||||
case ' ': case '\t':
|
||||
case '\r': case '\n':
|
||||
if(valueStr.length!=0)
|
||||
throw_wrongchar(c);
|
||||
valueStr.ptr++;
|
||||
break;
|
||||
case '=': case ':':
|
||||
case '}': case '$':
|
||||
throw_wrongchar(c);
|
||||
break;
|
||||
case '#':;
|
||||
char _c=c;
|
||||
SkipComment();
|
||||
if(valueStr.length!=0)
|
||||
throw_wrongchar(_c);
|
||||
valueStr.ptr=text+1; //skips '\n'
|
||||
break;
|
||||
case '"':
|
||||
if(valueStr.length!=0) throw_wrongchar(c);
|
||||
value=UniPtr(CharPtr,ReadString());
|
||||
break;
|
||||
case '\'':
|
||||
if(valueStr.length!=0) throw_wrongchar(c);
|
||||
char valueChar=*++text;
|
||||
if (*++text != '\'') throw("after <'> should be char");
|
||||
value=Uni(Char,valueChar);
|
||||
break;
|
||||
case '[':
|
||||
if(valueStr.length!=0) throw_wrongchar(c);
|
||||
value=UniPtr(AutoarrUnitypePtr,ReadList());
|
||||
case ']':
|
||||
readingList=false;
|
||||
break;
|
||||
case '{':
|
||||
if(valueStr.length!=0) throw_wrongchar(c);
|
||||
++text; //skips '{'
|
||||
value=UniPtr(HashtablePtr, __deserialize(&text,true));
|
||||
return value;
|
||||
case ';':
|
||||
case ',':
|
||||
if(valueStr.length!=0)
|
||||
value=ParseValue(valueStr);
|
||||
return value;
|
||||
default:
|
||||
valueStr.length++;
|
||||
break;
|
||||
}
|
||||
|
||||
throw(ERR_ENDOFSTR);
|
||||
return UniNull;
|
||||
};
|
||||
|
||||
|
||||
Hashtable* __deserialize(char** _text, bool _calledRecursively) {
|
||||
DeserializeSharedData _shared={
|
||||
.sh_text=*_text,
|
||||
.sh_partOfDollarList=false,
|
||||
.sh_readingList=false,
|
||||
.sh_calledRecursively=_calledRecursively
|
||||
};
|
||||
#define throw_wrongchar(C) __throw_wrongchar(__FILE__,__LINE__,__func__,C)
|
||||
DeserializeSharedData* shared=&_shared;
|
||||
Hashtable* dict=Hashtable_create();
|
||||
char c;
|
||||
|
||||
|
||||
void SkipComment(){
|
||||
while((c=*++text)!='\n')
|
||||
if(!c) throw(ERR_ENDOFSTR);
|
||||
};
|
||||
|
||||
string ReadName(){
|
||||
string nameStr={text,0};
|
||||
text--;
|
||||
while ((c=*++text)) switch (c){
|
||||
case ' ': case '\t':
|
||||
case '\r': case '\n':
|
||||
if(nameStr.length!=0)
|
||||
throw_wrongchar(c);
|
||||
nameStr.ptr++;
|
||||
break;
|
||||
case '=': case ';':
|
||||
case '\'': case '"':
|
||||
case '[': case ']':
|
||||
case '{':
|
||||
throw_wrongchar(c);
|
||||
break;
|
||||
case '#':
|
||||
SkipComment();
|
||||
if(nameStr.length!=0)
|
||||
throw_wrongchar(c);
|
||||
nameStr.ptr=text+1; //skips '\n'
|
||||
break;
|
||||
case '}':
|
||||
if(!calledRecursively) throw_wrongchar(c);
|
||||
if((*++text)!=';')
|
||||
throw_wrongchar(c);
|
||||
case ':':
|
||||
return nameStr;
|
||||
case '$':
|
||||
if(nameStr.length!=0)
|
||||
throw_wrongchar(c);
|
||||
nameStr.ptr++;
|
||||
partOfDollarList=true;
|
||||
break;
|
||||
default:
|
||||
nameStr.length++;
|
||||
break;
|
||||
}
|
||||
|
||||
if(nameStr.length>0) throw(ERR_ENDOFSTR);
|
||||
return nameStr;
|
||||
};
|
||||
|
||||
Unitype ReadValue(){
|
||||
//returns part of <text> without quotes
|
||||
char* ReadString(){
|
||||
bool prevIsBackslash=false;
|
||||
StringBuilder _b=StringBuilder_create(STRB_BC,STRB_BL);
|
||||
StringBuilder* b=&_b;
|
||||
while ((c=*++text)){
|
||||
if(c=='"') {
|
||||
if(prevIsBackslash) {
|
||||
//replacing <\"> with <">
|
||||
Autoarr_remove(b);
|
||||
StringBuilder_append_char(b,c);
|
||||
}
|
||||
else {
|
||||
char* str=StringBuilder_build(b);
|
||||
Autoarr_clear(b);
|
||||
return str;
|
||||
}
|
||||
}
|
||||
else {
|
||||
prevIsBackslash= c=='\\' && !prevIsBackslash;
|
||||
StringBuilder_append_char(b,c);
|
||||
}
|
||||
}
|
||||
throw(ERR_ENDOFSTR);
|
||||
return NULL;
|
||||
};
|
||||
|
||||
Autoarr(Unitype)* ReadList(){
|
||||
Autoarr(Unitype)* list=malloc(sizeof(Autoarr(Unitype)));
|
||||
*list=Autoarr_create(Unitype,ARR_BC,ARR_BL);
|
||||
readingList=true;
|
||||
while (true){
|
||||
Autoarr_add(list,ReadValue());
|
||||
if (!readingList) break;
|
||||
}
|
||||
return list;
|
||||
};
|
||||
|
||||
Hashtable* ReadDtsod(){
|
||||
++text; //skips '{'
|
||||
return __deserialize(&text,true);
|
||||
}
|
||||
|
||||
Unitype ParseValue(string str){
|
||||
//printf("\e[94m<\e[96m%s\e[94m>\n",string_cpToCharPtr(str));
|
||||
const string nullStr={"null",4};
|
||||
const string trueStr={"true",4};
|
||||
const string falseStr={"false",5};
|
||||
switch(*str.ptr){
|
||||
case 'n':
|
||||
if(string_compare(str,nullStr))
|
||||
return UniNull;
|
||||
else throw_wrongchar(*str.ptr);
|
||||
break;
|
||||
case 't':
|
||||
if(string_compare(str,trueStr))
|
||||
return UniTrue;
|
||||
else throw_wrongchar(*str.ptr);
|
||||
break;
|
||||
case 'f':
|
||||
if(string_compare(str,falseStr))
|
||||
return UniFalse;
|
||||
else throw_wrongchar(*str.ptr);
|
||||
break;
|
||||
default:
|
||||
switch(str.ptr[str.length-1]){
|
||||
case 'f': {
|
||||
char* _c=string_cpToCharPtr(str);
|
||||
Unitype rez=Uni(Double,strtod(_c,NULL));
|
||||
free(_c);
|
||||
return rez;
|
||||
}
|
||||
case 'u': {
|
||||
uint64 lu=0;
|
||||
char* _c=string_cpToCharPtr(str);
|
||||
sscanf(_c,"%lu",&lu);
|
||||
free(_c);
|
||||
return Uni(UInt64,lu);
|
||||
}
|
||||
case '0': case '1': case '2': case '3': case '4':
|
||||
case '5': case '6': case '7': case '8': case '9': {
|
||||
int64 li=0;
|
||||
char* _c=string_cpToCharPtr(str);
|
||||
if(sscanf(_c,"%li",&li)!=1){
|
||||
char err[64];
|
||||
sprintf(err,"can't parse to int: <%s>",_c);
|
||||
throw(err);
|
||||
}
|
||||
|
||||
free(_c);
|
||||
return Uni(Int64,li);
|
||||
}
|
||||
default:
|
||||
throw_wrongchar(str.ptr[str.length-1]);
|
||||
}
|
||||
}
|
||||
throw(ERR_ENDOFSTR);
|
||||
return UniNull;
|
||||
};
|
||||
|
||||
string valueStr={text+1,0};
|
||||
Unitype value;
|
||||
while ((c=*++text)) switch (c){
|
||||
case ' ': case '\t':
|
||||
case '\r': case '\n':
|
||||
if(valueStr.length!=0)
|
||||
throw_wrongchar(c);
|
||||
valueStr.ptr++;
|
||||
break;
|
||||
case '=': case ':':
|
||||
case '}': case '$':
|
||||
throw_wrongchar(c);
|
||||
break;
|
||||
case '#':;
|
||||
char _c=c;
|
||||
SkipComment();
|
||||
if(valueStr.length!=0)
|
||||
throw_wrongchar(_c);
|
||||
valueStr.ptr=text+1; //skips '\n'
|
||||
break;
|
||||
case '"':
|
||||
if(valueStr.length!=0) throw_wrongchar(c);
|
||||
value=UniPtr(CharPtr,ReadString());
|
||||
break;
|
||||
case '\'':
|
||||
if(valueStr.length!=0) throw_wrongchar(c);
|
||||
char valueChar=*++text;
|
||||
if (*++text != '\'') throw("after <'> should be char");
|
||||
value=Uni(Char,valueChar);
|
||||
break;
|
||||
case '[':
|
||||
if(valueStr.length!=0) throw_wrongchar(c);
|
||||
value=UniPtr(AutoarrUnitypePtr,ReadList());
|
||||
case ']':
|
||||
readingList=false;
|
||||
break;
|
||||
case '{':
|
||||
if(valueStr.length!=0) throw_wrongchar(c);
|
||||
value=UniPtr(HashtablePtr,ReadDtsod());
|
||||
return value;
|
||||
case ';':
|
||||
case ',':
|
||||
if(valueStr.length!=0)
|
||||
value=ParseValue(valueStr);
|
||||
return value;
|
||||
default:
|
||||
valueStr.length++;
|
||||
break;
|
||||
}
|
||||
|
||||
throw(ERR_ENDOFSTR);
|
||||
return UniNull;
|
||||
};
|
||||
|
||||
text--;
|
||||
while((c=*++text)){
|
||||
string name=ReadName();
|
||||
if(name.length==0) //end of file or '}' in recursive call
|
||||
goto END;
|
||||
char* nameCPtr=string_cpToCharPtr(name);
|
||||
char* nameCPtr=string_cpToCptr(name);
|
||||
Unitype value=ReadValue();
|
||||
if(partOfDollarList){
|
||||
Autoarr(Unitype)* list;
|
||||
@ -255,7 +280,6 @@ Hashtable* __deserialize(char** _text, bool calledRecursively){
|
||||
return dict;
|
||||
}
|
||||
|
||||
Hashtable* DtsodV24_deserialize(char* text) {
|
||||
Hashtable* r=__deserialize(&text,false);
|
||||
return r;
|
||||
Hashtable* DtsodV24_deserialize(char* _text) {
|
||||
return __deserialize(&_text, false);
|
||||
}
|
||||
|
||||
45
DtsodParser/DtsodV24_exported.c
Normal file
45
DtsodParser/DtsodV24_exported.c
Normal file
@ -0,0 +1,45 @@
|
||||
//
|
||||
// I planned to export functions from DtsodV24.h,
|
||||
// but C# P/Invoke can't get returned values for some reason.
|
||||
// Following functions return values by pointer, which looks in C# like out parameter
|
||||
//
|
||||
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "DtsodV24.h"
|
||||
|
||||
//parses text to binary values
|
||||
EXPORT void CALL kerep_DtsodV24_deserialize(char* text, Hashtable** output){
|
||||
*output=DtsodV24_deserialize(text);
|
||||
}
|
||||
|
||||
//creates text representation of dtsod
|
||||
EXPORT void CALL kerep_DtsodV24_serialize(Hashtable* dtsod, char** output){
|
||||
*output=DtsodV24_serialize(dtsod);
|
||||
}
|
||||
|
||||
//returns value or UniNull if key not found
|
||||
EXPORT void CALL kerep_DtsodV24_get(Hashtable* dtsod, char* key, Unitype* output){
|
||||
*output=DtsodV24_get(dtsod, key);
|
||||
}
|
||||
|
||||
//adds or sets value
|
||||
EXPORT void CALL kerep_DtsodV24_addOrSet(Hashtable* dtsod, char* key, Unitype value){
|
||||
DtsodV24_addOrSet(dtsod, key, value);
|
||||
}
|
||||
|
||||
//checks for dtsod contains value or dont
|
||||
EXPORT void CALL kerep_DtsodV24_contains(Hashtable* dtsod, char* key, bool* output){
|
||||
*output=DtsodV24_contains(dtsod, key);
|
||||
}
|
||||
|
||||
//replaces value with UniNull if key exists in dtsod
|
||||
EXPORT void CALL kerep_DtsodV24_remove(Hashtable* dtsod, char* key, bool* output){
|
||||
*output=DtsodV24_remove(dtsod, key);
|
||||
}
|
||||
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif
|
||||
@ -5,86 +5,104 @@
|
||||
#define STRB_BC 64
|
||||
#define STRB_BL 1024
|
||||
|
||||
#define addc(B,C) StringBuilder_append_char(B,C)
|
||||
typedef struct SerializeSharedData{
|
||||
StringBuilder* sh_builder;
|
||||
uint8 sh_tabs;
|
||||
} SerializeSharedData;
|
||||
#define b shared->sh_builder
|
||||
#define tabs shared->sh_tabs
|
||||
|
||||
void __serialize(StringBuilder* b, uint8 tabs, Hashtable* dtsod){
|
||||
|
||||
void AppendTabs(){
|
||||
for(uint8 t=0; t<tabs; t++)
|
||||
addc(b,'\t');
|
||||
void __serialize(StringBuilder* _b, uint8 _tabs, Hashtable* dtsod);
|
||||
|
||||
#define addc(C) StringBuilder_append_char(b,C)
|
||||
|
||||
|
||||
void __AppendTabs(SerializeSharedData* shared) {
|
||||
for (uint8 t = 0; t < tabs; t++)
|
||||
addc( '\t');
|
||||
};
|
||||
#define AppendTabs() __AppendTabs(shared)
|
||||
|
||||
void __AppendValue(SerializeSharedData* shared, Unitype u);
|
||||
#define AppendValue(UNI) __AppendValue(shared, UNI)
|
||||
void __AppendValue(SerializeSharedData* shared, Unitype u){
|
||||
switch(u.type){
|
||||
case Int64:
|
||||
StringBuilder_append_int64(b,u.Int64);
|
||||
break;
|
||||
case UInt64:
|
||||
StringBuilder_append_uint64(b,u.UInt64);
|
||||
addc('u');
|
||||
break;
|
||||
case Double:
|
||||
StringBuilder_append_double(b,u.Double);
|
||||
addc('f');
|
||||
break;
|
||||
case CharPtr:
|
||||
addc('"');
|
||||
char c;
|
||||
while((c=*(char*)(u.VoidPtr++))){
|
||||
if(c=='\"') addc('\\');
|
||||
addc(c);
|
||||
}
|
||||
addc('"');
|
||||
break;
|
||||
case Char:
|
||||
addc('\'');
|
||||
addc(u.Char);
|
||||
addc('\'');
|
||||
break;
|
||||
case Bool:
|
||||
StringBuilder_append_cptr(b, u.Bool ? "true" : "false");
|
||||
break;
|
||||
case Null:
|
||||
if(!u.VoidPtr) StringBuilder_append_cptr(b, "null");
|
||||
else throw("Null-type pointer is not 0");
|
||||
break;
|
||||
case AutoarrUnitypePtr:
|
||||
addc('[');
|
||||
Autoarr_foreach(((Autoarr_Unitype*)(u.VoidPtr)), e, ({
|
||||
addc(' ');
|
||||
AppendValue(e);
|
||||
addc(',');
|
||||
}));
|
||||
Autoarr_remove(b);
|
||||
addc(' ');
|
||||
addc(']');
|
||||
break;
|
||||
case HashtablePtr:
|
||||
addc('{');
|
||||
addc('\n');
|
||||
__serialize(b,tabs+1,u.VoidPtr);
|
||||
AppendTabs();
|
||||
addc('}');
|
||||
break;
|
||||
default: dbg((u.type)); throw(ERR_WRONGTYPE);
|
||||
}
|
||||
};
|
||||
|
||||
void __serialize(StringBuilder* _b, uint8 _tabs, Hashtable* dtsod){
|
||||
SerializeSharedData _shared={
|
||||
.sh_builder=_b,
|
||||
.sh_tabs=_tabs
|
||||
};
|
||||
|
||||
void AppendValue(Unitype u){
|
||||
switch(u.type){
|
||||
case Int64:
|
||||
StringBuilder_append_int64(b,u.Int64);
|
||||
break;
|
||||
case UInt64:
|
||||
StringBuilder_append_uint64(b,u.UInt64);
|
||||
addc(b,'u');
|
||||
break;
|
||||
case Double:
|
||||
StringBuilder_append_double(b,u.Double);
|
||||
addc(b,'f');
|
||||
break;
|
||||
case CharPtr:
|
||||
addc(b,'"');
|
||||
char c;
|
||||
while((c=*(char*)(u.VoidPtr++))){
|
||||
if(c=='\"') addc(b,'\\');
|
||||
addc(b,c);
|
||||
}
|
||||
addc(b,'"');
|
||||
break;
|
||||
case Char:
|
||||
addc(b,'\'');
|
||||
addc(b,u.Char);
|
||||
addc(b,'\'');
|
||||
break;
|
||||
case Bool:
|
||||
StringBuilder_append_cptr(b, u.Bool ? "true" : "false");
|
||||
break;
|
||||
case Null:
|
||||
if(!u.VoidPtr) StringBuilder_append_cptr(b, "null");
|
||||
else throw("Null-type pointer is not 0");
|
||||
break;
|
||||
case AutoarrUnitypePtr:
|
||||
addc(b,'[');
|
||||
Autoarr_foreach(((Autoarr_Unitype*)(u.VoidPtr)), e, ({
|
||||
addc(b,' ');
|
||||
AppendValue(e);
|
||||
addc(b,',');
|
||||
}));
|
||||
Autoarr_remove(b);
|
||||
addc(b,' ');
|
||||
addc(b,']');
|
||||
break;
|
||||
case HashtablePtr:
|
||||
addc(b,'{');
|
||||
addc(b,'\n');
|
||||
__serialize(b,tabs+1,u.VoidPtr);
|
||||
AppendTabs();
|
||||
addc(b,'}');
|
||||
break;
|
||||
default: dbg((u.type)); throw(ERR_WRONGTYPE);
|
||||
}
|
||||
};
|
||||
|
||||
SerializeSharedData* shared=&_shared;
|
||||
|
||||
Hashtable_foreach(dtsod, p, ({
|
||||
AppendTabs();
|
||||
StringBuilder_append_cptr(b,p.key);
|
||||
addc(b,':');
|
||||
addc(b,' ');
|
||||
addc(':');
|
||||
addc(' ');
|
||||
AppendValue(p.value);
|
||||
addc(b,';');
|
||||
addc(b,'\n');
|
||||
addc(';');
|
||||
addc('\n');
|
||||
}));
|
||||
}
|
||||
|
||||
char* DtsodV24_serialize(Hashtable* dtsod){
|
||||
StringBuilder b=StringBuilder_create(STRB_BC,STRB_BL);
|
||||
__serialize(&b,0,dtsod);
|
||||
char* str=StringBuilder_build(&b);
|
||||
Autoarr_clear((&b));
|
||||
StringBuilder sb=StringBuilder_create(STRB_BC,STRB_BL);
|
||||
__serialize(&sb,0,dtsod);
|
||||
char* str=StringBuilder_build(&sb);
|
||||
Autoarr_clear((&sb));
|
||||
return str;
|
||||
}
|
||||
|
||||
@ -1,5 +1,9 @@
|
||||
#pragma once
|
||||
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "../base/base.h"
|
||||
#include "hash.h"
|
||||
#include "KeyValuePair.h"
|
||||
@ -41,3 +45,7 @@ void Hashtable_set(Hashtable* ht, char* key, Unitype u);
|
||||
Autoarr_foreach(AR, EL, codeblock);\
|
||||
}\
|
||||
})
|
||||
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif
|
||||
@ -1,3 +1,9 @@
|
||||
#pragma once
|
||||
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "../base/base.h"
|
||||
#include "../Autoarr/Autoarr.h"
|
||||
|
||||
@ -15,3 +21,7 @@ void KeyValuePair_free(KeyValuePair p);
|
||||
void Autoarr_KeyValuePair_clear(Autoarr_KeyValuePair* ar);
|
||||
|
||||
void printkvp(KeyValuePair p);
|
||||
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif
|
||||
@ -1,8 +1,16 @@
|
||||
#pragma once
|
||||
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "../base/base.h"
|
||||
|
||||
//djb2 hash function from http://www.cse.yorku.ca/~oz/hash.html
|
||||
uint32 ihash(char *str);
|
||||
//sdbm hash function
|
||||
uint64 lhash(char* str);
|
||||
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif
|
||||
20
Makefile
20
Makefile
@ -1,9 +1,9 @@
|
||||
SRC=$(wildcard [^tests]**/*.c)
|
||||
TESTS=$(wildcard tests/*c) $(wildcard tests/**/*.c)
|
||||
OUTDIR=.bin
|
||||
OUTDIR=bin
|
||||
CMP=gcc
|
||||
|
||||
all: clear_c clear_bin build_test build_dll
|
||||
all: clear_c clear_bin build_test build_lib
|
||||
|
||||
clear_c:
|
||||
clear
|
||||
@ -27,7 +27,7 @@ build_test_dbg:
|
||||
@echo -e '\n\e[96m--------------[build_test_dbg]--------------\e[0m'
|
||||
$(CMP) -O0 -g $(TEST_ARGS).dbg
|
||||
|
||||
test:
|
||||
test: clear_c build_test
|
||||
@echo -e '\n\e[96m----------------[test]-----------------\e[0m'
|
||||
$(TEST_FILE)
|
||||
|
||||
@ -36,10 +36,10 @@ valgrind: clear_c build_test_dbg
|
||||
valgrind -s --read-var-info=yes --track-origins=yes --fullpath-after=kerep/ \
|
||||
--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)
|
||||
LIB_FILE=kerep.so
|
||||
LIB_ARGS= -Wall -Wno-discarded-qualifiers \
|
||||
-O1 -fPIC -shared -Wl,-soname,$(LIB_FILE) \
|
||||
$(SRC) $(TESTS) -o $(OUTDIR)/$(LIB_FILE)
|
||||
build_lib:
|
||||
@echo -e '\n\e[96m-------------[build_lib]---------------\e[0m'
|
||||
$(CMP) $(OPT_ARGS) $(LIB_ARGS)
|
||||
|
||||
@ -1,5 +1,9 @@
|
||||
#pragma once
|
||||
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "../base/base.h"
|
||||
|
||||
typedef struct SearchTreeNode{
|
||||
@ -12,3 +16,7 @@ void STNode_free(STNode* node);
|
||||
|
||||
void ST_push(STNode* node, const char* key, Unitype value);
|
||||
Unitype ST_pull(STNode* node, const char* key);
|
||||
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif
|
||||
18
base/base.h
18
base/base.h
@ -1,12 +1,16 @@
|
||||
#pragma once
|
||||
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "std.h"
|
||||
#include "types.h"
|
||||
#include "errors.h"
|
||||
#include "mystr.h"
|
||||
|
||||
// executes codeblock and prints execution time
|
||||
#define optime(opname,repeats,codeblock) ({\
|
||||
/*#define optime(opname,repeats,codeblock) ({\
|
||||
struct timespec start, stop;\
|
||||
clock_gettime(CLOCK_REALTIME, &start);\
|
||||
for(uint64 ___OPREP=0;___OPREP<repeats;___OPREP++)\
|
||||
@ -14,4 +18,16 @@
|
||||
clock_gettime(CLOCK_REALTIME, &stop);\
|
||||
double t=(double)(stop.tv_sec-start.tv_sec+(double)(stop.tv_nsec-start.tv_nsec)/1000000000)/repeats;\
|
||||
printf("\e[93moperation \e[94m%s\e[93m lasted \e[94m%lf \e[93mseconds\n",opname,t);\
|
||||
})*/
|
||||
#define optime(opname,repeats,codeblock) ({\
|
||||
clock_t start=clock();\
|
||||
for(uint64 ___OPREP=0;___OPREP<repeats;___OPREP++)\
|
||||
(codeblock);\
|
||||
clock_t stop=clock();\
|
||||
double t=(double)(stop-start)/CLOCKS_PER_SEC/repeats;\
|
||||
printf("\e[93moperation \e[94m%s\e[93m lasted \e[94m%lf \e[93mseconds\n",opname,t);\
|
||||
})
|
||||
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif
|
||||
@ -1,5 +1,9 @@
|
||||
#pragma once
|
||||
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef enum err_t {
|
||||
SUCCESS, //not an error
|
||||
ERR_MAXLENGTH, ERR_WRONGTYPE, ERR_WRONGINDEX, ERR_NOTIMPLEMENTED, ERR_NULLPTR, ERR_ENDOFSTR
|
||||
@ -14,3 +18,7 @@ void _throwstr(const char* errmesg, const char* srcfile, int line, const char* f
|
||||
CHOOSE(IFTYPE(E,int), _throwint(E,__FILE__,__LINE__,__func__), \
|
||||
CHOOSE(IFTYPE(E,char[]), _throwstr(E,__FILE__,__LINE__,__func__), \
|
||||
printf("\e[31m[%s:%d/%s] UNKNOWN ERROR\n",__FILE__,__LINE__,__func__)))
|
||||
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif
|
||||
@ -36,7 +36,7 @@ char* char_multiply(char c, uint32 n){
|
||||
}
|
||||
|
||||
//copies str content to new char pointer value (adding '\0' at the end)
|
||||
char* string_cpToCharPtr(string str){
|
||||
char* string_cpToCptr(string str){
|
||||
char* cptr=malloc(str.length*sizeof(char)+1);
|
||||
if(str.length==0) return NULL;
|
||||
cptr[str.length]=0;
|
||||
|
||||
10
base/mystr.h
10
base/mystr.h
@ -1,5 +1,9 @@
|
||||
#pragma once
|
||||
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "types.h"
|
||||
|
||||
//returns length of string (including \0)
|
||||
@ -24,7 +28,7 @@ typedef struct string{
|
||||
static const string stringNull={NULL,0};
|
||||
|
||||
//copies str content to new char pointer value (adding '\0' at the end)
|
||||
char* string_cpToCharPtr(string str);
|
||||
char* string_cpToCptr(string str);
|
||||
|
||||
//copies cptr content (excluding '\0' at the end) to new string
|
||||
string string_cpFromCharPtr(char* cptr);
|
||||
@ -34,3 +38,7 @@ bool string_compare(string str0, string str1);
|
||||
|
||||
//creates new string which is reversed variant of <s>
|
||||
string string_reverse(string s);
|
||||
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif
|
||||
36
base/std.h
36
base/std.h
@ -1,4 +1,9 @@
|
||||
#pragma once
|
||||
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
@ -11,3 +16,34 @@
|
||||
#define IFTYPE(X, T) __builtin_types_compatible_p(typeof(X), T)
|
||||
|
||||
#define dbg(N) printf("\e[95m%d\n",N)
|
||||
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma comment(lib, "mincore_downlevel.lib") // Support OS older than SDK
|
||||
#define _CRT_SECURE_NO_WARNINGS 1
|
||||
#define EXPORT __declspec(dllexport)
|
||||
#define CALL __cdecl
|
||||
#elif defined(__GNUC__)
|
||||
#define EXPORT __attribute__((visibility("default")))
|
||||
#if __SIZEOF_POINTER__ == 4
|
||||
#define CALL __attribute__((__cdecl__))
|
||||
#else
|
||||
#define CALL
|
||||
#endif
|
||||
#else
|
||||
#pragma GCC error "unknown compiler"
|
||||
#endif
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#define IFWIN(YES, NO) YES
|
||||
#elif defined(__GNUC__)
|
||||
#define IFWIN(YES, NO) NO
|
||||
#else
|
||||
#pragma GCC error "unknown compiler"
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif
|
||||
14
base/types.c
14
base/types.c
@ -4,7 +4,7 @@
|
||||
#include "../Hashtable/Hashtable.h"
|
||||
#include "../SearchTree/SearchTree.h"
|
||||
|
||||
const char* typename(my_type t){
|
||||
const char* my_type_name(my_type t){
|
||||
switch (t) {
|
||||
case Null: return "Null";
|
||||
case Double: return "Double";
|
||||
@ -119,12 +119,12 @@ void Unitype_free(Unitype u){
|
||||
void printuni(Unitype v){
|
||||
switch (v.type) {
|
||||
case Null: printf("{Null}");break;
|
||||
case Double: printf("{%s : %lf}",typename(v.type),v.Double);break;
|
||||
case Char: printf("{%s : '%c'}",typename(v.type),v.Char);break;
|
||||
case Double: printf("{%s : %lf}",my_type_name(v.type),v.Double);break;
|
||||
case Char: printf("{%s : '%c'}",my_type_name(v.type),v.Char);break;
|
||||
case Bool:
|
||||
case UInt64: printf("{%s : %lu}",typename(v.type),v.UInt64);break;
|
||||
case Int64: printf("{%s : %ld}",typename(v.type),v.Int64);break;
|
||||
case CharPtr: printf("{%s : \"%s\"}",typename(v.type),(char*)v.VoidPtr);break;
|
||||
default: printf("{%s : %p}",typename(v.type),v.VoidPtr);break;
|
||||
case UInt64: printf("{%s : %lu}",my_type_name(v.type),v.UInt64);break;
|
||||
case Int64: printf("{%s : %ld}",my_type_name(v.type),v.Int64);break;
|
||||
case CharPtr: printf("{%s : \"%s\"}",my_type_name(v.type),(char*)v.VoidPtr);break;
|
||||
default: printf("{%s : %p}",my_type_name(v.type),v.VoidPtr);break;
|
||||
}
|
||||
}
|
||||
|
||||
19
base/types.h
19
base/types.h
@ -1,5 +1,9 @@
|
||||
#pragma once
|
||||
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "std.h"
|
||||
|
||||
typedef int8_t int8;
|
||||
@ -10,7 +14,7 @@ typedef int32_t int32;
|
||||
typedef uint32_t uint32;
|
||||
typedef int64_t int64;
|
||||
typedef uint64_t uint64;
|
||||
typedef enum my_type{
|
||||
typedef enum __attribute__((__packed__)) my_type {
|
||||
Null, Float, Double, Char, Bool,
|
||||
UInt8, Int8, UInt16, Int16, UInt32, Int32, UInt64, Int64,
|
||||
UInt8Ptr, Int8Ptr, UInt16Ptr, Int16Ptr, UInt32Ptr, Int32Ptr, UInt64Ptr, Int64Ptr,
|
||||
@ -19,15 +23,10 @@ typedef enum my_type{
|
||||
AutoarrInt8Ptr, AutoarrUInt8Ptr, AutoarrInt16Ptr, AutoarrUInt16Ptr,
|
||||
AutoarrInt32Ptr, AutoarrUInt32Ptr, AutoarrInt64Ptr, AutoarrUInt64Ptr,
|
||||
AutoarrUnitypePtr, AutoarrKVPairPtr
|
||||
} __attribute__ ((__packed__)) my_type;
|
||||
} my_type;
|
||||
|
||||
//returns type name
|
||||
const char* typename(my_type t);
|
||||
const char* my_type_name(my_type t);
|
||||
|
||||
// returns size of type in bytes
|
||||
int8 typesize(my_type type);
|
||||
|
||||
// can store any base type
|
||||
typedef struct Unitype{
|
||||
union {
|
||||
int64 Int64;
|
||||
@ -50,3 +49,7 @@ static const Unitype UniFalse={.Bool=false,.type=Bool};
|
||||
//frees VoidPtr value or does nothing if type isn't pointer
|
||||
void Unitype_free(Unitype u);
|
||||
void printuni(Unitype v);
|
||||
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif
|
||||
31
kerep.sln
Normal file
31
kerep.sln
Normal file
@ -0,0 +1,31 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.2.32317.152
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "kerep", "kerep.vcxproj", "{52F0BD29-A3CB-47CE-B25D-CEAF5DFB2D73}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|x64 = Debug|x64
|
||||
Debug|x86 = Debug|x86
|
||||
Release|x64 = Release|x64
|
||||
Release|x86 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{52F0BD29-A3CB-47CE-B25D-CEAF5DFB2D73}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{52F0BD29-A3CB-47CE-B25D-CEAF5DFB2D73}.Debug|x64.Build.0 = Debug|x64
|
||||
{52F0BD29-A3CB-47CE-B25D-CEAF5DFB2D73}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{52F0BD29-A3CB-47CE-B25D-CEAF5DFB2D73}.Debug|x86.Build.0 = Debug|Win32
|
||||
{52F0BD29-A3CB-47CE-B25D-CEAF5DFB2D73}.Release|x64.ActiveCfg = Release|x64
|
||||
{52F0BD29-A3CB-47CE-B25D-CEAF5DFB2D73}.Release|x64.Build.0 = Release|x64
|
||||
{52F0BD29-A3CB-47CE-B25D-CEAF5DFB2D73}.Release|x86.ActiveCfg = Release|Win32
|
||||
{52F0BD29-A3CB-47CE-B25D-CEAF5DFB2D73}.Release|x86.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {22F8C351-9A96-4F37-94E6-37E6AB5BA058}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
246
kerep.vcxproj
Normal file
246
kerep.vcxproj
Normal file
@ -0,0 +1,246 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<VCProjectVersion>16.0</VCProjectVersion>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<ProjectGuid>{52f0bd29-a3cb-47ce-b25d-ceaf5dfb2d73}</ProjectGuid>
|
||||
<RootNamespace>kerep</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>10.0.18362.0</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>ClangCL</PlatformToolset>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<CLRSupport>false</CLRSupport>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>ClangCL</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<CLRSupport>false</CLRSupport>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>ClangCL</PlatformToolset>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<CLRSupport>false</CLRSupport>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>ClangCL</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<CLRSupport>false</CLRSupport>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="Shared">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<OutDir>bin-$(Platform)\$(Configuration)\</OutDir>
|
||||
<IntDir>obj-$(Platform)\$(Configuration)\</IntDir>
|
||||
<RunCodeAnalysis>true</RunCodeAnalysis>
|
||||
<ManagedAssembly>false</ManagedAssembly>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<OutDir>bin-$(Platform)\$(Configuration)\</OutDir>
|
||||
<IntDir>obj-$(Platform)\$(Configuration)\</IntDir>
|
||||
<RunCodeAnalysis>true</RunCodeAnalysis>
|
||||
<ManagedAssembly>false</ManagedAssembly>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<RunCodeAnalysis>true</RunCodeAnalysis>
|
||||
<OutDir>bin-$(Platform)\$(Configuration)\</OutDir>
|
||||
<IntDir>obj-$(Platform)\$(Configuration)\</IntDir>
|
||||
<ManagedAssembly>false</ManagedAssembly>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<RunCodeAnalysis>true</RunCodeAnalysis>
|
||||
<OutDir>bin-$(Platform)\$(Configuration)\</OutDir>
|
||||
<IntDir>obj-$(Platform)\$(Configuration)\</IntDir>
|
||||
<ManagedAssembly>false</ManagedAssembly>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>TurnOffAllWarnings</WarningLevel>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;KEREP_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<PrecompiledHeaderFile>
|
||||
</PrecompiledHeaderFile>
|
||||
<LanguageStandard_C>stdc17</LanguageStandard_C>
|
||||
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
|
||||
<PrecompiledHeaderOutputFile />
|
||||
<AdditionalOptions>/Zc:twoPhase- /MP %(AdditionalOptions)</AdditionalOptions>
|
||||
<CompileAs>Default</CompileAs>
|
||||
<LanguageStandard>Default</LanguageStandard>
|
||||
<DebugInformationFormat>None</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableUAC>false</EnableUAC>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>TurnOffAllWarnings</WarningLevel>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;KEREP_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<PrecompiledHeaderFile>
|
||||
</PrecompiledHeaderFile>
|
||||
<LanguageStandard_C>stdc17</LanguageStandard_C>
|
||||
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
|
||||
<PrecompiledHeaderOutputFile />
|
||||
<AdditionalOptions>/Zc:twoPhase- /MP %(AdditionalOptions)</AdditionalOptions>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<CompileAs>Default</CompileAs>
|
||||
<LanguageStandard>Default</LanguageStandard>
|
||||
<DebugInformationFormat>None</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableUAC>false</EnableUAC>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>TurnOffAllWarnings</WarningLevel>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>_DEBUG;KEREP_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<PrecompiledHeaderFile>
|
||||
</PrecompiledHeaderFile>
|
||||
<LanguageStandard_C>stdc17</LanguageStandard_C>
|
||||
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
|
||||
<PrecompiledHeaderOutputFile />
|
||||
<AdditionalOptions>/Zc:twoPhase- /MP %(AdditionalOptions)</AdditionalOptions>
|
||||
<CompileAs>Default</CompileAs>
|
||||
<LanguageStandard>Default</LanguageStandard>
|
||||
<DebugInformationFormat>None</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableUAC>false</EnableUAC>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>TurnOffAllWarnings</WarningLevel>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>NDEBUG;KEREP_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<PrecompiledHeaderFile>
|
||||
</PrecompiledHeaderFile>
|
||||
<LanguageStandard_C>stdc11</LanguageStandard_C>
|
||||
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
|
||||
<PrecompiledHeaderOutputFile />
|
||||
<AdditionalOptions>/Zc:twoPhase- /MP %(AdditionalOptions)</AdditionalOptions>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<CompileAs>Default</CompileAs>
|
||||
<LanguageStandard>Default</LanguageStandard>
|
||||
<DebugInformationFormat>None</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableUAC>false</EnableUAC>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="Autoarr\Autoarr.h" />
|
||||
<ClInclude Include="Autoarr\Autoarr_declare.h" />
|
||||
<ClInclude Include="Autoarr\Autoarr_define.h" />
|
||||
<ClInclude Include="Autoarr\StringBuilder.h" />
|
||||
<ClInclude Include="base\base.h" />
|
||||
<ClInclude Include="base\errors.h" />
|
||||
<ClInclude Include="base\mystr.h" />
|
||||
<ClInclude Include="base\std.h" />
|
||||
<ClInclude Include="base\types.h" />
|
||||
<ClInclude Include="DtsodParser\DtsodV24.h" />
|
||||
<ClInclude Include="Hashtable\hash.h" />
|
||||
<ClInclude Include="Hashtable\Hashtable.h" />
|
||||
<ClInclude Include="Hashtable\KeyValuePair.h" />
|
||||
<ClInclude Include="SearchTree\SearchTree.h" />
|
||||
<ClInclude Include="tests\tests.h" />
|
||||
<ClInclude Include="tests\test_marshalling.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="Autoarr\Autoarr.c" />
|
||||
<ClCompile Include="Autoarr\StringBuilder.c" />
|
||||
<ClCompile Include="base\errors.c" />
|
||||
<ClCompile Include="base\mystr.c" />
|
||||
<ClCompile Include="base\types.c" />
|
||||
<ClCompile Include="DtsodParser\DtsodV24.c" />
|
||||
<ClCompile Include="DtsodParser\DtsodV24_deserialize.c" />
|
||||
<ClCompile Include="DtsodParser\DtsodV24_exported.c" />
|
||||
<ClCompile Include="DtsodParser\DtsodV24_serialize.c" />
|
||||
<ClCompile Include="Hashtable\hash.c" />
|
||||
<ClCompile Include="Hashtable\Hashtable.c" />
|
||||
<ClCompile Include="Hashtable\KeyValuePair.c" />
|
||||
<ClCompile Include="SearchTree\SearchTree.c" />
|
||||
<ClCompile Include="tests\main.c" />
|
||||
<ClCompile Include="tests\test_autoarr.c" />
|
||||
<ClCompile Include="tests\test_dtsod.c" />
|
||||
<ClCompile Include="tests\test_hashtable.c" />
|
||||
<ClCompile Include="tests\test_marshalling.c" />
|
||||
<ClCompile Include="tests\test_searchtree.c" />
|
||||
<ClCompile Include="tests\test_string.c" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
129
kerep.vcxproj.filters
Normal file
129
kerep.vcxproj.filters
Normal file
@ -0,0 +1,129 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Исходные файлы">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Файлы заголовков">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Файлы ресурсов">
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="Autoarr\Autoarr.h">
|
||||
<Filter>Файлы заголовков</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Autoarr\Autoarr_declare.h">
|
||||
<Filter>Файлы заголовков</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Autoarr\Autoarr_define.h">
|
||||
<Filter>Файлы заголовков</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Autoarr\StringBuilder.h">
|
||||
<Filter>Файлы заголовков</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="base\base.h">
|
||||
<Filter>Файлы заголовков</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="base\errors.h">
|
||||
<Filter>Файлы заголовков</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="base\mystr.h">
|
||||
<Filter>Файлы заголовков</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="base\std.h">
|
||||
<Filter>Файлы заголовков</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="base\types.h">
|
||||
<Filter>Файлы заголовков</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="DtsodParser\DtsodV24.h">
|
||||
<Filter>Файлы заголовков</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Hashtable\hash.h">
|
||||
<Filter>Файлы заголовков</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Hashtable\Hashtable.h">
|
||||
<Filter>Файлы заголовков</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Hashtable\KeyValuePair.h">
|
||||
<Filter>Файлы заголовков</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="SearchTree\SearchTree.h">
|
||||
<Filter>Файлы заголовков</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="tests\test_marshalling.h">
|
||||
<Filter>Файлы заголовков</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="tests\tests.h">
|
||||
<Filter>Файлы заголовков</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="Autoarr\Autoarr.c">
|
||||
<Filter>Исходные файлы</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Autoarr\StringBuilder.c">
|
||||
<Filter>Исходные файлы</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="base\errors.c">
|
||||
<Filter>Исходные файлы</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="base\mystr.c">
|
||||
<Filter>Исходные файлы</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="base\types.c">
|
||||
<Filter>Исходные файлы</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="DtsodParser\DtsodV24.c">
|
||||
<Filter>Исходные файлы</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="DtsodParser\DtsodV24_deserialize.c">
|
||||
<Filter>Исходные файлы</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="DtsodParser\DtsodV24_serialize.c">
|
||||
<Filter>Исходные файлы</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Hashtable\hash.c">
|
||||
<Filter>Исходные файлы</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Hashtable\Hashtable.c">
|
||||
<Filter>Исходные файлы</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Hashtable\KeyValuePair.c">
|
||||
<Filter>Исходные файлы</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="SearchTree\SearchTree.c">
|
||||
<Filter>Исходные файлы</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="tests\main.c">
|
||||
<Filter>Исходные файлы</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="tests\test_autoarr.c">
|
||||
<Filter>Исходные файлы</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="tests\test_dtsod.c">
|
||||
<Filter>Исходные файлы</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="tests\test_hashtable.c">
|
||||
<Filter>Исходные файлы</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="tests\test_searchtree.c">
|
||||
<Filter>Исходные файлы</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="tests\test_string.c">
|
||||
<Filter>Исходные файлы</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="tests\test_marshalling.c">
|
||||
<Filter>Исходные файлы</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="DtsodParser\DtsodV24_exported.c">
|
||||
<Filter>Исходные файлы</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
10
tests/main.c
10
tests/main.c
@ -1,15 +1,5 @@
|
||||
#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_autoarr();
|
||||
|
||||
@ -2,8 +2,9 @@
|
||||
#include "../Autoarr/Autoarr.h"
|
||||
|
||||
static void printautoarr(Autoarr(uint16)* ar){
|
||||
printf("\e[94mAutoarr(uint16): %lu\n"
|
||||
" max_blocks_count: %u\n"
|
||||
printf("\e[94mAutoarr(uint16): "
|
||||
IFWIN("%llu", "%lu")
|
||||
"\n max_blocks_count: %u\n"
|
||||
" blocks_count: %u\n"
|
||||
" max_block_length: %u\n"
|
||||
" block_length: %u\n"
|
||||
|
||||
@ -2,8 +2,9 @@
|
||||
#include "../Hashtable/Hashtable.h"
|
||||
|
||||
void print_hashtable(Hashtable* ht){
|
||||
printf("\e[94mHashtable:%lu\n"
|
||||
" hein: %u\n"
|
||||
printf("\e[94mHashtable: "
|
||||
IFWIN("%llu", "%lu")
|
||||
"\n hein: %u\n"
|
||||
" height: %u\n"
|
||||
" rows: %p\n",
|
||||
sizeof(Hashtable),
|
||||
|
||||
14
tests/test_marshalling.c
Normal file
14
tests/test_marshalling.c
Normal file
@ -0,0 +1,14 @@
|
||||
#include "../Hashtable/KeyValuePair.h"
|
||||
|
||||
EXPORT void CALL test_marshalling(char* text, KeyValuePair** kptr){
|
||||
KeyValuePair* k=malloc(sizeof(KeyValuePair));
|
||||
k->key="message";
|
||||
char* tc=cptr_copy(text);
|
||||
Unitype u={.VoidPtr=tc, .type=CharPtr};
|
||||
k->value=u;
|
||||
*kptr=k;
|
||||
}
|
||||
|
||||
EXPORT void CALL pinvoke_print(char* msg) {
|
||||
printf("printed from unmanaged code: %s\n", msg);
|
||||
}
|
||||
@ -1,13 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "../Hashtable/KeyValuePair.h"
|
||||
|
||||
KeyValuePair test_marshalling(char* text);
|
||||
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif
|
||||
@ -2,7 +2,9 @@
|
||||
#include "../SearchTree/SearchTree.h"
|
||||
|
||||
void printstnode(STNode* node){
|
||||
printf("\e[94mSTNode: %lu\n address: %p\n value: ",sizeof(STNode),node);
|
||||
printf("\e[94mSTNode: "
|
||||
IFWIN("%llu", "%lu")
|
||||
"\n address: %p\n value: ",sizeof(STNode),node);
|
||||
printuni(node->value);
|
||||
// prints pointers to all existing branches
|
||||
printf("\n branches: %p\n", node->branches);
|
||||
|
||||
@ -8,8 +8,8 @@ void test_string(){
|
||||
string s=string_cpFromCharPtr(c);
|
||||
printf("\e[92m\"%s\" -> string_cpFromCharPtr()\n",c);
|
||||
if(s.length!=16) throw("string created with incorrect length");
|
||||
char* p=string_cpToCharPtr(s);
|
||||
printf("\e[92mstring_cpToCharPtr() -> \"%s\"\n",p);
|
||||
char* p=string_cpToCptr(s);
|
||||
printf("\e[92mstring_cpToCptr() -> \"%s\"\n",p);
|
||||
free(p);
|
||||
free(s.ptr);
|
||||
}));
|
||||
|
||||
Loading…
Reference in New Issue
Block a user