You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
naka/include/comp.h

18 lines
885 B

#ifndef _COMP_H
#define _COMP_H
#include <macros.h>
#include <ints.h>
/// Find `needle` in `haystack`, sets the start of `needle`'s `origin` in `haystack`'s to `pos` and returns `true` if a match is found, otherwise returns false.
bool cmp_find(const map_t *pIN needle, const map_t *pIN haystack, usize *pOUT pos);
/// Check `needle` against `nhaystacks` number of haystack maps, store the offset in `sizes[n]` where `n` is the haystack number.
/// `sizes` must be at least `nhaystacks` long. The haystacks themselves are expected to be of type `const map_t* pIN`
/// Returns `-1` if all haystacks passed match, otherwise returns the index of the haystack that failed.
///
/// # Panics
/// Will `FATAL` if any of the haystack pointers are `NULL`
int cmp_find_many(usize nhaystacks; const map_t *pIN needle, usize sizes[pOUT nhaystacks], usize nhaystacks, ...);
#endif /* _COMP_H */