diff --git a/moo/kernel/Socket.moo b/moo/kernel/Socket.moo index ac98148..32d7176 100644 --- a/moo/kernel/Socket.moo +++ b/moo/kernel/Socket.moo @@ -208,20 +208,7 @@ class(#byte(16)) IP6Address(IP4Address) ##} } -class(#byte(19)) SocketAddress(Object) -{ - method(#primitive) port. - method(#primitive) port: port. - - method(#primitive) ipaddr. - method(#primitive) ipaddr: ipaddr. - - method fromString: str - { - } -} - -class SocketAddress(Object) from 'sck.addr' +class(#byte) SocketAddress(Object) from 'sck.addr' { ##method(#primitive) family. method(#primitive) fromString: str. @@ -391,6 +378,11 @@ class MyObject(Object) method(#class) main { | s conact inact outact | + + +SocketAddress new dump. +'****************************' dump. + (* s:= X new: 20. s basicSize dump. diff --git a/moo/lib/comp.c b/moo/lib/comp.c index c2f0ce3..3149ac8 100644 --- a/moo/lib/comp.c +++ b/moo/lib/comp.c @@ -7728,7 +7728,8 @@ static int __compile_class_definition (moo_t* moo, int extend) * this extra module name, i'm free from GC headache */ if (moo_importmod (moo, moo->c->cls.self_oop, moo->c->cls.modname.ptr, moo->c->cls.modname.len) <= -1) { - set_syntax_error (moo, MOO_SYNERR_MODIMPFAIL, &moo->c->cls.modname_loc, &moo->c->cls.modname); + moo_copyoocstr (moo->errmsg.tmpbuf.ooch, MOO_COUNTOF(moo->errmsg.tmpbuf.ooch), moo->errmsg.buf); + set_syntax_errbfmt (moo, MOO_SYNERR_MODIMPFAIL, &moo->c->cls.modname_loc, &moo->c->cls.modname, "%js", moo->errmsg.tmpbuf.ooch); return -1; } } diff --git a/moo/mod/sck-addr.c b/moo/mod/sck-addr.c index 4ad2aba..d70b8ef 100644 --- a/moo/mod/sck-addr.c +++ b/moo/mod/sck-addr.c @@ -25,6 +25,7 @@ */ #include "_sck.h" +#include "../lib/moo-prv.h" #include #include @@ -94,7 +95,20 @@ static moo_pfinfo_t pfinfos[] = static int import (moo_t* moo, moo_mod_t* mod, moo_oop_class_t _class) { - if (moo_setclasstrsize (moo, _class, MOO_SIZEOF(sck_addr_trailer_t), MOO_NULL) <= -1) return -1; + moo_ooi_t spec; + /*if (moo_setclasstrsize (moo, _class, MOO_SIZEOF(sck_addr_trailer_t), MOO_NULL) <= -1) return -1;*/ + + spec = MOO_OOP_TO_SMOOI(_class->spec); + if (!MOO_CLASS_SPEC_IS_INDEXED(spec) || MOO_CLASS_SPEC_INDEXED_TYPE(spec) != MOO_OBJ_TYPE_BYTE || MOO_CLASS_SPEC_NAMED_INSTVARS(spec) != 0) + { + moo_seterrbfmt (moo, MOO_EINVAL, "%O not a plain byte class", _class); + return -1; + } + + /* change the number of the fixed fields forcibly */ +/* TODO: check if the super class has what kind of size ... */ + spec = MOO_CLASS_SPEC_MAKE (10, MOO_CLASS_SPEC_FLAGS(spec), MOO_CLASS_SPEC_INDEXED_TYPE(spec)); + _class->spec = MOO_SMOOI_TO_OOP(spec); return 0; }