//==================================================================================================
// D e p e n d e n c y                                                                    Interface
// G c c _ 3 _ l i n u x
//                                                                                By Bruno Bachelet
//==================================================================================================
// Copyright (c) 1999-2016
// Bruno Bachelet - bruno@nawouak.net - http://www.nawouak.net
//
// This file is part of the B++ Library. This library is free software; you can redistribute it
// and/or modify it under the terms of the GNU Library General Public License as published by the
// Free Software Foundation; either version 2 of the License, or (at your option) any later
// version.
//
// This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
// without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
// the GNU Library General Public License for more details (http://www.gnu.org).

/*DESCRIPTION*/
/* This module contains the specificity of the GCC 3 compiler for Linux. */

// File Name //-------------------------------------------------------------------------------------
#line __LINE__ "dependency/gcc_3_linux.hpp"

// Guardian //--------------------------------------------------------------------------------------
#ifndef guDependencyGcc3Linux
#define guDependencyGcc3Linux

// Headers //---------------------------------------------------------------------------------------
#include <bpp/information.hpp> /*INCLUDE*/

// Compiler Check //--------------------------------------------------------------------------------
#ifdef GCC_3_LINUX

// Environment Information //-----------------------------------------------------------------------
/*MACROCOMMAND*/ /* Full name and version of the compiler. */
#define COMPILER "GCC 3"

// Dependencies (Internal Use) //-------------------------------------------------------------------
/*MACROCOMMAND*/ /* Symbol to separate file names in a path. */
#define FILE_NAME_SEPARATOR "/"

/*MACROCOMMAND*/ /* Symbol to separate paths in an environment variable. */
#define PATH_SEPARATOR ":"

/*MACROCOMMAND*/ /* Type of the opening modes of the file streams. */
#define FILE_OPENING_MODE_TYPE std::_Ios_Openmode

/*MACROCOMMAND*/ /* Last year representable with the standard C time library. */
#define LAST_YEAR 2038

/*MACROCOMMAND*/ /* Maximum number of characters a path string can contain. */
#define MAXIMUM_PATH_LENGTH 4096u

/*MACROCOMMAND*/
/* Is defined if the generic complementary comparators <CODE>!=</CODE>, <CODE>></CODE>,
   <CODE><=</CODE> and <CODE>>=</CODE> are not provided by the STL. */
#undef NEED_COMPLEMENTARY_COMPARATORS

/*MACROCOMMAND*/
/* Is defined if types based on instanciation of template classes must be instanciated. */
#undef NEED_INSTANTIATE_TEMPLATE_CLASS

/*MACROCOMMAND*/
/* Is defined if the keywords <CODE>and</CODE>, <CODE>or</CODE> and <CODE>not</CODE> are not
   recognized by the compiler. */
#undef NEED_LOGICAL_KEYWORDS

/*MACROCOMMAND*/
/* Is defined if an explicit conversion is required to cast a static method pointer into a
   <CODE>void *</CODE> pointer. */
#define NEED_STATIC_METHOD_TO_VOID_POINTER_CONVERSION

/*MACROCOMMAND*/ /* Number of ticks per second of the internal clock of the computer. */
#define TICKS_PER_SECOND CLOCKS_PER_SEC

/*MACROCOMMAND*/ /* Type representing the type information. */
#define TYPE_INFORMATION_TYPE std::type_info

/*MACROCOMMAND*/
/* If defined, uses the <CODE>getrusage</CODE> function instead of <CODE>clock</CODE> to measure
   the user time consumed by the process. */
#define USE_GETRUSAGE_FOR_CLOCK

/*MACROCOMMAND*/
/* If defined, uses the <CODE>demangle_*</CODE> functions in the contribution module to demangle
the symbol or type strings provided by the RTTI mechanism. */
#define USE_SYMBOL_DEMANGLING

/*MACROCOMMAND*/
/* If defined, indicates that the compiler does not manage very well the destruction of objects
   in a virtual inheritance. */
#undef VIRTUAL_INHERITANCE_BUG

/*MACROCOMMAND*/
/* Is defined if the plain <CODE>new</CODE> and <CODE>delete</CODE> operators
   are not thread-safe. */
#undef NEED_SAFE_PLAIN_NEW

/*MACROCOMMAND*/
/* Is defined if the "nothrow" versions of the <CODE>new</CODE> and <CODE>delete</CODE> operators
   are not thread-safe. */
#undef NEED_SAFE_NOTHROW_NEW

