From: <enl...@li...> - 2002-04-29 19:27:26
|
Enlightenment CVS committal Author : mej Project : eterm Module : libast Dir : eterm/libast/include Modified Files: libast.h libast_internal.h Log Message: Mon Apr 29 15:25:01 2002 Michael Jennings (mej) The options parser seems to be working now. It's fairly extensible and fixes a lot of the problems with the old one. It was rewritten more or less from scratch. =================================================================== RCS file: /cvsroot/enlightenment/eterm/libast/include/libast.h,v retrieving revision 1.12 retrieving revision 1.13 diff -u -3 -r1.12 -r1.13 --- libast.h 26 Apr 2002 19:14:56 -0000 1.12 +++ libast.h 29 Apr 2002 19:26:51 -0000 1.13 @@ -501,16 +501,34 @@ /* Flags that control the parser's behavior */ #define SPIFOPT_SETTING_POSTPARSE (1UL << 0) -#define SPIFOPT_OPTION(s, l, d, f, p, m) { s, l, d, (f), (void *) &(p), m } -#define SPIFOPT_STR(s, l, d, p) { s, l, d, SPIFOPT_FLAG_STRING, (const char **) &(p), 0 } -#define SPIFOPT_INT(s, l, d, p) { s, l, d, SPIFOPT_FLAG_INTEGER, (const int *) &(p), 0 } -#define SPIFOPT_BOOL(s, l, d, v, m) { s, l, d, SPIFOPT_FLAG_BOOLEAN, (void *) &(v), m } -#define SPIFOPT_SLONG(l, d, p) { 0, l, d, SPIFOPT_FLAG_STRING, (const char **) &(p), 0 } -#define SPIFOPT_ARGS(s, l, d, p) { s, l, d, SPIFOPT_FLAG_ARGLIST, (const char ***) &(p), 0 } -#define SPIFOPT_BLONG(l, d, v, m) { 0, l, d, SPIFOPT_FLAG_BOOLEAN, (void *) &(v), m } -#define SPIFOPT_ILONG(l, d, p) { 0, l, d, SPIFOPT_FLAG_INTEGER, (const int *) &(p), 0 } +#define SPIFOPT_OPTION(s, l, d, f, p, m) { s, l, d, (f), &(p), m } +#define SPIFOPT_BOOL(s, l, d, v, m) { s, l, d, (SPIFOPT_FLAG_BOOLEAN), &(v), m } +#define SPIFOPT_BOOL_PP(s, l, d, v, m) { s, l, d, (SPIFOPT_FLAG_BOOLEAN | SPIFOPT_FLAG_PREPARSE), &(v), m } +#define SPIFOPT_BOOL_LONG(l, d, v, m) { 0, l, d, (SPIFOPT_FLAG_BOOLEAN), &(v), m } +#define SPIFOPT_BOOL_LONG_PP(l, d, v, m) { 0, l, d, (SPIFOPT_FLAG_BOOLEAN | SPIFOPT_FLAG_PREPARSE), &(v), m } +#define SPIFOPT_ABST(s, l, d, f) { s, l, d, (SPIFOPT_FLAG_ABSTRACT), (f), 0 } +#define SPIFOPT_ABST_PP(s, l, d, f) { s, l, d, (SPIFOPT_FLAG_ABSTRACT | SPIFOPT_FLAG_PREPARSE), (f), 0 } +#define SPIFOPT_ABST_LONG(l, d, f) { 0, l, d, (SPIFOPT_FLAG_ABSTRACT), (f), 0 } +#define SPIFOPT_ABST_LONG_PP(l, d, f) { 0, l, d, (SPIFOPT_FLAG_ABSTRACT | SPIFOPT_FLAG_PREPARSE), (f), 0 } +#define SPIFOPT_INT(s, l, d, p) { s, l, d, (SPIFOPT_FLAG_INTEGER), &(p), 0 } +#define SPIFOPT_INT_PP(s, l, d, p) { s, l, d, (SPIFOPT_FLAG_INTEGER | SPIFOPT_FLAG_PREPARSE), &(p), 0 } +#define SPIFOPT_INT_LONG(l, d, p) { 0, l, d, (SPIFOPT_FLAG_INTEGER), &(p), 0 } +#define SPIFOPT_INT_LONG_PP(l, d, p) { 0, l, d, (SPIFOPT_FLAG_INTEGER | SPIFOPT_FLAG_PREPARSE), &(p), 0 } +#define SPIFOPT_STR(s, l, d, p) { s, l, d, (SPIFOPT_FLAG_STRING), &(p), 0 } +#define SPIFOPT_STR_PP(s, l, d, p) { s, l, d, (SPIFOPT_FLAG_STRING | SPIFOPT_FLAG_PREPARSE), &(p), 0 } +#define SPIFOPT_STR_LONG(l, d, p) { 0, l, d, (SPIFOPT_FLAG_STRING), &(p), 0 } +#define SPIFOPT_STR_LONG_PP(l, d, p) { 0, l, d, (SPIFOPT_FLAG_STRING | SPIFOPT_FLAG_PREPARSE), &(p), 0 } +#define SPIFOPT_ARGS(s, l, d, p) { s, l, d, (SPIFOPT_FLAG_ARGLIST), &(p), 0 } +#define SPIFOPT_ARGS_PP(s, l, d, p) { s, l, d, (SPIFOPT_FLAG_ARGLIST | SPIFOPT_FLAG_PREPARSE), &(p), 0 } +#define SPIFOPT_ARGS_LONG(l, d, p) { 0, l, d, (SPIFOPT_FLAG_ARGLIST), &(p), 0 } +#define SPIFOPT_ARGS_LONG_PP(l, d, p) { 0, l, d, (SPIFOPT_FLAG_ARGLIST | SPIFOPT_FLAG_PREPARSE), &(p), 0 } +#define SPIFOPT_ABSV(s, l, d, f) { s, l, d, (SPIFOPT_FLAG_ABSTRACT_VALUE), (f), 0 } +#define SPIFOPT_ABSV_PP(s, l, d, f) { s, l, d, (SPIFOPT_FLAG_ABSTRACT_VALUE | SPIFOPT_FLAG_PREPARSE), (f), 0 } +#define SPIFOPT_ABSV_LONG(l, d, f) { 0, l, d, (SPIFOPT_FLAG_ABSTRACT_VALUE), (f), 0 } +#define SPIFOPT_ABSV_LONG_PP(l, d, f) { 0, l, d, (SPIFOPT_FLAG_ABSTRACT_VALUE | SPIFOPT_FLAG_PREPARSE), (f), 0 } #define SPIFOPT_TYPE(opt) (((spifopt_t) (opt)).flags & SPIFOPT_FLAG_TYPEMASK) +#define SPIFOPT_OPT_TYPE(n) (SPIFOPT_OPT_FLAGS(n) & SPIFOPT_FLAG_TYPEMASK) #define SPIFOPT_OPT_IS_BOOLEAN(n) (SPIFOPT_OPT_FLAGS(n) & SPIFOPT_FLAG_BOOLEAN) #define SPIFOPT_OPT_IS_ABSTRACT(n) (SPIFOPT_OPT_FLAGS(n) & SPIFOPT_FLAG_ABSTRACT) #define SPIFOPT_OPT_IS_STRING(n) (SPIFOPT_OPT_FLAGS(n) & SPIFOPT_FLAG_STRING) @@ -519,7 +537,8 @@ #define SPIFOPT_OPT_IS_ABSTRACT_VALUE(n) (SPIFOPT_OPT_FLAGS(n) & SPIFOPT_FLAG_ABSTRACT_VALUE) #define SPIFOPT_OPT_IS_PREPARSE(n) (SPIFOPT_OPT_FLAGS(n) & SPIFOPT_FLAG_PREPARSE) #define SPIFOPT_OPT_IS_DEPRECATED(n) (SPIFOPT_OPT_FLAGS(n) & SPIFOPT_FLAG_DEPRECATED) -#define SPIFOPT_OPT_NEEDS_VALUE(n) (SPIFOPT_OPT_FLAGS(n) & (SPIFOPT_FLAG_STRING | SPIFOPT_FLAG_INTEGER | SPIFOPT_FLAG_ARGLIST)) +#define SPIFOPT_OPT_NEEDS_VALUE(n) (SPIFOPT_OPT_FLAGS(n) & (SPIFOPT_FLAG_STRING | SPIFOPT_FLAG_INTEGER \ + | SPIFOPT_FLAG_ARGLIST | SPIFOPT_FLAG_ABSTRACT_VALUE)) #define SPIFOPT_OPT_SHORT(n) (SPIFOPT_OPTLIST(n).short_opt) #define SPIFOPT_OPT_LONG(n) (SPIFOPT_OPTLIST(n).long_opt) @@ -529,6 +548,7 @@ #define SPIFOPT_OPT_MASK(n) (SPIFOPT_OPTLIST(n).mask) #define SPIFOPT_OPTLIST(n) (spifopt_settings.opt_list[((n) < (spifopt_settings.num_opts) ? (n) : (0))]) +#define SPIFOPT_OPTLIST_SET(l) (spifopt_settings.opt_list = ((spifopt_t *) (l))) #define SPIFOPT_NUMOPTS_GET() (spifopt_settings.num_opts) #define SPIFOPT_NUMOPTS_SET(n) (spifopt_settings.num_opts = (n)) #define SPIFOPT_FLAGS_GET() (spifopt_settings.flags) =================================================================== RCS file: /cvsroot/enlightenment/eterm/libast/include/libast_internal.h,v retrieving revision 1.7 retrieving revision 1.8 diff -u -3 -r1.7 -r1.8 --- libast_internal.h 26 Apr 2002 19:14:57 -0000 1.7 +++ libast_internal.h 29 Apr 2002 19:26:51 -0000 1.8 @@ -47,21 +47,6 @@ # include <stdarg.h> #endif -/******************************* OBJECT GOOP ***********************************/ - -/* Macros to allocate and deallocate memory for an object. For use only in - object constructors/destructors, not in end-user programs. */ -#define SPIF_ALLOC(type) SPIF_CAST(type) MALLOC(SPIF_SIZEOF_TYPE(type)) -#define SPIF_DEALLOC(obj) FREE(obj) - -/* Macros for specifying the classname variables for each class type. Each subclass of - spif_obj_t must define this variable using these macros. */ -#define SPIF_DECL_CLASSNAME(type) "!spif_" #type "_t!" - -/* The declaration of an interface class. */ -#define SPIF_DECL_IFCLASS(if, type) spif_const_ ## if ## _ifclass_t SPIF_IFCLASS_VAR(if, type) - - /******************************** MSGS GOOP ***********************************/ extern char *libast_program_name, *libast_program_version; |