<?php
/**
 * Zend Framework
 *
 * LICENSE
 *
 * This source file is subject to the new BSD license that is bundled
 * with this package in the file LICENSE.txt.
 * It is also available through the world-wide-web at this URL:
 * http://framework.zend.com/license/new-bsd
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@zend.com so we can send you a copy immediately.
 *
 * @category   Zend
 * @package    Zend_Pdf
 * @subpackage Fonts
 * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
 * @license    http://framework.zend.com/license/new-bsd     New BSD License
 * @version    $Id: CidFont.php 24665 2012-02-26 16:53:25Z adamlundrigan $
 */

/** Internally used classes */
require_once 'Zend/Pdf/Element/Array.php';
require_once 'Zend/Pdf/Element/Dictionary.php';
require_once 'Zend/Pdf/Element/Name.php';
require_once 'Zend/Pdf/Element/Numeric.php';
require_once 'Zend/Pdf/Element/String.php';

/** Zend_Pdf_Resource_Font */
require_once 'Zend/Pdf/Resource/Font.php';

/**
 * Adobe PDF CIDFont font object implementation
 *
 * A CIDFont program contains glyph descriptions that are accessed using a CID as
 * the character selector. There are two types of CIDFont. A Type 0 CIDFont contains
 * glyph descriptions based on Adobe’s Type 1 font format, whereas those in a
 * Type 2 CIDFont are based on the TrueType font format.
 *
 * A CIDFont dictionary is a PDF object that contains information about a CIDFont program.
 * Although its Type value is Font, a CIDFont is not actually a font. It does not have an Encoding
 * entry, it cannot be listed in the Font subdictionary of a resource dictionary, and it cannot be
 * used as the operand of the Tf operator. It is used only as a descendant of a Type 0 font.
 * The CMap in the Type 0 font is what defines the encoding that maps character codes to CIDs
 * in the CIDFont.
 *
 * Font objects should be normally be obtained from the factory methods
 * {@link Zend_Pdf_Font::fontWithName} and {@link Zend_Pdf_Font::fontWithPath}.
 *
 * @package    Zend_Pdf
 * @subpackage Fonts
 * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
 * @license    http://framework.zend.com/license/new-bsd     New BSD License
 */
abstract class Zend_Pdf_Resource_Font_CidFont extends Zend_Pdf_Resource_Font
{
    /**
     * Object representing the font's cmap (character to glyph map).
     * @var Zend_Pdf_Cmap
     */
    protected $_cmap = null;

    /**
     * Array containing the widths of each character that have entries in used character map.
     *
     * @var array
     */
    protected $_charWidths = null;

    /**
     * Width for characters missed in the font
     *
     * @var integer
     */
    protected $_missingCharWidth = 0;

    /**
     * Object constructor
     *
     * @param Zend_Pdf_FileParser_Font_OpenType $fontParser Font parser object
     *   containing OpenType file.
     * @param integer $embeddingOptions Options for font embedding.
     * @throws Zend_Pdf_Exception
     */
    public function __construct(Zend_Pdf_FileParser_Font_OpenType $fontParser)
    {
        parent::__construct();

        $fontParser->parse();

        /* Object properties */

        $this->_fontNames = $fontParser->names;

        $this->_isBold       = $fontParser->isBold;
        $this->_isItalic     = $fontParser->isItalic;
        $this->_isMonospaced = $fontParser->isMonospaced;

        $this->_underlinePosition  = $fontParser->underlinePosition;
        $this->_underlineThickness = $fontParser->underlineThickness;
        $this->_strikePosition     = $fontParser->strikePosition;
        $this->_strikeThickness    = $fontParser->strikeThickness;

        $this->_unitsPerEm = $fontParser->unitsPerEm;

        $this->_ascent  = $fontParser->ascent;
        $this->_descent = $fontParser->descent;
        $this->_lineGap = $fontParser->lineGap;

        $this->_cmap = $fontParser->cmap;

        /* Resource dictionary */

        $baseFont = $this->getFontName(Zend_Pdf_Font::NAME_POSTSCRIPT, 'en', 'UTF-8');
        $this->_resource->BaseFont = new Zend_Pdf_Element_Name($baseFont);

        /**
         * Prepare widths array.
         */
        /* Constract characters widths array using font CMap and glyphs widths array */
        $glyphWidths = $fontParser->glyphWidths;
        $charGlyphs  = $this->_cmap->getCoveredCharactersGlyphs();
        $charWidths  = array();
        foreach ($charGlyphs as $charCode => $glyph) {
            if(isset($glyphWidths[$glyph]) && !is_null($glyphWidths[$glyph])) {
                $charWidths[$charCode] = $glyphWidths[$glyph];
            }
        }
        $this->_charWidths       = $charWidths;
        $this->_missingCharWidth = $glyphWidths[0];

        /* Width array optimization. Step1: extract default value */
        $widthFrequencies = array_count_values($charWidths);
        $defaultWidth          = null;
        $defaultWidthFrequency = -1;
        foreach ($widthFrequencies as $width => $frequency) {
            if ($frequency > $defaultWidthFrequency) {
                $defaultWidth          = $width;
                $defaultWidthFrequency = $frequency;
            }
        }

        // Store default value in the font dictionary
        $this->_resource->DW = new Zend_Pdf_Element_Numeric($this->toEmSpace($defaultWidth));

        // Remove characters which corresponds to default width from the widths array
        $defWidthChars = array_keys($charWidths, $defaultWidth);
        foreach ($defWidthChars as $charCode) {
            unset($charWidths[$charCode]);
        }

        // Order cheracter widths aray by character codes
        ksort($charWidths, SORT_NUMERIC);

        /* Width array optimization. Step2: Compact character codes sequences */
        $lastCharCode = -1;
        $widthsSequences = array();
        foreach ($charWidths as $charCode => $width) {
            if ($lastCharCode == -1) {
                $charCodesSequense = array();
                $sequenceStartCode = $charCode;
            } else if ($charCode != $lastCharCode + 1) {
                // New chracters sequence detected
                $widthsSequences[$sequenceStartCode] = $charCodesSequense;
                $charCodesSequense = array();
                $sequenceStartCode = $charCode;
            }
            $charCodesSequense[] = $width;
            $lastCharCode = $charCode;
        }
        // Save last sequence, if widths array is not empty (it may happens for monospaced fonts)
        if (count($charWidths) != 0) {
            $widthsSequences[$sequenceStartCode] = $charCodesSequense;
        }

        $pdfCharsWidths = array();
        foreach ($widthsSequences as $startCode => $widthsSequence) {
            /* Width array optimization. Step3: Compact widths sequences */
            $pdfWidths        = array();
            $lastWidth        = -1;
            $widthsInSequence = 0;
            foreach ($widthsSequence as $width) {
                if ($lastWidth != $width) {
                    // New width is detected
                    if ($widthsInSequence != 0) {
                        // Previous width value was a part of the widths sequence. Save it as 'c_1st c_last w'.
                        $pdfCharsWidths[] = new Zend_Pdf_Element_Numeric($startCode);                         // First character code
                        $pdfCharsWidths[] = new Zend_Pdf_Element_Numeric($startCode + $widthsInSequence - 1); // Last character code
                        $pdfCharsWidths[] = new Zend_Pdf_Element_Numeric($this->toEmSpace($lastWidth));       // Width

                        // Reset widths sequence
                        $startCode = $startCode + $widthsInSequence;
                        $widthsInSequence = 0;
                    }

                    // Collect new width
                    $pdfWidths[] = new Zend_Pdf_Element_Numeric($this->toEmSpace($width));

                    $lastWidth = $width;
                } else {
                    // Width is equal to previous
                    if (count($pdfWidths) != 0) {
                        // We already have some widths collected
                        // So, we've just detected new widths sequence

                        // Remove last element from widths list, since it's a part of widths sequence
                        array_pop($pdfWidths);

                        // and write the rest if it's not empty
                        if (count($pdfWidths) != 0) {
                            // Save it as 'c_1st [w1 w2 ... wn]'.
                            $pdfCharsWidths[] = new Zend_Pdf_Element_Numeric($startCode); // First character code
                            $pdfCharsWidths[] = new Zend_Pdf_Element_Array($pdfWidths);   // Widths array

                            // Reset widths collection
                            $startCode += count($pdfWidths);
                            $pdfWidths = array();
                        }

                        $widthsInSequence = 2;
                    } else {
                        // Continue widths sequence
                        $widthsInSequence++;
                    }
                }
            }

            // Check if we have widths collection or widths sequence to wite it down
            if (count($pdfWidths) != 0) {
                // We have some widths collected
                // Save it as 'c_1st [w1 w2 ... wn]'.
                $pdfCharsWidths[] = new Zend_Pdf_Element_Numeric($startCode); // First character code
                $pdfCharsWidths[] = new Zend_Pdf_Element_Array($pdfWidths);   // Widths array
            } else if ($widthsInSequence != 0){
                // We have widths sequence
                // Save it as 'c_1st c_last w'.
                $pdfCharsWidths[] = new Zend_Pdf_Element_Numeric($startCode);                         // First character code
                $pdfCharsWidths[] = new Zend_Pdf_Element_Numeric($startCode + $widthsInSequence - 1); // Last character code
                $pdfCharsWidths[] = new Zend_Pdf_Element_Numeric($this->toEmSpace($lastWidth));       // Width
            }
        }

        /* Create the Zend_Pdf_Element_Array object and add it to the font's
         * object factory and resource dictionary.
         */
        $widthsArrayElement = new Zend_Pdf_Element_Array($pdfCharsWidths);
        $widthsObject = $this->_objectFactory->newObject($widthsArrayElement);
        $this->_resource->W = $widthsObject;

        /* CIDSystemInfo dictionary */
        $cidSystemInfo = new Zend_Pdf_Element_Dictionary();
        $cidSystemInfo->Registry   = new Zend_Pdf_Element_String('Adobe');
        $cidSystemInfo->Ordering   = new Zend_Pdf_Element_String('UCS');
        $cidSystemInfo->Supplement = new Zend_Pdf_Element_Numeric(0);
        $cidSystemInfoObject            = $this->_objectFactory->newObject($cidSystemInfo);
        $this->_resource->CIDSystemInfo = $cidSystemInfoObject;
    }

