yet another round of internal name changes
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
hyung-hwan 2023-11-04 23:23:20 +09:00
parent 238365e198
commit bcfe69feda
6 changed files with 95 additions and 95 deletions

View File

@ -1807,15 +1807,15 @@ static int print_bcs (hcl_fmtout_t* fmtout, const hcl_bch_t* ptr, hcl_oow_t len)
ucsptr = ucsbuf;
while (ucslen > 0)
{
hcl->io.outarg.ptr = ucsptr;
hcl->io.outarg.len = ucslen;
hcl->io.udo_arg.ptr = ucsptr;
hcl->io.udo_arg.len = ucslen;
if (hcl->io.printer(hcl, HCL_IO_WRITE, &hcl->io.outarg) <= -1) return -1;
if (hcl->io.outarg.xlen <= 0) return 0; /* end of stream. but not failure */
if (hcl->io.udo_wrtr(hcl, HCL_IO_WRITE, &hcl->io.udo_arg) <= -1) return -1;
if (hcl->io.udo_arg.xlen <= 0) return 0; /* end of stream. but not failure */
HCL_ASSERT (hcl, hcl->io.outarg.xlen <= len);
ucsptr += hcl->io.outarg.xlen;
ucslen -= hcl->io.outarg.xlen;
HCL_ASSERT (hcl, hcl->io.udo_arg.xlen <= len);
ucsptr += hcl->io.udo_arg.xlen;
ucslen -= hcl->io.udo_arg.xlen;
}
ptr += bcslen;
@ -1827,15 +1827,15 @@ static int print_bcs (hcl_fmtout_t* fmtout, const hcl_bch_t* ptr, hcl_oow_t len)
optr = (hcl_bch_t*)ptr;
while (len > 0)
{
hcl->io.outarg.ptr = optr;
hcl->io.outarg.len = len;
hcl->io.udo_arg.ptr = optr;
hcl->io.udo_arg.len = len;
if (hcl->io.printer(hcl, HCL_IO_WRITE, &hcl->io.outarg) <= -1) return -1;
if (hcl->io.outarg.xlen <= 0) return 0; /* end of stream. but not failure */
if (hcl->io.udo_wrtr(hcl, HCL_IO_WRITE, &hcl->io.udo_arg) <= -1) return -1;
if (hcl->io.udo_arg.xlen <= 0) return 0; /* end of stream. but not failure */
HCL_ASSERT (hcl, hcl->io.outarg.xlen <= len);
optr += hcl->io.outarg.xlen;
len -= hcl->io.outarg.xlen;
HCL_ASSERT (hcl, hcl->io.udo_arg.xlen <= len);
optr += hcl->io.udo_arg.xlen;
len -= hcl->io.udo_arg.xlen;
}
#endif
#else
@ -1844,15 +1844,15 @@ static int print_bcs (hcl_fmtout_t* fmtout, const hcl_bch_t* ptr, hcl_oow_t len)
optr = (hcl_bch_t*)ptr;
while (len > 0)
{
hcl->io.outarg.ptr = optr;
hcl->io.outarg.len = len;
hcl->io.udo_arg.ptr = optr;
hcl->io.udo_arg.len = len;
if (hcl->io.printer(hcl, HCL_IO_WRITE_BYTES, &hcl->io.outarg) <= -1) return -1;
if (hcl->io.outarg.xlen <= 0) return 0; /* end of stream. but not failure */
if (hcl->io.udo_wrtr(hcl, HCL_IO_WRITE_BYTES, &hcl->io.udo_arg) <= -1) return -1;
if (hcl->io.udo_arg.xlen <= 0) return 0; /* end of stream. but not failure */
HCL_ASSERT (hcl, hcl->io.outarg.xlen <= len);
optr += hcl->io.outarg.xlen;
len -= hcl->io.outarg.xlen;
HCL_ASSERT (hcl, hcl->io.udo_arg.xlen <= len);
optr += hcl->io.udo_arg.xlen;
len -= hcl->io.udo_arg.xlen;
}
#endif
@ -1869,15 +1869,15 @@ static int print_ucs (hcl_fmtout_t* fmtout, const hcl_uch_t* ptr, hcl_oow_t len)
optr = (hcl_uch_t*)ptr;
while (len > 0)
{
hcl->io.outarg.ptr = optr;
hcl->io.outarg.len = len;
hcl->io.udo_arg.ptr = optr;
hcl->io.udo_arg.len = len;
if (hcl->io.printer(hcl, HCL_IO_WRITE, &hcl->io.outarg) <= -1) return -1;
if (hcl->io.outarg.xlen <= 0) return 0; /* end of stream. but not failure */
if (hcl->io.udo_wrtr(hcl, HCL_IO_WRITE, &hcl->io.udo_arg) <= -1) return -1;
if (hcl->io.udo_arg.xlen <= 0) return 0; /* end of stream. but not failure */
HCL_ASSERT (hcl, hcl->io.outarg.xlen <= len);
optr += hcl->io.outarg.xlen;
len -= hcl->io.outarg.xlen;
HCL_ASSERT (hcl, hcl->io.udo_arg.xlen <= len);
optr += hcl->io.udo_arg.xlen;
len -= hcl->io.udo_arg.xlen;
}
#else
hcl_oow_t bcslen, ucslen;
@ -1892,15 +1892,15 @@ static int print_ucs (hcl_fmtout_t* fmtout, const hcl_uch_t* ptr, hcl_oow_t len)
bcsptr = bcsbuf;
while (bcslen > 0)
{
hcl->io.outarg.ptr = bcsptr;
hcl->io.outarg.len = bcslen;
hcl->io.udo_arg.ptr = bcsptr;
hcl->io.udo_arg.len = bcslen;
if (hcl->io.printer(hcl, HCL_IO_WRITE, &hcl->io.outarg) <= -1) return -1;
if (hcl->io.outarg.xlen <= 0) return 0; /* end of stream. but not failure */
if (hcl->io.udo_wrtr(hcl, HCL_IO_WRITE, &hcl->io.udo_arg) <= -1) return -1;
if (hcl->io.udo_arg.xlen <= 0) return 0; /* end of stream. but not failure */
HCL_ASSERT (hcl, hcl->io.outarg.xlen <= len);
bcsptr += hcl->io.outarg.xlen;
bcslen -= hcl->io.outarg.xlen;
HCL_ASSERT (hcl, hcl->io.udo_arg.xlen <= len);
bcsptr += hcl->io.udo_arg.xlen;
bcslen -= hcl->io.udo_arg.xlen;
}
ptr += ucslen;

