term: rename struct term_state to term