    /**
     * Returns an array of glyph numbers corresponding to the Unicode characters.
     *
     * If a particular character doesn't exist in this font, the special 'missing
     * character glyph' will be substituted.
     *
     * See also {@link glyphNumberForCharacter()}.
     *
     * @param array $characterCodes Array of Unicode character codes (code points).
     * @return array Array of glyph numbers.
     */
    public function glyphNumbersForCharacters($characterCodes)
    {
        /**
         * CIDFont object is not actually a font. It does not have an Encoding entry,
         * it cannot be listed in the Font subdictionary of a resource dictionary, and
         * it cannot be used as the operand of the Tf operator.
         *
         * Throw an exception.
         */
        require_once 'Zend/Pdf/Exception.php';
        throw new Zend_Pdf_Exception('CIDFont PDF objects could not be used as the operand of the text drawing operators');
    }

    /**
     * Returns the glyph number corresponding to the Unicode character.
     *
     * If a particular character doesn't exist in this font, the special 'missing
     * character glyph' will be substituted.
     *
     * See also {@link glyphNumbersForCharacters()} which is optimized for bulk
     * operations.
     *
     * @param integer $characterCode Unicode character code (code point).
     * @return integer Glyph number.
     */
    public function glyphNumberForCharacter($characterCode)
    {
        /**
         * CIDFont object is not actually a font. It does not have an Encoding entry,
         * it cannot be listed in the Font subdictionary of a resource dictionary, and
         * it cannot be used as the operand of the Tf operator.
         *
         * Throw an exception.
         */
        require_once 'Zend/Pdf/Exception.php';
        throw new Zend_Pdf_Exception('CIDFont PDF objects could not be used as the operand of the text drawing operators');
    }

    /**
     * Returns a number between 0 and 1 inclusive that indicates the percentage
     * of characters in the string which are covered by glyphs in this font.
     *
     * Since no one font will contain glyphs for the entire Unicode character
     * range, this method can be used to help locate a suitable font when the
     * actual contents of the string are not known.
     *
     * Note that some fonts lie about the characters they support. Additionally,
     * fonts don't usually contain glyphs for control characters such as tabs
     * and line breaks, so it is rare that you will get back a full 1.0 score.
     * The resulting value should be considered informational only.
     *
     * @param string $string
     * @param string $charEncoding (optional) Character encoding of source text.
     *   If omitted, uses 'current locale'.
     * @return float
     */
    public function getCoveredPercentage($string, $charEncoding = '')
    {
        /* Convert the string to UTF-16BE encoding so we can match the string's
         * character codes to those found in the cmap.
         */
        if ($charEncoding != 'UTF-16BE') {
            $string = iconv($charEncoding, 'UTF-16BE', $string);
        }

        $charCount = iconv_strlen($string, 'UTF-16BE');
        if ($charCount == 0) {
            return 0;
        }

        /* Calculate the score by doing a lookup for each character.
         */
        $score = 0;
        $maxIndex = strlen($string);
        for ($i = 0; $i < $maxIndex; $i++) {
            /**
             * @todo Properly handle characters encoded as surrogate pairs.
             */
            $charCode = (ord($string[$i]) << 8) | ord($string[++$i]);
            /* This could probably be optimized a bit with a binary search...
             */
            if (isset($this->_charWidths[$charCode])) {
                $score++;
            }
        }
        return $score / $charCount;
    }

    /**
     * Returns the widths of the Chars.
     *
     * The widths are expressed in the font's glyph space. You are responsible
     * for converting to user space as necessary. See {@link unitsPerEm()}.
     *
     * See also {@link widthForChar()}.
     *
     * @param array &$glyphNumbers Array of glyph numbers.
     * @return array Array of glyph widths (integers).
     */
    public function widthsForChars($charCodes)
    {
        $widths = array();
        foreach ($charCodes as $key => $charCode) {
            if (!isset($this->_charWidths[$charCode])) {
                $widths[$key] = $this->_missingCharWidth;
            } else {
                $widths[$key] = $this->_charWidths[$charCode];
            }
        }
        return $widths;
    }

    /**
     * Returns the width of the character.
     *
     * Like {@link widthsForChars()} but used for one char at a time.
     *
     * @param integer $charCode
     * @return integer
     */
    public function widthForChar($charCode)
    {
        if (!isset($this->_charWidths[$charCode])) {
            return $this->_missingCharWidth;
        }
        return $this->_charWidths[$charCode];
    }

    /**
     * Returns the widths of the glyphs.
     *
     * @param array &$glyphNumbers Array of glyph numbers.
     * @return array Array of glyph widths (integers).
     * @throws Zend_Pdf_Exception
     */
    public function widthsForGlyphs($glyphNumbers)
    {
        /**
         * CIDFont object is not actually a font. It does not have an Encoding entry,
         * it cannot be listed in the Font subdictionary of a resource dictionary, and
         * it cannot be used as the operand of the Tf operator.
         *
         * Throw an exception.
         */
        require_once 'Zend/Pdf/Exception.php';
        throw new Zend_Pdf_Exception('CIDFont PDF objects could not be used as the operand of the text drawing operators');
    }

    /**
     * Returns the width of the glyph.
     *
     * Like {@link widthsForGlyphs()} but used for one glyph at a time.
     *
     * @param integer $glyphNumber
     * @return integer
     * @throws Zend_Pdf_Exception
     */
    public function widthForGlyph($glyphNumber)
    {
        /**
         * CIDFont object is not actually a font. It does not have an Encoding entry,
         * it cannot be listed in the Font subdictionary of a resource dictionary, and
         * it cannot be used as the operand of the Tf operator.
         *
         * Throw an exception.
         */
        require_once 'Zend/Pdf/Exception.php';
        throw new Zend_Pdf_Exception('CIDFont PDF objects could not be used as the operand of the text drawing operators');
    }

    /**
     * Convert string to the font encoding.
     *
     * @param string $string
     * @param string $charEncoding Character encoding of source text.
     * @return string
     * @throws Zend_Pdf_Exception
     *      */
    public function encodeString($string, $charEncoding)
    {
        /**
         * CIDFont object is not actually a font. It does not have an Encoding entry,
         * it cannot be listed in the Font subdictionary of a resource dictionary, and
         * it cannot be used as the operand of the Tf operator.
         *
         * Throw an exception.
         */
        require_once 'Zend/Pdf/Exception.php';
        throw new Zend_Pdf_Exception('CIDFont PDF objects could not be used as the operand of the text drawing operators');
    }

    /**
     * Convert string from the font encoding.
     *
     * @param string $string
     * @param string $charEncoding Character encoding of resulting text.
     * @return string
     * @throws Zend_Pdf_Exception
     */
    public function decodeString($string, $charEncoding)
    {
        /**
         * CIDFont object is not actually a font. It does not have an Encoding entry,
         * it cannot be listed in the Font subdictionary of a resource dictionary, and
         * it cannot be used as the operand of the Tf operator.
         *
         * Throw an exception.
         */
        require_once 'Zend/Pdf/Exception.php';
        throw new Zend_Pdf_Exception('CIDFont PDF objects could not be used as the operand of the text drawing operators');
    }
}


<?php
namespace JmesPath;

/**
 * Returns data from the input array that matches a JMESPath expression.
 *
 * @param string $expression Expression to search.
 * @param mixed $data Data to search.
 *
 * @return mixed|null
 */
if (!function_exists(__NAMESPACE__ . '\search')) {
    function search($expression, $data)
    {
        return Env::search($expression, $data);
    }
}


// Copyright (C) 2017 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/*---
esid: sec-with-statement
description: >
  ExpressionStatement has a lookahead restriction for `let [`.
