eĿlipsis
a language independent preprocessor
 
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Loading...
Searching...
No Matches
ellipsis-sarray.h
Go to the documentation of this file.
1
8#ifndef ELLIPSIS_SARRAY_H
9#define ELLIPSIS_SARRAY_H 1
10
11#include <stddef.h>
12
17
18#include <stddef.h>
19#include <string.h>
20#include <stdlib.h>
22
23extern thread_local bool volatile ellipsis‿contracts‿ignore‿dynamic;
24extern thread_local bool volatile ellipsis‿contracts‿proceed‿dynamic;
25extern thread_local bool volatile ellipsis‿contracts‿verbose‿dynamic;
26
28
29#include <stdio.h>
30#include <stdlib.h>
31#include <stdint.h>
32
33#define STRINGIFY(...) STRINGIFY_(__VA_ARGS__)
34#define STRINGIFY_(...) #__VA_ARGS__
35
36#define ELLIPSIS_CONTRACT_VIOLATION(COUNT, VERB, CTYPE, CSTR, ...) \
37({\
38 static char const contract_format_ ## COUNT[] = \
39 __FILE__ ":" STRINGIFY(__LINE__) ": violation of " CTYPE " `" CSTR "`" __VA_OPT__(", ") __VA_ARGS__ "\n";\
40 (VERB \
41 ? fputs(contract_format_ ## COUNT, stderr) \
42 : 0);\
43 })
44
45#define ELLIPSIS_CONTRACT_IMPL(COUNT, COND, ACTION, VERB, CSTR, CTYPE, ...) \
46(((false) || (COND)) \
47 ? (void)0 \
48 : (ELLIPSIS_CONTRACT_VIOLATION(COUNT, VERB, CTYPE, CSTR __VA_OPT__(,) __VA_ARGS__) \
49 , ((false) \
50 ? (void)0 \
51 : ACTION())))
52
53#define ELLIPSIS_TO_VOIDS(...) ((void*)((uintptr_t)((__VA_ARGS__)-(__VA_ARGS__))))
54
55#define ELLIPSIS_TEST_ICE(...) (false ? ELLIPSIS_TO_VOIDS(__VA_ARGS__) : (ellipsis‿contracts‿is_ice*)nullptr)
56
57#define ELLIPSIS_CONTRACT_ICE_OR_TRUE(...) \
58 _Generic( \
59 ELLIPSIS_TEST_ICE(__VA_ARGS__), \
60 ellipsis‿contracts‿is_ice*: (__VA_ARGS__), \
61 default: true)
62
63#define ELLIPSIS_CONTRACT_CHECK_STATIC(CTYPE, COND, CSTR, ...) \
64 ({\
65 static_assert(ELLIPSIS_CONTRACT_ICE_OR_TRUE(COND), \
66 "compile time violation of " CTYPE " " CSTR \
67 __VA_OPT__(", ") __VA_ARGS__ );\
68 })
69
70#define ELLIPSIS_CONTRACT(COUNT, COND, ACTION, VERB, CSTR, CTYPE, ...) \
71 \
72 do { \
73 _Generic( \
74 ELLIPSIS_TEST_ICE(COND), \
75 ellipsis‿contracts‿is_ice*: ELLIPSIS_CONTRACT_CHECK_STATIC(CTYPE, COND, CSTR __VA_OPT__(,) __VA_ARGS__), \
76 default: ELLIPSIS_CONTRACT_IMPL(COUNT, COND, ACTION, VERB, CSTR, CTYPE __VA_OPT__(,) __VA_ARGS__));\
77 } while(false)
78
141#ifndef DOXYGEN_SPECIAL
142 union {
143#endif
149 size_t const length;
155 [[deprecated("use const member length instead")]]
157#ifndef DOXYGEN_SPECIAL
158 };
159#endif
166 size_t const capacity;
175};
176
177#define ELLIPSIS_SARRAY_OVERLAY(N) \
178 union {\
179 struct {\
180 size_t const length;\
181 size_t const padding;\
182 unsigned const :(offsetof(ellipsis‿sarray, array)-2*sizeof(size_t));\
183 ellipsis‿sarray‿base array[N];\
184 };\
185 ellipsis‿sarray fa;\
186 }
187
188#define ELLIPSIS_SARRAY_STATIC(N, ...) \
189 (({\
190 static const ELLIPSIS_SARRAY_OVERLAY( \
191 sizeof((ellipsis‿sarray‿base[]){__VA_ARGS__ }) \
192 /sizeof(ellipsis‿sarray‿base)) \
193 __LOC_ID_1_1 = {\
194 .length = (N), \
195 .array = {__VA_ARGS__ }, \
196 };&__LOC_ID_1_1;})->fa)
197
218#if __clang__ && (__clang_major__ < 30)
219#define ELLIPSIS_SARRAY_LITERAL_LOCAL(N, ...) ELLIPSIS_SARRAY_STATIC(N, __VA_ARGS__)
220#else
221#define ELLIPSIS_SARRAY_LITERAL_LOCAL(N, ...) \
222 ((static const ELLIPSIS_SARRAY_OVERLAY( \
223 sizeof((ellipsis‿sarray‿base[]){__VA_ARGS__ }) \
224 /sizeof(ellipsis‿sarray‿base))) \
225 {\
226 .length = (N), \
227 .array = {__VA_ARGS__ }, \
228 }.fa)
229#endif
230
231#define ELLIPSIS_SARRAY_LITERAL_GLOBAL(N, ...) \
232 ((const ELLIPSIS_SARRAY_OVERLAY( \
233 sizeof((ellipsis‿sarray‿base[]){__VA_ARGS__ }) \
234 /sizeof(ellipsis‿sarray‿base))) \
235 {\
236 .length = (N), \
237 .array = {__VA_ARGS__ }, \
238 }.fa)
239
240#define ELLIPSIS_SARRAY_LITERAL ELLIPSIS_SARRAY_LITERAL_LOCAL
241
257
266inline void ellipsis‿sarray‿move(ellipsis‿sarray* __LOC_ID_0_1[restrict static 1], ellipsis‿sarray**restrict __LOC_ID_0_2) {
267 if (*__LOC_ID_0_1)
268 ellipsis‿sarray‿delete((void*)*__LOC_ID_0_1);
269 if (__LOC_ID_0_2) {
270 *__LOC_ID_0_1= *__LOC_ID_0_2;
271 *__LOC_ID_0_2= nullptr;
272 } else {
273 *__LOC_ID_0_1= nullptr;
274 }
275
276}
277
286inline void ellipsis‿sarray‿cmove(ellipsis‿sarray const* __LOC_ID_0_3[restrict static 1], ellipsis‿sarray const**restrict __LOC_ID_0_4) {
287 if (*__LOC_ID_0_3)
288 ellipsis‿sarray‿delete((void*)*__LOC_ID_0_3);
289 if (__LOC_ID_0_4) {
290 *__LOC_ID_0_3= *__LOC_ID_0_4;
291 *__LOC_ID_0_4= nullptr;
292 } else {
293 *__LOC_ID_0_3= nullptr;
294 }
295
296}
297
305GNU_ATTR_RETURNS_NONNULL STDC_ATTR_NODISCARD("functions for " "ellipsis∷sarray" " need to keep pointer returns")
306inline
308 typeof(ellipsis‿sarray*) DEFER_LOC_ID_0_1;
309 if (__func__[0] == 'm' && __func__[1] == 'a' && __func__[2] == 'i' && __func__[3] == 'n' && !__func__[4]) {
310 DEFER_LOC_ID_0_1 = (typeof(ellipsis‿sarray*)) {};
311 }
312 [[__maybe_unused__]] register unsigned DEFER_LOC_ID_0_2 = 1U;
313 [[__maybe_unused__]] register bool defer_return_flag = false;
314 if (false) {
315 DEFER_ID_1_1:
316 goto DEFER_END_ID_1_2;
317 } else {
318 (void)0 ;
319 /* defer */
320 [[__maybe_unused__, __deprecated__("dummy variable for better diagnostics")]]
321 unsigned (*DEFER_LOC_ID_1_1)[DEFER_LOC_ID_0_2] = {};
322 if (false) {
323 DEFER_ID_1_2: {
324 [[__maybe_unused__, __deprecated__("invalid termination of a deferred block")]]
325 register bool const defer_return_flag = false, defer_break_flag = false, defer_continue_flag = false;
326 {ELLIPSIS_CONTRACT(1, ((typeof(DEFER_LOC_ID_0_1))DEFER_LOC_ID_0_1), unreachable, false, "((typeof(DEFER_LOC_ID_0_1))DEFER_LOC_ID_0_1)", "assumption", "out of memory when growing an FA array");}
327 }
328 goto DEFER_ID_1_1;
329 } else
330 (void)0 ;
332 do {
333 /* return mode 2 */
334 defer_return_flag = true;
335 DEFER_LOC_ID_0_1 = ellipsis‿sarray‿alloc‿_Insta(len);
336 goto DEFER_ID_1_2;
337 } while(false);
338
339 goto DEFER_ID_1_2;
340 }
341[[__maybe_unused__]] DEFER_END_ID_1_2:;
342 return DEFER_LOC_ID_0_1;
343}
344
360GNU_ATTR_RETURNS_NONNULL STDC_ATTR_NODISCARD("functions for " "ellipsis∷sarray" " need to keep pointer returns")
361inline
363 typeof(ellipsis‿sarray*) DEFER_LOC_ID_0_1;
364 if (__func__[0] == 'm' && __func__[1] == 'a' && __func__[2] == 'i' && __func__[3] == 'n' && !__func__[4]) {
365 DEFER_LOC_ID_0_1 = (typeof(ellipsis‿sarray*)) {};
366 }
367 [[__maybe_unused__]] register unsigned DEFER_LOC_ID_0_2 = 1U;
368 [[__maybe_unused__]] register bool defer_return_flag = false;
369 if (false) {
370 DEFER_ID_1_3:
371 goto DEFER_END_ID_1_4;
372 } else {
373 (void)0 ;
374 /* defer */
375 [[__maybe_unused__, __deprecated__("dummy variable for better diagnostics")]]
376 unsigned (*DEFER_LOC_ID_1_2)[DEFER_LOC_ID_0_2] = {};
377 if (false) {
378 DEFER_ID_1_4: {
379 [[__maybe_unused__, __deprecated__("invalid termination of a deferred block")]]
380 register bool const defer_return_flag = false, defer_break_flag = false, defer_continue_flag = false;
381 {ELLIPSIS_CONTRACT(2, ((typeof(DEFER_LOC_ID_0_1))DEFER_LOC_ID_0_1), unreachable, false, "((typeof(DEFER_LOC_ID_0_1))DEFER_LOC_ID_0_1)", "assumption", "out of memory when creating a one element FA array");}
382 }
383 goto DEFER_ID_1_3;
384 } else
385 (void)0 ;
386 do {ELLIPSIS_CONTRACT(3, !s || (s->length < s->capacity) || (s->capacity < SIZE_MAX), abort, true, "¬s ∨ (s→length < s→capacity) ∨ (s→capacity < SIZE_MAX)", "assertion", "FA array is a its limits");} while (false);
388 do {
389 /* return mode 2 */
390 defer_return_flag = true;
391 DEFER_LOC_ID_0_1 = ellipsis‿sarray‿append‿_Insta(s, c);
392 goto DEFER_ID_1_4;
393 } while(false);
394
395 goto DEFER_ID_1_4;
396 }
397[[__maybe_unused__]] DEFER_END_ID_1_4:;
398 return DEFER_LOC_ID_0_1;
399}
400
408GNU_ATTR_RETURNS_NONNULL STDC_ATTR_NODISCARD("functions for " "ellipsis∷sarray" " need to keep pointer returns")
409inline
411 typeof(ellipsis‿sarray*) DEFER_LOC_ID_0_1;
412 if (__func__[0] == 'm' && __func__[1] == 'a' && __func__[2] == 'i' && __func__[3] == 'n' && !__func__[4]) {
413 DEFER_LOC_ID_0_1 = (typeof(ellipsis‿sarray*)) {};
414 }
415 [[__maybe_unused__]] register unsigned DEFER_LOC_ID_0_2 = 1U;
416 [[__maybe_unused__]] register bool defer_return_flag = false;
417 if (false) {
418 DEFER_ID_1_5:
419 goto DEFER_END_ID_1_6;
420 } else {
421 (void)0 ;
422 /* defer */
423 [[__maybe_unused__, __deprecated__("dummy variable for better diagnostics")]]
424 unsigned (*DEFER_LOC_ID_1_3)[DEFER_LOC_ID_0_2] = {};
425 if (false) {
426 DEFER_ID_1_6: {
427 [[__maybe_unused__, __deprecated__("invalid termination of a deferred block")]]
428 register bool const defer_return_flag = false, defer_break_flag = false, defer_continue_flag = false;
429 {ELLIPSIS_CONTRACT(4, ((typeof(DEFER_LOC_ID_0_1))DEFER_LOC_ID_0_1), unreachable, false, "((typeof(DEFER_LOC_ID_0_1))DEFER_LOC_ID_0_1)", "assumption", "out of memory when concatenating two FA arrays");}
430 }
431 goto DEFER_ID_1_5;
432 } else
433 (void)0 ;
434 do {ELLIPSIS_CONTRACT(5, s && t, abort, true, "s ∧ t", "assertion", "argument FA arrays for concatenation must not be null");} while (false);
435 do {ELLIPSIS_CONTRACT(6, s->length <= (SIZE_MAX - t->length), abort, true, "s→length ≤ (SIZE_MAX − t→length)", "assertion", "concatenation of FA would be too long");} while (false);
437 do {
438 /* return mode 2 */
439 defer_return_flag = true;
440 DEFER_LOC_ID_0_1 = ellipsis‿sarray‿concat‿_Insta(s, t);
441 goto DEFER_ID_1_6;
442 } while(false);
443
444 goto DEFER_ID_1_6;
445 }
446[[__maybe_unused__]] DEFER_END_ID_1_6:;
447 return DEFER_LOC_ID_0_1;
448}
449
478GNU_ATTR_RETURNS_NONNULL STDC_ATTR_NODISCARD("functions for " "ellipsis∷sarray" " need to keep pointer returns")
479inline
481 typeof(ellipsis‿sarray*) DEFER_LOC_ID_0_1;
482 if (__func__[0] == 'm' && __func__[1] == 'a' && __func__[2] == 'i' && __func__[3] == 'n' && !__func__[4]) {
483 DEFER_LOC_ID_0_1 = (typeof(ellipsis‿sarray*)) {};
484 }
485 [[__maybe_unused__]] register unsigned DEFER_LOC_ID_0_2 = 1U;
486 [[__maybe_unused__]] register bool defer_return_flag = false;
487 if (false) {
488 DEFER_ID_1_7:
489 goto DEFER_END_ID_1_8;
490 } else {
491 (void)0 ;
492 /* defer */
493 [[__maybe_unused__, __deprecated__("dummy variable for better diagnostics")]]
494 unsigned (*DEFER_LOC_ID_1_4)[DEFER_LOC_ID_0_2] = {};
495 if (false) {
496 DEFER_ID_1_8: {
497 [[__maybe_unused__, __deprecated__("invalid termination of a deferred block")]]
498 register bool const defer_return_flag = false, defer_break_flag = false, defer_continue_flag = false;
499 {ELLIPSIS_CONTRACT(7, ((typeof(DEFER_LOC_ID_0_1))DEFER_LOC_ID_0_1), unreachable, false, "((typeof(DEFER_LOC_ID_0_1))DEFER_LOC_ID_0_1)", "assumption", "out of memory when growing an FA array");}
500 }
501 goto DEFER_ID_1_7;
502 } else
503 (void)0 ;
505 do {
506 /* return mode 2 */
507 defer_return_flag = true;
508 DEFER_LOC_ID_0_1 = ellipsis‿sarray‿concat_inplace‿_Insta(s, t);
509 goto DEFER_ID_1_8;
510 } while(false);
511
512 goto DEFER_ID_1_8;
513 }
514[[__maybe_unused__]] DEFER_END_ID_1_8:;
515 return DEFER_LOC_ID_0_1;
516}
517
533GNU_ATTR_RETURNS_NONNULL STDC_ATTR_NODISCARD("functions for " "ellipsis∷sarray" " need to keep pointer returns")
534inline
536 typeof(ellipsis‿sarray*) DEFER_LOC_ID_0_1;
537 if (__func__[0] == 'm' && __func__[1] == 'a' && __func__[2] == 'i' && __func__[3] == 'n' && !__func__[4]) {
538 DEFER_LOC_ID_0_1 = (typeof(ellipsis‿sarray*)) {};
539 }
540 [[__maybe_unused__]] register unsigned DEFER_LOC_ID_0_2 = 1U;
541 [[__maybe_unused__]] register bool defer_return_flag = false;
542 if (false) {
543 DEFER_ID_1_9:
544 goto DEFER_END_ID_1_10;
545 } else {
546 (void)0 ;
547 /* defer */
548 [[__maybe_unused__, __deprecated__("dummy variable for better diagnostics")]]
549 unsigned (*DEFER_LOC_ID_1_5)[DEFER_LOC_ID_0_2] = {};
550 if (false) {
551 DEFER_ID_1_10: {
552 [[__maybe_unused__, __deprecated__("invalid termination of a deferred block")]]
553 register bool const defer_return_flag = false, defer_break_flag = false, defer_continue_flag = false;
554 {ELLIPSIS_CONTRACT(8, ((typeof(DEFER_LOC_ID_0_1))DEFER_LOC_ID_0_1), unreachable, false, "((typeof(DEFER_LOC_ID_0_1))DEFER_LOC_ID_0_1)", "assumption", "out of memory when growing an FA array");}
555 }
556 goto DEFER_ID_1_9;
557 } else
558 (void)0 ;
559 do {ELLIPSIS_CONTRACT(9, !s || ((bool)((s)->capacity)), abort, true, "¬s ∨ ((bool)((s)→capacity))", "assertion", "flexible array object must be in allocated storage to be growable");} while (false);
560 do {ELLIPSIS_CONTRACT(10, !s || s->length < SIZE_MAX, abort, true, "¬s ∨ s→length < SIZE_MAX", "assertion", "FA array is a its limits");} while (false);
562 do {
563 /* return mode 2 */
564 defer_return_flag = true;
565 DEFER_LOC_ID_0_1 = ellipsis‿sarray‿grow‿_Insta(s, length);
566 goto DEFER_ID_1_10;
567 } while(false);
568
569 goto DEFER_ID_1_10;
570 }
571[[__maybe_unused__]] DEFER_END_ID_1_10:;
572 return DEFER_LOC_ID_0_1;
573}
574
592GNU_ATTR_RETURNS_NONNULL STDC_ATTR_NODISCARD("functions for " "ellipsis∷sarray" " need to keep pointer returns")
593inline
595 typeof(ellipsis‿sarray*) DEFER_LOC_ID_0_1;
596 if (__func__[0] == 'm' && __func__[1] == 'a' && __func__[2] == 'i' && __func__[3] == 'n' && !__func__[4]) {
597 DEFER_LOC_ID_0_1 = (typeof(ellipsis‿sarray*)) {};
598 }
599 [[__maybe_unused__]] register unsigned DEFER_LOC_ID_0_2 = 1U;
600 [[__maybe_unused__]] register bool defer_return_flag = false;
601 if (false) {
602 DEFER_ID_1_11:
603 goto DEFER_END_ID_1_12;
604 } else {
605 (void)0 ;
606 /* defer */
607 [[__maybe_unused__, __deprecated__("dummy variable for better diagnostics")]]
608 unsigned (*DEFER_LOC_ID_1_6)[DEFER_LOC_ID_0_2] = {};
609 if (false) {
610 DEFER_ID_1_12: {
611 [[__maybe_unused__, __deprecated__("invalid termination of a deferred block")]]
612 register bool const defer_return_flag = false, defer_break_flag = false, defer_continue_flag = false;
613 {ELLIPSIS_CONTRACT(11, ((typeof(DEFER_LOC_ID_0_1))DEFER_LOC_ID_0_1), unreachable, false, "((typeof(DEFER_LOC_ID_0_1))DEFER_LOC_ID_0_1)", "assumption", "out of memory when shrinking an FA array");}
614 }
615 goto DEFER_ID_1_11;
616 } else
617 (void)0 ;
618 do {ELLIPSIS_CONTRACT(12, s, abort, true, "s", "assertion", "can only shrink existing array");} while (false);
619 do {ELLIPSIS_CONTRACT(13, ((bool)((s)->capacity)), abort, true, "((bool)((s)→capacity))", "assertion", "flexible array object must be in allocated storage to be shrinkable");} while (false);
620 do {ELLIPSIS_CONTRACT(14, length <= s->length, abort, true, "length ≤ s→length", "assertion", "can\'t shrink array to make it longer");} while (false);
622 do {
623 /* return mode 2 */
624 defer_return_flag = true;
625 DEFER_LOC_ID_0_1 = ellipsis‿sarray‿shrink‿_Insta(s, length);
626 goto DEFER_ID_1_12;
627 } while(false);
628
629 goto DEFER_ID_1_12;
630 }
631[[__maybe_unused__]] DEFER_END_ID_1_12:;
632 return DEFER_LOC_ID_0_1;
633}
634
643GNU_ATTR_RETURNS_NONNULL STDC_ATTR_NODISCARD("functions for " "ellipsis∷sarray" " need to keep pointer returns")
644inline
645ellipsis‿sarray* ellipsis‿sarray‿sub(ellipsis‿sarray const*restrict s, size_t pos, size_t len) {
646 typeof(ellipsis‿sarray*) DEFER_LOC_ID_0_1;
647 if (__func__[0] == 'm' && __func__[1] == 'a' && __func__[2] == 'i' && __func__[3] == 'n' && !__func__[4]) {
648 DEFER_LOC_ID_0_1 = (typeof(ellipsis‿sarray*)) {};
649 }
650 [[__maybe_unused__]] register unsigned DEFER_LOC_ID_0_2 = 1U;
651 [[__maybe_unused__]] register bool defer_return_flag = false;
652 if (false) {
653 DEFER_ID_1_13:
654 goto DEFER_END_ID_1_14;
655 } else {
656 (void)0 ;
657 do {ELLIPSIS_CONTRACT(15, s, abort, true, "s", "assertion", "substring from non-existing string");} while (false);
658 do {ELLIPSIS_CONTRACT(16, pos < s->length, abort, true, "pos < s→length", "assertion", "start of substring is out of bounds");} while (false);
659 /* defer */
660 [[__maybe_unused__, __deprecated__("dummy variable for better diagnostics")]]
661 unsigned (*DEFER_LOC_ID_1_7)[DEFER_LOC_ID_0_2] = {};
662 if (false) {
663 DEFER_ID_1_14: {
664 [[__maybe_unused__, __deprecated__("invalid termination of a deferred block")]]
665 register bool const defer_return_flag = false, defer_break_flag = false, defer_continue_flag = false;
666 {ELLIPSIS_CONTRACT(17, ((typeof(DEFER_LOC_ID_0_1))DEFER_LOC_ID_0_1), unreachable, false, "((typeof(DEFER_LOC_ID_0_1))DEFER_LOC_ID_0_1)", "assumption", "out of memory when growing an FA array");}
667 }
668 goto DEFER_ID_1_13;
669 } else
670 (void)0 ;
672 do {
673 /* return mode 2 */
674 defer_return_flag = true;
675 DEFER_LOC_ID_0_1 = ellipsis‿sarray‿sub‿_Insta(s, pos, len);
676 goto DEFER_ID_1_14;
677 } while(false);
678
679 goto DEFER_ID_1_14;
680 }
681[[__maybe_unused__]] DEFER_END_ID_1_14:;
682 return DEFER_LOC_ID_0_1;
683}
684
696GNU_ATTR_RETURNS_NONNULL STDC_ATTR_NODISCARD("functions for " "ellipsis∷sarray" " need to keep pointer returns")
697inline
699 typeof(ellipsis‿sarray const*) DEFER_LOC_ID_0_1;
700 if (__func__[0] == 'm' && __func__[1] == 'a' && __func__[2] == 'i' && __func__[3] == 'n' && !__func__[4]) {
701 DEFER_LOC_ID_0_1 = (typeof(ellipsis‿sarray const*)) {};
702 }
703 [[__maybe_unused__]] register unsigned DEFER_LOC_ID_0_2 = 1U;
704 [[__maybe_unused__]] register bool defer_return_flag = false;
705 if (false) {
706 DEFER_ID_1_15:
707 goto DEFER_END_ID_1_16;
708 } else {
709 (void)0 ;
710 do {ELLIPSIS_CONTRACT(18, s, abort, true, "s", "assertion", "copy of non-existing string");} while (false);
711 /* defer */
712 [[__maybe_unused__, __deprecated__("dummy variable for better diagnostics")]]
713 unsigned (*DEFER_LOC_ID_1_8)[DEFER_LOC_ID_0_2] = {};
714 if (false) {
715 DEFER_ID_1_16: {
716 [[__maybe_unused__, __deprecated__("invalid termination of a deferred block")]]
717 register bool const defer_return_flag = false, defer_break_flag = false, defer_continue_flag = false;
718 {ELLIPSIS_CONTRACT(19, ((typeof(DEFER_LOC_ID_0_1))DEFER_LOC_ID_0_1), unreachable, false, "((typeof(DEFER_LOC_ID_0_1))DEFER_LOC_ID_0_1)", "assumption", "copy operation failed");}
719 }
720 goto DEFER_ID_1_15;
721 } else
722 (void)0 ;
724 do {
725 /* return mode 2 */
726 defer_return_flag = true;
727 DEFER_LOC_ID_0_1 = ellipsis‿sarray‿cpy_const‿_Insta(s);
728 goto DEFER_ID_1_16;
729 } while(false);
730
731 goto DEFER_ID_1_16;
732 }
733[[__maybe_unused__]] DEFER_END_ID_1_16:;
734 return DEFER_LOC_ID_0_1;
735}
736
744GNU_ATTR_RETURNS_NONNULL STDC_ATTR_NODISCARD("functions for " "ellipsis∷sarray" " need to keep pointer returns")
745inline
747 typeof(ellipsis‿sarray*) DEFER_LOC_ID_0_1;
748 if (__func__[0] == 'm' && __func__[1] == 'a' && __func__[2] == 'i' && __func__[3] == 'n' && !__func__[4]) {
749 DEFER_LOC_ID_0_1 = (typeof(ellipsis‿sarray*)) {};
750 }
751 [[__maybe_unused__]] register unsigned DEFER_LOC_ID_0_2 = 1U;
752 [[__maybe_unused__]] register bool defer_return_flag = false;
753 if (false) {
754 DEFER_ID_1_17:
755 goto DEFER_END_ID_1_18;
756 } else {
757 (void)0 ;
758 /* defer */
759 [[__maybe_unused__, __deprecated__("dummy variable for better diagnostics")]]
760 unsigned (*DEFER_LOC_ID_1_9)[DEFER_LOC_ID_0_2] = {};
761 if (false) {
762 DEFER_ID_1_18: {
763 [[__maybe_unused__, __deprecated__("invalid termination of a deferred block")]]
764 register bool const defer_return_flag = false, defer_break_flag = false, defer_continue_flag = false;
765 {ELLIPSIS_CONTRACT(20, ((typeof(DEFER_LOC_ID_0_1))DEFER_LOC_ID_0_1), abort, true, "((typeof(DEFER_LOC_ID_0_1))DEFER_LOC_ID_0_1)", "assertion", "out of memory when growing an FA array");}
766 }
767 goto DEFER_ID_1_17;
768 } else
769 (void)0 ;
771 do {
772 /* return mode 2 */
773 defer_return_flag = true;
774 DEFER_LOC_ID_0_1 = ellipsis‿sarray‿alloc‿_Inner(len);
775 goto DEFER_ID_1_18;
776 } while(false);
777
778 goto DEFER_ID_1_18;
779 }
780[[__maybe_unused__]] DEFER_END_ID_1_18:;
781 return DEFER_LOC_ID_0_1;
782}
783
799GNU_ATTR_RETURNS_NONNULL STDC_ATTR_NODISCARD("functions for " "ellipsis∷sarray" " need to keep pointer returns")
800inline
802 typeof(ellipsis‿sarray*) DEFER_LOC_ID_0_1;
803 if (__func__[0] == 'm' && __func__[1] == 'a' && __func__[2] == 'i' && __func__[3] == 'n' && !__func__[4]) {
804 DEFER_LOC_ID_0_1 = (typeof(ellipsis‿sarray*)) {};
805 }
806 [[__maybe_unused__]] register unsigned DEFER_LOC_ID_0_2 = 1U;
807 [[__maybe_unused__]] register bool defer_return_flag = false;
808 if (false) {
809 DEFER_ID_1_19:
810 goto DEFER_END_ID_1_20;
811 } else {
812 (void)0 ;
813 /* defer */
814 [[__maybe_unused__, __deprecated__("dummy variable for better diagnostics")]]
815 unsigned (*DEFER_LOC_ID_1_10)[DEFER_LOC_ID_0_2] = {};
816 if (false) {
817 DEFER_ID_1_20: {
818 [[__maybe_unused__, __deprecated__("invalid termination of a deferred block")]]
819 register bool const defer_return_flag = false, defer_break_flag = false, defer_continue_flag = false;
820 {ELLIPSIS_CONTRACT(21, ((typeof(DEFER_LOC_ID_0_1))DEFER_LOC_ID_0_1), abort, true, "((typeof(DEFER_LOC_ID_0_1))DEFER_LOC_ID_0_1)", "assertion", "out of memory when creating a one element FA array");}
821 }
822 goto DEFER_ID_1_19;
823 } else
824 (void)0 ;
825 do {ELLIPSIS_CONTRACT(22, !s || (s->length < s->capacity) || (s->capacity < SIZE_MAX), unreachable, false, "¬s ∨ (s→length < s→capacity) ∨ (s→capacity < SIZE_MAX)", "assumption", "FA array is a its limits");} while (false);
827 do {
828 /* return mode 2 */
829 defer_return_flag = true;
830 DEFER_LOC_ID_0_1 = ellipsis‿sarray‿append‿_Inner(s, c);
831 goto DEFER_ID_1_20;
832 } while(false);
833
834 goto DEFER_ID_1_20;
835 }
836[[__maybe_unused__]] DEFER_END_ID_1_20:;
837 return DEFER_LOC_ID_0_1;
838}
839
847GNU_ATTR_RETURNS_NONNULL STDC_ATTR_NODISCARD("functions for " "ellipsis∷sarray" " need to keep pointer returns")
848inline
850 typeof(ellipsis‿sarray*) DEFER_LOC_ID_0_1;
851 if (__func__[0] == 'm' && __func__[1] == 'a' && __func__[2] == 'i' && __func__[3] == 'n' && !__func__[4]) {
852 DEFER_LOC_ID_0_1 = (typeof(ellipsis‿sarray*)) {};
853 }
854 [[__maybe_unused__]] register unsigned DEFER_LOC_ID_0_2 = 1U;
855 [[__maybe_unused__]] register bool defer_return_flag = false;
856 if (false) {
857 DEFER_ID_1_21:
858 goto DEFER_END_ID_1_22;
859 } else {
860 (void)0 ;
861 /* defer */
862 [[__maybe_unused__, __deprecated__("dummy variable for better diagnostics")]]
863 unsigned (*DEFER_LOC_ID_1_11)[DEFER_LOC_ID_0_2] = {};
864 if (false) {
865 DEFER_ID_1_22: {
866 [[__maybe_unused__, __deprecated__("invalid termination of a deferred block")]]
867 register bool const defer_return_flag = false, defer_break_flag = false, defer_continue_flag = false;
868 {ELLIPSIS_CONTRACT(23, ((typeof(DEFER_LOC_ID_0_1))DEFER_LOC_ID_0_1), abort, true, "((typeof(DEFER_LOC_ID_0_1))DEFER_LOC_ID_0_1)", "assertion", "out of memory when concatenating two FA arrays");}
869 }
870 goto DEFER_ID_1_21;
871 } else
872 (void)0 ;
873 do {ELLIPSIS_CONTRACT(24, s && t, unreachable, false, "s ∧ t", "assumption", "argument FA arrays for concatenation must not be null");} while (false);
874 do {ELLIPSIS_CONTRACT(25, s->length <= (SIZE_MAX - t->length), unreachable, false, "s→length ≤ (SIZE_MAX − t→length)", "assumption", "concatenation of FA would be too long");} while (false);
876 do {
877 /* return mode 2 */
878 defer_return_flag = true;
879 DEFER_LOC_ID_0_1 = ellipsis‿sarray‿concat‿_Inner(s, t);
880 goto DEFER_ID_1_22;
881 } while(false);
882
883 goto DEFER_ID_1_22;
884 }
885[[__maybe_unused__]] DEFER_END_ID_1_22:;
886 return DEFER_LOC_ID_0_1;
887}
888
917GNU_ATTR_RETURNS_NONNULL STDC_ATTR_NODISCARD("functions for " "ellipsis∷sarray" " need to keep pointer returns")
918inline
920 typeof(ellipsis‿sarray*) DEFER_LOC_ID_0_1;
921 if (__func__[0] == 'm' && __func__[1] == 'a' && __func__[2] == 'i' && __func__[3] == 'n' && !__func__[4]) {
922 DEFER_LOC_ID_0_1 = (typeof(ellipsis‿sarray*)) {};
923 }
924 [[__maybe_unused__]] register unsigned DEFER_LOC_ID_0_2 = 1U;
925 [[__maybe_unused__]] register bool defer_return_flag = false;
926 if (false) {
927 DEFER_ID_1_23:
928 goto DEFER_END_ID_1_24;
929 } else {
930 (void)0 ;
931 /* defer */
932 [[__maybe_unused__, __deprecated__("dummy variable for better diagnostics")]]
933 unsigned (*DEFER_LOC_ID_1_12)[DEFER_LOC_ID_0_2] = {};
934 if (false) {
935 DEFER_ID_1_24: {
936 [[__maybe_unused__, __deprecated__("invalid termination of a deferred block")]]
937 register bool const defer_return_flag = false, defer_break_flag = false, defer_continue_flag = false;
938 {ELLIPSIS_CONTRACT(26, ((typeof(DEFER_LOC_ID_0_1))DEFER_LOC_ID_0_1), abort, true, "((typeof(DEFER_LOC_ID_0_1))DEFER_LOC_ID_0_1)", "assertion", "out of memory when growing an FA array");}
939 }
940 goto DEFER_ID_1_23;
941 } else
942 (void)0 ;
944 do {
945 /* return mode 2 */
946 defer_return_flag = true;
947 DEFER_LOC_ID_0_1 = ellipsis‿sarray‿concat_inplace‿_Inner(s, t);
948 goto DEFER_ID_1_24;
949 } while(false);
950
951 goto DEFER_ID_1_24;
952 }
953[[__maybe_unused__]] DEFER_END_ID_1_24:;
954 return DEFER_LOC_ID_0_1;
955}
956
972GNU_ATTR_RETURNS_NONNULL STDC_ATTR_NODISCARD("functions for " "ellipsis∷sarray" " need to keep pointer returns")
973inline
975 typeof(ellipsis‿sarray*) DEFER_LOC_ID_0_1;
976 if (__func__[0] == 'm' && __func__[1] == 'a' && __func__[2] == 'i' && __func__[3] == 'n' && !__func__[4]) {
977 DEFER_LOC_ID_0_1 = (typeof(ellipsis‿sarray*)) {};
978 }
979 [[__maybe_unused__]] register unsigned DEFER_LOC_ID_0_2 = 1U;
980 [[__maybe_unused__]] register bool defer_return_flag = false;
981 if (false) {
982 DEFER_ID_1_25:
983 goto DEFER_END_ID_1_26;
984 } else {
985 (void)0 ;
986 /* defer */
987 [[__maybe_unused__, __deprecated__("dummy variable for better diagnostics")]]
988 unsigned (*DEFER_LOC_ID_1_13)[DEFER_LOC_ID_0_2] = {};
989 if (false) {
990 DEFER_ID_1_26: {
991 [[__maybe_unused__, __deprecated__("invalid termination of a deferred block")]]
992 register bool const defer_return_flag = false, defer_break_flag = false, defer_continue_flag = false;
993 {ELLIPSIS_CONTRACT(27, ((typeof(DEFER_LOC_ID_0_1))DEFER_LOC_ID_0_1), abort, true, "((typeof(DEFER_LOC_ID_0_1))DEFER_LOC_ID_0_1)", "assertion", "out of memory when growing an FA array");}
994 }
995 goto DEFER_ID_1_25;
996 } else
997 (void)0 ;
998 do {ELLIPSIS_CONTRACT(28, !s || ((bool)((s)->capacity)), unreachable, false, "¬s ∨ ((bool)((s)→capacity))", "assumption", "flexible array object must be in allocated storage to be growable");} while (false);
999 do {ELLIPSIS_CONTRACT(29, !s || s->length < SIZE_MAX, unreachable, false, "¬s ∨ s→length < SIZE_MAX", "assumption", "FA array is a its limits");} while (false);
1001 do {
1002 /* return mode 2 */
1003 defer_return_flag = true;
1004 DEFER_LOC_ID_0_1 = ellipsis‿sarray‿grow‿_Inner(s, length);
1005 goto DEFER_ID_1_26;
1006 } while(false);
1007
1008 goto DEFER_ID_1_26;
1009 }
1010[[__maybe_unused__]] DEFER_END_ID_1_26:;
1011 return DEFER_LOC_ID_0_1;
1012}
1013
1031GNU_ATTR_RETURNS_NONNULL STDC_ATTR_NODISCARD("functions for " "ellipsis∷sarray" " need to keep pointer returns")
1032inline
1034 typeof(ellipsis‿sarray*) DEFER_LOC_ID_0_1;
1035 if (__func__[0] == 'm' && __func__[1] == 'a' && __func__[2] == 'i' && __func__[3] == 'n' && !__func__[4]) {
1036 DEFER_LOC_ID_0_1 = (typeof(ellipsis‿sarray*)) {};
1037 }
1038 [[__maybe_unused__]] register unsigned DEFER_LOC_ID_0_2 = 1U;
1039 [[__maybe_unused__]] register bool defer_return_flag = false;
1040 if (false) {
1041 DEFER_ID_1_27:
1042 goto DEFER_END_ID_1_28;
1043 } else {
1044 (void)0 ;
1045 /* defer */
1046 [[__maybe_unused__, __deprecated__("dummy variable for better diagnostics")]]
1047 unsigned (*DEFER_LOC_ID_1_14)[DEFER_LOC_ID_0_2] = {};
1048 if (false) {
1049 DEFER_ID_1_28: {
1050 [[__maybe_unused__, __deprecated__("invalid termination of a deferred block")]]
1051 register bool const defer_return_flag = false, defer_break_flag = false, defer_continue_flag = false;
1052 {ELLIPSIS_CONTRACT(30, ((typeof(DEFER_LOC_ID_0_1))DEFER_LOC_ID_0_1), abort, true, "((typeof(DEFER_LOC_ID_0_1))DEFER_LOC_ID_0_1)", "assertion", "out of memory when shrinking an FA array");}
1053 }
1054 goto DEFER_ID_1_27;
1055 } else
1056 (void)0 ;
1057 do {ELLIPSIS_CONTRACT(31, s, unreachable, false, "s", "assumption", "can only shrink existing array");} while (false);
1058 do {ELLIPSIS_CONTRACT(32, ((bool)((s)->capacity)), unreachable, false, "((bool)((s)→capacity))", "assumption", "flexible array object must be in allocated storage to be shrinkable");} while (false);
1059 do {ELLIPSIS_CONTRACT(33, length <= s->length, unreachable, false, "length ≤ s→length", "assumption", "can\'t shrink array to make it longer");} while (false);
1061 do {
1062 /* return mode 2 */
1063 defer_return_flag = true;
1064 DEFER_LOC_ID_0_1 = ellipsis‿sarray‿shrink‿_Inner(s, length);
1065 goto DEFER_ID_1_28;
1066 } while(false);
1067
1068 goto DEFER_ID_1_28;
1069 }
1070[[__maybe_unused__]] DEFER_END_ID_1_28:;
1071 return DEFER_LOC_ID_0_1;
1072}
1073
1082GNU_ATTR_RETURNS_NONNULL STDC_ATTR_NODISCARD("functions for " "ellipsis∷sarray" " need to keep pointer returns")
1083inline
1084ellipsis‿sarray* ellipsis‿sarray‿sub‿_Ctra(ellipsis‿sarray const*restrict s, size_t pos, size_t len) {
1085 typeof(ellipsis‿sarray*) DEFER_LOC_ID_0_1;
1086 if (__func__[0] == 'm' && __func__[1] == 'a' && __func__[2] == 'i' && __func__[3] == 'n' && !__func__[4]) {
1087 DEFER_LOC_ID_0_1 = (typeof(ellipsis‿sarray*)) {};
1088 }
1089 [[__maybe_unused__]] register unsigned DEFER_LOC_ID_0_2 = 1U;
1090 [[__maybe_unused__]] register bool defer_return_flag = false;
1091 if (false) {
1092 DEFER_ID_1_29:
1093 goto DEFER_END_ID_1_30;
1094 } else {
1095 (void)0 ;
1096 do {ELLIPSIS_CONTRACT(34, s, unreachable, false, "s", "assumption", "substring from non-existing string");} while (false);
1097 do {ELLIPSIS_CONTRACT(35, pos < s->length, unreachable, false, "pos < s→length", "assumption", "start of substring is out of bounds");} while (false);
1098 /* defer */
1099 [[__maybe_unused__, __deprecated__("dummy variable for better diagnostics")]]
1100 unsigned (*DEFER_LOC_ID_1_15)[DEFER_LOC_ID_0_2] = {};
1101 if (false) {
1102 DEFER_ID_1_30: {
1103 [[__maybe_unused__, __deprecated__("invalid termination of a deferred block")]]
1104 register bool const defer_return_flag = false, defer_break_flag = false, defer_continue_flag = false;
1105 {ELLIPSIS_CONTRACT(36, ((typeof(DEFER_LOC_ID_0_1))DEFER_LOC_ID_0_1), abort, true, "((typeof(DEFER_LOC_ID_0_1))DEFER_LOC_ID_0_1)", "assertion", "out of memory when growing an FA array");}
1106 }
1107 goto DEFER_ID_1_29;
1108 } else
1109 (void)0 ;
1111 do {
1112 /* return mode 2 */
1113 defer_return_flag = true;
1114 DEFER_LOC_ID_0_1 = ellipsis‿sarray‿sub‿_Inner(s, pos, len);
1115 goto DEFER_ID_1_30;
1116 } while(false);
1117
1118 goto DEFER_ID_1_30;
1119 }
1120[[__maybe_unused__]] DEFER_END_ID_1_30:;
1121 return DEFER_LOC_ID_0_1;
1122}
1123
1135GNU_ATTR_RETURNS_NONNULL STDC_ATTR_NODISCARD("functions for " "ellipsis∷sarray" " need to keep pointer returns")
1136inline
1138 typeof(ellipsis‿sarray const*) DEFER_LOC_ID_0_1;
1139 if (__func__[0] == 'm' && __func__[1] == 'a' && __func__[2] == 'i' && __func__[3] == 'n' && !__func__[4]) {
1140 DEFER_LOC_ID_0_1 = (typeof(ellipsis‿sarray const*)) {};
1141 }
1142 [[__maybe_unused__]] register unsigned DEFER_LOC_ID_0_2 = 1U;
1143 [[__maybe_unused__]] register bool defer_return_flag = false;
1144 if (false) {
1145 DEFER_ID_1_31:
1146 goto DEFER_END_ID_1_32;
1147 } else {
1148 (void)0 ;
1149 do {ELLIPSIS_CONTRACT(37, s, unreachable, false, "s", "assumption", "copy of non-existing string");} while (false);
1150 /* defer */
1151 [[__maybe_unused__, __deprecated__("dummy variable for better diagnostics")]]
1152 unsigned (*DEFER_LOC_ID_1_16)[DEFER_LOC_ID_0_2] = {};
1153 if (false) {
1154 DEFER_ID_1_32: {
1155 [[__maybe_unused__, __deprecated__("invalid termination of a deferred block")]]
1156 register bool const defer_return_flag = false, defer_break_flag = false, defer_continue_flag = false;
1157 {ELLIPSIS_CONTRACT(38, ((typeof(DEFER_LOC_ID_0_1))DEFER_LOC_ID_0_1), abort, true, "((typeof(DEFER_LOC_ID_0_1))DEFER_LOC_ID_0_1)", "assertion", "copy operation failed");}
1158 }
1159 goto DEFER_ID_1_31;
1160 } else
1161 (void)0 ;
1163 do {
1164 /* return mode 2 */
1165 defer_return_flag = true;
1166 DEFER_LOC_ID_0_1 = ellipsis‿sarray‿cpy_const‿_Inner(s);
1167 goto DEFER_ID_1_32;
1168 } while(false);
1169
1170 goto DEFER_ID_1_32;
1171 }
1172[[__maybe_unused__]] DEFER_END_ID_1_32:;
1173 return DEFER_LOC_ID_0_1;
1174}
1175
1191GNU_ATTR_RETURNS_NONNULL STDC_ATTR_NODISCARD("functions for " "ellipsis∷sarray" " need to keep pointer returns") ellipsis‿sarray* ellipsis‿sarray‿remove(ellipsis‿sarray s[restrict static 1], size_t);
1192
1203inline
1205 memset(_ar, 0, _n*sizeof(_ar[0]));
1206}
1207
1217inline
1219 return memcmp(_a, _b, sizeof(_a[0]));
1220}
1221
1234
1243GNU_ATTR_RETURNS_NONNULL STDC_ATTR_NODISCARD("functions for " "ellipsis∷sarray" " need to keep pointer returns")
1244inline
1246 typeof(ellipsis‿sarray*) DEFER_LOC_ID_0_1;
1247 if (__func__[0] == 'm' && __func__[1] == 'a' && __func__[2] == 'i' && __func__[3] == 'n' && !__func__[4]) {
1248 DEFER_LOC_ID_0_1 = (typeof(ellipsis‿sarray*)) {};
1249 }
1250 [[__maybe_unused__]] register unsigned DEFER_LOC_ID_0_2 = 1U;
1251 [[__maybe_unused__]] register bool defer_return_flag = false;
1252 if (false) {
1253 DEFER_ID_1_33:
1254 goto DEFER_END_ID_1_34;
1255 } else {
1256 (void)0 ;
1257 ELLIPSIS_CONTRACT(39, __LOC_ID_0_5, abort, true, "__LOC(0, 1)", "precondition", "copy of non-existing string");
1258 do {
1259 /* return mode 2 */
1260 defer_return_flag = true;
1261 DEFER_LOC_ID_0_1 = ellipsis‿sarray‿sub(__LOC_ID_0_5, 0, __LOC_ID_0_5->length);
1262 goto DEFER_ID_1_33;
1263 } while(false);
1264
1265 goto DEFER_ID_1_33;
1266 }
1267[[__maybe_unused__]] DEFER_END_ID_1_34:;
1268 return DEFER_LOC_ID_0_1;
1269}
1270
1274inline
1275int ellipsis‿sarray‿compareInternal(void const* A, void const* B) {
1276 ellipsis‿sarray‿base const* a = A;
1277 ellipsis‿sarray‿base const* b = B;
1279}
1280
1293inline
1294void ellipsis‿sarray‿sort(ellipsis‿sarray* p, size_t offs, size_t len) {
1295 extern void (qsort)(void*, size_t, size_t, int (*)(const void*, const void*));
1296 if (offs < p->length) {
1297 size_t rlen = p->length - offs;
1298 if (rlen < len) len = rlen;
1299 if (len > 1) {
1300 qsort((void*)(p->array+offs), len, sizeof(ellipsis‿sarray‿base), ellipsis‿sarray‿compareInternal);
1301 }
1302 }
1303}
1304
1313inline
1314ellipsis‿sarray‿base const* ellipsis‿sarray‿search(ellipsis‿sarray‿base const el[static 1], ellipsis‿sarray const* p, size_t offs, size_t len) {
1315 extern void* (bsearch)(void const*, void const*, size_t, size_t, int (*)(const void*, const void*));
1316 if (offs < p->length) {
1317 size_t rlen = p->length - offs;
1318 if (rlen < len) len = rlen;
1319 if (len > 0) {
1320 return bsearch((void const*)el, (void const*)(p->array+offs), len, sizeof(ellipsis‿sarray‿base), ellipsis‿sarray‿compareInternal);
1321 }
1322 }
1323 return nullptr;
1324}
1325
1326#endif
#define GNU_ATTR_COUNTED_BY(...)
Definition ellipsis-error.h:59
#define STDC_ATTR_NODISCARD(...)
Definition ellipsis-error.h:68
#define GNU_ATTR_STRICT_FLEX_ARRAY(...)
Definition ellipsis-error.h:54
#define GNU_ATTR_RETURNS_NONNULL
Definition ellipsis-error.h:34
struct ellipsis‿contracts‿is_ice ellipsis‿contracts‿is_ice
Definition ellipsis-expression.c:24
ellipsis‿sarray * ellipsis‿sarray‿alloc‿_Inner(size_t len)
Definition ellipsis-sarray.c:147
ellipsis‿sarray * ellipsis‿sarray‿shrink‿_Inner(ellipsis‿sarray s[restrict static 1], size_t length)
Definition ellipsis-sarray.c:228
ellipsis‿sarray const * ellipsis‿sarray‿cpy_const‿_Inner(ellipsis‿sarray const *restrict s)
Definition ellipsis-sarray.c:257
ellipsis‿sarray * ellipsis‿sarray‿sub‿_Inner(ellipsis‿sarray const *s, size_t pos, size_t len)
Definition ellipsis-sarray.c:240
ellipsis‿sarray * ellipsis‿sarray‿append‿_Inner(ellipsis‿sarray *restrict s, s->array[0] c)
Definition ellipsis-sarray.c:159
ellipsis‿sarray * ellipsis‿sarray‿grow‿_Inner(ellipsis‿sarray *restrict s, size_t length)
Definition ellipsis-sarray.c:202
ellipsis‿sarray * ellipsis‿sarray‿concat_inplace‿_Inner(ellipsis‿sarray const *s0, ellipsis‿sarray const *t)
Definition ellipsis-sarray.c:183
ellipsis‿sarray * ellipsis‿sarray‿concat‿_Inner(ellipsis‿sarray const *s, ellipsis‿sarray const *t)
Definition ellipsis-sarray.c:168
thread_local bool volatile ellipsis‿contracts‿verbose‿dynamic
#define ELLIPSIS_CONTRACT(COUNT, COND, ACTION, VERB, CSTR, CTYPE,...)
Definition ellipsis-sarray.h:70
thread_local bool volatile ellipsis‿contracts‿proceed‿dynamic
thread_local bool volatile ellipsis‿contracts‿ignore‿dynamic
A structure with a flexible array member of base type ellipsis‿sarray‿base.
Definition ellipsis-sarray.h:140
int ellipsis‿sarray‿compare(ellipsis‿sarray const *s, ellipsis‿sarray const *t)
Compare two arrays lexicographically.
Definition ellipsis-sarray.c:119
ellipsis‿sarray * ellipsis‿sarray‿grow‿_Ctra(ellipsis‿sarray *restrict s, size_t length)
Grow the ellipsis‿sarray to (at least) the indicated amount of elements return a new one and delete t...
Definition ellipsis-sarray.h:974
ellipsis‿sarray * ellipsis‿sarray‿grow(ellipsis‿sarray *restrict s, size_t length)
Grow the ellipsis‿sarray to (at least) the indicated amount of elements return a new one and delete t...
Definition ellipsis-sarray.h:535
size_t const length
Current length of this instance.
Definition ellipsis-sarray.h:149
ellipsis‿sarray const * ellipsis‿sarray‿cpy_const(ellipsis‿sarray const *restrict s)
Copy or link to a const-qualified ellipsis‿sarray.
Definition ellipsis-sarray.h:698
ellipsis‿sarray * ellipsis‿sarray‿alloc‿_Ctra(size_t len)
Allocate a ellipsis‿sarray with elements as given by the parameter.
Definition ellipsis-sarray.h:746
ellipsis‿sarray * ellipsis‿sarray‿alloc‿_Insta(size_t len)
Allocate a ellipsis‿sarray with elements as given by the parameter.
Definition ellipsis-sarray.c:272
void ellipsis‿sarray‿move(ellipsis‿sarray *__LOC_ID_0_1[restrict static 1], ellipsis‿sarray **restrict __LOC_ID_0_2)
Move a ellipsis‿sarray pointed to by the second parameter to the one pointed to by the first.
Definition ellipsis-sarray.h:266
ellipsis‿sarray * ellipsis‿sarray‿grow‿_Insta(ellipsis‿sarray *restrict s, size_t length)
Grow the ellipsis‿sarray to (at least) the indicated amount of elements return a new one and delete t...
Definition ellipsis-sarray.c:456
void ellipsis‿sarray‿delete(ellipsis‿sarray const *)
Delete a ellipsis‿sarray pointed to by the parameter.
Definition ellipsis-sarray.c:615
ellipsis‿sarray * ellipsis‿sarray‿concat(ellipsis‿sarray const *s, ellipsis‿sarray const *t)
Concatenate two ellipsis‿sarray into a new one.
Definition ellipsis-sarray.h:410
ellipsis‿sarray‿base array[]
The current data array.
Definition ellipsis-sarray.h:174
ellipsis‿sarray * ellipsis‿sarray‿sub(ellipsis‿sarray const *restrict s, size_t pos, size_t len)
Allocate a ellipsis‿sarray with len elements and copy the data from *s at position pos onward.
Definition ellipsis-sarray.h:645
ellipsis‿sarray const * ellipsis‿sarray‿cpy_const‿_Ctra(ellipsis‿sarray const *restrict s)
Copy or link to a const-qualified ellipsis‿sarray.
Definition ellipsis-sarray.h:1137
size_t length_mod
Modifiable length of this instance.
Definition ellipsis-sarray.h:156
ellipsis‿sarray * ellipsis‿sarray‿concat_inplace(ellipsis‿sarray const *s, ellipsis‿sarray const *t)
Concatenate two ellipsis‿sarray into a new one and delete s.
Definition ellipsis-sarray.h:480
void ellipsis‿sarray‿base‿destroy(size_t _n, ellipsis‿sarray‿base _ar[static _n])
Destroy an element of type ellipsis‿sarray‿base.
Definition ellipsis-sarray.h:1204
ellipsis‿sarray‿base const * ellipsis‿sarray‿search(ellipsis‿sarray‿base const el[static 1], ellipsis‿sarray const *p, size_t offs, size_t len)
search for an element in a ellipsis‿sarray
Definition ellipsis-sarray.h:1314
int ellipsis‿sarray‿compareInternal(void const *A, void const *B)
Definition ellipsis-sarray.h:1275
ellipsis‿sarray * ellipsis‿sarray‿remove(ellipsis‿sarray s[restrict static 1], size_t)
Remove (at most) the indicated amount of elements from the ellipsis‿sarray return a new one and delet...
Definition ellipsis-sarray.c:108
ellipsis‿sarray * ellipsis‿sarray‿concat_inplace‿_Insta(ellipsis‿sarray const *s, ellipsis‿sarray const *t)
Concatenate two ellipsis‿sarray into a new one and delete s.
Definition ellipsis-sarray.c:412
ellipsis‿sarray * ellipsis‿sarray‿append‿_Ctra(ellipsis‿sarray *restrict s, ellipsis‿sarray‿base c)
Append a new element to a ellipsis‿sarray and return a new object.
Definition ellipsis-sarray.h:801
ellipsis‿sarray * ellipsis‿sarray‿concat‿_Insta(ellipsis‿sarray const *s, ellipsis‿sarray const *t)
Concatenate two ellipsis‿sarray into a new one.
Definition ellipsis-sarray.c:353
size_t ellipsis‿sarray‿base
Definition ellipsis-sarray.h:16
ellipsis‿sarray * ellipsis‿sarray‿append‿_Insta(ellipsis‿sarray *restrict s, ellipsis‿sarray‿base c)
Append a new element to a ellipsis‿sarray and return a new object.
Definition ellipsis-sarray.c:316
void ellipsis‿sarray‿sort(ellipsis‿sarray *p, size_t offs, size_t len)
sort a ellipsis‿sarray in place.
Definition ellipsis-sarray.h:1294
ellipsis‿sarray * ellipsis‿sarray‿cpy(ellipsis‿sarray const *restrict __LOC_ID_0_5)
Allocate a ellipsis‿sarray and copy the data to which the parameter points into it.
Definition ellipsis-sarray.h:1245
ellipsis‿sarray const * ellipsis‿sarray‿cpy_const‿_Insta(ellipsis‿sarray const *restrict s)
Copy or link to a const-qualified ellipsis‿sarray.
Definition ellipsis-sarray.c:586
ellipsis‿sarray * ellipsis‿sarray‿concat_inplace‿_Ctra(ellipsis‿sarray const *s, ellipsis‿sarray const *t)
Concatenate two ellipsis‿sarray into a new one and delete s.
Definition ellipsis-sarray.h:919
ellipsis‿sarray * ellipsis‿sarray‿append(ellipsis‿sarray *restrict s, ellipsis‿sarray‿base c)
Append a new element to a ellipsis‿sarray and return a new object.
Definition ellipsis-sarray.h:362
ellipsis‿sarray * ellipsis‿sarray‿shrink‿_Ctra(ellipsis‿sarray s[restrict static 1], size_t length)
Shrink the ellipsis‿sarray to exactly the indicated amount of elements return a new one and delete th...
Definition ellipsis-sarray.h:1033
int ellipsis‿sarray‿base‿compare(ellipsis‿sarray‿base const _a[static 1], ellipsis‿sarray‿base const _b[static 1])
Compare two elements of type ellipsis‿sarray‿base.
Definition ellipsis-sarray.h:1218
ellipsis‿sarray * ellipsis‿sarray‿concat‿_Ctra(ellipsis‿sarray const *s, ellipsis‿sarray const *t)
Concatenate two ellipsis‿sarray into a new one.
Definition ellipsis-sarray.h:849
size_t const capacity
Maximal length of this instance.
Definition ellipsis-sarray.h:166
ellipsis‿sarray * ellipsis‿sarray‿sub‿_Insta(ellipsis‿sarray const *restrict s, size_t pos, size_t len)
Allocate a ellipsis‿sarray with len elements and copy the data from *s at position pos onward.
Definition ellipsis-sarray.c:544
ellipsis‿sarray * ellipsis‿sarray‿alloc(size_t len)
Allocate a ellipsis‿sarray with elements as given by the parameter.
Definition ellipsis-sarray.h:307
ellipsis‿sarray * ellipsis‿sarray‿shrink(ellipsis‿sarray s[restrict static 1], size_t length)
Shrink the ellipsis‿sarray to exactly the indicated amount of elements return a new one and delete th...
Definition ellipsis-sarray.h:594
void ellipsis‿sarray‿cmove(ellipsis‿sarray const *__LOC_ID_0_3[restrict static 1], ellipsis‿sarray const **restrict __LOC_ID_0_4)
Move a ellipsis‿sarray const pointed to by the second parameter to the one pointed to by the first.
Definition ellipsis-sarray.h:286
ellipsis‿sarray * ellipsis‿sarray‿shrink‿_Insta(ellipsis‿sarray s[restrict static 1], size_t length)
Shrink the ellipsis‿sarray to exactly the indicated amount of elements return a new one and delete th...
Definition ellipsis-sarray.c:504
ellipsis‿sarray * ellipsis‿sarray‿sub‿_Ctra(ellipsis‿sarray const *restrict s, size_t pos, size_t len)
Allocate a ellipsis‿sarray with len elements and copy the data from *s at position pos onward.
Definition ellipsis-sarray.h:1084