Skip to content

MisraScope

Description

Reserved identifier used by Scope-aware public macros to find the “current” allocator. The Scope and ScopeWith macros introduce this name into the enclosing block; tier-1 public macros (VecInit, …) expand to references to it. Outside any Scope/ScopeWith block the name is undeclared and the call site is a compile error.

Do not declare a local variable with this name in user code.

Success

Resolves to the Allocator * that the enclosing Scope / ScopeWith block introduced.

Failure

Compile error (undeclared identifier) when used outside any Scope / ScopeWith block.

Usage example (Cross-references)

Usage examples (Cross-references)
    Zstr zstr_dup_n(Zstr src, size n, Allocator *alloc);
    #define ZstrDupN(...)             OVERLOAD(ZstrDupN, __VA_ARGS__)
    #define ZstrDupN_2(src, n)        zstr_dup_n((src), (n), MisraScope)
    #define ZstrDupN_3(src, n, alloc) zstr_dup_n((src), (n), ALLOCATOR_OF(alloc))
    Zstr zstr_dup(Zstr src, Allocator *alloc);
    #define ZstrDup(...)          OVERLOAD(ZstrDup, __VA_ARGS__)
    #define ZstrDup_1(src)        zstr_dup((src), MisraScope)
    #define ZstrDup_2(src, alloc) zstr_dup((src), ALLOCATOR_OF(alloc))
        ///
    #define ArgParseInit(...)                     OVERLOAD(ArgParseInit, __VA_ARGS__)
    #define ArgParseInit_2(prog_name, prog_about) ArgParseInit_3((prog_name), (prog_about), MisraScope)
    #define ArgParseInit_3(prog_name, prog_about, alloc_ptr)                                                               \
        ((                                                                                                                 \
    File file_open_temp(Str *out_path, Allocator *alloc);
    #define FileOpenTemp(...)               OVERLOAD(FileOpenTemp, __VA_ARGS__)
    #define FileOpenTemp_1(out_path)        file_open_temp((out_path), MisraScope)
    #define FileOpenTemp_2(out_path, alloc) file_open_temp((out_path), ALLOCATOR_OF(alloc))
             AllocType##Deinit(&UNPL(scope_internal)), AllocType##Deinit(&UNPL(scope_user)), UNPL(scope_loop) = NULL)      \
            for (Allocator *name             = &UNPL(scope_user).base,                                                     \
                           *MisraScope       = &UNPL(scope_internal).base,                                                 \
                           *UNPL(scope_done) = name;                                                                       \
                 (UNUSED(MisraScope), UNPL(scope_done));                                                                   \
                           *MisraScope       = &UNPL(scope_internal).base,                                                 \
                           *UNPL(scope_done) = name;                                                                       \
                 (UNUSED(MisraScope), UNPL(scope_done));                                                                   \
                 UNPL(scope_done) = NULL)
    ///
    #define ScopeWith(alloc_ptr)                                                                                           \
        for (Allocator *MisraScope = (alloc_ptr), *UNPL(scope_with_done) = MisraScope;                                     \
             (UNUSED(MisraScope), UNPL(scope_with_done));                                                                  \
             UNPL(scope_with_done) = NULL)
    #define ScopeWith(alloc_ptr)                                                                                           \
        for (Allocator *MisraScope = (alloc_ptr), *UNPL(scope_with_done) = MisraScope;                                     \
             (UNUSED(MisraScope), UNPL(scope_with_done));                                                                  \
             UNPL(scope_with_done) = NULL)
    #    define FloatTryToDecimalStr(...) OVERLOAD(FloatTryToDecimalStr, __VA_ARGS__)
    #    define FloatTryToDecimalStr_4(out, value, precision, has_precision)                                               \
            float_try_to_decimal_str((out), (value), (precision), (has_precision), MisraScope)
    #    define FloatTryToDecimalStr_5(out, value, precision, has_precision, alloc)                                        \
            float_try_to_decimal_str((out), (value), (precision), (has_precision), ALLOCATOR_OF(alloc))
    #    define FloatTryToScientificStr(...) OVERLOAD(FloatTryToScientificStr, __VA_ARGS__)
    #    define FloatTryToScientificStr_5(out, value, precision, has_precision, uppercase)                                 \
            float_try_to_scientific_str((out), (value), (precision), (has_precision), (uppercase), MisraScope)
    #    define FloatTryToScientificStr_6(out, value, precision, has_precision, uppercase, alloc)                          \
            float_try_to_scientific_str((out), (value), (precision), (has_precision), (uppercase), ALLOCATOR_OF(alloc))
    ///
    #define GraphInit(...)               OVERLOAD(GraphInit, __VA_ARGS__)
    #define GraphInit_0()                GraphInitWithDeepCopy_3(NULL, NULL, MisraScope)
    #define GraphInit_1(typed_alloc_ptr) GraphInitWithDeepCopy_3(NULL, NULL, typed_alloc_ptr)
    ///
    #define GraphInitT(g, ...)               OVERLOAD(GraphInitT, g, __VA_ARGS__)
    #define GraphInitT_1(g)                  GraphInitWithDeepCopyT_4((g), NULL, NULL, MisraScope)
    #define GraphInitT_2(g, typed_alloc_ptr) GraphInitWithDeepCopyT_4((g), NULL, NULL, typed_alloc_ptr)
    ///
    #define GraphInitWithDeepCopy(...)                       OVERLOAD(GraphInitWithDeepCopy, __VA_ARGS__)
    #define GraphInitWithDeepCopy_2(ci, cd)                  GRAPH_INIT_WITH_DEEP_COPY_VALUE((ci), (cd), MisraScope)
    #define GraphInitWithDeepCopy_3(ci, cd, typed_alloc_ptr) GRAPH_INIT_WITH_DEEP_COPY_VALUE((ci), (cd), typed_alloc_ptr)
    #define GraphInitWithDeepCopyT(g, ...) OVERLOAD(GraphInitWithDeepCopyT, g, __VA_ARGS__)
    #ifdef __cplusplus
    #    define GraphInitWithDeepCopyT_3(g, ci, cd) (TYPE_OF(g) GRAPH_INIT_WITH_DEEP_COPY_VALUE((ci), (cd), MisraScope))
    #    define GraphInitWithDeepCopyT_4(g, ci, cd, typed_alloc_ptr)                                                       \
            (TYPE_OF(g) GRAPH_INIT_WITH_DEEP_COPY_VALUE((ci), (cd), typed_alloc_ptr))
            (TYPE_OF(g) GRAPH_INIT_WITH_DEEP_COPY_VALUE((ci), (cd), typed_alloc_ptr))
    #else
    #    define GraphInitWithDeepCopyT_3(g, ci, cd) ((TYPE_OF(g))GRAPH_INIT_WITH_DEEP_COPY_VALUE((ci), (cd), MisraScope))
    #    define GraphInitWithDeepCopyT_4(g, ci, cd, typed_alloc_ptr)                                                       \
            ((TYPE_OF(g))GRAPH_INIT_WITH_DEEP_COPY_VALUE((ci), (cd), typed_alloc_ptr))
        _Generic((text), Str *: float_from_str_str, Zstr: float_from_str_zstr, char *: float_from_str_zstr)(               \
            (text),                                                                                                        \
            MisraScope                                                                                                     \
        )
    #define FloatFromStr_2(text, alloc)                                                                                    \
    ///
    #define FloatInit(...)             OVERLOAD(FloatInit, __VA_ARGS__)
    #define FloatInit_0()              ((Float) {.negative = false, .significand = IntInit_1(MisraScope), .exponent = 0})
    #define FloatInit_1(allocator_ptr) ((Float) {.negative = false, .significand = IntInit_1(allocator_ptr), .exponent = 0})
    ///
    #define VecInit(...) OVERLOAD(VecInit, __VA_ARGS__)
    #define VecInit_0()  VecInit_1(MisraScope)
    #define VecInit_1(allocator_ptr)                                                                                       \
        {.length      = 0,                                                                                                 \
    #define VecInitT(v, ...) OVERLOAD(VecInitT, v, __VA_ARGS__)
    #ifdef __cplusplus
    #    define VecInitT_1(v)            (TYPE_OF(v) VecInit_1(MisraScope))
    #    define VecInitT_2(v, alloc_ptr) (TYPE_OF(v) VecInit_1(alloc_ptr))
    #else
    #    define VecInitT_2(v, alloc_ptr) (TYPE_OF(v) VecInit_1(alloc_ptr))
    #else
    #    define VecInitT_1(v)            ((TYPE_OF(v))VecInit_1(MisraScope))
    #    define VecInitT_2(v, alloc_ptr) ((TYPE_OF(v))VecInit_1(alloc_ptr))
    #endif
    ///
    #define VecInitWithDeepCopy(...)      OVERLOAD(VecInitWithDeepCopy, __VA_ARGS__)
    #define VecInitWithDeepCopy_2(ci, cd) VecInitWithDeepCopy_3(ci, cd, MisraScope)
    #define VecInitWithDeepCopy_3(ci, cd, allocator_ptr)                                                                   \
        {.length      = 0,                                                                                                 \
    #define VecInitWithDeepCopyT(v, ...) OVERLOAD(VecInitWithDeepCopyT, v, __VA_ARGS__)
    #ifdef __cplusplus
    #    define VecInitWithDeepCopyT_3(v, ci, cd)            (TYPE_OF(v) VecInitWithDeepCopy_3(ci, cd, MisraScope))
    #    define VecInitWithDeepCopyT_4(v, ci, cd, alloc_ptr) (TYPE_OF(v) VecInitWithDeepCopy_3(ci, cd, alloc_ptr))
    #else
    #    define VecInitWithDeepCopyT_4(v, ci, cd, alloc_ptr) (TYPE_OF(v) VecInitWithDeepCopy_3(ci, cd, alloc_ptr))
    #else
    #    define VecInitWithDeepCopyT_3(v, ci, cd)            ((TYPE_OF(v))VecInitWithDeepCopy_3(ci, cd, MisraScope))
    #    define VecInitWithDeepCopyT_4(v, ci, cd, alloc_ptr) ((TYPE_OF(v))VecInitWithDeepCopy_3(ci, cd, alloc_ptr))
    #endif
            (out),                                                                                                         \
            (str),                                                                                                         \
            MisraScope                                                                                                     \
        )
    #define BitVecTryFromStr_3(out, str, alloc)                                                                            \
        _Generic((str), Str *: bitvec_from_str_str, Zstr: bitvec_from_str_zstr, char *: bitvec_from_str_zstr)(             \
            (str),                                                                                                         \
            MisraScope                                                                                                     \
        )
    #define BitVecFromStr_2(str, alloc)                                                                                    \
        bool bitvec_try_from_bytes(BitVec *out, const u8 *bytes, u64 bit_len, Allocator *alloc);
    #define BitVecTryFromBytes(...)                   OVERLOAD(BitVecTryFromBytes, __VA_ARGS__)
    #define BitVecTryFromBytes_3(out, bytes, bit_len) bitvec_try_from_bytes((out), (bytes), (bit_len), MisraScope)
    #define BitVecTryFromBytes_4(out, bytes, bit_len, alloc)                                                               \
        bitvec_try_from_bytes((out), (bytes), (bit_len), ALLOCATOR_OF(alloc))
        BitVec bitvec_from_bytes(const u8 *bytes, u64 bit_len, Allocator *alloc);
    #define BitVecFromBytes(...)                     OVERLOAD(BitVecFromBytes, __VA_ARGS__)
    #define BitVecFromBytes_2(bytes, bit_len)        bitvec_from_bytes((bytes), (bit_len), MisraScope)
    #define BitVecFromBytes_3(bytes, bit_len, alloc) bitvec_from_bytes((bytes), (bit_len), ALLOCATOR_OF(alloc))
        bool bitvec_try_from_integer(BitVec *out, u64 value, u64 bits, Allocator *alloc);
    #define BitVecTryFromInteger(...)                OVERLOAD(BitVecTryFromInteger, __VA_ARGS__)
    #define BitVecTryFromInteger_3(out, value, bits) bitvec_try_from_integer((out), (value), (bits), MisraScope)
    #define BitVecTryFromInteger_4(out, value, bits, alloc)                                                                \
        bitvec_try_from_integer((out), (value), (bits), ALLOCATOR_OF(alloc))
        BitVec bitvec_from_integer(u64 value, u64 bits, Allocator *alloc);
    #define BitVecFromInteger(...)                  OVERLOAD(BitVecFromInteger, __VA_ARGS__)
    #define BitVecFromInteger_2(value, bits)        bitvec_from_integer((value), (bits), MisraScope)
    #define BitVecFromInteger_3(value, bits, alloc) bitvec_from_integer((value), (bits), ALLOCATOR_OF(alloc))
    ///
    #define BitVecInit(...) OVERLOAD(BitVecInit, __VA_ARGS__)
    #define BitVecInit_0()  BitVecInit_1(MisraScope)
    #ifdef __cplusplus
    #    define BitVecInit_1(allocator_ptr)                                                                                \
        BitVec bitvec_init_with_capacity(u64 cap, Allocator *alloc);
    #define BitVecInitWithCapacity(...)         OVERLOAD(BitVecInitWithCapacity, __VA_ARGS__)
    #define BitVecInitWithCapacity_1(cap)         bitvec_init_with_capacity((cap), MisraScope)
    #define BitVecInitWithCapacity_2(cap, alloc)  bitvec_init_with_capacity((cap), ALLOCATOR_OF(alloc))
        Int int_from_bytes_le(const u8 *bytes, u64 len, Allocator *alloc);
    #define IntFromBytesLE(...)                 OVERLOAD(IntFromBytesLE, __VA_ARGS__)
    #define IntFromBytesLE_2(bytes, len)        int_from_bytes_le((bytes), (len), MisraScope)
    #define IntFromBytesLE_3(bytes, len, alloc) int_from_bytes_le((bytes), (len), ALLOCATOR_OF(alloc))
        Int int_from_bytes_be(const u8 *bytes, u64 len, Allocator *alloc);
    #define IntFromBytesBE(...)                 OVERLOAD(IntFromBytesBE, __VA_ARGS__)
    #define IntFromBytesBE_2(bytes, len)        int_from_bytes_be((bytes), (len), MisraScope)
    #define IntFromBytesBE_3(bytes, len, alloc) int_from_bytes_be((bytes), (len), ALLOCATOR_OF(alloc))
            (digits),                                                                                                      \
            (radix),                                                                                                       \
            MisraScope                                                                                                     \
        )
    #define IntFromStrRadix_3(digits, radix, alloc)                                                                        \
        _Generic((decimal), Str *: int_from_str_str, Zstr: int_from_str_zstr, char *: int_from_str_zstr)(                  \
            (decimal),                                                                                                     \
            MisraScope                                                                                                     \
        )
    #define IntFromStr_2(decimal, alloc)                                                                                   \
        _Generic((binary), Str *: int_from_binary_str, Zstr: int_from_binary_zstr, char *: int_from_binary_zstr)(          \
            (binary),                                                                                                      \
            MisraScope                                                                                                     \
        )
    #define IntFromBinary_2(binary, alloc)                                                                                 \
        _Generic((octal), Str *: int_from_oct_str_str, Zstr: int_from_oct_str_zstr, char *: int_from_oct_str_zstr)(        \
            (octal),                                                                                                       \
            MisraScope                                                                                                     \
        )
    #define IntFromOctStr_2(octal, alloc)                                                                                  \
        _Generic((hex), Str *: int_from_hex_str_str, Zstr: int_from_hex_str_zstr, char *: int_from_hex_str_zstr)(          \
            (hex),                                                                                                         \
            MisraScope                                                                                                     \
        )
    #define IntFromHexStr_2(hex, alloc)                                                                                    \
    ///
    #define IntInit(...)             OVERLOAD(IntInit, __VA_ARGS__)
    #define IntInit_0()              ((Int) {.bits = BitVecInit_1(MisraScope)})
    #define IntInit_1(allocator_ptr) ((Int) {.bits = BitVecInit_1(allocator_ptr)})
    ///
    #define StrInitFromCstr(...)                OVERLOAD(StrInitFromCstr, __VA_ARGS__)
    #define StrInitFromCstr_2(cstr, len)        str_init_from_cstr((cstr), (len), MisraScope)
    #define StrInitFromCstr_3(cstr, len, alloc) str_init_from_cstr((cstr), (len), ALLOCATOR_OF(alloc))
    #define StrInit(...) OVERLOAD(StrInit, __VA_ARGS__)
    #ifdef __cplusplus
    #    define StrInit_0()          (Str VecInit_1(MisraScope))
    #    define StrInit_1(alloc_ptr) (Str VecInit_1(alloc_ptr))
    #else
    #    define StrInit_1(alloc_ptr) (Str VecInit_1(alloc_ptr))
    #else
    #    define StrInit_0()          ((Str)VecInit_1(MisraScope))
    #    define StrInit_1(alloc_ptr) ((Str)VecInit_1(alloc_ptr))
    #endif
    ///
    #define ListInit(...)               OVERLOAD(ListInit, __VA_ARGS__)
    #define ListInit_0()                ListInitWithDeepCopy_3(NULL, NULL, MisraScope)
    #define ListInit_1(typed_alloc_ptr) ListInitWithDeepCopy_3(NULL, NULL, typed_alloc_ptr)
    ///
    #define ListInitT(l, ...)               OVERLOAD(ListInitT, l, __VA_ARGS__)
    #define ListInitT_1(l)                  ListInitWithDeepCopyT_4(l, NULL, NULL, MisraScope)
    #define ListInitT_2(l, typed_alloc_ptr) ListInitWithDeepCopyT_4(l, NULL, NULL, typed_alloc_ptr)
    ///
    #define ListInitWithDeepCopy(...)      OVERLOAD(ListInitWithDeepCopy, __VA_ARGS__)
    #define ListInitWithDeepCopy_2(ci, cd) ListInitWithDeepCopy_3(ci, cd, MisraScope)
    #define ListInitWithDeepCopy_3(ci, cd, typed_alloc_ptr)                                                                \
        {.head        = NULL,                                                                                              \
    #define ListInitWithDeepCopyT(l, ...) OVERLOAD(ListInitWithDeepCopyT, l, __VA_ARGS__)
    #ifdef __cplusplus
    #    define ListInitWithDeepCopyT_3(l, ci, cd) (TYPE_OF(l) ListInitWithDeepCopy_3(ci, cd, MisraScope))
    #    define ListInitWithDeepCopyT_4(l, ci, cd, typed_alloc_ptr)                                                        \
            (TYPE_OF(l) ListInitWithDeepCopy_3(ci, cd, typed_alloc_ptr))
            (TYPE_OF(l) ListInitWithDeepCopy_3(ci, cd, typed_alloc_ptr))
    #else
    #    define ListInitWithDeepCopyT_3(l, ci, cd) ((TYPE_OF(l))ListInitWithDeepCopy_3(ci, cd, MisraScope))
    #    define ListInitWithDeepCopyT_4(l, ci, cd, typed_alloc_ptr)                                                        \
            ((TYPE_OF(l))ListInitWithDeepCopy_3(ci, cd, typed_alloc_ptr))
    #define MapInitFull(...) OVERLOAD(MapInitFull, __VA_ARGS__)
    #define MapInitFull_8(hash_fn, compare_fn, vcmp, kci, kcd, vci, vcd, policy_value)                                     \
        MapInitFull_9(hash_fn, compare_fn, vcmp, kci, kcd, vci, vcd, policy_value, MisraScope)
    
    ///
    ///
    #define MapInit(...)                   OVERLOAD(MapInit, __VA_ARGS__)
    #define MapInit_2(hash_fn, compare_fn) MapInit_3(hash_fn, compare_fn, MisraScope)
    #define MapInit_3(hash_fn, compare_fn, typed_alloc_ptr)                                                                \
        MapInitFull_9((hash_fn), (compare_fn), NULL, NULL, NULL, NULL, NULL, MapPolicyLinear, typed_alloc_ptr)
    #define MapInitWithValueCompare(...) OVERLOAD(MapInitWithValueCompare, __VA_ARGS__)
    #define MapInitWithValueCompare_3(hash_fn, compare_fn, value_compare_fn)                                               \
        MapInitWithValueCompare_4(hash_fn, compare_fn, value_compare_fn, MisraScope)
    #define MapInitWithValueCompare_4(hash_fn, compare_fn, value_compare_fn, typed_alloc_ptr)                              \
        MapInitFull_9((hash_fn), (compare_fn), (value_compare_fn), NULL, NULL, NULL, NULL, MapPolicyLinear, typed_alloc_ptr)
    #define MapInitWithPolicy(...) OVERLOAD(MapInitWithPolicy, __VA_ARGS__)
    #define MapInitWithPolicy_3(hash_fn, compare_fn, policy_value)                                                         \
        MapInitWithPolicy_4(hash_fn, compare_fn, policy_value, MisraScope)
    #define MapInitWithPolicy_4(hash_fn, compare_fn, policy_value, typed_alloc_ptr)                                        \
        MapInitFull_9((hash_fn), (compare_fn), NULL, NULL, NULL, NULL, NULL, (policy_value), typed_alloc_ptr)
    #define MapInitWithValueCompareAndPolicy(...) OVERLOAD(MapInitWithValueCompareAndPolicy, __VA_ARGS__)
    #define MapInitWithValueCompareAndPolicy_4(hash_fn, compare_fn, value_compare_fn, policy_value)                        \
        MapInitWithValueCompareAndPolicy_5(hash_fn, compare_fn, value_compare_fn, policy_value, MisraScope)
    #define MapInitWithValueCompareAndPolicy_5(hash_fn, compare_fn, value_compare_fn, policy_value, typed_alloc_ptr)       \
        MapInitFull_9((hash_fn), (compare_fn), (value_compare_fn), NULL, NULL, NULL, NULL, (policy_value), typed_alloc_ptr)
    #define MapInitWithDeepCopy(...) OVERLOAD(MapInitWithDeepCopy, __VA_ARGS__)
    #define MapInitWithDeepCopy_6(hash_fn, compare_fn, key_ci, key_cd, value_ci, value_cd)                                 \
        MapInitWithDeepCopy_7(hash_fn, compare_fn, key_ci, key_cd, value_ci, value_cd, MisraScope)
    #define MapInitWithDeepCopy_7(hash_fn, compare_fn, key_ci, key_cd, value_ci, value_cd, typed_alloc_ptr)                \
        MapInitFull_9(                                                                                                     \
    #define MapInitT(m, ...) OVERLOAD(MapInitT, m, __VA_ARGS__)
    #ifdef __cplusplus
    #    define MapInitT_3(m, hash_fn, compare_fn) (TYPE_OF(m) MapInit_3((hash_fn), (compare_fn), MisraScope))
    #    define MapInitT_4(m, hash_fn, compare_fn, typed_alloc_ptr)                                                        \
            (TYPE_OF(m) MapInit_3((hash_fn), (compare_fn), typed_alloc_ptr))
            (TYPE_OF(m) MapInit_3((hash_fn), (compare_fn), typed_alloc_ptr))
    #else
    #    define MapInitT_3(m, hash_fn, compare_fn) ((TYPE_OF(m))MapInit_3((hash_fn), (compare_fn), MisraScope))
    #    define MapInitT_4(m, hash_fn, compare_fn, typed_alloc_ptr)                                                        \
            ((TYPE_OF(m))MapInit_3((hash_fn), (compare_fn), typed_alloc_ptr))
    #    define MapInitWithDeepCopyT_7(m, hash_fn, compare_fn, key_ci, key_cd, value_ci, value_cd)                         \
            (TYPE_OF(m)                                                                                                    \
                 MapInitWithDeepCopy_7((hash_fn), (compare_fn), (key_ci), (key_cd), (value_ci), (value_cd), MisraScope))
    #    define MapInitWithDeepCopyT_8(m, hash_fn, compare_fn, key_ci, key_cd, value_ci, value_cd, typed_alloc_ptr)        \
            (TYPE_OF(                                                                                                      \
    #    define MapInitWithDeepCopyT_7(m, hash_fn, compare_fn, key_ci, key_cd, value_ci, value_cd)                         \
            ((TYPE_OF(m))                                                                                                  \
                 MapInitWithDeepCopy_7((hash_fn), (compare_fn), (key_ci), (key_cd), (value_ci), (value_cd), MisraScope))
    #    define MapInitWithDeepCopyT_8(m, hash_fn, compare_fn, key_ci, key_cd, value_ci, value_cd, typed_alloc_ptr)        \
            ((                                                                                                             \
    Str socket_addr_format(const SocketAddr *addr, Allocator *alloc);
    #define SocketAddrFormat(...)           OVERLOAD(SocketAddrFormat, __VA_ARGS__)
    #define SocketAddrFormat_1(addr)        socket_addr_format((addr), MisraScope)
    #define SocketAddrFormat_2(addr, alloc) socket_addr_format((addr), ALLOCATOR_OF(alloc))
        _Generic(                                                                                                          \
            (path),                                                                                                        \
            Str *: dir_get_contents((Zstr)StrBegin((Str *)(path)), MisraScope),                                            \
            Zstr: dir_get_contents((Zstr)(path), MisraScope),                                                              \
            char *: dir_get_contents((Zstr)(path), MisraScope)                                                             \
            (path),                                                                                                        \
            Str *: dir_get_contents((Zstr)StrBegin((Str *)(path)), MisraScope),                                            \
            Zstr: dir_get_contents((Zstr)(path), MisraScope),                                                              \
            char *: dir_get_contents((Zstr)(path), MisraScope)                                                             \
        )
            Str *: dir_get_contents((Zstr)StrBegin((Str *)(path)), MisraScope),                                            \
            Zstr: dir_get_contents((Zstr)(path), MisraScope),                                                              \
            char *: dir_get_contents((Zstr)(path), MisraScope)                                                             \
        )
    #define DirGetContents_2(path, alloc)                                                                                  \
    ///
    #define PdbCacheInit(...)        OVERLOAD(PdbCacheInit, __VA_ARGS__)
    #define PdbCacheInit_0()         PdbCacheInit_1(MisraScope)
    #define PdbCacheInit_1(alloc_ptr) ((PdbCache) {.allocator = ALLOCATOR_OF(alloc_ptr), .entries = VecInit_1(alloc_ptr)})
    
    #define ProcInit(...)                       OVERLOAD(ProcInit, __VA_ARGS__)
    #define ProcInit_3(path, argv, envp)        proc_init((path), (argv), (envp), MisraScope)
    #define ProcInit_4(path, argv, envp, alloc) proc_init((path), (argv), (envp), ALLOCATOR_OF(alloc))
    bool symbol_resolver_init(SymbolResolver *out, Allocator *alloc);
    #define SymbolResolverInit(...)          OVERLOAD(SymbolResolverInit, __VA_ARGS__)
    #define SymbolResolverInit_1(out)        symbol_resolver_init((out), MisraScope)
    #define SymbolResolverInit_2(out, alloc) symbol_resolver_init((out), ALLOCATOR_OF(alloc))
        bool dns_resolver_init(DnsResolver *out, Allocator *alloc);
    #define DnsResolverInit(...)          OVERLOAD(DnsResolverInit, __VA_ARGS__)
    #define DnsResolverInit_1(out)        dns_resolver_init((out), MisraScope)
    #define DnsResolverInit_2(out, alloc) dns_resolver_init((out), ALLOCATOR_OF(alloc))
    ///
    #define MachoCacheInit(...)         OVERLOAD(MachoCacheInit, __VA_ARGS__)
    #define MachoCacheInit_0()          MachoCacheInit_1(MisraScope)
    #define MachoCacheInit_1(alloc_ptr) ((MachoCache) {.allocator = ALLOCATOR_OF(alloc_ptr), .entries = VecInit_1(alloc_ptr)})
    ///
    #define HttpHeaderInit(...)         OVERLOAD(HttpHeaderInit, __VA_ARGS__)
    #define HttpHeaderInit_0()          HttpHeaderInit_1(MisraScope)
    #define HttpHeaderInit_1(alloc_ptr) ((HttpHeader) {.key = StrInit_1(alloc_ptr), .value = StrInit_1(alloc_ptr)})
    ///
    #define HttpRequestInit(...) OVERLOAD(HttpRequestInit, __VA_ARGS__)
    #define HttpRequestInit_0()  HttpRequestInit_1(MisraScope)
    #define HttpRequestInit_1(alloc_ptr)                                                                                   \
        ((HttpRequest) {.allocator = ALLOCATOR_OF(alloc_ptr),                                                              \
    ///
    #define HttpResponseInit(...) OVERLOAD(HttpResponseInit, __VA_ARGS__)
    #define HttpResponseInit_0()  HttpResponseInit_1(MisraScope)
    #define HttpResponseInit_1(alloc_ptr)                                                                                  \
        ((HttpResponse) {.allocator    = ALLOCATOR_OF(alloc_ptr),                                                          \
    ///
    #define HttpResponseSerialize(...)               OVERLOAD(HttpResponseSerialize, __VA_ARGS__)
    #define HttpResponseSerialize_1(response)        http_response_serialize((response), MisraScope)
    #define HttpResponseSerialize_2(response, alloc) http_response_serialize((response), ALLOCATOR_OF(alloc))
    ///
    #define KvConfigInit(...) OVERLOAD(KvConfigInit, __VA_ARGS__)
    #define KvConfigInit_0()  KvConfigInit_1(MisraScope)
    #define KvConfigInit_1(allocator_ptr)                                                                                  \
        MapInitFull_9(                                                                                                     \
        _Generic(                                                                                                          \
            (path),                                                                                                        \
            Str *: pdb_open((out), (Zstr)StrBegin((Str *)(path)), MisraScope),                                             \
            Zstr: pdb_open((out), (Zstr)(path), MisraScope),                                                               \
            char *: pdb_open((out), (Zstr)(path), MisraScope)                                                              \
            (path),                                                                                                        \
            Str *: pdb_open((out), (Zstr)StrBegin((Str *)(path)), MisraScope),                                             \
            Zstr: pdb_open((out), (Zstr)(path), MisraScope),                                                               \
            char *: pdb_open((out), (Zstr)(path), MisraScope)                                                              \
        )
            Str *: pdb_open((out), (Zstr)StrBegin((Str *)(path)), MisraScope),                                             \
            Zstr: pdb_open((out), (Zstr)(path), MisraScope),                                                               \
            char *: pdb_open((out), (Zstr)(path), MisraScope)                                                              \
        )
    #define PdbOpen_3(out, path, alloc)                                                                                    \
    ///
    #define PdbOpenFromMemoryCopy(...)                    OVERLOAD(PdbOpenFromMemoryCopy, __VA_ARGS__)
    #define PdbOpenFromMemoryCopy_3(out, data, data_size) pdb_open_from_memory_copy((out), (data), (data_size), MisraScope)
    #define PdbOpenFromMemoryCopy_4(out, data, data_size, alloc)                                                           \
        pdb_open_from_memory_copy((out), (data), (data_size), ALLOCATOR_OF(alloc))
    ///
    #define DwarfLinesBuildFromElf(...)               OVERLOAD(DwarfLinesBuildFromElf, __VA_ARGS__)
    #define DwarfLinesBuildFromElf_2(out, elf)        dwarf_lines_build_from_elf((out), (elf), MisraScope)
    #define DwarfLinesBuildFromElf_3(out, elf, alloc) dwarf_lines_build_from_elf((out), (elf), ALLOCATOR_OF(alloc))
    ///
    #define DwarfCfiBuildFromElf(...)               OVERLOAD(DwarfCfiBuildFromElf, __VA_ARGS__)
    #define DwarfCfiBuildFromElf_2(out, elf)        dwarf_cfi_build_from_elf((out), (elf), MisraScope)
    #define DwarfCfiBuildFromElf_3(out, elf, alloc) dwarf_cfi_build_from_elf((out), (elf), ALLOCATOR_OF(alloc))
    ///
    #define DwarfFunctionsBuildFromElf(...)               OVERLOAD(DwarfFunctionsBuildFromElf, __VA_ARGS__)
    #define DwarfFunctionsBuildFromElf_2(out, elf)        dwarf_functions_build_from_elf((out), (elf), MisraScope)
    #define DwarfFunctionsBuildFromElf_3(out, elf, alloc) dwarf_functions_build_from_elf((out), (elf), ALLOCATOR_OF(alloc))
        _Generic(                                                                                                          \
            (path),                                                                                                        \
            Str *: elf_open((out), (Zstr)StrBegin((Str *)(path)), MisraScope),                                             \
            Zstr: elf_open((out), (Zstr)(path), MisraScope),                                                               \
            char *: elf_open((out), (Zstr)(path), MisraScope)                                                              \
            (path),                                                                                                        \
            Str *: elf_open((out), (Zstr)StrBegin((Str *)(path)), MisraScope),                                             \
            Zstr: elf_open((out), (Zstr)(path), MisraScope),                                                               \
            char *: elf_open((out), (Zstr)(path), MisraScope)                                                              \
        )
            Str *: elf_open((out), (Zstr)StrBegin((Str *)(path)), MisraScope),                                             \
            Zstr: elf_open((out), (Zstr)(path), MisraScope),                                                               \
            char *: elf_open((out), (Zstr)(path), MisraScope)                                                              \
        )
    #define ElfOpen_3(out, path, alloc)                                                                                    \
    ///
    #define ElfOpenFromMemoryCopy(...)                    OVERLOAD(ElfOpenFromMemoryCopy, __VA_ARGS__)
    #define ElfOpenFromMemoryCopy_3(out, data, data_size) elf_open_from_memory_copy((out), (data), (data_size), MisraScope)
    #define ElfOpenFromMemoryCopy_4(out, data, data_size, alloc)                                                           \
        elf_open_from_memory_copy((out), (data), (data_size), ALLOCATOR_OF(alloc))
        _Generic(                                                                                                          \
            (path),                                                                                                        \
            Str *: pe_open((out), (Zstr)StrBegin((Str *)(path)), MisraScope),                                              \
            Zstr: pe_open((out), (Zstr)(path), MisraScope),                                                                \
            char *: pe_open((out), (Zstr)(path), MisraScope)                                                               \
            (path),                                                                                                        \
            Str *: pe_open((out), (Zstr)StrBegin((Str *)(path)), MisraScope),                                              \
            Zstr: pe_open((out), (Zstr)(path), MisraScope),                                                                \
            char *: pe_open((out), (Zstr)(path), MisraScope)                                                               \
        )
            Str *: pe_open((out), (Zstr)StrBegin((Str *)(path)), MisraScope),                                              \
            Zstr: pe_open((out), (Zstr)(path), MisraScope),                                                                \
            char *: pe_open((out), (Zstr)(path), MisraScope)                                                               \
        )
    #define PeOpen_3(out, path, alloc)                                                                                     \
    ///
    #define PeOpenFromMemoryCopy(...)                    OVERLOAD(PeOpenFromMemoryCopy, __VA_ARGS__)
    #define PeOpenFromMemoryCopy_3(out, data, data_size) pe_open_from_memory_copy((out), (data), (data_size), MisraScope)
    #define PeOpenFromMemoryCopy_4(out, data, data_size, alloc)                                                            \
        pe_open_from_memory_copy((out), (data), (data_size), ALLOCATOR_OF(alloc))
        _Generic(                                                                                                          \
            (path),                                                                                                        \
            Str *: macho_open((out), (Zstr)StrBegin((Str *)(path)), MisraScope),                                           \
            Zstr: macho_open((out), (Zstr)(path), MisraScope),                                                             \
            char *: macho_open((out), (Zstr)(path), MisraScope)                                                            \
            (path),                                                                                                        \
            Str *: macho_open((out), (Zstr)StrBegin((Str *)(path)), MisraScope),                                           \
            Zstr: macho_open((out), (Zstr)(path), MisraScope),                                                             \
            char *: macho_open((out), (Zstr)(path), MisraScope)                                                            \
        )
            Str *: macho_open((out), (Zstr)StrBegin((Str *)(path)), MisraScope),                                           \
            Zstr: macho_open((out), (Zstr)(path), MisraScope),                                                             \
            char *: macho_open((out), (Zstr)(path), MisraScope)                                                            \
        )
    #define MachoOpen_3(out, path, alloc)                                                                                  \
    #define MachoOpenFromMemoryCopy(...) OVERLOAD(MachoOpenFromMemoryCopy, __VA_ARGS__)
    #define MachoOpenFromMemoryCopy_3(out, data, data_size)                                                                \
        macho_open_from_memory_copy((out), (data), (data_size), MisraScope)
    #define MachoOpenFromMemoryCopy_4(out, data, data_size, alloc)                                                         \
        macho_open_from_memory_copy((out), (data), (data_size), ALLOCATOR_OF(alloc))
    bool proc_maps_load(ProcMaps *out, Allocator *alloc);
    #define ProcMapsLoad(...)          OVERLOAD(ProcMapsLoad, __VA_ARGS__)
    #define ProcMapsLoad_1(out)        proc_maps_load((out), MisraScope)
    #define ProcMapsLoad_2(out, alloc) proc_maps_load((out), ALLOCATOR_OF(alloc))
Last updated on