enhanced the compiler and the interface structure to allow an interface as a name space.

enhanced formatted output of namespace, interface, class to include the hierarchy.
changed the pooldic item terminator from a period to a comma
This commit is contained in:
hyunghwan.chung 2019-09-30 08:46:50 +00:00
parent 5bb0fb70b8
commit e145c4742e
16 changed files with 322 additions and 102 deletions

View File

@ -6,19 +6,19 @@ class(#limited) Error(Apex)
{ {
pooldic Code pooldic Code
{ {
ENOERR := #\E0. ENOERR := #\E0,
EGENERIC := #\E1. EGENERIC := #\E1,
ENOIMPL := #\E2. ENOIMPL := #\E2,
ESYSERR := #\E3. ESYSERR := #\E3,
EINTERN := #\E4. EINTERN := #\E4,
ESYSMEM := #\E5. ESYSMEM := #\E5,
EOOMEM := #\E6. EOOMEM := #\E6,
EINVAL := #\E7. EINVAL := #\E7,
ENOENT := #\E8. ENOENT := #\E8,
EPERM := #\E12. EPERM := #\E12,
ERANGE := #\E20. ERANGE := #\E20,
ELIMIT := #\E9999. ELIMIT := #\E9999
// add more items... // add more items...
} }
} }
@ -26,19 +26,19 @@ class(#limited) Error(Apex)
/* /*
pooldic Error.Code pooldic Error.Code
{ {
ENOERR := #\E0. ENOERR := #\E0,
EGENERIC := #\E1. EGENERIC := #\E1,
ENOIMPL := #\E2. ENOIMPL := #\E2,
ESYSERR := #\E3. ESYSERR := #\E3,
EINTERN := #\E4. EINTERN := #\E4,
ESYSMEM := #\E5. ESYSMEM := #\E5,
EOOMEM := #\E6. EOOMEM := #\E6,
EINVAL := #\E7. EINVAL := #\E7,
ENOENT := #\E8. ENOENT := #\E8,
EPERM := #\E12. EPERM := #\E12,
ERANGE := #\E20. ERANGE := #\E20,
ELIMIT := #\E9999. ELIMIT := #\E9999
// add more items... // add more items...
} */ } */
@ -49,7 +49,7 @@ pooldic Error.Code
>> and treat it as if it's a literal like? then even if the defined value changes, >> and treat it as if it's a literal like? then even if the defined value changes,
>> the definition here won't see the change... what is the best way to tackle this issue? >> the definition here won't see the change... what is the best way to tackle this issue?
EGENERIC := Error.Code2.EGENERIC. EGENERIC := Error.Code2.EGENERIC
}*/ }*/
extend Apex extend Apex
@ -332,8 +332,8 @@ extend Error
pooldic/const pooldic/const
{ {
NONE := #\e0. NONE := #\e0,
GENERIC := #\e1. GENERIC := #\e1
} }
-------------------------------- */ -------------------------------- */

View File

@ -47,5 +47,5 @@ class(#pointer,#limited,#uncopyable) Class(Apex) [ClassInterface]
class(#pointer,#limited,#uncopyable) Interface(Apex) class(#pointer,#limited,#uncopyable) Interface(Apex)
{ {
var name. var name.
var instmthdic, classmthdic, nsup. var instmthdic, classmthdic, nsup, nsdic.
} }

View File

@ -203,10 +203,10 @@ extend Context
pooldic MethodContext.Preamble pooldic MethodContext.Preamble
{ {
// this must follow MOO_METHOD_PREAMBLE_EXCEPTION in moo.h // this must follow MOO_METHOD_PREAMBLE_EXCEPTION in moo.h
EXCEPTION := 13. EXCEPTION := 13,
// this must follow MOO_METHOD_PREAMBLE_ENSURE in moo.h // this must follow MOO_METHOD_PREAMBLE_ENSURE in moo.h
ENSURE := 14. ENSURE := 14
} }
pooldic MethodContext.Index pooldic MethodContext.Index
@ -217,10 +217,10 @@ pooldic MethodContext.Index
// instance variables of the method context. As MethodContex has // instance variables of the method context. As MethodContex has
// instance variables, the ensure block must be at the 9th position // instance variables, the ensure block must be at the 9th position
// which translates to index 8 // which translates to index 8
ENSURE := 8. ENSURE := 8,
// [ ... ] on: Exception: do: [:ex | ... ] // [ ... ] on: Exception: do: [:ex | ... ]
FIRST_ON := 8. FIRST_ON := 8
} }
extend MethodContext extend MethodContext

