addition of silc.css
[crypto.git] / apps / irssi / src / fe-common / core / printtext.h
1 #ifndef __PRINTTEXT_H
2 #define __PRINTTEXT_H
3
4 #include "fe-windows.h"
5
6 void printformat_module(const char *module, void *server, const char *target, int level, int formatnum, ...);
7 void printformat_module_window(const char *module, WINDOW_REC *window, int level, int formatnum, ...);
8
9 void printformat_module_args(const char *module, void *server, const char *target, int level, int formatnum, va_list va);
10 void printformat_module_window_args(const char *module, WINDOW_REC *window, int level, int formatnum, va_list va);
11
12 void printtext(void *server, const char *target, int level, const char *text, ...);
13 void printtext_string(void *server, const char *target, int level, const char *text);
14 void printtext_window(WINDOW_REC *window, int level, const char *text, ...);
15 void printtext_multiline(void *server, const char *target, int level, const char *format, const char *text);
16
17 /* only GUI should call these - used for printing text to somewhere else
18    than windows */
19 void printtext_gui(const char *text);
20 void printformat_module_gui(const char *module, int formatnum, ...);
21 void printformat_module_gui_args(const char *module, int formatnum, va_list va);
22
23 void printtext_init(void);
24 void printtext_deinit(void);
25
26 /* printformat(...) = printformat_format(MODULE_NAME, ...)
27
28    Could this be any harder? :) With GNU C compiler and C99 compilers,
29    use #define. With others use either inline functions if they are
30    supported or static functions if they are not..
31  */
32 #if defined (__GNUC__) && !defined (__STRICT_ANSI__)
33 /* GCC */
34 #  define printformat(server, target, level, formatnum...) \
35         printformat_module(MODULE_NAME, server, target, level, ##formatnum)
36 #  define printformat_window(window, level, formatnum...) \
37         printformat_module_window(MODULE_NAME, window, level, ##formatnum)
38 #  define printformat_gui(formatnum...) \
39         printformat_module_gui(MODULE_NAME, ##formatnum)
40 #elif defined (_ISOC99_SOURCE)
41 /* C99 */
42 #  define printformat(server, target, level, formatnum, ...) \
43         printformat_module(MODULE_NAME, server, target, level, formatnum, __VA_ARGS__)
44 #  define printformat_window(window, level, formatnum, ...) \
45         printformat_module_window(MODULE_NAME, window, level, formatnum, __VA_ARGS__)
46 #  define printformat_gui(formatnum, ...) \
47         printformat_module_gui(MODULE_NAME, formatnum, __VA_ARGS__)
48 #else
49 /* inline/static */
50 #ifdef G_CAN_INLINE
51 G_INLINE_FUNC
52 #else
53 static
54 #endif
55 void printformat(void *server, const char *target, int level, int formatnum, ...)
56 {
57         va_list va;
58
59         va_start(va, formatnum);
60         printformat_module_args(MODULE_NAME, server, target, level, formatnum, va);
61         va_end(va);
62 }
63
64 #ifdef G_CAN_INLINE
65 G_INLINE_FUNC
66 #else
67 static
68 #endif
69 void printformat_window(WINDOW_REC *window, int level, int formatnum, ...)
70 {
71         va_list va;
72
73         va_start(va, formatnum);
74         printformat_module_window_args(MODULE_NAME, window, level, formatnum, va);
75         va_end(va);
76 }
77
78 #ifdef G_CAN_INLINE
79 G_INLINE_FUNC
80 #else
81 static
82 #endif
83 void printformat_gui(int formatnum, ...)
84 {
85         va_list va;
86
87         va_start(va, formatnum);
88         printformat_module_gui_args(MODULE_NAME, formatnum, va);
89         va_end(va);
90 }
91 #endif
92
93 #endif