cmark

Unnamed repository; edit this file 'description' to name the repository.

commit d9f7581443bd786e7d17532f6678efd2ee77c26f
parent de1e28217f0da80b928bca0ca09541c0401314ee
Author: John MacFarlane <jgm@berkeley.edu>
Date:   Mon, 29 Sep 2014 22:59:46 -0700

Merge branch 'master' into newemphasis

Conflicts:
	Makefile
	js/stmd.js

Diffstat:
MMakefile | 28+++++++++++++++++++---------
Mruntests.pl | 11+++++++++--
Mspec.txt | 73+++++++++++++++++++++++++++++++++++++++++++------------------------------
Msrc/blocks.c | 1381++++++++++++++++++++++++++++++++++++++++---------------------------------------
Dsrc/bstrlib.c | 2979-------------------------------------------------------------------------------
Dsrc/bstrlib.h | 304-------------------------------------------------------------------------------
Asrc/buffer.c | 354+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Asrc/buffer.h | 114+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Rsrc/case_fold_switch.c -> src/case_fold_switch.inc | 0
Dsrc/casefold.c | 2699-------------------------------------------------------------------------------
Asrc/chunk.h | 92+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Dsrc/detab.c | 48------------------------------------------------
Dsrc/getopt.c | 199-------------------------------------------------------------------------------
Dsrc/html.c | 276-------------------------------------------------------------------------------
Asrc/html/houdini.h | 46++++++++++++++++++++++++++++++++++++++++++++++
Asrc/html/houdini_href_e.c | 107+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Asrc/html/houdini_html_e.c | 81+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Asrc/html/houdini_html_u.c | 111+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Asrc/html/html.c | 228+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Asrc/html/html_unescape.gperf | 2131+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Asrc/html/html_unescape.h | 9746+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Msrc/inlines.c | 1677++++++++++++++++++++++++++++++++++++++-----------------------------------------
Asrc/inlines.h | 13+++++++++++++
Msrc/main.c | 142+++++++++++++++++++++++++++++++++----------------------------------------------
Msrc/print.c | 314++++++++++++++++++++++++++++++++++++++++---------------------------------------
Asrc/references.c | 141+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Asrc/references.h | 27+++++++++++++++++++++++++++
Msrc/scanners.h | 57++++++++++++++++++++++++++++++++++++++++++---------------
Msrc/scanners.re | 96++++++++++++++++++++++++++++++++-----------------------------------------------
Msrc/stmd.h | 194++++++++++++++++++++++++++++++++++++++-----------------------------------------
Msrc/utf8.c | 277++++++++++++++++++++++++++++++++++++++++++++++++++++---------------------------
Msrc/utf8.h | 17++++++++++++-----
Dsrc/uthash.h | 948-------------------------------------------------------------------------------
33 files changed, 15370 insertions(+), 9541 deletions(-)
diff --git a/Makefile b/Makefile
@@ -1,4 +1,4 @@
-CFLAGS?=-g -O3 -Wall -Wextra -std=c99 -Isrc $(OPTFLAGS)
+CFLAGS?=-g -O3 -Wall -Wextra -std=c99 -Isrc -Wno-missing-field-initializers $(OPTFLAGS)
 LDFLAGS?=-g -O3 -Wall -Werror
 SRCDIR?=src
 DATADIR?=data
@@ -6,7 +6,7 @@ DATADIR?=data
 PROG?=./stmd
 
 .PHONY: all oldtests test spec benchjs testjs
-all: $(SRCDIR)/case_fold_switch.c $(PROG)
+all: $(SRCDIR)/case_fold_switch.inc $(PROG)
 
 README.html: README.md template.html
 	pandoc --template template.html -S -s -t html5 -o $@ $<
@@ -41,15 +41,22 @@ testjs: spec.txt
 benchjs:
 	node js/bench.js ${BENCHINP}
 
-$(PROG): $(SRCDIR)/main.c $(SRCDIR)/inlines.o $(SRCDIR)/blocks.o $(SRCDIR)/detab.o $(SRCDIR)/bstrlib.o $(SRCDIR)/scanners.o $(SRCDIR)/print.o $(SRCDIR)/html.o $(SRCDIR)/utf8.o
-	$(CC) $(LDFLAGS) -o $@ $^
+HTML_OBJ=$(SRCDIR)/html/html.o $(SRCDIR)/html/houdini_href_e.o $(SRCDIR)/html/houdini_html_e.o $(SRCDIR)/html/houdini_html_u.o
+
+STMD_OBJ=$(SRCDIR)/inlines.o $(SRCDIR)/buffer.o $(SRCDIR)/blocks.o $(SRCDIR)/scanners.c $(SRCDIR)/print.o $(SRCDIR)/utf8.o $(SRCDIR)/references.c
+
+$(PROG): $(SRCDIR)/html/html_unescape.h $(SRCDIR)/case_fold_switch.inc $(HTML_OBJ) $(STMD_OBJ) $(SRCDIR)/main.c
+	$(CC) $(LDFLAGS) -o $@ $(HTML_OBJ) $(STMD_OBJ) $(SRCDIR)/main.c
 
 $(SRCDIR)/scanners.c: $(SRCDIR)/scanners.re
 	re2c --case-insensitive -bis $< > $@ || (rm $@ && false)
 
-$(SRCDIR)/case_fold_switch.c: $(DATADIR)/CaseFolding-3.2.0.txt
+$(SRCDIR)/case_fold_switch.inc: $(DATADIR)/CaseFolding-3.2.0.txt
 	perl mkcasefold.pl < $< > $@
 
+$(SRCDIR)/html/html_unescape.h: $(SRCDIR)/html/html_unescape.gperf
+	gperf -I -t -N find_entity -H hash_entity -K entity -C -l --null-strings -m5 $< > $@
+
 .PHONY: leakcheck clean fuzztest dingus upload
 
 dingus:
@@ -58,6 +65,9 @@ dingus:
 leakcheck: $(PROG)
 	cat oldtests/*/*.markdown | valgrind --leak-check=full --dsymutil=yes $(PROG)
 
+operf: $(PROG)
+	operf $(PROG) <bench.md >/dev/null
+
 fuzztest:
 	for i in `seq 1 10`; do \
 	  time cat /dev/urandom | head -c 100000 | iconv -f latin1 -t utf-8 | $(PROG) >/dev/null; done
@@ -69,7 +79,7 @@ update-site: spec.html narrative.html
 	(cd _site ; git pull ; git commit -a -m "Updated site for latest spec, narrative, js" ; git push; cd ..)
 
 clean:
-	-rm test $(SRCDIR)/*.o $(SRCDIR)/scanners.c
-	-rm -r *.dSYM
-	-rm README.html
-	-rm spec.md fuzz.txt spec.html
+	-rm -f test $(SRCDIR)/*.o $(SRCDIR)/scanners.c $(SRCDIR)/html/*.o
+	-rm -rf *.dSYM
+	-rm -f README.html
+	-rm -f spec.md fuzz.txt spec.html
diff --git a/runtests.pl b/runtests.pl
@@ -38,7 +38,9 @@ sub tidy
     } elsif (/<\/pre/) {
       $inpre = 0;
     }
-    if ($inpre) {
+    # remove \r to allow mixing linux/windows newlines
+	  s/\r//;
+	  if ($inpre) {
       print $outfh $_;
     } else {
       # remove leading spaces
@@ -49,6 +51,7 @@ sub tidy
       s/  */ /;
       # collapse space before /> in tag
       s/  *\/>/\/>/;
+	  s/>\n$/>/;
       # skip blank line
       if (/^$/) {
         next;
@@ -69,15 +72,17 @@ sub dotest
   # We use → to indicate tab and ␣ space in the spec
   $markdown =~ s/→/\t/g;s/␣/ /g;
   $html =~ s/→/\t/g;s/␣/ /g;
-  open2(my $out, my $in, @PROG);
+  my $pid = open2(my $out, my $in, @PROG);
   print $in $markdown;
   close $in;
   flush $out;
   $actual = do { local $/; <$out>; };
   close $out;
+  waitpid($pid, 0);
   $html   = &tidy($html);
   $actual = &tidy($actual);
   $actual =~ s/\&#39;/'/;
+
   if ($actual eq $html) {
     print colored("✓", "green");
     return 1;
@@ -89,8 +94,10 @@ sub dotest
     print $markdown;
     print "=== expected ===============\n";
     print $html;
+	print "\n";
     print "=== got ====================\n";
     print $actual;
+	print "\n";
     print color "black";
     return 0;
   }
diff --git a/spec.txt b/spec.txt
@@ -2,8 +2,8 @@
 title: CommonMark Spec
 author:
 - John MacFarlane
-version: 1
-date: 2014-09-06
+version: 2
+date: 2014-09-19
 ...
 
 # Introduction
@@ -1682,7 +1682,7 @@ them.
 
 [Foo bar]
 .
-<p><a href="my url" title="title">Foo bar</a></p>
+<p><a href="my%20url" title="title">Foo bar</a></p>
 .
 
 The title may be omitted:
@@ -1745,7 +1745,7 @@ case-insensitive (see [matches](#matches)).
 
 [αγω]
 .
-<p><a href="/φου">αγω</a></p>
+<p><a href="/%CF%86%CE%BF%CF%85">αγω</a></p>
 .
 
 Here is a link reference definition with no corresponding link.
@@ -3688,7 +3688,7 @@ raw HTML:
 .
 <http://google.com?find=\*>
 .
-<p><a href="http://google.com?find=\*">http://google.com?find=\*</a></p>
+<p><a href="http://google.com?find=%5C*">http://google.com?find=\*</a></p>
 .
 
 .
@@ -3727,47 +3727,59 @@ foo
 
 ## Entities
 
-Entities are parsed as entities, not as literal text, in all contexts
-except code spans and code blocks. Three kinds of entities are recognized.
+With the goal of making this standard as HTML-agnostic as possible, all HTML valid HTML Entities in any
+context are recognized as such and converted into their actual values (i.e. the UTF8 characters representing
+the entity itself) before they are stored in the AST.
+
+This allows implementations that target HTML output to trivially escape the entities when generating HTML,
+and simplifies the job of implementations targetting other languages, as these will only need to handle the
+UTF8 chars and need not be HTML-entity aware.
 
 [Named entities](#name-entities) <a id="named-entities"></a> consist of `&`
-+ a string of 2-32 alphanumerics beginning with a letter + `;`.
++ any of the valid HTML5 entity names + `;`. The [following document](http://www.whatwg.org/specs/web-apps/current-work/multipage/entities.json)
+is used as an authoritative source of the valid entity names and their corresponding codepoints.
+
+Conforming implementations that target Markdown don't need to generate entities for all the valid
+named entities that exist, with the exception of `"` (`&quot;`), `&` (`&amp;`), `<` (`&lt;`) and `>` (`&gt;`),
+which always need to be written as entities for security reasons.
 
 .
 &nbsp; &amp; &copy; &AElig; &Dcaron; &frac34; &HilbertSpace; &DifferentialD; &ClockwiseContourIntegral;
 .
-<p>&nbsp; &amp; &copy; &AElig; &Dcaron; &frac34; &HilbertSpace; &DifferentialD; &ClockwiseContourIntegral;</p>
+<p>  &amp; © Æ Ď ¾ ℋ ⅆ ∲</p>
 .
 
 [Decimal entities](#decimal-entities) <a id="decimal-entities"></a>
-consist of `&#` + a string of 1--8 arabic digits + `;`.
+consist of `&#` + a string of 1--8 arabic digits + `;`. Again, these entities need to be recognised
+and tranformed into their corresponding UTF8 codepoints. Invalid Unicode codepoints will be written
+as the "unknown codepoint" character (`0xFFFD`)
 
 .
-&#1; &#35; &#1234; &#992; &#98765432;
+&#35; &#1234; &#992; &#98765432;
 .
-<p>&#1; &#35; &#1234; &#992; &#98765432;</p>
+<p># Ӓ Ϡ �</p>
 .
 
 [Hexadecimal entities](#hexadecimal-entities) <a id="hexadecimal-entities"></a>
 consist of `&#` + either `X` or `x` + a string of 1-8 hexadecimal digits
-+ `;`.
++ `;`. They will also be parsed and turned into their corresponding UTF8 values in the AST.
 
 .
-&#x1; &#X22; &#XD06; &#xcab;
+&#X22; &#XD06; &#xcab;
 .
-<p>&#x1; &#X22; &#XD06; &#xcab;</p>
+<p>&quot; ആ ಫ</p>
 .
 
 Here are some nonentities:
 
 .
-&nbsp &x; &#; &#x; &#123456789; &ThisIsWayTooLongToBeAnEntityIsntIt; &hi?;
+&nbsp &x; &#; &#x; &ThisIsWayTooLongToBeAnEntityIsntIt; &hi?;
 .
-<p>&amp;nbsp &amp;x; &amp;#; &amp;#x; &amp;#123456789; &amp;ThisIsWayTooLongToBeAnEntityIsntIt; &amp;hi?;</p>
+<p>&amp;nbsp &amp;x; &amp;#; &amp;#x; &amp;ThisIsWayTooLongToBeAnEntityIsntIt; &amp;hi?;</p>
 .
 
 Although HTML5 does accept some entities without a trailing semicolon
-(such as `&copy`), these are not recognized as entities here:
+(such as `&copy`), these are not recognized as entities here, because it makes the grammar too ambiguous:
 
 .
 &copy
@@ -3775,13 +3787,12 @@ Although HTML5 does accept some entities without a trailing semicolon
 <p>&amp;copy</p>
 .
 
-On the other hand, many strings that are not on the list of HTML5
-named entities are recognized as entities here:
+Strings that are not on the list of HTML5 named entities are not recognized as entities either:
 
 .
 &MadeUpEntity;
 .
-<p>&MadeUpEntity;</p>
+<p>&amp;MadeUpEntity;</p>
 .
 
 Entities are recognized in any context besides code spans or
@@ -3797,7 +3808,7 @@ code blocks, including raw HTML, URLs, [link titles](#link-title), and
 .
 [foo](/f&ouml;&ouml; "f&ouml;&ouml;")
 .
-<p><a href="/f&ouml;&ouml;" title="f&ouml;&ouml;">foo</a></p>
+<p><a href="/f%C3%B6%C3%B6" title="föö">foo</a></p>
 .
 
 .
@@ -3805,7 +3816,7 @@ code blocks, including raw HTML, URLs, [link titles](#link-title), and
 
 [foo]: /f&ouml;&ouml; "f&ouml;&ouml;"
 .
-<p><a href="/f&ouml;&ouml;" title="f&ouml;&ouml;">foo</a></p>
+<p><a href="/f%C3%B6%C3%B6" title="föö">foo</a></p>
 .
 
 .
@@ -3813,7 +3824,7 @@ code blocks, including raw HTML, URLs, [link titles](#link-title), and
 foo
 ```
 .
-<pre><code class="language-f&ouml;&ouml;">foo
+<pre><code class="language-föö">foo
 </code></pre>
 .
 
@@ -3946,7 +3957,7 @@ But this is a link:
 .
 <http://foo.bar.`baz>`
 .
-<p><a href="http://foo.bar.`baz">http://foo.bar.`baz</a>`</p>
+<p><a href="http://foo.bar.%60baz">http://foo.bar.`baz</a>`</p>
 .
 
 And this is an HTML tag:
@@ -4030,7 +4041,7 @@ for efficient parsing strategies that do not backtrack:
 
     (a) it is not part of a sequence of four or more unescaped `_`s,
     (b) it is not followed by whitespace,
-    (c) is is not preceded by an ASCII alphanumeric character, and
+    (c) it is not preceded by an ASCII alphanumeric character, and
     (d) either it is not followed by a `_` character or it is
         followed immediately by emphasis or strong emphasis.
 
@@ -4754,7 +4765,7 @@ braces:
 .
 [link](</my uri>)
 .
-<p><a href="/my uri">link</a></p>
+<p><a href="/my%20uri">link</a></p>
 .
 
 The destination cannot contain line breaks, even with pointy braces:
@@ -4805,12 +4816,14 @@ in Markdown:
 <p><a href="foo):">link</a></p>
 .
 
-URL-escaping and entities should be left alone inside the destination:
+URL-escaping and should be left alone inside the destination, as all URL-escaped characters
+are also valid URL characters. HTML entities in the destination will be parsed into their UTF8
+codepoints, as usual, and optionally URL-escaped when written as HTML.
 
 .
 [link](foo%20b&auml;)
 .
-<p><a href="foo%20b&auml;">link</a></p>
+<p><a href="foo%20b%C3%A4">link</a></p>
 .
 
 Note that, because titles can often be parsed as destinations,
@@ -4820,7 +4833,7 @@ get unexpected results:
 .
 [link]("title")
 .
-<p><a href="&quot;title&quot;">link</a></p>
+<p><a href="%22title%22">link</a></p>
 .
 
 Titles may be in single quotes, double quotes, or parentheses:
diff --git a/src/blocks.c b/src/blocks.c
@@ -1,747 +1,770 @@
 #include <stdlib.h>
+#include <assert.h>
 #include <stdio.h>
 #include <stdbool.h>
 #include <ctype.h>
-#include "bstrlib.h"
+
 #include "stmd.h"
-#include "uthash.h"
-#include "debug.h"
+#include "utf8.h"
 #include "scanners.h"
+#include "inlines.h"
+#include "html/houdini.h"
+
+#define peek_at(i, n) (i)->data[n]
+
+static void incorporate_line(strbuf *ln, int line_number, node_block** curptr);
+static void finalize(node_block* b, int line_number);
 
-static block* make_block(int tag, int start_line, int start_column)
+static node_block* make_block(int tag, int start_line, int start_column)
 {
-  block* e;
-  e = (block*) malloc(sizeof(block));
-  e->tag = tag;
-  e->open = true;
-  e->last_line_blank = false;
-  e->start_line = start_line;
-  e->start_column = start_column;
-  e->end_line = start_line;
-  e->children = NULL;
-  e->last_child = NULL;
-  e->parent = NULL;
-  e->top = NULL;
-  e->attributes.refmap = NULL;
-  e->string_content = bfromcstr("");
-  e->inline_content = NULL;
-  e->next = NULL;
-  e->prev = NULL;
-  return e;
+	node_block* e;
+
+	e = malloc(sizeof(node_block));
+	memset(e, 0x0, sizeof(*e));
+
+	e->tag = tag;
+	e->open = true;
+	e->start_line = start_line;
+	e->start_column = start_column;
+	e->end_line = start_line;
+	strbuf_init(&e->string_content, 32);
+
+	return e;
 }
 
-// Create a root document block.
-extern block* make_document()
+// Create a root document node_block.
+extern node_block* make_document()
 {
-  block * e = make_block(document, 1, 1);
-  reference * map = NULL;
-  reference ** refmap;
-  refmap = (reference**) malloc(sizeof(reference*));
-  *refmap = map;
-  e->attributes.refmap = refmap;
-  e->top = e;
-  return e;
+	node_block *e = make_block(BLOCK_DOCUMENT, 1, 1);
+	e->as.document.refmap = reference_map_new();
+	e->top = e;
+
+	return e;
 }
 
 // Returns true if line has only space characters, else false.
-bool is_blank(bstring s, int offset)
+bool is_blank(strbuf *s, int offset)
 {
-  char c;
-  while ((c = bchar(s, offset))) {
-    if (c == '\n') {
-      return true;
-    } else if (c == ' ') {
-      offset++;
-    } else {
-      return false;
-    }
-  }
-  return true;
+	while (offset < s->size) {
+		switch (s->ptr[offset]) {
+			case '\n':
+				return true;
+			case ' ':
+				offset++;
+				break;
+			default:
+				return false;
+		}
+	}
+
+	return true;
 }
 
 static inline bool can_contain(int parent_type, int child_type)
 {
-  return ( parent_type == document ||
-           parent_type == block_quote ||
-           parent_type == list_item ||
-           (parent_type == list && child_type == list_item) );
+	return ( parent_type == BLOCK_DOCUMENT ||
+			parent_type == BLOCK_BQUOTE ||
+			parent_type == BLOCK_LIST_ITEM ||
+			(parent_type == BLOCK_LIST && child_type == BLOCK_LIST_ITEM) );
 }
 
 static inline bool accepts_lines(int block_type)
 {
-  return (block_type == paragraph ||
-          block_type == atx_header ||
-          block_type == indented_code ||
-          block_type == fenced_code);
+	return (block_type == BLOCK_PARAGRAPH ||
+			block_type == BLOCK_ATX_HEADER ||
+			block_type == BLOCK_INDENTED_CODE ||
+			block_type == BLOCK_FENCED_CODE);
 }
 
-static int add_line(block* block, bstring ln, int offset)
+static void add_line(node_block* node_block, chunk *ch, int offset)
 {
-  bstring s = bmidstr(ln, offset, blength(ln) - offset);
-  check(block->open, "attempted to add line (%s) to closed container (%d)",
-        ln->data, block->tag);
-  check(bformata(block->string_content, "%s", s->data) == 0,
-        "could not append line to string_content");
-  bdestroy(s);
-  return 0;
- error:
-  return -1;
+	assert(node_block->open);
+	strbuf_put(&node_block->string_content, ch->data + offset, ch->len - offset);
 }
 
-static int remove_trailing_blank_lines(bstring ln)
+static void remove_trailing_blank_lines(strbuf *ln)
 {
-  bstring tofind = bfromcstr(" \t\r\n");
-  int pos;
-  // find last nonspace:
-  pos = bninchrr(ln, blength(ln) - 1, tofind);
-  if (pos == BSTR_ERR) { // all spaces
-    bassigncstr(ln, "");
-  } else {
-    // find next newline after it
-    pos = bstrchrp(ln, '\n', pos);
-    if (pos != BSTR_ERR) {
-      check(bdelete(ln, pos, blength(ln) - pos) != BSTR_ERR,
-        "failed to delete trailing blank lines");
-    }
-  }
-  bdestroy(tofind);
-  return 0;
- error:
-  return -1;
+	int i;
+
+	for (i = ln->size - 1; i >= 0; --i) {
+		char c = ln->ptr[i];
+
+		if (c != ' ' && c != '\t' && c != '\r' && c != '\n')
+			break;
+	}
+
+	if (i < 0) {
+		strbuf_clear(ln);
+		return;
+	}
+
+	i = strbuf_strchr(ln, '\n', i);
+	if (i >= 0)
+		strbuf_truncate(ln, i);
 }
 
-// Check to see if a block ends with a blank line, descending
+// Check to see if a node_block ends with a blank line, descending
 // if needed into lists and sublists.
-static bool ends_with_blank_line(block* block)
+static bool ends_with_blank_line(node_block* node_block)
 {
-  if (block->last_line_blank) {
-    return true;
-  }
-  if ((block->tag == list || block->tag == list_item) && block->last_child) {
-    return ends_with_blank_line(block->last_child);
-  } else {
-    return false;
-  }
+	if (node_block->last_line_blank) {
+		return true;
+	}
+	if ((node_block->tag == BLOCK_LIST || node_block->tag == BLOCK_LIST_ITEM) && node_block->last_child) {
+		return ends_with_blank_line(node_block->last_child);
+	} else {
+		return false;
+	}
 }
 
 // Break out of all containing lists
-static int break_out_of_lists(block ** bptr, int line_number)
+static int break_out_of_lists(node_block ** bptr, int line_number)
 {
-  block * container = *bptr;
-  block * b = container->top;
-  // find first containing list:
-  while (b && b->tag != list) {
-    b = b->last_child;
-  }
-  if (b) {
-    while (container && container != b) {
-      finalize(container, line_number);
-      container = container->parent;
-    }
-    finalize(b, line_number);
-    *bptr = b->parent;
-  }
-  return 0;
+	node_block *container = *bptr;
+	node_block *b = container->top;
+	// find first containing BLOCK_LIST:
+	while (b && b->tag != BLOCK_LIST) {
+		b = b->last_child;
+	}
+	if (b) {
+		while (container && container != b) {
+			finalize(container, line_number);
+			container = container->parent;
+		}
+		finalize(b, line_number);
+		*bptr = b->parent;
+	}
+	return 0;
 }
 
 
-extern int finalize(block* b, int line_number)
+static void finalize(node_block* b, int line_number)
 {
-  int firstlinelen;
-  int pos;
-  block* item;
-  block* subitem;
-
-  check(b != NULL, "finalize called on null block");
-  if (!b->open) {
-    return 0; // don't do anything if the block is already closed
-  }
-  b->open = false;
-  if (line_number > b->start_line) {
-    b->end_line = line_number - 1;
-  } else {
-    b->end_line = line_number;
-  }
-
-  switch (b->tag) {
-
-  case paragraph:
-    pos = 0;
-    while (bchar(b->string_content, 0) == '[' &&
-           (pos = parse_reference(b->string_content,
-                                  b->top->attributes.refmap))) {
-      bdelete(b->string_content, 0, pos);
-    }
-    if (is_blank(b->string_content, 0)) {
-      b->tag = reference_def;
-    }
-    break;
-
-  case indented_code:
-    remove_trailing_blank_lines(b->string_content);
-    bformata(b->string_content, "\n");
-    break;
-
-  case fenced_code:
-    // first line of contents becomes info
-    firstlinelen = bstrchr(b->string_content, '\n');
-    b->attributes.fenced_code_data.info =
-      bmidstr(b->string_content, 0, firstlinelen);
-    bdelete(b->string_content, 0, firstlinelen + 1); // +1 for \n
-    btrimws(b->attributes.fenced_code_data.info);
-    unescape(b->attributes.fenced_code_data.info);
-    break;
-
-  case list: // determine tight/loose status
-    b->attributes.list_data.tight = true; // tight by default
-    item = b->children;
-
-    while (item) {
-      // check for non-final non-empty list item ending with blank line:
-      if (item->last_line_blank && item->next) {
-        b->attributes.list_data.tight = false;
-        break;
-      }
-      // recurse into children of list item, to see if there are
-      // spaces between them:
-      subitem = item->children;
-      while (subitem) {
-        if (ends_with_blank_line(subitem) &&
-            (item->next || subitem->next)) {
-          b->attributes.list_data.tight = false;
-          break;
-        }
-        subitem = subitem->next;
-      }
-      if (!(b->attributes.list_data.tight)) {
-        break;
-      }
-      item = item->next;
-    }
-
-    break;
-
-  default:
-    break;
-  }
-
-  return 0;
- error:
-  return -1;
+	int firstlinelen;
+	int pos;
+	node_block* item;
+	node_block* subitem;
+
+	if (!b->open)
+		return; // don't do anything if the node_block is already closed
+
+	b->open = false;
+	if (line_number > b->start_line) {
+		b->end_line = line_number - 1;
+	} else {
+		b->end_line = line_number;
+	}
+
+	switch (b->tag) {
+		case BLOCK_PARAGRAPH:
+			pos = 0;
+			while (strbuf_at(&b->string_content, 0) == '[' &&
+					(pos = parse_reference_inline(&b->string_content, b->top->as.document.refmap))) {
+
+				strbuf_drop(&b->string_content, pos);
+			}
+			if (is_blank(&b->string_content, 0)) {
+				b->tag = BLOCK_REFERENCE_DEF;
+			}
+			break;
+
+		case BLOCK_INDENTED_CODE:
+			remove_trailing_blank_lines(&b->string_content);
+			strbuf_putc(&b->string_content, '\n');
+			break;
+
+		case BLOCK_FENCED_CODE:
+			// first line of contents becomes info
+			firstlinelen = strbuf_strchr(&b->string_content, '\n', 0);
+
+			strbuf_init(&b->as.code.info, 0);
+			houdini_unescape_html_f(
+				&b->as.code.info,
+				b->string_content.ptr,
+				firstlinelen
+			);
+
+			strbuf_drop(&b->string_content, firstlinelen + 1);
+
+			strbuf_trim(&b->as.code.info);
+			strbuf_unescape(&b->as.code.info);
+			break;
+
+		case BLOCK_LIST: // determine tight/loose status
+			b->as.list.tight = true; // tight by default
+			item = b->children;
+
+			while (item) {
+				// check for non-final non-empty list item ending with blank line:
+				if (item->last_line_blank && item->next) {
+					b->as.list.tight = false;
+					break;
+				}
+				// recurse into children of list item, to see if there are
+				// spaces between them:
+				subitem = item->children;
+				while (subitem) {
+					if (ends_with_blank_line(subitem) &&
+							(item->next || subitem->next)) {
+						b->as.list.tight = false;
+						break;
+					}
+					subitem = subitem->next;
+				}
+				if (!(b->as.list.tight)) {
+					break;
+				}
+				item = item->next;
+			}
+
+			break;
+
+		default:
+			break;
+	}
 }
 
-// Add a block as child of another.  Return pointer to child.
-extern block* add_child(block* parent,
-                        int block_type, int start_line, int start_column)
+// Add a node_block as child of another.  Return pointer to child.
+static node_block* add_child(node_block* parent,
+		int block_type, int start_line, int start_column)
 {
-  // if 'parent' isn't the kind of block that can accept this child,
-  // then back up til we hit a block that can.
-  while (!can_contain(parent->tag, block_type)) {
-    finalize(parent, start_line);
-    parent = parent->parent;
-  }
-
-  check(parent != NULL, "parent container cannot accept children");
-
-  block* child = make_block(block_type, start_line, start_column);
-  child->parent = parent;
-  child->top = parent->top;
-
-  if (parent->last_child) {
-    parent->last_child->next = child;
-    child->prev = parent->last_child;
-  } else {
-    parent->children = child;
-    child->prev = NULL;
-  }
-  parent->last_child = child;
-  return child;
- error:
-  return NULL;
+	assert(parent);
+
+	// if 'parent' isn't the kind of node_block that can accept this child,
+	// then back up til we hit a node_block that can.
+	while (!can_contain(parent->tag, block_type)) {
+		finalize(parent, start_line);
+		parent = parent->parent;
+	}
+
+	node_block* child = make_block(block_type, start_line, start_column);
+	child->parent = parent;
+	child->top = parent->top;
+
+	if (parent->last_child) {
+		parent->last_child->next = child;
+		child->prev = parent->last_child;
+	} else {
+		parent->children = child;
+		child->prev = NULL;
+	}
+	parent->last_child = child;
+	return child;
 }
 
-// Free a block list and any children.
-extern void free_blocks(block* e)
+// Free a node_block list and any children.
+void stmd_free_nodes(node_block *e)
 {
-  block * next;
-  while (e != NULL) {
-    next = e->next;
-    free_inlines(e->inline_content);
-    bdestroy(e->string_content);
-    if (e->tag == fenced_code) {
-      bdestroy(e->attributes.fenced_code_data.info);
-    } else if (e->tag == document) {
-      free_reference_map(e->attributes.refmap);
-    }
-    free_blocks(e->children);
-    free(e);
-    e = next;
-  }
+	node_block * next;
+	while (e != NULL) {
+		next = e->next;
+		free_inlines(e->inline_content);
+		strbuf_free(&e->string_content);
+		if (e->tag == BLOCK_FENCED_CODE) {
+			strbuf_free(&e->as.code.info);
+		} else if (e->tag == BLOCK_DOCUMENT) {
+			reference_map_free(e->as.document.refmap);
+		}
+		stmd_free_nodes(e->children);
+		free(e);
+		e = next;
+	}
 }
 
-// Walk through block and all children, recursively, parsing
+// Walk through node_block and all children, recursively, parsing
 // string content into inline content where appropriate.
-int process_inlines(block* cur, reference** refmap)
+void process_inlines(node_block* cur, reference_map *refmap)
 {
-  switch (cur->tag) {
-
-  case paragraph:
-  case atx_header:
-  case setext_header:
-    check(cur->string_content != NULL, "string_content is NULL");
-    cur->inline_content = parse_inlines(cur->string_content, refmap);
-    bdestroy(cur->string_content);
-    cur->string_content = NULL;
-    break;
-
-  default:
-    break;
-  }
-
-  block * child = cur->children;
-  while (child != NULL) {
-    process_inlines(child, refmap);
-    child = child->next;
-  }
-
-  return 0;
- error:
-  return -1;
+	switch (cur->tag) {
+		case BLOCK_PARAGRAPH:
+		case BLOCK_ATX_HEADER:
+		case BLOCK_SETEXT_HEADER:
+			cur->inline_content = parse_inlines(&cur->string_content, refmap);
+			break;
+
+		default:
+			break;
+	}
+
+	node_block *child = cur->children;
+	while (child != NULL) {
+		process_inlines(child, refmap);
+		child = child->next;
+	}
 }
 
 // Attempts to parse a list item marker (bullet or enumerated).
 // On success, returns length of the marker, and populates
 // data with the details.  On failure, returns 0.
-static int parse_list_marker(bstring ln, int pos,
-                             struct ListData ** dataptr)
+static int parse_list_marker(chunk *input, int pos, struct ListData ** dataptr)
 {
-  char c;
-  int startpos;
-  int start = 1;
-  struct ListData * data;
-
-  startpos = pos;
-  c = bchar(ln, pos);
-
-  if ((c == '*' || c == '-' || c == '+') && !scan_hrule(ln, pos)) {
-    pos++;
-    if (!isspace(bchar(ln, pos))) {
-      return 0;
-    }
-    data = malloc(sizeof(struct ListData));
-    data->marker_offset = 0; // will be adjusted later
-    data->list_type = bullet;
-    data->bullet_char = c;
-    data->start = 1;
-    data->delimiter = period;
-    data->tight = false;
-
-  } else if (isdigit(c)) {
-
-    pos++;
-    while (isdigit(bchar(ln, pos))) {
-      pos++;
-    }
-
-    if (!sscanf((char *) ln->data + startpos, "%d", &start)) {
-      log_err("sscanf failed");
-      return 0;
-    }
-
-    c = bchar(ln, pos);
-    if (c == '.' || c == ')') {
-      pos++;
-      if (!isspace(bchar(ln, pos))) {
-        return 0;
-      }
-      data = malloc(sizeof(struct ListData));
-      data->marker_offset = 0; // will be adjusted later
-      data->list_type = ordered;
-      data->bullet_char = 0;
-      data->start = start;
-      data->delimiter = (c == '.' ? period : parens);
-      data->tight = false;
-    } else {
-      return 0;
-    }
-
-  } else {
-    return 0;
-  }
-
-  *dataptr = data;
-  return (pos - startpos);
+	unsigned char c;
+	int startpos;
+	struct ListData * data;
+
+	startpos = pos;
+	c = peek_at(input, pos);
+
+	if ((c == '*' || c == '-' || c == '+') && !scan_hrule(input, pos)) {
+		pos++;
+		if (!isspace(peek_at(input, pos))) {
+			return 0;
+		}
+		data = malloc(sizeof(struct ListData));
+		data->marker_offset = 0; // will be adjusted later
+		data->list_type = bullet;
+		data->bullet_char = c;
+		data->start = 1;
+		data->delimiter = period;
+		data->tight = false;
+
+	} else if (isdigit(c)) {
+		int start = 0;
+
+		do {
+			start = (10 * start) + (peek_at(input, pos) - '0');
+			pos++;
+		} while (isdigit(peek_at(input, pos)));
+
+		c = peek_at(input, pos);
+		if (c == '.' || c == ')') {
+			pos++;
+			if (!isspace(peek_at(input, pos))) {
+				return 0;
+			}
+			data = malloc(sizeof(struct ListData));
+			data->marker_offset = 0; // will be adjusted later
+			data->list_type = ordered;
+			data->bullet_char = 0;
+			data->start = start;
+			data->delimiter = (c == '.' ? period : parens);
+			data->tight = false;
+		} else {
+			return 0;
+		}
+
+	} else {
+		return 0;
+	}
+
+	*dataptr = data;
+	return (pos - startpos);
 }
 
 // Return 1 if list item belongs in list, else 0.
-static int lists_match(struct ListData list_data,
-                       struct ListData item_data)
+static int lists_match(struct ListData *list_data, struct ListData *item_data)
+{
+	return (list_data->list_type == item_data->list_type &&
+			list_data->delimiter == item_data->delimiter &&
+			// list_data->marker_offset == item_data.marker_offset &&
+			list_data->bullet_char == item_data->bullet_char);
+}
+
+static node_block *finalize_document(node_block *document, int linenum)
+{
+	while (document != document->top) {
+		finalize(document, linenum);
+		document = document->parent;
+	}
+
+	finalize(document, linenum);
+	process_inlines(document, document->as.document.refmap);
+
+	return document;
+}
+
+extern node_block *stmd_parse_file(FILE *f)
 {
-  return (list_data.list_type == item_data.list_type &&
-          list_data.delimiter == item_data.delimiter &&
-          // list_data.marker_offset == item_data.marker_offset &&
-          list_data.bullet_char == item_data.bullet_char);
+	strbuf line = GH_BUF_INIT;
+	unsigned char buffer[4096];
+	int linenum = 1;
+	node_block *document = make_document();
+
+	while (fgets((char *)buffer, sizeof(buffer), f)) {
+		utf8proc_detab(&line, buffer, strlen((char *)buffer));
+		incorporate_line(&line, linenum, &document);
+		strbuf_clear(&line);
+		linenum++;
+	}
+
+	strbuf_free(&line);
+	return finalize_document(document, linenum);
 }
 
-// Process one line at a time, modifying a block.
-// Returns 0 if successful.  curptr is changed to point to
-// the currently open block.
-extern int incorporate_line(bstring ln, int line_number, block** curptr)
+extern node_block *stmd_parse_document(const unsigned char *buffer, size_t len)
 {
-  block* last_matched_container;
-  int offset = 0;
-  int matched = 0;
-  int lev = 0;
-  int i;
-  struct ListData * data = NULL;
-  bool all_matched = true;
-  block* container;
-  block* cur = *curptr;
-  bool blank = false;
-  int first_nonspace;
-  int indent;
-
-  // detab input line
-  check(bdetab(ln, 1) != BSTR_ERR,
-        "invalid UTF-8 sequence in line %d\n", line_number);
-
-  // container starts at the document root.
-  container = cur->top;
-
-  // for each containing block, try to parse the associated line start.
-  // bail out on failure:  container will point to the last matching block.
-
-  while (container->last_child && container->last_child->open) {
-    container = container->last_child;
-
-    first_nonspace = offset;
-    while (bchar(ln, first_nonspace) == ' ') {
-      first_nonspace++;
-    }
-
-    indent = first_nonspace - offset;
-    blank = bchar(ln, first_nonspace) == '\n';
-
-    if (container->tag == block_quote) {
-
-      matched = indent <= 3 && bchar(ln, first_nonspace) == '>';
-      if (matched) {
-        offset = first_nonspace + 1;
-        if (bchar(ln, offset) == ' ') {
-          offset++;
-        }
-      } else {
-        all_matched = false;
-      }
-
-    } else if (container->tag == list_item) {
-
-      if (indent >= container->attributes.list_data.marker_offset +
-          container->attributes.list_data.padding) {
-        offset += container->attributes.list_data.marker_offset +
-          container->attributes.list_data.padding;
-      } else if (blank) {
-        offset = first_nonspace;
-      } else {
-        all_matched = false;
-      }
-
-    } else if (container->tag == indented_code) {
-
-      if (indent >= CODE_INDENT) {
-        offset += CODE_INDENT;
-      } else if (blank) {
-        offset = first_nonspace;
-      } else {
-        all_matched = false;
-      }
-
-    } else if (container->tag == atx_header ||
-               container->tag == setext_header) {
-
-      // a header can never contain more than one line
-      all_matched = false;
-
-    } else if (container->tag == fenced_code) {
-
-      // skip optional spaces of fence offset
-      i = container->attributes.fenced_code_data.fence_offset;
-      while (i > 0 && bchar(ln, offset) == ' ') {
-        offset++;
-        i--;
-      }
-
-    } else if (container->tag == html_block) {
-
-      if (blank) {
-        all_matched = false;
-      }
-
-    } else if (container->tag == paragraph) {
-
-      if (blank) {
-        container->last_line_blank =true;
-        all_matched = false;
-      }
-
-    }
-
-    if (!all_matched) {
-      container = container->parent;  // back up to last matching block
-      break;
-    }
-  }
-
-  last_matched_container = container;
-
-  // check to see if we've hit 2nd blank line, break out of list:
-  if (blank && container->last_line_blank) {
-    break_out_of_lists(&container, line_number);
-  }
-
-  // unless last matched container is code block, try new container starts:
-  while (container->tag != fenced_code && container->tag != indented_code &&
-         container->tag != html_block) {
-
-    first_nonspace = offset;
-    while (bchar(ln, first_nonspace) == ' ') {
-      first_nonspace++;
-    }
-
-    indent = first_nonspace - offset;
-    blank = bchar(ln, first_nonspace) == '\n';
-
-    if (indent >= CODE_INDENT) {
-
-      if (cur->tag != paragraph && !blank) {
-        offset += CODE_INDENT;
-        container = add_child(container, indented_code, line_number, offset + 1);
-      } else { // indent > 4 in lazy line
-        break;
-      }
-
-    } else if (bchar(ln, first_nonspace) == '>') {
-
-      offset = first_nonspace + 1;
-      // optional following character
-      if (bchar(ln, offset) == ' ') {
-        offset++;
-      }
-      container = add_child(container, block_quote, line_number, offset + 1);
-
-    } else if ((matched = scan_atx_header_start(ln, first_nonspace))) {
-
-      offset = first_nonspace + matched;
-      container = add_child(container, atx_header, line_number, offset + 1);
-      int hashpos = bstrchrp(ln, '#', first_nonspace);
-      check(hashpos != BSTR_ERR, "no # found in atx header start");
-      int level = 0;
-      while (bchar(ln, hashpos) == '#') {
-        level++;
-        hashpos++;
-      }
-      container->attributes.header_level = level;
-
-    } else if ((matched = scan_open_code_fence(ln, first_nonspace))) {
-
-      container = add_child(container, fenced_code, line_number,
-          first_nonspace + 1);
-      container->attributes.fenced_code_data.fence_char = bchar(ln,
-          first_nonspace);
-      container->attributes.fenced_code_data.fence_length = matched;
-      container->attributes.fenced_code_data.fence_offset =
-        first_nonspace - offset;
-      offset = first_nonspace + matched;
-
-    } else if ((matched = scan_html_block_tag(ln, first_nonspace))) {
-
-      container = add_child(container, html_block, line_number,
-                            first_nonspace + 1);
-      // note, we don't adjust offset because the tag is part of the text
-
-    } else if (container->tag == paragraph &&
-              (lev = scan_setext_header_line(ln, first_nonspace)) &&
-               // check that there is only one line in the paragraph:
-               bstrrchrp(container->string_content, '\n',
-                         blength(container->string_content) - 2) == BSTR_ERR) {
-
-        container->tag = setext_header;
-        container->attributes.header_level = lev;
-        offset = blength(ln) - 1;
-
-    } else if (!(container->tag == paragraph && !all_matched) &&
-               (matched = scan_hrule(ln, first_nonspace))) {
-
-      // it's only now that we know the line is not part of a setext header:
-      container = add_child(container, hrule, line_number, first_nonspace + 1);
-      finalize(container, line_number);
-      container = container->parent;
-      offset = blength(ln) - 1;
-
-    } else if ((matched = parse_list_marker(ln, first_nonspace, &data))) {
-
-        // compute padding:
-        offset = first_nonspace + matched;
-        i = 0;
-        while (i <= 5 && bchar(ln, offset + i) == ' ') {
-          i++;
-        }
-        // i = number of spaces after marker, up to 5
-        if (i >= 5 || i < 1 || bchar(ln, offset) == '\n') {
-          data->padding = matched + 1;
-          if (i > 0) {
-            offset += 1;
-          }
-        } else {
-          data->padding = matched + i;
-          offset += i;
-        }
-
-        // check container; if it's a list, see if this list item
-        // can continue the list; otherwise, create a list container.
-
-        data->marker_offset = indent;
-
-        if (container->tag != list ||
-            !lists_match(container->attributes.list_data, *data)) {
-          container = add_child(container, list, line_number,
-              first_nonspace + 1);
-          container->attributes.list_data = *data;
-        }
-
-        // add the list item
-        container = add_child(container, list_item, line_number,
-            first_nonspace + 1);
-        container->attributes.list_data = *data;
-        free(data);
-
-    } else {
-      break;
-    }
-
-    if (accepts_lines(container->tag)) {
-      // if it's a line container, it can't contain other containers
-      break;
-    }
-  }
-
-  // what remains at offset is a text line.  add the text to the
-  // appropriate container.
-
-  first_nonspace = offset;
-  while (bchar(ln, first_nonspace) == ' ') {
-    first_nonspace++;
-  }
-
-  indent = first_nonspace - offset;
-  blank = bchar(ln, first_nonspace) == '\n';
-
-  // block quote lines are never blank as they start with >
-  // and we don't count blanks in fenced code for purposes of tight/loose
-  // lists or breaking out of lists.  we also don't set last_line_blank
-  // on an empty list item.
-  container->last_line_blank = (blank &&
-                                container->tag != block_quote &&
-                                container->tag != fenced_code &&
-                                !(container->tag == list_item &&
-                                  container->children == NULL &&
-                                  container->start_line == line_number));
-
-    block *cont = container;
-    while (cont->parent) {
-      cont->parent->last_line_blank = false;
-      cont = cont->parent;
-    }
-
-  if (cur != last_matched_container &&
-      container == last_matched_container &&
-      !blank &&
-      cur->tag == paragraph &&
-      blength(cur->string_content) > 0) {
-
-    check(add_line(cur, ln, offset) == 0, "could not add line");
-
-  } else { // not a lazy continuation
-
-    // finalize any blocks that were not matched and set cur to container:
-    while (cur != last_matched_container) {
-
-      finalize(cur, line_number);
-      cur = cur->parent;
-      check(cur != NULL, "cur is NULL, last_matched_container->tag = %d",
-            last_matched_container->tag);
-
-    }
-
-    if (container->tag == indented_code) {
-
-      check(add_line(container, ln, offset) == 0, "could not add line");
-
-    } else if (container->tag == fenced_code) {
-
-      matched = (indent <= 3
-        && bchar(ln, first_nonspace) == container->attributes.fenced_code_data.fence_char)
-        && scan_close_code_fence(ln, first_nonspace,
-                                 container->attributes.fenced_code_data.fence_length);
-      if (matched) {
-        // if closing fence, don't add line to container; instead, close it:
-        finalize(container, line_number);
-        container = container->parent; // back up to parent
-      } else {
-        check(add_line(container, ln, offset) == 0, "could not add line");
-      }
-
-    } else if (container->tag == html_block) {
-
-      check(add_line(container, ln, offset) == 0, "could not add line");
-
-    } else if (blank) {
-
-      // ??? do nothing
-
-    } else if (container->tag == atx_header) {
-
-      // chop off trailing ###s...use a scanner?
-      brtrimws(ln);
-      int p = blength(ln) - 1;
-      int numhashes = 0;
-      // if string ends in #s, remove these:
-      while (bchar(ln, p) == '#') {
-        p--;
-        numhashes++;
-      }
-      if (bchar(ln, p) == '\\') {
-        // the last # was escaped, so we include it.
-        p++;
-        numhashes--;
-      }
-      check(bdelete(ln, p + 1, numhashes) != BSTR_ERR,
-            "could not delete final hashes");
-      check(add_line(container, ln, first_nonspace) == 0, "could not add line");
-      finalize(container, line_number);
-      container = container->parent;
-
-    } else if (accepts_lines(container->tag)) {
-
-      check(add_line(container, ln, first_nonspace) == 0, "could not add line");
+	strbuf line = GH_BUF_INIT;
+	int linenum = 1;
+	const unsigned char *end = buffer + len;
+	node_block *document = make_document();
+
+	while (buffer < end) {
+		const unsigned char *eol = memchr(buffer, '\n', end - buffer);
+
+		if (!eol) {
+			utf8proc_detab(&line, buffer, end - buffer);
+			buffer = end;
+		} else {
+			utf8proc_detab(&line, buffer, (eol - buffer) + 1);
+			buffer += (eol - buffer) + 1;
+		}
+
+		incorporate_line(&line, linenum, &document);
+		strbuf_clear(&line);
+		linenum++;
+	}
+
+	strbuf_free(&line);
+	return finalize_document(document, linenum);
+}
+
+static void chop_trailing_hashtags(chunk *ch)
+{
+	int n, orig_n;
+
+	chunk_rtrim(ch);
+	orig_n = n = ch->len - 1;
+
+	// if string ends in #s, remove these:
+	while (n >= 0 && peek_at(ch, n) == '#')
+		n--;
+
+	// the last # was escaped, so we include it.
+	if (n != orig_n && n >= 0 && peek_at(ch, n) == '\\')
+		n++;
+
+	ch->len = n + 1;
+}
+
+// Process one line at a time, modifying a node_block.
+static void incorporate_line(strbuf *line, int line_number, node_block** curptr)
+{
+	node_block* last_matched_container;
+	int offset = 0;
+	int matched = 0;
+	int lev = 0;
+	int i;
+	struct ListData * data = NULL;
+	bool all_matched = true;
+	node_block* container;
+	node_block* cur = *curptr;
+	bool blank = false;
+	int first_nonspace;
+	int indent;
+	chunk input;
+
+	input.data = line->ptr;
+	input.len = line->size;
+
+	// container starts at the document root.
+	container = cur->top;
+
+	// for each containing node_block, try to parse the associated line start.
+	// bail out on failure:  container will point to the last matching node_block.
+
+	while (container->last_child && container->last_child->open) {
+		container = container->last_child;
+
+		first_nonspace = offset;
+		while (peek_at(&input, first_nonspace) == ' ') {
+			first_nonspace++;
+		}
+
+		indent = first_nonspace - offset;
+		blank = peek_at(&input, first_nonspace) == '\n';
+
+		if (container->tag == BLOCK_BQUOTE) {
+			matched = indent <= 3 && peek_at(&input, first_nonspace) == '>';
+			if (matched) {
+				offset = first_nonspace + 1;
+				if (peek_at(&input, offset) == ' ')
+					offset++;
+			} else {
+				all_matched = false;
+			}
+
+		} else if (container->tag == BLOCK_LIST_ITEM) {
+
+			if (indent >= container->as.list.marker_offset +
+					container->as.list.padding) {
+				offset += container->as.list.marker_offset +
+					container->as.list.padding;
+			} else if (blank) {
+				offset = first_nonspace;
+			} else {
+				all_matched = false;
+			}
+
+		} else if (container->tag == BLOCK_INDENTED_CODE) {
+
+			if (indent >= CODE_INDENT) {
+				offset += CODE_INDENT;
+			} else if (blank) {
+				offset = first_nonspace;
+			} else {
+				all_matched = false;
+			}
+
+		} else if (container->tag == BLOCK_ATX_HEADER ||
+				container->tag == BLOCK_SETEXT_HEADER) {
+
+			// a header can never contain more than one line
+			all_matched = false;
+
+		} else if (container->tag == BLOCK_FENCED_CODE) {
+
+			// skip optional spaces of fence offset
+			i = container->as.code.fence_offset;
+			while (i > 0 && peek_at(&input, offset) == ' ') {
+				offset++;
+				i--;
+			}
+
+		} else if (container->tag == BLOCK_HTML) {
+
+			if (blank) {
+				all_matched = false;
+			}
+
+		} else if (container->tag == BLOCK_PARAGRAPH) {
+
+			if (blank) {
+				container->last_line_blank = true;
+				all_matched = false;
+			}
+
+		}
+
+		if (!all_matched) {
+			container = container->parent;  // back up to last matching node_block
+			break;
+		}
+	}
+
+	last_matched_container = container;
+
+	// check to see if we've hit 2nd blank line, break out of list:
+	if (blank && container->last_line_blank) {
+		break_out_of_lists(&container, line_number);
+	}
+
+	// unless last matched container is code node_block, try new container starts:
+	while (container->tag != BLOCK_FENCED_CODE && container->tag != BLOCK_INDENTED_CODE &&
+			container->tag != BLOCK_HTML) {
+
+		first_nonspace = offset;
+		while (peek_at(&input, first_nonspace) == ' ')
+			first_nonspace++;
+
+		indent = first_nonspace - offset;
+		blank = peek_at(&input, first_nonspace) == '\n';
+
+		if (indent >= CODE_INDENT) {
+			if (cur->tag != BLOCK_PARAGRAPH && !blank) {
+				offset += CODE_INDENT;
+				container = add_child(container, BLOCK_INDENTED_CODE, line_number, offset + 1);
+			} else { // indent > 4 in lazy line
+				break;
+			}
+
+		} else if (peek_at(&input, first_nonspace) == '>') {
+
+			offset = first_nonspace + 1;
+			// optional following character
+			if (peek_at(&input, offset) == ' ')
+				offset++;
+			container = add_child(container, BLOCK_BQUOTE, line_number, offset + 1);
+
+		} else if ((matched = scan_atx_header_start(&input, first_nonspace))) {
+
+			offset = first_nonspace + matched;
+			container = add_child(container, BLOCK_ATX_HEADER, line_number, offset + 1);
+
+			int hashpos = chunk_strchr(&input, '#', first_nonspace);
+			int level = 0;
+
+			while (peek_at(&input, hashpos) == '#') {
+				level++;
+				hashpos++;
+			}
+			container->as.header.level = level;
+
+		} else if ((matched = scan_open_code_fence(&input, first_nonspace))) {
+
+			container = add_child(container, BLOCK_FENCED_CODE, line_number, first_nonspace + 1);
+			container->as.code.fence_char = peek_at(&input, first_nonspace);
+			container->as.code.fence_length = matched;
+			container->as.code.fence_offset = first_nonspace - offset;
+			offset = first_nonspace + matched;
+
+		} else if ((matched = scan_html_block_tag(&input, first_nonspace))) {
+
+			container = add_child(container, BLOCK_HTML, line_number, first_nonspace + 1);
+			// note, we don't adjust offset because the tag is part of the text
+
+		} else if (container->tag == BLOCK_PARAGRAPH &&
+				(lev = scan_setext_header_line(&input, first_nonspace)) &&
+				// check that there is only one line in the paragraph:
+				strbuf_strrchr(&container->string_content, '\n',
+					strbuf_len(&container->string_content) - 2) < 0) {
+
+			container->tag = BLOCK_SETEXT_HEADER;
+			container->as.header.level = lev;
+			offset = input.len - 1;
+
+		} else if (!(container->tag == BLOCK_PARAGRAPH && !all_matched) &&
+				(matched = scan_hrule(&input, first_nonspace))) {
+
+			// it's only now that we know the line is not part of a setext header:
+			container = add_child(container, BLOCK_HRULE, line_number, first_nonspace + 1);
+			finalize(container, line_number);
+			container = container->parent;
+			offset = input.len - 1;
+
+		} else if ((matched = parse_list_marker(&input, first_nonspace, &data))) {
+
+			// compute padding:
+			offset = first_nonspace + matched;
+			i = 0;
+			while (i <= 5 && peek_at(&input, offset + i) == ' ') {
+				i++;
+			}
+			// i = number of spaces after marker, up to 5
+			if (i >= 5 || i < 1 || peek_at(&input, offset) == '\n') {
+				data->padding = matched + 1;
+				if (i > 0) {
+					offset += 1;
+				}
+			} else {
+				data->padding = matched + i;
+				offset += i;
+			}
+
+			// check container; if it's a list, see if this list item
+			// can continue the list; otherwise, create a list container.
+
+			data->marker_offset = indent;
+
+			if (container->tag != BLOCK_LIST ||
+					!lists_match(&container->as.list, data)) {
+				container = add_child(container, BLOCK_LIST, line_number,
+						first_nonspace + 1);
+
+				memcpy(&container->as.list, data, sizeof(*data));
+			}
+
+			// add the list item
+			container = add_child(container, BLOCK_LIST_ITEM, line_number,
+					first_nonspace + 1);
+			/* TODO: static */
+			memcpy(&container->as.list, data, sizeof(*data));
+			free(data);
+		} else {
+			break;
+		}
+
+		if (accepts_lines(container->tag)) {
+			// if it's a line container, it can't contain other containers
+			break;
+		}
+	}
+
+	// what remains at offset is a text line.  add the text to the
+	// appropriate container.
+
+	first_nonspace = offset;
+	while (peek_at(&input, first_nonspace) == ' ')
+		first_nonspace++;
+
+	indent = first_nonspace - offset;
+	blank = peek_at(&input, first_nonspace) == '\n';
+
+	// node_block quote lines are never blank as they start with >
+	// and we don't count blanks in fenced code for purposes of tight/loose
+	// lists or breaking out of lists.  we also don't set last_line_blank
+	// on an empty list item.
+	container->last_line_blank = (blank &&
+			container->tag != BLOCK_BQUOTE &&
+			container->tag != BLOCK_FENCED_CODE &&
+			!(container->tag == BLOCK_LIST_ITEM &&
+				container->children == NULL &&
+				container->start_line == line_number));
+
+	node_block *cont = container;
+	while (cont->parent) {
+		cont->parent->last_line_blank = false;
+		cont = cont->parent;
+	}
+
+	if (cur != last_matched_container &&
+			container == last_matched_container &&
+			!blank &&
+			cur->tag == BLOCK_PARAGRAPH &&
+			strbuf_len(&cur->string_content) > 0) {
+
+		add_line(cur, &input, offset);
+
+	} else { // not a lazy continuation
+
+		// finalize any blocks that were not matched and set cur to container:
+		while (cur != last_matched_container) {
+			finalize(cur, line_number);
+			cur = cur->parent;
+			assert(cur != NULL);
+		}
+
+		if (container->tag == BLOCK_INDENTED_CODE) {
+
+			add_line(container, &input, offset);
+
+		} else if (container->tag == BLOCK_FENCED_CODE) {
+			matched = 0;
+
+			if (indent <= 3 &&
+				peek_at(&input, first_nonspace) == container->as.code.fence_char) {
+				int fence_len = scan_close_code_fence(&input, first_nonspace);
+				if (fence_len > container->as.code.fence_length)
+					matched = 1;
+			}
+
+			if (matched) {
+				// if closing fence, don't add line to container; instead, close it:
+				finalize(container, line_number);
+				container = container->parent; // back up to parent
+			} else {
+				add_line(container, &input, offset);
+			}
+
+		} else if (container->tag == BLOCK_HTML) {
+
+			add_line(container, &input, offset);
+
+		} else if (blank) {
+
+			// ??? do nothing
+
+		} else if (container->tag == BLOCK_ATX_HEADER) {
+
+			chop_trailing_hashtags(&input);
+			add_line(container, &input, first_nonspace);
+			finalize(container, line_number);
+			container = container->parent;
+
+		} else if (accepts_lines(container->tag)) {
+
+			add_line(container, &input, first_nonspace);
+
+		} else if (container->tag != BLOCK_HRULE && container->tag != BLOCK_SETEXT_HEADER) {
+
+			// create paragraph container for line
+			container = add_child(container, BLOCK_PARAGRAPH, line_number, first_nonspace + 1);
+			add_line(container, &input, first_nonspace);
 
-    } else if (container->tag != hrule && container->tag != setext_header) {
-
-      // create paragraph container for line
-      container = add_child(container, paragraph, line_number, first_nonspace + 1);
-      check(add_line(container, ln, first_nonspace) == 0, "could not add line");
-
-    } else {
+		} else {
+			assert(false);
+		}
 
-      log_warn("Line %d with container type %d did not match any condition:\n\"%s\"",
-               line_number, container->tag, ln->data);
-
-    }
-    *curptr = container;
-  }
-
-  return 0;
- error:
-  return -1;
+		*curptr = container;
+	}
 }
 
diff --git a/src/bstrlib.c b/src/bstrlib.c
@@ -1,2979 +0,0 @@
-/*
- * This source file is part of the bstring string library.  This code was
- * written by Paul Hsieh in 2002-2010, and is covered by either the 3-clause 
- * BSD open source license or GPL v2.0. Refer to the accompanying documentation 
- * for details on usage and license.
- */
-
-/*
- * bstrlib.c
- *
- * This file is the core module for implementing the bstring functions.
- */
-
-#if defined (_MSC_VER)
-/* These warnings from MSVC++ are totally pointless. */
-# define _CRT_SECURE_NO_WARNINGS
-#endif
-
-#include <stdio.h>
-#include <stddef.h>
-#include <stdarg.h>
-#include <stdlib.h>
-#include <string.h>
-#include <ctype.h>
-#include "bstrlib.h"
-
-/* Optionally include a mechanism for debugging memory */
-
-#if defined(MEMORY_DEBUG) || defined(BSTRLIB_MEMORY_DEBUG)
-#include "memdbg.h"
-#endif
-
-#ifndef bstr__alloc
-#define bstr__alloc(x) malloc (x)
-#endif
-
-#ifndef bstr__free
-#define bstr__free(p) free (p)
-#endif
-
-#ifndef bstr__realloc
-#define bstr__realloc(p,x) realloc ((p), (x))
-#endif
-
-#ifndef bstr__memcpy
-#define bstr__memcpy(d,s,l) memcpy ((d), (s), (l))
-#endif
-
-#ifndef bstr__memmove
-#define bstr__memmove(d,s,l) memmove ((d), (s), (l))
-#endif
-
-#ifndef bstr__memset
-#define bstr__memset(d,c,l) memset ((d), (c), (l))
-#endif
-
-#ifndef bstr__memcmp
-#define bstr__memcmp(d,c,l) memcmp ((d), (c), (l))
-#endif
-
-#ifndef bstr__memchr
-#define bstr__memchr(s,c,l) memchr ((s), (c), (l))
-#endif
-
-/* Just a length safe wrapper for memmove. */
-
-#define bBlockCopy(D,S,L) { if ((L) > 0) bstr__memmove ((D),(S),(L)); }
-
-/* Compute the snapped size for a given requested size.  By snapping to powers
-   of 2 like this, repeated reallocations are avoided. */
-static int snapUpSize (int i) {
-	if (i < 8) {
-		i = 8;
-	} else {
-		unsigned int j;
-		j = (unsigned int) i;
-
-		j |= (j >>  1);
-		j |= (j >>  2);
-		j |= (j >>  4);
-		j |= (j >>  8);		/* Ok, since int >= 16 bits */
-#if (UINT_MAX != 0xffff)
-		j |= (j >> 16);		/* For 32 bit int systems */
-#if (UINT_MAX > 0xffffffffUL)
-		j |= (j >> 32);		/* For 64 bit int systems */
-#endif
-#endif
-		/* Least power of two greater than i */
-		j++;
-		if ((int) j >= i) i = (int) j;
-	}
-	return i;
-}
-
-/*  int balloc (bstring b, int len)
- *
- *  Increase the size of the memory backing the bstring b to at least len.
- */
-int balloc (bstring b, int olen) {
-	int len;
-	if (b == NULL || b->data == NULL || b->slen < 0 || b->mlen <= 0 || 
-	    b->mlen < b->slen || olen <= 0) {
-		return BSTR_ERR;
-	}
-
-	if (olen >= b->mlen) {
-		unsigned char * x;
-
-		if ((len = snapUpSize (olen)) <= b->mlen) return BSTR_OK;
-
-		/* Assume probability of a non-moving realloc is 0.125 */
-		if (7 * b->mlen < 8 * b->slen) {
-
-			/* If slen is close to mlen in size then use realloc to reduce
-			   the memory defragmentation */
-
-			reallocStrategy:;
-
-			x = (unsigned char *) bstr__realloc (b->data, (size_t) len);
-			if (x == NULL) {
-
-				/* Since we failed, try allocating the tighest possible 
-				   allocation */
-
-				if (NULL == (x = (unsigned char *) bstr__realloc (b->data, (size_t) (len = olen)))) {
-					return BSTR_ERR;
-				}
-			}
-		} else {
-
-			/* If slen is not close to mlen then avoid the penalty of copying
-			   the extra bytes that are allocated, but not considered part of
-			   the string */
-
-			if (NULL == (x = (unsigned char *) bstr__alloc ((size_t) len))) {
-
-				/* Perhaps there is no available memory for the two 
-				   allocations to be in memory at once */
-
-				goto reallocStrategy;
-
-			} else {
-				if (b->slen) bstr__memcpy ((char *) x, (char *) b->data, (size_t) b->slen);
-				bstr__free (b->data);
-			}
-		}
-		b->data = x;
-		b->mlen = len;
-		b->data[b->slen] = (unsigned char) '\0';
-	}
-
-	return BSTR_OK;
-}
-
-/*  int ballocmin (bstring b, int len)
- *
- *  Set the size of the memory backing the bstring b to len or b->slen+1,
- *  whichever is larger.  Note that repeated use of this function can degrade
- *  performance.
- */
-int ballocmin (bstring b, int len) {
-	unsigned char * s;
-
-	if (b == NULL || b->data == NULL || (b->slen+1) < 0 || b->mlen <= 0 || 
-	    b->mlen < b->slen || len <= 0) {
-		return BSTR_ERR;
-	}
-
-	if (len < b->slen + 1) len = b->slen + 1;
-
-	if (len != b->mlen) {
-		s = (unsigned char *) bstr__realloc (b->data, (size_t) len);
-		if (NULL == s) return BSTR_ERR;
-		s[b->slen] = (unsigned char) '\0';
-		b->data = s;
-		b->mlen = len;
-	}
-
-	return BSTR_OK;
-}
-
-/*  bstring bfromcstr (const char * str)
- *
- *  Create a bstring which contains the contents of the '\0' terminated char *
- *  buffer str.
- */
-bstring bfromcstr (const char * str) {
-bstring b;
-int i;
-size_t j;
-
-	if (str == NULL) return NULL;
-	j = (strlen) (str);
-	i = snapUpSize ((int) (j + (2 - (j != 0))));
-	if (i <= (int) j) return NULL;
-
-	b = (bstring) bstr__alloc (sizeof (struct tagbstring));
-	if (NULL == b) return NULL;
-	b->slen = (int) j;
-	if (NULL == (b->data = (unsigned char *) bstr__alloc (b->mlen = i))) {
-		bstr__free (b);
-		return NULL;
-	}
-
-	bstr__memcpy (b->data, str, j+1);
-	return b;
-}
-
-/*  bstring bfromcstralloc (int mlen, const char * str)
- *
- *  Create a bstring which contains the contents of the '\0' terminated char *
- *  buffer str.  The memory buffer backing the string is at least len 
- *  characters in length.
- */
-bstring bfromcstralloc (int mlen, const char * str) {
-bstring b;
-int i;
-size_t j;
-
-	if (str == NULL) return NULL;
-	j = (strlen) (str);
-	i = snapUpSize ((int) (j + (2 - (j != 0))));
-	if (i <= (int) j) return NULL;
-
-	b = (bstring) bstr__alloc (sizeof (struct tagbstring));
-	if (b == NULL) return NULL;
-	b->slen = (int) j;
-	if (i < mlen) i = mlen;
-
-	if (NULL == (b->data = (unsigned char *) bstr__alloc (b->mlen = i))) {
-		bstr__free (b);
-		return NULL;
-	}
-
-	bstr__memcpy (b->data, str, j+1);
-	return b;
-}
-
-/*  bstring blk2bstr (const void * blk, int len)
- *
- *  Create a bstring which contains the content of the block blk of length 
- *  len.
- */
-bstring blk2bstr (const void * blk, int len) {
-bstring b;
-int i;
-
-	if (blk == NULL || len < 0) return NULL;
-	b = (bstring) bstr__alloc (sizeof (struct tagbstring));
-	if (b == NULL) return NULL;
-	b->slen = len;
-
-	i = len + (2 - (len != 0));
-	i = snapUpSize (i);
-
-	b->mlen = i;
-
-	b->data = (unsigned char *) bstr__alloc ((size_t) b->mlen);
-	if (b->data == NULL) {
-		bstr__free (b);
-		return NULL;
-	}
-
-	if (len > 0) bstr__memcpy (b->data, blk, (size_t) len);
-	b->data[len] = (unsigned char) '\0';
-
-	return b;
-}
-
-/*  char * bstr2cstr (const_bstring s, char z)
- *
- *  Create a '\0' terminated char * buffer which is equal to the contents of 
- *  the bstring s, except that any contained '\0' characters are converted 
- *  to the character in z. This returned value should be freed with a 
- *  bcstrfree () call, by the calling application.
- */
-char * bstr2cstr (const_bstring b, char z) {
-int i, l;
-char * r;
-
-	if (b == NULL || b->slen < 0 || b->data == NULL) return NULL;
-	l = b->slen;
-	r = (char *) bstr__alloc ((size_t) (l + 1));
-	if (r == NULL) return r;
-
-	for (i=0; i < l; i ++) {
-		r[i] = (char) ((b->data[i] == '\0') ? z : (char) (b->data[i]));
-	}
-
-	r[l] = (unsigned char) '\0';
-
-	return r;
-}
-
-/*  int bcstrfree (char * s)
- *
- *  Frees a C-string generated by bstr2cstr ().  This is normally unnecessary
- *  since it just wraps a call to bstr__free (), however, if bstr__alloc () 
- *  and bstr__free () have been redefined as a macros within the bstrlib 
- *  module (via defining them in memdbg.h after defining 
- *  BSTRLIB_MEMORY_DEBUG) with some difference in behaviour from the std 
- *  library functions, then this allows a correct way of freeing the memory 
- *  that allows higher level code to be independent from these macro 
- *  redefinitions.
- */
-int bcstrfree (char * s) {
-	if (s) {
-		bstr__free (s);
-		return BSTR_OK;
-	}
-	return BSTR_ERR;
-}
-
-/*  int bconcat (bstring b0, const_bstring b1)
- *
- *  Concatenate the bstring b1 to the bstring b0.
- */
-int bconcat (bstring b0, const_bstring b1) {
-int len, d;
-bstring aux = (bstring) b1;
-
-	if (b0 == NULL || b1 == NULL || b0->data == NULL || b1->data == NULL) return BSTR_ERR;
-
-	d = b0->slen;
-	len = b1->slen;
-	if ((d | (b0->mlen - d) | len | (d + len)) < 0) return BSTR_ERR;
-
-	if (b0->mlen <= d + len + 1) {
-		ptrdiff_t pd = b1->data - b0->data;
-		if (0 <= pd && pd < b0->mlen) {
-			if (NULL == (aux = bstrcpy (b1))) return BSTR_ERR;
-		}
-		if (balloc (b0, d + len + 1) != BSTR_OK) {
-			if (aux != b1) bdestroy (aux);
-			return BSTR_ERR;
-		}
-	}
-
-	bBlockCopy (&b0->data[d], &aux->data[0], (size_t) len);
-	b0->data[d + len] = (unsigned char) '\0';
-	b0->slen = d + len;
-	if (aux != b1) bdestroy (aux);
-	return BSTR_OK;
-}
-
-/*  int bconchar (bstring b, char c)
-/ *
- *  Concatenate the single character c to the bstring b.
- */
-int bconchar (bstring b, char c) {
-int d;
-
-	if (b == NULL) return BSTR_ERR;
-	d = b->slen;
-	if ((d | (b->mlen - d)) < 0 || balloc (b, d + 2) != BSTR_OK) return BSTR_ERR;
-	b->data[d] = (unsigned char) c;
-	b->data[d + 1] = (unsigned char) '\0';
-	b->slen++;
-	return BSTR_OK;
-}
-
-/*  int bcatcstr (bstring b, const char * s)
- *
- *  Concatenate a char * string to a bstring.
- */
-int bcatcstr (bstring b, const char * s) {
-char * d;
-int i, l;
-
-	if (b == NULL || b->data == NULL || b->slen < 0 || b->mlen < b->slen
-	 || b->mlen <= 0 || s == NULL) return BSTR_ERR;
-
-	/* Optimistically concatenate directly */
-	l = b->mlen - b->slen;
-	d = (char *) &b->data[b->slen];
-	for (i=0; i < l; i++) {
-		if ((*d++ = *s++) == '\0') {
-			b->slen += i;
-			return BSTR_OK;
-		}
-	}
-	b->slen += i;
-
-	/* Need to explicitely resize and concatenate tail */
-	return bcatblk (b, (const void *) s, (int) strlen (s));
-}
-
-/*  int bcatblk (bstring b, const void * s, int len)
- *
- *  Concatenate a fixed length buffer to a bstring.
- */
-int bcatblk (bstring b, const void * s, int len) {
-int nl;
-
-	if (b == NULL || b->data == NULL || b->slen < 0 || b->mlen < b->slen
-	 || b->mlen <= 0 || s == NULL || len < 0) return BSTR_ERR;
-
-	if (0 > (nl = b->slen + len)) return BSTR_ERR; /* Overflow? */
-	if (b->mlen <= nl && 0 > balloc (b, nl + 1)) return BSTR_ERR;
-
-	bBlockCopy (&b->data[b->slen], s, (size_t) len);
-	b->slen = nl;
-	b->data[nl] = (unsigned char) '\0';
-	return BSTR_OK;
-}
-
-/*  bstring bstrcpy (const_bstring b)
- *
- *  Create a copy of the bstring b.
- */
-bstring bstrcpy (const_bstring b) {
-bstring b0;
-int i,j;
-
-	/* Attempted to copy an invalid string? */
-	if (b == NULL || b->slen < 0 || b->data == NULL) return NULL;
-
-	b0 = (bstring) bstr__alloc (sizeof (struct tagbstring));
-	if (b0 == NULL) {
-		/* Unable to allocate memory for string header */
-		return NULL;
-	}
-
-	i = b->slen;
-	j = snapUpSize (i + 1);
-
-	b0->data = (unsigned char *) bstr__alloc (j);
-	if (b0->data == NULL) {
-		j = i + 1;
-		b0->data = (unsigned char *) bstr__alloc (j);
-		if (b0->data == NULL) {
-			/* Unable to allocate memory for string data */
-			bstr__free (b0);
-			return NULL;
-		}
-	}
-
-	b0->mlen = j;
-	b0->slen = i;
-
-	if (i) bstr__memcpy ((char *) b0->data, (char *) b->data, i);
-	b0->data[b0->slen] = (unsigned char) '\0';
-
-	return b0;
-}
-
-/*  int bassign (bstring a, const_bstring b)
- *
- *  Overwrite the string a with the contents of string b.
- */
-int bassign (bstring a, const_bstring b) {
-	if (b == NULL || b->data == NULL || b->slen < 0)
-		return BSTR_ERR;
-	if (b->slen != 0) {
-		if (balloc (a, b->slen) != BSTR_OK) return BSTR_ERR;
-		bstr__memmove (a->data, b->data, b->slen);
-	} else {
-		if (a == NULL || a->data == NULL || a->mlen < a->slen || 
-		    a->slen < 0 || a->mlen == 0) 
-			return BSTR_ERR;
-	}
-	a->data[b->slen] = (unsigned char) '\0';
-	a->slen = b->slen;
-	return BSTR_OK;
-}
-
-/*  int bassignmidstr (bstring a, const_bstring b, int left, int len)
- *
- *  Overwrite the string a with the middle of contents of string b 
- *  starting from position left and running for a length len.  left and 
- *  len are clamped to the ends of b as with the function bmidstr.
- */
-int bassignmidstr (bstring a, const_bstring b, int left, int len) {
-	if (b == NULL || b->data == NULL || b->slen < 0)
-		return BSTR_ERR;
-
-	if (left < 0) {
-		len += left;
-		left = 0;
-	}
-
-	if (len > b->slen - left) len = b->slen - left;
-
-	if (a == NULL || a->data == NULL || a->mlen < a->slen ||
-	    a->slen < 0 || a->mlen == 0)
-		return BSTR_ERR;
-
-	if (len > 0) {
-		if (balloc (a, len) != BSTR_OK) return BSTR_ERR;
-		bstr__memmove (a->data, b->data + left, len);
-		a->slen = len;
-	} else {
-		a->slen = 0;
-	}
-	a->data[a->slen] = (unsigned char) '\0';
-	return BSTR_OK;
-}
-
-/*  int bassigncstr (bstring a, const char * str)
- *
- *  Overwrite the string a with the contents of char * string str.  Note that 
- *  the bstring a must be a well defined and writable bstring.  If an error 
- *  occurs BSTR_ERR is returned however a may be partially overwritten.
- */
-int bassigncstr (bstring a, const char * str) {
-int i;
-size_t len;
-	if (a == NULL || a->data == NULL || a->mlen < a->slen ||
-	    a->slen < 0 || a->mlen == 0 || NULL == str) 
-		return BSTR_ERR;
-
-	for (i=0; i < a->mlen; i++) {
-		if ('\0' == (a->data[i] = str[i])) {
-			a->slen = i;
-			return BSTR_OK;
-		}
-	}
-
-	a->slen = i;
-	len = strlen (str + i);
-	if (len > INT_MAX || i + len + 1 > INT_MAX ||
-	    0 > balloc (a, (int) (i + len + 1))) return BSTR_ERR;
-	bBlockCopy (a->data + i, str + i, (size_t) len + 1);
-	a->slen += (int) len;
-	return BSTR_OK;
-}
-
-/*  int bassignblk (bstring a, const void * s, int len)
- *
- *  Overwrite the string a with the contents of the block (s, len).  Note that 
- *  the bstring a must be a well defined and writable bstring.  If an error 
- *  occurs BSTR_ERR is returned and a is not overwritten.
- */
-int bassignblk (bstring a, const void * s, int len) {
-	if (a == NULL || a->data == NULL || a->mlen < a->slen ||
-	    a->slen < 0 || a->mlen == 0 || NULL == s || len + 1 < 1) 
-		return BSTR_ERR;
-	if (len + 1 > a->mlen && 0 > balloc (a, len + 1)) return BSTR_ERR;
-	bBlockCopy (a->data, s, (size_t) len);
-	a->data[len] = (unsigned char) '\0';
-	a->slen = len;
-	return BSTR_OK;
-}
-
-/*  int btrunc (bstring b, int n)
- *
- *  Truncate the bstring to at most n characters.
- */
-int btrunc (bstring b, int n) {
-	if (n < 0 || b == NULL || b->data == NULL || b->mlen < b->slen ||
-	    b->slen < 0 || b->mlen <= 0) return BSTR_ERR;
-	if (b->slen > n) {
-		b->slen = n;
-		b->data[n] = (unsigned char) '\0';
-	}
-	return BSTR_OK;
-}
-
-#define   upcase(c) (toupper ((unsigned char) c))
-#define downcase(c) (tolower ((unsigned char) c))
-#define   wspace(c) (isspace ((unsigned char) c))
-
-/*  int btoupper (bstring b)
- *
- *  Convert contents of bstring to upper case.
- */
-int btoupper (bstring b) {
-int i, len;
-	if (b == NULL || b->data == NULL || b->mlen < b->slen ||
-	    b->slen < 0 || b->mlen <= 0) return BSTR_ERR;
-	for (i=0, len = b->slen; i < len; i++) {
-		b->data[i] = (unsigned char) upcase (b->data[i]);
-	}
-	return BSTR_OK;
-}
-
-/*  int btolower (bstring b)
- *
- *  Convert contents of bstring to lower case.
- */
-int btolower (bstring b) {
-int i, len;
-	if (b == NULL || b->data == NULL || b->mlen < b->slen ||
-	    b->slen < 0 || b->mlen <= 0) return BSTR_ERR;
-	for (i=0, len = b->slen; i < len; i++) {
-		b->data[i] = (unsigned char) downcase (b->data[i]);
-	}
-	return BSTR_OK;
-}
-
-/*  int bstricmp (const_bstring b0, const_bstring b1)
- *
- *  Compare two strings without differentiating between case.  The return 
- *  value is the difference of the values of the characters where the two 
- *  strings first differ after lower case transformation, otherwise 0 is 
- *  returned indicating that the strings are equal.  If the lengths are 
- *  different, then a difference from 0 is given, but if the first extra 
- *  character is '\0', then it is taken to be the value UCHAR_MAX+1.
- */
-int bstricmp (const_bstring b0, const_bstring b1) {
-int i, v, n;
-
-	if (bdata (b0) == NULL || b0->slen < 0 || 
-	    bdata (b1) == NULL || b1->slen < 0) return SHRT_MIN;
-	if ((n = b0->slen) > b1->slen) n = b1->slen;
-	else if (b0->slen == b1->slen && b0->data == b1->data) return BSTR_OK;
-
-	for (i = 0; i < n; i ++) {
-		v  = (char) downcase (b0->data[i])
-		   - (char) downcase (b1->data[i]);
-		if (0 != v) return v;
-	}
-
-	if (b0->slen > n) {
-		v = (char) downcase (b0->data[n]);
-		if (v) return v;
-		return UCHAR_MAX + 1;
-	}
-	if (b1->slen > n) {
-		v = - (char) downcase (b1->data[n]);
-		if (v) return v;
-		return - (int) (UCHAR_MAX + 1);
-	}
-	return BSTR_OK;
-}
-
-/*  int bstrnicmp (const_bstring b0, const_bstring b1, int n)
- *
- *  Compare two strings without differentiating between case for at most n
- *  characters.  If the position where the two strings first differ is
- *  before the nth position, the return value is the difference of the values
- *  of the characters, otherwise 0 is returned.  If the lengths are different
- *  and less than n characters, then a difference from 0 is given, but if the 
- *  first extra character is '\0', then it is taken to be the value 
- *  UCHAR_MAX+1.
- */
-int bstrnicmp (const_bstring b0, const_bstring b1, int n) {
-int i, v, m;
-
-	if (bdata (b0) == NULL || b0->slen < 0 || 
-	    bdata (b1) == NULL || b1->slen < 0 || n < 0) return SHRT_MIN;
-	m = n;
-	if (m > b0->slen) m = b0->slen;
-	if (m > b1->slen) m = b1->slen;
-
-	if (b0->data != b1->data) {
-		for (i = 0; i < m; i ++) {
-			v  = (char) downcase (b0->data[i]);
-			v -= (char) downcase (b1->data[i]);
-			if (v != 0) return b0->data[i] - b1->data[i];
-		}
-	}
-
-	if (n == m || b0->slen == b1->slen) return BSTR_OK;
-
-	if (b0->slen > m) {
-		v = (char) downcase (b0->data[m]);
-		if (v) return v;
-		return UCHAR_MAX + 1;
-	}
-
-	v = - (char) downcase (b1->data[m]);
-	if (v) return v;
-	return - (int) (UCHAR_MAX + 1);
-}
-
-/*  int biseqcaseless (const_bstring b0, const_bstring b1)
- *
- *  Compare two strings for equality without differentiating between case.  
- *  If the strings differ other than in case, 0 is returned, if the strings 
- *  are the same, 1 is returned, if there is an error, -1 is returned.  If 
- *  the length of the strings are different, this function is O(1).  '\0' 
- *  termination characters are not treated in any special way.
- */
-int biseqcaseless (const_bstring b0, const_bstring b1) {
-int i, n;
-
-	if (bdata (b0) == NULL || b0->slen < 0 || 
-	    bdata (b1) == NULL || b1->slen < 0) return BSTR_ERR;
-	if (b0->slen != b1->slen) return BSTR_OK;
-	if (b0->data == b1->data || b0->slen == 0) return 1;
-	for (i=0, n=b0->slen; i < n; i++) {
-		if (b0->data[i] != b1->data[i]) {
-			unsigned char c = (unsigned char) downcase (b0->data[i]);
-			if (c != (unsigned char) downcase (b1->data[i])) return 0;
-		}
-	}
-	return 1;
-}
-
-/*  int bisstemeqcaselessblk (const_bstring b0, const void * blk, int len)
- *
- *  Compare beginning of string b0 with a block of memory of length len 
- *  without differentiating between case for equality.  If the beginning of b0
- *  differs from the memory block other than in case (or if b0 is too short), 
- *  0 is returned, if the strings are the same, 1 is returned, if there is an 
- *  error, -1 is returned.  '\0' characters are not treated in any special 
- *  way.
- */
-int bisstemeqcaselessblk (const_bstring b0, const void * blk, int len) {
-int i;
-
-	if (bdata (b0) == NULL || b0->slen < 0 || NULL == blk || len < 0)
-		return BSTR_ERR;
-	if (b0->slen < len) return BSTR_OK;
-	if (b0->data == (const unsigned char *) blk || len == 0) return 1;
-
-	for (i = 0; i < len; i ++) {
-		if (b0->data[i] != ((const unsigned char *) blk)[i]) {
-			if (downcase (b0->data[i]) != 
-			    downcase (((const unsigned char *) blk)[i])) return 0;
-		}
-	}
-	return 1;
-}
-
-/*
- * int bltrimws (bstring b)
- *
- * Delete whitespace contiguous from the left end of the string.
- */
-int bltrimws (bstring b) {
-int i, len;
-
-	if (b == NULL || b->data == NULL || b->mlen < b->slen ||
-	    b->slen < 0 || b->mlen <= 0) return BSTR_ERR;
-
-	for (len = b->slen, i = 0; i < len; i++) {
-		if (!wspace (b->data[i])) {
-			return bdelete (b, 0, i);
-		}
-	}
-
-	b->data[0] = (unsigned char) '\0';
-	b->slen = 0;
-	return BSTR_OK;
-}
-
-/*
- * int brtrimws (bstring b)
- *
- * Delete whitespace contiguous from the right end of the string.
- */
-int brtrimws (bstring b) {
-int i;
-
-	if (b == NULL || b->data == NULL || b->mlen < b->slen ||
-	    b->slen < 0 || b->mlen <= 0) return BSTR_ERR;
-
-	for (i = b->slen - 1; i >= 0; i--) {
-		if (!wspace (b->data[i])) {
-			if (b->mlen > i) b->data[i+1] = (unsigned char) '\0';
-			b->slen = i + 1;
-			return BSTR_OK;
-		}
-	}
-
-	b->data[0] = (unsigned char) '\0';
-	b->slen = 0;
-	return BSTR_OK;
-}
-
-/*
- * int btrimws (bstring b)
- *
- * Delete whitespace contiguous from both ends of the string.
- */
-int btrimws (bstring b) {
-int i, j;
-
-	if (b == NULL || b->data == NULL || b->mlen < b->slen ||
-	    b->slen < 0 || b->mlen <= 0) return BSTR_ERR;
-
-	for (i = b->slen - 1; i >= 0; i--) {
-		if (!wspace (b->data[i])) {
-			if (b->mlen > i) b->data[i+1] = (unsigned char) '\0';
-			b->slen = i + 1;
-			for (j = 0; wspace (b->data[j]); j++) {}
-			return bdelete (b, 0, j);
-		}
-	}
-
-	b->data[0] = (unsigned char) '\0';
-	b->slen = 0;
-	return BSTR_OK;
-}
-
-/*  int biseq (const_bstring b0, const_bstring b1)
- *
- *  Compare the string b0 and b1.  If the strings differ, 0 is returned, if 
- *  the strings are the same, 1 is returned, if there is an error, -1 is 
- *  returned.  If the length of the strings are different, this function is
- *  O(1).  '\0' termination characters are not treated in any special way.
- */
-int biseq (const_bstring b0, const_bstring b1) {
-	if (b0 == NULL || b1 == NULL || b0->data == NULL || b1->data == NULL ||
-		b0->slen < 0 || b1->slen < 0) return BSTR_ERR;
-	if (b0->slen != b1->slen) return BSTR_OK;
-	if (b0->data == b1->data || b0->slen == 0) return 1;
-	return !bstr__memcmp (b0->data, b1->data, b0->slen);
-}
-
-/*  int bisstemeqblk (const_bstring b0, const void * blk, int len)
- *
- *  Compare beginning of string b0 with a block of memory of length len for 
- *  equality.  If the beginning of b0 differs from the memory block (or if b0 
- *  is too short), 0 is returned, if the strings are the same, 1 is returned, 
- *  if there is an error, -1 is returned.  '\0' characters are not treated in 
- *  any special way.
- */
-int bisstemeqblk (const_bstring b0, const void * blk, int len) {
-int i;
-
-	if (bdata (b0) == NULL || b0->slen < 0 || NULL == blk || len < 0)
-		return BSTR_ERR;
-	if (b0->slen < len) return BSTR_OK;
-	if (b0->data == (const unsigned char *) blk || len == 0) return 1;
-
-	for (i = 0; i < len; i ++) {
-		if (b0->data[i] != ((const unsigned char *) blk)[i]) return BSTR_OK;
-	}
-	return 1;
-}
-
-/*  int biseqcstr (const_bstring b, const char *s)
- *
- *  Compare the bstring b and char * string s.  The C string s must be '\0' 
- *  terminated at exactly the length of the bstring b, and the contents 
- *  between the two must be identical with the bstring b with no '\0' 
- *  characters for the two contents to be considered equal.  This is 
- *  equivalent to the condition that their current contents will be always be 
- *  equal when comparing them in the same format after converting one or the 
- *  other.  If the strings are equal 1 is returned, if they are unequal 0 is 
- *  returned and if there is a detectable error BSTR_ERR is returned.
- */
-int biseqcstr (const_bstring b, const char * s) {
-int i;
-	if (b == NULL || s == NULL || b->data == NULL || b->slen < 0) return BSTR_ERR;
-	for (i=0; i < b->slen; i++) {
-		if (s[i] == '\0' || b->data[i] != (unsigned char) s[i]) return BSTR_OK;
-	}
-	return s[i] == '\0';
-}
-
-/*  int biseqcstrcaseless (const_bstring b, const char *s)
- *
- *  Compare the bstring b and char * string s.  The C string s must be '\0' 
- *  terminated at exactly the length of the bstring b, and the contents 
- *  between the two must be identical except for case with the bstring b with 
- *  no '\0' characters for the two contents to be considered equal.  This is 
- *  equivalent to the condition that their current contents will be always be 
- *  equal ignoring case when comparing them in the same format after 
- *  converting one or the other.  If the strings are equal, except for case, 
- *  1 is returned, if they are unequal regardless of case 0 is returned and 
- *  if there is a detectable error BSTR_ERR is returned.
- */
-int biseqcstrcaseless (const_bstring b, const char * s) {
-int i;
-	if (b == NULL || s == NULL || b->data == NULL || b->slen < 0) return BSTR_ERR;
-	for (i=0; i < b->slen; i++) {
-		if (s[i] == '\0' || 
-		    (b->data[i] != (unsigned char) s[i] && 
-		     downcase (b->data[i]) != (unsigned char) downcase (s[i])))
-			return BSTR_OK;
-	}
-	return s[i] == '\0';
-}
-
-/*  int bstrcmp (const_bstring b0, const_bstring b1)
- *
- *  Compare the string b0 and b1.  If there is an error, SHRT_MIN is returned, 
- *  otherwise a value less than or greater than zero, indicating that the 
- *  string pointed to by b0 is lexicographically less than or greater than 
- *  the string pointed to by b1 is returned.  If the the string lengths are 
- *  unequal but the characters up until the length of the shorter are equal 
- *  then a value less than, or greater than zero, indicating that the string 
- *  pointed to by b0 is shorter or longer than the string pointed to by b1 is 
- *  returned.  0 is returned if and only if the two strings are the same.  If 
- *  the length of the strings are different, this function is O(n).  Like its
- *  standard C library counter part strcmp, the comparison does not proceed 
- *  past any '\0' termination characters encountered.
- */
-int bstrcmp (const_bstring b0, const_bstring b1) {
-int i, v, n;
-
-	if (b0 == NULL || b1 == NULL || b0->data == NULL || b1->data == NULL ||
-		b0->slen < 0 || b1->slen < 0) return SHRT_MIN;
-	n = b0->slen; if (n > b1->slen) n = b1->slen;
-	if (b0->slen == b1->slen && (b0->data == b1->data || b0->slen == 0))
-		return BSTR_OK;
-
-	for (i = 0; i < n; i ++) {
-		v = ((char) b0->data[i]) - ((char) b1->data[i]);
-		if (v != 0) return v;
-		if (b0->data[i] == (unsigned char) '\0') return BSTR_OK;
-	}
-
-	if (b0->slen > n) return 1;
-	if (b1->slen > n) return -1;
-	return BSTR_OK;
-}
-
-/*  int bstrncmp (const_bstring b0, const_bstring b1, int n)
- *
- *  Compare the string b0 and b1 for at most n characters.  If there is an 
- *  error, SHRT_MIN is returned, otherwise a value is returned as if b0 and 
- *  b1 were first truncated to at most n characters then bstrcmp was called
- *  with these new strings are paremeters.  If the length of the strings are 
- *  different, this function is O(n).  Like its standard C library counter 
- *  part strcmp, the comparison does not proceed past any '\0' termination 
- *  characters encountered.
- */
-int bstrncmp (const_bstring b0, const_bstring b1, int n) {
-int i, v, m;
-
-	if (b0 == NULL || b1 == NULL || b0->data == NULL || b1->data == NULL ||
-		b0->slen < 0 || b1->slen < 0) return SHRT_MIN;
-	m = n;
-	if (m > b0->slen) m = b0->slen;
-	if (m > b1->slen) m = b1->slen;
-
-	if (b0->data != b1->data) {
-		for (i = 0; i < m; i ++) {
-			v = ((char) b0->data[i]) - ((char) b1->data[i]);
-			if (v != 0) return v;
-			if (b0->data[i] == (unsigned char) '\0') return BSTR_OK;
-		}
-	}
-
-	if (n == m || b0->slen == b1->slen) return BSTR_OK;
-
-	if (b0->slen > m) return 1;
-	return -1;
-}
-
-/*  bstring bmidstr (const_bstring b, int left, int len)
- *
- *  Create a bstring which is the substring of b starting from position left
- *  and running for a length len (clamped by the end of the bstring b.)  If
- *  b is detectably invalid, then NULL is returned.  The section described 
- *  by (left, len) is clamped to the boundaries of b.
- */
-bstring bmidstr (const_bstring b, int left, int len) {
-
-	if (b == NULL || b->slen < 0 || b->data == NULL) return NULL;
-
-	if (left < 0) {
-		len += left;
-		left = 0;
-	}
-
-	if (len > b->slen - left) len = b->slen - left;
-
-	if (len <= 0) return bfromcstr ("");
-	return blk2bstr (b->data + left, len);
-}
-
-/*  int bdelete (bstring b, int pos, int len)
- *
- *  Removes characters from pos to pos+len-1 inclusive and shifts the tail of 
- *  the bstring starting from pos+len to pos.  len must be positive for this 
- *  call to have any effect.  The section of the string described by (pos, 
- *  len) is clamped to boundaries of the bstring b.
- */
-int bdelete (bstring b, int pos, int len) {
-	/* Clamp to left side of bstring */
-	if (pos < 0) {
-		len += pos;
-		pos = 0;
-	}
-
-	if (len < 0 || b == NULL || b->data == NULL || b->slen < 0 || 
-	    b->mlen < b->slen || b->mlen <= 0) 
-		return BSTR_ERR;
-	if (len > 0 && pos < b->slen) {
-		if (pos + len >= b->slen) {
-			b->slen = pos;
-		} else {
-			bBlockCopy ((char *) (b->data + pos),
-			            (char *) (b->data + pos + len), 
-			            b->slen - (pos+len));
-			b->slen -= len;
-		}
-		b->data[b->slen] = (unsigned char) '\0';
-	}
-	return BSTR_OK;
-}
-
-/*  int bdestroy (bstring b)
- *
- *  Free up the bstring.  Note that if b is detectably invalid or not writable
- *  then no action is performed and BSTR_ERR is returned.  Like a freed memory
- *  allocation, dereferences, writes or any other action on b after it has 
- *  been bdestroyed is undefined.
- */
-int bdestroy (bstring b) {
-	if (b == NULL || b->slen < 0 || b->mlen <= 0 || b->mlen < b->slen ||
-	    b->data == NULL)
-		return BSTR_ERR;
-
-	bstr__free (b->data);
-
-	/* In case there is any stale usage, there is one more chance to 
-	   notice this error. */
-
-	b->slen = -1;
-	b->mlen = -__LINE__;
-	b->data = NULL;
-
-	bstr__free (b);
-	return BSTR_OK;
-}
-
-/*  int binstr (const_bstring b1, int pos, const_bstring b2)
- *
- *  Search for the bstring b2 in b1 starting from position pos, and searching 
- *  forward.  If it is found then return with the first position where it is 
- *  found, otherwise return BSTR_ERR.  Note that this is just a brute force 
- *  string searcher that does not attempt clever things like the Boyer-Moore 
- *  search algorithm.  Because of this there are many degenerate cases where 
- *  this can take much longer than it needs to.
- */
-int binstr (const_bstring b1, int pos, const_bstring b2) {
-int j, ii, ll, lf;
-unsigned char * d0;
-unsigned char c0;
-register unsigned char * d1;
-register unsigned char c1;
-register int i;
-
-	if (b1 == NULL || b1->data == NULL || b1->slen < 0 ||
-	    b2 == NULL || b2->data == NULL || b2->slen < 0) return BSTR_ERR;
-	if (b1->slen == pos) return (b2->slen == 0)?pos:BSTR_ERR;
-	if (b1->slen < pos || pos < 0) return BSTR_ERR;
-	if (b2->slen == 0) return pos;
-
-	/* No space to find such a string? */
-	if ((lf = b1->slen - b2->slen + 1) <= pos) return BSTR_ERR;
-
-	/* An obvious alias case */
-	if (b1->data == b2->data && pos == 0) return 0;
-
-	i = pos;
-
-	d0 = b2->data;
-	d1 = b1->data;
-	ll = b2->slen;
-
-	/* Peel off the b2->slen == 1 case */
-	c0 = d0[0];
-	if (1 == ll) {
-		for (;i < lf; i++) if (c0 == d1[i]) return i;
-		return BSTR_ERR;
-	}
-
-	c1 = c0;
-	j = 0;
-	lf = b1->slen - 1;
-
-	ii = -1;
-	if (i < lf) do {
-		/* Unrolled current character test */
-		if (c1 != d1[i]) {
-			if (c1 != d1[1+i]) {
-				i += 2;
-				continue;
-			}
-			i++;
-		}
-
-		/* Take note if this is the start of a potential match */
-		if (0 == j) ii = i;
-
-		/* Shift the test character down by one */
-		j++;
-		i++;
-
-		/* If this isn't past the last character continue */
-		if (j < ll) {
-			c1 = d0[j];
-			continue;
-		}
-
-		N0:;
-
-		/* If no characters mismatched, then we matched */
-		if (i == ii+j) return ii;
-
-		/* Shift back to the beginning */
-		i -= j;
-		j  = 0;
-		c1 = c0;
-	} while (i < lf);
-
-	/* Deal with last case if unrolling caused a misalignment */
-	if (i == lf && ll == j+1 && c1 == d1[i]) goto N0;
-
-	return BSTR_ERR;
-}
-
-/*  int binstrr (const_bstring b1, int pos, const_bstring b2)
- *
- *  Search for the bstring b2 in b1 starting from position pos, and searching 
- *  backward.  If it is found then return with the first position where it is 
- *  found, otherwise return BSTR_ERR.  Note that this is just a brute force 
- *  string searcher that does not attempt clever things like the Boyer-Moore 
- *  search algorithm.  Because of this there are many degenerate cases where 
- *  this can take much longer than it needs to.
- */
-int binstrr (const_bstring b1, int pos, const_bstring b2) {
-int j, i, l;
-unsigned char * d0, * d1;
-
-	if (b1 == NULL || b1->data == NULL || b1->slen < 0 ||
-	    b2 == NULL || b2->data == NULL || b2->slen < 0) return BSTR_ERR;
-	if (b1->slen == pos && b2->slen == 0) return pos;
-	if (b1->slen < pos || pos < 0) return BSTR_ERR;
-	if (b2->slen == 0) return pos;
-
-	/* Obvious alias case */
-	if (b1->data == b2->data && pos == 0 && b2->slen <= b1->slen) return 0;
-
-	i = pos;
-	if ((l = b1->slen - b2->slen) < 0) return BSTR_ERR;
-
-	/* If no space to find such a string then snap back */
-	if (l + 1 <= i) i = l;
-	j = 0;
-
-	d0 = b2->data;
-	d1 = b1->data;
-	l  = b2->slen;
-
-	for (;;) {
-		if (d0[j] == d1[i + j]) {
-			j ++;
-			if (j >= l) return i;
-		} else {
-			i --;
-			if (i < 0) break;
-			j=0;
-		}
-	}
-
-	return BSTR_ERR;
-}
-
-/*  int binstrcaseless (const_bstring b1, int pos, const_bstring b2)
- *
- *  Search for the bstring b2 in b1 starting from position pos, and searching 
- *  forward but without regard to case.  If it is found then return with the 
- *  first position where it is found, otherwise return BSTR_ERR.  Note that 
- *  this is just a brute force string searcher that does not attempt clever 
- *  things like the Boyer-Moore search algorithm.  Because of this there are 
- *  many degenerate cases where this can take much longer than it needs to.
- */
-int binstrcaseless (const_bstring b1, int pos, const_bstring b2) {
-int j, i, l, ll;
-unsigned char * d0, * d1;
-
-	if (b1 == NULL || b1->data == NULL || b1->slen < 0 ||
-	    b2 == NULL || b2->data == NULL || b2->slen < 0) return BSTR_ERR;
-	if (b1->slen == pos) return (b2->slen == 0)?pos:BSTR_ERR;
-	if (b1->slen < pos || pos < 0) return BSTR_ERR;
-	if (b2->slen == 0) return pos;
-
-	l = b1->slen - b2->slen + 1;
-
-	/* No space to find such a string? */
-	if (l <= pos) return BSTR_ERR;
-
-	/* An obvious alias case */
-	if (b1->data == b2->data && pos == 0) return BSTR_OK;
-
-	i = pos;
-	j = 0;
-
-	d0 = b2->data;
-	d1 = b1->data;
-	ll = b2->slen;
-
-	for (;;) {
-		if (d0[j] == d1[i + j] || downcase (d0[j]) == downcase (d1[i + j])) {
-			j ++;
-			if (j >= ll) return i;
-		} else {
-			i ++;
-			if (i >= l) break;
-			j=0;
-		}
-	}
-
-	return BSTR_ERR;
-}
-
-/*  int binstrrcaseless (const_bstring b1, int pos, const_bstring b2)
- *
- *  Search for the bstring b2 in b1 starting from position pos, and searching 
- *  backward but without regard to case.  If it is found then return with the 
- *  first position where it is found, otherwise return BSTR_ERR.  Note that 
- *  this is just a brute force string searcher that does not attempt clever 
- *  things like the Boyer-Moore search algorithm.  Because of this there are 
- *  many degenerate cases where this can take much longer than it needs to.
- */
-int binstrrcaseless (const_bstring b1, int pos, const_bstring b2) {
-int j, i, l;
-unsigned char * d0, * d1;
-
-	if (b1 == NULL || b1->data == NULL || b1->slen < 0 ||
-	    b2 == NULL || b2->data == NULL || b2->slen < 0) return BSTR_ERR;
-	if (b1->slen == pos && b2->slen == 0) return pos;
-	if (b1->slen < pos || pos < 0) return BSTR_ERR;
-	if (b2->slen == 0) return pos;
-
-	/* Obvious alias case */
-	if (b1->data == b2->data && pos == 0 && b2->slen <= b1->slen) return BSTR_OK;
-
-	i = pos;
-	if ((l = b1->slen - b2->slen) < 0) return BSTR_ERR;
-
-	/* If no space to find such a string then snap back */
-	if (l + 1 <= i) i = l;
-	j = 0;
-
-	d0 = b2->data;
-	d1 = b1->data;
-	l  = b2->slen;
-
-	for (;;) {
-		if (d0[j] == d1[i + j] || downcase (d0[j]) == downcase (d1[i + j])) {
-			j ++;
-			if (j >= l) return i;
-		} else {
-			i --;
-			if (i < 0) break;
-			j=0;
-		}
-	}
-
-	return BSTR_ERR;
-}
-
-
-/*  int bstrchrp (const_bstring b, int c, int pos)
- *
- *  Search for the character c in b forwards from the position pos 
- *  (inclusive).
- */
-int bstrchrp (const_bstring b, int c, int pos) {
-unsigned char * p;
-
-	if (b == NULL || b->data == NULL || b->slen <= pos || pos < 0) return BSTR_ERR;
-	p = (unsigned char *) bstr__memchr ((b->data + pos), (unsigned char) c, (b->slen - pos));
-	if (p) return (int) (p - b->data);
-	return BSTR_ERR;
-}
-
-/*  int bstrrchrp (const_bstring b, int c, int pos)
- *
- *  Search for the character c in b backwards from the position pos in string 
- *  (inclusive).
- */
-int bstrrchrp (const_bstring b, int c, int pos) {
-int i;
- 
-	if (b == NULL || b->data == NULL || b->slen <= pos || pos < 0) return BSTR_ERR;
-	for (i=pos; i >= 0; i--) {
-		if (b->data[i] == (unsigned char) c) return i;
-	}
-	return BSTR_ERR;
-}
-
-#if !defined (BSTRLIB_AGGRESSIVE_MEMORY_FOR_SPEED_TRADEOFF)
-#define LONG_LOG_BITS_QTY (3)
-#define LONG_BITS_QTY (1 << LONG_LOG_BITS_QTY)
-#define LONG_TYPE unsigned char
-
-#define CFCLEN ((1 << CHAR_BIT) / LONG_BITS_QTY)
-struct charField { LONG_TYPE content[CFCLEN]; };
-#define testInCharField(cf,c) ((cf)->content[(c) >> LONG_LOG_BITS_QTY] & (((long)1) << ((c) & (LONG_BITS_QTY-1))))
-#define setInCharField(cf,idx) { \
-	unsigned int c = (unsigned int) (idx); \
-	(cf)->content[c >> LONG_LOG_BITS_QTY] |= (LONG_TYPE) (1ul << (c & (LONG_BITS_QTY-1))); \
-}
-
-#else
-
-#define CFCLEN (1 << CHAR_BIT)
-struct charField { unsigned char content[CFCLEN]; };
-#define testInCharField(cf,c) ((cf)->content[(unsigned char) (c)])
-#define setInCharField(cf,idx) (cf)->content[(unsigned int) (idx)] = ~0
-
-#endif
-
-/* Convert a bstring to charField */
-static int buildCharField (struct charField * cf, const_bstring b) {
-int i;
-	if (b == NULL || b->data == NULL || b->slen <= 0) return BSTR_ERR;
-	memset ((void *) cf->content, 0, sizeof (struct charField));
-	for (i=0; i < b->slen; i++) {
-		setInCharField (cf, b->data[i]);
-	}
-	return BSTR_OK;
-}
-
-static void invertCharField (struct charField * cf) {
-int i;
-	for (i=0; i < CFCLEN; i++) cf->content[i] = ~cf->content[i];
-}
-
-/* Inner engine for binchr */
-static int binchrCF (const unsigned char * data, int len, int pos, const struct charField * cf) {
-int i;
-	for (i=pos; i < len; i++) {
-		unsigned char c = (unsigned char) data[i];
-		if (testInCharField (cf, c)) return i;
-	}
-	return BSTR_ERR;
-}
-
-/*  int binchr (const_bstring b0, int pos, const_bstring b1);
- *
- *  Search for the first position in b0 starting from pos or after, in which 
- *  one of the characters in b1 is found and return it.  If such a position 
- *  does not exist in b0, then BSTR_ERR is returned.
- */
-int binchr (const_bstring b0, int pos, const_bstring b1) {
-struct charField chrs;
-	if (pos < 0 || b0 == NULL || b0->data == NULL ||
-	    b0->slen <= pos) return BSTR_ERR;
-	if (1 == b1->slen) return bstrchrp (b0, b1->data[0], pos);
-	if (0 > buildCharField (&chrs, b1)) return BSTR_ERR;
-	return binchrCF (b0->data, b0->slen, pos, &chrs);
-}
-
-/* Inner engine for binchrr */
-static int binchrrCF (const unsigned char * data, int pos, const struct charField * cf) {
-int i;
-	for (i=pos; i >= 0; i--) {
-		unsigned int c = (unsigned int) data[i];
-		if (testInCharField (cf, c)) return i;
-	}
-	return BSTR_ERR;
-}
-
-/*  int binchrr (const_bstring b0, int pos, const_bstring b1);
- *
- *  Search for the last position in b0 no greater than pos, in which one of 
- *  the characters in b1 is found and return it.  If such a position does not 
- *  exist in b0, then BSTR_ERR is returned.
- */
-int binchrr (const_bstring b0, int pos, const_bstring b1) {
-struct charField chrs;
-	if (pos < 0 || b0 == NULL || b0->data == NULL || b1 == NULL ||
-	    b0->slen < pos) return BSTR_ERR;
-	if (pos == b0->slen) pos--;
-	if (1 == b1->slen) return bstrrchrp (b0, b1->data[0], pos);
-	if (0 > buildCharField (&chrs, b1)) return BSTR_ERR;
-	return binchrrCF (b0->data, pos, &chrs);
-}
-
-/*  int bninchr (const_bstring b0, int pos, const_bstring b1);
- *
- *  Search for the first position in b0 starting from pos or after, in which 
- *  none of the characters in b1 is found and return it.  If such a position 
- *  does not exist in b0, then BSTR_ERR is returned.
- */
-int bninchr (const_bstring b0, int pos, const_bstring b1) {
-struct charField chrs;
-	if (pos < 0 || b0 == NULL || b0->data == NULL || 
-	    b0->slen <= pos) return BSTR_ERR;
-	if (buildCharField (&chrs, b1) < 0) return BSTR_ERR;
-	invertCharField (&chrs);
-	return binchrCF (b0->data, b0->slen, pos, &chrs);
-}
-
-/*  int bninchrr (const_bstring b0, int pos, const_bstring b1);
- *
- *  Search for the last position in b0 no greater than pos, in which none of 
- *  the characters in b1 is found and return it.  If such a position does not 
- *  exist in b0, then BSTR_ERR is returned.
- */
-int bninchrr (const_bstring b0, int pos, const_bstring b1) {
-struct charField chrs;
-	if (pos < 0 || b0 == NULL || b0->data == NULL || 
-	    b0->slen < pos) return BSTR_ERR;
-	if (pos == b0->slen) pos--;
-	if (buildCharField (&chrs, b1) < 0) return BSTR_ERR;
-	invertCharField (&chrs);
-	return binchrrCF (b0->data, pos, &chrs);
-}
-
-/*  int bsetstr (bstring b0, int pos, bstring b1, unsigned char fill)
- *
- *  Overwrite the string b0 starting at position pos with the string b1. If 
- *  the position pos is past the end of b0, then the character "fill" is 
- *  appended as necessary to make up the gap between the end of b0 and pos.
- *  If b1 is NULL, it behaves as if it were a 0-length string.
- */
-int bsetstr (bstring b0, int pos, const_bstring b1, unsigned char fill) {
-int d, newlen;
-ptrdiff_t pd;
-bstring aux = (bstring) b1;
-
-	if (pos < 0 || b0 == NULL || b0->slen < 0 || NULL == b0->data || 
-	    b0->mlen < b0->slen || b0->mlen <= 0) return BSTR_ERR;
-	if (b1 != NULL && (b1->slen < 0 || b1->data == NULL)) return BSTR_ERR;
-
-	d = pos;
-
-	/* Aliasing case */
-	if (NULL != aux) {
-		if ((pd = (ptrdiff_t) (b1->data - b0->data)) >= 0 && pd < (ptrdiff_t) b0->mlen) {
-			if (NULL == (aux = bstrcpy (b1))) return BSTR_ERR;
-		}
-		d += aux->slen;
-	}
-
-	/* Increase memory size if necessary */
-	if (balloc (b0, d + 1) != BSTR_OK) {
-		if (aux != b1) bdestroy (aux);
-		return BSTR_ERR;
-	}
-
-	newlen = b0->slen;
-
-	/* Fill in "fill" character as necessary */
-	if (pos > newlen) {
-		bstr__memset (b0->data + b0->slen, (int) fill, (size_t) (pos - b0->slen));
-		newlen = pos;
-	}
-
-	/* Copy b1 to position pos in b0. */
-	if (aux != NULL) {
-		bBlockCopy ((char *) (b0->data + pos), (char *) aux->data, aux->slen);
-		if (aux != b1) bdestroy (aux);
-	}
-
-	/* Indicate the potentially increased size of b0 */
-	if (d > newlen) newlen = d;
-
-	b0->slen = newlen;
-	b0->data[newlen] = (unsigned char) '\0';
-
-	return BSTR_OK;
-}
-
-/*  int binsert (bstring b1, int pos, bstring b2, unsigned char fill)
- *
- *  Inserts the string b2 into b1 at position pos.  If the position pos is 
- *  past the end of b1, then the character "fill" is appended as necessary to 
- *  make up the gap between the end of b1 and pos.  Unlike bsetstr, binsert
- *  does not allow b2 to be NULL.
- */
-int binsert (bstring b1, int pos, const_bstring b2, unsigned char fill) {
-int d, l;
-ptrdiff_t pd;
-bstring aux = (bstring) b2;
-
-	if (pos < 0 || b1 == NULL || b2 == NULL || b1->slen < 0 || 
-	    b2->slen < 0 || b1->mlen < b1->slen || b1->mlen <= 0) return BSTR_ERR;
-
-	/* Aliasing case */
-	if ((pd = (ptrdiff_t) (b2->data - b1->data)) >= 0 && pd < (ptrdiff_t) b1->mlen) {
-		if (NULL == (aux = bstrcpy (b2))) return BSTR_ERR;
-	}
-
-	/* Compute the two possible end pointers */
-	d = b1->slen + aux->slen;
-	l = pos + aux->slen;
-	if ((d|l) < 0) return BSTR_ERR;
-
-	if (l > d) {
-		/* Inserting past the end of the string */
-		if (balloc (b1, l + 1) != BSTR_OK) {
-			if (aux != b2) bdestroy (aux);
-			return BSTR_ERR;
-		}
-		bstr__memset (b1->data + b1->slen, (int) fill, (size_t) (pos - b1->slen));
-		b1->slen = l;
-	} else {
-		/* Inserting in the middle of the string */
-		if (balloc (b1, d + 1) != BSTR_OK) {
-			if (aux != b2) bdestroy (aux);
-			return BSTR_ERR;
-		}
-		bBlockCopy (b1->data + l, b1->data + pos, d - l);
-		b1->slen = d;
-	}
-	bBlockCopy (b1->data + pos, aux->data, aux->slen);
-	b1->data[b1->slen] = (unsigned char) '\0';
-	if (aux != b2) bdestroy (aux);
-	return BSTR_OK;
-}
-
-/*  int breplace (bstring b1, int pos, int len, bstring b2, 
- *                unsigned char fill)
- *
- *  Replace a section of a string from pos for a length len with the string b2.
- *  fill is used is pos > b1->slen.
- */
-int breplace (bstring b1, int pos, int len, const_bstring b2, 
-			  unsigned char fill) {
-int pl, ret;
-ptrdiff_t pd;
-bstring aux = (bstring) b2;
-
-	if (pos < 0 || len < 0 || (pl = pos + len) < 0 || b1 == NULL || 
-	    b2 == NULL || b1->data == NULL || b2->data == NULL || 
-	    b1->slen < 0 || b2->slen < 0 || b1->mlen < b1->slen ||
-	    b1->mlen <= 0) return BSTR_ERR;
-
-	/* Straddles the end? */
-	if (pl >= b1->slen) {
-		if ((ret = bsetstr (b1, pos, b2, fill)) < 0) return ret;
-		if (pos + b2->slen < b1->slen) {
-			b1->slen = pos + b2->slen;
-			b1->data[b1->slen] = (unsigned char) '\0';
-		}
-		return ret;
-	}
-
-	/* Aliasing case */
-	if ((pd = (ptrdiff_t) (b2->data - b1->data)) >= 0 && pd < (ptrdiff_t) b1->slen) {
-		if (NULL == (aux = bstrcpy (b2))) return BSTR_ERR;
-	}
-
-	if (aux->slen > len) {
-		if (balloc (b1, b1->slen + aux->slen - len) != BSTR_OK) {
-			if (aux != b2) bdestroy (aux);
-			return BSTR_ERR;
-		}
-	}
-
-	if (aux->slen != len) bstr__memmove (b1->data + pos + aux->slen, b1->data + pos + len, b1->slen - (pos + len));
-	bstr__memcpy (b1->data + pos, aux->data, aux->slen);
-	b1->slen += aux->slen - len;
-	b1->data[b1->slen] = (unsigned char) '\0';
-	if (aux != b2) bdestroy (aux);
-	return BSTR_OK;
-}
-
-/*  
- *  findreplaceengine is used to implement bfindreplace and 
- *  bfindreplacecaseless. It works by breaking the three cases of
- *  expansion, reduction and replacement, and solving each of these
- *  in the most efficient way possible.
- */
-
-typedef int (*instr_fnptr) (const_bstring s1, int pos, const_bstring s2);
-
-#define INITIAL_STATIC_FIND_INDEX_COUNT 32
-
-static int findreplaceengine (bstring b, const_bstring find, const_bstring repl, int pos, instr_fnptr instr) {
-int i, ret, slen, mlen, delta, acc;
-int * d;
-int static_d[INITIAL_STATIC_FIND_INDEX_COUNT+1]; /* This +1 is unnecessary, but it shuts up LINT. */
-ptrdiff_t pd;
-bstring auxf = (bstring) find;
-bstring auxr = (bstring) repl;
-
-	if (b == NULL || b->data == NULL || find == NULL ||
-	    find->data == NULL || repl == NULL || repl->data == NULL || 
-	    pos < 0 || find->slen <= 0 || b->mlen < 0 || b->slen > b->mlen || 
-	    b->mlen <= 0 || b->slen < 0 || repl->slen < 0) return BSTR_ERR;
-	if (pos > b->slen - find->slen) return BSTR_OK;
-
-	/* Alias with find string */
-	pd = (ptrdiff_t) (find->data - b->data);
-	if ((ptrdiff_t) (pos - find->slen) < pd && pd < (ptrdiff_t) b->slen) {
-		if (NULL == (auxf = bstrcpy (find))) return BSTR_ERR;
-	}
-
-	/* Alias with repl string */
-	pd = (ptrdiff_t) (repl->data - b->data);
-	if ((ptrdiff_t) (pos - repl->slen) < pd && pd < (ptrdiff_t) b->slen) {
-		if (NULL == (auxr = bstrcpy (repl))) {
-			if (auxf != find) bdestroy (auxf);
-			return BSTR_ERR;
-		}
-	}
-
-	delta = auxf->slen - auxr->slen;
-
-	/* in-place replacement since find and replace strings are of equal 
-	   length */
-	if (delta == 0) {
-		while ((pos = instr (b, pos, auxf)) >= 0) {
-			bstr__memcpy (b->data + pos, auxr->data, auxr->slen);
-			pos += auxf->slen;
-		}
-		if (auxf != find) bdestroy (auxf);
-		if (auxr != repl) bdestroy (auxr);
-		return BSTR_OK;
-	}
-
-	/* shrinking replacement since auxf->slen > auxr->slen */
-	if (delta > 0) {
-		acc = 0;
-
-		while ((i = instr (b, pos, auxf)) >= 0) {
-			if (acc && i > pos)
-				bstr__memmove (b->data + pos - acc, b->data + pos, i - pos);
-			if (auxr->slen)
-				bstr__memcpy (b->data + i - acc, auxr->data, auxr->slen);
-			acc += delta;
-			pos = i + auxf->slen;
-		}
-
-		if (acc) {
-			i = b->slen;
-			if (i > pos)
-				bstr__memmove (b->data + pos - acc, b->data + pos, i - pos);
-			b->slen -= acc;
-			b->data[b->slen] = (unsigned char) '\0';
-		}
-
-		if (auxf != find) bdestroy (auxf);
-		if (auxr != repl) bdestroy (auxr);
-		return BSTR_OK;
-	}
-
-	/* expanding replacement since find->slen < repl->slen.  Its a lot 
-	   more complicated.  This works by first finding all the matches and 
-	   storing them to a growable array, then doing at most one resize of
-	   the destination bstring and then performing the direct memory transfers
-	   of the string segment pieces to form the final result. The growable 
-	   array of matches uses a deferred doubling reallocing strategy.  What 
-	   this means is that it starts as a reasonably fixed sized auto array in 
-	   the hopes that many if not most cases will never need to grow this 
-	   array.  But it switches as soon as the bounds of the array will be 
-	   exceeded.  An extra find result is always appended to this array that
-	   corresponds to the end of the destination string, so slen is checked
-	   against mlen - 1 rather than mlen before resizing.
-	*/
-
-	mlen = INITIAL_STATIC_FIND_INDEX_COUNT;
-	d = (int *) static_d; /* Avoid malloc for trivial/initial cases */
-	acc = slen = 0;
-
-	while ((pos = instr (b, pos, auxf)) >= 0) {
-		if (slen >= mlen - 1) {
-			int sl, *t;
-
-			mlen += mlen;
-			sl = sizeof (int *) * mlen;
-			if (static_d == d) d = NULL; /* static_d cannot be realloced */
-			if (mlen <= 0 || sl < mlen || NULL == (t = (int *) bstr__realloc (d, sl))) {
-				ret = BSTR_ERR;
-				goto done;
-			}
-			if (NULL == d) bstr__memcpy (t, static_d, sizeof (static_d));
-			d = t;
-		}
-		d[slen] = pos;
-		slen++;
-		acc -= delta;
-		pos += auxf->slen;
-		if (pos < 0 || acc < 0) {
-			ret = BSTR_ERR;
-			goto done;
-		}
-	}
-	
-	/* slen <= INITIAL_STATIC_INDEX_COUNT-1 or mlen-1 here. */
-	d[slen] = b->slen;
-
-	if (BSTR_OK == (ret = balloc (b, b->slen + acc + 1))) {
-		b->slen += acc;
-		for (i = slen-1; i >= 0; i--) {
-			int s, l;
-			s = d[i] + auxf->slen;
-			l = d[i+1] - s; /* d[slen] may be accessed here. */
-			if (l) {
-				bstr__memmove (b->data + s + acc, b->data + s, l);
-			}
-			if (auxr->slen) {
-				bstr__memmove (b->data + s + acc - auxr->slen, 
-				               auxr->data, auxr->slen);
-			}
-			acc += delta;		
-		}
-		b->data[b->slen] = (unsigned char) '\0';
-	}
-
-	done:;
-	if (static_d == d) d = NULL;
-	bstr__free (d);
-	if (auxf != find) bdestroy (auxf);
-	if (auxr != repl) bdestroy (auxr);
-	return ret;
-}
-
-/*  int bfindreplace (bstring b, const_bstring find, const_bstring repl, 
- *                    int pos)
- *
- *  Replace all occurrences of a find string with a replace string after a
- *  given point in a bstring.
- */
-int bfindreplace (bstring b, const_bstring find, const_bstring repl, int pos) {
-	return findreplaceengine (b, find, repl, pos, binstr);
-}
-
-/*  int bfindreplacecaseless (bstring b, const_bstring find, const_bstring repl, 
- *                    int pos)
- *
- *  Replace all occurrences of a find string, ignoring case, with a replace 
- *  string after a given point in a bstring.
- */
-int bfindreplacecaseless (bstring b, const_bstring find, const_bstring repl, int pos) {
-	return findreplaceengine (b, find, repl, pos, binstrcaseless);
-}
-
-/*  int binsertch (bstring b, int pos, int len, unsigned char fill)
- *
- *  Inserts the character fill repeatedly into b at position pos for a 
- *  length len.  If the position pos is past the end of b, then the 
- *  character "fill" is appended as necessary to make up the gap between the 
- *  end of b and the position pos + len.
- */
-int binsertch (bstring b, int pos, int len, unsigned char fill) {
-int d, l, i;
-
-	if (pos < 0 || b == NULL || b->slen < 0 || b->mlen < b->slen ||
-	    b->mlen <= 0 || len < 0) return BSTR_ERR;
-
-	/* Compute the two possible end pointers */
-	d = b->slen + len;
-	l = pos + len;
-	if ((d|l) < 0) return BSTR_ERR;
-
-	if (l > d) {
-		/* Inserting past the end of the string */
-		if (balloc (b, l + 1) != BSTR_OK) return BSTR_ERR;
-		pos = b->slen;
-		b->slen = l;
-	} else {
-		/* Inserting in the middle of the string */
-		if (balloc (b, d + 1) != BSTR_OK) return BSTR_ERR;
-		for (i = d - 1; i >= l; i--) {
-			b->data[i] = b->data[i - len];
-		}
-		b->slen = d;
-	}
-
-	for (i=pos; i < l; i++) b->data[i] = fill;
-	b->data[b->slen] = (unsigned char) '\0';
-	return BSTR_OK;
-}
-
-/*  int bpattern (bstring b, int len)
- *
- *  Replicate the bstring, b in place, end to end repeatedly until it 
- *  surpasses len characters, then chop the result to exactly len characters. 
- *  This function operates in-place.  The function will return with BSTR_ERR 
- *  if b is NULL or of length 0, otherwise BSTR_OK is returned.
- */
-int bpattern (bstring b, int len) {
-int i, d;
-
-	d = blength (b);
-	if (d <= 0 || len < 0 || balloc (b, len + 1) != BSTR_OK) return BSTR_ERR;
-	if (len > 0) {
-		if (d == 1) return bsetstr (b, len, NULL, b->data[0]);
-		for (i = d; i < len; i++) b->data[i] = b->data[i - d];
-	}
-	b->data[len] = (unsigned char) '\0';
-	b->slen = len;
-	return BSTR_OK;
-}
-
-#define BS_BUFF_SZ (1024)
-
-/*  int breada (bstring b, bNread readPtr, void * parm)
- *
- *  Use a finite buffer fread-like function readPtr to concatenate to the 
- *  bstring b the entire contents of file-like source data in a roughly 
- *  efficient way.
- */
-int breada (bstring b, bNread readPtr, void * parm) {
-int i, l, n;
-
-	if (b == NULL || b->mlen <= 0 || b->slen < 0 || b->mlen < b->slen ||
-	    b->mlen <= 0 || readPtr == NULL) return BSTR_ERR;
-
-	i = b->slen;
-	for (n=i+16; ; n += ((n < BS_BUFF_SZ) ? n : BS_BUFF_SZ)) {
-		if (BSTR_OK != balloc (b, n + 1)) return BSTR_ERR;
-		l = (int) readPtr ((void *) (b->data + i), 1, n - i, parm);
-		i += l;
-		b->slen = i;
-		if (i < n) break;
-	}
-
-	b->data[i] = (unsigned char) '\0';
-	return BSTR_OK;
-}
-
-/*  bstring bread (bNread readPtr, void * parm)
- *
- *  Use a finite buffer fread-like function readPtr to create a bstring 
- *  filled with the entire contents of file-like source data in a roughly 
- *  efficient way.
- */
-bstring bread (bNread readPtr, void * parm) {
-bstring buff;
-
-	if (0 > breada (buff = bfromcstr (""), readPtr, parm)) {
-		bdestroy (buff);
-		return NULL;
-	}
-	return buff;
-}
-
-/*  int bassigngets (bstring b, bNgetc getcPtr, void * parm, char terminator)
- *
- *  Use an fgetc-like single character stream reading function (getcPtr) to 
- *  obtain a sequence of characters which are concatenated to the end of the
- *  bstring b.  The stream read is terminated by the passed in terminator 
- *  parameter.
- *
- *  If getcPtr returns with a negative number, or the terminator character 
- *  (which is appended) is read, then the stream reading is halted and the 
- *  function returns with a partial result in b.  If there is an empty partial
- *  result, 1 is returned.  If no characters are read, or there is some other 
- *  detectable error, BSTR_ERR is returned.
- */
-int bassigngets (bstring b, bNgetc getcPtr, void * parm, char terminator) {
-int c, d, e;
-
-	if (b == NULL || b->mlen <= 0 || b->slen < 0 || b->mlen < b->slen ||
-	    b->mlen <= 0 || getcPtr == NULL) return BSTR_ERR;
-	d = 0;
-	e = b->mlen - 2;
-
-	while ((c = getcPtr (parm)) >= 0) {
-		if (d > e) {
-			b->slen = d;
-			if (balloc (b, d + 2) != BSTR_OK) return BSTR_ERR;
-			e = b->mlen - 2;
-		}
-		b->data[d] = (unsigned char) c;
-		d++;
-		if (c == terminator) break;
-	}
-
-	b->data[d] = (unsigned char) '\0';
-	b->slen = d;
-
-	return d == 0 && c < 0;
-}
-
-/*  int bgetsa (bstring b, bNgetc getcPtr, void * parm, char terminator)
- *
- *  Use an fgetc-like single character stream reading function (getcPtr) to 
- *  obtain a sequence of characters which are concatenated to the end of the
- *  bstring b.  The stream read is terminated by the passed in terminator 
- *  parameter.
- *
- *  If getcPtr returns with a negative number, or the terminator character 
- *  (which is appended) is read, then the stream reading is halted and the 
- *  function returns with a partial result concatentated to b.  If there is 
- *  an empty partial result, 1 is returned.  If no characters are read, or 
- *  there is some other detectable error, BSTR_ERR is returned.
- */
-int bgetsa (bstring b, bNgetc getcPtr, void * parm, char terminator) {
-int c, d, e;
-
-	if (b == NULL || b->mlen <= 0 || b->slen < 0 || b->mlen < b->slen ||
-	    b->mlen <= 0 || getcPtr == NULL) return BSTR_ERR;
-	d = b->slen;
-	e = b->mlen - 2;
-
-	while ((c = getcPtr (parm)) >= 0) {
-		if (d > e) {
-			b->slen = d;
-			if (balloc (b, d + 2) != BSTR_OK) return BSTR_ERR;
-			e = b->mlen - 2;
-		}
-		b->data[d] = (unsigned char) c;
-		d++;
-		if (c == terminator) break;
-	}
-
-	b->data[d] = (unsigned char) '\0';
-	b->slen = d;
-
-	return d == 0 && c < 0;
-}
-
-/*  bstring bgets (bNgetc getcPtr, void * parm, char terminator)
- *
- *  Use an fgetc-like single character stream reading function (getcPtr) to 
- *  obtain a sequence of characters which are concatenated into a bstring.  
- *  The stream read is terminated by the passed in terminator function.
- *
- *  If getcPtr returns with a negative number, or the terminator character 
- *  (which is appended) is read, then the stream reading is halted and the 
- *  result obtained thus far is returned.  If no characters are read, or 
- *  there is some other detectable error, NULL is returned.
- */
-bstring bgets (bNgetc getcPtr, void * parm, char terminator) {
-bstring buff;
-
-	if (0 > bgetsa (buff = bfromcstr (""), getcPtr, parm, terminator) || 0 >= buff->slen) {
-		bdestroy (buff);
-		buff = NULL;
-	}
-	return buff;
-}
-
-struct bStream {
-	bstring buff;		/* Buffer for over-reads */
-	void * parm;		/* The stream handle for core stream */
-	bNread readFnPtr;	/* fread compatible fnptr for core stream */
-	int isEOF;		/* track file's EOF state */
-	int maxBuffSz;
-};
-
-/*  struct bStream * bsopen (bNread readPtr, void * parm)
- *
- *  Wrap a given open stream (described by a fread compatible function 
- *  pointer and stream handle) into an open bStream suitable for the bstring 
- *  library streaming functions.
- */
-struct bStream * bsopen (bNread readPtr, void * parm) {
-struct bStream * s;
-
-	if (readPtr == NULL) return NULL;
-	s = (struct bStream *) bstr__alloc (sizeof (struct bStream));
-	if (s == NULL) return NULL;
-	s->parm = parm;
-	s->buff = bfromcstr ("");
-	s->readFnPtr = readPtr;
-	s->maxBuffSz = BS_BUFF_SZ;
-	s->isEOF = 0;
-	return s;
-}
-
-/*  int bsbufflength (struct bStream * s, int sz)
- *
- *  Set the length of the buffer used by the bStream.  If sz is zero, the 
- *  length is not set.  This function returns with the previous length.
- */
-int bsbufflength (struct bStream * s, int sz) {
-int oldSz;
-	if (s == NULL || sz < 0) return BSTR_ERR;
-	oldSz = s->maxBuffSz;
-	if (sz > 0) s->maxBuffSz = sz;
-	return oldSz;
-}
-
-int bseof (const struct bStream * s) {
-	if (s == NULL || s->readFnPtr == NULL) return BSTR_ERR;
-	return s->isEOF && (s->buff->slen == 0);
-}
-
-/*  void * bsclose (struct bStream * s)
- *
- *  Close the bStream, and return the handle to the stream that was originally
- *  used to open the given stream.
- */
-void * bsclose (struct bStream * s) {
-void * parm;
-	if (s == NULL) return NULL;
-	s->readFnPtr = NULL;
-	if (s->buff) bdestroy (s->buff);
-	s->buff = NULL;
-	parm = s->parm;
-	s->parm = NULL;
-	s->isEOF = 1;
-	bstr__free (s);
-	return parm;
-}
-
-/*  int bsreadlna (bstring r, struct bStream * s, char terminator)
- *
- *  Read a bstring terminated by the terminator character or the end of the
- *  stream from the bStream (s) and return it into the parameter r.  This 
- *  function may read additional characters from the core stream that are not 
- *  returned, but will be retained for subsequent read operations.
- */
-int bsreadlna (bstring r, struct bStream * s, char terminator) {
-int i, l, ret, rlo;
-char * b;
-struct tagbstring x;
-
-	if (s == NULL || s->buff == NULL || r == NULL || r->mlen <= 0 ||
-	    r->slen < 0 || r->mlen < r->slen) return BSTR_ERR;
-	l = s->buff->slen;
-	if (BSTR_OK != balloc (s->buff, s->maxBuffSz + 1)) return BSTR_ERR;
-	b = (char *) s->buff->data;
-	x.data = (unsigned char *) b;
-
-	/* First check if the current buffer holds the terminator */
-	b[l] = terminator; /* Set sentinel */
-	for (i=0; b[i] != terminator; i++) ;
-	if (i < l) {
-		x.slen = i + 1;
-		ret = bconcat (r, &x);
-		s->buff->slen = l;
-		if (BSTR_OK == ret) bdelete (s->buff, 0, i + 1);
-		return BSTR_OK;
-	}
-
-	rlo = r->slen;
-
-	/* If not then just concatenate the entire buffer to the output */
-	x.slen = l;
-	if (BSTR_OK != bconcat (r, &x)) return BSTR_ERR;
-
-	/* Perform direct in-place reads into the destination to allow for
-	   the minimum of data-copies */
-	for (;;) {
-		if (BSTR_OK != balloc (r, r->slen + s->maxBuffSz + 1)) return BSTR_ERR;
-		b = (char *) (r->data + r->slen);
-		l = (int) s->readFnPtr (b, 1, s->maxBuffSz, s->parm);
-		if (l <= 0) {
-			r->data[r->slen] = (unsigned char) '\0';
-			s->buff->slen = 0;
-			s->isEOF = 1;
-			/* If nothing was read return with an error message */
-			return BSTR_ERR & -(r->slen == rlo);
-		}
-		b[l] = terminator; /* Set sentinel */
-		for (i=0; b[i] != terminator; i++) ;
-		if (i < l) break;
-		r->slen += l;
-	}
-
-	/* Terminator found, push over-read back to buffer */
-	i++;
-	r->slen += i;
-	s->buff->slen = l - i;
-	bstr__memcpy (s->buff->data, b + i, l - i);
-	r->data[r->slen] = (unsigned char) '\0';
-	return BSTR_OK;
-}
-
-/*  int bsreadlnsa (bstring r, struct bStream * s, bstring term)
- *
- *  Read a bstring terminated by any character in the term string or the end 
- *  of the stream from the bStream (s) and return it into the parameter r.  
- *  This function may read additional characters from the core stream that 
- *  are not returned, but will be retained for subsequent read operations.
- */
-int bsreadlnsa (bstring r, struct bStream * s, const_bstring term) {
-int i, l, ret, rlo;
-unsigned char * b;
-struct tagbstring x;
-struct charField cf;
-
-	if (s == NULL || s->buff == NULL || r == NULL || term == NULL ||
-	    term->data == NULL || r->mlen <= 0 || r->slen < 0 ||
-	    r->mlen < r->slen) return BSTR_ERR;
-	if (term->slen == 1) return bsreadlna (r, s, term->data[0]);
-	if (term->slen < 1 || buildCharField (&cf, term)) return BSTR_ERR;
-
-	l = s->buff->slen;
-	if (BSTR_OK != balloc (s->buff, s->maxBuffSz + 1)) return BSTR_ERR;
-	b = (unsigned char *) s->buff->data;
-	x.data = b;
-
-	/* First check if the current buffer holds the terminator */
-	b[l] = term->data[0]; /* Set sentinel */
-	for (i=0; !testInCharField (&cf, b[i]); i++) ;
-	if (i < l) {
-		x.slen = i + 1;
-		ret = bconcat (r, &x);
-		s->buff->slen = l;
-		if (BSTR_OK == ret) bdelete (s->buff, 0, i + 1);
-		return BSTR_OK;
-	}
-
-	rlo = r->slen;
-
-	/* If not then just concatenate the entire buffer to the output */
-	x.slen = l;
-	if (BSTR_OK != bconcat (r, &x)) return BSTR_ERR;
-
-	/* Perform direct in-place reads into the destination to allow for
-	   the minimum of data-copies */
-	for (;;) {
-		if (BSTR_OK != balloc (r, r->slen + s->maxBuffSz + 1)) return BSTR_ERR;
-		b = (unsigned char *) (r->data + r->slen);
-		l = (int) s->readFnPtr (b, 1, s->maxBuffSz, s->parm);
-		if (l <= 0) {
-			r->data[r->slen] = (unsigned char) '\0';
-			s->buff->slen = 0;
-			s->isEOF = 1;
-			/* If nothing was read return with an error message */
-			return BSTR_ERR & -(r->slen == rlo);
-		}
-
-		b[l] = term->data[0]; /* Set sentinel */
-		for (i=0; !testInCharField (&cf, b[i]); i++) ;
-		if (i < l) break;
-		r->slen += l;
-	}
-
-	/* Terminator found, push over-read back to buffer */
-	i++;
-	r->slen += i;
-	s->buff->slen = l - i;
-	bstr__memcpy (s->buff->data, b + i, l - i);
-	r->data[r->slen] = (unsigned char) '\0';
-	return BSTR_OK;
-}
-
-/*  int bsreada (bstring r, struct bStream * s, int n)
- *
- *  Read a bstring of length n (or, if it is fewer, as many bytes as is 
- *  remaining) from the bStream.  This function may read additional 
- *  characters from the core stream that are not returned, but will be 
- *  retained for subsequent read operations.  This function will not read
- *  additional characters from the core stream beyond virtual stream pointer.
- */
-int bsreada (bstring r, struct bStream * s, int n) {
-int l, ret, orslen;
-char * b;
-struct tagbstring x;
-
-	if (s == NULL || s->buff == NULL || r == NULL || r->mlen <= 0
-	 || r->slen < 0 || r->mlen < r->slen || n <= 0) return BSTR_ERR;
-
-	n += r->slen;
-	if (n <= 0) return BSTR_ERR;
-
-	l = s->buff->slen;
-
-	orslen = r->slen;
-
-	if (0 == l) {
-		if (s->isEOF) return BSTR_ERR;
-		if (r->mlen > n) {
-			l = (int) s->readFnPtr (r->data + r->slen, 1, n - r->slen, s->parm);
-			if (0 >= l || l > n - r->slen) {
-				s->isEOF = 1;
-				return BSTR_ERR;
-			}
-			r->slen += l;
-			r->data[r->slen] = (unsigned char) '\0';
-			return 0;
-		}
-	}
-
-	if (BSTR_OK != balloc (s->buff, s->maxBuffSz + 1)) return BSTR_ERR;
-	b = (char *) s->buff->data;
-	x.data = (unsigned char *) b;
-
-	do {
-		if (l + r->slen >= n) {
-			x.slen = n - r->slen;
-			ret = bconcat (r, &x);
-			s->buff->slen = l;
-			if (BSTR_OK == ret) bdelete (s->buff, 0, x.slen);
-			return BSTR_ERR & -(r->slen == orslen);
-		}
-
-		x.slen = l;
-		if (BSTR_OK != bconcat (r, &x)) break;
-
-		l = n - r->slen;
-		if (l > s->maxBuffSz) l = s->maxBuffSz;
-
-		l = (int) s->readFnPtr (b, 1, l, s->parm);
-
-	} while (l > 0);
-	if (l < 0) l = 0;
-	if (l == 0) s->isEOF = 1;
-	s->buff->slen = l;
-	return BSTR_ERR & -(r->slen == orslen);
-}
-
-/*  int bsreadln (bstring r, struct bStream * s, char terminator)
- *
- *  Read a bstring terminated by the terminator character or the end of the
- *  stream from the bStream (s) and return it into the parameter r.  This 
- *  function may read additional characters from the core stream that are not 
- *  returned, but will be retained for subsequent read operations.
- */
-int bsreadln (bstring r, struct bStream * s, char terminator) {
-	if (s == NULL || s->buff == NULL || r == NULL || r->mlen <= 0)
-		return BSTR_ERR;
-	if (BSTR_OK != balloc (s->buff, s->maxBuffSz + 1)) return BSTR_ERR;
-	r->slen = 0;
-	return bsreadlna (r, s, terminator);
-}
-
-/*  int bsreadlns (bstring r, struct bStream * s, bstring term)
- *
- *  Read a bstring terminated by any character in the term string or the end 
- *  of the stream from the bStream (s) and return it into the parameter r.  
- *  This function may read additional characters from the core stream that 
- *  are not returned, but will be retained for subsequent read operations.
- */
-int bsreadlns (bstring r, struct bStream * s, const_bstring term) {
-	if (s == NULL || s->buff == NULL || r == NULL || term == NULL 
-	 || term->data == NULL || r->mlen <= 0) return BSTR_ERR;
-	if (term->slen == 1) return bsreadln (r, s, term->data[0]);
-	if (term->slen < 1) return BSTR_ERR;
-	if (BSTR_OK != balloc (s->buff, s->maxBuffSz + 1)) return BSTR_ERR;
-	r->slen = 0;
-	return bsreadlnsa (r, s, term);
-}
-
-/*  int bsread (bstring r, struct bStream * s, int n)
- *
- *  Read a bstring of length n (or, if it is fewer, as many bytes as is 
- *  remaining) from the bStream.  This function may read additional 
- *  characters from the core stream that are not returned, but will be 
- *  retained for subsequent read operations.  This function will not read
- *  additional characters from the core stream beyond virtual stream pointer.
- */
-int bsread (bstring r, struct bStream * s, int n) {
-	if (s == NULL || s->buff == NULL || r == NULL || r->mlen <= 0
-	 || n <= 0) return BSTR_ERR;
-	if (BSTR_OK != balloc (s->buff, s->maxBuffSz + 1)) return BSTR_ERR;
-	r->slen = 0;
-	return bsreada (r, s, n);
-}
-
-/*  int bsunread (struct bStream * s, const_bstring b)
- *
- *  Insert a bstring into the bStream at the current position.  These 
- *  characters will be read prior to those that actually come from the core 
- *  stream.
- */
-int bsunread (struct bStream * s, const_bstring b) {
-	if (s == NULL || s->buff == NULL) return BSTR_ERR;
-	return binsert (s->buff, 0, b, (unsigned char) '?');
-}
-
-/*  int bspeek (bstring r, const struct bStream * s)
- *
- *  Return the currently buffered characters from the bStream that will be 
- *  read prior to reads from the core stream.
- */
-int bspeek (bstring r, const struct bStream * s) {
-	if (s == NULL || s->buff == NULL) return BSTR_ERR;
-	return bassign (r, s->buff);
-}
-
-/*  bstring bjoin (const struct bstrList * bl, const_bstring sep);
- *
- *  Join the entries of a bstrList into one bstring by sequentially 
- *  concatenating them with the sep string in between.  If there is an error 
- *  NULL is returned, otherwise a bstring with the correct result is returned.
- */
-bstring bjoin (const struct bstrList * bl, const_bstring sep) {
-bstring b;
-int i, c, v;
-
-	if (bl == NULL || bl->qty < 0) return NULL;
-	if (sep != NULL && (sep->slen < 0 || sep->data == NULL)) return NULL;
-
-	for (i = 0, c = 1; i < bl->qty; i++) {
-		v = bl->entry[i]->slen;
-		if (v < 0) return NULL;	/* Invalid input */
-		c += v;
-		if (c < 0) return NULL;	/* Wrap around ?? */
-	}
-
-	if (sep != NULL) c += (bl->qty - 1) * sep->slen;
-
-	b = (bstring) bstr__alloc (sizeof (struct tagbstring));
-	if (NULL == b) return NULL; /* Out of memory */
-	b->data = (unsigned char *) bstr__alloc (c);
-	if (b->data == NULL) {
-		bstr__free (b);
-		return NULL;
-	}
-
-	b->mlen = c;
-	b->slen = c-1;
-
-	for (i = 0, c = 0; i < bl->qty; i++) {
-		if (i > 0 && sep != NULL) {
-			bstr__memcpy (b->data + c, sep->data, sep->slen);
-			c += sep->slen;
-		}
-		v = bl->entry[i]->slen;
-		bstr__memcpy (b->data + c, bl->entry[i]->data, v);
-		c += v;
-	}
-	b->data[c] = (unsigned char) '\0';
-	return b;
-}
-
-#define BSSSC_BUFF_LEN (256)
-
-/*  int bssplitscb (struct bStream * s, const_bstring splitStr, 
- *	int (* cb) (void * parm, int ofs, const_bstring entry), void * parm)
- *
- *  Iterate the set of disjoint sequential substrings read from a stream 
- *  divided by any of the characters in splitStr.  An empty splitStr causes 
- *  the whole stream to be iterated once.
- *
- *  Note: At the point of calling the cb function, the bStream pointer is 
- *  pointed exactly at the position right after having read the split 
- *  character.  The cb function can act on the stream by causing the bStream
- *  pointer to move, and bssplitscb will continue by starting the next split
- *  at the position of the pointer after the return from cb.
- *
- *  However, if the cb causes the bStream s to be destroyed then the cb must
- *  return with a negative value, otherwise bssplitscb will continue in an 
- *  undefined manner.
- */
-int bssplitscb (struct bStream * s, const_bstring splitStr, 
-	int (* cb) (void * parm, int ofs, const_bstring entry), void * parm) {
-struct charField chrs;
-bstring buff;
-int i, p, ret;
-
-	if (cb == NULL || s == NULL || s->readFnPtr == NULL 
-	 || splitStr == NULL || splitStr->slen < 0) return BSTR_ERR;
-
-	if (NULL == (buff = bfromcstr (""))) return BSTR_ERR;
-
-	if (splitStr->slen == 0) {
-		while (bsreada (buff, s, BSSSC_BUFF_LEN) >= 0) ;
-		if ((ret = cb (parm, 0, buff)) > 0) 
-			ret = 0;
-	} else {
-		buildCharField (&chrs, splitStr);
-		ret = p = i = 0;
-		for (;;) {
-			if (i >= buff->slen) {
-				bsreada (buff, s, BSSSC_BUFF_LEN);
-				if (i >= buff->slen) {
-					if (0 < (ret = cb (parm, p, buff))) ret = 0;
-					break;
-				}
-			}
-			if (testInCharField (&chrs, buff->data[i])) {
-				struct tagbstring t;
-				unsigned char c;
-
-				blk2tbstr (t, buff->data + i + 1, buff->slen - (i + 1));
-				if ((ret = bsunread (s, &t)) < 0) break;
-				buff->slen = i;
-				c = buff->data[i];
-				buff->data[i] = (unsigned char) '\0';
-				if ((ret = cb (parm, p, buff)) < 0) break;
-				buff->data[i] = c;
-				buff->slen = 0;
-				p += i + 1;
-				i = -1;
-			}
-			i++;
-		}
-	}
-
-	bdestroy (buff);
-	return ret;
-}
-
-/*  int bssplitstrcb (struct bStream * s, const_bstring splitStr, 
- *	int (* cb) (void * parm, int ofs, const_bstring entry), void * parm)
- *
- *  Iterate the set of disjoint sequential substrings read from a stream 
- *  divided by the entire substring splitStr.  An empty splitStr causes 
- *  each character of the stream to be iterated.
- *
- *  Note: At the point of calling the cb function, the bStream pointer is 
- *  pointed exactly at the position right after having read the split 
- *  character.  The cb function can act on the stream by causing the bStream
- *  pointer to move, and bssplitscb will continue by starting the next split
- *  at the position of the pointer after the return from cb.
- *
- *  However, if the cb causes the bStream s to be destroyed then the cb must
- *  return with a negative value, otherwise bssplitscb will continue in an 
- *  undefined manner.
- */
-int bssplitstrcb (struct bStream * s, const_bstring splitStr, 
-	int (* cb) (void * parm, int ofs, const_bstring entry), void * parm) {
-bstring buff;
-int i, p, ret;
-
-	if (cb == NULL || s == NULL || s->readFnPtr == NULL 
-	 || splitStr == NULL || splitStr->slen < 0) return BSTR_ERR;
-
-	if (splitStr->slen == 1) return bssplitscb (s, splitStr, cb, parm);
-
-	if (NULL == (buff = bfromcstr (""))) return BSTR_ERR;
-
-	if (splitStr->slen == 0) {
-		for (i=0; bsreada (buff, s, BSSSC_BUFF_LEN) >= 0; i++) {
-			if ((ret = cb (parm, 0, buff)) < 0) {
-				bdestroy (buff);
-				return ret;
-			}
-			buff->slen = 0;
-		}
-		return BSTR_OK;
-	} else {
-		ret = p = i = 0;
-		for (i=p=0;;) {
-			if ((ret = binstr (buff, 0, splitStr)) >= 0) {
-				struct tagbstring t;
-				blk2tbstr (t, buff->data, ret);
-				i = ret + splitStr->slen;
-				if ((ret = cb (parm, p, &t)) < 0) break;
-				p += i;
-				bdelete (buff, 0, i);
-			} else {
-				bsreada (buff, s, BSSSC_BUFF_LEN);
-				if (bseof (s)) {
-					if ((ret = cb (parm, p, buff)) > 0) ret = 0;
-					break;
-				}
-			}
-		}
-	}
-
-	bdestroy (buff);
-	return ret;
-}
-
-/*  int bstrListCreate (void)
- *
- *  Create a bstrList.
- */
-struct bstrList * bstrListCreate (void) {
-struct bstrList * sl = (struct bstrList *) bstr__alloc (sizeof (struct bstrList));
-	if (sl) {
-		sl->entry = (bstring *) bstr__alloc (1*sizeof (bstring));
-		if (!sl->entry) {
-			bstr__free (sl);
-			sl = NULL;
-		} else {
-			sl->qty = 0;
-			sl->mlen = 1;
-		}
-	}
-	return sl;
-}
-
-/*  int bstrListDestroy (struct bstrList * sl)
- *
- *  Destroy a bstrList that has been created by bsplit, bsplits or bstrListCreate.
- */
-int bstrListDestroy (struct bstrList * sl) {
-int i;
-	if (sl == NULL || sl->qty < 0) return BSTR_ERR;
-	for (i=0; i < sl->qty; i++) {
-		if (sl->entry[i]) {
-			bdestroy (sl->entry[i]);
-			sl->entry[i] = NULL;
-		}
-	}
-	sl->qty  = -1;
-	sl->mlen = -1;
-	bstr__free (sl->entry);
-	sl->entry = NULL;
-	bstr__free (sl);
-	return BSTR_OK;
-}
-
-/*  int bstrListAlloc (struct bstrList * sl, int msz)
- *
- *  Ensure that there is memory for at least msz number of entries for the
- *  list.
- */
-int bstrListAlloc (struct bstrList * sl, int msz) {
-bstring * l;
-int smsz;
-size_t nsz;
-	if (!sl || msz <= 0 || !sl->entry || sl->qty < 0 || sl->mlen <= 0 || sl->qty > sl->mlen) return BSTR_ERR;
-	if (sl->mlen >= msz) return BSTR_OK;
-	smsz = snapUpSize (msz);
-	nsz = ((size_t) smsz) * sizeof (bstring);
-	if (nsz < (size_t) smsz) return BSTR_ERR;
-	l = (bstring *) bstr__realloc (sl->entry, nsz);
-	if (!l) {
-		smsz = msz;
-		nsz = ((size_t) smsz) * sizeof (bstring);
-		l = (bstring *) bstr__realloc (sl->entry, nsz);
-		if (!l) return BSTR_ERR;
-	}
-	sl->mlen = smsz;
-	sl->entry = l;
-	return BSTR_OK;
-}
-
-/*  int bstrListAllocMin (struct bstrList * sl, int msz)
- *
- *  Try to allocate the minimum amount of memory for the list to include at
- *  least msz entries or sl->qty whichever is greater.
- */
-int bstrListAllocMin (struct bstrList * sl, int msz) {
-bstring * l;
-size_t nsz;
-	if (!sl || msz <= 0 || !sl->entry || sl->qty < 0 || sl->mlen <= 0 || sl->qty > sl->mlen) return BSTR_ERR;
-	if (msz < sl->qty) msz = sl->qty;
-	if (sl->mlen == msz) return BSTR_OK;
-	nsz = ((size_t) msz) * sizeof (bstring);
-	if (nsz < (size_t) msz) return BSTR_ERR;
-	l = (bstring *) bstr__realloc (sl->entry, nsz);
-	if (!l) return BSTR_ERR;
-	sl->mlen = msz;
-	sl->entry = l;
-	return BSTR_OK;
-}
-
-/*  int bsplitcb (const_bstring str, unsigned char splitChar, int pos,
- *	int (* cb) (void * parm, int ofs, int len), void * parm)
- *
- *  Iterate the set of disjoint sequential substrings over str divided by the
- *  character in splitChar.
- *
- *  Note: Non-destructive modification of str from within the cb function 
- *  while performing this split is not undefined.  bsplitcb behaves in 
- *  sequential lock step with calls to cb.  I.e., after returning from a cb 
- *  that return a non-negative integer, bsplitcb continues from the position 
- *  1 character after the last detected split character and it will halt 
- *  immediately if the length of str falls below this point.  However, if the 
- *  cb function destroys str, then it *must* return with a negative value, 
- *  otherwise bsplitcb will continue in an undefined manner.
- */
-int bsplitcb (const_bstring str, unsigned char splitChar, int pos,
-	int (* cb) (void * parm, int ofs, int len), void * parm) {
-int i, p, ret;
-
-	if (cb == NULL || str == NULL || pos < 0 || pos > str->slen) 
-		return BSTR_ERR;
-
-	p = pos;
-	do {
-		for (i=p; i < str->slen; i++) {
-			if (str->data[i] == splitChar) break;
-		}
-		if ((ret = cb (parm, p, i - p)) < 0) return ret;
-		p = i + 1;
-	} while (p <= str->slen);
-	return BSTR_OK;
-}
-
-/*  int bsplitscb (const_bstring str, const_bstring splitStr, int pos,
- *	int (* cb) (void * parm, int ofs, int len), void * parm)
- *
- *  Iterate the set of disjoint sequential substrings over str divided by any 
- *  of the characters in splitStr.  An empty splitStr causes the whole str to
- *  be iterated once.
- *
- *  Note: Non-destructive modification of str from within the cb function 
- *  while performing this split is not undefined.  bsplitscb behaves in 
- *  sequential lock step with calls to cb.  I.e., after returning from a cb 
- *  that return a non-negative integer, bsplitscb continues from the position 
- *  1 character after the last detected split character and it will halt 
- *  immediately if the length of str falls below this point.  However, if the 
- *  cb function destroys str, then it *must* return with a negative value, 
- *  otherwise bsplitscb will continue in an undefined manner.
- */
-int bsplitscb (const_bstring str, const_bstring splitStr, int pos,
-	int (* cb) (void * parm, int ofs, int len), void * parm) {
-struct charField chrs;
-int i, p, ret;
-
-	if (cb == NULL || str == NULL || pos < 0 || pos > str->slen 
-	 || splitStr == NULL || splitStr->slen < 0) return BSTR_ERR;
-	if (splitStr->slen == 0) {
-		if ((ret = cb (parm, 0, str->slen)) > 0) ret = 0;
-		return ret;
-	}
-
-	if (splitStr->slen == 1) 
-		return bsplitcb (str, splitStr->data[0], pos, cb, parm);
-
-	buildCharField (&chrs, splitStr);
-
-	p = pos;
-	do {
-		for (i=p; i < str->slen; i++) {
-			if (testInCharField (&chrs, str->data[i])) break;
-		}
-		if ((ret = cb (parm, p, i - p)) < 0) return ret;
-		p = i + 1;
-	} while (p <= str->slen);
-	return BSTR_OK;
-}
-
-/*  int bsplitstrcb (const_bstring str, const_bstring splitStr, int pos,
- *	int (* cb) (void * parm, int ofs, int len), void * parm)
- *
- *  Iterate the set of disjoint sequential substrings over str divided by the 
- *  substring splitStr.  An empty splitStr causes the whole str to be 
- *  iterated once.
- *
- *  Note: Non-destructive modification of str from within the cb function 
- *  while performing this split is not undefined.  bsplitstrcb behaves in 
- *  sequential lock step with calls to cb.  I.e., after returning from a cb 
- *  that return a non-negative integer, bsplitscb continues from the position 
- *  1 character after the last detected split character and it will halt 
- *  immediately if the length of str falls below this point.  However, if the 
- *  cb function destroys str, then it *must* return with a negative value, 
- *  otherwise bsplitscb will continue in an undefined manner.
- */
-int bsplitstrcb (const_bstring str, const_bstring splitStr, int pos,
-	int (* cb) (void * parm, int ofs, int len), void * parm) {
-int i, p, ret;
-
-	if (cb == NULL || str == NULL || pos < 0 || pos > str->slen 
-	 || splitStr == NULL || splitStr->slen < 0) return BSTR_ERR;
-
-	if (0 == splitStr->slen) {
-		for (i=pos; i < str->slen; i++) {
-			if ((ret = cb (parm, i, 1)) < 0) return ret;
-		}
-		return BSTR_OK;
-	}
-
-	if (splitStr->slen == 1) 
-		return bsplitcb (str, splitStr->data[0], pos, cb, parm);
-
-	for (i=p=pos; i <= str->slen - splitStr->slen; i++) {
-		if (0 == bstr__memcmp (splitStr->data, str->data + i, splitStr->slen)) {
-			if ((ret = cb (parm, p, i - p)) < 0) return ret;
-			i += splitStr->slen;
-			p = i;
-		}
-	}
-	if ((ret = cb (parm, p, str->slen - p)) < 0) return ret;
-	return BSTR_OK;
-}
-
-struct genBstrList {
-	bstring b;
-	struct bstrList * bl;
-};
-
-static int bscb (void * parm, int ofs, int len) {
-struct genBstrList * g = (struct genBstrList *) parm;
-	if (g->bl->qty >= g->bl->mlen) {
-		int mlen = g->bl->mlen * 2;
-		bstring * tbl;
-
-		while (g->bl->qty >= mlen) {
-			if (mlen < g->bl->mlen) return BSTR_ERR;
-			mlen += mlen;
-		}
-
-		tbl = (bstring *) bstr__realloc (g->bl->entry, sizeof (bstring) * mlen);
-		if (tbl == NULL) return BSTR_ERR;
-
-		g->bl->entry = tbl;
-		g->bl->mlen = mlen;
-	}
-
-	g->bl->entry[g->bl->qty] = bmidstr (g->b, ofs, len);
-	g->bl->qty++;
-	return BSTR_OK;
-}
-
-/*  struct bstrList * bsplit (const_bstring str, unsigned char splitChar)
- *
- *  Create an array of sequential substrings from str divided by the character
- *  splitChar.  
- */
-struct bstrList * bsplit (const_bstring str, unsigned char splitChar) {
-struct genBstrList g;
-
-	if (str == NULL || str->data == NULL || str->slen < 0) return NULL;
-
-	g.bl = (struct bstrList *) bstr__alloc (sizeof (struct bstrList));
-	if (g.bl == NULL) return NULL;
-	g.bl->mlen = 4;
-	g.bl->entry = (bstring *) bstr__alloc (g.bl->mlen * sizeof (bstring));
-	if (NULL == g.bl->entry) {
-		bstr__free (g.bl);
-		return NULL;
-	}
-
-	g.b = (bstring) str;
-	g.bl->qty = 0;
-	if (bsplitcb (str, splitChar, 0, bscb, &g) < 0) {
-		bstrListDestroy (g.bl);
-		return NULL;
-	}
-	return g.bl;
-}
-
-/*  struct bstrList * bsplitstr (const_bstring str, const_bstring splitStr)
- *
- *  Create an array of sequential substrings from str divided by the entire
- *  substring splitStr.
- */
-struct bstrList * bsplitstr (const_bstring str, const_bstring splitStr) {
-struct genBstrList g;
-
-	if (str == NULL || str->data == NULL || str->slen < 0) return NULL;
-
-	g.bl = (struct bstrList *) bstr__alloc (sizeof (struct bstrList));
-	if (g.bl == NULL) return NULL;
-	g.bl->mlen = 4;
-	g.bl->entry = (bstring *) bstr__alloc (g.bl->mlen * sizeof (bstring));
-	if (NULL == g.bl->entry) {
-		bstr__free (g.bl);
-		return NULL;
-	}
-
-	g.b = (bstring) str;
-	g.bl->qty = 0;
-	if (bsplitstrcb (str, splitStr, 0, bscb, &g) < 0) {
-		bstrListDestroy (g.bl);
-		return NULL;
-	}
-	return g.bl;
-}
-
-/*  struct bstrList * bsplits (const_bstring str, bstring splitStr)
- *
- *  Create an array of sequential substrings from str divided by any of the 
- *  characters in splitStr.  An empty splitStr causes a single entry bstrList
- *  containing a copy of str to be returned.
- */
-struct bstrList * bsplits (const_bstring str, const_bstring splitStr) {
-struct genBstrList g;
-
-	if (     str == NULL ||      str->slen < 0 ||      str->data == NULL ||
-	    splitStr == NULL || splitStr->slen < 0 || splitStr->data == NULL)
-		return NULL;
-
-	g.bl = (struct bstrList *) bstr__alloc (sizeof (struct bstrList));
-	if (g.bl == NULL) return NULL;
-	g.bl->mlen = 4;
-	g.bl->entry = (bstring *) bstr__alloc (g.bl->mlen * sizeof (bstring));
-	if (NULL == g.bl->entry) {
-		bstr__free (g.bl);
-		return NULL;
-	}
-	g.b = (bstring) str;
-	g.bl->qty = 0;
-
-	if (bsplitscb (str, splitStr, 0, bscb, &g) < 0) {
-		bstrListDestroy (g.bl);
-		return NULL;
-	}
-	return g.bl;
-}
-
-#if defined (__TURBOC__) && !defined (__BORLANDC__)
-# ifndef BSTRLIB_NOVSNP
-#  define BSTRLIB_NOVSNP
-# endif
-#endif
-
-/* Give WATCOM C/C++, MSVC some latitude for their non-support of vsnprintf */
-#if defined(__WATCOMC__) || defined(_MSC_VER)
-#define exvsnprintf(r,b,n,f,a) {r = _vsnprintf (b,n,f,a);}
-#else
-#ifdef BSTRLIB_NOVSNP
-/* This is just a hack.  If you are using a system without a vsnprintf, it is 
-   not recommended that bformat be used at all. */
-#define exvsnprintf(r,b,n,f,a) {vsprintf (b,f,a); r = -1;}
-#define START_VSNBUFF (256)
-#else
-
-#if defined(__GNUC__) && !defined(__APPLE__)
-/* Something is making gcc complain about this prototype not being here, so 
-   I've just gone ahead and put it in. */
-extern int vsnprintf (char *buf, size_t count, const char *format, va_list arg);
-#endif
-
-#define exvsnprintf(r,b,n,f,a) {r = vsnprintf (b,n,f,a);}
-#endif
-#endif
-
-#if !defined (BSTRLIB_NOVSNP)
-
-#ifndef START_VSNBUFF
-#define START_VSNBUFF (16)
-#endif
-
-/* On IRIX vsnprintf returns n-1 when the operation would overflow the target 
-   buffer, WATCOM and MSVC both return -1, while C99 requires that the 
-   returned value be exactly what the length would be if the buffer would be
-   large enough.  This leads to the idea that if the return value is larger 
-   than n, then changing n to the return value will reduce the number of
-   iterations required. */
-
-/*  int bformata (bstring b, const char * fmt, ...)
- *
- *  After the first parameter, it takes the same parameters as printf (), but 
- *  rather than outputting results to stdio, it appends the results to 
- *  a bstring which contains what would have been output. Note that if there 
- *  is an early generation of a '\0' character, the bstring will be truncated 
- *  to this end point.
- */
-int bformata (bstring b, const char * fmt, ...) {
-va_list arglist;
-bstring buff;
-int n, r;
-
-	if (b == NULL || fmt == NULL || b->data == NULL || b->mlen <= 0 
-	 || b->slen < 0 || b->slen > b->mlen) return BSTR_ERR;
-
-	/* Since the length is not determinable beforehand, a search is
-	   performed using the truncating "vsnprintf" call (to avoid buffer
-	   overflows) on increasing potential sizes for the output result. */
-
-	if ((n = (int) (2*strlen (fmt))) < START_VSNBUFF) n = START_VSNBUFF;
-	if (NULL == (buff = bfromcstralloc (n + 2, ""))) {
-		n = 1;
-		if (NULL == (buff = bfromcstralloc (n + 2, ""))) return BSTR_ERR;
-	}
-
-	for (;;) {
-		va_start (arglist, fmt);
-		exvsnprintf (r, (char *) buff->data, n + 1, fmt, arglist);
-		va_end (arglist);
-
-		buff->data[n] = (unsigned char) '\0';
-		buff->slen = (int) (strlen) ((char *) buff->data);
-
-		if (buff->slen < n) break;
-
-		if (r > n) n = r; else n += n;
-
-		if (BSTR_OK != balloc (buff, n + 2)) {
-			bdestroy (buff);
-			return BSTR_ERR;
-		}
-	}
-
-	r = bconcat (b, buff);
-	bdestroy (buff);
-	return r;
-}
-
-/*  int bassignformat (bstring b, const char * fmt, ...)
- *
- *  After the first parameter, it takes the same parameters as printf (), but 
- *  rather than outputting results to stdio, it outputs the results to 
- *  the bstring parameter b. Note that if there is an early generation of a 
- *  '\0' character, the bstring will be truncated to this end point.
- */
-int bassignformat (bstring b, const char * fmt, ...) {
-va_list arglist;
-bstring buff;
-int n, r;
-
-	if (b == NULL || fmt == NULL || b->data == NULL || b->mlen <= 0 
-	 || b->slen < 0 || b->slen > b->mlen) return BSTR_ERR;
-
-	/* Since the length is not determinable beforehand, a search is
-	   performed using the truncating "vsnprintf" call (to avoid buffer
-	   overflows) on increasing potential sizes for the output result. */
-
-	if ((n = (int) (2*strlen (fmt))) < START_VSNBUFF) n = START_VSNBUFF;
-	if (NULL == (buff = bfromcstralloc (n + 2, ""))) {
-		n = 1;
-		if (NULL == (buff = bfromcstralloc (n + 2, ""))) return BSTR_ERR;
-	}
-
-	for (;;) {
-		va_start (arglist, fmt);
-		exvsnprintf (r, (char *) buff->data, n + 1, fmt, arglist);
-		va_end (arglist);
-
-		buff->data[n] = (unsigned char) '\0';
-		buff->slen = (int) (strlen) ((char *) buff->data);
-
-		if (buff->slen < n) break;
-
-		if (r > n) n = r; else n += n;
-
-		if (BSTR_OK != balloc (buff, n + 2)) {
-			bdestroy (buff);
-			return BSTR_ERR;
-		}
-	}
-
-	r = bassign (b, buff);
-	bdestroy (buff);
-	return r;
-}
-
-/*  bstring bformat (const char * fmt, ...)
- *
- *  Takes the same parameters as printf (), but rather than outputting results
- *  to stdio, it forms a bstring which contains what would have been output.
- *  Note that if there is an early generation of a '\0' character, the 
- *  bstring will be truncated to this end point.
- */
-bstring bformat (const char * fmt, ...) {
-va_list arglist;
-bstring buff;
-int n, r;
-
-	if (fmt == NULL) return NULL;
-
-	/* Since the length is not determinable beforehand, a search is
-	   performed using the truncating "vsnprintf" call (to avoid buffer
-	   overflows) on increasing potential sizes for the output result. */
-
-	if ((n = (int) (2*strlen (fmt))) < START_VSNBUFF) n = START_VSNBUFF;
-	if (NULL == (buff = bfromcstralloc (n + 2, ""))) {
-		n = 1;
-		if (NULL == (buff = bfromcstralloc (n + 2, ""))) return NULL;
-	}
-
-	for (;;) {
-		va_start (arglist, fmt);
-		exvsnprintf (r, (char *) buff->data, n + 1, fmt, arglist);
-		va_end (arglist);
-
-		buff->data[n] = (unsigned char) '\0';
-		buff->slen = (int) (strlen) ((char *) buff->data);
-
-		if (buff->slen < n) break;
-
-		if (r > n) n = r; else n += n;
-
-		if (BSTR_OK != balloc (buff, n + 2)) {
-			bdestroy (buff);
-			return NULL;
-		}
-	}
-
-	return buff;
-}
-
-/*  int bvcformata (bstring b, int count, const char * fmt, va_list arglist)
- *
- *  The bvcformata function formats data under control of the format control 
- *  string fmt and attempts to append the result to b.  The fmt parameter is 
- *  the same as that of the printf function.  The variable argument list is 
- *  replaced with arglist, which has been initialized by the va_start macro.
- *  The size of the appended output is upper bounded by count.  If the 
- *  required output exceeds count, the string b is not augmented with any 
- *  contents and a value below BSTR_ERR is returned.  If a value below -count 
- *  is returned then it is recommended that the negative of this value be 
- *  used as an update to the count in a subsequent pass.  On other errors, 
- *  such as running out of memory, parameter errors or numeric wrap around 
- *  BSTR_ERR is returned.  BSTR_OK is returned when the output is successfully 
- *  generated and appended to b.
- *
- *  Note: There is no sanity checking of arglist, and this function is
- *  destructive of the contents of b from the b->slen point onward.  If there 
- *  is an early generation of a '\0' character, the bstring will be truncated 
- *  to this end point.
- */
-int bvcformata (bstring b, int count, const char * fmt, va_list arg) {
-int n, r, l;
-
-	if (b == NULL || fmt == NULL || count <= 0 || b->data == NULL
-	 || b->mlen <= 0 || b->slen < 0 || b->slen > b->mlen) return BSTR_ERR;
-
-	if (count > (n = b->slen + count) + 2) return BSTR_ERR;
-	if (BSTR_OK != balloc (b, n + 2)) return BSTR_ERR;
-
-	exvsnprintf (r, (char *) b->data + b->slen, count + 2, fmt, arg);
-
-	/* Did the operation complete successfully within bounds? */
-	for (l = b->slen; l <= n; l++) {
-		if ('\0' == b->data[l]) {
-			b->slen = l;
-			return BSTR_OK;
-		}
-	}
-
-	/* Abort, since the buffer was not large enough.  The return value 
-	   tries to help set what the retry length should be. */
-
-	b->data[b->slen] = '\0';
-	if (r > count + 1) {	/* Does r specify a particular target length? */
-		n = r;
-	} else {
-		n = count + count;	/* If not, just double the size of count */
-		if (count > n) n = INT_MAX;
-	}
-	n = -n;
-
-	if (n > BSTR_ERR-1) n = BSTR_ERR-1;
-	return n;
-}
-
-#endif
diff --git a/src/bstrlib.h b/src/bstrlib.h
@@ -1,304 +0,0 @@
-/*
- * This source file is part of the bstring string library.  This code was
- * written by Paul Hsieh in 2002-2010, and is covered by either the 3-clause 
- * BSD open source license or GPL v2.0. Refer to the accompanying documentation 
- * for details on usage and license.
- */
-
-/*
- * bstrlib.h
- *
- * This file is the header file for the core module for implementing the 
- * bstring functions.
- */
-
-#ifndef BSTRLIB_INCLUDE
-#define BSTRLIB_INCLUDE
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <stdarg.h>
-#include <string.h>
-#include <limits.h>
-#include <ctype.h>
-
-#if !defined (BSTRLIB_VSNP_OK) && !defined (BSTRLIB_NOVSNP)
-# if defined (__TURBOC__) && !defined (__BORLANDC__)
-#  define BSTRLIB_NOVSNP
-# endif
-#endif
-
-#define BSTR_ERR (-1)
-#define BSTR_OK (0)
-#define BSTR_BS_BUFF_LENGTH_GET (0)
-
-typedef struct tagbstring * bstring;
-typedef const struct tagbstring * const_bstring;
-
-/* Copy functions */
-#define cstr2bstr bfromcstr
-extern bstring bfromcstr (const char * str);
-extern bstring bfromcstralloc (int mlen, const char * str);
-extern bstring blk2bstr (const void * blk, int len);
-extern char * bstr2cstr (const_bstring s, char z);
-extern int bcstrfree (char * s);
-extern bstring bstrcpy (const_bstring b1);
-extern int bassign (bstring a, const_bstring b);
-extern int bassignmidstr (bstring a, const_bstring b, int left, int len);
-extern int bassigncstr (bstring a, const char * str);
-extern int bassignblk (bstring a, const void * s, int len);
-
-/* Destroy function */
-extern int bdestroy (bstring b);
-
-/* Space allocation hinting functions */
-extern int balloc (bstring s, int len);
-extern int ballocmin (bstring b, int len);
-
-/* Substring extraction */
-extern bstring bmidstr (const_bstring b, int left, int len);
-
-/* Various standard manipulations */
-extern int bconcat (bstring b0, const_bstring b1);
-extern int bconchar (bstring b0, char c);
-extern int bcatcstr (bstring b, const char * s);
-extern int bcatblk (bstring b, const void * s, int len);
-extern int binsert (bstring s1, int pos, const_bstring s2, unsigned char fill);
-extern int binsertch (bstring s1, int pos, int len, unsigned char fill);
-extern int breplace (bstring b1, int pos, int len, const_bstring b2, unsigned char fill);
-extern int bdelete (bstring s1, int pos, int len);
-extern int bsetstr (bstring b0, int pos, const_bstring b1, unsigned char fill);
-extern int btrunc (bstring b, int n);
-
-/* Scan/search functions */
-extern int bstricmp (const_bstring b0, const_bstring b1);
-extern int bstrnicmp (const_bstring b0, const_bstring b1, int n);
-extern int biseqcaseless (const_bstring b0, const_bstring b1);
-extern int bisstemeqcaselessblk (const_bstring b0, const void * blk, int len);
-extern int biseq (const_bstring b0, const_bstring b1);
-extern int bisstemeqblk (const_bstring b0, const void * blk, int len);
-extern int biseqcstr (const_bstring b, const char * s);
-extern int biseqcstrcaseless (const_bstring b, const char * s);
-extern int bstrcmp (const_bstring b0, const_bstring b1);
-extern int bstrncmp (const_bstring b0, const_bstring b1, int n);
-extern int binstr (const_bstring s1, int pos, const_bstring s2);
-extern int binstrr (const_bstring s1, int pos, const_bstring s2);
-extern int binstrcaseless (const_bstring s1, int pos, const_bstring s2);
-extern int binstrrcaseless (const_bstring s1, int pos, const_bstring s2);
-extern int bstrchrp (const_bstring b, int c, int pos);
-extern int bstrrchrp (const_bstring b, int c, int pos);
-#define bstrchr(b,c) bstrchrp ((b), (c), 0)
-#define bstrrchr(b,c) bstrrchrp ((b), (c), blength(b)-1)
-extern int binchr (const_bstring b0, int pos, const_bstring b1);
-extern int binchrr (const_bstring b0, int pos, const_bstring b1);
-extern int bninchr (const_bstring b0, int pos, const_bstring b1);
-extern int bninchrr (const_bstring b0, int pos, const_bstring b1);
-extern int bfindreplace (bstring b, const_bstring find, const_bstring repl, int pos);
-extern int bfindreplacecaseless (bstring b, const_bstring find, const_bstring repl, int pos);
-
-/* List of string container functions */
-struct bstrList {
-    int qty, mlen;
-    bstring * entry;
-};
-extern struct bstrList * bstrListCreate (void);
-extern int bstrListDestroy (struct bstrList * sl);
-extern int bstrListAlloc (struct bstrList * sl, int msz);
-extern int bstrListAllocMin (struct bstrList * sl, int msz);
-
-/* String split and join functions */
-extern struct bstrList * bsplit (const_bstring str, unsigned char splitChar);
-extern struct bstrList * bsplits (const_bstring str, const_bstring splitStr);
-extern struct bstrList * bsplitstr (const_bstring str, const_bstring splitStr);
-extern bstring bjoin (const struct bstrList * bl, const_bstring sep);
-extern int bsplitcb (const_bstring str, unsigned char splitChar, int pos,
-	int (* cb) (void * parm, int ofs, int len), void * parm);
-extern int bsplitscb (const_bstring str, const_bstring splitStr, int pos,
-	int (* cb) (void * parm, int ofs, int len), void * parm);
-extern int bsplitstrcb (const_bstring str, const_bstring splitStr, int pos,
-	int (* cb) (void * parm, int ofs, int len), void * parm);
-
-/* Miscellaneous functions */
-extern int bpattern (bstring b, int len);
-extern int btoupper (bstring b);
-extern int btolower (bstring b);
-extern int bltrimws (bstring b);
-extern int brtrimws (bstring b);
-extern int btrimws (bstring b);
-
-/* <*>printf format functions */
-#if !defined (BSTRLIB_NOVSNP)
-extern bstring bformat (const char * fmt, ...);
-extern int bformata (bstring b, const char * fmt, ...);
-extern int bassignformat (bstring b, const char * fmt, ...);
-extern int bvcformata (bstring b, int count, const char * fmt, va_list arglist);
-
-#define bvformata(ret, b, fmt, lastarg) { \
-bstring bstrtmp_b = (b); \
-const char * bstrtmp_fmt = (fmt); \
-int bstrtmp_r = BSTR_ERR, bstrtmp_sz = 16; \
-	for (;;) { \
-		va_list bstrtmp_arglist; \
-		va_start (bstrtmp_arglist, lastarg); \
-		bstrtmp_r = bvcformata (bstrtmp_b, bstrtmp_sz, bstrtmp_fmt, bstrtmp_arglist); \
-		va_end (bstrtmp_arglist); \
-		if (bstrtmp_r >= 0) { /* Everything went ok */ \
-			bstrtmp_r = BSTR_OK; \
-			break; \
-		} else if (-bstrtmp_r <= bstrtmp_sz) { /* A real error? */ \
-			bstrtmp_r = BSTR_ERR; \
-			break; \
-		} \
-		bstrtmp_sz = -bstrtmp_r; /* Doubled or target size */ \
-	} \
-	ret = bstrtmp_r; \
-}
-
-#endif
-
-typedef int (*bNgetc) (void *parm);
-typedef size_t (* bNread) (void *buff, size_t elsize, size_t nelem, void *parm);
-
-/* Input functions */
-extern bstring bgets (bNgetc getcPtr, void * parm, char terminator);
-extern bstring bread (bNread readPtr, void * parm);
-extern int bgetsa (bstring b, bNgetc getcPtr, void * parm, char terminator);
-extern int bassigngets (bstring b, bNgetc getcPtr, void * parm, char terminator);
-extern int breada (bstring b, bNread readPtr, void * parm);
-
-/* Stream functions */
-extern struct bStream * bsopen (bNread readPtr, void * parm);
-extern void * bsclose (struct bStream * s);
-extern int bsbufflength (struct bStream * s, int sz);
-extern int bsreadln (bstring b, struct bStream * s, char terminator);
-extern int bsreadlns (bstring r, struct bStream * s, const_bstring term);
-extern int bsread (bstring b, struct bStream * s, int n);
-extern int bsreadlna (bstring b, struct bStream * s, char terminator);
-extern int bsreadlnsa (bstring r, struct bStream * s, const_bstring term);
-extern int bsreada (bstring b, struct bStream * s, int n);
-extern int bsunread (struct bStream * s, const_bstring b);
-extern int bspeek (bstring r, const struct bStream * s);
-extern int bssplitscb (struct bStream * s, const_bstring splitStr, 
-	int (* cb) (void * parm, int ofs, const_bstring entry), void * parm);
-extern int bssplitstrcb (struct bStream * s, const_bstring splitStr, 
-	int (* cb) (void * parm, int ofs, const_bstring entry), void * parm);
-extern int bseof (const struct bStream * s);
-
-struct tagbstring {
-	int mlen;
-	int slen;
-	unsigned char * data;
-};
-
-/* Accessor macros */
-#define blengthe(b, e)      (((b) == (void *)0 || (b)->slen < 0) ? (int)(e) : ((b)->slen))
-#define blength(b)          (blengthe ((b), 0))
-#define bdataofse(b, o, e)  (((b) == (void *)0 || (b)->data == (void*)0) ? (char *)(e) : ((char *)(b)->data) + (o))
-#define bdataofs(b, o)      (bdataofse ((b), (o), (void *)0))
-#define bdatae(b, e)        (bdataofse (b, 0, e))
-#define bdata(b)            (bdataofs (b, 0))
-#define bchare(b, p, e)     ((((unsigned)(p)) < (unsigned)blength(b)) ? ((b)->data[(p)]) : (e))
-#define bchar(b, p)         bchare ((b), (p), '\0')
-
-/* Static constant string initialization macro */
-#define bsStaticMlen(q,m)   {(m), (int) sizeof(q)-1, (unsigned char *) ("" q "")}
-#if defined(_MSC_VER)
-/* There are many versions of MSVC which emit __LINE__ as a non-constant. */
-# define bsStatic(q)        bsStaticMlen(q,-32)
-#endif
-#ifndef bsStatic
-# define bsStatic(q)        bsStaticMlen(q,-__LINE__)
-#endif
-
-/* Static constant block parameter pair */
-#define bsStaticBlkParms(q) ((void *)("" q "")), ((int) sizeof(q)-1)
-
-/* Reference building macros */
-#define cstr2tbstr btfromcstr
-#define btfromcstr(t,s) {                                            \
-    (t).data = (unsigned char *) (s);                                \
-    (t).slen = ((t).data) ? ((int) (strlen) ((char *)(t).data)) : 0; \
-    (t).mlen = -1;                                                   \
-}
-#define blk2tbstr(t,s,l) {            \
-    (t).data = (unsigned char *) (s); \
-    (t).slen = l;                     \
-    (t).mlen = -1;                    \
-}
-#define btfromblk(t,s,l) blk2tbstr(t,s,l)
-#define bmid2tbstr(t,b,p,l) {                                                \
-    const_bstring bstrtmp_s = (b);                                           \
-    if (bstrtmp_s && bstrtmp_s->data && bstrtmp_s->slen >= 0) {              \
-        int bstrtmp_left = (p);                                              \
-        int bstrtmp_len  = (l);                                              \
-        if (bstrtmp_left < 0) {                                              \
-            bstrtmp_len += bstrtmp_left;                                     \
-            bstrtmp_left = 0;                                                \
-        }                                                                    \
-        if (bstrtmp_len > bstrtmp_s->slen - bstrtmp_left)                    \
-            bstrtmp_len = bstrtmp_s->slen - bstrtmp_left;                    \
-        if (bstrtmp_len <= 0) {                                              \
-            (t).data = (unsigned char *)"";                                  \
-            (t).slen = 0;                                                    \
-        } else {                                                             \
-            (t).data = bstrtmp_s->data + bstrtmp_left;                       \
-            (t).slen = bstrtmp_len;                                          \
-        }                                                                    \
-    } else {                                                                 \
-        (t).data = (unsigned char *)"";                                      \
-        (t).slen = 0;                                                        \
-    }                                                                        \
-    (t).mlen = -__LINE__;                                                    \
-}
-#define btfromblkltrimws(t,s,l) {                                            \
-    int bstrtmp_idx = 0, bstrtmp_len = (l);                                  \
-    unsigned char * bstrtmp_s = (s);                                         \
-    if (bstrtmp_s && bstrtmp_len >= 0) {                                     \
-        for (; bstrtmp_idx < bstrtmp_len; bstrtmp_idx++) {                   \
-            if (!isspace (bstrtmp_s[bstrtmp_idx])) break;                    \
-        }                                                                    \
-    }                                                                        \
-    (t).data = bstrtmp_s + bstrtmp_idx;                                      \
-    (t).slen = bstrtmp_len - bstrtmp_idx;                                    \
-    (t).mlen = -__LINE__;                                                    \
-}
-#define btfromblkrtrimws(t,s,l) {                                            \
-    int bstrtmp_len = (l) - 1;                                               \
-    unsigned char * bstrtmp_s = (s);                                         \
-    if (bstrtmp_s && bstrtmp_len >= 0) {                                     \
-        for (; bstrtmp_len >= 0; bstrtmp_len--) {                            \
-            if (!isspace (bstrtmp_s[bstrtmp_len])) break;                    \
-        }                                                                    \
-    }                                                                        \
-    (t).data = bstrtmp_s;                                                    \
-    (t).slen = bstrtmp_len + 1;                                              \
-    (t).mlen = -__LINE__;                                                    \
-}
-#define btfromblktrimws(t,s,l) {                                             \
-    int bstrtmp_idx = 0, bstrtmp_len = (l) - 1;                              \
-    unsigned char * bstrtmp_s = (s);                                         \
-    if (bstrtmp_s && bstrtmp_len >= 0) {                                     \
-        for (; bstrtmp_idx <= bstrtmp_len; bstrtmp_idx++) {                  \
-            if (!isspace (bstrtmp_s[bstrtmp_idx])) break;                    \
-        }                                                                    \
-        for (; bstrtmp_len >= bstrtmp_idx; bstrtmp_len--) {                  \
-            if (!isspace (bstrtmp_s[bstrtmp_len])) break;                    \
-        }                                                                    \
-    }                                                                        \
-    (t).data = bstrtmp_s + bstrtmp_idx;                                      \
-    (t).slen = bstrtmp_len + 1 - bstrtmp_idx;                                \
-    (t).mlen = -__LINE__;                                                    \
-}
-
-/* Write protection macros */
-#define bwriteprotect(t)     { if ((t).mlen >=  0) (t).mlen = -1; }
-#define bwriteallow(t)       { if ((t).mlen == -1) (t).mlen = (t).slen + ((t).slen == 0); }
-#define biswriteprotected(t) ((t).mlen <= 0)
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/src/buffer.c b/src/buffer.c
@@ -0,0 +1,354 @@
+#include <stdarg.h>
+#include <ctype.h>
+#include <string.h>
+#include <assert.h>
+#include <string.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/param.h>
+
+#include "buffer.h"
+
+/* Used as default value for strbuf->ptr so that people can always
+ * assume ptr is non-NULL and zero terminated even for new strbufs.
+ */
+unsigned char strbuf__initbuf[1];
+unsigned char strbuf__oom[1];
+
+#define ENSURE_SIZE(b, d) \
+	if ((d) > buf->asize && strbuf_grow(b, (d)) < 0)\
+		return -1;
+
+void strbuf_init(strbuf *buf, int initial_size)
+{
+	buf->asize = 0;
+	buf->size = 0;
+	buf->ptr = strbuf__initbuf;
+
+	if (initial_size)
+		strbuf_grow(buf, initial_size);
+}
+
+int strbuf_try_grow(strbuf *buf, int target_size, bool mark_oom)
+{
+	unsigned char *new_ptr;
+	int new_size;
+
+	if (buf->ptr == strbuf__oom)
+		return -1;
+
+	if (target_size <= buf->asize)
+		return 0;
+
+	if (buf->asize == 0) {
+		new_size = target_size;
+		new_ptr = NULL;
+	} else {
+		new_size = buf->asize;
+		new_ptr = buf->ptr;
+	}
+
+	/* grow the buffer size by 1.5, until it's big enough
+	 * to fit our target size */
+	while (new_size < target_size)
+		new_size = (new_size << 1) - (new_size >> 1);
+
+	/* round allocation up to multiple of 8 */
+	new_size = (new_size + 7) & ~7;
+
+	new_ptr = realloc(new_ptr, new_size);
+
+	if (!new_ptr) {
+		if (mark_oom)
+			buf->ptr = strbuf__oom;
+		return -1;
+	}
+
+	buf->asize = new_size;
+	buf->ptr   = new_ptr;
+
+	/* truncate the existing buffer size if necessary */
+	if (buf->size >= buf->asize)
+		buf->size = buf->asize - 1;
+	buf->ptr[buf->size] = '\0';
+
+	return 0;
+}
+
+void strbuf_free(strbuf *buf)
+{
+	if (!buf) return;
+
+	if (buf->ptr != strbuf__initbuf && buf->ptr != strbuf__oom)
+		free(buf->ptr);
+
+	strbuf_init(buf, 0);
+}
+
+void strbuf_clear(strbuf *buf)
+{
+	buf->size = 0;
+
+	if (buf->asize > 0)
+		buf->ptr[0] = '\0';
+}
+
+int strbuf_set(strbuf *buf, const unsigned char *data, int len)
+{
+	if (len <= 0 || data == NULL) {
+		strbuf_clear(buf);
+	} else {
+		if (data != buf->ptr) {
+			ENSURE_SIZE(buf, len + 1);
+			memmove(buf->ptr, data, len);
+		}
+		buf->size = len;
+		buf->ptr[buf->size] = '\0';
+	}
+	return 0;
+}
+
+int strbuf_sets(strbuf *buf, const char *string)
+{
+	return strbuf_set(buf,
+		(const unsigned char *)string,
+		string ? strlen(string) : 0);
+}
+
+int strbuf_putc(strbuf *buf, int c)
+{
+	ENSURE_SIZE(buf, buf->size + 2);
+	buf->ptr[buf->size++] = c;
+	buf->ptr[buf->size] = '\0';
+	return 0;
+}
+
+int strbuf_put(strbuf *buf, const unsigned char *data, int len)
+{
+	if (len <= 0)
+		return 0;
+
+	ENSURE_SIZE(buf, buf->size + len + 1);
+	memmove(buf->ptr + buf->size, data, len);
+	buf->size += len;
+	buf->ptr[buf->size] = '\0';
+	return 0;
+}
+
+int strbuf_puts(strbuf *buf, const char *string)
+{
+	return strbuf_put(buf, (const unsigned char *)string, strlen(string));
+}
+
+int strbuf_vprintf(strbuf *buf, const char *format, va_list ap)
+{
+	const int expected_size = buf->size + (strlen(format) * 2);
+	int len;
+
+	ENSURE_SIZE(buf, expected_size);
+
+	while (1) {
+		va_list args;
+		va_copy(args, ap);
+
+		len = vsnprintf(
+			(char *)buf->ptr + buf->size,
+			buf->asize - buf->size,
+			format, args
+		);
+
+		if (len < 0) {
+			free(buf->ptr);
+			buf->ptr = strbuf__oom;
+			return -1;
+		}
+
+		if (len + 1 <= buf->asize - buf->size) {
+			buf->size += len;
+			break;
+		}
+
+		ENSURE_SIZE(buf, buf->size + len + 1);
+	}
+
+	return 0;
+}
+
+int strbuf_printf(strbuf *buf, const char *format, ...)
+{
+	int r;
+	va_list ap;
+
+	va_start(ap, format);
+	r = strbuf_vprintf(buf, format, ap);
+	va_end(ap);
+
+	return r;
+}
+
+void strbuf_copy_cstr(char *data, int datasize, const strbuf *buf)
+{
+	int copylen;
+
+	assert(data && datasize && buf);
+
+	data[0] = '\0';
+
+	if (buf->size == 0 || buf->asize <= 0)
+		return;
+
+	copylen = buf->size;
+	if (copylen > datasize - 1)
+		copylen = datasize - 1;
+	memmove(data, buf->ptr, copylen);
+	data[copylen] = '\0';
+}
+
+void strbuf_swap(strbuf *buf_a, strbuf *buf_b)
+{
+	strbuf t = *buf_a;
+	*buf_a = *buf_b;
+	*buf_b = t;
+}
+
+unsigned char *strbuf_detach(strbuf *buf)
+{
+	unsigned char *data = buf->ptr;
+
+	if (buf->asize == 0 || buf->ptr == strbuf__oom) {
+		/* return an empty string */
+		return calloc(1, 1);
+	}
+
+	strbuf_init(buf, 0);
+	return data;
+}
+
+void strbuf_attach(strbuf *buf, unsigned char *ptr, int asize)
+{
+	strbuf_free(buf);
+
+	if (ptr) {
+		buf->ptr = ptr;
+		buf->size = strlen((char *)ptr);
+		if (asize)
+			buf->asize = (asize < buf->size) ? buf->size + 1 : asize;
+		else /* pass 0 to fall back on strlen + 1 */
+			buf->asize = buf->size + 1;
+	} else {
+		strbuf_grow(buf, asize);
+	}
+}
+
+int strbuf_cmp(const strbuf *a, const strbuf *b)
+{
+	int result = memcmp(a->ptr, b->ptr, MIN(a->size, b->size));
+	return (result != 0) ? result :
+		(a->size < b->size) ? -1 : (a->size > b->size) ? 1 : 0;
+}
+
+int strbuf_strchr(const strbuf *buf, int c, int pos)
+{
+	const unsigned char *p = memchr(buf->ptr + pos, c, buf->size - pos);
+	if (!p)
+		return -1;
+
+	return (int)(p - (const unsigned char *)buf->ptr);
+}
+
+int strbuf_strrchr(const strbuf *buf, int c, int pos)
+{
+	int i;
+
+	for (i = pos; i >= 0; i--) {
+		if (buf->ptr[i] == (unsigned char) c)
+			return i;
+	}
+
+	return -1;
+}
+
+void strbuf_truncate(strbuf *buf, int len)
+{
+	if (len < buf->size) {
+		buf->size = len;
+		buf->ptr[buf->size] = '\0';
+	}
+}
+
+void strbuf_drop(strbuf *buf, int n)
+{
+	if (n > 0) {
+		buf->size = buf->size - n;
+		if (buf->size)
+			memmove(buf->ptr, buf->ptr + n, buf->size);
+
+		buf->ptr[buf->size] = '\0';
+	}
+}
+
+void strbuf_trim(strbuf *buf)
+{
+	int i = 0;
+
+	if (!buf->size)
+		return;
+
+	while (i < buf->size && isspace(buf->ptr[i]))
+		i++;
+
+	strbuf_drop(buf, i);
+
+	/* rtrim */
+	while (buf->size > 0) {
+		if (!isspace(buf->ptr[buf->size - 1]))
+			break;
+
+		buf->size--;
+	}
+
+	buf->ptr[buf->size] = '\0';
+}
+
+// Destructively modify string, collapsing consecutive
+// space and newline characters into a single space.
+void strbuf_normalize_whitespace(strbuf *s)
+{
+	bool last_char_was_space = false;
+	int r, w;
+
+	for (r = 0, w = 0; r < s->size; ++r) {
+		switch (s->ptr[r]) {
+		case ' ':
+		case '\n':
+			if (last_char_was_space)
+				break;
+
+			s->ptr[w++] = ' ';
+			last_char_was_space = true;
+			break;
+
+		default:
+			s->ptr[w++] = s->ptr[r];
+			last_char_was_space = false;
+		}
+	}
+
+	strbuf_truncate(s, w);
+}
+
+// Destructively unescape a string: remove backslashes before punctuation chars.
+extern void strbuf_unescape(strbuf *buf)
+{
+	int r, w;
+
+	for (r = 0, w = 0; r < buf->size; ++r) {
+		if (buf->ptr[r] == '\\' && ispunct(buf->ptr[r + 1]))
+			continue;
+
+		buf->ptr[w++] = buf->ptr[r];
+	}
+
+	strbuf_truncate(buf, w);
+}
+
diff --git a/src/buffer.h b/src/buffer.h
@@ -0,0 +1,114 @@
+#ifndef INCLUDE_buffer_h__
+#define INCLUDE_buffer_h__
+
+#include <stdbool.h>
+#include <stddef.h>
+#include <stdarg.h>
+#include <sys/types.h>
+
+typedef struct {
+	unsigned char *ptr;
+	int asize, size;
+} strbuf;
+
+extern unsigned char strbuf__initbuf[];
+extern unsigned char strbuf__oom[];
+
+#define GH_BUF_INIT { strbuf__initbuf, 0, 0 }
+
+/**
+ * Initialize a strbuf structure.
+ *
+ * For the cases where GH_BUF_INIT cannot be used to do static
+ * initialization.
+ */
+extern void strbuf_init(strbuf *buf, int initial_size);
+
+/**
+ * Attempt to grow the buffer to hold at least `target_size` bytes.
+ *
+ * If the allocation fails, this will return an error.  If mark_oom is true,
+ * this will mark the buffer as invalid for future operations; if false,
+ * existing buffer content will be preserved, but calling code must handle
+ * that buffer was not expanded.
+ */
+extern int strbuf_try_grow(strbuf *buf, int target_size, bool mark_oom);
+
+/**
+ * Grow the buffer to hold at least `target_size` bytes.
+ *
+ * If the allocation fails, this will return an error and the buffer will be
+ * marked as invalid for future operations, invaliding contents.
+ *
+ * @return 0 on success or -1 on failure
+ */
+static inline int strbuf_grow(strbuf *buf, int target_size)
+{
+	return strbuf_try_grow(buf, target_size, true);
+}
+
+extern void strbuf_free(strbuf *buf);
+extern void strbuf_swap(strbuf *buf_a, strbuf *buf_b);
+
+/**
+ * Test if there have been any reallocation failures with this strbuf.
+ *
+ * Any function that writes to a strbuf can fail due to memory allocation
+ * issues.  If one fails, the strbuf will be marked with an OOM error and
+ * further calls to modify the buffer will fail.  Check strbuf_oom() at the
+ * end of your sequence and it will be true if you ran out of memory at any
+ * point with that buffer.
+ *
+ * @return false if no error, true if allocation error
+ */
+static inline bool strbuf_oom(const strbuf *buf)
+{
+	return (buf->ptr == strbuf__oom);
+}
+
+
+static inline size_t strbuf_len(const strbuf *buf)
+{
+	return buf->size;
+}
+
+extern int strbuf_cmp(const strbuf *a, const strbuf *b);
+
+extern void strbuf_attach(strbuf *buf, unsigned char *ptr, int asize);
+extern unsigned char *strbuf_detach(strbuf *buf);
+extern void strbuf_copy_cstr(char *data, int datasize, const strbuf *buf);
+
+static inline const char *strbuf_cstr(const strbuf *buf)
+{
+	return (char *)buf->ptr;
+}
+
+#define strbuf_at(buf, n) ((buf)->ptr[n])
+
+/*
+ * Functions below that return int value error codes will return 0 on
+ * success or -1 on failure (which generally means an allocation failed).
+ * Using a strbuf where the allocation has failed with result in -1 from
+ * all further calls using that buffer.  As a result, you can ignore the
+ * return code of these functions and call them in a series then just call
+ * strbuf_oom at the end.
+ */
+extern int strbuf_set(strbuf *buf, const unsigned char *data, int len);
+extern int strbuf_sets(strbuf *buf, const char *string);
+extern int strbuf_putc(strbuf *buf, int c);
+extern int strbuf_put(strbuf *buf, const unsigned char *data, int len);
+extern int strbuf_puts(strbuf *buf, const char *string);
+extern int strbuf_printf(strbuf *buf, const char *format, ...)
+	__attribute__((format (printf, 2, 3)));
+extern int strbuf_vprintf(strbuf *buf, const char *format, va_list ap);
+extern void strbuf_clear(strbuf *buf);
+
+int strbuf_strchr(const strbuf *buf, int c, int pos);
+int strbuf_strrchr(const strbuf *buf, int c, int pos);
+void strbuf_drop(strbuf *buf, int n);
+void strbuf_truncate(strbuf *buf, int len);
+void strbuf_trim(strbuf *buf);
+void strbuf_normalize_whitespace(strbuf *s);
+void strbuf_unescape(strbuf *s);
+
+#endif
diff --git a/src/case_fold_switch.c b/src/case_fold_switch.inc
diff --git a/src/casefold.c b/src/casefold.c
@@ -1,2699 +0,0 @@
-#include <stdlib.h>
-#include <stdio.h>
-
-
-  switch c {
-    case 0x0041:
-      bufpush(0x0061);
-      break;
-    case 0x0042:
-      bufpush(0x0062);
-      break;
-    case 0x0043:
-      bufpush(0x0063);
-      break;
-    case 0x0044:
-      bufpush(0x0064);
-      break;
-    case 0x0045:
-      bufpush(0x0065);
-      break;
-    case 0x0046:
-      bufpush(0x0066);
-      break;
-    case 0x0047:
-      bufpush(0x0067);
-      break;
-    case 0x0048:
-      bufpush(0x0068);
-      break;
-    case 0x0049:
-      bufpush(0x0069);
-      break;
-    case 0x0049:
-      bufpush(0x0131);
-      break;
-    case 0x004A:
-      bufpush(0x006A);
-      break;
-    case 0x004B:
-      bufpush(0x006B);
-      break;
-    case 0x004C:
-      bufpush(0x006C);
-      break;
-    case 0x004D:
-      bufpush(0x006D);
-      break;
-    case 0x004E:
-      bufpush(0x006E);
-      break;
-    case 0x004F:
-      bufpush(0x006F);
-      break;
-    case 0x0050:
-      bufpush(0x0070);
-      break;
-    case 0x0051:
-      bufpush(0x0071);
-      break;
-    case 0x0052:
-      bufpush(0x0072);
-      break;
-    case 0x0053:
-      bufpush(0x0073);
-      break;
-    case 0x0054:
-      bufpush(0x0074);
-      break;
-    case 0x0055:
-      bufpush(0x0075);
-      break;
-    case 0x0056:
-      bufpush(0x0076);
-      break;
-    case 0x0057:
-      bufpush(0x0077);
-      break;
-    case 0x0058:
-      bufpush(0x0078);
-      break;
-    case 0x0059:
-      bufpush(0x0079);
-      break;
-    case 0x005A:
-      bufpush(0x007A);
-      break;
-    case 0x00B5:
-      bufpush(0x03BC);
-      break;
-    case 0x00C0:
-      bufpush(0x00E0);
-      break;
-    case 0x00C1:
-      bufpush(0x00E1);
-      break;
-    case 0x00C2:
-      bufpush(0x00E2);
-      break;
-    case 0x00C3:
-      bufpush(0x00E3);
-      break;
-    case 0x00C4:
-      bufpush(0x00E4);
-      break;
-    case 0x00C5:
-      bufpush(0x00E5);
-      break;
-    case 0x00C6:
-      bufpush(0x00E6);
-      break;
-    case 0x00C7:
-      bufpush(0x00E7);
-      break;
-    case 0x00C8:
-      bufpush(0x00E8);
-      break;
-    case 0x00C9:
-      bufpush(0x00E9);
-      break;
-    case 0x00CA:
-      bufpush(0x00EA);
-      break;
-    case 0x00CB:
-      bufpush(0x00EB);
-      break;
-    case 0x00CC:
-      bufpush(0x00EC);
-      break;
-    case 0x00CD:
-      bufpush(0x00ED);
-      break;
-    case 0x00CE:
-      bufpush(0x00EE);
-      break;
-    case 0x00CF:
-      bufpush(0x00EF);
-      break;
-    case 0x00D0:
-      bufpush(0x00F0);
-      break;
-    case 0x00D1:
-      bufpush(0x00F1);
-      break;
-    case 0x00D2:
-      bufpush(0x00F2);
-      break;
-    case 0x00D3:
-      bufpush(0x00F3);
-      break;
-    case 0x00D4:
-      bufpush(0x00F4);
-      break;
-    case 0x00D5:
-      bufpush(0x00F5);
-      break;
-    case 0x00D6:
-      bufpush(0x00F6);
-      break;
-    case 0x00D8:
-      bufpush(0x00F8);
-      break;
-    case 0x00D9:
-      bufpush(0x00F9);
-      break;
-    case 0x00DA:
-      bufpush(0x00FA);
-      break;
-    case 0x00DB:
-      bufpush(0x00FB);
-      break;
-    case 0x00DC:
-      bufpush(0x00FC);
-      break;
-    case 0x00DD:
-      bufpush(0x00FD);
-      break;
-    case 0x00DE:
-      bufpush(0x00FE);
-      break;
-    case 0x00DF:
-      bufpush(0x0073);
-      bufpush(0x0073);
-      break;
-    case 0x0100:
-      bufpush(0x0101);
-      break;
-    case 0x0102:
-      bufpush(0x0103);
-      break;
-    case 0x0104:
-      bufpush(0x0105);
-      break;
-    case 0x0106:
-      bufpush(0x0107);
-      break;
-    case 0x0108:
-      bufpush(0x0109);
-      break;
-    case 0x010A:
-      bufpush(0x010B);
-      break;
-    case 0x010C:
-      bufpush(0x010D);
-      break;
-    case 0x010E:
-      bufpush(0x010F);
-      break;
-    case 0x0110:
-      bufpush(0x0111);
-      break;
-    case 0x0112:
-      bufpush(0x0113);
-      break;
-    case 0x0114:
-      bufpush(0x0115);
-      break;
-    case 0x0116:
-      bufpush(0x0117);
-      break;
-    case 0x0118:
-      bufpush(0x0119);
-      break;
-    case 0x011A:
-      bufpush(0x011B);
-      break;
-    case 0x011C:
-      bufpush(0x011D);
-      break;
-    case 0x011E:
-      bufpush(0x011F);
-      break;
-    case 0x0120:
-      bufpush(0x0121);
-      break;
-    case 0x0122:
-      bufpush(0x0123);
-      break;
-    case 0x0124:
-      bufpush(0x0125);
-      break;
-    case 0x0126:
-      bufpush(0x0127);
-      break;
-    case 0x0128:
-      bufpush(0x0129);
-      break;
-    case 0x012A:
-      bufpush(0x012B);
-      break;
-    case 0x012C:
-      bufpush(0x012D);
-      break;
-    case 0x012E:
-      bufpush(0x012F);
-      break;
-    case 0x0130:
-      bufpush(0x0069);
-      bufpush(0x0307);
-      break;
-    case 0x0130:
-      bufpush(0x0069);
-      break;
-    case 0x0132:
-      bufpush(0x0133);
-      break;
-    case 0x0134:
-      bufpush(0x0135);
-      break;
-    case 0x0136:
-      bufpush(0x0137);
-      break;
-    case 0x0139:
-      bufpush(0x013A);
-      break;
-    case 0x013B:
-      bufpush(0x013C);
-      break;
-    case 0x013D:
-      bufpush(0x013E);
-      break;
-    case 0x013F:
-      bufpush(0x0140);
-      break;
-    case 0x0141:
-      bufpush(0x0142);
-      break;
-    case 0x0143:
-      bufpush(0x0144);
-      break;
-    case 0x0145:
-      bufpush(0x0146);
-      break;
-    case 0x0147:
-      bufpush(0x0148);
-      break;
-    case 0x0149:
-      bufpush(0x02BC);
-      bufpush(0x006E);
-      break;
-    case 0x014A:
-      bufpush(0x014B);
-      break;
-    case 0x014C:
-      bufpush(0x014D);
-      break;
-    case 0x014E:
-      bufpush(0x014F);
-      break;
-    case 0x0150:
-      bufpush(0x0151);
-      break;
-    case 0x0152:
-      bufpush(0x0153);
-      break;
-    case 0x0154:
-      bufpush(0x0155);
-      break;
-    case 0x0156:
-      bufpush(0x0157);
-      break;
-    case 0x0158:
-      bufpush(0x0159);
-      break;
-    case 0x015A:
-      bufpush(0x015B);
-      break;
-    case 0x015C:
-      bufpush(0x015D);
-      break;
-    case 0x015E:
-      bufpush(0x015F);
-      break;
-    case 0x0160:
-      bufpush(0x0161);
-      break;
-    case 0x0162:
-      bufpush(0x0163);
-      break;
-    case 0x0164:
-      bufpush(0x0165);
-      break;
-    case 0x0166:
-      bufpush(0x0167);
-      break;
-    case 0x0168:
-      bufpush(0x0169);
-      break;
-    case 0x016A:
-      bufpush(0x016B);
-      break;
-    case 0x016C:
-      bufpush(0x016D);
-      break;
-    case 0x016E:
-      bufpush(0x016F);
-      break;
-    case 0x0170:
-      bufpush(0x0171);
-      break;
-    case 0x0172:
-      bufpush(0x0173);
-      break;
-    case 0x0174:
-      bufpush(0x0175);
-      break;
-    case 0x0176:
-      bufpush(0x0177);
-      break;
-    case 0x0178:
-      bufpush(0x00FF);
-      break;
-    case 0x0179:
-      bufpush(0x017A);
-      break;
-    case 0x017B:
-      bufpush(0x017C);
-      break;
-    case 0x017D:
-      bufpush(0x017E);
-      break;
-    case 0x017F:
-      bufpush(0x0073);
-      break;
-    case 0x0181:
-      bufpush(0x0253);
-      break;
-    case 0x0182:
-      bufpush(0x0183);
-      break;
-    case 0x0184:
-      bufpush(0x0185);
-      break;
-    case 0x0186:
-      bufpush(0x0254);
-      break;
-    case 0x0187:
-      bufpush(0x0188);
-      break;
-    case 0x0189:
-      bufpush(0x0256);
-      break;
-    case 0x018A:
-      bufpush(0x0257);
-      break;
-    case 0x018B:
-      bufpush(0x018C);
-      break;
-    case 0x018E:
-      bufpush(0x01DD);
-      break;
-    case 0x018F:
-      bufpush(0x0259);
-      break;
-    case 0x0190:
-      bufpush(0x025B);
-      break;
-    case 0x0191:
-      bufpush(0x0192);
-      break;
-    case 0x0193:
-      bufpush(0x0260);
-      break;
-    case 0x0194:
-      bufpush(0x0263);
-      break;
-    case 0x0196:
-      bufpush(0x0269);
-      break;
-    case 0x0197:
-      bufpush(0x0268);
-      break;
-    case 0x0198:
-      bufpush(0x0199);
-      break;
-    case 0x019C:
-      bufpush(0x026F);
-      break;
-    case 0x019D:
-      bufpush(0x0272);
-      break;
-    case 0x019F:
-      bufpush(0x0275);
-      break;
-    case 0x01A0:
-      bufpush(0x01A1);
-      break;
-    case 0x01A2:
-      bufpush(0x01A3);
-      break;
-    case 0x01A4:
-      bufpush(0x01A5);
-      break;
-    case 0x01A6:
-      bufpush(0x0280);
-      break;
-    case 0x01A7:
-      bufpush(0x01A8);
-      break;
-    case 0x01A9:
-      bufpush(0x0283);
-      break;
-    case 0x01AC:
-      bufpush(0x01AD);
-      break;
-    case 0x01AE:
-      bufpush(0x0288);
-      break;
-    case 0x01AF:
-      bufpush(0x01B0);
-      break;
-    case 0x01B1:
-      bufpush(0x028A);
-      break;
-    case 0x01B2:
-      bufpush(0x028B);
-      break;
-    case 0x01B3:
-      bufpush(0x01B4);
-      break;
-    case 0x01B5:
-      bufpush(0x01B6);
-      break;
-    case 0x01B7:
-      bufpush(0x0292);
-      break;
-    case 0x01B8:
-      bufpush(0x01B9);
-      break;
-    case 0x01BC:
-      bufpush(0x01BD);
-      break;
-    case 0x01C4:
-      bufpush(0x01C6);
-      break;
-    case 0x01C5:
-      bufpush(0x01C6);
-      break;
-    case 0x01C7:
-      bufpush(0x01C9);
-      break;
-    case 0x01C8:
-      bufpush(0x01C9);
-      break;
-    case 0x01CA:
-      bufpush(0x01CC);
-      break;
-    case 0x01CB:
-      bufpush(0x01CC);
-      break;
-    case 0x01CD:
-      bufpush(0x01CE);
-      break;
-    case 0x01CF:
-      bufpush(0x01D0);
-      break;
-    case 0x01D1:
-      bufpush(0x01D2);
-      break;
-    case 0x01D3:
-      bufpush(0x01D4);
-      break;
-    case 0x01D5:
-      bufpush(0x01D6);
-      break;
-    case 0x01D7:
-      bufpush(0x01D8);
-      break;
-    case 0x01D9:
-      bufpush(0x01DA);
-      break;
-    case 0x01DB:
-      bufpush(0x01DC);
-      break;
-    case 0x01DE:
-      bufpush(0x01DF);
-      break;
-    case 0x01E0:
-      bufpush(0x01E1);
-      break;
-    case 0x01E2:
-      bufpush(0x01E3);
-      break;
-    case 0x01E4:
-      bufpush(0x01E5);
-      break;
-    case 0x01E6:
-      bufpush(0x01E7);
-      break;
-    case 0x01E8:
-      bufpush(0x01E9);
-      break;
-    case 0x01EA:
-      bufpush(0x01EB);
-      break;
-    case 0x01EC:
-      bufpush(0x01ED);
-      break;
-    case 0x01EE:
-      bufpush(0x01EF);
-      break;
-    case 0x01F0:
-      bufpush(0x006A);
-      bufpush(0x030C);
-      break;
-    case 0x01F1:
-      bufpush(0x01F3);
-      break;
-    case 0x01F2:
-      bufpush(0x01F3);
-      break;
-    case 0x01F4:
-      bufpush(0x01F5);
-      break;
-    case 0x01F6:
-      bufpush(0x0195);
-      break;
-    case 0x01F7:
-      bufpush(0x01BF);
-      break;
-    case 0x01F8:
-      bufpush(0x01F9);
-      break;
-    case 0x01FA:
-      bufpush(0x01FB);
-      break;
-    case 0x01FC:
-      bufpush(0x01FD);
-      break;
-    case 0x01FE:
-      bufpush(0x01FF);
-      break;
-    case 0x0200:
-      bufpush(0x0201);
-      break;
-    case 0x0202:
-      bufpush(0x0203);
-      break;
-    case 0x0204:
-      bufpush(0x0205);
-      break;
-    case 0x0206:
-      bufpush(0x0207);
-      break;
-    case 0x0208:
-      bufpush(0x0209);
-      break;
-    case 0x020A:
-      bufpush(0x020B);
-      break;
-    case 0x020C:
-      bufpush(0x020D);
-      break;
-    case 0x020E:
-      bufpush(0x020F);
-      break;
-    case 0x0210:
-      bufpush(0x0211);
-      break;
-    case 0x0212:
-      bufpush(0x0213);
-      break;
-    case 0x0214:
-      bufpush(0x0215);
-      break;
-    case 0x0216:
-      bufpush(0x0217);
-      break;
-    case 0x0218:
-      bufpush(0x0219);
-      break;
-    case 0x021A:
-      bufpush(0x021B);
-      break;
-    case 0x021C:
-      bufpush(0x021D);
-      break;
-    case 0x021E:
-      bufpush(0x021F);
-      break;
-    case 0x0220:
-      bufpush(0x019E);
-      break;
-    case 0x0222:
-      bufpush(0x0223);
-      break;
-    case 0x0224:
-      bufpush(0x0225);
-      break;
-    case 0x0226:
-      bufpush(0x0227);
-      break;
-    case 0x0228:
-      bufpush(0x0229);
-      break;
-    case 0x022A:
-      bufpush(0x022B);
-      break;
-    case 0x022C:
-      bufpush(0x022D);
-      break;
-    case 0x022E:
-      bufpush(0x022F);
-      break;
-    case 0x0230:
-      bufpush(0x0231);
-      break;
-    case 0x0232:
-      bufpush(0x0233);
-      break;
-    case 0x0345:
-      bufpush(0x03B9);
-      break;
-    case 0x0386:
-      bufpush(0x03AC);
-      break;
-    case 0x0388:
-      bufpush(0x03AD);
-      break;
-    case 0x0389:
-      bufpush(0x03AE);
-      break;
-    case 0x038A:
-      bufpush(0x03AF);
-      break;
-    case 0x038C:
-      bufpush(0x03CC);
-      break;
-    case 0x038E:
-      bufpush(0x03CD);
-      break;
-    case 0x038F:
-      bufpush(0x03CE);
-      break;
-    case 0x0390:
-      bufpush(0x03B9);
-      bufpush(0x0308);
-      bufpush(0x0301);
-      break;
-    case 0x0391:
-      bufpush(0x03B1);
-      break;
-    case 0x0392:
-      bufpush(0x03B2);
-      break;
-    case 0x0393:
-      bufpush(0x03B3);
-      break;
-    case 0x0394:
-      bufpush(0x03B4);
-      break;
-    case 0x0395:
-      bufpush(0x03B5);
-      break;
-    case 0x0396:
-      bufpush(0x03B6);
-      break;
-    case 0x0397:
-      bufpush(0x03B7);
-      break;
-    case 0x0398:
-      bufpush(0x03B8);
-      break;
-    case 0x0399:
-      bufpush(0x03B9);
-      break;
-    case 0x039A:
-      bufpush(0x03BA);
-      break;
-    case 0x039B:
-      bufpush(0x03BB);
-      break;
-    case 0x039C:
-      bufpush(0x03BC);
-      break;
-    case 0x039D:
-      bufpush(0x03BD);
-      break;
-    case 0x039E:
-      bufpush(0x03BE);
-      break;
-    case 0x039F:
-      bufpush(0x03BF);
-      break;
-    case 0x03A0:
-      bufpush(0x03C0);
-      break;
-    case 0x03A1:
-      bufpush(0x03C1);
-      break;
-    case 0x03A3:
-      bufpush(0x03C3);
-      break;
-    case 0x03A4:
-      bufpush(0x03C4);
-      break;
-    case 0x03A5:
-      bufpush(0x03C5);
-      break;
-    case 0x03A6:
-      bufpush(0x03C6);
-      break;
-    case 0x03A7:
-      bufpush(0x03C7);
-      break;
-    case 0x03A8:
-      bufpush(0x03C8);
-      break;
-    case 0x03A9:
-      bufpush(0x03C9);
-      break;
-    case 0x03AA:
-      bufpush(0x03CA);
-      break;
-    case 0x03AB:
-      bufpush(0x03CB);
-      break;
-    case 0x03B0:
-      bufpush(0x03C5);
-      bufpush(0x0308);
-      bufpush(0x0301);
-      break;
-    case 0x03C2:
-      bufpush(0x03C3);
-      break;
-    case 0x03D0:
-      bufpush(0x03B2);
-      break;
-    case 0x03D1:
-      bufpush(0x03B8);
-      break;
-    case 0x03D5:
-      bufpush(0x03C6);
-      break;
-    case 0x03D6:
-      bufpush(0x03C0);
-      break;
-    case 0x03D8:
-      bufpush(0x03D9);
-      break;
-    case 0x03DA:
-      bufpush(0x03DB);
-      break;
-    case 0x03DC:
-      bufpush(0x03DD);
-      break;
-    case 0x03DE:
-      bufpush(0x03DF);
-      break;
-    case 0x03E0:
-      bufpush(0x03E1);
-      break;
-    case 0x03E2:
-      bufpush(0x03E3);
-      break;
-    case 0x03E4:
-      bufpush(0x03E5);
-      break;
-    case 0x03E6:
-      bufpush(0x03E7);
-      break;
-    case 0x03E8:
-      bufpush(0x03E9);
-      break;
-    case 0x03EA:
-      bufpush(0x03EB);
-      break;
-    case 0x03EC:
-      bufpush(0x03ED);
-      break;
-    case 0x03EE:
-      bufpush(0x03EF);
-      break;
-    case 0x03F0:
-      bufpush(0x03BA);
-      break;
-    case 0x03F1:
-      bufpush(0x03C1);
-      break;
-    case 0x03F2:
-      bufpush(0x03C3);
-      break;
-    case 0x03F4:
-      bufpush(0x03B8);
-      break;
-    case 0x03F5:
-      bufpush(0x03B5);
-      break;
-    case 0x0400:
-      bufpush(0x0450);
-      break;
-    case 0x0401:
-      bufpush(0x0451);
-      break;
-    case 0x0402:
-      bufpush(0x0452);
-      break;
-    case 0x0403:
-      bufpush(0x0453);
-      break;
-    case 0x0404:
-      bufpush(0x0454);
-      break;
-    case 0x0405:
-      bufpush(0x0455);
-      break;
-    case 0x0406:
-      bufpush(0x0456);
-      break;
-    case 0x0407:
-      bufpush(0x0457);
-      break;
-    case 0x0408:
-      bufpush(0x0458);
-      break;
-    case 0x0409:
-      bufpush(0x0459);
-      break;
-    case 0x040A:
-      bufpush(0x045A);
-      break;
-    case 0x040B:
-      bufpush(0x045B);
-      break;
-    case 0x040C:
-      bufpush(0x045C);
-      break;
-    case 0x040D:
-      bufpush(0x045D);
-      break;
-    case 0x040E:
-      bufpush(0x045E);
-      break;
-    case 0x040F:
-      bufpush(0x045F);
-      break;
-    case 0x0410:
-      bufpush(0x0430);
-      break;
-    case 0x0411:
-      bufpush(0x0431);
-      break;
-    case 0x0412:
-      bufpush(0x0432);
-      break;
-    case 0x0413:
-      bufpush(0x0433);
-      break;
-    case 0x0414:
-      bufpush(0x0434);
-      break;
-    case 0x0415:
-      bufpush(0x0435);
-      break;
-    case 0x0416:
-      bufpush(0x0436);
-      break;
-    case 0x0417:
-      bufpush(0x0437);
-      break;
-    case 0x0418:
-      bufpush(0x0438);
-      break;
-    case 0x0419:
-      bufpush(0x0439);
-      break;
-    case 0x041A:
-      bufpush(0x043A);
-      break;
-    case 0x041B:
-      bufpush(0x043B);
-      break;
-    case 0x041C:
-      bufpush(0x043C);
-      break;
-    case 0x041D:
-      bufpush(0x043D);
-      break;
-    case 0x041E:
-      bufpush(0x043E);
-      break;
-    case 0x041F:
-      bufpush(0x043F);
-      break;
-    case 0x0420:
-      bufpush(0x0440);
-      break;
-    case 0x0421:
-      bufpush(0x0441);
-      break;
-    case 0x0422:
-      bufpush(0x0442);
-      break;
-    case 0x0423:
-      bufpush(0x0443);
-      break;
-    case 0x0424:
-      bufpush(0x0444);
-      break;
-    case 0x0425:
-      bufpush(0x0445);
-      break;
-    case 0x0426:
-      bufpush(0x0446);
-      break;
-    case 0x0427:
-      bufpush(0x0447);
-      break;
-    case 0x0428:
-      bufpush(0x0448);
-      break;
-    case 0x0429:
-      bufpush(0x0449);
-      break;
-    case 0x042A:
-      bufpush(0x044A);
-      break;
-    case 0x042B:
-      bufpush(0x044B);
-      break;
-    case 0x042C:
-      bufpush(0x044C);
-      break;
-    case 0x042D:
-      bufpush(0x044D);
-      break;
-    case 0x042E:
-      bufpush(0x044E);
-      break;
-    case 0x042F:
-      bufpush(0x044F);
-      break;
-    case 0x0460:
-      bufpush(0x0461);
-      break;
-    case 0x0462:
-      bufpush(0x0463);
-      break;
-    case 0x0464:
-      bufpush(0x0465);
-      break;
-    case 0x0466:
-      bufpush(0x0467);
-      break;
-    case 0x0468:
-      bufpush(0x0469);
-      break;
-    case 0x046A:
-      bufpush(0x046B);
-      break;
-    case 0x046C:
-      bufpush(0x046D);
-      break;
-    case 0x046E:
-      bufpush(0x046F);
-      break;
-    case 0x0470:
-      bufpush(0x0471);
-      break;
-    case 0x0472:
-      bufpush(0x0473);
-      break;
-    case 0x0474:
-      bufpush(0x0475);
-      break;
-    case 0x0476:
-      bufpush(0x0477);
-      break;
-    case 0x0478:
-      bufpush(0x0479);
-      break;
-    case 0x047A:
-      bufpush(0x047B);
-      break;
-    case 0x047C:
-      bufpush(0x047D);
-      break;
-    case 0x047E:
-      bufpush(0x047F);
-      break;
-    case 0x0480:
-      bufpush(0x0481);
-      break;
-    case 0x048A:
-      bufpush(0x048B);
-      break;
-    case 0x048C:
-      bufpush(0x048D);
-      break;
-    case 0x048E:
-      bufpush(0x048F);
-      break;
-    case 0x0490:
-      bufpush(0x0491);
-      break;
-    case 0x0492:
-      bufpush(0x0493);
-      break;
-    case 0x0494:
-      bufpush(0x0495);
-      break;
-    case 0x0496:
-      bufpush(0x0497);
-      break;
-    case 0x0498:
-      bufpush(0x0499);
-      break;
-    case 0x049A:
-      bufpush(0x049B);
-      break;
-    case 0x049C:
-      bufpush(0x049D);
-      break;
-    case 0x049E:
-      bufpush(0x049F);
-      break;
-    case 0x04A0:
-      bufpush(0x04A1);
-      break;
-    case 0x04A2:
-      bufpush(0x04A3);
-      break;
-    case 0x04A4:
-      bufpush(0x04A5);
-      break;
-    case 0x04A6:
-      bufpush(0x04A7);
-      break;
-    case 0x04A8:
-      bufpush(0x04A9);
-      break;
-    case 0x04AA:
-      bufpush(0x04AB);
-      break;
-    case 0x04AC:
-      bufpush(0x04AD);
-      break;
-    case 0x04AE:
-      bufpush(0x04AF);
-      break;
-    case 0x04B0:
-      bufpush(0x04B1);
-      break;
-    case 0x04B2:
-      bufpush(0x04B3);
-      break;
-    case 0x04B4:
-      bufpush(0x04B5);
-      break;
-    case 0x04B6:
-      bufpush(0x04B7);
-      break;
-    case 0x04B8:
-      bufpush(0x04B9);
-      break;
-    case 0x04BA:
-      bufpush(0x04BB);
-      break;
-    case 0x04BC:
-      bufpush(0x04BD);
-      break;
-    case 0x04BE:
-      bufpush(0x04BF);
-      break;
-    case 0x04C1:
-      bufpush(0x04C2);
-      break;
-    case 0x04C3:
-      bufpush(0x04C4);
-      break;
-    case 0x04C5:
-      bufpush(0x04C6);
-      break;
-    case 0x04C7:
-      bufpush(0x04C8);
-      break;
-    case 0x04C9:
-      bufpush(0x04CA);
-      break;
-    case 0x04CB:
-      bufpush(0x04CC);
-      break;
-    case 0x04CD:
-      bufpush(0x04CE);
-      break;
-    case 0x04D0:
-      bufpush(0x04D1);
-      break;
-    case 0x04D2:
-      bufpush(0x04D3);
-      break;
-    case 0x04D4:
-      bufpush(0x04D5);
-      break;
-    case 0x04D6:
-      bufpush(0x04D7);
-      break;
-    case 0x04D8:
-      bufpush(0x04D9);
-      break;
-    case 0x04DA:
-      bufpush(0x04DB);
-      break;
-    case 0x04DC:
-      bufpush(0x04DD);
-      break;
-    case 0x04DE:
-      bufpush(0x04DF);
-      break;
-    case 0x04E0:
-      bufpush(0x04E1);
-      break;
-    case 0x04E2:
-      bufpush(0x04E3);
-      break;
-    case 0x04E4:
-      bufpush(0x04E5);
-      break;
-    case 0x04E6:
-      bufpush(0x04E7);
-      break;
-    case 0x04E8:
-      bufpush(0x04E9);
-      break;
-    case 0x04EA:
-      bufpush(0x04EB);
-      break;
-    case 0x04EC:
-      bufpush(0x04ED);
-      break;
-    case 0x04EE:
-      bufpush(0x04EF);
-      break;
-    case 0x04F0:
-      bufpush(0x04F1);
-      break;
-    case 0x04F2:
-      bufpush(0x04F3);
-      break;
-    case 0x04F4:
-      bufpush(0x04F5);
-      break;
-    case 0x04F8:
-      bufpush(0x04F9);
-      break;
-    case 0x0500:
-      bufpush(0x0501);
-      break;
-    case 0x0502:
-      bufpush(0x0503);
-      break;
-    case 0x0504:
-      bufpush(0x0505);
-      break;
-    case 0x0506:
-      bufpush(0x0507);
-      break;
-    case 0x0508:
-      bufpush(0x0509);
-      break;
-    case 0x050A:
-      bufpush(0x050B);
-      break;
-    case 0x050C:
-      bufpush(0x050D);
-      break;
-    case 0x050E:
-      bufpush(0x050F);
-      break;
-    case 0x0531:
-      bufpush(0x0561);
-      break;
-    case 0x0532:
-      bufpush(0x0562);
-      break;
-    case 0x0533:
-      bufpush(0x0563);
-      break;
-    case 0x0534:
-      bufpush(0x0564);
-      break;
-    case 0x0535:
-      bufpush(0x0565);
-      break;
-    case 0x0536:
-      bufpush(0x0566);
-      break;
-    case 0x0537:
-      bufpush(0x0567);
-      break;
-    case 0x0538:
-      bufpush(0x0568);
-      break;
-    case 0x0539:
-      bufpush(0x0569);
-      break;
-    case 0x053A:
-      bufpush(0x056A);
-      break;
-    case 0x053B:
-      bufpush(0x056B);
-      break;
-    case 0x053C:
-      bufpush(0x056C);
-      break;
-    case 0x053D:
-      bufpush(0x056D);
-      break;
-    case 0x053E:
-      bufpush(0x056E);
-      break;
-    case 0x053F:
-      bufpush(0x056F);
-      break;
-    case 0x0540:
-      bufpush(0x0570);
-      break;
-    case 0x0541:
-      bufpush(0x0571);
-      break;
-    case 0x0542:
-      bufpush(0x0572);
-      break;
-    case 0x0543:
-      bufpush(0x0573);
-      break;
-    case 0x0544:
-      bufpush(0x0574);
-      break;
-    case 0x0545:
-      bufpush(0x0575);
-      break;
-    case 0x0546:
-      bufpush(0x0576);
-      break;
-    case 0x0547:
-      bufpush(0x0577);
-      break;
-    case 0x0548:
-      bufpush(0x0578);
-      break;
-    case 0x0549:
-      bufpush(0x0579);
-      break;
-    case 0x054A:
-      bufpush(0x057A);
-      break;
-    case 0x054B:
-      bufpush(0x057B);
-      break;
-    case 0x054C:
-      bufpush(0x057C);
-      break;
-    case 0x054D:
-      bufpush(0x057D);
-      break;
-    case 0x054E:
-      bufpush(0x057E);
-      break;
-    case 0x054F:
-      bufpush(0x057F);
-      break;
-    case 0x0550:
-      bufpush(0x0580);
-      break;
-    case 0x0551:
-      bufpush(0x0581);
-      break;
-    case 0x0552:
-      bufpush(0x0582);
-      break;
-    case 0x0553:
-      bufpush(0x0583);
-      break;
-    case 0x0554:
-      bufpush(0x0584);
-      break;
-    case 0x0555:
-      bufpush(0x0585);
-      break;
-    case 0x0556:
-      bufpush(0x0586);
-      break;
-    case 0x0587:
-      bufpush(0x0565);
-      bufpush(0x0582);
-      break;
-    case 0x1E00:
-      bufpush(0x1E01);
-      break;
-    case 0x1E02:
-      bufpush(0x1E03);
-      break;
-    case 0x1E04:
-      bufpush(0x1E05);
-      break;
-    case 0x1E06:
-      bufpush(0x1E07);
-      break;
-    case 0x1E08:
-      bufpush(0x1E09);
-      break;
-    case 0x1E0A:
-      bufpush(0x1E0B);
-      break;
-    case 0x1E0C:
-      bufpush(0x1E0D);
-      break;
-    case 0x1E0E:
-      bufpush(0x1E0F);
-      break;
-    case 0x1E10:
-      bufpush(0x1E11);
-      break;
-    case 0x1E12:
-      bufpush(0x1E13);
-      break;
-    case 0x1E14:
-      bufpush(0x1E15);
-      break;
-    case 0x1E16:
-      bufpush(0x1E17);
-      break;
-    case 0x1E18:
-      bufpush(0x1E19);
-      break;
-    case 0x1E1A:
-      bufpush(0x1E1B);
-      break;
-    case 0x1E1C:
-      bufpush(0x1E1D);
-      break;
-    case 0x1E1E:
-      bufpush(0x1E1F);
-      break;
-    case 0x1E20:
-      bufpush(0x1E21);
-      break;
-    case 0x1E22:
-      bufpush(0x1E23);
-      break;
-    case 0x1E24:
-      bufpush(0x1E25);
-      break;
-    case 0x1E26:
-      bufpush(0x1E27);
-      break;
-    case 0x1E28:
-      bufpush(0x1E29);
-      break;
-    case 0x1E2A:
-      bufpush(0x1E2B);
-      break;
-    case 0x1E2C:
-      bufpush(0x1E2D);
-      break;
-    case 0x1E2E:
-      bufpush(0x1E2F);
-      break;
-    case 0x1E30:
-      bufpush(0x1E31);
-      break;
-    case 0x1E32:
-      bufpush(0x1E33);
-      break;
-    case 0x1E34:
-      bufpush(0x1E35);
-      break;
-    case 0x1E36:
-      bufpush(0x1E37);
-      break;
-    case 0x1E38:
-      bufpush(0x1E39);
-      break;
-    case 0x1E3A:
-      bufpush(0x1E3B);
-      break;
-    case 0x1E3C:
-      bufpush(0x1E3D);
-      break;
-    case 0x1E3E:
-      bufpush(0x1E3F);
-      break;
-    case 0x1E40:
-      bufpush(0x1E41);
-      break;
-    case 0x1E42:
-      bufpush(0x1E43);
-      break;
-    case 0x1E44:
-      bufpush(0x1E45);
-      break;
-    case 0x1E46:
-      bufpush(0x1E47);
-      break;
-    case 0x1E48:
-      bufpush(0x1E49);
-      break;
-    case 0x1E4A:
-      bufpush(0x1E4B);
-      break;
-    case 0x1E4C:
-      bufpush(0x1E4D);
-      break;
-    case 0x1E4E:
-      bufpush(0x1E4F);
-      break;
-    case 0x1E50:
-      bufpush(0x1E51);
-      break;
-    case 0x1E52:
-      bufpush(0x1E53);
-      break;
-    case 0x1E54:
-      bufpush(0x1E55);
-      break;
-    case 0x1E56:
-      bufpush(0x1E57);
-      break;
-    case 0x1E58:
-      bufpush(0x1E59);
-      break;
-    case 0x1E5A:
-      bufpush(0x1E5B);
-      break;
-    case 0x1E5C:
-      bufpush(0x1E5D);
-      break;
-    case 0x1E5E:
-      bufpush(0x1E5F);
-      break;
-    case 0x1E60:
-      bufpush(0x1E61);
-      break;
-    case 0x1E62:
-      bufpush(0x1E63);
-      break;
-    case 0x1E64:
-      bufpush(0x1E65);
-      break;
-    case 0x1E66:
-      bufpush(0x1E67);
-      break;
-    case 0x1E68:
-      bufpush(0x1E69);
-      break;
-    case 0x1E6A:
-      bufpush(0x1E6B);
-      break;
-    case 0x1E6C:
-      bufpush(0x1E6D);
-      break;
-    case 0x1E6E:
-      bufpush(0x1E6F);
-      break;
-    case 0x1E70:
-      bufpush(0x1E71);
-      break;
-    case 0x1E72:
-      bufpush(0x1E73);
-      break;
-    case 0x1E74:
-      bufpush(0x1E75);
-      break;
-    case 0x1E76:
-      bufpush(0x1E77);
-      break;
-    case 0x1E78:
-      bufpush(0x1E79);
-      break;
-    case 0x1E7A:
-      bufpush(0x1E7B);
-      break;
-    case 0x1E7C:
-      bufpush(0x1E7D);
-      break;
-    case 0x1E7E:
-      bufpush(0x1E7F);
-      break;
-    case 0x1E80:
-      bufpush(0x1E81);
-      break;
-    case 0x1E82:
-      bufpush(0x1E83);
-      break;
-    case 0x1E84:
-      bufpush(0x1E85);
-      break;
-    case 0x1E86:
-      bufpush(0x1E87);
-      break;
-    case 0x1E88:
-      bufpush(0x1E89);
-      break;
-    case 0x1E8A:
-      bufpush(0x1E8B);
-      break;
-    case 0x1E8C:
-      bufpush(0x1E8D);
-      break;
-    case 0x1E8E:
-      bufpush(0x1E8F);
-      break;
-    case 0x1E90:
-      bufpush(0x1E91);
-      break;
-    case 0x1E92:
-      bufpush(0x1E93);
-      break;
-    case 0x1E94:
-      bufpush(0x1E95);
-      break;
-    case 0x1E96:
-      bufpush(0x0068);
-      bufpush(0x0331);
-      break;
-    case 0x1E97:
-      bufpush(0x0074);
-      bufpush(0x0308);
-      break;
-    case 0x1E98:
-      bufpush(0x0077);
-      bufpush(0x030A);
-      break;
-    case 0x1E99:
-      bufpush(0x0079);
-      bufpush(0x030A);
-      break;
-    case 0x1E9A:
-      bufpush(0x0061);
-      bufpush(0x02BE);
-      break;
-    case 0x1E9B:
-      bufpush(0x1E61);
-      break;
-    case 0x1EA0:
-      bufpush(0x1EA1);
-      break;
-    case 0x1EA2:
-      bufpush(0x1EA3);
-      break;
-    case 0x1EA4:
-      bufpush(0x1EA5);
-      break;
-    case 0x1EA6:
-      bufpush(0x1EA7);
-      break;
-    case 0x1EA8:
-      bufpush(0x1EA9);
-      break;
-    case 0x1EAA:
-      bufpush(0x1EAB);
-      break;
-    case 0x1EAC:
-      bufpush(0x1EAD);
-      break;
-    case 0x1EAE:
-      bufpush(0x1EAF);
-      break;
-    case 0x1EB0:
-      bufpush(0x1EB1);
-      break;
-    case 0x1EB2:
-      bufpush(0x1EB3);
-      break;
-    case 0x1EB4:
-      bufpush(0x1EB5);
-      break;
-    case 0x1EB6:
-      bufpush(0x1EB7);
-      break;
-    case 0x1EB8:
-      bufpush(0x1EB9);
-      break;
-    case 0x1EBA:
-      bufpush(0x1EBB);
-      break;
-    case 0x1EBC:
-      bufpush(0x1EBD);
-      break;
-    case 0x1EBE:
-      bufpush(0x1EBF);
-      break;
-    case 0x1EC0:
-      bufpush(0x1EC1);
-      break;
-    case 0x1EC2:
-      bufpush(0x1EC3);
-      break;
-    case 0x1EC4:
-      bufpush(0x1EC5);
-      break;
-    case 0x1EC6:
-      bufpush(0x1EC7);
-      break;
-    case 0x1EC8:
-      bufpush(0x1EC9);
-      break;
-    case 0x1ECA:
-      bufpush(0x1ECB);
-      break;
-    case 0x1ECC:
-      bufpush(0x1ECD);
-      break;
-    case 0x1ECE:
-      bufpush(0x1ECF);
-      break;
-    case 0x1ED0:
-      bufpush(0x1ED1);
-      break;
-    case 0x1ED2:
-      bufpush(0x1ED3);
-      break;
-    case 0x1ED4:
-      bufpush(0x1ED5);
-      break;
-    case 0x1ED6:
-      bufpush(0x1ED7);
-      break;
-    case 0x1ED8:
-      bufpush(0x1ED9);
-      break;
-    case 0x1EDA:
-      bufpush(0x1EDB);
-      break;
-    case 0x1EDC:
-      bufpush(0x1EDD);
-      break;
-    case 0x1EDE:
-      bufpush(0x1EDF);
-      break;
-    case 0x1EE0:
-      bufpush(0x1EE1);
-      break;
-    case 0x1EE2:
-      bufpush(0x1EE3);
-      break;
-    case 0x1EE4:
-      bufpush(0x1EE5);
-      break;
-    case 0x1EE6:
-      bufpush(0x1EE7);
-      break;
-    case 0x1EE8:
-      bufpush(0x1EE9);
-      break;
-    case 0x1EEA:
-      bufpush(0x1EEB);
-      break;
-    case 0x1EEC:
-      bufpush(0x1EED);
-      break;
-    case 0x1EEE:
-      bufpush(0x1EEF);
-      break;
-    case 0x1EF0:
-      bufpush(0x1EF1);
-      break;
-    case 0x1EF2:
-      bufpush(0x1EF3);
-      break;
-    case 0x1EF4:
-      bufpush(0x1EF5);
-      break;
-    case 0x1EF6:
-      bufpush(0x1EF7);
-      break;
-    case 0x1EF8:
-      bufpush(0x1EF9);
-      break;
-    case 0x1F08:
-      bufpush(0x1F00);
-      break;
-    case 0x1F09:
-      bufpush(0x1F01);
-      break;
-    case 0x1F0A:
-      bufpush(0x1F02);
-      break;
-    case 0x1F0B:
-      bufpush(0x1F03);
-      break;
-    case 0x1F0C:
-      bufpush(0x1F04);
-      break;
-    case 0x1F0D:
-      bufpush(0x1F05);
-      break;
-    case 0x1F0E:
-      bufpush(0x1F06);
-      break;
-    case 0x1F0F:
-      bufpush(0x1F07);
-      break;
-    case 0x1F18:
-      bufpush(0x1F10);
-      break;
-    case 0x1F19:
-      bufpush(0x1F11);
-      break;
-    case 0x1F1A:
-      bufpush(0x1F12);
-      break;
-    case 0x1F1B:
-      bufpush(0x1F13);
-      break;
-    case 0x1F1C:
-      bufpush(0x1F14);
-      break;
-    case 0x1F1D:
-      bufpush(0x1F15);
-      break;
-    case 0x1F28:
-      bufpush(0x1F20);
-      break;
-    case 0x1F29:
-      bufpush(0x1F21);
-      break;
-    case 0x1F2A:
-      bufpush(0x1F22);
-      break;
-    case 0x1F2B:
-      bufpush(0x1F23);
-      break;
-    case 0x1F2C:
-      bufpush(0x1F24);
-      break;
-    case 0x1F2D:
-      bufpush(0x1F25);
-      break;
-    case 0x1F2E:
-      bufpush(0x1F26);
-      break;
-    case 0x1F2F:
-      bufpush(0x1F27);
-      break;
-    case 0x1F38:
-      bufpush(0x1F30);
-      break;
-    case 0x1F39:
-      bufpush(0x1F31);
-      break;
-    case 0x1F3A:
-      bufpush(0x1F32);
-      break;
-    case 0x1F3B:
-      bufpush(0x1F33);
-      break;
-    case 0x1F3C:
-      bufpush(0x1F34);
-      break;
-    case 0x1F3D:
-      bufpush(0x1F35);
-      break;
-    case 0x1F3E:
-      bufpush(0x1F36);
-      break;
-    case 0x1F3F:
-      bufpush(0x1F37);
-      break;
-    case 0x1F48:
-      bufpush(0x1F40);
-      break;
-    case 0x1F49:
-      bufpush(0x1F41);
-      break;
-    case 0x1F4A:
-      bufpush(0x1F42);
-      break;
-    case 0x1F4B:
-      bufpush(0x1F43);
-      break;
-    case 0x1F4C:
-      bufpush(0x1F44);
-      break;
-    case 0x1F4D:
-      bufpush(0x1F45);
-      break;
-    case 0x1F50:
-      bufpush(0x03C5);
-      bufpush(0x0313);
-      break;
-    case 0x1F52:
-      bufpush(0x03C5);
-      bufpush(0x0313);
-      bufpush(0x0300);
-      break;
-    case 0x1F54:
-      bufpush(0x03C5);
-      bufpush(0x0313);
-      bufpush(0x0301);
-      break;
-    case 0x1F56:
-      bufpush(0x03C5);
-      bufpush(0x0313);
-      bufpush(0x0342);
-      break;
-    case 0x1F59:
-      bufpush(0x1F51);
-      break;
-    case 0x1F5B:
-      bufpush(0x1F53);
-      break;
-    case 0x1F5D:
-      bufpush(0x1F55);
-      break;
-    case 0x1F5F:
-      bufpush(0x1F57);
-      break;
-    case 0x1F68:
-      bufpush(0x1F60);
-      break;
-    case 0x1F69:
-      bufpush(0x1F61);
-      break;
-    case 0x1F6A:
-      bufpush(0x1F62);
-      break;
-    case 0x1F6B:
-      bufpush(0x1F63);
-      break;
-    case 0x1F6C:
-      bufpush(0x1F64);
-      break;
-    case 0x1F6D:
-      bufpush(0x1F65);
-      break;
-    case 0x1F6E:
-      bufpush(0x1F66);
-      break;
-    case 0x1F6F:
-      bufpush(0x1F67);
-      break;
-    case 0x1F80:
-      bufpush(0x1F00);
-      bufpush(0x03B9);
-      break;
-    case 0x1F81:
-      bufpush(0x1F01);
-      bufpush(0x03B9);
-      break;
-    case 0x1F82:
-      bufpush(0x1F02);
-      bufpush(0x03B9);
-      break;
-    case 0x1F83:
-      bufpush(0x1F03);
-      bufpush(0x03B9);
-      break;
-    case 0x1F84:
-      bufpush(0x1F04);
-      bufpush(0x03B9);
-      break;
-    case 0x1F85:
-      bufpush(0x1F05);
-      bufpush(0x03B9);
-      break;
-    case 0x1F86:
-      bufpush(0x1F06);
-      bufpush(0x03B9);
-      break;
-    case 0x1F87:
-      bufpush(0x1F07);
-      bufpush(0x03B9);
-      break;
-    case 0x1F88:
-      bufpush(0x1F00);
-      bufpush(0x03B9);
-      break;
-    case 0x:
-      break;
-    case 0x1F89:
-      bufpush(0x1F01);
-      bufpush(0x03B9);
-      break;
-    case 0x:
-      break;
-    case 0x1F8A:
-      bufpush(0x1F02);
-      bufpush(0x03B9);
-      break;
-    case 0x:
-      break;
-    case 0x1F8B:
-      bufpush(0x1F03);
-      bufpush(0x03B9);
-      break;
-    case 0x:
-      break;
-    case 0x1F8C:
-      bufpush(0x1F04);
-      bufpush(0x03B9);
-      break;
-    case 0x:
-      break;
-    case 0x1F8D:
-      bufpush(0x1F05);
-      bufpush(0x03B9);
-      break;
-    case 0x:
-      break;
-    case 0x1F8E:
-      bufpush(0x1F06);
-      bufpush(0x03B9);
-      break;
-    case 0x:
-      break;
-    case 0x1F8F:
-      bufpush(0x1F07);
-      bufpush(0x03B9);
-      break;
-    case 0x:
-      break;
-    case 0x1F90:
-      bufpush(0x1F20);
-      bufpush(0x03B9);
-      break;
-    case 0x1F91:
-      bufpush(0x1F21);
-      bufpush(0x03B9);
-      break;
-    case 0x1F92:
-      bufpush(0x1F22);
-      bufpush(0x03B9);
-      break;
-    case 0x1F93:
-      bufpush(0x1F23);
-      bufpush(0x03B9);
-      break;
-    case 0x1F94:
-      bufpush(0x1F24);
-      bufpush(0x03B9);
-      break;
-    case 0x1F95:
-      bufpush(0x1F25);
-      bufpush(0x03B9);
-      break;
-    case 0x1F96:
-      bufpush(0x1F26);
-      bufpush(0x03B9);
-      break;
-    case 0x1F97:
-      bufpush(0x1F27);
-      bufpush(0x03B9);
-      break;
-    case 0x1F98:
-      bufpush(0x1F20);
-      bufpush(0x03B9);
-      break;
-    case 0x:
-      break;
-    case 0x1F99:
-      bufpush(0x1F21);
-      bufpush(0x03B9);
-      break;
-    case 0x:
-      break;
-    case 0x1F9A:
-      bufpush(0x1F22);
-      bufpush(0x03B9);
-      break;
-    case 0x:
-      break;
-    case 0x1F9B:
-      bufpush(0x1F23);
-      bufpush(0x03B9);
-      break;
-    case 0x:
-      break;
-    case 0x1F9C:
-      bufpush(0x1F24);
-      bufpush(0x03B9);
-      break;
-    case 0x:
-      break;
-    case 0x1F9D:
-      bufpush(0x1F25);
-      bufpush(0x03B9);
-      break;
-    case 0x:
-      break;
-    case 0x1F9E:
-      bufpush(0x1F26);
-      bufpush(0x03B9);
-      break;
-    case 0x:
-      break;
-    case 0x1F9F:
-      bufpush(0x1F27);
-      bufpush(0x03B9);
-      break;
-    case 0x:
-      break;
-    case 0x1FA0:
-      bufpush(0x1F60);
-      bufpush(0x03B9);
-      break;
-    case 0x1FA1:
-      bufpush(0x1F61);
-      bufpush(0x03B9);
-      break;
-    case 0x1FA2:
-      bufpush(0x1F62);
-      bufpush(0x03B9);
-      break;
-    case 0x1FA3:
-      bufpush(0x1F63);
-      bufpush(0x03B9);
-      break;
-    case 0x1FA4:
-      bufpush(0x1F64);
-      bufpush(0x03B9);
-      break;
-    case 0x1FA5:
-      bufpush(0x1F65);
-      bufpush(0x03B9);
-      break;
-    case 0x1FA6:
-      bufpush(0x1F66);
-      bufpush(0x03B9);
-      break;
-    case 0x1FA7:
-      bufpush(0x1F67);
-      bufpush(0x03B9);
-      break;
-    case 0x1FA8:
-      bufpush(0x1F60);
-      bufpush(0x03B9);
-      break;
-    case 0x:
-      break;
-    case 0x1FA9:
-      bufpush(0x1F61);
-      bufpush(0x03B9);
-      break;
-    case 0x:
-      break;
-    case 0x1FAA:
-      bufpush(0x1F62);
-      bufpush(0x03B9);
-      break;
-    case 0x:
-      break;
-    case 0x1FAB:
-      bufpush(0x1F63);
-      bufpush(0x03B9);
-      break;
-    case 0x:
-      break;
-    case 0x1FAC:
-      bufpush(0x1F64);
-      bufpush(0x03B9);
-      break;
-    case 0x:
-      break;
-    case 0x1FAD:
-      bufpush(0x1F65);
-      bufpush(0x03B9);
-      break;
-    case 0x:
-      break;
-    case 0x1FAE:
-      bufpush(0x1F66);
-      bufpush(0x03B9);
-      break;
-    case 0x:
-      break;
-    case 0x1FAF:
-      bufpush(0x1F67);
-      bufpush(0x03B9);
-      break;
-    case 0x:
-      break;
-    case 0x1FB2:
-      bufpush(0x1F70);
-      bufpush(0x03B9);
-      break;
-    case 0x1FB3:
-      bufpush(0x03B1);
-      bufpush(0x03B9);
-      break;
-    case 0x1FB4:
-      bufpush(0x03AC);
-      bufpush(0x03B9);
-      break;
-    case 0x1FB6:
-      bufpush(0x03B1);
-      bufpush(0x0342);
-      break;
-    case 0x1FB7:
-      bufpush(0x03B1);
-      bufpush(0x0342);
-      bufpush(0x03B9);
-      break;
-    case 0x1FB8:
-      bufpush(0x1FB0);
-      break;
-    case 0x1FB9:
-      bufpush(0x1FB1);
-      break;
-    case 0x1FBA:
-      bufpush(0x1F70);
-      break;
-    case 0x1FBB:
-      bufpush(0x1F71);
-      break;
-    case 0x1FBC:
-      bufpush(0x03B1);
-      bufpush(0x03B9);
-      break;
-    case 0x:
-      break;
-    case 0x1FBE:
-      bufpush(0x03B9);
-      break;
-    case 0x1FC2:
-      bufpush(0x1F74);
-      bufpush(0x03B9);
-      break;
-    case 0x1FC3:
-      bufpush(0x03B7);
-      bufpush(0x03B9);
-      break;
-    case 0x1FC4:
-      bufpush(0x03AE);
-      bufpush(0x03B9);
-      break;
-    case 0x1FC6:
-      bufpush(0x03B7);
-      bufpush(0x0342);
-      break;
-    case 0x1FC7:
-      bufpush(0x03B7);
-      bufpush(0x0342);
-      bufpush(0x03B9);
-      break;
-    case 0x1FC8:
-      bufpush(0x1F72);
-      break;
-    case 0x1FC9:
-      bufpush(0x1F73);
-      break;
-    case 0x1FCA:
-      bufpush(0x1F74);
-      break;
-    case 0x1FCB:
-      bufpush(0x1F75);
-      break;
-    case 0x1FCC:
-      bufpush(0x03B7);
-      bufpush(0x03B9);
-      break;
-    case 0x:
-      break;
-    case 0x1FD2:
-      bufpush(0x03B9);
-      bufpush(0x0308);
-      bufpush(0x0300);
-      break;
-    case 0x1FD3:
-      bufpush(0x03B9);
-      bufpush(0x0308);
-      bufpush(0x0301);
-      break;
-    case 0x1FD6:
-      bufpush(0x03B9);
-      bufpush(0x0342);
-      break;
-    case 0x1FD7:
-      bufpush(0x03B9);
-      bufpush(0x0308);
-      bufpush(0x0342);
-      break;
-    case 0x1FD8:
-      bufpush(0x1FD0);
-      break;
-    case 0x1FD9:
-      bufpush(0x1FD1);
-      break;
-    case 0x1FDA:
-      bufpush(0x1F76);
-      break;
-    case 0x1FDB:
-      bufpush(0x1F77);
-      break;
-    case 0x1FE2:
-      bufpush(0x03C5);
-      bufpush(0x0308);
-      bufpush(0x0300);
-      break;
-    case 0x1FE3:
-      bufpush(0x03C5);
-      bufpush(0x0308);
-      bufpush(0x0301);
-      break;
-    case 0x1FE4:
-      bufpush(0x03C1);
-      bufpush(0x0313);
-      break;
-    case 0x1FE6:
-      bufpush(0x03C5);
-      bufpush(0x0342);
-      break;
-    case 0x1FE7:
-      bufpush(0x03C5);
-      bufpush(0x0308);
-      bufpush(0x0342);
-      break;
-    case 0x1FE8:
-      bufpush(0x1FE0);
-      break;
-    case 0x1FE9:
-      bufpush(0x1FE1);
-      break;
-    case 0x1FEA:
-      bufpush(0x1F7A);
-      break;
-    case 0x1FEB:
-      bufpush(0x1F7B);
-      break;
-    case 0x1FEC:
-      bufpush(0x1FE5);
-      break;
-    case 0x1FF2:
-      bufpush(0x1F7C);
-      bufpush(0x03B9);
-      break;
-    case 0x1FF3:
-      bufpush(0x03C9);
-      bufpush(0x03B9);
-      break;
-    case 0x1FF4:
-      bufpush(0x03CE);
-      bufpush(0x03B9);
-      break;
-    case 0x1FF6:
-      bufpush(0x03C9);
-      bufpush(0x0342);
-      break;
-    case 0x1FF7:
-      bufpush(0x03C9);
-      bufpush(0x0342);
-      bufpush(0x03B9);
-      break;
-    case 0x1FF8:
-      bufpush(0x1F78);
-      break;
-    case 0x1FF9:
-      bufpush(0x1F79);
-      break;
-    case 0x1FFA:
-      bufpush(0x1F7C);
-      break;
-    case 0x1FFB:
-      bufpush(0x1F7D);
-      break;
-    case 0x1FFC:
-      bufpush(0x03C9);
-      bufpush(0x03B9);
-      break;
-    case 0x:
-      break;
-    case 0x2126:
-      bufpush(0x03C9);
-      break;
-    case 0x212A:
-      bufpush(0x006B);
-      break;
-    case 0x212B:
-      bufpush(0x00E5);
-      break;
-    case 0x2160:
-      bufpush(0x2170);
-      break;
-    case 0x2161:
-      bufpush(0x2171);
-      break;
-    case 0x2162:
-      bufpush(0x2172);
-      break;
-    case 0x2163:
-      bufpush(0x2173);
-      break;
-    case 0x2164:
-      bufpush(0x2174);
-      break;
-    case 0x2165:
-      bufpush(0x2175);
-      break;
-    case 0x2166:
-      bufpush(0x2176);
-      break;
-    case 0x2167:
-      bufpush(0x2177);
-      break;
-    case 0x2168:
-      bufpush(0x2178);
-      break;
-    case 0x2169:
-      bufpush(0x2179);
-      break;
-    case 0x216A:
-      bufpush(0x217A);
-      break;
-    case 0x216B:
-      bufpush(0x217B);
-      break;
-    case 0x216C:
-      bufpush(0x217C);
-      break;
-    case 0x216D:
-      bufpush(0x217D);
-      break;
-    case 0x216E:
-      bufpush(0x217E);
-      break;
-    case 0x216F:
-      bufpush(0x217F);
-      break;
-    case 0x24B6:
-      bufpush(0x24D0);
-      break;
-    case 0x24B7:
-      bufpush(0x24D1);
-      break;
-    case 0x24B8:
-      bufpush(0x24D2);
-      break;
-    case 0x24B9:
-      bufpush(0x24D3);
-      break;
-    case 0x24BA:
-      bufpush(0x24D4);
-      break;
-    case 0x24BB:
-      bufpush(0x24D5);
-      break;
-    case 0x24BC:
-      bufpush(0x24D6);
-      break;
-    case 0x24BD:
-      bufpush(0x24D7);
-      break;
-    case 0x24BE:
-      bufpush(0x24D8);
-      break;
-    case 0x24BF:
-      bufpush(0x24D9);
-      break;
-    case 0x24C0:
-      bufpush(0x24DA);
-      break;
-    case 0x24C1:
-      bufpush(0x24DB);
-      break;
-    case 0x24C2:
-      bufpush(0x24DC);
-      break;
-    case 0x24C3:
-      bufpush(0x24DD);
-      break;
-    case 0x24C4:
-      bufpush(0x24DE);
-      break;
-    case 0x24C5:
-      bufpush(0x24DF);
-      break;
-    case 0x24C6:
-      bufpush(0x24E0);
-      break;
-    case 0x24C7:
-      bufpush(0x24E1);
-      break;
-    case 0x24C8:
-      bufpush(0x24E2);
-      break;
-    case 0x24C9:
-      bufpush(0x24E3);
-      break;
-    case 0x24CA:
-      bufpush(0x24E4);
-      break;
-    case 0x24CB:
-      bufpush(0x24E5);
-      break;
-    case 0x24CC:
-      bufpush(0x24E6);
-      break;
-    case 0x24CD:
-      bufpush(0x24E7);
-      break;
-    case 0x24CE:
-      bufpush(0x24E8);
-      break;
-    case 0x24CF:
-      bufpush(0x24E9);
-      break;
-    case 0xFB00:
-      bufpush(0x0066);
-      bufpush(0x0066);
-      break;
-    case 0xFB01:
-      bufpush(0x0066);
-      bufpush(0x0069);
-      break;
-    case 0xFB02:
-      bufpush(0x0066);
-      bufpush(0x006C);
-      break;
-    case 0xFB03:
-      bufpush(0x0066);
-      bufpush(0x0066);
-      bufpush(0x0069);
-      break;
-    case 0xFB04:
-      bufpush(0x0066);
-      bufpush(0x0066);
-      bufpush(0x006C);
-      break;
-    case 0xFB05:
-      bufpush(0x0073);
-      bufpush(0x0074);
-      break;
-    case 0xFB06:
-      bufpush(0x0073);
-      bufpush(0x0074);
-      break;
-    case 0xFB13:
-      bufpush(0x0574);
-      bufpush(0x0576);
-      break;
-    case 0xFB14:
-      bufpush(0x0574);
-      bufpush(0x0565);
-      break;
-    case 0xFB15:
-      bufpush(0x0574);
-      bufpush(0x056B);
-      break;
-    case 0xFB16:
-      bufpush(0x057E);
-      bufpush(0x0576);
-      break;
-    case 0xFB17:
-      bufpush(0x0574);
-      bufpush(0x056D);
-      break;
-    case 0xFF21:
-      bufpush(0xFF41);
-      break;
-    case 0xFF22:
-      bufpush(0xFF42);
-      break;
-    case 0xFF23:
-      bufpush(0xFF43);
-      break;
-    case 0xFF24:
-      bufpush(0xFF44);
-      break;
-    case 0xFF25:
-      bufpush(0xFF45);
-      break;
-    case 0xFF26:
-      bufpush(0xFF46);
-      break;
-    case 0xFF27:
-      bufpush(0xFF47);
-      break;
-    case 0xFF28:
-      bufpush(0xFF48);
-      break;
-    case 0xFF29:
-      bufpush(0xFF49);
-      break;
-    case 0xFF2A:
-      bufpush(0xFF4A);
-      break;
-    case 0xFF2B:
-      bufpush(0xFF4B);
-      break;
-    case 0xFF2C:
-      bufpush(0xFF4C);
-      break;
-    case 0xFF2D:
-      bufpush(0xFF4D);
-      break;
-    case 0xFF2E:
-      bufpush(0xFF4E);
-      break;
-    case 0xFF2F:
-      bufpush(0xFF4F);
-      break;
-    case 0xFF30:
-      bufpush(0xFF50);
-      break;
-    case 0xFF31:
-      bufpush(0xFF51);
-      break;
-    case 0xFF32:
-      bufpush(0xFF52);
-      break;
-    case 0xFF33:
-      bufpush(0xFF53);
-      break;
-    case 0xFF34:
-      bufpush(0xFF54);
-      break;
-    case 0xFF35:
-      bufpush(0xFF55);
-      break;
-    case 0xFF36:
-      bufpush(0xFF56);
-      break;
-    case 0xFF37:
-      bufpush(0xFF57);
-      break;
-    case 0xFF38:
-      bufpush(0xFF58);
-      break;
-    case 0xFF39:
-      bufpush(0xFF59);
-      break;
-    case 0xFF3A:
-      bufpush(0xFF5A);
-      break;
-    case 0x10400:
-      bufpush(0x10428);
-      break;
-    case 0x10401:
-      bufpush(0x10429);
-      break;
-    case 0x10402:
-      bufpush(0x1042A);
-      break;
-    case 0x10403:
-      bufpush(0x1042B);
-      break;
-    case 0x10404:
-      bufpush(0x1042C);
-      break;
-    case 0x10405:
-      bufpush(0x1042D);
-      break;
-    case 0x10406:
-      bufpush(0x1042E);
-      break;
-    case 0x10407:
-      bufpush(0x1042F);
-      break;
-    case 0x10408:
-      bufpush(0x10430);
-      break;
-    case 0x10409:
-      bufpush(0x10431);
-      break;
-    case 0x1040A:
-      bufpush(0x10432);
-      break;
-    case 0x1040B:
-      bufpush(0x10433);
-      break;
-    case 0x1040C:
-      bufpush(0x10434);
-      break;
-    case 0x1040D:
-      bufpush(0x10435);
-      break;
-    case 0x1040E:
-      bufpush(0x10436);
-      break;
-    case 0x1040F:
-      bufpush(0x10437);
-      break;
-    case 0x10410:
-      bufpush(0x10438);
-      break;
-    case 0x10411:
-      bufpush(0x10439);
-      break;
-    case 0x10412:
-      bufpush(0x1043A);
-      break;
-    case 0x10413:
-      bufpush(0x1043B);
-      break;
-    case 0x10414:
-      bufpush(0x1043C);
-      break;
-    case 0x10415:
-      bufpush(0x1043D);
-      break;
-    case 0x10416:
-      bufpush(0x1043E);
-      break;
-    case 0x10417:
-      bufpush(0x1043F);
-      break;
-    case 0x10418:
-      bufpush(0x10440);
-      break;
-    case 0x10419:
-      bufpush(0x10441);
-      break;
-    case 0x1041A:
-      bufpush(0x10442);
-      break;
-    case 0x1041B:
-      bufpush(0x10443);
-      break;
-    case 0x1041C:
-      bufpush(0x10444);
-      break;
-    case 0x1041D:
-      bufpush(0x10445);
-      break;
-    case 0x1041E:
-      bufpush(0x10446);
-      break;
-    case 0x1041F:
-      bufpush(0x10447);
-      break;
-    case 0x10420:
-      bufpush(0x10448);
-      break;
-    case 0x10421:
-      bufpush(0x10449);
-      break;
-    case 0x10422:
-      bufpush(0x1044A);
-      break;
-    case 0x10423:
-      bufpush(0x1044B);
-      break;
-    case 0x10424:
-      bufpush(0x1044C);
-      break;
-    case 0x10425:
-      bufpush(0x1044D);
-      break;
-  }
diff --git a/src/chunk.h b/src/chunk.h
@@ -0,0 +1,92 @@
+#ifndef _CHUNK_H_
+#define _CHUNK_H_
+
+#include <string.h>
+#include <ctype.h>
+#include <stdlib.h>
+#include <assert.h>
+#include "buffer.h"
+
+typedef struct {
+	const unsigned char *data;
+	int len;
+	int alloc;
+} chunk;
+
+static inline void chunk_free(chunk *c)
+{
+	if (c->alloc)
+		free((char *)c->data);
+
+	c->data = NULL;
+	c->alloc = 0;
+	c->len = 0;
+}
+
+static inline void chunk_ltrim(chunk *c)
+{
+	assert(!c->alloc);
+
+	while (c->len && isspace(c->data[0])) {
+		c->data++;
+		c->len--;
+	}
+}
+
+static inline void chunk_rtrim(chunk *c)
+{
+	while (c->len > 0) {
+		if (!isspace(c->data[c->len - 1]))
+			break;
+
+		c->len--;
+	}
+}
+
+static inline void chunk_trim(chunk *c)
+{
+	chunk_ltrim(c);
+	chunk_rtrim(c);
+}
+
+static inline int chunk_strchr(chunk *ch, int c, int offset)
+{
+	const unsigned char *p = memchr(ch->data + offset, c, ch->len - offset);
+	return p ? (int)(p - ch->data) : ch->len;
+}
+
+static inline unsigned char *chunk_to_cstr(chunk *c)
+{
+	unsigned char *str;
+
+	str = malloc(c->len + 1);
+	memcpy(str, c->data, c->len);
+	str[c->len] = 0;
+
+	return str;
+}
+
+static inline chunk chunk_literal(const char *data)
+{
+	chunk c = {(const unsigned char *)data, data ? strlen(data) : 0, 0};
+	return c;
+}
+
+static inline chunk chunk_dup(const chunk *ch, int pos, int len)
+{
+	chunk c = {ch->data + pos, len, 0};
+	return c;
+}
+
+static inline chunk chunk_buf_detach(strbuf *buf)
+{
+	chunk c;
+
+	c.len = buf->size;
+	c.data = strbuf_detach(buf);
+	c.alloc = 1;
+
+	return c;
+}
+
+#endif
diff --git a/src/detab.c b/src/detab.c
@@ -1,48 +0,0 @@
-#include "bstrlib.h"
-
-// UTF-8 aware detab:  assumes s has no newlines, or only a final newline.
-// Return 0 on success, BSTR_ERR if invalid UTF-8.
-extern int bdetab(bstring s, int utf8)
-{
-  unsigned char c;
-  int pos = 0;  // a count of characters
-  int byte = 0; // a count of bytes
-  int high_chars_to_skip = 0;
-  int numspaces = 0;
-  while ((c = bchar(s, byte))) {
-    if (utf8 && high_chars_to_skip > 0) {
-      if (c >= 0x80) {
-        high_chars_to_skip--;
-        byte++;
-      } else {
-        return BSTR_ERR; // invalid utf-8
-      }
-    } else if (c == '\t') {
-      bdelete(s, byte, 1); // delete tab character
-      numspaces = 4 - (pos % 4);
-      binsertch(s, byte, numspaces, ' ');
-      byte += numspaces;
-      pos  += numspaces;
-    } else if (c <= 0x80 || !utf8) {
-      byte++;
-      pos++;
-    } else {  // multibyte utf8 sequences
-      if (c >> 1 == 0176) {
-        high_chars_to_skip = 5;
-      } else if (c >> 2 == 076) {
-        high_chars_to_skip = 4;
-      } else if (c >> 3 == 036) {
-        high_chars_to_skip = 3;
-      } else if (c >> 4 == 016) {
-        high_chars_to_skip = 2;
-      } else if (c >> 5 == 06) {
-        high_chars_to_skip = 1;
-      } else {
-        return BSTR_ERR; // invalid utf-8
-      }
-      pos++;
-      byte++;
-    }
-  }
-  return 0;
-}
diff --git a/src/getopt.c b/src/getopt.c
@@ -1,199 +0,0 @@
-/* $Id: getopt.c 4022 2008-03-31 06:11:07Z rra $
- *
- * Replacement implementation of getopt.
- *
- * This is a replacement implementation for getopt based on the my_getopt
- * distribution by Benjamin Sittler.  Only the getopt interface is included,
- * since remctl doesn't use GNU long options, and the code has been rearranged
- * and reworked somewhat to fit with the remctl coding style.
- *
- * Copyright 1997, 2000, 2001, 2002 Benjamin Sittler
- * Copyright 2008 Russ Allbery <rra@stanford.edu>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *  
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *  
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- */
-
-#include <config.h>
-#include <portable/system.h>
-#include <portable/getopt.h>
-
-/*
- * If we're running the test suite, rename getopt and the global variables to
- * avoid conflicts with the system version.
- */
-#if TESTING
-# define getopt test_getopt
-int test_getopt(int, char **, const char *);
-# define optind test_optind
-# define opterr test_opterr
-# define optopt test_optopt
-# define optarg test_optarg
-#endif
-
-/* Initialize global interface variables. */
-int optind = 1;
-int opterr = 1;
-int optopt = 0;
-char *optarg = NULL;
-
-/*
- * This is the plain old UNIX getopt, with GNU-style extensions.  If you're
- * porting some piece of UNIX software, this is all you need.  It supports
- * GNU-style permutation and optional arguments, but does not support the GNU
- * -W extension.
- *
- * This function is not re-entrant or thread-safe, has static variables, and
- * generally isn't a great interface, but normally you only call it once.
- */
-int
-getopt(int argc, char *argv[], const char *optstring)
-{
-    const char *p;
-    size_t offset = 0;
-    char mode = '\0';
-    int colon_mode = 0;
-    int option = -1;
-
-    /* Holds the current position in the parameter being parsed. */
-    static int charind = 0;
-
-    /*
-     * By default, getopt permutes argv as it scans and leaves all non-options
-     * at the end.  This can be changed with the first character of optstring
-     * or the environment variable POSIXLY_CORRECT.  With a first character of
-     * '+' or when POSIXLY_CORRECT is set, option processing stops at the
-     * first non-option.  If the first character is '-', each non-option argv
-     * element is handled as if it were the argument of an option with
-     * character code 1.  mode holds this character.
-     *
-     * After the optional leading '+' and '-', optstring may contain ':'.  If
-     * present, missing arguments return ':' instead of '?'.  colon_mode holds
-     * this setting.
-     */
-    if (getenv("POSIXLY_CORRECT") != NULL) {
-        mode = '+';
-        colon_mode = '+';
-    } else {
-        if (optstring[offset] == '+' || optstring[offset] == '-') {
-            mode = optstring[offset];
-            offset++;
-        }
-        if (optstring[offset] == ':') {
-            colon_mode = 1;
-            offset++;
-        }
-    }
-
-    /*
-     * charind holds where we left off.  If it's set, we were in the middle
-     * of an argv element; if not, we pick up with the next element of
-     * optind.
-     */
-    optarg = NULL;
-    if (charind == 0) {
-        if (optind >= argc)
-            option = -1;
-        else if (strcmp(argv[optind], "--") == 0) {
-            optind++;
-            option = -1;
-        } else if (argv[optind][0] != '-' || argv[optind][1] == '\0') {
-            char *tmp;
-            int i, j, k, end;
-
-            if (mode == '+')
-                option = -1;
-            else if (mode == '-') {
-                optarg = argv[optind];
-                optind++;
-                option = 1;
-            } else {
-                for (i = optind + 1, j = optind; i < argc; i++)
-                    if ((argv[i][0] == '-') && (argv[i][1] != '\0')) {
-                        optind = i;
-                        option = getopt(argc, argv, optstring);
-                        while (i > j) {
-                            --i;
-                            tmp = argv[i];
-                            end = (charind == 0) ? optind - 1 : optind;
-                            for (k = i; k + 1 <= end; k++) {
-                                argv[k] = argv[k + 1];
-                            }
-                            argv[end] = tmp;
-                            --optind;
-                        }
-                        break;
-                    }
-                if (i == argc)
-                    option = -1;
-            }
-            return option;
-        } else {
-            charind = 1;
-        }
-    }
-    if (charind != 0) {
-        optopt = argv[optind][charind];
-        for (p = optstring + offset; *p != '\0'; p++)
-            if (optopt == *p) {
-                p++;
-                if (*p == ':') {
-                    if (argv[optind][charind + 1] != '\0') {
-                        optarg = &argv[optind][charind + 1];
-                        optind++;
-                        charind = 0;
-                    } else {
-                        p++;
-                        if (*p != ':') {
-                            charind = 0;
-                            optind++;
-                            if (optind >= argc) {
-                                if (opterr)
-                                    fprintf(stderr, "%s: option requires"
-                                            " an argument -- %c\n", argv[0],
-                                            optopt);
-                                option = colon_mode ? ':' : '?';
-                                goto done;
-                            } else {
-                                optarg = argv[optind];
-                                optind++;
-                            }
-                        }
-                    }
-                }
-                option = optopt;
-            }
-        if (option == -1) {
-            if (opterr)
-                fprintf(stderr, "%s: illegal option -- %c\n", argv[0], optopt);
-            option = '?';
-        }
-    }
-
-done:
-    if (charind != 0) {
-        charind++;
-        if (argv[optind][charind] == '\0') {
-            optind++;
-            charind = 0;
-        }
-    }
-    if (optind > argc)
-        optind = argc;
-    return option;
-}
diff --git a/src/html.c b/src/html.c
@@ -1,276 +0,0 @@
-#include <stdlib.h>
-#include <stdio.h>
-#include <stdbool.h>
-#include "bstrlib.h"
-#include "stmd.h"
-#include "debug.h"
-#include "scanners.h"
-
-// Functions to convert block and inline lists to HTML strings.
-
-// Escape special characters in HTML.  More efficient than
-// three calls to bfindreplace.  If preserve_entities is set,
-// existing entities are left alone.
-static bstring escape_html(bstring inp, bool preserve_entities)
-{
-  int pos = 0;
-  int match;
-  char c;
-  bstring escapable = blk2bstr("&<>\"", 4);
-  bstring ent;
-  bstring s = bstrcpy(inp);
-  while ((pos = binchr(s, pos, escapable)) != BSTR_ERR) {
-    c = bchar(s,pos);
-    switch (c) {
-    case '<':
-      bdelete(s, pos, 1);
-      ent = blk2bstr("&lt;", 4);
-      binsert(s, pos, ent, ' ');
-      bdestroy(ent);
-      pos += 4;
-      break;
-    case '>':
-      bdelete(s, pos, 1);
-      ent = blk2bstr("&gt;", 4);
-      binsert(s, pos, ent, ' ');
-      bdestroy(ent);
-      pos += 4;
-      break;
-    case '&':
-      if (preserve_entities && (match = scan_entity(s, pos))) {
-        pos += match;
-      } else {
-        bdelete(s, pos, 1);
-        ent = blk2bstr("&amp;", 5);
-        binsert(s, pos, ent, ' ');
-        bdestroy(ent);
-        pos += 5;
-      }
-      break;
-    case '"':
-      bdelete(s, pos, 1);
-      ent = blk2bstr("&quot;", 6);
-      binsert(s, pos, ent, ' ');
-      bdestroy(ent);
-      pos += 6;
-      break;
-    default:
-      bdelete(s, pos, 1);
-      log_err("unexpected character %02x", c);
-    }
-  }
-  bdestroy(escapable);
-  return s;
-}
-
-static inline void cr(bstring buffer)
-{
-  int c = bchar(buffer, blength(buffer) - 1);
-  if (c != '\n' && c) {
-    bconchar(buffer, '\n');
-  }
-}
-
-// Convert a block list to HTML.  Returns 0 on success, and sets result.
-extern int blocks_to_html(block* b, bstring* result, bool tight)
-{
-  bstring contents = NULL;
-  bstring escaped, escaped2;
-  struct bstrList * info_words;
-  struct ListData * data;
-  bstring mbstart;
-  bstring html = blk2bstr("", 0);
-
-  while(b != NULL) {
-    switch(b->tag) {
-    case document:
-      check(blocks_to_html(b->children, &contents, false) == 0,
-            "error converting blocks to html");
-      bformata(html, "%s", contents->data);
-      bdestroy(contents);
-      break;
-    case paragraph:
-      check(inlines_to_html(b->inline_content, &contents) == 0,
-            "error converting inlines to html");
-      if (tight) {
-        bformata(html, "%s", contents->data);
-      } else {
-        cr(html);
-        bformata(html, "<p>%s</p>", contents->data);
-        cr(html);
-      }
-      bdestroy(contents);
-      break;
-    case block_quote:
-      check(blocks_to_html(b->children, &contents, false) == 0,
-            "error converting blocks to html");
-      cr(html);
-      bformata(html, "<blockquote>\n%s</blockquote>", contents->data);
-      cr(html);
-      bdestroy(contents);
-      break;
-    case list_item:
-      check(blocks_to_html(b->children, &contents, tight) == 0,
-            "error converting blocks to html");
-      brtrimws(contents);
-      cr(html);
-      bformata(html, "<li>%s</li>", contents->data);
-      cr(html);
-      bdestroy(contents);
-      break;
-    case list:
-      // make sure a list starts at the beginning of the line:
-      cr(html);
-      data = &(b->attributes.list_data);
-      check(blocks_to_html(b->children, &contents, data->tight) == 0,
-            "error converting blocks to html");
-      mbstart = bformat(" start=\"%d\"", data->start);
-      bformata(html, "<%s%s>\n%s</%s>",
-               data->list_type == bullet ? "ul" : "ol",
-               data->start == 1 ? "" : (char*) mbstart->data,
-               contents->data,
-               data->list_type == bullet ? "ul" : "ol");
-      cr(html);
-      bdestroy(contents);
-      bdestroy(mbstart);
-      break;
-    case atx_header:
-    case setext_header:
-      check(inlines_to_html(b->inline_content, &contents) == 0,
-            "error converting inlines to html");
-      cr(html);
-      bformata(html, "<h%d>%s</h%d>",
-               b->attributes.header_level,
-               contents->data,
-               b->attributes.header_level);
-      cr(html);
-      bdestroy(contents);
-      break;
-    case indented_code:
-      escaped = escape_html(b->string_content, false);
-      cr(html);
-      bformata(html, "<pre><code>%s</code></pre>", escaped->data);
-      cr(html);
-      bdestroy(escaped);
-      break;
-    case fenced_code:
-      escaped = escape_html(b->string_content, false);
-      cr(html);
-      bformata(html, "<pre><code");
-      if (blength(b->attributes.fenced_code_data.info) > 0) {
-        escaped2 = escape_html(b->attributes.fenced_code_data.info, true);
-        info_words = bsplit(escaped2, ' ');
-        bformata(html, " class=\"language-%s\"", info_words->entry[0]->data);
-        bdestroy(escaped2);
-        bstrListDestroy(info_words);
-      }
-      bformata(html, ">%s</code></pre>", escaped->data);
-      cr(html);
-      bdestroy(escaped);
-      break;
-    case html_block:
-      bformata(html, "%s", b->string_content->data);
-      break;
-    case hrule:
-      bformata(html, "<hr />");
-      cr(html);
-      break;
-    case reference_def:
-      break;
-    default:
-      log_warn("block type %d not implemented\n", b->tag);
-      break;
-    }
-    b = b->next;
-  }
-  *result = html;
-  return 0;
- error:
-  return -1;
-}
-
-// Convert an inline list to HTML.  Returns 0 on success, and sets result.
-extern int inlines_to_html(inl* ils, bstring* result)
-{
-  bstring contents = NULL;
-  bstring html = blk2bstr("", 0);
-  bstring mbtitle, escaped, escaped2;
-
-  while(ils != NULL) {
-    switch(ils->tag) {
-    case str:
-      escaped = escape_html(ils->content.literal, false);
-      bformata(html, "%s", escaped->data);
-      bdestroy(escaped);
-      break;
-    case linebreak:
-      bformata(html, "<br />\n");
-      break;
-    case softbreak:
-      bformata(html, "\n");
-      break;
-    case code:
-      escaped = escape_html(ils->content.literal, false);
-      bformata(html, "<code>%s</code>", escaped->data);
-      bdestroy(escaped);
-      break;
-    case raw_html:
-    case entity:
-      bformata(html, "%s", ils->content.literal->data);
-      break;
-    case link:
-      check(inlines_to_html(ils->content.inlines, &contents) == 0,
-            "error converting inlines to html");
-      if (blength(ils->content.linkable.title) > 0) {
-        escaped = escape_html(ils->content.linkable.title, true);
-        mbtitle = bformat(" title=\"%s\"", escaped->data);
-        bdestroy(escaped);
-      } else {
-        mbtitle = blk2bstr("",0);
-      }
-      escaped = escape_html(ils->content.linkable.url, true);
-      bformata(html, "<a href=\"%s\"%s>%s</a>",
-               escaped->data,
-               mbtitle->data,
-               contents->data);
-      bdestroy(escaped);
-      bdestroy(mbtitle);
-      bdestroy(contents);
-      break;
-    case image:
-      check(inlines_to_html(ils->content.inlines, &contents) == 0,
-            "error converting inlines to html");
-      escaped  = escape_html(ils->content.linkable.url, true);
-      escaped2 = escape_html(contents, false);
-      bdestroy(contents);
-      bformata(html, "<img src=\"%s\" alt=\"%s\"",
-               escaped->data, escaped2->data);
-      bdestroy(escaped);
-      bdestroy(escaped2);
-      if (blength(ils->content.linkable.title) > 0) {
-        escaped = escape_html(ils->content.linkable.title, true);
-        bformata(html, " title=\"%s\"", escaped->data);
-        bdestroy(escaped);
-      }
-      bformata(html, " />");
-      break;
-    case strong:
-      check(inlines_to_html(ils->content.inlines, &contents) == 0,
-            "error converting inlines to html");
-      bformata(html, "<strong>%s</strong>", contents->data);
-      bdestroy(contents);
-      break;
-    case emph:
-      check(inlines_to_html(ils->content.inlines, &contents) == 0,
-            "error converting inlines to html");
-      bformata(html, "<em>%s</em>", contents->data);
-      bdestroy(contents);
-      break;
-    }
-    ils = ils->next;
-  }
-  *result = html;
-  return 0;
- error:
-  return -1;
-}
diff --git a/src/html/houdini.h b/src/html/houdini.h
@@ -0,0 +1,46 @@
+#ifndef __HOUDINI_H__
+#define __HOUDINI_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdint.h>
+#include "buffer.h"
+
+#define likely(x)       __builtin_expect((x),1)
+#define unlikely(x)     __builtin_expect((x),0)
+
+#ifdef HOUDINI_USE_LOCALE
+#	define _isxdigit(c) isxdigit(c)
+#	define _isdigit(c) isdigit(c)
+#else
+/*
+ * Helper _isdigit methods -- do not trust the current locale
+ * */
+#	define _isxdigit(c) (strchr("0123456789ABCDEFabcdef", (c)) != NULL)
+#	define _isdigit(c) ((c) >= '0' && (c) <= '9')
+#endif
+
+#define HOUDINI_ESCAPED_SIZE(x) (((x) * 12) / 10)
+#define HOUDINI_UNESCAPED_SIZE(x) (x)
+
+extern size_t houdini_unescape_ent(strbuf *ob, const uint8_t *src, size_t size);
+extern int houdini_escape_html(strbuf *ob, const uint8_t *src, size_t size);
+extern int houdini_escape_html0(strbuf *ob, const uint8_t *src, size_t size, int secure);
+extern int houdini_unescape_html(strbuf *ob, const uint8_t *src, size_t size);
+extern void houdini_unescape_html_f(strbuf *ob, const uint8_t *src, size_t size);
+extern int houdini_escape_xml(strbuf *ob, const uint8_t *src, size_t size);
+extern int houdini_escape_uri(strbuf *ob, const uint8_t *src, size_t size);
+extern int houdini_escape_url(strbuf *ob, const uint8_t *src, size_t size);
+extern int houdini_escape_href(strbuf *ob, const uint8_t *src, size_t size);
+extern int houdini_unescape_uri(strbuf *ob, const uint8_t *src, size_t size);
+extern int houdini_unescape_url(strbuf *ob, const uint8_t *src, size_t size);
+extern int houdini_escape_js(strbuf *ob, const uint8_t *src, size_t size);
+extern int houdini_unescape_js(strbuf *ob, const uint8_t *src, size_t size);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/src/html/houdini_href_e.c b/src/html/houdini_href_e.c
@@ -0,0 +1,107 @@
+#include <assert.h>
+#include <stdio.h>
+#include <string.h>
+
+#include "html/houdini.h"
+
+/*
+ * The following characters will not be escaped:
+ *
+ *		-_.+!*'(),%#@?=;:/,+&$ alphanum
+ *
+ * Note that this character set is the addition of:
+ *
+ *	- The characters which are safe to be in an URL
+ *	- The characters which are *not* safe to be in
+ *	an URL because they are RESERVED characters.
+ *
+ * We asume (lazily) that any RESERVED char that
+ * appears inside an URL is actually meant to
+ * have its native function (i.e. as an URL
+ * component/separator) and hence needs no escaping.
+ *
+ * There are two exceptions: the chacters & (amp)
+ * and ' (single quote) do not appear in the table.
+ * They are meant to appear in the URL as components,
+ * yet they require special HTML-entity escaping
+ * to generate valid HTML markup.
+ *
+ * All other characters will be escaped to %XX.
+ *
+ */
+static const char HREF_SAFE[] = {
+	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+	0, 1, 0, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1,
+	1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1,
+	1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+	1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1,
+	0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+	1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0,
+	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+};
+
+int
+houdini_escape_href(strbuf *ob, const uint8_t *src, size_t size)
+{
+	static const uint8_t hex_chars[] = "0123456789ABCDEF";
+	size_t  i = 0, org;
+	uint8_t hex_str[3];
+
+	hex_str[0] = '%';
+
+	while (i < size) {
+		org = i;
+		while (i < size && HREF_SAFE[src[i]] != 0)
+			i++;
+
+		if (likely(i > org))
+			strbuf_put(ob, src + org, i - org);
+
+		/* escaping */
+		if (i >= size)
+			break;
+
+		switch (src[i]) {
+		/* amp appears all the time in URLs, but needs
+		 * HTML-entity escaping to be inside an href */
+		case '&':
+			strbuf_puts(ob, "&amp;");
+			break;
+
+		/* the single quote is a valid URL character
+		 * according to the standard; it needs HTML
+		 * entity escaping too */
+		case '\'':
+			strbuf_puts(ob, "&#x27;");
+			break;
+
+		/* the space can be escaped to %20 or a plus
+		 * sign. we're going with the generic escape
+		 * for now. the plus thing is more commonly seen
+		 * when building GET strings */
+#if 0
+		case ' ':
+			strbuf_putc(ob, '+');
+			break;
+#endif
+
+		/* every other character goes with a %XX escaping */
+		default:
+			hex_str[1] = hex_chars[(src[i] >> 4) & 0xF];
+			hex_str[2] = hex_chars[src[i] & 0xF];
+			strbuf_put(ob, hex_str, 3);
+		}
+
+		i++;
+	}
+
+	return 1;
+}
diff --git a/src/html/houdini_html_e.c b/src/html/houdini_html_e.c
@@ -0,0 +1,81 @@
+#include <assert.h>
+#include <stdio.h>
+#include <string.h>
+
+#include "html/houdini.h"
+
+/**
+ * According to the OWASP rules:
+ *
+ * & --> &amp;
+ * < --> &lt;
+ * > --> &gt;
+ * " --> &quot;
+ * ' --> &#x27;     &apos; is not recommended
+ * / --> &#x2F;     forward slash is included as it helps end an HTML entity
+ *
+ */
+static const char HTML_ESCAPE_TABLE[] = {
+	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+	0, 0, 1, 0, 0, 0, 2, 3, 0, 0, 0, 0, 0, 0, 0, 4,
+	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 6, 0,
+	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+};
+
+static const char *HTML_ESCAPES[] = {
+        "",
+        "&quot;",
+        "&amp;",
+        "&#39;",
+        "&#47;",
+        "&lt;",
+        "&gt;"
+};
+
+int
+houdini_escape_html0(strbuf *ob, const uint8_t *src, size_t size, int secure)
+{
+	size_t  i = 0, org, esc = 0;
+
+	while (i < size) {
+		org = i;
+		while (i < size && (esc = HTML_ESCAPE_TABLE[src[i]]) == 0)
+			i++;
+
+		if (i > org)
+			strbuf_put(ob, src + org, i - org);
+
+		/* escaping */
+		if (unlikely(i >= size))
+			break;
+
+		/* The forward slash is only escaped in secure mode */
+		if ((src[i] == '/' || src[i] == '\'') && !secure) {
+			strbuf_putc(ob, src[i]);
+		} else {
+			strbuf_puts(ob, HTML_ESCAPES[esc]);
+		}
+
+		i++;
+	}
+
+	return 1;
+}
+
+int
+houdini_escape_html(strbuf *ob, const uint8_t *src, size_t size)
+{
+	return houdini_escape_html0(ob, src, size, 1);
+}
diff --git a/src/html/houdini_html_u.c b/src/html/houdini_html_u.c
@@ -0,0 +1,111 @@
+#include <assert.h>
+#include <stdio.h>
+#include <string.h>
+
+#include "houdini.h"
+#include "utf8.h"
+#include "html_unescape.h"
+
+size_t
+houdini_unescape_ent(strbuf *ob, const uint8_t *src, size_t size)
+{
+	size_t i = 0;
+
+	if (size > 3 && src[0] == '#') {
+		int codepoint = 0;
+
+		if (_isdigit(src[1])) {
+			for (i = 1; i < size && _isdigit(src[i]); ++i) {
+				int cp = (codepoint * 10) + (src[i] - '0');
+
+				if (cp < codepoint)
+					return 0;
+
+				codepoint = cp;
+			}
+		}
+
+		else if (src[1] == 'x' || src[1] == 'X') {
+			for (i = 2; i < size && _isxdigit(src[i]); ++i) {
+				int cp = (codepoint * 16) + ((src[i] | 32) % 39 - 9);
+
+				if (cp < codepoint)
+					return 0;
+
+				codepoint = cp;
+			}
+		}
+
+		if (i < size && src[i] == ';' && codepoint) {
+			utf8proc_encode_char(codepoint, ob);
+			return i + 1;
+		}
+	}
+
+	else {
+		if (size > MAX_WORD_LENGTH)
+			size = MAX_WORD_LENGTH;
+
+		for (i = MIN_WORD_LENGTH; i < size; ++i) {
+			if (src[i] == ' ')
+				break;
+
+			if (src[i] == ';') {
+				const struct html_ent *entity = find_entity((char *)src, i);
+
+				if (entity != NULL) {
+					strbuf_put(ob, entity->utf8, entity->utf8_len);
+					return i + 1;
+				}
+
+				break;
+			}
+		}
+	}
+
+	return 0;
+}
+
+int
+houdini_unescape_html(strbuf *ob, const uint8_t *src, size_t size)
+{
+	size_t  i = 0, org, ent;
+
+	while (i < size) {
+		org = i;
+		while (i < size && src[i] != '&')
+			i++;
+
+		if (likely(i > org)) {
+			if (unlikely(org == 0)) {
+				if (i >= size)
+					return 0;
+
+				strbuf_grow(ob, HOUDINI_UNESCAPED_SIZE(size));
+			}
+
+			strbuf_put(ob, src + org, i - org);
+		}
+
+		/* escaping */
+		if (i >= size)
+			break;
+
+		i++;
+
+		ent = houdini_unescape_ent(ob, src + i, size - i);
+		i += ent;
+
+		/* not really an entity */
+		if (ent == 0)
+			strbuf_putc(ob, '&');
+	}
+
+	return 1;
+}
+
+void houdini_unescape_html_f(strbuf *ob, const uint8_t *src, size_t size)
+{
+	if (!houdini_unescape_html(ob, src, size))
+		strbuf_put(ob, src, size);
+}
diff --git a/src/html/html.c b/src/html/html.c
@@ -0,0 +1,228 @@
+#include <stdlib.h>
+#include <stdio.h>
+#include <stdbool.h>
+#include <string.h>
+#include <assert.h>
+
+#include "stmd.h"
+#include "debug.h"
+#include "html/houdini.h"
+
+// Functions to convert node_block and inline lists to HTML strings.
+
+static void escape_html(strbuf *dest, const unsigned char *source, int length)
+{
+	if (length < 0)
+		length = strlen((char *)source);
+
+	houdini_escape_html0(dest, source, (size_t)length, 0);
+}
+
+static void escape_href(strbuf *dest, const unsigned char *source, int length)
+{
+	if (length < 0)
+		length = strlen((char *)source);
+
+	houdini_escape_href(dest, source, (size_t)length);
+}
+
+static inline void cr(strbuf *html)
+{
+	if (html->size && html->ptr[html->size - 1] != '\n')
+		strbuf_putc(html, '\n');
+}
+
+// Convert an inline list to HTML.  Returns 0 on success, and sets result.
+static void inlines_to_html(strbuf *html, node_inl* ils)
+{
+	strbuf scrap = GH_BUF_INIT;
+
+	while(ils != NULL) {
+		switch(ils->tag) {
+			case INL_STRING:
+				escape_html(html, ils->content.literal.data, ils->content.literal.len);
+				break;
+
+			case INL_LINEBREAK:
+				strbuf_puts(html, "<br />\n");
+				break;
+
+			case INL_SOFTBREAK:
+				strbuf_putc(html, '\n');
+				break;
+
+			case INL_CODE:
+				strbuf_puts(html, "<code>");
+				escape_html(html, ils->content.literal.data, ils->content.literal.len);
+				strbuf_puts(html, "</code>");
+				break;
+
+			case INL_RAW_HTML:
+				strbuf_put(html,
+						ils->content.literal.data,
+						ils->content.literal.len);
+				break;
+
+			case INL_LINK:
+				strbuf_puts(html, "<a href=\"");
+				if (ils->content.linkable.url)
+					escape_href(html, ils->content.linkable.url, -1);
+
+				if (ils->content.linkable.title) {
+					strbuf_puts(html, "\" title=\"");
+					escape_html(html, ils->content.linkable.title, -1);
+				}
+
+				strbuf_puts(html, "\">");
+				inlines_to_html(html, ils->content.inlines);
+				strbuf_puts(html, "</a>");
+				break;
+
+			case INL_IMAGE:
+				strbuf_puts(html, "<img src=\"");
+				if (ils->content.linkable.url)
+					escape_href(html, ils->content.linkable.url, -1);
+
+				inlines_to_html(&scrap, ils->content.inlines);
+				strbuf_puts(html, "\" alt=\"");
+				if (scrap.size)
+					escape_html(html, scrap.ptr, scrap.size);
+				strbuf_clear(&scrap);
+
+				if (ils->content.linkable.title) {
+					strbuf_puts(html, "\" title=\"");
+					escape_html(html, ils->content.linkable.title, -1);
+				}
+
+				strbuf_puts(html, "\"/>");
+				break;
+
+			case INL_STRONG:
+				strbuf_puts(html, "<strong>");
+				inlines_to_html(html, ils->content.inlines);
+				strbuf_puts(html, "</strong>");
+				break;
+
+			case INL_EMPH:
+				strbuf_puts(html, "<em>");
+				inlines_to_html(html, ils->content.inlines);
+				strbuf_puts(html, "</em>");
+				break;
+		}
+		ils = ils->next;
+	}
+
+	strbuf_free(&scrap);
+}
+
+// Convert a node_block list to HTML.  Returns 0 on success, and sets result.
+static void blocks_to_html(strbuf *html, node_block *b, bool tight)
+{
+	struct ListData *data;
+
+	while(b != NULL) {
+		switch(b->tag) {
+			case BLOCK_DOCUMENT:
+				blocks_to_html(html, b->children, false);
+				break;
+
+			case BLOCK_PARAGRAPH:
+				if (tight) {
+					inlines_to_html(html, b->inline_content);
+				} else {
+					cr(html);
+					strbuf_puts(html, "<p>");
+					inlines_to_html(html, b->inline_content);
+					strbuf_puts(html, "</p>\n");
+				}
+				break;
+
+			case BLOCK_BQUOTE:
+				cr(html);
+				strbuf_puts(html, "<blockquote>\n");
+				blocks_to_html(html, b->children, false);
+				strbuf_puts(html, "</blockquote>\n");
+				break;
+
+			case BLOCK_LIST_ITEM:
+				cr(html);
+				strbuf_puts(html, "<li>");
+				blocks_to_html(html, b->children, tight);
+				strbuf_trim(html); /* TODO: rtrim */
+				strbuf_puts(html, "</li>\n");
+				break;
+
+			case BLOCK_LIST:
+				// make sure a list starts at the beginning of the line:
+				cr(html);
+				data = &(b->as.list);
+
+				if (data->start > 1) {
+					strbuf_printf(html, "<%s start=\"%d\">\n",
+							data->list_type == bullet ? "ul" : "ol",
+							data->start);
+				} else {
+					strbuf_puts(html, data->list_type == bullet ? "<ul>\n" : "<ol>\n");
+				}
+
+				blocks_to_html(html, b->children, data->tight);
+				strbuf_puts(html, data->list_type == bullet ? "</ul>" : "</ol>");
+				strbuf_putc(html, '\n');
+				break;
+
+			case BLOCK_ATX_HEADER:
+			case BLOCK_SETEXT_HEADER:
+				cr(html);
+				strbuf_printf(html, "<h%d>", b->as.header.level);
+				inlines_to_html(html, b->inline_content);
+				strbuf_printf(html, "</h%d>\n", b->as.header.level);
+				break;
+
+			case BLOCK_INDENTED_CODE:
+			case BLOCK_FENCED_CODE:
+				cr(html);
+
+				strbuf_puts(html, "<pre><code");
+
+				if (b->tag == BLOCK_FENCED_CODE) {
+					strbuf *info = &b->as.code.info;
+
+					if (strbuf_len(info) > 0) {
+						int first_tag = strbuf_strchr(info, ' ', 0);
+						if (first_tag < 0)
+							first_tag = strbuf_len(info);
+
+						strbuf_puts(html, " class=\"language-");
+						escape_html(html, info->ptr, first_tag);
+						strbuf_putc(html, '"');
+					}
+				}
+
+				strbuf_putc(html, '>');
+				escape_html(html, b->string_content.ptr, b->string_content.size);
+				strbuf_puts(html, "</code></pre>\n");
+				break;
+
+			case BLOCK_HTML:
+				strbuf_put(html, b->string_content.ptr, b->string_content.size);
+				break;
+
+			case BLOCK_HRULE:
+				strbuf_puts(html, "<hr />\n");
+				break;
+
+			case BLOCK_REFERENCE_DEF:
+				break;
+
+			default:
+				assert(false);
+		}
+
+		b = b->next;
+	}
+}
+
+void stmd_render_html(strbuf *html, node_block *root)
+{
+	blocks_to_html(html, root, false);
+}
diff --git a/src/html/html_unescape.gperf b/src/html/html_unescape.gperf
@@ -0,0 +1,2131 @@
+struct html_ent {
+	const char *entity;
+	unsigned int utf8_len;
+	unsigned char utf8[4];
+};
+%%
+"Aacute", 2, {195, 129}
+"aacute", 2, {195, 161}
+"Abreve", 2, {196, 130}
+"abreve", 2, {196, 131}
+"ac", 3, {226, 136, 190}
+"acd", 3, {226, 136, 191}
+"acE", 3, {226, 136, 190}
+"Acirc", 2, {195, 130}
+"acirc", 2, {195, 162}
+"acute", 2, {194, 180}
+"Acy", 2, {208, 144}
+"acy", 2, {208, 176}
+"AElig", 2, {195, 134}
+"aelig", 2, {195, 166}
+"af", 3, {226, 129, 161}
+"Afr", 4, {240, 157, 148, 132}
+"afr", 4, {240, 157, 148, 158}
+"Agrave", 2, {195, 128}
+"agrave", 2, {195, 160}
+"alefsym", 3, {226, 132, 181}
+"aleph", 3, {226, 132, 181}
+"Alpha", 2, {206, 145}
+"alpha", 2, {206, 177}
+"Amacr", 2, {196, 128}
+"amacr", 2, {196, 129}
+"amalg", 3, {226, 168, 191}
+"amp", 1, {38}
+"AMP", 1, {38}
+"andand", 3, {226, 169, 149}
+"And", 3, {226, 169, 147}
+"and", 3, {226, 136, 167}
+"andd", 3, {226, 169, 156}
+"andslope", 3, {226, 169, 152}
+"andv", 3, {226, 169, 154}
+"ang", 3, {226, 136, 160}
+"ange", 3, {226, 166, 164}
+"angle", 3, {226, 136, 160}
+"angmsdaa", 3, {226, 166, 168}
+"angmsdab", 3, {226, 166, 169}
+"angmsdac", 3, {226, 166, 170}
+"angmsdad", 3, {226, 166, 171}
+"angmsdae", 3, {226, 166, 172}
+"angmsdaf", 3, {226, 166, 173}
+"angmsdag", 3, {226, 166, 174}
+"angmsdah", 3, {226, 166, 175}
+"angmsd", 3, {226, 136, 161}
+"angrt", 3, {226, 136, 159}
+"angrtvb", 3, {226, 138, 190}
+"angrtvbd", 3, {226, 166, 157}
+"angsph", 3, {226, 136, 162}
+"angst", 2, {195, 133}
+"angzarr", 3, {226, 141, 188}
+"Aogon", 2, {196, 132}
+"aogon", 2, {196, 133}
+"Aopf", 4, {240, 157, 148, 184}
+"aopf", 4, {240, 157, 149, 146}
+"apacir", 3, {226, 169, 175}
+"ap", 3, {226, 137, 136}
+"apE", 3, {226, 169, 176}
+"ape", 3, {226, 137, 138}
+"apid", 3, {226, 137, 139}
+"apos", 1, {39}
+"ApplyFunction", 3, {226, 129, 161}
+"approx", 3, {226, 137, 136}
+"approxeq", 3, {226, 137, 138}
+"Aring", 2, {195, 133}
+"aring", 2, {195, 165}
+"Ascr", 4, {240, 157, 146, 156}
+"ascr", 4, {240, 157, 146, 182}
+"Assign", 3, {226, 137, 148}
+"ast", 1, {42}
+"asymp", 3, {226, 137, 136}
+"asympeq", 3, {226, 137, 141}
+"Atilde", 2, {195, 131}
+"atilde", 2, {195, 163}
+"Auml", 2, {195, 132}
+"auml", 2, {195, 164}
+"awconint", 3, {226, 136, 179}
+"awint", 3, {226, 168, 145}
+"backcong", 3, {226, 137, 140}
+"backepsilon", 2, {207, 182}
+"backprime", 3, {226, 128, 181}
+"backsim", 3, {226, 136, 189}
+"backsimeq", 3, {226, 139, 141}
+"Backslash", 3, {226, 136, 150}
+"Barv", 3, {226, 171, 167}
+"barvee", 3, {226, 138, 189}
+"barwed", 3, {226, 140, 133}
+"Barwed", 3, {226, 140, 134}
+"barwedge", 3, {226, 140, 133}
+"bbrk", 3, {226, 142, 181}
+"bbrktbrk", 3, {226, 142, 182}
+"bcong", 3, {226, 137, 140}
+"Bcy", 2, {208, 145}
+"bcy", 2, {208, 177}
+"bdquo", 3, {226, 128, 158}
+"becaus", 3, {226, 136, 181}
+"because", 3, {226, 136, 181}
+"Because", 3, {226, 136, 181}
+"bemptyv", 3, {226, 166, 176}
+"bepsi", 2, {207, 182}
+"bernou", 3, {226, 132, 172}
+"Bernoullis", 3, {226, 132, 172}
+"Beta", 2, {206, 146}
+"beta", 2, {206, 178}
+"beth", 3, {226, 132, 182}
+"between", 3, {226, 137, 172}
+"Bfr", 4, {240, 157, 148, 133}
+"bfr", 4, {240, 157, 148, 159}
+"bigcap", 3, {226, 139, 130}
+"bigcirc", 3, {226, 151, 175}
+"bigcup", 3, {226, 139, 131}
+"bigodot", 3, {226, 168, 128}
+"bigoplus", 3, {226, 168, 129}
+"bigotimes", 3, {226, 168, 130}
+"bigsqcup", 3, {226, 168, 134}
+"bigstar", 3, {226, 152, 133}
+"bigtriangledown", 3, {226, 150, 189}
+"bigtriangleup", 3, {226, 150, 179}
+"biguplus", 3, {226, 168, 132}
+"bigvee", 3, {226, 139, 129}
+"bigwedge", 3, {226, 139, 128}
+"bkarow", 3, {226, 164, 141}
+"blacklozenge", 3, {226, 167, 171}
+"blacksquare", 3, {226, 150, 170}
+"blacktriangle", 3, {226, 150, 180}
+"blacktriangledown", 3, {226, 150, 190}
+"blacktriangleleft", 3, {226, 151, 130}
+"blacktriangleright", 3, {226, 150, 184}
+"blank", 3, {226, 144, 163}
+"blk12", 3, {226, 150, 146}
+"blk14", 3, {226, 150, 145}
+"blk34", 3, {226, 150, 147}
+"block", 3, {226, 150, 136}
+"bne", 1, {61}
+"bnequiv", 3, {226, 137, 161}
+"bNot", 3, {226, 171, 173}
+"bnot", 3, {226, 140, 144}
+"Bopf", 4, {240, 157, 148, 185}
+"bopf", 4, {240, 157, 149, 147}
+"bot", 3, {226, 138, 165}
+"bottom", 3, {226, 138, 165}
+"bowtie", 3, {226, 139, 136}
+"boxbox", 3, {226, 167, 137}
+"boxdl", 3, {226, 148, 144}
+"boxdL", 3, {226, 149, 149}
+"boxDl", 3, {226, 149, 150}
+"boxDL", 3, {226, 149, 151}
+"boxdr", 3, {226, 148, 140}
+"boxdR", 3, {226, 149, 146}
+"boxDr", 3, {226, 149, 147}
+"boxDR", 3, {226, 149, 148}
+"boxh", 3, {226, 148, 128}
+"boxH", 3, {226, 149, 144}
+"boxhd", 3, {226, 148, 172}
+"boxHd", 3, {226, 149, 164}
+"boxhD", 3, {226, 149, 165}
+"boxHD", 3, {226, 149, 166}
+"boxhu", 3, {226, 148, 180}
+"boxHu", 3, {226, 149, 167}
+"boxhU", 3, {226, 149, 168}
+"boxHU", 3, {226, 149, 169}
+"boxminus", 3, {226, 138, 159}
+"boxplus", 3, {226, 138, 158}
+"boxtimes", 3, {226, 138, 160}
+"boxul", 3, {226, 148, 152}
+"boxuL", 3, {226, 149, 155}
+"boxUl", 3, {226, 149, 156}
+"boxUL", 3, {226, 149, 157}
+"boxur", 3, {226, 148, 148}
+"boxuR", 3, {226, 149, 152}
+"boxUr", 3, {226, 149, 153}
+"boxUR", 3, {226, 149, 154}
+"boxv", 3, {226, 148, 130}
+"boxV", 3, {226, 149, 145}
+"boxvh", 3, {226, 148, 188}
+"boxvH", 3, {226, 149, 170}
+"boxVh", 3, {226, 149, 171}
+"boxVH", 3, {226, 149, 172}
+"boxvl", 3, {226, 148, 164}
+"boxvL", 3, {226, 149, 161}
+"boxVl", 3, {226, 149, 162}
+"boxVL", 3, {226, 149, 163}
+"boxvr", 3, {226, 148, 156}
+"boxvR", 3, {226, 149, 158}
+"boxVr", 3, {226, 149, 159}
+"boxVR", 3, {226, 149, 160}
+"bprime", 3, {226, 128, 181}
+"breve", 2, {203, 152}
+"Breve", 2, {203, 152}
+"brvbar", 2, {194, 166}
+"bscr", 4, {240, 157, 146, 183}
+"Bscr", 3, {226, 132, 172}
+"bsemi", 3, {226, 129, 143}
+"bsim", 3, {226, 136, 189}
+"bsime", 3, {226, 139, 141}
+"bsolb", 3, {226, 167, 133}
+"bsol", 1, {92}
+"bsolhsub", 3, {226, 159, 136}
+"bull", 3, {226, 128, 162}
+"bullet", 3, {226, 128, 162}
+"bump", 3, {226, 137, 142}
+"bumpE", 3, {226, 170, 174}
+"bumpe", 3, {226, 137, 143}
+"Bumpeq", 3, {226, 137, 142}
+"bumpeq", 3, {226, 137, 143}
+"Cacute", 2, {196, 134}
+"cacute", 2, {196, 135}
+"capand", 3, {226, 169, 132}
+"capbrcup", 3, {226, 169, 137}
+"capcap", 3, {226, 169, 139}
+"cap", 3, {226, 136, 169}
+"Cap", 3, {226, 139, 146}
+"capcup", 3, {226, 169, 135}
+"capdot", 3, {226, 169, 128}
+"CapitalDifferentialD", 3, {226, 133, 133}
+"caps", 3, {226, 136, 169}
+"caret", 3, {226, 129, 129}
+"caron", 2, {203, 135}
+"Cayleys", 3, {226, 132, 173}
+"ccaps", 3, {226, 169, 141}
+"Ccaron", 2, {196, 140}
+"ccaron", 2, {196, 141}
+"Ccedil", 2, {195, 135}
+"ccedil", 2, {195, 167}
+"Ccirc", 2, {196, 136}
+"ccirc", 2, {196, 137}
+"Cconint", 3, {226, 136, 176}
+"ccups", 3, {226, 169, 140}
+"ccupssm", 3, {226, 169, 144}
+"Cdot", 2, {196, 138}
+"cdot", 2, {196, 139}
+"cedil", 2, {194, 184}
+"Cedilla", 2, {194, 184}
+"cemptyv", 3, {226, 166, 178}
+"cent", 2, {194, 162}
+"centerdot", 2, {194, 183}
+"CenterDot", 2, {194, 183}
+"cfr", 4, {240, 157, 148, 160}
+"Cfr", 3, {226, 132, 173}
+"CHcy", 2, {208, 167}
+"chcy", 2, {209, 135}
+"check", 3, {226, 156, 147}
+"checkmark", 3, {226, 156, 147}
+"Chi", 2, {206, 167}
+"chi", 2, {207, 135}
+"circ", 2, {203, 134}
+"circeq", 3, {226, 137, 151}
+"circlearrowleft", 3, {226, 134, 186}
+"circlearrowright", 3, {226, 134, 187}
+"circledast", 3, {226, 138, 155}
+"circledcirc", 3, {226, 138, 154}
+"circleddash", 3, {226, 138, 157}
+"CircleDot", 3, {226, 138, 153}
+"circledR", 2, {194, 174}
+"circledS", 3, {226, 147, 136}
+"CircleMinus", 3, {226, 138, 150}
+"CirclePlus", 3, {226, 138, 149}
+"CircleTimes", 3, {226, 138, 151}
+"cir", 3, {226, 151, 139}
+"cirE", 3, {226, 167, 131}
+"cire", 3, {226, 137, 151}
+"cirfnint", 3, {226, 168, 144}
+"cirmid", 3, {226, 171, 175}
+"cirscir", 3, {226, 167, 130}
+"ClockwiseContourIntegral", 3, {226, 136, 178}
+"CloseCurlyDoubleQuote", 3, {226, 128, 157}
+"CloseCurlyQuote", 3, {226, 128, 153}
+"clubs", 3, {226, 153, 163}
+"clubsuit", 3, {226, 153, 163}
+"colon", 1, {58}
+"Colon", 3, {226, 136, 183}
+"Colone", 3, {226, 169, 180}
+"colone", 3, {226, 137, 148}
+"coloneq", 3, {226, 137, 148}
+"comma", 1, {44}
+"commat", 1, {64}
+"comp", 3, {226, 136, 129}
+"compfn", 3, {226, 136, 152}
+"complement", 3, {226, 136, 129}
+"complexes", 3, {226, 132, 130}
+"cong", 3, {226, 137, 133}
+"congdot", 3, {226, 169, 173}
+"Congruent", 3, {226, 137, 161}
+"conint", 3, {226, 136, 174}
+"Conint", 3, {226, 136, 175}
+"ContourIntegral", 3, {226, 136, 174}
+"copf", 4, {240, 157, 149, 148}
+"Copf", 3, {226, 132, 130}
+"coprod", 3, {226, 136, 144}
+"Coproduct", 3, {226, 136, 144}
+"copy", 2, {194, 169}
+"COPY", 2, {194, 169}
+"copysr", 3, {226, 132, 151}
+"CounterClockwiseContourIntegral", 3, {226, 136, 179}
+"crarr", 3, {226, 134, 181}
+"cross", 3, {226, 156, 151}
+"Cross", 3, {226, 168, 175}
+"Cscr", 4, {240, 157, 146, 158}
+"cscr", 4, {240, 157, 146, 184}
+"csub", 3, {226, 171, 143}
+"csube", 3, {226, 171, 145}
+"csup", 3, {226, 171, 144}
+"csupe", 3, {226, 171, 146}
+"ctdot", 3, {226, 139, 175}
+"cudarrl", 3, {226, 164, 184}
+"cudarrr", 3, {226, 164, 181}
+"cuepr", 3, {226, 139, 158}
+"cuesc", 3, {226, 139, 159}
+"cularr", 3, {226, 134, 182}
+"cularrp", 3, {226, 164, 189}
+"cupbrcap", 3, {226, 169, 136}
+"cupcap", 3, {226, 169, 134}
+"CupCap", 3, {226, 137, 141}
+"cup", 3, {226, 136, 170}
+"Cup", 3, {226, 139, 147}
+"cupcup", 3, {226, 169, 138}
+"cupdot", 3, {226, 138, 141}
+"cupor", 3, {226, 169, 133}
+"cups", 3, {226, 136, 170}
+"curarr", 3, {226, 134, 183}
+"curarrm", 3, {226, 164, 188}
+"curlyeqprec", 3, {226, 139, 158}
+"curlyeqsucc", 3, {226, 139, 159}
+"curlyvee", 3, {226, 139, 142}
+"curlywedge", 3, {226, 139, 143}
+"curren", 2, {194, 164}
+"curvearrowleft", 3, {226, 134, 182}
+"curvearrowright", 3, {226, 134, 183}
+"cuvee", 3, {226, 139, 142}
+"cuwed", 3, {226, 139, 143}
+"cwconint", 3, {226, 136, 178}
+"cwint", 3, {226, 136, 177}
+"cylcty", 3, {226, 140, 173}
+"dagger", 3, {226, 128, 160}
+"Dagger", 3, {226, 128, 161}
+"daleth", 3, {226, 132, 184}
+"darr", 3, {226, 134, 147}
+"Darr", 3, {226, 134, 161}
+"dArr", 3, {226, 135, 147}
+"dash", 3, {226, 128, 144}
+"Dashv", 3, {226, 171, 164}
+"dashv", 3, {226, 138, 163}
+"dbkarow", 3, {226, 164, 143}
+"dblac", 2, {203, 157}
+"Dcaron", 2, {196, 142}
+"dcaron", 2, {196, 143}
+"Dcy", 2, {208, 148}
+"dcy", 2, {208, 180}
+"ddagger", 3, {226, 128, 161}
+"ddarr", 3, {226, 135, 138}
+"DD", 3, {226, 133, 133}
+"dd", 3, {226, 133, 134}
+"DDotrahd", 3, {226, 164, 145}
+"ddotseq", 3, {226, 169, 183}
+"deg", 2, {194, 176}
+"Del", 3, {226, 136, 135}
+"Delta", 2, {206, 148}
+"delta", 2, {206, 180}
+"demptyv", 3, {226, 166, 177}
+"dfisht", 3, {226, 165, 191}
+"Dfr", 4, {240, 157, 148, 135}
+"dfr", 4, {240, 157, 148, 161}
+"dHar", 3, {226, 165, 165}
+"dharl", 3, {226, 135, 131}
+"dharr", 3, {226, 135, 130}
+"DiacriticalAcute", 2, {194, 180}
+"DiacriticalDot", 2, {203, 153}
+"DiacriticalDoubleAcute", 2, {203, 157}
+"DiacriticalGrave", 1, {96}
+"DiacriticalTilde", 2, {203, 156}
+"diam", 3, {226, 139, 132}
+"diamond", 3, {226, 139, 132}
+"Diamond", 3, {226, 139, 132}
+"diamondsuit", 3, {226, 153, 166}
+"diams", 3, {226, 153, 166}
+"die", 2, {194, 168}
+"DifferentialD", 3, {226, 133, 134}
+"digamma", 2, {207, 157}
+"disin", 3, {226, 139, 178}
+"div", 2, {195, 183}
+"divide", 2, {195, 183}
+"divideontimes", 3, {226, 139, 135}
+"divonx", 3, {226, 139, 135}
+"DJcy", 2, {208, 130}
+"djcy", 2, {209, 146}
+"dlcorn", 3, {226, 140, 158}
+"dlcrop", 3, {226, 140, 141}
+"dollar", 1, {36}
+"Dopf", 4, {240, 157, 148, 187}
+"dopf", 4, {240, 157, 149, 149}
+"Dot", 2, {194, 168}
+"dot", 2, {203, 153}
+"DotDot", 3, {226, 131, 156}
+"doteq", 3, {226, 137, 144}
+"doteqdot", 3, {226, 137, 145}
+"DotEqual", 3, {226, 137, 144}
+"dotminus", 3, {226, 136, 184}
+"dotplus", 3, {226, 136, 148}
+"dotsquare", 3, {226, 138, 161}
+"doublebarwedge", 3, {226, 140, 134}
+"DoubleContourIntegral", 3, {226, 136, 175}
+"DoubleDot", 2, {194, 168}
+"DoubleDownArrow", 3, {226, 135, 147}
+"DoubleLeftArrow", 3, {226, 135, 144}
+"DoubleLeftRightArrow", 3, {226, 135, 148}
+"DoubleLeftTee", 3, {226, 171, 164}
+"DoubleLongLeftArrow", 3, {226, 159, 184}
+"DoubleLongLeftRightArrow", 3, {226, 159, 186}
+"DoubleLongRightArrow", 3, {226, 159, 185}
+"DoubleRightArrow", 3, {226, 135, 146}
+"DoubleRightTee", 3, {226, 138, 168}
+"DoubleUpArrow", 3, {226, 135, 145}
+"DoubleUpDownArrow", 3, {226, 135, 149}
+"DoubleVerticalBar", 3, {226, 136, 165}
+"DownArrowBar", 3, {226, 164, 147}
+"downarrow", 3, {226, 134, 147}
+"DownArrow", 3, {226, 134, 147}
+"Downarrow", 3, {226, 135, 147}
+"DownArrowUpArrow", 3, {226, 135, 181}
+"DownBreve", 2, {204, 145}
+"downdownarrows", 3, {226, 135, 138}
+"downharpoonleft", 3, {226, 135, 131}
+"downharpoonright", 3, {226, 135, 130}
+"DownLeftRightVector", 3, {226, 165, 144}
+"DownLeftTeeVector", 3, {226, 165, 158}
+"DownLeftVectorBar", 3, {226, 165, 150}
+"DownLeftVector", 3, {226, 134, 189}
+"DownRightTeeVector", 3, {226, 165, 159}
+"DownRightVectorBar", 3, {226, 165, 151}
+"DownRightVector", 3, {226, 135, 129}
+"DownTeeArrow", 3, {226, 134, 167}
+"DownTee", 3, {226, 138, 164}
+"drbkarow", 3, {226, 164, 144}
+"drcorn", 3, {226, 140, 159}
+"drcrop", 3, {226, 140, 140}
+"Dscr", 4, {240, 157, 146, 159}
+"dscr", 4, {240, 157, 146, 185}
+"DScy", 2, {208, 133}
+"dscy", 2, {209, 149}
+"dsol", 3, {226, 167, 182}
+"Dstrok", 2, {196, 144}
+"dstrok", 2, {196, 145}
+"dtdot", 3, {226, 139, 177}
+"dtri", 3, {226, 150, 191}
+"dtrif", 3, {226, 150, 190}
+"duarr", 3, {226, 135, 181}
+"duhar", 3, {226, 165, 175}
+"dwangle", 3, {226, 166, 166}
+"DZcy", 2, {208, 143}
+"dzcy", 2, {209, 159}
+"dzigrarr", 3, {226, 159, 191}
+"Eacute", 2, {195, 137}
+"eacute", 2, {195, 169}
+"easter", 3, {226, 169, 174}
+"Ecaron", 2, {196, 154}
+"ecaron", 2, {196, 155}
+"Ecirc", 2, {195, 138}
+"ecirc", 2, {195, 170}
+"ecir", 3, {226, 137, 150}
+"ecolon", 3, {226, 137, 149}
+"Ecy", 2, {208, 173}
+"ecy", 2, {209, 141}
+"eDDot", 3, {226, 169, 183}
+"Edot", 2, {196, 150}
+"edot", 2, {196, 151}
+"eDot", 3, {226, 137, 145}
+"ee", 3, {226, 133, 135}
+"efDot", 3, {226, 137, 146}
+"Efr", 4, {240, 157, 148, 136}
+"efr", 4, {240, 157, 148, 162}
+"eg", 3, {226, 170, 154}
+"Egrave", 2, {195, 136}
+"egrave", 2, {195, 168}
+"egs", 3, {226, 170, 150}
+"egsdot", 3, {226, 170, 152}
+"el", 3, {226, 170, 153}
+"Element", 3, {226, 136, 136}
+"elinters", 3, {226, 143, 167}
+"ell", 3, {226, 132, 147}
+"els", 3, {226, 170, 149}
+"elsdot", 3, {226, 170, 151}
+"Emacr", 2, {196, 146}
+"emacr", 2, {196, 147}
+"empty", 3, {226, 136, 133}
+"emptyset", 3, {226, 136, 133}
+"EmptySmallSquare", 3, {226, 151, 187}
+"emptyv", 3, {226, 136, 133}
+"EmptyVerySmallSquare", 3, {226, 150, 171}
+"emsp13", 3, {226, 128, 132}
+"emsp14", 3, {226, 128, 133}
+"emsp", 3, {226, 128, 131}
+"ENG", 2, {197, 138}
+"eng", 2, {197, 139}
+"ensp", 3, {226, 128, 130}
+"Eogon", 2, {196, 152}
+"eogon", 2, {196, 153}
+"Eopf", 4, {240, 157, 148, 188}
+"eopf", 4, {240, 157, 149, 150}
+"epar", 3, {226, 139, 149}
+"eparsl", 3, {226, 167, 163}
+"eplus", 3, {226, 169, 177}
+"epsi", 2, {206, 181}
+"Epsilon", 2, {206, 149}
+"epsilon", 2, {206, 181}
+"epsiv", 2, {207, 181}
+"eqcirc", 3, {226, 137, 150}
+"eqcolon", 3, {226, 137, 149}
+"eqsim", 3, {226, 137, 130}
+"eqslantgtr", 3, {226, 170, 150}
+"eqslantless", 3, {226, 170, 149}
+"Equal", 3, {226, 169, 181}
+"equals", 1, {61}
+"EqualTilde", 3, {226, 137, 130}
+"equest", 3, {226, 137, 159}
+"Equilibrium", 3, {226, 135, 140}
+"equiv", 3, {226, 137, 161}
+"equivDD", 3, {226, 169, 184}
+"eqvparsl", 3, {226, 167, 165}
+"erarr", 3, {226, 165, 177}
+"erDot", 3, {226, 137, 147}
+"escr", 3, {226, 132, 175}
+"Escr", 3, {226, 132, 176}
+"esdot", 3, {226, 137, 144}
+"Esim", 3, {226, 169, 179}
+"esim", 3, {226, 137, 130}
+"Eta", 2, {206, 151}
+"eta", 2, {206, 183}
+"ETH", 2, {195, 144}
+"eth", 2, {195, 176}
+"Euml", 2, {195, 139}
+"euml", 2, {195, 171}
+"euro", 3, {226, 130, 172}
+"excl", 1, {33}
+"exist", 3, {226, 136, 131}
+"Exists", 3, {226, 136, 131}
+"expectation", 3, {226, 132, 176}
+"exponentiale", 3, {226, 133, 135}
+"ExponentialE", 3, {226, 133, 135}
+"fallingdotseq", 3, {226, 137, 146}
+"Fcy", 2, {208, 164}
+"fcy", 2, {209, 132}
+"female", 3, {226, 153, 128}
+"ffilig", 3, {239, 172, 131}
+"fflig", 3, {239, 172, 128}
+"ffllig", 3, {239, 172, 132}
+"Ffr", 4, {240, 157, 148, 137}
+"ffr", 4, {240, 157, 148, 163}
+"filig", 3, {239, 172, 129}
+"FilledSmallSquare", 3, {226, 151, 188}
+"FilledVerySmallSquare", 3, {226, 150, 170}
+"fjlig", 1, {102}
+"flat", 3, {226, 153, 173}
+"fllig", 3, {239, 172, 130}
+"fltns", 3, {226, 150, 177}
+"fnof", 2, {198, 146}
+"Fopf", 4, {240, 157, 148, 189}
+"fopf", 4, {240, 157, 149, 151}
+"forall", 3, {226, 136, 128}
+"ForAll", 3, {226, 136, 128}
+"fork", 3, {226, 139, 148}
+"forkv", 3, {226, 171, 153}
+"Fouriertrf", 3, {226, 132, 177}
+"fpartint", 3, {226, 168, 141}
+"frac12", 2, {194, 189}
+"frac13", 3, {226, 133, 147}
+"frac14", 2, {194, 188}
+"frac15", 3, {226, 133, 149}
+"frac16", 3, {226, 133, 153}
+"frac18", 3, {226, 133, 155}
+"frac23", 3, {226, 133, 148}
+"frac25", 3, {226, 133, 150}
+"frac34", 2, {194, 190}
+"frac35", 3, {226, 133, 151}
+"frac38", 3, {226, 133, 156}
+"frac45", 3, {226, 133, 152}
+"frac56", 3, {226, 133, 154}
+"frac58", 3, {226, 133, 157}
+"frac78", 3, {226, 133, 158}
+"frasl", 3, {226, 129, 132}
+"frown", 3, {226, 140, 162}
+"fscr", 4, {240, 157, 146, 187}
+"Fscr", 3, {226, 132, 177}
+"gacute", 2, {199, 181}
+"Gamma", 2, {206, 147}
+"gamma", 2, {206, 179}
+"Gammad", 2, {207, 156}
+"gammad", 2, {207, 157}
+"gap", 3, {226, 170, 134}
+"Gbreve", 2, {196, 158}
+"gbreve", 2, {196, 159}
+"Gcedil", 2, {196, 162}
+"Gcirc", 2, {196, 156}
+"gcirc", 2, {196, 157}
+"Gcy", 2, {208, 147}
+"gcy", 2, {208, 179}
+"Gdot", 2, {196, 160}
+"gdot", 2, {196, 161}
+"ge", 3, {226, 137, 165}
+"gE", 3, {226, 137, 167}
+"gEl", 3, {226, 170, 140}
+"gel", 3, {226, 139, 155}
+"geq", 3, {226, 137, 165}
+"geqq", 3, {226, 137, 167}
+"geqslant", 3, {226, 169, 190}
+"gescc", 3, {226, 170, 169}
+"ges", 3, {226, 169, 190}
+"gesdot", 3, {226, 170, 128}
+"gesdoto", 3, {226, 170, 130}
+"gesdotol", 3, {226, 170, 132}
+"gesl", 3, {226, 139, 155}
+"gesles", 3, {226, 170, 148}
+"Gfr", 4, {240, 157, 148, 138}
+"gfr", 4, {240, 157, 148, 164}
+"gg", 3, {226, 137, 171}
+"Gg", 3, {226, 139, 153}
+"ggg", 3, {226, 139, 153}
+"gimel", 3, {226, 132, 183}
+"GJcy", 2, {208, 131}
+"gjcy", 2, {209, 147}
+"gla", 3, {226, 170, 165}
+"gl", 3, {226, 137, 183}
+"glE", 3, {226, 170, 146}
+"glj", 3, {226, 170, 164}
+"gnap", 3, {226, 170, 138}
+"gnapprox", 3, {226, 170, 138}
+"gne", 3, {226, 170, 136}
+"gnE", 3, {226, 137, 169}
+"gneq", 3, {226, 170, 136}
+"gneqq", 3, {226, 137, 169}
+"gnsim", 3, {226, 139, 167}
+"Gopf", 4, {240, 157, 148, 190}
+"gopf", 4, {240, 157, 149, 152}
+"grave", 1, {96}
+"GreaterEqual", 3, {226, 137, 165}
+"GreaterEqualLess", 3, {226, 139, 155}
+"GreaterFullEqual", 3, {226, 137, 167}
+"GreaterGreater", 3, {226, 170, 162}
+"GreaterLess", 3, {226, 137, 183}
+"GreaterSlantEqual", 3, {226, 169, 190}
+"GreaterTilde", 3, {226, 137, 179}
+"Gscr", 4, {240, 157, 146, 162}
+"gscr", 3, {226, 132, 138}
+"gsim", 3, {226, 137, 179}
+"gsime", 3, {226, 170, 142}
+"gsiml", 3, {226, 170, 144}
+"gtcc", 3, {226, 170, 167}
+"gtcir", 3, {226, 169, 186}
+"gt", 1, {62}
+"GT", 1, {62}
+"Gt", 3, {226, 137, 171}
+"gtdot", 3, {226, 139, 151}
+"gtlPar", 3, {226, 166, 149}
+"gtquest", 3, {226, 169, 188}
+"gtrapprox", 3, {226, 170, 134}
+"gtrarr", 3, {226, 165, 184}
+"gtrdot", 3, {226, 139, 151}
+"gtreqless", 3, {226, 139, 155}
+"gtreqqless", 3, {226, 170, 140}
+"gtrless", 3, {226, 137, 183}
+"gtrsim", 3, {226, 137, 179}
+"gvertneqq", 3, {226, 137, 169}
+"gvnE", 3, {226, 137, 169}
+"Hacek", 2, {203, 135}
+"hairsp", 3, {226, 128, 138}
+"half", 2, {194, 189}
+"hamilt", 3, {226, 132, 139}
+"HARDcy", 2, {208, 170}
+"hardcy", 2, {209, 138}
+"harrcir", 3, {226, 165, 136}
+"harr", 3, {226, 134, 148}
+"hArr", 3, {226, 135, 148}
+"harrw", 3, {226, 134, 173}
+"Hat", 1, {94}
+"hbar", 3, {226, 132, 143}
+"Hcirc", 2, {196, 164}
+"hcirc", 2, {196, 165}
+"hearts", 3, {226, 153, 165}
+"heartsuit", 3, {226, 153, 165}
+"hellip", 3, {226, 128, 166}
+"hercon", 3, {226, 138, 185}
+"hfr", 4, {240, 157, 148, 165}
+"Hfr", 3, {226, 132, 140}
+"HilbertSpace", 3, {226, 132, 139}
+"hksearow", 3, {226, 164, 165}
+"hkswarow", 3, {226, 164, 166}
+"hoarr", 3, {226, 135, 191}
+"homtht", 3, {226, 136, 187}
+"hookleftarrow", 3, {226, 134, 169}
+"hookrightarrow", 3, {226, 134, 170}
+"hopf", 4, {240, 157, 149, 153}
+"Hopf", 3, {226, 132, 141}
+"horbar", 3, {226, 128, 149}
+"HorizontalLine", 3, {226, 148, 128}
+"hscr", 4, {240, 157, 146, 189}
+"Hscr", 3, {226, 132, 139}
+"hslash", 3, {226, 132, 143}
+"Hstrok", 2, {196, 166}
+"hstrok", 2, {196, 167}
+"HumpDownHump", 3, {226, 137, 142}
+"HumpEqual", 3, {226, 137, 143}
+"hybull", 3, {226, 129, 131}
+"hyphen", 3, {226, 128, 144}
+"Iacute", 2, {195, 141}
+"iacute", 2, {195, 173}
+"ic", 3, {226, 129, 163}
+"Icirc", 2, {195, 142}
+"icirc", 2, {195, 174}
+"Icy", 2, {208, 152}
+"icy", 2, {208, 184}
+"Idot", 2, {196, 176}
+"IEcy", 2, {208, 149}
+"iecy", 2, {208, 181}
+"iexcl", 2, {194, 161}
+"iff", 3, {226, 135, 148}
+"ifr", 4, {240, 157, 148, 166}
+"Ifr", 3, {226, 132, 145}
+"Igrave", 2, {195, 140}
+"igrave", 2, {195, 172}
+"ii", 3, {226, 133, 136}
+"iiiint", 3, {226, 168, 140}
+"iiint", 3, {226, 136, 173}
+"iinfin", 3, {226, 167, 156}
+"iiota", 3, {226, 132, 169}
+"IJlig", 2, {196, 178}
+"ijlig", 2, {196, 179}
+"Imacr", 2, {196, 170}
+"imacr", 2, {196, 171}
+"image", 3, {226, 132, 145}
+"ImaginaryI", 3, {226, 133, 136}
+"imagline", 3, {226, 132, 144}
+"imagpart", 3, {226, 132, 145}
+"imath", 2, {196, 177}
+"Im", 3, {226, 132, 145}
+"imof", 3, {226, 138, 183}
+"imped", 2, {198, 181}
+"Implies", 3, {226, 135, 146}
+"incare", 3, {226, 132, 133}
+"in", 3, {226, 136, 136}
+"infin", 3, {226, 136, 158}
+"infintie", 3, {226, 167, 157}
+"inodot", 2, {196, 177}
+"intcal", 3, {226, 138, 186}
+"int", 3, {226, 136, 171}
+"Int", 3, {226, 136, 172}
+"integers", 3, {226, 132, 164}
+"Integral", 3, {226, 136, 171}
+"intercal", 3, {226, 138, 186}
+"Intersection", 3, {226, 139, 130}
+"intlarhk", 3, {226, 168, 151}
+"intprod", 3, {226, 168, 188}
+"InvisibleComma", 3, {226, 129, 163}
+"InvisibleTimes", 3, {226, 129, 162}
+"IOcy", 2, {208, 129}
+"iocy", 2, {209, 145}
+"Iogon", 2, {196, 174}
+"iogon", 2, {196, 175}
+"Iopf", 4, {240, 157, 149, 128}
+"iopf", 4, {240, 157, 149, 154}
+"Iota", 2, {206, 153}
+"iota", 2, {206, 185}
+"iprod", 3, {226, 168, 188}
+"iquest", 2, {194, 191}
+"iscr", 4, {240, 157, 146, 190}
+"Iscr", 3, {226, 132, 144}
+"isin", 3, {226, 136, 136}
+"isindot", 3, {226, 139, 181}
+"isinE", 3, {226, 139, 185}
+"isins", 3, {226, 139, 180}
+"isinsv", 3, {226, 139, 179}
+"isinv", 3, {226, 136, 136}
+"it", 3, {226, 129, 162}
+"Itilde", 2, {196, 168}
+"itilde", 2, {196, 169}
+"Iukcy", 2, {208, 134}
+"iukcy", 2, {209, 150}
+"Iuml", 2, {195, 143}
+"iuml", 2, {195, 175}
+"Jcirc", 2, {196, 180}
+"jcirc", 2, {196, 181}
+"Jcy", 2, {208, 153}
+"jcy", 2, {208, 185}
+"Jfr", 4, {240, 157, 148, 141}
+"jfr", 4, {240, 157, 148, 167}
+"jmath", 2, {200, 183}
+"Jopf", 4, {240, 157, 149, 129}
+"jopf", 4, {240, 157, 149, 155}
+"Jscr", 4, {240, 157, 146, 165}
+"jscr", 4, {240, 157, 146, 191}
+"Jsercy", 2, {208, 136}
+"jsercy", 2, {209, 152}
+"Jukcy", 2, {208, 132}
+"jukcy", 2, {209, 148}
+"Kappa", 2, {206, 154}
+"kappa", 2, {206, 186}
+"kappav", 2, {207, 176}
+"Kcedil", 2, {196, 182}
+"kcedil", 2, {196, 183}
+"Kcy", 2, {208, 154}
+"kcy", 2, {208, 186}
+"Kfr", 4, {240, 157, 148, 142}
+"kfr", 4, {240, 157, 148, 168}
+"kgreen", 2, {196, 184}
+"KHcy", 2, {208, 165}
+"khcy", 2, {209, 133}
+"KJcy", 2, {208, 140}
+"kjcy", 2, {209, 156}
+"Kopf", 4, {240, 157, 149, 130}
+"kopf", 4, {240, 157, 149, 156}
+"Kscr", 4, {240, 157, 146, 166}
+"kscr", 4, {240, 157, 147, 128}
+"lAarr", 3, {226, 135, 154}
+"Lacute", 2, {196, 185}
+"lacute", 2, {196, 186}
+"laemptyv", 3, {226, 166, 180}
+"lagran", 3, {226, 132, 146}
+"Lambda", 2, {206, 155}
+"lambda", 2, {206, 187}
+"lang", 3, {226, 159, 168}
+"Lang", 3, {226, 159, 170}
+"langd", 3, {226, 166, 145}
+"langle", 3, {226, 159, 168}
+"lap", 3, {226, 170, 133}
+"Laplacetrf", 3, {226, 132, 146}
+"laquo", 2, {194, 171}
+"larrb", 3, {226, 135, 164}
+"larrbfs", 3, {226, 164, 159}
+"larr", 3, {226, 134, 144}
+"Larr", 3, {226, 134, 158}
+"lArr", 3, {226, 135, 144}
+"larrfs", 3, {226, 164, 157}
+"larrhk", 3, {226, 134, 169}
+"larrlp", 3, {226, 134, 171}
+"larrpl", 3, {226, 164, 185}
+"larrsim", 3, {226, 165, 179}
+"larrtl", 3, {226, 134, 162}
+"latail", 3, {226, 164, 153}
+"lAtail", 3, {226, 164, 155}
+"lat", 3, {226, 170, 171}
+"late", 3, {226, 170, 173}
+"lates", 3, {226, 170, 173}
+"lbarr", 3, {226, 164, 140}
+"lBarr", 3, {226, 164, 142}
+"lbbrk", 3, {226, 157, 178}
+"lbrace", 1, {123}
+"lbrack", 1, {91}
+"lbrke", 3, {226, 166, 139}
+"lbrksld", 3, {226, 166, 143}
+"lbrkslu", 3, {226, 166, 141}
+"Lcaron", 2, {196, 189}
+"lcaron", 2, {196, 190}
+"Lcedil", 2, {196, 187}
+"lcedil", 2, {196, 188}
+"lceil", 3, {226, 140, 136}
+"lcub", 1, {123}
+"Lcy", 2, {208, 155}
+"lcy", 2, {208, 187}
+"ldca", 3, {226, 164, 182}
+"ldquo", 3, {226, 128, 156}
+"ldquor", 3, {226, 128, 158}
+"ldrdhar", 3, {226, 165, 167}
+"ldrushar", 3, {226, 165, 139}
+"ldsh", 3, {226, 134, 178}
+"le", 3, {226, 137, 164}
+"lE", 3, {226, 137, 166}
+"LeftAngleBracket", 3, {226, 159, 168}
+"LeftArrowBar", 3, {226, 135, 164}
+"leftarrow", 3, {226, 134, 144}
+"LeftArrow", 3, {226, 134, 144}
+"Leftarrow", 3, {226, 135, 144}
+"LeftArrowRightArrow", 3, {226, 135, 134}
+"leftarrowtail", 3, {226, 134, 162}
+"LeftCeiling", 3, {226, 140, 136}
+"LeftDoubleBracket", 3, {226, 159, 166}
+"LeftDownTeeVector", 3, {226, 165, 161}
+"LeftDownVectorBar", 3, {226, 165, 153}
+"LeftDownVector", 3, {226, 135, 131}
+"LeftFloor", 3, {226, 140, 138}
+"leftharpoondown", 3, {226, 134, 189}
+"leftharpoonup", 3, {226, 134, 188}
+"leftleftarrows", 3, {226, 135, 135}
+"leftrightarrow", 3, {226, 134, 148}
+"LeftRightArrow", 3, {226, 134, 148}
+"Leftrightarrow", 3, {226, 135, 148}
+"leftrightarrows", 3, {226, 135, 134}
+"leftrightharpoons", 3, {226, 135, 139}
+"leftrightsquigarrow", 3, {226, 134, 173}
+"LeftRightVector", 3, {226, 165, 142}
+"LeftTeeArrow", 3, {226, 134, 164}
+"LeftTee", 3, {226, 138, 163}
+"LeftTeeVector", 3, {226, 165, 154}
+"leftthreetimes", 3, {226, 139, 139}
+"LeftTriangleBar", 3, {226, 167, 143}
+"LeftTriangle", 3, {226, 138, 178}
+"LeftTriangleEqual", 3, {226, 138, 180}
+"LeftUpDownVector", 3, {226, 165, 145}
+"LeftUpTeeVector", 3, {226, 165, 160}
+"LeftUpVectorBar", 3, {226, 165, 152}
+"LeftUpVector", 3, {226, 134, 191}
+"LeftVectorBar", 3, {226, 165, 146}
+"LeftVector", 3, {226, 134, 188}
+"lEg", 3, {226, 170, 139}
+"leg", 3, {226, 139, 154}
+"leq", 3, {226, 137, 164}
+"leqq", 3, {226, 137, 166}
+"leqslant", 3, {226, 169, 189}
+"lescc", 3, {226, 170, 168}
+"les", 3, {226, 169, 189}
+"lesdot", 3, {226, 169, 191}
+"lesdoto", 3, {226, 170, 129}
+"lesdotor", 3, {226, 170, 131}
+"lesg", 3, {226, 139, 154}
+"lesges", 3, {226, 170, 147}
+"lessapprox", 3, {226, 170, 133}
+"lessdot", 3, {226, 139, 150}
+"lesseqgtr", 3, {226, 139, 154}
+"lesseqqgtr", 3, {226, 170, 139}
+"LessEqualGreater", 3, {226, 139, 154}
+"LessFullEqual", 3, {226, 137, 166}
+"LessGreater", 3, {226, 137, 182}
+"lessgtr", 3, {226, 137, 182}
+"LessLess", 3, {226, 170, 161}
+"lesssim", 3, {226, 137, 178}
+"LessSlantEqual", 3, {226, 169, 189}
+"LessTilde", 3, {226, 137, 178}
+"lfisht", 3, {226, 165, 188}
+"lfloor", 3, {226, 140, 138}
+"Lfr", 4, {240, 157, 148, 143}
+"lfr", 4, {240, 157, 148, 169}
+"lg", 3, {226, 137, 182}
+"lgE", 3, {226, 170, 145}
+"lHar", 3, {226, 165, 162}
+"lhard", 3, {226, 134, 189}
+"lharu", 3, {226, 134, 188}
+"lharul", 3, {226, 165, 170}
+"lhblk", 3, {226, 150, 132}
+"LJcy", 2, {208, 137}
+"ljcy", 2, {209, 153}
+"llarr", 3, {226, 135, 135}
+"ll", 3, {226, 137, 170}
+"Ll", 3, {226, 139, 152}
+"llcorner", 3, {226, 140, 158}
+"Lleftarrow", 3, {226, 135, 154}
+"llhard", 3, {226, 165, 171}
+"lltri", 3, {226, 151, 186}
+"Lmidot", 2, {196, 191}
+"lmidot", 2, {197, 128}
+"lmoustache", 3, {226, 142, 176}
+"lmoust", 3, {226, 142, 176}
+"lnap", 3, {226, 170, 137}
+"lnapprox", 3, {226, 170, 137}
+"lne", 3, {226, 170, 135}
+"lnE", 3, {226, 137, 168}
+"lneq", 3, {226, 170, 135}
+"lneqq", 3, {226, 137, 168}
+"lnsim", 3, {226, 139, 166}
+"loang", 3, {226, 159, 172}
+"loarr", 3, {226, 135, 189}
+"lobrk", 3, {226, 159, 166}
+"longleftarrow", 3, {226, 159, 181}
+"LongLeftArrow", 3, {226, 159, 181}
+"Longleftarrow", 3, {226, 159, 184}
+"longleftrightarrow", 3, {226, 159, 183}
+"LongLeftRightArrow", 3, {226, 159, 183}
+"Longleftrightarrow", 3, {226, 159, 186}
+"longmapsto", 3, {226, 159, 188}
+"longrightarrow", 3, {226, 159, 182}
+"LongRightArrow", 3, {226, 159, 182}
+"Longrightarrow", 3, {226, 159, 185}
+"looparrowleft", 3, {226, 134, 171}
+"looparrowright", 3, {226, 134, 172}
+"lopar", 3, {226, 166, 133}
+"Lopf", 4, {240, 157, 149, 131}
+"lopf", 4, {240, 157, 149, 157}
+"loplus", 3, {226, 168, 173}
+"lotimes", 3, {226, 168, 180}
+"lowast", 3, {226, 136, 151}
+"lowbar", 1, {95}
+"LowerLeftArrow", 3, {226, 134, 153}
+"LowerRightArrow", 3, {226, 134, 152}
+"loz", 3, {226, 151, 138}
+"lozenge", 3, {226, 151, 138}
+"lozf", 3, {226, 167, 171}
+"lpar", 1, {40}
+"lparlt", 3, {226, 166, 147}
+"lrarr", 3, {226, 135, 134}
+"lrcorner", 3, {226, 140, 159}
+"lrhar", 3, {226, 135, 139}
+"lrhard", 3, {226, 165, 173}
+"lrm", 3, {226, 128, 142}
+"lrtri", 3, {226, 138, 191}
+"lsaquo", 3, {226, 128, 185}
+"lscr", 4, {240, 157, 147, 129}
+"Lscr", 3, {226, 132, 146}
+"lsh", 3, {226, 134, 176}
+"Lsh", 3, {226, 134, 176}
+"lsim", 3, {226, 137, 178}
+"lsime", 3, {226, 170, 141}
+"lsimg", 3, {226, 170, 143}
+"lsqb", 1, {91}
+"lsquo", 3, {226, 128, 152}
+"lsquor", 3, {226, 128, 154}
+"Lstrok", 2, {197, 129}
+"lstrok", 2, {197, 130}
+"ltcc", 3, {226, 170, 166}
+"ltcir", 3, {226, 169, 185}
+"lt", 1, {60}
+"LT", 1, {60}
+"Lt", 3, {226, 137, 170}
+"ltdot", 3, {226, 139, 150}
+"lthree", 3, {226, 139, 139}
+"ltimes", 3, {226, 139, 137}
+"ltlarr", 3, {226, 165, 182}
+"ltquest", 3, {226, 169, 187}
+"ltri", 3, {226, 151, 131}
+"ltrie", 3, {226, 138, 180}
+"ltrif", 3, {226, 151, 130}
+"ltrPar", 3, {226, 166, 150}
+"lurdshar", 3, {226, 165, 138}
+"luruhar", 3, {226, 165, 166}
+"lvertneqq", 3, {226, 137, 168}
+"lvnE", 3, {226, 137, 168}
+"macr", 2, {194, 175}
+"male", 3, {226, 153, 130}
+"malt", 3, {226, 156, 160}
+"maltese", 3, {226, 156, 160}
+"Map", 3, {226, 164, 133}
+"map", 3, {226, 134, 166}
+"mapsto", 3, {226, 134, 166}
+"mapstodown", 3, {226, 134, 167}
+"mapstoleft", 3, {226, 134, 164}
+"mapstoup", 3, {226, 134, 165}
+"marker", 3, {226, 150, 174}
+"mcomma", 3, {226, 168, 169}
+"Mcy", 2, {208, 156}
+"mcy", 2, {208, 188}
+"mdash", 3, {226, 128, 148}
+"mDDot", 3, {226, 136, 186}
+"measuredangle", 3, {226, 136, 161}
+"MediumSpace", 3, {226, 129, 159}
+"Mellintrf", 3, {226, 132, 179}
+"Mfr", 4, {240, 157, 148, 144}
+"mfr", 4, {240, 157, 148, 170}
+"mho", 3, {226, 132, 167}
+"micro", 2, {194, 181}
+"midast", 1, {42}
+"midcir", 3, {226, 171, 176}
+"mid", 3, {226, 136, 163}
+"middot", 2, {194, 183}
+"minusb", 3, {226, 138, 159}
+"minus", 3, {226, 136, 146}
+"minusd", 3, {226, 136, 184}
+"minusdu", 3, {226, 168, 170}
+"MinusPlus", 3, {226, 136, 147}
+"mlcp", 3, {226, 171, 155}
+"mldr", 3, {226, 128, 166}
+"mnplus", 3, {226, 136, 147}
+"models", 3, {226, 138, 167}
+"Mopf", 4, {240, 157, 149, 132}
+"mopf", 4, {240, 157, 149, 158}
+"mp", 3, {226, 136, 147}
+"mscr", 4, {240, 157, 147, 130}
+"Mscr", 3, {226, 132, 179}
+"mstpos", 3, {226, 136, 190}
+"Mu", 2, {206, 156}
+"mu", 2, {206, 188}
+"multimap", 3, {226, 138, 184}
+"mumap", 3, {226, 138, 184}
+"nabla", 3, {226, 136, 135}
+"Nacute", 2, {197, 131}
+"nacute", 2, {197, 132}
+"nang", 3, {226, 136, 160}
+"nap", 3, {226, 137, 137}
+"napE", 3, {226, 169, 176}
+"napid", 3, {226, 137, 139}
+"napos", 2, {197, 137}
+"napprox", 3, {226, 137, 137}
+"natural", 3, {226, 153, 174}
+"naturals", 3, {226, 132, 149}
+"natur", 3, {226, 153, 174}
+"nbsp", 2, {194, 160}
+"nbump", 3, {226, 137, 142}
+"nbumpe", 3, {226, 137, 143}
+"ncap", 3, {226, 169, 131}
+"Ncaron", 2, {197, 135}
+"ncaron", 2, {197, 136}
+"Ncedil", 2, {197, 133}
+"ncedil", 2, {197, 134}
+"ncong", 3, {226, 137, 135}
+"ncongdot", 3, {226, 169, 173}
+"ncup", 3, {226, 169, 130}
+"Ncy", 2, {208, 157}
+"ncy", 2, {208, 189}
+"ndash", 3, {226, 128, 147}
+"nearhk", 3, {226, 164, 164}
+"nearr", 3, {226, 134, 151}
+"neArr", 3, {226, 135, 151}
+"nearrow", 3, {226, 134, 151}
+"ne", 3, {226, 137, 160}
+"nedot", 3, {226, 137, 144}
+"NegativeMediumSpace", 3, {226, 128, 139}
+"NegativeThickSpace", 3, {226, 128, 139}
+"NegativeThinSpace", 3, {226, 128, 139}
+"NegativeVeryThinSpace", 3, {226, 128, 139}
+"nequiv", 3, {226, 137, 162}
+"nesear", 3, {226, 164, 168}
+"nesim", 3, {226, 137, 130}
+"NestedGreaterGreater", 3, {226, 137, 171}
+"NestedLessLess", 3, {226, 137, 170}
+"NewLine", 1, {10}
+"nexist", 3, {226, 136, 132}
+"nexists", 3, {226, 136, 132}
+"Nfr", 4, {240, 157, 148, 145}
+"nfr", 4, {240, 157, 148, 171}
+"ngE", 3, {226, 137, 167}
+"nge", 3, {226, 137, 177}
+"ngeq", 3, {226, 137, 177}
+"ngeqq", 3, {226, 137, 167}
+"ngeqslant", 3, {226, 169, 190}
+"nges", 3, {226, 169, 190}
+"nGg", 3, {226, 139, 153}
+"ngsim", 3, {226, 137, 181}
+"nGt", 3, {226, 137, 171}
+"ngt", 3, {226, 137, 175}
+"ngtr", 3, {226, 137, 175}
+"nGtv", 3, {226, 137, 171}
+"nharr", 3, {226, 134, 174}
+"nhArr", 3, {226, 135, 142}
+"nhpar", 3, {226, 171, 178}
+"ni", 3, {226, 136, 139}
+"nis", 3, {226, 139, 188}
+"nisd", 3, {226, 139, 186}
+"niv", 3, {226, 136, 139}
+"NJcy", 2, {208, 138}
+"njcy", 2, {209, 154}
+"nlarr", 3, {226, 134, 154}
+"nlArr", 3, {226, 135, 141}
+"nldr", 3, {226, 128, 165}
+"nlE", 3, {226, 137, 166}
+"nle", 3, {226, 137, 176}
+"nleftarrow", 3, {226, 134, 154}
+"nLeftarrow", 3, {226, 135, 141}
+"nleftrightarrow", 3, {226, 134, 174}
+"nLeftrightarrow", 3, {226, 135, 142}
+"nleq", 3, {226, 137, 176}
+"nleqq", 3, {226, 137, 166}
+"nleqslant", 3, {226, 169, 189}
+"nles", 3, {226, 169, 189}
+"nless", 3, {226, 137, 174}
+"nLl", 3, {226, 139, 152}
+"nlsim", 3, {226, 137, 180}
+"nLt", 3, {226, 137, 170}
+"nlt", 3, {226, 137, 174}
+"nltri", 3, {226, 139, 170}
+"nltrie", 3, {226, 139, 172}
+"nLtv", 3, {226, 137, 170}
+"nmid", 3, {226, 136, 164}
+"NoBreak", 3, {226, 129, 160}
+"NonBreakingSpace", 2, {194, 160}
+"nopf", 4, {240, 157, 149, 159}
+"Nopf", 3, {226, 132, 149}
+"Not", 3, {226, 171, 172}
+"not", 2, {194, 172}
+"NotCongruent", 3, {226, 137, 162}
+"NotCupCap", 3, {226, 137, 173}
+"NotDoubleVerticalBar", 3, {226, 136, 166}
+"NotElement", 3, {226, 136, 137}
+"NotEqual", 3, {226, 137, 160}
+"NotEqualTilde", 3, {226, 137, 130}
+"NotExists", 3, {226, 136, 132}
+"NotGreater", 3, {226, 137, 175}
+"NotGreaterEqual", 3, {226, 137, 177}
+"NotGreaterFullEqual", 3, {226, 137, 167}
+"NotGreaterGreater", 3, {226, 137, 171}
+"NotGreaterLess", 3, {226, 137, 185}
+"NotGreaterSlantEqual", 3, {226, 169, 190}
+"NotGreaterTilde", 3, {226, 137, 181}
+"NotHumpDownHump", 3, {226, 137, 142}
+"NotHumpEqual", 3, {226, 137, 143}
+"notin", 3, {226, 136, 137}
+"notindot", 3, {226, 139, 181}
+"notinE", 3, {226, 139, 185}
+"notinva", 3, {226, 136, 137}
+"notinvb", 3, {226, 139, 183}
+"notinvc", 3, {226, 139, 182}
+"NotLeftTriangleBar", 3, {226, 167, 143}
+"NotLeftTriangle", 3, {226, 139, 170}
+"NotLeftTriangleEqual", 3, {226, 139, 172}
+"NotLess", 3, {226, 137, 174}
+"NotLessEqual", 3, {226, 137, 176}
+"NotLessGreater", 3, {226, 137, 184}
+"NotLessLess", 3, {226, 137, 170}
+"NotLessSlantEqual", 3, {226, 169, 189}
+"NotLessTilde", 3, {226, 137, 180}
+"NotNestedGreaterGreater", 3, {226, 170, 162}
+"NotNestedLessLess", 3, {226, 170, 161}
+"notni", 3, {226, 136, 140}
+"notniva", 3, {226, 136, 140}
+"notnivb", 3, {226, 139, 190}
+"notnivc", 3, {226, 139, 189}
+"NotPrecedes", 3, {226, 138, 128}
+"NotPrecedesEqual", 3, {226, 170, 175}
+"NotPrecedesSlantEqual", 3, {226, 139, 160}
+"NotReverseElement", 3, {226, 136, 140}
+"NotRightTriangleBar", 3, {226, 167, 144}
+"NotRightTriangle", 3, {226, 139, 171}
+"NotRightTriangleEqual", 3, {226, 139, 173}
+"NotSquareSubset", 3, {226, 138, 143}
+"NotSquareSubsetEqual", 3, {226, 139, 162}
+"NotSquareSuperset", 3, {226, 138, 144}
+"NotSquareSupersetEqual", 3, {226, 139, 163}
+"NotSubset", 3, {226, 138, 130}
+"NotSubsetEqual", 3, {226, 138, 136}
+"NotSucceeds", 3, {226, 138, 129}
+"NotSucceedsEqual", 3, {226, 170, 176}
+"NotSucceedsSlantEqual", 3, {226, 139, 161}
+"NotSucceedsTilde", 3, {226, 137, 191}
+"NotSuperset", 3, {226, 138, 131}
+"NotSupersetEqual", 3, {226, 138, 137}
+"NotTilde", 3, {226, 137, 129}
+"NotTildeEqual", 3, {226, 137, 132}
+"NotTildeFullEqual", 3, {226, 137, 135}
+"NotTildeTilde", 3, {226, 137, 137}
+"NotVerticalBar", 3, {226, 136, 164}
+"nparallel", 3, {226, 136, 166}
+"npar", 3, {226, 136, 166}
+"nparsl", 3, {226, 171, 189}
+"npart", 3, {226, 136, 130}
+"npolint", 3, {226, 168, 148}
+"npr", 3, {226, 138, 128}
+"nprcue", 3, {226, 139, 160}
+"nprec", 3, {226, 138, 128}
+"npreceq", 3, {226, 170, 175}
+"npre", 3, {226, 170, 175}
+"nrarrc", 3, {226, 164, 179}
+"nrarr", 3, {226, 134, 155}
+"nrArr", 3, {226, 135, 143}
+"nrarrw", 3, {226, 134, 157}
+"nrightarrow", 3, {226, 134, 155}
+"nRightarrow", 3, {226, 135, 143}
+"nrtri", 3, {226, 139, 171}
+"nrtrie", 3, {226, 139, 173}
+"nsc", 3, {226, 138, 129}
+"nsccue", 3, {226, 139, 161}
+"nsce", 3, {226, 170, 176}
+"Nscr", 4, {240, 157, 146, 169}
+"nscr", 4, {240, 157, 147, 131}
+"nshortmid", 3, {226, 136, 164}
+"nshortparallel", 3, {226, 136, 166}
+"nsim", 3, {226, 137, 129}
+"nsime", 3, {226, 137, 132}
+"nsimeq", 3, {226, 137, 132}
+"nsmid", 3, {226, 136, 164}
+"nspar", 3, {226, 136, 166}
+"nsqsube", 3, {226, 139, 162}
+"nsqsupe", 3, {226, 139, 163}
+"nsub", 3, {226, 138, 132}
+"nsubE", 3, {226, 171, 133}
+"nsube", 3, {226, 138, 136}
+"nsubset", 3, {226, 138, 130}
+"nsubseteq", 3, {226, 138, 136}
+"nsubseteqq", 3, {226, 171, 133}
+"nsucc", 3, {226, 138, 129}
+"nsucceq", 3, {226, 170, 176}
+"nsup", 3, {226, 138, 133}
+"nsupE", 3, {226, 171, 134}
+"nsupe", 3, {226, 138, 137}
+"nsupset", 3, {226, 138, 131}
+"nsupseteq", 3, {226, 138, 137}
+"nsupseteqq", 3, {226, 171, 134}
+"ntgl", 3, {226, 137, 185}
+"Ntilde", 2, {195, 145}
+"ntilde", 2, {195, 177}
+"ntlg", 3, {226, 137, 184}
+"ntriangleleft", 3, {226, 139, 170}
+"ntrianglelefteq", 3, {226, 139, 172}
+"ntriangleright", 3, {226, 139, 171}
+"ntrianglerighteq", 3, {226, 139, 173}
+"Nu", 2, {206, 157}
+"nu", 2, {206, 189}
+"num", 1, {35}
+"numero", 3, {226, 132, 150}
+"numsp", 3, {226, 128, 135}
+"nvap", 3, {226, 137, 141}
+"nvdash", 3, {226, 138, 172}
+"nvDash", 3, {226, 138, 173}
+"nVdash", 3, {226, 138, 174}
+"nVDash", 3, {226, 138, 175}
+"nvge", 3, {226, 137, 165}
+"nvgt", 1, {62}
+"nvHarr", 3, {226, 164, 132}
+"nvinfin", 3, {226, 167, 158}
+"nvlArr", 3, {226, 164, 130}
+"nvle", 3, {226, 137, 164}
+"nvlt", 1, {60}
+"nvltrie", 3, {226, 138, 180}
+"nvrArr", 3, {226, 164, 131}
+"nvrtrie", 3, {226, 138, 181}
+"nvsim", 3, {226, 136, 188}
+"nwarhk", 3, {226, 164, 163}
+"nwarr", 3, {226, 134, 150}
+"nwArr", 3, {226, 135, 150}
+"nwarrow", 3, {226, 134, 150}
+"nwnear", 3, {226, 164, 167}
+"Oacute", 2, {195, 147}
+"oacute", 2, {195, 179}
+"oast", 3, {226, 138, 155}
+"Ocirc", 2, {195, 148}
+"ocirc", 2, {195, 180}
+"ocir", 3, {226, 138, 154}
+"Ocy", 2, {208, 158}
+"ocy", 2, {208, 190}
+"odash", 3, {226, 138, 157}
+"Odblac", 2, {197, 144}
+"odblac", 2, {197, 145}
+"odiv", 3, {226, 168, 184}
+"odot", 3, {226, 138, 153}
+"odsold", 3, {226, 166, 188}
+"OElig", 2, {197, 146}
+"oelig", 2, {197, 147}
+"ofcir", 3, {226, 166, 191}
+"Ofr", 4, {240, 157, 148, 146}
+"ofr", 4, {240, 157, 148, 172}
+"ogon", 2, {203, 155}
+"Ograve", 2, {195, 146}
+"ograve", 2, {195, 178}
+"ogt", 3, {226, 167, 129}
+"ohbar", 3, {226, 166, 181}
+"ohm", 2, {206, 169}
+"oint", 3, {226, 136, 174}
+"olarr", 3, {226, 134, 186}
+"olcir", 3, {226, 166, 190}
+"olcross", 3, {226, 166, 187}
+"oline", 3, {226, 128, 190}
+"olt", 3, {226, 167, 128}
+"Omacr", 2, {197, 140}
+"omacr", 2, {197, 141}
+"Omega", 2, {206, 169}
+"omega", 2, {207, 137}
+"Omicron", 2, {206, 159}
+"omicron", 2, {206, 191}
+"omid", 3, {226, 166, 182}
+"ominus", 3, {226, 138, 150}
+"Oopf", 4, {240, 157, 149, 134}
+"oopf", 4, {240, 157, 149, 160}
+"opar", 3, {226, 166, 183}
+"OpenCurlyDoubleQuote", 3, {226, 128, 156}
+"OpenCurlyQuote", 3, {226, 128, 152}
+"operp", 3, {226, 166, 185}
+"oplus", 3, {226, 138, 149}
+"orarr", 3, {226, 134, 187}
+"Or", 3, {226, 169, 148}
+"or", 3, {226, 136, 168}
+"ord", 3, {226, 169, 157}
+"order", 3, {226, 132, 180}
+"orderof", 3, {226, 132, 180}
+"ordf", 2, {194, 170}
+"ordm", 2, {194, 186}
+"origof", 3, {226, 138, 182}
+"oror", 3, {226, 169, 150}
+"orslope", 3, {226, 169, 151}
+"orv", 3, {226, 169, 155}
+"oS", 3, {226, 147, 136}
+"Oscr", 4, {240, 157, 146, 170}
+"oscr", 3, {226, 132, 180}
+"Oslash", 2, {195, 152}
+"oslash", 2, {195, 184}
+"osol", 3, {226, 138, 152}
+"Otilde", 2, {195, 149}
+"otilde", 2, {195, 181}
+"otimesas", 3, {226, 168, 182}
+"Otimes", 3, {226, 168, 183}
+"otimes", 3, {226, 138, 151}
+"Ouml", 2, {195, 150}
+"ouml", 2, {195, 182}
+"ovbar", 3, {226, 140, 189}
+"OverBar", 3, {226, 128, 190}
+"OverBrace", 3, {226, 143, 158}
+"OverBracket", 3, {226, 142, 180}
+"OverParenthesis", 3, {226, 143, 156}
+"para", 2, {194, 182}
+"parallel", 3, {226, 136, 165}
+"par", 3, {226, 136, 165}
+"parsim", 3, {226, 171, 179}
+"parsl", 3, {226, 171, 189}
+"part", 3, {226, 136, 130}
+"PartialD", 3, {226, 136, 130}
+"Pcy", 2, {208, 159}
+"pcy", 2, {208, 191}
+"percnt", 1, {37}
+"period", 1, {46}
+"permil", 3, {226, 128, 176}
+"perp", 3, {226, 138, 165}
+"pertenk", 3, {226, 128, 177}
+"Pfr", 4, {240, 157, 148, 147}
+"pfr", 4, {240, 157, 148, 173}
+"Phi", 2, {206, 166}
+"phi", 2, {207, 134}
+"phiv", 2, {207, 149}
+"phmmat", 3, {226, 132, 179}
+"phone", 3, {226, 152, 142}
+"Pi", 2, {206, 160}
+"pi", 2, {207, 128}
+"pitchfork", 3, {226, 139, 148}
+"piv", 2, {207, 150}
+"planck", 3, {226, 132, 143}
+"planckh", 3, {226, 132, 142}
+"plankv", 3, {226, 132, 143}
+"plusacir", 3, {226, 168, 163}
+"plusb", 3, {226, 138, 158}
+"pluscir", 3, {226, 168, 162}
+"plus", 1, {43}
+"plusdo", 3, {226, 136, 148}
+"plusdu", 3, {226, 168, 165}
+"pluse", 3, {226, 169, 178}
+"PlusMinus", 2, {194, 177}
+"plusmn", 2, {194, 177}
+"plussim", 3, {226, 168, 166}
+"plustwo", 3, {226, 168, 167}
+"pm", 2, {194, 177}
+"Poincareplane", 3, {226, 132, 140}
+"pointint", 3, {226, 168, 149}
+"popf", 4, {240, 157, 149, 161}
+"Popf", 3, {226, 132, 153}
+"pound", 2, {194, 163}
+"prap", 3, {226, 170, 183}
+"Pr", 3, {226, 170, 187}
+"pr", 3, {226, 137, 186}
+"prcue", 3, {226, 137, 188}
+"precapprox", 3, {226, 170, 183}
+"prec", 3, {226, 137, 186}
+"preccurlyeq", 3, {226, 137, 188}
+"Precedes", 3, {226, 137, 186}
+"PrecedesEqual", 3, {226, 170, 175}
+"PrecedesSlantEqual", 3, {226, 137, 188}
+"PrecedesTilde", 3, {226, 137, 190}
+"preceq", 3, {226, 170, 175}
+"precnapprox", 3, {226, 170, 185}
+"precneqq", 3, {226, 170, 181}
+"precnsim", 3, {226, 139, 168}
+"pre", 3, {226, 170, 175}
+"prE", 3, {226, 170, 179}
+"precsim", 3, {226, 137, 190}
+"prime", 3, {226, 128, 178}
+"Prime", 3, {226, 128, 179}
+"primes", 3, {226, 132, 153}
+"prnap", 3, {226, 170, 185}
+"prnE", 3, {226, 170, 181}
+"prnsim", 3, {226, 139, 168}
+"prod", 3, {226, 136, 143}
+"Product", 3, {226, 136, 143}
+"profalar", 3, {226, 140, 174}
+"profline", 3, {226, 140, 146}
+"profsurf", 3, {226, 140, 147}
+"prop", 3, {226, 136, 157}
+"Proportional", 3, {226, 136, 157}
+"Proportion", 3, {226, 136, 183}
+"propto", 3, {226, 136, 157}
+"prsim", 3, {226, 137, 190}
+"prurel", 3, {226, 138, 176}
+"Pscr", 4, {240, 157, 146, 171}
+"pscr", 4, {240, 157, 147, 133}
+"Psi", 2, {206, 168}
+"psi", 2, {207, 136}
+"puncsp", 3, {226, 128, 136}
+"Qfr", 4, {240, 157, 148, 148}
+"qfr", 4, {240, 157, 148, 174}
+"qint", 3, {226, 168, 140}
+"qopf", 4, {240, 157, 149, 162}
+"Qopf", 3, {226, 132, 154}
+"qprime", 3, {226, 129, 151}
+"Qscr", 4, {240, 157, 146, 172}
+"qscr", 4, {240, 157, 147, 134}
+"quaternions", 3, {226, 132, 141}
+"quatint", 3, {226, 168, 150}
+"quest", 1, {63}
+"questeq", 3, {226, 137, 159}
+"quot", 1, {34}
+"QUOT", 1, {34}
+"rAarr", 3, {226, 135, 155}
+"race", 3, {226, 136, 189}
+"Racute", 2, {197, 148}
+"racute", 2, {197, 149}
+"radic", 3, {226, 136, 154}
+"raemptyv", 3, {226, 166, 179}
+"rang", 3, {226, 159, 169}
+"Rang", 3, {226, 159, 171}
+"rangd", 3, {226, 166, 146}
+"range", 3, {226, 166, 165}
+"rangle", 3, {226, 159, 169}
+"raquo", 2, {194, 187}
+"rarrap", 3, {226, 165, 181}
+"rarrb", 3, {226, 135, 165}
+"rarrbfs", 3, {226, 164, 160}
+"rarrc", 3, {226, 164, 179}
+"rarr", 3, {226, 134, 146}
+"Rarr", 3, {226, 134, 160}
+"rArr", 3, {226, 135, 146}
+"rarrfs", 3, {226, 164, 158}
+"rarrhk", 3, {226, 134, 170}
+"rarrlp", 3, {226, 134, 172}
+"rarrpl", 3, {226, 165, 133}
+"rarrsim", 3, {226, 165, 180}
+"Rarrtl", 3, {226, 164, 150}
+"rarrtl", 3, {226, 134, 163}
+"rarrw", 3, {226, 134, 157}
+"ratail", 3, {226, 164, 154}
+"rAtail", 3, {226, 164, 156}
+"ratio", 3, {226, 136, 182}
+"rationals", 3, {226, 132, 154}
+"rbarr", 3, {226, 164, 141}
+"rBarr", 3, {226, 164, 143}
+"RBarr", 3, {226, 164, 144}
+"rbbrk", 3, {226, 157, 179}
+"rbrace", 1, {125}
+"rbrack", 1, {93}
+"rbrke", 3, {226, 166, 140}
+"rbrksld", 3, {226, 166, 142}
+"rbrkslu", 3, {226, 166, 144}
+"Rcaron", 2, {197, 152}
+"rcaron", 2, {197, 153}
+"Rcedil", 2, {197, 150}
+"rcedil", 2, {197, 151}
+"rceil", 3, {226, 140, 137}
+"rcub", 1, {125}
+"Rcy", 2, {208, 160}
+"rcy", 2, {209, 128}
+"rdca", 3, {226, 164, 183}
+"rdldhar", 3, {226, 165, 169}
+"rdquo", 3, {226, 128, 157}
+"rdquor", 3, {226, 128, 157}
+"rdsh", 3, {226, 134, 179}
+"real", 3, {226, 132, 156}
+"realine", 3, {226, 132, 155}
+"realpart", 3, {226, 132, 156}
+"reals", 3, {226, 132, 157}
+"Re", 3, {226, 132, 156}
+"rect", 3, {226, 150, 173}
+"reg", 2, {194, 174}
+"REG", 2, {194, 174}
+"ReverseElement", 3, {226, 136, 139}
+"ReverseEquilibrium", 3, {226, 135, 139}
+"ReverseUpEquilibrium", 3, {226, 165, 175}
+"rfisht", 3, {226, 165, 189}
+"rfloor", 3, {226, 140, 139}
+"rfr", 4, {240, 157, 148, 175}
+"Rfr", 3, {226, 132, 156}
+"rHar", 3, {226, 165, 164}
+"rhard", 3, {226, 135, 129}
+"rharu", 3, {226, 135, 128}
+"rharul", 3, {226, 165, 172}
+"Rho", 2, {206, 161}
+"rho", 2, {207, 129}
+"rhov", 2, {207, 177}
+"RightAngleBracket", 3, {226, 159, 169}
+"RightArrowBar", 3, {226, 135, 165}
+"rightarrow", 3, {226, 134, 146}
+"RightArrow", 3, {226, 134, 146}
+"Rightarrow", 3, {226, 135, 146}
+"RightArrowLeftArrow", 3, {226, 135, 132}
+"rightarrowtail", 3, {226, 134, 163}
+"RightCeiling", 3, {226, 140, 137}
+"RightDoubleBracket", 3, {226, 159, 167}
+"RightDownTeeVector", 3, {226, 165, 157}
+"RightDownVectorBar", 3, {226, 165, 149}
+"RightDownVector", 3, {226, 135, 130}
+"RightFloor", 3, {226, 140, 139}
+"rightharpoondown", 3, {226, 135, 129}
+"rightharpoonup", 3, {226, 135, 128}
+"rightleftarrows", 3, {226, 135, 132}
+"rightleftharpoons", 3, {226, 135, 140}
+"rightrightarrows", 3, {226, 135, 137}
+"rightsquigarrow", 3, {226, 134, 157}
+"RightTeeArrow", 3, {226, 134, 166}
+"RightTee", 3, {226, 138, 162}
+"RightTeeVector", 3, {226, 165, 155}
+"rightthreetimes", 3, {226, 139, 140}
+"RightTriangleBar", 3, {226, 167, 144}
+"RightTriangle", 3, {226, 138, 179}
+"RightTriangleEqual", 3, {226, 138, 181}
+"RightUpDownVector", 3, {226, 165, 143}
+"RightUpTeeVector", 3, {226, 165, 156}
+"RightUpVectorBar", 3, {226, 165, 148}
+"RightUpVector", 3, {226, 134, 190}
+"RightVectorBar", 3, {226, 165, 147}
+"RightVector", 3, {226, 135, 128}
+"ring", 2, {203, 154}
+"risingdotseq", 3, {226, 137, 147}
+"rlarr", 3, {226, 135, 132}
+"rlhar", 3, {226, 135, 140}
+"rlm", 3, {226, 128, 143}
+"rmoustache", 3, {226, 142, 177}
+"rmoust", 3, {226, 142, 177}
+"rnmid", 3, {226, 171, 174}
+"roang", 3, {226, 159, 173}
+"roarr", 3, {226, 135, 190}
+"robrk", 3, {226, 159, 167}
+"ropar", 3, {226, 166, 134}
+"ropf", 4, {240, 157, 149, 163}
+"Ropf", 3, {226, 132, 157}
+"roplus", 3, {226, 168, 174}
+"rotimes", 3, {226, 168, 181}
+"RoundImplies", 3, {226, 165, 176}
+"rpar", 1, {41}
+"rpargt", 3, {226, 166, 148}
+"rppolint", 3, {226, 168, 146}
+"rrarr", 3, {226, 135, 137}
+"Rrightarrow", 3, {226, 135, 155}
+"rsaquo", 3, {226, 128, 186}
+"rscr", 4, {240, 157, 147, 135}
+"Rscr", 3, {226, 132, 155}
+"rsh", 3, {226, 134, 177}
+"Rsh", 3, {226, 134, 177}
+"rsqb", 1, {93}
+"rsquo", 3, {226, 128, 153}
+"rsquor", 3, {226, 128, 153}
+"rthree", 3, {226, 139, 140}
+"rtimes", 3, {226, 139, 138}
+"rtri", 3, {226, 150, 185}
+"rtrie", 3, {226, 138, 181}
+"rtrif", 3, {226, 150, 184}
+"rtriltri", 3, {226, 167, 142}
+"RuleDelayed", 3, {226, 167, 180}
+"ruluhar", 3, {226, 165, 168}
+"rx", 3, {226, 132, 158}
+"Sacute", 2, {197, 154}
+"sacute", 2, {197, 155}
+"sbquo", 3, {226, 128, 154}
+"scap", 3, {226, 170, 184}
+"Scaron", 2, {197, 160}
+"scaron", 2, {197, 161}
+"Sc", 3, {226, 170, 188}
+"sc", 3, {226, 137, 187}
+"sccue", 3, {226, 137, 189}
+"sce", 3, {226, 170, 176}
+"scE", 3, {226, 170, 180}
+"Scedil", 2, {197, 158}
+"scedil", 2, {197, 159}
+"Scirc", 2, {197, 156}
+"scirc", 2, {197, 157}
+"scnap", 3, {226, 170, 186}
+"scnE", 3, {226, 170, 182}
+"scnsim", 3, {226, 139, 169}
+"scpolint", 3, {226, 168, 147}
+"scsim", 3, {226, 137, 191}
+"Scy", 2, {208, 161}
+"scy", 2, {209, 129}
+"sdotb", 3, {226, 138, 161}
+"sdot", 3, {226, 139, 133}
+"sdote", 3, {226, 169, 166}
+"searhk", 3, {226, 164, 165}
+"searr", 3, {226, 134, 152}
+"seArr", 3, {226, 135, 152}
+"searrow", 3, {226, 134, 152}
+"sect", 2, {194, 167}
+"semi", 1, {59}
+"seswar", 3, {226, 164, 169}
+"setminus", 3, {226, 136, 150}
+"setmn", 3, {226, 136, 150}
+"sext", 3, {226, 156, 182}
+"Sfr", 4, {240, 157, 148, 150}
+"sfr", 4, {240, 157, 148, 176}
+"sfrown", 3, {226, 140, 162}
+"sharp", 3, {226, 153, 175}
+"SHCHcy", 2, {208, 169}
+"shchcy", 2, {209, 137}
+"SHcy", 2, {208, 168}
+"shcy", 2, {209, 136}
+"ShortDownArrow", 3, {226, 134, 147}
+"ShortLeftArrow", 3, {226, 134, 144}
+"shortmid", 3, {226, 136, 163}
+"shortparallel", 3, {226, 136, 165}
+"ShortRightArrow", 3, {226, 134, 146}
+"ShortUpArrow", 3, {226, 134, 145}
+"shy", 2, {194, 173}
+"Sigma", 2, {206, 163}
+"sigma", 2, {207, 131}
+"sigmaf", 2, {207, 130}
+"sigmav", 2, {207, 130}
+"sim", 3, {226, 136, 188}
+"simdot", 3, {226, 169, 170}
+"sime", 3, {226, 137, 131}
+"simeq", 3, {226, 137, 131}
+"simg", 3, {226, 170, 158}
+"simgE", 3, {226, 170, 160}
+"siml", 3, {226, 170, 157}
+"simlE", 3, {226, 170, 159}
+"simne", 3, {226, 137, 134}
+"simplus", 3, {226, 168, 164}
+"simrarr", 3, {226, 165, 178}
+"slarr", 3, {226, 134, 144}
+"SmallCircle", 3, {226, 136, 152}
+"smallsetminus", 3, {226, 136, 150}
+"smashp", 3, {226, 168, 179}
+"smeparsl", 3, {226, 167, 164}
+"smid", 3, {226, 136, 163}
+"smile", 3, {226, 140, 163}
+"smt", 3, {226, 170, 170}
+"smte", 3, {226, 170, 172}
+"smtes", 3, {226, 170, 172}
+"SOFTcy", 2, {208, 172}
+"softcy", 2, {209, 140}
+"solbar", 3, {226, 140, 191}
+"solb", 3, {226, 167, 132}
+"sol", 1, {47}
+"Sopf", 4, {240, 157, 149, 138}
+"sopf", 4, {240, 157, 149, 164}
+"spades", 3, {226, 153, 160}
+"spadesuit", 3, {226, 153, 160}
+"spar", 3, {226, 136, 165}
+"sqcap", 3, {226, 138, 147}
+"sqcaps", 3, {226, 138, 147}
+"sqcup", 3, {226, 138, 148}
+"sqcups", 3, {226, 138, 148}
+"Sqrt", 3, {226, 136, 154}
+"sqsub", 3, {226, 138, 143}
+"sqsube", 3, {226, 138, 145}
+"sqsubset", 3, {226, 138, 143}
+"sqsubseteq", 3, {226, 138, 145}
+"sqsup", 3, {226, 138, 144}
+"sqsupe", 3, {226, 138, 146}
+"sqsupset", 3, {226, 138, 144}
+"sqsupseteq", 3, {226, 138, 146}
+"square", 3, {226, 150, 161}
+"Square", 3, {226, 150, 161}
+"SquareIntersection", 3, {226, 138, 147}
+"SquareSubset", 3, {226, 138, 143}
+"SquareSubsetEqual", 3, {226, 138, 145}
+"SquareSuperset", 3, {226, 138, 144}
+"SquareSupersetEqual", 3, {226, 138, 146}
+"SquareUnion", 3, {226, 138, 148}
+"squarf", 3, {226, 150, 170}
+"squ", 3, {226, 150, 161}
+"squf", 3, {226, 150, 170}
+"srarr", 3, {226, 134, 146}
+"Sscr", 4, {240, 157, 146, 174}
+"sscr", 4, {240, 157, 147, 136}
+"ssetmn", 3, {226, 136, 150}
+"ssmile", 3, {226, 140, 163}
+"sstarf", 3, {226, 139, 134}
+"Star", 3, {226, 139, 134}
+"star", 3, {226, 152, 134}
+"starf", 3, {226, 152, 133}
+"straightepsilon", 2, {207, 181}
+"straightphi", 2, {207, 149}
+"strns", 2, {194, 175}
+"sub", 3, {226, 138, 130}
+"Sub", 3, {226, 139, 144}
+"subdot", 3, {226, 170, 189}
+"subE", 3, {226, 171, 133}
+"sube", 3, {226, 138, 134}
+"subedot", 3, {226, 171, 131}
+"submult", 3, {226, 171, 129}
+"subnE", 3, {226, 171, 139}
+"subne", 3, {226, 138, 138}
+"subplus", 3, {226, 170, 191}
+"subrarr", 3, {226, 165, 185}
+"subset", 3, {226, 138, 130}
+"Subset", 3, {226, 139, 144}
+"subseteq", 3, {226, 138, 134}
+"subseteqq", 3, {226, 171, 133}
+"SubsetEqual", 3, {226, 138, 134}
+"subsetneq", 3, {226, 138, 138}
+"subsetneqq", 3, {226, 171, 139}
+"subsim", 3, {226, 171, 135}
+"subsub", 3, {226, 171, 149}
+"subsup", 3, {226, 171, 147}
+"succapprox", 3, {226, 170, 184}
+"succ", 3, {226, 137, 187}
+"succcurlyeq", 3, {226, 137, 189}
+"Succeeds", 3, {226, 137, 187}
+"SucceedsEqual", 3, {226, 170, 176}
+"SucceedsSlantEqual", 3, {226, 137, 189}
+"SucceedsTilde", 3, {226, 137, 191}
+"succeq", 3, {226, 170, 176}
+"succnapprox", 3, {226, 170, 186}
+"succneqq", 3, {226, 170, 182}
+"succnsim", 3, {226, 139, 169}
+"succsim", 3, {226, 137, 191}
+"SuchThat", 3, {226, 136, 139}
+"sum", 3, {226, 136, 145}
+"Sum", 3, {226, 136, 145}
+"sung", 3, {226, 153, 170}
+"sup1", 2, {194, 185}
+"sup2", 2, {194, 178}
+"sup3", 2, {194, 179}
+"sup", 3, {226, 138, 131}
+"Sup", 3, {226, 139, 145}
+"supdot", 3, {226, 170, 190}
+"supdsub", 3, {226, 171, 152}
+"supE", 3, {226, 171, 134}
+"supe", 3, {226, 138, 135}
+"supedot", 3, {226, 171, 132}
+"Superset", 3, {226, 138, 131}
+"SupersetEqual", 3, {226, 138, 135}
+"suphsol", 3, {226, 159, 137}
+"suphsub", 3, {226, 171, 151}
+"suplarr", 3, {226, 165, 187}
+"supmult", 3, {226, 171, 130}
+"supnE", 3, {226, 171, 140}
+"supne", 3, {226, 138, 139}
+"supplus", 3, {226, 171, 128}
+"supset", 3, {226, 138, 131}
+"Supset", 3, {226, 139, 145}
+"supseteq", 3, {226, 138, 135}
+"supseteqq", 3, {226, 171, 134}
+"supsetneq", 3, {226, 138, 139}
+"supsetneqq", 3, {226, 171, 140}
+"supsim", 3, {226, 171, 136}
+"supsub", 3, {226, 171, 148}
+"supsup", 3, {226, 171, 150}
+"swarhk", 3, {226, 164, 166}
+"swarr", 3, {226, 134, 153}
+"swArr", 3, {226, 135, 153}
+"swarrow", 3, {226, 134, 153}
+"swnwar", 3, {226, 164, 170}
+"szlig", 2, {195, 159}
+"Tab", 1, {9}
+"target", 3, {226, 140, 150}
+"Tau", 2, {206, 164}
+"tau", 2, {207, 132}
+"tbrk", 3, {226, 142, 180}
+"Tcaron", 2, {197, 164}
+"tcaron", 2, {197, 165}
+"Tcedil", 2, {197, 162}
+"tcedil", 2, {197, 163}
+"Tcy", 2, {208, 162}
+"tcy", 2, {209, 130}
+"tdot", 3, {226, 131, 155}
+"telrec", 3, {226, 140, 149}
+"Tfr", 4, {240, 157, 148, 151}
+"tfr", 4, {240, 157, 148, 177}
+"there4", 3, {226, 136, 180}
+"therefore", 3, {226, 136, 180}
+"Therefore", 3, {226, 136, 180}
+"Theta", 2, {206, 152}
+"theta", 2, {206, 184}
+"thetasym", 2, {207, 145}
+"thetav", 2, {207, 145}
+"thickapprox", 3, {226, 137, 136}
+"thicksim", 3, {226, 136, 188}
+"ThickSpace", 3, {226, 129, 159}
+"ThinSpace", 3, {226, 128, 137}
+"thinsp", 3, {226, 128, 137}
+"thkap", 3, {226, 137, 136}
+"thksim", 3, {226, 136, 188}
+"THORN", 2, {195, 158}
+"thorn", 2, {195, 190}
+"tilde", 2, {203, 156}
+"Tilde", 3, {226, 136, 188}
+"TildeEqual", 3, {226, 137, 131}
+"TildeFullEqual", 3, {226, 137, 133}
+"TildeTilde", 3, {226, 137, 136}
+"timesbar", 3, {226, 168, 177}
+"timesb", 3, {226, 138, 160}
+"times", 2, {195, 151}
+"timesd", 3, {226, 168, 176}
+"tint", 3, {226, 136, 173}
+"toea", 3, {226, 164, 168}
+"topbot", 3, {226, 140, 182}
+"topcir", 3, {226, 171, 177}
+"top", 3, {226, 138, 164}
+"Topf", 4, {240, 157, 149, 139}
+"topf", 4, {240, 157, 149, 165}
+"topfork", 3, {226, 171, 154}
+"tosa", 3, {226, 164, 169}
+"tprime", 3, {226, 128, 180}
+"trade", 3, {226, 132, 162}
+"TRADE", 3, {226, 132, 162}
+"triangle", 3, {226, 150, 181}
+"triangledown", 3, {226, 150, 191}
+"triangleleft", 3, {226, 151, 131}
+"trianglelefteq", 3, {226, 138, 180}
+"triangleq", 3, {226, 137, 156}
+"triangleright", 3, {226, 150, 185}
+"trianglerighteq", 3, {226, 138, 181}
+"tridot", 3, {226, 151, 172}
+"trie", 3, {226, 137, 156}
+"triminus", 3, {226, 168, 186}
+"TripleDot", 3, {226, 131, 155}
+"triplus", 3, {226, 168, 185}
+"trisb", 3, {226, 167, 141}
+"tritime", 3, {226, 168, 187}
+"trpezium", 3, {226, 143, 162}
+"Tscr", 4, {240, 157, 146, 175}
+"tscr", 4, {240, 157, 147, 137}
+"TScy", 2, {208, 166}
+"tscy", 2, {209, 134}
+"TSHcy", 2, {208, 139}
+"tshcy", 2, {209, 155}
+"Tstrok", 2, {197, 166}
+"tstrok", 2, {197, 167}
+"twixt", 3, {226, 137, 172}
+"twoheadleftarrow", 3, {226, 134, 158}
+"twoheadrightarrow", 3, {226, 134, 160}
+"Uacute", 2, {195, 154}
+"uacute", 2, {195, 186}
+"uarr", 3, {226, 134, 145}
+"Uarr", 3, {226, 134, 159}
+"uArr", 3, {226, 135, 145}
+"Uarrocir", 3, {226, 165, 137}
+"Ubrcy", 2, {208, 142}
+"ubrcy", 2, {209, 158}
+"Ubreve", 2, {197, 172}
+"ubreve", 2, {197, 173}
+"Ucirc", 2, {195, 155}
+"ucirc", 2, {195, 187}
+"Ucy", 2, {208, 163}
+"ucy", 2, {209, 131}
+"udarr", 3, {226, 135, 133}
+"Udblac", 2, {197, 176}
+"udblac", 2, {197, 177}
+"udhar", 3, {226, 165, 174}
+"ufisht", 3, {226, 165, 190}
+"Ufr", 4, {240, 157, 148, 152}
+"ufr", 4, {240, 157, 148, 178}
+"Ugrave", 2, {195, 153}
+"ugrave", 2, {195, 185}
+"uHar", 3, {226, 165, 163}
+"uharl", 3, {226, 134, 191}
+"uharr", 3, {226, 134, 190}
+"uhblk", 3, {226, 150, 128}
+"ulcorn", 3, {226, 140, 156}
+"ulcorner", 3, {226, 140, 156}
+"ulcrop", 3, {226, 140, 143}
+"ultri", 3, {226, 151, 184}
+"Umacr", 2, {197, 170}
+"umacr", 2, {197, 171}
+"uml", 2, {194, 168}
+"UnderBar", 1, {95}
+"UnderBrace", 3, {226, 143, 159}
+"UnderBracket", 3, {226, 142, 181}
+"UnderParenthesis", 3, {226, 143, 157}
+"Union", 3, {226, 139, 131}
+"UnionPlus", 3, {226, 138, 142}
+"Uogon", 2, {197, 178}
+"uogon", 2, {197, 179}
+"Uopf", 4, {240, 157, 149, 140}
+"uopf", 4, {240, 157, 149, 166}
+"UpArrowBar", 3, {226, 164, 146}
+"uparrow", 3, {226, 134, 145}
+"UpArrow", 3, {226, 134, 145}
+"Uparrow", 3, {226, 135, 145}
+"UpArrowDownArrow", 3, {226, 135, 133}
+"updownarrow", 3, {226, 134, 149}
+"UpDownArrow", 3, {226, 134, 149}
+"Updownarrow", 3, {226, 135, 149}
+"UpEquilibrium", 3, {226, 165, 174}
+"upharpoonleft", 3, {226, 134, 191}
+"upharpoonright", 3, {226, 134, 190}
+"uplus", 3, {226, 138, 142}
+"UpperLeftArrow", 3, {226, 134, 150}
+"UpperRightArrow", 3, {226, 134, 151}
+"upsi", 2, {207, 133}
+"Upsi", 2, {207, 146}
+"upsih", 2, {207, 146}
+"Upsilon", 2, {206, 165}
+"upsilon", 2, {207, 133}
+"UpTeeArrow", 3, {226, 134, 165}
+"UpTee", 3, {226, 138, 165}
+"upuparrows", 3, {226, 135, 136}
+"urcorn", 3, {226, 140, 157}
+"urcorner", 3, {226, 140, 157}
+"urcrop", 3, {226, 140, 142}
+"Uring", 2, {197, 174}
+"uring", 2, {197, 175}
+"urtri", 3, {226, 151, 185}
+"Uscr", 4, {240, 157, 146, 176}
+"uscr", 4, {240, 157, 147, 138}
+"utdot", 3, {226, 139, 176}
+"Utilde", 2, {197, 168}
+"utilde", 2, {197, 169}
+"utri", 3, {226, 150, 181}
+"utrif", 3, {226, 150, 180}
+"uuarr", 3, {226, 135, 136}
+"Uuml", 2, {195, 156}
+"uuml", 2, {195, 188}
+"uwangle", 3, {226, 166, 167}
+"vangrt", 3, {226, 166, 156}
+"varepsilon", 2, {207, 181}
+"varkappa", 2, {207, 176}
+"varnothing", 3, {226, 136, 133}
+"varphi", 2, {207, 149}
+"varpi", 2, {207, 150}
+"varpropto", 3, {226, 136, 157}
+"varr", 3, {226, 134, 149}
+"vArr", 3, {226, 135, 149}
+"varrho", 2, {207, 177}
+"varsigma", 2, {207, 130}
+"varsubsetneq", 3, {226, 138, 138}
+"varsubsetneqq", 3, {226, 171, 139}
+"varsupsetneq", 3, {226, 138, 139}
+"varsupsetneqq", 3, {226, 171, 140}
+"vartheta", 2, {207, 145}
+"vartriangleleft", 3, {226, 138, 178}
+"vartriangleright", 3, {226, 138, 179}
+"vBar", 3, {226, 171, 168}
+"Vbar", 3, {226, 171, 171}
+"vBarv", 3, {226, 171, 169}
+"Vcy", 2, {208, 146}
+"vcy", 2, {208, 178}
+"vdash", 3, {226, 138, 162}
+"vDash", 3, {226, 138, 168}
+"Vdash", 3, {226, 138, 169}
+"VDash", 3, {226, 138, 171}
+"Vdashl", 3, {226, 171, 166}
+"veebar", 3, {226, 138, 187}
+"vee", 3, {226, 136, 168}
+"Vee", 3, {226, 139, 129}
+"veeeq", 3, {226, 137, 154}
+"vellip", 3, {226, 139, 174}
+"verbar", 1, {124}
+"Verbar", 3, {226, 128, 150}
+"vert", 1, {124}
+"Vert", 3, {226, 128, 150}
+"VerticalBar", 3, {226, 136, 163}
+"VerticalLine", 1, {124}
+"VerticalSeparator", 3, {226, 157, 152}
+"VerticalTilde", 3, {226, 137, 128}
+"VeryThinSpace", 3, {226, 128, 138}
+"Vfr", 4, {240, 157, 148, 153}
+"vfr", 4, {240, 157, 148, 179}
+"vltri", 3, {226, 138, 178}
+"vnsub", 3, {226, 138, 130}
+"vnsup", 3, {226, 138, 131}
+"Vopf", 4, {240, 157, 149, 141}
+"vopf", 4, {240, 157, 149, 167}
+"vprop", 3, {226, 136, 157}
+"vrtri", 3, {226, 138, 179}
+"Vscr", 4, {240, 157, 146, 177}
+"vscr", 4, {240, 157, 147, 139}
+"vsubnE", 3, {226, 171, 139}
+"vsubne", 3, {226, 138, 138}
+"vsupnE", 3, {226, 171, 140}
+"vsupne", 3, {226, 138, 139}
+"Vvdash", 3, {226, 138, 170}
+"vzigzag", 3, {226, 166, 154}
+"Wcirc", 2, {197, 180}
+"wcirc", 2, {197, 181}
+"wedbar", 3, {226, 169, 159}
+"wedge", 3, {226, 136, 167}
+"Wedge", 3, {226, 139, 128}
+"wedgeq", 3, {226, 137, 153}
+"weierp", 3, {226, 132, 152}
+"Wfr", 4, {240, 157, 148, 154}
+"wfr", 4, {240, 157, 148, 180}
+"Wopf", 4, {240, 157, 149, 142}
+"wopf", 4, {240, 157, 149, 168}
+"wp", 3, {226, 132, 152}
+"wr", 3, {226, 137, 128}
+"wreath", 3, {226, 137, 128}
+"Wscr", 4, {240, 157, 146, 178}
+"wscr", 4, {240, 157, 147, 140}
+"xcap", 3, {226, 139, 130}
+"xcirc", 3, {226, 151, 175}
+"xcup", 3, {226, 139, 131}
+"xdtri", 3, {226, 150, 189}
+"Xfr", 4, {240, 157, 148, 155}
+"xfr", 4, {240, 157, 148, 181}
+"xharr", 3, {226, 159, 183}
+"xhArr", 3, {226, 159, 186}
+"Xi", 2, {206, 158}
+"xi", 2, {206, 190}
+"xlarr", 3, {226, 159, 181}
+"xlArr", 3, {226, 159, 184}
+"xmap", 3, {226, 159, 188}
+"xnis", 3, {226, 139, 187}
+"xodot", 3, {226, 168, 128}
+"Xopf", 4, {240, 157, 149, 143}
+"xopf", 4, {240, 157, 149, 169}
+"xoplus", 3, {226, 168, 129}
+"xotime", 3, {226, 168, 130}
+"xrarr", 3, {226, 159, 182}
+"xrArr", 3, {226, 159, 185}
+"Xscr", 4, {240, 157, 146, 179}
+"xscr", 4, {240, 157, 147, 141}
+"xsqcup", 3, {226, 168, 134}
+"xuplus", 3, {226, 168, 132}
+"xutri", 3, {226, 150, 179}
+"xvee", 3, {226, 139, 129}
+"xwedge", 3, {226, 139, 128}
+"Yacute", 2, {195, 157}
+"yacute", 2, {195, 189}
+"YAcy", 2, {208, 175}
+"yacy", 2, {209, 143}
+"Ycirc", 2, {197, 182}
+"ycirc", 2, {197, 183}
+"Ycy", 2, {208, 171}
+"ycy", 2, {209, 139}
+"yen", 2, {194, 165}
+"Yfr", 4, {240, 157, 148, 156}
+"yfr", 4, {240, 157, 148, 182}
+"YIcy", 2, {208, 135}
+"yicy", 2, {209, 151}
+"Yopf", 4, {240, 157, 149, 144}
+"yopf", 4, {240, 157, 149, 170}
+"Yscr", 4, {240, 157, 146, 180}
+"yscr", 4, {240, 157, 147, 142}
+"YUcy", 2, {208, 174}
+"yucy", 2, {209, 142}
+"yuml", 2, {195, 191}
+"Yuml", 2, {197, 184}
+"Zacute", 2, {197, 185}
+"zacute", 2, {197, 186}
+"Zcaron", 2, {197, 189}
+"zcaron", 2, {197, 190}
+"Zcy", 2, {208, 151}
+"zcy", 2, {208, 183}
+"Zdot", 2, {197, 187}
+"zdot", 2, {197, 188}
+"zeetrf", 3, {226, 132, 168}
+"ZeroWidthSpace", 3, {226, 128, 139}
+"Zeta", 2, {206, 150}
+"zeta", 2, {206, 182}
+"zfr", 4, {240, 157, 148, 183}
+"Zfr", 3, {226, 132, 168}
+"ZHcy", 2, {208, 150}
+"zhcy", 2, {208, 182}
+"zigrarr", 3, {226, 135, 157}
+"zopf", 4, {240, 157, 149, 171}
+"Zopf", 3, {226, 132, 164}
+"Zscr", 4, {240, 157, 146, 181}
+"zscr", 4, {240, 157, 147, 143}
+"zwj", 3, {226, 128, 141}
+"zwnj", 3, {226, 128, 140}
diff --git a/src/html/html_unescape.h b/src/html/html_unescape.h
@@ -0,0 +1,9746 @@
+/* C code produced by gperf version 3.0.4 */
+/* Command-line: gperf -I -t -N find_entity -H hash_entity -K entity -C -l --null-strings -m5 src/html/html_unescape.gperf  */
+/* Computed positions: -k'1-7,10,12,$' */
+
+#if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \
+      && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \
+      && (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) \
+      && ('-' == 45) && ('.' == 46) && ('/' == 47) && ('0' == 48) \
+      && ('1' == 49) && ('2' == 50) && ('3' == 51) && ('4' == 52) \
+      && ('5' == 53) && ('6' == 54) && ('7' == 55) && ('8' == 56) \
+      && ('9' == 57) && (':' == 58) && (';' == 59) && ('<' == 60) \
+      && ('=' == 61) && ('>' == 62) && ('?' == 63) && ('A' == 65) \
+      && ('B' == 66) && ('C' == 67) && ('D' == 68) && ('E' == 69) \
+      && ('F' == 70) && ('G' == 71) && ('H' == 72) && ('I' == 73) \
+      && ('J' == 74) && ('K' == 75) && ('L' == 76) && ('M' == 77) \
+      && ('N' == 78) && ('O' == 79) && ('P' == 80) && ('Q' == 81) \
+      && ('R' == 82) && ('S' == 83) && ('T' == 84) && ('U' == 85) \
+      && ('V' == 86) && ('W' == 87) && ('X' == 88) && ('Y' == 89) \
+      && ('Z' == 90) && ('[' == 91) && ('\\' == 92) && (']' == 93) \
+      && ('^' == 94) && ('_' == 95) && ('a' == 97) && ('b' == 98) \
+      && ('c' == 99) && ('d' == 100) && ('e' == 101) && ('f' == 102) \
+      && ('g' == 103) && ('h' == 104) && ('i' == 105) && ('j' == 106) \
+      && ('k' == 107) && ('l' == 108) && ('m' == 109) && ('n' == 110) \
+      && ('o' == 111) && ('p' == 112) && ('q' == 113) && ('r' == 114) \
+      && ('s' == 115) && ('t' == 116) && ('u' == 117) && ('v' == 118) \
+      && ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \
+      && ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126))
+/* The character set is not based on ISO-646.  */
+error "gperf generated tables don't work with this execution character set. Please report a bug to <bug-gnu-gperf@gnu.org>."
+#endif
+
+#line 1 "src/html/html_unescape.gperf"
+struct html_ent {
+	const char *entity;
+	unsigned int utf8_len;
+	unsigned char utf8[4];
+};
+#include <string.h>
+
+#define TOTAL_KEYWORDS 2125
+#define MIN_WORD_LENGTH 2
+#define MAX_WORD_LENGTH 31
+#define MIN_HASH_VALUE 39
+#define MAX_HASH_VALUE 16000
+/* maximum key range = 15962, duplicates = 0 */
+
+#ifdef __GNUC__
+__inline
+#else
+#ifdef __cplusplus
+inline
+#endif
+#endif
+static unsigned int
+hash_entity (str, len)
+     register const char *str;
+     register unsigned int len;
+{
+  static const unsigned short asso_values[] =
+    {
+      16001, 16001, 16001, 16001, 16001, 16001, 16001, 16001, 16001, 16001,
+      16001, 16001, 16001, 16001, 16001, 16001, 16001, 16001, 16001, 16001,
+      16001, 16001, 16001, 16001, 16001, 16001, 16001, 16001, 16001, 16001,
+      16001, 16001, 16001, 16001, 16001, 16001, 16001, 16001, 16001, 16001,
+      16001, 16001, 16001, 16001, 16001, 16001, 16001, 16001, 16001,     2,
+          3,     7,     2,     4,     8, 16001,    10, 16001, 16001, 16001,
+      16001, 16001, 16001, 16001, 16001,  1890,  1538,   220,   165,  1045,
+        535,  1971,  1187,  1262,    35,   126,   201,   133,   350,  1487,
+       1965,     3,   478,   134,     8,   147,    73,    41,    23,   212,
+          9, 16001,     2, 16001,     2, 16001, 16001,  4154,    29,  3168,
+        429,    10,   146,  1925,  2307,   280,  1313,  1924,     4,   651,
+         27,  1031,    65,   176,     2,     6,    17,    15,   107,   482,
+       3207,  3865,   757,   131,   178,     4,     4, 16001, 16001, 16001,
+      16001, 16001, 16001, 16001, 16001, 16001, 16001, 16001, 16001, 16001,
+      16001, 16001, 16001, 16001, 16001, 16001, 16001, 16001, 16001, 16001,
+      16001, 16001, 16001, 16001, 16001, 16001, 16001, 16001, 16001, 16001,
+      16001, 16001, 16001, 16001, 16001, 16001, 16001, 16001, 16001, 16001,
+      16001, 16001, 16001, 16001, 16001, 16001, 16001, 16001, 16001, 16001,
+      16001, 16001, 16001, 16001, 16001, 16001, 16001, 16001, 16001, 16001,
+      16001, 16001, 16001, 16001, 16001, 16001, 16001, 16001, 16001, 16001,
+      16001, 16001, 16001, 16001, 16001, 16001, 16001, 16001, 16001, 16001,
+      16001, 16001, 16001, 16001, 16001, 16001, 16001, 16001, 16001, 16001,
+      16001, 16001, 16001, 16001, 16001, 16001, 16001, 16001, 16001, 16001,
+      16001, 16001, 16001, 16001, 16001, 16001, 16001, 16001, 16001, 16001,
+      16001, 16001, 16001, 16001, 16001, 16001, 16001, 16001, 16001, 16001,
+      16001, 16001, 16001, 16001, 16001, 16001, 16001, 16001, 16001, 16001
+    };
+  register int hval = len;
+
+  switch (hval)
+    {
+      default:
+        hval += asso_values[(unsigned char)str[11]];
+      /*FALLTHROUGH*/
+      case 11:
+      case 10:
+        hval += asso_values[(unsigned char)str[9]];
+      /*FALLTHROUGH*/
+      case 9:
+      case 8:
+      case 7:
+        hval += asso_values[(unsigned char)str[6]];
+      /*FALLTHROUGH*/
+      case 6:
+        hval += asso_values[(unsigned char)str[5]];
+      /*FALLTHROUGH*/
+      case 5:
+        hval += asso_values[(unsigned char)str[4]+1];
+      /*FALLTHROUGH*/
+      case 4:
+        hval += asso_values[(unsigned char)str[3]+3];
+      /*FALLTHROUGH*/
+      case 3:
+        hval += asso_values[(unsigned char)str[2]+1];
+      /*FALLTHROUGH*/
+      case 2:
+        hval += asso_values[(unsigned char)str[1]+4];
+      /*FALLTHROUGH*/
+      case 1:
+        hval += asso_values[(unsigned char)str[0]];
+        break;
+    }
+  return hval + asso_values[(unsigned char)str[len - 1]];
+}
+
+#ifdef __GNUC__
+__inline
+#if defined __GNUC_STDC_INLINE__ || defined __GNUC_GNU_INLINE__
+__attribute__ ((__gnu_inline__))
+#endif
+#endif
+const struct html_ent *
+find_entity (str, len)
+     register const char *str;
+     register unsigned int len;
+{
+  static const unsigned char lengthtable[] =
+    {
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  4,  0,  4,
+       0,  0,  0,  0,  0,  0,  0,  3,  0,  0,  4,  0,  0,  3,
+       0,  0,  0,  0,  0,  0,  6,  0,  6,  5,  0,  5,  3,  4,
+       3,  4,  0,  4,  0,  2,  5,  4,  0,  0,  0,  2,  0,  7,
+       0,  7,  3,  0,  5,  0,  0,  0,  0,  0,  4,  0,  0,  6,
+       0,  0,  0,  3,  6,  0,  4,  0,  0,  0,  0,  6,  4,  5,
+       0,  0,  0,  5,  0,  5,  0,  6,  0,  0,  0,  4,  5,  5,
+       5,  3,  5,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,
+       0,  0,  0,  3,  4,  0,  3,  0,  0,  5,  0,  0,  3,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,  5,  0,
+       5,  0,  5,  6,  0,  6,  5,  0,  2,  5,  0,  5,  0,  0,
+       0,  0,  4,  0,  0,  0,  3,  0,  3,  5,  0,  0,  5,  0,
+       0,  0,  6,  0, 10,  0,  4,  0,  0,  5,  3,  5,  0,  0,
+       0,  0,  0,  0,  0,  5,  0,  3,  0,  0,  0,  0,  6,  6,
+       0,  6,  0,  0,  0,  0,  6,  0,  6,  0,  2,  0,  0,  0,
+       4,  7,  0,  7,  0,  5,  0,  0,  0,  0,  0,  0,  0,  3,
+       0,  4,  0,  4,  6,  0,  3,  0,  0,  0,  0,  0,  0,  4,
+       4,  3,  0,  4,  0,  0,  2,  0,  0,  0,  4,  0,  4,  0,
+       0,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+      13,  0,  2,  0,  0,  0,  5,  0,  2,  0,  0,  0,  0,  0,
+       0,  0,  3,  2,  4,  0,  6,  0,  0,  3,  0,  2,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  6,  0,  3,  4,  0,  0,  0,
+       0,  4,  6,  0,  0,  0,  5,  5,  5,  0, 13,  0,  0,  4,
+       0,  0,  5,  0,  4,  4,  5, 17, 18,  0,  0,  0,  0,  0,
+       5,  0,  0, 17,  0,  0,  0,  0,  0,  5,  5,  0,  0,  0,
+       5,  5,  0,  0,  0,  8,  0,  0,  0,  3,  0,  0,  6,  3,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  4,  0,  0,  0,  5,  6,  0,  0,
+       0,  4,  0,  0,  5,  0,  6,  6,  6,  6,  6,  6,  6,  0,
+       0,  6,  0,  6,  0,  6,  6,  6,  6,  6,  6,  0,  0,  0,
+       6,  0,  6,  3,  4,  0,  0,  4,  3,  5,  0,  0,  3,  0,
+       0,  0, 11,  5,  0,  0,  0,  4,  0,  0,  6,  0,  0,  0,
+       5,  0,  0,  0,  5,  0,  5,  0,  0,  0,  0,  0,  0,  0,
+       0,  5,  0,  0,  0,  0,  0,  5,  3,  0,  0,  4,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  5,  0,  4,  0,  4,
+       0,  0,  0,  0,  0,  0,  6,  0,  0,  5,  0,  0,  0,  0,
+       3,  6,  0,  0,  0,  0,  0,  8,  8,  0,  0,  0,  4,  6,
+       0,  0,  8,  0,  8,  0,  2,  0,  0,  0,  0,  4,  0,  0,
+       0,  4,  0,  6,  0,  0,  0,  0,  6,  0,  4,  0,  0,  0,
+       0,  6,  0,  5,  6,  2,  5,  8,  5,  0,  0,  4,  0,  4,
+       0,  0,  0,  0,  8,  0,  0,  0,  0,  0,  9,  0,  4,  4,
+       4,  0,  4,  6,  4,  4,  4,  0,  0,  0,  5,  4,  5,  4,
+       0,  0,  0,  0,  0,  4,  0,  0,  0,  4,  0,  4,  5,  4,
+       5,  0,  0,  4,  0,  5,  0,  0,  0,  4,  0,  0,  0,  0,
+       4,  4,  0,  5,  0,  0, 11,  0,  0,  6,  0,  0,  3,  0,
+       0,  0,  0,  6,  0,  4,  0,  0,  4,  0,  0,  0,  0,  4,
+       0,  0,  0,  0,  7,  4,  4,  0,  7,  0,  0,  0,  0,  0,
+       5,  0,  0,  0,  3,  8,  4,  0,  0,  0,  5,  0,  6,  0,
+       0,  0,  0,  6,  0,  4,  0,  0,  0,  5,  0,  6,  0,  0,
+       0,  5,  5,  0,  0,  3,  6,  2,  0,  0,  4,  0,  0,  7,
+       0,  4,  0,  4,  4,  4,  3,  5,  0,  0,  0,  0,  0,  0,
+       6,  0,  4,  4,  0,  0,  0, 12, 13,  0,  0,  6,  8,  0,
+       2,  0,  0, 17,  0,  0,  0,  4,  0,  5,  0,  7,  0,  5,
+       0,  0,  0,  5,  4,  5,  0,  0,  3,  0,  0,  0,  5,  0,
+       5, 12, 13,  0,  7,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  4,  0,  0,  0,  7,  0,  0,  6,  6,  6,  0,  4,  0,
+       0,  0,  0, 17,  0,  0,  4,  5,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  5,  3,  6,  9,  0,  0,
+       0,  9,  0,  0,  0,  0,  0,  6,  4,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0, 19,  0,  5,  0,  0, 17,  0,  0,
+      14,  0,  0,  0,  0, 12,  4,  0,  0,  0,  4,  0,  2,  0,
+       4,  0,  6,  0,  0,  3,  0,  0,  0,  3,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 10,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  4,  4,  4,  0,
+       4,  0,  4,  4,  4,  0,  0,  0,  0,  4,  0,  4,  0,  4,
+       9,  0,  0,  4,  2,  0,  0,  4,  2,  4,  4,  0,  0,  0,
+       0,  4,  6,  0,  0,  6,  9,  4,  0,  6,  0,  0,  0,  0,
+       0,  0,  0,  0,  5,  0,  0,  0,  0,  0,  0,  6,  0,  0,
+       0,  0,  0,  4,  2,  0,  0,  0,  0,  0,  0,  4,  0,  0,
+       0,  0,  0,  5,  0,  0,  0,  0,  0,  0,  0,  0,  0,  5,
+       0,  0,  0,  0,  0,  0, 10,  0,  0,  0, 10,  6,  0,  0,
+       0,  0,  6,  4,  6,  4,  0,  0,  0,  0,  0,  0,  0,  5,
+       0,  0,  0,  0,  0,  9,  0,  0,  4,  0,  0,  0,  0,  0,
+       7,  4,  4,  7,  0,  7,  5,  0,  0,  6,  4,  4,  4,  0,
+       4,  4,  0,  0,  0,  0,  0,  0,  0,  4,  0,  0,  4,  0,
+       0,  0,  4,  0,  0,  4,  4,  6,  0,  0,  0,  3,  5,  3,
+       5, 11,  4,  0,  0,  4,  0,  0,  0,  5,  0,  0,  0,  0,
+       7,  0,  0,  0,  0,  5,  0,  5,  0,  0,  0,  3,  5,  4,
+       0,  0,  0,  5,  0,  6,  9,  7,  2,  0,  4,  0,  0,  4,
+       0,  0,  0,  0,  4,  5,  6,  0,  0,  0,  0,  9, 10,  0,
+       0,  0,  5,  0,  0,  0,  0, 11,  0,  0,  6,  0,  0,  0,
+       0,  0,  0,  4,  8,  6,  0,  0,  0,  0,  0,  8,  0,  0,
+       0,  0,  0,  0,  0,  5,  6,  0,  0,  0, 13,  5,  5,  6,
+       0,  0,  0,  0,  2,  0,  0,  0,  4,  2,  4,  0,  0,  6,
+       4,  0,  4,  0,  0,  0,  4,  0, 21,  0,  0,  0,  6,  0,
+       3,  0,  0,  0,  6,  6,  0,  3, 13,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  6,  0,  0,  7,  0,  0,  0,  0,
+       0,  0,  0,  4,  0,  0,  0,  0,  0,  0,  3,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  5,  0,  4,  0,  6,  0,  0,  0,
+       0,  0,  0,  0,  6,  0,  0,  0,  0,  0,  7,  3,  0,  0,
+       0,  0,  0,  0,  0,  7,  3,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,  3,  3,  0,
+       3, 15,  3,  3,  3,  0,  0,  0,  3,  3,  6,  3,  6,  0,
+       0,  0,  0,  3,  0,  0,  4,  3,  0,  3,  0, 12,  0,  0,
+       0,  3,  0,  4,  0,  0,  0,  3,  0, 12,  0,  4,  5,  0,
+       9,  0,  0,  7,  0,  6,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  3,  0,  0,  0,  0,  0,  5,  0,  3,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  5,  4,  0,  0,  0,
+       4,  0,  0,  0,  0,  0,  0,  0,  0, 12,  0,  0,  0,  0,
+       0,  5,  0,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  3,  0,  0,  0,  0,  5,
+       0,  3,  3,  0,  0,  6,  0,  0,  0,  0,  0,  4,  0,  0,
+       3,  3,  0,  8,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  5,  3,  7,  0,  0,  8,  0,  0,  0,  0,
+       0,  0,  3,  4,  0,  6,  0,  0,  0, 15,  0,  0,  0,  0,
+       0,  0,  0,  9,  0,  0,  0,  2,  0,  0,  0,  0,  9,  3,
+       0,  0,  0,  0,  0,  0,  6,  0,  0,  7,  3, 24,  0,  0,
+       0,  0,  5,  0,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  6,  7,  4,  0,  0,  0,  0,  0,  0,
+       6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  4,  0,  3,  3,
+       0,  4,  0,  7,  0,  0,  0,  3,  0,  0,  0,  0,  0,  0,
+       0,  5,  2,  0,  0,  0,  6,  0,  3,  8,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  4,  6,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  5,  0,  9,  5,  7,  0,  0,  0,  0,  0,  0,  0,
+       0,  7, 15,  7,  8,  4,  0,  5,  0,  0,  6,  0,  0,  0,
+       0,  0,  0,  0,  4,  4,  5,  0,  0,  0,  0,  6, 14,  3,
+      15,  0,  6,  0,  0,  0,  3,  0,  3,  3,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  4,  6,  0,  0,  0,
+       0,  0,  0,  5,  0,  0,  5, 16,  0,  5, 10,  0,  0,  0,
+       5,  7,  0,  5,  0,  0,  6,  0,  3,  0,  0, 11,  5,  0,
+       0,  4,  5,  0,  0,  5,  0,  0,  3,  0,  0,  0,  0,  8,
+       0,  0,  0,  5,  0,  0,  0,  6,  3,  0,  0,  0,  0,  0,
+       5,  0,  0,  3,  3,  3,  0,  0,  0,  6,  0,  0,  5,  6,
+       0,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       6,  0,  0, 11,  0,  6,  0,  6,  0,  0, 13,  0,  0,  7,
+       0,  0,  0,  0,  7,  0,  6,  4,  5,  0,  3,  0,  0,  5,
+       3,  0,  0,  0,  0,  0,  6,  0,  0,  4,  0,  0,  0,  0,
+       3,  6,  5,  0,  0,  0,  0, 11,  0,  4,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  5,  0,  0,  0,  0,  0,
+       0, 11,  0,  5,  5,  0,  0,  0,  0,  0,  0,  3,  0,  0,
+       0,  0,  0,  8,  0,  7,  4,  0,  0,  0,  0,  5,  4,  9,
+       0,  0,  5,  0,  0,  0,  0,  0,  8,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,
+       0,  6,  0,  8,  0,  0,  0,  0,  0,  0,  0,  0,  0, 11,
+       0,  0,  0,  0,  0,  0,  0,  4,  0,  0,  7,  0,  0,  0,
+       0,  0,  0,  0,  6,  0,  4,  0,  0, 14,  5,  0,  0,  8,
+       0,  0,  0, 20,  7,  0,  0,  0,  0,  0,  0,  0,  0,  5,
+       3,  0,  0,  4,  6,  0,  0,  0,  0,  6,  0,  0,  0,  7,
+       0,  3,  6,  4,  6,  0,  0,  0,  0,  0,  0,  6,  3,  4,
+       0,  0,  0,  0,  0,  0,  0,  0,  2,  0,  0,  0,  0,  0,
+       0, 11,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  7,  4,
+       0,  0,  0,  0,  0,  0,  0, 13, 18,  5,  0,  3,  0,  7,
+       0,  4,  0,  0,  0,  4,  0,  0, 10, 11,  0,  0,  0,  6,
+       0,  6,  0,  0,  5,  0,  5, 12, 12,  0,  0,  0,  4,  0,
+       0, 14,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  7,  0,
+      14,  0,  0,  0,  2,  4,  8,  4,  0,  3,  0,  0,  7,  0,
+       3,  0,  0,  0,  3,  2,  0,  0,  0,  0,  6,  0,  6,  4,
+       6,  7,  6,  6,  6,  0, 10,  0,  0,  0,  3,  6,  0,  4,
+       0,  0,  0,  0,  0,  4,  0,  6,  6,  0,  4,  0,  0,  0,
+       7,  0,  0,  7,  0,  0,  4,  0,  4,  0,  5,  6,  0,  6,
+       0,  3,  0,  0,  0,  0,  0,  0,  4,  0,  0,  0,  0,  0,
+       6,  0,  0,  0,  0,  0,  0,  0,  5,  0,  0,  0,  0,  0,
+       9,  0,  0,  0,  0,  0,  8, 14,  0,  3,  0,  0,  0,  0,
+       0,  0,  8,  0,  0,  7,  5,  0,  0,  0,  4,  0,  0,  0,
+      17,  7,  0,  0,  4,  0,  0,  7,  0,  5,  0,  0,  7,  5,
+       0,  0,  4,  0,  7,  2, 20,  0,  0,  0,  0, 13,  0,  0,
+       0,  0,  6,  0,  7,  3,  5,  4,  0,  0,  0,  0,  5,  5,
+       0,  0,  0,  0,  0,  4,  5,  0,  0,  0,  0,  0,  0,  0,
+       5,  0,  5,  0,  0,  6,  0,  0,  6,  0,  0,  0,  0,  0,
+       0,  0,  4,  9,  0,  5, 12,  0,  0,  0,  0,  5,  0,  5,
+       4,  0,  0,  0,  9,  0,  0,  0, 10, 10,  0,  0,  4,  6,
+       0,  5,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  2,  6,  0,  0,  0,  0,  0,  5,  0,  0,  0,
+       0,  0,  6,  0,  0,  0,  0,  6,  6,  0,  3,  0,  0,  0,
+       7,  0,  0,  0,  0,  7,  4,  0,  0,  0,  0,  0,  4,  0,
+       9,  0,  0,  3,  0,  0,  0,  7,  0,  4,  0,  0,  5,  6,
+       0,  0,  6,  3,  5,  4,  0,  0,  0,  0,  0,  6,  0,  5,
+       0,  0,  0,  0,  0,  0,  3,  0,  0,  0,  0,  6,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  4,  0,  0,  5,
+       0,  0,  6,  0,  0,  0,  0,  0,  0,  0,  0,  4,  0,  0,
+       6,  0,  0,  6,  0,  0,  0,  8,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  8,  0,  0,  0,  6,  0,  0,  0,  0,  4,
+       0,  0,  0,  0,  0,  0,  0,  5,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0, 10,  0,  0,  6,  0,  6,  0,  0,  6,
+       0,  0, 18,  0,  6,  0, 20, 15,  0,  0,  4,  4,  0,  0,
+       0,  6,  0,  0,  0,  3,  0,  0,  0,  0,  0,  5,  4,  4,
+       0,  7,  0,  6,  0,  4,  0,  5,  0,  0,  0,  0,  5,  0,
+       0,  0,  4,  4,  0,  0,  0,  0,  4,  0,  4,  0, 11,  0,
+      20, 23,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0, 10,  0,  0,  8,  0,  0,  0,  6,  0,  0,  0,
+       0,  4,  0,  0,  0,  0,  0,  4,  0,  0,  3,  0,  0,  6,
+       0,  0,  0,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  4,
+       0,  0,  0,  0,  0,  0, 13,  0,  0,  9,  0,  0,  0,  5,
+       0,  0,  0,  5,  0,  3,  0,  0,  0,  0,  0,  0,  0,  5,
+       0,  0,  0,  0,  3,  0,  0, 17,  0,  5,  0,  0,  0,  0,
+       0,  0,  0,  0,  6,  0,  9,  0,  0,  0,  6,  0,  0,  0,
+       0,  0,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  5,
+       0,  7,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0, 14,  0,
+       0, 11,  0,  6,  0,  6,  0,  7,  5,  0,  0,  0,  6, 12,
+      12,  0,  0,  0,  0, 16,  0, 14,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  5,  0,  5,  0,  0,  0,  7,
+       0,  0,  5,  0,  0,  0,  0,  0,  0,  6,  0, 14,  0,  0,
+       0,  0,  0,  0,  4,  0,  0,  0,  6,  0,  0,  0,  0,  0,
+       0,  0,  8,  0,  0,  0,  0,  5,  0,  6,  0,  0,  0,  0,
+       0,  0,  0,  0,  5,  0,  0,  5,  0,  0,  0,  0,  0,  0,
+       5,  0,  5,  0,  0,  0,  0,  0, 11,  6,  6,  3,  0,  0,
+       0,  0,  7,  0,  6,  0,  6,  6,  4,  0,  0,  0,  7,  0,
+       0,  0,  0,  0, 14,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  5,  0,  5,  0,  0,  0,  6,  0,  0,  0,  0,
+       4,  4,  0,  0,  0,  0,  3,  3,  6,  0,  0,  0,  0,  0,
+       0,  8,  0,  0,  0,  0,  0,  6,  0,  0,  0,  4,  6,  0,
+       4,  4,  0,  0,  0,  0, 13,  0,  4,  0,  0,  0,  0,  4,
+       2,  0,  0,  0,  0,  4,  0,  0,  0,  0,  0,  0,  7,  0,
+       0,  0, 10,  0,  9,  0,  0,  4,  6,  0,  5,  0,  0,  0,
+      13,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       5,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0, 10,  0,  0,  0,  0,  0,  0,  8,  0,  0,  6,  0,
+       0,  0,  0,  0,  0,  0,  5,  0,  0,  0,  0, 12,  0,  0,
+       6,  0,  0,  0,  0,  0,  0,  0,  3,  0,  0,  0, 12,  0,
+       0,  0,  0,  0,  0,  0, 18,  0,  0,  4,  0,  0,  0,  0,
+       0,  0,  0,  0,  6,  0,  7,  0,  0,  0,  0,  5,  0,  5,
+       0,  0,  0,  6,  0,  0,  5,  0,  0,  6,  0,  6,  0,  0,
+      13,  6,  0,  0,  0,  0,  5,  0,  0,  0,  0,  0,  0,  0,
+       0,  4,  0,  6,  0,  6,  7,  0,  0,  0,  0,  0,  0,  0,
+      14,  0,  6, 15,  0,  0,  7,  0,  3,  0,  3,  0,  0,  0,
+       9,  0,  0,  6,  0,  0,  0,  0,  0,  0,  0,  0,  8,  0,
+       0,  4,  0,  0,  0,  0,  0,  0,  0,  7,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  6,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 12,  0,  0, 15,
+       0,  0,  0,  6,  0,  0,  6,  0,  0,  0,  0,  6,  0,  0,
+       0,  0,  0,  0,  0,  7,  6,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  2,  0,  0,  0,  0,  0,  0,  5,  0,  0,  0,
+       0,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  8,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  3,  9,  4,  0,  3,  0,
+       0,  0,  0,  0,  0,  0,  0,  4,  0,  0,  2, 15,  0,  0,
+       0,  5,  0,  5,  0,  4,  0,  0,  0,  0,  0,  0, 16,  0,
+       3,  3, 10,  0,  0,  0,  0,  0,  0,  0,  0,  4,  5,  4,
+       5,  4,  0,  0,  6,  0,  5,  4,  0,  5,  5,  3,  5,  0,
+       4,  0,  6,  0,  0,  0,  0,  0,  0,  6,  0,  0,  0,  3,
+       0,  0,  0,  0,  0,  3,  0,  0,  6,  0,  5,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  6,  8,  6,  0,  0,  0,  0,  0,  0,  0,  5, 16,  0,
+       5,  7,  0,  6,  0,  0,  0,  0,  0,  0,  6,  0,  0,  0,
+       0,  0,  0,  8,  0,  0,  0,  0,  0,  0,  6,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  7,  0,  7,  0,  0,  5,  0,  0,
+       0,  0,  6,  0,  5,  4,  5,  0,  5,  5,  0,  0,  0,  0,
+       5,  2,  6,  4,  0,  5,  0,  0,  5,  0,  4,  0,  0,  0,
+       0,  0,  0,  5,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,
+       0,  6,  0,  0,  0,  0,  3,  5,  0,  0,  0,  2,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  4,  0,  0,  0,  0,
+       0,  0,  0,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  8,  0,  0,  0,  0,  6,  5,  0,  0,  4,
+       0,  0,  0,  5,  0,  0,  0,  0,  0,  0,  6,  0,  0,  0,
+       0,  4,  0,  0,  0,  5,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  4,  0,  4,  2,  6,  0,  6,  3,  3,  0,  0,
+       3,  0,  4,  0,  6,  0,  3,  0,  0,  6,  0,  5, 31,  0,
+       0,  0,  0,  0,  0,  0,  3,  6,  0,  0,  0,  0,  0,  0,
+       0,  4,  0,  0,  5,  0,  0,  0,  3,  0,  0,  0,  0,  6,
+       0,  8,  0,  5,  4,  0,  0,  0,  0,  3,  0,  0,  0,  0,
+       0,  0,  0,  3,  0,  0,  0,  0,  0,  5,  0,  0,  5,  0,
+       0,  0, 19,  0,  0,  0,  0, 24,  0,  0,  4,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,  5,
+       0,  0,  0,  6,  0,  0,  0,  0, 14,  0,  0,  0,  0,  0,
+       0, 16,  5,  0,  0,  3,  4,  4,  0,  5,  4,  5,  0,  0,
+       0, 13,  0,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  5,  5,  0,  0,  0,  0,  0,  0,  6,  0,  3,
+       0,  7,  0, 10,  0,  0,  0,  0,  6,  0,  6,  0,  0, 13,
+       0,  0,  0,  5,  0,  8,  0,  6,  0,  6,  8,  6,  0,  0,
+       6,  6,  0, 10,  0,  8,  6,  6,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  6,  0, 11,  0,  0,  0,  6,  0,  0,  0,
+       0,  7,  0,  5,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       7,  0,  0,  0, 17,  6,  0,  0,  0,  0,  0, 16,  0,  0,
+       0,  0,  0,  0,  4,  0,  4,  0,  0,  0,  0,  0,  7,  0,
+      14,  7,  6,  0,  6,  0,  7,  0,  0,  0,  0,  0,  0,  0,
+       4,  0, 15,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  6, 10,  4, 14,  0,  0,  0,  9,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0, 14,  0,  4,  0,  6,
+       0,  0,  0,  0,  0,  0,  0,  6,  3,  8,  4,  6,  6,  0,
+       5,  0,  0,  0,  0,  0,  0,  0,  0,  3,  0,  0,  0,  0,
+       0,  6,  0,  4,  0,  2,  0, 20, 21,  0,  0,  2,  0,  0,
+       3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  4,  0,  0,  0,
+       0,  0,  0,  0,  0,  6,  0,  0, 14,  4,  6, 17,  0,  0,
+       0,  0,  0,  0,  0,  0,  6,  6,  0,  0,  0,  5,  0,  0,
+       4,  6,  0,  2,  7,  0,  6,  5,  0,  8,  0,  0,  5,  0,
+       4,  0,  0,  0,  5,  0,  4, 15,  5,  0,  4,  6,  0,  0,
+       0,  0,  5,  5,  0,  0,  0,  0,  0,  0,  0, 17,  5,  0,
+       0,  0,  9,  6,  0,  0, 12,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  6,  0,  5,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  6,  0,  0,  0,  0,  0,  7,  5,  0,
+       0,  0,  0,  0,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  2,  0,  0,
+       0,  0,  0,  0,  5,  0,  0,  0,  0,  0,  4,  0,  0,  0,
+       0, 12,  0,  0,  0,  6,  0,  0,  0,  0, 10,  3,  0,  0,
+       0,  4,  0,  5,  0,  0,  0,  0,  0,  4,  0,  0,  4,  0,
+       0,  0,  0,  0,  0,  0,  4,  0,  0,  0,  0,  7,  0,  0,
+       0,  0,  0,  0,  9,  0,  6,  0,  6,  0,  0,  0,  0, 19,
+       5,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  4,  0,
+       0,  0,  0,  0,  0,  0,  0,  3,  0,  0,  0,  0,  0,  3,
+       0,  0,  0,  0,  0,  0,  5,  0,  0,  5,  0,  6,  3,  6,
+       0,  0,  0,  0,  0,  0,  0,  4,  0,  4,  2,  0,  0,  0,
+       4,  0,  0,  0,  0,  0,  0,  0,  0,  5,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  5,  0,  6,  0,  6,  0,  6,  0,  0,
+       0,  0,  0,  0,  0,  8,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  6,  0,  0,  0,  0,  7,  0,  0,  0,  0,  0, 17,  0,
+       0,  7,  0,  0,  2,  6,  2,  0,  0,  0,  2,  0,  0,  0,
+       0,  3,  8,  0,  0,  3,  0,  5,  0,  5,  6,  0,  0,  0,
+       0, 18,  0,  0,  0,  0,  5,  0,  7,  0,  0,  9,  0,  0,
+       0,  0,  5,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  4,  0,  4,  0,  0,  4,  0,  9,  0,  6,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  6,  5,  0,  4,  0,
+       0,  0,  0,  6,  0,  0,  0,  0,  0,  0,  5,  0,  5,  6,
+       0,  0,  0,  3,  3,  5,  0,  0,  0,  0,  6,  0,  0,  0,
+       6,  0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  5,  0,  4,
+       6, 13,  0,  0,  0,  0,  0,  0,  0,  0,  5,  0,  0,  0,
+      13,  0,  0,  0,  0,  0,  0,  0,  0,  7,  0,  0,  0,  0,
+       0,  0,  5,  0,  0,  0,  3,  0,  0,  0,  0,  0,  0,  0,
+       8,  6,  8,  0,  0,  7,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  5,
+       0,  0,  0,  0,  0, 12,  0,  6,  0,  0,  0,  6,  0,  0,
+       0,  6,  4,  0,  0,  7,  6,  5,  0,  0,  6,  0,  5,  5,
+       5,  0,  0,  0,  9,  0,  0,  0,  0,  0,  5,  0,  6,  8,
+       0,  0,  6,  0,  5,  8,  0,  0,  0,  6,  0,  4,  0,  9,
+       0,  0,  0,  0,  4,  6,  4,  0,  0,  0,  0,  0,  3,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  5,  4,
+      11,  0,  0,  8,  9,  0,  0,  0,  0,  3,  5,  3,  0,  0,
+       0,  0,  6,  4,  0,  0,  0,  9,  4,  3,  0,  2,  0,  0,
+       0,  0,  0,  7,  5,  0,  0,  0,  0,  6,  0,  0,  0,  0,
+       0, 14,  3,  0,  0,  0,  0,  0,  0,  4,  0,  0,  0, 10,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  3,  3,  0,  0,  0,
+       0,  0,  0,  0,  0,  5,  0,  0,  0,  0,  0,  0, 10,  7,
+       5,  0,  6,  0,  6,  0,  3, 17,  0,  0,  0,  0,  0,  0,
+      20,  0, 14,  4,  0,  0,  0,  0,  0,  0, 19,  6,  6,  0,
+      10,  0,  0,  0,  0,  0,  0,  4,  0,  0,  0,  0,  6,  0,
+       0,  3,  0,  0,  0,  4,  5,  0,  0,  4,  0,  5,  0,  0,
+       0,  0,  0,  0,  7,  0,  4,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  4,  0,  0,  3,  0,  0,  0,  0,
+       0,  0,  7,  0,  3,  0,  4,  0,  3,  0,  4,  0,  0, 13,
+       0,  4,  0,  0,  0,  0,  0,  0,  0, 12,  0,  0,  0,  0,
+       0,  0, 10,  0,  0,  0,  0,  0,  0,  0,  8,  0,  0,  0,
+       6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  5,  0,  0,
+       6,  0,  0,  0,  0,  0,  7,  0, 13,  0,  0, 15,  0,  0,
+       5,  9,  0,  0,  0,  6,  0,  6,  0,  0,  4,  6,  0,  0,
+       6,  4,  4,  0, 16,  0,  4,  0,  3,  0,  0, 11,  5, 15,
+       0,  0,  0,  5,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  7,  0,  0,  5,  0,  5,  4,  0,  0,  4,  0,
+      20,  4,  0,  0,  0,  0,  0,  5, 15,  4,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  4,  0,  0,  0,  5,  0,  0,  5,  0,
+       0,  0,  0,  0,  0,  0,  0,  5,  5,  0, 22,  0,  0,  7,
+       8,  0,  4,  0, 17,  0,  0,  0,  0,  0,  0,  0,  0,  6,
+       0,  0,  6,  7,  0,  0,  0,  0,  6,  0,  6,  0,  0,  0,
+       6,  0,  0,  0,  0,  0,  4,  0,  5,  0, 12, 15,  6,  0,
+      13,  0,  4,  0,  5,  4,  6,  0,  0,  0,  0,  4,  0,  0,
+       4,  3,  5,  0,  0,  0,  0,  0,  0,  4,  0,  4,  0,  0,
+       0,  0,  0,  0,  4,  0,  0,  9,  0,  0, 20,  0,  4, 10,
+       0,  0,  0,  0,  4,  0,  5,  0,  0,  8,  6,  0,  5,  4,
+       0,  0,  3,  0,  4,  0,  0,  6,  6,  0,  4,  0,  0,  0,
+       0,  0,  0,  0,  0,  6,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  4,  0,  0,  0,  0,  0,  0,  4,  0,
+       0,  0,  0,  0,  0,  0,  0,  4,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 14,  0,  9,
+       0,  0,  0,  0,  5,  0,  0,  0,  0,  0,  0,  0,  0, 17,
+       0,  4,  0,  0,  0,  0,  0,  0,  0,  0,  4,  0,  0,  0,
+       0,  0,  0, 14,  0,  0,  0,  0,  0,  6,  0,  0,  0,  0,
+       0, 14,  0,  0,  0,  0,  0,  0,  5,  6,  0,  5,  0,  0,
+       0,  0,  0,  0,  5,  0,  8,  0,  0,  0,  4,  0,  0,  0,
+       0,  0, 16, 15,  4,  0,  0, 11,  0,  0,  0,  8,  0,  0,
+       0,  0,  0,  0,  0,  2,  0,  5,  0, 10,  0,  0,  5,  0,
+       0,  0,  6,  0,  0,  0,  0,  0,  0,  0,  7,  0,  0,  0,
+       5,  0,  5,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  5,  4,  0,  0,  0,  0,  0,  0,  0,  2,
+       0,  0,  0,  0,  5,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  8,  6,  5,  4,  0,  0,  0,
+       0,  5,  0,  0,  0,  0,  0,  0,  0,  3,  0,  0,  6,  0,
+       0,  0,  0,  2,  4,  5,  0,  0,  0,  8,  0,  0,  3,  0,
+       8,  0,  0,  4, 18,  0,  0,  0,  0,  4,  5,  0,  0,  0,
+      16,  0,  0,  0,  0,  7,  0,  2,  3,  5,  0,  0,  5,  0,
+       4,  4,  0,  0,  0,  5,  0,  0,  0,  0,  0,  0,  0,  0,
+       8,  0, 14,  0,  0,  0,  0,  5,  0,  0,  6,  0,  6,  0,
+       5,  0,  5,  0,  5, 15,  0,  0,  8, 17, 12,  0,  0,  0,
+       0,  0,  6,  0,  0,  8,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  5,  0,  5,  0,  0, 20,  0,  0,  0,  0,  0,
+      11,  0,  5,  0,  0,  0,  0,  0,  4,  0,  0,  0,  0, 13,
+       0,  0,  0,  0,  0,  6,  0,  6,  0,  6,  0,  6,  0,  5,
+       8,  0,  0,  0,  0,  0,  6, 14,  0,  0,  0,  0,  0,  0,
+       0,  0,  6,  0,  0,  0,  0,  0,  0,  0,  4,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  2,
+       0,  0,  0,  0,  0,  0,  0,  0,  6,  0,  0,  4,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  5,  5,  0,  0,  0,  0,  0,
+       0, 13,  0,  0,  0,  0,  0,  8,  4,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0, 19,  0,  0,  0,  0,  0,  0,  7,
+       0,  0, 16,  0, 14,  0, 18, 13,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  6,  0,  0,  0,  0,  0,  0,  0,  6,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  8,  0,  0,  5,  0,  0,
+       0,  0,  0,  0,  3,  0,  0,  0, 16,  0,  0,  0,  0,  0,
+       0, 14,  0,  0, 17,  0,  0,  0,  0,  0,  0,  0,  0,  3,
+       0,  0,  0,  0,  0,  0,  0, 13,  0,  0,  5,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  6,  0,  0,  0,  5,  0,
+       4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  6,
+       0,  0,  0,  8, 17,  0,  0,  0,  5,  0,  0,  0,  8,  0,
+       0,  0,  0,  0,  0,  0,  9,  0, 15,  0,  5,  0,  5,  0,
+       0,  0,  0,  0,  0,  6,  5,  0,  0,  0,  0,  6,  4,  0,
+       0,  9,  0,  0,  0,  0,  0,  6,  0,  6,  0,  0,  8,  0,
+       0,  0,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  6,  0,
+       6,  2,  0,  0,  6,  0, 12,  6,  0,  0,  0, 16,  0,  0,
+       0,  0, 10,  0,  0,  0,  0,  0,  0,  0,  0,  4,  0,  0,
+       0,  0, 14, 22,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0, 10,  8,  0,  5,  0,  0,  6,
+       0,  0,  0,  6,  0,  0,  0,  0,  6,  0,  0,  0,  0,  0,
+       0,  0,  5,  0,  0,  5,  6,  0,  0,  0,  0,  0,  0,  0,
+       0,  8,  0,  0,  0, 14,  5,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  6,  0,  0,  0,  5,  0,  9,  0,
+       0,  0,  5,  0,  0,  0,  0,  4,  6,  0,  0,  0,  0,  0,
+       0,  8,  0,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  0,
+       3,  0,  0,  0,  0,  0,  0,  0,  6,  0,  0, 21,  5,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  2,  0,  0,  0,  6,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  6,  0,  6,  0,  0,  0,  0,  0,  3,  5,  0,
+       0,  5,  0,  0,  0,  0,  0,  5,  0,  0,  0,  0,  2,  0,
+       9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 10,
+       5,  0,  0,  0,  0,  0,  0,  0,  0,  8,  5, 14,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  6,  0,  0,  0,  0,  0,
+       5,  6,  0,  0,  4,  0,  4,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  5,  0,  0,  0,  0,  0,  0, 13,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  6,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0, 12,  0,  0,  0, 18, 10,  0,  0, 18,  0,  7,  0,  0,
+       0,  6,  0,  0,  6,  0,  0,  0,  0,  0,  0,  0,  0,  4,
+       0,  5,  0,  0,  0,  0,  6,  0,  0,  5,  0,  0,  4,  0,
+       0,  0,  0,  0,  0,  0,  5,  0,  0,  0,  0,  0,  4,  0,
+       0,  0,  5,  0, 12,  4, 12,  8,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  7,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  7,  0,  0,  0,  0,  0,  0,  5,  0,  5,  0,
+       0,  0,  0,  0,  8,  0,  0,  0,  0,  4,  0,  0,  0,  0,
+       7,  5,  0,  0,  7,  0,  0,  0,  0,  0,  0,  0,  0,  4,
+       5,  0,  0,  0,  5,  6,  7,  7,  0,  0,  0,  0,  0,  0,
+       0,  6,  0,  8,  0,  0,  0,  0,  5,  0,  0,  5,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  5,  0,  0,
+       0,  0, 16,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0, 10, 16,  0,  0,  0,  0,  0,  0, 17,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  5,  0,  0,  0,  0,  0,
+       4,  6,  0,  0,  0,  5,  0,  0,  0,  8,  0,  0,  0,  0,
+       0, 17,  0,  0,  5,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  5,  0,  0,  0,  0, 17,  0,  5,  0,  0,  0,  0,  5,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  6,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0, 18,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  5,  8,  0,  0,  0,  0,  0,  5,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  4,  0,  0,
+       0,  0,  0,  0,  0,  0, 15,  0,  0,  0,  0,  0,  7,  0,
+       0,  0,  0,  0,  5,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  7,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  5,  8,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  6,  4,  0,
+       8,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  8,  0,  0,  0,  0,  0,  0,  0, 14,  0,  0,  0,
+       0,  0,  0,  0,  0,  8,  4,  0,  7,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  4,  0,  4,  6,  8,  0,  5,  0,
+       0,  4,  4,  0,  5,  4,  5,  0,  0,  0,  0,  0,  0,  6,
+       0,  0,  5,  0,  0, 18,  0,  5,  0,  0,  0, 19,  0,  0,
+       8,  0, 14,  0,  0,  0,  0, 13,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  5,  0,  0,  5,  0,  6,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0, 11,  0,  5, 13,  0,  0,  0,  7,
+       0,  0,  0,  0,  0,  5,  0,  0,  0,  0,  0,  3,  0,  0,
+       4,  0,  6, 13,  0,  8,  0,  5,  0,  0,  0,  5,  0,  0,
+       7,  0,  0,  0,  0,  0,  0,  0,  0,  0, 10,  0,  0,  0,
+       3,  0,  3,  0,  3,  0,  3,  3,  3,  4,  0,  4,  0,  3,
+       5,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,  0,  3,
+       4,  0,  0,  0,  0,  3,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  7,  0,  0,  0,  0,  0,  0,  5,
+       0, 18,  0,  0, 15,  7,  0,  3,  0,  0,  6,  5,  0,  5,
+       0,  3,  0,  0,  8,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  5,  0,  0,  0,
+      12,  0,  0,  0,  0,  0,  0,  3,  0,  0,  0,  0,  0,  0,
+       0,  7,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,  0,
+       0,  0,  0,  0,  0,  3,  3,  0,  0,  0,  0,  0,  0,  7,
+       0,  0,  0,  0,  3,  3,  0,  0,  0,  0,  0,  0,  5,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  3,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  6,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 16,
+       7, 10,  0,  0,  0,  0,  0,  4,  0,  0,  9,  0,  0,  0,
+       0,  0,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0, 11,  0,  4,  0,  0,  0,  0,  0,  0,  0,  5,  3,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  6, 12,  0,  0,  0,  5,  6,  0,  0,  0,  0,
+       0,  5,  0,  0,  0,  5,  0,  0,  0,  0,  5,  0, 17,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  5,  0,  0,  0,  0,  6,  5,  0,  0,  0,  3,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0, 13,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 13,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       4,  0,  0,  0,  0,  5,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  3,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  5,  0, 10,  0,  0,  0,  0,  0,  0,  0,  0,
+       4, 15,  5,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  6,  0,  9,  6,  0,  0,  0,
+       3,  0,  0,  0,  0,  0,  7,  0,  0, 20,  0,  5,  0,  0,
+       0,  0,  0,  0,  0, 10,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  8,  5,  0,  0,
+       0,  3,  0,  0,  6,  5,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  3,  0,  0,  0,  0,  9,  0,  0,  0,  0,  0,  7,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0, 14,  0,  0,  0,  0,  5,  6,  0,  0,  0,  0,
+       0,  4,  0,  0,  0,  0,  0,  0,  0,  5,  0,  0,  0,  0,
+       0,  0,  5,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       6,  0,  0,  8,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0, 14,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  5,  3,  0,  3,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  8,  0,  8,  0,  0,  5,  0,  0,  0,  0,  0,  0,
+       5,  0,  0,  0,  0,  0,  6,  8,  0,  0, 17,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0, 17,  0,  6,  0,  0,  0,  0,
+       0,  0,  0,  0,  7,  0,  0,  0,  6,  0,  0,  0,  0,  0,
+       0,  0,  0, 13,  0,  0,  0,  0,  7,  0,  0,  3, 14,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       6,  0, 13,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
+       0,  7,  5,  0,  0,  0,  0,  0,  0,  6,  0,  0,  0,  0,
+       0,  0,  0,  4,  4,  4,  0,  0,  0,  0,  6, 11, 19,  0,
+       0,  5, 17,  0,  0,  0,  0,  0, 16,  5,  0,  0,  0,  0,
+      16,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+      16,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  5,  0,
+       7,  0,  0,  0,  0,  0,  0, 11,  0,  0,  0,  6,  0,  0,
+       0,  0,  0,  0,  0,  4,  0,  0,  0,  0,  0,  3,  0,  0,
+       0,  0,  0,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       7,  0,  7,  8,  0,  0,  0,  0,  0, 13,  0, 16,  5,  4,
+       0,  0,  0,  6,  0,  0,  5,  0,  0,  0,  0,  0,  6,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 21,
+       9,  6,  0,  0,  0,  0,  0,  0,  6,  0,  0,  0,  0,  0,
+       0,  7,  0,  0,  0,  7,  0,  0,  0,  0,  0,  0,  0,  8,
+       9, 15,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  6,  9,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       5,  7, 15,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  6,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0, 10,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  3,  7,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  3,  0,  0,  6,  0,  0,  0,
+       0,  0, 15,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 14,
+       0,  0,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0, 16,  0,  0,  0,  0,  0,  0,  0,  0,  0,  5,  0,  0,
+       0,  0,  0,  0,  4, 10,  0,  0,  0,  0,  0,  5,  0,  0,
+       0,  0,  0,  0,  3,  0,  0,  0,  0,  0, 10,  0, 10,  0,
+       0,  0, 21,  0,  0,  7,  0,  0,  0,  0,  0,  0,  0,  0,
+       6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 10,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  5,  5,  0,  0,  0,
+       0,  0,  7,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  5,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  5,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0, 12,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  8,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  6,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0, 11,  0, 20,  0,  3,  0,  0,  6,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  4,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  5,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  5,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  7,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 13,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  6,  0,  0,  0,
+       0,  3,  0,  0,  0,  0,  5, 14,  5,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 21,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  3,  0,  0,  0,  3,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0, 13,  0,  0,  0,  0,  5,  0,
+       0,  8,  0,  0,  0,  0,  0,  0,  0,  0,  0,  5,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  6,  0,  0,  0,  0,
+       0,  4,  0,  0,  0,  0,  0,  0,  4,  0,  4,  0,  0,  0,
+      18,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  5,  0,  0,  0,  0,  0,  8,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0, 10, 11,  5,  0,  0,
+       0,  0,  0,  0,  0, 13,  0,  0,  0,  0,  0,  0,  7,  0,
+      19,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  8,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  6,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  6,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 14,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 11,  0,  5,  0,
+       0,  0,  0,  0,  0,  0,  0,  4,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  6,  0,  0,  0,  0,  0, 16,  5,  0, 15,  0,
+       0,  0,  0,  0,  0,  3,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  5,  5,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,  0,  3,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  3,  3,  0,  0,  0,  0,  0,  0,  0,  0,
+       0, 15,  0,  0,  0,  0,  0,  6,  0,  0,  0,  9,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  6,  0,  0,  0,  0,  0,
+       0,  0,  0,  3,  0,  0,  0,  0,  0,  3,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  7,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  4,  0, 15,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0, 10,  0,  0,  0,  0,  5,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  7,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  5, 11,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0, 12,  0,  0,  0,  0,  0,  0,  0,  0,  0, 11,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  5,  7,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  5,  0,  0,  0,  4,  7,  0,  0,  0,  0,  0,  6,
+       0,  0,  0,  0,  4,  0,  0,  0,  5,  0,  0,  8,  0,  0,
+       0,  0,  0,  0, 11,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  5,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  6,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  5,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 11,  0,  0,  0,
+       0,  0,  8,  0,  0,  0,  0,  0,  0,  0,  0,  0,  6,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  6,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  6,  0,  0,
+       0,  0,  0,  0,  0,  0,  0, 15,  0,  0,  0,  0,  0,  4,
+       0,  0, 11,  0, 15,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0, 15,  0,  0, 18,  0,
+       0,  0,  0,  0,  0,  0,  5,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0, 11,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0, 14,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  6,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  2,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+      14,  0,  0, 18,  0,  0,  0,  4,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 17,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 16, 15,  0,  0,
+       0,  0,  5,  0,  0,  0,  7,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 10,  0,  6,
+       0,  0,  0,  0,  0,  0,  0,  0,  4,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0, 14,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  7,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  7,
+      13,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0, 14,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0, 15,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  5,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  6,  0,  0,
+       0,  0,  0, 12,  0,  0,  0, 14,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  6,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0, 12,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0, 13,  0,  0, 16,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0, 15,  0,  0, 18,  0,  0,  0,  7,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 16, 15,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  5,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  8,  0,  0,  0,
+       0,  0,  0,  0,  8,  0,  0,  0,  0,  0,  0,  0, 11,  0,
+       0,  5,  0,  0,  0,  7,  0,  0,  0, 11,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  5,  0,  0,  0,  5,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  5,
+       0,  0,  0,  0,  0, 10,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  8,  5,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  6,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       9,  0, 13,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  5,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0, 19,  0,  0,  0, 21, 16,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0, 13,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  5,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  6,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  7,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0, 10,  0,  5,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  3,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  5,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  7,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+      10,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  6,  0,  0,
+       0, 13,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  7,  0,  0,  0,  0,  0,  0,  0,  0,  5,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 16,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  5,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 10,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  8,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  8,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  8,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  6,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  7,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  8,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0, 16,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0, 11,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  8,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0, 13,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       8,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0, 16,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  7,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0, 11,  0,  0,  0,  4,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  8,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  6,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0, 16,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0, 14,  0,  0,  0,  0,
+       6,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0, 11,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  7,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  6,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  8,  0,  0,  0,  0,  0,  5,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  6,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  8,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  8,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0, 11,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0, 17,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+       0,  0,  0,  0,  0,  0,  0,  0,