--- /dev/null
+# See more at: https://cmake.org/Wiki/CMake_Useful_Variables
+
+# Stop if cmake version below 2.8
+cmake_minimum_required(VERSION 2.8 FATAL_ERROR)
+
+# Project name
+project(anna)
+
+# Enable c++ language
+enable_language(C CXX)
+
+# Project version
+set(VERSION_MAJOR 1)
+set(VERSION_MINOR 0)
+set(VERSION_PATCH 0)
+
+# Build type:
+if(NOT CMAKE_BUILD_TYPE)
+ message(WARNING "Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel.")
+ set(CMAKE_BUILD_TYPE "Release" CACHE STRING
+ "Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel." FORCE)
+endif(NOT CMAKE_BUILD_TYPE)
+
+# Build output directory:
+set(CMAKE_RUNTIME_OUTPUT_DIRECTORY build/${CMAKE_BUILD_TYPE}/bin)
+set(CMAKE_LIBRARY_OUTPUT_DIRECTORY build/${CMAKE_BUILD_TYPE}/lib)
+set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY build/${CMAKE_BUILD_TYPE}/lib)
+message(STATUS "CMAKE_RUNTIME_OUTPUT_DIRECTORY is ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}")
+message(STATUS "CMAKE_LIBRARY_OUTPUT_DIRECTORY is ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}")
+message(STATUS "CMAKE_ARCHIVE_OUTPUT_DIRECTORY is ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}")
+
+# http://stackoverflow.com/questions/6594796/how-do-i-make-cmake-output-into-a-bin-dir
+#set_target_properties( targets...
+# PROPERTIES
+# ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
+# LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
+# RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin"
+#)
+
+# Location of additional cmake modules
+set(CMAKE_MODULE_PATH
+ ${CMAKE_MODULE_PATH}
+ ${CMAKE_CURRENT_SOURCE_DIR}/cmake
+ )
+
+# Detect operating system
+message(STATUS "This is a ${CMAKE_SYSTEM_NAME} system")
+if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
+ add_definitions(-DSYSTEM_LINUX)
+endif()
+if(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
+ add_definitions(-DSYSTEM_DARWIN)
+endif()
+if(${CMAKE_SYSTEM_NAME} STREQUAL "AIX")
+ add_definitions(-DSYSTEM_AIX)
+endif()
+
+# Detect host processor
+message(STATUS "The host processor is ${CMAKE_HOST_SYSTEM_PROCESSOR}")
+message(STATUS "The c compiler is ${CMAKE_C_COMPILER}")
+message(STATUS "The c++ compiler is ${CMAKE_CXX_COMPILER}")
+message(STATUS "The build type is ${CMAKE_BUILD_TYPE}")
+
+# Example how to set c++ compiler flags for GNU
+if(CMAKE_CXX_COMPILER_ID MATCHES GNU)
+ #execute_process(COMMAND g++ --version >/dev/null 2>/dev/null)
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -Wno-unknown-pragmas -Wno-sign-compare -Woverloaded-virtual -Wwrite-strings -Wno-unused")
+ set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g3")
+ set(CMAKE_CXX_FLAGS_RELEASE "-O3")
+
+elseif(CMAKE_CXX_COMPILER_ID MATCHES Clang)
+ #execute_process(COMMAND clang++ --version >/dev/null 2>/dev/null)
+ add_definitions(-DIS_CLANG)
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -Wno-unknown-pragmas -Wno-sign-compare -Woverloaded-virtual -Wwrite-strings -Wno-unused -Wno-parentheses-equality")
+ set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g3")
+ set(CMAKE_CXX_FLAGS_RELEASE "-O3")
+endif()
+
+
+if (CMAKE_BUILD_TYPE STREQUAL Debug)
+ set(BUILD_POSTFIX "_d")
+else(CMAKE_BUILD_TYPE STREQUAL Debug)
+ set(BUILD_POSTFIX "")
+endif(CMAKE_BUILD_TYPE STREQUAL Debug)
+
+
+# Macro to get children directories:
+MACRO(SUBDIRLIST result curdir)
+ FILE(GLOB children RELATIVE ${curdir} ${curdir}/*)
+ SET(dirlist "")
+ FOREACH(child ${children})
+ IF(IS_DIRECTORY ${curdir}/${child})
+ LIST(APPEND dirlist ${child})
+ ENDIF()
+ ENDFOREACH()
+ SET(${result} ${dirlist})
+ENDMACRO()
+
+# Definitions (any way to apply only at ldap context ?):
+add_definitions(-DLDAP_DEPRECATED)
+
+# General includes:
+include_directories(include/anna)
+include_directories(/usr/include/libxml2)
+include_directories(/usr/lib/oracle/12.1/client64/include)
+
+# <source>
+SUBDIRLIST(SUBDIRS ${CMAKE_CURRENT_SOURCE_DIR}/source)
+FOREACH(subdir ${SUBDIRS})
+ message(STATUS "Processing library at: source/${subdir}")
+ file(GLOB_RECURSE SRCS source/${subdir}/*.cpp)
+ add_library(${subdir}_static STATIC ${SRCS})
+ add_library(${subdir}_shared SHARED ${SRCS})
+ENDFOREACH()
+
+# <dynamic>
+file(GLOB_RECURSE DYNAMIC_PROCEDURES ${CMAKE_CURRENT_SOURCE_DIR}/dynamic/launcher/*.cpp)
+FOREACH(procedure ${DYNAMIC_PROCEDURES})
+ get_filename_component(dirname ${procedure} DIRECTORY)
+ file(RELATIVE_PATH rel ${CMAKE_CURRENT_SOURCE_DIR}/dynamic/launcher ${dirname})
+ # convert "/" to "_"
+ string(REGEX REPLACE "/" "_" libpath ${rel})
+
+ message(STATUS "Processing dynamic library at: dynamic/launcher/${rel}")
+ file(GLOB_RECURSE SRCS dynamic/launcher/${rel}/*.cpp)
+ add_library(launcher_procedure_${libpath}_shared SHARED ${SRCS})
+ set(target_dirname build/${CMAKE_BUILD_TYPE}/lib/dynamic_launcher/${libpath})
+ set(target_basename launcher_procedure_${libpath}_shared)
+ set_target_properties(${target_basename} PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${target_dirname})
+ #file(RENAME ${target_dirname}/lib${target_basename}.so ${target_dirname}/libprocedure.so)
+ENDFOREACH()
+
+# Linking example:
+#file(GLOB_RECURSE SRCS ${CMAKE_CURRENT_SOURCE_DIR}/example/core/genLogon/*.cpp)
+#add_executable(genLogon ${SRCS})
+#target_link_libraries(genLogon core_static app_static core_static test_static xml_static io_static crypto xml2 rt)
+
+# Generalization:
+# <example>
+SUBDIRLIST(MODULES ${CMAKE_CURRENT_SOURCE_DIR}/example)
+FOREACH(module ${MODULES})
+ SUBDIRLIST(SUBDIRS ${CMAKE_CURRENT_SOURCE_DIR}/example/${module})
+ FOREACH(subdir ${SUBDIRS})
+ message(STATUS "Processing executable at: example/${module}/${subdir}")
+
+ # Sources
+ file(GLOB_RECURSE SRCS ${CMAKE_CURRENT_SOURCE_DIR}/example/${module}/${subdir}/*.cpp)
+
+ # Executable
+ set(target "${module}_${subdir}")
+ add_executable(${target} "${SRCS}")
+ set_target_properties(${target} PROPERTIES LINKER_LANGUAGE CXX)
+ set(libraries_file "${CMAKE_CURRENT_SOURCE_DIR}/example/${module}/${subdir}/libraries.txt")
+ set(includes_file "${CMAKE_CURRENT_SOURCE_DIR}/example/${module}/${subdir}/includes.txt")
+
+ if(EXISTS "${includes_file}")
+ file (STRINGS "${includes_file}" HDRS)
+ # Include own example directory:
+ target_include_directories(${target} PUBLIC
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/example/${module}/${subdir}>
+ )
+ FOREACH(HDR ${HDRS})
+ #message(STATUS "Header directory: ${HDR}")
+ target_include_directories(${target} PUBLIC
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/${HDR}>
+ )
+ ENDFOREACH()
+ endif()
+
+ if(EXISTS "${libraries_file}")
+ file (STRINGS "${libraries_file}" LIBS)
+ #message(STATUS "Libraries: ${LIBS}")
+ target_link_libraries(${target} ${LIBS})
+ endif()
+
+ ENDFOREACH()
+ENDFOREACH()
+
+
+# <test>
+find_package(Boost COMPONENTS system filesystem REQUIRED)
+SUBDIRLIST(MODULES ${CMAKE_CURRENT_SOURCE_DIR}/test)
+FOREACH(module ${MODULES})
+
+ message(STATUS "Processing basic test at: test/${module}")
+
+ # Sources
+ file(GLOB_RECURSE SRCS ${CMAKE_CURRENT_SOURCE_DIR}/test/${module}/*.cpp)
+
+ # Executable
+ set(target "${module}")
+ find_package(Boost COMPONENTS system filesystem unit_test_framework REQUIRED)
+ add_executable(${target} "${SRCS}")
+ set_target_properties(${target} PROPERTIES LINKER_LANGUAGE CXX)
+
+
+ set(libraries_file "${CMAKE_CURRENT_SOURCE_DIR}/example/${module}/${subdir}/libraries.txt")
+
+ if(EXISTS "${libraries_file}")
+ file (STRINGS "${libraries_file}" LIBS)
+ #message(STATUS "Libraries: ${LIBS}")
+ target_link_libraries(${target} ${Boost_FILESYSTEM_LIBRARY} ${Boost_SYSTEM_LIBRARY} ${LIBS})
+ endif()
+
+ add_test(tester tester)
+
+ENDFOREACH()
+
+
+# Install
+# see http://stackoverflow.com/questions/14084759/keep-a-single-files-permissions-when-using-install-in-cmake
+####set(CMAKE_INSTALL_PREFIX "${CMAKE_SOURCE_DIR}/deploy")
+####install(FILES build/lib/libtools_static.a DESTINATION lib)
+####install(PROGRAMS build/lib/libtools_shared.so DESTINATION lib)
+####install(PROGRAMS build/bin/hello DESTINATION bin)
+
+# Add target for API documentation with Doxygen
+find_package(Doxygen)
+if(DOXYGEN_FOUND)
+add_custom_target(doc
+ ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/docs/doxygen/Doxyfile
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/docs/doxygen
+ COMMENT "Generating API documentation with Doxygen" VERBATIM
+)
+endif(DOXYGEN_FOUND)
+
Based on GIT, hosted on http://redmine.teslayout.com
You could use my pre-commit specific template if you want to do some basic checkings (i.e.
- astyle code processing): Execute './scr/git/use-pre-commit.sh'
+ astyle code processing): Execute './scripts/git/use-pre-commit.sh'
## Documentation
--- /dev/null
+comm_static
+timex_static
+app_static
+test_static
+xml_static
+io_static
+core_static
+pthread
+rt
+xml2
--- /dev/null
+comm_static
+timex_static
+app_static
+test_static
+xml_static
+io_static
+core_static
+pthread
+rt
+xml2
--- /dev/null
+comm_static
+timex_static
+app_static
+test_static
+xml_static
+io_static
+core_static
+pthread
+rt
+xml2
--- /dev/null
+comm_static
+timex_static
+app_static
+test_static
+xml_static
+io_static
+core_static
+pthread
+rt
+xml2
--- /dev/null
+comm_static
+timex_static
+app_static
+test_static
+xml_static
+io_static
+core_static
+pthread
+rt
+xml2
--- /dev/null
+comm_static
+timex_static
+app_static
+test_static
+xml_static
+io_static
+core_static
+pthread
+rt
+xml2
--- /dev/null
+comm_static
+timex_static
+app_static
+test_static
+xml_static
+io_static
+core_static
+pthread
+rt
+xml2
--- /dev/null
+comm_static
+timex_static
+app_static
+test_static
+xml_static
+io_static
+core_static
+pthread
+rt
+xml2
--- /dev/null
+comm_static
+timex_static
+app_static
+test_static
+xml_static
+io_static
+core_static
+pthread
+rt
+xml2
--- /dev/null
+comm_static
+timex_static
+app_static
+test_static
+xml_static
+io_static
+core_static
+pthread
+rt
+xml2
--- /dev/null
+comm_static
+timex_static
+app_static
+test_static
+xml_static
+io_static
+core_static
+pthread
+rt
+xml2
--- /dev/null
+comm_static
+timex_static
+app_static
+test_static
+xml_static
+io_static
+core_static
+pthread
+rt
+xml2
--- /dev/null
+comm_static
+timex_static
+app_static
+test_static
+xml_static
+io_static
+core_static
+pthread
+rt
+xml2
--- /dev/null
+comm_static
+timex_static
+app_static
+test_static
+xml_static
+io_static
+core_static
+pthread
+rt
+xml2
--- /dev/null
+app_static
+test_static
+xml_static
+io_static
+core_static
+rt
+xml2
+crypto
--- /dev/null
+comm_static
+timex_static
+app_static
+test_static
+xml_static
+io_static
+core_static
+pthread
+rt
+xml2
--- /dev/null
+comm_static
+timex_static
+app_static
+test_static
+xml_static
+io_static
+core_static
+pthread
+rt
+xml2
--- /dev/null
+comm_static
+timex_static
+app_static
+test_static
+xml_static
+io_static
+core_static
+pthread
+rt
+xml2
--- /dev/null
+comm_static
+timex_static
+app_static
+test_static
+xml_static
+io_static
+core_static
+pthread
+rt
+xml2
--- /dev/null
+comm_static
+timex_static
+app_static
+test_static
+xml_static
+io_static
+core_static
+pthread
+rt
+xml2
+crypto
--- /dev/null
+comm_static
+timex_static
+app_static
+test_static
+xml_static
+io_static
+core_static
+pthread
+rt
+xml2
--- /dev/null
+comm_static
+timex_static
+app_static
+test_static
+xml_static
+io_static
+core_static
+pthread
+rt
+xml2
--- /dev/null
+io_static
+core_static
+xml_static
+rt
+xml2
--- /dev/null
+core_static
+xml_static
+rt
+xml2
--- /dev/null
+comm_static
+timex_static
+app_static
+test_static
+xml_static
+io_static
+core_static
+pthread
+rt
+xml2
--- /dev/null
+io_static
+core_static
+xml_static
+z
+rt
+xml2
--- /dev/null
+mysqlclient
+++ /dev/null
-#include <stdlib.h>
-#include <string.h>
-#include <stdio.h>
-
-#include <mysql/mysql.h>
-
-#define STRING_SIZE 50
-
-#define INSERT_SAMPLE "insert into anna_db_test (xx, yy, zz, tt) values (?,?,?,?)"
-
-
-#define MAXCOLUMN 4
-
-MYSQL* mysql;
-MYSQL_STMT *stmt;
-MYSQL_BIND bind[MAXCOLUMN];
-MYSQL_TIME ts;
-unsigned long length[MAXCOLUMN];
-int param_count, column_count, row_count;
-float float_data;
-int int_data;
-char str_data[STRING_SIZE];
-my_bool is_null[MAXCOLUMN];
-
-/*
- * From http://dev.mysql.com/doc/refman/4.1/en/mysql-stmt-fetch.html
- */
-int main ()
-{
- if ((mysql = mysql_init (NULL)) == NULL)
- exit(-12);
-
- if (mysql_real_connect (mysql, NULL, "sdp", "sdp", "test", 0, NULL, 0L) == NULL) {
- fprintf(stderr, " mysql_stmt_prepare(), SELECT failed\n");
- fprintf(stderr, " %s\n", mysql_stmt_error(stmt));
- exit(0);
- }
-
- /* Prepare a SELECT query to fetch data from test_table */
- stmt = mysql_stmt_init(mysql);
- if (!stmt)
- {
- fprintf(stderr, " mysql_stmt_init(), out of memory\n");
- exit(0);
- }
-
- if (mysql_stmt_prepare(stmt, INSERT_SAMPLE, strlen(INSERT_SAMPLE)))
- {
- fprintf(stderr, " mysql_stmt_prepare(), INSERT failed\n");
- fprintf(stderr, " %s\n", mysql_stmt_error(stmt));
- exit(0);
- }
- fprintf(stdout, " prepare, INSERT successful\n");
-
- /* Get the parameter count from the statement */
- param_count= mysql_stmt_param_count(stmt);
- fprintf(stdout, " total parameters in INSERT: %d\n", param_count);
-
- if (param_count != MAXCOLUMN) /* validate parameter count */
- {
- fprintf(stderr, " invalid parameter count returned by MySQL\n");
- exit(0);
- }
-
- /* Bind the result buffers for all 3 columns before fetching them */
-
- memset(bind, 0, sizeof(bind));
-
- /* INTEGER COLUMN */
- bind[0].buffer_type= MYSQL_TYPE_LONG;
- bind[0].buffer= (char *)&int_data;
- bind[0].is_null= &is_null[0];
- bind[0].length= &length[0];
-
- /* STRING COLUMN */
- bind[1].buffer_type= MYSQL_TYPE_STRING;
- bind[1].buffer= (char *)str_data;
- bind[1].buffer_length= STRING_SIZE;
- bind[1].is_null= &is_null[1];
- bind[1].length= &length [1];
-
- /* FLOAT COLUMN */
- bind[2].buffer_type= MYSQL_TYPE_FLOAT;
- bind[2].buffer= (char *)&float_data;
- bind[2].is_null= &is_null[2];
- bind[2].length= &length[2];
-
- /* TIME COLUMN */
- bind[3].buffer_type= MYSQL_TYPE_DATETIME;
- bind[3].buffer= (char *)&ts;
- bind[3].is_null= &is_null[2];
- bind[3].length= &length[2];
-
- /* Bind the result buffers */
- if (mysql_stmt_bind_param (stmt, bind))
- {
- fprintf(stderr, " mysql_stmt_bind_param() failed\n");
- fprintf(stderr, " %s\n", mysql_stmt_error(stmt));
- exit(0);
- }
-
- int_data = 99;
- strcpy (str_data, "insert: 99");
- length [1] = strlen (str_data);
- float_data = 0.99;
- ts.year = 1996; ts.month = 2; ts.day = 11;
- ts.hour = 19; ts.minute = 22; ts.second = 0;
-
- /* Execute the INSERT query */
- if (mysql_stmt_execute(stmt))
- {
- fprintf(stderr, " mysql_stmt_execute(), failed\n");
- fprintf(stderr, " %s\n", mysql_stmt_error(stmt));
- exit(0);
- }
-
- is_null [0] = 1;
- strcpy (str_data, "insert: <null>");
- length [1] = strlen (str_data);
- float_data = 0.98;
- ts.year = 1999; ts.month = 8; ts.day = 7;
- ts.hour = 19; ts.minute = 18; ts.second = 17;
-
- /* Execute the INSERT query */
- if (mysql_stmt_execute(stmt))
- {
- fprintf(stderr, " mysql_stmt_execute(), failed\n");
- fprintf(stderr, " %s\n", mysql_stmt_error(stmt));
- exit(0);
- }
-
- /* Close the statement */
- if (mysql_stmt_close(stmt))
- {
- fprintf(stderr, " failed while closing the statement\n");
- fprintf(stderr, " %s\n", mysql_stmt_error(stmt));
- exit(0);
- }
-
- return 0;
-}
--- /dev/null
+#include <stdlib.h>
+#include <string.h>
+#include <stdio.h>
+
+#include <mysql/mysql.h>
+
+#define STRING_SIZE 50
+
+#define INSERT_SAMPLE "insert into anna_db_test (xx, yy, zz, tt) values (?,?,?,?)"
+
+
+#define MAXCOLUMN 4
+
+MYSQL* mysql;
+MYSQL_STMT *stmt;
+MYSQL_BIND bind[MAXCOLUMN];
+MYSQL_TIME ts;
+unsigned long length[MAXCOLUMN];
+int param_count, column_count, row_count;
+float float_data;
+int int_data;
+char str_data[STRING_SIZE];
+my_bool is_null[MAXCOLUMN];
+
+/*
+ * From http://dev.mysql.com/doc/refman/4.1/en/mysql-stmt-fetch.html
+ */
+int main (int argc, const char** argv)
+{
+ if ((mysql = mysql_init (NULL)) == NULL)
+ exit(-12);
+
+ if (mysql_real_connect (mysql, NULL, "sdp", "sdp", "test", 0, NULL, 0L) == NULL) {
+ fprintf(stderr, " mysql_stmt_prepare(), SELECT failed\n");
+ fprintf(stderr, " %s\n", mysql_stmt_error(stmt));
+ exit(0);
+ }
+
+ /* Prepare a SELECT query to fetch data from test_table */
+ stmt = mysql_stmt_init(mysql);
+ if (!stmt)
+ {
+ fprintf(stderr, " mysql_stmt_init(), out of memory\n");
+ exit(0);
+ }
+
+ if (mysql_stmt_prepare(stmt, INSERT_SAMPLE, strlen(INSERT_SAMPLE)))
+ {
+ fprintf(stderr, " mysql_stmt_prepare(), INSERT failed\n");
+ fprintf(stderr, " %s\n", mysql_stmt_error(stmt));
+ exit(0);
+ }
+ fprintf(stdout, " prepare, INSERT successful\n");
+
+ /* Get the parameter count from the statement */
+ param_count= mysql_stmt_param_count(stmt);
+ fprintf(stdout, " total parameters in INSERT: %d\n", param_count);
+
+ if (param_count != MAXCOLUMN) /* validate parameter count */
+ {
+ fprintf(stderr, " invalid parameter count returned by MySQL\n");
+ exit(0);
+ }
+
+ /* Bind the result buffers for all 3 columns before fetching them */
+
+ memset(bind, 0, sizeof(bind));
+
+ /* INTEGER COLUMN */
+ bind[0].buffer_type= MYSQL_TYPE_LONG;
+ bind[0].buffer= (char *)&int_data;
+ bind[0].is_null= &is_null[0];
+ bind[0].length= &length[0];
+
+ /* STRING COLUMN */
+ bind[1].buffer_type= MYSQL_TYPE_STRING;
+ bind[1].buffer= (char *)str_data;
+ bind[1].buffer_length= STRING_SIZE;
+ bind[1].is_null= &is_null[1];
+ bind[1].length= &length [1];
+
+ /* FLOAT COLUMN */
+ bind[2].buffer_type= MYSQL_TYPE_FLOAT;
+ bind[2].buffer= (char *)&float_data;
+ bind[2].is_null= &is_null[2];
+ bind[2].length= &length[2];
+
+ /* TIME COLUMN */
+ bind[3].buffer_type= MYSQL_TYPE_DATETIME;
+ bind[3].buffer= (char *)&ts;
+ bind[3].is_null= &is_null[2];
+ bind[3].length= &length[2];
+
+ /* Bind the result buffers */
+ if (mysql_stmt_bind_param (stmt, bind))
+ {
+ fprintf(stderr, " mysql_stmt_bind_param() failed\n");
+ fprintf(stderr, " %s\n", mysql_stmt_error(stmt));
+ exit(0);
+ }
+
+ int_data = 99;
+ strcpy (str_data, "insert: 99");
+ length [1] = strlen (str_data);
+ float_data = 0.99;
+ ts.year = 1996; ts.month = 2; ts.day = 11;
+ ts.hour = 19; ts.minute = 22; ts.second = 0;
+
+ /* Execute the INSERT query */
+ if (mysql_stmt_execute(stmt))
+ {
+ fprintf(stderr, " mysql_stmt_execute(), failed\n");
+ fprintf(stderr, " %s\n", mysql_stmt_error(stmt));
+ exit(0);
+ }
+
+ is_null [0] = 1;
+ strcpy (str_data, "insert: <null>");
+ length [1] = strlen (str_data);
+ float_data = 0.98;
+ ts.year = 1999; ts.month = 8; ts.day = 7;
+ ts.hour = 19; ts.minute = 18; ts.second = 17;
+
+ /* Execute the INSERT query */
+ if (mysql_stmt_execute(stmt))
+ {
+ fprintf(stderr, " mysql_stmt_execute(), failed\n");
+ fprintf(stderr, " %s\n", mysql_stmt_error(stmt));
+ exit(0);
+ }
+
+ /* Close the statement */
+ if (mysql_stmt_close(stmt))
+ {
+ fprintf(stderr, " failed while closing the statement\n");
+ fprintf(stderr, " %s\n", mysql_stmt_error(stmt));
+ exit(0);
+ }
+
+ return 0;
+}
--- /dev/null
+mysqlclient
+++ /dev/null
-#include <string.h>
-#include <stdio.h>
-
-#include <mysql/mysql.h>
-
-#define STRING_SIZE 50
-
-#define SELECT_SAMPLE "SELECT xx, yy, zz, tt FROM anna_db_test"
-
-#define MAXCOLUMN 4
-
-MYSQL* mysql;
-MYSQL_STMT *stmt;
-MYSQL_BIND bind[MAXCOLUMN];
-MYSQL_RES *prepare_meta_result;
-MYSQL_TIME ts;
-unsigned long length[MAXCOLUMN];
-int param_count, column_count, row_count;
-float float_data;
-int int_data;
-char str_data[STRING_SIZE];
-my_bool is_null[MAXCOLUMN];
-
-/*
- * From http://dev.mysql.com/doc/refman/4.1/en/mysql-stmt-fetch.html
- */
-int main ()
-{
- if ((mysql = mysql_init (NULL)) == NULL)
- exit (-12);
-
- if (mysql_real_connect (mysql, NULL, "sdp", "sdp", "test", 0, NULL, 0L) == NULL) {
- fprintf(stderr, " mysql_stmt_prepare(), SELECT failed\n");
- fprintf(stderr, " %s\n", mysql_stmt_error(stmt));
- exit(0);
- }
-
- /* Prepare a SELECT query to fetch data from test_table */
- stmt = mysql_stmt_init(mysql);
- if (!stmt)
- {
- fprintf(stderr, " mysql_stmt_init(), out of memory\n");
- exit(0);
- }
-
- if (mysql_stmt_prepare(stmt, SELECT_SAMPLE, strlen(SELECT_SAMPLE)))
- {
- fprintf(stderr, " mysql_stmt_prepare(), SELECT failed\n");
- fprintf(stderr, " %s\n", mysql_stmt_error(stmt));
- exit(0);
- }
- fprintf(stdout, " prepare, SELECT successful\n");
-
- /* Get the parameter count from the statement */
- param_count= mysql_stmt_param_count(stmt);
- fprintf(stdout, " total parameters in SELECT: %d\n", param_count);
-
- if (param_count != 0) /* validate parameter count */
- {
- fprintf(stderr, " invalid parameter count returned by MySQL\n");
- exit(0);
- }
-
- /* Fetch result set meta information */
- prepare_meta_result = mysql_stmt_result_metadata(stmt);
- if (!prepare_meta_result)
- {
- fprintf(stderr," mysql_stmt_result_metadata(), returned no meta information\n");
- fprintf(stderr, " %s\n", mysql_stmt_error(stmt));
- exit(0);
- }
-
- /* Get total columns in the query */
- column_count= mysql_num_fields(prepare_meta_result);
- fprintf(stdout, " total columns in SELECT statement: %d\n", column_count);
-
- if (column_count != MAXCOLUMN) /* validate column count */
- {
- fprintf(stderr, " invalid column count returned by MySQL\n");
- exit(0);
- }
-
- /* Execute the SELECT query */
- if (mysql_stmt_execute(stmt))
- {
- fprintf(stderr, " mysql_stmt_execute(), failed\n");
- fprintf(stderr, " %s\n", mysql_stmt_error(stmt));
- exit(0);
- }
-
- /* Bind the result buffers for all 4 columns before fetching them */
-
- memset(bind, 0, sizeof(bind));
-
- /* INTEGER COLUMN */
- bind[0].buffer_type= MYSQL_TYPE_LONG;
- bind[0].buffer= (char *)&int_data;
- bind[0].is_null= &is_null[0];
- bind[0].length= &length[0];
-
- /* STRING COLUMN */
- bind[1].buffer_type= MYSQL_TYPE_STRING;
- bind[1].buffer= (char *)str_data;
- bind[1].buffer_length= STRING_SIZE;
- bind[1].is_null= &is_null[1];
- bind[1].length= &length[1];
-
- /* SMALLINT COLUMN */
- bind[2].buffer_type= MYSQL_TYPE_FLOAT;
- bind[2].buffer= (char *)&float_data;
- bind[2].is_null= &is_null[2];
- bind[2].length= &length[2];
-
- /* TIMESTAMP COLUMN */
- bind[3].buffer_type= MYSQL_TYPE_TIMESTAMP;
- bind[3].buffer= (char *)&ts;
- bind[3].is_null= &is_null[3];
- bind[3].length= &length[3];
-
- /* Bind the result buffers */
- if (mysql_stmt_bind_result(stmt, bind))
- {
- fprintf(stderr, " mysql_stmt_bind_result() failed\n");
- fprintf(stderr, " %s\n", mysql_stmt_error(stmt));
- exit(0);
- }
-
- /* Now buffer all results to client (optional step) */
- if (mysql_stmt_store_result(stmt))
- {
- fprintf(stderr, " mysql_stmt_store_result() failed\n");
- fprintf(stderr, " %s\n", mysql_stmt_error(stmt));
- exit(0);
- }
-
- /* Fetch all rows */
- row_count= 0;
- fprintf(stdout, "Fetching results ...\n");
- while (!mysql_stmt_fetch(stmt))
- {
- row_count++;
- fprintf(stdout, " row %d\n", row_count);
-
- /* column 1 */
- fprintf(stdout, " column1 (integer) : ");
- if (is_null[0])
- fprintf(stdout, " NULL\n");
- else
- fprintf(stdout, " %d(%ld)\n", int_data, length[0]);
-
- /* column 2 */
- fprintf(stdout, " column2 (string) : ");
- if (is_null[1])
- fprintf(stdout, " NULL\n");
- else
- fprintf(stdout, " %s(%ld)\n", str_data, length[1]);
-
- /* column 3 */
- fprintf(stdout, " column3 (float) : ");
- if (is_null[2])
- fprintf(stdout, " NULL\n");
- else
- fprintf(stdout, " %f(%ld)\n", float_data, length[2]);
-
- /* column 4 */
- fprintf(stdout, " column4 (timestamp): ");
- if (is_null[3])
- fprintf(stdout, " NULL\n");
- else
- fprintf(stdout, " %04d-%02d-%02d %02d:%02d:%02d (%ld)\n",
- ts.year, ts.month, ts.day,
- ts.hour, ts.minute, ts.second,
- length[3]);
- fprintf(stdout, "\n");
- }
-
- /* Free the prepared result metadata */
- mysql_free_result(prepare_meta_result);
-
- /* Close the statement */
- if (mysql_stmt_close(stmt))
- {
- fprintf(stderr, " failed while closing the statement\n");
- fprintf(stderr, " %s\n", mysql_stmt_error(stmt));
- exit(0);
- }
-
-}
--- /dev/null
+#include <string.h>
+#include <stdio.h>
+
+#include <mysql/mysql.h>
+
+#define STRING_SIZE 50
+
+#define SELECT_SAMPLE "SELECT xx, yy, zz, tt FROM anna_db_test"
+
+#define MAXCOLUMN 4
+
+MYSQL* mysql;
+MYSQL_STMT *stmt;
+MYSQL_BIND bind[MAXCOLUMN];
+MYSQL_RES *prepare_meta_result;
+MYSQL_TIME ts;
+unsigned long length[MAXCOLUMN];
+int param_count, column_count, row_count;
+float float_data;
+int int_data;
+char str_data[STRING_SIZE];
+my_bool is_null[MAXCOLUMN];
+
+/*
+ * From http://dev.mysql.com/doc/refman/4.1/en/mysql-stmt-fetch.html
+ */
+int main (int argc, const char** argv)
+{
+ if ((mysql = mysql_init (NULL)) == NULL)
+ exit (-12);
+
+ if (mysql_real_connect (mysql, NULL, "sdp", "sdp", "test", 0, NULL, 0L) == NULL) {
+ fprintf(stderr, " mysql_stmt_prepare(), SELECT failed\n");
+ fprintf(stderr, " %s\n", mysql_stmt_error(stmt));
+ exit(0);
+ }
+
+ /* Prepare a SELECT query to fetch data from test_table */
+ stmt = mysql_stmt_init(mysql);
+ if (!stmt)
+ {
+ fprintf(stderr, " mysql_stmt_init(), out of memory\n");
+ exit(0);
+ }
+
+ if (mysql_stmt_prepare(stmt, SELECT_SAMPLE, strlen(SELECT_SAMPLE)))
+ {
+ fprintf(stderr, " mysql_stmt_prepare(), SELECT failed\n");
+ fprintf(stderr, " %s\n", mysql_stmt_error(stmt));
+ exit(0);
+ }
+ fprintf(stdout, " prepare, SELECT successful\n");
+
+ /* Get the parameter count from the statement */
+ param_count= mysql_stmt_param_count(stmt);
+ fprintf(stdout, " total parameters in SELECT: %d\n", param_count);
+
+ if (param_count != 0) /* validate parameter count */
+ {
+ fprintf(stderr, " invalid parameter count returned by MySQL\n");
+ exit(0);
+ }
+
+ /* Fetch result set meta information */
+ prepare_meta_result = mysql_stmt_result_metadata(stmt);
+ if (!prepare_meta_result)
+ {
+ fprintf(stderr," mysql_stmt_result_metadata(), returned no meta information\n");
+ fprintf(stderr, " %s\n", mysql_stmt_error(stmt));
+ exit(0);
+ }
+
+ /* Get total columns in the query */
+ column_count= mysql_num_fields(prepare_meta_result);
+ fprintf(stdout, " total columns in SELECT statement: %d\n", column_count);
+
+ if (column_count != MAXCOLUMN) /* validate column count */
+ {
+ fprintf(stderr, " invalid column count returned by MySQL\n");
+ exit(0);
+ }
+
+ /* Execute the SELECT query */
+ if (mysql_stmt_execute(stmt))
+ {
+ fprintf(stderr, " mysql_stmt_execute(), failed\n");
+ fprintf(stderr, " %s\n", mysql_stmt_error(stmt));
+ exit(0);
+ }
+
+ /* Bind the result buffers for all 4 columns before fetching them */
+
+ memset(bind, 0, sizeof(bind));
+
+ /* INTEGER COLUMN */
+ bind[0].buffer_type= MYSQL_TYPE_LONG;
+ bind[0].buffer= (char *)&int_data;
+ bind[0].is_null= &is_null[0];
+ bind[0].length= &length[0];
+
+ /* STRING COLUMN */
+ bind[1].buffer_type= MYSQL_TYPE_STRING;
+ bind[1].buffer= (char *)str_data;
+ bind[1].buffer_length= STRING_SIZE;
+ bind[1].is_null= &is_null[1];
+ bind[1].length= &length[1];
+
+ /* SMALLINT COLUMN */
+ bind[2].buffer_type= MYSQL_TYPE_FLOAT;
+ bind[2].buffer= (char *)&float_data;
+ bind[2].is_null= &is_null[2];
+ bind[2].length= &length[2];
+
+ /* TIMESTAMP COLUMN */
+ bind[3].buffer_type= MYSQL_TYPE_TIMESTAMP;
+ bind[3].buffer= (char *)&ts;
+ bind[3].is_null= &is_null[3];
+ bind[3].length= &length[3];
+
+ /* Bind the result buffers */
+ if (mysql_stmt_bind_result(stmt, bind))
+ {
+ fprintf(stderr, " mysql_stmt_bind_result() failed\n");
+ fprintf(stderr, " %s\n", mysql_stmt_error(stmt));
+ exit(0);
+ }
+
+ /* Now buffer all results to client (optional step) */
+ if (mysql_stmt_store_result(stmt))
+ {
+ fprintf(stderr, " mysql_stmt_store_result() failed\n");
+ fprintf(stderr, " %s\n", mysql_stmt_error(stmt));
+ exit(0);
+ }
+
+ /* Fetch all rows */
+ row_count= 0;
+ fprintf(stdout, "Fetching results ...\n");
+ while (!mysql_stmt_fetch(stmt))
+ {
+ row_count++;
+ fprintf(stdout, " row %d\n", row_count);
+
+ /* column 1 */
+ fprintf(stdout, " column1 (integer) : ");
+ if (is_null[0])
+ fprintf(stdout, " NULL\n");
+ else
+ fprintf(stdout, " %d(%ld)\n", int_data, length[0]);
+
+ /* column 2 */
+ fprintf(stdout, " column2 (string) : ");
+ if (is_null[1])
+ fprintf(stdout, " NULL\n");
+ else
+ fprintf(stdout, " %s(%ld)\n", str_data, length[1]);
+
+ /* column 3 */
+ fprintf(stdout, " column3 (float) : ");
+ if (is_null[2])
+ fprintf(stdout, " NULL\n");
+ else
+ fprintf(stdout, " %f(%ld)\n", float_data, length[2]);
+
+ /* column 4 */
+ fprintf(stdout, " column4 (timestamp): ");
+ if (is_null[3])
+ fprintf(stdout, " NULL\n");
+ else
+ fprintf(stdout, " %04d-%02d-%02d %02d:%02d:%02d (%ld)\n",
+ ts.year, ts.month, ts.day,
+ ts.hour, ts.minute, ts.second,
+ length[3]);
+ fprintf(stdout, "\n");
+ }
+
+ /* Free the prepared result metadata */
+ mysql_free_result(prepare_meta_result);
+
+ /* Close the statement */
+ if (mysql_stmt_close(stmt))
+ {
+ fprintf(stderr, " failed while closing the statement\n");
+ fprintf(stderr, " %s\n", mysql_stmt_error(stmt));
+ exit(0);
+ }
+
+}
--- /dev/null
+dbms.mysql_static
+dbms_static
+comm_static
+app_static
+xml_static
+io_static
+core_static
+mysqlclient
+rt
+xml2
--- /dev/null
+dbms.mysql_static
+dbms_static
+comm_static
+app_static
+xml_static
+io_static
+core_static
+mysqlclient
+rt
+xml2
--- /dev/null
+dbos_static
+dbms_static
+comm_static
+app_static
+xml_static
+io_static
+core_static
+rt
+xml2
--- /dev/null
+diameter_static
+time_static
+xml_static
+io_static
+core_static
+rt
+xml2
--- /dev/null
+dynamic/launcher/default
--- /dev/null
+diameter.comm_static
+diameter_static
+time_static
+statistics_static
+http_static
+timex_static
+comm_static
+http_static
+app_static
+xml_static
+launcher_procedure_default_shared
+testing_shared
+io_static
+core_static
+pthread
+rt
+xml2
Launcher app;
anna::http::functions::initialize();
- std::cout << "XXXXXXXXXXXXXXXXXXXXXXX " << anna::functions::hash("hola que tal") << std::endl;
-
try {
anna::CommandLine& commandLine(anna::CommandLine::instantiate());
// General
--- /dev/null
+core_static
+pcap
+rt
--- /dev/null
+diameter_static
+time_static
+xml_static
+io_static
+core_static
+rt
+xml2
--- /dev/null
+diameter_static
+time_static
+xml_static
+io_static
+core_static
+rt
+xml2
--- /dev/null
+http_static
+comm_static
+app_static
+xml_static
+io_static
+core_static
+rt
+xml2
--- /dev/null
+http_static
+comm_static
+timex_static
+app_static
+xml_static
+io_static
+core_static
+pthread
+rt
+xml2
--- /dev/null
+http_static
+comm_static
+app_static
+xml_static
+io_static
+core_static
+rt
+xml2
--- /dev/null
+http_static
+comm_static
+app_static
+test_static
+xml_static
+io_static
+core_static
+rt
+xml2
--- /dev/null
+http_static
+comm_static
+app_static
+test_static
+xml_static
+io_static
+core_static
+rt
+xml2
--- /dev/null
+http_static
+comm_static
+app_static
+test_static
+xml_static
+io_static
+core_static
+rt
+xml2
--- /dev/null
+http_static
+comm_static
+app_static
+xml_static
+io_static
+core_static
+rt
+xml2
--- /dev/null
+http_static
+comm_static
+app_static
+xml_static
+io_static
+core_static
+rt
+xml2
--- /dev/null
+http_static
+comm_static
+timex_static
+app_static
+xml_static
+io_static
+core_static
+pthread
+rt
+xml2
--- /dev/null
+http_static
+comm_static
+app_static
+test_static
+xml_static
+io_static
+core_static
+rt
+xml2
--- /dev/null
+http_static
+comm_static
+timex_static
+app_static
+xml_static
+io_static
+core_static
+pthread
+rt
+xml2
--- /dev/null
+http_static
+comm_static
+app_static
+test_static
+xml_static
+io_static
+core_static
+rt
+xml2
--- /dev/null
+http_static
+comm_static
+app_static
+xml_static
+io_static
+core_static
+rt
+xml2
--- /dev/null
+app_static
+io_static
+xml_static
+core_static
+rt
+xml2
--- /dev/null
+ldap_static
+timex_static
+comm_static
+app_static
+xml_static
+io_static
+core_static
+pthread
+rt
+xml2
+ldap
+lber
--- /dev/null
+time_static
+xml_static
+core_static
--- /dev/null
+http_static
+timex_static
+comm_static
+app_static
+xml_static
+io_static
+core_static
+pthread
+rt
+xml2
--- /dev/null
+app_static
+xml_static
+io_static
+core_static
+rt
+xml2
--- /dev/null
+app_static
+xml_static
+io_static
+core_static
+z
+rt
+xml2
--- /dev/null
+app_static
+xml_static
+io_static
+core_static
+rt
+xml2
+++ /dev/null
-#!/bin/sh
-#
-# An example hook script to verify what is about to be committed.
-# Called by "git commit" with no arguments. The hook should
-# exit with non-zero status after issuing an appropriate message if
-# it wants to stop the commit.
-#
-# To enable this hook, rename this file to "pre-commit".
-
-if git rev-parse --verify HEAD >/dev/null 2>&1
-then
- against=HEAD
-else
- # Initial commit: diff against an empty tree object
- against=4b825dc642cb6eb9a060e54bf8d69288fbee4904
-fi
-
-# If you want to allow non-ascii filenames set this variable to true.
-allownonascii=$(git config hooks.allownonascii)
-
-
-# Redirect output to stderr.
-exec 1>&2
-
-# Cross platform projects tend to avoid non-ascii filenames; prevent
-# them from being added to the repository. We exploit the fact that the
-# printable range starts at the space character and ends with tilde.
-if [ "$allownonascii" != "true" ] &&
- # Note that the use of brackets around a tr range is ok here, (it's
- # even required, for portability to Solaris 10's /usr/bin/tr), since
- # the square bracket bytes happen to fall in the designated range.
- test $(git diff --cached --name-only --diff-filter=A -z $against |
- LC_ALL=C tr -d '[ -~]\0' | wc -c) != 0
-then
- echo "Error: Attempt to add a non-ascii file name."
- echo
- echo "This can cause problems if you want to work"
- echo "with people on other platforms."
- echo
- echo "To be portable it is advisable to rename the file ..."
- echo
- echo "If you know what you are doing you can disable this"
- echo "check using:"
- echo
- echo " git config hooks.allownonascii true"
- echo
- exit 1
-fi
-
-# Astyle
-which astyle >/dev/null 2>/dev/null
-if [ $? -ne 0 ]; then
-echo "pre-commit hook: 'astyle' not found, install it before continuing or remove .fix_style to skip astyle processing."
-exit 1
-fi
-ASTYLE=astyle
-
-case `$ASTYLE --version 2> /dev/null` in
- Artistic*)
- ;;
- default)
- echo "pre-commit hook: unsupported astyle version, must be 'Artistic Style Version x.xx'. Install or skip (remove .fix_style)."
- exit 1
- ;;
-esac
-
-ASTYLE_PARAMETERS="--style=allman \
- --indent=spaces=2 \
- --convert-tabs \
- --indent-classes \
- --indent-switches \
- --indent-namespaces \
- --indent-labels \
- --indent-col1-comments \
- --min-conditional-indent=0 \
- --pad-oper \
- --pad-header \
- --unpad-paren \
- --align-pointer=name \
- --lineend=linux \
- --suffix=none"
-# --brackets=linux
-# --one-line=keep-statements
-# --indent-preprocessor
-
-test_style () {
-
- file=$1
- newfile=${file}.astyled
- #$ASTYLE ${ASTYLE_PARAMETERS} < $file > $newfile 2>>/dev/null
- echo "Executing $ASTYLE -a -f -p -o -O -c -s2 -U --mode=c < $file > $newfile"
- $ASTYLE -a -f -p -o -O -c -s2 -U --mode=c < $file > $newfile
- if [ $? -ne 0 ] ; then
- echo "Error in astyle"
- exit 1
- fi
- diff "${file}" "${newfile}"
- if [ $? -ne 0 ] ; then
- echo "Code style error in '$file', please fix before commiting."
- if [ -f "./.fix_style" ]; then
- echo "Auto-fixing code style..."
- cp $file ${file}.orig
- mv $newfile $file
- else
- echo "To autofix, create a hidden file named './.fix_style' on suite root."
- rm $newfile
- exit 1
- fi
- else
- rm $newfile
- fi
-}
-
-echo "Source code style checking ..."
-
-files=`git-diff-index --diff-filter=ACMR --name-only -r --cached $against --`
-for file in $files; do
- x=`echo $file |grep -E '(\.cpp|\.hpp)'`
- if test "x$x" != "x"; then
- test_style $file
- git add $file
- fi
-done
-
-# If there are whitespace errors, print the offending file names and fail.
-#exec git diff-index --check --cached $against --
-
+++ /dev/null
-#!/bin/sh
-# THIS ONLY IS EFFECTIVE IF YOU ARE WORKING ON THE GIT SERVER HOST
-cd `dirname $0`/../../.git/hooks
-mv post-update.sample post-update 2>/dev/null
+++ /dev/null
-#!/bin/sh
-cd `dirname $0`
-ln -sf ../../scr/git/pre-commit.sh ../../.git/hooks/pre-commit
--- /dev/null
+#!/bin/sh
+#
+# An example hook script to verify what is about to be committed.
+# Called by "git commit" with no arguments. The hook should
+# exit with non-zero status after issuing an appropriate message if
+# it wants to stop the commit.
+#
+# To enable this hook, rename this file to "pre-commit".
+
+if git rev-parse --verify HEAD >/dev/null 2>&1
+then
+ against=HEAD
+else
+ # Initial commit: diff against an empty tree object
+ against=4b825dc642cb6eb9a060e54bf8d69288fbee4904
+fi
+
+# If you want to allow non-ascii filenames set this variable to true.
+allownonascii=$(git config hooks.allownonascii)
+
+
+# Redirect output to stderr.
+exec 1>&2
+
+# Cross platform projects tend to avoid non-ascii filenames; prevent
+# them from being added to the repository. We exploit the fact that the
+# printable range starts at the space character and ends with tilde.
+if [ "$allownonascii" != "true" ] &&
+ # Note that the use of brackets around a tr range is ok here, (it's
+ # even required, for portability to Solaris 10's /usr/bin/tr), since
+ # the square bracket bytes happen to fall in the designated range.
+ test $(git diff --cached --name-only --diff-filter=A -z $against |
+ LC_ALL=C tr -d '[ -~]\0' | wc -c) != 0
+then
+ echo "Error: Attempt to add a non-ascii file name."
+ echo
+ echo "This can cause problems if you want to work"
+ echo "with people on other platforms."
+ echo
+ echo "To be portable it is advisable to rename the file ..."
+ echo
+ echo "If you know what you are doing you can disable this"
+ echo "check using:"
+ echo
+ echo " git config hooks.allownonascii true"
+ echo
+ exit 1
+fi
+
+# Astyle
+which astyle >/dev/null 2>/dev/null
+if [ $? -ne 0 ]; then
+echo "pre-commit hook: 'astyle' not found, install it before continuing or remove .fix_style to skip astyle processing."
+exit 1
+fi
+ASTYLE=astyle
+
+case `$ASTYLE --version 2> /dev/null` in
+ Artistic*)
+ ;;
+ default)
+ echo "pre-commit hook: unsupported astyle version, must be 'Artistic Style Version x.xx'. Install or skip (remove .fix_style)."
+ exit 1
+ ;;
+esac
+
+ASTYLE_PARAMETERS="--style=allman \
+ --indent=spaces=2 \
+ --convert-tabs \
+ --indent-classes \
+ --indent-switches \
+ --indent-namespaces \
+ --indent-labels \
+ --indent-col1-comments \
+ --min-conditional-indent=0 \
+ --pad-oper \
+ --pad-header \
+ --unpad-paren \
+ --align-pointer=name \
+ --lineend=linux \
+ --suffix=none"
+# --brackets=linux
+# --one-line=keep-statements
+# --indent-preprocessor
+
+test_style () {
+
+ file=$1
+ newfile=${file}.astyled
+ #$ASTYLE ${ASTYLE_PARAMETERS} < $file > $newfile 2>>/dev/null
+ echo "Executing $ASTYLE -a -f -p -o -O -c -s2 -U --mode=c < $file > $newfile"
+ $ASTYLE -a -f -p -o -O -c -s2 -U --mode=c < $file > $newfile
+ if [ $? -ne 0 ] ; then
+ echo "Error in astyle"
+ exit 1
+ fi
+ diff "${file}" "${newfile}"
+ if [ $? -ne 0 ] ; then
+ echo "Code style error in '$file', please fix before commiting."
+ if [ -f "./.fix_style" ]; then
+ echo "Auto-fixing code style..."
+ cp $file ${file}.orig
+ mv $newfile $file
+ else
+ echo "To autofix, create a hidden file named './.fix_style' on suite root."
+ rm $newfile
+ exit 1
+ fi
+ else
+ rm $newfile
+ fi
+}
+
+echo "Source code style checking ..."
+
+files=`git-diff-index --diff-filter=ACMR --name-only -r --cached $against --`
+for file in $files; do
+ x=`echo $file |grep -E '(\.cpp|\.hpp)'`
+ if test "x$x" != "x"; then
+ test_style $file
+ git add $file
+ fi
+done
+
+# If there are whitespace errors, print the offending file names and fail.
+#exec git diff-index --check --cached $against --
+
--- /dev/null
+#!/bin/sh
+# THIS ONLY IS EFFECTIVE IF YOU ARE WORKING ON THE GIT SERVER HOST
+cd `dirname $0`/../../.git/hooks
+mv post-update.sample post-update 2>/dev/null
--- /dev/null
+#!/bin/sh
+cd `dirname $0`
+ln -sf ../../scripts/git/pre-commit.sh ../../.git/hooks/pre-commit