|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
通常来讲,非常实用,不用模板创建的话,也可以直接复制粘贴进去使用哦!3 z/ m) p5 G" D% P5 g( m" N$ h
/ b* g8 i7 t) H' C' }[mw_shl_code=c,true], K( S/ T& K: T# V3 J" f" P
#include <stdarg.h>" W$ m7 I& t1 X7 ^& D9 g
) ?) F' l c; \3 y& @9 rstatic void ECHO(const char *format, ...)
' y# {6 x7 V6 Y{6 G3 X. J7 s3 D! K" ^. m/ i
char msg[UF_UI_MAX_STRING_LEN+1];) P, t; o) e3 P( F8 n1 W
va_list args;
% O/ t6 l, z# D6 P va_start(args, format);
- T; Z. ~" N8 o( D, v vsnprintf(msg, sizeof(msg), format, args);0 h F2 Y4 \# [, _; d/ s
va_end(args);- J1 V) N, l7 r" O0 g7 n: K% }
UF_UI_open_listing_window();' d' ^4 `6 _/ u* E
UF_UI_write_listing_window(msg);
( {, M7 {& q: \/ I UF_print_syslog(msg, FALSE);3 O8 Y/ E4 c8 R1 w7 d3 O2 ?
}) Q9 Q3 d5 ? \; W" g
5 H* C9 B. p! s# ^. ?% @
#define UF_CALL(X) (report_error( __FILE__, __LINE__, #X, (X))); o7 C- Z' o# S# @8 O- t1 ?7 h4 c
' y Z. H) p7 f
static int report_error( const char *file, int line, const char *call, int irc)
: i/ R7 j9 i( R: c{
- K! j; k8 E, x2 |+ j1 l, ` if (irc)
5 e/ D4 f3 h0 p I# D, ` {
% x, [& E, x8 t. R0 k( Y6 J char err[133];3 R' F5 [$ R9 C# b# e
$ N% k j+ ?$ K. i' {4 Q UF_get_fail_message(irc, err);- V! |, ]( \) K" z; z) k
ECHO("*** ERROR code %d at line %d in %s:\n",
5 o& p0 O5 r: S% b irc, line, file);
( N5 @9 W" B* j* R( u5 m ECHO("+++ %s\n", err);2 x. b$ a, N. a: T. H
ECHO("%s;\n", call);
* K3 h, u+ |/ c" i- _" k4 z }
2 R1 ~! L4 X" ?+ } Q5 _* ?; s W3 y
8 s7 [% s8 Y" ? return(irc);
! r& q& S+ M8 o. U) b' g}[/mw_shl_code]5 M7 y' ~* R0 H0 o- A
* t5 u5 Y( _& e2 g0 K |
|