text:
#if !defined(CY_CLOCK_SPI1_IntClock_H)
#define CY_CLOCK_SPI1_IntClock_H

#include <cytypes.h>
#include <cyfitter.h>

/***************************************
* Conditional Compilation Parameters
***************************************/

/* Check to see if required defines such as CY_PSOC5LP are available */
/* They are defined starting with cy_boot v3.0 */
#if !defined (CY_PSOC5LP)
    #error Component cy_clock_v2_20 requires cy_boot v3.0 or later
#endif /* (CY_PSOC5LP) */

/***************************************
*        Function Prototypes
***************************************/

void SPI1_IntClock_Start(void) ;
void SPI1_IntClock_Stop(void) ;

#if(CY_PSOC3 || CY_PSOC5LP)
void SPI1_IntClock_StopBlock(void) ;
#endif /* (CY_PSOC3 || CY_PSOC5LP) */

void SPI1_IntClock_StandbyPower(uint8 state) ;
void SPI1_IntClock_SetDividerRegister(uint16 clkDivider, uint8 restart)
                                ;
uint16 SPI1_IntClock_GetDividerRegister(void) ;
void SPI1_IntClock_SetModeRegister(uint8 modeBitMask) ;
void SPI1_IntClock_ClearModeRegister(uint8 modeBitMask) ;
uint8 SPI1_IntClock_GetModeRegister(void) ;
void SPI1_IntClock_SetSourceRegister(uint8 clkSource) ;
uint8 SPI1_IntClock_GetSourceRegister(void) ;
#if defined(SPI1_IntClock__CFG3)
void SPI1_IntClock_SetPhaseRegister(uint8 clkPhase) ;
uint8 SPI1_IntClock_GetPhaseRegister(void) ;
#endif /* defined(SPI1_IntClock__CFG3) */

#define SPI1_IntClock_Enable()                       SPI1_IntClock_Start()
#define SPI1_IntClock_Disable()                      SPI1_IntClock_Stop()
#define SPI1_IntClock_SetDivider(clkDivider)         SPI1_IntClock_SetDividerRegister(clkDivider, 1u)
#define SPI1_IntClock_SetDividerValue(clkDivider)    SPI1_IntClock_SetDividerRegister((clkDivider) - 1u, 1u)
#define SPI1_IntClock_SetMode(clkMode)               SPI1_IntClock_SetModeRegister(clkMode)
#define SPI1_IntClock_SetSource(clkSource)           SPI1_IntClock_SetSourceRegister(clkSource)
#if defined(SPI1_IntClock__CFG3)
#define SPI1_IntClock_SetPhase(clkPhase)             SPI1_IntClock_SetPhaseRegister(clkPhase)
#define SPI1_IntClock_SetPhaseValue(clkPhase)        SPI1_IntClock_SetPhaseRegister((clkPhase) + 1u)
#endif /* defined(SPI1_IntClock__CFG3) */

/***************************************
*             Registers
***************************************/

/* Register to enable or disable the clock */
#define SPI1_IntClock_CLKEN              (* (reg8 *) SPI1_IntClock__PM_ACT_CFG)
#define SPI1_IntClock_CLKEN_PTR          ((reg8 *) SPI1_IntClock__PM_ACT_CFG)

/* Register to enable or disable the clock */
#define SPI1_IntClock_CLKSTBY            (* (reg8 *) SPI1_IntClock__PM_STBY_CFG)
#define SPI1_IntClock_CLKSTBY_PTR        ((reg8 *) SPI1_IntClock__PM_STBY_CFG)

/* Clock LSB divider configuration register. */
#define SPI1_IntClock_DIV_LSB            (* (reg8 *) SPI1_IntClock__CFG0)
#define SPI1_IntClock_DIV_LSB_PTR        ((reg8 *) SPI1_IntClock__CFG0)
#define SPI1_IntClock_DIV_PTR            ((reg16 *) SPI1_IntClock__CFG0)

/* Clock MSB divider configuration register. */
#define SPI1_IntClock_DIV_MSB            (* (reg8 *) SPI1_IntClock__CFG1)
#define SPI1_IntClock_DIV_MSB_PTR        ((reg8 *) SPI1_IntClock__CFG1)

/* Mode and source configuration register */
#define SPI1_IntClock_MOD_SRC            (* (reg8 *) SPI1_IntClock__CFG2)
#define SPI1_IntClock_MOD_SRC_PTR        ((reg8 *) SPI1_IntClock__CFG2)

#if defined(SPI1_IntClock__CFG3)
/* Analog clock phase configuration register */
#define SPI1_IntClock_PHASE              (* (reg8 *) SPI1_IntClock__CFG3)
#define SPI1_IntClock_PHASE_PTR          ((reg8 *) SPI1_IntClock__CFG3)
#endif /* defined(SPI1_IntClock__CFG3) */

/**************************************
*       Register Constants
**************************************/

/* Power manager register masks */
#define SPI1_IntClock_CLKEN_MASK         SPI1_IntClock__PM_ACT_MSK
#define SPI1_IntClock_CLKSTBY_MASK       SPI1_IntClock__PM_STBY_MSK

/* CFG2 field masks */
#define SPI1_IntClock_SRC_SEL_MSK        SPI1_IntClock__CFG2_SRC_SEL_MASK
#define SPI1_IntClock_MODE_MASK          (~(SPI1_IntClock_SRC_SEL_MSK))

#if defined(SPI1_IntClock__CFG3)
/* CFG3 phase mask */
#define SPI1_IntClock_PHASE_MASK         SPI1_IntClock__CFG3_PHASE_DLY_MASK
#endif /* defined(SPI1_IntClock__CFG3) */

#endif /* CY_CLOCK_SPI1_IntClock_H */

/* [] END OF FILE */


text:
using QtNodes::PortType;
using QtNodes::PortIndex;
using QtNodes::NodeData;
using QtNodes::NodeDataType;
using QtNodes::NodeDataModel;
using QtNodes::NodeValidationState;

/// The class can potentially incapsulate any user data which
/// need to be transferred within the Node Editor graph
class MyNodeData : public NodeData
{
public:

  NodeDataType
  type() const override
  { return NodeDataType {"MyNodeData", "My Node Data"}; }
};

//------------------------------------------------------------------------------

/// The model dictates the number of inputs and outputs for the Node.
/// In this example it has no logic.
class MyDataModel : public NodeDataModel
{
  Q_OBJECT

public:

  virtual
  ~MyDataModel() {}

public:

  QString
  caption() const override
  {
    return QString("My Data Model");
  }

  QString
  name() const override
  {
    return QString("MyDataModel");
  }

  std::unique_ptr<NodeDataModel>
  clone() const override
  {
    return std::make_unique<MyDataModel>();
  }

public:

  QJsonObject
  save() const override
  {
    QJsonObject modelJson;

    modelJson["name"] = name();

    return modelJson;
  }

public:

  unsigned int
  nPorts(PortType) const override
  {
    return 3;
  }

  NodeDataType
  dataType(PortType, PortIndex) const override
  {
    return MyNodeData().type();
  }

  std::shared_ptr<NodeData>
  outData(PortIndex) override
  {
    return std::make_shared<MyNodeData>();
  }

  void
  setInData(std::shared_ptr<NodeData>, int) override
  {
    //
  }

  QWidget *
  embeddedWidget() override { return nullptr; }
};

redpajama_set_name: RedPajamaGithub


text:
import React from 'react';
import ReactDOMServer from 'react-dom/server';

export default (props) => {
    const { layout } = props;

    const shellState = `
        window.SHELL_STATE = ${JSON.stringify(props)};
    `;

    const children = [
        <title id='shell-head-title'>{ layout.pageTitle }</title>,
        <script dangerouslySetInnerHTML={{__html: shellState}} />
    ].concat(props.children || [ ]);

    return children.reduce(
        (previous, child) => previous + ReactDOMServer.renderToStaticMarkup(child),
        ''
    );
};


text:
using System;
using System.Xml.Serialization;
using System.Collections.Generic;

namespace Aop.Api.Domain
{
    /// <summary>
    /// SsdataDataserviceRiskAudioQueryModel Data Structure.
    /// </summary>
    [Serializable]
    public class SsdataDataserviceRiskAudioQueryModel : AopObject
    {
        /// <summary>
        /// 调用识别服务的用户id,与使用ssdata.dataservice.risk.audio.set的creator一致
        /// </summary>
        [XmlElement("checker")]
        public string Checker { get; set; }

        /// <summary>
        /// 用户音频请求唯一识别码
        /// </summary>
        [XmlElement("request_id")]
        public string RequestId { get; set; }

        /// <summary>
        /// 风险类型,1-涉政模型, 2-涉黄模型。与ssdata.dataservice.risk.audio.verify接口传数据时的参数保持一致。
        /// </summary>
        [XmlArray("risk_type")]
        [XmlArrayItem("string")]
        public List<string> RiskType { get; set; }
    }
}


text:
<title>{% block title %}SensorSafe{% endblock %}</title>
{% block head %}{% endblock %}

SensorSafe: Broker  (beta)

{% block login %}
	{% if user.is_authenticated %}

Welcome {{ user.username }}! My Profile Sign out

	{% else %}

You are currently not logged in. Sign in.

	{% endif %}
{% endblock %}

{% block content %}{% endblock %}


text:
<?xml version="1.0" encoding="UTF-8"?>
<reference xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="refentry">
  <info>
    <title>Common » Refentry Metadata Template Reference</title>
    <releaseinfo role="meta">
    </releaseinfo>
  </info>

  <partintro xml:id="partintro">
    <title>Introduction</title>

<para>This is technical reference documentation for the "refentry
    metadata" templates in the DocBook XSL Stylesheets.</para>

<para>This is not intended to be user documentation. It is provided
    for developers writing customization layers for the stylesheets.</para>

    <note>

<para>Currently, only the manpages stylesheets make use of these
      templates. They are, however, potentially useful elsewhere.</para>

    </note>
  </partintro>

<refentry xml:id="template.get.refentry.metadata">
<refnamediv>
<refname>get.refentry.metadata</refname>
<refpurpose>Gathers metadata from a refentry and its ancestors</refpurpose>
</refnamediv>
<refsynopsisdiv>
<synopsis><xsl:template name="get.refentry.metadata">
<xsl:param name="refname"/>
<xsl:param name="info"/>
<xsl:param name="prefs"/>
  ...
</xsl:template></synopsis>
</refsynopsisdiv>
<refsect1><title>Description</title>

<para>Reference documentation for particular commands, functions,
    etc., is sometimes viewed in isolation from its greater "context". For
    example, users view Unix man pages as, well, individual pages, not as
    part of a "book" of some kind. Therefore, it is sometimes necessary to
    embed "context" information in output for each <tag>refentry</tag>.</para>

<para>However, one problem is that different users mark up that
    context information in different ways. Often (usually), the
    context information is not actually part of the content of the
    <tag>refentry</tag> itself, but instead part of the content of a
    parent or ancestor element to the <tag>refentry</tag>. And
    even then, DocBook provides a variety of elements that users might
    potentially use to mark up the same kind of information. One user
    might use the <tag>productnumber</tag> element to mark up version
    information about a particular product, while another might use
    the <tag>releaseinfo</tag> element.</para>

<para>Taking all that in mind, the
    <function>get.refentry.metadata</function> template tries to gather
    metadata from a <tag>refentry</tag> element and its ancestor
    elements in an intelligent and user-configurable way. The basic
    mechanism used in the XPath expressions throughout this stylesheet
    is to select the relevant metadata from the *info element that is
    closest to the actual <tag>refentry</tag> – either on the
    <tag>refentry</tag> itself, or on its nearest ancestor.</para>

    <note>

