DOSBox-X
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator
src/hardware/snd_pc98/common/profile.h
00001 
00002 #if !defined(NP2_PROFILE_H__)
00003 #define NP2_PROFILE_H__
00004 
00005 #ifdef __cplusplus
00006 extern "C" {
00007 #endif
00008 
00009 BOOL profile_enum(const OEMCHAR *filename, void *arg,
00010                                                         BOOL (*proc)(void *arg, const OEMCHAR *para,
00011                                                                 const OEMCHAR *key, const OEMCHAR *data));
00012 const OEMCHAR *profile_getarg(const OEMCHAR *str, OEMCHAR *buf, UINT leng);
00013 
00014 
00015 
00016 
00017 // ---- まだテスト
00018 
00019 enum {
00020         PFILEH_READONLY         = 0x0001,
00021         PFILEH_MODIFY           = 0x0002
00022 };
00023 
00024 typedef struct {
00025         OEMCHAR *buffer;
00026         UINT    buffers;
00027         UINT    size;
00028         UINT8   hdr[4];
00029         UINT    hdrsize;
00030         UINT    flag;
00031         OEMCHAR path[MAX_PATH];
00032 } _PFILEH, *PFILEH;
00033 
00034 PFILEH profile_open(const OEMCHAR *filename, UINT flag);
00035 void profile_close(PFILEH hdl);
00036 BRESULT profile_read(const OEMCHAR *app, const OEMCHAR *key,
00037                                         const OEMCHAR *def, OEMCHAR *ret, UINT size, PFILEH hdl);
00038 BRESULT profile_write(const OEMCHAR *app, const OEMCHAR *key,
00039                                                                                         const OEMCHAR *data, PFILEH hdl);
00040 
00041 
00042 enum {
00043         PFTYPE_STR                      = 0,
00044         PFTYPE_BOOL,
00045         PFTYPE_BITMAP,
00046         PFTYPE_BIN,
00047         PFTYPE_SINT8,
00048         PFTYPE_SINT16,
00049         PFTYPE_SINT32,
00050         PFTYPE_UINT8,
00051         PFTYPE_UINT16,
00052         PFTYPE_UINT32,
00053         PFTYPE_HEX8,
00054         PFTYPE_HEX16,
00055         PFTYPE_HEX32,
00056         PFTYPE_USER,
00057         PFTYPE_MASK                     = 0xff,
00058 
00059         PFFLAG_RO                       = 0x0100,
00060         PFFLAG_MAX                      = 0x0200,
00061         PFFLAG_AND                      = 0x0400
00062 };
00063 
00064 typedef struct {
00065         OEMCHAR item[12];
00066         UINT    itemtype;
00067         void    *value;
00068         UINT32  arg;
00069 } PFTBL;
00070 
00071 #define PFSTR(k, f, a)          {OEMTEXT(k), f, a, NELEMENTS(a)}
00072 #define PFVAL(k, f, a)          {OEMTEXT(k), f, a, 0}
00073 #define PFMAX(k, f, a, v)       {OEMTEXT(k), f | PFFLAG_MAX, a, v}
00074 #define PFAND(k, f, a, v)       {OEMTEXT(k), f | PFFLAG_AND, a, v}
00075 #define PFEXT(k, f, a, v)       {OEMTEXT(k), f, a, v}
00076 
00077 typedef void (*PFREAD)(const PFTBL *item, const OEMCHAR *string);
00078 typedef OEMCHAR *(*PFWRITE)(const PFTBL *item, OEMCHAR *string, UINT size);
00079 
00080 void profile_iniread(const OEMCHAR *path, const OEMCHAR *app,
00081                                                                 const PFTBL *tbl, UINT count, PFREAD cb);
00082 void profile_iniwrite(const OEMCHAR *path, const OEMCHAR *app,
00083                                                                 const PFTBL *tbl, UINT count, PFWRITE cb);
00084 
00085 #ifdef __cplusplus
00086 }
00087 #endif
00088 
00089 #endif  // defined(NP2_PROFILE_H__)
00090