text:
//          Copyright Oliver Kowalke 2009.
// Distributed under the Boost Software License, Version 1.0.
//    (See accompanying file LICENSE_1_0.txt or copy at
//          http://www.boost.org/LICENSE_1_0.txt)

#ifndef BOOST_COROUTINES_DETAIL_COROUTINE_BASE_RESUME_H
#define BOOST_COROUTINES_DETAIL_COROUTINE_BASE_RESUME_H

#include <iterator>

#include <boost/assert.hpp>
#include <boost/config.hpp>
#include <boost/context/fcontext.hpp>
#include <boost/optional.hpp>
#include <boost/preprocessor/arithmetic/add.hpp>
#include <boost/preprocessor/arithmetic/sub.hpp>
#include <boost/preprocessor/cat.hpp>
#include <boost/preprocessor/punctuation/comma_if.hpp>
#include <boost/preprocessor/repetition/repeat_from_to.hpp>
#include <boost/range.hpp>

#include <boost/coroutine/detail/arg.hpp>
#include <boost/coroutine/detail/config.hpp>
#include <boost/coroutine/detail/exceptions.hpp>
#include <boost/coroutine/detail/holder.hpp>

#ifdef BOOST_HAS_ABI_HEADERS
#  include BOOST_ABI_PREFIX
#endif

namespace boost {
namespace coroutines {
namespace detail {

template< typename Signature, typename D, typename Result, int arity >
class coroutine_base_resume;

template< typename Signature, typename D >
class coroutine_base_resume< Signature, D, void, 0 >
{
public:
    void resume()
    {
        BOOST_ASSERT( static_cast< D * >( this)->callee_);

        holder< void > hldr_to( & static_cast< D * >( this)->caller_);
        holder< void > * hldr_from(
            reinterpret_cast< holder< void > * >( context::jump_fcontext(
            hldr_to.ctx,
            static_cast< D * >( this)->callee_,
            reinterpret_cast< intptr_t >( & hldr_to),
            static_cast< D * >( this)->preserve_fpu() ) ) );
        static_cast< D * >( this)->callee_ = hldr_from->ctx;
        if ( hldr_from->force_unwind) throw forced_unwind();
        if ( static_cast< D * >( this)->except_)
            rethrow_exception( static_cast< D * >( this)->except_);
    }
};

template< typename Signature, typename D, typename Result >
class coroutine_base_resume< Signature, D, Result, 0 >
{
public:
    void resume()
    {
        BOOST_ASSERT( static_cast< D * >( this));
        BOOST_ASSERT( ! static_cast< D * >( this)->is_complete() );
        BOOST_ASSERT( static_cast< D * >( this)->callee_);

        holder< void > hldr_to( & static_cast< D * >( this)->caller_);
        holder< Result > * hldr_from(
            reinterpret_cast< holder< Result > * >( context::jump_fcontext(
            hldr_to.ctx,
            static_cast< D * >( this)->callee_,
            reinterpret_cast< intptr_t >( & hldr_to),
            static_cast< D * >( this)->preserve_fpu() ) ) );
        static_cast< D * >( this)->callee_ = hldr_from->ctx;
        result_ = hldr_from->data;
        if ( hldr_from->force_unwind) throw forced_unwind();
        if ( static_cast< D * >( this)->except_)
            rethrow_exception( static_cast< D * >( this)->except_);
    }

protected:
    template< typename X, typename Y, int >
    friend struct coroutine_get;

    optional< Result >  result_;
};

template< typename Signature, typename D >
class coroutine_base_resume< Signature, D, void, 1 >
{
public:
    typedef typename arg< Signature >::type     arg_type;

    void resume( arg_type a1)
    {
        BOOST_ASSERT( static_cast< D * >( this));
        BOOST_ASSERT( ! static_cast< D * >( this)->is_complete() );
        BOOST_ASSERT( static_cast< D * >( this)->callee_);

        holder< arg_type > hldr_to( & static_cast< D * >( this)->caller_, a1);
        holder< void > * hldr_from(
            reinterpret_cast< holder< void > * >( context::jump_fcontext(
            hldr_to.ctx,
            static_cast< D * >( this)->callee_,
            reinterpret_cast< intptr_t >( & hldr_to),
            static_cast< D * >( this)->preserve_fpu() ) ) );
        static_cast< D * >( this)->callee_ = hldr_from->ctx;
        if ( hldr_from->force_unwind) throw forced_unwind();
        if ( static_cast< D * >( this)->except_)
            rethrow_exception( static_cast< D * >( this)->except_);
    }
};

template< typename Signature, typename D, typename Result >
class coroutine_base_resume< Signature, D, Result, 1 >
{
public:
    typedef typename arg< Signature >::type     arg_type;

    void resume( arg_type a1)
    {
        BOOST_ASSERT( static_cast< D * >( this));
        BOOST_ASSERT( ! static_cast< D * >( this)->is_complete() );
        BOOST_ASSERT( static_cast< D * >( this)->callee_);

        context::fcontext_t caller;
        holder< arg_type > hldr_to( & static_cast< D * >( this)->caller_, a1);
        holder< Result > * hldr_from(
            reinterpret_cast< holder< Result > * >( context::jump_fcontext(
            hldr_to.ctx,
            static_cast< D * >( this)->callee_,
            reinterpret_cast< intptr_t >( & hldr_to),
            static_cast< D * >( this)->preserve_fpu() ) ) );
        static_cast< D * >( this)->callee_ = hldr_from->ctx;
        result_ = hldr_from->data;
        if ( hldr_from->force_unwind) throw forced_unwind();
        if ( static_cast< D * >( this)->except_)
            rethrow_exception( static_cast< D * >( this)->except_);
    }

protected:
    template< typename X, typename Y, int >
    friend struct coroutine_get;

    optional< Result >  result_;
};

#define BOOST_COROUTINE_BASE_RESUME_COMMA(n) BOOST_PP_COMMA_IF(BOOST_PP_SUB(n,1))
#define BOOST_COROUTINE_BASE_RESUME_VAL(z,n,unused) BOOST_COROUTINE_BASE_RESUME_COMMA(n) BOOST_PP_CAT(a,n)
#define BOOST_COROUTINE_BASE_RESUME_VALS(n) BOOST_PP_REPEAT_FROM_TO(1,BOOST_PP_ADD(n,1),BOOST_COROUTINE_BASE_RESUME_VAL,~)
#define BOOST_COROUTINE_BASE_RESUME_ARG_TYPE(n) \
    typename function_traits< Signature >::BOOST_PP_CAT(BOOST_PP_CAT(arg,n),_type)
#define BOOST_COROUTINE_BASE_RESUME_ARG(z,n,unused) BOOST_COROUTINE_BASE_RESUME_COMMA(n) BOOST_COROUTINE_BASE_RESUME_ARG_TYPE(n) BOOST_PP_CAT(a,n)
#define BOOST_COROUTINE_BASE_RESUME_ARGS(n) BOOST_PP_REPEAT_FROM_TO(1,BOOST_PP_ADD(n,1),BOOST_COROUTINE_BASE_RESUME_ARG,~)
#define BOOST_COROUTINE_BASE_RESUME(z,n,unused) \
template< typename Signature, typename D > \
class coroutine_base_resume< Signature, D, void, n > \
{ \
public: \
    typedef typename arg< Signature >::type     arg_type; \
\
    void resume( BOOST_COROUTINE_BASE_RESUME_ARGS(n)) \
    { \
        BOOST_ASSERT( static_cast< D * >( this)); \
        BOOST_ASSERT( ! static_cast< D * >( this)->is_complete() ); \
        BOOST_ASSERT( static_cast< D * >( this)->callee_); \
\
        holder< arg_type > hldr_to( \
            & static_cast< D * >( this)->caller_, \
            arg_type(BOOST_COROUTINE_BASE_RESUME_VALS(n) ) ); \
        holder< void > * hldr_from( \
            reinterpret_cast< holder< void > * >( context::jump_fcontext( \
                hldr_to.ctx, \
                static_cast< D * >( this)->callee_, \
                reinterpret_cast< intptr_t >( & hldr_to), \
                static_cast< D * >( this)->preserve_fpu() ) ) ); \
        static_cast< D * >( this)->callee_ = hldr_from->ctx; \
        if ( hldr_from->force_unwind) throw forced_unwind(); \
        if ( static_cast< D * >( this)->except_) \
            rethrow_exception( static_cast< D * >( this)->except_); \
    } \
}; \
\
template< typename Signature, typename D, typename Result > \
class coroutine_base_resume< Signature, D, Result, n > \
{ \
public: \
    typedef typename arg< Signature >::type     arg_type; \
\
    void resume( BOOST_COROUTINE_BASE_RESUME_ARGS(n)) \
    { \
        BOOST_ASSERT( static_cast< D * >( this)); \
        BOOST_ASSERT( ! static_cast< D * >( this)->is_complete() ); \
        BOOST_ASSERT( static_cast< D * >( this)->callee_); \
\
        holder< arg_type > hldr_to( \
            & static_cast< D * >( this)->caller_, \
            arg_type(BOOST_COROUTINE_BASE_RESUME_VALS(n) ) ); \
        holder< Result > * hldr_from( \
            reinterpret_cast< holder< Result > * >( context::jump_fcontext( \
                hldr_to.ctx, \
                static_cast< D * >( this)->callee_, \
                reinterpret_cast< intptr_t >( & hldr_to), \
                static_cast< D * >( this)->preserve_fpu() ) ) ); \
        static_cast< D * >( this)->callee_ = hldr_from->ctx; \
        result_ = hldr_from->data; \
        if ( hldr_from->force_unwind) throw forced_unwind(); \
        if ( static_cast< D * >( this)->except_) \
            rethrow_exception( static_cast< D * >( this)->except_); \
    } \
\
protected: \
    template< typename X, typename Y, int > \
    friend struct coroutine_get; \
\
    optional< Result >  result_; \
};
BOOST_PP_REPEAT_FROM_TO(2,11,BOOST_COROUTINE_BASE_RESUME,~)
#undef BOOST_COROUTINE_BASE_RESUME
#undef BOOST_COROUTINE_BASE_RESUME_ARGS
#undef BOOST_COROUTINE_BASE_RESUME_ARG
#undef BOOST_COROUTINE_BASE_RESUME_ARG_TYPE
#undef BOOST_COROUTINE_BASE_RESUME_VALS
#undef BOOST_COROUTINE_BASE_RESUME_VAL
#undef BOOST_COROUTINE_BASE_RESUME_COMMA

}}}

#ifdef BOOST_HAS_ABI_HEADERS
#  include BOOST_ABI_SUFFIX
#endif

#endif // BOOST_COROUTINES_DETAIL_coroutine_base_resume_H


text:
package org.apache.shindig.gadgets.templates.tags;

import com.google.common.collect.Maps;
import com.google.inject.Inject;

import org.apache.shindig.gadgets.templates.TemplateProcessor;

import org.w3c.dom.Element;
import org.w3c.dom.Node;

/**
 * Implement the os:Var tag
 */
public class VarTagHandler extends AbstractTagHandler {

  private static final String TAG_VAR = "Var";
  private static final String TAG_KEY = "key";
  private static final String TAG_VALUE = "value";

  @Inject
  public VarTagHandler() {
    super(TagHandler.OPENSOCIAL_NAMESPACE, TAG_VAR);
  }

  public void process(Node result, Element tag, TemplateProcessor processor) {
    // Get the key.  Don't support EL (to match pipelining)
    String key = tag.getAttribute(TAG_KEY);
    if ("".equals(key)) {
      return;
    }

    // Get the value (with EL)
    Object value = getValueFromTag(tag, TAG_VALUE, processor, Object.class);

    if (processor.getTemplateContext().getMy() == null) {
      processor.getTemplateContext().setMy(Maps.<String, Object> newHashMap());
    }
    processor.getTemplateContext().getMy().put(key, value);
  }

}

redpajama_set_name: RedPajamaGithub


text:
package bss

import (
	. "aliyun-openapi-go-sdk/core"
)

type DescribeCouponDetailRequest struct {
	RpcRequest
	CouponNumber string
}

func (r *DescribeCouponDetailRequest) SetCouponNumber(value string) {
	r.CouponNumber = value
	r.QueryParams.Set("CouponNumber", value)
}
func (r *DescribeCouponDetailRequest) GetCouponNumber() string {
	return r.CouponNumber
}

func (r *DescribeCouponDetailRequest) Init() {
	r.RpcRequest.Init()
	r.SetVersion(Version)
	r.SetAction("DescribeCouponDetail")
	r.SetProtocol("HTTPS")
	r.SetProduct(Product)
}

