From 11ee1bc5dee4311ecd01442c8a3bfe3e5a29953a Mon Sep 17 00:00:00 2001 From: Mathieu Faverge <mathieu.faverge@inria.fr> Date: Thu, 27 Apr 2017 13:01:54 +0200 Subject: [PATCH] Add common.c/comm.h into testings and restructure headers --- include/libhqr.h | 2 +- include/{common.h => libhqr_common.h} | 14 +++++--------- include/{libdraw.h => libhqr_draw.h} | 13 +++++++------ include/{queue.h => libhqr_queue.h} | 12 ++++++------ src/queue.c | 2 +- src/treedraw.c | 2 +- src/treewalk.c | 4 ++-- testings/CMakeLists.txt | 6 +++++- testings/testing_pivgen.c | 5 +++-- testings/testing_tileinit.c | 4 +--- testings/testing_treedraw.c | 4 +--- 11 files changed, 33 insertions(+), 35 deletions(-) rename include/{common.h => libhqr_common.h} (59%) rename include/{libdraw.h => libhqr_draw.h} (77%) rename include/{queue.h => libhqr_queue.h} (79%) diff --git a/include/libhqr.h b/include/libhqr.h index 2406395..4f95775 100644 --- a/include/libhqr.h +++ b/include/libhqr.h @@ -18,8 +18,8 @@ #ifndef _LIBHQR_H_ #define _LIBHQR_H_ -#include "common.h" #include <stdio.h> +#include "libhqr_common.h" BEGIN_C_DECLS diff --git a/include/common.h b/include/libhqr_common.h similarity index 59% rename from include/common.h rename to include/libhqr_common.h index 0b4d316..1ae8a43 100644 --- a/include/common.h +++ b/include/libhqr_common.h @@ -1,14 +1,10 @@ /** * - * @file common.h + * @file libhqr_common.h * * Header file for common macro * - * @copyright 2010-2017 The University of Tennessee and The University - * of Tennessee Research Foundation. All rights - * reserved. - * - * @copyright 2012-2017 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, + * @copyright 2017 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, * Univ. Bordeaux. All rights reserved. * * @version 1.0.0 @@ -17,8 +13,8 @@ * @date 2017-04-05 * */ -#ifndef _COMMON_H_ -#define _COMMON_H_ +#ifndef _LIBHQR_COMMON_H_ +#define _LIBHQR_COMMON_H_ #undef BEGIN_C_DECLS #undef END_C_DECLS @@ -30,4 +26,4 @@ # define END_C_DECLS /* empty */ #endif -#endif /* _COMMON_H_ */ +#endif /* _LIBHQR_COMMON_H_ */ diff --git a/include/libdraw.h b/include/libhqr_draw.h similarity index 77% rename from include/libdraw.h rename to include/libhqr_draw.h index bef64bc..596151d 100644 --- a/include/libdraw.h +++ b/include/libhqr_draw.h @@ -1,10 +1,10 @@ /** * - * @file libdraw.h + * @file libhqr_draw.h * * Header file for all the functions of drawing. * - * @copyright 2017 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, + * @copyright 2017 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, * Univ. Bordeaux. All rights reserved. * * @version 1.0.0 @@ -14,10 +14,11 @@ * **/ -#ifndef _LIBDRAW_H_ -#define _LIBDRAW_H_ +#ifndef _LIBHQR_DRAW_H_ +#define _LIBHQR_DRAW_H_ + +#include "libhqr_common.h" -#include "common.h" BEGIN_C_DECLS #define WIDTH 50 @@ -42,4 +43,4 @@ void libhqr_drawline(int x1, int y1, int x2, int y2, int k, FILE *file); END_C_DECLS -#endif /* _LIBDRAW_H_ */ +#endif /* _LIBHQR_DRAW_H_ */ diff --git a/include/queue.h b/include/libhqr_queue.h similarity index 79% rename from include/queue.h rename to include/libhqr_queue.h index 7581a5d..1448ce8 100644 --- a/include/queue.h +++ b/include/libhqr_queue.h @@ -1,10 +1,10 @@ /** * - * @file queue.h + * @file libhqr_queue.h * * Queue module for the treewalk algorithm. * - * @copyright 2012-2017 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, + * @copyright 2017 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria, * Univ. Bordeaux. All rights reserved. * * @version 1.0.0 @@ -13,10 +13,10 @@ * @date 2017-03-21 * */ -#ifndef _QUEUE_H_ -#define _QUEUE_H_ +#ifndef _LIBHQR_QUEUE_H_ +#define _LIBHQR_QUEUE_H_ -#include "common.h" +#include "libhqr_common.h" BEGIN_C_DECLS @@ -34,4 +34,4 @@ void libhqr_queue_tile_delete(libhqr_queue_tile_t ** queue_tile); END_C_DECLS -#endif /* _QUEUE_H_ */ +#endif /* _LIBHQR_QUEUE_H_ */ diff --git a/src/queue.c b/src/queue.c index 6afbbf7..eedec89 100644 --- a/src/queue.c +++ b/src/queue.c @@ -13,7 +13,7 @@ * @date 2017-04-05 * */ -#include "queue.h" +#include "libhqr_queue.h" #include <stdlib.h> #include <stdio.h> #include <assert.h> diff --git a/src/treedraw.c b/src/treedraw.c index 4c3a05d..4a22317 100644 --- a/src/treedraw.c +++ b/src/treedraw.c @@ -16,7 +16,7 @@ #include <string.h> #include <stdio.h> -#include "libdraw.h" +#include "libhqr_draw.h" /* * Global array for color diff --git a/src/treewalk.c b/src/treewalk.c index 4f6e494..4643048 100644 --- a/src/treewalk.c +++ b/src/treewalk.c @@ -15,8 +15,8 @@ */ #include "libhqr.h" -#include "libdraw.h" -#include "queue.h" +#include "libhqr_draw.h" +#include "libhqr_queue.h" #include <stdio.h> #include <assert.h> #include <stdlib.h> diff --git a/testings/CMakeLists.txt b/testings/CMakeLists.txt index 5f5c936..59ed2e4 100644 --- a/testings/CMakeLists.txt +++ b/testings/CMakeLists.txt @@ -8,6 +8,9 @@ # @date 2017-04-26 # ### + +include_directories(${CMAKE_CURRENT_SOURCE_DIR}) + set(TESTINGS testing_pivgen.c testing_tileinit.c @@ -16,7 +19,8 @@ set(TESTINGS foreach (_file ${TESTINGS}) get_filename_component(_name_we ${_file} NAME_WE) - add_executable(${_name_we} ${_file}) + add_executable(${_name_we} + ${_file} common.c) target_link_libraries(${_name_we} hqr) install(TARGETS ${_name_we} RUNTIME DESTINATION examples ) diff --git a/testings/testing_pivgen.c b/testings/testing_pivgen.c index 3b80573..669755c 100644 --- a/testings/testing_pivgen.c +++ b/testings/testing_pivgen.c @@ -17,11 +17,12 @@ * @date 2017-03-21 * */ -#include "libhqr.h" #include <stdlib.h> #include <stdio.h> +#include "libhqr.h" -int main(int argc, char ** argv) +int +main(int argc, char ** argv) { libhqr_tree_t qrtree; libhqr_tiledesc_t matrix; diff --git a/testings/testing_tileinit.c b/testings/testing_tileinit.c index 895aa63..e2cccd2 100644 --- a/testings/testing_tileinit.c +++ b/testings/testing_tileinit.c @@ -1,6 +1,6 @@ /** * - * @file testting_tileinit.c + * @file testing_tileinit.c * * Testing file for the functions stocking the informations of the tiles * @@ -13,8 +13,6 @@ * @date 2017-04-18 * */ - - #include <stdio.h> #include <string.h> #include <stdlib.h> diff --git a/testings/testing_treedraw.c b/testings/testing_treedraw.c index d37809f..a9b1ed3 100644 --- a/testings/testing_treedraw.c +++ b/testings/testing_treedraw.c @@ -13,13 +13,11 @@ * @date 2017-04-04 * */ - - #include <stdio.h> #include <string.h> #include <stdlib.h> -#include "libdraw.h" #include "libhqr.h" +#include "libhqr_draw.h" int main(int argc, char ** argv) -- GitLab