Lhogho  0.0.028
 All Data Structures Files Functions Variables Typedefs Macros Pages
error.h
Go to the documentation of this file.
1 //===================================================
2 // Project:TestSystem Author: Peter Armianov
3 //===================================================
4 //
5 // ERROR.H
6 //
7 // This file contains error codes for the system
8 //
9 // Revision history:
10 // 2007-05-14 - file created
11 // 2007-07-12 - additional comments in Doxygen style
12 //===================================================
13 
14 #if defined(_MSC_VER)
15 # pragma once
16 #endif
17 
18 #ifndef __ERROR_H_EF982CFB_9F07_4AD5_888A_BFF8566F6DD6_INCLUDED
19 #define __ERROR_H_EF982CFB_9F07_4AD5_888A_BFF8566F6DD6_INCLUDED
20 
21 #define ERROR_FLAG 0x80000000
22 
23 
24 //===================================================
28 //===================================================
30 #define MAKE_ERROR(X) (ERROR_FLAG | X)
31 #define MAKE_SUCCESS(X) (X & (~ERROR_FLAG))
32 #define IS_ERROR(X) (!!(X & ERROR_FLAG))
33 #define IS_SUCCESS(X) (!(X & ERROR_FLAG))
34 #define GET_CODE(X) (X & (~ERROR_FLAG))
35 
37 //===================================================
39 //===================================================
41 #define CODE_GENERIC 0x0000
42 #define CODE_INVALID_ARG 0x0001
43 #define CODE_FILE 0x0002
44 #define CODE_NOT_IMPL 0x0003
45 #define CODE_MEMORY 0x0004
46 #define CODE_EMPTY 0x0005
47 
49 #define SUCCESS_FULL MAKE_SUCCESS(CODE_GENERIC)
50 #define SUCCESS_EMPTY MAKE_SUCCESS(CODE_EMPTY)
51 #define SUCCESS_FILE MAKE_SUCCESS(CODE_FILE)
52 
53 #define ERR_GENERIC MAKE_ERROR(CODE_GENERIC)
54 #define ERR_INVALID_ARG MAKE_ERROR(CODE_INVALID_ARG)
55 #define ERR_FILE MAKE_ERROR(CODE_FILE)
56 #define ERR_NOT_IMPL MAKE_ERROR(CODE_NOT_IMPL)
57 #define ERR_MEMORY MAKE_ERROR(CODE_MEMORY)
58 
59 #define RESULT UINT32
60 
61 //===================================================
64 //===================================================
66 #ifdef LOG_STDERR
67 # define INIT_LOGER
68 # define LOG_ERROR(X) fprintf(stderr, "%s - %s : %s\n",__FILE__, __LINE__, X);
69 # define UNINIT_LOGER
70 #else
71 # define INIT_LOGER
72 # define LOG_ERROR(X)
73 # define UNINIT_LOGER
74 #endif
75 
77 
78 #endif /* __ERROR_H_EF982CFB_9F07_4AD5_888A_BFF8566F6DD6_INCLUDED */
79 

[ HOME | INDEX | ATOMS | VARS | REFERENCE ]
Lhogho Developer's Documentation
Wed Jul 10 2013