37 #ifndef CAEN_INCLUDE_CAENMULTIPLATFORM_H_ 38 #define CAEN_INCLUDE_CAENMULTIPLATFORM_H_ 54 #define c_arraysize(A) _countof(A) 56 #define c_arraysize(A) (sizeof(A)/sizeof((A)[0])+sizeof(__typeof__(int[1-2*!!__builtin_types_compatible_p(__typeof__(A),__typeof__(&A[0]))]))*0) 91 static inline
void*
c_zeromem(
void* dest,
size_t size) {
93 return (dest == NULL) ? dest : memset(dest, 0, size);
96 static inline void*
c_memset(
void* dest,
int val,
size_t size) {
97 return (dest == NULL) ? dest : memset(dest, val, size);
100 static inline void*
c_memcpy(
void* __restrict dest,
const void* __restrict src,
size_t size) {
101 return (dest == NULL || src == NULL) ? dest : memcpy(dest, src, size);
104 static inline void*
c_memmove(
void* dest,
const void* src,
size_t size) {
105 return (dest == NULL || src == NULL) ? dest : memmove(dest, src, size);
220 #ifdef _WIN32 // Windows (deprecated macros) 221 #define opendir(name) c_opendir(name) 222 #define closedir(dir) c_closedir(dir) 223 #define readdir(dir) c_readdir(dir) 224 #define rewinddir(dir) c_rewinddir(dir) 238 #ifndef _WIN32 // Linux (deprecated macros) 239 #define _getch() c_getch() 240 #define _kbhit() c_kbhit() 269 #define c_freeExpandedString(str) c_free(str) 327 #define c_CopySystemTime(src, dest) (*(dest) = *(src)) 392 #ifdef _WIN32 // Windows 405 #define c_mp_opterr opterr 406 #define c_mp_optopt optopt 407 #define c_mp_optind optind 408 #define c_mp_optarg optarg 409 #define c_mp_getopt getopt 412 #define c_opterr c_mp_opterr 413 #define c_optopt c_mp_optopt 414 #define c_optind c_mp_optind 415 #define c_optarg c_mp_optarg 416 #define c_getopt c_mp_getopt 423 #endif // CAEN_INCLUDE_CAENMULTIPLATFORM_H_
int32_t c_getDirName(char *dest, const char *source)
void c_freeProc(c_Process_t *proc)
DIR * c_opendir(const char *name)
Not marked CAEN_UTILITY_API (meaningful only on 32-bit Windows), likely an original sin more than a c...
static void * c_memset(void *dest, int val, size_t size)
Wrapper to memset(dest, val, size), with check for NULL arguments.
int32_t c_dfload(c_libhandle_t hLib, const char *fcnName, c_fcnhandle_t *funcPtr)
static uint64_t c_hton64(uint64_t x)
bool c_checkFileExists(const char *fname)
int32_t c_dlload(const char *libName, c_libhandle_t *libHandle)
#define c_attribute_alloc_size(...)
static void * c_memcpy(void *__restrict dest, const void *__restrict src, size_t size)
Wrapper to memcpy(dest, src, size), with check for NULL arguments.
static uint32_t c_ntoh32(uint32_t x)
int c_access(const char *pathname, int mode)
int32_t c_remAllFiles(const char *dir)
uint32_t c_clz(uint32_t value)
void * c_calloc(size_t nmemb, size_t size)
int32_t c_killProcess(const char *procName)
Main header and generic tools.
int32_t c_dlclose(c_libhandle_t hLib)
int32_t c_getBaseName(char *dest, const char *source)
Definitions and types for CAENMultiplatform.h.
char * c_getcwd(char *buf, size_t size)
uint32_t c_ctz(uint32_t value)
int32_t c_getCurrentEnvironment(c_environment_t *dest)
uint64_t c_get_time(void)
Get time in milliseconds since 00:00:00 UTC, January 1, 1970.
double c_DiffSystemTime_sec(const c_systemtime_t *t1, const c_systemtime_t *t2)
int c_rmdir(const char *path)
void c_GetSystemTime(c_systemtime_t *t)
uint32_t c_popcount64(uint64_t value)
int32_t c_endProcess(c_Process_t *proc)
int32_t c_addProcEnv(const char *varname, const char *varvalue, c_Process_t *proc)
void c_rewinddir(DIR *dir)
int32_t c_mkdir(const char *path)
int32_t c_setProcExec(const char *exec, c_Process_t *proc)
size_t c_malloc_size(void *ptr)
#define c_attribute_nonnull(...)
#define CAEN_UTILITY_DLLAPI
static c_libhandle_t libHandle
int c_strncasecmp(const char *s1, const char *s2, size_t n)
#define c_attribute_malloc
static uint16_t c_hton16(uint16_t x)
#define c_declspec_allocator
char * c_getExpandedString(const char *filename)
void * c_malloc(size_t size)
double c_ldexp(int64_t mantissa, int16_t exponent, int8_t classification)
int32_t c_addProcArg(const char *arg, c_Process_t *proc)
c_Process_t * c_newProc(void)
void c_GetLocalTime(c_systemtime_t *t)
static uint32_t c_hton32(uint32_t x)
int32_t c_mkdirp(const char *dir)
Same of c_mkdir() but creates also intermediate directories.
static void * c_memmove(void *dest, const void *src, size_t size)
Wrapper to memmove(dest, src, size), with check for NULL arguments.
static uint64_t c_ntoh64(uint64_t x)
int32_t c_startProcess(c_Process_t *proc)
int c_chdir(const char *path)
int c_strcasecmp(const char *s1, const char *s2)
int64_t c_frexp(double value, int16_t *exponent, int8_t *classification)
static uint16_t c_ntoh16(uint16_t x)
char * c_strndup(const char *str, size_t size)
Wrapper to strndup(str, size), with check for NULL arguments. To be freed with c_free().
struct dirent * c_readdir(DIR *dir)
Not marked CAEN_UTILITY_API (meaningful only on 32-bit Windows), likely an original sin more than a c...
void * c_realloc(void *ptr, size_t size)
char * c_strdup(const char *str)
Wrapper to strdup(str), with check for NULL arguments. To be freed with c_free(). ...
uint32_t c_clz64(uint64_t value)
uint64_t c_getCurrentTimeRepresentation(void)
uint32_t c_ctz64(uint64_t value)
static void * c_zeromem(void *dest, size_t size)
Wrapper to memset(dest, 0, size), with check for NULL arguments.
uint32_t c_popcount(uint32_t value)