Manticore  Version 1.0
Physics of Molecular Clouds
Macros | Functions | Variables
util.h File Reference

The MathUtils miscellaneous utilities library. More...

#include "mutils/platform.h"
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <strings.h>
#include <unistd.h>
Include dependency graph for util.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define mu_alloc(s)   mu_alloc_r(NULL, s)
 
#define MU_DATEMAX   24 /* Max length of cppdate string. */
 
#define mu_free(p)   mu_free_r(NULL, p)
 
#define mu_freeall()   mu_freeall_r(NULL)
 
#define MU_iferr(err, func)
 
#define MU_iferr_abort(err, func)
 
#define MU_iferr_warn(err, func)
 
#define MU_iferrn(err, func)
 
#define MU_iferrn_abort(err, func)
 
#define MU_iferrn_warn(err, func)
 
#define mu_realloc(p, s)   mu_realloc_r(NULL, p, s)
 
#define MU_VERMAX   32 /* Max length of version string. */
 

Functions

DLLSPEC void * mu_alloc_r (void **, size_t)
 
DLLSPEC int mu_clock_Hz (void)
 
DLLSPEC double mu_clock_time (void)
 
DLLSPEC void mu_cppdate (char str[], const char *date, const char *time)
 
DLLSPEC double mu_cpu_time (void)
 
DLLSPEC void mu_error_action (int, const char *, const char *, int, int)
 
DLLSPEC char * mu_fgetline (char *, long int, FILE *)
 
DLLSPEC int mu_free_r (void **, void *)
 
DLLSPEC void mu_freeall_r (void *)
 
DLLSPEC int mu_getopt (int argc, char *const argv[], const char *opts)
 
DLLSPEC const char * mu_platform (void)
 
DLLSPEC int mu_ppmtext (char *, char *, int, int, int)
 
DLLSPEC double mu_process_cpu_time (void)
 
DLLSPEC double mu_real_clock_time (void)
 
DLLSPEC void * mu_realloc_r (void **, void *, size_t)
 
DLLSPEC void mu_split_tag (char pre[], int *maj, int *min, int *clas, int *bug, int *y, int *m, int *d, const char *tag)
 
DLLSPEC double mu_system_time (void)
 
DLLSPEC double mu_thread_cpu_time (void)
 
DLLSPEC double mu_time_binary (double(*fn)(double, double), double x1, double x2, double y1, double y2, double tmin)
 
DLLSPEC double mu_time_trinary (double(*fn)(double, double, double), double x1, double x2, double y1, double y2, double z1, double z2, double tmin)
 
DLLSPEC double mu_time_unary (double(*fn)(double), double x1, double x2, double tmin)
 
DLLSPEC double mu_user_time (void)
 
DLLSPEC char * mu_utoa9 (char *str, unsigned i, int strip)
 
DLLSPEC int mu_vernum (const char *name, const char *cvs)
 
DLLSPEC const char * mu_version (void)
 
DLLSPEC const char * mu_verstr (char verstr[], const char *pre, int maj, int min, int clas, int bug)
 
DLLSPEC void mu_wait_time (double)
 

Variables

DLLSPEC char * mu_optarg
 
DLLSPEC int mu_opterr
 
DLLSPEC int mu_optind
 
DLLSPEC int mu_optopt
 

Detailed Description

The MathUtils miscellaneous utilities library.

Includes the following common headers:

Aliases the following common values into the mutils namespace:

Author:  Kevin P. Rauch  <rauch.nosp@m.@ast.nosp@m.ro.um.nosp@m.d.ed.nosp@m.u>

Definition in file util.h.

Macro Definition Documentation

◆ mu_alloc

#define mu_alloc (   s)    mu_alloc_r(NULL, s)

Definition at line 100 of file util.h.

◆ MU_DATEMAX

#define MU_DATEMAX   24 /* Max length of cppdate string. */

Definition at line 53 of file util.h.

◆ mu_free

#define mu_free (   p)    mu_free_r(NULL, p)

Definition at line 102 of file util.h.

◆ mu_freeall

#define mu_freeall ( )    mu_freeall_r(NULL)

Definition at line 103 of file util.h.

◆ MU_iferr

#define MU_iferr (   err,
  func 
)
Value:
do { \
if (err) mu_error_action(-1, func, __FILE__, __LINE__, 1); } while (0)
DLLSPEC void mu_error_action(int, const char *, const char *, int, int)

Definition at line 85 of file util.h.

◆ MU_iferr_abort

#define MU_iferr_abort (   err,
  func 
)
Value:
do { \
if (err) mu_error_action(-1, func, __FILE__, __LINE__, -1); } while (0)
DLLSPEC void mu_error_action(int, const char *, const char *, int, int)

Definition at line 79 of file util.h.

◆ MU_iferr_warn

#define MU_iferr_warn (   err,
  func 
)
Value:
do { \
if (err) mu_error_action(-1, func, __FILE__, __LINE__, 0); } while (0)
DLLSPEC void mu_error_action(int, const char *, const char *, int, int)

