text:
#ifndef AERON_EXCLUSIVE_PUBLICATION_H
#define AERON_EXCLUSIVE_PUBLICATION_H

#include <array>
#include <memory>
#include <string>

#include "Publication.h"
#include "concurrent/logbuffer/ExclusiveTermAppender.h"

namespace aeron
{

using namespace aeron::concurrent::status;

/**
 * Aeron Publisher API for sending messages to subscribers of a given channel and streamId pair. ExclusivePublications
 * each get their own session id so multiple can be concurrently active on the same media driver as independent streams.
 *
 * {@link ExclusivePublication}s are created via the {@link Aeron#addExclusivePublication(String, int)} method,
 * and messages are sent via one of the {@link #offer(DirectBuffer)} methods, or a
 * {@link #tryClaim(int, ExclusiveBufferClaim)} and {@link ExclusiveBufferClaim#commit()} method combination.
 *
 * {@link ExclusivePublication}s have the potential to provide greater throughput than {@link Publication}s.
 *
 * The APIs used try claim and offer are non-blocking.
 *
 * Note: ExclusivePublication instances are NOT threadsafe for offer and try claim methods but are for others.
 *
 * @see Aeron#addExclusivePublication(String, int)
 * @see BufferClaim
 */
class CLIENT_EXPORT ExclusivePublication
{
public:

    /// @cond HIDDEN_SYMBOLS
    ExclusivePublication(
        ClientConductor &conductor,
        const std::string &channel,
        std::int64_t registrationId,
        std::int32_t streamId,
        std::int32_t sessionId,
        UnsafeBufferPosition &publicationLimit,
        std::int32_t channelStatusId,
        std::shared_ptr<LogBuffers> logBuffers);
    /// @endcond

    ~ExclusivePublication();

    /**
     * Media address for delivery to the channel.
     *
     * @return Media address for delivery to the channel.
     */
    inline const std::string &channel() const
    {
        return m_channel;
    }

    /**
     * Stream identity for scoping within the channel media address.
     *
     * @return Stream identity for scoping within the channel media address.
     */
    inline std::int32_t streamId() const
    {
        return m_streamId;
    }

    /**
     * Session under which messages are published. Identifies this Publication instance.
     *
     * @return the session id for this publication.
     */
    inline std::int32_t sessionId() const
    {
        return m_sessionId;
    }

    /**
     * The initial term id assigned when this Publication was created. This can be used to determine how many
     * terms have passed since creation.
     *
     * @return the initial term id.
     */
    inline std::int32_t initialTermId() const
    {
        return m_initialTermId;
    }

    /**
     * The term-id the publication has reached.
     *
     * @return the term-id the publication has reached.
     */
    inline std::int32_t termId() const
    {
        return m_termId;
    }

    /**
     * The term-offset the publication has reached.
     *
     * @return the term-offset the publication has reached.
     */
    inline std::int32_t termOffset() const
    {
        return m_termOffset;
    }

    /**
     * Get the original registration used to register this Publication with the media driver by the first publisher.
     *
     * @return the original registrationId of the publication.
     */
    inline std::int64_t originalRegistrationId() const
    {
        return m_registrationId;
    }

    /**
     * Registration Id returned by Aeron::addExclusivePublication when this Publication was added.
     *
     * @return the registrationId of the publication.
     */
    inline std::int64_t registrationId() const
    {
        return m_registrationId;
    }

    /**
     * ExclusivePublication instances are always original.
     *
     * @return true.
     */
    static constexpr bool isOriginal()
    {
        return true;
    }

    /**
     * Maximum message length supported in bytes.
     *
     * @return maximum message length supported in bytes.
     */
    inline util::index_t maxMessageLength() const
    {
        return m_maxMessageLength;
    }

    /**
     * Maximum length of a message payload that fits within a message fragment.
     *
     * This is he MTU length minus the message fragment header length.
     *
     * @return maximum message fragment payload length.
     */
    inline util::index_t maxPayloadLength() const
    {
        return m_maxPayloadLength;
    }

    /**
     * Get the length in bytes for each term partition in the log buffer.
     *
     * @return the length in bytes for each term partition in the log buffer.
     */
    inline std::int32_t termBufferLength() const
    {
        return m_appenders[0]->termBuffer().capacity();
    }

    /**
     * Number of bits to right shift a position to get a term count for how far the stream has progressed.
     *
     * @return of bits to right shift a position to get a term count for how far the stream has progressed.
     */
    inline std::int32_t positionBitsToShift() const
    {
        return m_positionBitsToShift;
    }

    /**
     * Has this Publication seen an active subscriber recently?
     *
     * @return true if this Publication has seen an active subscriber recently.
     */
    inline bool isConnected() const
    {
        return !isClosed() && LogBufferDescriptor::isConnected(m_logMetaDataBuffer);
    }

    /**
     * Has this object been closed and should no longer be used?
     *
     * @return true if it has been closed otherwise false.
     */
    inline bool isClosed() const
    {
        return m_isClosed.load(std::memory_order_acquire);
    }

    /**
     * Get the max possible position the stream can reach given term length.
     *
     * @return the max possible position the stream can reach given term length.
     */
    inline std::int64_t maxPossiblePosition() const
    {
        return m_maxPossiblePosition;
    }

    /**
     * Get the current position to which the publication has advanced for this stream.
     *
     * @return the current position to which the publication has advanced for this stream or {@link CLOSED}.
     */
    inline std::int64_t position() const
    {
        std::int64_t result = PUBLICATION_CLOSED;

        if (!isClosed())
        {
            result = m_termBeginPosition + m_termOffset;
        }

        return result;
    }

    /**
     * Get the position limit beyond which this {@link Publication} will be back pressured.
     *
     * This should only be used as a guide to determine when back pressure is likely to be applied.
     *
     * @return the position limit beyond which this {@link Publication} will be back pressured.
     */
    inline std::int64_t publicationLimit() const
    {
        std::int64_t result = PUBLICATION_CLOSED;

        if (!isClosed())
        {
            result = m_publicationLimit.getVolatile();
        }

        return result;
    }

    /**
     * Get the counter id used to represent the publication limit.
     *
     * @return the counter id used to represent the publication limit.
     */
    inline std::int32_t publicationLimitId() const
    {
        return m_publicationLimit.id();
    }

    /**
     * Available window for offering into a publication before the {@link #positionLimit()} is reached.
     *
     * @return  window for offering into a publication before the {@link #positionLimit()} is reached. If
     * the publication is closed then {@link #CLOSED} will be returned.
     */
    inline std::int64_t availableWindow() const
    {
        std::int64_t result = PUBLICATION_CLOSED;

        if (!isClosed())
        {
            result = m_publicationLimit.getVolatile() - position();
        }

        return result;
    }

    /**
     * Get the counter id used to represent the channel status.
     *
     * @return the counter id used to represent the channel status.
     */
    inline std::int32_t channelStatusId() const
    {
        return m_channelStatusId;
    }

    /**
     * Get the status for the channel of this {@link Publication}
     *
     * @return status code for this channel
     */
    std::int64_t channelStatus() const;

    /**
     * Fetches the local socket addresses for this publication. If the channel is not
     * {@link aeron::concurrent::status::ChannelEndpointStatus::CHANNEL_ENDPOINT_ACTIVE}, then this will return an
     * empty list.
     *
     * The format is as follows:
     *

     *

     * IPv4: ip address:port
     *

     * IPv6: [ip6 address]:port
     *

     *

     * This is to match the formatting used in the Aeron URI
     *
     * @return local socket address for this subscription.
     * @see #channelStatus()
     */
    std::vector<std::string> localSocketAddresses() const;

    /**
     * Non-blocking publish of a buffer containing a message.
     *
     * @param buffer containing message.
     * @param offset offset in the buffer at which the encoded message begins.
     * @param length in bytes of the encoded message.
     * @param reservedValueSupplier for the frame.
     * @return The new stream position, otherwise {@link #NOT_CONNECTED}, {@link #BACK_PRESSURED},
     * {@link #ADMIN_ACTION} or {@link #CLOSED}.
     */
    inline std::int64_t offer(
        const concurrent::AtomicBuffer &buffer,
        util::index_t offset,
        util::index_t length,
        const on_reserved_value_supplier_t &reservedValueSupplier)
    {
        std::int64_t newPosition = PUBLICATION_CLOSED;

        if (!isClosed())
        {
            const std::int64_t limit = m_publicationLimit.getVolatile();
            ExclusiveTermAppender *termAppender = m_appenders[m_activePartitionIndex].get();
            const std::int64_t position = m_termBeginPosition + m_termOffset;

            if (position < limit)
            {
                std::int32_t result;
                if (length <= m_maxPayloadLength)
                {
                    result = termAppender->appendUnfragmentedMessage(
                        m_termId,
                        m_termOffset,
                        m_headerWriter,
                        buffer,
                        offset,
                        length,
                        reservedValueSupplier);
                }
                else
                {
                    checkMaxMessageLength(length);
                    result = termAppender->appendFragmentedMessage(
                        m_termId,
                        m_termOffset,
                        m_headerWriter,
                        buffer,
                        offset,
                        length,
                        m_maxPayloadLength,
                        reservedValueSupplier);
                }

                newPosition = ExclusivePublication::newPosition(result);
            }
            else
            {
                newPosition = ExclusivePublication::backPressureStatus(position, length);
            }
        }

        return newPosition;
    }

    /**
     * Non-blocking publish of a buffer containing a message.
     *
     * @param buffer containing message.
     * @param offset offset in the buffer at which the encoded message begins.
     * @param length in bytes of the encoded message.
     * @return The new stream position, otherwise {@link #NOT_CONNECTED}, {@link #BACK_PRESSURED},
     * {@link #ADMIN_ACTION} or {@link #CLOSED}.
     */
    inline std::int64_t offer(const concurrent::AtomicBuffer &buffer, util::index_t offset, util::index_t length)
    {
        return offer(buffer, offset, length, DEFAULT_RESERVED_VALUE_SUPPLIER);
    }

    /**
     * Non-blocking publish of a buffer containing a message.
     *
     * @param buffer containing message.
     * @return The new stream position on success, otherwise {@link BACK_PRESSURED} or {@link NOT_CONNECTED}.
     */
    inline std::int64_t offer(const concurrent::AtomicBuffer &buffer)
    {
        return offer(buffer, 0, buffer.capacity());
    }