info: |
  ExpressionStatement[Yield, Await] :
    [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
    Expression[+In, ?Yield, ?Await] ;
negative:
  phase: parse
  type: SyntaxError
flags: [noStrict]
---*/

$DONOTEVALUATE();

// Wrapped in an if-statement to avoid reference errors at runtime.
if (false) {
    with ({}) let
    [a] = 0;
}


<!DOCTYPE html>

    <meta http-equiv="refresh" content="0;URL=../../../../libc/unix/notbsd/linux/constant._SC_BC_BASE_MAX.html">

Redirecting to ../../../../libc/unix/notbsd/linux/constant._SC_BC_BASE_MAX.html...


<%-# Fedena
#Copyright 2010 Foradian Technologies Private Limited
#
#This product includes software developed at
#Project Fedena - http://www.projectfedena.org/
#
#Licensed under the Apache License, Version 2.0 (the "License");
#you may not use this file except in compliance with the License.
#You may obtain a copy of the License at
#
#  http://www.apache.org/licenses/LICENSE-2.0
#
#Unless required by applicable law or agreed to in writing,
#software distributed under the License is distributed on an
#"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
#KIND, either express or implied.  See the License for the
#specific language governing permissions and limitations
#under the License. -%>

  <%= t('select_ranking_level') %> :

    <%= select :ranking_level_report, :ranking_level_id,
      @ranking_levels.map {|b| [b.name, b.id]},
      {:prompt => "select a ranking level"}%>

  <%= t('select_a_report_type') %> :

    <%= select :ranking_level_report, :report_type,
      [["#{t('overall')}","overall"],["#{t('subject_wise')}","subject"]],
      {:prompt => "#{t('select_a_report_type')}"}, {:onChange => "#{remote_function(:url => {:action => "select_type", :batch_id=>@batch.id}, :with => "'report_type='+value")}"}%>


package com.aidchow.doubanmovie.retrofit

import retrofit2.Call
import retrofit2.Callback
import retrofit2.Response

/**
 * Created by aidchow on 17-5-27.
 */
abstract class CustemCallBack<T> : Callback<T> {
    override fun onResponse(call: Call<T>?, response: Response<T>?) {
        if (response != null) {
            if (response.isSuccessful) {
                onSuccess(response)
            } else {
                onFail(response.message())
            }
        }

        println(call?.request()?.url())
    }

    override fun onFailure(call: Call<T>?, t: Throwable?) {
        onFail(t?.message as String)
    }

    abstract fun onSuccess(response: Response<T>?)

    abstract fun onFail(message: String)
}


torch.utils.checkpoint
======================

.. note::
    Checkpointing is implemented by rerunning a forward-pass segment for
    each checkpointed segment during backward.  This can cause persistent
    states like the RNG state to be advanced than they would without
    checkpointing.  By default, checkpointing includes logic to juggle
    the RNG state such that checkpointed passes making use of RNG
    (through dropout for example) have deterministic output as
    compared to non-checkpointed passes.  The logic to stash and restore
    RNG states can incur a moderate performance hit depending on the runtime
    of checkpointed operations.  If deterministic output compared to
    non-checkpointed passes is not required, supply ``preserve_rng_state=False``
    to ``checkpoint`` or ``checkpoint_sequential`` to omit stashing and
    restoring the RNG state during each checkpoint.

    The stashing logic saves and restores the RNG state for the current device
    and the device of all cuda Tensor arguments to the ``run_fn``.
    However, the logic has no way to anticipate if the user will move
    Tensors to a new device within the ``run_fn`` itself.  Therefore, if you move
    Tensors to a new device ("new" meaning not belonging to the set of
    [current device + devices of Tensor arguments]) within ``run_fn``, deterministic
    output compared to non-checkpointed passes is never guaranteed.

.. currentmodule:: torch.utils.checkpoint
.. autofunction:: checkpoint
.. autofunction:: checkpoint_sequential


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
  <maintainer type="project">
    <email>games@gentoo.org</email>
    <name>Gentoo Games Project</name>
  </maintainer>
  <use>
    <flag name="atcp">enable ATCP support.</flag>
    <flag name="gmcp">enable GMCP support.</flag>
    <flag name="option102">enable telnet option 102 support.</flag>
  </use>
  <upstream>
    <remote-id type="sourceforge">tinyfugue</remote-id>
  </upstream>
</pkgmetadata>


<!--

lxc: linux Container library

(C) Copyright IBM Corp. 2007, 2008

Authors:
Daniel Lezcano <daniel.lezcano at free.fr>

This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA

Translated into Korean
by Sungbae Yoo <sungbae.yoo at samsung.com>

-->

<!DOCTYPE refentry PUBLIC @docdtd@ [

<!ENTITY commonoptions SYSTEM "@builddir@/common_options.sgml">
<!ENTITY seealso SYSTEM "@builddir@/see_also.sgml">
]>

<refentry>

  <docinfo><date>@LXC_GENERATE_DATE@</date></docinfo>

  <refmeta>
    <refentrytitle>lxc-cgroup</refentrytitle>
    <manvolnum>1</manvolnum>
  </refmeta>

  <refnamediv>
    <refname>lxc-cgroup</refname>

    <refpurpose>
      <!--
      manage the control group associated with a container
      -->
      컨테이너와 관련된 컨트롤 그룹 관리
    </refpurpose>
  </refnamediv>

  <refsynopsisdiv>
    <cmdsynopsis>
      <command>lxc-cgroup</command>
      <arg choice="req">-n <replaceable>name</replaceable></arg>
      <arg choice="req"><replaceable>state-object</replaceable></arg>
      <arg choice="opt">value</arg>
    </cmdsynopsis>
  </refsynopsisdiv>

  <refsect1>
    <title><!-- Description -->설명</title>

    <para>
      <!--
      <command>lxc-cgroup</command> gets or sets the value of a
      <replaceable>state-object</replaceable> (e.g., 'cpuset.cpus')
      in the container's cgroup for the corresponding subsystem (e.g.,
      'cpuset'). If no <optional>value</optional> is specified, the
      current value of the <replaceable>state-object</replaceable> is
      displayed; otherwise it is set.
      -->
      <command>lxc-cgroup</command>는 지정한 서브시스템(예를 들어 'cpuset')의 컨테이너 cgroup의 <replaceable>state-object</replaceable> (예를들어 'cpuset.cpus')의 값을 얻어오거나 설정한다.
      만약 <optional>value</optional>가 지정되지 않았다면, <replaceable>state-object</replaceable>의 현재 값을 표시한다. 지정한 경우에는 해당 값으로 설정한다.
    </para>

    <para>
      <!--
      Note that <command>lxc-cgroup</command> does not check that the
      <replaceable>state-object</replaceable> is valid for the running
      kernel, or that the corresponding subsystem is contained in any
      mounted cgroup hierarchy.
      -->
      <command>lxc-cgroup</command>는 <replaceable>state-object</replaceable>가 실행중인 커널에서 사용가능한지 검사하지 않는 것을 주의해야 한다. 또한 지정한 서브시스템이 마운트된 cgroup에 포함이 되어 있는지도 검사하지 않는다.
    </para>

  </refsect1>

  <refsect1>
    <title><!-- Options -->옵션</title>
    <variablelist>

      <varlistentry>
	<term>
	  <option><replaceable>state-object</replaceable></option>
	</term>
	<listitem>
	  <para>
            <!--
	    Specify the state object name.
            -->
            cgroup의 state object 이름을 지정한다.
	  </para>
	</listitem>
      </varlistentry>

      <varlistentry>
	<term>
	  <option><optional>value</optional></option>
	</term>
	<listitem>
	  <para>
            <!--
	    Specify the value to assign to the state object.
            -->
            cgroup의 state object에 설정할 값을 지정한다.
	  </para>
	</listitem>
      </varlistentry>

    </variablelist>

  </refsect1>

  &commonoptions;

  <refsect1>
    <title><!-- Examples -->예제</title>
    <variablelist>
      <varlistentry>
	<term>lxc-cgroup -n foo devices.list</term>
	<listitem>
	<para>
          <!--
	  display the allowed devices to be used.
          -->
          허용된 디바이스를 표시한다.
	</para>
	</listitem>
      </varlistentry>

      <varlistentry>
	<term>lxc-cgroup -n foo cpuset.cpus "0,3"</term>
	<listitem>
	<para>
          <!--
	  assign the processors 0 and 3 to the container.
          -->
          프로세서 0과 3을 컨테이너에게 할당한다.
	</para>
	</listitem>
      </varlistentry>

    </variablelist>
  </refsect1>

  <refsect1>
    <title><!-- Diagnostic -->진단</title>

    <variablelist>

      <varlistentry>
        <term>The container was not found</term>
        <listitem>
          <para>
            <!--
	    The container is not running.
            -->
            컨테이너가 실행중이 아니다.
          </para>
        </listitem>
      </varlistentry>

    </variablelist>

  </refsect1>

  &seealso;

  <refsect1>
    <title><!-- Author -->저자</title>
    <para>Daniel Lezcano <email>daniel.lezcano@free.fr</email></para>
  </refsect1>

</refentry>

<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:2
sgml-indent-data:t
sgml-parent-document:nil
sgml-default-dtd-file:nil
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
-->


" Warren's version of stat. stat file
" Like ls -l, except that we don't print out the i-node

main:

   lac 017777 i		" Load the pointer pointer in 017777
   sad d4		" to see if we have any arguments
     jmp nofiles	" No arguments, stop now
   lac 017777           " Move five words past the argument word count
   tad d5               " so that AC points at the first argument
   dac statfile		" and save in statfile and name
   dac name

   lac statbufptr	" Get the file's details into the statbuf
   sys status; curdir; statfile:0
   spa
     jmp badfile

			" Ugly code. Improvements welcome!
   lac s.perm		" See if this is a directory
   and isdirmask
   sna
     jmp 1f
   lac fd1
   sys write; d; 1	" Yes, print a d
   jmp 2f
1: lac s.perm		" Not a dir, see if its a large file
   and largemask
   sna
     jmp 1f
   lac fd1
   sys write; l; 1	" Yes, print an l
   jmp 2f
1: lac fd1
   sys write; s; 1	" Not a dir, not large, print an s

2: lac s.perm		" Readable by owner?
   and ureadmask
   sna
     jmp 1f
   lac fd1
   sys write; r; 1	" Yes, print an r
   jmp 2f
1: lac fd1
   sys write; minus; 1	" No, print a - sign

2: lac s.perm		" Writable by owner?
   and uwritemask
   sna
     jmp 1f
   lac fd1
   sys write; w; 1	" Yes, print a w
   jmp 2f
1: lac fd1
   sys write; minus; 1	" No, print a - sign

2: lac s.perm		" Readable by other?
   and oreadmask
   sna
     jmp 1f
   lac fd1
   sys write; r; 1	" Yes, print an r
   jmp 2f
1: lac fd1
   sys write; minus; 1	" No, print a - sign

2: lac s.perm		" Writable by other?
   and owritemask
   sna
     jmp 1f
   lac fd1
   sys write; w; 1	" Yes, print a w
   jmp 2f
1: lac fd1
   sys write; minus; 1	" No, print a - sign

2: lac fd1
   sys write; space; 1	" Print a space

   lac s.nlinks		" Print the number of links out
                        " but first make it positive
   cma
   tad d1
   jms octal; -2
   lac s.uid		" Print the user-id out
   jms octal; -3
   lac s.size		" Print the size out
   jms octal; -5

printname:
   lac fd1
   sys write; name:0; 4	" Write the filename out to stdout
   lac fd1
   sys write; newline; 1	" followed by a newline
   sys exit

nofiles:
   lac d8
   sys write; 1f; 5             " Write "No files\n" to stderr
   sys exit                     " and exit

1: <no>; 040;  <fi>;<le>;<s 012

badfile:
   lac name                     " Get the pointer to the filename
   dac 1f                       " Store it in 1f below
   lac d8                       " Load fd 8 which is stderr
   sys write; 1:0; 4            " Write the four words of the filename
   lac d8
   sys write; 1f; 2             " and then write " ?\n"
   sys exit

1: 040;077012                   " String literal: " ?\n"

			" Octal print code: This code borrowed from ds.s
