-
Notifications
You must be signed in to change notification settings - Fork 23
/
modp_ascii.h
103 lines (91 loc) · 2.86 KB
/
modp_ascii.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
96
97
98
99
100
101
102
103
/* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 4 -*- */
/* vi: set expandtab shiftwidth=4 tabstop=4: */
/**
* \file modp_ascii.h
* <PRE>
* MODP_ASCII -- Simple ascii manipulation (uppercase, lowercase, etc)
* http://code.google.com/p/stringencoders/
*
* Copyright © 2007, Nick Galbreath -- nickg [at] modp [dot] com
* All rights reserved.
*
* Released under bsd license. See modp_ascii.c for details.
* </PRE>
*
*/
#ifndef COM_MODP_STRINGENCODERS_ASCII
#define COM_MODP_STRINGENCODERS_ASCII
#ifdef __cplusplus
#define BEGIN_C extern "C" {
#define END_C }
#else
#define BEGIN_C
#define END_C
#endif
BEGIN_C
/*
* \param[in,out] str the input string
* \param[in] len the length of input string (the strlen)
*/
void modp_toupper(char* str, int size_t);
/** \brief make lower case copy of input string
*
* \param[out] output buffer, with at least 'len + 1' bytes allocated
* \param[in] str the input string
* \param[in] len the length of input string (the strlen)
*
* Please make sure dest has been allocation with at least 'len+1'
* bytes. This appends a trailing NULL character at the end of
* dest!
*
* This is based on the algorithm by Paul Hsieh
* http://www.azillionmonkeys.com/qed/asmexample.html
*/
void modp_toupper_copy(char* dest, const char* str, size_t len);
/** \brief lower case a string in place
*
* \param[in, out] str the input string
* \param[in] len the length of input string (the strlen)
*
*/
void modp_tolower(char* str, size_t size);
/** \brief make lower case copy of input string
*
* \param[out] output buffer, with at least 'len + 1' bytes allocated
* \param[in] str the input string
* \param[in] len the length of input string (the strlen)
*
* Please make sure dest has been allocation with at least 'len+1'
* bytes. This appends a trailing NULL character at the end of
* dest!
*
* This is based on the algorithm by Paul Hsieh
* http://www.azillionmonkeys.com/qed/asmexample.html
*/
void modp_tolower_copy(char* dest, const char* str, size_t len);
/** \brief turn a string into 7-bit printable ascii.
*
* By "printable" we means all characters between 32 and 126.
* All other values are turned into '?'
*
* \param[in, out] str the input string
* \param[in] len the length of input string (the strlen)
*
*/
void modp_toprint(char* str, size_t len);
/** \brief make a printable copy of a string
*
* By "printable" we means all characters between 32 and 126.
* All other values are turned into '?'
*
* \param[out] output buffer, with at least 'len + 1' bytes allocated
* \param[in] str the input string
* \param[in] len the length of input string (the strlen)
*
* Please make sure dest has been allocation with at least 'len+1'
* bytes. This appends a trailing NULL character at the end of
* dest!
*/
void modp_toprint_copy(char* dest, const char* str, size_t len);
END_C
#endif /* MODP_ASCII */