MCPcopy Create free account
hub / github.com/F-Stack/f-stack / xo_do_open_list

Function xo_do_open_list

tools/libxo/libxo/libxo.c:7115–7158  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7113}
7114
7115static int
7116xo_do_open_list (xo_handle_t *xop, xo_xof_flags_t flags, const char *name)
7117{
7118 ssize_t rc = 0;
7119 int indent = 0;
7120
7121 xop = xo_default(xop);
7122
7123 const char *ppn = XOF_ISSET(xop, XOF_PRETTY) ? "\n" : "";
7124 const char *pre_nl = "";
7125
7126 switch (xo_style(xop)) {
7127 case XO_STYLE_JSON:
7128
7129 indent = 1;
7130 if (!XOF_ISSET(xop, XOF_NO_TOP)
7131 && !XOIF_ISSET(xop, XOIF_TOP_EMITTED))
7132 xo_emit_top(xop, ppn);
7133
7134 if (name == NULL) {
7135 xo_failure(xop, "NULL passed for list name");
7136 name = XO_FAILURE_NAME;
7137 }
7138
7139 xo_stack_set_flags(xop);
7140
7141 if (xop->xo_stack[xop->xo_depth].xs_flags & XSF_NOT_FIRST)
7142 pre_nl = XOF_ISSET(xop, XOF_PRETTY) ? ",\n" : ", ";
7143 xop->xo_stack[xop->xo_depth].xs_flags |= XSF_NOT_FIRST;
7144
7145 rc = xo_printf(xop, "%s%*s\"%s\": [%s",
7146 pre_nl, xo_indent(xop), "", name, ppn);
7147 break;
7148
7149 case XO_STYLE_ENCODER:
7150 rc = xo_encoder_handle(xop, XO_OP_OPEN_LIST, name, NULL, flags);
7151 break;
7152 }
7153
7154 xo_depth_change(xop, name, 1, indent, XSS_OPEN_LIST,
7155 XSF_LIST | xo_stack_flags(flags));
7156
7157 return rc;
7158}
7159
7160xo_ssize_t
7161xo_open_list_hf (xo_handle_t *xop, xo_xof_flags_t flags, const char *name)

Callers 2

xo_transitionFunction · 0.85
xo_explicit_transitionFunction · 0.85

Calls 10

xo_defaultFunction · 0.85
xo_styleFunction · 0.85
xo_emit_topFunction · 0.85
xo_failureFunction · 0.85
xo_stack_set_flagsFunction · 0.85
xo_printfFunction · 0.85
xo_indentFunction · 0.85
xo_encoder_handleFunction · 0.85
xo_depth_changeFunction · 0.85
xo_stack_flagsFunction · 0.85

Tested by

no test coverage detected