<para>The <function>get.refentry.metadata</function>
        template is actually just sort of a "driver" template; it
        calls other templates that do the actual data collection,
        then returns the data as a set.</para>

    </note>

  </refsect1><refsect1><title>Parameters</title>

<variablelist>
      <varlistentry>
        <term>refname</term>
        <listitem>

<para>The first <tag>refname</tag> in the refentry</para>

        </listitem>
      </varlistentry>
      <varlistentry>
        <term>info</term>
        <listitem>

<para>A set of info nodes (from a <tag>refentry</tag>
          element and its ancestors)</para>

        </listitem>
      </varlistentry>
      <varlistentry>
        <term>prefs</term>
        <listitem>

<para>A node containing user preferences (from global
          stylesheet parameters)</para>

        </listitem>
      </varlistentry>
    </variablelist>

  </refsect1><refsect1><title>Returns</title>

<para>Returns a node set with the following elements. The
    descriptions are verbatim from the <literal>man(7)</literal> man
    page.

<variablelist>
      <varlistentry>
        <term>title</term>
        <listitem>

<para>the title of the man page (e.g., <literal>MAN</literal>)</para>

        </listitem>
      </varlistentry>
      <varlistentry>
        <term>section</term>
        <listitem>

<para>the section number the man page should be placed in (e.g.,
          <literal>7</literal>)</para>

        </listitem>
      </varlistentry>
      <varlistentry>
        <term>date</term>
        <listitem>

<para>the date of the last revision</para>

        </listitem>
      </varlistentry>
      <varlistentry>
        <term>source</term>
        <listitem>

<para>the source of the command</para>

        </listitem>
      </varlistentry>
      <varlistentry>
        <term>manual</term>
        <listitem>

