// SDB-CGEN V2.6.2
#include <ctype.h>
#include <stdio.h>
#include <string.h>

struct kv { const char *name; const char *value; };
static const struct kv kvs[] = {
// gcc -DMAIN=1 dospart.c ; ./a.out > dospart.h
	{"0", "empty"},
	{"1", "DOS 12-bit FAT"},
	{"1.fs", "fat"},
	{"11", "WIN95 OSR2 FAT32"},
	{"11.fs", "fat"},
	{"12", "WIN95 OSR2 FAT32, LBA"},
	{"12.fs", "fat"},
	{"130", "Linux swap"},
	{"131", "Linux native partition"},
	{"131.fs", "ext2"},
	{"166", "OpenBSD"},
	{"167", "NeXTStep"},
	{"168", "Mac OS-X"},
	{"169", "NetBSD"},
	{"171", "Mac OS-X Boot partition"},
	{"175", "Mac OS-X HFS"},
	{"2", "XENIX root"},
	{"3", "XENIX /usr"},
	{"4", "DOS 3.0+ 16-bit FAT (up to 32M)"},
	{"4.fs", "fat"},
	{"5", "DOS 3.0+ extended partition"},
	{"5.fs", "fat"},
	{"6", "DOS 3.0+ 16-bit FAT (over 32M)"},
	{"6.fs", "fat"},
	{"7", "Window NTFS / exFAT / QNX"},
	{"7.fs", "ntfs"},
  {NULL, NULL}
};
typedef int (*GperfForeachCallback)(void *user, const char *k, const char *v);
int gperf_dospart_foreach(GperfForeachCallback cb, void *user) {
  int i = 0; while (kvs[i].name) {
  cb (user, kvs[i].name, kvs[i].value);
  i++;}
  return 0;
}
const char *gperf_dospart_get(const char *s) {
  int i = 0; while (kvs[i].name) {
  if (!strcmp (s, kvs[i].name)) return kvs[i].value;
  i++;}
  return NULL;
}
#define sdb_hash_c_dospart(x,y) gperf_dospart_hash(x)
const unsigned int gperf_dospart_hash(const char *s) {
  int sum = strlen (s);
  while (*s) { sum += *s; s++; }
  return sum;
}
struct {const char *name;void *get;void *hash;void *foreach;} gperf_dospart = {
  .name = "dospart",
  .get = &gperf_dospart_get,
  .hash = &gperf_dospart_hash,
  .foreach = &gperf_dospart_foreach
};

#if MAIN
int main () {
	const char *s = ((char*(*)(char*))gperf_dospart.get)("foo");
	printf ("%s\n", s);
}
#endif
