Debian Codegraph @

common/system_string.h

raw symbols SCIP
1 /*
2 * System character string functions
3 *
4 * Copyright (C) 2012-2025, Joachim Metz <[email protected]>
5 *
6 * Refer to AUTHORS for acknowledgements.
7 *
8 * This program is free software: you can redistribute it and/or modify
9 * it under the terms of the GNU Lesser General Public License as published by
10 * the Free Software Foundation, either version 3 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU Lesser General Public License
19 * along with this program. If not, see <https://www.gnu.org/licenses/>.
20 */
21
22 #if !defined( _SYSTEM_STRING_H )
23 #define _SYSTEM_STRING_H
24
25 #include "common.h"
26 #include "narrow_string.h"
27 #include "types.h"
28 #include "wide_string.h"
29
30 #if defined( _cplusplus )
31 extern "C" {
32 #endif
33
34 #if defined( HAVE_WIDE_SYSTEM_CHARACTER )
35
36 #if SIZEOF_WCHAR_T != 2
37 #error Unsupported wide system character size
38 #endif
39
40 /* Intermediate version of the macro required
41 * for correct evaluation predefined string
42 */
43 #define _SYSTEM_STRING_INTERMEDIATE( string ) \
44 L ## string
45
46 #define _SYSTEM_STRING( string ) \
47 _SYSTEM_STRING_INTERMEDIATE( string )
48
49 #define system_string_allocate( size ) \
50 wide_string_allocate( size )
51
52 #define system_string_reallocate( string, size ) \
53 wide_string_reallocate( string, size )
54
55 #define system_string_compare( destination, source, size ) \
56 wide_string_compare( destination, source, size )
57
58 #define system_string_compare_no_case( destination, source, size ) \
59 wide_string_compare_no_case( destination, source, size )
60
61 #define system_string_copy( destination, source, size ) \
62 wide_string_copy( destination, source, size )
63
64 #define system_string_length( string ) \
65 wide_string_length( string )
66
67 #define system_string_search_character( string, character, size ) \
68 wide_string_search_character( string, character, size )
69
70 #define system_string_search_character_reverse( string, character, size ) \
71 wide_string_search_character_reverse( string, character, size )
72
73 #define system_string_search_string( string, substring, size ) \
74 wide_string_search_string( string, substring, size )
75
76 #if defined( __BORLANDC__ ) && ( __BORLANDC__ < 0x0560 )
77 #define system_string_sprintf \
78 wide_string_snwprintf
79
80 #else
81 #define system_string_sprintf( string, size, format, ... ) \
82 wide_string_snwprintf( string, size, format, __VA_ARGS__ )
83 #endif
84
85 #if defined( __BORLANDC__ ) && ( __BORLANDC__ < 0x0560 )
86 #define system_string_vsnprintf \
87 wide_string_vsnwprintf
88
89 #else
90 #define system_string_vsnprintf( string, size, format, ... ) \
91 wide_string_vsnwprintf( string, size, format, __VA_ARGS__ )
92 #endif
93
94 #else
95
96 #define _SYSTEM_STRING( string ) \
97 string
98
99 #define system_string_allocate( size ) \
100 narrow_string_allocate( size )
101
102 #define system_string_reallocate( string, size ) \
103 narrow_string_reallocate( string, size )
104
105 #define system_string_compare( destination, source, size ) \
106 narrow_string_compare( destination, source, size )
107
108 #define system_string_compare_no_case( destination, source, size ) \
109 narrow_string_compare_no_case( destination, source, size )
110
111 #define system_string_copy( destination, source, size ) \
112 narrow_string_copy( destination, source, size )
113
114 #define system_string_length( string ) \
115 narrow_string_length( string )
116
117 #define system_string_search_character( string, character, size ) \
118 narrow_string_search_character( string, character, size )
119
120 #define system_string_search_character_reverse( string, character, size ) \
121 narrow_string_search_character_reverse( string, character, size )
122
123 #define system_string_search_string( string, substring, size ) \
124 narrow_string_search_string( string, substring, size )
125
126 #if defined( __BORLANDC__ ) && ( __BORLANDC__ < 0x0560 )
127 #define system_string_sprintf \
128 narrow_string_snprintf
129
130 #else
131 #define system_string_sprintf( string, size, format, ... ) \
132 narrow_string_snprintf( string, size, format, __VA_ARGS__ )
133 #endif
134
135 #if defined( __BORLANDC__ ) && ( __BORLANDC__ < 0x0560 )
136 #define system_string_vsnprintf \
137 narrow_string_vsnprintf
138
139 #else
140 #define system_string_vsnprintf( string, size, format, ... ) \
141 narrow_string_vsnprintf( string, size, format, __VA_ARGS__ )
142 #endif
143
144 #endif /* defined( HAVE_WIDE_SYSTEM_CHARACTER ) */
145
146 /* For backwards compatibility */
147 #define system_string_vsprintf system_string_vsnprintf
148
149 #if defined( _cplusplus )
150 }
151 #endif
152
153 #endif /* !defined( _SYSTEM_STRING_H ) */
154