<para>the title of the manual (e.g., <citetitle>Linux
          Programmer's Manual</citetitle>)</para>

        </listitem>
      </varlistentry>
    </variablelist>

    </para>

  </refsect1></refentry>

<refentry xml:id="template.get.refentry.title">
<refnamediv>
<refname>get.refentry.title</refname>
<refpurpose>Gets title metadata for a refentry</refpurpose>
</refnamediv>
<refsynopsisdiv>
<synopsis><xsl:template name="get.refentry.title">
<xsl:param name="refname"/>
  ...
</xsl:template></synopsis>
</refsynopsisdiv>
<refsect1><title>Description</title>

<para>The <literal>man(7)</literal> man page describes this as "the
    title of the man page (e.g., <literal>MAN</literal>). This differs
    from <tag>refname</tag> in that, if the <tag>refentry</tag> has a
    <tag>refentrytitle</tag>, we use that as the <tag>title</tag>;
    otherwise, we just use first <tag>refname</tag> in the first
    <tag>refnamediv</tag> in the source.</para>

  </refsect1><refsect1><title>Parameters</title>

<variablelist>
      <varlistentry>
        <term>refname</term>
        <listitem>

<para>The first <tag>refname</tag> in the refentry</para>

        </listitem>
      </varlistentry>
    </variablelist>

  </refsect1><refsect1><title>Returns</title>

<para>Returns a <tag>title</tag> node.</para>
</refsect1></refentry>

<refentry xml:id="template.get.refentry.section">
<refnamediv>
<refname>get.refentry.section</refname>
<refpurpose>Gets section metadata for a refentry</refpurpose>
</refnamediv>
<refsynopsisdiv>
<synopsis><xsl:template name="get.refentry.section">
<xsl:param name="refname"/>
<xsl:param name="quiet" select="0"/>
  ...
</xsl:template></synopsis>
</refsynopsisdiv>
<refsect1><title>Description</title>

<para>The <literal>man(7)</literal> man page describes this as "the
    section number the man page should be placed in (e.g.,
    <literal>7</literal>)". If we do not find a <tag>manvolnum</tag>
    specified in the source, and we find that the <tag>refentry</tag> is
    for a function, we use the section number <literal>3</literal>
    ["Library calls (functions within program libraries)"]; otherwise, we
    default to using <literal>1</literal> ["Executable programs or shell
    commands"].</para>

  </refsect1><refsect1><title>Parameters</title>

<variablelist>
      <varlistentry>
        <term>refname</term>
        <listitem>

<para>The first <tag>refname</tag> in the refentry</para>

        </listitem>
      </varlistentry>
      <varlistentry>
        <term>quiet</term>
        <listitem>

<para>If non-zero, no "missing" message is emitted</para>

        </listitem>
      </varlistentry>
    </variablelist>

  </refsect1><refsect1><title>Returns</title>

<para>Returns a string representing a section number.</para>
</refsect1></refentry>

<refentry xml:id="template.get.refentry.date">
<refnamediv>
<refname>get.refentry.date</refname>
<refpurpose>Gets date metadata for a refentry</refpurpose>
</refnamediv>
<refsynopsisdiv>
<synopsis><xsl:template name="get.refentry.date">
<xsl:param name="refname"/>
<xsl:param name="info"/>
<xsl:param name="prefs"/>
  ...
</xsl:template></synopsis>
</refsynopsisdiv>
<refsect1><title>Description</title>

<para>The <literal>man(7)</literal> man page describes this as "the
    date of the last revision". If we cannot find a date in the source, we
    generate one.</para>

  </refsect1><refsect1><title>Parameters</title>

<variablelist>
      <varlistentry>
        <term>refname</term>
        <listitem>

<para>The first <tag>refname</tag> in the refentry</para>

        </listitem>
      </varlistentry>
      <varlistentry>
        <term>info</term>
        <listitem>

<para>A set of info nodes (from a <tag>refentry</tag>
          element and its ancestors)</para>

        </listitem>
      </varlistentry>
      <varlistentry>
        <term>prefs</term>
        <listitem>

<para>A node containing users preferences (from global stylesheet parameters)</para>

        </listitem>
      </varlistentry>
    </variablelist>

  </refsect1><refsect1><title>Returns</title>

<para>Returns a <tag>date</tag> node.</para>

  </refsect1></refentry>

<refentry xml:id="template.get.refentry.source">
<refnamediv>
<refname>get.refentry.source</refname>
<refpurpose>Gets source metadata for a refentry</refpurpose>
</refnamediv>
<refsynopsisdiv>
<synopsis><xsl:template name="get.refentry.source">
<xsl:param name="refname"/>
<xsl:param name="info"/>
<xsl:param name="prefs"/>
  ...
</xsl:template></synopsis>
</refsynopsisdiv>
<refsect1><title>Description</title>

<para>The <literal>man(7)</literal> man page describes this as "the
    source of the command", and provides the following examples:

<itemizedlist>
      <listitem>

<para>For binaries, use something like: GNU, NET-2, SLS
        Distribution, MCC Distribution.</para>

      </listitem>
      <listitem>

<para>For system calls, use the version of the kernel that you are
        currently looking at: Linux 0.99.11.</para>

      </listitem>
      <listitem>

<para>For library calls, use the source of the function: GNU, BSD
        4.3, Linux DLL 4.4.1.</para>

      </listitem>
    </itemizedlist>

    </para>

<para>The <literal>solbook(5)</literal> man page describes
    something very much like what <literal>man(7)</literal> calls
    "source", except that <literal>solbook(5)</literal> names it
    "software" and describes it like this:

<para>This is the name of the software product that the topic
      discussed on the reference page belongs to. For example UNIX
      commands are part of the <literal>SunOS x.x</literal>
      release.</para>

    </para>

<para>In practice, there are many pages that simply have a version
    number in the "source" field. So, it looks like what we have is a
    two-part field,
    <replaceable>Name</replaceable> <replaceable>Version</replaceable>,
    where:

<variablelist>
      <varlistentry>
        <term>Name</term>
        <listitem>

<para>product name (e.g., BSD) or org. name (e.g., GNU)</para>

        </listitem>
      </varlistentry>
      <varlistentry>
        <term>Version</term>
        <listitem>

<para>version name</para>

        </listitem>
      </varlistentry>
    </variablelist>

    Each part is optional. If the <replaceable>Name</replaceable> is a
    product name, then the <replaceable>Version</replaceable> is probably
    the version of the product. Or there may be no
    <replaceable>Name</replaceable>, in which case, if there is a
    <replaceable>Version</replaceable>, it is probably the version of the
    item itself, not the product it is part of. Or, if the
    <replaceable>Name</replaceable> is an organization name, then there
    probably will be no <replaceable>Version</replaceable>.
    </para>

  </refsect1><refsect1><title>Parameters</title>

<variablelist>
      <varlistentry>
        <term>refname</term>
        <listitem>

<para>The first <tag>refname</tag> in the refentry</para>

        </listitem>
      </varlistentry>
      <varlistentry>
        <term>info</term>
        <listitem>

<para>A set of info nodes (from a <tag>refentry</tag>
          element and its ancestors)</para>

        </listitem>
      </varlistentry>
      <varlistentry>
        <term>prefs</term>
        <listitem>

<para>A node containing users preferences (from global
          stylesheet parameters)</para>

        </listitem>
      </varlistentry>
    </variablelist>

  </refsect1><refsect1><title>Returns</title>

<para>Returns a <tag>source</tag> node.</para>

  </refsect1></refentry>

<refentry xml:id="template.get.refentry.source.name">
<refnamediv>
<refname>get.refentry.source.name</refname>
<refpurpose>Gets source-name metadata for a refentry</refpurpose>
</refnamediv>
<refsynopsisdiv>
<synopsis><xsl:template name="get.refentry.source.name">
<xsl:param name="refname"/>
<xsl:param name="info"/>
<xsl:param name="prefs"/>
  ...
</xsl:template></synopsis>
</refsynopsisdiv>
<refsect1><title>Description</title>

<para>A "source name" is one part of a (potentially) two-part
    <replaceable>Name</replaceable> <replaceable>Version</replaceable>
    source field. For more details, see the documentation for the
    <function>get.refentry.source</function> template.</para>

  </refsect1><refsect1><title>Parameters</title>

<variablelist>
      <varlistentry>
        <term>refname</term>
        <listitem>

<para>The first <tag>refname</tag> in the refentry</para>

        </listitem>
      </varlistentry>
      <varlistentry>
        <term>info</term>
        <listitem>

<para>A set of info nodes (from a <tag>refentry</tag>
          element and its ancestors)</para>

        </listitem>
      </varlistentry>
      <varlistentry>
        <term>prefs</term>
        <listitem>

<para>A node containing users preferences (from global
          stylesheet parameters)</para>

        </listitem>
      </varlistentry>
    </variablelist>

  </refsect1><refsect1><title>Returns</title>

<para>Depending on what output method is used for the
  current stylesheet, either returns a text node or possibly an element
  node, containing "source name" data.</para>

  </refsect1></refentry>

<refentry xml:id="template.get.refentry.version">
<refnamediv>
<refname>get.refentry.version</refname>
<refpurpose>Gets version metadata for a refentry</refpurpose>
</refnamediv>
<refsynopsisdiv>
<synopsis><xsl:template name="get.refentry.version">
<xsl:param name="refname"/>
<xsl:param name="info"/>
<xsl:param name="prefs"/>
  ...
</xsl:template></synopsis>
</refsynopsisdiv>
<refsect1><title>Description</title>

<para>A "version" is one part of a (potentially) two-part
    <replaceable>Name</replaceable> <replaceable>Version</replaceable>
    source field. For more details, see the documentation for the
    <function>get.refentry.source</function> template.</para>

  </refsect1><refsect1><title>Parameters</title>

<variablelist>
      <varlistentry>
        <term>refname</term>
        <listitem>

<para>The first <tag>refname</tag> in the refentry</para>

        </listitem>
      </varlistentry>
      <varlistentry>
        <term>info</term>
        <listitem>

<para>A set of info nodes (from a <tag>refentry</tag>
          element and its ancestors)</para>

        </listitem>
      </varlistentry>
      <varlistentry>
        <term>prefs</term>
        <listitem>

<para>A node containing users preferences (from global
          stylesheet parameters)</para>

        </listitem>
      </varlistentry>
    </variablelist>

  </refsect1><refsect1><title>Returns</title>

<para>Depending on what output method is used for the
  current stylesheet, either returns a text node or possibly an element
  node, containing "version" data.</para>

  </refsect1></refentry>

<refentry xml:id="template.get.refentry.manual">
<refnamediv>
<refname>get.refentry.manual</refname>
<refpurpose>Gets source metadata for a refentry</refpurpose>
</refnamediv>
<refsynopsisdiv>
<synopsis><xsl:template name="get.refentry.manual">
<xsl:param name="refname"/>
<xsl:param name="info"/>
<xsl:param name="prefs"/>
  ...
</xsl:template></synopsis>
</refsynopsisdiv>
<refsect1><title>Description</title>

<para>The <literal>man(7)</literal> man page describes this as "the
    title of the manual (e.g., <citetitle>Linux Programmer's
    Manual</citetitle>)". Here are some examples from existing man pages:

<itemizedlist>
      <listitem>

<para><citetitle>dpkg utilities</citetitle>
        (<command>dpkg-name</command>)</para>

      </listitem>
      <listitem>

<para><citetitle>User Contributed Perl Documentation</citetitle>
        (<command>GET</command>)</para>

      </listitem>
      <listitem>

<para><citetitle>GNU Development Tools</citetitle>
        (<command>ld</command>)</para>

      </listitem>
      <listitem>

<para><citetitle>Emperor Norton Utilities</citetitle>
        (<command>ddate</command>)</para>

      </listitem>
      <listitem>

<para><citetitle>Debian GNU/Linux manual</citetitle>
        (<command>faked</command>)</para>

      </listitem>
      <listitem>

<para><citetitle>GIMP Manual Pages</citetitle>
        (<command>gimp</command>)</para>

      </listitem>
      <listitem>

<para><citetitle>KDOC Documentation System</citetitle>
        (<command>qt2kdoc</command>)</para>

      </listitem>
    </itemizedlist>

    </para>

<para>The <literal>solbook(5)</literal> man page describes
    something very much like what <literal>man(7)</literal> calls
    "manual", except that <literal>solbook(5)</literal> names it
    "sectdesc" and describes it like this:

<para>This is the section title of the reference page; for
      example <literal>User Commands</literal>.</para>

    </para>

  </refsect1><refsect1><title>Parameters</title>

<variablelist>
      <varlistentry>
        <term>refname</term>
        <listitem>

<para>The first <tag>refname</tag> in the refentry</para>

        </listitem>
      </varlistentry>
      <varlistentry>
        <term>info</term>
        <listitem>

<para>A set of info nodes (from a <tag>refentry</tag>
          element and its ancestors)</para>

        </listitem>
      </varlistentry>
      <varlistentry>
        <term>prefs</term>
        <listitem>

<para>A node containing users preferences (from global
          stylesheet parameters)</para>

        </listitem>
      </varlistentry>
    </variablelist>

  </refsect1><refsect1><title>Returns</title>

<para>Returns a <tag>manual</tag> node.</para>

  </refsect1></refentry>

<refentry xml:id="template.get.refentry.metadata.prefs">
<refnamediv>
<refname>get.refentry.metadata.prefs</refname>
<refpurpose>Gets user preferences for refentry metadata gathering</refpurpose>
</refnamediv>
<refsynopsisdiv>
<synopsis><xsl:template name="get.refentry.metadata.prefs"/></synopsis>
</refsynopsisdiv>
<refsect1><title>Description</title>

<para>The DocBook XSL stylesheets include several user-configurable
    global stylesheet parameters for controlling <tag>refentry</tag>
    metadata gathering. Those parameters are not read directly by the
    other <tag>refentry</tag> metadata-gathering
    templates. Instead, they are read only by the
    <function>get.refentry.metadata.prefs</function> template,
    which assembles them into a structure that is then passed to
    the other <tag>refentry</tag> metadata-gathering
    templates.</para>

<para>So the, <function>get.refentry.metadata.prefs</function>
    template is the only interface to collecting stylesheet parameters for
    controlling <tag>refentry</tag> metadata gathering.</para>

  </refsect1><refsect1><title>Parameters</title>

<para>There are no local parameters for this template; however, it
    does rely on a number of global parameters.</para>

  </refsect1><refsect1><title>Returns</title>

<para>Returns a <tag>manual</tag> node.</para>

  </refsect1></refentry>

<refentry xml:id="template.set.refentry.metadata">
<refnamediv>
<refname>set.refentry.metadata</refname>
<refpurpose>Sets content of a refentry metadata item</refpurpose>
</refnamediv>
<refsynopsisdiv>
<synopsis><xsl:template name="set.refentry.metadata">
<xsl:param name="refname"/>
<xsl:param name="info"/>
<xsl:param name="contents"/>
<xsl:param name="context"/>
<xsl:param name="preferred"/>
  ...
</xsl:template></synopsis>
</refsynopsisdiv>
<refsect1><title>Description</title>

<para>The <function>set.refentry.metadata</function> template is
    called each time a suitable source element is found for a certain
    metadata field.</para>

  </refsect1><refsect1><title>Parameters</title>

<variablelist>
      <varlistentry>
        <term>refname</term>
        <listitem>

<para>The first <tag>refname</tag> in the refentry</para>

        </listitem>
      </varlistentry>
      <varlistentry>
        <term>info</term>
        <listitem>

<para>A single *info node that contains the selected source element.</para>

        </listitem>
      </varlistentry>
      <varlistentry>
        <term>contents</term>
        <listitem>

<para>A node containing the selected source element.</para>

        </listitem>
      </varlistentry>
      <varlistentry>
        <term>context</term>
        <listitem>

<para>A string describing the metadata context in which the
          <function>set.refentry.metadata</function> template was
          called: either "date", "source", "version", or "manual".</para>

        </listitem>
      </varlistentry>
    </variablelist>

  </refsect1><refsect1><title>Returns</title>

<para>Returns formatted contents of a selected source element.</para>
</refsect1></refentry>
</reference>


text:
Imports System.Composition
Imports System.Threading
Imports Microsoft.CodeAnalysis.Editing
Imports Microsoft.CodeAnalysis.Host.Mef
Imports Microsoft.CodeAnalysis.ReplacePropertyWithMethods
Imports Microsoft.CodeAnalysis.VisualBasic.Syntax

Namespace Microsoft.CodeAnalysis.VisualBasic.CodeRefactorings.ReplaceMethodWithProperty
    <ExportLanguageService(GetType(IReplacePropertyWithMethodsService), LanguageNames.VisualBasic), [Shared]>
    Friend Class VisualBasicReplacePropertyWithMethods
        Inherits AbstractReplacePropertyWithMethodsService(Of IdentifierNameSyntax, ExpressionSyntax, StatementSyntax)

        Public Overrides Function GetPropertyDeclaration(token As SyntaxToken) As SyntaxNode
            Dim containingProperty = token.Parent.FirstAncestorOrSelf(Of PropertyStatementSyntax)
            If containingProperty Is Nothing Then
                Return Nothing
            End If

            ' a parameterized property can be trivially converted to a method.
            If containingProperty.ParameterList IsNot Nothing Then
                Return Nothing
            End If

            Dim start = If(containingProperty.AttributeLists.Count > 0,
                containingProperty.AttributeLists.Last().GetLastToken().GetNextToken().SpanStart,
                 containingProperty.SpanStart)

            ' Offer this refactoring anywhere in the signature of the property.
            Dim position = token.SpanStart
            If position < start Then
                Return Nothing
            End If

            If containingProperty.HasReturnType() AndAlso
                position > containingProperty.GetReturnType().Span.End Then
                Return Nothing
            End If

            Return containingProperty
        End Function

        Public Overrides Function GetReplacementMembers(
                document As Document,
                [property] As IPropertySymbol,
                propertyDeclarationNode As SyntaxNode,
                propertyBackingField As IFieldSymbol,
                desiredGetMethodName As String,
                desiredSetMethodName As String,
                cancellationToken As CancellationToken) As IList(Of SyntaxNode)

            Dim propertyStatement = TryCast(propertyDeclarationNode, PropertyStatementSyntax)
            If propertyStatement Is Nothing Then
                Return SpecializedCollections.EmptyList(Of SyntaxNode)
            End If

            Return ConvertPropertyToMembers(
                SyntaxGenerator.GetGenerator(document), [property],
                propertyStatement, propertyBackingField,
                desiredGetMethodName, desiredSetMethodName,
                cancellationToken)
        End Function

        Private Function ConvertPropertyToMembers(
                generator As SyntaxGenerator,
                [property] As IPropertySymbol,
                propertyStatement As PropertyStatementSyntax,
                propertyBackingField As IFieldSymbol,
                desiredGetMethodName As String,
                desiredSetMethodName As String,
                cancellationToken As CancellationToken) As IList(Of SyntaxNode)

            Dim result = New List(Of SyntaxNode)()

            If propertyBackingField IsNot Nothing Then
                Dim initializer = propertyStatement.Initializer?.Value
                result.Add(generator.FieldDeclaration(propertyBackingField, initializer))
            End If

            Dim getMethod = [property].GetMethod
            If getMethod IsNot Nothing Then
                result.Add(GetGetMethod(
                    generator, propertyStatement, propertyBackingField,
                    getMethod, desiredGetMethodName, cancellationToken))
            End If

            Dim setMethod = [property].SetMethod
            If setMethod IsNot Nothing Then
                result.Add(GetSetMethod(
                    generator, propertyStatement, propertyBackingField,
                    setMethod, desiredSetMethodName, cancellationToken))
            End If

            Return result
        End Function

        Private Function GetGetMethod(
                generator As SyntaxGenerator,
                propertyStatement As PropertyStatementSyntax,
                propertyBackingField As IFieldSymbol,
                getMethod As IMethodSymbol,
                desiredGetMethodName As String,
                cancellationToken As CancellationToken) As SyntaxNode
            Dim statements = New List(Of SyntaxNode)()

            Dim getAccessorDeclaration = If(getMethod.DeclaringSyntaxReferences.Length = 0,
                Nothing,
                TryCast(getMethod.DeclaringSyntaxReferences(0).GetSyntax(cancellationToken), AccessorStatementSyntax))

            If TypeOf getAccessorDeclaration?.Parent Is AccessorBlockSyntax Then
                Dim block = DirectCast(getAccessorDeclaration.Parent, AccessorBlockSyntax)
                statements.AddRange(block.Statements)
            ElseIf propertyBackingField IsNot Nothing Then
                Dim fieldReference = GetFieldReference(generator, propertyBackingField)
                statements.Add(generator.ReturnStatement(fieldReference))
            End If

            Return generator.MethodDeclaration(getMethod, desiredGetMethodName, statements)
        End Function

        Private Function GetSetMethod(
                generator As SyntaxGenerator,
                propertyStatement As PropertyStatementSyntax,
                propertyBackingField As IFieldSymbol,
                setMethod As IMethodSymbol,
                desiredSetMethodName As String,
                cancellationToken As CancellationToken) As SyntaxNode
            Dim statements = New List(Of SyntaxNode)()

            Dim setAccessorDeclaration = If(setMethod.DeclaringSyntaxReferences.Length = 0,
                Nothing,
                TryCast(setMethod.DeclaringSyntaxReferences(0).GetSyntax(cancellationToken), AccessorStatementSyntax))

            If TypeOf setAccessorDeclaration?.Parent Is AccessorBlockSyntax Then
                Dim block = DirectCast(setAccessorDeclaration.Parent, AccessorBlockSyntax)
                statements.AddRange(block.Statements)
            ElseIf propertyBackingField IsNot Nothing Then
                Dim fieldReference = GetFieldReference(generator, propertyBackingField)
                statements.Add(generator.AssignmentStatement(
                    fieldReference, generator.IdentifierName(setMethod.Parameters(0).Name)))
            End If

            Return generator.MethodDeclaration(setMethod, desiredSetMethodName, statements)
        End Function

        Public Overrides Function GetPropertyNodeToReplace(propertyDeclaration As SyntaxNode) As SyntaxNode
            ' In VB we'll have the property statement.  If that is parented by a
            ' property block, we'll want to replace that instead.  Otherwise we
            ' just replace the property statement itself
            Return If(propertyDeclaration.IsParentKind(SyntaxKind.PropertyBlock),
                propertyDeclaration.Parent,
                propertyDeclaration)
        End Function

        Protected Overrides Function UnwrapCompoundAssignment(compoundAssignment As SyntaxNode, readExpression As ExpressionSyntax) As ExpressionSyntax
            Throw New InvalidOperationException("Compound assignments don't exist in VB")
        End Function
    End Class
End Namespace


text:
<?php

/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
	exit;
}

/**
* ucp_activate
* User activation
* @package ucp
*/
class ucp_activate
{
	var $u_action;

	function main($id, $mode)
	{
		global $config, $phpbb_root_path, $phpEx;
		global $db, $user, $auth, $template;

		$user_id = request_var('u', 0);
		$key = request_var('k', '');

		$sql = 'SELECT user_id, username, user_type, user_email, user_newpasswd, user_lang, user_notify_type, user_actkey, user_inactive_reason
			FROM ' . USERS_TABLE . "
			WHERE user_id = $user_id";
		$result = $db->sql_query($sql);
		$user_row = $db->sql_fetchrow($result);
		$db->sql_freeresult($result);

		if (!$user_row)
		{
			trigger_error('NO_USER');
		}

		if ($user_row['user_type'] <> USER_INACTIVE && !$user_row['user_newpasswd'])
		{
			meta_refresh(3, append_sid("{$phpbb_root_path}index.$phpEx"));
			trigger_error('ALREADY_ACTIVATED');
		}

		if ($user_row['user_inactive_reason'] == INACTIVE_MANUAL || $user_row['user_actkey'] !== $key)
		{
			trigger_error('WRONG_ACTIVATION');
		}

		// Do not allow activating by non administrators when admin activation is on
		// Only activation type the user should be able to do is INACTIVE_REMIND
		// or activate a new password which is not an activation state :@
		if (!$user_row['user_newpasswd'] && $user_row['user_inactive_reason'] != INACTIVE_REMIND && $config['require_activation'] == USER_ACTIVATION_ADMIN && !$auth->acl_get('a_user'))
		{
			if (!$user->data['is_registered'])
			{
				login_box('', $user->lang['NO_AUTH_OPERATION']);
			}
			trigger_error('NO_AUTH_OPERATION');
		}

		$update_password = ($user_row['user_newpasswd']) ? true : false;

		if ($update_password)
		{
			$sql_ary = array(
				'user_actkey'		=> '',
				'user_password'		=> $user_row['user_newpasswd'],
				'user_newpasswd'	=> '',
				'user_pass_convert'	=> 0,
				'user_login_attempts'	=> 0,
			);

			$sql = 'UPDATE ' . USERS_TABLE . '
				SET ' . $db->sql_build_array('UPDATE', $sql_ary) . '
				WHERE user_id = ' . $user_row['user_id'];
			$db->sql_query($sql);

			add_log('user', $user_row['user_id'], 'LOG_USER_NEW_PASSWORD', $user_row['username']);
		}

		if (!$update_password)
		{
			include_once($phpbb_root_path . 'includes/functions_user.' . $phpEx);

			user_active_flip('activate', $user_row['user_id']);

			$sql = 'UPDATE ' . USERS_TABLE . "
				SET user_actkey = ''
				WHERE user_id = {$user_row['user_id']}";
			$db->sql_query($sql);

			// Create the correct logs
			add_log('user', $user_row['user_id'], 'LOG_USER_ACTIVE_USER');
			if ($auth->acl_get('a_user'))
			{
				add_log('admin', 'LOG_USER_ACTIVE', $user_row['username']);
			}
		}

		if ($config['require_activation'] == USER_ACTIVATION_ADMIN && !$update_password)
		{
			include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx);

			$messenger = new messenger(false);

			$messenger->template('admin_welcome_activated', $user_row['user_lang']);

			$messenger->to($user_row['user_email'], $user_row['username']);

			$messenger->anti_abuse_headers($config, $user);

			$messenger->assign_vars(array(
				'USERNAME'	=> htmlspecialchars_decode($user_row['username']))
			);

			$messenger->send($user_row['user_notify_type']);

			$message = 'ACCOUNT_ACTIVE_ADMIN';
		}
		else
		{
			if (!$update_password)
			{
				$message = ($user_row['user_inactive_reason'] == INACTIVE_PROFILE) ? 'ACCOUNT_ACTIVE_PROFILE' : 'ACCOUNT_ACTIVE';
			}
			else
			{
				$message = 'PASSWORD_ACTIVATED';
			}
		}

		meta_refresh(3, append_sid("{$phpbb_root_path}index.$phpEx"));
		trigger_error($user->lang[$message]);
	}
}

