Resync
[CMakeLuaTailorHgBridge.git] / CMakeLua / Tests / SwigTest / runme.pike
bloba6377600ebbf77b4a7dbe9737718c1d06ba1ee49
1 import .example;
3 int main()
5 // ----- Object creation -----
7 write("Creating some objects:\n");
8 Circle c = Circle(10.0);
9 write(" Created circle.\n");
10 Square s = Square(10.0);
11 write(" Created square.\n");
13 // ----- Access a static member -----
15 write("\nA total of " + Shape_nshapes_get() + " shapes were created\n");
17 // ----- Member data access -----
19 // Set the location of the object
21 c->x_set(20.0);
22 c->y_set(30.0);
24 s->x_set(-10.0);
25 s->y_set(5.0);
27 write("\nHere is their current position:\n");
28 write(" Circle = (%f, %f)\n", c->x_get(), c->y_get());
29 write(" Square = (%f, %f)\n", s->x_get(), s->y_get());
31 // ----- Call some methods -----
33 write("\nHere are some properties of the shapes:\n");
34 write(" The circle:\n");
35 write(" area = %f.\n", c->area());
36 write(" perimeter = %f.\n", c->perimeter());
37 write(" The square:\n");
38 write(" area = %f.\n", s->area());
39 write(" perimeter = %f.\n", s->perimeter());
41 write("\nGuess I'll clean up now\n");
43 /* See if we can force 's' to be garbage-collected */
44 s = 0;
46 /* Now we should be down to only 1 shape */
47 write("%d shapes remain\n", Shape_nshapes_get());
49 /* Done */
50 write("Goodbye\n");
52 return 0;