octal: 0
   lmq			" Move the negative argument into the MQ
			" as we will use shifting to deal with the
			" number by shifting groups of 3 digits.

   lac d5		" By adding 5 to the negative count and
   tad octal i		" complementing it, we set the actual
   cma			" loop count up to 6 - count. So, if we
   dac c		" want to print 2 digits, we lose 6 - 2 = 4 digits
1:
   llss 3		" Lose top 3 bits of the MQ
   isz c		" Do we have any more to lose?
     jmp 1b		" Yes, keep looping
   lac octal i		" Save the actual number of print digits into c
   dac c		" as a negative number.
1:
   cla
   llss 3		" Shift 3 more bits into AC
   tad o60		" Add AC to ASCII '0'
   dac cbuf		" and print out the digit
   lac fd1
   sys write; cbuf; 1
   isz c		" Any more characters to print out?
     jmp 1b		" Yes, loop back
   lac fd1		" Print out a space
   sys write; space; 1
   isz octal		" Move return address 1 past the argument
   jmp octal i		" and return from subroutine

longopt: 0		" User set the -l option when this is 1
d1: fd1: 1		" File descriptor 1, stdout
d4: 4
d5: 5
d8: 8
o60: 060
count: 0		" Count of # of directory words read in
cbuf: 0			" Used to print out in the octal routing
c: .=.+1		" Loop counter for printing octal digits

statbufptr: statbuf		" Pointer to the statbuf
statbuf:			" Status buffer fields below
s.perm: 0
s.blk1: 0
s.blk2: 0
s.blk3: 0
s.blk4: 0
s.blk5: 0
s.blk6: 0
s.blk7: 0
s.uid: 0
s.nlinks: 0
s.size: 0
s.uniq: 0
largemask:  200000  		" large file, bigger than 4096 words
isdirmask:  000020  		" is a directory
ureadmask:  000010  		" user read
uwritemask: 000004		" user write
oreadmask:  000002  		" other read
owritemask: 000001		" other write

d: 0144				" ASCII characters: d, l, s, r, w, -, space, \n
l: 0154
s: 0163
r: 0162
w: 0167
minus: 055
space: 040
newline: 012
curdir: <. 040; 040040; 040040; 040040          " i.e. "."


//
//  Canvas.swift
//  AnyImageKit
//
//  Created by Harley.xk on 2018/4/11.
//
//  The Canvas is a modified version of
//  some classes from Harley's MaLiang project (https://github.com/Harley-xk/MaLiang)
//
//  MIT license
//
//  Copyright (c) 2019 Harley-xk <harley.gb@foxmail.com>
//
//  Permission is hereby granted, free of charge, to any person obtaining a copy
//  of this software and associated documentation files (the "Software"), to deal
//  in the Software without restriction, including without limitation the rights
//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
//  copies of the Software, and to permit persons to whom the Software is
//  furnished to do so, subject to the following conditions:
//
//  The above copyright notice and this permission notice shall be included in
//  all copies or substantial portions of the Software.
//
//  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
//  THE SOFTWARE.

import UIKit

protocol CanvasDelegate: class {

    func canvasDidBeginPen()
    func canvasDidEndPen()
}

protocol CanvasDataSource: class {

    func canvasGetScale(_ canvas: Canvas) -> CGFloat
}

class Canvas: UIView {

    weak var delegate: CanvasDelegate?
    weak var dataSource: CanvasDataSource?

    var brush = Brush()

    private let bezierGenerator = BezierGenerator()
    private var layerList: [CAShapeLayer] = []
    private var lastPoint: CGPoint = .zero

    private(set) lazy var lastPenImageView: UIImageView = {
        let view = UIImageView(frame: .zero)
        return view
    }()

    override init(frame: CGRect) {
        super.init(frame: frame)
        setupView()
    }

    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }

    override func layoutSubviews() {
        super.layoutSubviews()
        let animated = lastPenImageView.frame != .zero
        UIView.animate(withDuration: animated ? 0.25 : 0) {
            self.lastPenImageView.frame = self.bounds
        }
    }

    private func setupView() {
        addSubview(lastPenImageView)
    }

    override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
        guard let touch = touches.first else { return }
        let point = touch.preciseLocation(in: self)
        bezierGenerator.begin(with: point)
        pushPoint(point, to: bezierGenerator, state: .begin)
    }

    override func touchesMoved(_ touches: Set<UITouch>, with event: UIEvent?) {
        guard bezierGenerator.points.count > 0 else { return }
        guard let touch = touches.first else { return }
        let point = touch.preciseLocation(in: self)
        if lastPoint == point { return }
        lastPoint = point
        pushPoint(point, to: bezierGenerator, state: .move)
    }

    override func touchesEnded(_ touches: Set<UITouch>, with event: UIEvent?) {
        touchesEndedOrCancelled(touches)
    }

    override func touchesCancelled(_ touches: Set<UITouch>, with event: UIEvent?) {
        touchesEndedOrCancelled(touches)
    }
}

// MARK: - Public function
extension Canvas {

    func reset() {
        for layer in layerList {
            layer.removeFromSuperlayer()
        }
        layerList.removeAll()
    }
}

// MARK: - Private function
extension Canvas {

    private func pushPoint(_ point: CGPoint, to bezier: BezierGenerator, state: TouchState) {
        if state == .begin {
            reset()
        }
        defer {
            if state == .end && layerList.count > 0 {
                delegate?.canvasDidEndPen()
            }
        }

        let points = bezier.pushPoint(point)
        if points.count < 3 { return }
        delegate?.canvasDidBeginPen()

        let scale = dataSource?.canvasGetScale(self) ?? 1.0
        let shapeLayer = layer(of: points, brush: brush, scale: scale)
        layerList.append(shapeLayer)
        self.layer.addSublayer(shapeLayer)
    }

    private func layer(of points: [CGPoint], brush: Brush, scale: CGFloat) -> CAShapeLayer {
        let path = UIBezierPath.create(with: points)
        let shapeLayer = CAShapeLayer()
        shapeLayer.path = path.cgPath
        shapeLayer.lineCap = .round
        shapeLayer.lineJoin = .round
        shapeLayer.lineWidth = brush.lineWidth / scale
        // Brush
        shapeLayer.fillColor = UIColor.clear.cgColor
        shapeLayer.strokeColor = brush.color.cgColor
        return shapeLayer
    }

    private func touchesEndedOrCancelled(_ touches: Set<UITouch>) {
        defer {
            bezierGenerator.finish()
            lastPoint = .zero
        }

        guard bezierGenerator.points.count > 0 else { return }
        guard let touch = touches.first else { return }
        let point = touch.preciseLocation(in: self)
        pushPoint(point, to: bezierGenerator, state: .end)
    }
}


/* pcy_tree.c */
/*
 * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL project
 * 2004.
 */
/* ====================================================================
 * Copyright (c) 2004 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 *
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in
 *    the documentation and/or other materials provided with the
 *    distribution.
 *
 * 3. All advertising materials mentioning features or use of this
 *    software must display the following acknowledgment:
 *    "This product includes software developed by the OpenSSL Project
 *    for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
 *
 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
 *    endorse or promote products derived from this software without
 *    prior written permission. For written permission, please contact
 *    licensing@OpenSSL.org.
 *
 * 5. Products derived from this software may not be called "OpenSSL"
 *    nor may "OpenSSL" appear in their names without prior written
 *    permission of the OpenSSL Project.
 *
 * 6. Redistributions of any form whatsoever must retain the following
 *    acknowledgment:
 *    "This product includes software developed by the OpenSSL Project
 *    for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
 *
 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR
 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
 * OF THE POSSIBILITY OF SUCH DAMAGE.
 * ====================================================================
 *
 * This product includes cryptographic software written by Eric Young
 * (eay@cryptsoft.com).  This product includes software written by Tim
 * Hudson (tjh@cryptsoft.com).
 *
 */

#include "cryptlib.h"
#include <openssl/x509.h>
#include <openssl/x509v3.h>

#include "pcy_int.h"

/*
 * Enable this to print out the complete policy tree at various point during
 * evaluation.
 */

/*
 * #define OPENSSL_POLICY_DEBUG
 */

#ifdef OPENSSL_POLICY_DEBUG

static void expected_print(BIO *err, X509_POLICY_LEVEL *lev,
                           X509_POLICY_NODE *node, int indent)
{
    if ((lev->flags & X509_V_FLAG_INHIBIT_MAP)
        || !(node->data->flags & POLICY_DATA_FLAG_MAP_MASK))
        BIO_puts(err, "  Not Mapped\n");
    else {
        int i;
        STACK_OF(ASN1_OBJECT) *pset = node->data->expected_policy_set;
        ASN1_OBJECT *oid;
        BIO_puts(err, "  Expected: ");
        for (i = 0; i < sk_ASN1_OBJECT_num(pset); i++) {
            oid = sk_ASN1_OBJECT_value(pset, i);
            if (i)
                BIO_puts(err, ", ");
            i2a_ASN1_OBJECT(err, oid);
        }
        BIO_puts(err, "\n");
    }
}

static void tree_print(char *str, X509_POLICY_TREE *tree,
                       X509_POLICY_LEVEL *curr)
{
    X509_POLICY_LEVEL *plev;
    X509_POLICY_NODE *node;
    int i;
    BIO *err;
    err = BIO_new_fp(stderr, BIO_NOCLOSE);
    if (!curr)
        curr = tree->levels + tree->nlevel;
    else
        curr++;
    BIO_printf(err, "Level print after %s\n", str);
    BIO_printf(err, "Printing Up to Level %ld\n", curr - tree->levels);
    for (plev = tree->levels; plev != curr; plev++) {
        BIO_printf(err, "Level %ld, flags = %x\n",
                   plev - tree->levels, plev->flags);
        for (i = 0; i < sk_X509_POLICY_NODE_num(plev->nodes); i++) {
            node = sk_X509_POLICY_NODE_value(plev->nodes, i);
            X509_POLICY_NODE_print(err, node, 2);
            expected_print(err, plev, node, 2);
            BIO_printf(err, "  Flags: %x\n", node->data->flags);
        }
        if (plev->anyPolicy)
            X509_POLICY_NODE_print(err, plev->anyPolicy, 2);
    }

    BIO_free(err);

}
#else

