www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

types.h (1231B)


      1 #ifndef TYPES_H
      2 #define TYPES_H
      3 
      4 /* Types simples */
      5 typedef unsigned char uint8;
      6 typedef unsigned short uint16;
      7 typedef unsigned int uint32;
      8 typedef unsigned long long uint64;
      9 
     10 typedef int int32;
     11 
     12 typedef enum {
     13 	TRUE = 1,
     14 	FALSE = 0
     15 } bool;
     16 
     17 
     18 /* Types composés */
     19 #define CAST_STRUCT_TO_INT(_struct) (*((int*)((void*)(&_struct))))
     20 #define CAST_INT_TO_STRUCT(_int, _struct_t) (*((_struct_t*)((void*)(&_int))))
     21 
     22 typedef struct Liste {
     23 	void* car;
     24 	struct Liste* cdr;
     25 } Liste;
     26 
     27 typedef char* String;
     28 typedef String StringZ;
     29 
     30 #define LONGUEUR(t) (sizeof (t) / sizeof (*(t)))
     31 
     32 
     33 /* Attributs */
     34 #define ALIGNED(alignement) __attribute__ ((aligned(alignement)))
     35 #define PACKED __attribute__ ((packed))
     36 #define USED __attribute__ ((used))
     37 #define SECTION(sec) __attribute__ ((section(#sec)))
     38 
     39 
     40 /* Constantes */
     41 #define NULL (void*)0
     42 
     43 
     44 /* Prototypes de fonctions */
     45 
     46 /*                Comparaison  ComparaisonStricte
     47  * a < b : return <0           <0
     48  * a = b : return peu importe  =0
     49  * a > b : return >=0          >0 */
     50 typedef int (Comparaison)(void* a, void* b);
     51 
     52 typedef Comparaison ComparaisonStricte;
     53 
     54 typedef void* (AccesseurIndex)(void* t, uint32 index);
     55 
     56 typedef void (AccesseurEchanger)(void* t, uint32 a, uint32 b);
     57 
     58 
     59 #endif