diff --git a/hawk/lib/hawk.h b/hawk/lib/hawk.h index 0a7fa40e..18d9cce1 100644 --- a/hawk/lib/hawk.h +++ b/hawk/lib/hawk.h @@ -2356,7 +2356,7 @@ HAWK_EXPORT int hawk_rtx_setgbl ( hawk_val_t* val ); -HAWK_EXPORT int hawk_rtx_setgblbyname ( +HAWK_EXPORT int hawk_rtx_setgbltostrbyname ( hawk_rtx_t* rtx, const hawk_ooch_t* name, const hawk_ooch_t* val diff --git a/hawk/lib/run.c b/hawk/lib/run.c index ead6ddfb..b566ba60 100644 --- a/hawk/lib/run.c +++ b/hawk/lib/run.c @@ -634,7 +634,7 @@ HAWK_INLINE int hawk_rtx_setgbl (hawk_rtx_t* rtx, int id, hawk_val_t* val) return set_global(rtx, id, HAWK_NULL, val, 0); } -int hawk_rtx_setgblbyname (hawk_rtx_t* rtx, const hawk_ooch_t* name, const hawk_ooch_t* val) +int hawk_rtx_setgbltostrbyname (hawk_rtx_t* rtx, const hawk_ooch_t* name, const hawk_ooch_t* val) { int id, n; hawk_val_t* v; diff --git a/hawk/lib/std.c b/hawk/lib/std.c index 5698f1af..f352190d 100644 --- a/hawk/lib/std.c +++ b/hawk/lib/std.c @@ -163,7 +163,7 @@ typedef struct rxtn_t { hawk_ooch_t** files; hawk_oow_t index; - hawk_oow_t count; + hawk_oow_t count; /* number of files opened so far */ } in; struct @@ -1683,7 +1683,7 @@ static int check_var_assign (hawk_rtx_t* rtx, hawk_ooch_t* str) if (HAWK_UNLIKELY(!var)) return -1; n = hawk_isvalidident(hawk_rtx_gethawk(rtx), var)? - ((hawk_rtx_setgblbyname(rtx, var, eq + 1) <= -1)? -1: 1): 0; + ((hawk_rtx_setgbltostrbyname(rtx, var, eq + 1) <= -1)? -1: 1): 0; hawk_rtx_freemem (rtx, var); return n; } @@ -2017,7 +2017,7 @@ static int open_rio_console (hawk_rtx_t* rtx, hawk_rio_arg_t* riod) { xtn_t* xtn = (xtn_t*)GET_XTN(rtx->awk); - if (rxtn->c.in.files == HAWK_NULL) + if (!rxtn->c.in.files) { /* if no input files is specified, * open the standard input */ @@ -2053,8 +2053,7 @@ static int open_rio_console (hawk_rtx_t* rtx, hawk_rio_arg_t* riod) nextfile: file = rxtn->c.in.files[rxtn->c.in.index]; - - if (file == HAWK_NULL) + if (!file) { /* no more input file */ @@ -2100,7 +2099,7 @@ static int open_rio_console (hawk_rtx_t* rtx, hawk_rio_arg_t* riod) map = ((hawk_val_map_t*)argv)->map; HAWK_ASSERT (map != HAWK_NULL); - + ibuflen = hawk_int_to_oocstr(rxtn->c.in.index + 1, 10, HAWK_NULL, ibuf, HAWK_COUNTOF(ibuf)); pair = hawk_htb_search(map, ibuf, ibuflen);