renamed enumerators of hawk_opt_t

This commit is contained in:
hyung-hwan 2020-04-15 08:38:41 +00:00
parent fd94b20974
commit a36dbd9c2f
7 changed files with 67 additions and 67 deletions

View File

@ -1151,22 +1151,22 @@ static HAWK_INLINE int execute_hawk (int argc, hawk_bch_t* argv[])
if (arg.modern) i = HAWK_MODERN; if (arg.modern) i = HAWK_MODERN;
else if (arg.classic) i = HAWK_CLASSIC; else if (arg.classic) i = HAWK_CLASSIC;
else hawk_getopt (awk, HAWK_TRAIT, &i); else hawk_getopt (awk, HAWK_OPT_TRAIT, &i);
if (arg.opton) i |= arg.opton; if (arg.opton) i |= arg.opton;
if (arg.optoff) i &= ~arg.optoff; if (arg.optoff) i &= ~arg.optoff;
hawk_setopt (awk, HAWK_TRAIT, &i); hawk_setopt (awk, HAWK_OPT_TRAIT, &i);
/* TODO: get depth from command line */ /* TODO: get depth from command line */
{ {
hawk_oow_t tmp; hawk_oow_t tmp;
tmp = 50; tmp = 50;
hawk_setopt (awk, HAWK_DEPTH_BLOCK_PARSE, &tmp); hawk_setopt (awk, HAWK_OPT_DEPTH_BLOCK_PARSE, &tmp);
hawk_setopt (awk, HAWK_DEPTH_EXPR_PARSE, &tmp); hawk_setopt (awk, HAWK_OPT_DEPTH_EXPR_PARSE, &tmp);
tmp = 500; tmp = 500;
hawk_setopt (awk, HAWK_DEPTH_BLOCK_RUN, &tmp); hawk_setopt (awk, HAWK_OPT_DEPTH_BLOCK_RUN, &tmp);
hawk_setopt (awk, HAWK_DEPTH_EXPR_RUN, &tmp); hawk_setopt (awk, HAWK_OPT_DEPTH_EXPR_RUN, &tmp);
tmp = 64; tmp = 64;
hawk_setopt (awk, HAWK_DEPTH_INCLUDE, &tmp); hawk_setopt (awk, HAWK_OPT_DEPTH_INCLUDE, &tmp);
} }
if (add_gvs_to_awk(awk, &arg) <= -1) if (add_gvs_to_awk(awk, &arg) <= -1)

View File

@ -1851,14 +1851,14 @@ int Hawk::getTrait () const
{ {
HAWK_ASSERT (this->hawk != HAWK_NULL); HAWK_ASSERT (this->hawk != HAWK_NULL);
int val; int val;
hawk_getopt (this->hawk, HAWK_TRAIT, &val); hawk_getopt (this->hawk, HAWK_OPT_TRAIT, &val);
return val; return val;
} }
void Hawk::setTrait (int trait) void Hawk::setTrait (int trait)
{ {
HAWK_ASSERT (this->hawk != HAWK_NULL); HAWK_ASSERT (this->hawk != HAWK_NULL);
hawk_setopt (this->hawk, HAWK_TRAIT, &trait); hawk_setopt (this->hawk, HAWK_OPT_TRAIT, &trait);
} }
hawk_oow_t Hawk::getMaxDepth (depth_t id) const hawk_oow_t Hawk::getMaxDepth (depth_t id) const

View File