type DescribeCouponDetailResponse struct {
	CouponTemplateId int    `xml:"CouponTemplateId" json:"CouponTemplateId"`
	TotalAmount      string `xml:"TotalAmount" json:"TotalAmount"`
	BalanceAmount    string `xml:"BalanceAmount" json:"BalanceAmount"`
	FrozenAmount     string `xml:"FrozenAmount" json:"FrozenAmount"`
	ExpiredAmount    string `xml:"ExpiredAmount" json:"ExpiredAmount"`
	DeliveryTime     string `xml:"DeliveryTime" json:"DeliveryTime"`
	ExpiredTime      string `xml:"ExpiredTime" json:"ExpiredTime"`
	CouponNumber     string `xml:"CouponNumber" json:"CouponNumber"`
	Status           string `xml:"Status" json:"Status"`
	Description      string `xml:"Description" json:"Description"`
	CreationTime     string `xml:"CreationTime" json:"CreationTime"`
	ModificationTime string `xml:"ModificationTime" json:"ModificationTime"`
	PriceLimit       string `xml:"PriceLimit" json:"PriceLimit"`
	Application      string `xml:"Application" json:"Application"`
	ProductCodes     struct {
		ProductCode []string `xml:"ProductCode" json:"ProductCode"`
	} `xml:"ProductCodes" json:"ProductCodes"`
	TradeTypes struct {
		TradeType []string `xml:"TradeType" json:"TradeType"`
	} `xml:"TradeTypes" json:"TradeTypes"`
}

func DescribeCouponDetail(req *DescribeCouponDetailRequest, accessId, accessSecret string) (*DescribeCouponDetailResponse, error) {
	var pResponse DescribeCouponDetailResponse
	body, err := ApiHttpRequest(accessId, accessSecret, req)
	if err != nil {
		return nil, err
	}
	ApiUnmarshalResponse(req.GetFormat(), body, &pResponse)
	return &pResponse, err
}


text:
'use strict';

/**
* @author walle <liaozhicheng.cn@163.com>
*/

import mongoose from 'mongoose';

module.exports = function(done) {

  const debug = $.debug('mongodb');
  debug('init mongodb connnection');

  const conn = mongoose.createConnection($.config.get('db.mongodb'));
  $.mongodb = conn;

  done();
}


text:
package prototime

import (
	"time"

	google_duration "github.com/golang/protobuf/ptypes/duration"
	google_protobuf "github.com/golang/protobuf/ptypes/timestamp"
)

// TimeToTimestamp converts a go Time to a protobuf Timestamp.
func TimeToTimestamp(t time.Time) *google_protobuf.Timestamp {
	return &google_protobuf.Timestamp{
		Seconds: t.UnixNano() / int64(time.Second),
		Nanos:   int32(t.UnixNano() % int64(time.Second)),
	}
}

// TimestampToTime converts a protobuf Timestamp to a go Time.
func TimestampToTime(timestamp *google_protobuf.Timestamp) time.Time {
	if timestamp == nil {
		return time.Unix(0, 0).UTC()
	}
	return time.Unix(
		timestamp.Seconds,
		int64(timestamp.Nanos),
	).UTC()
}

// TimestampLess returns true if i is before j.
func TimestampLess(i *google_protobuf.Timestamp, j *google_protobuf.Timestamp) bool {
	if j == nil {
		return false
	}
	if i == nil {
		return true
	}
	if i.Seconds < j.Seconds {
		return true
	}
	if i.Seconds > j.Seconds {
		return false
	}
	return i.Nanos < j.Nanos
}

// Now returns the current time as a protobuf Timestamp.
func Now() *google_protobuf.Timestamp {
	return TimeToTimestamp(time.Now().UTC())
}

// DurationToProto converts a go Duration to a protobuf Duration.
func DurationToProto(d time.Duration) *google_duration.Duration {
	return &google_duration.Duration{
		Seconds: int64(d) / int64(time.Second),
		Nanos:   int32(int64(d) % int64(time.Second)),
	}
}

// DurationFromProto converts a protobuf Duration to a go Duration.
func DurationFromProto(duration *google_duration.Duration) time.Duration {
	if duration == nil {
		return 0
	}
	return time.Duration((duration.Seconds * int64(time.Second)) + int64(duration.Nanos))
}


text:
module ParsePretty where

import Control.Monad ( liftM )

import Test.HUnit.Base
import Test.HUnit.Text
import Data.Data

import TypedJavaScript.Test

eraseSourcePos x = fmap (const ()) x

assertEqualWithoutSourcePos lhs rhs =
  case eraseSourcePos lhs == eraseSourcePos rhs of
    True -> return ()
    False -> assertFailure $ "expected:\n" ++ show lhs ++ "\ngot:\n" ++
                             show rhs ++ "\n"

testParsePrettyIdentity :: FilePath -> String -> Test
testParsePrettyIdentity src str = TestCase $
  assertEqualWithoutSourcePos lhs rhs where
    lhs = ((parse (src ++ " (PRETTY-PRINTING)")) . pretty . (parse src)) str
    rhs = parse src str

main = do
  --testPaths <- liftM concat $ mapM getTjsPaths ["parse-pretty", "libs"]
  testPaths <- getPathsWithExtension ".js" "parse-pretty"
  testData <- mapM readFile testPaths
  let tests = zipWith testParsePrettyIdentity testPaths testData
  return (TestList tests)


text:
const {
  run,
  params,
} = require("../../transcribe/src/transcribe_create_medical_job");
const {
  transcribeClient,
} = require("../../transcribe/src/libs/transcribeClient.js");

jest.mock("../../transcribe/src/libs/transcribeClient.js");

describe("@aws-sdk/client-transcribe mock", () => {
  it("should successfully mock Transcribe client", async () => {
    transcribeClient.send.mockResolvedValue({ isMock: true });
    const response = await run(params);
    expect(response.isMock).toEqual(true);
  });
});


text:
var mongoose = require('mongoose')
  , Menu = mongoose.model('Menu')
  , utils = require('../../lib/utils');

exports.index = function (req, res) {
  var dates = utils.getDates(new Date())

  Menu.findOne({ date: dates.dateString }, {'_id': 0, '__v': 0}, function (err, result) {
    if (result !== null) {
      res.render('menus/menu', { menu: result, displayDate: dates.displayDate });
    }
    else {
      utils.getAnyDateMenu(dates.dateString, dates.displayDate, req, res);
    }
  })
}

exports.date = function (req, res) {

}


text:
/*******************************************************************************
  UART Library Interface Definition

  Summary:
    This file contains the interface definition for the UART peripheral library.

  Description:
    This library provides a low-level abstraction of the UART (Universal
    Asynchronous Receiver/Transmtter) module on Microchip PIC32MX family
    microcontrollers with a convenient C language interface.  It can be used to
    simplify low-level access to the module without the necessity of interacting
    directly with the module's registers, thus hiding differences from one
    microcontroller variant to another.
*******************************************************************************/
//DOM-IGNORE-BEGIN
/*******************************************************************************
FileName:       uart.h
Dependencies:   See includes
Processor:      PIC32MX

Compiler:       Microchip MPLAB XC32 v1.00 or higher
Company:        Microchip Technology Inc.

Copyright © 2008-2009 released Microchip Technology Inc.  All rights
reserved.

Microchip licenses to you the right to use, modify, copy and distribute
Software only when embedded on a Microchip microcontroller or digital signal
controller that is integrated into your product or third party product
(pursuant to the sublicense terms in the accompanying license agreement).

You should refer to the license agreement accompanying this Software for
additional information regarding your rights and obligations.

SOFTWARE AND DOCUMENTATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF
MERCHANTABILITY, TITLE, NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE.
IN NO EVENT SHALL MICROCHIP OR ITS LICENSORS BE LIABLE OR OBLIGATED UNDER
CONTRACT, NEGLIGENCE, STRICT LIABILITY, CONTRIBUTION, BREACH OF WARRANTY, OR
OTHER LEGAL EQUITABLE THEORY ANY DIRECT OR INDIRECT DAMAGES OR EXPENSES
INCLUDING BUT NOT LIMITED TO ANY INCIDENTAL, SPECIAL, INDIRECT, PUNITIVE OR
CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST OF PROCUREMENT OF
SUBSTITUTE GOODS, TECHNOLOGY, SERVICES, OR ANY CLAIMS BY THIRD PARTIES
(INCLUDING BUT NOT LIMITED TO ANY DEFENSE THEREOF), OR OTHER SIMILAR COSTS.
*******************************************************************************

Author      Date          Description
-------------------------------------------------------------------------------
RP          12-Nov-2012   Cleaned up various code examples and comments.
*******************************************************************************/
//DOM-IGNORE-END

#ifndef _UART_H_
#define _UART_H_

#include <xc.h>
#include <GenericTypeDefs.h>
#ifndef _PLIB_DISABLE_LEGACY
    #include <peripheral/legacy/uart_legacy.h>  // Legacy definitions, do not use
#endif

