Diff for libco/test/clone.c between version 1.1 and 1.2
| version 1.1, 2003/03/23 11:03:35 |
version 1.2, 2003/03/30 10:27:38 |
|
|
| * Boston, MA 02111-1307, USA. * |
* Boston, MA 02111-1307, USA. * |
| *******************************************************************}}}***/ |
*******************************************************************}}}***/ |
| /* {{{ file description */ |
/* {{{ file description */ |
| /** \file object.c |
/** |
| * \brief Test libco's object engine. Quite simple, for now. */ |
* @file clone.c |
| |
* @brief Test for clone functionality of libco objects. |
| |
**/ |
| /* }}} */ |
/* }}} */ |
| |
|
| /* {{{ includes */ |
/* {{{ includes */ |
| #include "co_object.h" |
#include "co_o_default.h" |
| #include "test_util.h" |
#include "test_util.h" |
| |
#include "co_conv.h" |
| /* }}} */ |
/* }}} */ |
| |
|
| /* {{{ */ |
/* {{{ */ |
| CO_OBJECT (person) |
CO_OBJECT (person, default) |
| { |
{ |
| CO_HEAD_FULL; |
|
| CO_ATTR (int, id); |
CO_ATTR (int, id); |
| }; |
}; |
| /* }}} */ |
/* }}} */ |
| |
|
| #include "clone.cometa" |
#include "clone.cometa" |
| |
|
| /* {{{ */ static co person_new (void) |
/* {{{ */ |
| |
CO_METH (person, init) |
| { |
{ |
| co_o_head_full o; |
person td; |
| o = new (person_s); |
td = new (person_s); |
| person_meth_ar_init (o); |
this -> data = td; |
| CO_BLESS (o, person, 0); |
cox_pop (td); |
| return o; |
} |
| } /* }}} */ |
/* }}} */ |
| |
|
| /* {{{ */ |
/* {{{ */ |
| CO_METH (person, clean) |
CO_METH (person, getid) |
| { |
{ |
| CO_METH_INI (person, clean); |
CO_METH_INI (person, getid); |
| this -> id = 0; |
CO_RETURN (int, CO_A (int, self, id)); |
| CO_RETURN (int, 0); |
|
| } |
} |
| /* }}} */ |
/* }}} */ |
| /* {{{ */ |
/* {{{ */ |
| CO_METH (person, default) |
CO_METH (person, default) |
| { |
{ |
| CO_METH_INI (person, default); |
CO_METH_INI (person, default); |
| |
CO_DEBUG (1, "called"); |
| CO_RETURN (int, 0); |
CO_RETURN (int, 0); |
| } |
} |
| /* }}} */ |
/* }}} */ |
| |
|
| /* {{{ */ int main (void) |
/* {{{ */ int main (void) |
| { |
{ |
| co p, q; |
co tst1, tst2; |
| |
int i; |
| co super; |
co super; |
| super = co_super_new (); |
super = co_init (); |
| __co_file_init_clone_c (super); |
__co_file_init_clone_c (super); |
| |
|
| p = CO_NEW (person); |
tst1 = person_new (); |
| ((person) p) -> id = 13; |
tst2 = M (tst1, clone) . _co; |
| q = CO_M (p, dclone_c) . _co; |
|
| cox_pop (q); |
CO_M (super, exit, 0); |
| CO_DEBUG (1, "p -> id = %d", CO_A (int, p, id)); |
|
| CO_DEBUG (1, "q -> id = %d", CO_A (int, q, id)); |
|
| |
|
| return 0; |
return 0; |
| } /* }}} */ |
} /* }}} */ |
Platon Group <platon@platon.org> http://platon.org/
|
|