@ -379,13 +379,13 @@ public:
enum depth_t enum depth_t
{ {
DEPTH_INCLUDE = HAWK_DEPTH_INCLUDE, DEPTH_INCLUDE = HAWK_OPT_DEPTH_INCLUDE,
DEPTH_BLOCK_PARSE = HAWK_DEPTH_BLOCK_PARSE, DEPTH_BLOCK_PARSE = HAWK_OPT_DEPTH_BLOCK_PARSE,
DEPTH_BLOCK_RUN = HAWK_DEPTH_BLOCK_RUN, DEPTH_BLOCK_RUN = HAWK_OPT_DEPTH_BLOCK_RUN,
DEPTH_EXPR_PARSE = HAWK_DEPTH_EXPR_PARSE, DEPTH_EXPR_PARSE = HAWK_OPT_DEPTH_EXPR_PARSE,
DEPTH_EXPR_RUN = HAWK_DEPTH_EXPR_RUN, DEPTH_EXPR_RUN = HAWK_OPT_DEPTH_EXPR_RUN,
DEPTH_REX_BUILD = HAWK_DEPTH_REX_BUILD, DEPTH_REX_BUILD = HAWK_OPT_DEPTH_REX_BUILD,
DEPTH_REX_MATCH = HAWK_DEPTH_REX_MATCH DEPTH_REX_MATCH = HAWK_OPT_DEPTH_REX_MATCH
}; };
class Run; class Run;

View File

