From e8810fbc6194b56afbf9bac631b6e78ae3b92fb5 Mon Sep 17 00:00:00 2001 From: Gertjan van den Burg Date: Tue, 20 Sep 2016 17:07:25 +0200 Subject: Change globals.h to gensvm_globals.h Conformity! --- include/gensvm_base.h | 2 +- include/gensvm_cmdarg.h | 2 +- include/gensvm_globals.h | 59 ++++++++++++++++++++++++++++++++++++++++++++++++ include/gensvm_grid.h | 2 +- include/gensvm_print.h | 2 +- include/gensvm_simplex.h | 2 +- include/gensvm_strutil.h | 2 +- include/gensvm_timer.h | 2 +- include/globals.h | 59 ------------------------------------------------ src/gensvm_memory.c | 2 +- 10 files changed, 67 insertions(+), 67 deletions(-) create mode 100644 include/gensvm_globals.h delete mode 100644 include/globals.h diff --git a/include/gensvm_base.h b/include/gensvm_base.h index f2df59f..0366edf 100644 --- a/include/gensvm_base.h +++ b/include/gensvm_base.h @@ -14,7 +14,7 @@ #define GENSVM_BASE_H // includes -#include "globals.h" +#include "gensvm_globals.h" // type declarations diff --git a/include/gensvm_cmdarg.h b/include/gensvm_cmdarg.h index ac33be8..600de81 100644 --- a/include/gensvm_cmdarg.h +++ b/include/gensvm_cmdarg.h @@ -12,7 +12,7 @@ #ifndef GENSVM_CMDARG_H #define GENSVM_CMDARG_H -#include "globals.h" +#include "gensvm_globals.h" // function declarations int gensvm_check_argv(int argc, char **argv, char *str); diff --git a/include/gensvm_globals.h b/include/gensvm_globals.h new file mode 100644 index 0000000..96d3b38 --- /dev/null +++ b/include/gensvm_globals.h @@ -0,0 +1,59 @@ +/** + * @file globals.h + * @author Gertjan van den Burg + * @date January, 2014 + * @brief Global definitions + * + * @details + * This header file contains defines and includes which are used in many + * parts of the program. Most notably, it includes the gensvm_memory.h header + * which defines functions for safe memory allocation. + * + * Furthermore, a maximum and minimum function are defined here. These + * functions have their own include guards, to ensure potential linked + * libraries don't conflict with these definitions. + * + */ + +#ifndef GENSVM_GLOBALS_H +#define GENSVM_GLOBALS_H + +#include "gensvm_memory.h" +#include "gensvm_types.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +#define MAX_LINE_LENGTH 1024 + +#ifndef MIN_MAX_DEFINE +#define MIN_MAX_DEFINE +#define maximum(a, b) (a) > (b) ? (a) : (b) +#define minimum(a, b) (a) < (b) ? (a) : (b) +#endif + +// Set a matrix element (RowMajor) +#define matrix_set(M, cols, i, j, val) M[(i)*(cols)+j] = val + +// Get a matrix element (RowMajor) +#define matrix_get(M, cols, i, j) M[(i)*(cols)+j] + +// Add to a matrix element (RowMajor) +#define matrix_add(M, cols, i, j, val) M[(i)*(cols)+j] += val + +// Multiply a matrix element (RowMajor) +#define matrix_mul(M, cols, i, j, val) M[(i)*(cols)+j] *= val + +// Set a 3D matrix element (N2 = second dim, N3 = third dim, RowMajor) +#define matrix3_set(M, N2, N3, i, j, k, val) M[k+(N3)*(j+(N2)*(i))] = val + +// Get a 3D matrix element (N2 = second dim, N3 = third dim, RowMajor) +#define matrix3_get(M, N2, N3, i, j, k) M[k+(N3)*(j+(N2)*(i))] + +#endif diff --git a/include/gensvm_grid.h b/include/gensvm_grid.h index d335d7c..a37ce12 100644 --- a/include/gensvm_grid.h +++ b/include/gensvm_grid.h @@ -15,7 +15,7 @@ #ifndef GENSVM_GRID_H #define GENSVM_GRID_H -#include "globals.h" +#include "gensvm_globals.h" /** * @brief Structure for describing the entire grid search diff --git a/include/gensvm_print.h b/include/gensvm_print.h index fff7af5..4cd1dd9 100644 --- a/include/gensvm_print.h +++ b/include/gensvm_print.h @@ -13,7 +13,7 @@ #define GENSVM_PRINT_H // includes -#include "globals.h" +#include "gensvm_globals.h" // function declarations void note(const char *fmt,...); diff --git a/include/gensvm_simplex.h b/include/gensvm_simplex.h index 9bb40b1..d774afa 100644 --- a/include/gensvm_simplex.h +++ b/include/gensvm_simplex.h @@ -10,7 +10,7 @@ #define GENSVM_SIMPLEX_H // includes -#include "globals.h" +#include "gensvm_globals.h" // forward declarations void gensvm_simplex(long K, double *U); diff --git a/include/gensvm_strutil.h b/include/gensvm_strutil.h index acdd0c0..d70809b 100644 --- a/include/gensvm_strutil.h +++ b/include/gensvm_strutil.h @@ -13,7 +13,7 @@ #ifndef GENSVM_STRUTIL_H #define GENSVM_STRUTIL_H -#include "globals.h" +#include "gensvm_globals.h" bool str_startswith(const char *str, const char *pre); bool str_endswith(const char *str, const char *suf); diff --git a/include/gensvm_timer.h b/include/gensvm_timer.h index 11e61e5..563576b 100644 --- a/include/gensvm_timer.h +++ b/include/gensvm_timer.h @@ -13,7 +13,7 @@ #define GENSVM_TIMER_H // includes -#include "globals.h" +#include "gensvm_globals.h" // function declarations double gensvm_elapsed_time(clock_t s_time, clock_t e_time); diff --git a/include/globals.h b/include/globals.h deleted file mode 100644 index 96d3b38..0000000 --- a/include/globals.h +++ /dev/null @@ -1,59 +0,0 @@ -/** - * @file globals.h - * @author Gertjan van den Burg - * @date January, 2014 - * @brief Global definitions - * - * @details - * This header file contains defines and includes which are used in many - * parts of the program. Most notably, it includes the gensvm_memory.h header - * which defines functions for safe memory allocation. - * - * Furthermore, a maximum and minimum function are defined here. These - * functions have their own include guards, to ensure potential linked - * libraries don't conflict with these definitions. - * - */ - -#ifndef GENSVM_GLOBALS_H -#define GENSVM_GLOBALS_H - -#include "gensvm_memory.h" -#include "gensvm_types.h" - -#include -#include -#include -#include -#include -#include -#include -#include - -#define MAX_LINE_LENGTH 1024 - -#ifndef MIN_MAX_DEFINE -#define MIN_MAX_DEFINE -#define maximum(a, b) (a) > (b) ? (a) : (b) -#define minimum(a, b) (a) < (b) ? (a) : (b) -#endif - -// Set a matrix element (RowMajor) -#define matrix_set(M, cols, i, j, val) M[(i)*(cols)+j] = val - -// Get a matrix element (RowMajor) -#define matrix_get(M, cols, i, j) M[(i)*(cols)+j] - -// Add to a matrix element (RowMajor) -#define matrix_add(M, cols, i, j, val) M[(i)*(cols)+j] += val - -// Multiply a matrix element (RowMajor) -#define matrix_mul(M, cols, i, j, val) M[(i)*(cols)+j] *= val - -// Set a 3D matrix element (N2 = second dim, N3 = third dim, RowMajor) -#define matrix3_set(M, N2, N3, i, j, k, val) M[k+(N3)*(j+(N2)*(i))] = val - -// Get a 3D matrix element (N2 = second dim, N3 = third dim, RowMajor) -#define matrix3_get(M, N2, N3, i, j, k) M[k+(N3)*(j+(N2)*(i))] - -#endif diff --git a/src/gensvm_memory.c b/src/gensvm_memory.c index 624a4a6..304e5d8 100644 --- a/src/gensvm_memory.c +++ b/src/gensvm_memory.c @@ -6,7 +6,7 @@ * */ -#include "globals.h" // imports gensvm_memory.h +#include "gensvm_globals.h" // imports gensvm_memory.h /** * @brief Wrapper for calloc() which warns when allocation fails -- cgit v1.2.3