///Print a red error message with the file, line and position of the caller with the message in parameter with printf format. Then raise SIGABRT signal (usefull for debugging) and exit with code EXIT_FAILURE.
SYSTEM_ERROR_CHECK(file=fopen(filename, "r"), NULL, "Problem opening the file '%s'", filename);
@endcode
if file is NULL this exit with a error message showing the position of the error, the executed command 'file=fopen(filename, "r")', the system error message and your personnal formated message*/
/**Like @ref ALLOCATION but reallocates 'pointer' to contain 'numbers' element of 'type'. The content of pointer may be changed if needed. If pointer is NULL, this macro has the same effect than MANY_ALLOACTIONS. @return Nothing as the 'pointer' is directly modified.
/**Insert the content of the object pointed by new_element to the array pointed by pointer. The size of the array will increase and the pointer will be changed acordingly. To insert the data, a part of the array is copied, which may not be optimal. The number of elements is incremented. The size of the element is determined by the type of pointer.
/**Remove item by replacing the item at position by the last item and liberating the memory. This change the order of the element in the array. If you use a loop, do not forget to reiterate the current position as it as now a new item ( the one that was at teh end of the array ).
/* Not usually useful. Log the data in the file log_file. log_file has to be managed (open/close), by the caller. You can have many different log file depending on the caller. It can also be stdout or stderr. In this case declare log_file = stdout/stderr. It is not yet stabilized.*/
//Envoie un message de warning avec name_of_file, name_of_function, number_of_line et affiche le message formate avec les parametres variables. To be used with PRINT_WARNING.
@@ -68,7 +68,7 @@ void print_warning(const char *name_of_file, const char* name_of_function, int n
}
//Envoie un message de warning avec name_of_file, name_of_function, number_of_line et affiche le message formate avec les parametres variables. To be used with PRINT_WARNING.
// Envoie un message d'erreur avec name_of_file, name_of_function, number_of_line et affiche le message formate avec les parametres variables. Puis exit le programme avec le parametre EXIT_FAILURE. To be used with EXIT_ON_ERROR.
@@ -94,7 +94,7 @@ void fatal_error(const char *name_of_file, const char* name_of_function, int num
}
//Envoie un message d'erreur avec name_of_file, name_of_function, number_of_line et affiche le message formate avec les parametres variables. Puis exit le programme avec le parametre EXIT_FAILURE. To be used with @ref EXIT_ON_SYSTEM_ERROR .
// Fait un malloc de taille 'size' verifie qu'il n'a pas renvoye NULL et renvoie ce pointeur. Si le malloc a renvoye NULL alors une erreur fatal est generee avec le filename, name_of_function, et line comme parametres.
if(pointer==NULL)fatal_error(file,function,line,"malloc of size %d has failed (return NULL)",size);
if(pointer==NULL)blc_fatal_error(file,function,line,"malloc of size %d has failed (return NULL)",size);
elsereturnpointer;
}
returnNULL;
}
//Fait un realloc de taille 'size' sur le pointeur verifie qu'il n'a pas renvoye NULL et renvoie la nouvelle addresse du pointeur. Si le pointeur d'origine est NULL alors la fonction a le meme effet que secure_malloc. Si le realloc a renvoiye NULL alors une erreur fatal est generee avec le filename, name_of_function, et line comme parametres.
if(pointer_content_size!=item_size)fatal_error(file,function,line,"The size '%ld' of the content of the array must be equal to the size '%ld' of the item to contain.\nYou may mix content and pointer.",pointer_content_size,item_size);
if(pointer_content_size!=item_size)blc_fatal_error(file,function,line,"The size '%ld' of the content of the array must be equal to the size '%ld' of the item to contain.\nYou may mix content and pointer.",pointer_content_size,item_size);
if(pointer_content_size!=item_size)fatal_error(file,function,line,"The size '%ld' of the content of the array must be equal to the size '%ld' of the item to contain.",pointer_content_size,item_size);
if(pointer_content_size!=item_size)blc_fatal_error(file,function,line,"The size '%ld' of the content of the array must be equal to the size '%ld' of the item to contain.",pointer_content_size,item_size);
if(pointer_content_size!=item_size)fatal_error(file,function,line,"The size '%d' of the content of array must be equal to the size of the researched item '%d'",pointer_content_size,item_size);
if(pointer_content_size!=item_size)blc_fatal_error(file,function,line,"The size '%d' of the content of array must be equal to the size of the researched item '%d'",pointer_content_size,item_size);
if(i)command.append_text(" ");//add space but not at the first word.
if((strchr(argv[i],' '))&&((argv[i][0]!='"'||argv[i][strlen(argv[i])-1]!='"')))SPRINTF(text,"\"%s\"",argv[i]);//Add quotes if needed ( space in the word and no quotes).
elseSPRINTF(text,"%s",argv[i]);
command.append_text(text);
}
command.append("",1);
command.size=0;//avoid free at the end of the function