|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
通常来讲,非常实用,不用模板创建的话,也可以直接复制粘贴进去使用哦!
/ j! P# x' X; X) S- N% X, ~* k. J2 h; h- r m Q# o3 a6 U
[mw_shl_code=c,true]' M$ C7 S$ @3 W; J
#include <stdarg.h>0 G. d7 ~6 _& H
9 x4 f6 m! y n+ Z
static void ECHO(const char *format, ...)0 r; O" u$ A0 E
{
4 A% Z9 x& A+ e& @! c+ d7 g# D8 Z char msg[UF_UI_MAX_STRING_LEN+1];. a6 m& Y5 ~! Q. c; Y
va_list args;# ^! D R# H; V' U" i, S/ l
va_start(args, format);
4 w& _1 D f. R& R _6 ?) p vsnprintf(msg, sizeof(msg), format, args);
3 o* i2 H- C, U+ h va_end(args);8 e4 w" C. q) b* b( m/ b1 e1 x! w. Z6 @
UF_UI_open_listing_window();
1 e+ c: m( c: Q V6 Y0 Z& Q UF_UI_write_listing_window(msg);
\ v: j* G. ~3 N8 ?. E UF_print_syslog(msg, FALSE);
! |; G, m/ _+ e4 \8 q}# B7 z+ o, ?8 b5 ^. }7 X! ]
( W6 l2 [. G7 K# ~# V#define UF_CALL(X) (report_error( __FILE__, __LINE__, #X, (X)))9 Z9 J; w$ S. q" \ P; d' A( H
3 K# U( i0 h0 |2 p6 _2 y
static int report_error( const char *file, int line, const char *call, int irc); J% Z. E; ?% n0 ^/ z" t
{
0 F2 O5 L7 X' @; ] if (irc)( g: E$ W/ T8 {: f6 I" @. s
{4 e6 E Q- z1 g( Q- Z: g( e' N4 C
char err[133];( B. N6 i, {# f9 h K6 I
- W/ C! H& l' c
UF_get_fail_message(irc, err);
3 w: i- a% g5 y: C) P ECHO("*** ERROR code %d at line %d in %s:\n",; v' F$ X' ]$ V* r( L
irc, line, file);+ d* j8 i! w |8 f0 j* R5 o
ECHO("+++ %s\n", err);
0 t0 d: V+ a5 E6 `' K, p% ~ ECHO("%s;\n", call);
" l0 i3 b r& h3 L, R9 P g }( w% r& A+ O& H, d6 E
: ~# b2 G, q0 C7 d' g$ s return(irc);) I) [& r4 I( ^! X0 r
}[/mw_shl_code]; `) x2 }- A, |$ s
; }" w. t I/ N# I5 L0 ~6 A; l |
|