# define tree_print(a,b,c)      /* */

#endif

/*-
 * Initialize policy tree. Return values:
 *  0 Some internal error occurred.
 * -1 Inconsistent or invalid extensions in certificates.
 *  1 Tree initialized OK.
 *  2 Policy tree is empty.
 *  5 Tree OK and requireExplicitPolicy true.
 *  6 Tree empty and requireExplicitPolicy true.
 */

static int tree_init(X509_POLICY_TREE **ptree, STACK_OF(X509) *certs,
                     unsigned int flags)
{
    X509_POLICY_TREE *tree;
    X509_POLICY_LEVEL *level;
    const X509_POLICY_CACHE *cache;
    X509_POLICY_DATA *data = NULL;
    X509 *x;
    int ret = 1;
    int i, n;
    int explicit_policy;
    int any_skip;
    int map_skip;
    *ptree = NULL;
    n = sk_X509_num(certs);

#if 0
    /* Disable policy mapping for now... */
    flags |= X509_V_FLAG_INHIBIT_MAP;
#endif

    if (flags & X509_V_FLAG_EXPLICIT_POLICY)
        explicit_policy = 0;
    else
        explicit_policy = n + 1;

    if (flags & X509_V_FLAG_INHIBIT_ANY)
        any_skip = 0;
    else
        any_skip = n + 1;

    if (flags & X509_V_FLAG_INHIBIT_MAP)
        map_skip = 0;
    else
        map_skip = n + 1;

    /* Can't do anything with just a trust anchor */
    if (n == 1)
        return 1;
    /*
     * First setup policy cache in all certificates apart from the trust
     * anchor. Note any bad cache results on the way. Also can calculate
     * explicit_policy value at this point.
     */
    for (i = n - 2; i >= 0; i--) {
        x = sk_X509_value(certs, i);
        X509_check_purpose(x, -1, -1);
        cache = policy_cache_set(x);
        /* If cache NULL something bad happened: return immediately */
        if (cache == NULL)
            return 0;
        /*
         * If inconsistent extensions keep a note of it but continue
         */
        if (x->ex_flags & EXFLAG_INVALID_POLICY)
            ret = -1;
        /*
         * Otherwise if we have no data (hence no CertificatePolicies) and
         * haven't already set an inconsistent code note it.
         */
        else if ((ret == 1) && !cache->data)
            ret = 2;
        if (explicit_policy > 0) {
            if (!(x->ex_flags & EXFLAG_SI))
                explicit_policy--;
            if ((cache->explicit_skip != -1)
                && (cache->explicit_skip < explicit_policy))
                explicit_policy = cache->explicit_skip;
        }
    }

    if (ret != 1) {
        if (ret == 2 && !explicit_policy)
            return 6;
        return ret;
    }

    /* If we get this far initialize the tree */

    tree = OPENSSL_malloc(sizeof(X509_POLICY_TREE));

    if (!tree)
        return 0;

    tree->flags = 0;
    tree->levels = OPENSSL_malloc(sizeof(X509_POLICY_LEVEL) * n);
    tree->nlevel = 0;
    tree->extra_data = NULL;
    tree->auth_policies = NULL;
    tree->user_policies = NULL;

    if (!tree->levels) {
        OPENSSL_free(tree);
        return 0;
    }

    memset(tree->levels, 0, n * sizeof(X509_POLICY_LEVEL));

    tree->nlevel = n;

    level = tree->levels;

    /* Root data: initialize to anyPolicy */

    data = policy_data_new(NULL, OBJ_nid2obj(NID_any_policy), 0);

    if (!data || !level_add_node(level, data, NULL, tree))
        goto bad_tree;

    for (i = n - 2; i >= 0; i--) {
        level++;
        x = sk_X509_value(certs, i);
        cache = policy_cache_set(x);
        CRYPTO_add(&x->references, 1, CRYPTO_LOCK_X509);
        level->cert = x;

        if (!cache->anyPolicy)
            level->flags |= X509_V_FLAG_INHIBIT_ANY;

        /* Determine inhibit any and inhibit map flags */
        if (any_skip == 0) {
            /*
             * Any matching allowed if certificate is self issued and not the
             * last in the chain.
             */
            if (!(x->ex_flags & EXFLAG_SI) || (i == 0))
                level->flags |= X509_V_FLAG_INHIBIT_ANY;
        } else {
            if (!(x->ex_flags & EXFLAG_SI))
                any_skip--;
            if ((cache->any_skip >= 0)
                && (cache->any_skip < any_skip))
                any_skip = cache->any_skip;
        }

        if (map_skip == 0)
            level->flags |= X509_V_FLAG_INHIBIT_MAP;
        else {
            if (!(x->ex_flags & EXFLAG_SI))
                map_skip--;
            if ((cache->map_skip >= 0)
                && (cache->map_skip < map_skip))
                map_skip = cache->map_skip;
        }

    }

    *ptree = tree;

    if (explicit_policy)
        return 1;
    else
        return 5;

 bad_tree:

    X509_policy_tree_free(tree);

    return 0;

}

static int tree_link_matching_nodes(X509_POLICY_LEVEL *curr,
                                    const X509_POLICY_DATA *data)
{
    X509_POLICY_LEVEL *last = curr - 1;
    X509_POLICY_NODE *node;
    int i, matched = 0;
    /* Iterate through all in nodes linking matches */
    for (i = 0; i < sk_X509_POLICY_NODE_num(last->nodes); i++) {
        node = sk_X509_POLICY_NODE_value(last->nodes, i);
        if (policy_node_match(last, node, data->valid_policy)) {
            if (!level_add_node(curr, data, node, NULL))
                return 0;
            matched = 1;
        }
    }
    if (!matched && last->anyPolicy) {
        if (!level_add_node(curr, data, last->anyPolicy, NULL))
            return 0;
    }
    return 1;
}

/*
 * This corresponds to RFC3280 6.1.3(d)(1): link any data from
 * CertificatePolicies onto matching parent or anyPolicy if no match.
 */

static int tree_link_nodes(X509_POLICY_LEVEL *curr,
                           const X509_POLICY_CACHE *cache)
{
    int i;
    X509_POLICY_DATA *data;

    for (i = 0; i < sk_X509_POLICY_DATA_num(cache->data); i++) {
        data = sk_X509_POLICY_DATA_value(cache->data, i);
        /*
         * If a node is mapped any it doesn't have a corresponding
         * CertificatePolicies entry. However such an identical node would
         * be created if anyPolicy matching is enabled because there would be
         * no match with the parent valid_policy_set. So we create link
         * because then it will have the mapping flags right and we can prune
         * it later.
         */
#if 0
        if ((data->flags & POLICY_DATA_FLAG_MAPPED_ANY)
            && !(curr->flags & X509_V_FLAG_INHIBIT_ANY))
            continue;
#endif
        /* Look for matching nodes in previous level */
        if (!tree_link_matching_nodes(curr, data))
            return 0;
    }
    return 1;
}

/*
 * This corresponds to RFC3280 6.1.3(d)(2): Create new data for any unmatched
 * policies in the parent and link to anyPolicy.
 */

static int tree_add_unmatched(X509_POLICY_LEVEL *curr,
                              const X509_POLICY_CACHE *cache,
                              const ASN1_OBJECT *id,
                              X509_POLICY_NODE *node, X509_POLICY_TREE *tree)
{
    X509_POLICY_DATA *data;
    if (id == NULL)
        id = node->data->valid_policy;
    /*
     * Create a new node with qualifiers from anyPolicy and id from unmatched
     * node.
     */
    data = policy_data_new(NULL, id, node_critical(node));

    if (data == NULL)
        return 0;
    /* Curr may not have anyPolicy */
    data->qualifier_set = cache->anyPolicy->qualifier_set;
    data->flags |= POLICY_DATA_FLAG_SHARED_QUALIFIERS;
    if (!level_add_node(curr, data, node, tree)) {
        policy_data_free(data);
        return 0;
    }

    return 1;
}

static int tree_link_unmatched(X509_POLICY_LEVEL *curr,
                               const X509_POLICY_CACHE *cache,
                               X509_POLICY_NODE *node, X509_POLICY_TREE *tree)
{
    const X509_POLICY_LEVEL *last = curr - 1;
    int i;

    if ((last->flags & X509_V_FLAG_INHIBIT_MAP)
        || !(node->data->flags & POLICY_DATA_FLAG_MAPPED)) {
        /* If no policy mapping: matched if one child present */
        if (node->nchild)
            return 1;
        if (!tree_add_unmatched(curr, cache, NULL, node, tree))
            return 0;
        /* Add it */
    } else {
        /* If mapping: matched if one child per expected policy set */
        STACK_OF(ASN1_OBJECT) *expset = node->data->expected_policy_set;
        if (node->nchild == sk_ASN1_OBJECT_num(expset))
            return 1;
        /* Locate unmatched nodes */
        for (i = 0; i < sk_ASN1_OBJECT_num(expset); i++) {
            ASN1_OBJECT *oid = sk_ASN1_OBJECT_value(expset, i);
            if (level_find_node(curr, node, oid))
                continue;
            if (!tree_add_unmatched(curr, cache, oid, node, tree))
                return 0;
        }

    }

    return 1;

}