Definition at line 82 of file util.h.

◆ MU_iferrn

#define MU_iferrn (   err,
  func 
)
Value:
do { \
int errn=(err); \
if (errn) mu_error_action(errn, func, __FILE__, __LINE__, 1); } while (0)
DLLSPEC void mu_error_action(int, const char *, const char *, int, int)

Definition at line 96 of file util.h.

◆ MU_iferrn_abort

#define MU_iferrn_abort (   err,
  func 
)
Value:
do { \
int errn=(err); \
if (errn) mu_error_action(errn, func, __FILE__, __LINE__, -1); } while (0)
DLLSPEC void mu_error_action(int, const char *, const char *, int, int)

Definition at line 88 of file util.h.

◆ MU_iferrn_warn

#define MU_iferrn_warn (   err,
  func 
)
Value:
do { \
int errn=(err); \
if (errn) mu_error_action(errn, func, __FILE__, __LINE__, 0); } while (0)
DLLSPEC void mu_error_action(int, const char *, const char *, int, int)

Definition at line 92 of file util.h.

◆ mu_realloc

#define mu_realloc (   p,
 
)    mu_realloc_r(NULL, p, s)

Definition at line 101 of file util.h.

◆ MU_VERMAX

#define MU_VERMAX   32 /* Max length of version string. */

Definition at line 52 of file util.h.

Function Documentation

◆ mu_alloc_r()

DLLSPEC void * mu_alloc_r ( void **  ,
size_t   
)

◆ mu_clock_Hz()

DLLSPEC int mu_clock_Hz ( void  )

◆ mu_clock_time()

DLLSPEC double mu_clock_time ( void  )

◆ mu_cppdate()

DLLSPEC void mu_cppdate ( char  str[],
const char *  date,
const char *  time 
)

◆ mu_cpu_time()

DLLSPEC double mu_cpu_time ( void  )

◆ mu_error_action()

DLLSPEC void mu_error_action ( int  ,
const char *  ,
const char *  ,
int  ,
int   
)

◆ mu_fgetline()

DLLSPEC char * mu_fgetline ( char *  ,
long  int,
FILE *   
)

◆ mu_free_r()

DLLSPEC int mu_free_r ( void **  ,
void *   
)

◆ mu_freeall_r()

DLLSPEC void mu_freeall_r ( void *  )

◆ mu_getopt()

DLLSPEC int mu_getopt ( int  argc,
char *const  argv[],
const char *  opts 
)

◆ mu_platform()

DLLSPEC const char* mu_platform ( void  )

◆ mu_ppmtext()

DLLSPEC int mu_ppmtext ( char *  ,
char *  ,
int  ,
int  ,
int   
)

◆ mu_process_cpu_time()

DLLSPEC double mu_process_cpu_time ( void  )

◆ mu_real_clock_time()

DLLSPEC double mu_real_clock_time ( void  )

◆ mu_realloc_r()

DLLSPEC void * mu_realloc_r ( void **  ,
void *  ,
size_t   
)

◆ mu_split_tag()

DLLSPEC void mu_split_tag ( char  pre[],
int *  maj,
int *  min,
int *  clas,
int *  bug,
int *  y,
int *  m,
int *  d,
const char *  tag 
)

◆ mu_system_time()

DLLSPEC double mu_system_time ( void  )

◆ mu_thread_cpu_time()

DLLSPEC double mu_thread_cpu_time ( void  )

◆ mu_time_binary()

DLLSPEC double mu_time_binary ( double(*)(double, double)  fn,
double  x1,
double  x2,
double  y1,
double  y2,
double  tmin 
)

◆ mu_time_trinary()

DLLSPEC double mu_time_trinary ( double(*)(double, double, double)  fn,
double  x1,
double  x2,
double  y1,
double  y2,
double  z1,
double  z2,
double  tmin 
)

◆ mu_time_unary()

DLLSPEC double mu_time_unary ( double(*)(double)  fn,
double  x1,
double  x2,
double  tmin 
)

◆ mu_user_time()

DLLSPEC double mu_user_time ( void  )

◆ mu_utoa9()

DLLSPEC char* mu_utoa9 ( char *  str,
unsigned  i,
int  strip 
)

◆ mu_vernum()

DLLSPEC int mu_vernum ( const char *  name,
const char *  cvs 
)

◆ mu_version()

DLLSPEC const char * mu_version ( void  )

◆ mu_verstr()

DLLSPEC const char * mu_verstr ( char  verstr[],
const char *  pre,
int  maj,
int  min,
int  clas,
int  bug 
)

◆ mu_wait_time()

DLLSPEC void mu_wait_time ( double  )

Variable Documentation

◆ mu_optarg

DLLSPEC char* mu_optarg

◆ mu_opterr

DLLSPEC int mu_opterr

◆ mu_optind

DLLSPEC int mu_optind

◆ mu_optopt

DLLSPEC int mu_optopt