1 /* 2 * HT Editor 3 * htcfg.h 4 * 5 * Copyright (C) 1999-2002 Stefan Weyergraf 6 * 7 * This program is free software; you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License version 2 as 9 * published by the Free Software Foundation. 10 * 11 * This program is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with this program; if not, write to the Free Software 18 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 */ 20 21 #ifndef __HTCFG_H__ 22 #define __HTCFG_H__ 23 24 #include "data.h" 25 #include "stream.h" 26 27 #if defined(WIN32) || defined(__WIN32__) || defined(MSDOS) || defined(DJGPP) 28 #define SYSTEM_CONFIG_FILE_NAME "ht2.cfg" 29 #else 30 #define SYSTEM_CONFIG_FILE_NAME ".htcfg2" 31 #endif 32 33 enum loadstore_result { 34 LS_OK, 35 LS_ERROR_NOT_FOUND, 36 LS_ERROR_READ, 37 LS_ERROR_WRITE, 38 LS_ERROR_MAGIC, 39 LS_ERROR_VERSION, // sets error_info to version 40 LS_ERROR_FORMAT, 41 LS_ERROR_CORRUPTED 42 }; 43 44 /* SYSTEM CONFIG FILE VERSION HISTORY 45 * Version 2: HT 0.4.4 46 * Version 3: HT 0.4.5 47 * Version 4: HT 0.5.0 48 * Version 5: HT 0.6.0 49 * Version 6: HT 2.0beta 50 */ 51 52 #define ht_systemconfig_magic "HTCP" 53 #define ht_systemconfig_fileversion 6 54 55 56 57 /* FILE CONFIG FILE VERSION HISTORY 58 * Version 1: HT 0.5.0 59 * Version 2: HT 0.6.0 60 * Version 3: HT 0.7.0 61 * Version 4: HT 2.0beta 62 */ 63 64 #define ht_fileconfig_magic "HTCF" 65 #define ht_fileconfig_fileversion 4 66 67 68 69 /* PROJECT CONFIG FILE VERSION HISTORY 70 * Version 1: HT 0.7.0 71 * Version 2: HT 2.0beta 72 */ 73 74 #define ht_projectconfig_magic "HTPR" 75 #define ht_projectconfig_fileversion 2 76 77 78 79 /**/ 80 81 extern char *systemconfig_file; 82 loadstore_result save_systemconfig(String &error_info); 83 bool load_systemconfig(loadstore_result *result, int *error_info); 84 85 typedef void (*load_fcfg_func)(ObjectStream &f, void *context); 86 typedef void (*store_fcfg_func)(ObjectStream &f, void *context); 87 88 loadstore_result save_fileconfig(const char *fileconfig_file, const char *magic, uint version, store_fcfg_func store_func, void *context, String &error_info); 89 loadstore_result load_fileconfig(const char *fileconfig_file, const char *magic, uint version, load_fcfg_func load_func, void *context, String &error_info); 90 91 /* 92 * INIT 93 */ 94 extern bool ht_cfg_use_homedir; 95 bool init_cfg(); 96 97 /* 98 * DONE 99 */ 100 101 void done_cfg(); 102 103 #endif /* !__HTCFG_H__ */ 104 105