VSF Documented
mf_u8_dec2str.h
Go to the documentation of this file.
1/****************************************************************************
2* Copyright 2020 by Gorgon Meducer (Email:embedded_zhuoran@hotmail.com) *
3* *
4* Licensed under the Apache License, Version 2.0 (the "License"); *
5* you may not use this file except in compliance with the License. *
6* You may obtain a copy of the License at *
7* *
8* http://www.apache.org/licenses/LICENSE-2.0 *
9* *
10* Unless required by applicable law or agreed to in writing, software *
11* distributed under the License is distributed on an "AS IS" BASIS, *
12* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
13* See the License for the specific language governing permissions and *
14* limitations under the License. *
15* *
16****************************************************************************/
17
18/*****************************************************************************
19 * Copyright(C)2009-2022 by VSF Team *
20 * *
21 * Licensed under the Apache License, Version 2.0 (the "License"); *
22 * you may not use this file except in compliance with the License. *
23 * You may obtain a copy of the License at *
24 * *
25 * http://www.apache.org/licenses/LICENSE-2.0 *
26 * *
27 * Unless required by applicable law or agreed to in writing, software *
28 * distributed under the License is distributed on an "AS IS" BASIS, *
29 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
30 * See the License for the specific language governing permissions and *
31 * limitations under the License. *
32 * *
33 ****************************************************************************/
34
35/*============================ INCLUDES ======================================*/
36#include "./vsf_connect_macro.h"
37/*============================ MACROS ========================================*/
38
39#ifdef __cplusplus
40extern "C" {
41#endif
42
43#ifndef MFUNC_IN_U8_DEC_VALUE
44# error Please define the MFUNC_IN_U8_DEC_VALUE as the input value. It must be \
45a compile-time constant value.
46#endif
47
48#undef __MFUNC_OUT_DEC_DIGIT_TEMP0
49#undef __MFUNC_OUT_DEC_DIGIT_TEMP1
50#undef __MFUNC_OUT_DEC_DIGIT_TEMP2
51#undef __MFUNC_OUT_DEC_STR_TEMP
52#undef MFUNC_OUT_DEC_STR
53
54
55#if (MFUNC_IN_U8_DEC_VALUE % 10) == 0
56# define __MFUNC_OUT_DEC_DIGIT_TEMP0 0
57#elif (MFUNC_IN_U8_DEC_VALUE % 10) == 1
58# define __MFUNC_OUT_DEC_DIGIT_TEMP0 1
59#elif (MFUNC_IN_U8_DEC_VALUE % 10) == 2
60# define __MFUNC_OUT_DEC_DIGIT_TEMP0 2
61#elif (MFUNC_IN_U8_DEC_VALUE % 10) == 3
62# define __MFUNC_OUT_DEC_DIGIT_TEMP0 3
63#elif (MFUNC_IN_U8_DEC_VALUE % 10) == 4
64# define __MFUNC_OUT_DEC_DIGIT_TEMP0 4
65#elif (MFUNC_IN_U8_DEC_VALUE % 10) == 5
66# define __MFUNC_OUT_DEC_DIGIT_TEMP0 5
67#elif (MFUNC_IN_U8_DEC_VALUE % 10) == 6
68# define __MFUNC_OUT_DEC_DIGIT_TEMP0 6
69#elif (MFUNC_IN_U8_DEC_VALUE % 10) == 7
70# define __MFUNC_OUT_DEC_DIGIT_TEMP0 7
71#elif (MFUNC_IN_U8_DEC_VALUE % 10) == 8
72# define __MFUNC_OUT_DEC_DIGIT_TEMP0 8
73#elif (MFUNC_IN_U8_DEC_VALUE % 10) == 9
74# define __MFUNC_OUT_DEC_DIGIT_TEMP0 9
75#endif
76
77
78#if ((MFUNC_IN_U8_DEC_VALUE/10) % 10) == 0
79# define __MFUNC_OUT_DEC_DIGIT_TEMP1 0
80#elif ((MFUNC_IN_U8_DEC_VALUE/10) % 10) == 1
81# define __MFUNC_OUT_DEC_DIGIT_TEMP1 1
82#elif ((MFUNC_IN_U8_DEC_VALUE/10) % 10) == 2
83# define __MFUNC_OUT_DEC_DIGIT_TEMP1 2
84#elif ((MFUNC_IN_U8_DEC_VALUE/10) % 10) == 3
85# define __MFUNC_OUT_DEC_DIGIT_TEMP1 3
86#elif ((MFUNC_IN_U8_DEC_VALUE/10) % 10) == 4
87# define __MFUNC_OUT_DEC_DIGIT_TEMP1 4
88#elif ((MFUNC_IN_U8_DEC_VALUE/10) % 10) == 5
89# define __MFUNC_OUT_DEC_DIGIT_TEMP1 5
90#elif ((MFUNC_IN_U8_DEC_VALUE/10) % 10) == 6
91# define __MFUNC_OUT_DEC_DIGIT_TEMP1 6
92#elif ((MFUNC_IN_U8_DEC_VALUE/10) % 10) == 7
93# define __MFUNC_OUT_DEC_DIGIT_TEMP1 7
94#elif ((MFUNC_IN_U8_DEC_VALUE/10) % 10) == 8
95# define __MFUNC_OUT_DEC_DIGIT_TEMP1 8
96#elif ((MFUNC_IN_U8_DEC_VALUE/10) % 10) == 9
97# define __MFUNC_OUT_DEC_DIGIT_TEMP1 9
98#endif
99
100#if ((MFUNC_IN_U8_DEC_VALUE/100) % 10) == 0
101# define __MFUNC_OUT_DEC_DIGIT_TEMP2 0
102#elif ((MFUNC_IN_U8_DEC_VALUE/100) % 10) == 1
103# define __MFUNC_OUT_DEC_DIGIT_TEMP2 1
104#elif ((MFUNC_IN_U8_DEC_VALUE/100) % 10) == 2
105# define __MFUNC_OUT_DEC_DIGIT_TEMP2 2
106#endif
107
108
109#if __MFUNC_OUT_DEC_DIGIT_TEMP2 == 0
110# if __MFUNC_OUT_DEC_DIGIT_TEMP1 == 0
111# define MFUNC_OUT_DEC_STR __MFUNC_OUT_DEC_DIGIT_TEMP0
112# else
113# define MFUNC_OUT_DEC_STR \
114 VSF_MCONNECT2( __MFUNC_OUT_DEC_DIGIT_TEMP1, \
115 __MFUNC_OUT_DEC_DIGIT_TEMP0)
116# endif
117#else
118# define MFUNC_OUT_DEC_STR \
119 VSF_MCONNECT3( __MFUNC_OUT_DEC_DIGIT_TEMP2, \
120 __MFUNC_OUT_DEC_DIGIT_TEMP1, \
121 __MFUNC_OUT_DEC_DIGIT_TEMP0)
122#endif
123
124
125#undef MFUNC_IN_U8_DEC_VALUE
126
127
128/*============================ MACROFIED FUNCTIONS ===========================*/
129/*============================ TYPES =========================================*/
130/*============================ GLOBAL VARIABLES ==============================*/
131/*============================ LOCAL VARIABLES ===============================*/
132/*============================ PROTOTYPES ====================================*/
133
134#ifdef __cplusplus
135}
136#endif