// SDB-CGEN V1.8.0
// gcc -DMAIN=1 dos_x86_16.c ; ./a.out > dos_x86_16.h
#include <ctype.h>
#include <stdio.h>
#include <string.h>

struct kv { const char *name; const char *value; };
static struct kv kvs[] = {
  {"AllocateMemory","0x21,72,0,0,"}, 
  {"BufferedInput","0x21,10,0,0,"}, 
  {"CanonicalizeFileName","0x21,96,0,0,"}, 
  {"CloseFile","0x21,62,0,0,"}, 
  {"CommitFile","0x21,104,0,0,"}, 
  {"CreateChildPSP","0x21,85,0,0,"}, 
  {"CreateDirectory","0x21,57,0,0,"}, 
  {"CreateFile","0x21,60,0,0,"}, 
  {"CreateNewFile","0x21,91,0,0,"}, 
  {"CreateNewPSP","0x21,38,0,0,"}, 
  {"CreateTemporaryFile","0x21,90,0,0,"}, 
  {"DirectCharInputWithoutEcho","0x21,8,0,0,"}, 
  {"DirectConsoleOutput","0x21,6,0,0,"}, 
  {"DiskReset","0x21,13,0,0,"}, 
  {"DoubleByteCharacterSet","0x21,99,0,0,"}, 
  {"Dup","0x21,69,0,0,"}, 
  {"Dup2","0x21,70,0,0,"}, 
  {"ExecuteProgram","0x21,75,0,0,"}, 
  {"ExtendedBreakCheck","0x21,51,0,0,"}, 
  {"ExtendedOpenCreate","0x21,108,0,0,"}, 
  {"FCB_CloseFile","0x21,16,0,0,"}, 
  {"FCB_CreateOrTruncateFile","0x21,22,0,0,"}, 
  {"FCB_DeleteFile","0x21,19,0,0,"}, 
  {"FCB_FindFirstMatchingFile","0x21,17,0,0,"}, 
  {"FCB_FindNextMatchingFile","0x21,18,0,0,"}, 
  {"FCB_GetAllocationOfDefaultDrive","0x21,27,0,0,"}, 
  {"FCB_GetAllocationOfSpecificDrive","0x21,28,0,0,"}, 
  {"FCB_GetFileSize","0x21,35,0,0,"}, 
  {"FCB_OpenFile","0x21,15,0,0,"}, 
  {"FCB_ParseFileIntoFCB","0x21,41,0,0,"}, 
  {"FCB_ReadRandomBlock","0x21,39,0,0,"}, 
  {"FCB_ReadRandomRecord","0x21,33,0,0,"}, 
  {"FCB_ReadSequential","0x21,20,0,0,"}, 
  {"FCB_RenameFile","0x21,23,0,0,"}, 
  {"FCB_SetRandomRecordNumber","0x21,36,0,0,"}, 
  {"FCB_WriteRandomBlock","0x21,40,0,0,"}, 
  {"FCB_WriteRandomRecord","0x21,34,0,0,"}, 
  {"FCB_WriteSequential","0x21,21,0,0,"}, 
  {"FileRegionLock","0x21,92,0,0,"}, 
  {"FindFirstMatchingFile","0x21,78,0,0,"}, 
  {"FindNextMatchingFile","0x21,79,0,0,"}, 
  {"FreeMemory","0x21,73,0,0,"}, 
  {"GetCountryInformation","0x21,101,0,0,"}, 
  {"GetCurrentDefaultDrive","0x21,25,0,0,"}, 
  {"GetCurrentDirectory","0x21,71,0,0,"}, 
  {"GetCurrentPSP","0x21,81,0,0,"}, 
  {"GetCurrentPSPAddress","0x21,98,0,0,"}, 
  {"GetDOSVersion","0x21,48,0,0,"}, 
  {"GetDiskTransferArea","0x21,47,0,0,"}, 
  {"GetDriveParameterBlockForDefaultDrive","0x21,31,0,0,"}, 
  {"GetDriveParameterBlockForSpecificDrive","0x21,50,0,0,"}, 
  {"GetExtendedErrorInformation","0x21,89,0,0,"}, 
  {"GetFreeDiskSpace","0x21,54,0,0,"}, 
  {"GetIndosFlag","0x21,52,0,0,"}, 
  {"GetInterruptVector","0x21,53,0,0,"}, 
  {"GetListOfLists","0x21,82,0,0,"}, 
  {"GetReturnCode","0x21,77,0,0,"}, 
  {"GetSetDiskSerialNumber","0x21,105,0,0,"}, 
  {"GetSetFileAttributes","0x21,67,0,0,"}, 
  {"GetSetFileDateTime","0x21,87,0,0,"}, 
  {"GetSetGlobalCodePageTable","0x21,102,0,0,"}, 
  {"GetSetMemoryAllocationStrategy","0x21,88,0,0,"}, 
  {"GetSetSwitch","0x21,55,0,0,"}, 
  {"GetStdinStatus","0x21,11,0,0,"}, 
  {"GetSystemDate","0x21,42,0,0,"}, 
  {"GetSystemTime","0x21,44,0,0,"}, 
  {"GetVerifyFlag","0x21,84,0,0,"}, 
  {"Ioctl","0x21,68,0,0,"}, 
  {"Lseek","0x21,66,0,0,"}, 
  {"NetworkFunctions","0x21,93,0,0,"}, 
  {"NetworkRedirection","0x21,95,0,0,"}, 
  {"OpenFile","0x21,61,0,0,"}, 
  {"ReadCharFromStdaux","0x21,3,0,0,"}, 
  {"ReadFile","0x21,63,0,0,"}, 
  {"ReadFromFlushedStdin","0x21,12,0,0,"}, 
  {"ReadFromStdin","0x21,7,0,0,"}, 
  {"ReadFromStdinWithEcho","0x21,1,0,i"}, 
  {"RemoveDirectory","0x21,58,0,0,"}, 
  {"RenameFile","0x21,86,0,0,"}, 
  {"ResizeMemoryBlock","0x21,74,0,0,"}, 
  {"SelectDefaultDrive","0x21,14,0,0,"}, 
  {"SetCountryCode","0x21,56,0,0,"}, 
  {"SetCurrentDirectory","0x21,59,0,0,"}, 
  {"SetCurrentPSP","0x21,80,0,0,"}, 
  {"SetDeviceDriverLookaheadFlag","0x21,100,0,0,"}, 
  {"SetDiskTransferAddress","0x21,26,0,0,"}, 
  {"SetHandleCount","0x21,103,0,0,"}, 
  {"SetInterruptVector","0x21,37,0,0,"}, 
  {"SetSystemDate","0x21,43,0,0,"}, 
  {"SetSystemTime","0x21,45,0,0,"}, 
  {"SetVerifyFlag","0x21,46,0,0,"}, 
  {"TerminateAndStayResident","0x21,49,0,0,"}, 
  {"TerminateProcess","0x21,0,1,1,i"}, 
  {"TerminateProcessWithReturnCode","0x21,76,0,0,"}, 
  {"TranslateBiosBlock","0x21,83,0,0,"}, 
  {"UnlinkFile","0x21,65,0,0,"}, 
  {"WriteCharToPrinter","0x21,5,0,0,"}, 
  {"WriteCharToStdaux","0x21,4,0,0,"}, 
  {"WriteCharToStdout","0x21,2,0,"}, 
  {"WriteFile","0x21,64,0,0,"}, 
  {"WriteStringToStdout","0x21,9,0,0,"}, 
  {"_","0x21"}, 
  {NULL, NULL}
};
// 0x4bd868
// TODO
typedef int (*GperfForeachCallback)(void *user, const char *k, const char *v);
int gperf_dos_x86_16_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_dos_x86_16_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_dos_x86_16(x,y) gperf_dos_x86_16_hash(x)
const unsigned int gperf_dos_x86_16_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_dos_x86_16 = {
  .name = "dos-x86-16",
  .get = &gperf_dos_x86_16_get,
  .hash = &gperf_dos_x86_16_hash,
  .foreach = &gperf_dos_x86_16_foreach
};

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