// // This file is generated by fmtgen from "libaegis/uconf.def". // If you want to change the contents of this file // you need to edit libaegis/uconf.def // or you need to enhance fmtgen. // #include #include #include #include #include #include #include #include #include #include #include #include static const char *uconf_delete_file_preference_s[] = { "no_keep", "interactive", "keep", }; static string_ty *uconf_delete_file_preference_f[SIZEOF(uconf_delete_file_preference_s)]; const char * uconf_delete_file_preference_ename(uconf_delete_file_preference_ty this_thing) { static char buffer[20]; if ((int)this_thing >= 0 && (int)this_thing < 3) return uconf_delete_file_preference_s[this_thing]; snprintf(buffer, sizeof(buffer), "%d", (int)this_thing); return buffer; } void uconf_delete_file_preference_write(const output::pointer &fp, const char *name, uconf_delete_file_preference_ty this_thing, bool show) { if (this_thing == 0) { if (!show || type_enum_option_query()) return; } if (name) { fp->fputs(name); fp->fputs(" = "); } fp->fputs(uconf_delete_file_preference_s[this_thing]); if (name) fp->fputs(";\n"); } void uconf_delete_file_preference_write_xml(const output::pointer &fp, const char *name, uconf_delete_file_preference_ty this_thing, bool show) { if (this_thing == 0) { if (!show || type_enum_option_query()) return; } assert(name); assert((size_t)this_thing < SIZEOF(uconf_delete_file_preference_s)); fp->fputc('<'); fp->fputs(name); fp->fputc('>'); fp->fputs(uconf_delete_file_preference_s[this_thing]); fp->fputs("fputs(name); fp->fputs(">\n"); } static bool uconf_delete_file_preference_parse(string_ty *name, void *ptr) { slow_to_fast(uconf_delete_file_preference_s, uconf_delete_file_preference_f, SIZEOF(uconf_delete_file_preference_s)); for (size_t j = 0; j < SIZEOF(uconf_delete_file_preference_f); ++j) { if (str_equal(name, uconf_delete_file_preference_f[j])) { *(uconf_delete_file_preference_ty *)ptr = (uconf_delete_file_preference_ty)j; return true; } } return false; } static string_ty * uconf_delete_file_preference_fuzzy(string_ty *name) { return generic_enum_fuzzy(name, uconf_delete_file_preference_f, SIZEOF(uconf_delete_file_preference_f)); } static rpt_value::pointer uconf_delete_file_preference_convert(void *this_thing) { if (!uconf_delete_file_preference_f[0]) slow_to_fast(uconf_delete_file_preference_s, uconf_delete_file_preference_f, SIZEOF(uconf_delete_file_preference_s)); return generic_enum_convert ( (int)*(uconf_delete_file_preference_ty *)this_thing, uconf_delete_file_preference_f, SIZEOF(uconf_delete_file_preference_f) ); } static bool uconf_delete_file_preference_is_set(void *this_thing) { return (*(uconf_delete_file_preference_ty *)this_thing != 0); } meta_type uconf_delete_file_preference_type = { "uconf_delete_file_preference", 0, // alloc 0, // free uconf_delete_file_preference_parse, 0, // list_parse 0, // struct_parse uconf_delete_file_preference_fuzzy, uconf_delete_file_preference_convert, uconf_delete_file_preference_is_set, }; static const char *uconf_diff_preference_s[] = { "automatic_merge", "no_merge", "only_merge", }; static string_ty *uconf_diff_preference_f[SIZEOF(uconf_diff_preference_s)]; const char * uconf_diff_preference_ename(uconf_diff_preference_ty this_thing) { static char buffer[20]; if ((int)this_thing >= 0 && (int)this_thing < 3) return uconf_diff_preference_s[this_thing]; snprintf(buffer, sizeof(buffer), "%d", (int)this_thing); return buffer; } void uconf_diff_preference_write(const output::pointer &fp, const char *name, uconf_diff_preference_ty this_thing, bool show) { if (this_thing == 0) { if (!show || type_enum_option_query()) return; } if (name) { fp->fputs(name); fp->fputs(" = "); } fp->fputs(uconf_diff_preference_s[this_thing]); if (name) fp->fputs(";\n"); } void uconf_diff_preference_write_xml(const output::pointer &fp, const char *name, uconf_diff_preference_ty this_thing, bool show) { if (this_thing == 0) { if (!show || type_enum_option_query()) return; } assert(name); assert((size_t)this_thing < SIZEOF(uconf_diff_preference_s)); fp->fputc('<'); fp->fputs(name); fp->fputc('>'); fp->fputs(uconf_diff_preference_s[this_thing]); fp->fputs("fputs(name); fp->fputs(">\n"); } static bool uconf_diff_preference_parse(string_ty *name, void *ptr) { slow_to_fast(uconf_diff_preference_s, uconf_diff_preference_f, SIZEOF(uconf_diff_preference_s)); for (size_t j = 0; j < SIZEOF(uconf_diff_preference_f); ++j) { if (str_equal(name, uconf_diff_preference_f[j])) { *(uconf_diff_preference_ty *)ptr = (uconf_diff_preference_ty)j; return true; } } return false; } static string_ty * uconf_diff_preference_fuzzy(string_ty *name) { return generic_enum_fuzzy(name, uconf_diff_preference_f, SIZEOF(uconf_diff_preference_f)); } static rpt_value::pointer uconf_diff_preference_convert(void *this_thing) { if (!uconf_diff_preference_f[0]) slow_to_fast(uconf_diff_preference_s, uconf_diff_preference_f, SIZEOF(uconf_diff_preference_s)); return generic_enum_convert ( (int)*(uconf_diff_preference_ty *)this_thing, uconf_diff_preference_f, SIZEOF(uconf_diff_preference_f) ); } static bool uconf_diff_preference_is_set(void *this_thing) { return (*(uconf_diff_preference_ty *)this_thing != 0); } meta_type uconf_diff_preference_type = { "uconf_diff_preference", 0, // alloc 0, // free uconf_diff_preference_parse, 0, // list_parse 0, // struct_parse uconf_diff_preference_fuzzy, uconf_diff_preference_convert, uconf_diff_preference_is_set, }; static const char *uconf_pager_preference_s[] = { "foreground", "never", }; static string_ty *uconf_pager_preference_f[SIZEOF(uconf_pager_preference_s)]; const char * uconf_pager_preference_ename(uconf_pager_preference_ty this_thing) { static char buffer[20]; if ((int)this_thing >= 0 && (int)this_thing < 2) return uconf_pager_preference_s[this_thing]; snprintf(buffer, sizeof(buffer), "%d", (int)this_thing); return buffer; } void uconf_pager_preference_write(const output::pointer &fp, const char *name, uconf_pager_preference_ty this_thing, bool show) { if (this_thing == 0) { if (!show || type_enum_option_query()) return; } if (name) { fp->fputs(name); fp->fputs(" = "); } fp->fputs(uconf_pager_preference_s[this_thing]); if (name) fp->fputs(";\n"); } void uconf_pager_preference_write_xml(const output::pointer &fp, const char *name, uconf_pager_preference_ty this_thing, bool show) { if (this_thing == 0) { if (!show || type_enum_option_query()) return; } assert(name); assert((size_t)this_thing < SIZEOF(uconf_pager_preference_s)); fp->fputc('<'); fp->fputs(name); fp->fputc('>'); fp->fputs(uconf_pager_preference_s[this_thing]); fp->fputs("fputs(name); fp->fputs(">\n"); } static bool uconf_pager_preference_parse(string_ty *name, void *ptr) { slow_to_fast(uconf_pager_preference_s, uconf_pager_preference_f, SIZEOF(uconf_pager_preference_s)); for (size_t j = 0; j < SIZEOF(uconf_pager_preference_f); ++j) { if (str_equal(name, uconf_pager_preference_f[j])) { *(uconf_pager_preference_ty *)ptr = (uconf_pager_preference_ty)j; return true; } } return false; } static string_ty * uconf_pager_preference_fuzzy(string_ty *name) { return generic_enum_fuzzy(name, uconf_pager_preference_f, SIZEOF(uconf_pager_preference_f)); } static rpt_value::pointer uconf_pager_preference_convert(void *this_thing) { if (!uconf_pager_preference_f[0]) slow_to_fast(uconf_pager_preference_s, uconf_pager_preference_f, SIZEOF(uconf_pager_preference_s)); return generic_enum_convert ( (int)*(uconf_pager_preference_ty *)this_thing, uconf_pager_preference_f, SIZEOF(uconf_pager_preference_f) ); } static bool uconf_pager_preference_is_set(void *this_thing) { return (*(uconf_pager_preference_ty *)this_thing != 0); } meta_type uconf_pager_preference_type = { "uconf_pager_preference", 0, // alloc 0, // free uconf_pager_preference_parse, 0, // list_parse 0, // struct_parse uconf_pager_preference_fuzzy, uconf_pager_preference_convert, uconf_pager_preference_is_set, }; static const char *uconf_persevere_preference_s[] = { "all", "stop", }; static string_ty *uconf_persevere_preference_f[SIZEOF(uconf_persevere_preference_s)]; const char * uconf_persevere_preference_ename(uconf_persevere_preference_ty this_thing) { static char buffer[20]; if ((int)this_thing >= 0 && (int)this_thing < 2) return uconf_persevere_preference_s[this_thing]; snprintf(buffer, sizeof(buffer), "%d", (int)this_thing); return buffer; } void uconf_persevere_preference_write(const output::pointer &fp, const char *name, uconf_persevere_preference_ty this_thing, bool show) { if (this_thing == 0) { if (!show || type_enum_option_query()) return; } if (name) { fp->fputs(name); fp->fputs(" = "); } fp->fputs(uconf_persevere_preference_s[this_thing]); if (name) fp->fputs(";\n"); } void uconf_persevere_preference_write_xml(const output::pointer &fp, const char *name, uconf_persevere_preference_ty this_thing, bool show) { if (this_thing == 0) { if (!show || type_enum_option_query()) return; } assert(name); assert((size_t)this_thing < SIZEOF(uconf_persevere_preference_s)); fp->fputc('<'); fp->fputs(name); fp->fputc('>'); fp->fputs(uconf_persevere_preference_s[this_thing]); fp->fputs("fputs(name); fp->fputs(">\n"); } static bool uconf_persevere_preference_parse(string_ty *name, void *ptr) { slow_to_fast(uconf_persevere_preference_s, uconf_persevere_preference_f, SIZEOF(uconf_persevere_preference_s)); for (size_t j = 0; j < SIZEOF(uconf_persevere_preference_f); ++j) { if (str_equal(name, uconf_persevere_preference_f[j])) { *(uconf_persevere_preference_ty *)ptr = (uconf_persevere_preference_ty)j; return true; } } return false; } static string_ty * uconf_persevere_preference_fuzzy(string_ty *name) { return generic_enum_fuzzy(name, uconf_persevere_preference_f, SIZEOF(uconf_persevere_preference_f)); } static rpt_value::pointer uconf_persevere_preference_convert(void *this_thing) { if (!uconf_persevere_preference_f[0]) slow_to_fast(uconf_persevere_preference_s, uconf_persevere_preference_f, SIZEOF(uconf_persevere_preference_s)); return generic_enum_convert ( (int)*(uconf_persevere_preference_ty *)this_thing, uconf_persevere_preference_f, SIZEOF(uconf_persevere_preference_f) ); } static bool uconf_persevere_preference_is_set(void *this_thing) { return (*(uconf_persevere_preference_ty *)this_thing != 0); } meta_type uconf_persevere_preference_type = { "uconf_persevere_preference", 0, // alloc 0, // free uconf_persevere_preference_parse, 0, // list_parse 0, // struct_parse uconf_persevere_preference_fuzzy, uconf_persevere_preference_convert, uconf_persevere_preference_is_set, }; static const char *uconf_log_file_preference_s[] = { "snuggle", "append", "replace", "never", }; static string_ty *uconf_log_file_preference_f[SIZEOF(uconf_log_file_preference_s)]; const char * uconf_log_file_preference_ename(uconf_log_file_preference_ty this_thing) { static char buffer[20]; if ((int)this_thing >= 0 && (int)this_thing < 4) return uconf_log_file_preference_s[this_thing]; snprintf(buffer, sizeof(buffer), "%d", (int)this_thing); return buffer; } void uconf_log_file_preference_write(const output::pointer &fp, const char *name, uconf_log_file_preference_ty this_thing, bool show) { if (this_thing == 0) { if (!show || type_enum_option_query()) return; } if (name) { fp->fputs(name); fp->fputs(" = "); } fp->fputs(uconf_log_file_preference_s[this_thing]); if (name) fp->fputs(";\n"); } void uconf_log_file_preference_write_xml(const output::pointer &fp, const char *name, uconf_log_file_preference_ty this_thing, bool show) { if (this_thing == 0) { if (!show || type_enum_option_query()) return; } assert(name); assert((size_t)this_thing < SIZEOF(uconf_log_file_preference_s)); fp->fputc('<'); fp->fputs(name); fp->fputc('>'); fp->fputs(uconf_log_file_preference_s[this_thing]); fp->fputs("fputs(name); fp->fputs(">\n"); } static bool uconf_log_file_preference_parse(string_ty *name, void *ptr) { slow_to_fast(uconf_log_file_preference_s, uconf_log_file_preference_f, SIZEOF(uconf_log_file_preference_s)); for (size_t j = 0; j < SIZEOF(uconf_log_file_preference_f); ++j) { if (str_equal(name, uconf_log_file_preference_f[j])) { *(uconf_log_file_preference_ty *)ptr = (uconf_log_file_preference_ty)j; return true; } } return false; } static string_ty * uconf_log_file_preference_fuzzy(string_ty *name) { return generic_enum_fuzzy(name, uconf_log_file_preference_f, SIZEOF(uconf_log_file_preference_f)); } static rpt_value::pointer uconf_log_file_preference_convert(void *this_thing) { if (!uconf_log_file_preference_f[0]) slow_to_fast(uconf_log_file_preference_s, uconf_log_file_preference_f, SIZEOF(uconf_log_file_preference_s)); return generic_enum_convert ( (int)*(uconf_log_file_preference_ty *)this_thing, uconf_log_file_preference_f, SIZEOF(uconf_log_file_preference_f) ); } static bool uconf_log_file_preference_is_set(void *this_thing) { return (*(uconf_log_file_preference_ty *)this_thing != 0); } meta_type uconf_log_file_preference_type = { "uconf_log_file_preference", 0, // alloc 0, // free uconf_log_file_preference_parse, 0, // list_parse 0, // struct_parse uconf_log_file_preference_fuzzy, uconf_log_file_preference_convert, uconf_log_file_preference_is_set, }; static const char *uconf_lock_wait_preference_s[] = { "always", "background", "never", }; static string_ty *uconf_lock_wait_preference_f[SIZEOF(uconf_lock_wait_preference_s)]; const char * uconf_lock_wait_preference_ename(uconf_lock_wait_preference_ty this_thing) { static char buffer[20]; if ((int)this_thing >= 0 && (int)this_thing < 3) return uconf_lock_wait_preference_s[this_thing]; snprintf(buffer, sizeof(buffer), "%d", (int)this_thing); return buffer; } void uconf_lock_wait_preference_write(const output::pointer &fp, const char *name, uconf_lock_wait_preference_ty this_thing, bool show) { if (this_thing == 0) { if (!show || type_enum_option_query()) return; } if (name) { fp->fputs(name); fp->fputs(" = "); } fp->fputs(uconf_lock_wait_preference_s[this_thing]); if (name) fp->fputs(";\n"); } void uconf_lock_wait_preference_write_xml(const output::pointer &fp, const char *name, uconf_lock_wait_preference_ty this_thing, bool show) { if (this_thing == 0) { if (!show || type_enum_option_query()) return; } assert(name); assert((size_t)this_thing < SIZEOF(uconf_lock_wait_preference_s)); fp->fputc('<'); fp->fputs(name); fp->fputc('>'); fp->fputs(uconf_lock_wait_preference_s[this_thing]); fp->fputs("fputs(name); fp->fputs(">\n"); } static bool uconf_lock_wait_preference_parse(string_ty *name, void *ptr) { slow_to_fast(uconf_lock_wait_preference_s, uconf_lock_wait_preference_f, SIZEOF(uconf_lock_wait_preference_s)); for (size_t j = 0; j < SIZEOF(uconf_lock_wait_preference_f); ++j) { if (str_equal(name, uconf_lock_wait_preference_f[j])) { *(uconf_lock_wait_preference_ty *)ptr = (uconf_lock_wait_preference_ty)j; return true; } } return false; } static string_ty * uconf_lock_wait_preference_fuzzy(string_ty *name) { return generic_enum_fuzzy(name, uconf_lock_wait_preference_f, SIZEOF(uconf_lock_wait_preference_f)); } static rpt_value::pointer uconf_lock_wait_preference_convert(void *this_thing) { if (!uconf_lock_wait_preference_f[0]) slow_to_fast(uconf_lock_wait_preference_s, uconf_lock_wait_preference_f, SIZEOF(uconf_lock_wait_preference_s)); return generic_enum_convert ( (int)*(uconf_lock_wait_preference_ty *)this_thing, uconf_lock_wait_preference_f, SIZEOF(uconf_lock_wait_preference_f) ); } static bool uconf_lock_wait_preference_is_set(void *this_thing) { return (*(uconf_lock_wait_preference_ty *)this_thing != 0); } meta_type uconf_lock_wait_preference_type = { "uconf_lock_wait_preference", 0, // alloc 0, // free uconf_lock_wait_preference_parse, 0, // list_parse 0, // struct_parse uconf_lock_wait_preference_fuzzy, uconf_lock_wait_preference_convert, uconf_lock_wait_preference_is_set, }; static const char *uconf_symbolic_link_preference_s[] = { "verify", "assume", }; static string_ty *uconf_symbolic_link_preference_f[SIZEOF(uconf_symbolic_link_preference_s)]; const char * uconf_symbolic_link_preference_ename(uconf_symbolic_link_preference_ty this_thing) { static char buffer[20]; if ((int)this_thing >= 0 && (int)this_thing < 2) return uconf_symbolic_link_preference_s[this_thing]; snprintf(buffer, sizeof(buffer), "%d", (int)this_thing); return buffer; } void uconf_symbolic_link_preference_write(const output::pointer &fp, const char *name, uconf_symbolic_link_preference_ty this_thing, bool show) { if (this_thing == 0) { if (!show || type_enum_option_query()) return; } if (name) { fp->fputs(name); fp->fputs(" = "); } fp->fputs(uconf_symbolic_link_preference_s[this_thing]); if (name) fp->fputs(";\n"); } void uconf_symbolic_link_preference_write_xml(const output::pointer &fp, const char *name, uconf_symbolic_link_preference_ty this_thing, bool show) { if (this_thing == 0) { if (!show || type_enum_option_query()) return; } assert(name); assert((size_t)this_thing < SIZEOF(uconf_symbolic_link_preference_s)); fp->fputc('<'); fp->fputs(name); fp->fputc('>'); fp->fputs(uconf_symbolic_link_preference_s[this_thing]); fp->fputs("fputs(name); fp->fputs(">\n"); } static bool uconf_symbolic_link_preference_parse(string_ty *name, void *ptr) { slow_to_fast(uconf_symbolic_link_preference_s, uconf_symbolic_link_preference_f, SIZEOF(uconf_symbolic_link_preference_s)); for (size_t j = 0; j < SIZEOF(uconf_symbolic_link_preference_f); ++j) { if (str_equal(name, uconf_symbolic_link_preference_f[j])) { *(uconf_symbolic_link_preference_ty *)ptr = (uconf_symbolic_link_preference_ty)j; return true; } } return false; } static string_ty * uconf_symbolic_link_preference_fuzzy(string_ty *name) { return generic_enum_fuzzy(name, uconf_symbolic_link_preference_f, SIZEOF(uconf_symbolic_link_preference_f)); } static rpt_value::pointer uconf_symbolic_link_preference_convert(void *this_thing) { if (!uconf_symbolic_link_preference_f[0]) slow_to_fast(uconf_symbolic_link_preference_s, uconf_symbolic_link_preference_f, SIZEOF(uconf_symbolic_link_preference_s)); return generic_enum_convert ( (int)*(uconf_symbolic_link_preference_ty *)this_thing, uconf_symbolic_link_preference_f, SIZEOF(uconf_symbolic_link_preference_f) ); } static bool uconf_symbolic_link_preference_is_set(void *this_thing) { return (*(uconf_symbolic_link_preference_ty *)this_thing != 0); } meta_type uconf_symbolic_link_preference_type = { "uconf_symbolic_link_preference", 0, // alloc 0, // free uconf_symbolic_link_preference_parse, 0, // list_parse 0, // struct_parse uconf_symbolic_link_preference_fuzzy, uconf_symbolic_link_preference_convert, uconf_symbolic_link_preference_is_set, }; static const char *uconf_relative_filename_preference_s[] = { "current", "base", }; static string_ty *uconf_relative_filename_preference_f[SIZEOF(uconf_relative_filename_preference_s)]; const char * uconf_relative_filename_preference_ename(uconf_relative_filename_preference_ty this_thing) { static char buffer[20]; if ((int)this_thing >= 0 && (int)this_thing < 2) return uconf_relative_filename_preference_s[this_thing]; snprintf(buffer, sizeof(buffer), "%d", (int)this_thing); return buffer; } void uconf_relative_filename_preference_write(const output::pointer &fp, const char *name, uconf_relative_filename_preference_ty this_thing, bool show) { if (this_thing == 0) { if (!show || type_enum_option_query()) return; } if (name) { fp->fputs(name); fp->fputs(" = "); } fp->fputs(uconf_relative_filename_preference_s[this_thing]); if (name) fp->fputs(";\n"); } void uconf_relative_filename_preference_write_xml(const output::pointer &fp, const char *name, uconf_relative_filename_preference_ty this_thing, bool show) { if (this_thing == 0) { if (!show || type_enum_option_query()) return; } assert(name); assert((size_t)this_thing < SIZEOF(uconf_relative_filename_preference_s)); fp->fputc('<'); fp->fputs(name); fp->fputc('>'); fp->fputs(uconf_relative_filename_preference_s[this_thing]); fp->fputs("fputs(name); fp->fputs(">\n"); } static bool uconf_relative_filename_preference_parse(string_ty *name, void *ptr) { slow_to_fast(uconf_relative_filename_preference_s, uconf_relative_filename_preference_f, SIZEOF(uconf_relative_filename_preference_s)); for (size_t j = 0; j < SIZEOF(uconf_relative_filename_preference_f); ++j) { if (str_equal(name, uconf_relative_filename_preference_f[j])) { *(uconf_relative_filename_preference_ty *)ptr = (uconf_relative_filename_preference_ty)j; return true; } } return false; } static string_ty * uconf_relative_filename_preference_fuzzy(string_ty *name) { return generic_enum_fuzzy(name, uconf_relative_filename_preference_f, SIZEOF(uconf_relative_filename_preference_f)); } static rpt_value::pointer uconf_relative_filename_preference_convert(void *this_thing) { if (!uconf_relative_filename_preference_f[0]) slow_to_fast(uconf_relative_filename_preference_s, uconf_relative_filename_preference_f, SIZEOF(uconf_relative_filename_preference_s)); return generic_enum_convert ( (int)*(uconf_relative_filename_preference_ty *)this_thing, uconf_relative_filename_preference_f, SIZEOF(uconf_relative_filename_preference_f) ); } static bool uconf_relative_filename_preference_is_set(void *this_thing) { return (*(uconf_relative_filename_preference_ty *)this_thing != 0); } meta_type uconf_relative_filename_preference_type = { "uconf_relative_filename_preference", 0, // alloc 0, // free uconf_relative_filename_preference_parse, 0, // list_parse 0, // struct_parse uconf_relative_filename_preference_fuzzy, uconf_relative_filename_preference_convert, uconf_relative_filename_preference_is_set, }; static const char *uconf_whiteout_preference_s[] = { "always", "never", }; static string_ty *uconf_whiteout_preference_f[SIZEOF(uconf_whiteout_preference_s)]; const char * uconf_whiteout_preference_ename(uconf_whiteout_preference_ty this_thing) { static char buffer[20]; if ((int)this_thing >= 0 && (int)this_thing < 2) return uconf_whiteout_preference_s[this_thing]; snprintf(buffer, sizeof(buffer), "%d", (int)this_thing); return buffer; } void uconf_whiteout_preference_write(const output::pointer &fp, const char *name, uconf_whiteout_preference_ty this_thing, bool show) { if (this_thing == 0) { if (!show || type_enum_option_query()) return; } if (name) { fp->fputs(name); fp->fputs(" = "); } fp->fputs(uconf_whiteout_preference_s[this_thing]); if (name) fp->fputs(";\n"); } void uconf_whiteout_preference_write_xml(const output::pointer &fp, const char *name, uconf_whiteout_preference_ty this_thing, bool show) { if (this_thing == 0) { if (!show || type_enum_option_query()) return; } assert(name); assert((size_t)this_thing < SIZEOF(uconf_whiteout_preference_s)); fp->fputc('<'); fp->fputs(name); fp->fputc('>'); fp->fputs(uconf_whiteout_preference_s[this_thing]); fp->fputs("fputs(name); fp->fputs(">\n"); } static bool uconf_whiteout_preference_parse(string_ty *name, void *ptr) { slow_to_fast(uconf_whiteout_preference_s, uconf_whiteout_preference_f, SIZEOF(uconf_whiteout_preference_s)); for (size_t j = 0; j < SIZEOF(uconf_whiteout_preference_f); ++j) { if (str_equal(name, uconf_whiteout_preference_f[j])) { *(uconf_whiteout_preference_ty *)ptr = (uconf_whiteout_preference_ty)j; return true; } } return false; } static string_ty * uconf_whiteout_preference_fuzzy(string_ty *name) { return generic_enum_fuzzy(name, uconf_whiteout_preference_f, SIZEOF(uconf_whiteout_preference_f)); } static rpt_value::pointer uconf_whiteout_preference_convert(void *this_thing) { if (!uconf_whiteout_preference_f[0]) slow_to_fast(uconf_whiteout_preference_s, uconf_whiteout_preference_f, SIZEOF(uconf_whiteout_preference_s)); return generic_enum_convert ( (int)*(uconf_whiteout_preference_ty *)this_thing, uconf_whiteout_preference_f, SIZEOF(uconf_whiteout_preference_f) ); } static bool uconf_whiteout_preference_is_set(void *this_thing) { return (*(uconf_whiteout_preference_ty *)this_thing != 0); } meta_type uconf_whiteout_preference_type = { "uconf_whiteout_preference", 0, // alloc 0, // free uconf_whiteout_preference_parse, 0, // list_parse 0, // struct_parse uconf_whiteout_preference_fuzzy, uconf_whiteout_preference_convert, uconf_whiteout_preference_is_set, }; void uconf_write(const output::pointer &fp, uconf_ty *this_thing) { if (!this_thing) return; trace(("uconf_write(this_thing = %08lX)\n{\n", (long)this_thing)); assert(((uconf_ty *)this_thing)->reference_count > 0); trace(("rc = %ld;\n", ((uconf_ty *)this_thing)->reference_count)); string_write(fp, "default_project_name", this_thing->default_project_name); integer_write(fp, "default_change_number", this_thing->default_change_number, 0); string_write(fp, "default_development_directory", this_thing->default_development_directory); string_write(fp, "default_project_directory", this_thing->default_project_directory); uconf_delete_file_preference_write(fp, "delete_file_preference", this_thing->delete_file_preference, 1); uconf_diff_preference_write(fp, "diff_preference", this_thing->diff_preference, 1); uconf_pager_preference_write(fp, "pager_preference", this_thing->pager_preference, 1); uconf_persevere_preference_write(fp, "persevere_preference", this_thing->persevere_preference, 1); uconf_log_file_preference_write(fp, "log_file_preference", this_thing->log_file_preference, 1); uconf_lock_wait_preference_write(fp, "lock_wait_preference", this_thing->lock_wait_preference, 1); uconf_symbolic_link_preference_write(fp, "symbolic_link_preference", this_thing->symbolic_link_preference, 1); uconf_relative_filename_preference_write(fp, "relative_filename_preference", this_thing->relative_filename_preference, 1); string_write(fp, "email_address", this_thing->email_address); uconf_whiteout_preference_write(fp, "whiteout_preference", this_thing->whiteout_preference, 1); string_write(fp, "editor_command", this_thing->editor_command); string_write(fp, "visual_command", this_thing->visual_command); string_write(fp, "pager_command", this_thing->pager_command); attributes_list_write(fp, "attribute", this_thing->attribute); trace(("}\n")); } void uconf_write_xml(const output::pointer &fp, uconf_ty *this_thing) { if (!this_thing) return; trace(("uconf_write_xml(this_thing = %08lX)\n{\n", (long)this_thing)); assert(((uconf_ty *)this_thing)->reference_count > 0); trace(("rc = %ld;\n", ((uconf_ty *)this_thing)->reference_count)); fp->fputs("\n"); string_write_xml(fp, "default_project_name", this_thing->default_project_name); integer_write_xml(fp, "default_change_number", this_thing->default_change_number, 0); string_write_xml(fp, "default_development_directory", this_thing->default_development_directory); string_write_xml(fp, "default_project_directory", this_thing->default_project_directory); uconf_delete_file_preference_write_xml(fp, "delete_file_preference", this_thing->delete_file_preference, 0); uconf_diff_preference_write_xml(fp, "diff_preference", this_thing->diff_preference, 0); uconf_pager_preference_write_xml(fp, "pager_preference", this_thing->pager_preference, 0); uconf_persevere_preference_write_xml(fp, "persevere_preference", this_thing->persevere_preference, 0); uconf_log_file_preference_write_xml(fp, "log_file_preference", this_thing->log_file_preference, 0); uconf_lock_wait_preference_write_xml(fp, "lock_wait_preference", this_thing->lock_wait_preference, 0); uconf_symbolic_link_preference_write_xml(fp, "symbolic_link_preference", this_thing->symbolic_link_preference, 0); uconf_relative_filename_preference_write_xml(fp, "relative_filename_preference", this_thing->relative_filename_preference, 0); string_write_xml(fp, "email_address", this_thing->email_address); uconf_whiteout_preference_write_xml(fp, "whiteout_preference", this_thing->whiteout_preference, 0); string_write_xml(fp, "editor_command", this_thing->editor_command); string_write_xml(fp, "visual_command", this_thing->visual_command); string_write_xml(fp, "pager_command", this_thing->pager_command); attributes_list_write_xml(fp, "attribute", this_thing->attribute); fp->fputs("\n"); } static void * uconf_alloc(void) { uconf_ty *this_thing; trace(("uconf_alloc()\n{\n")); this_thing = (uconf_ty *)mem_alloc(sizeof(uconf_ty)); this_thing->reference_count = 1; this_thing->mask = 0; this_thing->errpos = str_copy(lex_position()); this_thing->default_project_name = (string_ty *)0; this_thing->default_change_number = (long)0; this_thing->default_development_directory = (string_ty *)0; this_thing->default_project_directory = (string_ty *)0; this_thing->delete_file_preference = (uconf_delete_file_preference_ty)0; this_thing->diff_preference = (uconf_diff_preference_ty)0; this_thing->pager_preference = (uconf_pager_preference_ty)0; this_thing->persevere_preference = (uconf_persevere_preference_ty)0; this_thing->log_file_preference = (uconf_log_file_preference_ty)0; this_thing->lock_wait_preference = (uconf_lock_wait_preference_ty)0; this_thing->symbolic_link_preference = (uconf_symbolic_link_preference_ty)0; this_thing->relative_filename_preference = (uconf_relative_filename_preference_ty)0; this_thing->email_address = (string_ty *)0; this_thing->whiteout_preference = (uconf_whiteout_preference_ty)0; this_thing->editor_command = (string_ty *)0; this_thing->visual_command = (string_ty *)0; this_thing->pager_command = (string_ty *)0; this_thing->attribute = (attributes_list_ty *)0; trace(("return %08lX;\n", (long)this_thing)); trace(("}\n")); return this_thing; } uconf_ty * uconf_copy(uconf_ty *this_thing) { trace(("uconf_copy()\n{\n")); this_thing->reference_count++; trace(("return %08lX;\n", (long)this_thing)); trace(("}\n")); return this_thing; } uconf_ty * uconf_clone(uconf_ty *this_thing) { if (!this_thing) return 0; trace(("uconf_clone()\n{\n")); uconf_ty *result = (uconf_ty *)uconf_alloc(); result->default_project_name = str_copy(this_thing->default_project_name); result->default_change_number = this_thing->default_change_number; result->default_development_directory = str_copy(this_thing->default_development_directory); result->default_project_directory = str_copy(this_thing->default_project_directory); result->delete_file_preference = this_thing->delete_file_preference; result->diff_preference = this_thing->diff_preference; result->pager_preference = this_thing->pager_preference; result->persevere_preference = this_thing->persevere_preference; result->log_file_preference = this_thing->log_file_preference; result->lock_wait_preference = this_thing->lock_wait_preference; result->symbolic_link_preference = this_thing->symbolic_link_preference; result->relative_filename_preference = this_thing->relative_filename_preference; result->email_address = str_copy(this_thing->email_address); result->whiteout_preference = this_thing->whiteout_preference; result->editor_command = str_copy(this_thing->editor_command); result->visual_command = str_copy(this_thing->visual_command); result->pager_command = str_copy(this_thing->pager_command); result->attribute = attributes_list_clone(this_thing->attribute); trace(("return %08lX;\n", (long)result)); trace(("}\n")); return result; } #ifdef DEBUG void uconf_trace_real(const char *name, const uconf_ty *value) { if (name && *name) { trace_printf("%s = ", name); } if (!value) { trace_printf("NULL"); } else { trace_printf("{\n"); trace_string_real("default_project_name", value->default_project_name); trace_long_real("default_change_number", &value->default_change_number); trace_string_real("default_development_directory", value->default_development_directory); trace_string_real("default_project_directory", value->default_project_directory); trace_printf("delete_file_preference = %s;\n", uconf_delete_file_preference_ename(value->delete_file_preference)); trace_printf("diff_preference = %s;\n", uconf_diff_preference_ename(value->diff_preference)); trace_printf("pager_preference = %s;\n", uconf_pager_preference_ename(value->pager_preference)); trace_printf("persevere_preference = %s;\n", uconf_persevere_preference_ename(value->persevere_preference)); trace_printf("log_file_preference = %s;\n", uconf_log_file_preference_ename(value->log_file_preference)); trace_printf("lock_wait_preference = %s;\n", uconf_lock_wait_preference_ename(value->lock_wait_preference)); trace_printf("symbolic_link_preference = %s;\n", uconf_symbolic_link_preference_ename(value->symbolic_link_preference)); trace_printf("relative_filename_preference = %s;\n", uconf_relative_filename_preference_ename(value->relative_filename_preference)); trace_string_real("email_address", value->email_address); trace_printf("whiteout_preference = %s;\n", uconf_whiteout_preference_ename(value->whiteout_preference)); trace_string_real("editor_command", value->editor_command); trace_string_real("visual_command", value->visual_command); trace_string_real("pager_command", value->pager_command); attributes_list_trace_real("attribute", value->attribute); trace_printf("}"); } trace_printf((name && *name) ? ";\n" : ",\n"); } #endif // DEBUG static void uconf_free(void *that) { uconf_ty *this_thing; this_thing = (uconf_ty *)that; if (!this_thing) return; this_thing->reference_count--; assert(this_thing->reference_count >= 0); if (this_thing->reference_count > 0) return; trace(("uconf_free(this_thing = %08lX)\n{\n", (long)this_thing)); if (this_thing->errpos) { str_free(this_thing->errpos); this_thing->errpos = 0; } str_free(this_thing->default_project_name); str_free(this_thing->default_development_directory); str_free(this_thing->default_project_directory); str_free(this_thing->email_address); str_free(this_thing->editor_command); str_free(this_thing->visual_command); str_free(this_thing->pager_command); attributes_list_type.free(this_thing->attribute); mem_free(this_thing); trace(("}\n")); } static type_table_ty uconf_table[] = { { "default_project_name", offsetof(uconf_ty, default_project_name), &string_type, uconf_default_project_name_mask, 0, // redefinition not ok 0, // fast_name }, { "default_change_number", offsetof(uconf_ty, default_change_number), &integer_type, uconf_default_change_number_mask, 0, // redefinition not ok 0, // fast_name }, { "default_development_directory", offsetof(uconf_ty, default_development_directory), &string_type, uconf_default_development_directory_mask, 0, // redefinition not ok 0, // fast_name }, { "default_project_directory", offsetof(uconf_ty, default_project_directory), &string_type, uconf_default_project_directory_mask, 0, // redefinition not ok 0, // fast_name }, { "delete_file_preference", offsetof(uconf_ty, delete_file_preference), &uconf_delete_file_preference_type, uconf_delete_file_preference_mask, 0, // redefinition not ok 0, // fast_name }, { "diff_preference", offsetof(uconf_ty, diff_preference), &uconf_diff_preference_type, uconf_diff_preference_mask, 0, // redefinition not ok 0, // fast_name }, { "pager_preference", offsetof(uconf_ty, pager_preference), &uconf_pager_preference_type, uconf_pager_preference_mask, 0, // redefinition not ok 0, // fast_name }, { "persevere_preference", offsetof(uconf_ty, persevere_preference), &uconf_persevere_preference_type, uconf_persevere_preference_mask, 0, // redefinition not ok 0, // fast_name }, { "log_file_preference", offsetof(uconf_ty, log_file_preference), &uconf_log_file_preference_type, uconf_log_file_preference_mask, 0, // redefinition not ok 0, // fast_name }, { "lock_wait_preference", offsetof(uconf_ty, lock_wait_preference), &uconf_lock_wait_preference_type, uconf_lock_wait_preference_mask, 0, // redefinition not ok 0, // fast_name }, { "symbolic_link_preference", offsetof(uconf_ty, symbolic_link_preference), &uconf_symbolic_link_preference_type, uconf_symbolic_link_preference_mask, 0, // redefinition not ok 0, // fast_name }, { "relative_filename_preference", offsetof(uconf_ty, relative_filename_preference), &uconf_relative_filename_preference_type, uconf_relative_filename_preference_mask, 0, // redefinition not ok 0, // fast_name }, { "email_address", offsetof(uconf_ty, email_address), &string_type, uconf_email_address_mask, 0, // redefinition not ok 0, // fast_name }, { "whiteout_preference", offsetof(uconf_ty, whiteout_preference), &uconf_whiteout_preference_type, uconf_whiteout_preference_mask, 0, // redefinition not ok 0, // fast_name }, { "editor_command", offsetof(uconf_ty, editor_command), &string_type, uconf_editor_command_mask, 0, // redefinition not ok 0, // fast_name }, { "visual_command", offsetof(uconf_ty, visual_command), &string_type, uconf_visual_command_mask, 0, // redefinition not ok 0, // fast_name }, { "pager_command", offsetof(uconf_ty, pager_command), &string_type, uconf_pager_command_mask, 0, // redefinition not ok 0, // fast_name }, { "attribute", offsetof(uconf_ty, attribute), &attributes_list_type, uconf_attribute_mask, 0, // redefinition not ok 0, // fast_name }, }; static void * uconf_parse(void *this_thing, string_ty *name, meta_type **type_pp, unsigned long *mask_p, int *redef_p) { void *addr; trace(("uconf_parse(this_thing = %08lX, name = %08lX, type_pp = %08lX)\n{\n", (long)this_thing, (long)name, (long)type_pp)); assert(((uconf_ty *)this_thing)->reference_count > 0); addr = generic_struct_parse ( this_thing, name, type_pp, mask_p, redef_p, uconf_table, SIZEOF(uconf_table) ); trace(("return %08lX;\n}\n", (long)addr)); return addr; } static string_ty * uconf_fuzzy(string_ty *name) { string_ty *result; trace(("uconf_fuzzy(name = %08lX)\n{\n", (long)name)); result = generic_struct_fuzzy ( name, uconf_table, SIZEOF(uconf_table) ); trace(("return %08lX;\n", (long)result)); trace(("}\n")); return result; } static rpt_value::pointer uconf_convert(void *this_thing) { trace(("uconf_convert(name = %08lX)\n{\n", (long)this_thing)); assert(((uconf_ty *)this_thing)->reference_count > 0); rpt_value::pointer result = generic_struct_convert ( this_thing, uconf_table, SIZEOF(uconf_table) ); trace(("return %08lX;\n", (long)result.get())); trace(("}\n")); return result; } meta_type uconf_type = { "uconf", uconf_alloc, uconf_free, 0, // enum_parse 0, // list_parse uconf_parse, uconf_fuzzy, uconf_convert, generic_struct_is_set, }; uconf_ty * uconf_read_file(const nstring &filename) { return uconf_read_file(filename.get_ref()); } uconf_ty * uconf_read_file(string_ty *filename) { uconf_ty *result; trace(("uconf_read_file(filename = \"%s\")\n{\n", (filename ? filename->str_text : ""))); os_become_must_be_active(); result = (uconf_ty *)parse(filename, &uconf_type); trace(("return %08lX;\n", (long)result)); trace(("}\n")); return result; } void uconf_write_file(const nstring &filename, uconf_ty *value, bool comp) { uconf_write_file(filename.get_ref(), value, comp); } void uconf_write_file(string_ty *filename, uconf_ty *value, int needs_compression) { trace(("uconf_write_file(filename = \"%s\", value = %08lX)\n{\n", (filename ? filename->str_text : ""), (long)value)); if (filename) os_become_must_be_active(); output::pointer fp; if (needs_compression) { fp = output_file::binary_open(filename); fp = output_gzip::create(fp); } else { fp = output_file::text_open(filename); } fp = output_indent::create(fp); io_comment_emit(fp); uconf_write(fp, value); type_enum_option_clear(); trace(("}\n")); } void uconf__rpt_init(void) { trace(("uconf__rpt_init()\n{\n")); generic_enum__init(uconf_delete_file_preference_s, SIZEOF(uconf_delete_file_preference_s)); generic_enum__init(uconf_diff_preference_s, SIZEOF(uconf_diff_preference_s)); generic_enum__init(uconf_pager_preference_s, SIZEOF(uconf_pager_preference_s)); generic_enum__init(uconf_persevere_preference_s, SIZEOF(uconf_persevere_preference_s)); generic_enum__init(uconf_log_file_preference_s, SIZEOF(uconf_log_file_preference_s)); generic_enum__init(uconf_lock_wait_preference_s, SIZEOF(uconf_lock_wait_preference_s)); generic_enum__init(uconf_symbolic_link_preference_s, SIZEOF(uconf_symbolic_link_preference_s)); generic_enum__init(uconf_relative_filename_preference_s, SIZEOF(uconf_relative_filename_preference_s)); generic_enum__init(uconf_whiteout_preference_s, SIZEOF(uconf_whiteout_preference_s)); trace(("}\n")); }