From 0dca7a1e165cdffa0065455b377d2658f33f4ea2 Mon Sep 17 00:00:00 2001 From: Burt P Date: Sat, 13 Jul 2019 10:08:36 -0500 Subject: vendor.ids update and vendor.{h,c} improvements from sysobj version * more fields in struct Vendor. * match_case -> match_rule and new match rule "exact". match_rule remains compatible with match_case for old conf format. * matches must be "whole word" matches so "Harmony" no longer hits for "ARM". * Parts outside of () are checked first, so "Foo (formerly Barly)" matches Foo before Barly, even though Barly is longer and would otherwise match first. * vendor_list type (a blessed GSList*) and helper functions to manage it. Signed-off-by: Burt P --- includes/vendor.h | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) (limited to 'includes/vendor.h') diff --git a/includes/vendor.h b/includes/vendor.h index 683e7d8a..f7d02998 100644 --- a/includes/vendor.h +++ b/includes/vendor.h @@ -18,16 +18,30 @@ #ifndef __VENDOR_H__ #define __VENDOR_H__ +#include "gg_slist.h" -typedef struct _Vendor Vendor; -struct _Vendor { +typedef GSList* vendor_list; +#define vendor_list_append(vl, v) g_slist_append(vl, (Vendor*)v) +#define vendor_list_concat(vl, ext) g_slist_concat(vl, ext) +vendor_list vendor_list_concat_va(int count, vendor_list vl, ...); /* count = -1 for NULL terminated list */ +#define vendor_list_free(vl) g_slist_free(vl) +#define vendor_list_remove_duplicates(vl) gg_slist_remove_duplicates(vl) +vendor_list vendor_list_remove_duplicates_deep(vendor_list vl); + +typedef struct { char *match_string; - int match_case; /* 0 = ignore case, 1 = match case */ + int match_rule; /* 0 = ignore case, 1 = match case, 2 = exact */ char *name; char *name_short; char *url; char *url_support; -}; + char *wikipedia; /* wikipedia page title (assumes en:, otherwise include langauge), usually more informative than the vendor's page */ + char *note; /* a short stored comment */ + char *ansi_color; + + unsigned long file_line; + unsigned long ms_length; +} Vendor; void vendor_init(void); void vendor_cleanup(void); @@ -39,4 +53,6 @@ gchar *vendor_get_link(const gchar *id_str); gchar *vendor_get_link_from_vendor(const Vendor *v); void vendor_free(Vendor *v); +vendor_list vendors_match_core(const gchar *str, int limit); + #endif /* __VENDOR_H__ */ -- cgit v1.2.3