svn commit: r300925 - in head: contrib/libxo contrib/libxo/doc contrib/libxo/libxo contrib/libxo/tests/core contrib/libxo/tests/core/saved lib/libxo

Phil Shafer phil at FreeBSD.org
Sun May 29 01:43:32 UTC 2016


Author: phil
Date: Sun May 29 01:43:28 2016
New Revision: 300925
URL: https://svnweb.freebsd.org/changeset/base/300925

Log:
  Submitted by:	phil
  Reviewed by:	sjg (mentor)
  Approved by:	sjg

Modified:
  head/contrib/libxo/configure.ac
  head/contrib/libxo/doc/libxo-manual.html
  head/contrib/libxo/doc/libxo.txt
  head/contrib/libxo/libxo/libxo.c
  head/contrib/libxo/libxo/xo_buf.h
  head/contrib/libxo/libxo/xo_encoder.c
  head/contrib/libxo/libxo/xo_format.5
  head/contrib/libxo/tests/core/saved/test_03.E.out
  head/contrib/libxo/tests/core/saved/test_03.H.out
  head/contrib/libxo/tests/core/saved/test_03.HIPx.out
  head/contrib/libxo/tests/core/saved/test_03.HP.out
  head/contrib/libxo/tests/core/saved/test_03.J.out
  head/contrib/libxo/tests/core/saved/test_03.JP.out
  head/contrib/libxo/tests/core/saved/test_03.T.out
  head/contrib/libxo/tests/core/saved/test_03.X.out
  head/contrib/libxo/tests/core/saved/test_03.XP.out
  head/contrib/libxo/tests/core/test_03.c
  head/lib/libxo/add.man
  head/lib/libxo/xo_config.h
Directory Properties:
  head/contrib/libxo/   (props changed)

Modified: head/contrib/libxo/configure.ac
==============================================================================
--- head/contrib/libxo/configure.ac	Sun May 29 01:40:48 2016	(r300924)
+++ head/contrib/libxo/configure.ac	Sun May 29 01:43:28 2016	(r300925)
@@ -12,7 +12,7 @@
 #
 
 AC_PREREQ(2.2)
-AC_INIT([libxo], [0.6.1], [phil at juniper.net])
+AC_INIT([libxo], [0.6.2], [phil at juniper.net])
 AM_INIT_AUTOMAKE([-Wall -Werror foreign -Wno-portability])
 
 # Support silent build rules.  Requires at least automake-1.11.

