|
Robotran C Documentation
|
Go to the documentation of this file.
6 #ifndef _USEFUL_FUNCTIONS_H_
7 #define _USEFUL_FUNCTIONS_H_
13 #define MIN(a,b) (((a)<(b))?(a):(b))
14 #define MAX(a,b) (((a)>(b))?(a):(b))
26 #define DBL_MAX 1.7976931348623158e+308
52 double pow_int(
double basis,
int expo);
67 double sign(
double a);
165 char *
str_replace_char(
char* orig,
const char old_char,
const char *new_str,
int free_orig);
179 int mbs_is_char_in(
const char *text,
const char **list,
int nb_elem);
387 int mbs_strncmp(
const char* __s1,
const char* __s2,
size_t n);
411 int mbs_strnicmp(
const char* __s1,
const char* __s2,
size_t n);
421 int mbs_strcmp(
const char* __s1,
const char* __s2);
431 int mbs_stricmp(
const char* __s1,
const char* __s2);
448 char*
mbs_strndup(
const char* input_char,
size_t char_size);
char * get_char_cpy(const char *fmt,...)
Copy the provided formatted string into a newly allocated memory.
Definition: useful_functions.c:235
#define MBS_INFO_FAILURE
Definition: mbs_define.h:32
void mbs_msg(const char *msg,...)
Send a message.
Definition: mbs_message.c:87
char * str_replace_char(char *orig, const char old_char, const char *new_str, int free_orig)
Create a copy of a string with a specific char replaced by a string.
Definition: useful_functions.c:306
void free_d3Darray_1(double ***array3D)
Definition: useful_functions.c:508
char * get_char_cpy(const char *fmt,...)
Copy the provided formatted string into a newly allocated memory.
Definition: useful_functions.c:235
void free_char_tab(char **mat)
release memory for a matrix of chars
Definition: useful_functions.c:294
int mbs_stricmp(const char *__s1, const char *__s2)
Compare two char with _stricmp (convert strings to lower case, ignoring case sensitive).
Definition: useful_functions.c:584
int mbs_is_char_in_concat(const char *text, const char *list)
Check if the provided text is in a concatenated list of text separated by ";".
Definition: useful_functions.c:409
void mbs_log(char *msg,...)
Function for logging messages in a file called "log" where the program is executed.
Definition: useful_functions.c:32
double sign(double a)
sign function
Definition: useful_functions.c:132
int mbs_strnicmp(const char *__s1, const char *__s2, size_t n)
Compares only the first (at most) n bytes of of two chars ignoring the case.
Definition: useful_functions.c:542
void free_char_vec(char *vec)
release memory for a vector of char
Definition: useful_functions.c:194
int mbs_write_data(MbsData *mbs, char *filename, char *function_name)
Write a source with a function allocating and setting a MbsData copy of the provided.
Definition: mbs_data.c:324
int mbs_is_char_i_in_concat(const char *text, const char *list)
Check if the provided text (not case sensitive) is in a concatenated list of text separated by ";".
Definition: useful_functions.c:414
char * mbs_strndup(const char *input_char, size_t char_size)
(taken from strdup definition in string.h since C23) Returns a pointer to a null-terminated byte stri...
Definition: useful_functions.c:606
char * str_replace_char(char *orig, const char old_char, const char *new_str, int free_orig)
Create a copy of a string with a specific char replaced by a string.
Definition: useful_functions.c:306
void free_char_vec(char *vec)
release memory for a vector of char
Definition: useful_functions.c:194
int mbs_strcmp(const char *__s1, const char *__s2)
Compare two char with strcmp.
Definition: useful_functions.c:568
void mbs_reset_data(MbsData *s)
Reset all fields of a MbsData structure to initial values.
Definition: mbs_data.c:306
void mbs_warning_msg(const char *msg,...)
Send a warning message.
Definition: mbs_message.c:100
double sign(double a)
sign function
Definition: useful_functions.c:132
double *** get_d3Darray_0(int nb_r, int nb_c, int z)
create (with memory allocation) a [x times y times z] 3D array of doubles, starting at index 0
Definition: useful_functions.c:486
char * get_char_vec(int size)
create (with memory allocation) a vector (length l_v) of char
Definition: useful_functions.c:167
double *** get_d3Darray_1(int x, int y, int z)
create (with memory allocation) a [x times y times z] 3D array of doubles, starting at index 1
Definition: useful_functions.c:478
void free_d3Darray_1(double ***array3D)
Definition: useful_functions.c:508
int mbs_is_char_i_in_concat(const char *text, const char *list)
Check if the provided text (not case sensitive) is in a concatenated list of text separated by ";".
Definition: useful_functions.c:414
void free_char_tab(char **mat)
release memory for a matrix of chars
Definition: useful_functions.c:294
double *** get_d3Darray_1(int x, int y, int z)
create (with memory allocation) a [x times y times z] 3D array of doubles, starting at index 1
Definition: useful_functions.c:478
int mbs_is_char_in(const char *text, const char **list, int nb_elem)
Return the index of the provided text in a list of text.
Definition: useful_functions.c:367
char * mbs_strndup(const char *input_char, size_t char_size)
(taken from strdup definition in string.h since C23) Returns a pointer to a null-terminated byte stri...
Definition: useful_functions.c:606
void free_d3Darray_0(double ***array3D)
release memory for a 3D array of doubles, starting at index 0
Definition: useful_functions.c:513
char * get_char_cpy_varg(const char *fmt, va_list argptr)
Definition: useful_functions.c:199
int mbs_strcmp(const char *__s1, const char *__s2)
Compare two char with strcmp.
Definition: useful_functions.c:568
void free_d3Darray_0(double ***array3D)
release memory for a 3D array of doubles, starting at index 1
Definition: useful_functions.c:513
int set_um_string(char **um_str, const char *new_txt)
Redirect the memory of the string user model to a newly allocated char array.
Definition: useful_functions.c:281
int mbs_strncmp(const char *__s1, const char *__s2, size_t n)
Compares only the first (at most) n bytes of of two chars.
Definition: useful_functions.c:522
char * get_char_vec(int l_v)
create (with memory allocation) a vector (length l_v) of char
Definition: useful_functions.c:167
void mbs_copy_data(MbsData *s, MbsData *s_copy)
Copy all fields between two MBSdata structures.
Definition: mbs_data.c:165
char ** get_char_tab(int nb_r, int nb_c)
create (with memory allocation) a [nb_r times nb_c] matrix of chars WARNING: only the first dimension...
Definition: useful_functions.c:178
int mbs_strncmp(const char *__s1, const char *__s2, size_t n)
Compares only the first (at most) n bytes of of two chars.
Definition: useful_functions.c:522
double * mbs_data_get_IO(MbsData *mbs, const char *io_name, int in_out)
Return the adress of the specified User IO.
Definition: mbs_data.c:900
int mbs_strnicmp(const char *__s1, const char *__s2, size_t n)
Compares only the first (at most) n bytes of of two chars ignoring the case.
Definition: useful_functions.c:542
void mbs_reset_joints_kine(MbsData *s)
Reset joints kinematics (q, qd, qdd) of a MbsData structure to initial values.
Definition: mbs_data.c:295
double *** get_d3Darray_0(int x, int y, int z)
create (with memory allocation) a [x times y times z] 3D array of doubles, starting at index 0
Definition: useful_functions.c:486
#define _MBS_ERR_LOW_INVALID
Invalid value (include NULL pointer) error number Value is not valid for the function = -8.
Definition: mbs_errors_names.h:152
void mbs_print_data(MbsData *mbs_data)
Definition: mbs_data.c:78
char * get_time_machine()
returns the current time as a String
Definition: useful_functions.c:139
int mbs_is_char_in_concat_full(const char *text, const char *list, char sep, int case_sens)
Check if the provided text is in a concatenated list of text.
Definition: useful_functions.c:419
char ** get_char_tab(int nb_r, int nb_c)
create (with memory allocation) a [nb_r times nb_c] matrix of chars WARNING: only the first dimension...
Definition: useful_functions.c:178
int set_char_cpy(char **dest, const char *fmt,...)
Set a copy the provided formatted string into a newly allocated memory.
Definition: useful_functions.c:250
char * get_time_machine()
returns the current time as a String
Definition: useful_functions.c:139
int expo_ten_inf(double nb)
get log with base 10
Definition: useful_functions.c:97
Definition: mbs_data.h:247
void * mbs_free(void *__ptr)
Free the pointor ptr and set it to NULL.
Definition: useful_functions.c:21
int expo_ten_inf(double nb)
get log with base 10
Definition: useful_functions.c:97
#define MSG_PRE
Definition: useful_functions.c:19
double pow_int(double basis, int expo)
compute efficiently pow with an integer exponent
Definition: useful_functions.c:68
#define MBS_INFO_SUCCESS
Definition: mbs_define.h:30
int mbs_is_char_in_concat(const char *text, const char *list)
Check if the provided text is in a concatenated list of text separated by ";".
Definition: useful_functions.c:409
void mbs_log(char *msg,...)
Function for logging messages in a file called "log" where the program is executed.
Definition: useful_functions.c:32
int mbs_is_char_in_concat_full(const char *text, const char *list, char sep, int case_sens)
Check if the provided text is in a concatenated list of text.
Definition: useful_functions.c:419
#define MSG_ERR
Definition: useful_functions.c:18
int set_um_string(char **um_str, const char *new_txt)
Redirect the memory of the string user model to a newly allocated char array.
Definition: useful_functions.c:281
int set_char_cpy(char **dest, const char *fmt,...)
Set a copy the provided formatted string into a newly allocated memory.
Definition: useful_functions.c:250
int mbs_is_char_in(const char *text, const char **list, int nb_elem)
Return the index of the provided text in a list of text.
Definition: useful_functions.c:367
int mbs_stricmp(const char *__s1, const char *__s2)
Compare two char with _stricmp (convert strings to lower case, ignoring case sensitive).
Definition: useful_functions.c:584
double pow_int(double basis, int expo)
compute efficiently pow with an integer exponent
Definition: useful_functions.c:68
int mbs_compare_data(MbsData *s1, MbsData *s2, int accelred)
Compare two MbsData.
Definition: mbs_data.c:604
void * mbs_free(void *__ptr)
Free the pointor ptr and set it to NULL.
Definition: useful_functions.c:21