misc.h

Go to the documentation of this file.
00001 
00005 /*
00006     This file is part of Advanced Strategic Command; http://www.asc-hq.de
00007     Copyright (C) 1994-2010  Martin Bickel  and  Marc Schellenberger
00008 
00009     This program is free software; you can redistribute it and/or modify
00010     it under the terms of the GNU General Public License as published by
00011     the Free Software Foundation; either version 2 of the License, or
00012     (at your option) any later version.
00013 
00014     This program is distributed in the hope that it will be useful,
00015     but WITHOUT ANY WARRANTY; without even the implied warranty of
00016     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017     GNU General Public License for more details.
00018 
00019     You should have received a copy of the GNU General Public License
00020     along with this program; see the file COPYING. If not, write to the
00021     Free Software Foundation, Inc., 59 Temple Place, Suite 330,
00022     Boston, MA  02111-1307  USA
00023 */
00024 
00025 
00026 
00027 #ifndef miscH
00028    #define miscH
00029 
00030    #include "global.h"
00031    #include <string>
00032 
00033    #define dblue lightgray
00034    //153
00035    
00036 
00038    extern int getFirstBit(int i);
00039 
00040   
00041    extern const char* digit[] ; 
00042    extern const char* letter[] ;
00043 
00047    extern char* strrr ( int a ) ;
00048    // extern char* strrr ( Uint32 a );
00049 
00053    extern char* strrr ( double a ) ;
00054 
00055    extern int  crc32buf( const void *vbuf, int len);
00056    
00057    extern int atoi ( const std::string& s );
00058    extern double atof ( const std::string& s );
00059 
00060 #ifdef min
00061 #undef min
00062 #endif
00063 
00064 #ifdef max
00065 #undef max
00066 #endif
00067 
00068 /*
00069 template<typename T>
00070 T min ( T a, T b )
00071 {
00072    if ( a > b )
00073       return b;
00074    else
00075       return a;
00076 }
00077 */
00078 
00079 template<typename T>
00080 const T& min ( const T& a, const T& b, const T&  c )
00081 {
00082    return min ( a, min ( b, c ));
00083 }
00084 
00085 /*
00086 template<typename T>
00087 T max ( T a, T b )
00088 {
00089    if ( a > b )
00090       return a;
00091    else
00092       return b;
00093 }
00094 */
00095 
00096 template<typename T>
00097 const T& max ( const T& a, const T& b, const T& c )
00098 {
00099    return max ( a, max ( b, c ));
00100 }
00101 
00102 
00103    extern char *strupr (const char *a);
00104 
00105   #ifndef HAVE_ITOA
00106    extern char* itoa ( int a, char* b, int c);
00107   #endif
00108 
00109 #endif

Generated on Mon May 21 01:26:35 2012 for Advanced Strategic Command by  doxygen 1.5.1