OSDN Git Service

(LibGoblin)
[drdeamon64/drdeamon64.git] / include / drd64_error.h
1 /*DrDeAmOn64DrDeAmOn64DrDeAmOn64DrDeAmOn64DrDeAmOn64DrDeAmOn64DrDeAmOn64
2
3                          D r . D e a m o n  6 4
4                         for INTEL64(R), AMD64(R)
5         
6    Copyright(C) 2007-2009 Koine Yuusuke(koinec). All rights reserved.
7
8 Redistribution and use in source and binary forms, with or without
9 modification, are permitted provided that the following conditions are met:
10
11  1. Redistributions of source code must retain the above copyright notice,
12     this list of conditions and the following disclaimer.
13  2. Redistributions in binary form must reproduce the above copyright
14     notice, this list of conditions and the following disclaimer in the
15     documentation and/or other materials provided with the distribution.
16
17 THIS SOFTWARE IS PROVIDED BY Koine Yuusuke(koinec) ``AS IS'' AND ANY
18 EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20 DISCLAIMED. IN NO EVENT SHALL Koine Yuusuke(koinec) OR CONTRIBUTORS BE
21 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
27 OF THE POSSIBILITY OF SUCH DAMAGE.
28
29 DrDeAmOn64DrDeAmOn64DrDeAmOn64DrDeAmOn64DrDeAmOn64DrDeAmOn64DrDeAmOn64*/
30
31 /* File Info -----------------------------------------------------------
32 File: drd64_error.h
33 Function: Header 
34 Comment: 
35 ----------------------------------------------------------------------*/
36
37 #ifndef DRD64_HEADER_ERROR
38 #define DRD64_HEADER_ERROR
39
40 #include<time.h>
41 #include<sys/time.h>
42
43 #include"drd64_types.h"
44 #include"drd64_defines.h"
45
46 /*DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD
47
48  [Error] : Error Code
49    31 | xxxx xxxx | xxxx xxxx | xxxx xxxx | xxxx xxxx | 0
50       | AAAA RRRR | PPPP PPPP | 1111 1111 | 2222 2222 |
51      AAAA => Error Type Code
52      RRRR => Reserved. 
53      PPPP => Error Pattern     
54      1111 => Error Code Level-1 ( defined by Each-Module )
55      2222 => Error Code Level-2 ( defined by Each-Module )
56
57 DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD
58
59  [Location] : Error Location Code
60    31 | xxxx xxxx | xxxx xxxx | xxxx xxxx | xxxx xxxx | 0
61       | 1111 1orA | AAAA SSSS | SSSS SSSS | FFFF FFFF |
62      1111 => Module Level-1 Code
63      AAAA => Archtechture Code or Module Sub-Code 
64      SSSS => Source File ID ( defined by Each-Module )     
65      FFFF => Function ID ( defined by Each-Module )
66
67 DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD*/
68
69 #define DRD64_ERROR_CODE_CLEAR                  0x00000000
70 #define DRD64_ERROR_LOCATION_CLEAR              0x00000000
71
72 /* [Error] Type Code ==================   *_______ */
73 #define DRD64_ERROR_TYPE(n)                             (((DWord)(n))&0xf0000000)
74 #define DRD64_ERROR_TYPE_FATAL                  0x80000000
75 #define DRD64_ERROR_TYPE_ERROR                  0x40000000
76 #define DRD64_ERROR_TYPE_WARNING                0x20000000
77 #define DRD64_ERROR_TYPE_INFO                   0x10000000
78 #define DRD64_ERROR_TYPE_NONE                   0x00000000
79
80 /* [Error] Pattern Code ===============   __**____ */
81 #define DRD64_ERROR_PTN(n)                              (((DWord)(n))&0x00ff0000)
82 #define DRD64_ERROR_PTN_NOERROR                 0x00000000
83 #define DRD64_ERROR_PTN_PACKET                  0x00010000
84 #define DRD64_ERROR_PTN_COMMAND                 0x00020000
85 #define DRD64_ERROR_PTN_LOG                             0x00030000
86 #define DRD64_ERROR_PTN_SYSCALL                 0x00040000      // system call error.
87 #define DRD64_ERROR_PTN_LIBCALL                 0x00050000      // libc/libm/stdlib call error.
88 #define DRD64_ERROR_PTN_TIMEOUT                 0x00060000
89 #define DRD64_ERROR_PTN_NOEXIST                 0x00070000
90 #define DRD64_ERROR_PTN_NOMEMORY                0x00080000
91 #define DRD64_ERROR_PTN_SOCKET                  0x00090000
92 #define DRD64_ERROR_PTN_INETADDR                0x000a0000
93 #define DRD64_ERROR_PTN_NCURSES                 0x000b0000
94 #define DRD64_ERROR_PTN_FAILED_ARG              0x000c0000      // API invalid Arg indicate.  
95 #define DRD64_ERROR_PTN_LESSBUFFER              0x000d0000
96 #define DRD64_ERROR_PTN_NULLPTR                 0x000e0000
97 #define DRD64_ERROR_PTN_CALLFUNC                0x000f0000
98 #define DRD64_ERROR_PTN_FAILCALL                0x00100000
99 #define DRD64_ERROR_PTN_OTHER                   0x007f0000
100 #define DRD64_ERROR_PTN_BUG                             0x00ff0000
101
102 /* [Error] Error Code Level-1 =========   ____**__ */
103 #define DRD64_ERROR_LEVEL1(n)                   ((((DWord)(n)&0x0000ff00))>>8)
104
105 /* [Error] Error Code Level-2 =========   ______** */
106 #define DRD64_ERROR_LEVEL2(n)                   (((DWord)(n))&0x000000ff)
107
108 /* [Location] Module Level-1 Code =====   *+______ */
109 #define DRD64_ERROR_MODULE(n)                   (((DWord)(n))&0xff000000)
110 #define DRD64_ERROR_MODULE_NOARCH(n)    (((DWord)(n))&0xff000000)
111 #define DRD64_ERROR_MODULE_WITHARCH(n)  (((DWord)(n))&0xf0000000)
112 #define DRD64_ERROR_MODULE_IsArch(n)    (((DWord)(n))&0x80000000)
113 #define DRD64_ERROR_MODULE_MARSHALD             0x01000000
114 #define DRD64_ERROR_MODULE_DEBUGD               0x02000000
115 #define DRD64_ERROR_MODULE_SERVER               0x03000000
116 #define DRD64_ERROR_MODULE_LIBDRD64             0x11000000
117 #define DRD64_ERROR_MODULE_LIBBROWNIE   0x12000000
118 #define DRD64_ERROR_MODULE_DRCC                 0x20000000
119 #define DRD64_ERROR_MODULE_LIBEDITTEXT  0x31000000
120 #define DRD64_ERROR_MODULE_LIBFILETYPE  0x32000000
121 #define DRD64_ERROR_MODULE_LIBGOBLIN    0x40000000
122 #define DRD64_ERROR_MODULE_RESERVE              0x70000000
123 #define DRD64_ERROR_MODULE_LIBASM               0x90000000      /* with ArchCode */
124 #define DRD64_ERROR_MODULE_LIBARCH              0xa0000000      /* with ArchCode */
125 #define DRD64_ERROR_MODULE_ARCHRESERVE  0xf0000000      /* with ArchCode */
126
127 /* [Location] Archtechture Code =======   _+*_____ */
128 #define DRD64_ERROR_ARCH(n)                             (((DWord)(n))&0x0ff00000)
129 #define DRD64_ERROR_ARCH_NODEPEND               0x00000000
130 #define DRD64_ERROR_ARCH_INTEL64                0x01100000
131 #define DRD64_ERROR_ARCH_INTEL32                0x01200000
132 #define DRD64_ERROR_ARCH_INTEL16                0x01300000
133 #define DRD64_ERROR_ARCH_POWERPC64              0x02100000
134 #define DRD64_ERROR_ARCH_POWERPC32              0x02200000
135 #define DRD64_ERROR_ARCH_ARM64                  0x04100000
136 #define DRD64_ERROR_ARCH_ARM32                  0x04200000
137 #define DRD64_ERROR_ARCH_SPARC64                0x05100000
138 #define DRD64_ERROR_ARCH_SPARC32                0x05200000
139 #define DRD64_ERROR_ARCH_MIPS                   0x06100000
140
141 /* [Location] Source File ID ==========   ____**__ */
142 #define DRD64_ERROR_SOURCE(n)                   ((((DWord)(n)&0x0000ff00))>>8)
143
144 /* [Location] Function ID =============   ______** */
145 #define DRD64_ERROR_FUNCTION(n)                 (((DWord)(n))&0x000000ff)
146
147 typedef struct  {
148         DWord   dw_error;
149         DWord   dw_location;
150         int             i_system_errno;
151         int             i_srcline;
152         QWord   qw_value[2];
153         struct  timeval t_time;
154 } Drd64_ErrorInfo;
155
156 #define DRD64_ERROR_SET_CODE(c,p,m,n)   (((DWord)(c))|((DWord)(p))|(((DWord)(m))<<8)|((DWord)(n)))
157 #define DRD64_ERROR_SET_LOCATION(m,a,s,f)       (((DWord)(m))|((DWord)(a))|(((DWord)(s))<<8)|((DWord)(f)))
158
159 #define DRD64_ERR_CODE(c,p,m,n) (((DWord)(c))|((DWord)(p))|(((DWord)(m))<<8)|((DWord)(n)))
160 #define DRD64_ERR_LOCATION(m,a,s,f)     (((DWord)(m))|((DWord)(a))|(((DWord)(s))<<8)|((DWord)(f)))
161
162 #define DRD64_FATAL(p,m,n)      ((DRD64_ERROR_TYPE_FATAL)|((DWord)(p))|(((DWord)(m))<<8)|((DWord)(n)))
163 #define DRD64_ERROR(p,m,n)      ((DRD64_ERROR_TYPE_ERROR)|((DWord)(p))|(((DWord)(m))<<8)|((DWord)(n)))
164 #define DRD64_WARNING(p,m,n)    ((DRD64_ERROR_TYPE_WARNING)|((DWord)(p))|(((DWord)(m))<<8)|((DWord)(n)))
165 #define DRD64_INFO(p,m,n)       ((DRD64_ERROR_TYPE_ERROR)|((DWord)(p))|(((DWord)(m))<<8)|((DWord)(n)))
166
167
168 #endif  /* DRD64_HEADER_XXX */
169
170 /* EOF of drd64_.h ----------------------------------- */