    /**
     * Non-blocking publish of buffers containing a message.
     *
     * @param startBuffer containing part of the message.
     * @param lastBuffer after the message.
     * @param reservedValueSupplier for the frame.
     * @return The new stream position, otherwise {@link #NOT_CONNECTED}, {@link #BACK_PRESSURED},
     * {@link #ADMIN_ACTION} or {@link #CLOSED}.
     */
    template<class BufferIterator>
    std::int64_t offer(
        BufferIterator startBuffer,
        BufferIterator lastBuffer,
        const on_reserved_value_supplier_t &reservedValueSupplier = DEFAULT_RESERVED_VALUE_SUPPLIER)
    {
        util::index_t length = 0;
        for (BufferIterator it = startBuffer; it != lastBuffer; ++it)
        {
            if (AERON_COND_EXPECT(length + it->capacity() < 0, false))
            {
                throw aeron::util::IllegalStateException(
                    "length overflow: " + std::to_string(length) + " + " + std::to_string(it->capacity()) +
                    " > " + std::to_string(length + it->capacity()),
                    SOURCEINFO);
            }

            length += it->capacity();
        }

        std::int64_t newPosition = PUBLICATION_CLOSED;

        if (!isClosed())
        {
            const std::int64_t limit = m_publicationLimit.getVolatile();
            ExclusiveTermAppender *termAppender = m_appenders[m_activePartitionIndex].get();
            const std::int64_t position = m_termBeginPosition + m_termOffset;

            if (position < limit)
            {
                std::int32_t result;
                if (length <= m_maxPayloadLength)
                {
                    result = termAppender->appendUnfragmentedMessage(
                        m_termId,
                        m_termOffset,
                        m_headerWriter,
                        startBuffer,
                        length,
                        reservedValueSupplier);
                }
                else
                {
                    checkMaxMessageLength(length);
                    result = termAppender->appendFragmentedMessage(
                        m_termId,
                        m_termOffset,
                        m_headerWriter,
                        startBuffer,
                        length,
                        m_maxPayloadLength,
                        reservedValueSupplier);
                }

                newPosition = ExclusivePublication::newPosition(result);
            }
            else
            {
                newPosition = ExclusivePublication::backPressureStatus(position, length);
            }
        }

        return newPosition;
    }

    /**
     * Non-blocking publish of array of buffers containing a message.
     *
     * @param buffers containing parts of the message.
     * @param length of the array of buffers.
     * @param reservedValueSupplier for the frame.
     * @return The new stream position, otherwise {@link #NOT_CONNECTED}, {@link #BACK_PRESSURED},
     * {@link #ADMIN_ACTION} or {@link #CLOSED}.
     */
    std::int64_t offer(
        const concurrent::AtomicBuffer buffers[],
        std::size_t length,
        const on_reserved_value_supplier_t &reservedValueSupplier = DEFAULT_RESERVED_VALUE_SUPPLIER)
    {
        return offer(buffers, buffers + length, reservedValueSupplier);
    }

    /**
     * Non-blocking publish of array of buffers containing a message.
     *
     * @param buffers containing parts of the message.
     * @param reservedValueSupplier for the frame.
     * @return The new stream position, otherwise {@link #NOT_CONNECTED}, {@link #BACK_PRESSURED},
     * {@link #ADMIN_ACTION} or {@link #CLOSED}.
     */
    template<std::size_t N>
    std::int64_t offer(
        const std::array<concurrent::AtomicBuffer, N> &buffers,
        const on_reserved_value_supplier_t &reservedValueSupplier = DEFAULT_RESERVED_VALUE_SUPPLIER)
    {
        return offer(buffers.begin(), buffers.end(), reservedValueSupplier);
    }

    /**
     * Try to claim a range in the publication log into which a message can be written with zero copy semantics.
     * Once the message has been written then {@link BufferClaim#commit()} should be called thus making it available.
     *

     * Note: This method can only be used for message lengths less than MTU length minus header.
     *
     * @code
     *     BufferClaim bufferClaim; // Can be stored and reused to avoid allocation
     *
     *     if (publication->tryClaim(messageLength, bufferClaim) > 0)
     *     {
     *         try
     *         {
     *              AtomicBuffer &buffer = bufferClaim.buffer();
     *              const index_t offset = bufferClaim.offset();
     *
     *              // Work with buffer directly or wrap with a flyweight
     *         }
     *         finally
     *         {
     *             bufferClaim.commit();
     *         }
     *     }
     * @endcode
     *
     * @param length      of the range to claim, in bytes..
     * @param bufferClaim to be populate if the claim succeeds.
     * @return The new stream position, otherwise {@link #NOT_CONNECTED}, {@link #BACK_PRESSURED},
     * {@link #ADMIN_ACTION} or {@link #CLOSED}.
     * @throws IllegalArgumentException if the length is greater than max payload length within an MTU.
     * @see BufferClaim::commit
     * @see BufferClaim::abort
     */
    inline std::int64_t tryClaim(util::index_t length, concurrent::logbuffer::BufferClaim &bufferClaim)
    {
        checkPayloadLength(length);
        std::int64_t newPosition = PUBLICATION_CLOSED;

        if (AERON_COND_EXPECT((!isClosed()), true))
        {
            const std::int64_t limit = m_publicationLimit.getVolatile();
            ExclusiveTermAppender *termAppender = m_appenders[m_activePartitionIndex].get();
            const std::int64_t position = m_termBeginPosition + m_termOffset;

            if (AERON_COND_EXPECT((position < limit), true))
            {
                const std::int32_t result = termAppender->claim(
                    m_termId, m_termOffset, m_headerWriter, length, bufferClaim);
                newPosition = ExclusivePublication::newPosition(result);
            }
            else
            {
                newPosition = ExclusivePublication::backPressureStatus(position, length);
            }
        }

        return newPosition;
    }

    /**
     * Add a destination manually to a multi-destination-cast Publication.
     *
     * @param endpointChannel for the destination to add
     */
    void addDestination(const std::string &endpointChannel);

    /**
     * Remove a previously added destination manually from a multi-destination-cast Publication.
     *
     * @param endpointChannel for the destination to remove
     */
    void removeDestination(const std::string &endpointChannel);

    /// @cond HIDDEN_SYMBOLS
    inline void close()
    {
        m_isClosed.store(true, std::memory_order_release);
    }
    /// @endcond

private:
    ClientConductor &m_conductor;
    AtomicBuffer &m_logMetaDataBuffer;

    const std::string m_channel;
    std::int64_t m_registrationId;
    std::int64_t m_maxPossiblePosition;
    std::int32_t m_streamId;
    std::int32_t m_sessionId;
    std::int32_t m_initialTermId;
    std::int32_t m_maxPayloadLength;
    std::int32_t m_maxMessageLength;
    std::int32_t m_positionBitsToShift;

    std::int32_t m_termOffset;
    std::int32_t m_termId;
    std::int32_t m_activePartitionIndex;
    std::int64_t m_termBeginPosition;

    ReadablePosition<UnsafeBufferPosition> m_publicationLimit;
    std::int32_t m_channelStatusId;
    std::atomic<bool> m_isClosed = { false };

    std::shared_ptr<LogBuffers> m_logBuffers;
    std::unique_ptr<ExclusiveTermAppender> m_appenders[3];
    HeaderWriter m_headerWriter;

    inline std::int64_t newPosition(const std::int32_t resultingOffset)
    {
        if (resultingOffset > 0)
        {
            m_termOffset = resultingOffset;

            return m_termBeginPosition + resultingOffset;
        }

        const std::int32_t termLength = termBufferLength();
        if ((m_termBeginPosition + termLength) >= m_maxPossiblePosition)
        {
            return MAX_POSITION_EXCEEDED;
        }

        const int nextIndex = LogBufferDescriptor::nextPartitionIndex(m_activePartitionIndex);
        const std::int32_t nextTermId = m_termId + 1;

        m_activePartitionIndex = nextIndex;
        m_termOffset = 0;
        m_termId = nextTermId;
        m_termBeginPosition += termLength;

        const std::int32_t termCount = nextTermId - m_initialTermId;

        LogBufferDescriptor::initializeTailWithTermId(m_logMetaDataBuffer, nextIndex, nextTermId);
        LogBufferDescriptor::activeTermCountOrdered(m_logMetaDataBuffer, termCount);

        return ADMIN_ACTION;
    }

    inline std::int64_t backPressureStatus(std::int64_t currentPosition, std::int32_t messageLength)
    {
        if ((currentPosition + messageLength) >= m_maxPossiblePosition)
        {
            return MAX_POSITION_EXCEEDED;
        }

        if (LogBufferDescriptor::isConnected(m_logMetaDataBuffer))
        {
            return BACK_PRESSURED;
        }

        return NOT_CONNECTED;
    }

    inline void checkMaxMessageLength(const util::index_t length) const
    {
        if (AERON_COND_EXPECT((length > m_maxMessageLength), false))
        {
            throw aeron::util::IllegalArgumentException(
                "message exceeds maxMessageLength=" + std::to_string(m_maxMessageLength) +
                ", length=" + std::to_string(length), SOURCEINFO);
        }
    }

    inline void checkPayloadLength(const util::index_t length) const
    {
        if (AERON_COND_EXPECT((length > m_maxPayloadLength), false))
        {
            throw aeron::util::IllegalArgumentException(
                "message exceeds maxPayloadLength=" + std::to_string(m_maxPayloadLength) +
                ", length=" + std::to_string(length), SOURCEINFO);
        }
    }
};

}

#endif


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<title>ur_rna.RNAstructureUI.windows Class Hierarchy</title>
<meta name="date" content="2015-10-11">
<link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Skip navigation links

Overview

Package

Class

Tree

Index

Help

Prev

Next

Frames

No Frames

All Classes

Hierarchy For Package ur_rna.RNAstructureUI.windows

Package Hierarchies:

All Packages

Class Hierarchy

java.lang.Object

java.awt.Component (implements java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable)

java.awt.Container

javax.swing.JComponent (implements java.io.Serializable)

javax.swing.AbstractButton (implements java.awt.ItemSelectable, javax.swing.SwingConstants)

javax.swing.JButton (implements javax.accessibility.Accessible)

ur_rna.RNAstructureUI.windows.OligoWalkWindow.BarButton

javax.swing.JMenuItem (implements javax.accessibility.Accessible, javax.swing.MenuElement)

javax.swing.JMenu (implements javax.accessibility.Accessible, javax.swing.MenuElement)

ur_rna.RNAstructureUI.utilities.RNAstructureMenu (implements java.awt.event.ActionListener)

ur_rna.RNAstructureUI.menus.RolloverMenu

ur_rna.RNAstructureUI.windows.OligoWalkWindow.OligoWalkResultsMenu

ur_rna.RNAstructureUI.windows.SequenceDisplayWindow.EditMenu

ur_rna.RNAstructureUI.windows.SequenceDisplayWindow.ReadMenu

javax.swing.JComboBox<E> (implements javax.accessibility.Accessible, java.awt.event.ActionListener, java.awt.ItemSelectable, javax.swing.event.ListDataListener)

ur_rna.RNAstructureUI.windows.OligoWalkWindow.StringComboBox

javax.swing.JInternalFrame (implements javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants)

ur_rna.RNAstructureUI.windows.InternalWindow (implements java.awt.event.ActionListener)

ur_rna.RNAstructureUI.windows.DrawingWindow

ur_rna.RNAstructureUI.windows.ModuleWindow

ur_rna.RNAstructureUI.windows.DynalignFoldWindow

ur_rna.RNAstructureUI.windows.DynalignRefoldWindow

ur_rna.RNAstructureUI.windows.Efn2Window

ur_rna.RNAstructureUI.windows.FoldDoubleWindow

ur_rna.RNAstructureUI.windows.FoldSingleWindow

ur_rna.RNAstructureUI.windows.FoldSuboptimalWindow

ur_rna.RNAstructureUI.windows.MaxExpectWindow

ur_rna.RNAstructureUI.windows.MultiWindow