/*MACROCOMMAND*/ /* Is defined if the STL does not provide a thread-safe allocator. */
#undef NEED_SAFE_STL_ALLOCATOR

/*MACROCOMMAND*/ /* Template parameters for the STL map allocator. */
#define STL_MAP_ALLOCATOR_PARAMETERS(prType1,prType2) std_pair(prType1 const,prType2)

/*MACROCOMMAND*/ /* Is defined if the STL set container needs a specific deflator. */
#define NEED_STL_SET_SPECIFIC_DEFLATOR

/*MACROCOMMAND*/
/* Is defined if partial instantiation defined with template template parameters must be
   monolithic (i.e. interface and implementation together). */
#undef NEED_MONOLITHIC_TEMPLATE_TEMPLATE
//---------------------------------------------------------------------------------Folder Management
/*MACROCOMMAND*/ /* If defined, header to use folder management facilities. */
#define DIR_HEADER_1 <unistd.h>

/*MACROCOMMAND*/ /* If defined, additional header to use folder management facilities. */
#define DIR_HEADER_2 <sys/stat.h>

/*MACROCOMMAND*/ /* Is defined if the library has no <CODE>DIR</CODE> structure. */
#undef NEED_FOLDER_MANAGEMENT

/*MACROCOMMAND*/
/* If defined, function call to create a folder. The macrocommand must have a parameter that is the
   name of the folder. */
#define MKDIR_CALL(prPath) mkdir(prPath,0755)

/*MACROCOMMAND*/
/* If defined, function call to remove a folder. The macrocommand must have a parameter that is the
   name of the folder. */
#undef RMDIR_CALL

/*MACROCOMMAND*/ /* If defined, command to create a folder with the shell. */
#undef MKDIR_COMMAND

/*MACROCOMMAND*/ /* If defined, command to remove a folder with the shell. */
#undef RMDIR_COMMAND
//-----------------------------------------------------------------------------------Dynamic Loading
/*MACROCOMMAND*/ /* Type representing a dynamic library. */
#define DYNAMIC_LIBRARY_TYPE tyPointer

/*MACROCOMMAND*/ /* Header to use dynamic loading facilities. */
#define DYNAMIC_LOADING_HEADER <dlfcn.h>

/*MACROCOMMAND*/ /* Command to get a symbol in a dynamic library. */
#define GET_DYNAMIC_SYMBOL_COMMAND(prPointer,prLibrary,prSymbol) \
 (prPointer.toObject=(tyPointer)dlsym(prLibrary,prSymbol))

/*MACROCOMMAND*/ /* Command to load a dynamic library. */
#define LOAD_DYNAMIC_LIBRARY_COMMAND(prName) dlopen(prName,RTLD_LAZY)

/*MACROCOMMAND*/ /* Command to unload a dynamic library. */
#define UNLOAD_DYNAMIC_LIBRARY_COMMAND(prLibrary) dlclose(prLibrary)
//--------------------------------------------------------------------------------------------Thread
/*MACROCOMMAND*/
/* If defined, command to create a thread, else the Unix command <CODE>fork</CODE> is used. */
#define CREATE_THREAD(prThread,prFunction,prData) {                                     \
 pthread_attr_t _properties_;                                                           \
 pthread_attr_init(&_properties_);                                                      \
 pthread_attr_setdetachstate(&_properties_,PTHREAD_CREATE_DETACHED);                    \
 pthread_attr_setscope(&_properties_,PTHREAD_SCOPE_SYSTEM);                             \
 pthread_create(&(prThread),&_properties_,(void * (*)(void *))(prFunction),(prData)); } \

/*MACROCOMMAND*/ /* Command to exit the current thread. */
#define EXIT_THREAD (pthread_exit(EXIT_SUCCESS))

/*MACROCOMMAND*/ /* If defined, header to suspend a thread. */
#define SUSPEND_HEADER <unistd.h>

/*MACROCOMMAND*/ /* Command to suspend the current thread for a given number of seconds. */
#define SUSPEND_THREAD(prDuration) (sleep(prDuration))

/*MACROCOMMAND*/ /* If defined, header to use the thread-safe allocator of the STL. */
#undef THREAD_ALLOCATOR_HEADER

/*MACROCOMMAND*/ /* If defined, header to use threads. */
#define THREAD_HEADER <pthread.h>

