serialize()
This commit is contained in:
@@ -66,3 +66,11 @@ bool string_compare(string str0, string str1){
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
//creates new string which is reversed variant of <s>
|
||||
string string_reverse(string s){
|
||||
string r={malloc(s.length), s.length};
|
||||
for(uint32 i; i<s.length; i++)
|
||||
r.ptr[i]=s.ptr[s.length-i-1];
|
||||
return r;
|
||||
}
|
||||
|
||||
@@ -31,3 +31,6 @@ string string_cpFromCharPtr(char* cptr);
|
||||
|
||||
//compares two strings, NullPtr-friendly
|
||||
bool string_compare(string str0, string str1);
|
||||
|
||||
//creates new string which is reversed variant of <s>
|
||||
string string_reverse(string s);
|
||||
|
||||
@@ -114,3 +114,16 @@ void Unitype_free(Unitype u){
|
||||
default: throw(ERR_WRONGTYPE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
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 Bool:
|
||||
case UInt64: printf("{%s:%lu}",typename(v.type),v.UInt64);break;
|
||||
case Int64: printf("{%s:%ld}",typename(v.type),v.Int64);break;
|
||||
default: printf("{%s:%p}",typename(v.type),v.VoidPtr);break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,3 +49,4 @@ static const Unitype UniFalse={Bool,.Bool=false};
|
||||
|
||||
//frees VoidPtr value or does nothing if type isn't pointer
|
||||
void Unitype_free(Unitype u);
|
||||
void printuni(Unitype v);
|
||||
|
||||
Reference in New Issue
Block a user