@ -151,7 +151,7 @@ int HawkStd::open ()
if (!this->stdmod_up) if (!this->stdmod_up)
{ {
#if defined(USE_DLFCN) #if defined(USE_DLFCN)
if (hawk_setopt(this->hawk, HAWK_MODPOSTFIX, HAWK_T(".so")) <= -1) goto oops; if (hawk_setopt(this->hawk, HAWK_OPT_MODPOSTFIX, HAWK_T(".so")) <= -1) goto oops;
#endif #endif
if (hawk_stdmodstartup(this->hawk) <= -1) goto oops; if (hawk_stdmodstartup(this->hawk) <= -1) goto oops;

View File

@ -457,27 +457,27 @@ int hawk_setopt (hawk_t* hawk, hawk_opt_t id, const void* value)
{ {
switch (id) switch (id)
{ {
case HAWK_TRAIT: case HAWK_OPT_TRAIT:
hawk->opt.trait = *(const int*)value; hawk->opt.trait = *(const int*)value;
return 0; return 0;
case HAWK_MODLIBDIR: case HAWK_OPT_MODLIBDIR:
case HAWK_MODPREFIX: case HAWK_OPT_MODPREFIX:
case HAWK_MODPOSTFIX: case HAWK_OPT_MODPOSTFIX:
{ {
hawk_oocs_t tmp; hawk_oocs_t tmp;
int idx; int idx;
if (dup_str_opt(hawk, value, &tmp) <= -1) return -1; if (dup_str_opt(hawk, value, &tmp) <= -1) return -1;
idx = id - HAWK_MODLIBDIR; idx = id - HAWK_OPT_MODLIBDIR;
if (hawk->opt.mod[idx].ptr) hawk_freemem (hawk, hawk->opt.mod[idx].ptr); if (hawk->opt.mod[idx].ptr) hawk_freemem (hawk, hawk->opt.mod[idx].ptr);
hawk->opt.mod[idx] = tmp; hawk->opt.mod[idx] = tmp;
return 0; return 0;
} }
case HAWK_INCLUDEDIRS: case HAWK_OPT_INCLUDEDIRS:
{ {
hawk_oocs_t tmp; hawk_oocs_t tmp;
if (dup_str_opt(hawk, value, &tmp) <= -1) return -1; if (dup_str_opt(hawk, value, &tmp) <= -1) return -1;
@ -486,28 +486,28 @@ int hawk_setopt (hawk_t* hawk, hawk_opt_t id, const void* value)
return 0; return 0;
} }
case HAWK_DEPTH_INCLUDE: case HAWK_OPT_DEPTH_INCLUDE:
case HAWK_DEPTH_BLOCK_PARSE: case HAWK_OPT_DEPTH_BLOCK_PARSE:
case HAWK_DEPTH_BLOCK_RUN: case HAWK_OPT_DEPTH_BLOCK_RUN:
case HAWK_DEPTH_EXPR_PARSE: case HAWK_OPT_DEPTH_EXPR_PARSE:
case HAWK_DEPTH_EXPR_RUN: case HAWK_OPT_DEPTH_EXPR_RUN:
case HAWK_DEPTH_REX_BUILD: case HAWK_OPT_DEPTH_REX_BUILD:
case HAWK_DEPTH_REX_MATCH: case HAWK_OPT_DEPTH_REX_MATCH:
hawk->opt.depth.a[id - HAWK_DEPTH_INCLUDE] = *(const hawk_oow_t*)value; hawk->opt.depth.a[id - HAWK_OPT_DEPTH_INCLUDE] = *(const hawk_oow_t*)value;
return 0; return 0;
case HAWK_RTX_STACK_LIMIT: case HAWK_OPT_RTX_STACK_LIMIT:
hawk->opt.rtx_stack_limit = *(const hawk_oow_t*)value; hawk->opt.rtx_stack_limit = *(const hawk_oow_t*)value;
if (hawk->opt.rtx_stack_limit < HAWK_MIN_RTX_STACK_LIMIT) hawk->opt.rtx_stack_limit = HAWK_MIN_RTX_STACK_LIMIT; if (hawk->opt.rtx_stack_limit < HAWK_MIN_RTX_STACK_LIMIT) hawk->opt.rtx_stack_limit = HAWK_MIN_RTX_STACK_LIMIT;
else if (hawk->opt.rtx_stack_limit > HAWK_MAX_RTX_STACK_LIMIT) hawk->opt.rtx_stack_limit = HAWK_MAX_RTX_STACK_LIMIT; else if (hawk->opt.rtx_stack_limit > HAWK_MAX_RTX_STACK_LIMIT) hawk->opt.rtx_stack_limit = HAWK_MAX_RTX_STACK_LIMIT;
return 0; return 0;
case HAWK_LOG_MASK: case HAWK_OPT_LOG_MASK:
hawk->opt.log_mask = *(hawk_bitmask_t*)value; hawk->opt.log_mask = *(hawk_bitmask_t*)value;
return 0; return 0;
case HAWK_LOG_MAXCAPA: case HAWK_OPT_LOG_MAXCAPA:
hawk->opt.log_maxcapa = *(hawk_oow_t*)value; hawk->opt.log_maxcapa = *(hawk_oow_t*)value;
return 0; return 0;
@ -521,39 +521,39 @@ int hawk_getopt (hawk_t* hawk, hawk_opt_t id, void* value)
{ {
switch (id) switch (id)
{ {
case HAWK_TRAIT: case HAWK_OPT_TRAIT:
*(int*)value = hawk->opt.trait; *(int*)value = hawk->opt.trait;
return 0; return 0;
case HAWK_MODLIBDIR: case HAWK_OPT_MODLIBDIR:
case HAWK_MODPREFIX: case HAWK_OPT_MODPREFIX:
case HAWK_MODPOSTFIX: case HAWK_OPT_MODPOSTFIX:
*(const hawk_ooch_t**)value = hawk->opt.mod[id - HAWK_MODLIBDIR].ptr; *(const hawk_ooch_t**)value = hawk->opt.mod[id - HAWK_OPT_MODLIBDIR].ptr;
return 0; return 0;
case HAWK_INCLUDEDIRS: case HAWK_OPT_INCLUDEDIRS:
*(const hawk_ooch_t**)value = hawk->opt.incldirs.ptr; *(const hawk_ooch_t**)value = hawk->opt.incldirs.ptr;
return 0; return 0;
case HAWK_DEPTH_INCLUDE: case HAWK_OPT_DEPTH_INCLUDE:
case HAWK_DEPTH_BLOCK_PARSE: case HAWK_OPT_DEPTH_BLOCK_PARSE:
case HAWK_DEPTH_BLOCK_RUN: case HAWK_OPT_DEPTH_BLOCK_RUN:
case HAWK_DEPTH_EXPR_PARSE: case HAWK_OPT_DEPTH_EXPR_PARSE:
case HAWK_DEPTH_EXPR_RUN: case HAWK_OPT_DEPTH_EXPR_RUN:
case HAWK_DEPTH_REX_BUILD: case HAWK_OPT_DEPTH_REX_BUILD:
case HAWK_DEPTH_REX_MATCH: case HAWK_OPT_DEPTH_REX_MATCH:
*(hawk_oow_t*)value = hawk->opt.depth.a[id - HAWK_DEPTH_INCLUDE]; *(hawk_oow_t*)value = hawk->opt.depth.a[id - HAWK_OPT_DEPTH_INCLUDE];
return 0; return 0;
case HAWK_RTX_STACK_LIMIT: case HAWK_OPT_RTX_STACK_LIMIT:
*(hawk_oow_t*)value = hawk->opt.rtx_stack_limit; *(hawk_oow_t*)value = hawk->opt.rtx_stack_limit;
return 0; return 0;
case HAWK_LOG_MASK: case HAWK_OPT_LOG_MASK:
*(hawk_bitmask_t*)value = hawk->opt.log_mask; *(hawk_bitmask_t*)value = hawk->opt.log_mask;
return 0; return 0;
case HAWK_LOG_MAXCAPA: case HAWK_OPT_LOG_MAXCAPA:
*(hawk_oow_t*)value = hawk->opt.log_maxcapa; *(hawk_oow_t*)value = hawk->opt.log_maxcapa;
return 0; return 0;

View File

@ -1142,25 +1142,25 @@ struct hawk_rtx_ecb_t
enum hawk_opt_t enum hawk_opt_t
{ {
/** trait option. 0 or bitwise-ORed of ::hawk_trait_t values */ /** trait option. 0 or bitwise-ORed of ::hawk_trait_t values */
HAWK_TRAIT, HAWK_OPT_TRAIT,
HAWK_MODLIBDIR, HAWK_OPT_MODLIBDIR,
HAWK_MODPREFIX, HAWK_OPT_MODPREFIX,
HAWK_MODPOSTFIX, HAWK_OPT_MODPOSTFIX,
HAWK_INCLUDEDIRS, HAWK_OPT_INCLUDEDIRS,
HAWK_DEPTH_INCLUDE, HAWK_OPT_DEPTH_INCLUDE,
HAWK_DEPTH_BLOCK_PARSE, HAWK_OPT_DEPTH_BLOCK_PARSE,
HAWK_DEPTH_BLOCK_RUN, HAWK_OPT_DEPTH_BLOCK_RUN,
HAWK_DEPTH_EXPR_PARSE, HAWK_OPT_DEPTH_EXPR_PARSE,
HAWK_DEPTH_EXPR_RUN, HAWK_OPT_DEPTH_EXPR_RUN,
HAWK_DEPTH_REX_BUILD, HAWK_OPT_DEPTH_REX_BUILD,
HAWK_DEPTH_REX_MATCH, HAWK_OPT_DEPTH_REX_MATCH,
HAWK_RTX_STACK_LIMIT, HAWK_OPT_RTX_STACK_LIMIT,
HAWK_LOG_MASK, HAWK_OPT_LOG_MASK,
HAWK_LOG_MAXCAPA HAWK_OPT_LOG_MAXCAPA
}; };
typedef enum hawk_opt_t hawk_opt_t; typedef enum hawk_opt_t hawk_opt_t;

View File

@ -915,7 +915,7 @@ hawk_t* hawk_openstdwithmmgr (hawk_mmgr_t* mmgr, hawk_oow_t xtnsize, hawk_cmgr_t
awk->_instsize += HAWK_SIZEOF(xtn_t); awk->_instsize += HAWK_SIZEOF(xtn_t);
#if defined(USE_DLFCN) #if defined(USE_DLFCN)
if (hawk_setopt(awk, HAWK_MODPOSTFIX, HAWK_T(".so")) <= -1) if (hawk_setopt(awk, HAWK_OPT_MODPOSTFIX, HAWK_T(".so")) <= -1)
{ {
if (errnum) *errnum = hawk_geterrnum(awk); if (errnum) *errnum = hawk_geterrnum(awk);
goto oops; goto oops;