View File

@ -572,7 +572,7 @@ static int print_handler (hcl_t* hcl, hcl_io_cmd_t cmd, void* arg)
case HCL_IO_WRITE:
{
worker_hcl_xtn_t* xtn = (worker_hcl_xtn_t*)hcl_getxtn(hcl);
hcl_io_outarg_t* outarg = (hcl_io_outarg_t*)arg;
hcl_io_udoarg_t* outarg = (hcl_io_udoarg_t*)arg;
if (hcl_server_proto_feed_reply(xtn->proto, outarg->ptr, outarg->len, 0) <= -1)
{
@ -591,7 +591,7 @@ static int print_handler (hcl_t* hcl, hcl_io_cmd_t cmd, void* arg)
case HCL_IO_WRITE_BYTES:
{
worker_hcl_xtn_t* xtn = (worker_hcl_xtn_t*)hcl_getxtn(hcl);
hcl_io_outarg_t* outarg = (hcl_io_outarg_t*)arg;
hcl_io_udoarg_t* outarg = (hcl_io_udoarg_t*)arg;
if (hcl_server_proto_feed_reply_bytes(xtn->proto, outarg->ptr, outarg->len, 0) <= -1)
{

View File

@ -1268,8 +1268,8 @@ struct hcl_io_sciarg_t
/*-----------------------------------------------------------------*/
};
typedef struct hcl_io_inarg_t hcl_io_inarg_t;
struct hcl_io_inarg_t
typedef struct hcl_io_udiarg_t hcl_io_udiarg_t;
struct hcl_io_udiarg_t
{
/**
* [OUT] I/O handle set by a handler.
@ -1290,8 +1290,8 @@ struct hcl_io_inarg_t
hcl_oow_t xlen;
};
typedef struct hcl_io_outarg_t hcl_io_outarg_t;
struct hcl_io_outarg_t
typedef struct hcl_io_udoarg_t hcl_io_udoarg_t;
struct hcl_io_udoarg_t
{
/**
* [OUT] I/O handle set by a handler.
@ -1328,7 +1328,7 @@ struct hcl_io_outarg_t
typedef int (*hcl_io_impl_t) (
hcl_t* hcl,
hcl_io_cmd_t cmd,
void* arg /* one of hcl_io_sciarg_t*, hcl_io_inarg_t*, hcl_io_outarg_t* */
void* arg /* one of hcl_io_sciarg_t*, hcl_io_udiarg_t*, hcl_io_udoarg_t* */
);
/* =========================================================================
@ -1706,7 +1706,7 @@ struct hcl_t
hcl_dbgi_t* dbgi;
} code;
/* == PRINTER == */
/* == PRINTER to udo stream == */
struct
{
struct
@ -1717,7 +1717,7 @@ struct hcl_t
} s;
hcl_oop_t e; /* top entry being printed */
} p;
/* == PRINTER == */
/* == PRINTER to udo stream == */
struct
{
@ -1750,12 +1750,12 @@ struct hcl_t
struct
{
/* input handler */
hcl_io_impl_t scanner;
hcl_io_inarg_t inarg;
hcl_io_impl_t udi_rdr;
hcl_io_udiarg_t udi_arg;
/* output handler */
hcl_io_impl_t printer;
hcl_io_outarg_t outarg;
hcl_io_impl_t udo_wrtr;
hcl_io_udoarg_t udo_arg;
} io;
#if defined(HCL_INCLUDE_COMPILER)
@ -2243,8 +2243,8 @@ HCL_EXPORT hcl_ooch_t* hcl_readbasesrraw (
HCL_EXPORT int hcl_attachio (
hcl_t* hcl,
hcl_io_impl_t sci_rdr, /* source code input handler */
hcl_io_impl_t scanner, /* user data input handler */
hcl_io_impl_t printer /* user data output handler */
hcl_io_impl_t udi_rdr, /* user data input handler */
hcl_io_impl_t udo_wrtr /* user data output handler */
);
HCL_EXPORT int hcl_attachiostdwithbcstr (

View File

@ -778,7 +778,7 @@ int hcl_outfmtobj (hcl_t* hcl, hcl_bitmask_t mask, hcl_oop_t obj, hcl_outbfmt_t
int hcl_print (hcl_t* hcl, hcl_oop_t obj)
{
HCL_ASSERT (hcl, hcl->io.printer != HCL_NULL);
HCL_ASSERT (hcl, hcl->io.udo_wrtr != HCL_NULL);
/*return hcl_outfmtobj(hcl, HCL_LOG_APP | HCL_LOG_FATAL, obj);*/
return hcl_prbfmt(hcl, "%O", obj);
}

View File

@ -2669,7 +2669,7 @@ default callback for on_eof?
/* ------------------------------------------------------------------------ */
/* TODO: rename compiler to something else that can include reader, printer, and compiler
/* TODO: rename compiler to something else that can include reader, udo_wrtr, and compiler
* move compiler intialization/finalization here to more common place */
static void gc_compiler_cb (hcl_t* hcl)
@ -2786,13 +2786,13 @@ static int init_compiler (hcl_t* hcl)
return 0;
}
int hcl_attachio (hcl_t* hcl, hcl_io_impl_t sci_rdr, hcl_io_impl_t scanner, hcl_io_impl_t printer)
int hcl_attachio (hcl_t* hcl, hcl_io_impl_t sci_rdr, hcl_io_impl_t udi_rdr, hcl_io_impl_t udo_wrtr)
{
int n;
int inited_compiler = 0;
hcl_io_sciarg_t new_sciarg;
hcl_io_inarg_t new_inarg;
hcl_io_outarg_t new_outarg;
hcl_io_udiarg_t new_udiarg;
hcl_io_udoarg_t new_udoarg;
if (!hcl->c)
{
@ -2813,10 +2813,10 @@ int hcl_attachio (hcl_t* hcl, hcl_io_impl_t sci_rdr, hcl_io_impl_t scanner, hcl_
if (n <= -1) goto oops;
}
if (scanner)
if (udi_rdr)
{
HCL_MEMSET (&new_inarg, 0, HCL_SIZEOF(new_inarg));
n = scanner(hcl, HCL_IO_OPEN, &new_inarg);
HCL_MEMSET (&new_udiarg, 0, HCL_SIZEOF(new_udiarg));
n = udi_rdr(hcl, HCL_IO_OPEN, &new_udiarg);
if (n <= -1)
{
sci_rdr (hcl, HCL_IO_CLOSE, &new_sciarg);
@ -2824,14 +2824,14 @@ int hcl_attachio (hcl_t* hcl, hcl_io_impl_t sci_rdr, hcl_io_impl_t scanner, hcl_
}
}
if (printer)
if (udo_wrtr)
{
/* open the new output stream */
HCL_MEMSET (&new_outarg, 0, HCL_SIZEOF(new_outarg));
n = printer(hcl, HCL_IO_OPEN, &new_outarg);
HCL_MEMSET (&new_udoarg, 0, HCL_SIZEOF(new_udoarg));
n = udo_wrtr(hcl, HCL_IO_OPEN, &new_udoarg);
if (n <= -1)
{
if (scanner) scanner (hcl, HCL_IO_CLOSE, &new_inarg);
if (udi_rdr) udi_rdr (hcl, HCL_IO_CLOSE, &new_udiarg);
if (sci_rdr) sci_rdr (hcl, HCL_IO_CLOSE, &new_sciarg);
goto oops;
}
@ -2848,26 +2848,26 @@ int hcl_attachio (hcl_t* hcl, hcl_io_impl_t sci_rdr, hcl_io_impl_t scanner, hcl_
hcl->c->sci_arg = new_sciarg;
}
if (scanner)
if (udi_rdr)
{
if (hcl->io.scanner)
if (hcl->io.udi_rdr)
{
/* close the old input stream */
hcl->io.scanner (hcl, HCL_IO_CLOSE, &hcl->io.inarg);
hcl->io.udi_rdr (hcl, HCL_IO_CLOSE, &hcl->io.udi_arg);
}
hcl->io.scanner = scanner;
hcl->io.inarg = new_inarg;
hcl->io.udi_rdr = udi_rdr;
hcl->io.udi_arg = new_udiarg;
}
if (printer)
if (udo_wrtr)
{
if (hcl->io.printer)
if (hcl->io.udo_wrtr)
{
/* close the old output stream */
hcl->io.printer (hcl, HCL_IO_CLOSE, &hcl->io.outarg);
hcl->io.udo_wrtr (hcl, HCL_IO_CLOSE, &hcl->io.udo_arg);
}
hcl->io.printer = printer;
hcl->io.outarg = new_outarg;
hcl->io.udo_wrtr = udo_wrtr;
hcl->io.udo_arg = new_udoarg;
}
if (sci_rdr)
@ -2890,7 +2890,7 @@ oops:
void hcl_flushio (hcl_t* hcl)
{
if (hcl->io.printer) hcl->io.printer (hcl, HCL_IO_FLUSH, &hcl->io.outarg);
if (hcl->io.udo_wrtr) hcl->io.udo_wrtr (hcl, HCL_IO_FLUSH, &hcl->io.udo_arg);
}
void hcl_detachio (hcl_t* hcl)
@ -2922,16 +2922,16 @@ void hcl_detachio (hcl_t* hcl)
}
if (hcl->io.scanner)
if (hcl->io.udi_rdr)
{
hcl->io.scanner (hcl, HCL_IO_CLOSE, &hcl->io.inarg);
hcl->io.scanner = HCL_NULL; /* ready for another attachment */
hcl->io.udi_rdr (hcl, HCL_IO_CLOSE, &hcl->io.udi_arg);
hcl->io.udi_rdr = HCL_NULL; /* ready for another attachment */
}
if (hcl->io.printer)
if (hcl->io.udo_wrtr)
{
hcl->io.printer (hcl, HCL_IO_CLOSE, &hcl->io.outarg);
hcl->io.printer = HCL_NULL; /* ready for another attachment */
hcl->io.udo_wrtr (hcl, HCL_IO_CLOSE, &hcl->io.udo_arg);
hcl->io.udo_wrtr = HCL_NULL; /* ready for another attachment */
}
}

View File

@ -3396,7 +3396,7 @@ static int sci_handler (hcl_t* hcl, hcl_io_cmd_t cmd, void* arg)
}
/* --------------------------------------------------------------------- */
static HCL_INLINE int open_in_stream (hcl_t* hcl, hcl_io_inarg_t* arg)
static HCL_INLINE int open_in_stream (hcl_t* hcl, hcl_io_udiarg_t* arg)
{
xtn_t* xtn = GET_XTN(hcl);
bb_t* bb = HCL_NULL;
@ -3438,7 +3438,7 @@ oops:
return -1;
}
static HCL_INLINE int close_in_stream (hcl_t* hcl, hcl_io_inarg_t* arg)
static HCL_INLINE int close_in_stream (hcl_t* hcl, hcl_io_udiarg_t* arg)
{
/*xtn_t* xtn = GET_XTN(hcl);*/
bb_t* bb;
@ -3453,7 +3453,7 @@ static HCL_INLINE int close_in_stream (hcl_t* hcl, hcl_io_inarg_t* arg)
return 0;
}
static HCL_INLINE int read_in_stream (hcl_t* hcl, hcl_io_inarg_t* arg)
static HCL_INLINE int read_in_stream (hcl_t* hcl, hcl_io_udiarg_t* arg)
{
/*xtn_t* xtn = GET_XTN(hcl);*/
bb_t* bb;
@ -3508,13 +3508,13 @@ static int scan_handler (hcl_t* hcl, hcl_io_cmd_t cmd, void* arg)
switch (cmd)
{
case HCL_IO_OPEN:
return open_in_stream(hcl, (hcl_io_inarg_t*)arg);
return open_in_stream(hcl, (hcl_io_udiarg_t*)arg);
case HCL_IO_CLOSE:
return close_in_stream(hcl, (hcl_io_inarg_t*)arg);
return close_in_stream(hcl, (hcl_io_udiarg_t*)arg);
case HCL_IO_READ:
return read_in_stream(hcl, (hcl_io_inarg_t*)arg);
return read_in_stream(hcl, (hcl_io_udiarg_t*)arg);
case HCL_IO_FLUSH:
/* no effect on an input stream */
@ -3528,7 +3528,7 @@ static int scan_handler (hcl_t* hcl, hcl_io_cmd_t cmd, void* arg)
/* --------------------------------------------------------------------- */
static HCL_INLINE int open_out_stream (hcl_t* hcl, hcl_io_outarg_t* arg)
static HCL_INLINE int open_out_stream (hcl_t* hcl, hcl_io_udoarg_t* arg)
{
xtn_t* xtn = GET_XTN(hcl);
FILE* fp;
@ -3552,7 +3552,7 @@ static HCL_INLINE int open_out_stream (hcl_t* hcl, hcl_io_outarg_t* arg)
return 0;
}
static HCL_INLINE int close_out_stream (hcl_t* hcl, hcl_io_outarg_t* arg)
static HCL_INLINE int close_out_stream (hcl_t* hcl, hcl_io_udoarg_t* arg)
{
/*xtn_t* xtn = GET_XTN(hcl);*/
FILE* fp;
@ -3564,7 +3564,7 @@ static HCL_INLINE int close_out_stream (hcl_t* hcl, hcl_io_outarg_t* arg)
return 0;
}
static HCL_INLINE int write_out_stream (hcl_t* hcl, hcl_io_outarg_t* arg)
static HCL_INLINE int write_out_stream (hcl_t* hcl, hcl_io_udoarg_t* arg)
{
/*xtn_t* xtn = GET_XTN(hcl);*/
const hcl_ooch_t* ptr;
@ -3604,7 +3604,7 @@ static HCL_INLINE int write_out_stream (hcl_t* hcl, hcl_io_outarg_t* arg)
return 0;
}
static HCL_INLINE int write_bytes_out_stream (hcl_t* hcl, hcl_io_outarg_t* arg)
static HCL_INLINE int write_bytes_out_stream (hcl_t* hcl, hcl_io_udoarg_t* arg)
{
/*xtn_t* xtn = GET_XTN(hcl);*/
const hcl_uint8_t* ptr;
@ -3621,7 +3621,7 @@ static HCL_INLINE int write_bytes_out_stream (hcl_t* hcl, hcl_io_outarg_t* arg)
return 0;
}
static HCL_INLINE int flush_out_stream (hcl_t* hcl, hcl_io_outarg_t* arg)
static HCL_INLINE int flush_out_stream (hcl_t* hcl, hcl_io_udoarg_t* arg)
{
FILE* fp;
@ -3637,19 +3637,19 @@ static int print_handler (hcl_t* hcl, hcl_io_cmd_t cmd, void* arg)
switch (cmd)
{
case HCL_IO_OPEN:
return open_out_stream(hcl, (hcl_io_outarg_t*)arg);
return open_out_stream(hcl, (hcl_io_udoarg_t*)arg);
case HCL_IO_CLOSE:
return close_out_stream(hcl, (hcl_io_outarg_t*)arg);
return close_out_stream(hcl, (hcl_io_udoarg_t*)arg);
case HCL_IO_WRITE:
return write_out_stream(hcl, (hcl_io_outarg_t*)arg);
return write_out_stream(hcl, (hcl_io_udoarg_t*)arg);
case HCL_IO_WRITE_BYTES:
return write_bytes_out_stream(hcl, (hcl_io_outarg_t*)arg);
return write_bytes_out_stream(hcl, (hcl_io_udoarg_t*)arg);
case HCL_IO_FLUSH:
return flush_out_stream(hcl, (hcl_io_outarg_t*)arg);
return flush_out_stream(hcl, (hcl_io_udoarg_t*)arg);
default:
hcl_seterrnum (hcl, HCL_EINTERN);