Synesis Software STLSoft - ... Robust, Lightweight, Cross-platform, Template Software ...

pantheios/pantheios.h

Go to the documentation of this file.
00001 /* /////////////////////////////////////////////////////////////////////////
00002  * File:        pantheios/pantheios.h
00003  *
00004  * Purpose:     Pantheios Core and Util APIs.
00005  *
00006  * Created:     21st June 2005
00007  * Updated:     4th January 2011
00008  *
00009  * Home:        http://www.pantheios.org/
00010  *
00011  * Copyright (c) 2005-2011, Matthew Wilson and Synesis Software
00012  * Copyright (c) 1999-2005, Synesis Software and Matthew Wilson
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
00017  * met:
00018  *
00019  * - Redistributions of source code must retain the above copyright notice,
00020  *   this list of conditions and the following disclaimer.
00021  * - Redistributions in binary form must reproduce the above copyright
00022  *   notice, this list of conditions and the following disclaimer in the
00023  *   documentation and/or other materials provided with the distribution.
00024  * - Neither the name(s) of Matthew Wilson and Synesis Software nor the
00025  *   names of any contributors may be used to endorse or promote products
00026  *   derived from this software without specific prior written permission.
00027  *
00028  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
00029  * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
00030  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
00031  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
00032  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00033  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00034  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
00035  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
00036  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
00037  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00038  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00039  *
00040  * ////////////////////////////////////////////////////////////////////// */
00041 
00042 
00049 #ifndef PANTHEIOS_INCL_PANTHEIOS_H_PANTHEIOS
00050 #define PANTHEIOS_INCL_PANTHEIOS_H_PANTHEIOS
00051 
00052 /* /////////////////////////////////////////////////////////////////////////
00053  * Version information
00054  */
00055 
00056 #ifndef PANTHEIOS_DOCUMENTATION_SKIP_SECTION
00057 # define PANTHEIOS_VER_PANTHEIOS_H_PANTHEIOS_MAJOR      3
00058 # define PANTHEIOS_VER_PANTHEIOS_H_PANTHEIOS_MINOR      43
00059 # define PANTHEIOS_VER_PANTHEIOS_H_PANTHEIOS_REVISION   6
00060 # define PANTHEIOS_VER_PANTHEIOS_H_PANTHEIOS_EDIT       333
00061 #endif /* !PANTHEIOS_DOCUMENTATION_SKIP_SECTION */
00062 
00079 #ifndef PANTHEIOS_DOCUMENTATION_SKIP_SECTION
00080 # define PANTHEIOS_VER_1_0_1_B2                 0x01000102
00081 # define PANTHEIOS_VER_1_0_1_B193               0x010001c1
00082 # define PANTHEIOS_VER_1_0_1_B194               0x010001c2
00083 # define PANTHEIOS_VER_1_0_1_B195               0x010001c3
00084 # define PANTHEIOS_VER_1_0_1_B196               0x010001c4
00085 # define PANTHEIOS_VER_1_0_1_B197               0x010001c5
00086 # define PANTHEIOS_VER_1_0_1_B198               0x010001c6
00087 # define PANTHEIOS_VER_1_0_1_B199               0x010001c7
00088 # define PANTHEIOS_VER_1_0_1_B200               0x010001c8
00089 # define PANTHEIOS_VER_1_0_1_B201               0x010001c9
00090 # define PANTHEIOS_VER_1_0_1_B202               0x010001ca
00091 # define PANTHEIOS_VER_1_0_1_B203               0x010001cb
00092 # define PANTHEIOS_VER_1_0_1_B204               0x010001cc
00093 # define PANTHEIOS_VER_1_0_1_B205               0x010001cd
00094 # define PANTHEIOS_VER_1_0_1_B206               0x010001ce
00095 # define PANTHEIOS_VER_1_0_1_B207               0x010001cf
00096 # define PANTHEIOS_VER_1_0_1_B208               0x010001d0
00097 # define PANTHEIOS_VER_1_0_1                    0x010001ff
00098 #endif /* !PANTHEIOS_DOCUMENTATION_SKIP_SECTION */
00099 
00100 #define PANTHEIOS_VER_MAJOR                     1
00101 #define PANTHEIOS_VER_MINOR                     0
00102 #define PANTHEIOS_VER_REVISION                  1
00103 
00104 #define PANTHEIOS_VER                           PANTHEIOS_VER_1_0_1_B208
00105 
00106 /* /////////////////////////////////////////////////////////////////////////
00107  * Includes - 1
00108  */
00109 
00110 /* Pantheios core API relies on STLSoft for compiler/library discrimination,
00111  * and various fundamental types.
00112  */
00113 #ifndef STLSOFT_INCL_STLSOFT_H_STLSOFT
00114 # include <stlsoft/stlsoft.h>
00115 #endif /* !STLSOFT_INCL_STLSOFT_H_STLSOFT */
00116 
00117 #if !defined(_STLSOFT_VER) || \
00118     _STLSOFT_VER < 0x010969ff
00119 # error This version Pantheios requires STLSoft 1.9.105, or later. (www.stlsoft.org)
00120 #endif /* STLSoft version */
00121 
00122 #ifndef PANTHEIOS_INCL_H_STDARG
00123 # define PANTHEIOS_INCL_H_STDARG
00124 # include <stdarg.h>     /* for va_list */
00125 #endif /* !PANTHEIOS_INCL_H_STDARG */
00126 #ifndef PANTHEIOS_INCL_H_STDDEF
00127 # define PANTHEIOS_INCL_H_STDDEF
00128 # include <stddef.h>     /* for size_t */
00129 #endif /* !PANTHEIOS_INCL_H_STDDEF */
00130 
00131 /* /////////////////////////////////////////////////////////////////////////
00132  * Feature detection
00133  */
00134 
00135 /* By default, Pantheios is a multi-byte string library
00136  *
00137  * If you define \c PANTHEIOS_USE_WIDE_STRINGS, then it will be built in
00138  * wide string form.
00139  *
00140  * Also, if you are compiling for Windows (32-bit or 64-bit) and define
00141  * either \c _UNICODE or \c UNICODE, then \c PANTHEIOS_USE_WIDE_STRINGS will
00142  * be defined automatically.
00143  *
00144  * In either case, if you define \c PANTHEIOS_NO_USE_WIDE_STRINGS, then the
00145  * wide string support will be suppressed.
00146  */
00147 
00148 #ifndef PANTHEIOS_USE_WIDE_STRINGS
00149 # if defined(_WIN32) && \
00150      defined(UNICODE) && \
00151      defined(_UNICODE)
00152 #  define PANTHEIOS_USE_WIDE_STRINGS
00153 # endif /* _WIN32 && UNICODE && _UNICODE */
00154 #endif /* !PANTHEIOS_USE_WIDE_STRINGS */
00155 
00156 #ifdef PANTHEIOS_NO_USE_WIDE_STRINGS
00157 # ifdef PANTHEIOS_USE_WIDE_STRINGS
00158 #  undef PANTHEIOS_USE_WIDE_STRINGS
00159 # endif /* PANTHEIOS_USE_WIDE_STRINGS */
00160 #endif /* PANTHEIOS_NO_USE_WIDE_STRINGS */
00161 
00162 /* /////////////////////////////////////////////////////////////////////////
00163  * Includes - 2
00164  */
00165 
00166 #ifdef PANTHEIOS_USE_WIDE_STRINGS
00167 # ifndef _WCHAR_T_DEFINED
00168 #  include <wchar.h>    /* for wchar_t (if not built-in) */
00169 # endif /* !_WCHAR_T_DEFINED */
00170 #endif /* PANTHEIOS_USE_WIDE_STRINGS */
00171 
00172 #include <pantheios/internal/string_encoding.h>
00173 
00174 /* /////////////////////////////////////////////////////////////////////////
00175  * Macros and definitions
00176  */
00177 
00187 #ifndef PANTHEIOS_DOCUMENTATION_SKIP_SECTION
00188 # define PANTHEIOS_STRINGIZE_(x)    #x
00189 #endif /* !PANTHEIOS_DOCUMENTATION_SKIP_SECTION */
00190 #define PANTHEIOS_STRINGIZE(x)      PANTHEIOS_STRINGIZE_(x)
00191 
00204 #define PANTHEIOS_MAKE_EXTENDED_SEVERITY(sev, xi28)     \
00205                                                         \
00206     (((sev) & 0x0f) | (((xi28) << 4) & ~0x0f))
00207 
00265 #if !defined(PANTHEIOS_DECLSPEC)
00266 # define PANTHEIOS_DECLSPEC
00267 #endif /* !PANTHEIOS_DECLSPEC */
00268 
00269 #if defined(__cplusplus) || \
00270     defined(PANTHEIOS_DOCUMENTATION_SKIP_SECTION)
00271 # define PANTHEIOS_EXTERN_C            extern "C"
00272 #else /* ? __cplusplus */
00273 # define PANTHEIOS_EXTERN_C            extern
00274 #endif /* !__cplusplus */
00275 
00276 #if !defined(PANTHEIOS_CALLCONV)
00277 # define PANTHEIOS_CALLCONV
00278 #endif /* !PANTHEIOS_CALLCONV */
00279 
00280 #define PANTHEIOS_CALL(rt)             PANTHEIOS_DECLSPEC PANTHEIOS_EXTERN_C rt PANTHEIOS_CALLCONV
00281 
00282 #ifndef PANTHEIOS_DOCUMENTATION_SKIP_SECTION
00283 # define PANTHEIOS_CPP_CALL(rt)        PANTHEIOS_DECLSPEC extern "C++" rt PANTHEIOS_CALLCONV
00284 #endif /* !PANTHEIOS_DOCUMENTATION_SKIP_SECTION */
00285 
00286 #if defined(STLSOFT_COMPILER_IS_MSVC) && \
00287     (   _MSC_VER >= 1500 || \
00288         (   _MSC_VER >= 1400 && \
00289             defined(_MSC_FULL_VER) && \
00290             _MSC_FULL_VER >= 140050320))
00291 #define PANTHEIOS_DECLARE_DEPRECATION(symtype, oldfn, newfn)    __declspec(deprecated("The " symtype " " PANTHEIOS_STRINGIZE(oldfn) " is deprecated and will be removed from a future version of Pantheios; use " PANTHEIOS_STRINGIZE(newfn) " instead"))
00292 #define PANTHEIOS_CALL_DEPRECATED(rt, oldfn, newfn)             PANTHEIOS_DECLARE_DEPRECATION("function", oldfn, newfn) PANTHEIOS_DECLSPEC PANTHEIOS_EXTERN_C rt PANTHEIOS_CALLCONV
00293 #else /* ? compiler */
00294 #define PANTHEIOS_DECLARE_DEPRECATION(symtype, oldfn, newfn)
00295 #define PANTHEIOS_CALL_DEPRECATED(rt, oldfn, newfn)             PANTHEIOS_CALL(rt)
00296 #endif /* compiler */
00297 
00298 /* /////////////////////////////////////////////////////////////////////////
00299  * Namespace
00300  */
00301 
00302 #if defined(STLSOFT_CF_NAMESPACE_SUPPORT)
00303 # define PANTHEIOS_CF_NAMESPACE_SUPPORT
00304 #else /* STLSOFT_CF_NAMESPACE_SUPPORT */
00305 # ifdef PANTHEIOS_CF_NAMESPACE_SUPPORT
00306 #  undef PANTHEIOS_CF_NAMESPACE_SUPPORT
00307 # endif /* PANTHEIOS_CF_NAMESPACE_SUPPORT */
00308 #endif /* STLSOFT_CF_NAMESPACE_SUPPORT */
00309 
00310 #if !defined(PANTHEIOS_CF_NAMESPACE_SUPPORT) && \
00311     !defined(PANTHEIOS_DOCUMENTATION_SKIP_SECTION) && \
00312     !defined(PANTHEIOS_NO_NAMESPACE)
00313 # define PANTHEIOS_NO_NAMESPACE
00314 #endif /* __cplusplus, etc. */
00315 
00316 #if !defined(PANTHEIOS_NO_NAMESPACE)
00317 
00322 namespace pantheios
00323 {
00324 
00329 namespace util
00330 {
00331 } /* namespace util */
00332 
00337 namespace core
00338 {
00339 } /* namespace core */
00340 
00341 # define PANTHEIOS_NS_QUAL(x)           ::pantheios::x
00342 # define PANTHEIOS_SUBNS_QUAL(sns, x)   ::pantheios::sns::x
00343 
00344 #else /* ? !PANTHEIOS_NO_NAMESPACE */
00345 
00346 # define PANTHEIOS_NS_QUAL(x)           x
00347 # define PANTHEIOS_SUBNS_QUAL(sns, x)   x
00348 
00349 #endif /* !PANTHEIOS_NO_NAMESPACE */
00350 
00363 /* /////////////////////////////////////////////////////////////////////////
00364  * Types
00365  */
00366 
00367 /* Basic types */
00368 
00370 typedef stlsoft_ns_qual(ss_uint8_t)     pan_uint8_t;
00372 typedef stlsoft_ns_qual(ss_uint16_t)    pan_uint16_t;
00374 typedef stlsoft_ns_qual(ss_uint32_t)    pan_uint32_t;
00376 typedef stlsoft_ns_qual(ss_uint64_t)    pan_uint64_t;
00377 
00379 typedef stlsoft_ns_qual(ss_sint8_t)     pan_sint8_t;
00381 typedef stlsoft_ns_qual(ss_sint16_t)    pan_sint16_t;
00383 typedef stlsoft_ns_qual(ss_sint32_t)    pan_sint32_t;
00385 typedef stlsoft_ns_qual(ss_sint64_t)    pan_sint64_t;
00386 
00387 
00394 #ifdef PANTHEIOS_USE_WIDE_STRINGS
00395 typedef wchar_t     pan_char_t;
00396 #else /* ? PANTHEIOS_USE_WIDE_STRINGS */
00397 typedef char        pan_char_t;
00398 #endif /* PANTHEIOS_USE_WIDE_STRINGS */
00399 
00407 #define PAN_CHAR_T  PANTHEIOS_NS_QUAL(pan_char_t)
00408 
00420 struct pan_slice_t
00421 {
00422     size_t              len;    
00423     pan_char_t const*   ptr;    
00425 #ifdef __cplusplus
00426 
00427     pan_slice_t();
00429     pan_slice_t(pan_char_t const* p, size_t l);
00431     pan_slice_t(pan_slice_t const& rhs);
00433     pan_slice_t& operator =(pan_slice_t const& rhs);
00434 
00435 # ifndef PANTHEIOS_DOCUMENTATION_SKIP_SECTION
00436 
00437     pan_slice_t(int len, pan_char_t const* p);
00438 # endif /* !PANTHEIOS_DOCUMENTATION_SKIP_SECTION */
00439 
00440 #ifndef PANTHEIOS_DOCUMENTATION_SKIP_SECTION
00441 
00446     static size_t   get_lazy_length(size_t fromLen, size_t toLen);
00447 #endif /* !PANTHEIOS_DOCUMENTATION_SKIP_SECTION */
00448 
00449 private:
00450     static size_t   calc_length_n_(pan_char_t const* s, size_t len);
00451 
00452 #endif /* __cplusplus */
00453 };
00454 #if !defined(__cplusplus)
00455 typedef struct pan_slice_t pan_slice_t;
00456 #endif /* !__cplusplus */
00457 
00458 
00459 #ifndef PANTHEIOS_NO_STOCK_LEVELS
00460 
00475 enum pan_severity_t
00476 {
00477         SEV_EMERGENCY       =   0   
00478     ,   SEV_ALERT           =   1   
00479     ,   SEV_CRITICAL        =   2   
00480     ,   SEV_ERROR           =   3   
00481     ,   SEV_WARNING         =   4   
00482     ,   SEV_NOTICE          =   5   
00483     ,   SEV_INFORMATIONAL   =   6   
00484     ,   SEV_DEBUG           =   7   
00486 # if defined(PANTHEIOS_NO_NAMESPACE)
00487     ,   PANTHEIOS_SEV_EMERGENCY         =   SEV_EMERGENCY
00488     ,   PANTHEIOS_SEV_ALERT             =   SEV_ALERT
00489     ,   PANTHEIOS_SEV_CRITICAL          =   SEV_CRITICAL
00490     ,   PANTHEIOS_SEV_ERROR             =   SEV_ERROR
00491     ,   PANTHEIOS_SEV_WARNING           =   SEV_WARNING
00492     ,   PANTHEIOS_SEV_NOTICE            =   SEV_NOTICE
00493     ,   PANTHEIOS_SEV_INFORMATIONAL     =   SEV_INFORMATIONAL
00494     ,   PANTHEIOS_SEV_DEBUG             =   SEV_DEBUG
00495 # endif /* PANTHEIOS_NO_NAMESPACE */
00496 
00497 };
00498 # if !defined(__cplusplus)
00499 typedef enum pan_severity_t pan_severity_t;
00500 # endif /* !__cplusplus */
00501 #endif /* !PANTHEIOS_NO_STOCK_LEVELS */
00502 
00509 typedef stlsoft_ns_qual(ss_sint32_t)    pan_sev_t;
00510 
00511 #if defined(__cplusplus) && \
00512     !defined(PANTHEIOS_NO_STOCK_LEVELS) && \
00513     !defined(PANTHEIOS_DOCUMENTATION_SKIP_SECTION)
00514 # define PANTHEIOS_INCLUDING_STOCKLEVELS
00515 # include "./internal/stock_levels.hpp"    /* Stock/custom level type */
00516 # undef PANTHEIOS_INCLUDING_STOCKLEVELS
00517 
00518 #endif /* __cplusplus */
00519 
00520 /* /////////////////////////////////////////////////////////////////////////
00521  * API
00522  */
00523 
00540 PANTHEIOS_CALL(pan_uint32_t) pantheios_getVersion(void);
00541 
00563 PANTHEIOS_CALL(int) pantheios_init(void);
00564 
00584 PANTHEIOS_CALL(void) pantheios_uninit(void);
00585 
00602 PANTHEIOS_CALL(int) pantheios_isSeverityLogged(pan_sev_t severity);
00603 
00614 PANTHEIOS_CALL(pan_char_t const*) pantheios_getStockSeverityString(pan_sev_t severity);
00615 #ifndef PANTHEIOS_DOCUMENTATION_SKIP_SECTION
00616 PANTHEIOS_CALL_DEPRECATED(pan_char_t const*, pantheios_getSeverityString, pantheios_getStockSeverityString) pantheios_getSeverityString(pan_sev_t severity);
00617 #endif /* !PANTHEIOS_DOCUMENTATION_SKIP_SECTION */
00618 
00628 PANTHEIOS_CALL(size_t) pantheios_getStockSeverityStringLength(pan_sev_t severity);
00629 #ifndef PANTHEIOS_DOCUMENTATION_SKIP_SECTION
00630 PANTHEIOS_CALL_DEPRECATED(size_t, pantheios_getSeverityStringLength, pantheios_getStockSeverityStringLength) pantheios_getSeverityStringLength(pan_sev_t severity);
00631 #endif /* !PANTHEIOS_DOCUMENTATION_SKIP_SECTION */
00632 
00642 PANTHEIOS_CALL(char const*) pantheios_getInitCodeString(int code);
00643 #ifndef PANTHEIOS_DOCUMENTATION_SKIP_SECTION
00644 PANTHEIOS_CALL_DEPRECATED(char const*, pantheios_getInitErrorString, pantheios_getInitCodeString) pantheios_getInitErrorString(int code);
00645 #endif /* !PANTHEIOS_DOCUMENTATION_SKIP_SECTION */
00646 
00654 PANTHEIOS_CALL(size_t) pantheios_getInitCodeStringLength(int code);
00655 #ifndef PANTHEIOS_DOCUMENTATION_SKIP_SECTION
00656 PANTHEIOS_CALL_DEPRECATED(size_t, pantheios_getInitErrorStringLength, pantheios_getInitCodeStringLength) pantheios_getInitErrorStringLength(int code);
00657 #endif /* !PANTHEIOS_DOCUMENTATION_SKIP_SECTION */
00658 
00659 #if !defined(PANTHEIOS_NO_NAMESPACE)
00660 namespace core
00661 {
00662 #endif /* !PANTHEIOS_NO_NAMESPACE */
00663 
00677 PANTHEIOS_CALL(int) pantheios_log_n(
00678     pan_sev_t                       severity
00679 ,   size_t                          numSlices
00680 #ifdef PANTHEIOS_DOCUMENTATION_SKIP_SECTION
00681 ,   pantheios::pan_slice_t const*   slices
00682 #else /* ? PANTHEIOS_DOCUMENTATION_SKIP_SECTION */
00683 ,   pan_slice_t const*              slices
00684 #endif /* PANTHEIOS_DOCUMENTATION_SKIP_SECTION */
00685 );
00686 
00687 #ifndef PANTHEIOS_DOCUMENTATION_SKIP_SECTION
00688 # define PANTHEIOS_INCLUDING_C_API_FUNCTIONS
00689 #endif /* !PANTHEIOS_DOCUMENTATION_SKIP_SECTION */
00690 #include "./internal/generated/log_functions.h"    /* pantheios_log_1() (pantheios::log_1()), etc.  */
00691 #ifndef PANTHEIOS_DOCUMENTATION_SKIP_SECTION
00692 # undef PANTHEIOS_INCLUDING_C_API_FUNCTIONS
00693 #endif /* !PANTHEIOS_DOCUMENTATION_SKIP_SECTION */
00694 
00695 #if !defined(PANTHEIOS_NO_NAMESPACE)
00696 } /* namespace core */
00697 #endif /* !PANTHEIOS_NO_NAMESPACE */
00698 
00711 PANTHEIOS_CALL(int) pantheios_logprintf(
00712     pan_sev_t           severity
00713 ,   pan_char_t const*   format
00714 ,   ...
00715 )
00716 #if defined(STLSOFT_COMPILER_IS_GCC) /* TODO: Change this to proper discriminated feature */
00717 __attribute__((format(printf,2,3)))
00718 #endif /* compiler */
00719 ;
00720 
00737 PANTHEIOS_CALL(int) pantheios_logvprintf(
00738     pan_sev_t           severity
00739 ,   pan_char_t const*   format
00740 ,   va_list             args
00741 );
00742 
00743 /* /////////////////////////////////////////////////////////////////////////
00744  * Utility functions
00745  */
00746 
00747 #if !defined(PANTHEIOS_NO_NAMESPACE)
00748 namespace util
00749 {
00750 #endif /* !PANTHEIOS_NO_NAMESPACE */
00751 
00779 PANTHEIOS_CALL(void) pantheios_onBailOut4(
00780     int           severity
00781 ,   char const*   message
00782 ,   char const*   processId
00783 ,   char const*   qualifier
00784 );
00785 
00813 PANTHEIOS_CALL(void) pantheios_onBailOut3(
00814     int           severity
00815 ,   char const*   message
00816 ,   char const*   processId
00817 );
00818 
00819 # ifndef PANTHEIOS_DOCUMENTATION_SKIP_SECTION
00820 
00821 PANTHEIOS_CALL(size_t) pantheios_util_strnlen(pan_char_t const* s, size_t len);
00822 PANTHEIOS_CALL_DEPRECATED(size_t, pantheios_strnlen, pantheios_util_strnlen) pantheios_strnlen(pan_char_t const* s, size_t len);
00823 
00824 # endif /* !PANTHEIOS_DOCUMENTATION_SKIP_SECTION */
00825 
00826 #if !defined(PANTHEIOS_NO_NAMESPACE)
00827 } /* namespace util */
00828 #endif /* !PANTHEIOS_NO_NAMESPACE */
00829 
00830 /* /////////////////////////////////////////////////////////////////////////
00831  * Core functions
00832  */
00833 
00834 #if !defined(PANTHEIOS_NO_NAMESPACE)
00835 namespace core
00836 {
00837 #endif /* !PANTHEIOS_NO_NAMESPACE */
00838 
00839 # ifndef PANTHEIOS_DOCUMENTATION_SKIP_SECTION
00840 PANTHEIOS_CALL(int)     pantheios_isInitialising(void);
00841 PANTHEIOS_CALL(int)     pantheios_isInitialised(void);
00842 PANTHEIOS_CALL(void)    pantheios_exitProcess(int code);
00843 PANTHEIOS_CALL_DEPRECATED(void, pantheios_exit_process, pantheios_exitProcess) pantheios_exit_process(int code);
00844 
00845 /* Memory block remains until Pantheios is uninitialised
00846  *
00847  * \param cb The number of bytes to allocate
00848  *
00849  * \return the NULL pointer if allocation failed, otherwise a pointer to a
00850  *   correctly aligned block of bytes, all of whose values are 0x00.
00851  */
00852 PANTHEIOS_CALL(void*)   pantheios_malloc(size_t cb);
00853 
00854 /* Memory allocation/deallocation for inserter memory blocks */
00855 PANTHEIOS_CALL(void*)   pantheios_inserterAllocate(size_t cb);
00856 PANTHEIOS_CALL(void)    pantheios_inserterDeallocate(void* pv);
00857 
00858 /*
00859  *
00860  * \remarks Guaranteed to be at least 999 characters
00861  */
00862 PANTHEIOS_CALL(pan_char_t const*) pantheios_getPad(size_t minimumWidth, size_t* actualWidth);
00863 # endif /* !PANTHEIOS_DOCUMENTATION_SKIP_SECTION */
00864 
00865 #if !defined(PANTHEIOS_NO_NAMESPACE)
00866 } /* namespace core */
00867 #endif /* !PANTHEIOS_NO_NAMESPACE */
00868 
00869 /* /////////////////////////////////////////////////////////////////////////
00870  * Core functions
00871  */
00872 
00873 #if !defined(PANTHEIOS_NO_NAMESPACE)
00874 namespace core
00875 {
00876 #endif /* !PANTHEIOS_NO_NAMESPACE */
00877 
00895 PANTHEIOS_CALL(int) pantheios_getNextBackEndId(void);
00896 
00897 #if !defined(PANTHEIOS_NO_NAMESPACE)
00898 } /* namespace core */
00899 #endif /* !PANTHEIOS_NO_NAMESPACE */
00900 
00914 PANTHEIOS_CALL(void) pantheios_logputs(
00915     pan_sev_t           severity
00916 ,   pan_char_t const*   message
00917 );
00918 
00926 PANTHEIOS_CALL_DEPRECATED(void, pantheios_puts, pantheios_logputs) pantheios_puts(pan_sev_t severity, pan_char_t const* message);
00927 
00928 #ifndef PANTHEIOS_DOCUMENTATION_SKIP_SECTION
00929 PANTHEIOS_CALL(void) pantheios_logassertfail(
00930     pan_sev_t   severity
00931 ,   char const* fileLine
00932 ,   char const* message
00933 );
00934 #endif /* !PANTHEIOS_DOCUMENTATION_SKIP_SECTION */
00935 
00936 /* /////////////////////////////////////////////////////////////////////////
00937  * Back-end map functions
00938  */
00939 
00940 #if 0 /* Not yet released */
00941 
00958 PANTHEIOS_CALL(int) pantheios_backEndMap_lookup(int backEndId, void** ptoken);
00959 
00972 PANTHEIOS_CALL(int) pantheios_backEndMap_add(int backEndId, void* token);
00973 
00985 PANTHEIOS_CALL(int) pantheios_backEndMap_remove(int backEndId);
00986 #endif /* 0 */
00987 
00988 /* /////////////////////////////////////////////////////////////////////////
00989  * Generated function control
00990  */
00991 
00992 #if defined(PANTHEIOS_DOCUMENTATION_SKIP_SECTION) || \
00993     !defined(PANTHEIOS_APPL_PARAMS_LIMIT)
00994 
01000 # define PANTHEIOS_APPL_PARAMS_LIMIT    PANTHEIOS_APPL_PARAMS_LIMIT_MAX_GENERATED
01001 #endif /* PANTHEIOS_DOCUMENTATION_SKIP_SECTION || !PANTHEIOS_APPL_PARAMS_LIMIT */
01002 
01003 /* Sanity check on PANTHEIOS_APPL_PARAMS_LIMIT */
01004 #if PANTHEIOS_APPL_PARAMS_LIMIT < 0 || \
01005     PANTHEIOS_APPL_PARAMS_LIMIT > PANTHEIOS_APPL_PARAMS_LIMIT_MAX_GENERATED
01006 # error PANTHEIOS_APPL_PARAMS_LIMIT Must be defined to be a number between 1 and PANTHEIOS_APPL_PARAMS_LIMIT_MAX_GENERATED
01007 #endif /* PANTHEIOS_APPL_PARAMS_LIMIT */
01008 
01009 /* /////////////////////////////////////////////////////////////////////////
01010  * API functions for C++
01011  */
01012 
01013 #if !defined(PANTHEIOS_NO_NAMESPACE)
01014 
01016 typedef pan_uint8_t     uint8_t;
01018 typedef pan_uint16_t    uint16_t;
01020 typedef pan_uint32_t    uint32_t;
01022 typedef pan_uint64_t    uint64_t;
01023 
01025 typedef pan_sint8_t     sint8_t;
01027 typedef pan_sint16_t    sint16_t;
01029 typedef pan_sint32_t    sint32_t;
01031 typedef pan_sint64_t    sint64_t;
01032 
01033 /* /////////////////////////////////////////////////////////////////////////
01034  * Utility Functions
01035  */
01036 
01037 namespace util
01038 {
01039 
01040 # ifndef PANTHEIOS_DOCUMENTATION_SKIP_SECTION
01041 
01042 inline void onBailOut(int severity, char const* message, char const* processId)
01043 {
01044     pantheios_onBailOut3(severity, message, processId);
01045 }
01046 
01047 inline void onBailOut(int severity, char const* message, char const* processId, char const* qualifier)
01048 {
01049     pantheios_onBailOut4(severity, message, processId, qualifier);
01050 }
01051 
01052 inline size_t strnlen(pan_char_t const* s, size_t len)
01053 {
01054     return pantheios_util_strnlen(s, len);
01055 }
01056 
01057 # endif /* !PANTHEIOS_DOCUMENTATION_SKIP_SECTION */
01058 
01059 } /* namespace util */
01060 
01061 /* /////////////////////////////////////////////////////////////////////////
01062  * Core Functions
01063  */
01064 
01065 # ifndef PANTHEIOS_DOCUMENTATION_SKIP_SECTION
01066 
01067 inline int init()
01068 {
01069     return pantheios_init();
01070 }
01071 
01072 inline void uninit()
01073 {
01074     pantheios_uninit();
01075 }
01076 
01077 # endif /* !PANTHEIOS_DOCUMENTATION_SKIP_SECTION */
01078 
01079 namespace core
01080 {
01081 
01082 # ifndef PANTHEIOS_DOCUMENTATION_SKIP_SECTION
01083 
01084 inline int isInitialising()
01085 {
01086     return pantheios_isInitialising();
01087 }
01088 
01089 inline int isInitialised()
01090 {
01091     return pantheios_isInitialised();
01092 }
01093 
01094 inline void exitProcess(int code)
01095 {
01096     pantheios_exitProcess(code);
01097 }
01098 
01099 inline PANTHEIOS_DECLARE_DEPRECATION("function", exit_process, exitProcess) void exit_process(int code)
01100 {
01101     exitProcess(code);
01102 }
01103 
01104 inline void* malloc(size_t cb)
01105 {
01106     return pantheios_malloc(cb);
01107 }
01108 
01109 # endif /* !PANTHEIOS_DOCUMENTATION_SKIP_SECTION */
01110 
01111 } /* namespace core */
01112 
01117 inline int isSeverityLogged(pan_sev_t severity)
01118 {
01119     return pantheios_isSeverityLogged(severity);
01120 }
01121 
01126 inline pan_char_t const* getStockSeverityString(pan_sev_t severity)
01127 {
01128     return pantheios_getStockSeverityString(severity);
01129 }
01130 
01131 # ifndef PANTHEIOS_DOCUMENTATION_SKIP_SECTION
01132 
01133 inline PANTHEIOS_DECLARE_DEPRECATION("function", getSeverityString, getStockSeverityString) pan_char_t const* getSeverityString(pan_sev_t severity)
01134 {
01135     return getStockSeverityString(severity);
01136 }
01137 
01138 # endif /* !PANTHEIOS_DOCUMENTATION_SKIP_SECTION */
01139 
01144 inline size_t getStockSeverityStringLength(pan_sev_t severity)
01145 {
01146     return pantheios_getStockSeverityStringLength(severity);
01147 }
01148 
01149 # ifndef PANTHEIOS_DOCUMENTATION_SKIP_SECTION
01150 
01151 inline PANTHEIOS_DECLARE_DEPRECATION("function", getSeverityStringLength, getStockSeverityStringLength) size_t getSeverityStringLength(pan_sev_t severity)
01152 {
01153     return getStockSeverityStringLength(severity);
01154 }
01155 
01156 # endif /* !PANTHEIOS_DOCUMENTATION_SKIP_SECTION */
01157 
01162 inline char const* getInitCodeString(int code)
01163 {
01164     return pantheios_getInitCodeString(code);
01165 }
01166 
01167 # ifndef PANTHEIOS_DOCUMENTATION_SKIP_SECTION
01168 
01169 inline PANTHEIOS_DECLARE_DEPRECATION("function", getInitErrorString, getInitCodeString) char const* getInitErrorString(int code)
01170 {
01171     return getInitCodeString(code);
01172 }
01173 
01174 # endif /* !PANTHEIOS_DOCUMENTATION_SKIP_SECTION */
01175 
01180 inline size_t getInitCodeStringLength(int code)
01181 {
01182     return pantheios_getInitCodeStringLength(code);
01183 }
01184 
01185 # ifndef PANTHEIOS_DOCUMENTATION_SKIP_SECTION
01186 
01187 inline PANTHEIOS_DECLARE_DEPRECATION("function", getInitErrorStringLength, getInitCodeStringLength) size_t getInitErrorStringLength(int code)
01188 {
01189     return getStockSeverityStringLength(code);
01190 }
01191 
01192 # endif /* !PANTHEIOS_DOCUMENTATION_SKIP_SECTION */
01193 
01194 namespace core
01195 {
01196 
01202 inline int getNextBackEndId()
01203 {
01204     return pantheios_getNextBackEndId();
01205 }
01206 
01207 } /* namespace core */
01208 
01213 inline void logputs(
01214     pan_sev_t           severity
01215 ,   pan_char_t const*   message
01216 )
01217 {
01218     pantheios_logputs(severity, message);
01219 }
01220 
01228 inline PANTHEIOS_DECLARE_DEPRECATION("function", puts, logputs) void puts(pan_sev_t severity, pan_char_t const* message)
01229 {
01230     pantheios_logputs(severity, message);
01231 }
01232 
01238 #if !defined(PANTHEIOS_DOCUMENTATION_SKIP_SECTION) && \
01239     defined(STLSOFT_COMPILER_IS_GCC) /* TODO: Change this to proper discriminated feature */
01240 int logprintf(
01241     pan_sev_t           severity
01242 ,   pan_char_t const*   format
01243 ,   ...
01244 )
01245 __attribute__((format(printf,2,3)))
01246 ;
01247 #endif /* compiler */
01248 
01249 inline int logprintf(
01250     pan_sev_t           severity
01251 ,   pan_char_t const*   format
01252 ,   ...
01253 )
01254 {
01255     va_list args;
01256     int     ret;
01257 
01258     va_start(args, format);
01259 
01260     ret = pantheios_logvprintf(severity, format, args);
01261 
01262     va_end(args);
01263 
01264     return ret;
01265 }
01266 
01267 
01272 inline int logvprintf(
01273     pan_sev_t           severity
01274 ,   pan_char_t const*   format
01275 ,   va_list             args
01276 )
01277 {
01278     return pantheios_logvprintf(severity, format, args);
01279 }
01280 
01281 #endif /* !PANTHEIOS_NO_NAMESPACE */
01282 
01283 /* /////////////////////////////////////////////////////////////////////////
01284  * String access shims
01285  */
01286 
01287 #ifdef __cplusplus
01288 
01289 # if !defined(PANTHEIOS_NO_NAMESPACE)
01290 namespace shims
01291 {
01292 # endif /* !PANTHEIOS_NO_NAMESPACE */
01293 
01295 # ifdef PANTHEIOS_USE_WIDE_STRINGS
01296 inline wchar_t const* c_str_ptr_w(pan_slice_t const& s)
01297 {
01298     return (0 == s.len) ? L"" : s.ptr;
01299 }
01300 # else /* ? PANTHEIOS_USE_WIDE_STRINGS */
01301 inline char const* c_str_ptr_a(pan_slice_t const& s)
01302 {
01303     return (0 == s.len) ? "" : s.ptr;
01304 }
01305 # endif /* PANTHEIOS_USE_WIDE_STRINGS */
01306 
01307 inline pan_char_t const* c_str_ptr(pan_slice_t const& s)
01308 {
01309 # ifdef PANTHEIOS_USE_WIDE_STRINGS
01310     return c_str_ptr_w(s);
01311 # else /* ? PANTHEIOS_USE_WIDE_STRINGS */
01312     return c_str_ptr_a(s);
01313 # endif /* PANTHEIOS_USE_WIDE_STRINGS */
01314 }
01315 
01317 # ifdef PANTHEIOS_USE_WIDE_STRINGS
01318 inline wchar_t const* c_str_ptr_null_w(pan_slice_t const& s)
01319 {
01320     return (0 != s.len) ? s.ptr : NULL;
01321 }
01322 # else /* ? PANTHEIOS_USE_WIDE_STRINGS */
01323 inline char const* c_str_ptr_null_a(pan_slice_t const& s)
01324 {
01325     return (0 != s.len) ? s.ptr : NULL;
01326 }
01327 # endif /* PANTHEIOS_USE_WIDE_STRINGS */
01328 
01329 inline pan_char_t const* c_str_ptr_null(pan_slice_t const& s)
01330 {
01331 # ifdef PANTHEIOS_USE_WIDE_STRINGS
01332     return c_str_ptr_null_w(s);
01333 # else /* ? PANTHEIOS_USE_WIDE_STRINGS */
01334     return c_str_ptr_null_a(s);
01335 # endif /* PANTHEIOS_USE_WIDE_STRINGS */
01336 }
01337 
01339 # ifdef PANTHEIOS_USE_WIDE_STRINGS
01340 inline wchar_t const* c_str_data_w(pan_slice_t const& s)
01341 {
01342     return c_str_ptr(s);
01343 }
01344 # else /* ? PANTHEIOS_USE_WIDE_STRINGS */
01345 inline char const* c_str_data_a(pan_slice_t const& s)
01346 {
01347     return c_str_ptr(s);
01348 }
01349 # endif /* PANTHEIOS_USE_WIDE_STRINGS */
01350 
01351 inline pan_char_t const* c_str_data(pan_slice_t const& s)
01352 {
01353 # ifdef PANTHEIOS_USE_WIDE_STRINGS
01354     return c_str_data_w(s);
01355 # else /* ? PANTHEIOS_USE_WIDE_STRINGS */
01356     return c_str_data_a(s);
01357 # endif /* PANTHEIOS_USE_WIDE_STRINGS */
01358 }
01359 
01361 # ifdef PANTHEIOS_USE_WIDE_STRINGS
01362 inline size_t c_str_len_w(pan_slice_t const& s)
01363 {
01364     return s.len;
01365 }
01366 # else /* ? PANTHEIOS_USE_WIDE_STRINGS */
01367 inline size_t c_str_len_a(pan_slice_t const& s)
01368 {
01369     return s.len;
01370 }
01371 # endif /* PANTHEIOS_USE_WIDE_STRINGS */
01372 
01373 inline size_t c_str_len(pan_slice_t const& s)
01374 {
01375 # ifdef PANTHEIOS_USE_WIDE_STRINGS
01376     return c_str_len_w(s);
01377 # else /* ? PANTHEIOS_USE_WIDE_STRINGS */
01378     return c_str_len_a(s);
01379 # endif /* PANTHEIOS_USE_WIDE_STRINGS */
01380 }
01381 
01382 
01383 
01385 # ifdef PANTHEIOS_USE_WIDE_STRINGS
01386 inline wchar_t const* c_str_ptr_w(pan_slice_t const* s)
01387 {
01388     return (NULL != s) ? c_str_ptr_w(*s) : L"";
01389 }
01390 # else /* ? PANTHEIOS_USE_WIDE_STRINGS */
01391 inline char const* c_str_ptr_a(pan_slice_t const* s)
01392 {
01393     return (NULL != s) ? c_str_ptr_a(*s) : "";
01394 }
01395 # endif /* PANTHEIOS_USE_WIDE_STRINGS */
01396 
01397 inline pan_char_t const* c_str_ptr(pan_slice_t const* s)
01398 {
01399 # ifdef PANTHEIOS_USE_WIDE_STRINGS
01400     return c_str_ptr_w(s);
01401 # else /* ? PANTHEIOS_USE_WIDE_STRINGS */
01402     return c_str_ptr_a(s);
01403 # endif /* PANTHEIOS_USE_WIDE_STRINGS */
01404 }
01405 
01407 # ifdef PANTHEIOS_USE_WIDE_STRINGS
01408 inline wchar_t const* c_str_ptr_null_w(pan_slice_t const* s)
01409 {
01410     return (NULL != s && (0 != s->len)) ? s->ptr : NULL;
01411 }
01412 # else /* ? PANTHEIOS_USE_WIDE_STRINGS */
01413 inline char const* c_str_ptr_null_a(pan_slice_t const* s)
01414 {
01415     return (NULL != s && (0 != s->len)) ? s->ptr : NULL;
01416 }
01417 # endif /* PANTHEIOS_USE_WIDE_STRINGS */
01418 
01419 inline pan_char_t const* c_str_ptr_null(pan_slice_t const* s)
01420 {
01421 # ifdef PANTHEIOS_USE_WIDE_STRINGS
01422     return c_str_ptr_null_w(s);
01423 # else /* ? PANTHEIOS_USE_WIDE_STRINGS */
01424     return c_str_ptr_null_a(s);
01425 # endif /* PANTHEIOS_USE_WIDE_STRINGS */
01426 }
01427 
01429 # ifdef PANTHEIOS_USE_WIDE_STRINGS
01430 inline wchar_t const* c_str_data_w(pan_slice_t const* s)
01431 {
01432     return c_str_ptr(s);
01433 }
01434 # else /* ? PANTHEIOS_USE_WIDE_STRINGS */
01435 inline char const* c_str_data_a(pan_slice_t const* s)
01436 {
01437     return c_str_ptr(s);
01438 }
01439 # endif /* PANTHEIOS_USE_WIDE_STRINGS */
01440 
01441 inline pan_char_t const* c_str_data(pan_slice_t const* s)
01442 {
01443 # ifdef PANTHEIOS_USE_WIDE_STRINGS
01444     return c_str_data_w(s);
01445 # else /* ? PANTHEIOS_USE_WIDE_STRINGS */
01446     return c_str_data_a(s);
01447 # endif /* PANTHEIOS_USE_WIDE_STRINGS */
01448 }
01449 
01451 # ifdef PANTHEIOS_USE_WIDE_STRINGS
01452 inline size_t c_str_len_w(pan_slice_t const* s)
01453 {
01454     return (NULL != s) ? s->len : 0;
01455 }
01456 # else /* ? PANTHEIOS_USE_WIDE_STRINGS */
01457 inline size_t c_str_len_a(pan_slice_t const* s)
01458 {
01459     return (NULL != s) ? s->len : 0;
01460 }
01461 # endif /* PANTHEIOS_USE_WIDE_STRINGS */
01462 
01463 inline size_t c_str_len(pan_slice_t const* s)
01464 {
01465 # ifdef PANTHEIOS_USE_WIDE_STRINGS
01466     return c_str_len_w(s);
01467 # else /* ? PANTHEIOS_USE_WIDE_STRINGS */
01468     return c_str_len_a(s);
01469 # endif /* PANTHEIOS_USE_WIDE_STRINGS */
01470 }
01471 
01472 
01473 
01474 # ifndef PANTHEIOS_NO_STOCK_LEVELS
01475 
01476 # ifdef PANTHEIOS_USE_WIDE_STRINGS
01477 inline wchar_t const* c_str_data_w(pan_severity_t severity)
01478 {
01479     return pantheios_getStockSeverityString(severity);
01480 }
01481 # else /* ? PANTHEIOS_USE_WIDE_STRINGS */
01482 inline char const* c_str_data_a(pan_severity_t severity)
01483 {
01484     return pantheios_getStockSeverityString(severity);
01485 }
01486 # endif /* PANTHEIOS_USE_WIDE_STRINGS */
01487 
01488 inline pan_char_t const* c_str_data(pan_severity_t severity)
01489 {
01490     return pantheios_getStockSeverityString(severity);
01491 }
01492 
01494 # ifdef PANTHEIOS_USE_WIDE_STRINGS
01495 inline size_t c_str_len_w(pan_severity_t severity)
01496 {
01497     return pantheios_getStockSeverityStringLength(severity);
01498 }
01499 # else /* ? PANTHEIOS_USE_WIDE_STRINGS */
01500 inline size_t c_str_len_a(pan_severity_t severity)
01501 {
01502     return pantheios_getStockSeverityStringLength(severity);
01503 }
01504 # endif /* PANTHEIOS_USE_WIDE_STRINGS */
01505 
01506 inline size_t c_str_len(pan_severity_t severity)
01507 {
01508     return pantheios_getStockSeverityStringLength(severity);
01509 }
01510 
01512 # ifdef PANTHEIOS_USE_WIDE_STRINGS
01513 inline wchar_t const* c_str_ptr_w(pan_severity_t severity)
01514 {
01515     return pantheios_getStockSeverityString(severity);
01516 }
01517 # else /* ? PANTHEIOS_USE_WIDE_STRINGS */
01518 inline char const* c_str_ptr_a(pan_severity_t severity)
01519 {
01520     return pantheios_getStockSeverityString(severity);
01521 }
01522 # endif /* PANTHEIOS_USE_WIDE_STRINGS */
01523 
01524 inline pan_char_t const* c_str_ptr(pan_severity_t severity)
01525 {
01526     return pantheios_getStockSeverityString(severity);
01527 }
01528 
01530 # ifdef PANTHEIOS_USE_WIDE_STRINGS
01531 inline wchar_t const* c_str_ptr_null_w(pan_severity_t severity)
01532 {
01533     wchar_t const* s = pantheios_getStockSeverityString(severity);
01534 
01535     return ('\0' != *s) ? s : NULL;
01536 }
01537 # else /* ? PANTHEIOS_USE_WIDE_STRINGS */
01538 inline char const* c_str_ptr_null_a(pan_severity_t severity)
01539 {
01540     char const* s = pantheios_getStockSeverityString(severity);
01541 
01542     return ('\0' != *s) ? s : NULL;
01543 }
01544 # endif /* PANTHEIOS_USE_WIDE_STRINGS */
01545 
01546 inline pan_char_t const* c_str_ptr_null(pan_severity_t severity)
01547 {
01548     pan_char_t const* s = pantheios_getStockSeverityString(severity);
01549 
01550     return ('\0' != *s) ? s : NULL;
01551 }
01552 # endif /* !PANTHEIOS_NO_STOCK_LEVELS */
01553 
01554 # if !defined(PANTHEIOS_NO_NAMESPACE)
01555 } /* namespace shims */
01556 # endif /* !PANTHEIOS_NO_NAMESPACE */
01557 
01558 #endif /* __cplusplus */
01559 
01560 /* /////////////////////////////////////////////////////////////////////////
01561  * Namespace
01562  */
01563 
01564 #ifdef __cplusplus
01565 # ifndef PANTHEIOS_DOCUMENTATION_SKIP_SECTION
01566 inline /* static */ size_t pan_slice_t::calc_length_n_(pan_char_t const* s, size_t len)
01567 {
01568 #if !defined(PANTHEIOS_NO_NAMESPACE)
01569     return pantheios::util::strnlen(s, len);
01570 #else /* ? !PANTHEIOS_NO_NAMESPACE */
01571     return pantheios_util_strnlen(s, len);
01572 #endif /* !PANTHEIOS_NO_NAMESPACE */
01573 }
01574 
01575 inline pan_slice_t::pan_slice_t()
01576     : len(0)
01577     , ptr(NULL)
01578 {}
01579 inline pan_slice_t::pan_slice_t(pan_char_t const* p, size_t l)
01580     : len(l)
01581     , ptr(p)
01582 {
01583     const size_t topBit = size_t(0x01) << (sizeof(size_t) * 8 - 1);
01584 
01585     if(topBit & len)
01586     {
01587         this->len = calc_length_n_(p, len);
01588     }
01589 }
01590 inline pan_slice_t::pan_slice_t(pan_slice_t const& rhs)
01591     : len(rhs.len)
01592     , ptr(rhs.ptr)
01593 {}
01594 inline pan_slice_t& pan_slice_t::operator =(pan_slice_t const& rhs)
01595 {
01596     len = rhs.len;
01597     ptr = rhs.ptr;
01598 
01599     return *this;
01600 }
01601 
01602 inline pan_slice_t::pan_slice_t(int len, pan_char_t const* p)
01603     : len(calc_length_n_(p, static_cast<size_t>(len)))
01604     , ptr(p)
01605 {}
01606 # endif /* !PANTHEIOS_DOCUMENTATION_SKIP_SECTION */
01607 #endif /* __cplusplus */
01608 
01609 /* /////////////////////////////////////////////////////////////////////////
01610  * Namespace
01611  */
01612 
01613 #if !defined(PANTHEIOS_NO_NAMESPACE)
01614 } /* namespace pantheios */
01615 
01616 
01617 # ifndef PANTHEIOS_NO_STOCK_LEVELS
01618 
01619 /* #define the severity levels at the global level, since the construction
01620  * of pantheios::PANTHEIOS_SEV_xxx is too wordy and unnecessary.
01621  */
01622 
01663 #  define PANTHEIOS_SEV_EMERGENCY       ::pantheios::SEV_EMERGENCY
01664 #  define PANTHEIOS_SEV_ALERT           ::pantheios::SEV_ALERT
01665 #  define PANTHEIOS_SEV_CRITICAL        ::pantheios::SEV_CRITICAL
01666 #  define PANTHEIOS_SEV_ERROR           ::pantheios::SEV_ERROR
01667 #  define PANTHEIOS_SEV_WARNING         ::pantheios::SEV_WARNING
01668 #  define PANTHEIOS_SEV_NOTICE          ::pantheios::SEV_NOTICE
01669 #  define PANTHEIOS_SEV_INFORMATIONAL   ::pantheios::SEV_INFORMATIONAL
01670 #  define PANTHEIOS_SEV_DEBUG           ::pantheios::SEV_DEBUG
01671 # endif /* !PANTHEIOS_NO_STOCK_LEVELS */
01672 
01673 
01674 #ifdef PANTHEIOS_DOCUMENTATION_SKIP_SECTION
01675 
01687 #endif /* PANTHEIOS_DOCUMENTATION_SKIP_SECTION */
01688 namespace stlsoft
01689 {
01690 
01691 #ifdef PANTHEIOS_USE_WIDE_STRINGS
01692     using ::pantheios::shims::c_str_data_w;
01693     using ::pantheios::shims::c_str_len_w;
01694     using ::pantheios::shims::c_str_ptr_w;
01695     using ::pantheios::shims::c_str_ptr_null_w;
01696 #else /* ? PANTHEIOS_USE_WIDE_STRINGS */
01697     using ::pantheios::shims::c_str_data_a;
01698     using ::pantheios::shims::c_str_len_a;
01699     using ::pantheios::shims::c_str_ptr_a;
01700     using ::pantheios::shims::c_str_ptr_null_a;
01701 #endif /* PANTHEIOS_USE_WIDE_STRINGS */
01702     using ::pantheios::shims::c_str_data;
01703     using ::pantheios::shims::c_str_len;
01704     using ::pantheios::shims::c_str_ptr;
01705     using ::pantheios::shims::c_str_ptr_null;
01706 
01707 } /* namespace stlsoft */
01708 
01709 #else /* ? !PANTHEIOS_NO_NAMESPACE */
01710 
01711 # ifdef __cplusplus
01712 namespace stlsoft
01713 {
01714 
01715 #ifdef PANTHEIOS_USE_WIDE_STRINGS
01716     using ::c_str_data_w;
01717     using ::c_str_len_w;
01718     using ::c_str_ptr_w;
01719     using ::c_str_ptr_null_w;
01720 #else /* ? PANTHEIOS_USE_WIDE_STRINGS */
01721     using ::c_str_data_a;
01722     using ::c_str_len_a;
01723     using ::c_str_ptr_a;
01724     using ::c_str_ptr_null_a;
01725 #endif /* PANTHEIOS_USE_WIDE_STRINGS */
01726     using ::c_str_data;
01727     using ::c_str_len;
01728     using ::c_str_ptr;
01729     using ::c_str_ptr_null;
01730 
01731 } /* namespace stlsoft */
01732 # endif /* __cplusplus */
01733 
01734 #endif /* !PANTHEIOS_NO_NAMESPACE */
01735 
01736 /* /////////////////////////////////////////////////////////////////////////
01737  * Inclusion
01738  */
01739 
01740 #ifdef STLSOFT_PPF_pragma_once_SUPPORT
01741 # pragma once
01742 #endif /* STLSOFT_PPF_pragma_once_SUPPORT */
01743 
01744 /* ////////////////////////////////////////////////////////////////////// */
01745 
01746 #endif /* !PANTHEIOS_INCL_PANTHEIOS_H_PANTHEIOS */
01747 
01748 /* ///////////////////////////// end of file //////////////////////////// */

pantheios Library documentation © Matthew Wilson & Synesis Software, 2006-2011 SourceForge.net Logo