MarkT:
if (state = 1) int charge ();
if (state = 2) int wait (hold);
if (state = 3) int discharge ();
if (state = 4) int saftey ();
isn't right. Are you expecting to call some functions rather than declare them? Your code sounds like it can simply be linear and not need a state variable (or are you doing something else in the sketch at the same time?)
Not only that, but they should all be the equality operator ('==') not the assignment operator ('=').