#ifdef __cplusplus
extern "C"
  {
#endif

/*
*  WARNING: All the Peripheral Library (PLIB) functions, including those in this file,
*  will be removed from future releases of MPLAB XC32 C/C++ Compiler.
*  Please refer to the MPLAB Harmony Libraries for new projects.  For legacy support,
*  these PLIB Libraries will be available for download from: www.microchip.com/pic32_peripheral_lib
*/
#ifndef _SUPPRESS_PLIB_WARNING
  #warning The PLIB functions and macros in this file will be removed from the MPLAB XC32 C/C++ Compiler in future releases
#endif

// *****************************************************************************
// *****************************************************************************
// Section: Constants & Data Types
// *****************************************************************************
// *****************************************************************************

//DOM-IGNORE-BEGIN
/****
 NOTE: It might be wise to place the generic clr/set/inv reg structure in
       the device file.  Also the UART register set could also be placed there
*****/
typedef struct
{
    volatile UINT   reg;
    volatile UINT   clr;
    volatile UINT   set;
    volatile UINT   inv;
}REG_SET;

typedef struct
{
    volatile REG_SET    mode;
    volatile REG_SET    sta;
    volatile REG_SET    tx;
    volatile REG_SET    rx;
    volatile REG_SET    brg;
}UART_REGS;

extern UART_REGS * const uartReg[];
//DOM-IGNORE-END

// *****************************************************************************
/* UART Module

  Summary:
    UART modules supported.

  Description:
    This enumeration identifies the available UART modules.
*/

typedef enum
{
#if defined _UART1
    // UART1 Module ID.
    UART1 = 0,
#endif
#if defined _UART2
    // UART2 Module ID.
    UART2,
#endif
#ifdef _UART3
    // UART3 Module ID.
    UART3,
#endif
#ifdef _UART4
    // UART4 Module ID (not available if UART1 CTS/RTS used).
    UART4,
#endif
#ifdef _UART5
    // UART5 Module ID (not available if UART2 CTS/RTS used).
    UART5,
#endif
#ifdef _UART6
    // UART6 Module ID (not available if UART3 CTS/RTS used).
    UART6,
#endif
    // Number of available UART modules.
    UART_NUMBER_OF_MODULES

} UART_MODULE;

// *****************************************************************************
/* UART Enable Modes

  Summary:
    Operating modes of UART.

  Description:
    This enumeration defines the supported modes in which the UART may be
    enabled or disbled.

  Remarks:
    Enabling the UART trasnmitter may cause an immediate UART TX interrupt
    request (if the UART TX interrupt is enabled), unless the transmit buffer
    has been pre-loaded with data.

    The caller should not rely on the specific numbers assigned to any of these
    values as they may change from one processor to the next.
*/

typedef enum
{
    // Disables UART module functionality, must be OR'd with UART_MODULE, UART_RX, or UART_TX.
    UART_DISABLE        /*DOM-IGNORE-BEGIN*/= 0x00/*DOM-IGNORE-END*/,

    // Enables UART module functionality, must be OR'd with UART_MODULE, UART_RX, or UART_TX.
    UART_ENABLE         /*DOM-IGNORE-BEGIN*/= 0x80/*DOM-IGNORE-END*/,

    // UART Module, receiver and transmitter functionality is not.
    // enabled or disabled
    UART_PERIPHERAL     /*DOM-IGNORE-BEGIN*/= 0x01/*DOM-IGNORE-END*/,

    // UART Module receiver.
    UART_RX             /*DOM-IGNORE-BEGIN*/= 0x02/*DOM-IGNORE-END*/,

    // UART Module transmitter.
    UART_TX             /*DOM-IGNORE-BEGIN*/= 0x04/*DOM-IGNORE-END*/

} UART_ENABLE_MODE;

// *****************************************************************************
/* UART Enable Helper Macro

  Summary:
    Macro for enabling module operating modes.

  Description:
    This macro creates the proper flags for enabling operating modes of the UART module.

  Example:

    UARTEnable(UART1, UART_ENABLE_FLAGS(UART_PERIPHERAL | UART_RX));

  Remarks:
    Enabling the UART trasnmitter may cause an immediate UART TX interrupt
    request (if the UART TX interrupt is enabled), unless the transmit buffer
    has been pre-loaded with data.
*/
#define UART_ENABLE_FLAGS(a)    /*DOM-IGNORE-BEGIN*/(UART_ENABLE | (a))/*DOM-IGNORE-END*/

// *****************************************************************************
/* UART Disable Helper Macro

  Summary:
    Macro for disabling module operating modes.

  Description:
    This macro creates the proper flags for disabling operating modes of the UART module.

  Example:

    UARTEnable(UART1, UART_DISABLE_FLAGS(UART_TX));

*/
#define UART_DISABLE_FLAGS(a)    /*DOM-IGNORE-BEGIN*/(UART_DISABLE | (a))/*DOM-IGNORE-END*/

// *****************************************************************************
/* UART Configuration Settings

  Summary:
    Supported configuration flags for the UART module.

  Description:
    This enumeration defines the various configuration options for the UART
    module.  These values can be OR'd together to create a configuration mask
    passed to the UARTConfigure routine.

  Remarks:
    Several of the configuration options are mutually exclusive:
    * Only one of the "ENABLE_PINS" modes can be used at a time
    * Only one of the "RTS_WHEN" modes can be used at a time
    * Only one of the "INTERRUPT_ON_TX" modes can be used at a time
    * Only one of the "INTERRUPT_ON_RX" modes can be used at a time

    The caller should not rely on the specific numbers assigned to any of these
    values as they may change from one processor ot the next.
*/

typedef enum
{
    // Enables high-speed range of the UART (see UARTSetBitRate).
    UART_ENABLE_HIGH_SPEED              /*DOM-IGNORE-BEGIN*/= 0x00000008/*DOM-IGNORE-END*/,

    // Inverts polarity of data interpretation the received (RX) pin.
    UART_INVERT_RECEIVE_POLARITY        /*DOM-IGNORE-BEGIN*/= 0x00000010/*DOM-IGNORE-END*/,

    // Enables UART TX-to-RX Loop-back mode.
    UART_ENABLE_LOOPBACK                /*DOM-IGNORE-BEGIN*/= 0x00000040/*DOM-IGNORE-END*/,

    // Enables Wake-up of the part when a start bit is received.
    UART_ENABLE_WAKE_ON_START           /*DOM-IGNORE-BEGIN*/= 0x00000080/*DOM-IGNORE-END*/,

    // Enable Bit-clock for external IrDA transceiver support (Note:  CTS and RTS
    // cannot be used in bit-clock/IrDA mode).
    UART_ENABLE_PINS_BIT_CLOCK          /*DOM-IGNORE-BEGIN*/= 0x00000300/*DOM-IGNORE-END*/,

    // Enable Request-To-Send and Clear-To-Send signals (Note: The bit-clock
    // cannot be used in CTS/RTS mode).
    UART_ENABLE_PINS_CTS_RTS            /*DOM-IGNORE-BEGIN*/= 0x00000200/*DOM-IGNORE-END*/,

    // Enable Request-To-send signal only (Note: The bit-clock and CTS cannot
    // be used in RTS-Only mode).
    UART_ENABLE_PINS_RTS                /*DOM-IGNORE-BEGIN*/= 0x00000100/*DOM-IGNORE-END*/,

    // Disables use of Clear-To-Send and Request-To-Send signals (Note: This is
    // the default mode and this parameter can be left out if it is desired).
    UART_ENABLE_PINS_TX_RX_ONLY         /*DOM-IGNORE-BEGIN*/= 0x00000000/*DOM-IGNORE-END*/,

    // If RTS is enabled, it is asserted (driven low) when the receive buffer
    // is not full (i.e., the UART is ready to receive data).  This is also known
    // as "RTS Flow-Control Mode".
    UART_RTS_WHEN_RX_NOT_FULL           /*DOM-IGNORE-BEGIN*/= 0x00000000/*DOM-IGNORE-END*/,

    // If RTS is enabled, it is asserted (driven low) when the transmit buffer
    // is not empty (i.e., when the UART has data ready to send).  This is also
    // known as "RTS Simplex Mode".
    UART_RTS_WHEN_TX_NOT_EMPTY          /*DOM-IGNORE-BEGIN*/= 0x00000800/*DOM-IGNORE-END*/,

    // Enable the IrDA encoder/decoder.
    UART_ENABLE_IRDA                    /*DOM-IGNORE-BEGIN*/= 0x00001000/*DOM-IGNORE-END*/,

    // Enables stopping of the UART operation to save power when the core has
    // been put in idle mode.
    UART_ENABLE_STOP_ON_IDLE            /*DOM-IGNORE-BEGIN*/= 0x00002000/*DOM-IGNORE-END*/,

    // Inverts the polarity of data sent on the transmit (TX) pin.
    UART_INVERT_TRANSMIT_POLARITY       /*DOM-IGNORE-BEGIN*/= 0x20000000/*DOM-IGNORE-END*/,

    // Enables support for IEEE-485 protocol (equivalent the following OR'd
    // together: UART_RTS_WHEN_TX_NOT_EMPTY | UART_ENABLE_PINS_RTS )
    // Note:  The address must still be set using UARTEnableAddressDetect
    // to support IEEE-485 protocol.
    UART_SUPPORT_IEEE_485               /*DOM-IGNORE-BEGIN*/= 0x00000900/*DOM-IGNORE-END*/

} UART_CONFIGURATION;

// *****************************************************************************
/* UART FIFO Modes

  Summary:
    Supported FIFO modes for the UART module.

  Description:
    This enumeration defines supported FIFO modes that determine when the Tx
    and Rx interrupts will occur.

  Remarks:
    These modes consist of two sets of mutially exclusive modes:
    * Only one of the "INTERRUPT_ON_TX" modes can be used at a time
    * Only one of the "INTERRUPT_ON_RX" modes can be used at a time

    The caller should not rely on the specific numbers assigned to any of these
    values as they may change from one processor ot the next.

*/

typedef enum
{
    // If enabled, the TX interrupt will occur when the TX buffer is empty.
    UART_INTERRUPT_ON_TX_BUFFER_EMPTY   /*DOM-IGNORE-BEGIN*/= 0x8000/*DOM-IGNORE-END*/,

    // If enabled, the TX interrupt will occur when all data has been transmitted.
    UART_INTERRUPT_ON_TX_DONE           /*DOM-IGNORE-BEGIN*/= 0x4000/*DOM-IGNORE-END*/,

    // If enabled, the TX interrupt will occur whenever the TX buffer is not
    // full (i.e. there is space available for more data)  This is the default.
    UART_INTERRUPT_ON_TX_NOT_FULL       /*DOM-IGNORE-BEGIN*/= 0x0000/*DOM-IGNORE-END*/,

    // If enabled, the RX interrupt will occur whenever the RX buffer is
    // completely full.  (Not supported on PIC32MX5xx, PIC32MX6xx, or PIC32MX7xx.).
    UART_INTERRUPT_ON_RX_FULL           /*DOM-IGNORE-BEGIN*/= 0x00C0/*DOM-IGNORE-END*/,

    // If enabled, the RX interrupt will occur whenever the RX buffer is 3/4
    // (three-quarter) full.
    UART_INTERRUPT_ON_RX_3_QUARTER_FULL /*DOM-IGNORE-BEGIN*/= 0x0080/*DOM-IGNORE-END*/,

    // If enabled, the RX interrupt will occur wheneer the RX buffer is half
    // full.  (Not supported on PIC32X3xx or PIC32MX4xx.).
    UART_INTERRUPT_ON_RX_HALF_FULL      /*DOM-IGNORE-BEGIN*/= 0x0040/*DOM-IGNORE-END*/,

    // If enabled, the RX interrupt will occur whenever the RX buffer has any
    // data.
    UART_INTERRUPT_ON_RX_NOT_EMPTY      /*DOM-IGNORE-BEGIN*/= 0x0000/*DOM-IGNORE-END*/

} UART_FIFO_MODE;

// *****************************************************************************
/* UART Line Control Mode

  Summary:
    UART line control mode.

  Description:
    This data type defines the supported line control modes for the UART.

  Remarks:
    Some of the line-control options are mutually exclusive:
    * Only one of the "DATA_SIZE" options can be used at a time
    * Only one of the "PARITY" options can be used at a time
    * Only one of the "STOP_BITS" options can be used at a time

    The caller should not rely on the specific numbers assigned to any of these
    values as they may change from one processor ot the next.
*/

typedef enum
{
    // Sets the data transfer size to 8-bits per frame.
    UART_DATA_SIZE_8_BITS   /*DOM-IGNORE-BEGIN*/= 0x0000/*DOM-IGNORE-END*/,

    // Sets the data transfer size to 9-bits per frame.
    UART_DATA_SIZE_9_BITS   /*DOM-IGNORE-BEGIN*/= 0x0006/*DOM-IGNORE-END*/,

    // Enables parity bit generation for odd parity.
    UART_PARITY_ODD         /*DOM-IGNORE-BEGIN*/= 0x0004/*DOM-IGNORE-END*/,

    // Enables parity bit generation for even parity.
    UART_PARITY_EVEN        /*DOM-IGNORE-BEGIN*/= 0x0002/*DOM-IGNORE-END*/,

    // Disables parity bit generation.
    UART_PARITY_NONE        /*DOM-IGNORE-BEGIN*/= 0x0000/*DOM-IGNORE-END*/,

    // Enables generation of 2 stop bits per frame.
    UART_STOP_BITS_2        /*DOM-IGNORE-BEGIN*/= 0x0001/*DOM-IGNORE-END*/,

    // Enables generation of 1 stop bit per frame (default).
    UART_STOP_BITS_1        /*DOM-IGNORE-BEGIN*/= 0x0000/*DOM-IGNORE-END*/

} UART_LINE_CONTROL_MODE;

// *****************************************************************************
/* UART Line Status Flags

  Summary:
    UART line-status bitmask flags.

  Description:
    This enumeration defines the UART line-status bits.  These values are
    OR'd together to make up the bitmask returned by UARTGetLineStatus.

  Remarks:
    The caller should not rely on the specific numbers assigned to any of these
    values as they may change from one processor ot the next.
*/

typedef enum
{
    // The transmitter is able to accept data to transmit.
    UART_TRANSMITTER_NOT_FULL   /*DOM-IGNORE-BEGIN*/= 0x00000200/*DOM-IGNORE-END*/,

    // The transmitter is empty (no data is available to transmit).
    UART_TRANSMITTER_EMPTY      /*DOM-IGNORE-BEGIN*/= 0x00000100/*DOM-IGNORE-END*/,

    // The receiver is currently idle.
    UART_RECEIVER_IDLE          /*DOM-IGNORE-BEGIN*/= 0x00000010/*DOM-IGNORE-END*/,

    // A received data parity error was detected.
    UART_PARITY_ERROR           /*DOM-IGNORE-BEGIN*/= 0x00000008/*DOM-IGNORE-END*/,

    // Data was received that violated the framing protocol (the data word did
    // not start or stop at the appropriate place).  Note:  A break condition
    // will always indicate a framing error.
    UART_FRAMING_ERROR          /*DOM-IGNORE-BEGIN*/= 0x00000004/*DOM-IGNORE-END*/,

    // The UART has received more data than it can buffer.  Data has been lost.
    UART_OVERRUN_ERROR          /*DOM-IGNORE-BEGIN*/= 0x00000002/*DOM-IGNORE-END*/,

    // UART data has been received and is avaiable in the FIFO.
    UART_DATA_READY             /*DOM-IGNORE-BEGIN*/= 0x00000001/*DOM-IGNORE-END*/

} UART_LINE_STATUS;

#define UART_LINE_STATUS_MASK   (UART_TRANSMITTER_NOT_FULL | UART_TRANSMITTER_EMPTY |\
                                UART_RECEIVER_IDLE | UART_PARITY_ERROR | UART_FRAMING_ERROR |\
                                UART_OVERRUN_ERROR | UART_DATA_READY)

// *****************************************************************************
/* UART Data

  Summary:
    UART data.

  Description:
    This data type defines the supported data sizes for the UART.
*/

