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

Function main

tools/libxo/tests/core/test_04.c:25–63  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

23int info_count = (sizeof(info) / sizeof(info[0]));
24
25int
26main (int argc, char **argv)
27{
28 struct employee {
29 const char *e_first;
30 const char *e_last;
31 unsigned e_dept;
32 } employees[] = {
33 { "Terry", "Jones", 660 },
34 { "Leslie", "Patterson", 341 },
35 { "Ashley", "Smith", 1440 },
36 { NULL, NULL }
37 }, *ep = employees;
38
39 argc = xo_parse_args(argc, argv);
40 if (argc < 0)
41 return 1;
42
43 xo_set_info(NULL, info, info_count);
44
45 xo_open_container("employees");
46 xo_open_list("employee");
47
48 xo_emit("{T:Last Name/%-12s}{T:First Name/%-14s}{T:Department/%s}\n");
49 for ( ; ep->e_first; ep++) {
50 xo_open_instance("employee");
51 xo_emit("{:first-name/%-12s/%s}{:last-name/%-14s/%s}"
52 "{:department/%8u/%u}\n",
53 ep->e_first, ep->e_last, ep->e_dept);
54 xo_close_instance("employee");
55 }
56
57 xo_close_list("employee");
58 xo_close_container("employees");
59
60 xo_finish();
61
62 return 0;
63}

Callers

nothing calls this directly

Calls 10

xo_parse_argsFunction · 0.85
xo_set_infoFunction · 0.85
xo_open_containerFunction · 0.85
xo_open_listFunction · 0.85
xo_emitFunction · 0.85
xo_open_instanceFunction · 0.85
xo_close_instanceFunction · 0.85
xo_close_listFunction · 0.85
xo_close_containerFunction · 0.85
xo_finishFunction · 0.85

Tested by

no test coverage detected