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/display.h

41 lines
844 B

#ifndef _DISPLAY_H
#define _DISPLAY_H
#include <stdio.h>
#include "macros.h"
#include "ints.h"
#include "slice.h"
typedef enum display_kind {
DISPK_NORMAL = 0,
DISPK_CSV,
DISPK_BINARY,
DISPK_INI,
} dispkind_t;
#define X(n) AS(1lu << (n), usize)
typedef enum display_flags {
// Show the number (index) of they haystack matched
DISPF_SHOW_NUMBER = X(0),
// Show the slice
DISPF_SHOW_SLICE = X(1),
// Show the length of the slice
DISPF_SHOW_LENGTH = X(2),
// Show failed matches
DISPF_SHOW_FAILURES = X(3),
} dispflags_t;
#define DISPLAY_FLAGS_DEFAULT (DISPF_SHOW_SLICE | DISPF_SHOW_NUMBER | DISPF_SHOW_FAILURES)
#undef X
typedef struct {
bool matched;
slice_t cslice;
const void* base;
usize index;
} dispin_t;
void display_result(FILE* output, dispin_t input, dispkind_t how, dispflags_t flags);
#endif /* _DISPLAY_H */