?>


text:
<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class UserDepartment extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        //
        Schema::create('user_department', function (Blueprint $table) {
        $table->increments('id');
        $table->integer('user_id');
        $table->integer('department_id');
        $table->integer('division_id');
        });

    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        //
        Schema::drop('user_department');
        Schema::drop('user_department');
    }
}


text:
<?php

namespace Victoire\Bundle\SeoBundle\Entity;

use Doctrine\ORM\Mapping as ORM;

/**
 * Redirection.
 *
 * @ORM\Entity()
 */
class ErrorRedirection extends Redirection
{
    /**
     * @var HttpError
     *
     * @ORM\OneToOne(
     *     targetEntity="Victoire\Bundle\SeoBundle\Entity\HttpError",
     *     mappedBy="redirection"
     * )
     */
    private $error;

    /**
     * @return HttpError
     */
    public function getError()
    {
        return $this->error;
    }

    /**
     * @param HttpError $error
     *
     * @return Redirection
     */
    public function setError($error)
    {
        $this->error = $error;

        return $this;
    }

    /**
     * Simple proxy to Error's url.
     *
     * @return string
     */
    public function getUrl()
    {
        return $this->getError()->getUrl();
    }
}


text:
package io.github.gpein.magneto.interfaces.api.rest;

import io.github.gpein.magneto.domain.Collector;
import io.github.gpein.magneto.domain.CollectorRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Collection;

@RestController
@RequestMapping("/api/collectors")
public class CollectorsController {

    @Autowired
    private CollectorRepository collectorRepository;

    @GetMapping(produces = MediaType.APPLICATION_JSON_VALUE)
    public Collection<Collector> all() {
        return collectorRepository.all();
    }
}


text:
package com.msopentech.thali.utilities.webviewbridge;

/**
 * Defines the method called when a registered class is called from Javascript in a WebView.
 */
public abstract class BridgeHandler {
    protected String handlerName;

    public BridgeHandler(String name) {
        if (name == null || "".equals(name)) {
            throw new RuntimeException("Illegal name");
        }
        this.handlerName = name;
    }

    /**
     * If the registered object is sent a request then this method is called. The WebView will be blocked until
     * this method returns. So if any non-trivial work is to happen it's best to spawn it off on a separate thread
     * and return this thread immediately. The callback is asynchronous and multi-thread safe so you can send back
     * the response when it's ready without blocking anything.
     * @param jsonString Argument passed in from Javascript
     * @param bridgeCallBack If a callback was requested then a callback object will be sent, otherwise this will be NULL
     */
    public abstract void call(final String jsonString, final BridgeCallBack bridgeCallBack);

    /**
     * The name that the handler wants to be called in Javascript
     * @return
     */
    String getName() {
        return handlerName;
    }
}


text:
namespace Machete.HL7Schema.V26.Maps
{
    using V26;

    /// <summary>
    /// QSC (ComponentMap) - Query Selection Criteria
    /// </summary>
    public class QSCMap :
        HL7V26ComponentMap<QSC>
    {
        public QSCMap()
        {
            Value(x => x.SegmentFieldName, 0);
            Value(x => x.RelationalOperator, 1);
            Value(x => x.Value, 2);
            Value(x => x.RelationalConjunction, 3);
        }
    }
}


text:
package com.jeromecompsci.dgui;

import javax.swing.*;

/**
 * @author derek
 */
class Pane extends Widget {
    private JPanel panel;
    private SpringLayout layout;

    Pane(final Widget... widgets) {
        executeOnEDT(new Runnable() {
            @Override public void run() {
                panel = new JPanel();
                layout = new SpringLayout();
                panel.setLayout(layout);
                for (Widget w: widgets) {
                    panel.add(w.getInternal());
                }
            }
        });
    }

    @Override public JComponent getInternal() {
        return panel;
    }
}


text:
//=================================================================================================

//=================================================================================================

#ifndef _BLAZEMARK_SYSTEM_BLITZ_H_
#define _BLAZEMARK_SYSTEM_BLITZ_H_

//=================================================================================================
//
//  BLITZ CONFIGURATION
//
//=================================================================================================

//*************************************************************************************************
/*!\brief Compilation switch for the Blitz++ performance benchmarks.
//
// This compilation switch enables/disables the Blitz++ library performance benchmarks.
//
// Possible settings for the Blitz switch:
//  - Deactivated: \b 0
//  - Activated  : \b 1
//
// Note that changing this setting requires a recompilation of the Blaze benchmark suite. Also
// note that this switch is automatically set by the configuration script of the Blaze benchmark
// suite.
*/
#define BLAZEMARK_BLITZ_MODE 0
//*************************************************************************************************

#endif


text:
package hobbydev.teammanager.business.services;

import hobbydev.teammanager.business.exception.ResourceForbiddenOperationException;
import hobbydev.teammanager.business.exception.ResourceNotFoundException;
import hobbydev.teammanager.domain.accounts.Company;
import hobbydev.teammanager.domain.accounts.offices.Office;

import java.util.List;

public interface CompanyService {

	List<Company> listCompanies();
	Company getCompany(Long id) throws ResourceNotFoundException;

	Office addOffice(Office office) throws ResourceForbiddenOperationException, ResourceNotFoundException;
	Office updateOffice(Office office) throws ResourceForbiddenOperationException, ResourceNotFoundException;
	boolean deleteOffice(Office office) throws ResourceNotFoundException;
}


text:
package com.laytonsmith.abstraction.events;

import com.laytonsmith.abstraction.MCEntity;
import com.laytonsmith.abstraction.enums.MCEntityType;
import com.laytonsmith.core.events.BindableEvent;

/**
 *
 * @author EntityReborn
 */
public interface MCEntityTargetEvent extends BindableEvent {

    public MCEntity getTarget();

    public void setTarget(MCEntity target);

    public MCEntity getEntity();

    public MCEntityType getEntityType();

}


text:
namespace MongoRepository2.Tests
{
    using MongoDB.Driver;

    public class MongoDBRepositoryTests : AbstractRepositoryTests
    {
        public const string _mongourl = "mongodb://localhost/MongoRepositoryCoreTests";

        public MongoDBRepositoryTests()
        {
            this.DropDB();
        }

        public override void Dispose()
        {
            this.DropDB();
        }

        private void DropDB()
        {
            var url = new MongoUrl(_mongourl);
            var client = new MongoClient(url);
            client.DropDatabase(url.DatabaseName);
        }

