forked from F8LEFT/FAInHook
-
Notifications
You must be signed in to change notification settings - Fork 0
/
MinAndroidDef.h
executable file
·95 lines (78 loc) · 3.22 KB
/
MinAndroidDef.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
//===------------------------------------------------------------*- C++ -*-===//
//
// Created by F8LEFT on 2017/6/8.
// Copyright (c) 2017. All rights reserved.
//===--------------------------------------------------------------------------
//
//===----------------------------------------------------------------------===//
#ifndef FSHELL_MINANDROIDDEF_H_H
#define FSHELL_MINANDROIDDEF_H_H
// 补充一些Android的定义
#ifndef NDEBUG
#define TOSTR(fmt) #fmt
#define FLFMT(fmt) TOSTR([%s:%d]fmt)
#ifdef __ANDROID__
#include <android/log.h>
#define FLOG_TAG "F8LEFT"
#define LOGE(...) __android_log_print(ANDROID_LOG_ERROR, FLOG_TAG, __VA_ARGS__)
#define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG, FLOG_TAG, __VA_ARGS__)
#define LOGW(...) __android_log_print(ANDROID_LOG_WARN, FLOG_TAG, __VA_ARGS__)
#define LOGI(...) __android_log_print(ANDROID_LOG_INFO, FLOG_TAG, __VA_ARGS__)
#define LOGV(...) __android_log_print(ANDROID_LOG_VERBOSE, FLOG_TAG, __VA_ARGS__)
#define FLOGE(fmt, ...) __android_log_print(ANDROID_LOG_ERROR, FLOG_TAG, FLFMT(fmt), __FUNCTION__, __LINE__, ##__VA_ARGS__)
#define FLOGD(fmt, ...) __android_log_print(ANDROID_LOG_DEBUG, FLOG_TAG, FLFMT(fmt), __FUNCTION__, __LINE__, ##__VA_ARGS__)
#define FLOGW(fmt, ...) __android_log_print(ANDROID_LOG_WARN, FLOG_TAG, FLFMT(fmt), __FUNCTION__, __LINE__, ##__VA_ARGS__)
#define FLOGI(fmt, ...) __android_log_print(ANDROID_LOG_INFO, FLOG_TAG, FLFMT(fmt), __FUNCTION__, __LINE__, ##__VA_ARGS__)
#define FLOGV(fmt, ...) __android_log_print(ANDROID_LOG_VERBOSE, FLOG_TAG, FLFMT(fmt), __FUNCTION__, __LINE__, ##__VA_ARGS__)
#else
#define LOGE printf
#define LOGD printf
#define LOGW printf
#define LOGI printf
#define LOGV printf
#define FLOGE(fmt, ...) printf(FLFMT(fmt), __FUNCTION__, __LINE__, ##__VA_ARGS__)
#define FLOGD(fmt, ...) printf(FLFMT(fmt), __FUNCTION__, __LINE__, ##__VA_ARGS__)
#define FLOGW(fmt, ...) printf(FLFMT(fmt), __FUNCTION__, __LINE__, ##__VA_ARGS__)
#define FLOGI(fmt, ...) printf(FLFMT(fmt), __FUNCTION__, __LINE__, ##__VA_ARGS__)
#define FLOGV(fmt, ...) printf(FLFMT(fmt), __FUNCTION__, __LINE__, ##__VA_ARGS__)
#endif
#else
// DO NOT LOG MESSAGE IN RELEASE VERSION
#define LOGE(...)
#define LOGD(...)
#define LOGW(...)
#define LOGI(...)
#define LOGV(...)
#define FLOGE(...)
#define FLOGD(...)
#define FLOGW(...)
#define FLOGI(...)
#define FLOGV(...)
#endif
#define ALOGE LOGE
#define ALOGV LOGV
#define ALOGW LOGW
#define ALOGD LOGD
#define ALOGI LOGI
#ifndef PAGE_SHIFT
#define PAGE_SHIFT 12
#endif
#ifndef PAGE_SIZE
#define PAGE_SIZE (1UL << PAGE_SHIFT)
#endif
#ifndef PAGESIZE
#define PAGESIZE PAGE_SIZE
#endif
#ifndef PAGE_MASK
#define PAGE_MASK (~(PAGE_SIZE-1))
#endif
#define PAGE_START(x) ((x) & PAGE_MASK)
#define PAGE_OFFSET(x) ((x) & ~PAGE_MASK)
#define PAGE_END(x) PAGE_START((x) + (PAGE_SIZE-1))
#define PACKED(x) __attribute__ ((__aligned__(x), __packed__))
// DISALLOW_COPY_AND_ASSIGN disallows the copy and operator= functions.
// It goes in the private: declarations in a class.
#define DISALLOW_COPY_AND_ASSIGN(TypeName) \
TypeName(const TypeName&); \
void operator=(const TypeName&)
#endif //FSHELL_MINANDROIDDEF_H_H