ur_rna.RNAstructureUI.windows.MultilignWindow

ur_rna.RNAstructureUI.windows.TurboFoldWindow

ur_rna.RNAstructureUI.windows.OligoScreenWindow

ur_rna.RNAstructureUI.windows.OligoWalkWindow

ur_rna.RNAstructureUI.windows.PartitionDoubleWindow

ur_rna.RNAstructureUI.windows.PartitionSingleWindow

ur_rna.RNAstructureUI.windows.ProbKnotWindow

ur_rna.RNAstructureUI.windows.PseudoknotWindow

ur_rna.RNAstructureUI.windows.RefoldWindow

ur_rna.RNAstructureUI.windows.StochasticWindow

ur_rna.RNAstructureUI.windows.SequenceDisplayWindow

javax.swing.JPanel (implements javax.accessibility.Accessible)

ur_rna.RNAstructureUI.windows.OligoWalkWindow.SpinnerPanel

java.awt.Window (implements javax.accessibility.Accessible)

java.awt.Dialog

javax.swing.JDialog (implements javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants)

ur_rna.RNAstructureUI.utilities.ValueSelectionDialog

ur_rna.RNAstructureUI.windows.OligoWalkWindow.OligoSelectionDialog

Skip navigation links

Overview

Package

Class

Tree

Index

Help

Prev

Next

Frames

No Frames

All Classes

redpajama_set_name: RedPajamaGithub


text:
import { Component, OnInit } from '@angular/core';

@Component({
  selector: 'app-galaxy',
  templateUrl: './galaxy.component.html',
  styleUrls: ['./galaxy.component.scss']
})
export class GalaxyComponent implements OnInit {

  constructor() { }

  ngOnInit() {
  }

}


text:
using System;
using System.ComponentModel;
using System.Linq.Expressions;
using System.Reflection;
using System.Runtime.CompilerServices;
using Template10.Common;
using Template10.Utils;

namespace Template10.Mvvm
{
    // DOCS: https://github.com/Windows-XAML/Template10/wiki/Docs-%7C-MVVM
    public abstract class BindableBase : IBindable
    {
        public event PropertyChangedEventHandler PropertyChanged;

        public virtual bool Set<T>(ref T storage, T value, [CallerMemberName]string propertyName = null)
        {
            if (object.Equals(storage, value))
                return false;

            storage = value;
            this.RaisePropertyChanged(propertyName);
            return true;
        }

        public virtual void RaisePropertyChanged([CallerMemberName]string propertyName = null)
        {
            if (Windows.ApplicationModel.DesignMode.DesignModeEnabled)
                return;

            var handler = PropertyChanged;
            if (!object.Equals(handler, null))
            {
                var args = new PropertyChangedEventArgs(propertyName);
                var dispatcher = WindowWrapper.Current().Dispatcher;
                if (dispatcher.HasThreadAccess())
                {
                    try
                    {
                        handler.Invoke(this, args);
                    }
                    catch
                    {
                        dispatcher.Dispatch(() => handler.Invoke(this, args));
                    }
                }
                else
                {
                    dispatcher.Dispatch(() => handler.Invoke(this, args));
                }
            }
        }

        public virtual bool Set<T>(Expression<Func<T>> propertyExpression, ref T field, T newValue)
        {
            if (object.Equals(field, newValue))
                return false;

            field = newValue;
            RaisePropertyChanged(propertyExpression);
            return true;
        }

        public virtual void RaisePropertyChanged<T>(Expression<Func<T>> propertyExpression)
        {
            if (Windows.ApplicationModel.DesignMode.DesignModeEnabled)
                return;

            var handler = PropertyChanged;
            if (!object.Equals(handler, null))
            {
                var propertyName = ExpressionUtils.GetPropertyName(propertyExpression);
                if (!object.Equals(propertyName, null))
                {
                    var args = new PropertyChangedEventArgs(propertyName);
                    var dispatcher = WindowWrapper.Current().Dispatcher;
                    if (dispatcher.HasThreadAccess())
                    {
                        try
                        {
                            handler.Invoke(this, args);
                        }
                        catch
                        {
                            dispatcher.Dispatch(() => handler.Invoke(this, args));
                        }
                    }
                    else
                    {
                        dispatcher.Dispatch(() => handler.Invoke(this, args));
                    }
                }
            }
        }
    }
}


text:
package org.antlr.v4.test;

import org.antlr.v4.Tool;
import org.antlr.v4.tool.ErrorType;
import org.junit.Test;

public class TestToolSyntaxErrors extends BaseTest {
    static String[] A = {
        // INPUT
        "grammar A;\n" +
        "",
        // YIELDS
        "error(" + ErrorType.NO_RULES.code + "): A.g4::: grammar A has no rules\n",

		"A;",
		"error(" + ErrorType.SYNTAX_ERROR.code + "): A.g4:1:0: syntax error: 'A' came as a complete surprise to me\n",

		"grammar ;",
		"error(" + ErrorType.SYNTAX_ERROR.code + "): A.g4:1:8: syntax error: ';' came as a complete surprise to me while looking for an identifier\n",

		"grammar A\n" +
		"a : ID ;\n",
		"error(" + ErrorType.SYNTAX_ERROR.code + "): A.g4:2:0: syntax error: missing SEMI at 'a'\n",

		"grammar A;\n" +
		"a : ID ;;\n"+
		"b : B ;",
		"error(" + ErrorType.SYNTAX_ERROR.code + "): A.g4:2:8: syntax error: ';' came as a complete surprise to me\n",

		"grammar A;;\n" +
		"a : ID ;\n",
		"error(" + ErrorType.SYNTAX_ERROR.code + "): A;.g4:1:10: syntax error: ';' came as a complete surprise to me\n",

		"grammar A;\n" +
		"a @init : ID ;\n",
		"error(" + ErrorType.SYNTAX_ERROR.code + "): A.g4:2:8: syntax error: mismatched input ':' expecting ACTION while matching rule preamble\n",

		"grammar A;\n" +
		"a  ( A | B ) D ;\n" +
		"b : B ;",
		"error(" + ErrorType.SYNTAX_ERROR.code + "): A.g4:2:3: syntax error: '(' came as a complete surprise to me while matching rule preamble\n" +
		"error(" + ErrorType.SYNTAX_ERROR.code + "): A.g4:2:11: syntax error: mismatched input ')' expecting SEMI while matching a rule\n" +
		"error(" + ErrorType.SYNTAX_ERROR.code + "): A.g4:2:15: syntax error: mismatched input ';' expecting COLON while matching a lexer rule\n",
    };

	@Test public void testA() { super.testErrors(A, true); }

	@Test public void testExtraColon() {
		String[] pair = new String[] {
			"grammar A;\n" +
			"a : : A ;\n" +
			"b : B ;",
			"error(" + ErrorType.SYNTAX_ERROR.code + "): A.g4:2:4: syntax error: ':' came as a complete surprise to me while matching alternative\n",
		};
		super.testErrors(pair, true);
	}

	@Test public void testMissingRuleSemi() {
		String[] pair = new String[] {
			"grammar A;\n" +
			"a : A \n" +
			"b : B ;",
			"error(" + ErrorType.SYNTAX_ERROR.code + "): A.g4:3:0: syntax error: unterminated rule (missing ';') detected at 'b :' while looking for rule element\n",
		};
		super.testErrors(pair, true);
	}

	@Test public void testMissingRuleSemi2() {
		String[] pair = new String[] {
			"lexer grammar A;\n" +
			"A : 'a' \n" +
			"B : 'b' ;",
			"error(" + ErrorType.SYNTAX_ERROR.code + "): A.g4:3:0: syntax error: unterminated rule (missing ';') detected at 'B :' while looking for lexer rule element\n",
		};
		super.testErrors(pair, true);
	}

	@Test public void testMissingRuleSemi3() {
		String[] pair = new String[] {
			"grammar A;\n" +
			"a : A \n" +
			"b[int i] returns [int y] : B ;",
			"error(" + ErrorType.SYNTAX_ERROR.code + "): A.g4:3:9: syntax error: unterminated rule (missing ';') detected at 'returns int y' while looking for rule element\n"
		};
		super.testErrors(pair, true);
	}

	@Test public void testMissingRuleSemi4() {
		String[] pair = new String[] {
			"grammar A;\n" +
			"a : b \n" +
			"  catch [Exception e] {...}\n" +
			"b : B ;\n",

			"error(" + ErrorType.SYNTAX_ERROR.code + "): A.g4:2:4: syntax error: unterminated rule (missing ';') detected at 'b catch' while looking for rule element\n"
		};
		super.testErrors(pair, true);
	}

	@Test public void testMissingRuleSemi5() {
		String[] pair = new String[] {
			"grammar A;\n" +
			"a : A \n" +
			"  catch [Exception e] {...}\n",

			"error(" + ErrorType.SYNTAX_ERROR.code + "): A.g4:2:4: syntax error: unterminated rule (missing ';') detected at 'A catch' while looking for rule element\n"
		};
		super.testErrors(pair, true);
	}

	@Test public void testBadRulePrequelStart() {
		String[] pair = new String[] {
			"grammar A;\n" +
			"a @ options {k=1;} : A ;\n" +
			"b : B ;",

			"error(" + ErrorType.SYNTAX_ERROR.code + "): A.g4:2:4: syntax error: 'options {' came as a complete surprise to me while looking for an identifier\n"
		};
		super.testErrors(pair, true);
	}

	@Test public void testBadRulePrequelStart2() {
		String[] pair = new String[] {
			"grammar A;\n" +
			"a } : A ;\n" +
			"b : B ;",

			"error(" + ErrorType.SYNTAX_ERROR.code + "): A.g4:2:2: syntax error: '}' came as a complete surprise to me while matching rule preamble\n"
		};
		super.testErrors(pair, true);
	}

	@Test public void testModeInParser() {
		String[] pair = new String[] {
			"grammar A;\n" +
			"a : A ;\n" +
			"mode foo;\n" +
			"b : B ;",

			"error(" + ErrorType.SYNTAX_ERROR.code + "): A.g4:4:0: syntax error: 'b' came as a complete surprise to me\n" +
			"error(" + ErrorType.SYNTAX_ERROR.code + "): A.g4:4:6: syntax error: mismatched input ';' expecting COLON while matching a lexer rule\n"
		};
		super.testErrors(pair, true);
	}

	/**
	 * This is a regression test for antlr/antlr4#243
	 * "Generate a good message for unterminated strings"
	 * https://github.com/antlr/antlr4/issues/243
	 */
	@Test public void testUnterminatedStringLiteral() {
		String[] pair = new String[] {
			"grammar A;\n" +
			"a : 'x\n" +
			"  ;\n",

			"error(" + ErrorType.UNTERMINATED_STRING_LITERAL.code + "): A.g4:2:4: unterminated string literal\n"
		};
		super.testErrors(pair, true);
	}

	/**
	 * This is a regression test for antlr/antlr4#262
	 * "Parser Rule Name Starting With an Underscore"
	 * https://github.com/antlr/antlr4/issues/262
	 */
	@Test public void testParserRuleNameStartingWithUnderscore() {
		String[] pair = new String[] {
			"grammar A;\n" +
			"_a : 'x' ;\n",

			"error(" + ErrorType.SYNTAX_ERROR.code + "): A.g4:2:0: syntax error: '_' came as a complete surprise to me\n"
		};
		super.testErrors(pair, true);
	}

