MAOS
Multithreaded Adaptive Optics Simulator
|
Macros | |
#define | MAX(a, b) ({__typeof__(a) _M1=(a); __typeof__(b) _M2=(b); (_M1)>(_M2)?(_M1):(_M2);}) |
#define | MIN(a, b) ({__typeof__(a) _m1=(a); __typeof__(b) _m2=(b); (_m1)<(_m2)?(_m1):(_m2);}) |
#define | RSS(a, b) ({__typeof__(a) _M1=(a); __typeof__(b) _M2=(b); sqrtf(_M1*_M1+_M2*_M2);}) |
#define | CLIP(x, d_, u_) ({__typeof__(d_) d=(d_); __typeof__(u_) u=(u_);x=x<d?d:(x>u?u:x);}) |
#define | restrict __restrict |
#define | EPS 1.e-15 |
#define | BASEFILE mybasename(__FILE__) |
#define | BLACK "\033[00;00m" |
#define | RED "\033[01;31m" |
#define | GREEN "\033[0;32m" |
#define | YELLOW "\033[0;33m" |
#define | BLUE "\033[0;34m" |
#define | MAGENTA "\033[0;35m" |
#define | CYAN "\033[0;36m" |
#define | logerr(level, COLOR, format, ...) ({if(LOG_LEVEL>level){fprintf(stderr, COLOR format BLACK, ##__VA_ARGS__); if(fplog){fprintf(fplog, format, ##__VA_ARGS__);}}}) |
#define | logdbg(level, COLOR, format, ...) ({if(LOG_LEVEL>level){fprintf(stdout, COLOR format BLACK, ##__VA_ARGS__); if(fplog){fprintf(fplog, format, ##__VA_ARGS__);}}}) |
#define | logstd(level, A...) ({if(LOG_LEVEL>level){fprintf(stdout, A); if(fplog){fprintf(fplog, A);}}}) |
#define | error(format, ...) ({logerr(-4, RED, "Error(%s:%d): " format, BASEFILE,__LINE__, ##__VA_ARGS__); default_signal_handler(SIGUSR2,0,0);}) |
#define | warning(format, ...) logerr(-4, CYAN, "Warning(%s:%d): " format, BASEFILE,__LINE__, ##__VA_ARGS__) |
#define | warning_time(format, ...) logerr(-4, CYAN, "[%s]Warning(%s:%d): " format, myasctime(0),BASEFILE,__LINE__, ##__VA_ARGS__) |
#define | warning_once(A...) ({static int done=0; if(!done){done=1; warning(A);}}) |
#define | info_line(format, ...) logstd(-4, "Info(%s:%d): " format ,BASEFILE,__LINE__,##__VA_ARGS__) |
#define | info_time(format, ...) logstd(-1, "[%s]Info(%s:%d): " format, myasctime(0), BASEFILE,__LINE__,##__VA_ARGS__) |
#define | info(A...) logstd(-1, A) |
#define | info2(A...) logstd(-2, A) |
#define | info3(A...) logstd(-3, A) |
#define | info_once(A...) ({static int done=0; if(!done){done=1; info(A);}}) |
#define | info_progress(i, n) if((i)%(((n)>>4)+1)==0) fprintf(stderr,">") |
#define | info_errno(A) if(errno) info(A " failed (%d): %s\n", errno, strerror(errno)) |
#define | dbg(A...) logdbg(0, YELLOW, A) |
#define | dbg2(A...) logdbg(1, YELLOW, A) |
#define | dbg3(A...) logdbg(2, YELLOW, A) |
#define | logdbg_time(level, format, ...) logdbg(level, YELLOW, "[%s]%s: " format, myasctime(0), __func__, ##__VA_ARGS__) |
#define | dbg_line(format, ...) logdbg(0, YELLOW, "Debug(%s:%d): " format ,BASEFILE,__LINE__,##__VA_ARGS__) |
#define | dbg_time(A...) logdbg_time(0, A) |
#define | dbg2_time(A...) logdbg_time(1, A) |
#define | dbg3_time(A...) logdbg_time(2, A) |
#define | dbg_once(A...) ({static int done=0; if(!done){done=1; dbg_line(A);}}) |
#define | assert(A) |
#define | check(A) (A) |
#define | TIC double tk |
#define | tic tk=myclockd() |
#define | toc(format, ...) logstd(-1, format " takes %.6f seconds.\n", ##__VA_ARGS__, myclockd()-tk) |
#define | toc2(format, ...) dbg(format " takes %.6f seconds.\n", ##__VA_ARGS__, myclockd()-tk) |
#define | toc3 (myclockd()-tk) |
#define | format2fn |
#define | CHECK_ARG(n) |
#define | LIKELY(A) A |
#define | UNLIKELY(A) A |
#define | CHECK_UNUSED_RESULT |
#define | CHECK_NULL_TERMINATED |
#define | STR_TO_INT(A, B) strtol(A,B,10) |
#define | STR_TO_DBL(A, B) strtod(A,B) |
#define | READ_ENV_NUM(A, min, max, T, FUN) |
#define | READ_ENV_INT(A, min, max) READ_ENV_NUM(A,min,max,int, STR_TO_INT) |
#define | READ_ENV_DBL(A, min, max) READ_ENV_NUM(A,min,max,double,STR_TO_DBL) |
#define | DEF_ENV_FLAG(A, default_val) |
Every source file in this folder should include this file
#define DEF_ENV_FLAG | ( | A, | |
default_val | |||
) |