20#define SP_USAGE_LABEL_STRING "???"
22#define SP_MAX_SETUP_LINE 512
23#define SP_MAX_SETUP_NAME 128
25#define SP_MAX_SETUP_VALUE 8192
27#define SP_UNKNOWN (-1)
29#define SP_MAX_EXIT_CALLBACK 16
30typedef void (*spExitFunc)(
int status);
38#define SP_TYPE_STRING 2
40#define SP_TYPE_SHORT 4
42#define SP_TYPE_FLOAT 6
43#define SP_TYPE_DOUBLE 7
45#define SP_TYPE_STRING_A 9
46#define SP_TYPE_ENUM 10
47#define SP_TYPE_USER 16
48#define SP_TYPE_BOOLEAN SP_TYPE_BOOL
49#define SP_TYPE_STRING_S SP_TYPE_STRING_A
51#define SP_TYPE_EDITABLE (1<<8)
52#define SP_TYPE_LIST (1<<9)
53#define SP_TYPE_COMBO (1<<10)
54#define SP_TYPE_TOGGLE (1<<11)
55#define SP_TYPE_SHOW_TIP (1<<12)
56#define SP_TYPE_NO_GUI (1<<13)
57#define SP_TYPE_INPUT_ONLY (1<<14)
58#define SP_TYPE_OUTPUT_ONLY (1<<15)
60#define SpNullOption(flag, subflag, type) {flag, subflag, NULL, NULL, type, NULL, NULL}
67typedef struct _spOption {
84extern int spGetNumOption(
spOptions options);
86extern char *xspCutOptionValue(
const char *value,
int index);
87extern int spConvertOptionValue(
spOption *option,
const char *value);
91extern void _spFreeOptionsAndValues(
spOptions options,
spBool free_values);
92extern void _spFreeOptions(
spOptions options);
93extern spOptions _spGetOptions(
int argc,
char **argv,
int num_option,
spOption *option_list,
94 int num_file,
const char **labels);
111extern void spUpdateOptionsValue(
int argc,
char **argv,
spOptions options);
116extern char *xspGetOptionLabel(
spOption *option,
int index);
117extern void spSetOptionDescOffset(
int offset);
120extern void spPrintHelpHeader(
const char *format, ...);
126extern void spPrintMan(
spOptions options,
const char *description,
const char *author);
131extern spBool spGetOptionValueString(
spOption *option,
char *buf,
int buf_size);
134extern void spPrintUsageHeader(
void);
135extern void spPrintUsage(
void);
142extern void spSetHInstanceWin(
void *hinstance,
unsigned long reason);
143extern void *spGetHInstanceWin(
void);
147extern spBool spSetExitFunc(spExitFunc func);
148extern spBool spEmitExitCallback(
void);
157#define spFreeOptions(options) {_spFreeOptions(options); (options) = NULL;}
158#define spFreeOptionsAndValues(options, free_values) {_spFreeOptionsAndValues(options, free_values); (options) = NULL;}
160#define spGetOptions(argc, argv, option, file_label) \
161_spGetOptions(argc, argv, spArraySize(option), option, spArraySize(file_label), file_label)
165#define spStrToBool(value) (((*(value) == 'T') || spStrEq(value, "1") || spStrEq(value, "ON") || spStrEq(value, "On")) ? SP_TRUE : SP_FALSE)
167#define spBoolToStr(value) (((value) == SP_TRUE) ? "True" : "False")
int spBool
Definition spDefs.h:248
void spSetSection(spOptions options, int section)
char * spGetOptionValue(int argc, char **argv, spOptions options)
spBool spWriteSetup(const char *filename, spOptions options)
void spSetSetup(const char *filename)
unsigned short spOptionType
Definition spOption.h:34
spBool spWriteGlobalSetup(void)
void spCheckNumFile(spOptions options)
spBool spAddExitCallback(spExitCallbackFunc callback, void *data)
void(* spExitCallbackFunc)(void *)
Definition spOption.h:32
struct _spOptions * spOptions
Definition spOption.h:62
void spGetOptionsValue(int argc, char **argv, spOptions options)
const char * spGetFile(spOptions options)
void spSetHelpMessage(spBool *flag, const char *format,...)
spBool spRemoveExitCallback(spExitCallbackFunc callback, void *data)
void spPrintError(const char *format,...)
spBool spReadSetup(const char *filename, spOptions options)
spBool spEqType(spOptionType type1, spOptionType type2)
void spPrintHelp(const char *format,...)
void * value
Definition spOption.h:73
const char * desc
Definition spOption.h:70
const char * label
Definition spOption.h:71
const char * subflag
Definition spOption.h:69
const char * def_value
Definition spOption.h:74
const char * flag
Definition spOption.h:68
spOptionType type
Definition spOption.h:72