Modified: head/contrib/libxo/doc/libxo-manual.html
==============================================================================
--- head/contrib/libxo/doc/libxo-manual.html	Sun May 29 01:40:48 2016	(r300924)
+++ head/contrib/libxo/doc/libxo-manual.html	Sun May 29 01:43:28 2016	(r300925)
@@ -515,7 +515,7 @@ li.indline1 {
  
   } 
   @top-right {
-       content: "April 2016";
+       content: "May 2016";
  
   } 
   @top-center {
@@ -22009,7 +22009,7 @@ jQuery(function ($) {
 </tr>
 <tr>
 <td class="header left"></td>
-<td class="header right">April 15, 2016</td>
+<td class="header right">May 28, 2016</td>
 </tr>
 </table></div>
 <p id="title" class="title">libxo: The Easy Way to Generate text, XML, JSON, and HTML output<br><span class="filename">libxo-manual</span></p>
@@ -22739,7 +22739,7 @@ jQuery(function ($) {
     make
     make test
     sudo make install
-	    </pre> <p id="doc_section_1_1_2_p_4">The following sections will walk thru each of these steps with additional details and options, but the above directions should be all that's needed.</p>
+	    </pre> <p id="doc_section_1_1_2_p_4">The following sections will walk through each of these steps with additional details and options, but the above directions should be all that's needed.</p>
 <p id="doc_section_1_1_2_p_5">Section Contents: </p>
 <ul>
 <li><a href="#setting-up-the-build" title="Setting up the build">Section 1.1.2.1</a></li>
@@ -23087,7 +23087,7 @@ jQuery(function ($) {
         xo_emit("{L:Free}{D::}{P:   }{:free/%u} {U:Blocks}\n",
                 free_blocks);
 	    </pre> <p id="doc_section_2_2_1_p_3">When a role is not provided, the "value" role is used as the default.</p>
-<p id="doc_section_2_2_1_p_4">Roles and modifiers can also use more verbose names, when preceeded by a comma:</p>
+<p id="doc_section_2_2_1_p_4">Roles and modifiers can also use more verbose names, when preceded by a comma:</p>
 <div id="doc_figure_u.27"></div> <pre>
     EXAMPLE:
         xo_emit("{,label:Free}{,decoration::}{,padding:   }"
@@ -23444,7 +23444,7 @@ jQuery(function ($) {
 </tr>
 </tbody>
 </table></div>
-<p id="doc_section_2_2_2_p_2">Roles and modifiers can also use more verbose names, when preceeded by a comma. For example, the modifier string "Lwc" (or "L,white,colon") means the field has a label role (text that describes the next field) and should be followed by a colon ('c') and a space ('w'). The modifier string "Vkq" (or ":key,quote") means the field has a value role (the default role), that it is a key for the current instance, and that the value should be quoted when encoded for JSON.</p>
+<p id="doc_section_2_2_2_p_2">Roles and modifiers can also use more verbose names, when preceded by a comma. For example, the modifier string "Lwc" (or "L,white,colon") means the field has a label role (text that describes the next field) and should be followed by a colon ('c') and a space ('w'). The modifier string "Vkq" (or ":key,quote") means the field has a value role (the default role), that it is a key for the current instance, and that the value should be quoted when encoded for JSON.</p>
 <p id="doc_section_2_2_2_p_3">Section Contents: </p>
 <ul>
 <li><a href="#the-argument-modifier-a" title="The Argument Modifier ({a:})">Section 2.2.2.1</a></li>
@@ -23688,7 +23688,7 @@ jQuery(function ($) {
 <li>a '#' character, indicating the output value should be prefixed with '0x', typically to indicate a base 16 (hex) value.</li>
 <li>a minus sign ('‑'), indicating the output value should be padded on the right instead of the left.</li>
 <li>a leading zero ('0') indicating the output value should be padded on the left with zeroes instead of spaces (' ').</li>
-<li>one or more digits ('0' - '9') indicating the minimum width of the argument. If the width in columns of the output value is less that the minumum width, the value will be padded to reach the minimum.</li>
+<li>one or more digits ('0' - '9') indicating the minimum width of the argument. If the width in columns of the output value is less than the minimum width, the value will be padded to reach the minimum.</li>
 <li>a period followed by one or more digits indicating the maximum number of bytes which will be examined for a string argument, or the maximum width for a non-string argument. When handling ASCII strings this functions as the field width but for multi-byte characters, a single character may be composed of multiple bytes. xo_emit will never dereference memory beyond the given number of bytes.</li>
 <li>a second period followed by one or more digits indicating the maximum width for a string argument. This modifier cannot be given for non-string arguments.</li>
 <li>one or more 'h' characters, indicating shorter input data.</li>

Modified: head/contrib/libxo/doc/libxo.txt
==============================================================================
--- head/contrib/libxo/doc/libxo.txt	Sun May 29 01:40:48 2016	(r300924)
+++ head/contrib/libxo/doc/libxo.txt	Sun May 29 01:43:28 2016	(r300925)
@@ -155,7 +155,7 @@ explained in detail in the rest of this 
     make test
     sudo make install
 
-The following sections will walk thru each of these steps with
+The following sections will walk through each of these steps with
 additional details and options, but the above directions should be all
 that's needed.
 
@@ -469,7 +469,7 @@ content.  The roles are listed below; on
 
 When a role is not provided, the "value" role is used as the default.
 
-Roles and modifiers can also use more verbose names, when preceeded by
+Roles and modifiers can also use more verbose names, when preceded by
 a comma:
 
     EXAMPLE:
@@ -720,7 +720,7 @@ particular output styles:
 | w | white         | A blank (" ") is appended after the label        |
 |---+---------------+--------------------------------------------------|
 
-Roles and modifiers can also use more verbose names, when preceeded by
+Roles and modifiers can also use more verbose names, when preceded by
 a comma.  For example, the modifier string "Lwc" (or "L,white,colon")
 means the field has a label role (text that describes the next field)
 and should be followed by a colon ('c') and a space ('w').  The
@@ -986,8 +986,8 @@ the right instead of the left.
 - a leading zero ('0') indicating the output value should be padded on the
 left with zeroes instead of spaces (' ').
 - one or more digits ('0' - '9') indicating the minimum width of the
-argument.  If the width in columns of the output value is less that
-the minumum width, the value will be padded to reach the minimum.
+argument.  If the width in columns of the output value is less than
+the minimum width, the value will be padded to reach the minimum.
 - a period followed by one or more digits indicating the maximum
 number of bytes which will be examined for a string argument, or the maximum
 width for a non-string argument.  When handling ASCII strings this

Modified: head/contrib/libxo/libxo/libxo.c
==============================================================================
--- head/contrib/libxo/libxo/libxo.c	Sun May 29 01:40:48 2016	(r300924)
+++ head/contrib/libxo/libxo/libxo.c	Sun May 29 01:43:28 2016	(r300925)
@@ -56,7 +56,7 @@
  * (end of word, middle of word, etc) and many that affect characters
  * previously emitted.  Without content, it can't hope to tell us.
  * But it's the only standard tool we've got, so we use it.  We would
- * use wcswidth() but it typically just loops thru adding the results
+ * use wcswidth() but it typically just loops through adding the results
  * of wcwidth() calls in an entirely unhelpful way.
  *
  * Even then, there are many poor implementations (macosx), so we have
@@ -97,7 +97,7 @@
 
 /*
  * Three styles of specifying thread-local variables are supported.
- * configure.ac has the brains to run each possibility thru the
+ * configure.ac has the brains to run each possibility through the
  * compiler and see what works; we are left to define the THREAD_LOCAL
  * macro to the right value.  Most toolchains (clang, gcc) use
  * "before", but some (borland) use "after" and I've heard of some
@@ -988,7 +988,7 @@ xo_vsnprintf (xo_handle_t *xop, xo_buffe
 }
 
 /*
- * Print some data thru the handle.
+ * Print some data through the handle.
  */
 static int
 xo_printf_v (xo_handle_t *xop, const char *fmt, va_list vap)
@@ -1251,7 +1251,7 @@ xo_buf_append_locale (xo_handle_t *xop, 
 
 	cols += xo_buf_append_locale_from_utf8(xop, xbp, cp, slen);
 
-	/* Next time thru, we'll start at the next character */
+	/* Next time through, we'll start at the next character */
 	cp += slen - 1;
 	sp = cp + 1;
     }
@@ -2816,7 +2816,7 @@ xo_format_string (xo_handle_t *xop, xo_b
 	 * but if we did the work ourselves, then we need to do it.
 	 */
 	int delta = xfp->xf_width[XF_WIDTH_MIN] - cols;
-	if (!xo_buf_has_room(xbp, delta))
+	if (!xo_buf_has_room(xbp, xfp->xf_width[XF_WIDTH_MIN]))
 	    goto bail;
 
 	/*
@@ -3328,7 +3328,7 @@ xo_do_format_field (xo_handle_t *xop, xo
 		case XO_STYLE_XML:
 		    if (flags & XFF_TRIM_WS)
 			columns = rc = xo_trim_ws(xbp, rc);
-		    /* fall thru */
+		    /* FALLTHRU */
 		case XO_STYLE_HTML:
 		    rc = xo_escape_xml(xbp, rc, (flags & XFF_ATTR));
 		    break;
@@ -3687,7 +3687,7 @@ xo_buf_append_div (xo_handle_t *xop, con
 
     if (flags & XFF_ENCODE_ONLY) {
 	/*
-	 * Even if this is encode-only, we need to go thru the
+	 * Even if this is encode-only, we need to go through the
 	 * work of formatting it to make sure the args are cleared
 	 * from xo_vap.
 	 */
@@ -5342,7 +5342,7 @@ xo_gettext_finish_numbering_fields (xo_h
 }
 
 /*
- * The format string uses field numbers, so we need to whiffle thru it
+ * The format string uses field numbers, so we need to whiffle through it
  * and make sure everything's sane and lovely.
  */
 static int
@@ -6128,6 +6128,12 @@ xo_do_emit_fields (xo_handle_t *xop, xo_
 
     XOIF_CLEAR(xop, XOIF_REORDER);
 
+    /*
+     * If we've got enough data, flush it.
+     */
+    if (xo_buf_offset(&xop->xo_data) > XO_BUF_HIGH_WATER)
+	flush = 1;
+
     /* If we don't have an anchor, write the text out */
     if (flush && !XOIF_ISSET(xop, XOIF_ANCHOR)) {
 	if (xo_write(xop) < 0) 
@@ -6988,7 +6994,7 @@ xo_do_close_leaf_list (xo_handle_t *xop,
 
     case XO_STYLE_ENCODER:
 	rc = xo_encoder_handle(xop, XO_OP_CLOSE_LEAF_LIST, name, NULL);
-	/*fallthru*/
+	/* FALLTHRU */
 
     default:
 	xo_depth_change(xop, name, -1, 0, XSS_CLOSE_LEAF_LIST, XSF_LIST);
@@ -7780,9 +7786,9 @@ xo_parse_args (int argc, char **argv)
 	}
 
 	cp = argv[i] + sizeof(libxo_opt) - 1;
-	if (*cp == 0) {
+	if (*cp == '\0') {
 	    cp = argv[++i];
-	    if (cp == 0) {
+	    if (cp == NULL) {
 		xo_warnx("missing libxo option");
 		return -1;
 	    }
@@ -7879,7 +7885,7 @@ xo_set_version_h (xo_handle_t *xop, cons
 }
 
 /*
- * Set the version number for the API content being carried thru
+ * Set the version number for the API content being carried through
  * the xo handle.
  */
 void

Modified: head/contrib/libxo/libxo/xo_buf.h
==============================================================================
--- head/contrib/libxo/libxo/xo_buf.h	Sun May 29 01:40:48 2016	(r300924)
+++ head/contrib/libxo/libxo/xo_buf.h	Sun May 29 01:43:28 2016	(r300925)
@@ -19,8 +19,8 @@
 #ifndef XO_BUF_H
 #define XO_BUF_H
 
-#define XO_BUFSIZ	(8*1024) /* Initial buffer size */
-
+#define XO_BUFSIZ		(8*1024) /* Initial buffer size */
+#define XO_BUF_HIGH_WATER	(XO_BUFSIZ - 512) /* When to auto-flush */
 /*
  * xo_buffer_t: a memory buffer that can be grown as needed.  We
  * use them for building format strings and output data.

Modified: head/contrib/libxo/libxo/xo_encoder.c
==============================================================================
--- head/contrib/libxo/libxo/xo_encoder.c	Sun May 29 01:40:48 2016	(r300924)
+++ head/contrib/libxo/libxo/xo_encoder.c	Sun May 29 01:43:28 2016	(r300925)
@@ -313,7 +313,7 @@ xo_encoder_init (xo_handle_t *xop, const
 
 /*
  * A couple of function varieties here, to allow for multiple
- * use cases.  This varient is for when the main program knows
+ * use cases.  This variant is for when the main program knows
  * its own encoder needs.
  */
 xo_handle_t *

Modified: head/contrib/libxo/libxo/xo_format.5
==============================================================================
--- head/contrib/libxo/libxo/xo_format.5	Sun May 29 01:40:48 2016	(r300924)
+++ head/contrib/libxo/libxo/xo_format.5	Sun May 29 01:43:28 2016	(r300925)
@@ -116,7 +116,7 @@ The roles are listed below; only one rol
 .Pp
 When a role is not provided, the "value" role is used as the default.
 .Pp
-Roles and modifiers can also use more verbose names, when preceeded by
+Roles and modifiers can also use more verbose names, when preceded by
 a comma:
 .Bd -literal -offset indent
    EXAMPLE:
@@ -380,7 +380,7 @@ The modifier string "Vkq" means the
 field has a value role, that it is a key for the current instance, and
 that the value should be quoted when encoded for JSON.
 .Pp
-Roles and modifiers can also use more verbose names, when preceeded by
+Roles and modifiers can also use more verbose names, when preceded by
 a comma.
 For example, the modifier string "Lwc" (or "L,white,colon")
 means the field has a label role (text that describes the next field)

Modified: head/contrib/libxo/tests/core/saved/test_03.E.out
==============================================================================
--- head/contrib/libxo/tests/core/saved/test_03.E.out	Sun May 29 01:40:48 2016	(r300924)
+++ head/contrib/libxo/tests/core/saved/test_03.E.out	Sun May 29 01:43:28 2016	(r300925)
@@ -1,6 +1,18 @@
 op create: [] []
 op open_container: [employees] []
 op open_list: [employee] []
+op close_list: [employee] []
+op string: [extra] []
+op open_list: [memory] []
+op open_instance: [memory] []
+op string: [type] [name]
+op content: [in-use] [12345]
+op content: [memory-use] [54321]
+op string: [high-use] [-]
+op content: [requests] [32145]
+op close_instance: [memory] []
+op close_list: [memory] []
+op open_list: [employee] []
 op open_instance: [employee] []
 op string: [first-name] [Terry]
 op string: [last-name] [Jones]

Modified: head/contrib/libxo/tests/core/saved/test_03.H.out
==============================================================================
--- head/contrib/libxo/tests/core/saved/test_03.H.out	Sun May 29 01:40:48 2016	(r300924)
+++ head/contrib/libxo/tests/core/saved/test_03.H.out	Sun May 29 01:43:28 2016	(r300925)
@@ -1 +1 @@
-<div class="line"><div class="data" data-tag="first-name">Terry</div><div class="text"> </div><div class="data" data-tag="last-name">Jones</div><div class="text"> works in dept #</div><div class="data" data-tag="department">660</div></div><div class="line"><div class="data" data-tag="first-name">Leslie</div><div class="text"> </div><div class="data" data-tag="last-name">Patterson</div><div class="text"> works in dept #</div><div class="data" data-tag="department">341</div></div><div class="line"><div class="data" data-tag="first-name">Ashley</div><div class="text"> </div><div class="data" data-tag="last-name">Smith</div><div class="text"> works in dept #</div><div class="data" data-tag="department">1440</div></div>
\ No newline at end of file
+<div class="line"><div class="text">[</div><div class="data" data-tag="extra"></div><div class="text">]</div></div><div class="line"><div class="title">         Type</div><div class="text"> </div><div class="title">InUse</div><div class="text"> </div><div class="title">MemUse</div><div class="text"> </div><div class="title">HighUse</div><div class="text"> </div><div class="title">Requests</div><div class="text">  </div><div class="title">Size(s)</div></div><div class="line"><div class="data" data-tag="type">         name</div><div class="text"> </div><div class="data" data-tag="in-use">12345</div><div class="text"> </div><div class="data" data-tag="memory-use">54321</div><div class="units">K</div><div class="text"> </div><div class="data" data-tag="high-use">      -</div><div class="text"> </div><div class="data" data-tag="requests">   32145</div><div class="text">  </div></div><div class="line"><div class="data" data-tag="first-name">Terry</div><div class="text"> </div><div class="
 data" data-tag="last-name">Jones</div><div class="text"> works in dept #</div><div class="data" data-tag="department">660</div></div><div class="line"><div class="data" data-tag="first-name">Leslie</div><div class="text"> </div><div class="data" data-tag="last-name">Patterson</div><div class="text"> works in dept #</div><div class="data" data-tag="department">341</div></div><div class="line"><div class="data" data-tag="first-name">Ashley</div><div class="text"> </div><div class="data" data-tag="last-name">Smith</div><div class="text"> works in dept #</div><div class="data" data-tag="department">1440</div></div><div class="line"><div class="text">done</div></div>
\ No newline at end of file

Modified: head/contrib/libxo/tests/core/saved/test_03.HIPx.out
==============================================================================
--- head/contrib/libxo/tests/core/saved/test_03.HIPx.out	Sun May 29 01:40:48 2016	(r300924)
+++ head/contrib/libxo/tests/core/saved/test_03.HIPx.out	Sun May 29 01:43:28 2016	(r300925)
@@ -1,4 +1,35 @@
 <div class="line">
+  <div class="text">[</div>
+  <div class="data" data-tag="extra" data-xpath="/employees/extra"></div>
+  <div class="text">]</div>
+</div>
+<div class="line">
+  <div class="title">         Type</div>
+  <div class="text"> </div>
+  <div class="title">InUse</div>
+  <div class="text"> </div>
+  <div class="title">MemUse</div>
+  <div class="text"> </div>
+  <div class="title">HighUse</div>
+  <div class="text"> </div>
+  <div class="title">Requests</div>
+  <div class="text">  </div>
+  <div class="title">Size(s)</div>
+</div>
+<div class="line">
+  <div class="data" data-tag="type" data-xpath="/employees/memory/type">         name</div>
+  <div class="text"> </div>
+  <div class="data" data-tag="in-use" data-xpath="/employees/memory[type = 'name']/in-use">12345</div>
+  <div class="text"> </div>
+  <div class="data" data-tag="memory-use" data-xpath="/employees/memory[type = 'name']/memory-use">54321</div>
+  <div class="units">K</div>
+  <div class="text"> </div>
+  <div class="data" data-tag="high-use" data-xpath="/employees/memory[type = 'name']/high-use">      -</div>
+  <div class="text"> </div>
+  <div class="data" data-tag="requests" data-xpath="/employees/memory[type = 'name']/requests">   32145</div>
+  <div class="text">  </div>
+</div>
+<div class="line">
   <div class="data" data-tag="first-name" data-xpath="/employees/employee/first-name" data-type="string" data-help="First name of employee">Terry</div>
   <div class="text"> </div>
   <div class="data" data-tag="last-name" data-xpath="/employees/employee/last-name" data-type="string" data-help="Last name of employee">Jones</div>
@@ -19,3 +50,6 @@
   <div class="text"> works in dept #</div>
   <div class="data" data-tag="department" data-xpath="/employees/employee/department">1440</div>
 </div>
+<div class="line">
+  <div class="text">done</div>
+</div>

Modified: head/contrib/libxo/tests/core/saved/test_03.HP.out
==============================================================================
--- head/contrib/libxo/tests/core/saved/test_03.HP.out	Sun May 29 01:40:48 2016	(r300924)
+++ head/contrib/libxo/tests/core/saved/test_03.HP.out	Sun May 29 01:43:28 2016	(r300925)
@@ -1,4 +1,35 @@
 <div class="line">
+  <div class="text">[</div>
+  <div class="data" data-tag="extra"></div>
+  <div class="text">]</div>
+</div>
+<div class="line">
+  <div class="title">         Type</div>
+  <div class="text"> </div>
+  <div class="title">InUse</div>
+  <div class="text"> </div>
+  <div class="title">MemUse</div>
+  <div class="text"> </div>
+  <div class="title">HighUse</div>
+  <div class="text"> </div>
+  <div class="title">Requests</div>
+  <div class="text">  </div>
+  <div class="title">Size(s)</div>
+</div>
+<div class="line">
+  <div class="data" data-tag="type">         name</div>
+  <div class="text"> </div>
+  <div class="data" data-tag="in-use">12345</div>
+  <div class="text"> </div>
+  <div class="data" data-tag="memory-use">54321</div>
+  <div class="units">K</div>
+  <div class="text"> </div>
+  <div class="data" data-tag="high-use">      -</div>
+  <div class="text"> </div>
+  <div class="data" data-tag="requests">   32145</div>
+  <div class="text">  </div>
+</div>
+<div class="line">
   <div class="data" data-tag="first-name">Terry</div>
   <div class="text"> </div>
   <div class="data" data-tag="last-name">Jones</div>
@@ -19,3 +50,6 @@
   <div class="text"> works in dept #</div>
   <div class="data" data-tag="department">1440</div>
 </div>
+<div class="line">
+  <div class="text">done</div>
+</div>

Modified: head/contrib/libxo/tests/core/saved/test_03.J.out
==============================================================================
--- head/contrib/libxo/tests/core/saved/test_03.J.out	Sun May 29 01:40:48 2016	(r300924)
+++ head/contrib/libxo/tests/core/saved/test_03.J.out	Sun May 29 01:43:28 2016	(r300925)
@@ -1,2 +1,2 @@
-{"employees": {"employee": [{"first-name":"Terry","last-name":"Jones","department":660}, {"first-name":"Leslie","last-name":"Patterson","department":341}, {"first-name":"Ashley","last-name":"Smith","department":1440}]}
+{"employees": {"employee": [],"extra":"", "memory": [{"type":"name","in-use":12345,"memory-use":54321,"high-use":"-","requests":32145}], "employee": [{"first-name":"Terry","last-name":"Jones","department":660}, {"first-name":"Leslie","last-name":"Patterson","department":341}, {"first-name":"Ashley","last-name":"Smith","department":1440}]}
 }

Modified: head/contrib/libxo/tests/core/saved/test_03.JP.out
==============================================================================
--- head/contrib/libxo/tests/core/saved/test_03.JP.out	Sun May 29 01:40:48 2016	(r300924)
+++ head/contrib/libxo/tests/core/saved/test_03.JP.out	Sun May 29 01:43:28 2016	(r300925)
@@ -1,6 +1,18 @@
 {
   "employees": {
     "employee": [
+    ],
+    "extra": "",
+    "memory": [
+      {
+        "type": "name",
+        "in-use": 12345,
+        "memory-use": 54321,
+        "high-use": "-",
+        "requests": 32145
+      }
+    ],
+    "employee": [
       {
         "first-name": "Terry",
         "last-name": "Jones",

Modified: head/contrib/libxo/tests/core/saved/test_03.T.out
==============================================================================
--- head/contrib/libxo/tests/core/saved/test_03.T.out	Sun May 29 01:40:48 2016	(r300924)
+++ head/contrib/libxo/tests/core/saved/test_03.T.out	Sun May 29 01:43:28 2016	(r300925)
@@ -1,3 +1,7 @@
+[]
+         Type InUse MemUse HighUse Requests  Size(s)
+         name 12345 54321K       -    32145  
 Terry Jones works in dept #660
 Leslie Patterson works in dept #341
 Ashley Smith works in dept #1440
+done

Modified: head/contrib/libxo/tests/core/saved/test_03.X.out
==============================================================================
--- head/contrib/libxo/tests/core/saved/test_03.X.out	Sun May 29 01:40:48 2016	(r300924)
+++ head/contrib/libxo/tests/core/saved/test_03.X.out	Sun May 29 01:43:28 2016	(r300925)
@@ -1 +1 @@
-<employees><employee><first-name>Terry</first-name><last-name>Jones</last-name><department>660</department></employee><employee><first-name>Leslie</first-name><last-name>Patterson</last-name><department>341</department></employee><employee><first-name>Ashley</first-name><last-name>Smith</last-name><department>1440</department></employee></employees>
\ No newline at end of file
+<employees><extra></extra><memory><type>name</type><in-use>12345</in-use><memory-use>54321</memory-use><high-use>-</high-use><requests>32145</requests></memory><employee><first-name>Terry</first-name><last-name>Jones</last-name><department>660</department></employee><employee><first-name>Leslie</first-name><last-name>Patterson</last-name><department>341</department></employee><employee><first-name>Ashley</first-name><last-name>Smith</last-name><department>1440</department></employee></employees>
\ No newline at end of file

Modified: head/contrib/libxo/tests/core/saved/test_03.XP.out
==============================================================================
--- head/contrib/libxo/tests/core/saved/test_03.XP.out	Sun May 29 01:40:48 2016	(r300924)
+++ head/contrib/libxo/tests/core/saved/test_03.XP.out	Sun May 29 01:43:28 2016	(r300925)
@@ -1,4 +1,12 @@
 <employees>
+  <extra></extra>
+  <memory>
+    <type>name</type>
+    <in-use>12345</in-use>
+    <memory-use>54321</memory-use>
+    <high-use>-</high-use>
+    <requests>32145</requests>
+  </memory>
   <employee>
     <first-name>Terry</first-name>
     <last-name>Jones</last-name>

Modified: head/contrib/libxo/tests/core/test_03.c
==============================================================================
--- head/contrib/libxo/tests/core/test_03.c	Sun May 29 01:40:48 2016	(r300924)
+++ head/contrib/libxo/tests/core/test_03.c	Sun May 29 01:43:28 2016	(r300925)
@@ -25,6 +25,9 @@ int info_count = (sizeof(info) / sizeof(
 int
 main (int argc, char **argv)
 {
+    unsigned opt_count = 1;
+    unsigned opt_extra = 0;
+
     struct employee {
 	const char *e_first;
 	const char *e_last;
@@ -34,24 +37,68 @@ main (int argc, char **argv)
 	{ "Leslie", "Patterson", 341 },
 	{ "Ashley", "Smith", 1440 },
 	{ NULL, NULL }
-    }, *ep = employees;
+    }, *ep;
 
     argc = xo_parse_args(argc, argv);
     if (argc < 0)
 	return 1;
 
+    for (argc = 1; argv[argc]; argc++) {
+	if (strcmp(argv[argc], "count") == 0) {
+	    if (argv[argc + 1])
+		opt_count = atoi(argv[++argc]);
+	} else if (strcmp(argv[argc], "extra") == 0) {
+	    if (argv[argc + 1])
+		opt_extra = atoi(argv[++argc]);
+	}
+    }
+
     xo_set_info(NULL, info, info_count);
 
     xo_open_container("employees");
     xo_open_list("employee");
 
-    for ( ; ep->e_first; ep++) {
-	xo_open_instance("employee");
-	xo_emit("{:first-name} {:last-name} works in dept #{:department/%u}\n",
-		ep->e_first, ep->e_last, ep->e_dept);
-	xo_close_instance("employee");
+    xo_emit("[{:extra/%*s}]\n", opt_extra, "");
+
+    xo_emit("{T:/%13s} {T:/%5s} {T:/%6s} {T:/%7s} {T:/%8s}  {T:Size(s)}\n",
+	    "Type", "InUse", "MemUse", "HighUse", "Requests");
+    xo_open_list("memory");
+    xo_open_instance("memory");
+
+#define PRIu64 "llu"
+#define TO_ULL(_x) ((unsigned long long) _x)
+    xo_emit("{k:type/%13s} {:in-use/%5" PRIu64 "} "
+	    "{:memory-use/%5" PRIu64 "}{U:K} {:high-use/%7s} "
+	    "{:requests/%8" PRIu64 "}  ",
+	    "name", TO_ULL(12345), TO_ULL(54321), "-", TO_ULL(32145));
+
+    int first = 1, i;
+#if 0
+    xo_open_list("size");
+    for (i = 0; i < 32; i++) {
+	if (!first)
+	    xo_emit(",");
+	xo_emit("{l:size/%d}", 1 << (i + 4));
+	first = 0;
+    }
+    xo_close_list("size");
+#endif
+    xo_close_instance("memory");
+    xo_emit("\n");
+    xo_close_list("memory");
+
+    while (opt_count-- != 0) {
+	for (ep = employees; ep->e_first; ep++) {
+	    xo_open_instance("employee");
+	    xo_emit("{:first-name} {:last-name} works in "
+		    "dept #{:department/%u}\n",
+		    ep->e_first, ep->e_last, ep->e_dept);
+	    xo_close_instance("employee");
+	}
     }
 
+    xo_emit("done\n");
+
     xo_close_list("employee");
     xo_close_container("employees");
 

Modified: head/lib/libxo/add.man
==============================================================================
--- head/lib/libxo/add.man	Sun May 29 01:40:48 2016	(r300924)
+++ head/lib/libxo/add.man	Sun May 29 01:43:28 2016	(r300925)
@@ -3,10 +3,10 @@
 .Fx
 uses
 .Nm libxo
-version 0.6.1.
+version 0.6.2.
 Complete documentation can be found on github:
 .Bd -literal -offset indent
-http://juniper.github.io/libxo/0.6.1/libxo\-manual.html
+http://juniper.github.io/libxo/0.6.2/libxo\-manual.html
 .Ed
 .Pp
 .Nm libxo

Modified: head/lib/libxo/xo_config.h
==============================================================================
--- head/lib/libxo/xo_config.h	Sun May 29 01:40:48 2016	(r300924)
+++ head/lib/libxo/xo_config.h	Sun May 29 01:43:28 2016	(r300925)
@@ -183,16 +183,16 @@
 /* #undef LIBXO_TEXT_ONLY */
 
 /* Version number as dotted value */
-#define LIBXO_VERSION "0.6.1"
+#define LIBXO_VERSION "0.6.2"
 
 /* Version number extra information */
 #define LIBXO_VERSION_EXTRA ""
 
 /* Version number as a number */
-#define LIBXO_VERSION_NUMBER 6001
+#define LIBXO_VERSION_NUMBER 6002
 
 /* Version number as string */
-#define LIBXO_VERSION_STRING "6001"
+#define LIBXO_VERSION_STRING "6002"
 
 /* Enable local wcwidth implementation */
 #define LIBXO_WCWIDTH 1
@@ -210,7 +210,7 @@
 #define PACKAGE_NAME "libxo"
 
 /* Define to the full name and version of this package. */
-#define PACKAGE_STRING "libxo 0.6.1"
+#define PACKAGE_STRING "libxo 0.6.2"
 
 /* Define to the one symbol short name of this package. */
 #define PACKAGE_TARNAME "libxo"
@@ -219,7 +219,7 @@
 #define PACKAGE_URL ""
 
 /* Define to the version of this package. */
-#define PACKAGE_VERSION "0.6.1"
+#define PACKAGE_VERSION "0.6.2"
 
 /* If using the C implementation of alloca, define if you know the
    direction of stack growth for your system; otherwise it will be
@@ -233,7 +233,7 @@
 #define STDC_HEADERS 1
 
 /* Version number of package */
-#define VERSION "0.6.1"
+#define VERSION "0.6.2"
 
 /* Retain hash bucket size */
 /* #undef XO_RETAIN_SIZE */


More information about the svn-src-head mailing list