]> mj.ucw.cz Git - libucw.git/blob - images/error.h
Merge with git+ssh://git.ucw.cz/projects/sherlock/GIT/sherlock.git
[libucw.git] / images / error.h
1 #ifndef _IMAGES_ERROR_H
2 #define _IMAGES_ERROR_H
3
4 extern uns image_trace; /* ImageLib.Trace */ 
5
6 /* Error codes */
7
8 enum image_msg_code {
9   IMAGE_MSG_TYPE = 0xff000000,
10   IMAGE_MSG_TRACE = (L_DEBUG << 24),
11   IMAGE_MSG_WARN = (L_WARN << 24),
12   IMAGE_MSG_ERROR = (L_ERROR << 24),
13   IMAGE_TRACE_LEVEL = 0x0000ffff,
14   IMAGE_WARN_TYPE = 0x0000ffff,
15   IMAGE_WARN_SUBTYPE = 0x00ff0000,
16   IMAGE_ERROR_TYPE = 0x0000ffff,
17   IMAGE_ERROR_SUBTYPE = 0x00ff0000,
18   IMAGE_ERROR_NOT_IMPLEMENTED = 1,
19   IMAGE_ERROR_INVALID_DIMENSIONS = 2,
20   IMAGE_ERROR_INVALID_FILE_FORMAT = 3,
21   IMAGE_ERROR_INVALID_PIXEL_FORMAT = 4,
22   IMAGE_ERROR_READ_FAILED = 5,
23   IMAGE_ERROR_WRITE_FAILED = 6,
24 };
25
26 /* Useful macros */
27
28 #define IMAGE_WARN(ctx, type, msg...) image_context_msg((ctx), IMAGE_MSG_WARN | (type), msg)
29 #define IMAGE_ERROR(ctx, type, msg...) image_context_msg((ctx), IMAGE_MSG_ERROR | (type), msg)
30
31 #define IMAGE_TRACE(ctx, level, msg...) do { \
32         struct image_context *_ctx = (ctx); uns _level = (level); \
33         if (_level < _ctx->tracing_level) image_context_msg(_ctx, IMAGE_MSG_TRACE | _level, msg); } while (0)
34
35 #endif