* The xo(1) utility needs to be able to open and close lists and * instances, but since it's called without "state", we cannot * rely on the state transitions (in xo_transition) to DTRT, so * we have a mechanism for external parties to "force" transitions * that would otherwise be impossible. This is not a general * mechanism, and is really tailored only for xo(1). */
| 8483 | * mechanism, and is really tailored only for xo(1). |
| 8484 | */ |
| 8485 | void |
| 8486 | xo_explicit_transition (xo_handle_t *xop, xo_state_t new_state, |
| 8487 | const char *name, xo_xof_flags_t flags) |
| 8488 | { |
| 8489 | xo_xsf_flags_t xsf_flags; |
| 8490 | |
| 8491 | xop = xo_default(xop); |
| 8492 | |
| 8493 | switch (new_state) { |
| 8494 | |
| 8495 | case XSS_OPEN_LIST: |
| 8496 | xo_do_open_list(xop, flags, name); |
| 8497 | break; |
| 8498 | |
| 8499 | case XSS_OPEN_INSTANCE: |
| 8500 | xo_do_open_instance(xop, flags, name); |
| 8501 | break; |
| 8502 | |
| 8503 | case XSS_CLOSE_INSTANCE: |
| 8504 | xo_depth_change(xop, name, 1, 1, XSS_OPEN_INSTANCE, |
| 8505 | xo_stack_flags(flags)); |
| 8506 | xo_stack_set_flags(xop); |
| 8507 | xo_do_close_instance(xop, name); |
| 8508 | break; |
| 8509 | |
| 8510 | case XSS_CLOSE_LIST: |
| 8511 | xsf_flags = XOF_ISSET(xop, XOF_NOT_FIRST) ? XSF_NOT_FIRST : 0; |
| 8512 | |
| 8513 | xo_depth_change(xop, name, 1, 1, XSS_OPEN_LIST, |
| 8514 | XSF_LIST | xsf_flags | xo_stack_flags(flags)); |
| 8515 | xo_do_close_list(xop, name); |
| 8516 | break; |
| 8517 | } |
| 8518 | } |
no test coverage detected