| verzia 1.4, 2003/03/09 10:32:41 |
verzia 1.5, 2003/03/30 10:27:38 |
|
|
| /* }}} */ |
/* }}} */ |
| |
|
| /* {{{ includes */ |
/* {{{ includes */ |
| #include "co_object.h" |
#include "co_o_small.h" |
| #include "test_util.h" |
#include "test_util.h" |
| /* }}} */ |
/* }}} */ |
| |
|
| /* {{{ */ |
/* {{{ */ |
| CO_OBJECT (person) |
CO_OBJECT (person, small) |
| { |
{ |
| CO_HEAD_FULL; |
|
| CO_ATTR (int, id); |
CO_ATTR (int, id); |
| }; |
}; |
| /* }}} */ |
/* }}} */ |
| /* {{{ */ |
/* {{{ */ |
| CO_OBJECT (employee) |
CO_OBJECT (employee, small) |
| { |
{ |
| CO_HEAD_FULL; |
|
| co person; |
co person; |
| CO_ATTR (int, id); |
CO_ATTR (int, id); |
| }; |
}; |
| Riadok 45 CO_OBJECT (employee) |
|
| Riadok 43 CO_OBJECT (employee) |
|
| |
|
| #include "delegation.cometa" |
#include "delegation.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); |
CO_RETURN (int, 0); |
| return o; |
} |
| } /* }}} */ |
/* }}} */ |
| /* {{{ */ static co employee_new (void) |
/* {{{ */ |
| { |
CO_METH (employee, init) |
| co_o_head_full o; |
{ |
| o = new (employee_s); |
employee td; |
| employee_meth_ar_init (o); |
td = new (employee_s); |
| CO_BLESS (o, employee, 0); |
this -> data = td; |
| return o; |
CO_RETURN (int, 0); |
| } /* }}} */ |
} |
| |
/* }}} */ |
| |
|
| /* {{{ */ |
/* {{{ */ |
| CO_METH (employee, getid) |
CO_METH (employee, getid) |
| { |
{ |
| CO_METH_INI (employee, getid); |
CO_METH_INI (employee, getid); |
| return CO_D (this -> person, getid); |
return CO_D (td -> person, getid); |
| } |
} |
| /* }}} */ |
/* }}} */ |
| /* {{{ */ |
/* {{{ */ |
| CO_METH (employee, getid_nodeleg) |
CO_METH (employee, getid_nodeleg) |
| { |
{ |
| CO_METH_INI (employee, getid_nodeleg); |
CO_METH_INI (employee, getid_nodeleg); |
| return CO_M (this -> person, getid); |
return CO_M (td -> person, getid); |
| } |
} |
| /* }}} */ |
/* }}} */ |
| /* {{{ */ |
/* {{{ */ |
| Riadok 100 CO_METH (person, default) |
|
| Riadok 100 CO_METH (person, default) |
|
| |
|
| /* {{{ */ int main (void) |
/* {{{ */ int main (void) |
| { |
{ |
| co p, e; |
co_o_small p, e; |
| int pid_dir, pid_ind, eid_dir, eid_ind; |
int pid_dir, pid_ind, eid_dir, eid_ind; |
| int eid_nod; |
int eid_nod; |
| co super; |
co super; |
| super = co_super_new (); |
super = co_init (); |
| __co_file_init_delegation_c (super); |
__co_file_init_delegation_c (super); |
| |
|
| // create new test object |
// create new test object |
| e = CO_NEW (employee); |
e = employee_new (); |
| p = CO_NEW (person); |
p = person_new (); |
| ((employee) e) -> person = p; |
((employee) (e -> data)) -> person = p; |
| ((employee) e) -> id = 42; |
((employee) (e -> data)) -> id = 42; |
| ((person) p) -> id = 13; |
((person) (p -> data)) -> id = 13; |
| eid_ind = CO_M (e, getid) . _int; |
eid_ind = CO_M (e, getid) . _int; |
| eid_dir = CO_A (int, e, id); |
eid_dir = CO_A (int, e, id); |
| pid_ind = CO_M (p, getid) . _int; |
pid_ind = CO_M (p, getid) . _int; |