home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Boldly Go Collection
/
version40.iso
/
TS
/
17A
/
DRWIN101.ZIP
/
CFGUTIL.H
< prev
next >
Wrap
C/C++ Source or Header
|
1991-10-24
|
2KB
|
51 lines
#ifndef __CFGUTIL_H
#define __CFGUTIL_H
typedef enum { //codes for data types
CFG_CUSTOM=0, //use custom load function
CFG_CHAR=1, //single character
CFG_BYTE, //byte -- u-char handled like an int
CFG_INT, //decimal int
CFG_UINT, //unsigned int
CFG_LONG, //long int
CFG_ULONG, //unsigned long
CFG_DOUBLE, //double floating point
CFG_STRING, //string of chars
CFG_NOLOAD=0x0100, //don't load this item
CFG_NOSAVE=0x0200, //don't save this item
CFG_QUOTES=0x0400, //use quotes when saving char/string
CFG_HEX =0x0800, //hex output (with "0x")
CFG_XBYTE =CFG_BYTE |CFG_HEX, //hex byte
CFG_XINT =CFG_UINT |CFG_HEX, //hex int
CFG_XLONG =CFG_ULONG |CFG_HEX, //hex long
CFG_QCHAR =CFG_CHAR |CFG_QUOTES, //char with quotes
CFG_QSTRING=CFG_STRING|CFG_QUOTES, //string with quotes
CFG_TYPE_MASK=0x00FF, //used to mask off types listed above
} CFG_VALUE_TYPE;
#define CFG_LOAD 0 //control flag for custom function
#define CFG_SAVE 1
#define CFG_WRITE 0 //overwrite file on save
#define CFG_APPEND 1 //append on save
typedef int (*CFG_FUNC)(int item,void* val,char* str,int loadsave);
typedef struct { //auto-variable loading struct
char* name; //name of the field
CFG_VALUE_TYPE type; //type of value being loaded
void* val; //pointer to data value
CFG_FUNC func; //load/save func
} CFG_TYPE;
int cfg_load(char* fn,char* obj,CFG_TYPE* ini,int n);
int cfg_save(char* fn,char* obj,CFG_TYPE* ini,int n,int append);
#endif