added hcl_setinloc() and called this on each .SCRIPT command received in the server
This commit is contained in:
parent
9a1b20a47d
commit
7c886ae2e3
@ -757,7 +757,7 @@ static void* dl_open (hcl_t* hcl, const hcl_ooch_t* name, int flags)
|
|||||||
if (!bufptr) return HCL_NULL;
|
if (!bufptr) return HCL_NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flags & HCL_VMPRIM_OPENDL_PFMOD)
|
if (flags & HCL_VMPRIM_DLOPEN_PFMOD)
|
||||||
{
|
{
|
||||||
hcl_oow_t len, i, xlen;
|
hcl_oow_t len, i, xlen;
|
||||||
|
|
||||||
@ -1671,11 +1671,11 @@ static void reformat_synerr (hcl_t* hcl)
|
|||||||
orgmsg = hcl_backuperrmsg(hcl);
|
orgmsg = hcl_backuperrmsg(hcl);
|
||||||
hcl_seterrbfmt (
|
hcl_seterrbfmt (
|
||||||
hcl, HCL_ESYNERR,
|
hcl, HCL_ESYNERR,
|
||||||
"%js%s%.*js at line %lu",
|
"%js%s%.*js at line %zu column %zu",
|
||||||
orgmsg,
|
orgmsg,
|
||||||
(synerr.tgt.len > 0? " near ": ""),
|
(synerr.tgt.len > 0? " near ": ""),
|
||||||
synerr.tgt.len, synerr.tgt.ptr,
|
synerr.tgt.len, synerr.tgt.ptr,
|
||||||
(unsigned long int)synerr.loc.line
|
synerr.loc.line, synerr.loc.colm
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1765,6 +1765,8 @@ int hcl_server_proto_handle_request (hcl_server_proto_t* proto)
|
|||||||
hcl_oop_t obj;
|
hcl_oop_t obj;
|
||||||
hcl_ooci_t c;
|
hcl_ooci_t c;
|
||||||
|
|
||||||
|
hcl_setinloc (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 */
|
||||||
GET_CHAR_TO_WITH_GOTO (proto, c, fail_with_errmsg);
|
GET_CHAR_TO_WITH_GOTO (proto, c, fail_with_errmsg);
|
||||||
|
21
lib/hcl.c
21
lib/hcl.c
@ -286,22 +286,11 @@ void hcl_fini (hcl_t* hcl)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void hcl_reset (hcl_t* hcl/*, int flags*/)
|
void hcl_reset (hcl_t* hcl)
|
||||||
{
|
{
|
||||||
hcl_oop_t v;
|
hcl_oop_t v;
|
||||||
hcl_oow_t i;
|
hcl_oow_t i;
|
||||||
|
|
||||||
#if 0
|
|
||||||
if (flags & HCL_RESET_LXC)
|
|
||||||
{
|
|
||||||
hcl->c->nungots = 0;
|
|
||||||
|
|
||||||
hcl->c->inarg.line = 1;
|
|
||||||
hcl->c->inarg.colm = 1;
|
|
||||||
/* reset on curinp???? hwo to reset the input stream? or crate a separate function? */
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* delete all literals shown in the literal frame from the system dictionary
|
/* delete all literals shown in the literal frame from the system dictionary
|
||||||
* excluding special kernel symbols. */
|
* excluding special kernel symbols. */
|
||||||
for (i = 0; i < hcl->code.lit.len; i++)
|
for (i = 0; i < hcl->code.lit.len; i++)
|
||||||
@ -323,6 +312,12 @@ void hcl_reset (hcl_t* hcl/*, int flags*/)
|
|||||||
hcl_gc (hcl);
|
hcl_gc (hcl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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)
|
||||||
{
|
{
|
||||||
switch (id)
|
switch (id)
|
||||||
@ -618,7 +613,7 @@ hcl_mod_data_t* hcl_openmod (hcl_t* hcl, const hcl_ooch_t* name, hcl_oow_t namel
|
|||||||
hcl_copy_oochars((hcl_ooch_t*)md.mod.name, name, namelen);
|
hcl_copy_oochars((hcl_ooch_t*)md.mod.name, name, namelen);
|
||||||
if (hcl->vmprim.dl_open && hcl->vmprim.dl_getsym && hcl->vmprim.dl_close)
|
if (hcl->vmprim.dl_open && hcl->vmprim.dl_getsym && hcl->vmprim.dl_close)
|
||||||
{
|
{
|
||||||
md.handle = hcl->vmprim.dl_open(hcl, &buf[MOD_PREFIX_LEN], HCL_VMPRIM_OPENDL_PFMOD);
|
md.handle = hcl->vmprim.dl_open(hcl, &buf[MOD_PREFIX_LEN], HCL_VMPRIM_DLOPEN_PFMOD);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (md.handle == HCL_NULL)
|
if (md.handle == HCL_NULL)
|
||||||
|
20
lib/hcl.h
20
lib/hcl.h
@ -743,11 +743,11 @@ typedef void (*hcl_syserrstru_t) (
|
|||||||
hcl_oow_t len
|
hcl_oow_t len
|
||||||
);
|
);
|
||||||
|
|
||||||
enum hcl_vmprim_opendl_flag_t
|
enum hcl_vmprim_dlopen_flag_t
|
||||||
{
|
{
|
||||||
HCL_VMPRIM_OPENDL_PFMOD = (1 << 0)
|
HCL_VMPRIM_DLOPEN_PFMOD = (1 << 0)
|
||||||
};
|
};
|
||||||
typedef enum hcl_vmprim_opendl_flag_t hcl_vmprim_opendl_flag_t;
|
typedef enum hcl_vmprim_dlopen_flag_t hcl_vmprim_dlopen_flag_t;
|
||||||
|
|
||||||
typedef void* (*hcl_vmprim_dlopen_t) (
|
typedef void* (*hcl_vmprim_dlopen_t) (
|
||||||
hcl_t* hcl,
|
hcl_t* hcl,
|
||||||
@ -818,8 +818,8 @@ typedef enum hcl_iocmd_t hcl_iocmd_t;
|
|||||||
|
|
||||||
struct hcl_ioloc_t
|
struct hcl_ioloc_t
|
||||||
{
|
{
|
||||||
unsigned long int line; /**< line */
|
hcl_oow_t line; /**< line */
|
||||||
unsigned long int colm; /**< column */
|
hcl_oow_t colm; /**< column */
|
||||||
const hcl_ooch_t* file; /**< file specified in #include */
|
const hcl_ooch_t* file; /**< file specified in #include */
|
||||||
};
|
};
|
||||||
typedef struct hcl_ioloc_t hcl_ioloc_t;
|
typedef struct hcl_ioloc_t hcl_ioloc_t;
|
||||||
@ -874,8 +874,8 @@ struct hcl_ioinarg_t
|
|||||||
int state;
|
int state;
|
||||||
} b;
|
} b;
|
||||||
|
|
||||||
unsigned long int line;
|
hcl_oow_t line;
|
||||||
unsigned long int colm;
|
hcl_oow_t colm;
|
||||||
hcl_ooci_t nl;
|
hcl_ooci_t nl;
|
||||||
|
|
||||||
hcl_iolxc_t lxc;
|
hcl_iolxc_t lxc;
|
||||||
@ -1487,6 +1487,12 @@ 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 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; }
|
||||||
static HCL_INLINE void* hcl_getxtn (hcl_t* hcl) { return (void*)(hcl + 1); }
|
static HCL_INLINE void* hcl_getxtn (hcl_t* hcl) { return (void*)(hcl + 1); }
|
||||||
|
@ -788,7 +788,7 @@ static void* dl_open (hcl_t* hcl, const hcl_ooch_t* name, int flags)
|
|||||||
if (!bufptr) return HCL_NULL;
|
if (!bufptr) return HCL_NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flags & HCL_VMPRIM_OPENDL_PFMOD)
|
if (flags & HCL_VMPRIM_DLOPEN_PFMOD)
|
||||||
{
|
{
|
||||||
hcl_oow_t len, i, xlen;
|
hcl_oow_t len, i, xlen;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user