12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- /* This file is part of nit.
- *
- * Nit is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Nit is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with nit. If not, see <http://www.gnu.org/licenses/>.
- */
- #ifndef STATE_H
- #define STATE_H
- #include "acts.h"
- #include "trie.h"
- typedef struct Branch_act {
- uint64_t branch;
- Act act;
- Trie_entry *real_next;
- } Branch_act;
- typedef void (*Act_dispose)(Act *act, void *extra);
- typedef struct State {
- Act_dispose act_dispose;
- Disposer disposer;
- Trie past;
- Trie_entry *end;
- Acts *acts;
- void *extra;
- uint64_t branch;
- unsigned undoing : 1;
- } State;
- Nit_error
- state_init(State *state, Acts *acts, uint64_t branch,
- Act_dispose dispose, void *extra);
- void
- state_dispose(State *state);
- Nit_error
- state_do(State *state, uint32_t key_len, const void *key,
- void *dat, void *args, int real);
- Nit_error
- state_undo(State *state);
- Nit_error
- state_redo(State *state, uint64_t branch, int real);
- /* Nit_error */
- /* state_realize(State *state) */
- /* { */
- /* List list; */
- /* Branch_act *b_act; */
- /* Nit_error err_str; */
- /* list_init(&list, NULL); */
- /* while (!(b_act = state->end->dat)->act.real) */
- /* if ((err_str = list_add(&list, NULL, &b_act->branch))) */
- /* return err_str; */
-
- /* } */
- #endif
|