1 /* string_funcs.h
2  *  Copyright (C) 2001-2010, Parrot Foundation.
3  *  Overview:
4  *     This is the api header for the string subsystem
5  *  Data Structure and Algorithms:
6  *  History:
7  *  Notes:
8  *  References:
9  */
10 
11 #ifndef PARROT_STRING_FUNCS_H_GUARD
12 #define PARROT_STRING_FUNCS_H_GUARD
13 
14 #include "parrot/compiler.h"
15 
16 #ifdef PARROT_IN_CORE
17 
18 /* Declarations of accessors */
19 
20 #define string_from_literal(i, s) Parrot_str_new((i), (s), (sizeof (s)-1))
21 #define Parrot_unCOW_string(i, s) PObj_COW_TEST((s)) ? \
22     Parrot_str_write_COW((i), (s)), (s) : (s)
23 
24 /* HEADERIZER BEGIN: src/string/api.c */
25 /* Don't modify between HEADERIZER BEGIN / HEADERIZER END.  Your changes will be lost. */
26 
27 PARROT_EXPORT
28 PARROT_CANNOT_RETURN_NULL
29 STRING * Parrot_str_bitwise_and(PARROT_INTERP,
30     ARGIN_NULLOK(const STRING *s1),
31     ARGIN_NULLOK(const STRING *s2))
32         __attribute__nonnull__(1);
33 
34 PARROT_EXPORT
35 PARROT_CANNOT_RETURN_NULL
36 STRING * Parrot_str_bitwise_not(PARROT_INTERP,
37     ARGIN_NULLOK(const STRING *s))
38         __attribute__nonnull__(1);
39 
40 PARROT_EXPORT
41 PARROT_CANNOT_RETURN_NULL
42 STRING * Parrot_str_bitwise_or(PARROT_INTERP,
43     ARGIN_NULLOK(const STRING *s1),
44     ARGIN_NULLOK(const STRING *s2))
45         __attribute__nonnull__(1);
46 
47 PARROT_EXPORT
48 PARROT_CANNOT_RETURN_NULL
49 STRING * Parrot_str_bitwise_xor(PARROT_INTERP,
50     ARGIN_NULLOK(const STRING *s1),
51     ARGIN_NULLOK(const STRING *s2))
52         __attribute__nonnull__(1);
53 
54 PARROT_EXPORT
55 PARROT_WARN_UNUSED_RESULT
56 INTVAL Parrot_str_boolean(PARROT_INTERP, ARGIN_NULLOK(const STRING *s))
57         __attribute__nonnull__(1);
58 
59 PARROT_EXPORT
60 PARROT_PURE_FUNCTION
61 UINTVAL Parrot_str_byte_length(PARROT_INTERP, ARGIN_NULLOK(const STRING *s));
62 
63 PARROT_EXPORT
64 PARROT_WARN_UNUSED_RESULT
65 PARROT_CAN_RETURN_NULL
66 STRING* Parrot_str_change_encoding(PARROT_INTERP,
67     ARGMOD_NULLOK(STRING *src),
68     INTVAL encoding_nr)
69         __attribute__nonnull__(1)
70         FUNC_MODIFIES(*src);
71 
72 PARROT_EXPORT
73 PARROT_CANNOT_RETURN_NULL
74 STRING * Parrot_str_chopn(PARROT_INTERP, ARGIN(const STRING *s), INTVAL n)
75         __attribute__nonnull__(1)
76         __attribute__nonnull__(2);
77 
78 PARROT_EXPORT
79 PARROT_CANNOT_RETURN_NULL
80 PARROT_WARN_UNUSED_RESULT
81 STRING * Parrot_str_chr(PARROT_INTERP, UINTVAL character)
82         __attribute__nonnull__(1);
83 
84 PARROT_EXPORT
85 PARROT_WARN_UNUSED_RESULT
86 INTVAL Parrot_str_compare(PARROT_INTERP,
87     ARGIN_NULLOK(const STRING *s1),
88     ARGIN_NULLOK(const STRING *s2))
89         __attribute__nonnull__(1);
90 
91 PARROT_EXPORT
92 PARROT_WARN_UNUSED_RESULT
93 PARROT_CANNOT_RETURN_NULL
94 STRING * Parrot_str_compose(PARROT_INTERP, ARGIN_NULLOK(const STRING *src))
95         __attribute__nonnull__(1);
96 
97 PARROT_EXPORT
98 PARROT_CANNOT_RETURN_NULL
99 STRING * Parrot_str_concat(PARROT_INTERP,
100     ARGIN_NULLOK(const STRING *a),
101     ARGIN_NULLOK(const STRING *b))
102         __attribute__nonnull__(1);
103 
104 PARROT_EXPORT
105 PARROT_CANNOT_RETURN_NULL
106 PARROT_WARN_UNUSED_RESULT
107 STRING * Parrot_str_copy(PARROT_INTERP, ARGIN_NULLOK(const STRING *s))
108         __attribute__nonnull__(1);
109 
110 PARROT_EXPORT
111 PARROT_PURE_FUNCTION
112 PARROT_CANNOT_RETURN_NULL
113 const char * Parrot_str_cstring(PARROT_INTERP, ARGIN(const STRING *str))
114         __attribute__nonnull__(2);
115 
116 PARROT_EXPORT
117 PARROT_CANNOT_RETURN_NULL
118 PARROT_MALLOC
119 STRING * Parrot_str_downcase(PARROT_INTERP, ARGIN_NULLOK(const STRING *s))
120         __attribute__nonnull__(1);
121 
122 PARROT_EXPORT
123 PARROT_WARN_UNUSED_RESULT
124 INTVAL Parrot_str_equal(PARROT_INTERP,
125     ARGIN_NULLOK(const STRING *s1),
126     ARGIN_NULLOK(const STRING *s2))
127         __attribute__nonnull__(1);
128 
129 PARROT_EXPORT
130 PARROT_CANNOT_RETURN_NULL
131 STRING * Parrot_str_escape(PARROT_INTERP, ARGIN_NULLOK(const STRING *src))
132         __attribute__nonnull__(1);
133 
134 PARROT_EXPORT
135 PARROT_CANNOT_RETURN_NULL
136 STRING * Parrot_str_escape_truncate(PARROT_INTERP,
137     ARGIN_NULLOK(const STRING *src),
138     UINTVAL limit)
139         __attribute__nonnull__(1);
140 
141 PARROT_EXPORT
142 PARROT_WARN_UNUSED_RESULT
143 INTVAL Parrot_str_find_cclass(PARROT_INTERP,
144     INTVAL flags,
145     ARGIN_NULLOK(const STRING *s),
146     UINTVAL offset,
147     UINTVAL count)
148         __attribute__nonnull__(1);
149 
150 PARROT_EXPORT
151 PARROT_WARN_UNUSED_RESULT
152 INTVAL Parrot_str_find_index(PARROT_INTERP,
153     ARGIN(const STRING *src),
154     ARGIN(const STRING *search),
155     INTVAL start)
156         __attribute__nonnull__(1)
157         __attribute__nonnull__(2)
158         __attribute__nonnull__(3);
159 
160 PARROT_EXPORT
161 PARROT_WARN_UNUSED_RESULT
162 INTVAL Parrot_str_find_not_cclass(PARROT_INTERP,
163     INTVAL flags,
164     ARGIN_NULLOK(const STRING *s),
165     UINTVAL offset,
166     UINTVAL count)
167         __attribute__nonnull__(1);
168 
169 PARROT_EXPORT
170 PARROT_WARN_UNUSED_RESULT
171 INTVAL Parrot_str_find_reverse_index(PARROT_INTERP,
172     ARGIN(const STRING *src),
173     ARGIN(const STRING *search),
174     INTVAL start)
175         __attribute__nonnull__(1)
176         __attribute__nonnull__(2)
177         __attribute__nonnull__(3);
178 
179 PARROT_EXPORT
180 void Parrot_str_finish(PARROT_INTERP)
181         __attribute__nonnull__(1);
182 
183 PARROT_EXPORT
184 PARROT_CANNOT_RETURN_NULL
185 STRING * Parrot_str_format_data(PARROT_INTERP,
186     ARGIN_FORMAT(const char *format),
187     ...)
188         __attribute__nonnull__(1)
189         __attribute__format__(2, 3)
190         __attribute__nonnull__(2);
191 
192 PARROT_EXPORT
193 void Parrot_str_free_cstring(ARGFREE(char *p));
194 
195 PARROT_EXPORT
196 PARROT_WARN_UNUSED_RESULT
197 PARROT_CANNOT_RETURN_NULL
198 STRING * Parrot_str_from_int(PARROT_INTERP, INTVAL i)
199         __attribute__nonnull__(1);
200 
201 PARROT_EXPORT
202 PARROT_WARN_UNUSED_RESULT
203 PARROT_CANNOT_RETURN_NULL
204 STRING * Parrot_str_from_num(PARROT_INTERP, FLOATVAL f)
205         __attribute__nonnull__(1);
206 
207 PARROT_EXPORT
208 PARROT_CANNOT_RETURN_NULL
209 STRING * Parrot_str_from_platform_cstring(PARROT_INTERP,
210     ARGIN_NULLOK(const char *c))
211         __attribute__nonnull__(1);
212 
213 PARROT_EXPORT
214 void Parrot_str_gc_register(PARROT_INTERP, ARGIN(STRING *s))
215         __attribute__nonnull__(1)
216         __attribute__nonnull__(2);
217 
218 PARROT_EXPORT
219 void Parrot_str_gc_unregister(PARROT_INTERP, ARGIN(STRING *s))
220         __attribute__nonnull__(1)
221         __attribute__nonnull__(2);
222 
223 PARROT_EXPORT
224 PARROT_WARN_UNUSED_RESULT
225 INTVAL Parrot_str_indexed(PARROT_INTERP, ARGIN(const STRING *s), INTVAL idx)
226         __attribute__nonnull__(1)
227         __attribute__nonnull__(2);
228 
229 PARROT_EXPORT
230 void Parrot_str_init(PARROT_INTERP)
231         __attribute__nonnull__(1);
232 
233 PARROT_EXPORT
234 PARROT_WARN_UNUSED_RESULT
235 INTVAL Parrot_str_is_cclass(PARROT_INTERP,
236     INTVAL flags,
237     ARGIN(const STRING *s),
238     UINTVAL offset)
239         __attribute__nonnull__(1)
240         __attribute__nonnull__(3);
241 
242 PARROT_EXPORT
243 PARROT_HOT
244 PARROT_PURE_FUNCTION
245 INTVAL Parrot_str_is_null(PARROT_INTERP, ARGIN_NULLOK(const STRING *s));
246 
247 PARROT_EXPORT
248 PARROT_WARN_UNUSED_RESULT
249 PARROT_CANNOT_RETURN_NULL
250 STRING* Parrot_str_join(PARROT_INTERP,
251     ARGIN_NULLOK(STRING *j),
252     ARGIN(PMC *ar))
253         __attribute__nonnull__(1)
254         __attribute__nonnull__(3);
255 
256 PARROT_EXPORT
257 PARROT_PURE_FUNCTION
258 PARROT_WARN_UNUSED_RESULT
259 INTVAL Parrot_str_length(PARROT_INTERP, ARGIN_NULLOK(const STRING *s));
260 
261 PARROT_EXPORT
262 PARROT_WARN_UNUSED_RESULT
263 PARROT_MALLOC
264 PARROT_CANNOT_RETURN_NULL
265 STRING * Parrot_str_new(PARROT_INTERP,
266     ARGIN_NULLOK(const char *buffer),
267     const UINTVAL len)
268         __attribute__nonnull__(1);
269 
270 PARROT_EXPORT
271 PARROT_WARN_UNUSED_RESULT
272 PARROT_CANNOT_RETURN_NULL
273 STRING * Parrot_str_new_constant(PARROT_INTERP, ARGIN(const char *buffer))
274         __attribute__nonnull__(1)
275         __attribute__nonnull__(2);
276 
277 PARROT_EXPORT
278 PARROT_WARN_UNUSED_RESULT
279 PARROT_MALLOC
280 PARROT_CANNOT_RETURN_NULL
281 STRING * Parrot_str_new_from_buffer(PARROT_INTERP,
282     ARGMOD(Parrot_Buffer *buffer),
283     const UINTVAL len)
284         __attribute__nonnull__(1)
285         __attribute__nonnull__(2)
286         FUNC_MODIFIES(*buffer);
287 
288 PARROT_EXPORT
289 PARROT_WARN_UNUSED_RESULT
290 PARROT_CANNOT_RETURN_NULL
291 STRING * Parrot_str_new_init(PARROT_INTERP,
292     ARGIN_NULLOK(const char *buffer),
293     UINTVAL len,
294     ARGIN(const STR_VTABLE *encoding),
295     UINTVAL flags)
296         __attribute__nonnull__(1)
297         __attribute__nonnull__(4);
298 
299 PARROT_EXPORT
300 PARROT_CANNOT_RETURN_NULL
301 STRING * Parrot_str_new_noinit(PARROT_INTERP, UINTVAL capacity)
302         __attribute__nonnull__(1);
303 
304 PARROT_EXPORT
305 PARROT_WARN_UNUSED_RESULT
306 INTVAL Parrot_str_not_equal(PARROT_INTERP,
307     ARGIN_NULLOK(const STRING *s1),
308     ARGIN_NULLOK(const STRING *s2))
309         __attribute__nonnull__(1);
310 
311 PARROT_EXPORT
312 void Parrot_str_pin(PARROT_INTERP, ARGMOD(STRING *s))
313         __attribute__nonnull__(2)
314         FUNC_MODIFIES(*s);
315 
316 PARROT_EXPORT
317 PARROT_IGNORABLE_RESULT
318 PARROT_CAN_RETURN_NULL
319 PARROT_PURE_FUNCTION
320 const STR_VTABLE * Parrot_str_rep_compatible(PARROT_INTERP,
321     ARGIN(const STRING *a),
322     ARGIN(const STRING *b))
323         __attribute__nonnull__(2)
324         __attribute__nonnull__(3);
325 
326 PARROT_EXPORT
327 PARROT_CANNOT_RETURN_NULL
328 STRING * Parrot_str_repeat(PARROT_INTERP,
329     ARGIN(const STRING *s),
330     UINTVAL num)
331         __attribute__nonnull__(1)
332         __attribute__nonnull__(2);
333 
334 PARROT_EXPORT
335 PARROT_CANNOT_RETURN_NULL
336 PARROT_WARN_UNUSED_RESULT
337 STRING * Parrot_str_replace(PARROT_INTERP,
338     ARGIN(const STRING *src),
339     INTVAL offset,
340     INTVAL length,
341     ARGIN(const STRING *rep))
342         __attribute__nonnull__(1)
343         __attribute__nonnull__(2)
344         __attribute__nonnull__(5);
345 
346 PARROT_EXPORT
347 PARROT_CANNOT_RETURN_NULL
348 STRING * Parrot_str_reverse(PARROT_INTERP, ARGIN(const STRING *src))
349         __attribute__nonnull__(1)
350         __attribute__nonnull__(2);
351 
352 PARROT_EXPORT
353 PARROT_WARN_UNUSED_RESULT
354 PARROT_CANNOT_RETURN_NULL
355 PMC* Parrot_str_split(PARROT_INTERP,
356     ARGIN_NULLOK(const STRING *delim),
357     ARGIN_NULLOK(const STRING *str))
358         __attribute__nonnull__(1);
359 
360 PARROT_EXPORT
361 PARROT_CANNOT_RETURN_NULL
362 PARROT_WARN_UNUSED_RESULT
363 STRING * Parrot_str_substr(PARROT_INTERP,
364     ARGIN_NULLOK(const STRING *src),
365     INTVAL offset,
366     INTVAL length)
367         __attribute__nonnull__(1);
368 
369 PARROT_EXPORT
370 PARROT_CANNOT_RETURN_NULL
371 PARROT_MALLOC
372 STRING * Parrot_str_titlecase(PARROT_INTERP, ARGIN_NULLOK(const STRING *s))
373         __attribute__nonnull__(1);
374 
375 PARROT_EXPORT
376 PARROT_CANNOT_RETURN_NULL
377 char * Parrot_str_to_cstring(PARROT_INTERP, ARGIN(const STRING *s))
378         __attribute__nonnull__(1)
379         __attribute__nonnull__(2);
380 
381 PARROT_EXPORT
382 PARROT_CANNOT_RETURN_NULL
383 char * Parrot_str_to_encoded_cstring(PARROT_INTERP,
384     ARGIN(const STRING *s),
385     ARGIN(const STR_VTABLE *enc))
386         __attribute__nonnull__(1)
387         __attribute__nonnull__(2)
388         __attribute__nonnull__(3);
389 
390 PARROT_EXPORT
391 PARROT_WARN_UNUSED_RESULT
392 size_t Parrot_str_to_hashval(PARROT_INTERP, ARGIN_NULLOK(const STRING *s))
393         __attribute__nonnull__(1);
394 
395 PARROT_EXPORT
396 PARROT_WARN_UNUSED_RESULT
397 INTVAL Parrot_str_to_int(PARROT_INTERP, ARGIN_NULLOK(const STRING *s))
398         __attribute__nonnull__(1);
399 
400 PARROT_EXPORT
401 PARROT_WARN_UNUSED_RESULT
402 FLOATVAL Parrot_str_to_num(PARROT_INTERP, ARGIN_NULLOK(const STRING *s))
403         __attribute__nonnull__(1);
404 
405 PARROT_EXPORT
406 PARROT_CAN_RETURN_NULL
407 PARROT_WARN_UNUSED_RESULT
408 char * Parrot_str_to_platform_cstring(PARROT_INTERP, ARGIN(const STRING *s))
409         __attribute__nonnull__(1)
410         __attribute__nonnull__(2);
411 
412 PARROT_EXPORT
413 PARROT_CANNOT_RETURN_NULL
414 STRING * Parrot_str_unescape(PARROT_INTERP,
415     ARGIN(const char *cstring),
416     char delimiter,
417     ARGIN_NULLOK(const char *enc_char))
418         __attribute__nonnull__(1)
419         __attribute__nonnull__(2);
420 
421 PARROT_EXPORT
422 PARROT_CANNOT_RETURN_NULL
423 STRING * Parrot_str_unescape_string(PARROT_INTERP,
424     ARGIN(const STRING *src),
425     ARGIN(const STR_VTABLE *encoding),
426     UINTVAL flags)
427         __attribute__nonnull__(1)
428         __attribute__nonnull__(2)
429         __attribute__nonnull__(3);
430 
431 PARROT_EXPORT
432 void Parrot_str_unpin(PARROT_INTERP, ARGMOD(STRING *s))
433         __attribute__nonnull__(1)
434         __attribute__nonnull__(2)
435         FUNC_MODIFIES(*s);
436 
437 PARROT_EXPORT
438 PARROT_CANNOT_RETURN_NULL
439 PARROT_MALLOC
440 STRING * Parrot_str_upcase(PARROT_INTERP, ARGIN_NULLOK(const STRING *s))
441         __attribute__nonnull__(1);
442 
443 PARROT_WARN_UNUSED_RESULT
444 PARROT_CANNOT_RETURN_NULL
445 STRING * Parrot_str_clone(PARROT_INTERP, ARGIN_NULLOK(const STRING *s))
446         __attribute__nonnull__(1);
447 
448 PARROT_WARN_UNUSED_RESULT
449 PARROT_CANNOT_RETURN_NULL
450 STRING * Parrot_str_extract_chars(PARROT_INTERP,
451     ARGIN(const char *buffer),
452     UINTVAL len,
453     INTVAL chars,
454     ARGIN(const STR_VTABLE *encoding))
455         __attribute__nonnull__(1)
456         __attribute__nonnull__(2)
457         __attribute__nonnull__(5);
458 
459 PARROT_WARN_UNUSED_RESULT
460 PARROT_CANNOT_RETURN_NULL
461 STRING * Parrot_str_from_int_base(PARROT_INTERP,
462     ARGOUT(char *tc),
463     HUGEINTVAL num,
464     unsigned int base)
465         __attribute__nonnull__(1)
466         __attribute__nonnull__(2)
467         FUNC_MODIFIES(*tc);
468 
469 PARROT_WARN_UNUSED_RESULT
470 PARROT_CANNOT_RETURN_NULL
471 STRING* Parrot_str_from_uint(PARROT_INTERP,
472     ARGOUT(char *tc),
473     UHUGEINTVAL num,
474     unsigned int base,
475     int minus)
476         __attribute__nonnull__(1)
477         __attribute__nonnull__(2)
478         FUNC_MODIFIES(*tc);
479 
480 INTVAL Parrot_str_iter_index(PARROT_INTERP,
481     ARGIN(const STRING *src),
482     ARGMOD(String_iter *start),
483     ARGOUT(String_iter *end),
484     ARGIN(const STRING *search))
485         __attribute__nonnull__(1)
486         __attribute__nonnull__(2)
487         __attribute__nonnull__(3)
488         __attribute__nonnull__(4)
489         __attribute__nonnull__(5)
490         FUNC_MODIFIES(*start)
491         FUNC_MODIFIES(*end);
492 
493 PARROT_CANNOT_RETURN_NULL
494 PARROT_WARN_UNUSED_RESULT
495 STRING * Parrot_str_iter_substr(PARROT_INTERP,
496     ARGIN(const STRING *str),
497     ARGIN(const String_iter *l),
498     ARGIN_NULLOK(const String_iter *r))
499         __attribute__nonnull__(1)
500         __attribute__nonnull__(2)
501         __attribute__nonnull__(3);
502 
503 PARROT_WARN_UNUSED_RESULT
504 PARROT_CANNOT_RETURN_NULL
505 STRING * Parrot_str_new_from_cstring(PARROT_INTERP,
506     ARGIN_NULLOK(const char *buffer),
507     ARGIN_NULLOK(STRING *encodingname))
508         __attribute__nonnull__(1);
509 
510 #define ASSERT_ARGS_Parrot_str_bitwise_and __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
511        PARROT_ASSERT_ARG(interp))
512 #define ASSERT_ARGS_Parrot_str_bitwise_not __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
513        PARROT_ASSERT_ARG(interp))
514 #define ASSERT_ARGS_Parrot_str_bitwise_or __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
515        PARROT_ASSERT_ARG(interp))
516 #define ASSERT_ARGS_Parrot_str_bitwise_xor __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
517        PARROT_ASSERT_ARG(interp))
518 #define ASSERT_ARGS_Parrot_str_boolean __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
519        PARROT_ASSERT_ARG(interp))
520 #define ASSERT_ARGS_Parrot_str_byte_length __attribute__unused__ int _ASSERT_ARGS_CHECK = (0)
521 #define ASSERT_ARGS_Parrot_str_change_encoding __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
522        PARROT_ASSERT_ARG(interp))
523 #define ASSERT_ARGS_Parrot_str_chopn __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
524        PARROT_ASSERT_ARG(interp) \
525     , PARROT_ASSERT_ARG(s))
526 #define ASSERT_ARGS_Parrot_str_chr __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
527        PARROT_ASSERT_ARG(interp))
528 #define ASSERT_ARGS_Parrot_str_compare __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
529        PARROT_ASSERT_ARG(interp))
530 #define ASSERT_ARGS_Parrot_str_compose __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
531        PARROT_ASSERT_ARG(interp))
532 #define ASSERT_ARGS_Parrot_str_concat __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
533        PARROT_ASSERT_ARG(interp))
534 #define ASSERT_ARGS_Parrot_str_copy __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
535        PARROT_ASSERT_ARG(interp))
536 #define ASSERT_ARGS_Parrot_str_cstring __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
537        PARROT_ASSERT_ARG(str))
538 #define ASSERT_ARGS_Parrot_str_downcase __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
539        PARROT_ASSERT_ARG(interp))
540 #define ASSERT_ARGS_Parrot_str_equal __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
541        PARROT_ASSERT_ARG(interp))
542 #define ASSERT_ARGS_Parrot_str_escape __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
543        PARROT_ASSERT_ARG(interp))
544 #define ASSERT_ARGS_Parrot_str_escape_truncate __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
545        PARROT_ASSERT_ARG(interp))
546 #define ASSERT_ARGS_Parrot_str_find_cclass __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
547        PARROT_ASSERT_ARG(interp))
548 #define ASSERT_ARGS_Parrot_str_find_index __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
549        PARROT_ASSERT_ARG(interp) \
550     , PARROT_ASSERT_ARG(src) \
551     , PARROT_ASSERT_ARG(search))
552 #define ASSERT_ARGS_Parrot_str_find_not_cclass __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
553        PARROT_ASSERT_ARG(interp))
554 #define ASSERT_ARGS_Parrot_str_find_reverse_index __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
555        PARROT_ASSERT_ARG(interp) \
556     , PARROT_ASSERT_ARG(src) \
557     , PARROT_ASSERT_ARG(search))
558 #define ASSERT_ARGS_Parrot_str_finish __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
559        PARROT_ASSERT_ARG(interp))
560 #define ASSERT_ARGS_Parrot_str_format_data __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
561        PARROT_ASSERT_ARG(interp) \
562     , PARROT_ASSERT_ARG(format))
563 #define ASSERT_ARGS_Parrot_str_free_cstring __attribute__unused__ int _ASSERT_ARGS_CHECK = (0)
564 #define ASSERT_ARGS_Parrot_str_from_int __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
565        PARROT_ASSERT_ARG(interp))
566 #define ASSERT_ARGS_Parrot_str_from_num __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
567        PARROT_ASSERT_ARG(interp))
568 #define ASSERT_ARGS_Parrot_str_from_platform_cstring \
569      __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
570        PARROT_ASSERT_ARG(interp))
571 #define ASSERT_ARGS_Parrot_str_gc_register __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
572        PARROT_ASSERT_ARG(interp) \
573     , PARROT_ASSERT_ARG(s))
574 #define ASSERT_ARGS_Parrot_str_gc_unregister __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
575        PARROT_ASSERT_ARG(interp) \
576     , PARROT_ASSERT_ARG(s))
577 #define ASSERT_ARGS_Parrot_str_indexed __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
578        PARROT_ASSERT_ARG(interp) \
579     , PARROT_ASSERT_ARG(s))
580 #define ASSERT_ARGS_Parrot_str_init __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
581        PARROT_ASSERT_ARG(interp))
582 #define ASSERT_ARGS_Parrot_str_is_cclass __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
583        PARROT_ASSERT_ARG(interp) \
584     , PARROT_ASSERT_ARG(s))
585 #define ASSERT_ARGS_Parrot_str_is_null __attribute__unused__ int _ASSERT_ARGS_CHECK = (0)
586 #define ASSERT_ARGS_Parrot_str_join __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
587        PARROT_ASSERT_ARG(interp) \
588     , PARROT_ASSERT_ARG(ar))
589 #define ASSERT_ARGS_Parrot_str_length __attribute__unused__ int _ASSERT_ARGS_CHECK = (0)
590 #define ASSERT_ARGS_Parrot_str_new __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
591        PARROT_ASSERT_ARG(interp))
592 #define ASSERT_ARGS_Parrot_str_new_constant __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
593        PARROT_ASSERT_ARG(interp) \
594     , PARROT_ASSERT_ARG(buffer))
595 #define ASSERT_ARGS_Parrot_str_new_from_buffer __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
596        PARROT_ASSERT_ARG(interp) \
597     , PARROT_ASSERT_ARG(buffer))
598 #define ASSERT_ARGS_Parrot_str_new_init __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
599        PARROT_ASSERT_ARG(interp) \
600     , PARROT_ASSERT_ARG(encoding))
601 #define ASSERT_ARGS_Parrot_str_new_noinit __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
602        PARROT_ASSERT_ARG(interp))
603 #define ASSERT_ARGS_Parrot_str_not_equal __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
604        PARROT_ASSERT_ARG(interp))
605 #define ASSERT_ARGS_Parrot_str_pin __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
606        PARROT_ASSERT_ARG(s))
607 #define ASSERT_ARGS_Parrot_str_rep_compatible __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
608        PARROT_ASSERT_ARG(a) \
609     , PARROT_ASSERT_ARG(b))
610 #define ASSERT_ARGS_Parrot_str_repeat __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
611        PARROT_ASSERT_ARG(interp) \
612     , PARROT_ASSERT_ARG(s))
613 #define ASSERT_ARGS_Parrot_str_replace __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
614        PARROT_ASSERT_ARG(interp) \
615     , PARROT_ASSERT_ARG(src) \
616     , PARROT_ASSERT_ARG(rep))
617 #define ASSERT_ARGS_Parrot_str_reverse __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
618        PARROT_ASSERT_ARG(interp) \
619     , PARROT_ASSERT_ARG(src))
620 #define ASSERT_ARGS_Parrot_str_split __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
621        PARROT_ASSERT_ARG(interp))
622 #define ASSERT_ARGS_Parrot_str_substr __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
623        PARROT_ASSERT_ARG(interp))
624 #define ASSERT_ARGS_Parrot_str_titlecase __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
625        PARROT_ASSERT_ARG(interp))
626 #define ASSERT_ARGS_Parrot_str_to_cstring __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
627        PARROT_ASSERT_ARG(interp) \
628     , PARROT_ASSERT_ARG(s))
629 #define ASSERT_ARGS_Parrot_str_to_encoded_cstring __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
630        PARROT_ASSERT_ARG(interp) \
631     , PARROT_ASSERT_ARG(s) \
632     , PARROT_ASSERT_ARG(enc))
633 #define ASSERT_ARGS_Parrot_str_to_hashval __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
634        PARROT_ASSERT_ARG(interp))
635 #define ASSERT_ARGS_Parrot_str_to_int __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
636        PARROT_ASSERT_ARG(interp))
637 #define ASSERT_ARGS_Parrot_str_to_num __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
638        PARROT_ASSERT_ARG(interp))
639 #define ASSERT_ARGS_Parrot_str_to_platform_cstring \
640      __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
641        PARROT_ASSERT_ARG(interp) \
642     , PARROT_ASSERT_ARG(s))
643 #define ASSERT_ARGS_Parrot_str_unescape __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
644        PARROT_ASSERT_ARG(interp) \
645     , PARROT_ASSERT_ARG(cstring))
646 #define ASSERT_ARGS_Parrot_str_unescape_string __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
647        PARROT_ASSERT_ARG(interp) \
648     , PARROT_ASSERT_ARG(src) \
649     , PARROT_ASSERT_ARG(encoding))
650 #define ASSERT_ARGS_Parrot_str_unpin __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
651        PARROT_ASSERT_ARG(interp) \
652     , PARROT_ASSERT_ARG(s))
653 #define ASSERT_ARGS_Parrot_str_upcase __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
654        PARROT_ASSERT_ARG(interp))
655 #define ASSERT_ARGS_Parrot_str_clone __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
656        PARROT_ASSERT_ARG(interp))
657 #define ASSERT_ARGS_Parrot_str_extract_chars __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
658        PARROT_ASSERT_ARG(interp) \
659     , PARROT_ASSERT_ARG(buffer) \
660     , PARROT_ASSERT_ARG(encoding))
661 #define ASSERT_ARGS_Parrot_str_from_int_base __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
662        PARROT_ASSERT_ARG(interp) \
663     , PARROT_ASSERT_ARG(tc))
664 #define ASSERT_ARGS_Parrot_str_from_uint __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
665        PARROT_ASSERT_ARG(interp) \
666     , PARROT_ASSERT_ARG(tc))
667 #define ASSERT_ARGS_Parrot_str_iter_index __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
668        PARROT_ASSERT_ARG(interp) \
669     , PARROT_ASSERT_ARG(src) \
670     , PARROT_ASSERT_ARG(start) \
671     , PARROT_ASSERT_ARG(end) \
672     , PARROT_ASSERT_ARG(search))
673 #define ASSERT_ARGS_Parrot_str_iter_substr __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
674        PARROT_ASSERT_ARG(interp) \
675     , PARROT_ASSERT_ARG(str) \
676     , PARROT_ASSERT_ARG(l))
677 #define ASSERT_ARGS_Parrot_str_new_from_cstring __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
678        PARROT_ASSERT_ARG(interp))
679 /* Don't modify between HEADERIZER BEGIN / HEADERIZER END.  Your changes will be lost. */
680 /* HEADERIZER END: src/string/api.c */
681 
682 /* HEADERIZER BEGIN: src/string/sprintf.c */
683 /* Don't modify between HEADERIZER BEGIN / HEADERIZER END.  Your changes will be lost. */
684 
685 PARROT_EXPORT
686 int Parrot_eprintf(NULLOK_INTERP, ARGIN_FORMAT(const char *s), ...)
687         __attribute__format__(2, 3)
688         __attribute__nonnull__(2);
689 
690 PARROT_EXPORT
691 int Parrot_fprintf(PARROT_INTERP,
692     ARGIN(Parrot_PMC pio),
693     ARGIN_FORMAT(const char *s),
694     ...)
695         __attribute__nonnull__(1)
696         __attribute__nonnull__(2)
697         __attribute__format__(3, 4)
698         __attribute__nonnull__(3);
699 
700 PARROT_EXPORT
701 int Parrot_printf(NULLOK_INTERP, ARGIN_FORMAT(const char *s), ...)
702         __attribute__format__(2, 3)
703         __attribute__nonnull__(2);
704 
705 PARROT_EXPORT
706 PARROT_WARN_UNUSED_RESULT
707 PARROT_CANNOT_RETURN_NULL
708 STRING * Parrot_psprintf(PARROT_INTERP,
709     ARGIN(STRING *pat),
710     ARGOUT(PMC *ary))
711         __attribute__nonnull__(1)
712         __attribute__nonnull__(2)
713         __attribute__nonnull__(3)
714         FUNC_MODIFIES(*ary);
715 
716 PARROT_EXPORT
717 PARROT_IGNORABLE_RESULT
718 int /*@alt void@*/
719 Parrot_secret_snprintf(
720     ARGOUT(char *buffer),
721     size_t len,
722     ARGIN_FORMAT(const char *format),
723     ...)
724         __attribute__nonnull__(1)
725         __attribute__format__(3, 4)
726         __attribute__nonnull__(3)
727         FUNC_MODIFIES(*buffer);
728 
729 PARROT_EXPORT
730 void Parrot_snprintf(PARROT_INTERP,
731     ARGOUT(char *targ),
732     size_t len,
733     ARGIN_FORMAT(const char *pat),
734     ...)
735         __attribute__nonnull__(1)
736         __attribute__nonnull__(2)
737         __attribute__format__(4, 5)
738         __attribute__nonnull__(4)
739         FUNC_MODIFIES(*targ);
740 
741 PARROT_EXPORT
742 PARROT_WARN_UNUSED_RESULT
743 PARROT_CANNOT_RETURN_NULL
744 STRING * Parrot_sprintf_c(PARROT_INTERP, ARGIN_FORMAT(const char *pat), ...)
745         __attribute__nonnull__(1)
746         __attribute__format__(2, 3)
747         __attribute__nonnull__(2);
748 
749 PARROT_EXPORT
750 PARROT_WARN_UNUSED_RESULT
751 PARROT_CANNOT_RETURN_NULL
752 STRING * Parrot_sprintf_s(PARROT_INTERP, ARGIN(STRING *pat), ...)
753         __attribute__nonnull__(1)
754         __attribute__nonnull__(2);
755 
756 PARROT_EXPORT
757 int Parrot_vfprintf(PARROT_INTERP,
758     ARGIN(Parrot_PMC pio),
759     ARGIN_FORMAT(const char *s),
760     va_list args)
761         __attribute__nonnull__(1)
762         __attribute__nonnull__(2)
763         __attribute__format__(3, 0)
764         __attribute__nonnull__(3);
765 
766 PARROT_EXPORT
767 void Parrot_vsnprintf(PARROT_INTERP,
768     ARGMOD(char *targ),
769     size_t len,
770     ARGIN_FORMAT(const char *pat),
771     va_list args)
772         __attribute__nonnull__(1)
773         __attribute__nonnull__(2)
774         __attribute__format__(4, 0)
775         __attribute__nonnull__(4)
776         FUNC_MODIFIES(*targ);
777 
778 PARROT_EXPORT
779 PARROT_CANNOT_RETURN_NULL
780 PARROT_WARN_UNUSED_RESULT
781 STRING * Parrot_vsprintf_c(PARROT_INTERP,
782     ARGIN_FORMAT(const char *pat),
783     va_list args)
784         __attribute__nonnull__(1)
785         __attribute__format__(2, 0)
786         __attribute__nonnull__(2);
787 
788 PARROT_EXPORT
789 PARROT_WARN_UNUSED_RESULT
790 PARROT_CANNOT_RETURN_NULL
791 STRING * Parrot_vsprintf_s(PARROT_INTERP, ARGIN(STRING *pat), va_list args)
792         __attribute__nonnull__(1)
793         __attribute__nonnull__(2);
794 
795 #define ASSERT_ARGS_Parrot_eprintf __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
796        PARROT_ASSERT_ARG(s))
797 #define ASSERT_ARGS_Parrot_fprintf __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
798        PARROT_ASSERT_ARG(interp) \
799     , PARROT_ASSERT_ARG(pio) \
800     , PARROT_ASSERT_ARG(s))
801 #define ASSERT_ARGS_Parrot_printf __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
802        PARROT_ASSERT_ARG(s))
803 #define ASSERT_ARGS_Parrot_psprintf __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
804        PARROT_ASSERT_ARG(interp) \
805     , PARROT_ASSERT_ARG(pat) \
806     , PARROT_ASSERT_ARG(ary))
807 #define ASSERT_ARGS_Parrot_secret_snprintf __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
808        PARROT_ASSERT_ARG(buffer) \
809     , PARROT_ASSERT_ARG(format))
810 #define ASSERT_ARGS_Parrot_snprintf __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
811        PARROT_ASSERT_ARG(interp) \
812     , PARROT_ASSERT_ARG(targ) \
813     , PARROT_ASSERT_ARG(pat))
814 #define ASSERT_ARGS_Parrot_sprintf_c __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
815        PARROT_ASSERT_ARG(interp) \
816     , PARROT_ASSERT_ARG(pat))
817 #define ASSERT_ARGS_Parrot_sprintf_s __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
818        PARROT_ASSERT_ARG(interp) \
819     , PARROT_ASSERT_ARG(pat))
820 #define ASSERT_ARGS_Parrot_vfprintf __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
821        PARROT_ASSERT_ARG(interp) \
822     , PARROT_ASSERT_ARG(pio) \
823     , PARROT_ASSERT_ARG(s))
824 #define ASSERT_ARGS_Parrot_vsnprintf __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
825        PARROT_ASSERT_ARG(interp) \
826     , PARROT_ASSERT_ARG(targ) \
827     , PARROT_ASSERT_ARG(pat))
828 #define ASSERT_ARGS_Parrot_vsprintf_c __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
829        PARROT_ASSERT_ARG(interp) \
830     , PARROT_ASSERT_ARG(pat))
831 #define ASSERT_ARGS_Parrot_vsprintf_s __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
832        PARROT_ASSERT_ARG(interp) \
833     , PARROT_ASSERT_ARG(pat))
834 /* Don't modify between HEADERIZER BEGIN / HEADERIZER END.  Your changes will be lost. */
835 /* HEADERIZER END: src/string/sprintf.c */
836 
837 #endif /* PARROT_IN_CORE */
838 #endif /* PARROT_STRING_FUNCS_H_GUARD */
839 
840 /*
841  * Local variables:
842  *   c-file-style: "parrot"
843  * End:
844  * vim: expandtab shiftwidth=4 cinoptions='\:2=2' :
845  */
846