some work
authorxchaos <xchaos@4bb87942-c103-4e5a-b51c-0ebff58f8515>
Tue, 23 Sep 2008 16:13:45 +0000 (16:13 +0000)
committerxchaos <xchaos@4bb87942-c103-4e5a-b51c-0ebff58f8515>
Tue, 23 Sep 2008 16:13:45 +0000 (16:13 +0000)
git-svn-id: https://dev.arachne.cz/repos/cll1h/trunk@93 4bb87942-c103-4e5a-b51c-0ebff58f8515

demos/objects/objects-community.c
demos/objects/objects-confederation.c [moved from demos/objects/objects-hierarchy.c with 94% similarity]
demos/objects/objects-wiki.c

index 2ed93ec2c80fd79c4ef1d5f7635c88e05d616601..0854766c0ae28313594a92ebb9515a5795e0d352 100644 (file)
@@ -262,7 +262,7 @@ Interface circInterface(void)
  return this;
 }
 
-/* usage of objects inside C<<1 program */
+/* usage of object community inside C<<1 program */
 
 program
 {
similarity index 94%
rename from demos/objects/objects-hierarchy.c
rename to demos/objects/objects-confederation.c
index 4c81c7b9aa4743e43adf3572bbb63f43923476ab..61b479878c08ea609ddd951ea22178eeed3637bf 100644 (file)
@@ -2,10 +2,7 @@
 
 /* This is example of advanced C<<1 object oriented features... */ 
 
-def_type(Point);
-def_type(Shape);
-
-def_mem(PointInterface)
+def_interface(Point, PointInterface)
 {
  void method(move) (Shape self, int x, int y);
  str method(desc) (Shape self);
@@ -13,22 +10,21 @@ def_mem(PointInterface)
  int count;
 };
 
-def_mem(ShapeInterface)
+def_interface(Shape, ShapeInterface)
 {
+ federation(Point);
  void method(draw) (Shape self);
- void method(move) (Shape self, int x, int y);
- str method(desc) (Shape self);
- void method(rename) (Shape self, str name);
  void method(reset) (Shape self, int x1, int y1, int x2, int y2, int x3, int y3);
  float method(area) (Shape self);
  int count;
 };
 
-/* This is example of hierarchical object architecture in C<<1 */
+/* This is example of non-hierarchical object federation architecture in C<<1 */
 
 def_obj(Point)
 {
  interface(PointInterface);
+ shape Shape; /* this is optional, but we will use it do demonstrate power of C<<1 */
  int x1, y1;
  str desc;
 }
@@ -204,9 +200,11 @@ void nameRect(Shape community, str newname)
 
 construct(Tri,ShapeInterface) (Tri self, int x1, int y1, int x2, int y2, int x3, int y3)
 {
+ self->point = confederate_obj(Point);
+ _(move, self->point, x1, x2);
  self->name = "TRIANGLE";
  interface_of(self)->count++;
- _(reset, self, x1, y1, x2, y2, x3, y3);
+ _(reset, self, x2, y2, x3, y3);
 
  return self;
 }
index 871488b2686ecdb89dc969b607ea63e6042cb0ef..08403cb91af186a2a8830537b0a509af8217d5c2 100644 (file)
@@ -14,7 +14,7 @@ def_interface(Animal,Actions)
 def_obj(Animal)
 {
  interface(Actions);
char *name;
str name;
 };
 
 construct(Animal,Actions) (Animal self, str name)
This page took 0.222095 seconds and 4 git commands to generate.