text:
package com.google.common.css.compiler.gssfunctions;

import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableMap;

import java.awt.Color;
import java.util.Arrays;
import java.util.EnumSet;
import java.util.Map;
import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * A parser that recognizes all color formats allowed by the CSS Level 2
 * and SVG 1.0 specifications.
 *
 *
See the CSS
 * 2.1 colors.
 *
 *
A CSS color can be one of 5 things:
 *
 *

 *
A 6-character hexadecimal color, such as "#f6e43a" (lower or upper
 *      case).

 *
A 3-character hexadecimal color, such as "#c4d".

 *
A 255-based RGB value, such as "rgb(255, 10, 0)" (spaces are allowed
 *     around values).

 *
A percent-based RGB value, such as "rgb(100%, 0%, 10%)" (spaces are
 *     allowed around values).

 *
A predefined color keyword, such as "red".

 *

 *
 *
An example of a parser that will handle all valid CSS 2.1 colors:
 *

 * // Construct a ColorParser instance (thread-safe, and can be reused):
 * ColorParser parser = new ColorParser(
 *     ColorParser.Format.HEX3,
 *     ColorParser.Format.HEX6,
 *     ColorParser.Format.CSS_RGB,
 *     ColorParser.Format.CSS_KEYWORDS);
 * // Parse a color:
 * Color red = parser.parse("rgb(255, 0, 0)");
 *

 *
 *
