Initial version.

This commit is contained in:
Gatsby Van
2023-12-20 00:11:03 +08:00
commit 416bd53733
1043 changed files with 293547 additions and 0 deletions
+81
View File
@@ -0,0 +1,81 @@
/*****************************************************************************/
/**
* Description: Common definitions
*
* Date: 2021-12-04 16:32
* LastEditors: Fan Hao
* LastEditTime: 2022-07-16 17:13
* Revisions: Rev 0.1
* History:
* [2022-07-16]: New branch for Dijian.
* [2021-11-16]: Initial version.
*
* Copyright(c) 2021 Beijing Institute of Technology.
* Lab of Communication and Networking
*
******************************************************************************/
/***************************** Include Files *********************************/
#ifndef DATAKINK_COMMON_H_
#define DATAKINK_COMMON_H_
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <assert.h>
#include "util/util.h"
#include "error.h"
/************************** Constant Definitions *****************************/
/***************** Macros (Inline Functions) Definitions *********************/
#define __PRINT_BLOCK(block) do {\
block\
} while(0)
#define ASSERT(exp) ((exp) ? (void)0 : AppAssert(__FILE__, __LINE__))
#define _nop_() __asm__("nop")
/* Stringify */
#define STR(x) #x
//#define _814_DEBUG_LEVEL 3
#if _814_DEBUG_LEVEL > 0
#define DBG_PRINT(...) printf(__VA_ARGS__)
#endif
#if _814_DEBUG_LEVEL >= 1
#define DBG_ERROR(...) __PRINT_BLOCK( \
printf("in"__FILE__" #%4d [error]\t",__LINE__); \
printf(__VA_ARGS__); \
)
#endif
#if _814_DEBUG_LEVEL >= 2
#define DBG_WARNING(...) __PRINT_BLOCK( \
printf("[warning]\t"); \
printf(__VA_ARGS__); \
)
#endif
#if _814_DEBUG_LEVEL >= 3
#define DBG_INFO(...) __PRINT_BLOCK( \
printf("[Info]\t"); \
printf(__VA_ARGS__); \
)
#endif
#ifndef DBG_ERROR
#define DBG_ERROR(...) {}
#endif
#ifndef DBG_WARNING
#define DBG_WARNING(...) {}
#endif
#ifndef DBG_INFO
#define DBG_INFO(...) {}
#endif
#ifndef DBG_PRINT
#define DBG_PRINT(...) {}
#endif
/**************************** Type Definitions *******************************/
/************************** Variable Definitions *****************************/
/************************** Function Prototypes ******************************/
void AppAssert(const char * file, int line);
#endif /* COMMON_H_ */