typedef union
{
    // 8-bit data
    struct
    {
        UINT16  data8bit    : 8;
    };

    // 9-bit data
    struct
    {
        UINT16  data9bit    : 9;
    };

    UINT16 __data;
} UART_DATA;

// *****************************************************************************
// *****************************************************************************
// Section: UART Peripheral Library Interface Routines
// *****************************************************************************
// *****************************************************************************

/*******************************************************************************
  Function:
    void UARTEnable( UART_MODULE id, UART_ENABLE_MODE mode )

  Summary:
    Enables or disables the given UART module in the desired mode.

  Description:
    This routine enables or disables the given UART module in the desired mode.

  Precondition:
    The UART module should be appropriately configured before being enabled.

  Parameters:
    id    - Identifies the desired UART module.

    mode  - Identifies the desired mode of UART operation.

  Returns:
    None

  Example:

    UARTEnable(UART1, UART_ENABLE_FLAGS(UART_PERIPHERAL | UART_RX | UART_TX));

  Remarks:
    Enabling UART transmissions will immediately cause a TX interrupt to
    indicate that the transmitter needs data, unless the transmitter FIFO/buffer
    was pre-loaded with data.
  *****************************************************************************/

void UARTEnable( UART_MODULE id, UART_ENABLE_MODE mode );

/*******************************************************************************
  Function:
    void UARTConfigure ( UART_MODULE id, UART_CONFIGURATION flags )

  Summary:
    UART module configuration routine.

  Description:
    This routine allows the caller to configure various features of the UART
    module for desired operation.

  Precondition:
    None

  Parameters:
    id      - Identifies the desired UART module.

    flags   - Bit-wise OR of the desired module configuration settings.

  Returns:
    None

  Example:

    UARTConfigure(UART1, UART_RTS_WHEN_RX_NOT_FULL|UART_ENABLE_PINS_CTS_RTS);

  Remarks:
    Refer to the UART_CONFIGURATION enumerated data type for details on each
    configuration flag.  Note that the bitmask resulting from the bit-wise OR
    of these values will result in a value that is not explicitly defined in
    the enumeration.
  *****************************************************************************/

void UARTConfigure ( UART_MODULE id, UART_CONFIGURATION flags );

/*******************************************************************************
  Function:
    void UARTSetFifoMode ( UART_MODULE id, UART_FIFO_MODE mode )

  Summary:
    Controls UART module TX and RX FIFO operation.

  Description:
    This routine allows the caller to configure when interrupts occur relative
    to different "watermark" levels in the UART TX and RX FIFOs (i.e., how full
    or empty the FIFOs are).

  Precondition:
    None

  Parameters:
    id      - Identifies the desired UART module.

    mode    - Bit-wise OR of the desired FIFO mode values.

  Returns:
    None

  Example:

    UARTSetFifoMode(UART1, UART_INTERRUPT_ON_TX_DONE|UART_INTERRUPT_ON_RX_NOT_EMPTY);

  Remarks:
    Refer to the UART_FIFO_MODE enumerated data type for details on each
    mode flag.  Note that the bitmask resulting from the bit-wise OR
    of these values will result in a value that is not explicitly defined in
    the enumeration.
  *****************************************************************************/

void UARTSetFifoMode ( UART_MODULE id, UART_FIFO_MODE mode );

/*******************************************************************************
  Function:
    UINT32 UARTSetDataRate ( UART_MODULE id, UINT32 sourceClock, UINT32 dataRate )

  Summary:
    Routine to set the UART module's desired data data rate.

  Description:
    This routine allows the caller to set the desired data rate for the UART.

  Precondition:
    The source clock's frequency must be operating at the frequency passed in the
    "sourceClock" parameter.

  Parameters:
    id          - Identifies the desired UART module.

    sourceClock - Frequency (Hz) of the source clock being provided to the
                  UART module.

    dataRate     - Desired data rate (bits per second).

  Returns:
    Actual bit rate selected

  Example:

    #define PERIPHERAL_CLOCK    10000000
    #define DESIRED_DATA_RATE   19200

    UINT32    actualDataRate;

    actualDataRate = UARTSetDataRate(UART1, PERIPHERAL_CLOCK, DESIRED_DATA_RATE);

  Remarks:
    Actual data rate selected may be slightly different than the data rate
    requested due to truncation error.

    Note:  In normal mode, the maximum possible data rate is sourceClock/16.  If
    the UART_ENABLE_HIGH_SPEED flag is sent to the UARTConfigure routine, then
    the maximum data rate is sourceClock/4.
  *****************************************************************************/

UINT32 UARTSetDataRate ( UART_MODULE id, UINT32 sourceClock, UINT32 dataRate );

/*******************************************************************************
  Function:
    UINT32 UARTGetDataRate ( UART_MODULE id, UINT32 sourceClock )

  Summary:
    Routine to get the UART module's current data data rate.

  Description:
    This routine allows the caller to get the current data rate for the UART module.

  Precondition:
    The source clock's frequency must be operating at the frequency passed in the
    "sourceClock" parameter.

  Parameters:
    id          - Identifies the desired UART module.

    sourceClock - Frequency (Hz) of the source clock being provided to the
                  UART module.

  Returns:
    The UART's current data rate (bits per second).

  Example:

    #define PERIPHERAL_CLOCK    10000000

    UINT32    currentDataRate;

    currentDataRate = UARTGetDataRate(UART1, PERIPHERAL_CLOCK);

  Remarks:
    The current (actual) data rate returned may be slightly different than bit
    rate requested due to truncation error.
  *****************************************************************************/

UINT32 UARTGetDataRate( UART_MODULE id, UINT32 sourceClock );

/*******************************************************************************
  Function:
        void UARTSetLineControl ( UART_MODULE id, UART_LINE_CONTROL_MODE mode )

  Summary:
    Routine to set the UART module's desired line control parameters.

  Description:
    This routine allows the caller to select the desired size of the UART data
    frame, the generation of parity and framing parameters (collectively
    referred to as the "line control" mode).

  Precondition:

  Parameters:
    id      - Identifies the desired UART module.

    mode    - This is a bit-wise OR of the desired line control mode flags.

  Returns:
    None

  Example:

    UARTSetLineControl(UART1, UART_DATA_SIZE_8_BITS|UART_PARITY_NONE|UART_STOP_BITS_1);

  Remarks:
    Refer to the UART_LINE_CONTROL_MODE enumerated data type for details on
    each mode flag.  Note that the bitmask resulting from the bit-wise OR
    of these values will result in a value that is not explicitly defined in
    the enumeration.
  *****************************************************************************/

void UARTSetLineControl ( UART_MODULE id, UART_LINE_CONTROL_MODE mode );

/*******************************************************************************
  Function:
    UART_LINE_STATUS UARTGetLineStatus ( UART_MODULE id )

  Summary:
    Provides current UART line status.

  Description:
    This routine allows the caller to get the current line status of the UART,
    indicating the current state of the transmitter and receiver buffers, and
    if any errors have occurred.

  Precondition:
    None

  Parameters:
    id      - Identifies the desired UART module.

  Returns:
    A bit-wise OR of the current line status flags.

  Example:

    UART_LINE_STATUS lineStatus;

    lineStatus = UARTGetLineStatus(UART1);
    if ( (UART_PARITY_ERROR|UART_FRAMING_ERROR|UART_OVERRUN_ERROR) & lineStatus )
    {
        // Handle receiver error
    }

  Remarks:
    Refer to the UART_LINE_STATUS enumerated data type for details on each
    status flag.

    The receiver line status flags are only valid when data has been received
    and for the data at the top of the RX FIFO.

    Note that the bitmask resulting from the bit-wise OR of these values will
    result in a value that is not explicitly defined in the enumeration.
  *****************************************************************************/
extern inline UART_LINE_STATUS __attribute__((always_inline)) UARTGetLineStatus ( UART_MODULE id )
{
    return (UART_LINE_STATUS)(uartReg[id]->sta.reg & (UART_LINE_STATUS_MASK));
}

/*******************************************************************************
  Function:
    BOOL UARTTransmitterIsReady ( UART_MODULE id )

  Summary:
    Routine to detect if the transmitter is ready to accept data to transmit.

  Description:
    This routine determines if the transmitter is ready to accept more data to
    be transmitted.

  Precondition:
    The UART module should have been appropriately configured and enabled.

  Parameters:
    id      - Identifies the desired UART module.

  Returns:
    Boolean identifying whether or not the transmitter is ready:
    * TRUE    - If the transmitter is ready to accept more data
    * FALSE   - If the transmitter is not ready to accept more data

  Example:

    unsigned char data;

    data = 'a';

    if (UARTTransmitterIsReady(UART1))
    {
        UARTSendDataByte(UART1, data);
    }

  Remarks:
  *****************************************************************************/

extern inline BOOL __attribute__ ((always_inline)) UARTTransmitterIsReady ( UART_MODULE id )
{
    return (BOOL)(!(uartReg[id]->sta.reg & _U1STA_UTXBF_MASK));
}

/*******************************************************************************
  Function:
    void UARTSendDataByte ( UART_MODULE id, BYTE data )

  Summary:
    Routine to send a byte of data.

  Description:
    This routine allows the caller to send a byte of data.

  Precondition:
    The UART should have been appropriately configured.  The configuration must
    have been for 8-bit data (see UART_DATA_SIZE_8_BITS).  The transmitter must
    have been ready, although not necessarily enabled yet.

  Parameters:
    id      - Identifies the desired UART module.

    data    - Data byte to be sent.

  Returns:
    None

  Example:

    unsigned char data;

    data = 'a';

    if (UARTTransmitterIsReady(UART1))
    {
        UARTSendDataByte(UART1, data);
    }

  Remarks:
    This routine is optimized to send 8-bit (1-byte) data through the UART.
    This is an optimization of the "UARTSendData" routine for 8-bit (or less)
    data.
  *****************************************************************************/

extern inline void __attribute__((always_inline)) UARTSendDataByte ( UART_MODULE id, BYTE data )
{
    uartReg[id]->tx.reg = data;
}

/*******************************************************************************
  Function:
    void UARTSendData ( UART_MODULE id, UART_DATA data )

  Summary:
    Routine to send data through the UART.

  Description:
    This routine allows the caller to send data of any permitted size through
    the UART.

  Precondition:
    The UART module should have been appropriately configured.  The configuration must
    have been for desired data size.  The transmitter must have been ready,
    although not necessarily enabled yet.

  Parameters:
    id      - Identifies the desired UART module.

    data    - Data to be sent.

  Returns:
    None

  Example:

    UART_DATA data = 0x1ff; //can be 8-bit or 9-bit word, depending on how UART is configured

    if (UARTTransmitterIsReady(UART1))
    {
        UARTSendData(UART1, data);
    }

  Remarks:
    Size of the data word size depends on the current configuration (see
    UARTSetLineControl and UART_LINE_CONTROL_MODE).
  *****************************************************************************/

extern inline void __attribute__((always_inline)) UARTSendData( UART_MODULE id, UART_DATA data )
{
    uartReg[id]->tx.reg = data.__data;
}

/*******************************************************************************
  Function:
    BOOL UARTTransmissionHasCompleted ( UART_MODULE id )

  Summary:
    Routine to detect if the UART module has finshed transmitting the most recent
    data.

  Description:
    This routine determines if the transmitter has finished sending all
    available data.

  Preconditions:
    The UART module should have been appropriately configured and enabled and data
    sent to the UART TX buffer.

  Parameters:
    id      - Identifies the desired UART module.

  Returns:
    Boolean identifying if the transmission has completed:
    * TRUE    - If the transmitter has completed sending the data
    * FALSE   - If the transmitter is still busy sending the data

  Example:

    if (UARTTransmissionHasCompleted(UART1))
    {
        // Perform any tasks necessary when all data has been sent
    }

  Remarks:
  *****************************************************************************/

extern inline BOOL __attribute__((always_inline)) UARTTransmissionHasCompleted ( UART_MODULE id )
{
    return (BOOL)(_U1STA_TRMT_MASK == (uartReg[id]->sta.reg & _U1STA_TRMT_MASK));
}

/*******************************************************************************
  Function:
    BOOL UARTReceivedDataIsAvailable ( UART_MODULE id )

  Summary:
    Routine to detect if the receiver has data available.

  Description:
    This routine determines if the receiver has data available to be read.

  Precondition:
    The UART module must have been configured appropriately and enabled. A complete
    data frame must have been sent to the UART before it will return a TRUE.

  Parameters:
    id      - Identifies the desired UART module.

  Returns:
    Boolean identifying whether or not data is available:
    * TRUE    - If the receiver has data available
    * FALSE   - If the receiver does not have data availble

  Example:

    UART_DATA data;

    if (UARTReceivedDataIsAvailable(UART1))
    {
        data = UARTGetData(UART1);
    }

  Remarks:
    This routine provides the same information as the UART_DATA_READY line
    status flag.
  *****************************************************************************/

