Skip to content

IterPos

Description

Pointer to the current read position, or NULL_ITER_DATA(mi) when the iterator is exhausted.

Usage example (Cross-references)

Usage examples (Cross-references)
    /// TAGS: StrIter, Position, Alias
    ///
    #define StrIterPos(mi) IterPos(mi)
    
    ///
                // a short buffer is a soft parse failure (rewind + false),
                // not an abort -- this is how magic bytes are checked inline.
                if (IterRemainingLength(iter) < 1 || *(const u8 *)IterPos(iter) != (u8)fc) {
                    *iter = start;
                    return false;
            char esc = 0;
            if (StrIterPeek(&fsi, &esc) && esc == '{') {
                if (IterRemainingLength(iter) < 1 || *(const u8 *)IterPos(iter) != (u8)'{') {
                    *iter = start;
                    return false;
    
            // Read the raw bytes into a u64 with the spec's endianness.
            Zstr in   = (Zstr)IterPos(iter);
            u64  x    = 0;
            Zstr next = NULL;
        const u8 buf[2] = {40, 50};
        BufIter  it     = BufIterFromMemory(buf, 2);
        if (IterPos(&it) != &buf[0] || *IterPos(&it) != 40) {
            return false;
        }
        }
        IterMove(&it, 2); // exhaust
        return IterPos(&it) == NULL_ITER_DATA(&it);
    }
Last updated on