        protected override IRepository<T> CreateRepository<T>()
        {
            var url = new MongoUrl(_mongourl);
            return new MongoRepository<T>(url);
        }

        protected override IRepository<T> CreateRepository<T>(string collectionName)
        {
            var url = new MongoUrl(_mongourl);
            return new MongoRepository<T>(url, collectionName);
        }

        protected override IRepository<T, K> CreateRepository<T, K>()
        {
            var url = new MongoUrl(_mongourl);
            return new MongoRepository<T, K>(url);
        }
    }

}


text:
/***************************************************************************

    Bally/Sente SAC-1 system

    driver by Aaron Giles

***************************************************************************/

#include "emu.h"
#include "cpu/m6809/m6809.h"
#include "includes/balsente.h"
#include "sound/cem3394.h"

#define LOG_CEM_WRITES		0

/* local prototypes */
static void poly17_init(running_machine &machine);
static void counter_set_out(running_machine &machine, int which, int gate);
static void update_grudge_steering(running_machine &machine);

/*************************************
 *
 *  Interrupt handling
 *
 *************************************/

static TIMER_CALLBACK( irq_off )
{
	cputag_set_input_line(machine, "maincpu", M6809_IRQ_LINE, CLEAR_LINE);
}

TIMER_DEVICE_CALLBACK( balsente_interrupt_timer )
{
	balsente_state *state = timer.machine().driver_data<balsente_state>();

	/* next interrupt after scanline 256 is scanline 64 */
	if (param == 256)
		state->m_scanline_timer->adjust(timer.machine().primary_screen->time_until_pos(64), 64);
	else
		state->m_scanline_timer->adjust(timer.machine().primary_screen->time_until_pos(param + 64), param + 64);

	/* IRQ starts on scanline 0, 64, 128, etc. */
	cputag_set_input_line(timer.machine(), "maincpu", M6809_IRQ_LINE, ASSERT_LINE);

	/* it will turn off on the next HBLANK */
	timer.machine().scheduler().timer_set(timer.machine().primary_screen->time_until_pos(param, BALSENTE_HBSTART), FUNC(irq_off));

	/* if this is Grudge Match, update the steering */
	if (state->m_grudge_steering_result & 0x80)
		update_grudge_steering(timer.machine());

	/* if we're a shooter, we do a little more work */
	if (state->m_shooter)
	{
		UINT8 tempx, tempy;

		/* we latch the beam values on the first interrupt after VBLANK */
		if (param == 64)
		{
			state->m_shooter_x = input_port_read(timer.machine(), "FAKEX");
			state->m_shooter_y = input_port_read(timer.machine(), "FAKEY");
		}

		/* which bits get returned depends on which scanline we're at */
		tempx = state->m_shooter_x << ((param - 64) / 64);
		tempy = state->m_shooter_y << ((param - 64) / 64);
		state->m_nstocker_bits = ((tempx >> 4) & 0x08) | ((tempx >> 1) & 0x04) |
								((tempy >> 6) & 0x02) | ((tempy >> 3) & 0x01);
	}
}

MACHINE_START( balsente )
{
	balsente_state *state = machine.driver_data<balsente_state>();
	int i;

	state->m_cem_device[0] = state->m_cem1;
	state->m_cem_device[1] = state->m_cem2;
	state->m_cem_device[2] = state->m_cem3;
	state->m_cem_device[3] = state->m_cem4;
	state->m_cem_device[4] = state->m_cem5;
	state->m_cem_device[5] = state->m_cem6;

	/* create the polynomial tables */
	poly17_init(machine);

	/* register for saving */
	for (i = 0; i < 3; i++)
	{
		state_save_register_item(machine, "8253counter", NULL, i, state->m_counter[i].timer_active);
		state_save_register_item(machine, "8253counter", NULL, i, state->m_counter[i].initial);
		state_save_register_item(machine, "8253counter", NULL, i, state->m_counter[i].count);
		state_save_register_item(machine, "8253counter", NULL, i, state->m_counter[i].gate);
		state_save_register_item(machine, "8253counter", NULL, i, state->m_counter[i].out);
		state_save_register_item(machine, "8253counter", NULL, i, state->m_counter[i].mode);
		state_save_register_item(machine, "8253counter", NULL, i, state->m_counter[i].readbyte);
		state_save_register_item(machine, "8253counter", NULL, i, state->m_counter[i].writebyte);
	}

	state->save_item(NAME(state->m_counter_control));
	state->save_item(NAME(state->m_counter_0_ff));
	state->save_item(NAME(state->m_counter_0_timer_active));

	state->save_item(NAME(state->m_analog_input_data));
	state->save_item(NAME(state->m_adc_value));

	state->save_item(NAME(state->m_dac_value));
	state->save_item(NAME(state->m_dac_register));
	state->save_item(NAME(state->m_chip_select));

	state->save_item(NAME(state->m_m6850_status));
	state->save_item(NAME(state->m_m6850_control));
	state->save_item(NAME(state->m_m6850_input));
	state->save_item(NAME(state->m_m6850_output));
	state->save_item(NAME(state->m_m6850_data_ready));

	state->save_item(NAME(state->m_m6850_sound_status));
	state->save_item(NAME(state->m_m6850_sound_control));
	state->save_item(NAME(state->m_m6850_sound_input));
	state->save_item(NAME(state->m_m6850_sound_output));

	state->save_item(NAME(state->m_noise_position));

	state->save_item(NAME(state->m_nstocker_bits));
	state->save_item(NAME(state->m_spiker_expand_color));
	state->save_item(NAME(state->m_spiker_expand_bgcolor));
	state->save_item(NAME(state->m_spiker_expand_bits));
	state->save_item(NAME(state->m_grudge_steering_result));
	state->save_item(NAME(state->m_grudge_last_steering));
}

MACHINE_RESET( balsente )
{
	address_space *space = machine.device("maincpu")->memory().space(AS_PROGRAM);
	balsente_state *state = machine.driver_data<balsente_state>();
	int numbanks;

	/* reset counters; counter 2's gate is tied high */
	memset(state->m_counter, 0, sizeof(state->m_counter));
	state->m_counter[1].timer = machine.device<timer_device>("8253_1_timer");
	state->m_counter[2].timer = machine.device<timer_device>("8253_2_timer");
	state->m_counter[2].gate = 1;

	/* reset the manual counter 0 clock */
	state->m_counter_control = 0x00;
	state->m_counter_0_ff = 0;
	state->m_counter_0_timer_active = 0;

	/* reset the ADC states */
	state->m_adc_value = 0;

	/* reset the CEM3394 I/O states */
	state->m_dac_value = 0;
	state->m_dac_register = 0;
	state->m_chip_select = 0x3f;

	/* reset game-specific states */
	state->m_grudge_steering_result = 0;

	/* reset the 6850 chips */
	balsente_m6850_w(space, 0, 3);
	balsente_m6850_sound_w(space, 0, 3);

	/* reset the noise generator */
	memset(state->m_noise_position, 0, sizeof(state->m_noise_position));

	/* point the banks to bank 0 */
	numbanks = (machine.region("maincpu")->bytes() > 0x40000) ? 16 : 8;
	memory_configure_bank(machine, "bank1", 0, numbanks, &machine.region("maincpu")->base()[0x10000], 0x6000);
	memory_configure_bank(machine, "bank2", 0, numbanks, &machine.region("maincpu")->base()[0x12000], 0x6000);
	memory_set_bank(space->machine(), "bank1", 0);
	memory_set_bank(space->machine(), "bank2", 0);
	machine.device("maincpu")->reset();

	/* start a timer to generate interrupts */
	state->m_scanline_timer->adjust(machine.primary_screen->time_until_pos(0));
}

/*************************************
 *
 *  MM5837 noise generator
 *
 *  NOTE: this is stolen straight from
 *          POKEY.c
 *
 *************************************/

static void poly17_init(running_machine &machine)
{
	balsente_state *state = machine.driver_data<balsente_state>();
	UINT32 i, x = 0;
	UINT8 *p, *r;

	/* allocate memory */
	p = state->m_poly17;
	r = state->m_rand17;

	/* generate the polynomial */
	for (i = 0; i < POLY17_SIZE; i++)
	{
        /* store new values */
		*p++ = x & 1;
		*r++ = x >> 3;

        /* calculate next bit */
		x = ((x << POLY17_SHL) + (x >> POLY17_SHR) + POLY17_ADD) & POLY17_SIZE;
	}
}

void balsente_noise_gen(device_t *device, int count, short *buffer)
{
	balsente_state *state = device->machine().driver_data<balsente_state>();
	int chip;
	UINT32 step, noise_counter;

	/* find the chip we are referring to */
	for (chip = 0; chip < ARRAY_LENGTH(state->m_cem_device); chip++)
		if (device == state->m_cem_device[chip])
			break;
	assert(chip < ARRAY_LENGTH(state->m_cem_device));

	/* noise generator runs at 100kHz */
	step = (100000 << 14) / CEM3394_SAMPLE_RATE;
	noise_counter = state->m_noise_position[chip];

	while (count--)
	{
		*buffer++ = state->m_poly17[(noise_counter >> 14) & POLY17_SIZE] << 12;
		noise_counter += step;
	}

	/* remember the noise position */
	state->m_noise_position[chip] = noise_counter;
}

/*************************************
 *
 *  Hardware random numbers
 *
 *************************************/

WRITE8_HANDLER( balsente_random_reset_w )
{
	/* reset random number generator */
}

READ8_HANDLER( balsente_random_num_r )
{
	balsente_state *state = space->machine().driver_data<balsente_state>();
	UINT32 cc;

	/* CPU runs at 1.25MHz, noise source at 100kHz --> multiply by 12.5 */
	cc = space->machine().firstcpu->total_cycles();

	/* 12.5 = 8 + 4 + 0.5 */
	cc = (cc << 3) + (cc << 2) + (cc >> 1);
	return state->m_rand17[cc & POLY17_SIZE];
}

/*************************************
 *
 *  ROM banking
 *
 *************************************/

WRITE8_HANDLER( balsente_rombank_select_w )
{
	/* the bank number comes from bits 4-6 */
	memory_set_bank(space->machine(), "bank1", (data >> 4) & 7);
	memory_set_bank(space->machine(), "bank2", (data >> 4) & 7);
}

WRITE8_HANDLER( balsente_rombank2_select_w )
{
	/* Night Stocker and Name that Tune only so far.... */
	int bank = data & 7;

	/* top bit controls which half of the ROMs to use (Name that Tune only) */
	if (space->machine().region("maincpu")->bytes() > 0x40000) bank |= (data >> 4) & 8;

	/* when they set the AB bank, it appears as though the CD bank is reset */
	if (data & 0x20)
	{
		memory_set_bank(space->machine(), "bank1", bank);
		memory_set_bank(space->machine(), "bank2", 6);
	}

	/* set both banks */
	else
	{
		memory_set_bank(space->machine(), "bank1", bank);
		memory_set_bank(space->machine(), "bank2", bank);
	}
}

/*************************************
 *
 *  Special outputs
 *
 *************************************/

WRITE8_HANDLER( balsente_misc_output_w )
{
	offset = (offset / 4) % 8;
	data >>= 7;

	/* these are generally used to control the various lamps */
	/* special case is offset 7, which recalls the NVRAM data */
	if (offset == 7)
	{
		logerror("nvrecall_w=%d\n", data);
	}
	else
	{
//      set_led_status(space->machine(), offset, data);
	}
}

/*************************************
 *
 *  6850 UART communications
 *
 *************************************/

