2010-02-13 Jb Evain <jbevain@novell.com>
[mcs.git] / tools / cilc / demo.c
blobacb6e60afc6acd52f56983469815bbc1aa30d934
1 #include <glib.h>
2 #include <glib/gprintf.h>
3 #include "demo.h"
5 int main () {
6 DemoTest *my_test;
7 const gchar *mystr;
8 int num;
9 gdouble num_dbl;
10 DemoDrink drink;
11 //GEnumClass *enum_class;
13 //run a static method
14 demo_test_static_method ();
16 //create an object instance
17 my_test = demo_test_new ();
19 //run an instance method
20 demo_test_increment (my_test);
22 //run an instance method with arguments
23 demo_test_add_number (my_test, 2);
25 //run an instance method with arguments
26 demo_test_echo (my_test, "hello from c");
28 //run an instance method with arguments and a return string
29 mystr = demo_test_make_upper (my_test, "lower to upper");
30 g_printf ("Lower to upper: %s\n", mystr);
32 //run a property set accessor
33 demo_test_set_title (my_test, "set property from c");
35 //run a property get accessor
36 mystr = demo_test_get_title (my_test);
37 g_printf ("Title property: %s\n", mystr);
39 num = demo_test_get_value (my_test);
40 g_printf ("The counter's value is %d\n", num);
42 num_dbl = demo_test_get_double_value (my_test);
43 g_printf ("The counter's double value is %.16f\n", num_dbl);
45 drink = demo_test_pick_drink ();
46 //enum_class = g_type_class_peek (demo_drink_get_type ());
47 //g_enum_get_value (enum_class, drink);
48 //g_printf ("%d\n", drink);
50 //TODO: return value
51 //g_printf ("returned string: %s\n", demo_test_get_title (my_test));
53 return 0;