minor code fixes

This commit is contained in:
hyung-hwan 2021-03-27 10:32:23 +00:00
parent e46d7fa286
commit a20587537e
4 changed files with 190 additions and 168 deletions

View File

@ -635,7 +635,7 @@ int hcl_decode (hcl_t* hcl, hcl_oow_t start, hcl_oow_t end)
} }
} }
// TODO: this needs changes... */ /* TODO: this needs changes... */
/* print literal frame contents */ /* print literal frame contents */
for (ip = 0; ip < hcl->code.lit.len; ip++) for (ip = 0; ip < hcl->code.lit.len; ip++)
{ {

View File

@ -1174,7 +1174,7 @@ static int fmt_outv (hcl_fmtout_t* fmtout, va_list ap)
newcapa = precision + width + 32; newcapa = precision + width + 32;
if (fb.out.capa < newcapa) if (fb.out.capa < newcapa)
{ {
HCL_ASSERT (moo, fb.out.ptr == fb.out.sbuf); /*HCL_ASSERT (hcl, fb.out.ptr == fb.out.sbuf);*/
fb.out.ptr = HCL_MMGR_ALLOC(fmtout->mmgr, HCL_SIZEOF(hcl_bch_t) * (newcapa + 1)); fb.out.ptr = HCL_MMGR_ALLOC(fmtout->mmgr, HCL_SIZEOF(hcl_bch_t) * (newcapa + 1));
if (!fb.out.ptr) goto oops; if (!fb.out.ptr) goto oops;

View File

@ -73,7 +73,37 @@
# define HCL_SIZEOF_VOID_P 4 # define HCL_SIZEOF_VOID_P 4
# define HCL_SIZEOF_FLOAT 4 # define HCL_SIZEOF_FLOAT 4
# define HCL_SIZEOF_DOUBLE 8 # define HCL_SIZEOF_DOUBLE 8
# define HCL_SIZEOF_LONG_DOUBLE 8 # define HCL_SIZEOF_LONG_DOUBLE 10
# define HCL_SIZEOF_WCHAR_T 2
# define HCL_SIZEOF___INT8 0
# define HCL_SIZEOF___INT16 0
# define HCL_SIZEOF___INT32 0
# define HCL_SIZEOF___INT64 0
# define HCL_SIZEOF___INT128 0
# define HCL_SIZEOF_OFF64_T 0
# define HCL_SIZEOF_OFF_T 4
# define HCL_SIZEOF_MBSTATE_T HCL_SIZEOF_LONG
# define HCL_MBLEN_MAX 8
# define HCL_SIZEOF_STRUCT_SOCKADDR_IN 32
# define HCL_SIZEOF_STRUCT_SOCKADDR_IN6 64
# define HCL_SIZEOF_SOCKLEN_T 4
#elif defined(__IBMC__) || defined(__IBMCPP__)
/* visualage c or c++ */
# define HCL_SIZEOF_CHAR 1
# define HCL_SIZEOF_SHORT 2
# define HCL_SIZEOF_INT 4
# define HCL_SIZEOF_LONG 4
# define HCL_SIZEOF_LONG_LONG 0
# define HCL_SIZEOF_VOID_P 4
# define HCL_SIZEOF_FLOAT 4
# define HCL_SIZEOF_DOUBLE 8
# define HCL_SIZEOF_LONG_DOUBLE 16
# define HCL_SIZEOF_WCHAR_T 2 # define HCL_SIZEOF_WCHAR_T 2
# define HCL_SIZEOF___INT8 0 # define HCL_SIZEOF___INT8 0

View File

@ -215,7 +215,7 @@ static HCL_INLINE hcl_oop_t alloc_numeric_array (hcl_t* hcl, int brand, const vo
hdr->_flags = HCL_OBJ_MAKE_FLAGS(type, unit, extra, 0, 0, ngc, 0, 0); hdr->_flags = HCL_OBJ_MAKE_FLAGS(type, unit, extra, 0, 0, ngc, 0, 0);
hdr->_size = len; hdr->_size = len;
HCL_OBJ_SET_SIZE (hdr, len); HCL_OBJ_SET_SIZE (hdr, len);
//HCL_OBJ_SET_CLASS (hdr, hcl->_nil); /*HCL_OBJ_SET_CLASS (hdr, hcl->_nil);*/
HCL_OBJ_SET_FLAGS_BRAND (hdr, brand); HCL_OBJ_SET_FLAGS_BRAND (hdr, brand);
if (ptr) if (ptr)
@ -321,20 +321,12 @@ hcl_oop_t hcl_makebytearray (hcl_t* hcl, const hcl_oob_t* ptr, hcl_oow_t size)
return hcl_allocbyteobj(hcl, HCL_BRAND_BYTE_ARRAY, ptr, size); return hcl_allocbyteobj(hcl, HCL_BRAND_BYTE_ARRAY, ptr, size);
} }
hcl_oop_t hcl_makedlist (hcl_t* hcl)
{
//return hcl_allocoopobj(hcl, HCL_BRAND_DLIST);
hcl_seterrnum (hcl, HCL_ENOIMPL);
return HCL_NULL;
}
hcl_oop_t hcl_makestring (hcl_t* hcl, const hcl_ooch_t* ptr, hcl_oow_t len, int ngc) hcl_oop_t hcl_makestring (hcl_t* hcl, const hcl_ooch_t* ptr, hcl_oow_t len, int ngc)
{ {
/*return hcl_alloccharobj(hcl, HCL_BRAND_STRING, ptr, len);*/ /*return hcl_alloccharobj(hcl, HCL_BRAND_STRING, ptr, len);*/
return alloc_numeric_array(hcl, HCL_BRAND_STRING, ptr, len, HCL_OBJ_TYPE_CHAR, HCL_SIZEOF(hcl_ooch_t), 1, ngc); return alloc_numeric_array(hcl, HCL_BRAND_STRING, ptr, len, HCL_OBJ_TYPE_CHAR, HCL_SIZEOF(hcl_ooch_t), 1, ngc);
} }
hcl_oop_t hcl_makefpdec (hcl_t* hcl, hcl_oop_t value, hcl_ooi_t scale) hcl_oop_t hcl_makefpdec (hcl_t* hcl, hcl_oop_t value, hcl_ooi_t scale)
{ {
hcl_oop_fpdec_t f; hcl_oop_fpdec_t f;