static int tree_link_any(X509_POLICY_LEVEL *curr,
                         const X509_POLICY_CACHE *cache,
                         X509_POLICY_TREE *tree)
{
    int i;
    /*
     * X509_POLICY_DATA *data;
     */
    X509_POLICY_NODE *node;
    X509_POLICY_LEVEL *last = curr - 1;

    for (i = 0; i < sk_X509_POLICY_NODE_num(last->nodes); i++) {
        node = sk_X509_POLICY_NODE_value(last->nodes, i);

        if (!tree_link_unmatched(curr, cache, node, tree))
            return 0;

#if 0

        /*
         * Skip any node with any children: we only want unmathced nodes.
         * Note: need something better for policy mapping because each node
         * may have multiple children
         */
        if (node->nchild)
            continue;

        /*
         * Create a new node with qualifiers from anyPolicy and id from
         * unmatched node.
         */
        data = policy_data_new(NULL, node->data->valid_policy,
                               node_critical(node));

        if (data == NULL)
            return 0;
        /* Curr may not have anyPolicy */
        data->qualifier_set = cache->anyPolicy->qualifier_set;
        data->flags |= POLICY_DATA_FLAG_SHARED_QUALIFIERS;
        if (!level_add_node(curr, data, node, tree)) {
            policy_data_free(data);
            return 0;
        }
#endif

    }
    /* Finally add link to anyPolicy */
    if (last->anyPolicy) {
        if (!level_add_node(curr, cache->anyPolicy, last->anyPolicy, NULL))
            return 0;
    }
    return 1;
}

/*
 * Prune the tree: delete any child mapped child data on the current level
 * then proceed up the tree deleting any data with no children. If we ever
 * have no data on a level we can halt because the tree will be empty.
 */

static int tree_prune(X509_POLICY_TREE *tree, X509_POLICY_LEVEL *curr)
{
    STACK_OF(X509_POLICY_NODE) *nodes;
    X509_POLICY_NODE *node;
    int i;
    nodes = curr->nodes;
    if (curr->flags & X509_V_FLAG_INHIBIT_MAP) {
        for (i = sk_X509_POLICY_NODE_num(nodes) - 1; i >= 0; i--) {
            node = sk_X509_POLICY_NODE_value(nodes, i);
            /* Delete any mapped data: see RFC3280 XXXX */
            if (node->data->flags & POLICY_DATA_FLAG_MAP_MASK) {
                node->parent->nchild--;
                OPENSSL_free(node);
                (void)sk_X509_POLICY_NODE_delete(nodes, i);
            }
        }
    }

    for (;;) {
        --curr;
        nodes = curr->nodes;
        for (i = sk_X509_POLICY_NODE_num(nodes) - 1; i >= 0; i--) {
            node = sk_X509_POLICY_NODE_value(nodes, i);
            if (node->nchild == 0) {
                node->parent->nchild--;
                OPENSSL_free(node);
                (void)sk_X509_POLICY_NODE_delete(nodes, i);
            }
        }
        if (curr->anyPolicy && !curr->anyPolicy->nchild) {
            if (curr->anyPolicy->parent)
                curr->anyPolicy->parent->nchild--;
            OPENSSL_free(curr->anyPolicy);
            curr->anyPolicy = NULL;
        }
        if (curr == tree->levels) {
            /* If we zapped anyPolicy at top then tree is empty */
            if (!curr->anyPolicy)
                return 2;
            return 1;
        }
    }

    return 1;

}

static int tree_add_auth_node(STACK_OF(X509_POLICY_NODE) **pnodes,
                              X509_POLICY_NODE *pcy)
{
    if (!*pnodes) {
        *pnodes = policy_node_cmp_new();
        if (!*pnodes)
            return 0;
    } else if (sk_X509_POLICY_NODE_find(*pnodes, pcy) != -1)
        return 1;

    if (!sk_X509_POLICY_NODE_push(*pnodes, pcy))
        return 0;

    return 1;

}

/*
 * Calculate the authority set based on policy tree. The 'pnodes' parameter
 * is used as a store for the set of policy nodes used to calculate the user
 * set. If the authority set is not anyPolicy then pnodes will just point to
 * the authority set. If however the authority set is anyPolicy then the set
 * of valid policies (other than anyPolicy) is store in pnodes. The return
 * value of '2' is used in this case to indicate that pnodes should be freed.
 */

static int tree_calculate_authority_set(X509_POLICY_TREE *tree,
                                        STACK_OF(X509_POLICY_NODE) **pnodes)
{
    X509_POLICY_LEVEL *curr;
    X509_POLICY_NODE *node, *anyptr;
    STACK_OF(X509_POLICY_NODE) **addnodes;
    int i, j;
    curr = tree->levels + tree->nlevel - 1;

    /* If last level contains anyPolicy set is anyPolicy */
    if (curr->anyPolicy) {
        if (!tree_add_auth_node(&tree->auth_policies, curr->anyPolicy))
            return 0;
        addnodes = pnodes;
    } else
        /* Add policies to authority set */
        addnodes = &tree->auth_policies;

    curr = tree->levels;
    for (i = 1; i < tree->nlevel; i++) {
        /*
         * If no anyPolicy node on this this level it can't appear on lower
         * levels so end search.
         */
        if (!(anyptr = curr->anyPolicy))
            break;
        curr++;
        for (j = 0; j < sk_X509_POLICY_NODE_num(curr->nodes); j++) {
            node = sk_X509_POLICY_NODE_value(curr->nodes, j);
            if ((node->parent == anyptr)
                && !tree_add_auth_node(addnodes, node))
                return 0;
        }
    }

    if (addnodes == pnodes)
        return 2;

    *pnodes = tree->auth_policies;

    return 1;
}

static int tree_calculate_user_set(X509_POLICY_TREE *tree,
                                   STACK_OF(ASN1_OBJECT) *policy_oids,
                                   STACK_OF(X509_POLICY_NODE) *auth_nodes)
{
    int i;
    X509_POLICY_NODE *node;
    ASN1_OBJECT *oid;

    X509_POLICY_NODE *anyPolicy;
    X509_POLICY_DATA *extra;

    /*
     * Check if anyPolicy present in authority constrained policy set: this
     * will happen if it is a leaf node.
     */

    if (sk_ASN1_OBJECT_num(policy_oids) <= 0)
        return 1;

    anyPolicy = tree->levels[tree->nlevel - 1].anyPolicy;

    for (i = 0; i < sk_ASN1_OBJECT_num(policy_oids); i++) {
        oid = sk_ASN1_OBJECT_value(policy_oids, i);
        if (OBJ_obj2nid(oid) == NID_any_policy) {
            tree->flags |= POLICY_FLAG_ANY_POLICY;
            return 1;
        }
    }

    for (i = 0; i < sk_ASN1_OBJECT_num(policy_oids); i++) {
        oid = sk_ASN1_OBJECT_value(policy_oids, i);
        node = tree_find_sk(auth_nodes, oid);
        if (!node) {
            if (!anyPolicy)
                continue;
            /*
             * Create a new node with policy ID from user set and qualifiers
             * from anyPolicy.
             */
            extra = policy_data_new(NULL, oid, node_critical(anyPolicy));
            if (!extra)
                return 0;
            extra->qualifier_set = anyPolicy->data->qualifier_set;
            extra->flags = POLICY_DATA_FLAG_SHARED_QUALIFIERS
                | POLICY_DATA_FLAG_EXTRA_NODE;
            node = level_add_node(NULL, extra, anyPolicy->parent, tree);
        }
        if (!tree->user_policies) {
            tree->user_policies = sk_X509_POLICY_NODE_new_null();
            if (!tree->user_policies)
                return 1;
        }
        if (!sk_X509_POLICY_NODE_push(tree->user_policies, node))
            return 0;
    }
    return 1;

}

static int tree_evaluate(X509_POLICY_TREE *tree)
{
    int ret, i;
    X509_POLICY_LEVEL *curr = tree->levels + 1;
    const X509_POLICY_CACHE *cache;

    for (i = 1; i < tree->nlevel; i++, curr++) {
        cache = policy_cache_set(curr->cert);
        if (!tree_link_nodes(curr, cache))
            return 0;

        if (!(curr->flags & X509_V_FLAG_INHIBIT_ANY)
            && !tree_link_any(curr, cache, tree))
            return 0;
        tree_print("before tree_prune()", tree, curr);
        ret = tree_prune(tree, curr);
        if (ret != 1)
            return ret;
    }

    return 1;

}

static void exnode_free(X509_POLICY_NODE *node)
{
    if (node->data && (node->data->flags & POLICY_DATA_FLAG_EXTRA_NODE))
        OPENSSL_free(node);
}

void X509_policy_tree_free(X509_POLICY_TREE *tree)
{
    X509_POLICY_LEVEL *curr;
    int i;

    if (!tree)
        return;

    sk_X509_POLICY_NODE_free(tree->auth_policies);
    sk_X509_POLICY_NODE_pop_free(tree->user_policies, exnode_free);

    for (i = 0, curr = tree->levels; i < tree->nlevel; i++, curr++) {
        if (curr->cert)
            X509_free(curr->cert);
        if (curr->nodes)
            sk_X509_POLICY_NODE_pop_free(curr->nodes, policy_node_free);
        if (curr->anyPolicy)
            policy_node_free(curr->anyPolicy);
    }

    if (tree->extra_data)
        sk_X509_POLICY_DATA_pop_free(tree->extra_data, policy_data_free);

    OPENSSL_free(tree->levels);
    OPENSSL_free(tree);

}

/*-
 * Application policy checking function.
 * Return codes:
 *  0   Internal Error.
 *  1   Successful.
 * -1   One or more certificates contain invalid or inconsistent extensions
 * -2   User constrained policy set empty and requireExplicit true.
 */