	/**
	 * This is a regression test for antlr/antlr4#194
	 * "NullPointerException on 'options{}' in grammar file"
	 * https://github.com/antlr/antlr4/issues/194
	 */
	@Test public void testEmptyGrammarOptions() {
		String[] pair = new String[] {
			"grammar A;\n" +
			"options {}\n" +
			"a : 'x' ;\n",

			""
		};
		super.testErrors(pair, true);
	}

	/**
	 * This is a "related" regression test for antlr/antlr4#194
	 * "NullPointerException on 'options{}' in grammar file"
	 * https://github.com/antlr/antlr4/issues/194
	 */
	@Test public void testEmptyRuleOptions() {
		String[] pair = new String[] {
			"grammar A;\n" +
			"a options{} : 'x' ;\n",

			""
		};
		super.testErrors(pair, true);
	}

	/**
	 * This is a "related" regression test for antlr/antlr4#194
	 * "NullPointerException on 'options{}' in grammar file"
	 * https://github.com/antlr/antlr4/issues/194
	 */
	@Test public void testEmptyBlockOptions() {
		String[] pair = new String[] {
			"grammar A;\n" +
			"a : (options{} : 'x') ;\n",

			""
		};
		super.testErrors(pair, true);
	}

	@Test public void testEmptyTokensBlock() {
		String[] pair = new String[] {
			"grammar A;\n" +
			"tokens {}\n" +
			"a : 'x' ;\n",

			""
		};
		super.testErrors(pair, true);
	}

	/**
	 * This is a regression test for antlr/antlr4#190
	 * "NullPointerException building lexer grammar using bogus 'token' action"
	 * https://github.com/antlr/antlr4/issues/190
	 */
	@Test public void testInvalidLexerCommand() {
		String[] pair = new String[] {
			"grammar A;\n" +
			"tokens{Foo}\n" +
			"b : Foo ;\n" +
			"X : 'foo' -> popmode;\n" + // "meant" to use -> popMode
			"Y : 'foo' -> token(Foo);", // "meant" to use -> type(Foo)

			"error(" + ErrorType.INVALID_LEXER_COMMAND.code + "): A.g4:4:13: lexer command popmode does not exist or is not supported by the current target\n" +
			"error(" + ErrorType.INVALID_LEXER_COMMAND.code + "): A.g4:5:13: lexer command token does not exist or is not supported by the current target\n"
		};
		super.testErrors(pair, true);
	}

	@Test public void testLexerCommandArgumentValidation() {
		String[] pair = new String[] {
			"grammar A;\n" +
			"tokens{Foo}\n" +
			"b : Foo ;\n" +
			"X : 'foo' -> popMode(Foo);\n" + // "meant" to use -> popMode
			"Y : 'foo' -> type;", // "meant" to use -> type(Foo)

			"error(" + ErrorType.UNWANTED_LEXER_COMMAND_ARGUMENT.code + "): A.g4:4:13: lexer command popMode does not take any arguments\n" +
			"error(" + ErrorType.MISSING_LEXER_COMMAND_ARGUMENT.code + "): A.g4:5:13: missing argument for lexer command type\n"
		};
		super.testErrors(pair, true);
	}

	@Test public void testRuleRedefinition() {
		String[] pair = new String[] {
			"grammar Oops;\n" +
			"\n" +
			"ret_ty : A ;\n" +
			"ret_ty : B ;\n" +
			"\n" +
			"A : 'a' ;\n" +
			"B : 'b' ;\n",

			"error(" + ErrorType.RULE_REDEFINITION.code + "): Oops.g4:4:0: rule ret_ty redefinition; previous at line 3\n"
		};
		super.testErrors(pair, true);
	}

	@Test public void testEpsilonClosureAnalysis() {
		String grammar =
			"grammar A;\n"
			+ "x : ;\n"
			+ "y1 : x+;\n"
			+ "y2 : x*;\n"
			+ "z1 : ('foo' | 'bar'? 'bar2'?)*;\n"
			+ "z2 : ('foo' | 'bar' 'bar2'? | 'bar2')*;\n";
		String expected =
			"error(" + ErrorType.EPSILON_CLOSURE.code + "): A.g4:3:0: rule y1 contains a closure with at least one alternative that can match an empty string\n" +
			"error(" + ErrorType.EPSILON_CLOSURE.code + "): A.g4:4:0: rule y2 contains a closure with at least one alternative that can match an empty string\n" +
			"error(" + ErrorType.EPSILON_CLOSURE.code + "): A.g4:5:0: rule z1 contains a closure with at least one alternative that can match an empty string\n";

		String[] pair = new String[] {
			grammar,
			expected
		};

		super.testErrors(pair, true);
	}

	@Test public void testEpsilonOptionalAnalysis() {
		String grammar =
			"grammar A;\n"
			+ "x : ;\n"
			+ "y  : x?;\n"
			+ "z1 : ('foo' | 'bar'? 'bar2'?)?;\n"
			+ "z2 : ('foo' | 'bar' 'bar2'? | 'bar2')?;\n";
		String expected =
			"warning(" + ErrorType.EPSILON_OPTIONAL.code + "): A.g4:3:0: rule y contains an optional block with at least one alternative that can match an empty string\n" +
			"warning(" + ErrorType.EPSILON_OPTIONAL.code + "): A.g4:4:0: rule z1 contains an optional block with at least one alternative that can match an empty string\n";

		String[] pair = new String[] {
			grammar,
			expected
		};

		super.testErrors(pair, true);
	}

	/**
	 * This is a regression test for antlr/antlr4#315
	 * "Inconsistent lexer error msg for actions"
	 * https://github.com/antlr/antlr4/issues/315
	 */
	@Test public void testActionAtEndOfOneLexerAlternative() {
		String grammar =
			"grammar A;\n" +
			"stat : 'start' CharacterLiteral 'end' EOF;\n" +
			"\n" +
			"// Lexer\n" +
			"\n" +
			"CharacterLiteral\n" +
			"    :   '\\'' SingleCharacter '\\''\n" +
			"    |   '\\'' ~[\\r\\n] {notifyErrorListeners(\"unclosed character literal\");}\n" +
			"    ;\n" +
			"\n" +
			"fragment\n" +
			"SingleCharacter\n" +
			"    :   ~['\\\\\\r\\n]\n" +
			"    ;\n" +
			"\n" +
			"WS   : [ \\r\\t\\n]+ -> skip ;\n";
		String expected =
			"";

		String[] pair = new String[] { grammar, expected };
		super.testErrors(pair, true);
	}

	/**
	 * This is a regression test for antlr/antlr4#308 "NullPointer exception"
	 * https://github.com/antlr/antlr4/issues/308
	 */
	@Test public void testDoubleQuotedStringLiteral() {
		String grammar =
			"lexer grammar A;\n"
			+ "WHITESPACE : (\" \" | \"\\t\" | \"\\n\" | \"\\r\" | \"\\f\");\n";
		String expected =
			"error(" + ErrorType.SYNTAX_ERROR.code + "): A.g4:2:14: syntax error: '\"' came as a complete surprise to me\n" +
			"error(" + ErrorType.SYNTAX_ERROR.code + "): A.g4:2:16: syntax error: '\"' came as a complete surprise to me\n" +
			"error(" + ErrorType.SYNTAX_ERROR.code + "): A.g4:2:20: syntax error: '\"' came as a complete surprise to me\n" +
			"error(" + ErrorType.SYNTAX_ERROR.code + "): A.g4:2:21: syntax error: '\\' came as a complete surprise to me\n" +
			"error(" + ErrorType.SYNTAX_ERROR.code + "): A.g4:2:23: syntax error: '\"' came as a complete surprise to me\n" +
			"error(" + ErrorType.SYNTAX_ERROR.code + "): A.g4:2:27: syntax error: '\"' came as a complete surprise to me\n" +
			"error(" + ErrorType.SYNTAX_ERROR.code + "): A.g4:2:28: syntax error: '\\' came as a complete surprise to me\n" +
			"error(" + ErrorType.SYNTAX_ERROR.code + "): A.g4:2:30: syntax error: '\"' came as a complete surprise to me\n" +
			"error(" + ErrorType.SYNTAX_ERROR.code + "): A.g4:2:34: syntax error: '\"' came as a complete surprise to me\n" +
			"error(" + ErrorType.SYNTAX_ERROR.code + "): A.g4:2:35: syntax error: '\\' came as a complete surprise to me\n" +
			"error(" + ErrorType.SYNTAX_ERROR.code + "): A.g4:2:37: syntax error: '\"' came as a complete surprise to me\n" +
			"error(" + ErrorType.SYNTAX_ERROR.code + "): A.g4:2:41: syntax error: '\"' came as a complete surprise to me\n" +
			"error(" + ErrorType.SYNTAX_ERROR.code + "): A.g4:2:42: syntax error: '\\' came as a complete surprise to me\n" +
			"error(" + ErrorType.SYNTAX_ERROR.code + "): A.g4:2:44: syntax error: '\"' came as a complete surprise to me\n";

		String[] pair = new String[] {
			grammar,
			expected
		};

		super.testErrors(pair, true);
	}

	/**
	 * This test ensures that the {@link ErrorType#INVALID_ESCAPE_SEQUENCE}
	 * error is not reported for escape sequences that are known to be valid.
	 */
	@Test public void testValidEscapeSequences() {
		String grammar =
			"lexer grammar A;\n" +
			"NORMAL_ESCAPE : '\\b \\t \\n \\f \\r \\\" \\' \\\\';\n" +
			"UNICODE_ESCAPE : '\\u0001 \\u00A1 \\u00a1 \\uaaaa \\uAAAA';\n";
		String expected =
			"";

		String[] pair = new String[] {
			grammar,
			expected
		};

		super.testErrors(pair, true);
	}

	/**
	 * This is a regression test for antlr/antlr4#507 "NullPointerException When
	 * Generating Code from Grammar".
	 * https://github.com/antlr/antlr4/issues/507
	 */
	@Test public void testInvalidEscapeSequences() {
		String grammar =
			"lexer grammar A;\n" +
			"RULE : 'Foo \\uAABG \\x \\u';\n";
		String expected =
			"error(" + ErrorType.INVALID_ESCAPE_SEQUENCE.code + "): A.g4:2:12: invalid escape sequence\n" +
			"error(" + ErrorType.INVALID_ESCAPE_SEQUENCE.code + "): A.g4:2:19: invalid escape sequence\n" +
			"error(" + ErrorType.INVALID_ESCAPE_SEQUENCE.code + "): A.g4:2:22: invalid escape sequence\n";

		String[] pair = new String[] {
			grammar,
			expected
		};

		super.testErrors(pair, true);
	}

