2 * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
3 * Copyright (C) 1999,2000 Hiroyuki Yamamoto
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
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, write to the Free Software
17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 #include <gtk/gtkmain.h>
24 #include "automaton.h"
26 Automaton *automaton_create(gint num)
30 g_return_val_if_fail(num > 0, NULL);
32 atm = g_new0(Automaton, 1);
34 atm->state = g_new0(AtmState, num);
39 void automaton_destroy(Automaton *atm)
47 void automaton_input_cb(gpointer data, gint source,
48 GdkInputCondition condition)
50 Automaton *atm = (Automaton *)data;
53 //g_print("atm->num = %d\n", atm->num);
55 if (atm->timeout_tag > 0) {
56 gtk_timeout_remove(atm->timeout_tag);
60 gdk_input_remove(atm->tag);
63 next = atm->state[atm->num].handler(source, atm->data);
68 if (next >= 0 && next <= atm->max && next != atm->num) {
70 atm->tag = gdk_input_add(source,
71 atm->state[atm->num].condition,
75 atm->terminate(source, data);