From 8e1e6572feabd291cbd5048459c0a58c6460ff91 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Thu, 23 Sep 2021 15:15:48 -0700 Subject: Moved type defs into their own files instead of types.h --- match.h | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) (limited to 'match.h') diff --git a/match.h b/match.h index b6e7392..db948b8 100644 --- a/match.h +++ b/match.h @@ -8,7 +8,31 @@ #include #include "files.h" -#include "types.h" +#include "pattern.h" +#include "definitions.h" + +struct match_s; // forward declared to resolve circular struct defs + +typedef struct { + struct match_s **home, *next; +} match_dll_t; + +// #define MATCH_FROM(node, name) ((match_t*)((char*)node + (size_t)(&((match_t*)0)->name))) + +// +// Pattern matching result object +// +typedef struct match_s { + // Where the match starts and ends (end is after the last character) + const char *start, *end; + pat_t *pat; + // Intrusive linked list nodes for garbage collection and cache buckets: + match_dll_t gc, cache; + size_t defs_id; + int refcount; + struct match_s **children; + struct match_s *_children[3]; +} match_t; __attribute__((returns_nonnull)) match_t *new_match(def_t *defs, pat_t *pat, const char *start, const char *end, match_t *children[]); -- cgit v1.2.3