some minor code touch-up

This commit is contained in:
hyung-hwan 2022-07-31 13:17:44 +00:00
parent b4eb3d9768
commit 1bf908e6ba
6 changed files with 40 additions and 17 deletions

View File

@ -137,6 +137,26 @@ briefly.
### Request message ### Request message
TODO: fill here TODO: fill here
.BEGIN
.SCRIPT
.END
.EXIT
.KILL-WORKER
.SHOW-WORKERS
You can send a single-line script with a .SCRIPT command.
.SCRIPT (printf "hello, world\n")
If the script is long and contains line-breaks, enclose multiple .SCRIPT commands
with the .BEGIN and .END command.
.BEGIN
.SCRIPT (printf "hello ")
.SCRIPT (printf "world\n")
.END
### Reponse message ### Reponse message
There are two types of response messages. There are two types of response messages.

View File

@ -831,7 +831,7 @@ static int feed_loop (hcl_t* hcl, xtn_t* xtn, int cflags, int verbose)
} }
/* [NOTE] it isn't a very nice idea to get this internal data and use it with read_input() */ /* [NOTE] it isn't a very nice idea to get this internal data and use it with read_input() */
inarg = hcl_getbaseioarg(hcl); inarg = hcl_getbaseinarg(hcl);
while (1) while (1)
{ {
if (read_input(hcl, inarg) <= -1) goto oops; if (read_input(hcl, inarg) <= -1) goto oops;

View File

@ -1360,7 +1360,7 @@ int hcl_server_proto_handle_request (hcl_server_proto_t* proto)
hcl_ooci_t c; hcl_ooci_t c;
int n; int n;
hcl_setinloc (proto->hcl, 1, 1); hcl_setbaseinloc (proto->hcl, 1, 1);
/* do a special check bypassing get_token(). it checks if the script contents /* do a special check bypassing get_token(). it checks if the script contents
* come on the same line as .SCRIPT */ * come on the same line as .SCRIPT */
@ -1396,7 +1396,10 @@ int hcl_server_proto_handle_request (hcl_server_proto_t* proto)
} }
proto->worker->opstate = HCL_SERVER_WORKER_OPSTATE_COMPILE; proto->worker->opstate = HCL_SERVER_WORKER_OPSTATE_COMPILE;
n = hcl_compile(proto->hcl, obj, HCL_COMPILE_CLEAR_CODE | HCL_COMPILE_CLEAR_FNBLK);
/*n = hcl_compile(proto->hcl, obj, HCL_COMPILE_CLEAR_CODE | HCL_COMPILE_CLEAR_FNBLK);*/
n = hcl_compile(proto->hcl, obj, 0);
hcl_freecnode (proto->hcl, obj); hcl_freecnode (proto->hcl, obj);
if (n <= -1) if (n <= -1)
{ {

View File

@ -379,12 +379,6 @@ void hcl_reset (hcl_t* hcl)
hcl_gc (hcl, 1); hcl_gc (hcl, 1);
} }
void hcl_setinloc (hcl_t* hcl, hcl_oow_t line, hcl_oow_t colm)
{
hcl->c->inarg.line = line;
hcl->c->inarg.colm = colm;
}
int hcl_setoption (hcl_t* hcl, hcl_option_t id, const void* value) int hcl_setoption (hcl_t* hcl, hcl_option_t id, const void* value)
{ {
hcl_cb_t* cb; hcl_cb_t* cb;

View File

@ -1969,12 +1969,6 @@ HCL_EXPORT void hcl_reset (
hcl_t* hcl hcl_t* hcl
); );
HCL_EXPORT void hcl_setinloc (
hcl_t* hcl,
hcl_oow_t line,
hcl_oow_t colm
);
#if defined(HCL_HAVE_INLINE) #if defined(HCL_HAVE_INLINE)
static HCL_INLINE void* hcl_getxtn (hcl_t* hcl) { return (void*)((hcl_uint8_t*)hcl + hcl->_instsize); } static HCL_INLINE void* hcl_getxtn (hcl_t* hcl) { return (void*)((hcl_uint8_t*)hcl + hcl->_instsize); }
static HCL_INLINE hcl_mmgr_t* hcl_getmmgr (hcl_t* hcl) { return hcl->_mmgr; } static HCL_INLINE hcl_mmgr_t* hcl_getmmgr (hcl_t* hcl) { return hcl->_mmgr; }
@ -2150,10 +2144,16 @@ HCL_EXPORT void hcl_abort (
# define hcl_switchprocess(hcl) ((hcl)->switch_proc = 1) # define hcl_switchprocess(hcl) ((hcl)->switch_proc = 1)
#endif #endif
HCL_EXPORT hcl_ioinarg_t* hcl_getbaseioarg ( HCL_EXPORT hcl_ioinarg_t* hcl_getbaseinarg (
hcl_t* hcl hcl_t* hcl
); );
HCL_EXPORT void hcl_setbaseinloc (
hcl_t* hcl,
hcl_oow_t line,
hcl_oow_t colm
);
HCL_EXPORT int hcl_attachio ( HCL_EXPORT int hcl_attachio (
hcl_t* hcl, hcl_t* hcl,
hcl_ioimpl_t reader, hcl_ioimpl_t reader,

View File

@ -4056,7 +4056,13 @@ void hcl_detachio (hcl_t* hcl)
} }
} }
hcl_ioinarg_t* hcl_getbaseioarg (hcl_t* hcl) hcl_ioinarg_t* hcl_getbaseinarg (hcl_t* hcl)
{ {
return &hcl->c->inarg; return &hcl->c->inarg;
} }
void hcl_setbaseinloc (hcl_t* hcl, hcl_oow_t line, hcl_oow_t colm)
{
hcl->c->inarg.line = line;
hcl->c->inarg.colm = colm;
}