// 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 pickle.c ; ./a.out > pickle.h
	{"additems", "Add an arbitrary number of items to an existing set."},
	{"append", "Append an object to a list."},
	{"appends", "Extend a list by a slice of stack objects."},
	{"binbytes", "Push a Python bytes object."},
	{"binbytes8", "Push a Python bytes object."},
	{"binfloat", "Float stored in binary form, with 8 bytes of data."},
	{"binget", "Read an object from the memo and push it on the stack."},
	{"binint", "Push a four-byte signed integer."},
	{"binint1", "Push a one-byte unsigned integer."},
	{"binint2", "Push a two-byte unsigned integer."},
	{"binpersid", "Push an object identified by a persistent ID."},
	{"binput", "Store the stack top into the memo.  The stack is not popped."},
	{"binstring", "Push a Python string object."},
	{"binunicode", "Push a Python Unicode string object."},
	{"binunicode8", "Push a Python Unicode string object."},
	{"build", "Finish building an object, via __setstate__ or dict update."},
	{"bytearray8", "Push a Python bytearray object."},
	{"dict", "Build a dict out of the topmost stack slice, after markobject."},
	{"dup", "Push the top stack item onto the stack again, duplicating it."},
	{"empty_dict", "Push an empty dict."},
	{"empty_list", "Push an empty list."},
	{"empty_set", "Push an empty set."},
	{"empty_tuple", "Push an empty tuple."},
	{"ext1", "Extension code."},
	{"ext2", "Extension code."},
	{"ext4", "Extension code."},
	{"float", "Newline-terminated decimal float literal."},
	{"frame", "Indicate the beginning of a new frame."},
	{"frozenset", "Build a frozenset out of the topmost slice, after markobject."},
	{"get", "Read an object from the memo and push it on the stack."},
	{"global", "Push a global object (module.attr) on the stack."},
	{"inst", "Build a class instance."},
	{"int", "Push an integer or bool."},
	{"list", "Build a list out of the topmost stack slice, after markobject."},
	{"long", "Push a long integer."},
	{"long1", "Long integer using one-byte length."},
	{"long4", "Long integer using found-byte length."},
	{"long_binget", "Read an object from the memo and push it on the stack."},
	{"long_binput", "Store the stack top into the memo.  The stack is not popped."},
	{"mark", "Push markobject onto the stack."},
	{"memoize", "Store the stack top into the memo.  The stack is not popped."},
	{"newfalse", "Push False onto the stack."},
	{"newobj", "Build an object instance."},
	{"newobj_ex", "Build an object instance."},
	{"newtrue", "Push True onto the stack."},
	{"next_buffer", "Push an out-of-band buffer object."},
	{"none", "Push None on the stack."},
	{"obj", "Build a class instance."},
	{"persid", "Push an object identified by a persistent ID."},
	{"pop", "Discard the top stack item, shrinking the stack by one item."},
	{"pop_mark", "Pop all the stack objects at and above the topmost markobject."},
	{"proto", "Protocol version indicator."},
	{"put", "Store the stack top into the memo.  The stack is not popped."},
	{"readonly_buffer", "Make an out-of-band buffer object read-only."},
	{"reduce", "Push an object built from a callable and an argument tuple."},
	{"setitem", "Add a key+value pair to an existing dict."},
	{"setitems", "Add an arbitrary number of key+value pairs to an existing dict."},
	{"short_binbytes", "Push a Python bytes object."},
	{"short_binstring", "Push a Python string object."},
	{"short_binunicode", "Push a Python Unicode string object."},
	{"stack_global", "Push a global object (module.attr) on the stack."},
	{"stop", "Stop the unpickling machine."},
	{"string", "Push a Python string object."},
	{"tuple", "Build a tuple out of the topmost stack slice, after markobject."},
	{"tuple1", "Build a one-tuple out of the topmost item on the stack."},
	{"tuple2", "Build a two-tuple out of the top two items on the stack."},
	{"tuple3", "Build a three-tuple out of the top three items on the stack."},
	{"unicode", "Push a Python Unicode string object."},
  {NULL, NULL}
};
typedef int (*GperfForeachCallback)(void *user, const char *k, const char *v);
int gperf_pickle_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_pickle_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_pickle(x,y) gperf_pickle_hash(x)
const unsigned int gperf_pickle_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_pickle = {
  .name = "pickle",
  .get = &gperf_pickle_get,
  .hash = &gperf_pickle_hash,
  .foreach = &gperf_pickle_foreach
};

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