00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00023 #include <stdio.h>
00024 #include <stdlib.h>
00025 #include <string.h>
00026
00027 #include "cuf-global.h"
00028 #include "array.h"
00029 #include "llist.h"
00030
00031 #ifndef _POPTS_H_
00032 # define _POPTS_H_
00033
00034 #define DESC_WINDOW_WIDTH 78
00035 #define DESC_COLUMN_START 30
00036
00037 typedef void (*FuncString2d) (char **);
00038
00043 typedef enum _OType {
00044
00045 OBool,
00046 OChar,
00047 OInt,
00048 OLong,
00049 OFloat,
00050 ODouble,
00051 OString,
00052
00053
00054 OFuncVoid,
00055 OFuncBool,
00056 OFuncChar,
00057 OFuncInt,
00058 OFuncLong,
00059 OFuncFloat,
00060 OFuncDouble,
00061 OFuncString,
00062
00063
00064 OString2d,
00065 OFuncString2d,
00066 OProgramname
00067 } OType;
00068
00069
00070
00071
00072
00073
00074
00075
00080 typedef struct _COption_description {
00081 unsigned int letterid;
00082 unsigned int wordid;
00083 char *desc;
00084 } COption_description;
00085
00090 typedef struct _COption_letter {
00091 unsigned int id;
00092 OType ot;
00093 char sl;
00094 void *var;
00095 } COption_letter;
00096
00101 typedef struct _COption_word {
00102 unsigned int id;
00103 OType ot;
00104 char *sw;
00105 void *var;
00106 } COption_word;
00107
00108
00109
00110
00111 void popts_init (void);
00112 void popts_description_add (unsigned int letterid, unsigned int wordid,
00113 char *desc);
00114 unsigned int popts_letter_add (char sl, OType ot, void *var);
00115 unsigned int popts_word_add (char *sw, OType ot, void *var);
00116 void popts_help_add (void);
00117 void popts_descriptions_print (void);
00118 int popts_parse (int argc, char **argv);
00119 void popts_done (void);
00120
00121 #endif