//================================================================================================== // S t a n d a r d Interface // T y p e // 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 provides the common basic types. */
// File Name //------------------------------------------------------------------------------------- #line __LINE__ "standard/type.hpp"
// Guardian //-------------------------------------------------------------------------------------- #ifndef guStandardType #define guStandardType
// Headers //--------------------------------------------------------------------------------------- #include <typeinfo> /*INCLUDE*/ #include <bpp/standard/initializer.hpp> /*INCLUDE*/
namespace bpp {
// Importation/Exportation //----------------------------------------------------------------------- #ifdef STANDARD_DLL #define dll_export DLL_EXPORT #else #define dll_export DLL_IMPORT #endif
// Namespaces //------------------------------------------------------------------------------------ #define public_area standardType #define private_area standardType_private
namespace public_area { /*NAMESPACE*/ using namespace standardThread; } namespace private_area { using namespace public_area; }
// Initialization //-------------------------------------------------------------------------------- #define iniStandardType has_initializer;
// Macrocommands //--------------------------------------------------------------------------------- #ifdef NEED_INSTANTIATE_TEMPLATE_CLASS #define instantiate_class(prLine) prLine #else #define instantiate_class(prLine) #endif
// Types & Classes //------------------------------------------------------------------------------- namespace public_area { //-----------------------------------------------------------------------------------Variable Types /*TYPE*/ /* Boolean (<CODE>false</CODE> or <CODE>true</CODE>). */ typedef BOOLEAN_TYPE tyBoolean;
/*TYPE*/ /* Byte (positive integer between 0 and 255). */ typedef BYTE_TYPE tyByte;
/*TYPE*/ /* Cardinal (positive integer used to count elements in the memory). */ typedef CARDINAL_TYPE tyCardinal;
/*TYPE*/ /* Character (signed or unsigned integer). */ typedef CHARACTER_TYPE tyCharacter;
/*TYPE*/ /* Signed integer. */ typedef INTEGER_TYPE tyInteger;
/*TYPE*/ /* Signed real number. */ typedef REAL_TYPE tyReal;
/*TYPE*/ /* Standard return type of the basic C functions. */ typedef RETURN_TYPE tyReturn;
/*TYPE*/ /* Array of characters. */ typedef tyCharacter * tyString;
/*TYPE*/ /* Array of bytes. */ typedef tyByte * tyBinary;
/*TYPE*/ /* Pointer to object. */ typedef void * tyPointer;
/*TYPE*/ /* Pointer to function. */ typedef void (*tyFunction)(void);
/*TYPE*/ /* Universal pointer (i.e. to object or to function). */ type_union { tyPointer toObject; tyFunction toFunction; } tyUniversalPointer; //
/*TYPE*/ /* List of arguments of a function or a method. */ typedef va_list tyArgumentList;
/*TYPE*/ /* Type information. */ typedef TYPE_INFORMATION_TYPE clTypeInformation;
/*TYPE*/ /* Standard input/output class of the STL. */ typedef std::ios ios; //-----------------------------------------------------------------------------------Constant Types typedef const tyByte * tcBinary; typedef const tyBoolean tcBoolean; typedef const tyByte tcByte; typedef const tyCardinal tcCardinal; typedef const tyCharacter tcCharacter; typedef const tyInteger tcInteger; typedef const tyReal tcReal; typedef const tyCharacter * tcString;
typedef const clTypeInformation ctTypeInformation; }
namespace private_area {}
// Functions Interface //--------------------------------------------------------------------------- namespace public_area {} namespace private_area { testing_mode ( function void test(void); ) }
// Errors //---------------------------------------------------------------------------------------- namespace public_area {}
// Constants & Variables //------------------------------------------------------------------------- /*CONSTANT*/ /* Maximum byte value. */ extern_static_constant(public,tyByte,goByteMax,byteMax);
/*CONSTANT*/ /* Maximum cardinal value. */ extern_static_constant(public,tyCardinal,goCardinalMax,cardinalMax);
/*CONSTANT*/ /* Maximum character value. */ extern_static_constant(public,tyCharacter,goCharacterMax,characterMax);
/*CONSTANT*/ /* Minimum character value. */ extern_static_constant(public,tyCharacter,goCharacterMin,characterMin);
/*CONSTANT*/ /* Maximum integer value. */ extern_static_constant(public,tyInteger,goIntegerMax,integerMax);
/*CONSTANT*/ /* Minimum integer value. */ extern_static_constant(public,tyInteger,goIntegerMin,integerMin);
/*CONSTANT*/ /* Maximum real value. */ extern_static_constant(public,tyReal,goRealMax,realMax);
/*CONSTANT*/ /* Minimum real value. */ extern_static_constant(public,tyReal,goRealMin,realMin);
/*CONSTANT*/ /* Number of bytes to represent a boolean. */ extern_static_constant(public,tyCardinal,goBooleanSize,booleanSize);
/*CONSTANT*/ /* Number of bytes to represent a byte (always 1). */ extern_static_constant(public,tyCardinal,goByteSize,byteSize);
/*CONSTANT*/ /* Number of bytes to represent a cardinal. */ extern_static_constant(public,tyCardinal,goCardinalSize,cardinalSize);
/*CONSTANT*/ /* Number of bytes to represent a character. */ extern_static_constant(public,tyCardinal,goCharacterSize,characterSize);
/*CONSTANT*/ /* Number of bytes to represent an integer. */ extern_static_constant(public,tyCardinal,goIntegerSize,integerSize);
/*CONSTANT*/ /* Number of bytes to represent a real number. */ extern_static_constant(public,tyCardinal,goRealSize,realSize);
/*CONSTANT*/ /* Maximal decimal precision of a real number. */ extern_static_constant(public,tyCardinal,goRealDecimalPrecision,realDecimalPrecision);
/*CONSTANT*/ /* Maximum positive real value that is considered to be equal to zero. */ extern_static_constant(public,tyReal,goRealEpsilon,realEpsilon);
/*CONSTANT*/ /* Smallest positive real value that can be represented. */ extern_static_constant(public,tyReal,goRealSmallest,realSmallest);
// X X X Interface //------------------------------------------------------------------------------ namespace {}
// Functions Inline //------------------------------------------------------------------------------ namespace public_area {} namespace private_area {}
// X X X Inline //--------------------------------------------------------------------------------- namespace {}
// End //------------------------------------------------------------------------------------------- } #undef dll_export #undef public_area #undef private_area #endif |
//================================================================================================== // S t a n d a r d Implementation // T y p e // 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).
// File Name //------------------------------------------------------------------------------------- #line __LINE__ "standard/type.cpp"
// DLL Belonging //--------------------------------------------------------------------------------- #define STANDARD_DLL
// Headers //--------------------------------------------------------------------------------------- #include <cfloat> /*NEED*/ #include <climits> /*NEED*/ #include <bpp/standard/type.hpp> /*INTERFACE*/
namespace bpp {
// Namespaces //------------------------------------------------------------------------------------ #define public_area standardType #define private_area standardType_private #define dll_export DLL_EXPORT
namespace public_area {} namespace private_area {}
// Initialization //-------------------------------------------------------------------------------- #undef iniStandardType static_constant(private_area::clInitializer,goInitializer);
// Errors //---------------------------------------------------------------------------------------- namespace public_area {}
// Constants & Variables //------------------------------------------------------------------------- static_constant(tyByte,goByteMax); static_constant(tyCardinal,goCardinalMax); static_constant(tyCharacter,goCharacterMax); static_constant(tyCharacter,goCharacterMin); static_constant(tyInteger,goIntegerMax); static_constant(tyInteger,goIntegerMin); static_constant(tyReal,goRealMax); static_constant(tyReal,goRealMin);
static_constant(tyCardinal,goBooleanSize); static_constant(tyCardinal,goByteSize); static_constant(tyCardinal,goCardinalSize); static_constant(tyCardinal,goCharacterSize); static_constant(tyCardinal,goIntegerSize); static_constant(tyCardinal,goRealSize);
static_constant(tyCardinal,goRealDecimalPrecision); static_constant(tyReal,goRealEpsilon); static_constant(tyReal,goRealSmallest);
// Static Members //-------------------------------------------------------------------------------- namespace public_area {} namespace private_area {}
// Functions Implementation //---------------------------------------------------------------------- namespace public_area {} namespace private_area {}
// X X X Implementation //------------------------------------------------------------------------- namespace {}
// I n i t i a l i z e r Implementation //--------------------------------------------------------- namespace private_area { //--------------------------------------------------------------------------------------------Start property void clInitializer::start(void) { if (atCounter++ == 0) { #include <bpp/modules.hpp> /*NEED*/ registerStop(this);
goByteMax = BYTE_MAX; goCardinalMax = CARDINAL_MAX; goCharacterMax = CHARACTER_MAX; goCharacterMin = CHARACTER_MIN; goIntegerMax = INTEGER_MAX; goIntegerMin = INTEGER_MIN; goRealMax = REAL_MAX; goRealMin = REAL_MIN;
goBooleanSize = sizeof(tyBoolean); goByteSize = 1; goCardinalSize = sizeof(tyCardinal); goCharacterSize = sizeof(tyCharacter); goIntegerSize = sizeof(tyInteger); goRealSize = sizeof(tyReal);
goRealDecimalPrecision = REAL_DECIMAL_PRECISION; goRealEpsilon = REAL_EPSILON; goRealSmallest = REAL_SMALLEST; } } //---------------------------------------------------------------------------------------------Stop property void clInitializer::stop(void) {} }
// End //------------------------------------------------------------------------------------------- } |
|