View File

@ -19,15 +19,15 @@ class FFI(Object)
/* /*
pooldic Type pooldic Type
{ {
UINT8 := 1. UINT8 := 1,
UINT16 := 2. UINT16 := 2,
UINT32 := 3. UINT32 := 3,
UINT64 := 4. UINT64 := 4
} }
*/ */
/* /*
const UINT8 := 1. const UINT8 := 1,
const UINT16 := 2. const UINT16 := 2
*/ */
method(#class) new: aString method(#class) new: aString

View File

@ -266,17 +266,17 @@ class Fcgi.ParamRecord(Fcgi.Record)
pooldic Fcgi.Type pooldic Fcgi.Type
{ {
BEGIN_REQUEST := 1. BEGIN_REQUEST := 1,
ABORT_REQUEST := 2. ABORT_REQUEST := 2,
END_REQUEST := 3. END_REQUEST := 3,
PARAMS := 4. PARAMS := 4,
STDIN := 5. STDIN := 5,
STDOUT := 6. STDOUT := 6,
STDERR := 7. STDERR := 7,
DATA := 8. DATA := 8,
GET_VALUES := 9. GET_VALUES := 9,
GET_VALUES_RESULT := 10. GET_VALUES_RESULT := 10,
UNKNOWN_TYPE := 11. UNKNOWN_TYPE := 11
} }
class FcgiConnReg(Object) class FcgiConnReg(Object)

View File

@ -364,7 +364,7 @@ a free.
/* /*
pooldic XXD { pooldic XXD {
#abc := #(1 2 3). #abc := #(1 2 3),
#def := ##( 1, 3, 4 ). // syntax error - literal expected where ##( is #def := ##( 1, 3, 4 ) // syntax error - literal expected where ##( is
} }
*/ */

View File

@ -233,14 +233,14 @@ class Socket(Object) from 'sck'
// TODO: generate these family and type from the C header // TODO: generate these family and type from the C header
pooldic Family pooldic Family
{ {
INET := 2. INET := 2,
INET6 := 10. INET6 := 10
} }
pooldic Type pooldic Type
{ {
STREAM := 1. STREAM := 1,
DGRAM := 2. DGRAM := 2
} }
method(#primitive) open(family, type, proto). method(#primitive) open(family, type, proto).

View File

@ -22,11 +22,11 @@ class System(Apex)
// these items must follow defintions in moo.h // these items must follow defintions in moo.h
// ----------------------------------------------------------- // -----------------------------------------------------------
DEBUG := 1. DEBUG := 1,
INFO := 2. INFO := 2,
WARN := 4. WARN := 4,
ERROR := 8. ERROR := 8,
FATAL := 16. FATAL := 16
} }
method(#class) _initialize method(#class) _initialize

View File

@ -138,20 +138,20 @@ TODO: TODO: compiler enhancement
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
pooldic X11.LLEventType pooldic X11.LLEventType
{ {
KEY_PRESS := 2. KEY_PRESS := 2,
KEY_RELEASE := 3. KEY_RELEASE := 3,
BUTTON_PRESS := 4. BUTTON_PRESS := 4,
BUTTON_RELEASE := 5. BUTTON_RELEASE := 5,
MOTION_NOTIFY := 6. MOTION_NOTIFY := 6,
ENTER_NOTIFY := 7. ENTER_NOTIFY := 7,
LEAVE_NOTIFY := 8. LEAVE_NOTIFY := 8,
EXPOSE := 12. EXPOSE := 12,
VISIBILITY_NOTIFY := 15. VISIBILITY_NOTIFY := 15,
DESTROY_NOTIFY := 17. DESTROY_NOTIFY := 17,
CONFIGURE_NOTIFY := 22. CONFIGURE_NOTIFY := 22,
CLIENT_MESSAGE := 33. CLIENT_MESSAGE := 33,
SHELL_CLOSE := 65537. SHELL_CLOSE := 65537
} }
class X11.LLEvent(Object) class X11.LLEvent(Object)
@ -170,9 +170,9 @@ class X11.KeyEvent(X11.Event)
pooldic X11.MouseButton pooldic X11.MouseButton
{ {
LEFT := 1. LEFT := 1,
MIDDLE := 2. MIDDLE := 2,
RIGHT := 3. RIGHT := 3
} }
class X11.MouseEvent(X11.Event) class X11.MouseEvent(X11.Event)
@ -207,17 +207,17 @@ class X11.ExposeEvent(X11.Event)
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
pooldic X11.GCLineStyle pooldic X11.GCLineStyle
{ {
SOLID := 0. SOLID := 0,
ON_OFF_DASH := 1. ON_OFF_DASH := 1,
DOUBLE_DASH := 2. DOUBLE_DASH := 2
} }
pooldic X11.GCFillStyle pooldic X11.GCFillStyle
{ {
SOLID := 0. SOLID := 0,
TILED := 1. TILED := 1,
STIPPLED := 2. STIPPLED := 2,
OPAQUE_STIPPLED := 3. OPAQUE_STIPPLED := 3
} }
class X11.GC(Object) class X11.GC(Object)

View File

@ -18,10 +18,10 @@ class MyObject.Donkey (MyObject)
pooldic MyObject.Code pooldic MyObject.Code
{ {
FAST := 20. FAST := 20,
FASTER := 40. FASTER := 40,
FASTER2X := self.FASTER. FASTER2X := self.FASTER,
FASTER3X := #(self.FAST self.FASTER self.FASTER2X #(MyObject.Donkey selfns.Donkey self.FAST FASTER) FASTER2X). FASTER3X := #(self.FAST self.FASTER self.FASTER2X #(MyObject.Donkey selfns.Donkey self.FAST FASTER) FASTER2X)
} }
class MyObject.Donkey.Party (MyObject.Donkey) class MyObject.Donkey.Party (MyObject.Donkey)
@ -65,10 +65,10 @@ class MyObject.System.Horse (Donkey)
pooldic XX pooldic XX
{ {
Horse := MyObject.System.Horse. Horse := MyObject.System.Horse,
Party := MyObject.Donkey.Party. Party := MyObject.Donkey.Party,
AAAA := 'AAAAAAAAAAAAAAAAAAAAAAAAA'. AAAA := 'AAAAAAAAAAAAAAAAAAAAAAAAA',
FFFF := 'FFFFFFFFFFFFFFFFFFFFFFFFF'. FFFF := 'FFFFFFFFFFFFFFFFFFFFFFFFF'
} }
class MyObject.System.System (selfns.Donkey) class MyObject.System.System (selfns.Donkey)

View File

@ -51,7 +51,7 @@ class B.TestObject(Object)
pooldic ABC pooldic ABC
{ {
KKK := 20. KKK := 20
} }

View File

@ -47,12 +47,12 @@ class B.TestObject(Object)
pooldic ABC pooldic ABC
{ {
KKK := 20. KKK := 20
} }
pooldic SRX.ABC pooldic SRX.ABC
{ {
JJJ := 1000. JJJ := 1000
} }
class MyConsole(Console) class MyConsole(Console)
{ {

View File

@ -571,6 +571,22 @@ static int fetch_word_from_string (const moo_oocs_t* haystack, moo_oow_t xindex,
return -1; return -1;
} }
static int find_oop_in_oopbuf (moo_t* moo, moo_oopbuf_t* oopbuf, moo_oow_t start, moo_oow_t step, moo_oop_t item, moo_oow_t* index)
{
moo_oow_t i;
for (i = start; i < oopbuf->count; i += step)
{
if (oopbuf->ptr[i] == item)
{
if (index) *index = i;
return 0;
}
}
moo_seterrnum (moo, MOO_ENOENT);
return -1;
}
static int add_oop_to_oopbuf (moo_t* moo, moo_oopbuf_t* oopbuf, moo_oop_t item) static int add_oop_to_oopbuf (moo_t* moo, moo_oopbuf_t* oopbuf, moo_oop_t item)
{ {
@ -3508,6 +3524,28 @@ oops:
return MOO_NULL; return MOO_NULL;
} }
static moo_oop_nsdic_t attach_nsdic_to_interface (moo_t* moo, moo_oop_interface_t c)
{
moo_oow_t tmp_count = 0;
moo_oop_nsdic_t nsdic;
moo_pushvolat (moo, (moo_oop_t*)&c); tmp_count++;
nsdic = moo_makensdic(moo, moo->_namespace, NAMESPACE_SIZE);
if (!nsdic) goto oops;
MOO_STORE_OOP (moo, &nsdic->nsup, (moo_oop_t)c); /* it points to the owning interface as it belongs to an interface */
MOO_STORE_OOP (moo, (moo_oop_t*)&nsdic->name, (moo_oop_t)c->name); /* for convenience only */
c->nsdic = nsdic;
moo_popvolats (moo, tmp_count);
return nsdic;
oops:
moo_popvolats (moo, tmp_count);
return MOO_NULL;
}
#define PDN_DONT_ADD_NS (1 << 0) #define PDN_DONT_ADD_NS (1 << 0)
#define PDN_ACCEPT_POOLDIC_AS_NS (1 << 1) #define PDN_ACCEPT_POOLDIC_AS_NS (1 << 1)
@ -3567,6 +3605,24 @@ static int preprocess_dotted_name (moo_t* moo, int flags, moo_oop_nsdic_t topdic
} }
else dic = t; else dic = t;
} }
else if (MOO_CLASSOF(moo, ass->value) == moo->_interface)
{
moo_oop_nsdic_t t;
t = ((moo_oop_interface_t)ass->value)->nsdic;
if ((moo_oop_t)t == moo->_nil)
{
if (flags & PDN_DONT_ADD_NS) goto wrong_name;
/* attach a new namespace dictionary to the nsdic field
* of the interface */
t = attach_nsdic_to_interface(moo, (moo_oop_interface_t)ass->value);
if (!t) return -1;
dic = t;
}
else dic = t;
}
else if ((flags & PDN_ACCEPT_POOLDIC_AS_NS) && MOO_CLASSOF(moo, ass->value) == moo->_pool_dictionary) else if ((flags & PDN_ACCEPT_POOLDIC_AS_NS) && MOO_CLASSOF(moo, ass->value) == moo->_pool_dictionary)
{ {
/* A pool dictionary is treated as if it's a name space. /* A pool dictionary is treated as if it's a name space.
@ -5138,6 +5194,11 @@ static MOO_INLINE int add_to_array_literal_buffer (moo_t* moo, moo_oop_t item)
return add_oop_to_oopbuf(moo, &moo->c->arlit, item); return add_oop_to_oopbuf(moo, &moo->c->arlit, item);
} }
static MOO_INLINE int find_in_array_literal_buffer (moo_t* moo, moo_oow_t start, moo_oow_t step, moo_oop_t item, moo_oow_t* index)
{
return find_oop_in_oopbuf(moo, &moo->c->arlit, start, step, item, index);
}
static int read_byte_array_literal (moo_t* moo, int rdonly, moo_oop_t* xlit) static int read_byte_array_literal (moo_t* moo, int rdonly, moo_oop_t* xlit)
{ {
moo_ooi_t tmp; moo_ooi_t tmp;
@ -9771,7 +9832,15 @@ static int __compile_pooldic_definition (moo_t* moo)
while (TOKEN_TYPE(moo) == MOO_IOTOK_IDENT) while (TOKEN_TYPE(moo) == MOO_IOTOK_IDENT)
{ {
lit = moo_makesymbol(moo, TOKEN_NAME_PTR(moo), TOKEN_NAME_LEN(moo)); lit = moo_makesymbol(moo, TOKEN_NAME_PTR(moo), TOKEN_NAME_LEN(moo));
if (!lit || add_to_array_literal_buffer(moo, lit) <= -1) goto oops; if (!lit) goto oops;
if (find_in_array_literal_buffer(moo, 0, 2, lit, MOO_NULL) >= 0)
{
moo_setsynerr (moo, MOO_SYNERR_NAMEDUPL, TOKEN_LOC(moo), TOKEN_NAME(moo));
goto oops;
}
if (add_to_array_literal_buffer(moo, lit) <= -1) goto oops;
GET_TOKEN (moo); GET_TOKEN (moo);
@ -9796,14 +9865,23 @@ static int __compile_pooldic_definition (moo_t* moo)
GET_TOKEN (moo); GET_TOKEN (moo);
/*if (TOKEN_TYPE(moo) == MOO_IOTOK_RBRACE) goto done; if (TOKEN_TYPE(moo) == MOO_IOTOK_RBRACE) goto done;
else*/ if (TOKEN_TYPE(moo) != MOO_IOTOK_PERIOD)
if (TOKEN_TYPE(moo) != MOO_IOTOK_COMMA)
{ {
moo_setsynerr (moo, MOO_SYNERR_PERIOD, TOKEN_LOC(moo), TOKEN_NAME(moo)); moo_setsynerrbfmt (moo, MOO_SYNERR_COMMA, TOKEN_LOC(moo), TOKEN_NAME(moo), "comma expected");
goto oops; goto oops;
} }
GET_TOKEN (moo); GET_TOKEN (moo);
/* comment out the following check to allow the last item
* to be followed by a comma. what is better? */
if (TOKEN_TYPE(moo) != MOO_IOTOK_IDENT)
{
moo_setsynerrbfmt (moo, MOO_SYNERR_IDENT, TOKEN_LOC(moo), TOKEN_NAME(moo), "identifier expected after comma");
goto oops;
}
} }
if (TOKEN_TYPE(moo) != MOO_IOTOK_RBRACE) if (TOKEN_TYPE(moo) != MOO_IOTOK_RBRACE)
@ -9812,7 +9890,7 @@ static int __compile_pooldic_definition (moo_t* moo)
goto oops; goto oops;
} }
/*done:*/ done:
GET_TOKEN (moo); GET_TOKEN (moo);
tally = (moo->c->arlit.count - saved_arlit_count) / 2; tally = (moo->c->arlit.count - saved_arlit_count) / 2;

