+/* Internal functions to convert from human-readable names in the config file
+to enums and back. Later: replace with plugin functions. */
+static ChimaraIFFormat
+parse_format(const char *format)
+{
+ if(strcmp(format, "z5") == 0)
+ return CHIMARA_IF_FORMAT_Z5;
+ if(strcmp(format, "z6") == 0)
+ return CHIMARA_IF_FORMAT_Z6;
+ if(strcmp(format, "z8") == 0)
+ return CHIMARA_IF_FORMAT_Z8;
+ if(strcmp(format, "zblorb") == 0)
+ return CHIMARA_IF_FORMAT_Z_BLORB;
+ if(strcmp(format, "glulx") == 0)
+ return CHIMARA_IF_FORMAT_GLULX;
+ if(strcmp(format, "gblorb") == 0)
+ return CHIMARA_IF_FORMAT_GLULX_BLORB;
+ return CHIMARA_IF_FORMAT_NONE;
+}
+
+static const char *format_strings[CHIMARA_IF_NUM_FORMATS] = {
+ "z5", "z6", "z8", "zblorb", "glulx", "gblorb"
+};
+
+static const char *format_to_string(ChimaraIFFormat format)
+{
+ if(format >= 0 && format < CHIMARA_IF_NUM_FORMATS)
+ return format_strings[format];
+ return "unknown";
+}
+
+static const char *format_display_strings[CHIMARA_IF_NUM_FORMATS] = {
+ N_("Z-machine version 5"),
+ N_("Z-machine version 6"),
+ N_("Z-machine version 8"),
+ N_("Z-machine Blorb file"),
+ N_("Glulx"),
+ N_("Glulx Blorb file")
+};
+
+static const char *
+format_to_display_string(ChimaraIFFormat format)
+{
+ if(format >= 0 && format < CHIMARA_IF_NUM_FORMATS)
+ return gettext(format_display_strings[format]);
+ return _("Unknown");
+}
+
+static ChimaraIFInterpreter
+parse_interpreter(const char *interp)
+{
+ if(strcmp(interp, "frotz") == 0)
+ return CHIMARA_IF_INTERPRETER_FROTZ;
+ if(strcmp(interp, "nitfol") == 0)
+ return CHIMARA_IF_INTERPRETER_NITFOL;
+ if(strcmp(interp, "glulxe") == 0)
+ return CHIMARA_IF_INTERPRETER_GLULXE;
+ if(strcmp(interp, "git") == 0)
+ return CHIMARA_IF_INTERPRETER_GIT;
+ return CHIMARA_IF_INTERPRETER_NONE;
+}
+
+static const char *interpreter_strings[CHIMARA_IF_NUM_INTERPRETERS] = {
+ "frotz", "nitfol", "glulxe", "git"
+};
+
+static const char *
+interpreter_to_string(ChimaraIFInterpreter interp)
+{
+ if(interp >= 0 && interp < CHIMARA_IF_NUM_INTERPRETERS)
+ return interpreter_strings[interp];
+ return "unknown";
+}
+
+static const char *interpreter_display_strings[CHIMARA_IF_NUM_INTERPRETERS] = {
+ N_("Frotz"),
+ N_("Nitfol"),
+ N_("Glulxe"),
+ N_("Git")
+};
+
+static const char *
+interpreter_to_display_string(ChimaraIFInterpreter interp)
+{
+ if(interp >= 0 && interp < CHIMARA_IF_NUM_INTERPRETERS)
+ return gettext(interpreter_display_strings[interp]);
+ return _("Unknown");
+}
+