Pipeline graphique
 Tout Structures de données Espaces de nommage Fichiers Fonctions Variables Définitions de type Énumérations Valeurs énumérées Macros
defUtil.h
Aller à la documentation de ce fichier.
1 #ifndef _DEF_UTIL
2 #define _DEF_UTIL
3 #include <stdlib.h>
4 #include <stdio.h>
5 #include <utility>
6 #include "defTypes.h"
7 
8 #define SAFE_DELETE(x) { if ((x)!=NULL) { delete (x); x=NULL; } }
9 #define SAFE_DELETE_ARRAY(x) { if ((x)!=NULL) { delete [] (x); x=NULL; } }
10 
11 // error codes
12 typedef unsigned int ErrCode;
13 const unsigned int error = 0;
14 const unsigned int success = !error;
15 
16 void WriteConsole(const char *fmt, ...);
17 #define FATAL_ERROR(msg) { printf("%s:%s\n",__FUNCTION__,msg); getchar(); exit(-1); }
18 /*
19 #if defined(linux) || defined(__CYGWIN__)
20 #define ERROR(why, fmt) { printf("Error (%s:%s line %d) : %s (" fmt ")\n", __FILE__, __FUNCTION__, __LINE__, why); exit(-1); }
21 #define WARNING(why, fmt) { printf("Warning (%s:%s line %d) : %s (" fmt ")\n", __FILE__, __FUNCTION__, __LINE__, why); }
22 #else
23 */
24 #define ERROR(why, fmt, ...) { printf("Error (%s:%s line %d) : %s (" fmt ")\n", __FILE__, __FUNCTION__, __LINE__, why,__VA_ARGS__ ); exit(-1); }
25 #define WARNING(why, fmt, ...) { printf("Warning (%s:%s line %d) : %s (" fmt ")\n", __FILE__, __FUNCTION__, __LINE__, why,__VA_ARGS__ ); }
26 //#endif
27 
28 #define swap(a,b,c) { c=a; a=b; b=c; }
29 #define min(a,b) ( (a)<(b) ? (a):(b) )
30 #define max(a,b) ( (a)>(b) ? (a):(b) )
31 
32 // color
33 struct color { uchar r,g,b,a; };
34 struct rgb { uchar r,g,b; };
35 
36 const color
37  black={0x00,0x00,0x00,0xff}, cyan ={0x00,0xff,0xff,0xff},
38  red ={0xff,0x00,0x00,0xff}, magenta={0xff,0x00,0xff,0xff},
39  green={0x00,0xff,0x00,0xff}, yellow ={0xff,0xff,0xff,0xff},
40  blue ={0x00,0x00,0xff,0xff}, white ={0xff,0xff,0xff,0xff};
41 
42 
43 #endif
uchar r
Definition: defUtil.h:33
const color black
Definition: defUtil.h:37
const color blue
Definition: defUtil.h:40
uchar r
Definition: defUtil.h:34
Definition: pgm.h:5
byte g
Definition: pgm.h:5
const unsigned int error
Definition: defUtil.h:13
const color red
Definition: defUtil.h:38
uchar a
Definition: defUtil.h:33
const color yellow
Definition: defUtil.h:39
unsigned int ErrCode
Definition: defUtil.h:12
const color green
Definition: defUtil.h:39
const color cyan
Definition: defUtil.h:37
const unsigned int success
Definition: defUtil.h:14
byte b
Definition: pgm.h:5
void WriteConsole(const char *fmt,...)
unsigned char g
Definition: definition.h:61
unsigned char uchar
Definition: defTypes.h:5
const color white
Definition: defUtil.h:40
const color magenta
Definition: defUtil.h:38
unsigned char b
Definition: definition.h:61
Definition: definition.h:60