public int enumerate (String name, String description,
    String [] enum_strings, int default_value) {     

    int retval = default_value;

    try {
      String opt = option (name);
      boolean successful = false;
      if (opt != null) {
        for (int i=0; i<enum_strings.length; i++)
          if (opt.equals (enum_strings [i])) {           
            successful = true;
            retval = i;            
            break;
          }
        if (!successful) throw new RuntimeException ();
      }

    } catch (RuntimeException e) {
      invalid_names.append (name + ", ");
      // fall through
    }


    StringBuffer sb = new StringBuffer ("enum: ");
    for (int i=0; i<enum_strings.length; i++)
      sb.append (enum_strings [i] + ", ");    
    sb.delete (sb.length ()-2, sb.length ()); // delete last ", "

    add_spec (name, sb.toString (), description, 
      enum_strings [default_value], enum_strings [retval]);
    return retval;
  }