View File

@ -1559,10 +1559,151 @@ int moo_fmt_object_ (moo_fmtout_t* fmtout, moo_oop_t oop)
} }
if (moo_bfmt_out(fmtout, ")") <= -1) return -1; if (moo_bfmt_out(fmtout, ")") <= -1) return -1;
} }
else if (c == moo->_namespace)
{
moo_oop_t ns;
struct
{
moo_oop_nsdic_t v;
struct node_t* next;
}* tmp, * top = MOO_NULL;
int ok = 1;
/* TODO: better memory allocation management? */
ns = ((moo_oop_nsdic_t)oop)->nsup;
while (/*ns != moo->_system &&*/ ns != moo->_system->nsdic) /* exclude System from the output */
{
if (MOO_CLASSOF(moo, ns) == moo->_class)
{
ns = ((moo_oop_class_t)ns)->nsup;
}
else if (MOO_CLASSOF(moo, ns) == moo->_interface)
{
ns = ((moo_oop_interface_t)ns)->nsup;
}
else
{
/* TODO: better memory allocation management? */
tmp = moo_callocmem(moo, MOO_SIZEOF(*tmp));
if (!tmp) goto done_namespace;
tmp->v = (moo_oop_nsdic_t)ns;
tmp->next = top;
top = tmp;
ns = ((moo_oop_nsdic_t)ns)->nsup;
}
}
done_namespace:
if (ok && moo_bfmt_out(fmtout, "<<namespace:") <= -1) ok = 0;
while (top)
{
tmp = top;
top = top->next;
if (ok && moo_bfmt_out(fmtout, "%.*js.", MOO_OBJ_GET_SIZE(tmp->v->name), MOO_OBJ_GET_CHAR_SLOT(tmp->v->name)) <= -1) ok = 0;
moo_freemem (moo, tmp);
}
if (ok && moo_bfmt_out(fmtout, "%.*js", MOO_OBJ_GET_SIZE(((moo_oop_nsdic_t)oop)->name), MOO_OBJ_GET_CHAR_SLOT(((moo_oop_nsdic_t)oop)->name)) <= -1) ok = 0;
if (ok && moo_bfmt_out(fmtout, ">>") <= -1) ok = 0;
if (!ok) return -1;
}
else if (c == moo->_class) else if (c == moo->_class)
{ {
/* print the class name */ /* print the class name */
if (moo_bfmt_out(fmtout, "%.*js", MOO_OBJ_GET_SIZE(((moo_oop_class_t)oop)->name), MOO_OBJ_GET_CHAR_SLOT(((moo_oop_class_t)oop)->name)) <= -1) return -1; moo_oop_t ns;
struct
{
moo_oop_nsdic_t v;
struct node_t* next;
}* tmp, * top = MOO_NULL;
int ok = 1;
/* TODO: collapse many duplicate code among namespace, class, interface name printing */
ns = ((moo_oop_class_t)oop)->nsup;
while (/*ns != moo->_system &&*/ ns != moo->_system->nsdic) /* exclude System from the output */
{
if (MOO_CLASSOF(moo, ns) == moo->_class)
{
ns = ((moo_oop_class_t)ns)->nsup;
}
else if (MOO_CLASSOF(moo, ns) == moo->_interface)
{
ns = ((moo_oop_interface_t)ns)->nsup;
}
else
{
/* TODO: better memory allocation management? */
tmp = moo_callocmem(moo, MOO_SIZEOF(*tmp));
if (!tmp) goto done_class;
tmp->v = (moo_oop_nsdic_t)ns;
tmp->next = top;
top = tmp;
ns = ((moo_oop_nsdic_t)ns)->nsup;
}
}
done_class:
if (ok && moo_bfmt_out(fmtout, "<<class:") <= -1) ok = 0;
while (top)
{
tmp = top;
top = top->next;
if (ok && moo_bfmt_out(fmtout, "%.*js.", MOO_OBJ_GET_SIZE(tmp->v->name), MOO_OBJ_GET_CHAR_SLOT(tmp->v->name)) <= -1) ok = 0;
moo_freemem (moo, tmp);
}
if (ok && moo_bfmt_out(fmtout, "%.*js", MOO_OBJ_GET_SIZE(((moo_oop_class_t)oop)->name), MOO_OBJ_GET_CHAR_SLOT(((moo_oop_class_t)oop)->name)) <= -1) return -1;
if (ok && moo_bfmt_out(fmtout, ">>") <= -1) ok = 0;
if (!ok) return -1;
}
else if (c == moo->_interface)
{
moo_oop_t ns;
struct
{
moo_oop_nsdic_t v;
struct node_t* next;
}* tmp, * top = MOO_NULL;
int ok = 1;
ns = ((moo_oop_interface_t)oop)->nsup;
while (/*ns != moo->_system &&*/ ns != moo->_system->nsdic) /* exclude System from the output */
{
if (MOO_CLASSOF(moo, ns) == moo->_class)
{
ns = ((moo_oop_class_t)ns)->nsup;
}
else if (MOO_CLASSOF(moo, ns) == moo->_interface)
{
ns = ((moo_oop_interface_t)ns)->nsup;
}
else
{
/* TODO: better memory allocation management? */
tmp = moo_callocmem(moo, MOO_SIZEOF(*tmp));
if (!tmp) goto done_interface;
tmp->v = (moo_oop_nsdic_t)ns;
tmp->next = top;
top = tmp;
ns = ((moo_oop_nsdic_t)ns)->nsup;
}
}
done_interface:
if (ok && moo_bfmt_out(fmtout, "<<interface:") <= -1) ok = 0;
while (top)
{
tmp = top;
top = top->next;
if (ok && moo_bfmt_out(fmtout, "%.*js.", MOO_OBJ_GET_SIZE(tmp->v->name), MOO_OBJ_GET_CHAR_SLOT(tmp->v->name)) <= -1) ok = 0;
moo_freemem (moo, tmp);
}
if (ok && moo_bfmt_out(fmtout, "%.*js", MOO_OBJ_GET_SIZE(((moo_oop_interface_t)oop)->name), MOO_OBJ_GET_CHAR_SLOT(((moo_oop_interface_t)oop)->name)) <= -1) return -1;
if (ok && moo_bfmt_out(fmtout, ">>") <= -1) ok = 0;
if (!ok) return -1;
} }
else if (c == moo->_association) else if (c == moo->_association)
{ {

View File

@ -1048,7 +1048,7 @@ moo_oop_t moo_findclass (moo_t* moo, moo_oop_nsdic_t nsdic, const moo_ooch_t* na
n.ptr = (moo_ooch_t*)name; n.ptr = (moo_ooch_t*)name;
n.len = moo_count_oocstr(name); n.len = moo_count_oocstr(name);
ass = moo_lookupdic (moo, (moo_oop_dic_t)nsdic, &n); ass = moo_lookupdic(moo, (moo_oop_dic_t)nsdic, &n);
if (!ass || MOO_CLASSOF(moo,ass->value) != moo->_class) if (!ass || MOO_CLASSOF(moo,ass->value) != moo->_class)
{ {
moo_seterrnum (moo, MOO_ENOENT); moo_seterrnum (moo, MOO_ENOENT);

View File

@ -476,7 +476,7 @@ struct moo_dic_t
typedef struct moo_nsdic_t moo_nsdic_t; typedef struct moo_nsdic_t moo_nsdic_t;
typedef struct moo_nsdic_t* moo_oop_nsdic_t; typedef struct moo_nsdic_t* moo_oop_nsdic_t;
#define MOO_INTERFACE_NAMED_INSTVARS 4 #define MOO_INTERFACE_NAMED_INSTVARS 5
typedef struct moo_interface_t moo_interface_t; typedef struct moo_interface_t moo_interface_t;
typedef struct moo_interface_t* moo_oop_interface_t; typedef struct moo_interface_t* moo_oop_interface_t;
@ -504,6 +504,7 @@ struct moo_interface_t
* [1] - class methods, MethodDictionary */ * [1] - class methods, MethodDictionary */
moo_oop_dic_t mthdic[2]; moo_oop_dic_t mthdic[2];
moo_oop_nsdic_t nsup; /* pointer to the upper namespace */ moo_oop_nsdic_t nsup; /* pointer to the upper namespace */
moo_oop_nsdic_t nsdic; /* dictionary used for namespacing - may be nil when there are no subitems underneath */
}; };
struct moo_class_t struct moo_class_t