6 class My:Person from Gtk:Object {
8 public long dob; /* date of birth as a time_t */
9 public long dod; /* date of death as a time_t */
11 private int rounds_in_shotgun; /* number of rounds in our shotgun */
16 ARG = g_strdup(self->name);
23 self->name = g_strdup(ARG);
28 argument LONG dob get { ARG = self->dob; } set { self->dob = ARG; };
29 argument LONG dod get { ARG = self->dod; } set { self->dod = ARG; };
33 person->name = g_strdup("Nobody");
37 /* initially we have no rounds in the shotgun */
38 person->_priv->rounds_in_shotgun = 0;
41 /* when the person gets born, sends out a signal, the caller
42 of the signal should provide the date of birth */
43 signal last NONE (LONG)
50 /* when the person dies, sends out a signal, the caller
51 of the signal should provide the date of death */
52 signal last NONE (LONG)
63 /* add a round to our shotgun */
64 self->_priv->rounds_in_shotgun++;
69 shoot_oneself_in_the_head(self)
71 if(self->_priv->rounds_in_shotgun==0) {
72 g_warning("No rounds in the shotgun!");
76 /* one round was fired */
77 self->_priv->rounds_in_shotgun--;
79 /* death is imminent if we shoot oneself in the head */
80 death(self,(long)time(NULL));