99 lines
2.5 KiB
C
99 lines
2.5 KiB
C
#ifndef __COMMON_DEF_H__
|
|
#define __COMMON_DEF_H__
|
|
/*************************************************************************
|
|
*
|
|
* deepCam Shenzhen CONFIDENTIAL
|
|
* FILE: <tag>
|
|
*
|
|
* [2016] - [2019] DeepCam Shenzhen
|
|
* All Rights Reserved.
|
|
|
|
NOTICE:
|
|
* All information contained herein is, and remains the property of DeepCam Shenzhen.
|
|
* The intellectual and technical concepts contained herein are proprietary to DeepCam
|
|
* Shenzhen and may be covered by China and Foreign Patents,patents in process, and
|
|
* are protected by trade secret or copyright law.
|
|
* Dissemination of this information or reproduction of this material
|
|
* is strictly forbidden unless prior written permission is obtained
|
|
* DeepCam Shenzhen.
|
|
*
|
|
*
|
|
* Written: Jing.Yi 2021-05-06
|
|
* Updated:
|
|
**************************************************************************/
|
|
|
|
#ifdef PLATFORM_ANDROID
|
|
#include <android/log.h>
|
|
#else
|
|
#include <stdio.h>
|
|
#endif
|
|
|
|
#include "typedef.h"
|
|
|
|
|
|
#define TERMINAL 0
|
|
#define SYSTEM_LOG 1
|
|
|
|
#ifdef PLATFORM_ANDROID
|
|
#define LOG_DESTINATION SYSTEM_LOG //{SYSTEM_LOG,TERMINAL}
|
|
#else
|
|
#define LOG_DESTINATION TERMINAL //{SYSTEM_LOG,TERMINAL}
|
|
#endif
|
|
|
|
|
|
#define LOG_TAG_COMMON "log_common"
|
|
|
|
|
|
#ifdef PLATFORM_WINDOWS
|
|
#define PATH_SEPARATOR "\\"
|
|
#else
|
|
#define PATH_SEPARATOR "/"
|
|
#endif
|
|
|
|
#if (LOG_DESTINATION == SYSTEM_LOG)
|
|
#define __ASSERT__(c,tag,fmt,...) do {\
|
|
if(c == 0){\
|
|
__android_log_print(ANDROID_LOG_FATAL,tag,fmt,##__VA_ARGS__);\
|
|
exit(0);\
|
|
}\
|
|
}while(0)
|
|
|
|
#define __LOGPRINTF__(level,tag,fmt,...) do {\
|
|
__android_log_print(level,tag,fmt,##__VA_ARGS__);\
|
|
}while(0)
|
|
|
|
#define __ASSERT_RETURN__(c,tag,fmt,...) do {\
|
|
if(c == 0){\
|
|
__android_log_print(ANDROID_LOG_FATAL,tag,fmt,##__VA_ARGS__);\
|
|
return;\
|
|
}\
|
|
}while(0)
|
|
|
|
#define DbgMark() __LOGPRINTF__(ANDROID_LOG_INFO,"DBG_MARK","Run at:%s:%d!\n",__func__,__LINE__)
|
|
#elif (LOG_DESTINATION == TERMINAL)
|
|
#define __ASSERT__(c,tag,fmt,...) do {\
|
|
if(c == 0){\
|
|
printf(fmt,##__VA_ARGS__);\
|
|
fflush(stdout);\
|
|
exit(0);\
|
|
}\
|
|
}while(0)
|
|
|
|
#define __LOGPRINTF__(level,tag,fmt,...) do {\
|
|
printf(fmt,##__VA_ARGS__);\
|
|
}while(0)
|
|
|
|
#define __ASSERT_RETURN__(c,tag,fmt,...) do {\
|
|
if(c == 0){\
|
|
printf(fmt,##__VA_ARGS__);\
|
|
return;\
|
|
}\
|
|
}while(0)
|
|
|
|
#define DbgMark() printf("Run at:%s:%d!\n",__func__,__LINE__)
|
|
#else
|
|
#error "LOG_DESTINATION must be TERMINAL or SYSTEM_LOG !"
|
|
#endif
|
|
|
|
#endif
|