int X509_policy_check(X509_POLICY_TREE **ptree, int *pexplicit_policy,
                      STACK_OF(X509) *certs,
                      STACK_OF(ASN1_OBJECT) *policy_oids, unsigned int flags)
{
    int ret;
    X509_POLICY_TREE *tree = NULL;
    STACK_OF(X509_POLICY_NODE) *nodes, *auth_nodes = NULL;
    *ptree = NULL;

    *pexplicit_policy = 0;
    ret = tree_init(&tree, certs, flags);

    switch (ret) {

        /* Tree empty requireExplicit False: OK */
    case 2:
        return 1;

        /* Some internal error */
    case -1:
        return -1;

        /* Some internal error */
    case 0:
        return 0;

        /* Tree empty requireExplicit True: Error */

    case 6:
        *pexplicit_policy = 1;
        return -2;

        /* Tree OK requireExplicit True: OK and continue */
    case 5:
        *pexplicit_policy = 1;
        break;

        /* Tree OK: continue */

    case 1:
        if (!tree)
            /*
             * tree_init() returns success and a null tree
             * if it's just looking at a trust anchor.
             * I'm not sure that returning success here is
             * correct, but I'm sure that reporting this
             * as an internal error which our caller
             * interprets as a malloc failure is wrong.
             */
            return 1;
        break;
    }

    if (!tree)
        goto error;
    ret = tree_evaluate(tree);

    tree_print("tree_evaluate()", tree, NULL);

    if (ret <= 0)
        goto error;

    /* Return value 2 means tree empty */
    if (ret == 2) {
        X509_policy_tree_free(tree);
        if (*pexplicit_policy)
            return -2;
        else
            return 1;
    }

    /* Tree is not empty: continue */

    ret = tree_calculate_authority_set(tree, &auth_nodes);

    if (!ret)
        goto error;

    if (!tree_calculate_user_set(tree, policy_oids, auth_nodes))
        goto error;

    if (ret == 2)
        sk_X509_POLICY_NODE_free(auth_nodes);

    if (tree)
        *ptree = tree;

    if (*pexplicit_policy) {
        nodes = X509_policy_tree_get0_user_policies(tree);
        if (sk_X509_POLICY_NODE_num(nodes) <= 0)
            return -2;
    }

    return 1;

 error:

    X509_policy_tree_free(tree);

    return 0;

}


//== Colours

// main
@dark-sky-blue: #28afe4;
@bluish: #239bca;
@lightblue: #4dc4f3;
@light-blue: #41baea;
@light-blue-two: #3fbced;
@light-blue-three: #f2fafe;
@blue-grey: #4d5978;
@dark-blue-grey: #101833;
@fiord: #3f4c6b;
@dusk: #3f4b6a;
@dusk-two: #495a81;
@dusty-blue: #657cb2;
@greyblue: #8c9dc5;
@light-grey-blue: #96a8d3;
@dusk-three: #474056;
@greyish-purple: #898593;
@cool-grey: #acaab3;
@silver: #c9c9cd;
@light-grey: #f7f7fa;
@light-grey-two: #f1f6fa;
@light-grey-three: #e0e0e0;
@light-grayish-blue: #f2f2f5;
@pale-grey: #e1e0e5;
@pale-grey-two: #edecef;
@pale-grey-three: #f3f3f6;
@pale-white: #f2f2f6;
@white: #ffffff;
@solid-grey: #a9a9a9;
@dark-grey: #0a0a0a;
@black: #000000;

// alert colours
@darkish-pink: #e54158;
@sunflower-yellow: #f7dd00;
@tealish: #21d4ac;
@light-green: #f1f9f5;
@cloudy-blue: #a8c6dc;

// chart colours
@tiffany-blue: #83dfe9;
@orangish: #f9794f;
@dark-orange: #ef7a51;
@orange: #fa9153;
@pale-orange: #fdbc5a;
@dark-greyish-blue: #9997a0;
@french-blue: #4a69ab;
@greyish-blue: #a0c3dc;
@cerulean-blue: #2b5cc5;

// NOT in standard palette
@slider-bar: #dedce1;
@vs-dark: #1e1e1e;

@alabaster: #f7f7f7;
@alabaster-two: #fbfbfb;
@alice-blue: #f3fbff;
@alto: #d9d9d9;
@alto-two: #dedede;
@alto-three: #dddddd;
@alto-four: #d7d7d7;
@anakiwa: #7ee3fe;
@athens-gray: #f1f0f2;
@athens-gray-two: #efeff0;
@athens-gray-three: #f5f5f8;
@bismark: #4b6c8b;
@botticelli: #dce2ef;
@boston-blue: #3d96ae;
@botticelli: #dce2ef;
@bright-turquoise: #00c9ff;
@bright-turquoise-two: #03c8ff;
@burnt-sienna: #ea674d;
@cadet-blue: #aab6c1;
@casablanca: #f7bf48;
@catskill-white: #f8fafc;
@catskill-white-two: #f9fafc;
@cerise-red: #e4365f;
@cerulean: #01b7e7;
@chelsea-cucumber: #89a54e;
@chenin: #e1d97f;
@cherub: #fbe5e8;
@cornflower-blue: #668ef1;
@cream-can: #f6cb5a;
@deep-blush: #e27182;
@deep-blush-two: #e17082;
@dodger-blue: #3bd6ff;
@dove-gray: #727272;
@east-bay: #3d5b77;
@ebony-clay: #252d36;
@fire-bush: #e49836;
@foam: #eff9fd;
@fountain-blue: #53bdb3;
@fountain-blue-two: #54bdb5;
@french-grey: #c0bec5;
@gallery: #ebebeb;
@gallery-two: #ececec;
@gallery-three: #f0f0f0;
@geyser: #dde2e6;
@glacier: #7ea1c1;
@gray: #808080;
@gray-chateau: #9aa2ae;
@hippie-blue: #6492b7;
@hopbush: #c669a7;
@horizon: #5982a2;
@horizon-two: #5a83a3;
@horizon-three: #5a82a2;
@horizon-four: #5d81a1;
@iron: #d7dbdc;
@kimberly: #80699b;
@limed-spruce: #37424e;
@loblolly: #b2bfc8;
@loblolly-two: #c7d0d8;
@loblolly-three: #c2cbd3;
@lynch: #61798f;
@malachite: #16e07a;
@malibu: #61d9f9;
@manatee: #94959a;
@mercury: #e1e1e1;
@mercury-two: #e6e6e6;
@mine-shaft: #222222;
@mischka: #dbdadf;
@moss-green: #a4d6ab;
@mountain-mist: #918c9a;
@mountain-mist-two: #94909d;
@mountain-meadow: #1dbd99;
@mystic: #e7edf0;
@mystic-two: #e6ebf1;
@outer-space: #2d3640;
@oslo-gray: #919499;
@pastel-green: #7fe165;
@perano: #a5cdf1;
@pharlap: #a47d7c;
@picton-blue: #3dc9e7;
@picton-blue-two: #3ec9e8;
@pigeon-post: #b2c7da;
@pine-glade: #b5ca92;
@polo-blue: #92a8cd;
@red: #ff0000;
@red-berry: #910000;
@red-damask: #db843d;
@san-juan: #37516a;
@shuttle-gray: #616870;
@silver-chalice: #9d9d9d;
@silver-chalice-two: #b2b2b2;
@silver-two: #cccccc;
@silver-three: #c7c7c7;
@silver-sand: #b9bec4;
@spindle: #b7bdee;
@spindle-two: #accbea;
@topaz: #8a8694;
@tuna: #3c3649;
@tundora: #444444;
@tropical-blue: #c1e8f7;
@valencia: #d73d53;
@viking: #52ded3;
@wild-sand: #f5f5f5;
@wild-blue-yonder: #798bb4;
@white-two: #fdfdfd;
@whisper: #f8f8fb;
@ziggurat: #becfdf;

.ebonyClay(@alpha) {
    @color: rgba(37, 45, 54, @alpha);
}

.mountainMist(@alpha) {
    @color: rgba(145, 140, 154, @alpha);
}

.red(@alpha) {
    @color: rgba(255, 0, 0, @alpha);
}

.darkSkyBlue(@alpha) {
    @color: rgba(40, 175, 228, @alpha);
}

.lightblue(@alpha) {
    @color: rgba(77, 196, 243, @alpha);
}

.bluish(@alpha) {
    @color: rgba(35, 155, 202, @alpha);
}

.darkBlueGrey(@alpha) {
    @color: rgba(16, 24, 51, @alpha);
}

.dusk(@alpha) {
    @color: rgba(63, 75, 106, @alpha);
}

.duskTwo(@alpha) {
    @color: rgba(73, 90, 129, @alpha);
}

.dustyBlue(@alpha) {
    @color: rgba(101, 124, 178, @alpha);
}

.greyblue(@alpha) {
    @color: rgba(140, 157, 197, @alpha);
}

.lightGreyBlue(@alpha) {
    @color: rgba(150, 168, 211, @alpha);
}

.duskThree(@alpha) {
    @color: rgba(71, 64, 86, @alpha);
}

.greyishPurple(@alpha) {
    @color: rgba(137, 133, 147, @alpha);
}

.coolGrey(@alpha) {
    @color: rgba(172, 170, 179, @alpha);
}

.silver(@alpha) {
    @color: rgba(201, 201, 205, @alpha);
}

.paleGreyTwo(@alpha) {
    @color: rgba(237, 236, 239, @alpha);
}

.paleGreyThree(@alpha) {
    @color: rgba(243, 243, 246, @alpha);
}

.paleWhite(@alpha) {
    @color: rgba(242, 242, 242, @alpha);
}

.white(@alpha) {
    @color: rgba(255, 255, 255, @alpha);
}

.darkishPink(@alpha) {
    @color: rgba(229, 65, 88, @alpha);
}

.sunflowerYellow(@alpha) {
    @color: rgba(247, 221, 0, @alpha);
}

.tealish(@alpha) {
    @color: rgba(33, 212, 172, @alpha);
}

.tiffanyBlue(@alpha) {
    @color: rgba(131, 223, 233, @alpha);
}

.orangish(@alpha) {
    @color: rgba(249, 121, 79, @alpha);
}

.paleOrange(@alpha) {
    @color: rgba(253, 188, 90, @alpha);
}

.frenchBlue(@alpha) {
    @color: rgba(74, 105, 171, @alpha);
}

.greyishBlue(@alpha) {
    @color: rgba(168, 198, 220, @alpha);
}

.orange(@alpha) {
    @color: rgba(250, 143, 83, @alpha);
}

.darkOrange(@alpha) {
    @color: rgba(239, 122, 81, @alpha);
}

.paleGrey(@alpha) {
    @color: rgba(225, 224, 229, @alpha);
}

.black(@alpha) {
    @color: rgba(0, 0, 0, @alpha);
}

.lightBlue(@alpha) {
    @color: rgba(65, 186, 234, @alpha);
}


# Maintainer: ArchStrike <team@archstrike.org>

buildarch=1