Also see the {@link #parseAny} static convenience method.
 *
 * @author chrisn@google.com (Chris Nokleberg)
 */
final class ColorParser {

  /** Pattern for matching #RRGGBB */
  private static final Pattern HEX6_PATTERN = formatHexadecimalPattern(6);

  /** Pattern for matching #RRGGBBAA */
  private static final Pattern HEX8_PATTERN = formatHexadecimalPattern(8);

  /** Pattern for matching #RGBA */
  private static final Pattern HEX4_PATTERN = formatHexadecimalPattern(4);

  /** Pattern for matching rgb(r, g, b) [0-255] */
  private static final Pattern CSS_RGB_PATTERN;

  /** Pattern for matching rgb(r, g, b) [0-100%] */
  private static final Pattern CSS_PERCENT_PATTERN;

  /** Pattern for matching rgba(r, g, b, a) [0-255, a = 0-1] */
  private static final Pattern CSS_RGBA_PATTERN;

  /** Pattern for matching rgba(r, g, b, a) [0-100%, a = 0-1] */
  private static final Pattern CSS_RGBA_PERCENT_PATTERN;

  // Initialize the patterns to recognize "rgb(...)" colors.
  static {
    /*
      From CSS2 spec:

      An <integer> consists of one or more digits "0" to "9".
      A <number> can either be an <integer>, or it can be zero
      or more digits followed by a dot (.) followed by one or more
      digits. Both integers and real numbers may be preceded by a "-"
      or "+" to indicate the sign.

      The format of a percentage value is an optional sign character
      ('+' or '-', with '+' being the default) immediately followed by a
      <number> immediately followed by '%'.
    */
    String integerPattern = "([+-]?[0-9]+)";
    String numberPattern = "([+-]?[0-9]+|[+-]?[0-9]*\\.[0-9]+)";
    String rgbTemplate = "^rgb\\(\\s*%1$s\\s*,\\s*%1$s\\s*,\\s*%1$s\\s*\\)$";
    CSS_RGB_PATTERN = Pattern.compile(
        String.format(rgbTemplate, integerPattern));
    CSS_PERCENT_PATTERN = Pattern.compile(
        String.format(rgbTemplate, numberPattern + "%"));

    String rgbaTemplate =
        "^rgba\\(\\s*%1$s\\s*,\\s*%1$s\\s*,\\s*%1$s\\s*\\,\\s*%2$s\\s*\\)$";
    CSS_RGBA_PATTERN = Pattern.compile(
        String.format(rgbaTemplate, integerPattern, numberPattern));
    CSS_RGBA_PERCENT_PATTERN = Pattern.compile(
        String.format(rgbaTemplate, numberPattern + "%", numberPattern));
  }

  /** Map of the 16 allowed colors defined in HTML 4.01. */
  private static final Map<String, Color> HTML_COLOR_MAP
      = new ImmutableMap.Builder<String, Color>()
      .put("aqua", new Color(0x00FFFF))
      .put("black", new Color(0x000000))
      .put("blue", new Color(0x0000FF))
      .put("fuchsia", new Color(0xFF00FF))
      .put("gray", new Color(0x808080))
      .put("green", new Color(0x008000))
      .put("lime", new Color(0x00FF00))
      .put("maroon", new Color(0x800000))
      .put("navy", new Color(0x000080))
      .put("olive", new Color(0x808000))
      .put("purple", new Color(0x800080))
      .put("red", new Color(0xFF0000))
      .put("silver", new Color(0xC0C0C0))
      .put("teal", new Color(0x008080))
      .put("white", new Color(0xFFFFFF))
      .put("yellow", new Color(0xFFFF00))
      .build();

  /** All the named colors defined in CSS 2.1 */
  private static final Map<String, Color> CSS_COLOR_MAP
      = new ImmutableMap.Builder<String, Color>()
      .putAll(HTML_COLOR_MAP)
      .put("orange", new Color(0xFFA500))
      .build();

  /** All the named colors defined in SVG 1.0 */
  private static final Map<String, Color> SVG_COLOR_MAP
      = new ImmutableMap.Builder<String, Color>()
      .putAll(CSS_COLOR_MAP)
      .put("aliceblue", new Color(0xF0F8FF))
      .put("antiquewhite", new Color(0xFAEBD7))
      .put("aquamarine", new Color(0x7FFFD4))
      .put("azure", new Color(0xF0FFFF))
      .put("beige", new Color(0xF5F5DC))
      .put("bisque", new Color(0xFFE4C4))
      .put("blanchedalmond", new Color(0xFFEBCD))
      .put("blueviolet", new Color(0x8A2BE2))
      .put("brown", new Color(0xA52A2A))
      .put("burlywood", new Color(0xDEB887))
      .put("cadetblue", new Color(0x5F9EA0))
      .put("chartreuse", new Color(0x7FFF00))
      .put("chocolate", new Color(0xD2691E))
      .put("coral", new Color(0xFF7F50))
      .put("cornflowerblue", new Color(0x6495ED))
      .put("cornsilk", new Color(0xFFF8DC))
      .put("crimson", new Color(0xDC143C))
      .put("cyan", new Color(0x00FFFF))
      .put("darkblue", new Color(0x00008B))
      .put("darkcyan", new Color(0x008B8B))
      .put("darkgoldenrod", new Color(0xB8860B))
      .put("darkgray", new Color(0xA9A9A9))
      .put("darkgreen", new Color(0x006400))
      .put("darkgrey", new Color(0xA9A9A9))
      .put("darkkhaki", new Color(0xBDB76B))
      .put("darkmagenta", new Color(0x8B008B))
      .put("darkolivegreen", new Color(0x556B2F))
      .put("darkorange", new Color(0xFF8C00))
      .put("darkorchid", new Color(0x9932CC))
      .put("darkred", new Color(0x8B0000))
      .put("darksalmon", new Color(0xE9967A))
      .put("darkseagreen", new Color(0x8FBC8F))
      .put("darkslateblue", new Color(0x483D8B))
      .put("darkslategray", new Color(0x2F4F4F))
      .put("darkslategrey", new Color(0x2F4F4F))
      .put("darkturquoise", new Color(0x00CED1))
      .put("darkviolet", new Color(0x9400D3))
      .put("deeppink", new Color(0xFF1493))
      .put("deepskyblue", new Color(0x00BFFF))
      .put("dimgray", new Color(0x696969))
      .put("dimgrey", new Color(0x696969))
      .put("dodgerblue", new Color(0x1E90FF))
      .put("firebrick", new Color(0xB22222))
      .put("floralwhite", new Color(0xFFFAF0))
      .put("forestgreen", new Color(0x228B22))
      .put("gainsboro", new Color(0xDCDCDC))
      .put("ghostwhite", new Color(0xF8F8FF))
      .put("gold", new Color(0xFFD700))
      .put("goldenrod", new Color(0xDAA520))
      .put("greenyellow", new Color(0xADFF2F))
      .put("grey", new Color(0x808080))
      .put("honeydew", new Color(0xF0FFF0))
      .put("hotpink", new Color(0xFF69B4))
      .put("indianred", new Color(0xCD5C5C))
      .put("indigo", new Color(0x4B0082))
      .put("ivory", new Color(0xFFFFF0))
      .put("khaki", new Color(0xF0E68C))
      .put("lavender", new Color(0xE6E6FA))
      .put("lavenderblush", new Color(0xFFF0F5))
      .put("lawngreen", new Color(0x7CFC00))
      .put("lemonchiffon", new Color(0xFFFACD))
      .put("lightblue", new Color(0xADD8E6))
      .put("lightcoral", new Color(0xF08080))
      .put("lightcyan", new Color(0xE0FFFF))
      .put("lightgoldenrodyellow", new Color(0xFAFAD2))
      .put("lightgray", new Color(0xD3D3D3))
      .put("lightgreen", new Color(0x90EE90))
      .put("lightgrey", new Color(0xD3D3D3))
      .put("lightpink", new Color(0xFFB6C1))
      .put("lightsalmon", new Color(0xFFA07A))
      .put("lightseagreen", new Color(0x20B2AA))
      .put("lightskyblue", new Color(0x87CEFA))
      .put("lightslategray", new Color(0x778899))
      .put("lightslategrey", new Color(0x778899))
      .put("lightsteelblue", new Color(0xB0C4DE))
      .put("lightyellow", new Color(0xFFFFE0))
      .put("limegreen", new Color(0x32CD32))
      .put("linen", new Color(0xFAF0E6))
      .put("magenta", new Color(0xFF00FF))
      .put("mediumaquamarine", new Color(0x66CDAA))
      .put("mediumblue", new Color(0x0000CD))
      .put("mediumorchid", new Color(0xBA55D3))
      .put("mediumpurple", new Color(0x9370DB))
      .put("mediumseagreen", new Color(0x3CB371))
      .put("mediumslateblue", new Color(0x7B68EE))
      .put("mediumspringgreen", new Color(0x00FA9A))
      .put("mediumturquoise", new Color(0x48D1CC))
      .put("mediumvioletred", new Color(0xC71585))
      .put("midnightblue", new Color(0x191970))
      .put("mintcream", new Color(0xF5FFFA))
      .put("mistyrose", new Color(0xFFE4E1))
      .put("moccasin", new Color(0xFFE4B5))
      .put("navajowhite", new Color(0xFFDEAD))
      .put("oldlace", new Color(0xFDF5E6))
      .put("olivedrab", new Color(0x6B8E23))
      .put("orangered", new Color(0xFF4500))
      .put("orchid", new Color(0xDA70D6))
      .put("palegoldenrod", new Color(0xEEE8AA))
      .put("palegreen", new Color(0x98FB98))
      .put("paleturquoise", new Color(0xAFEEEE))
      .put("palevioletred", new Color(0xDB7093))
      .put("papayawhip", new Color(0xFFEFD5))
      .put("peachpuff", new Color(0xFFDAB9))
      .put("peru", new Color(0xCD853F))
      .put("pink", new Color(0xFFC0CB))
      .put("plum", new Color(0xDDA0DD))
      .put("powderblue", new Color(0xB0E0E6))
      .put("rosybrown", new Color(0xBC8F8F))
      .put("royalblue", new Color(0x4169E1))
      .put("saddlebrown", new Color(0x8B4513))
      .put("salmon", new Color(0xFA8072))
      .put("sandybrown", new Color(0xF4A460))
      .put("seagreen", new Color(0x2E8B57))
      .put("seashell", new Color(0xFFF5EE))
      .put("sienna", new Color(0xA0522D))
      .put("skyblue", new Color(0x87CEEB))
      .put("slateblue", new Color(0x6A5ACD))
      .put("slategray", new Color(0x708090))
      .put("slategrey", new Color(0x708090))
      .put("snow", new Color(0xFFFAFA))
      .put("springgreen", new Color(0x00FF7F))
      .put("steelblue", new Color(0x4682B4))
      .put("tan", new Color(0xD2B48C))
      .put("thistle", new Color(0xD8BFD8))
      .put("tomato", new Color(0xFF6347))
      .put("turquoise", new Color(0x40E0D0))
      .put("violet", new Color(0xEE82EE))
      .put("wheat", new Color(0xF5DEB3))
      .put("whitesmoke", new Color(0xF5F5F5))
      .put("yellowgreen", new Color(0x9ACD32))
      .build();

  /** Optional formats that each parser instance can accept. */
  public static enum Format {
    /** #RRGGBB format */
    HEX6 {
      @Override Color parse(String value) {
        return (HEX6_PATTERN.matcher(value).matches())
            ? new Color(Integer.parseInt(value.substring(1), 16)) : null;
      }
    },

    /** #RGB format */
    HEX3 {
      @Override Color parse(String value) {
        return HEX4.parse(value + "F");
      }
    },

    /** #RGBA format */
    HEX4 {
      @Override Color parse(String value) {
        if (HEX4_PATTERN.matcher(value).matches()) {
          int r = Integer.parseInt(value.substring(1, 2), 16);
          int g = Integer.parseInt(value.substring(2, 3), 16);
          int b = Integer.parseInt(value.substring(3, 4), 16);
          int a = Integer.parseInt(value.substring(4, 5), 16);
          return
              new Color((r << 4) | r, (g << 4) | g, (b << 4) | b, (a << 4) | a);
        }
        return null;
      }
    },

    /** #RRGGBBAA format */
    HEX8 {
      @Override Color parse(String value) {
        if (HEX8_PATTERN.matcher(value).matches()) {
          int rgb = Integer.parseInt(value.substring(1, 7), 16);
          int a = Integer.parseInt(value.substring(7, 9), 16);
          return new Color(a << 24 | rgb, true);
        }
        return null;
      }
    },

    /** rgb(R, G, B) format (R/G/B = 0-255 or 0-100%) */
    CSS_RGB {
      @Override Color parse(String value) {
        // Try to parse with 255-based values...
        Matcher matcher = CSS_RGB_PATTERN.matcher(value);
        if (matcher.matches()) {
          return newColor(matcher, 255);
        } else {
          // ... or with percent-based values.
          matcher = CSS_PERCENT_PATTERN.matcher(value);
          return matcher.matches() ? newColor(matcher, 100) : null;
        }
      }

      /** Creates a new color from a regexp match. */
      private Color newColor(Matcher matcher, float max) {
        return new Color(
            clipRangeAndNormalize(matcher.group(1), max),
            clipRangeAndNormalize(matcher.group(2), max),
            clipRangeAndNormalize(matcher.group(3), max));
      }
    },

    /** rgba(R, G, B, A) format (R/G/B = 0-255 or 0-100%, A = 0.0-1.0) */
    CSS_RGBA {
      @Override Color parse(String value) {
        // Try to parse with 255-based values...
        Matcher matcher = CSS_RGBA_PATTERN.matcher(value);
        if (matcher.matches()) {
          return newColor(matcher, 255);
        } else {
          // ... or with percent-based values.
          matcher = CSS_RGBA_PERCENT_PATTERN.matcher(value);
          return matcher.matches() ? newColor(matcher, 100) : null;
        }
      }

      /** Creates a new color from a regexp match. */
      private Color newColor(Matcher matcher, float max) {
        return new Color(
            clipRangeAndNormalize(matcher.group(1), max),
            clipRangeAndNormalize(matcher.group(2), max),
            clipRangeAndNormalize(matcher.group(3), max),
            clipRangeAndNormalize(matcher.group(4), 1));
      }
    },

    /** HTML 4.0 color keywords (16 colors) */
    HTML_KEYWORDS {
      @Override Color parse(String value) {
        return HTML_COLOR_MAP.get(value.toLowerCase());
      }
    },

    /** CSS 2.1 color keywords (HTML + "orange") */
    CSS_KEYWORDS {
      @Override Color parse(String value) {
        return CSS_COLOR_MAP.get(value.toLowerCase());
      }
    },

    /** SVG 1.0 color keywords */
    SVG_KEYWORDS {
      @Override Color parse(String value) {
        return SVG_COLOR_MAP.get(value.toLowerCase());
      }
    };

    /**
     * Parses the given color description.
     *
     * @param value the value to parse
     * @return the parsed color, or null if this format cannot parse the value
     */
    abstract Color parse(String value);

    /**
     * Parses value as float, clips to [0, max], and returns the
     * clipped value divided by the maximum value.
     */
    private static float clipRangeAndNormalize(String value, float max) {
      return Math.max(0, Math.min(max, Float.parseFloat(value))) / max;
    }
  }

  private final Set<Format> formats;

  private static final ColorParser ANY_COLOR_PARSER = new ColorParser(
      Format.HEX3, Format.HEX6, Format.CSS_RGB, Format.CSS_RGBA,
      Format.SVG_KEYWORDS);

  /**
   * Parses a color description using all supported CSS2/CSS3
   * {@linkplain Format formats} (meaning all formats except
   * {@linkplain Format#HEX4 hex-4} and {@linkplain Format#HEX8 hex-8}).
   *
   * @param value the value to parse
   * @return the parsed color
   * @throws IllegalArgumentException if the value cannot be parsed
   */
  public static Color parseAny(String value) {
    return ANY_COLOR_PARSER.parse(value);
  }

  /**
   * Constructs a new instance using the given formats.
   *
   * @param formats the formats to accept
   * @throws IllegalArgumentException if no formats are specified
   */
  public ColorParser(Format... formats) {
    Preconditions.checkArgument(formats.length > 0,
        "At least one format is required");
    this.formats = EnumSet.copyOf(Arrays.asList(formats));
  }

  /**
   * Parses the given color description.
   *
   * @param value the value to parse
   * @return the parsed color
   * @throws IllegalArgumentException if the value cannot be parsed
   */
  public Color parse(String value) {
    value = value.trim();
    for (Format format : formats) {
      Color result = format.parse(value);
      if (result != null) {
        return result;
      }
    }
    // If we get to this point, we're unable to parse the color.
    throw new IllegalArgumentException("Illegal color value, does not match "
        + "any of " + formats + ": " + value);
  }

  /**
   * Formats a hexadecimal color pattern with the given number of digits. For
   * example, a pattern made from 6 digits matches strings such as "#AB4D9F".
   *
   * @param numberOfDigits The number of digits that the pattern should match
   * @return The requested pattern.
   */
  @VisibleForTesting
  static Pattern formatHexadecimalPattern(int numberOfDigits) {
    return Pattern.compile(String.format("^#[0-9a-fA-F]{%d}$", numberOfDigits));
  }
}


text:
<?php

namespace PhpPactTest\Standalone\ProviderVerifier;

use PhpPact\Standalone\Installer\InstallManager;
use PhpPact\Standalone\Installer\Model\Scripts;
use PhpPact\Standalone\ProviderVerifier\ProcessRunnerFactory;
use PhpPact\Standalone\ProviderVerifier\VerifierProcess;
use PhpPact\Standalone\Runner\ProcessRunner;
use PHPUnit\Framework\TestCase;
use Psr\Log\LoggerInterface;

class VerifierProcessTest extends TestCase
{
    public function testRun()
    {
        $verifier  = 'foo';
        $arguments = ['foo' => 'bar'];

        $scripts = $this->createMock(Scripts::class);
        $scripts->expects($this->once())
            ->method('getProviderVerifier')
            ->will($this->returnValue($verifier));

        $logger = $this->createMock(LoggerInterface::class);

        $processRunner = $this->createMock(ProcessRunner::class);

        $installManager = $this->createMock(InstallManager::class);
        $installManager->expects($this->once())
            ->method('install')
            ->will($this->returnValue($scripts));

        $processRunnerFactory = $this->createMock(ProcessRunnerFactory::class);
        $processRunnerFactory->expects($this->once())
            ->method('createRunner')
            ->with($this->equalTo($verifier), $this->equalTo($arguments), $this->equalTo($logger))
            ->will($this->returnValue($processRunner));

        $process = new VerifierProcess($installManager, $processRunnerFactory);
        $process->setLogger($logger);
        $process->run($arguments, 42, 23);
    }

    public function testRunWithDefaultLogger()
    {
        $verifier  = 'foo';
        $arguments = ['foo' => 'bar'];

        $scripts = $this->createMock(Scripts::class);
        $scripts->expects($this->once())
            ->method('getProviderVerifier')
            ->will($this->returnValue($verifier));

        $processRunner = $this->createMock(ProcessRunner::class);

        $installManager = $this->createMock(InstallManager::class);
        $installManager->expects($this->once())
            ->method('install')
            ->will($this->returnValue($scripts));

        $processRunnerFactory = $this->createMock(ProcessRunnerFactory::class);
        $processRunnerFactory->expects($this->once())
            ->method('createRunner')
            ->with($this->equalTo($verifier), $this->equalTo($arguments))
            ->will($this->returnValue($processRunner));

        $process = new VerifierProcess($installManager, $processRunnerFactory);
        $process->run($arguments, 42, 23);
    }

    public function testRunForwardsException()
    {
        $this->expectExceptionMessage('foo');
        $this->expectException(\RuntimeException::class);

        $verifier  = 'foo';
        $arguments = ['foo' => 'bar'];

        $expectedException = new \RuntimeException('foo');

        $scripts = $this->createMock(Scripts::class);
        $scripts->expects($this->once())
            ->method('getProviderVerifier')
            ->will($this->returnValue($verifier));

        $processRunner = $this->createMock(ProcessRunner::class);
        $processRunner->expects($this->once())
            ->method('runBlocking')
            ->will(
                $this->returnCallback(
                    function () use ($expectedException) {
                        throw $expectedException;
                    }
                )
            );

        $installManager = $this->createMock(InstallManager::class);
        $installManager->expects($this->once())
            ->method('install')
            ->will($this->returnValue($scripts));

        $processRunnerFactory = $this->createMock(ProcessRunnerFactory::class);
        $processRunnerFactory->expects($this->once())
            ->method('createRunner')
            ->with($this->equalTo($verifier), $this->equalTo($arguments))
            ->will($this->returnValue($processRunner));

        $process = new VerifierProcess($installManager, $processRunnerFactory);
        $process->run($arguments, 42, 23);
    }
}

redpajama_set_name: RedPajamaGithub


text:
<!DOCTYPE html>

  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <meta name="description" content="Beets Store. A plugin for the misc geek's media organizer.">
  <meta name="author" content="Tobias Schäfer">
  <link rel="icon" href="{{ url_for('static', filename='favicon.png') }}">

  <title>Beets</title>

  <link rel="stylesheet" href="{{ url_for('static', filename='css/bootstrap-3.4.1.min.css') }}">
  <link rel="stylesheet" href="{{ url_for('static', filename='css/font-awesome-4.7.0.min.css') }}">

  {% block style %}{% endblock %}

           Beets Store.

        <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
          Toggle navigation

        </button>

            Albums

            Artists

            Tracks

            LastFM

        {% block navbar_form %}{% endblock %}

    {% block content %}{% endblock %}

  {% block script %}{% endblock %}


text:
package dynamics.api;

import java.util.List;

import net.minecraft.item.ItemStack;

public interface ICustomBreakDrops {
    public void addDrops(List<ItemStack> drops);
}


text:
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Homes on Eric M. Huntley, MUP</title>
    <link>https://ericmhuntley.github.io/home/</link>
    <description>Recent content in Homes on Eric M. Huntley, MUP</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en-us</language>
    <copyright>&copy; 2016 Eric Huntley</copyright>
    <lastBuildDate>Wed, 20 Apr 2016 00:00:00 +0000</lastBuildDate>
    <atom:link href="/home/" rel="self" type="application/rss+xml" />

  </channel>
</rss>


text:
node.default['enterprise']['name'] = 'testproject'

enterprise_pg_database node['test']['database'] do
  encoding node['test']['encoding']
  host node['test']['host']
  owner node['test']['owner']
  password node['test']['password']
  username node['test']['username']
  template node['test']['template']
end


text:
/*
 * @bug     4530538
 * @summary A Barrier utility class.
 * @author  Mandy Chung
 */

public class Barrier {
    private Object go = new Object();
    private int count;
    private int waiters = 0;

    public Barrier(int count) {
        if (count <= 0) {
            throw new IllegalArgumentException();
        }
        this.count = count;
    }

    public void set(int count) {
        if (waiters != 0) {
            throw new IllegalArgumentException();
        }
        this.count = count;
        this.waiters = 0;
    }

    public void await() {
        synchronized (go) {
            waiters++;
            while (count > 0) {
                try {
                    go.wait();
                } catch (InterruptedException e) {
                    e.printStackTrace();
                    throw new InternalError();
                }
            }
            waiters--;
        }
    }
    public void signal() {
        synchronized (go) {
            count--;
            go.notifyAll();
        }
    }

    public int getWaiterCount() {
        synchronized (go) {
            return waiters;
        }
    }
}


text:
<!DOCTYPE HTML>

  <title>
   Werner Family Recipes
  </title>
  <meta charset="utf-8"/>
  <meta content="width=device-width, initial-scale=1" name="viewport"/>

  <link href="../../assets/css/main.css" rel="stylesheet"/>

  <link href="../../../generator/templates/images/touch/chrome-touch-icon-192x192.png" rel="icon" sizes="192x192"/>
  <link href="../../../generator/templates/images/touch/apple-touch-icon.png" rel="apple-touch-icon"/>

         Menu

     Menu

    <button id="searchButton" onclick="enterKeyRedirect()" style="float:right">
     Search
    </button>

     <input class="searchField" id="searchTxt" maxlength="512" name="searchTxt" placeholder="Search Here..." style="width: 100%" type="text"/>

    <button id="scalingButton" onclick="rescaleRecipe()">
     1X
    </button>

       Home

       Appetizer

       Bread

       Breakfast

       Cocktail

       Dessert

       Entree

       Hotdish

       Instant Pot

       Meat

       Pasta

       Side Dish

       Soup

      Chicken Cacciatore

        Ingredients

          3 1/2

          Pounds

          Chicken Thighs and Legs, Bone-In and Skin-On

          1

          Pinch

          Kosher Salt and Freshly Ground Pepper

          1/2

          Cup

          All-Purpose Flour

          3

          Tablespoons

          Olive Oil

          1

          Pound

          Cremini Mushrooms, Washed, Trimmed, and Quartered

          1

          Whole

          Yellow Onion, Thinly Sliced

          5

          Cloves

          Garlic, Thinly Sliced

          3/4

          Cup

          Dry White Wine

          28

          Ounces

          Diced Tomatoes and Juices

          2

          Whole

          Springs of Fresh Rosemary, Sage, or Thyme

          1

          Whole

          Bay Leaf

        Directions

         Preheat oven to 350°.

         Season chicken all over with salt and pepper. Pour a roughly 1/2-inch layer of flour into a wide, shallow bowl. Dredge each chicken piece in flour and tap off excess.

         In a Dutch oven or large straight-sided sauté pan, heat oil over medium-high heat until shimmering. Working in batches, add chicken and cook, turning occasionally, until browned all over, about 4 minutes per side. Transfer chicken to a platter as it finishes cooking and set aside.

         Add mushrooms to pan and cook, scraping up browned bits with a wooden spoon and stirring occasionally, until browned all over, about 8 minutes. Add onion and garlic and cook, stirring and scraping up any browned bits, until softened, about 6 minutes.

         Add wine and bring to a simmer. Add tomatoes and reserved juices, along with herb sprigs and bay leaf. Return to a simmer. Season with salt and pepper. Nestle chicken and any accumulated juices into liquid and vegetables.

         Transfer to oven and cook, uncovered, until chicken is fully cooked through and tender and sauce is slightly reduced and thickened, about 30 minutes. Discard herb sprigs and bay leaf. Serve right away, garnishing with minced parsley if desired.

    <scaling_button_goes_here>
    </scaling_button_goes_here>

       All recipes subject to cooking skill

        Contact the Administrator


text:
id: build-process
title: Build Process
category: Getting Started
---

Build Process
===============

**Development of the `interstellar` project has been paused. Please check out the [JS Stellar SDK](https://www.stellar.org/developers/js-stellar-sdk/learn/index.html) docs for how integrate with Stellar using JavaScript.**

This document explains what the build process looks like in Interstellar.

You may want to begin with the [Getting Started](./) doc.

## Webpack

We're using [Webpack](http://webpack.github.io) for bundling and compilation because of its flexibility, performance and possible code optimizations. Webpack can not only bundle JS files but also stylesheets and this feature is very important in our modules environment.

## Javascript

Interstellar is built using ECMAScript 6 standard of JavaScript. We're using [babel-loader](https://github.com/babel/babel-loader) to compile it to ES5 code. We strongly encourage you to use [ES6 Modules](https://github.com/lukehoban/es6features#modules) to load your files and export resources from your modules.

Interstellar apps have three entry points:
* `vendor.es6` - loaded in `<head>` section of your app and contains common Interstellar modules used by you app and modules.
* `head.es6` - loaded in `<head>` section of your app.
* `main.es6` -  loaded just before `</body>` of your app.

We will allow developers to create more entry points and change Webpack configuration in a near future.

## Stylesheets

_Read more about the css architecture in [solar css framework](https://github.com/stellar/solar) repo._

Interstellar apps use the Solar css framework, a framework designed to enable modules to adapt to different themes with ease. Interstellar apps and modules follow the architecture and style guide of the Solar framework.

Interstellar Module System frontend's building blocks are widgets. Every widget styles are attached to its controller. This means that when developer decides to use a certain widget its styles gets loaded too! But what if an application developer wants to change how it looks like?

Interstellar concatenates project files and then is using [node-sass](https://github.com/sass/node-sass) to compile it. We're concatenating stylesheets in this order:

1. Add in the theming layers of the [solar css framework](https://github.com/stellar/solar) and load the styles and libraries from each of the theme layers. These mixins and variables can be used later by modules and the app.
1. We check your application `styles` folder and concatenate all `*.header.scss` files. It's a great place to add your core styles.
1. We concatenate all styles of loaded widgets.
1. We check your application `styles` folder again but this time we concatenate all `*.footer.scss` files. It's a great place to overwrite widgets' styles.

## CLI

[`interstellar`](https://github.com/stellar/interstellar) is our CLI tool that performs all of the compilation steps. Use:

* `interstellar develop` to open your application in a browser a see changes as you work.
* `interstellar build` to build you application.

## Where to go from here?

<!-- this section is copied in other .md files in this docs folder -->
* Join our [Slack channel](http://slack.stellar.org/) to discuss Interstellar and share ideas!
* Help us develop our [interstellar-client](https://github.com/stellar/interstellar-client).
* [Fix issues](https://github.com/issues?utf8=%E2%9C%93&q=is%3Aopen+repo%3Astellar%2Finterstellar+repo%3Astellar%2Finterstellar-core+repo%3Astellar%2Finterstellar-network+repo%3Astellar%2Finterstellar-network-widgets+repo%3Astellar%2Finterstellar-wallet+repo%3Astellar%2Finterstellar-sessions+repo%3Astellar%2Finterstellar-client) in Interstellar modules.
* Develop your own module!


text:
@implementation ZHView

- (void)drawRect:(NSRect)dirtyRect {
    [super drawRect:dirtyRect];

    // Drawing code here.
}

@end


text:
namespace drafter
{
    namespace utils
    {
        namespace utf8
        {

            using codepoint = std::uint32_t;

            constexpr codepoint replacement = 0xFFFD;
            constexpr codepoint invalid = 0xFFFFFFFF;

            ///
            /// Decode utf8 codepoint from octet sequence
            ///
            /// @param  first   iterator to begin of octet sequence to be decoded from
            /// @param  last    iterator to end of octet sequence to be decoded from
            ///
            /// @returns    iff first equals last, then (0xFFFFFFFF, last) ; else
            ///             iff invalid utf8 sequence, then (0xFFFD, iterator to begin of next Utf8 character)
            ///             otherwise (codepoint, iterator to begin of next Utf8 character)
            ///
            template <typename It>
            typename std::enable_if<is_iterator<It>::value, std::pair<codepoint, It> >::type //
            decode_one(It first, It last)
            {
                if (first == last)
                    return { invalid, last };

                codepoint cp = 0;
                cp |= reinterpret_cast<const unsigned char&>(*first);

                if (cp < 0x80) { // single byte
                    std::advance(first, 1);

                    return { cp, first };
                } else if (cp < 0xE0) { // two bytes
                    if (last - first < 2) {
                        return { replacement, last }; // expected more!
                    }

                    codepoint result = ((cp & 0x1F) << 6) //
                        | (static_cast<unsigned char>(first[1]) & 0x3F);
                    std::advance(first, 2);

                    return { result < 0x80 ? replacement : result, first }; // check for oversized

                } else if (cp < 0xF0) { // three bytes
                    if (last - first < 3) {
                        return { replacement, last }; // expected more!
                    }

                    codepoint result = ((cp & 0x0F) << 12)                     //
                        | ((static_cast<unsigned char>(first[1]) & 0x3F) << 6) //
                        | (static_cast<unsigned char>(first[2]) & 0x3F);
                    std::advance(first, 3);

                    if (result >= 0xD800 && result <= 0xDFFF) // surrogates not codepoints
                        return { replacement, first };

                    return { result < 0x800 ? replacement : result, first }; // check for oversized

                } else { // four bytes
                    if (last - first < 4)
                        return { replacement, last }; // expected more!

                    codepoint result = ((cp & 0x07) << 18)                      //
                        | ((static_cast<unsigned char>(first[1]) & 0x3F) << 12) //
                        | ((static_cast<unsigned char>(first[2]) & 0x3F) << 6)  //
                        | (static_cast<unsigned char>(first[3]) & 0x3F);
                    std::advance(first, 4);

                    // check for oversized
                    if (result < 0x10000)
                        return { replacement, first };

                    // check for overlong sequences
                    if (result > 0x10FFFF)
                        return { replacement, first };

                    return { result, first };
                }
            }

            ///
            /// Encode utf8 codepoint to octet sequence
            ///
            /// @param  c   utf8 codepoint to be serialized
            /// @param  out iterator to start of output sequence
            ///
            /// @returns    iterator to after where last octet was written to
            ///
            template <typename It>
            typename std::enable_if<is_iterator<It>::value, It>::type //
            encode(codepoint c, It out)
            {
                using byte = const std::uint8_t;

                if (c < 0x80) { // single byte
                    byte b1 = c;
                    *out = reinterpret_cast<const char&>(b1);
                    ++out;

                } else if (c < 0x800) { // two bytes
                    {
                        byte b1 = ((c >> 6) & 0b00011111) | 0b11000000;
                        *out = reinterpret_cast<const char&>(b1);
                        ++out;
                    }

                    {
                        byte b2 = (c & 0b00111111) | 0b10000000;
                        *out = reinterpret_cast<const char&>(b2);
                        ++out;
                    }

                } else if (c < 0x10000) { // three bytes
                    {
                        byte b1 = ((c >> 12) & 0b00001111) | 0b11100000;
                        *out = reinterpret_cast<const char&>(b1);
                        ++out;
                    }

                    {
                        byte b2 = ((c >> 6) & 0b00111111) | 0b10000000;
                        *out = reinterpret_cast<const char&>(b2);
                        ++out;
                    }

                    {
                        byte b3 = (c & 0b00111111) | 0b10000000;
                        *out = reinterpret_cast<const char&>(b3);
                        ++out;
                    }

                } else if (c < 0x110000) { // four bytes
                    {
                        byte b1 = ((c >> 18) & 0b00000111) | 0b11110000;
                        *out = reinterpret_cast<const char&>(b1);
                        ++out;
                    }

                    {
                        byte b2 = ((c >> 12) & 0b00111111) | 0b10000000;
                        *out = reinterpret_cast<const char&>(b2);
                        ++out;
                    }

                    {
                        byte b3 = ((c >> 6) & 0b00111111) | 0b10000000;
                        *out = reinterpret_cast<const char&>(b3);
                        ++out;
                    }

                    {
                        byte b4 = (c & 0b00111111) | 0b10000000;
                        *out = reinterpret_cast<const char&>(b4);
                        ++out;
                    }

                } else {
                    assert(false); // invalid codepoint
                }
                return out;
            }

            ///
            /// Validating utf8 input iterator defined above
            ///     a octet sequence with iterator It
            ///
            /// OPTIM: naively buffers current codepoint; benchmark a version
            ///     without buffering
            ///
            template <typename It>
            class input_iterator
            {

            private:
                It e_;
                std::pair<codepoint, It> cp_and_next_;

            public:
                using value_type = codepoint;
                using reference = const codepoint&;
                using pointer = const codepoint*;
                using iterator_category = std::input_iterator_tag;
                using difference_type = typename It::difference_type;

            public:
                template <typename ItT>
                constexpr input_iterator(ItT&& first, ItT&& last) noexcept //
                    : e_(std::forward<ItT>(last)),
                      cp_and_next_(decode_one(first, last))
                {
                }

                template <typename Container>
                explicit constexpr input_iterator(const Container& last) noexcept //
                    : e_(last.end()),
                      cp_and_next_(decode_one(last.begin(), last.end()))
                {
                }

                input_iterator(const input_iterator& other) = default;
                input_iterator(input_iterator&& other) = default;
                input_iterator& operator=(const input_iterator& other) = default;
                input_iterator& operator=(input_iterator&& other) = default;

                friend void swap(input_iterator& lhs, input_iterator& rhs)
                {
                    using std::swap;
                    swap(lhs.e_, rhs.e_);
                    swap(lhs.cp_and_next_, rhs.cp_and_next_);
                }

                friend bool operator==(const input_iterator& lhs, const input_iterator& rhs)
                {
                    return lhs.cp_and_next_ == rhs.cp_and_next_;
                }

                friend bool operator!=(const input_iterator& lhs, const input_iterator& rhs)
                {
                    return !(lhs == rhs);
                }

            public:
                input_iterator& operator++()
                {
                    cp_and_next_ = decode_one(cp_and_next_.second, e_);
                    return *this;
                }

                input_iterator operator++(int)
                {
                    auto result = *this;
                    ++(*this);
                    return result;
                }

                reference operator*() const noexcept
                {
                    return cp_and_next_.first;
                }

                pointer operator->() const
                {
                    return &cp_and_next_.first;
                }
            };
        }
    }
}
#endif


text:
//NB: 'bohrium' is declared in _bhmodule.c

static PyObject *
array_add(PyObject *m1, PyObject *m2) {
    return PyObject_CallMethod(bohrium, "add", "OO", m1, m2);
}

static PyObject *
array_subtract(PyObject *m1, PyObject *m2) {
    return PyObject_CallMethod(bohrium, "subtract", "OO", m1, m2);
}

static PyObject *
array_multiply(PyObject *m1, PyObject *m2) {
    return PyObject_CallMethod(bohrium, "multiply", "OO", m1, m2);
}

#if !defined(NPY_PY3K)
static PyObject *
array_divide(PyObject *m1, PyObject *m2) {
    return PyObject_CallMethod(bohrium, "divide", "OO", m1, m2);
}
#endif

static PyObject *
array_remainder(PyObject *m1, PyObject *m2) {
    return PyObject_CallMethod(bohrium, "mod", "OO", m1, m2);
}

static PyObject *
array_power(PyObject *m1, PyObject *m2, PyObject *modulo) {
    return PyObject_CallMethod(bohrium, "power", "OO", m1, m2);
}

static PyObject *
array_negative(PyObject *m1) {
    return PyObject_CallMethod(bohrium, "negative", "O", m1);
}

static PyObject *
array_absolute(PyObject *m1) {
    return PyObject_CallMethod(bohrium, "absolute", "O", m1);
}

static PyObject *
array_invert(PyObject *m1) {
    return PyObject_CallMethod(bohrium, "invert", "O", m1);
}

static PyObject *
array_left_shift(PyObject *m1, PyObject *m2) {
    return PyObject_CallMethod(bohrium, "left_shift", "OO", m1, m2);
}

static PyObject *
array_right_shift(PyObject *m1, PyObject *m2) {
    return PyObject_CallMethod(bohrium, "right_shift", "OO", m1, m2);
}

static PyObject *
array_bitwise_and(PyObject *m1, PyObject *m2) {
    return PyObject_CallMethod(bohrium, "bitwise_and", "OO", m1, m2);
}

static PyObject *
array_bitwise_or(PyObject *m1, PyObject *m2) {
    return PyObject_CallMethod(bohrium, "bitwise_or", "OO", m1, m2);
}

static PyObject *
array_bitwise_xor(PyObject *m1, PyObject *m2) {
    return PyObject_CallMethod(bohrium, "bitwise_xor", "OO", m1, m2);
}

static PyObject *
array_inplace_add(PyObject *m1, PyObject *m2) {
    return PyObject_CallMethod(bohrium, "add", "OOO", m1, m2, m1);
}

static PyObject *
array_inplace_subtract(PyObject *m1, PyObject *m2) {
    return PyObject_CallMethod(bohrium, "subtract", "OOO", m1, m2, m1);
}

static PyObject *
array_inplace_multiply(PyObject *m1, PyObject *m2) {
    return PyObject_CallMethod(bohrium, "multiply", "OOO", m1, m2, m1);
}

#if !defined(NPY_PY3K)
static PyObject *
array_inplace_divide(PyObject *m1, PyObject *m2) {
    return PyObject_CallMethod(bohrium, "divide", "OOO", m1, m2, m1);
}
#endif

static PyObject *
array_inplace_remainder(PyObject *m1, PyObject *m2) {
    return PyObject_CallMethod(bohrium, "remainder", "OOO", m1, m2, m1);
}

static PyObject *
array_inplace_left_shift(PyObject *m1, PyObject *m2) {
    return PyObject_CallMethod(bohrium, "left_shift", "OOO", m1, m2, m1);
}

static PyObject *
array_inplace_right_shift(PyObject *m1, PyObject *m2) {
    return PyObject_CallMethod(bohrium, "right_shift", "OOO", m1, m2, m1);
}

static PyObject *
array_inplace_bitwise_and(PyObject *m1, PyObject *m2) {
    return PyObject_CallMethod(bohrium, "bitwise_and", "OOO", m1, m2, m1);
}

static PyObject *
array_inplace_bitwise_or(PyObject *m1, PyObject *m2) {
    return PyObject_CallMethod(bohrium, "bitwise_or", "OOO", m1, m2, m1);
}

static PyObject *
array_inplace_bitwise_xor(PyObject *m1, PyObject *m2) {
    return PyObject_CallMethod(bohrium, "bitwise_xor", "OOO", m1, m2, m1);
}

static PyObject *
array_floor_divide(PyObject *m1, PyObject *m2) {
    return PyObject_CallMethod(bohrium, "floor_divide", "OO", m1, m2);
}

static PyObject *
array_true_divide(PyObject *m1, PyObject *m2) {
    return PyObject_CallMethod(bohrium, "true_divide", "OO", m1, m2);
}

static PyObject *
array_inplace_floor_divide(PyObject *m1, PyObject *m2) {
    return PyObject_CallMethod(bohrium, "floor_divide", "OOO", m1, m2, m1);
}

static PyObject *
array_inplace_power(PyObject *m1, PyObject *m2, PyObject *modulo) {
    return PyObject_CallMethod(bohrium, "power", "OOO", m1, m2, m1);
}

static PyObject *
array_inplace_true_divide(PyObject *m1, PyObject *m2) {
    return PyObject_CallMethod(bohrium, "true_divide", "OOO", m1, m2, m1);
}

static PyObject *
array_divmod(PyObject *op1, PyObject *op2) {
    PyObject *divp, *modp, *result;

    divp = array_floor_divide(op1, op2);
    if (divp == NULL) {
        return NULL;
    }
    else if(divp == Py_NotImplemented) {
        return divp;
    }
    modp = array_remainder(op1, op2);
    if (modp == NULL) {
        Py_DECREF(divp);
        return NULL;
    }
    else if(modp == Py_NotImplemented) {
        Py_DECREF(divp);
        return modp;
    }
    result = Py_BuildValue("OO", divp, modp);
    Py_DECREF(divp);
    Py_DECREF(modp);
    return result;
}

static int
array_nonzero(PyArrayObject *mp) {
    npy_intp n;
    int ret;

    n = PyArray_SIZE(mp);
    if (n == 1) {
        PyArrayObject *np_ary = (PyArrayObject*) BhArray_copy2numpy((PyObject*)mp, NULL);
        if (np_ary == NULL) {
            return -1;
        }
        ret = PyArray_DESCR(np_ary)->f->nonzero(PyArray_DATA(np_ary), np_ary);
        Py_DECREF(np_ary);
        return ret;
    }
    else if (n == 0) {
        return 0;
    }
    else {
        PyErr_SetString(PyExc_ValueError,
                        "The truth value of an array " \
                        "with more than one element is ambiguous. " \
                        "Use a.any() or a.all()");
        return -1;
    }
}

static PyObject *
array_float(PyArrayObject *v) {
    if (PyArray_SIZE(v) != 1) {
        PyErr_SetString(PyExc_TypeError, "only length-1 arrays can be converted to Python scalars");
        return NULL;
    }

    PyObject *pv, *pv2;
    PyArrayObject *np_ary = (PyArrayObject*) BhArray_copy2numpy((PyObject*)v, NULL);
    if (np_ary == NULL) {
        return NULL;
    }
    pv = PyArray_DESCR(np_ary)->f->getitem(PyArray_DATA(np_ary), np_ary);

    if (pv == NULL) {
        return NULL;
    }

    if (Py_TYPE(pv)->tp_as_number == 0) {
        PyErr_SetString(PyExc_TypeError, "cannot convert to a float; scalar object is not a number");
        Py_DECREF(pv);
        return NULL;
    }

    if (Py_TYPE(pv)->tp_as_number->nb_float == 0) {
        PyErr_SetString(PyExc_TypeError, "don't know how to convert scalar number to float");
        Py_DECREF(pv);
        return NULL;
    }

    /*
     * If we still got an array which can hold references, stop
     * because it could point back at 'v'.
     */
    if (PyArray_Check(pv) && PyDataType_REFCHK(PyArray_DESCR((PyArrayObject *)pv))) {
        PyErr_SetString(PyExc_TypeError, "object array may be self-referencing");
        Py_DECREF(pv);
        return NULL;
    }

    pv2 = Py_TYPE(pv)->tp_as_number->nb_float(pv);
    Py_DECREF(pv);
    return pv2;
}

NPY_NO_EXPORT PyObject *
array_int(PyArrayObject *v) {
    if (PyArray_SIZE(v) != 1) {
        PyErr_SetString(PyExc_TypeError, "only length-1 arrays can be converted to Python scalars");
        return NULL;
    }

    PyObject *pv, *pv2;
    PyArrayObject *np_ary = (PyArrayObject*) BhArray_copy2numpy((PyObject*)v, NULL);
    if (np_ary == NULL) {
        return NULL;
    }
    pv = PyArray_DESCR(np_ary)->f->getitem(PyArray_DATA(np_ary), np_ary);

    if (pv == NULL) {
        return NULL;
    }

    if (Py_TYPE(pv)->tp_as_number == 0) {
        PyErr_SetString(PyExc_TypeError, "cannot convert to an int; scalar object is not a number");
        Py_DECREF(pv);
        return NULL;
    }

    if (Py_TYPE(pv)->tp_as_number->nb_int == 0) {
        PyErr_SetString(PyExc_TypeError, "don't know how to convert scalar number to int");
        Py_DECREF(pv);
        return NULL;
    }

    /*
     * If we still got an array which can hold references, stop
     * because it could point back at 'v'.
     */
    if (PyArray_Check(pv) && PyDataType_REFCHK(PyArray_DESCR((PyArrayObject *)pv))) {
        PyErr_SetString(PyExc_TypeError, "object array may be self-referencing");
        Py_DECREF(pv);
        return NULL;
    }

    pv2 = Py_TYPE(pv)->tp_as_number->nb_int(pv);
    Py_DECREF(pv);
    return pv2;
}

#if !defined(NPY_PY3K)
static PyObject *
array_long(PyArrayObject *v) {
    if (PyArray_SIZE(v) != 1) {
        PyErr_SetString(PyExc_TypeError, "only length-1 arrays can be converted to Python scalars");
        return NULL;
    }

    PyObject *pv, *pv2;
    PyArrayObject *np_ary = (PyArrayObject*) BhArray_copy2numpy((PyObject*)v, NULL);
    if (np_ary == NULL) {
        return NULL;
    }
    pv = PyArray_DESCR(np_ary)->f->getitem(PyArray_DATA(np_ary), np_ary);

    if (pv == NULL) {
        return NULL;
    }

    if (Py_TYPE(pv)->tp_as_number == 0) {
        PyErr_SetString(PyExc_TypeError, "cannot convert to a long; scalar object is not a number");
        Py_DECREF(pv);
        return NULL;
    }

    if (Py_TYPE(pv)->tp_as_number->nb_long == 0) {
        PyErr_SetString(PyExc_TypeError, "don't know how to convert scalar number to long");
        Py_DECREF(pv);
        return NULL;
    }

    /*
     * If we still got an array which can hold references, stop
     * because it could point back at 'v'.
     */
    if (PyArray_Check(pv) && PyDataType_REFCHK(PyArray_DESCR((PyArrayObject *)pv))) {
        PyErr_SetString(PyExc_TypeError, "object array may be self-referencing");
        Py_DECREF(pv);
        return NULL;
    }

    pv2 = Py_TYPE(pv)->tp_as_number->nb_long(pv);
    Py_DECREF(pv);
    return pv2;
}

static PyObject *
array_oct(PyArrayObject *v) {
    if (PyArray_SIZE(v) != 1) {
        PyErr_SetString(PyExc_TypeError, "only length-1 arrays can be converted to Python scalars");
        return NULL;
    }

    PyObject *pv, *pv2;
    PyArrayObject *np_ary = (PyArrayObject*) BhArray_copy2numpy((PyObject*)v, NULL);
    if (np_ary == NULL) {
        return NULL;
    }
    pv = PyArray_DESCR(np_ary)->f->getitem(PyArray_DATA(np_ary), np_ary);

    if (pv == NULL) {
        return NULL;
    }

    if (Py_TYPE(pv)->tp_as_number == 0) {
        PyErr_SetString(PyExc_TypeError, "cannot convert to oct; scalar object is not a number");
        Py_DECREF(pv);
        return NULL;
    }

    if (Py_TYPE(pv)->tp_as_number->nb_oct == 0) {
        PyErr_SetString(PyExc_TypeError, "don't know how to convert scalar number to oct");
        Py_DECREF(pv);
        return NULL;
    }

    /*
     * If we still got an array which can hold references, stop
     * because it could point back at 'v'.
     */
    if (PyArray_Check(pv) && PyDataType_REFCHK(PyArray_DESCR((PyArrayObject *)pv))) {
        PyErr_SetString(PyExc_TypeError, "object array may be self-referencing");
        Py_DECREF(pv);
        return NULL;
    }

    pv2 = Py_TYPE(pv)->tp_as_number->nb_oct(pv);
    Py_DECREF(pv);
    return pv2;
}

static PyObject *
array_hex(PyArrayObject *v) {
    if (PyArray_SIZE(v) != 1) {
        PyErr_SetString(PyExc_TypeError, "only length-1 arrays can be converted to Python scalars");
        return NULL;
    }

    PyObject *pv, *pv2;
    PyArrayObject *np_ary = (PyArrayObject*) BhArray_copy2numpy((PyObject*)v, NULL);
    if (np_ary == NULL) {
        return NULL;
    }
    pv = PyArray_DESCR(np_ary)->f->getitem(PyArray_DATA(np_ary), np_ary);

    if (pv == NULL) {
        return NULL;
    }

    if (Py_TYPE(pv)->tp_as_number == 0) {
        PyErr_SetString(PyExc_TypeError, "cannot convert to hex; scalar object is not a number");
        Py_DECREF(pv);
        return NULL;
    }

    if (Py_TYPE(pv)->tp_as_number->nb_hex == 0) {
        PyErr_SetString(PyExc_TypeError, "don't know how to convert scalar number to hex");
        Py_DECREF(pv);
        return NULL;
    }

    /*
     * If we still got an array which can hold references, stop
     * because it could point back at 'v'.
     */
    if (PyArray_Check(pv) && PyDataType_REFCHK(PyArray_DESCR((PyArrayObject *)pv))) {
        PyErr_SetString(PyExc_TypeError, "object array may be self-referencing");
        Py_DECREF(pv);
        return NULL;
    }

    pv2 = Py_TYPE(pv)->tp_as_number->nb_hex(pv);
    Py_DECREF(pv);
    return pv2;
}
#endif

static PyObject *
array_positive(PyArrayObject *v) {
    PyErr_SetString(PyExc_TypeError, "to positive is not implemented");
    return NULL;
}

PyNumberMethods array_as_number = {
    (binaryfunc)array_add,                      /*nb_add*/
    (binaryfunc)array_subtract,                 /*nb_subtract*/
    (binaryfunc)array_multiply,                 /*nb_multiply*/
#if !defined(NPY_PY3K)
    (binaryfunc)array_divide,                   /*nb_divide*/
#endif
    (binaryfunc)array_remainder,                /*nb_remainder*/
    (binaryfunc)array_divmod,                   /*nb_divmod*/
    (ternaryfunc)array_power,                   /*nb_power*/
    (unaryfunc)array_negative,                  /*nb_neg*/
    (unaryfunc)array_positive,                  /*nb_pos*/
    (unaryfunc)array_absolute,                  /*array_abs,*/
    (inquiry)array_nonzero,                     /*nb_nonzero*/
    (unaryfunc)array_invert,                    /*nb_invert*/
    (binaryfunc)array_left_shift,               /*nb_lshift*/
    (binaryfunc)array_right_shift,              /*nb_rshift*/
    (binaryfunc)array_bitwise_and,              /*nb_and*/
    (binaryfunc)array_bitwise_xor,              /*nb_xor*/
    (binaryfunc)array_bitwise_or,               /*nb_or*/
#if !defined(NPY_PY3K)
    0,                                          /*nb_coerce*/
#endif
    (unaryfunc)array_int,                       /*nb_int*/
#if defined(NPY_PY3K)
    0,                                          /*nb_reserved*/
#else
    (unaryfunc)array_long,                      /*nb_long*/
#endif
    (unaryfunc)array_float,                     /*nb_float*/
#if !defined(NPY_PY3K)
    (unaryfunc)array_oct,                       /*nb_oct*/
    (unaryfunc)array_hex,                       /*nb_hex*/
#endif
    (binaryfunc)array_inplace_add,              /*inplace_add*/
    (binaryfunc)array_inplace_subtract,         /*inplace_subtract*/
    (binaryfunc)array_inplace_multiply,         /*inplace_multiply*/
#if !defined(NPY_PY3K)
    (binaryfunc)array_inplace_divide,           /*inplace_divide*/
#endif
    (binaryfunc)array_inplace_remainder,        /*inplace_remainder*/
    (ternaryfunc)array_inplace_power,           /*inplace_power*/
    (binaryfunc)array_inplace_left_shift,       /*inplace_lshift*/
    (binaryfunc)array_inplace_right_shift,      /*inplace_rshift*/
    (binaryfunc)array_inplace_bitwise_and,      /*inplace_and*/
    (binaryfunc)array_inplace_bitwise_xor,      /*inplace_xor*/
    (binaryfunc)array_inplace_bitwise_or,       /*inplace_or*/

    (binaryfunc)array_floor_divide,             /*nb_floor_divide*/
    (binaryfunc)array_true_divide,              /*nb_true_divide*/
    (binaryfunc)array_inplace_floor_divide,     /*nb_inplace_floor_divide*/
    (binaryfunc)array_inplace_true_divide,      /*nb_inplace_true_divide*/
    (unaryfunc)0,                               /*nb_index */
};

static PyObject *
array_richcompare(PyArrayObject *self, PyObject *other, int cmp_op) {
    switch (cmp_op) {
    case Py_LT:
        return PyObject_CallMethod(bohrium, "less", "OO", self, other);
    case Py_LE:
        return PyObject_CallMethod(bohrium, "less_equal", "OO", self, other);
    case Py_EQ:
        return PyObject_CallMethod(bohrium, "equal", "OO", self, other);
    case Py_NE:
        return PyObject_CallMethod(bohrium, "not_equal", "OO", self, other);
    case Py_GT:
        return PyObject_CallMethod(bohrium, "greater", "OO", self, other);
    case Py_GE:
        return PyObject_CallMethod(bohrium, "greater_equal", "OO", self, other);
    default:
        return NULL;
    }
}


text:
@interface NetworkViewController ()
// ViewModel
@property (nonatomic,strong) requestViewModel *requestVM;
@end

@implementation NetworkViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
//    [self.requestVM.requestCommand execute:nil];
    RACSignal *signal = [self.requestVM.requestCommand execute:nil];

    [signal subscribeNext:^(id x) {
        // 模型数组
        Book *book = x[1];
        NSLog(@"%@",book.title);
    }];
}
- (IBAction)goToBack:(id)sender {
    [self dismissViewControllerAnimated:YES completion:nil];
}

- (requestViewModel *)requestVM {
    if (!_requestVM) {
        _requestVM = [[requestViewModel alloc] init];
    }
    return _requestVM;
}

@end


text:
ACCEPTED

#### According to
International Plant Names Index

#### Published in
null

#### Original name
Pentas austroorientalis Homolle & Verdc.

### Remarks
null


text:
/*_ASSIGN_ ET*/
var express = require("express"),
    router = express.Router();

router.route("/:thread_id")
    .post(require("./POST.js"))
    .get(require("./GET.js"));

module.exports = router;


text:
package main

import (
	"fmt"
	"os"
	"time"

	check "github.com/solo-io/go-checkpoint"
	"github.com/solo-io/squash/pkg/squashctl"
	"github.com/solo-io/squash/pkg/version"
)

func main() {
	start := time.Now()
	defer check.CallReport("squashctl", version.Version, start)

	app, err := squashctl.App(fmt.Sprint(version.Version))
	if err != nil {
		fmt.Println(err)
		os.Exit(1)
	}

	if err := app.Execute(); err != nil {
		fmt.Println(err)
		os.Exit(1)
	}
}


text:
package firestore

import (
	"context"
	"testing"

	"github.com/golang/protobuf/ptypes/empty"
	"google.golang.org/api/iterator"
	pb "google.golang.org/genproto/googleapis/firestore/v1beta1"
	"google.golang.org/grpc"
	"google.golang.org/grpc/codes"
	"google.golang.org/grpc/status"
)

func TestRunTransaction(t *testing.T) {
	ctx := context.Background()
	const db = "projects/projectID/databases/(default)"
	tid := []byte{1}
	c, srv := newMock(t)
	beginReq := &pb.BeginTransactionRequest{Database: db}
	beginRes := &pb.BeginTransactionResponse{Transaction: tid}
	commitReq := &pb.CommitRequest{Database: db, Transaction: tid}
	// Empty transaction.
	srv.addRPC(beginReq, beginRes)
	srv.addRPC(commitReq, &pb.CommitResponse{CommitTime: aTimestamp})
	err := c.RunTransaction(ctx, func(context.Context, *Transaction) error { return nil })
	if err != nil {
		t.Fatal(err)
	}

	// Transaction with read and write.
	srv.reset()
	srv.addRPC(beginReq, beginRes)
	aDoc := &pb.Document{
		Name:       db + "/documents/C/a",
		CreateTime: aTimestamp,
		UpdateTime: aTimestamp2,
		Fields:     map[string]*pb.Value{"count": intval(1)},
	}
	srv.addRPC(
		&pb.BatchGetDocumentsRequest{
			Database:            c.path(),
			Documents:           []string{db + "/documents/C/a"},
			ConsistencySelector: &pb.BatchGetDocumentsRequest_Transaction{tid},
		}, []interface{}{
			&pb.BatchGetDocumentsResponse{
				Result:   &pb.BatchGetDocumentsResponse_Found{aDoc},
				ReadTime: aTimestamp2,
			},
		})
	aDoc2 := &pb.Document{
		Name:   aDoc.Name,
		Fields: map[string]*pb.Value{"count": intval(2)},
	}
	srv.addRPC(
		&pb.CommitRequest{
			Database:    db,
			Transaction: tid,
			Writes: []*pb.Write{{
				Operation:  &pb.Write_Update{aDoc2},
				UpdateMask: &pb.DocumentMask{FieldPaths: []string{"count"}},
				CurrentDocument: &pb.Precondition{
					ConditionType: &pb.Precondition_Exists{true},
				},
			}},
		},
		&pb.CommitResponse{CommitTime: aTimestamp3},
	)
	err = c.RunTransaction(ctx, func(_ context.Context, tx *Transaction) error {
		docref := c.Collection("C").Doc("a")
		doc, err := tx.Get(docref)
		if err != nil {
			return err
		}
		count, err := doc.DataAt("count")
		if err != nil {
			return err
		}
		return tx.Update(docref, []Update{{Path: "count", Value: count.(int64) + 1}})
	})
	if err != nil {
		t.Fatal(err)
	}

	// Query
	srv.reset()
	srv.addRPC(beginReq, beginRes)
	srv.addRPC(
		&pb.RunQueryRequest{
			Parent: db,
			QueryType: &pb.RunQueryRequest_StructuredQuery{
				&pb.StructuredQuery{
					From: []*pb.StructuredQuery_CollectionSelector{{CollectionId: "C"}},
				},
			},
			ConsistencySelector: &pb.RunQueryRequest_Transaction{tid},
		},
		[]interface{}{},
	)
	srv.addRPC(commitReq, &pb.CommitResponse{CommitTime: aTimestamp3})
	err = c.RunTransaction(ctx, func(_ context.Context, tx *Transaction) error {
		it := tx.Documents(c.Collection("C"))
		defer it.Stop()
		_, err := it.Next()
		if err != iterator.Done {
			return err
		}
		return nil
	})
	if err != nil {
		t.Fatal(err)
	}

	// Retry entire transaction.
	srv.reset()
	srv.addRPC(beginReq, beginRes)
	srv.addRPC(commitReq, status.Errorf(codes.Aborted, ""))
	srv.addRPC(
		&pb.BeginTransactionRequest{
			Database: db,
			Options: &pb.TransactionOptions{
				Mode: &pb.TransactionOptions_ReadWrite_{
					&pb.TransactionOptions_ReadWrite{RetryTransaction: tid},
				},
			},
		},
		beginRes,
	)
	srv.addRPC(commitReq, &pb.CommitResponse{CommitTime: aTimestamp})
	err = c.RunTransaction(ctx, func(_ context.Context, tx *Transaction) error { return nil })
	if err != nil {
		t.Fatal(err)
	}
}

func TestTransactionErrors(t *testing.T) {
	ctx := context.Background()
	const db = "projects/projectID/databases/(default)"
	c, srv := newMock(t)
	var (
		tid         = []byte{1}
		internalErr = status.Errorf(codes.Internal, "so sad")
		beginReq    = &pb.BeginTransactionRequest{
			Database: db,
		}
		beginRes = &pb.BeginTransactionResponse{Transaction: tid}
		getReq   = &pb.BatchGetDocumentsRequest{
			Database:            c.path(),
			Documents:           []string{db + "/documents/C/a"},
			ConsistencySelector: &pb.BatchGetDocumentsRequest_Transaction{tid},
		}
		rollbackReq = &pb.RollbackRequest{Database: db, Transaction: tid}
		commitReq   = &pb.CommitRequest{Database: db, Transaction: tid}
	)

	// BeginTransaction has a permanent error.
	srv.addRPC(beginReq, internalErr)
	err := c.RunTransaction(ctx, func(context.Context, *Transaction) error { return nil })
	if grpc.Code(err) != codes.Internal {
		t.Errorf("got <%v>, want Internal", err)
	}

	// Get has a permanent error.
	get := func(_ context.Context, tx *Transaction) error {
		_, err := tx.Get(c.Doc("C/a"))
		return err
	}
	srv.reset()
	srv.addRPC(beginReq, beginRes)
	srv.addRPC(getReq, internalErr)
	srv.addRPC(rollbackReq, &empty.Empty{})
	err = c.RunTransaction(ctx, get)
	if grpc.Code(err) != codes.Internal {
		t.Errorf("got <%v>, want Internal", err)
	}

	// Get has a permanent error, but the rollback fails. We still
	// return Get's error.
	srv.reset()
	srv.addRPC(beginReq, beginRes)
	srv.addRPC(getReq, internalErr)
	srv.addRPC(rollbackReq, status.Errorf(codes.FailedPrecondition, ""))
	err = c.RunTransaction(ctx, get)
	if grpc.Code(err) != codes.Internal {
		t.Errorf("got <%v>, want Internal", err)
	}

	// Commit has a permanent error.
	srv.reset()
	srv.addRPC(beginReq, beginRes)
	srv.addRPC(getReq, []interface{}{
		&pb.BatchGetDocumentsResponse{
			Result: &pb.BatchGetDocumentsResponse_Found{&pb.Document{
				Name:       "projects/projectID/databases/(default)/documents/C/a",
				CreateTime: aTimestamp,
				UpdateTime: aTimestamp2,
			}},
			ReadTime: aTimestamp2,
		},
	})
	srv.addRPC(commitReq, internalErr)
	err = c.RunTransaction(ctx, get)
	if grpc.Code(err) != codes.Internal {
		t.Errorf("got <%v>, want Internal", err)
	}

	// Read after write.
	srv.reset()
	srv.addRPC(beginReq, beginRes)
	srv.addRPC(rollbackReq, &empty.Empty{})
	err = c.RunTransaction(ctx, func(_ context.Context, tx *Transaction) error {
		if err := tx.Delete(c.Doc("C/a")); err != nil {
			return err
		}
		if _, err := tx.Get(c.Doc("C/a")); err != nil {
			return err
		}
		return nil
	})
	if err != errReadAfterWrite {
		t.Errorf("got <%v>, want <%v>", err, errReadAfterWrite)
	}

	// Read after write, with query.
	srv.reset()
	srv.addRPC(beginReq, beginRes)
	srv.addRPC(rollbackReq, &empty.Empty{})
	err = c.RunTransaction(ctx, func(_ context.Context, tx *Transaction) error {
		if err := tx.Delete(c.Doc("C/a")); err != nil {
			return err
		}
		it := tx.Documents(c.Collection("C").Select("x"))
		defer it.Stop()
		if _, err := it.Next(); err != iterator.Done {
			return err
		}
		return nil
	})
	if err != errReadAfterWrite {
		t.Errorf("got <%v>, want <%v>", err, errReadAfterWrite)
	}

	// Read after write fails even if the user ignores the read's error.
	srv.reset()
	srv.addRPC(beginReq, beginRes)
	srv.addRPC(rollbackReq, &empty.Empty{})
	err = c.RunTransaction(ctx, func(_ context.Context, tx *Transaction) error {
		if err := tx.Delete(c.Doc("C/a")); err != nil {
			return err
		}
		if _, err := tx.Get(c.Doc("C/a")); err != nil {
			return err
		}
		return nil
	})
	if err != errReadAfterWrite {
		t.Errorf("got <%v>, want <%v>", err, errReadAfterWrite)
	}

	// Write in read-only transaction.
	srv.reset()
	srv.addRPC(
		&pb.BeginTransactionRequest{
			Database: db,
			Options: &pb.TransactionOptions{
				Mode: &pb.TransactionOptions_ReadOnly_{&pb.TransactionOptions_ReadOnly{}},
			},
		},
		beginRes,
	)
	srv.addRPC(rollbackReq, &empty.Empty{})
	err = c.RunTransaction(ctx, func(_ context.Context, tx *Transaction) error {
		return tx.Delete(c.Doc("C/a"))
	}, ReadOnly)
	if err != errWriteReadOnly {
		t.Errorf("got <%v>, want <%v>", err, errWriteReadOnly)
	}

	// Too many retries.
	srv.reset()
	srv.addRPC(beginReq, beginRes)
	srv.addRPC(commitReq, status.Errorf(codes.Aborted, ""))
	srv.addRPC(
		&pb.BeginTransactionRequest{
			Database: db,
			Options: &pb.TransactionOptions{
				Mode: &pb.TransactionOptions_ReadWrite_{
					&pb.TransactionOptions_ReadWrite{RetryTransaction: tid},
				},
			},
		},
		beginRes,
	)
	srv.addRPC(commitReq, status.Errorf(codes.Aborted, ""))
	srv.addRPC(rollbackReq, &empty.Empty{})
	err = c.RunTransaction(ctx, func(context.Context, *Transaction) error { return nil },
		MaxAttempts(2))
	if grpc.Code(err) != codes.Aborted {
		t.Errorf("got <%v>, want Aborted", err)
	}

	// Nested transaction.
	srv.reset()
	srv.addRPC(beginReq, beginRes)
	srv.addRPC(rollbackReq, &empty.Empty{})
	err = c.RunTransaction(ctx, func(ctx context.Context, tx *Transaction) error {
		return c.RunTransaction(ctx, func(context.Context, *Transaction) error { return nil })
	})
	if got, want := err, errNestedTransaction; got != want {
		t.Errorf("got <%v>, want <%v>", got, want)
	}

	// Non-transactional operation.
	dr := c.Doc("C/d")

	for i, op := range []func(ctx context.Context) error{
		func(ctx context.Context) error { _, err := c.GetAll(ctx, []*DocumentRef{dr}); return err },
		func(ctx context.Context) error { _, _, err := c.Collection("C").Add(ctx, testData); return err },
		func(ctx context.Context) error { _, err := dr.Get(ctx); return err },
		func(ctx context.Context) error { _, err := dr.Create(ctx, testData); return err },
		func(ctx context.Context) error { _, err := dr.Set(ctx, testData); return err },
		func(ctx context.Context) error { _, err := dr.Delete(ctx); return err },
		func(ctx context.Context) error {
			_, err := dr.Update(ctx, []Update{{FieldPath: []string{"*"}, Value: 1}})
			return err
		},
		func(ctx context.Context) error { it := c.Collections(ctx); _, err := it.Next(); return err },
		func(ctx context.Context) error { it := dr.Collections(ctx); _, err := it.Next(); return err },
		func(ctx context.Context) error {
			_, err := c.Batch().Set(dr, testData).Commit(ctx)
			return err
		},
		func(ctx context.Context) error {
			it := c.Collection("C").Documents(ctx)
			defer it.Stop()
			_, err := it.Next()
			return err
		},
	} {
		srv.reset()
		srv.addRPC(beginReq, beginRes)
		srv.addRPC(rollbackReq, &empty.Empty{})
		err = c.RunTransaction(ctx, func(ctx context.Context, _ *Transaction) error {
			return op(ctx)
		})
		if got, want := err, errNonTransactionalOp; got != want {
			t.Errorf("#%d: got <%v>, want <%v>", i, got, want)
		}
	}
}

func TestTransactionGetAll(t *testing.T) {
	c, srv := newMock(t)
	defer c.Close()
	const dbPath = "projects/projectID/databases/(default)"
	tid := []byte{1}
	beginReq := &pb.BeginTransactionRequest{Database: dbPath}
	beginRes := &pb.BeginTransactionResponse{Transaction: tid}
	srv.addRPC(beginReq, beginRes)
	req := &pb.BatchGetDocumentsRequest{
		Database: dbPath,
		Documents: []string{
			dbPath + "/documents/C/a",
			dbPath + "/documents/C/b",
			dbPath + "/documents/C/c",
		},
		ConsistencySelector: &pb.BatchGetDocumentsRequest_Transaction{tid},
	}
	err := c.RunTransaction(context.Background(), func(_ context.Context, tx *Transaction) error {
		testGetAll(t, c, srv, dbPath,
			func(drs []*DocumentRef) ([]*DocumentSnapshot, error) { return tx.GetAll(drs) },
			req)
		commitReq := &pb.CommitRequest{Database: dbPath, Transaction: tid}
		srv.addRPC(commitReq, &pb.CommitResponse{CommitTime: aTimestamp})
		return nil
	})
	if err != nil {
		t.Fatal(err)
	}
}


text:
#include <windows.h>
#include "config.h"
#include <vector>

#include "platform/fonts/Font.h"
#include "platform/fonts/GlyphPageTreeNode.h"
#include "platform/fonts/SimpleFontData.h"
#include "platform/fonts/win/FontPlatformDataWin.h"
#include "platform/fonts/win/UniscribeHelperTextRun.h"
#include "platform/win/HWndDC.h"
#include "platform/win/SystemInfo.h"

namespace WebCore {

// Fills one page of font data pointers with 0 to indicate that there
// are no glyphs for the characters.
static void fillEmptyGlyphs(GlyphPage* page)
{
    for (int i = 0; i < GlyphPage::size; ++i)
        page->setGlyphDataForIndex(i, 0, 0);
}

// Convert characters to glyph ids by GetGlyphIndices(), during which, we
// ensure the font is loaded in memory to make it work in a sandboxed process.
static bool getGlyphIndices(HFONT font, HDC dc, const UChar* characters, unsigned charactersLength, WORD* glyphBuffer, DWORD flag)
{
    if (GetGlyphIndices(dc, characters, charactersLength, glyphBuffer, flag) != GDI_ERROR)
        return true;
    if (FontPlatformData::ensureFontLoaded(font)) {
        if (GetGlyphIndices(dc, characters, charactersLength, glyphBuffer, flag) != GDI_ERROR)
            return true;
        // FIXME: Handle gracefully the error if this call also fails.
        // See http://crbug.com/6401
        WTF_LOG_ERROR("Unable to get the glyph indices after second attempt");
    }
    return false;
}

// Initializes space glyph
static bool initSpaceGlyph(HFONT font, HDC dc, Glyph* spaceGlyph)
{
    static wchar_t space = ' ';
    return getGlyphIndices(font, dc, &space, 1, spaceGlyph, 0);
}

// Fills |length| glyphs starting at |offset| in a |page| in the Basic
// Multilingual Plane (<= U+FFFF). The input buffer size should be the
// same as |length|. We can use the standard Windows GDI functions here.
// Returns true if any glyphs were found.
static bool fillBMPGlyphs(unsigned offset,
                          unsigned length,
                          UChar* buffer,
                          GlyphPage* page,
                          const SimpleFontData* fontData)
{
    HWndDC dc(0);
    HGDIOBJ oldFont = SelectObject(dc, fontData->platformData().hfont());

    TEXTMETRIC tm = {0};
    if (!GetTextMetrics(dc, &tm)) {
        if (FontPlatformData::ensureFontLoaded(fontData->platformData().hfont())) {
            if (!GetTextMetrics(dc, &tm)) {
                // FIXME: Handle gracefully the error if this call also fails.
                // See http://crbug.com/6401
                WTF_LOG_ERROR("Unable to get the text metrics after second attempt");

                SelectObject(dc, oldFont);
                fillEmptyGlyphs(page);
                return false;
            }
        } else {
            SelectObject(dc, oldFont);
            fillEmptyGlyphs(page);
            return false;
        }
    }

    // FIXME: GetGlyphIndices() sets each item of localGlyphBuffer[]
    // with the one of the values listed below.
    //  * With the GGI_MARK_NONEXISTING_GLYPHS flag
    //    + If the font has a glyph available for the character,
    //      localGlyphBuffer[i] > 0x0.
    //    + If the font does not have glyphs available for the character,
    //      localGlyphBuffer[i] = 0x1F (TrueType Collection?) or
    //                            0xFFFF (OpenType?).
    //  * Without the GGI_MARK_NONEXISTING_GLYPHS flag
    //    + If the font has a glyph available for the character,
    //      localGlyphBuffer[i] > 0x0.
    //    + If the font does not have glyphs available for the character,
    //      localGlyphBuffer[i] = 0x80.
    //      (Windows automatically assigns the glyph for a box character to
    //      prevent ExtTextOut() from returning errors.)
    // To avoid from hurting the rendering performance, this code just
    // tells WebKit whether or not the all glyph indices for the given
    // characters are 0x80 (i.e. a possibly-invalid glyph) and let it
    // use alternative fonts for the characters.
    // Although this may cause a problem, it seems to work fine as far as I
    // have tested. (Obviously, I need more tests.)
    WORD localGlyphBuffer[GlyphPage::size];

    // FIXME: I find some Chinese characters can not be correctly displayed
    // when call GetGlyphIndices without flag GGI_MARK_NONEXISTING_GLYPHS,
    // because the corresponding glyph index is set as 0x20 when current font
    // does not have glyphs available for the character. According a blog post
    // http://blogs.msdn.com/michkap/archive/2006/06/28/649791.aspx
    // I think we should switch to the way about calling GetGlyphIndices with
    // flag GGI_MARK_NONEXISTING_GLYPHS, it should be OK according the
    // description of MSDN.
    // Also according to Jungshik and Hironori's suggestion and modification
    // we treat turetype and raster Font as different way when windows version
    // is less than Vista.
    if (!getGlyphIndices(fontData->platformData().hfont(), dc, buffer, length, localGlyphBuffer, GGI_MARK_NONEXISTING_GLYPHS)) {
        SelectObject(dc, oldFont);
        fillEmptyGlyphs(page);
        return false;
    }

    // Copy the output to the GlyphPage
    bool haveGlyphs = false;
    int invalidGlyph = 0xFFFF;
    const DWORD cffTableTag = 0x20464643; // 4-byte identifier for OpenType CFF table ('CFF ').
    if (!isWindowsVistaOrGreater() && !(tm.tmPitchAndFamily & TMPF_TRUETYPE) && (GetFontData(dc, cffTableTag, 0, 0, 0) == GDI_ERROR))
        invalidGlyph = 0x1F;

    Glyph spaceGlyph = 0;  // Glyph for a space. Lazily filled.
    bool spaceGlyphInitialized = false;

    for (unsigned i = 0; i < length; i++) {
        UChar c = buffer[i];
        Glyph glyph = localGlyphBuffer[i];
        const SimpleFontData* glyphFontData = fontData;
        // When this character should be a space, we ignore whatever the font
        // says and use a space. Otherwise, if fonts don't map one of these
        // space or zero width glyphs, we will get a box.
        if (Font::treatAsSpace(c)) {
            // Hard code the glyph indices for characters that should be
            // treated like spaces.
            if (!spaceGlyphInitialized) {
                // If initSpaceGlyph fails, spaceGlyph stays 0 (= glyph is not present).
                initSpaceGlyph(fontData->platformData().hfont(), dc, &spaceGlyph);
                spaceGlyphInitialized = true;
                if (spaceGlyph)
                    haveGlyphs = true;
            }
            glyph = spaceGlyph;
        } else if (glyph == invalidGlyph) {
            // WebKit expects both the glyph index and FontData
            // pointer to be 0 if the glyph is not present
            glyph = 0;
            glyphFontData = 0;
        } else
            haveGlyphs = true;
        page->setGlyphDataForCharacter(offset + i, glyph, glyphFontData);
    }

    SelectObject(dc, oldFont);
    return haveGlyphs;
}

// For non-BMP characters, each is two words (UTF-16) and the input buffer
// size is 2 * |length|. Since GDI doesn't know how to handle non-BMP
// characters, we must use Uniscribe to tell us the glyph indices.
//
// We don't want to call this in the case of "regular" characters since some
// fonts may not have the correct combining rules for accents. See the notes
// at the bottom of ScriptGetCMap. We can't use ScriptGetCMap, though, since
// it doesn't seem to support UTF-16, despite what this blog post says:
//   http://blogs.msdn.com/michkap/archive/2006/06/29/650680.aspx
//
// So we fire up the full Uniscribe doohicky, give it our string, and it will
// correctly handle the UTF-16 for us. The hard part is taking this and getting
// the glyph indices back out that correspond to the correct input characters,
// since they may be missing.
//
// Returns true if any glyphs were found.
static bool fillNonBMPGlyphs(unsigned offset,
                             unsigned length,
                             UChar* buffer,
                             GlyphPage* page,
                             const SimpleFontData* fontData)
{
    bool haveGlyphs = false;

    UniscribeHelperTextRun state(buffer, length * 2, false,
                                 fontData->platformData().hfont(),
                                 fontData->platformData().scriptCache(),
                                 fontData->platformData().scriptFontProperties());
    state.setInhibitLigate(true);
    state.setDisableFontFallback(true);
    state.init();

    for (unsigned i = 0; i < length; i++) {
        // Each character in this input buffer is a surrogate pair, which
        // consists of two UChars. So, the offset for its i-th character is
        // (i * 2).
        WORD glyph = state.firstGlyphForCharacter(i * 2);
        if (glyph) {
            haveGlyphs = true;
            page->setGlyphDataForIndex(offset + i, glyph, fontData);
        } else
            // Clear both glyph and fontData fields.
            page->setGlyphDataForIndex(offset + i, 0, 0);
    }
    return haveGlyphs;
}

// We're supposed to return true if there are any glyphs in the range
// specified by |offset| and |length| in  our font,
// false if there are none.
bool GlyphPage::fill(unsigned offset, unsigned length, UChar* characterBuffer,
                     unsigned bufferLength, const SimpleFontData* fontData)
{
    // We have to handle BMP and non-BMP characters differently.
    // FIXME: Add assertions to make sure that buffer is entirely in BMP
    // or entirely in non-BMP.
    if (bufferLength == length)
        return fillBMPGlyphs(offset, length, characterBuffer, this, fontData);

    if (bufferLength == 2 * length) {
        // A non-BMP input buffer will be twice as long as output glyph buffer
        // because each character in the non-BMP input buffer will be
        // represented by a surrogate pair (two UChar's).
        return fillNonBMPGlyphs(offset, length, characterBuffer, this, fontData);
    }

    ASSERT_NOT_REACHED();
    return false;
}

}  // namespace WebCore


text:
package de.uni_hildesheim.sse.codeEraser.ant;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.channels.FileChannel;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.regex.PatternSyntaxException;

import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.taskdefs.MatchingTask;
import org.apache.tools.ant.types.FileSet;
import org.apache.tools.ant.types.resources.FileResource;

/**
 * An ANT task for generating classes from resource files.
 *
 * @author Holger Eichelberger
 * @since 1.00
 * @version 1.00
 */
public class FlattenTask extends MatchingTask {

    /**
     * The base directory.
     */
    private File baseDir;

    /**
     * The target directory.
     */
    private File outDir;

    /**
     * Stores the characters to be removed.
     */
    private String removeRegEx;

    /**
     * Stores a rule for handling character cases.
     */
    private String caseRule;

    /**
     * The file sets collected.
     */
    private List<FileSet> filesets = new ArrayList<FileSet>();

    /**
     * Directory from which to use files.
     *
     * @param baseDir the new base dir
     */
    public void setBasedir(File baseDir) {
        this.baseDir = baseDir;
    }

    /**
     * Target directory.
     *
     * @param outDir the new target dir
     */
    public void setOutdir(File outDir) {
        this.outDir = outDir;
    }

    /**
     * Adds a set of files.
     *
     * @param set the file set to add
     */
    public void addFileset(FileSet set) {
        filesets.add(set);
    }

    /**
     * Defines an optional regular expression of characters to
     * be removed from target file names.
     *
     * @param removeRegEx the regular expression
     *
     * @since 1.00
     */
    public void setRemoveRegEx(String removeRegEx) {
        this.removeRegEx = removeRegEx;
    }

    /**
     * Defines an optional rule how to handle character cases.
     *
     * @param caseRule may be null, lower,
     *   upper
     *
     * @since 1.00
     */
    public void setCaseRule(String caseRule) {
        this.caseRule = caseRule;
        if (null != this.caseRule) {
            this.caseRule = this.caseRule.toLowerCase();
        }
    }

    /**
     * Validate and build.
     *
     * @throws BuildException in case that a build exception occurred
     */
    public void execute() throws BuildException {
        if (filesets.isEmpty()) {
            throw new BuildException("No resources specified");
        }
        String base = null;
        if (null != baseDir) {
            base = baseDir.getAbsolutePath();
        }
        for (int i = 0; i < filesets.size(); i++) {
            FileSet set = filesets.get(i);
            Iterator<?> iter = set.iterator();
            while (iter.hasNext()) {
                FileResource res = (FileResource) iter.next();
                String file = res.getFile().getAbsolutePath();
                if (null != base && file.startsWith(base)) {
                    file = file.substring(base.length());
                    while (file.startsWith(File.separator)) {
                        file = file.substring(1);
                    }
                }
                String flattenName = file.replace(File.separator, "");
                if (null != removeRegEx) {
                    try {
                        flattenName = flattenName.replaceAll(removeRegEx, "");
                    } catch (PatternSyntaxException e) {
                        throw new BuildException(
                            "illegal character removal pattern: "
                                + e.getMessage());
                    }
                }
                if ("lower".equals(caseRule)) {
                    flattenName = flattenName.toLowerCase();
                } else if ("upper".equals(caseRule)) {
                    flattenName = flattenName.toUpperCase();
                }
                File outFile = new File(outDir, flattenName);
                try {
                    FileChannel inChannel = new FileInputStream(
                        res.getFile()).getChannel();
                    FileChannel outChannel = new FileOutputStream(
                        outFile).getChannel();
                    try {
                        inChannel.transferTo(0, inChannel.size(),
                                outChannel);
                    } catch (IOException e) {
                        throw new BuildException(e);
                    } finally {
                        if (inChannel != null) {
                            inChannel.close();
                        }
                        if (outChannel != null) {
                            outChannel.close();
                        }
                    }
                } catch (IOException e) {
                    throw new BuildException(e);
                }
                System.out.println(file + " -> " + outFile);
            }
        }
    }
}


text:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:orientation="vertical"
    android:paddingLeft="24dp"
    android:paddingRight="24dp"
    android:paddingTop="24dp"
    android:paddingBottom="24dp"
    tools:context="com.fsck.k9.activity.compose.PgpEnabledErrorDialog">

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginBottom="20dp"
        android:textAppearance="?android:textAppearanceLarge"
        android:text="@string/openpgp_enabled_error_title"
        />

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textAppearance="?android:textAppearanceSmall"
        android:text="@string/openpgp_enabled_error_msg"
        style="?android:textAppearanceMedium"
        />

</LinearLayout>


text:
import * as React from 'react';

export enum PlotType {
  CONFUSION_MATRIX = 'confusion_matrix',
  MARKDOWN = 'markdown',
  ROC = 'roc',
  TABLE = 'table',
  TENSORBOARD = 'tensorboard',
  VISUALIZATION_CREATOR = 'visualization-creator',
  WEB_APP = 'web-app',
}

// Interface to be extended by each viewer implementation, so it's possible to
// build an array of viewer configurations that forces them to declare their type.
export interface ViewerConfig {
  type: PlotType;
}

abstract class Viewer<P, S> extends React.Component<P, S> {
  public isAggregatable(): boolean {
    return false;
  }

  public abstract getDisplayName(): string;
}

export default Viewer;


text:
// --------- This code has been automatically generated !!! 2017-01-16T16:52:09.129Z
"use strict";
require("requirish")._(module);
/**
 * @module opcua.address_space.types
 */
var assert = require("better-assert");
var util = require("util");
var _  = require("underscore");
var makeNodeId = require("lib/datamodel/nodeid").makeNodeId;
var schema_helpers =  require("lib/misc/factories_schema_helpers");
var extract_all_fields                       = schema_helpers.extract_all_fields;
var resolve_schema_field_types               = schema_helpers.resolve_schema_field_types;
var initialize_field                         = schema_helpers.initialize_field;
var initialize_field_array                   = schema_helpers.initialize_field_array;
var check_options_correctness_against_schema = schema_helpers.check_options_correctness_against_schema;
var _defaultTypeMap = require("lib/misc/factories_builtin_types")._defaultTypeMap;
var ec = require("lib/misc/encode_decode");
var encodeArray = ec.encodeArray;
var decodeArray = ec.decodeArray;
var makeExpandedNodeId = ec.makeExpandedNodeId;
var generate_new_id = require("lib/misc/factories").generate_new_id;
var _enumerations = require("lib/misc/factories_enumerations")._private._enumerations;
var schema = require("../schemas/CloseSecureChannelResponse_schema").CloseSecureChannelResponse_Schema;
var ResponseHeader = require("./_auto_generated_ResponseHeader").ResponseHeader;
var BaseUAObject = require("lib/misc/factories_baseobject").BaseUAObject;

/**
 *
 * @class CloseSecureChannelResponse
 * @constructor
 * @extends BaseUAObject
 * @param  options {Object}
 * @param  [options.responseHeader] {ResponseHeader}
 */
function CloseSecureChannelResponse(options)
{
    options = options || {};
    /* istanbul ignore next */
    if (schema_helpers.doDebug) { check_options_correctness_against_schema(this,schema,options); }
    var self = this;
    assert(this instanceof BaseUAObject); //  ' keyword "new" is required for constructor call')
    resolve_schema_field_types(schema);

    BaseUAObject.call(this,options);

    /**
      *
      * @property responseHeader
      * @type {ResponseHeader}
      */
    self.responseHeader =  new ResponseHeader( options.responseHeader);

   // Object.preventExtensions(self);
}
util.inherits(CloseSecureChannelResponse,BaseUAObject);
CloseSecureChannelResponse.prototype.encodingDefaultBinary = makeExpandedNodeId(455,0);
CloseSecureChannelResponse.prototype.encodingDefaultXml = makeExpandedNodeId(454,0);
CloseSecureChannelResponse.prototype._schema = schema;

/**
 * encode the object into a binary stream
 * @method encode
 *
 * @param stream {BinaryStream}
 */
CloseSecureChannelResponse.prototype.encode = function(stream,options) {
    // call base class implementation first
    BaseUAObject.prototype.encode.call(this,stream,options);
   this.responseHeader.encode(stream,options);
};
/**
 * decode the object from a binary stream
 * @method decode
 *
 * @param stream {BinaryStream}
 * @param [option] {object}
 */
CloseSecureChannelResponse.prototype.decode = function(stream,options) {
    // call base class implementation first
    BaseUAObject.prototype.decode.call(this,stream,options);
    this.responseHeader.decode(stream,options);
};
CloseSecureChannelResponse.possibleFields = [
  "responseHeader"
];

exports.CloseSecureChannelResponse = CloseSecureChannelResponse;
var register_class_definition = require("lib/misc/factories_factories").register_class_definition;
register_class_definition("CloseSecureChannelResponse",CloseSecureChannelResponse);


text:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.madisp.trails">
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.RECORD_AUDIO" />

    <application
        android:name=".App"
        android:label="@string/app_label"
        android:theme="@android:style/Theme.Material.Light.DarkActionBar"
        android:allowBackup="true">

        <activity android:name=".Main">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

        <service
            android:name=".CaptureService"
            android:exported="false" />

        <provider
            android:name="android.support.v4.content.FileProvider"
            android:authorities="com.madisp.trails.fileprovider"
            android:exported="false"
            android:grantUriPermissions="true">

            <meta-data
                android:name="android.support.FILE_PROVIDER_PATHS"
                android:resource="@xml/fileprovider" />

        </provider>

    </application>

</manifest>


text:
namespace Host.AspNetCore.UnitTests
{
    using System;
    using Crest.Abstractions;
    using Crest.Host.AspNetCore;
    using FluentAssertions;
    using Microsoft.AspNetCore.Builder;
    using Microsoft.AspNetCore.Http;
    using Microsoft.Extensions.DependencyInjection;
    using Microsoft.Extensions.DependencyModel;
    using NSubstitute;
    using Xunit;

    public class StartupBootstrapperTests
    {
        private readonly StartupBootstrapper startup;

        private StartupBootstrapperTests()
        {
            object CreateType(Type type)
            {
                return type.IsInterface ?
                    Substitute.For(new[] { type }, new object[0]) :
                    null;
            }

            IServiceLocator serviceLocator = Substitute.For<IServiceLocator>();
            serviceLocator.GetService(null)
                .ReturnsForAnyArgs(ci => CreateType(ci.Arg<Type>()));

            this.startup = new StartupBootstrapper(serviceLocator);
        }

        public sealed class Configure : StartupBootstrapperTests
        {
            [Fact]
            public void ShouldRegisterARequestHandler()
            {
                Func<RequestDelegate, RequestDelegate> useParameter = null;
                IApplicationBuilder builder = Substitute.For<IApplicationBuilder>();
                builder.Use(Arg.Do<Func<RequestDelegate, RequestDelegate>>(p => useParameter = p));

                this.startup.Configure(builder);
                RequestDelegate result = useParameter(Substitute.For<RequestDelegate>());

                result.Should().NotBeNull();
            }
        }

        public sealed class ConfigureServices : StartupBootstrapperTests
        {
            [Fact]
            public void ShouldReturnTheDefaultAspNetContainer()
            {
                IServiceProvider result = this.startup.ConfigureServices(Substitute.For<IServiceCollection>());

                result.Should().NotBeNull();
                result.GetType().FullName.Should().StartWith("Microsoft.");
            }
        }

        public sealed class DefaultConstructor : StartupBootstrapperTests
        {
            [Fact]
            public void ShouldSetTheServiceLocator()
            {
                using (var bootstrapper = new StartupBootstrapper(DependencyContext.Default))
                {
                    bootstrapper.ServiceLocator.Should().NotBeNull();
                }
            }
        }
    }
}


text:
# Require space before/after arrow function's arrow (arrow-spacing)

This rule normalize style of spacing before/after an arrow function's arrow(`=>`).

```js
/*eslint-env es6*/

// { "before": true, "after": true }
(a) => {}

// { "before": false, "after": false }
(a)=>{}
```

## Rule Details

This rule takes an object argument with `before` and `after` properties, each with a Boolean value.

The default configuration is `{ "before": true, "after": true }`.

`true` means there should be **one or more spaces** and `false` means **no spaces**.

Examples of **incorrect** code for this rule with the default `{ "before": true, "after": true }` option:

```js
/*eslint arrow-spacing: "error"*/
/*eslint-env es6*/

()=> {};
() =>{};
(a)=> {};
(a) =>{};
a =>a;
a=> a;
()=> {'\n'};
() =>{'\n'};
```

Examples of **correct** code for this rule with the default `{ "before": true, "after": true }` option:

```js
/*eslint arrow-spacing: "error"*/
/*eslint-env es6*/

() => {};
(a) => {};
a => a;
() => {'\n'};
```

Examples of **incorrect** code for this rule with the `{ "before": false, "after": false }` option:

```js
/*eslint arrow-spacing: ["error", { "before": false, "after": false }]*/
/*eslint-env es6*/

() =>{};
(a) => {};
()=> {'\n'};
```

Examples of **correct** code for this rule with the `{ "before": false, "after": false }` option:

```js
/*eslint arrow-spacing: ["error", { "before": false, "after": false }]*/
/*eslint-env es6*/

()=>{};
(a)=>{};
()=>{'\n'};
```

Examples of **incorrect** code for this rule with the `{ "before": false, "after": true }` option:

```js
/*eslint arrow-spacing: ["error", { "before": false, "after": true }]*/
/*eslint-env es6*/

() =>{};
(a) => {};
()=>{'\n'};
```

Examples of **correct** code for this rule with the `{ "before": false, "after": true }` option:

```js
/*eslint arrow-spacing: ["error", { "before": false, "after": true }]*/
/*eslint-env es6*/

()=> {};
(a)=> {};
()=> {'\n'};
```


text:
namespace vctl
{

void TAtomicOperation::MemoryBarrier()
    {
    detail::DoMemoryBarrier();
    }

TAtomicInt32 TAtomicOperation::BarrieredAtomicIncrement(volatile TAtomicInt32* aValueToIncrement, TAtomicInt32 aIncrementByAmount)
    {
    return detail::DoBarrieredAtomicIncrement(aValueToIncrement, aIncrementByAmount);
    }

TAtomicInt32 TAtomicOperation::AcquireLoad(volatile const TAtomicInt32* aPtr)
    {
    TAtomicInt32 r = *aPtr;
    MemoryBarrier();
    return r;
    }

} //namespace vctl


text:
import { nodeName } from '../../../helpers/node-name';
import { module, test } from 'qunit';

module('Unit | Helper | node name');

// Replace this with your real tests.
test('it works', function(assert) {
  let result = nodeName(42);
  assert.ok(result);
});