Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | Related Pages | Examples

internal.h

00001 /*
00002   $Id: internal.h,v 1.7 2004/12/10 07:52:22 majo Exp $
00003 
00004   $Log: internal.h,v $
00005   Revision 1.7  2004/12/10 07:52:22  majo
00006   documentation update
00007   fastcall & wakref optimizations removed!!!
00008 
00009   Revision 1.5  2004/12/02 09:20:52  majo
00010   *patchlevel
00011 
00012   Revision 1.4  2004/03/25 17:38:40  majo
00013   fixed 16bit colors (FGMakeColor) and optimized FGColor::RecomputeValue()
00014 
00015   Revision 1.3  2004/03/17 21:19:12  majo
00016   added FGColor, FGImage
00017 
00018   Revision 1.2  2004/03/03 20:12:39  majo
00019   added class FGColor
00020   fixed Solaris compiling
00021 
00022   Revision 1.1.1.1  2004/01/22 16:25:08  majo
00023   initial release
00024 
00025 */
00026 
00027 #undef NONAMELESSUNION
00028 
00029 #include <string.h>
00030 #include <math.h>
00031 #include <stdlib.h>
00032 #include <assert.h>
00033 #include <stdio.h>
00034 #include <ctype.h>
00035 #include <time.h>
00036 
00037 #ifdef _WIN32
00038 #include <windows.h>
00039 #endif
00040 
00041 #ifndef FASTGL_BPP
00042 #ifdef BPP8
00043 #define FASTGL_BPP      8
00044 #endif
00045 
00046 #ifdef BPP15
00047 #define FASTGL_BPP      15
00048 #endif
00049 
00050 #ifdef BPP16
00051 #define FASTGL_BPP      16
00052 #endif
00053 
00054 #ifdef BPP32
00055 #define FASTGL_BPP      32
00056 #endif
00057 #endif // FASTGL_BPP
00058 
00059 // as default
00060 #ifndef FASTGL_BPP
00061 #define FASTGL_BPP  8
00062 #define BPP8
00063 #endif
00064 
00065 #if defined(__BORLANDC__) && defined(_WIN32)
00066 #include <alloc.h>
00067 #include <_str.h>
00068 #elif defined(_MSC_VER)
00069 #else
00070 #include <unistd.h>
00071 #endif
00072 
00073 #ifndef TRUE
00074 #define TRUE   1
00075 #define FALSE  0
00076 #endif
00077 
00078 #ifndef M_PI
00079 #define M_PI    3.1415926
00080 #endif
00081 
00082 #ifdef __QNX__
00083 #include <signal.h>
00084 #include <process.h>
00085 #include <unistd.h>
00086 #undef Yield
00087 #endif // qnx
00088 
00089 #if defined(__sun__)
00090 #include <pthread.h>
00091 #endif
00092 
00093 #if defined(__linux__)
00094 #include <linux/version.h>
00095 #include <pthread.h>
00096 #define PTHREAD_MUTEX_NORMAL    PTHREAD_MUTEX_TIMED_NP
00097 #define PTHREAD_MUTEX_RECURSIVE PTHREAD_MUTEX_RECURSIVE_NP
00098 #ifdef __BORLANDC__
00099 #pragma link "libpthread.so"
00100 #endif
00101 #endif // linux
00102 
00103 #ifdef __DJGPP__
00104 #include <dpmi.h>
00105 #endif // djgpp
00106 
00107 // force link
00108 #ifdef __BORLANDC__
00109 #ifndef INTO_FGL
00110 #ifndef __linux__
00111 #if (FASTGL_BPP == 8)
00112     #pragma link "fgl.lib"
00113 #elif (FASTGL_BPP == 15 || FASTGL_BPP == 16)
00114     #pragma link "fgl16.lib"
00115 #elif (FASTGL_BPP == 32)
00116     #pragma link "fgl32.lib"
00117 #endif
00118 
00119 #else   // LINUX libs
00120 
00121 #if (FASTGL_BPP == 8)
00122     #pragma link "fgl.a"
00123 #elif (FASTGL_BPP == 15 || FASTGL_BPP == 16)
00124     #pragma link "fgl16.a"
00125 #elif (FASTGL_BPP == 32)
00126     #pragma link "fgl32.a"
00127 #endif
00128 #endif // INTO_FGL
00129 #endif // __linux__
00130 
00131 #ifdef __linux__
00132 #ifdef X11_DRIVER
00133 #pragma link "libX11.so"
00134 #pragma link "libXext.so"
00135 #ifdef DGA_DRIVER
00136 #pragma link "libXxf86dga.a"
00137 #endif
00138 #endif
00139 
00140 #endif // __linux__
00141 #endif // __borlandc__
00142 
00143 #ifdef __WATCOMC__
00144 #include <i86.h>
00145 #ifndef __SW_3S
00146 #error "you must use stack call conventions! (-3s)"
00147 #endif
00148 // this line force linker to linking with fgl.lib implicitly
00149 #if (FASTGL_BPP == 8)
00150     #pragma library (fgl)
00151 #elif (FASTGL_BPP == 15 || FASTGL_BPP == 16)
00152     #pragma library (fgl16)
00153 #elif (FASTGL_BPP == 32)
00154     #pragma library (fgl32)
00155 #endif
00156 #endif  // watcom
00157 
00158 // for WATCOM & DOS
00159 #ifdef __DOS__
00160 #define __MSDOS__
00161 #endif // dos
00162 
00163 #if (FASTGL_BPP==8)
00164 #define INDEX_COLORS
00165 
00166 #elif (FASTGL_BPP==15)
00167 #define DIRECT_COLORS   15
00168 #define FGDirectColor(rgb) (((rgb&0xF80000)>>9) | ((rgb&0xF800)>>6) | ((rgb&0xF8)>>3))
00169 #define FGMakeColor(r,g,b) (((r&0xf8)<<7)|((g&0xf8)<<3)|(b&0xf8)>>3)
00170 #define ExpandColor(rgb) (((rgb<<9)&0xF80000) | ((rgb<<6)&0xF800) | ((rgb<<3)&0xF8))
00171 #define kBlueComponent(pix) ((pix<<3)&0xf8)
00172 #define kGreenComponent(pix) ((pix>>2)&0xf8)
00173 #define kRedComponent(pix) ((pix>>7)&0xf8)
00174 
00175 #elif (FASTGL_BPP==16)
00176 #define DIRECT_COLORS   16
00177 #define FGDirectColor(rgb) (((rgb&0xF80000)>>8) | ((rgb&0xFc00)>>5) | ((rgb&0xF8)>>3))
00178 #define FGMakeColor(r,g,b) (((r&0xf8)<<8)|((g&0xfc)<<3)|(b&0xf8)>>3)
00179 #define ExpandColor(rgb) (((rgb<<8)&0xF80000) | ((rgb<<5)&0xFc00) | ((rgb<<3)&0xF8))
00180 #define kBlueComponent(pix) ((pix<<3)&0xf8)
00181 #define kGreenComponent(pix) ((pix>>3)&0xfc)
00182 #define kRedComponent(pix) ((pix>>8)&0xf8)
00183 
00184 #elif (FASTGL_BPP==32)
00185 #define TRUE_COLORS
00186 #define FGDirectColor
00187 #define FGMakeColor(r,g,b) ((r<<16)|(g<<8)|(b))
00188 #define ExpandColor
00189 #define kBlueComponent(pix) (pix&0xff)
00190 #define kGreenComponent(pix) ((pix>>8)&0xff)
00191 #define kRedComponent(pix) ((pix>>16)&0xff)
00192 #endif // fastgl_bpp
00193 
00194 #ifdef _WIN32
00195 #define PRTRSC  F12
00196 #define BACKSP  0x8
00197 #define KUP     0x126
00198 #define KDOWN   0x128
00199 #define KRIGHT  0x127
00200 #define KLEFT   0x125
00201 
00202 #define INSERT  0x12d
00203 #define DEL     0x12e
00204 #define HOME    0x124
00205 #define END     0x123
00206 #define PGUP    0x121
00207 #define PGDOWN  0x122
00208 
00209 #define ALT_A   0x1061
00210 #define ALT_B   (ALT_A+1)
00211 #define ALT_C   (ALT_A+2)
00212 #define ALT_D   (ALT_A+3)
00213 #define ALT_E   (ALT_A+4)
00214 #define ALT_F   (ALT_A+5)
00215 #define ALT_G   (ALT_A+6)
00216 #define ALT_H   (ALT_A+7)
00217 #define ALT_I   (ALT_A+8)
00218 #define ALT_J   (ALT_A+9)
00219 #define ALT_K   (ALT_A+10)
00220 #define ALT_L   (ALT_A+11)
00221 #define ALT_M   (ALT_A+12)
00222 #define ALT_N   (ALT_A+13)
00223 #define ALT_O   (ALT_A+14)
00224 #define ALT_P   (ALT_A+15)
00225 #define ALT_Q   (ALT_A+16)
00226 #define ALT_R   (ALT_A+17)
00227 #define ALT_S   (ALT_A+18)
00228 #define ALT_T   (ALT_A+19)
00229 #define ALT_U   (ALT_A+20)
00230 #define ALT_V   (ALT_A+21)
00231 #define ALT_W   (ALT_A+22)
00232 #define ALT_X   (ALT_A+23)
00233 #define ALT_Y   (ALT_A+24)
00234 #define ALT_Z   (ALT_A+25)
00235 
00236 #define F01     0x270
00237 #define F02     (F01+1)
00238 #define F03     (F01+2)
00239 #define F04     (F01+3)
00240 #define F05     (F01+4)
00241 #define F06     (F01+5)
00242 #define F07     (F01+6)
00243 #define F08     (F01+7)
00244 #define F09     (F01+8)
00245 #define F10     (F01+9)
00246 #define F11     (F01+10)
00247 #define F12     (F01+11)
00248 
00249 #define ALT_F01     0x1201
00250 #define ALT_F02     0x1202
00251 #define ALT_F03     0x1203
00252 #define ALT_F04     0x1204
00253 #define ALT_F05     0x1205
00254 #define ALT_F06     0x1206
00255 #define ALT_F07     0x1207
00256 #define ALT_F08     0x1208
00257 #define ALT_F09     0x1209
00258 #define ALT_F10     0x120a
00259 #define ALT_F11     0x120b
00260 #define ALT_F12     0x120c
00261 
00262 #define CTRL_F01        0x401
00263 #define CTRL_F02        0x402
00264 #define CTRL_F03        0x403
00265 #define CTRL_F04        0x404
00266 #define CTRL_F05        0x405
00267 #define CTRL_F06        0x406
00268 #define CTRL_F07        0x407
00269 #define CTRL_F08        0x408
00270 #define CTRL_F09        0x409
00271 #define CTRL_F10        0x40a
00272 #define CTRL_F11        0x40b
00273 #define CTRL_F12        0x40c
00274 
00275 #define ALT_UP      (KUP+0x1000)
00276 #define ALT_DOWN    (KDOWN+0x1000)
00277 #define ALT_RIGHT   (KRIGHT+0x1000)
00278 #define ALT_LEFT    (KLEFT+0x1000)
00279 
00280 #define ALT_TAB         4105
00281 #define ALT_INSERT      4642
00282 #define ALT_DEL         4223
00283 #define ALT_HOME        4664
00284 #define ALT_END         4665
00285 #define ALT_PGUP        4662
00286 #define ALT_PGDOWN      4663
00287 
00288 #define CTRL_UP     (KUP+0x100)
00289 #define CTRL_DOWN   (KDOWN+0x100)
00290 #define CTRL_RIGHT  (KRIGHT+0x100)
00291 #define CTRL_LEFT   (KLEFT+0x100)
00292 
00293 #define CTRL_TAB        0xFFF
00294 #define CTRL_INSERT     802
00295 #define CTRL_DEL        0x7F
00296 #define CTRL_HOME       824
00297 #define CTRL_END        825
00298 #define CTRL_PGUP   (PGUP+0x100)
00299 #define CTRL_PGDOWN (PGDOWN+0x100)
00300 #endif
00301 
00302 #if defined( __linux__ ) || defined( __rtems__ ) || defined(__sun__)
00303 #define PRTRSC  0x20e
00304 #define BACKSP      0x8
00305 #define KUP     0x232
00306 #define KDOWN   0x233
00307 #define KRIGHT  0x235
00308 #define KLEFT   0x234
00309 
00310 #define INSERT  0x222
00311 #define DEL     0x7F
00312 #define HOME        0x238
00313 #define END     0x239
00314 #define PGUP    0x236
00315 #define PGDOWN  0x237
00316 
00317 #define ALT_A   0x1061
00318 #define ALT_B   (ALT_A+1)
00319 #define ALT_C   (ALT_A+2)
00320 #define ALT_D   (ALT_A+3)
00321 #define ALT_E   (ALT_A+4)
00322 #define ALT_F   (ALT_A+5)
00323 #define ALT_G   (ALT_A+6)
00324 #define ALT_H   (ALT_A+7)
00325 #define ALT_I   (ALT_A+8)
00326 #define ALT_J   (ALT_A+9)
00327 #define ALT_K   (ALT_A+10)
00328 #define ALT_L   (ALT_A+11)
00329 #define ALT_M   (ALT_A+12)
00330 #define ALT_N   (ALT_A+13)
00331 #define ALT_O   (ALT_A+14)
00332 #define ALT_P   (ALT_A+15)
00333 #define ALT_Q   (ALT_A+16)
00334 #define ALT_R   (ALT_A+17)
00335 #define ALT_S   (ALT_A+18)
00336 #define ALT_T   (ALT_A+19)
00337 #define ALT_U   (ALT_A+20)
00338 #define ALT_V   (ALT_A+21)
00339 #define ALT_W   (ALT_A+22)
00340 #define ALT_X   (ALT_A+23)
00341 #define ALT_Y   (ALT_A+24)
00342 #define ALT_Z   (ALT_A+25)
00343 
00344 #define F01     0x301
00345 #define F02     (F01+1)
00346 #define F03     (F01+2)
00347 #define F04     (F01+3)
00348 #define F05     (F01+4)
00349 #define F06     (F01+5)
00350 #define F07     (F01+6)
00351 #define F08     (F01+7)
00352 #define F09     (F01+8)
00353 #define F10     (F01+9)
00354 #define F11     (F01+10)
00355 #define F12     (F01+11)
00356 
00357 #define ALT_F01     0x1201
00358 #define ALT_F02     0x1202
00359 #define ALT_F03     0x1203
00360 #define ALT_F04     0x1204
00361 #define ALT_F05     0x1205
00362 #define ALT_F06     0x1206
00363 #define ALT_F07     0x1207
00364 #define ALT_F08     0x1208
00365 #define ALT_F09     0x1209
00366 #define ALT_F10     0x120a
00367 #define ALT_F11     0x120b
00368 #define ALT_F12     0x120c
00369 
00370 #define CTRL_F01        0x401
00371 #define CTRL_F02        0x402
00372 #define CTRL_F03        0x403
00373 #define CTRL_F04        0x404
00374 #define CTRL_F05        0x405
00375 #define CTRL_F06        0x406
00376 #define CTRL_F07        0x407
00377 #define CTRL_F08        0x408
00378 #define CTRL_F09        0x409
00379 #define CTRL_F10        0x40a
00380 #define CTRL_F11        0x40b
00381 #define CTRL_F12        0x40c
00382 
00383 #define ALT_UP      (KUP+0x1000)
00384 #define ALT_DOWN    (KDOWN+0x1000)
00385 #define ALT_RIGHT   (KRIGHT+0x1000)
00386 #define ALT_LEFT    (KLEFT+0x1000)
00387 
00388 #define ALT_TAB         4105
00389 #define ALT_INSERT      4642
00390 #define ALT_DEL         4223
00391 #define ALT_HOME        4664
00392 #define ALT_END         4665
00393 #define ALT_PGUP        4662
00394 #define ALT_PGDOWN      4663
00395 
00396 #define CTRL_UP     (KUP+0x100)
00397 #define CTRL_DOWN   (KDOWN+0x100)
00398 #define CTRL_RIGHT  (KRIGHT+0x100)
00399 #define CTRL_LEFT   (KLEFT+0x100)
00400 
00401 #define CTRL_TAB        0xFFF
00402 #define CTRL_INSERT     802
00403 #define CTRL_DEL        0x7F
00404 #define CTRL_HOME       824
00405 #define CTRL_END        825
00406 #define CTRL_PGUP   (PGUP+0x100)
00407 #define CTRL_PGDOWN (PGDOWN+0x100)
00408 #endif //linux
00409 
00410 #define CTRL_A  1
00411 #define CTRL_B  2
00412 #define CTRL_C  3
00413 #define CTRL_D  4
00414 #define CTRL_E  5
00415 #define CTRL_F  6
00416 #define CTRL_G  7
00417 #define CTRL_H  8
00418 #define CTRL_I  9
00419 #define CTRL_J  10
00420 #define CTRL_K  11
00421 #define CTRL_L  12
00422 #define CTRL_M  13
00423 #define CTRL_N  14
00424 #define CTRL_O  15
00425 #define CTRL_P  16
00426 #define CTRL_Q  17
00427 #define CTRL_R  18
00428 #define CTRL_S  19
00429 #define CTRL_T  20
00430 #define CTRL_U  21
00431 #define CTRL_V  22
00432 #define CTRL_W  23
00433 #define CTRL_X  24
00434 #define CTRL_Y  25
00435 #define CTRL_Z  26
00436 
00437 /*
00438 #if (((__GNUC__<<16) + (__GNUC_MINOR__ <<8) + (__GNUC_PATCHLEVEL__)) >= 0x030201)
00439 #define HIDDEN __attribute__ ((weak))
00440 #else
00441 #define HIDDEN
00442 #endif
00443 */
00444 
00445 #define HIDDEN
00446 
00447 /*
00448 #ifdef __BORLANDC__
00449 #define FGAPI   __fastcall
00450 #define APISTR "__fastcall"
00451 #elif  __GNUC__
00452 #define FGAPI   __attribute__ ((regparm(3)))
00453 #define APISTR "__attribute__ ((regparm(3)))"
00454 #endif
00455 */
00456 
00457 #ifndef FGAPI
00458 #define FGAPI
00459 #define APISTR ""
00460 #endif

Generated on Wed Feb 9 11:31:35 2005 for OpenGUI by  doxygen 1.4.0