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