librnr  1.14.5
RoadNarrows Robotics Common Library 1
char.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////////////
2 /*! \file
3  *
4  * \brief Simple character manipulations.
5  *
6  * \pkgsynopsis
7  * RoadNarrows Robotics Common Library 1
8  *
9  * \pkgcomponent{Library}
10  * librnr
11  *
12  * \pkgfile{rnr/char.h}
13  *
14  * \author Robin Knight (robin.knight@roadnarrows.com)
15  *
16  * \pkgcopyright{2005-2018,RoadNarrows LLC.,http://www.roadnarrows.com}
17  *
18  * \license{MIT}
19  *
20  * \EulaBegin
21  * See the README and EULA files for any copyright and licensing information.
22  * \EulaEnd
23  */
24 ////////////////////////////////////////////////////////////////////////////////
25 
26 #ifndef _RNR_CHAR_H
27 #define _RNR_CHAR_H
28 
29 #include <stdio.h>
30 
32 
33 /*!
34  * \brief Convert hex nibble to ascii equivalent.
35  * \param h Hex nibble [0,15].
36  */
37 static inline char hexnibbletoa(int h)
38 {
39  return (char)(h<10? '0'+h: 'a'+(h & 0x0f));
40 }
41 
42 extern char *NewPrettyBuf(byte_t buf[], size_t len);
43 
44 extern int PrettyPrintBuf(FILE *fp, byte_t buf[], size_t len);
45 
47 
48 #endif // _RNR_CHAR_H
char * NewPrettyBuf(byte_t buf[], size_t len)
Allocates a string buffer and copies a &#39;prettified&#39; readable version of the contents of the given (bi...
Definition: char.c:40
#define C_DECLS_BEGIN
C declaration block begin in C.
Definition: rnrconfig.h:71
u8_t byte_t
8-bit byte
Definition: rnrconfig.h:177
int PrettyPrintBuf(FILE *fp, byte_t buf[], size_t len)
Print out &#39;prettified&#39; readable version of the contents of the given (binary) buffer.
Definition: char.c:107
#define C_DECLS_END
C declaration block end in C.
Definition: rnrconfig.h:72
static char hexnibbletoa(int h)
Convert hex nibble to ascii equivalent.
Definition: char.h:37