extern inline BOOL __attribute__((always_inline)) UARTReceivedDataIsAvailable ( UART_MODULE id )
{
    return (BOOL)(_U1STA_URXDA_MASK == (uartReg[id]->sta.reg & _U1STA_URXDA_MASK));
}

/*******************************************************************************
  Function:
    BYTE UARTGetDataByte ( UART_MODULE id )

  Summary:
    Routine to get a byte of data received by the UART.

  Description:
    This routine allows the caller to read a byte of data received by the UART.

  Precondition:
    The UART module must have been appropriately configured, the configuration must
    have been for 8-bit data (see UART_DATA_SIZE_8_BITS), and the UART must have
    been enabled.  Also, a complete data frame must have been received by the UART.

  Parameters:
    id      - Identifies the desired UART module.

  Returns:
    A byte of data received by the UART.

  Example:

    unsigned char data;

    if (UARTReceivedDataIsAvailable(UART1))
    {
        data = UARTGetDataByte(UART1);
    }

  Remarks:
    This routine is optimized for receiving 8-bit data through the UART.
  *****************************************************************************/

extern inline BYTE __attribute__((always_inline)) UARTGetDataByte ( UART_MODULE id )
{
    return (BYTE)uartReg[id]->rx.reg;
}

/*******************************************************************************
  Function:
    UART_DATA UARTGetData ( UART_MODULE id )

  Summary:
    Routine to get data received by the UART.

  Description:
    This routine allows the caller to read a data word received by the UART.

  Precondition:
    The module must have been appropriately configured, the UART module must have been
    enabled, and a complete data frame must have been received by the UART.

  Parameters:
    id      - Identifies the desired UART module.

  Returns:
    Data received by the UART.

  Example:

    UART_DATA data;

    if (UARTReceivedDataIsAvailable(UART1))
    {
        data = UARTGetData(UART1);
    }

  Remarks:
    Size of the data word depends on the current configuration (see
    UARTSetLineControl).
  *****************************************************************************/

extern inline UART_DATA __attribute__((always_inline)) UARTGetData ( UART_MODULE id )
{
    UART_DATA data;

    data.__data = uartReg[id]->rx.reg;

    return data;
}

/*******************************************************************************
  Function:
    void UARTSetAddress ( UART_MODULE id, BYTE address, BOOL watch )

  Summary:
    Routine to program the address for which the UART module may watch.

  Description:
    This routine programs the 8-bit address for which the module may watch.

  Precondition:
    None

  Parameters:
    id      - Identifies the desired UART module.

    address - 8-bit address for which the module will watch.

    watch   - Determines if the "address watch" mode will be enabled or disabled:
              * TRUE - Enable address watch mode
              * FALSE - Disable address watch mode

  Returns:
    None.

  Example:

    #define SLAVE_ADDRESS  0x42

    UARTSetAddress(UART1, SLAVE_ADDRESS, TRUE);

  Remarks:
    The module can be placed into a mode where it will ignore all data received
    until it identifies the programmed adress.  After the programmed address
    has been identified, it will begin receiving data normally.  This mode is
    particularly useful for supporting the IEEE-485 protocol.
  *****************************************************************************/

void UARTSetAddress ( UART_MODULE id, BYTE address, BOOL watch );

/*******************************************************************************
  Function:
    void UARTWatchForAddress ( UART_MODULE id, BOOL watch )

  Summary:
    Routine to enable or disable recognition of the programmed address byte.

  Description:
    This routine can enable or disable the "address watch" mode.  In this mode,
    the UART module will ignore all data until it recognizes the programmed address.

  Precondition:
    UART should have already been enabled and set with watch address.

  Parameters:
    id      - Identifies the desired UART module.

    watch   - Determines if the "address watch" mode will be enabled or
              disabled.
              * TRUE - Enable address watch mode
              * FALSE - Disable address watch mode

  Returns:
    None.

  Example:

    #define SLAVE_ADDRESS 0x42

    // Set the address, but don't enable the watch until later,
    // UART continues to receive data normally
    UARTSetAddress(UART1, SLAVE_ADDRESS, FALSE);

    // ...

    // Now begin to ignore all UART traffic until we are addressed
    UARTWatchForAddress(UART1, TRUE);

  Remarks:
    The UART module can be placed into a mode where it will ignore all data received
    until it identifies the programmed address.  After the programmed address
    has been identified, it will begin receiving data normally.  This mode is
    particularly useful for supporting the IEEE-485 protocol.
  *****************************************************************************/

void UARTWatchForAddress ( UART_MODULE id, BOOL watch );

/*******************************************************************************
  Function:
    void UARTSendBreak ( UART_MODULE id )

  Summary:
    Routine to send a break signal from the UART.

  Description:
    This routine allows the caller to send a break signal (12-bits of '0' data).

  Precondition:
    The UART should have been appropriately configured.  The transmitter should
    be idle, although not necessarily enabled yet.

  Parameters:
    id      - Identifies the desired UART module.

  Returns:
    None

  Example:

    if (UARTTransmissionHasCompleted(UART1))
    {
        UARTSendBreak(UART1);
    }

  Remarks:
    After calling UARTSendBreak (and ensuring that the transmitter is enabled),
    data may be pre-loaded into the FIFO and it will be send immediately
    following the break signal.
  *****************************************************************************/

extern inline void __attribute__((always_inline)) UARTSendBreak ( UART_MODULE id )
{
    uartReg[id]->sta.set = _U1STA_UTXBRK_MASK;
}

/*******************************************************************************
  Function:
    void UARTStartAutoDataRateDetect ( UART_MODULE id )

  Summary:
    Routine to automatically determine the data rate (bits-per-second) of an
    external transmitter to the UART.

  Description:
    This routine initiates the process of automatically determining the data
    rate (bits-per-second) of an external transmitter to the UART.

  Precondition:
    The UART should have been appropriately configured.  The transmitter should
    be idle, although not necessarily enabled yet.

  Parameters:
    id      - Identifies the desired UART module.

  Returns:
    None

  Example:

    // See "PIC32 Family Reference Manual, Sect. 21 UART" for information on
    // methods to detect a Break.

    if (breakDetected && useAutoRateDetect)
    {
        UARTStartAutoDataRateDetect (UART1);
    }

  Remarks:
    The UART module begins measuring the data rate beginning at the next start
    bit.  The external transmitter should send an alternating pattern (0x55)
    for the byte to be measured for an effective rate detection.  To ensure
    an effective measurement sequence, this can be done immediately following
    a break reception. It is important that this UART module is not
    transmitting data while it is trying to detect RX baud rate, see the
    "PIC32 Family Reference Manual, Sect. 21 UART".
  *****************************************************************************/

extern inline void __attribute__((always_inline)) UARTStartAutoDataRateDetect ( UART_MODULE id )
{
   uartReg[id]->mode.set = _U1MODE_ABAUD_MASK;
}

/*******************************************************************************
  Function:
    BOOL UARTDataRateDetected ( UART_MODULE id )

  Summary:
    Routine to identify when automatic data rate detection has completed.

  Description:
    This routine checks to see if automatic data rate detection has completed.

  Precondition:
    Automatic rate detection should have been previously started.

  Parameters:
    id      - Identifies the desired UART module.

  Returns:
    * TRUE    - Indicates that automatic rate detection has completed.
    * FALSE   - Indicates that automatic rate detection is still ongoing.

  Example:

    #define PERIPHERAL_CLOCK    10000000

    UINT32 currentRate;

    if (UARTDataRateDetected(UART1))
    {
        currentRate = UARTGetDataRate(UART1, PERIPHERAL_CLOCK);
    }

  Remarks:
    This routine returns FALSE after automatic rate detection
    has been started but before rate is detectdd, it will return TRUE
    at any other time.
  *****************************************************************************/

extern inline BOOL __attribute__((always_inline)) UARTDataRateDetected ( UART_MODULE id )
{
    return (BOOL)(!(uartReg[id]->mode.reg & _U1MODE_ABAUD_MASK));
}

#ifdef __cplusplus
  }
#endif

#endif // _UART_h_


text:
package com.example

import org.jooq.{Allow, PlainSQL, SQL}

object API {

  @PlainSQL
  def foo: SQL = ???

}

object PlainSQLWartTest {

  @Allow.PlainSQL
  def bar(): Unit = API.foo

}


text:
package aos.lucene.analysis.codec;

import java.io.Reader;

import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.analysis.TokenStream;
import org.apache.lucene.analysis.core.LetterTokenizer;

public class MetaphoneReplacementAnalyzer extends Analyzer {

    @Override
    public TokenStream tokenStream(String fieldName, Reader reader) {
        return new MetaphoneReplacementFilter(new LetterTokenizer(reader));
    }

}


text:
<?php

namespace AppBundle\Entity;

use FOS\UserBundle\Model\User as BaseUser;
use Doctrine\ORM\Mapping as ORM;

/**
 * @ORM\Entity
 * @ORM\Table(name="fos_user")
 */
class User extends BaseUser
{
    /**
     * @ORM\Id
     * @ORM\Column(type="integer")
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    protected $id;

    public function __construct()
    {
        parent::__construct();
        // your own logic
    }

    public function setEmail($email) {
        parent::setUsername($email);
        return parent::setEmail($email);
    }

    public function setEmailCanonical($emailCanonical) {
        parent::setUsernameCanonical($emailCanonical);
        return parent::setEmailCanonical($emailCanonical);
    }
}


text:
package org.encog.ml.factory.method;

import org.encog.ml.MLMethod;
import org.encog.ml.bayesian.BayesianNetwork;

/**
 * Factory to create bayesian networks.
 *
 */
public class BayesianFactory {

	/**
	 * Create a bayesian network.
	 * @param architecture The architecture to use.
	 * @param input The input neuron count.
	 * @param output The output neuron count.
	 * @return The new bayesian network.
	 */
	public MLMethod create(final String architecture, final int input,
			final int output) {
		BayesianNetwork method = new BayesianNetwork();
		method.setContents(architecture);
		return method;
	}
}


text:
package externals

import (
	"strings"

	libkb "github.com/keybase/client/go/libkb"
	keybase1 "github.com/keybase/client/go/protocol/keybase1"
	jsonw "github.com/keybase/go-jsonw"
)

// =============================================================================
// Dns
//

type DNSChecker struct {
	proof libkb.RemoteProofChainLink
}

var _ libkb.ProofChecker = (*DNSChecker)(nil)

func NewDNSChecker(p libkb.RemoteProofChainLink) (*DNSChecker, libkb.ProofError) {
	return &DNSChecker{p}, nil
}

func (rc *DNSChecker) GetTorError() libkb.ProofError { return libkb.ProofErrorDNSOverTor }

func (rc *DNSChecker) CheckStatus(m libkb.MetaContext, h libkb.SigHint, pcm libkb.ProofCheckerMode,
	pvlU keybase1.MerkleStoreEntry) (*libkb.SigHint, libkb.ProofError) {
	// TODO CORE-8951 see if we can populate verifiedHint with anything useful.
	if pcm != libkb.ProofCheckerModeActive {
		m.Debug("DNS check skipped since proof checking was not in active mode (%s)", h.GetAPIURL())
		return nil, libkb.ProofErrorUnchecked
	}
	return nil, CheckProofPvl(m, keybase1.ProofType_DNS, rc.proof, h, pvlU)
}

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

type DNSServiceType struct{ libkb.BaseServiceType }

func (t *DNSServiceType) Key() string { return t.GetTypeName() }

func (t *DNSServiceType) NormalizeUsername(s string) (string, error) {
	if !libkb.IsValidHostname(s) {
		return "", libkb.NewInvalidHostnameError(s)
	}
	return strings.ToLower(s), nil
}

func (t *DNSServiceType) NormalizeRemoteName(_ libkb.MetaContext, s string) (string, error) {
	// Allow a leading 'dns://' and preserve case.
	s = strings.TrimPrefix(s, "dns://")
	if !libkb.IsValidHostname(s) {
		return "", libkb.NewInvalidHostnameError(s)
	}
	return s, nil
}

func (t *DNSServiceType) GetPrompt() string {
	return "Your DNS domain"
}

func (t *DNSServiceType) ToServiceJSON(un string) *jsonw.Wrapper {
	ret := jsonw.NewDictionary()
	_ = ret.SetKey("protocol", jsonw.NewString("dns"))
	_ = ret.SetKey("domain", jsonw.NewString(un))
	return ret
}

func (t *DNSServiceType) FormatProofText(ctx libkb.MetaContext, ppr *libkb.PostProofRes,
	kbUsername, remoteUsername string, sigID keybase1.SigID) (string, error) {
	return (ppr.Text + "\n"), nil
}

func (t *DNSServiceType) PostInstructions(un string) *libkb.Markup {
	return libkb.FmtMarkup(`Please save the following as a DNS TXT entry for
` + un + ` OR _keybase.` + un + `:`)
}

func (t *DNSServiceType) DisplayName() string   { return "Dns" }
func (t *DNSServiceType) GetTypeName() string   { return "dns" }
func (t *DNSServiceType) PickerSubtext() string { return t.GetTypeName() }

func (t *DNSServiceType) RecheckProofPosting(tryNumber int, status keybase1.ProofStatus, dn string) (warning *libkb.Markup, err error) {
	warning = libkb.FmtMarkup(`<p>We couldn't find a DNS proof for ` + dn + ` ... yet

DNS propagation can be slow; we'll keep trying and email you the result
`)
	err = libkb.WaitForItError{}
	return
}
func (t *DNSServiceType) GetProofType() string { return t.BaseGetProofType(t) }

func (t *DNSServiceType) CheckProofText(text string, id keybase1.SigID, sig string) (err error) {
	return t.BaseCheckProofTextShort(text, id, true)
}

func (t *DNSServiceType) GetAPIArgKey() string { return "remote_host" }
func (t *DNSServiceType) LastWriterWins() bool { return false }

func (t *DNSServiceType) MakeProofChecker(l libkb.RemoteProofChainLink) libkb.ProofChecker {
	return &DNSChecker{l}
}


text:
@interface NSApplication (MXUtilities)

@property (nonatomic, assign) BOOL launchAtLogin;

@end


text:
kissposh
========

(new-object Net.WebClient).DownloadString("https://raw.githubusercontent.com/kissposh/kissposh/master/GetKissPosh.ps1") | iex


text:
package blended.streams.processor

import akka.NotUsed
import akka.stream.scaladsl.Flow
import blended.streams.message.FlowEnvelope

class AckProcessor(val name : String) {

