|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
通常来讲,非常实用,不用模板创建的话,也可以直接复制粘贴进去使用哦!
! ?% ~8 P& k5 Y2 _2 g& y3 P" z) \4 n+ y* J
[mw_shl_code=c,true]
+ w& H) G. q/ ?, H#include <stdarg.h>
. R+ {3 m- i1 i, D8 y) d8 k* b) M4 }' p6 B8 ]% D
static void ECHO(const char *format, ...)
+ j- e8 c% m( t/ R; y/ N* k/ @3 k: m{3 `) ?1 L3 @) [9 `* @& _
char msg[UF_UI_MAX_STRING_LEN+1];0 j3 N+ g5 H( @) W
va_list args;( J5 T d0 w' @. L4 P7 e% H
va_start(args, format);
. n2 S' `6 G# G6 a6 r. t vsnprintf(msg, sizeof(msg), format, args);
) _4 @, {/ g& F6 z& \: U va_end(args);) R8 k, C# ^, R# W" v
UF_UI_open_listing_window();
- K( c$ c% s. l2 { UF_UI_write_listing_window(msg);
, ~3 K) z, k4 p9 ]) \% z8 O UF_print_syslog(msg, FALSE);
+ w" t- e/ D c! ?}0 x- v: q2 }% V+ p
: \. A7 X( j4 r" K#define UF_CALL(X) (report_error( __FILE__, __LINE__, #X, (X)))
# N- N0 r& c, ]# u1 j6 S: P/ W3 h3 M
) B/ F: }9 Q9 a5 E3 ^static int report_error( const char *file, int line, const char *call, int irc)
( A' ?7 Q* v q( r5 _{# s/ ]& b! b5 Y2 [
if (irc)5 r# Z& D( V3 W* P% k) a# D
{. S1 p% ]8 S6 |; ]2 ?
char err[133];3 z7 i! C$ P% H
+ E6 r3 p, q$ ]# ~. ~& ?6 G6 N
UF_get_fail_message(irc, err);/ u0 r9 ^ ^- Y" W
ECHO("*** ERROR code %d at line %d in %s:\n",, T( M$ l6 I2 e u
irc, line, file); {8 g) W$ c4 i' C, D
ECHO("+++ %s\n", err);( e8 E4 Y1 \- l3 y! p4 L
ECHO("%s;\n", call);! `. |4 Q. ]4 d
}
1 a+ N5 r+ B+ T* x/ x
# |. T! w1 o0 p6 H return(irc);" K1 z: n, k/ X/ |
}[/mw_shl_code]6 m5 y, E) g# k: ]! M' { S
3 p! X9 V. E: R
|
|