2 * Copyright (c) 2014, Juniper Networks, Inc.
4 * This SOFTWARE is licensed under the LICENSE provided in the
5 * ../Copyright file. By downloading, installing, copying, or otherwise
6 * using the SOFTWARE, you agree to be bound by the terms of that
8 * Phil Shafer, July 2014
18 { "employee", "object", "Employee data" },
19 { "first-name", "string", "First name of employee" },
20 { "last-name", "string", "Last name of employee" },
21 { "department", "number", "Department number" },
22 { "percent-time", "number", "Percentage of full & part time (%)" },
24 int info_count = (sizeof(info) / sizeof(info[0]));
27 main (int argc, char **argv)
36 { "Jim", "რეგტ", "გთხოვთ ახ", 431, 90 },
37 { "Terry", "<one", "Οὐχὶ ταὐτὰ παρίσταταί μοι Jones", 660, 90 },
38 { "Leslie", "Les", "Patterson", 341,60 },
39 { "Ashley", "Ash", "Meter & Smith", 1440, 40 },
40 { "0123456789", "0123456789", "012345678901234567890", 1440, 40 },
41 { "ახლა", "გაიარო", "საერთაშორისო", 123, 90 },
45 argc = xo_parse_args(argc, argv);
49 xo_set_info(NULL, info, info_count);
51 xo_open_container("employees");
53 xo_emit("Οὐχὶ ταὐτὰ παρίσταταί μοι {:v1/%s}, {:v2/%s}\n",
54 "γιγνώσκειν", "ὦ ἄνδρες ᾿Αθηναῖοι");
56 xo_emit("გთხოვთ {:v1/%s} {:v2/%s}\n",
57 "ახლავე გაიაროთ რეგისტრაცია",
58 "Unicode-ის მეათე საერთაშორისო");
60 xo_open_list("employee");
62 xo_emit("{T:First Name/%-25s}{T:Last Name/%-14s}"
63 "{T:/%-12s}{T:Time (%)}\n", "Department");
64 for ( ; ep->e_first; ep++) {
65 xo_open_instance("employee");
66 xo_emit("{[:-25}{:first-name/%s} ({:nic-name/\"%s\"}){]:}"
67 "{:last-name/%-14..14s/%s}"
68 "{:department/%8u/%u}{:percent-time/%8u/%u}\n",
69 ep->e_first, ep->e_nic, ep->e_last, ep->e_dept, ep->e_percent);
70 if (ep->e_percent > 50) {
71 xo_attr("full-time", "%s", "honest & for true");
72 xo_emit("{e:benefits/%s}", "full");
74 xo_close_instance("employee");
77 xo_close_list("employee");
78 xo_close_container("employees");