Please use code-tags on your program code, it makes it much more readable. Also, don't post several times after you wrote something, wait for replys or edit your first post.
So lets go through this
About strings - i just readed this part from manual and got curious about this:
STRING* mystring = "Some tekst";
TEXT* mytext = txt_create(0, 1);//0 strings, 1. layer
(mytext.pstring)[0] = mystring;//it vorks, but i have no idea if it nov is
//removable string from text
str_cpy((mytext.pstring)[0], mystring);//gives error - possible because zere isnt
Not okay. (mytext.pstring)[0] is not initialized.
use txt_addstring(mytext, mystring); instead.
//any text strings in vhich to copy
TEXT* mytext1 = txt_create(1, 1);
(mytext1.pstring)[0] = mystring;//it vorks too, but i have no idea if it
//replaces created string or inserts it.
Will not crash, BUT will replace an automatically created string. This string is no longer available and this is a
memory leak because you can never ptr_remove it.
So here question is if im not filling
//memory vith pointer lost strings
str_cpy((mytext1.pstring)[0], mystring);//i assume this copy content from
//second string to first created one
This is a good way to do it.
//And about zis again:
(mytext1.pstring)[0] = mystring;
//So in case im deleting strings from situation above
ptr_remove((mytext1.pstring)[0]));//is it removes string from text nov or
//defined mystring
This will remove the defined mystring. as i said above the originaly created string from the text is no longer available.
typedef struct
{
//some other info
Struct next_struct;
}Struct;
This is okay, "next_struct" becomes a part of "Struct" and when you free a Struct object, it also frees the next_struct part.
BUT for every Pointer in next_struct, you have to create and also remove it.
You should write constructors and destructors for your own structs, example:
typedef struct {
int* dyn_array;
int dyn_array_size;
STRING* str;
PANEL* pan
} mystruct;
mystruct* mystruct_create(int arraysize)
{
mystruct *s = sys_malloc(sizeof(mystruct));
s.dyn_array_size = arraysize;
s.dyn_array = sys_malloc(sizeof(int) * arraysize);
s.str = str_create("lol");
s.pan = pan_create("....", 1);
return s;
}
void mystruct_delete(mystruct *s)
{
sys_free (s.dyn_array);
ptr_remove(s.str);
ptr_remove(s.pan);
// remove the struct memory itself
sys_free(s);
}
Only create and remove the struct with this, and you are pretty safe. Remember to use sys_free when you used sys_malloc, and ptr_remove for the engine *_create functions!
Garbage collector will probably never be added, because lite-C is based on the C language, and it doesn't have a garbage collector too.