	/**
	 * This test ensures the {@link ErrorType#UNRECOGNIZED_ASSOC_OPTION} warning
	 * is produced as described in the documentation.
	 */
	@Test public void testUnrecognizedAssocOption() {
		String grammar =
			"grammar A;\n" +
			"x : 'x'\n" +
			"  | x '+'<assoc=right> x   // warning 157\n" +
			"  |<assoc=right> x '*' x   // ok\n" +
			"  ;\n";
		String expected =
			"warning(" + ErrorType.UNRECOGNIZED_ASSOC_OPTION.code + "): A.g4:3:10: rule x contains an assoc terminal option in an unrecognized location\n";

		String[] pair = new String[] {
			grammar,
			expected
		};

		super.testErrors(pair, true);
	}

	/**
	 * This test ensures the {@link ErrorType#FRAGMENT_ACTION_IGNORED} warning
	 * is produced as described in the documentation.
	 */
	@Test public void testFragmentActionIgnored() {
		String grammar =
			"lexer grammar A;\n" +
			"X1 : 'x' -> more    // ok\n" +
			"   ;\n" +
			"Y1 : 'x' {more();}  // ok\n" +
			"   ;\n" +
			"fragment\n" +
			"X2 : 'x' -> more    // warning 158\n" +
			"   ;\n" +
			"fragment\n" +
			"Y2 : 'x' {more();}  // warning 158\n" +
			"   ;\n";
		String expected =
			"warning(" + ErrorType.FRAGMENT_ACTION_IGNORED.code + "): A.g4:7:12: fragment rule X2 contains an action or command which can never be executed\n" +
			"warning(" + ErrorType.FRAGMENT_ACTION_IGNORED.code + "): A.g4:10:9: fragment rule Y2 contains an action or command which can never be executed\n";

		String[] pair = new String[] {
			grammar,
			expected
		};

		super.testErrors(pair, true);
	}

	/**
	 * This is a regression test for antlr/antlr4#500 "Array Index Out Of
	 * Bounds".
	 * https://github.com/antlr/antlr4/issues/500
	 */
	@Test public void testTokenNamedEOF() {
		String grammar =
			"lexer grammar A;\n" +
			"WS : ' ';\n" +
			" EOF : 'a';\n";
		String expected =
			"error(" + ErrorType.RESERVED_RULE_NAME.code + "): A.g4:3:1: cannot declare a rule with reserved name EOF\n";

		String[] pair = new String[] {
			grammar,
			expected
		};

		super.testErrors(pair, true);
	}

	/**
	 * This is a regression test for antlr/antlr4#649 "unknown target causes
	 * null ptr exception.".
	 * https://github.com/antlr/antlr4/issues/649
	 * Stops before processing the lexer
	 */
	@Test public void testInvalidLanguageInGrammarWithLexerCommand() throws Exception {
		String grammar =
			"grammar T;\n" +
			"options { language=Foo; }\n" +
			"start : 'T' EOF;\n" +
			"Something : 'something' -> channel(CUSTOM);";
		String expected =
			"error(" + ErrorType.CANNOT_CREATE_TARGET_GENERATOR.code + "):  ANTLR cannot generate Foo code as of version " + Tool.VERSION + "\n";
		String[] pair = new String[] {
			grammar,
			expected
		};

		super.testErrors(pair, true);
	}

	/**
	 * This is a regression test for antlr/antlr4#649 "unknown target causes
	 * null ptr exception.".
	 * https://github.com/antlr/antlr4/issues/649
	 */
	@Test public void testInvalidLanguageInGrammar() throws Exception {
		String grammar =
			"grammar T;\n" +
			"options { language=Foo; }\n" +
			"start : 'T' EOF;\n";
		String expected =
			"error(" + ErrorType.CANNOT_CREATE_TARGET_GENERATOR.code + "):  ANTLR cannot generate Foo code as of version " + Tool.VERSION + "\n";

		String[] pair = new String[] {
			grammar,
			expected
		};

		super.testErrors(pair, true);
	}

	@Test public void testChannelDefinitionInLexer() throws Exception {
		String grammar =
			"lexer grammar T;\n" +
			"\n" +
			"channels {\n" +
			"	WHITESPACE_CHANNEL,\n" +
			"	COMMENT_CHANNEL\n" +
			"}\n" +
			"\n" +
			"COMMENT:    '//' ~[\\n]+ -> channel(COMMENT_CHANNEL);\n" +
			"WHITESPACE: [ \\t]+      -> channel(WHITESPACE_CHANNEL);\n";

		String expected = "";

		String[] pair = { grammar, expected };
		super.testErrors(pair, true);
	}

	@Test public void testChannelDefinitionInParser() throws Exception {
		String grammar =
			"parser grammar T;\n" +
			"\n" +
			"channels {\n" +
			"	WHITESPACE_CHANNEL,\n" +
			"	COMMENT_CHANNEL\n" +
			"}\n" +
			"\n" +
			"start : EOF;\n";

		String expected =
			"error(" + ErrorType.CHANNELS_BLOCK_IN_PARSER_GRAMMAR.code + "): T.g4:3:0: custom channels are not supported in parser grammars\n";

		String[] pair = { grammar, expected };
		super.testErrors(pair, true);
	}

	@Test public void testChannelDefinitionInCombined() throws Exception {
		String grammar =
			"grammar T;\n" +
			"\n" +
			"channels {\n" +
			"	WHITESPACE_CHANNEL,\n" +
			"	COMMENT_CHANNEL\n" +
			"}\n" +
			"\n" +
			"start : EOF;\n" +
			"\n" +
			"COMMENT:    '//' ~[\\n]+ -> channel(COMMENT_CHANNEL);\n" +
			"WHITESPACE: [ \\t]+      -> channel(WHITESPACE_CHANNEL);\n";

		String expected =
			"warning(" + ErrorType.UNKNOWN_LEXER_CONSTANT.code + "): T.g4:10:35: rule COMMENT contains a lexer command with an unrecognized constant value; lexer interpreters may produce incorrect output\n" +
			"warning(" + ErrorType.UNKNOWN_LEXER_CONSTANT.code + "): T.g4:11:35: rule WHITESPACE contains a lexer command with an unrecognized constant value; lexer interpreters may produce incorrect output\n" +
			"error(" + ErrorType.CHANNELS_BLOCK_IN_COMBINED_GRAMMAR.code + "): T.g4:3:0: custom channels are not supported in combined grammars\n";

		String[] pair = { grammar, expected };
		super.testErrors(pair, true);
	}

	/**
	 * This is a regression test for antlr/antlr4#497 now that antlr/antlr4#309
	 * is resolved.
	 * https://github.com/antlr/antlr4/issues/497
	 * https://github.com/antlr/antlr4/issues/309
	 */
	@Test public void testChannelDefinitions() throws Exception {
		String grammar =
			"lexer grammar T;\n" +
			"\n" +
			"channels {\n" +
			"	WHITESPACE_CHANNEL,\n" +
			"	COMMENT_CHANNEL\n" +
			"}\n" +
			"\n" +
			"COMMENT:    '//' ~[\\n]+ -> channel(COMMENT_CHANNEL);\n" +
			"WHITESPACE: [ \\t]+      -> channel(WHITESPACE_CHANNEL);\n" +
			"NEWLINE:    '\\r'? '\\n' -> channel(NEWLINE_CHANNEL);";

		// WHITESPACE_CHANNEL and COMMENT_CHANNEL are defined, but NEWLINE_CHANNEL is not
		String expected =
			"warning(" + ErrorType.UNKNOWN_LEXER_CONSTANT.code + "): T.g4:10:34: rule NEWLINE contains a lexer command with an unrecognized constant value; lexer interpreters may produce incorrect output\n";

		String[] pair = { grammar, expected };
		super.testErrors(pair, true);
	}
}


text:
libpam                    = CDLL(find_library("pam"))

pam_authenticate          = libpam.pam_authenticate
pam_authenticate.restype  = c_int
pam_authenticate.argtypes = [PamHandle, c_int]

def authenticate(username, password, service='login'):
    def my_conv(n_messages, messages, p_response, app_data):
        """
        Simple conversation function that responds to any prompt where the echo is off with the supplied password
        """
        ...

    handle = PamHandle()
    conv   = PamConv(my_conv, 0)
    retval = pam_start(service, username, byref(conv), byref(handle))

    retval = pam_authenticate(handle, 0)
    return retval == 0


text:
XOBVSYSI ;; ld,mjk/alb - VistaLink Interface Implementation ; 07/27/2002  13:00
 ;;1.6;VistALink;;May 08, 2009;Build 15
 ;Per VHA directive 2004-038, this routine should not be modified.
CALLBACK(CB) ; -- init callbacks implementation
 SET CB("STARTELEMENT")="ELEST^XOBVSYSI"
 QUIT
 ;
 ; ------------------------------------------------------------------------
 ;             RPC Server: Request Message XML SAX Parser Callbacks
 ; ------------------------------------------------------------------------
ELEST(ELE,ATR) ; -- element start event handler
 IF ELE="VistaLink" DO  QUIT
 . SET XOBDATA("MODE")=$GET(ATR("mode"),"single call")
 ;
 IF ELE="Request" DO  QUIT
 . SET XOBDATA("XOB SYSTEM","TYPE")=$GET(ATR("type"),"unknown")
 . SET XOBDATA("XOB SYSTEM","ENV")=$$LOW^XLFSTR($GET(ATR("environment"),"j2se"))
 ;
 QUIT
 ;
READER(XOBUF,XOBDATA) ; -- proprietary format reader implementation
 QUIT
 ;
REQHDLR(XOBDATA) ; -- request handler implementation
 NEW TYPE
 SET TYPE=$GET(XOBDATA("XOB SYSTEM","TYPE"),"unknown")
 ;
 ; -- initialize socket partition request
 IF TYPE="initializeSocket" DO INIT(.TYPE) GOTO REQHDLRQ
 ;
 ; -- set stop flag to close socket request
 IF TYPE="closeSocket" DO CLOSE(.TYPE) GOTO REQHDLRQ
 ;
 ; -- cleanup partition request
 IF TYPE="cleanupPartition" DO CLEANUP(.TYPE) GOTO REQHDLRQ
 ;
 ; --  heartbeat request
 IF TYPE="heartbeat" DO HB(.TYPE) GOTO REQHDLRQ
 ;
 ; --  system info request
 IF TYPE="systemInfo" DO SYSINFO(.TYPE) GOTO REQHDLRQ
 ;
 ; -- failure if processing get here
 DO RESPONSE(.TYPE,"failure")
 ;
REQHDLRQ ;
 QUIT
 ;
ENV ; -- set env variable
 SET XOBSYS("ENV")=$GET(XOBDATA("XOB SYSTEM","ENV"))
 QUIT
 ;
PSTANUM ; -- set primary station number
 SET XOBSYS("PRIMARY STATION#")=$$TRUNCCH($$STA^XUAF4($$KSP^XUPARAM("INST")))
 ; note: AAC 200M is truncated to 200
 QUIT
 ;