  override def toString() : String = {
    s"${getClass().getSimpleName()}($name)"
  }

  val flow : Flow[FlowEnvelope, FlowEnvelope, NotUsed] = Flow.fromFunction[FlowEnvelope, FlowEnvelope] { env =>
    if (env.requiresAcknowledge) {
      if (env.exception.isEmpty) {
        env.acknowledge()
      } else {
        env.deny()
      }
    }
    env
  }
}


text:
// -*- c++ -*-
// Generated by gmmproc 2.44.0 -- DO NOT MODIFY!
#ifndef _GTKMM_REVEALER_P_H
#define _GTKMM_REVEALER_P_H

#include <gtkmm/private/bin_p.h>

#include <glibmm/class.h>

namespace Gtk
{

class Revealer_Class : public Glib::Class
{
public:
#ifndef DOXYGEN_SHOULD_SKIP_THIS
  typedef Revealer CppObjectType;
  typedef GtkRevealer BaseObjectType;
  typedef GtkRevealerClass BaseClassType;
  typedef Gtk::Bin_Class CppClassParent;
  typedef GtkBinClass BaseClassParent;

  friend class Revealer;
#endif /* DOXYGEN_SHOULD_SKIP_THIS */

  const Glib::Class& init();

  static void class_init_function(void* g_class, void* class_data);

  static Glib::ObjectBase* wrap_new(GObject*);

protected:

  //Callbacks (default signal handlers):
  //These will call the *_impl member methods, which will then call the existing default signal callbacks, if any.
  //You could prevent the original default signal handlers being called by overriding the *_impl method.

  //Callbacks (virtual functions):
};

} // namespace Gtk

#endif /* _GTKMM_REVEALER_P_H */


text:
"""Tests for misc.chatspeak check."""

from proselint.checks.misc import chatspeak as chk

from .check import Check

class TestCheck(Check):
    """The test class for misc.chatspeak."""

    __test__ = True

    @property
    def this_check(self):
        """Boilerplate."""
        return chk

    def test_smoke(self):
        """Basic smoke test for misc.chatspeak."""
        assert self.passes("""Smoke phrase with nothing flagged.""")
        assert not self.passes("""BRB getting coffee.""")


text:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="blue">#00F</color>
<color name="title_background">#ff355689</color>
<color name="title_text">#fff</color>

    <color name="primary">#2196F3</color>
    <color name="primary_dark">#1976D2</color>
    <color name="accent">#03A9F4</color>

    <color name="green_seek_bar">#CDDC39</color>

</resources>


text:
<?php

namespace Finite\Test;

use Finite\State\State;
use  Finite\StateMachine\StateMachine;
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;

/**
 * @author Yohan Giarelli <yohan@giarel.li>
 */
class StateMachineTestCase extends TestCase
{
    /**
     * @var StateMachine
     */
    protected $object;

    /**
     * @var MockObject
     */
    protected $dispatcher;

    protected $accessor;

    public function setUp(): void
    {
        $this->accessor = $this->createMock('Finite\State\Accessor\StateAccessorInterface');
        $this->dispatcher = $this->getMockBuilder('Finite\Event\StateMachineDispatcher')
            ->disableOriginalConstructor()
            ->getMock();

        $this->object = new StateMachine(null, $this->dispatcher, $this->accessor);
    }

    public function statesProvider()
    {
        return array(
            array(new State('s1', State::TYPE_INITIAL)),
            array(new State('s2', State::TYPE_NORMAL, array(), array('visible' => true))),
            array('s3'),
            array(new State('s4', State::TYPE_NORMAL, array(), array('visible' => true))),
            array(new State('s5', State::TYPE_FINAL, array(), array('visible' => false))),
        );
    }

    public function transitionsProvider()
    {
        return array(
            array('t12', 's1', 's2'),
            array('t23', 's2', 's3'),
            array('t34', 's3', 's4'),
            array('t45', 's4', 's5'),
        );
    }

    protected function addStates()
    {
        foreach ($this->statesProvider() as $state) {
            $this->object->addState($state[0]);
        }
    }

    protected function addTransitions()
    {
        foreach ($this->transitionsProvider() as $transitions) {
            $this->object->addTransition($transitions[0], $transitions[1], $transitions[2]);
        }
    }

    protected function initialize()
    {
        $this->addStates();
        $this->addTransitions();
        $this->object->setObject($this->getStatefulObjectMock());
        $this->object->initialize();
    }

    protected function getStatefulObjectMock()
    {
        $mock = $this->createMock('Finite\StatefulInterface');
        $this->accessor->expects($this->at(0))->method('getState')->will($this->returnValue('s2'));

        return $mock;
    }
}


text:
<?php

use yii\helpers\Html;
use yii\grid\GridView;

/* @var $this yii\web\View */
/* @var $searchModel app\models\AdendosSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */

$session = Yii::$app->session;
$processo_id = $session['sess_processo'];

$this->title = 'Adendos';
$this->params['breadcrumbs'][] = ['label' => 'Processos Seletivos', 'url' => ['processo-seletivo/index']];
$this->params['breadcrumbs'][] = ['label' => $processo_id, 'url' => ['processo-seletivo/view', 'id' => $processo_id]];
$this->params['breadcrumbs'][] = $this->title;
?>

<?php
foreach (Yii::$app->session->getAllFlashes() as $key => $message) {
echo '
' . $message . '
';
}
?>

<?= Html::encode($this->title) ?>

    <?php // echo $this->render('_search', ['model' => $searchModel]); ?>

        <?= Html::a('Inserir Adendo', ['create'], ['class' => 'btn btn-success']) ?>

    <?= GridView::widget([
        'dataProvider' => $dataProvider,
        'filterModel' => $searchModel,
        'columns' => [
            ['class' => 'yii\grid\SerialColumn'],

            [
                         'label'=>'Arquivos',
                         'format'=>'raw',
                         'value' => function($model, $key, $index){
                             $url = Yii::$app->request->baseUrl . "/" . $model->adendos;
                             return Html::a($model->adendos, $url, ['target'=> '_blank']);
                         }
            ],

            ['class' => 'yii\grid\ActionColumn', 'template' => '{update} {delete}'],
        ],
    ]); ?>


text:
package cz.syntea.nb.sqlxml.tests;

import org.junit.Test;
import static org.junit.Assert.*;

public class RootTest {

