#ifndef _INCLUDED_L3_PORT_H #define _INCLUDED_L3_PORT_H // *L3 Libraries portability issues* Copyright (C) Krzysztof Bosak, 1999-10-02...2001-02-13. // All rights reserved. // kbosak@box43.pl // http://www.kbosak.prv.pl ///////////////////////////////////////////////////////////////////////////// #include #define PLATFORM_HAS_FILESYSTEM ///////////////////////////////////////////////////////////////////////////// #ifdef _MSC_VER #define inline __forceinline // Nice trick with Visual C++ #else #ifndef __cdecl // Cygwin has this symbol already defined #define __cdecl // Used to allow fastcall convention with Visual C++ #endif #endif ///////////////////////////////////////////////////////////////////////////// #define NO_EXCEPTIONS // Profiler at l3_time.h ///////////////////////////////////////////////////////////////////////////// // When there are no assertions: #ifdef UNDER_CE #if UNDER_CE==300 // no assert.h header, but assert macro is defined sometimes inside STL, we define it here explicitly #define assert(exp) if(!(exp)) {fprintf(stderr, "Internal problem in file %s at line %d\n", __FILE__, __LINE__);exit(1);} #else #include #endif #else #include #endif ///////////////////////////////////////////////////////////////////////////// #ifdef UNDER_CE #include "l3_miniiostream.h" // Replacement for iostream.h and fstream.h #else #ifdef _MSC_VER #if (_MSC_VER >= 1310) // Visual C++ .NET (7.1) #include using namespace std;// OpenWatcom 1.2 hates this line. #else #include #endif #else #include #endif #ifdef PLATFORM_HAS_FILESYSTEM #ifdef _MSC_VER #if (_MSC_VER >= 1310) // Visual C++ .NET (7.1) #include using namespace std;// OpenWatcom 1.2 hates this line. #else #include #endif #else #include #endif #endif // PLATFORM_HAS_FILESYSTEM #endif ///////////////////////////////////////////////////////////////////////////// // KAI KCC v. 4.0-d1 and Bloodshed Dev-C++ // (MINGW gcc 3.2, DJGPP gcc 3.23, Metrowerks CodeWarrior 8.0 (IDEv5)) // compilers offer no separate flag ios::nocreate // (but MS Visual C++ needs this flag explicitly // while the ISO standard tells us nothing about this case!): /* __KAI_IOS __MINGW __MWERKS__ __DJGPP */ #ifdef _MSC_VER #if (_MSC_VER >= 1310) // Visual C++ .NET (7.1) #define nocreate in #endif #else #define nocreate in #endif ///////////////////////////////////////////////////////////////////////////// // DEC CXX v. 6.1 compiler hasn't ios::binary nor ios::bin: #ifdef __DECCXX #define binary out #endif ///////////////////////////////////////////////////////////////////////////// // When explicit keyword is not supported: //#define explicit ///////////////////////////////////////////////////////////////////////////// // When bool type is not present: //typedef char bool; const bool true=1, false=0; ///////////////////////////////////////////////////////////////////////////// /* // When there are no C++ casts: template class c_style_emulated_cast { private: const target _data; public: template inline explicit c_style_emulated_cast(source data): _data((target)data) { } inline operator target() const { return _data; } private: c_style_emulated_cast& operator=(const c_style_emulated_cast&);// Forbidden. explicit c_style_emulated_cast(const c_style_emulated_cast&);// Forbidden. }; #define static_cast c_style_emulated_cast #define const_cast c_style_emulated_cast #define reinterpret_cast c_style_emulated_cast //#define dynamic_cast c_style_emulated_cast */ ///////////////////////////////////////////////////////////////////////////// /* // Replacement of safe arrays by STL std::vector<>: // Less safety, slower and much larger executable. #define _INCLUDED_L3_ARRAY_H #include #include #include #include //#include // Broken with eMbedded Visual 4.0. #include template class autoarray: public std::vector { public: inline autoarray() { } inline explicit autoarray(int len) : std::vector(len) { } inline void setsize(int len) { resize(0); reserve(len); resize(len); } inline void fill(const type& value) { const int imax=size(); for(int i=0; i class basearray: public std::vector { public: inline basearray() { } inline explicit basearray(int len) : std::vector(len) { } inline basearray(const type arr[], int len) : std::vector(len) { for(int i=0; i>1; for(int i1=0, i2=size()-1; i1 typedef std::string TextString; */ ///////////////////////////////////////////////////////////////////////////// #endif // _INCLUDED_L3_PORT_H