STLSoft - ... Robust, Lightweight, Cross-platform, Template Software ... ATLSTL - Template Software for the Active Template Library COMSTL - The Standard Template Library meets the Component Object Model .netSTL - Standard Template Library meets the Microsoft.NET Common Language Runtime InetSTL - The Standard Template Library meets WinInet MFCSTL - Template Software for the Microsoft Foundation Classes UNIXSTL - Template Software for the UNIX Operating System WinSTL - where the Standard Template Library meets the Win32 API

Main Page   Modules   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

unixstl.h

Go to the documentation of this file.
00001 /* 
00002  * File:        unixstl.h
00003  *
00004  * Purpose:     Root header for the UNIXSTL libraries. Performs various compiler
00005  *              and platform discriminations, and definitions of types.
00006  *
00007  * Created:     15th January 2002
00008  * Updated:     11th September 2004
00009  *
00010  * Home:        http://stlsoft.org/
00011  *
00012  * Copyright (c) 2002-2004, Matthew Wilson and Synesis Software
00013  * All rights reserved.
00014  *
00015  * Redistribution and use in source and binary forms, with or without
00016  * modification, are permitted provided that the following conditions are met:
00017  *
00018  * - Redistributions of source code must retain the above copyright notice, this
00019  *   list of conditions and the following disclaimer.
00020  * - Redistributions in binary form must reproduce the above copyright notice,
00021  *   this list of conditions and the following disclaimer in the documentation
00022  *   and/or other materials provided with the distribution.
00023  * - Neither the name(s) of Matthew Wilson and Synesis Software nor the names of
00024  *   any contributors may be used to endorse or promote products derived from
00025  *   this software without specific prior written permission.
00026  *
00027  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00028  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00029  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00030  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
00031  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
00032  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
00033  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
00034  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
00035  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
00036  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00037  * POSSIBILITY OF SUCH DAMAGE.
00038  *
00039  * 
00040 
00041 
00042 #ifndef UNIXSTL_INCL_H_UNIXSTL
00043 #define UNIXSTL_INCL_H_UNIXSTL
00044 
00045 /* File version */
00046 #ifndef __STLSOFT_DOCUMENTATION_SKIP_SECTION
00047 # define UNIXSTL_VER_H_UNIXSTL_MAJOR    2
00048 # define UNIXSTL_VER_H_UNIXSTL_MINOR    0
00049 # define UNIXSTL_VER_H_UNIXSTL_REVISION 1
00050 # define UNIXSTL_VER_H_UNIXSTL_EDIT     43
00051 #endif /* !__STLSOFT_DOCUMENTATION_SKIP_SECTION */
00052 
00096 /* 
00097  * UNIXSTL version
00098  *
00099  * The libraries version information is comprised of major, minor and revision
00100  * components.
00101  *
00102  * The major version is denoted by the _UNIXSTL_VER_MAJOR preprocessor symbol.
00103  * A changes to the major version component implies that a dramatic change has
00104  * occurred in the libraries, such that considerable changes to source dependent
00105  * on previous versions would need to be effected.
00106  *
00107  * The minor version is denoted by the _UNIXSTL_VER_MINOR preprocessor symbol.
00108  * Changes to the minor version component imply that a significant change has
00109  * occurred to the libraries, either in the addition of new functionality or in
00110  * the destructive change to one or more components such that recomplilation and
00111  * code change may be necessitated.
00112  *
00113  * The revision version is denoted by the _UNIXSTL_VER_REVISIO preprocessor
00114  * symbol. Changes to the revision version component imply that a bug has been
00115  * fixed. Dependent code should be recompiled in order to pick up the changes.
00116  *
00117  * In addition to the individual version symbols - _UNIXSTL_VER_MAJOR,
00118  * _UNIXSTL_VER_MINOR and _UNIXSTL_VER_REVISION - a composite symbol _UNIXSTL_VER
00119  * is defined, where the upper 8 bits are 0, bits 16-23 represent the major
00120  * component,  bits 8-15 represent the minor component, and bits 0-7 represent
00121  * the revision component.
00122  *
00123  * Each release of the libraries will bear a different version, and that version
00124  * will also have its own symbol: Version 1.0.1 specifies _UNIXSTL_VER_1_0_1.
00125  *
00126  * Thus the symbol _UNIXSTL_VER may be compared meaningfully with a specific
00127  * version symbol, e.g.# if _UNIXSTL_VER >= _UNIXSTL_VER_1_0_1
00128  */
00129 
00132 
00135 
00138 
00141 
00142 #define _UNIXSTL_VER_MAJOR      1
00143 #define _UNIXSTL_VER_MINOR      2
00144 #define _UNIXSTL_VER_REVISION   1
00145 #ifndef __STLSOFT_DOCUMENTATION_SKIP_SECTION
00146 # define _UNIXSTL_VER_0_9_1     0x00000901  
00147 # define _UNIXSTL_VER_0_9_2     0x00000902  
00148 # define _UNIXSTL_VER_1_0_1     0x00010001  
00149 # define _UNIXSTL_VER_1_0_2     0x00010002  
00150 # define _UNIXSTL_VER_1_0_3     0x00010003  
00151 # define _UNIXSTL_VER_1_1_1     0x00010101  
00152 # define _UNIXSTL_VER_1_2_1     0x00010201  
00153 #endif /* !__STLSOFT_DOCUMENTATION_SKIP_SECTION */
00154 
00155 #define _UNIXSTL_VER            _UNIXSTL_VER_1_2_1
00156 
00157 /* 
00158  * Includes
00159  */
00160 
00161 #ifndef STLSOFT_INCL_H_STLSOFT
00162 # include "stlsoft.h"   // Include the STLSoft root header
00163 #endif /* !STLSOFT_INCL_H_STLSOFT */
00164 
00165 /* 
00166  * STLSoft version compatibility
00167  */
00168 
00169 #if !defined(_STLSOFT_VER_1_5_1) || \
00170     _STLSOFT_VER < _STLSOFT_VER_1_5_1
00171 # error This version of the UNIXSTL libraries requires STLSoft version 1.5.1 or later
00172 #endif /* _STLSOFT_VER < _STLSOFT_VER_1_5_1 */
00173 
00174 /* 
00175  * Compiler compatibility
00176  *
00177  * Currently the only compilers supported by the UNIXSTL libraries are
00178  *
00179  * GCC 2.95, 2.96, 3.2
00180  * Intel C/C++ 6.0 & 7.0
00181  */
00182 
00183 #if defined(__STLSOFT_COMPILER_IS_GCC)
00184 /* GNU C/C++ */
00185 # if __GNUC__ < 2 || \
00186      (  __GNUC__ == 2 && \
00187         __GNUC_MINOR__ < 95)
00188 #  error Versions of GNU C/C++ prior to 2.95 are not supported by the UNIXSTL libraries
00189 # endif /* __GNUC__ */
00190 
00191 #elif defined(__STLSOFT_COMPILER_IS_INTEL)
00192 /* Intel C++ */
00193 # if (__INTEL_COMPILER < 700)
00194 #  error Versions of Intel C++ prior to 7.0 are not supported by the UNIXSTL libraries
00195 # endif /* __INTEL_COMPILER */
00196 
00197 #else
00198 /* No recognised compiler */
00199 # ifdef _STLSOFT_FORCE_ANY_COMPILER
00200 #  define _UNIXSTL_COMPILER_IS_UNKNOWN
00201 #  ifdef _STLSOFT_COMPILE_VERBOSE
00202 #   pragma message("Compiler is unknown to UNIXSTL")
00203 #  endif /* _STLSOFT_COMPILE_VERBOSE */
00204 # else
00205 #  error Currently only GNU C/C++ compiler supported by the UNIXSTL libraries. To use other, possibly untested, compilers, define _STLSOFT_FORCE_ANY_COMPILER
00206 # endif /* _STLSOFT_FORCE_ANY_COMPILER */
00207 #endif /* compiler */
00208 
00209 /* 
00210  * Debugging
00211  *
00212  * The macro unixstl_assert provides standard debug-mode assert functionality.
00213  */
00214 
00218 #define unixstl_assert(expr)                stlsoft_assert(expr)
00219 
00224 #define unixstl_message_assert(msg, expr)   stlsoft_message_assert(msg, expr)
00225 
00229 #define unixstl_static_assert(expr)         stlsoft_static_assert(expr)
00230 
00231 /* 
00232  * Namespace
00233  *
00234  * The UNIXSTL components are contained within the unixstl namespace. This is
00235  * usually an alias for stlsoft::unixstl_project,
00236  *
00237  * When compilers support namespaces they are defined by default. They can be
00238  * undefined using a cascasing system, as follows:
00239  *
00240  * If _STLSOFT_NO_NAMESPACES is defined, then _UNIXSTL_NO_NAMESPACES is defined.
00241  *
00242  * If _UNIXSTL_NO_NAMESPACES is defined, then _UNIXSTL_NO_NAMESPACE is defined.
00243  *
00244  * If _UNIXSTL_NO_NAMESPACE is defined, then the UNIXSTL constructs are defined
00245  * in the global scope.
00246  *
00247  * If _STLSOFT_NO_NAMESPACES, _UNIXSTL_NO_NAMESPACES and _UNIXSTL_NO_NAMESPACE are
00248  * all undefined but the symbol _STLSOFT_NO_NAMESPACE is defined (whence the
00249  * namespace stlsoft does not exist), then the UNIXSTL constructs are defined
00250  * within the unixstl namespace. The definition matrix is as follows:
00251  *
00252  * _STLSOFT_NO_NAMESPACE    _UNIXSTL_NO_NAMESPACE   unixstl definition
00253  * ---------------------    --------------------    -----------------
00254  *  not defined              not defined             = stlsoft::unixstl_project
00255  *  not defined              defined                 not defined
00256  *  defined                  not defined             unixstl
00257  *  defined                  defined                 not defined
00258  *
00259  *
00260  *
00261  * The macro unixstl_ns_qual() macro can be used to refer to elements in the
00262  * UNIXSTL libraries irrespective of whether they are in the
00263  * stlsoft::unixstl_project (or unixstl) namespace or in the global namespace.
00264  *
00265  * Furthermore, some compilers do not support the standard library in the std
00266  * namespace, so the unixstl_ns_qual_std() macro can be used to refer to elements
00267  * in the UNIXSTL libraries irrespective of whether they are in the std namespace
00268  * or in the global namespace.
00269  */
00270 
00271 /* No STLSoft namespaces means no UNIXSTL namespaces */
00272 #ifdef _STLSOFT_NO_NAMESPACES
00273 # define _UNIXSTL_NO_NAMESPACES
00274 #endif /* _STLSOFT_NO_NAMESPACES */
00275 
00276 /* No UNIXSTL namespaces means no unixstl namespace */
00277 #ifdef _UNIXSTL_NO_NAMESPACES
00278 # define _UNIXSTL_NO_NAMESPACE
00279 #endif /* _UNIXSTL_NO_NAMESPACES */
00280 
00281 #ifndef _UNIXSTL_NO_NAMESPACE
00282 # if defined(_STLSOFT_NO_NAMESPACE) || \
00283      defined(__STLSOFT_DOCUMENTATION_SKIP_SECTION)
00284 /* There is no stlsoft namespace, so must define ::unixstl */
00287 namespace unixstl
00288 {
00289 # else
00290 /* Define stlsoft::unixstl_project */
00291 
00292 namespace stlsoft
00293 {
00294 
00295 namespace unixstl_project
00296 {
00297 
00298 # endif /* _STLSOFT_NO_NAMESPACE */
00299 #else
00300 stlsoft_ns_using(move_lhs_from_rhs)
00301 #endif /* !_UNIXSTL_NO_NAMESPACE */
00302 
00305 
00308 
00309 #ifndef _UNIXSTL_NO_NAMESPACE
00310 # define unixstl_ns_qual(x)             ::unixstl::x
00311 # define unixstl_ns_using(x)            using ::unixstl::x;
00312 #else
00313 # define unixstl_ns_qual(x)             x
00314 # define unixstl_ns_using(x)
00315 #endif /* !_UNIXSTL_NO_NAMESPACE */
00316 
00319 
00322 
00323 #ifdef __STLSOFT_CF_std_NAMESPACE
00324 # define unixstl_ns_qual_std(x)         ::std::x
00325 # define unixstl_ns_using_std(x)        using ::std::x;
00326 #else
00327 # define unixstl_ns_qual_std(x)         x
00328 # define unixstl_ns_using_std(x)
00329 #endif /* !__STLSOFT_CF_std_NAMESPACE */
00330 
00331 /* 
00332  * Typedefs
00333  *
00334  * The UNIXSTL uses a number of typedefs to aid in compiler-independence in the
00335  * libraries' main code.
00336  */
00337 
00338 typedef stlsoft_ns_qual(ss_char_a_t)        us_char_a_t;    
00339 typedef stlsoft_ns_qual(ss_char_w_t)        us_char_w_t;    
00340 typedef stlsoft_ns_qual(ss_sint8_t)         us_sint8_t;     
00341 typedef stlsoft_ns_qual(ss_uint8_t)         us_uint8_t;     
00342 typedef stlsoft_ns_qual(ss_int16_t)         us_int16_t;     
00343 typedef stlsoft_ns_qual(ss_sint16_t)        us_sint16_t;    
00344 typedef stlsoft_ns_qual(ss_uint16_t)        us_uint16_t;    
00345 typedef stlsoft_ns_qual(ss_int32_t)         us_int32_t;     
00346 typedef stlsoft_ns_qual(ss_sint32_t)        us_sint32_t;    
00347 typedef stlsoft_ns_qual(ss_uint32_t)        us_uint32_t;    
00348 #ifdef STLSOFT_CF_64BIT_INT_SUPPORT
00349 typedef stlsoft_ns_qual(ss_int64_t)         us_int64_t;     
00350 typedef stlsoft_ns_qual(ss_sint64_t)        us_sint64_t;    
00351 typedef stlsoft_ns_qual(ss_uint64_t)        us_uint64_t;    
00352 #endif /* STLSOFT_CF_64BIT_INT_SUPPORT */
00353 typedef stlsoft_ns_qual(ss_int_t)           us_int_t;       
00354 typedef stlsoft_ns_qual(ss_sint_t)          us_sint_t;      
00355 typedef stlsoft_ns_qual(ss_uint_t)          us_uint_t;      
00356 typedef stlsoft_ns_qual(ss_long_t)          us_long_t;      
00357 typedef stlsoft_ns_qual(ss_bool_t)          us_bool_t;      
00358 typedef stlsoft_ns_qual(ss_size_t)          us_size_t;      
00359 typedef stlsoft_ns_qual(ss_ptrdiff_t)       us_ptrdiff_t;   
00360 typedef stlsoft_ns_qual(ss_streampos_t)     us_streampos_t; 
00361 typedef stlsoft_ns_qual(ss_streamoff_t)     us_streamoff_t; 
00362 
00363 #ifndef _UNIXSTL_NO_NAMESPACE
00364 typedef us_char_a_t         char_a_t;           
00365 typedef us_char_w_t         char_w_t;           
00366 //typedef us_int8_t           int8_t;             //!< 8-bit integer
00367 typedef us_sint8_t          sint8_t;            
00368 typedef us_uint8_t          uint8_t;            
00369 typedef us_int16_t          int16_t;            
00370 typedef us_sint16_t         sint16_t;           
00371 typedef us_uint16_t         uint16_t;           
00372 typedef us_int32_t          int32_t;            
00373 typedef us_sint32_t         sint32_t;           
00374 typedef us_uint32_t         uint32_t;           
00375 # ifdef STLSOFT_CF_64BIT_INT_SUPPORT
00376  typedef us_int64_t         int64_t;            
00377  typedef us_sint64_t        sint64_t;           
00378  typedef us_uint64_t        uint64_t;           
00379 # endif /* STLSOFT_CF_64BIT_INT_SUPPORT */
00380 //typedef us_short_t          short_t;            //!< short integer
00381 typedef us_int_t            int_t;              
00382 typedef us_sint_t           sint_t;             
00383 typedef us_uint_t           uint_t;             
00384 typedef us_long_t           long_t;             
00385 //typedef us_byte_t           byte_t;             //!< Byte
00386 typedef us_bool_t           bool_t;             
00387 # if !defined(__STLSOFT_COMPILER_IS_DMC)
00388 typedef us_size_t           size_t;             
00389 typedef us_ptrdiff_t        ptrdiff_t;          
00390 typedef us_streampos_t      streampos_t;        
00391 typedef us_streamoff_t      streamoff_t;        
00392 # endif /* compiler */
00393 #endif /* !_UNIXSTL_NO_NAMESPACE */
00394 
00395 #ifndef __STLSOFT_DOCUMENTATION_SKIP_SECTION
00396 /* 
00397  * Values
00398  *
00399  * Since the boolean type may not be supported natively on all compilers, the
00400  * values of true and false may also not be provided. Hence the values of
00401  * us_true_v and us_false_v are defined, and are used in all code.
00402  */
00403 
00404 #define us_true_v       ss_true_v
00405 #define us_false_v      ss_false_v
00406 
00407 #endif /* !__STLSOFT_DOCUMENTATION_SKIP_SECTION */
00408 /* 
00409  * Code modification macros
00410  */
00411 
00412 #ifndef __STLSOFT_DOCUMENTATION_SKIP_SECTION
00413 /* Exception signatures. */
00414 #define unixstl_throw_0()                               stlsoft_throw_0()
00415 #define unixstl_throw_1(x1)                             stlsoft_throw_1(x1)
00416 #define unixstl_throw_2(x1, x2)                         stlsoft_throw_2(x1, x2)
00417 #define unixstl_throw_3(x1, x2, x3)                     stlsoft_throw_3(x1, x2, x3)
00418 #define unixstl_throw_4(x1, x2, x3, x4)                 stlsoft_throw_4(x1, x2, x3, x4)
00419 #define unixstl_throw_5(x1, x2, x3, x4, x5)             stlsoft_throw_5(x1, x2, x3, x4, x5)
00420 #define unixstl_throw_6(x1, x2, x3, x4, x5, x6)         stlsoft_throw_6(x1, x2, x3, x4, x5, x6)
00421 #define unixstl_throw_7(x1, x2, x3, x4, x5, x6, x7)     stlsoft_throw_7(x1, x2, x3, x4, x5, x6, x7)
00422 #define unixstl_throw_8(x1, x2, x3, x4, x5, x6, x7, x8) stlsoft_throw_8(x1, x2, x3, x4, x5, x6, x7, x8)
00423 #endif /* !__STLSOFT_DOCUMENTATION_SKIP_SECTION */
00424 
00426 #define unixstl_num_elements(ar)                        stlsoft_num_elements(ar)
00427 
00429 #define unixstl_destroy_instance(t, _type, p)           stlsoft_destroy_instance(t, _type, p)
00430 
00432 #define unixstl_gen_opaque(_htype)                      stlsoft_gen_opaque(_htype)
00433 
00434 /* 
00435 
00436 #ifndef _UNIXSTL_NO_NAMESPACE
00437 # if defined(_STLSOFT_NO_NAMESPACE) || \
00438      defined(__STLSOFT_DOCUMENTATION_SKIP_SECTION)
00439 } // namespace unixstl
00440 # else
00441 } // namespace unixstl_project
00442 } // namespace stlsoft
00443 namespace unixstl = ::stlsoft::unixstl_project;
00444 # endif /* _STLSOFT_NO_NAMESPACE */
00445 #endif /* !_UNIXSTL_NO_NAMESPACE */
00446 
00447 /* 
00448 
00449 #endif /* !UNIXSTL_INCL_H_UNIXSTL */
00450 
00451 /* 

STLSoft Libraries documentation © Synesis Software Pty Ltd, 2001-2004