void uti_strzero (char *buf, int buflen) ----------------------------------------
Puts all the elements of a string to '/0'.
buf: pointer to the string buflen: length of the string buf
void uti_vzero (char *buf, int buflen) --------------------------------------
Puts all the elements of a vector to 0.
buf: pointer to the vector buflen: length of the vector buf
int uti_i_comp (void *v, int i, int j) --------------------------------------
Compares the values of the i-th and j-th elements in v.
v: an integer vector, passed as a vector of void i: first element to compare j: second element to compare return value: >0 if v[i]>v[j], 0 if v[i]=v[j], <0 otherwise
int uti_ui_comp (void *v, int i, int j) ---------------------------------------
Compares the values of the i-th and j-th elements in v.
v: an unsigned integer vector, passed as a vector of void i: first element to compare j: second element to compare return value: >0 if v[i]>v[j], 0 if v[i]=v[j], <0 otherwise
int uti_c_comp (void *v, int i, int j) --------------------------------------
Compares the values of the i-th and j-th elements in v.
v: a vector of characters, passed as a vector of void i: first element to compare j: second element to compare return value: >0 if v[i]>v[j], 0 if v[i]=v[j], <0 otherwise
int uti_uc_comp (void *v, int i, int j) ---------------------------------------
Compares the values of the i-th and j-th elements in v.
v: a vector of unsigned chars, passed as a vector of void i: first element to compare j: second element to compare return value: >0 if v[i]>v[j], 0 if v[i]=v[j], <0 otherwise
void uti_swap (void *v, size_t size, int i, int j) --------------------------------------------------
Swaps two elements of size size in vector v.
v: pointer to a vector size: size of the elements of v i: first element to swap j: last element to swap
int uti_imax (void *v, int n, int (*comp) (void *, int , int)) --------------------------------------------------------------
This function returns the index corresponding to the maximum element of a vector of any type. A comparison function must be provided; see for example the functions uti_i_comp, uti_c_comp, etc...
v: pointer to a generic vector n: dimension of v comp: pointer to a comparison function. The arguments of this function must be the vector itself and the two indexes of the elements to be compared. comp has to return a number >0 if the first element is greater than the second, 0 if they are equal, <0 otherwise return value: the index corresponding to the position of the maximum of v, according to the comparison function comp
void uti_index_sort (void *v, int *index, int n, int (*comp) (void *, int , int)) -----------------------------------------------------
Given a generic vector v, this function fills a vector of indexes in such a way that following their order the components of v wuold be in a non-descending order.
v: pointer to a generic vector index: pointer to a vector of indexes to be filled n: dimension of v comp: pointer to a comparison function. The arguments of this function must be the vector itself and the two indexes of the elements to be compared. comp has to return a number >0 if the first element is greater than the second, 0 if they are equal, <0 otherwise
void uti_vorder (void *a, void *b, size_t size, int n, int (*comp) (void *, int , int)) ------------------------------------------------------
Orders the elements of a according to the non_descending order of the elements in b.
a: pointer to a vector b: pointer to a vector size: size of the elements of a n: number of elements comp: comparison function for b (see for example uti_icomp)
void uti_translate_macadd (unsigned char *add, unsigned char *buffer) ---------------------------------------------------------------------
Translates hardware ethernet addresses (in the exadecimal format 08-00-2b-17-31-f4) to the a string containing the corresponding decimal numbers.
add: pointer to the input string buffer: pointer to the output vector
unsigned int uti_translate_ip_address (char *buffer) ----------------------------------------------------
This function retrieves the ip number of a node, given the same ip number as a string.
buffer: pointer to the input string (example: "192.84.127.12") return value: ip number as an unsigned long
char *uti_translate_ip_address_reverse (unsigned int *ladd) -----------------------------------------------------------
This function retrieves the ip number of a node in the form www.xxx.yyy.zzz, given the same ip number as a long. A character string is returned.
address: the address of the address number return value: ip number as a string (example: "192.84.127.12")
unsigned int uti_address (char *node) -------------------------------------
This function retrieves the node number corresponding to an ip node name. If node contains the number, this number is returned.
node: pointer to the input string (example: "lnfnet.lnf.infn.it") return value: ip number as an unsigned long
void uti_setbit (int ibit, unsigned int *imask, unsigned int ivalue) --------------------------------------------------------------------
This function sets a single bit to the value ivalue in a mask. The mask is a generic string of unsigned integers.
ibit: bit to be set imask: pointer to a vector of one of more unsigned integers containing the mask ivalue: value (TRUE or FALSE) to set the bit
unsigned int uti_getbit (int ibit, unsigned int *imask) -------------------------------------------------------
This function gets the value of a single bit from a mask. The mask is a generic string of unsigned integers.
ibit: bit to be read imask: pointer to a vector of one of more unsigned integers containing the mask return value: value (TRUE or FALSE) of the bit
int uti_static_to_dynamic (int n, unsigned int *stat_nlist, unsigned int *dyn_nlist, unsigned int *imask) ----------------------------------------------------------------------
This function fills a `dynamic' list of integers from a static one, according to the value of a single bit from a mask. The mask is a generic string of unsigned integers.
n: number of elements of the static list stat_nlist: vector containing a static list of unsigned integers dyn_nlist: vector to be filled imask: pointer to a vector of one of more unsigned integers containing the mask return value: number of `active' elements (i.e. elements in the dynamic list)
The prototypes of the KLOE DAQ useful routines.
File name : utilib_protos.h
Author : Enrico Pasqualucci
Header file containing the prototypes for the uti function. Should be included in each file where a function in that library is called.
Useful constants for the utilib functions
File name : utilib.h
Author: E. Pasqualucci
[ Index ]
[ Top ]