repo_name
stringlengths 4
116
| path
stringlengths 4
379
| size
stringlengths 1
7
| content
stringlengths 3
1.05M
| license
stringclasses 15
values |
---|---|---|---|---|
ochi51/CybozuHttpBundle | tests/DependencyInjection/CybozuHttpExtensionTest.php | 1672 | <?php
namespace CybozuHttpBundle\Tests\DependencyInjection;
use CybozuHttpBundle\DependencyInjection\CybozuHttpExtension;
use Matthias\SymfonyDependencyInjectionTest\PhpUnit\AbstractExtensionTestCase;
/**
* @author ochi51 <[email protected]>
*/
class CybozuHttpExtensionTest extends AbstractExtensionTestCase
{
/**
* @var array
*/
private static $config = [
'domain' => 'cybozu.com',
'subdomain' => 'test',
'use_api_token' => false,
'login' => '[email protected]',
'password' => 'password',
'token' => null,
'use_basic' => true,
'basic_login' => 'basic_login',
'basic_password' => 'password',
'use_client_cert' => false,
'cert_file' => '/path/to/cert.pem',
'cert_password' => 'password',
'use_cache' => true,
'cache_dir' => '/path/to/cache_dir',
'cache_ttl' => 60
];
public function testServiceDefinitions()
{
$this->load();
$this->assertContainerBuilderHasService('cybozu_http.client', 'CybozuHttp\Client');
$this->assertContainerBuilderHasService('cybozu_http.kintone_api_client', 'CybozuHttp\Api\KintoneApi');
$this->assertContainerBuilderHasService('cybozu_http.user_api_client', 'CybozuHttp\Api\UserApi');
$this->assertContainerBuilderHasService('cybozu_http.cybozu.config', 'CybozuHttpBundle\Cybozu\Config');
}
/**
* {@inheritdoc}
*/
protected function getContainerExtensions()
{
return [new CybozuHttpExtension()];
}
}
| mit |
janij/ionic | js/angular/directive/sideMenuContent.js | 9465 | /**
* @ngdoc directive
* @name ionSideMenuContent
* @module ionic
* @restrict E
* @parent ionic.directive:ionSideMenus
*
* @description
* A container for the main visible content, sibling to one or more
* {@link ionic.directive:ionSideMenu} directives.
*
* @usage
* ```html
* <ion-side-menu-content
* edge-drag-threshold="true"
* drag-content="true">
* </ion-side-menu-content>
* ```
* For a complete side menu example, see the
* {@link ionic.directive:ionSideMenus} documentation.
*
* @param {boolean=} drag-content Whether the content can be dragged. Default true.
* @param {boolean|number=} edge-drag-threshold Whether the content drag can only start if it is below a certain threshold distance from the edge of the screen. Default false. Accepts three types of values:
* - If a non-zero number is given, that many pixels is used as the maximum allowed distance from the edge that starts dragging the side menu.
* - If true is given, the default number of pixels (25) is used as the maximum allowed distance.
* - If false or 0 is given, the edge drag threshold is disabled, and dragging from anywhere on the content is allowed.
*
*/
IonicModule
.directive('ionSideMenuContent', [
'$timeout',
'$ionicGesture',
'$window',
function($timeout, $ionicGesture, $window) {
return {
restrict: 'EA', //DEPRECATED 'A'
require: '^ionSideMenus',
scope: true,
compile: function(element, attr) {
element.addClass('menu-content pane');
return { pre: prelink };
function prelink($scope, $element, $attr, sideMenuCtrl) {
var startCoord = null;
var primaryScrollAxis = null;
if (isDefined(attr.dragContent)) {
$scope.$watch(attr.dragContent, function(value) {
sideMenuCtrl.canDragContent(value);
});
} else {
sideMenuCtrl.canDragContent(true);
}
if (isDefined(attr.edgeDragThreshold)) {
$scope.$watch(attr.edgeDragThreshold, function(value) {
sideMenuCtrl.edgeDragThreshold(value);
});
}
// Listen for taps on the content to close the menu
function onContentTap(gestureEvt) {
if (sideMenuCtrl.getOpenAmount() !== 0) {
sideMenuCtrl.close();
gestureEvt.gesture.srcEvent.preventDefault();
startCoord = null;
primaryScrollAxis = null;
} else if (!startCoord) {
startCoord = ionic.tap.pointerCoord(gestureEvt.gesture.srcEvent);
}
}
function onDragX(e) {
if (!sideMenuCtrl.isDraggableTarget(e)) return;
if (getPrimaryScrollAxis(e) == 'x') {
sideMenuCtrl._handleDrag(e);
e.gesture.srcEvent.preventDefault();
}
}
function onDragY(e) {
if (getPrimaryScrollAxis(e) == 'x') {
e.gesture.srcEvent.preventDefault();
}
}
function onDragRelease(e) {
sideMenuCtrl._endDrag(e);
startCoord = null;
primaryScrollAxis = null;
}
function getPrimaryScrollAxis(gestureEvt) {
// gets whether the user is primarily scrolling on the X or Y
// If a majority of the drag has been on the Y since the start of
// the drag, but the X has moved a little bit, it's still a Y drag
if (primaryScrollAxis) {
// we already figured out which way they're scrolling
return primaryScrollAxis;
}
if (gestureEvt && gestureEvt.gesture) {
if (!startCoord) {
// get the starting point
startCoord = ionic.tap.pointerCoord(gestureEvt.gesture.srcEvent);
} else {
// we already have a starting point, figure out which direction they're going
var endCoord = ionic.tap.pointerCoord(gestureEvt.gesture.srcEvent);
var xDistance = Math.abs(endCoord.x - startCoord.x);
var yDistance = Math.abs(endCoord.y - startCoord.y);
var scrollAxis = (xDistance < yDistance ? 'y' : 'x');
if (Math.max(xDistance, yDistance) > 30) {
// ok, we pretty much know which way they're going
// let's lock it in
primaryScrollAxis = scrollAxis;
}
return scrollAxis;
}
}
return 'y';
}
var content = {
element: element[0],
onDrag: function() {},
endDrag: function() {},
setCanScroll: function(canScroll) {
var c = $element[0].querySelector('.scroll');
if (!c) {
return;
}
var content = angular.element(c.parentElement);
if (!content) {
return;
}
// freeze our scroll container if we have one
var scrollScope = content.scope();
scrollScope.scrollCtrl && scrollScope.scrollCtrl.freezeScrollShut(!canScroll);
},
getTranslateX: function() {
return $scope.sideMenuContentTranslateX || 0;
},
setTranslateX: ionic.animationFrameThrottle(function(amount) {
var xTransform = content.offsetX + amount;
console.log("XTRANS:"+amount+":"+xTransform);
$element[0].style[ionic.CSS.TRANSFORM] = 'translate3d(' + xTransform + 'px,0,0)';
// $element.parent()[0].style[ionic.CSS.TRANSFORM] = 'translate3d(' + xTransform + 'px,0,0)';
engine.trigger("SetTranslateX", amount);
$timeout(function() {
$scope.sideMenuContentTranslateX = amount;
if (amount == 0)
$scope.sideMenuIsClosed();
});
}),
setMarginLeft: ionic.animationFrameThrottle(function(amount) {
if (amount) {
amount = parseInt(amount, 10);
$element[0].style[ionic.CSS.TRANSFORM] = 'translate3d(' + amount + 'px,0,0)';
$element[0].style.width = ($window.innerWidth - amount) + 'px';
content.offsetX = amount;
} else {
$element[0].style[ionic.CSS.TRANSFORM] = 'translate3d(0,0,0)';
$element[0].style.width = '';
content.offsetX = 0;
}
}),
setMarginRight: ionic.animationFrameThrottle(function(amount) {
if (amount) {
amount = parseInt(amount, 10);
$element[0].style.width = ($window.innerWidth - amount) + 'px';
content.offsetX = amount;
} else {
$element[0].style.width = '';
content.offsetX = 0;
}
// reset incase left gets grabby
$element[0].style[ionic.CSS.TRANSFORM] = 'translate3d(0,0,0)';
}),
setMarginLeftAndRight: ionic.animationFrameThrottle(function(amountLeft, amountRight) {
amountLeft = amountLeft && parseInt(amountLeft, 10) || 0;
amountRight = amountRight && parseInt(amountRight, 10) || 0;
var amount = amountLeft + amountRight;
if (amount > 0) {
$element[0].style[ionic.CSS.TRANSFORM] = 'translate3d(' + amountLeft + 'px,0,0)';
$element[0].style.width = ($window.innerWidth - amount) + 'px';
content.offsetX = amountLeft;
} else {
$element[0].style[ionic.CSS.TRANSFORM] = 'translate3d(0,0,0)';
$element[0].style.width = '';
content.offsetX = 0;
}
// reset incase left gets grabby
//$element[0].style[ionic.CSS.TRANSFORM] = 'translate3d(0,0,0)';
}),
enableAnimation: function() {
$scope.animationEnabled = true;
$element[0].classList.add('menu-animated');
},
disableAnimation: function() {
$scope.animationEnabled = false;
$element[0].classList.remove('menu-animated');
},
offsetX: 0
};
sideMenuCtrl.setContent(content);
// add gesture handlers
var gestureOpts = { stop_browser_behavior: false };
gestureOpts.prevent_default_directions = ['left', 'right'];
var contentTapGesture = $ionicGesture.on('tap', onContentTap, $element, gestureOpts);
var dragRightGesture = $ionicGesture.on('dragright', onDragX, $element, gestureOpts);
var dragLeftGesture = $ionicGesture.on('dragleft', onDragX, $element, gestureOpts);
var dragUpGesture = $ionicGesture.on('dragup', onDragY, $element, gestureOpts);
var dragDownGesture = $ionicGesture.on('dragdown', onDragY, $element, gestureOpts);
var releaseGesture = $ionicGesture.on('release', onDragRelease, $element, gestureOpts);
// Cleanup
$scope.$on('$destroy', function() {
if (content) {
content.element = null;
content = null;
}
$ionicGesture.off(dragLeftGesture, 'dragleft', onDragX);
$ionicGesture.off(dragRightGesture, 'dragright', onDragX);
$ionicGesture.off(dragUpGesture, 'dragup', onDragY);
$ionicGesture.off(dragDownGesture, 'dragdown', onDragY);
$ionicGesture.off(releaseGesture, 'release', onDragRelease);
$ionicGesture.off(contentTapGesture, 'tap', onContentTap);
});
}
}
};
}]);
| mit |
laincloud/hagrid | models/user.go | 4742 | package models
import (
"time"
"github.com/jinzhu/gorm"
"github.com/laincloud/hagrid/config"
)
type User struct {
ID int `gorm:"primary_key:true" form:"-"`
Name string `gorm:"type:varchar(64);not null;unique" form:"-"`
EmailAddress string `gorm:"type:varchar(64);not null" form:"email_address"`
PhoneNumber string `gorm:"type:varchar(64);not null" form:"phone_number"`
BearychatTeam string `gorm:"type:varchar(64);not null" form:"bearychat_team"`
BearychatToken string `gorm:"type:varchar(64);not null" form:"bearychat_token"`
BearychatChannel string `gorm:"type:varchar(64);not null" form:"bearychat_channel"`
PushbulletToken string `gorm:"type:varchar(64);not null" form:"pushbullet_token"`
SlackTeam string `gorm:"type:varchar(64);not null" form:"slack_team"`
SlackToken string `gorm:"type:varchar(64);not null" form:"slack_token"`
SlackChannel string `gorm:"type:varchar(64);not null" form:"slack_channel"`
CreatedAt time.Time
AdminedAlerts []Alert `gorm:"many2many:alert_to_user_admin"`
NotifiedAlerts []Alert `gorm:"many2many:alert_to_user_notify"`
}
func AddUserIfNotExists(name string) error {
maybeNewUser := &User{
Name: name,
}
syncLock.Lock()
defer syncLock.Unlock()
return db.FirstOrCreate(maybeNewUser, maybeNewUser).Error
}
func UpdateUser(user *User) error {
syncLock.Lock()
defer syncLock.Unlock()
if err := db.Save(user).Error; err != nil {
return err
}
return renderUsers()
}
func GetUser(userName string, user *User) error {
if err := db.First(user, "name = ?", userName).Error; err != nil {
return err
}
return db.Model(&user).Association("AdminedAlerts").Find(&(user.AdminedAlerts)).Error
}
func GetAllUsers(users *[]User, namePattern string) error {
return db.Select("id, name").Where("name LIKE ? AND name <> ?", namePattern, config.GetSuperUser()).Find(users).Error
}
func GetAllUsersDetails(users *[]User, namePattern string) error {
return db.Where("name LIKE ? AND name <> ?", namePattern, config.GetSuperUser()).Find(users).Error
}
func GetNotifiersByAlertID(id int, notifiers *[]User) error {
return db.Model(&Alert{ID: id}).Association("Notifiers").Find(notifiers).Error
}
func DeleteNotifier(alertID, notifierID int) error {
return db.Exec("DELETE FROM `alert_to_user_notify` where alert_id = ? and user_id = ?", alertID, notifierID).Error
}
func AddNotifier(alertID, notifierID int) error {
if isNotifierDuplicated(alertID, notifierID) {
return ErrorDuplicatedName
}
if err := db.First(&User{}, notifierID).Error; err != nil {
return err
}
return db.Exec("INSERT INTO `alert_to_user_notify`(alert_id, user_id) values(?, ?)", alertID, notifierID).Error
}
func isNotifierDuplicated(alertID, notifierID int) bool {
var count int
err := db.Table("alert_to_user_notify").Where("alert_id = ? and user_id = ?", alertID, notifierID).Count(&count).Error
return count != 0 || err != nil
}
func GetAdminsByAlertID(id int, admins *[]User) error {
return db.Model(&Alert{ID: id}).Association("Admins").Find(admins).Error
}
func DeleteAdmin(alertID, adminID int) error {
return db.Exec("DELETE FROM `alert_to_user_admin` where alert_id = ? and user_id = ?", alertID, adminID).Error
}
func AddAdmin(alertID, adminID int) error {
if isAdminDuplicated(alertID, adminID) {
return ErrorDuplicatedName
}
if err := db.First(&User{}, adminID).Error; err != nil {
return err
}
return db.Exec("INSERT INTO `alert_to_user_admin`(alert_id, user_id) values(?, ?)", alertID, adminID).Error
}
func isAdminDuplicated(alertID, adminID int) bool {
var count int
err := db.Table("alert_to_user_admin").Where("alert_id = ? and user_id = ?", alertID, adminID).Count(&count).Error
return count != 0 || err != nil
}
func IsSuperUser(userID int) (bool, error) {
var err error
if err = db.First(&User{}, "id = ? AND name = ?", userID, config.GetSuperUser()).Error; err == nil {
return true, nil
}
if err == gorm.ErrRecordNotFound {
return false, nil
}
return false, err
}
func renderUsers() error {
var (
users []User
err error
data, newStage string
)
if err = GetAllUsersDetails(&users, "%%%%"); err != nil {
return err
}
data, err = renderTemplate("users.tmpl", map[string][]User{"Users": users})
if err != nil {
return err
}
icinga2Client.CreatePackage(userPackage)
if newStage, err = icinga2Client.UploadFiles(userPackage,
map[string]string{
"conf.d/user.conf": data,
}); err != nil {
return err
}
pkg, _ := icinga2Client.GetPackage(userPackage)
if pkg != nil {
for _, stage := range pkg.Stages {
if stage != newStage && stage != pkg.ActiveStage {
icinga2Client.DeleteStage(userPackage, stage)
}
}
}
return nil
}
| mit |
TBoehm/greedyaur | src/checkpoints.cpp | 2529 | // Copyright (c) 2009-2012 The Bitcoin developers
// Copyright (c) 2011-2012 Litecoin Developers
// Copyright (c) 2013 AuroraCoin Developers
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include <boost/assign/list_of.hpp> // for 'map_list_of()'
#include <boost/foreach.hpp>
#include "checkpoints.h"
#include "main.h"
#include "uint256.h"
namespace Checkpoints
{
typedef std::map<int, uint256> MapCheckpoints;
//
// What makes a good checkpoint block?
// + Is surrounded by blocks with reasonable timestamps
// (no blocks before with a timestamp after, none after with
// timestamp before)
// + Contains no strange transactions
//
static MapCheckpoints mapCheckpoints =
boost::assign::map_list_of
( 0, uint256("0x2a8e100939494904af825b488596ddd536b3a96226ad02e0f7ab7ae472b27a8e"))
( 1, uint256("0xf54c0f8ed0b8ba85f99525d37e7cc9a5107bd752a54d8778d6cfb4f36cb51131"))
( 2, uint256("0x2e739d971f02265b83895c04854fcb4deb48806126097b5feaf92ffd4d2341d6"))
( 123, uint256("0x76b2378c0cd904584d9c226d9ef7a4a91a4ed701f2da36e4bd486d0c7a27b1fd"))
( 5810, uint256("0x71517f8219449fd56ade24c888bbfd7d228c898d2aac8a078fd655be4182e813"))
( 6350, uint256("0x76afd9f23e61b513e0c5224754943a1b1a6ddbed73586416363095808ac12eb1"))
;
bool CheckBlock(int nHeight, const uint256& hash)
{
if (fTestNet) return true; // Testnet has no checkpoints
MapCheckpoints::const_iterator i = mapCheckpoints.find(nHeight);
if (i == mapCheckpoints.end()) return true;
return hash == i->second;
}
int GetTotalBlocksEstimate()
{
if (fTestNet) return 0;
return mapCheckpoints.rbegin()->first;
}
CBlockIndex* GetLastCheckpoint(const std::map<uint256, CBlockIndex*>& mapBlockIndex)
{
if (fTestNet) return NULL;
BOOST_REVERSE_FOREACH(const MapCheckpoints::value_type& i, mapCheckpoints)
{
const uint256& hash = i.second;
std::map<uint256, CBlockIndex*>::const_iterator t = mapBlockIndex.find(hash);
if (t != mapBlockIndex.end())
return t->second;
}
return NULL;
}
uint256 GetLatestHardenedCheckpoint()
{
const MapCheckpoints& checkpoints = mapCheckpoints;
return (checkpoints.rbegin()->second);
}
}
| mit |
AndrewGaspar/Podcasts | Podcasts.Shared/Transport/ForeroundMessageTransport.cs | 2449 | using System;
using System.Threading.Tasks;
using Podcasts.Messages;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.Media.Playback;
namespace Podcasts.Transport
{
using ServiceReadyHandler = TypedEventHandler<ForeroundMessageTransport, ServiceReadyNotification>;
public class ForeroundMessageTransport : MessageTransport
{
public void Start()
{
AttachEventHandlers();
}
public void Stop()
{
DetachEventHandlers();
}
// Internal events
private event ServiceReadyHandler ServiceReady;
private void NotifyServiceReady(ServiceReadyNotification notification)
{
var ready = ServiceReady;
if (ready != null)
{
ready(this, notification);
}
}
protected override void AttachEventHandlersInternal()
{
BackgroundMediaPlayer.MessageReceivedFromBackground += OnMessageReceived;
}
protected override void DetachEventHandlersInternal()
{
BackgroundMediaPlayer.MessageReceivedFromBackground -= OnMessageReceived;
}
private void SendPing()
{
SendMessage(new ServiceReadyRequest());
}
public void RequestPlayback(PlayEpisodeRequest request)
{
SendMessage(request);
}
public async Task PingServiceAsync()
{
var tcs = new TaskCompletionSource<int>();
ServiceReadyHandler callback = (sender, e) => tcs.SetResult(1);
ServiceReady += callback;
SendPing();
var result = await Task.WhenAny(tcs.Task, Task.Delay(10000));
ServiceReady -= callback;
if (result != tcs.Task)
{
throw new Exception("Background audio service ping timed out.");
}
}
protected override void HandleMessage(ValueSet message)
{
new MessageParseHelper()
.Try<ServiceReadyNotification>(NotifyServiceReady)
.Invoke(message);
}
private void Current_CurrentStateChanged(MediaPlayer sender, object args)
{
throw new NotImplementedException();
}
protected override void SendMessageRaw(ValueSet message) => BackgroundMediaPlayer.SendMessageToBackground(message);
}
} | mit |
myhgew/JGame_Slogo_Team11 | src/model/Model.java | 646 | package model;
import java.util.ResourceBundle;
import java.util.Map;
import controller.ControllerToModelInterface;
import java.util.Stack;
import model.expression.Expression;
import model.parser.Parser;
import Exceptions.SlogoException;
public abstract class Model {
public abstract void updateTrace (String userInput) throws SlogoException;
public abstract Map<String, Expression> getGlobalVariables ();
public abstract Map<String, Expression> getRunningFunction ();
public abstract Parser getParser();
public abstract ControllerToModelInterface getController ();
public abstract Stack<String> getFunctionStack ();
}
| mit |
node-opcua/node-opcua | packages/node-opcua-nodeset-ua/source/ua_highly_managed_alarm_condition_class.ts | 824 | // ----- this file has been automatically generated - do not edit
import { UABaseConditionClass, UABaseConditionClass_Base } from "./ua_base_condition_class"
/**
* | | |
* |----------------|--------------------------------------------------|
* |namespace |http://opcfoundation.org/UA/ |
* |nodeClass |ObjectType |
* |typedDefinition |HighlyManagedAlarmConditionClassType ns=0;i=17219 |
* |isAbstract |true |
*/
export interface UAHighlyManagedAlarmConditionClass_Base extends UABaseConditionClass_Base {
}
export interface UAHighlyManagedAlarmConditionClass extends UABaseConditionClass, UAHighlyManagedAlarmConditionClass_Base {
} | mit |
MassDebaters/DebateApp | DebateAppDomain/DebateAppDomainAPI/Program.cs | 610 | using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;
namespace DebateAppDomainAPI
{
public class Program
{
public static void Main(string[] args)
{
BuildWebHost(args).Run();
}
public static IWebHost BuildWebHost(string[] args) =>
WebHost.CreateDefaultBuilder(args)
.UseStartup<Startup>()
.Build();
}
}
| mit |
nickb1080/fast-poser | test/test.js | 20153 | var should = require('should'),
expect = require('expect.js'),
fast = require('../lib')();
describe('fast.bind()', function () {
var input = function (a, b, c) {
return a + b + c + this.seed;
};
var object = {
seed: 100
};
it('should bind to a context', function () {
var bound = fast.bind(input, object);
bound(1,2,3).should.equal(106);
});
it('should partially apply a function', function () {
var bound = fast.bind(input, object, 1, 2);
bound(3).should.equal(106);
});
});
describe('fast.partial()', function () {
var input = function (a, b, c) {
return a + b + c + this.seed;
};
var object = {
seed: 100
};
it('should partially apply a function', function () {
object.foo = fast.partial(input, 1, 2);
object.foo(3).should.equal(106);
})
});
describe('fast.partialConstructor()', function () {
var Constructor = function (baz, greeting) {
this.bar = 10;
this.baz = baz;
this.greeting = greeting;
};
Constructor.prototype.foo = function () {
return this.bar + this.baz;
};
var Partial = fast.partialConstructor(Constructor, 32),
instance;
beforeEach(function () {
instance = new Partial("hello world");
});
it('should be an instanceof the original constructor', function () {
instance.should.be.an.instanceOf(Constructor);
});
it('should apply the bound arguments', function () {
instance.baz.should.equal(32);
});
it('should apply the supplied arguments', function () {
instance.greeting.should.equal("hello world");
});
it('should supply methods from the prototype', function () {
instance.foo().should.equal(42);
});
it('should work without the new keyword', function () {
instance = Partial('hello world');
instance.should.be.an.instanceOf(Constructor);
instance.foo().should.equal(42);
instance.greeting.should.equal('hello world');
});
});
describe('fast.clone()', function () {
it('should return primitives directly', function () {
fast.clone(0).should.equal(0);
fast.clone("hello world").should.equal("hello world");
});
it('should clone arrays', function () {
fast.clone([1,2,3]).should.eql([1,2,3]);
});
it('should clone objects', function () {
fast.clone({a: 1, b: 2, c: 3}).should.eql({a: 1, b: 2, c: 3});
});
});
describe('fast.cloneArray()', function () {
var input = [1,2,3,4,5];
it('should clone an array', function () {
fast.cloneArray(input).should.eql(input);
});
it('should clone an arguments object', function () {
// don't actually do this, it leaks the arguments object
(function () { return fast.cloneArray(arguments); }).apply(this, input).should.eql(input);
});
});
describe('fast.cloneObject()', function () {
var input = {
a: 1,
b: 2,
c: 3
};
it('should clone an object', function () {
fast.cloneObject(input).should.eql(input);
});
});
describe('fast.concat()', function () {
var input = [1, 2, 3];
it('should concatenate an array of items', function () {
fast.concat(input, [4, 5, 6]).should.eql([1,2,3,4,5,6]);
});
it('should concatenate a list of items', function () {
fast.concat(input, 4, 5, 6).should.eql([1,2,3,4,5,6]);
});
it('should concatenate a mixed array / list of items', function () {
fast.concat(input, [4, 5], 6).should.eql([1,2,3,4,5,6]);
});
});
describe('fast.map()', function () {
var input = [1,2,3,4,5];
it('should map over a list of items', function () {
var result = fast.map(input, function (item) {
return item * item;
});
result.should.eql([1, 4, 9, 16, 25]);
});
it('should take context', function () {
fast.map([1], function () {
this.should.equal(fast);
}, fast);
});
});
describe('fast.filter()', function () {
var input = [1,2,3,4,5];
it('should filter a list of items', function () {
var result = fast.filter(input, function (item) {
return item % 2;
});
result.should.eql([1, 3, 5]);
});
it('should take context', function () {
fast.map([1], function () {
this.should.equal(fast);
}, fast);
});
});
describe('fast.reduce()', function () {
var input = [1,2,3,4,5];
it('should reduce a list of items', function () {
var result = fast.reduce(input, function (last, item) {
return last + item;
}, 0);
result.should.equal(15);
});
it('should take context', function () {
fast.reduce([1], function () {
this.should.equal(fast);
}, {}, fast);
});
it('should use input[0] if initialValue isn\'t provided', function() {
var result = fast.reduce(input, function (last, item) {
return last + item;
});
result.should.equal(15);
});
});
describe('fast.reduceRight()', function () {
var input = ["a", "b", "c"];
it('should reduce a list of items', function () {
var result = fast.reduceRight(input, function (last, item) {
return last + item;
}, "z");
result.should.equal("zcba");
});
it('should take context', function () {
fast.reduceRight([1], function () {
this.should.equal(fast);
}, {}, fast);
});
it('should use input[input.length - 1] if initialValue isn\'t provided', function() {
var result = fast.reduceRight(input, function (last, item) {
return last + item;
});
result.should.equal("cba");
});
});
describe('fast.forEach()', function () {
var input = [1,2,3,4,5];
it('should iterate over a list of items', function () {
var result = 0;
fast.forEach(input, function (item) {
result += item;
});
result.should.equal(15);
});
it('should take context', function () {
fast.forEach([1], function () {
this.should.equal(fast);
}, fast);
});
});
describe('fast.some()', function () {
var input = [1,2,3,4,5];
it('should return true if the check passes', function () {
var result = fast.some(input, function (item) {
return item === 3;
});
result.should.be.true;
});
it('should return false if the check fails', function () {
var result = fast.some(input, function (item) {
return item === 30000;
});
result.should.be.false;
});
it('should take context', function () {
fast.some([1], function () {
this.should.equal(fast);
}, fast);
});
});
describe('fast.indexOf()', function () {
var input = [1,2,3,4,5];
it('should return the index of the first item', function () {
fast.indexOf(input, 1).should.equal(0);
});
it('should return the index of the last item', function () {
fast.indexOf(input, 5).should.equal(4);
});
it('should return -1 if the item does not exist in the array', function () {
fast.indexOf(input, 1000).should.equal(-1);
});
var arr = [1,2,3];
arr[-2] = 4; // Throw a wrench in the gears by assigning a non-valid array index as object property.
it('finds 1', function() {
fast.indexOf(arr, 1).should.equal(0);
});
it('finds 1 and is result strictly it', function() {
fast.indexOf(arr, 1).should.equal(0);
});
it('does not find 4', function() {
fast.indexOf(arr, 4).should.equal(-1);
});
it('Uses strict equality', function() {
fast.indexOf(arr, '1').should.equal(-1);
});
it('from index 1', function() {
fast.indexOf(arr, 2, 1).should.equal(1);
});
it('from index 2', function() {
fast.indexOf(arr, 2, 2).should.equal(-1);
});
it('from index 3', function() {
fast.indexOf(arr, 2, 3).should.equal(-1);
});
it('from index 4', function() {
fast.indexOf(arr, 2, 4).should.equal(-1);
});
it('from index -1', function() {
fast.indexOf(arr, 3, -1).should.equal(2);
});
it('from index -2', function() {
fast.indexOf(arr, 3, -2).should.equal(2);
});
it('from index -3', function() {
fast.indexOf(arr, 3, -3).should.equal(2);
});
it('from index -4', function() {
fast.indexOf(arr, 3, -4).should.equal(2);
});
});
describe('fast.lastIndexOf()', function () {
var input = [1,2,3,4,5,1];
it('should return the last index of the first item', function () {
fast.lastIndexOf(input, 1).should.equal(5);
});
it('should return the index of the last item', function () {
fast.lastIndexOf(input, 5).should.equal(4);
});
it('should return -1 if the item does not exist in the array', function () {
fast.lastIndexOf(input, 1000).should.equal(-1);
});
var arr = ['a', 1, 'a'];
arr[-2] = 'a'; // Throw a wrench in the gears by assigning a non-valid array index as object property.
it('Array#lastIndexOf | finds a', function () {
fast.lastIndexOf(arr, 'a').should.equal(2);
});
it('Array#lastIndexOf | does not find c', function () {
fast.lastIndexOf(arr, 'c').should.equal(-1);
});
it( 'Array#lastIndexOf | Uses strict equality', function () {
fast.lastIndexOf(arr, '1').should.equal(-1);
});
it( 'Array#lastIndexOf | from index 1', function () {
fast.lastIndexOf(arr, 'a', 1).should.equal(0);
});
it( 'Array#lastIndexOf | from index 2', function () {
fast.lastIndexOf(arr, 'a', 2).should.equal(2);
});
it( 'Array#lastIndexOf | from index 3', function () {
fast.lastIndexOf(arr, 'a', 3).should.equal(2);
});
it( 'Array#lastIndexOf | from index 4', function () {
fast.lastIndexOf(arr, 'a', 4).should.equal(2);
});
it( 'Array#lastIndexOf | from index 0', function () {
fast.lastIndexOf(arr, 'a', 0).should.equal(0);
});
it('Array#lastIndexOf | from index -1', function () {
fast.lastIndexOf(arr, 'a', -1).should.equal(2);
});
it('Array#lastIndexOf | from index -2', function () {
fast.lastIndexOf(arr, 'a', -2).should.equal(0);
});
it('Array#lastIndexOf | from index -3', function () {
fast.lastIndexOf(arr, 'a', -3).should.equal(0);
});
it('Array#lastIndexOf | from index -4', function () {
fast.lastIndexOf(arr, 'a', -4).should.equal(-1);
});
});
describe('fast.try()', function () {
it('should return the value', function () {
var result = fast.try(function () {
return 123;
});
result.should.equal(123);
});
it('should return the error, if thrown', function () {
var result = fast.try(function () {
throw new Error('foo');
});
result.should.be.an.instanceOf(Error);
});
it('should return the error, if thrown, even if it\'s a string error', function () {
var result = fast.try(function () {
throw "Please don't do this, use an Error object";
});
result.should.be.an.instanceOf(Error);
});
});
describe('fast.apply()', function () {
var fn = function (a, b, c, d, e, f, g, h, i, j, k) {
return {
a: a,
b: b,
c: c,
d: d,
e: e,
f: f,
g: g,
h: h,
i: i,
j: j,
this: this
};
};
describe('noContext', function () {
it ('should apply 0 arguments', function () {
var result = fast.apply(fn, undefined, []);
expect(result.a).to.equal(undefined);
});
it ('should apply 1 argument', function () {
var result = fast.apply(fn, undefined, [1]);
expect(result.a).to.equal(1);
});
it ('should apply 2 arguments', function () {
var result = fast.apply(fn, undefined, [1, 2]);
expect(result.a).to.equal(1);
expect(result.b).to.equal(2);
});
it ('should apply 3 arguments', function () {
var result = fast.apply(fn, undefined, [1, 2, 3]);
expect(result.a).to.equal(1);
expect(result.b).to.equal(2);
expect(result.c).to.equal(3);
});
it ('should apply 4 arguments', function () {
var result = fast.apply(fn, undefined, [1, 2, 3, 4]);
expect(result.a).to.equal(1);
expect(result.b).to.equal(2);
expect(result.c).to.equal(3);
expect(result.d).to.equal(4);
});
it ('should apply 5 arguments', function () {
var result = fast.apply(fn, undefined, [1, 2, 3, 4, 5]);
expect(result.a).to.equal(1);
expect(result.b).to.equal(2);
expect(result.c).to.equal(3);
expect(result.d).to.equal(4);
expect(result.e).to.equal(5);
});
it ('should apply 6 arguments', function () {
var result = fast.apply(fn, undefined, [1, 2, 3, 4, 5, 6]);
expect(result.a).to.equal(1);
expect(result.b).to.equal(2);
expect(result.c).to.equal(3);
expect(result.d).to.equal(4);
expect(result.e).to.equal(5);
expect(result.f).to.equal(6);
});
it ('should apply 7 arguments', function () {
var result = fast.apply(fn, undefined, [1, 2, 3, 4, 5, 6, 7]);
expect(result.a).to.equal(1);
expect(result.b).to.equal(2);
expect(result.c).to.equal(3);
expect(result.d).to.equal(4);
expect(result.e).to.equal(5);
expect(result.f).to.equal(6);
expect(result.g).to.equal(7);
});
it ('should apply 8 arguments', function () {
var result = fast.apply(fn, undefined, [1, 2, 3, 4, 5, 6, 7, 8]);
expect(result.a).to.equal(1);
expect(result.b).to.equal(2);
expect(result.c).to.equal(3);
expect(result.d).to.equal(4);
expect(result.e).to.equal(5);
expect(result.f).to.equal(6);
expect(result.g).to.equal(7);
expect(result.h).to.equal(8);
});
it ('should apply 9 arguments', function () {
var result = fast.apply(fn, undefined, [1, 2, 3, 4, 5, 6, 7, 8, 9]);
expect(result.a).to.equal(1);
expect(result.b).to.equal(2);
expect(result.c).to.equal(3);
expect(result.d).to.equal(4);
expect(result.e).to.equal(5);
expect(result.f).to.equal(6);
expect(result.g).to.equal(7);
expect(result.h).to.equal(8);
expect(result.i).to.equal(9);
});
it ('should apply 10 arguments', function () {
var result = fast.apply(fn, undefined, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]);
expect(result.a).to.equal(1);
expect(result.b).to.equal(2);
expect(result.c).to.equal(3);
expect(result.d).to.equal(4);
expect(result.e).to.equal(5);
expect(result.f).to.equal(6);
expect(result.g).to.equal(7);
expect(result.h).to.equal(8);
expect(result.i).to.equal(9);
expect(result.j).to.equal(10);
});
});
describe('withContext', function () {
var obj = {};
it ('should apply 0 arguments', function () {
var result = fast.apply(fn, obj, []);
expect(result.this).to.equal(obj);
expect(result.a).to.equal(undefined);
});
it ('should apply 1 argument', function () {
var result = fast.apply(fn, obj, [1]);
expect(result.this).to.equal(obj);
expect(result.a).to.equal(1);
});
it ('should apply 2 arguments', function () {
var result = fast.apply(fn, obj, [1, 2]);
expect(result.this).to.equal(obj);
expect(result.a).to.equal(1);
expect(result.b).to.equal(2);
});
it ('should apply 3 arguments', function () {
var result = fast.apply(fn, obj, [1, 2, 3]);
expect(result.this).to.equal(obj);
expect(result.a).to.equal(1);
expect(result.b).to.equal(2);
expect(result.c).to.equal(3);
});
it ('should apply 4 arguments', function () {
var result = fast.apply(fn, obj, [1, 2, 3, 4]);
expect(result.this).to.equal(obj);
expect(result.a).to.equal(1);
expect(result.b).to.equal(2);
expect(result.c).to.equal(3);
expect(result.d).to.equal(4);
});
it ('should apply 5 arguments', function () {
var result = fast.apply(fn, obj, [1, 2, 3, 4, 5]);
expect(result.this).to.equal(obj);
expect(result.a).to.equal(1);
expect(result.b).to.equal(2);
expect(result.c).to.equal(3);
expect(result.d).to.equal(4);
expect(result.e).to.equal(5);
});
it ('should apply 6 arguments', function () {
var result = fast.apply(fn, obj, [1, 2, 3, 4, 5, 6]);
expect(result.this).to.equal(obj);
expect(result.a).to.equal(1);
expect(result.b).to.equal(2);
expect(result.c).to.equal(3);
expect(result.d).to.equal(4);
expect(result.e).to.equal(5);
expect(result.f).to.equal(6);
});
it ('should apply 7 arguments', function () {
var result = fast.apply(fn, obj, [1, 2, 3, 4, 5, 6, 7]);
expect(result.this).to.equal(obj);
expect(result.a).to.equal(1);
expect(result.b).to.equal(2);
expect(result.c).to.equal(3);
expect(result.d).to.equal(4);
expect(result.e).to.equal(5);
expect(result.f).to.equal(6);
expect(result.g).to.equal(7);
});
it ('should apply 8 arguments', function () {
var result = fast.apply(fn, obj, [1, 2, 3, 4, 5, 6, 7, 8]);
expect(result.this).to.equal(obj);
expect(result.a).to.equal(1);
expect(result.b).to.equal(2);
expect(result.c).to.equal(3);
expect(result.d).to.equal(4);
expect(result.e).to.equal(5);
expect(result.f).to.equal(6);
expect(result.g).to.equal(7);
expect(result.h).to.equal(8);
});
it ('should apply 9 arguments', function () {
var result = fast.apply(fn, obj, [1, 2, 3, 4, 5, 6, 7, 8, 9]);
expect(result.this).to.equal(obj);
expect(result.a).to.equal(1);
expect(result.b).to.equal(2);
expect(result.c).to.equal(3);
expect(result.d).to.equal(4);
expect(result.e).to.equal(5);
expect(result.f).to.equal(6);
expect(result.g).to.equal(7);
expect(result.h).to.equal(8);
expect(result.i).to.equal(9);
});
it ('should apply 10 arguments', function () {
var result = fast.apply(fn, obj, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]);
expect(result.this).to.equal(obj);
expect(result.a).to.equal(1);
expect(result.b).to.equal(2);
expect(result.c).to.equal(3);
expect(result.d).to.equal(4);
expect(result.e).to.equal(5);
expect(result.f).to.equal(6);
expect(result.g).to.equal(7);
expect(result.h).to.equal(8);
expect(result.i).to.equal(9);
expect(result.j).to.equal(10);
});
});
});
describe('Fast', function () {
var input = fast([1,2,3,4,5,6]);
describe('constructor', function () {
it('should return a Fast instance', function () {
input.should.be.an.instanceOf(fast);
});
it('should wrap the value', function () {
input.value.should.eql([1,2,3,4,5,6]);
});
it('should assign an empty array if none given', function () {
fast().length.should.equal(0);
fast().value.should.eql([]);
});
});
describe('length', function () {
it('should give the correct length', function () {
input.length.should.equal(6);
});
})
it('should map over the list', function () {
var result = input.map(function (item) {
return item * 2;
});
result.should.be.an.instanceOf(fast);
result.length.should.equal(6);
result.value.should.eql([2,4,6,8,10,12]);
});
it('should filter the list', function () {
var result = input.filter(function (item) {
return item % 2;
});
result.should.be.an.instanceOf(fast);
result.value.should.eql([1,3,5]);
});
it('should reduce over the list', function () {
var result = input.reduce(function (last, item) {
return last + item
});
result.should.equal(21);
});
it('should iterate over the list', function () {
var result = 0;
input.forEach(function (item) {
result += item;
});
result.should.equal(21);
});
it('should return true for ', function () {
var result = input.reduce(function (last, item) {
return last + item
});
result.should.equal(21);
});
describe('integration', function () {
var result;
beforeEach(function () {
result = input
.map(function (item) {
return item * 2;
})
.reverse()
.filter(function (item) {
return item % 3 === 0;
})
.map(function (item) {
return item / 2;
})
.concat(1, [2, 3]);
});
it('should perform functions in a chain', function () {
result.should.be.an.instanceOf(fast);
});
it('reduce to a final value', function () {
result.reduce(function (a, b) { return a + b; }).should.equal(15);
});
});
});
| mit |
chafey/cornerstone | src/internal/calculateTransform.js | 3500 | import { Transform } from './transform.js';
/**
* Calculate the transform for a Cornerstone enabled element
*
* @param {EnabledElement} enabledElement The Cornerstone Enabled Element
* @param {Number} [scale] The viewport scale
* @return {Transform} The current transform
* @memberof Internal
*/
export default function (enabledElement, scale) {
const transform = new Transform();
// Move to center of canvas
transform.translate(enabledElement.canvas.width / 2, enabledElement.canvas.height / 2);
// Apply the rotation before scaling for non square pixels
const angle = enabledElement.viewport.rotation;
if (angle !== 0) {
transform.rotate(angle * Math.PI / 180);
}
// Apply the scale
let widthScale = enabledElement.viewport.scale;
let heightScale = enabledElement.viewport.scale;
const width = enabledElement.viewport.displayedArea.brhc.x - (enabledElement.viewport.displayedArea.tlhc.x - 1);
const height = enabledElement.viewport.displayedArea.brhc.y - (enabledElement.viewport.displayedArea.tlhc.y - 1);
if (enabledElement.viewport.displayedArea.presentationSizeMode === 'NONE') {
if (enabledElement.image.rowPixelSpacing < enabledElement.image.columnPixelSpacing) {
widthScale *= (enabledElement.image.columnPixelSpacing / enabledElement.image.rowPixelSpacing);
} else if (enabledElement.image.columnPixelSpacing < enabledElement.image.rowPixelSpacing) {
heightScale *= (enabledElement.image.rowPixelSpacing / enabledElement.image.columnPixelSpacing);
}
} else {
// These should be good for "TRUE SIZE" and "MAGNIFY"
widthScale = enabledElement.viewport.displayedArea.columnPixelSpacing;
heightScale = enabledElement.viewport.displayedArea.rowPixelSpacing;
if (enabledElement.viewport.displayedArea.presentationSizeMode === 'SCALE TO FIT') {
// Fit TRUE IMAGE image (width/height) to window
const verticalScale = enabledElement.canvas.height / (height * heightScale);
const horizontalScale = enabledElement.canvas.width / (width * widthScale);
// Apply new scale
widthScale = heightScale = Math.min(horizontalScale, verticalScale);
if (enabledElement.viewport.displayedArea.rowPixelSpacing < enabledElement.viewport.displayedArea.columnPixelSpacing) {
widthScale *= (enabledElement.viewport.displayedArea.columnPixelSpacing / enabledElement.viewport.displayedArea.rowPixelSpacing);
} else if (enabledElement.viewport.displayedArea.columnPixelSpacing < enabledElement.viewport.displayedArea.rowPixelSpacing) {
heightScale *= (enabledElement.viewport.displayedArea.rowPixelSpacing / enabledElement.viewport.displayedArea.columnPixelSpacing);
}
}
}
transform.scale(widthScale, heightScale);
// Unrotate to so we can translate unrotated
if (angle !== 0) {
transform.rotate(-angle * Math.PI / 180);
}
// Apply the pan offset
transform.translate(enabledElement.viewport.translation.x, enabledElement.viewport.translation.y);
// Rotate again so we can apply general scale
if (angle !== 0) {
transform.rotate(angle * Math.PI / 180);
}
if (scale !== undefined) {
// Apply the font scale
transform.scale(scale, scale);
}
// Apply Flip if required
if (enabledElement.viewport.hflip) {
transform.scale(-1, 1);
}
if (enabledElement.viewport.vflip) {
transform.scale(1, -1);
}
// Move back from center of image
transform.translate(-width / 2, -height / 2);
return transform;
}
| mit |
sidoh/ha_gateway | ha_gateway.rb | 900 | require 'sinatra'
require 'sinatra/json'
require 'sinatra/param'
require 'sinatra/namespace'
require 'ledenet_api'
require 'bravtroller'
require 'easy_upnp'
require 'color'
require 'openssl'
require 'net/ping'
require 'open-uri'
require_relative 'helpers/config_provider'
require_relative 'helpers/security'
require_relative 'lib/mqtt_client_factory'
module HaGateway
class App < Sinatra::Application
before do
if security_enabled?
validate_request(request, params)
end
if request.content_type == 'application/json'
request.body.rewind
params.merge!(JSON.parse(request.body.read))
end
logger.info "Params: #{params.inspect}"
end
get '/:driver_type' do
content_type 'application/json'
get_devices(params[:driver_type]).keys.to_json
end
end
end
require_relative 'helpers/init'
require_relative 'routes/init'
| mit |
maksa988/MyUCP | engine/protected/Response/Redirect.php | 488 | <?php
class Redirect
{
private $url;
public function __construct($value, $params = [])
{
if(gettype($value) == "object") {
$this->url = $value->getRedirectURL($params);
} else {
$this->url = $value;
}
return $this;
}
public function with($name, $value = null)
{
flash($name, $value);
}
public function __destruct()
{
return registry()->response->redirect($this->url);
}
} | mit |
bollsal/pikicast-java-study | src/test/java/quiz/elevator/ElevatorTest.java | 4097 | package quiz.elevator;
import org.junit.Before;
import org.junit.Test;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
/**
* Created by bollsal on 2016. 11. 28..
*
* 10층짜리 건물.
*
* tick()호출시 1층씩 이동 (위아래상관없음)
*
*
* 1. 탑승객 인원 체크
*
* 2. 한사람만 타는 경우
* - 위로 올라가는 경우
* - 아래로 내려가는 경우
*
* 3. 두사람이 타는 경우
* - 같은 방향
* - 한사람이 내리고 반대로 가는 사람이 탄 경우
*
*/
public class ElevatorTest {
private Person person01;
private Person person02;
private Person person03;
private Elevator elevator;
@Before
public void setUp() {
person01 = new Person();
person02 = new Person();
person03 = new Person();
elevator = new Elevator();
elevator.setCurrentFloor(0);
}
@Test
public void 탑승객_인원체크() {
assertThat(elevator.getPersonCount(), is(0));
elevator.enterElevator(person01);
assertThat(elevator.getPersonCount(), is(1));
elevator.enterElevator(person01);
assertThat(elevator.getPersonCount(), is(2));
}
@Test
public void 한사람만타서_올라가는_경우() {
elevator.enterElevator(person01);
person01.setDestFloor(5);
elevatorWorking(person01.getDestFloor());
assertThat(elevator.getPersonCount(), is(0));
assertThat(elevator.getCurrentFloor(), is(person01.getDestFloor()));
}
@Test
public void 같은층에서_두사람이타서_올라가는_경우() {
sameDirectionTwoPerson();
elevatorWorking(Math.abs(person02.getDestFloor() - elevator.getCurrentFloor()));
assertThat(elevator.getPersonCount(), is(0));
assertThat(elevator.getCurrentFloor(), is(person02.getDestFloor()));
}
@Test
public void 같은층에서_두사람이올라갈때_첫번째지점에서_한명더합류_같은방향() {
sameDirectionTwoPerson();
elevator.enterElevator(person03);
person03.setDestFloor(10);
assertThat(elevator.getPersonCount(), is(2));
elevatorWorking(Math.abs(person02.getDestFloor() - elevator.getCurrentFloor()));
assertThat(elevator.getPersonCount(), is(1));
assertThat(elevator.getCurrentFloor(), is(person02.getDestFloor()));
elevatorWorking(Math.abs(person03.getDestFloor() - elevator.getCurrentFloor()));
assertThat(elevator.getPersonCount(), is(0));
assertThat(elevator.getCurrentFloor(), is(person03.getDestFloor()));
}
@Test
public void 같은층에서_두사람이_올라갈때_첫번째지점에서_한명더합류_다른반향() {
sameDirectionTwoPerson();
elevator.enterElevator(person03);
person03.setDestFloor(2);
assertThat(elevator.getPersonCount(), is(2));
elevatorWorking(Math.abs(person02.getDestFloor() - elevator.getCurrentFloor()));
assertThat(elevator.getPersonCount(), is(1));
assertThat(elevator.getCurrentFloor(), is(person02.getDestFloor()));
elevatorWorking(Math.abs(person03.getDestFloor() - elevator.getCurrentFloor()));
assertThat(elevator.getPersonCount(), is(0));
assertThat(elevator.getCurrentFloor(), is(person03.getDestFloor()));
}
private void sameDirectionTwoPerson() {
elevator.enterElevator(person01);
elevator.enterElevator(person02);
person01.setDestFloor(3);
person02.setDestFloor(7);
elevatorWorking(person01.getDestFloor());
assertThat(elevator.getPersonCount(), is(1));
assertThat(elevator.getCurrentFloor(), is(person01.getDestFloor()));
}
private void elevatorWorking(int destFloor) {
elevator.prepareElevator();
tickIterator(destFloor);
elevator.arrivalElevator();
}
private void tickIterator(int tick) {
for (int i = 0; i < tick; i++) {
elevator.tick();
}
}
}
| mit |
tokenly/bitsplit | app/Console/Commands/DeleteDistroTx.php | 2676 | <?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use Models\Distribution as Distro, Models\DistributionTx as DistroTx;
use Models\Fuel;
class DeleteDistroTx extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'bitsplit:deleteDistroTx {address} {out_address}';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Removes an entry from a distributions address list and recalculates total';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
//find distro
$address = $this->argument('address');
$out_address = $this->argument('out_address');
$distro = Distro::where('deposit_address', $address)->first();
if(!$distro){
$distro = Distro::where('id', intval($address))->first();
}
if(!$distro){
$this->error('Distribution not found');
return false;
}
//get tx list
$tx_list = DistroTx::where('distribution_id', $distro->id)->orderBy('id', 'asc')->get();
//check for matching entry
$found = false;
if($tx_list){
foreach($tx_list as $item){
if($item->destination == $out_address OR $item->id == $out_address){
$found = $item;
break;
}
}
}
if(!$found){
$this->error('Distribution TX not found');
return false;
}
$new_count = count($tx_list) - 1;
if($new_count <= 0){
$this->error('Distribution must have at least one address to send to');
return false;
}
$quantity = $found->quantity;
//delete tx
$delete = $found->delete();
if(!$delete){
$this->error('Error deleting distribution tx #'.$found->id);
return false;
}
//update totals;
$distro->asset_total = intval($distro->asset_total) - intval($quantity);
$distro->fee_total = Fuel::estimateFuelCost($new_count, $distro);
$save = $distro->save();
if(!$save){
$this->error('Error updating distribution #'.$distro->id.' totals');
return false;
}
$this->info('Deleted tx #'.$found->id.' from distro #'.$distro->id);
return true;
}
}
| mit |
gjeck/design-patterns | command/ruby/stock_command.rb | 1444 | class Stock
attr_reader :name, :market
def initialize(name, market)
@name = name
@market = market
end
def key
"#{market}:#{name}"
end
end
class Portfolio
attr_reader :store
def initialize(store={})
@store = store
end
def buy(stock, count)
@store[stock.key] = @store.fetch(stock.key, 0) + count
end
def sell(stock, count)
@store[stock.key] = @store.fetch(stock.key, 0) - count
end
end
class SellStock
attr_reader :stock, :count
def initialize(stock, count, portfolio)
@stock = stock
@count = count
@portfolio = portfolio
end
def execute
@portfolio.sell(@stock, @count)
end
def unexecute
@portfolio.buy(@stock, @count)
end
end
class BuyStock
attr_reader :stock, :count
def initialize(stock, count, portfolio)
@stock = stock
@count = count
@portfolio = portfolio
end
def execute
@portfolio.buy(@stock, @count)
end
def unexecute
@portfolio.sell(@stock, @count)
end
end
class Broker
attr_reader :orders
def initialize(orders=[])
@orders = orders
end
def take_order(*order)
order.each {|o| @orders << o}
end
def place_orders()
@orders.each {|o| o.execute}
end
def undo_orders()
@orders.reverse.each {|o| o.unexecute}
end
end
| mit |
VMatrixTeam/open-matrix | src/judgesystem/uniTest/testSandbox/main.cpp | 91 | #include <iostream>
int main() {
int a;
std::cin >> a;
std::cout << a;
return 0;
}
| mit |
fabiojaniolima/PGR | modulos/ssh/vendor/phpseclib/File/ASN1.php | 57159 | <?php
/**
* Pure-PHP ASN.1 Parser
*
* PHP versions 4 and 5
*
* ASN.1 provides the semantics for data encoded using various schemes. The most commonly
* utilized scheme is DER or the "Distinguished Encoding Rules". PEM's are base64 encoded
* DER blobs.
*
* File_ASN1 decodes and encodes DER formatted messages and places them in a semantic context.
*
* Uses the 1988 ASN.1 syntax.
*
* LICENSE: Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* @category File
* @package File_ASN1
* @author Jim Wigginton <[email protected]>
* @copyright 2012 Jim Wigginton
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @link http://phpseclib.sourceforge.net
*/
/**#@+
* Tag Classes
*
* @access private
* @link http://www.itu.int/ITU-T/studygroups/com17/languages/X.690-0207.pdf#page=12
*/
define('FILE_ASN1_CLASS_UNIVERSAL', 0);
define('FILE_ASN1_CLASS_APPLICATION', 1);
define('FILE_ASN1_CLASS_CONTEXT_SPECIFIC', 2);
define('FILE_ASN1_CLASS_PRIVATE', 3);
/**#@-*/
/**#@+
* Tag Classes
*
* @access private
* @link http://www.obj-sys.com/asn1tutorial/node124.html
*/
define('FILE_ASN1_TYPE_BOOLEAN', 1);
define('FILE_ASN1_TYPE_INTEGER', 2);
define('FILE_ASN1_TYPE_BIT_STRING', 3);
define('FILE_ASN1_TYPE_OCTET_STRING', 4);
define('FILE_ASN1_TYPE_NULL', 5);
define('FILE_ASN1_TYPE_OBJECT_IDENTIFIER', 6);
//define('FILE_ASN1_TYPE_OBJECT_DESCRIPTOR', 7);
//define('FILE_ASN1_TYPE_INSTANCE_OF', 8); // EXTERNAL
define('FILE_ASN1_TYPE_REAL', 9);
define('FILE_ASN1_TYPE_ENUMERATED', 10);
//define('FILE_ASN1_TYPE_EMBEDDED', 11);
define('FILE_ASN1_TYPE_UTF8_STRING', 12);
//define('FILE_ASN1_TYPE_RELATIVE_OID', 13);
define('FILE_ASN1_TYPE_SEQUENCE', 16); // SEQUENCE OF
define('FILE_ASN1_TYPE_SET', 17); // SET OF
/**#@-*/
/**#@+
* More Tag Classes
*
* @access private
* @link http://www.obj-sys.com/asn1tutorial/node10.html
*/
define('FILE_ASN1_TYPE_NUMERIC_STRING', 18);
define('FILE_ASN1_TYPE_PRINTABLE_STRING', 19);
define('FILE_ASN1_TYPE_TELETEX_STRING', 20); // T61String
define('FILE_ASN1_TYPE_VIDEOTEX_STRING', 21);
define('FILE_ASN1_TYPE_IA5_STRING', 22);
define('FILE_ASN1_TYPE_UTC_TIME', 23);
define('FILE_ASN1_TYPE_GENERALIZED_TIME', 24);
define('FILE_ASN1_TYPE_GRAPHIC_STRING', 25);
define('FILE_ASN1_TYPE_VISIBLE_STRING', 26); // ISO646String
define('FILE_ASN1_TYPE_GENERAL_STRING', 27);
define('FILE_ASN1_TYPE_UNIVERSAL_STRING', 28);
//define('FILE_ASN1_TYPE_CHARACTER_STRING', 29);
define('FILE_ASN1_TYPE_BMP_STRING', 30);
/**#@-*/
/**#@+
* Tag Aliases
*
* These tags are kinda place holders for other tags.
*
* @access private
*/
define('FILE_ASN1_TYPE_CHOICE', -1);
define('FILE_ASN1_TYPE_ANY', -2);
/**#@-*/
/**
* ASN.1 Element
*
* Bypass normal encoding rules in File_ASN1::encodeDER()
*
* @package File_ASN1
* @author Jim Wigginton <[email protected]>
* @access public
*/
class File_ASN1_Element
{
/**
* Raw element value
*
* @var string
* @access private
*/
var $element;
/**
* Constructor
*
* @param string $encoded
* @return File_ASN1_Element
* @access public
*/
function File_ASN1_Element($encoded)
{
$this->element = $encoded;
}
}
/**
* Pure-PHP ASN.1 Parser
*
* @package File_ASN1
* @author Jim Wigginton <[email protected]>
* @access public
*/
class File_ASN1
{
/**
* ASN.1 object identifier
*
* @var array
* @access private
* @link http://en.wikipedia.org/wiki/Object_identifier
*/
var $oids = array();
/**
* Default date format
*
* @var string
* @access private
* @link http://php.net/class.datetime
*/
var $format = 'D, d M Y H:i:s O';
/**
* Default date format
*
* @var array
* @access private
* @see self::setTimeFormat()
* @see self::asn1map()
* @link http://php.net/class.datetime
*/
var $encoded;
/**
* Filters
*
* If the mapping type is FILE_ASN1_TYPE_ANY what do we actually encode it as?
*
* @var array
* @access private
* @see self::_encode_der()
*/
var $filters;
/**
* Type mapping table for the ANY type.
*
* Structured or unknown types are mapped to a FILE_ASN1_Element.
* Unambiguous types get the direct mapping (int/real/bool).
* Others are mapped as a choice, with an extra indexing level.
*
* @var array
* @access public
*/
var $ANYmap = array(
FILE_ASN1_TYPE_BOOLEAN => true,
FILE_ASN1_TYPE_INTEGER => true,
FILE_ASN1_TYPE_BIT_STRING => 'bitString',
FILE_ASN1_TYPE_OCTET_STRING => 'octetString',
FILE_ASN1_TYPE_NULL => 'null',
FILE_ASN1_TYPE_OBJECT_IDENTIFIER => 'objectIdentifier',
FILE_ASN1_TYPE_REAL => true,
FILE_ASN1_TYPE_ENUMERATED => 'enumerated',
FILE_ASN1_TYPE_UTF8_STRING => 'utf8String',
FILE_ASN1_TYPE_NUMERIC_STRING => 'numericString',
FILE_ASN1_TYPE_PRINTABLE_STRING => 'printableString',
FILE_ASN1_TYPE_TELETEX_STRING => 'teletexString',
FILE_ASN1_TYPE_VIDEOTEX_STRING => 'videotexString',
FILE_ASN1_TYPE_IA5_STRING => 'ia5String',
FILE_ASN1_TYPE_UTC_TIME => 'utcTime',
FILE_ASN1_TYPE_GENERALIZED_TIME => 'generalTime',
FILE_ASN1_TYPE_GRAPHIC_STRING => 'graphicString',
FILE_ASN1_TYPE_VISIBLE_STRING => 'visibleString',
FILE_ASN1_TYPE_GENERAL_STRING => 'generalString',
FILE_ASN1_TYPE_UNIVERSAL_STRING => 'universalString',
//FILE_ASN1_TYPE_CHARACTER_STRING => 'characterString',
FILE_ASN1_TYPE_BMP_STRING => 'bmpString'
);
/**
* String type to character size mapping table.
*
* Non-convertable types are absent from this table.
* size == 0 indicates variable length encoding.
*
* @var array
* @access public
*/
var $stringTypeSize = array(
FILE_ASN1_TYPE_UTF8_STRING => 0,
FILE_ASN1_TYPE_BMP_STRING => 2,
FILE_ASN1_TYPE_UNIVERSAL_STRING => 4,
FILE_ASN1_TYPE_PRINTABLE_STRING => 1,
FILE_ASN1_TYPE_TELETEX_STRING => 1,
FILE_ASN1_TYPE_IA5_STRING => 1,
FILE_ASN1_TYPE_VISIBLE_STRING => 1,
);
/**
* Default Constructor.
*
* @access public
*/
function File_ASN1()
{
static $static_init = null;
if (!$static_init) {
$static_init = true;
if (!class_exists('Math_BigInteger')) {
include_once 'Math/BigInteger.php';
}
}
}
/**
* Parse BER-encoding
*
* Serves a similar purpose to openssl's asn1parse
*
* @param string $encoded
* @return array
* @access public
*/
function decodeBER($encoded)
{
if (is_object($encoded) && strtolower(get_class($encoded)) == 'file_asn1_element') {
$encoded = $encoded->element;
}
$this->encoded = $encoded;
// encapsulate in an array for BC with the old decodeBER
return array($this->_decode_ber($encoded));
}
/**
* Parse BER-encoding (Helper function)
*
* Sometimes we want to get the BER encoding of a particular tag. $start lets us do that without having to reencode.
* $encoded is passed by reference for the recursive calls done for FILE_ASN1_TYPE_BIT_STRING and
* FILE_ASN1_TYPE_OCTET_STRING. In those cases, the indefinite length is used.
*
* @param string $encoded
* @param int $start
* @param int $encoded_pos
* @return array
* @access private
*/
function _decode_ber($encoded, $start = 0, $encoded_pos = 0)
{
$current = array('start' => $start);
$type = ord($encoded[$encoded_pos++]);
$start++;
$constructed = ($type >> 5) & 1;
$tag = $type & 0x1F;
if ($tag == 0x1F) {
$tag = 0;
// process septets (since the eighth bit is ignored, it's not an octet)
do {
$loop = ord($encoded[0]) >> 7;
$tag <<= 7;
$tag |= ord($encoded[$encoded_pos++]) & 0x7F;
$start++;
} while ($loop);
}
// Length, as discussed in paragraph 8.1.3 of X.690-0207.pdf#page=13
$length = ord($encoded[$encoded_pos++]);
$start++;
if ($length == 0x80) { // indefinite length
// "[A sender shall] use the indefinite form (see 8.1.3.6) if the encoding is constructed and is not all
// immediately available." -- paragraph 8.1.3.2.c
$length = strlen($encoded) - $encoded_pos;
} elseif ($length & 0x80) { // definite length, long form
// technically, the long form of the length can be represented by up to 126 octets (bytes), but we'll only
// support it up to four.
$length&= 0x7F;
$temp = substr($encoded, $encoded_pos, $length);
$encoded_pos += $length;
// tags of indefinte length don't really have a header length; this length includes the tag
$current+= array('headerlength' => $length + 2);
$start+= $length;
extract(unpack('Nlength', substr(str_pad($temp, 4, chr(0), STR_PAD_LEFT), -4)));
} else {
$current+= array('headerlength' => 2);
}
if ($length > (strlen($encoded) - $encoded_pos)) {
return false;
}
$content = substr($encoded, $encoded_pos, $length);
$content_pos = 0;
// at this point $length can be overwritten. it's only accurate for definite length things as is
/* Class is UNIVERSAL, APPLICATION, PRIVATE, or CONTEXT-SPECIFIC. The UNIVERSAL class is restricted to the ASN.1
built-in types. It defines an application-independent data type that must be distinguishable from all other
data types. The other three classes are user defined. The APPLICATION class distinguishes data types that
have a wide, scattered use within a particular presentation context. PRIVATE distinguishes data types within
a particular organization or country. CONTEXT-SPECIFIC distinguishes members of a sequence or set, the
alternatives of a CHOICE, or universally tagged set members. Only the class number appears in braces for this
data type; the term CONTEXT-SPECIFIC does not appear.
-- http://www.obj-sys.com/asn1tutorial/node12.html */
$class = ($type >> 6) & 3;
switch ($class) {
case FILE_ASN1_CLASS_APPLICATION:
case FILE_ASN1_CLASS_PRIVATE:
case FILE_ASN1_CLASS_CONTEXT_SPECIFIC:
if (!$constructed) {
return array(
'type' => $class,
'constant' => $tag,
'content' => $content,
'length' => $length + $start - $current['start']
);
}
$newcontent = array();
$remainingLength = $length;
while ($remainingLength > 0) {
$temp = $this->_decode_ber($content, $start);
$length = $temp['length'];
// end-of-content octets - see paragraph 8.1.5
if (substr($content, $content_pos + $length, 2) == "\0\0") {
$length+= 2;
$start+= $length;
$newcontent[] = $temp;
break;
}
$start+= $length;
$remainingLength-= $length;
$newcontent[] = $temp;
$content_pos += $length;
}
return array(
'type' => $class,
'constant' => $tag,
// the array encapsulation is for BC with the old format
'content' => $newcontent,
// the only time when $content['headerlength'] isn't defined is when the length is indefinite.
// the absence of $content['headerlength'] is how we know if something is indefinite or not.
// technically, it could be defined to be 2 and then another indicator could be used but whatever.
'length' => $start - $current['start']
) + $current;
}
$current+= array('type' => $tag);
// decode UNIVERSAL tags
switch ($tag) {
case FILE_ASN1_TYPE_BOOLEAN:
// "The contents octets shall consist of a single octet." -- paragraph 8.2.1
//if (strlen($content) != 1) {
// return false;
//}
$current['content'] = (bool) ord($content[$content_pos]);
break;
case FILE_ASN1_TYPE_INTEGER:
case FILE_ASN1_TYPE_ENUMERATED:
$current['content'] = new Math_BigInteger(substr($content, $content_pos), -256);
break;
case FILE_ASN1_TYPE_REAL: // not currently supported
return false;
case FILE_ASN1_TYPE_BIT_STRING:
// The initial octet shall encode, as an unsigned binary integer with bit 1 as the least significant bit,
// the number of unused bits in the final subsequent octet. The number shall be in the range zero to
// seven.
if (!$constructed) {
$current['content'] = substr($content, $content_pos);
} else {
$temp = $this->_decode_ber($content, $start, $content_pos);
$length-= (strlen($content) - $content_pos);
$last = count($temp) - 1;
for ($i = 0; $i < $last; $i++) {
// all subtags should be bit strings
//if ($temp[$i]['type'] != FILE_ASN1_TYPE_BIT_STRING) {
// return false;
//}
$current['content'].= substr($temp[$i]['content'], 1);
}
// all subtags should be bit strings
//if ($temp[$last]['type'] != FILE_ASN1_TYPE_BIT_STRING) {
// return false;
//}
$current['content'] = $temp[$last]['content'][0] . $current['content'] . substr($temp[$i]['content'], 1);
}
break;
case FILE_ASN1_TYPE_OCTET_STRING:
if (!$constructed) {
$current['content'] = substr($content, $content_pos);
} else {
$current['content'] = '';
$length = 0;
while (substr($content, $content_pos, 2) != "\0\0") {
$temp = $this->_decode_ber($content, $length + $start, $content_pos);
$content_pos += $temp['length'];
// all subtags should be octet strings
//if ($temp['type'] != FILE_ASN1_TYPE_OCTET_STRING) {
// return false;
//}
$current['content'].= $temp['content'];
$length+= $temp['length'];
}
if (substr($content, $content_pos, 2) == "\0\0") {
$length+= 2; // +2 for the EOC
}
}
break;
case FILE_ASN1_TYPE_NULL:
// "The contents octets shall not contain any octets." -- paragraph 8.8.2
//if (strlen($content)) {
// return false;
//}
break;
case FILE_ASN1_TYPE_SEQUENCE:
case FILE_ASN1_TYPE_SET:
$offset = 0;
$current['content'] = array();
$content_len = strlen($content);
while ($content_pos < $content_len) {
// if indefinite length construction was used and we have an end-of-content string next
// see paragraphs 8.1.1.3, 8.1.3.2, 8.1.3.6, 8.1.5, and (for an example) 8.6.4.2
if (!isset($current['headerlength']) && substr($content, $content_pos, 2) == "\0\0") {
$length = $offset + 2; // +2 for the EOC
break 2;
}
$temp = $this->_decode_ber($content, $start + $offset, $content_pos);
$content_pos += $temp['length'];
$current['content'][] = $temp;
$offset+= $temp['length'];
}
break;
case FILE_ASN1_TYPE_OBJECT_IDENTIFIER:
$temp = ord($content[$content_pos++]);
$current['content'] = sprintf('%d.%d', floor($temp / 40), $temp % 40);
$valuen = 0;
// process septets
$content_len = strlen($content);
while ($content_pos < $content_len) {
$temp = ord($content[$content_pos++]);
$valuen <<= 7;
$valuen |= $temp & 0x7F;
if (~$temp & 0x80) {
$current['content'].= ".$valuen";
$valuen = 0;
}
}
// the eighth bit of the last byte should not be 1
//if ($temp >> 7) {
// return false;
//}
break;
/* Each character string type shall be encoded as if it had been declared:
[UNIVERSAL x] IMPLICIT OCTET STRING
-- X.690-0207.pdf#page=23 (paragraph 8.21.3)
Per that, we're not going to do any validation. If there are any illegal characters in the string,
we don't really care */
case FILE_ASN1_TYPE_NUMERIC_STRING:
// 0,1,2,3,4,5,6,7,8,9, and space
case FILE_ASN1_TYPE_PRINTABLE_STRING:
// Upper and lower case letters, digits, space, apostrophe, left/right parenthesis, plus sign, comma,
// hyphen, full stop, solidus, colon, equal sign, question mark
case FILE_ASN1_TYPE_TELETEX_STRING:
// The Teletex character set in CCITT's T61, space, and delete
// see http://en.wikipedia.org/wiki/Teletex#Character_sets
case FILE_ASN1_TYPE_VIDEOTEX_STRING:
// The Videotex character set in CCITT's T.100 and T.101, space, and delete
case FILE_ASN1_TYPE_VISIBLE_STRING:
// Printing character sets of international ASCII, and space
case FILE_ASN1_TYPE_IA5_STRING:
// International Alphabet 5 (International ASCII)
case FILE_ASN1_TYPE_GRAPHIC_STRING:
// All registered G sets, and space
case FILE_ASN1_TYPE_GENERAL_STRING:
// All registered C and G sets, space and delete
case FILE_ASN1_TYPE_UTF8_STRING:
// ????
case FILE_ASN1_TYPE_BMP_STRING:
$current['content'] = substr($content, $content_pos);
break;
case FILE_ASN1_TYPE_UTC_TIME:
case FILE_ASN1_TYPE_GENERALIZED_TIME:
$current['content'] = $this->_decodeTime(substr($content, $content_pos), $tag);
default:
}
$start+= $length;
// ie. length is the length of the full TLV encoding - it's not just the length of the value
return $current + array('length' => $start - $current['start']);
}
/**
* ASN.1 Map
*
* Provides an ASN.1 semantic mapping ($mapping) from a parsed BER-encoding to a human readable format.
*
* "Special" mappings may be applied on a per tag-name basis via $special.
*
* @param array $decoded
* @param array $mapping
* @param array $special
* @return array
* @access public
*/
function asn1map($decoded, $mapping, $special = array())
{
if (isset($mapping['explicit']) && is_array($decoded['content'])) {
$decoded = $decoded['content'][0];
}
switch (true) {
case $mapping['type'] == FILE_ASN1_TYPE_ANY:
$intype = $decoded['type'];
if (isset($decoded['constant']) || !isset($this->ANYmap[$intype]) || (ord($this->encoded[$decoded['start']]) & 0x20)) {
return new File_ASN1_Element(substr($this->encoded, $decoded['start'], $decoded['length']));
}
$inmap = $this->ANYmap[$intype];
if (is_string($inmap)) {
return array($inmap => $this->asn1map($decoded, array('type' => $intype) + $mapping, $special));
}
break;
case $mapping['type'] == FILE_ASN1_TYPE_CHOICE:
foreach ($mapping['children'] as $key => $option) {
switch (true) {
case isset($option['constant']) && $option['constant'] == $decoded['constant']:
case !isset($option['constant']) && $option['type'] == $decoded['type']:
$value = $this->asn1map($decoded, $option, $special);
break;
case !isset($option['constant']) && $option['type'] == FILE_ASN1_TYPE_CHOICE:
$v = $this->asn1map($decoded, $option, $special);
if (isset($v)) {
$value = $v;
}
}
if (isset($value)) {
if (isset($special[$key])) {
$value = call_user_func($special[$key], $value);
}
return array($key => $value);
}
}
return null;
case isset($mapping['implicit']):
case isset($mapping['explicit']):
case $decoded['type'] == $mapping['type']:
break;
default:
// if $decoded['type'] and $mapping['type'] are both strings, but different types of strings,
// let it through
switch (true) {
case $decoded['type'] < 18: // FILE_ASN1_TYPE_NUMERIC_STRING == 18
case $decoded['type'] > 30: // FILE_ASN1_TYPE_BMP_STRING == 30
case $mapping['type'] < 18:
case $mapping['type'] > 30:
return null;
}
}
if (isset($mapping['implicit'])) {
$decoded['type'] = $mapping['type'];
}
switch ($decoded['type']) {
case FILE_ASN1_TYPE_SEQUENCE:
$map = array();
// ignore the min and max
if (isset($mapping['min']) && isset($mapping['max'])) {
$child = $mapping['children'];
foreach ($decoded['content'] as $content) {
if (($map[] = $this->asn1map($content, $child, $special)) === null) {
return null;
}
}
return $map;
}
$n = count($decoded['content']);
$i = 0;
foreach ($mapping['children'] as $key => $child) {
$maymatch = $i < $n; // Match only existing input.
if ($maymatch) {
$temp = $decoded['content'][$i];
if ($child['type'] != FILE_ASN1_TYPE_CHOICE) {
// Get the mapping and input class & constant.
$childClass = $tempClass = FILE_ASN1_CLASS_UNIVERSAL;
$constant = null;
if (isset($temp['constant'])) {
$tempClass = isset($temp['class']) ? $temp['class'] : FILE_ASN1_CLASS_CONTEXT_SPECIFIC;
}
if (isset($child['class'])) {
$childClass = $child['class'];
$constant = $child['cast'];
} elseif (isset($child['constant'])) {
$childClass = FILE_ASN1_CLASS_CONTEXT_SPECIFIC;
$constant = $child['constant'];
}
if (isset($constant) && isset($temp['constant'])) {
// Can only match if constants and class match.
$maymatch = $constant == $temp['constant'] && $childClass == $tempClass;
} else {
// Can only match if no constant expected and type matches or is generic.
$maymatch = !isset($child['constant']) && array_search($child['type'], array($temp['type'], FILE_ASN1_TYPE_ANY, FILE_ASN1_TYPE_CHOICE)) !== false;
}
}
}
if ($maymatch) {
// Attempt submapping.
$candidate = $this->asn1map($temp, $child, $special);
$maymatch = $candidate !== null;
}
if ($maymatch) {
// Got the match: use it.
if (isset($special[$key])) {
$candidate = call_user_func($special[$key], $candidate);
}
$map[$key] = $candidate;
$i++;
} elseif (isset($child['default'])) {
$map[$key] = $child['default']; // Use default.
} elseif (!isset($child['optional'])) {
return null; // Syntax error.
}
}
// Fail mapping if all input items have not been consumed.
return $i < $n ? null: $map;
// the main diff between sets and sequences is the encapsulation of the foreach in another for loop
case FILE_ASN1_TYPE_SET:
$map = array();
// ignore the min and max
if (isset($mapping['min']) && isset($mapping['max'])) {
$child = $mapping['children'];
foreach ($decoded['content'] as $content) {
if (($map[] = $this->asn1map($content, $child, $special)) === null) {
return null;
}
}
return $map;
}
for ($i = 0; $i < count($decoded['content']); $i++) {
$temp = $decoded['content'][$i];
$tempClass = FILE_ASN1_CLASS_UNIVERSAL;
if (isset($temp['constant'])) {
$tempClass = isset($temp['class']) ? $temp['class'] : FILE_ASN1_CLASS_CONTEXT_SPECIFIC;
}
foreach ($mapping['children'] as $key => $child) {
if (isset($map[$key])) {
continue;
}
$maymatch = true;
if ($child['type'] != FILE_ASN1_TYPE_CHOICE) {
$childClass = FILE_ASN1_CLASS_UNIVERSAL;
$constant = null;
if (isset($child['class'])) {
$childClass = $child['class'];
$constant = $child['cast'];
} elseif (isset($child['constant'])) {
$childClass = FILE_ASN1_CLASS_CONTEXT_SPECIFIC;
$constant = $child['constant'];
}
if (isset($constant) && isset($temp['constant'])) {
// Can only match if constants and class match.
$maymatch = $constant == $temp['constant'] && $childClass == $tempClass;
} else {
// Can only match if no constant expected and type matches or is generic.
$maymatch = !isset($child['constant']) && array_search($child['type'], array($temp['type'], FILE_ASN1_TYPE_ANY, FILE_ASN1_TYPE_CHOICE)) !== false;
}
}
if ($maymatch) {
// Attempt submapping.
$candidate = $this->asn1map($temp, $child, $special);
$maymatch = $candidate !== null;
}
if (!$maymatch) {
break;
}
// Got the match: use it.
if (isset($special[$key])) {
$candidate = call_user_func($special[$key], $candidate);
}
$map[$key] = $candidate;
break;
}
}
foreach ($mapping['children'] as $key => $child) {
if (!isset($map[$key])) {
if (isset($child['default'])) {
$map[$key] = $child['default'];
} elseif (!isset($child['optional'])) {
return null;
}
}
}
return $map;
case FILE_ASN1_TYPE_OBJECT_IDENTIFIER:
return isset($this->oids[$decoded['content']]) ? $this->oids[$decoded['content']] : $decoded['content'];
case FILE_ASN1_TYPE_UTC_TIME:
case FILE_ASN1_TYPE_GENERALIZED_TIME:
if (isset($mapping['implicit'])) {
$decoded['content'] = $this->_decodeTime($decoded['content'], $decoded['type']);
}
return @date($this->format, $decoded['content']);
case FILE_ASN1_TYPE_BIT_STRING:
if (isset($mapping['mapping'])) {
$offset = ord($decoded['content'][0]);
$size = (strlen($decoded['content']) - 1) * 8 - $offset;
/*
From X.680-0207.pdf#page=46 (21.7):
"When a "NamedBitList" is used in defining a bitstring type ASN.1 encoding rules are free to add (or remove)
arbitrarily any trailing 0 bits to (or from) values that are being encoded or decoded. Application designers should
therefore ensure that different semantics are not associated with such values which differ only in the number of trailing
0 bits."
*/
$bits = count($mapping['mapping']) == $size ? array() : array_fill(0, count($mapping['mapping']) - $size, false);
for ($i = strlen($decoded['content']) - 1; $i > 0; $i--) {
$current = ord($decoded['content'][$i]);
for ($j = $offset; $j < 8; $j++) {
$bits[] = (bool) ($current & (1 << $j));
}
$offset = 0;
}
$values = array();
$map = array_reverse($mapping['mapping']);
foreach ($map as $i => $value) {
if ($bits[$i]) {
$values[] = $value;
}
}
return $values;
}
case FILE_ASN1_TYPE_OCTET_STRING:
return base64_encode($decoded['content']);
case FILE_ASN1_TYPE_NULL:
return '';
case FILE_ASN1_TYPE_BOOLEAN:
return $decoded['content'];
case FILE_ASN1_TYPE_NUMERIC_STRING:
case FILE_ASN1_TYPE_PRINTABLE_STRING:
case FILE_ASN1_TYPE_TELETEX_STRING:
case FILE_ASN1_TYPE_VIDEOTEX_STRING:
case FILE_ASN1_TYPE_IA5_STRING:
case FILE_ASN1_TYPE_GRAPHIC_STRING:
case FILE_ASN1_TYPE_VISIBLE_STRING:
case FILE_ASN1_TYPE_GENERAL_STRING:
case FILE_ASN1_TYPE_UNIVERSAL_STRING:
case FILE_ASN1_TYPE_UTF8_STRING:
case FILE_ASN1_TYPE_BMP_STRING:
return $decoded['content'];
case FILE_ASN1_TYPE_INTEGER:
case FILE_ASN1_TYPE_ENUMERATED:
$temp = $decoded['content'];
if (isset($mapping['implicit'])) {
$temp = new Math_BigInteger($decoded['content'], -256);
}
if (isset($mapping['mapping'])) {
$temp = (int) $temp->toString();
return isset($mapping['mapping'][$temp]) ?
$mapping['mapping'][$temp] :
false;
}
return $temp;
}
}
/**
* ASN.1 Encode
*
* DER-encodes an ASN.1 semantic mapping ($mapping). Some libraries would probably call this function
* an ASN.1 compiler.
*
* "Special" mappings can be applied via $special.
*
* @param string $source
* @param string $mapping
* @param int $idx
* @return string
* @access public
*/
function encodeDER($source, $mapping, $special = array())
{
$this->location = array();
return $this->_encode_der($source, $mapping, null, $special);
}
/**
* ASN.1 Encode (Helper function)
*
* @param string $source
* @param string $mapping
* @param int $idx
* @return string
* @access private
*/
function _encode_der($source, $mapping, $idx = null, $special = array())
{
if (is_object($source) && strtolower(get_class($source)) == 'file_asn1_element') {
return $source->element;
}
// do not encode (implicitly optional) fields with value set to default
if (isset($mapping['default']) && $source === $mapping['default']) {
return '';
}
if (isset($idx)) {
if (isset($special[$idx])) {
$source = call_user_func($special[$idx], $source);
}
$this->location[] = $idx;
}
$tag = $mapping['type'];
switch ($tag) {
case FILE_ASN1_TYPE_SET: // Children order is not important, thus process in sequence.
case FILE_ASN1_TYPE_SEQUENCE:
$tag|= 0x20; // set the constructed bit
// ignore the min and max
if (isset($mapping['min']) && isset($mapping['max'])) {
$value = array();
$child = $mapping['children'];
foreach ($source as $content) {
$temp = $this->_encode_der($content, $child, null, $special);
if ($temp === false) {
return false;
}
$value[]= $temp;
}
/* "The encodings of the component values of a set-of value shall appear in ascending order, the encodings being compared
as octet strings with the shorter components being padded at their trailing end with 0-octets.
NOTE - The padding octets are for comparison purposes only and do not appear in the encodings."
-- sec 11.6 of http://www.itu.int/ITU-T/studygroups/com17/languages/X.690-0207.pdf */
if ($mapping['type'] == FILE_ASN1_TYPE_SET) {
sort($value);
}
$value = implode($value, '');
break;
}
$value = '';
foreach ($mapping['children'] as $key => $child) {
if (!array_key_exists($key, $source)) {
if (!isset($child['optional'])) {
return false;
}
continue;
}
$temp = $this->_encode_der($source[$key], $child, $key, $special);
if ($temp === false) {
return false;
}
// An empty child encoding means it has been optimized out.
// Else we should have at least one tag byte.
if ($temp === '') {
continue;
}
// if isset($child['constant']) is true then isset($child['optional']) should be true as well
if (isset($child['constant'])) {
/*
From X.680-0207.pdf#page=58 (30.6):
"The tagging construction specifies explicit tagging if any of the following holds:
...
c) the "Tag Type" alternative is used and the value of "TagDefault" for the module is IMPLICIT TAGS or
AUTOMATIC TAGS, but the type defined by "Type" is an untagged choice type, an untagged open type, or
an untagged "DummyReference" (see ITU-T Rec. X.683 | ISO/IEC 8824-4, 8.3)."
*/
if (isset($child['explicit']) || $child['type'] == FILE_ASN1_TYPE_CHOICE) {
$subtag = chr((FILE_ASN1_CLASS_CONTEXT_SPECIFIC << 6) | 0x20 | $child['constant']);
$temp = $subtag . $this->_encodeLength(strlen($temp)) . $temp;
} else {
$subtag = chr((FILE_ASN1_CLASS_CONTEXT_SPECIFIC << 6) | (ord($temp[0]) & 0x20) | $child['constant']);
$temp = $subtag . substr($temp, 1);
}
}
$value.= $temp;
}
break;
case FILE_ASN1_TYPE_CHOICE:
$temp = false;
foreach ($mapping['children'] as $key => $child) {
if (!isset($source[$key])) {
continue;
}
$temp = $this->_encode_der($source[$key], $child, $key, $special);
if ($temp === false) {
return false;
}
// An empty child encoding means it has been optimized out.
// Else we should have at least one tag byte.
if ($temp === '') {
continue;
}
$tag = ord($temp[0]);
// if isset($child['constant']) is true then isset($child['optional']) should be true as well
if (isset($child['constant'])) {
if (isset($child['explicit']) || $child['type'] == FILE_ASN1_TYPE_CHOICE) {
$subtag = chr((FILE_ASN1_CLASS_CONTEXT_SPECIFIC << 6) | 0x20 | $child['constant']);
$temp = $subtag . $this->_encodeLength(strlen($temp)) . $temp;
} else {
$subtag = chr((FILE_ASN1_CLASS_CONTEXT_SPECIFIC << 6) | (ord($temp[0]) & 0x20) | $child['constant']);
$temp = $subtag . substr($temp, 1);
}
}
}
if (isset($idx)) {
array_pop($this->location);
}
if ($temp && isset($mapping['cast'])) {
$temp[0] = chr(($mapping['class'] << 6) | ($tag & 0x20) | $mapping['cast']);
}
return $temp;
case FILE_ASN1_TYPE_INTEGER:
case FILE_ASN1_TYPE_ENUMERATED:
if (!isset($mapping['mapping'])) {
if (is_numeric($source)) {
$source = new Math_BigInteger($source);
}
$value = $source->toBytes(true);
} else {
$value = array_search($source, $mapping['mapping']);
if ($value === false) {
return false;
}
$value = new Math_BigInteger($value);
$value = $value->toBytes(true);
}
if (!strlen($value)) {
$value = chr(0);
}
break;
case FILE_ASN1_TYPE_UTC_TIME:
case FILE_ASN1_TYPE_GENERALIZED_TIME:
$format = $mapping['type'] == FILE_ASN1_TYPE_UTC_TIME ? 'y' : 'Y';
$format.= 'mdHis';
$value = @gmdate($format, strtotime($source)) . 'Z';
break;
case FILE_ASN1_TYPE_BIT_STRING:
if (isset($mapping['mapping'])) {
$bits = array_fill(0, count($mapping['mapping']), 0);
$size = 0;
for ($i = 0; $i < count($mapping['mapping']); $i++) {
if (in_array($mapping['mapping'][$i], $source)) {
$bits[$i] = 1;
$size = $i;
}
}
if (isset($mapping['min']) && $mapping['min'] >= 1 && $size < $mapping['min']) {
$size = $mapping['min'] - 1;
}
$offset = 8 - (($size + 1) & 7);
$offset = $offset !== 8 ? $offset : 0;
$value = chr($offset);
for ($i = $size + 1; $i < count($mapping['mapping']); $i++) {
unset($bits[$i]);
}
$bits = implode('', array_pad($bits, $size + $offset + 1, 0));
$bytes = explode(' ', rtrim(chunk_split($bits, 8, ' ')));
foreach ($bytes as $byte) {
$value.= chr(bindec($byte));
}
break;
}
case FILE_ASN1_TYPE_OCTET_STRING:
/* The initial octet shall encode, as an unsigned binary integer with bit 1 as the least significant bit,
the number of unused bits in the final subsequent octet. The number shall be in the range zero to seven.
-- http://www.itu.int/ITU-T/studygroups/com17/languages/X.690-0207.pdf#page=16 */
$value = base64_decode($source);
break;
case FILE_ASN1_TYPE_OBJECT_IDENTIFIER:
$oid = preg_match('#(?:\d+\.)+#', $source) ? $source : array_search($source, $this->oids);
if ($oid === false) {
user_error('Invalid OID');
return false;
}
$value = '';
$parts = explode('.', $oid);
$value = chr(40 * $parts[0] + $parts[1]);
for ($i = 2; $i < count($parts); $i++) {
$temp = '';
if (!$parts[$i]) {
$temp = "\0";
} else {
while ($parts[$i]) {
$temp = chr(0x80 | ($parts[$i] & 0x7F)) . $temp;
$parts[$i] >>= 7;
}
$temp[strlen($temp) - 1] = $temp[strlen($temp) - 1] & chr(0x7F);
}
$value.= $temp;
}
break;
case FILE_ASN1_TYPE_ANY:
$loc = $this->location;
if (isset($idx)) {
array_pop($this->location);
}
switch (true) {
case !isset($source):
return $this->_encode_der(null, array('type' => FILE_ASN1_TYPE_NULL) + $mapping, null, $special);
case is_int($source):
case is_object($source) && strtolower(get_class($source)) == 'math_biginteger':
return $this->_encode_der($source, array('type' => FILE_ASN1_TYPE_INTEGER) + $mapping, null, $special);
case is_float($source):
return $this->_encode_der($source, array('type' => FILE_ASN1_TYPE_REAL) + $mapping, null, $special);
case is_bool($source):
return $this->_encode_der($source, array('type' => FILE_ASN1_TYPE_BOOLEAN) + $mapping, null, $special);
case is_array($source) && count($source) == 1:
$typename = implode('', array_keys($source));
$outtype = array_search($typename, $this->ANYmap, true);
if ($outtype !== false) {
return $this->_encode_der($source[$typename], array('type' => $outtype) + $mapping, null, $special);
}
}
$filters = $this->filters;
foreach ($loc as $part) {
if (!isset($filters[$part])) {
$filters = false;
break;
}
$filters = $filters[$part];
}
if ($filters === false) {
user_error('No filters defined for ' . implode('/', $loc));
return false;
}
return $this->_encode_der($source, $filters + $mapping, null, $special);
case FILE_ASN1_TYPE_NULL:
$value = '';
break;
case FILE_ASN1_TYPE_NUMERIC_STRING:
case FILE_ASN1_TYPE_TELETEX_STRING:
case FILE_ASN1_TYPE_PRINTABLE_STRING:
case FILE_ASN1_TYPE_UNIVERSAL_STRING:
case FILE_ASN1_TYPE_UTF8_STRING:
case FILE_ASN1_TYPE_BMP_STRING:
case FILE_ASN1_TYPE_IA5_STRING:
case FILE_ASN1_TYPE_VISIBLE_STRING:
case FILE_ASN1_TYPE_VIDEOTEX_STRING:
case FILE_ASN1_TYPE_GRAPHIC_STRING:
case FILE_ASN1_TYPE_GENERAL_STRING:
$value = $source;
break;
case FILE_ASN1_TYPE_BOOLEAN:
$value = $source ? "\xFF" : "\x00";
break;
default:
user_error('Mapping provides no type definition for ' . implode('/', $this->location));
return false;
}
if (isset($idx)) {
array_pop($this->location);
}
if (isset($mapping['cast'])) {
if (isset($mapping['explicit']) || $mapping['type'] == FILE_ASN1_TYPE_CHOICE) {
$value = chr($tag) . $this->_encodeLength(strlen($value)) . $value;
$tag = ($mapping['class'] << 6) | 0x20 | $mapping['cast'];
} else {
$tag = ($mapping['class'] << 6) | (ord($temp[0]) & 0x20) | $mapping['cast'];
}
}
return chr($tag) . $this->_encodeLength(strlen($value)) . $value;
}
/**
* DER-encode the length
*
* DER supports lengths up to (2**8)**127, however, we'll only support lengths up to (2**8)**4. See
* {@link http://itu.int/ITU-T/studygroups/com17/languages/X.690-0207.pdf#p=13 X.690 paragraph 8.1.3} for more information.
*
* @access private
* @param int $length
* @return string
*/
function _encodeLength($length)
{
if ($length <= 0x7F) {
return chr($length);
}
$temp = ltrim(pack('N', $length), chr(0));
return pack('Ca*', 0x80 | strlen($temp), $temp);
}
/**
* BER-decode the time
*
* Called by _decode_ber() and in the case of implicit tags asn1map().
*
* @access private
* @param string $content
* @param int $tag
* @return string
*/
function _decodeTime($content, $tag)
{
/* UTCTime:
http://tools.ietf.org/html/rfc5280#section-4.1.2.5.1
http://www.obj-sys.com/asn1tutorial/node15.html
GeneralizedTime:
http://tools.ietf.org/html/rfc5280#section-4.1.2.5.2
http://www.obj-sys.com/asn1tutorial/node14.html */
$pattern = $tag == FILE_ASN1_TYPE_UTC_TIME ?
'#(..)(..)(..)(..)(..)(..)(.*)#' :
'#(....)(..)(..)(..)(..)(..).*([Z+-].*)$#';
preg_match($pattern, $content, $matches);
list(, $year, $month, $day, $hour, $minute, $second, $timezone) = $matches;
if ($tag == FILE_ASN1_TYPE_UTC_TIME) {
$year = $year >= 50 ? "19$year" : "20$year";
}
if ($timezone == 'Z') {
$mktime = 'gmmktime';
$timezone = 0;
} elseif (preg_match('#([+-])(\d\d)(\d\d)#', $timezone, $matches)) {
$mktime = 'gmmktime';
$timezone = 60 * $matches[3] + 3600 * $matches[2];
if ($matches[1] == '-') {
$timezone = -$timezone;
}
} else {
$mktime = 'mktime';
$timezone = 0;
}
return @$mktime($hour, $minute, $second, $month, $day, $year) + $timezone;
}
/**
* Set the time format
*
* Sets the time / date format for asn1map().
*
* @access public
* @param string $format
*/
function setTimeFormat($format)
{
$this->format = $format;
}
/**
* Load OIDs
*
* Load the relevant OIDs for a particular ASN.1 semantic mapping.
*
* @access public
* @param array $oids
*/
function loadOIDs($oids)
{
$this->oids = $oids;
}
/**
* Load filters
*
* See File_X509, etc, for an example.
*
* @access public
* @param array $filters
*/
function loadFilters($filters)
{
$this->filters = $filters;
}
/**
* String Shift
*
* Inspired by array_shift
*
* @param string $string
* @param int $index
* @return string
* @access private
*/
function _string_shift(&$string, $index = 1)
{
$substr = substr($string, 0, $index);
$string = substr($string, $index);
return $substr;
}
/**
* String type conversion
*
* This is a lazy conversion, dealing only with character size.
* No real conversion table is used.
*
* @param string $in
* @param int $from
* @param int $to
* @return string
* @access public
*/
function convert($in, $from = FILE_ASN1_TYPE_UTF8_STRING, $to = FILE_ASN1_TYPE_UTF8_STRING)
{
if (!isset($this->stringTypeSize[$from]) || !isset($this->stringTypeSize[$to])) {
return false;
}
$insize = $this->stringTypeSize[$from];
$outsize = $this->stringTypeSize[$to];
$inlength = strlen($in);
$out = '';
for ($i = 0; $i < $inlength;) {
if ($inlength - $i < $insize) {
return false;
}
// Get an input character as a 32-bit value.
$c = ord($in[$i++]);
switch (true) {
case $insize == 4:
$c = ($c << 8) | ord($in[$i++]);
$c = ($c << 8) | ord($in[$i++]);
case $insize == 2:
$c = ($c << 8) | ord($in[$i++]);
case $insize == 1:
break;
case ($c & 0x80) == 0x00:
break;
case ($c & 0x40) == 0x00:
return false;
default:
$bit = 6;
do {
if ($bit > 25 || $i >= $inlength || (ord($in[$i]) & 0xC0) != 0x80) {
return false;
}
$c = ($c << 6) | (ord($in[$i++]) & 0x3F);
$bit += 5;
$mask = 1 << $bit;
} while ($c & $bit);
$c &= $mask - 1;
break;
}
// Convert and append the character to output string.
$v = '';
switch (true) {
case $outsize == 4:
$v .= chr($c & 0xFF);
$c >>= 8;
$v .= chr($c & 0xFF);
$c >>= 8;
case $outsize == 2:
$v .= chr($c & 0xFF);
$c >>= 8;
case $outsize == 1:
$v .= chr($c & 0xFF);
$c >>= 8;
if ($c) {
return false;
}
break;
case ($c & 0x80000000) != 0:
return false;
case $c >= 0x04000000:
$v .= chr(0x80 | ($c & 0x3F));
$c = ($c >> 6) | 0x04000000;
case $c >= 0x00200000:
$v .= chr(0x80 | ($c & 0x3F));
$c = ($c >> 6) | 0x00200000;
case $c >= 0x00010000:
$v .= chr(0x80 | ($c & 0x3F));
$c = ($c >> 6) | 0x00010000;
case $c >= 0x00000800:
$v .= chr(0x80 | ($c & 0x3F));
$c = ($c >> 6) | 0x00000800;
case $c >= 0x00000080:
$v .= chr(0x80 | ($c & 0x3F));
$c = ($c >> 6) | 0x000000C0;
default:
$v .= chr($c);
break;
}
$out .= strrev($v);
}
return $out;
}
}
| mit |
RobertFoll/RevMob-Xamarin-iOS | obj/Debug/ios/SupportDelegates.g.cs | 1961 | //
// Auto-generated from generator.cs, do not edit
//
// We keep references to objects, so warning 414 is expected
#pragma warning disable 414
using System;
using System.Drawing;
using System.Diagnostics;
using System.ComponentModel;
using System.Threading.Tasks;
using System.Runtime.InteropServices;
using System.Runtime.CompilerServices;
using UIKit;
using GLKit;
using Metal;
using MapKit;
using ModelIO;
using Security;
using SceneKit;
using CoreVideo;
using CoreMedia;
using QuickLook;
using Foundation;
using CoreMotion;
using ObjCRuntime;
using AddressBook;
using CoreGraphics;
using CoreLocation;
using AVFoundation;
using NewsstandKit;
using CoreAnimation;
using CoreFoundation;
namespace RevMob.iOS {
public delegate void RevMobAdLinkFailureHandler (RevMob.iOS.RevMobAdLink arg0, NSError arg1);
public delegate void RevMobAdLinkSuccessfullHandler (RevMob.iOS.RevMobAdLink arg0);
public delegate void RevMobBannerViewFailureHandler (RevMob.iOS.RevMobBannerView arg0, NSError arg1);
public delegate void RevMobBannerViewOnclickHandler (RevMob.iOS.RevMobBannerView arg0);
public delegate void RevMobBannerViewSuccessfullHandler (RevMob.iOS.RevMobBannerView arg0);
public delegate void RevMobBannerFailureHandler (RevMob.iOS.RevMobBanner arg0, NSError arg1);
public delegate void RevMobBannerOnClickHandler (RevMob.iOS.RevMobBanner arg0);
public delegate void RevMobBannerSuccessfullHandler (RevMob.iOS.RevMobBanner arg0);
public delegate void RevMobButtonFailureHandler (RevMob.iOS.RevMobButton arg0, NSError arg1);
public delegate void RevMobButtonOnclickHandler (RevMob.iOS.RevMobButton arg0);
public delegate void RevMobButtonSuccessfullHandler (RevMob.iOS.RevMobButton arg0);
public delegate void RevMobPopupFailureHandler (RevMob.iOS.RevMobPopup arg0, NSError arg1);
public delegate void RevMobPopupOnClickHandler (RevMob.iOS.RevMobPopup arg0);
public delegate void RevMobPopupSuccessfullHandler (RevMob.iOS.RevMobPopup arg0);
}
| mit |
Wolframcheg/symfotest | src/AppBundle/Controller/Admin/ModuleUserController.php | 3258 | <?php
namespace AppBundle\Controller\Admin;
use AppBundle\Entity\ModuleUser;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\HttpFoundation\Request;
use AppBundle\Form\ModuleUserType;
/**
* Class ModuleUserController
* @package AppBundle\Controller\Admin
*/
class ModuleUserController extends Controller
{
/**
* @Route("/admin/moduleUser/new/{idUser}", name="create_moduleUser")
* @Template("@App/admin/moduleuser/createModuleUser.html.twig")
*/
public function createModuleUserAction(Request $request, $idUser)
{
$em = $this->getDoctrine()->getManager();
$user = $em->getRepository('AppBundle:User')
->find($idUser);
$modulesUser = $em->getRepository('AppBundle:ModuleUser')
->findBy(['user' => $user]);
$moduleUser = new ModuleUser();
$form = $this->createForm(ModuleUserType::class, $moduleUser, ['user' => $user]);
$form->handleRequest($request);
if ($form->isValid()) {
$user->setIsActive(true);
$moduleUser->setUser($user);
$user->removeChosenModule($moduleUser->getModule()->getId());
$em->persist($moduleUser);
$em->flush();
return $this->redirectToRoute('user_show');
}
$form_delete = [];
foreach ($modulesUser as $item) {
$form_delete[$item->getModule()->getId()] = $this->createFormDelete($idUser, $item->getModule()->getId())->createView();
}
return [
'modulesUser' => $modulesUser,
'form_remove' => $form_delete,
'form' => $form->createView()
];
}
/**
* @Route("/admin/moduleUser/remove/{idUser}/{idModule}", name="remove_moduleUser")
* @Method("DELETE")
*/
public function removeModuleAction($idUser, $idModule)
{
$em = $this->getDoctrine()->getManager();
$user = $em->getRepository('AppBundle:User')
->find($idUser);
$module = $em->getRepository('AppBundle:Module')
->find($idModule);
$moduleUser = $em->getRepository('AppBundle:ModuleUser')
->findOneBy(['user' => $user, 'module' => $module]);
$em->remove($moduleUser);
$em->flush();
return $this->redirectToRoute('create_moduleUser', ['idUser' => $idUser]);
}
/**
* @return \Symfony\Component\Form\Form
*/
private function createFormDelete($idUser, $idModule)
{
return $this->createFormBuilder()
->setAction($this->generateUrl('remove_moduleUser', ['idUser' => $idUser, 'idModule' => $idModule]))
->setMethod('DELETE')
->add('submit', SubmitType::class, [
'label' => ' ',
'attr' => [
'class' => 'glyphicon glyphicon-remove btn-link',
'onclick' => 'return confirm("Are you sure?")'
]
])
->getForm();
}
}
| mit |
jacksonps4/jutils | src/main/java/com/minorityhobbies/util/ExceptionUtilities.java | 1605 | /*
Copyright (c) 2013 Chris Wraith
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package com.minorityhobbies.util;
import java.io.ByteArrayOutputStream;
import java.io.PrintWriter;
public class ExceptionUtilities {
private ExceptionUtilities() {}
/**
* Gets the stack trace from the specified exception as a String.
* @param t The exception
* @return The stack trace as a string
*/
public static String getStackTraceAsString(Throwable t) {
ByteArrayOutputStream bos = new ByteArrayOutputStream();
PrintWriter pw = new PrintWriter(bos);
t.printStackTrace(pw);
pw.flush();
return bos.toString();
}
}
| mit |
nodoid/ChiSquared | ChiSquared/Properties/Settings.Designer.cs | 1095 | //------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.488
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace ChiSquared.Properties
{
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
{
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default
{
get
{
return defaultInstance;
}
}
}
}
| mit |
carefree0910/MachineLearning | Zhihu/NN/_extra/two/Test.py | 630 | from Zhihu.NN._extra.two.Networks import *
from Util.Util import DataUtil
np.random.seed(142857) # for reproducibility
def main():
nn = NNDist()
epoch = 1000
timing = Timing(enabled=True)
timing_level = 1
nn.feed_timing(timing)
x, y = DataUtil.gen_spiral(100)
nn.add(ReLU((x.shape[1], 24)))
nn.add(ReLU((24,)))
nn.add(Softmax((y.shape[1],)))
nn.fit(x, y, epoch=epoch, verbose=2, metrics=["acc", "f1_score"], train_rate=0.8)
nn.draw_logs()
nn.visualize_2d(x, y)
timing.show_timing_log(timing_level)
if __name__ == '__main__':
main()
| mit |
saulmadi/Encomiendas | src/Encomiendas.Domain.Specs/Properties/AssemblyInfo.cs | 1424 | using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Encomiendas.Domain.Specs")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Encomiendas.Domain.Specs")]
[assembly: AssemblyCopyright("Copyright © 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("37132585-de93-4494-8953-1c1cbe143d01")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
| mit |
AcklenAvenue/surgicor_spike | src/SurgicorSpike.Web/Api/Infrastructure/RestExceptions/RestExceptionRepackager.cs | 869 | using System;
using System.Linq;
using Nancy.Bootstrapper;
namespace SurgicorSpike.Web.Api.Infrastructure.RestExceptions
{
public static class RestExceptionRepackager
{
public static RestExceptionRepackagingRegistrar Configure(Action<RestExceptionConfiguration> config)
{
var configurer = new RestExceptionConfiguration();
var repackagers =
AppDomainAssemblyTypeScanner.TypesOf<IExceptionRepackager>(ScanMode.ExcludeNancy);
repackagers.ToList().ForEach(
x => configurer.WithRepackager((IExceptionRepackager) Activator.CreateInstance(x)));
configurer.WithDefault(new InternalServerExceptionRepackager());
config(configurer);
return new RestExceptionRepackagingRegistrar(configurer);
}
}
} | mit |
ScullinSteel/apple2js | js/roms/apple2plus.js | 75692 | function Apple2ROM()
{
var rom = [
0x6f,0xd8,0x65,0xd7,0xf8,0xdc,0x94,0xd9,
0xb1,0xdb,0x30,0xf3,0xd8,0xdf,0xe1,0xdb,
0x8f,0xf3,0x98,0xf3,0xe4,0xf1,0xdd,0xf1,
0xd4,0xf1,0x24,0xf2,0x31,0xf2,0x40,0xf2,
0xd7,0xf3,0xe1,0xf3,0xe8,0xf6,0xfd,0xf6,
0x68,0xf7,0x6e,0xf7,0xe6,0xf7,0x57,0xfc,
0x20,0xf7,0x26,0xf7,0x74,0xf7,0x6c,0xf2,
0x6e,0xf2,0x72,0xf2,0x76,0xf2,0x7f,0xf2,
0x4e,0xf2,0x6a,0xd9,0x55,0xf2,0x85,0xf2,
0xa5,0xf2,0xca,0xf2,0x17,0xf3,0xbb,0xf3,
0x9e,0xf3,0x61,0xf2,0x45,0xda,0x3d,0xd9,
0x11,0xd9,0xc8,0xd9,0x48,0xd8,0xf4,0x03,
0x20,0xd9,0x6a,0xd9,0xdb,0xd9,0x6d,0xd8,
0xeb,0xd9,0x83,0xe7,0xc8,0xd8,0xaf,0xd8,
0x12,0xe3,0x7a,0xe7,0xd4,0xda,0x95,0xd8,
0xa4,0xd6,0x69,0xd6,0x9f,0xdb,0x48,0xd6,
0x90,0xeb,0x23,0xec,0xaf,0xeb,0x0a,0x00,
0xde,0xe2,0x12,0xd4,0xcd,0xdf,0xff,0xe2,
0x8d,0xee,0xae,0xef,0x41,0xe9,0x09,0xef,
0xea,0xef,0xf1,0xef,0x3a,0xf0,0x9e,0xf0,
0x64,0xe7,0xd6,0xe6,0xc5,0xe3,0x07,0xe7,
0xe5,0xe6,0x46,0xe6,0x5a,0xe6,0x86,0xe6,
0x91,0xe6,0x79,0xc0,0xe7,0x79,0xa9,0xe7,
0x7b,0x81,0xe9,0x7b,0x68,0xea,0x7d,0x96,
0xee,0x50,0x54,0xdf,0x46,0x4e,0xdf,0x7f,
0xcf,0xee,0x7f,0x97,0xde,0x64,0x64,0xdf,
0x45,0x4e,0xc4,0x46,0x4f,0xd2,0x4e,0x45,
0x58,0xd4,0x44,0x41,0x54,0xc1,0x49,0x4e,
0x50,0x55,0xd4,0x44,0x45,0xcc,0x44,0x49,
0xcd,0x52,0x45,0x41,0xc4,0x47,0xd2,0x54,
0x45,0x58,0xd4,0x50,0x52,0xa3,0x49,0x4e,
0xa3,0x43,0x41,0x4c,0xcc,0x50,0x4c,0x4f,
0xd4,0x48,0x4c,0x49,0xce,0x56,0x4c,0x49,
0xce,0x48,0x47,0x52,0xb2,0x48,0x47,0xd2,
0x48,0x43,0x4f,0x4c,0x4f,0x52,0xbd,0x48,
0x50,0x4c,0x4f,0xd4,0x44,0x52,0x41,0xd7,
0x58,0x44,0x52,0x41,0xd7,0x48,0x54,0x41,
0xc2,0x48,0x4f,0x4d,0xc5,0x52,0x4f,0x54,
0xbd,0x53,0x43,0x41,0x4c,0x45,0xbd,0x53,
0x48,0x4c,0x4f,0x41,0xc4,0x54,0x52,0x41,
0x43,0xc5,0x4e,0x4f,0x54,0x52,0x41,0x43,
0xc5,0x4e,0x4f,0x52,0x4d,0x41,0xcc,0x49,
0x4e,0x56,0x45,0x52,0x53,0xc5,0x46,0x4c,
0x41,0x53,0xc8,0x43,0x4f,0x4c,0x4f,0x52,
0xbd,0x50,0x4f,0xd0,0x56,0x54,0x41,0xc2,
0x48,0x49,0x4d,0x45,0x4d,0xba,0x4c,0x4f,
0x4d,0x45,0x4d,0xba,0x4f,0x4e,0x45,0x52,
0xd2,0x52,0x45,0x53,0x55,0x4d,0xc5,0x52,
0x45,0x43,0x41,0x4c,0xcc,0x53,0x54,0x4f,
0x52,0xc5,0x53,0x50,0x45,0x45,0x44,0xbd,
0x4c,0x45,0xd4,0x47,0x4f,0x54,0xcf,0x52,
0x55,0xce,0x49,0xc6,0x52,0x45,0x53,0x54,
0x4f,0x52,0xc5,0xa6,0x47,0x4f,0x53,0x55,
0xc2,0x52,0x45,0x54,0x55,0x52,0xce,0x52,
0x45,0xcd,0x53,0x54,0x4f,0xd0,0x4f,0xce,
0x57,0x41,0x49,0xd4,0x4c,0x4f,0x41,0xc4,
0x53,0x41,0x56,0xc5,0x44,0x45,0xc6,0x50,
0x4f,0x4b,0xc5,0x50,0x52,0x49,0x4e,0xd4,
0x43,0x4f,0x4e,0xd4,0x4c,0x49,0x53,0xd4,
0x43,0x4c,0x45,0x41,0xd2,0x47,0x45,0xd4,
0x4e,0x45,0xd7,0x54,0x41,0x42,0xa8,0x54,
0xcf,0x46,0xce,0x53,0x50,0x43,0xa8,0x54,
0x48,0x45,0xce,0x41,0xd4,0x4e,0x4f,0xd4,
0x53,0x54,0x45,0xd0,0xab,0xad,0xaa,0xaf,
0xde,0x41,0x4e,0xc4,0x4f,0xd2,0xbe,0xbd,
0xbc,0x53,0x47,0xce,0x49,0x4e,0xd4,0x41,
0x42,0xd3,0x55,0x53,0xd2,0x46,0x52,0xc5,
0x53,0x43,0x52,0x4e,0xa8,0x50,0x44,0xcc,
0x50,0x4f,0xd3,0x53,0x51,0xd2,0x52,0x4e,
0xc4,0x4c,0x4f,0xc7,0x45,0x58,0xd0,0x43,
0x4f,0xd3,0x53,0x49,0xce,0x54,0x41,0xce,
0x41,0x54,0xce,0x50,0x45,0x45,0xcb,0x4c,
0x45,0xce,0x53,0x54,0x52,0xa4,0x56,0x41,
0xcc,0x41,0x53,0xc3,0x43,0x48,0x52,0xa4,
0x4c,0x45,0x46,0x54,0xa4,0x52,0x49,0x47,
0x48,0x54,0xa4,0x4d,0x49,0x44,0xa4,0x00,
0x4e,0x45,0x58,0x54,0x20,0x57,0x49,0x54,
0x48,0x4f,0x55,0x54,0x20,0x46,0x4f,0xd2,
0x53,0x59,0x4e,0x54,0x41,0xd8,0x52,0x45,
0x54,0x55,0x52,0x4e,0x20,0x57,0x49,0x54,
0x48,0x4f,0x55,0x54,0x20,0x47,0x4f,0x53,
0x55,0xc2,0x4f,0x55,0x54,0x20,0x4f,0x46,
0x20,0x44,0x41,0x54,0xc1,0x49,0x4c,0x4c,
0x45,0x47,0x41,0x4c,0x20,0x51,0x55,0x41,
0x4e,0x54,0x49,0x54,0xd9,0x4f,0x56,0x45,
0x52,0x46,0x4c,0x4f,0xd7,0x4f,0x55,0x54,
0x20,0x4f,0x46,0x20,0x4d,0x45,0x4d,0x4f,
0x52,0xd9,0x55,0x4e,0x44,0x45,0x46,0x27,
0x44,0x20,0x53,0x54,0x41,0x54,0x45,0x4d,
0x45,0x4e,0xd4,0x42,0x41,0x44,0x20,0x53,
0x55,0x42,0x53,0x43,0x52,0x49,0x50,0xd4,
0x52,0x45,0x44,0x49,0x4d,0x27,0x44,0x20,
0x41,0x52,0x52,0x41,0xd9,0x44,0x49,0x56,
0x49,0x53,0x49,0x4f,0x4e,0x20,0x42,0x59,
0x20,0x5a,0x45,0x52,0xcf,0x49,0x4c,0x4c,
0x45,0x47,0x41,0x4c,0x20,0x44,0x49,0x52,
0x45,0x43,0xd4,0x54,0x59,0x50,0x45,0x20,
0x4d,0x49,0x53,0x4d,0x41,0x54,0x43,0xc8,
0x53,0x54,0x52,0x49,0x4e,0x47,0x20,0x54,
0x4f,0x4f,0x20,0x4c,0x4f,0x4e,0xc7,0x46,
0x4f,0x52,0x4d,0x55,0x4c,0x41,0x20,0x54,
0x4f,0x4f,0x20,0x43,0x4f,0x4d,0x50,0x4c,
0x45,0xd8,0x43,0x41,0x4e,0x27,0x54,0x20,
0x43,0x4f,0x4e,0x54,0x49,0x4e,0x55,0xc5,
0x55,0x4e,0x44,0x45,0x46,0x27,0x44,0x20,
0x46,0x55,0x4e,0x43,0x54,0x49,0x4f,0xce,
0x20,0x45,0x52,0x52,0x4f,0x52,0x07,0x00,
0x20,0x49,0x4e,0x20,0x00,0x0d,0x42,0x52,
0x45,0x41,0x4b,0x07,0x00,0xba,0xe8,0xe8,
0xe8,0xe8,0xbd,0x01,0x01,0xc9,0x81,0xd0,
0x21,0xa5,0x86,0xd0,0x0a,0xbd,0x02,0x01,
0x85,0x85,0xbd,0x03,0x01,0x85,0x86,0xdd,
0x03,0x01,0xd0,0x07,0xa5,0x85,0xdd,0x02,
0x01,0xf0,0x07,0x8a,0x18,0x69,0x12,0xaa,
0xd0,0xd8,0x60,0x20,0xe3,0xd3,0x85,0x6d,
0x84,0x6e,0x38,0xa5,0x96,0xe5,0x9b,0x85,
0x5e,0xa8,0xa5,0x97,0xe5,0x9c,0xaa,0xe8,
0x98,0xf0,0x23,0xa5,0x96,0x38,0xe5,0x5e,
0x85,0x96,0xb0,0x03,0xc6,0x97,0x38,0xa5,
0x94,0xe5,0x5e,0x85,0x94,0xb0,0x08,0xc6,
0x95,0x90,0x04,0xb1,0x96,0x91,0x94,0x88,
0xd0,0xf9,0xb1,0x96,0x91,0x94,0xc6,0x97,
0xc6,0x95,0xca,0xd0,0xf2,0x60,0x0a,0x69,
0x36,0xb0,0x35,0x85,0x5e,0xba,0xe4,0x5e,
0x90,0x2e,0x60,0xc4,0x70,0x90,0x28,0xd0,
0x04,0xc5,0x6f,0x90,0x22,0x48,0xa2,0x09,
0x98,0x48,0xb5,0x93,0xca,0x10,0xfa,0x20,
0x84,0xe4,0xa2,0xf7,0x68,0x95,0x9d,0xe8,
0x30,0xfa,0x68,0xa8,0x68,0xc4,0x70,0x90,
0x06,0xd0,0x05,0xc5,0x6f,0xb0,0x01,0x60,
0xa2,0x4d,0x24,0xd8,0x10,0x03,0x4c,0xe9,
0xf2,0x20,0xfb,0xda,0x20,0x5a,0xdb,0xbd,
0x60,0xd2,0x48,0x20,0x5c,0xdb,0xe8,0x68,
0x10,0xf5,0x20,0x83,0xd6,0xa9,0x50,0xa0,
0xd3,0x20,0x3a,0xdb,0xa4,0x76,0xc8,0xf0,
0x03,0x20,0x19,0xed,0x20,0xfb,0xda,0xa2,
0xdd,0x20,0x2e,0xd5,0x86,0xb8,0x84,0xb9,
0x46,0xd8,0x20,0xb1,0x00,0xaa,0xf0,0xec,
0xa2,0xff,0x86,0x76,0x90,0x06,0x20,0x59,
0xd5,0x4c,0x05,0xd8,0xa6,0xaf,0x86,0x69,
0xa6,0xb0,0x86,0x6a,0x20,0x0c,0xda,0x20,
0x59,0xd5,0x84,0x0f,0x20,0x1a,0xd6,0x90,
0x44,0xa0,0x01,0xb1,0x9b,0x85,0x5f,0xa5,
0x69,0x85,0x5e,0xa5,0x9c,0x85,0x61,0xa5,
0x9b,0x88,0xf1,0x9b,0x18,0x65,0x69,0x85,
0x69,0x85,0x60,0xa5,0x6a,0x69,0xff,0x85,
0x6a,0xe5,0x9c,0xaa,0x38,0xa5,0x9b,0xe5,
0x69,0xa8,0xb0,0x03,0xe8,0xc6,0x61,0x18,
0x65,0x5e,0x90,0x03,0xc6,0x5f,0x18,0xb1,
0x5e,0x91,0x60,0xc8,0xd0,0xf9,0xe6,0x5f,
0xe6,0x61,0xca,0xd0,0xf2,0xad,0x00,0x02,
0xf0,0x38,0xa5,0x73,0xa4,0x74,0x85,0x6f,
0x84,0x70,0xa5,0x69,0x85,0x96,0x65,0x0f,
0x85,0x94,0xa4,0x6a,0x84,0x97,0x90,0x01,
0xc8,0x84,0x95,0x20,0x93,0xd3,0xa5,0x50,
0xa4,0x51,0x8d,0xfe,0x01,0x8c,0xff,0x01,
0xa5,0x6d,0xa4,0x6e,0x85,0x69,0x84,0x6a,
0xa4,0x0f,0xb9,0xfb,0x01,0x88,0x91,0x9b,
0xd0,0xf8,0x20,0x65,0xd6,0xa5,0x67,0xa4,
0x68,0x85,0x5e,0x84,0x5f,0x18,0xa0,0x01,
0xb1,0x5e,0xd0,0x0b,0xa5,0x69,0x85,0xaf,
0xa5,0x6a,0x85,0xb0,0x4c,0x3c,0xd4,0xa0,
0x04,0xc8,0xb1,0x5e,0xd0,0xfb,0xc8,0x98,
0x65,0x5e,0xaa,0xa0,0x00,0x91,0x5e,0xa5,
0x5f,0x69,0x00,0xc8,0x91,0x5e,0x86,0x5e,
0x85,0x5f,0x90,0xd2,0xa2,0x80,0x86,0x33,
0x20,0x6a,0xfd,0xe0,0xef,0x90,0x02,0xa2,
0xef,0xa9,0x00,0x9d,0x00,0x02,0x8a,0xf0,
0x0b,0xbd,0xff,0x01,0x29,0x7f,0x9d,0xff,
0x01,0xca,0xd0,0xf5,0xa9,0x00,0xa2,0xff,
0xa0,0x01,0x60,0x20,0x0c,0xfd,0x29,0x7f,
0x60,0xa6,0xb8,0xca,0xa0,0x04,0x84,0x13,
0x24,0xd6,0x10,0x08,0x68,0x68,0x20,0x65,
0xd6,0x4c,0xd2,0xd7,0xe8,0xbd,0x00,0x02,
0x24,0x13,0x70,0x04,0xc9,0x20,0xf0,0xf4,
0x85,0x0e,0xc9,0x22,0xf0,0x74,0x70,0x4d,
0xc9,0x3f,0xd0,0x04,0xa9,0xba,0xd0,0x45,
0xc9,0x30,0x90,0x04,0xc9,0x3c,0x90,0x3d,
0x84,0xad,0xa9,0xd0,0x85,0x9d,0xa9,0xcf,
0x85,0x9e,0xa0,0x00,0x84,0x0f,0x88,0x86,
0xb8,0xca,0xc8,0xd0,0x02,0xe6,0x9e,0xe8,
0xbd,0x00,0x02,0xc9,0x20,0xf0,0xf8,0x38,
0xf1,0x9d,0xf0,0xee,0xc9,0x80,0xd0,0x41,
0x05,0x0f,0xc9,0xc5,0xd0,0x0d,0xbd,0x01,
0x02,0xc9,0x4e,0xf0,0x34,0xc9,0x4f,0xf0,
0x30,0xa9,0xc5,0xa4,0xad,0xe8,0xc8,0x99,
0xfb,0x01,0xb9,0xfb,0x01,0xf0,0x39,0x38,
0xe9,0x3a,0xf0,0x04,0xc9,0x49,0xd0,0x02,
0x85,0x13,0x38,0xe9,0x78,0xd0,0x86,0x85,
0x0e,0xbd,0x00,0x02,0xf0,0xdf,0xc5,0x0e,
0xf0,0xdb,0xc8,0x99,0xfb,0x01,0xe8,0xd0,
0xf0,0xa6,0xb8,0xe6,0x0f,0xb1,0x9d,0xc8,
0xd0,0x02,0xe6,0x9e,0x0a,0x90,0xf6,0xb1,
0x9d,0xd0,0x9d,0xbd,0x00,0x02,0x10,0xbb,
0x99,0xfd,0x01,0xc6,0xb9,0xa9,0xff,0x85,
0xb8,0x60,0xa5,0x67,0xa6,0x68,0xa0,0x01,
0x85,0x9b,0x86,0x9c,0xb1,0x9b,0xf0,0x1f,
0xc8,0xc8,0xa5,0x51,0xd1,0x9b,0x90,0x18,
0xf0,0x03,0x88,0xd0,0x09,0xa5,0x50,0x88,
0xd1,0x9b,0x90,0x0c,0xf0,0x0a,0x88,0xb1,
0x9b,0xaa,0x88,0xb1,0x9b,0xb0,0xd7,0x18,
0x60,0xd0,0xfd,0xa9,0x00,0x85,0xd6,0xa8,
0x91,0x67,0xc8,0x91,0x67,0xa5,0x67,0x69,
0x02,0x85,0x69,0x85,0xaf,0xa5,0x68,0x69,
0x00,0x85,0x6a,0x85,0xb0,0x20,0x97,0xd6,
0xa9,0x00,0xd0,0x2a,0xa5,0x73,0xa4,0x74,
0x85,0x6f,0x84,0x70,0xa5,0x69,0xa4,0x6a,
0x85,0x6b,0x84,0x6c,0x85,0x6d,0x84,0x6e,
0x20,0x49,0xd8,0xa2,0x55,0x86,0x52,0x68,
0xa8,0x68,0xa2,0xf8,0x9a,0x48,0x98,0x48,
0xa9,0x00,0x85,0x7a,0x85,0x14,0x60,0x18,
0xa5,0x67,0x69,0xff,0x85,0xb8,0xa5,0x68,
0x69,0xff,0x85,0xb9,0x60,0x90,0x0a,0xf0,
0x08,0xc9,0xc9,0xf0,0x04,0xc9,0x2c,0xd0,
0xe5,0x20,0x0c,0xda,0x20,0x1a,0xd6,0x20,
0xb7,0x00,0xf0,0x10,0xc9,0xc9,0xf0,0x04,
0xc9,0x2c,0xd0,0x84,0x20,0xb1,0x00,0x20,
0x0c,0xda,0xd0,0xca,0x68,0x68,0xa5,0x50,
0x05,0x51,0xd0,0x06,0xa9,0xff,0x85,0x50,
0x85,0x51,0xa0,0x01,0xb1,0x9b,0xf0,0x44,
0x20,0x58,0xd8,0x20,0xfb,0xda,0xc8,0xb1,
0x9b,0xaa,0xc8,0xb1,0x9b,0xc5,0x51,0xd0,
0x04,0xe4,0x50,0xf0,0x02,0xb0,0x2d,0x84,
0x85,0x20,0x24,0xed,0xa9,0x20,0xa4,0x85,
0x29,0x7f,0x20,0x5c,0xdb,0xa5,0x24,0xc9,
0x21,0x90,0x07,0x20,0xfb,0xda,0xa9,0x05,
0x85,0x24,0xc8,0xb1,0x9b,0xd0,0x1d,0xa8,
0xb1,0x9b,0xaa,0xc8,0xb1,0x9b,0x86,0x9b,
0x85,0x9c,0xd0,0xb6,0xa9,0x0d,0x20,0x5c,
0xdb,0x4c,0xd2,0xd7,0xc8,0xd0,0x02,0xe6,
0x9e,0xb1,0x9d,0x60,0x10,0xcc,0x38,0xe9,
0x7f,0xaa,0x84,0x85,0xa0,0xd0,0x84,0x9d,
0xa0,0xcf,0x84,0x9e,0xa0,0xff,0xca,0xf0,
0x07,0x20,0x2c,0xd7,0x10,0xfb,0x30,0xf6,
0xa9,0x20,0x20,0x5c,0xdb,0x20,0x2c,0xd7,
0x30,0x05,0x20,0x5c,0xdb,0xd0,0xf6,0x20,
0x5c,0xdb,0xa9,0x20,0xd0,0x98,0xa9,0x80,
0x85,0x14,0x20,0x46,0xda,0x20,0x65,0xd3,
0xd0,0x05,0x8a,0x69,0x0f,0xaa,0x9a,0x68,
0x68,0xa9,0x09,0x20,0xd6,0xd3,0x20,0xa3,
0xd9,0x18,0x98,0x65,0xb8,0x48,0xa5,0xb9,
0x69,0x00,0x48,0xa5,0x76,0x48,0xa5,0x75,
0x48,0xa9,0xc1,0x20,0xc0,0xde,0x20,0x6a,
0xdd,0x20,0x67,0xdd,0xa5,0xa2,0x09,0x7f,
0x25,0x9e,0x85,0x9e,0xa9,0xaf,0xa0,0xd7,
0x85,0x5e,0x84,0x5f,0x4c,0x20,0xde,0xa9,
0x13,0xa0,0xe9,0x20,0xf9,0xea,0x20,0xb7,
0x00,0xc9,0xc7,0xd0,0x06,0x20,0xb1,0x00,
0x20,0x67,0xdd,0x20,0x82,0xeb,0x20,0x15,
0xde,0xa5,0x86,0x48,0xa5,0x85,0x48,0xa9,
0x81,0x48,0xba,0x86,0xf8,0x20,0x58,0xd8,
0xa5,0xb8,0xa4,0xb9,0xa6,0x76,0xe8,0xf0,
0x04,0x85,0x79,0x84,0x7a,0xa0,0x00,0xb1,
0xb8,0xd0,0x57,0xa0,0x02,0xb1,0xb8,0x18,
0xf0,0x34,0xc8,0xb1,0xb8,0x85,0x75,0xc8,
0xb1,0xb8,0x85,0x76,0x98,0x65,0xb8,0x85,
0xb8,0x90,0x02,0xe6,0xb9,0x24,0xf2,0x10,
0x14,0xa6,0x76,0xe8,0xf0,0x0f,0xa9,0x23,
0x20,0x5c,0xdb,0xa6,0x75,0xa5,0x76,0x20,
0x24,0xed,0x20,0x57,0xdb,0x20,0xb1,0x00,
0x20,0x28,0xd8,0x4c,0xd2,0xd7,0xf0,0x62,
0xf0,0x2d,0xe9,0x80,0x90,0x11,0xc9,0x40,
0xb0,0x14,0x0a,0xa8,0xb9,0x01,0xd0,0x48,
0xb9,0x00,0xd0,0x48,0x4c,0xb1,0x00,0x4c,
0x46,0xda,0xc9,0x3a,0xf0,0xbf,0x4c,0xc9,
0xde,0x38,0xa5,0x67,0xe9,0x01,0xa4,0x68,
0xb0,0x01,0x88,0x85,0x7d,0x84,0x7e,0x60,
0xad,0x00,0xc0,0xc9,0x83,0xf0,0x01,0x60,
0x20,0x53,0xd5,0xa2,0xff,0x24,0xd8,0x10,
0x03,0x4c,0xe9,0xf2,0xc9,0x03,0xb0,0x01,
0x18,0xd0,0x3c,0xa5,0xb8,0xa4,0xb9,0xa6,
0x76,0xe8,0xf0,0x0c,0x85,0x79,0x84,0x7a,
0xa5,0x75,0xa4,0x76,0x85,0x77,0x84,0x78,
0x68,0x68,0xa9,0x5d,0xa0,0xd3,0x90,0x03,
0x4c,0x31,0xd4,0x4c,0x3c,0xd4,0xd0,0x17,
0xa2,0xd2,0xa4,0x7a,0xd0,0x03,0x4c,0x12,
0xd4,0xa5,0x79,0x85,0xb8,0x84,0xb9,0xa5,
0x77,0xa4,0x78,0x85,0x75,0x84,0x76,0x60,
0x38,0xa5,0xaf,0xe5,0x67,0x85,0x50,0xa5,
0xb0,0xe5,0x68,0x85,0x51,0x20,0xf0,0xd8,
0x20,0xcd,0xfe,0x20,0x01,0xd9,0x4c,0xcd,
0xfe,0x20,0xf0,0xd8,0x20,0xfd,0xfe,0x18,
0xa5,0x67,0x65,0x50,0x85,0x69,0xa5,0x68,
0x65,0x51,0x85,0x6a,0xa5,0x52,0x85,0xd6,
0x20,0x01,0xd9,0x20,0xfd,0xfe,0x24,0xd6,
0x10,0x03,0x4c,0x65,0xd6,0x4c,0xf2,0xd4,
0xa9,0x50,0xa0,0x00,0x85,0x3c,0x84,0x3d,
0xa9,0x52,0x85,0x3e,0x84,0x3f,0x84,0xd6,
0x60,0xa5,0x67,0xa4,0x68,0x85,0x3c,0x84,
0x3d,0xa5,0x69,0xa4,0x6a,0x85,0x3e,0x84,
0x3f,0x60,0x08,0xc6,0x76,0x28,0xd0,0x03,
0x4c,0x65,0xd6,0x20,0x6c,0xd6,0x4c,0x35,
0xd9,0xa9,0x03,0x20,0xd6,0xd3,0xa5,0xb9,
0x48,0xa5,0xb8,0x48,0xa5,0x76,0x48,0xa5,
0x75,0x48,0xa9,0xb0,0x48,0x20,0xb7,0x00,
0x20,0x3e,0xd9,0x4c,0xd2,0xd7,0x20,0x0c,
0xda,0x20,0xa6,0xd9,0xa5,0x76,0xc5,0x51,
0xb0,0x0b,0x98,0x38,0x65,0xb8,0xa6,0xb9,
0x90,0x07,0xe8,0xb0,0x04,0xa5,0x67,0xa6,
0x68,0x20,0x1e,0xd6,0x90,0x1e,0xa5,0x9b,
0xe9,0x01,0x85,0xb8,0xa5,0x9c,0xe9,0x00,
0x85,0xb9,0x60,0xd0,0xfd,0xa9,0xff,0x85,
0x85,0x20,0x65,0xd3,0x9a,0xc9,0xb0,0xf0,
0x0b,0xa2,0x16,0x2c,0xa2,0x5a,0x4c,0x12,
0xd4,0x4c,0xc9,0xde,0x68,0x68,0xc0,0x42,
0xf0,0x3b,0x85,0x75,0x68,0x85,0x76,0x68,
0x85,0xb8,0x68,0x85,0xb9,0x20,0xa3,0xd9,
0x98,0x18,0x65,0xb8,0x85,0xb8,0x90,0x02,
0xe6,0xb9,0x60,0xa2,0x3a,0x2c,0xa2,0x00,
0x86,0x0d,0xa0,0x00,0x84,0x0e,0xa5,0x0e,
0xa6,0x0d,0x85,0x0d,0x86,0x0e,0xb1,0xb8,
0xf0,0xe8,0xc5,0x0e,0xf0,0xe4,0xc8,0xc9,
0x22,0xd0,0xf3,0xf0,0xe9,0x68,0x68,0x68,
0x60,0x20,0x7b,0xdd,0x20,0xb7,0x00,0xc9,
0xab,0xf0,0x05,0xa9,0xc4,0x20,0xc0,0xde,
0xa5,0x9d,0xd0,0x05,0x20,0xa6,0xd9,0xf0,
0xb7,0x20,0xb7,0x00,0xb0,0x03,0x4c,0x3e,
0xd9,0x4c,0x28,0xd8,0x20,0xf8,0xe6,0x48,
0xc9,0xb0,0xf0,0x04,0xc9,0xab,0xd0,0x89,
0xc6,0xa1,0xd0,0x04,0x68,0x4c,0x2a,0xd8,
0x20,0xb1,0x00,0x20,0x0c,0xda,0xc9,0x2c,
0xf0,0xee,0x68,0x60,0xa2,0x00,0x86,0x50,
0x86,0x51,0xb0,0xf7,0xe9,0x2f,0x85,0x0d,
0xa5,0x51,0x85,0x5e,0xc9,0x19,0xb0,0xd4,
0xa5,0x50,0x0a,0x26,0x5e,0x0a,0x26,0x5e,
0x65,0x50,0x85,0x50,0xa5,0x5e,0x65,0x51,
0x85,0x51,0x06,0x50,0x26,0x51,0xa5,0x50,
0x65,0x0d,0x85,0x50,0x90,0x02,0xe6,0x51,
0x20,0xb1,0x00,0x4c,0x12,0xda,0x20,0xe3,
0xdf,0x85,0x85,0x84,0x86,0xa9,0xd0,0x20,
0xc0,0xde,0xa5,0x12,0x48,0xa5,0x11,0x48,
0x20,0x7b,0xdd,0x68,0x2a,0x20,0x6d,0xdd,
0xd0,0x18,0x68,0x10,0x12,0x20,0x72,0xeb,
0x20,0x0c,0xe1,0xa0,0x00,0xa5,0xa0,0x91,
0x85,0xc8,0xa5,0xa1,0x91,0x85,0x60,0x4c,
0x27,0xeb,0x68,0xa0,0x02,0xb1,0xa0,0xc5,
0x70,0x90,0x17,0xd0,0x07,0x88,0xb1,0xa0,
0xc5,0x6f,0x90,0x0e,0xa4,0xa1,0xc4,0x6a,
0x90,0x08,0xd0,0x0d,0xa5,0xa0,0xc5,0x69,
0xb0,0x07,0xa5,0xa0,0xa4,0xa1,0x4c,0xb7,
0xda,0xa0,0x00,0xb1,0xa0,0x20,0xd5,0xe3,
0xa5,0x8c,0xa4,0x8d,0x85,0xab,0x84,0xac,
0x20,0xd4,0xe5,0xa9,0x9d,0xa0,0x00,0x85,
0x8c,0x84,0x8d,0x20,0x35,0xe6,0xa0,0x00,
0xb1,0x8c,0x91,0x85,0xc8,0xb1,0x8c,0x91,
0x85,0xc8,0xb1,0x8c,0x91,0x85,0x60,0x20,
0x3d,0xdb,0x20,0xb7,0x00,0xf0,0x24,0xf0,
0x29,0xc9,0xc0,0xf0,0x39,0xc9,0xc3,0x18,
0xf0,0x34,0xc9,0x2c,0x18,0xf0,0x1c,0xc9,
0x3b,0xf0,0x44,0x20,0x7b,0xdd,0x24,0x11,
0x30,0xdd,0x20,0x34,0xed,0x20,0xe7,0xe3,
0x4c,0xcf,0xda,0xa9,0x0d,0x20,0x5c,0xdb,
0x49,0xff,0x60,0xa5,0x24,0xc9,0x18,0x90,
0x05,0x20,0xfb,0xda,0xd0,0x21,0x69,0x10,
0x29,0xf0,0x85,0x24,0x90,0x19,0x08,0x20,
0xf5,0xe6,0xc9,0x29,0xf0,0x03,0x4c,0xc9,
0xde,0x28,0x90,0x07,0xca,0x8a,0xe5,0x24,
0x90,0x05,0xaa,0xe8,0xca,0xd0,0x06,0x20,
0xb1,0x00,0x4c,0xd7,0xda,0x20,0x57,0xdb,
0xd0,0xf2,0x20,0xe7,0xe3,0x20,0x00,0xe6,
0xaa,0xa0,0x00,0xe8,0xca,0xf0,0xbb,0xb1,
0x5e,0x20,0x5c,0xdb,0xc8,0xc9,0x0d,0xd0,
0xf3,0x20,0x00,0xdb,0x4c,0x44,0xdb,0xa9,
0x20,0x2c,0xa9,0x3f,0x09,0x80,0xc9,0xa0,
0x90,0x02,0x05,0xf3,0x20,0xed,0xfd,0x29,
0x7f,0x48,0xa5,0xf1,0x20,0xa8,0xfc,0x68,
0x60,0xa5,0x15,0xf0,0x12,0x30,0x04,0xa0,
0xff,0xd0,0x04,0xa5,0x7b,0xa4,0x7c,0x85,
0x75,0x84,0x76,0x4c,0xc9,0xde,0x68,0x24,
0xd8,0x10,0x05,0xa2,0xfe,0x4c,0xe9,0xf2,
0xa9,0xef,0xa0,0xdc,0x20,0x3a,0xdb,0xa5,
0x79,0xa4,0x7a,0x85,0xb8,0x84,0xb9,0x60,
0x20,0x06,0xe3,0xa2,0x01,0xa0,0x02,0xa9,
0x00,0x8d,0x01,0x02,0xa9,0x40,0x20,0xeb,
0xdb,0x60,0xc9,0x22,0xd0,0x0e,0x20,0x81,
0xde,0xa9,0x3b,0x20,0xc0,0xde,0x20,0x3d,
0xdb,0x4c,0xc7,0xdb,0x20,0x5a,0xdb,0x20,
0x06,0xe3,0xa9,0x2c,0x8d,0xff,0x01,0x20,
0x2c,0xd5,0xad,0x00,0x02,0xc9,0x03,0xd0,
0x10,0x4c,0x63,0xd8,0x20,0x5a,0xdb,0x4c,
0x2c,0xd5,0xa6,0x7d,0xa4,0x7e,0xa9,0x98,
0x2c,0xa9,0x00,0x85,0x15,0x86,0x7f,0x84,
0x80,0x20,0xe3,0xdf,0x85,0x85,0x84,0x86,
0xa5,0xb8,0xa4,0xb9,0x85,0x87,0x84,0x88,
0xa6,0x7f,0xa4,0x80,0x86,0xb8,0x84,0xb9,
0x20,0xb7,0x00,0xd0,0x1e,0x24,0x15,0x50,
0x0e,0x20,0x0c,0xfd,0x29,0x7f,0x8d,0x00,
0x02,0xa2,0xff,0xa0,0x01,0xd0,0x08,0x30,
0x7f,0x20,0x5a,0xdb,0x20,0xdc,0xdb,0x86,
0xb8,0x84,0xb9,0x20,0xb1,0x00,0x24,0x11,
0x10,0x31,0x24,0x15,0x50,0x09,0xe8,0x86,
0xb8,0xa9,0x00,0x85,0x0d,0xf0,0x0c,0x85,
0x0d,0xc9,0x22,0xf0,0x07,0xa9,0x3a,0x85,
0x0d,0xa9,0x2c,0x18,0x85,0x0e,0xa5,0xb8,
0xa4,0xb9,0x69,0x00,0x90,0x01,0xc8,0x20,
0xed,0xe3,0x20,0x3d,0xe7,0x20,0x7b,0xda,
0x4c,0x72,0xdc,0x48,0xad,0x00,0x02,0xf0,
0x30,0x68,0x20,0x4a,0xec,0xa5,0x12,0x20,
0x63,0xda,0x20,0xb7,0x00,0xf0,0x07,0xc9,
0x2c,0xf0,0x03,0x4c,0x71,0xdb,0xa5,0xb8,
0xa4,0xb9,0x85,0x7f,0x84,0x80,0xa5,0x87,
0xa4,0x88,0x85,0xb8,0x84,0xb9,0x20,0xb7,
0x00,0xf0,0x33,0x20,0xbe,0xde,0x4c,0xf1,
0xdb,0xa5,0x15,0xd0,0xcc,0x4c,0x86,0xdb,
0x20,0xa3,0xd9,0xc8,0xaa,0xd0,0x12,0xa2,
0x2a,0xc8,0xb1,0xb8,0xf0,0x5f,0xc8,0xb1,
0xb8,0x85,0x7b,0xc8,0xb1,0xb8,0xc8,0x85,
0x7c,0xb1,0xb8,0xaa,0x20,0x98,0xd9,0xe0,
0x83,0xd0,0xdd,0x4c,0x2b,0xdc,0xa5,0x7f,
0xa4,0x80,0xa6,0x15,0x10,0x03,0x4c,0x53,
0xd8,0xa0,0x00,0xb1,0x7f,0xf0,0x07,0xa9,
0xdf,0xa0,0xdc,0x4c,0x3a,0xdb,0x60,0x3f,
0x45,0x58,0x54,0x52,0x41,0x20,0x49,0x47,
0x4e,0x4f,0x52,0x45,0x44,0x0d,0x00,0x3f,
0x52,0x45,0x45,0x4e,0x54,0x45,0x52,0x0d,
0x00,0xd0,0x04,0xa0,0x00,0xf0,0x03,0x20,
0xe3,0xdf,0x85,0x85,0x84,0x86,0x20,0x65,
0xd3,0xf0,0x04,0xa2,0x00,0xf0,0x69,0x9a,
0xe8,0xe8,0xe8,0xe8,0x8a,0xe8,0xe8,0xe8,
0xe8,0xe8,0xe8,0x86,0x60,0xa0,0x01,0x20,
0xf9,0xea,0xba,0xbd,0x09,0x01,0x85,0xa2,
0xa5,0x85,0xa4,0x86,0x20,0xbe,0xe7,0x20,
0x27,0xeb,0xa0,0x01,0x20,0xb4,0xeb,0xba,
0x38,0xfd,0x09,0x01,0xf0,0x17,0xbd,0x0f,
0x01,0x85,0x75,0xbd,0x10,0x01,0x85,0x76,
0xbd,0x12,0x01,0x85,0xb8,0xbd,0x11,0x01,
0x85,0xb9,0x4c,0xd2,0xd7,0x8a,0x69,0x11,
0xaa,0x9a,0x20,0xb7,0x00,0xc9,0x2c,0xd0,
0xf1,0x20,0xb1,0x00,0x20,0xff,0xdc,0x20,
0x7b,0xdd,0x18,0x24,0x38,0x24,0x11,0x30,
0x03,0xb0,0x03,0x60,0xb0,0xfd,0xa2,0xa3,
0x4c,0x12,0xd4,0xa6,0xb8,0xd0,0x02,0xc6,
0xb9,0xc6,0xb8,0xa2,0x00,0x24,0x48,0x8a,
0x48,0xa9,0x01,0x20,0xd6,0xd3,0x20,0x60,
0xde,0xa9,0x00,0x85,0x89,0x20,0xb7,0x00,
0x38,0xe9,0xcf,0x90,0x17,0xc9,0x03,0xb0,
0x13,0xc9,0x01,0x2a,0x49,0x01,0x45,0x89,
0xc5,0x89,0x90,0x61,0x85,0x89,0x20,0xb1,
0x00,0x4c,0x98,0xdd,0xa6,0x89,0xd0,0x2c,
0xb0,0x7b,0x69,0x07,0x90,0x77,0x65,0x11,
0xd0,0x03,0x4c,0x97,0xe5,0x69,0xff,0x85,
0x5e,0x0a,0x65,0x5e,0xa8,0x68,0xd9,0xb2,
0xd0,0xb0,0x67,0x20,0x6a,0xdd,0x48,0x20,
0xfd,0xdd,0x68,0xa4,0x87,0x10,0x17,0xaa,
0xf0,0x56,0xd0,0x5f,0x46,0x11,0x8a,0x2a,
0xa6,0xb8,0xd0,0x02,0xc6,0xb9,0xc6,0xb8,
0xa0,0x1b,0x85,0x89,0xd0,0xd7,0xd9,0xb2,
0xd0,0xb0,0x48,0x90,0xd9,0xb9,0xb4,0xd0,
0x48,0xb9,0xb3,0xd0,0x48,0x20,0x10,0xde,
0xa5,0x89,0x4c,0x86,0xdd,0x4c,0xc9,0xde,
0xa5,0xa2,0xbe,0xb2,0xd0,0xa8,0x68,0x85,
0x5e,0xe6,0x5e,0x68,0x85,0x5f,0x98,0x48,
0x20,0x72,0xeb,0xa5,0xa1,0x48,0xa5,0xa0,
0x48,0xa5,0x9f,0x48,0xa5,0x9e,0x48,0xa5,
0x9d,0x48,0x6c,0x5e,0x00,0xa0,0xff,0x68,
0xf0,0x23,0xc9,0x64,0xf0,0x03,0x20,0x6a,
0xdd,0x84,0x87,0x68,0x4a,0x85,0x16,0x68,
0x85,0xa5,0x68,0x85,0xa6,0x68,0x85,0xa7,
0x68,0x85,0xa8,0x68,0x85,0xa9,0x68,0x85,
0xaa,0x45,0xa2,0x85,0xab,0xa5,0x9d,0x60,
0xa9,0x00,0x85,0x11,0x20,0xb1,0x00,0xb0,
0x03,0x4c,0x4a,0xec,0x20,0x7d,0xe0,0xb0,
0x64,0xc9,0x2e,0xf0,0xf4,0xc9,0xc9,0xf0,
0x55,0xc9,0xc8,0xf0,0xe7,0xc9,0x22,0xd0,
0x0f,0xa5,0xb8,0xa4,0xb9,0x69,0x00,0x90,
0x01,0xc8,0x20,0xe7,0xe3,0x4c,0x3d,0xe7,
0xc9,0xc6,0xd0,0x10,0xa0,0x18,0xd0,0x38,
0xa5,0x9d,0xd0,0x03,0xa0,0x01,0x2c,0xa0,
0x00,0x4c,0x01,0xe3,0xc9,0xc2,0xd0,0x03,
0x4c,0x54,0xe3,0xc9,0xd2,0x90,0x03,0x4c,
0x0c,0xdf,0x20,0xbb,0xde,0x20,0x7b,0xdd,
0xa9,0x29,0x2c,0xa9,0x28,0x2c,0xa9,0x2c,
0xa0,0x00,0xd1,0xb8,0xd0,0x03,0x4c,0xb1,
0x00,0xa2,0x10,0x4c,0x12,0xd4,0xa0,0x15,
0x68,0x68,0x4c,0xd7,0xdd,0x20,0xe3,0xdf,
0x85,0xa0,0x84,0xa1,0xa6,0x11,0xf0,0x05,
0xa2,0x00,0x86,0xac,0x60,0xa6,0x12,0x10,
0x0d,0xa0,0x00,0xb1,0xa0,0xaa,0xc8,0xb1,
0xa0,0xa8,0x8a,0x4c,0xf2,0xe2,0x4c,0xf9,
0xea,0x20,0xb1,0x00,0x20,0xec,0xf1,0x8a,
0xa4,0xf0,0x20,0x71,0xf8,0xa8,0x20,0x01,
0xe3,0x4c,0xb8,0xde,0xc9,0xd7,0xf0,0xe9,
0x0a,0x48,0xaa,0x20,0xb1,0x00,0xe0,0xcf,
0x90,0x20,0x20,0xbb,0xde,0x20,0x7b,0xdd,
0x20,0xbe,0xde,0x20,0x6c,0xdd,0x68,0xaa,
0xa5,0xa1,0x48,0xa5,0xa0,0x48,0x8a,0x48,
0x20,0xf8,0xe6,0x68,0xa8,0x8a,0x48,0x4c,
0x3f,0xdf,0x20,0xb2,0xde,0x68,0xa8,0xb9,
0xdc,0xcf,0x85,0x91,0xb9,0xdd,0xcf,0x85,
0x92,0x20,0x90,0x00,0x4c,0x6a,0xdd,0xa5,
0xa5,0x05,0x9d,0xd0,0x0b,0xa5,0xa5,0xf0,
0x04,0xa5,0x9d,0xd0,0x03,0xa0,0x00,0x2c,
0xa0,0x01,0x4c,0x01,0xe3,0x20,0x6d,0xdd,
0xb0,0x13,0xa5,0xaa,0x09,0x7f,0x25,0xa6,
0x85,0xa6,0xa9,0xa5,0xa0,0x00,0x20,0xb2,
0xeb,0xaa,0x4c,0xb0,0xdf,0xa9,0x00,0x85,
0x11,0xc6,0x89,0x20,0x00,0xe6,0x85,0x9d,
0x86,0x9e,0x84,0x9f,0xa5,0xa8,0xa4,0xa9,
0x20,0x04,0xe6,0x86,0xa8,0x84,0xa9,0xaa,
0x38,0xe5,0x9d,0xf0,0x08,0xa9,0x01,0x90,
0x04,0xa6,0x9d,0xa9,0xff,0x85,0xa2,0xa0,
0xff,0xe8,0xc8,0xca,0xd0,0x07,0xa6,0xa2,
0x30,0x0f,0x18,0x90,0x0c,0xb1,0xa8,0xd1,
0x9e,0xf0,0xef,0xa2,0xff,0xb0,0x02,0xa2,
0x01,0xe8,0x8a,0x2a,0x25,0x16,0xf0,0x02,
0xa9,0x01,0x4c,0x93,0xeb,0x20,0xfb,0xe6,
0x20,0x1e,0xfb,0x4c,0x01,0xe3,0x20,0xbe,
0xde,0xaa,0x20,0xe8,0xdf,0x20,0xb7,0x00,
0xd0,0xf4,0x60,0xa2,0x00,0x20,0xb7,0x00,
0x86,0x10,0x85,0x81,0x20,0xb7,0x00,0x20,
0x7d,0xe0,0xb0,0x03,0x4c,0xc9,0xde,0xa2,
0x00,0x86,0x11,0x86,0x12,0x4c,0x07,0xe0,
0x4c,0x28,0xf1,0x4c,0x3c,0xd4,0x00,0x20,
0xb1,0x00,0x90,0x05,0x20,0x7d,0xe0,0x90,
0x0b,0xaa,0x20,0xb1,0x00,0x90,0xfb,0x20,
0x7d,0xe0,0xb0,0xf6,0xc9,0x24,0xd0,0x06,
0xa9,0xff,0x85,0x11,0xd0,0x10,0xc9,0x25,
0xd0,0x13,0xa5,0x14,0x30,0xc6,0xa9,0x80,
0x85,0x12,0x05,0x81,0x85,0x81,0x8a,0x09,
0x80,0xaa,0x20,0xb1,0x00,0x86,0x82,0x38,
0x05,0x14,0xe9,0x28,0xd0,0x03,0x4c,0x1e,
0xe1,0x24,0x14,0x30,0x02,0x70,0xf7,0xa9,
0x00,0x85,0x14,0xa5,0x69,0xa6,0x6a,0xa0,
0x00,0x86,0x9c,0x85,0x9b,0xe4,0x6c,0xd0,
0x04,0xc5,0x6b,0xf0,0x22,0xa5,0x81,0xd1,
0x9b,0xd0,0x08,0xa5,0x82,0xc8,0xd1,0x9b,
0xf0,0x6c,0x88,0x18,0xa5,0x9b,0x69,0x07,
0x90,0xe1,0xe8,0xd0,0xdc,0xc9,0x41,0x90,
0x05,0xe9,0x5b,0x38,0xe9,0xa5,0x60,0x68,
0x48,0xc9,0xd7,0xd0,0x0f,0xba,0xbd,0x02,
0x01,0xc9,0xde,0xd0,0x07,0xa9,0x9a,0xa0,
0xe0,0x60,0x00,0x00,0xa5,0x6b,0xa4,0x6c,
0x85,0x9b,0x84,0x9c,0xa5,0x6d,0xa4,0x6e,
0x85,0x96,0x84,0x97,0x18,0x69,0x07,0x90,
0x01,0xc8,0x85,0x94,0x84,0x95,0x20,0x93,
0xd3,0xa5,0x94,0xa4,0x95,0xc8,0x85,0x6b,
0x84,0x6c,0xa0,0x00,0xa5,0x81,0x91,0x9b,
0xc8,0xa5,0x82,0x91,0x9b,0xa9,0x00,0xc8,
0x91,0x9b,0xc8,0x91,0x9b,0xc8,0x91,0x9b,
0xc8,0x91,0x9b,0xc8,0x91,0x9b,0xa5,0x9b,
0x18,0x69,0x02,0xa4,0x9c,0x90,0x01,0xc8,
0x85,0x83,0x84,0x84,0x60,0xa5,0x0f,0x0a,
0x69,0x05,0x65,0x9b,0xa4,0x9c,0x90,0x01,
0xc8,0x85,0x94,0x84,0x95,0x60,0x90,0x80,
0x00,0x00,0x20,0xb1,0x00,0x20,0x67,0xdd,
0xa5,0xa2,0x30,0x0d,0xa5,0x9d,0xc9,0x90,
0x90,0x09,0xa9,0xfe,0xa0,0xe0,0x20,0xb2,
0xeb,0xd0,0x7e,0x4c,0xf2,0xeb,0xa5,0x14,
0xd0,0x47,0xa5,0x10,0x05,0x12,0x48,0xa5,
0x11,0x48,0xa0,0x00,0x98,0x48,0xa5,0x82,
0x48,0xa5,0x81,0x48,0x20,0x02,0xe1,0x68,
0x85,0x81,0x68,0x85,0x82,0x68,0xa8,0xba,
0xbd,0x02,0x01,0x48,0xbd,0x01,0x01,0x48,
0xa5,0xa0,0x9d,0x02,0x01,0xa5,0xa1,0x9d,
0x01,0x01,0xc8,0x20,0xb7,0x00,0xc9,0x2c,
0xf0,0xd2,0x84,0x0f,0x20,0xb8,0xde,0x68,
0x85,0x11,0x68,0x85,0x12,0x29,0x7f,0x85,
0x10,0xa6,0x6b,0xa5,0x6c,0x86,0x9b,0x85,
0x9c,0xc5,0x6e,0xd0,0x04,0xe4,0x6d,0xf0,
0x3f,0xa0,0x00,0xb1,0x9b,0xc8,0xc5,0x81,
0xd0,0x06,0xa5,0x82,0xd1,0x9b,0xf0,0x16,
0xc8,0xb1,0x9b,0x18,0x65,0x9b,0xaa,0xc8,
0xb1,0x9b,0x65,0x9c,0x90,0xd7,0xa2,0x6b,
0x2c,0xa2,0x35,0x4c,0x12,0xd4,0xa2,0x78,
0xa5,0x10,0xd0,0xf7,0xa5,0x14,0xf0,0x02,
0x38,0x60,0x20,0xed,0xe0,0xa5,0x0f,0xa0,
0x04,0xd1,0x9b,0xd0,0xe1,0x4c,0x4b,0xe2,
0xa5,0x14,0xf0,0x05,0xa2,0x2a,0x4c,0x12,
0xd4,0x20,0xed,0xe0,0x20,0xe3,0xd3,0xa9,
0x00,0xa8,0x85,0xae,0xa2,0x05,0xa5,0x81,
0x91,0x9b,0x10,0x01,0xca,0xc8,0xa5,0x82,
0x91,0x9b,0x10,0x02,0xca,0xca,0x86,0xad,
0xa5,0x0f,0xc8,0xc8,0xc8,0x91,0x9b,0xa2,
0x0b,0xa9,0x00,0x24,0x10,0x50,0x08,0x68,
0x18,0x69,0x01,0xaa,0x68,0x69,0x00,0xc8,
0x91,0x9b,0xc8,0x8a,0x91,0x9b,0x20,0xad,
0xe2,0x86,0xad,0x85,0xae,0xa4,0x5e,0xc6,
0x0f,0xd0,0xdc,0x65,0x95,0xb0,0x5d,0x85,
0x95,0xa8,0x8a,0x65,0x94,0x90,0x03,0xc8,
0xf0,0x52,0x20,0xe3,0xd3,0x85,0x6d,0x84,
0x6e,0xa9,0x00,0xe6,0xae,0xa4,0xad,0xf0,
0x05,0x88,0x91,0x94,0xd0,0xfb,0xc6,0x95,
0xc6,0xae,0xd0,0xf5,0xe6,0x95,0x38,0xa5,
0x6d,0xe5,0x9b,0xa0,0x02,0x91,0x9b,0xa5,
0x6e,0xc8,0xe5,0x9c,0x91,0x9b,0xa5,0x10,
0xd0,0x62,0xc8,0xb1,0x9b,0x85,0x0f,0xa9,
0x00,0x85,0xad,0x85,0xae,0xc8,0x68,0xaa,
0x85,0xa0,0x68,0x85,0xa1,0xd1,0x9b,0x90,
0x0e,0xd0,0x06,0xc8,0x8a,0xd1,0x9b,0x90,
0x07,0x4c,0x96,0xe1,0x4c,0x10,0xd4,0xc8,
0xa5,0xae,0x05,0xad,0x18,0xf0,0x0a,0x20,
0xad,0xe2,0x8a,0x65,0xa0,0xaa,0x98,0xa4,
0x5e,0x65,0xa1,0x86,0xad,0xc6,0x0f,0xd0,
0xca,0x85,0xae,0xa2,0x05,0xa5,0x81,0x10,
0x01,0xca,0xa5,0x82,0x10,0x02,0xca,0xca,
0x86,0x64,0xa9,0x00,0x20,0xb6,0xe2,0x8a,
0x65,0x94,0x85,0x83,0x98,0x65,0x95,0x85,
0x84,0xa8,0xa5,0x83,0x60,0x84,0x5e,0xb1,
0x9b,0x85,0x64,0x88,0xb1,0x9b,0x85,0x65,
0xa9,0x10,0x85,0x99,0xa2,0x00,0xa0,0x00,
0x8a,0x0a,0xaa,0x98,0x2a,0xa8,0xb0,0xa4,
0x06,0xad,0x26,0xae,0x90,0x0b,0x18,0x8a,
0x65,0x64,0xaa,0x98,0x65,0x65,0xa8,0xb0,
0x93,0xc6,0x99,0xd0,0xe3,0x60,0xa5,0x11,
0xf0,0x03,0x20,0x00,0xe6,0x20,0x84,0xe4,
0x38,0xa5,0x6f,0xe5,0x6d,0xa8,0xa5,0x70,
0xe5,0x6e,0xa2,0x00,0x86,0x11,0x85,0x9e,
0x84,0x9f,0xa2,0x90,0x4c,0x9b,0xeb,0xa4,
0x24,0xa9,0x00,0x38,0xf0,0xec,0xa6,0x76,
0xe8,0xd0,0xa1,0xa2,0x95,0x2c,0xa2,0xe0,
0x4c,0x12,0xd4,0x20,0x41,0xe3,0x20,0x06,
0xe3,0x20,0xbb,0xde,0xa9,0x80,0x85,0x14,
0x20,0xe3,0xdf,0x20,0x6a,0xdd,0x20,0xb8,
0xde,0xa9,0xd0,0x20,0xc0,0xde,0x48,0xa5,
0x84,0x48,0xa5,0x83,0x48,0xa5,0xb9,0x48,
0xa5,0xb8,0x48,0x20,0x95,0xd9,0x4c,0xaf,
0xe3,0xa9,0xc2,0x20,0xc0,0xde,0x09,0x80,
0x85,0x14,0x20,0xea,0xdf,0x85,0x8a,0x84,
0x8b,0x4c,0x6a,0xdd,0x20,0x41,0xe3,0xa5,
0x8b,0x48,0xa5,0x8a,0x48,0x20,0xb2,0xde,
0x20,0x6a,0xdd,0x68,0x85,0x8a,0x68,0x85,
0x8b,0xa0,0x02,0xb1,0x8a,0x85,0x83,0xaa,
0xc8,0xb1,0x8a,0xf0,0x99,0x85,0x84,0xc8,
0xb1,0x83,0x48,0x88,0x10,0xfa,0xa4,0x84,
0x20,0x2b,0xeb,0xa5,0xb9,0x48,0xa5,0xb8,
0x48,0xb1,0x8a,0x85,0xb8,0xc8,0xb1,0x8a,
0x85,0xb9,0xa5,0x84,0x48,0xa5,0x83,0x48,
0x20,0x67,0xdd,0x68,0x85,0x8a,0x68,0x85,
0x8b,0x20,0xb7,0x00,0xf0,0x03,0x4c,0xc9,
0xde,0x68,0x85,0xb8,0x68,0x85,0xb9,0xa0,
0x00,0x68,0x91,0x8a,0x68,0xc8,0x91,0x8a,
0x68,0xc8,0x91,0x8a,0x68,0xc8,0x91,0x8a,
0x68,0xc8,0x91,0x8a,0x60,0x20,0x6a,0xdd,
0xa0,0x00,0x20,0x36,0xed,0x68,0x68,0xa9,
0xff,0xa0,0x00,0xf0,0x12,0xa6,0xa0,0xa4,
0xa1,0x86,0x8c,0x84,0x8d,0x20,0x52,0xe4,
0x86,0x9e,0x84,0x9f,0x85,0x9d,0x60,0xa2,
0x22,0x86,0x0d,0x86,0x0e,0x85,0xab,0x84,
0xac,0x85,0x9e,0x84,0x9f,0xa0,0xff,0xc8,
0xb1,0xab,0xf0,0x0c,0xc5,0x0d,0xf0,0x04,
0xc5,0x0e,0xd0,0xf3,0xc9,0x22,0xf0,0x01,
0x18,0x84,0x9d,0x98,0x65,0xab,0x85,0xad,
0xa6,0xac,0x90,0x01,0xe8,0x86,0xae,0xa5,
0xac,0xf0,0x04,0xc9,0x02,0xd0,0x0b,0x98,
0x20,0xd5,0xe3,0xa6,0xab,0xa4,0xac,0x20,
0xe2,0xe5,0xa6,0x52,0xe0,0x5e,0xd0,0x05,
0xa2,0xbf,0x4c,0x12,0xd4,0xa5,0x9d,0x95,
0x00,0xa5,0x9e,0x95,0x01,0xa5,0x9f,0x95,
0x02,0xa0,0x00,0x86,0xa0,0x84,0xa1,0x88,
0x84,0x11,0x86,0x53,0xe8,0xe8,0xe8,0x86,
0x52,0x60,0x46,0x13,0x48,0x49,0xff,0x38,
0x65,0x6f,0xa4,0x70,0xb0,0x01,0x88,0xc4,
0x6e,0x90,0x11,0xd0,0x04,0xc5,0x6d,0x90,
0x0b,0x85,0x6f,0x84,0x70,0x85,0x71,0x84,
0x72,0xaa,0x68,0x60,0xa2,0x4d,0xa5,0x13,
0x30,0xb8,0x20,0x84,0xe4,0xa9,0x80,0x85,
0x13,0x68,0xd0,0xd0,0xa6,0x73,0xa5,0x74,
0x86,0x6f,0x85,0x70,0xa0,0x00,0x84,0x8b,
0xa5,0x6d,0xa6,0x6e,0x85,0x9b,0x86,0x9c,
0xa9,0x55,0xa2,0x00,0x85,0x5e,0x86,0x5f,
0xc5,0x52,0xf0,0x05,0x20,0x23,0xe5,0xf0,
0xf7,0xa9,0x07,0x85,0x8f,0xa5,0x69,0xa6,
0x6a,0x85,0x5e,0x86,0x5f,0xe4,0x6c,0xd0,
0x04,0xc5,0x6b,0xf0,0x05,0x20,0x19,0xe5,
0xf0,0xf3,0x85,0x94,0x86,0x95,0xa9,0x03,
0x85,0x8f,0xa5,0x94,0xa6,0x95,0xe4,0x6e,
0xd0,0x07,0xc5,0x6d,0xd0,0x03,0x4c,0x62,
0xe5,0x85,0x5e,0x86,0x5f,0xa0,0x00,0xb1,
0x5e,0xaa,0xc8,0xb1,0x5e,0x08,0xc8,0xb1,
0x5e,0x65,0x94,0x85,0x94,0xc8,0xb1,0x5e,
0x65,0x95,0x85,0x95,0x28,0x10,0xd3,0x8a,
0x30,0xd0,0xc8,0xb1,0x5e,0xa0,0x00,0x0a,
0x69,0x05,0x65,0x5e,0x85,0x5e,0x90,0x02,
0xe6,0x5f,0xa6,0x5f,0xe4,0x95,0xd0,0x04,
0xc5,0x94,0xf0,0xba,0x20,0x23,0xe5,0xf0,
0xf3,0xb1,0x5e,0x30,0x35,0xc8,0xb1,0x5e,
0x10,0x30,0xc8,0xb1,0x5e,0xf0,0x2b,0xc8,
0xb1,0x5e,0xaa,0xc8,0xb1,0x5e,0xc5,0x70,
0x90,0x06,0xd0,0x1e,0xe4,0x6f,0xb0,0x1a,
0xc5,0x9c,0x90,0x16,0xd0,0x04,0xe4,0x9b,
0x90,0x10,0x86,0x9b,0x85,0x9c,0xa5,0x5e,
0xa6,0x5f,0x85,0x8a,0x86,0x8b,0xa5,0x8f,
0x85,0x91,0xa5,0x8f,0x18,0x65,0x5e,0x85,
0x5e,0x90,0x02,0xe6,0x5f,0xa6,0x5f,0xa0,
0x00,0x60,0xa6,0x8b,0xf0,0xf7,0xa5,0x91,
0x29,0x04,0x4a,0xa8,0x85,0x91,0xb1,0x8a,
0x65,0x9b,0x85,0x96,0xa5,0x9c,0x69,0x00,
0x85,0x97,0xa5,0x6f,0xa6,0x70,0x85,0x94,
0x86,0x95,0x20,0x9a,0xd3,0xa4,0x91,0xc8,
0xa5,0x94,0x91,0x8a,0xaa,0xe6,0x95,0xa5,
0x95,0xc8,0x91,0x8a,0x4c,0x88,0xe4,0xa5,
0xa1,0x48,0xa5,0xa0,0x48,0x20,0x60,0xde,
0x20,0x6c,0xdd,0x68,0x85,0xab,0x68,0x85,
0xac,0xa0,0x00,0xb1,0xab,0x18,0x71,0xa0,
0x90,0x05,0xa2,0xb0,0x4c,0x12,0xd4,0x20,
0xd5,0xe3,0x20,0xd4,0xe5,0xa5,0x8c,0xa4,
0x8d,0x20,0x04,0xe6,0x20,0xe6,0xe5,0xa5,
0xab,0xa4,0xac,0x20,0x04,0xe6,0x20,0x2a,
0xe4,0x4c,0x95,0xdd,0xa0,0x00,0xb1,0xab,
0x48,0xc8,0xb1,0xab,0xaa,0xc8,0xb1,0xab,
0xa8,0x68,0x86,0x5e,0x84,0x5f,0xa8,0xf0,
0x0a,0x48,0x88,0xb1,0x5e,0x91,0x71,0x98,
0xd0,0xf8,0x68,0x18,0x65,0x71,0x85,0x71,
0x90,0x02,0xe6,0x72,0x60,0x20,0x6c,0xdd,
0xa5,0xa0,0xa4,0xa1,0x85,0x5e,0x84,0x5f,
0x20,0x35,0xe6,0x08,0xa0,0x00,0xb1,0x5e,
0x48,0xc8,0xb1,0x5e,0xaa,0xc8,0xb1,0x5e,
0xa8,0x68,0x28,0xd0,0x13,0xc4,0x70,0xd0,
0x0f,0xe4,0x6f,0xd0,0x0b,0x48,0x18,0x65,
0x6f,0x85,0x6f,0x90,0x02,0xe6,0x70,0x68,
0x86,0x5e,0x84,0x5f,0x60,0xc4,0x54,0xd0,
0x0c,0xc5,0x53,0xd0,0x08,0x85,0x52,0xe9,
0x03,0x85,0x53,0xa0,0x00,0x60,0x20,0xfb,
0xe6,0x8a,0x48,0xa9,0x01,0x20,0xdd,0xe3,
0x68,0xa0,0x00,0x91,0x9e,0x68,0x68,0x4c,
0x2a,0xe4,0x20,0xb9,0xe6,0xd1,0x8c,0x98,
0x90,0x04,0xb1,0x8c,0xaa,0x98,0x48,0x8a,
0x48,0x20,0xdd,0xe3,0xa5,0x8c,0xa4,0x8d,
0x20,0x04,0xe6,0x68,0xa8,0x68,0x18,0x65,
0x5e,0x85,0x5e,0x90,0x02,0xe6,0x5f,0x98,
0x20,0xe6,0xe5,0x4c,0x2a,0xe4,0x20,0xb9,
0xe6,0x18,0xf1,0x8c,0x49,0xff,0x4c,0x60,
0xe6,0xa9,0xff,0x85,0xa1,0x20,0xb7,0x00,
0xc9,0x29,0xf0,0x06,0x20,0xbe,0xde,0x20,
0xf8,0xe6,0x20,0xb9,0xe6,0xca,0x8a,0x48,
0x18,0xa2,0x00,0xf1,0x8c,0xb0,0xb8,0x49,
0xff,0xc5,0xa1,0x90,0xb3,0xa5,0xa1,0xb0,
0xaf,0x20,0xb8,0xde,0x68,0xa8,0x68,0x85,
0x91,0x68,0x68,0x68,0xaa,0x68,0x85,0x8c,
0x68,0x85,0x8d,0xa5,0x91,0x48,0x98,0x48,
0xa0,0x00,0x8a,0xf0,0x1d,0x60,0x20,0xdc,
0xe6,0x4c,0x01,0xe3,0x20,0xfd,0xe5,0xa2,
0x00,0x86,0x11,0xa8,0x60,0x20,0xdc,0xe6,
0xf0,0x08,0xa0,0x00,0xb1,0x5e,0xa8,0x4c,
0x01,0xe3,0x4c,0x99,0xe1,0x20,0xb1,0x00,
0x20,0x67,0xdd,0x20,0x08,0xe1,0xa6,0xa0,
0xd0,0xf0,0xa6,0xa1,0x4c,0xb7,0x00,0x20,
0xdc,0xe6,0xd0,0x03,0x4c,0x4e,0xe8,0xa6,
0xb8,0xa4,0xb9,0x86,0xad,0x84,0xae,0xa6,
0x5e,0x86,0xb8,0x18,0x65,0x5e,0x85,0x60,
0xa6,0x5f,0x86,0xb9,0x90,0x01,0xe8,0x86,
0x61,0xa0,0x00,0xb1,0x60,0x48,0xa9,0x00,
0x91,0x60,0x20,0xb7,0x00,0x20,0x4a,0xec,
0x68,0xa0,0x00,0x91,0x60,0xa6,0xad,0xa4,
0xae,0x86,0xb8,0x84,0xb9,0x60,0x20,0x67,
0xdd,0x20,0x52,0xe7,0x20,0xbe,0xde,0x4c,
0xf8,0xe6,0xa5,0x9d,0xc9,0x91,0xb0,0x9a,
0x20,0xf2,0xeb,0xa5,0xa0,0xa4,0xa1,0x84,
0x50,0x85,0x51,0x60,0xa5,0x50,0x48,0xa5,
0x51,0x48,0x20,0x52,0xe7,0xa0,0x00,0xb1,
0x50,0xa8,0x68,0x85,0x51,0x68,0x85,0x50,
0x4c,0x01,0xe3,0x20,0x46,0xe7,0x8a,0xa0,
0x00,0x91,0x50,0x60,0x20,0x46,0xe7,0x86,
0x85,0xa2,0x00,0x20,0xb7,0x00,0xf0,0x03,
0x20,0x4c,0xe7,0x86,0x86,0xa0,0x00,0xb1,
0x50,0x45,0x86,0x25,0x85,0xf0,0xf8,0x60,
0xa9,0x64,0xa0,0xee,0x4c,0xbe,0xe7,0x20,
0xe3,0xe9,0xa5,0xa2,0x49,0xff,0x85,0xa2,
0x45,0xaa,0x85,0xab,0xa5,0x9d,0x4c,0xc1,
0xe7,0x20,0xf0,0xe8,0x90,0x3c,0x20,0xe3,
0xe9,0xd0,0x03,0x4c,0x53,0xeb,0xa6,0xac,
0x86,0x92,0xa2,0xa5,0xa5,0xa5,0xa8,0xf0,
0xce,0x38,0xe5,0x9d,0xf0,0x24,0x90,0x12,
0x84,0x9d,0xa4,0xaa,0x84,0xa2,0x49,0xff,
0x69,0x00,0xa0,0x00,0x84,0x92,0xa2,0x9d,
0xd0,0x04,0xa0,0x00,0x84,0xac,0xc9,0xf9,
0x30,0xc7,0xa8,0xa5,0xac,0x56,0x01,0x20,
0x07,0xe9,0x24,0xab,0x10,0x57,0xa0,0x9d,
0xe0,0xa5,0xf0,0x02,0xa0,0xa5,0x38,0x49,
0xff,0x65,0x92,0x85,0xac,0xb9,0x04,0x00,
0xf5,0x04,0x85,0xa1,0xb9,0x03,0x00,0xf5,
0x03,0x85,0xa0,0xb9,0x02,0x00,0xf5,0x02,
0x85,0x9f,0xb9,0x01,0x00,0xf5,0x01,0x85,
0x9e,0xb0,0x03,0x20,0x9e,0xe8,0xa0,0x00,
0x98,0x18,0xa6,0x9e,0xd0,0x4a,0xa6,0x9f,
0x86,0x9e,0xa6,0xa0,0x86,0x9f,0xa6,0xa1,
0x86,0xa0,0xa6,0xac,0x86,0xa1,0x84,0xac,
0x69,0x08,0xc9,0x20,0xd0,0xe4,0xa9,0x00,
0x85,0x9d,0x85,0xa2,0x60,0x65,0x92,0x85,
0xac,0xa5,0xa1,0x65,0xa9,0x85,0xa1,0xa5,
0xa0,0x65,0xa8,0x85,0xa0,0xa5,0x9f,0x65,
0xa7,0x85,0x9f,0xa5,0x9e,0x65,0xa6,0x85,
0x9e,0x4c,0x8d,0xe8,0x69,0x01,0x06,0xac,
0x26,0xa1,0x26,0xa0,0x26,0x9f,0x26,0x9e,
0x10,0xf2,0x38,0xe5,0x9d,0xb0,0xc7,0x49,
0xff,0x69,0x01,0x85,0x9d,0x90,0x0e,0xe6,
0x9d,0xf0,0x42,0x66,0x9e,0x66,0x9f,0x66,
0xa0,0x66,0xa1,0x66,0xac,0x60,0xa5,0xa2,
0x49,0xff,0x85,0xa2,0xa5,0x9e,0x49,0xff,
0x85,0x9e,0xa5,0x9f,0x49,0xff,0x85,0x9f,
0xa5,0xa0,0x49,0xff,0x85,0xa0,0xa5,0xa1,
0x49,0xff,0x85,0xa1,0xa5,0xac,0x49,0xff,
0x85,0xac,0xe6,0xac,0xd0,0x0e,0xe6,0xa1,
0xd0,0x0a,0xe6,0xa0,0xd0,0x06,0xe6,0x9f,
0xd0,0x02,0xe6,0x9e,0x60,0xa2,0x45,0x4c,
0x12,0xd4,0xa2,0x61,0xb4,0x04,0x84,0xac,
0xb4,0x03,0x94,0x04,0xb4,0x02,0x94,0x03,
0xb4,0x01,0x94,0x02,0xa4,0xa4,0x94,0x01,
0x69,0x08,0x30,0xe8,0xf0,0xe6,0xe9,0x08,
0xa8,0xa5,0xac,0xb0,0x14,0x16,0x01,0x90,
0x02,0xf6,0x01,0x76,0x01,0x76,0x01,0x76,
0x02,0x76,0x03,0x76,0x04,0x6a,0xc8,0xd0,
0xec,0x18,0x60,0x81,0x00,0x00,0x00,0x00,
0x03,0x7f,0x5e,0x56,0xcb,0x79,0x80,0x13,
0x9b,0x0b,0x64,0x80,0x76,0x38,0x93,0x16,
0x82,0x38,0xaa,0x3b,0x20,0x80,0x35,0x04,
0xf3,0x34,0x81,0x35,0x04,0xf3,0x34,0x80,
0x80,0x00,0x00,0x00,0x80,0x31,0x72,0x17,
0xf8,0x20,0x82,0xeb,0xf0,0x02,0x10,0x03,
0x4c,0x99,0xe1,0xa5,0x9d,0xe9,0x7f,0x48,
0xa9,0x80,0x85,0x9d,0xa9,0x2d,0xa0,0xe9,
0x20,0xbe,0xe7,0xa9,0x32,0xa0,0xe9,0x20,
0x66,0xea,0xa9,0x13,0xa0,0xe9,0x20,0xa7,
0xe7,0xa9,0x18,0xa0,0xe9,0x20,0x5c,0xef,
0xa9,0x37,0xa0,0xe9,0x20,0xbe,0xe7,0x68,
0x20,0xd5,0xec,0xa9,0x3c,0xa0,0xe9,0x20,
0xe3,0xe9,0xd0,0x03,0x4c,0xe2,0xe9,0x20,
0x0e,0xea,0xa9,0x00,0x85,0x62,0x85,0x63,
0x85,0x64,0x85,0x65,0xa5,0xac,0x20,0xb0,
0xe9,0xa5,0xa1,0x20,0xb0,0xe9,0xa5,0xa0,
0x20,0xb0,0xe9,0xa5,0x9f,0x20,0xb0,0xe9,
0xa5,0x9e,0x20,0xb5,0xe9,0x4c,0xe6,0xea,
0xd0,0x03,0x4c,0xda,0xe8,0x4a,0x09,0x80,
0xa8,0x90,0x19,0x18,0xa5,0x65,0x65,0xa9,
0x85,0x65,0xa5,0x64,0x65,0xa8,0x85,0x64,
0xa5,0x63,0x65,0xa7,0x85,0x63,0xa5,0x62,
0x65,0xa6,0x85,0x62,0x66,0x62,0x66,0x63,
0x66,0x64,0x66,0x65,0x66,0xac,0x98,0x4a,
0xd0,0xd6,0x60,0x85,0x5e,0x84,0x5f,0xa0,
0x04,0xb1,0x5e,0x85,0xa9,0x88,0xb1,0x5e,
0x85,0xa8,0x88,0xb1,0x5e,0x85,0xa7,0x88,
0xb1,0x5e,0x85,0xaa,0x45,0xa2,0x85,0xab,
0xa5,0xaa,0x09,0x80,0x85,0xa6,0x88,0xb1,
0x5e,0x85,0xa5,0xa5,0x9d,0x60,0xa5,0xa5,
0xf0,0x1f,0x18,0x65,0x9d,0x90,0x04,0x30,
0x1d,0x18,0x2c,0x10,0x14,0x69,0x80,0x85,
0x9d,0xd0,0x03,0x4c,0x52,0xe8,0xa5,0xab,
0x85,0xa2,0x60,0xa5,0xa2,0x49,0xff,0x30,
0x05,0x68,0x68,0x4c,0x4e,0xe8,0x4c,0xd5,
0xe8,0x20,0x63,0xeb,0xaa,0xf0,0x10,0x18,
0x69,0x02,0xb0,0xf2,0xa2,0x00,0x86,0xab,
0x20,0xce,0xe7,0xe6,0x9d,0xf0,0xe7,0x60,
0x84,0x20,0x00,0x00,0x00,0x20,0x63,0xeb,
0xa9,0x50,0xa0,0xea,0xa2,0x00,0x86,0xab,
0x20,0xf9,0xea,0x4c,0x69,0xea,0x20,0xe3,
0xe9,0xf0,0x76,0x20,0x72,0xeb,0xa9,0x00,
0x38,0xe5,0x9d,0x85,0x9d,0x20,0x0e,0xea,
0xe6,0x9d,0xf0,0xba,0xa2,0xfc,0xa9,0x01,
0xa4,0xa6,0xc4,0x9e,0xd0,0x10,0xa4,0xa7,
0xc4,0x9f,0xd0,0x0a,0xa4,0xa8,0xc4,0xa0,
0xd0,0x04,0xa4,0xa9,0xc4,0xa1,0x08,0x2a,
0x90,0x09,0xe8,0x95,0x65,0xf0,0x32,0x10,
0x34,0xa9,0x01,0x28,0xb0,0x0e,0x06,0xa9,
0x26,0xa8,0x26,0xa7,0x26,0xa6,0xb0,0xe6,
0x30,0xce,0x10,0xe2,0xa8,0xa5,0xa9,0xe5,
0xa1,0x85,0xa9,0xa5,0xa8,0xe5,0xa0,0x85,
0xa8,0xa5,0xa7,0xe5,0x9f,0x85,0xa7,0xa5,
0xa6,0xe5,0x9e,0x85,0xa6,0x98,0x4c,0xa6,
0xea,0xa9,0x40,0xd0,0xce,0x0a,0x0a,0x0a,
0x0a,0x0a,0x0a,0x85,0xac,0x28,0x4c,0xe6,
0xea,0xa2,0x85,0x4c,0x12,0xd4,0xa5,0x62,
0x85,0x9e,0xa5,0x63,0x85,0x9f,0xa5,0x64,
0x85,0xa0,0xa5,0x65,0x85,0xa1,0x4c,0x2e,
0xe8,0x85,0x5e,0x84,0x5f,0xa0,0x04,0xb1,
0x5e,0x85,0xa1,0x88,0xb1,0x5e,0x85,0xa0,
0x88,0xb1,0x5e,0x85,0x9f,0x88,0xb1,0x5e,
0x85,0xa2,0x09,0x80,0x85,0x9e,0x88,0xb1,
0x5e,0x85,0x9d,0x84,0xac,0x60,0xa2,0x98,
0x2c,0xa2,0x93,0xa0,0x00,0xf0,0x04,0xa6,
0x85,0xa4,0x86,0x20,0x72,0xeb,0x86,0x5e,
0x84,0x5f,0xa0,0x04,0xa5,0xa1,0x91,0x5e,
0x88,0xa5,0xa0,0x91,0x5e,0x88,0xa5,0x9f,
0x91,0x5e,0x88,0xa5,0xa2,0x09,0x7f,0x25,
0x9e,0x91,0x5e,0x88,0xa5,0x9d,0x91,0x5e,
0x84,0xac,0x60,0xa5,0xaa,0x85,0xa2,0xa2,
0x05,0xb5,0xa4,0x95,0x9c,0xca,0xd0,0xf9,
0x86,0xac,0x60,0x20,0x72,0xeb,0xa2,0x06,
0xb5,0x9c,0x95,0xa4,0xca,0xd0,0xf9,0x86,
0xac,0x60,0xa5,0x9d,0xf0,0xfb,0x06,0xac,
0x90,0xf7,0x20,0xc6,0xe8,0xd0,0xf2,0x4c,
0x8f,0xe8,0xa5,0x9d,0xf0,0x09,0xa5,0xa2,
0x2a,0xa9,0xff,0xb0,0x02,0xa9,0x01,0x60,
0x20,0x82,0xeb,0x85,0x9e,0xa9,0x00,0x85,
0x9f,0xa2,0x88,0xa5,0x9e,0x49,0xff,0x2a,
0xa9,0x00,0x85,0xa1,0x85,0xa0,0x86,0x9d,
0x85,0xac,0x85,0xa2,0x4c,0x29,0xe8,0x46,
0xa2,0x60,0x85,0x60,0x84,0x61,0xa0,0x00,
0xb1,0x60,0xc8,0xaa,0xf0,0xc4,0xb1,0x60,
0x45,0xa2,0x30,0xc2,0xe4,0x9d,0xd0,0x21,
0xb1,0x60,0x09,0x80,0xc5,0x9e,0xd0,0x19,
0xc8,0xb1,0x60,0xc5,0x9f,0xd0,0x12,0xc8,
0xb1,0x60,0xc5,0xa0,0xd0,0x0b,0xc8,0xa9,
0x7f,0xc5,0xac,0xb1,0x60,0xe5,0xa1,0xf0,
0x28,0xa5,0xa2,0x90,0x02,0x49,0xff,0x4c,
0x88,0xeb,0xa5,0x9d,0xf0,0x4a,0x38,0xe9,
0xa0,0x24,0xa2,0x10,0x09,0xaa,0xa9,0xff,
0x85,0xa4,0x20,0xa4,0xe8,0x8a,0xa2,0x9d,
0xc9,0xf9,0x10,0x06,0x20,0xf0,0xe8,0x84,
0xa4,0x60,0xa8,0xa5,0xa2,0x29,0x80,0x46,
0x9e,0x05,0x9e,0x85,0x9e,0x20,0x07,0xe9,
0x84,0xa4,0x60,0xa5,0x9d,0xc9,0xa0,0xb0,
0x20,0x20,0xf2,0xeb,0x84,0xac,0xa5,0xa2,
0x84,0xa2,0x49,0x80,0x2a,0xa9,0xa0,0x85,
0x9d,0xa5,0xa1,0x85,0x0d,0x4c,0x29,0xe8,
0x85,0x9e,0x85,0x9f,0x85,0xa0,0x85,0xa1,
0xa8,0x60,0xa0,0x00,0xa2,0x0a,0x94,0x99,
0xca,0x10,0xfb,0x90,0x0f,0xc9,0x2d,0xd0,
0x04,0x86,0xa3,0xf0,0x04,0xc9,0x2b,0xd0,
0x05,0x20,0xb1,0x00,0x90,0x5b,0xc9,0x2e,
0xf0,0x2e,0xc9,0x45,0xd0,0x30,0x20,0xb1,
0x00,0x90,0x17,0xc9,0xc9,0xf0,0x0e,0xc9,
0x2d,0xf0,0x0a,0xc9,0xc8,0xf0,0x08,0xc9,
0x2b,0xf0,0x04,0xd0,0x07,0x66,0x9c,0x20,
0xb1,0x00,0x90,0x5c,0x24,0x9c,0x10,0x0e,
0xa9,0x00,0x38,0xe5,0x9a,0x4c,0xa0,0xec,
0x66,0x9b,0x24,0x9b,0x50,0xc3,0xa5,0x9a,
0x38,0xe5,0x99,0x85,0x9a,0xf0,0x12,0x10,
0x09,0x20,0x55,0xea,0xe6,0x9a,0xd0,0xf9,
0xf0,0x07,0x20,0x39,0xea,0xc6,0x9a,0xd0,
0xf9,0xa5,0xa3,0x30,0x01,0x60,0x4c,0xd0,
0xee,0x48,0x24,0x9b,0x10,0x02,0xe6,0x99,
0x20,0x39,0xea,0x68,0x38,0xe9,0x30,0x20,
0xd5,0xec,0x4c,0x61,0xec,0x48,0x20,0x63,
0xeb,0x68,0x20,0x93,0xeb,0xa5,0xaa,0x45,
0xa2,0x85,0xab,0xa6,0x9d,0x4c,0xc1,0xe7,
0xa5,0x9a,0xc9,0x0a,0x90,0x09,0xa9,0x64,
0x24,0x9c,0x30,0x11,0x4c,0xd5,0xe8,0x0a,
0x0a,0x18,0x65,0x9a,0x0a,0x18,0xa0,0x00,
0x71,0xb8,0x38,0xe9,0x30,0x85,0x9a,0x4c,
0x87,0xec,0x9b,0x3e,0xbc,0x1f,0xfd,0x9e,
0x6e,0x6b,0x27,0xfd,0x9e,0x6e,0x6b,0x28,
0x00,0xa9,0x58,0xa0,0xd3,0x20,0x31,0xed,
0xa5,0x76,0xa6,0x75,0x85,0x9e,0x86,0x9f,
0xa2,0x90,0x38,0x20,0xa0,0xeb,0x20,0x34,
0xed,0x4c,0x3a,0xdb,0xa0,0x01,0xa9,0x2d,
0x88,0x24,0xa2,0x10,0x04,0xc8,0x99,0xff,
0x00,0x85,0xa2,0x84,0xad,0xc8,0xa9,0x30,
0xa6,0x9d,0xd0,0x03,0x4c,0x57,0xee,0xa9,
0x00,0xe0,0x80,0xf0,0x02,0xb0,0x09,0xa9,
0x14,0xa0,0xed,0x20,0x7f,0xe9,0xa9,0xf7,
0x85,0x99,0xa9,0x0f,0xa0,0xed,0x20,0xb2,
0xeb,0xf0,0x1e,0x10,0x12,0xa9,0x0a,0xa0,
0xed,0x20,0xb2,0xeb,0xf0,0x02,0x10,0x0e,
0x20,0x39,0xea,0xc6,0x99,0xd0,0xee,0x20,
0x55,0xea,0xe6,0x99,0xd0,0xdc,0x20,0xa0,
0xe7,0x20,0xf2,0xeb,0xa2,0x01,0xa5,0x99,
0x18,0x69,0x0a,0x30,0x09,0xc9,0x0b,0xb0,
0x06,0x69,0xff,0xaa,0xa9,0x02,0x38,0xe9,
0x02,0x85,0x9a,0x86,0x99,0x8a,0xf0,0x02,
0x10,0x13,0xa4,0xad,0xa9,0x2e,0xc8,0x99,
0xff,0x00,0x8a,0xf0,0x06,0xa9,0x30,0xc8,
0x99,0xff,0x00,0x84,0xad,0xa0,0x00,0xa2,
0x80,0xa5,0xa1,0x18,0x79,0x6c,0xee,0x85,
0xa1,0xa5,0xa0,0x79,0x6b,0xee,0x85,0xa0,
0xa5,0x9f,0x79,0x6a,0xee,0x85,0x9f,0xa5,
0x9e,0x79,0x69,0xee,0x85,0x9e,0xe8,0xb0,
0x04,0x10,0xde,0x30,0x02,0x30,0xda,0x8a,
0x90,0x04,0x49,0xff,0x69,0x0a,0x69,0x2f,
0xc8,0xc8,0xc8,0xc8,0x84,0x83,0xa4,0xad,
0xc8,0xaa,0x29,0x7f,0x99,0xff,0x00,0xc6,
0x99,0xd0,0x06,0xa9,0x2e,0xc8,0x99,0xff,
0x00,0x84,0xad,0xa4,0x83,0x8a,0x49,0xff,
0x29,0x80,0xaa,0xc0,0x24,0xd0,0xaa,0xa4,
0xad,0xb9,0xff,0x00,0x88,0xc9,0x30,0xf0,
0xf8,0xc9,0x2e,0xf0,0x01,0xc8,0xa9,0x2b,
0xa6,0x9a,0xf0,0x2e,0x10,0x08,0xa9,0x00,
0x38,0xe5,0x9a,0xaa,0xa9,0x2d,0x99,0x01,
0x01,0xa9,0x45,0x99,0x00,0x01,0x8a,0xa2,
0x2f,0x38,0xe8,0xe9,0x0a,0xb0,0xfb,0x69,
0x3a,0x99,0x03,0x01,0x8a,0x99,0x02,0x01,
0xa9,0x00,0x99,0x04,0x01,0xf0,0x08,0x99,
0xff,0x00,0xa9,0x00,0x99,0x00,0x01,0xa9,
0x00,0xa0,0x01,0x60,0x80,0x00,0x00,0x00,
0x00,0xfa,0x0a,0x1f,0x00,0x00,0x98,0x96,
0x80,0xff,0xf0,0xbd,0xc0,0x00,0x01,0x86,
0xa0,0xff,0xff,0xd8,0xf0,0x00,0x00,0x03,
0xe8,0xff,0xff,0xff,0x9c,0x00,0x00,0x00,
0x0a,0xff,0xff,0xff,0xff,0x20,0x63,0xeb,
0xa9,0x64,0xa0,0xee,0x20,0xf9,0xea,0xf0,
0x70,0xa5,0xa5,0xd0,0x03,0x4c,0x50,0xe8,
0xa2,0x8a,0xa0,0x00,0x20,0x2b,0xeb,0xa5,
0xaa,0x10,0x0f,0x20,0x23,0xec,0xa9,0x8a,
0xa0,0x00,0x20,0xb2,0xeb,0xd0,0x03,0x98,
0xa4,0x0d,0x20,0x55,0xeb,0x98,0x48,0x20,
0x41,0xe9,0xa9,0x8a,0xa0,0x00,0x20,0x7f,
0xe9,0x20,0x09,0xef,0x68,0x4a,0x90,0x0a,
0xa5,0x9d,0xf0,0x06,0xa5,0xa2,0x49,0xff,
0x85,0xa2,0x60,0x81,0x38,0xaa,0x3b,0x29,
0x07,0x71,0x34,0x58,0x3e,0x56,0x74,0x16,
0x7e,0xb3,0x1b,0x77,0x2f,0xee,0xe3,0x85,
0x7a,0x1d,0x84,0x1c,0x2a,0x7c,0x63,0x59,
0x58,0x0a,0x7e,0x75,0xfd,0xe7,0xc6,0x80,
0x31,0x72,0x18,0x10,0x81,0x00,0x00,0x00,
0x00,0xa9,0xdb,0xa0,0xee,0x20,0x7f,0xe9,
0xa5,0xac,0x69,0x50,0x90,0x03,0x20,0x7a,
0xeb,0x85,0x92,0x20,0x66,0xeb,0xa5,0x9d,
0xc9,0x88,0x90,0x03,0x20,0x2b,0xea,0x20,
0x23,0xec,0xa5,0x0d,0x18,0x69,0x81,0xf0,
0xf3,0x38,0xe9,0x01,0x48,0xa2,0x05,0xb5,
0xa5,0xb4,0x9d,0x95,0x9d,0x94,0xa5,0xca,
0x10,0xf5,0xa5,0x92,0x85,0xac,0x20,0xaa,
0xe7,0x20,0xd0,0xee,0xa9,0xe0,0xa0,0xee,
0x20,0x72,0xef,0xa9,0x00,0x85,0xab,0x68,
0x20,0x10,0xea,0x60,0x85,0xad,0x84,0xae,
0x20,0x21,0xeb,0xa9,0x93,0x20,0x7f,0xe9,
0x20,0x76,0xef,0xa9,0x93,0xa0,0x00,0x4c,
0x7f,0xe9,0x85,0xad,0x84,0xae,0x20,0x1e,
0xeb,0xb1,0xad,0x85,0xa3,0xa4,0xad,0xc8,
0x98,0xd0,0x02,0xe6,0xae,0x85,0xad,0xa4,
0xae,0x20,0x7f,0xe9,0xa5,0xad,0xa4,0xae,
0x18,0x69,0x05,0x90,0x01,0xc8,0x85,0xad,
0x84,0xae,0x20,0xbe,0xe7,0xa9,0x98,0xa0,
0x00,0xc6,0xa3,0xd0,0xe4,0x60,0x98,0x35,
0x44,0x7a,0x68,0x28,0xb1,0x46,0x20,0x82,
0xeb,0xaa,0x30,0x18,0xa9,0xc9,0xa0,0x00,
0x20,0xf9,0xea,0x8a,0xf0,0xe7,0xa9,0xa6,
0xa0,0xef,0x20,0x7f,0xe9,0xa9,0xaa,0xa0,
0xef,0x20,0xbe,0xe7,0xa6,0xa1,0xa5,0x9e,
0x85,0xa1,0x86,0x9e,0xa9,0x00,0x85,0xa2,
0xa5,0x9d,0x85,0xac,0xa9,0x80,0x85,0x9d,
0x20,0x2e,0xe8,0xa2,0xc9,0xa0,0x00,0x4c,
0x2b,0xeb,0xa9,0x66,0xa0,0xf0,0x20,0xbe,
0xe7,0x20,0x63,0xeb,0xa9,0x6b,0xa0,0xf0,
0xa6,0xaa,0x20,0x5e,0xea,0x20,0x63,0xeb,
0x20,0x23,0xec,0xa9,0x00,0x85,0xab,0x20,
0xaa,0xe7,0xa9,0x70,0xa0,0xf0,0x20,0xa7,
0xe7,0xa5,0xa2,0x48,0x10,0x0d,0x20,0xa0,
0xe7,0xa5,0xa2,0x30,0x09,0xa5,0x16,0x49,
0xff,0x85,0x16,0x20,0xd0,0xee,0xa9,0x70,
0xa0,0xf0,0x20,0xbe,0xe7,0x68,0x10,0x03,
0x20,0xd0,0xee,0xa9,0x75,0xa0,0xf0,0x4c,
0x5c,0xef,0x20,0x21,0xeb,0xa9,0x00,0x85,
0x16,0x20,0xf1,0xef,0xa2,0x8a,0xa0,0x00,
0x20,0xe7,0xef,0xa9,0x93,0xa0,0x00,0x20,
0xf9,0xea,0xa9,0x00,0x85,0xa2,0xa5,0x16,
0x20,0x62,0xf0,0xa9,0x8a,0xa0,0x00,0x4c,
0x66,0xea,0x48,0x4c,0x23,0xf0,0x81,0x49,
0x0f,0xda,0xa2,0x83,0x49,0x0f,0xda,0xa2,
0x7f,0x00,0x00,0x00,0x00,0x05,0x84,0xe6,
0x1a,0x2d,0x1b,0x86,0x28,0x07,0xfb,0xf8,
0x87,0x99,0x68,0x89,0x01,0x87,0x23,0x35,
0xdf,0xe1,0x86,0xa5,0x5d,0xe7,0x28,0x83,
0x49,0x0f,0xda,0xa2,0xa6,0xd3,0xc1,0xc8,
0xd4,0xc8,0xd5,0xc4,0xce,0xca,0xa5,0xa2,
0x48,0x10,0x03,0x20,0xd0,0xee,0xa5,0x9d,
0x48,0xc9,0x81,0x90,0x07,0xa9,0x13,0xa0,
0xe9,0x20,0x66,0xea,0xa9,0xce,0xa0,0xf0,
0x20,0x5c,0xef,0x68,0xc9,0x81,0x90,0x07,
0xa9,0x66,0xa0,0xf0,0x20,0xa7,0xe7,0x68,
0x10,0x03,0x4c,0xd0,0xee,0x60,0x0b,0x76,
0xb3,0x83,0xbd,0xd3,0x79,0x1e,0xf4,0xa6,
0xf5,0x7b,0x83,0xfc,0xb0,0x10,0x7c,0x0c,
0x1f,0x67,0xca,0x7c,0xde,0x53,0xcb,0xc1,
0x7d,0x14,0x64,0x70,0x4c,0x7d,0xb7,0xea,
0x51,0x7a,0x7d,0x63,0x30,0x88,0x7e,0x7e,
0x92,0x44,0x99,0x3a,0x7e,0x4c,0xcc,0x91,
0xc7,0x7f,0xaa,0xaa,0xaa,0x13,0x81,0x00,
0x00,0x00,0x00,0xe6,0xb8,0xd0,0x02,0xe6,
0xb9,0xad,0x60,0xea,0xc9,0x3a,0xb0,0x0a,
0xc9,0x20,0xf0,0xef,0x38,0xe9,0x30,0x38,
0xe9,0xd0,0x60,0x80,0x4f,0xc7,0x52,0x58,
0xa2,0xff,0x86,0x76,0xa2,0xfb,0x9a,0xa9,
0x28,0xa0,0xf1,0x85,0x01,0x84,0x02,0x85,
0x04,0x84,0x05,0x20,0x73,0xf2,0xa9,0x4c,
0x85,0x00,0x85,0x03,0x85,0x90,0x85,0x0a,
0xa9,0x99,0xa0,0xe1,0x85,0x0b,0x84,0x0c,
0xa2,0x1c,0xbd,0x0a,0xf1,0x95,0xb0,0x86,
0xf1,0xca,0xd0,0xf6,0x86,0xf2,0x8a,0x85,
0xa4,0x85,0x54,0x48,0xa9,0x03,0x85,0x8f,
0x20,0xfb,0xda,0xa9,0x01,0x8d,0xfd,0x01,
0x8d,0xfc,0x01,0xa2,0x55,0x86,0x52,0xa9,
0x00,0xa0,0x08,0x85,0x50,0x84,0x51,0xa0,
0x00,0xe6,0x51,0xb1,0x50,0x49,0xff,0x91,
0x50,0xd1,0x50,0xd0,0x08,0x49,0xff,0x91,
0x50,0xd1,0x50,0xf0,0xec,0xa4,0x50,0xa5,
0x51,0x29,0xf0,0x84,0x73,0x85,0x74,0x84,
0x6f,0x85,0x70,0xa2,0x00,0xa0,0x08,0x86,
0x67,0x84,0x68,0xa0,0x00,0x84,0xd6,0x98,
0x91,0x67,0xe6,0x67,0xd0,0x02,0xe6,0x68,
0xa5,0x67,0xa4,0x68,0x20,0xe3,0xd3,0x20,
0x4b,0xd6,0xa9,0x3a,0xa0,0xdb,0x85,0x04,
0x84,0x05,0xa9,0x3c,0xa0,0xd4,0x85,0x01,
0x84,0x02,0x6c,0x01,0x00,0x20,0x67,0xdd,
0x20,0x52,0xe7,0x6c,0x50,0x00,0x20,0xf8,
0xe6,0x8a,0x4c,0x8b,0xfe,0x20,0xf8,0xe6,
0x8a,0x4c,0x95,0xfe,0x20,0xf8,0xe6,0xe0,
0x30,0xb0,0x13,0x86,0xf0,0xa9,0x2c,0x20,
0xc0,0xde,0x20,0xf8,0xe6,0xe0,0x30,0xb0,
0x05,0x86,0x2c,0x86,0x2d,0x60,0x4c,0x99,
0xe1,0x20,0xec,0xf1,0xe4,0xf0,0xb0,0x08,
0xa5,0xf0,0x85,0x2c,0x85,0x2d,0x86,0xf0,
0xa9,0xc5,0x20,0xc0,0xde,0x20,0xf8,0xe6,
0xe0,0x30,0xb0,0xe2,0x60,0x20,0xec,0xf1,
0x8a,0xa4,0xf0,0xc0,0x28,0xb0,0xd7,0x4c,
0x00,0xf8,0x20,0x09,0xf2,0x8a,0xa4,0x2c,
0xc0,0x28,0xb0,0xca,0xa4,0xf0,0x4c,0x19,
0xf8,0x20,0x09,0xf2,0x8a,0xa8,0xc0,0x28,
0xb0,0xbc,0xa5,0xf0,0x4c,0x28,0xf8,0x20,
0xf8,0xe6,0x8a,0x4c,0x64,0xf8,0x20,0xf8,
0xe6,0xca,0x8a,0xc9,0x18,0xb0,0xa7,0x4c,
0x5b,0xfb,0x20,0xf8,0xe6,0x8a,0x49,0xff,
0xaa,0xe8,0x86,0xf1,0x60,0x38,0x90,0x18,
0x66,0xf2,0x60,0xa9,0xff,0xd0,0x02,0xa9,
0x3f,0xa2,0x00,0x85,0x32,0x86,0xf3,0x60,
0xa9,0x7f,0xa2,0x40,0xd0,0xf5,0x20,0x67,
0xdd,0x20,0x52,0xe7,0xa5,0x50,0xc5,0x6d,
0xa5,0x51,0xe5,0x6e,0xb0,0x03,0x4c,0x10,
0xd4,0xa5,0x50,0x85,0x73,0x85,0x6f,0xa5,
0x51,0x85,0x74,0x85,0x70,0x60,0x20,0x67,
0xdd,0x20,0x52,0xe7,0xa5,0x50,0xc5,0x73,
0xa5,0x51,0xe5,0x74,0xb0,0xe0,0xa5,0x50,
0xc5,0x69,0xa5,0x51,0xe5,0x6a,0x90,0xd6,
0xa5,0x50,0x85,0x69,0xa5,0x51,0x85,0x6a,
0x4c,0x6c,0xd6,0xa9,0xab,0x20,0xc0,0xde,
0xa5,0xb8,0x85,0xf4,0xa5,0xb9,0x85,0xf5,
0x38,0x66,0xd8,0xa5,0x75,0x85,0xf6,0xa5,
0x76,0x85,0xf7,0x20,0xa6,0xd9,0x4c,0x98,
0xd9,0x86,0xde,0xa6,0xf8,0x86,0xdf,0xa5,
0x75,0x85,0xda,0xa5,0x76,0x85,0xdb,0xa5,
0x79,0x85,0xdc,0xa5,0x7a,0x85,0xdd,0xa5,
0xf4,0x85,0xb8,0xa5,0xf5,0x85,0xb9,0xa5,
0xf6,0x85,0x75,0xa5,0xf7,0x85,0x76,0x20,
0xb7,0x00,0x20,0x3e,0xd9,0x4c,0xd2,0xd7,
0xa5,0xda,0x85,0x75,0xa5,0xdb,0x85,0x76,
0xa5,0xdc,0x85,0xb8,0xa5,0xdd,0x85,0xb9,
0xa6,0xdf,0x9a,0x4c,0xd2,0xd7,0x4c,0xc9,
0xde,0xb0,0xfb,0xa6,0xaf,0x86,0x69,0xa6,
0xb0,0x86,0x6a,0x20,0x0c,0xda,0x20,0x1a,
0xd6,0xa5,0x9b,0x85,0x60,0xa5,0x9c,0x85,
0x61,0xa9,0x2c,0x20,0xc0,0xde,0x20,0x0c,
0xda,0xe6,0x50,0xd0,0x02,0xe6,0x51,0x20,
0x1a,0xd6,0xa5,0x9b,0xc5,0x60,0xa5,0x9c,
0xe5,0x61,0xb0,0x01,0x60,0xa0,0x00,0xb1,
0x9b,0x91,0x60,0xe6,0x9b,0xd0,0x02,0xe6,
0x9c,0xe6,0x60,0xd0,0x02,0xe6,0x61,0xa5,
0x69,0xc5,0x9b,0xa5,0x6a,0xe5,0x9c,0xb0,
0xe6,0xa6,0x61,0xa4,0x60,0xd0,0x01,0xca,
0x88,0x86,0x6a,0x84,0x69,0x4c,0xf2,0xd4,
0xad,0x56,0xc0,0xad,0x53,0xc0,0x4c,0x40,
0xfb,0xad,0x54,0xc0,0x4c,0x39,0xfb,0x20,
0xd9,0xf7,0xa0,0x03,0xb1,0x9b,0xaa,0x88,
0xb1,0x9b,0xe9,0x01,0xb0,0x01,0xca,0x85,
0x50,0x86,0x51,0x20,0xcd,0xfe,0x20,0xbc,
0xf7,0x4c,0xcd,0xfe,0x20,0xd9,0xf7,0x20,
0xfd,0xfe,0xa0,0x02,0xb1,0x9b,0xc5,0x50,
0xc8,0xb1,0x9b,0xe5,0x51,0xb0,0x03,0x4c,
0x10,0xd4,0x20,0xbc,0xf7,0x4c,0xfd,0xfe,
0x2c,0x55,0xc0,0x2c,0x52,0xc0,0xa9,0x40,
0xd0,0x08,0xa9,0x20,0x2c,0x54,0xc0,0x2c,
0x53,0xc0,0x85,0xe6,0xad,0x57,0xc0,0xad,
0x50,0xc0,0xa9,0x00,0x85,0x1c,0xa5,0xe6,
0x85,0x1b,0xa0,0x00,0x84,0x1a,0xa5,0x1c,
0x91,0x1a,0x20,0x7e,0xf4,0xc8,0xd0,0xf6,
0xe6,0x1b,0xa5,0x1b,0x29,0x1f,0xd0,0xee,
0x60,0x85,0xe2,0x86,0xe0,0x84,0xe1,0x48,
0x29,0xc0,0x85,0x26,0x4a,0x4a,0x05,0x26,
0x85,0x26,0x68,0x85,0x27,0x0a,0x0a,0x0a,
0x26,0x27,0x0a,0x26,0x27,0x0a,0x66,0x26,
0xa5,0x27,0x29,0x1f,0x05,0xe6,0x85,0x27,
0x8a,0xc0,0x00,0xf0,0x05,0xa0,0x23,0x69,
0x04,0xc8,0xe9,0x07,0xb0,0xfb,0x84,0xe5,
0xaa,0xbd,0xb9,0xf4,0x85,0x30,0x98,0x4a,
0xa5,0xe4,0x85,0x1c,0xb0,0x28,0x60,0x20,
0x11,0xf4,0xa5,0x1c,0x51,0x26,0x25,0x30,
0x51,0x26,0x91,0x26,0x60,0x10,0x23,0xa5,
0x30,0x4a,0xb0,0x05,0x49,0xc0,0x85,0x30,
0x60,0x88,0x10,0x02,0xa0,0x27,0xa9,0xc0,
0x85,0x30,0x84,0xe5,0xa5,0x1c,0x0a,0xc9,
0xc0,0x10,0x06,0xa5,0x1c,0x49,0x7f,0x85,
0x1c,0x60,0xa5,0x30,0x0a,0x49,0x80,0x30,
0xdd,0xa9,0x81,0xc8,0xc0,0x28,0x90,0xe0,
0xa0,0x00,0xb0,0xdc,0x18,0xa5,0xd1,0x29,
0x04,0xf0,0x25,0xa9,0x7f,0x25,0x30,0x31,
0x26,0xd0,0x19,0xe6,0xea,0xa9,0x7f,0x25,
0x30,0x10,0x11,0x18,0xa5,0xd1,0x29,0x04,
0xf0,0x0e,0xb1,0x26,0x45,0x1c,0x25,0x30,
0xd0,0x02,0xe6,0xea,0x51,0x26,0x91,0x26,
0xa5,0xd1,0x65,0xd3,0x29,0x03,0xc9,0x02,
0x6a,0xb0,0x92,0x30,0x30,0x18,0xa5,0x27,
0x2c,0xb9,0xf5,0xd0,0x22,0x06,0x26,0xb0,
0x1a,0x2c,0xcd,0xf4,0xf0,0x05,0x69,0x1f,
0x38,0xb0,0x12,0x69,0x23,0x48,0xa5,0x26,
0x69,0xb0,0xb0,0x02,0x69,0xf0,0x85,0x26,
0x68,0xb0,0x02,0x69,0x1f,0x66,0x26,0x69,
0xfc,0x85,0x27,0x60,0x18,0xa5,0x27,0x69,
0x04,0x2c,0xb9,0xf5,0xd0,0xf3,0x06,0x26,
0x90,0x18,0x69,0xe0,0x18,0x2c,0x08,0xf5,
0xf0,0x12,0xa5,0x26,0x69,0x50,0x49,0xf0,
0xf0,0x02,0x49,0xf0,0x85,0x26,0xa5,0xe6,
0x90,0x02,0x69,0xe0,0x66,0x26,0x90,0xd1,
0x48,0xa9,0x00,0x85,0xe0,0x85,0xe1,0x85,
0xe2,0x68,0x48,0x38,0xe5,0xe0,0x48,0x8a,
0xe5,0xe1,0x85,0xd3,0xb0,0x0a,0x68,0x49,
0xff,0x69,0x01,0x48,0xa9,0x00,0xe5,0xd3,
0x85,0xd1,0x85,0xd5,0x68,0x85,0xd0,0x85,
0xd4,0x68,0x85,0xe0,0x86,0xe1,0x98,0x18,
0xe5,0xe2,0x90,0x04,0x49,0xff,0x69,0xfe,
0x85,0xd2,0x84,0xe2,0x66,0xd3,0x38,0xe5,
0xd0,0xaa,0xa9,0xff,0xe5,0xd1,0x85,0x1d,
0xa4,0xe5,0xb0,0x05,0x0a,0x20,0x65,0xf4,
0x38,0xa5,0xd4,0x65,0xd2,0x85,0xd4,0xa5,
0xd5,0xe9,0x00,0x85,0xd5,0xb1,0x26,0x45,
0x1c,0x25,0x30,0x51,0x26,0x91,0x26,0xe8,
0xd0,0x04,0xe6,0x1d,0xf0,0x62,0xa5,0xd3,
0xb0,0xda,0x20,0xd3,0xf4,0x18,0xa5,0xd4,
0x65,0xd0,0x85,0xd4,0xa5,0xd5,0x65,0xd1,
0x50,0xd9,0x81,0x82,0x84,0x88,0x90,0xa0,
0xc0,0x1c,0xff,0xfe,0xfa,0xf4,0xec,0xe1,
0xd4,0xc5,0xb4,0xa1,0x8d,0x78,0x61,0x49,
0x31,0x18,0xff,0xa5,0x26,0x0a,0xa5,0x27,
0x29,0x03,0x2a,0x05,0x26,0x0a,0x0a,0x0a,
0x85,0xe2,0xa5,0x27,0x4a,0x4a,0x29,0x07,
0x05,0xe2,0x85,0xe2,0xa5,0xe5,0x0a,0x65,
0xe5,0x0a,0xaa,0xca,0xa5,0x30,0x29,0x7f,
0xe8,0x4a,0xd0,0xfc,0x85,0xe1,0x8a,0x18,
0x65,0xe5,0x90,0x02,0xe6,0xe1,0x85,0xe0,
0x60,0x86,0x1a,0x84,0x1b,0xaa,0x4a,0x4a,
0x4a,0x4a,0x85,0xd3,0x8a,0x29,0x0f,0xaa,
0xbc,0xba,0xf5,0x84,0xd0,0x49,0x0f,0xaa,
0xbc,0xbb,0xf5,0xc8,0x84,0xd2,0xa4,0xe5,
0xa2,0x00,0x86,0xea,0xa1,0x1a,0x85,0xd1,
0xa2,0x80,0x86,0xd4,0x86,0xd5,0xa6,0xe7,
0xa5,0xd4,0x38,0x65,0xd0,0x85,0xd4,0x90,
0x04,0x20,0xb3,0xf4,0x18,0xa5,0xd5,0x65,
0xd2,0x85,0xd5,0x90,0x03,0x20,0xb4,0xf4,
0xca,0xd0,0xe5,0xa5,0xd1,0x4a,0x4a,0x4a,
0xd0,0xd4,0xe6,0x1a,0xd0,0x02,0xe6,0x1b,
0xa1,0x1a,0xd0,0xca,0x60,0x86,0x1a,0x84,
0x1b,0xaa,0x4a,0x4a,0x4a,0x4a,0x85,0xd3,
0x8a,0x29,0x0f,0xaa,0xbc,0xba,0xf5,0x84,
0xd0,0x49,0x0f,0xaa,0xbc,0xbb,0xf5,0xc8,
0x84,0xd2,0xa4,0xe5,0xa2,0x00,0x86,0xea,
0xa1,0x1a,0x85,0xd1,0xa2,0x80,0x86,0xd4,
0x86,0xd5,0xa6,0xe7,0xa5,0xd4,0x38,0x65,
0xd0,0x85,0xd4,0x90,0x04,0x20,0x9c,0xf4,
0x18,0xa5,0xd5,0x65,0xd2,0x85,0xd5,0x90,
0x03,0x20,0x9d,0xf4,0xca,0xd0,0xe5,0xa5,
0xd1,0x4a,0x4a,0x4a,0xd0,0xd4,0xe6,0x1a,
0xd0,0x02,0xe6,0x1b,0xa1,0x1a,0xd0,0xca,
0x60,0x20,0x67,0xdd,0x20,0x52,0xe7,0xa4,
0x51,0xa6,0x50,0xc0,0x01,0x90,0x06,0xd0,
0x1d,0xe0,0x18,0xb0,0x19,0x8a,0x48,0x98,
0x48,0xa9,0x2c,0x20,0xc0,0xde,0x20,0xf8,
0xe6,0xe0,0xc0,0xb0,0x09,0x86,0x9d,0x68,
0xa8,0x68,0xaa,0xa5,0x9d,0x60,0x4c,0x06,
0xf2,0x20,0xf8,0xe6,0xe0,0x08,0xb0,0xf6,
0xbd,0xf6,0xf6,0x85,0xe4,0x60,0x00,0x2a,
0x55,0x7f,0x80,0xaa,0xd5,0xff,0xc9,0xc1,
0xf0,0x0d,0x20,0xb9,0xf6,0x20,0x57,0xf4,
0x20,0xb7,0x00,0xc9,0xc1,0xd0,0xe6,0x20,
0xc0,0xde,0x20,0xb9,0xf6,0x84,0x9d,0xa8,
0x8a,0xa6,0x9d,0x20,0x3a,0xf5,0x4c,0x08,
0xf7,0x20,0xf8,0xe6,0x86,0xf9,0x60,0x20,
0xf8,0xe6,0x86,0xe7,0x60,0x20,0xf8,0xe6,
0xa5,0xe8,0x85,0x1a,0xa5,0xe9,0x85,0x1b,
0x8a,0xa2,0x00,0xc1,0x1a,0xf0,0x02,0xb0,
0xa5,0x0a,0x90,0x03,0xe6,0x1b,0x18,0xa8,
0xb1,0x1a,0x65,0x1a,0xaa,0xc8,0xb1,0x1a,
0x65,0xe9,0x85,0x1b,0x86,0x1a,0x20,0xb7,
0x00,0xc9,0xc5,0xd0,0x09,0x20,0xc0,0xde,
0x20,0xb9,0xf6,0x20,0x11,0xf4,0xa5,0xf9,
0x60,0x20,0x2d,0xf7,0x4c,0x05,0xf6,0x20,
0x2d,0xf7,0x4c,0x61,0xf6,0xa9,0x00,0x85,
0x3d,0x85,0x3f,0xa0,0x50,0x84,0x3c,0xc8,
0x84,0x3e,0x20,0xfd,0xfe,0x18,0xa5,0x73,
0xaa,0xca,0x86,0x3e,0xe5,0x50,0x48,0xa5,
0x74,0xa8,0xe8,0xd0,0x01,0x88,0x84,0x3f,
0xe5,0x51,0xc5,0x6e,0x90,0x02,0xd0,0x03,
0x4c,0x10,0xd4,0x85,0x74,0x85,0x70,0x85,
0x3d,0x85,0xe9,0x68,0x85,0xe8,0x85,0x73,
0x85,0x6f,0x85,0x3c,0x20,0xfa,0xfc,0xa9,
0x03,0x4c,0x02,0xff,0x18,0xa5,0x9b,0x65,
0x50,0x85,0x3e,0xa5,0x9c,0x65,0x51,0x85,
0x3f,0xa0,0x04,0xb1,0x9b,0x20,0xef,0xe0,
0xa5,0x94,0x85,0x3c,0xa5,0x95,0x85,0x3d,
0x60,0xa9,0x40,0x85,0x14,0x20,0xe3,0xdf,
0xa9,0x00,0x85,0x14,0x4c,0xf0,0xd8,0x20,
0xf8,0xe6,0xca,0x8a,0xc9,0x28,0x90,0x0a,
0xe9,0x28,0x48,0x20,0xfb,0xda,0x68,0x4c,
0xec,0xf7,0x85,0x24,0x60,0xcb,0xd2,0xd7,
0x4a,0x08,0x20,0x47,0xf8,0x28,0xa9,0x0f,
0x90,0x02,0x69,0xe0,0x85,0x2e,0xb1,0x26,
0x45,0x30,0x25,0x2e,0x51,0x26,0x91,0x26,
0x60,0x20,0x00,0xf8,0xc4,0x2c,0xb0,0x11,
0xc8,0x20,0x0e,0xf8,0x90,0xf6,0x69,0x01,
0x48,0x20,0x00,0xf8,0x68,0xc5,0x2d,0x90,
0xf5,0x60,0xa0,0x2f,0xd0,0x02,0xa0,0x27,
0x84,0x2d,0xa0,0x27,0xa9,0x00,0x85,0x30,
0x20,0x28,0xf8,0x88,0x10,0xf6,0x60,0x48,
0x4a,0x29,0x03,0x09,0x04,0x85,0x27,0x68,
0x29,0x18,0x90,0x02,0x69,0x7f,0x85,0x26,
0x0a,0x0a,0x05,0x26,0x85,0x26,0x60,0xa5,
0x30,0x18,0x69,0x03,0x29,0x0f,0x85,0x30,
0x0a,0x0a,0x0a,0x0a,0x05,0x30,0x85,0x30,
0x60,0x4a,0x08,0x20,0x47,0xf8,0xb1,0x26,
0x28,0x90,0x04,0x4a,0x4a,0x4a,0x4a,0x29,
0x0f,0x60,0xa6,0x3a,0xa4,0x3b,0x20,0x96,
0xfd,0x20,0x48,0xf9,0xa1,0x3a,0xa8,0x4a,
0x90,0x09,0x6a,0xb0,0x10,0xc9,0xa2,0xf0,
0x0c,0x29,0x87,0x4a,0xaa,0xbd,0x62,0xf9,
0x20,0x79,0xf8,0xd0,0x04,0xa0,0x80,0xa9,
0x00,0xaa,0xbd,0xa6,0xf9,0x85,0x2e,0x29,
0x03,0x85,0x2f,0x98,0x29,0x8f,0xaa,0x98,
0xa0,0x03,0xe0,0x8a,0xf0,0x0b,0x4a,0x90,
0x08,0x4a,0x4a,0x09,0x20,0x88,0xd0,0xfa,
0xc8,0x88,0xd0,0xf2,0x60,0xff,0xff,0xff,
0x20,0x82,0xf8,0x48,0xb1,0x3a,0x20,0xda,
0xfd,0xa2,0x01,0x20,0x4a,0xf9,0xc4,0x2f,
0xc8,0x90,0xf1,0xa2,0x03,0xc0,0x04,0x90,
0xf2,0x68,0xa8,0xb9,0xc0,0xf9,0x85,0x2c,
0xb9,0x00,0xfa,0x85,0x2d,0xa9,0x00,0xa0,
0x05,0x06,0x2d,0x26,0x2c,0x2a,0x88,0xd0,
0xf8,0x69,0xbf,0x20,0xed,0xfd,0xca,0xd0,
0xec,0x20,0x48,0xf9,0xa4,0x2f,0xa2,0x06,
0xe0,0x03,0xf0,0x1c,0x06,0x2e,0x90,0x0e,
0xbd,0xb3,0xf9,0x20,0xed,0xfd,0xbd,0xb9,
0xf9,0xf0,0x03,0x20,0xed,0xfd,0xca,0xd0,
0xe7,0x60,0x88,0x30,0xe7,0x20,0xda,0xfd,
0xa5,0x2e,0xc9,0xe8,0xb1,0x3a,0x90,0xf2,
0x20,0x56,0xf9,0xaa,0xe8,0xd0,0x01,0xc8,
0x98,0x20,0xda,0xfd,0x8a,0x4c,0xda,0xfd,
0xa2,0x03,0xa9,0xa0,0x20,0xed,0xfd,0xca,
0xd0,0xf8,0x60,0x38,0xa5,0x2f,0xa4,0x3b,
0xaa,0x10,0x01,0x88,0x65,0x3a,0x90,0x01,
0xc8,0x60,0x04,0x20,0x54,0x30,0x0d,0x80,
0x04,0x90,0x03,0x22,0x54,0x33,0x0d,0x80,
0x04,0x90,0x04,0x20,0x54,0x33,0x0d,0x80,
0x04,0x90,0x04,0x20,0x54,0x3b,0x0d,0x80,
0x04,0x90,0x00,0x22,0x44,0x33,0x0d,0xc8,
0x44,0x00,0x11,0x22,0x44,0x33,0x0d,0xc8,
0x44,0xa9,0x01,0x22,0x44,0x33,0x0d,0x80,
0x04,0x90,0x01,0x22,0x44,0x33,0x0d,0x80,
0x04,0x90,0x26,0x31,0x87,0x9a,0x00,0x21,
0x81,0x82,0x00,0x00,0x59,0x4d,0x91,0x92,
0x86,0x4a,0x85,0x9d,0xac,0xa9,0xac,0xa3,
0xa8,0xa4,0xd9,0x00,0xd8,0xa4,0xa4,0x00,
0x1c,0x8a,0x1c,0x23,0x5d,0x8b,0x1b,0xa1,
0x9d,0x8a,0x1d,0x23,0x9d,0x8b,0x1d,0xa1,
0x00,0x29,0x19,0xae,0x69,0xa8,0x19,0x23,
0x24,0x53,0x1b,0x23,0x24,0x53,0x19,0xa1,
0x00,0x1a,0x5b,0x5b,0xa5,0x69,0x24,0x24,
0xae,0xae,0xa8,0xad,0x29,0x00,0x7c,0x00,
0x15,0x9c,0x6d,0x9c,0xa5,0x69,0x29,0x53,
0x84,0x13,0x34,0x11,0xa5,0x69,0x23,0xa0,
0xd8,0x62,0x5a,0x48,0x26,0x62,0x94,0x88,
0x54,0x44,0xc8,0x54,0x68,0x44,0xe8,0x94,
0x00,0xb4,0x08,0x84,0x74,0xb4,0x28,0x6e,
0x74,0xf4,0xcc,0x4a,0x72,0xf2,0xa4,0x8a,
0x00,0xaa,0xa2,0xa2,0x74,0x74,0x74,0x72,
0x44,0x68,0xb2,0x32,0xb2,0x00,0x22,0x00,
0x1a,0x1a,0x26,0x26,0x72,0x72,0x88,0xc8,
0xc4,0xca,0x26,0x48,0x44,0x44,0xa2,0xc8,
0x85,0x45,0x68,0x48,0x0a,0x0a,0x0a,0x30,
0x03,0x6c,0xfe,0x03,0x28,0x20,0x4c,0xff,
0x68,0x85,0x3a,0x68,0x85,0x3b,0x6c,0xf0,
0x03,0x20,0x82,0xf8,0x20,0xda,0xfa,0x4c,
0x65,0xff,0xd8,0x20,0x84,0xfe,0x20,0x2f,
0xfb,0x20,0x93,0xfe,0x20,0x89,0xfe,0xad,
0x58,0xc0,0xad,0x5a,0xc0,0xad,0x5d,0xc0,
0xad,0x5f,0xc0,0xad,0xff,0xcf,0x2c,0x10,
0xc0,0xd8,0x20,0x3a,0xff,0xad,0xf3,0x03,
0x49,0xa5,0xcd,0xf4,0x03,0xd0,0x17,0xad,
0xf2,0x03,0xd0,0x0f,0xa9,0xe0,0xcd,0xf3,
0x03,0xd0,0x08,0xa0,0x03,0x8c,0xf2,0x03,
0x4c,0x00,0xe0,0x6c,0xf2,0x03,0x20,0x60,
0xfb,0xa2,0x05,0xbd,0xfc,0xfa,0x9d,0xef,
0x03,0xca,0xd0,0xf7,0xa9,0xc8,0x86,0x00,
0x85,0x01,0xa0,0x07,0xc6,0x01,0xa5,0x01,
0xc9,0xc0,0xf0,0xd7,0x8d,0xf8,0x07,0xb1,
0x00,0xd9,0x01,0xfb,0xd0,0xec,0x88,0x88,
0x10,0xf5,0x6c,0x00,0x00,0xea,0xea,0x20,
0x8e,0xfd,0xa9,0x45,0x85,0x40,0xa9,0x00,
0x85,0x41,0xa2,0xfb,0xa9,0xa0,0x20,0xed,
0xfd,0xbd,0x1e,0xfa,0x20,0xed,0xfd,0xa9,
0xbd,0x20,0xed,0xfd,0xb5,0x4a,0x20,0xda,
0xfd,0xe8,0x30,0xe8,0x60,0x59,0xfa,0x00,
0xe0,0x45,0x20,0xff,0x00,0xff,0x03,0xff,
0x3c,0xc1,0xd0,0xd0,0xcc,0xc5,0xa0,0xdd,
0xdb,0xc4,0xc2,0xc1,0xff,0xc3,0xff,0xff,
0xff,0xc1,0xd8,0xd9,0xd0,0xd3,0xad,0x70,
0xc0,0xa0,0x00,0xea,0xea,0xbd,0x64,0xc0,
0x10,0x04,0xc8,0xd0,0xf8,0x88,0x60,0xa9,
0x00,0x85,0x48,0xad,0x56,0xc0,0xad,0x54,
0xc0,0xad,0x51,0xc0,0xa9,0x00,0xf0,0x0b,
0xad,0x50,0xc0,0xad,0x53,0xc0,0x20,0x36,
0xf8,0xa9,0x14,0x85,0x22,0xa9,0x00,0x85,
0x20,0xa9,0x28,0x85,0x21,0xa9,0x18,0x85,
0x23,0xa9,0x17,0x85,0x25,0x4c,0x22,0xfc,
0x20,0x58,0xfc,0xa0,0x08,0xb9,0x08,0xfb,
0x99,0x0e,0x04,0x88,0xd0,0xf7,0x60,0xad,
0xf3,0x03,0x49,0xa5,0x8d,0xf4,0x03,0x60,
0xc9,0x8d,0xd0,0x18,0xac,0x00,0xc0,0x10,
0x13,0xc0,0x93,0xd0,0x0f,0x2c,0x10,0xc0,
0xac,0x00,0xc0,0x10,0xfb,0xc0,0x83,0xf0,
0x03,0x2c,0x10,0xc0,0x4c,0xfd,0xfb,0x38,
0x4c,0x2c,0xfc,0xa8,0xb9,0x48,0xfa,0x20,
0x97,0xfb,0x20,0x0c,0xfd,0xc9,0xce,0xb0,
0xee,0xc9,0xc9,0x90,0xea,0xc9,0xcc,0xf0,
0xe6,0xd0,0xe8,0xea,0xea,0xea,0xea,0xea,
0xea,0xea,0xea,0xea,0xea,0xea,0xea,0xea,
0xea,0x48,0x4a,0x29,0x03,0x09,0x04,0x85,
0x29,0x68,0x29,0x18,0x90,0x02,0x69,0x7f,
0x85,0x28,0x0a,0x0a,0x05,0x28,0x85,0x28,
0x60,0xc9,0x87,0xd0,0x12,0xa9,0x40,0x20,
0xa8,0xfc,0xa0,0xc0,0xa9,0x0c,0x20,0xa8,
0xfc,0xad,0x30,0xc0,0x88,0xd0,0xf5,0x60,
0xa4,0x24,0x91,0x28,0xe6,0x24,0xa5,0x24,
0xc5,0x21,0xb0,0x66,0x60,0xc9,0xa0,0xb0,
0xef,0xa8,0x10,0xec,0xc9,0x8d,0xf0,0x5a,
0xc9,0x8a,0xf0,0x5a,0xc9,0x88,0xd0,0xc9,
0xc6,0x24,0x10,0xe8,0xa5,0x21,0x85,0x24,
0xc6,0x24,0xa5,0x22,0xc5,0x25,0xb0,0x0b,
0xc6,0x25,0xa5,0x25,0x20,0xc1,0xfb,0x65,
0x20,0x85,0x28,0x60,0x49,0xc0,0xf0,0x28,
0x69,0xfd,0x90,0xc0,0xf0,0xda,0x69,0xfd,
0x90,0x2c,0xf0,0xde,0x69,0xfd,0x90,0x5c,
0xd0,0xe9,0xa4,0x24,0xa5,0x25,0x48,0x20,
0x24,0xfc,0x20,0x9e,0xfc,0xa0,0x00,0x68,
0x69,0x00,0xc5,0x23,0x90,0xf0,0xb0,0xca,
0xa5,0x22,0x85,0x25,0xa0,0x00,0x84,0x24,
0xf0,0xe4,0xa9,0x00,0x85,0x24,0xe6,0x25,
0xa5,0x25,0xc5,0x23,0x90,0xb6,0xc6,0x25,
0xa5,0x22,0x48,0x20,0x24,0xfc,0xa5,0x28,
0x85,0x2a,0xa5,0x29,0x85,0x2b,0xa4,0x21,
0x88,0x68,0x69,0x01,0xc5,0x23,0xb0,0x0d,
0x48,0x20,0x24,0xfc,0xb1,0x28,0x91,0x2a,
0x88,0x10,0xf9,0x30,0xe1,0xa0,0x00,0x20,
0x9e,0xfc,0xb0,0x86,0xa4,0x24,0xa9,0xa0,
0x91,0x28,0xc8,0xc4,0x21,0x90,0xf9,0x60,
0x38,0x48,0xe9,0x01,0xd0,0xfc,0x68,0xe9,
0x01,0xd0,0xf6,0x60,0xe6,0x42,0xd0,0x02,
0xe6,0x43,0xa5,0x3c,0xc5,0x3e,0xa5,0x3d,
0xe5,0x3f,0xe6,0x3c,0xd0,0x02,0xe6,0x3d,
0x60,0xa0,0x4b,0x20,0xdb,0xfc,0xd0,0xf9,
0x69,0xfe,0xb0,0xf5,0xa0,0x21,0x20,0xdb,
0xfc,0xc8,0xc8,0x88,0xd0,0xfd,0x90,0x05,
0xa0,0x32,0x88,0xd0,0xfd,0xac,0x20,0xc0,
0xa0,0x2c,0xca,0x60,0xa2,0x08,0x48,0x20,
0xfa,0xfc,0x68,0x2a,0xa0,0x3a,0xca,0xd0,
0xf5,0x60,0x20,0xfd,0xfc,0x88,0xad,0x60,
0xc0,0x45,0x2f,0x10,0xf8,0x45,0x2f,0x85,
0x2f,0xc0,0x80,0x60,0xa4,0x24,0xb1,0x28,
0x48,0x29,0x3f,0x09,0x40,0x91,0x28,0x68,
0x6c,0x38,0x00,0xe6,0x4e,0xd0,0x02,0xe6,
0x4f,0x2c,0x00,0xc0,0x10,0xf5,0x91,0x28,
0xad,0x00,0xc0,0x2c,0x10,0xc0,0x60,0x20,
0x0c,0xfd,0x20,0xa5,0xfb,0x20,0x0c,0xfd,
0xc9,0x9b,0xf0,0xf3,0x60,0xa5,0x32,0x48,
0xa9,0xff,0x85,0x32,0xbd,0x00,0x02,0x20,
0xed,0xfd,0x68,0x85,0x32,0xbd,0x00,0x02,
0xc9,0x88,0xf0,0x1d,0xc9,0x98,0xf0,0x0a,
0xe0,0xf8,0x90,0x03,0x20,0x3a,0xff,0xe8,
0xd0,0x13,0xa9,0xdc,0x20,0xed,0xfd,0x20,
0x8e,0xfd,0xa5,0x33,0x20,0xed,0xfd,0xa2,
0x01,0x8a,0xf0,0xf3,0xca,0x20,0x35,0xfd,
0xc9,0x95,0xd0,0x02,0xb1,0x28,0xc9,0xe0,
0x90,0x02,0x29,0xdf,0x9d,0x00,0x02,0xc9,
0x8d,0xd0,0xb2,0x20,0x9c,0xfc,0xa9,0x8d,
0xd0,0x5b,0xa4,0x3d,0xa6,0x3c,0x20,0x8e,
0xfd,0x20,0x40,0xf9,0xa0,0x00,0xa9,0xad,
0x4c,0xed,0xfd,0xa5,0x3c,0x09,0x07,0x85,
0x3e,0xa5,0x3d,0x85,0x3f,0xa5,0x3c,0x29,
0x07,0xd0,0x03,0x20,0x92,0xfd,0xa9,0xa0,
0x20,0xed,0xfd,0xb1,0x3c,0x20,0xda,0xfd,
0x20,0xba,0xfc,0x90,0xe8,0x60,0x4a,0x90,
0xea,0x4a,0x4a,0xa5,0x3e,0x90,0x02,0x49,
0xff,0x65,0x3c,0x48,0xa9,0xbd,0x20,0xed,
0xfd,0x68,0x48,0x4a,0x4a,0x4a,0x4a,0x20,
0xe5,0xfd,0x68,0x29,0x0f,0x09,0xb0,0xc9,
0xba,0x90,0x02,0x69,0x06,0x6c,0x36,0x00,
0xc9,0xa0,0x90,0x02,0x25,0x32,0x84,0x35,
0x48,0x20,0x78,0xfb,0x68,0xa4,0x35,0x60,
0xc6,0x34,0xf0,0x9f,0xca,0xd0,0x16,0xc9,
0xba,0xd0,0xbb,0x85,0x31,0xa5,0x3e,0x91,
0x40,0xe6,0x40,0xd0,0x02,0xe6,0x41,0x60,
0xa4,0x34,0xb9,0xff,0x01,0x85,0x31,0x60,
0xa2,0x01,0xb5,0x3e,0x95,0x42,0x95,0x44,
0xca,0x10,0xf7,0x60,0xb1,0x3c,0x91,0x42,
0x20,0xb4,0xfc,0x90,0xf7,0x60,0xb1,0x3c,
0xd1,0x42,0xf0,0x1c,0x20,0x92,0xfd,0xb1,
0x3c,0x20,0xda,0xfd,0xa9,0xa0,0x20,0xed,
0xfd,0xa9,0xa8,0x20,0xed,0xfd,0xb1,0x42,
0x20,0xda,0xfd,0xa9,0xa9,0x20,0xed,0xfd,
0x20,0xb4,0xfc,0x90,0xd9,0x60,0x20,0x75,
0xfe,0xa9,0x14,0x48,0x20,0xd0,0xf8,0x20,
0x53,0xf9,0x85,0x3a,0x84,0x3b,0x68,0x38,
0xe9,0x01,0xd0,0xef,0x60,0x8a,0xf0,0x07,
0xb5,0x3c,0x95,0x3a,0xca,0x10,0xf9,0x60,
0xa0,0x3f,0xd0,0x02,0xa0,0xff,0x84,0x32,
0x60,0xa9,0x00,0x85,0x3e,0xa2,0x38,0xa0,
0x1b,0xd0,0x08,0xa9,0x00,0x85,0x3e,0xa2,
0x36,0xa0,0xf0,0xa5,0x3e,0x29,0x0f,0xf0,
0x06,0x09,0xc0,0xa0,0x00,0xf0,0x02,0xa9,
0xfd,0x94,0x00,0x95,0x01,0x60,0xea,0xea,
0x4c,0x00,0xe0,0x4c,0x03,0xe0,0x20,0x75,
0xfe,0x20,0x3f,0xff,0x6c,0x3a,0x00,0x4c,
0xd7,0xfa,0x60,0xea,0x60,0xea,0xea,0xea,
0xea,0xea,0x4c,0xf8,0x03,0xa9,0x40,0x20,
0xc9,0xfc,0xa0,0x27,0xa2,0x00,0x41,0x3c,
0x48,0xa1,0x3c,0x20,0xed,0xfe,0x20,0xba,
0xfc,0xa0,0x1d,0x68,0x90,0xee,0xa0,0x22,
0x20,0xed,0xfe,0xf0,0x4d,0xa2,0x10,0x0a,
0x20,0xd6,0xfc,0xd0,0xfa,0x60,0x20,0x00,
0xfe,0x68,0x68,0xd0,0x6c,0x20,0xfa,0xfc,
0xa9,0x16,0x20,0xc9,0xfc,0x85,0x2e,0x20,
0xfa,0xfc,0xa0,0x24,0x20,0xfd,0xfc,0xb0,
0xf9,0x20,0xfd,0xfc,0xa0,0x3b,0x20,0xec,
0xfc,0x81,0x3c,0x45,0x2e,0x85,0x2e,0x20,
0xba,0xfc,0xa0,0x35,0x90,0xf0,0x20,0xec,
0xfc,0xc5,0x2e,0xf0,0x0d,0xa9,0xc5,0x20,
0xed,0xfd,0xa9,0xd2,0x20,0xed,0xfd,0x20,
0xed,0xfd,0xa9,0x87,0x4c,0xed,0xfd,0xa5,
0x48,0x48,0xa5,0x45,0xa6,0x46,0xa4,0x47,
0x28,0x60,0x85,0x45,0x86,0x46,0x84,0x47,
0x08,0x68,0x85,0x48,0xba,0x86,0x49,0xd8,
0x60,0x20,0x84,0xfe,0x20,0x2f,0xfb,0x20,
0x93,0xfe,0x20,0x89,0xfe,0xd8,0x20,0x3a,
0xff,0xa9,0xaa,0x85,0x33,0x20,0x67,0xfd,
0x20,0xc7,0xff,0x20,0xa7,0xff,0x84,0x34,
0xa0,0x17,0x88,0x30,0xe8,0xd9,0xcc,0xff,
0xd0,0xf8,0x20,0xbe,0xff,0xa4,0x34,0x4c,
0x73,0xff,0xa2,0x03,0x0a,0x0a,0x0a,0x0a,
0x0a,0x26,0x3e,0x26,0x3f,0xca,0x10,0xf8,
0xa5,0x31,0xd0,0x06,0xb5,0x3f,0x95,0x3d,
0x95,0x41,0xe8,0xf0,0xf3,0xd0,0x06,0xa2,
0x00,0x86,0x3e,0x86,0x3f,0xb9,0x00,0x02,
0xc8,0x49,0xb0,0xc9,0x0a,0x90,0xd3,0x69,
0x88,0xc9,0xfa,0xb0,0xcd,0x60,0xa9,0xfe,
0x48,0xb9,0xe3,0xff,0x48,0xa5,0x31,0xa0,
0x00,0x84,0x31,0x60,0xbc,0xb2,0xbe,0xb2,
0xef,0xc4,0xb2,0xa9,0xbb,0xa6,0xa4,0x06,
0x95,0x07,0x02,0x05,0xf0,0x00,0xeb,0x93,
0xa7,0xc6,0x99,0xb2,0xc9,0xbe,0xc1,0x35,
0x8c,0xc4,0x96,0xaf,0x17,0x17,0x2b,0x1f,
0x83,0x7f,0x5d,0xcc,0xb5,0xfc,0x17,0x17,
0xf5,0x03,0xfb,0x03,0x62,0xfa,0x59,0xff
];
return {
start: function() {
return 0xd0;
},
end: function() {
return 0xff;
},
read: function(page, off) {
return rom[(page - 0xd0) << 8 | off];
},
write: function() {},
getState: function() { return {}; },
setState: function() {}
};
}
module.exports = Apple2ROM;
| mit |
iawells/spark-parse | firmware/spark-parse.cpp | 617 | #include "spark-parse.h"
static const String hex_digits = String("0123456789ABCDEF");
// Turn a hex string into a number. NB: string has to be in uppercase.
int parse_hex(String s)
{
int val = 0;
int len = s.length();
int i;
for(i=0;i<len;i++) {
char digit = s.charAt(i);
int digit_val = hex_digits.indexOf(digit);
if(digit_val == -1) {
// Bad digit
break;
} else {
val = (val << 4) + digit_val;
}
}
if(len == 0 || i != len) {
return -1; // Conversion failure
} else {
return val;
}
}
| mit |
codeforabq/Open-Budget-ABQ | server.js | 493 | const express = require('express')
const path = require('path')
const port = process.env.PORT || 3000
const app = express()
// serve static assets normally
app.use(express.static(__dirname + '/'))
// handle every other route with index.html, which will contain
// a script tag to your application's JavaScript file(s).
app.get('*', function (request, response){
response.sendFile(path.resolve(__dirname, '', 'index.html'))
})
app.listen(port)
console.log("server started on port " + port) | mit |
hypertiny/notches | app/models/notches/url.rb | 217 | class Notches::URL < ActiveRecord::Base
self.table_name = "notches_urls"
has_many :hits, :class_name => "Notches::Hit",
:foreign_key => 'notches_url_id'
validates :url, :presence => true
end
| mit |
ResolveWang/WeiboSpider | admin/weibo_config/apps.py | 126 | from django.apps import AppConfig
class WeiboConfig(AppConfig):
name = 'weibo_config'
verbose_name = '微博配置'
| mit |
Azure/azure-sdk-for-java | sdk/databoxedge/azure-resourcemanager-databoxedge/src/main/java/com/azure/resourcemanager/databoxedge/models/MetricAggregationType.java | 1984 | // Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.
package com.azure.resourcemanager.databoxedge.models;
import com.azure.core.util.ExpandableStringEnum;
import com.fasterxml.jackson.annotation.JsonCreator;
import java.util.Collection;
/** Defines values for MetricAggregationType. */
public final class MetricAggregationType extends ExpandableStringEnum<MetricAggregationType> {
/** Static value NotSpecified for MetricAggregationType. */
public static final MetricAggregationType NOT_SPECIFIED = fromString("NotSpecified");
/** Static value None for MetricAggregationType. */
public static final MetricAggregationType NONE = fromString("None");
/** Static value Average for MetricAggregationType. */
public static final MetricAggregationType AVERAGE = fromString("Average");
/** Static value Minimum for MetricAggregationType. */
public static final MetricAggregationType MINIMUM = fromString("Minimum");
/** Static value Maximum for MetricAggregationType. */
public static final MetricAggregationType MAXIMUM = fromString("Maximum");
/** Static value Total for MetricAggregationType. */
public static final MetricAggregationType TOTAL = fromString("Total");
/** Static value Count for MetricAggregationType. */
public static final MetricAggregationType COUNT = fromString("Count");
/**
* Creates or finds a MetricAggregationType from its string representation.
*
* @param name a name to look for.
* @return the corresponding MetricAggregationType.
*/
@JsonCreator
public static MetricAggregationType fromString(String name) {
return fromString(name, MetricAggregationType.class);
}
/** @return known MetricAggregationType values. */
public static Collection<MetricAggregationType> values() {
return values(MetricAggregationType.class);
}
}
| mit |
delitamakanda/jobboard | inventory/recommender.py | 2204 | import redis
from django.conf import settings
from .models import Product
# connect to redis
if settings.DEBUG:
r = redis.StrictRedis(host=settings.REDIS_HOST, port=settings.REDIS_PORT, db=settings.REDIS_DB)
else:
r = redis.from_url(settings.REDISTOGO_URL)
class Recommender(object):
def get_product_key(self, id):
return 'product:{}:purchased_with'.format(id)
def products_bought(self, products):
product_ids = [p.id for p in products]
for product_id in product_ids:
for with_id in product_ids:
# get others products bought with each products
if product_id != with_id:
# increment score for product bought together
r.zincrby(self.get_product_key(product_id), with_id, amount=1)
def suggest_products_for(self, products, max_results=6):
product_ids = [p.id for p in products]
if len(products) == 1:
# only 1 product
suggestions = r.zrange(self.get_product_key(product_ids[0]), 0, -1, desc=True)[:max_results]
else:
# generate a key
flat_ids = ''.join([str(id) for id in product_ids])
tmp_key = 'tmp_{}'.format(flat_ids)
# multiple products combining score of all products
# store the results sorted set in a key
keys = [self.get_product_key(id) for id in product_ids]
r.zunionstore(tmp_key, keys)
# remove ids for the products
r.zrem(tmp_key, *product_ids)
# get product_ids by their score
suggestions = r.zrange(tmp_key, 0, -1, desc=True)[:max_results]
# remove tmp_key
r.delete(tmp_key)
suggested_products_ids = [int(id) for id in suggestions]
# get suggested products and sort by order of appearance
suggested_products = list(Product.objects.filter(id__in=suggested_products_ids))
suggested_products.sort(key=lambda x: suggested_products_ids.index(x.id))
return suggested_products
def clear_purchases(self):
for id in Product.objects.values_list('id', flat=True):
r.delete(self.get_product_key(id))
| mit |
GenoGenov/KnowledgeSpreadSystem | KnowledgeSpreadSystem/KnowledgeSpreadSystem.Web/Controllers/EnrolmentController.cs | 3272 | namespace KnowledgeSpreadSystem.Web.Controllers
{
using System.Linq;
using System.Web.Mvc;
using AutoMapper;
using AutoMapper.QueryableExtensions;
using KnowledgeSpreadSystem.Data;
using KnowledgeSpreadSystem.Web.Controllers.Base;
using KnowledgeSpreadSystem.Web.ViewModels.Course;
using KnowledgeSpreadSystem.Web.ViewModels.Insight;
using KnowledgeSpreadSystem.Web.ViewModels.Module;
using KnowledgeSpreadSystem.Web.ViewModels.Resource;
using WebGrease.Css.Extensions;
[Authorize]
public class EnrolmentController : BaseController
{
// GET: Enrolment
public EnrolmentController(IKSSData data)
: base(data)
{
}
public ActionResult Module(int id)
{
var module = this.Data.CourseModules.Find(id);
if (module != null && this.CurrentUser.Courses.Any(c => c.Id == module.CourseId))
{
return this.PartialView(Mapper.Map<ModuleViewModel>(module));
}
this.AddNotification("No such course exists in your enrolled courses!", "error");
return this.RedirectToAction("Index");
}
public ActionResult Course(int courseId)
{
var course = this.CurrentUser.Courses.AsQueryable().FirstOrDefault(c => c.Id == courseId);
if (course != null)
{
var result = Mapper.Map<CourseViewModel>(course);
ViewBag.IsModerator = course.Moderators.Any(u => u.Id == this.CurrentUser.Id)
|| this.User.IsInRole("Administrator");
return this.PartialView(result);
}
this.AddNotification("No such course exists in your enrolled courses!", "error");
return this.RedirectToAction("Index");
}
public ActionResult Index(int? courseId, string moduleName)
{
if (courseId.HasValue)
{
}
return View();
}
public JsonResult SideMenu(int? id)
{
if (id.HasValue)
{
var course = this.CurrentUser.Courses.FirstOrDefault(x => x.Id == id);
if (course != null)
{
var modules = course.CourseModules.Select(
m => new { id = m.Id, Name = m.Name, hasChildren = false });
return this.Json(modules, JsonRequestBehavior.AllowGet);
}
return null;
}
return
this.Json(
this.CurrentUser.Courses.Select(
c =>
new
{
id = c.Id,
Name = c.Name,
hasChildren = c.CourseModules.Any(),
}),
JsonRequestBehavior.AllowGet);
}
}
} | mit |
okyereadugyamfi/softlogik | SPCode/CS/UI/Form/RecordForm.cs | 16436 | using System.Text.RegularExpressions;
using System.Diagnostics;
using System;
using System.Drawing.Drawing2D;
using System.Windows.Forms;
using System.Collections;
using System.Drawing;
using Microsoft.VisualBasic;
using System.Data.SqlClient;
using System.Data;
using System.Collections.Generic;
using WeifenLuo.WinFormsUI;
using Microsoft.Win32;
using WeifenLuo;
using System.IO;
using System.Drawing.Imaging;
using SoftLogik.Win.UI;
namespace SoftLogik.Win
{
namespace UI
{
public partial class RecordForm
{
public RecordForm()
{
InitializeComponent();
}
//Navigation Events
public delegate void NavigationChangedEventHandler(System.Object sender, SPFormNavigateEventArgs e);
private NavigationChangedEventHandler NavigationChangedEvent;
public event NavigationChangedEventHandler NavigationChanged
{
add
{
NavigationChangedEvent = (NavigationChangedEventHandler) System.Delegate.Combine(NavigationChangedEvent, value);
}
remove
{
NavigationChangedEvent = (NavigationChangedEventHandler) System.Delegate.Remove(NavigationChangedEvent, value);
}
}
public delegate void RecordBindingEventHandler(System.Object sender, SPFormRecordBindingEventArgs e);
private RecordBindingEventHandler RecordBindingEvent;
public event RecordBindingEventHandler RecordBinding
{
add
{
RecordBindingEvent = (RecordBindingEventHandler) System.Delegate.Combine(RecordBindingEvent, value);
}
remove
{
RecordBindingEvent = (RecordBindingEventHandler) System.Delegate.Remove(RecordBindingEvent, value);
}
}
public delegate void DataboundEventHandler(System.Object sender, System.EventArgs e);
private DataboundEventHandler DataboundEvent;
public event DataboundEventHandler Databound
{
add
{
DataboundEvent = (DataboundEventHandler) System.Delegate.Combine(DataboundEvent, value);
}
remove
{
DataboundEvent = (DataboundEventHandler) System.Delegate.Remove(DataboundEvent, value);
}
}
public delegate void RecordChangedEventHandler(System.Object sender, SPFormRecordUpdateEventArgs e);
private RecordChangedEventHandler RecordChangedEvent;
public event RecordChangedEventHandler RecordChanged
{
add
{
RecordChangedEvent = (RecordChangedEventHandler) System.Delegate.Combine(RecordChangedEvent, value);
}
remove
{
RecordChangedEvent = (RecordChangedEventHandler) System.Delegate.Remove(RecordChangedEvent, value);
}
}
public delegate void RecordValidatingEventHandler(System.Object sender, SPFormValidatingEventArgs e);
private RecordValidatingEventHandler RecordValidatingEvent;
public event RecordValidatingEventHandler RecordValidating
{
add
{
RecordValidatingEvent = (RecordValidatingEventHandler) System.Delegate.Combine(RecordValidatingEvent, value);
}
remove
{
RecordValidatingEvent = (RecordValidatingEventHandler) System.Delegate.Remove(RecordValidatingEvent, value);
}
}
#region Properties
protected DataTable _DataSource = null;
protected SPRecordBindingSettings _BindingSettings;
protected SPFormRecordStateManager _RecordState = new SPFormRecordStateManager();
protected LookupForm _LookupForm;
protected Control _FirstField = null;
protected NewRecordCallback _NewRecordProc;
public LookupForm LookupForm
{
set
{
_LookupForm = value;
}
}
#endregion
#region Form Overrides
protected override void OnLoad(System.EventArgs e)
{
base.OnLoad(e);
//WindowState = FormWindowState.Maximized
if (! DesignMode)
{
SPFormRecordBindingEventArgs dataBindSettings = new SPFormRecordBindingEventArgs();
OnRecordBinding(dataBindSettings);
this._RecordState.CurrentState = SPFormRecordModes.EditMode; //By Default Form is in Edit Mode
this._RecordState.BindingData = true;
_DataSource = dataBindSettings.DataSource;
_BindingSettings = dataBindSettings.BindingSettings;
_NewRecordProc = _BindingSettings.NewRecordProc;
SPFormSupport.BindControls(this.Controls, ref DetailBinding, ref _RecordState, new SoftLogik.Win.UI.EventHandler(OnFieldChanged));
MyTabOrderManager = new UI.SPTabOrderManager(this);
MyTabOrderManager.SetTabOrder(UI.SPTabOrderManager.TabScheme.DownFirst); // set tab order
}
}
protected override void OnActivated(System.EventArgs e)
{
base.OnActivated(e);
}
protected override void OnFormClosing(System.Windows.Forms.FormClosingEventArgs e)
{
if (_RecordState.CurrentState == SPFormRecordModes.DirtyMode || _RecordState.CurrentState == SPFormRecordModes.InsertMode)
{
DialogResult msgResult = MessageBox.Show("Save Changes made to " + this.Text + "?", "Save Changes", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1);
switch (msgResult)
{
case System.Windows.Forms.DialogResult.Yes:
OnSaveRecord(); //Save Changes
break;
case System.Windows.Forms.DialogResult.No:
break;
case System.Windows.Forms.DialogResult.Cancel:
e.Cancel = true;
break;
}
}
base.OnFormClosing(e);
}
protected override void OnKeyDown(System.Windows.Forms.KeyEventArgs e)
{
base.OnKeyDown(e);
if (e.Control)
{
switch (e.KeyCode)
{
case Keys.N:
NewRecord.PerformClick();
break;
case Keys.S:
SaveRecord.PerformClick();
break;
case Keys.Delete:
DeleteRecord.PerformClick();
break;
}
}
if (e.KeyCode == Keys.Escape)
{
if (_RecordState.CurrentState == SPFormRecordModes.DirtyMode)
{
UndoRecord.PerformClick();
}
else
{
CloseWindow.PerformClick();
}
}
}
#endregion
#region Protected Overrides
protected virtual void OnRecordBinding(SPFormRecordBindingEventArgs e)
{
if (RecordBindingEvent != null) //let client respond
RecordBindingEvent(this, e);
}
protected virtual void OnRecordChanged(SPFormRecordUpdateEventArgs e)
{
if (RecordChangedEvent != null)
RecordChangedEvent(this, e);
}
#endregion
#region Private Methods
protected virtual void OnFieldChanged(System.Object sender, System.EventArgs e)
{
if (_RecordState.ShowingData == false)
{
if (_RecordState.CurrentState == SPFormRecordModes.EditMode && _RecordState.CurrentState != SPFormRecordModes.DirtyMode && (! _RecordState.BindingData))
{
_RecordState.CurrentState = SPFormRecordModes.DirtyMode;
UpdateFormCaption(false);
TStripSupport.ToolbarToggleSave(tbrMain, null);
}
}
_RecordState.BindingData = false;
}
protected virtual void OnNewRecord()
{
try
{
DetailBinding.AddNew();
DetailBinding.MoveFirst();
this._RecordState.CurrentState = SPFormRecordModes.InsertMode;
TStripSupport.ToolbarToggleSave(tbrMain, null);
FirstFieldFocus();
}
catch (Exception)
{
}
}
protected virtual void OnRefreshRecord()
{
try
{
this._RecordState.CurrentState = SPFormRecordModes.EditMode;
FirstFieldFocus();
}
catch (Exception)
{
}
}
protected virtual void OnSortRecord()
{
try
{
this._RecordState.CurrentState = SPFormRecordModes.EditMode;
FirstFieldFocus();
}
catch (Exception)
{
}
}
protected virtual void OnSaveRecord()
{
this.Validate();
try
{
_RecordState.ShowingData = true;
DetailBinding.EndEdit();
_RecordState.ShowingData = false;
}
catch (Exception)
{
return;
}
if (DetailBinding.Current != null)
{
if (this._RecordState.CurrentState == SPFormRecordModes.InsertMode)
{
OnRecordChanged(new SPFormRecordUpdateEventArgs(_RecordState.NewRecordData, @SPFormDataStates.New));
_RecordState.NewRecordData = null;
}
else
{
OnRecordChanged(new SPFormRecordUpdateEventArgs(((DataRowView) DetailBinding.Current).Row, SPFormDataStates.Edited));
}
_RecordState.CurrentState = SPFormRecordModes.EditMode;
UpdateFormCaption(true);
}
}
protected virtual void OnUndoRecord()
{
//On Error Resume Next VBConversions Warning: On Error Resume Next not supported in C#
if (DetailBinding.Current != null)
{
if (((DataRowView) DetailBinding.Current).IsNew)
{
DetailBinding.RemoveCurrent();
}
else
{
DetailBinding.CancelEdit();
}
}
_RecordState.CurrentState = SPFormRecordModes.EditMode;
UpdateFormCaption(true);
}
protected virtual void OnDeleteRecord()
{
try
{
if (MessageBox.Show("Are you sure you want to Delete \'" + ((DataRowView) DetailBinding.Current).Row(_BindingSettings.DisplayMember).ToString() + "\' ?", "Delete Record", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes)
{
OnRecordChanged(new SPFormRecordUpdateEventArgs(((DataRowView) DetailBinding.Current).Row, SPFormDataStates.Deleted));
_RecordState.ShowingData = true;
DetailBinding.RemoveCurrent();
_RecordState.ShowingData = false;
}
}
catch (Exception)
{
}
}
protected virtual void OnSearchRecord()
{
if (_LookupForm != null)
{
_LookupForm.ShowDialog(this);
//.SearchResults()
}
}
protected virtual void OnCopyRecord()
{
if (DetailBinding.Current != null)
{
//_RecordState.ShowingData = True
DataRowView clonedDataRow = (DataRowView) DetailBinding.Current;
DataRowView newDataRow = (DataRowView) (DetailBinding.AddNew());
DuplicateRecord(clonedDataRow, ref newDataRow);
DetailBinding.ResetBindings(false);
_RecordState.CurrentState = SPFormRecordModes.InsertMode;
//_RecordState.ShowingData = False
}
}
protected virtual void OnNavigate(SPRecordNavigateDirections direction)
{
DataRow lastRecord;
DataRow currentRecord;
//On Error Resume Next VBConversions Warning: On Error Resume Next not supported in C#
_RecordState.ShowingData = true;
lastRecord = ((DataRowView) DetailBinding.Current).Row;
switch (direction)
{
case SPRecordNavigateDirections.First:
SelectNameInList(0);
break;
case SPRecordNavigateDirections.Last:
SelectNameInList(DetailBinding.Count - 1);
break;
case SPRecordNavigateDirections.Next:
SelectNameInList(DetailBinding.Position + 1);
break;
case SPRecordNavigateDirections.Previous:
SelectNameInList(DetailBinding.Position - 1);
break;
}
_RecordState.ShowingData = false;
currentRecord = ((DataRowView) DetailBinding.Current).Row;
if (NavigationChangedEvent != null)
NavigationChangedEvent(tbrMain, new SPFormNavigateEventArgs(direction, lastRecord, currentRecord));
}
protected virtual void OnCloseWindow()
{
this.Close();
}
#endregion
#region Support Methods
protected virtual void UpdateFormCaption(bool Clear)
{
string strText = this.Text;
if (! Clear)
{
strText += ((strText.EndsWith("*")) ? Constants.vbNullString : "*").ToString();
this.Text = strText;
}
else
{
this.Text = strText.Replace("*", Constants.vbNullString);
}
}
protected virtual void FirstFieldFocus()
{
int lastTabIndex;
try
{
Control firstControl = this.GetNextControl(this, true);
if (firstControl != null)
{
lastTabIndex = firstControl.TabIndex;
FindFirstField(firstControl, ref lastTabIndex);
}
}
catch (Exception)
{
return;
}
}
private void FindFirstField(Control OuterControl, ref int lastTabIndex)
{
Control ctl = OuterControl;
while (ctl != null)
{
if ((! ctl.HasChildren) && (ctl.CanFocus && ctl.CanSelect))
{
ctl.Focus();
return;
}
else
{
ctl = ctl.GetNextControl(ctl, true);
FindFirstField(ctl, ref lastTabIndex);
}
}
}
private void DuplicateRecord(DataRowView SourceRow, ref DataRowView TargetRow)
{
_RecordState.DuplicatingData = true;
TargetRow.Row.ItemArray = SourceRow.Row.ItemArray;
foreach (DataColumn itm in TargetRow.Row.Table.Columns)
{
if (itm.ReadOnly)
{
if (itm.AutoIncrement)
{
TargetRow[itm.ColumnName] = 0;
}
}
}
_RecordState.DuplicatingData = false;
}
#endregion
#region List and Toolbar Events
protected virtual void ToolbarOperation(System.Object sender, System.EventArgs e)
{
if (((ToolStripItem) sender).Name == TStripSupport.MasterToolbarButtonNames.ToolbarNew)
{
OnNewRecord();
}
else if (((ToolStripItem) sender).Name == TStripSupport.MasterToolbarButtonNames.ToolbarSave)
{
OnSaveRecord();
}
else if (((ToolStripItem) sender).Name == TStripSupport.MasterToolbarButtonNames.ToolbarDelete)
{
OnDeleteRecord();
}
else if (((ToolStripItem) sender).Name == TStripSupport.MasterToolbarButtonNames.ToolbarUndo)
{
OnUndoRecord();
}
else if (((ToolStripItem) sender).Name == TStripSupport.MasterToolbarButtonNames.ToolbarSearch)
{
OnSearchRecord();
}
else if (((ToolStripItem) sender).Name == TStripSupport.MasterToolbarButtonNames.ToolbarCopy)
{
OnCopyRecord();
}
else if (((ToolStripItem) sender).Name == TStripSupport.MasterToolbarButtonNames.ToolbarRefresh)
{
OnRefreshRecord();
}
else if (((ToolStripItem) sender).Name == TStripSupport.MasterToolbarButtonNames.ToolbarSort)
{
OnSortRecord();
}
else if (((ToolStripItem) sender).Name == TStripSupport.MasterToolbarButtonNames.ToolbarFirst)
{
OnNavigate(SPRecordNavigateDirections.First);
}
else if (((ToolStripItem) sender).Name == TStripSupport.MasterToolbarButtonNames.ToolbarPrevious)
{
OnNavigate(SPRecordNavigateDirections.Previous);
}
else if (((ToolStripItem) sender).Name == TStripSupport.MasterToolbarButtonNames.ToolbarNext)
{
OnNavigate(SPRecordNavigateDirections.Next);
}
else if (((ToolStripItem) sender).Name == TStripSupport.MasterToolbarButtonNames.ToolbarLast)
{
OnNavigate(SPRecordNavigateDirections.Last);
} //Close Window
else if (((ToolStripItem) sender).Name == TStripSupport.MasterToolbarButtonNames.ToolbarClose)
{
OnCloseWindow();
}
}
public void tbrMain_ItemClicked(System.Object sender, System.Windows.Forms.ToolStripItemClickedEventArgs e)
{
ToolbarOperation(e.ClickedItem, e);
}
protected virtual void SelectNameInList(int Index)
{
int selectedRow = Index;
DataRow lastRecord = null;
DataRow currentRecord = null;
if (selectedRow != - 1)
{
_RecordState.ShowingData = true;
if (DetailBinding.Current != null)
{
lastRecord = ((DataRowView) DetailBinding.Current).Row;
}
DetailBinding.Position = selectedRow;
_RecordState.ShowingData = false;
if (DetailBinding.Current != null)
{
currentRecord = ((DataRowView) DetailBinding.Current).Row;
}
if (NavigationChangedEvent != null)
NavigationChangedEvent(tbrMain, new SPFormNavigateEventArgs(SPRecordNavigateDirections.None, lastRecord, currentRecord));
}
}
#endregion
public void DetailBinding_BindingComplete(object sender, System.Windows.Forms.BindingCompleteEventArgs e)
{
this._RecordState.BindingData = false;
}
public void DetailBinding_DataSourceChanged(object sender, System.EventArgs e)
{
this._RecordState.BindingData = true;
}
public void DetailBinding_ListChanged(object sender, System.ComponentModel.ListChangedEventArgs e)
{
if (e.ListChangedType == System.ComponentModel.ListChangedType.ItemAdded)
{
if ((_NewRecordProc != null)&& _RecordState.DuplicatingData == false && _RecordState.ShowingData == false)
{
((DataRowView) (DetailBinding[e.NewIndex])).Row.ItemArray = _NewRecordProc.Invoke.Row.ItemArray;
_RecordState.NewRecordData = ((DataRowView) (DetailBinding[e.NewIndex])).Row;
}
}
}
}
}
}
| mit |
commonsensesoftware/More | src/More.UI.Presentation/Platforms/net45/More/Microsoft.Win32/OverwriteResponse.cs | 139 | namespace Microsoft.Win32
{
using System;
enum OverwriteResponse
{
Default,
Accept,
Refuse,
}
} | mit |
auth0/auth0-java | src/test/java/com/auth0/client/mgmt/ConnectionsEntityTest.java | 15050 | package com.auth0.client.mgmt;
import com.auth0.client.mgmt.filter.ConnectionFilter;
import com.auth0.json.mgmt.Connection;
import com.auth0.json.mgmt.ConnectionsPage;
import com.auth0.net.Request;
import okhttp3.mockwebserver.RecordedRequest;
import org.junit.Test;
import java.util.List;
import java.util.Map;
import static com.auth0.client.MockServer.*;
import static com.auth0.client.RecordedRequestMatcher.*;
import static org.hamcrest.Matchers.*;
import static org.hamcrest.MatcherAssert.assertThat;
public class ConnectionsEntityTest extends BaseMgmtEntityTest {
@Test
public void shouldListConnections() throws Exception {
@SuppressWarnings("deprecation")
Request<List<Connection>> request = api.connections().list(null);
assertThat(request, is(notNullValue()));
server.jsonResponse(MGMT_CONNECTIONS_LIST, 200);
List<Connection> response = request.execute();
RecordedRequest recordedRequest = server.takeRequest();
assertThat(recordedRequest, hasMethodAndPath("GET", "/api/v2/connections"));
assertThat(recordedRequest, hasHeader("Content-Type", "application/json"));
assertThat(recordedRequest, hasHeader("Authorization", "Bearer apiToken"));
assertThat(response, is(notNullValue()));
assertThat(response, hasSize(2));
}
@Test
public void shouldListConnectionsWithStrategy() throws Exception {
ConnectionFilter filter = new ConnectionFilter().withStrategy("auth0");
@SuppressWarnings("deprecation")
Request<List<Connection>> request = api.connections().list(filter);
assertThat(request, is(notNullValue()));
server.jsonResponse(MGMT_CONNECTIONS_LIST, 200);
List<Connection> response = request.execute();
RecordedRequest recordedRequest = server.takeRequest();
assertThat(recordedRequest, hasMethodAndPath("GET", "/api/v2/connections"));
assertThat(recordedRequest, hasHeader("Content-Type", "application/json"));
assertThat(recordedRequest, hasHeader("Authorization", "Bearer apiToken"));
assertThat(recordedRequest, hasQueryParameter("strategy", "auth0"));
assertThat(response, is(notNullValue()));
assertThat(response, hasSize(2));
}
@Test
public void shouldListConnectionsWithName() throws Exception {
ConnectionFilter filter = new ConnectionFilter().withName("my-connection");
@SuppressWarnings("deprecation")
Request<List<Connection>> request = api.connections().list(filter);
assertThat(request, is(notNullValue()));
server.jsonResponse(MGMT_CONNECTIONS_LIST, 200);
List<Connection> response = request.execute();
RecordedRequest recordedRequest = server.takeRequest();
assertThat(recordedRequest, hasMethodAndPath("GET", "/api/v2/connections"));
assertThat(recordedRequest, hasHeader("Content-Type", "application/json"));
assertThat(recordedRequest, hasHeader("Authorization", "Bearer apiToken"));
assertThat(recordedRequest, hasQueryParameter("name", "my-connection"));
assertThat(response, is(notNullValue()));
assertThat(response, hasSize(2));
}
@Test
public void shouldListConnectionsWithFields() throws Exception {
ConnectionFilter filter = new ConnectionFilter().withFields("some,random,fields", true);
@SuppressWarnings("deprecation")
Request<List<Connection>> request = api.connections().list(filter);
assertThat(request, is(notNullValue()));
server.jsonResponse(MGMT_CONNECTIONS_LIST, 200);
List<Connection> response = request.execute();
RecordedRequest recordedRequest = server.takeRequest();
assertThat(recordedRequest, hasMethodAndPath("GET", "/api/v2/connections"));
assertThat(recordedRequest, hasHeader("Content-Type", "application/json"));
assertThat(recordedRequest, hasHeader("Authorization", "Bearer apiToken"));
assertThat(recordedRequest, hasQueryParameter("fields", "some,random,fields"));
assertThat(recordedRequest, hasQueryParameter("include_fields", "true"));
assertThat(response, is(notNullValue()));
assertThat(response, hasSize(2));
}
@Test
public void shouldListConnectionsWithoutFilter() throws Exception {
Request<ConnectionsPage> request = api.connections().listAll(null);
assertThat(request, is(notNullValue()));
server.jsonResponse(MGMT_CONNECTIONS_LIST, 200);
ConnectionsPage response = request.execute();
RecordedRequest recordedRequest = server.takeRequest();
assertThat(recordedRequest, hasMethodAndPath("GET", "/api/v2/connections"));
assertThat(recordedRequest, hasHeader("Content-Type", "application/json"));
assertThat(recordedRequest, hasHeader("Authorization", "Bearer apiToken"));
assertThat(response, is(notNullValue()));
assertThat(response.getItems(), hasSize(2));
}
@Test
public void shouldNotListConnectionsWithTotals() throws Exception {
ConnectionFilter filter = new ConnectionFilter().withTotals(true);
@SuppressWarnings("deprecation")
Request<List<Connection>> request = api.connections().list(filter);
assertThat(request, is(notNullValue()));
server.jsonResponse(MGMT_CONNECTIONS_LIST, 200);
List<Connection> response = request.execute();
RecordedRequest recordedRequest = server.takeRequest();
assertThat(recordedRequest, hasMethodAndPath("GET", "/api/v2/connections"));
assertThat(recordedRequest, hasHeader("Content-Type", "application/json"));
assertThat(recordedRequest, hasHeader("Authorization", "Bearer apiToken"));
assertThat(recordedRequest, not(hasQueryParameter("include_totals")));
assertThat(response, is(notNullValue()));
assertThat(response, hasSize(2));
}
@Test
public void shouldListConnectionsWithPage() throws Exception {
ConnectionFilter filter = new ConnectionFilter().withPage(23, 5);
Request<ConnectionsPage> request = api.connections().listAll(filter);
assertThat(request, is(notNullValue()));
server.jsonResponse(MGMT_CONNECTIONS_LIST, 200);
ConnectionsPage response = request.execute();
RecordedRequest recordedRequest = server.takeRequest();
assertThat(recordedRequest, hasMethodAndPath("GET", "/api/v2/connections"));
assertThat(recordedRequest, hasHeader("Content-Type", "application/json"));
assertThat(recordedRequest, hasHeader("Authorization", "Bearer apiToken"));
assertThat(recordedRequest, hasQueryParameter("page", "23"));
assertThat(recordedRequest, hasQueryParameter("per_page", "5"));
assertThat(response, is(notNullValue()));
assertThat(response.getItems(), hasSize(2));
}
@Test
public void shouldListConnectionsWithTotals() throws Exception {
ConnectionFilter filter = new ConnectionFilter().withTotals(true);
Request<ConnectionsPage> request = api.connections().listAll(filter);
assertThat(request, is(notNullValue()));
server.jsonResponse(MGMT_CONNECTIONS_PAGED_LIST, 200);
ConnectionsPage response = request.execute();
RecordedRequest recordedRequest = server.takeRequest();
assertThat(recordedRequest, hasMethodAndPath("GET", "/api/v2/connections"));
assertThat(recordedRequest, hasHeader("Content-Type", "application/json"));
assertThat(recordedRequest, hasHeader("Authorization", "Bearer apiToken"));
assertThat(recordedRequest, hasQueryParameter("include_totals", "true"));
assertThat(response, is(notNullValue()));
assertThat(response.getItems(), hasSize(2));
assertThat(response.getStart(), is(0));
assertThat(response.getLength(), is(14));
assertThat(response.getTotal(), is(14));
assertThat(response.getLimit(), is(50));
}
@Test
public void shouldReturnEmptyConnections() throws Exception {
@SuppressWarnings("deprecation")
Request<List<Connection>> request = api.connections().list(null);
assertThat(request, is(notNullValue()));
server.jsonResponse(MGMT_EMPTY_LIST, 200);
List<Connection> response = request.execute();
assertThat(response, is(notNullValue()));
assertThat(response, is(emptyCollectionOf(Connection.class)));
}
@Test
public void shouldThrowOnGetConnectionWithNullId() {
exception.expect(IllegalArgumentException.class);
exception.expectMessage("'connection id' cannot be null!");
api.connections().get(null, null);
}
@Test
public void shouldGetConnection() throws Exception {
Request<Connection> request = api.connections().get("1", null);
assertThat(request, is(notNullValue()));
server.jsonResponse(MGMT_CONNECTION, 200);
Connection response = request.execute();
RecordedRequest recordedRequest = server.takeRequest();
assertThat(recordedRequest, hasMethodAndPath("GET", "/api/v2/connections/1"));
assertThat(recordedRequest, hasHeader("Content-Type", "application/json"));
assertThat(recordedRequest, hasHeader("Authorization", "Bearer apiToken"));
assertThat(response, is(notNullValue()));
}
@Test
public void shouldGetConnectionWithFields() throws Exception {
ConnectionFilter filter = new ConnectionFilter().withFields("some,random,fields", true);
Request<Connection> request = api.connections().get("1", filter);
assertThat(request, is(notNullValue()));
server.jsonResponse(MGMT_CONNECTION, 200);
Connection response = request.execute();
RecordedRequest recordedRequest = server.takeRequest();
assertThat(recordedRequest, hasMethodAndPath("GET", "/api/v2/connections/1"));
assertThat(recordedRequest, hasHeader("Content-Type", "application/json"));
assertThat(recordedRequest, hasHeader("Authorization", "Bearer apiToken"));
assertThat(recordedRequest, hasQueryParameter("fields", "some,random,fields"));
assertThat(recordedRequest, hasQueryParameter("include_fields", "true"));
assertThat(response, is(notNullValue()));
}
@Test
public void shouldThrowOnCreateConnectionWithNullData() {
exception.expect(IllegalArgumentException.class);
exception.expectMessage("'connection' cannot be null!");
api.connections().create(null);
}
@Test
public void shouldCreateConnection() throws Exception {
Request<Connection> request = api.connections().create(new Connection("my-connection", "auth0"));
assertThat(request, is(notNullValue()));
server.jsonResponse(MGMT_CONNECTION, 200);
Connection response = request.execute();
RecordedRequest recordedRequest = server.takeRequest();
assertThat(recordedRequest, hasMethodAndPath("POST", "/api/v2/connections"));
assertThat(recordedRequest, hasHeader("Content-Type", "application/json"));
assertThat(recordedRequest, hasHeader("Authorization", "Bearer apiToken"));
Map<String, Object> body = bodyFromRequest(recordedRequest);
assertThat(body.size(), is(2));
assertThat(body, hasEntry("name", "my-connection"));
assertThat(body, hasEntry("strategy", "auth0"));
assertThat(response, is(notNullValue()));
}
@Test
public void shouldThrowOnDeleteConnectionWithNullId() {
exception.expect(IllegalArgumentException.class);
exception.expectMessage("'connection id' cannot be null!");
api.connections().delete(null);
}
@Test
public void shouldDeleteConnection() throws Exception {
Request<Void> request = api.connections().delete("1");
assertThat(request, is(notNullValue()));
server.jsonResponse(MGMT_CONNECTION, 200);
request.execute();
RecordedRequest recordedRequest = server.takeRequest();
assertThat(recordedRequest, hasMethodAndPath("DELETE", "/api/v2/connections/1"));
assertThat(recordedRequest, hasHeader("Content-Type", "application/json"));
assertThat(recordedRequest, hasHeader("Authorization", "Bearer apiToken"));
}
@Test
public void shouldThrowOnUpdateConnectionWithNullId() {
exception.expect(IllegalArgumentException.class);
exception.expectMessage("'connection id' cannot be null!");
api.connections().update(null, new Connection("my-connection", "auth0"));
}
@Test
public void shouldThrowOnUpdateConnectionWithNullData() {
exception.expect(IllegalArgumentException.class);
exception.expectMessage("'connection' cannot be null!");
api.connections().update("1", null);
}
@Test
public void shouldUpdateConnection() throws Exception {
Request<Connection> request = api.connections().update("1", new Connection("my-connection", "auth0"));
assertThat(request, is(notNullValue()));
server.jsonResponse(MGMT_CONNECTION, 200);
Connection response = request.execute();
RecordedRequest recordedRequest = server.takeRequest();
assertThat(recordedRequest, hasMethodAndPath("PATCH", "/api/v2/connections/1"));
assertThat(recordedRequest, hasHeader("Content-Type", "application/json"));
assertThat(recordedRequest, hasHeader("Authorization", "Bearer apiToken"));
Map<String, Object> body = bodyFromRequest(recordedRequest);
assertThat(body.size(), is(2));
assertThat(body, hasEntry("name", "my-connection"));
assertThat(body, hasEntry("strategy", "auth0"));
assertThat(response, is(notNullValue()));
}
@Test
public void shouldThrowOnDeleteConnectionUserWithNullId() {
exception.expect(IllegalArgumentException.class);
exception.expectMessage("'connection id' cannot be null!");
api.connections().deleteUser(null, "[email protected]");
}
@Test
public void shouldThrowOnDeleteConnectionUserWithNullEmail() {
exception.expect(IllegalArgumentException.class);
exception.expectMessage("'email' cannot be null!");
api.connections().deleteUser("1", null);
}
@Test
public void shouldDeleteConnectionUser() throws Exception {
Request<Void> request = api.connections().deleteUser("1", "[email protected]");
assertThat(request, is(notNullValue()));
server.jsonResponse(MGMT_CONNECTION, 200);
request.execute();
RecordedRequest recordedRequest = server.takeRequest();
assertThat(recordedRequest, hasMethodAndPath("DELETE", "/api/v2/connections/1/users"));
assertThat(recordedRequest, hasHeader("Content-Type", "application/json"));
assertThat(recordedRequest, hasHeader("Authorization", "Bearer apiToken"));
assertThat(recordedRequest, hasQueryParameter("email", "[email protected]"));
}
}
| mit |
pempel/musk | spec/lib/musk/formatter/pretty_spec.rb | 748 | require "spec_helper"
describe Musk::Formatter::Pretty do
describe ".print(tracks)" do
let(:tracks) { [build(:jets_track), build(:kamakura_track)] }
let(:stdout) do
tracks.map { |t| Musk::Decorator::PrintableTrack.new(t) }.map do |track|
"Path: #{track.path}\n"\
"Title: #{track.title}\n"\
"Position: #{track.position}\n"\
"Artist: #{track.artist}\n"\
"Release: #{track.release}\n"\
"Genre: #{track.genre}\n"\
"Year: #{track.year}\n"\
"Comment: #{track.comment}\n"
end.join("\n")
end
it "should print tracks to STDOUT in the pretty format" do
capture_stdout { described_class.print(tracks) }.should eq(stdout)
end
end
end
| mit |
Hiroto-K/hk_sub_ | core/memo.rb | 884 | Plugin.command(:memo, /#(メモ|(hk)?memo)/i) do |obj|
next unless obj.hashtags?
uri = URI.parse("https://csrf.cf/api/memo/create")
request = Net::HTTP::Post.new(uri.request_uri)
request.set_form_data({:id => obj.id})
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
response = http.start do |h|
h.request(request)
end
json = JSON.parse(response.body, {symbolize_names: true})
raise Hk::Error::ErrorException, json[:error][:message] if json[:error]
raise Hk::Error::HttpError, "HTTP Error code #{response.code}" unless response.code == "200"
raise Hk::Error::ErrorException, "id is empty." unless json[:id]
obj.reply("メモに登録しました。 https://csrf.cf/memo/show/#{json[:id]}\n自分のメモ一覧は https://csrf.cf/memo/user/#{json[:user_sn]} から確認出来ます。")
end | mit |
khlieng/dispatch | client/js/components/pages/Chat/Search.js | 922 | import React, { memo, useRef, useEffect } from 'react';
import { FiSearch } from 'react-icons/fi';
import SearchResult from './SearchResult';
const Search = ({ search, onSearch }) => {
const inputEl = useRef();
useEffect(() => {
if (search.show) {
inputEl.current.focus();
}
}, [search.show]);
const style = {
display: search.show ? 'block' : 'none'
};
let i = 0;
const results = search.results.map(result => (
<SearchResult key={i++} result={result} />
));
return (
<div className="search" style={style}>
<div className="search-input-wrap">
<FiSearch className="search-input-icon" />
<input
ref={inputEl}
className="search-input"
type="text"
onChange={e => onSearch(e.target.value)}
/>
</div>
<div className="search-results">{results}</div>
</div>
);
};
export default memo(Search);
| mit |
neuecc/MagicOnion | samples/ChatApp/ChatApp.Unity/Assets/Scripts/MessagePack/SequenceReaderExtensions.cs | 10802 | // Copyright (c) All contributors. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
/* Licensed to the .NET Foundation under one or more agreements.
* The .NET Foundation licenses this file to you under the MIT license.
* See the LICENSE file in the project root for more information. */
using System.Buffers.Binary;
using System.Diagnostics;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
namespace System.Buffers
{
internal static partial class SequenceReaderExtensions
{
/// <summary>
/// Try to read the given type out of the buffer if possible. Warning: this is dangerous to use with arbitrary
/// structs- see remarks for full details.
/// </summary>
/// <remarks>
/// IMPORTANT: The read is a straight copy of bits. If a struct depends on specific state of its members to
/// behave correctly this can lead to exceptions, etc. If reading endian specific integers, use the explicit
/// overloads such as <see cref="TryReadBigEndian(ref SequenceReader{byte}, out short)"/>.
/// </remarks>
/// <returns>
/// True if successful. <paramref name="value"/> will be default if failed (due to lack of space).
/// </returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static unsafe bool TryRead<T>(ref this SequenceReader<byte> reader, out T value)
where T : unmanaged
{
ReadOnlySpan<byte> span = reader.UnreadSpan;
if (span.Length < sizeof(T))
{
return TryReadMultisegment(ref reader, out value);
}
value = Unsafe.ReadUnaligned<T>(ref MemoryMarshal.GetReference(span));
reader.Advance(sizeof(T));
return true;
}
#if UNITY_ANDROID
/// <summary>
/// In Android 32bit device(armv7) + IL2CPP does not work correctly on Unsafe.ReadUnaligned.
/// Perhaps it is about memory alignment bug of Unity's IL2CPP VM.
/// For a workaround, read memory manually.
/// https://github.com/neuecc/MessagePack-CSharp/issues/748
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static unsafe bool TryRead(ref this SequenceReader<byte> reader, out long value)
{
ReadOnlySpan<byte> span = reader.UnreadSpan;
if (span.Length < sizeof(long))
{
return TryReadMultisegment(ref reader, out value);
}
value = BitConverterToInt64(span);
reader.Advance(sizeof(long));
return true;
}
private static unsafe long BitConverterToInt64(ReadOnlySpan<byte> value)
{
if (BitConverter.IsLittleEndian)
{
int i1 = value[0] | (value[1] << 8) | (value[2] << 16) | (value[3] << 24);
int i2 = value[4] | (value[5] << 8) | (value[6] << 16) | (value[7] << 24);
return (uint)i1 | ((long)i2 << 32);
}
else
{
int i1 = (value[0] << 24) | (value[1] << 16) | (value[2] << 8) | value[3];
int i2 = (value[4] << 24) | (value[5] << 16) | (value[6] << 8) | value[7];
return (uint)i2 | ((long)i1 << 32);
}
}
#endif
private static unsafe bool TryReadMultisegment<T>(ref SequenceReader<byte> reader, out T value)
where T : unmanaged
{
Debug.Assert(reader.UnreadSpan.Length < sizeof(T), "reader.UnreadSpan.Length < sizeof(T)");
// Not enough data in the current segment, try to peek for the data we need.
T buffer = default;
Span<byte> tempSpan = new Span<byte>(&buffer, sizeof(T));
if (!reader.TryCopyTo(tempSpan))
{
value = default;
return false;
}
value = Unsafe.ReadUnaligned<T>(ref MemoryMarshal.GetReference(tempSpan));
reader.Advance(sizeof(T));
return true;
}
#if UNITY_ANDROID
private static unsafe bool TryReadMultisegment(ref SequenceReader<byte> reader, out long value)
{
Debug.Assert(reader.UnreadSpan.Length < sizeof(long), "reader.UnreadSpan.Length < sizeof(long)");
// Not enough data in the current segment, try to peek for the data we need.
long buffer = default;
Span<byte> tempSpan = new Span<byte>(&buffer, sizeof(long));
if (!reader.TryCopyTo(tempSpan))
{
value = default;
return false;
}
value = BitConverterToInt64(tempSpan);
reader.Advance(sizeof(long));
return true;
}
#endif
/// <summary>
/// Reads an <see cref="sbyte"/> from the next position in the sequence.
/// </summary>
/// <param name="reader">The reader to read from.</param>
/// <param name="value">Receives the value read.</param>
/// <returns><c>true</c> if there was another byte in the sequence; <c>false</c> otherwise.</returns>
public static bool TryRead(ref this SequenceReader<byte> reader, out sbyte value)
{
if (TryRead(ref reader, out byte byteValue))
{
value = unchecked((sbyte)byteValue);
return true;
}
value = default;
return false;
}
/// <summary>
/// Reads an <see cref="Int16"/> as big endian.
/// </summary>
/// <returns>False if there wasn't enough data for an <see cref="Int16"/>.</returns>
public static bool TryReadBigEndian(ref this SequenceReader<byte> reader, out short value)
{
if (!BitConverter.IsLittleEndian)
{
return reader.TryRead(out value);
}
return TryReadReverseEndianness(ref reader, out value);
}
/// <summary>
/// Reads an <see cref="UInt16"/> as big endian.
/// </summary>
/// <returns>False if there wasn't enough data for an <see cref="UInt16"/>.</returns>
public static bool TryReadBigEndian(ref this SequenceReader<byte> reader, out ushort value)
{
if (TryReadBigEndian(ref reader, out short shortValue))
{
value = unchecked((ushort)shortValue);
return true;
}
value = default;
return false;
}
private static bool TryReadReverseEndianness(ref SequenceReader<byte> reader, out short value)
{
if (reader.TryRead(out value))
{
value = BinaryPrimitives.ReverseEndianness(value);
return true;
}
return false;
}
/// <summary>
/// Reads an <see cref="Int32"/> as big endian.
/// </summary>
/// <returns>False if there wasn't enough data for an <see cref="Int32"/>.</returns>
public static bool TryReadBigEndian(ref this SequenceReader<byte> reader, out int value)
{
if (!BitConverter.IsLittleEndian)
{
return reader.TryRead(out value);
}
return TryReadReverseEndianness(ref reader, out value);
}
/// <summary>
/// Reads an <see cref="UInt32"/> as big endian.
/// </summary>
/// <returns>False if there wasn't enough data for an <see cref="UInt32"/>.</returns>
public static bool TryReadBigEndian(ref this SequenceReader<byte> reader, out uint value)
{
if (TryReadBigEndian(ref reader, out int intValue))
{
value = unchecked((uint)intValue);
return true;
}
value = default;
return false;
}
private static bool TryReadReverseEndianness(ref SequenceReader<byte> reader, out int value)
{
if (reader.TryRead(out value))
{
value = BinaryPrimitives.ReverseEndianness(value);
return true;
}
return false;
}
/// <summary>
/// Reads an <see cref="Int64"/> as big endian.
/// </summary>
/// <returns>False if there wasn't enough data for an <see cref="Int64"/>.</returns>
public static bool TryReadBigEndian(ref this SequenceReader<byte> reader, out long value)
{
if (!BitConverter.IsLittleEndian)
{
return reader.TryRead(out value);
}
return TryReadReverseEndianness(ref reader, out value);
}
/// <summary>
/// Reads an <see cref="UInt64"/> as big endian.
/// </summary>
/// <returns>False if there wasn't enough data for an <see cref="UInt64"/>.</returns>
public static bool TryReadBigEndian(ref this SequenceReader<byte> reader, out ulong value)
{
if (TryReadBigEndian(ref reader, out long longValue))
{
value = unchecked((ulong)longValue);
return true;
}
value = default;
return false;
}
private static bool TryReadReverseEndianness(ref SequenceReader<byte> reader, out long value)
{
if (reader.TryRead(out value))
{
value = BinaryPrimitives.ReverseEndianness(value);
return true;
}
return false;
}
/// <summary>
/// Reads a <see cref="Single"/> as big endian.
/// </summary>
/// <returns>False if there wasn't enough data for a <see cref="Single"/>.</returns>
public static unsafe bool TryReadBigEndian(ref this SequenceReader<byte> reader, out float value)
{
if (TryReadBigEndian(ref reader, out int intValue))
{
value = *(float*)&intValue;
return true;
}
value = default;
return false;
}
/// <summary>
/// Reads a <see cref="Double"/> as big endian.
/// </summary>
/// <returns>False if there wasn't enough data for a <see cref="Double"/>.</returns>
public static unsafe bool TryReadBigEndian(ref this SequenceReader<byte> reader, out double value)
{
if (TryReadBigEndian(ref reader, out long longValue))
{
value = *(double*)&longValue;
return true;
}
value = default;
return false;
}
}
}
| mit |
alexbol99/palabras2 | js/views/textbox.js | 3702 | /**
* Created by alexbol on 1/8/2015.
*/
define(['models/quiz', 'views/editItemForm'],
function (quiz, editItemForm) {
return Backbone.View.extend({
className: "palabra",
initialize: function () {
this.render();
if (quiz.get("mode") == "Play") {
$(this.el).draggable({containment: "parent", cursor: "move", revert: true});
}
$(this.el).droppable({
drop: function( event, ui ) {
var other = ui.draggable[0];
if (this.id == other.id) {
if ('speechSynthesis' in window && quiz.get("sound")) {
// Synthesis support. Make your web apps talk!
var msg = new SpeechSynthesisUtterance(this.model.palabra.get("spanish"));
msg.lang = 'es-ES';
msg.rate = 0.9; // 0.1 to 10
msg.pitch = 0.9; //0 to 2
window.speechSynthesis.speak(msg);
}
$(this).html($(this).text() + " - " + $(other).text());
$(this).fadeOut(1500);
$(other).remove();
quiz.triggerMatch();
}
}
});
$(this.el).on( "taphold", function(event) {
var position = $(this).position();
if ( Math.abs(position.top - this.origTop) <= 10 &&
Math.abs(position.left - this.origLeft) <= 10) {
// alert("long tap event");
editItemForm.openForm(this.model.palabra);
}
});
$(this.el).on( "click", function(event) {
if (quiz.get("mode") == "Edit" && quiz.get("sound")) {
if ('speechSynthesis' in window) {
// Synthesis support. Make your web apps talk!
var msg = new SpeechSynthesisUtterance(this.model.palabra.get("spanish"));
msg.lang = 'es-ES';
msg.rate = 0.9; // 0.1 to 10
msg.pitch = 0.9; //0 to 2
window.speechSynthesis.speak(msg);
}
}
});
},
render: function () {
$(this.el).html(this.model.text);
this.el.id = this.model.palabra.cid; // augment element with id for matching
this.el.model = this.model; // augment with model for edit form initialization
$(this.el).hide().appendTo("#palabras-container").fadeIn(1500);
// $("#palabras-container").append(this.el);
var containerWidth = $(this.el).parent().width();
var left = this.model.leftside ? 0 : containerWidth/2;
var top = this.model.y - 10;
$(this.el).parent().css({position: 'relative'});
$(this.el).css({top: top, left: left, position:'absolute'});
$(this.el).width( 0.4*containerWidth );
$(this.el).height( $(this.el).height() + 10);
var position = $(this.el).position();
this.el.origTop = position.top;
this.el.origLeft = position.left;
}
});
});
| mit |
thunderhoser/GewitterGefahr | gewittergefahr/scripts/compare_human_vs_machine_interpretn.py | 26120 | """Compares human-generated vs. machine-generated interpretation map.
This script handles 3 types of interpretation maps:
- saliency
- Grad-CAM
- guided Grad-CAM
"""
import os.path
import argparse
import numpy
import matplotlib
matplotlib.use('agg')
import matplotlib.pyplot as pyplot
from gewittergefahr.gg_utils import human_polygons
from gewittergefahr.gg_utils import storm_tracking_utils as tracking_utils
from gewittergefahr.gg_utils import file_system_utils
from gewittergefahr.gg_utils import error_checking
from gewittergefahr.deep_learning import cnn
from gewittergefahr.deep_learning import saliency_maps
from gewittergefahr.deep_learning import gradcam
from gewittergefahr.deep_learning import training_validation_io as trainval_io
from gewittergefahr.plotting import plotting_utils
from gewittergefahr.plotting import radar_plotting
TOLERANCE = 1e-6
METRES_TO_KM = 0.001
TIME_FORMAT = '%Y-%m-%d-%H%M%S'
MARKER_TYPE = 'o'
MARKER_SIZE = 15
MARKER_EDGE_WIDTH = 1
MARKER_COLOUR = numpy.full(3, 0.)
HUMAN_STRING = 'H'
MACHINE_STRING = 'M'
OVERLAY_FONT_SIZE = 20
OVERLAY_FONT_COLOUR = numpy.full(3, 0.)
FIGURE_WIDTH_INCHES = 15
FIGURE_HEIGHT_INCHES = 15
FIGURE_RESOLUTION_DPI = 300
MACHINE_POSITIVE_MASK_KEY = 'machine_positive_mask_matrix_2d'
POSITIVE_IOU_KEY = 'positive_iou'
MACHINE_NEGATIVE_MASK_KEY = 'machine_negative_mask_matrix_2d'
NEGATIVE_IOU_KEY = 'negative_iou'
HUMAN_FILE_ARG_NAME = 'input_human_file_name'
MACHINE_FILE_ARG_NAME = 'input_machine_file_name'
GUIDED_GRADCAM_ARG_NAME = 'guided_gradcam_flag'
THRESHOLD_ARG_NAME = 'abs_percentile_threshold'
OUTPUT_DIR_ARG_NAME = 'output_dir_name'
HUMAN_FILE_HELP_STRING = (
'Path to file with human-generated polygons. Will be read by '
'`human_polygons.read_polygons`.')
MACHINE_FILE_HELP_STRING = (
'Path to file with machine-generated interpretation map. Will be read by '
'`saliency_maps.read_standard_file`, `saliency_maps.read_pmm_file`, '
'`gradcam.read_pmm_file`, or `gradcam.read_pmm_file`.')
GUIDED_GRADCAM_HELP_STRING = (
'[used only if `{0:s}` contains Grad-CAM output] Boolean flag. If 1, will '
'compare human polygons with guided Grad-CAM. If 0, will compare with '
'simple Grad-CAM.'
).format(MACHINE_FILE_ARG_NAME)
THRESHOLD_HELP_STRING = (
'Threshold for interpretation quantity (I). Human polygons will be turned '
'into interpretation maps by assuming that (1) all grid points in a '
'positive polygon have I >= p, where p is the `{0:s}`th percentile of '
'positive values in the machine-generated map; and (2) all grid points '
'inside a negative polygon have I <= q, where q is the (100 - `{0:s}`)th '
'percentile of negative values in the machine-generated map. If you want '
'this to be set adaptively, leave the argument alone.'
).format(THRESHOLD_ARG_NAME)
OUTPUT_DIR_HELP_STRING = (
'Name of output directory (figures will be saved here).')
INPUT_ARG_PARSER = argparse.ArgumentParser()
INPUT_ARG_PARSER.add_argument(
'--' + HUMAN_FILE_ARG_NAME, type=str, required=True,
help=HUMAN_FILE_HELP_STRING)
INPUT_ARG_PARSER.add_argument(
'--' + MACHINE_FILE_ARG_NAME, type=str, required=True,
help=MACHINE_FILE_HELP_STRING)
INPUT_ARG_PARSER.add_argument(
'--' + GUIDED_GRADCAM_ARG_NAME, type=int, required=False, default=0,
help=GUIDED_GRADCAM_HELP_STRING)
INPUT_ARG_PARSER.add_argument(
'--' + THRESHOLD_ARG_NAME, type=float, required=False, default=-1.,
help=THRESHOLD_HELP_STRING)
INPUT_ARG_PARSER.add_argument(
'--' + OUTPUT_DIR_ARG_NAME, type=str, required=True,
help=OUTPUT_DIR_HELP_STRING)
def _compute_iou(machine_mask_matrix, human_mask_matrix):
"""Computes IoU (intersection over union) between human and machine masks.
:param machine_mask_matrix: Boolean numpy array, representing areas of
extreme positive or negative interpretation values.
:param human_mask_matrix: Same but for human. The two numpy arrays must
have the same shape.
:return: iou: Intersection over union between the two masks.
"""
union_matrix = numpy.logical_or(machine_mask_matrix, human_mask_matrix)
intersection_matrix = numpy.logical_and(
machine_mask_matrix, human_mask_matrix)
return float(numpy.sum(intersection_matrix)) / numpy.sum(union_matrix)
def _plot_comparison_one_channel(
machine_mask_matrix_3d, human_mask_matrix_3d, channel_index,
axes_object_matrix):
"""Plots human/machine comparison for one channel.
J = number of panel rows
K = number of panel columns
:param machine_mask_matrix_3d: See doc for `_plot_comparison`.
:param human_mask_matrix_3d: Same.
:param channel_index: Channel index. Will plot comparison for only this
channel.
:param axes_object_matrix: J-by-K numpy array of axes handles (instances
of `matplotlib.axes._subplots.AxesSubplot`).
"""
i, j = numpy.unravel_index(
channel_index, axes_object_matrix.shape, order='F'
)
this_axes_object = axes_object_matrix[i, j]
these_grid_rows, these_grid_columns = numpy.where(numpy.logical_and(
machine_mask_matrix_3d[..., channel_index],
human_mask_matrix_3d[..., channel_index]
))
these_grid_rows = these_grid_rows + 0.5
these_grid_columns = these_grid_columns + 0.5
if len(these_grid_rows) > 0:
marker_colour_as_tuple = plotting_utils.colour_from_numpy_to_tuple(
MARKER_COLOUR)
this_axes_object.plot(
these_grid_columns, these_grid_rows, linestyle='None',
marker=MARKER_TYPE, markersize=MARKER_SIZE,
markeredgewidth=MARKER_EDGE_WIDTH,
markerfacecolor=marker_colour_as_tuple,
markeredgecolor=marker_colour_as_tuple)
these_grid_rows, these_grid_columns = numpy.where(numpy.logical_and(
machine_mask_matrix_3d[..., channel_index],
numpy.invert(human_mask_matrix_3d[..., channel_index])
))
these_grid_rows = these_grid_rows + 0.5
these_grid_columns = these_grid_columns + 0.5
for k in range(len(these_grid_rows)):
this_axes_object.text(
these_grid_columns[k], these_grid_rows[k], MACHINE_STRING,
fontsize=OVERLAY_FONT_SIZE, color=OVERLAY_FONT_COLOUR,
fontweight='bold', horizontalalignment='center',
verticalalignment='center')
these_grid_rows, these_grid_columns = numpy.where(numpy.logical_and(
numpy.invert(machine_mask_matrix_3d[..., channel_index]),
human_mask_matrix_3d[..., channel_index]
))
these_grid_rows = these_grid_rows + 0.5
these_grid_columns = these_grid_columns + 0.5
for k in range(len(these_grid_rows)):
this_axes_object.text(
these_grid_columns[k], these_grid_rows[k], HUMAN_STRING,
fontsize=OVERLAY_FONT_SIZE, color=OVERLAY_FONT_COLOUR,
fontweight='bold', horizontalalignment='center',
verticalalignment='center')
def _plot_comparison(
predictor_matrix, model_metadata_dict, machine_mask_matrix_3d,
human_mask_matrix_3d, iou_by_channel, positive_flag, output_file_name):
"""Plots comparison between human and machine interpretation maps.
M = number of rows in grid (physical space)
N = number of columns in grid (physical space)
C = number of channels
:param predictor_matrix: M-by-N-by-C numpy array of predictors.
:param model_metadata_dict: Dictionary returned by
`cnn.read_model_metadata`.
:param machine_mask_matrix_3d: M-by-N-by-C numpy array of Boolean flags,
indicating where machine interpretation value is strongly positive or
negative.
:param human_mask_matrix_3d: Same.
:param iou_by_channel: length-C numpy array of IoU values (intersection over
union) between human and machine masks.
:param positive_flag: Boolean flag. If True (False), masks indicate where
interpretation value is strongly positive (negative).
:param output_file_name: Path to output file (figure will be saved here).
"""
training_option_dict = model_metadata_dict[cnn.TRAINING_OPTION_DICT_KEY]
list_of_layer_operation_dicts = model_metadata_dict[
cnn.LAYER_OPERATIONS_KEY]
if list_of_layer_operation_dicts is None:
field_name_by_panel = training_option_dict[trainval_io.RADAR_FIELDS_KEY]
panel_names = radar_plotting.fields_and_heights_to_names(
field_names=field_name_by_panel,
heights_m_agl=training_option_dict[trainval_io.RADAR_HEIGHTS_KEY]
)
plot_colour_bar_by_panel = numpy.full(
len(field_name_by_panel), True, dtype=bool
)
else:
field_name_by_panel, panel_names = (
radar_plotting.layer_operations_to_names(
list_of_layer_operation_dicts=list_of_layer_operation_dicts
)
)
plot_colour_bar_by_panel = numpy.full(
len(field_name_by_panel), False, dtype=bool
)
plot_colour_bar_by_panel[2::3] = True
num_panels = len(field_name_by_panel)
num_panel_rows = int(numpy.floor(
numpy.sqrt(num_panels)
))
for k in range(num_panels):
panel_names[k] += '\n{0:s} IoU = {1:.3f}'.format(
'Positive' if positive_flag else 'Negative',
iou_by_channel[k]
)
axes_object_matrix = radar_plotting.plot_many_2d_grids_without_coords(
field_matrix=numpy.flip(predictor_matrix, axis=0),
field_name_by_panel=field_name_by_panel, panel_names=panel_names,
num_panel_rows=num_panel_rows,
plot_colour_bar_by_panel=plot_colour_bar_by_panel, font_size=14,
row_major=False
)[1]
for k in range(num_panels):
_plot_comparison_one_channel(
human_mask_matrix_3d=human_mask_matrix_3d,
machine_mask_matrix_3d=numpy.flip(machine_mask_matrix_3d, axis=0),
channel_index=k, axes_object_matrix=axes_object_matrix)
print('Saving figure to: "{0:s}"...'.format(output_file_name))
pyplot.savefig(output_file_name, dpi=FIGURE_RESOLUTION_DPI,
pad_inches=0., bbox_inches='tight')
pyplot.close()
def _reshape_human_maps(model_metadata_dict, positive_mask_matrix_4d,
negative_mask_matrix_4d):
"""Reshapes human interpretation maps to match machine interpretation maps.
M = number of rows in grid (physical space)
N = number of columns in grid (physical space)
J = number of panel rows
K = number of panel columns
C = J * K = number of channels
:param model_metadata_dict: Dictionary returned by
`cnn.read_model_metadata`.
:param positive_mask_matrix_4d: J-by-K-by-M-by-N numpy array of Boolean
flags.
:param negative_mask_matrix_4d: Same, except this may be None.
:return: positive_mask_matrix_3d: M-by-N-by-C numpy array of Boolean flags,
with values matching `positive_mask_matrix_4d`.
:return: negative_mask_matrix_3d: M-by-N-by-C numpy array of Boolean flags,
with values matching `negative_mask_matrix_4d`. If
`negative_mask_matrix_4d is None`, this is also None.
:raises: TypeError: if model performs 2-D and 3-D convolution.
:raises: ValueError: if number of channels in mask != number of input
channels to model (in the predictor matrix).
"""
if model_metadata_dict[cnn.CONV_2D3D_KEY]:
raise TypeError(
'This script cannot handle models that perform 2-D and 3-D'
'convolution.'
)
training_option_dict = model_metadata_dict[cnn.TRAINING_OPTION_DICT_KEY]
list_of_layer_operation_dicts = model_metadata_dict[
cnn.LAYER_OPERATIONS_KEY]
if list_of_layer_operation_dicts is None:
num_machine_channels = len(
training_option_dict[trainval_io.RADAR_FIELDS_KEY]
)
else:
num_machine_channels = len(list_of_layer_operation_dicts)
num_panel_rows = positive_mask_matrix_4d.shape[0]
num_panel_columns = positive_mask_matrix_4d.shape[1]
num_human_channels = num_panel_rows * num_panel_columns
if num_machine_channels != num_human_channels:
error_string = (
'Number of channels in human masks ({0:d}) != number of input '
'channels to model ({1:d}).'
).format(num_human_channels, num_machine_channels)
raise ValueError(error_string)
this_shape = positive_mask_matrix_4d.shape[2:] + (num_human_channels,)
positive_mask_matrix_3d = numpy.full(this_shape, False, dtype=bool)
if negative_mask_matrix_4d is None:
negative_mask_matrix_3d = None
else:
negative_mask_matrix_3d = numpy.full(this_shape, False, dtype=bool)
for k in range(num_human_channels):
this_panel_row, this_panel_column = numpy.unravel_index(
k, (num_panel_rows, num_panel_columns), order='F'
)
positive_mask_matrix_3d[..., k] = positive_mask_matrix_4d[
this_panel_row, this_panel_column, ...]
if negative_mask_matrix_3d is None:
continue
negative_mask_matrix_3d[..., k] = negative_mask_matrix_4d[
this_panel_row, this_panel_column, ...]
return positive_mask_matrix_3d, negative_mask_matrix_3d
def _do_comparison_one_channel(
machine_interpretation_matrix_2d, abs_percentile_threshold,
human_positive_mask_matrix_2d, human_negative_mask_matrix_2d=None):
"""Compares human and machine masks for one channel.
M = number of rows in grid (physical space)
N = number of columns in grid (physical space)
:param machine_interpretation_matrix_2d: M-by-N numpy array of
interpretation values (floats).
:param abs_percentile_threshold: See documentation at top of file. This
will be used to turn `machine_interpretation_matrix_2d` into one or two
masks.
:param human_positive_mask_matrix_2d: M-by-N numpy array of Boolean flags,
indicating where the human thinks the interpretation value is strongly
POSITIVE.
:param human_negative_mask_matrix_2d: M-by-N numpy array of Boolean flags,
indicating where the human thinks the interpretation value is strongly
NEGATIVE. This may be None.
:return: comparison_dict: Dictionary with the following keys.
comparison_dict['machine_positive_mask_matrix_2d']: Same as
`human_positive_mask_matrix_2d` but for the machine.
comparison_dict['positive_iou']: IoU (intersection over union) between
positive masks for human and machine.
comparison_dict['machine_negative_mask_matrix_2d']: Same as
`human_negative_mask_matrix_2d` but for the machine. If
`human_negative_mask_matrix_2d is None`, this is None.
comparison_dict['negative_iou']: IoU (intersection over union) between
negative masks for human and machine. If
`human_negative_mask_matrix_2d is None`, this is None.
"""
if abs_percentile_threshold is None:
this_percentile_threshold = 100 * (
1 - numpy.mean(human_positive_mask_matrix_2d)
)
else:
this_percentile_threshold = abs_percentile_threshold + 0.
print(this_percentile_threshold)
if numpy.any(machine_interpretation_matrix_2d > 0):
positive_threshold = numpy.percentile(
machine_interpretation_matrix_2d[
machine_interpretation_matrix_2d > 0],
this_percentile_threshold
)
else:
positive_threshold = TOLERANCE + 0.
machine_positive_mask_matrix_2d = (
machine_interpretation_matrix_2d >= positive_threshold
)
positive_iou = _compute_iou(
machine_mask_matrix=machine_positive_mask_matrix_2d,
human_mask_matrix=human_positive_mask_matrix_2d)
comparison_dict = {
MACHINE_POSITIVE_MASK_KEY: machine_positive_mask_matrix_2d,
POSITIVE_IOU_KEY: positive_iou,
MACHINE_NEGATIVE_MASK_KEY: None,
NEGATIVE_IOU_KEY: None
}
if human_negative_mask_matrix_2d is None:
return comparison_dict
if abs_percentile_threshold is None:
this_percentile_threshold = (
100 * numpy.mean(human_negative_mask_matrix_2d)
)
else:
this_percentile_threshold = 100. - abs_percentile_threshold
print(this_percentile_threshold)
if numpy.any(machine_interpretation_matrix_2d < 0):
negative_threshold = numpy.percentile(
machine_interpretation_matrix_2d[
machine_interpretation_matrix_2d < 0],
this_percentile_threshold
)
else:
negative_threshold = -1 * TOLERANCE
machine_negative_mask_matrix_2d = (
machine_interpretation_matrix_2d <= negative_threshold
)
negative_iou = _compute_iou(
machine_mask_matrix=machine_negative_mask_matrix_2d,
human_mask_matrix=human_negative_mask_matrix_2d)
comparison_dict[MACHINE_NEGATIVE_MASK_KEY] = machine_negative_mask_matrix_2d
comparison_dict[NEGATIVE_IOU_KEY] = negative_iou
return comparison_dict
def _run(input_human_file_name, input_machine_file_name, guided_gradcam_flag,
abs_percentile_threshold, output_dir_name):
"""Compares human-generated vs. machine-generated interpretation map.
This is effectively the main method.
:param input_human_file_name: See documentation at top of file.
:param input_machine_file_name: Same.
:param guided_gradcam_flag: Same.
:param abs_percentile_threshold: Same.
:param output_dir_name: Same.
"""
file_system_utils.mkdir_recursive_if_necessary(
directory_name=output_dir_name)
if abs_percentile_threshold < 0:
abs_percentile_threshold = None
if abs_percentile_threshold is not None:
error_checking.assert_is_leq(abs_percentile_threshold, 100.)
print('Reading data from: "{0:s}"...'.format(input_human_file_name))
human_polygon_dict = human_polygons.read_polygons(input_human_file_name)
human_positive_mask_matrix_4d = human_polygon_dict[
human_polygons.POSITIVE_MASK_MATRIX_KEY]
human_negative_mask_matrix_4d = human_polygon_dict[
human_polygons.NEGATIVE_MASK_MATRIX_KEY]
full_storm_id_string = human_polygon_dict[human_polygons.STORM_ID_KEY]
storm_time_unix_sec = human_polygon_dict[human_polygons.STORM_TIME_KEY]
pmm_flag = full_storm_id_string is None and storm_time_unix_sec is None
print('Reading data from: "{0:s}"...'.format(input_machine_file_name))
# TODO(thunderhoser): This is a HACK.
machine_channel_indices = numpy.array([2, 8], dtype=int)
if pmm_flag:
try:
saliency_dict = saliency_maps.read_pmm_file(input_machine_file_name)
saliency_flag = True
model_file_name = saliency_dict[saliency_maps.MODEL_FILE_KEY]
predictor_matrix = saliency_dict.pop(
saliency_maps.MEAN_INPUT_MATRICES_KEY
)[0][..., machine_channel_indices]
machine_interpretation_matrix_3d = saliency_dict.pop(
saliency_maps.MEAN_SALIENCY_MATRICES_KEY
)[0][..., machine_channel_indices]
except ValueError:
gradcam_dict = gradcam.read_pmm_file(input_machine_file_name)
saliency_flag = False
model_file_name = gradcam_dict[gradcam.MODEL_FILE_KEY]
predictor_matrix = gradcam_dict.pop(
gradcam.MEAN_INPUT_MATRICES_KEY
)[0][..., machine_channel_indices]
if guided_gradcam_flag:
machine_interpretation_matrix_3d = gradcam_dict.pop(
gradcam.MEAN_GUIDED_GRADCAM_KEY
)[..., machine_channel_indices]
else:
machine_interpretation_matrix_3d = gradcam_dict.pop(
gradcam.MEAN_CLASS_ACTIVATIONS_KEY)
else:
try:
saliency_dict = saliency_maps.read_standard_file(
input_machine_file_name)
saliency_flag = True
all_full_id_strings = saliency_dict[saliency_maps.FULL_IDS_KEY]
all_times_unix_sec = saliency_dict[saliency_maps.STORM_TIMES_KEY]
model_file_name = saliency_dict[saliency_maps.MODEL_FILE_KEY]
predictor_matrix = saliency_dict.pop(
saliency_maps.INPUT_MATRICES_KEY
)[0][..., machine_channel_indices]
machine_interpretation_matrix_3d = saliency_dict.pop(
saliency_maps.SALIENCY_MATRICES_KEY
)[0][..., machine_channel_indices]
except ValueError:
gradcam_dict = gradcam.read_standard_file(input_machine_file_name)
saliency_flag = False
all_full_id_strings = gradcam_dict[gradcam.FULL_IDS_KEY]
all_times_unix_sec = gradcam_dict[gradcam.STORM_TIMES_KEY]
model_file_name = gradcam_dict[gradcam.MODEL_FILE_KEY]
predictor_matrix = gradcam_dict.pop(
gradcam.INPUT_MATRICES_KEY
)[0][..., machine_channel_indices]
if guided_gradcam_flag:
machine_interpretation_matrix_3d = gradcam_dict.pop(
gradcam.GUIDED_GRADCAM_KEY
)[..., machine_channel_indices]
else:
machine_interpretation_matrix_3d = gradcam_dict.pop(
gradcam.CLASS_ACTIVATIONS_KEY)
storm_object_index = tracking_utils.find_storm_objects(
all_id_strings=all_full_id_strings,
all_times_unix_sec=all_times_unix_sec,
id_strings_to_keep=[full_storm_id_string],
times_to_keep_unix_sec=numpy.array(
[storm_time_unix_sec], dtype=int
),
allow_missing=False
)[0]
predictor_matrix = predictor_matrix[storm_object_index, ...]
machine_interpretation_matrix_3d = machine_interpretation_matrix_3d[
storm_object_index, ...]
if not saliency_flag and not guided_gradcam_flag:
machine_interpretation_matrix_3d = numpy.expand_dims(
machine_interpretation_matrix_3d, axis=-1)
machine_interpretation_matrix_3d = numpy.repeat(
a=machine_interpretation_matrix_3d,
repeats=predictor_matrix.shape[-1], axis=-1)
if not (saliency_flag or guided_gradcam_flag):
human_negative_mask_matrix_4d = None
model_metafile_name = '{0:s}/model_metadata.p'.format(
os.path.split(model_file_name)[0]
)
print('Reading metadata from: "{0:s}"...'.format(model_metafile_name))
model_metadata_dict = cnn.read_model_metadata(model_metafile_name)
model_metadata_dict[cnn.LAYER_OPERATIONS_KEY] = [
model_metadata_dict[cnn.LAYER_OPERATIONS_KEY][k]
for k in machine_channel_indices
]
human_positive_mask_matrix_3d, human_negative_mask_matrix_3d = (
_reshape_human_maps(
model_metadata_dict=model_metadata_dict,
positive_mask_matrix_4d=human_positive_mask_matrix_4d,
negative_mask_matrix_4d=human_negative_mask_matrix_4d)
)
num_channels = human_positive_mask_matrix_3d.shape[-1]
machine_positive_mask_matrix_3d = numpy.full(
human_positive_mask_matrix_3d.shape, False, dtype=bool)
positive_iou_by_channel = numpy.full(num_channels, numpy.nan)
if human_negative_mask_matrix_3d is None:
machine_negative_mask_matrix_3d = None
negative_iou_by_channel = None
else:
machine_negative_mask_matrix_3d = numpy.full(
human_negative_mask_matrix_3d.shape, False, dtype=bool)
negative_iou_by_channel = numpy.full(num_channels, numpy.nan)
for k in range(num_channels):
this_negative_matrix = (
None if human_negative_mask_matrix_3d is None
else human_negative_mask_matrix_3d[..., k]
)
this_comparison_dict = _do_comparison_one_channel(
machine_interpretation_matrix_2d=machine_interpretation_matrix_3d[
..., k],
abs_percentile_threshold=abs_percentile_threshold,
human_positive_mask_matrix_2d=human_positive_mask_matrix_3d[..., k],
human_negative_mask_matrix_2d=this_negative_matrix)
machine_positive_mask_matrix_3d[..., k] = this_comparison_dict[
MACHINE_POSITIVE_MASK_KEY]
positive_iou_by_channel[k] = this_comparison_dict[POSITIVE_IOU_KEY]
if human_negative_mask_matrix_3d is None:
continue
machine_negative_mask_matrix_3d[..., k] = this_comparison_dict[
MACHINE_NEGATIVE_MASK_KEY]
negative_iou_by_channel[k] = this_comparison_dict[NEGATIVE_IOU_KEY]
this_file_name = '{0:s}/positive_comparison.jpg'.format(output_dir_name)
_plot_comparison(
predictor_matrix=predictor_matrix,
model_metadata_dict=model_metadata_dict,
machine_mask_matrix_3d=machine_positive_mask_matrix_3d,
human_mask_matrix_3d=human_positive_mask_matrix_3d,
iou_by_channel=positive_iou_by_channel,
positive_flag=True, output_file_name=this_file_name)
if human_negative_mask_matrix_3d is None:
return
this_file_name = '{0:s}/negative_comparison.jpg'.format(output_dir_name)
_plot_comparison(
predictor_matrix=predictor_matrix,
model_metadata_dict=model_metadata_dict,
machine_mask_matrix_3d=machine_negative_mask_matrix_3d,
human_mask_matrix_3d=human_negative_mask_matrix_3d,
iou_by_channel=negative_iou_by_channel,
positive_flag=False, output_file_name=this_file_name)
if __name__ == '__main__':
INPUT_ARG_OBJECT = INPUT_ARG_PARSER.parse_args()
_run(
input_human_file_name=getattr(INPUT_ARG_OBJECT, HUMAN_FILE_ARG_NAME),
input_machine_file_name=getattr(
INPUT_ARG_OBJECT, MACHINE_FILE_ARG_NAME),
guided_gradcam_flag=bool(getattr(
INPUT_ARG_OBJECT, GUIDED_GRADCAM_ARG_NAME)),
abs_percentile_threshold=getattr(INPUT_ARG_OBJECT, THRESHOLD_ARG_NAME),
output_dir_name=getattr(INPUT_ARG_OBJECT, OUTPUT_DIR_ARG_NAME)
)
| mit |
PrinceOfAmber/PersonalWebsite | blog/views/layout/head.php | 651 |
<link rel="stylesheet" type="text/css" href="css/global.css">
<link rel="stylesheet" type="text/css" href="css/icons.css">
<link rel="stylesheet" type="text/css" href="css/left_menu.css">
<script src="plugins/modernizr-2.7.1.js" type="text/javascript" defer="defer"></script>
<script src="plugins/html5boilerplate.js" type="text/javascript" defer="defer"></script>
<script src="plugins/jquery-1.10.2.min.js" type="text/javascript"></script>
<script src="plugins/bootstrap/js/bootstrap.min.js" type="text/javascript" defer="defer"></script>
<link rel="stylesheet" type="text/css" href="plugins/bootstrap/css/bootstrap.min.css">
| mit |
ralphpina/VideoPlayer | app/src/main/java/net/ralphpina/famigo/videoplayer/app/VideoPlayingActivity.java | 6363 | package net.ralphpina.famigo.videoplayer.app;
import android.annotation.TargetApi;
import android.app.Activity;
import android.media.MediaPlayer;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.support.v4.app.NavUtils;
import android.view.MenuItem;
import android.view.View;
import android.widget.MediaController;
import android.widget.VideoView;
import net.ralphpina.famigo.videoplayer.app.util.SystemUiHider;
/**
* An example full-screen activity that shows and hides the system UI (i.e.
* status bar and navigation/system bar) with user interaction.
*
* @see SystemUiHider
*/
public class VideoPlayingActivity extends Activity {
/**
* Whether or not the system UI should be auto-hidden after
* {@link #AUTO_HIDE_DELAY_MILLIS} milliseconds.
*/
private static final boolean AUTO_HIDE = true;
/**
* If {@link #AUTO_HIDE} is set, the number of milliseconds to wait after
* user interaction before hiding the system UI.
*/
private static final int AUTO_HIDE_DELAY_MILLIS = 3000;
/**
* If set, will toggle the system UI visibility upon interaction. Otherwise,
* will show the system UI visibility upon interaction.
*/
private static final boolean TOGGLE_ON_CLICK = true;
/**
* The flags to pass to {@link SystemUiHider#getInstance}.
*/
private static final int HIDER_FLAGS = SystemUiHider.FLAG_HIDE_NAVIGATION;
/**
* The instance of the {@link SystemUiHider} for this activity.
*/
private SystemUiHider mSystemUiHider;
private VideoView mVideoView;
private MediaController mMediaController;
private VideosManager mVideosManager;
private Video mVideo;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_video_playing);
mVideosManager = VideosManager.getInstance();
mVideo = mVideosManager.getCurrentVideo();
setupActionBar();
mVideoView = (VideoView) findViewById(R.id.videoView);
// Set up an instance of SystemUiHider to control the system UI for
// this activity.
mSystemUiHider = SystemUiHider.getInstance(this, mVideoView, HIDER_FLAGS);
mSystemUiHider.setup();
mSystemUiHider
.setOnVisibilityChangeListener(new SystemUiHider.OnVisibilityChangeListener() {
@Override
@TargetApi(Build.VERSION_CODES.HONEYCOMB_MR2)
public void onVisibilityChange(boolean visible) {
if (visible && AUTO_HIDE) {
// Schedule a hide().
delayedHide(AUTO_HIDE_DELAY_MILLIS);
}
}
});
mVideoView.setOnCompletionListener(new PlayerOnCompleteVideo());
mMediaController = new MediaController(this);
mMediaController.setMediaPlayer(mVideoView);
mMediaController.setPrevNextListeners(new NextOnClickListener(), new PreviousOnClickListener());
mVideoView.setMediaController(mMediaController);
mVideoView.requestFocus();
playVideo();
}
@Override
protected void onPostCreate(Bundle savedInstanceState) {
super.onPostCreate(savedInstanceState);
// Trigger the initial hide() shortly after the activity has been
// created, to briefly hint to the user that UI controls
// are available.
delayedHide(100);
}
/**
* Set up the {@link android.app.ActionBar}, if the API is available.
*/
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
private void setupActionBar() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
// Show the Up button in the action bar.
getActionBar().setDisplayHomeAsUpEnabled(true);
getActionBar().setTitle(mVideo.getTitle());
}
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId();
if (id == android.R.id.home) {
// This ID represents the Home or Up button. In the case of this
// activity, the Up button is shown. Use NavUtils to allow users
// to navigate up one level in the application structure. For
// more details, see the Navigation pattern on Android Design:
//
// http://developer.android.com/design/patterns/navigation.html#up-vs-back
//
// TODO: If Settings has multiple levels, Up should navigate up
// that hierarchy.
NavUtils.navigateUpFromSameTask(this);
return true;
}
return super.onOptionsItemSelected(item);
}
Handler mHideHandler = new Handler();
Runnable mHideRunnable = new Runnable() {
@Override
public void run() {
mSystemUiHider.hide();
}
};
/**
* Schedules a call to hide() in [delay] milliseconds, canceling any
* previously scheduled calls.
*/
private void delayedHide(int delayMillis) {
mHideHandler.removeCallbacks(mHideRunnable);
mHideHandler.postDelayed(mHideRunnable, delayMillis);
}
private class PlayerOnCompleteVideo implements MediaPlayer.OnCompletionListener {
@Override
public void onCompletion(MediaPlayer mp) {
mVideo = mVideosManager.getNextVideo();
setupActionBar();
mVideoView.stopPlayback();
playVideo();
}
}
private class PreviousOnClickListener implements View.OnClickListener {
@Override
public void onClick(View v) {
mVideo = mVideosManager.getPreviousVideo();
setupActionBar();
mVideoView.stopPlayback();
playVideo();
}
}
private class NextOnClickListener implements View.OnClickListener {
@Override
public void onClick(View v) {
mVideo = mVideosManager.getNextVideo();
setupActionBar();
mVideoView.stopPlayback();
playVideo();
}
}
private void playVideo() {
mVideoView.setVideoURI(Uri.parse(mVideo.getContentData()));
mVideoView.start();
}
}
| mit |
RonAlmog/meanjs | app/models/car.server.model.js | 586 | 'use strict';
/**
* Module dependencies.
*/
var mongoose = require('mongoose'),
Schema = mongoose.Schema;
/**
* Car Schema
*/
var CarSchema = new Schema({
name: {
type: String,
default: '',
required: 'Please fill Car name',
trim: true
},
maker:{
type: String,
default: '',
required: 'Please fill Car maker',
trim: true
},
engine:{
type: String,
default: '',
required: 'Please fill Engine size',
trim: true
},
created: {
type: Date,
default: Date.now
},
user: {
type: Schema.ObjectId,
ref: 'User'
}
});
mongoose.model('Car', CarSchema);
| mit |
WiTH-Collective/ie-prompt | ie-prompt.js | 4871 | /*! IE Prompt - v0.1; Copyright 2015 WiTH Collective; Licensed MIT */
(function () {
"use strict";
var props = {
// namespace
name: "ie-prompt",
// min IE version - override with <script data-ie="{version}">
ie: 11,
// default prompt element
prompt: {
id: "ie-prompt",
close: "ie-prompt-close",
msg: "Sorry! Your browser (Internet Explorer %ie%) is out of date.<br>
Please update your browser for the best experience on this site.",
url: "http://windows.microsoft.com/en-AU/internet-explorer/download-ie",
// include as a single line if script is included un-minified
template: '<div class="ie-prompt" id="ie-prompt" role="alert" aria-labelledby="ie-prompt-label" aria-describedby="ie-prompt-description">
<div class="container">
<button class="ie-prompt__button" id="ie-prompt-close">Close alert</button>
<p class="ie-prompt__msg" id="ie-prompt-label">%msg%</p>
<p class="ie-prompt__paragraph"><a id="ie-prompt-description" href="%url%" target="_blank">Update your browser now</a></p>
</div>
</div>',
// include as a single line if script is included un-minified
style: '.ie-prompt {
background: #8de2e0;
border-bottom: 2px solid #31bfbc;
font-family: monospace;
left: 0;
padding-top: 1em;
position: absolute;
right: 0;
text-align: center;
top: 0;
z-index: 1000;
}
.ie-prompt + * {
margin-top: 7.3em;
}
[data-demo] ~ .ie-prompt:after {
background: red;
color: white;
content: "DEMO PROMPT";
display: block;
margin-top: 2px;
opacity: 0.15;
position: absolute;
width: 100%;
}'
}
},
fn = {
init: function () {
// current IE version
var demo = fn.attr('demo'),
version = demo || fn.version();
// check browser is IE
if(!version) {
return;
}
// add IE classes to <html>
document.documentElement.className += ' ie ie' + version;
// cookie (safe namespace)
props.cookie = props.name.toLowerCase().replace(/[^a-z]/g, '');
// min IE version
props.min = +fn.attr('ie', props.ie);
// check min version
if(version>=props.min || !props.prompt.template || document.cookie.indexOf(props.cookie)>=0) {
return;
}
// add namespace class
document.documentElement.className += ' lt-ie' + props.min;
// cancel render
if(fn.hasAttr('norender')) {
return;
}
// prompt message
props.msg = fn.attr('msg', props.prompt.msg);
// download url
props.url = fn.attr('url', props.prompt.url);
// get template and update variables
props.template = fn.attr('template', props.prompt.template);
// add style to dom if default template
if(props.template===props.prompt.template) {
document.write('<style type="text/css">' + props.prompt.style + '</style>');
}
// add element to dom
document.write(props.template.replace(/%msg%/g, props.msg).replace(/%ie%/g, version).replace(/%url%/g, props.url));
// add event listener
if(props.prompt.close) {
(document.getElementById(props.prompt.close) || {}).onclick = fn.close;
}
},
close: function () {
// create session cookie (unless [data-nocookie] is set)
if(!fn.hasAttr('nocookie')) {
document.cookie = props.cookie + '=0; path=/';
}
// remove element
var el = document.getElementById(props.prompt.id);
if(el) {
el.parentNode.removeChild(el);
}
},
hasAttr: function (name) {
var attr = fn.attr(name);
return attr || attr === "";
},
attr: function (name, fallback) {
// script tag
if(typeof props.tag === "undefined") {
var tags = document.getElementsByTagName('script');
props.tag = tags.length ? tags[tags.length - 1] : 0;
}
var attr = props.tag ? props.tag.getAttribute("data-" + name) : fallback;
return attr || attr === "" ? attr : fallback;
},
version: function () {
// check major version
var version = typeof ScriptEngineMajorVersion === "function" ? ScriptEngineMajorVersion() : undefined;
// check minor version (<=IE8)
if(version===5 && typeof ScriptEngineMinorVersion === "function") {
version = ScriptEngineMinorVersion();
}
return version || undefined;
}
};
fn.init();
})(); | mit |
samybob1/down-checker | core/Fetcher.php | 1143 | <?php
class Fetcher
{
/**
* @var resource
*/
protected $ch;
public function __construct()
{
$this->ch = curl_init();
curl_setopt_array($this->ch, array(
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HEADER => true,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_ENCODING => '',
CURLOPT_AUTOREFERER => true,
CURLOPT_CONNECTTIMEOUT => 120,
CURLOPT_TIMEOUT => 120,
CURLOPT_MAXREDIRS => 10,
CURLOPT_SSL_VERIFYPEER => true,
CURLOPT_SSL_VERIFYHOST => 2,
CURLOPT_CAINFO => __DIR__.'/../ssl/free-mobile.crt',
));
}
/**
* @param string $link
* @return int
*/
public function getCode($link)
{
curl_setopt($this->ch, CURLOPT_URL, $link);
if(curl_exec($this->ch) === false) {
echo curl_error($this->ch).PHP_EOL;
}
return (int) curl_getinfo($this->ch, CURLINFO_HTTP_CODE);
}
public function __destruct()
{
curl_close($this->ch);
}
}
| mit |
RsxBox/RsxBox.Email | src/RsxBox.Email.Core.Models/Models/StringTokens.cs | 211 | using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace RsxBox.Email.Core.Models
{
public class StringTokens : Dictionary<string, string>
{
}
}
| mit |
CaptainCrowbar/prion-lib | rs-core/range-expansion.hpp | 22503 | #pragma once
#include "rs-core/range-core.hpp"
#include <algorithm>
#include <functional>
#include <iterator>
#include <limits>
#include <memory>
#include <type_traits>
namespace RS::Range {
// combinations
struct CombinationsObject:
AlgorithmBase<CombinationsObject> {
size_t num;
CombinationsObject(size_t k): num(k) {}
};
template <typename ForwardRange>
class CombinationsIterator:
public InputIterator<CombinationsIterator<ForwardRange>, const SharedRange<Meta::RangeValue<ForwardRange>>> {
public:
using range_iterator = Meta::RangeIterator<const ForwardRange>;
using value_type = Meta::RangeValue<ForwardRange>;
CombinationsIterator() = default;
CombinationsIterator(range_iterator i, range_iterator j, size_t k):
its(make_shared_range<range_iterator>(i == j ? 0 : k, i)),
val(make_shared_range<value_type>(its.size(), *i)),
src{i, j},
count(i == j ? npos : 0) {}
const auto& operator*() const noexcept { return val; }
CombinationsIterator& operator++() {
if (count == npos)
return *this;
auto& ivec = *its.first.share;
auto& vvec = *val.first.share;
size_t i = ivec.size();
for (; i > 0; --i) {
auto& j = ivec[i - 1];
auto& v = vvec[i - 1];
++j;
if (j != src.second) {
v = *j;
break;
}
j = src.first;
v = *j;
}
if (i == 0)
count = npos;
else
++count;
return *this;
}
bool operator==(const CombinationsIterator& rhs) const noexcept { return count == rhs.count; }
private:
SharedRange<range_iterator> its;
SharedRange<value_type> val;
Irange<range_iterator> src;
size_t count = npos;
};
template <typename ForwardRange>
Irange<CombinationsIterator<ForwardRange>>
operator>>(const ForwardRange& lhs, CombinationsObject rhs) {
using std::begin;
using std::end;
return {{begin(lhs), end(lhs), rhs.num}, {}};
}
inline CombinationsObject combinations(size_t k) { return {k}; }
// flat_map
template <typename UnaryFunction>
struct FlatMapObject:
AlgorithmBase<FlatMapObject<UnaryFunction>> {
UnaryFunction fun;
FlatMapObject(const UnaryFunction& f): fun(f) {}
};
template <typename Range, typename UnaryFunction>
class FlatMapIterator:
public ForwardIterator<FlatMapIterator<Range, UnaryFunction>, const Meta::RangeValue<InvokeResult<UnaryFunction, Meta::RangeValue<Range>>>> {
public:
using iterator_category = Meta::MinCategory<Range, std::forward_iterator_tag>;
using level_1_iterator = Meta::RangeIterator<const Range>;
using level_2_range = InvokeResult<UnaryFunction, Meta::RangeValue<Range>>;
using level_2_iterator = Meta::RangeIterator<level_2_range>;
using function_type = std::function<level_2_range(const Meta::RangeValue<Range>&)>;
FlatMapIterator() = default;
FlatMapIterator(level_1_iterator b, level_1_iterator e, UnaryFunction f):
iter1(b), end1(e), range2(), iter2(), fun(f) { update(); }
const auto& operator*() const noexcept { return *iter2; }
FlatMapIterator& operator++() {
using std::end;
++iter2;
if (iter2 == end(*range2)) {
++iter1;
range2.reset();
update();
}
return *this;
}
bool operator==(const FlatMapIterator& rhs) const noexcept {
if (iter1 != rhs.iter1)
return false;
else if (range2 && rhs.range2)
return iter2 == rhs.iter2;
else
return ! range2 && ! rhs.range2;
}
private:
level_1_iterator iter1, end1;
std::shared_ptr<level_2_range> range2;
level_2_iterator iter2;
function_type fun;
void update() {
using std::begin;
if (! range2 && iter1 != end1) {
range2 = std::make_shared<level_2_range>(fun(*iter1));
iter2 = begin(*range2);
}
}
};
template <typename Range, typename UnaryFunction>
Irange<FlatMapIterator<Range, UnaryFunction>> operator>>(const Range& lhs, FlatMapObject<UnaryFunction> rhs) {
using std::begin;
using std::end;
auto b = begin(lhs), e = end(lhs);
return {{b, e, rhs.fun}, {e, e, rhs.fun}};
}
template <typename Container, typename UnaryFunction>
Container& operator<<(Container& lhs, FlatMapObject<UnaryFunction> rhs) {
using std::begin;
using std::end;
Container temp;
for (auto& x: lhs) {
auto range = rhs.fun(x);
std::copy(begin(range), end(range), append(temp));
}
lhs = move(temp);
return lhs;
}
template <typename UnaryFunction>
inline FlatMapObject<UnaryFunction> flat_map(UnaryFunction f) {
return f;
}
// flatten
struct FlattenObject:
AlgorithmBase<FlattenObject> {};
template <typename NestedRange>
class FlattenIterator:
public ForwardIterator<FlattenIterator<NestedRange>, const Meta::RangeValue<const Meta::RangeValue<NestedRange>>> {
public:
using iterator_category = Meta::MinCategory<NestedRange, std::forward_iterator_tag>;
using level_1_iterator = Meta::RangeIterator<const NestedRange>;
using level_2_range = Meta::RangeValue<NestedRange>;
using level_2_iterator = Meta::RangeIterator<const level_2_range>;
FlattenIterator() = default;
FlattenIterator(level_1_iterator b, level_1_iterator e):
iter1(b), end1(e), iter2(), end2() { init2(); }
const auto& operator*() const noexcept { return *iter2; }
FlattenIterator& operator++() {
++iter2;
if (iter2 == end2) {
++iter1;
init2();
}
return *this;
}
bool operator==(const FlattenIterator& rhs) const noexcept {
if (iter1 != rhs.iter1)
return false;
else if (iter1 == end1 || rhs.iter1 == rhs.end1)
return iter1 == end1 && rhs.iter1 == rhs.end1;
else
return iter2 == rhs.iter2;
}
private:
level_1_iterator iter1, end1;
level_2_iterator iter2, end2;
void init2() {
using std::begin;
using std::end;
if (iter1 == end1) {
iter2 = end2 = level_2_iterator();
} else {
iter2 = begin(*iter1);
end2 = end(*iter1);
}
}
};
template <typename NestedRange>
Irange<FlattenIterator<NestedRange>> operator>>(const NestedRange& lhs, FlattenObject /*rhs*/) {
using std::begin;
using std::end;
auto b = begin(lhs), e = end(lhs);
return {{b, e}, {e, e}};
}
constexpr FlattenObject flatten = {};
// insert_before, insert_after, insert_between, insert_around
template <typename T>
struct InsertBeforeObject:
AlgorithmBase<InsertBeforeObject<T>> {
T value;
InsertBeforeObject(const T& t): value(t) {}
};
template <typename T>
struct InsertAfterObject:
AlgorithmBase<InsertAfterObject<T>> {
T value;
InsertAfterObject(const T& t): value(t) {}
};
template <typename T>
struct InsertBetweenObject:
AlgorithmBase<InsertBetweenObject<T>> {
T value;
InsertBetweenObject(const T& t): value(t) {}
};
template <typename T>
struct InsertAroundObject:
AlgorithmBase<InsertAroundObject<T>> {
T before, after;
InsertAroundObject(const T& t1, const T& t2): before(t1), after(t2) {}
};
template <typename Range, typename T>
class InsertBeforeIterator:
public ForwardIterator<InsertBeforeIterator<Range, T>, const T> {
public:
using iterator_category = Meta::MinCategory<Range, std::forward_iterator_tag>;
using range_iterator = Meta::RangeIterator<const Range>;
InsertBeforeIterator() = default;
InsertBeforeIterator(range_iterator b, range_iterator e, const T& t): iter(b), end(e), value(t), step(0) {}
const auto& operator*() const noexcept { return step == 0 ? value : *iter; }
InsertBeforeIterator& operator++() {
if (step == 0) {
step = 1;
} else {
++iter;
step = 0;
}
return *this;
}
bool operator==(const InsertBeforeIterator& rhs) const noexcept { return iter == rhs.iter && step == rhs.step; }
private:
range_iterator iter, end;
T value;
uint8_t step = 0;
};
template <typename Range, typename T>
class InsertAfterIterator:
public ForwardIterator<InsertAfterIterator<Range, T>, const T> {
public:
using iterator_category = Meta::MinCategory<Range, std::forward_iterator_tag>;
using range_iterator = Meta::RangeIterator<const Range>;
InsertAfterIterator() = default;
InsertAfterIterator(range_iterator b, range_iterator e, const T& t): iter(b), end(e), value(t), step(0) {}
const auto& operator*() const noexcept { return step == 0 ? *iter : value; }
InsertAfterIterator& operator++() {
if (step == 0) {
step = 1;
} else {
++iter;
step = 0;
}
return *this;
}
bool operator==(const InsertAfterIterator& rhs) const noexcept { return iter == rhs.iter && step == rhs.step; }
private:
range_iterator iter, end;
T value;
uint8_t step = 0;
};
template <typename Range, typename T>
class InsertBetweenIterator:
public ForwardIterator<InsertBetweenIterator<Range, T>, const T> {
public:
using iterator_category = Meta::MinCategory<Range, std::forward_iterator_tag>;
using range_iterator = Meta::RangeIterator<const Range>;
InsertBetweenIterator() = default;
InsertBetweenIterator(range_iterator b, range_iterator e, const T& t): iter(b), end(e), value(t), step(b != e) {}
const auto& operator*() const noexcept { return step == 0 ? value : *iter; }
InsertBetweenIterator& operator++() {
if (step == 0) {
step = 1;
} else {
++iter;
step = 0;
}
return *this;
}
bool operator==(const InsertBetweenIterator& rhs) const noexcept { return iter == rhs.iter && step == rhs.step; }
private:
range_iterator iter, end;
T value;
uint8_t step = 0;
};
template <typename Range, typename T>
class InsertAroundIterator:
public ForwardIterator<InsertAroundIterator<Range, T>, const T> {
public:
using iterator_category = Meta::MinCategory<Range, std::forward_iterator_tag>;
using range_iterator = Meta::RangeIterator<const Range>;
InsertAroundIterator() = default;
InsertAroundIterator(range_iterator b, range_iterator e, const T& t1, const T& t2):
iter(b), end(e), before(t1), after(t2), step(0) {}
const auto& operator*() const noexcept {
switch (step) {
case 0: return before;
case 1: return *iter;
default: return after;
}
}
InsertAroundIterator& operator++() {
++step;
if (step == 3) {
step = 0;
++iter;
}
return *this;
}
bool operator==(const InsertAroundIterator& rhs) const noexcept { return iter == rhs.iter && step == rhs.step; }
private:
range_iterator iter, end;
T before, after;
uint8_t step = 0;
};
template <typename Range, typename T>
Irange<InsertBeforeIterator<Range, T>> operator>>(const Range& lhs, InsertBeforeObject<T> rhs) {
using std::begin;
using std::end;
auto b = begin(lhs), e = end(lhs);
return {{b, e, rhs.value}, {e, e, rhs.value}};
}
template <typename Range, typename T>
Irange<InsertAfterIterator<Range, T>> operator>>(const Range& lhs, InsertAfterObject<T> rhs) {
using std::begin;
using std::end;
auto b = begin(lhs), e = end(lhs);
return {{b, e, rhs.value}, {e, e, rhs.value}};
}
template <typename Range, typename T>
Irange<InsertBetweenIterator<Range, T>> operator>>(const Range& lhs, InsertBetweenObject<T> rhs) {
using std::begin;
using std::end;
auto b = begin(lhs), e = end(lhs);
return {{b, e, rhs.value}, {e, e, rhs.value}};
}
template <typename Range, typename T>
Irange<InsertAroundIterator<Range, T>> operator>>(const Range& lhs, InsertAroundObject<T> rhs) {
using std::begin;
using std::end;
auto b = begin(lhs), e = end(lhs);
return {{b, e, rhs.before, rhs.after}, {e, e, rhs.before, rhs.after}};
}
template <typename Container, typename T>
Container& operator<<(Container& lhs, const InsertBeforeObject<T>& rhs) {
using std::begin;
using std::end;
Container temp;
for (auto& x: lhs) {
append_to(temp, rhs.value);
append_to(temp, x);
}
lhs = move(temp);
return lhs;
}
template <typename Container, typename T>
Container& operator<<(Container& lhs, const InsertAfterObject<T>& rhs) {
using std::begin;
using std::end;
Container temp;
for (auto& x: lhs) {
append_to(temp, x);
append_to(temp, rhs.value);
}
lhs = move(temp);
return lhs;
}
template <typename Container, typename T>
Container& operator<<(Container& lhs, const InsertBetweenObject<T>& rhs) {
using std::begin;
using std::end;
Container temp;
auto i = begin(lhs), e = end(lhs);
if (i != e)
append_to(temp, *i++);
for (; i != e; ++i) {
append_to(temp, rhs.value);
append_to(temp, *i);
}
lhs = move(temp);
return lhs;
}
template <typename Container, typename T>
Container& operator<<(Container& lhs, const InsertAroundObject<T>& rhs) {
using std::begin;
using std::end;
Container temp;
for (auto& x: lhs) {
append_to(temp, rhs.before);
append_to(temp, x);
append_to(temp, rhs.after);
}
lhs = move(temp);
return lhs;
}
template <typename T>
inline InsertBeforeObject<T> insert_before(const T& t) {
return t;
}
template <typename T>
inline InsertAfterObject<T> insert_after(const T& t) {
return t;
}
template <typename T>
inline InsertBetweenObject<T> insert_between(const T& t) {
return t;
}
template <typename T>
inline InsertAroundObject<T> insert_around(const T& t1, const T& t2) {
return {t1, t2};
}
// permutations
template <typename ComparisonPredicate>
struct PermutationsObject:
AlgorithmBase<PermutationsObject<ComparisonPredicate>> {
ComparisonPredicate comp;
PermutationsObject() = default;
PermutationsObject(const ComparisonPredicate& p): comp(p) {}
template <typename CP2> PermutationsObject<CP2> operator()(CP2 p) const { return p; }
};
template <typename Range, typename ComparisonPredicate>
class PermutationsIterator:
public InputIterator<PermutationsIterator<Range, ComparisonPredicate>, const SharedRange<Meta::RangeValue<Range>>> {
public:
using range_iterator = Meta::RangeIterator<const Range>;
PermutationsIterator() = default;
PermutationsIterator(range_iterator i, range_iterator j, ComparisonPredicate p):
val(make_shared_range<Meta::RangeValue<Range>>(i, j)), comp(p), count(i == j ? npos : 0) {}
const auto& operator*() const noexcept { return val; }
PermutationsIterator& operator++() {
if (std::next_permutation(val.begin(), val.end(), comp))
++count;
else
count = npos;
return *this;
}
bool operator==(const PermutationsIterator& rhs) const noexcept { return count == rhs.count; }
private:
SharedRange<Meta::RangeValue<Range>> val;
ComparisonPredicate comp;
size_t count = npos;
};
template <typename Range, typename ComparisonPredicate>
Irange<PermutationsIterator<Range, ComparisonPredicate>>
operator>>(const Range& lhs, PermutationsObject<ComparisonPredicate> rhs) {
using std::begin;
using std::end;
return {{begin(lhs), end(lhs), rhs.comp}, {}};
}
constexpr PermutationsObject<std::less<>> permutations = {};
// repeat
struct RepeatObject:
AlgorithmBase<RepeatObject> {
ptrdiff_t num = std::numeric_limits<ptrdiff_t>::max();
RepeatObject operator()(size_t k) const noexcept {
RepeatObject o;
if (k < size_t(o.num))
o.num = k;
return o;
}
};
template <typename FR>
class RepeatIterator:
public FlexibleRandomAccessIterator<RepeatIterator<FR>, const Meta::RangeValue<FR>> {
public:
static_assert(! Meta::category_is_less<FR, std::forward_iterator_tag>);
using underlying_iterator = Meta::RangeIterator<const FR>;
using iterator_category = Meta::MinCategory<FR, std::bidirectional_iterator_tag>;
RepeatIterator() = default;
RepeatIterator(underlying_iterator b, underlying_iterator e, ptrdiff_t c): begin(b), end(e), iter(b), cycle(c) {}
const auto& operator*() const noexcept { return *iter; }
RepeatIterator& operator++() {
++iter;
if (iter == end) {
iter = begin;
++cycle;
}
return *this;
}
RepeatIterator& operator--() {
if (iter == begin) {
iter = end;
--cycle;
}
--iter;
return *this;
}
RepeatIterator& operator+=(ptrdiff_t rhs) {
ptrdiff_t offset = std::distance(begin, iter) + rhs;
auto qr = divide(offset, std::distance(begin, end));
cycle += qr.first;
iter = begin;
std::advance(iter, qr.second);
return *this;
}
ptrdiff_t operator-(const RepeatIterator& rhs) const {
return (cycle - rhs.cycle) * std::distance(begin, end) + std::distance(rhs.iter, iter);
}
bool operator==(const RepeatIterator& rhs) const noexcept { return cycle == rhs.cycle && iter == rhs.iter; }
private:
underlying_iterator begin, end, iter;
ptrdiff_t cycle = 0;
};
template <typename FR>
Irange<RepeatIterator<FR>> operator>>(const FR& lhs, RepeatObject rhs) {
using std::begin;
using std::end;
auto b = begin(lhs), e = end(lhs);
return {{b, e, 0}, {b, e, rhs.num}};
}
template <typename Container>
Container& operator<<(Container& lhs, RepeatObject rhs) {
using std::begin;
using std::end;
if (rhs.num == 0) {
lhs.clear();
} else if (rhs.num > 1) {
Container temp = lhs;
for (ptrdiff_t i = 1; i < rhs.num; ++i)
std::copy(begin(lhs), end(lhs), append(temp));
lhs = move(temp);
}
return lhs;
}
constexpr RepeatObject repeat = {};
// subsets
struct SubsetsObject:
AlgorithmBase<SubsetsObject> {
size_t num;
SubsetsObject(size_t k): num(k) {}
};
template <typename ForwardRange>
class SubsetsIterator:
public InputIterator<SubsetsIterator<ForwardRange>, const SharedRange<Meta::RangeValue<ForwardRange>>> {
public:
using range_iterator = Meta::RangeIterator<const ForwardRange>;
using value_type = Meta::RangeValue<ForwardRange>;
SubsetsIterator() = default;
SubsetsIterator(range_iterator i, range_iterator j, size_t k):
its(make_shared_range<range_iterator>(std::min(k, size_t(std::distance(i, j))))),
val(make_shared_range<value_type>(its.size())),
src{i, j},
count(0) {
auto& ivec = *its.first.share;
auto& vvec = *val.first.share;
for (size_t m = 0, n = ivec.size(); m < n; ++i, ++m) {
ivec[m] = i;
vvec[m] = *i;
}
}
const auto& operator*() const noexcept { return val; }
SubsetsIterator& operator++() {
if (count == npos)
return *this;
auto& ivec = *its.first.share;
auto& vvec = *val.first.share;
size_t i = ivec.size(), j = 0;
for (; i > 0; --i) {
auto k = ivec[i - 1];
for (j = i - 1; j < ivec.size(); ++j) {
ivec[j] = ++k;
if (k == src.second)
break;
vvec[j] = *k;
}
if (j == ivec.size())
break;
}
if (i == 0)
count = npos;
else
++count;
return *this;
}
bool operator==(const SubsetsIterator& rhs) const noexcept { return count == rhs.count; }
private:
SharedRange<range_iterator> its;
SharedRange<value_type> val;
Irange<range_iterator> src;
size_t count = npos;
};
template <typename ForwardRange>
Irange<SubsetsIterator<ForwardRange>>
operator>>(const ForwardRange& lhs, SubsetsObject rhs) {
using std::begin;
using std::end;
return {{begin(lhs), end(lhs), rhs.num}, {}};
}
inline SubsetsObject subsets(size_t k) { return {k}; }
}
| mit |
mastoj/NestDemo | NestDemo/Program.cs | 739 | using System;
using Nowin;
namespace NestDemo
{
class Program
{
const int Port = 1337;
public static Type[] EnforceReferencesFor =
{
typeof (Simple.Web.Razor.RazorHtmlMediaTypeHandler),
typeof (Simple.Web.JsonNet.JsonMediaTypeHandler)
};
static void Main(string[] args)
{
var app = new AppBuilder().BuildApp();
var serverBuilder = ServerBuilder.New()
.SetPort(Port)
.SetOwinApp(app);
using (serverBuilder.Start())
{
Console.WriteLine("Listening on port {0}, press enter to exit", Port);
Console.ReadLine();
}
}
}
}
| mit |
MontealegreLuis/edeco | src/PhpThumb/Plugin/GdReflection.php | 5084 | <?php
/**
* GD Reflection Lib Plugin Definition File
*
* This file contains the plugin definition for the GD Reflection Lib for PHP Thumb
*
* PHP Version 5 with GD 2.0+
* PhpThumb : PHP Thumb Library <http://phpthumb.gxdlabs.com>
* Copyright (c) 2009, Ian Selby/Gen X Design
*
* Author(s): Ian Selby <[email protected]>
*
* Licensed under the MIT License
* Redistributions of files must retain the above copyright notice.
*/
namespace PhpThumb\Plugin;
use PhpThumb\PhpThumb;
/**
* GD Reflection Lib Plugin
*
* This plugin allows you to create those fun Apple(tm)-style reflections in your images
*/
class GdReflection
{
/**
* Instance of GdThumb passed to this class
*
* @var GdThumb
*/
protected $parentInstance;
protected $currentDimensions;
protected $workingImage;
protected $newImage;
protected $options;
public function createReflection ($percent, $reflection, $white, $border, $borderColor, &$that)
{
// bring stuff from the parent class into this class...
$this->parentInstance = $that;
$this->currentDimensions = $this->parentInstance->getCurrentDimensions();
$this->workingImage = $this->parentInstance->getWorkingImage();
$this->newImage = $this->parentInstance->getOldImage();
$this->options = $this->parentInstance->getOptions();
$width = $this->currentDimensions['width'];
$height = $this->currentDimensions['height'];
$reflectionHeight = intval($height * ($reflection / 100));
$newHeight = $height + $reflectionHeight;
$reflectedPart = $height * ($percent / 100);
$this->workingImage = imagecreatetruecolor($width, $newHeight);
imagealphablending($this->workingImage, true);
$colorToPaint = imagecolorallocatealpha($this->workingImage,255,255,255,0);
imagefilledrectangle($this->workingImage,0,0,$width,$newHeight,$colorToPaint);
imagecopyresampled
(
$this->workingImage,
$this->newImage,
0,
0,
0,
$reflectedPart,
$width,
$reflectionHeight,
$width,
($height - $reflectedPart)
);
$this->imageFlipVertical();
imagecopy($this->workingImage, $this->newImage, 0, 0, 0, 0, $width, $height);
imagealphablending($this->workingImage, true);
for ($i = 0; $i < $reflectionHeight; $i++)
{
$colorToPaint = imagecolorallocatealpha($this->workingImage, 255, 255, 255, ($i/$reflectionHeight*-1+1)*$white);
imagefilledrectangle($this->workingImage, 0, $height + $i, $width, $height + $i, $colorToPaint);
}
if($border == true)
{
$rgb = $this->hex2rgb($borderColor, false);
$colorToPaint = imagecolorallocate($this->workingImage, $rgb[0], $rgb[1], $rgb[2]);
imageline($this->workingImage, 0, 0, $width, 0, $colorToPaint); //top line
imageline($this->workingImage, 0, $height, $width, $height, $colorToPaint); //bottom line
imageline($this->workingImage, 0, 0, 0, $height, $colorToPaint); //left line
imageline($this->workingImage, $width-1, 0, $width-1, $height, $colorToPaint); //right line
}
if ($this->parentInstance->getFormat() == 'PNG')
{
$colorTransparent = imagecolorallocatealpha
(
$this->workingImage,
$this->options['alphaMaskColor'][0],
$this->options['alphaMaskColor'][1],
$this->options['alphaMaskColor'][2],
0
);
imagefill($this->workingImage, 0, 0, $colorTransparent);
imagesavealpha($this->workingImage, true);
}
$this->parentInstance->setOldImage($this->workingImage);
$this->currentDimensions['width'] = $width;
$this->currentDimensions['height'] = $newHeight;
$this->parentInstance->setCurrentDimensions($this->currentDimensions);
return $that;
}
/**
* Flips the image vertically
*
*/
protected function imageFlipVertical ()
{
$x_i = imagesx($this->workingImage);
$y_i = imagesy($this->workingImage);
for ($x = 0; $x < $x_i; $x++)
{
for ($y = 0; $y < $y_i; $y++)
{
imagecopy($this->workingImage, $this->workingImage, $x, $y_i - $y - 1, $x, $y, 1, 1);
}
}
}
/**
* Converts a hex color to rgb tuples
*
* @return mixed
* @param string $hex
* @param bool $asString
*/
protected function hex2rgb ($hex, $asString = false)
{
// strip off any leading #
if (0 === strpos($hex, '#'))
{
$hex = substr($hex, 1);
}
elseif (0 === strpos($hex, '&H'))
{
$hex = substr($hex, 2);
}
// break into hex 3-tuple
$cutpoint = ceil(strlen($hex) / 2)-1;
$rgb = explode(':', wordwrap($hex, $cutpoint, ':', $cutpoint), 3);
// convert each tuple to decimal
$rgb[0] = (isset($rgb[0]) ? hexdec($rgb[0]) : 0);
$rgb[1] = (isset($rgb[1]) ? hexdec($rgb[1]) : 0);
$rgb[2] = (isset($rgb[2]) ? hexdec($rgb[2]) : 0);
return ($asString ? "{$rgb[0]} {$rgb[1]} {$rgb[2]}" : $rgb);
}
}
$pt = PhpThumb::getInstance();
$pt->registerPlugin('PhpThumb\Plugin\GdReflection', 'gd'); | mit |
shageman/cbra_book_code | c2s05/sportsball/components/app_component/spec/helpers/app_component/teams_helper_spec.rb | 463 | require 'rails_helper'
# Specs in this file have access to a helper object that includes
# the TeamsHelper. For example:
#
# describe TeamsHelper do
# describe "string concat" do
# it "concats two strings with spaces" do
# expect(helper.concat_strings("this","that")).to eq("this that")
# end
# end
# end
module AppComponent
RSpec.describe TeamsHelper, :type => :helper do
pending "add some examples to (or delete) #{__FILE__}"
end
end
| mit |
jdonsan/my-cv | api/models/skill.js | 399 | var mongoose = require('mongoose');
var Schema = mongoose.Schema;
var skillSchema = new Schema({
name: String,
description: String,
category: String,
type: {
type: String,
enum: ['FRONT', 'BACK', 'BOTH', 'OTHERS']
},
level: Number,
yearsExperience: Number,
logo: String,
active: Boolean
});
module.exports = mongoose.model('Skill', skillSchema); | mit |
kubkowski/live_assets | test/dummy/app/controllers/home_controller.rb | 113 | class HomeController < ApplicationController
def index
render text: "Hello", layout: true
end
end | mit |
thomasgibson/tabula-rasa | SWE/solver.py | 15689 | from firedrake import *
from firedrake.petsc import PETSc
from firedrake.utils import cached_property
from pyop2.profiling import timed_stage
import numpy as np
def fmax(f):
fmax = op2.Global(1, np.finfo(float).min, dtype=float)
op2.par_loop(op2.Kernel("""
void maxify(double *a, double *b) {
a[0] = a[0] < fabs(b[0]) ? fabs(b[0]) : a[0];
}
""", "maxify"), f.dof_dset.set, fmax(op2.MAX), f.dat(op2.READ))
return fmax.data[0]
def latlon_coords(mesh):
x0, y0, z0 = SpatialCoordinate(mesh)
unsafe = z0 / sqrt(x0*x0 + y0*y0 + z0*z0)
safe = Min(Max(unsafe, -1.0), 1.0)
theta = asin(safe)
lamda = atan_2(y0, x0)
return theta, lamda
class W5Problem(object):
"""Williamson test case 5 Problem class."""
def __init__(self, refinement_level, R,
H, Dt, method="BDM",
hybridization=False, model_degree=2,
mesh_degree=1,
profile=False,
monitor=False):
super(W5Problem, self).__init__()
self.refinement_level = refinement_level
self.method = method
self.model_degree = model_degree
self.mesh_degree = mesh_degree
self.hybridization = hybridization
self.profile = profile
self.monitor = monitor
# Mesh radius
self.R = R
# Earth-sized mesh
if self.method == "RTCF":
mesh = CubedSphereMesh(self.R, self.refinement_level,
degree=self.mesh_degree)
else:
mesh = IcosahedralSphereMesh(self.R, self.refinement_level,
degree=self.mesh_degree)
x = SpatialCoordinate(mesh)
global_normal = as_vector(x)
mesh.init_cell_orientations(global_normal)
self.mesh = mesh
# Get Dx information (this is approximate).
# We compute the area (m^2) of each cell in the mesh,
# then take the square root to get the right units.
cell_vs = interpolate(CellVolume(self.mesh),
FunctionSpace(self.mesh, "DG", 0))
a_max = fmax(cell_vs)
dx_max = sqrt(a_max)
self.dx_max = dx_max
# Wave speed for the shallow water system
g = 9.810616
wave_speed = sqrt(H*g)
# Courant number
self.courant = (Dt / dx_max) * wave_speed
self.dt = Constant(Dt)
self.Dt = Dt
# Compatible FE spaces for velocity and depth
if self.method == "RT":
Vu = FunctionSpace(self.mesh, "RT", self.model_degree)
elif self.method == "RTCF":
Vu = FunctionSpace(self.mesh, "RTCF", self.model_degree)
elif self.method == "BDM":
Vu = FunctionSpace(self.mesh, "BDM", self.model_degree)
else:
raise ValueError("Unrecognized method '%s'" % self.method)
VD = FunctionSpace(self.mesh, "DG", self.model_degree - 1)
self.function_spaces = (Vu, VD)
# Mean depth
self.H = Constant(H)
# Acceleration due to gravity
self.g = Constant(g)
# Build initial conditions and parameters
self._build_initial_conditions()
# Setup solvers
self._build_DU_solvers()
self._build_picard_solver()
self.ksp_outer_its = []
self.ksp_inner_its = []
self.sim_time = []
self.picard_seq = []
self.reductions = []
def _build_initial_conditions(self):
x = SpatialCoordinate(self.mesh)
_, VD = self.function_spaces
# Initial conditions for velocity and depth (in geostrophic balance)
u_0 = 20.0
u_max = Constant(u_0)
R0 = Constant(self.R)
uexpr = as_vector([-u_max*x[1]/R0, u_max*x[0]/R0, 0.0])
h0 = self.H
Omega = Constant(7.292e-5)
g = self.g
Dexpr = h0 - ((R0*Omega*u_max + u_max*u_max/2.0)*(x[2]*x[2]/(R0*R0)))/g
theta, lamda = latlon_coords(self.mesh)
Rpn = pi/9.
R0sq = Rpn**2
lamda_c = -pi/2.
lsq = (lamda - lamda_c)**2
theta_c = pi/6.
thsq = (theta - theta_c)**2
rsq = Min(R0sq, lsq + thsq)
r = sqrt(rsq)
bexpr = 2000 * (1 - r/Rpn)
self.b = Function(VD, name="Topography").interpolate(bexpr)
# Coriolis expression (1/s)
fexpr = 2*Omega*x[2]/R0
self.f = fexpr
self.uexpr = uexpr
self.Dexpr = Dexpr
def _build_DU_solvers(self):
Vu, VD = self.function_spaces
un, Dn = self.state
up, Dp = self.updates
dt = self.dt
# Stage 1: Depth advection
# DG upwinded advection for depth
self.Dps = Function(VD, name="stabilized depth")
D = TrialFunction(VD)
phi = TestFunction(VD)
Dh = 0.5*(Dn + D)
uh = 0.5*(un + up)
n = FacetNormal(self.mesh)
uup = 0.5*(dot(uh, n) + abs(dot(uh, n)))
Deqn = (
(D - Dn)*phi*dx - dt*inner(grad(phi), uh*Dh)*dx
+ dt*jump(phi)*(uup('+')*Dh('+')-uup('-')*Dh('-'))*dS
)
Dparams = {'ksp_type': 'cg',
'pc_type': 'bjacobi',
'sub_pc_type': 'ilu'}
Dproblem = LinearVariationalProblem(lhs(Deqn), rhs(Deqn),
self.Dps)
Dsolver = LinearVariationalSolver(Dproblem,
solver_parameters=Dparams,
options_prefix="D-advection")
self.Dsolver = Dsolver
# Stage 2: U update
self.Ups = Function(Vu, name="stabilized velocity")
u = TrialFunction(Vu)
v = TestFunction(Vu)
Dh = 0.5*(Dn + Dp)
ubar = 0.5*(un + up)
uup = 0.5*(dot(ubar, n) + abs(dot(ubar, n)))
uh = 0.5*(un + u)
Upwind = 0.5*(sign(dot(ubar, n)) + 1)
# Kinetic energy term (implicit midpoint)
K = 0.5*(inner(0.5*(un + up), 0.5*(un + up)))
both = lambda u: 2*avg(u)
# u_t + gradperp.u + f)*perp(ubar) + grad(g*D + K)
# <w, gradperp.u * perp(ubar)> = <perp(ubar).w, gradperp(u)>
# = <-gradperp(w.perp(ubar))), u>
# +<< [[perp(n)(w.perp(ubar))]], u>>
ueqn = (
inner(u - un, v)*dx + dt*inner(self.perp(uh)*self.f, v)*dx
- dt*inner(self.perp(grad(inner(v, self.perp(ubar)))), uh)*dx
+ dt*inner(both(self.perp(n)*inner(v, self.perp(ubar))),
both(Upwind*uh))*dS
- dt*div(v)*(self.g*(Dh + self.b) + K)*dx
)
uparams = {'ksp_type': 'gmres',
'pc_type': 'bjacobi',
'sub_pc_type': 'ilu'}
Uproblem = LinearVariationalProblem(lhs(ueqn), rhs(ueqn),
self.Ups)
Usolver = LinearVariationalSolver(Uproblem,
solver_parameters=uparams,
options_prefix="U-advection")
self.Usolver = Usolver
def _build_picard_solver(self):
Vu, VD = self.function_spaces
un, Dn = self.state
up, Dp = self.updates
dt = self.dt
f = self.f
g = self.g
H = self.H
Dps = self.Dps
Ups = self.Ups
# Stage 3: Implicit linear solve for u, D increments
W = MixedFunctionSpace((Vu, VD))
self.DU = Function(W, name="linear updates")
w, phi = TestFunctions(W)
du, dD = TrialFunctions(W)
uDlhs = (
inner(w, du + 0.5*dt*f*self.perp(du)) - 0.5*dt*div(w)*g*dD +
phi*(dD + 0.5*dt*H*div(du))
)*dx
uDrhs = -(
inner(w, up - Ups)*dx
+ phi*(Dp - Dps)*dx
)
self.FuD = action(uDlhs, self.DU) - uDrhs
DUproblem = LinearVariationalProblem(uDlhs, uDrhs, self.DU)
if self.hybridization:
parameters = {
'ksp_type': 'preonly',
'mat_type': 'matfree',
'pmat_type': 'matfree',
'pc_type': 'python',
'pc_python_type': 'firedrake.HybridizationPC',
'hybridization': {
'ksp_type': 'gmres',
'ksp_max_it': 100,
'pc_type': 'gamg',
'pc_gamg_reuse_interpolation': None,
'pc_gamg_sym_graph': None,
'pc_mg_cycles': 'v',
'ksp_rtol': 1e-8,
'mg_levels': {
'ksp_type': 'richardson',
'ksp_max_it': 2,
'pc_type': 'bjacobi',
'sub_pc_type': 'ilu'
}
}
}
if self.monitor:
parameters['hybridization']['ksp_monitor_true_residual'] = None
else:
parameters = {
'ksp_type': 'fgmres',
'ksp_rtol': 1e-8,
'ksp_max_it': 500,
'ksp_gmres_restart': 50,
'pc_type': 'fieldsplit',
'pc_fieldsplit': {
'type': 'schur',
'schur_fact_type': 'full',
# Use Stilde = A11 - A10 Diag(A00).inv A01 as the
# preconditioner for the Schur-complement
'schur_precondition': 'selfp'
},
'fieldsplit_0': {
'ksp_type': 'preonly',
'pc_type': 'bjacobi',
'sub_pc_type': 'ilu'
},
'fieldsplit_1': {
'ksp_type': 'gmres',
'ksp_max_it': 50,
'ksp_rtol': 1e-8,
'pc_type': 'gamg',
'pc_gamg_reuse_interpolation': None,
'pc_gamg_sym_graph': None,
'pc_mg_cycles': 'v',
'mg_levels': {
'ksp_type': 'chebyshev',
'ksp_max_it': 2,
'pc_type': 'bjacobi',
'sub_pc_type': 'ilu'
}
}
}
if self.monitor:
parameters['ksp_monitor_true_residual'] = None
parameters['fieldsplit_1']['ksp_monitor_true_residual'] = None
DUsolver = LinearVariationalSolver(DUproblem,
solver_parameters=parameters,
options_prefix="implicit-solve")
self.DUsolver = DUsolver
@cached_property
def num_cells(self):
return self.mesh.cell_set.size
@cached_property
def comm(self):
return self.mesh.comm
@cached_property
def outward_normals(self):
return CellNormal(self.mesh)
def perp(self, u):
return cross(self.outward_normals, u)
@cached_property
def eta(self):
_, VD = self.function_spaces
eta = Function(VD, name="Surface height")
return eta
@cached_property
def state(self):
Vu, VD = self.function_spaces
un = Function(Vu, name="Velocity")
Dn = Function(VD, name="Depth")
return un, Dn
@cached_property
def updates(self):
Vu, VD = self.function_spaces
up = Function(Vu)
Dp = Function(VD)
return up, Dp
@cached_property
def output_file(self):
dirname = "results/"
if self.hybridization:
dirname += "hybrid_%s%d_ref%d_Dt%s/" % (self.method,
self.model_degree,
self.refinement_level,
self.Dt)
else:
dirname += "gmres_%s%d_ref%d_Dt%s/" % (self.method,
self.model_degree,
self.refinement_level,
self.Dt)
return File(dirname + "w5_" + str(self.refinement_level) + ".pvd")
def write(self, dumpcount, dumpfreq):
dumpcount += 1
un, Dn = self.state
if(dumpcount > dumpfreq):
eta = self.eta
eta.assign(Dn + self.b)
self.output_file.write(un, Dn, eta, self.b)
dumpcount -= dumpfreq
return dumpcount
def initialize(self):
self.DU.assign(0.0)
self.Ups.assign(0.0)
self.Dps.assign(0.0)
un, Dn = self.state
un.project(self.uexpr)
Dn.interpolate(self.Dexpr)
Dn -= self.b
def warmup(self):
self.initialize()
un, Dn = self.state
up, Dp = self.updates
up.assign(un)
Dp.assign(Dn)
with timed_stage("Warm up: DU Residuals"):
self.Dsolver.solve()
self.Usolver.solve()
with timed_stage("Warm up: Linear solve"):
self.DUsolver.solve()
def run_simulation(self, tmax, write=False, dumpfreq=100):
PETSc.Sys.Print("""
Running Williamson 5 test with parameters:\n
method: %s,\n
model degree: %d,\n
refinements: %d,\n
hybridization: %s,\n
tmax: %s
"""
% (self.method, self.model_degree,
self.refinement_level, self.hybridization, tmax))
t = 0.0
un, Dn = self.state
up, Dp = self.updates
deltau, deltaD = self.DU.split()
dumpcount = dumpfreq
if write:
dumpcount = self.write(dumpcount, dumpfreq)
self.Dsolver.snes.setConvergenceHistory()
self.Dsolver.snes.ksp.setConvergenceHistory()
self.Usolver.snes.setConvergenceHistory()
self.Usolver.snes.ksp.setConvergenceHistory()
self.DUsolver.snes.setConvergenceHistory()
self.DUsolver.snes.ksp.setConvergenceHistory()
while t < tmax - self.Dt/2:
t += self.Dt
up.assign(un)
Dp.assign(Dn)
for i in range(4):
self.sim_time.append(t)
self.picard_seq.append(i+1)
with timed_stage("DU Residuals"):
self.Dsolver.solve()
self.Usolver.solve()
with timed_stage("Linear solve"):
self.DUsolver.solve()
# Here we collect the reductions in the linear residual.
# Get rhs from ksp
r0 = self.DUsolver.snes.ksp.getRhs()
# Assemble the problem residual (b - Ax)
res = assemble(self.FuD, mat_type="aij")
bnorm = r0.norm()
rnorm = res.dat.norm
r_factor = rnorm/bnorm
self.reductions.append(r_factor)
up += deltau
Dp += deltaD
outer_ksp = self.DUsolver.snes.ksp
if self.hybridization:
ctx = outer_ksp.getPC().getPythonContext()
inner_ksp = ctx.trace_ksp
else:
ksps = outer_ksp.getPC().getFieldSplitSubKSP()
_, inner_ksp = ksps
# Collect ksp iterations
self.ksp_outer_its.append(outer_ksp.getIterationNumber())
self.ksp_inner_its.append(inner_ksp.getIterationNumber())
un.assign(up)
Dn.assign(Dp)
if write:
with timed_stage("Dump output"):
dumpcount = self.write(dumpcount, dumpfreq)
| mit |
vandersonmr/GEOS | docs/html/search/all_14.js | 377 | var searchData=
[
['u_5flong_5flong',['u_long_long',['../papi_8h.html#a88b2f548f11fcd6920d85595904d0dd1',1,'papi.h']]],
['uncondbranch',['UncondBranch',['../structllvm_1_1GCOVOptions.html#a6dbf83a66464f6bfd8893244a4bd3744',1,'llvm::GCOVOptions']]],
['us',['us',['../struct__papi__multiplex__option.html#a8f9ae34f958ef9b31c320dd27fb8ed9a',1,'_papi_multiplex_option']]]
];
| mit |
EmmetBlue/Emmet-Blue-Ui | plugins/accounts/main/assets/controllers/accounting-period-management-controller.js | 2608 | angular.module("EmmetBlue")
.controller('accountsAccountingPeriodsManagementController', function($scope, utils){
$scope.dttInstance = {};
$scope.dttOptions = utils.DT.optionsBuilder
.fromFnPromise(function(){
var periods = utils.serverRequest('/financial-accounts/accounting-period/view-period-history', 'GET');
return periods;
})
.withPaginationType('full_numbers')
.withDisplayLength(50)
.withOption('createdRow', function(row, data, dataIndex){
utils.compile(angular.element(row).contents())($scope);
})
.withOption('headerCallback', function(header) {
if (!$scope.headerCompiled) {
$scope.headerCompiled = true;
utils.compile(angular.element(header).contents())($scope);
}
});
$scope.dttColumns = [
utils.DT.columnBuilder.newColumn('PeriodAlias').withTitle("Period Alias"),
utils.DT.columnBuilder.newColumn('SetBy').withTitle("Set By"),
utils.DT.columnBuilder.newColumn(null).withTitle("Set Date").renderWith(function(data){
var val = (new Date(data.SetDate)).toDateString();
return "<span>"+val+"</span>";
}).notSortable()
];
$scope.reloadTable = function(){
$scope.dttInstance.reloadData();
}
$scope.reload = function(){
$scope.reloadTable();
loadPeriods();
}
$scope.periods = {};
$scope.currentPeriod = {};
function loadPeriods(){
utils.serverRequest("/financial-accounts/accounting-period/get-current-period", "GET").then(function(response){
$scope.currentPeriod = response;
}, function(error){
utils.errorHandler(error);
});
var req = utils.serverRequest("/financial-accounts/accounting-period/view-alias", "GET");
req.then(function(response){
$scope.periods = response;
}, function(error){
utils.errorHandler(error);
})
}
loadPeriods();
$scope.setDefaultPeriod = function(){
if (typeof $scope.tempHolder !== "undefined"){
var title = "Please Confirm";
var text = "Do you really want to change the current default accounting period?"
var close = true;
var type = "warning";
var btnText = "Yes, please continue";
var process = function(){
var data = $scope.tempHolder;
data.staffId = utils.userSession.getID();
var req = utils.serverRequest("/financial-accounts/accounting-period/set-current-period", "POST", data);
req.then(function(response){
utils.alert("Operation Successful", "The selected accounting period has been set as the current period", "success");
$scope.reload();
}, function(error){
utils.errorHandler(error);
});
}
utils.confirm(title, text, close, process, type, btnText);
}
}
});
| mit |
gomidi/midi | examples/simple/simple_test.go | 1234 | package simple_test
import (
"fmt"
"io"
"time"
"gitlab.com/gomidi/midi/reader"
"gitlab.com/gomidi/midi/writer"
)
type printer struct{}
func (pr printer) noteOn(p *reader.Position, channel, key, vel uint8) {
fmt.Printf("NoteOn (ch %v: key %v vel: %v)\n", channel, key, vel)
}
func (pr printer) noteOff(p *reader.Position, channel, key, vel uint8) {
fmt.Printf("NoteOff (ch %v: key %v)\n", channel, key)
}
func Example() {
var p printer
// to disable logging, pass mid.NoLogger() as option
rd := reader.New(reader.NoLogger(),
// set the callbacks for the messages you are interested in
reader.NoteOn(p.noteOn),
reader.NoteOff(p.noteOff),
)
// to allow reading and writing concurrently in this example
// we need a pipe
piperd, pipewr := io.Pipe()
go func() {
wr := writer.New(pipewr)
wr.SetChannel(11) // sets the channel for the next messages
writer.NoteOn(wr, 120, 50)
time.Sleep(time.Second)
writer.NoteOff(wr, 120) // let the note ring for 1 sec
pipewr.Close() // finishes the writing
}()
for {
if reader.ReadAllFrom(rd, piperd) == io.EOF {
piperd.Close() // finishes the reading
break
}
}
// Output: NoteOn (ch 11: key 120 vel: 50)
// NoteOff (ch 11: key 120)
}
| mit |
sweetlandj/Platibus | Source/Platibus/Config/Extensibility/ISecurityTokenServiceProvider.cs | 2207 | // The MIT License (MIT)
//
// Copyright (c) 2016 Jesse Sweetland
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
using System.Threading.Tasks;
#if NETSTANDARD2_0 || NET461
using Microsoft.Extensions.Configuration;
#endif
using Platibus.Security;
namespace Platibus.Config.Extensibility
{
/// <summary>
/// A factory for initializing a <see cref="ISecurityTokenService"/>
/// during bus initialization.
/// </summary>
public interface ISecurityTokenServiceProvider
{
/// <summary>
/// Creates an initializes a <see cref="ISecurityTokenService"/>
/// based on the provided <paramref name="configuration"/>.
/// </summary>
/// <param name="configuration">The journaling configuration
/// element.</param>
/// <returns>Returns a task whose result is an initialized
/// <see cref="ISecurityTokenService"/>.</returns>
#if NET452 || NET461
Task<ISecurityTokenService> CreateSecurityTokenService(SecurityTokensElement configuration);
#endif
#if NETSTANDARD2_0 || NET461
Task<ISecurityTokenService> CreateSecurityTokenService(IConfiguration configuration);
#endif
}
}
| mit |
tripmode/pxlcoin | src/qt/paymentserver.cpp | 4470 | // Copyright (c) 2009-2012 The Bitcoin developers
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include <QApplication>
#include "paymentserver.h"
#include "guiconstants.h"
#include "ui_interface.h"
#include "util.h"
#include <QByteArray>
#include <QDataStream>
#include <QDebug>
#include <QFileOpenEvent>
#include <QHash>
#include <QLocalServer>
#include <QLocalSocket>
#include <QStringList>
#include <QUrl>
using namespace boost;
const int BITCOIN_IPC_CONNECT_TIMEOUT = 1000; // milliseconds
const QString BITCOIN_IPC_PREFIX("bitcoin:");
//
// Create a name that is unique for:
// testnet / non-testnet
// data directory
//
static QString ipcServerName()
{
QString name("PxlcoinQt");
// Append a simple hash of the datadir
// Note that GetDataDir(true) returns a different path
// for -testnet versus main net
QString ddir(GetDataDir(true).string().c_str());
name.append(QString::number(qHash(ddir)));
return name;
}
//
// This stores payment requests received before
// the main GUI window is up and ready to ask the user
// to send payment.
//
static QStringList savedPaymentRequests;
//
// Sending to the server is done synchronously, at startup.
// If the server isn't already running, startup continues,
// and the items in savedPaymentRequest will be handled
// when uiReady() is called.
//
bool PaymentServer::ipcSendCommandLine()
{
bool fResult = false;
const QStringList& args = qApp->arguments();
for (int i = 1; i < args.size(); i++)
{
if (!args[i].startsWith(BITCOIN_IPC_PREFIX, Qt::CaseInsensitive))
continue;
savedPaymentRequests.append(args[i]);
}
foreach (const QString& arg, savedPaymentRequests)
{
QLocalSocket* socket = new QLocalSocket();
socket->connectToServer(ipcServerName(), QIODevice::WriteOnly);
if (!socket->waitForConnected(BITCOIN_IPC_CONNECT_TIMEOUT))
return false;
QByteArray block;
QDataStream out(&block, QIODevice::WriteOnly);
out.setVersion(QDataStream::Qt_4_0);
out << arg;
out.device()->seek(0);
socket->write(block);
socket->flush();
socket->waitForBytesWritten(BITCOIN_IPC_CONNECT_TIMEOUT);
socket->disconnectFromServer();
delete socket;
fResult = true;
}
return fResult;
}
PaymentServer::PaymentServer(QApplication* parent) : QObject(parent), saveURIs(true)
{
// Install global event filter to catch QFileOpenEvents on the mac (sent when you click bitcoin: links)
parent->installEventFilter(this);
QString name = ipcServerName();
// Clean up old socket leftover from a crash:
QLocalServer::removeServer(name);
uriServer = new QLocalServer(this);
if (!uriServer->listen(name))
qDebug() << tr("Cannot start pxlcoin: click-to-pay handler");
else
connect(uriServer, SIGNAL(newConnection()), this, SLOT(handleURIConnection()));
}
bool PaymentServer::eventFilter(QObject *object, QEvent *event)
{
// clicking on bitcoin: URLs creates FileOpen events on the Mac:
if (event->type() == QEvent::FileOpen)
{
QFileOpenEvent* fileEvent = static_cast<QFileOpenEvent*>(event);
if (!fileEvent->url().isEmpty())
{
if (saveURIs) // Before main window is ready:
savedPaymentRequests.append(fileEvent->url().toString());
else
emit receivedURI(fileEvent->url().toString());
return true;
}
}
return false;
}
void PaymentServer::uiReady()
{
saveURIs = false;
foreach (const QString& s, savedPaymentRequests)
emit receivedURI(s);
savedPaymentRequests.clear();
}
void PaymentServer::handleURIConnection()
{
QLocalSocket *clientConnection = uriServer->nextPendingConnection();
while (clientConnection->bytesAvailable() < (int)sizeof(quint32))
clientConnection->waitForReadyRead();
connect(clientConnection, SIGNAL(disconnected()),
clientConnection, SLOT(deleteLater()));
QDataStream in(clientConnection);
in.setVersion(QDataStream::Qt_4_0);
if (clientConnection->bytesAvailable() < (int)sizeof(quint16)) {
return;
}
QString message;
in >> message;
if (saveURIs)
savedPaymentRequests.append(message);
else
emit receivedURI(message);
}
| mit |
nicksenger/mydegreen | infoParsing/universityParser.py | 1561 | def findBetween(string, before, after):
cursor = 0
finished = False
matchArray = []
while finished == False:
try:
start = string.index(before, cursor) + len(before)
end = string.index(after, start)
matchArray.append(string[start:end])
cursor = end
except ValueError:
finished = True
return matchArray
def findRubbish(string, before, after):
try:
start = string.index(before)
end = string.index(after, start) + len(after)
matchArray = string[start:end]
tupled = string.partition(matchArray)
return tupled[2]
except ValueError:
return ''
return matchArray
def removeRubbish(item):
return findRubbish(item, '//', '/\">')
def removeTruncants(item):
return len(item) > 6
def removeLink(item):
try:
return item.partition(' - Link')[0]
except:
return item
rawUniversities = open("rawUniversities.txt", "r+")
rawString = rawUniversities.read()
rawUniversities.close
firstMatch = findBetween(rawString, '<a href=\"', '</a>')
# print firstMatch
cleaned = map(removeRubbish, firstMatch)
# print cleaned
refined = filter(removeTruncants, cleaned)
# print refined
polished = map(removeLink, refined)
# print polished
stringified = ""
for item in polished:
stringified = stringified + '\"' + item + '\"' + ', '
degreeList = open("degreeList.txt", "wb")
degreeList.write(stringified)
degreeList.close
| mit |
rolandwz/pymisc | matrader/indicators/macd.py | 500 | # -*- coding: utf-8 -*-
from rwlogging import log
from indicators import ma
def calc_macd(prices, fast = 12, slow = 26, sign = 9):
ps = [p['close'] for p in prices]
macds = {}
macds['fast'] = ma.calc_ema(ps, fast)
macds['slow'] = ma.calc_ema(ps, slow)
macds['diff'] = list(map(lambda f,s: round(f - s, 5), macds['fast'], macds['slow']))
macds['dea'] = ma.calc_ema(macds['diff'], sign)
macds['macd'] = list(map(lambda f,s: round(f - s, 5), macds['diff'], macds['dea']))
return macds
| mit |
afton77/p2e-lib-dev | assets/angular-javantech/login.js | 2633 | 'use strict';
//var myJavanTech = angular.module('myJavanTech', []);
//var myJavanTech = angular.module('myJavanTech', ['ui.bootstrap', 'dialogs', 'ngFileUpload', 'ngDialog']);
var myJavanTech = angular.module('myJavanTech', ['ui.bootstrap', 'ngFileUpload', 'ngDialog', 'ngRoute']);
/**
*
* @param int ID
* @param object form
*/
myJavanTech.factory("loginServicesJT", ['$http', function ($http) {
var serviceBase = 'http://localhost:7777/p2e-lib-dev/';
var obj = {};
/**
* Submit Login
* @param JSON data
* @returns JSON
*/
obj.submitLogin = function (data) {
return $http.post(serviceBase + 'login/login', data);
};
return obj;
}]);
/**
*
* @param int ID
* @param object form
*/
myJavanTech.controller('loginController', ['$scope', '$http', '$log', 'ngDialog', '$location', 'loginServicesJT', '$window', function ($scope, $http, $log, ngDialog, $location, loginServicesJT, $window) {
$scope.login = function (event) {
$scope.rLogin = "";
var data = {
email: $scope.txtEmail || "",
password: $scope.txtPassword || ""
};
// console.log(data);
loginServicesJT.submitLogin(data).then(function (r) {
// console.log(r);
if (r.data.r) {
$window.location = "http://localhost:7777/p2e-lib-dev/admins";
} else {
$scope.rLogin = "Maaf, email atau password Anda salah !";
// console.log("Gagal")
}
});
};
$scope.eLogin = function (event) {
if (event.keyCode === 13) {
$scope.rLogin = "";
var data = {
email: $scope.txtEmail || "",
password: $scope.txtPassword || ""
};
loginServicesJT.submitLogin(data).then(function (r) {
if (r.data.r) {
$window.location = "http://localhost:7777/p2e-lib-dev/admins";
} else {
$scope.rLogin = "Maaf, email atau password Anda salah !";
}
});
}
};
$scope.reset = function (event) {
$scope.rLogin = "";
};
}]);
//myJavanTech.config(function ($routeProvider, $locationProvider) {
// $locationProvider.html5Mode(true).hashPrefix('!');
// console.log($routeProvider);
// console.log($locationProvider);
// $routeProvider.when("/post/:id", {
// title: 'Edit Data',
// templateUrl: 'post',
// controller: 'editCtrl',
// resolve: {
// customer: function (services, $route) {
// var customerID = $route.current.params.customerID;
// console.log(customerID);
// // return services.getCustomer(customerID);
// }
// }
// });
//}); | mit |
ALGEBRU/TwitchAFKGame | Game/core/src/com/afkgame/Commands.java | 3388 | package com.afkgame;
import com.afkgame.Twitch.TwitchHandler;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.utils.Array;
import com.gikk.twirk.enums.USER_TYPE;
import com.gikk.twirk.types.users.TwitchUser;
public class Commands {
private static boolean voteIsActive = false;
private static float voteTime = 0.0f;
private static int yesVotes = 0;
private static int noVotes = 0;
private static String voteMessage;
private static Array<Long> voters = new Array<Long>(1000);
static public void up(TwitchUser sender){
if(Game.getPosY() > Gdx.graphics.getHeight() - 64){
Game.setPos(Game.getPosX(), Gdx.graphics.getHeight() - 32);
}else {
Game.setPos(Game.getPosX(), Game.getPosY() + 32);
}
TwitchHandler.sendMessage("@" + sender.getDisplayName() + " Going up");
}
static public void down(TwitchUser sender){
if(Game.getPosY() < 32){
Game.setPos(Game.getPosX(), 0);
}else {
Game.setPos(Game.getPosX(), Game.getPosY() - 32);
}
TwitchHandler.sendMessage("@" + sender.getDisplayName() + " Going down");
}
static public void hello(TwitchUser sender){
TwitchHandler.sendMessage("@" + sender.getDisplayName() + " Hello");
}
static public void callVote(TwitchUser sender, String command){
if(sender.getUserType().value >= USER_TYPE.MOD.value){
voteIsActive = true;
voteMessage = command.substring(10);
TwitchHandler.sendMessage("vote: \"" + voteMessage + "\" type \"!voteYes\" or \"!voteNo\" into chat");
} else {
TwitchHandler.sendMessage("@" + sender.getDisplayName() + " You do not have access to this feature");
}
}
static public void voteYes(TwitchUser voter){
if(voteIsActive && !voters.contains(voter.getUserID(), false)){
yesVotes++;
voters.add(voter.getUserID());
}else {
TwitchHandler.sendMessage("@" + voter.getDisplayName() + " You have already voted, you cannot vote twice or there is no vote up");
}
}
static public void voteNo(TwitchUser voter){
if(voteIsActive && !voters.contains(voter.getUserID(), false)){
noVotes++;
voters.add(voter.getUserID());
}else {
TwitchHandler.sendMessage("@" + voter.getDisplayName() + " You have already voted, you cannot vote twice or there is no vote up");
}
}
static public void voteUpdate(){
if(voteIsActive){
voteTime += Gdx.graphics.getDeltaTime();
if(voteTime >= 30.0){
if(yesVotes > noVotes) {
TwitchHandler.sendMessage(" The vote: \"" + voteMessage + "\" has been voted yes " + yesVotes + " to " + noVotes);
}else if(yesVotes < noVotes){
TwitchHandler.sendMessage("The vote: \"" + voteMessage + "\" has been voted no " + yesVotes + " to " + noVotes);
}else if(yesVotes == noVotes){
TwitchHandler.sendMessage("The vote: \"" + voteMessage + "\" has been tied " + yesVotes + " to " + noVotes);
}
voters.clear();
voteIsActive = false;
voteTime = 0;
yesVotes = 0;
noVotes = 0;
}
}
}
}
| mit |
ankitguptag18/CardDeck | src/main/java/com/ankitgupta/Card.java | 391 | package com.ankitgupta;
/**
* Created by ankitgupta on 9/9/16.
*/
public class Card {
CardShape shape;
CardNumber number;
Card(CardShape shape,CardNumber number){
this.shape = shape;
this.number = number;
}
public CardNumber getNumber() {
return number;
}
public CardShape getShape() {
return shape;
}
public String getName(){
return number + " of " + shape;
}
}
| mit |
kamsar/Unicorn | src/Unicorn/ControlPanel/Pipelines/UnicornControlPanelRequest/UnicornControlPanelRequestPipelineArgs.cs | 667 | using System.Web;
using Sitecore.Pipelines;
using Unicorn.ControlPanel.Responses;
using Unicorn.ControlPanel.Security;
namespace Unicorn.ControlPanel.Pipelines.UnicornControlPanelRequest
{
public class UnicornControlPanelRequestPipelineArgs : PipelineArgs
{
public string Verb { get; private set; }
public HttpContextBase Context { get; private set; }
public SecurityState SecurityState { get; private set; }
public IResponse Response { get; set; }
public UnicornControlPanelRequestPipelineArgs(string verb, HttpContextBase context, SecurityState securityState)
{
Verb = verb;
Context = context;
SecurityState = securityState;
}
}
}
| mit |
MayasHaddad/netFlox | tools/SessionManager.class.php | 756 | <?php
/**
* This controller is responsible of session management
* @author Mayas Haddad
*/
class SessionManager
{
function __construct($sessionVariables = array())
{
}
public function newOrResetSession($posteData)
{
if(session_status() === PHP_SESSION_ACTIVE)
{
$this->endSession();
}
session_start();
$_SESSION = $posteData;
}
public function endSession()
{
if(session_status() !== PHP_SESSION_ACTIVE)
{
session_start();
}
session_unset();
session_destroy();
}
public function getSessionVariable($sessionVariableName = null)
{
if(session_status() !== PHP_SESSION_ACTIVE)
{
session_start();
}
if($sessionVariableName)
{
return $_SESSION[$sessionVariableName];
}
return $_SESSION;
}
} | mit |
buriburisuri/ByteNet | train.py | 1185 | import sugartensor as tf
from model import *
from data import ComTrans
__author__ = '[email protected]'
# set log level to debug
tf.sg_verbosity(10)
#
# hyper parameters
#
batch_size = 16 # batch size
#
# inputs
#
# ComTrans parallel corpus input tensor ( with QueueRunner )
data = ComTrans(batch_size=batch_size)
# source, target sentence
x, y = data.source, data.target
# shift target for training source
y_in = tf.concat([tf.zeros((batch_size, 1), tf.sg_intx), y[:, :-1]], axis=1)
# vocabulary size
voca_size = data.voca_size
# make embedding matrix for source and target
emb_x = tf.sg_emb(name='emb_x', voca_size=voca_size, dim=latent_dim)
emb_y = tf.sg_emb(name='emb_y', voca_size=voca_size, dim=latent_dim)
# latent from embed table
z_x = x.sg_lookup(emb=emb_x)
z_y = y_in.sg_lookup(emb=emb_y)
# encode graph ( atrous convolution )
enc = encode(z_x)
# concat merge target source
enc = enc.sg_concat(target=z_y)
# decode graph ( causal convolution )
dec = decode(enc, voca_size)
# cross entropy loss with logit and mask
loss = dec.sg_ce(target=y, mask=True)
# train
tf.sg_train(loss=loss, log_interval=30, lr=0.0001, ep_size=data.num_batch, max_ep=20)
| mit |
believer/atom-react-alt-templates | assets/Project/src/views/App/App.js | 176 | import React from 'react'
import CSSModules from 'react-css-modules'
import styles from './App.css'
export const App = () =>
<div />
export default CSSModules(App, styles)
| mit |
igorrKurr/ember-cli-photoswipe | tests/test-helper.js | 447 | import resolver from './helpers/resolver';
import { setResolver } from 'ember-qunit';
setResolver(resolver);
document.write('<div id="ember-testing-container"><div id="ember-testing"></div></div>');
QUnit.config.urlConfig.push({ id: 'nocontainer', label: 'Hide container'});
var containerVisibility = QUnit.urlParams.nocontainer ? 'hidden' : 'visible';
document.getElementById('ember-testing-container').style.visibility = containerVisibility;
| mit |
gerritdrost/aes-java | src/main/java/com/gerritdrost/lib/cryptography/symmetrical/tests/Test.java | 1002 | package com.gerritdrost.lib.cryptography.symmetrical.tests;
import com.gerritdrost.lib.cryptography.symmetrical.blockciphers.aes.Aes;
import com.gerritdrost.lib.utils.ByteUtils;
import java.io.IOException;
public class Test {
public static void main(String[] args) throws IOException {
byte[] block = ByteUtils.unsignedToSigned(new int[] {0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff});
byte[] key = ByteUtils.unsignedToSigned(new int[] {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f});
Aes aes = new Aes(key);
System.out.println(" KEY: " + ByteUtils.toHexString(key));
System.out.println(" PLAIN: " + ByteUtils.toHexString(block));
aes.encryptBlock(block);
System.out.println("CIPHER: " + ByteUtils.toHexString(block));
aes.decryptBlock(block);
System.out.println(" PLAIN: " + ByteUtils.toHexString(block));
}
}
| mit |
atlaschan/TooterSymfony | app/cache/dev/twig/c1/f9/31a28ffd374c10bd65aac2984ade.php | 13229 | <?php
/* TwigBundle:Exception:exception.html.twig */
class __TwigTemplate_c1f931a28ffd374c10bd65aac2984ade extends Twig_Template
{
public function __construct(Twig_Environment $env)
{
parent::__construct($env);
$this->parent = false;
$this->blocks = array(
);
}
protected function doDisplay(array $context, array $blocks = array())
{
// line 1
echo "<div class=\"sf-exceptionreset\">
<div class=\"block_exception\">
<div class=\"block_exception_detected clear_fix\">
<div class=\"illustration_exception\">
<img alt=\"Exception detected!\" src=\"";
// line 6
echo twig_escape_filter($this->env, $this->env->getExtension('assets')->getAssetUrl("bundles/framework/images/exception_detected.png"), "html", null, true);
echo "\"/>
</div>
<div class=\"text_exception\">
<div class=\"open_quote\">
<img alt=\"\" src=\"";
// line 11
echo twig_escape_filter($this->env, $this->env->getExtension('assets')->getAssetUrl("bundles/framework/images/open_quote.gif"), "html", null, true);
echo "\"/>
</div>
<h1>
";
// line 15
echo $this->env->getExtension('code')->formatFileFromText(nl2br(twig_escape_filter($this->env, $this->getAttribute((isset($context["exception"]) ? $context["exception"] : $this->getContext($context, "exception")), "message"), "html", null, true)));
echo "
</h1>
<div>
<strong>";
// line 19
echo twig_escape_filter($this->env, (isset($context["status_code"]) ? $context["status_code"] : $this->getContext($context, "status_code")), "html", null, true);
echo "</strong> ";
echo twig_escape_filter($this->env, (isset($context["status_text"]) ? $context["status_text"] : $this->getContext($context, "status_text")), "html", null, true);
echo " - ";
echo $this->env->getExtension('code')->abbrClass($this->getAttribute((isset($context["exception"]) ? $context["exception"] : $this->getContext($context, "exception")), "class"));
echo "
</div>
";
// line 22
$context["previous_count"] = twig_length_filter($this->env, $this->getAttribute((isset($context["exception"]) ? $context["exception"] : $this->getContext($context, "exception")), "allPrevious"));
// line 23
echo " ";
if ((isset($context["previous_count"]) ? $context["previous_count"] : $this->getContext($context, "previous_count"))) {
// line 24
echo " <div class=\"linked\"><span><strong>";
echo twig_escape_filter($this->env, (isset($context["previous_count"]) ? $context["previous_count"] : $this->getContext($context, "previous_count")), "html", null, true);
echo "</strong> linked Exception";
echo ((((isset($context["previous_count"]) ? $context["previous_count"] : $this->getContext($context, "previous_count")) > 1)) ? ("s") : (""));
echo ":</span>
<ul>
";
// line 26
$context['_parent'] = (array) $context;
$context['_seq'] = twig_ensure_traversable($this->getAttribute((isset($context["exception"]) ? $context["exception"] : $this->getContext($context, "exception")), "allPrevious"));
foreach ($context['_seq'] as $context["i"] => $context["previous"]) {
// line 27
echo " <li>
";
// line 28
echo $this->env->getExtension('code')->abbrClass($this->getAttribute((isset($context["previous"]) ? $context["previous"] : $this->getContext($context, "previous")), "class"));
echo " <a href=\"#traces_link_";
echo twig_escape_filter($this->env, ((isset($context["i"]) ? $context["i"] : $this->getContext($context, "i")) + 1), "html", null, true);
echo "\" onclick=\"toggle('traces_";
echo twig_escape_filter($this->env, ((isset($context["i"]) ? $context["i"] : $this->getContext($context, "i")) + 1), "html", null, true);
echo "', 'traces'); switchIcons('icon_traces_";
echo twig_escape_filter($this->env, ((isset($context["i"]) ? $context["i"] : $this->getContext($context, "i")) + 1), "html", null, true);
echo "_open', 'icon_traces_";
echo twig_escape_filter($this->env, ((isset($context["i"]) ? $context["i"] : $this->getContext($context, "i")) + 1), "html", null, true);
echo "_close');\">»</a>
</li>
";
}
$_parent = $context['_parent'];
unset($context['_seq'], $context['_iterated'], $context['i'], $context['previous'], $context['_parent'], $context['loop']);
$context = array_merge($_parent, array_intersect_key($context, $_parent));
// line 31
echo " </ul>
</div>
";
}
// line 34
echo "
<div class=\"close_quote\">
<img alt=\"\" src=\"";
// line 36
echo twig_escape_filter($this->env, $this->env->getExtension('assets')->getAssetUrl("bundles/framework/images/close_quote.gif"), "html", null, true);
echo "\"/>
</div>
</div>
</div>
</div>
";
// line 43
$context['_parent'] = (array) $context;
$context['_seq'] = twig_ensure_traversable($this->getAttribute((isset($context["exception"]) ? $context["exception"] : $this->getContext($context, "exception")), "toarray"));
foreach ($context['_seq'] as $context["position"] => $context["e"]) {
// line 44
echo " ";
$this->env->loadTemplate("TwigBundle:Exception:traces.html.twig")->display(array("exception" => (isset($context["e"]) ? $context["e"] : $this->getContext($context, "e")), "position" => (isset($context["position"]) ? $context["position"] : $this->getContext($context, "position")), "count" => (isset($context["previous_count"]) ? $context["previous_count"] : $this->getContext($context, "previous_count"))));
// line 45
echo " ";
}
$_parent = $context['_parent'];
unset($context['_seq'], $context['_iterated'], $context['position'], $context['e'], $context['_parent'], $context['loop']);
$context = array_merge($_parent, array_intersect_key($context, $_parent));
// line 46
echo "
";
// line 47
if ((isset($context["logger"]) ? $context["logger"] : $this->getContext($context, "logger"))) {
// line 48
echo " <div class=\"block\">
<div class=\"logs clear_fix\">
";
// line 50
ob_start();
// line 51
echo " <h2>
Logs
<a href=\"#\" onclick=\"toggle('logs'); switchIcons('icon_logs_open', 'icon_logs_close'); return false;\">
<img class=\"toggle\" id=\"icon_logs_open\" alt=\"+\" src=\"";
// line 54
echo twig_escape_filter($this->env, $this->env->getExtension('assets')->getAssetUrl("bundles/framework/images/blue_picto_more.gif"), "html", null, true);
echo "\" style=\"visibility: hidden\" />
<img class=\"toggle\" id=\"icon_logs_close\" alt=\"-\" src=\"";
// line 55
echo twig_escape_filter($this->env, $this->env->getExtension('assets')->getAssetUrl("bundles/framework/images/blue_picto_less.gif"), "html", null, true);
echo "\" style=\"visibility: visible; margin-left: -18px\" />
</a>
</h2>
";
echo trim(preg_replace('/>\s+</', '><', ob_get_clean()));
// line 59
echo "
";
// line 60
if ($this->getAttribute((isset($context["logger"]) ? $context["logger"] : $this->getContext($context, "logger")), "counterrors")) {
// line 61
echo " <div class=\"error_count\">
<span>
";
// line 63
echo twig_escape_filter($this->env, $this->getAttribute((isset($context["logger"]) ? $context["logger"] : $this->getContext($context, "logger")), "counterrors"), "html", null, true);
echo " error";
echo ((($this->getAttribute((isset($context["logger"]) ? $context["logger"] : $this->getContext($context, "logger")), "counterrors") > 1)) ? ("s") : (""));
echo "
</span>
</div>
";
}
// line 67
echo "
</div>
<div id=\"logs\">
";
// line 71
$this->env->loadTemplate("TwigBundle:Exception:logs.html.twig")->display(array("logs" => $this->getAttribute((isset($context["logger"]) ? $context["logger"] : $this->getContext($context, "logger")), "logs")));
// line 72
echo " </div>
</div>
";
}
// line 76
echo "
";
// line 77
if ((isset($context["currentContent"]) ? $context["currentContent"] : $this->getContext($context, "currentContent"))) {
// line 78
echo " <div class=\"block\">
";
// line 79
ob_start();
// line 80
echo " <h2>
Content of the Output
<a href=\"#\" onclick=\"toggle('output_content'); switchIcons('icon_content_open', 'icon_content_close'); return false;\">
<img class=\"toggle\" id=\"icon_content_close\" alt=\"-\" src=\"";
// line 83
echo twig_escape_filter($this->env, $this->env->getExtension('assets')->getAssetUrl("bundles/framework/images/blue_picto_less.gif"), "html", null, true);
echo "\" style=\"visibility: hidden\" />
<img class=\"toggle\" id=\"icon_content_open\" alt=\"+\" src=\"";
// line 84
echo twig_escape_filter($this->env, $this->env->getExtension('assets')->getAssetUrl("bundles/framework/images/blue_picto_more.gif"), "html", null, true);
echo "\" style=\"visibility: visible; margin-left: -18px\" />
</a>
</h2>
";
echo trim(preg_replace('/>\s+</', '><', ob_get_clean()));
// line 88
echo "
<div id=\"output_content\" style=\"display: none\">
";
// line 90
echo twig_escape_filter($this->env, (isset($context["currentContent"]) ? $context["currentContent"] : $this->getContext($context, "currentContent")), "html", null, true);
echo "
</div>
<div style=\"clear: both\"></div>
</div>
";
}
// line 96
echo "
</div>
<script type=\"text/javascript\">//<![CDATA[
function toggle(id, clazz) {
var el = document.getElementById(id),
current = el.style.display,
i;
if (clazz) {
var tags = document.getElementsByTagName('*');
for (i = tags.length - 1; i >= 0 ; i--) {
if (tags[i].className === clazz) {
tags[i].style.display = 'none';
}
}
}
el.style.display = current === 'none' ? 'block' : 'none';
}
function switchIcons(id1, id2) {
var icon1, icon2, visibility1, visibility2;
icon1 = document.getElementById(id1);
icon2 = document.getElementById(id2);
visibility1 = icon1.style.visibility;
visibility2 = icon2.style.visibility;
icon1.style.visibility = visibility2;
icon2.style.visibility = visibility1;
}
//]]></script>
";
}
public function getTemplateName()
{
return "TwigBundle:Exception:exception.html.twig";
}
public function isTraitable()
{
return false;
}
public function getDebugInfo()
{
return array ( 225 => 96, 216 => 90, 212 => 88, 205 => 84, 201 => 83, 196 => 80, 194 => 79, 191 => 78, 189 => 77, 186 => 76, 180 => 72, 178 => 71, 172 => 67, 163 => 63, 159 => 61, 157 => 60, 154 => 59, 147 => 55, 143 => 54, 138 => 51, 136 => 50, 132 => 48, 130 => 47, 127 => 46, 121 => 45, 118 => 44, 114 => 43, 104 => 36, 100 => 34, 95 => 31, 78 => 28, 75 => 27, 71 => 26, 63 => 24, 60 => 23, 58 => 22, 41 => 15, 34 => 11, 19 => 1, 94 => 39, 88 => 6, 81 => 40, 79 => 39, 59 => 22, 48 => 19, 39 => 8, 35 => 7, 31 => 6, 26 => 6, 21 => 1, 46 => 8, 43 => 7, 32 => 4, 29 => 3,);
}
}
| mit |
dvaJi/ReaderFront | packages/web/src/__tests__/components/layout/header.test.js | 1686 | import React from 'react';
import { mountWithIntl } from 'utils/enzyme-intl';
import * as nextRouter from 'next/router';
import Header from '@components/layout/header';
jest.mock('@components/layout/RouteNavItem', () => ({ children }) => (
<a>{children}</a>
));
it('should render Public Nav without throwing an error', () => {
const wrapper = mountWithIntl(<Header />);
expect(wrapper.find('nav')).toBeTruthy();
expect(wrapper.find('nav').prop('style').display).toBe('flex');
wrapper.unmount();
});
it('should render Admin Nav without throwing an error', () => {
nextRouter.withRouter = jest.fn();
nextRouter.withRouter.mockImplementation(() => () => Component => props => (
<Component {...props} router={{ pathname: '/admincp/dashboard' }} />
));
nextRouter.useRouter = jest.fn();
nextRouter.useRouter.mockImplementation(() => ({
route: '/admincp/dashboard',
query: {},
pathname: '/admincp/dashboard',
prefetch: async () => undefined
}));
const wrapper = mountWithIntl(<Header />);
expect(wrapper.find('nav')).toBeTruthy();
wrapper.unmount();
});
it('should hidden if the path is /read without throwing an error', () => {
nextRouter.useRouter = jest.fn();
nextRouter.useRouter.mockImplementation(() => ({
route: '/read/grateful_dead/es/1/3.0',
pathname: '/read/grateful_dead/es/1/3.0',
query: {
slug: 'grateful_dead',
lang: 'es',
volume: '2',
chapter: '3.0'
},
prefetch: async () => undefined
}));
const wrapper = mountWithIntl(<Header />);
expect(wrapper.find('nav')).toBeTruthy();
expect(wrapper.find('nav').prop('style').display).toBe('none');
wrapper.unmount();
});
| mit |
betteridiots/ddf-maven-plugin | src/test/java/org/betteridiots/maven/plugins/ddf/DDFInstallAppMojoTest.java | 944 | package org.betteridiots.maven.plugins.ddf;
import org.apache.maven.plugin.testing.AbstractMojoTestCase;
import java.io.File;
public class DDFInstallAppMojoTest extends AbstractMojoTestCase
{
protected void setUp() throws Exception
{
super.setUp();
}
public void testMojoGoal() throws Exception
{
File testPom = new File( getBasedir(), "src/test/resources/unit/install-app-test/install-app-test.xml" );
DDFInstallAppMojo mojo = (DDFInstallAppMojo) lookupMojo( "install-app", testPom );
// Check for null values
assertNotNull( mojo );
assertNotNull( getVariableValueFromObject( mojo, "host" ) );
assertNotNull( getVariableValueFromObject( mojo, "port" ) );
assertNotNull( getVariableValueFromObject( mojo, "user" ) );
assertNotNull( getVariableValueFromObject( mojo, "password" ) );
// Execute mojo test
// mojo.execute();
}
}
| mit |
michaeldwan/static | vendor/github.com/aws/aws-sdk-go/service/ecs/examples_test.go | 28161 | // THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
package ecs_test
import (
"bytes"
"fmt"
"time"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/awserr"
"github.com/aws/aws-sdk-go/aws/awsutil"
"github.com/aws/aws-sdk-go/service/ecs"
)
var _ time.Duration
var _ bytes.Buffer
func ExampleECS_CreateCluster() {
svc := ecs.New(nil)
params := &ecs.CreateClusterInput{
ClusterName: aws.String("String"),
}
resp, err := svc.CreateCluster(params)
if err != nil {
if awsErr, ok := err.(awserr.Error); ok {
// Generic AWS error with Code, Message, and original error (if any)
fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
if reqErr, ok := err.(awserr.RequestFailure); ok {
// A service error occurred
fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID())
}
} else {
// This case should never be hit, the SDK should always return an
// error which satisfies the awserr.Error interface.
fmt.Println(err.Error())
}
}
// Pretty-print the response data.
fmt.Println(awsutil.StringValue(resp))
}
func ExampleECS_CreateService() {
svc := ecs.New(nil)
params := &ecs.CreateServiceInput{
DesiredCount: aws.Long(1), // Required
ServiceName: aws.String("String"), // Required
TaskDefinition: aws.String("String"), // Required
ClientToken: aws.String("String"),
Cluster: aws.String("String"),
LoadBalancers: []*ecs.LoadBalancer{
{ // Required
ContainerName: aws.String("String"),
ContainerPort: aws.Long(1),
LoadBalancerName: aws.String("String"),
},
// More values...
},
Role: aws.String("String"),
}
resp, err := svc.CreateService(params)
if err != nil {
if awsErr, ok := err.(awserr.Error); ok {
// Generic AWS error with Code, Message, and original error (if any)
fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
if reqErr, ok := err.(awserr.RequestFailure); ok {
// A service error occurred
fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID())
}
} else {
// This case should never be hit, the SDK should always return an
// error which satisfies the awserr.Error interface.
fmt.Println(err.Error())
}
}
// Pretty-print the response data.
fmt.Println(awsutil.StringValue(resp))
}
func ExampleECS_DeleteCluster() {
svc := ecs.New(nil)
params := &ecs.DeleteClusterInput{
Cluster: aws.String("String"), // Required
}
resp, err := svc.DeleteCluster(params)
if err != nil {
if awsErr, ok := err.(awserr.Error); ok {
// Generic AWS error with Code, Message, and original error (if any)
fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
if reqErr, ok := err.(awserr.RequestFailure); ok {
// A service error occurred
fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID())
}
} else {
// This case should never be hit, the SDK should always return an
// error which satisfies the awserr.Error interface.
fmt.Println(err.Error())
}
}
// Pretty-print the response data.
fmt.Println(awsutil.StringValue(resp))
}
func ExampleECS_DeleteService() {
svc := ecs.New(nil)
params := &ecs.DeleteServiceInput{
Service: aws.String("String"), // Required
Cluster: aws.String("String"),
}
resp, err := svc.DeleteService(params)
if err != nil {
if awsErr, ok := err.(awserr.Error); ok {
// Generic AWS error with Code, Message, and original error (if any)
fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
if reqErr, ok := err.(awserr.RequestFailure); ok {
// A service error occurred
fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID())
}
} else {
// This case should never be hit, the SDK should always return an
// error which satisfies the awserr.Error interface.
fmt.Println(err.Error())
}
}
// Pretty-print the response data.
fmt.Println(awsutil.StringValue(resp))
}
func ExampleECS_DeregisterContainerInstance() {
svc := ecs.New(nil)
params := &ecs.DeregisterContainerInstanceInput{
ContainerInstance: aws.String("String"), // Required
Cluster: aws.String("String"),
Force: aws.Boolean(true),
}
resp, err := svc.DeregisterContainerInstance(params)
if err != nil {
if awsErr, ok := err.(awserr.Error); ok {
// Generic AWS error with Code, Message, and original error (if any)
fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
if reqErr, ok := err.(awserr.RequestFailure); ok {
// A service error occurred
fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID())
}
} else {
// This case should never be hit, the SDK should always return an
// error which satisfies the awserr.Error interface.
fmt.Println(err.Error())
}
}
// Pretty-print the response data.
fmt.Println(awsutil.StringValue(resp))
}
func ExampleECS_DeregisterTaskDefinition() {
svc := ecs.New(nil)
params := &ecs.DeregisterTaskDefinitionInput{
TaskDefinition: aws.String("String"), // Required
}
resp, err := svc.DeregisterTaskDefinition(params)
if err != nil {
if awsErr, ok := err.(awserr.Error); ok {
// Generic AWS error with Code, Message, and original error (if any)
fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
if reqErr, ok := err.(awserr.RequestFailure); ok {
// A service error occurred
fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID())
}
} else {
// This case should never be hit, the SDK should always return an
// error which satisfies the awserr.Error interface.
fmt.Println(err.Error())
}
}
// Pretty-print the response data.
fmt.Println(awsutil.StringValue(resp))
}
func ExampleECS_DescribeClusters() {
svc := ecs.New(nil)
params := &ecs.DescribeClustersInput{
Clusters: []*string{
aws.String("String"), // Required
// More values...
},
}
resp, err := svc.DescribeClusters(params)
if err != nil {
if awsErr, ok := err.(awserr.Error); ok {
// Generic AWS error with Code, Message, and original error (if any)
fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
if reqErr, ok := err.(awserr.RequestFailure); ok {
// A service error occurred
fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID())
}
} else {
// This case should never be hit, the SDK should always return an
// error which satisfies the awserr.Error interface.
fmt.Println(err.Error())
}
}
// Pretty-print the response data.
fmt.Println(awsutil.StringValue(resp))
}
func ExampleECS_DescribeContainerInstances() {
svc := ecs.New(nil)
params := &ecs.DescribeContainerInstancesInput{
ContainerInstances: []*string{ // Required
aws.String("String"), // Required
// More values...
},
Cluster: aws.String("String"),
}
resp, err := svc.DescribeContainerInstances(params)
if err != nil {
if awsErr, ok := err.(awserr.Error); ok {
// Generic AWS error with Code, Message, and original error (if any)
fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
if reqErr, ok := err.(awserr.RequestFailure); ok {
// A service error occurred
fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID())
}
} else {
// This case should never be hit, the SDK should always return an
// error which satisfies the awserr.Error interface.
fmt.Println(err.Error())
}
}
// Pretty-print the response data.
fmt.Println(awsutil.StringValue(resp))
}
func ExampleECS_DescribeServices() {
svc := ecs.New(nil)
params := &ecs.DescribeServicesInput{
Services: []*string{ // Required
aws.String("String"), // Required
// More values...
},
Cluster: aws.String("String"),
}
resp, err := svc.DescribeServices(params)
if err != nil {
if awsErr, ok := err.(awserr.Error); ok {
// Generic AWS error with Code, Message, and original error (if any)
fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
if reqErr, ok := err.(awserr.RequestFailure); ok {
// A service error occurred
fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID())
}
} else {
// This case should never be hit, the SDK should always return an
// error which satisfies the awserr.Error interface.
fmt.Println(err.Error())
}
}
// Pretty-print the response data.
fmt.Println(awsutil.StringValue(resp))
}
func ExampleECS_DescribeTaskDefinition() {
svc := ecs.New(nil)
params := &ecs.DescribeTaskDefinitionInput{
TaskDefinition: aws.String("String"), // Required
}
resp, err := svc.DescribeTaskDefinition(params)
if err != nil {
if awsErr, ok := err.(awserr.Error); ok {
// Generic AWS error with Code, Message, and original error (if any)
fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
if reqErr, ok := err.(awserr.RequestFailure); ok {
// A service error occurred
fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID())
}
} else {
// This case should never be hit, the SDK should always return an
// error which satisfies the awserr.Error interface.
fmt.Println(err.Error())
}
}
// Pretty-print the response data.
fmt.Println(awsutil.StringValue(resp))
}
func ExampleECS_DescribeTasks() {
svc := ecs.New(nil)
params := &ecs.DescribeTasksInput{
Tasks: []*string{ // Required
aws.String("String"), // Required
// More values...
},
Cluster: aws.String("String"),
}
resp, err := svc.DescribeTasks(params)
if err != nil {
if awsErr, ok := err.(awserr.Error); ok {
// Generic AWS error with Code, Message, and original error (if any)
fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
if reqErr, ok := err.(awserr.RequestFailure); ok {
// A service error occurred
fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID())
}
} else {
// This case should never be hit, the SDK should always return an
// error which satisfies the awserr.Error interface.
fmt.Println(err.Error())
}
}
// Pretty-print the response data.
fmt.Println(awsutil.StringValue(resp))
}
func ExampleECS_DiscoverPollEndpoint() {
svc := ecs.New(nil)
params := &ecs.DiscoverPollEndpointInput{
Cluster: aws.String("String"),
ContainerInstance: aws.String("String"),
}
resp, err := svc.DiscoverPollEndpoint(params)
if err != nil {
if awsErr, ok := err.(awserr.Error); ok {
// Generic AWS error with Code, Message, and original error (if any)
fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
if reqErr, ok := err.(awserr.RequestFailure); ok {
// A service error occurred
fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID())
}
} else {
// This case should never be hit, the SDK should always return an
// error which satisfies the awserr.Error interface.
fmt.Println(err.Error())
}
}
// Pretty-print the response data.
fmt.Println(awsutil.StringValue(resp))
}
func ExampleECS_ListClusters() {
svc := ecs.New(nil)
params := &ecs.ListClustersInput{
MaxResults: aws.Long(1),
NextToken: aws.String("String"),
}
resp, err := svc.ListClusters(params)
if err != nil {
if awsErr, ok := err.(awserr.Error); ok {
// Generic AWS error with Code, Message, and original error (if any)
fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
if reqErr, ok := err.(awserr.RequestFailure); ok {
// A service error occurred
fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID())
}
} else {
// This case should never be hit, the SDK should always return an
// error which satisfies the awserr.Error interface.
fmt.Println(err.Error())
}
}
// Pretty-print the response data.
fmt.Println(awsutil.StringValue(resp))
}
func ExampleECS_ListContainerInstances() {
svc := ecs.New(nil)
params := &ecs.ListContainerInstancesInput{
Cluster: aws.String("String"),
MaxResults: aws.Long(1),
NextToken: aws.String("String"),
}
resp, err := svc.ListContainerInstances(params)
if err != nil {
if awsErr, ok := err.(awserr.Error); ok {
// Generic AWS error with Code, Message, and original error (if any)
fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
if reqErr, ok := err.(awserr.RequestFailure); ok {
// A service error occurred
fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID())
}
} else {
// This case should never be hit, the SDK should always return an
// error which satisfies the awserr.Error interface.
fmt.Println(err.Error())
}
}
// Pretty-print the response data.
fmt.Println(awsutil.StringValue(resp))
}
func ExampleECS_ListServices() {
svc := ecs.New(nil)
params := &ecs.ListServicesInput{
Cluster: aws.String("String"),
MaxResults: aws.Long(1),
NextToken: aws.String("String"),
}
resp, err := svc.ListServices(params)
if err != nil {
if awsErr, ok := err.(awserr.Error); ok {
// Generic AWS error with Code, Message, and original error (if any)
fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
if reqErr, ok := err.(awserr.RequestFailure); ok {
// A service error occurred
fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID())
}
} else {
// This case should never be hit, the SDK should always return an
// error which satisfies the awserr.Error interface.
fmt.Println(err.Error())
}
}
// Pretty-print the response data.
fmt.Println(awsutil.StringValue(resp))
}
func ExampleECS_ListTaskDefinitionFamilies() {
svc := ecs.New(nil)
params := &ecs.ListTaskDefinitionFamiliesInput{
FamilyPrefix: aws.String("String"),
MaxResults: aws.Long(1),
NextToken: aws.String("String"),
}
resp, err := svc.ListTaskDefinitionFamilies(params)
if err != nil {
if awsErr, ok := err.(awserr.Error); ok {
// Generic AWS error with Code, Message, and original error (if any)
fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
if reqErr, ok := err.(awserr.RequestFailure); ok {
// A service error occurred
fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID())
}
} else {
// This case should never be hit, the SDK should always return an
// error which satisfies the awserr.Error interface.
fmt.Println(err.Error())
}
}
// Pretty-print the response data.
fmt.Println(awsutil.StringValue(resp))
}
func ExampleECS_ListTaskDefinitions() {
svc := ecs.New(nil)
params := &ecs.ListTaskDefinitionsInput{
FamilyPrefix: aws.String("String"),
MaxResults: aws.Long(1),
NextToken: aws.String("String"),
Sort: aws.String("SortOrder"),
Status: aws.String("TaskDefinitionStatus"),
}
resp, err := svc.ListTaskDefinitions(params)
if err != nil {
if awsErr, ok := err.(awserr.Error); ok {
// Generic AWS error with Code, Message, and original error (if any)
fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
if reqErr, ok := err.(awserr.RequestFailure); ok {
// A service error occurred
fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID())
}
} else {
// This case should never be hit, the SDK should always return an
// error which satisfies the awserr.Error interface.
fmt.Println(err.Error())
}
}
// Pretty-print the response data.
fmt.Println(awsutil.StringValue(resp))
}
func ExampleECS_ListTasks() {
svc := ecs.New(nil)
params := &ecs.ListTasksInput{
Cluster: aws.String("String"),
ContainerInstance: aws.String("String"),
DesiredStatus: aws.String("DesiredStatus"),
Family: aws.String("String"),
MaxResults: aws.Long(1),
NextToken: aws.String("String"),
ServiceName: aws.String("String"),
StartedBy: aws.String("String"),
}
resp, err := svc.ListTasks(params)
if err != nil {
if awsErr, ok := err.(awserr.Error); ok {
// Generic AWS error with Code, Message, and original error (if any)
fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
if reqErr, ok := err.(awserr.RequestFailure); ok {
// A service error occurred
fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID())
}
} else {
// This case should never be hit, the SDK should always return an
// error which satisfies the awserr.Error interface.
fmt.Println(err.Error())
}
}
// Pretty-print the response data.
fmt.Println(awsutil.StringValue(resp))
}
func ExampleECS_RegisterContainerInstance() {
svc := ecs.New(nil)
params := &ecs.RegisterContainerInstanceInput{
Cluster: aws.String("String"),
InstanceIdentityDocument: aws.String("String"),
InstanceIdentityDocumentSignature: aws.String("String"),
TotalResources: []*ecs.Resource{
{ // Required
DoubleValue: aws.Double(1.0),
IntegerValue: aws.Long(1),
LongValue: aws.Long(1),
Name: aws.String("String"),
StringSetValue: []*string{
aws.String("String"), // Required
// More values...
},
Type: aws.String("String"),
},
// More values...
},
VersionInfo: &ecs.VersionInfo{
AgentHash: aws.String("String"),
AgentVersion: aws.String("String"),
DockerVersion: aws.String("String"),
},
}
resp, err := svc.RegisterContainerInstance(params)
if err != nil {
if awsErr, ok := err.(awserr.Error); ok {
// Generic AWS error with Code, Message, and original error (if any)
fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
if reqErr, ok := err.(awserr.RequestFailure); ok {
// A service error occurred
fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID())
}
} else {
// This case should never be hit, the SDK should always return an
// error which satisfies the awserr.Error interface.
fmt.Println(err.Error())
}
}
// Pretty-print the response data.
fmt.Println(awsutil.StringValue(resp))
}
func ExampleECS_RegisterTaskDefinition() {
svc := ecs.New(nil)
params := &ecs.RegisterTaskDefinitionInput{
ContainerDefinitions: []*ecs.ContainerDefinition{ // Required
{ // Required
CPU: aws.Long(1),
Command: []*string{
aws.String("String"), // Required
// More values...
},
EntryPoint: []*string{
aws.String("String"), // Required
// More values...
},
Environment: []*ecs.KeyValuePair{
{ // Required
Name: aws.String("String"),
Value: aws.String("String"),
},
// More values...
},
Essential: aws.Boolean(true),
Image: aws.String("String"),
Links: []*string{
aws.String("String"), // Required
// More values...
},
Memory: aws.Long(1),
MountPoints: []*ecs.MountPoint{
{ // Required
ContainerPath: aws.String("String"),
ReadOnly: aws.Boolean(true),
SourceVolume: aws.String("String"),
},
// More values...
},
Name: aws.String("String"),
PortMappings: []*ecs.PortMapping{
{ // Required
ContainerPort: aws.Long(1),
HostPort: aws.Long(1),
Protocol: aws.String("TransportProtocol"),
},
// More values...
},
VolumesFrom: []*ecs.VolumeFrom{
{ // Required
ReadOnly: aws.Boolean(true),
SourceContainer: aws.String("String"),
},
// More values...
},
},
// More values...
},
Family: aws.String("String"), // Required
Volumes: []*ecs.Volume{
{ // Required
Host: &ecs.HostVolumeProperties{
SourcePath: aws.String("String"),
},
Name: aws.String("String"),
},
// More values...
},
}
resp, err := svc.RegisterTaskDefinition(params)
if err != nil {
if awsErr, ok := err.(awserr.Error); ok {
// Generic AWS error with Code, Message, and original error (if any)
fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
if reqErr, ok := err.(awserr.RequestFailure); ok {
// A service error occurred
fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID())
}
} else {
// This case should never be hit, the SDK should always return an
// error which satisfies the awserr.Error interface.
fmt.Println(err.Error())
}
}
// Pretty-print the response data.
fmt.Println(awsutil.StringValue(resp))
}
func ExampleECS_RunTask() {
svc := ecs.New(nil)
params := &ecs.RunTaskInput{
TaskDefinition: aws.String("String"), // Required
Cluster: aws.String("String"),
Count: aws.Long(1),
Overrides: &ecs.TaskOverride{
ContainerOverrides: []*ecs.ContainerOverride{
{ // Required
Command: []*string{
aws.String("String"), // Required
// More values...
},
Environment: []*ecs.KeyValuePair{
{ // Required
Name: aws.String("String"),
Value: aws.String("String"),
},
// More values...
},
Name: aws.String("String"),
},
// More values...
},
},
StartedBy: aws.String("String"),
}
resp, err := svc.RunTask(params)
if err != nil {
if awsErr, ok := err.(awserr.Error); ok {
// Generic AWS error with Code, Message, and original error (if any)
fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
if reqErr, ok := err.(awserr.RequestFailure); ok {
// A service error occurred
fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID())
}
} else {
// This case should never be hit, the SDK should always return an
// error which satisfies the awserr.Error interface.
fmt.Println(err.Error())
}
}
// Pretty-print the response data.
fmt.Println(awsutil.StringValue(resp))
}
func ExampleECS_StartTask() {
svc := ecs.New(nil)
params := &ecs.StartTaskInput{
ContainerInstances: []*string{ // Required
aws.String("String"), // Required
// More values...
},
TaskDefinition: aws.String("String"), // Required
Cluster: aws.String("String"),
Overrides: &ecs.TaskOverride{
ContainerOverrides: []*ecs.ContainerOverride{
{ // Required
Command: []*string{
aws.String("String"), // Required
// More values...
},
Environment: []*ecs.KeyValuePair{
{ // Required
Name: aws.String("String"),
Value: aws.String("String"),
},
// More values...
},
Name: aws.String("String"),
},
// More values...
},
},
StartedBy: aws.String("String"),
}
resp, err := svc.StartTask(params)
if err != nil {
if awsErr, ok := err.(awserr.Error); ok {
// Generic AWS error with Code, Message, and original error (if any)
fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
if reqErr, ok := err.(awserr.RequestFailure); ok {
// A service error occurred
fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID())
}
} else {
// This case should never be hit, the SDK should always return an
// error which satisfies the awserr.Error interface.
fmt.Println(err.Error())
}
}
// Pretty-print the response data.
fmt.Println(awsutil.StringValue(resp))
}
func ExampleECS_StopTask() {
svc := ecs.New(nil)
params := &ecs.StopTaskInput{
Task: aws.String("String"), // Required
Cluster: aws.String("String"),
}
resp, err := svc.StopTask(params)
if err != nil {
if awsErr, ok := err.(awserr.Error); ok {
// Generic AWS error with Code, Message, and original error (if any)
fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
if reqErr, ok := err.(awserr.RequestFailure); ok {
// A service error occurred
fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID())
}
} else {
// This case should never be hit, the SDK should always return an
// error which satisfies the awserr.Error interface.
fmt.Println(err.Error())
}
}
// Pretty-print the response data.
fmt.Println(awsutil.StringValue(resp))
}
func ExampleECS_SubmitContainerStateChange() {
svc := ecs.New(nil)
params := &ecs.SubmitContainerStateChangeInput{
Cluster: aws.String("String"),
ContainerName: aws.String("String"),
ExitCode: aws.Long(1),
NetworkBindings: []*ecs.NetworkBinding{
{ // Required
BindIP: aws.String("String"),
ContainerPort: aws.Long(1),
HostPort: aws.Long(1),
Protocol: aws.String("TransportProtocol"),
},
// More values...
},
Reason: aws.String("String"),
Status: aws.String("String"),
Task: aws.String("String"),
}
resp, err := svc.SubmitContainerStateChange(params)
if err != nil {
if awsErr, ok := err.(awserr.Error); ok {
// Generic AWS error with Code, Message, and original error (if any)
fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
if reqErr, ok := err.(awserr.RequestFailure); ok {
// A service error occurred
fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID())
}
} else {
// This case should never be hit, the SDK should always return an
// error which satisfies the awserr.Error interface.
fmt.Println(err.Error())
}
}
// Pretty-print the response data.
fmt.Println(awsutil.StringValue(resp))
}
func ExampleECS_SubmitTaskStateChange() {
svc := ecs.New(nil)
params := &ecs.SubmitTaskStateChangeInput{
Cluster: aws.String("String"),
Reason: aws.String("String"),
Status: aws.String("String"),
Task: aws.String("String"),
}
resp, err := svc.SubmitTaskStateChange(params)
if err != nil {
if awsErr, ok := err.(awserr.Error); ok {
// Generic AWS error with Code, Message, and original error (if any)
fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
if reqErr, ok := err.(awserr.RequestFailure); ok {
// A service error occurred
fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID())
}
} else {
// This case should never be hit, the SDK should always return an
// error which satisfies the awserr.Error interface.
fmt.Println(err.Error())
}
}
// Pretty-print the response data.
fmt.Println(awsutil.StringValue(resp))
}
func ExampleECS_UpdateContainerAgent() {
svc := ecs.New(nil)
params := &ecs.UpdateContainerAgentInput{
ContainerInstance: aws.String("String"), // Required
Cluster: aws.String("String"),
}
resp, err := svc.UpdateContainerAgent(params)
if err != nil {
if awsErr, ok := err.(awserr.Error); ok {
// Generic AWS error with Code, Message, and original error (if any)
fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
if reqErr, ok := err.(awserr.RequestFailure); ok {
// A service error occurred
fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID())
}
} else {
// This case should never be hit, the SDK should always return an
// error which satisfies the awserr.Error interface.
fmt.Println(err.Error())
}
}
// Pretty-print the response data.
fmt.Println(awsutil.StringValue(resp))
}
func ExampleECS_UpdateService() {
svc := ecs.New(nil)
params := &ecs.UpdateServiceInput{
Service: aws.String("String"), // Required
Cluster: aws.String("String"),
DesiredCount: aws.Long(1),
TaskDefinition: aws.String("String"),
}
resp, err := svc.UpdateService(params)
if err != nil {
if awsErr, ok := err.(awserr.Error); ok {
// Generic AWS error with Code, Message, and original error (if any)
fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr())
if reqErr, ok := err.(awserr.RequestFailure); ok {
// A service error occurred
fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID())
}
} else {
// This case should never be hit, the SDK should always return an
// error which satisfies the awserr.Error interface.
fmt.Println(err.Error())
}
}
// Pretty-print the response data.
fmt.Println(awsutil.StringValue(resp))
}
| mit |
bpreece/Frodo | src/com/bpreece/lotr/FrodoTokenManager.java | 74995 | /* Generated By:JavaCC: Do not edit this line. FrodoTokenManager.java */
package com.bpreece.lotr;
import java.io.BufferedReader;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintStream;
import java.io.Reader;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/** Token Manager. */
public class FrodoTokenManager implements FrodoConstants
{
/** Debug output. */
public static java.io.PrintStream debugStream = System.out;
/** Set debug output. */
public static void setDebugStream(java.io.PrintStream ds) { debugStream = ds; }
private static final int jjStopStringLiteralDfa_0(int pos, long active0)
{
switch (pos)
{
case 0:
if ((active0 & 0x20000000080000L) != 0L)
{
jjmatchedKind = 59;
return 9;
}
if ((active0 & 0x10000000000L) != 0L)
{
jjmatchedKind = 59;
return 32;
}
if ((active0 & 0x178001fc10000L) != 0L)
{
jjmatchedKind = 59;
return 46;
}
if ((active0 & 0x1e000000008400L) != 0L)
{
jjmatchedKind = 59;
return 74;
}
if ((active0 & 0x120000L) != 0L)
{
jjmatchedKind = 59;
return 100;
}
if ((active0 & 0x7800000000L) != 0L)
{
jjmatchedKind = 59;
return 24;
}
if ((active0 & 0x200L) != 0L)
{
jjmatchedKind = 59;
return 40;
}
if ((active0 & 0x200000L) != 0L)
{
jjmatchedKind = 59;
return 82;
}
if ((active0 & 0x20L) != 0L)
return 66;
if ((active0 & 0x3c0000000L) != 0L)
{
jjmatchedKind = 59;
return 18;
}
return -1;
case 1:
if ((active0 & 0x7800000000L) != 0L)
{
jjmatchedKind = 59;
jjmatchedPos = 1;
return 23;
}
if ((active0 & 0x1780000010000L) != 0L)
{
jjmatchedKind = 59;
jjmatchedPos = 1;
return 45;
}
if ((active0 & 0x10000000000L) != 0L)
{
jjmatchedKind = 59;
jjmatchedPos = 1;
return 31;
}
if ((active0 & 0x100000L) != 0L)
{
jjmatchedKind = 59;
jjmatchedPos = 1;
return 99;
}
if ((active0 & 0x3e00001fe28600L) != 0L)
{
jjmatchedKind = 59;
jjmatchedPos = 1;
return 74;
}
if ((active0 & 0x80000L) != 0L)
{
jjmatchedKind = 59;
jjmatchedPos = 1;
return 8;
}
if ((active0 & 0x3c0000000L) != 0L)
{
jjmatchedKind = 59;
jjmatchedPos = 1;
return 17;
}
return -1;
case 2:
if ((active0 & 0x80000000000L) != 0L)
{
jjmatchedKind = 59;
jjmatchedPos = 2;
return 44;
}
if ((active0 & 0x10000000000L) != 0L)
{
jjmatchedKind = 59;
jjmatchedPos = 2;
return 30;
}
if ((active0 & 0x7800000000L) != 0L)
{
jjmatchedKind = 59;
jjmatchedPos = 2;
return 22;
}
if ((active0 & 0x400L) != 0L)
return 74;
if ((active0 & 0x3970001fe38200L) != 0L)
{
jjmatchedKind = 59;
jjmatchedPos = 2;
return 74;
}
if ((active0 & 0x3c0000000L) != 0L)
{
jjmatchedKind = 59;
jjmatchedPos = 2;
return 16;
}
if ((active0 & 0x6000000000000L) != 0L)
{
if (jjmatchedPos < 1)
{
jjmatchedKind = 59;
jjmatchedPos = 1;
}
return -1;
}
if ((active0 & 0x80000L) != 0L)
{
jjmatchedKind = 59;
jjmatchedPos = 2;
return 7;
}
if ((active0 & 0x100000L) != 0L)
{
jjmatchedKind = 13;
jjmatchedPos = 2;
return 74;
}
return -1;
case 3:
if ((active0 & 0x6000000000000L) != 0L)
{
if (jjmatchedPos < 1)
{
jjmatchedKind = 59;
jjmatchedPos = 1;
}
return -1;
}
if ((active0 & 0x10000000000L) != 0L)
{
jjmatchedKind = 59;
jjmatchedPos = 3;
return 29;
}
if ((active0 & 0x80000L) != 0L)
{
jjmatchedKind = 59;
jjmatchedPos = 3;
return 6;
}
if ((active0 & 0x80000000000L) != 0L)
{
jjmatchedKind = 59;
jjmatchedPos = 3;
return 43;
}
if ((active0 & 0x8000000100000L) != 0L)
return 74;
if ((active0 & 0x7800000000L) != 0L)
{
jjmatchedKind = 34;
jjmatchedPos = 3;
return 74;
}
if ((active0 & 0x3c0000000L) != 0L)
{
jjmatchedKind = 29;
jjmatchedPos = 3;
return 74;
}
if ((active0 & 0x3170001fe38200L) != 0L)
{
jjmatchedKind = 59;
jjmatchedPos = 3;
return 74;
}
return -1;
case 4:
if ((active0 & 0x6000000000000L) != 0L)
{
if (jjmatchedPos < 1)
{
jjmatchedKind = 59;
jjmatchedPos = 1;
}
return -1;
}
if ((active0 & 0x1700000200000L) != 0L)
{
if (jjmatchedPos != 4)
{
jjmatchedKind = 59;
jjmatchedPos = 4;
}
return 74;
}
if ((active0 & 0x80000000000L) != 0L)
{
if (jjmatchedPos != 4)
{
jjmatchedKind = 59;
jjmatchedPos = 4;
}
return 42;
}
if ((active0 & 0x3000001fc38200L) != 0L)
return 74;
if ((active0 & 0x7800000000L) != 0L)
{
if (jjmatchedPos < 3)
{
jjmatchedKind = 34;
jjmatchedPos = 3;
}
return -1;
}
if ((active0 & 0x80000L) != 0L)
{
if (jjmatchedPos != 4)
{
jjmatchedKind = 12;
jjmatchedPos = 4;
}
return 74;
}
if ((active0 & 0x10000000000L) != 0L)
{
if (jjmatchedPos != 4)
{
jjmatchedKind = 59;
jjmatchedPos = 4;
}
return 28;
}
if ((active0 & 0x3c0000000L) != 0L)
{
if (jjmatchedPos < 3)
{
jjmatchedKind = 29;
jjmatchedPos = 3;
}
return -1;
}
return -1;
case 5:
if ((active0 & 0x6000000000000L) != 0L)
{
if (jjmatchedPos < 1)
{
jjmatchedKind = 59;
jjmatchedPos = 1;
}
return -1;
}
if ((active0 & 0x10000000000L) != 0L)
{
jjmatchedKind = 39;
jjmatchedPos = 5;
return 74;
}
if ((active0 & 0x80000000000L) != 0L)
{
jjmatchedKind = 42;
jjmatchedPos = 5;
return 74;
}
if ((active0 & 0x1700000200000L) != 0L)
{
jjmatchedKind = 59;
jjmatchedPos = 5;
return 74;
}
if ((active0 & 0x80000L) != 0L)
return 74;
if ((active0 & 0x7800000000L) != 0L)
{
if (jjmatchedPos < 3)
{
jjmatchedKind = 34;
jjmatchedPos = 3;
}
return -1;
}
if ((active0 & 0x3c0000000L) != 0L)
{
if (jjmatchedPos < 3)
{
jjmatchedKind = 29;
jjmatchedPos = 3;
}
return -1;
}
return -1;
case 6:
if ((active0 & 0x6000000000000L) != 0L)
{
if (jjmatchedPos < 1)
{
jjmatchedKind = 59;
jjmatchedPos = 1;
}
return -1;
}
if ((active0 & 0x10000000000L) != 0L)
{
if (jjmatchedPos < 5)
{
jjmatchedKind = 39;
jjmatchedPos = 5;
}
return -1;
}
if ((active0 & 0x80000000000L) != 0L)
{
if (jjmatchedPos < 5)
{
jjmatchedKind = 42;
jjmatchedPos = 5;
}
return -1;
}
if ((active0 & 0x1700000000000L) != 0L)
return 74;
if ((active0 & 0x7800000000L) != 0L)
{
if (jjmatchedPos < 3)
{
jjmatchedKind = 34;
jjmatchedPos = 3;
}
return -1;
}
if ((active0 & 0x200000L) != 0L)
{
if (jjmatchedPos != 6)
{
jjmatchedKind = 59;
jjmatchedPos = 6;
}
return 74;
}
if ((active0 & 0x3c0000000L) != 0L)
{
if (jjmatchedPos < 3)
{
jjmatchedKind = 29;
jjmatchedPos = 3;
}
return -1;
}
return -1;
case 7:
if ((active0 & 0x6000000000000L) != 0L)
{
if (jjmatchedPos < 1)
{
jjmatchedKind = 59;
jjmatchedPos = 1;
}
return -1;
}
if ((active0 & 0x10000000000L) != 0L)
{
if (jjmatchedPos < 5)
{
jjmatchedKind = 39;
jjmatchedPos = 5;
}
return -1;
}
if ((active0 & 0x80000000000L) != 0L)
{
if (jjmatchedPos < 5)
{
jjmatchedKind = 42;
jjmatchedPos = 5;
}
return -1;
}
if ((active0 & 0x200000L) != 0L)
return 74;
if ((active0 & 0x7800000000L) != 0L)
{
if (jjmatchedPos < 3)
{
jjmatchedKind = 34;
jjmatchedPos = 3;
}
return -1;
}
if ((active0 & 0x3c0000000L) != 0L)
{
if (jjmatchedPos < 3)
{
jjmatchedKind = 29;
jjmatchedPos = 3;
}
return -1;
}
return -1;
case 8:
if ((active0 & 0x10000000000L) != 0L)
{
if (jjmatchedPos < 5)
{
jjmatchedKind = 39;
jjmatchedPos = 5;
}
return -1;
}
if ((active0 & 0x80000000000L) != 0L)
{
if (jjmatchedPos < 5)
{
jjmatchedKind = 42;
jjmatchedPos = 5;
}
return -1;
}
if ((active0 & 0x7800000000L) != 0L)
{
if (jjmatchedPos < 3)
{
jjmatchedKind = 34;
jjmatchedPos = 3;
}
return -1;
}
if ((active0 & 0x3c0000000L) != 0L)
{
if (jjmatchedPos < 3)
{
jjmatchedKind = 29;
jjmatchedPos = 3;
}
return -1;
}
return -1;
case 9:
if ((active0 & 0x10000000000L) != 0L)
{
if (jjmatchedPos < 5)
{
jjmatchedKind = 39;
jjmatchedPos = 5;
}
return -1;
}
if ((active0 & 0x80000000000L) != 0L)
{
if (jjmatchedPos < 5)
{
jjmatchedKind = 42;
jjmatchedPos = 5;
}
return -1;
}
if ((active0 & 0x5800000000L) != 0L)
{
if (jjmatchedPos < 3)
{
jjmatchedKind = 34;
jjmatchedPos = 3;
}
return -1;
}
if ((active0 & 0x2c0000000L) != 0L)
{
if (jjmatchedPos < 3)
{
jjmatchedKind = 29;
jjmatchedPos = 3;
}
return -1;
}
return -1;
case 10:
if ((active0 & 0x10000000000L) != 0L)
{
if (jjmatchedPos < 5)
{
jjmatchedKind = 39;
jjmatchedPos = 5;
}
return -1;
}
if ((active0 & 0x80000000000L) != 0L)
{
if (jjmatchedPos < 5)
{
jjmatchedKind = 42;
jjmatchedPos = 5;
}
return -1;
}
if ((active0 & 0x5000000000L) != 0L)
{
if (jjmatchedPos < 3)
{
jjmatchedKind = 34;
jjmatchedPos = 3;
}
return -1;
}
if ((active0 & 0x280000000L) != 0L)
{
if (jjmatchedPos < 3)
{
jjmatchedKind = 29;
jjmatchedPos = 3;
}
return -1;
}
return -1;
case 11:
if ((active0 & 0x10000000000L) != 0L)
{
if (jjmatchedPos < 5)
{
jjmatchedKind = 39;
jjmatchedPos = 5;
}
return -1;
}
if ((active0 & 0x80000000000L) != 0L)
{
if (jjmatchedPos < 5)
{
jjmatchedKind = 42;
jjmatchedPos = 5;
}
return -1;
}
if ((active0 & 0x4000000000L) != 0L)
{
if (jjmatchedPos < 3)
{
jjmatchedKind = 34;
jjmatchedPos = 3;
}
return -1;
}
if ((active0 & 0x200000000L) != 0L)
{
if (jjmatchedPos < 3)
{
jjmatchedKind = 29;
jjmatchedPos = 3;
}
return -1;
}
return -1;
case 12:
if ((active0 & 0x4000000000L) != 0L)
{
if (jjmatchedPos < 3)
{
jjmatchedKind = 34;
jjmatchedPos = 3;
}
return -1;
}
if ((active0 & 0x200000000L) != 0L)
{
if (jjmatchedPos < 3)
{
jjmatchedKind = 29;
jjmatchedPos = 3;
}
return -1;
}
return -1;
default :
return -1;
}
}
private static final int jjStartNfa_0(int pos, long active0)
{
return jjMoveNfa_0(jjStopStringLiteralDfa_0(pos, active0), pos + 1);
}
static private int jjStopAtPos(int pos, int kind)
{
jjmatchedKind = kind;
jjmatchedPos = pos;
return pos + 1;
}
static private int jjMoveStringLiteralDfa0_0()
{
switch(curChar)
{
case 45:
return jjMoveStringLiteralDfa1_0(0x20L);
case 97:
return jjMoveStringLiteralDfa1_0(0x200L);
case 99:
return jjMoveStringLiteralDfa1_0(0x200000L);
case 101:
return jjMoveStringLiteralDfa1_0(0x120000L);
case 105:
return jjMoveStringLiteralDfa1_0(0x10000000000L);
case 108:
return jjMoveStringLiteralDfa1_0(0x400L);
case 109:
return jjMoveStringLiteralDfa1_0(0x10000000000000L);
case 110:
return jjMoveStringLiteralDfa1_0(0x7800000000L);
case 112:
return jjMoveStringLiteralDfa1_0(0x3c0000000L);
case 114:
return jjMoveStringLiteralDfa1_0(0x178001fc10000L);
case 115:
return jjMoveStringLiteralDfa1_0(0x20000000080000L);
case 116:
return jjMoveStringLiteralDfa1_0(0xe000000000000L);
case 119:
return jjMoveStringLiteralDfa1_0(0x8000L);
default :
return jjMoveNfa_0(1, 0);
}
}
static private int jjMoveStringLiteralDfa1_0(long active0)
{
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) {
jjStopStringLiteralDfa_0(0, active0);
return 1;
}
switch(curChar)
{
case 45:
if ((active0 & 0x20L) != 0L)
return jjStopAtPos(1, 5);
break;
case 97:
return jjMoveStringLiteralDfa2_0(active0, 0x1000001fc00000L);
case 98:
return jjMoveStringLiteralDfa2_0(active0, 0x200L);
case 101:
return jjMoveStringLiteralDfa2_0(active0, 0x1787800010000L);
case 104:
return jjMoveStringLiteralDfa2_0(active0, 0x8000L);
case 109:
return jjMoveStringLiteralDfa2_0(active0, 0x20000L);
case 110:
return jjMoveStringLiteralDfa2_0(active0, 0x10000100000L);
case 111:
return jjMoveStringLiteralDfa2_0(active0, 0x6000000200400L);
case 112:
return jjMoveStringLiteralDfa2_0(active0, 0x20000000000000L);
case 114:
return jjMoveStringLiteralDfa2_0(active0, 0x80003c0000000L);
case 116:
return jjMoveStringLiteralDfa2_0(active0, 0x80000L);
default :
break;
}
return jjStartNfa_0(0, active0);
}
static private int jjMoveStringLiteralDfa2_0(long old0, long active0)
{
if (((active0 &= old0)) == 0L)
return jjStartNfa_0(0, old0);
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) {
jjStopStringLiteralDfa_0(1, active0);
return 2;
}
switch(curChar)
{
case 45:
return jjMoveStringLiteralDfa3_0(active0, 0x6000000000000L);
case 97:
return jjMoveStringLiteralDfa3_0(active0, 0x80000L);
case 100:
return jjMoveStringLiteralDfa3_0(active0, 0x100000L);
case 101:
return jjMoveStringLiteralDfa3_0(active0, 0x3c0000000L);
case 103:
if ((active0 & 0x400L) != 0L)
return jjStartNfaWithStates_0(2, 10, 74);
break;
case 105:
return jjMoveStringLiteralDfa3_0(active0, 0x8000000008000L);
case 108:
return jjMoveStringLiteralDfa3_0(active0, 0x20000000000000L);
case 109:
return jjMoveStringLiteralDfa3_0(active0, 0x80000000000L);
case 110:
return jjMoveStringLiteralDfa3_0(active0, 0x1fe00000L);
case 111:
return jjMoveStringLiteralDfa3_0(active0, 0x200L);
case 112:
return jjMoveStringLiteralDfa3_0(active0, 0x700000020000L);
case 115:
return jjMoveStringLiteralDfa3_0(active0, 0x10000010000L);
case 116:
return jjMoveStringLiteralDfa3_0(active0, 0x10000000000000L);
case 119:
return jjMoveStringLiteralDfa3_0(active0, 0x1000000000000L);
case 120:
return jjMoveStringLiteralDfa3_0(active0, 0x7800000000L);
default :
break;
}
return jjStartNfa_0(1, active0);
}
static private int jjMoveStringLiteralDfa3_0(long old0, long active0)
{
if (((active0 &= old0)) == 0L)
return jjStartNfa_0(1, old0);
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) {
jjStopStringLiteralDfa_0(2, active0);
return 3;
}
switch(curChar)
{
case 99:
return jjMoveStringLiteralDfa4_0(active0, 0x10000000000000L);
case 101:
return jjMoveStringLiteralDfa4_0(active0, 0x10000010000L);
case 103:
return jjMoveStringLiteralDfa4_0(active0, 0x1fc00000L);
case 105:
return jjMoveStringLiteralDfa4_0(active0, 0x20000000000000L);
case 108:
return jjMoveStringLiteralDfa4_0(active0, 0x2700000008000L);
case 109:
if ((active0 & 0x8000000000000L) != 0L)
return jjStartNfaWithStates_0(3, 51, 74);
break;
case 111:
return jjMoveStringLiteralDfa4_0(active0, 0x80000000000L);
case 114:
return jjMoveStringLiteralDfa4_0(active0, 0x1000000080200L);
case 115:
if ((active0 & 0x100000L) != 0L)
return jjStartNfaWithStates_0(3, 20, 74);
break;
case 116:
return jjMoveStringLiteralDfa4_0(active0, 0x7800220000L);
case 117:
return jjMoveStringLiteralDfa4_0(active0, 0x4000000000000L);
case 118:
return jjMoveStringLiteralDfa4_0(active0, 0x3c0000000L);
default :
break;
}
return jjStartNfa_0(2, active0);
}
static private int jjMoveStringLiteralDfa4_0(long old0, long active0)
{
if (((active0 &= old0)) == 0L)
return jjStartNfa_0(2, old0);
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) {
jjStopStringLiteralDfa_0(3, active0);
return 4;
}
switch(curChar)
{
case 45:
return jjMoveStringLiteralDfa5_0(active0, 0x7bc0000000L);
case 97:
return jjMoveStringLiteralDfa5_0(active0, 0x700000200000L);
case 101:
if ((active0 & 0x8000L) != 0L)
return jjStartNfaWithStates_0(4, 15, 74);
else if ((active0 & 0x400000L) != 0L)
{
jjmatchedKind = 22;
jjmatchedPos = 4;
}
return jjMoveStringLiteralDfa5_0(active0, 0x1f800000L);
case 104:
if ((active0 & 0x10000000000000L) != 0L)
return jjStartNfaWithStates_0(4, 52, 74);
break;
case 105:
return jjMoveStringLiteralDfa5_0(active0, 0x1000000000000L);
case 111:
return jjMoveStringLiteralDfa5_0(active0, 0x2000000000000L);
case 112:
return jjMoveStringLiteralDfa5_0(active0, 0x4000000000000L);
case 114:
return jjMoveStringLiteralDfa5_0(active0, 0x10000000000L);
case 116:
if ((active0 & 0x200L) != 0L)
return jjStartNfaWithStates_0(4, 9, 74);
else if ((active0 & 0x10000L) != 0L)
return jjStartNfaWithStates_0(4, 16, 74);
else if ((active0 & 0x20000000000000L) != 0L)
return jjStartNfaWithStates_0(4, 53, 74);
return jjMoveStringLiteralDfa5_0(active0, 0x80000L);
case 118:
return jjMoveStringLiteralDfa5_0(active0, 0x80000000000L);
case 121:
if ((active0 & 0x20000L) != 0L)
return jjStartNfaWithStates_0(4, 17, 74);
break;
default :
break;
}
return jjStartNfa_0(3, active0);
}
static private int jjMoveStringLiteralDfa5_0(long old0, long active0)
{
if (((active0 &= old0)) == 0L)
return jjStartNfa_0(3, old0);
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) {
jjStopStringLiteralDfa_0(4, active0);
return 5;
}
switch(curChar)
{
case 45:
return jjMoveStringLiteralDfa6_0(active0, 0x1f800000L);
case 99:
return jjMoveStringLiteralDfa6_0(active0, 0x704200000000L);
case 101:
return jjMoveStringLiteralDfa6_0(active0, 0x82940000000L);
case 105:
return jjMoveStringLiteralDfa6_0(active0, 0x200000L);
case 112:
return jjMoveStringLiteralDfa6_0(active0, 0x4000000000000L);
case 115:
if ((active0 & 0x80000L) != 0L)
return jjStartNfaWithStates_0(5, 19, 74);
return jjMoveStringLiteralDfa6_0(active0, 0x1080000000L);
case 116:
return jjMoveStringLiteralDfa6_0(active0, 0x1010000000000L);
case 119:
return jjMoveStringLiteralDfa6_0(active0, 0x2000000000000L);
default :
break;
}
return jjStartNfa_0(4, active0);
}
static private int jjMoveStringLiteralDfa6_0(long old0, long active0)
{
if (((active0 &= old0)) == 0L)
return jjStartNfa_0(4, old0);
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) {
jjStopStringLiteralDfa_0(5, active0);
return 6;
}
switch(curChar)
{
case 45:
return jjMoveStringLiteralDfa7_0(active0, 0x90000000000L);
case 97:
return jjMoveStringLiteralDfa7_0(active0, 0x8000000L);
case 99:
return jjMoveStringLiteralDfa7_0(active0, 0x4000000L);
case 101:
if ((active0 & 0x100000000000L) != 0L)
{
jjmatchedKind = 44;
jjmatchedPos = 6;
}
else if ((active0 & 0x1000000000000L) != 0L)
return jjStartNfaWithStates_0(6, 48, 74);
return jjMoveStringLiteralDfa7_0(active0, 0x6600002800000L);
case 109:
return jjMoveStringLiteralDfa7_0(active0, 0x840000000L);
case 110:
return jjMoveStringLiteralDfa7_0(active0, 0x2100200000L);
case 111:
return jjMoveStringLiteralDfa7_0(active0, 0x4200000000L);
case 114:
return jjMoveStringLiteralDfa7_0(active0, 0x10000000L);
case 115:
return jjMoveStringLiteralDfa7_0(active0, 0x1000000L);
case 116:
return jjMoveStringLiteralDfa7_0(active0, 0x1080000000L);
default :
break;
}
return jjStartNfa_0(5, active0);
}
static private int jjMoveStringLiteralDfa7_0(long old0, long active0)
{
if (((active0 &= old0)) == 0L)
return jjStartNfa_0(5, old0);
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) {
jjStopStringLiteralDfa_0(6, active0);
return 7;
}
switch(curChar)
{
case 45:
return jjMoveStringLiteralDfa8_0(active0, 0x600000000000L);
case 97:
return jjMoveStringLiteralDfa8_0(active0, 0x11080000000L);
case 100:
return jjMoveStringLiteralDfa8_0(active0, 0x2108000000L);
case 101:
return jjMoveStringLiteralDfa8_0(active0, 0x10000000L);
case 109:
return jjMoveStringLiteralDfa8_0(active0, 0x800000L);
case 110:
return jjMoveStringLiteralDfa8_0(active0, 0x4202000000L);
case 111:
return jjMoveStringLiteralDfa8_0(active0, 0x4000000L);
case 112:
return jjMoveStringLiteralDfa8_0(active0, 0x840000000L);
case 114:
if ((active0 & 0x2000000000000L) != 0L)
return jjStopAtPos(7, 49);
else if ((active0 & 0x4000000000000L) != 0L)
return jjStopAtPos(7, 50);
return jjMoveStringLiteralDfa8_0(active0, 0x80000000000L);
case 115:
if ((active0 & 0x200000L) != 0L)
return jjStartNfaWithStates_0(7, 21, 74);
break;
case 116:
return jjMoveStringLiteralDfa8_0(active0, 0x1000000L);
default :
break;
}
return jjStartNfa_0(6, active0);
}
static private int jjMoveStringLiteralDfa8_0(long old0, long active0)
{
if (((active0 &= old0)) == 0L)
return jjStartNfa_0(6, old0);
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) {
jjStopStringLiteralDfa_0(7, active0);
return 8;
}
switch(curChar)
{
case 97:
return jjMoveStringLiteralDfa9_0(active0, 0x480001000000L);
case 100:
return jjMoveStringLiteralDfa9_0(active0, 0x2000000L);
case 102:
return jjMoveStringLiteralDfa9_0(active0, 0x210000000000L);
case 106:
return jjMoveStringLiteralDfa9_0(active0, 0x8000000L);
case 110:
return jjMoveStringLiteralDfa9_0(active0, 0x4000000L);
case 112:
return jjMoveStringLiteralDfa9_0(active0, 0x800000L);
case 114:
return jjMoveStringLiteralDfa9_0(active0, 0x1080000000L);
case 115:
if ((active0 & 0x100000000L) != 0L)
return jjStopAtPos(8, 32);
else if ((active0 & 0x2000000000L) != 0L)
return jjStopAtPos(8, 37);
return jjMoveStringLiteralDfa9_0(active0, 0x10000000L);
case 116:
return jjMoveStringLiteralDfa9_0(active0, 0x4a40000000L);
default :
break;
}
return jjStartNfa_0(7, active0);
}
static private int jjMoveStringLiteralDfa9_0(long old0, long active0)
{
if (((active0 &= old0)) == 0L)
return jjStartNfa_0(7, old0);
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) {
jjStopStringLiteralDfa_0(8, active0);
return 9;
}
switch(curChar)
{
case 97:
return jjMoveStringLiteralDfa10_0(active0, 0x4200000000L);
case 101:
return jjMoveStringLiteralDfa10_0(active0, 0x10000000L);
case 105:
return jjMoveStringLiteralDfa10_0(active0, 0x200000000000L);
case 108:
return jjMoveStringLiteralDfa10_0(active0, 0x400000000000L);
case 110:
return jjMoveStringLiteralDfa10_0(active0, 0x80000000000L);
case 114:
return jjMoveStringLiteralDfa10_0(active0, 0x1000000L);
case 115:
if ((active0 & 0x2000000L) != 0L)
return jjStopAtPos(9, 25);
break;
case 116:
return jjMoveStringLiteralDfa10_0(active0, 0x11084800000L);
case 117:
return jjMoveStringLiteralDfa10_0(active0, 0x8000000L);
case 121:
if ((active0 & 0x40000000L) != 0L)
return jjStopAtPos(9, 30);
else if ((active0 & 0x800000000L) != 0L)
return jjStopAtPos(9, 35);
break;
default :
break;
}
return jjStartNfa_0(8, active0);
}
static private int jjMoveStringLiteralDfa10_0(long old0, long active0)
{
if (((active0 &= old0)) == 0L)
return jjStartNfa_0(8, old0);
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) {
jjStopStringLiteralDfa_0(9, active0);
return 10;
}
switch(curChar)
{
case 97:
return jjMoveStringLiteralDfa11_0(active0, 0x4000000L);
case 101:
return jjMoveStringLiteralDfa11_0(active0, 0x10000000000L);
case 103:
return jjMoveStringLiteralDfa11_0(active0, 0x80000000000L);
case 105:
return jjMoveStringLiteralDfa11_0(active0, 0x4200000000L);
case 108:
if ((active0 & 0x400000000000L) != 0L)
return jjStopAtPos(10, 46);
break;
case 114:
return jjMoveStringLiteralDfa11_0(active0, 0x200000000000L);
case 115:
if ((active0 & 0x80000000L) != 0L)
return jjStopAtPos(10, 31);
else if ((active0 & 0x1000000000L) != 0L)
return jjStopAtPos(10, 36);
return jjMoveStringLiteralDfa11_0(active0, 0x8000000L);
case 116:
if ((active0 & 0x10000000L) != 0L)
return jjStopAtPos(10, 28);
return jjMoveStringLiteralDfa11_0(active0, 0x1000000L);
case 121:
if ((active0 & 0x800000L) != 0L)
return jjStopAtPos(10, 23);
break;
default :
break;
}
return jjStartNfa_0(9, active0);
}
static private int jjMoveStringLiteralDfa11_0(long old0, long active0)
{
if (((active0 &= old0)) == 0L)
return jjStartNfa_0(9, old0);
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) {
jjStopStringLiteralDfa_0(10, active0);
return 11;
}
switch(curChar)
{
case 101:
if ((active0 & 0x80000000000L) != 0L)
return jjStopAtPos(11, 43);
break;
case 105:
return jjMoveStringLiteralDfa12_0(active0, 0x4000000L);
case 110:
return jjMoveStringLiteralDfa12_0(active0, 0x4200000000L);
case 114:
if ((active0 & 0x10000000000L) != 0L)
return jjStopAtPos(11, 40);
break;
case 115:
if ((active0 & 0x1000000L) != 0L)
return jjStopAtPos(11, 24);
return jjMoveStringLiteralDfa12_0(active0, 0x200000000000L);
case 116:
if ((active0 & 0x8000000L) != 0L)
return jjStopAtPos(11, 27);
break;
default :
break;
}
return jjStartNfa_0(10, active0);
}
static private int jjMoveStringLiteralDfa12_0(long old0, long active0)
{
if (((active0 &= old0)) == 0L)
return jjStartNfa_0(10, old0);
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) {
jjStopStringLiteralDfa_0(11, active0);
return 12;
}
switch(curChar)
{
case 110:
return jjMoveStringLiteralDfa13_0(active0, 0x4000000L);
case 115:
if ((active0 & 0x200000000L) != 0L)
return jjStopAtPos(12, 33);
else if ((active0 & 0x4000000000L) != 0L)
return jjStopAtPos(12, 38);
break;
case 116:
if ((active0 & 0x200000000000L) != 0L)
return jjStopAtPos(12, 45);
break;
default :
break;
}
return jjStartNfa_0(11, active0);
}
static private int jjMoveStringLiteralDfa13_0(long old0, long active0)
{
if (((active0 &= old0)) == 0L)
return jjStartNfa_0(11, old0);
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) {
jjStopStringLiteralDfa_0(12, active0);
return 13;
}
switch(curChar)
{
case 115:
if ((active0 & 0x4000000L) != 0L)
return jjStopAtPos(13, 26);
break;
default :
break;
}
return jjStartNfa_0(12, active0);
}
static private int jjStartNfaWithStates_0(int pos, int kind, int state)
{
jjmatchedKind = kind;
jjmatchedPos = pos;
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) { return pos + 1; }
return jjMoveNfa_0(state, pos + 1);
}
static final long[] jjbitVec0 = {
0x0L, 0x0L, 0xffffffffffffffffL, 0xffffffffffffffffL
};
static private int jjMoveNfa_0(int startState, int curPos)
{
int startsAt = 0;
jjnewStateCnt = 109;
int i = 1;
jjstateSet[0] = startState;
int kind = 0x7fffffff;
for (;;)
{
if (++jjround == 0x7fffffff)
ReInitRounds();
if (curChar < 64)
{
long l = 1L << curChar;
do
{
switch(jjstateSet[--i])
{
case 9:
case 74:
if ((0x3ff000000000000L & l) == 0L)
break;
if (kind > 59)
kind = 59;
jjCheckNAdd(74);
break;
case 7:
if ((0x3ff000000000000L & l) == 0L)
break;
if (kind > 59)
kind = 59;
jjCheckNAdd(74);
break;
case 46:
if ((0x3ff000000000000L & l) == 0L)
break;
if (kind > 59)
kind = 59;
jjCheckNAdd(74);
break;
case 45:
if ((0x3ff000000000000L & l) == 0L)
break;
if (kind > 59)
kind = 59;
jjCheckNAdd(74);
break;
case 82:
if ((0x3ff000000000000L & l) == 0L)
break;
if (kind > 59)
kind = 59;
jjCheckNAdd(74);
break;
case 43:
if ((0x3ff000000000000L & l) == 0L)
break;
if (kind > 59)
kind = 59;
jjCheckNAdd(74);
break;
case 100:
if ((0x3ff000000000000L & l) == 0L)
break;
if (kind > 59)
kind = 59;
jjCheckNAdd(74);
break;
case 28:
if ((0x3ff000000000000L & l) == 0L)
break;
if (kind > 59)
kind = 59;
jjCheckNAdd(74);
break;
case 32:
if ((0x3ff000000000000L & l) == 0L)
break;
if (kind > 59)
kind = 59;
jjCheckNAdd(74);
break;
case 30:
if ((0x3ff000000000000L & l) == 0L)
break;
if (kind > 59)
kind = 59;
jjCheckNAdd(74);
break;
case 17:
if ((0x3ff000000000000L & l) == 0L)
break;
if (kind > 59)
kind = 59;
jjCheckNAdd(74);
break;
case 23:
if ((0x3ff000000000000L & l) == 0L)
break;
if (kind > 59)
kind = 59;
jjCheckNAdd(74);
break;
case 8:
if ((0x3ff000000000000L & l) == 0L)
break;
if (kind > 59)
kind = 59;
jjCheckNAdd(74);
break;
case 6:
if ((0x3ff000000000000L & l) == 0L)
break;
if (kind > 59)
kind = 59;
jjCheckNAdd(74);
break;
case 99:
if ((0x3ff000000000000L & l) == 0L)
break;
if (kind > 59)
kind = 59;
jjCheckNAdd(74);
break;
case 44:
if ((0x3ff000000000000L & l) == 0L)
break;
if (kind > 59)
kind = 59;
jjCheckNAdd(74);
break;
case 42:
if ((0x3ff000000000000L & l) == 0L)
break;
if (kind > 59)
kind = 59;
jjCheckNAdd(74);
break;
case 40:
if ((0x3ff000000000000L & l) == 0L)
break;
if (kind > 59)
kind = 59;
jjCheckNAdd(74);
break;
case 29:
if ((0x3ff000000000000L & l) == 0L)
break;
if (kind > 59)
kind = 59;
jjCheckNAdd(74);
break;
case 31:
if ((0x3ff000000000000L & l) == 0L)
break;
if (kind > 59)
kind = 59;
jjCheckNAdd(74);
break;
case 18:
if ((0x3ff000000000000L & l) == 0L)
break;
if (kind > 59)
kind = 59;
jjCheckNAdd(74);
break;
case 24:
if ((0x3ff000000000000L & l) == 0L)
break;
if (kind > 59)
kind = 59;
jjCheckNAdd(74);
break;
case 16:
if ((0x3ff000000000000L & l) == 0L)
break;
if (kind > 59)
kind = 59;
jjCheckNAdd(74);
break;
case 22:
if ((0x3ff000000000000L & l) == 0L)
break;
if (kind > 59)
kind = 59;
jjCheckNAdd(74);
break;
case 1:
if ((0x3ff000000000000L & l) != 0L)
jjCheckNAddTwoStates(68, 69);
else if (curChar == 36)
jjAddStates(0, 1);
else if (curChar == 46)
jjCheckNAdd(72);
else if (curChar == 45)
jjstateSet[jjnewStateCnt++] = 66;
else if (curChar == 47)
jjCheckNAddStates(2, 4);
else if (curChar == 34)
jjCheckNAddStates(5, 7);
else if (curChar == 35)
jjstateSet[jjnewStateCnt++] = 48;
else if (curChar == 62)
jjstateSet[jjnewStateCnt++] = 26;
else if (curChar == 60)
jjstateSet[jjnewStateCnt++] = 20;
else if (curChar == 61)
jjstateSet[jjnewStateCnt++] = 14;
else if (curChar == 41)
{
if (kind > 13)
kind = 13;
}
else if (curChar == 40)
{
if (kind > 12)
kind = 12;
}
else if (curChar == 58)
jjstateSet[jjnewStateCnt++] = 0;
else if (curChar == 63)
{
if (kind > 14)
kind = 14;
}
if ((0x3fe000000000000L & l) != 0L)
{
if (kind > 57)
kind = 57;
jjCheckNAdd(67);
}
break;
case 0:
if (curChar == 61 && kind > 8)
kind = 8;
break;
case 11:
if (curChar == 40 && kind > 12)
kind = 12;
break;
case 12:
if (curChar == 41 && kind > 13)
kind = 13;
break;
case 13:
if (curChar == 63 && kind > 14)
kind = 14;
break;
case 14:
if (curChar == 61 && kind > 18)
kind = 18;
break;
case 15:
if (curChar == 61)
jjstateSet[jjnewStateCnt++] = 14;
break;
case 20:
if (curChar == 60 && kind > 29)
kind = 29;
break;
case 21:
if (curChar == 60)
jjstateSet[jjnewStateCnt++] = 20;
break;
case 26:
if (curChar == 62 && kind > 34)
kind = 34;
break;
case 27:
if (curChar == 62)
jjstateSet[jjnewStateCnt++] = 26;
break;
case 48:
if (curChar == 35 && kind > 42)
kind = 42;
break;
case 49:
if (curChar == 35)
jjstateSet[jjnewStateCnt++] = 48;
break;
case 50:
case 53:
if (curChar == 34)
jjCheckNAddStates(5, 7);
break;
case 51:
if ((0xfffffffbffffdbffL & l) != 0L)
jjCheckNAddStates(5, 7);
break;
case 54:
if (curChar == 34 && kind > 54)
kind = 54;
break;
case 55:
case 58:
if (curChar == 47)
jjCheckNAddStates(2, 4);
break;
case 56:
if ((0xffff7fffffffdbffL & l) != 0L)
jjCheckNAddStates(2, 4);
break;
case 59:
if (curChar == 47 && kind > 55)
kind = 55;
break;
case 61:
if ((0xffffffffffffdbffL & l) != 0L)
jjAddStates(8, 10);
break;
case 65:
if (curChar == 45)
jjstateSet[jjnewStateCnt++] = 66;
break;
case 66:
if ((0x3fe000000000000L & l) == 0L)
break;
if (kind > 57)
kind = 57;
jjCheckNAdd(67);
break;
case 67:
if ((0x3ff000000000000L & l) == 0L)
break;
if (kind > 57)
kind = 57;
jjCheckNAdd(67);
break;
case 68:
if ((0x3ff000000000000L & l) != 0L)
jjCheckNAddTwoStates(68, 69);
break;
case 69:
if (curChar != 46)
break;
if (kind > 58)
kind = 58;
jjCheckNAdd(70);
break;
case 70:
if ((0x3ff000000000000L & l) == 0L)
break;
if (kind > 58)
kind = 58;
jjCheckNAdd(70);
break;
case 71:
if (curChar == 46)
jjCheckNAdd(72);
break;
case 72:
if ((0x3ff000000000000L & l) == 0L)
break;
if (kind > 58)
kind = 58;
jjCheckNAdd(72);
break;
case 93:
if (curChar == 36)
jjAddStates(0, 1);
break;
case 94:
if (curChar == 43 && kind > 11)
kind = 11;
break;
case 95:
if (curChar == 33)
jjstateSet[jjnewStateCnt++] = 94;
break;
case 96:
if (curChar == 35)
jjstateSet[jjnewStateCnt++] = 95;
break;
case 97:
if (curChar == 36 && kind > 41)
kind = 41;
break;
default : break;
}
} while(i != startsAt);
}
else if (curChar < 128)
{
long l = 1L << (curChar & 077);
do
{
switch(jjstateSet[--i])
{
case 9:
if ((0x7fffffe87fffffeL & l) != 0L)
{
if (kind > 59)
kind = 59;
jjCheckNAdd(74);
}
if (curChar == 116)
jjstateSet[jjnewStateCnt++] = 8;
break;
case 7:
if ((0x7fffffe87fffffeL & l) != 0L)
{
if (kind > 59)
kind = 59;
jjCheckNAdd(74);
}
if (curChar == 114)
jjstateSet[jjnewStateCnt++] = 6;
break;
case 46:
if ((0x7fffffe87fffffeL & l) != 0L)
{
if (kind > 59)
kind = 59;
jjCheckNAdd(74);
}
if (curChar == 101)
jjstateSet[jjnewStateCnt++] = 45;
break;
case 45:
if ((0x7fffffe87fffffeL & l) != 0L)
{
if (kind > 59)
kind = 59;
jjCheckNAdd(74);
}
if (curChar == 109)
jjstateSet[jjnewStateCnt++] = 44;
break;
case 82:
if ((0x7fffffe87fffffeL & l) != 0L)
{
if (kind > 59)
kind = 59;
jjCheckNAdd(74);
}
if (curChar == 97)
jjstateSet[jjnewStateCnt++] = 83;
if (curChar == 97)
jjstateSet[jjnewStateCnt++] = 81;
break;
case 43:
if ((0x7fffffe87fffffeL & l) != 0L)
{
if (kind > 59)
kind = 59;
jjCheckNAdd(74);
}
if (curChar == 118)
jjstateSet[jjnewStateCnt++] = 42;
break;
case 100:
if ((0x7fffffe87fffffeL & l) != 0L)
{
if (kind > 59)
kind = 59;
jjCheckNAdd(74);
}
if (curChar == 113)
jjstateSet[jjnewStateCnt++] = 107;
else if (curChar == 108)
jjstateSet[jjnewStateCnt++] = 102;
else if (curChar == 110)
jjstateSet[jjnewStateCnt++] = 99;
break;
case 28:
if ((0x7fffffe87fffffeL & l) != 0L)
{
if (kind > 59)
kind = 59;
jjCheckNAdd(74);
}
if (curChar == 116)
{
if (kind > 39)
kind = 39;
}
break;
case 32:
if ((0x7fffffe87fffffeL & l) != 0L)
{
if (kind > 59)
kind = 59;
jjCheckNAdd(74);
}
if (curChar == 110)
jjstateSet[jjnewStateCnt++] = 31;
break;
case 30:
if ((0x7fffffe87fffffeL & l) != 0L)
{
if (kind > 59)
kind = 59;
jjCheckNAdd(74);
}
if (curChar == 101)
jjstateSet[jjnewStateCnt++] = 29;
break;
case 17:
if ((0x7fffffe87fffffeL & l) != 0L)
{
if (kind > 59)
kind = 59;
jjCheckNAdd(74);
}
if (curChar == 101)
jjstateSet[jjnewStateCnt++] = 16;
break;
case 23:
if ((0x7fffffe87fffffeL & l) != 0L)
{
if (kind > 59)
kind = 59;
jjCheckNAdd(74);
}
if (curChar == 120)
jjstateSet[jjnewStateCnt++] = 22;
break;
case 8:
if ((0x7fffffe87fffffeL & l) != 0L)
{
if (kind > 59)
kind = 59;
jjCheckNAdd(74);
}
if (curChar == 97)
jjstateSet[jjnewStateCnt++] = 7;
break;
case 6:
if ((0x7fffffe87fffffeL & l) != 0L)
{
if (kind > 59)
kind = 59;
jjCheckNAdd(74);
}
if (curChar == 116)
{
if (kind > 12)
kind = 12;
}
break;
case 99:
if ((0x7fffffe87fffffeL & l) != 0L)
{
if (kind > 59)
kind = 59;
jjCheckNAdd(74);
}
if (curChar == 100)
{
if (kind > 13)
kind = 13;
}
break;
case 44:
if ((0x7fffffe87fffffeL & l) != 0L)
{
if (kind > 59)
kind = 59;
jjCheckNAdd(74);
}
if (curChar == 111)
jjstateSet[jjnewStateCnt++] = 43;
break;
case 42:
if ((0x7fffffe87fffffeL & l) != 0L)
{
if (kind > 59)
kind = 59;
jjCheckNAdd(74);
}
if (curChar == 101)
{
if (kind > 42)
kind = 42;
}
break;
case 40:
if ((0x7fffffe87fffffeL & l) != 0L)
{
if (kind > 59)
kind = 59;
jjCheckNAdd(74);
}
if (curChar == 112)
jjstateSet[jjnewStateCnt++] = 39;
break;
case 29:
if ((0x7fffffe87fffffeL & l) != 0L)
{
if (kind > 59)
kind = 59;
jjCheckNAdd(74);
}
if (curChar == 114)
jjstateSet[jjnewStateCnt++] = 28;
break;
case 31:
if ((0x7fffffe87fffffeL & l) != 0L)
{
if (kind > 59)
kind = 59;
jjCheckNAdd(74);
}
if (curChar == 115)
jjstateSet[jjnewStateCnt++] = 30;
break;
case 18:
if ((0x7fffffe87fffffeL & l) != 0L)
{
if (kind > 59)
kind = 59;
jjCheckNAdd(74);
}
if (curChar == 114)
jjstateSet[jjnewStateCnt++] = 17;
break;
case 24:
if ((0x7fffffe87fffffeL & l) != 0L)
{
if (kind > 59)
kind = 59;
jjCheckNAdd(74);
}
if (curChar == 101)
jjstateSet[jjnewStateCnt++] = 23;
break;
case 16:
if ((0x7fffffe87fffffeL & l) != 0L)
{
if (kind > 59)
kind = 59;
jjCheckNAdd(74);
}
if (curChar == 118)
{
if (kind > 29)
kind = 29;
}
break;
case 22:
if ((0x7fffffe87fffffeL & l) != 0L)
{
if (kind > 59)
kind = 59;
jjCheckNAdd(74);
}
if (curChar == 116)
{
if (kind > 34)
kind = 34;
}
break;
case 1:
if ((0x7fffffe07fffffeL & l) != 0L)
{
if (kind > 59)
kind = 59;
jjCheckNAdd(74);
}
else if (curChar == 124)
jjCheckNAddStates(8, 10);
else if (curChar == 94)
jjstateSet[jjnewStateCnt++] = 34;
if (curChar == 101)
jjAddStates(11, 13);
else if (curChar == 100)
jjAddStates(14, 15);
else if (curChar == 99)
jjAddStates(16, 17);
else if (curChar == 114)
jjstateSet[jjnewStateCnt++] = 46;
else if (curChar == 97)
jjstateSet[jjnewStateCnt++] = 40;
else if (curChar == 105)
jjstateSet[jjnewStateCnt++] = 32;
else if (curChar == 110)
jjstateSet[jjnewStateCnt++] = 24;
else if (curChar == 112)
jjstateSet[jjnewStateCnt++] = 18;
else if (curChar == 115)
jjstateSet[jjnewStateCnt++] = 9;
else if (curChar == 102)
jjstateSet[jjnewStateCnt++] = 4;
break;
case 2:
if (curChar == 108 && kind > 11)
kind = 11;
break;
case 3:
if (curChar == 105)
jjstateSet[jjnewStateCnt++] = 2;
break;
case 4:
if (curChar == 97)
jjstateSet[jjnewStateCnt++] = 3;
break;
case 5:
if (curChar == 102)
jjstateSet[jjnewStateCnt++] = 4;
break;
case 10:
if (curChar == 115)
jjstateSet[jjnewStateCnt++] = 9;
break;
case 19:
if (curChar == 112)
jjstateSet[jjnewStateCnt++] = 18;
break;
case 25:
if (curChar == 110)
jjstateSet[jjnewStateCnt++] = 24;
break;
case 33:
if (curChar == 105)
jjstateSet[jjnewStateCnt++] = 32;
break;
case 34:
if (curChar == 94 && kind > 39)
kind = 39;
break;
case 35:
if (curChar == 94)
jjstateSet[jjnewStateCnt++] = 34;
break;
case 36:
if (curChar == 100 && kind > 41)
kind = 41;
break;
case 37:
if (curChar == 110)
jjstateSet[jjnewStateCnt++] = 36;
break;
case 38:
if (curChar == 101)
jjstateSet[jjnewStateCnt++] = 37;
break;
case 39:
if (curChar == 112)
jjstateSet[jjnewStateCnt++] = 38;
break;
case 41:
if (curChar == 97)
jjstateSet[jjnewStateCnt++] = 40;
break;
case 47:
if (curChar == 114)
jjstateSet[jjnewStateCnt++] = 46;
break;
case 51:
if ((0xffffffffefffffffL & l) != 0L)
jjCheckNAddStates(5, 7);
break;
case 52:
if (curChar == 92)
jjstateSet[jjnewStateCnt++] = 53;
break;
case 53:
if ((0x10004410000000L & l) != 0L)
jjCheckNAddStates(5, 7);
break;
case 56:
if ((0xffffffffefffffffL & l) != 0L)
jjCheckNAddStates(2, 4);
break;
case 57:
if (curChar == 92)
jjstateSet[jjnewStateCnt++] = 58;
break;
case 58:
if ((0x10004410000000L & l) != 0L)
jjCheckNAddStates(2, 4);
break;
case 60:
if (curChar == 124)
jjCheckNAddStates(8, 10);
break;
case 61:
if ((0xefffffffefffffffL & l) != 0L)
jjCheckNAddStates(8, 10);
break;
case 62:
if (curChar == 92)
jjstateSet[jjnewStateCnt++] = 63;
break;
case 63:
if ((0x1010004410000000L & l) != 0L)
jjCheckNAddStates(8, 10);
break;
case 64:
if (curChar == 124 && kind > 56)
kind = 56;
break;
case 73:
if ((0x7fffffe07fffffeL & l) == 0L)
break;
if (kind > 59)
kind = 59;
jjCheckNAdd(74);
break;
case 74:
if ((0x7fffffe87fffffeL & l) == 0L)
break;
if (kind > 59)
kind = 59;
jjCheckNAdd(74);
break;
case 75:
if (curChar == 99)
jjAddStates(16, 17);
break;
case 76:
if (curChar == 101 && kind > 47)
kind = 47;
break;
case 77:
if (curChar == 116)
jjstateSet[jjnewStateCnt++] = 76;
break;
case 78:
if (curChar == 97)
jjstateSet[jjnewStateCnt++] = 77;
break;
case 79:
if (curChar == 110)
jjstateSet[jjnewStateCnt++] = 78;
break;
case 80:
if (curChar == 101)
jjstateSet[jjnewStateCnt++] = 79;
break;
case 81:
if (curChar == 116)
jjstateSet[jjnewStateCnt++] = 80;
break;
case 83:
if (curChar == 116 && kind > 47)
kind = 47;
break;
case 84:
if (curChar == 97)
jjstateSet[jjnewStateCnt++] = 83;
break;
case 85:
if (curChar == 100)
jjAddStates(14, 15);
break;
case 86:
if (curChar == 101 && kind > 8)
kind = 8;
break;
case 87:
if (curChar == 110)
jjstateSet[jjnewStateCnt++] = 86;
break;
case 88:
if (curChar == 105)
jjstateSet[jjnewStateCnt++] = 87;
break;
case 89:
if (curChar == 102)
jjstateSet[jjnewStateCnt++] = 88;
break;
case 90:
if (curChar == 101)
jjstateSet[jjnewStateCnt++] = 89;
break;
case 91:
if (curChar == 102 && kind > 8)
kind = 8;
break;
case 92:
if (curChar == 101)
jjstateSet[jjnewStateCnt++] = 91;
break;
case 98:
if (curChar == 101)
jjAddStates(11, 13);
break;
case 101:
if (curChar == 101 && kind > 14)
kind = 14;
break;
case 102:
if (curChar == 115)
jjstateSet[jjnewStateCnt++] = 101;
break;
case 103:
if (curChar == 108)
jjstateSet[jjnewStateCnt++] = 102;
break;
case 104:
if (curChar == 115 && kind > 18)
kind = 18;
break;
case 105:
if (curChar == 108)
jjstateSet[jjnewStateCnt++] = 104;
break;
case 106:
if (curChar == 97)
jjstateSet[jjnewStateCnt++] = 105;
break;
case 107:
if (curChar == 117)
jjstateSet[jjnewStateCnt++] = 106;
break;
case 108:
if (curChar == 113)
jjstateSet[jjnewStateCnt++] = 107;
break;
default : break;
}
} while(i != startsAt);
}
else
{
int i2 = (curChar & 0xff) >> 6;
long l2 = 1L << (curChar & 077);
do
{
switch(jjstateSet[--i])
{
case 51:
if ((jjbitVec0[i2] & l2) != 0L)
jjAddStates(5, 7);
break;
case 56:
if ((jjbitVec0[i2] & l2) != 0L)
jjAddStates(2, 4);
break;
case 61:
if ((jjbitVec0[i2] & l2) != 0L)
jjAddStates(8, 10);
break;
default : break;
}
} while(i != startsAt);
}
if (kind != 0x7fffffff)
{
jjmatchedKind = kind;
jjmatchedPos = curPos;
kind = 0x7fffffff;
}
++curPos;
if ((i = jjnewStateCnt) == (startsAt = 109 - (jjnewStateCnt = startsAt)))
return curPos;
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) { return curPos; }
}
}
static private int jjMoveStringLiteralDfa0_1()
{
return jjMoveNfa_1(0, 0);
}
static private int jjMoveNfa_1(int startState, int curPos)
{
int startsAt = 0;
jjnewStateCnt = 1;
int i = 1;
jjstateSet[0] = startState;
int kind = 0x7fffffff;
for (;;)
{
if (++jjround == 0x7fffffff)
ReInitRounds();
if (curChar < 64)
{
long l = 1L << curChar;
do
{
switch(jjstateSet[--i])
{
case 0:
if ((0x2400L & l) != 0L)
kind = 6;
break;
default : break;
}
} while(i != startsAt);
}
else if (curChar < 128)
{
long l = 1L << (curChar & 077);
do
{
switch(jjstateSet[--i])
{
default : break;
}
} while(i != startsAt);
}
else
{
int i2 = (curChar & 0xff) >> 6;
long l2 = 1L << (curChar & 077);
do
{
switch(jjstateSet[--i])
{
default : break;
}
} while(i != startsAt);
}
if (kind != 0x7fffffff)
{
jjmatchedKind = kind;
jjmatchedPos = curPos;
kind = 0x7fffffff;
}
++curPos;
if ((i = jjnewStateCnt) == (startsAt = 1 - (jjnewStateCnt = startsAt)))
return curPos;
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) { return curPos; }
}
}
static final int[] jjnextStates = {
96, 97, 56, 57, 59, 51, 52, 54, 61, 62, 64, 100, 103, 108, 90, 92,
82, 84,
};
/** Token literal values. */
public static final String[] jjstrLiteralImages = {
"", null, null, null, null, null, null, null, null, "\141\142\157\162\164",
"\154\157\147", null, null, null, null, "\167\150\151\154\145", "\162\145\163\145\164",
"\145\155\160\164\171", null, "\163\164\141\162\164\163", "\145\156\144\163",
"\143\157\156\164\141\151\156\163", "\162\141\156\147\145", "\162\141\156\147\145\55\145\155\160\164\171",
"\162\141\156\147\145\55\163\164\141\162\164\163", "\162\141\156\147\145\55\145\156\144\163",
"\162\141\156\147\145\55\143\157\156\164\141\151\156\163", "\162\141\156\147\145\55\141\144\152\165\163\164",
"\162\141\156\147\145\55\162\145\163\145\164", null, "\160\162\145\166\55\145\155\160\164\171",
"\160\162\145\166\55\163\164\141\162\164\163", "\160\162\145\166\55\145\156\144\163",
"\160\162\145\166\55\143\157\156\164\141\151\156\163", null, "\156\145\170\164\55\145\155\160\164\171",
"\156\145\170\164\55\163\164\141\162\164\163", "\156\145\170\164\55\145\156\144\163",
"\156\145\170\164\55\143\157\156\164\141\151\156\163", null, "\151\156\163\145\162\164\55\141\146\164\145\162", null, null,
"\162\145\155\157\166\145\55\162\141\156\147\145", "\162\145\160\154\141\143\145",
"\162\145\160\154\141\143\145\55\146\151\162\163\164", "\162\145\160\154\141\143\145\55\141\154\154", null,
"\162\145\167\162\151\164\145", "\164\157\55\154\157\167\145\162", "\164\157\55\165\160\160\145\162",
"\164\162\151\155", "\155\141\164\143\150", "\163\160\154\151\164", null, null, null, null, null,
null, };
/** Lexer state names. */
public static final String[] lexStateNames = {
"DEFAULT",
"INSIDE_COMMENT",
};
/** Lex State array. */
public static final int[] jjnewLexState = {
-1, -1, -1, -1, -1, 1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
};
static final long[] jjtoToken = {
0xfffffffffffff01L,
};
static final long[] jjtoSkip = {
0xfeL,
};
static protected SimpleCharStream input_stream;
static private final int[] jjrounds = new int[109];
static private final int[] jjstateSet = new int[218];
static protected char curChar;
/** Constructor. */
public FrodoTokenManager(SimpleCharStream stream){
if (input_stream != null)
throw new TokenMgrError("ERROR: Second call to constructor of static lexer. You must use ReInit() to initialize the static variables.", TokenMgrError.STATIC_LEXER_ERROR);
input_stream = stream;
}
/** Constructor. */
public FrodoTokenManager(SimpleCharStream stream, int lexState){
this(stream);
SwitchTo(lexState);
}
/** Reinitialise parser. */
static public void ReInit(SimpleCharStream stream)
{
jjmatchedPos = jjnewStateCnt = 0;
curLexState = defaultLexState;
input_stream = stream;
ReInitRounds();
}
static private void ReInitRounds()
{
int i;
jjround = 0x80000001;
for (i = 109; i-- > 0;)
jjrounds[i] = 0x80000000;
}
/** Reinitialise parser. */
static public void ReInit(SimpleCharStream stream, int lexState)
{
ReInit(stream);
SwitchTo(lexState);
}
/** Switch to specified lex state. */
static public void SwitchTo(int lexState)
{
if (lexState >= 2 || lexState < 0)
throw new TokenMgrError("Error: Ignoring invalid lexical state : " + lexState + ". State unchanged.", TokenMgrError.INVALID_LEXICAL_STATE);
else
curLexState = lexState;
}
static protected Token jjFillToken()
{
final Token t;
final String curTokenImage;
final int beginLine;
final int endLine;
final int beginColumn;
final int endColumn;
String im = jjstrLiteralImages[jjmatchedKind];
curTokenImage = (im == null) ? input_stream.GetImage() : im;
beginLine = input_stream.getBeginLine();
beginColumn = input_stream.getBeginColumn();
endLine = input_stream.getEndLine();
endColumn = input_stream.getEndColumn();
t = Token.newToken(jjmatchedKind, curTokenImage);
t.beginLine = beginLine;
t.endLine = endLine;
t.beginColumn = beginColumn;
t.endColumn = endColumn;
return t;
}
static int curLexState = 0;
static int defaultLexState = 0;
static int jjnewStateCnt;
static int jjround;
static int jjmatchedPos;
static int jjmatchedKind;
/** Get the next Token. */
public static Token getNextToken()
{
Token matchedToken;
int curPos = 0;
EOFLoop :
for (;;)
{
try
{
curChar = input_stream.BeginToken();
}
catch(java.io.IOException e)
{
jjmatchedKind = 0;
matchedToken = jjFillToken();
return matchedToken;
}
switch(curLexState)
{
case 0:
try { input_stream.backup(0);
while (curChar <= 32 && (0x100002600L & (1L << curChar)) != 0L)
curChar = input_stream.BeginToken();
}
catch (java.io.IOException e1) { continue EOFLoop; }
jjmatchedKind = 0x7fffffff;
jjmatchedPos = 0;
curPos = jjMoveStringLiteralDfa0_0();
break;
case 1:
jjmatchedKind = 0x7fffffff;
jjmatchedPos = 0;
curPos = jjMoveStringLiteralDfa0_1();
if (jjmatchedPos == 0 && jjmatchedKind > 7)
{
jjmatchedKind = 7;
}
break;
}
if (jjmatchedKind != 0x7fffffff)
{
if (jjmatchedPos + 1 < curPos)
input_stream.backup(curPos - jjmatchedPos - 1);
if ((jjtoToken[jjmatchedKind >> 6] & (1L << (jjmatchedKind & 077))) != 0L)
{
matchedToken = jjFillToken();
if (jjnewLexState[jjmatchedKind] != -1)
curLexState = jjnewLexState[jjmatchedKind];
return matchedToken;
}
else
{
if (jjnewLexState[jjmatchedKind] != -1)
curLexState = jjnewLexState[jjmatchedKind];
continue EOFLoop;
}
}
int error_line = input_stream.getEndLine();
int error_column = input_stream.getEndColumn();
String error_after = null;
boolean EOFSeen = false;
try { input_stream.readChar(); input_stream.backup(1); }
catch (java.io.IOException e1) {
EOFSeen = true;
error_after = curPos <= 1 ? "" : input_stream.GetImage();
if (curChar == '\n' || curChar == '\r') {
error_line++;
error_column = 0;
}
else
error_column++;
}
if (!EOFSeen) {
input_stream.backup(1);
error_after = curPos <= 1 ? "" : input_stream.GetImage();
}
throw new TokenMgrError(EOFSeen, curLexState, error_line, error_column, error_after, curChar, TokenMgrError.LEXICAL_ERROR);
}
}
static private void jjCheckNAdd(int state)
{
if (jjrounds[state] != jjround)
{
jjstateSet[jjnewStateCnt++] = state;
jjrounds[state] = jjround;
}
}
static private void jjAddStates(int start, int end)
{
do {
jjstateSet[jjnewStateCnt++] = jjnextStates[start];
} while (start++ != end);
}
static private void jjCheckNAddTwoStates(int state1, int state2)
{
jjCheckNAdd(state1);
jjCheckNAdd(state2);
}
static private void jjCheckNAddStates(int start, int end)
{
do {
jjCheckNAdd(jjnextStates[start]);
} while (start++ != end);
}
}
| mit |
axelpale/ghosture | lib/ObjectMap.js | 754 | module.exports = function ObjectMap() {
// See MDN WeakMap
var objects = [];
var values = [];
this.get = function (obj) {
return values[objects.indexOf(obj)];
};
this.set = function (obj, value) {
var index = objects.indexOf(obj);
if (index < 0) {
// Not found. Create.
objects.push(obj);
values.push(value);
} else {
// Found. Replace.
values[index] = value;
}
};
this.has = function (obj) {
return (objects.indexOf(obj) !== -1);
};
this.remove = function (obj) {
var index = objects.indexOf(obj);
if (index < 0) {
// Does not exist. Do nothing.
} else {
// Found. Remove.
objects.splice(index, 1);
values.splice(index, 1);
}
};
};
| mit |
kgigova/BookStoreCatalog | BookStoreCatalog/Resources/js/custom.js | 257 | $(document).ready(function(){
$('.responsive-buttons a').click(function() {
$('.responsive-sidebar-hide').toggle();
var text = $(this).text();
$(this).text(
text == "Show sidebar" ? "Hide sidebar" : "Show sidebar");
});
}); | mit |
pagesource/fusion | fusion/Link 2.js | 389 | // import PropTypes from 'prop-types';
// const Link = styled('a.attrs({
// href: props => props.href,
// })`
// color: violet;
// text-decoration: none;
// `;
// /* Props Check */
// Link.propTypes = {
// /**
// * URL
// */
// href: PropTypes.string,
// };
// /* Deafult Props */
// Link.defaultProps = {
// href: 'http://google.com/',
// };
// export default Link;
| mit |
Akoceru/EzSymf | app/AppKernel.php | 1694 | <?php
use Symfony\Component\HttpKernel\Kernel;
use Symfony\Component\Config\Loader\LoaderInterface;
class AppKernel extends Kernel
{
public function registerBundles()
{
$bundles = array(
new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
new Symfony\Bundle\SecurityBundle\SecurityBundle(),
new Symfony\Bundle\TwigBundle\TwigBundle(),
new Symfony\Bundle\MonologBundle\MonologBundle(),
new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(),
new Symfony\Bundle\AsseticBundle\AsseticBundle(),
new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
new AppBundle\AppBundle(),
new Sonata\CoreBundle\SonataCoreBundle(),
new Sonata\BlockBundle\SonataBlockBundle(),
new Knp\Bundle\MenuBundle\KnpMenuBundle(),
new Sonata\DoctrineORMAdminBundle\SonataDoctrineORMAdminBundle(),
new Sonata\AdminBundle\SonataAdminBundle(),
);
if (in_array($this->getEnvironment(), array('dev', 'test'))) {
$bundles[] = new Symfony\Bundle\DebugBundle\DebugBundle();
$bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();
$bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle();
$bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle();
}
return $bundles;
}
public function registerContainerConfiguration(LoaderInterface $loader)
{
$loader->load(__DIR__.'/config/config_'.$this->getEnvironment().'.yml');
}
}
| mit |
restorer/gloomy-dungeons-2 | tools/site/source/gloomy/js/tex.js | 2754 | window.Tex = {
BASE_ICONS: 0x00,
BASE_WALLS: 0x10,
BASE_TRANSPARENTS: 0x30,
BASE_DOORS_F: 0x40,
BASE_DOORS_S: 0x44,
BASE_OBJECTS: 0x50,
BASE_DECORATIONS: 0x48,
HAND: 5,
PIST: 9,
SHTG: 14,
CHGN: 19,
MAPS: [
{ img: 'background.jpg', wdt: 250, hgt: 175 }, // 0
{ img: 'texmap.png', wdt: 64, hgt: 64, cols: 16 }, // 1
{ img: 'texmap_mon_1.png', wdt: 128, hgt: 128, cols: 8 }, // 2
{ img: 'texmap_mon_2.png', wdt: 128, hgt: 128, cols: 8 }, // 3
{ img: 'texmap_mon_3.png', wdt: 128, hgt: 128, cols: 8 }, // 4
{ img: 'hit_hand_1.png', wdt: 256, hgt: 128 }, // 5
{ img: 'hit_hand_2.png', wdt: 256, hgt: 128 }, // 6
{ img: 'hit_hand_3.png', wdt: 256, hgt: 128 }, // 7
{ img: 'hit_hand_4.png', wdt: 256, hgt: 128 }, // 8
{ img: 'hit_pist_1.png', wdt: 256, hgt: 128 }, // 9
{ img: 'hit_pist_2.png', wdt: 256, hgt: 128 }, // 10
{ img: 'hit_pist_3.png', wdt: 256, hgt: 128 }, // 11
{ img: 'hit_pist_4.png', wdt: 256, hgt: 128 }, // 12
{ img: 'hit_pist_5.png', wdt: 256, hgt: 128 }, // 13
{ img: 'hit_shtg_1.png', wdt: 256, hgt: 128 }, // 14
{ img: 'hit_shtg_2.png', wdt: 256, hgt: 128 }, // 15
{ img: 'hit_shtg_3.png', wdt: 256, hgt: 128 }, // 16
{ img: 'hit_shtg_4.png', wdt: 256, hgt: 128 }, // 17
{ img: 'hit_shtg_5.png', wdt: 256, hgt: 128 }, // 18
{ img: 'hit_chgn_1.png', wdt: 256, hgt: 128 }, // 19
{ img: 'hit_chgn_2.png', wdt: 256, hgt: 128 }, // 20
{ img: 'hit_chgn_3.png', wdt: 256, hgt: 128 }, // 21
{ img: 'hit_chgn_4.png', wdt: 256, hgt: 128 } // 22
],
init: function() {
Tex.OBJ_ARMOR_GREEN = Tex.BASE_OBJECTS + 0;
Tex.OBJ_ARMOR_RED = Tex.BASE_OBJECTS + 1;
Tex.OBJ_KEY_BLUE = Tex.BASE_OBJECTS + 2;
Tex.OBJ_KEY_RED = Tex.BASE_OBJECTS + 3;
Tex.OBJ_STIM = Tex.BASE_OBJECTS + 4;
Tex.OBJ_MEDI = Tex.BASE_OBJECTS + 5;
Tex.OBJ_CLIP = Tex.BASE_OBJECTS + 6;
Tex.OBJ_AMMO = Tex.BASE_OBJECTS + 7;
Tex.OBJ_SHELL = Tex.BASE_OBJECTS + 8;
Tex.OBJ_SBOX = Tex.BASE_OBJECTS + 9;
Tex.OBJ_BPACK = Tex.BASE_OBJECTS + 10;
Tex.OBJ_SHOTGUN = Tex.BASE_OBJECTS + 11;
Tex.OBJ_KEY_GREEN = Tex.BASE_OBJECTS + 12;
Tex.OBJ_CHAINGUN = Tex.BASE_OBJECTS + 13;
Tex.OBJ_DBLSHOTGUN = Tex.BASE_OBJECTS + 14;
},
load: function(callback) {
var loaded = 0;
var errorHandler = function() {
App.error("Can't load textures");
}
var loadHandler = function() {
loaded += 1;
if (loaded >= Tex.MAPS.length) {
callback();
} else {
App.log('Loading textures ' + (loaded + 1) + '/' + Tex.MAPS.length);
}
}
App.log('Loading textures 1/' + Tex.MAPS.length);
for (var i = 0; i < Tex.MAPS.length; i++) {
var img = new Image();
img.onerror = errorHandler;
img.onload = loadHandler;
img.src = 'gloomy/' + Tex.MAPS[i].img;
Tex.MAPS[i].img = img;
}
}
};
| mit |
hanickadot/syntax-parser | single-header/ctre.hpp | 196754 | /*
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
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.
--- LLVM Exceptions to the Apache 2.0 License ----
As an exception, if, as a result of your compiling your source code, portions
of this Software are embedded into an Object form of such source code, you
may redistribute such embedded portions in such Object form without complying
with the conditions of Sections 4(a), 4(b) and 4(d) of the License.
In addition, if you combine or link compiled forms of this Software with
software that is licensed under the GPLv2 ("Combined Software") and if a
court of competent jurisdiction determines that the patent provision (Section
3), the indemnity provision (Section 9) or other Section of the License
conflicts with the conditions of the GPLv2, you may retroactively and
prospectively choose to deem waived or otherwise exclude such Section(s) of
the License, but only in their entirety and only with respect to the Combined
Software.
*/
#ifndef CTRE_V2__CTRE__HPP
#define CTRE_V2__CTRE__HPP
#ifndef CTRE_V2__CTRE__LITERALS__HPP
#define CTRE_V2__CTRE__LITERALS__HPP
#ifndef CTRE_V2__CTLL__HPP
#define CTRE_V2__CTLL__HPP
#ifndef CTLL__PARSER__HPP
#define CTLL__PARSER__HPP
#ifndef CTLL__FIXED_STRING__GPP
#define CTLL__FIXED_STRING__GPP
#include <utility>
#include <cstddef>
#include <string_view>
#include <cstdint>
namespace ctll {
struct length_value_t {
uint32_t value;
uint8_t length;
};
constexpr length_value_t length_and_value_of_utf8_code_point(uint8_t first_unit) noexcept {
if ((first_unit & 0b1000'0000) == 0b0000'0000) return {static_cast<uint32_t>(first_unit), 1};
else if ((first_unit & 0b1110'0000) == 0b1100'0000) return {static_cast<uint32_t>(first_unit & 0b0001'1111), 2};
else if ((first_unit & 0b1111'0000) == 0b1110'0000) return {static_cast<uint32_t>(first_unit & 0b0000'1111), 3};
else if ((first_unit & 0b1111'1000) == 0b1111'0000) return {static_cast<uint32_t>(first_unit & 0b0000'0111), 4};
else if ((first_unit & 0b1111'1100) == 0b1111'1000) return {static_cast<uint32_t>(first_unit & 0b0000'0011), 5};
else if ((first_unit & 0b1111'1100) == 0b1111'1100) return {static_cast<uint32_t>(first_unit & 0b0000'0001), 6};
else return {0, 0};
}
constexpr char32_t value_of_trailing_utf8_code_point(uint8_t unit, bool & correct) noexcept {
if ((unit & 0b1100'0000) == 0b1000'0000) return unit & 0b0011'1111;
else {
correct = false;
return 0;
}
}
constexpr length_value_t length_and_value_of_utf16_code_point(uint16_t first_unit) noexcept {
if ((first_unit & 0b1111110000000000) == 0b1101'1000'0000'0000) return {static_cast<uint32_t>(first_unit & 0b0000001111111111), 2};
else return {first_unit, 1};
}
template <size_t N> struct fixed_string {
char32_t content[N] = {};
size_t real_size{0};
bool correct_flag{true};
template <typename T> constexpr fixed_string(const T (&input)[N+1]) noexcept {
if constexpr (std::is_same_v<T, char>) {
#if CTRE_STRING_IS_UTF8
size_t out{0};
for (size_t i{0}; i < N; ++i) {
if ((i == (N-1)) && (input[i] == 0)) break;
length_value_t info = length_and_value_of_utf8_code_point(input[i]);
switch (info.length) {
case 6:
if (++i < N) info.value = (info.value << 6) | value_of_trailing_utf8_code_point(input[i], correct_flag);
[[fallthrough]];
case 5:
if (++i < N) info.value = (info.value << 6) | value_of_trailing_utf8_code_point(input[i], correct_flag);
[[fallthrough]];
case 4:
if (++i < N) info.value = (info.value << 6) | value_of_trailing_utf8_code_point(input[i], correct_flag);
[[fallthrough]];
case 3:
if (++i < N) info.value = (info.value << 6) | value_of_trailing_utf8_code_point(input[i], correct_flag);
[[fallthrough]];
case 2:
if (++i < N) info.value = (info.value << 6) | value_of_trailing_utf8_code_point(input[i], correct_flag);
[[fallthrough]];
case 1:
content[out++] = static_cast<char32_t>(info.value);
real_size++;
break;
default:
correct_flag = false;
return;
}
}
#else
for (size_t i{0}; i < N; ++i) {
content[i] = static_cast<uint8_t>(input[i]);
if ((i == (N-1)) && (input[i] == 0)) break;
real_size++;
}
#endif
#if __cpp_char8_t
} else if constexpr (std::is_same_v<T, char8_t>) {
size_t out{0};
for (size_t i{0}; i < N; ++i) {
if ((i == (N-1)) && (input[i] == 0)) break;
length_value_t info = length_and_value_of_utf8_code_point(input[i]);
switch (info.length) {
case 6:
if (++i < N) info.value = (info.value << 6) | value_of_trailing_utf8_code_point(input[i], correct_flag);
[[fallthrough]];
case 5:
if (++i < N) info.value = (info.value << 6) | value_of_trailing_utf8_code_point(input[i], correct_flag);
[[fallthrough]];
case 4:
if (++i < N) info.value = (info.value << 6) | value_of_trailing_utf8_code_point(input[i], correct_flag);
[[fallthrough]];
case 3:
if (++i < N) info.value = (info.value << 6) | value_of_trailing_utf8_code_point(input[i], correct_flag);
[[fallthrough]];
case 2:
if (++i < N) info.value = (info.value << 6) | value_of_trailing_utf8_code_point(input[i], correct_flag);
[[fallthrough]];
case 1:
content[out++] = static_cast<char32_t>(info.value);
real_size++;
break;
default:
correct_flag = false;
return;
}
}
#endif
} else if constexpr (std::is_same_v<T, char16_t>) {
size_t out{0};
for (size_t i{0}; i < N; ++i) {
length_value_t info = length_and_value_of_utf16_code_point(input[i]);
if (info.length == 2) {
if (++i < N) {
if ((input[i] & 0b1111'1100'0000'0000) == 0b1101'1100'0000'0000) {
content[out++] = (info.value << 10) | (input[i] & 0b0000'0011'1111'1111);
} else {
correct_flag = false;
break;
}
}
} else {
if ((i == (N-1)) && (input[i] == 0)) break;
content[out++] = info.value;
}
}
real_size = out;
} else if constexpr (std::is_same_v<T, wchar_t> || std::is_same_v<T, char32_t>) {
for (size_t i{0}; i < N; ++i) {
content[i] = input[i];
if ((i == (N-1)) && (input[i] == 0)) break;
real_size++;
}
}
}
constexpr fixed_string(const fixed_string & other) noexcept {
for (size_t i{0}; i < N; ++i) {
content[i] = other.content[i];
}
real_size = other.real_size;
correct_flag = other.correct_flag;
}
constexpr bool correct() const noexcept {
return correct_flag;
}
constexpr size_t size() const noexcept {
return real_size;
}
constexpr const char32_t * begin() const noexcept {
return content;
}
constexpr const char32_t * end() const noexcept {
return content + size();
}
constexpr char32_t operator[](size_t i) const noexcept {
return content[i];
}
template <size_t M> constexpr bool is_same_as(const fixed_string<M> & rhs) const noexcept {
if (real_size != rhs.size()) return false;
for (size_t i{0}; i != real_size; ++i) {
if (content[i] != rhs[i]) return false;
}
return true;
}
constexpr operator std::basic_string_view<char32_t>() const noexcept {
return std::basic_string_view<char32_t>{content, size()};
}
};
template <> class fixed_string<0> {
static constexpr char32_t empty[1] = {0};
public:
template <typename T> constexpr fixed_string(const T *) noexcept {
}
constexpr fixed_string(std::initializer_list<char32_t>) noexcept {
}
constexpr fixed_string(const fixed_string &) noexcept {
}
constexpr bool correct() const noexcept {
return true;
}
constexpr size_t size() const noexcept {
return 0;
}
constexpr const char32_t * begin() const noexcept {
return empty;
}
constexpr const char32_t * end() const noexcept {
return empty + size();
}
constexpr char32_t operator[](size_t) const noexcept {
return 0;
}
constexpr operator std::basic_string_view<char32_t>() const noexcept {
return std::basic_string_view<char32_t>{empty, 0};
}
};
template <typename CharT, size_t N> fixed_string(const CharT (&)[N]) -> fixed_string<N-1>;
template <size_t N> fixed_string(fixed_string<N>) -> fixed_string<N>;
}
#if (__cpp_nontype_template_parameter_class || (__cpp_nontype_template_args >= 201911L))
#define CTLL_FIXED_STRING ctll::fixed_string
#else
#define CTLL_FIXED_STRING const auto &
#endif
#endif
#ifndef CTLL__TYPE_STACK__HPP
#define CTLL__TYPE_STACK__HPP
#ifndef CTLL__UTILITIES__HPP
#define CTLL__UTILITIES__HPP
#include <type_traits>
#ifdef _MSC_VER
#define CTLL_FORCE_INLINE __forceinline
#else
#define CTLL_FORCE_INLINE __attribute__((always_inline))
#endif
namespace ctll {
template <bool> struct conditional_helper;
template <> struct conditional_helper<true> {
template <typename A, typename> using type = A;
};
template <> struct conditional_helper<false> {
template <typename, typename B> using type = B;
};
template <bool V, typename A, typename B> using conditional = typename conditional_helper<V>::template type<A,B>;
}
#endif
namespace ctll {
template <typename... Ts> struct list { };
struct _nothing { };
using empty_list = list<>;
// calculate size of list content
template <typename... Ts> constexpr auto size(list<Ts...>) noexcept { return sizeof...(Ts); }
// check if the list is empty
template <typename... Ts> constexpr bool empty(list<Ts...>) noexcept { return false; }
constexpr bool empty(empty_list) { return true; }
// concat two lists together left to right
template <typename... As, typename... Bs> constexpr auto concat(list<As...>, list<Bs...>) noexcept -> list<As..., Bs...> { return {}; }
// push something to the front of a list
template <typename T, typename... As> constexpr auto push_front(T, list<As...>) noexcept -> list<T, As...> { return {}; }
// pop element from the front of a list
template <typename T, typename... As> constexpr auto pop_front(list<T, As...>) noexcept -> list<As...> { return {}; }
constexpr auto pop_front(empty_list) -> empty_list;
// pop element from the front of a list and return new typelist too
template <typename Front, typename List> struct list_pop_pair {
Front front{};
List list{};
constexpr list_pop_pair() = default;
};
template <typename Head, typename... As, typename T = _nothing> constexpr auto pop_and_get_front(list<Head, As...>, T = T()) noexcept -> list_pop_pair<Head, list<As...>> { return {}; }
template <typename T = _nothing> constexpr auto pop_and_get_front(empty_list, T = T()) noexcept -> list_pop_pair<T, empty_list> { return {}; }
// return front of the list
template <typename Head, typename... As, typename T = _nothing> constexpr auto front(list<Head, As...>, T = T()) noexcept -> Head { return {}; }
template <typename T = _nothing> constexpr auto front(empty_list, T = T()) noexcept -> T { return {}; }
}
#endif
#ifndef CTLL__GRAMMARS__HPP
#define CTLL__GRAMMARS__HPP
namespace ctll {
// terminal type representing symbol / character of any type
template <auto v> struct term {
static constexpr auto value = v;
};
// epsilon = nothing on input tape
// also used as an command for parsing means "do nothing"
struct epsilon {
static constexpr auto value = '-';
};
// empty_stack_symbol = nothing on stack
struct empty_stack_symbol {};
// push<T...> is alias to list<T...>
template <typename... Ts> using push = list<Ts...>;
// accept/reject type for controlling output of LL1 machine
struct accept { constexpr explicit operator bool() noexcept { return true; } };
struct reject { constexpr explicit operator bool() noexcept { return false; } };
// action type, every action item in grammar must inherit from
struct action {
struct action_tag { };
};
// move one character forward and pop it from stack command
struct pop_input {
struct pop_input_tag { };
};
// additional overloads for type list
template <typename... Ts> constexpr auto push_front(pop_input, list<Ts...>) -> list<Ts...> { return {}; }
template <typename... Ts> constexpr auto push_front(epsilon, list<Ts...>) -> list<Ts...> { return {}; }
template <typename... As, typename... Bs> constexpr auto push_front(list<As...>, list<Bs...>) -> list<As..., Bs...> { return {}; }
template <typename T, typename... As> constexpr auto pop_front_and_push_front(T item, list<As...> l) {
return push_front(item, pop_front(l));
}
// SPECIAL matching types for nicer grammars
// match any term
struct anything {
constexpr inline anything() noexcept { }
template <auto V> constexpr anything(term<V>) noexcept;
};
// match range of term A-B
template <auto A, decltype(A) B> struct range {
constexpr inline range() noexcept { }
//template <auto V> constexpr range(term<V>) noexcept requires (A <= V) && (V <= B);
template <auto V, typename = std::enable_if_t<(A <= V) && (V <= B)>> constexpr inline range(term<V>) noexcept;
};
#ifdef __EDG__
template <auto V, auto... Set> struct contains {
static constexpr bool value = ((Set == V) || ... || false);
};
#endif
// match terms defined in set
template <auto... Def> struct set {
constexpr inline set() noexcept { }
#ifdef __EDG__
template <auto V, typename = std::enable_if_t<contains<V, Def...>::value>> constexpr inline set(term<V>) noexcept;
#else
template <auto V, typename = std::enable_if_t<((Def == V) || ... || false)>> constexpr inline set(term<V>) noexcept;
#endif
};
// match terms not defined in set
template <auto... Def> struct neg_set {
constexpr inline neg_set() noexcept { }
#ifdef __EDG__
template <auto V, typename = std::enable_if_t<!contains<V, Def...>::value>> constexpr inline neg_set(term<V>) noexcept;
#else
template <auto V, typename = std::enable_if_t<!((Def == V) || ... || false)>> constexpr inline neg_set(term<V>) noexcept;
#endif
};
// AUGMENTED grammar which completes user-defined grammar for all other cases
template <typename Grammar> struct augment_grammar: public Grammar {
// start nonterminal is defined in parent type
using typename Grammar::_start;
// grammar rules are inherited from Grammar parent type
using Grammar::rule;
// term on stack and on input means pop_input;
template <auto A> static constexpr auto rule(term<A>, term<A>) -> ctll::pop_input;
// if the type on stack (range, set, neg_set, anything) is constructible from the terminal => pop_input
template <typename Expected, auto V> static constexpr auto rule(Expected, term<V>) -> std::enable_if_t<std::is_constructible_v<Expected, term<V>>, ctll::pop_input>;
// empty stack and empty input means we are accepting
static constexpr auto rule(empty_stack_symbol, epsilon) -> ctll::accept;
// not matching anything else => reject
static constexpr auto rule(...) -> ctll::reject;
// start stack is just a list<Grammar::_start>;
using start_stack = list<typename Grammar::_start>;
};
}
#endif
#ifndef CTLL__ACTIONS__HPP
#define CTLL__ACTIONS__HPP
namespace ctll {
struct empty_subject { };
struct empty_actions {
// dummy operator so using Actions::operator() later will not give error
template <typename Action, typename InputSymbol, typename Subject> static constexpr auto apply(Action, InputSymbol, Subject subject) {
return subject;
}
};
template <typename Actions> struct identity: public Actions {
using Actions::apply;
// allow empty_subject to exists
template <typename Action, auto V> constexpr static auto apply(Action, term<V>, empty_subject) -> empty_subject { return {}; }
template <typename Action> constexpr static auto apply(Action, epsilon, empty_subject) -> empty_subject { return {}; }
};
template <typename Actions> struct ignore_unknown: public Actions {
using Actions::apply;
// allow flow thru unknown actions
template <typename Action, auto V, typename Subject> constexpr static auto apply(Action, term<V>, Subject) -> Subject { return {}; }
template <typename Action, typename Subject> constexpr static auto apply(Action, epsilon, Subject) -> Subject { return {}; }
};
}
#endif
#include <limits>
namespace ctll {
enum class decision {
reject,
accept,
undecided
};
struct placeholder { };
template <size_t> using index_placeholder = placeholder;
#if ((__cpp_nontype_template_parameter_class || (__cpp_nontype_template_args >= 201911L)) || (__cpp_nontype_template_args >= 201911L))
template <typename Grammar, ctll::fixed_string input, typename ActionSelector = empty_actions, bool IgnoreUnknownActions = false> struct parser { // in c++20
#else
template <typename Grammar, const auto & input, typename ActionSelector = empty_actions, bool IgnoreUnknownActions = false> struct parser {
#endif
#ifdef __GNUC__ // workaround to GCC bug
#if ((__cpp_nontype_template_parameter_class || (__cpp_nontype_template_args >= 201911L)) || (__cpp_nontype_template_args >= 201911L))
static constexpr auto _input = input; // c++20 mode
#else
static constexpr auto & _input = input; // c++17 mode
#endif
#else
static constexpr auto _input = input; // everyone else
#endif
using Actions = ctll::conditional<IgnoreUnknownActions, ignore_unknown<ActionSelector>, identity<ActionSelector>>;
using grammar = augment_grammar<Grammar>;
template <size_t Pos, typename Stack, typename Subject, decision Decision> struct results {
constexpr inline CTLL_FORCE_INLINE operator bool() const noexcept {
return Decision == decision::accept;
}
#ifdef __GNUC__ // workaround to GCC bug
#if ((__cpp_nontype_template_parameter_class || (__cpp_nontype_template_args >= 201911L)) || (__cpp_nontype_template_args >= 201911L))
static constexpr auto _input = input; // c++20 mode
#else
static constexpr auto & _input = input; // c++17 mode
#endif
#else
static constexpr auto _input = input; // everyone else
#endif
using output_type = Subject;
constexpr auto operator+(placeholder) const noexcept {
if constexpr (Decision == decision::undecided) {
// parse for current char (RPos) with previous stack and subject :)
return parser<Grammar, _input, ActionSelector, IgnoreUnknownActions>::template decide<Pos, Stack, Subject>({}, {});
} else {
// if there is decision already => just push it to the end of fold expression
return *this;
}
}
};
template <size_t Pos> static constexpr auto get_current_term() noexcept {
if constexpr (Pos < input.size()) {
constexpr auto value = input[Pos];
if constexpr (value <= std::numeric_limits<char>::max()) {
return term<static_cast<char>(value)>{};
} else {
return term<input[Pos]>{};
}
} else {
// return epsilon if we are past the input
return epsilon{};
}
}
template <size_t Pos> static constexpr auto get_previous_term() noexcept {
if constexpr (Pos == 0) {
// there is no previous character on input if we are on start
return epsilon{};
} else if constexpr ((Pos-1) < input.size()) {
constexpr auto value = input[Pos-1];
if constexpr (value <= std::numeric_limits<char>::max()) {
return term<static_cast<char>(value)>{};
} else {
return term<value>{};
}
} else {
return epsilon{};
}
}
// if rule is accept => return true and subject
template <size_t Pos, typename Terminal, typename Stack, typename Subject>
static constexpr auto move(ctll::accept, Terminal, Stack, Subject) noexcept {
return typename parser<Grammar, _input, ActionSelector, IgnoreUnknownActions>::template results<Pos, Stack, Subject, decision::accept>();
}
// if rule is reject => return false and subject
template <size_t Pos, typename Terminal, typename Stack, typename Subject>
static constexpr auto move(ctll::reject, Terminal, Stack, Subject) noexcept {
return typename parser<Grammar, _input, ActionSelector, IgnoreUnknownActions>::template results<Pos, Stack, Subject, decision::reject>();
}
// if rule is pop_input => move to next character
template <size_t Pos, typename Terminal, typename Stack, typename Subject>
static constexpr auto move(ctll::pop_input, Terminal, Stack, Subject) noexcept {
return typename parser<Grammar, _input, ActionSelector, IgnoreUnknownActions>::template results<Pos+1, Stack, Subject, decision::undecided>();
}
// if rule is string => push it to the front of stack
template <size_t Pos, typename... Content, typename Terminal, typename Stack, typename Subject>
static constexpr auto move(push<Content...> string, Terminal, Stack stack, Subject subject) noexcept {
return decide<Pos>(push_front(string, stack), subject);
}
// if rule is epsilon (empty string) => continue
template <size_t Pos, typename Terminal, typename Stack, typename Subject>
static constexpr auto move(epsilon, Terminal, Stack stack, Subject subject) noexcept {
return decide<Pos>(stack, subject);
}
// if rule is string with current character at the beginning (term<V>) => move to next character
// and push string without the character (quick LL(1))
template <size_t Pos, auto V, typename... Content, typename Stack, typename Subject>
static constexpr auto move(push<term<V>, Content...>, term<V>, Stack stack, Subject) noexcept {
constexpr auto _input = input;
return typename parser<Grammar, _input, ActionSelector, IgnoreUnknownActions>::template results<Pos+1, decltype(push_front(list<Content...>(), stack)), Subject, decision::undecided>();
}
// if rule is string with any character at the beginning (compatible with current term<T>) => move to next character
// and push string without the character (quick LL(1))
template <size_t Pos, auto V, typename... Content, auto T, typename Stack, typename Subject>
static constexpr auto move(push<anything, Content...>, term<T>, Stack stack, Subject) noexcept {
constexpr auto _input = input;
return typename parser<Grammar, _input, ActionSelector, IgnoreUnknownActions>::template results<Pos+1, decltype(push_front(list<Content...>(), stack)), Subject, decision::undecided>();
}
// decide if we need to take action or move
template <size_t Pos, typename Stack, typename Subject> static constexpr auto decide(Stack previous_stack, Subject previous_subject) noexcept {
// each call means we pop something from stack
auto top_symbol = decltype(ctll::front(previous_stack, empty_stack_symbol()))();
// gcc pedantic warning
[[maybe_unused]] auto stack = decltype(ctll::pop_front(previous_stack))();
// in case top_symbol is action type (apply it on previous subject and get new one)
if constexpr (std::is_base_of_v<ctll::action, decltype(top_symbol)>) {
auto subject = Actions::apply(top_symbol, get_previous_term<Pos>(), previous_subject);
// in case that semantic action is error => reject input
if constexpr (std::is_same_v<ctll::reject, decltype(subject)>) {
return typename parser<Grammar, _input, ActionSelector, IgnoreUnknownActions>::template results<Pos, Stack, Subject, decision::reject>();
} else {
return decide<Pos>(stack, subject);
}
} else {
// all other cases are ordinary for LL(1) parser
auto current_term = get_current_term<Pos>();
auto rule = decltype(grammar::rule(top_symbol,current_term))();
return move<Pos>(rule, current_term, stack, previous_subject);
}
}
// trampolines with folded expression
template <typename Subject, size_t... Pos> static constexpr auto trampoline_decide(Subject, std::index_sequence<Pos...>) noexcept {
// parse everything for first char and than for next and next ...
// Pos+1 is needed as we want to finish calculation with epsilons on stack
auto v = (decide<0, typename grammar::start_stack, Subject>({}, {}) + ... + index_placeholder<Pos+1>());
return v;
}
template <typename Subject = empty_subject> static constexpr auto trampoline_decide(Subject subject = {}) noexcept {
// there will be no recursion, just sequence long as the input
return trampoline_decide(subject, std::make_index_sequence<input.size()>());
}
template <typename Subject = empty_subject> using output = decltype(trampoline_decide<Subject>());
template <typename Subject = empty_subject> static inline constexpr bool correct_with = trampoline_decide<Subject>();
};
} // end of ctll namespace
#endif
#endif
#ifndef CTRE__PCRE_ACTIONS__HPP
#define CTRE__PCRE_ACTIONS__HPP
#ifndef CTRE__PCRE__HPP
#define CTRE__PCRE__HPP
// THIS FILE WAS GENERATED BY DESATOMAT TOOL, DO NOT MODIFY THIS FILE
namespace ctre {
struct pcre {
// NONTERMINALS:
struct a {};
struct b {};
struct backslash {};
struct backslash_range {};
struct block {};
struct block_name2 {};
struct block_name {};
struct c {};
struct class_named_name {};
struct content2 {};
struct content_in_capture {};
struct d {};
struct e {};
struct f {};
struct g {};
struct h {};
struct hexdec_repeat {};
struct i {};
struct j {};
struct k {};
struct l {};
struct m {};
struct mod {};
struct mod_opt {};
struct n {};
struct number2 {};
struct number {};
struct o {};
struct p {};
struct property_name2 {};
struct property_name {};
struct property_value2 {};
struct property_value {};
struct q {};
struct range {};
struct repeat {};
struct s {}; using _start = s;
struct set2a {};
struct set2b {};
struct string2 {};
// 'action' types:
struct class_digit: ctll::action {};
struct class_named_alnum: ctll::action {};
struct class_named_alpha: ctll::action {};
struct class_named_ascii: ctll::action {};
struct class_named_blank: ctll::action {};
struct class_named_cntrl: ctll::action {};
struct class_named_digit: ctll::action {};
struct class_named_graph: ctll::action {};
struct class_named_lower: ctll::action {};
struct class_named_print: ctll::action {};
struct class_named_punct: ctll::action {};
struct class_named_space: ctll::action {};
struct class_named_upper: ctll::action {};
struct class_named_word: ctll::action {};
struct class_named_xdigit: ctll::action {};
struct class_nondigit: ctll::action {};
struct class_nonnewline: ctll::action {};
struct class_nonspace: ctll::action {};
struct class_nonword: ctll::action {};
struct class_space: ctll::action {};
struct class_word: ctll::action {};
struct create_hexdec: ctll::action {};
struct create_number: ctll::action {};
struct finish_hexdec: ctll::action {};
struct look_finish: ctll::action {};
struct make_alternate: ctll::action {};
struct make_back_reference: ctll::action {};
struct make_capture: ctll::action {};
struct make_capture_with_name: ctll::action {};
struct make_lazy: ctll::action {};
struct make_optional: ctll::action {};
struct make_possessive: ctll::action {};
struct make_property: ctll::action {};
struct make_property_negative: ctll::action {};
struct make_range: ctll::action {};
struct make_relative_back_reference: ctll::action {};
struct make_sequence: ctll::action {};
struct negate_class_named: ctll::action {};
struct prepare_capture: ctll::action {};
struct push_assert_begin: ctll::action {};
struct push_assert_end: ctll::action {};
struct push_character: ctll::action {};
struct push_character_alarm: ctll::action {};
struct push_character_anything: ctll::action {};
struct push_character_escape: ctll::action {};
struct push_character_formfeed: ctll::action {};
struct push_character_newline: ctll::action {};
struct push_character_null: ctll::action {};
struct push_character_return_carriage: ctll::action {};
struct push_character_tab: ctll::action {};
struct push_empty: ctll::action {};
struct push_hexdec: ctll::action {};
struct push_name: ctll::action {};
struct push_number: ctll::action {};
struct push_property_name: ctll::action {};
struct push_property_value: ctll::action {};
struct repeat_ab: ctll::action {};
struct repeat_at_least: ctll::action {};
struct repeat_exactly: ctll::action {};
struct repeat_plus: ctll::action {};
struct repeat_star: ctll::action {};
struct reset_capture: ctll::action {};
struct set_combine: ctll::action {};
struct set_make: ctll::action {};
struct set_make_negative: ctll::action {};
struct set_start: ctll::action {};
struct start_lookahead_negative: ctll::action {};
struct start_lookahead_positive: ctll::action {};
// (q)LL1 function:
using _others = ctll::neg_set<'!','$','\x28','\x29','*','+',',','-','.',':','<','=','>','?','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','0','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','\x7B','|','\x7D','1','2','3','4','5','6','7','8','9'>;
static constexpr auto rule(s, ctll::term<'\\'>) -> ctll::push<ctll::anything, backslash, repeat, string2, content2>;
static constexpr auto rule(s, ctll::term<'['>) -> ctll::push<ctll::anything, c, repeat, string2, content2>;
static constexpr auto rule(s, ctll::term<'\x28'>) -> ctll::push<ctll::anything, prepare_capture, block, repeat, string2, content2>;
static constexpr auto rule(s, ctll::term<'^'>) -> ctll::push<ctll::anything, push_assert_begin, repeat, string2, content2>;
static constexpr auto rule(s, ctll::term<'$'>) -> ctll::push<ctll::anything, push_assert_end, repeat, string2, content2>;
static constexpr auto rule(s, ctll::set<'!',',','-',':','<','=','>','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T',']','_','0','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','1','2','3','4','5','6','7','8','9'>) -> ctll::push<ctll::anything, push_character, repeat, string2, content2>;
static constexpr auto rule(s, _others) -> ctll::push<ctll::anything, push_character, repeat, string2, content2>;
static constexpr auto rule(s, ctll::term<'.'>) -> ctll::push<ctll::anything, push_character_anything, repeat, string2, content2>;
static constexpr auto rule(s, ctll::epsilon) -> ctll::push<push_empty>;
static constexpr auto rule(s, ctll::set<'\x29','*','+','?','\x7B','|','\x7D'>) -> ctll::reject;
static constexpr auto rule(a, ctll::term<'\\'>) -> ctll::push<ctll::anything, backslash, repeat, string2, content2, make_alternate>;
static constexpr auto rule(a, ctll::term<'['>) -> ctll::push<ctll::anything, c, repeat, string2, content2, make_alternate>;
static constexpr auto rule(a, ctll::term<'\x28'>) -> ctll::push<ctll::anything, prepare_capture, block, repeat, string2, content2, make_alternate>;
static constexpr auto rule(a, ctll::term<'^'>) -> ctll::push<ctll::anything, push_assert_begin, repeat, string2, content2, make_alternate>;
static constexpr auto rule(a, ctll::term<'$'>) -> ctll::push<ctll::anything, push_assert_end, repeat, string2, content2, make_alternate>;
static constexpr auto rule(a, ctll::set<'!',',','-',':','<','=','>','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T',']','_','0','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','1','2','3','4','5','6','7','8','9'>) -> ctll::push<ctll::anything, push_character, repeat, string2, content2, make_alternate>;
static constexpr auto rule(a, _others) -> ctll::push<ctll::anything, push_character, repeat, string2, content2, make_alternate>;
static constexpr auto rule(a, ctll::term<'.'>) -> ctll::push<ctll::anything, push_character_anything, repeat, string2, content2, make_alternate>;
static constexpr auto rule(a, ctll::term<'\x29'>) -> ctll::push<push_empty, make_alternate>;
static constexpr auto rule(a, ctll::epsilon) -> ctll::push<push_empty, make_alternate>;
static constexpr auto rule(a, ctll::set<'*','+','?','\x7B','|','\x7D'>) -> ctll::reject;
static constexpr auto rule(b, ctll::term<','>) -> ctll::push<ctll::anything, n>;
static constexpr auto rule(b, ctll::term<'\x7D'>) -> ctll::push<repeat_exactly, ctll::anything>;
static constexpr auto rule(backslash, ctll::term<'d'>) -> ctll::push<ctll::anything, class_digit>;
static constexpr auto rule(backslash, ctll::term<'D'>) -> ctll::push<ctll::anything, class_nondigit>;
static constexpr auto rule(backslash, ctll::term<'N'>) -> ctll::push<ctll::anything, class_nonnewline>;
static constexpr auto rule(backslash, ctll::term<'S'>) -> ctll::push<ctll::anything, class_nonspace>;
static constexpr auto rule(backslash, ctll::term<'W'>) -> ctll::push<ctll::anything, class_nonword>;
static constexpr auto rule(backslash, ctll::term<'s'>) -> ctll::push<ctll::anything, class_space>;
static constexpr auto rule(backslash, ctll::term<'w'>) -> ctll::push<ctll::anything, class_word>;
static constexpr auto rule(backslash, ctll::set<'1','2','3','4','5','6','7','8','9'>) -> ctll::push<ctll::anything, create_number, make_back_reference>;
static constexpr auto rule(backslash, ctll::term<'g'>) -> ctll::push<ctll::anything, ctll::term<'\x7B'>, m>;
static constexpr auto rule(backslash, ctll::term<'p'>) -> ctll::push<ctll::anything, ctll::term<'\x7B'>, property_name, ctll::term<'\x7D'>, make_property>;
static constexpr auto rule(backslash, ctll::term<'P'>) -> ctll::push<ctll::anything, ctll::term<'\x7B'>, property_name, ctll::term<'\x7D'>, make_property_negative>;
static constexpr auto rule(backslash, ctll::term<'u'>) -> ctll::push<ctll::anything, k>;
static constexpr auto rule(backslash, ctll::term<'x'>) -> ctll::push<ctll::anything, l>;
static constexpr auto rule(backslash, ctll::set<'$','\x28','\x29','*','+','-','.','?','[','\\',']','^','\x7B','|','\x7D'>) -> ctll::push<ctll::anything, push_character>;
static constexpr auto rule(backslash, ctll::term<'a'>) -> ctll::push<ctll::anything, push_character_alarm>;
static constexpr auto rule(backslash, ctll::term<'e'>) -> ctll::push<ctll::anything, push_character_escape>;
static constexpr auto rule(backslash, ctll::term<'f'>) -> ctll::push<ctll::anything, push_character_formfeed>;
static constexpr auto rule(backslash, ctll::term<'n'>) -> ctll::push<ctll::anything, push_character_newline>;
static constexpr auto rule(backslash, ctll::term<'0'>) -> ctll::push<ctll::anything, push_character_null>;
static constexpr auto rule(backslash, ctll::term<'r'>) -> ctll::push<ctll::anything, push_character_return_carriage>;
static constexpr auto rule(backslash, ctll::term<'t'>) -> ctll::push<ctll::anything, push_character_tab>;
static constexpr auto rule(backslash_range, ctll::term<'u'>) -> ctll::push<ctll::anything, k>;
static constexpr auto rule(backslash_range, ctll::term<'x'>) -> ctll::push<ctll::anything, l>;
static constexpr auto rule(backslash_range, ctll::term<'-'>) -> ctll::push<ctll::anything, push_character>;
static constexpr auto rule(backslash_range, ctll::term<'a'>) -> ctll::push<ctll::anything, push_character_alarm>;
static constexpr auto rule(backslash_range, ctll::term<'e'>) -> ctll::push<ctll::anything, push_character_escape>;
static constexpr auto rule(backslash_range, ctll::term<'f'>) -> ctll::push<ctll::anything, push_character_formfeed>;
static constexpr auto rule(backslash_range, ctll::term<'n'>) -> ctll::push<ctll::anything, push_character_newline>;
static constexpr auto rule(backslash_range, ctll::term<'0'>) -> ctll::push<ctll::anything, push_character_null>;
static constexpr auto rule(backslash_range, ctll::term<'r'>) -> ctll::push<ctll::anything, push_character_return_carriage>;
static constexpr auto rule(backslash_range, ctll::term<'t'>) -> ctll::push<ctll::anything, push_character_tab>;
static constexpr auto rule(block, ctll::term<'\\'>) -> ctll::push<ctll::anything, backslash, repeat, string2, content2, make_capture, ctll::term<'\x29'>>;
static constexpr auto rule(block, ctll::term<'['>) -> ctll::push<ctll::anything, c, repeat, string2, content2, make_capture, ctll::term<'\x29'>>;
static constexpr auto rule(block, ctll::term<'?'>) -> ctll::push<ctll::anything, d>;
static constexpr auto rule(block, ctll::term<'\x28'>) -> ctll::push<ctll::anything, prepare_capture, block, repeat, string2, content2, make_capture, ctll::term<'\x29'>>;
static constexpr auto rule(block, ctll::term<'^'>) -> ctll::push<ctll::anything, push_assert_begin, repeat, string2, content2, make_capture, ctll::term<'\x29'>>;
static constexpr auto rule(block, ctll::term<'$'>) -> ctll::push<ctll::anything, push_assert_end, repeat, string2, content2, make_capture, ctll::term<'\x29'>>;
static constexpr auto rule(block, ctll::set<'!',',','-',':','<','=','>','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T',']','_','0','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','1','2','3','4','5','6','7','8','9'>) -> ctll::push<ctll::anything, push_character, repeat, string2, content2, make_capture, ctll::term<'\x29'>>;
static constexpr auto rule(block, _others) -> ctll::push<ctll::anything, push_character, repeat, string2, content2, make_capture, ctll::term<'\x29'>>;
static constexpr auto rule(block, ctll::term<'.'>) -> ctll::push<ctll::anything, push_character_anything, repeat, string2, content2, make_capture, ctll::term<'\x29'>>;
static constexpr auto rule(block, ctll::term<'\x29'>) -> ctll::push<push_empty, make_capture, ctll::anything>;
static constexpr auto rule(block, ctll::set<'*','+','\x7B','|','\x7D'>) -> ctll::reject;
static constexpr auto rule(block_name2, ctll::set<'>','\x7D'>) -> ctll::epsilon;
static constexpr auto rule(block_name2, ctll::set<'0','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','1','2','3','4','5','6','7','8','9'>) -> ctll::push<ctll::anything, push_name, block_name2>;
static constexpr auto rule(block_name, ctll::set<'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'>) -> ctll::push<ctll::anything, push_name, block_name2>;
static constexpr auto rule(c, ctll::term<'['>) -> ctll::push<ctll::anything, ctll::term<':'>, i, range, set_start, set2b, set_make, ctll::term<']'>>;
static constexpr auto rule(c, ctll::term<'\\'>) -> ctll::push<ctll::anything, e, set_start, set2b, set_make, ctll::term<']'>>;
static constexpr auto rule(c, ctll::set<'!','$','\x28','\x29','*','+',',','.',':','<','=','>','?','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','0','s','t','u','v','w','x','y','z','\x7B','\x7D','1','2','3','4','5','6','7','8','9'>) -> ctll::push<ctll::anything, push_character, range, set_start, set2b, set_make, ctll::term<']'>>;
static constexpr auto rule(c, _others) -> ctll::push<ctll::anything, push_character, range, set_start, set2b, set_make, ctll::term<']'>>;
static constexpr auto rule(c, ctll::term<'^'>) -> ctll::push<ctll::anything, set2a, set_make_negative, ctll::term<']'>>;
static constexpr auto rule(c, ctll::set<'-',']','|'>) -> ctll::reject;
static constexpr auto rule(class_named_name, ctll::term<'x'>) -> ctll::push<ctll::anything, ctll::term<'d'>, ctll::term<'i'>, ctll::term<'g'>, ctll::term<'i'>, ctll::term<'t'>, class_named_xdigit>;
static constexpr auto rule(class_named_name, ctll::term<'d'>) -> ctll::push<ctll::anything, ctll::term<'i'>, ctll::term<'g'>, ctll::term<'i'>, ctll::term<'t'>, class_named_digit>;
static constexpr auto rule(class_named_name, ctll::term<'b'>) -> ctll::push<ctll::anything, ctll::term<'l'>, ctll::term<'a'>, ctll::term<'n'>, ctll::term<'k'>, class_named_blank>;
static constexpr auto rule(class_named_name, ctll::term<'c'>) -> ctll::push<ctll::anything, ctll::term<'n'>, ctll::term<'t'>, ctll::term<'r'>, ctll::term<'l'>, class_named_cntrl>;
static constexpr auto rule(class_named_name, ctll::term<'w'>) -> ctll::push<ctll::anything, ctll::term<'o'>, ctll::term<'r'>, ctll::term<'d'>, class_named_word>;
static constexpr auto rule(class_named_name, ctll::term<'l'>) -> ctll::push<ctll::anything, ctll::term<'o'>, ctll::term<'w'>, ctll::term<'e'>, ctll::term<'r'>, class_named_lower>;
static constexpr auto rule(class_named_name, ctll::term<'s'>) -> ctll::push<ctll::anything, ctll::term<'p'>, ctll::term<'a'>, ctll::term<'c'>, ctll::term<'e'>, class_named_space>;
static constexpr auto rule(class_named_name, ctll::term<'u'>) -> ctll::push<ctll::anything, ctll::term<'p'>, ctll::term<'p'>, ctll::term<'e'>, ctll::term<'r'>, class_named_upper>;
static constexpr auto rule(class_named_name, ctll::term<'g'>) -> ctll::push<ctll::anything, ctll::term<'r'>, ctll::term<'a'>, ctll::term<'p'>, ctll::term<'h'>, class_named_graph>;
static constexpr auto rule(class_named_name, ctll::term<'a'>) -> ctll::push<ctll::anything, g>;
static constexpr auto rule(class_named_name, ctll::term<'p'>) -> ctll::push<ctll::anything, h>;
static constexpr auto rule(content2, ctll::term<'\x29'>) -> ctll::epsilon;
static constexpr auto rule(content2, ctll::epsilon) -> ctll::epsilon;
static constexpr auto rule(content2, ctll::term<'|'>) -> ctll::push<ctll::anything, a>;
static constexpr auto rule(content_in_capture, ctll::term<'\\'>) -> ctll::push<ctll::anything, backslash, repeat, string2, content2>;
static constexpr auto rule(content_in_capture, ctll::term<'['>) -> ctll::push<ctll::anything, c, repeat, string2, content2>;
static constexpr auto rule(content_in_capture, ctll::term<'\x28'>) -> ctll::push<ctll::anything, prepare_capture, block, repeat, string2, content2>;
static constexpr auto rule(content_in_capture, ctll::term<'^'>) -> ctll::push<ctll::anything, push_assert_begin, repeat, string2, content2>;
static constexpr auto rule(content_in_capture, ctll::term<'$'>) -> ctll::push<ctll::anything, push_assert_end, repeat, string2, content2>;
static constexpr auto rule(content_in_capture, ctll::set<'!',',','-',':','<','=','>','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T',']','_','0','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','1','2','3','4','5','6','7','8','9'>) -> ctll::push<ctll::anything, push_character, repeat, string2, content2>;
static constexpr auto rule(content_in_capture, _others) -> ctll::push<ctll::anything, push_character, repeat, string2, content2>;
static constexpr auto rule(content_in_capture, ctll::term<'.'>) -> ctll::push<ctll::anything, push_character_anything, repeat, string2, content2>;
static constexpr auto rule(content_in_capture, ctll::term<'\x29'>) -> ctll::push<push_empty>;
static constexpr auto rule(content_in_capture, ctll::set<'*','+','?','\x7B','|','\x7D'>) -> ctll::reject;
static constexpr auto rule(d, ctll::term<'<'>) -> ctll::push<ctll::anything, block_name, ctll::term<'>'>, content_in_capture, make_capture_with_name, ctll::term<'\x29'>>;
static constexpr auto rule(d, ctll::term<':'>) -> ctll::push<reset_capture, ctll::anything, content_in_capture, ctll::term<'\x29'>>;
static constexpr auto rule(d, ctll::term<'!'>) -> ctll::push<reset_capture, ctll::anything, start_lookahead_negative, content_in_capture, look_finish, ctll::term<'\x29'>>;
static constexpr auto rule(d, ctll::term<'='>) -> ctll::push<reset_capture, ctll::anything, start_lookahead_positive, content_in_capture, look_finish, ctll::term<'\x29'>>;
static constexpr auto rule(e, ctll::term<'d'>) -> ctll::push<ctll::anything, class_digit>;
static constexpr auto rule(e, ctll::term<'D'>) -> ctll::push<ctll::anything, class_nondigit>;
static constexpr auto rule(e, ctll::term<'N'>) -> ctll::push<ctll::anything, class_nonnewline>;
static constexpr auto rule(e, ctll::term<'S'>) -> ctll::push<ctll::anything, class_nonspace>;
static constexpr auto rule(e, ctll::term<'W'>) -> ctll::push<ctll::anything, class_nonword>;
static constexpr auto rule(e, ctll::term<'s'>) -> ctll::push<ctll::anything, class_space>;
static constexpr auto rule(e, ctll::term<'w'>) -> ctll::push<ctll::anything, class_word>;
static constexpr auto rule(e, ctll::set<'1','2','3','4','5','6','7','8','9'>) -> ctll::push<ctll::anything, create_number, make_back_reference>;
static constexpr auto rule(e, ctll::term<'p'>) -> ctll::push<ctll::anything, ctll::term<'\x7B'>, property_name, ctll::term<'\x7D'>, make_property>;
static constexpr auto rule(e, ctll::term<'P'>) -> ctll::push<ctll::anything, ctll::term<'\x7B'>, property_name, ctll::term<'\x7D'>, make_property_negative>;
static constexpr auto rule(e, ctll::term<'u'>) -> ctll::push<ctll::anything, k, range>;
static constexpr auto rule(e, ctll::term<'x'>) -> ctll::push<ctll::anything, l, range>;
static constexpr auto rule(e, ctll::term<'-'>) -> ctll::push<ctll::anything, p>;
static constexpr auto rule(e, ctll::set<'$','\x28','\x29','*','+','.','?','[','\\',']','^','\x7B','|','\x7D'>) -> ctll::push<ctll::anything, push_character>;
static constexpr auto rule(e, ctll::term<'a'>) -> ctll::push<ctll::anything, push_character_alarm, range>;
static constexpr auto rule(e, ctll::term<'e'>) -> ctll::push<ctll::anything, push_character_escape, range>;
static constexpr auto rule(e, ctll::term<'f'>) -> ctll::push<ctll::anything, push_character_formfeed, range>;
static constexpr auto rule(e, ctll::term<'n'>) -> ctll::push<ctll::anything, push_character_newline, range>;
static constexpr auto rule(e, ctll::term<'0'>) -> ctll::push<ctll::anything, push_character_null, range>;
static constexpr auto rule(e, ctll::term<'r'>) -> ctll::push<ctll::anything, push_character_return_carriage, range>;
static constexpr auto rule(e, ctll::term<'t'>) -> ctll::push<ctll::anything, push_character_tab, range>;
static constexpr auto rule(f, ctll::term<'d'>) -> ctll::push<ctll::anything, class_digit>;
static constexpr auto rule(f, ctll::term<'D'>) -> ctll::push<ctll::anything, class_nondigit>;
static constexpr auto rule(f, ctll::term<'N'>) -> ctll::push<ctll::anything, class_nonnewline>;
static constexpr auto rule(f, ctll::term<'S'>) -> ctll::push<ctll::anything, class_nonspace>;
static constexpr auto rule(f, ctll::term<'W'>) -> ctll::push<ctll::anything, class_nonword>;
static constexpr auto rule(f, ctll::term<'s'>) -> ctll::push<ctll::anything, class_space>;
static constexpr auto rule(f, ctll::term<'w'>) -> ctll::push<ctll::anything, class_word>;
static constexpr auto rule(f, ctll::set<'1','2','3','4','5','6','7','8','9'>) -> ctll::push<ctll::anything, create_number, make_back_reference>;
static constexpr auto rule(f, ctll::term<'p'>) -> ctll::push<ctll::anything, ctll::term<'\x7B'>, property_name, ctll::term<'\x7D'>, make_property>;
static constexpr auto rule(f, ctll::term<'P'>) -> ctll::push<ctll::anything, ctll::term<'\x7B'>, property_name, ctll::term<'\x7D'>, make_property_negative>;
static constexpr auto rule(f, ctll::term<'u'>) -> ctll::push<ctll::anything, k, range>;
static constexpr auto rule(f, ctll::term<'x'>) -> ctll::push<ctll::anything, l, range>;
static constexpr auto rule(f, ctll::set<'$','\x28','\x29','*','+','.','?','[','\\',']','^','\x7B','|','\x7D'>) -> ctll::push<ctll::anything, push_character>;
static constexpr auto rule(f, ctll::term<'a'>) -> ctll::push<ctll::anything, push_character_alarm, range>;
static constexpr auto rule(f, ctll::term<'e'>) -> ctll::push<ctll::anything, push_character_escape, range>;
static constexpr auto rule(f, ctll::term<'f'>) -> ctll::push<ctll::anything, push_character_formfeed, range>;
static constexpr auto rule(f, ctll::term<'n'>) -> ctll::push<ctll::anything, push_character_newline, range>;
static constexpr auto rule(f, ctll::term<'0'>) -> ctll::push<ctll::anything, push_character_null, range>;
static constexpr auto rule(f, ctll::term<'r'>) -> ctll::push<ctll::anything, push_character_return_carriage, range>;
static constexpr auto rule(f, ctll::term<'t'>) -> ctll::push<ctll::anything, push_character_tab, range>;
static constexpr auto rule(f, ctll::term<'-'>) -> ctll::push<ctll::anything, q>;
static constexpr auto rule(g, ctll::term<'s'>) -> ctll::push<ctll::anything, ctll::term<'c'>, ctll::term<'i'>, ctll::term<'i'>, class_named_ascii>;
static constexpr auto rule(g, ctll::term<'l'>) -> ctll::push<ctll::anything, o>;
static constexpr auto rule(h, ctll::term<'r'>) -> ctll::push<ctll::anything, ctll::term<'i'>, ctll::term<'n'>, ctll::term<'t'>, class_named_print>;
static constexpr auto rule(h, ctll::term<'u'>) -> ctll::push<ctll::anything, ctll::term<'n'>, ctll::term<'c'>, ctll::term<'t'>, class_named_punct>;
static constexpr auto rule(hexdec_repeat, ctll::term<'\x7D'>) -> ctll::epsilon;
static constexpr auto rule(hexdec_repeat, ctll::set<'0','A','B','C','D','E','F','a','b','c','d','e','f','1','2','3','4','5','6','7','8','9'>) -> ctll::push<ctll::anything, push_hexdec, hexdec_repeat>;
static constexpr auto rule(i, ctll::term<'^'>) -> ctll::push<ctll::anything, class_named_name, negate_class_named, ctll::term<':'>, ctll::term<']'>>;
static constexpr auto rule(i, ctll::term<'x'>) -> ctll::push<ctll::anything, ctll::term<'d'>, ctll::term<'i'>, ctll::term<'g'>, ctll::term<'i'>, ctll::term<'t'>, class_named_xdigit, ctll::term<':'>, ctll::term<']'>>;
static constexpr auto rule(i, ctll::term<'d'>) -> ctll::push<ctll::anything, ctll::term<'i'>, ctll::term<'g'>, ctll::term<'i'>, ctll::term<'t'>, class_named_digit, ctll::term<':'>, ctll::term<']'>>;
static constexpr auto rule(i, ctll::term<'b'>) -> ctll::push<ctll::anything, ctll::term<'l'>, ctll::term<'a'>, ctll::term<'n'>, ctll::term<'k'>, class_named_blank, ctll::term<':'>, ctll::term<']'>>;
static constexpr auto rule(i, ctll::term<'c'>) -> ctll::push<ctll::anything, ctll::term<'n'>, ctll::term<'t'>, ctll::term<'r'>, ctll::term<'l'>, class_named_cntrl, ctll::term<':'>, ctll::term<']'>>;
static constexpr auto rule(i, ctll::term<'w'>) -> ctll::push<ctll::anything, ctll::term<'o'>, ctll::term<'r'>, ctll::term<'d'>, class_named_word, ctll::term<':'>, ctll::term<']'>>;
static constexpr auto rule(i, ctll::term<'l'>) -> ctll::push<ctll::anything, ctll::term<'o'>, ctll::term<'w'>, ctll::term<'e'>, ctll::term<'r'>, class_named_lower, ctll::term<':'>, ctll::term<']'>>;
static constexpr auto rule(i, ctll::term<'s'>) -> ctll::push<ctll::anything, ctll::term<'p'>, ctll::term<'a'>, ctll::term<'c'>, ctll::term<'e'>, class_named_space, ctll::term<':'>, ctll::term<']'>>;
static constexpr auto rule(i, ctll::term<'u'>) -> ctll::push<ctll::anything, ctll::term<'p'>, ctll::term<'p'>, ctll::term<'e'>, ctll::term<'r'>, class_named_upper, ctll::term<':'>, ctll::term<']'>>;
static constexpr auto rule(i, ctll::term<'g'>) -> ctll::push<ctll::anything, ctll::term<'r'>, ctll::term<'a'>, ctll::term<'p'>, ctll::term<'h'>, class_named_graph, ctll::term<':'>, ctll::term<']'>>;
static constexpr auto rule(i, ctll::term<'a'>) -> ctll::push<ctll::anything, g, ctll::term<':'>, ctll::term<']'>>;
static constexpr auto rule(i, ctll::term<'p'>) -> ctll::push<ctll::anything, h, ctll::term<':'>, ctll::term<']'>>;
static constexpr auto rule(j, ctll::term<'\\'>) -> ctll::push<ctll::anything, backslash_range, make_range>;
static constexpr auto rule(j, ctll::set<'!','$','\x28','\x29','*','+',',','.',':','<','=','>','?','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','0','s','t','u','v','w','x','y','z','\x7B','\x7D','1','2','3','4','5','6','7','8','9'>) -> ctll::push<ctll::anything, push_character, make_range>;
static constexpr auto rule(j, _others) -> ctll::push<ctll::anything, push_character, make_range>;
static constexpr auto rule(j, ctll::set<'-','[',']','^','|'>) -> ctll::reject;
static constexpr auto rule(k, ctll::term<'\x7B'>) -> ctll::push<create_hexdec, ctll::anything, ctll::set<'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F','a','b','c','d','e','f'>, push_hexdec, hexdec_repeat, ctll::term<'\x7D'>, finish_hexdec>;
static constexpr auto rule(k, ctll::set<'0','A','B','C','D','E','F','a','b','c','d','e','f','1','2','3','4','5','6','7','8','9'>) -> ctll::push<create_hexdec, ctll::anything, push_hexdec, ctll::set<'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F','a','b','c','d','e','f'>, push_hexdec, ctll::set<'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F','a','b','c','d','e','f'>, push_hexdec, ctll::set<'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F','a','b','c','d','e','f'>, push_hexdec, finish_hexdec>;
static constexpr auto rule(l, ctll::term<'\x7B'>) -> ctll::push<create_hexdec, ctll::anything, ctll::set<'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F','a','b','c','d','e','f'>, push_hexdec, hexdec_repeat, ctll::term<'\x7D'>, finish_hexdec>;
static constexpr auto rule(l, ctll::set<'0','A','B','C','D','E','F','a','b','c','d','e','f','1','2','3','4','5','6','7','8','9'>) -> ctll::push<create_hexdec, ctll::anything, push_hexdec, ctll::set<'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F','a','b','c','d','e','f'>, push_hexdec, finish_hexdec>;
static constexpr auto rule(m, ctll::set<'0','1','2','3','4','5','6','7','8','9'>) -> ctll::push<ctll::anything, create_number, number2, ctll::term<'\x7D'>, make_back_reference>;
static constexpr auto rule(m, ctll::term<'-'>) -> ctll::push<ctll::anything, number, ctll::term<'\x7D'>, make_relative_back_reference>;
static constexpr auto rule(m, ctll::set<'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'>) -> ctll::push<ctll::anything, push_name, block_name2, ctll::term<'\x7D'>, make_back_reference>;
static constexpr auto rule(mod, ctll::set<'!','$','\x28','\x29',',','-','.',':','<','=','>','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'>) -> ctll::epsilon;
static constexpr auto rule(mod, ctll::epsilon) -> ctll::epsilon;
static constexpr auto rule(mod, _others) -> ctll::epsilon;
static constexpr auto rule(mod, ctll::term<'?'>) -> ctll::push<ctll::anything, make_lazy>;
static constexpr auto rule(mod, ctll::term<'+'>) -> ctll::push<ctll::anything, make_possessive>;
static constexpr auto rule(mod, ctll::set<'*','\x7B','\x7D'>) -> ctll::reject;
static constexpr auto rule(mod_opt, ctll::set<'!','$','\x28','\x29',',','-','.',':','<','=','>','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'>) -> ctll::epsilon;
static constexpr auto rule(mod_opt, ctll::epsilon) -> ctll::epsilon;
static constexpr auto rule(mod_opt, _others) -> ctll::epsilon;
static constexpr auto rule(mod_opt, ctll::term<'?'>) -> ctll::push<ctll::anything, make_lazy>;
static constexpr auto rule(mod_opt, ctll::set<'*','+','\x7B','\x7D'>) -> ctll::reject;
static constexpr auto rule(n, ctll::set<'0','1','2','3','4','5','6','7','8','9'>) -> ctll::push<ctll::anything, create_number, number2, repeat_ab, ctll::term<'\x7D'>, mod>;
static constexpr auto rule(n, ctll::term<'\x7D'>) -> ctll::push<repeat_at_least, ctll::anything, mod>;
static constexpr auto rule(number2, ctll::set<',','\x7D'>) -> ctll::epsilon;
static constexpr auto rule(number2, ctll::set<'0','1','2','3','4','5','6','7','8','9'>) -> ctll::push<ctll::anything, push_number, number2>;
static constexpr auto rule(number, ctll::set<'0','1','2','3','4','5','6','7','8','9'>) -> ctll::push<ctll::anything, create_number, number2>;
static constexpr auto rule(o, ctll::term<'p'>) -> ctll::push<ctll::anything, ctll::term<'h'>, ctll::term<'a'>, class_named_alpha>;
static constexpr auto rule(o, ctll::term<'n'>) -> ctll::push<ctll::anything, ctll::term<'u'>, ctll::term<'m'>, class_named_alnum>;
static constexpr auto rule(p, ctll::term<'-'>) -> ctll::push<push_character, ctll::anything, j>;
static constexpr auto rule(p, ctll::set<'!','$','\x28','\x29','*','+',',','.',':','<','=','>','?','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','\x7B','\x7D','0','1','2','3','4','5','6','7','8','9'>) -> ctll::push<push_character>;
static constexpr auto rule(p, ctll::epsilon) -> ctll::push<push_character>;
static constexpr auto rule(p, _others) -> ctll::push<push_character>;
static constexpr auto rule(p, ctll::term<'|'>) -> ctll::reject;
static constexpr auto rule(property_name2, ctll::term<'\x7D'>) -> ctll::epsilon;
static constexpr auto rule(property_name2, ctll::term<'='>) -> ctll::push<ctll::anything, property_value>;
static constexpr auto rule(property_name2, ctll::set<'0','.','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','1','2','3','4','5','6','7','8','9'>) -> ctll::push<ctll::anything, push_property_name, property_name2>;
static constexpr auto rule(property_name, ctll::set<'0','.','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','1','2','3','4','5','6','7','8','9'>) -> ctll::push<ctll::anything, push_property_name, property_name2>;
static constexpr auto rule(property_value2, ctll::term<'\x7D'>) -> ctll::epsilon;
static constexpr auto rule(property_value2, ctll::set<'0','.','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','1','2','3','4','5','6','7','8','9'>) -> ctll::push<ctll::anything, push_property_value, property_value2>;
static constexpr auto rule(property_value, ctll::set<'0','.','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','1','2','3','4','5','6','7','8','9'>) -> ctll::push<ctll::anything, push_property_value, property_value2>;
static constexpr auto rule(q, ctll::term<'-'>) -> ctll::push<push_character, ctll::anything, j>;
static constexpr auto rule(q, ctll::set<'!','$','\x28','\x29','*','+',',','.',':','<','=','>','?','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','\x7B','\x7D','0','1','2','3','4','5','6','7','8','9'>) -> ctll::push<push_character>;
static constexpr auto rule(q, ctll::epsilon) -> ctll::push<push_character>;
static constexpr auto rule(q, _others) -> ctll::push<push_character>;
static constexpr auto rule(q, ctll::term<'|'>) -> ctll::reject;
static constexpr auto rule(range, ctll::set<'!','$','\x28','\x29','*','+',',','.',':','<','=','>','?','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','\x7B','\x7D','0','1','2','3','4','5','6','7','8','9'>) -> ctll::epsilon;
static constexpr auto rule(range, ctll::epsilon) -> ctll::epsilon;
static constexpr auto rule(range, _others) -> ctll::epsilon;
static constexpr auto rule(range, ctll::term<'-'>) -> ctll::push<ctll::anything, j>;
static constexpr auto rule(range, ctll::term<'|'>) -> ctll::reject;
static constexpr auto rule(repeat, ctll::set<'!','$','\x28','\x29',',','-','.',':','<','=','>','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'>) -> ctll::epsilon;
static constexpr auto rule(repeat, ctll::epsilon) -> ctll::epsilon;
static constexpr auto rule(repeat, _others) -> ctll::epsilon;
static constexpr auto rule(repeat, ctll::term<'?'>) -> ctll::push<ctll::anything, make_optional, mod_opt>;
static constexpr auto rule(repeat, ctll::term<'\x7B'>) -> ctll::push<ctll::anything, number, b>;
static constexpr auto rule(repeat, ctll::term<'+'>) -> ctll::push<ctll::anything, repeat_plus, mod>;
static constexpr auto rule(repeat, ctll::term<'*'>) -> ctll::push<ctll::anything, repeat_star, mod>;
static constexpr auto rule(repeat, ctll::term<'\x7D'>) -> ctll::reject;
static constexpr auto rule(set2a, ctll::term<']'>) -> ctll::epsilon;
static constexpr auto rule(set2a, ctll::term<'['>) -> ctll::push<ctll::anything, ctll::term<':'>, i, range, set_start, set2b>;
static constexpr auto rule(set2a, ctll::term<'\\'>) -> ctll::push<ctll::anything, f, set_start, set2b>;
static constexpr auto rule(set2a, ctll::set<'!','$','\x28','\x29','*','+',',','.',':','<','=','>','?','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','0','s','t','u','v','w','x','y','z','\x7B','\x7D','1','2','3','4','5','6','7','8','9'>) -> ctll::push<ctll::anything, push_character, range, set_start, set2b>;
static constexpr auto rule(set2a, _others) -> ctll::push<ctll::anything, push_character, range, set_start, set2b>;
static constexpr auto rule(set2a, ctll::set<'-','|'>) -> ctll::reject;
static constexpr auto rule(set2b, ctll::term<']'>) -> ctll::epsilon;
static constexpr auto rule(set2b, ctll::term<'['>) -> ctll::push<ctll::anything, ctll::term<':'>, i, range, set_combine, set2b>;
static constexpr auto rule(set2b, ctll::term<'\\'>) -> ctll::push<ctll::anything, f, set_combine, set2b>;
static constexpr auto rule(set2b, ctll::set<'!','$','\x28','\x29','*','+',',','.',':','<','=','>','?','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','0','s','t','u','v','w','x','y','z','\x7B','\x7D','1','2','3','4','5','6','7','8','9'>) -> ctll::push<ctll::anything, push_character, range, set_combine, set2b>;
static constexpr auto rule(set2b, _others) -> ctll::push<ctll::anything, push_character, range, set_combine, set2b>;
static constexpr auto rule(set2b, ctll::set<'-','|'>) -> ctll::reject;
static constexpr auto rule(string2, ctll::set<'\x29','|'>) -> ctll::epsilon;
static constexpr auto rule(string2, ctll::epsilon) -> ctll::epsilon;
static constexpr auto rule(string2, ctll::term<'\\'>) -> ctll::push<ctll::anything, backslash, repeat, string2, make_sequence>;
static constexpr auto rule(string2, ctll::term<'['>) -> ctll::push<ctll::anything, c, repeat, string2, make_sequence>;
static constexpr auto rule(string2, ctll::term<'\x28'>) -> ctll::push<ctll::anything, prepare_capture, block, repeat, string2, make_sequence>;
static constexpr auto rule(string2, ctll::term<'^'>) -> ctll::push<ctll::anything, push_assert_begin, repeat, string2, make_sequence>;
static constexpr auto rule(string2, ctll::term<'$'>) -> ctll::push<ctll::anything, push_assert_end, repeat, string2, make_sequence>;
static constexpr auto rule(string2, ctll::set<'!',',','-',':','<','=','>','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T',']','_','0','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','1','2','3','4','5','6','7','8','9'>) -> ctll::push<ctll::anything, push_character, repeat, string2, make_sequence>;
static constexpr auto rule(string2, _others) -> ctll::push<ctll::anything, push_character, repeat, string2, make_sequence>;
static constexpr auto rule(string2, ctll::term<'.'>) -> ctll::push<ctll::anything, push_character_anything, repeat, string2, make_sequence>;
static constexpr auto rule(string2, ctll::set<'*','+','?','\x7B','\x7D'>) -> ctll::reject;
};
}
#endif //CTRE__PCRE__HPP
#ifndef CTRE__ATOMS__HPP
#define CTRE__ATOMS__HPP
#include <cstdint>
namespace ctre {
// special helpers for matching
struct accept { };
struct reject { };
struct start_mark { };
struct end_mark { };
struct end_cycle_mark { };
struct end_lookahead_mark { };
template <size_t Id> struct numeric_mark { };
// actual AST of regexp
template <auto... Str> struct string { };
template <typename... Opts> struct select { };
template <typename... Content> struct optional { };
template <typename... Content> struct lazy_optional { };
template <typename... Content> struct sequence { };
struct empty { };
template <typename... Content> struct plus { };
template <typename... Content> struct star { };
template <size_t a, size_t b, typename... Content> struct repeat { };
template <typename... Content> struct lazy_plus { };
template <typename... Content> struct lazy_star { };
template <size_t a, size_t b, typename... Content> struct lazy_repeat { };
template <typename... Content> struct possessive_plus { };
template <typename... Content> struct possessive_star { };
template <size_t a, size_t b, typename... Content> struct possessive_repeat { };
template <size_t Index, typename... Content> struct capture { };
template <size_t Index, typename Name, typename... Content> struct capture_with_name { };
template <size_t Index> struct back_reference { };
template <typename Name> struct back_reference_with_name { };
template <typename Type> struct look_start { };
template <typename... Content> struct lookahead_positive { };
template <typename... Content> struct lookahead_negative { };
struct assert_begin { };
struct assert_end { };
}
#endif
#ifndef CTRE__ATOMS_CHARACTERS__HPP
#define CTRE__ATOMS_CHARACTERS__HPP
#ifndef CTRE__UTILITY__HPP
#define CTRE__UTILITY__HPP
#ifdef _MSC_VER
#define CTRE_FORCE_INLINE __forceinline
#define CTRE_FLATTEN
#else
#define CTRE_FORCE_INLINE inline __attribute__((always_inline))
#define CTRE_FLATTEN __attribute__((flatten))
#endif
#endif
#include <cstdint>
namespace ctre {
// sfinae check for types here
template <typename T> class MatchesCharacter {
template <typename Y, typename CharT> static auto test(CharT c) -> decltype(Y::match_char(c), std::true_type());
template <typename> static auto test(...) -> std::false_type;
public:
template <typename CharT> static inline constexpr bool value = decltype(test<T>(std::declval<CharT>()))();
};
template <auto V> struct character {
template <typename CharT> CTRE_FORCE_INLINE static constexpr bool match_char(CharT value) noexcept {
return value == V;
}
};
struct any {
template <typename CharT> CTRE_FORCE_INLINE static constexpr bool match_char(CharT) noexcept { return true; }
};
template <typename... Content> struct negative_set {
template <typename CharT> inline static constexpr bool match_char(CharT value) noexcept {
return !(Content::match_char(value) || ... || false);
}
};
template <typename... Content> struct set {
template <typename CharT> inline static constexpr bool match_char(CharT value) noexcept {
return (Content::match_char(value) || ... || false);
}
};
template <auto... Cs> struct enumeration : set<character<Cs>...> { };
template <typename... Content> struct negate {
template <typename CharT> inline static constexpr bool match_char(CharT value) noexcept {
return !(Content::match_char(value) || ... || false);
}
};
template <auto A, auto B> struct char_range {
template <typename CharT> CTRE_FORCE_INLINE static constexpr bool match_char(CharT value) noexcept {
return (value >= A) && (value <= B);
}
};
using word_chars = set<char_range<'A','Z'>, char_range<'a','z'>, char_range<'0','9'>, character<'_'> >;
using space_chars = enumeration<' ', '\t', '\n', '\v', '\f', '\r'>;
using alphanum_chars = set<char_range<'A','Z'>, char_range<'a','z'>, char_range<'0','9'> >;
using alpha_chars = set<char_range<'A','Z'>, char_range<'a','z'> >;
using xdigit_chars = set<char_range<'A','F'>, char_range<'a','f'>, char_range<'0','9'> >;
using punct_chars
= enumeration<'!', '"', '#', '$', '%', '&', '\'', '(', ')', '*', ',', '-',
'.', '/', ':', ';', '<', '=', '>', '?', '@', '[', '\\', ']',
'^', '_', '`', '{', '|', '}', '~'>;
using digit_chars = char_range<'0','9'>;
using ascii_chars = char_range<'\x00','\x7F'>;
}
#endif
#ifndef CTRE__ATOMS_UNICODE__HPP
#define CTRE__ATOMS_UNICODE__HPP
// master branch is not including unicode db (for now)
// #include "../unicode-db/unicode.hpp"
#include <array>
namespace ctre {
// properties name & value
template <auto... Str> struct property_name { };
template <auto... Str> struct property_value { };
template <size_t Sz> constexpr std::string_view get_string_view(const std::array<char, Sz> & arr) noexcept {
return std::string_view(arr.data(), arr.size());
}
// basic support for binary and type-value properties
template <auto Name> struct binary_property;
template <auto Name, auto Value> struct property;
// unicode TS#18 level 1.2 general_category
//template <uni::__binary_prop Property> struct binary_property<Property> {
// template <typename CharT> inline static constexpr bool match_char(CharT) noexcept {
// return uni::__get_binary_prop<Property>(c);
// }
//};
// unicode TS#18 level 1.2.2
enum class property_type {
script, script_extension, age, block, unknown
};
// unicode TS#18 level 1.2.2
//template <uni::script Script> struct binary_property<Script> {
// template <typename CharT> inline static constexpr bool match_char(CharT) noexcept {
// return uni::cp_script(c) == Script;
// }
//};
//
//template <uni::script Script> struct property<property_type::script_extension, Script> {
// template <typename CharT> inline static constexpr bool match_char(CharT c) noexcept {
// for (uni::script sc: uni::cp_script_extensions(c)) {
// if (sc == Script) return true;
// }
// return false;
// }
//};
//template <uni::version Age> struct binary_property<Age> {
// template <typename CharT> inline static constexpr bool match_char(CharT c) noexcept {
// return uni::cp_age(c) <= Age;
// }
//};
//
//template <uni::block Block> struct binary_property<Block> {
// template <typename CharT> inline static constexpr bool match_char(CharT c) noexcept {
// return uni::cp_block(c) == Block;
// }
//};
// nonbinary properties
constexpr property_type property_type_from_name(std::string_view) noexcept {
return property_type::unknown;
//using namespace std::string_view_literals;
//if (uni::__pronamecomp(str, "script"sv) == 0 || uni::__pronamecomp(str, "sc"sv) == 0) {
// return property_type::script;
//} else if (uni::__pronamecomp(str, "script_extension"sv) == 0 || uni::__pronamecomp(str, "scx"sv) == 0) {
// return property_type::script_extension;
//} else if (uni::__pronamecomp(str, "age"sv) == 0) {
// return property_type::age;
//} else if (uni::__pronamecomp(str, "block"sv) == 0) {
// return property_type::block;
//} else {
// return property_type::unknown;
//}
}
template <property_type Property> struct property_type_builder {
template <auto... Value> static constexpr auto get() {
return ctll::reject{};
}
};
template <auto... Name> struct property_builder {
static constexpr std::array<char, sizeof...(Name)> name{static_cast<char>(Name)...};
static constexpr property_type type = property_type_from_name(get_string_view(name));
using helper = property_type_builder<type>;
template <auto... Value> static constexpr auto get() {
return helper::template get<Value...>();
}
};
// unicode TS#18 level 1.2.2 script support
//template <> struct property_type_builder<property_type::script> {
// template <auto... Value> static constexpr auto get() {
// constexpr std::array<char, sizeof...(Value)> value{Value...};
// constexpr auto sc = uni::__script_from_string(get_string_view(value));
// if constexpr (sc == uni::script::unknown) {
// return ctll::reject{};
// } else {
// return binary_property<sc>();
// }
// }
//};
//
//template <> struct property_type_builder<property_type::script_extension> {
// template <auto... Value> static constexpr auto get() {
// constexpr std::array<char, sizeof...(Value)> value{Value...};
// constexpr auto sc = uni::__script_from_string(get_string_view(value));
// if constexpr (sc == uni::script::unknown) {
// return ctll::reject{};
// } else {
// return property<property_type::script_extension, sc>();
// }
// }
//};
//
//template <> struct property_type_builder<property_type::age> {
// template <auto... Value> static constexpr auto get() {
// constexpr std::array<char, sizeof...(Value)> value{Value...};
// constexpr auto age = uni::__age_from_string(get_string_view(value));
// if constexpr (age == uni::version::unassigned) {
// return ctll::reject{};
// } else {
// return binary_property<age>();
// }
// }
//};
//
//template <> struct property_type_builder<property_type::block> {
// template <auto... Value> static constexpr auto get() {
// constexpr std::array<char, sizeof...(Value)> value{Value...};
// constexpr auto block = uni::__block_from_string(get_string_view(value));
// if constexpr (block == uni::block::no_block) {
// return ctll::reject{};
// } else {
// return binary_property<block>();
// }
// }
//};
}
#endif
#ifndef CTRE__ID__HPP
#define CTRE__ID__HPP
#include <type_traits>
namespace ctre {
template <auto... Name> struct id {
static constexpr auto name = ctll::fixed_string<sizeof...(Name)>{{Name...}};
};
template <auto... Name> constexpr auto operator==(id<Name...>, id<Name...>) noexcept -> std::true_type { return {}; }
template <auto... Name1, auto... Name2> constexpr auto operator==(id<Name1...>, id<Name2...>) noexcept -> std::false_type { return {}; }
template <auto... Name, typename T> constexpr auto operator==(id<Name...>, T) noexcept -> std::false_type { return {}; }
}
#endif
#include <cstdint>
#include <limits>
namespace ctre {
template <size_t Counter> struct pcre_parameters {
static constexpr size_t current_counter = Counter;
};
template <typename Stack = ctll::list<>, typename Parameters = pcre_parameters<0>> struct pcre_context {
using stack_type = Stack;
using parameters_type = Parameters;
static constexpr inline auto stack = stack_type();
static constexpr inline auto parameters = parameters_type();
constexpr pcre_context() noexcept { }
constexpr pcre_context(Stack, Parameters) noexcept { }
};
template <typename... Content, typename Parameters> pcre_context(ctll::list<Content...>, Parameters) -> pcre_context<ctll::list<Content...>, Parameters>;
template <size_t Value> struct number { };
template <size_t Id> struct capture_id { };
struct pcre_actions {
// i know it's ugly, but it's more readable
#ifndef CTRE__ACTIONS__ASSERTS__HPP
#define CTRE__ACTIONS__ASSERTS__HPP
// push_assert_begin
template <auto V, typename... Ts, typename Parameters> static constexpr auto apply(pcre::push_assert_begin, ctll::term<V>, pcre_context<ctll::list<Ts...>, Parameters> subject) {
return pcre_context{ctll::push_front(assert_begin(), subject.stack), subject.parameters};
}
// push_assert_end
template <auto V, typename... Ts, typename Parameters> static constexpr auto apply(pcre::push_assert_end, ctll::term<V>, pcre_context<ctll::list<Ts...>, Parameters> subject) {
return pcre_context{ctll::push_front(assert_end(), subject.stack), subject.parameters};
}
#endif
#ifndef CTRE__ACTIONS__BACKREFERENCE__HPP
#define CTRE__ACTIONS__BACKREFERENCE__HPP
// backreference with name
template <auto... Str, auto V, typename... Ts, size_t Counter> static constexpr auto apply(pcre::make_back_reference, ctll::term<V>, pcre_context<ctll::list<id<Str...>, Ts...>, pcre_parameters<Counter>>) {
return pcre_context{ctll::push_front(back_reference_with_name<id<Str...>>(), ctll::list<Ts...>()), pcre_parameters<Counter>()};
}
// with just a number
template <auto V, size_t Id, typename... Ts, size_t Counter> static constexpr auto apply(pcre::make_back_reference, ctll::term<V>, pcre_context<ctll::list<number<Id>, Ts...>, pcre_parameters<Counter>>) {
// if we are looking outside of existing list of Ids ... reject input during parsing
if constexpr (Counter < Id) {
return ctll::reject{};
} else {
return pcre_context{ctll::push_front(back_reference<Id>(), ctll::list<Ts...>()), pcre_parameters<Counter>()};
}
}
// relative backreference
template <auto V, size_t Id, typename... Ts, size_t Counter> static constexpr auto apply(pcre::make_relative_back_reference, ctll::term<V>, [[maybe_unused]] pcre_context<ctll::list<number<Id>, Ts...>, pcre_parameters<Counter>>) {
// if we are looking outside of existing list of Ids ... reject input during parsing
if constexpr (Counter < Id) {
return ctll::reject{};
} else {
constexpr size_t absolute_id = (Counter + 1) - Id;
return pcre_context{ctll::push_front(back_reference<absolute_id>(), ctll::list<Ts...>()), pcre_parameters<Counter>()};
}
}
#endif
#ifndef CTRE__ACTIONS__CAPTURE__HPP
#define CTRE__ACTIONS__CAPTURE__HPP
// prepare_capture
template <auto V, typename... Ts, size_t Counter> static constexpr auto apply(pcre::prepare_capture, ctll::term<V>, pcre_context<ctll::list<Ts...>, pcre_parameters<Counter>>) {
return pcre_context{ctll::push_front(capture_id<Counter+1>(), ctll::list<Ts...>()), pcre_parameters<Counter+1>()};
}
// reset_capture
template <auto V, typename... Ts, size_t Id, size_t Counter> static constexpr auto apply(pcre::reset_capture, ctll::term<V>, pcre_context<ctll::list<capture_id<Id>, Ts...>, pcre_parameters<Counter>>) {
return pcre_context{ctll::list<Ts...>(), pcre_parameters<Counter-1>()};
}
// capture
template <auto V, typename A, size_t Id, typename... Ts, size_t Counter> static constexpr auto apply(pcre::make_capture, ctll::term<V>, pcre_context<ctll::list<A, capture_id<Id>, Ts...>, pcre_parameters<Counter>>) {
return pcre_context{ctll::push_front(capture<Id, A>(), ctll::list<Ts...>()), pcre_parameters<Counter>()};
}
// capture (sequence)
template <auto V, typename... Content, size_t Id, typename... Ts, size_t Counter> static constexpr auto apply(pcre::make_capture, ctll::term<V>, pcre_context<ctll::list<sequence<Content...>, capture_id<Id>, Ts...>, pcre_parameters<Counter>>) {
return pcre_context{ctll::push_front(capture<Id, Content...>(), ctll::list<Ts...>()), pcre_parameters<Counter>()};
}
// push_name
template <auto V, typename... Ts, typename Parameters> static constexpr auto apply(pcre::push_name, ctll::term<V>, pcre_context<ctll::list<Ts...>, Parameters> subject) {
return pcre_context{ctll::push_front(id<V>(), subject.stack), subject.parameters};
}
// push_name (concat)
template <auto... Str, auto V, typename... Ts, typename Parameters> static constexpr auto apply(pcre::push_name, ctll::term<V>, pcre_context<ctll::list<id<Str...>, Ts...>, Parameters> subject) {
return pcre_context{ctll::push_front(id<Str..., V>(), ctll::list<Ts...>()), subject.parameters};
}
// capture with name
template <auto... Str, auto V, typename A, size_t Id, typename... Ts, size_t Counter> static constexpr auto apply(pcre::make_capture_with_name, ctll::term<V>, pcre_context<ctll::list<A, id<Str...>, capture_id<Id>, Ts...>, pcre_parameters<Counter>>) {
return pcre_context{ctll::push_front(capture_with_name<Id, id<Str...>, A>(), ctll::list<Ts...>()), pcre_parameters<Counter>()};
}
// capture with name (sequence)
template <auto... Str, auto V, typename... Content, size_t Id, typename... Ts, size_t Counter> static constexpr auto apply(pcre::make_capture_with_name, ctll::term<V>, pcre_context<ctll::list<sequence<Content...>, id<Str...>, capture_id<Id>, Ts...>, pcre_parameters<Counter>>) {
return pcre_context{ctll::push_front(capture_with_name<Id, id<Str...>, Content...>(), ctll::list<Ts...>()), pcre_parameters<Counter>()};
}
#endif
#ifndef CTRE__ACTIONS__CHARACTERS__HPP
#define CTRE__ACTIONS__CHARACTERS__HPP
// push character
template <auto V, typename... Ts, typename Parameters> static constexpr auto apply(pcre::push_character, ctll::term<V>, pcre_context<ctll::list<Ts...>, Parameters> subject) {
return pcre_context{ctll::push_front(character<V>(), subject.stack), subject.parameters};
}
// push_any_character
template <auto V, typename... Ts, typename Parameters> static constexpr auto apply(pcre::push_character_anything, ctll::term<V>, pcre_context<ctll::list<Ts...>, Parameters> subject) {
return pcre_context{ctll::push_front(any(), subject.stack), subject.parameters};
}
// character_alarm
template <auto V, typename... Ts, typename Parameters> static constexpr auto apply(pcre::push_character_alarm, ctll::term<V>, pcre_context<ctll::list<Ts...>, Parameters> subject) {
return pcre_context{ctll::push_front(character<'\x07'>(), subject.stack), subject.parameters};
}
// character_escape
template <auto V, typename... Ts, typename Parameters> static constexpr auto apply(pcre::push_character_escape, ctll::term<V>, pcre_context<ctll::list<Ts...>, Parameters> subject) {
return pcre_context{ctll::push_front(character<'\x14'>(), subject.stack), subject.parameters};
}
// character_formfeed
template <auto V, typename... Ts, typename Parameters> static constexpr auto apply(pcre::push_character_formfeed, ctll::term<V>, pcre_context<ctll::list<Ts...>, Parameters> subject) {
return pcre_context{ctll::push_front(character<'\x0C'>(), subject.stack), subject.parameters};
}
// push_character_newline
template <auto V, typename... Ts, typename Parameters> static constexpr auto apply(pcre::push_character_newline, ctll::term<V>, pcre_context<ctll::list<Ts...>, Parameters> subject) {
return pcre_context{ctll::push_front(character<'\x0A'>(), subject.stack), subject.parameters};
}
// push_character_null
template <auto V, typename... Ts, typename Parameters> static constexpr auto apply(pcre::push_character_null, ctll::term<V>, pcre_context<ctll::list<Ts...>, Parameters> subject) {
return pcre_context{ctll::push_front(character<'\0'>(), subject.stack), subject.parameters};
}
// push_character_return_carriage
template <auto V, typename... Ts, typename Parameters> static constexpr auto apply(pcre::push_character_return_carriage, ctll::term<V>, pcre_context<ctll::list<Ts...>, Parameters> subject) {
return pcre_context{ctll::push_front(character<'\x0D'>(), subject.stack), subject.parameters};
}
// push_character_tab
template <auto V, typename... Ts, typename Parameters> static constexpr auto apply(pcre::push_character_tab, ctll::term<V>, pcre_context<ctll::list<Ts...>, Parameters> subject) {
return pcre_context{ctll::push_front(character<'\x09'>(), subject.stack), subject.parameters};
}
#endif
#ifndef CTRE__ACTIONS__CLASS__HPP
#define CTRE__ACTIONS__CLASS__HPP
// class_digit
template <auto V, typename... Ts, typename Parameters> static constexpr auto apply(pcre::class_digit, ctll::term<V>, pcre_context<ctll::list<Ts...>, Parameters> subject) {
return pcre_context{ctll::push_front(ctre::set<ctre::digit_chars>(), subject.stack), subject.parameters};
}
// class_non_digit
template <auto V, typename... Ts, typename Parameters> static constexpr auto apply(pcre::class_nondigit, ctll::term<V>, pcre_context<ctll::list<Ts...>, Parameters> subject) {
return pcre_context{ctll::push_front(ctre::negative_set<ctre::digit_chars>(), subject.stack), subject.parameters};
}
// class_space
template <auto V, typename... Ts, typename Parameters> static constexpr auto apply(pcre::class_space, ctll::term<V>, pcre_context<ctll::list<Ts...>, Parameters> subject) {
return pcre_context{ctll::push_front(ctre::set<ctre::space_chars>(), subject.stack), subject.parameters};
}
// class_nonspace
template <auto V, typename... Ts, typename Parameters> static constexpr auto apply(pcre::class_nonspace, ctll::term<V>, pcre_context<ctll::list<Ts...>, Parameters> subject) {
return pcre_context{ctll::push_front(ctre::negative_set<ctre::space_chars>(), subject.stack), subject.parameters};
}
// class_word
template <auto V, typename... Ts, typename Parameters> static constexpr auto apply(pcre::class_word, ctll::term<V>, pcre_context<ctll::list<Ts...>, Parameters> subject) {
return pcre_context{ctll::push_front(ctre::set<ctre::word_chars>(), subject.stack), subject.parameters};
}
// class_nonword
template <auto V, typename... Ts, typename Parameters> static constexpr auto apply(pcre::class_nonword, ctll::term<V>, pcre_context<ctll::list<Ts...>, Parameters> subject) {
return pcre_context{ctll::push_front(ctre::negative_set<ctre::word_chars>(), subject.stack), subject.parameters};
}
// class_nonnewline
template <auto V, typename... Ts, typename Parameters> static constexpr auto apply(pcre::class_nonnewline, ctll::term<V>, pcre_context<ctll::list<Ts...>, Parameters> subject) {
return pcre_context{ctll::push_front(ctre::negative_set<character<'\n'>>(), subject.stack), subject.parameters};
}
#endif
#ifndef CTRE__ACTIONS__HEXDEC__HPP
#define CTRE__ACTIONS__HEXDEC__HPP
// hexdec character support (seed)
template <auto V, typename... Ts, typename Parameters> static constexpr auto apply(pcre::create_hexdec, ctll::term<V>, pcre_context<ctll::list<Ts...>, Parameters> subject) {
return pcre_context{ctll::push_front(number<0ull>(), subject.stack), subject.parameters};
}
// hexdec character support (push value)
template <auto V, size_t N, typename... Ts, typename Parameters> static constexpr auto apply(pcre::push_hexdec, ctll::term<V>, pcre_context<ctll::list<number<N>, Ts...>, Parameters> subject) {
constexpr auto previous = N << 4ull;
if constexpr (V >= 'a' && V <= 'f') {
return pcre_context{ctll::push_front(number<(previous + (V - 'a' + 10))>(), ctll::list<Ts...>()), subject.parameters};
} else if constexpr (V >= 'A' && V <= 'F') {
return pcre_context{ctll::push_front(number<(previous + (V - 'A' + 10))>(), ctll::list<Ts...>()), subject.parameters};
} else {
return pcre_context{ctll::push_front(number<(previous + (V - '0'))>(), ctll::list<Ts...>()), subject.parameters};
}
}
// hexdec character support (convert to character)
template <auto V, size_t N, typename... Ts, typename Parameters> static constexpr auto apply(pcre::finish_hexdec, ctll::term<V>, pcre_context<ctll::list<number<N>, Ts...>, Parameters> subject) {
if constexpr (N <= std::numeric_limits<unsigned char>::max()) {
return pcre_context{ctll::push_front(character<(char)N>(), ctll::list<Ts...>()), subject.parameters};
} else {
return pcre_context{ctll::push_front(character<N>(), ctll::list<Ts...>()), subject.parameters};
}
}
#endif
#ifndef CTRE__ACTIONS__LOOKAHEAD__HPP
#define CTRE__ACTIONS__LOOKAHEAD__HPP
// lookahead positive start
template <auto V, typename... Ts, size_t Counter> static constexpr auto apply(pcre::start_lookahead_positive, ctll::term<V>, pcre_context<ctll::list<Ts...>, pcre_parameters<Counter>>) {
return pcre_context{ctll::list<look_start<lookahead_positive<>>, Ts...>(), pcre_parameters<Counter>()};
}
// lookahead positive end
template <auto V, typename Look, typename... Ts, size_t Counter> static constexpr auto apply(pcre::look_finish, ctll::term<V>, pcre_context<ctll::list<Look, look_start<lookahead_positive<>>, Ts...>, pcre_parameters<Counter>>) {
return pcre_context{ctll::list<lookahead_positive<Look>, Ts...>(), pcre_parameters<Counter>()};
}
// lookahead positive end (sequence)
template <auto V, typename... Look, typename... Ts, size_t Counter> static constexpr auto apply(pcre::look_finish, ctll::term<V>, pcre_context<ctll::list<ctre::sequence<Look...>, look_start<lookahead_positive<>>, Ts...>, pcre_parameters<Counter>>) {
return pcre_context{ctll::list<lookahead_positive<Look...>, Ts...>(), pcre_parameters<Counter>()};
}
// lookahead negative start
template <auto V, typename... Ts, size_t Counter> static constexpr auto apply(pcre::start_lookahead_negative, ctll::term<V>, pcre_context<ctll::list<Ts...>, pcre_parameters<Counter>>) {
return pcre_context{ctll::list<look_start<lookahead_negative<>>, Ts...>(), pcre_parameters<Counter>()};
}
// lookahead negative end
template <auto V, typename Look, typename... Ts, size_t Counter> static constexpr auto apply(pcre::look_finish, ctll::term<V>, pcre_context<ctll::list<Look, look_start<lookahead_negative<>>, Ts...>, pcre_parameters<Counter>>) {
return pcre_context{ctll::list<lookahead_negative<Look>, Ts...>(), pcre_parameters<Counter>()};
}
// lookahead negative end (sequence)
template <auto V, typename... Look, typename... Ts, size_t Counter> static constexpr auto apply(pcre::look_finish, ctll::term<V>, pcre_context<ctll::list<ctre::sequence<Look...>, look_start<lookahead_negative<>>, Ts...>, pcre_parameters<Counter>>) {
return pcre_context{ctll::list<lookahead_negative<Look...>, Ts...>(), pcre_parameters<Counter>()};
}
#endif
#ifndef CTRE__ACTIONS__NAMED_CLASS__HPP
#define CTRE__ACTIONS__NAMED_CLASS__HPP
// class_named_alnum
template <auto V, typename... Ts, typename Parameters> static constexpr auto apply(pcre::class_named_alnum, ctll::term<V>, pcre_context<ctll::list<Ts...>, Parameters> subject) {
return pcre_context{ctll::push_front(ctre::alphanum_chars(), subject.stack), subject.parameters};
}
// class_named_alpha
template <auto V, typename... Ts, typename Parameters> static constexpr auto apply(pcre::class_named_alpha, ctll::term<V>, pcre_context<ctll::list<Ts...>, Parameters> subject) {
return pcre_context{ctll::push_front(ctre::alpha_chars(), subject.stack), subject.parameters};
}
// class_named_digit
template <auto V, typename... Ts, typename Parameters> static constexpr auto apply(pcre::class_named_digit, ctll::term<V>, pcre_context<ctll::list<Ts...>, Parameters> subject) {
return pcre_context{ctll::push_front(ctre::digit_chars(), subject.stack), subject.parameters};
}
// class_named_ascii
template <auto V, typename... Ts, typename Parameters> static constexpr auto apply(pcre::class_named_ascii, ctll::term<V>, pcre_context<ctll::list<Ts...>, Parameters> subject) {
return pcre_context{ctll::push_front(ctre::ascii_chars(), subject.stack), subject.parameters};
}
// class_named_blank
template <auto V, typename... Ts, typename Parameters> static constexpr auto apply(pcre::class_named_blank, ctll::term<V>, pcre_context<ctll::list<Ts...>, Parameters> subject) {
return pcre_context{ctll::push_front(ctre::enumeration<' ','\t'>(), subject.stack), subject.parameters};
}
// class_named_cntrl
template <auto V, typename... Ts, typename Parameters> static constexpr auto apply(pcre::class_named_cntrl, ctll::term<V>, pcre_context<ctll::list<Ts...>, Parameters> subject) {
return pcre_context{ctll::push_front(ctre::set<ctre::char_range<'\x00','\x1F'>, ctre::character<'\x7F'>>(), subject.stack), subject.parameters};
}
// class_named_graph
template <auto V, typename... Ts, typename Parameters> static constexpr auto apply(pcre::class_named_graph, ctll::term<V>, pcre_context<ctll::list<Ts...>, Parameters> subject) {
return pcre_context{ctll::push_front(ctre::char_range<'\x21','\x7E'>(), subject.stack), subject.parameters};
}
// class_named_lower
template <auto V, typename... Ts, typename Parameters> static constexpr auto apply(pcre::class_named_lower, ctll::term<V>, pcre_context<ctll::list<Ts...>, Parameters> subject) {
return pcre_context{ctll::push_front(ctre::char_range<'a','z'>(), subject.stack), subject.parameters};
}
// class_named_upper
template <auto V, typename... Ts, typename Parameters> static constexpr auto apply(pcre::class_named_upper, ctll::term<V>, pcre_context<ctll::list<Ts...>, Parameters> subject) {
return pcre_context{ctll::push_front(ctre::char_range<'A','Z'>(), subject.stack), subject.parameters};
}
// class_named_print
template <auto V, typename... Ts, typename Parameters> static constexpr auto apply(pcre::class_named_print, ctll::term<V>, pcre_context<ctll::list<Ts...>, Parameters> subject) {
return pcre_context{ctll::push_front(ctre::char_range<'\x20','\x7E'>(), subject.stack), subject.parameters};
}
// class_named_space
template <auto V, typename... Ts, typename Parameters> static constexpr auto apply(pcre::class_named_space, ctll::term<V>, pcre_context<ctll::list<Ts...>, Parameters> subject) {
return pcre_context{ctll::push_front(space_chars(), subject.stack), subject.parameters};
}
// class_named_word
template <auto V, typename... Ts, typename Parameters> static constexpr auto apply(pcre::class_named_word, ctll::term<V>, pcre_context<ctll::list<Ts...>, Parameters> subject) {
return pcre_context{ctll::push_front(word_chars(), subject.stack), subject.parameters};
}
// class_named_punct
template <auto V, typename... Ts, typename Parameters> static constexpr auto apply(pcre::class_named_punct, ctll::term<V>, pcre_context<ctll::list<Ts...>, Parameters> subject) {
return pcre_context{ctll::push_front(punct_chars(), subject.stack), subject.parameters};
}
// class_named_xdigit
template <auto V, typename... Ts, typename Parameters> static constexpr auto apply(pcre::class_named_xdigit, ctll::term<V>, pcre_context<ctll::list<Ts...>, Parameters> subject) {
return pcre_context{ctll::push_front(xdigit_chars(), subject.stack), subject.parameters};
}
#endif
#ifndef CTRE__ACTIONS__OPTIONS__HPP
#define CTRE__ACTIONS__OPTIONS__HPP
// empty option for alternate
template <auto V, typename... Ts, typename Parameters> static constexpr auto apply(pcre::push_empty, ctll::term<V>, pcre_context<ctll::list<Ts...>, Parameters> subject) {
return pcre_context{ctll::push_front(empty(), subject.stack), subject.parameters};
}
// empty option for empty regex
template <typename Parameters> static constexpr auto apply(pcre::push_empty, ctll::epsilon, pcre_context<ctll::list<>, Parameters> subject) {
return pcre_context{ctll::push_front(empty(), subject.stack), subject.parameters};
}
// make_alternate (A|B)
template <auto V, typename A, typename B, typename... Ts, typename Parameters> static constexpr auto apply(pcre::make_alternate, ctll::term<V>, pcre_context<ctll::list<B, A, Ts...>, Parameters> subject) {
return pcre_context{ctll::push_front(select<A,B>(), ctll::list<Ts...>()), subject.parameters};
}
// make_alternate (As..)|B => (As..|B)
template <auto V, typename A, typename... Bs, typename... Ts, typename Parameters> static constexpr auto apply(pcre::make_alternate, ctll::term<V>, pcre_context<ctll::list<ctre::select<Bs...>, A, Ts...>, Parameters> subject) {
return pcre_context{ctll::push_front(select<A,Bs...>(), ctll::list<Ts...>()), subject.parameters};
}
// make_optional
template <auto V, typename A, typename... Ts, typename Parameters> static constexpr auto apply(pcre::make_optional, ctll::term<V>, pcre_context<ctll::list<A, Ts...>, Parameters> subject) {
return pcre_context{ctll::push_front(optional<A>(), ctll::list<Ts...>()), subject.parameters};
}
template <auto V, typename... Content, typename... Ts, typename Parameters> static constexpr auto apply(pcre::make_optional, ctll::term<V>, pcre_context<ctll::list<sequence<Content...>, Ts...>, Parameters> subject) {
return pcre_context{ctll::push_front(optional<Content...>(), ctll::list<Ts...>()), subject.parameters};
}
// make_lazy (optional)
template <auto V, typename... Subject, typename... Ts, typename Parameters> static constexpr auto apply(pcre::make_lazy, ctll::term<V>, pcre_context<ctll::list<optional<Subject...>, Ts...>, Parameters> subject) {
return pcre_context{ctll::push_front(lazy_optional<Subject...>(), ctll::list<Ts...>()), subject.parameters};
}
#endif
#ifndef CTRE__ACTIONS__REPEAT__HPP
#define CTRE__ACTIONS__REPEAT__HPP
// repeat 1..N
template <auto V, typename A, typename... Ts, typename Parameters> static constexpr auto apply(pcre::repeat_plus, ctll::term<V>, pcre_context<ctll::list<A, Ts...>, Parameters> subject) {
return pcre_context{ctll::push_front(plus<A>(), ctll::list<Ts...>()), subject.parameters};
}
// repeat 1..N (sequence)
template <auto V, typename... Content, typename... Ts, typename Parameters> static constexpr auto apply(pcre::repeat_plus, ctll::term<V>, pcre_context<ctll::list<sequence<Content...>, Ts...>, Parameters> subject) {
return pcre_context{ctll::push_front(plus<Content...>(), ctll::list<Ts...>()), subject.parameters};
}
// repeat 0..N
template <auto V, typename A, typename... Ts, typename Parameters> static constexpr auto apply(pcre::repeat_star, ctll::term<V>, pcre_context<ctll::list<A, Ts...>, Parameters> subject) {
return pcre_context{ctll::push_front(star<A>(), ctll::list<Ts...>()), subject.parameters};
}
// repeat 0..N (sequence)
template <auto V, typename... Content, typename... Ts, typename Parameters> static constexpr auto apply(pcre::repeat_star, ctll::term<V>, pcre_context<ctll::list<sequence<Content...>, Ts...>, Parameters> subject) {
return pcre_context{ctll::push_front(star<Content...>(), ctll::list<Ts...>()), subject.parameters};
}
// create_number (seed)
template <auto V, typename... Ts, typename Parameters> static constexpr auto apply(pcre::create_number, ctll::term<V>, pcre_context<ctll::list<Ts...>, Parameters> subject) {
return pcre_context{ctll::push_front(number<static_cast<size_t>(V - '0')>(), subject.stack), subject.parameters};
}
// push_number
template <auto V, size_t N, typename... Ts, typename Parameters> static constexpr auto apply(pcre::push_number, ctll::term<V>, pcre_context<ctll::list<number<N>, Ts...>, Parameters> subject) {
constexpr size_t previous = N * 10ull;
return pcre_context{ctll::push_front(number<(previous + (V - '0'))>(), ctll::list<Ts...>()), subject.parameters};
}
// repeat A..B
template <auto V, typename Subject, size_t A, size_t B, typename... Ts, typename Parameters> static constexpr auto apply(pcre::repeat_ab, ctll::term<V>, pcre_context<ctll::list<number<B>, number<A>, Subject, Ts...>, Parameters> subject) {
return pcre_context{ctll::push_front(repeat<A,B,Subject>(), ctll::list<Ts...>()), subject.parameters};
}
// repeat A..B (sequence)
template <auto V, typename... Content, size_t A, size_t B, typename... Ts, typename Parameters> static constexpr auto apply(pcre::repeat_ab, ctll::term<V>, pcre_context<ctll::list<number<B>, number<A>, sequence<Content...>, Ts...>, Parameters> subject) {
return pcre_context{ctll::push_front(repeat<A,B,Content...>(), ctll::list<Ts...>()), subject.parameters};
}
// repeat_exactly
template <auto V, typename Subject, size_t A, typename... Ts, typename Parameters> static constexpr auto apply(pcre::repeat_exactly, ctll::term<V>, pcre_context<ctll::list<number<A>, Subject, Ts...>, Parameters> subject) {
return pcre_context{ctll::push_front(repeat<A,A,Subject>(), ctll::list<Ts...>()), subject.parameters};
}
// repeat_exactly A..B (sequence)
template <auto V, typename... Content, size_t A, typename... Ts, typename Parameters> static constexpr auto apply(pcre::repeat_exactly, ctll::term<V>, pcre_context<ctll::list<number<A>, sequence<Content...>, Ts...>, Parameters> subject) {
return pcre_context{ctll::push_front(repeat<A,A,Content...>(), ctll::list<Ts...>()), subject.parameters};
}
// repeat_at_least (A+)
template <auto V, typename Subject, size_t A, typename... Ts, typename Parameters> static constexpr auto apply(pcre::repeat_at_least, ctll::term<V>, pcre_context<ctll::list<number<A>, Subject, Ts...>, Parameters> subject) {
return pcre_context{ctll::push_front(repeat<A,0,Subject>(), ctll::list<Ts...>()), subject.parameters};
}
// repeat_at_least (A+) (sequence)
template <auto V, typename... Content, size_t A, typename... Ts, typename Parameters> static constexpr auto apply(pcre::repeat_at_least, ctll::term<V>, pcre_context<ctll::list<number<A>, sequence<Content...>, Ts...>, Parameters> subject) {
return pcre_context{ctll::push_front(repeat<A,0,Content...>(), ctll::list<Ts...>()), subject.parameters};
}
// make_lazy (plus)
template <auto V, typename... Subject, typename... Ts, typename Parameters> static constexpr auto apply(pcre::make_lazy, ctll::term<V>, pcre_context<ctll::list<plus<Subject...>, Ts...>, Parameters> subject) {
return pcre_context{ctll::push_front(lazy_plus<Subject...>(), ctll::list<Ts...>()), subject.parameters};
}
// make_lazy (star)
template <auto V, typename... Subject, typename... Ts, typename Parameters> static constexpr auto apply(pcre::make_lazy, ctll::term<V>, pcre_context<ctll::list<star<Subject...>, Ts...>, Parameters> subject) {
return pcre_context{ctll::push_front(lazy_star<Subject...>(), ctll::list<Ts...>()), subject.parameters};
}
// make_lazy (repeat<A,B>)
template <auto V, typename... Subject, size_t A, size_t B, typename... Ts, typename Parameters> static constexpr auto apply(pcre::make_lazy, ctll::term<V>, pcre_context<ctll::list<repeat<A,B,Subject...>, Ts...>, Parameters> subject) {
return pcre_context{ctll::push_front(lazy_repeat<A,B,Subject...>(), ctll::list<Ts...>()), subject.parameters};
}
// make_possessive (plus)
template <auto V, typename... Subject, typename... Ts, typename Parameters> static constexpr auto apply(pcre::make_possessive, ctll::term<V>, pcre_context<ctll::list<plus<Subject...>, Ts...>, Parameters> subject) {
return pcre_context{ctll::push_front(possessive_plus<Subject...>(), ctll::list<Ts...>()), subject.parameters};
}
// make_possessive (star)
template <auto V, typename... Subject, typename... Ts, typename Parameters> static constexpr auto apply(pcre::make_possessive, ctll::term<V>, pcre_context<ctll::list<star<Subject...>, Ts...>, Parameters> subject) {
return pcre_context{ctll::push_front(possessive_star<Subject...>(), ctll::list<Ts...>()), subject.parameters};
}
// make_possessive (repeat<A,B>)
template <auto V, typename... Subject, size_t A, size_t B, typename... Ts, typename Parameters> static constexpr auto apply(pcre::make_possessive, ctll::term<V>, pcre_context<ctll::list<repeat<A,B,Subject...>, Ts...>, Parameters> subject) {
return pcre_context{ctll::push_front(possessive_repeat<A,B,Subject...>(), ctll::list<Ts...>()), subject.parameters};
}
#endif
#ifndef CTRE__ACTIONS__SEQUENCE__HPP
#define CTRE__ACTIONS__SEQUENCE__HPP
// make_sequence
template <auto V, typename A, typename B, typename... Ts, typename Parameters> static constexpr auto apply(pcre::make_sequence, ctll::term<V>, pcre_context<ctll::list<B,A,Ts...>, Parameters> subject) {
return pcre_context{ctll::push_front(sequence<A,B>(), ctll::list<Ts...>()), subject.parameters};
}
// make_sequence (concat)
template <auto V, typename... As, typename B, typename... Ts, typename Parameters> static constexpr auto apply(pcre::make_sequence, ctll::term<V>, pcre_context<ctll::list<sequence<As...>,B,Ts...>, Parameters> subject) {
return pcre_context{ctll::push_front(sequence<B,As...>(), ctll::list<Ts...>()), subject.parameters};
}
// make_sequence (make string)
template <auto V, auto A, auto B, typename... Ts, typename Parameters> static constexpr auto apply(pcre::make_sequence, ctll::term<V>, pcre_context<ctll::list<character<B>,character<A>,Ts...>, Parameters> subject) {
return pcre_context{ctll::push_front(string<A,B>(), ctll::list<Ts...>()), subject.parameters};
}
// make_sequence (concat string)
template <auto V, auto... As, auto B, typename... Ts, typename Parameters> static constexpr auto apply(pcre::make_sequence, ctll::term<V>, pcre_context<ctll::list<string<As...>,character<B>,Ts...>, Parameters> subject) {
return pcre_context{ctll::push_front(string<B,As...>(), ctll::list<Ts...>()), subject.parameters};
}
#endif
#ifndef CTRE__ACTIONS__SET__HPP
#define CTRE__ACTIONS__SET__HPP
// UTILITY
// add into set if not exists
template <template <typename...> typename SetType, typename T, typename... As, bool Exists = (std::is_same_v<T, As> || ... || false)> static constexpr auto push_back_into_set(T, SetType<As...>) -> ctll::conditional<Exists, SetType<As...>, SetType<As...,T>> { return {}; }
//template <template <typename...> typename SetType, typename A, typename BHead, typename... Bs> struct set_merge_helper {
// using step = decltype(push_back_into_set<SetType>(BHead(), A()));
// using type = ctll::conditional<(sizeof...(Bs) > 0), set_merge_helper<SetType, step, Bs...>, step>;
//};
//
//// add set into set if not exists
//template <template <typename...> typename SetType, typename... As, typename... Bs> static constexpr auto push_back_into_set(SetType<As...>, SetType<Bs...>) -> typename set_merge_helper<SetType, SetType<As...>, Bs...>::type { return pcre_context{{};), subject.parameters}}
//
//template <template <typename...> typename SetType, typename... As> static constexpr auto push_back_into_set(SetType<As...>, SetType<>) -> SetType<As...> { return pcre_context{{};), subject.parameters}}
// END OF UTILITY
// set_start
template <auto V, typename A,typename... Ts, typename Parameters> static constexpr auto apply(pcre::set_start, ctll::term<V>, pcre_context<ctll::list<A,Ts...>, Parameters> subject) {
return pcre_context{ctll::push_front(set<A>(), ctll::list<Ts...>()), subject.parameters};
}
// set_make
template <auto V, typename... Content, typename... Ts, typename Parameters> static constexpr auto apply(pcre::set_make, ctll::term<V>, pcre_context<ctll::list<set<Content...>, Ts...>, Parameters> subject) {
return pcre_context{ctll::push_front(set<Content...>(), ctll::list<Ts...>()), subject.parameters};
}
// set_make_negative
template <auto V, typename... Content, typename... Ts, typename Parameters> static constexpr auto apply(pcre::set_make_negative, ctll::term<V>, pcre_context<ctll::list<set<Content...>, Ts...>, Parameters> subject) {
return pcre_context{ctll::push_front(negative_set<Content...>(), ctll::list<Ts...>()), subject.parameters};
}
// set{A...} + B = set{A,B}
template <auto V, typename A, typename... Content, typename... Ts, typename Parameters> static constexpr auto apply(pcre::set_combine, ctll::term<V>, pcre_context<ctll::list<A,set<Content...>,Ts...>, Parameters> subject) {
auto new_set = push_back_into_set<set>(A(), set<Content...>());
return pcre_context{ctll::push_front(new_set, ctll::list<Ts...>()), subject.parameters};
}
// TODO checkme
//// set{A...} + set{B...} = set{A...,B...}
//template <auto V, typename... As, typename... Bs, typename... Ts, typename Parameters> static constexpr auto apply(pcre::set_combine, ctll::term<V>, pcre_context<ctll::list<set<As...>,set<Bs...>,Ts...>, Parameters> subject) {
// auto new_set = push_back_into_set<set>(set<As...>(), set<Bs...>());
// return pcre_context{ctll::push_front(new_set, ctll::list<Ts...>()), subject.parameters};
//}
// negative_set{A...} + B = negative_set{A,B}
template <auto V, typename A, typename... Content, typename... Ts, typename Parameters> static constexpr auto apply(pcre::set_combine, ctll::term<V>, pcre_context<ctll::list<A,negative_set<Content...>,Ts...>, Parameters> subject) {
auto new_set = push_back_into_set<set>(A(), set<Content...>());
return pcre_context{ctll::push_front(new_set, ctll::list<Ts...>()), subject.parameters};
}
// TODO checkme
//// negative_set{A...} + negative_set{B...} = negative_set{A...,B...}
//template <auto V, typename... As, typename... Bs, typename... Ts, typename Parameters> static constexpr auto apply(pcre::set_combine, ctll::term<V>, pcre_context<ctll::list<negative_set<As...>,negative_set<Bs...>,Ts...>, Parameters> subject) {
// auto new_set = push_back_into_set<negative_set>(negative_set<As...>(), negative_set<Bs...>());
// return pcre_context{ctll::push_front(new_set, ctll::list<Ts...>()), subject.parameters};
//}
// negate_class_named: [[^:digit:]] = [^[:digit:]]
template <auto V, typename A, typename... Ts, typename Parameters> static constexpr auto apply(pcre::negate_class_named, ctll::term<V>, pcre_context<ctll::list<A, Ts...>, Parameters> subject) {
return pcre_context{ctll::push_front(negate<A>(), ctll::list<Ts...>()), subject.parameters};
}
// add range to set
template <auto V, auto B, auto A, typename... Ts, typename Parameters> static constexpr auto apply(pcre::make_range, ctll::term<V>, pcre_context<ctll::list<character<B>,character<A>, Ts...>, Parameters> subject) {
return pcre_context{ctll::push_front(char_range<A,B>(), ctll::list<Ts...>()), subject.parameters};
}
#endif
#ifndef CTRE__ACTIONS__PROPERTIES__HPP
#define CTRE__ACTIONS__PROPERTIES__HPP
// push_property_name
template <auto V, typename... Ts, typename Parameters> static constexpr auto apply(pcre::push_property_name, ctll::term<V>, pcre_context<ctll::list<Ts...>, Parameters> subject) {
return pcre_context{ctll::push_front(property_name<V>(), subject.stack), subject.parameters};
}
// push_property_name (concat)
template <auto... Str, auto V, typename... Ts, typename Parameters> static constexpr auto apply(pcre::push_property_name, ctll::term<V>, pcre_context<ctll::list<property_name<Str...>, Ts...>, Parameters> subject) {
return pcre_context{ctll::push_front(property_name<Str..., V>(), ctll::list<Ts...>()), subject.parameters};
}
// push_property_value
template <auto V, typename... Ts, typename Parameters> static constexpr auto apply(pcre::push_property_value, ctll::term<V>, pcre_context<ctll::list<Ts...>, Parameters> subject) {
return pcre_context{ctll::push_front(property_value<V>(), subject.stack), subject.parameters};
}
// push_property_value (concat)
template <auto... Str, auto V, typename... Ts, typename Parameters> static constexpr auto apply(pcre::push_property_value, ctll::term<V>, pcre_context<ctll::list<property_value<Str...>, Ts...>, Parameters> subject) {
return pcre_context{ctll::push_front(property_value<Str..., V>(), ctll::list<Ts...>()), subject.parameters};
}
// make_property
template <auto V, auto... Name, typename... Ts, typename Parameters> static constexpr auto apply(pcre::make_property, ctll::term<V>, [[maybe_unused]] pcre_context<ctll::list<property_name<Name...>, Ts...>, Parameters> subject) {
return ctll::reject{};
//constexpr std::array<char, sizeof...(Name)> name{static_cast<char>(Name)...};
//constexpr auto p = uni::__binary_prop_from_string(get_string_view(name));
//
//if constexpr (p == uni::__binary_prop::unknown) {
// return ctll::reject{};
//} else {
// return pcre_context{ctll::push_front(binary_property<p>(), ctll::list<Ts...>()), subject.parameters};
//}
}
// make_property
template <auto V, auto... Value, auto... Name, typename... Ts, typename Parameters> static constexpr auto apply(pcre::make_property, ctll::term<V>, [[maybe_unused]] pcre_context<ctll::list<property_value<Value...>, property_name<Name...>, Ts...>, Parameters> subject) {
return ctll::reject{};
//constexpr auto prop = property_builder<Name...>::template get<Value...>();
//
//if constexpr (std::is_same_v<decltype(prop), ctll::reject>) {
// return ctll::reject{};
//} else {
// return pcre_context{ctll::push_front(prop, ctll::list<Ts...>()), subject.parameters};
//}
}
// make_property_negative
template <auto V, auto... Name, typename... Ts, typename Parameters> static constexpr auto apply(pcre::make_property_negative, ctll::term<V>, [[maybe_unused]] pcre_context<ctll::list<property_name<Name...>, Ts...>, Parameters> subject) {
return ctll::reject{};
//constexpr std::array<char, sizeof...(Name)> name{static_cast<char>(Name)...};
//constexpr auto p = uni::__binary_prop_from_string(get_string_view(name));
//
//if constexpr (p == uni::__binary_prop::unknown) {
// return ctll::reject{};
//} else {
// return pcre_context{ctll::push_front(negate<binary_property<p>>(), ctll::list<Ts...>()), subject.parameters};
//}
}
// make_property_negative
template <auto V, auto... Value, auto... Name, typename... Ts, typename Parameters> static constexpr auto apply(pcre::make_property_negative, ctll::term<V>, [[maybe_unused]] pcre_context<ctll::list<property_value<Value...>, property_name<Name...>, Ts...>, Parameters> subject) {
return ctll::reject{};
//constexpr auto prop = property_builder<Name...>::template get<Value...>();
//
//if constexpr (std::is_same_v<decltype(prop), ctll::reject>) {
// return ctll::reject{};
//} else {
// return pcre_context{ctll::push_front(negate<decltype(prop)>(), ctll::list<Ts...>()), subject.parameters};
//}
}
#endif
};
}
#endif
#ifndef CTRE__EVALUATION__HPP
#define CTRE__EVALUATION__HPP
#ifndef CTRE__RETURN_TYPE__HPP
#define CTRE__RETURN_TYPE__HPP
#include <type_traits>
#include <tuple>
#include <string_view>
#include <string>
namespace ctre {
struct not_matched_tag_t { };
static constexpr inline auto not_matched = not_matched_tag_t{};
template <size_t Id, typename Name = void> struct captured_content {
template <typename Iterator> class storage {
Iterator _begin{};
Iterator _end{};
bool _matched{false};
public:
using char_type = typename std::iterator_traits<Iterator>::value_type;
using name = Name;
constexpr CTRE_FORCE_INLINE storage() noexcept {}
constexpr CTRE_FORCE_INLINE void matched() noexcept {
_matched = true;
}
constexpr CTRE_FORCE_INLINE void unmatch() noexcept {
_matched = false;
}
constexpr CTRE_FORCE_INLINE void set_start(Iterator pos) noexcept {
_begin = pos;
}
constexpr CTRE_FORCE_INLINE storage & set_end(Iterator pos) noexcept {
_end = pos;
return *this;
}
constexpr CTRE_FORCE_INLINE Iterator get_end() const noexcept {
return _end;
}
constexpr auto begin() const noexcept {
return _begin;
}
constexpr auto end() const noexcept {
return _end;
}
constexpr CTRE_FORCE_INLINE operator bool() const noexcept {
return _matched;
}
constexpr CTRE_FORCE_INLINE const auto * data() const noexcept {
return &*_begin;
}
constexpr CTRE_FORCE_INLINE auto size() const noexcept {
return static_cast<size_t>(std::distance(_begin, _end));
}
constexpr CTRE_FORCE_INLINE auto to_view() const noexcept {
return std::basic_string_view<char_type>(&*_begin, static_cast<size_t>(std::distance(_begin, _end)));
}
constexpr CTRE_FORCE_INLINE auto to_string() const noexcept {
return std::basic_string<char_type>(begin(), end());
}
constexpr CTRE_FORCE_INLINE auto view() const noexcept {
return std::basic_string_view<char_type>(&*_begin, static_cast<size_t>(std::distance(_begin, _end)));
}
constexpr CTRE_FORCE_INLINE auto str() const noexcept {
return std::basic_string<char_type>(begin(), end());
}
constexpr CTRE_FORCE_INLINE operator std::basic_string_view<char_type>() const noexcept {
return to_view();
}
constexpr CTRE_FORCE_INLINE explicit operator std::basic_string<char_type>() const noexcept {
return to_string();
}
constexpr CTRE_FORCE_INLINE static size_t get_id() noexcept {
return Id;
}
friend CTRE_FORCE_INLINE constexpr bool operator==(const storage & lhs, std::basic_string_view<char_type> rhs) noexcept {
return lhs.view() == rhs;
}
friend CTRE_FORCE_INLINE constexpr bool operator!=(const storage & lhs, std::basic_string_view<char_type> rhs) noexcept {
return lhs.view() != rhs;
}
friend CTRE_FORCE_INLINE constexpr bool operator==(std::basic_string_view<char_type> lhs, const storage & rhs) noexcept {
return lhs == rhs.view();
}
friend CTRE_FORCE_INLINE constexpr bool operator!=(std::basic_string_view<char_type> lhs, const storage & rhs) noexcept {
return lhs != rhs.view();
}
};
};
struct capture_not_exists_tag { };
static constexpr inline auto capture_not_exists = capture_not_exists_tag{};
template <typename... Captures> struct captures;
template <typename Head, typename... Tail> struct captures<Head, Tail...>: captures<Tail...> {
Head head{};
constexpr CTRE_FORCE_INLINE captures() noexcept { }
template <size_t id> CTRE_FORCE_INLINE static constexpr bool exists() noexcept {
if constexpr (id == Head::get_id()) {
return true;
} else {
return captures<Tail...>::template exists<id>();
}
}
template <typename Name> CTRE_FORCE_INLINE static constexpr bool exists() noexcept {
if constexpr (std::is_same_v<Name, typename Head::name>) {
return true;
} else {
return captures<Tail...>::template exists<Name>();
}
}
#if (__cpp_nontype_template_parameter_class || (__cpp_nontype_template_args >= 201911L))
template <ctll::fixed_string Name> CTRE_FORCE_INLINE static constexpr bool exists() noexcept {
#else
template <const auto & Name> CTRE_FORCE_INLINE static constexpr bool exists() noexcept {
#endif
if constexpr (std::is_same_v<typename Head::name, void>) {
return captures<Tail...>::template exists<Name>();
} else {
if constexpr (Head::name::name.is_same_as(Name)) {
return true;
} else {
return captures<Tail...>::template exists<Name>();
}
}
}
template <size_t id> CTRE_FORCE_INLINE constexpr auto & select() noexcept {
if constexpr (id == Head::get_id()) {
return head;
} else {
return captures<Tail...>::template select<id>();
}
}
template <typename Name> CTRE_FORCE_INLINE constexpr auto & select() noexcept {
if constexpr (std::is_same_v<Name, typename Head::name>) {
return head;
} else {
return captures<Tail...>::template select<Name>();
}
}
template <size_t id> CTRE_FORCE_INLINE constexpr auto & select() const noexcept {
if constexpr (id == Head::get_id()) {
return head;
} else {
return captures<Tail...>::template select<id>();
}
}
template <typename Name> CTRE_FORCE_INLINE constexpr auto & select() const noexcept {
if constexpr (std::is_same_v<Name, typename Head::name>) {
return head;
} else {
return captures<Tail...>::template select<Name>();
}
}
#if (__cpp_nontype_template_parameter_class || (__cpp_nontype_template_args >= 201911L))
template <ctll::fixed_string Name> CTRE_FORCE_INLINE constexpr auto & select() const noexcept {
#else
template <const auto & Name> CTRE_FORCE_INLINE constexpr auto & select() const noexcept {
#endif
if constexpr (std::is_same_v<typename Head::name, void>) {
return captures<Tail...>::template select<Name>();
} else {
if constexpr (Head::name::name.is_same_as(Name)) {
return head;
} else {
return captures<Tail...>::template select<Name>();
}
}
}
};
template <> struct captures<> {
constexpr CTRE_FORCE_INLINE captures() noexcept { }
template <size_t> CTRE_FORCE_INLINE static constexpr bool exists() noexcept {
return false;
}
template <typename> CTRE_FORCE_INLINE static constexpr bool exists() noexcept {
return false;
}
#if (__cpp_nontype_template_parameter_class || (__cpp_nontype_template_args >= 201911L))
template <ctll::fixed_string> CTRE_FORCE_INLINE static constexpr bool exists() noexcept {
#else
template <const auto &> CTRE_FORCE_INLINE static constexpr bool exists() noexcept {
#endif
return false;
}
template <size_t> CTRE_FORCE_INLINE constexpr auto & select() const noexcept {
return capture_not_exists;
}
template <typename> CTRE_FORCE_INLINE constexpr auto & select() const noexcept {
return capture_not_exists;
}
#if (__cpp_nontype_template_parameter_class || (__cpp_nontype_template_args >= 201911L))
template <ctll::fixed_string> CTRE_FORCE_INLINE constexpr auto & select() const noexcept {
#else
template <const auto &> CTRE_FORCE_INLINE constexpr auto & select() const noexcept {
#endif
return capture_not_exists;
}
};
template <typename Iterator, typename... Captures> class regex_results {
captures<captured_content<0>::template storage<Iterator>, typename Captures::template storage<Iterator>...> _captures{};
public:
using char_type = typename std::iterator_traits<Iterator>::value_type;
constexpr CTRE_FORCE_INLINE regex_results() noexcept { }
constexpr CTRE_FORCE_INLINE regex_results(not_matched_tag_t) noexcept { }
// special constructor for deducting
constexpr CTRE_FORCE_INLINE regex_results(Iterator, ctll::list<Captures...>) noexcept { }
template <size_t Id, typename = std::enable_if_t<decltype(_captures)::template exists<Id>()>> CTRE_FORCE_INLINE constexpr auto get() const noexcept {
return _captures.template select<Id>();
}
template <typename Name, typename = std::enable_if_t<decltype(_captures)::template exists<Name>()>> CTRE_FORCE_INLINE constexpr auto get() const noexcept {
return _captures.template select<Name>();
}
#if (__cpp_nontype_template_parameter_class || (__cpp_nontype_template_args >= 201911L))
template <ctll::fixed_string Name, typename = std::enable_if_t<decltype(_captures)::template exists<Name>()>> CTRE_FORCE_INLINE constexpr auto get() const noexcept {
#else
template <const auto & Name, typename = std::enable_if_t<decltype(_captures)::template exists<Name>()>> CTRE_FORCE_INLINE constexpr auto get() const noexcept {
#endif
return _captures.template select<Name>();
}
static constexpr size_t count() noexcept {
return sizeof...(Captures) + 1;
}
constexpr CTRE_FORCE_INLINE regex_results & matched() noexcept {
_captures.template select<0>().matched();
return *this;
}
constexpr CTRE_FORCE_INLINE regex_results & unmatch() noexcept {
_captures.template select<0>().unmatch();
return *this;
}
constexpr CTRE_FORCE_INLINE operator bool() const noexcept {
return bool(_captures.template select<0>());
}
constexpr CTRE_FORCE_INLINE operator std::basic_string_view<char_type>() const noexcept {
return to_view();
}
constexpr CTRE_FORCE_INLINE explicit operator std::basic_string<char_type>() const noexcept {
return to_string();
}
constexpr CTRE_FORCE_INLINE auto to_view() const noexcept {
return _captures.template select<0>().to_view();
}
constexpr CTRE_FORCE_INLINE auto to_string() const noexcept {
return _captures.template select<0>().to_string();
}
constexpr CTRE_FORCE_INLINE auto view() const noexcept {
return _captures.template select<0>().view();
}
constexpr CTRE_FORCE_INLINE auto str() const noexcept {
return _captures.template select<0>().to_string();
}
constexpr CTRE_FORCE_INLINE size_t size() const noexcept {
return _captures.template select<0>().size();
}
constexpr CTRE_FORCE_INLINE const auto * data() const noexcept {
return _captures.template select<0>().data();
}
constexpr CTRE_FORCE_INLINE regex_results & set_start_mark(Iterator pos) noexcept {
_captures.template select<0>().set_start(pos);
return *this;
}
constexpr CTRE_FORCE_INLINE regex_results & set_end_mark(Iterator pos) noexcept {
_captures.template select<0>().set_end(pos);
return *this;
}
constexpr CTRE_FORCE_INLINE Iterator get_end_position() const noexcept {
return _captures.template select<0>().get_end();
}
template <size_t Id> CTRE_FORCE_INLINE constexpr regex_results & start_capture(Iterator pos) noexcept {
_captures.template select<Id>().set_start(pos);
return *this;
}
template <size_t Id> CTRE_FORCE_INLINE constexpr regex_results & end_capture(Iterator pos) noexcept {
_captures.template select<Id>().set_end(pos).matched();
return *this;
}
friend CTRE_FORCE_INLINE constexpr bool operator==(const regex_results & lhs, std::basic_string_view<char_type> rhs) noexcept {
return lhs.view() == rhs;
}
friend CTRE_FORCE_INLINE constexpr bool operator!=(const regex_results & lhs, std::basic_string_view<char_type> rhs) noexcept {
return lhs.view() != rhs;
}
friend CTRE_FORCE_INLINE constexpr bool operator==(std::basic_string_view<char_type> lhs, const regex_results & rhs) noexcept {
return lhs == rhs.view();
}
friend CTRE_FORCE_INLINE constexpr bool operator!=(std::basic_string_view<char_type> lhs, const regex_results & rhs) noexcept {
return lhs != rhs.view();
}
};
template <typename Iterator, typename... Captures> regex_results(Iterator, ctll::list<Captures...>) -> regex_results<Iterator, Captures...>;
}
// support for structured bindings
#ifndef __EDG__
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wmismatched-tags"
#endif
namespace std {
template <typename... Captures> struct tuple_size<ctre::regex_results<Captures...>> : public std::integral_constant<size_t, ctre::regex_results<Captures...>::count()> { };
template <size_t N, typename... Captures> struct tuple_element<N, ctre::regex_results<Captures...>> {
public:
using type = decltype(
std::declval<const ctre::regex_results<Captures...> &>().template get<N>()
);
};
}
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif
#endif
#ifndef CTRE__FIND_CAPTURES__HPP
#define CTRE__FIND_CAPTURES__HPP
namespace ctre {
template <typename Pattern> constexpr auto find_captures(Pattern) noexcept {
return find_captures(ctll::list<Pattern>(), ctll::list<>());
}
template <typename... Output> constexpr auto find_captures(ctll::list<>, ctll::list<Output...> output) noexcept {
return output;
}
template <auto... String, typename... Tail, typename Output> constexpr auto find_captures(ctll::list<string<String...>, Tail...>, Output output) noexcept {
return find_captures(ctll::list<Tail...>(), output);
}
template <typename... Options, typename... Tail, typename Output> constexpr auto find_captures(ctll::list<select<Options...>, Tail...>, Output output) noexcept {
return find_captures(ctll::list<Options..., Tail...>(), output);
}
template <typename... Content, typename... Tail, typename Output> constexpr auto find_captures(ctll::list<optional<Content...>, Tail...>, Output output) noexcept {
return find_captures(ctll::list<Content..., Tail...>(), output);
}
template <typename... Content, typename... Tail, typename Output> constexpr auto find_captures(ctll::list<lazy_optional<Content...>, Tail...>, Output output) noexcept {
return find_captures(ctll::list<Content..., Tail...>(), output);
}
template <typename... Content, typename... Tail, typename Output> constexpr auto find_captures(ctll::list<sequence<Content...>, Tail...>, Output output) noexcept {
return find_captures(ctll::list<Content..., Tail...>(), output);
}
template <typename... Tail, typename Output> constexpr auto find_captures(ctll::list<empty, Tail...>, Output output) noexcept {
return find_captures(ctll::list<Tail...>(), output);
}
template <typename... Tail, typename Output> constexpr auto find_captures(ctll::list<assert_begin, Tail...>, Output output) noexcept {
return find_captures(ctll::list<Tail...>(), output);
}
template <typename... Tail, typename Output> constexpr auto find_captures(ctll::list<assert_end, Tail...>, Output output) noexcept {
return find_captures(ctll::list<Tail...>(), output);
}
// , typename = std::enable_if_t<(MatchesCharacter<CharacterLike>::template value<char>)
template <typename CharacterLike, typename... Tail, typename Output> constexpr auto find_captures(ctll::list<CharacterLike, Tail...>, Output output) noexcept {
return find_captures(ctll::list<Tail...>(), output);
}
template <typename... Content, typename... Tail, typename Output> constexpr auto find_captures(ctll::list<plus<Content...>, Tail...>, Output output) noexcept {
return find_captures(ctll::list<Content..., Tail...>(), output);
}
template <typename... Content, typename... Tail, typename Output> constexpr auto find_captures(ctll::list<star<Content...>, Tail...>, Output output) noexcept {
return find_captures(ctll::list<Content..., Tail...>(), output);
}
template <size_t A, size_t B, typename... Content, typename... Tail, typename Output> constexpr auto find_captures(ctll::list<repeat<A,B,Content...>, Tail...>, Output output) noexcept {
return find_captures(ctll::list<Content..., Tail...>(), output);
}
template <typename... Content, typename... Tail, typename Output> constexpr auto find_captures(ctll::list<lazy_plus<Content...>, Tail...>, Output output) noexcept {
return find_captures(ctll::list<Content..., Tail...>(), output);
}
template <typename... Content, typename... Tail, typename Output> constexpr auto find_captures(ctll::list<lazy_star<Content...>, Tail...>, Output output) noexcept {
return find_captures(ctll::list<Content..., Tail...>(), output);
}
template <size_t A, size_t B, typename... Content, typename... Tail, typename Output> constexpr auto find_captures(ctll::list<lazy_repeat<A,B,Content...>, Tail...>, Output output) noexcept {
return find_captures(ctll::list<Content..., Tail...>(), output);
}
template <typename... Content, typename... Tail, typename Output> constexpr auto find_captures(ctll::list<possessive_plus<Content...>, Tail...>, Output output) noexcept {
return find_captures(ctll::list<Content..., Tail...>(), output);
}
template <typename... Content, typename... Tail, typename Output> constexpr auto find_captures(ctll::list<possessive_star<Content...>, Tail...>, Output output) noexcept {
return find_captures(ctll::list<Content..., Tail...>(), output);
}
template <size_t A, size_t B, typename... Content, typename... Tail, typename Output> constexpr auto find_captures(ctll::list<possessive_repeat<A,B,Content...>, Tail...>, Output output) noexcept {
return find_captures(ctll::list<Content..., Tail...>(), output);
}
template <typename... Content, typename... Tail, typename Output> constexpr auto find_captures(ctll::list<lookahead_positive<Content...>, Tail...>, Output output) noexcept {
return find_captures(ctll::list<Content..., Tail...>(), output);
}
template <typename... Content, typename... Tail, typename Output> constexpr auto find_captures(ctll::list<lookahead_negative<Content...>, Tail...>, Output output) noexcept {
return find_captures(ctll::list<Content..., Tail...>(), output);
}
template <size_t Id, typename... Content, typename... Tail, typename... Output> constexpr auto find_captures(ctll::list<capture<Id,Content...>, Tail...>, ctll::list<Output...>) noexcept {
return find_captures(ctll::list<Content..., Tail...>(), ctll::list<Output..., captured_content<Id>>());
}
template <size_t Id, typename Name, typename... Content, typename... Tail, typename... Output> constexpr auto find_captures(ctll::list<capture_with_name<Id,Name,Content...>, Tail...>, ctll::list<Output...>) noexcept {
return find_captures(ctll::list<Content..., Tail...>(), ctll::list<Output..., captured_content<Id, Name>>());
}
}
#endif
#ifndef CTRE__FIRST__HPP
#define CTRE__FIRST__HPP
namespace ctre {
struct can_be_anything {};
template <typename... Content>
constexpr auto first(ctll::list<Content...> l, ctll::list<>) noexcept {
return l;
}
template <typename... Content, typename... Tail>
constexpr auto first(ctll::list<Content...> l, ctll::list<accept, Tail...>) noexcept {
return l;
}
template <typename... Content, typename... Tail>
constexpr auto first(ctll::list<Content...> l, ctll::list<end_mark, Tail...>) noexcept {
return l;
}
template <typename... Content, typename... Tail>
constexpr auto first(ctll::list<Content...> l, ctll::list<end_cycle_mark, Tail...>) noexcept {
return l;
}
template <typename... Content, typename... Tail>
constexpr auto first(ctll::list<Content...> l, ctll::list<end_lookahead_mark, Tail...>) noexcept {
return l;
}
template <typename... Content, size_t Id, typename... Tail>
constexpr auto first(ctll::list<Content...> l, ctll::list<numeric_mark<Id>, Tail...>) noexcept {
return first(l, ctll::list<Tail...>{});
}
// empty
template <typename... Content, typename... Tail>
constexpr auto first(ctll::list<Content...> l, ctll::list<empty, Tail...>) noexcept {
return first(l, ctll::list<Tail...>{});
}
// asserts
template <typename... Content, typename... Tail>
constexpr auto first(ctll::list<Content...> l, ctll::list<assert_begin, Tail...>) noexcept {
return first(l, ctll::list<Tail...>{});
}
template <typename... Content, typename... Tail>
constexpr auto first(ctll::list<Content...> l, ctll::list<assert_end, Tail...>) noexcept {
return l;
}
// sequence
template <typename... Content, typename... Seq, typename... Tail>
constexpr auto first(ctll::list<Content...> l, ctll::list<sequence<Seq...>, Tail...>) noexcept {
return first(l, ctll::list<Seq..., Tail...>{});
}
// plus
template <typename... Content, typename... Seq, typename... Tail>
constexpr auto first(ctll::list<Content...> l, ctll::list<plus<Seq...>, Tail...>) noexcept {
return first(l, ctll::list<Seq..., Tail...>{});
}
// lazy_plus
template <typename... Content, typename... Seq, typename... Tail>
constexpr auto first(ctll::list<Content...> l, ctll::list<lazy_plus<Seq...>, Tail...>) noexcept {
return first(l, ctll::list<Seq..., Tail...>{});
}
// possessive_plus
template <typename... Content, typename... Seq, typename... Tail>
constexpr auto first(ctll::list<Content...> l, ctll::list<possessive_plus<Seq...>, Tail...>) noexcept {
return first(l, ctll::list<Seq..., Tail...>{});
}
// star
template <typename... Content, typename... Seq, typename... Tail>
constexpr auto first(ctll::list<Content...> l, ctll::list<star<Seq...>, Tail...>) noexcept {
return first(first(l, ctll::list<Tail...>{}), ctll::list<Seq..., Tail...>{});
}
// lazy_star
template <typename... Content, typename... Seq, typename... Tail>
constexpr auto first(ctll::list<Content...> l, ctll::list<lazy_star<Seq...>, Tail...>) noexcept {
return first(first(l, ctll::list<Tail...>{}), ctll::list<Seq..., Tail...>{});
}
// possessive_star
template <typename... Content, typename... Seq, typename... Tail>
constexpr auto first(ctll::list<Content...> l, ctll::list<possessive_star<Seq...>, Tail...>) noexcept {
return first(first(l, ctll::list<Tail...>{}), ctll::list<Seq..., Tail...>{});
}
// lazy_repeat
template <typename... Content, size_t A, size_t B, typename... Seq, typename... Tail>
constexpr auto first(ctll::list<Content...> l, ctll::list<lazy_repeat<A, B, Seq...>, Tail...>) noexcept {
return first(l, ctll::list<Seq..., Tail...>{});
}
template <typename... Content, size_t B, typename... Seq, typename... Tail>
constexpr auto first(ctll::list<Content...> l, ctll::list<lazy_repeat<0, B, Seq...>, Tail...>) noexcept {
return first(first(l, ctll::list<Tail...>{}), ctll::list<Seq..., Tail...>{});
}
// possessive_repeat
template <typename... Content, size_t A, size_t B, typename... Seq, typename... Tail>
constexpr auto first(ctll::list<Content...> l, ctll::list<possessive_repeat<A, B, Seq...>, Tail...>) noexcept {
return first(l, ctll::list<Seq..., Tail...>{});
}
template <typename... Content, size_t B, typename... Seq, typename... Tail>
constexpr auto first(ctll::list<Content...> l, ctll::list<possessive_repeat<0, B, Seq...>, Tail...>) noexcept {
return first(first(l, ctll::list<Tail...>{}), ctll::list<Seq..., Tail...>{});
}
// repeat
template <typename... Content, size_t A, size_t B, typename... Seq, typename... Tail>
constexpr auto first(ctll::list<Content...> l, ctll::list<repeat<A, B, Seq...>, Tail...>) noexcept {
return first(l, ctll::list<Seq..., Tail...>{});
}
template <typename... Content, size_t B, typename... Seq, typename... Tail>
constexpr auto first(ctll::list<Content...> l, ctll::list<repeat<0, B, Seq...>, Tail...>) noexcept {
return first(first(l, ctll::list<Tail...>{}), ctll::list<Seq..., Tail...>{});
}
// lookahead_positive
template <typename... Content, typename... Seq, typename... Tail>
constexpr auto first(ctll::list<Content...>, ctll::list<lookahead_positive<Seq...>, Tail...>) noexcept {
return ctll::list<can_be_anything>{};
}
// lookahead_negative TODO fixme
template <typename... Content, typename... Seq, typename... Tail>
constexpr auto first(ctll::list<Content...>, ctll::list<lookahead_negative<Seq...>, Tail...>) noexcept {
return ctll::list<can_be_anything>{};
}
// capture
template <typename... Content, size_t Id, typename... Seq, typename... Tail>
constexpr auto first(ctll::list<Content...> l, ctll::list<capture<Id, Seq...>, Tail...>) noexcept {
return first(l, ctll::list<Seq..., Tail...>{});
}
template <typename... Content, size_t Id, typename Name, typename... Seq, typename... Tail>
constexpr auto first(ctll::list<Content...> l, ctll::list<capture_with_name<Id, Name, Seq...>, Tail...>) noexcept {
return first(l, ctll::list<Seq..., Tail...>{});
}
// backreference
template <typename... Content, size_t Id, typename... Tail>
constexpr auto first(ctll::list<Content...>, ctll::list<back_reference<Id>, Tail...>) noexcept {
return ctll::list<can_be_anything>{};
}
template <typename... Content, typename Name, typename... Tail>
constexpr auto first(ctll::list<Content...>, ctll::list<back_reference_with_name<Name>, Tail...>) noexcept {
return ctll::list<can_be_anything>{};
}
// string First extraction
template <typename... Content, auto First, auto... String, typename... Tail>
constexpr auto first(ctll::list<Content...>, ctll::list<string<First, String...>, Tail...>) noexcept {
return ctll::list<Content..., character<First>>{};
}
template <typename... Content, typename... Tail>
constexpr auto first(ctll::list<Content...> l, ctll::list<string<>, Tail...>) noexcept {
return first(l, ctll::list<Tail...>{});
}
// optional
template <typename... Content, typename... Opt, typename... Tail>
constexpr auto first(ctll::list<Content...> l, ctll::list<optional<Opt...>, Tail...>) noexcept {
return first(first(l, ctll::list<Opt..., Tail...>{}), ctll::list<Tail...>{});
}
template <typename... Content, typename... Opt, typename... Tail>
constexpr auto first(ctll::list<Content...> l, ctll::list<lazy_optional<Opt...>, Tail...>) noexcept {
return first(first(l, ctll::list<Opt..., Tail...>{}), ctll::list<Tail...>{});
}
// select (alternation)
template <typename... Content, typename SHead, typename... STail, typename... Tail>
constexpr auto first(ctll::list<Content...> l, ctll::list<select<SHead, STail...>, Tail...>) noexcept {
return first(first(l, ctll::list<SHead, Tail...>{}), ctll::list<select<STail...>, Tail...>{});
}
template <typename... Content, typename... Tail>
constexpr auto first(ctll::list<Content...> l, ctll::list<select<>, Tail...>) noexcept {
return l;
}
// characters / sets
template <typename... Content, auto V, typename... Tail>
constexpr auto first(ctll::list<Content...>, ctll::list<character<V>, Tail...>) noexcept {
return ctll::list<Content..., character<V>>{};
}
template <typename... Content, auto... Values, typename... Tail>
constexpr auto first(ctll::list<Content...>, ctll::list<enumeration<Values...>, Tail...>) noexcept {
return ctll::list<Content..., character<Values>...>{};
}
template <typename... Content, typename... SetContent, typename... Tail>
constexpr auto first(ctll::list<Content...>, ctll::list<set<SetContent...>, Tail...>) noexcept {
return ctll::list<Content..., SetContent...>{};
}
template <typename... Content, auto A, auto B, typename... Tail>
constexpr auto first(ctll::list<Content...>, ctll::list<char_range<A,B>, Tail...>) noexcept {
return ctll::list<Content..., char_range<A,B>>{};
}
template <typename... Content, typename... Tail>
constexpr auto first(ctll::list<Content...>, ctll::list<any, Tail...>) noexcept {
return ctll::list<can_be_anything>{};
}
// negative
template <typename... Content, typename... SetContent, typename... Tail>
constexpr auto first(ctll::list<Content...>, ctll::list<negate<SetContent...>, Tail...>) noexcept {
return ctll::list<Content..., negative_set<SetContent...>>{};
}
template <typename... Content, typename... SetContent, typename... Tail>
constexpr auto first(ctll::list<Content...>, ctll::list<negative_set<SetContent...>, Tail...>) noexcept {
return ctll::list<Content..., negative_set<SetContent...>>{};
}
// user facing interface
template <typename... Content> constexpr auto calculate_first(Content...) noexcept {
return first(ctll::list<>{}, ctll::list<Content...>{});
}
// calculate mutual exclusivity
template <typename... Content> constexpr size_t calculate_size_of_first(ctre::negative_set<Content...>) {
return 1 + 1 * sizeof...(Content);
}
template <auto... V> constexpr size_t calculate_size_of_first(ctre::enumeration<V...>) {
return sizeof...(V);
}
constexpr size_t calculate_size_of_first(...) {
return 1;
}
template <typename... Content> constexpr size_t calculate_size_of_first(ctll::list<Content...>) {
return (calculate_size_of_first(Content{}) + ... + 0);
}
template <typename... Content> constexpr size_t calculate_size_of_first(ctre::set<Content...>) {
return (calculate_size_of_first(Content{}) + ... + 0);
}
template <auto A, typename CB> constexpr int64_t negative_helper(ctre::character<A>, CB & cb, int64_t start) {
if (A != std::numeric_limits<int64_t>::min()) {
if (start < A) {
cb(start, A-1);
}
}
if (A != std::numeric_limits<int64_t>::max()) {
return A+1;
} else {
return A;
}
}
template <auto A, auto B, typename CB> constexpr int64_t negative_helper(ctre::char_range<A,B>, CB & cb, int64_t start) {
if (A != std::numeric_limits<int64_t>::min()) {
if (start < A) {
cb(start, A-1);
}
}
if (B != std::numeric_limits<int64_t>::max()) {
return B+1;
} else {
return B;
}
}
template <auto Head, auto... Tail, typename CB> constexpr int64_t negative_helper(ctre::enumeration<Head, Tail...>, CB & cb, int64_t start) {
int64_t nstart = negative_helper(ctre::character<Head>{}, cb, start);
return negative_helper(ctre::enumeration<Tail...>{}, cb, nstart);
}
template <typename CB> constexpr int64_t negative_helper(ctre::enumeration<>, CB &, int64_t start) {
return start;
}
template <typename CB> constexpr int64_t negative_helper(ctre::set<>, CB &, int64_t start) {
return start;
}
template <typename Head, typename... Rest, typename CB> constexpr int64_t negative_helper(ctre::set<Head, Rest...>, CB & cb, int64_t start) {
start = negative_helper(Head{}, cb, start);
return negative_helper(ctre::set<Rest...>{}, cb, start);
}
template <typename Head, typename... Rest, typename CB> constexpr void negative_helper(ctre::negative_set<Head, Rest...>, CB && cb, int64_t start = std::numeric_limits<int64_t>::min()) {
start = negative_helper(Head{}, cb, start);
negative_helper(ctre::negative_set<Rest...>{}, std::forward<CB>(cb), start);
}
template <typename CB> constexpr void negative_helper(ctre::negative_set<>, CB && cb, int64_t start = std::numeric_limits<int64_t>::min()) {
if (start < std::numeric_limits<int64_t>::max()) {
cb(start, std::numeric_limits<int64_t>::max());
}
}
// simple fixed set
// TODO: this needs some optimizations
template <size_t Capacity> class point_set {
struct point {
int64_t low{};
int64_t high{};
constexpr bool operator<(const point & rhs) const {
return low < rhs.low;
}
constexpr point() { }
constexpr point(int64_t l, int64_t h): low{l}, high{h} { }
};
point points[Capacity+1]{};
size_t used{0};
constexpr point * begin() {
return points;
}
constexpr point * begin() const {
return points;
}
constexpr point * end() {
return points + used;
}
constexpr point * end() const {
return points + used;
}
constexpr point * lower_bound(point obj) {
auto first = begin();
auto last = end();
auto it = first;
size_t count = std::distance(first, last);
while (count > 0) {
it = first;
size_t step = count / 2;
std::advance(it, step);
if (*it < obj) {
first = ++it;
count -= step + 1;
} else {
count = step;
}
}
return it;
}
constexpr point * insert_point(int64_t position, int64_t other) {
point obj{position, other};
auto it = lower_bound(obj);
if (it == end()) {
*it = obj;
used++;
return it;
} else {
auto out = it;
auto e = end();
while (it != e) {
auto tmp = *it;
*it = obj;
obj = tmp;
//std::swap(*it, obj);
it++;
}
auto tmp = *it;
*it = obj;
obj = tmp;
//std::swap(*it, obj);
used++;
return out;
}
}
public:
constexpr point_set() { }
constexpr void insert(int64_t low, int64_t high) {
insert_point(low, high);
//insert_point(high, low);
}
constexpr bool check(int64_t low, int64_t high) {
for (auto r: *this) {
if (r.low <= low && low <= r.high) {
return true;
} else if (r.low <= high && high <= r.high) {
return true;
} else if (low <= r.low && r.low <= high) {
return true;
} else if (low <= r.high && r.high <= high) {
return true;
}
}
return false;
}
template <auto V> constexpr bool check(ctre::character<V>) {
return check(V,V);
}
template <auto A, auto B> constexpr bool check(ctre::char_range<A,B>) {
return check(A,B);
}
constexpr bool check(can_be_anything) {
return used > 0;
}
template <typename... Content> constexpr bool check(ctre::negative_set<Content...> nset) {
bool collision = false;
negative_helper(nset, [&](int64_t low, int64_t high){
collision |= this->check(low, high);
});
return collision;
}
template <auto... V> constexpr bool check(ctre::enumeration<V...>) {
return (check(V,V) || ... || false);
}
template <typename... Content> constexpr bool check(ctll::list<Content...>) {
return (check(Content{}) || ... || false);
}
template <typename... Content> constexpr bool check(ctre::set<Content...>) {
return (check(Content{}) || ... || false);
}
template <auto V> constexpr void populate(ctre::character<V>) {
insert(V,V);
}
template <auto A, auto B> constexpr void populate(ctre::char_range<A,B>) {
insert(A,B);
}
constexpr void populate(can_be_anything) {
insert(std::numeric_limits<int64_t>::min(), std::numeric_limits<int64_t>::max());
}
template <typename... Content> constexpr void populate(ctre::negative_set<Content...> nset) {
negative_helper(nset, [&](int64_t low, int64_t high){
this->insert(low, high);
});
}
template <typename... Content> constexpr void populate(ctre::set<Content...>) {
(populate(Content{}), ...);
}
template <typename... Content> constexpr void populate(ctll::list<Content...>) {
(populate(Content{}), ...);
}
};
template <typename... A, typename... B> constexpr bool collides(ctll::list<A...> rhs, ctll::list<B...> lhs) {
constexpr size_t capacity = calculate_size_of_first(rhs);
point_set<capacity> set;
set.populate(rhs);
return set.check(lhs);
}
}
#endif
// remove me when MSVC fix the constexpr bug
#ifdef _MSC_VER
#ifndef CTRE_MSVC_GREEDY_WORKAROUND
#define CTRE_MSVC_GREEDY_WORKAROUND
#endif
#endif
namespace ctre {
// calling with pattern prepare stack and triplet of iterators
template <typename Iterator, typename EndIterator, typename Pattern>
constexpr inline auto match_re(const Iterator begin, const EndIterator end, Pattern pattern) noexcept {
using return_type = decltype(regex_results(std::declval<Iterator>(), find_captures(pattern)));
return evaluate(begin, begin, end, return_type{}, ctll::list<start_mark, Pattern, assert_end, end_mark, accept>());
}
template <typename Iterator, typename EndIterator, typename Pattern>
constexpr inline auto search_re(const Iterator begin, const EndIterator end, Pattern pattern) noexcept {
using return_type = decltype(regex_results(std::declval<Iterator>(), find_captures(pattern)));
auto it = begin;
for (; end != it; ++it) {
if (auto out = evaluate(begin, it, end, return_type{}, ctll::list<start_mark, Pattern, end_mark, accept>())) {
return out;
}
}
// in case the RE is empty
return evaluate(begin, it, end, return_type{}, ctll::list<start_mark, Pattern, end_mark, accept>());
}
// sink for making the errors shorter
template <typename R, typename Iterator, typename EndIterator>
constexpr CTRE_FORCE_INLINE R evaluate(const Iterator, Iterator, const EndIterator, R, ...) noexcept {
return R{};
}
// if we found "accept" object on stack => ACCEPT
template <typename R, typename Iterator, typename EndIterator>
constexpr CTRE_FORCE_INLINE R evaluate(const Iterator, Iterator, const EndIterator, R captures, ctll::list<accept>) noexcept {
return captures.matched();
}
// if we found "reject" object on stack => REJECT
template <typename R, typename... Rest, typename Iterator, typename EndIterator>
constexpr CTRE_FORCE_INLINE R evaluate(const Iterator, Iterator, const EndIterator, R, ctll::list<reject, Rest...>) noexcept {
return R{}; // just return not matched return type
}
// mark start of outer capture
template <typename R, typename Iterator, typename EndIterator, typename... Tail>
constexpr CTRE_FORCE_INLINE R evaluate(const Iterator begin, Iterator current, const EndIterator end, R captures, ctll::list<start_mark, Tail...>) noexcept {
return evaluate(begin, current, end, captures.set_start_mark(current), ctll::list<Tail...>());
}
// mark end of outer capture
template <typename R, typename Iterator, typename EndIterator, typename... Tail>
constexpr CTRE_FORCE_INLINE R evaluate(const Iterator begin, Iterator current, const EndIterator end, R captures, ctll::list<end_mark, Tail...>) noexcept {
return evaluate(begin, current, end, captures.set_end_mark(current), ctll::list<Tail...>());
}
// mark end of cycle
template <typename R, typename Iterator, typename EndIterator, typename... Tail>
constexpr CTRE_FORCE_INLINE R evaluate(const Iterator, Iterator current, const EndIterator, R captures, ctll::list<end_cycle_mark>) noexcept {
return captures.set_end_mark(current).matched();
}
// matching everything which behave as a one character matcher
template <typename R, typename Iterator, typename EndIterator, typename CharacterLike, typename... Tail, typename = std::enable_if_t<(MatchesCharacter<CharacterLike>::template value<decltype(*std::declval<Iterator>())>)>>
constexpr CTRE_FORCE_INLINE R evaluate(const Iterator begin, Iterator current, const EndIterator end, R captures, ctll::list<CharacterLike, Tail...>) noexcept {
if (end == current) return not_matched;
if (!CharacterLike::match_char(*current)) return not_matched;
return evaluate(begin, current+1, end, captures, ctll::list<Tail...>());
}
// matching strings in patterns
template <typename Iterator> struct string_match_result {
Iterator current;
bool match;
};
template <auto Head, auto... String, typename Iterator, typename EndIterator> constexpr CTRE_FORCE_INLINE string_match_result<Iterator> evaluate_match_string(Iterator current, const EndIterator end) noexcept {
if ((end != current) && (Head == *current)) {
if constexpr (sizeof...(String) > 0) {
return evaluate_match_string<String...>(++current, end);
} else {
return {++current, true};
}
} else {
return {current, false}; // not needed but will optimize
}
}
template <typename R, typename Iterator, typename EndIterator, auto... String, typename... Tail>
constexpr CTRE_FORCE_INLINE R evaluate(const Iterator begin, Iterator current, const EndIterator end, R captures, ctll::list<string<String...>, Tail...>) noexcept {
if constexpr (sizeof...(String) == 0) {
return evaluate(begin, current, end, captures, ctll::list<Tail...>());
} else if (auto tmp = evaluate_match_string<String...>(current, end); tmp.match) {
return evaluate(begin, tmp.current, end, captures, ctll::list<Tail...>());
} else {
return not_matched;
}
}
// matching select in patterns
template <typename R, typename Iterator, typename EndIterator, typename HeadOptions, typename... TailOptions, typename... Tail>
constexpr CTRE_FORCE_INLINE R evaluate(const Iterator begin, Iterator current, const EndIterator end, R captures, ctll::list<select<HeadOptions, TailOptions...>, Tail...>) noexcept {
if (auto r = evaluate(begin, current, end, captures, ctll::list<HeadOptions, Tail...>())) {
return r;
} else {
return evaluate(begin, current, end, captures, ctll::list<select<TailOptions...>, Tail...>());
}
}
template <typename R, typename Iterator, typename EndIterator, typename... Tail>
constexpr CTRE_FORCE_INLINE R evaluate(const Iterator, Iterator, const EndIterator, R, ctll::list<select<>, Tail...>) noexcept {
// no previous option was matched => REJECT
return not_matched;
}
// matching optional in patterns
template <typename R, typename Iterator, typename EndIterator, typename... Content, typename... Tail>
constexpr CTRE_FORCE_INLINE R evaluate(const Iterator begin, Iterator current, const EndIterator end, R captures, ctll::list<optional<Content...>, Tail...>) noexcept {
if (auto r1 = evaluate(begin, current, end, captures, ctll::list<sequence<Content...>, Tail...>())) {
return r1;
} else if (auto r2 = evaluate(begin, current, end, captures, ctll::list<Tail...>())) {
return r2;
} else {
return not_matched;
}
}
// lazy optional
template <typename R, typename Iterator, typename EndIterator, typename... Content, typename... Tail>
constexpr CTRE_FORCE_INLINE R evaluate(const Iterator begin, Iterator current, const EndIterator end, R captures, ctll::list<lazy_optional<Content...>, Tail...>) noexcept {
if (auto r1 = evaluate(begin, current, end, captures, ctll::list<Tail...>())) {
return r1;
} else if (auto r2 = evaluate(begin, current, end, captures, ctll::list<sequence<Content...>, Tail...>())) {
return r2;
} else {
return not_matched;
}
}
// matching sequence in patterns
template <typename R, typename Iterator, typename EndIterator, typename HeadContent, typename... TailContent, typename... Tail>
constexpr CTRE_FORCE_INLINE R evaluate(const Iterator begin, Iterator current, const EndIterator end, R captures, ctll::list<sequence<HeadContent, TailContent...>, Tail...>) noexcept {
if constexpr (sizeof...(TailContent) > 0) {
return evaluate(begin, current, end, captures, ctll::list<HeadContent, sequence<TailContent...>, Tail...>());
} else {
return evaluate(begin, current, end, captures, ctll::list<HeadContent, Tail...>());
}
}
// matching empty in patterns
template <typename R, typename Iterator, typename EndIterator, typename... Tail>
constexpr CTRE_FORCE_INLINE R evaluate(const Iterator begin, Iterator current, const EndIterator end, R captures, ctll::list<empty, Tail...>) noexcept {
return evaluate(begin, current, end, captures, ctll::list<Tail...>());
}
// matching asserts
template <typename R, typename Iterator, typename EndIterator, typename... Tail>
constexpr CTRE_FORCE_INLINE R evaluate(const Iterator begin, Iterator current, const EndIterator end, R captures, ctll::list<assert_begin, Tail...>) noexcept {
if (begin != current) {
return not_matched;
}
return evaluate(begin, current, end, captures, ctll::list<Tail...>());
}
template <typename R, typename Iterator, typename EndIterator, typename... Tail>
constexpr CTRE_FORCE_INLINE R evaluate(const Iterator begin, Iterator current, const EndIterator end, R captures, ctll::list<assert_end, Tail...>) noexcept {
if (end != current) {
return not_matched;
}
return evaluate(begin, current, end, captures, ctll::list<Tail...>());
}
// lazy repeat
template <typename R, typename Iterator, typename EndIterator, size_t A, size_t B, typename... Content, typename... Tail>
constexpr CTRE_FORCE_INLINE R evaluate(const Iterator begin, Iterator current, const EndIterator end, R captures, ctll::list<lazy_repeat<A,B,Content...>, Tail...>) noexcept {
// A..B
size_t i{0};
for (; i < A && (A != 0); ++i) {
if (auto outer_result = evaluate(begin, current, end, captures, ctll::list<sequence<Content...>, end_cycle_mark>())) {
captures = outer_result.unmatch();
current = outer_result.get_end_position();
} else {
return not_matched;
}
}
if (auto outer_result = evaluate(begin, current, end, captures, ctll::list<Tail...>())) {
return outer_result;
} else {
for (; (i < B) || (B == 0); ++i) {
if (auto inner_result = evaluate(begin, current, end, captures, ctll::list<sequence<Content...>, end_cycle_mark>())) {
if (auto outer_result = evaluate(begin, inner_result.get_end_position(), end, inner_result.unmatch(), ctll::list<Tail...>())) {
return outer_result;
} else {
captures = inner_result.unmatch();
current = inner_result.get_end_position();
continue;
}
} else {
return not_matched;
}
}
return evaluate(begin, current, end, captures, ctll::list<Tail...>());
}
}
// possessive repeat
template <typename R, typename Iterator, typename EndIterator, size_t A, size_t B, typename... Content, typename... Tail>
constexpr CTRE_FORCE_INLINE R evaluate(const Iterator begin, Iterator current, const EndIterator end, R captures, ctll::list<possessive_repeat<A,B,Content...>, Tail...>) noexcept {
for (size_t i{0}; (i < B) || (B == 0); ++i) {
// try as many of inner as possible and then try outer once
if (auto inner_result = evaluate(begin, current, end, captures, ctll::list<sequence<Content...>, end_cycle_mark>())) {
captures = inner_result.unmatch();
current = inner_result.get_end_position();
} else {
if (i < A && (A != 0)) return not_matched;
else return evaluate(begin, current, end, captures, ctll::list<Tail...>());
}
}
return evaluate(begin, current, end, captures, ctll::list<Tail...>());
}
// (gready) repeat
template <typename R, typename Iterator, typename EndIterator, size_t A, size_t B, typename... Content, typename... Tail>
#ifdef CTRE_MSVC_GREEDY_WORKAROUND
constexpr inline void evaluate_recursive(R & result, size_t i, const Iterator begin, Iterator current, const EndIterator end, R captures, ctll::list<repeat<A,B,Content...>, Tail...> stack) {
#else
constexpr inline R evaluate_recursive(size_t i, const Iterator begin, Iterator current, const EndIterator end, R captures, ctll::list<repeat<A,B,Content...>, Tail...> stack) {
#endif
if ((B == 0) || (i < B)) {
// a*ab
// aab
if (auto inner_result = evaluate(begin, current, end, captures, ctll::list<sequence<Content...>, end_cycle_mark>())) {
// TODO MSVC issue:
// if I uncomment this return it will not fail in constexpr (but the matching result will not be correct)
// return inner_result
// I tried to add all constructors to R but without any success
#ifdef CTRE_MSVC_GREEDY_WORKAROUND
evaluate_recursive(result, i+1, begin, inner_result.get_end_position(), end, inner_result.unmatch(), stack);
if (result) {
return;
}
#else
if (auto rec_result = evaluate_recursive(i+1, begin, inner_result.get_end_position(), end, inner_result.unmatch(), stack)) {
return rec_result;
}
#endif
}
}
#ifdef CTRE_MSVC_GREEDY_WORKAROUND
result = evaluate(begin, current, end, captures, ctll::list<Tail...>());
#else
return evaluate(begin, current, end, captures, ctll::list<Tail...>());
#endif
}
// (gready) repeat optimization
// basic one, if you are at the end of RE, just change it into possessive
// TODO do the same if there is no collision with rest of the RE
template <typename R, typename Iterator, typename EndIterator, size_t A, size_t B, typename... Content, typename... Tail>
constexpr CTRE_FORCE_INLINE R evaluate(const Iterator begin, Iterator current, const EndIterator end, R captures, ctll::list<repeat<A,B,Content...>,assert_end, Tail...>) {
return evaluate(begin, current, end, captures, ctll::list<possessive_repeat<A,B,Content...>, assert_end, Tail...>());
}
template <typename... T> struct identify_type;
// (greedy) repeat
template <typename R, typename Iterator, typename EndIterator, size_t A, size_t B, typename... Content, typename... Tail>
constexpr CTRE_FORCE_INLINE R evaluate(const Iterator begin, Iterator current, const EndIterator end, R captures, [[maybe_unused]] ctll::list<repeat<A,B,Content...>, Tail...> stack) {
// check if it can be optimized
#ifndef CTRE_DISABLE_GREEDY_OPT
if constexpr (collides(calculate_first(Content{}...), calculate_first(Tail{}...))) {
#endif
// A..B
size_t i{0};
for (; i < A && (A != 0); ++i) {
if (auto inner_result = evaluate(begin, current, end, captures, ctll::list<sequence<Content...>, end_cycle_mark>())) {
captures = inner_result.unmatch();
current = inner_result.get_end_position();
} else {
return not_matched;
}
}
#ifdef CTRE_MSVC_GREEDY_WORKAROUND
R result;
evaluate_recursive(result, i, begin, current, end, captures, stack);
return result;
#else
return evaluate_recursive(i, begin, current, end, captures, stack);
#endif
#ifndef CTRE_DISABLE_GREEDY_OPT
} else {
// if there is no collision we can go possessive
return evaluate(begin, current, end, captures, ctll::list<possessive_repeat<A,B,Content...>, Tail...>());
}
#endif
}
// repeat lazy_star
template <typename R, typename Iterator, typename EndIterator, typename... Content, typename... Tail>
constexpr CTRE_FORCE_INLINE R evaluate(const Iterator begin, Iterator current, const EndIterator end, R captures, ctll::list<lazy_star<Content...>, Tail...>) noexcept {
return evaluate(begin, current, end, captures, ctll::list<lazy_repeat<0,0,Content...>, Tail...>());
}
// repeat (lazy_plus)
template <typename R, typename Iterator, typename EndIterator, typename... Content, typename... Tail>
constexpr CTRE_FORCE_INLINE R evaluate(const Iterator begin, Iterator current, const EndIterator end, R captures, ctll::list<lazy_plus<Content...>, Tail...>) noexcept {
return evaluate(begin, current, end, captures, ctll::list<lazy_repeat<1,0,Content...>, Tail...>());
}
// repeat (possessive_star)
template <typename R, typename Iterator, typename EndIterator, typename... Content, typename... Tail>
constexpr CTRE_FORCE_INLINE R evaluate(const Iterator begin, Iterator current, const EndIterator end, R captures, ctll::list<possessive_star<Content...>, Tail...>) noexcept {
return evaluate(begin, current, end, captures, ctll::list<possessive_repeat<0,0,Content...>, Tail...>());
}
// repeat (possessive_plus)
template <typename R, typename Iterator, typename EndIterator, typename... Content, typename... Tail>
constexpr CTRE_FORCE_INLINE R evaluate(const Iterator begin, Iterator current, const EndIterator end, R captures, ctll::list<possessive_plus<Content...>, Tail...>) noexcept {
return evaluate(begin, current, end, captures, ctll::list<possessive_repeat<1,0,Content...>, Tail...>());
}
// repeat (greedy) star
template <typename R, typename Iterator, typename EndIterator, typename... Content, typename... Tail>
constexpr CTRE_FORCE_INLINE R evaluate(const Iterator begin, Iterator current, const EndIterator end, R captures, ctll::list<star<Content...>, Tail...>) noexcept {
return evaluate(begin, current, end, captures, ctll::list<repeat<0,0,Content...>, Tail...>());
}
// repeat (greedy) plus
template <typename R, typename Iterator, typename EndIterator, typename... Content, typename... Tail>
constexpr CTRE_FORCE_INLINE R evaluate(const Iterator begin, Iterator current, const EndIterator end, R captures, ctll::list<plus<Content...>, Tail...>) noexcept {
return evaluate(begin, current, end, captures, ctll::list<repeat<1,0,Content...>, Tail...>());
}
// capture (numeric ID)
template <typename R, typename Iterator, typename EndIterator, size_t Id, typename... Content, typename... Tail>
constexpr CTRE_FORCE_INLINE R evaluate(const Iterator begin, Iterator current, const EndIterator end, R captures, ctll::list<capture<Id, Content...>, Tail...>) noexcept {
return evaluate(begin, current, end, captures.template start_capture<Id>(current), ctll::list<sequence<Content...>, numeric_mark<Id>, Tail...>());
}
// capture end mark (numeric and string ID)
template <typename R, typename Iterator, typename EndIterator, size_t Id, typename... Tail>
constexpr CTRE_FORCE_INLINE R evaluate(const Iterator begin, Iterator current, const EndIterator end, R captures, ctll::list<numeric_mark<Id>, Tail...>) noexcept {
return evaluate(begin, current, end, captures.template end_capture<Id>(current), ctll::list<Tail...>());
}
// capture (string ID)
template <typename R, typename Iterator, typename EndIterator, size_t Id, typename Name, typename... Content, typename... Tail>
constexpr CTRE_FORCE_INLINE R evaluate(const Iterator begin, Iterator current, const EndIterator end, R captures, ctll::list<capture_with_name<Id, Name, Content...>, Tail...>) noexcept {
return evaluate(begin, current, end, captures.template start_capture<Id>(current), ctll::list<sequence<Content...>, numeric_mark<Id>, Tail...>());
}
// backreference support (match agains content of iterators)
template <typename Iterator, typename EndIterator> constexpr CTRE_FORCE_INLINE string_match_result<Iterator> match_against_range(Iterator current, const EndIterator end, Iterator range_current, const Iterator range_end) noexcept {
while (end != current && range_end != range_current) {
if (*current == *range_current) {
current++;
range_current++;
} else {
return {current, false};
}
}
return {current, range_current == range_end};
}
// backreference with name
template <typename R, typename Id, typename Iterator, typename EndIterator, typename... Tail>
constexpr CTRE_FORCE_INLINE R evaluate(const Iterator begin, Iterator current, const EndIterator end, R captures, ctll::list<back_reference_with_name<Id>, Tail...>) noexcept {
if (const auto ref = captures.template get<Id>()) {
if (auto tmp = match_against_range(current, end, ref.begin(), ref.end()); tmp.match) {
return evaluate(begin, tmp.current, end, captures, ctll::list<Tail...>());
}
}
return not_matched;
}
// backreference
template <typename R, size_t Id, typename Iterator, typename EndIterator, typename... Tail>
constexpr CTRE_FORCE_INLINE R evaluate(const Iterator begin, Iterator current, const EndIterator end, R captures, ctll::list<back_reference<Id>, Tail...>) noexcept {
if (const auto ref = captures.template get<Id>()) {
if (auto tmp = match_against_range(current, end, ref.begin(), ref.end()); tmp.match) {
return evaluate(begin, tmp.current, end, captures, ctll::list<Tail...>());
}
}
return not_matched;
}
// end of lookahead
template <typename R, typename Iterator, typename EndIterator, typename... Tail>
constexpr CTRE_FORCE_INLINE R evaluate(const Iterator, Iterator, const EndIterator, R captures, ctll::list<end_lookahead_mark>) noexcept {
return captures.matched();
}
// lookahead positive
template <typename R, typename Iterator, typename EndIterator, typename... Content, typename... Tail>
constexpr CTRE_FORCE_INLINE R evaluate(const Iterator begin, Iterator current, const EndIterator end, R captures, ctll::list<lookahead_positive<Content...>, Tail...>) noexcept {
if (auto lookahead_result = evaluate(begin, current, end, captures, ctll::list<sequence<Content...>, end_lookahead_mark>())) {
captures = lookahead_result.unmatch();
return evaluate(begin, current, end, captures, ctll::list<Tail...>());
} else {
return not_matched;
}
}
// lookahead negative
template <typename R, typename Iterator, typename EndIterator, typename... Content, typename... Tail>
constexpr CTRE_FORCE_INLINE R evaluate(const Iterator begin, Iterator current, const EndIterator end, R captures, ctll::list<lookahead_negative<Content...>, Tail...>) noexcept {
if (auto lookahead_result = evaluate(begin, current, end, captures, ctll::list<sequence<Content...>, end_lookahead_mark>())) {
return not_matched;
} else {
return evaluate(begin, current, end, captures, ctll::list<Tail...>());
}
}
// property matching
}
#endif
#ifndef CTRE__WRAPPER__HPP
#define CTRE__WRAPPER__HPP
#include <string_view>
#include <string>
namespace ctre {
struct zero_terminated_string_end_iterator {
constexpr inline zero_terminated_string_end_iterator() = default;
constexpr CTRE_FORCE_INLINE bool operator==(const char * ptr) const noexcept {
return *ptr == '\0';
}
constexpr CTRE_FORCE_INLINE bool operator==(const wchar_t * ptr) const noexcept {
return *ptr == 0;
}
constexpr CTRE_FORCE_INLINE bool operator!=(const char * ptr) const noexcept {
return *ptr != '\0';
}
constexpr CTRE_FORCE_INLINE bool operator!=(const wchar_t * ptr) const noexcept {
return *ptr != 0;
}
};
template <typename T> class RangeLikeType {
template <typename Y> static auto test(Y *) -> decltype(std::declval<const Y &>().begin(), std::declval<const Y &>().end(), std::true_type());
template <typename> static auto test(...) -> std::false_type;
public:
static inline constexpr bool value = decltype(test<std::remove_reference_t<std::remove_const_t<T>>>( nullptr ))::value;
};
template <typename RE> struct regular_expression {
template <typename IteratorBegin, typename IteratorEnd> constexpr CTRE_FORCE_INLINE static auto match_2(IteratorBegin begin, IteratorEnd end) noexcept {
return match_re(begin, end, RE());
}
template <typename IteratorBegin, typename IteratorEnd> constexpr CTRE_FORCE_INLINE static auto search_2(IteratorBegin begin, IteratorEnd end) noexcept {
return search_re(begin, end, RE());
}
constexpr CTRE_FORCE_INLINE regular_expression() noexcept { }
constexpr CTRE_FORCE_INLINE regular_expression(RE) noexcept { }
template <typename Iterator> constexpr CTRE_FORCE_INLINE static auto match(Iterator begin, Iterator end) noexcept {
return match_re(begin, end, RE());
}
static constexpr CTRE_FORCE_INLINE auto match(const char * s) noexcept {
return match_2(s, zero_terminated_string_end_iterator());
}
static constexpr CTRE_FORCE_INLINE auto match(const wchar_t * s) noexcept {
return match_2(s, zero_terminated_string_end_iterator());
}
static constexpr CTRE_FORCE_INLINE auto match(const std::string & s) noexcept {
return match_2(s.c_str(), zero_terminated_string_end_iterator());
}
static constexpr CTRE_FORCE_INLINE auto match(const std::wstring & s) noexcept {
return match_2(s.c_str(), zero_terminated_string_end_iterator());
}
static constexpr CTRE_FORCE_INLINE auto match(std::string_view sv) noexcept {
return match(sv.begin(), sv.end());
}
static constexpr CTRE_FORCE_INLINE auto match(std::wstring_view sv) noexcept {
return match(sv.begin(), sv.end());
}
static constexpr CTRE_FORCE_INLINE auto match(std::u16string_view sv) noexcept {
return match(sv.begin(), sv.end());
}
static constexpr CTRE_FORCE_INLINE auto match(std::u32string_view sv) noexcept {
return match(sv.begin(), sv.end());
}
template <typename Range, typename = typename std::enable_if<RangeLikeType<Range>::value>::type> static constexpr CTRE_FORCE_INLINE auto match(Range && range) noexcept {
return match(std::begin(range), std::end(range));
}
template <typename Iterator> constexpr CTRE_FORCE_INLINE static auto search(Iterator begin, Iterator end) noexcept {
return search_re(begin, end, RE());
}
constexpr CTRE_FORCE_INLINE static auto search(const char * s) noexcept {
return search_2(s, zero_terminated_string_end_iterator());
}
static constexpr CTRE_FORCE_INLINE auto search(const wchar_t * s) noexcept {
return search_2(s, zero_terminated_string_end_iterator());
}
static constexpr CTRE_FORCE_INLINE auto search(const std::string & s) noexcept {
return search_2(s.c_str(), zero_terminated_string_end_iterator());
}
static constexpr CTRE_FORCE_INLINE auto search(const std::wstring & s) noexcept {
return search_2(s.c_str(), zero_terminated_string_end_iterator());
}
static constexpr CTRE_FORCE_INLINE auto search(std::string_view sv) noexcept {
return search(sv.begin(), sv.end());
}
static constexpr CTRE_FORCE_INLINE auto search(std::wstring_view sv) noexcept {
return search(sv.begin(), sv.end());
}
static constexpr CTRE_FORCE_INLINE auto search(std::u16string_view sv) noexcept {
return search(sv.begin(), sv.end());
}
static constexpr CTRE_FORCE_INLINE auto search(std::u32string_view sv) noexcept {
return search(sv.begin(), sv.end());
}
template <typename Range> static constexpr CTRE_FORCE_INLINE auto search(Range && range) noexcept {
return search(std::begin(range), std::end(range));
}
};
template <typename RE> regular_expression(RE) -> regular_expression<RE>;
}
#endif
#ifndef __EDG__
namespace ctre {
// in C++17 (clang & gcc with gnu extension) we need translate character pack into ctll::fixed_string
// in C++20 we have `class nontype template parameters`
#if !(__cpp_nontype_template_parameter_class || (__cpp_nontype_template_args >= 201911L))
template <typename CharT, CharT... input> static inline constexpr auto _fixed_string_reference = ctll::fixed_string< sizeof...(input)>({input...});
#endif
namespace literals {
// clang and GCC <9 supports LITERALS with packs
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wgnu-string-literal-operator-template"
#define CTRE_ENABLE_LITERALS
#endif
#ifdef __INTEL_COMPILER
// not enable literals
#elif defined __GNUC__
#if not(__GNUC__ == 9)
#define CTRE_ENABLE_LITERALS
#endif
#endif
#ifdef CTRE_ENABLE_LITERALS
// add this when we will have concepts
// requires ctll::parser<ctre::pcre, _fixed_string_reference<CharT, charpack...>, ctre::pcre_actions>::template correct_with<pcre_context<>>
#if !(__cpp_nontype_template_parameter_class || (__cpp_nontype_template_args >= 201911L))
template <typename CharT, CharT... charpack> CTRE_FLATTEN constexpr CTRE_FORCE_INLINE auto operator""_ctre() noexcept {
constexpr auto & _input = _fixed_string_reference<CharT, charpack...>;
#else
template <ctll::fixed_string input> CTRE_FLATTEN constexpr CTRE_FORCE_INLINE auto operator""_ctre() noexcept {
constexpr auto _input = input; // workaround for GCC 9 bug 88092
#endif
using tmp = typename ctll::parser<ctre::pcre, _input, ctre::pcre_actions>::template output<pcre_context<>>;
static_assert(tmp(), "Regular Expression contains syntax error.");
if constexpr (tmp()) {
using re = decltype(front(typename tmp::output_type::stack_type()));
return ctre::regular_expression(re());
} else {
return ctre::regular_expression(reject());
}
}
// this will need to be fixed with C++20
#if !(__cpp_nontype_template_parameter_class || (__cpp_nontype_template_args >= 201911L))
template <typename CharT, CharT... charpack> CTRE_FLATTEN constexpr CTRE_FORCE_INLINE auto operator""_ctre_id() noexcept {
return id<charpack...>();
}
#endif
#endif // CTRE_ENABLE_LITERALS
}
namespace test_literals {
#ifdef CTRE_ENABLE_LITERALS
#if !(__cpp_nontype_template_parameter_class || (__cpp_nontype_template_args >= 201911L))
template <typename CharT, CharT... charpack> CTRE_FLATTEN constexpr inline auto operator""_ctre_test() noexcept {
constexpr auto & _input = _fixed_string_reference<CharT, charpack...>;
#else
template <ctll::fixed_string input> CTRE_FLATTEN constexpr inline auto operator""_ctre_test() noexcept {
constexpr auto _input = input; // workaround for GCC 9 bug 88092
#endif
return ctll::parser<ctre::pcre, _input>::template correct_with<>;
}
#if !(__cpp_nontype_template_parameter_class || (__cpp_nontype_template_args >= 201911L))
template <typename CharT, CharT... charpack> CTRE_FLATTEN constexpr inline auto operator""_ctre_gen() noexcept {
constexpr auto & _input = _fixed_string_reference<CharT, charpack...>;
#else
template <ctll::fixed_string input> CTRE_FLATTEN constexpr inline auto operator""_ctre_gen() noexcept {
constexpr auto _input = input; // workaround for GCC 9 bug 88092
#endif
using tmp = typename ctll::parser<ctre::pcre, _input, ctre::pcre_actions>::template output<pcre_context<>>;
static_assert(tmp(), "Regular Expression contains syntax error.");
return typename tmp::output_type::stack_type();
}
#if !(__cpp_nontype_template_parameter_class || (__cpp_nontype_template_args >= 201911L))
template <typename CharT, CharT... charpack> CTRE_FLATTEN constexpr CTRE_FORCE_INLINE auto operator""_ctre_syntax() noexcept {
constexpr auto & _input = _fixed_string_reference<CharT, charpack...>;
#else
template <ctll::fixed_string input> CTRE_FLATTEN constexpr CTRE_FORCE_INLINE auto operator""_ctre_syntax() noexcept {
constexpr auto _input = input; // workaround for GCC 9 bug 88092
#endif
return ctll::parser<ctre::pcre, _input, ctre::pcre_actions>::template correct_with<pcre_context<>>;
}
#endif
#ifdef __clang__
#pragma clang diagnostic pop
#endif
} // literals
} // ctre
#endif
#endif
#ifndef CTRE_V2__CTRE__FUNCTIONS__HPP
#define CTRE_V2__CTRE__FUNCTIONS__HPP
namespace ctre {
#if !(__cpp_nontype_template_parameter_class || (__cpp_nontype_template_args >= 201911L))
// avoiding CTAD limitation in C++17
template <typename CharT, size_t N> class pattern: public ctll::fixed_string<N> {
using parent = ctll::fixed_string<N>;
public:
constexpr pattern(const CharT (&input)[N]) noexcept: parent(input) { }
};
template <typename CharT, size_t N> pattern(const CharT (&)[N]) -> pattern<CharT, N>;
// for better examples
template <typename CharT, size_t N> class fixed_string: public ctll::fixed_string<N> {
using parent = ctll::fixed_string<N>;
public:
constexpr fixed_string(const CharT (&input)[N]) noexcept: parent(input) { }
};
template <typename CharT, size_t N> fixed_string(const CharT (&)[N]) -> fixed_string<CharT, N>;
#endif
#if (__cpp_nontype_template_parameter_class || (__cpp_nontype_template_args >= 201911L))
template <ctll::fixed_string input> CTRE_FLATTEN constexpr CTRE_FORCE_INLINE auto re() noexcept {
constexpr auto _input = input; // workaround for GCC 9 bug 88092
#else
template <auto & input> CTRE_FLATTEN constexpr CTRE_FORCE_INLINE auto re() noexcept {
constexpr auto & _input = input;
#endif
using tmp = typename ctll::parser<ctre::pcre, _input, ctre::pcre_actions>::template output<pcre_context<>>;
static_assert(tmp(), "Regular Expression contains syntax error.");
using re = decltype(front(typename tmp::output_type::stack_type()));
return ctre::regular_expression(re());
}
// in moment when we get C++20 support this will start to work :)
template <typename RE> struct regex_match_t {
template <typename... Args> CTRE_FORCE_INLINE constexpr auto operator()(Args && ... args) const noexcept {
auto re_obj = ctre::regular_expression<RE>();
return re_obj.match(std::forward<Args>(args)...);
}
template <typename... Args> CTRE_FORCE_INLINE constexpr auto try_extract(Args && ... args) const noexcept {
return operator()(std::forward<Args>(args)...);
}
};
template <typename RE> struct regex_search_t {
template <typename... Args> CTRE_FORCE_INLINE constexpr auto operator()(Args && ... args) const noexcept {
auto re_obj = ctre::regular_expression<RE>();
return re_obj.search(std::forward<Args>(args)...);
}
template <typename... Args> CTRE_FORCE_INLINE constexpr auto try_extract(Args && ... args) const noexcept {
return operator()(std::forward<Args>(args)...);
}
};
#if (__cpp_nontype_template_parameter_class || (__cpp_nontype_template_args >= 201911L))
template <auto input> struct regex_builder {
static constexpr auto _input = input;
using _tmp = typename ctll::parser<ctre::pcre, _input, ctre::pcre_actions>::template output<pcre_context<>>;
static_assert(_tmp(), "Regular Expression contains syntax error.");
using type = ctll::conditional<(bool)(_tmp()), decltype(ctll::front(typename _tmp::output_type::stack_type())), ctll::list<reject>>;
};
template <ctll::fixed_string input> static constexpr inline auto match = regex_match_t<typename regex_builder<input>::type>();
template <ctll::fixed_string input> static constexpr inline auto search = regex_search_t<typename regex_builder<input>::type>();
#else
template <auto & input> struct regex_builder {
using _tmp = typename ctll::parser<ctre::pcre, input, ctre::pcre_actions>::template output<pcre_context<>>;
static_assert(_tmp(), "Regular Expression contains syntax error.");
using type = ctll::conditional<(bool)(_tmp()), decltype(ctll::front(typename _tmp::output_type::stack_type())), ctll::list<reject>>;
};
template <auto & input> static constexpr inline auto match = regex_match_t<typename regex_builder<input>::type>();
template <auto & input> static constexpr inline auto search = regex_search_t<typename regex_builder<input>::type>();
#endif
}
#endif
#ifndef CTRE_V2__CTRE__ITERATOR__HPP
#define CTRE_V2__CTRE__ITERATOR__HPP
namespace ctre {
struct regex_end_iterator {
constexpr regex_end_iterator() noexcept { }
};
template <typename BeginIterator, typename EndIterator, typename RE> struct regex_iterator {
BeginIterator current;
const EndIterator end;
decltype(RE::search_2(std::declval<BeginIterator>(), std::declval<EndIterator>())) current_match;
constexpr regex_iterator(BeginIterator begin, EndIterator end) noexcept: current{begin}, end{end}, current_match{RE::search_2(current, end)} {
if (current_match) {
current = current_match.template get<0>().end();
}
}
constexpr const auto & operator*() const noexcept {
return current_match;
}
constexpr regex_iterator & operator++() noexcept {
current_match = RE::search_2(current, end);
if (current_match) {
current = current_match.template get<0>().end();
}
return *this;
}
constexpr regex_iterator operator++(int) noexcept {
auto previous = *this;
current_match = RE::search_2(current, end);
if (current_match) {
current = current_match.template get<0>().end();
}
return previous;
}
};
template <typename BeginIterator, typename EndIterator, typename RE> constexpr bool operator!=(const regex_iterator<BeginIterator, EndIterator, RE> & left, regex_end_iterator) {
return bool(left.current_match);
}
template <typename BeginIterator, typename EndIterator, typename RE> constexpr bool operator!=(regex_end_iterator, const regex_iterator<BeginIterator, EndIterator, RE> & right) {
return bool(right.current_match);
}
template <typename BeginIterator, typename EndIterator, typename RE> constexpr auto iterator(BeginIterator begin, EndIterator end, RE) noexcept {
return regex_iterator<BeginIterator, EndIterator, RE>(begin, end);
}
constexpr auto iterator() noexcept {
return regex_end_iterator{};
}
template <typename Subject, typename RE> constexpr auto iterator(const Subject & subject, RE re) noexcept {
return iterator(subject.begin(), subject.end(), re);
}
#if (__cpp_nontype_template_parameter_class || (__cpp_nontype_template_args >= 201911L))
template <ctll::fixed_string input, typename BeginIterator, typename EndIterator> CTRE_FLATTEN constexpr CTRE_FORCE_INLINE auto iterator(BeginIterator begin, EndIterator end) noexcept {
constexpr auto _input = input;
using tmp = typename ctll::parser<ctre::pcre, _input, ctre::pcre_actions>::template output<pcre_context<>>;
static_assert(tmp(), "Regular Expression contains syntax error.");
using re = decltype(front(typename tmp::output_type::stack_type()));
return iterator(begin, end, re());
}
#endif
#if (__cpp_nontype_template_parameter_class || (__cpp_nontype_template_args >= 201911L))
template <ctll::fixed_string input, typename Subject> CTRE_FLATTEN constexpr CTRE_FORCE_INLINE auto iterator(const Subject & subject) noexcept {
constexpr auto _input = input;
using tmp = typename ctll::parser<ctre::pcre, _input, ctre::pcre_actions>::template output<pcre_context<>>;
static_assert(tmp(), "Regular Expression contains syntax error.");
using re = decltype(front(typename tmp::output_type::stack_type()));
return iterator(subject.begin(), subject.end(), re());
}
#endif
} // ctre
#endif
#ifndef CTRE_V2__CTRE__RANGE__HPP
#define CTRE_V2__CTRE__RANGE__HPP
namespace ctre {
template <typename BeginIterator, typename EndIterator, typename RE> struct regex_range {
BeginIterator _begin;
const EndIterator _end;
constexpr regex_range(BeginIterator begin, EndIterator end) noexcept: _begin{begin}, _end{end} { }
constexpr auto begin() const noexcept {
return regex_iterator<BeginIterator, EndIterator, RE>(_begin, _end);
}
constexpr auto end() const noexcept {
return regex_end_iterator{};
}
};
template <typename BeginIterator, typename EndIterator, typename RE> constexpr auto range(BeginIterator begin, EndIterator end, RE) noexcept {
return regex_range<BeginIterator, EndIterator, RE>(begin, end);
}
#if (__cpp_nontype_template_parameter_class || (__cpp_nontype_template_args >= 201911L))
template <ctll::fixed_string input, typename BeginIterator, typename EndIterator> constexpr auto range(BeginIterator begin, EndIterator end) noexcept {
constexpr auto _input = input;
using tmp = typename ctll::parser<ctre::pcre, _input, ctre::pcre_actions>::template output<pcre_context<>>;
static_assert(tmp(), "Regular Expression contains syntax error.");
using re = decltype(front(typename tmp::output_type::stack_type()));
auto re_obj = ctre::regular_expression(re());
return range(begin, end, re_obj);
}
#endif
template <typename Subject, typename RE> constexpr auto range(const Subject & subject, RE re) noexcept {
return range(subject.begin(), subject.end(), re);
}
template <typename RE> constexpr auto range(const char * subject, RE re) noexcept {
return range(subject, zero_terminated_string_end_iterator(), re);
}
#if (__cpp_nontype_template_parameter_class || (__cpp_nontype_template_args >= 201911L))
template <ctll::fixed_string input, typename Subject> constexpr auto range(const Subject & subject) noexcept {
constexpr auto _input = input;
using tmp = typename ctll::parser<ctre::pcre, _input, ctre::pcre_actions>::template output<pcre_context<>>;
static_assert(tmp(), "Regular Expression contains syntax error.");
using re = decltype(front(typename tmp::output_type::stack_type()));
auto re_obj = ctre::regular_expression(re());
return range(subject.begin(), subject.end(), re_obj);
}
#else
template <auto & input, typename Subject> constexpr auto range(const Subject & subject) noexcept {
constexpr auto & _input = input;
using tmp = typename ctll::parser<ctre::pcre, _input, ctre::pcre_actions>::template output<pcre_context<>>;
static_assert(tmp(), "Regular Expression contains syntax error.");
using re = decltype(front(typename tmp::output_type::stack_type()));
auto re_obj = ctre::regular_expression(re());
return range(subject.begin(), subject.end(), re_obj);
}
#endif
}
#endif
#ifndef CTRE_V2__CTRE__OPERATORS__HPP
#define CTRE_V2__CTRE__OPERATORS__HPP
template <typename A, typename B> constexpr auto operator|(ctre::regular_expression<A>, ctre::regular_expression<B>) -> ctre::regular_expression<ctre::select<A,B>> {
return {};
}
template <typename A, typename B> constexpr auto operator>>(ctre::regular_expression<A>, ctre::regular_expression<B>) -> ctre::regular_expression<ctre::sequence<A,B>> {
return {};
}
#endif
#endif
| mit |
samuilll/BeginnerExams | PrgrammingFundametnalsFast/09_FilesAndExeptions/Task01MostFrequentNumber/Properties/AssemblyInfo.cs | 1419 | using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Task01MostFrequentNumber")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Task01MostFrequentNumber")]
[assembly: AssemblyCopyright("Copyright © 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("fc0726c6-4524-4dda-abf4-b0cebe1fbb40")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
| mit |
fabstr/stackomat | User.php | 7228 | <?php
require_once('Exceptions.php');
require_once('log.php');
class User {
// the pdo handle
private $db;
// the id of this user
private $id;
public function __construct($db, $id) {
$this -> db = $db;
$this -> id = hash('SHA256', $id);
}
/**
* Add a user to the database.
* Hash the id with sha256 before adding to the database.
* @param db The pdo handle.
* @param id The id of the user to add.
* @param name The name of the user to add (can be the empty string).
* @param balance The initial balance of the user to add.
* @param calories The initial amount of calories eaten by the user.
* @return true if the user was added successfully, else false.
*/
public static function addUser($db, $id, $name, $balance, $calories) {
l('add user');
$s = $db -> prepare('
INSERT INTO users (id, name, balance, calories)
VALUES (:id, :name, :balance, :calories)');
$id = hash('SHA256', $id);
$s -> bindParam(':id', $id);
$s -> bindParam(':name', $name);
$s -> bindParam(':balance', $balance);
$s -> bindParam(':calories', $calories);
return $s -> execute();
}
/**
* Check if a user with the given id exists in the database.
* The id is hashed before checking in the database.
* @param db The pdo handle.
* @param id The id to check.
* @return true if the user exists, else false.
*/
public static function isUser($db, $id) {
l('isUser? ' . $id);
$id = hash('SHA256', $id);
$s = $db -> prepare('SELECT *, COUNT(*) AS cnt FROM users WHERE id=:id');
$s -> bindParam(':id', $id);
$s -> execute();
$res = $s -> fetch();
$result = $res['cnt'] > 0;
if ($result) l('isUser? yes');
else l('isUser? no');
return $result;
}
/**
* Get the name of this user by checking in the database.
* @return The name.
*/
public function getName() {
$s = $this -> db -> prepare('
SELECT name
FROM users
WHERE id=:id');
$s -> bindParam(':id', $id);
$s -> execute();
$row = $s -> fetch();
return $row['name'];
}
/**
* Get the amount of calories consumed by this user.
* @return The amount.
*/
public function getCalories() {
$s = $this -> db -> prepare('
SELECT calories
FROM users
WHERE id=:id');
$s -> bindParam(':id', $this -> id);
$s -> execute();
$row = $s -> fetch();
return $row['calories'];
}
/**
* Let the user pay.
* In a transaction, update the user's balance to balance - amount
* and update lastPurchase with amount. If both queries could be
* executed, commit and return true. Else, rollback and throw an
* exception.
*
* @param amount The amount to pay.
* @return true if the database could be updated.
*/
public function pay($amount) {
$this -> db -> beginTransaction();
$s = $this -> db -> prepare('
UPDATE users
SET balance = balance - :amount
WHERE id = :id');
$s -> bindParam(':amount', $amount);
$s -> bindParam(':id', $this -> id);
$p = $this -> db -> prepare('
INSERT INTO lastPurchase (id, amount)
VALUES (:id1, :amount1)
ON DUPLICATE KEY UPDATE id=:id2, amount=:amount2');
$p -> bindParam(':id1', $this -> id);
$p -> bindParam(':amount1', $amount);
$p -> bindParam(':id2', $this -> id);
$p -> bindParam(':amount2', $amount);
if ($s -> execute() && $p -> execute()) {
$this -> db -> commit();
return true;
} else {
$this -> db -> rollback();
throw new DatabaseException('Köpet kunde inte genomföras. '
. 'Saldot har inte belastats.');
}
}
/**
* Add amount to the user's balance.
* @param amount The amount to add.
* @return true if the database could be updated, else false.
*/
public function addBalance($amount) {
$s = $this -> db -> prepare('
UPDATE users
SET balance = balance + :amount
WHERE id = :id');
$s -> bindParam(':amount', $amount);
$s -> bindParam(':id', $this -> id);
return $s -> execute();
}
/**
* Get the balance of this user by checking in the database.
* @return The balance.
*/
public function getBalance() {
$s = $this -> db -> prepare('
SELECT balance
FROM users
WHERE id=:id');
$s -> bindParam(':id', $this -> id);
$s -> execute();
$result = $s -> fetch();
return $result['balance'];
}
/**
* Undo the user's last purchase.
* First get the amount from the last purchase. If this does not exist,
* throw an exception. If it does, update the user's balance and delete
* the row in lastPurchase. Return true if the updates was successfull,
* else false.
* @return true if the update was successfull, else false
*/
public function undoLatest() {
// get the amount
$s = $this -> db -> prepare('
SELECT amount
FROM lastPurchase
WHERE id=:id');
$s -> bindParam(':id', $this -> id);
$s -> execute();
$row = $s -> fetch();
$amount = $row['amount'];
if ($amount) {
// the amount exists so there is a purchase to undo
// begin the transaction
$this -> db -> beginTransaction();
// update the balance
$p = $this -> db -> prepare('
UPDATE users
SET balance = balance + :amount
WHERE id=:id;');
$p -> bindParam(':amount', $amount);
$p -> bindParam(':id', $this -> id);
// delete the row from lastPurchase
$q = $this -> db -> prepare('
DELETE FROM lastPurchase
WHERE id=:id;');
$q -> bindParam(':id', $this -> id);
// execute
if ($p -> execute() && $q -> execute()) {
$this -> db -> commit();
return true;
} else {
$this -> db -> rollback();
return false;
}
}
throw new NoUndoException('Det finns inget köp att ångra. Köp går '
.'endast att ångra en gång.');
}
/**
* Add (or remove) calories from this user.
* If amount is positive, add calories; if amount is negative, remove
* calories.
* @param amount The calories to add or remove.
* @return true if the change was successfull.
*/
public function addCalories($amount) {
$s = $this -> db -> prepare('
UPDATE users
SET calories = calories + :amount
WHERE id=:id');
$s -> bindParam(':amount', $amount);
$s -> bindParam(':id', $this -> id);
return $s -> execute();
}
/**
* Return true if the user counts calories.
* @return true if the user counts calories.
*/
public function countsCalories() {
$s = $this -> db -> prepare('
SELECT countCalories
FROM users
WHERE id=:id');
$s -> bindParam(':id', $this -> id);
$s -> execute();
$row = $s -> fetch();
if ($row['countCalories'] == 1) {
return true;
}
return false;
}
/**
* Toggle the user's calorie counting.
* If the user is not counting, make the user count calories.
* If the user is counting, set the calories to zero and disable
* counting.
* @return true if the change was succesfull.
*/
public function toggleCalories() {
if ($this -> countsCalories()) {
// disable counting
$s = $this -> db -> prepare('
UPDATE users
SET calories = 0, countCalories = 0
WHERE id=:id');
$s -> bindParam(':id', $this -> id);
return $s -> execute();
} else {
// enable counting
$s = $this -> db -> prepare('
UPDATE users
SET countCalories = 1
WHERE id=:id');
$s -> bindParam(':id', $this -> id);
return $s -> execute();
}
}
}
?>
| mit |
node-modules/cluster-client | test/supports/invoke.js | 1354 | 'use strict';
const co = require('co');
const is = require('is-type-of');
const assert = require('assert');
const cluster = require('../../');
const NotifyClient = require('./notify_client');
const client = cluster(NotifyClient, {
port: 6789,
transcode: {
encode(obj) {
if (is.date(obj)) {
return Buffer.from(JSON.stringify({
type: 'date',
data: obj.getTime(),
}));
} else if (is.buffer(obj)) {
return Buffer.from(JSON.stringify({
type: 'buffer',
data: obj.toString('hex'),
}));
}
return Buffer.from(JSON.stringify(obj));
},
decode(buf) {
const obj = JSON.parse(buf);
if (obj.type === 'date') {
return new Date(obj.data);
} else if (obj.type === 'buffer') {
return Buffer.from(obj.data, 'hex');
}
return obj;
},
},
})
.delegate('publish', 'invoke')
.create();
co(function* () {
let ret = yield client.commit('123', new Date());
assert(is.date(ret));
ret = yield client.commit('123', Buffer.from('hello'));
assert(is.buffer(ret) && ret.toString() === 'hello');
ret = yield client.commit('123', { name: 'peter' });
assert(is.object(ret) && ret.name === 'peter');
console.log('success');
process.exit(0);
}).catch(err => {
console.error(err);
process.exit(1);
});
| mit |
ltrem/cliniquecoderre2 | src/AppBundle/Form/UserRequestPasswordForm.php | 391 | <?php
namespace AppBundle\Form;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\EmailType;
use Symfony\Component\Form\FormBuilderInterface;
class UserRequestPasswordForm extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('email', EmailType::class);
}
}
| mit |
jelhan/croodle | public/assets/internet-explorer-11-deprecation.js | 1029 | var outerContainer = document.createElement('div');
outerContainer.style.display = 'flex';
outerContainer.style.height = '100vh';
var container = document.createElement('div');
container.style.alignSelf = 'center';
container.style.margin = 'auto';
container.style.maxWidth = '50rem';
container.style.textAlign = 'center';
outerContainer.appendChild(container);
var header = document.createElement('h2');
header.style.color = '#B33A3A';
var icon = document.createElement('span');
icon.className = 'oi oi-warning';
header.appendChild(icon);
header.appendChild(
document.createTextNode('Your Browser is not supported!')
);
header.appendChild(icon.cloneNode());
container.appendChild(header);
var text = document.createElement('p');
text.innerText =
'You are using an out-dated browser like Internet Explorer 11 that is not supported anymore by Croodle. ' +
'Please switch to a modern browser like Firefox, Google Chrome, Microsoft Edge or Safari.';
container.appendChild(text);
document.body.appendChild(outerContainer);
| mit |
andviro/grayproxy | vendor/github.com/weaveworks/common/httpgrpc/httpgrpc.pb.go | 26963 | // Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: github.com/weaveworks/common/httpgrpc/httpgrpc.proto
/*
Package httpgrpc is a generated protocol buffer package.
It is generated from these files:
github.com/weaveworks/common/httpgrpc/httpgrpc.proto
It has these top-level messages:
HTTPRequest
HTTPResponse
Header
*/
package httpgrpc
import proto "github.com/gogo/protobuf/proto"
import fmt "fmt"
import math "math"
import bytes "bytes"
import strings "strings"
import reflect "reflect"
import context "golang.org/x/net/context"
import grpc "google.golang.org/grpc"
import io "io"
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package
type HTTPRequest struct {
Method string `protobuf:"bytes,1,opt,name=method,proto3" json:"method,omitempty"`
Url string `protobuf:"bytes,2,opt,name=url,proto3" json:"url,omitempty"`
Headers []*Header `protobuf:"bytes,3,rep,name=headers" json:"headers,omitempty"`
Body []byte `protobuf:"bytes,4,opt,name=body,proto3" json:"body,omitempty"`
}
func (m *HTTPRequest) Reset() { *m = HTTPRequest{} }
func (*HTTPRequest) ProtoMessage() {}
func (*HTTPRequest) Descriptor() ([]byte, []int) { return fileDescriptorHttpgrpc, []int{0} }
func (m *HTTPRequest) GetMethod() string {
if m != nil {
return m.Method
}
return ""
}
func (m *HTTPRequest) GetUrl() string {
if m != nil {
return m.Url
}
return ""
}
func (m *HTTPRequest) GetHeaders() []*Header {
if m != nil {
return m.Headers
}
return nil
}
func (m *HTTPRequest) GetBody() []byte {
if m != nil {
return m.Body
}
return nil
}
type HTTPResponse struct {
Code int32 `protobuf:"varint,1,opt,name=Code,json=code,proto3" json:"Code,omitempty"`
Headers []*Header `protobuf:"bytes,2,rep,name=headers" json:"headers,omitempty"`
Body []byte `protobuf:"bytes,3,opt,name=body,proto3" json:"body,omitempty"`
}
func (m *HTTPResponse) Reset() { *m = HTTPResponse{} }
func (*HTTPResponse) ProtoMessage() {}
func (*HTTPResponse) Descriptor() ([]byte, []int) { return fileDescriptorHttpgrpc, []int{1} }
func (m *HTTPResponse) GetCode() int32 {
if m != nil {
return m.Code
}
return 0
}
func (m *HTTPResponse) GetHeaders() []*Header {
if m != nil {
return m.Headers
}
return nil
}
func (m *HTTPResponse) GetBody() []byte {
if m != nil {
return m.Body
}
return nil
}
type Header struct {
Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
Values []string `protobuf:"bytes,2,rep,name=values" json:"values,omitempty"`
}
func (m *Header) Reset() { *m = Header{} }
func (*Header) ProtoMessage() {}
func (*Header) Descriptor() ([]byte, []int) { return fileDescriptorHttpgrpc, []int{2} }
func (m *Header) GetKey() string {
if m != nil {
return m.Key
}
return ""
}
func (m *Header) GetValues() []string {
if m != nil {
return m.Values
}
return nil
}
func init() {
proto.RegisterType((*HTTPRequest)(nil), "httpgrpc.HTTPRequest")
proto.RegisterType((*HTTPResponse)(nil), "httpgrpc.HTTPResponse")
proto.RegisterType((*Header)(nil), "httpgrpc.Header")
}
func (this *HTTPRequest) Equal(that interface{}) bool {
if that == nil {
return this == nil
}
that1, ok := that.(*HTTPRequest)
if !ok {
that2, ok := that.(HTTPRequest)
if ok {
that1 = &that2
} else {
return false
}
}
if that1 == nil {
return this == nil
} else if this == nil {
return false
}
if this.Method != that1.Method {
return false
}
if this.Url != that1.Url {
return false
}
if len(this.Headers) != len(that1.Headers) {
return false
}
for i := range this.Headers {
if !this.Headers[i].Equal(that1.Headers[i]) {
return false
}
}
if !bytes.Equal(this.Body, that1.Body) {
return false
}
return true
}
func (this *HTTPResponse) Equal(that interface{}) bool {
if that == nil {
return this == nil
}
that1, ok := that.(*HTTPResponse)
if !ok {
that2, ok := that.(HTTPResponse)
if ok {
that1 = &that2
} else {
return false
}
}
if that1 == nil {
return this == nil
} else if this == nil {
return false
}
if this.Code != that1.Code {
return false
}
if len(this.Headers) != len(that1.Headers) {
return false
}
for i := range this.Headers {
if !this.Headers[i].Equal(that1.Headers[i]) {
return false
}
}
if !bytes.Equal(this.Body, that1.Body) {
return false
}
return true
}
func (this *Header) Equal(that interface{}) bool {
if that == nil {
return this == nil
}
that1, ok := that.(*Header)
if !ok {
that2, ok := that.(Header)
if ok {
that1 = &that2
} else {
return false
}
}
if that1 == nil {
return this == nil
} else if this == nil {
return false
}
if this.Key != that1.Key {
return false
}
if len(this.Values) != len(that1.Values) {
return false
}
for i := range this.Values {
if this.Values[i] != that1.Values[i] {
return false
}
}
return true
}
func (this *HTTPRequest) GoString() string {
if this == nil {
return "nil"
}
s := make([]string, 0, 8)
s = append(s, "&httpgrpc.HTTPRequest{")
s = append(s, "Method: "+fmt.Sprintf("%#v", this.Method)+",\n")
s = append(s, "Url: "+fmt.Sprintf("%#v", this.Url)+",\n")
if this.Headers != nil {
s = append(s, "Headers: "+fmt.Sprintf("%#v", this.Headers)+",\n")
}
s = append(s, "Body: "+fmt.Sprintf("%#v", this.Body)+",\n")
s = append(s, "}")
return strings.Join(s, "")
}
func (this *HTTPResponse) GoString() string {
if this == nil {
return "nil"
}
s := make([]string, 0, 7)
s = append(s, "&httpgrpc.HTTPResponse{")
s = append(s, "Code: "+fmt.Sprintf("%#v", this.Code)+",\n")
if this.Headers != nil {
s = append(s, "Headers: "+fmt.Sprintf("%#v", this.Headers)+",\n")
}
s = append(s, "Body: "+fmt.Sprintf("%#v", this.Body)+",\n")
s = append(s, "}")
return strings.Join(s, "")
}
func (this *Header) GoString() string {
if this == nil {
return "nil"
}
s := make([]string, 0, 6)
s = append(s, "&httpgrpc.Header{")
s = append(s, "Key: "+fmt.Sprintf("%#v", this.Key)+",\n")
s = append(s, "Values: "+fmt.Sprintf("%#v", this.Values)+",\n")
s = append(s, "}")
return strings.Join(s, "")
}
func valueToGoStringHttpgrpc(v interface{}, typ string) string {
rv := reflect.ValueOf(v)
if rv.IsNil() {
return "nil"
}
pv := reflect.Indirect(rv).Interface()
return fmt.Sprintf("func(v %v) *%v { return &v } ( %#v )", typ, typ, pv)
}
// Reference imports to suppress errors if they are not otherwise used.
var _ context.Context
var _ grpc.ClientConn
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
const _ = grpc.SupportPackageIsVersion4
// Client API for HTTP service
type HTTPClient interface {
Handle(ctx context.Context, in *HTTPRequest, opts ...grpc.CallOption) (*HTTPResponse, error)
}
type hTTPClient struct {
cc *grpc.ClientConn
}
func NewHTTPClient(cc *grpc.ClientConn) HTTPClient {
return &hTTPClient{cc}
}
func (c *hTTPClient) Handle(ctx context.Context, in *HTTPRequest, opts ...grpc.CallOption) (*HTTPResponse, error) {
out := new(HTTPResponse)
err := grpc.Invoke(ctx, "/httpgrpc.HTTP/Handle", in, out, c.cc, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// Server API for HTTP service
type HTTPServer interface {
Handle(context.Context, *HTTPRequest) (*HTTPResponse, error)
}
func RegisterHTTPServer(s *grpc.Server, srv HTTPServer) {
s.RegisterService(&_HTTP_serviceDesc, srv)
}
func _HTTP_Handle_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(HTTPRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(HTTPServer).Handle(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/httpgrpc.HTTP/Handle",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(HTTPServer).Handle(ctx, req.(*HTTPRequest))
}
return interceptor(ctx, in, info, handler)
}
var _HTTP_serviceDesc = grpc.ServiceDesc{
ServiceName: "httpgrpc.HTTP",
HandlerType: (*HTTPServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "Handle",
Handler: _HTTP_Handle_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "github.com/weaveworks/common/httpgrpc/httpgrpc.proto",
}
func (m *HTTPRequest) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA)
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *HTTPRequest) MarshalTo(dAtA []byte) (int, error) {
var i int
_ = i
var l int
_ = l
if len(m.Method) > 0 {
dAtA[i] = 0xa
i++
i = encodeVarintHttpgrpc(dAtA, i, uint64(len(m.Method)))
i += copy(dAtA[i:], m.Method)
}
if len(m.Url) > 0 {
dAtA[i] = 0x12
i++
i = encodeVarintHttpgrpc(dAtA, i, uint64(len(m.Url)))
i += copy(dAtA[i:], m.Url)
}
if len(m.Headers) > 0 {
for _, msg := range m.Headers {
dAtA[i] = 0x1a
i++
i = encodeVarintHttpgrpc(dAtA, i, uint64(msg.Size()))
n, err := msg.MarshalTo(dAtA[i:])
if err != nil {
return 0, err
}
i += n
}
}
if len(m.Body) > 0 {
dAtA[i] = 0x22
i++
i = encodeVarintHttpgrpc(dAtA, i, uint64(len(m.Body)))
i += copy(dAtA[i:], m.Body)
}
return i, nil
}
func (m *HTTPResponse) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA)
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *HTTPResponse) MarshalTo(dAtA []byte) (int, error) {
var i int
_ = i
var l int
_ = l
if m.Code != 0 {
dAtA[i] = 0x8
i++
i = encodeVarintHttpgrpc(dAtA, i, uint64(m.Code))
}
if len(m.Headers) > 0 {
for _, msg := range m.Headers {
dAtA[i] = 0x12
i++
i = encodeVarintHttpgrpc(dAtA, i, uint64(msg.Size()))
n, err := msg.MarshalTo(dAtA[i:])
if err != nil {
return 0, err
}
i += n
}
}
if len(m.Body) > 0 {
dAtA[i] = 0x1a
i++
i = encodeVarintHttpgrpc(dAtA, i, uint64(len(m.Body)))
i += copy(dAtA[i:], m.Body)
}
return i, nil
}
func (m *Header) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalTo(dAtA)
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *Header) MarshalTo(dAtA []byte) (int, error) {
var i int
_ = i
var l int
_ = l
if len(m.Key) > 0 {
dAtA[i] = 0xa
i++
i = encodeVarintHttpgrpc(dAtA, i, uint64(len(m.Key)))
i += copy(dAtA[i:], m.Key)
}
if len(m.Values) > 0 {
for _, s := range m.Values {
dAtA[i] = 0x12
i++
l = len(s)
for l >= 1<<7 {
dAtA[i] = uint8(uint64(l)&0x7f | 0x80)
l >>= 7
i++
}
dAtA[i] = uint8(l)
i++
i += copy(dAtA[i:], s)
}
}
return i, nil
}
func encodeVarintHttpgrpc(dAtA []byte, offset int, v uint64) int {
for v >= 1<<7 {
dAtA[offset] = uint8(v&0x7f | 0x80)
v >>= 7
offset++
}
dAtA[offset] = uint8(v)
return offset + 1
}
func (m *HTTPRequest) Size() (n int) {
var l int
_ = l
l = len(m.Method)
if l > 0 {
n += 1 + l + sovHttpgrpc(uint64(l))
}
l = len(m.Url)
if l > 0 {
n += 1 + l + sovHttpgrpc(uint64(l))
}
if len(m.Headers) > 0 {
for _, e := range m.Headers {
l = e.Size()
n += 1 + l + sovHttpgrpc(uint64(l))
}
}
l = len(m.Body)
if l > 0 {
n += 1 + l + sovHttpgrpc(uint64(l))
}
return n
}
func (m *HTTPResponse) Size() (n int) {
var l int
_ = l
if m.Code != 0 {
n += 1 + sovHttpgrpc(uint64(m.Code))
}
if len(m.Headers) > 0 {
for _, e := range m.Headers {
l = e.Size()
n += 1 + l + sovHttpgrpc(uint64(l))
}
}
l = len(m.Body)
if l > 0 {
n += 1 + l + sovHttpgrpc(uint64(l))
}
return n
}
func (m *Header) Size() (n int) {
var l int
_ = l
l = len(m.Key)
if l > 0 {
n += 1 + l + sovHttpgrpc(uint64(l))
}
if len(m.Values) > 0 {
for _, s := range m.Values {
l = len(s)
n += 1 + l + sovHttpgrpc(uint64(l))
}
}
return n
}
func sovHttpgrpc(x uint64) (n int) {
for {
n++
x >>= 7
if x == 0 {
break
}
}
return n
}
func sozHttpgrpc(x uint64) (n int) {
return sovHttpgrpc(uint64((x << 1) ^ uint64((int64(x) >> 63))))
}
func (this *HTTPRequest) String() string {
if this == nil {
return "nil"
}
s := strings.Join([]string{`&HTTPRequest{`,
`Method:` + fmt.Sprintf("%v", this.Method) + `,`,
`Url:` + fmt.Sprintf("%v", this.Url) + `,`,
`Headers:` + strings.Replace(fmt.Sprintf("%v", this.Headers), "Header", "Header", 1) + `,`,
`Body:` + fmt.Sprintf("%v", this.Body) + `,`,
`}`,
}, "")
return s
}
func (this *HTTPResponse) String() string {
if this == nil {
return "nil"
}
s := strings.Join([]string{`&HTTPResponse{`,
`Code:` + fmt.Sprintf("%v", this.Code) + `,`,
`Headers:` + strings.Replace(fmt.Sprintf("%v", this.Headers), "Header", "Header", 1) + `,`,
`Body:` + fmt.Sprintf("%v", this.Body) + `,`,
`}`,
}, "")
return s
}
func (this *Header) String() string {
if this == nil {
return "nil"
}
s := strings.Join([]string{`&Header{`,
`Key:` + fmt.Sprintf("%v", this.Key) + `,`,
`Values:` + fmt.Sprintf("%v", this.Values) + `,`,
`}`,
}, "")
return s
}
func valueToStringHttpgrpc(v interface{}) string {
rv := reflect.ValueOf(v)
if rv.IsNil() {
return "nil"
}
pv := reflect.Indirect(rv).Interface()
return fmt.Sprintf("*%v", pv)
}
func (m *HTTPRequest) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowHttpgrpc
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: HTTPRequest: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: HTTPRequest: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Method", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowHttpgrpc
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthHttpgrpc
}
postIndex := iNdEx + intStringLen
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Method = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Url", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowHttpgrpc
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthHttpgrpc
}
postIndex := iNdEx + intStringLen
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Url = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 3:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Headers", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowHttpgrpc
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= (int(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthHttpgrpc
}
postIndex := iNdEx + msglen
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Headers = append(m.Headers, &Header{})
if err := m.Headers[len(m.Headers)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 4:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Body", wireType)
}
var byteLen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowHttpgrpc
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
byteLen |= (int(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
if byteLen < 0 {
return ErrInvalidLengthHttpgrpc
}
postIndex := iNdEx + byteLen
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Body = append(m.Body[:0], dAtA[iNdEx:postIndex]...)
if m.Body == nil {
m.Body = []byte{}
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipHttpgrpc(dAtA[iNdEx:])
if err != nil {
return err
}
if skippy < 0 {
return ErrInvalidLengthHttpgrpc
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *HTTPResponse) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowHttpgrpc
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: HTTPResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: HTTPResponse: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field Code", wireType)
}
m.Code = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowHttpgrpc
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.Code |= (int32(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Headers", wireType)
}
var msglen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowHttpgrpc
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
msglen |= (int(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
if msglen < 0 {
return ErrInvalidLengthHttpgrpc
}
postIndex := iNdEx + msglen
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Headers = append(m.Headers, &Header{})
if err := m.Headers[len(m.Headers)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
return err
}
iNdEx = postIndex
case 3:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Body", wireType)
}
var byteLen int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowHttpgrpc
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
byteLen |= (int(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
if byteLen < 0 {
return ErrInvalidLengthHttpgrpc
}
postIndex := iNdEx + byteLen
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Body = append(m.Body[:0], dAtA[iNdEx:postIndex]...)
if m.Body == nil {
m.Body = []byte{}
}
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipHttpgrpc(dAtA[iNdEx:])
if err != nil {
return err
}
if skippy < 0 {
return ErrInvalidLengthHttpgrpc
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func (m *Header) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowHttpgrpc
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: Header: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: Header: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowHttpgrpc
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthHttpgrpc
}
postIndex := iNdEx + intStringLen
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Key = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Values", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowHttpgrpc
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthHttpgrpc
}
postIndex := iNdEx + intStringLen
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Values = append(m.Values, string(dAtA[iNdEx:postIndex]))
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipHttpgrpc(dAtA[iNdEx:])
if err != nil {
return err
}
if skippy < 0 {
return ErrInvalidLengthHttpgrpc
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func skipHttpgrpc(dAtA []byte) (n int, err error) {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowHttpgrpc
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
wireType := int(wire & 0x7)
switch wireType {
case 0:
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowHttpgrpc
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
iNdEx++
if dAtA[iNdEx-1] < 0x80 {
break
}
}
return iNdEx, nil
case 1:
iNdEx += 8
return iNdEx, nil
case 2:
var length int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowHttpgrpc
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
length |= (int(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
iNdEx += length
if length < 0 {
return 0, ErrInvalidLengthHttpgrpc
}
return iNdEx, nil
case 3:
for {
var innerWire uint64
var start int = iNdEx
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowHttpgrpc
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
innerWire |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
innerWireType := int(innerWire & 0x7)
if innerWireType == 4 {
break
}
next, err := skipHttpgrpc(dAtA[start:])
if err != nil {
return 0, err
}
iNdEx = start + next
}
return iNdEx, nil
case 4:
return iNdEx, nil
case 5:
iNdEx += 4
return iNdEx, nil
default:
return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
}
}
panic("unreachable")
}
var (
ErrInvalidLengthHttpgrpc = fmt.Errorf("proto: negative length found during unmarshaling")
ErrIntOverflowHttpgrpc = fmt.Errorf("proto: integer overflow")
)
func init() {
proto.RegisterFile("github.com/weaveworks/common/httpgrpc/httpgrpc.proto", fileDescriptorHttpgrpc)
}
var fileDescriptorHttpgrpc = []byte{
// 319 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x32, 0x49, 0xcf, 0x2c, 0xc9,
0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0xd5, 0x2f, 0x4f, 0x4d, 0x2c, 0x4b, 0x2d, 0xcf, 0x2f, 0xca,
0x2e, 0xd6, 0x4f, 0xce, 0xcf, 0xcd, 0xcd, 0xcf, 0xd3, 0xcf, 0x28, 0x29, 0x29, 0x48, 0x2f, 0x2a,
0x48, 0x86, 0x33, 0xf4, 0x0a, 0x8a, 0xf2, 0x4b, 0xf2, 0x85, 0x38, 0x60, 0x7c, 0xa5, 0x72, 0x2e,
0x6e, 0x8f, 0x90, 0x90, 0x80, 0xa0, 0xd4, 0xc2, 0xd2, 0xd4, 0xe2, 0x12, 0x21, 0x31, 0x2e, 0xb6,
0xdc, 0xd4, 0x92, 0x8c, 0xfc, 0x14, 0x09, 0x46, 0x05, 0x46, 0x0d, 0xce, 0x20, 0x28, 0x4f, 0x48,
0x80, 0x8b, 0xb9, 0xb4, 0x28, 0x47, 0x82, 0x09, 0x2c, 0x08, 0x62, 0x0a, 0x69, 0x71, 0xb1, 0x67,
0xa4, 0x26, 0xa6, 0xa4, 0x16, 0x15, 0x4b, 0x30, 0x2b, 0x30, 0x6b, 0x70, 0x1b, 0x09, 0xe8, 0xc1,
0x2d, 0xf1, 0x00, 0x4b, 0x04, 0xc1, 0x14, 0x08, 0x09, 0x71, 0xb1, 0x24, 0xe5, 0xa7, 0x54, 0x4a,
0xb0, 0x28, 0x30, 0x6a, 0xf0, 0x04, 0x81, 0xd9, 0x4a, 0x49, 0x5c, 0x3c, 0x10, 0x8b, 0x8b, 0x0b,
0xf2, 0xf3, 0x8a, 0x53, 0x41, 0x6a, 0x9c, 0xf3, 0x53, 0x52, 0xc1, 0xf6, 0xb2, 0x06, 0xb1, 0x24,
0xe7, 0xa7, 0xa4, 0x22, 0xdb, 0xc1, 0x44, 0xac, 0x1d, 0xcc, 0x48, 0x76, 0x18, 0x71, 0xb1, 0x41,
0x94, 0x81, 0xdc, 0x9f, 0x9d, 0x5a, 0x09, 0xf5, 0x14, 0x88, 0x09, 0xf2, 0x69, 0x59, 0x62, 0x4e,
0x69, 0x2a, 0xc4, 0x68, 0xce, 0x20, 0x28, 0xcf, 0xc8, 0x91, 0x8b, 0x05, 0xe4, 0x2e, 0x21, 0x4b,
0x2e, 0x36, 0x8f, 0xc4, 0xbc, 0x94, 0x9c, 0x54, 0x21, 0x51, 0x24, 0x4b, 0x11, 0x41, 0x25, 0x25,
0x86, 0x2e, 0x0c, 0xf1, 0x88, 0x12, 0x83, 0x53, 0xf0, 0x85, 0x87, 0x72, 0x0c, 0x37, 0x1e, 0xca,
0x31, 0x7c, 0x78, 0x28, 0xc7, 0xd8, 0xf0, 0x48, 0x8e, 0x71, 0xc5, 0x23, 0x39, 0xc6, 0x13, 0x8f,
0xe4, 0x18, 0x2f, 0x3c, 0x92, 0x63, 0x7c, 0xf0, 0x48, 0x8e, 0xf1, 0xc5, 0x23, 0x39, 0x86, 0x0f,
0x8f, 0xe4, 0x18, 0x27, 0x3c, 0x96, 0x63, 0x88, 0x52, 0x25, 0x2a, 0x06, 0x93, 0xd8, 0xc0, 0x31,
0x67, 0x0c, 0x08, 0x00, 0x00, 0xff, 0xff, 0x49, 0xec, 0x86, 0xd6, 0xf1, 0x01, 0x00, 0x00,
}
| mit |
uni-react/react-native-navigation | android/app/src/main/java/com/reactnativenavigation/utils/ViewUtils.java | 6993 | package com.reactnativenavigation.utils;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffColorFilter;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.support.annotation.Nullable;
import android.text.SpannableString;
import android.text.Spanned;
import android.text.SpannedString;
import android.text.style.ForegroundColorSpan;
import android.util.DisplayMetrics;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewParent;
import android.view.ViewTreeObserver;
import android.view.WindowManager;
import android.widget.TextView;
import com.reactnativenavigation.NavigationApplication;
import com.reactnativenavigation.params.AppStyle;
import com.reactnativenavigation.screens.Screen;
import com.reactnativenavigation.views.utils.Point;
import java.util.concurrent.atomic.AtomicInteger;
public class ViewUtils {
private static final AtomicInteger viewId = new AtomicInteger(1);
private static int statusBarHeight = -1;
public static void runOnPreDraw(final View view, final Runnable task) {
view.getViewTreeObserver().addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() {
@Override
public boolean onPreDraw() {
if (!view.getViewTreeObserver().isAlive()) {
return true;
}
view.getViewTreeObserver().removeOnPreDrawListener(this);
task.run();
return true;
}
});
}
public static void tintDrawable(Drawable drawable, int tint, boolean enabled) {
drawable.setColorFilter(new PorterDuffColorFilter(enabled ? tint :
AppStyle.appStyle.titleBarDisabledButtonColor.getColor(),
PorterDuff.Mode.SRC_IN));
}
public static float convertDpToPixel(float dp) {
float scale = NavigationApplication.instance.getResources().getDisplayMetrics().density;
return dp * scale + 0.5f;
}
public static float convertPixelToSp(float pixels) {
float scaledDensity = NavigationApplication.instance.getResources().getDisplayMetrics().scaledDensity;
return pixels / scaledDensity;
}
public static float convertSpToPixel(float pixels) {
float scaledDensity = NavigationApplication.instance.getResources().getDisplayMetrics().scaledDensity;
return pixels * scaledDensity;
}
public static int generateViewId() {
if (Build.VERSION.SDK_INT >= 17) {
return View.generateViewId();
} else {
return compatGenerateViewId();
}
}
public static float getScreenHeight() {
WindowManager wm = (WindowManager) NavigationApplication.instance.getSystemService(Context.WINDOW_SERVICE);
DisplayMetrics metrics = new DisplayMetrics();
wm.getDefaultDisplay().getMetrics(metrics);
return metrics.heightPixels;
}
public static float getScreenWidth() {
WindowManager wm = (WindowManager) NavigationApplication.instance.getSystemService(Context.WINDOW_SERVICE);
DisplayMetrics metrics = new DisplayMetrics();
wm.getDefaultDisplay().getMetrics(metrics);
return metrics.widthPixels;
}
private static int compatGenerateViewId() {
for (; ; ) {
final int result = viewId.get();
// aapt-generated IDs have the high byte nonzero; clamp to the range under that.
int newValue = result + 1;
if (newValue > 0x00FFFFFF) newValue = 1; // Roll over to 1, not 0.
if (viewId.compareAndSet(result, newValue)) {
return result;
}
}
}
public interface Matcher<T> {
boolean match(T child);
}
/**
* Returns the first instance of clazz in root
*/
@Nullable
public static <T> T findChildByClass(ViewGroup root, Class clazz) {
return findChildByClass(root, clazz, null);
}
@Nullable
public static <T> T findChildByClass(ViewGroup root, Class clazz, Matcher<T> matcher) {
for (int i = 0; i < root.getChildCount(); i++) {
View view = root.getChildAt(i);
if (clazz.isAssignableFrom(view.getClass())) {
return (T) view;
}
if (view instanceof ViewGroup) {
view = (View) findChildByClass((ViewGroup) view, clazz, matcher);
if (view != null && clazz.isAssignableFrom(view.getClass())) {
if (matcher == null) {
return (T) view;
}
if (matcher.match((T) view)) {
return (T) view;
}
}
}
}
return null;
}
public static void performOnChildren(ViewGroup root, PerformOnViewTask task) {
for (int i = 0; i < root.getChildCount(); i++) {
View child = root.getChildAt(i);
if (child instanceof ViewGroup) {
performOnChildren((ViewGroup) child, task);
}
task.runOnView(child);
}
}
public interface PerformOnViewTask {
void runOnView(View view);
}
public static void performOnParentScreen(View child, Task<Screen> task) {
Screen parentScreen = findParentScreen(child.getParent());
if (parentScreen != null) {
task.run(parentScreen);
}
}
private static Screen findParentScreen(ViewParent parent) {
if (parent == null) {
return null;
}
if (parent instanceof Screen) {
return (Screen) parent;
}
return findParentScreen(parent.getParent());
}
public static Point getLocationOnScreen(View view) {
int[] xy = new int[2];
view.getLocationOnScreen(xy);
xy[1] -= getStatusBarPixelHeight();
return new Point(xy[0], xy[1]);
}
private static int getStatusBarPixelHeight() {
if (statusBarHeight > 0) {
return statusBarHeight;
}
final Resources resources = NavigationApplication.instance.getResources();
final int resourceId = resources.getIdentifier("status_bar_height", "dimen", "android");
statusBarHeight = resourceId > 0 ?
resources.getDimensionPixelSize(resourceId) :
(int) convertDpToPixel(Build.VERSION.SDK_INT >= Build.VERSION_CODES.M ? 24 : 25);
return statusBarHeight;
}
public static ForegroundColorSpan[] getForegroundColorSpans(TextView view) {
SpannedString text = (SpannedString) view.getText();
return text.getSpans(0, text.length(), ForegroundColorSpan.class);
}
public static void setSpanColor(SpannableString span, int color) {
span.setSpan(new ForegroundColorSpan(color), 0, span.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
}
}
| mit |
roberino/linqinfer | src/LinqInfer/Text/Analysis/VectorExtractionResult.cs | 973 | using LinqInfer.Data.Serialisation;
using LinqInfer.Maths;
namespace LinqInfer.Text.Analysis
{
public sealed class VectorExtractionResult : IExportableAsDataDocument
{
internal VectorExtractionResult(PortableDataDocument model, LabelledMatrix<string> vectors)
{
ModelData = model;
Vectors = vectors;
}
public PortableDataDocument ModelData { get; }
public LabelledMatrix<string> Vectors { get; }
public PortableDataDocument ExportData()
{
var doc = new PortableDataDocument();
doc.Children.Add(ModelData);
doc.Children.Add(Vectors.ExportData());
return doc;
}
public static VectorExtractionResult CreateFromData(PortableDataDocument data)
{
var matrix = new LabelledMatrix<string>(data.Children[1]);
return new VectorExtractionResult(data.Children[0], matrix);
}
}
} | mit |
Rudhie/simlab | application/config/autoload.php | 4082 | <?php
defined('BASEPATH') OR exit('No direct script access allowed');
/*
| -------------------------------------------------------------------
| AUTO-LOADER
| -------------------------------------------------------------------
| This file specifies which systems should be loaded by default.
|
| In order to keep the framework as light-weight as possible only the
| absolute minimal resources are loaded by default. For example,
| the database is not connected to automatically since no assumption
| is made regarding whether you intend to use it. This file lets
| you globally define which systems you would like loaded with every
| request.
|
| -------------------------------------------------------------------
| Instructions
| -------------------------------------------------------------------
|
| These are the things you can load automatically:
|
| 1. Packages
| 2. Libraries
| 3. Drivers
| 4. Helper files
| 5. Custom config files
| 6. Language files
| 7. Models
|
*/
/*
| -------------------------------------------------------------------
| Auto-load Packages
| -------------------------------------------------------------------
| Prototype:
|
| $autoload['packages'] = array(APPPATH.'third_party', '/usr/local/shared');
|
*/
$autoload['packages'] = array();
/*
| -------------------------------------------------------------------
| Auto-load Libraries
| -------------------------------------------------------------------
| These are the classes located in system/libraries/ or your
| application/libraries/ directory, with the addition of the
| 'database' library, which is somewhat of a special case.
|
| Prototype:
|
| $autoload['libraries'] = array('database', 'email', 'session');
|
| You can also supply an alternative library name to be assigned
| in the controller:
|
| $autoload['libraries'] = array('user_agent' => 'ua');
*/
$autoload['libraries'] = array('session','database','form_validation');
/*
| -------------------------------------------------------------------
| Auto-load Drivers
| -------------------------------------------------------------------
| These classes are located in system/libraries/ or in your
| application/libraries/ directory, but are also placed inside their
| own subdirectory and they extend the CI_Driver_Library class. They
| offer multiple interchangeable driver options.
|
| Prototype:
|
| $autoload['drivers'] = array('cache');
|
| You can also supply an alternative property name to be assigned in
| the controller:
|
| $autoload['drivers'] = array('cache' => 'cch');
|
*/
$autoload['drivers'] = array();
/*
| -------------------------------------------------------------------
| Auto-load Helper Files
| -------------------------------------------------------------------
| Prototype:
|
| $autoload['helper'] = array('url', 'file');
*/
$autoload['helper'] = array('form','html','url');
/*
| -------------------------------------------------------------------
| Auto-load Config files
| -------------------------------------------------------------------
| Prototype:
|
| $autoload['config'] = array('config1', 'config2');
|
| NOTE: This item is intended for use ONLY if you have created custom
| config files. Otherwise, leave it blank.
|
*/
$autoload['config'] = array();
/*
| -------------------------------------------------------------------
| Auto-load Language files
| -------------------------------------------------------------------
| Prototype:
|
| $autoload['language'] = array('lang1', 'lang2');
|
| NOTE: Do not include the "_lang" part of your file. For example
| "codeigniter_lang.php" would be referenced as array('codeigniter');
|
*/
$autoload['language'] = array();
/*
| -------------------------------------------------------------------
| Auto-load Models
| -------------------------------------------------------------------
| Prototype:
|
| $autoload['model'] = array('first_model', 'second_model');
|
| You can also supply an alternative model name to be assigned
| in the controller:
|
| $autoload['model'] = array('first_model' => 'first');
*/
$autoload['model'] = array();
| mit |
ruanmartinelli/terra-core | src/app/event/event-dispatcher.js | 3117 | let io
const config = require('../../config')
const eventModel = require('./event-model')
const random = require('lodash/random')
const chalk = require('chalk')
const mda100_temperature = require('../../helpers/mda100-temperature')
const sht1x_temperature = require('../../helpers/sht1x-temperature')
const moment = require('moment')
/**
* Initializes connections
* @param {} app express app object
*/
const init = app => {
const server = require('http').createServer(app)
io = require('socket.io')(server)
io.on('connection', socket => {
console.log(
`${chalk.bold(' 🔌 Socket.io: connected on port ' + config.socket_io_port)}`
)
})
server.listen(config.socket_io_port)
}
/**
* Mount the event following a certain standard
* Works like a constructor
* @param {Object} raw_data Raw event data
* @returns {Object} The event object
*/
const Event = e => {
let event = {}
if (e.port) event.port = e.port
if (e.source) event.id_mote = e.source
if (e.gateway_time) event.gateway_time = e.gateway_time
if (e.d8 && e.d8[0]) event.counter = e.d8[0]
if (e.d16 && e.d16[0]) {
const { id_temperature_event, id_luminosity_event } = config
// TODO: add correct validation of sensor data type
const is_temperature = e.id == id_temperature_event
const is_luminosity = e.id == id_luminosity_event
if (is_luminosity) event.raw_luminosity = e.d16[0]
if (is_temperature) event.raw_temperature = e.d16[0]
}
return event
}
/**
* Prepare, store and send the event through all channels
* @param {*} raw_event Raw event data
*/
const dispatchEvent = raw_event => {
console.log(
` ${chalk.bold('📥 Event received from mote ' + raw_event.source)}`
)
/*const curr_time = moment()
console.log('curr_time:------------')
console.log(curr_time)
console.log('------------------')
const gateway_time = moment(raw_event.gateway_time)
console.log('gateway_time:------------')
console.log(gateway_time)
console.log('------------------')
const delay = curr_time.diff(gateway_time, 'milliseconds')
console.log('Daley:------------')
console.log(delay)
console.log('------------------')*/
const event = Event(raw_event)
convert(event)
// send to web client via socket.io
io.emit('message', event)
// parse gateway_time
event.gateway_time = new Date(event.gateway_time)
// save to database (ACHO QUE PARA O EXPERIMENTO NÃO PRECISA SALVAR NO BANCO TA GERANDO DELAY)
//eventModel.addEvent(event)
return event
}
const convert = event => {
const { raw_temperature, id_mote } = event
const { networks } = config
if (!raw_temperature) return
let model = ''
networks.forEach(network => {
if (network.mote_ids.includes(id_mote)) {
model = network.model
}
})
switch (model) {
case 'MDA100':
event.temperature = mda100_temperature(raw_temperature)
break
case 'TELOSB':
event.temperature = sht1x_temperature(raw_temperature)
break
default:
event.temperature = null
}
}
module.exports.init = init
module.exports.dispatchEvent = dispatchEvent
| mit |
endercrest/UWaterloo-API | src/main/java/com/endercrest/uwaterlooapi/resources/models/ResourceTutor.java | 1258 | package com.endercrest.uwaterlooapi.resources.models;
import com.google.gson.annotations.SerializedName;
/**
* Created by Thomas Cordua-von Specht on 12/5/2016.
*/
public class ResourceTutor {
private String subject;
@SerializedName("catalog_number")
private String catalogNumber;
private String title;
@SerializedName("tutors_count")
private int tutorsCount;
@SerializedName("contact_url")
private String contactUrl;
public String getSubject() {
return subject;
}
public void setSubject(String subject) {
this.subject = subject;
}
public String getCatalogNumber() {
return catalogNumber;
}
public void setCatalogNumber(String catalogNumber) {
this.catalogNumber = catalogNumber;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public int getTutorsCount() {
return tutorsCount;
}
public void setTutorsCount(int tutorsCount) {
this.tutorsCount = tutorsCount;
}
public String getContactUrl() {
return contactUrl;
}
public void setContactUrl(String contactUrl) {
this.contactUrl = contactUrl;
}
}
| mit |
UMKC-Law/permit-matrix | src/main/java/edu/umkc/permitme/domain/enumeration/MeterLocation.java | 138 | package edu.umkc.permitme.domain.enumeration;
/**
* The MeterLocation enumeration.
*/
public enum MeterLocation {
INSIDE,OUTSIDE
}
| mit |
ryw/pinboard | lib/pinboard.rb | 290 | require 'pinboard/util'
require 'pinboard/client'
require 'pinboard/post'
require 'pinboard/tag'
require 'pinboard/note'
module Pinboard
class << self
def new(options={})
Pinboard::Client.new(options)
end
def endpoint
Pinboard::Client.base_uri
end
end
end
| mit |
yasutaka/nlp_100 | kiyota/05.py | 959 | '''
05. n-gram
与えられたシーケンス(文字列やリストなど)からn-gramを作る関数を作成せよ.この関数を用い,
"I am an NLPer"という文から単語bi-gram,文字bi-gramを得よ
単語n-gram:隣り合うn個の単語を一塊として考える
文字gram:隣り合うn個の文字を一塊として考える
'''
# coding: utf-8
def do_ngram(ori,mode,num):
if mode == "word": #単語bi-gram
str = []
str = ori.split()
elif mode == "char": #文字bi-gram
str = ""
str = ori.replace(" ","")
i = 0
n = num
ngram = []
while i < len(str)-1: #2個ずつ取り出して配列に入れたい
ngram.append(str[i:n])
i += 1
n +=1
print (ngram)
# ここから呼ぶ
ori_sentence = "I am an NLPer"
# 単語bi-gram
do_ngram(ori_sentence,"word",2)
# 文字bi-gram
do_ngram(ori_sentence,"char",2)
| mit |
NoRoboto/Coursera | Multiplatform Mobile App Development with Web Technologies/Week4/04 Assignment 04/ionic/conFusion/www/js/services.js | 2011 | 'use strict';
angular.module('conFusion.services', ['ngResource'])
.constant("baseURL", "http://192.168.0.5:3000/")
.factory('menuFactory', ['$resource', 'baseURL', function($resource, baseURL) {
return $resource(baseURL + "dishes/:id", null, {
'update': {
method: 'PUT'
}
});
}])
.factory('promotionFactory', ['$resource', 'baseURL', function($resource, baseURL) {
return $resource(baseURL + "promotions/:id");
}])
.factory('corporateFactory', ['$resource', 'baseURL', function($resource, baseURL) {
return $resource(baseURL + "leadership/:id");
}])
.factory('feedbackFactory', ['$resource', 'baseURL', function($resource, baseURL) {
return $resource(baseURL + "feedback/:id");
}])
.factory('favoriteFactory', ['$resource', '$localStorage', 'baseURL', function($resource, $localStorage, baseURL) {
var favFac = {};
var favorites = $localStorage.getObject('favorites', '[]');
favFac.addToFavorites = function(index) {
for (var i = 0; i < favorites.length; i++) {
if (favorites[i].id == index)
return;
}
favorites.push({
id: index
});
$localStorage.storeObject('favorites', favorites);
};
favFac.deleteFromFavorites = function(index) {
for (var i = 0; i < favorites.length; i++) {
if (favorites[i].id == index) {
favorites.splice(i, 1);
$localStorage.storeObject('favorites', favorites);
}
}
}
favFac.getFavorites = function() {
return favorites;
};
return favFac;
}])
.factory('$localStorage', ['$window', function($window) {
return {
store: function(key, value) {
$window.localStorage[key] = value;
},
get: function(key, defaultValue) {
return $window.localStorage[key] || defaultValue;
},
storeObject: function(key, value) {
$window.localStorage[key] = JSON.stringify(value);
},
getObject: function(key, defaultValue) {
return JSON.parse($window.localStorage[key] || defaultValue);
}
}
}]);
| mit |
szymonwelgus/interpreter | src/token_type.hpp | 119 | #pragma once
enum class token_type : unsigned int
{
E_ERROR = 0,
E_INVALID,
E_INTEGER,
E_PLUS,
E_EOF,
}; | mit |
gre/gl-react | packages/cookbook/src/examples/textanimated/index.source.js | 2623 | module.exports=`//@flow
import React, { PureComponent, Component } from "react";
import { Shaders, Node, GLSL, LinearCopy } from "gl-react";
import { Surface } from "gl-react-dom";
import JSON2D from "react-json2d";
import timeLoop from "../../HOC/timeLoop";
const shaders = Shaders.create({
animated: {
frag: GLSL\`
precision highp float;
varying vec2 uv;
uniform sampler2D t;
uniform float time, amp, freq, colorSeparation, moving;
vec2 lookup (vec2 offset) {
return mod(
uv + amp * vec2(
cos(freq*(uv.x+offset.x)+time/1000.0),
sin(freq*(uv.y+offset.x)+time/1000.0))
+ vec2( moving * time/10000.0, 0.0),
vec2(1.0));
}
void main() {
vec3 col = mix(vec3(
texture2D(t, lookup(vec2(colorSeparation))).r,
texture2D(t, lookup(vec2(-colorSeparation))).g,
texture2D(t, lookup(vec2(0.0))).b), vec3(1.0), 0.1);
gl_FragColor = vec4(col * vec3(
0.5 + 0.5 * cos(uv.y + uv.x * 49.0),
0.6 * uv.x + 0.2 * sin(uv.y * 30.0),
1.0 - uv.x + 0.5 * cos(uv.y * 2.0)
), 1.0);
}\`,
},
});
class Animated extends Component {
render() {
const { children: t, time } = this.props;
return (
<Node
shader={shaders.animated}
uniforms={{
t,
time,
freq: 20 - 14 * Math.sin(time / 7000),
amp: 0.05 * (1 - Math.cos(time / 4000)),
colorSeparation: 0.02,
moving: 1,
}}
/>
);
}
}
const AnimatedLoop = timeLoop(Animated);
const size = { width: 500, height: 200 };
const font = "36px bold Helvetica";
const lineHeight = 40;
const padding = 10;
class Text extends PureComponent {
render() {
const { text } = this.props;
return (
// Text is a PureComponent that renders a LinearCopy
// that will cache the canvas content for more efficiency
<LinearCopy>
<JSON2D {...size}>
{{
background: "#000",
size: [size.width, size.height],
draws: [
{
textBaseline: "top",
fillStyle: "#fff",
font,
},
["fillText", text, padding, padding, lineHeight],
],
}}
</JSON2D>
</LinearCopy>
);
}
}
export default class Example extends Component {
render() {
const { text } = this.props;
return (
<Surface {...size}>
<AnimatedLoop>
<Text text={text} />
</AnimatedLoop>
</Surface>
);
}
static defaultProps = {
text: "Hello world\\n2d canvas text\\ninjected as texture",
};
}
export { size, font, lineHeight, padding };
`
| mit |
juanbond/doctorcoin | src/qt/locale/bitcoin_fi.ts | 113261 | <?xml version="1.0" ?><!DOCTYPE TS><TS language="fi" version="2.0">
<defaultcodec>UTF-8</defaultcodec>
<context>
<name>AboutDialog</name>
<message>
<location filename="../forms/aboutdialog.ui" line="+14"/>
<source>About Doctorcoin</source>
<translation>Tietoa Doctorcoinista</translation>
</message>
<message>
<location line="+39"/>
<source><b>Doctorcoin</b> version</source>
<translation><b>Doctorcoin</b> versio</translation>
</message>
<message>
<location line="+57"/>
<source>
This is experimental software.
Distributed under the MIT/X11 software license, see the accompanying file COPYING or http://www.opensource.org/licenses/mit-license.php.
This product includes software developed by the OpenSSL Project for use in the OpenSSL Toolkit (http://www.openssl.org/) and cryptographic software written by Eric Young ([email protected]) and UPnP software written by Thomas Bernard.</source>
<translation>
Tämä on kokeellinen ohjelmisto.
Levitetään MIT/X11 ohjelmistolisenssin alaisuudessa. Tarkemmat tiedot löytyvät tiedostosta COPYING tai osoitteesta http://www.opensource.org/licenses/mit-license.php.
Tämä ohjelma sisältää OpenSSL projektin OpenSSL työkalupakin (http://www.openssl.org/), Eric Youngin ([email protected]) kehittämän salausohjelmiston sekä Thomas Bernardin UPnP ohjelmiston.
</translation>
</message>
<message>
<location filename="../aboutdialog.cpp" line="+14"/>
<source>Copyright</source>
<translation>Tekijänoikeus</translation>
</message>
<message>
<location line="+0"/>
<source>The Doctorcoin developers</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>AddressBookPage</name>
<message>
<location filename="../forms/addressbookpage.ui" line="+14"/>
<source>Address Book</source>
<translation>Osoitekirja</translation>
</message>
<message>
<location line="+19"/>
<source>Double-click to edit address or label</source>
<translation>Kaksoisnapauta muokataksesi osoitetta tai nimeä</translation>
</message>
<message>
<location line="+27"/>
<source>Create a new address</source>
<translation>Luo uusi osoite</translation>
</message>
<message>
<location line="+14"/>
<source>Copy the currently selected address to the system clipboard</source>
<translation>Kopioi valittu osoite leikepöydälle</translation>
</message>
<message>
<location line="-11"/>
<source>&New Address</source>
<translation>&Uusi Osoite</translation>
</message>
<message>
<location filename="../addressbookpage.cpp" line="+63"/>
<source>These are your Doctorcoin addresses for receiving payments. You may want to give a different one to each sender so you can keep track of who is paying you.</source>
<translation>Nämä ovat Doctorcoin-osoitteesi joihin voit vastaanottaa maksuja. Voit haluta antaa jokaiselle maksajalle omansa, että pystyt seuraamaan keneltä maksut tulevat.</translation>
</message>
<message>
<location filename="../forms/addressbookpage.ui" line="+14"/>
<source>&Copy Address</source>
<translation>&Kopioi Osoite</translation>
</message>
<message>
<location line="+11"/>
<source>Show &QR Code</source>
<translation>Näytä &QR-koodi</translation>
</message>
<message>
<location line="+11"/>
<source>Sign a message to prove you own a Doctorcoin address</source>
<translation>Allekirjoita viesti todistaaksesi, että omistat Doctorcoin-osoitteen</translation>
</message>
<message>
<location line="+3"/>
<source>Sign &Message</source>
<translation>Allekirjoita &viesti</translation>
</message>
<message>
<location line="+25"/>
<source>Delete the currently selected address from the list</source>
<translation>Poista valittu osoite listalta</translation>
</message>
<message>
<location line="+27"/>
<source>Export the data in the current tab to a file</source>
<translation>Vie auki olevan välilehden tiedot tiedostoon</translation>
</message>
<message>
<location line="+3"/>
<source>&Export</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-44"/>
<source>Verify a message to ensure it was signed with a specified Doctorcoin address</source>
<translation>Tarkista viestin allekirjoitus varmistaaksesi, että se allekirjoitettiin tietyllä Doctorcoin-osoitteella</translation>
</message>
<message>
<location line="+3"/>
<source>&Verify Message</source>
<translation>&Varmista viesti...</translation>
</message>
<message>
<location line="+14"/>
<source>&Delete</source>
<translation>&Poista</translation>
</message>
<message>
<location filename="../addressbookpage.cpp" line="-5"/>
<source>These are your Doctorcoin addresses for sending payments. Always check the amount and the receiving address before sending coins.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+13"/>
<source>Copy &Label</source>
<translation>Kopioi &Nimi</translation>
</message>
<message>
<location line="+1"/>
<source>&Edit</source>
<translation>&Muokkaa</translation>
</message>
<message>
<location line="+1"/>
<source>Send &Coins</source>
<translation>Lähetä &Rahaa</translation>
</message>
<message>
<location line="+260"/>
<source>Export Address Book Data</source>
<translation>Vie osoitekirja</translation>
</message>
<message>
<location line="+1"/>
<source>Comma separated file (*.csv)</source>
<translation>Comma separated file (*.csv)</translation>
</message>
<message>
<location line="+13"/>
<source>Error exporting</source>
<translation>Virhe viedessä osoitekirjaa</translation>
</message>
<message>
<location line="+0"/>
<source>Could not write to file %1.</source>
<translation>Ei voida kirjoittaa tiedostoon %1.</translation>
</message>
</context>
<context>
<name>AddressTableModel</name>
<message>
<location filename="../addresstablemodel.cpp" line="+144"/>
<source>Label</source>
<translation>Nimi</translation>
</message>
<message>
<location line="+0"/>
<source>Address</source>
<translation>Osoite</translation>
</message>
<message>
<location line="+36"/>
<source>(no label)</source>
<translation>(ei nimeä)</translation>
</message>
</context>
<context>
<name>AskPassphraseDialog</name>
<message>
<location filename="../forms/askpassphrasedialog.ui" line="+26"/>
<source>Passphrase Dialog</source>
<translation>Tunnuslauseen Dialogi</translation>
</message>
<message>
<location line="+21"/>
<source>Enter passphrase</source>
<translation>Kirjoita tunnuslause</translation>
</message>
<message>
<location line="+14"/>
<source>New passphrase</source>
<translation>Uusi tunnuslause</translation>
</message>
<message>
<location line="+14"/>
<source>Repeat new passphrase</source>
<translation>Kiroita uusi tunnuslause uudelleen</translation>
</message>
<message>
<location filename="../askpassphrasedialog.cpp" line="+33"/>
<source>Enter the new passphrase to the wallet.<br/>Please use a passphrase of <b>10 or more random characters</b>, or <b>eight or more words</b>.</source>
<translation>Anna lompakolle uusi tunnuslause.<br/>Käytä tunnuslausetta, jossa on ainakin <b>10 satunnaista mekkiä</b> tai <b>kahdeksan sanaa</b>.</translation>
</message>
<message>
<location line="+1"/>
<source>Encrypt wallet</source>
<translation>Salaa lompakko</translation>
</message>
<message>
<location line="+3"/>
<source>This operation needs your wallet passphrase to unlock the wallet.</source>
<translation>Tätä toimintoa varten sinun täytyy antaa lompakon tunnuslause sen avaamiseksi.</translation>
</message>
<message>
<location line="+5"/>
<source>Unlock wallet</source>
<translation>Avaa lompakko</translation>
</message>
<message>
<location line="+3"/>
<source>This operation needs your wallet passphrase to decrypt the wallet.</source>
<translation>Tätä toimintoa varten sinun täytyy antaa lompakon tunnuslause salauksen purkuun.</translation>
</message>
<message>
<location line="+5"/>
<source>Decrypt wallet</source>
<translation>Pura lompakon salaus</translation>
</message>
<message>
<location line="+3"/>
<source>Change passphrase</source>
<translation>Vaihda tunnuslause</translation>
</message>
<message>
<location line="+1"/>
<source>Enter the old and new passphrase to the wallet.</source>
<translation>Anna vanha ja uusi tunnuslause.</translation>
</message>
<message>
<location line="+46"/>
<source>Confirm wallet encryption</source>
<translation>Vahvista lompakon salaus</translation>
</message>
<message>
<location line="+1"/>
<source>Warning: If you encrypt your wallet and lose your passphrase, you will <b>LOSE ALL OF YOUR DOCTORCOINS</b>!</source>
<translation>Varoitus: Jos salaat lompakkosi ja menetät tunnuslauseesi, <b>MENETÄT KAIKKI DOCTORCOINISI</b>!</translation>
</message>
<message>
<location line="+0"/>
<source>Are you sure you wish to encrypt your wallet?</source>
<translation>Haluatko varmasti salata lompakkosi?</translation>
</message>
<message>
<location line="+15"/>
<source>IMPORTANT: Any previous backups you have made of your wallet file should be replaced with the newly generated, encrypted wallet file. For security reasons, previous backups of the unencrypted wallet file will become useless as soon as you start using the new, encrypted wallet.</source>
<translation>TÄRKEÄÄ: Kaikki vanhat lompakon varmuuskopiot pitäisi korvata uusilla suojatuilla varmuuskopioilla. Turvallisuussyistä edelliset varmuuskopiot muuttuvat turhiksi, kun aloitat suojatun lompakon käytön.</translation>
</message>
<message>
<location line="+100"/>
<location line="+24"/>
<source>Warning: The Caps Lock key is on!</source>
<translation>Varoitus: Caps Lock on käytössä!</translation>
</message>
<message>
<location line="-130"/>
<location line="+58"/>
<source>Wallet encrypted</source>
<translation>Lompakko salattu</translation>
</message>
<message>
<location line="-56"/>
<source>Doctorcoin will close now to finish the encryption process. Remember that encrypting your wallet cannot fully protect your doctorcoins from being stolen by malware infecting your computer.</source>
<translation>Doctorcoin sulkeutuu lopettaakseen salausprosessin. Muista, että salattukaan lompakko ei täysin suojaa sitä haittaohjelmien aiheuttamilta varkauksilta.</translation>
</message>
<message>
<location line="+13"/>
<location line="+7"/>
<location line="+42"/>
<location line="+6"/>
<source>Wallet encryption failed</source>
<translation>Lompakon salaus epäonnistui</translation>
</message>
<message>
<location line="-54"/>
<source>Wallet encryption failed due to an internal error. Your wallet was not encrypted.</source>
<translation>Lompakon salaaminen epäonnistui sisäisen virheen vuoksi. Lompakkoasi ei salattu.</translation>
</message>
<message>
<location line="+7"/>
<location line="+48"/>
<source>The supplied passphrases do not match.</source>
<translation>Annetut tunnuslauseet eivät täsmää.</translation>
</message>
<message>
<location line="-37"/>
<source>Wallet unlock failed</source>
<translation>Lompakon avaaminen epäonnistui.</translation>
</message>
<message>
<location line="+1"/>
<location line="+11"/>
<location line="+19"/>
<source>The passphrase entered for the wallet decryption was incorrect.</source>
<translation>Annettu tunnuslause oli väärä.</translation>
</message>
<message>
<location line="-20"/>
<source>Wallet decryption failed</source>
<translation>Lompakon salauksen purku epäonnistui.</translation>
</message>
<message>
<location line="+14"/>
<source>Wallet passphrase was successfully changed.</source>
<translation>Lompakon tunnuslause vaihdettiin onnistuneesti.</translation>
</message>
</context>
<context>
<name>BitcoinGUI</name>
<message>
<location filename="../bitcoingui.cpp" line="+233"/>
<source>Sign &message...</source>
<translation>&Allekirjoita viesti...</translation>
</message>
<message>
<location line="+280"/>
<source>Synchronizing with network...</source>
<translation>Synkronoidaan verkon kanssa...</translation>
</message>
<message>
<location line="-349"/>
<source>&Overview</source>
<translation>&Yleisnäkymä</translation>
</message>
<message>
<location line="+1"/>
<source>Show general overview of wallet</source>
<translation>Lompakon tilanteen yleiskatsaus</translation>
</message>
<message>
<location line="+20"/>
<source>&Transactions</source>
<translation>&Rahansiirrot</translation>
</message>
<message>
<location line="+1"/>
<source>Browse transaction history</source>
<translation>Selaa rahansiirtohistoriaa</translation>
</message>
<message>
<location line="+7"/>
<source>Edit the list of stored addresses and labels</source>
<translation>Muokkaa tallennettujen nimien ja osoitteiden listaa</translation>
</message>
<message>
<location line="-14"/>
<source>Show the list of addresses for receiving payments</source>
<translation>Näytä Doctorcoinien vastaanottamiseen käytetyt osoitteet</translation>
</message>
<message>
<location line="+31"/>
<source>E&xit</source>
<translation>L&opeta</translation>
</message>
<message>
<location line="+1"/>
<source>Quit application</source>
<translation>Sulje ohjelma</translation>
</message>
<message>
<location line="+4"/>
<source>Show information about Doctorcoin</source>
<translation>Näytä tietoa Doctorcoin-projektista</translation>
</message>
<message>
<location line="+2"/>
<source>About &Qt</source>
<translation>Tietoja &Qt</translation>
</message>
<message>
<location line="+1"/>
<source>Show information about Qt</source>
<translation>Näytä tietoja QT:ta</translation>
</message>
<message>
<location line="+2"/>
<source>&Options...</source>
<translation>&Asetukset...</translation>
</message>
<message>
<location line="+6"/>
<source>&Encrypt Wallet...</source>
<translation>&Salaa lompakko...</translation>
</message>
<message>
<location line="+3"/>
<source>&Backup Wallet...</source>
<translation>&Varmuuskopioi Lompakko...</translation>
</message>
<message>
<location line="+2"/>
<source>&Change Passphrase...</source>
<translation>&Vaihda Tunnuslause...</translation>
</message>
<message>
<location line="+285"/>
<source>Importing blocks from disk...</source>
<translation>Tuodaan lohkoja levyltä</translation>
</message>
<message>
<location line="+3"/>
<source>Reindexing blocks on disk...</source>
<translation>Ladataan lohkoindeksiä...</translation>
</message>
<message>
<location line="-347"/>
<source>Send coins to a Doctorcoin address</source>
<translation>Lähetä kolikoita Doctorcoin-osoitteeseen</translation>
</message>
<message>
<location line="+49"/>
<source>Modify configuration options for Doctorcoin</source>
<translation>Muuta Doctorcoinin konfiguraatioasetuksia</translation>
</message>
<message>
<location line="+9"/>
<source>Backup wallet to another location</source>
<translation>Varmuuskopioi lompakko toiseen sijaintiin</translation>
</message>
<message>
<location line="+2"/>
<source>Change the passphrase used for wallet encryption</source>
<translation>Vaihda lompakon salaukseen käytettävä tunnuslause</translation>
</message>
<message>
<location line="+6"/>
<source>&Debug window</source>
<translation>&Testausikkuna</translation>
</message>
<message>
<location line="+1"/>
<source>Open debugging and diagnostic console</source>
<translation>Avaa debuggaus- ja diagnostiikkakonsoli</translation>
</message>
<message>
<location line="-4"/>
<source>&Verify message...</source>
<translation>Varmista &viesti...</translation>
</message>
<message>
<location line="-165"/>
<location line="+530"/>
<source>Doctorcoin</source>
<translation>Doctorcoin</translation>
</message>
<message>
<location line="-530"/>
<source>Wallet</source>
<translation>Lompakko</translation>
</message>
<message>
<location line="+101"/>
<source>&Send</source>
<translation>&Lähetä</translation>
</message>
<message>
<location line="+7"/>
<source>&Receive</source>
<translation>&Vastaanota</translation>
</message>
<message>
<location line="+14"/>
<source>&Addresses</source>
<translation>&Osoitteet</translation>
</message>
<message>
<location line="+22"/>
<source>&About Doctorcoin</source>
<translation>&Tietoa Doctorcoinista</translation>
</message>
<message>
<location line="+9"/>
<source>&Show / Hide</source>
<translation>&Näytä / Piilota</translation>
</message>
<message>
<location line="+1"/>
<source>Show or hide the main Window</source>
<translation>Näytä tai piilota Doctorcoin-ikkuna</translation>
</message>
<message>
<location line="+3"/>
<source>Encrypt the private keys that belong to your wallet</source>
<translation>Suojaa yksityiset avaimet, jotka kuuluvat lompakkoosi</translation>
</message>
<message>
<location line="+7"/>
<source>Sign messages with your Doctorcoin addresses to prove you own them</source>
<translation>Allekirjoita viestisi omalla Doctorcoin -osoitteellasi todistaaksesi, että omistat ne</translation>
</message>
<message>
<location line="+2"/>
<source>Verify messages to ensure they were signed with specified Doctorcoin addresses</source>
<translation>Varmista, että viestisi on allekirjoitettu määritetyllä Doctorcoin -osoitteella</translation>
</message>
<message>
<location line="+28"/>
<source>&File</source>
<translation>&Tiedosto</translation>
</message>
<message>
<location line="+7"/>
<source>&Settings</source>
<translation>&Asetukset</translation>
</message>
<message>
<location line="+6"/>
<source>&Help</source>
<translation>&Apua</translation>
</message>
<message>
<location line="+9"/>
<source>Tabs toolbar</source>
<translation>Välilehtipalkki</translation>
</message>
<message>
<location line="+17"/>
<location line="+10"/>
<source>[testnet]</source>
<translation>[testnet]</translation>
</message>
<message>
<location line="+47"/>
<source>Doctorcoin client</source>
<translation>Doctorcoin-asiakas</translation>
</message>
<message numerus="yes">
<location line="+141"/>
<source>%n active connection(s) to Doctorcoin network</source>
<translation><numerusform>%n aktiivinen yhteys Doctorcoin-verkkoon</numerusform><numerusform>%n aktiivista yhteyttä Doctorcoin-verkkoon</numerusform></translation>
</message>
<message>
<location line="+22"/>
<source>No block source available...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+12"/>
<source>Processed %1 of %2 (estimated) blocks of transaction history.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+4"/>
<source>Processed %1 blocks of transaction history.</source>
<translation>Käsitelty %1 lohkoa rahansiirtohistoriasta</translation>
</message>
<message numerus="yes">
<location line="+20"/>
<source>%n hour(s)</source>
<translation><numerusform>%n tunti</numerusform><numerusform>%n tuntia</numerusform></translation>
</message>
<message numerus="yes">
<location line="+4"/>
<source>%n day(s)</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message numerus="yes">
<location line="+4"/>
<source>%n week(s)</source>
<translation><numerusform>%n viikko</numerusform><numerusform>%n viikkoa</numerusform></translation>
</message>
<message>
<location line="+4"/>
<source>%1 behind</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+14"/>
<source>Last received block was generated %1 ago.</source>
<translation>Viimeisin vastaanotettu lohko tuotettu %1.</translation>
</message>
<message>
<location line="+2"/>
<source>Transactions after this will not yet be visible.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+22"/>
<source>Error</source>
<translation>Virhe</translation>
</message>
<message>
<location line="+3"/>
<source>Warning</source>
<translation>Varoitus</translation>
</message>
<message>
<location line="+3"/>
<source>Information</source>
<translation>Tietoa</translation>
</message>
<message>
<location line="+70"/>
<source>This transaction is over the size limit. You can still send it for a fee of %1, which goes to the nodes that process your transaction and helps to support the network. Do you want to pay the fee?</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-140"/>
<source>Up to date</source>
<translation>Rahansiirtohistoria on ajan tasalla</translation>
</message>
<message>
<location line="+31"/>
<source>Catching up...</source>
<translation>Saavutetaan verkkoa...</translation>
</message>
<message>
<location line="+113"/>
<source>Confirm transaction fee</source>
<translation>Vahvista maksukulu</translation>
</message>
<message>
<location line="+8"/>
<source>Sent transaction</source>
<translation>Lähetetyt rahansiirrot</translation>
</message>
<message>
<location line="+0"/>
<source>Incoming transaction</source>
<translation>Saapuva rahansiirto</translation>
</message>
<message>
<location line="+1"/>
<source>Date: %1
Amount: %2
Type: %3
Address: %4
</source>
<translation>Päivä: %1
Määrä: %2
Tyyppi: %3
Osoite: %4</translation>
</message>
<message>
<location line="+33"/>
<location line="+23"/>
<source>URI handling</source>
<translation>URI käsittely</translation>
</message>
<message>
<location line="-23"/>
<location line="+23"/>
<source>URI can not be parsed! This can be caused by an invalid Doctorcoin address or malformed URI parameters.</source>
<translation>URIa ei voitu jäsentää! Tämä voi johtua kelvottomasta Doctorcoin-osoitteesta tai virheellisistä URI parametreista.</translation>
</message>
<message>
<location line="+17"/>
<source>Wallet is <b>encrypted</b> and currently <b>unlocked</b></source>
<translation>Lompakko on <b>salattu</b> ja tällä hetkellä <b>avoinna</b></translation>
</message>
<message>
<location line="+8"/>
<source>Wallet is <b>encrypted</b> and currently <b>locked</b></source>
<translation>Lompakko on <b>salattu</b> ja tällä hetkellä <b>lukittuna</b></translation>
</message>
<message>
<location filename="../bitcoin.cpp" line="+111"/>
<source>A fatal error occurred. Doctorcoin can no longer continue safely and will quit.</source>
<translation>Peruuttamaton virhe on tapahtunut. Doctorcoin ei voi enää jatkaa turvallisesti ja sammutetaan.</translation>
</message>
</context>
<context>
<name>ClientModel</name>
<message>
<location filename="../clientmodel.cpp" line="+104"/>
<source>Network Alert</source>
<translation>Verkkohälytys</translation>
</message>
</context>
<context>
<name>EditAddressDialog</name>
<message>
<location filename="../forms/editaddressdialog.ui" line="+14"/>
<source>Edit Address</source>
<translation>Muokkaa osoitetta</translation>
</message>
<message>
<location line="+11"/>
<source>&Label</source>
<translation>&Nimi</translation>
</message>
<message>
<location line="+10"/>
<source>The label associated with this address book entry</source>
<translation>Tähän osoitteeseen liitetty nimi</translation>
</message>
<message>
<location line="+7"/>
<source>&Address</source>
<translation>&Osoite</translation>
</message>
<message>
<location line="+10"/>
<source>The address associated with this address book entry. This can only be modified for sending addresses.</source>
<translation>Osoite, joka liittyy tämän osoitekirjan merkintään. Tätä voidaan muuttaa vain lähtevissä osoitteissa.</translation>
</message>
<message>
<location filename="../editaddressdialog.cpp" line="+21"/>
<source>New receiving address</source>
<translation>Uusi vastaanottava osoite</translation>
</message>
<message>
<location line="+4"/>
<source>New sending address</source>
<translation>Uusi lähettävä osoite</translation>
</message>
<message>
<location line="+3"/>
<source>Edit receiving address</source>
<translation>Muokkaa vastaanottajan osoitetta</translation>
</message>
<message>
<location line="+4"/>
<source>Edit sending address</source>
<translation>Muokkaa lähtevää osoitetta</translation>
</message>
<message>
<location line="+76"/>
<source>The entered address "%1" is already in the address book.</source>
<translation>Osoite "%1" on jo osoitekirjassa.</translation>
</message>
<message>
<location line="-5"/>
<source>The entered address "%1" is not a valid Doctorcoin address.</source>
<translation>Antamasi osoite "%1" ei ole validi Doctorcoin-osoite.</translation>
</message>
<message>
<location line="+10"/>
<source>Could not unlock wallet.</source>
<translation>Lompakkoa ei voitu avata.</translation>
</message>
<message>
<location line="+5"/>
<source>New key generation failed.</source>
<translation>Uuden avaimen luonti epäonnistui.</translation>
</message>
</context>
<context>
<name>GUIUtil::HelpMessageBox</name>
<message>
<location filename="../guiutil.cpp" line="+424"/>
<location line="+12"/>
<source>Doctorcoin-Qt</source>
<translation>Doctorcoin-Qt</translation>
</message>
<message>
<location line="-12"/>
<source>version</source>
<translation>versio</translation>
</message>
<message>
<location line="+2"/>
<source>Usage:</source>
<translation>Käyttö:</translation>
</message>
<message>
<location line="+1"/>
<source>command-line options</source>
<translation>komentorivi parametrit</translation>
</message>
<message>
<location line="+4"/>
<source>UI options</source>
<translation>Käyttöliittymäasetukset</translation>
</message>
<message>
<location line="+1"/>
<source>Set language, for example "de_DE" (default: system locale)</source>
<translation>Set language, for example "de_DE" (default: system locale)</translation>
</message>
<message>
<location line="+1"/>
<source>Start minimized</source>
<translation>Käynnistä pienennettynä</translation>
</message>
<message>
<location line="+1"/>
<source>Show splash screen on startup (default: 1)</source>
<translation>Näytä aloitusruutu käynnistettäessä (oletus: 1)</translation>
</message>
</context>
<context>
<name>OptionsDialog</name>
<message>
<location filename="../forms/optionsdialog.ui" line="+14"/>
<source>Options</source>
<translation>Asetukset</translation>
</message>
<message>
<location line="+16"/>
<source>&Main</source>
<translation>&Yleiset</translation>
</message>
<message>
<location line="+6"/>
<source>Optional transaction fee per kB that helps make sure your transactions are processed quickly. Most transactions are 1 kB.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+15"/>
<source>Pay transaction &fee</source>
<translation>Maksa rahansiirtopalkkio</translation>
</message>
<message>
<location line="+31"/>
<source>Automatically start Doctorcoin after logging in to the system.</source>
<translation>Käynnistä Doctorcoin kirjautumisen yhteydessä.</translation>
</message>
<message>
<location line="+3"/>
<source>&Start Doctorcoin on system login</source>
<translation>&Käynnistä Doctorcoin kirjautumisen yhteydessä</translation>
</message>
<message>
<location line="+35"/>
<source>Reset all client options to default.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>&Reset Options</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+13"/>
<source>&Network</source>
<translation>&Verkko</translation>
</message>
<message>
<location line="+6"/>
<source>Automatically open the Doctorcoin client port on the router. This only works when your router supports UPnP and it is enabled.</source>
<translation>Avaa Doctorcoin-asiakasohjelman portti reitittimellä automaattisesti. Tämä toimii vain, jos reitittimesi tukee UPnP:tä ja se on käytössä.</translation>
</message>
<message>
<location line="+3"/>
<source>Map port using &UPnP</source>
<translation>Portin uudelleenohjaus &UPnP:llä</translation>
</message>
<message>
<location line="+7"/>
<source>Connect to the Doctorcoin network through a SOCKS proxy (e.g. when connecting through Tor).</source>
<translation>Ota yhteys Doctorcoin-verkkoon SOCKS-proxyn läpi (esimerkiksi kun haluat käyttää Tor-verkkoa).</translation>
</message>
<message>
<location line="+3"/>
<source>&Connect through SOCKS proxy:</source>
<translation>&Ota yhteys SOCKS-proxyn kautta:</translation>
</message>
<message>
<location line="+9"/>
<source>Proxy &IP:</source>
<translation>Proxyn &IP:</translation>
</message>
<message>
<location line="+19"/>
<source>IP address of the proxy (e.g. 127.0.0.1)</source>
<translation>Välityspalvelimen IP-osoite (esim. 127.0.0.1)</translation>
</message>
<message>
<location line="+7"/>
<source>&Port:</source>
<translation>&Portti</translation>
</message>
<message>
<location line="+19"/>
<source>Port of the proxy (e.g. 9050)</source>
<translation>Proxyn Portti (esim. 9050)</translation>
</message>
<message>
<location line="+7"/>
<source>SOCKS &Version:</source>
<translation>SOCKS &Versio:</translation>
</message>
<message>
<location line="+13"/>
<source>SOCKS version of the proxy (e.g. 5)</source>
<translation>Proxyn SOCKS-versio (esim. 5)</translation>
</message>
<message>
<location line="+36"/>
<source>&Window</source>
<translation>&Ikkuna</translation>
</message>
<message>
<location line="+6"/>
<source>Show only a tray icon after minimizing the window.</source>
<translation>Näytä ainoastaan ilmaisinalueella ikkunan pienentämisen jälkeen.</translation>
</message>
<message>
<location line="+3"/>
<source>&Minimize to the tray instead of the taskbar</source>
<translation>&Pienennä ilmaisinalueelle työkalurivin sijasta</translation>
</message>
<message>
<location line="+7"/>
<source>Minimize instead of exit the application when the window is closed. When this option is enabled, the application will be closed only after selecting Quit in the menu.</source>
<translation>Ikkunaa suljettaessa vain pienentää Doctorcoin-ohjelman ikkunan lopettamatta itse ohjelmaa. Kun tämä asetus on valittuna, ohjelman voi sulkea vain valitsemalla Lopeta ohjelman valikosta.</translation>
</message>
<message>
<location line="+3"/>
<source>M&inimize on close</source>
<translation>P&ienennä suljettaessa</translation>
</message>
<message>
<location line="+21"/>
<source>&Display</source>
<translation>&Käyttöliittymä</translation>
</message>
<message>
<location line="+8"/>
<source>User Interface &language:</source>
<translation>&Käyttöliittymän kieli</translation>
</message>
<message>
<location line="+13"/>
<source>The user interface language can be set here. This setting will take effect after restarting Doctorcoin.</source>
<translation>Tässä voit määritellä käyttöliittymän kielen. Muutokset astuvat voimaan seuraavan kerran, kun Doctorcoin käynnistetään.</translation>
</message>
<message>
<location line="+11"/>
<source>&Unit to show amounts in:</source>
<translation>Yksikkö jona doctorcoin-määrät näytetään</translation>
</message>
<message>
<location line="+13"/>
<source>Choose the default subdivision unit to show in the interface and when sending coins.</source>
<translation>Valitse mitä yksikköä käytetään ensisijaisesti doctorcoin-määrien näyttämiseen.</translation>
</message>
<message>
<location line="+9"/>
<source>Whether to show Doctorcoin addresses in the transaction list or not.</source>
<translation>Näytetäänkö Doctorcoin-osoitteet rahansiirrot listassa vai ei.</translation>
</message>
<message>
<location line="+3"/>
<source>&Display addresses in transaction list</source>
<translation>&Näytä osoitteet rahansiirrot listassa</translation>
</message>
<message>
<location line="+71"/>
<source>&OK</source>
<translation>&OK</translation>
</message>
<message>
<location line="+7"/>
<source>&Cancel</source>
<translation>&Peruuta</translation>
</message>
<message>
<location line="+10"/>
<source>&Apply</source>
<translation>&Hyväksy</translation>
</message>
<message>
<location filename="../optionsdialog.cpp" line="+53"/>
<source>default</source>
<translation>oletus</translation>
</message>
<message>
<location line="+130"/>
<source>Confirm options reset</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Some settings may require a client restart to take effect.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>Do you want to proceed?</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+42"/>
<location line="+9"/>
<source>Warning</source>
<translation>Varoitus</translation>
</message>
<message>
<location line="-9"/>
<location line="+9"/>
<source>This setting will take effect after restarting Doctorcoin.</source>
<translation>Tämä asetus astuu voimaan seuraavalla kerralla, kun Doctorcoin käynnistetään.</translation>
</message>
<message>
<location line="+29"/>
<source>The supplied proxy address is invalid.</source>
<translation>Antamasi proxy-osoite on virheellinen.</translation>
</message>
</context>
<context>
<name>OverviewPage</name>
<message>
<location filename="../forms/overviewpage.ui" line="+14"/>
<source>Form</source>
<translation>Lomake</translation>
</message>
<message>
<location line="+50"/>
<location line="+166"/>
<source>The displayed information may be out of date. Your wallet automatically synchronizes with the Doctorcoin network after a connection is established, but this process has not completed yet.</source>
<translation>Näytetyt tiedot eivät välttämättä ole ajantasalla. Lompakkosi synkronoituu Doctorcoin-verkon kanssa automaattisesti yhteyden muodostamisen jälkeen, mutta synkronointi on vielä meneillään.</translation>
</message>
<message>
<location line="-124"/>
<source>Balance:</source>
<translation>Saldo:</translation>
</message>
<message>
<location line="+29"/>
<source>Unconfirmed:</source>
<translation>Vahvistamatta:</translation>
</message>
<message>
<location line="-78"/>
<source>Wallet</source>
<translation>Lompakko</translation>
</message>
<message>
<location line="+107"/>
<source>Immature:</source>
<translation>Epäkypsää:</translation>
</message>
<message>
<location line="+13"/>
<source>Mined balance that has not yet matured</source>
<translation>Louhittu saldo, joka ei ole vielä kypsynyt</translation>
</message>
<message>
<location line="+46"/>
<source><b>Recent transactions</b></source>
<translation><b>Viimeisimmät rahansiirrot</b></translation>
</message>
<message>
<location line="-101"/>
<source>Your current balance</source>
<translation>Tililläsi tällä hetkellä olevien Doctorcoinien määrä</translation>
</message>
<message>
<location line="+29"/>
<source>Total of transactions that have yet to be confirmed, and do not yet count toward the current balance</source>
<translation>Niiden saapuvien rahansiirtojen määrä, joita Doctorcoin-verkko ei vielä ole ehtinyt vahvistaa ja siten eivät vielä näy saldossa.</translation>
</message>
<message>
<location filename="../overviewpage.cpp" line="+116"/>
<location line="+1"/>
<source>out of sync</source>
<translation>Ei ajan tasalla</translation>
</message>
</context>
<context>
<name>PaymentServer</name>
<message>
<location filename="../paymentserver.cpp" line="+107"/>
<source>Cannot start doctorcoin: click-to-pay handler</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>QRCodeDialog</name>
<message>
<location filename="../forms/qrcodedialog.ui" line="+14"/>
<source>QR Code Dialog</source>
<translation>QR-koodi Dialogi</translation>
</message>
<message>
<location line="+59"/>
<source>Request Payment</source>
<translation>Vastaanota maksu</translation>
</message>
<message>
<location line="+56"/>
<source>Amount:</source>
<translation>Määrä:</translation>
</message>
<message>
<location line="-44"/>
<source>Label:</source>
<translation>Tunniste:</translation>
</message>
<message>
<location line="+19"/>
<source>Message:</source>
<translation>Viesti:</translation>
</message>
<message>
<location line="+71"/>
<source>&Save As...</source>
<translation>&Tallenna nimellä...</translation>
</message>
<message>
<location filename="../qrcodedialog.cpp" line="+62"/>
<source>Error encoding URI into QR Code.</source>
<translation>Virhe käännettäessä URI:a QR-koodiksi.</translation>
</message>
<message>
<location line="+40"/>
<source>The entered amount is invalid, please check.</source>
<translation>Syötetty määrä on virheellinen. Tarkista kirjoitusasu.</translation>
</message>
<message>
<location line="+23"/>
<source>Resulting URI too long, try to reduce the text for label / message.</source>
<translation>Tuloksen URI liian pitkä, yritä lyhentää otsikon tekstiä / viestiä.</translation>
</message>
<message>
<location line="+25"/>
<source>Save QR Code</source>
<translation>Tallenna QR-koodi</translation>
</message>
<message>
<location line="+0"/>
<source>PNG Images (*.png)</source>
<translation>PNG kuvat (*png)</translation>
</message>
</context>
<context>
<name>RPCConsole</name>
<message>
<location filename="../forms/rpcconsole.ui" line="+46"/>
<source>Client name</source>
<translation>Pääteohjelman nimi</translation>
</message>
<message>
<location line="+10"/>
<location line="+23"/>
<location line="+26"/>
<location line="+23"/>
<location line="+23"/>
<location line="+36"/>
<location line="+53"/>
<location line="+23"/>
<location line="+23"/>
<location filename="../rpcconsole.cpp" line="+339"/>
<source>N/A</source>
<translation>Ei saatavilla</translation>
</message>
<message>
<location line="-217"/>
<source>Client version</source>
<translation>Pääteohjelman versio</translation>
</message>
<message>
<location line="-45"/>
<source>&Information</source>
<translation>T&ietoa</translation>
</message>
<message>
<location line="+68"/>
<source>Using OpenSSL version</source>
<translation>Käytössä oleva OpenSSL-versio</translation>
</message>
<message>
<location line="+49"/>
<source>Startup time</source>
<translation>Käynnistysaika</translation>
</message>
<message>
<location line="+29"/>
<source>Network</source>
<translation>Verkko</translation>
</message>
<message>
<location line="+7"/>
<source>Number of connections</source>
<translation>Yhteyksien lukumäärä</translation>
</message>
<message>
<location line="+23"/>
<source>On testnet</source>
<translation>Käyttää testiverkkoa</translation>
</message>
<message>
<location line="+23"/>
<source>Block chain</source>
<translation>Lohkoketju</translation>
</message>
<message>
<location line="+7"/>
<source>Current number of blocks</source>
<translation>Nykyinen Lohkojen määrä</translation>
</message>
<message>
<location line="+23"/>
<source>Estimated total blocks</source>
<translation>Arvioitu lohkojen kokonaismäärä</translation>
</message>
<message>
<location line="+23"/>
<source>Last block time</source>
<translation>Viimeisimmän lohkon aika</translation>
</message>
<message>
<location line="+52"/>
<source>&Open</source>
<translation>&Avaa</translation>
</message>
<message>
<location line="+16"/>
<source>Command-line options</source>
<translation>Komentorivi parametrit</translation>
</message>
<message>
<location line="+7"/>
<source>Show the Doctorcoin-Qt help message to get a list with possible Doctorcoin command-line options.</source>
<translation>Näytä Doctorcoin-Qt komentoriviparametrien ohjesivu, jossa on listattuna mahdolliset komentoriviparametrit.</translation>
</message>
<message>
<location line="+3"/>
<source>&Show</source>
<translation>&Näytä</translation>
</message>
<message>
<location line="+24"/>
<source>&Console</source>
<translation>&Konsoli</translation>
</message>
<message>
<location line="-260"/>
<source>Build date</source>
<translation>Kääntöpäiväys</translation>
</message>
<message>
<location line="-104"/>
<source>Doctorcoin - Debug window</source>
<translation>Doctorcoin - Debug ikkuna</translation>
</message>
<message>
<location line="+25"/>
<source>Doctorcoin Core</source>
<translation>Doctorcoin-ydin</translation>
</message>
<message>
<location line="+279"/>
<source>Debug log file</source>
<translation>Debug lokitiedosto</translation>
</message>
<message>
<location line="+7"/>
<source>Open the Doctorcoin debug log file from the current data directory. This can take a few seconds for large log files.</source>
<translation>Avaa lokitiedosto nykyisestä data-kansiosta. Tämä voi viedä useamman sekunnin, jos lokitiedosto on iso.</translation>
</message>
<message>
<location line="+102"/>
<source>Clear console</source>
<translation>Tyhjennä konsoli</translation>
</message>
<message>
<location filename="../rpcconsole.cpp" line="-30"/>
<source>Welcome to the Doctorcoin RPC console.</source>
<translation>Tervetuloa Doctorcoin RPC konsoliin.</translation>
</message>
<message>
<location line="+1"/>
<source>Use up and down arrows to navigate history, and <b>Ctrl-L</b> to clear screen.</source>
<translation>Ylös- ja alas-nuolet selaavat historiaa ja <b>Ctrl-L</b> tyhjentää ruudun.</translation>
</message>
<message>
<location line="+1"/>
<source>Type <b>help</b> for an overview of available commands.</source>
<translation>Kirjoita <b>help</b> nähdäksesi yleiskatsauksen käytettävissä olevista komennoista.</translation>
</message>
</context>
<context>
<name>SendCoinsDialog</name>
<message>
<location filename="../forms/sendcoinsdialog.ui" line="+14"/>
<location filename="../sendcoinsdialog.cpp" line="+124"/>
<location line="+5"/>
<location line="+5"/>
<location line="+5"/>
<location line="+6"/>
<location line="+5"/>
<location line="+5"/>
<source>Send Coins</source>
<translation>Lähetä Doctorcoineja</translation>
</message>
<message>
<location line="+50"/>
<source>Send to multiple recipients at once</source>
<translation>Lähetä monelle vastaanottajalle</translation>
</message>
<message>
<location line="+3"/>
<source>Add &Recipient</source>
<translation>Lisää &Vastaanottaja</translation>
</message>
<message>
<location line="+20"/>
<source>Remove all transaction fields</source>
<translation>Poista kaikki rahansiirtokentät</translation>
</message>
<message>
<location line="+3"/>
<source>Clear &All</source>
<translation>&Tyhjennnä Kaikki</translation>
</message>
<message>
<location line="+22"/>
<source>Balance:</source>
<translation>Saldo:</translation>
</message>
<message>
<location line="+10"/>
<source>123.456 BTC</source>
<translation>123,456 BTC</translation>
</message>
<message>
<location line="+31"/>
<source>Confirm the send action</source>
<translation>Vahvista lähetys</translation>
</message>
<message>
<location line="+3"/>
<source>S&end</source>
<translation>&Lähetä</translation>
</message>
<message>
<location filename="../sendcoinsdialog.cpp" line="-59"/>
<source><b>%1</b> to %2 (%3)</source>
<translation><b>%1</b> to %2 (%3)</translation>
</message>
<message>
<location line="+5"/>
<source>Confirm send coins</source>
<translation>Hyväksy Doctorcoinien lähettäminen</translation>
</message>
<message>
<location line="+1"/>
<source>Are you sure you want to send %1?</source>
<translation>Haluatko varmasti lähettää %1?</translation>
</message>
<message>
<location line="+0"/>
<source> and </source>
<translation> ja </translation>
</message>
<message>
<location line="+23"/>
<source>The recipient address is not valid, please recheck.</source>
<translation>Vastaanottajan osoite on virheellinen. Tarkista osoite.</translation>
</message>
<message>
<location line="+5"/>
<source>The amount to pay must be larger than 0.</source>
<translation>Maksettavan summan tulee olla suurempi kuin 0 Doctorcoinia.</translation>
</message>
<message>
<location line="+5"/>
<source>The amount exceeds your balance.</source>
<translation>Määrä ylittää käytettävissä olevan saldon.</translation>
</message>
<message>
<location line="+5"/>
<source>The total exceeds your balance when the %1 transaction fee is included.</source>
<translation>Kokonaismäärä ylittää saldosi kun %1 maksukulu lisätään summaan.</translation>
</message>
<message>
<location line="+6"/>
<source>Duplicate address found, can only send to each address once per send operation.</source>
<translation>Sama osoite toistuu useamman kerran. Samaan osoitteeseen voi lähettää vain kerran per maksu.</translation>
</message>
<message>
<location line="+5"/>
<source>Error: Transaction creation failed!</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Error: The transaction was rejected. This might happen if some of the coins in your wallet were already spent, such as if you used a copy of wallet.dat and coins were spent in the copy but not marked as spent here.</source>
<translation>Virhe: Rahansiirto hylättiin. Tämä voi tapahtua jos jotkin doctorcoineistasi on jo käytetty, esimerkiksi jos olet käyttänyt kopiota wallet.dat-lompakkotiedostosta ja doctorcoinit on merkitty käytetyksi vain kopiossa.</translation>
</message>
</context>
<context>
<name>SendCoinsEntry</name>
<message>
<location filename="../forms/sendcoinsentry.ui" line="+14"/>
<source>Form</source>
<translation>Lomake</translation>
</message>
<message>
<location line="+15"/>
<source>A&mount:</source>
<translation>M&äärä:</translation>
</message>
<message>
<location line="+13"/>
<source>Pay &To:</source>
<translation>Maksun saaja:</translation>
</message>
<message>
<location line="+34"/>
<source>The address to send the payment to (e.g. Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+60"/>
<location filename="../sendcoinsentry.cpp" line="+26"/>
<source>Enter a label for this address to add it to your address book</source>
<translation>Anna nimi tälle osoitteelle, jos haluat lisätä sen osoitekirjaan</translation>
</message>
<message>
<location line="-78"/>
<source>&Label:</source>
<translation>&Nimi:</translation>
</message>
<message>
<location line="+28"/>
<source>Choose address from address book</source>
<translation>Valitse osoite osoitekirjasta</translation>
</message>
<message>
<location line="+10"/>
<source>Alt+A</source>
<translation>Alt+A</translation>
</message>
<message>
<location line="+7"/>
<source>Paste address from clipboard</source>
<translation>Liitä osoite leikepöydältä</translation>
</message>
<message>
<location line="+10"/>
<source>Alt+P</source>
<translation>Alt+P</translation>
</message>
<message>
<location line="+7"/>
<source>Remove this recipient</source>
<translation>Poista </translation>
</message>
<message>
<location filename="../sendcoinsentry.cpp" line="+1"/>
<source>Enter a Doctorcoin address (e.g. Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)</source>
<translation>Anna Doctorcoin-osoite (esim. Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)</translation>
</message>
</context>
<context>
<name>SignVerifyMessageDialog</name>
<message>
<location filename="../forms/signverifymessagedialog.ui" line="+14"/>
<source>Signatures - Sign / Verify a Message</source>
<translation>Allekirjoitukset - Allekirjoita / Varmista viesti</translation>
</message>
<message>
<location line="+13"/>
<source>&Sign Message</source>
<translation>&Allekirjoita viesti</translation>
</message>
<message>
<location line="+6"/>
<source>You can sign messages with your addresses to prove you own them. Be careful not to sign anything vague, as phishing attacks may try to trick you into signing your identity over to them. Only sign fully-detailed statements you agree to.</source>
<translation>Voit allekirjoittaa viestit omalla osoitteellasi todistaaksesi että omistat ne. Ole huolellinen, että et allekirjoita mitään epämääräistä, phishing-hyökkääjät voivat huijata sinua allekirjoittamaan luovuttamalla henkilöllisyytesi. Allekirjoita selvitys täysin yksityiskohtaisesti mihin olet sitoutunut.</translation>
</message>
<message>
<location line="+18"/>
<source>The address to sign the message with (e.g. Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)</source>
<translation>Osoite, jolla viesti allekirjoitetaan (esimerkiksi Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)</translation>
</message>
<message>
<location line="+10"/>
<location line="+213"/>
<source>Choose an address from the address book</source>
<translation>Valitse osoite osoitekirjasta</translation>
</message>
<message>
<location line="-203"/>
<location line="+213"/>
<source>Alt+A</source>
<translation>Alt+A</translation>
</message>
<message>
<location line="-203"/>
<source>Paste address from clipboard</source>
<translation>Liitä osoite leikepöydältä</translation>
</message>
<message>
<location line="+10"/>
<source>Alt+P</source>
<translation>Alt+P</translation>
</message>
<message>
<location line="+12"/>
<source>Enter the message you want to sign here</source>
<translation>Kirjoita tähän viesti minkä haluat allekirjoittaa</translation>
</message>
<message>
<location line="+7"/>
<source>Signature</source>
<translation>Allekirjoitus</translation>
</message>
<message>
<location line="+27"/>
<source>Copy the current signature to the system clipboard</source>
<translation>Kopioi tämänhetkinen allekirjoitus leikepöydälle</translation>
</message>
<message>
<location line="+21"/>
<source>Sign the message to prove you own this Doctorcoin address</source>
<translation>Allekirjoita viesti todistaaksesi, että omistat tämän Doctorcoin-osoitteen</translation>
</message>
<message>
<location line="+3"/>
<source>Sign &Message</source>
<translation>Allekirjoita &viesti</translation>
</message>
<message>
<location line="+14"/>
<source>Reset all sign message fields</source>
<translation>Tyhjennä kaikki allekirjoita-viesti-kentät</translation>
</message>
<message>
<location line="+3"/>
<location line="+146"/>
<source>Clear &All</source>
<translation>&Tyhjennä Kaikki</translation>
</message>
<message>
<location line="-87"/>
<source>&Verify Message</source>
<translation>&Varmista viesti</translation>
</message>
<message>
<location line="+6"/>
<source>Enter the signing address, message (ensure you copy line breaks, spaces, tabs, etc. exactly) and signature below to verify the message. Be careful not to read more into the signature than what is in the signed message itself, to avoid being tricked by a man-in-the-middle attack.</source>
<translation>Syötä allekirjoittava osoite, viesti ja allekirjoitus alla oleviin kenttiin varmistaaksesi allekirjoituksen aitouden. Varmista että kopioit kaikki kentät täsmälleen oikein, myös rivinvaihdot, välilyönnit, tabulaattorit, jne.</translation>
</message>
<message>
<location line="+21"/>
<source>The address the message was signed with (e.g. Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)</source>
<translation>Osoite, jolla viesti allekirjoitettiin (esimerkiksi Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)</translation>
</message>
<message>
<location line="+40"/>
<source>Verify the message to ensure it was signed with the specified Doctorcoin address</source>
<translation>Tarkista viestin allekirjoitus varmistaaksesi, että se allekirjoitettiin tietyllä Doctorcoin-osoitteella</translation>
</message>
<message>
<location line="+3"/>
<source>Verify &Message</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+14"/>
<source>Reset all verify message fields</source>
<translation>Tyhjennä kaikki varmista-viesti-kentät</translation>
</message>
<message>
<location filename="../signverifymessagedialog.cpp" line="+27"/>
<location line="+3"/>
<source>Enter a Doctorcoin address (e.g. Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)</source>
<translation>Anna Doctorcoin-osoite (esim. Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)</translation>
</message>
<message>
<location line="-2"/>
<source>Click "Sign Message" to generate signature</source>
<translation>Klikkaa "Allekirjoita Viesti luodaksesi allekirjoituksen </translation>
</message>
<message>
<location line="+3"/>
<source>Enter Doctorcoin signature</source>
<translation>Syötä Doctorcoin-allekirjoitus</translation>
</message>
<message>
<location line="+82"/>
<location line="+81"/>
<source>The entered address is invalid.</source>
<translation>Syötetty osoite on virheellinen.</translation>
</message>
<message>
<location line="-81"/>
<location line="+8"/>
<location line="+73"/>
<location line="+8"/>
<source>Please check the address and try again.</source>
<translation>Tarkista osoite ja yritä uudelleen.</translation>
</message>
<message>
<location line="-81"/>
<location line="+81"/>
<source>The entered address does not refer to a key.</source>
<translation>Syötetyn osoitteen avainta ei löydy.</translation>
</message>
<message>
<location line="-73"/>
<source>Wallet unlock was cancelled.</source>
<translation>Lompakon avaaminen peruttiin.</translation>
</message>
<message>
<location line="+8"/>
<source>Private key for the entered address is not available.</source>
<translation>Yksityistä avainta syötetylle osoitteelle ei ole saatavilla.</translation>
</message>
<message>
<location line="+12"/>
<source>Message signing failed.</source>
<translation>Viestin allekirjoitus epäonnistui.</translation>
</message>
<message>
<location line="+5"/>
<source>Message signed.</source>
<translation>Viesti allekirjoitettu.</translation>
</message>
<message>
<location line="+59"/>
<source>The signature could not be decoded.</source>
<translation>Allekirjoitusta ei pystytty tulkitsemaan.</translation>
</message>
<message>
<location line="+0"/>
<location line="+13"/>
<source>Please check the signature and try again.</source>
<translation>Tarkista allekirjoitus ja yritä uudelleen.</translation>
</message>
<message>
<location line="+0"/>
<source>The signature did not match the message digest.</source>
<translation>Allekirjoitus ei täsmää viestin tiivisteeseen.</translation>
</message>
<message>
<location line="+7"/>
<source>Message verification failed.</source>
<translation>Viestin varmistus epäonnistui.</translation>
</message>
<message>
<location line="+5"/>
<source>Message verified.</source>
<translation>Viesti varmistettu.</translation>
</message>
</context>
<context>
<name>SplashScreen</name>
<message>
<location filename="../splashscreen.cpp" line="+22"/>
<source>The Doctorcoin developers</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>[testnet]</source>
<translation>[testnet]</translation>
</message>
</context>
<context>
<name>TransactionDesc</name>
<message>
<location filename="../transactiondesc.cpp" line="+20"/>
<source>Open until %1</source>
<translation>Avoinna %1 asti</translation>
</message>
<message>
<location line="+6"/>
<source>%1/offline</source>
<translation>%1/offline</translation>
</message>
<message>
<location line="+2"/>
<source>%1/unconfirmed</source>
<translation>%1/vahvistamaton</translation>
</message>
<message>
<location line="+2"/>
<source>%1 confirmations</source>
<translation>%1 vahvistusta</translation>
</message>
<message>
<location line="+18"/>
<source>Status</source>
<translation>Tila</translation>
</message>
<message numerus="yes">
<location line="+7"/>
<source>, broadcast through %n node(s)</source>
<translation><numerusform>lähetetty %n noodin läpi</numerusform><numerusform>lähetetty %n noodin läpi</numerusform></translation>
</message>
<message>
<location line="+4"/>
<source>Date</source>
<translation>Päivämäärä</translation>
</message>
<message>
<location line="+7"/>
<source>Source</source>
<translation>Lähde</translation>
</message>
<message>
<location line="+0"/>
<source>Generated</source>
<translation>Generoitu</translation>
</message>
<message>
<location line="+5"/>
<location line="+17"/>
<source>From</source>
<translation>Lähettäjä</translation>
</message>
<message>
<location line="+1"/>
<location line="+22"/>
<location line="+58"/>
<source>To</source>
<translation>Saaja</translation>
</message>
<message>
<location line="-77"/>
<location line="+2"/>
<source>own address</source>
<translation>oma osoite</translation>
</message>
<message>
<location line="-2"/>
<source>label</source>
<translation>nimi</translation>
</message>
<message>
<location line="+37"/>
<location line="+12"/>
<location line="+45"/>
<location line="+17"/>
<location line="+30"/>
<source>Credit</source>
<translation>Credit</translation>
</message>
<message numerus="yes">
<location line="-102"/>
<source>matures in %n more block(s)</source>
<translation><numerusform>kypsyy %n lohkon kuluttua</numerusform><numerusform>kypsyy %n lohkon kuluttua</numerusform></translation>
</message>
<message>
<location line="+2"/>
<source>not accepted</source>
<translation>ei hyväksytty</translation>
</message>
<message>
<location line="+44"/>
<location line="+8"/>
<location line="+15"/>
<location line="+30"/>
<source>Debit</source>
<translation>Debit</translation>
</message>
<message>
<location line="-39"/>
<source>Transaction fee</source>
<translation>Maksukulu</translation>
</message>
<message>
<location line="+16"/>
<source>Net amount</source>
<translation>Netto määrä</translation>
</message>
<message>
<location line="+6"/>
<source>Message</source>
<translation>Viesti</translation>
</message>
<message>
<location line="+2"/>
<source>Comment</source>
<translation>Viesti</translation>
</message>
<message>
<location line="+2"/>
<source>Transaction ID</source>
<translation>Siirtotunnus</translation>
</message>
<message>
<location line="+3"/>
<source>Generated coins must mature 120 blocks before they can be spent. When you generated this block, it was broadcast to the network to be added to the block chain. If it fails to get into the chain, its state will change to "not accepted" and it won't be spendable. This may occasionally happen if another node generates a block within a few seconds of yours.</source>
<translation>Generoitujen kolikoiden täytyy kypsyä 120 lohkon ajan ennen kuin ne voidaan lähettää. Kun loit tämän lohkon, se lähetettiin verkkoon lisättäväksi lohkoketjuun. Jos se ei päädy osaksi lohkoketjua, sen tila vaihtuu "ei hyväksytty" ja sitä ei voida lähettää. Näin voi joskus käydä, jos toinen noodi löytää lohkon muutamaa sekuntia ennen tai jälkeen sinun lohkosi löytymisen.</translation>
</message>
<message>
<location line="+7"/>
<source>Debug information</source>
<translation>Debug tiedot</translation>
</message>
<message>
<location line="+8"/>
<source>Transaction</source>
<translation>Rahansiirto</translation>
</message>
<message>
<location line="+3"/>
<source>Inputs</source>
<translation>Sisääntulot</translation>
</message>
<message>
<location line="+23"/>
<source>Amount</source>
<translation>Määrä</translation>
</message>
<message>
<location line="+1"/>
<source>true</source>
<translation>tosi</translation>
</message>
<message>
<location line="+0"/>
<source>false</source>
<translation>epätosi</translation>
</message>
<message>
<location line="-209"/>
<source>, has not been successfully broadcast yet</source>
<translation>, ei ole vielä onnistuneesti lähetetty</translation>
</message>
<message numerus="yes">
<location line="-35"/>
<source>Open for %n more block(s)</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message>
<location line="+70"/>
<source>unknown</source>
<translation>tuntematon</translation>
</message>
</context>
<context>
<name>TransactionDescDialog</name>
<message>
<location filename="../forms/transactiondescdialog.ui" line="+14"/>
<source>Transaction details</source>
<translation>Rahansiirron yksityiskohdat</translation>
</message>
<message>
<location line="+6"/>
<source>This pane shows a detailed description of the transaction</source>
<translation>Tämä ruutu näyttää yksityiskohtaisen tiedon rahansiirrosta</translation>
</message>
</context>
<context>
<name>TransactionTableModel</name>
<message>
<location filename="../transactiontablemodel.cpp" line="+225"/>
<source>Date</source>
<translation>Päivämäärä</translation>
</message>
<message>
<location line="+0"/>
<source>Type</source>
<translation>Laatu</translation>
</message>
<message>
<location line="+0"/>
<source>Address</source>
<translation>Osoite</translation>
</message>
<message>
<location line="+0"/>
<source>Amount</source>
<translation>Määrä</translation>
</message>
<message numerus="yes">
<location line="+57"/>
<source>Open for %n more block(s)</source>
<translation type="unfinished"><numerusform></numerusform><numerusform></numerusform></translation>
</message>
<message>
<location line="+3"/>
<source>Open until %1</source>
<translation>Avoinna %1 asti</translation>
</message>
<message>
<location line="+3"/>
<source>Offline (%1 confirmations)</source>
<translation>Ei yhteyttä verkkoon (%1 vahvistusta)</translation>
</message>
<message>
<location line="+3"/>
<source>Unconfirmed (%1 of %2 confirmations)</source>
<translation>Vahvistamatta (%1/%2 vahvistusta)</translation>
</message>
<message>
<location line="+3"/>
<source>Confirmed (%1 confirmations)</source>
<translation>Vahvistettu (%1 vahvistusta)</translation>
</message>
<message numerus="yes">
<location line="+8"/>
<source>Mined balance will be available when it matures in %n more block(s)</source>
<translation><numerusform>Louhittu saldo on käytettävissä kun se kypsyy %n lohkon päästä</numerusform><numerusform>Louhittu saldo on käytettävissä kun se kypsyy %n lohkon päästä</numerusform></translation>
</message>
<message>
<location line="+5"/>
<source>This block was not received by any other nodes and will probably not be accepted!</source>
<translation>Tätä lohkoa ei vastaanotettu mistään muusta solmusta ja sitä ei mahdollisesti hyväksytä!</translation>
</message>
<message>
<location line="+3"/>
<source>Generated but not accepted</source>
<translation>Generoitu mutta ei hyväksytty</translation>
</message>
<message>
<location line="+43"/>
<source>Received with</source>
<translation>Vastaanotettu osoitteella</translation>
</message>
<message>
<location line="+2"/>
<source>Received from</source>
<translation>Vastaanotettu</translation>
</message>
<message>
<location line="+3"/>
<source>Sent to</source>
<translation>Saaja</translation>
</message>
<message>
<location line="+2"/>
<source>Payment to yourself</source>
<translation>Maksu itsellesi</translation>
</message>
<message>
<location line="+2"/>
<source>Mined</source>
<translation>Louhittu</translation>
</message>
<message>
<location line="+38"/>
<source>(n/a)</source>
<translation>(ei saatavilla)</translation>
</message>
<message>
<location line="+199"/>
<source>Transaction status. Hover over this field to show number of confirmations.</source>
<translation>Rahansiirron tila. Siirrä osoitin kentän päälle nähdäksesi vahvistusten lukumäärä.</translation>
</message>
<message>
<location line="+2"/>
<source>Date and time that the transaction was received.</source>
<translation>Rahansiirron vastaanottamisen päivämäärä ja aika.</translation>
</message>
<message>
<location line="+2"/>
<source>Type of transaction.</source>
<translation>Rahansiirron laatu.</translation>
</message>
<message>
<location line="+2"/>
<source>Destination address of transaction.</source>
<translation>Rahansiirron kohteen Doctorcoin-osoite</translation>
</message>
<message>
<location line="+2"/>
<source>Amount removed from or added to balance.</source>
<translation>Saldoon lisätty tai siitä vähennetty määrä.</translation>
</message>
</context>
<context>
<name>TransactionView</name>
<message>
<location filename="../transactionview.cpp" line="+52"/>
<location line="+16"/>
<source>All</source>
<translation>Kaikki</translation>
</message>
<message>
<location line="-15"/>
<source>Today</source>
<translation>Tänään</translation>
</message>
<message>
<location line="+1"/>
<source>This week</source>
<translation>Tällä viikolla</translation>
</message>
<message>
<location line="+1"/>
<source>This month</source>
<translation>Tässä kuussa</translation>
</message>
<message>
<location line="+1"/>
<source>Last month</source>
<translation>Viime kuussa</translation>
</message>
<message>
<location line="+1"/>
<source>This year</source>
<translation>Tänä vuonna</translation>
</message>
<message>
<location line="+1"/>
<source>Range...</source>
<translation>Alue...</translation>
</message>
<message>
<location line="+11"/>
<source>Received with</source>
<translation>Vastaanotettu osoitteella</translation>
</message>
<message>
<location line="+2"/>
<source>Sent to</source>
<translation>Saaja</translation>
</message>
<message>
<location line="+2"/>
<source>To yourself</source>
<translation>Itsellesi</translation>
</message>
<message>
<location line="+1"/>
<source>Mined</source>
<translation>Louhittu</translation>
</message>
<message>
<location line="+1"/>
<source>Other</source>
<translation>Muu</translation>
</message>
<message>
<location line="+7"/>
<source>Enter address or label to search</source>
<translation>Anna etsittävä osoite tai tunniste</translation>
</message>
<message>
<location line="+7"/>
<source>Min amount</source>
<translation>Minimimäärä</translation>
</message>
<message>
<location line="+34"/>
<source>Copy address</source>
<translation>Kopioi osoite</translation>
</message>
<message>
<location line="+1"/>
<source>Copy label</source>
<translation>Kopioi nimi</translation>
</message>
<message>
<location line="+1"/>
<source>Copy amount</source>
<translation>Kopioi määrä</translation>
</message>
<message>
<location line="+1"/>
<source>Copy transaction ID</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Edit label</source>
<translation>Muokkaa nimeä</translation>
</message>
<message>
<location line="+1"/>
<source>Show transaction details</source>
<translation>Näytä rahansiirron yksityiskohdat</translation>
</message>
<message>
<location line="+139"/>
<source>Export Transaction Data</source>
<translation>Vie rahansiirron tiedot</translation>
</message>
<message>
<location line="+1"/>
<source>Comma separated file (*.csv)</source>
<translation>Comma separated file (*.csv)</translation>
</message>
<message>
<location line="+8"/>
<source>Confirmed</source>
<translation>Vahvistettu</translation>
</message>
<message>
<location line="+1"/>
<source>Date</source>
<translation>Aika</translation>
</message>
<message>
<location line="+1"/>
<source>Type</source>
<translation>Laatu</translation>
</message>
<message>
<location line="+1"/>
<source>Label</source>
<translation>Nimi</translation>
</message>
<message>
<location line="+1"/>
<source>Address</source>
<translation>Osoite</translation>
</message>
<message>
<location line="+1"/>
<source>Amount</source>
<translation>Määrä</translation>
</message>
<message>
<location line="+1"/>
<source>ID</source>
<translation>ID</translation>
</message>
<message>
<location line="+4"/>
<source>Error exporting</source>
<translation>Virhe tietojen viennissä</translation>
</message>
<message>
<location line="+0"/>
<source>Could not write to file %1.</source>
<translation>Ei voida kirjoittaa tiedostoon %1.</translation>
</message>
<message>
<location line="+100"/>
<source>Range:</source>
<translation>Alue:</translation>
</message>
<message>
<location line="+8"/>
<source>to</source>
<translation>kenelle</translation>
</message>
</context>
<context>
<name>WalletModel</name>
<message>
<location filename="../walletmodel.cpp" line="+193"/>
<source>Send Coins</source>
<translation>Lähetä Doctorcoineja</translation>
</message>
</context>
<context>
<name>WalletView</name>
<message>
<location filename="../walletview.cpp" line="+42"/>
<source>&Export</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Export the data in the current tab to a file</source>
<translation>Vie auki olevan välilehden tiedot tiedostoon</translation>
</message>
<message>
<location line="+193"/>
<source>Backup Wallet</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>Wallet Data (*.dat)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Backup Failed</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+0"/>
<source>There was an error trying to save the wallet data to the new location.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+4"/>
<source>Backup Successful</source>
<translation>Varmuuskopio Onnistui</translation>
</message>
<message>
<location line="+0"/>
<source>The wallet data was successfully saved to the new location.</source>
<translation type="unfinished"/>
</message>
</context>
<context>
<name>bitcoin-core</name>
<message>
<location filename="../bitcoinstrings.cpp" line="+94"/>
<source>Doctorcoin version</source>
<translation>Doctorcoinin versio</translation>
</message>
<message>
<location line="+102"/>
<source>Usage:</source>
<translation>Käyttö:</translation>
</message>
<message>
<location line="-29"/>
<source>Send command to -server or doctorcoind</source>
<translation>Lähetä käsky palvelimelle tai doctorcoind:lle</translation>
</message>
<message>
<location line="-23"/>
<source>List commands</source>
<translation>Lista komennoista</translation>
</message>
<message>
<location line="-12"/>
<source>Get help for a command</source>
<translation>Hanki apua käskyyn</translation>
</message>
<message>
<location line="+24"/>
<source>Options:</source>
<translation>Asetukset:</translation>
</message>
<message>
<location line="+24"/>
<source>Specify configuration file (default: doctorcoin.conf)</source>
<translation>Määritä asetustiedosto (oletus: doctorcoin.conf)</translation>
</message>
<message>
<location line="+3"/>
<source>Specify pid file (default: doctorcoind.pid)</source>
<translation>Määritä pid-tiedosto (oletus: doctorcoin.pid)</translation>
</message>
<message>
<location line="-1"/>
<source>Specify data directory</source>
<translation>Määritä data-hakemisto</translation>
</message>
<message>
<location line="-9"/>
<source>Set database cache size in megabytes (default: 25)</source>
<translation>Aseta tietokannan välimuistin koko megatavuina (oletus: 25)</translation>
</message>
<message>
<location line="-28"/>
<source>Listen for connections on <port> (default: 9333 or testnet: 19333)</source>
<translation>Kuuntele yhteyksiä portista <port> (oletus: 9333 tai testnet: 19333)</translation>
</message>
<message>
<location line="+5"/>
<source>Maintain at most <n> connections to peers (default: 125)</source>
<translation>Pidä enintään <n> yhteyttä verkkoihin (oletus: 125)</translation>
</message>
<message>
<location line="-48"/>
<source>Connect to a node to retrieve peer addresses, and disconnect</source>
<translation>Yhdistä noodiin hakeaksesi naapurien osoitteet ja katkaise yhteys</translation>
</message>
<message>
<location line="+82"/>
<source>Specify your own public address</source>
<translation>Määritä julkinen osoitteesi</translation>
</message>
<message>
<location line="+3"/>
<source>Threshold for disconnecting misbehaving peers (default: 100)</source>
<translation>Kynnysarvo aikakatkaisulle heikosti toimiville verkoille (oletus: 100)</translation>
</message>
<message>
<location line="-134"/>
<source>Number of seconds to keep misbehaving peers from reconnecting (default: 86400)</source>
<translation>Sekuntien määrä, kuinka kauan uudelleenkytkeydytään verkkoihin (oletus: 86400)</translation>
</message>
<message>
<location line="-29"/>
<source>An error occurred while setting up the RPC port %u for listening on IPv4: %s</source>
<translation>Virhe valmisteltaessa RPC-portin %u avaamista kuunneltavaksi: %s</translation>
</message>
<message>
<location line="+27"/>
<source>Listen for JSON-RPC connections on <port> (default: 9332 or testnet: 19332)</source>
<translation>Kuuntele JSON-RPC -yhteyksiä portista <port> (oletus: 9332 or testnet: 19332)</translation>
</message>
<message>
<location line="+37"/>
<source>Accept command line and JSON-RPC commands</source>
<translation>Hyväksy merkkipohjaiset- ja JSON-RPC-käskyt</translation>
</message>
<message>
<location line="+76"/>
<source>Run in the background as a daemon and accept commands</source>
<translation>Aja taustalla daemonina ja hyväksy komennot</translation>
</message>
<message>
<location line="+37"/>
<source>Use the test network</source>
<translation>Käytä test -verkkoa</translation>
</message>
<message>
<location line="-112"/>
<source>Accept connections from outside (default: 1 if no -proxy or -connect)</source>
<translation>Hyväksy yhteyksiä ulkopuolelta (vakioasetus: 1 jos -proxy tai -connect ei määritelty)</translation>
</message>
<message>
<location line="-80"/>
<source>%s, you must set a rpcpassword in the configuration file:
%s
It is recommended you use the following random password:
rpcuser=doctorcoinrpc
rpcpassword=%s
(you do not need to remember this password)
The username and password MUST NOT be the same.
If the file does not exist, create it with owner-readable-only file permissions.
It is also recommended to set alertnotify so you are notified of problems;
for example: alertnotify=echo %%s | mail -s "Doctorcoin Alert" [email protected]
</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+17"/>
<source>An error occurred while setting up the RPC port %u for listening on IPv6, falling back to IPv4: %s</source>
<translation>Virhe ilmennyt asetettaessa RPC-porttia %u IPv6:n kuuntelemiseksi, palataan takaisin IPv4:ään %s</translation>
</message>
<message>
<location line="+3"/>
<source>Bind to given address and always listen on it. Use [host]:port notation for IPv6</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Cannot obtain a lock on data directory %s. Doctorcoin is probably already running.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Error: The transaction was rejected! This might happen if some of the coins in your wallet were already spent, such as if you used a copy of wallet.dat and coins were spent in the copy but not marked as spent here.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+4"/>
<source>Error: This transaction requires a transaction fee of at least %s because of its amount, complexity, or use of recently received funds!</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Execute command when a relevant alert is received (%s in cmd is replaced by message)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Execute command when a wallet transaction changes (%s in cmd is replaced by TxID)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+11"/>
<source>Set maximum size of high-priority/low-fee transactions in bytes (default: 27000)</source>
<translation>Aseta suurin korkean prioriteetin / matalan palkkion siirron koko tavuissa (vakioasetus: 27000)</translation>
</message>
<message>
<location line="+6"/>
<source>This is a pre-release test build - use at your own risk - do not use for mining or merchant applications</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+5"/>
<source>Warning: -paytxfee is set very high! This is the transaction fee you will pay if you send a transaction.</source>
<translation>Varoitus: -paytxfee on asetettu erittäin korkeaksi! Tämä on maksukulu jonka tulet maksamaan kun lähetät siirron.</translation>
</message>
<message>
<location line="+3"/>
<source>Warning: Displayed transactions may not be correct! You may need to upgrade, or other nodes may need to upgrade.</source>
<translation>Varoitus: Näytetyt siirrot eivät välttämättä pidä paikkaansa! Sinun tai toisten noodien voi olla tarpeen asentaa päivitys.</translation>
</message>
<message>
<location line="+3"/>
<source>Warning: Please check that your computer's date and time are correct! If your clock is wrong Doctorcoin will not work properly.</source>
<translation>Varoitus: Tarkista että tietokoneesi kellonaika ja päivämäärä ovat paikkansapitäviä! Doctorcoin ei toimi oikein väärällä päivämäärällä ja/tai kellonajalla.</translation>
</message>
<message>
<location line="+3"/>
<source>Warning: error reading wallet.dat! All keys read correctly, but transaction data or address book entries might be missing or incorrect.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+3"/>
<source>Warning: wallet.dat corrupt, data salvaged! Original wallet.dat saved as wallet.{timestamp}.bak in %s; if your balance or transactions are incorrect you should restore from a backup.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+14"/>
<source>Attempt to recover private keys from a corrupt wallet.dat</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Block creation options:</source>
<translation>Lohkon luonnin asetukset:</translation>
</message>
<message>
<location line="+5"/>
<source>Connect only to the specified node(s)</source>
<translation>Yhidstä ainoastaan määrättyihin noodeihin</translation>
</message>
<message>
<location line="+3"/>
<source>Corrupted block database detected</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Discover own IP address (default: 1 when listening and no -externalip)</source>
<translation>Hae oma IP osoite (vakioasetus: 1 kun kuuntelemassa ja ei -externalip)</translation>
</message>
<message>
<location line="+1"/>
<source>Do you want to rebuild the block database now?</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Error initializing block database</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Error initializing wallet database environment %s!</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Error loading block database</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+4"/>
<source>Error opening block database</source>
<translation>Virhe avattaessa lohkoindeksiä</translation>
</message>
<message>
<location line="+2"/>
<source>Error: Disk space is low!</source>
<translation>Varoitus: Levytila on vähissä!</translation>
</message>
<message>
<location line="+1"/>
<source>Error: Wallet locked, unable to create transaction!</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Error: system error: </source>
<translation>Virhe: Järjestelmävirhe</translation>
</message>
<message>
<location line="+1"/>
<source>Failed to listen on any port. Use -listen=0 if you want this.</source>
<translation>Ei onnistuttu kuuntelemaan missään portissa. Käytä -listen=0 jos haluat tätä.</translation>
</message>
<message>
<location line="+1"/>
<source>Failed to read block info</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Failed to read block</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Failed to sync block index</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Failed to write block index</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Failed to write block info</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Failed to write block</source>
<translation>Lohkon kirjoitus epäonnistui</translation>
</message>
<message>
<location line="+1"/>
<source>Failed to write file info</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Failed to write to coin database</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Failed to write transaction index</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Failed to write undo data</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Find peers using DNS lookup (default: 1 unless -connect)</source>
<translation>Hae naapureita DNS hauilla (vakioasetus: 1 paitsi jos -connect)</translation>
</message>
<message>
<location line="+1"/>
<source>Generate coins (default: 0)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>How many blocks to check at startup (default: 288, 0 = all)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>How thorough the block verification is (0-4, default: 3)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+19"/>
<source>Not enough file descriptors available.</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+8"/>
<source>Rebuild block chain index from current blk000??.dat files</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+16"/>
<source>Set the number of threads to service RPC calls (default: 4)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+26"/>
<source>Verifying blocks...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Verifying wallet...</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-69"/>
<source>Imports blocks from external blk000??.dat file</source>
<translation>Tuodaan lohkoja ulkoisesta blk000??.dat tiedostosta</translation>
</message>
<message>
<location line="-76"/>
<source>Set the number of script verification threads (up to 16, 0 = auto, <0 = leave that many cores free, default: 0)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+77"/>
<source>Information</source>
<translation>Tietoa</translation>
</message>
<message>
<location line="+3"/>
<source>Invalid -tor address: '%s'</source>
<translation>Virheellinen -tor osoite '%s'</translation>
</message>
<message>
<location line="+1"/>
<source>Invalid amount for -minrelaytxfee=<amount>: '%s'</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Invalid amount for -mintxfee=<amount>: '%s'</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+8"/>
<source>Maintain a full transaction index (default: 0)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Maximum per-connection receive buffer, <n>*1000 bytes (default: 5000)</source>
<translation>Suurin vastaanottopuskuri yksittäiselle yhteydelle, <n>*1000 tavua (vakioasetus: 5000)</translation>
</message>
<message>
<location line="+1"/>
<source>Maximum per-connection send buffer, <n>*1000 bytes (default: 1000)</source>
<translation>Suurin lähetyspuskuri yksittäiselle yhteydelle, <n>*1000 tavua (vakioasetus: 1000)</translation>
</message>
<message>
<location line="+2"/>
<source>Only accept block chain matching built-in checkpoints (default: 1)</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Only connect to nodes in network <net> (IPv4, IPv6 or Tor)</source>
<translation>Yhdistä vain noodeihin verkossa <net> (IPv4, IPv6 tai Tor)</translation>
</message>
<message>
<location line="+2"/>
<source>Output extra debugging information. Implies all other -debug* options</source>
<translation>Tulosta enemmän debug tietoa. Aktivoi kaikki -debug* asetukset</translation>
</message>
<message>
<location line="+1"/>
<source>Output extra network debugging information</source>
<translation>Tulosta lisää verkkoyhteys debug tietoa</translation>
</message>
<message>
<location line="+2"/>
<source>Prepend debug output with timestamp</source>
<translation>Lisää debuggaustiedon tulostukseen aikaleima</translation>
</message>
<message>
<location line="+5"/>
<source>SSL options: (see the Doctorcoin Wiki for SSL setup instructions)</source>
<translation>SSL asetukset (katso Doctorcoin Wikistä tarkemmat SSL ohjeet)</translation>
</message>
<message>
<location line="+1"/>
<source>Select the version of socks proxy to use (4-5, default: 5)</source>
<translation>Valitse käytettävän SOCKS-proxyn versio (4-5, vakioasetus: 5)</translation>
</message>
<message>
<location line="+3"/>
<source>Send trace/debug info to console instead of debug.log file</source>
<translation>Lähetä jäljitys/debug-tieto konsoliin, debug.log-tiedoston sijaan</translation>
</message>
<message>
<location line="+1"/>
<source>Send trace/debug info to debugger</source>
<translation>Lähetä jäljitys/debug-tieto debuggeriin</translation>
</message>
<message>
<location line="+5"/>
<source>Set maximum block size in bytes (default: 250000)</source>
<translation>Aseta suurin lohkon koko tavuissa (vakioasetus: 250000)</translation>
</message>
<message>
<location line="+1"/>
<source>Set minimum block size in bytes (default: 0)</source>
<translation>Asetan pienin lohkon koko tavuissa (vakioasetus: 0)</translation>
</message>
<message>
<location line="+2"/>
<source>Shrink debug.log file on client startup (default: 1 when no -debug)</source>
<translation>Pienennä debug.log tiedosto käynnistyksen yhteydessä (vakioasetus: 1 kun ei -debug)</translation>
</message>
<message>
<location line="+1"/>
<source>Signing transaction failed</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+2"/>
<source>Specify connection timeout in milliseconds (default: 5000)</source>
<translation>Määritä yhteyden aikakataisu millisekunneissa (vakioasetus: 5000)</translation>
</message>
<message>
<location line="+4"/>
<source>System error: </source>
<translation>Järjestelmävirhe:</translation>
</message>
<message>
<location line="+4"/>
<source>Transaction amount too small</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Transaction amounts must be positive</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>Transaction too large</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+7"/>
<source>Use UPnP to map the listening port (default: 0)</source>
<translation>Käytä UPnP:tä kuunneltavan portin avaamiseen (vakioasetus: 0)</translation>
</message>
<message>
<location line="+1"/>
<source>Use UPnP to map the listening port (default: 1 when listening)</source>
<translation>Käytä UPnP:tä kuunneltavan portin avaamiseen (vakioasetus: 1 kun kuuntelemassa)</translation>
</message>
<message>
<location line="+1"/>
<source>Use proxy to reach tor hidden services (default: same as -proxy)</source>
<translation>Käytä proxyä tor yhteyksien avaamiseen (vakioasetus: sama kuin -proxy)</translation>
</message>
<message>
<location line="+2"/>
<source>Username for JSON-RPC connections</source>
<translation>Käyttäjätunnus JSON-RPC-yhteyksille</translation>
</message>
<message>
<location line="+4"/>
<source>Warning</source>
<translation>Varoitus</translation>
</message>
<message>
<location line="+1"/>
<source>Warning: This version is obsolete, upgrade required!</source>
<translation>Varoitus: Tämä versio on vanhentunut, päivitys tarpeen!</translation>
</message>
<message>
<location line="+1"/>
<source>You need to rebuild the databases using -reindex to change -txindex</source>
<translation type="unfinished"/>
</message>
<message>
<location line="+1"/>
<source>wallet.dat corrupt, salvage failed</source>
<translation type="unfinished"/>
</message>
<message>
<location line="-50"/>
<source>Password for JSON-RPC connections</source>
<translation>Salasana JSON-RPC-yhteyksille</translation>
</message>
<message>
<location line="-67"/>
<source>Allow JSON-RPC connections from specified IP address</source>
<translation>Salli JSON-RPC yhteydet tietystä ip-osoitteesta</translation>
</message>
<message>
<location line="+76"/>
<source>Send commands to node running on <ip> (default: 127.0.0.1)</source>
<translation>Lähetä käskyjä solmuun osoitteessa <ip> (oletus: 127.0.0.1)</translation>
</message>
<message>
<location line="-120"/>
<source>Execute command when the best block changes (%s in cmd is replaced by block hash)</source>
<translation>Suorita käsky kun paras lohko muuttuu (%s cmd on vaihdettu block hashin kanssa)</translation>
</message>
<message>
<location line="+147"/>
<source>Upgrade wallet to latest format</source>
<translation>Päivitä lompakko uusimpaan formaattiin</translation>
</message>
<message>
<location line="-21"/>
<source>Set key pool size to <n> (default: 100)</source>
<translation>Aseta avainpoolin koko arvoon <n> (oletus: 100)</translation>
</message>
<message>
<location line="-12"/>
<source>Rescan the block chain for missing wallet transactions</source>
<translation>Skannaa uudelleen lohkoketju lompakon puuttuvien rahasiirtojen vuoksi</translation>
</message>
<message>
<location line="+35"/>
<source>Use OpenSSL (https) for JSON-RPC connections</source>
<translation>Käytä OpenSSL:ää (https) JSON-RPC-yhteyksille</translation>
</message>
<message>
<location line="-26"/>
<source>Server certificate file (default: server.cert)</source>
<translation>Palvelimen sertifikaatti-tiedosto (oletus: server.cert)</translation>
</message>
<message>
<location line="+1"/>
<source>Server private key (default: server.pem)</source>
<translation>Palvelimen yksityisavain (oletus: server.pem)</translation>
</message>
<message>
<location line="-151"/>
<source>Acceptable ciphers (default: TLSv1+HIGH:!SSLv2:!aNULL:!eNULL:!AH:!3DES:@STRENGTH)</source>
<translation>Hyväksyttävä salaus (oletus:
TLSv1+HIGH:!SSLv2:!aNULL:!eNULL:!AH:!3DES:@STRENGTH)</translation>
</message>
<message>
<location line="+165"/>
<source>This help message</source>
<translation>Tämä ohjeviesti</translation>
</message>
<message>
<location line="+6"/>
<source>Unable to bind to %s on this computer (bind returned error %d, %s)</source>
<translation>Kytkeytyminen %s tällä tietokonella ei onnistu (kytkeytyminen palautti virheen %d, %s)</translation>
</message>
<message>
<location line="-91"/>
<source>Connect through socks proxy</source>
<translation>Yhdistä socks proxyn läpi</translation>
</message>
<message>
<location line="-10"/>
<source>Allow DNS lookups for -addnode, -seednode and -connect</source>
<translation>Salli DNS kyselyt -addnode, -seednode ja -connect yhteydessä</translation>
</message>
<message>
<location line="+55"/>
<source>Loading addresses...</source>
<translation>Ladataan osoitteita...</translation>
</message>
<message>
<location line="-35"/>
<source>Error loading wallet.dat: Wallet corrupted</source>
<translation>Virhe ladattaessa wallet.dat-tiedostoa: Lompakko vioittunut</translation>
</message>
<message>
<location line="+1"/>
<source>Error loading wallet.dat: Wallet requires newer version of Doctorcoin</source>
<translation>Virhe ladattaessa wallet.dat-tiedostoa: Tarvitset uudemman version Doctorcoinista</translation>
</message>
<message>
<location line="+93"/>
<source>Wallet needed to be rewritten: restart Doctorcoin to complete</source>
<translation>Lompakko tarvitsee uudelleenkirjoittaa: käynnistä Doctorcoin uudelleen</translation>
</message>
<message>
<location line="-95"/>
<source>Error loading wallet.dat</source>
<translation>Virhe ladattaessa wallet.dat-tiedostoa</translation>
</message>
<message>
<location line="+28"/>
<source>Invalid -proxy address: '%s'</source>
<translation>Virheellinen proxy-osoite '%s'</translation>
</message>
<message>
<location line="+56"/>
<source>Unknown network specified in -onlynet: '%s'</source>
<translation>Tuntematon verkko -onlynet parametrina: '%s'</translation>
</message>
<message>
<location line="-1"/>
<source>Unknown -socks proxy version requested: %i</source>
<translation>Tuntematon -socks proxy versio pyydetty: %i</translation>
</message>
<message>
<location line="-96"/>
<source>Cannot resolve -bind address: '%s'</source>
<translation>-bind osoitteen '%s' selvittäminen epäonnistui</translation>
</message>
<message>
<location line="+1"/>
<source>Cannot resolve -externalip address: '%s'</source>
<translation>-externalip osoitteen '%s' selvittäminen epäonnistui</translation>
</message>
<message>
<location line="+44"/>
<source>Invalid amount for -paytxfee=<amount>: '%s'</source>
<translation>-paytxfee=<amount>: '%s' on virheellinen</translation>
</message>
<message>
<location line="+1"/>
<source>Invalid amount</source>
<translation>Virheellinen määrä</translation>
</message>
<message>
<location line="-6"/>
<source>Insufficient funds</source>
<translation>Lompakon saldo ei riitä</translation>
</message>
<message>
<location line="+10"/>
<source>Loading block index...</source>
<translation>Ladataan lohkoindeksiä...</translation>
</message>
<message>
<location line="-57"/>
<source>Add a node to connect to and attempt to keep the connection open</source>
<translation>Linää solmu mihin liittyä pitääksesi yhteyden auki</translation>
</message>
<message>
<location line="-25"/>
<source>Unable to bind to %s on this computer. Doctorcoin is probably already running.</source>
<translation>Kytkeytyminen %s ei onnistu tällä tietokoneella. Doctorcoin on todennäköisesti jo ajamassa.</translation>
</message>
<message>
<location line="+64"/>
<source>Fee per KB to add to transactions you send</source>
<translation>Rahansiirtopalkkio per KB lisätään lähettämääsi rahansiirtoon</translation>
</message>
<message>
<location line="+19"/>
<source>Loading wallet...</source>
<translation>Ladataan lompakkoa...</translation>
</message>
<message>
<location line="-52"/>
<source>Cannot downgrade wallet</source>
<translation>Et voi päivittää lompakkoasi vanhempaan versioon</translation>
</message>
<message>
<location line="+3"/>
<source>Cannot write default address</source>
<translation>Oletusosoitetta ei voi kirjoittaa</translation>
</message>
<message>
<location line="+64"/>
<source>Rescanning...</source>
<translation>Skannataan uudelleen...</translation>
</message>
<message>
<location line="-57"/>
<source>Done loading</source>
<translation>Lataus on valmis</translation>
</message>
<message>
<location line="+82"/>
<source>To use the %s option</source>
<translation>Käytä %s optiota</translation>
</message>
<message>
<location line="-74"/>
<source>Error</source>
<translation>Virhe</translation>
</message>
<message>
<location line="-31"/>
<source>You must set rpcpassword=<password> in the configuration file:
%s
If the file does not exist, create it with owner-readable-only file permissions.</source>
<translation>Sinun täytyy asettaa rpcpassword=<password> asetustiedostoon:
%s
Jos tiedostoa ei ole, niin luo se ainoastaan omistajan kirjoitusoikeuksin.</translation>
</message>
</context>
</TS> | mit |
Pinetrax/sw-outlook | src/lib/main.js | 2685 | //Todo: option to count all unread mail
var request = require("sdk/request").Request;
var tabs = require("sdk/tabs");
var tmr = require('sdk/timers');
var self = require("sdk/self");
var preferences = require("sdk/simple-prefs").prefs;
var notifications = require("sdk/notifications");
var { ActionButton } = require("sdk/ui/button/action");
// Global variables
var oldcount = 0;
var outlookbutton = ActionButton({
id: "outlookbutton",
label: "Not logged in",
icon: {
"16": "./outlook-16.png",
"32": "./outlook-32.png",
"64": "./outlook-64.png"
},
onClick: newOutlook,
badge: "",
badgeColor: "#FF4444",
label: "Loading"
});
tmr.setTimeout(checkOutlook, 420); //preferences.checktime * 1000
function checkOutlook() {
request({
url: "https://dub110.mail.live.com/default.aspx",
content: { var: Date.now() },
onComplete: function(response) {
//Test if logged in:
if(response.text.indexOf("Login_Core.js") > 0) {
//not logged in
outlookbutton.label = "Not logged in";
outlookbutton.badge = "!";
} else {
var count = /containerListRoot.+?title="\w+?[&#\d;]*?(\d*?)"/.exec(response.text);
if(count !== null && count[1] !== undefined) { //fail test
//count > 999? -> 999+
count = parseInt(count[1]) || 0;
if (count > oldcount) {
if (count >= 1000) { count = "999+"; }
if (preferences.notify) {
notifications.notify({
title: count + " new " + (count==1 ? "E-Mail" : "E-Mails") + " on Outlook",
text: "Click here to open outlook",
iconURL: self.data.url("outlook-64.png"),
onClick: function () { newOutlook(); }
});
}
}
oldcount = count;
outlookbutton.label = "Visit outlook.com (" + count + ")";
outlookbutton.badge = count==0 ? "" : count;
} else {
if(response.text.trim() == '') {
outlookbutton.label = "something went wrong, we'll try again soon";
outlookbutton.badge = "...";
} else {
outlookbutton.label = "Check login";
outlookbutton.badge = "@!";
}
}
}
}
}).get();
tmr.setTimeout(function(){ checkOutlook(); }, preferences.checktime * 1000);
}
function newOutlook() {
switch (preferences.newtab) {
case "N":
tabs.open("https://mail.live.com/");
break;
case "R":
var reused = false;
for (let tab of tabs) {
if (/mail\.live\.com/.test(tab.url)) {
tab.activate();
reused = true;
}
if ((/about:newtab/.test(tab.url)) && !reused) {
tab.activate();
tab.url = "https://mail.live.com/";
reused = true;
}
}
if (!reused) {
tabs.open("https://mail.live.com/");
}
break;
}
} | mit |