/*MACROCOMMAND*/ /* Type representing a thread. */
#define THREAD_TYPE pthread_t
//---------------------------------------------------------------------------------------------Mutex
/*MACROCOMMAND*/ /* Type representing a mutex (mutual exclusion for threads). */
#define MUTEX_TYPE pthread_mutex_t

/*MACROCOMMAND*/ /* Command to create a mutex. */
#define CREATE_MUTEX(prMutex) (pthread_mutex_init(&(prMutex),NULL))

/*MACROCOMMAND*/ /* Command to destroy a mutex. */
#define DESTROY_MUTEX(prMutex) (pthread_mutex_destroy(&(prMutex)))

/*MACROCOMMAND*/ /* Command to lock a mutex. */
#define LOCK_MUTEX(prMutex) (pthread_mutex_lock(&(prMutex)))

/*MACROCOMMAND*/ /* Command to release a mutex. */
#define RELEASE_MUTEX(prMutex) (pthread_mutex_unlock(&(prMutex)))

/*MACROCOMMAND*/ /* Command to try to lock a mutex. */
#define TRY_LOCK_MUTEX(prMutex) (pthread_mutex_trylock(&(prMutex))==0)

// Dependencies (External Use) //-------------------------------------------------------------------
/*MACROCOMMAND*/ /* Symbol to jump to the next line in an ASCII file or display. */
#define end_line std::endl

/*MACROCOMMAND*/ /* Expression to access the <CODE>advance</CODE> function of the STL. */
#define std_advance std::advance

/*MACROCOMMAND*/ /* Expression to access the <CODE>allocator</CODE> class of the STL. */
#define std_allocator std::allocator

/*MACROCOMMAND*/ /* Expression to access the <CODE>thread_allocator</CODE> class of the STL. */
#define std_thread_allocator std::pthread_allocator

/*MACROCOMMAND*/ /* Expression to access the <CODE>deque</CODE> class of the STL. */
#define std_deque(prType) std::deque< prType >

/*MACROCOMMAND*/ /* Expression to access the <CODE>distance</CODE> function of the STL. */
#define std_distance std::distance

/*MACROCOMMAND*/ /* Expression to access the <CODE>exception</CODE> class of the STL. */
#define std_exception std::exception

/*MACROCOMMAND*/ /* Expression to access the <CODE>find</CODE> function of the STL. */
#define std_find std::find

/*MACROCOMMAND*/ /* Expression to access the <CODE>less</CODE> class of the STL. */
#define std_less(prType) std::less< prType >

/*MACROCOMMAND*/ /* Expression to access the <CODE>list</CODE> class of the STL. */
#define std_list(prType) std::list< prType >

/*MACROCOMMAND*/ /* Expression to access the <CODE>make_pair</CODE> function of the STL. */
#define std_make_pair bpp::make_map_pair

/*MACROCOMMAND*/ /* Expression to access the <CODE>map</CODE> class of the STL. */
#define std_map(prType1,prType2)                  \
 std::map< prType1,prType2,std::less< prType1 > > \

/*MACROCOMMAND*/ /* Expression to access the <CODE>multimap</CODE> class of the STL. */
#define std_multimap(prType1,prType2)                  \
 std::multimap< prType1,prType2,std::less< prType1 > > \

/*MACROCOMMAND*/ /* Expression to access the <CODE>multiset</CODE> class of the STL. */
#define std_multiset(prType) std::multiset< prType,std::less< prType > >

/*MACROCOMMAND*/ /* Expression to access the <CODE>pair</CODE> class of the STL. */
#define std_pair(prType1,prType2) std::pair< prType1,prType2 >

/*MACROCOMMAND*/ /* Expression to access the <CODE>queue</CODE> class of the STL. */
#define std_queue(prType) std::queue< prType,std::deque< prType > >

/*MACROCOMMAND*/ /* Expression to access the <CODE>reverse</CODE> function of the STL. */
#define std_reverse std::reverse

/*MACROCOMMAND*/ /* Expression to access the <CODE>set</CODE> class of the STL. */
#define std_set(prType) std::set< prType,std::less< prType > >

/*MACROCOMMAND*/ /* Expression to access the <CODE>sort</CODE> function of the STL. */
#define std_sort std::sort

/*MACROCOMMAND*/ /* Expression to access the <CODE>vector</CODE> class of the STL. */
#define std_vector(prType) std::vector< prType >

/*MACROCOMMAND*/ /* Syntax to declare a non instantiated template class as friend. */
#define template_friend(prType) < prType >

// End //-------------------------------------------------------------------------------------------
#endif
#endif