static void m6850_update_io(running_machine &machine)
{
	balsente_state *state = machine.driver_data<balsente_state>();
	UINT8 new_state;

	/* sound -> main CPU communications */
	if (!(state->m_m6850_sound_status & 0x02))
	{
		/* set the overrun bit if the data in the destination hasn't been read yet */
		if (state->m_m6850_status & 0x01)
			state->m_m6850_status |= 0x20;

		/* copy the sound's output to our input */
		state->m_m6850_input = state->m_m6850_sound_output;

		/* set the receive register full bit */
		state->m_m6850_status |= 0x01;

		/* set the sound's trasmitter register empty bit */
		state->m_m6850_sound_status |= 0x02;
	}

	/* main -> sound CPU communications */
	if (state->m_m6850_data_ready)
	{
		/* set the overrun bit if the data in the destination hasn't been read yet */
		if (state->m_m6850_sound_status & 0x01)
			state->m_m6850_sound_status |= 0x20;

		/* copy the main CPU's output to our input */
		state->m_m6850_sound_input = state->m_m6850_output;

		/* set the receive register full bit */
		state->m_m6850_sound_status |= 0x01;

		/* set the main CPU's trasmitter register empty bit */
		state->m_m6850_status |= 0x02;
		state->m_m6850_data_ready = 0;
	}

	/* check for reset states */
	if ((state->m_m6850_control & 3) == 3)
	{
		state->m_m6850_status = 0x02;
		state->m_m6850_data_ready = 0;
	}
	if ((state->m_m6850_sound_control & 3) == 3)
		state->m_m6850_sound_status = 0x02;

	/* check for transmit/receive IRQs on the main CPU */
	new_state = 0;
	if ((state->m_m6850_control & 0x80) && (state->m_m6850_status & 0x21)) new_state = 1;
	if ((state->m_m6850_control & 0x60) == 0x20 && (state->m_m6850_status & 0x02)) new_state = 1;

	/* apply the change */
	if (new_state && !(state->m_m6850_status & 0x80))
	{
		cputag_set_input_line(machine, "maincpu", M6809_FIRQ_LINE, ASSERT_LINE);
		state->m_m6850_status |= 0x80;
	}
	else if (!new_state && (state->m_m6850_status & 0x80))
	{
		cputag_set_input_line(machine, "maincpu", M6809_FIRQ_LINE, CLEAR_LINE);
		state->m_m6850_status &= ~0x80;
	}

	/* check for transmit/receive IRQs on the sound CPU */
	new_state = 0;
	if ((state->m_m6850_sound_control & 0x80) && (state->m_m6850_sound_status & 0x21)) new_state = 1;
	if ((state->m_m6850_sound_control & 0x60) == 0x20 && (state->m_m6850_sound_status & 0x02)) new_state = 1;
	if (!(state->m_counter_control & 0x20)) new_state = 0;

	/* apply the change */
	if (new_state && !(state->m_m6850_sound_status & 0x80))
	{
		cputag_set_input_line(machine, "audiocpu", INPUT_LINE_NMI, ASSERT_LINE);
		state->m_m6850_sound_status |= 0x80;
	}
	else if (!new_state && (state->m_m6850_sound_status & 0x80))
	{
		cputag_set_input_line(machine, "audiocpu", INPUT_LINE_NMI, CLEAR_LINE);
		state->m_m6850_sound_status &= ~0x80;
	}
}

/*************************************
 *
 *  6850 UART (main CPU)
 *
 *************************************/

READ8_HANDLER( balsente_m6850_r )
{
	balsente_state *state = space->machine().driver_data<balsente_state>();
	int result;

	/* status register is at offset 0 */
	if (offset == 0)
	{
		result = state->m_m6850_status;
	}

	/* input register is at offset 1 */
	else
	{
		result = state->m_m6850_input;

		/* clear the overrun and receive buffer full bits */
		state->m_m6850_status &= ~0x21;
		m6850_update_io(space->machine());
	}

	return result;
}

static TIMER_CALLBACK( m6850_data_ready_callback )
{
	balsente_state *state = machine.driver_data<balsente_state>();

	/* set the output data byte and indicate that we're ready to go */
	state->m_m6850_output = param;
	state->m_m6850_data_ready = 1;
	m6850_update_io(machine);
}

static TIMER_CALLBACK( m6850_w_callback )
{
	balsente_state *state = machine.driver_data<balsente_state>();

	/* indicate that the transmit buffer is no longer empty and update the I/O state */
	state->m_m6850_status &= ~0x02;
	m6850_update_io(machine);

	/* set a timer for 500usec later to actually transmit the data */
	/* (this is very important for several games, esp Snacks'n Jaxson) */
	machine.scheduler().timer_set(attotime::from_usec(500), FUNC(m6850_data_ready_callback), param);
}

WRITE8_HANDLER( balsente_m6850_w )
{
	balsente_state *state = space->machine().driver_data<balsente_state>();

	/* control register is at offset 0 */
	if (offset == 0)
	{
		state->m_m6850_control = data;

		/* re-update since interrupt enables could have been modified */
		m6850_update_io(space->machine());
	}

	/* output register is at offset 1; set a timer to synchronize the CPUs */
	else
		space->machine().scheduler().synchronize(FUNC(m6850_w_callback), data);
}

/*************************************
 *
 *  6850 UART (sound CPU)
 *
 *************************************/

READ8_HANDLER( balsente_m6850_sound_r )
{
	balsente_state *state = space->machine().driver_data<balsente_state>();
	int result;

	/* status register is at offset 0 */
	if (offset == 0)
	{
		result = state->m_m6850_sound_status;
	}

	/* input register is at offset 1 */
	else
	{
		result = state->m_m6850_sound_input;

		/* clear the overrun and receive buffer full bits */
		state->m_m6850_sound_status &= ~0x21;
		m6850_update_io(space->machine());
	}

	return result;
}

WRITE8_HANDLER( balsente_m6850_sound_w )
{
	balsente_state *state = space->machine().driver_data<balsente_state>();

	/* control register is at offset 0 */
	if (offset == 0)
		state->m_m6850_sound_control = data;

	/* output register is at offset 1 */
	else
	{
		state->m_m6850_sound_output = data;
		state->m_m6850_sound_status &= ~0x02;
	}

	/* re-update since interrupt enables could have been modified */
	m6850_update_io(space->machine());
}

/*************************************
 *
 *  ADC handlers
 *
 *************************************/

INTERRUPT_GEN( balsente_update_analog_inputs )
{
	balsente_state *state = device->machine().driver_data<balsente_state>();
	int i;
	static const char *const analog[] = { "AN0", "AN1", "AN2", "AN3" };

	/* the analog input system helpfully scales the value read by the percentage of time */
	/* into the current frame we are; unfortunately, this is bad for us, since the analog */
	/* ports are read once a frame, just at varying intervals. To get around this, we */
	/* read all the analog inputs at VBLANK time and just return the cached values. */
	for (i = 0; i < 4; i++)
		state->m_analog_input_data[i] = input_port_read(device->machine(), analog[i]);
}

static TIMER_CALLBACK( adc_finished )
{
	balsente_state *state = machine.driver_data<balsente_state>();
	int which = param;

	/* analog controls are read in two pieces; the lower port returns the sign */
	/* and the upper port returns the absolute value of the magnitude */
	int val = state->m_analog_input_data[which / 2] << state->m_adc_shift;

	/* special case for Stompin'/Shrike Avenger */
	if (state->m_adc_shift == 32)
	{
		state->m_adc_value = state->m_analog_input_data[which];
		return;
	}

	/* push everything out a little bit extra; most games seem to have a dead */
	/* zone in the middle that feels unnatural with the mouse */
	if (val < 0) val -= 8;
	else if (val > 0) val += 8;

	/* clip to 0xff maximum magnitude */
	if (val < -0xff) val = -0xff;
	else if (val > 0xff) val = 0xff;

	/* return the sign */
	if (!(which & 1))
		state->m_adc_value = (val < 0) ? 0xff : 0x00;

	/* return the magnitude */
	else
		state->m_adc_value = (val < 0) ? -val : val;
}

READ8_HANDLER( balsente_adc_data_r )
{
	balsente_state *state = space->machine().driver_data<balsente_state>();

	/* just return the last value read */
	return state->m_adc_value;
}

WRITE8_HANDLER( balsente_adc_select_w )
{
	/* set a timer to go off and read the value after 50us */
	/* it's important that we do this for Mini Golf */
logerror("adc_select %d\n", offset & 7);
	space->machine().scheduler().timer_set(attotime::from_usec(50), FUNC(adc_finished), offset & 7);
}

/*************************************
 *
 *  8253-5 timer utilities
 *
 *  NOTE: this is far from complete!
 *
 *************************************/

INLINE void counter_start(balsente_state *state, int which)
{
	/* don't start a timer for channel 0; it is clocked manually */
	if (which != 0)
	{
		/* only start a timer if we're gated and there is none already */
		if (state->m_counter[which].gate && !state->m_counter[which].timer_active)
		{
			state->m_counter[which].timer_active = 1;
			state->m_counter[which].timer->adjust(attotime::from_hz(2000000) * state->m_counter[which].count, which);
		}
	}
}

INLINE void counter_stop(balsente_state *state, int which)
{
	/* only stop the timer if it exists */
	if (state->m_counter[which].timer_active)
		state->m_counter[which].timer->reset();
	state->m_counter[which].timer_active = 0;
}

INLINE void counter_update_count(balsente_state *state, int which)
{
	/* only update if the timer is running */
	if (state->m_counter[which].timer_active)
	{
		/* determine how many 2MHz cycles are remaining */
		int count = (state->m_counter[which].timer->time_left() * 2000000).as_double();
		state->m_counter[which].count = (count < 0) ? 0 : count;
	}
}

/*************************************
 *
 *  8253-5 timer internals
 *
 *  NOTE: this is far from complete!
 *
 *************************************/

static void counter_set_gate(running_machine &machine, int which, int gate)
{
	balsente_state *state = machine.driver_data<balsente_state>();
	int oldgate = state->m_counter[which].gate;

	/* remember the gate state */
	state->m_counter[which].gate = gate;

	/* if the counter is being halted, update the count and remove the system timer */
	if (!gate && oldgate)
	{
		counter_update_count(state, which);
		counter_stop(state, which);
	}

	/* if the counter is being started, create the timer */
	else if (gate && !oldgate)
	{
		/* mode 1 waits for the gate to trigger the counter */
		if (state->m_counter[which].mode == 1)
		{
			counter_set_out(machine, which, 0);

			/* add one to the count; technically, OUT goes low on the next clock pulse */
			/* and then starts counting down; it's important that we don't count the first one */
			state->m_counter[which].count = state->m_counter[which].initial + 1;
		}

		/* start the counter */
		counter_start(state, which);
	}
}

static void counter_set_out(running_machine &machine, int which, int out)
{
	balsente_state *state = machine.driver_data<balsente_state>();

	/* OUT on counter 2 is hooked to the /INT line on the Z80 */
	if (which == 2)
		cputag_set_input_line(machine, "audiocpu", 0, out ? ASSERT_LINE : CLEAR_LINE);

	/* OUT on counter 0 is hooked to the GATE line on counter 1 */
	else if (which == 0)
		counter_set_gate(machine, 1, !out);

	/* remember the out state */
	state->m_counter[which].out = out;
}

TIMER_DEVICE_CALLBACK( balsente_counter_callback )
{
	balsente_state *state = timer.machine().driver_data<balsente_state>();

	/* reset the counter and the count */
	state->m_counter[param].timer_active = 0;
	state->m_counter[param].count = 0;

	/* set the state of the OUT line */
	/* mode 0 and 1: when firing, transition OUT to high */
	if (state->m_counter[param].mode == 0 || state->m_counter[param].mode == 1)
		counter_set_out(timer.machine(), param, 1);

	/* no other modes handled currently */
}

/*************************************
 *
 *  8253-5 timer handlers
 *
 *  NOTE: this is far from complete!
 *
 *************************************/

