OSDN Git Service

* WorkBackup: 2015/06/01(Mon) AM05:43
[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"drd64_types.h"
41 #include"drd64_defines.h"
42
43 /*DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD
44
45  [Error] : Error Code
46    31 | xxxx xxxx | xxxx xxxx | xxxx xxxx | xxxx xxxx | 0
47       | AAAA RRRR | PPPP PPPP | 1111 1111 | 2222 2222 |
48      AAAA => Error Type Code
49      RRRR => Reserved. 
50      PPPP => Error Pattern     
51      1111 => Error Code Level-1 ( defined by Each-Module )
52      2222 => Error Code Level-2 ( defined by Each-Module )
53
54 DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD
55
56  [Location] : Error Location Code
57    31 | xxxx xxxx | xxxx xxxx | xxxx xxxx | xxxx xxxx | 0
58       | 1111 1orA | AAAA SSSS | SSSS SSSS | FFFF FFFF |
59      1111 => Module Level-1 Code
60      AAAA => Archtechture Code or Module Sub-Code 
61      SSSS => Source File ID ( defined by Each-Module )     
62      FFFF => Function ID ( defined by Each-Module )
63
64 DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD*/
65
66 #define DRD64_ERROR_CODE_CLEAR                  0x00000000
67 #define DRD64_ERROR_LOCATION_CLEAR              0x00000000
68
69 /* [Error] Type Code ==================   *_______ */
70 #define DRD64_ERROR_TYPE(n)                             (((DWord)(n))&0xf0000000)
71 #define DRD64_ERROR_TYPE_FATAL                  0x80000000
72 #define DRD64_ERROR_TYPE_ERROR                  0x40000000
73 #define DRD64_ERROR_TYPE_WARNING                0x20000000
74 #define DRD64_ERROR_TYPE_INFO                   0x10000000
75 #define DRD64_ERROR_TYPE_NONE                   0x00000000
76
77 /* [Error] Pattern Code ===============   __**____ */
78 #define DRD64_ERROR_PTN(n)                              (((DWord)(n))&0x00ff0000)
79 #define DRD64_ERROR_PTN_NOERROR                 0x00000000
80 #define DRD64_ERROR_PTN_PACKET                  0x00010000
81 #define DRD64_ERROR_PTN_COMMAND                 0x00020000
82 #define DRD64_ERROR_PTN_LOG                             0x00030000
83 #define DRD64_ERROR_PTN_SYSCALL                 0x00040000
84 #define DRD64_ERROR_PTN_LIBCALL                 0x00050000
85 #define DRD64_ERROR_PTN_TIMEOUT                 0x00060000
86 #define DRD64_ERROR_PTN_NOEXIST                 0x00070000
87 #define DRD64_ERROR_PTN_NOMEMORY                0x00080000
88 #define DRD64_ERROR_PTN_SOCKET                  0x00090000
89 #define DRD64_ERROR_PTN_INETADDR                0x000a0000
90 #define DRD64_ERROR_PTN_NCURSES                 0x000b0000
91 #define DRD64_ERROR_PTN_FAILED_ARG              0x000c0000
92 #define DRD64_ERROR_PTN_LESSBUFFER              0x000d0000
93 #define DRD64_ERROR_PTN_NULLPTR                 0x000e0000
94 #define DRD64_ERROR_PTN_CALLFUNC                0x000f0000
95 #define DRD64_ERROR_PTN_BUG                             0x00ff0000
96
97 /* [Error] Error Code Level-1 =========   ____**__ */
98 #define DRD64_ERROR_LEVEL1(n)                   ((((DWord)(n)&0x0000ff00))>>8)
99
100 /* [Error] Error Code Level-2 =========   ______** */
101 #define DRD64_ERROR_LEVEL2(n)                   (((DWord)(n))&0x000000ff)
102
103 /* [Location] Module Level-1 Code =====   *+______ */
104 #define DRD64_ERROR_MODULE(n)                   (((DWord)(n))&0xff000000)
105 #define DRD64_ERROR_MODULE_NOARCH(n)    (((DWord)(n))&0xff000000)
106 #define DRD64_ERROR_MODULE_WITHARCH(n)  (((DWord)(n))&0xf0000000)
107 #define DRD64_ERROR_MODULE_IsArch(n)    (((DWord)(n))&0x80000000)
108 #define DRD64_ERROR_MODULE_MARSHALD             0x01000000
109 #define DRD64_ERROR_MODULE_DEBUGD               0x02000000
110 #define DRD64_ERROR_MODULE_SERVER               0x03000000
111 #define DRD64_ERROR_MODULE_LIBDRD64             0x11000000
112 #define DRD64_ERROR_MODULE_LIBBROWNIE   0x12000000
113 #define DRD64_ERROR_MODULE_DRCC                 0x20000000
114 #define DRD64_ERROR_MODULE_LIBEDITTEXT  0x31000000
115 #define DRD64_ERROR_MODULE_LIBFILETYPE  0x32000000
116 #define DRD64_ERROR_MODULE_LIBGOBLIN    0x40000000
117 #define DRD64_ERROR_MODULE_RESERVE              0x70000000
118 #define DRD64_ERROR_MODULE_LIBASM               0x90000000      /* with ArchCode */
119 #define DRD64_ERROR_MODULE_LIBARCH              0xa0000000      /* with ArchCode */
120 #define DRD64_ERROR_MODULE_ARCHRESERVE  0xf0000000      /* with ArchCode */
121
122 /* [Location] Archtechture Code =======   _+*_____ */
123 #define DRD64_ERROR_ARCH(n)                             (((DWord)(n))&0x0ff00000)
124 #define DRD64_ERROR_ARCH_NODEPEND               0x00000000
125 #define DRD64_ERROR_ARCH_INTEL64                0x01100000
126 #define DRD64_ERROR_ARCH_INTEL32                0x01200000
127 #define DRD64_ERROR_ARCH_INTEL16                0x01300000
128 #define DRD64_ERROR_ARCH_POWERPC64              0x02100000
129 #define DRD64_ERROR_ARCH_POWERPC32              0x02200000
130 #define DRD64_ERROR_ARCH_ARM64                  0x04100000
131 #define DRD64_ERROR_ARCH_ARM32                  0x04200000
132 #define DRD64_ERROR_ARCH_SPARC64                0x05100000
133 #define DRD64_ERROR_ARCH_SPARC32                0x05200000
134 #define DRD64_ERROR_ARCH_MIPS                   0x06100000
135
136 /* [Location] Source File ID ==========   ____**__ */
137 #define DRD64_ERROR_SOURCE(n)                   ((((DWord)(n)&0x0000ff00))>>8)
138
139 /* [Location] Function ID =============   ______** */
140 #define DRD64_ERROR_FUNCTION(n)                 (((DWord)(n))&0x000000ff)
141
142 typedef struct  {
143         DWord   dw_error;
144         DWord   dw_location;
145         int             i_system_errno;
146         int             i_srcline;
147         QWord   qw_value[2];
148 } Drd64_ErrorInfo;
149
150 #define DRD64_ERROR_SET_CODE(c,p,m,n)   (((DWord)(c))|((DWord)(p))|(((DWord)(m))<<8)|((DWord)(n)))
151 #define DRD64_ERROR_SET_LOCATION(m,a,s,f)       (((DWord)(m))|((DWord)(a))|(((DWord)(s))<<8)|((DWord)(f)))
152
153 #define DRD64_ERR_CODE(c,p,m,n) (((DWord)(c))|((DWord)(p))|(((DWord)(m))<<8)|((DWord)(n)))
154 #define DRD64_ERR_LOCATION(m,a,s,f)     (((DWord)(m))|((DWord)(a))|(((DWord)(s))<<8)|((DWord)(f)))
155
156 #define DRD64_FATAL(p,m,n)      ((DRD64_ERROR_TYPE_FATAL)|((DWord)(p))|(((DWord)(m))<<8)|((DWord)(n)))
157 #define DRD64_ERROR(p,m,n)      ((DRD64_ERROR_TYPE_ERROR)|((DWord)(p))|(((DWord)(m))<<8)|((DWord)(n)))
158 #define DRD64_WARNING(p,m,n)    ((DRD64_ERROR_TYPE_WARNING)|((DWord)(p))|(((DWord)(m))<<8)|((DWord)(n)))
159 #define DRD64_INFO(p,m,n)       ((DRD64_ERROR_TYPE_ERROR)|((DWord)(p))|(((DWord)(m))<<8)|((DWord)(n)))
160
161
162 #endif  /* DRD64_HEADER_XXX */
163
164 /* EOF of drd64_.h ----------------------------------- */