actf 0.0.1
An acute CTF reader
Loading...
Searching...
No Matches
/home/adwe/code/actf/mappings.h File Reference

Mapping related methods. More...

#include <stddef.h>
#include <stdint.h>
#include "types.h"

Go to the source code of this file.

Typedefs

typedef struct actf_mappings actf_mappings
 Mappings map names to integer range sets.

Functions

size_t actf_mappings_len (const actf_mappings *maps)
 Get the number of mappings.
const char * actf_mappings_find_uint (const actf_mappings *maps, uint64_t val, actf_it *it)
 Find the next name matching the provided value.
const char * actf_mappings_find_first_uint (const actf_mappings *maps, uint64_t val)
 Find the first name matching the provided value.
const char * actf_mappings_find_sint (const actf_mappings *maps, int64_t val, actf_it *it)
const char * actf_mappings_find_first_sint (const actf_mappings *maps, int64_t val)

Detailed Description

Mapping related methods.

Function Documentation

◆ actf_mappings_len()

size_t actf_mappings_len ( const actf_mappings * maps)

Get the number of mappings.

Parameters
mapsthe mappings
Returns
the number of mappings in maps

◆ actf_mappings_find_uint()

const char * actf_mappings_find_uint ( const actf_mappings * maps,
uint64_t val,
actf_it * it )

Find the next name matching the provided value.

A value can be mapped to several names, so to read them all out, you should call actf_mappigns_find_uint() repeatedly with the same iterator until NULL is returned.

Parameters
mapsthe mappings
valthe value
itthe iterator to use, it must be zero initialized on the first call and then unmodified for subsequent calls.
Returns
a name or NULL if no more matches exist.

◆ actf_mappings_find_first_uint()

const char * actf_mappings_find_first_uint ( const actf_mappings * maps,
uint64_t val )

Find the first name matching the provided value.

Convenience function for when you only care about the first matching name.

Parameters
mapsthe mappings
valthe value
Returns
the name or NULL if no matches exist

◆ actf_mappings_find_sint()

const char * actf_mappings_find_sint ( const actf_mappings * maps,
int64_t val,
actf_it * it )

◆ actf_mappings_find_first_sint()

const char * actf_mappings_find_first_sint ( const actf_mappings * maps,
int64_t val )