_pkgname=roguehostapd
pkgname="python-${_pkgname}-git"
pkgver=1.2.3
pkgrel=1
pkgdesc="Hostapd wrapper for hostapd"
url="https://github.com/wifiphisher/roguehostapd"
depends=('python')
makedepends=('python-setuptools' 'libnl' 'git')
license=('BSD')
arch=('any')
source=("git+${url}.git")
sha512sums=('SKIP')

package() {
  cd "${srcdir}/${_pkgname}" || exit
  python setup.py install --root="${pkgdir}" -O1
}


The modern build of lodash’s internal `baseToString` as a module.

echo "See https://travis-ci.org/lodash/lodash-cli for testing details."


package com.xuexiang.xui.widget.banner.anim;

import android.animation.Animator;
import android.animation.AnimatorSet;
import android.view.View;
import android.view.animation.Interpolator;

public abstract class BaseAnimator {
    protected long mDuration = 500;
    protected AnimatorSet mAnimatorSet = new AnimatorSet();
    private Interpolator mInterpolator;
    private long mDelay;
    private AnimatorListener mListener;

    public abstract void setAnimation(View view);

    protected void start(final View view) {
        reset(view);
        setAnimation(view);

        mAnimatorSet.setDuration(mDuration);
        if (mInterpolator != null) {
            mAnimatorSet.setInterpolator(mInterpolator);
        }

        if (mDelay > 0) {
            mAnimatorSet.setStartDelay(mDelay);
        }

        if (mListener != null) {
            mAnimatorSet.addListener(new Animator.AnimatorListener() {
                @Override
                public void onAnimationStart(Animator animator) {
                    mListener.onAnimationStart(animator);
                }

                @Override
                public void onAnimationRepeat(Animator animator) {
                    mListener.onAnimationRepeat(animator);
                }

                @Override
                public void onAnimationEnd(Animator animator) {
                    mListener.onAnimationEnd(animator);
                }

                @Override
                public void onAnimationCancel(Animator animator) {
                    mListener.onAnimationCancel(animator);
                }
            });
        }

        mAnimatorSet.start();
    }

    public static void reset(View view) {
        view.setAlpha(1);
        view.setScaleX(1);
        view.setScaleY(1);
        view.setTranslationX(0);
        view.setTranslationY(0);
        view.setRotation(0);
        view.setRotationY(0);
        view.setRotationX(0);
    }

    public BaseAnimator duration(long duration) {
        this.mDuration = duration;
        return this;
    }

    public BaseAnimator delay(long delay) {
        this.mDelay = delay;
        return this;
    }

    public BaseAnimator interpolator(Interpolator interpolator) {
        this.mInterpolator = interpolator;
        return this;
    }

    public BaseAnimator listener(AnimatorListener listener) {
        this.mListener = listener;
        return this;
    }

    public void playOn(View view) {
        start(view);
    }

    public interface AnimatorListener {
        void onAnimationStart(Animator animator);

        void onAnimationRepeat(Animator animator);

        void onAnimationEnd(Animator animator);

        void onAnimationCancel(Animator animator);
    }
}


# make sure virtualenvwrapper is enabled if available

cite about-plugin
about-plugin 'virtualenvwrapper and pyenv-virtualenvwrapper helper functions'

if _command_exists pyenv; then
  pyenv virtualenvwrapper
else
  [[ `which virtualenvwrapper.sh` ]] && . virtualenvwrapper.sh
fi

function mkvenv {
  about 'create a new virtualenv for this directory'
  group 'virtualenv'

  cwd=`basename \`pwd\``
  mkvirtualenv --distribute $cwd
}

function mkvbranch {
  about 'create a new virtualenv for the current branch'
  group 'virtualenv'

  mkvirtualenv --distribute "$(basename `pwd`)@$SCM_BRANCH"
}

function wovbranch {
  about 'sets workon branch'
  group 'virtualenv'

  workon "$(basename `pwd`)@$SCM_BRANCH"
}

function wovenv {
  about 'works on the virtualenv for this directory'
  group 'virtualenv'

  workon "$(basename `pwd`)"
}


<?php declare(strict_types=1);
/**
 * Part of Windwalker project Test files.  @codingStandardsIgnoreStart
 *
 * @copyright  Copyright (C) 2019 LYRASOFT Taiwan, Inc.
 * @license    LGPL-2.0-or-later
 */

namespace Windwalker\Validator\Test;

use Windwalker\Validator\Rule\RegexValidator;

/**
 * Test class of RegexValidator
 *
 * @since 2.0
 */
class RegexValidatorTest extends \PHPUnit\Framework\TestCase
{
    /**
     * Test instance.
     *
     * @var RegexValidator
     */
    protected $instance;

    /**
     * Sets up the fixture, for example, opens a network connection.
     * This method is called before a test is executed.
     *
     * @return void
     */
    protected function setUp(): void
    {
        // Using Alnum to test
        $this->instance = new RegexValidator('^[a-zA-Z0-9]*$', 'i');
    }

    /**
     * Tears down the fixture, for example, closes a network connection.
     * This method is called after a test is executed.
     *
     * @return void
     */
    protected function tearDown(): void
    {
    }

    /**
     * testValidate
     *
     * @return  void
     *
     * @cover  \Windwalker\Validator\Rule\AlnumValidator
     */
    public function testValidate()
    {
        $this->assertTrue($this->instance->validate('abc123cba456'));

        $this->assertFalse($this->instance->validate('abc123 cba456'));
        $this->assertFalse($this->instance->validate('abc_123.cba-456'));
    }

    /**
     * Method to test getRegex().
     *
     * @return void
     *
     * @covers \Windwalker\Validator\Rule\RegexValidator::getRegex
     * @TODO   Implement testGetRegex().
     */
    public function testGetRegex()
    {
        // Remove the following lines when you implement this test.
        $this->markTestIncomplete(
            'This test has not been implemented yet.'
        );
    }

    /**
     * Method to test setRegex().
     *
     * @return void
     *
     * @covers \Windwalker\Validator\Rule\RegexValidator::setRegex
     * @TODO   Implement testSetRegex().
     */
    public function testSetRegex()
    {
        // Remove the following lines when you implement this test.
        $this->markTestIncomplete(
            'This test has not been implemented yet.'
        );
    }

    /**
     * Method to test getModifiers().
     *
     * @return void
     *
     * @covers \Windwalker\Validator\Rule\RegexValidator::getModifiers
     * @TODO   Implement testGetModifiers().
     */
    public function testGetModifiers()
    {
        // Remove the following lines when you implement this test.
        $this->markTestIncomplete(
            'This test has not been implemented yet.'
        );
    }

    /**
     * Method to test setModifiers().
     *
     * @return void
     *
     * @covers \Windwalker\Validator\Rule\RegexValidator::setModifiers
     * @TODO   Implement testSetModifiers().
     */
    public function testSetModifiers()
    {
        // Remove the following lines when you implement this test.
        $this->markTestIncomplete(
            'This test has not been implemented yet.'
        );
    }
}


<!DOCTYPE html>

    <title>ChildrenAnimations Struct Reference</title>
    <link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
    <link rel="stylesheet" type="text/css" href="../css/highlight.css" />
    <meta charset='utf-8'>

Katana Docs (100% documented)

View on GitHub

        Katana Reference

        ChildrenAnimations Struct Reference

            Classes

                Node

                PlasticNode

                PlasticView

                Renderer

                Store

                ViewsContainer

            Enums

                AnimationType

                AsyncActionState

                EmptyKeys

            Extensions

                Array

                CGSize

                UIView

            Protocols

                Action

                ActionWithSideEffect

                AnyAsyncAction

                AnyConnectedNodeDescription

                AnyNode

                AnyNodeDescription

                AnyNodeDescriptionProps

                AnyNodeDescriptionWithChildren

                AnyPlasticNodeDescription

                AnyStore

                AsyncAction

                Childrenable

                ConnectedNodeDescription

                LinkeableAction

                NodeDescription

                NodeDescriptionProps

                NodeDescriptionState

                NodeDescriptionWithChildren

                PlasticNodeDescription

                PlasticReferenceSizeable

                PlatformNativeView

                SideEffectDependencyContainer

                State

            Structs

                ActionLinker

                ActionLinks

                Anchor

                – Kind

                Animation

                AnimationContainer

                AnimationOptions

                AnimationProps

                ChildrenAnimations

                EdgeInsets

                EmptyProps

                EmptySideEffectDependencyContainer

                EmptyState

                Size

                Value

            Typealiases

                AnimationPropsTransformer

                NodeUpdateCompletion

            Associated Types

                PropsType

ChildrenAnimations

public struct ChildrenAnimations<Key>

This struct is used as container to define the animations for the children

                    subscript(_:)

Gets the Animation value relative to a specific key

If the key has not been defined, the allChildren value is returned

Declaration

Swift

subscript(key: String) -> Animation

Parameters

                                key

the key of the children to retrieve

Return Value

the Animation value related to the key

                        Show on GitHub

                    subscript(_:)

Note

    This subscript should be used only to set values.

It is an helper to specify the same animation for multiple keys

Declaration

Swift

public subscript(key: [Key]) -> Animation

                        Show on GitHub

                    subscript(_:)

Gets the Animation value relative to a specific key

If the key has not been defined, the allChildren value is returned

Declaration

Swift

public subscript(key: Key) -> Animation

Parameters

                                key

the key of the children to retrieve

Return Value

the Animation value related to the key

                        Show on GitHub

                    allChildren

A default that is used for all the children without a specific animation

Declaration

Swift

public var allChildren: Animation = .none

                        Show on GitHub

                    subscript(_:)

Implementation of the AnyChildrenAnimations protocol.

See also

    AnyChildrenAnimations

Declaration

Swift

subscript(description: AnyNodeDescription) -> Animation

                        Show on GitHub

© 2017 Bending Spoons Team. All rights reserved. (Last updated: 2017-01-27)

Generated by jazzy ♪♫ v0.7.3, a Realm project.


Dieses Werkzeug aktiviert die vorherige offene Zeichnung.


id :: @strict Int -> Int
id x = x

main = id 2