inital checkin: libpcre

This the initial commit of libpcre, the Perl Compatible Regular
Expression library (http://www.pcre.org/)

The files in the dist/ directory correspond to pcre version
8.36 and are unmodified.

  $ sha256sum pcre-8.36.tar.bz2
  ef833457de0c40e82f573e34528f43a751ff20257ad0e86d272ed5637eb845bb  pcre-8.36.tar.bz2

The top level directory contains 3 symlinks pointing into dist,
and one Android.mk file.

The code compiles, and I've tested a small program to verify that
the functionality is correct. However, no extensive testing has
been done at this point.

Bug: 17682157
Change-Id: Ie304aaf09cc37eb8920b40c3a3f7db61a0fda205
diff --git a/dist/CleanTxt b/dist/CleanTxt
new file mode 100755
index 0000000..1f42519
--- /dev/null
+++ b/dist/CleanTxt
@@ -0,0 +1,113 @@
+#! /usr/bin/perl -w
+
+# Script to take the output of nroff -man and remove all the backspacing and
+# the page footers and the screen commands etc so that it is more usefully
+# readable online. In fact, in the latest nroff, intermediate footers don't
+# seem to be generated any more.
+
+$blankcount = 0;
+$lastwascut = 0;
+$firstheader = 1;
+
+# Input on STDIN; output to STDOUT.
+
+while (<STDIN>)
+  {
+  s/\x1b\[\d+m//g;   # Remove screen controls "ESC [ number m"
+  s/.\x8//g;         # Remove "char, backspace"
+
+  # Handle header lines. Retain only the first one we encounter, but remove
+  # the blank line that follows. Any others (e.g. at end of document) and the
+  # following blank line are dropped.
+
+  if (/^PCRE(\w*)\(([13])\)\s+PCRE\1\(\2\)$/)
+    {
+    if ($firstheader)
+      {
+      $firstheader = 0;
+      print;
+      $lastprinted = $_;
+      $lastwascut = 0;
+      }
+    $_=<STDIN>;       # Remove a blank that follows
+    next;
+    }
+
+  # Count runs of empty lines
+
+  if (/^\s*$/)
+    {
+    $blankcount++;
+    $lastwascut = 0;
+    next;
+    }
+
+  # If a chunk of lines has been cut out (page footer) and the next line
+  # has a different indentation, put back one blank line.
+
+  if ($lastwascut && $blankcount < 1 && defined($lastprinted))
+    {
+    ($a) = $lastprinted =~ /^(\s*)/;
+    ($b) = $_ =~ /^(\s*)/;
+    $blankcount++ if ($a ne $b);
+    }
+
+  # We get here only when we have a non-blank line in hand. If it was preceded
+  # by 3 or more blank lines, read the next 3 lines and see if they are blank.
+  # If so, remove all 7 lines, and remember that we have just done a cut.
+
+  if ($blankcount >= 3)
+    {
+    for ($i = 0; $i < 3; $i++)
+      {
+      $next[$i] = <STDIN>;
+      $next[$i] = "" if !defined $next[$i];
+      $next[$i] =~ s/\x1b\[\d+m//g;   # Remove screen controls "ESC [ number m"
+      $next[$i] =~ s/.\x8//g;         # Remove "char, backspace"
+      }
+
+    # Cut out chunks of the form <3 blanks><non-blank><3 blanks>
+
+    if ($next[0] =~ /^\s*$/ &&
+        $next[1] =~ /^\s*$/ &&
+        $next[2] =~ /^\s*$/)
+      {
+      $blankcount -= 3;
+      $lastwascut = 1;
+      }
+
+    # Otherwise output the saved blanks, the current, and the next three
+    # lines. Remember the last printed line.
+
+    else
+      {
+      for ($i = 0; $i < $blankcount; $i++) { print "\n"; }
+      print;
+      for ($i = 0; $i < 3; $i++)
+        {
+        $next[$i] =~ s/.\x8//g;
+        print $next[$i];
+        $lastprinted = $_;
+        }
+      $lastwascut = 0;
+      $blankcount = 0;
+      }
+    }
+
+  # This non-blank line is not preceded by 3 or more blank lines. Output
+  # any blanks there are, and the line. Remember it. Force two blank lines
+  # before headings.
+
+  else
+    {
+    $blankcount = 2 if /^\S/ && !/^Last updated/ && !/^Copyright/ &&
+      defined($lastprinted);
+    for ($i = 0; $i < $blankcount; $i++) { print "\n"; }
+    print;
+    $lastprinted = $_;
+    $lastwascut = 0;
+    $blankcount = 0;
+    }
+  }
+
+# End