Crossfire Client, Branch  R11627
client-types.h
Go to the documentation of this file.
00001 /*
00002  * static char *rcsid_client_types_h =
00003  *   "$Id: client-types.h 11626 2009-04-04 12:41:46Z lalo $";
00004  */
00005 /*
00006     Crossfire client, a client program for the crossfire program.
00007 
00008     Copyright (C) 2001 Mark Wedel & Crossfire Development Team
00009 
00010     This program is free software; you can redistribute it and/or modify
00011     it under the terms of the GNU General Public License as published by
00012     the Free Software Foundation; either version 2 of the License, or
00013     (at your option) any later version.
00014 
00015     This program is distributed in the hope that it will be useful,
00016     but WITHOUT ANY WARRANTY; without even the implied warranty of
00017     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018     GNU General Public License for more details.
00019 
00020     You should have received a copy of the GNU General Public License
00021     along with this program; if not, write to the Free Software
00022     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00023 
00024     The author can be reached via e-mail to crossfire-devel@real-time.com
00025 */
00026 
00027 #ifndef CLIENT_TYPES_H
00028 #define CLIENT_TYPES_H
00029 #include <cconfig.h>
00030 
00031 
00032 /* If using autoconf, use it to pick up the necessary files.  Otherwise,
00033  * we will draw on includes.h
00034  */
00035 #include <config.h>
00036 #include <stdio.h>
00037 #include <stdlib.h>
00038 #include <sys/types.h>
00039 
00040 #ifdef HAVE_SYS_TIME_H
00041 #   include <sys/time.h>
00042 #endif
00043 
00044 #include <time.h>
00045 
00046 #ifdef HAVE_STRING_H
00047 #   include <string.h>
00048 #endif
00049 
00050 #ifdef HAVE_UNISTD_H
00051 #   include <unistd.h>
00052 #endif
00053 
00054 #ifdef HAVE_FCNTL_H
00055 #  include <fcntl.h>
00056 #endif
00057 
00058 #ifdef WIN32
00059 #  include <winsock2.h>
00060 #endif
00061 
00062 #ifdef HAVE_PTHREAD_H
00063 #  include <pthread.h>
00064 #endif
00065 
00066 /* Just some handy ones I like to use */
00067 #ifndef FALSE
00068 #define FALSE 0
00069 #endif
00070 #ifndef TRUE
00071 #define TRUE 1
00072 #endif
00073 
00074 #ifndef WIN32
00075 
00076 /* Set of common types used through the program and modules */
00077 typedef unsigned int    uint32;
00078 typedef signed int      sint32;
00079 typedef unsigned short  uint16;
00080 typedef signed short    sint16;
00081 typedef unsigned char   uint8;
00082 typedef signed char     sint8;
00083 
00084 #if SIZEOF_LONG == 8
00085 typedef unsigned long       uint64;
00086 typedef signed long         sint64;
00087 #define FMT64               "ld"
00088 #define FMT64U              "ld"
00089 #elif SIZEOF_LONG_LONG == 8
00090 typedef unsigned long long      uint64;
00091 typedef signed long long        sint64;
00092 #define FMT64               "lld"
00093 #define FMT64U              "lld"
00094 #else
00095 #error do not know how to get a 64 bit value on this system.
00096 #error correct and send mail to crossfire-devel on how to do this.
00097 #endif
00098 
00099 #else
00100 /* Windows specific defines */
00101 
00102 typedef unsigned __int64    uint64;
00103 typedef signed __int64      sint64;
00104 typedef unsigned __int32    uint32;
00105 typedef signed __int32      sint32;
00106 typedef unsigned __int16    uint16;
00107 typedef signed __int16      sint16;
00108 typedef unsigned char     uint8;
00109 typedef signed char       sint8;
00110 #define FMT64               "I64d"
00111 #define FMT64U              "I64u"
00112 
00113 /* mingw defines rand and srand only */
00114 #ifndef random
00115 #define random rand
00116 #endif
00117 #ifndef srandom
00118 #define srandom srand
00119 #endif
00120 
00121 #endif
00122 
00123 #ifndef SOL_TCP
00124 #define SOL_TCP IPPROTO_TCP
00125 #endif
00126 
00127 
00128 #define MAX_BUF 256
00129 #define BIG_BUF 1024
00130 
00131 /* used to register gui callbacks to extended texts
00132  * (which are supposed to be handled more friendly than raw text)*/
00133 typedef void (*ExtTextManager)(int flag, int type, int subtype, char* message);
00134 
00135 typedef struct TextManager{
00136     int type;
00137     ExtTextManager callback;
00138     struct TextManager* next;
00139 } TextManager;
00140 
00141 #endif