6 #include "my-person-private.h"
9 class My:Person from Gtk:Object {
11 public long dob; /* date of birth as a time_t */
12 public long dod; /* date of death as a time_t */
14 private int rounds_in_shotgun; /* number of rounds in our shotgun */
16 argument POINTER (type char *) name
19 ARG = g_strdup(self->name);
26 self->name = g_strdup(ARG);
31 argument LONG dob get { ARG = self->dob; } set { self->dob = ARG; };
32 argument LONG dod get { ARG = self->dod; } set { self->dod = ARG; };
36 person->name = g_strdup("Nobody");
40 /* initially we have no rounds in the shotgun */
41 person->_priv->rounds_in_shotgun = 0;
44 /* when the person gets born, sends out a signal, the caller
45 of the signal should provide the date of birth */
46 signal last NONE (LONG)
53 /* when the person dies, sends out a signal, the caller
54 of the signal should provide the date of death */
55 signal last NONE (LONG)
66 /* add a round to our shotgun */
67 self->_priv->rounds_in_shotgun++;
72 shoot_oneself_in_the_head(self)
74 if(self->_priv->rounds_in_shotgun==0) {
75 g_warning("No rounds in the shotgun!");
79 /* one round was fired */
80 self->_priv->rounds_in_shotgun--;
82 /* death is imminent if we shoot oneself in the head */
83 death(self,(long)time(NULL));