sprint 1-alpha
sprint/sysdef.h
Go to the documentation of this file.
00001 /******************************************************************************
00002 *   SPRINT::sysdef.h
00003 *
00004 *   Copyright (C) 2003-2011  Paolo Medici <www.pmx.it>
00005 *
00006 *  This library is free software; you can redistribute it and/or
00007 *  modify it under the terms of the GNU Lesser General Public
00008 *  License as published by the Free Software Foundation; either
00009 *  version 2.1 of the License, or (at your option) any later version.
00010 *
00011 *  This library is distributed in the hope that it will be useful,
00012 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014 *  Lesser General Public License for more details.
00015 *
00016 *  You should have received a copy of the GNU Lesser General Public
00017 *  License along with this library; if not, write to the Free Software
00018 *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
00019 *
00020 *******************************************************************************/
00021 
00022 
00027 #ifndef _SPRINT_SYSDEF_H
00028 #define _SPRINT_SYSDEF_H
00029 
00030 #include <sprint/platform.h>
00031 
00032 #include <cstring>      // strcmp
00033 
00034 // before in order to avoid winsock.h inclusion
00035 #include <sprint/network_headers.h>
00036 
00037 #include <sprint/unistd.h>
00038 
00039 // _cdecl and _stdcall
00040 #if !defined(WINCE) || !defined(WIN32) || (defined(__GNUC__) && defined(WIN32))
00041     #ifndef _cdecl
00042         #define _cdecl
00043     #endif
00044     #ifndef _stdcall
00045         #define _stdcall
00046     #endif
00047 #endif
00048 
00049 
00051 
00052 #ifndef DUMMYUNIONNAMEN
00053  #if defined(__cplusplus) || !defined(NONAMELESSUNION)
00054   #define DUMMYUNIONNAMEN(n)
00055  #else
00056   #define DUMMYUNIONNAMEN(n)      u##n
00057  #endif
00058 #endif
00059 
00060 #if defined(WIN32)
00061 /* ******************************* WINDOWS ************************* */
00062 
00063 #define DIRECTORY_SEP_CHAR      '\\'
00064 #define DIRECTORY_SEP_STR       "\\"
00065 
00066 #define my_error        WSAGetLastError()
00067 
00068 // convert from POSIX to MSVC
00069 #ifdef _MSC_VER
00070 // oldnames.lib
00071 # define strcasecmp     _stricmp
00072 # define strncasecmp _strnicmp
00073 #endif
00074 
00075 #elif defined(WINCE)
00076 /* ******************************* WINDOWSCE *********************** */
00077 
00078 #define DIRECTORY_SEP_CHAR      '\\'
00079 #define DIRECTORY_SEP_STR       "\\"
00080 
00081 /* **************************** UNIX/LINUX ************************* */
00082 #elif defined(LINUX)
00083 
00084 #define DIRECTORY_SEP_CHAR      '/'
00085 #define DIRECTORY_SEP_STR       "/"
00086 
00087 #define wvsprintf vsprintf
00088 #define wsprintf sprintf
00089 
00090 /* includere linux.c */
00091 #if defined __cplusplus
00092   extern "C" {
00093 #endif
00094 
00095 /* Extremely inefficient but portable POSIX getch(), see getch.c */
00096 int getch(void);
00097 int kbhit(void);
00098 
00099 /* windows conversion function */
00100 char * itoa(int, char *, int);
00101 char * ltoa(long, char *, int);
00102 char * ultoa(unsigned long, char *, int);
00103 
00104 #if defined __cplusplus
00105 }
00106 #endif // __cplusplus section
00107 
00108 // Sleep
00109 #define Sleep(x) usleep((x)*1000)
00110 
00111 #define my_error        errno
00112 
00113 #endif // __ linux
00114 
00115 // have minmax
00116 #if !defined(__cplusplus) && (defined (__GNUWIN32__) || defined (LINUX) )
00117 # include <sprint/minmax.h>
00118 #endif // min max
00119 
00121 #define MAKE_DWORD_ID(a,b,c,d)    (((a)<<24)+((b)<<16)+((c)<<8)+(d))
00122 
00123 #endif
00124 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines