diff options
| author | Burt P <pburt0@gmail.com> | 2019-07-13 10:08:36 -0500 | 
|---|---|---|
| committer | Leandro A. F. Pereira <leandro@hardinfo.org> | 2019-07-29 19:44:59 -0700 | 
| commit | 0dca7a1e165cdffa0065455b377d2658f33f4ea2 (patch) | |
| tree | 47b9cbefc77b443881b28eb8c910bb8615cb8e2d /includes | |
| parent | 4cfbf4907fa8221b7d8fcd7aa74ffd1d45691ef6 (diff) | |
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 <pburt0@gmail.com>
Diffstat (limited to 'includes')
| -rw-r--r-- | includes/vendor.h | 24 | 
1 files changed, 20 insertions, 4 deletions
| 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__ */ | 