     @Test
     public void root() {}
}


text:
//Switch to the appropriate trace level
#define TRACE_LEVEL STD_SERVICES_TRACE_LEVEL

//Dependencies
#include "core/net.h"
#include "std_services/chargen.h"
#include "debug.h"

//Character pattern (from RFC 864)
const char_t pattern[190] =
{
   '!', '"', '#',  '$', '%', '&', '\'', '(', ')', '*', '+', ',', '-', '.', '/', '0', '1', '2', '3',
   '4', '5', '6',  '7', '8', '9', ':',  ';', '<', '=', '>', '?', '@', 'A', 'B', 'C', 'D', 'E', 'F',
   'G', 'H', 'I',  'J', 'K', 'L', 'M',  'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y',
   'Z', '[', '\\', ']', '^', '_', '`',  'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l',
   'm', 'n', 'o',  'p', 'q', 'r', 's',  't', 'u', 'v', 'w', 'x', 'y', 'z', '{', '|', '}', '~', ' ',
   '!', '"', '#',  '$', '%', '&', '\'', '(', ')', '*', '+', ',', '-', '.', '/', '0', '1', '2', '3',
   '4', '5', '6',  '7', '8', '9', ':',  ';', '<', '=', '>', '?', '@', 'A', 'B', 'C', 'D', 'E', 'F',
   'G', 'H', 'I',  'J', 'K', 'L', 'M',  'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y',
   'Z', '[', '\\', ']', '^', '_', '`',  'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l',
   'm', 'n', 'o',  'p', 'q', 'r', 's',  't', 'u', 'v', 'w', 'x', 'y', 'z', '{', '|', '}', '~', ' '
};

/**
 * @brief Start TCP chargen service
 * @return Error code
 **/

error_t tcpChargenStart(void)
{
   error_t error;
   Socket *socket;
   OsTask *task;

   //Debug message
   TRACE_INFO("Starting TCP chargen service...\r\n");

   //Open a TCP socket
   socket = socketOpen(SOCKET_TYPE_STREAM, SOCKET_IP_PROTO_TCP);
   //Failed to open socket?
   if(!socket) return ERROR_OPEN_FAILED;

   //Start of exception handling block
   do
   {
      //Bind the newly created socket to port 19
      error = socketBind(socket, &IP_ADDR_ANY, CHARGEN_PORT);
      //Failed to bind the socket to the desired port?
      if(error) break;

      //Place the socket into listening mode
      error = socketListen(socket, 0);
      //Any error to report?
      if(error) break;

      //Create a task to handle incoming connection requests
      task = osCreateTask("TCP Chargen Listener", tcpChargenListenerTask,
         socket, CHARGEN_SERVICE_STACK_SIZE, CHARGEN_SERVICE_PRIORITY);

      //Unable to create the task?
      if(task == OS_INVALID_HANDLE)
      {
         //Report an error to the calling function
         error = ERROR_OUT_OF_RESOURCES;
         break;
      }

      //End of exception handling block
   } while(0);

   //Any error to report?
   if(error)
   {
      //Clean up side effects...
      socketClose(socket);
   }

   //Return status code
   return error;
}

/**
 * @brief Task handling connection requests
 * @param[in] param Pointer to the chargen service context
 **/

void tcpChargenListenerTask(void *param)
{
   error_t error;
   uint16_t clientPort;
   IpAddr clientIpAddr;
   Socket *serverSocket;
   Socket *clientSocket;
   ChargenServiceContext *context;
   OsTask *task;

   //Point to the listening socket
   serverSocket = (Socket *) param;

   //Main loop
   while(1)
   {
      //Accept an incoming connection
      clientSocket = socketAccept(serverSocket, &clientIpAddr, &clientPort);
      //Check whether a valid connection request has been received
      if(!clientSocket) continue;

      //Debug message
      TRACE_INFO("Chargen service: connection established with client %s port %" PRIu16 "\r\n",
         ipAddrToString(&clientIpAddr, NULL), clientPort);

      //Adjust timeout
      error = socketSetTimeout(clientSocket, CHARGEN_TIMEOUT);

      //Any error to report?
      if(error)
      {
         //Close socket
         socketClose(clientSocket);
         //Wait for an incoming connection attempt
         continue;
      }

      //Allocate resources for the new connection
      context = osAllocMem(sizeof(ChargenServiceContext));

      //Failed to allocate memory?
      if(!context)
      {
         //Close socket
         socketClose(clientSocket);
         //Wait for an incoming connection attempt
         continue;
      }

      //Record the handle of the newly created socket
      context->socket = clientSocket;

      //Create a task to service the current connection
      task = osCreateTask("TCP Chargen Connection", tcpChargenConnectionTask,
         context, CHARGEN_SERVICE_STACK_SIZE, CHARGEN_SERVICE_PRIORITY);

      //Did we encounter an error?
      if(task == OS_INVALID_HANDLE)
      {
         //Close socket
         socketClose(clientSocket);
         //Release resources
         osFreeMem(context);
      }
   }
}

/**
 * @brief TCP chargen service implementation
 * @param[in] param Pointer to the chargen service context
 **/

void tcpChargenConnectionTask(void *param)
{
   error_t error;
   //size_t i;
   size_t n;
   //size_t offset;
   size_t byteCount;
   systime_t startTime;
   systime_t duration;
   ChargenServiceContext *context;

   //Get a pointer to the context
   context = (ChargenServiceContext *) param;
   //Get current time
   startTime = osGetSystemTime();

   //Initialize counters
   byteCount = 0;
   //offset = 0;

   //Once a connection is established a stream of data is sent out
   //the connection (and any data received is thrown away). This
   //continues until the calling user terminates the connection
   while(1)
   {
      //Format output data
      /*for(i = 0; i < CHARGEN_BUFFER_SIZE; i += 95)
      {
         //Calculate the length of the current line
         n = MIN(CHARGEN_BUFFER_SIZE - i, 95);
         //Copy character pattern
         memcpy(context->buffer + i, pattern + offset, n);
      }

      //Update offset
      offset += CHARGEN_BUFFER_SIZE + 95 - i;
      //Wrap around if necessary
      if(offset >= 95) offset = 0;*/

      //Send data
      error = socketSend(context->socket, context->buffer, CHARGEN_BUFFER_SIZE, &n, 0);
      //Any error to report?
      if(error) break;

      //Total number of bytes sent
      byteCount += n;
   }

   //Graceful shutdown
   socketShutdown(context->socket, SOCKET_SD_BOTH);
   //Compute total duration
   duration = osGetSystemTime() - startTime;
   //Avoid division by zero...
   if(!duration) duration = 1;

   //Debug message
   TRACE_INFO("Chargen service: %" PRIuSIZE " bytes "
      "sent in %" PRIu32 " ms (%" PRIu32 " kBps, %" PRIu32 " kbps)\r\n",
      byteCount, duration, byteCount / duration, (byteCount * 8) / duration);

   //Close socket
   socketClose(context->socket);
   //Release previously allocated memory
   osFreeMem(context);

   //Kill ourselves
   osDeleteTask(NULL);
}

/**
 * @brief Start UDP chargen service
 * @return Error code
 **/

error_t udpChargenStart(void)
{
   error_t error;
   ChargenServiceContext *context;
   OsTask *task;

   //Debug message
   TRACE_INFO("Starting UDP chargen service...\r\n");

   //Allocate a memory block to hold the context
   context = osAllocMem(sizeof(ChargenServiceContext));
   //Failed to allocate memory?
   if(!context) return ERROR_OUT_OF_MEMORY;

   //Start of exception handling block
   do
   {
      //Open a UDP socket
      context->socket = socketOpen(SOCKET_TYPE_DGRAM, SOCKET_IP_PROTO_UDP);

      //Failed to open socket?
      if(!context->socket)
      {
         //Report an error
         error = ERROR_OPEN_FAILED;
         //Exit immediately
         break;
      }

      //The server listens for incoming datagrams on port 19
      error = socketBind(context->socket, &IP_ADDR_ANY, CHARGEN_PORT);
      //Unable to bind the socket to the desired port?
      if(error) break;

      //Create a task to handle incoming datagrams
      task = osCreateTask("UDP Chargen", udpChargenTask,
         context, CHARGEN_SERVICE_STACK_SIZE, CHARGEN_SERVICE_PRIORITY);

      //Unable to create the task?
      if(task == OS_INVALID_HANDLE)
      {
         //Report an error to the calling function
         error = ERROR_OUT_OF_RESOURCES;
         break;
      }

      //End of exception handling block
   } while(0);

   //Any error to report?
   if(error)
   {
      //Clean up side effects...
      socketClose(context->socket);
      osFreeMem(context);
   }

   //Return status code
   return error;
}

/**
 * @brief UDP chargen service implementation
 * @param[in] param Pointer to the chargen service context
 **/

void udpChargenTask(void *param)
{
   error_t error;
   size_t i;
   size_t k;
   size_t n;
   size_t length;
   uint16_t port;
   IpAddr ipAddr;
   ChargenServiceContext *context;

   //Get a pointer to the context
   context = (ChargenServiceContext *) param;

   //Main loop
   while(1)
   {
      //Wait for an incoming datagram
      error = socketReceiveFrom(context->socket, &ipAddr, &port,
         context->buffer, CHARGEN_BUFFER_SIZE, &n, 0);

      //Any datagram received?
      if(!error)
      {
         //When a datagram is received, an answering datagram is sent
         //containing a random number (between 0 and 512) of characters
         length = netGetRand() % 513;

         //Reset line counter
         n = 0;

         //Format output data
         for(i = 0; i < length; i += 74)
         {
            //Calculate the length of the current line
            k = MIN(length - i, 74);
            //Copy character pattern
            memcpy(context->buffer + i, pattern + n, k);

            //End each line with carriage return and line feed
            if(k == 74)
            {
               context->buffer[i + 72] = '\r';
               context->buffer[i + 73] = '\n';
            }

            //Increment line counter
            if(++n >= 95) n = 0;
         }

         //Send data to the remote host
         error = socketSendTo(context->socket, &ipAddr, port,
            context->buffer, length, &n, 0);

         //Debug message
         TRACE_INFO("Chargen service: %" PRIuSIZE " bytes sent to %s port %" PRIu16 "\r\n",
            n, ipAddrToString(&ipAddr, NULL), port);
      }
   }
}


text:
cask 'gltfquicklook' do
  version '0.2.2'
  sha256 'be9d7d65572ba50fbe71e1318b24f10bbba00bba9a9ca77a6d9219cac4b70b15'

  url "https://github.com/magicien/GLTFQuickLook/releases/download/v#{version}/GLTFQuickLook_v#{version}.zip"
  appcast 'https://github.com/magicien/GLTFQuickLook/releases.atom',
          checkpoint: '400dc1e96814ff7738b72741c5941832df3349dffb74481f57e6432bbe9499c3'
  name 'GLTFQuickLook'
  homepage 'https://github.com/magicien/GLTFQuickLook'

