00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef __HTCFG_H__
00022 #define __HTCFG_H__
00023
00024 #include "common.h"
00025 #include "stream.h"
00026
00027 #if defined(WIN32) || defined(__WIN32__) || defined(MSDOS) || defined(DJGPP)
00028 #define SYSTEM_CONFIG_FILE_NAME "ht.cfg"
00029 #else
00030 #define SYSTEM_CONFIG_FILE_NAME ".htcfg"
00031 #endif
00032
00033 enum loadstore_result {
00034 LS_OK,
00035 LS_ERROR_NOT_FOUND,
00036 LS_ERROR_READ,
00037 LS_ERROR_WRITE,
00038 LS_ERROR_MAGIC,
00039 LS_ERROR_VERSION,
00040 LS_ERROR_FORMAT,
00041 LS_ERROR_CORRUPTED
00042 };
00043
00044
00045
00046
00047
00048
00049
00050
00051 #define ht_systemconfig_magic "HTCP"
00052 #define ht_systemconfig_fileversion 5
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062 #define ht_fileconfig_magic "HTCF"
00063 #define ht_fileconfig_fileversion 3
00064
00065
00066
00067
00068
00069
00070
00071 #define ht_projectconfig_magic "HTPR"
00072 #define ht_projectconfig_fileversion 1
00073
00074
00075
00076
00077
00078 extern char *systemconfig_file;
00079 loadstore_result save_systemconfig();
00080 bool load_systemconfig(loadstore_result *result, int *error_info);
00081
00082 typedef int (*load_fcfg_func)(ht_object_stream *f, void *context);
00083 typedef void (*store_fcfg_func)(ht_object_stream *f, void *context);
00084
00085 loadstore_result save_fileconfig(char *fileconfig_file, const char *magic, UINT version, store_fcfg_func store_func, void *context);
00086 loadstore_result load_fileconfig(char *fileconfig_file, const char *magic, UINT version, load_fcfg_func load_func, void *context, int *error_info);
00087
00088
00089
00090
00091
00092 bool init_cfg();
00093
00094
00095
00096
00097
00098 void done_cfg();
00099
00100 #endif
00101