READ8_HANDLER( balsente_counter_8253_r )
{
	balsente_state *state = space->machine().driver_data<balsente_state>();
	int which;

	switch (offset & 3)
	{
		case 0:
		case 1:
		case 2:
			/* warning: assumes LSB/MSB addressing and no latching! */
			which = offset & 3;

			/* update the count */
			counter_update_count(state, which);

			/* return the LSB */
			if (state->m_counter[which].readbyte == 0)
			{
				state->m_counter[which].readbyte = 1;
				return state->m_counter[which].count & 0xff;
			}

			/* write the MSB and reset the counter */
			else
			{
				state->m_counter[which].readbyte = 0;
				return (state->m_counter[which].count >> 8) & 0xff;
			}
			break;
	}
	return 0;
}

WRITE8_HANDLER( balsente_counter_8253_w )
{
	balsente_state *state = space->machine().driver_data<balsente_state>();
	int which;

	switch (offset & 3)
	{
		case 0:
		case 1:
		case 2:
			/* warning: assumes LSB/MSB addressing and no latching! */
			which = offset & 3;

			/* if the counter is in mode 0, a write here will reset the OUT state */
			if (state->m_counter[which].mode == 0)
				counter_set_out(space->machine(), which, 0);

			/* write the LSB */
			if (state->m_counter[which].writebyte == 0)
			{
				state->m_counter[which].count = (state->m_counter[which].count & 0xff00) | (data & 0x00ff);
				state->m_counter[which].initial = (state->m_counter[which].initial & 0xff00) | (data & 0x00ff);
				state->m_counter[which].writebyte = 1;
			}

			/* write the MSB and reset the counter */
			else
			{
				state->m_counter[which].count = (state->m_counter[which].count & 0x00ff) | ((data << 8) & 0xff00);
				state->m_counter[which].initial = (state->m_counter[which].initial & 0x00ff) | ((data << 8) & 0xff00);
				state->m_counter[which].writebyte = 0;

				/* treat 0 as $10000 */
				if (state->m_counter[which].count == 0) state->m_counter[which].count = state->m_counter[which].initial = 0x10000;

				/* remove any old timer and set a new one */
				counter_stop(state, which);

				/* note that in mode 1, we have to wait for a rising edge of a gate */
				if (state->m_counter[which].mode == 0)
					counter_start(state, which);

				/* if the counter is in mode 1, a write here will set the OUT state */
				if (state->m_counter[which].mode == 1)
					counter_set_out(space->machine(), which, 1);
			}
			break;

		case 3:
			/* determine which counter */
			which = data >> 6;
			if (which == 3) break;

			/* if the counter was in mode 0, a write here will reset the OUT state */
			if (((state->m_counter[which].mode >> 1) & 7) == 0)
				counter_set_out(space->machine(), which, 0);

			/* set the mode */
			state->m_counter[which].mode = (data >> 1) & 7;

			/* if the counter is in mode 0, a write here will reset the OUT state */
			if (state->m_counter[which].mode == 0)
				counter_set_out(space->machine(), which, 0);
			break;
	}
}

/*************************************
 *
 *  Sound CPU counter 0 emulation
 *
 *************************************/

static void set_counter_0_ff(timer_device &timer, int newstate)
{
	balsente_state *state = timer.machine().driver_data<balsente_state>();

	/* the flip/flop output is inverted, so if we went high to low, that's a clock */
	if (state->m_counter_0_ff && !newstate)
	{
		/* only count if gated and non-zero */
		if (state->m_counter[0].count > 0 && state->m_counter[0].gate)
		{
			state->m_counter[0].count--;
			if (state->m_counter[0].count == 0)
				balsente_counter_callback(timer, NULL, 0);
		}
	}

	/* remember the new state */
	state->m_counter_0_ff = newstate;
}

TIMER_DEVICE_CALLBACK( balsente_clock_counter_0_ff )
{
	balsente_state *state = timer.machine().driver_data<balsente_state>();

	/* clock the D value through the flip-flop */
	set_counter_0_ff(timer, (state->m_counter_control >> 3) & 1);
}

static void update_counter_0_timer(balsente_state *state)
{
	double maxfreq = 0.0;
	int i;

	/* if there's already a timer, remove it */
	if (state->m_counter_0_timer_active)
		state->m_counter_0_timer->reset();
	state->m_counter_0_timer_active = 0;

	/* find the counter with the maximum frequency */
	/* this is used to calibrate the timers at startup */
	for (i = 0; i < 6; i++)
		if (cem3394_get_parameter(state->m_cem_device[i], CEM3394_FINAL_GAIN) < 10.0)
		{
			double tempfreq;

			/* if the filter resonance is high, then they're calibrating the filter frequency */
			if (cem3394_get_parameter(state->m_cem_device[i], CEM3394_FILTER_RESONANCE) > 0.9)
				tempfreq = cem3394_get_parameter(state->m_cem_device[i], CEM3394_FILTER_FREQENCY);

			/* otherwise, they're calibrating the VCO frequency */
			else
				tempfreq = cem3394_get_parameter(state->m_cem_device[i], CEM3394_VCO_FREQUENCY);

			if (tempfreq > maxfreq) maxfreq = tempfreq;
		}

	/* reprime the timer */
	if (maxfreq > 0.0)
	{
		state->m_counter_0_timer_active = 1;
		state->m_counter_0_timer->adjust(attotime::from_hz(maxfreq), 0, attotime::from_hz(maxfreq));
	}
}

/*************************************
 *
 *  Sound CPU counter handlers
 *
 *************************************/

READ8_HANDLER( balsente_counter_state_r )
{
	balsente_state *state = space->machine().driver_data<balsente_state>();

	/* bit D0 is the inverse of the flip-flop state */
	int result = !state->m_counter_0_ff;

	/* bit D1 is the OUT value from counter 0 */
	if (state->m_counter[0].out) result |= 0x02;

	return result;
}

WRITE8_HANDLER( balsente_counter_control_w )
{
	balsente_state *state = space->machine().driver_data<balsente_state>();
	UINT8 diff_counter_control = state->m_counter_control ^ data;

	/* set the new global value */
	state->m_counter_control = data;

	/* bit D0 enables/disables audio */
	if (diff_counter_control & 0x01)
	{
		int ch;
		for (ch = 0; ch < 6; ch++)
			state->m_cem_device[ch]->set_output_gain(0, (data & 0x01) ? 1.0 : 0);
	}

	/* bit D1 is hooked to counter 0's gate */
	/* if we gate on, start a pulsing timer to clock it */
	if (!state->m_counter[0].gate && (data & 0x02) && !state->m_counter_0_timer_active)
	{
		update_counter_0_timer(state);
	}

	/* if we gate off, remove the timer */
	else if (state->m_counter[0].gate && !(data & 0x02) && state->m_counter_0_timer_active)
	{
		state->m_counter_0_timer->reset();
		state->m_counter_0_timer_active = 0;
	}

	/* set the actual gate afterwards, since we need to know the old value above */
	counter_set_gate(space->machine(), 0, (data >> 1) & 1);

	/* bits D2 and D4 control the clear/reset flags on the flip-flop that feeds counter 0 */
	if (!(data & 0x04)) set_counter_0_ff(*state->m_counter_0_timer, 1);
	if (!(data & 0x10)) set_counter_0_ff(*state->m_counter_0_timer, 0);

	/* bit 5 clears the NMI interrupt; recompute the I/O state now */
	m6850_update_io(space->machine());
}

/*************************************
 *
 *  CEM3394 Interfaces
 *
 *************************************/

WRITE8_HANDLER( balsente_chip_select_w )
{
	static const UINT8 register_map[8] =
	{
		CEM3394_VCO_FREQUENCY,
		CEM3394_FINAL_GAIN,
		CEM3394_FILTER_RESONANCE,
		CEM3394_FILTER_FREQENCY,
		CEM3394_MIXER_BALANCE,
		CEM3394_MODULATION_AMOUNT,
		CEM3394_PULSE_WIDTH,
		CEM3394_WAVE_SELECT
	};

	balsente_state *state = space->machine().driver_data<balsente_state>();
	double voltage = (double)state->m_dac_value * (8.0 / 4096.0) - 4.0;
	int diffchip = data ^ state->m_chip_select, i;
	int reg = register_map[state->m_dac_register];

	/* remember the new select value */
	state->m_chip_select = data;

	/* check all six chip enables */
	for (i = 0; i < 6; i++)
		if ((diffchip & (1 << i)) && (data & (1 << i)))
		{
#if LOG_CEM_WRITES
			double temp = 0;

			/* remember the previous value */
			temp =
#endif
				cem3394_get_parameter(state->m_cem_device[i], reg);

			/* set the voltage */
			cem3394_set_voltage(state->m_cem_device[i], reg, voltage);

			/* only log changes */
#if LOG_CEM_WRITES
			if (temp != cem3394_get_parameter(state->m_cem_device[i], reg))
			{
				static const char *const names[] =
				{
					"VCO_FREQUENCY",
					"FINAL_GAIN",
					"FILTER_RESONANCE",
					"FILTER_FREQENCY",
					"MIXER_BALANCE",
					"MODULATION_AMOUNT",
					"PULSE_WIDTH",
					"WAVE_SELECT"
				};
				logerror("s%04X:   CEM#%d:%s=%f\n", cpu_get_previouspc(&space->device()), i, names[state->m_dac_register], voltage);
			}
#endif
		}

	/* if a timer for counter 0 is running, recompute */
	if (state->m_counter_0_timer_active)
		update_counter_0_timer(state);
}

WRITE8_HANDLER( balsente_dac_data_w )
{
	balsente_state *state = space->machine().driver_data<balsente_state>();

	/* LSB or MSB? */
	if (offset & 1)
		state->m_dac_value = (state->m_dac_value & 0xfc0) | ((data >> 2) & 0x03f);
	else
		state->m_dac_value = (state->m_dac_value & 0x03f) | ((data << 6) & 0xfc0);

	/* if there are open channels, force the values in */
	if ((state->m_chip_select & 0x3f) != 0x3f)
	{
		UINT8 temp = state->m_chip_select;
		balsente_chip_select_w(space, 0, 0x3f);
		balsente_chip_select_w(space, 0, temp);
	}
}

WRITE8_HANDLER( balsente_register_addr_w )
{
	balsente_state *state = space->machine().driver_data<balsente_state>();
	state->m_dac_register = data & 7;
}

/*************************************
 *
 *  Game-specific handlers
 *
 *************************************/

CUSTOM_INPUT( nstocker_bits_r )
{
	balsente_state *state = field.machine().driver_data<balsente_state>();
	return state->m_nstocker_bits;
}

WRITE8_HANDLER( spiker_expand_w )
{
	balsente_state *state = space->machine().driver_data<balsente_state>();

	/* offset 0 is the bit pattern */
	if (offset == 0)
		state->m_spiker_expand_bits = data;

	/* offset 1 is the background color (cleared on each read) */
	else if (offset == 1)
		state->m_spiker_expand_bgcolor = data;

	/* offset 2 is the color */
	else if (offset == 2)
		state->m_spiker_expand_color = data;
}

READ8_HANDLER( spiker_expand_r )
{
	balsente_state *state = space->machine().driver_data<balsente_state>();
	UINT8 left, right;

	/* first rotate each nibble */
	state->m_spiker_expand_bits = ((state->m_spiker_expand_bits << 1) & 0xee) | ((state->m_spiker_expand_bits >> 3) & 0x11);

	/* compute left and right pixels */
	left  = (state->m_spiker_expand_bits & 0x10) ? state->m_spiker_expand_color : state->m_spiker_expand_bgcolor;
	right = (state->m_spiker_expand_bits & 0x01) ? state->m_spiker_expand_color : state->m_spiker_expand_bgcolor;

	/* reset the background color */
	state->m_spiker_expand_bgcolor = 0;

	/* return the combined result */
	return (left & 0xf0) | (right & 0x0f);
}

