视频采集及显示: debug-msg.h文件参考
视频采集及显示 1.0 beta
Linux平台视频采集及其显示

debug-msg.h文件参考

Some macros(debug, error handle) usually used in my programs. 更多...

#include <stdio.h>
#include <string.h>
#include <errno.h>

浏览该文件的源代码。

宏定义

#define error_exit(error)
 A macro that prints the error msg and exit.
#define error_ret(error)
 A macro that prints the error msg and return -1.
#define unix_error_exit(error)
 A macro that prints the error msg(with errno) and then exit. I put 'unix' before the 'function' name because I am using 'errno'.
#define unix_error_ret(error)
 A macro that prints the error msg(with errno) and then return -1. I put 'unix' before the 'function' name because I am using 'errno'.
#define unix_print_error(error)
 A macro that prints the error msg(with errno) and then exit. I put 'unix' before the 'function' name because I am using 'errno'.
This error handle(detail version) can show the file, function and line where the error happens.
#define debug_msg(fmt,...)
 A macro that prints the debug msg, as the same with printf.
#define msg_out(format,...)   fprintf(stdout,format,##__VA_ARGS__)
#define TRACE   1
#define debug_trace(trace)
 A macro that traces the file, function and line.

详细描述

Some macros(debug, error handle) usually used in my programs.

Copyleft (C) 2010 Late Lee This program is tested on LINUX PLATFORM, WITH GCC 4.x. The program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY. Please feel free to use the program, and I feel free to ignore the related issues. Any questions or suggestions, or bugs, please contact me at <$ echo -n "aHR0cDovL3d3dy5sYXRlbGVlLm9yZwo=" | base64 -d> or e-mail to <$ echo -n "bGF0ZWxlZUAxNjMuY29tCg==" | base64 -d> if you want to do this.

作者:
Late Lee
日期:
2010
测试:
I only use this file on linux(with x86 & arm) platform.
注解:
You must define DEBUG before you include this file: #define DEBUG #include "debug-msg.h"

宏定义文档

#define debug_trace (   trace)
值:
fprintf(stdout, "%s File:%s Line:%d Func:%s.\n",   \
            trace, __FILE__, __LINE__, __func__)

A macro that traces the file, function and line.

#define error_exit (   error)
值:
do{                                         \
        fprintf(stderr, "%s\n", error);         \
        exit(0);                                \
    } while(0)

A macro that prints the error msg and exit.

#define error_ret (   error)
值:
do{                                           \
        fprintf(stderr, "%s\n", error);           \
        return -1;                                \
    } while(0)

A macro that prints the error msg and return -1.

#define TRACE   1

we trace all the time

#define unix_error_exit (   error)
值:
do{                                         \
        fprintf(stderr, "%s Info[%d]:%s\n",     \
                error, errno, strerror(errno)); \
        exit(1);                                \
    } while(0)

A macro that prints the error msg(with errno) and then exit. I put 'unix' before the 'function' name because I am using 'errno'.

#define unix_error_ret (   error)
值:
do{                                         \
        fprintf(stderr, "%s Info[%d]:%s\n",     \
                error, errno, strerror(errno)); \
        return -1;                              \
    } while(0)

A macro that prints the error msg(with errno) and then return -1. I put 'unix' before the 'function' name because I am using 'errno'.

#define unix_print_error (   error)
值:
do {                                                        \
        fprintf(stderr, "Oh God!\nFile:%s Line:%d Function:%s:\n",  \
                __FILE__, __LINE__, __func__);                      \
        perror(error);                                              \
        exit(0);                                                    \
    } while(0)

A macro that prints the error msg(with errno) and then exit. I put 'unix' before the 'function' name because I am using 'errno'.
This error handle(detail version) can show the file, function and line where the error happens.

注解:
I do not often use this 'function' in my program.