Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
Phil Shafer committed May 28, 2016
2 parents 8599461 + 29c8ac0 commit 84e94cd
Show file tree
Hide file tree
Showing 15 changed files with 188 additions and 31 deletions.
10 changes: 5 additions & 5 deletions doc/libxo.txt
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ explained in detail in the rest of this section.
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.

Expand Down Expand Up @@ -469,7 +469,7 @@ content. The roles are listed below; only one role is permitted:

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:
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
30 changes: 18 additions & 12 deletions libxo/libxo.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -988,7 +988,7 @@ xo_vsnprintf (xo_handle_t *xop, xo_buffer_t *xbp, const char *fmt, va_list vap)
}

/*
* 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)
Expand Down Expand Up @@ -1251,7 +1251,7 @@ xo_buf_append_locale (xo_handle_t *xop, xo_buffer_t *xbp,

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;
}
Expand Down Expand Up @@ -2816,7 +2816,7 @@ xo_format_string (xo_handle_t *xop, xo_buffer_t *xbp, xo_xff_flags_t flags,
* 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;

/*
Expand Down Expand Up @@ -3328,7 +3328,7 @@ xo_do_format_field (xo_handle_t *xop, xo_buffer_t *xbp,
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;
Expand Down Expand Up @@ -3687,7 +3687,7 @@ xo_buf_append_div (xo_handle_t *xop, const char *class, xo_xff_flags_t flags,

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.
*/
Expand Down Expand Up @@ -5342,7 +5342,7 @@ xo_gettext_finish_numbering_fields (xo_handle_t *xop UNUSED,
}

/*
* 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
Expand Down Expand Up @@ -6128,6 +6128,12 @@ xo_do_emit_fields (xo_handle_t *xop, xo_field_info_t *fields,

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)
Expand Down Expand Up @@ -6988,7 +6994,7 @@ xo_do_close_leaf_list (xo_handle_t *xop, const char *name)

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);
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -7879,7 +7885,7 @@ xo_set_version_h (xo_handle_t *xop, const char *version)
}

/*
* 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
Expand Down
4 changes: 2 additions & 2 deletions libxo/xo_buf.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion libxo/xo_encoder.c
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ xo_encoder_init (xo_handle_t *xop, const char *name)

/*
* 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 *
Expand Down
4 changes: 2 additions & 2 deletions libxo/xo_format.5
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ The roles are listed below; only one role is permitted:
.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:
Expand Down Expand Up @@ -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)
Expand Down
12 changes: 12 additions & 0 deletions tests/core/saved/test_03.E.out
Original file line number Diff line number Diff line change
@@ -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]
Expand Down
2 changes: 1 addition & 1 deletion tests/core/saved/test_03.H.out
Original file line number Diff line number Diff line change
@@ -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>
<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>
34 changes: 34 additions & 0 deletions tests/core/saved/test_03.HIPx.out
Original file line number Diff line number Diff line change
@@ -1,3 +1,34 @@
<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>
Expand All @@ -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>
34 changes: 34 additions & 0 deletions tests/core/saved/test_03.HP.out
Original file line number Diff line number Diff line change
@@ -1,3 +1,34 @@
<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>
Expand All @@ -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>
2 changes: 1 addition & 1 deletion tests/core/saved/test_03.J.out
Original file line number Diff line number Diff line change
@@ -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}]}
}
12 changes: 12 additions & 0 deletions tests/core/saved/test_03.JP.out
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
{
"employees": {
"employee": [
],
"extra": "",
"memory": [
{
"type": "name",
"in-use": 12345,
"memory-use": 54321,
"high-use": "-",
"requests": 32145
}
],
"employee": [
{
"first-name": "Terry",
Expand Down
4 changes: 4 additions & 0 deletions tests/core/saved/test_03.T.out
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion tests/core/saved/test_03.X.out
Original file line number Diff line number Diff line change
@@ -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>
<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>
8 changes: 8 additions & 0 deletions tests/core/saved/test_03.XP.out
Original file line number Diff line number Diff line change
@@ -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>
Expand Down
Loading

0 comments on commit 84e94cd

Please sign in to comment.