static void update_grudge_steering(running_machine &machine)
{
	balsente_state *state = machine.driver_data<balsente_state>();
	UINT8 wheel[3];
	INT8 diff[3];

	/* read the current steering values */
	wheel[0] = input_port_read(machine, "AN0");
	wheel[1] = input_port_read(machine, "AN1");
	wheel[2] = input_port_read(machine, "AN2");

	/* diff the values */
	diff[0] = wheel[0] - state->m_grudge_last_steering[0];
	diff[1] = wheel[1] - state->m_grudge_last_steering[1];
	diff[2] = wheel[2] - state->m_grudge_last_steering[2];

	/* update the last values */
	state->m_grudge_last_steering[0] += diff[0];
	state->m_grudge_last_steering[1] += diff[1];
	state->m_grudge_last_steering[2] += diff[2];

	/* compute the result */
	state->m_grudge_steering_result = 0xff;
	if (diff[0])
	{
		state->m_grudge_steering_result ^= 0x01;
		if (diff[0] > 0) state->m_grudge_steering_result ^= 0x02;
	}
	if (diff[1])
	{
		state->m_grudge_steering_result ^= 0x04;
		if (diff[1] > 0) state->m_grudge_steering_result ^= 0x08;
	}
	if (diff[2])
	{
		state->m_grudge_steering_result ^= 0x10;
		if (diff[2] > 0) state->m_grudge_steering_result ^= 0x20;
	}
	logerror("Recomputed steering\n");
}

READ8_HANDLER( grudge_steering_r )
{
	balsente_state *state = space->machine().driver_data<balsente_state>();
	logerror("%04X:grudge_steering_r(@%d)\n", cpu_get_pc(&space->device()), space->machine().primary_screen->vpos());
	state->m_grudge_steering_result |= 0x80;
	return state->m_grudge_steering_result;
}

/*************************************
 *
 *  Shrike Avenger CPU memory handlers
 *
 *************************************/

READ8_HANDLER( shrike_shared_6809_r )
{
	balsente_state *state = space->machine().driver_data<balsente_state>();
	UINT16 mem_mask = offset & 1 ? 0xff00 : 0x00ff;

	switch( offset )
	{
		case 6: // return OK for 68k status register until motors hooked up
			return 0;
		default:
			return ( state->m_shrike_shared[offset >> 1] & ~mem_mask ) >> ( mem_mask & 8 );
	}
}

WRITE8_HANDLER( shrike_shared_6809_w )
{
	balsente_state *state = space->machine().driver_data<balsente_state>();
	UINT16 mem_mask = offset & 1 ? 0xff00 : 0x00ff;
	state->m_shrike_shared[offset >> 1] = ( state->m_shrike_shared[offset >> 1] & mem_mask ) | ( data << ( mem_mask & 0x8 ) );
}

// uses movep, so writes even 8 bit addresses to odd 16 bit addresses, reads as 16 bit from odd addresses
// i.e. write 0xdeadbeef to 10000, read 0xde from 10001, 0xad from 10003, 0xbe from 10005...
WRITE16_HANDLER( shrike_io_68k_w )
{
	balsente_state *state = space->machine().driver_data<balsente_state>();
	COMBINE_DATA( &state->m_shrike_io[offset] );
}

READ16_HANDLER( shrike_io_68k_r )
{
	balsente_state *state = space->machine().driver_data<balsente_state>();
	return ( state->m_shrike_io[offset] & mem_mask ) >> ( 8 & ~mem_mask );
}


text:
import { WidgetFactory } from "./widgets/widgetfactory";
import { Element } from "./api/element";
import { WidgetRender } from "./common/widgetrender";
import { injectable, inject } from "inversify";
import { Layout, Setup } from "./api/dashboard";

@injectable()
export class DockerDashboard {
	private widgetFactory: WidgetFactory;
	private layout: Setup;

	constructor(@inject("Setup") layout: Setup, @inject("WidgetFactory") widgetFactory: WidgetFactory) {
		this.layout = layout;
		this.widgetFactory = widgetFactory;
	}

	public startup() {
		this.layout.setMenu(this.widgetFactory.getCommands());
		this.layout.asDefault(this.widgetFactory.getDefault());
		this.layout.render();
	}
}

@injectable()
export class BoardLayout implements Layout, Setup {
	private screen: any;
	private box: any;
	private activeElement: Element;
	constructor() {
		this.screen = WidgetRender.screen("🐳 Docker Dashboard");
		this.screen.key(["q"], () => {
			return process.exit(0);
		});
		this.box = WidgetRender.box(this.screen);
	}

	setMenu(commands: { [key: string]: any }): void {
		WidgetRender.menuBar(this.screen, commands);
	}

	asDefault(element: Element) {
		this.activeElement = element;
		this.activeElement.render();
	}

	active(element: Element) {
		this.activeElement.hide();
		this.activeElement = element;
		this.activeElement.show();
		this.screen.render();
	}

	getBox(): any {
		return this.box;
	}

	getScreen(): any {
		return this.screen;
	}

	render() {
		this.screen.render();
	}

	onResize(callback: Function) {
		this.screen.on('resize', () => {
			callback();
		});
	}

}


text:
package com.navercorp.pinpoint.common.plugin;

import com.navercorp.pinpoint.common.util.Assert;

import java.io.File;
import java.io.IOException;
import java.net.URL;
import java.security.CodeSource;
import java.security.ProtectionDomain;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.ServiceLoader;
import java.util.jar.JarFile;

/**
 * @author Woonduk Kang(emeroad)
 */
public class ServerPluginLoader implements PluginLoader {

    private final ClassLoader classLoader;

    public ServerPluginLoader(ClassLoader classLoader) {
        this.classLoader = Assert.requireNonNull(classLoader, "classLoader must not be null");
    }

    @Override
    public <T> List<Plugin<T>> load(Class<T> serviceType) {
        Assert.requireNonNull(serviceType, "serviceType must not be null");

        List<Plugin<T>> pluginList = new ArrayList<Plugin<T>>();
        ServiceLoader<T> serviceLoader = ServiceLoader.load(serviceType, classLoader);

        for (T plugin : serviceLoader) {
            Plugin<T> simple = newPlugin(plugin);
            pluginList.add(simple);
        }

        return pluginList;
    }

    private <T> Plugin<T> newPlugin(T plugin) {
        URL pluginURL = getPluginUrl(plugin);

        final File file = new File(pluginURL.getPath());
        if (file.isDirectory()) {
            return new DirClassPathPlugin<T>(pluginURL, Collections.singletonList(plugin), Collections.<String>emptyList());
        }

        if (file.getName().endsWith(".jar")) {
            JarFile jarFile = toJarFile(file);
            return new JarPlugin<T>(pluginURL, jarFile, Collections.singletonList(plugin), Collections.<String>emptyList());
        }
        throw new IllegalArgumentException("unknown plugin " + pluginURL);
    }

    private <T> URL getPluginUrl(T plugin) {
        ProtectionDomain protectionDomain = plugin.getClass().getProtectionDomain();
        CodeSource codeSource = protectionDomain.getCodeSource();
        return codeSource.getLocation();
    }

    private JarFile toJarFile(File file) {
        try {
            return new JarFile(file);
        } catch (IOException e) {
            throw new RuntimeException("jarFile create fail " + e.getMessage(), e);
        }
    }
}


text:
<?php include('stubs/header.php'); ?>

<?php if(isset($error) && strlen($error)) : ?>

<?php echo htmlentities($error, ENT_QUOTES, 'UTF-8') ?>

<?php endif; ?>

	<input type="text" id="url" class="shortlink" value="<?php echo htmlspecialchars($new_url); ?>" onclick="this.focus();this.select();" />
	→ <?php echo htmlspecialchars($url, ENT_QUOTES, 'UTF-8'); ?>

	<a href="https://twitter.com/?status=<?php echo urlencode(' '.$new_url); ?>">Tweet

<?php if(isset($bc_log) && strlen($bc_log)) : ?>

<?php echo nl2br(htmlentities($bc_log, ENT_QUOTES, 'UTF-8')) ?>

<?php endif; ?>

<?php include('stubs/footer.php'); ?>


text:
package dan200.computercraft.api.permissions;

import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;

import javax.annotation.Nonnull;

/**
 * This interface is used to restrict where turtles can move or build.
 *

 * Turtles will call these methods before attempting to perform an action, allowing them to be cancelled.
 *
 * @see dan200.computercraft.api.ComputerCraftAPI#registerPermissionProvider(ITurtlePermissionProvider)
 */
public interface ITurtlePermissionProvider {
    /**
     * Determine whether a block can be entered by a turtle.
     *
     * @param world The world the block exists in
     * @param pos   The location of the block.
     * @return Whether the turtle can move into this block.
     */
    boolean isBlockEnterable(@Nonnull World world, @Nonnull BlockPos pos);

    /**
     * Determine whether a block can be modified by a turtle.
     *

     * This includes breaking and placing blocks.
     *
     * @param world The world the block exists in
     * @param pos   The location of the block.
     * @return Whether the turtle can modify this block.
     */
    boolean isBlockEditable(@Nonnull World world, @Nonnull BlockPos pos);
}


text:
@interface UIView (SFAddition)

- (UIImage *)sf_toImage;
- (UIImage *)sf_toImageLegacy;

- (void)sf_fitToShowAllSubviews;
- (void)sf_fitToShowAllSubviewsWithPadding:(CGSize)padding;

- (UIViewController *)sf_viewController;

- (void)sf_removeAllSubviews;

- (CGFloat)sf_bottom;
- (CGFloat)sf_right;

- (CGFloat)sf_width;
- (CGFloat)sf_height;

- (void)sf_setX:(CGFloat)x;
- (void)sf_setY:(CGFloat)y;

- (void)sf_setWidth:(CGFloat)width;
- (void)sf_setHeight:(CGFloat)height;

- (void)sf_setX:(CGFloat)x y:(CGFloat)y;
- (void)sf_setWidth:(CGFloat)width height:(CGFloat)height;

- (BOOL)sf_isPointInView:(CGPoint)point;

+ (BOOL)sf_isPointInFrame:(CGRect)frame point:(CGPoint)point;

@end

@interface UIView (SFTapSupport)

- (void)sf_addTapListener:(void(^)(UITapGestureRecognizer *gr))tapListener;
- (void)sf_addTapListener:(void(^)(UITapGestureRecognizer *gr))tapListener identifier:(NSString *)identifier;
- (void)sf_removeTapListenerWithIdentifier:(NSString *)identifier;

@end

@interface UIView (SFXibSupport)

- (UIView *)sf_loadFromXibName:(NSString *)xibName;
- (UIView *)sf_loadFromXibName:(NSString *)xibName owner:(id)owner;
- (UIView *)sf_loadFromXibName:(NSString *)xibName bundle:(NSBundle *)bundle;
- (UIView *)sf_loadFromXibName:(NSString *)xibName owner:(id)owner bundle:(NSBundle *)bundle;
- (UIView *)sf_xibView;

@end

@interface UIView (SFSeparator)

- (SFLineView *)sf_addLeftLineWithColor:(UIColor *)color;
- (SFLineView *)sf_addRightLineWithColor:(UIColor *)color;
- (SFLineView *)sf_addTopLineWithColor:(UIColor *)color;
- (SFLineView *)sf_addBottomLineWithColor:(UIColor *)color;

@end

@interface UIView (SFSmallWaiting)

- (void)sf_setSmallWaitingAlpha:(CGFloat)alpha;
- (CGFloat)sf_smallWaitingAlpha;

- (void)sf_setSmallWaiting:(BOOL)waiting;

@end