home *** CD-ROM | disk | FTP | other *** search
/ Programming Win32 Under the API / ProgrammingWin32UnderTheApiPatVillani.iso / pedasm.zip / Globals.h < prev    next >
C/C++ Source or Header  |  1998-10-23  |  3KB  |  87 lines

  1. /*        fichier Globals.h : fichier header
  2.  *
  3.  *    descr : constantes et fct de portee global au projet
  4.  *
  5.  *    projet : PEDasm
  6.  *    
  7.  *    rq:
  8.  *    Ce programme est libre de droits. Il peut etre distribue et/ou modifie
  9.  *  selon les termes de la licence 'GNU General Public License version 2'.
  10.  *    
  11.  *    Ce programme est distribue sans aucunes garanties, y compris d'utilite 
  12.  *    ni de risques encouru, quelle que soit son utilisation.
  13.  *
  14.  *    lire le fichier licence.txt fourni ou bien ecrire a :
  15.  *    the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  16.  *    pour recevoir une copie de la licence.
  17.  *
  18.  *    Copyright (C) 1997 - 1998 Nicolas Witczak <witczak@geocities.com>
  19.  */
  20.  
  21. #ifndef GLOBALS_H
  22.     #define GLOBALS_H
  23.  
  24. #include <cstdlib>
  25. #include <cstdio>
  26. #include <functional>
  27. #include <string>
  28.  
  29.  
  30. /////////////////////////////////////////////////////////////////////////
  31. /** type buffer assez grand */
  32. typedef char char_buff[128] ;
  33.  
  34. /////////////////////////////////////////////////////////////////////////
  35. // separateurs utilises ds les fichiers de sortie
  36.  
  37. extern const char* cteHeaderSep;
  38. extern const char* cteHeaderStLine ;
  39. extern const char* ctePartSep ;
  40. extern const char* ctePartStLine ;
  41.  
  42. ////////////////////////////////////////////////////////////////////////
  43. // macro d'aide
  44. /** definie une cte 8 bit binaire */
  45. #define BIN_CTE(a7,a6,a5,a4,a3,a2,a1,a0)    \
  46.     ( (a7 * 128 ) + (a6 * 64) + (a5 * 32) + (a4 * 16) + ( a3 * 8 )+ ( a2 * 4 )+ ( a1 * 2 ) + a0 )
  47.  
  48.  
  49. //////////////////////////////////////////////////////////////////
  50. // fonctions globales
  51.  
  52. /** RoundUp : retourne iOldVal arrondi tq iOldVal >= n * iGranularity 
  53.  */
  54. unsigned int RoundUp( unsigned int iOldVal , unsigned  int iGranularity ) ;
  55.  
  56. /** GetFileSize : retourne la taille d'un fichier en nbr d'octets
  57.  */
  58. unsigned int GetFileSize( const char* pszFileName ) ;
  59.  
  60. /** StrDup : duplique une chaine : retourne  un buffer a effacer avec delete
  61.  */
  62. char* StrDup( const char* pszSrc );
  63.  
  64. /** GetBaseName : retourne un nom sans extension */
  65. const char* GetBaseName( const char* pszStr );
  66.  
  67.  
  68. /////////////////////////////////////////////////////////////////////////
  69. // objets fonctionnels
  70.  
  71.     //////////////////////////////////////////////////////////////
  72.     // objet fonctionnel de comparaison de chaine de caracteres (par valeur)
  73.  
  74. struct psz_less : public binary_function< const char* , const char* , bool>
  75. {
  76.     bool operator()( const char* x , const char* y) const
  77.     {    return ( strcmp( x, y ) < 0 ) ; } ;
  78. };
  79.  
  80. struct psz_less_nocase : public binary_function< const char* , const char* , bool>
  81. {
  82.     bool operator()( const char* x , const char* y) const
  83.     {    return ( stricmp( x, y ) < 0 ) ; } ;
  84. };
  85.  
  86.  
  87. #endif //GLOBALS_H