INIT(TYPE) ; -- handle initialize request
 KILL XOBSYS
 DO ENV
 DO PSTANUM
 ;
 IF "^j2se^j2ee^.net^"[(U_XOBSYS("ENV")_U) DO
 . DO RESPONSE(.TYPE,"success",$$RATE()_$$JOB()_$$RASTO())
 ELSE  DO
 . DO RESPONSE(.TYPE,"failure")
 QUIT
 ;
CLOSE(TYPE) ; -- handle close socket request
 SET XOBSTOP=1
 DO RESPONSE(.TYPE,"success")
 QUIT
 ;
CLEANUP(TYPE) ; -- handle cleanup partition request
 ; -- unlock any pending locks
 LOCK
 ;
 ; -- clean ^TMP, ^UTILITY, ^XUTL
 DO XUTL^XUSCLEAN
 ;
 ; -- restore DUZ to connector user
 KILL DUZ
 MERGE DUZ=XOBSYS("DUZ")
 ;
 ; -- clean symbol table
 DO KILL^XOBVLL
 ;
 DO RESPONSE(.TYPE,"success")
 QUIT
 ;
DUZSV(DUZ) ; -- save initial DUZ info for session
 IF $GET(XOBSYS("ENV"))="j2ee" DO
 . KILL XOBSYS("DUZ")
 . MERGE XOBSYS("DUZ")=DUZ
 QUIT
 ;
HB(TYPE) ; -- handle heartbeat request
 DO ENV
 DO RESPONSE(.TYPE,"success",$$RATE())
 QUIT
 ;
RATE() ; -- set up rate attribute for response
 NEW XOBRATE
 ; -- get J2EE timeout value for app serv environment
 IF $GET(XOBSYS("ENV"))="j2ee" DO
 . SET XOBRATE=$$GETASTO^XOBVLIB()
 ELSE  DO
 . SET XOBRATE=$$GETRATE^XOBVLIB()
 QUIT " rate="""_XOBRATE_""""
 ;
JOB() ; -- set up $JOB attribute for response
 QUIT " mJob="""_$JOB_""""
 ;
RASTO() ; -- set up ReAuthenticated Session TimeOut
 QUIT " reAuthSessionTimeout="""_$$GETRASTO^XOBVLIB()_""""
 ;
RESPONSE(TYPE,STATUS,ATTRS) ; -- build xml response
 ; -- initialize
 DO PRE^XOBVSKT
 DO WRITE^XOBVSKT($$VLHDR^XOBVLIB(4))
 DO WRITE^XOBVSKT("<Response type="""_$GET(TYPE)_""" status="""_$GET(STATUS)_""""_$GET(ATTRS,"")_" />")
 DO WRITE^XOBVSKT($$ENVFTR^XOBVLIB())
 ; -- send eot and flush buffer
 DO POST^XOBVSKT
 QUIT
 ;
SYSINFO(TYPE) ; -- build system info response
 NEW XOBINFO,XOBELE,XOBDEFLT,XOBINTRO,XOBI
 ;
 ; -- set up default value
 SET XOBDEFLT="unknown"
 ;
 ; -- get system info array
 DO GETSINFO(.XOBINFO)
 ;
 ; -- build <SystemInfo> element
 SET XOBELE="<SystemInfo"
 SET XOBELE=XOBELE_" vistalinkVersion="""_$GET(XOBINFO("version"),XOBDEFLT)_""""
 SET XOBELE=XOBELE_" vistalinkBuild="""_$GET(XOBINFO("build"),XOBDEFLT)_""""
 SET XOBELE=XOBELE_" appServerTimeout="""_$GET(XOBINFO("appServerTimeout"),XOBDEFLT)_""""
 SET XOBELE=XOBELE_" reAuthSessionTimeout="""_$GET(XOBINFO("reAuthSessionTimeout"),XOBDEFLT)_""""
 SET XOBELE=XOBELE_" uci="""_$GET(XOBINFO("uci"),XOBDEFLT)_""""
 SET XOBELE=XOBELE_" vol="""_$GET(XOBINFO("vol"),XOBDEFLT)_""""
 SET XOBELE=XOBELE_" boxVolume="""_$GET(XOBINFO("boxVolume"),XOBDEFLT)_""""
 SET XOBELE=XOBELE_" mVersion="""_$GET(XOBINFO("mVersion"),XOBDEFLT)_""""
 SET XOBELE=XOBELE_" operatingSystem="""_$GET(XOBINFO("operatingSystem"),XOBDEFLT)_""""
 SET XOBELE=XOBELE_" domainName="""_$GET(XOBINFO("domainName"),XOBDEFLT)_""""
 SET XOBELE=XOBELE_" vistaProduction="""_$GET(XOBINFO("vistaProduction"),XOBDEFLT)_""""
 SET XOBELE=XOBELE_" defaultInstitution="""_$GET(XOBINFO("defaultInstitution"),XOBDEFLT)_""""
 SET XOBELE=XOBELE_" cpName="""_$GET(XOBINFO("cpName"),XOBDEFLT)_""""
 SET XOBELE=XOBELE_" />"
 ;
 SET XOBINTRO=$GET(XOBINFO("introductoryText"))
 ;
 ; -- build and send complete message
 DO PRE^XOBVSKT
 DO WRITE^XOBVSKT($$VLHDR^XOBVLIB(4))
 DO WRITE^XOBVSKT("<Response type="""_$GET(TYPE)_""" status=""success"" >")
 DO WRITE^XOBVSKT(XOBELE)
 FOR XOBI=1:1  QUIT:'$DATA(XOBINFO("introductoryText",XOBI))  DO
 . DO WRITE^XOBVSKT(XOBINFO("introductoryText",XOBI))
 DO WRITE^XOBVSKT("</Response>")
 DO WRITE^XOBVSKT($$ENVFTR^XOBVLIB())
 DO POST^XOBVSKT
 ;
 QUIT
 ;
GETSINFO(XOBINFO) ; -- gather system info into array
 NEW X,Y
 ;
 ; -- get version
 SET XOBINFO("version")=$PIECE($TEXT(XOBVSYSI+1),";",3)
 ;
 ; -- get build number
 SET XOBINFO("build")=$PIECE($TEXT(XOBVSYSI+1),";",7)
 ;
 ; -- get application server connection timeout
 SET XOBINFO("appServerTimeout")=$$GETASTO^XOBVLIB()
 ;
 ; -- get reauthentication session timeout
 SET XOBINFO("reAuthSessionTimeout")=$$GETRASTO^XOBVLIB()
 ;
 ; -- get basic M environment information
 SET Y=""
 DO GETENV^%ZOSV
 ;
 ; -- get uci
 SET XOBINFO("uci")=$PIECE(Y,U,1)
 ;
 ; -- get vol
 SET XOBINFO("vol")=$PIECE(Y,U,2)
 ;
 ; -- get box volume
 SET XOBINFO("boxVolume")=$PIECE(Y,U,4)
 ;
 ; -- get M version (full name)
 SET XOBINFO("mVersion")=$$SYMENC^MXMLUTL($$VERSION^%ZOSV(1))
 ;
 ; -- get operating system
 SET XOBINFO("operatingSystem")=$$SYMENC^MXMLUTL($$SYSOS^XOBVLIB(XOBOS))
 ;
 ; -- get domain name
 SET XOBINFO("domainName")=$$SYMENC^MXMLUTL($$KSP^XUPARAM("WHERE"))
 ;
 ; -- production or test
 SET XOBINFO("vistaProduction")=$S($$PROD^XUPROD(0):"true",1:"false")
 ;
 ; -- default institution
 SET XOBINFO("defaultInstitution")=$$SYMENC^MXMLUTL($$STA^XUAF4($$KSP^XUPARAM("INST"))_"/"_$$NAME^XUAF4($$KSP^XUPARAM("INST")))
 ;
 ; -- get intro text
 D GETINTRO^XOBSCAV2("XOBINFO(""introductoryText"")",1)
 ;
 ; -- get c/p username
 SET XOBINFO("cpName")=$$NAME^XUSER(DUZ)
 ;
 QUIT
 ;
RPC(XOBY) ;
 NEW XOBX,XOBLINE,XOBARR
 D GETSINFO(.XOBARR)
 SET XOBLINE=0
 S XOBX="" F  S XOBX=$O(XOBARR(XOBX)) Q:XOBX']""  D
 . SET XOBLINE=XOBLINE+1
 . SET XOBY(XOBLINE)=XOBX_"~"_XOBARR(XOBX)
 QUIT
 ;
TRUNCCH(XOBSTR) ; truncate before first non-numeric char
 NEW XOBI,XOBSTOP,XOBSTR1
 SET XOBSTOP=0,XOBSTR1=""
 FOR XOBI=1:1:$L(XOBSTR) QUIT:XOBSTOP  DO
 . IF "0123456789"'[$E(XOBSTR,XOBI) SET XOBSTOP=1 QUIT
 . SET XOBSTR1=XOBSTR1_$E(XOBSTR,XOBI)
 QUIT XOBSTR1


text:
#ifndef	_NE500DEVICECHANNEL_H_
#define _NE500DEVICECHANNEL_H_

BEGIN_NAMESPACE_MW

class NE500DeviceChannel : public Component {

public:
    using SendFunction = std::function<bool(const std::string &, std::string)>;

    static const std::string CAPABILITY;
    static const std::string SYRINGE_DIAMETER;
    static const std::string FLOW_RATE;
    static const std::string RATE_UNIT;
    static const std::string VARIABLE;
    static const std::string VOLUME_UNIT;

    static void describeComponent(ComponentInfo &info);

    explicit NE500DeviceChannel(const ParameterValueMap &parameters);

    const VariablePtr& getVariable() const {
        return volume;
    }

    bool initialize(const SendFunction &sendMessage);
    bool update(const SendFunction &sendMessage);
    bool dispense(const SendFunction &sendMessage);

private:
    enum class Direction {
        Infuse,
        Withdraw
    };

    static std::string formatFloat(double val);

    double getCurrentRate() const {
        return rate->getValue().getFloat();
    }

    double getCurrentVolume() const {
        return volume->getValue().getFloat();
    }

    Direction getCurrentDirection(double currentVolume) const {
        return (currentVolume >= 0.0 ? Direction::Infuse : Direction::Withdraw);
    }

    bool setRate(const SendFunction &sendMessage, double currentRate);
    bool setVolume(const SendFunction &sendMessage, double currentVolume);
    bool setDirection(const SendFunction &sendMessage, Direction currentDirection);

    const std::string pump_id;
    const double syringe_diameter;
    const VariablePtr rate;
    const std::string rateUnit;
    const VariablePtr volume;
    const std::string volumeUnit;

    double previousRate;
    double previousAbsVolume;
    Direction previousDirection;

};

END_NAMESPACE_MW

#endif


text:
FOUNDATION_EXPORT double MFSliderVersionNumber;

//! Project version string for MFSlider.
FOUNDATION_EXPORT const unsigned char MFSliderVersionString[];

// In this header, you should import all the public headers of your framework using statements like #import <MFSlider/PublicHeader.h>


text:
#ifndef _PIN_MANAGER_H
#define _PIN_MANAGER_H
/**
    Section: Includes
*/
#include <xc.h>
/**
    Section: Device Pin Macros
*/
/**
  @Summary
    Sets the GPIO pin, RB5, high using LATBbits.LATB5.

  @Description
    Sets the GPIO pin, RB5, high using LATBbits.LATB5.

  @Preconditions
    The RB5 must be set to an output.

  @Returns
    None.

  @Param
    None.

  @Example

    // Set RB5 high (1)
    IO_RB5_SetHigh();

*/
#define IO_RB5_SetHigh()          ( LATBSET = (1 << 5) )
/**
  @Summary
    Sets the GPIO pin, RB5, low using LATBbits.LATB5.

  @Description
    Sets the GPIO pin, RB5, low using LATBbits.LATB5.

  @Preconditions
    The RB5 must be set to an output.

  @Returns
    None.

  @Param
    None.

  @Example

    // Set RB5 low (0)
    IO_RB5_SetLow();

*/
#define IO_RB5_SetLow()           ( LATBCLR = (1 << 5) )
/**
  @Summary
    Toggles the GPIO pin, RB5, using LATBbits.LATB5.

  @Description
    Toggles the GPIO pin, RB5, using LATBbits.LATB5.

  @Preconditions
    The RB5 must be set to an output.

  @Returns
    None.

  @Param
    None.

  @Example

    // Toggle RB5
    IO_RB5_Toggle();

*/
#define IO_RB5_Toggle()           ( LATBINV = (1 << 5) )
/**
  @Summary
    Reads the value of the GPIO pin, RB5.

  @Description
    Reads the value of the GPIO pin, RB5.

  @Preconditions
    None.

  @Returns
    None.

  @Param
    None.

  @Example

    uint16_t portValue;

    // Read RB5
    postValue = IO_RB5_GetValue();

*/
#define IO_RB5_GetValue()         PORTBbits.RB5
/**
  @Summary
    Configures the GPIO pin, RB5, as an input.

  @Description
    Configures the GPIO pin, RB5, as an input.

  @Preconditions
    None.

  @Returns
    None.

  @Param
    None.

  @Example

    // Sets the RB5 as an input
    IO_RB5_SetDigitalInput();

*/
#define IO_RB5_SetDigitalInput()   ( TRISBSET = (1 << 5) )
/**
  @Summary
    Configures the GPIO pin, RB5, as an output.

  @Description
    Configures the GPIO pin, RB5, as an output.

  @Preconditions
    None.

  @Returns
    None.

  @Param
    None.

  @Example

    // Sets the RB5 as an output
    IO_RB5_SetDigitalOutput();

*/
#define IO_RB5_SetDigitalOutput()   ( TRISBCLR = (1 << 5) )
/**
  @Summary
    Sets the GPIO pin, RB7, high using LATBbits.LATB7.

  @Description
    Sets the GPIO pin, RB7, high using LATBbits.LATB7.

  @Preconditions
    The RB7 must be set to an output.

  @Returns
    None.

  @Param
    None.

  @Example

    // Set RB7 high (1)
    TG_MCLR_SetHigh();

*/
#define TG_MCLR_SetHigh()          ( LATBSET = (1 << 7) )
/**
  @Summary
    Sets the GPIO pin, RB7, low using LATBbits.LATB7.

  @Description
    Sets the GPIO pin, RB7, low using LATBbits.LATB7.

  @Preconditions
    The RB7 must be set to an output.

  @Returns
    None.

  @Param
    None.

  @Example

    // Set RB7 low (0)
    TG_MCLR_SetLow();

*/
#define TG_MCLR_SetLow()           ( LATBCLR = (1 << 7) )
/**
  @Summary
    Toggles the GPIO pin, RB7, using LATBbits.LATB7.

  @Description
    Toggles the GPIO pin, RB7, using LATBbits.LATB7.

  @Preconditions
    The RB7 must be set to an output.

  @Returns
    None.

  @Param
    None.

  @Example

    // Toggle RB7
    TG_MCLR_Toggle();

*/
#define TG_MCLR_Toggle()           ( LATBINV = (1 << 7) )
/**
  @Summary
    Reads the value of the GPIO pin, RB7.

  @Description
    Reads the value of the GPIO pin, RB7.

  @Preconditions
    None.

  @Returns
    None.

  @Param
    None.

  @Example

    uint16_t portValue;

    // Read RB7
    postValue = TG_MCLR_GetValue();

*/
#define TG_MCLR_GetValue()         PORTBbits.RB7
/**
  @Summary
    Configures the GPIO pin, RB7, as an input.

  @Description
    Configures the GPIO pin, RB7, as an input.

  @Preconditions
    None.

  @Returns
    None.

  @Param
    None.

  @Example

    // Sets the RB7 as an input
    TG_MCLR_SetDigitalInput();

*/
#define TG_MCLR_SetDigitalInput()   ( TRISBSET = (1 << 7) )
/**
  @Summary
    Configures the GPIO pin, RB7, as an output.

  @Description
    Configures the GPIO pin, RB7, as an output.

  @Preconditions
    None.

  @Returns
    None.

  @Param
    None.

  @Example

    // Sets the RB7 as an output
    TG_MCLR_SetDigitalOutput();

*/
#define TG_MCLR_SetDigitalOutput()   ( TRISBCLR = (1 << 7) )
/**
  @Summary
    Sets the GPIO pin, RB8, high using LATBbits.LATB8.

  @Description
    Sets the GPIO pin, RB8, high using LATBbits.LATB8.

  @Preconditions
    The RB8 must be set to an output.

  @Returns
    None.

  @Param
    None.

  @Example

    // Set RB8 high (1)
    SCK1_SetHigh();

*/
#define SCK1_SetHigh()          ( LATBSET = (1 << 8) )
/**
  @Summary
    Sets the GPIO pin, RB8, low using LATBbits.LATB8.

  @Description
    Sets the GPIO pin, RB8, low using LATBbits.LATB8.

  @Preconditions
    The RB8 must be set to an output.

  @Returns
    None.

  @Param
    None.

  @Example

    // Set RB8 low (0)
    SCK1_SetLow();

*/
#define SCK1_SetLow()           ( LATBCLR = (1 << 8) )
/**
  @Summary
    Toggles the GPIO pin, RB8, using LATBbits.LATB8.

  @Description
    Toggles the GPIO pin, RB8, using LATBbits.LATB8.

  @Preconditions
    The RB8 must be set to an output.

  @Returns
    None.

  @Param
    None.

  @Example

    // Toggle RB8
    SCK1_Toggle();

*/
#define SCK1_Toggle()           ( LATBINV = (1 << 8) )
/**
  @Summary
    Reads the value of the GPIO pin, RB8.

  @Description
    Reads the value of the GPIO pin, RB8.

  @Preconditions
    None.

  @Returns
    None.

  @Param
    None.

  @Example

    uint16_t portValue;

    // Read RB8
    postValue = SCK1_GetValue();

*/
#define SCK1_GetValue()         PORTBbits.RB8
/**
  @Summary
    Configures the GPIO pin, RB8, as an input.

  @Description
    Configures the GPIO pin, RB8, as an input.

  @Preconditions
    None.

  @Returns
    None.

  @Param
    None.

  @Example

    // Sets the RB8 as an input
    SCK1_SetDigitalInput();

*/
#define SCK1_SetDigitalInput()   ( TRISBSET = (1 << 8) )
/**
  @Summary
    Configures the GPIO pin, RB8, as an output.

  @Description
    Configures the GPIO pin, RB8, as an output.

  @Preconditions
    None.

  @Returns
    None.

  @Param
    None.

  @Example

    // Sets the RB8 as an output
    SCK1_SetDigitalOutput();

*/
#define SCK1_SetDigitalOutput()   ( TRISBCLR = (1 << 8) )
/**
  @Summary
    Sets the GPIO pin, RB9, high using LATBbits.LATB9.

  @Description
    Sets the GPIO pin, RB9, high using LATBbits.LATB9.

  @Preconditions
    The RB9 must be set to an output.

  @Returns
    None.

  @Param
    None.

  @Example

    // Set RB9 high (1)
    SDO1_SetHigh();

*/
#define SDO1_SetHigh()          ( LATBSET = (1 << 9) )
/**
  @Summary
    Sets the GPIO pin, RB9, low using LATBbits.LATB9.

  @Description
    Sets the GPIO pin, RB9, low using LATBbits.LATB9.

  @Preconditions
    The RB9 must be set to an output.

  @Returns
    None.

  @Param
    None.

  @Example

    // Set RB9 low (0)
    SDO1_SetLow();

*/
#define SDO1_SetLow()           ( LATBCLR = (1 << 9) )
/**
  @Summary
    Toggles the GPIO pin, RB9, using LATBbits.LATB9.

  @Description
    Toggles the GPIO pin, RB9, using LATBbits.LATB9.

  @Preconditions
    The RB9 must be set to an output.

  @Returns
    None.

  @Param
    None.

  @Example

    // Toggle RB9
    SDO1_Toggle();

*/
#define SDO1_Toggle()           ( LATBINV = (1 << 9) )
/**
  @Summary
    Reads the value of the GPIO pin, RB9.

  @Description
    Reads the value of the GPIO pin, RB9.

  @Preconditions
    None.

  @Returns
    None.

  @Param
    None.

  @Example

    uint16_t portValue;

    // Read RB9
    postValue = SDO1_GetValue();

*/
#define SDO1_GetValue()         PORTBbits.RB9
/**
  @Summary
    Configures the GPIO pin, RB9, as an input.

  @Description
    Configures the GPIO pin, RB9, as an input.

  @Preconditions
    None.

  @Returns
    None.

  @Param
    None.

  @Example

    // Sets the RB9 as an input
    SDO1_SetDigitalInput();

*/
#define SDO1_SetDigitalInput()   ( TRISBSET = (1 << 9) )
/**
  @Summary
    Configures the GPIO pin, RB9, as an output.

  @Description
    Configures the GPIO pin, RB9, as an output.

  @Preconditions
    None.

  @Returns
    None.

  @Param
    None.

  @Example

    // Sets the RB9 as an output
    SDO1_SetDigitalOutput();

*/
#define SDO1_SetDigitalOutput()   ( TRISBCLR = (1 << 9) )
/**
  @Summary
    Sets the GPIO pin, RC9, high using LATCbits.LATC9.

  @Description
    Sets the GPIO pin, RC9, high using LATCbits.LATC9.

  @Preconditions
    The RC9 must be set to an output.

  @Returns
    None.

  @Param
    None.

  @Example

    // Set RC9 high (1)
    IO_RC9_SetHigh();

*/
#define IO_RC9_SetHigh()          ( LATCSET = (1 << 9) )
/**
  @Summary
    Sets the GPIO pin, RC9, low using LATCbits.LATC9.

  @Description
    Sets the GPIO pin, RC9, low using LATCbits.LATC9.

  @Preconditions
    The RC9 must be set to an output.

  @Returns
    None.

  @Param
    None.

  @Example

    // Set RC9 low (0)
    IO_RC9_SetLow();

*/
#define IO_RC9_SetLow()           ( LATCCLR = (1 << 9) )
/**
  @Summary
    Toggles the GPIO pin, RC9, using LATCbits.LATC9.

  @Description
    Toggles the GPIO pin, RC9, using LATCbits.LATC9.

  @Preconditions
    The RC9 must be set to an output.

  @Returns
    None.

  @Param
    None.

  @Example

    // Toggle RC9
    IO_RC9_Toggle();

*/
#define IO_RC9_Toggle()           ( LATCINV = (1 << 9) )
/**
  @Summary
    Reads the value of the GPIO pin, RC9.

  @Description
    Reads the value of the GPIO pin, RC9.

  @Preconditions
    None.

  @Returns
    None.

  @Param
    None.

  @Example

    uint16_t portValue;

    // Read RC9
    postValue = IO_RC9_GetValue();

*/
#define IO_RC9_GetValue()         PORTCbits.RC9
/**
  @Summary
    Configures the GPIO pin, RC9, as an input.

  @Description
    Configures the GPIO pin, RC9, as an input.

  @Preconditions
    None.

  @Returns
    None.

  @Param
    None.

  @Example

    // Sets the RC9 as an input
    IO_RC9_SetDigitalInput();

*/
#define IO_RC9_SetDigitalInput()   ( TRISCSET = (1 << 9) )
/**
  @Summary
    Configures the GPIO pin, RC9, as an output.

  @Description
    Configures the GPIO pin, RC9, as an output.

  @Preconditions
    None.

  @Returns
    None.

  @Param
    None.

  @Example

    // Sets the RC9 as an output
    IO_RC9_SetDigitalOutput();

*/
#define IO_RC9_SetDigitalOutput()   ( TRISCCLR = (1 << 9) )

/**
    Section: Function Prototypes
*/
/**
  @Summary
    Configures the pin settings of the PIC32MM0064GPL028
    The peripheral pin select, PPS, configuration is also handled by this manager.

  @Description
    This is the generated manager file for the MPLAB(c) Code Configurator device.  This manager
    configures the pins direction, initial state, analog setting.
    The peripheral pin select, PPS, configuration is also handled by this manager.

  @Preconditions
    None.

  @Returns
    None.

  @Param
    None.

  @Example

    void SYSTEM_Initialize(void)
    {
        // Other initializers are called from this function
        PIN_MANAGER_Initialize();
    }

*/
void PIN_MANAGER_Initialize(void);

#endif


text:
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"><url>
     <loc>https://lorensen.github.io/VTKExamples/site/</loc>
     <lastmod>2021-03-31</lastmod>
     <changefreq>daily</changefreq>
    </url>
</urlset>


text:
.. _analysis-page:

*********************
Kernel trace analysis
*********************

Introduction
============

LISA comes with a plethora of analysis functions based on `Ftrace
<https://www.kernel.org/doc/Documentation/trace/ftrace.txt>`_ traces. We
convert the trace events into :class:`pandas.DataFrame` which are suited to
handling mid-sized data sets.

Trace
=====

Our :class:`~lisa.trace.Trace` takes an Ftrace ``trace.dat`` file as input
(Systrace ``trace.html`` are also accepted, but mileage may vary since it's an
intrinsically ambiguous format), and provides access to both the raw trace
events, as well as some new :class:`pandas.DataFrame` built from analysing and
aggregating trace events.

You can create one like so::

  trace = Trace("path/to/trace.dat")

Raw trace events can be accessed like this::

  trace.df_event("sched_switch")

Whereas analysis dataframes can be obtained like that::

  # trace.ana.<analysis name>.<analysis method>
  trace.ana.tasks.df_tasks_states()

.. seealso:: See the :class:`~lisa.trace.Trace` documentation for more details.

Available analysis
==================

Dataframes
++++++++++

The majority of these dataframes are time-indexed (and if they aren't, it will
be called out in the docstring). This makes it easy to create dataframe slices
to study specific trace windows.

.. exec::
    from lisa._doc.helpers import get_analysis_list
    print(get_analysis_list("df"))

Plots
+++++

When run in a notebook, these plots will be displayed automatically. By default,
they are also saved in the same directory as your ``trace.dat``

.. exec::
    from lisa._doc.helpers import get_analysis_list
    print(get_analysis_list("plot"))

API
===

Trace
+++++

.. autoclass:: lisa.trace.Trace
   :members:

.. automodule:: lisa.trace
   :members:
   :exclude-members: Trace, TraceParserBase, EventParserBase, TxtTraceParserBase, MetaTxtTraceParser, TxtTraceParser, SimpleTxtTraceParser, HRTxtTraceParser, SysTraceParser, TxtEventParser, CustomFieldsTxtEventParser, PrintTxtEventParser, TrappyTraceParser

Analysis proxy
++++++++++++++

.. automodule:: lisa.analysis._proxy
   :members:

Analysis base class
+++++++++++++++++++

.. automodule:: lisa.analysis.base
   :members:

Load tracking
+++++++++++++

.. automodule:: lisa.analysis.load_tracking
   :members:

CPUs
++++

.. automodule:: lisa.analysis.cpus
   :members:

Frequency
+++++++++

.. automodule:: lisa.analysis.frequency
   :members:

Tasks
+++++

.. These two autoclasses should not be necessary, but sphinx doesn't seem
   to like Enums and refuses to do anything with TaskState unless explicetely
   told to.

.. autoclass:: lisa.analysis.tasks.StateInt
   :members:

.. autoclass:: lisa.analysis.tasks.TaskState
   :members:

.. automodule:: lisa.analysis.tasks
   :members:
   :exclude-members: StateInt, TaskState

rt-app
++++++

.. automodule:: lisa.analysis.rta
   :members:

Idle
++++

.. automodule:: lisa.analysis.idle
   :members:

Latency
+++++++

.. automodule:: lisa.analysis.latency
   :members:

Status
++++++

.. automodule:: lisa.analysis.status
   :members:

Thermal
+++++++

.. automodule:: lisa.analysis.thermal
   :members:

Function profiling
++++++++++++++++++

.. automodule:: lisa.analysis.functions
   :members:

Interactive notebook helper
+++++++++++++++++++++++++++

.. automodule:: lisa.analysis.notebook
   :members:

Trace parsers
+++++++++++++

.. note:: :class:`lisa.trace.Trace` is the class to use to manipulate a trace
    file, trace parsers are backend objects that are usually not
    manipulated by the user.

.. autoclass:: lisa.trace.TraceParserBase
   :members:

.. autoclass:: lisa.trace.EventParserBase
   :members:

.. autoclass:: lisa.trace.TxtTraceParserBase
   :members:

.. autoclass:: lisa.trace.TxtTraceParser
   :members:

.. autoclass:: lisa.trace.MetaTxtTraceParser
   :members:

.. autoclass:: lisa.trace.SimpleTxtTraceParser
   :members:

.. autoclass:: lisa.trace.HRTxtTraceParser
   :members:

.. autoclass:: lisa.trace.SysTraceParser
   :members:

.. autoclass:: lisa.trace.TxtEventParser
   :members:

.. autoclass:: lisa.trace.CustomFieldsTxtEventParser
   :members:

.. autoclass:: lisa.trace.PrintTxtEventParser
   :members:

.. autoclass:: lisa.trace.TrappyTraceParser
   :members:


text:
using System;

using NLog;

namespace Tabby.Terminal.Logger
{
    public class UiNlogLogger : ILogger
    {
        private static readonly NLog.Logger _instance;

        static UiNlogLogger()
        {
            LogManager.ReconfigExistingLoggers();
            _instance = LogManager.GetCurrentClassLogger();
        }

        public void Error(string message)
        {
            _instance.Error(message);
        }

        public void Info(string message)
        {
            _instance.Info(message);
        }

        public void Trace(string message)
        {
            _instance.Trace(message);
        }
    }
}


text:
package de.saxsys.svgfx.core.utils;

import java.util.Optional;

/**
 * Simple wrapper class to wraps an object. The wrapper is not immutable and the object can be changed.
 *
 * @param <T> the type of the object that is being wrapped.
 *
 * @author Xyanid on 08.04.2017.
 */
public class Wrapper<T> {

    // region Fields

    /**
     * The current object that is being wrapped if any.
     */
    private T object;

    // endregion

    // region Constructor

    public Wrapper() {}

    public Wrapper(final T object) {
        this.object = object;
    }

    // endregion

    // region Getter/Setter

    /**
     * Returns a {@link Optional} containing the {@link #object}.
     *
     * @return a new {@link Optional} containing the {@link #object}.
     */
    public Optional<T> getOptional() {
        return Optional.ofNullable(object);
    }

    /**
     * Returns the {@link #object} only if it is not null, otherwise an {@link IllegalStateException} will be thrown.
     *
     * @return the {@link #object}.
     *
     * @throws IllegalStateException if the {@link #object} is null.
     */
    public T getOrFail() {
        if (object == null) {
            throw new IllegalStateException("Can not request argument when it is not set");
        }
        return get();
    }

    /**
     * Returns the {@link #object}.
     *
     * @return the {@link #object}.
     */
    public T get() {
        return object;
    }

    /**
     * Set the {@link #object}.
     *
     * @param object the value to use.
     */
    public void set(T object) {
        this.object = object;
    }

    // endregion
}


text:
namespace cc {

scoped_refptr<NinePatchLayer> NinePatchLayer::Create() {
  return base::WrapRefCounted(new NinePatchLayer());
}

NinePatchLayer::NinePatchLayer()
    : UIResourceLayer(), fill_center_(false), nearest_neighbor_(false) {}

NinePatchLayer::~NinePatchLayer() = default;

std::unique_ptr<LayerImpl> NinePatchLayer::CreateLayerImpl(
    LayerTreeImpl* tree_impl) const {
  return NinePatchLayerImpl::Create(tree_impl, id());
}

void NinePatchLayer::SetBorder(const gfx::Rect& border) {
  if (border == border_.Read(*this))
    return;
  border_.Write(*this) = border;
  SetNeedsCommit();
}

void NinePatchLayer::SetAperture(const gfx::Rect& aperture) {
  if (image_aperture_.Read(*this) == aperture)
    return;

  image_aperture_.Write(*this) = aperture;
  SetNeedsCommit();
}

void NinePatchLayer::SetFillCenter(bool fill_center) {
  if (fill_center_.Read(*this) == fill_center)
    return;

  fill_center_.Write(*this) = fill_center;
  SetNeedsCommit();
}

void NinePatchLayer::SetNearestNeighbor(bool nearest_neighbor) {
  if (nearest_neighbor_.Read(*this) == nearest_neighbor)
    return;

  nearest_neighbor_.Write(*this) = nearest_neighbor;
  SetNeedsCommit();
}

void NinePatchLayer::SetLayerOcclusion(const gfx::Rect& occlusion) {
  if (layer_occlusion_.Read(*this) == occlusion)
    return;

  layer_occlusion_.Write(*this) = occlusion;
  SetNeedsCommit();
}

void NinePatchLayer::PushPropertiesTo(
    LayerImpl* layer,
    const CommitState& commit_state,
    const ThreadUnsafeCommitState& unsafe_state) {
  UIResourceLayer::PushPropertiesTo(layer, commit_state, unsafe_state);
  TRACE_EVENT0("cc", "NinePatchLayer::PushPropertiesTo");
  NinePatchLayerImpl* layer_impl = static_cast<NinePatchLayerImpl*>(layer);

  if (resource_id()) {
    DCHECK(IsAttached());
    layer_impl->SetLayout(image_aperture_.Read(*this), border_.Read(*this),
                          layer_occlusion_.Read(*this),
                          fill_center_.Read(*this),
                          nearest_neighbor_.Read(*this));
  }
}

}  // namespace cc