changing read2.c
This commit is contained in:
parent
963f162c4e
commit
ad4c8e35d4
18
lib/cnode.c
18
lib/cnode.c
@ -7,10 +7,10 @@
|
|||||||
modification, are permitted provided that the following conditions
|
modification, are permitted provided that the following conditions
|
||||||
are met:
|
are met:
|
||||||
1. Redistributions of source code must retain the above copyright
|
1. Redistributions of source code must retain the above copyright
|
||||||
notice, this list of conditions and the following disclaimer.
|
notice, this list of conditions and the following disclaimer.
|
||||||
2. Redistributions in binary form must reproduce the above copyright
|
2. Redistributions in binary form must reproduce the above copyright
|
||||||
notice, this list of conditions and the following disclaimer in the
|
notice, this list of conditions and the following disclaimer in the
|
||||||
documentation and/or other materials provided with the distribution.
|
documentation and/or other materials provided with the distribution.
|
||||||
|
|
||||||
THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR
|
THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR
|
||||||
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||||
@ -38,6 +38,18 @@ static hcl_cnode_t* make_cnode (hcl_t* hcl, hcl_cnode_type_t type, const hcl_iol
|
|||||||
return cnode;
|
return cnode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
hcl_cnode_t* hcl_makecnodersn (hcl_t* hcl, const hcl_ioloc_t* loc)
|
||||||
|
{
|
||||||
|
hcl_cnode_t* cnode;
|
||||||
|
cnode = make_cnode(hcl, loc);
|
||||||
|
if (HCL_UNLIKELY(!cnode)) return HCL_NULL;
|
||||||
|
cnode->u.rsn.head = HCL_NULL;
|
||||||
|
cnode->u.rsn.tail = HCL_NULL;
|
||||||
|
cnode->u.rsn.flags = 0;
|
||||||
|
cnode->u.rsn.rsn_par = HCL_NULL;
|
||||||
|
return cnode;
|
||||||
|
}
|
||||||
|
|
||||||
hcl_cnode_t* hcl_makecnodenil (hcl_t* hcl, const hcl_ioloc_t* loc)
|
hcl_cnode_t* hcl_makecnodenil (hcl_t* hcl, const hcl_ioloc_t* loc)
|
||||||
{
|
{
|
||||||
return make_cnode(hcl, HCL_CNODE_NIL, loc, 0);
|
return make_cnode(hcl, HCL_CNODE_NIL, loc, 0);
|
||||||
|
@ -183,6 +183,8 @@ struct hcl_iolink_t
|
|||||||
|
|
||||||
enum hcl_cnode_type_t
|
enum hcl_cnode_type_t
|
||||||
{
|
{
|
||||||
|
HCL_CNODE_RSN, /* internally used */
|
||||||
|
|
||||||
HCL_CNODE_CHARLIT,
|
HCL_CNODE_CHARLIT,
|
||||||
HCL_CNODE_STRLIT,
|
HCL_CNODE_STRLIT,
|
||||||
HCL_CNODE_NUMLIT,
|
HCL_CNODE_NUMLIT,
|
||||||
@ -226,6 +228,13 @@ struct hcl_cnode_t
|
|||||||
|
|
||||||
union
|
union
|
||||||
{
|
{
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
hcl_cnode_t* head;
|
||||||
|
hcl_cnode_t* tail;
|
||||||
|
hcl_oow_t count;
|
||||||
|
hcl_cnode_t* rsn_par; /* parent item in the stack */
|
||||||
|
} rsn; /* reader stack node */
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
hcl_ooch_t v;
|
hcl_ooch_t v;
|
||||||
@ -1237,6 +1246,7 @@ int hcl_emitbyteinstruction (
|
|||||||
/* ========================================================================= */
|
/* ========================================================================= */
|
||||||
/* cnode.c */
|
/* cnode.c */
|
||||||
/* ========================================================================= */
|
/* ========================================================================= */
|
||||||
|
hcl_cnode_t* hcl_makecnodersn (hcl_t* hcl, const hcl_ioloc_t* loc);
|
||||||
hcl_cnode_t* hcl_makecnodenil (hcl_t* hcl, const hcl_ioloc_t* loc);
|
hcl_cnode_t* hcl_makecnodenil (hcl_t* hcl, const hcl_ioloc_t* loc);
|
||||||
hcl_cnode_t* hcl_makecnodetrue (hcl_t* hcl, const hcl_ioloc_t* loc);
|
hcl_cnode_t* hcl_makecnodetrue (hcl_t* hcl, const hcl_ioloc_t* loc);
|
||||||
hcl_cnode_t* hcl_makecnodefalse (hcl_t* hcl, const hcl_ioloc_t* loc);
|
hcl_cnode_t* hcl_makecnodefalse (hcl_t* hcl, const hcl_ioloc_t* loc);
|
||||||
|
14
lib/read2.c
14
lib/read2.c
@ -13,7 +13,7 @@
|
|||||||
documentation and/or other materials provided with the distribution.
|
documentation and/or other materials provided with the distribution.
|
||||||
|
|
||||||
THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR
|
THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR
|
||||||
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WAfRRANTIES
|
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||||
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||||
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||||
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||||
@ -1405,8 +1405,9 @@ static int end_include (hcl_t* hcl)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static HCL_INLINE hcl_oop_t enter_list (hcl_t* hcl, int flagv)
|
static HCL_INLINE hcl_cnode_t* enter_list (hcl_t* hcl, int flagv)
|
||||||
{
|
{
|
||||||
|
#if 0
|
||||||
hcl_oop_oop_t rsa;
|
hcl_oop_oop_t rsa;
|
||||||
|
|
||||||
/* upon entering a list, it pushes a frame of 4 slots.
|
/* upon entering a list, it pushes a frame of 4 slots.
|
||||||
@ -1426,6 +1427,15 @@ static HCL_INLINE hcl_oop_t enter_list (hcl_t* hcl, int flagv)
|
|||||||
rsa->slot[4] = HCL_SMOOI_TO_OOP(0);
|
rsa->slot[4] = HCL_SMOOI_TO_OOP(0);
|
||||||
|
|
||||||
return hcl->c->r.s;
|
return hcl->c->r.s;
|
||||||
|
#else
|
||||||
|
hcl_cnode_t* rsn;
|
||||||
|
rsn = hcl_makecnodersn(hcl, loc)
|
||||||
|
if (HCL_UNLIKELY(!rsn)) return HCL_NULL
|
||||||
|
rsn->flags = flagv;
|
||||||
|
rsn->rsn_par = hcl->c->r.st; /* push */
|
||||||
|
hcl->c.r.st = rsn;
|
||||||
|
return rsn; /* returns the stack top */
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static HCL_INLINE hcl_oop_t leave_list (hcl_t* hcl, int* flagv, int* oldflagv)
|
static HCL_INLINE hcl_oop_t leave_list (hcl_t* hcl, int* flagv, int* oldflagv)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user