2 actiondesc.c - stack for all actions on one word
4 Copyright (C) 2004, 2005, Christian Thaeter <chth@gmx.net>
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License version 2 as
8 published by the Free Software Foundation.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, contact me.
20 #include "mala_types.h"
23 #include "actiondesc.h"
26 MalaActionDesc
mala_actiondesc_new (MalaString name
)
29 self
= malloc (sizeof(mala_actiondesc
));
33 LIST_INIT(&self
->actions
);
39 mala_actiondesc_ensure (MalaString str
)
43 self
= (MalaActionDesc
) mala_string_user_get (str
);
46 self
= mala_actiondesc_new (str
);
49 mala_string_user_set (str
, self
);
55 void mala_actiondesc_free (MalaActionDesc self
)
60 MALA_DEBUG("start %p",self
);
61 while (self
->actions
.lh_first
!= NULL
)
63 MalaAction act
= self
->actions
.lh_first
;
64 MALA_DEBUG("name %s",act
->name
->str
);
65 LIST_REMOVE(act
, stknode
);
66 mala_action_free (act
);
69 mala_string_user_set (self
->name
, NULL
);
71 MALA_DEBUG("done %p",self
);
77 mala_actiondesc_push_action (MalaActionDesc self
, MalaAction action
)
79 LIST_INSERT_HEAD (&self
->actions
, action
, stknode
);
86 // c-file-style: "gnu"
88 // arch-tag: 52850120-1610-46ce-9cd8-ec035f0fc025