更新日期: 2022/06/01 来源: https://gitee.com/weharmony/kernel_liteos_a_note
los_hook_types_parse.h
浏览该文件的文档.
1/*
2 * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
3 * Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without modification,
6 * are permitted provided that the following conditions are met:
7 *
8 * 1. Redistributions of source code must retain the above copyright notice, this list of
9 * conditions and the following disclaimer.
10 *
11 * 2. Redistributions in binary form must reproduce the above copyright notice, this list
12 * of conditions and the following disclaimer in the documentation and/or other materials
13 * provided with the distribution.
14 *
15 * 3. Neither the name of the copyright holder nor the names of its contributors may be used
16 * to endorse or promote products derived from this software without specific prior written
17 * permission.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
21 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
23 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
24 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
25 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
26 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
27 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
28 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
29 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 */
31
32#ifndef _LOS_HOOK_TYPES_PARSE_H
33#define _LOS_HOOK_TYPES_PARSE_H
34
35#define ADDR(a) (&(a))
36#define ARGS(a) (a)
37#define ADDRn(...) _CONCAT(ADDR, _NARGS(__VA_ARGS__))(__VA_ARGS__)
38#define ARGSn(...) _CONCAT(ARGS, _NARGS(__VA_ARGS__))(__VA_ARGS__)
39#define ARGS0()
40#define ADDR0()
41#define ARGS1(a) ARGS(a)
42#define ADDR1(a) ADDR(a)
43
44#define ARG_const _ARG_const(
45#define _ARG_const(a) ARG_CP_##a)
46#define ARG_CP_LosSemCB ADDR(
47#define ARG_CP_LosTaskCB ADDR(
48#define ARG_CP_UINT32 ADDR(
49#define ARG_CP_LosMux ADDR(
50#define ARG_CP_LosQueueCB ADDR(
51#define ARG_CP_SWTMR_CTRL_S ADDR(
52#define ARG_CP_IpcMsg ADDR(
53#define ARG_UINT32 ARGS(
54#define ARG_PEVENT_CB_S ARGS(
55#define ARG_void ADDRn(
56#define ARG(a) ARG_##a)
57
58#define PARAM_TO_ARGS1(a) ARG(a)
59#define PARAM_TO_ARGS2(a, b) ARG(a), PARAM_TO_ARGS1(b)
60#define PARAM_TO_ARGS3(a, b, c) ARG(a), PARAM_TO_ARGS2(b, c)
61#define PARAM_TO_ARGS4(a, b, c, d) ARG(a), PARAM_TO_ARGS3(b, c, d)
62#define PARAM_TO_ARGS5(a, b, c, d, e) ARG(a), PARAM_TO_ARGS4(b, c, d, e)
63#define PARAM_TO_ARGS6(a, b, c, d, e, f) ARG(a), PARAM_TO_ARGS5(b, c, d, e, f)
64#define PARAM_TO_ARGS7(a, b, c, d, e, f, g) ARG(a), PARAM_TO_ARGS6(b, c, d, e, f, g)
65
66#define _ZERO_ARGS 7, 6, 5, 4, 3, 2, 1, 0
67#define ___NARGS(a, b, c, d, e, f, g, h, n, ...) n
68#define __NARGS(...) ___NARGS(__VA_ARGS__)
69#define _NARGS(...) __NARGS(x, __VA_ARGS__##_ZERO_ARGS, 7, 6, 5, 4, 3, 2, 1, 0)
70#define __CONCAT(a, b) a##b
71#define _CONCAT(a, b) __CONCAT(a, b)
72
73#define PARAM_TO_ARGS(...) _CONCAT(PARAM_TO_ARGS, _NARGS(__VA_ARGS__))(__VA_ARGS__)
74#define OS_HOOK_PARAM_TO_ARGS(paramList) (PARAM_TO_ARGS paramList)
75
76#endif /* _LOS_HOOK_TYPES_PARSE_H */