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

This commit is contained in:
hyung-hwan 2023-11-04 22:58:31 +09:00
parent 110cb0b767
commit df924338df
8 changed files with 207 additions and 207 deletions

View File

@ -26,7 +26,7 @@
#include "hcl-prv.h"
static hcl_cnode_t* make_cnode (hcl_t* hcl, hcl_cnode_type_t type, const hcl_ioloc_t* loc, const hcl_oocs_t* tok)
static hcl_cnode_t* make_cnode (hcl_t* hcl, hcl_cnode_type_t type, const hcl_loc_t* loc, const hcl_oocs_t* tok)
{
hcl_cnode_t* cnode;
hcl_oocs_t empty;
@ -52,47 +52,47 @@ static hcl_cnode_t* make_cnode (hcl_t* hcl, hcl_cnode_type_t type, const hcl_iol
return cnode;
}
hcl_cnode_t* hcl_makecnodenil (hcl_t* hcl, const hcl_ioloc_t* loc, const hcl_oocs_t* tok)
hcl_cnode_t* hcl_makecnodenil (hcl_t* hcl, const hcl_loc_t* loc, const hcl_oocs_t* tok)
{
return make_cnode(hcl, HCL_CNODE_NIL, loc, tok);
}
hcl_cnode_t* hcl_makecnodetrue (hcl_t* hcl, const hcl_ioloc_t* loc, const hcl_oocs_t* tok)
hcl_cnode_t* hcl_makecnodetrue (hcl_t* hcl, const hcl_loc_t* loc, const hcl_oocs_t* tok)
{
return make_cnode(hcl, HCL_CNODE_TRUE, loc, tok);
}
hcl_cnode_t* hcl_makecnodefalse (hcl_t* hcl, const hcl_ioloc_t* loc, const hcl_oocs_t* tok)
hcl_cnode_t* hcl_makecnodefalse (hcl_t* hcl, const hcl_loc_t* loc, const hcl_oocs_t* tok)
{
return make_cnode(hcl, HCL_CNODE_FALSE, loc, tok);
}
hcl_cnode_t* hcl_makecnodeself (hcl_t* hcl, const hcl_ioloc_t* loc, const hcl_oocs_t* tok)
hcl_cnode_t* hcl_makecnodeself (hcl_t* hcl, const hcl_loc_t* loc, const hcl_oocs_t* tok)
{
return make_cnode(hcl, HCL_CNODE_SELF, loc, tok);
}
hcl_cnode_t* hcl_makecnodesuper (hcl_t* hcl, const hcl_ioloc_t* loc, const hcl_oocs_t* tok)
hcl_cnode_t* hcl_makecnodesuper (hcl_t* hcl, const hcl_loc_t* loc, const hcl_oocs_t* tok)
{
return make_cnode(hcl, HCL_CNODE_SUPER, loc, tok);
}
hcl_cnode_t* hcl_makecnodeellipsis (hcl_t* hcl, const hcl_ioloc_t* loc, const hcl_oocs_t* tok)
hcl_cnode_t* hcl_makecnodeellipsis (hcl_t* hcl, const hcl_loc_t* loc, const hcl_oocs_t* tok)
{
return make_cnode(hcl, HCL_CNODE_ELLIPSIS, loc, tok);
}
hcl_cnode_t* hcl_makecnodetrpcolons (hcl_t* hcl, const hcl_ioloc_t* loc, const hcl_oocs_t* tok)
hcl_cnode_t* hcl_makecnodetrpcolons (hcl_t* hcl, const hcl_loc_t* loc, const hcl_oocs_t* tok)
{
return make_cnode(hcl, HCL_CNODE_TRPCOLONS, loc, tok);
}
hcl_cnode_t* hcl_makecnodedcstar (hcl_t* hcl, const hcl_ioloc_t* loc, const hcl_oocs_t* tok)
hcl_cnode_t* hcl_makecnodedcstar (hcl_t* hcl, const hcl_loc_t* loc, const hcl_oocs_t* tok)
{
return make_cnode(hcl, HCL_CNODE_DCSTAR, loc, tok);
}
hcl_cnode_t* hcl_makecnodecharlit (hcl_t* hcl, const hcl_ioloc_t* loc, const hcl_oocs_t* tok, const hcl_ooch_t v)
hcl_cnode_t* hcl_makecnodecharlit (hcl_t* hcl, const hcl_loc_t* loc, const hcl_oocs_t* tok, const hcl_ooch_t v)
{
hcl_cnode_t* c = make_cnode(hcl, HCL_CNODE_CHARLIT, loc, tok);
if (HCL_UNLIKELY(!c)) return HCL_NULL;
@ -100,7 +100,7 @@ hcl_cnode_t* hcl_makecnodecharlit (hcl_t* hcl, const hcl_ioloc_t* loc, const hc
return c;
}
hcl_cnode_t* hcl_makecnodesymbol (hcl_t* hcl, const hcl_ioloc_t* loc, const hcl_oocs_t* tok)
hcl_cnode_t* hcl_makecnodesymbol (hcl_t* hcl, const hcl_loc_t* loc, const hcl_oocs_t* tok)
{
hcl_cnode_t* c = make_cnode(hcl, HCL_CNODE_SYMBOL, loc, tok);
if (HCL_UNLIKELY(!c)) return HCL_NULL;
@ -108,32 +108,32 @@ hcl_cnode_t* hcl_makecnodesymbol (hcl_t* hcl, const hcl_ioloc_t* loc, const hcl
return c;
}
hcl_cnode_t* hcl_makecnodedsymbol (hcl_t* hcl, const hcl_ioloc_t* loc, const hcl_oocs_t* tok)
hcl_cnode_t* hcl_makecnodedsymbol (hcl_t* hcl, const hcl_loc_t* loc, const hcl_oocs_t* tok)
{
return make_cnode(hcl, HCL_CNODE_DSYMBOL, loc, tok);
}
hcl_cnode_t* hcl_makecnodestrlit (hcl_t* hcl, const hcl_ioloc_t* loc, const hcl_oocs_t* tok)
hcl_cnode_t* hcl_makecnodestrlit (hcl_t* hcl, const hcl_loc_t* loc, const hcl_oocs_t* tok)
{
return make_cnode(hcl, HCL_CNODE_STRLIT, loc, tok);
}
hcl_cnode_t* hcl_makecnodenumlit (hcl_t* hcl, const hcl_ioloc_t* loc, const hcl_oocs_t* tok)
hcl_cnode_t* hcl_makecnodenumlit (hcl_t* hcl, const hcl_loc_t* loc, const hcl_oocs_t* tok)
{
return make_cnode(hcl, HCL_CNODE_NUMLIT, loc, tok);
}
hcl_cnode_t* hcl_makecnoderadnumlit (hcl_t* hcl, const hcl_ioloc_t* loc, const hcl_oocs_t* tok)
hcl_cnode_t* hcl_makecnoderadnumlit (hcl_t* hcl, const hcl_loc_t* loc, const hcl_oocs_t* tok)
{
return make_cnode(hcl, HCL_CNODE_RADNUMLIT, loc, tok);
}
hcl_cnode_t* hcl_makecnodefpdeclit (hcl_t* hcl, const hcl_ioloc_t* loc, const hcl_oocs_t* tok)
hcl_cnode_t* hcl_makecnodefpdeclit (hcl_t* hcl, const hcl_loc_t* loc, const hcl_oocs_t* tok)
{
return make_cnode(hcl, HCL_CNODE_FPDECLIT, loc, tok);
}
hcl_cnode_t* hcl_makecnodesmptrlit (hcl_t* hcl, const hcl_ioloc_t* loc, const hcl_oocs_t* tok, hcl_oow_t v)
hcl_cnode_t* hcl_makecnodesmptrlit (hcl_t* hcl, const hcl_loc_t* loc, const hcl_oocs_t* tok, hcl_oow_t v)
{
hcl_cnode_t* c = make_cnode(hcl, HCL_CNODE_SMPTRLIT, loc, tok);
if (HCL_UNLIKELY(!c)) return HCL_NULL;
@ -141,7 +141,7 @@ hcl_cnode_t* hcl_makecnodesmptrlit (hcl_t* hcl, const hcl_ioloc_t* loc, const hc
return c;
}
hcl_cnode_t* hcl_makecnodeerrlit (hcl_t* hcl, const hcl_ioloc_t* loc, const hcl_oocs_t* tok, hcl_ooi_t v)
hcl_cnode_t* hcl_makecnodeerrlit (hcl_t* hcl, const hcl_loc_t* loc, const hcl_oocs_t* tok, hcl_ooi_t v)
{
hcl_cnode_t* c = make_cnode(hcl, HCL_CNODE_ERRLIT, loc, tok);
if (HCL_UNLIKELY(!c)) return HCL_NULL;
@ -149,7 +149,7 @@ hcl_cnode_t* hcl_makecnodeerrlit (hcl_t* hcl, const hcl_ioloc_t* loc, const hcl_
return c;
}
hcl_cnode_t* hcl_makecnodecons (hcl_t* hcl, const hcl_ioloc_t* loc, hcl_cnode_t* car, hcl_cnode_t* cdr)
hcl_cnode_t* hcl_makecnodecons (hcl_t* hcl, const hcl_loc_t* loc, hcl_cnode_t* car, hcl_cnode_t* cdr)
{
hcl_cnode_t* c = make_cnode(hcl, HCL_CNODE_CONS, loc, HCL_NULL);
if (HCL_UNLIKELY(!c)) return HCL_NULL;
@ -158,7 +158,7 @@ hcl_cnode_t* hcl_makecnodecons (hcl_t* hcl, const hcl_ioloc_t* loc, hcl_cnode_t*
return c;
}
hcl_cnode_t* hcl_makecnodeelist (hcl_t* hcl, const hcl_ioloc_t* loc, hcl_concode_t type)
hcl_cnode_t* hcl_makecnodeelist (hcl_t* hcl, const hcl_loc_t* loc, hcl_concode_t type)
{
hcl_cnode_t* c = make_cnode(hcl, HCL_CNODE_ELIST, loc, HCL_NULL);
if (HCL_UNLIKELY(!c)) return HCL_NULL;
@ -166,7 +166,7 @@ hcl_cnode_t* hcl_makecnodeelist (hcl_t* hcl, const hcl_ioloc_t* loc, hcl_concode
return c;
}
hcl_cnode_t* hcl_makecnodeshell (hcl_t* hcl, const hcl_ioloc_t* loc, hcl_cnode_t* obj)
hcl_cnode_t* hcl_makecnodeshell (hcl_t* hcl, const hcl_loc_t* loc, hcl_cnode_t* obj)
{
hcl_cnode_t* c = make_cnode(hcl, HCL_CNODE_SHELL, loc, HCL_NULL);
if (HCL_UNLIKELY(!c)) return HCL_NULL;

View File

@ -458,7 +458,7 @@ static HCL_INLINE void patch_instruction (hcl_t* hcl, hcl_oow_t index, hcl_oob_t
hcl->code.bc.ptr[index] = bc;
}
static int emit_byte_instruction (hcl_t* hcl, hcl_oob_t bc, const hcl_ioloc_t* srcloc)
static int emit_byte_instruction (hcl_t* hcl, hcl_oob_t bc, const hcl_loc_t* srcloc)
{
/* the context object has the ip field. it should be representable
* in a small integer. for simplicity, limit the total byte code length
@ -513,7 +513,7 @@ int hcl_emitbyteinstruction (hcl_t* hcl, hcl_oob_t bc)
return emit_byte_instruction(hcl, bc, HCL_NULL);
}*/
static int emit_single_param_instruction (hcl_t* hcl, int cmd, hcl_oow_t param_1, const hcl_ioloc_t* srcloc)
static int emit_single_param_instruction (hcl_t* hcl, int cmd, hcl_oow_t param_1, const hcl_loc_t* srcloc)
{
hcl_oob_t bc;
@ -656,7 +656,7 @@ write_long2:
return 0;
}
static int emit_double_param_instruction (hcl_t* hcl, int cmd, hcl_oow_t param_1, hcl_oow_t param_2, const hcl_ioloc_t* srcloc)
static int emit_double_param_instruction (hcl_t* hcl, int cmd, hcl_oow_t param_1, hcl_oow_t param_2, const hcl_loc_t* srcloc)
{
hcl_oob_t bc;
@ -738,7 +738,7 @@ static HCL_INLINE int emit_long_param (hcl_t* hcl, hcl_oow_t param)
#endif
}
static int emit_push_literal (hcl_t* hcl, hcl_oop_t obj, const hcl_ioloc_t* srcloc)
static int emit_push_literal (hcl_t* hcl, hcl_oop_t obj, const hcl_loc_t* srcloc)
{
hcl_oow_t index;
@ -853,7 +853,7 @@ static HCL_INLINE void patch_double_long_params_with_oow (hcl_t* hcl, hcl_ooi_t
#endif
}
static int emit_variable_access (hcl_t* hcl, int mode, const hcl_var_info_t* vi, const hcl_ioloc_t* srcloc)
static int emit_variable_access (hcl_t* hcl, int mode, const hcl_var_info_t* vi, const hcl_loc_t* srcloc)
{
static hcl_oob_t inst_map[][3] =
{
@ -886,7 +886,7 @@ static int emit_variable_access (hcl_t* hcl, int mode, const hcl_var_info_t* vi,
}
/* ========================================================================= */
static int push_cblk (hcl_t* hcl, const hcl_ioloc_t* errloc, hcl_cblk_type_t type)
static int push_cblk (hcl_t* hcl, const hcl_loc_t* errloc, hcl_cblk_type_t type)
{
hcl_oow_t new_depth;
@ -929,7 +929,7 @@ static void pop_cblk (hcl_t* hcl)
hcl->c->cblk.depth--;
}
static int push_clsblk (hcl_t* hcl, const hcl_ioloc_t* errloc, hcl_oow_t nivars, hcl_oow_t ncvars, const hcl_ooch_t* ivars_str, hcl_oow_t ivars_strlen, const hcl_ooch_t* cvars_str, hcl_oow_t cvars_strlen)
static int push_clsblk (hcl_t* hcl, const hcl_loc_t* errloc, hcl_oow_t nivars, hcl_oow_t ncvars, const hcl_ooch_t* ivars_str, hcl_oow_t ivars_strlen, const hcl_ooch_t* cvars_str, hcl_oow_t cvars_strlen)
{
hcl_oow_t new_depth;
hcl_clsblk_info_t* ci;
@ -1028,7 +1028,7 @@ static void pop_clsblk (hcl_t* hcl)
}
static int push_fnblk (hcl_t* hcl, const hcl_ioloc_t* errloc,
static int push_fnblk (hcl_t* hcl, const hcl_loc_t* errloc,
hcl_oow_t tmpr_va, hcl_oow_t tmpr_nargs, hcl_oow_t tmpr_nrvars, hcl_oow_t tmpr_nlvars,
hcl_oow_t tmpr_count, hcl_oow_t tmpr_len, hcl_oow_t make_inst_pos, hcl_oow_t lfbase, int fun_type)
{
@ -3927,7 +3927,7 @@ HCL_DEBUG1 (hcl, ">>>> instance variable or method %js\n", sep + 1);
return 0;
}
static hcl_oop_t string_to_num (hcl_t* hcl, hcl_oocs_t* str, const hcl_ioloc_t* loc, int radixed)
static hcl_oop_t string_to_num (hcl_t* hcl, hcl_oocs_t* str, const hcl_loc_t* loc, int radixed)
{
int negsign, base;
const hcl_ooch_t* ptr, * end;
@ -3992,7 +3992,7 @@ static hcl_oop_t string_to_num (hcl_t* hcl, hcl_oocs_t* str, const hcl_ioloc_t*
return hcl_strtoint(hcl, ptr, end - ptr, base);
}
static hcl_oop_t string_to_fpdec (hcl_t* hcl, hcl_oocs_t* str, const hcl_ioloc_t* loc)
static hcl_oop_t string_to_fpdec (hcl_t* hcl, hcl_oocs_t* str, const hcl_loc_t* loc)
{
hcl_oow_t pos;
hcl_oow_t scale = 0;
@ -4625,7 +4625,7 @@ static HCL_INLINE int post_while_cond (hcl_t* hcl)
hcl_cframe_t* cf;
hcl_ooi_t jump_inst_pos;
hcl_ooi_t cond_pos, body_pos;
hcl_ioloc_t start_loc;
hcl_loc_t start_loc;
int jump_inst, next_cop;
hcl_cnode_t* cond, * body;

View File

@ -553,7 +553,7 @@ hcl_synerrnum_t hcl_getsynerrnum (hcl_t* hcl)
return hcl->c->synerr.num;
}
void hcl_setsynerrbfmt (hcl_t* hcl, hcl_synerrnum_t num, const hcl_ioloc_t* loc, const hcl_oocs_t* tgt, const hcl_bch_t* msgfmt, ...)
void hcl_setsynerrbfmt (hcl_t* hcl, hcl_synerrnum_t num, const hcl_loc_t* loc, const hcl_oocs_t* tgt, const hcl_bch_t* msgfmt, ...)
{
static hcl_bch_t syntax_error[] = "syntax error - ";
@ -612,7 +612,7 @@ void hcl_setsynerrbfmt (hcl_t* hcl, hcl_synerrnum_t num, const hcl_ioloc_t* loc,
}
}
void hcl_setsynerrufmt (hcl_t* hcl, hcl_synerrnum_t num, const hcl_ioloc_t* loc, const hcl_oocs_t* tgt, const hcl_uch_t* msgfmt, ...)
void hcl_setsynerrufmt (hcl_t* hcl, hcl_synerrnum_t num, const hcl_loc_t* loc, const hcl_oocs_t* tgt, const hcl_uch_t* msgfmt, ...)
{
static hcl_bch_t syntax_error[] = "syntax error - ";

View File

@ -157,7 +157,7 @@
/* ========================================================================= */
/* SOURCE CODE I/O FOR COMPILER */
/* ========================================================================= */
enum hcl_iotok_type_t
enum hcl_tok_type_t
{
HCL_IOTOK_EOF,
HCL_IOTOK_CHARLIT,
@ -199,22 +199,22 @@ enum hcl_iotok_type_t
HCL_IOTOK_INCLUDE,
HCL_IOTOK_PRAGMA
};
typedef enum hcl_iotok_type_t hcl_iotok_type_t;
typedef enum hcl_tok_type_t hcl_tok_type_t;
typedef struct hcl_iotok_t hcl_iotok_t;
struct hcl_iotok_t
typedef struct hcl_tok_t hcl_tok_t;
struct hcl_tok_t
{
hcl_iotok_type_t type;
hcl_tok_type_t type;
hcl_oocs_t name;
hcl_oow_t name_capa;
hcl_ioloc_t loc;
hcl_loc_t loc;
};
typedef struct hcl_iolink_t hcl_iolink_t;
struct hcl_iolink_t
typedef struct hcl_link_t hcl_link_t;
struct hcl_link_t
{
hcl_iolink_t* link;
hcl_link_t* link;
};
enum hcl_cnode_type_t
@ -274,7 +274,7 @@ typedef enum hcl_cnode_type_t hcl_cnode_type_t;
struct hcl_cnode_t
{
hcl_cnode_type_t cn_type;
hcl_ioloc_t cn_loc;
hcl_loc_t cn_loc;
hcl_oocs_t cn_tok;
union
@ -369,14 +369,14 @@ struct hcl_cframe_t
hcl_ooi_t cond_pos;
hcl_ooi_t body_pos;
hcl_ooi_t jump_inst_pos;
hcl_ioloc_t start_loc;
hcl_loc_t start_loc;
} post_while;
struct
{
hcl_ooi_t body_pos;
hcl_ooi_t jump_inst_pos;
hcl_ioloc_t start_loc;
hcl_loc_t start_loc;
} post_if;
struct
@ -451,7 +451,7 @@ struct hcl_cframe_t
struct
{
hcl_ooi_t nsuperclasses;
hcl_ioloc_t start_loc;
hcl_loc_t start_loc;
} _class;
} u;
};
@ -520,7 +520,7 @@ struct hcl_rstl_t
{
hcl_cnode_t* head;
hcl_cnode_t* tail;
hcl_ioloc_t loc;
hcl_loc_t loc;
int flagv;
hcl_oow_t count;
hcl_rstl_t* prev;
@ -553,7 +553,7 @@ typedef struct hcl_flx_hn_t hcl_flx_hn_t; /* hash-marked number - radixed number
struct hcl_flx_hn_t
{
/* input data */
hcl_iotok_type_t tok_type;
hcl_tok_type_t tok_type;
hcl_synerrnum_t synerr_code;
int radix;
@ -570,7 +570,7 @@ struct hcl_flx_pi_t
hcl_oow_t seg_count;
hcl_oow_t seg_len;
hcl_oow_t non_ident_seg_count;
hcl_iotok_type_t last_non_ident_type;
hcl_tok_type_t last_non_ident_type;
};
typedef struct hcl_flx_pn_t hcl_flx_pn_t;
@ -585,7 +585,7 @@ typedef struct hcl_flx_qt_t hcl_flx_qt_t; /* quoted token */
struct hcl_flx_qt_t
{
/* input data */
hcl_iotok_type_t tok_type;
hcl_tok_type_t tok_type;
hcl_synerrnum_t synerr_code;
hcl_ooch_t end_char;
hcl_ooch_t esc_char;
@ -644,28 +644,28 @@ struct hcl_compiler_t
hcl_cb_t* cbp;
/* input handler */
hcl_ioimpl_t reader;
hcl_io_impl_t reader;
/* static input data buffer */
hcl_iosrarg_t srarg;
hcl_io_sciarg_t sciarg;
/* pointer to the current input data. initially, it points to &inarg */
hcl_iosrarg_t* curinp;
hcl_io_sciarg_t* curinp;
/* information about the last meaningful character read.
* this is a copy of curinp->lxc if no ungetting is performed.
* if there is something in the unget buffer, this is overwritten
* by a value from the buffer when the request to read a character
* is served */
hcl_iolxc_t lxc;
hcl_lxc_t lxc;
/* unget buffer */
hcl_iolxc_t ungot[10];
hcl_lxc_t ungot[10];
int nungots;
/* the last token read */
hcl_iotok_t tok;
hcl_iolink_t* sr_names;
hcl_tok_t tok;
hcl_link_t* sr_names;
hcl_synerr_t synerr;
@ -696,8 +696,8 @@ struct hcl_compiler_t
struct
{
hcl_flx_state_t state;
hcl_ioloc_t loc;
hcl_ioloc_t _oloc;
hcl_loc_t loc;
hcl_loc_t _oloc;
union
{
@ -1694,26 +1694,26 @@ int hcl_emitbyteinstruction (
/* ========================================================================= */
/* cnode.c */
/* ========================================================================= */
hcl_cnode_t* hcl_makecnodenil (hcl_t* hcl, const hcl_ioloc_t* loc, const hcl_oocs_t* tok);
hcl_cnode_t* hcl_makecnodetrue (hcl_t* hcl, const hcl_ioloc_t* loc, const hcl_oocs_t* tok);
hcl_cnode_t* hcl_makecnodefalse (hcl_t* hcl, const hcl_ioloc_t* loc, const hcl_oocs_t* tok);
hcl_cnode_t* hcl_makecnodeself (hcl_t* hcl, const hcl_ioloc_t* loc, const hcl_oocs_t* tok);
hcl_cnode_t* hcl_makecnodesuper (hcl_t* hcl, const hcl_ioloc_t* loc, const hcl_oocs_t* tok);
hcl_cnode_t* hcl_makecnodeellipsis (hcl_t* hcl, const hcl_ioloc_t* loc, const hcl_oocs_t* tok);
hcl_cnode_t* hcl_makecnodetrpcolons (hcl_t* hcl, const hcl_ioloc_t* loc, const hcl_oocs_t* tok);
hcl_cnode_t* hcl_makecnodedcstar (hcl_t* hcl, const hcl_ioloc_t* loc, const hcl_oocs_t* tok);
hcl_cnode_t* hcl_makecnodecharlit (hcl_t* hcl, const hcl_ioloc_t* loc, const hcl_oocs_t* tok, const hcl_ooch_t v);
hcl_cnode_t* hcl_makecnodesymbol (hcl_t* hcl, const hcl_ioloc_t* loc, const hcl_oocs_t* tok);
hcl_cnode_t* hcl_makecnodedsymbol (hcl_t* hcl, const hcl_ioloc_t* loc, const hcl_oocs_t* tok);
hcl_cnode_t* hcl_makecnodestrlit (hcl_t* hcl, const hcl_ioloc_t* loc, const hcl_oocs_t* tok);
hcl_cnode_t* hcl_makecnodenumlit (hcl_t* hcl, const hcl_ioloc_t* loc, const hcl_oocs_t* tok);
hcl_cnode_t* hcl_makecnoderadnumlit (hcl_t* hcl, const hcl_ioloc_t* loc, const hcl_oocs_t* tok);
hcl_cnode_t* hcl_makecnodefpdeclit (hcl_t* hcl, const hcl_ioloc_t* loc, const hcl_oocs_t* tok);
hcl_cnode_t* hcl_makecnodesmptrlit (hcl_t* hcl, const hcl_ioloc_t* loc, const hcl_oocs_t* tok, hcl_oow_t v);
hcl_cnode_t* hcl_makecnodeerrlit (hcl_t* hcl, const hcl_ioloc_t* loc, const hcl_oocs_t* tok, hcl_ooi_t v);
hcl_cnode_t* hcl_makecnodecons (hcl_t* hcl, const hcl_ioloc_t* loc, hcl_cnode_t* car, hcl_cnode_t* cdr);
hcl_cnode_t* hcl_makecnodeelist (hcl_t* hcl, const hcl_ioloc_t* loc, hcl_concode_t type);
hcl_cnode_t* hcl_makecnodeshell (hcl_t* hcl, const hcl_ioloc_t* loc, hcl_cnode_t* obj);
hcl_cnode_t* hcl_makecnodenil (hcl_t* hcl, const hcl_loc_t* loc, const hcl_oocs_t* tok);
hcl_cnode_t* hcl_makecnodetrue (hcl_t* hcl, const hcl_loc_t* loc, const hcl_oocs_t* tok);
hcl_cnode_t* hcl_makecnodefalse (hcl_t* hcl, const hcl_loc_t* loc, const hcl_oocs_t* tok);
hcl_cnode_t* hcl_makecnodeself (hcl_t* hcl, const hcl_loc_t* loc, const hcl_oocs_t* tok);
hcl_cnode_t* hcl_makecnodesuper (hcl_t* hcl, const hcl_loc_t* loc, const hcl_oocs_t* tok);
hcl_cnode_t* hcl_makecnodeellipsis (hcl_t* hcl, const hcl_loc_t* loc, const hcl_oocs_t* tok);
hcl_cnode_t* hcl_makecnodetrpcolons (hcl_t* hcl, const hcl_loc_t* loc, const hcl_oocs_t* tok);
hcl_cnode_t* hcl_makecnodedcstar (hcl_t* hcl, const hcl_loc_t* loc, const hcl_oocs_t* tok);
hcl_cnode_t* hcl_makecnodecharlit (hcl_t* hcl, const hcl_loc_t* loc, const hcl_oocs_t* tok, const hcl_ooch_t v);
hcl_cnode_t* hcl_makecnodesymbol (hcl_t* hcl, const hcl_loc_t* loc, const hcl_oocs_t* tok);
hcl_cnode_t* hcl_makecnodedsymbol (hcl_t* hcl, const hcl_loc_t* loc, const hcl_oocs_t* tok);
hcl_cnode_t* hcl_makecnodestrlit (hcl_t* hcl, const hcl_loc_t* loc, const hcl_oocs_t* tok);
hcl_cnode_t* hcl_makecnodenumlit (hcl_t* hcl, const hcl_loc_t* loc, const hcl_oocs_t* tok);
hcl_cnode_t* hcl_makecnoderadnumlit (hcl_t* hcl, const hcl_loc_t* loc, const hcl_oocs_t* tok);
hcl_cnode_t* hcl_makecnodefpdeclit (hcl_t* hcl, const hcl_loc_t* loc, const hcl_oocs_t* tok);
hcl_cnode_t* hcl_makecnodesmptrlit (hcl_t* hcl, const hcl_loc_t* loc, const hcl_oocs_t* tok, hcl_oow_t v);
hcl_cnode_t* hcl_makecnodeerrlit (hcl_t* hcl, const hcl_loc_t* loc, const hcl_oocs_t* tok, hcl_ooi_t v);
hcl_cnode_t* hcl_makecnodecons (hcl_t* hcl, const hcl_loc_t* loc, hcl_cnode_t* car, hcl_cnode_t* cdr);
hcl_cnode_t* hcl_makecnodeelist (hcl_t* hcl, const hcl_loc_t* loc, hcl_concode_t type);
hcl_cnode_t* hcl_makecnodeshell (hcl_t* hcl, const hcl_loc_t* loc, hcl_cnode_t* obj);
void hcl_freesinglecnode (hcl_t* hcl, hcl_cnode_t* c);
hcl_oow_t hcl_countcnodecons (hcl_t* hcl, hcl_cnode_t* cons);

View File

@ -129,7 +129,7 @@ struct hcl_server_proto_token_t
hcl_ooch_t* ptr;
hcl_oow_t len;
hcl_oow_t capa;
hcl_ioloc_t loc;
hcl_loc_t loc;
};
enum hcl_server_proto_req_state_t
@ -150,9 +150,9 @@ struct hcl_server_proto_t
hcl_server_worker_t* worker;
hcl_t* hcl;
hcl_iolxc_t* lxc;
hcl_lxc_t* lxc;
hcl_oow_t unread_count;
hcl_iolxc_t unread_lxc;
hcl_lxc_t unread_lxc;
hcl_server_proto_token_t tok;
hcl_tmr_index_t exec_runtime_event_index;
@ -316,7 +316,7 @@ static const hcl_bch_t* get_base_name (const hcl_bch_t* path)
}
static HCL_INLINE int open_read_stream (hcl_t* hcl, hcl_iosrarg_t* arg)
static HCL_INLINE int open_read_stream (hcl_t* hcl, hcl_io_sciarg_t* arg)
{
worker_hcl_xtn_t* xtn = (worker_hcl_xtn_t*)hcl_getxtn(hcl);
bb_t* bb = HCL_NULL;
@ -412,7 +412,7 @@ oops:
return -1;
}
static HCL_INLINE int close_read_stream (hcl_t* hcl, hcl_iosrarg_t* arg)
static HCL_INLINE int close_read_stream (hcl_t* hcl, hcl_io_sciarg_t* arg)
{
worker_hcl_xtn_t* xtn = (worker_hcl_xtn_t*)hcl_getxtn(hcl);
bb_t* bb;
@ -427,7 +427,7 @@ static HCL_INLINE int close_read_stream (hcl_t* hcl, hcl_iosrarg_t* arg)
return 0;
}
static HCL_INLINE int read_input (hcl_t* hcl, hcl_iosrarg_t* arg)
static HCL_INLINE int read_input (hcl_t* hcl, hcl_io_sciarg_t* arg)
{
worker_hcl_xtn_t* xtn = (worker_hcl_xtn_t*)hcl_getxtn(hcl);
bb_t* bb;
@ -540,18 +540,18 @@ start_over:
}
static int read_handler (hcl_t* hcl, hcl_iocmd_t cmd, void* arg)
static int read_handler (hcl_t* hcl, hcl_io_cmd_t cmd, void* arg)
{
switch (cmd)
{
case HCL_IO_OPEN:
return open_read_stream(hcl, (hcl_iosrarg_t*)arg);
return open_read_stream(hcl, (hcl_io_sciarg_t*)arg);
case HCL_IO_CLOSE:
return close_read_stream(hcl, (hcl_iosrarg_t*)arg);
return close_read_stream(hcl, (hcl_io_sciarg_t*)arg);
case HCL_IO_READ:
return read_input(hcl, (hcl_iosrarg_t*)arg);
return read_input(hcl, (hcl_io_sciarg_t*)arg);
default:
hcl_seterrnum (hcl, HCL_EINTERN);
@ -559,7 +559,7 @@ static int read_handler (hcl_t* hcl, hcl_iocmd_t cmd, void* arg)
}
}
static int print_handler (hcl_t* hcl, hcl_iocmd_t cmd, void* arg)
static int print_handler (hcl_t* hcl, hcl_io_cmd_t cmd, void* arg)
{
switch (cmd)
{
@ -572,7 +572,7 @@ static int print_handler (hcl_t* hcl, hcl_iocmd_t cmd, void* arg)
case HCL_IO_WRITE:
{
worker_hcl_xtn_t* xtn = (worker_hcl_xtn_t*)hcl_getxtn(hcl);
hcl_iooutarg_t* outarg = (hcl_iooutarg_t*)arg;
hcl_io_outarg_t* outarg = (hcl_io_outarg_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_iocmd_t cmd, void* arg)
case HCL_IO_WRITE_BYTES:
{
worker_hcl_xtn_t* xtn = (worker_hcl_xtn_t*)hcl_getxtn(hcl);
hcl_iooutarg_t* outarg = (hcl_iooutarg_t*)arg;
hcl_io_outarg_t* outarg = (hcl_io_outarg_t*)arg;
if (hcl_server_proto_feed_reply_bytes(xtn->proto, outarg->ptr, outarg->len, 0) <= -1)
{

View File

@ -1192,7 +1192,7 @@ typedef struct hcl_vmprim_t hcl_vmprim_t;
* IO MANIPULATION
* ========================================================================= */
enum hcl_iocmd_t
enum hcl_io_cmd_t
{
HCL_IO_OPEN,
HCL_IO_CLOSE,
@ -1201,25 +1201,25 @@ enum hcl_iocmd_t
HCL_IO_WRITE_BYTES,
HCL_IO_FLUSH
};
typedef enum hcl_iocmd_t hcl_iocmd_t;
typedef enum hcl_io_cmd_t hcl_io_cmd_t;
struct hcl_ioloc_t
struct hcl_loc_t
{
hcl_oow_t line; /**< line */
hcl_oow_t colm; /**< column */
const hcl_ooch_t* file; /**< file specified in #include */
};
typedef struct hcl_ioloc_t hcl_ioloc_t;
typedef struct hcl_loc_t hcl_loc_t;
struct hcl_iolxc_t
struct hcl_lxc_t
{
hcl_ooci_t c; /**< character */
hcl_ioloc_t l; /**< location */
hcl_loc_t l; /**< location */
};
typedef struct hcl_iolxc_t hcl_iolxc_t;
typedef struct hcl_lxc_t hcl_lxc_t;
typedef struct hcl_iosrarg_t hcl_iosrarg_t;
struct hcl_iosrarg_t
typedef struct hcl_io_sciarg_t hcl_io_sciarg_t;
struct hcl_io_sciarg_t
{
/**
* [IN] I/O object name.
@ -1250,7 +1250,7 @@ struct hcl_iosrarg_t
* [IN] points to the data of the includer. It is #HCL_NULL for the
* main stream.
*/
hcl_iosrarg_t* includer;
hcl_io_sciarg_t* includer;
/*-----------------------------------------------------------------*/
/*----------- from here down, internal use only -------------------*/
@ -1264,12 +1264,12 @@ struct hcl_iosrarg_t
hcl_oow_t colm;
hcl_ooci_t nl;
hcl_iolxc_t lxc;
hcl_lxc_t lxc;
/*-----------------------------------------------------------------*/
};
typedef struct hcl_ioinarg_t hcl_ioinarg_t;
struct hcl_ioinarg_t
typedef struct hcl_io_inarg_t hcl_io_inarg_t;
struct hcl_io_inarg_t
{
/**
* [OUT] I/O handle set by a handler.
@ -1290,8 +1290,8 @@ struct hcl_ioinarg_t
hcl_oow_t xlen;
};
typedef struct hcl_iooutarg_t hcl_iooutarg_t;
struct hcl_iooutarg_t
typedef struct hcl_io_outarg_t hcl_io_outarg_t;
struct hcl_io_outarg_t
{
/**
* [OUT] I/O handle set by a handler.
@ -1322,13 +1322,13 @@ struct hcl_iooutarg_t
};
/**
* The hcl_ioimpl_t type defines a callback function prototype
* The hcl_io_impl_t type defines a callback function prototype
* for I/O operations.
*/
typedef int (*hcl_ioimpl_t) (
typedef int (*hcl_io_impl_t) (
hcl_t* hcl,
hcl_iocmd_t cmd,
void* arg /* hcl_iosrarg_t* or hcl_iooutarg_t* */
hcl_io_cmd_t cmd,
void* arg /* one of hcl_io_sciarg_t*, hcl_io_inarg_t*, hcl_io_outarg_t* */
);
/* =========================================================================
@ -1463,7 +1463,7 @@ typedef struct hcl_synerr_t hcl_synerr_t;
struct hcl_synerr_t
{
hcl_synerrnum_t num;
hcl_ioloc_t loc;
hcl_loc_t loc;
struct
{
hcl_ooch_t val[256];
@ -1750,12 +1750,12 @@ struct hcl_t
struct
{
/* input handler */
hcl_ioimpl_t scanner;
hcl_ioinarg_t inarg;
hcl_io_impl_t scanner;
hcl_io_inarg_t inarg;
/* output handler */
hcl_ioimpl_t printer;
hcl_iooutarg_t outarg;
hcl_io_impl_t printer;
hcl_io_outarg_t outarg;
} io;
#if defined(HCL_INCLUDE_COMPILER)
@ -2229,7 +2229,7 @@ HCL_EXPORT void hcl_setbasesrloc (
/* if you should read charcters from the input stream before hcl_read(),
* you can call hcl_readbasesrchar() */
HCL_EXPORT hcl_iolxc_t* hcl_readbasesrchar (
HCL_EXPORT hcl_lxc_t* hcl_readbasesrchar (
hcl_t* hcl
);
@ -2242,9 +2242,9 @@ HCL_EXPORT hcl_ooch_t* hcl_readbasesrraw (
HCL_EXPORT int hcl_attachio (
hcl_t* hcl,
hcl_ioimpl_t reader, /* source stream heandler */
hcl_ioimpl_t scanner, /* runtime input stream handler */
hcl_ioimpl_t printer /* runtime output stream handler */
hcl_io_impl_t reader, /* source stream heandler */
hcl_io_impl_t scanner, /* runtime input stream handler */
hcl_io_impl_t printer /* runtime output stream handler */
);
HCL_EXPORT int hcl_attachiostdwithbcstr (
@ -2370,7 +2370,7 @@ HCL_EXPORT hcl_synerrnum_t hcl_getsynerrnum (
HCL_EXPORT void hcl_setsynerrbfmt (
hcl_t* hcl,
hcl_synerrnum_t num,
const hcl_ioloc_t* loc,
const hcl_loc_t* loc,
const hcl_oocs_t* tgt,
const hcl_bch_t* msgfmt,
...
@ -2379,14 +2379,14 @@ HCL_EXPORT void hcl_setsynerrbfmt (
HCL_EXPORT void hcl_setsynerrufmt (
hcl_t* hcl,
hcl_synerrnum_t num,
const hcl_ioloc_t* loc,
const hcl_loc_t* loc,
const hcl_oocs_t* tgt,
const hcl_uch_t* msgfmt,
...
);
#if defined(HCL_HAVE_INLINE)
static HCL_INLINE void hcl_setsynerr (hcl_t* hcl, hcl_synerrnum_t num, const hcl_ioloc_t* loc, const hcl_oocs_t* tgt)
static HCL_INLINE void hcl_setsynerr (hcl_t* hcl, hcl_synerrnum_t num, const hcl_loc_t* loc, const hcl_oocs_t* tgt)
{
hcl_setsynerrbfmt (hcl, num, loc, tgt, HCL_NULL);
}

View File

@ -239,7 +239,7 @@ static hcl_oop_t string_to_num (hcl_t* hcl, hcl_oocs_t* str, int radixed)
return hcl_strtoint(hcl, ptr, end - ptr, base);
}
static hcl_oop_t string_to_fpdec (hcl_t* hcl, hcl_oocs_t* str, const hcl_ioloc_t* loc)
static hcl_oop_t string_to_fpdec (hcl_t* hcl, hcl_oocs_t* str, const hcl_loc_t* loc)
{
hcl_oow_t pos;
hcl_oow_t scale = 0;
@ -417,14 +417,14 @@ static HCL_INLINE int add_token_char (hcl_t* hcl, hcl_ooch_t c)
return copy_string_to(hcl, &tmp, TOKEN_NAME(hcl), &TOKEN_NAME_CAPA(hcl), 1, '\0');
}
static HCL_INLINE void unget_char (hcl_t* hcl, const hcl_iolxc_t* c)
static HCL_INLINE void unget_char (hcl_t* hcl, const hcl_lxc_t* c)
{
/* Make sure that the unget buffer is large enough */
HCL_ASSERT (hcl, hcl->c->nungots < HCL_COUNTOF(hcl->c->ungot));
hcl->c->ungot[hcl->c->nungots++] = *c;
}
static int get_directive_token_type (hcl_t* hcl, hcl_iotok_type_t* tok_type)
static int get_directive_token_type (hcl_t* hcl, hcl_tok_type_t* tok_type)
{
if (does_token_name_match(hcl, VOCA_INCLUDE))
{
@ -440,7 +440,7 @@ static int get_directive_token_type (hcl_t* hcl, hcl_iotok_type_t* tok_type)
return -1;
}
static int _get_char (hcl_t* hcl, hcl_iosrarg_t* inp)
static int _get_char (hcl_t* hcl, hcl_io_sciarg_t* inp)
{
hcl_ooci_t lc;
@ -513,14 +513,14 @@ static int get_char (hcl_t* hcl)
return n;
}
static hcl_iotok_type_t classify_ident_token (hcl_t* hcl, const hcl_oocs_t* v)
static hcl_tok_type_t classify_ident_token (hcl_t* hcl, const hcl_oocs_t* v)
{
hcl_oow_t i;
struct
{
hcl_oow_t len;
hcl_ooch_t name[10];
hcl_iotok_type_t type;
hcl_tok_type_t type;
} tab[] =
{
{ 4, { 'n','u','l','l' }, HCL_IOTOK_NIL },
@ -544,7 +544,7 @@ static int is_sr_name_in_use (hcl_t* hcl, const hcl_ooch_t* sr_name)
* this is very error prone. if there are changes in refernece
* points of this sr_name in the source code, this function also
* must be modifed. */
hcl_iosrarg_t* cur;
hcl_io_sciarg_t* cur;
if (hcl->c->synerr.loc.file == sr_name) return 1;
@ -559,7 +559,7 @@ static int is_sr_name_in_use (hcl_t* hcl, const hcl_ooch_t* sr_name)
static void clear_sr_names (hcl_t* hcl)
{
hcl_iolink_t* cur;
hcl_link_t* cur;
HCL_ASSERT (hcl, hcl->c != HCL_NULL);
@ -573,7 +573,7 @@ static void clear_sr_names (hcl_t* hcl)
static const hcl_ooch_t* add_sr_name (hcl_t* hcl, const hcl_oocs_t* name)
{
hcl_iolink_t* link;
hcl_link_t* link;
hcl_ooch_t* nptr;
/* TODO: make search faster */
@ -585,7 +585,7 @@ static const hcl_ooch_t* add_sr_name (hcl_t* hcl, const hcl_oocs_t* name)
link = link->link;
}
link = (hcl_iolink_t*)hcl_callocmem (hcl, HCL_SIZEOF(*link) + HCL_SIZEOF(hcl_ooch_t) * (name->len + 1));
link = (hcl_link_t*)hcl_callocmem (hcl, HCL_SIZEOF(*link) + HCL_SIZEOF(hcl_ooch_t) * (name->len + 1));
if (HCL_UNLIKELY(!link)) return HCL_NULL;
nptr = (hcl_ooch_t*)(link + 1);
@ -601,7 +601,7 @@ static const hcl_ooch_t* add_sr_name (hcl_t* hcl, const hcl_oocs_t* name)
/* -------------------------------------------------------------------------- */
static HCL_INLINE int enter_list (hcl_t* hcl, const hcl_ioloc_t* loc, int flagv)
static HCL_INLINE int enter_list (hcl_t* hcl, const hcl_loc_t* loc, int flagv)
{
hcl_rstl_t* rstl;
rstl = hcl_callocmem(hcl, HCL_SIZEOF(*rstl));
@ -617,7 +617,7 @@ static HCL_INLINE hcl_cnode_t* leave_list (hcl_t* hcl, int* flagv, int* oldflagv
{
hcl_rstl_t* rstl;
hcl_cnode_t* head;
hcl_ioloc_t loc;
hcl_loc_t loc;
int fv, concode;
/* the stack must not be empty - cannot leave a list without entering it */
@ -878,13 +878,13 @@ static void init_feed (hcl_t* hcl)
static int feed_begin_include (hcl_t* hcl)
{
hcl_iosrarg_t* arg;
hcl_io_sciarg_t* arg;
const hcl_ooch_t* io_name;
io_name = add_sr_name(hcl, TOKEN_NAME(hcl));
if (HCL_UNLIKELY(!io_name)) return -1;
arg = (hcl_iosrarg_t*)hcl_callocmem(hcl, HCL_SIZEOF(*arg));
arg = (hcl_io_sciarg_t*)hcl_callocmem(hcl, HCL_SIZEOF(*arg));
if (HCL_UNLIKELY(!arg)) goto oops;
arg->name = io_name;
@ -900,11 +900,11 @@ static int feed_begin_include (hcl_t* hcl)
goto oops;
}
if (arg->includer == &hcl->c->srarg) /* top-level include */
if (arg->includer == &hcl->c->sciarg) /* top-level include */
{
/* TODO: remove hcl_readbasesrchar() and clean up this part.
* hcl_readbasesrchar(), if called in the middle of feeds,
* updates hcl->c->srarg's line and colm. so use a separate
* updates hcl->c->sciarg's line and colm. so use a separate
* field to store the current feed location for now */
hcl->c->feed.lx._oloc = hcl->c->feed.lx.loc;
}
@ -932,9 +932,9 @@ oops:
static int feed_end_include (hcl_t* hcl)
{
int x;
hcl_iosrarg_t* cur;
hcl_io_sciarg_t* cur;
if (hcl->c->curinp == &hcl->c->srarg) return 0; /* no include */
if (hcl->c->curinp == &hcl->c->sciarg) return 0; /* no include */
/* if it is an included file, close it and
* retry to read a character from an outer file */
@ -948,7 +948,7 @@ static int feed_end_include (hcl_t* hcl)
cur = hcl->c->curinp;
hcl->c->curinp = hcl->c->curinp->includer;
if (hcl->c->curinp == &hcl->c->srarg)
if (hcl->c->curinp == &hcl->c->sciarg)
{
hcl->c->feed.lx.loc = hcl->c->feed.lx._oloc;
}
@ -1394,7 +1394,7 @@ struct delim_token_t
{
const char* t_value;
hcl_oow_t t_len;
hcl_iotok_type_t t_type;
hcl_tok_type_t t_type;
};
typedef struct delim_token_t delim_token_t;
@ -1458,7 +1458,7 @@ static int find_delim_token_char (hcl_t* hcl, const hcl_ooci_t c, int row_start,
return found;
}
static HCL_INLINE int feed_wrap_up (hcl_t* hcl, hcl_iotok_type_t type)
static HCL_INLINE int feed_wrap_up (hcl_t* hcl, hcl_tok_type_t type)
{
int n;
SET_TOKEN_TYPE (hcl, type);
@ -1469,13 +1469,13 @@ static HCL_INLINE int feed_wrap_up (hcl_t* hcl, hcl_iotok_type_t type)
return n;
}
static int feed_wrap_up_with_char (hcl_t* hcl, hcl_ooci_t c, hcl_iotok_type_t type)
static int feed_wrap_up_with_char (hcl_t* hcl, hcl_ooci_t c, hcl_tok_type_t type)
{
ADD_TOKEN_CHAR (hcl, c);
return feed_wrap_up(hcl, type);
}
static int feed_wrap_up_with_str (hcl_t* hcl, const hcl_ooch_t* str, hcl_oow_t len, hcl_iotok_type_t type)
static int feed_wrap_up_with_str (hcl_t* hcl, const hcl_ooch_t* str, hcl_oow_t len, hcl_tok_type_t type)
{
ADD_TOKEN_STR (hcl, str, len);
return feed_wrap_up(hcl, type);
@ -1526,7 +1526,7 @@ static HCL_INLINE void init_flx_hi (hcl_flx_hi_t* hi)
HCL_MEMSET (hi, 0, HCL_SIZEOF(*hi));
}
static HCL_INLINE void init_flx_hn (hcl_flx_hn_t* hn, hcl_iotok_type_t tok_type, hcl_synerrnum_t synerr_code, int radix)
static HCL_INLINE void init_flx_hn (hcl_flx_hn_t* hn, hcl_tok_type_t tok_type, hcl_synerrnum_t synerr_code, int radix)
{
HCL_MEMSET (hn, 0, HCL_SIZEOF(*hn));
hn->tok_type = tok_type;
@ -1534,7 +1534,7 @@ static HCL_INLINE void init_flx_hn (hcl_flx_hn_t* hn, hcl_iotok_type_t tok_type,
hn->radix = radix;
}
static HCL_INLINE void init_flx_qt (hcl_flx_qt_t* qt, hcl_iotok_type_t tok_type, hcl_synerrnum_t synerr_code, hcl_ooch_t end_char, hcl_ooch_t esc_char, hcl_oow_t min_len, hcl_oow_t max_len)
static HCL_INLINE void init_flx_qt (hcl_flx_qt_t* qt, hcl_tok_type_t tok_type, hcl_synerrnum_t synerr_code, hcl_ooch_t end_char, hcl_ooch_t esc_char, hcl_oow_t min_len, hcl_oow_t max_len)
{
HCL_MEMSET (qt, 0, HCL_SIZEOF(*qt));
qt->tok_type = tok_type;
@ -1880,7 +1880,7 @@ static int flx_hmarked_ident (hcl_t* hcl, hcl_ooci_t c)
if (is_delimchar(c))
{
hcl_iotok_type_t tok_type;
hcl_tok_type_t tok_type;
if (hi->char_count == 0)
{
@ -1932,7 +1932,7 @@ static int flx_hmarked_number (hcl_t* hcl, hcl_ooci_t c)
else if (rn->invalid_digit_count > 0)
{
/* invalid as a radixed number, but this could be a hash-marked directive */
hcl_iotok_type_t tok_type;
hcl_tok_type_t tok_type;
if (get_directive_token_type(hcl, &tok_type) <= -1)
{
@ -1981,7 +1981,7 @@ static int flx_plain_ident (hcl_t* hcl, hcl_ooci_t c) /* identifier */
{
hcl_oow_t start;
hcl_oocs_t seg;
hcl_iotok_type_t tok_type;
hcl_tok_type_t tok_type;
if (pi->seg_len == 0)
{
@ -2365,7 +2365,7 @@ static int feed_from_includee (hcl_t* hcl)
{
int x;
HCL_ASSERT (hcl, hcl->c->curinp != HCL_NULL && hcl->c->curinp != &hcl->c->srarg);
HCL_ASSERT (hcl, hcl->c->curinp != HCL_NULL && hcl->c->curinp != &hcl->c->sciarg);
do
{
@ -2406,7 +2406,7 @@ static int feed_from_includee (hcl_t* hcl)
if (feed_begin_include(hcl) <= -1) return -1;
}
}
while (hcl->c->curinp != &hcl->c->srarg);
while (hcl->c->curinp != &hcl->c->sciarg);
return 0;
}
@ -2465,7 +2465,7 @@ int hcl_feed (hcl_t* hcl, const hcl_ooch_t* data, hcl_oow_t len)
hcl->c->feed.rd.do_include_file = 0;
}
if (hcl->c->curinp && hcl->c->curinp != &hcl->c->srarg && feed_from_includee(hcl) <= -1)
if (hcl->c->curinp && hcl->c->curinp != &hcl->c->sciarg && feed_from_includee(hcl) <= -1)
{
/* TODO: return the number of processed characters via an argument? */
goto oops;
@ -2786,13 +2786,13 @@ static int init_compiler (hcl_t* hcl)
return 0;
}
int hcl_attachio (hcl_t* hcl, hcl_ioimpl_t reader, hcl_ioimpl_t scanner, hcl_ioimpl_t printer)
int hcl_attachio (hcl_t* hcl, hcl_io_impl_t reader, hcl_io_impl_t scanner, hcl_io_impl_t printer)
{
int n;
int inited_compiler = 0;
hcl_iosrarg_t new_srarg;
hcl_ioinarg_t new_inarg;
hcl_iooutarg_t new_outarg;
hcl_io_sciarg_t new_sciarg;
hcl_io_inarg_t new_inarg;
hcl_io_outarg_t new_outarg;
if (!hcl->c)
{
@ -2804,12 +2804,12 @@ int hcl_attachio (hcl_t* hcl, hcl_ioimpl_t reader, hcl_ioimpl_t scanner, hcl_ioi
{
/* The name field and the includer field are HCL_NULL
* for the main stream */
HCL_MEMSET (&new_srarg, 0, HCL_SIZEOF(new_srarg));
new_srarg.line = 1;
new_srarg.colm = 1;
HCL_MEMSET (&new_sciarg, 0, HCL_SIZEOF(new_sciarg));
new_sciarg.line = 1;
new_sciarg.colm = 1;
/* open the top-level source input stream */
n = reader(hcl, HCL_IO_OPEN, &new_srarg);
n = reader(hcl, HCL_IO_OPEN, &new_sciarg);
if (n <= -1) goto oops;
}
@ -2819,7 +2819,7 @@ int hcl_attachio (hcl_t* hcl, hcl_ioimpl_t reader, hcl_ioimpl_t scanner, hcl_ioi
n = scanner(hcl, HCL_IO_OPEN, &new_inarg);
if (n <= -1)
{
reader (hcl, HCL_IO_CLOSE, &new_srarg);
reader (hcl, HCL_IO_CLOSE, &new_sciarg);
goto oops;
}
}
@ -2832,7 +2832,7 @@ int hcl_attachio (hcl_t* hcl, hcl_ioimpl_t reader, hcl_ioimpl_t scanner, hcl_ioi
if (n <= -1)
{
if (scanner) scanner (hcl, HCL_IO_CLOSE, &new_inarg);
if (reader) reader (hcl, HCL_IO_CLOSE, &new_srarg);
if (reader) reader (hcl, HCL_IO_CLOSE, &new_sciarg);
goto oops;
}
}
@ -2842,10 +2842,10 @@ int hcl_attachio (hcl_t* hcl, hcl_ioimpl_t reader, hcl_ioimpl_t scanner, hcl_ioi
if (hcl->c->reader)
{
/* close the old source input stream */
hcl->c->reader (hcl, HCL_IO_CLOSE, &hcl->c->srarg);
hcl->c->reader (hcl, HCL_IO_CLOSE, &hcl->c->sciarg);
}
hcl->c->reader = reader;
hcl->c->srarg = new_srarg;
hcl->c->sciarg = new_sciarg;
}
if (scanner)
@ -2878,7 +2878,7 @@ int hcl_attachio (hcl_t* hcl, hcl_ioimpl_t reader, hcl_ioimpl_t scanner, hcl_ioi
/* initialize some other key fields */
hcl->c->nungots = 0;
/* the source stream is open. set it as the current input stream */
hcl->c->curinp = &hcl->c->srarg;
hcl->c->curinp = &hcl->c->sciarg;
}
return 0;
@ -2903,9 +2903,9 @@ void hcl_detachio (hcl_t* hcl)
{
if (hcl->c->reader)
{
while (hcl->c->curinp != &hcl->c->srarg)
while (hcl->c->curinp != &hcl->c->sciarg)
{
hcl_iosrarg_t* prev;
hcl_io_sciarg_t* prev;
/* nothing much to do about a close error */
hcl->c->reader (hcl, HCL_IO_CLOSE, hcl->c->curinp);
@ -2937,18 +2937,18 @@ void hcl_detachio (hcl_t* hcl)
void hcl_setbasesrloc (hcl_t* hcl, hcl_oow_t line, hcl_oow_t colm)
{
hcl->c->srarg.line = line;
hcl->c->srarg.colm = colm;
hcl->c->sciarg.line = line;
hcl->c->sciarg.colm = colm;
}
hcl_iolxc_t* hcl_readbasesrchar (hcl_t* hcl)
hcl_lxc_t* hcl_readbasesrchar (hcl_t* hcl)
{
/* read a character using the base input stream. the caller must care extra
* care when using this function. this function reads the main stream regardless
* of the inclusion status and ignores the ungot characters. */
int n = _get_char(hcl, &hcl->c->srarg);
int n = _get_char(hcl, &hcl->c->sciarg);
if (n <= -1) return HCL_NULL;
return &hcl->c->srarg.lxc;
return &hcl->c->sciarg.lxc;
}
hcl_ooch_t* hcl_readbasesrraw (hcl_t* hcl, hcl_oow_t* xlen)
@ -2959,7 +2959,7 @@ hcl_ooch_t* hcl_readbasesrraw (hcl_t* hcl, hcl_oow_t* xlen)
HCL_ASSERT (hcl, hcl->c != HCL_NULL); /* call hio_attachio() or hio_attachiostd() with proper arguments first */
if (hcl->c->reader(hcl, HCL_IO_READ, &hcl->c->srarg) <= -1) return HCL_NULL;
*xlen = hcl->c->srarg.xlen;
return hcl->c->srarg.buf;
if (hcl->c->reader(hcl, HCL_IO_READ, &hcl->c->sciarg) <= -1) return HCL_NULL;
*xlen = hcl->c->sciarg.xlen;
return hcl->c->sciarg.buf;
}

View File

@ -3200,7 +3200,7 @@ static const hcl_bch_t* get_base_name (const hcl_bch_t* path)
return (last == HCL_NULL)? path: (last + 1);
}
static HCL_INLINE int open_sin_stream (hcl_t* hcl, hcl_iosrarg_t* arg)
static HCL_INLINE int open_sci_stream (hcl_t* hcl, hcl_io_sciarg_t* arg)
{
xtn_t* xtn = GET_XTN(hcl);
bb_t* bb = HCL_NULL;
@ -3282,7 +3282,7 @@ static HCL_INLINE int open_sin_stream (hcl_t* hcl, hcl_iosrarg_t* arg)
arg->name = hcl_dupbtooocstr(hcl, bb->fn, HCL_NULL);
/* ignore duplication failure */
/* TODO: change the type of arg->name from const hcl_ooch_t* to hcl_ooch_t*.
* change its specification from [IN] only to [INOUT] in hcl_iosrarg_t. */
* change its specification from [IN] only to [INOUT] in hcl_io_sciarg_t. */
/* END HACK */
}
@ -3298,7 +3298,7 @@ oops:
return -1;
}
static HCL_INLINE int close_sin_stream (hcl_t* hcl, hcl_iosrarg_t* arg)
static HCL_INLINE int close_sci_stream (hcl_t* hcl, hcl_io_sciarg_t* arg)
{
/*xtn_t* xtn = GET_XTN(hcl);*/
bb_t* bb;
@ -3321,7 +3321,7 @@ static HCL_INLINE int close_sin_stream (hcl_t* hcl, hcl_iosrarg_t* arg)
return 0;
}
static HCL_INLINE int read_sin_stream (hcl_t* hcl, hcl_iosrarg_t* arg)
static HCL_INLINE int read_sci_stream (hcl_t* hcl, hcl_io_sciarg_t* arg)
{
/*xtn_t* xtn = GET_XTN(hcl);*/
bb_t* bb;
@ -3371,19 +3371,19 @@ static HCL_INLINE int read_sin_stream (hcl_t* hcl, hcl_iosrarg_t* arg)
return 0;
}
/* source input stream handler */
static int sin_handler (hcl_t* hcl, hcl_iocmd_t cmd, void* arg)
/* source code input handler */
static int sci_handler (hcl_t* hcl, hcl_io_cmd_t cmd, void* arg)
{
switch (cmd)
{
case HCL_IO_OPEN:
return open_sin_stream(hcl, (hcl_iosrarg_t*)arg);
return open_sci_stream(hcl, (hcl_io_sciarg_t*)arg);
case HCL_IO_CLOSE:
return close_sin_stream(hcl, (hcl_iosrarg_t*)arg);
return close_sci_stream(hcl, (hcl_io_sciarg_t*)arg);
case HCL_IO_READ:
return read_sin_stream(hcl, (hcl_iosrarg_t*)arg);
return read_sci_stream(hcl, (hcl_io_sciarg_t*)arg);
case HCL_IO_FLUSH:
/* no effect on an input stream */
@ -3396,7 +3396,7 @@ static int sin_handler (hcl_t* hcl, hcl_iocmd_t cmd, void* arg)
}
/* --------------------------------------------------------------------- */
static HCL_INLINE int open_in_stream (hcl_t* hcl, hcl_ioinarg_t* arg)
static HCL_INLINE int open_in_stream (hcl_t* hcl, hcl_io_inarg_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_ioinarg_t* arg)
static HCL_INLINE int close_in_stream (hcl_t* hcl, hcl_io_inarg_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_ioinarg_t* arg)
return 0;
}
static HCL_INLINE int read_in_stream (hcl_t* hcl, hcl_ioinarg_t* arg)
static HCL_INLINE int read_in_stream (hcl_t* hcl, hcl_io_inarg_t* arg)
{
/*xtn_t* xtn = GET_XTN(hcl);*/
bb_t* bb;
@ -3503,18 +3503,18 @@ static HCL_INLINE int read_in_stream (hcl_t* hcl, hcl_ioinarg_t* arg)
return 0;
}
static int scan_handler (hcl_t* hcl, hcl_iocmd_t cmd, void* arg)
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_ioinarg_t*)arg);
return open_in_stream(hcl, (hcl_io_inarg_t*)arg);
case HCL_IO_CLOSE:
return close_in_stream(hcl, (hcl_ioinarg_t*)arg);
return close_in_stream(hcl, (hcl_io_inarg_t*)arg);
case HCL_IO_READ:
return read_in_stream(hcl, (hcl_ioinarg_t*)arg);
return read_in_stream(hcl, (hcl_io_inarg_t*)arg);
case HCL_IO_FLUSH:
/* no effect on an input stream */
@ -3528,7 +3528,7 @@ static int scan_handler (hcl_t* hcl, hcl_iocmd_t cmd, void* arg)
/* --------------------------------------------------------------------- */
static HCL_INLINE int open_out_stream (hcl_t* hcl, hcl_iooutarg_t* arg)
static HCL_INLINE int open_out_stream (hcl_t* hcl, hcl_io_outarg_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_iooutarg_t* arg)
return 0;
}
static HCL_INLINE int close_out_stream (hcl_t* hcl, hcl_iooutarg_t* arg)
static HCL_INLINE int close_out_stream (hcl_t* hcl, hcl_io_outarg_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_iooutarg_t* arg)
return 0;
}
static HCL_INLINE int write_out_stream (hcl_t* hcl, hcl_iooutarg_t* arg)
static HCL_INLINE int write_out_stream (hcl_t* hcl, hcl_io_outarg_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_iooutarg_t* arg)
return 0;
}
static HCL_INLINE int write_bytes_out_stream (hcl_t* hcl, hcl_iooutarg_t* arg)
static HCL_INLINE int write_bytes_out_stream (hcl_t* hcl, hcl_io_outarg_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_iooutarg_t* arg)
return 0;
}
static HCL_INLINE int flush_out_stream (hcl_t* hcl, hcl_iooutarg_t* arg)
static HCL_INLINE int flush_out_stream (hcl_t* hcl, hcl_io_outarg_t* arg)
{
FILE* fp;
@ -3632,24 +3632,24 @@ static HCL_INLINE int flush_out_stream (hcl_t* hcl, hcl_iooutarg_t* arg)
return 0;
}
static int print_handler (hcl_t* hcl, hcl_iocmd_t cmd, void* arg)
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_iooutarg_t*)arg);
return open_out_stream(hcl, (hcl_io_outarg_t*)arg);
case HCL_IO_CLOSE:
return close_out_stream(hcl, (hcl_iooutarg_t*)arg);
return close_out_stream(hcl, (hcl_io_outarg_t*)arg);
case HCL_IO_WRITE:
return write_out_stream(hcl, (hcl_iooutarg_t*)arg);
return write_out_stream(hcl, (hcl_io_outarg_t*)arg);
case HCL_IO_WRITE_BYTES:
return write_bytes_out_stream(hcl, (hcl_iooutarg_t*)arg);
return write_bytes_out_stream(hcl, (hcl_io_outarg_t*)arg);
case HCL_IO_FLUSH:
return flush_out_stream(hcl, (hcl_iooutarg_t*)arg);
return flush_out_stream(hcl, (hcl_io_outarg_t*)arg);
default:
hcl_seterrnum (hcl, HCL_EINTERN);
@ -3672,7 +3672,7 @@ int hcl_attachiostdwithbcstr (hcl_t* hcl, const hcl_bch_t* read_file, const hcl_
xtn->scan_path = scan_file;
xtn->print_path = print_file;
n = hcl_attachio(hcl, sin_handler, scan_handler, print_handler);
n = hcl_attachio(hcl, sci_handler, scan_handler, print_handler);
xtn->read_path = HCL_NULL;
xtn->scan_path = HCL_NULL;
@ -3711,7 +3711,7 @@ int hcl_attachiostdwithucstr (hcl_t* hcl, const hcl_uch_t* read_file, const hcl_
return -1;
}
n = hcl_attachio(hcl, sin_handler, scan_handler, print_handler);
n = hcl_attachio(hcl, sci_handler, scan_handler, print_handler);
hcl_freemem (hcl, (void*)xtn->read_path);
hcl_freemem (hcl, (void*)xtn->scan_path);