  qlplugin "GLTFQuickLook_v#{version}/GLTFQuickLook.qlgenerator"
end


text:
class WelcomeController < ApplicationController
	def index
  		render :file => 'public/app/index.html' and return
	end
end


text:
<?xml version="1.0" encoding="utf-8"?>
<!--
  ~ Copyright (C) 2016 Jecelyin Peng <jecelyin@gmail.com>
  ~
  ~ This file is part of 920 Text Editor.
  ~
  ~ Licensed under the Apache License, Version 2.0 (the "License");
  ~ you may not use this file except in compliance with the License.
  ~ You may obtain a copy of the License at
  ~
  ~      http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS,
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License.
  -->

<resources>
    <string name="crash_report">تقرير الانهيار</string>
    <string name="crash_contact">الإيميل (اختياري)</string>
    <string name="crash_comment">كيف حدث الانهيار (اختياري):</string>
    <string name="crash_report_success">تم بنجاح, شكرا لك!</string>
    <string name="crash_stacktrace">التتبع المكدس:</string>
    <string name="crash_submit">تقديم</string>
    <string name="crash_submit_fail_x">فشل: %s</string>
    <string name="network_unavailable">الشبكة غير متوفرة</string>
    <string name="submitting">جار التقديم…</string>
    <string name="can_not_be_empty">لا يمكن أن يكون فارغا</string>
    <string name="no_data">لا توجد بيانات</string>
    <string name="try_agent">أعد المحاولة</string>
    <string name="search_results">نتائج البحث</string>
    <string name="directory">الدليل</string>
    <string name="authenticate">المصادقة</string>
    <string name="logout">الخروج</string>
    <string name="selected_x_items">حددت %d عناصر</string>
    <string name="filename">اسم الملف:</string>
    <string name="file_encoding">التشفير:</string>
    <string name="file_save">حفظ</string>
    <string name="root_path">الجذر</string>
    <string name="auto_detection_encoding">كشف تلقائي للتشفير</string>
    <string name="illegal_filename">اسم الملف غير قانوني</string>
    <string name="unknown_path">مسا  غير معروف</string>
    <string name="open_file">فتح ملف</string>
    <string name="save_file">حفظ ملف</string>
    <string name="override_file_prompt">%s موجود بالفعل، هل تريد تجاوز ذلك؟</string>
    <string name="filter_by_name">تصفية حسب الاسم</string>
    <string name="can_not_create_folder">غير قادر على إنشاء مجلد</string>
    <string name="can_not_share_x">غير قادر على مشاركة الملف: %s</string>
    <string name="cancel_select_all">إلغاء تحديد الكل</string>
    <string name="copy">نسخ</string>
    <string name="create_folder">إنشاء مجلد</string>
    <string name="cut">قص</string>
    <string name="delete">حذف</string>
    <string name="paste">لصق</string>
    <string name="rename">إعادة تسمية</string>
    <string name="rename_fail">فشل إعادة التسمية</string>
    <string name="select_all">تحديد الكل</string>
    <string name="share">مشاركة</string>
    <string name="show_hidden_files">عرض الملفات المخفية</string>
    <string name="sort_by_datetime">ترتيب حسب التاريخ</string>
    <string name="sort_by_name">ترتيب حسب الاسم</string>
    <string name="sort_by_size">ترتيب حسب الحجم</string>
    <string name="sort_by_type">ترتيب حسب النوع</string>
    <string name="addToDictionary">إضافة إلى القاموس</string>
    <string name="deleteText">حذف النص</string>
    <string name="replace">استبدال</string>
    <string name="textSelectionCABTitle">تحديد النص</string>
    <string name="selectAll">تحديد الكل</string>
    <string name="find">إيجاد</string>
    <string name="app_name">920 محرر النص</string>
    <string name="new_file">جديد</string>
    <string name="open">فتح</string>
    <string name="save">حفظ</string>
    <string name="undo">تراجع</string>
    <string name="redo">استعادة</string>
    <string name="save_all">حفظ الكل</string>
    <string name="save_as">حفظ بإسم</string>
    <string name="recent_files">الملفات الأخيرة</string>
    <string name="line_separator">سطر فاصل</string>
    <string name="duplication_line">سطر مزدوج</string>
    <string name="find_in_files">إيجاد في الملفات</string>
    <string name="jump_to_start">قفز إلى البداية</string>
    <string name="jump_to_end">قفز إلى النهاية</string>
    <string name="goto_line">ذهاب إلى سطر</string>
    <string name="back">رجوع</string>
    <string name="forward">إعادة توجيه</string>
    <string name="document_info">معلومات المستند</string>
    <string name="symbol">رمز</string>
    <string name="insert_color">إدراج لون</string>
    <string name="highlight_language">لغة العناوين الرئيسية</string>
    <string name="encoding">التشفير</string>
    <string name="read_only">للقراءة فقط</string>
    <string name="insert_datetime">إدراج الوقت والتاريخ</string>
    <string name="edit_mode">وضع التحرير</string>
    <string name="run">إقلاع</string>
    <string name="file">ملف</string>
    <string name="other">أخرى</string>
    <string name="view">عرض</string>
    <string name="edit">تحرير</string>
    <string name="new_filename">بدون عنوان %d</string>
    <string name="confirm_save">تأكيد الحفظ</string>
    <string name="confirm_save_msg">المستند %s قد تغير، هل تريد الحفظ والخروج؟</string>
    <string name="yes">نعم</string>
    <string name="no">لا</string>
    <string name="cannt_access_file">لا يمكن الوصول إلى الملف: %s</string>
    <string name="cannt_read_file">لا يمكن قراءة الملف: %s</string>
    <string name="ok">موافق</string>
    <string name="read_file_exception">"حدث استثناء عند قراءة الملف: "</string>
    <string name="init_syntax_msg">تهيئة الجملة…</string>
    <string name="init_syntax_error">فشل تهيئة الجملة</string>
    <string name="init_build_index_error">فشل بناء الفهرس</string>
    <string name="close">إغلاق</string>
    <string name="cancel">إلغاء</string>
    <string name="convert_wrap_char">تحويل إلى التفاف الحرف</string>
    <string name="path_x">المسار: %s</string>
    <string name="char_x">الحروف: %d</string>
    <string name="word_x">الكلمات: %d</string>
    <string name="line_number_x">رقم السطر: %d</string>
    <string name="encoding_x">التشفير: %s</string>
    <string name="tab">انقر</string>
    <string name="no_change">لا يوجد تغيير!</string>
    <string name="save_success">تم الحفظ بنجاح</string>
    <string name="find_label">إيجاد ماذا:</string>
    <string name="replace_label">استبدال بـ:</string>
    <string name="case_sensitive">تحسس حالة الأحرف</string>
    <string name="whole_words_only">الكلمة بالكامل فقط</string>
    <string name="regex">تنسيق واضح</string>
    <string name="in_path">في المسار:</string>
    <string name="recursively">بشكل تكراري</string>
    <string name="cannot_be_empty">لا بمكن أن بكون فارغا</string>
    <string name="path_not_exists">المسار غير موجود</string>
    <string name="find_not_found">غير موجود</string>
    <string name="previous_occurrence">الحالة السابقة</string>
    <string name="next_occurrence">الحالة التالية</string>
    <string name="replace_all">استبدال الكل</string>
    <string name="searching">البحث…</string>
    <string name="select_lang_to_highlight">حدد اللغة للعناوين الرئيسية</string>
    <string name="more_menu">قائمة إضافية</string>
    <string name="reopen_with_encoding">إعادة فتح بالتشفير</string>
    <string name="document_changed">المستند متغير</string>
    <string name="give_up_document_changed_message">الوثيقة قد تغيرت، التغييرات سيتم فقدانها لو لست قد حفظتها، تأكيد؟</string>
    <string name="preview_in_browser">عرض بالمتصفع</string>
    <string name="use_sl4a_in_background_run_script">استخدم SL4A إقلاع الوثيقة بالخلفية</string>
    <string name="use_sl4a_in_terminal_run_script">استخدم SL4A إقلاع الوثيقة بالنهاية</string>
    <string name="please_save_as_file_first">مدة الحفظ للملف أولا</string>
    <string name="run_fail_message">فشل استدعاء تطبيق خارجي</string>
    <string name="settings">الإعدادات</string>
    <string name="editor">المحرر</string>
    <string name="font">الخط</string>
    <string name="default_value">الافتراضي</string>
    <string name="font_size">حجم الخط</string>
    <string name="cursor_width">عرض المؤشر</string>
    <string name="touch_to_adjust_text_size">إلمس لتغيير حجم النص</string>
    <string name="word_wrap_in_editor">التفاف النص تلقائي</string>
    <string name="show_linenumber">عرض رقم الخط</string>
    <string name="show_whitespace">عرض المسافة البيضاء</string>
    <string name="auto_indent">مسافة بادئة تلقائية</string>
    <string name="insert_space_for_tab">إدراج مساحة للتبويب</string>
    <string name="indent_size">حجم المسافة البادئة</string>
    <string name="highlight_and_theme">العناوين الرئيسية والموضوع</string>
    <string name="highlight_the_file_size_limit">الحد الأقصى لحجم ملف العناوين الرئيسية</string>
    <string name="auto_save">حفظ تلقائي للملف</string>
    <string name="remember_last_opened_files">تذكر آخر الملفات المفتوحة</string>
    <string name="remember_last_opened_files_summary">فتح آخر الملفات التي تم فتحها عند بدء التشغيل تلقائيا</string>
    <string name="screen_orientation">اتجاه الشاشة</string>
    <string name="keep_screen_on">إبقاء الشاشة تعمل</string>
    <string name="auto_capitalize">حرف استهلالي كبير تلقائيا</string>
    <string name="feedback">ردود الفعل</string>
    <string name="donate">التبرع</string>
    <string name="help_translate">ترجم هذا التطبيق</string>
    <string name="about">حول</string>
    <string name="enable_highlight">تمكين العناوين الرئيسية</string>
    <string name="version_x">النسخة: %s</string>
    <string name="need_to_enable_read_storage_permissions">تحتاج إلى تمكين أذونات قراءة ذاكرة التخزين</string>
    <string name="file_not_exists">الملف غير موجود</string>
    <string name="cannt_handle_intent_x">لا يمكن معالجة الهدف: %s</string>
    <string name="handle_intent_x_error">حدث خطأ عند معالجة الهدف: %s</string>
    <string name="verify_sign_failure">تطبيقك الحالي ليس رسميا، يرجى الذهاب إلى https://github.com/jecelyin/920-text-editor-v2/releases لتحميله.</string>
    <string name="press_again_will_exit">انقر مرة أخرى للخروج</string>
    <string name="find_replace">إيجاد/استبدال</string>
    <string name="find_title">\"%s\" نتائج الإيجاد</string>
    <string name="zero_matches">0 مماثلة</string>
    <string name="chooser_browser">اختر المتصفح</string>
    <string name="find_or_replace">إيجاد/استبدال…</string>
    <string name="other_application">تطبيق آخر…</string>
    <string name="chooser_application">اختر تطبيق</string>
    <string name="editor_create_unknown_exception">حدث استثناء غير معروف عند إنشاء المحرر</string>
    <string name="convert_to_uppercase">تحويل إلى أحرف كبيرة</string>
    <string name="convert_to_lowercase">تحويل إلى أحرف صغيرة</string>
    <string name="duplication_text">نص مزدوج</string>
    <string name="tab_size">حجم التبويب</string>
    <string name="new_version_available">تتوفر نسخة جديدة</string>
    <string name="upgrade">ترقية</string>
    <string name="new_version_update_content">أحدث نسخة: %1$s\n\nالتغييرات:\n%2$s</string>
    <string name="auto_check_updates">التحقق من التحديثات تلقائيا</string>
    <string name="cannt_download">لا يمكن التحميل.</string>
    <string name="readonly_mode_not_support_this_action">نمط القراءة فقط لا يدعم هذا العمل</string>
    <string name="x_text_replaced">%d نص أصبح مستبدلا</string>
    <string name="enable_root">تمكين الجذر</string>
    <string name="my_name">المؤلف: Jecelyin Peng         ترجمة بلال الخولاني</string>
    <string name="open_with_external_browser">فتح بمتصفح خارجي</string>
    <string name="contact_email_optional">تواصل بالبريد الاكتروني (اختياري)</string>
    <string name="with_error_logs">سجلات الخطأ</string>
    <string name="content">المحتوى</string>
    <string name="send">إرسال</string>
    <string name="feedback_content_length_must_be_greater_than_x_char">يجب أن يكون طول محتوى ردود الفعل أكبر من %d حرف</string>
    <string name="feedback_submit_error_x">إرسال الخطأ: %s</string>
    <string name="submit_success">تم الإرسال بنجاح</string>
    <string name="writing">جار الكتابة</string>
    <string name="keyword">الكلمة</string>
    <string name="find_keyword_is_empty">الكلمة لا يمكن أن تكون فارغة</string>
    <plurals name="x_text_replaced">
        <item quantity="zero">0 وجدت</item>
        <item quantity="other">%d نص مستبدل</item>
    </plurals>
    <string-array name="insert_datetime_lang">
        <item>الإنجليزية</item>
        <item>الصينية</item>
        <item>الإنجليزية</item>
    </string-array>
    <string-array name="wrap_char_list">
        <item>التحويل إلى \\n(Linux/OSX)</item>
        <item>التحويل إلى \\r\\n(Windows)</item>
    </string-array>
    <string-array name="screen_orientation">
        <item>تلقائي</item>
        <item>تدوير الشاشة</item>
        <item>لوحة</item>
    </string-array>
    <string name="exit">خروج</string>
    <string name="unknown_exception_and_report_message_x">استثناء غير معروف، من فضلك قل لي ما هذه الحالة التي تحدث، شكرا لك\nCode: %s</string>
    <string name="keep_backup_file">الاحتفاظ بملف النسخة الاحتياطية</string>
    <string name="keep_backup_file_summary">أقترح عليك أن تبقي ملفات النسخ الاحتياطي، وتجنب الاخطاء الملف للاستثناء</string>
    <string name="save_all_without_new_document_message">حفظ الكل سوف يتخطى المستند الجديد</string>
    <string name="clear_history">تنظيف سجل التاريخ</string>
    <string name="custom_symbol_list">قائمة رمز مخصصة</string>
    <string name="reset">إعادة ضبط</string>
    <string name="change_theme">تغيير الموصوع</string>
    <string name="dark_theme">موضوع داكن</string>
    <string name="default_theme">الموضوع الافتراضي</string>
    <string name="fullscreen_mode">نمط ملء الشاشة</string>
    <string name="enable_fullscreen_mode_message">إعادة تشغيل التطبيق سيمكن وضع ملء الشاشة</string>
    <string name="disabled_fullscreen_mode_message">إعادة تشغيل التطبيق سيعطل وضع ملء الشاشة</string>
    <string name="confirm_change_theme_message">تغيير الموضوع سوف لن يحفظ المستند، قم بتأكيد رفض المستند لتغيير الموضوع؟</string>
    <string name="translate_confirm_message">لفتح getlocalization.com موقع الترجمة، يرجى الضغط على "موقع الترجمة" الزر في ضغط الترجمة المحلية زر "الترجمة المحلية"</string>
    <string name="translate_external_text">موقع الترجمة</string>
    <string name="translate_internal_text">الترجمة المحلية</string>
    <string name="cannt_load_lang_file">لا يمكن تحميل ملف اللغة</string>
    <string name="local_translate_message">يرجى إرسالها إلى jecelyin@gmail.com بعد انتهائك من الترجمة!</string>
</resources>


text:
import {
  Action as HistoryAction,
  History,
  Location as HistoryLocation,
  createBrowserHistory as createHistory,
} from 'history';
import React from 'react';
import { BrowserRouterProps, Router } from 'react-router-dom';

import { IonRouter } from './IonRouter';

interface IonReactRouterProps extends BrowserRouterProps {
  history?: History;
}

export class IonReactRouter extends React.Component<IonReactRouterProps> {
  historyListenHandler?: (location: HistoryLocation, action: HistoryAction) => void;
  history: History;

  constructor(props: IonReactRouterProps) {
    super(props);
    const { history, ...rest } = props;
    this.history = history || createHistory(rest);
    this.history.listen(this.handleHistoryChange.bind(this));
    this.registerHistoryListener = this.registerHistoryListener.bind(this);
  }

  handleHistoryChange(location: HistoryLocation, action: HistoryAction) {
    if (this.historyListenHandler) {
      this.historyListenHandler(location, action);
    }
  }

  registerHistoryListener(cb: (location: HistoryLocation, action: HistoryAction) => void) {
    this.historyListenHandler = cb;
  }

  render() {
    const { children, ...props } = this.props;
    return (
      <Router history={this.history} {...props}>
        <IonRouter registerHistoryListener={this.registerHistoryListener}>{children}</IonRouter>
      </Router>
    );
  }
}


text:
    <meta charset="utf-8">
    <title> Tests </title>
    <link rel="stylesheet" href="../../node_modules/mocha/mocha.css" />


text:
repohub
=====================

The SolusOS Repo and Buildfarm Management Interface
NOTE: You must use Python2.6 for Celery to work correctly

NOTES:
Admin's password is 'admin' (see fixtures)

Installation
-------------

**RabbitMQ**

     sudo rabbitmqctl add_user repohub repohub
     sudo rabbitmqctl add_vhost repohub
     sudo rabbitmqctl set_permissions -p repohub repohub ".*" ".*" ".*"

**From the base directory of the repohub repository:**

     virtualenv backend
     source backend/bin/activate
     pip install -r web/requirements.txt

**Usage:**

     cd web/
     source ../backend/bin/activate
     python manage.py syncdb --noinput
     python manage.py runserver

**Start the celery daemon**

    python manage.py celery worker -E -B

Other Daemons
-------------
RepoHub requires that rsyncd be running and configured for use by RepoHub.
We need to be able to receive log files from the build slave.

/etc/rsyncd.conf
----------------
    motd file = /etc/rsyncd.motd

    [buildlogs]
    path = /home/repohub/logs
    comment = RepoHub log files
    uid = repohub
    gid = repohub
    read only = false
    auth users = repohub
    secrets file = /etc/rsyncd.secret

/etc/rsyncd.secrets (mode 600)
------------------------------
    repohub:repohub

Now navigate to locahost:8080 to try out repohub