/// @file xed-flag-enum.c

// This file was automatically generated.
// Do not edit this file.

#include <string.h>
#include <assert.h>
#include "xed-flag-enum.h"

typedef struct {
    const char* name;
    xed_flag_enum_t value;
} name_table_xed_flag_enum_t;
static const name_table_xed_flag_enum_t name_array_xed_flag_enum_t[] = {
{"INVALID", XED_FLAG_INVALID},
{"of", XED_FLAG_of},
{"sf", XED_FLAG_sf},
{"zf", XED_FLAG_zf},
{"af", XED_FLAG_af},
{"pf", XED_FLAG_pf},
{"cf", XED_FLAG_cf},
{"df", XED_FLAG_df},
{"vif", XED_FLAG_vif},
{"iopl", XED_FLAG_iopl},
{"if", XED_FLAG_if},
{"ac", XED_FLAG_ac},
{"vm", XED_FLAG_vm},
{"rf", XED_FLAG_rf},
{"nt", XED_FLAG_nt},
{"tf", XED_FLAG_tf},
{"id", XED_FLAG_id},
{"vip", XED_FLAG_vip},
{"fc0", XED_FLAG_fc0},
{"fc1", XED_FLAG_fc1},
{"fc2", XED_FLAG_fc2},
{"fc3", XED_FLAG_fc3},
{"LAST", XED_FLAG_LAST},
{0, XED_FLAG_LAST},
};

        
xed_flag_enum_t str2xed_flag_enum_t(const char* s)
{
   const name_table_xed_flag_enum_t* p = name_array_xed_flag_enum_t;
   while( p->name ) {
     if (strcmp(p->name,s) == 0) {
      return p->value;
     }
     p++;
   }
        

   return XED_FLAG_INVALID;
}


const char* xed_flag_enum_t2str(const xed_flag_enum_t p)
{
   xed_flag_enum_t type_idx = p;
   if ( p > XED_FLAG_LAST) type_idx = XED_FLAG_LAST;
   return name_array_xed_flag_enum_t[type_idx].name;
}

xed_flag_enum_t xed_flag_enum_t_last(void) {
    return XED_FLAG_LAST;
}
       
/*

Here is a skeleton switch statement embedded in a comment


  switch(p) {
  case XED_FLAG_INVALID:
  case XED_FLAG_of:
  case XED_FLAG_sf:
  case XED_FLAG_zf:
  case XED_FLAG_af:
  case XED_FLAG_pf:
  case XED_FLAG_cf:
  case XED_FLAG_df:
  case XED_FLAG_vif:
  case XED_FLAG_iopl:
  case XED_FLAG_if:
  case XED_FLAG_ac:
  case XED_FLAG_vm:
  case XED_FLAG_rf:
  case XED_FLAG_nt:
  case XED_FLAG_tf:
  case XED_FLAG_id:
  case XED_FLAG_vip:
  case XED_FLAG_fc0:
  case XED_FLAG_fc1:
  case XED_FLAG_fc2:
  case XED_FLAG_fc3:
  case XED_FLAG_LAST:
  default:
     xed_assert(0);
  }
*/
