CAEN Utility  2.0.2
Utilities for CAEN projects
CAENMultiplatform.h File Reference

Generic wrappers to platform-dependent functions. More...

#include <types/CAENMultiplatformTypes.h>
#include <CAENUtility.h>
#include <endian.h>
Include dependency graph for CAENMultiplatform.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define c_arraysize(A)   (sizeof(A)/sizeof((A)[0])+sizeof(__typeof__(int[1-2*!!__builtin_types_compatible_p(__typeof__(A),__typeof__(&A[0]))]))*0)
 
#define _getch()   c_getch()
 
#define _kbhit()   c_kbhit()
 
#define c_freeExpandedString(str)   c_free(str)
 Also allocate the char*, that should be freed with c_free() More...
 
#define c_CopySystemTime(src, dest)   (*(dest) = *(src))
 
#define c_mp_opterr   opterr
 
#define c_mp_optopt   optopt
 
#define c_mp_optind   optind
 
#define c_mp_optarg   optarg
 
#define c_mp_getopt   getopt
 
#define c_opterr   c_mp_opterr
 
#define c_optopt   c_mp_optopt
 
#define c_optind   c_mp_optind
 
#define c_optarg   c_mp_optarg
 
#define c_getopt   c_mp_getopt
 

Functions

void * c_malloc (size_t size)
 
void * c_realloc (void *ptr, size_t size)
 
void * c_calloc (size_t nmemb, size_t size)
 
void c_free (void *ptr)
 
size_t c_malloc_size (void *ptr)
 
char * c_strdup (const char *str)
 Wrapper to strdup(str), with check for NULL arguments. To be freed with c_free(). More...
 
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(). More...
 
static void * c_zeromem (void *dest, size_t size)
 Wrapper to memset(dest, 0, size), with check for NULL arguments. More...
 
static void * c_memset (void *dest, int val, size_t size)
 Wrapper to memset(dest, val, size), with check for NULL arguments. More...
 
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. More...
 
static void * c_memmove (void *dest, const void *src, size_t size)
 Wrapper to memmove(dest, src, size), with check for NULL arguments. More...
 
int32_t c_getCurrentEnvironment (c_environment_t *dest)
 
c_Process_tc_newProc (void)
 
void c_freeProc (c_Process_t *proc)
 
int32_t c_setProcExec (const char *exec, c_Process_t *proc)
 
int32_t c_addProcArg (const char *arg, c_Process_t *proc)
 
int32_t c_addProcEnv (const char *varname, const char *varvalue, c_Process_t *proc)
 
int32_t c_startProcess (c_Process_t *proc)
 
int32_t c_endProcess (c_Process_t *proc)
 
int32_t c_getNCPU (void)
 
int32_t c_pause (void)
 
int32_t c_killProcess (const char *procName)
 
int32_t c_dlload (const char *libName, c_libhandle_t *libHandle)
 
int32_t c_dfload (c_libhandle_t hLib, const char *fcnName, c_fcnhandle_t *funcPtr)
 
int32_t c_dlclose (c_libhandle_t hLib)
 
uint32_t c_ctz (uint32_t value)
 
uint32_t c_clz (uint32_t value)
 
uint32_t c_popcount (uint32_t value)
 
uint32_t c_ctz64 (uint64_t value)
 
uint32_t c_clz64 (uint64_t value)
 
uint32_t c_popcount64 (uint64_t value)
 
DIR * c_opendir (const char *name)
 Not marked CAEN_UTILITY_API (meaningful only on 32-bit Windows), likely an original sin more than a choice. More...
 
int c_closedir (DIR *dir)
 
struct dirent * c_readdir (DIR *dir)
 Not marked CAEN_UTILITY_API (meaningful only on 32-bit Windows), likely an original sin more than a choice. More...
 
void c_rewinddir (DIR *dir)
 
int c_getch (void)
 
int c_kbhit (void)
 
int c_access (const char *pathname, int mode)
 
char * c_getcwd (char *buf, size_t size)
 
int c_chdir (const char *path)
 
int c_rmdir (const char *path)
 
int64_t c_getpid (void)
 
int c_strcasecmp (const char *s1, const char *s2)
 
int c_strncasecmp (const char *s1, const char *s2, size_t n)
 
char * c_getExpandedString (const char *filename)
 
bool c_checkFileExists (const char *fname)
 
int32_t c_getDirName (char *dest, const char *source)
 
int32_t c_getBaseName (char *dest, const char *source)
 
int32_t c_remAllFiles (const char *dir)
 
int32_t c_mkdir (const char *path)
 
int32_t c_mkdirp (const char *dir)
 Same of c_mkdir() but creates also intermediate directories. More...
 
int64_t c_frexp (double value, int16_t *exponent, int8_t *classification)
 
double c_ldexp (int64_t mantissa, int16_t exponent, int8_t classification)
 
uint64_t c_get_time (void)
 Get time in milliseconds since 00:00:00 UTC, January 1, 1970. More...
 
void c_GetLocalTime (c_systemtime_t *t)
 
void c_GetSystemTime (c_systemtime_t *t)
 
double c_DiffSystemTime_sec (const c_systemtime_t *t1, const c_systemtime_t *t2)
 
uint64_t c_getCurrentTimeRepresentation (void)
 
static uint16_t c_hton16 (uint16_t x)
 
static uint16_t c_ntoh16 (uint16_t x)
 
static uint32_t c_hton32 (uint32_t x)
 
static uint32_t c_ntoh32 (uint32_t x)
 
static uint64_t c_hton64 (uint64_t x)
 
static uint64_t c_ntoh64 (uint64_t x)
 

Detailed Description

Generic wrappers to platform-dependent functions.

Author

Definition in file CAENMultiplatform.h.

Macro Definition Documentation

◆ c_arraysize

#define c_arraysize (   A)    (sizeof(A)/sizeof((A)[0])+sizeof(__typeof__(int[1-2*!!__builtin_types_compatible_p(__typeof__(A),__typeof__(&A[0]))]))*0)

Macro to get the size of a C array, with error generated if usef for pointers

Warning
MSVC error works only when compiled as C++
Parameters
[in]Aa C array
Returns
the size

Definition at line 56 of file CAENMultiplatform.h.

◆ c_freeExpandedString

#define c_freeExpandedString (   str)    c_free(str)

Also allocate the char*, that should be freed with c_free()

Definition at line 269 of file CAENMultiplatform.h.

Function Documentation

◆ c_getExpandedString()

char* c_getExpandedString ( const char *  filename)

Definition at line 395 of file CAENMultiplatform.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ c_checkFileExists()

bool c_checkFileExists ( const char *  fname)

Definition at line 1654 of file CAENMultiplatform.c.

◆ c_getDirName()

int32_t c_getDirName ( char *  dest,
const char *  source 
)

Definition at line 448 of file CAENMultiplatform.c.

◆ c_getBaseName()

int32_t c_getBaseName ( char *  dest,
const char *  source 
)

Definition at line 472 of file CAENMultiplatform.c.

Here is the caller graph for this function:

◆ c_remAllFiles()

int32_t c_remAllFiles ( const char *  dir)

Definition at line 1689 of file CAENMultiplatform.c.

Here is the call graph for this function:

◆ c_mkdir()

int32_t c_mkdir ( const char *  path)

Definition at line 1114 of file CAENMultiplatform.c.

Here is the caller graph for this function:

◆ c_mkdirp()

int32_t c_mkdirp ( const char *  dir)

Same of c_mkdir() but creates also intermediate directories.

Definition at line 1123 of file CAENMultiplatform.c.

Here is the call graph for this function: