Crossfire Client, Trunk  R18666
/home/leaf/crossfire/client/trunk/common/client-types.h
Go to the documentation of this file.
00001 /*
00002  * static char *rcsid_common_client_types_h =
00003  *   "$Id: client-types.h 13273 2010-05-20 13:40:07Z cavesomething $";
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 
00032 #ifndef CLIENT_TYPES_H
00033 #define CLIENT_TYPES_H
00034 #include <cconfig.h>
00035 
00036 
00037 /* If using autoconf, use it to pick up the necessary files.  Otherwise,
00038  * we will draw on includes.h
00039  */
00040 #include <config.h>
00041 #include <stdio.h>
00042 #include <stdlib.h>
00043 #include <sys/types.h>
00044 
00045 #ifdef HAVE_SYS_TIME_H
00046 #   include <sys/time.h>
00047 #endif
00048 
00049 #include <time.h>
00050 
00051 #ifdef HAVE_STRING_H
00052 #   include <string.h>
00053 #endif
00054 
00055 #ifdef HAVE_UNISTD_H
00056 #   include <unistd.h>
00057 #endif
00058 
00059 #ifdef HAVE_FCNTL_H
00060 #  include <fcntl.h>
00061 #endif
00062 
00063 #ifdef WIN32
00064 #  include <winsock2.h>
00065 #endif
00066 
00067 #ifdef HAVE_PTHREAD_H
00068 #  include <pthread.h>
00069 #endif
00070 
00071 /* Just some handy ones I like to use */
00072 #ifndef FALSE
00073 #define FALSE 0
00074 #endif
00075 #ifndef TRUE
00076 #define TRUE 1
00077 #endif
00078 
00079 #ifndef WIN32
00080 
00081 /* Set of common types used through the program and modules */
00082 typedef unsigned int    uint32;
00083 typedef signed int      sint32;
00084 typedef unsigned short  uint16;
00085 typedef signed short    sint16;
00086 typedef unsigned char   uint8;
00087 typedef signed char     sint8;
00088 
00089 #if SIZEOF_LONG == 8
00090 typedef unsigned long       uint64;
00091 typedef signed long         sint64;
00092 #define FMT64               "ld"
00093 #define FMT64U              "ld"
00094 #elif SIZEOF_LONG_LONG == 8
00095 typedef unsigned long long      uint64;
00096 typedef signed long long        sint64;
00097 #define FMT64               "lld"
00098 #define FMT64U              "lld"
00099 #else
00100 #error do not know how to get a 64 bit value on this system.
00101 #error correct and send mail to crossfire-devel on how to do this.
00102 #endif
00103 
00104 #else
00105 /* Windows specific defines */
00106 
00107 typedef unsigned __int64    uint64;
00108 typedef signed __int64      sint64;
00109 typedef unsigned __int32    uint32;
00110 typedef signed __int32      sint32;
00111 typedef unsigned __int16    uint16;
00112 typedef signed __int16      sint16;
00113 typedef unsigned char     uint8;
00114 typedef signed char       sint8;
00115 #define FMT64               "I64d"
00116 #define FMT64U              "I64u"
00117 
00118 /* mingw defines rand and srand only */
00119 #ifndef random
00120 #define random rand
00121 #endif
00122 #ifndef srandom
00123 #define srandom srand
00124 #endif
00125 
00126 #ifndef sleep
00127 #define sleep(x) Sleep((x)*1000)
00128 #endif
00129 
00130 #endif
00131 
00132 #ifndef SOL_TCP
00133 #define SOL_TCP IPPROTO_TCP
00134 #endif
00135 
00136 
00137 #define MAX_BUF 256
00138 #define BIG_BUF 1024
00139 
00140 /* used to register gui callbacks to extended texts
00141  * (which are supposed to be handled more friendly than raw text)*/
00142 typedef void (*ExtTextManager)(int flag, int type, int subtype, char* message);
00143 
00144 typedef struct TextManager{
00145     int type;
00146     ExtTextManager callback;
00147     struct TextManager* next;
00148 } TextManager;
00149 
00150 #endif