text
stringlengths 2
99.9k
| meta
dict |
---|---|
/*
Copyright 2016 The Kubernetes Authors.
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.
*/
package v2alpha1
import (
batchv1 "k8s.io/api/batch/v1"
"k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// JobTemplate describes a template for creating copies of a predefined pod.
type JobTemplate struct {
metav1.TypeMeta `json:",inline"`
// Standard object's metadata.
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
// +optional
metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
// Defines jobs that will be created from this template.
// https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
// +optional
Template JobTemplateSpec `json:"template,omitempty" protobuf:"bytes,2,opt,name=template"`
}
// JobTemplateSpec describes the data a Job should have when created from a template
type JobTemplateSpec struct {
// Standard object's metadata of the jobs created from this template.
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
// +optional
metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
// Specification of the desired behavior of the job.
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
// +optional
Spec batchv1.JobSpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"`
}
// +genclient
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// CronJob represents the configuration of a single cron job.
type CronJob struct {
metav1.TypeMeta `json:",inline"`
// Standard object's metadata.
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
// +optional
metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
// Specification of the desired behavior of a cron job, including the schedule.
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
// +optional
Spec CronJobSpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"`
// Current status of a cron job.
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
// +optional
Status CronJobStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"`
}
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// CronJobList is a collection of cron jobs.
type CronJobList struct {
metav1.TypeMeta `json:",inline"`
// Standard list metadata.
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
// +optional
metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
// items is the list of CronJobs.
Items []CronJob `json:"items" protobuf:"bytes,2,rep,name=items"`
}
// CronJobSpec describes how the job execution will look like and when it will actually run.
type CronJobSpec struct {
// The schedule in Cron format, see https://en.wikipedia.org/wiki/Cron.
Schedule string `json:"schedule" protobuf:"bytes,1,opt,name=schedule"`
// Optional deadline in seconds for starting the job if it misses scheduled
// time for any reason. Missed jobs executions will be counted as failed ones.
// +optional
StartingDeadlineSeconds *int64 `json:"startingDeadlineSeconds,omitempty" protobuf:"varint,2,opt,name=startingDeadlineSeconds"`
// Specifies how to treat concurrent executions of a Job.
// Valid values are:
// - "Allow" (default): allows CronJobs to run concurrently;
// - "Forbid": forbids concurrent runs, skipping next run if previous run hasn't finished yet;
// - "Replace": cancels currently running job and replaces it with a new one
// +optional
ConcurrencyPolicy ConcurrencyPolicy `json:"concurrencyPolicy,omitempty" protobuf:"bytes,3,opt,name=concurrencyPolicy,casttype=ConcurrencyPolicy"`
// This flag tells the controller to suspend subsequent executions, it does
// not apply to already started executions. Defaults to false.
// +optional
Suspend *bool `json:"suspend,omitempty" protobuf:"varint,4,opt,name=suspend"`
// Specifies the job that will be created when executing a CronJob.
JobTemplate JobTemplateSpec `json:"jobTemplate" protobuf:"bytes,5,opt,name=jobTemplate"`
// The number of successful finished jobs to retain.
// This is a pointer to distinguish between explicit zero and not specified.
// +optional
SuccessfulJobsHistoryLimit *int32 `json:"successfulJobsHistoryLimit,omitempty" protobuf:"varint,6,opt,name=successfulJobsHistoryLimit"`
// The number of failed finished jobs to retain.
// This is a pointer to distinguish between explicit zero and not specified.
// +optional
FailedJobsHistoryLimit *int32 `json:"failedJobsHistoryLimit,omitempty" protobuf:"varint,7,opt,name=failedJobsHistoryLimit"`
}
// ConcurrencyPolicy describes how the job will be handled.
// Only one of the following concurrent policies may be specified.
// If none of the following policies is specified, the default one
// is AllowConcurrent.
type ConcurrencyPolicy string
const (
// AllowConcurrent allows CronJobs to run concurrently.
AllowConcurrent ConcurrencyPolicy = "Allow"
// ForbidConcurrent forbids concurrent runs, skipping next run if previous
// hasn't finished yet.
ForbidConcurrent ConcurrencyPolicy = "Forbid"
// ReplaceConcurrent cancels currently running job and replaces it with a new one.
ReplaceConcurrent ConcurrencyPolicy = "Replace"
)
// CronJobStatus represents the current state of a cron job.
type CronJobStatus struct {
// A list of pointers to currently running jobs.
// +optional
Active []v1.ObjectReference `json:"active,omitempty" protobuf:"bytes,1,rep,name=active"`
// Information when was the last time the job was successfully scheduled.
// +optional
LastScheduleTime *metav1.Time `json:"lastScheduleTime,omitempty" protobuf:"bytes,4,opt,name=lastScheduleTime"`
}
| {
"pile_set_name": "Github"
} |
<?xml version='1.0' encoding='utf-8'?>
<section xmlns="https://code.dccouncil.us/schemas/dc-library" xmlns:codified="https://code.dccouncil.us/schemas/codified" xmlns:codify="https://code.dccouncil.us/schemas/codify" xmlns:xi="http://www.w3.org/2001/XInclude" containing-doc="D.C. Code">
<num>1-610.62</num>
<heading>Retirement benefits.</heading>
<text>Executive Service employees shall be covered under <cite path="1|6|XXVI">subchapter XXVI of this chapter</cite>, except that employees first hired after September 30, 1987, may elect to participate in the District’s defined contribution plan or may elect to have the funds that would otherwise be contributed by the District under the defined contribution plan directed to another 401(a) retirement plan.</text>
<annotations>
<annotation doc="D.C. Law 2-139" type="History" path="§1062">Mar. 3, 1979, D.C. Law 2-139, § 1062</annotation>
<annotation doc="D.C. Law 12-124" type="History">as added June 10, 1998, D.C. Law 12-124, § 101(m), 45 DCR 2464</annotation>
<annotation type="Editor's Notes">Applicability of § 101(m) of <cite doc="D.C. Law 12-124">D.C. Law 12-124</cite>: See Historical and Statutory Notes following <cite path="§1-610.51">§ 1-610.51</cite>.</annotation>
<annotation type="Prior Codifications">1981 Ed., § 1-611.62.</annotation>
</annotations>
</section>
| {
"pile_set_name": "Github"
} |
#! /usr/bin/env ruby
require 'rubygems'
require 'activesupport'
LIMIT = 12
def create_data(data_file, file)
result = []
File.open(file, "rb") do |f|
str = f.read
keywords,data = str.split(";")
data.gsub!(/^[^=]+= /, "")
decoded = ActiveSupport::JSON.decode(data)
for it in decoded
i = {
:score => it["score"],
:name => it["name"],
:path => it["path"] == "-" ? nil : it["path"],
:type => it["type"],
:method_type => it["method_type"]
}
result << i
end
end
File.open(data_file, "wb") do |f|
f.write Marshal.dump(result)
end
end
def get_data(file)
data_file = "#{file}.data"
unless File.exists?(data_file)
create_data(data_file, file)
end
Marshal.load(File.open(data_file))
end
def search(mod, str)
file = File.dirname(__FILE__) + "/#{mod}.js"
data = get_data(file)
q = Regexp.new(Regexp.quote(str), Regexp::IGNORECASE)
result = []
for it in data
next unless q.match(it[:name])
it[:score] = it[:score].to_f
result << it
end
return if result.empty?
result = result.sort_by{ |a| a[:score] }.reverse
to_lisp(mod, result[0..LIMIT])
end
def to_lisp(mod, data)
result = []
for it in data
url_prefix = if it[:path]
"#{it[:path].gsub(/\:\:/, "/")}/"
else
""
end
url_prefix = "http://apidock.com/#{mod}/#{url_prefix}"
title = it[:name].dup
title << " (#{it[:path]})" if it[:path]
line = case it[:type]
when "method"
if it[:method_type] == "instance"
[title, "#{url_prefix}#{it[:name]}"]
else
[title, "#{url_prefix}#{it[:name]}/class"]
end
when "class", "module"
[title, "#{url_prefix}#{it[:name]}"]
end
result << line
end
result.map! do |i|
'("' + i.first + '" . "' + i.last + '")'
end
"(" + result.join("\n") + ")"
end
STDOUT.flush
loop do
line = STDIN.gets
mod, q = /(\w+)(.*)$/.match(line)[1..2]
q.strip!
puts search(mod, q) unless q.blank?
puts "APIDOCK_EOF"
STDOUT.flush
end
| {
"pile_set_name": "Github"
} |
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 7d052a6220061e34aadf5ebacb39e3dd, type: 3}
m_Name: Generic End
m_EditorClassIdentifier:
Clips:
- {fileID: 8300000, guid: 6ef5d16f8c76c5c42893cd3cb62700f5, type: 3}
VolumeRange: {x: 0.3, y: 0.5}
PitchRange: {x: 0.85, y: 1.15}
| {
"pile_set_name": "Github"
} |
version: '2.3'
services:
jolokia:
image: docker.elastic.co/integrations-ci/beats-jolokia:${JOLOKIA_VERSION:-1.5.0}-1
build:
context: ./_meta
args:
JOLOKIA_VERSION: ${JOLOKIA_VERSION:-1.5.0}
ports:
- 8778
| {
"pile_set_name": "Github"
} |
// Copyright 2010 Christophe Henry
// henry UNDERSCORE christophe AT hotmail DOT com
// This is an extended version of the state machine available in the boost::mpl library
// Distributed under the same license as the original.
// Copyright for the original version:
// Copyright 2005 David Abrahams and Aleksey Gurtovoy. Distributed
// under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#ifndef MENU_MODE_HPP
#define MENU_MODE_HPP
#include <iostream>
#include <boost/any.hpp>
#include "Events.hpp"
#include <boost/msm/back/favor_compile_time.hpp>
#include <boost/msm/back/state_machine.hpp>
#include <boost/msm/front/state_machine_def.hpp>
using namespace std;
namespace msm = boost::msm;
struct MenuMode_ : public msm::front::state_machine_def<MenuMode_>
{
typedef mpl::vector1<MenuActive> flag_list;
struct WaitingForSongChoice : public msm::front::state<>
{
template <class Event,class FSM>
void on_entry(Event const&,FSM& ) {std::cout << "starting: MenuMode::WaitingForSongChoice" << std::endl;}
template <class Event,class FSM>
void on_exit(Event const&,FSM& ) {std::cout << "finishing: MenuMode::WaitingForSongChoice" << std::endl;}
};
struct StartCurrentSong : public msm::front::state<>
{
template <class Event,class FSM>
void on_entry(Event const&,FSM& ) {std::cout << "starting: MenuMode::StartCurrentSong" << std::endl;}
template <class Event,class FSM>
void on_exit(Event const&,FSM& ) {std::cout << "finishing: MenuMode::StartCurrentSong" << std::endl;}
};
struct MenuExit : public msm::front::exit_pseudo_state<CloseMenu>
{
template <class Event,class FSM>
void on_entry(Event const&,FSM& ) {std::cout << "starting: MenuMode::WaitingForSongChoice" << std::endl;}
template <class Event,class FSM>
void on_exit(Event const&,FSM& ) {std::cout << "finishing: MenuMode::WaitingForSongChoice" << std::endl;}
};
typedef WaitingForSongChoice initial_state;
typedef MenuMode_ fsm; // makes transition table cleaner
// Transition table for player
struct transition_table : mpl::vector2<
// Start Event Next Action Guard
// +---------------------+------------------+-------------------+---------------------+----------------------+
_row < WaitingForSongChoice , MenuMiddleButton , StartCurrentSong >,
_row < StartCurrentSong , SelectSong , MenuExit >
// +---------------------+------------------+-------------------+---------------------+----------------------+
> {};
};
typedef msm::back::state_machine<MenuMode_> MenuMode;
#endif
| {
"pile_set_name": "Github"
} |
using System;
using System.Reflection;
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: 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("736f30cb-6d42-42cf-9bb6-7da1edaf88ff")]
[assembly: CLSCompliant(true)]
| {
"pile_set_name": "Github"
} |
#define TESTNAME "Coding. Compress zeros test. positions xtc3"
#define FILENAME "test69.tng_compress"
#define ALGOTEST
#define NATOMS 100
#define CHUNKY 100
#define SCALE 0.
#define PRECISION 0.01
#define WRITEVEL 0
#define VELPRECISION 0.1
#define INITIALCODING 10
#define INITIALCODINGPARAMETER 0
#define CODING 10
#define CODINGPARAMETER 0
#define INITIALVELCODING 3
#define INITIALVELCODINGPARAMETER -1
#define VELCODING 3
#define VELCODINGPARAMETER -1
#define INTMIN1 0
#define INTMIN2 0
#define INTMIN3 0
#define INTMAX1 0
#define INTMAX2 0
#define INTMAX3 0
#define NFRAMES 100
#define EXPECTED_FILESIZE 867.
| {
"pile_set_name": "Github"
} |
<!DOCTYPE html>
<html>
<head prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb# githubog: http://ogp.me/ns/fb/githubog#">
<meta charset='utf-8'>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>openfeint/s3eNOpenFeint/licence.txt at master · marmalade/openfeint · GitHub</title>
<link rel="search" type="application/opensearchdescription+xml" href="/opensearch.xml" title="GitHub" />
<link rel="fluid-icon" href="https://github.com/fluidicon.png" title="GitHub" />
<link rel="apple-touch-icon" sizes="57x57" href="/apple-touch-icon-114.png" />
<link rel="apple-touch-icon" sizes="114x114" href="/apple-touch-icon-114.png" />
<link rel="apple-touch-icon" sizes="72x72" href="/apple-touch-icon-144.png" />
<link rel="apple-touch-icon" sizes="144x144" href="/apple-touch-icon-144.png" />
<link rel="logo" type="image/svg" href="http://github-media-downloads.s3.amazonaws.com/github-logo.svg" />
<link rel="xhr-socket" href="/_sockets" />
<meta name="msapplication-TileImage" content="/windows-tile.png" />
<meta name="msapplication-TileColor" content="#ffffff" />
<meta name="selected-link" value="repo_source" data-pjax-transient />
<meta content="collector.githubapp.com" name="octolytics-host" /><meta content="github" name="octolytics-app-id" />
<link rel="icon" type="image/x-icon" href="/favicon.ico" />
<meta content="authenticity_token" name="csrf-param" />
<meta content="Xerd8aVd2OkJp58lkmQxzmtnExryzrAiQOL+tSkUYVc=" name="csrf-token" />
<link href="https://a248.e.akamai.net/assets.github.com/assets/github-d63f89e307e2e357d3b7160b3cd4020463f9bbc1.css" media="all" rel="stylesheet" type="text/css" />
<link href="https://a248.e.akamai.net/assets.github.com/assets/github2-4a2696ec075bd8d27843df00793c7e9d6525dded.css" media="all" rel="stylesheet" type="text/css" />
<script src="https://a248.e.akamai.net/assets.github.com/assets/frameworks-92d138f450f2960501e28397a2f63b0f100590f0.js" type="text/javascript"></script>
<script src="https://a248.e.akamai.net/assets.github.com/assets/github-60bb3beedc339be272bd2acfce1cae3b79371737.js" type="text/javascript"></script>
<meta http-equiv="x-pjax-version" content="7159fafc2fc92e02281814323bde3687">
<link data-pjax-transient rel='permalink' href='/marmalade/openfeint/blob/2a6d2130f6788b45d11cee2b2f18e25e79edd7fc/s3eNOpenFeint/licence.txt'>
<meta property="og:title" content="openfeint"/>
<meta property="og:type" content="githubog:gitrepository"/>
<meta property="og:url" content="https://github.com/marmalade/openfeint"/>
<meta property="og:image" content="https://secure.gravatar.com/avatar/31af9c4499f094aa56474a757ce92dde?s=420&d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png"/>
<meta property="og:site_name" content="GitHub"/>
<meta property="og:description" content="openfeint - Open Feint for Marmalade"/>
<meta property="twitter:card" content="summary"/>
<meta property="twitter:site" content="@GitHub">
<meta property="twitter:title" content="marmalade/openfeint"/>
<meta name="description" content="openfeint - Open Feint for Marmalade" />
<meta content="791199" name="octolytics-dimension-user_id" /><meta content="1842388" name="octolytics-dimension-repository_id" />
<link href="https://github.com/marmalade/openfeint/commits/master.atom" rel="alternate" title="Recent Commits to openfeint:master" type="application/atom+xml" />
</head>
<body class="logged_out page-blob vis-public env-production ">
<div id="wrapper">
<div class="header header-logged-out">
<div class="container clearfix">
<a class="header-logo-wordmark" href="https://github.com/">Github</a>
<div class="header-actions">
<a class="button primary" href="https://github.com/signup">Sign up</a>
<a class="button" href="https://github.com/login?return_to=%2Fmarmalade%2Fopenfeint%2Fblob%2Fmaster%2Fs3eNOpenFeint%2Flicence.txt">Sign in</a>
</div>
<div class="command-bar js-command-bar in-repository">
<ul class="top-nav">
<li class="explore"><a href="https://github.com/explore">Explore</a></li>
<li class="features"><a href="https://github.com/features">Features</a></li>
<li class="blog"><a href="https://github.com/blog">Blog</a></li>
</ul>
<form accept-charset="UTF-8" action="/search" class="command-bar-form" id="top_search_form" method="get">
<a href="/search/advanced" class="advanced-search-icon tooltipped downwards command-bar-search" id="advanced_search" title="Advanced search"><span class="octicon octicon-gear "></span></a>
<input type="text" data-hotkey="/ s" name="q" id="js-command-bar-field" placeholder="Search or type a command" tabindex="1" autocapitalize="off"
data-repo="marmalade/openfeint"
data-branch="master"
data-sha="0f1979f80f73f018c01279c24cb116591cf6e648"
>
<input type="hidden" name="nwo" value="marmalade/openfeint" />
<div class="select-menu js-menu-container js-select-menu search-context-select-menu">
<span class="minibutton select-menu-button js-menu-target">
<span class="js-select-button">This repository</span>
</span>
<div class="select-menu-modal-holder js-menu-content js-navigation-container">
<div class="select-menu-modal">
<div class="select-menu-item js-navigation-item selected">
<span class="select-menu-item-icon octicon octicon-check"></span>
<input type="radio" class="js-search-this-repository" name="search_target" value="repository" checked="checked" />
<div class="select-menu-item-text js-select-button-text">This repository</div>
</div> <!-- /.select-menu-item -->
<div class="select-menu-item js-navigation-item">
<span class="select-menu-item-icon octicon octicon-check"></span>
<input type="radio" name="search_target" value="global" />
<div class="select-menu-item-text js-select-button-text">All repositories</div>
</div> <!-- /.select-menu-item -->
</div>
</div>
</div>
<span class="octicon help tooltipped downwards" title="Show command bar help">
<span class="octicon octicon-question"></span>
</span>
<input type="hidden" name="ref" value="cmdform">
<div class="divider-vertical"></div>
</form>
</div>
</div>
</div>
<div class="site hfeed" itemscope itemtype="http://schema.org/WebPage">
<div class="hentry">
<div class="pagehead repohead instapaper_ignore readability-menu ">
<div class="container">
<div class="title-actions-bar">
<ul class="pagehead-actions">
<li>
<a href="/login?return_to=%2Fmarmalade%2Fopenfeint"
class="minibutton js-toggler-target star-button entice tooltipped upwards"
title="You must be signed in to use this feature" rel="nofollow">
<span class="octicon octicon-star"></span>Star
</a>
<a class="social-count js-social-count" href="/marmalade/openfeint/stargazers">
11
</a>
</li>
<li>
<a href="/login?return_to=%2Fmarmalade%2Fopenfeint"
class="minibutton js-toggler-target fork-button entice tooltipped upwards"
title="You must be signed in to fork a repository" rel="nofollow">
<span class="octicon octicon-git-branch"></span>Fork
</a>
<a href="/marmalade/openfeint/network" class="social-count">
5
</a>
</li>
</ul>
<h1 itemscope itemtype="http://data-vocabulary.org/Breadcrumb" class="entry-title public">
<span class="repo-label"><span>public</span></span>
<span class="mega-octicon octicon-repo"></span>
<span class="author vcard">
<a href="/marmalade" class="url fn" itemprop="url" rel="author">
<span itemprop="title">marmalade</span>
</a></span> /
<strong><a href="/marmalade/openfeint" class="js-current-repository">openfeint</a></strong>
</h1>
</div>
<ul class="tabs">
<li class="pulse-nav"><a href="/marmalade/openfeint/pulse" class="js-selected-navigation-item " data-selected-links="pulse /marmalade/openfeint/pulse" rel="nofollow"><span class="octicon octicon-pulse"></span></a></li>
<li><a href="/marmalade/openfeint" class="js-selected-navigation-item selected" data-selected-links="repo_source repo_downloads repo_commits repo_tags repo_branches /marmalade/openfeint">Code</a></li>
<li><a href="/marmalade/openfeint/network" class="js-selected-navigation-item " data-selected-links="repo_network /marmalade/openfeint/network">Network</a></li>
<li><a href="/marmalade/openfeint/pulls" class="js-selected-navigation-item " data-selected-links="repo_pulls /marmalade/openfeint/pulls">Pull Requests <span class='counter'>0</span></a></li>
<li><a href="/marmalade/openfeint/issues" class="js-selected-navigation-item " data-selected-links="repo_issues /marmalade/openfeint/issues">Issues <span class='counter'>4</span></a></li>
<li><a href="/marmalade/openfeint/wiki" class="js-selected-navigation-item " data-selected-links="repo_wiki /marmalade/openfeint/wiki">Wiki</a></li>
<li><a href="/marmalade/openfeint/graphs" class="js-selected-navigation-item " data-selected-links="repo_graphs repo_contributors /marmalade/openfeint/graphs">Graphs</a></li>
</ul>
<div class="tabnav">
<span class="tabnav-right">
<ul class="tabnav-tabs">
<li><a href="/marmalade/openfeint/tags" class="js-selected-navigation-item tabnav-tab" data-selected-links="repo_tags /marmalade/openfeint/tags">Tags <span class="counter blank">0</span></a></li>
</ul>
</span>
<div class="tabnav-widget scope">
<div class="select-menu js-menu-container js-select-menu js-branch-menu">
<a class="minibutton select-menu-button js-menu-target" data-hotkey="w" data-ref="master">
<span class="octicon octicon-branch"></span>
<i>branch:</i>
<span class="js-select-button">master</span>
</a>
<div class="select-menu-modal-holder js-menu-content js-navigation-container">
<div class="select-menu-modal">
<div class="select-menu-header">
<span class="select-menu-title">Switch branches/tags</span>
<span class="octicon octicon-remove-close js-menu-close"></span>
</div> <!-- /.select-menu-header -->
<div class="select-menu-filters">
<div class="select-menu-text-filter">
<input type="text" id="commitish-filter-field" class="js-filterable-field js-navigation-enable" placeholder="Filter branches/tags">
</div>
<div class="select-menu-tabs">
<ul>
<li class="select-menu-tab">
<a href="#" data-tab-filter="branches" class="js-select-menu-tab">Branches</a>
</li>
<li class="select-menu-tab">
<a href="#" data-tab-filter="tags" class="js-select-menu-tab">Tags</a>
</li>
</ul>
</div><!-- /.select-menu-tabs -->
</div><!-- /.select-menu-filters -->
<div class="select-menu-list select-menu-tab-bucket js-select-menu-tab-bucket css-truncate" data-tab-filter="branches">
<div data-filterable-for="commitish-filter-field" data-filterable-type="substring">
<div class="select-menu-item js-navigation-item selected">
<span class="select-menu-item-icon octicon octicon-check"></span>
<a href="/marmalade/openfeint/blob/master/s3eNOpenFeint/licence.txt" class="js-navigation-open select-menu-item-text js-select-button-text css-truncate-target" data-name="master" rel="nofollow" title="master">master</a>
</div> <!-- /.select-menu-item -->
</div>
<div class="select-menu-no-results">Nothing to show</div>
</div> <!-- /.select-menu-list -->
<div class="select-menu-list select-menu-tab-bucket js-select-menu-tab-bucket css-truncate" data-tab-filter="tags">
<div data-filterable-for="commitish-filter-field" data-filterable-type="substring">
</div>
<div class="select-menu-no-results">Nothing to show</div>
</div> <!-- /.select-menu-list -->
</div> <!-- /.select-menu-modal -->
</div> <!-- /.select-menu-modal-holder -->
</div> <!-- /.select-menu -->
</div> <!-- /.scope -->
<ul class="tabnav-tabs">
<li><a href="/marmalade/openfeint" class="selected js-selected-navigation-item tabnav-tab" data-selected-links="repo_source /marmalade/openfeint">Files</a></li>
<li><a href="/marmalade/openfeint/commits/master" class="js-selected-navigation-item tabnav-tab" data-selected-links="repo_commits /marmalade/openfeint/commits/master">Commits</a></li>
<li><a href="/marmalade/openfeint/branches" class="js-selected-navigation-item tabnav-tab" data-selected-links="repo_branches /marmalade/openfeint/branches" rel="nofollow">Branches <span class="counter ">1</span></a></li>
</ul>
</div>
</div>
</div><!-- /.repohead -->
<div id="js-repo-pjax-container" class="container context-loader-container" data-pjax-container>
<!-- blob contrib key: blob_contributors:v21:44b386c0859edb8ab03efbe51972a9ba -->
<!-- blob contrib frag key: views10/v8/blob_contributors:v21:44b386c0859edb8ab03efbe51972a9ba -->
<div id="slider">
<div class="frame-meta">
<p title="This is a placeholder element" class="js-history-link-replace hidden"></p>
<div class="breadcrumb">
<span class='bold'><span itemscope="" itemtype="http://data-vocabulary.org/Breadcrumb"><a href="/marmalade/openfeint" class="js-slide-to" data-branch="master" data-direction="back" itemscope="url"><span itemprop="title">openfeint</span></a></span></span><span class="separator"> / </span><span itemscope="" itemtype="http://data-vocabulary.org/Breadcrumb"><a href="/marmalade/openfeint/tree/master/s3eNOpenFeint" class="js-slide-to" data-branch="master" data-direction="back" itemscope="url"><span itemprop="title">s3eNOpenFeint</span></a></span><span class="separator"> / </span><strong class="final-path">licence.txt</strong> <span class="js-zeroclipboard zeroclipboard-button" data-clipboard-text="s3eNOpenFeint/licence.txt" data-copied-hint="copied!" title="copy to clipboard"><span class="octicon octicon-clippy"></span></span>
</div>
<a href="/marmalade/openfeint/find/master" class="js-slide-to" data-hotkey="t" style="display:none">Show File Finder</a>
<div class="commit file-history-tease">
<img class="main-avatar" height="24" src="https://secure.gravatar.com/avatar/9faeff62757ea7b4ae8192aff33efce3?s=140&d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png" width="24" />
<span class="author"><a href="/faizann" rel="author">faizann</a></span>
<time class="js-relative-date" datetime="2011-09-08T14:36:17-07:00" title="2011-09-08 14:36:17">September 08, 2011</time>
<div class="commit-title">
<a href="/marmalade/openfeint/commit/ad6602ab4ee74b3dcfb2ab813a49b9e58e662312" class="message">Created s3eNOpenFeint Marmalade extension supporting Challenges,Highs…</a>
</div>
<div class="participation">
<p class="quickstat"><a href="#blob_contributors_box" rel="facebox"><strong>1</strong> contributor</a></p>
</div>
<div id="blob_contributors_box" style="display:none">
<h2>Users on GitHub who have contributed to this file</h2>
<ul class="facebox-user-list">
<li>
<img height="24" src="https://secure.gravatar.com/avatar/9faeff62757ea7b4ae8192aff33efce3?s=140&d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png" width="24" />
<a href="/faizann">faizann</a>
</li>
</ul>
</div>
</div>
</div><!-- ./.frame-meta -->
<div class="frames">
<div class="frame" data-permalink-url="/marmalade/openfeint/blob/2a6d2130f6788b45d11cee2b2f18e25e79edd7fc/s3eNOpenFeint/licence.txt" data-title="openfeint/s3eNOpenFeint/licence.txt at master · marmalade/openfeint · GitHub" data-type="blob">
<div id="files" class="bubble">
<div class="file">
<div class="meta">
<div class="info">
<span class="icon"><b class="octicon octicon-file-text"></b></span>
<span class="mode" title="File Mode">file</span>
<span>166 lines (128 sloc)</span>
<span>7.651 kb</span>
</div>
<div class="actions">
<div class="button-group">
<a class="minibutton js-entice" href=""
data-entice="You must be signed in and on a branch to make or propose changes">Edit</a>
<a href="/marmalade/openfeint/raw/master/s3eNOpenFeint/licence.txt" class="button minibutton " id="raw-url">Raw</a>
<a href="/marmalade/openfeint/blame/master/s3eNOpenFeint/licence.txt" class="button minibutton ">Blame</a>
<a href="/marmalade/openfeint/commits/master/s3eNOpenFeint/licence.txt" class="button minibutton " rel="nofollow">History</a>
</div><!-- /.button-group -->
</div><!-- /.actions -->
</div>
<div class="blob-wrapper data type-text js-blob-data">
<table class="file-code file-diff">
<tr class="file-code-line">
<td class="blob-line-nums">
<span id="L1" rel="#L1">1</span>
<span id="L2" rel="#L2">2</span>
<span id="L3" rel="#L3">3</span>
<span id="L4" rel="#L4">4</span>
<span id="L5" rel="#L5">5</span>
<span id="L6" rel="#L6">6</span>
<span id="L7" rel="#L7">7</span>
<span id="L8" rel="#L8">8</span>
<span id="L9" rel="#L9">9</span>
<span id="L10" rel="#L10">10</span>
<span id="L11" rel="#L11">11</span>
<span id="L12" rel="#L12">12</span>
<span id="L13" rel="#L13">13</span>
<span id="L14" rel="#L14">14</span>
<span id="L15" rel="#L15">15</span>
<span id="L16" rel="#L16">16</span>
<span id="L17" rel="#L17">17</span>
<span id="L18" rel="#L18">18</span>
<span id="L19" rel="#L19">19</span>
<span id="L20" rel="#L20">20</span>
<span id="L21" rel="#L21">21</span>
<span id="L22" rel="#L22">22</span>
<span id="L23" rel="#L23">23</span>
<span id="L24" rel="#L24">24</span>
<span id="L25" rel="#L25">25</span>
<span id="L26" rel="#L26">26</span>
<span id="L27" rel="#L27">27</span>
<span id="L28" rel="#L28">28</span>
<span id="L29" rel="#L29">29</span>
<span id="L30" rel="#L30">30</span>
<span id="L31" rel="#L31">31</span>
<span id="L32" rel="#L32">32</span>
<span id="L33" rel="#L33">33</span>
<span id="L34" rel="#L34">34</span>
<span id="L35" rel="#L35">35</span>
<span id="L36" rel="#L36">36</span>
<span id="L37" rel="#L37">37</span>
<span id="L38" rel="#L38">38</span>
<span id="L39" rel="#L39">39</span>
<span id="L40" rel="#L40">40</span>
<span id="L41" rel="#L41">41</span>
<span id="L42" rel="#L42">42</span>
<span id="L43" rel="#L43">43</span>
<span id="L44" rel="#L44">44</span>
<span id="L45" rel="#L45">45</span>
<span id="L46" rel="#L46">46</span>
<span id="L47" rel="#L47">47</span>
<span id="L48" rel="#L48">48</span>
<span id="L49" rel="#L49">49</span>
<span id="L50" rel="#L50">50</span>
<span id="L51" rel="#L51">51</span>
<span id="L52" rel="#L52">52</span>
<span id="L53" rel="#L53">53</span>
<span id="L54" rel="#L54">54</span>
<span id="L55" rel="#L55">55</span>
<span id="L56" rel="#L56">56</span>
<span id="L57" rel="#L57">57</span>
<span id="L58" rel="#L58">58</span>
<span id="L59" rel="#L59">59</span>
<span id="L60" rel="#L60">60</span>
<span id="L61" rel="#L61">61</span>
<span id="L62" rel="#L62">62</span>
<span id="L63" rel="#L63">63</span>
<span id="L64" rel="#L64">64</span>
<span id="L65" rel="#L65">65</span>
<span id="L66" rel="#L66">66</span>
<span id="L67" rel="#L67">67</span>
<span id="L68" rel="#L68">68</span>
<span id="L69" rel="#L69">69</span>
<span id="L70" rel="#L70">70</span>
<span id="L71" rel="#L71">71</span>
<span id="L72" rel="#L72">72</span>
<span id="L73" rel="#L73">73</span>
<span id="L74" rel="#L74">74</span>
<span id="L75" rel="#L75">75</span>
<span id="L76" rel="#L76">76</span>
<span id="L77" rel="#L77">77</span>
<span id="L78" rel="#L78">78</span>
<span id="L79" rel="#L79">79</span>
<span id="L80" rel="#L80">80</span>
<span id="L81" rel="#L81">81</span>
<span id="L82" rel="#L82">82</span>
<span id="L83" rel="#L83">83</span>
<span id="L84" rel="#L84">84</span>
<span id="L85" rel="#L85">85</span>
<span id="L86" rel="#L86">86</span>
<span id="L87" rel="#L87">87</span>
<span id="L88" rel="#L88">88</span>
<span id="L89" rel="#L89">89</span>
<span id="L90" rel="#L90">90</span>
<span id="L91" rel="#L91">91</span>
<span id="L92" rel="#L92">92</span>
<span id="L93" rel="#L93">93</span>
<span id="L94" rel="#L94">94</span>
<span id="L95" rel="#L95">95</span>
<span id="L96" rel="#L96">96</span>
<span id="L97" rel="#L97">97</span>
<span id="L98" rel="#L98">98</span>
<span id="L99" rel="#L99">99</span>
<span id="L100" rel="#L100">100</span>
<span id="L101" rel="#L101">101</span>
<span id="L102" rel="#L102">102</span>
<span id="L103" rel="#L103">103</span>
<span id="L104" rel="#L104">104</span>
<span id="L105" rel="#L105">105</span>
<span id="L106" rel="#L106">106</span>
<span id="L107" rel="#L107">107</span>
<span id="L108" rel="#L108">108</span>
<span id="L109" rel="#L109">109</span>
<span id="L110" rel="#L110">110</span>
<span id="L111" rel="#L111">111</span>
<span id="L112" rel="#L112">112</span>
<span id="L113" rel="#L113">113</span>
<span id="L114" rel="#L114">114</span>
<span id="L115" rel="#L115">115</span>
<span id="L116" rel="#L116">116</span>
<span id="L117" rel="#L117">117</span>
<span id="L118" rel="#L118">118</span>
<span id="L119" rel="#L119">119</span>
<span id="L120" rel="#L120">120</span>
<span id="L121" rel="#L121">121</span>
<span id="L122" rel="#L122">122</span>
<span id="L123" rel="#L123">123</span>
<span id="L124" rel="#L124">124</span>
<span id="L125" rel="#L125">125</span>
<span id="L126" rel="#L126">126</span>
<span id="L127" rel="#L127">127</span>
<span id="L128" rel="#L128">128</span>
<span id="L129" rel="#L129">129</span>
<span id="L130" rel="#L130">130</span>
<span id="L131" rel="#L131">131</span>
<span id="L132" rel="#L132">132</span>
<span id="L133" rel="#L133">133</span>
<span id="L134" rel="#L134">134</span>
<span id="L135" rel="#L135">135</span>
<span id="L136" rel="#L136">136</span>
<span id="L137" rel="#L137">137</span>
<span id="L138" rel="#L138">138</span>
<span id="L139" rel="#L139">139</span>
<span id="L140" rel="#L140">140</span>
<span id="L141" rel="#L141">141</span>
<span id="L142" rel="#L142">142</span>
<span id="L143" rel="#L143">143</span>
<span id="L144" rel="#L144">144</span>
<span id="L145" rel="#L145">145</span>
<span id="L146" rel="#L146">146</span>
<span id="L147" rel="#L147">147</span>
<span id="L148" rel="#L148">148</span>
<span id="L149" rel="#L149">149</span>
<span id="L150" rel="#L150">150</span>
<span id="L151" rel="#L151">151</span>
<span id="L152" rel="#L152">152</span>
<span id="L153" rel="#L153">153</span>
<span id="L154" rel="#L154">154</span>
<span id="L155" rel="#L155">155</span>
<span id="L156" rel="#L156">156</span>
<span id="L157" rel="#L157">157</span>
<span id="L158" rel="#L158">158</span>
<span id="L159" rel="#L159">159</span>
<span id="L160" rel="#L160">160</span>
<span id="L161" rel="#L161">161</span>
<span id="L162" rel="#L162">162</span>
<span id="L163" rel="#L163">163</span>
<span id="L164" rel="#L164">164</span>
<span id="L165" rel="#L165">165</span>
</td>
<td class="blob-line-code">
<div class="highlight"><pre><div class='line' id='LC1'> GNU LESSER GENERAL PUBLIC LICENSE</div><div class='line' id='LC2'> Version 3, 29 June 2007</div><div class='line' id='LC3'><br/></div><div class='line' id='LC4'> Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/></div><div class='line' id='LC5'> Everyone is permitted to copy and distribute verbatim copies</div><div class='line' id='LC6'> of this license document, but changing it is not allowed.</div><div class='line' id='LC7'><br/></div><div class='line' id='LC8'><br/></div><div class='line' id='LC9'> This version of the GNU Lesser General Public License incorporates</div><div class='line' id='LC10'>the terms and conditions of version 3 of the GNU General Public</div><div class='line' id='LC11'>License, supplemented by the additional permissions listed below.</div><div class='line' id='LC12'><br/></div><div class='line' id='LC13'> 0. Additional Definitions.</div><div class='line' id='LC14'><br/></div><div class='line' id='LC15'> As used herein, "this License" refers to version 3 of the GNU Lesser</div><div class='line' id='LC16'>General Public License, and the "GNU GPL" refers to version 3 of the GNU</div><div class='line' id='LC17'>General Public License.</div><div class='line' id='LC18'><br/></div><div class='line' id='LC19'> "The Library" refers to a covered work governed by this License,</div><div class='line' id='LC20'>other than an Application or a Combined Work as defined below.</div><div class='line' id='LC21'><br/></div><div class='line' id='LC22'> An "Application" is any work that makes use of an interface provided</div><div class='line' id='LC23'>by the Library, but which is not otherwise based on the Library.</div><div class='line' id='LC24'>Defining a subclass of a class defined by the Library is deemed a mode</div><div class='line' id='LC25'>of using an interface provided by the Library.</div><div class='line' id='LC26'><br/></div><div class='line' id='LC27'> A "Combined Work" is a work produced by combining or linking an</div><div class='line' id='LC28'>Application with the Library. The particular version of the Library</div><div class='line' id='LC29'>with which the Combined Work was made is also called the "Linked</div><div class='line' id='LC30'>Version".</div><div class='line' id='LC31'><br/></div><div class='line' id='LC32'> The "Minimal Corresponding Source" for a Combined Work means the</div><div class='line' id='LC33'>Corresponding Source for the Combined Work, excluding any source code</div><div class='line' id='LC34'>for portions of the Combined Work that, considered in isolation, are</div><div class='line' id='LC35'>based on the Application, and not on the Linked Version.</div><div class='line' id='LC36'><br/></div><div class='line' id='LC37'> The "Corresponding Application Code" for a Combined Work means the</div><div class='line' id='LC38'>object code and/or source code for the Application, including any data</div><div class='line' id='LC39'>and utility programs needed for reproducing the Combined Work from the</div><div class='line' id='LC40'>Application, but excluding the System Libraries of the Combined Work.</div><div class='line' id='LC41'><br/></div><div class='line' id='LC42'> 1. Exception to Section 3 of the GNU GPL.</div><div class='line' id='LC43'><br/></div><div class='line' id='LC44'> You may convey a covered work under sections 3 and 4 of this License</div><div class='line' id='LC45'>without being bound by section 3 of the GNU GPL.</div><div class='line' id='LC46'><br/></div><div class='line' id='LC47'> 2. Conveying Modified Versions.</div><div class='line' id='LC48'><br/></div><div class='line' id='LC49'> If you modify a copy of the Library, and, in your modifications, a</div><div class='line' id='LC50'>facility refers to a function or data to be supplied by an Application</div><div class='line' id='LC51'>that uses the facility (other than as an argument passed when the</div><div class='line' id='LC52'>facility is invoked), then you may convey a copy of the modified</div><div class='line' id='LC53'>version:</div><div class='line' id='LC54'><br/></div><div class='line' id='LC55'> a) under this License, provided that you make a good faith effort to</div><div class='line' id='LC56'> ensure that, in the event an Application does not supply the</div><div class='line' id='LC57'> function or data, the facility still operates, and performs</div><div class='line' id='LC58'> whatever part of its purpose remains meaningful, or</div><div class='line' id='LC59'><br/></div><div class='line' id='LC60'> b) under the GNU GPL, with none of the additional permissions of</div><div class='line' id='LC61'> this License applicable to that copy.</div><div class='line' id='LC62'><br/></div><div class='line' id='LC63'> 3. Object Code Incorporating Material from Library Header Files.</div><div class='line' id='LC64'><br/></div><div class='line' id='LC65'> The object code form of an Application may incorporate material from</div><div class='line' id='LC66'>a header file that is part of the Library. You may convey such object</div><div class='line' id='LC67'>code under terms of your choice, provided that, if the incorporated</div><div class='line' id='LC68'>material is not limited to numerical parameters, data structure</div><div class='line' id='LC69'>layouts and accessors, or small macros, inline functions and templates</div><div class='line' id='LC70'>(ten or fewer lines in length), you do both of the following:</div><div class='line' id='LC71'><br/></div><div class='line' id='LC72'> a) Give prominent notice with each copy of the object code that the</div><div class='line' id='LC73'> Library is used in it and that the Library and its use are</div><div class='line' id='LC74'> covered by this License.</div><div class='line' id='LC75'><br/></div><div class='line' id='LC76'> b) Accompany the object code with a copy of the GNU GPL and this license</div><div class='line' id='LC77'> document.</div><div class='line' id='LC78'><br/></div><div class='line' id='LC79'> 4. Combined Works.</div><div class='line' id='LC80'><br/></div><div class='line' id='LC81'> You may convey a Combined Work under terms of your choice that,</div><div class='line' id='LC82'>taken together, effectively do not restrict modification of the</div><div class='line' id='LC83'>portions of the Library contained in the Combined Work and reverse</div><div class='line' id='LC84'>engineering for debugging such modifications, if you also do each of</div><div class='line' id='LC85'>the following:</div><div class='line' id='LC86'><br/></div><div class='line' id='LC87'> a) Give prominent notice with each copy of the Combined Work that</div><div class='line' id='LC88'> the Library is used in it and that the Library and its use are</div><div class='line' id='LC89'> covered by this License.</div><div class='line' id='LC90'><br/></div><div class='line' id='LC91'> b) Accompany the Combined Work with a copy of the GNU GPL and this license</div><div class='line' id='LC92'> document.</div><div class='line' id='LC93'><br/></div><div class='line' id='LC94'> c) For a Combined Work that displays copyright notices during</div><div class='line' id='LC95'> execution, include the copyright notice for the Library among</div><div class='line' id='LC96'> these notices, as well as a reference directing the user to the</div><div class='line' id='LC97'> copies of the GNU GPL and this license document.</div><div class='line' id='LC98'><br/></div><div class='line' id='LC99'> d) Do one of the following:</div><div class='line' id='LC100'><br/></div><div class='line' id='LC101'> 0) Convey the Minimal Corresponding Source under the terms of this</div><div class='line' id='LC102'> License, and the Corresponding Application Code in a form</div><div class='line' id='LC103'> suitable for, and under terms that permit, the user to</div><div class='line' id='LC104'> recombine or relink the Application with a modified version of</div><div class='line' id='LC105'> the Linked Version to produce a modified Combined Work, in the</div><div class='line' id='LC106'> manner specified by section 6 of the GNU GPL for conveying</div><div class='line' id='LC107'> Corresponding Source.</div><div class='line' id='LC108'><br/></div><div class='line' id='LC109'> 1) Use a suitable shared library mechanism for linking with the</div><div class='line' id='LC110'> Library. A suitable mechanism is one that (a) uses at run time</div><div class='line' id='LC111'> a copy of the Library already present on the user's computer</div><div class='line' id='LC112'> system, and (b) will operate properly with a modified version</div><div class='line' id='LC113'> of the Library that is interface-compatible with the Linked</div><div class='line' id='LC114'> Version.</div><div class='line' id='LC115'><br/></div><div class='line' id='LC116'> e) Provide Installation Information, but only if you would otherwise</div><div class='line' id='LC117'> be required to provide such information under section 6 of the</div><div class='line' id='LC118'> GNU GPL, and only to the extent that such information is</div><div class='line' id='LC119'> necessary to install and execute a modified version of the</div><div class='line' id='LC120'> Combined Work produced by recombining or relinking the</div><div class='line' id='LC121'> Application with a modified version of the Linked Version. (If</div><div class='line' id='LC122'> you use option 4d0, the Installation Information must accompany</div><div class='line' id='LC123'> the Minimal Corresponding Source and Corresponding Application</div><div class='line' id='LC124'> Code. If you use option 4d1, you must provide the Installation</div><div class='line' id='LC125'> Information in the manner specified by section 6 of the GNU GPL</div><div class='line' id='LC126'> for conveying Corresponding Source.)</div><div class='line' id='LC127'><br/></div><div class='line' id='LC128'> 5. Combined Libraries.</div><div class='line' id='LC129'><br/></div><div class='line' id='LC130'> You may place library facilities that are a work based on the</div><div class='line' id='LC131'>Library side by side in a single library together with other library</div><div class='line' id='LC132'>facilities that are not Applications and are not covered by this</div><div class='line' id='LC133'>License, and convey such a combined library under terms of your</div><div class='line' id='LC134'>choice, if you do both of the following:</div><div class='line' id='LC135'><br/></div><div class='line' id='LC136'> a) Accompany the combined library with a copy of the same work based</div><div class='line' id='LC137'> on the Library, uncombined with any other library facilities,</div><div class='line' id='LC138'> conveyed under the terms of this License.</div><div class='line' id='LC139'><br/></div><div class='line' id='LC140'> b) Give prominent notice with the combined library that part of it</div><div class='line' id='LC141'> is a work based on the Library, and explaining where to find the</div><div class='line' id='LC142'> accompanying uncombined form of the same work.</div><div class='line' id='LC143'><br/></div><div class='line' id='LC144'> 6. Revised Versions of the GNU Lesser General Public License.</div><div class='line' id='LC145'><br/></div><div class='line' id='LC146'> The Free Software Foundation may publish revised and/or new versions</div><div class='line' id='LC147'>of the GNU Lesser General Public License from time to time. Such new</div><div class='line' id='LC148'>versions will be similar in spirit to the present version, but may</div><div class='line' id='LC149'>differ in detail to address new problems or concerns.</div><div class='line' id='LC150'><br/></div><div class='line' id='LC151'> Each version is given a distinguishing version number. If the</div><div class='line' id='LC152'>Library as you received it specifies that a certain numbered version</div><div class='line' id='LC153'>of the GNU Lesser General Public License "or any later version"</div><div class='line' id='LC154'>applies to it, you have the option of following the terms and</div><div class='line' id='LC155'>conditions either of that published version or of any later version</div><div class='line' id='LC156'>published by the Free Software Foundation. If the Library as you</div><div class='line' id='LC157'>received it does not specify a version number of the GNU Lesser</div><div class='line' id='LC158'>General Public License, you may choose any version of the GNU Lesser</div><div class='line' id='LC159'>General Public License ever published by the Free Software Foundation.</div><div class='line' id='LC160'><br/></div><div class='line' id='LC161'> If the Library as you received it specifies that a proxy can decide</div><div class='line' id='LC162'>whether future versions of the GNU Lesser General Public License shall</div><div class='line' id='LC163'>apply, that proxy's public statement of acceptance of any version is</div><div class='line' id='LC164'>permanent authorization for you to choose that version for the</div><div class='line' id='LC165'>Library.</div></pre></div>
</td>
</tr>
</table>
</div>
</div>
</div>
<a href="#jump-to-line" rel="facebox" data-hotkey="l" class="js-jump-to-line" style="display:none">Jump to Line</a>
<div id="jump-to-line" style="display:none">
<h2>Jump to Line</h2>
<form accept-charset="UTF-8" class="js-jump-to-line-form">
<input class="textfield js-jump-to-line-field" type="text">
<div class="full-button">
<button type="submit" class="button">Go</button>
</div>
</form>
</div>
</div>
</div>
</div>
<div id="js-frame-loading-template" class="frame frame-loading large-loading-area" style="display:none;">
<img class="js-frame-loading-spinner" src="https://a248.e.akamai.net/assets.github.com/images/spinners/octocat-spinner-128.gif?1360648847" height="64" width="64">
</div>
</div>
</div>
<div class="modal-backdrop"></div>
</div>
<div id="footer-push"></div><!-- hack for sticky footer -->
</div><!-- end of wrapper - hack for sticky footer -->
<!-- footer -->
<div id="footer">
<div class="container clearfix">
<dl class="footer_nav">
<dt>GitHub</dt>
<dd><a href="https://github.com/about">About us</a></dd>
<dd><a href="https://github.com/blog">Blog</a></dd>
<dd><a href="https://github.com/contact">Contact & support</a></dd>
<dd><a href="http://enterprise.github.com/">GitHub Enterprise</a></dd>
<dd><a href="http://status.github.com/">Site status</a></dd>
</dl>
<dl class="footer_nav">
<dt>Applications</dt>
<dd><a href="http://mac.github.com/">GitHub for Mac</a></dd>
<dd><a href="http://windows.github.com/">GitHub for Windows</a></dd>
<dd><a href="http://eclipse.github.com/">GitHub for Eclipse</a></dd>
<dd><a href="http://mobile.github.com/">GitHub mobile apps</a></dd>
</dl>
<dl class="footer_nav">
<dt>Services</dt>
<dd><a href="http://get.gaug.es/">Gauges: Web analytics</a></dd>
<dd><a href="http://speakerdeck.com">Speaker Deck: Presentations</a></dd>
<dd><a href="https://gist.github.com">Gist: Code snippets</a></dd>
<dd><a href="http://jobs.github.com/">Job board</a></dd>
</dl>
<dl class="footer_nav">
<dt>Documentation</dt>
<dd><a href="http://help.github.com/">GitHub Help</a></dd>
<dd><a href="http://developer.github.com/">Developer API</a></dd>
<dd><a href="http://github.github.com/github-flavored-markdown/">GitHub Flavored Markdown</a></dd>
<dd><a href="http://pages.github.com/">GitHub Pages</a></dd>
</dl>
<dl class="footer_nav">
<dt>More</dt>
<dd><a href="http://training.github.com/">Training</a></dd>
<dd><a href="https://github.com/edu">Students & teachers</a></dd>
<dd><a href="http://shop.github.com">The Shop</a></dd>
<dd><a href="/plans">Plans & pricing</a></dd>
<dd><a href="http://octodex.github.com/">The Octodex</a></dd>
</dl>
<hr class="footer-divider">
<p class="right">© 2013 <span title="0.04166s from fe4.rs.github.com">GitHub</span>, Inc. All rights reserved.</p>
<a class="left" href="https://github.com/">
<span class="mega-octicon octicon-mark-github"></span>
</a>
<ul id="legal">
<li><a href="https://github.com/site/terms">Terms of Service</a></li>
<li><a href="https://github.com/site/privacy">Privacy</a></li>
<li><a href="https://github.com/security">Security</a></li>
</ul>
</div><!-- /.container -->
</div><!-- /.#footer -->
<div class="fullscreen-overlay js-fullscreen-overlay" id="fullscreen_overlay">
<div class="fullscreen-container js-fullscreen-container">
<div class="textarea-wrap">
<textarea name="fullscreen-contents" id="fullscreen-contents" class="js-fullscreen-contents" placeholder="" data-suggester="fullscreen_suggester"></textarea>
<div class="suggester-container">
<div class="suggester fullscreen-suggester js-navigation-container" id="fullscreen_suggester"
data-url="/marmalade/openfeint/suggestions/commit">
</div>
</div>
</div>
</div>
<div class="fullscreen-sidebar">
<a href="#" class="exit-fullscreen js-exit-fullscreen tooltipped leftwards" title="Exit Zen Mode">
<span class="mega-octicon octicon-screen-normal"></span>
</a>
<a href="#" class="theme-switcher js-theme-switcher tooltipped leftwards"
title="Switch themes">
<span class="octicon octicon-color-mode"></span>
</a>
</div>
</div>
<div id="ajax-error-message" class="flash flash-error">
<span class="octicon octicon-alert"></span>
Something went wrong with that request. Please try again.
<a href="#" class="octicon octicon-remove-close ajax-error-dismiss"></a>
</div>
<span id='server_response_time' data-time='0.04197' data-host='fe4'></span>
</body>
</html>
| {
"pile_set_name": "Github"
} |
//
// RxTextViewDelegateProxy.swift
// RxCocoa
//
// Created by Yuta ToKoRo on 7/19/15.
// Copyright © 2015 Krunoslav Zaher. All rights reserved.
//
#if os(iOS) || os(tvOS)
import UIKit
#if !RX_NO_MODULE
import RxSwift
#endif
/// For more information take a look at `DelegateProxyType`.
public class RxTextViewDelegateProxy
: RxScrollViewDelegateProxy
, UITextViewDelegate {
/// Typed parent object.
public weak private(set) var textView: UITextView?
/// Initializes `RxTextViewDelegateProxy`
///
/// - parameter parentObject: Parent object for delegate proxy.
public required init(parentObject: AnyObject) {
self.textView = castOrFatalError(parentObject)
super.init(parentObject: parentObject)
}
// MARK: delegate methods
/// For more information take a look at `DelegateProxyType`.
@objc public func textView(_ textView: UITextView, shouldChangeTextIn range: NSRange, replacementText text: String) -> Bool {
/**
We've had some issues with observing text changes. This is here just in case we need the same hack in future and that
we wouldn't need to change the public interface.
*/
let forwardToDelegate = self.forwardToDelegate() as? UITextViewDelegate
return forwardToDelegate?.textView?(textView,
shouldChangeTextIn: range,
replacementText: text) ?? true
}
}
#endif
| {
"pile_set_name": "Github"
} |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<title>Logback Home</title>
<link rel="stylesheet" type="text/css" href="css/common.css" />
<link rel="stylesheet" type="text/css" href="css/screen.css" media="screen" />
<link rel="stylesheet" type="text/css" href="css/_print.css" media="print" />
</head>
<body>
<script type="text/javascript">prefix='';</script>
<script src="templates/header.js" type="text/javascript"></script>
<div id="left">
<noscript>Please turn on Javascript to view this menu</noscript>
<script src="templates/left.js" type="text/javascript"></script>
</div>
<div id="right">
<script src="templates/right.js" type="text/javascript"></script>
</div>
<div id="content">
<h2>Logback Project</h2>
<p>Logback is intended as a successor to the popular log4j
project, <a href="reasonsToSwitch.html">picking up where log4j
leaves off</a>.
</p>
<p>Logback's architecture is sufficiently generic so as to apply
under different circumstances. At present time, logback is divided
into three modules, logback-core, logback-classic and
logback-access.
</p>
<p>The logback-core module lays the groundwork for the other two
modules. The logback-classic module can be assimilated to a
significantly improved version of log4j. Moreover, logback-classic
natively implements the <a href="http://www.slf4j.org">SLF4J
API</a> so that you can readily switch back and forth between
logback and other logging frameworks such as log4j or
java.util.logging (JUL).
</p>
<p>The logback-access module integrates with Servlet containers,
such as Tomcat and Jetty, to provide HTTP-access log
functionality. Note that you could easily build your own module
on top of logback-core.
</p>
<script src="templates/footer.js" type="text/javascript"></script>
</div>
</body>
</html>
| {
"pile_set_name": "Github"
} |
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. -->
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{55D5BA28-D427-4F53-80C2-FE9EF23C1553}</ProjectGuid>
<ConfigurationType>DynamicLibrary</ConfigurationType>
<TargetName>SfxCA</TargetName>
<CharacterSet>Unicode</CharacterSet>
<ProjectModuleDefinitionFile>EntryPoints.def</ProjectModuleDefinitionFile>
<ShouldSignOutput>false</ShouldSignOutput>
</PropertyGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildProjectDirectory), wix.proj))\tools\WixBuild.props" />
<PropertyGroup>
<ProjectAdditionalLinkLibraries>msi.lib;cabinet.lib;shlwapi.lib</ProjectAdditionalLinkLibraries>
</PropertyGroup>
<ItemGroup>
<ClCompile Include="ClrHost.cpp" />
<ClCompile Include="Extract.cpp" />
<ClCompile Include="RemoteMsi.cpp" />
<ClCompile Include="SfxCA.cpp" />
<ClCompile Include="SfxUtil.cpp" />
<ClCompile Include="EmbeddedUI.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="precomp.h" />
<ClInclude Include="EntryPoints.h" />
<ClInclude Include="RemoteMsiSession.h" />
<ClInclude Include="SfxUtil.h" />
</ItemGroup>
<ItemGroup>
<None Include="EntryPoints.def" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="SfxCA.rc" />
</ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildProjectDirectory), wix.proj))\tools\WixBuild.targets" />
</Project>
| {
"pile_set_name": "Github"
} |
# Building Julius
If you have experience in compiling from source, these are the basic instructions.
To build Julius, you'll need:
- `git`
- a compiler (`gcc`, `clang`, Visual Studio and MinGW(-w64) are all known to be supported)
- `cmake`
- `SDL2`
- `SDL2_mixer`
- `libpng` (optional, a bundled copy will be used if not found)
After cloning the repo (URL: `https://github.com/bvschaik/julius.git`), run the following commands:
$ mkdir build && cd build
$ cmake ..
$ make
This results in a `julius` executable.
To use the bundled copies of optional libraries even if a system version is available, add `-DSYSTEM_LIBS=OFF` to `cmake` invocation.
To build the Vita or Switch versions, use `cmake .. -DVITA_BUILD=ON` or `cmake .. -DSWITCH_BUILD=ON`
instead of `cmake ..`.
You'll obviously need the Vita or Switch SDK's. Docker images for the SDK's are available:
- Vita: `gnuton/vitasdk-docker:20190626`
- Switch: `rsn8887/switchdev`
See [Running Julius](RUNNING.md) for instructions on how to configure Julius for your platform.
--------------------------------------------------
For detailed building instructions, please check out the respective page:
- [Building for Windows](building_windows.md)
- [Building for Linux](building_linux.md)
- [Building for Mac](building_macos.md)
- [Building for Playstation Vita](building_vita.md)
- [Building for Nintendo Switch](building_switch.md) | {
"pile_set_name": "Github"
} |
// MIT License - Copyright (c) Callum McGing
// This file is subject to the terms and conditions defined in
// LICENSE, which is part of this source code package
using System;
using LibreLancer;
namespace LibreLancer.Interface
{
[UiLoadable]
public class ImageFile : UiWidget
{
public string Path { get; set; }
public bool Flip { get; set; } = true;
public InterfaceColor Tint { get; set; }
public bool Fill { get; set; }
private Texture2D texture;
private bool loaded = false;
public override void Render(UiContext context, RectangleF parentRectangle)
{
if (!Visible) return;
var myPos = context.AnchorPosition(parentRectangle, Anchor, X, Y, Width, Height);
var myRectangle = new RectangleF(myPos.X, myPos.Y, Width, Height);
if (Fill) myRectangle = parentRectangle;
if(Background != null)
Background.Draw(context, myRectangle);
if (!loaded)
{
texture = context.Data.GetTextureFile(Path);
loaded = true;
}
if (texture != null)
{
context.Mode2D();
var color = (Tint ?? InterfaceColor.White).Color;
context.Renderer2D.DrawImageStretched(texture, context.PointsToPixels(myRectangle), color, Flip);
}
}
}
} | {
"pile_set_name": "Github"
} |
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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.
*/
package org.apache.drill.exec.vector.accessor.writer;
import org.apache.drill.exec.record.metadata.ColumnMetadata;
import org.apache.drill.exec.vector.UInt4Vector;
import org.apache.drill.exec.vector.accessor.DictWriter;
import org.apache.drill.exec.vector.accessor.ObjectType;
import org.apache.drill.exec.vector.accessor.ObjectWriter;
import org.apache.drill.exec.vector.accessor.ScalarWriter;
import org.apache.drill.exec.vector.accessor.ValueType;
import org.apache.drill.exec.vector.accessor.impl.HierarchicalFormatter;
import org.apache.drill.exec.vector.accessor.writer.dummy.DummyArrayWriter;
import org.apache.drill.exec.vector.accessor.writer.dummy.DummyDictWriter;
import org.apache.drill.exec.vector.complex.DictVector;
import org.apache.drill.exec.vector.complex.RepeatedDictVector;
import java.lang.reflect.Array;
import java.util.List;
import java.util.Map;
/**
* The implementation represents the writer as an array writer
* with special dict entry writer as its element writer.
*/
public class ObjectDictWriter extends ObjectArrayWriter implements DictWriter {
public static class DictObjectWriter extends AbstractArrayWriter.ArrayObjectWriter {
public DictObjectWriter(DictWriter dictWriter) {
super((AbstractArrayWriter) dictWriter);
}
@Override
public DictWriter dict() {
return (DictWriter) arrayWriter;
}
@Override
public void dump(HierarchicalFormatter format) {
format.startObject(this)
.attribute("dictWriter");
arrayWriter.dump(format);
format.endObject();
}
}
public static ObjectDictWriter.DictObjectWriter buildDict(ColumnMetadata metadata, DictVector vector,
List<AbstractObjectWriter> keyValueWriters) {
DictEntryWriter.DictEntryObjectWriter entryObjectWriter =
DictEntryWriter.buildDictEntryWriter(metadata, keyValueWriters, vector);
DictWriter objectDictWriter;
if (vector != null) {
objectDictWriter = new ObjectDictWriter(metadata, vector.getOffsetVector(), entryObjectWriter);
} else {
objectDictWriter = new DummyDictWriter(metadata, entryObjectWriter);
}
return new ObjectDictWriter.DictObjectWriter(objectDictWriter);
}
public static ArrayObjectWriter buildDictArray(ColumnMetadata metadata, RepeatedDictVector vector,
List<AbstractObjectWriter> keyValueWriters) {
final DictVector dataVector;
if (vector != null) {
dataVector = (DictVector) vector.getDataVector();
} else {
dataVector = null;
}
ObjectDictWriter.DictObjectWriter dictWriter = buildDict(metadata, dataVector, keyValueWriters);
AbstractArrayWriter arrayWriter;
if (vector != null) {
arrayWriter = new ObjectArrayWriter(metadata, vector.getOffsetVector(), dictWriter);
} else {
arrayWriter = new DummyArrayWriter(metadata, dictWriter);
}
return new ArrayObjectWriter(arrayWriter);
}
public static final int FIELD_KEY_ORDINAL = 0;
public static final int FIELD_VALUE_ORDINAL = 1;
private final DictEntryWriter.DictEntryObjectWriter entryObjectWriter;
public ObjectDictWriter(ColumnMetadata schema, UInt4Vector offsetVector,
DictEntryWriter.DictEntryObjectWriter entryObjectWriter) {
super(schema, offsetVector, entryObjectWriter);
this.entryObjectWriter = entryObjectWriter;
}
@Override
public ValueType keyType() {
return tuple().scalar(FIELD_KEY_ORDINAL).valueType();
}
@Override
public ObjectType valueType() {
return tuple().type(FIELD_VALUE_ORDINAL);
}
@Override
public ScalarWriter keyWriter() {
return tuple().scalar(FIELD_KEY_ORDINAL);
}
@Override
public ObjectWriter valueWriter() {
return tuple().column(FIELD_VALUE_ORDINAL);
}
@Override
@SuppressWarnings("unchecked")
public void setObject(Object object) {
if (object == null) {
return;
}
if (object instanceof Map) {
Map<Object, Object> map = (Map<Object, Object>) object;
for (Map.Entry<Object, Object> entry : map.entrySet()) {
entryObjectWriter.setKeyValue(entry.getKey(), entry.getValue());
save();
}
} else {
int size = Array.getLength(object);
assert size % 2 == 0;
for (int i = 0; i < size; i += 2) {
Object key = Array.get(object, i);
Object value = Array.get(object, i + 1);
entryObjectWriter.setKeyValue(key, value);
save();
}
}
}
}
| {
"pile_set_name": "Github"
} |
// Copyright 2018 The Draco Authors.
//
// 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.
//
#include "draco/io/file_utils.h"
#include "draco/io/file_reader_factory.h"
#include "draco/io/file_reader_interface.h"
#include "draco/io/file_writer_factory.h"
#include "draco/io/file_writer_interface.h"
#include "draco/io/parser_utils.h"
namespace draco {
bool SplitPath(const std::string &full_path, std::string *out_folder_path,
std::string *out_file_name) {
const auto pos = full_path.find_last_of("/\\");
if (pos != std::string::npos) {
if (out_folder_path) {
*out_folder_path = full_path.substr(0, pos);
}
if (out_file_name) {
*out_file_name = full_path.substr(pos + 1, full_path.length());
}
} else {
if (out_folder_path) {
*out_folder_path = ".";
}
if (out_file_name) {
*out_file_name = full_path;
}
}
return true;
}
std::string ReplaceFileExtension(const std::string &in_file_name,
const std::string &new_extension) {
const auto pos = in_file_name.find_last_of(".");
if (pos == std::string::npos) {
// No extension found.
return in_file_name + "." + new_extension;
}
return in_file_name.substr(0, pos + 1) + new_extension;
}
std::string LowercaseFileExtension(const std::string &filename) {
const size_t pos = filename.find_last_of('.');
if (pos == 0 || pos == std::string::npos || pos == filename.length() - 1) {
return "";
}
return parser::ToLower(filename.substr(pos + 1));
}
std::string GetFullPath(const std::string &input_file_relative_path,
const std::string &sibling_file_full_path) {
const auto pos = sibling_file_full_path.find_last_of("/\\");
std::string input_file_full_path;
if (pos != std::string::npos) {
input_file_full_path = sibling_file_full_path.substr(0, pos + 1);
}
input_file_full_path += input_file_relative_path;
return input_file_full_path;
}
bool ReadFileToBuffer(const std::string &file_name, std::vector<char> *buffer) {
std::unique_ptr<FileReaderInterface> file_reader =
FileReaderFactory::OpenReader(file_name);
if (file_reader == nullptr) {
return false;
}
return file_reader->ReadFileToBuffer(buffer);
}
bool ReadFileToBuffer(const std::string &file_name,
std::vector<uint8_t> *buffer) {
std::unique_ptr<FileReaderInterface> file_reader =
FileReaderFactory::OpenReader(file_name);
if (file_reader == nullptr) {
return false;
}
return file_reader->ReadFileToBuffer(buffer);
}
bool WriteBufferToFile(const char *buffer, size_t buffer_size,
const std::string &file_name) {
std::unique_ptr<FileWriterInterface> file_writer =
FileWriterFactory::OpenWriter(file_name);
if (file_writer == nullptr) {
return false;
}
return file_writer->Write(buffer, buffer_size);
}
bool WriteBufferToFile(const unsigned char *buffer, size_t buffer_size,
const std::string &file_name) {
return WriteBufferToFile(reinterpret_cast<const char *>(buffer), buffer_size,
file_name);
}
bool WriteBufferToFile(const void *buffer, size_t buffer_size,
const std::string &file_name) {
return WriteBufferToFile(reinterpret_cast<const char *>(buffer), buffer_size,
file_name);
}
size_t GetFileSize(const std::string &file_name) {
std::unique_ptr<FileReaderInterface> file_reader =
FileReaderFactory::OpenReader(file_name);
if (file_reader == nullptr) {
return 0;
}
return file_reader->GetFileSize();
}
} // namespace draco
| {
"pile_set_name": "Github"
} |
from flask import current_app
from tests.unit.test_base import BasicsTestCase
class AppTestCase(BasicsTestCase):
def test_app_exists(self):
self.assertFalse(current_app is None)
| {
"pile_set_name": "Github"
} |
//------------------------------------------------------------------------------
// <copyright file="OutputScopeManager.cs" company="Microsoft">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
// <owner current="true" primary="true">Microsoft</owner>
//------------------------------------------------------------------------------
using System;
using System.Diagnostics;
using System.Xml;
using System.Collections;
namespace System.Xml.Xsl.Xslt {
internal class OutputScopeManager {
public struct ScopeReord {
public int scopeCount;
public string prefix;
public string nsUri;
}
ScopeReord[] records = new ScopeReord[32];
int lastRecord = 0;
int lastScopes = 0; // This is cash of records[lastRecord].scopeCount field;
// most often we will have PushScope()/PopScope pare over the same record.
// It has sence to avoid adresing this field through array access.
public OutputScopeManager() {
Reset();
}
public void Reset() {
// AddNamespace(null, null); -- lookup barier
records[0].prefix = null;
records[0].nsUri = null;
PushScope();
}
public void PushScope() {
lastScopes ++;
}
public void PopScope() {
if (0 < lastScopes) {
lastScopes --;
}
else {
while(records[-- lastRecord].scopeCount == 0) ;
lastScopes = records[lastRecord].scopeCount;
lastScopes --;
}
}
// This can be ns declaration or ns exclussion. Las one when prefix == null;
public void AddNamespace(string prefix, string uri) {
Debug.Assert(prefix != null);
Debug.Assert(uri != null);
// uri = nameTable.Add(uri);
AddRecord(prefix, uri);
}
private void AddRecord(string prefix, string uri) {
records[lastRecord].scopeCount = lastScopes;
lastRecord ++;
if (lastRecord == records.Length) {
ScopeReord[] newRecords = new ScopeReord[lastRecord * 2];
Array.Copy(records, 0, newRecords, 0, lastRecord);
records = newRecords;
}
lastScopes = 0;
records[lastRecord].prefix = prefix;
records[lastRecord].nsUri = uri;
}
// There are some cases where we can't predict namespace content. To garantee correct results we should output all
// literal namespaces once again.
// <xsl:element name="{}" namespace="{}"> all prefixes should be invalidated
// <xsl:element name="{}" namespace="FOO"> all prefixes should be invalidated
// <xsl:element name="foo:A" namespace="{}"> prefixe "foo" should be invalidated
// <xsl:element name="foo:{}" namespace="{}"> prefixe "foo" should be invalidated
// <xsl:element name="foo:A" namespace="FOO"> no invalidations reqired
// <xsl:attribute name="{}" namespace="FOO"> all prefixes should be invalidated but not default ""
// <xsl:attribute name="foo:A" namespace="{}"> all prefixes should be invalidated but not default ""
// <xsl:element name="foo:A" namespace="FOO"> We can try to invalidate only foo prefix, but there to many thinks to consider here.
// So for now if attribute has non-null namespace it invalidates all prefixes in the
// scope of its element.
//
// <xsl:copy-of select="@*|namespace::*"> all prefixes are invalidated for the current element scope
// <xsl:copy-of select="/|*|text()|etc."> no invalidations needed
// <xsl:copy> if the node is either attribute or namespace, all prefixes are invalidated for the current element scope
// if the node is element, new scope is created, and all prefixes are invalidated
// otherwise, no invalidations needed
//// We need following methods:
//public void InvalidatePrefix(string prefix) {
// Debug.Assert(prefix != null);
// if (LookupNamespace(prefix) == null) { // This is optimisation. May be better just add this record?
// return;
// }
// AddRecord(prefix, null);
//}
public void InvalidateAllPrefixes() {
if (records[lastRecord].prefix == null) {
return; // Averything was invalidated already. Nothing to do.
}
AddRecord(null, null);
}
public void InvalidateNonDefaultPrefixes() {
string defaultNs = LookupNamespace(string.Empty);
if (defaultNs == null) { // We don't know default NS anyway.
InvalidateAllPrefixes();
}
else {
if (
records[lastRecord ].prefix.Length == 0 &&
records[lastRecord - 1].prefix == null
) {
return; // Averything was already done
}
AddRecord(null, null);
AddRecord(string.Empty, defaultNs);
}
}
public string LookupNamespace(string prefix) {
Debug.Assert(prefix != null);
for (
int record = lastRecord; // from last record
records[record].prefix != null; // till lookup barrier
-- record // in reverce direction
) {
Debug.Assert(0 < record, "first record is lookup bariaer, so we don't need to check this condition runtime");
if (records[record].prefix == prefix) {
return records[record].nsUri;
}
}
return null;
}
}
}
| {
"pile_set_name": "Github"
} |
-- 18.05.2016 18:50
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Process_Para SET SeqNo=30,Updated=TO_TIMESTAMP('2016-05-18 18:50:54','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=540855
;
-- 18.05.2016 18:50
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Process_Para SET SeqNo=20,Updated=TO_TIMESTAMP('2016-05-18 18:50:57','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=540852
;
-- 18.05.2016 18:51
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Process_Para (AD_Client_ID,AD_Element_ID,AD_Org_ID,AD_Process_ID,AD_Process_Para_ID,AD_Reference_ID,ColumnName,Created,CreatedBy,Description,EntityType,FieldLength,Help,IsActive,IsAutocomplete,IsCentrallyMaintained,IsEncrypted,IsMandatory,IsRange,Name,SeqNo,Updated,UpdatedBy) VALUES (0,113,0,540646,540962,19,'AD_Org_ID',TO_TIMESTAMP('2016-05-18 18:51:10','YYYY-MM-DD HH24:MI:SS'),100,'Organisatorische Einheit des Mandanten','de.metas.fresh',0,'Eine Organisation ist ein Bereich ihres Mandanten - z.B. Laden oder Abteilung. Sie können Daten über Organisationen hinweg gemeinsam verwenden.','Y','N','Y','N','N','N','Sektion',40,TO_TIMESTAMP('2016-05-18 18:51:10','YYYY-MM-DD HH24:MI:SS'),100)
;
-- 18.05.2016 18:51
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
INSERT INTO AD_Process_Para_Trl (AD_Language,AD_Process_Para_ID, Description,Help,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy) SELECT l.AD_Language,t.AD_Process_Para_ID, t.Description,t.Help,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy FROM AD_Language l, AD_Process_Para t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Process_Para_ID=540962 AND NOT EXISTS (SELECT * FROM AD_Process_Para_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Process_Para_ID=t.AD_Process_Para_ID)
;
-- 18.05.2016 18:51
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Process_Para SET SeqNo=10,Updated=TO_TIMESTAMP('2016-05-18 18:51:13','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=540962
;
-- 18.05.2016 18:51
-- I forgot to set the DICTIONARY_ID_COMMENTS System Configurator
UPDATE AD_Process_Para SET DefaultValue='@AD_Org_ID@', IsMandatory='Y',Updated=TO_TIMESTAMP('2016-05-18 18:51:20','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=540962
;
| {
"pile_set_name": "Github"
} |
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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.
*/
package org.apache.activemq.apollo.cli
import java.io.File
import org.apache.activemq.apollo.util.FileSupport._
/**
* <p>
* Launches the Apollo broker assuming it's being run from
* an IDE environment.
* </p>
*
* @author <a href="http://hiramchirino.com">Hiram Chirino</a>
*/
object ApolloIDERunner {
// We use this to figure out where the source code is in the files system.
def project_base = new File(getClass.getResource("banner.txt").toURI.resolve("../../../../../../../..").toURL.getFile)
def main(args:Array[String]):Unit = {
// Let the user know where he configure logging at.
println("Logging was configured using '%s'.".format(getClass.getClassLoader.getResource("log4j.properties")));
// Setups where the broker base directory is...
if( System.getProperty("apollo.base") == null ) {
val apollo_base = project_base / "apollo-cli" / "target" / "test-classes" / "example-broker"
System.setProperty("apollo.base", apollo_base.getCanonicalPath)
}
println("apollo.base=%s".format(System.getProperty("apollo.base")));
System.setProperty("basedir", System.getProperty("apollo.base"))
// Setup where the web app resources are...
if( System.getProperty("apollo.webapp") == null ) {
val apollo_webapp = project_base / "apollo-web"/ "src" / "main"/ "webapp"
System.setProperty("apollo.webapp", apollo_webapp.getCanonicalPath)
}
System.setProperty("scalate.mode", "development")
// Configure jul logging..
val apollo_base = new File(System.getProperty("apollo.base"))
val jul_properties = apollo_base / "etc" / "jul.properties"
System.setProperty("java.util.logging.config.file", jul_properties.getCanonicalPath)
println("=======================")
println("Press Enter To Shutdown")
println("=======================")
new Apollo().run(System.in, System.out, System.err, Array("run"))
System.in.read
println("=============")
println("Shutting down")
println("=============")
System.exit(0)
}
} | {
"pile_set_name": "Github"
} |
-----BEGIN PRIVATE KEY-----
MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgHddU1hrJcauGouqG
3Xi2Xhn3RlOhQ3IVmEOlrtkHWp2hRANCAATZuKseQKoXOkcvFXZz9tASKG1t9TDK
ymCBOOj99hXUhul70k5amQOcPn6UCpj1Zkac0jT4shNSEinSAzjSCyBB
-----END PRIVATE KEY-----
| {
"pile_set_name": "Github"
} |
/**********************************************************************
*These solidity codes have been obtained from Etherscan for extracting
*the smartcontract related info.
*The data will be used by MATRIX AI team as the reference basis for
*MATRIX model analysis,extraction of contract semantics,
*as well as AI based data analysis, etc.
**********************************************************************/
pragma solidity ^0.4.16;
contract ERC20Token {
uint256 public totalSupply;
string public name;
uint8 public decimals;
string public symbol;
mapping (address => uint256) balances;
mapping (address => mapping (address => uint256)) allowed;
function balanceOf(address _owner) public constant returns (uint256 balance);
function transfer(address _to, uint256 _value) public returns (bool success);
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success);
function approve(address _spender, uint256 _value) public returns (bool success);
function allowance(address _owner, address _spender) public constant returns (uint256 remaining);
event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
}
contract ZToken is ERC20Token {
function () public {
require(false);
}
function ZToken(
uint256 _initialAmount,
string _tokenName,
uint8 _decimalUnits,
string _tokenSymbol
) public {
totalSupply = _initialAmount * 10 ** uint256(_decimalUnits);
balances[msg.sender] = totalSupply;
name = _tokenName;
decimals = _decimalUnits;
symbol = _tokenSymbol;
}
function transfer(address _to, uint256 _value) public returns (bool success) {
if (balances[msg.sender] >= _value && _value > 0) {
balances[msg.sender] -= _value;
balances[_to] += _value;
Transfer(msg.sender, _to, _value);
return true;
} else {
return false;
}
}
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) {
if (balances[_from] >= _value && allowed[_from][msg.sender] >= _value && _value > 0) {
balances[_to] += _value;
balances[_from] -= _value;
allowed[_from][msg.sender] -= _value;
Transfer(_from, _to, _value);
return true;
} else {
return false;
}
}
function balanceOf(address _owner) public constant returns (uint256 balance) {
return balances[_owner];
}
function approve(address _spender, uint256 _value) public returns (bool success) {
allowed[msg.sender][_spender] = _value;
Approval(msg.sender, _spender, _value);
return true;
}
function allowance(address _owner, address _spender) public constant returns (uint256 remaining) {
return allowed[_owner][_spender];
}
} | {
"pile_set_name": "Github"
} |
Title: Render filter for "Services colored according to state" painter
Class: feature
Compatible: compat
Component: wato
Date: 1571064008
Edition: cre
Knowledge: undoc
Level: 1
Version: 2.0.0i1
"Services colored according to state" painter rendered all services in
host. With this werk, it is possible to filter out services that are in a
given state. | {
"pile_set_name": "Github"
} |
/*
* Copyright 2007-2012 the original author or authors.
*
* 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.
*/
package org.springbyexample.web.service;
import java.sql.Connection;
import java.sql.SQLException;
import java.util.List;
import javax.persistence.Cache;
import javax.persistence.EntityManagerFactory;
import javax.sql.DataSource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springbyexample.mvc.test.AbstractProfileTest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.core.io.Resource;
import org.springframework.jdbc.datasource.init.ResourceDatabasePopulator;
import org.springframework.test.context.ContextConfiguration;
/**
* Base class for REST controller tests.
*
* @author David Winterfeldt
*/
@ContextConfiguration({ "classpath:/org/springbyexample/web/mvc/rest-controller-test-context.xml" })
public abstract class AbstractRestControllerTest extends AbstractProfileTest {
final Logger logger = LoggerFactory.getLogger(AbstractRestControllerTest.class);
@Autowired
private EmbeddedJetty embeddedJetty;
/**
* Reset the DB before each test.
*/
@Override
protected void doInit() {
reset();
}
/**
* Reset the database and entity manager cache.
*/
protected void reset() {
resetSchema();
resetCache();
logger.info("DB schema and entity manager cache reset.");
}
/**
* Resets DB schema.
*/
private void resetSchema() {
ApplicationContext ctx = embeddedJetty.getApplicationContext();
DataSource dataSource = ctx.getBean(DataSource.class);
@SuppressWarnings("unchecked")
List<Resource> databaseScripts = (List<Resource>) ctx.getBean("databaseScriptsList");
Connection con = null;
ResourceDatabasePopulator resourceDatabasePopulator = new ResourceDatabasePopulator();
try {
con = dataSource.getConnection();
resourceDatabasePopulator.setScripts(databaseScripts.toArray(new Resource[0]));
resourceDatabasePopulator.populate(con);
} catch (SQLException e) {
logger.error(e.getMessage(), e);
} finally {
try { con.close(); } catch (Exception e) {}
}
}
/**
* Reset cache.
*/
private void resetCache() {
ApplicationContext ctx = embeddedJetty.getApplicationContext();
EntityManagerFactory entityManagerFactory = ctx.getBean(EntityManagerFactory.class);
Cache cache = entityManagerFactory.getCache();
if (cache != null) {
cache.evictAll();
}
}
}
| {
"pile_set_name": "Github"
} |
<resources>
<string name="app_name">Game</string>
</resources>
| {
"pile_set_name": "Github"
} |
// Test for contact functionality. Although the contact functionality is exposed through the
// regular Titanium Contacts API, this test makes use of some Tizen-specific calls and features,
// therefore it's Tizen-only.
//
// This test verifies contact editing. It is initiated from the "contacts_find" test.
function edit_contact(args) {
var win = Ti.UI.createWindow({
title: args.title
}),
// the contact selected in the "contacts_find" test:
person = Ti.Contacts.getPersonByID(args.contactId),
// stuff related to contact editing UI:
labelLeftPos = 10,
labelWidth = '40%',
height = 30,
top = 10,
inputLeftPos = '45%',
inputWidth = '50%',
address = (person.address.home && (person.address.home.length > 0)) ? person.address.home[0] : {},
email = (person.email.home && (person.email.home.length > 0)) ? person.email.home[0] : '',
phoneNumber = (person.phone.home && (person.phone.home.length > 0)) ? person.phone.home[0] : '';
// Add controls for first name
var firstNameLabel = Ti.UI.createLabel({
left: labelLeftPos,
top: top,
height: height,
width: labelWidth,
textAlign: Ti.UI.TEXT_ALIGNMENT_LEFT,
text: 'First name:'
});
win.add(firstNameLabel);
var firstNameInput = Ti.UI.createTextField({
borderStyle: Ti.UI.INPUT_BORDERSTYLE_ROUNDED,
top: top,
left: inputLeftPos,
width: inputWidth,
height: height,
value: person.firstName || ''
});
win.add(firstNameInput);
top += height + 10;
// Add controls for last name
var lastNameLabel = Ti.UI.createLabel({
left: labelLeftPos,
top: top,
width: labelWidth,
height: height,
textAlign: Ti.UI.TEXT_ALIGNMENT_LEFT,
text: 'Last name:'
});
win.add(lastNameLabel);
var lastNameInput = Ti.UI.createTextField({
borderStyle: Ti.UI.INPUT_BORDERSTYLE_ROUNDED,
top: top,
left: inputLeftPos,
width: inputWidth,
height: height,
value: person.lastName || ''
});
win.add(lastNameInput);
top += height + 10;
// Add controls for email
var emailLabel = Ti.UI.createLabel({
left: labelLeftPos,
top: top,
width: labelWidth,
height: height,
textAlign: Ti.UI.TEXT_ALIGNMENT_LEFT,
text: 'Home email:'
});
win.add(emailLabel);
var emailInput = Ti.UI.createTextField({
borderStyle: Ti.UI.INPUT_BORDERSTYLE_ROUNDED,
top: top,
left: inputLeftPos,
width: inputWidth,
height: height,
keyboardType: Ti.UI.KEYBOARD_EMAIL,
value: email
});
win.add(emailInput);
top += height + 10;
// Add controls for phone number
var phoneNumberLabel = Ti.UI.createLabel({
left: labelLeftPos,
top: top,
width: labelWidth,
height: height,
textAlign: Ti.UI.TEXT_ALIGNMENT_LEFT,
text: 'Home phone number:'
});
win.add(phoneNumberLabel);
var phoneNumberInput = Ti.UI.createTextField({
borderStyle: Ti.UI.INPUT_BORDERSTYLE_ROUNDED,
top: top,
left: inputLeftPos,
width: inputWidth,
height: height,
keyboardType: Ti.UI.KEYBOARD_NUMBER_PAD,
value: phoneNumber
});
win.add(phoneNumberInput);
top += height + 10;
// Add controls for city
var cityLabel = Ti.UI.createLabel({
left: labelLeftPos,
top: top,
width: labelWidth,
height: height,
textAlign: Ti.UI.TEXT_ALIGNMENT_LEFT,
text: 'Home city:'
});
win.add(cityLabel);
var cityInput = Ti.UI.createTextField({
borderStyle: Ti.UI.INPUT_BORDERSTYLE_ROUNDED,
top: top,
left: inputLeftPos,
width: inputWidth,
height: height,
value: address.City || ''
});
win.add(cityInput);
top += height + 10;
// Add controls for street
var streetLabel = Ti.UI.createLabel({
left: labelLeftPos,
top: top,
width: labelWidth,
height: height,
textAlign: Ti.UI.TEXT_ALIGNMENT_LEFT,
text: 'Home street:'
});
win.add(streetLabel);
var streetInput = Ti.UI.createTextField({
borderStyle: Ti.UI.INPUT_BORDERSTYLE_ROUNDED,
top: top,
left: inputLeftPos,
width: inputWidth,
height: height,
value: address.Street || ''
});
win.add(streetInput);
top += height + 10;
// Add controls for ZIP
var zipLabel = Ti.UI.createLabel({
left: labelLeftPos,
top: top,
width: labelWidth,
height: height,
textAlign: Ti.UI.TEXT_ALIGNMENT_LEFT,
text: 'Home ZIP:'
});
win.add(zipLabel);
var zipInput = Ti.UI.createTextField({
borderStyle: Ti.UI.INPUT_BORDERSTYLE_ROUNDED,
top: top,
left: inputLeftPos,
width: inputWidth,
height: height,
value: address.ZIP || '',
keyboardType: Ti.UI.KEYBOARD_NUMBER_PAD
});
win.add(zipInput);
top += height + 20;
var updateButton = Ti.UI.createButton({
title: 'Update contact',
top: top
});
win.add(updateButton);
// Contact updating
updateButton.addEventListener('click', function(e) {
var firstName = firstNameInput.value.trim(),
lastName = lastNameInput.value.trim(),
phoneNumber = phoneNumberInput.value.trim(),
email = emailInput.value.trim(),
city = cityInput.value.trim(),
street = streetInput.value.trim(),
zip = zipInput.value.trim();
if (!(firstName || lastName || email || phoneNumber || city || street || zip)) {
alert('At least one field should not be empty');
return false;
} else {
person.firstName = firstName;
person.lastName = lastName;
if (Object.prototype.toString.call(person.address.home) === '[object Array]') {
person.address.home[0].City = city
person.address.home[0].Street = street;
person.address.home[0].ZIP = zip;
} else {
person.address.home = [{
City: city,
Street: street,
ZIP: zip
}];
}
// If the array was empty, add the first item. Otherwise, overwrite the first item.
(Object.prototype.toString.call(person.email.home) === '[object Array]') ? person.email.home[0] = email : person.email.home = [email];
(Object.prototype.toString.call(person.phone.home) === '[object Array]') ? person.phone.home[0] = phoneNumber : person.phone.home = [phoneNumber];
Ti.Contacts.save([person]);
alert('Contact was updated successfully. Contact ID = ' + person.id);
}
});
return win;
}
module.exports = edit_contact; | {
"pile_set_name": "Github"
} |
const test = require('tape')
const nlp = require('./_lib')
test('reserved words:', function(t) {
const reserved = [
'abstract',
'boolean',
'break',
'byte',
'case',
'catch',
'char',
'class',
'const',
'constructor',
'continue',
'debugger',
'default',
'delete',
'do',
'double',
'else',
'enum',
'export',
'extends',
'false',
'final',
'finally',
'float',
'for',
'function',
'goto',
'if',
'implements',
'import',
'in',
'instanceof',
'int',
'interface',
'let',
'long',
'native',
'new',
'null',
'package',
'private',
'protected',
'prototype',
'public',
'return',
'short',
'static',
'super',
'switch',
'synchronized',
'this',
'throw',
'throws',
'transient',
'true',
'try',
'typeof',
'var',
'void',
'volatile',
'while',
'with',
'yeild',
'__prototype__',
'&&',
'||',
'|',
"'",
'&',
'Math.PI',
12e34,
'#§$%',
'π',
'привет',
// 'hasOwnProperty',
'café',
'$$$',
1e2,
'{}',
'[]',
'constructor',
'prototype',
')&@)^',
' -@%@',
'-constructor',
'#!^@#$',
'..(',
]
const str = reserved.join(' ')
const r = nlp(str)
t.equal(r.out('text'), str, 'reserved-words-are-printed')
t.equal(r.terms().length, reserved.length, 'reserved-length')
t.ok(r.contractions().data(), 'runs contractions subset')
t.ok(r.parentheses().data(), 'runs parentheses subset')
t.ok(r.lists().data(), 'runs lists subset')
t.ok(r.terms().data(), 'runs terms subset')
t.ok(r.pronouns().data(), 'runs pronouns subset')
t.end()
})
test('co-erce reserved words', function(t) {
const r = nlp('constructor prototype')
r.tag('Verb')
t.ok(r.match('#Verb').data(), 'runs tag/match')
r.tag('Adjective')
t.ok(r.match('#Noun').data(), 'runs untag')
t.equal(r.terms().slice(0, 2).length, 2, 'runs slice')
t.ok(r.append('constructor').text(), 'runs append')
t.end()
})
| {
"pile_set_name": "Github"
} |
# contributor: Xah Lee (XahLee.org)
# name: funcall
# key: funcall
# --
(funcall $0) | {
"pile_set_name": "Github"
} |
class RdsCommandLineTools < Formula
desc "Amazon RDS command-line toolkit"
homepage "https://aws.amazon.com/developertools/2928"
url "https://rds-downloads.s3.amazonaws.com/RDSCli-1.19.004.zip"
sha256 "298c15ccd04bd91f1be457645d233455364992e7dd27e09c48230fbc20b5950c"
revision 1
bottle :unneeded
depends_on "openjdk"
def install
env = { JAVA_HOME: Formula["openjdk"].opt_prefix, AWS_RDS_HOME: libexec }
rm Dir["bin/*.cmd"] # Remove Windows versions
etc.install "credential-file-path.template"
libexec.install Dir["*"]
Pathname.glob("#{libexec}/bin/*") do |file|
next if file.directory?
basename = file.basename
next if basename.to_s == "service"
(bin/basename).write_env_script file, env
end
end
def caveats
<<~EOS
Before you can use these tools you must export a variable to your $SHELL.
export AWS_CREDENTIAL_FILE="<Path to the credentials file>"
To check that your setup works properly, run the following command:
rds-describe-db-instances --headers
You should see a header line. If you have database instances already configured,
you will see a description line for each database instance.
EOS
end
test do
assert_match version.to_s, shell_output("#{bin}/rds-version")
end
end
| {
"pile_set_name": "Github"
} |
// Utilities
import {
classToHex,
isCssColor,
parseGradient,
} from '../../util/colorUtils'
import colors from '../../util/colors'
// Types
import { VuetifyThemeVariant } from 'types/services/theme'
import { VNode, VNodeDirective } from 'vue'
interface BorderModifiers {
top?: Boolean
right?: Boolean
bottom?: Boolean
left?: Boolean
}
function setTextColor (
el: HTMLElement,
color: string,
currentTheme: Partial<VuetifyThemeVariant>,
) {
const cssColor = !isCssColor(color) ? classToHex(color, colors, currentTheme) : color
el.style.color = cssColor
el.style.caretColor = cssColor
}
function setBackgroundColor (
el: HTMLElement,
color: string,
currentTheme: Partial<VuetifyThemeVariant>,
) {
const cssColor = !isCssColor(color) ? classToHex(color, colors, currentTheme) : color
el.style.backgroundColor = cssColor
el.style.borderColor = cssColor
}
function setBorderColor (
el: HTMLElement,
color: string,
currentTheme: Partial<VuetifyThemeVariant>,
modifiers?: BorderModifiers,
) {
const cssColor = !isCssColor(color) ? classToHex(color, colors, currentTheme) : color
if (!modifiers || !Object.keys(modifiers).length) {
el.style.borderColor = cssColor
return
}
if (modifiers.top) el.style.borderTopColor = cssColor
if (modifiers.right) el.style.borderRightColor = cssColor
if (modifiers.bottom) el.style.borderBottomColor = cssColor
if (modifiers.left) el.style.borderLeftColor = cssColor
}
function setGradientColor (
el: HTMLElement,
gradient: string,
currentTheme: Partial<VuetifyThemeVariant>,
) {
el.style.backgroundImage = `linear-gradient(${
parseGradient(gradient, colors, currentTheme)
})`
}
function updateColor (
el: HTMLElement,
binding: VNodeDirective,
node: VNode
) {
const currentTheme = node.context!.$vuetify.theme.currentTheme
if (binding.arg === undefined) {
setBackgroundColor(el, binding.value, currentTheme)
} else if (binding.arg === 'text') {
setTextColor(el, binding.value, currentTheme)
} else if (binding.arg === 'border') {
setBorderColor(el, binding.value, currentTheme, binding.modifiers)
} else if (binding.arg === 'gradient') {
setGradientColor(el, binding.value, currentTheme)
}
}
function update (
el: HTMLElement,
binding: VNodeDirective,
node: VNode
) {
if (binding.value === binding.oldValue) return
updateColor(el, binding, node)
}
export const Color = {
bind: updateColor,
update,
}
export default Color
| {
"pile_set_name": "Github"
} |
// RUN: %clang_cc1 -fsyntax-only -verify %s
// expected-no-diagnostics
namespace pr7801 {
extern void* x[];
void* dummy[] = { &x };
}
| {
"pile_set_name": "Github"
} |
/* -----------------------------------------------------------------------------------------------------------
Software License for The Fraunhofer FDK AAC Codec Library for Android
© Copyright 1995 - 2013 Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V.
All rights reserved.
1. INTRODUCTION
The Fraunhofer FDK AAC Codec Library for Android ("FDK AAC Codec") is software that implements
the MPEG Advanced Audio Coding ("AAC") encoding and decoding scheme for digital audio.
This FDK AAC Codec software is intended to be used on a wide variety of Android devices.
AAC's HE-AAC and HE-AAC v2 versions are regarded as today's most efficient general perceptual
audio codecs. AAC-ELD is considered the best-performing full-bandwidth communications codec by
independent studies and is widely deployed. AAC has been standardized by ISO and IEC as part
of the MPEG specifications.
Patent licenses for necessary patent claims for the FDK AAC Codec (including those of Fraunhofer)
may be obtained through Via Licensing (www.vialicensing.com) or through the respective patent owners
individually for the purpose of encoding or decoding bit streams in products that are compliant with
the ISO/IEC MPEG audio standards. Please note that most manufacturers of Android devices already license
these patent claims through Via Licensing or directly from the patent owners, and therefore FDK AAC Codec
software may already be covered under those patent licenses when it is used for those licensed purposes only.
Commercially-licensed AAC software libraries, including floating-point versions with enhanced sound quality,
are also available from Fraunhofer. Users are encouraged to check the Fraunhofer website for additional
applications information and documentation.
2. COPYRIGHT LICENSE
Redistribution and use in source and binary forms, with or without modification, are permitted without
payment of copyright license fees provided that you satisfy the following conditions:
You must retain the complete text of this software license in redistributions of the FDK AAC Codec or
your modifications thereto in source code form.
You must retain the complete text of this software license in the documentation and/or other materials
provided with redistributions of the FDK AAC Codec or your modifications thereto in binary form.
You must make available free of charge copies of the complete source code of the FDK AAC Codec and your
modifications thereto to recipients of copies in binary form.
The name of Fraunhofer may not be used to endorse or promote products derived from this library without
prior written permission.
You may not charge copyright license fees for anyone to use, copy or distribute the FDK AAC Codec
software or your modifications thereto.
Your modified versions of the FDK AAC Codec must carry prominent notices stating that you changed the software
and the date of any change. For modified versions of the FDK AAC Codec, the term
"Fraunhofer FDK AAC Codec Library for Android" must be replaced by the term
"Third-Party Modified Version of the Fraunhofer FDK AAC Codec Library for Android."
3. NO PATENT LICENSE
NO EXPRESS OR IMPLIED LICENSES TO ANY PATENT CLAIMS, including without limitation the patents of Fraunhofer,
ARE GRANTED BY THIS SOFTWARE LICENSE. Fraunhofer provides no warranty of patent non-infringement with
respect to this software.
You may use this FDK AAC Codec software or modifications thereto only for purposes that are authorized
by appropriate patent licenses.
4. DISCLAIMER
This FDK AAC Codec software is provided by Fraunhofer on behalf of the copyright holders and contributors
"AS IS" and WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, including but not limited to the implied warranties
of merchantability and fitness for a particular purpose. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
CONTRIBUTORS BE LIABLE for any direct, indirect, incidental, special, exemplary, or consequential damages,
including but not limited to procurement of substitute goods or services; loss of use, data, or profits,
or business interruption, however caused and on any theory of liability, whether in contract, strict
liability, or tort (including negligence), arising in any way out of the use of this software, even if
advised of the possibility of such damage.
5. CONTACT INFORMATION
Fraunhofer Institute for Integrated Circuits IIS
Attention: Audio and Multimedia Departments - FDK AAC LL
Am Wolfsmantel 33
91058 Erlangen, Germany
www.iis.fraunhofer.de/amm
[email protected]
----------------------------------------------------------------------------------------------------------- */
/*************************** Fraunhofer IIS FDK Tools **********************
Author(s):
Description: fixed point intrinsics
******************************************************************************/
#if defined(__GNUC__) && defined(__mips__)
//#define FUNCTION_cplxMultDiv2_32x16
//#define FUNCTION_cplxMultDiv2_32x16X2
#define FUNCTION_cplxMultDiv2_32x32X2
//#define FUNCTION_cplxMult_32x16
//#define FUNCTION_cplxMult_32x16X2
#define FUNCTION_cplxMult_32x32X2
#if defined(FUNCTION_cplxMultDiv2_32x32X2)
inline void cplxMultDiv2( FIXP_DBL *c_Re,
FIXP_DBL *c_Im,
FIXP_DBL a_Re,
FIXP_DBL a_Im,
FIXP_DBL b_Re,
FIXP_DBL b_Im)
{
*c_Re = (((long long)a_Re * (long long)b_Re) - ((long long)a_Im * (long long)b_Im))>>32;
*c_Im = (((long long)a_Re * (long long)b_Im) + ((long long)a_Im * (long long)b_Re))>>32;
}
#endif
#if defined(FUNCTION_cplxMult_32x32X2)
inline void cplxMult( FIXP_DBL *c_Re,
FIXP_DBL *c_Im,
FIXP_DBL a_Re,
FIXP_DBL a_Im,
FIXP_DBL b_Re,
FIXP_DBL b_Im)
{
*c_Re = ((((long long)a_Re * (long long)b_Re) - ((long long)a_Im * (long long)b_Im))>>32)<<1;
*c_Im = ((((long long)a_Re * (long long)b_Im) + ((long long)a_Im * (long long)b_Re))>>32)<<1;
}
#endif
#endif /* defined(__GNUC__) && defined(__mips__) */
| {
"pile_set_name": "Github"
} |
/*
* Created by Angel Leon (@gubatron), Alden Torres (aldenml),
* Marcelina Knitter (@marcelinkaaa)
* Copyright (c) 2011-2016, FrostWire(R). All rights reserved.
*
* 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.
*/
package com.frostwire.android.gui.views;
import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.frostwire.android.R;
import java.util.Random;
/**
* @author gubatron
* @author aldenml
*
*/
public class AdMenuItemView extends RelativeLayout {
public AdMenuItemView(Context context, AttributeSet set) {
super(context, set);
}
@Override
protected void onFinishInflate() {
super.onFinishInflate();
View.inflate(getContext(), R.layout.view_ad_menuitem, this);
TextView textHeadline = findViewById(R.id.view_ad_menu_item_headline);
TextView textSubtitle = findViewById(R.id.view_ad_menu_item_subtitle);
TextView textThumbnail = findViewById(R.id.view_ad_menu_item_thumbnail);
ImageView imageThumbnail = findViewById(R.id.view_ad_menu_item_thumbnail_image);
textHeadline.setText(R.string.support_frostwire);
Random myRand = new Random();
boolean isEven = (myRand.nextInt() % 2) == 0;
if (isEven) {
textSubtitle.setText(R.string.save_bandwidth);
textThumbnail.setVisibility(VISIBLE);
textThumbnail.setText(R.string.ad_free);
} else {
textSubtitle.setText(R.string.remove_ads);
imageThumbnail.setVisibility(VISIBLE);
imageThumbnail.setImageResource(R.drawable.ad_menu_speaker);
}
}
}
| {
"pile_set_name": "Github"
} |
SUMMARY = "Hardware drivers for ${MACHINE}"
SECTION = "base"
PRIORITY = "required"
LICENSE = "CLOSED"
PACKAGE_ARCH = "${MACHINEBUILD}"
require conf/license/license-close.inc
KV = "3.14.2"
SRCDATE = "20160122"
PV = "${KV}+${SRCDATE}"
PR = "r1"
SRC_URI[md5sum] = "a0bbd2b0a26d750e89972364e52fa4e9"
SRC_URI[sha256sum] = "80997180ab4092afbbefe1e42914ff1c66fe9de861789e9c4b86027dbddb840e"
SRC_URI = "http://source.mynonpublic.com/ini/yhgd5034-drivers-${KV}-${SRCDATE}.zip"
S = "${WORKDIR}"
INHIBIT_PACKAGE_STRIP = "1"
do_compile() {
}
do_populate_sysroot() {
}
do_install() {
install -d ${D}/lib/modules/${KV}/extra
install -d ${D}/${sysconfdir}/modules-load.d
for i in dvb; do
install -m 0755 ${WORKDIR}/$i.ko ${D}/lib/modules/${KV}/extra/$i.ko
echo $i >> ${D}/${sysconfdir}/modules-load.d/_${MACHINEBUILD}.conf
done
}
FILES_${PN} += "${sysconfdir}/modules-load.d/_${MACHINEBUILD}.conf /lib/modules/${KV}/extra"
| {
"pile_set_name": "Github"
} |
.. _developer:
Developer Guide
===================
Creating a service class (REST case)
--------------------------------------------------
.. warning:: since version 1.3.0, RESTService is deprecated and REST should be
used. The changes should be easy: get method is now called http_get and
requestPost is now http_post.
You can test directly a SOAP/WSDL or REST service in a few lines. For instance,
to access to the biomart REST service, type::
>>> s = REST("BioMart" ,"http://www.biomart.org/biomart/martservice")
The first parameter is compulsary but can be any word. You can retrieve the base
URL by typing::
>>> s.url
'http://www.biomart.org/biomart/martservice'
and then send a request to retrieve registry information for instance (see
www.biomart.org.martservice.html for valid request::
>>> s.http_get("?type=registry")
<bioservices.xmltools.easyXML at 0x3b7a4d0>
The request method available from RESTService class concatenates the url and the
parameter provided so it request the "http://www.biomart.org.biomart/martservice" URL.
As a developer, you should ease the life of the user by wrapping up the previous
commands. An example of a BioMart class with a unique method dedicated to the
registry would look like::
>>> class BioMart(REST):
... def __init__(self):
... url = "http://www.biomart.org/biomart/martservice"
... super(BioMart, self).__init__("BioMart", url=url)
... def registry(self):
... ret = self.request("?type=registry")
... return ret
and you would use it as follows::
>>> s = BioMart()
>>> s.registry()
<bioservices.xmltools.easyXML at 0x3b7a4d0>
Creating a service class (WSDL case)
-----------------------------------------------
If a web service interface is not provided within bioservices, you can still
easily access its functionalities. As an example, let us look at the
`Ontology Lookup service <http://www.ebi.ac.uk/ontology-lookup/WSDLDocumentation.do>`_, which provides a
WSDL service. In order to easily access this service, use the :class:`WSDLService` class as follows::
>>> from bioservices import WSDLService
>>> ols = WSDLService("OLS", "http://www.ebi.ac.uk/ontology-lookup/OntologyQuery.wsdl")
You can now see which methods are available::
>>> ols.wsdl_methods
and call one (getVersion) using the :meth:`bioservices.services.WSDLService.serv`::
>>> ols.serv.getVersion()
You can then look at something more complex and extract relevant information::
>>> [x.value for x in ols.serv.getOntologyNames()[0]]
Of course, you can add new methods to ease the access to any functionalities::
>>> ols.getOnlogyNames() # returns the values
Similarly to the previous case using REST, you can wrap this example into a
proper class.
Others
========
When wrapper a WSDL services, it may be difficult to know what parameters
to provide if the API doc is not clear. This can be known as follows using
the **suds** factory. In this previous examples, we could use::
>>> ols.suds.factory.resolver.find('getTermById')
<Element:0xa848b50 name="getTermById" />
For eutils, this was more difficult::
m1 = list(e.suds.wsdl.services[0].ports[0].methods.values())[2]
m1.soap.input.body.parts[0]
the service is in m1.soap.input.body.parts[0] check for the element in the
root attribute
suds and client auth
=======================
http://stackoverflow.com/questions/6277027/suds-over-https-with-cert
| {
"pile_set_name": "Github"
} |
{
"images" : [
{
"idiom" : "universal"
},
{
"idiom" : "universal",
"scale" : "1x",
"filename" : "increment_highlighted_1x.png"
},
{
"idiom" : "universal",
"scale" : "2x",
"filename" : "increment_highlighted_2x.png"
},
{
"idiom" : "universal",
"scale" : "3x",
"filename" : "stepper_increment_highlighted_3x.png"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
} | {
"pile_set_name": "Github"
} |
#!/bin/sh
#
## Copyright (C) 2020 The Squid Software Foundation and contributors
##
## Squid software is distributed under GPLv2+ license and includes
## contributions from numerous individuals and organizations.
## Please see the COPYING and CONTRIBUTORS files for details.
##
#
# This script uses codespell to automatically fix a subset of common spelling
# mistakes in the current git-controlled workspace.
#
# Usage: ./scripts/spell-check.sh [target]...
# ... where "target" is a git-controlled file or directory name to be fixed.
#
# By default, a hand-picked subset of Squid repository sources is fixed.
#
# See ${WHITE_LIST} below for the list of allowed misspellings.
#
set -e
echo -n "Codespell version: "
if ! codespell --version; then
echo "This script requires codespell which was not found."
exit 1
fi
if ! git diff --quiet; then
echo "There are unstaged changes. This script may modify sources."
echo "Stage changes to avoid permanent losses when things go bad."
exit 1
fi
WHITE_LIST=scripts/codespell-whitelist.txt
if test ! -f "${WHITE_LIST}"; then
echo "${WHITE_LIST} does not exist"
exit 1
fi
for FILENAME in `git ls-files "$@"`; do
# skip subdirectories, git ls-files is recursive
test -d $FILENAME && continue
case ${FILENAME} in
# skip (some) generated files with otherwise-checked extensions
doc/debug-sections.txt)
;;
# skip imported/foreign files with otherwise-checked extensions
doc/*/*.txt)
;;
# check all these
*.h|*.c|*.cc|*.cci|\
*.sh|\
*.pre|\
*.pl|*.pl.in|*.pm|\
*.dox|*.html|*.md|*.txt|\
*.sql|\
errors/templates/ERR_*|\
INSTALL|README|QUICKSTART)
if ! codespell -d -q 3 -w -I "${WHITE_LIST}" ${FILENAME}; then
echo "codespell failed for ${FILENAME}"
exit 1
fi
;;
esac
done
exit 0
| {
"pile_set_name": "Github"
} |
[Desktop Entry]
Type=Application
Exec=@SHORTPRODUCTNAME@
Name=Robomongo
GenericName=MongoDB management tool
Icon=@ICONNAME@
Terminal=false
Categories=Development;IDE;mongodb;
| {
"pile_set_name": "Github"
} |
{
"name": "zikula/foomodule-module",
"version": "2.0.0-beta",
"description": "A foo module.",
"type": "zikula-module",
"license": ["MIT", "LGPL"],
"authors": [
{
"name": "Zikula Team",
"homepage": "https://ziku.la/",
"email": "[email protected]",
"role": "lead"
},
{
"name": "Zikula B Team",
"homepage": "https://ziku.la/",
"email": "[email protected]",
"role": "minion"
}
],
"autoload": {
"psr-4": { "Zikula\\FooModule\\": "" }
},
"require": {
"php": ">=7.2.5"
},
"require-dev": {
"phpunit/phpunit": "~4.5"
},
"suggest": {
"barmodule": "~1.0"
},
"extra": {
"zikula": {
"core-compatibility": ">=1.4.2",
"class": "Zikula\\FooModule\\ZikulaFooModule",
"displayname": "FooModule",
"url": "foo",
"oldnames": ["food"],
"icon": "fas fa-database",
"capabilities": {
"admin": {
"route": "zikulafoomodule_bar_index"
},
"user": {
"route": "zikulafoomodule_foo_index"
}
},
"securityschema": {
"ZikulaFooModule::": "::"
}
}
}
}
| {
"pile_set_name": "Github"
} |
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ERP5 Form" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_objects</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>action</string> </key>
<value> <string>Base_edit</string> </value>
</item>
<item>
<key> <string>encoding</string> </key>
<value> <string>UTF-8</string> </value>
</item>
<item>
<key> <string>enctype</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>group_list</string> </key>
<value>
<list>
<string>webcontent header bottom</string>
<string>bottom</string>
</list>
</value>
</item>
<item>
<key> <string>groups</string> </key>
<value>
<dictionary>
<item>
<key> <string>bottom</string> </key>
<value>
<list>
<string>iframe_content</string>
<string>text_content</string>
</list>
</value>
</item>
<item>
<key> <string>webcontent header bottom</string> </key>
<value>
<list/>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>WebPage_viewAsWeb</string> </value>
</item>
<item>
<key> <string>method</string> </key>
<value> <string>POST</string> </value>
</item>
<item>
<key> <string>name</string> </key>
<value> <string>WebPage_view</string> </value>
</item>
<item>
<key> <string>pt</string> </key>
<value> <string>form_view</string> </value>
</item>
<item>
<key> <string>row_length</string> </key>
<value> <int>4</int> </value>
</item>
<item>
<key> <string>stored_encoding</string> </key>
<value> <string>UTF-8</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Web Page</string> </value>
</item>
<item>
<key> <string>unicode_mode</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>update_action</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
| {
"pile_set_name": "Github"
} |
<div class="blade-static __bottom" ng-include="'$(Platform)/Scripts/common/templates/ok-cancel.tpl.html'"></div>
<div class="blade-content">
<div class="blade-inner">
<div class="inner-block">
<div class="sub-t">{{ 'platform.blades.account-roles.labels.select-roles' | translate }}</div>
<div class="table-wrapper">
<table class="table">
<tbody>
<tr class="table-item" ng-repeat="data in blade.currentEntities track by data.id" ng-class="{'__selected': data.id === selectedNodeId}">
<td class="table-col">
<label class="form-control __checkbox">
<input type="checkbox" ng-model="data.$selected">
<span class="check"></span>
</label>
</td>
<td class="table-col" ng-click='blade.selectNode(data)'>
<span class="table-t">{{data.name}}</span>
<span class="table-descr">{{data.description}}</span>
</td>
</tr>
</tbody>
</table>
</div>
<p class="note" ng-if="!blade.currentEntities.length">{{ 'platform.blades.account-roles.labels.no-roles' | translate }}</p>
</div>
</div>
</div> | {
"pile_set_name": "Github"
} |
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.
| {
"pile_set_name": "Github"
} |
/*
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* See the COPYRIGHT file distributed with this work for additional
* information regarding copyright ownership.
*/
acl rfc1918 { 10/8; 192.168/16; 172.16/12; };
options {
query-source address 10.53.0.3;
notify-source 10.53.0.3;
transfer-source 10.53.0.3;
port @PORT@;
pid-file "named.pid";
listen-on { 10.53.0.3; };
listen-on-v6 { none; };
allow-recursion { 10.53.0.3; };
notify yes;
dnssec-validation yes;
};
zone "." {
type primary;
file "root.db";
};
zone "example" {
type primary;
file "example.db";
};
zone "signed" {
type primary;
file "signed.db.signed";
};
zone "nsec3" {
type primary;
file "nsec3.db.signed";
};
zone "redirect" {
type primary;
file "redirect.db";
};
// include "trusted.conf";
| {
"pile_set_name": "Github"
} |
## This file is a PO Template file.
##
## `msgid`s here are often extracted from source code.
## Add new translations manually only if they're dynamic
## translations that can't be statically extracted.
##
## Run `mix gettext.extract` to bring this file up to
## date. Leave `msgstr`s empty as changing them here as no
## effect: edit them in PO (`.po`) files instead.
msgid ""
msgstr ""
"Language: fr\n"
#: lib/l10n/translator.ex:192
msgid "Fri"
msgstr "ven."
#: lib/l10n/translator.ex:200
msgid "Friday"
msgstr "vendredi"
#: lib/l10n/translator.ex:188
msgid "Mon"
msgstr "lun."
#: lib/l10n/translator.ex:196
msgid "Monday"
msgstr "lundi"
#: lib/l10n/translator.ex:193
msgid "Sat"
msgstr "sam."
#: lib/l10n/translator.ex:201
msgid "Saturday"
msgstr "samedi"
#: lib/l10n/translator.ex:194
msgid "Sun"
msgstr "dim."
#: lib/l10n/translator.ex:202
msgid "Sunday"
msgstr "dimanche"
#: lib/l10n/translator.ex:191
msgid "Thu"
msgstr "jeu."
#: lib/l10n/translator.ex:199
msgid "Thursday"
msgstr "jeudi"
#: lib/l10n/translator.ex:189
msgid "Tue"
msgstr "mar."
#: lib/l10n/translator.ex:197
msgid "Tuesday"
msgstr "mardi"
#: lib/l10n/translator.ex:190
msgid "Wed"
msgstr "mer."
#: lib/l10n/translator.ex:198
msgid "Wednesday"
msgstr "mercredi"
| {
"pile_set_name": "Github"
} |
HTTP/1.1 100 Continue
HTTP/1.1 200 OK
Server: nginx/1.1.19
Date: Fri, 11 Aug 2017 13:22:00 GMT
Content-Type: image/jpeg
Content-Length: 62574
Connection: close
Cache-Control: max-age=7257600
Expires: Fri, 03 Nov 2017 13:22:00 GMT
Strict-Transport-Security: max-age=31536000; includeSubDomains
X-Frame-Option: DENY
| {
"pile_set_name": "Github"
} |
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>Set and unset dir="auto"</title>
<style>
textarea { resize: none; }
</style>
</head>
<body>
<div><input type="text" value="ABC אבג" dir="ltr"></div>
<div><span dir="ltr">ABC אבג</span></div>
<div><textarea dir="ltr">ABC אבג</textarea></div>
<div><button dir="ltr">ABC אבג</button></div>
<div><span dir="ltr">ABC אבג</span></div>
</body>
</html>
| {
"pile_set_name": "Github"
} |
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=333673
-->
<head>
<title>Test for Bug 333673</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=333673">Mozilla Bug 333673</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
<script type="application/javascript">
/** Test for Bug 333673 **/
is(document.implementation, document.implementation,
"document.implementation should be the same object all the time.");
</script>
</pre>
</body>
</html>
| {
"pile_set_name": "Github"
} |
[default]
help = Compile with GNU gfortran
compiler = Gnu
cflags = -c
mod_dir = ./mod/
obj_dir = ./obj/
build_dir = ./build/
src = ./src/
vlibs = ./lib/first_dep.a
include = ./lib/
colors = True
quiet = False
target = cumbersome.f90
output = Cumbersome
[rule-triggering]
quiet = False
rule-1 = rm -f ./lib/first_dep.a
rule-2 = cp ./lib/first_dep.a.1 ./lib/first_dep.a
rule-3 = FoBiS.py build > /dev/null
rule-4 = rm -f ./lib/first_dep.a
rule-5 = cp ./lib/first_dep.a.2 ./lib/first_dep.a
rule-6 = FoBiS.py build
| {
"pile_set_name": "Github"
} |
<?php
final class PhabricatorConfigRemarkupRule
extends PhutilRemarkupRule {
public function apply($text) {
return preg_replace_callback(
'(@{config:([^}]+)})',
array($this, 'markupConfig'),
$text);
}
public function getPriority() {
// We're reusing the Diviner atom syntax, so make sure we evaluate before
// the Diviner rule evaluates.
return id(new DivinerSymbolRemarkupRule())->getPriority() - 1;
}
public function markupConfig(array $matches) {
if (!$this->isFlatText($matches[0])) {
return $matches[0];
}
$config_key = $matches[1];
try {
$option = PhabricatorEnv::getEnvConfig($config_key);
} catch (Exception $ex) {
return $matches[0];
}
$is_text = $this->getEngine()->isTextMode();
$is_html_mail = $this->getEngine()->isHTMLMailMode();
if ($is_text || $is_html_mail) {
return pht('"%s"', $config_key);
}
$link = phutil_tag(
'a',
array(
'href' => urisprintf('/config/edit/%s/', $config_key),
'target' => '_blank',
),
$config_key);
return $this->getEngine()->storeText($link);
}
}
| {
"pile_set_name": "Github"
} |
//========= Copyright © 1996-2008, Valve LLC, All rights reserved. ============
//
// Purpose:
//
//=============================================================================
#ifndef STEAMCLIENTPUBLIC_H
#define STEAMCLIENTPUBLIC_H
#ifdef _WIN32
#pragma once
#endif
//lint -save -e1931 -e1927 -e1924 -e613 -e726
// This header file defines the interface between the calling application and the code that
// knows how to communicate with the connection manager (CM) from the Steam service
// This header file is intended to be portable; ideally this 1 header file plus a lib or dll
// is all you need to integrate the client library into some other tree. So please avoid
// including or requiring other header files if possible. This header should only describe the
// interface layer, no need to include anything about the implementation.
#include "steamtypes.h"
// General result codes
enum EResult
{
k_EResultOK = 1, // success
k_EResultFail = 2, // generic failure
k_EResultNoConnection = 3, // no/failed network connection
// k_EResultNoConnectionRetry = 4, // OBSOLETE - removed
k_EResultInvalidPassword = 5, // password/ticket is invalid
k_EResultLoggedInElsewhere = 6, // same user logged in elsewhere
k_EResultInvalidProtocolVer = 7, // protocol version is incorrect
k_EResultInvalidParam = 8, // a parameter is incorrect
k_EResultFileNotFound = 9, // file was not found
k_EResultBusy = 10, // called method busy - action not taken
k_EResultInvalidState = 11, // called object was in an invalid state
k_EResultInvalidName = 12, // name is invalid
k_EResultInvalidEmail = 13, // email is invalid
k_EResultDuplicateName = 14, // name is not unique
k_EResultAccessDenied = 15, // access is denied
k_EResultTimeout = 16, // operation timed out
k_EResultBanned = 17, // VAC2 banned
k_EResultAccountNotFound = 18, // account not found
k_EResultInvalidSteamID = 19, // steamID is invalid
k_EResultServiceUnavailable = 20, // The requested service is currently unavailable
k_EResultNotLoggedOn = 21, // The user is not logged on
k_EResultPending = 22, // Request is pending (may be in process, or waiting on third party)
k_EResultEncryptionFailure = 23, // Encryption or Decryption failed
k_EResultInsufficientPrivilege = 24, // Insufficient privilege
k_EResultLimitExceeded = 25, // Too much of a good thing
k_EResultRevoked = 26, // Access has been revoked (used for revoked guest passes)
k_EResultExpired = 27, // License/Guest pass the user is trying to access is expired
k_EResultAlreadyRedeemed = 28, // Guest pass has already been redeemed by account, cannot be acked again
k_EResultDuplicateRequest = 29, // The request is a duplicate and the action has already occurred in the past, ignored this time
k_EResultAlreadyOwned = 30, // All the games in this guest pass redemption request are already owned by the user
k_EResultIPNotFound = 31, // IP address not found
k_EResultPersistFailed = 32, // failed to write change to the data store
k_EResultLockingFailed = 33, // failed to acquire access lock for this operation
k_EResultLogonSessionReplaced = 34,
k_EResultConnectFailed = 35,
k_EResultHandshakeFailed = 36,
k_EResultIOFailure = 37,
k_EResultRemoteDisconnect = 38,
k_EResultShoppingCartNotFound = 39, // failed to find the shopping cart requested
k_EResultBlocked = 40, // a user didn't allow it
k_EResultIgnored = 41, // target is ignoring sender
};
// Result codes to GSHandleClientDeny/Kick
typedef enum
{
k_EDenyInvalidVersion = 1,
k_EDenyGeneric = 2,
k_EDenyNotLoggedOn = 3,
k_EDenyNoLicense = 4,
k_EDenyCheater = 5,
k_EDenyLoggedInElseWhere = 6,
k_EDenyUnknownText = 7,
k_EDenyIncompatibleAnticheat = 8,
k_EDenyMemoryCorruption = 9,
k_EDenyIncompatibleSoftware = 10,
k_EDenySteamConnectionLost = 11,
k_EDenySteamConnectionError = 12,
k_EDenySteamResponseTimedOut = 13,
k_EDenySteamValidationStalled = 14,
} EDenyReason;
// Steam universes. Each universe is a self-contained Steam instance.
enum EUniverse
{
k_EUniverseInvalid = 0,
k_EUniversePublic = 1,
k_EUniverseBeta = 2,
k_EUniverseInternal = 3,
k_EUniverseDev = 4,
k_EUniverseRC = 5,
k_EUniverseMax
};
// Steam account types
enum EAccountType
{
k_EAccountTypeInvalid = 0,
k_EAccountTypeIndividual = 1, // single user account
k_EAccountTypeMultiseat = 2, // multiseat (e.g. cybercafe) account
k_EAccountTypeGameServer = 3, // game server account
k_EAccountTypeAnonGameServer = 4, // anonymous game server account
k_EAccountTypePending = 5, // pending
k_EAccountTypeContentServer = 6, // content server
k_EAccountTypeClan = 7,
k_EAccountTypeChat = 8,
k_EAccountTypeP2PSuperSeeder = 9, // a fake steamid used by superpeers to seed content to users of Steam P2P stuff
k_EAccountTypeAnonUser = 10,
// Max of 16 items in this field
k_EAccountTypeMax
};
//-----------------------------------------------------------------------------
// types of user game stats fields
// WARNING: DO NOT RENUMBER EXISTING VALUES - STORED IN DATABASE
//-----------------------------------------------------------------------------
enum ESteamUserStatType
{
k_ESteamUserStatTypeINVALID = 0,
k_ESteamUserStatTypeINT = 1,
k_ESteamUserStatTypeFLOAT = 2,
// Read as FLOAT, set with count / session length
k_ESteamUserStatTypeAVGRATE = 3,
k_ESteamUserStatTypeACHIEVEMENTS = 4,
k_ESteamUserStatTypeGROUPACHIEVEMENTS = 5,
};
//-----------------------------------------------------------------------------
// Purpose: Chat Entry Types (previously was only friend-to-friend message types)
//-----------------------------------------------------------------------------
enum EChatEntryType
{
k_EChatEntryTypeChatMsg = 1, // Normal text message from another user
k_EChatEntryTypeTyping = 2, // Another user is typing (not used in multi-user chat)
k_EChatEntryTypeInviteGame = 3, // Invite from other user into that users current game
k_EChatEntryTypeEmote = 4, // text emote message
k_EChatEntryTypeLobbyGameStart = 5, // lobby game is starting
// Above are previous FriendMsgType entries, now merged into more generic chat entry types
};
//-----------------------------------------------------------------------------
// Purpose: Chat Room Enter Responses
//-----------------------------------------------------------------------------
enum EChatRoomEnterResponse
{
k_EChatRoomEnterResponseSuccess = 1, // Success
k_EChatRoomEnterResponseDoesntExist = 2, // Chat doesn't exist (probably closed)
k_EChatRoomEnterResponseNotAllowed = 3, // General Denied - You don't have the permissions needed to join the chat
k_EChatRoomEnterResponseFull = 4, // Chat room has reached its maximum size
k_EChatRoomEnterResponseError = 5, // Unexpected Error
k_EChatRoomEnterResponseBanned = 6, // You are banned from this chat room and may not join
};
typedef void (*PFNLegacyKeyRegistration)( const char *pchCDKey, const char *pchInstallPath );
typedef bool (*PFNLegacyKeyInstalled)();
#pragma pack( push, 1 )
// Steam ID structure (64 bits total)
class CSteamID
{
public:
//-----------------------------------------------------------------------------
// Purpose: Constructor
//-----------------------------------------------------------------------------
CSteamID()
{
m_unAccountID = 0;
m_EAccountType = k_EAccountTypeInvalid;
m_EUniverse = k_EUniverseInvalid;
m_unAccountInstance = 0;
}
//-----------------------------------------------------------------------------
// Purpose: Constructor
// Input : unAccountID - 32-bit account ID
// eUniverse - Universe this account belongs to
// eAccountType - Type of account
//-----------------------------------------------------------------------------
CSteamID( uint32 unAccountID, EUniverse eUniverse, EAccountType eAccountType )
{
Set( unAccountID, eUniverse, eAccountType );
}
//-----------------------------------------------------------------------------
// Purpose: Constructor
// Input : unAccountID - 32-bit account ID
// unAccountInstance - instance
// eUniverse - Universe this account belongs to
// eAccountType - Type of account
//-----------------------------------------------------------------------------
CSteamID( uint32 unAccountID, unsigned int unAccountInstance, EUniverse eUniverse, EAccountType eAccountType )
{
#if defined(_SERVER) && defined(Assert)
Assert( ! ( ( k_EAccountTypeIndividual == eAccountType ) && ( 1 != unAccountInstance ) ) ); // enforce that for individual accounts, instance is always 1
#endif // _SERVER
InstancedSet( unAccountID, unAccountInstance, eUniverse, eAccountType );
}
//-----------------------------------------------------------------------------
// Purpose: Constructor
// Input : ulSteamID - 64-bit representation of a Steam ID
// Note: Will not accept a uint32 or int32 as input, as that is a probable mistake.
// See the stubbed out overloads in the private: section for more info.
//-----------------------------------------------------------------------------
CSteamID( uint64 ulSteamID )
{
SetFromUint64( ulSteamID );
}
//-----------------------------------------------------------------------------
// Purpose: Sets parameters for steam ID
// Input : unAccountID - 32-bit account ID
// eUniverse - Universe this account belongs to
// eAccountType - Type of account
//-----------------------------------------------------------------------------
void Set( uint32 unAccountID, EUniverse eUniverse, EAccountType eAccountType )
{
m_unAccountID = unAccountID;
m_EUniverse = eUniverse;
m_EAccountType = eAccountType;
m_unAccountInstance = 1;
}
//-----------------------------------------------------------------------------
// Purpose: Sets parameters for steam ID
// Input : unAccountID - 32-bit account ID
// eUniverse - Universe this account belongs to
// eAccountType - Type of account
//-----------------------------------------------------------------------------
void InstancedSet( uint32 unAccountID, uint32 unInstance, EUniverse eUniverse, EAccountType eAccountType )
{
m_unAccountID = unAccountID;
m_EUniverse = eUniverse;
m_EAccountType = eAccountType;
m_unAccountInstance = unInstance;
}
//-----------------------------------------------------------------------------
// Purpose: Initializes a steam ID from its 52 bit parts and universe/type
// Input : ulIdentifier - 52 bits of goodness
//-----------------------------------------------------------------------------
void FullSet( uint64 ulIdentifier, EUniverse eUniverse, EAccountType eAccountType )
{
m_unAccountID = ( ulIdentifier & 0xFFFFFFFF ); // account ID is low 32 bits
m_unAccountInstance = ( ( ulIdentifier >> 32 ) & 0xFFFFF ); // account instance is next 20 bits
m_EUniverse = eUniverse;
m_EAccountType = eAccountType;
}
//-----------------------------------------------------------------------------
// Purpose: Initializes a steam ID from its 64-bit representation
// Input : ulSteamID - 64-bit representation of a Steam ID
//-----------------------------------------------------------------------------
void SetFromUint64( uint64 ulSteamID )
{
m_unAccountID = ( ulSteamID & 0xFFFFFFFF ); // account ID is low 32 bits
m_unAccountInstance = ( ( ulSteamID >> 32 ) & 0xFFFFF ); // account instance is next 20 bits
m_EAccountType = ( EAccountType ) ( ( ulSteamID >> 52 ) & 0xF ); // type is next 4 bits
m_EUniverse = ( EUniverse ) ( ( ulSteamID >> 56 ) & 0xFF ); // universe is next 8 bits
}
#if defined( INCLUDED_STEAM_COMMON_STEAMCOMMON_H )
//-----------------------------------------------------------------------------
// Purpose: Initializes a steam ID from a Steam2 ID structure
// Input: pTSteamGlobalUserID - Steam2 ID to convert
// eUniverse - universe this ID belongs to
//-----------------------------------------------------------------------------
void SetFromSteam2( TSteamGlobalUserID *pTSteamGlobalUserID, EUniverse eUniverse )
{
m_unAccountID = pTSteamGlobalUserID->m_SteamLocalUserID.Split.Low32bits * 2 +
pTSteamGlobalUserID->m_SteamLocalUserID.Split.High32bits;
m_EUniverse = eUniverse; // set the universe
m_EAccountType = k_EAccountTypeIndividual; // Steam 2 accounts always map to account type of individual
m_unAccountInstance = 1; // individual accounts always have an account instance ID of 1
}
//-----------------------------------------------------------------------------
// Purpose: Fills out a Steam2 ID structure
// Input: pTSteamGlobalUserID - Steam2 ID to write to
//-----------------------------------------------------------------------------
void ConvertToSteam2( TSteamGlobalUserID *pTSteamGlobalUserID ) const
{
// only individual accounts have any meaning in Steam 2, only they can be mapped
// Assert( m_EAccountType == k_EAccountTypeIndividual );
pTSteamGlobalUserID->m_SteamInstanceID = 0;
pTSteamGlobalUserID->m_SteamLocalUserID.Split.High32bits = m_unAccountID % 2;
pTSteamGlobalUserID->m_SteamLocalUserID.Split.Low32bits = m_unAccountID / 2;
}
#endif // defined( INCLUDED_STEAM_COMMON_STEAMCOMMON_H )
//-----------------------------------------------------------------------------
// Purpose: Converts steam ID to its 64-bit representation
// Output : 64-bit representation of a Steam ID
//-----------------------------------------------------------------------------
uint64 ConvertToUint64() const
{
return (uint64) ( ( ( (uint64) m_EUniverse ) << 56 ) + ( ( (uint64) m_EAccountType ) << 52 ) +
( ( (uint64) m_unAccountInstance ) << 32 ) + m_unAccountID );
}
//-----------------------------------------------------------------------------
// Purpose: Converts the static parts of a steam ID to a 64-bit representation.
// For multiseat accounts, all instances of that account will have the
// same static account key, so they can be grouped together by the static
// account key.
// Output : 64-bit static account key
//-----------------------------------------------------------------------------
uint64 GetStaticAccountKey() const
{
// note we do NOT include the account instance (which is a dynamic property) in the static account key
return (uint64) ( ( ( (uint64) m_EUniverse ) << 56 ) + ((uint64) m_EAccountType << 52 ) + m_unAccountID );
}
//-----------------------------------------------------------------------------
// Purpose: create an anonymous game server login to be filled in by the AM
//-----------------------------------------------------------------------------
void CreateBlankAnonLogon( EUniverse eUniverse )
{
m_unAccountID = 0;
m_EAccountType = k_EAccountTypeAnonGameServer;
m_EUniverse = eUniverse;
m_unAccountInstance = 0;
}
//-----------------------------------------------------------------------------
// Purpose: create an anonymous game server login to be filled in by the AM
//-----------------------------------------------------------------------------
void CreateBlankAnonUserLogon( EUniverse eUniverse )
{
m_unAccountID = 0;
m_EAccountType = k_EAccountTypeAnonUser;
m_EUniverse = eUniverse;
m_unAccountInstance = 0;
}
//-----------------------------------------------------------------------------
// Purpose: Is this an anonymous game server login that will be filled in?
//-----------------------------------------------------------------------------
bool BBlankAnonAccount() const
{
return m_unAccountID == 0 && BAnonAccount() && m_unAccountInstance == 0;
}
//-----------------------------------------------------------------------------
// Purpose: Is this a game server account id?
//-----------------------------------------------------------------------------
bool BGameServerAccount() const
{
return m_EAccountType == k_EAccountTypeGameServer || m_EAccountType == k_EAccountTypeAnonGameServer;
}
//-----------------------------------------------------------------------------
// Purpose: Is this a content server account id?
//-----------------------------------------------------------------------------
bool BContentServerAccount() const
{
return m_EAccountType == k_EAccountTypeContentServer;
}
//-----------------------------------------------------------------------------
// Purpose: Is this a clan account id?
//-----------------------------------------------------------------------------
bool BClanAccount() const
{
return m_EAccountType == k_EAccountTypeClan;
}
//-----------------------------------------------------------------------------
// Purpose: Is this a chat account id?
//-----------------------------------------------------------------------------
bool BChatAccount() const
{
return m_EAccountType == k_EAccountTypeChat;
}
//-----------------------------------------------------------------------------
// Purpose: Is this an individual user account id?
//-----------------------------------------------------------------------------
bool BIndividualAccount() const
{
return m_EAccountType == k_EAccountTypeIndividual;
}
//-----------------------------------------------------------------------------
// Purpose: Is this an anonymous account?
//-----------------------------------------------------------------------------
bool BAnonAccount() const
{
return m_EAccountType == k_EAccountTypeAnonUser || m_EAccountType == k_EAccountTypeAnonGameServer;
}
// simple accessors
void SetAccountID( uint32 unAccountID ) { m_unAccountID = unAccountID; }
uint32 GetAccountID() const { return m_unAccountID; }
uint32 GetUnAccountInstance() const { return m_unAccountInstance; }
EAccountType GetEAccountType() const { return ( EAccountType ) m_EAccountType; }
EUniverse GetEUniverse() const { return m_EUniverse; }
void SetEUniverse( EUniverse eUniverse ) { m_EUniverse = eUniverse; }
bool IsValid() const { return ( m_EAccountType != k_EAccountTypeInvalid && m_EUniverse != k_EUniverseInvalid ); }
// this set of functions is hidden, will be moved out of class
explicit CSteamID( const char *pchSteamID, EUniverse eDefaultUniverse = k_EUniverseInvalid );
char * Render() const; // renders this steam ID to string
static char * Render( uint64 ulSteamID ); // static method to render a uint64 representation of a steam ID to a string
void SetFromString( const char *pchSteamID, EUniverse eDefaultUniverse );
bool SetFromSteam2String( const char *pchSteam2ID, EUniverse eUniverse );
bool operator==( const CSteamID &val ) const
{
return ( ( val.m_unAccountID == m_unAccountID ) && ( val.m_unAccountInstance == m_unAccountInstance )
&& ( val.m_EAccountType == m_EAccountType ) && ( val.m_EUniverse == m_EUniverse ) );
}
bool operator!=( const CSteamID &val ) const { return !operator==( val ); }
bool operator<( const CSteamID &val ) const { return ConvertToUint64() < val.ConvertToUint64(); }
bool operator>( const CSteamID &val ) const { return ConvertToUint64() > val.ConvertToUint64(); }
// DEBUG function
bool BValidExternalSteamID() const;
private:
// These are defined here to prevent accidental implicit conversion of a u32AccountID to a CSteamID.
// If you get a compiler error about an ambiguous constructor/function then it may be because you're
// passing a 32-bit int to a function that takes a CSteamID. You should explicitly create the SteamID
// using the correct Universe and account Type/Instance values.
CSteamID( uint32 );
CSteamID( int32 );
#ifdef _WIN32
#pragma warning(push)
#pragma warning(disable:4201) // nameless union is nonstandard
// 64 bits total
union
{
struct
{
#endif
uint32 m_unAccountID : 32; // unique account identifier
unsigned int m_unAccountInstance : 20; // dynamic instance ID (used for multiseat type accounts only)
unsigned int m_EAccountType : 4; // type of account - can't show as EAccountType, due to signed / unsigned difference
EUniverse m_EUniverse : 8; // universe this account belongs to
#ifdef _WIN32
};
uint64 m_unAll64Bits;
};
#pragma warning(pop) // no more anonymous unions until next time
#endif
};
const int k_unSteamAccountIDMask = 0xFFFFFFFF;
const int k_unSteamAccountInstanceMask = 0x000FFFFF;
// Special flags for Chat accounts - they go in the top 8 bits
// of the steam ID's "instance", leaving 12 for the actual instances
enum EChatSteamIDInstanceFlags
{
k_EChatAccountInstanceMask = 0x00000FFF, // top 8 bits are flags
k_EChatInstanceFlagClan = ( k_unSteamAccountInstanceMask + 1 ) >> 1, // top bit
k_EChatInstanceFlagLobby = ( k_unSteamAccountInstanceMask + 1 ) >> 2, // next one down, etc
// Max of 8 flags
};
// generic invalid CSteamID
const CSteamID k_steamIDNil;
// This steamID comes from a user game connection to an out of date GS that hasnt implemented the protocol
// to provide its steamID
const CSteamID k_steamIDOutofDateGS( 0, 0, k_EUniverseInvalid, k_EAccountTypeInvalid );
// This steamID comes from a user game connection to an sv_lan GS
const CSteamID k_steamIDLanModeGS( 0, 0, k_EUniversePublic, k_EAccountTypeInvalid );
// This steamID can come from a user game connection to a GS that has just booted but hasnt yet even initialized
// its steam3 component and started logging on.
const CSteamID k_steamIDNotInitYetGS( 1, 0, k_EUniverseInvalid, k_EAccountTypeInvalid );
#ifdef STEAM
// Returns the matching chat steamID, with the default instance of 0
// If the steamID passed in is already of type k_EAccountTypeChat it will be returned with the same instance
CSteamID ChatIDFromSteamID( CSteamID &steamID );
// Returns the matching clan steamID, with the default instance of 0
// If the steamID passed in is already of type k_EAccountTypeClan it will be returned with the same instance
CSteamID ClanIDFromSteamID( CSteamID &steamID );
// Asserts steamID type before conversion
CSteamID ChatIDFromClanID( CSteamID &steamIDClan );
// Asserts steamID type before conversion
CSteamID ClanIDFromChatID( CSteamID &steamIDChat );
#endif // _STEAM
//-----------------------------------------------------------------------------
// Purpose: encapsulates an appID/modID pair
//-----------------------------------------------------------------------------
class CGameID
{
public:
CGameID()
{
m_ulGameID = 0;
}
explicit CGameID( uint64 ulGameID )
{
m_ulGameID = ulGameID;
}
explicit CGameID( int32 nAppID )
{
m_ulGameID = 0;
m_gameID.m_nAppID = nAppID;
}
explicit CGameID( uint32 nAppID )
{
m_ulGameID = 0;
m_gameID.m_nAppID = nAppID;
}
CGameID( uint32 nAppID, uint32 nModID )
{
m_ulGameID = 0;
m_gameID.m_nAppID = nAppID;
m_gameID.m_nModID = nModID;
m_gameID.m_nType = k_EGameIDTypeGameMod;
}
// Hidden functions used only by Steam
explicit CGameID( const char *pchGameID );
char * Render() const; // renders this Game ID to string
static char * Render( uint64 ulGameID ); // static method to render a uint64 representation of a Game ID to a string
// must include checksum_crc.h first to get this functionality
#if defined( CHECKSUM_CRC_H )
CGameID( uint32 nAppID, const char *pchModPath )
{
m_ulGameID = 0;
m_gameID.m_nAppID = nAppID;
m_gameID.m_nType = k_EGameIDTypeGameMod;
char rgchModDir[MAX_PATH];
Q_FileBase( pchModPath, rgchModDir, sizeof( rgchModDir ) );
CRC32_t crc32;
CRC32_Init( &crc32 );
CRC32_ProcessBuffer( &crc32, rgchModDir, Q_strlen( rgchModDir ) );
CRC32_Final( &crc32 );
// set the high-bit on the mod-id
// reduces crc32 to 31bits, but lets us use the modID as a guaranteed unique
// replacement for appID's
m_gameID.m_nModID = crc32 | (0x80000000);
}
CGameID( const char *pchExePath, const char *pchAppName )
{
m_ulGameID = 0;
m_gameID.m_nAppID = 0;
m_gameID.m_nType = k_EGameIDTypeShortcut;
CRC32_t crc32;
CRC32_Init( &crc32 );
CRC32_ProcessBuffer( &crc32, pchExePath, Q_strlen( pchExePath ) );
CRC32_ProcessBuffer( &crc32, pchAppName, Q_strlen( pchAppName ) );
CRC32_Final( &crc32 );
// set the high-bit on the mod-id
// reduces crc32 to 31bits, but lets us use the modID as a guaranteed unique
// replacement for appID's
m_gameID.m_nModID = crc32 | (0x80000000);
}
#endif
void SetAsShortcut()
{
m_gameID.m_nAppID = 0;
m_gameID.m_nType = k_EGameIDTypeShortcut;
}
void SetAsP2PFile()
{
m_gameID.m_nAppID = 0;
m_gameID.m_nType = k_EGameIDTypeP2P;
}
uint64 ToUint64() const
{
return m_ulGameID;
}
uint64 *GetUint64Ptr()
{
return &m_ulGameID;
}
bool IsMod() const
{
return ( m_gameID.m_nType == k_EGameIDTypeGameMod );
}
bool IsShortcut() const
{
return ( m_gameID.m_nType == k_EGameIDTypeShortcut );
}
bool IsP2PFile() const
{
return ( m_gameID.m_nType == k_EGameIDTypeP2P );
}
bool IsSteamApp() const
{
return ( m_gameID.m_nType == k_EGameIDTypeApp );
}
uint32 ModID() const
{
return m_gameID.m_nModID;
}
uint32 AppID() const
{
return m_gameID.m_nAppID;
}
bool operator == ( const CGameID &rhs ) const
{
return m_ulGameID == rhs.m_ulGameID;
}
bool operator != ( const CGameID &rhs ) const
{
return !(*this == rhs);
}
bool operator < ( const CGameID &rhs ) const
{
return ( m_ulGameID < rhs.m_ulGameID );
}
bool IsValid() const
{
return ( m_ulGameID != 0 );
}
void Reset()
{
m_ulGameID = 0;
}
private:
enum EGameIDType
{
k_EGameIDTypeApp = 0,
k_EGameIDTypeGameMod = 1,
k_EGameIDTypeShortcut = 2,
k_EGameIDTypeP2P = 3,
};
struct GameID_t
{
unsigned int m_nAppID : 24;
unsigned int m_nType : 8;
unsigned int m_nModID : 32;
};
union
{
uint64 m_ulGameID;
GameID_t m_gameID;
};
};
#pragma pack( pop )
const int k_cchGameExtraInfoMax = 64;
// Max number of credit cards stored for one account
const int k_nMaxNumCardsPerAccount = 1;
//-----------------------------------------------------------------------------
// Constants used for query ports.
//-----------------------------------------------------------------------------
#define QUERY_PORT_NOT_INITIALIZED 0xFFFF // We haven't asked the GS for this query port's actual value yet.
#define QUERY_PORT_ERROR 0xFFFE // We were unable to get the query port for this server.
#endif // STEAMCLIENTPUBLIC_H
| {
"pile_set_name": "Github"
} |
//
// MJFoundation.h
// MJExtensionExample
//
// Created by MJ Lee on 14/7/16.
// Copyright (c) 2014年 小码哥. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface MJFoundation : NSObject
+ (BOOL)isClassFromFoundation:(Class)c;
@end
| {
"pile_set_name": "Github"
} |
package dns
import (
"bufio"
"fmt"
"io"
"os"
"path/filepath"
"strconv"
"strings"
)
const maxTok = 2048 // Largest token we can return.
// The maximum depth of $INCLUDE directives supported by the
// ZoneParser API.
const maxIncludeDepth = 7
// Tokinize a RFC 1035 zone file. The tokenizer will normalize it:
// * Add ownernames if they are left blank;
// * Suppress sequences of spaces;
// * Make each RR fit on one line (_NEWLINE is send as last)
// * Handle comments: ;
// * Handle braces - anywhere.
const (
// Zonefile
zEOF = iota
zString
zBlank
zQuote
zNewline
zRrtpe
zOwner
zClass
zDirOrigin // $ORIGIN
zDirTTL // $TTL
zDirInclude // $INCLUDE
zDirGenerate // $GENERATE
// Privatekey file
zValue
zKey
zExpectOwnerDir // Ownername
zExpectOwnerBl // Whitespace after the ownername
zExpectAny // Expect rrtype, ttl or class
zExpectAnyNoClass // Expect rrtype or ttl
zExpectAnyNoClassBl // The whitespace after _EXPECT_ANY_NOCLASS
zExpectAnyNoTTL // Expect rrtype or class
zExpectAnyNoTTLBl // Whitespace after _EXPECT_ANY_NOTTL
zExpectRrtype // Expect rrtype
zExpectRrtypeBl // Whitespace BEFORE rrtype
zExpectRdata // The first element of the rdata
zExpectDirTTLBl // Space after directive $TTL
zExpectDirTTL // Directive $TTL
zExpectDirOriginBl // Space after directive $ORIGIN
zExpectDirOrigin // Directive $ORIGIN
zExpectDirIncludeBl // Space after directive $INCLUDE
zExpectDirInclude // Directive $INCLUDE
zExpectDirGenerate // Directive $GENERATE
zExpectDirGenerateBl // Space after directive $GENERATE
)
// ParseError is a parsing error. It contains the parse error and the location in the io.Reader
// where the error occurred.
type ParseError struct {
file string
err string
lex lex
}
func (e *ParseError) Error() (s string) {
if e.file != "" {
s = e.file + ": "
}
s += "dns: " + e.err + ": " + strconv.QuoteToASCII(e.lex.token) + " at line: " +
strconv.Itoa(e.lex.line) + ":" + strconv.Itoa(e.lex.column)
return
}
type lex struct {
token string // text of the token
err bool // when true, token text has lexer error
value uint8 // value: zString, _BLANK, etc.
torc uint16 // type or class as parsed in the lexer, we only need to look this up in the grammar
line int // line in the file
column int // column in the file
}
// ttlState describes the state necessary to fill in an omitted RR TTL
type ttlState struct {
ttl uint32 // ttl is the current default TTL
isByDirective bool // isByDirective indicates whether ttl was set by a $TTL directive
}
// NewRR reads the RR contained in the string s. Only the first RR is returned.
// If s contains no records, NewRR will return nil with no error.
//
// The class defaults to IN and TTL defaults to 3600. The full zone file syntax
// like $TTL, $ORIGIN, etc. is supported. All fields of the returned RR are
// set, except RR.Header().Rdlength which is set to 0.
func NewRR(s string) (RR, error) {
if len(s) > 0 && s[len(s)-1] != '\n' { // We need a closing newline
return ReadRR(strings.NewReader(s+"\n"), "")
}
return ReadRR(strings.NewReader(s), "")
}
// ReadRR reads the RR contained in r.
//
// The string file is used in error reporting and to resolve relative
// $INCLUDE directives.
//
// See NewRR for more documentation.
func ReadRR(r io.Reader, file string) (RR, error) {
zp := NewZoneParser(r, ".", file)
zp.SetDefaultTTL(defaultTtl)
zp.SetIncludeAllowed(true)
rr, _ := zp.Next()
return rr, zp.Err()
}
// ZoneParser is a parser for an RFC 1035 style zonefile.
//
// Each parsed RR in the zone is returned sequentially from Next. An
// optional comment can be retrieved with Comment.
//
// The directives $INCLUDE, $ORIGIN, $TTL and $GENERATE are all
// supported. Although $INCLUDE is disabled by default.
// Note that $GENERATE's range support up to a maximum of 65535 steps.
//
// Basic usage pattern when reading from a string (z) containing the
// zone data:
//
// zp := NewZoneParser(strings.NewReader(z), "", "")
//
// for rr, ok := zp.Next(); ok; rr, ok = zp.Next() {
// // Do something with rr
// }
//
// if err := zp.Err(); err != nil {
// // log.Println(err)
// }
//
// Comments specified after an RR (and on the same line!) are
// returned too:
//
// foo. IN A 10.0.0.1 ; this is a comment
//
// The text "; this is comment" is returned from Comment. Comments inside
// the RR are returned concatenated along with the RR. Comments on a line
// by themselves are discarded.
type ZoneParser struct {
c *zlexer
parseErr *ParseError
origin string
file string
defttl *ttlState
h RR_Header
// sub is used to parse $INCLUDE files and $GENERATE directives.
// Next, by calling subNext, forwards the resulting RRs from this
// sub parser to the calling code.
sub *ZoneParser
osFile *os.File
includeDepth uint8
includeAllowed bool
generateDisallowed bool
}
// NewZoneParser returns an RFC 1035 style zonefile parser that reads
// from r.
//
// The string file is used in error reporting and to resolve relative
// $INCLUDE directives. The string origin is used as the initial
// origin, as if the file would start with an $ORIGIN directive.
func NewZoneParser(r io.Reader, origin, file string) *ZoneParser {
var pe *ParseError
if origin != "" {
origin = Fqdn(origin)
if _, ok := IsDomainName(origin); !ok {
pe = &ParseError{file, "bad initial origin name", lex{}}
}
}
return &ZoneParser{
c: newZLexer(r),
parseErr: pe,
origin: origin,
file: file,
}
}
// SetDefaultTTL sets the parsers default TTL to ttl.
func (zp *ZoneParser) SetDefaultTTL(ttl uint32) {
zp.defttl = &ttlState{ttl, false}
}
// SetIncludeAllowed controls whether $INCLUDE directives are
// allowed. $INCLUDE directives are not supported by default.
//
// The $INCLUDE directive will open and read from a user controlled
// file on the system. Even if the file is not a valid zonefile, the
// contents of the file may be revealed in error messages, such as:
//
// /etc/passwd: dns: not a TTL: "root:x:0:0:root:/root:/bin/bash" at line: 1:31
// /etc/shadow: dns: not a TTL: "root:$6$<redacted>::0:99999:7:::" at line: 1:125
func (zp *ZoneParser) SetIncludeAllowed(v bool) {
zp.includeAllowed = v
}
// Err returns the first non-EOF error that was encountered by the
// ZoneParser.
func (zp *ZoneParser) Err() error {
if zp.parseErr != nil {
return zp.parseErr
}
if zp.sub != nil {
if err := zp.sub.Err(); err != nil {
return err
}
}
return zp.c.Err()
}
func (zp *ZoneParser) setParseError(err string, l lex) (RR, bool) {
zp.parseErr = &ParseError{zp.file, err, l}
return nil, false
}
// Comment returns an optional text comment that occurred alongside
// the RR.
func (zp *ZoneParser) Comment() string {
if zp.parseErr != nil {
return ""
}
if zp.sub != nil {
return zp.sub.Comment()
}
return zp.c.Comment()
}
func (zp *ZoneParser) subNext() (RR, bool) {
if rr, ok := zp.sub.Next(); ok {
return rr, true
}
if zp.sub.osFile != nil {
zp.sub.osFile.Close()
zp.sub.osFile = nil
}
if zp.sub.Err() != nil {
// We have errors to surface.
return nil, false
}
zp.sub = nil
return zp.Next()
}
// Next advances the parser to the next RR in the zonefile and
// returns the (RR, true). It will return (nil, false) when the
// parsing stops, either by reaching the end of the input or an
// error. After Next returns (nil, false), the Err method will return
// any error that occurred during parsing.
func (zp *ZoneParser) Next() (RR, bool) {
if zp.parseErr != nil {
return nil, false
}
if zp.sub != nil {
return zp.subNext()
}
// 6 possible beginnings of a line (_ is a space):
//
// 0. zRRTYPE -> all omitted until the rrtype
// 1. zOwner _ zRrtype -> class/ttl omitted
// 2. zOwner _ zString _ zRrtype -> class omitted
// 3. zOwner _ zString _ zClass _ zRrtype -> ttl/class
// 4. zOwner _ zClass _ zRrtype -> ttl omitted
// 5. zOwner _ zClass _ zString _ zRrtype -> class/ttl (reversed)
//
// After detecting these, we know the zRrtype so we can jump to functions
// handling the rdata for each of these types.
st := zExpectOwnerDir // initial state
h := &zp.h
for l, ok := zp.c.Next(); ok; l, ok = zp.c.Next() {
// zlexer spotted an error already
if l.err {
return zp.setParseError(l.token, l)
}
switch st {
case zExpectOwnerDir:
// We can also expect a directive, like $TTL or $ORIGIN
if zp.defttl != nil {
h.Ttl = zp.defttl.ttl
}
h.Class = ClassINET
switch l.value {
case zNewline:
st = zExpectOwnerDir
case zOwner:
name, ok := toAbsoluteName(l.token, zp.origin)
if !ok {
return zp.setParseError("bad owner name", l)
}
h.Name = name
st = zExpectOwnerBl
case zDirTTL:
st = zExpectDirTTLBl
case zDirOrigin:
st = zExpectDirOriginBl
case zDirInclude:
st = zExpectDirIncludeBl
case zDirGenerate:
st = zExpectDirGenerateBl
case zRrtpe:
h.Rrtype = l.torc
st = zExpectRdata
case zClass:
h.Class = l.torc
st = zExpectAnyNoClassBl
case zBlank:
// Discard, can happen when there is nothing on the
// line except the RR type
case zString:
ttl, ok := stringToTTL(l.token)
if !ok {
return zp.setParseError("not a TTL", l)
}
h.Ttl = ttl
if zp.defttl == nil || !zp.defttl.isByDirective {
zp.defttl = &ttlState{ttl, false}
}
st = zExpectAnyNoTTLBl
default:
return zp.setParseError("syntax error at beginning", l)
}
case zExpectDirIncludeBl:
if l.value != zBlank {
return zp.setParseError("no blank after $INCLUDE-directive", l)
}
st = zExpectDirInclude
case zExpectDirInclude:
if l.value != zString {
return zp.setParseError("expecting $INCLUDE value, not this...", l)
}
neworigin := zp.origin // There may be optionally a new origin set after the filename, if not use current one
switch l, _ := zp.c.Next(); l.value {
case zBlank:
l, _ := zp.c.Next()
if l.value == zString {
name, ok := toAbsoluteName(l.token, zp.origin)
if !ok {
return zp.setParseError("bad origin name", l)
}
neworigin = name
}
case zNewline, zEOF:
// Ok
default:
return zp.setParseError("garbage after $INCLUDE", l)
}
if !zp.includeAllowed {
return zp.setParseError("$INCLUDE directive not allowed", l)
}
if zp.includeDepth >= maxIncludeDepth {
return zp.setParseError("too deeply nested $INCLUDE", l)
}
// Start with the new file
includePath := l.token
if !filepath.IsAbs(includePath) {
includePath = filepath.Join(filepath.Dir(zp.file), includePath)
}
r1, e1 := os.Open(includePath)
if e1 != nil {
var as string
if !filepath.IsAbs(l.token) {
as = fmt.Sprintf(" as `%s'", includePath)
}
msg := fmt.Sprintf("failed to open `%s'%s: %v", l.token, as, e1)
return zp.setParseError(msg, l)
}
zp.sub = NewZoneParser(r1, neworigin, includePath)
zp.sub.defttl, zp.sub.includeDepth, zp.sub.osFile = zp.defttl, zp.includeDepth+1, r1
zp.sub.SetIncludeAllowed(true)
return zp.subNext()
case zExpectDirTTLBl:
if l.value != zBlank {
return zp.setParseError("no blank after $TTL-directive", l)
}
st = zExpectDirTTL
case zExpectDirTTL:
if l.value != zString {
return zp.setParseError("expecting $TTL value, not this...", l)
}
if err := slurpRemainder(zp.c); err != nil {
return zp.setParseError(err.err, err.lex)
}
ttl, ok := stringToTTL(l.token)
if !ok {
return zp.setParseError("expecting $TTL value, not this...", l)
}
zp.defttl = &ttlState{ttl, true}
st = zExpectOwnerDir
case zExpectDirOriginBl:
if l.value != zBlank {
return zp.setParseError("no blank after $ORIGIN-directive", l)
}
st = zExpectDirOrigin
case zExpectDirOrigin:
if l.value != zString {
return zp.setParseError("expecting $ORIGIN value, not this...", l)
}
if err := slurpRemainder(zp.c); err != nil {
return zp.setParseError(err.err, err.lex)
}
name, ok := toAbsoluteName(l.token, zp.origin)
if !ok {
return zp.setParseError("bad origin name", l)
}
zp.origin = name
st = zExpectOwnerDir
case zExpectDirGenerateBl:
if l.value != zBlank {
return zp.setParseError("no blank after $GENERATE-directive", l)
}
st = zExpectDirGenerate
case zExpectDirGenerate:
if zp.generateDisallowed {
return zp.setParseError("nested $GENERATE directive not allowed", l)
}
if l.value != zString {
return zp.setParseError("expecting $GENERATE value, not this...", l)
}
return zp.generate(l)
case zExpectOwnerBl:
if l.value != zBlank {
return zp.setParseError("no blank after owner", l)
}
st = zExpectAny
case zExpectAny:
switch l.value {
case zRrtpe:
if zp.defttl == nil {
return zp.setParseError("missing TTL with no previous value", l)
}
h.Rrtype = l.torc
st = zExpectRdata
case zClass:
h.Class = l.torc
st = zExpectAnyNoClassBl
case zString:
ttl, ok := stringToTTL(l.token)
if !ok {
return zp.setParseError("not a TTL", l)
}
h.Ttl = ttl
if zp.defttl == nil || !zp.defttl.isByDirective {
zp.defttl = &ttlState{ttl, false}
}
st = zExpectAnyNoTTLBl
default:
return zp.setParseError("expecting RR type, TTL or class, not this...", l)
}
case zExpectAnyNoClassBl:
if l.value != zBlank {
return zp.setParseError("no blank before class", l)
}
st = zExpectAnyNoClass
case zExpectAnyNoTTLBl:
if l.value != zBlank {
return zp.setParseError("no blank before TTL", l)
}
st = zExpectAnyNoTTL
case zExpectAnyNoTTL:
switch l.value {
case zClass:
h.Class = l.torc
st = zExpectRrtypeBl
case zRrtpe:
h.Rrtype = l.torc
st = zExpectRdata
default:
return zp.setParseError("expecting RR type or class, not this...", l)
}
case zExpectAnyNoClass:
switch l.value {
case zString:
ttl, ok := stringToTTL(l.token)
if !ok {
return zp.setParseError("not a TTL", l)
}
h.Ttl = ttl
if zp.defttl == nil || !zp.defttl.isByDirective {
zp.defttl = &ttlState{ttl, false}
}
st = zExpectRrtypeBl
case zRrtpe:
h.Rrtype = l.torc
st = zExpectRdata
default:
return zp.setParseError("expecting RR type or TTL, not this...", l)
}
case zExpectRrtypeBl:
if l.value != zBlank {
return zp.setParseError("no blank before RR type", l)
}
st = zExpectRrtype
case zExpectRrtype:
if l.value != zRrtpe {
return zp.setParseError("unknown RR type", l)
}
h.Rrtype = l.torc
st = zExpectRdata
case zExpectRdata:
var rr RR
if newFn, ok := TypeToRR[h.Rrtype]; ok && canParseAsRR(h.Rrtype) {
rr = newFn()
*rr.Header() = *h
} else {
rr = &RFC3597{Hdr: *h}
}
_, isPrivate := rr.(*PrivateRR)
if !isPrivate && zp.c.Peek().token == "" {
// This is a dynamic update rr.
// TODO(tmthrgd): Previously slurpRemainder was only called
// for certain RR types, which may have been important.
if err := slurpRemainder(zp.c); err != nil {
return zp.setParseError(err.err, err.lex)
}
return rr, true
} else if l.value == zNewline {
return zp.setParseError("unexpected newline", l)
}
if err := rr.parse(zp.c, zp.origin); err != nil {
// err is a concrete *ParseError without the file field set.
// The setParseError call below will construct a new
// *ParseError with file set to zp.file.
// If err.lex is nil than we have encounter an unknown RR type
// in that case we substitute our current lex token.
if err.lex == (lex{}) {
return zp.setParseError(err.err, l)
}
return zp.setParseError(err.err, err.lex)
}
return rr, true
}
}
// If we get here, we and the h.Rrtype is still zero, we haven't parsed anything, this
// is not an error, because an empty zone file is still a zone file.
return nil, false
}
// canParseAsRR returns true if the record type can be parsed as a
// concrete RR. It blacklists certain record types that must be parsed
// according to RFC 3597 because they lack a presentation format.
func canParseAsRR(rrtype uint16) bool {
switch rrtype {
case TypeANY, TypeNULL, TypeOPT, TypeTSIG:
return false
default:
return true
}
}
type zlexer struct {
br io.ByteReader
readErr error
line int
column int
comBuf string
comment string
l lex
cachedL *lex
brace int
quote bool
space bool
commt bool
rrtype bool
owner bool
nextL bool
eol bool // end-of-line
}
func newZLexer(r io.Reader) *zlexer {
br, ok := r.(io.ByteReader)
if !ok {
br = bufio.NewReaderSize(r, 1024)
}
return &zlexer{
br: br,
line: 1,
owner: true,
}
}
func (zl *zlexer) Err() error {
if zl.readErr == io.EOF {
return nil
}
return zl.readErr
}
// readByte returns the next byte from the input
func (zl *zlexer) readByte() (byte, bool) {
if zl.readErr != nil {
return 0, false
}
c, err := zl.br.ReadByte()
if err != nil {
zl.readErr = err
return 0, false
}
// delay the newline handling until the next token is delivered,
// fixes off-by-one errors when reporting a parse error.
if zl.eol {
zl.line++
zl.column = 0
zl.eol = false
}
if c == '\n' {
zl.eol = true
} else {
zl.column++
}
return c, true
}
func (zl *zlexer) Peek() lex {
if zl.nextL {
return zl.l
}
l, ok := zl.Next()
if !ok {
return l
}
if zl.nextL {
// Cache l. Next returns zl.cachedL then zl.l.
zl.cachedL = &l
} else {
// In this case l == zl.l, so we just tell Next to return zl.l.
zl.nextL = true
}
return l
}
func (zl *zlexer) Next() (lex, bool) {
l := &zl.l
switch {
case zl.cachedL != nil:
l, zl.cachedL = zl.cachedL, nil
return *l, true
case zl.nextL:
zl.nextL = false
return *l, true
case l.err:
// Parsing errors should be sticky.
return lex{value: zEOF}, false
}
var (
str [maxTok]byte // Hold string text
com [maxTok]byte // Hold comment text
stri int // Offset in str (0 means empty)
comi int // Offset in com (0 means empty)
escape bool
)
if zl.comBuf != "" {
comi = copy(com[:], zl.comBuf)
zl.comBuf = ""
}
zl.comment = ""
for x, ok := zl.readByte(); ok; x, ok = zl.readByte() {
l.line, l.column = zl.line, zl.column
if stri >= len(str) {
l.token = "token length insufficient for parsing"
l.err = true
return *l, true
}
if comi >= len(com) {
l.token = "comment length insufficient for parsing"
l.err = true
return *l, true
}
switch x {
case ' ', '\t':
if escape || zl.quote {
// Inside quotes or escaped this is legal.
str[stri] = x
stri++
escape = false
break
}
if zl.commt {
com[comi] = x
comi++
break
}
var retL lex
if stri == 0 {
// Space directly in the beginning, handled in the grammar
} else if zl.owner {
// If we have a string and its the first, make it an owner
l.value = zOwner
l.token = string(str[:stri])
// escape $... start with a \ not a $, so this will work
switch strings.ToUpper(l.token) {
case "$TTL":
l.value = zDirTTL
case "$ORIGIN":
l.value = zDirOrigin
case "$INCLUDE":
l.value = zDirInclude
case "$GENERATE":
l.value = zDirGenerate
}
retL = *l
} else {
l.value = zString
l.token = string(str[:stri])
if !zl.rrtype {
tokenUpper := strings.ToUpper(l.token)
if t, ok := StringToType[tokenUpper]; ok {
l.value = zRrtpe
l.torc = t
zl.rrtype = true
} else if strings.HasPrefix(tokenUpper, "TYPE") {
t, ok := typeToInt(l.token)
if !ok {
l.token = "unknown RR type"
l.err = true
return *l, true
}
l.value = zRrtpe
l.torc = t
zl.rrtype = true
}
if t, ok := StringToClass[tokenUpper]; ok {
l.value = zClass
l.torc = t
} else if strings.HasPrefix(tokenUpper, "CLASS") {
t, ok := classToInt(l.token)
if !ok {
l.token = "unknown class"
l.err = true
return *l, true
}
l.value = zClass
l.torc = t
}
}
retL = *l
}
zl.owner = false
if !zl.space {
zl.space = true
l.value = zBlank
l.token = " "
if retL == (lex{}) {
return *l, true
}
zl.nextL = true
}
if retL != (lex{}) {
return retL, true
}
case ';':
if escape || zl.quote {
// Inside quotes or escaped this is legal.
str[stri] = x
stri++
escape = false
break
}
zl.commt = true
zl.comBuf = ""
if comi > 1 {
// A newline was previously seen inside a comment that
// was inside braces and we delayed adding it until now.
com[comi] = ' ' // convert newline to space
comi++
if comi >= len(com) {
l.token = "comment length insufficient for parsing"
l.err = true
return *l, true
}
}
com[comi] = ';'
comi++
if stri > 0 {
zl.comBuf = string(com[:comi])
l.value = zString
l.token = string(str[:stri])
return *l, true
}
case '\r':
escape = false
if zl.quote {
str[stri] = x
stri++
}
// discard if outside of quotes
case '\n':
escape = false
// Escaped newline
if zl.quote {
str[stri] = x
stri++
break
}
if zl.commt {
// Reset a comment
zl.commt = false
zl.rrtype = false
// If not in a brace this ends the comment AND the RR
if zl.brace == 0 {
zl.owner = true
l.value = zNewline
l.token = "\n"
zl.comment = string(com[:comi])
return *l, true
}
zl.comBuf = string(com[:comi])
break
}
if zl.brace == 0 {
// If there is previous text, we should output it here
var retL lex
if stri != 0 {
l.value = zString
l.token = string(str[:stri])
if !zl.rrtype {
tokenUpper := strings.ToUpper(l.token)
if t, ok := StringToType[tokenUpper]; ok {
zl.rrtype = true
l.value = zRrtpe
l.torc = t
}
}
retL = *l
}
l.value = zNewline
l.token = "\n"
zl.comment = zl.comBuf
zl.comBuf = ""
zl.rrtype = false
zl.owner = true
if retL != (lex{}) {
zl.nextL = true
return retL, true
}
return *l, true
}
case '\\':
// comments do not get escaped chars, everything is copied
if zl.commt {
com[comi] = x
comi++
break
}
// something already escaped must be in string
if escape {
str[stri] = x
stri++
escape = false
break
}
// something escaped outside of string gets added to string
str[stri] = x
stri++
escape = true
case '"':
if zl.commt {
com[comi] = x
comi++
break
}
if escape {
str[stri] = x
stri++
escape = false
break
}
zl.space = false
// send previous gathered text and the quote
var retL lex
if stri != 0 {
l.value = zString
l.token = string(str[:stri])
retL = *l
}
// send quote itself as separate token
l.value = zQuote
l.token = "\""
zl.quote = !zl.quote
if retL != (lex{}) {
zl.nextL = true
return retL, true
}
return *l, true
case '(', ')':
if zl.commt {
com[comi] = x
comi++
break
}
if escape || zl.quote {
// Inside quotes or escaped this is legal.
str[stri] = x
stri++
escape = false
break
}
switch x {
case ')':
zl.brace--
if zl.brace < 0 {
l.token = "extra closing brace"
l.err = true
return *l, true
}
case '(':
zl.brace++
}
default:
escape = false
if zl.commt {
com[comi] = x
comi++
break
}
str[stri] = x
stri++
zl.space = false
}
}
if zl.readErr != nil && zl.readErr != io.EOF {
// Don't return any tokens after a read error occurs.
return lex{value: zEOF}, false
}
var retL lex
if stri > 0 {
// Send remainder of str
l.value = zString
l.token = string(str[:stri])
retL = *l
if comi <= 0 {
return retL, true
}
}
if comi > 0 {
// Send remainder of com
l.value = zNewline
l.token = "\n"
zl.comment = string(com[:comi])
if retL != (lex{}) {
zl.nextL = true
return retL, true
}
return *l, true
}
if zl.brace != 0 {
l.token = "unbalanced brace"
l.err = true
return *l, true
}
return lex{value: zEOF}, false
}
func (zl *zlexer) Comment() string {
if zl.l.err {
return ""
}
return zl.comment
}
// Extract the class number from CLASSxx
func classToInt(token string) (uint16, bool) {
offset := 5
if len(token) < offset+1 {
return 0, false
}
class, err := strconv.ParseUint(token[offset:], 10, 16)
if err != nil {
return 0, false
}
return uint16(class), true
}
// Extract the rr number from TYPExxx
func typeToInt(token string) (uint16, bool) {
offset := 4
if len(token) < offset+1 {
return 0, false
}
typ, err := strconv.ParseUint(token[offset:], 10, 16)
if err != nil {
return 0, false
}
return uint16(typ), true
}
// stringToTTL parses things like 2w, 2m, etc, and returns the time in seconds.
func stringToTTL(token string) (uint32, bool) {
var s, i uint32
for _, c := range token {
switch c {
case 's', 'S':
s += i
i = 0
case 'm', 'M':
s += i * 60
i = 0
case 'h', 'H':
s += i * 60 * 60
i = 0
case 'd', 'D':
s += i * 60 * 60 * 24
i = 0
case 'w', 'W':
s += i * 60 * 60 * 24 * 7
i = 0
case '0', '1', '2', '3', '4', '5', '6', '7', '8', '9':
i *= 10
i += uint32(c) - '0'
default:
return 0, false
}
}
return s + i, true
}
// Parse LOC records' <digits>[.<digits>][mM] into a
// mantissa exponent format. Token should contain the entire
// string (i.e. no spaces allowed)
func stringToCm(token string) (e, m uint8, ok bool) {
if token[len(token)-1] == 'M' || token[len(token)-1] == 'm' {
token = token[0 : len(token)-1]
}
s := strings.SplitN(token, ".", 2)
var meters, cmeters, val int
var err error
switch len(s) {
case 2:
if cmeters, err = strconv.Atoi(s[1]); err != nil {
return
}
fallthrough
case 1:
if meters, err = strconv.Atoi(s[0]); err != nil {
return
}
case 0:
// huh?
return 0, 0, false
}
ok = true
if meters > 0 {
e = 2
val = meters
} else {
e = 0
val = cmeters
}
for val > 10 {
e++
val /= 10
}
if e > 9 {
ok = false
}
m = uint8(val)
return
}
func toAbsoluteName(name, origin string) (absolute string, ok bool) {
// check for an explicit origin reference
if name == "@" {
// require a nonempty origin
if origin == "" {
return "", false
}
return origin, true
}
// require a valid domain name
_, ok = IsDomainName(name)
if !ok || name == "" {
return "", false
}
// check if name is already absolute
if IsFqdn(name) {
return name, true
}
// require a nonempty origin
if origin == "" {
return "", false
}
return appendOrigin(name, origin), true
}
func appendOrigin(name, origin string) string {
if origin == "." {
return name + origin
}
return name + "." + origin
}
// LOC record helper function
func locCheckNorth(token string, latitude uint32) (uint32, bool) {
switch token {
case "n", "N":
return LOC_EQUATOR + latitude, true
case "s", "S":
return LOC_EQUATOR - latitude, true
}
return latitude, false
}
// LOC record helper function
func locCheckEast(token string, longitude uint32) (uint32, bool) {
switch token {
case "e", "E":
return LOC_EQUATOR + longitude, true
case "w", "W":
return LOC_EQUATOR - longitude, true
}
return longitude, false
}
// "Eat" the rest of the "line"
func slurpRemainder(c *zlexer) *ParseError {
l, _ := c.Next()
switch l.value {
case zBlank:
l, _ = c.Next()
if l.value != zNewline && l.value != zEOF {
return &ParseError{"", "garbage after rdata", l}
}
case zNewline:
case zEOF:
default:
return &ParseError{"", "garbage after rdata", l}
}
return nil
}
// Parse a 64 bit-like ipv6 address: "0014:4fff:ff20:ee64"
// Used for NID and L64 record.
func stringToNodeID(l lex) (uint64, *ParseError) {
if len(l.token) < 19 {
return 0, &ParseError{l.token, "bad NID/L64 NodeID/Locator64", l}
}
// There must be three colons at fixes postitions, if not its a parse error
if l.token[4] != ':' && l.token[9] != ':' && l.token[14] != ':' {
return 0, &ParseError{l.token, "bad NID/L64 NodeID/Locator64", l}
}
s := l.token[0:4] + l.token[5:9] + l.token[10:14] + l.token[15:19]
u, err := strconv.ParseUint(s, 16, 64)
if err != nil {
return 0, &ParseError{l.token, "bad NID/L64 NodeID/Locator64", l}
}
return u, nil
}
| {
"pile_set_name": "Github"
} |
<?php
$field=array (
0 =>
array (
'id' => '9',
'field_name' => 'username',
'use_name' => '姓名',
'field_type' => 'text',
'field_value' => '',
'field_length' => '255',
'form_id' => '5',
'field_info' => '',
'is_disable' => '0',
'form_order' => '1',
'is_empty' => '0',
),
1 =>
array (
'id' => '19',
'field_name' => 'jobname',
'use_name' => '姓名',
'field_type' => 'text',
'field_value' => '',
'field_length' => '255',
'form_id' => '8',
'field_info' => '',
'is_disable' => '0',
'form_order' => '1',
'is_empty' => '0',
),
2 =>
array (
'id' => '33',
'field_name' => 'title',
'use_name' => '主题',
'field_type' => 'text',
'field_value' => '',
'field_length' => '255',
'form_id' => '9',
'field_info' => '',
'is_disable' => '0',
'form_order' => '1',
'is_empty' => '0',
),
3 =>
array (
'id' => '12',
'field_name' => 'mail',
'use_name' => '邮箱',
'field_type' => 'text',
'field_value' => '',
'field_length' => '255',
'form_id' => '5',
'field_info' => '',
'is_disable' => '0',
'form_order' => '2',
'is_empty' => '1',
),
4 =>
array (
'id' => '20',
'field_name' => 'jobsex',
'use_name' => '性别',
'field_type' => 'select',
'field_value' => '男
女',
'field_length' => '255',
'form_id' => '8',
'field_info' => '',
'is_disable' => '0',
'form_order' => '2',
'is_empty' => '0',
),
5 =>
array (
'id' => '34',
'field_name' => 'f_name',
'use_name' => '姓名',
'field_type' => 'text',
'field_value' => '',
'field_length' => '255',
'form_id' => '9',
'field_info' => '',
'is_disable' => '0',
'form_order' => '2',
'is_empty' => '0',
),
6 =>
array (
'id' => '13',
'field_name' => 'tel',
'use_name' => '电话/传真',
'field_type' => 'text',
'field_value' => '',
'field_length' => '255',
'form_id' => '5',
'field_info' => '',
'is_disable' => '0',
'form_order' => '3',
'is_empty' => '0',
),
7 =>
array (
'id' => '21',
'field_name' => 'jobmoth',
'use_name' => '出生年月',
'field_type' => 'text',
'field_value' => '',
'field_length' => '255',
'form_id' => '8',
'field_info' => '',
'is_disable' => '0',
'form_order' => '3',
'is_empty' => '0',
),
8 =>
array (
'id' => '35',
'field_name' => 'f_mail',
'use_name' => 'E-mail',
'field_type' => 'text',
'field_value' => '',
'field_length' => '255',
'form_id' => '9',
'field_info' => '',
'is_disable' => '0',
'form_order' => '3',
'is_empty' => '0',
),
9 =>
array (
'id' => '32',
'field_name' => 'web_contact',
'use_name' => 'QQ/MSN/旺旺',
'field_type' => 'text',
'field_value' => '',
'field_length' => '255',
'form_id' => '5',
'field_info' => '',
'is_disable' => '0',
'form_order' => '4',
'is_empty' => '0',
),
10 =>
array (
'id' => '22',
'field_name' => 'jobjg',
'use_name' => '籍贯',
'field_type' => 'text',
'field_value' => '',
'field_length' => '255',
'form_id' => '8',
'field_info' => '',
'is_disable' => '0',
'form_order' => '4',
'is_empty' => '0',
),
11 =>
array (
'id' => '36',
'field_name' => 'f_tel',
'use_name' => '电话',
'field_type' => 'text',
'field_value' => '',
'field_length' => '255',
'form_id' => '9',
'field_info' => '',
'is_disable' => '0',
'form_order' => '4',
'is_empty' => '0',
),
12 =>
array (
'id' => '17',
'field_name' => 'address',
'use_name' => '公司地址',
'field_type' => 'text',
'field_value' => '',
'field_length' => '255',
'form_id' => '5',
'field_info' => '',
'is_disable' => '0',
'form_order' => '5',
'is_empty' => '0',
),
13 =>
array (
'id' => '23',
'field_name' => 'jobxl',
'use_name' => '学历',
'field_type' => 'text',
'field_value' => '',
'field_length' => '255',
'form_id' => '8',
'field_info' => '',
'is_disable' => '0',
'form_order' => '5',
'is_empty' => '0',
),
14 =>
array (
'id' => '37',
'field_name' => 'f_content',
'use_name' => '内容',
'field_type' => 'textarea',
'field_value' => '',
'field_length' => '255',
'form_id' => '9',
'field_info' => '',
'is_disable' => '0',
'form_order' => '5',
'is_empty' => '0',
),
15 =>
array (
'id' => '14',
'field_name' => 'content',
'use_name' => '详细内容',
'field_type' => 'textarea',
'field_value' => '',
'field_length' => '255',
'form_id' => '5',
'field_info' => '',
'is_disable' => '0',
'form_order' => '6',
'is_empty' => '0',
),
16 =>
array (
'id' => '24',
'field_name' => 'jobzy',
'use_name' => '专业',
'field_type' => 'text',
'field_value' => '',
'field_length' => '255',
'form_id' => '8',
'field_info' => '',
'is_disable' => '0',
'form_order' => '6',
'is_empty' => '0',
),
17 =>
array (
'id' => '25',
'field_name' => 'jobbyyx',
'use_name' => '毕业院校',
'field_type' => 'text',
'field_value' => '',
'field_length' => '255',
'form_id' => '8',
'field_info' => '',
'is_disable' => '0',
'form_order' => '7',
'is_empty' => '0',
),
18 =>
array (
'id' => '26',
'field_name' => 'jobphone',
'use_name' => '联系电话',
'field_type' => 'text',
'field_value' => '',
'field_length' => '255',
'form_id' => '8',
'field_info' => '',
'is_disable' => '0',
'form_order' => '8',
'is_empty' => '0',
),
19 =>
array (
'id' => '27',
'field_name' => 'jobmail',
'use_name' => 'E–mail',
'field_type' => 'text',
'field_value' => '',
'field_length' => '255',
'form_id' => '8',
'field_info' => '',
'is_disable' => '0',
'form_order' => '9',
'is_empty' => '0',
),
20 =>
array (
'id' => '28',
'field_name' => 'jobhj',
'use_name' => '所获奖项',
'field_type' => 'textarea',
'field_value' => '',
'field_length' => '255',
'form_id' => '8',
'field_info' => '',
'is_disable' => '0',
'form_order' => '10',
'is_empty' => '0',
),
21 =>
array (
'id' => '29',
'field_name' => 'jobgzjl',
'use_name' => '工作经历',
'field_type' => 'textarea',
'field_value' => '',
'field_length' => '255',
'form_id' => '8',
'field_info' => '',
'is_disable' => '0',
'form_order' => '11',
'is_empty' => '0',
),
22 =>
array (
'id' => '30',
'field_name' => 'jobzyjn',
'use_name' => '专业技能',
'field_type' => 'textarea',
'field_value' => '',
'field_length' => '255',
'form_id' => '8',
'field_info' => '',
'is_disable' => '0',
'form_order' => '12',
'is_empty' => '0',
),
23 =>
array (
'id' => '31',
'field_name' => 'jobyyah',
'use_name' => '业余爱好',
'field_type' => 'textarea',
'field_value' => '',
'field_length' => '255',
'form_id' => '8',
'field_info' => '',
'is_disable' => '0',
'form_order' => '13',
'is_empty' => '0',
),
);
?> | {
"pile_set_name": "Github"
} |
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1010"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "6877FA512056D4F100383B25"
BuildableName = "AssistantV1.framework"
BlueprintName = "AssistantV1"
ReferencedContainer = "container:WatsonDeveloperCloud.xcodeproj">
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "NO"
buildForProfiling = "NO"
buildForArchiving = "NO"
buildForAnalyzing = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "6877FA9C2056D4F500383B25"
BuildableName = "AssistantV1Tests.xctest"
BlueprintName = "AssistantV1Tests"
ReferencedContainer = "container:WatsonDeveloperCloud.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
codeCoverageEnabled = "YES"
onlyGenerateCoverageForSpecifiedTargets = "YES"
shouldUseLaunchSchemeArgsEnv = "YES">
<CodeCoverageTargets>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "6877FA512056D4F100383B25"
BuildableName = "AssistantV1.framework"
BlueprintName = "AssistantV1"
ReferencedContainer = "container:WatsonDeveloperCloud.xcodeproj">
</BuildableReference>
</CodeCoverageTargets>
<Testables>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "6877FA9C2056D4F500383B25"
BuildableName = "AssistantV1Tests.xctest"
BlueprintName = "AssistantV1Tests"
ReferencedContainer = "container:WatsonDeveloperCloud.xcodeproj">
</BuildableReference>
<SkippedTests>
<Test
Identifier = "AssistantTests/testListAllLogs()">
</Test>
<Test
Identifier = "AssistantTests/testListLogs()">
</Test>
</SkippedTests>
</TestableReference>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "6877FA512056D4F100383B25"
BuildableName = "AssistantV1.framework"
BlueprintName = "AssistantV1"
ReferencedContainer = "container:WatsonDeveloperCloud.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "6877FA512056D4F100383B25"
BuildableName = "AssistantV1.framework"
BlueprintName = "AssistantV1"
ReferencedContainer = "container:WatsonDeveloperCloud.xcodeproj">
</BuildableReference>
</MacroExpansion>
<EnvironmentVariables>
<EnvironmentVariable
key = "OS_ACTIVITY_MODE"
value = "disable"
isEnabled = "YES">
</EnvironmentVariable>
</EnvironmentVariables>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "6877FA512056D4F100383B25"
BuildableName = "AssistantV1.framework"
BlueprintName = "AssistantV1"
ReferencedContainer = "container:WatsonDeveloperCloud.xcodeproj">
</BuildableReference>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
| {
"pile_set_name": "Github"
} |
<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006~2015 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: yunwuxin <[email protected]>
// +----------------------------------------------------------------------
namespace think\console\command;
use think\console\Command;
use think\console\Input;
use think\console\input\Argument as InputArgument;
use think\console\input\Definition as InputDefinition;
use think\console\input\Option as InputOption;
use think\console\Output;
class Lists extends Command
{
/**
* {@inheritdoc}
*/
protected function configure()
{
$this->setName('list')->setDefinition($this->createDefinition())->setDescription('Lists commands')->setHelp(<<<EOF
The <info>%command.name%</info> command lists all commands:
<info>php %command.full_name%</info>
You can also display the commands for a specific namespace:
<info>php %command.full_name% test</info>
It's also possible to get raw list of commands (useful for embedding command runner):
<info>php %command.full_name% --raw</info>
EOF
);
}
/**
* {@inheritdoc}
*/
public function getNativeDefinition(): InputDefinition
{
return $this->createDefinition();
}
/**
* {@inheritdoc}
*/
protected function execute(Input $input, Output $output)
{
$output->describe($this->getConsole(), [
'raw_text' => $input->getOption('raw'),
'namespace' => $input->getArgument('namespace'),
]);
}
/**
* {@inheritdoc}
*/
private function createDefinition(): InputDefinition
{
return new InputDefinition([
new InputArgument('namespace', InputArgument::OPTIONAL, 'The namespace name'),
new InputOption('raw', null, InputOption::VALUE_NONE, 'To output raw command list'),
]);
}
}
| {
"pile_set_name": "Github"
} |
/*
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2011 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_01.txt |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| [email protected] so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Author: Ard Biesheuvel <[email protected]> |
+----------------------------------------------------------------------+
*/
/* $Id: php_pdo_firebird.h 306939 2011-01-01 02:19:59Z felipe $ */
#ifndef PHP_PDO_FIREBIRD_H
#define PHP_PDO_FIREBIRD_H
extern zend_module_entry pdo_firebird_module_entry;
#define phpext_pdo_firebird_ptr &pdo_firebird_module_entry
#ifdef ZTS
#include "TSRM.h"
#endif
PHP_MINIT_FUNCTION(pdo_firebird);
PHP_MSHUTDOWN_FUNCTION(pdo_firebird);
PHP_RINIT_FUNCTION(pdo_firebird);
PHP_RSHUTDOWN_FUNCTION(pdo_firebird);
PHP_MINFO_FUNCTION(pdo_firebird);
#endif /* PHP_PDO_FIREBIRD_H */
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* End:
* vim600: noet sw=4 ts=4 fdm=marker
* vim<600: noet sw=4 ts=4
*/
| {
"pile_set_name": "Github"
} |
/*
* Copyright 2014 Twitter, Inc.
*
* 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.
*/
package com.twitter.hpack;
import java.io.IOException;
import java.io.OutputStream;
final class HuffmanEncoder {
private final int[] codes;
private final byte[] lengths;
/**
* Creates a new Huffman encoder with the specified Huffman coding.
* @param codes the Huffman codes indexed by symbol
* @param lengths the length of each Huffman code
*/
HuffmanEncoder(int[] codes, byte[] lengths) {
this.codes = codes;
this.lengths = lengths;
}
/**
* Compresses the input string literal using the Huffman coding.
* @param out the output stream for the compressed data
* @param data the string literal to be Huffman encoded
* @throws IOException if an I/O error occurs.
* @see com.twitter.hpack.HuffmanEncoder#encode(OutputStream, byte[], int, int)
*/
public void encode(OutputStream out, byte[] data) throws IOException {
encode(out, data, 0, data.length);
}
/**
* Compresses the input string literal using the Huffman coding.
* @param out the output stream for the compressed data
* @param data the string literal to be Huffman encoded
* @param off the start offset in the data
* @param len the number of bytes to encode
* @throws IOException if an I/O error occurs. In particular,
* an <code>IOException</code> may be thrown if the
* output stream has been closed.
*/
public void encode(OutputStream out, byte[] data, int off, int len) throws IOException {
if (out == null) {
throw new NullPointerException("out");
} else if (data == null) {
throw new NullPointerException("data");
} else if (off < 0 || len < 0 || (off + len) < 0 || off > data.length || (off + len) > data.length) {
throw new IndexOutOfBoundsException();
} else if (len == 0) {
return;
}
long current = 0;
int n = 0;
for (int i = 0; i < len; i++) {
int b = data[off + i] & 0xFF;
int code = codes[b];
int nbits = lengths[b];
current <<= nbits;
current |= code;
n += nbits;
while (n >= 8) {
n -= 8;
out.write(((int)(current >> n)));
}
}
if (n > 0) {
current <<= (8 - n);
current |= (0xFF >>> n); // this should be EOS symbol
out.write((int)current);
}
}
/**
* Returns the number of bytes required to Huffman encode the input string literal.
* @param data the string literal to be Huffman encoded
* @return the number of bytes required to Huffman encode <code>data</code>
*/
public int getEncodedLength(byte[] data) {
if (data == null) {
throw new NullPointerException("data");
}
long len = 0;
for (byte b : data) {
len += lengths[b & 0xFF];
}
return (int)((len + 7) >> 3);
}
}
| {
"pile_set_name": "Github"
} |
require 'mail'
ActionMailer::Base.smtp_settings = {
:address => ENV["SMTP_ADDRESS"],
:port => 587,
:domain => ENV['SMTP_DOMAIN'],
:authentication => :plain,
:user_name => ENV['SMTP_USERNAME'],
:password => ENV['SMTP_PASSWORD'],
:enable_starttls_auto => true
}
require File.join( Rails.root, 'lib', 'development_mail_interceptor')
Mail.register_interceptor(DevelopmentMailInterceptor) if Rails.env.development? | {
"pile_set_name": "Github"
} |
FROM balenalib/amd64-alpine:3.11-build
LABEL io.balena.device-type="genericx86-64-ext"
RUN apk add --update \
less \
nano \
net-tools \
ifupdown \
usbutils \
gnupg \
&& rm -rf /var/cache/apk/*
RUN [ ! -d /.balena/messages ] && mkdir -p /.balena/messages; echo $'Here are a few details about this Docker image (For more information please visit https://www.balena.io/docs/reference/base-images/base-images/): \nArchitecture: Intel 64-bit (x86-64) \nOS: Alpine Linux 3.11 \nVariant: build variant \nDefault variable(s): UDEV=off \nExtra features: \n- Easy way to install packages with `install_packages <package-name>` command \n- Run anywhere with cross-build feature (for ARM only) \n- Keep the container idling with `balena-idle` command \n- Show base image details with `balena-info` command' > /.balena/messages/image-info
RUN echo $'#!/bin/bash\nbalena-info\nbusybox ln -sf /bin/busybox /bin/sh\n/bin/sh "$@"' > /bin/sh-shim \
&& chmod +x /bin/sh-shim \
&& ln -f /bin/sh /bin/sh.real \
&& ln -f /bin/sh-shim /bin/sh | {
"pile_set_name": "Github"
} |
<?php
namespace Guzzle\Tests\Plugin\Mock;
use Guzzle\Common\Event;
use Guzzle\Http\EntityBody;
use Guzzle\Http\Message\Response;
use Guzzle\Plugin\Mock\MockPlugin;
use Guzzle\Http\Client;
/**
* @covers Guzzle\Plugin\Mock\MockPlugin
*/
class MockPluginTest extends \Guzzle\Tests\GuzzleTestCase
{
public function testDescribesSubscribedEvents()
{
$this->assertInternalType('array', MockPlugin::getSubscribedEvents());
}
public function testDescribesEvents()
{
$this->assertInternalType('array', MockPlugin::getAllEvents());
}
public function testCanBeTemporary()
{
$plugin = new MockPlugin();
$this->assertFalse($plugin->isTemporary());
$plugin = new MockPlugin(null, true);
$this->assertTrue($plugin->isTemporary());
}
public function testIsCountable()
{
$plugin = new MockPlugin();
$plugin->addResponse(Response::fromMessage("HTTP/1.1 200 OK\r\nContent-Length: 0\r\n\r\n"));
$this->assertEquals(1, count($plugin));
}
/**
* @depends testIsCountable
*/
public function testCanClearQueue()
{
$plugin = new MockPlugin();
$plugin->addResponse(Response::fromMessage("HTTP/1.1 200 OK\r\nContent-Length: 0\r\n\r\n"));
$plugin->clearQueue();
$this->assertEquals(0, count($plugin));
}
public function testCanInspectQueue()
{
$plugin = new MockPlugin();
$this->assertInternalType('array', $plugin->getQueue());
$plugin->addResponse(Response::fromMessage("HTTP/1.1 200 OK\r\nContent-Length: 0\r\n\r\n"));
$queue = $plugin->getQueue();
$this->assertInternalType('array', $queue);
$this->assertEquals(1, count($queue));
}
public function testRetrievesResponsesFromFiles()
{
$response = MockPlugin::getMockFile(__DIR__ . '/../../TestData/mock_response');
$this->assertInstanceOf('Guzzle\\Http\\Message\\Response', $response);
$this->assertEquals(200, $response->getStatusCode());
}
/**
* @expectedException InvalidArgumentException
*/
public function testThrowsExceptionWhenResponseFileIsNotFound()
{
MockPlugin::getMockFile('missing/filename');
}
/**
* @expectedException InvalidArgumentException
*/
public function testInvalidResponsesThrowAnException()
{
$p = new MockPlugin();
$p->addResponse($this);
}
public function testAddsResponseObjectsToQueue()
{
$p = new MockPlugin();
$response = Response::fromMessage("HTTP/1.1 200 OK\r\nContent-Length: 0\r\n\r\n");
$p->addResponse($response);
$this->assertEquals(array($response), $p->getQueue());
}
public function testAddsResponseFilesToQueue()
{
$p = new MockPlugin();
$p->addResponse(__DIR__ . '/../../TestData/mock_response');
$this->assertEquals(1, count($p));
}
/**
* @depends testAddsResponseFilesToQueue
*/
public function testAddsMockResponseToRequestFromClient()
{
$p = new MockPlugin();
$response = MockPlugin::getMockFile(__DIR__ . '/../../TestData/mock_response');
$p->addResponse($response);
$client = new Client('http://localhost:123/');
$client->getEventDispatcher()->addSubscriber($p, 9999);
$request = $client->get();
$request->send();
$this->assertSame($response, $request->getResponse());
$this->assertEquals(0, count($p));
}
/**
* @depends testAddsResponseFilesToQueue
*/
public function testUpdateIgnoresWhenEmpty()
{
$p = new MockPlugin();
$p->onRequestCreate(new Event());
}
/**
* @depends testAddsMockResponseToRequestFromClient
*/
public function testDetachesTemporaryWhenEmpty()
{
$p = new MockPlugin(null, true);
$p->addResponse(MockPlugin::getMockFile(__DIR__ . '/../../TestData/mock_response'));
$client = new Client('http://localhost:123/');
$client->getEventDispatcher()->addSubscriber($p, 9999);
$request = $client->get();
$request->send();
$this->assertFalse($this->hasSubscriber($client, $p));
}
public function testLoadsResponsesFromConstructor()
{
$p = new MockPlugin(array(new Response(200)));
$this->assertEquals(1, $p->count());
}
public function testStoresMockedRequests()
{
$p = new MockPlugin(array(new Response(200), new Response(200)));
$client = new Client('http://localhost:123/');
$client->getEventDispatcher()->addSubscriber($p, 9999);
$request1 = $client->get();
$request1->send();
$this->assertEquals(array($request1), $p->getReceivedRequests());
$request2 = $client->get();
$request2->send();
$this->assertEquals(array($request1, $request2), $p->getReceivedRequests());
$p->flush();
$this->assertEquals(array(), $p->getReceivedRequests());
}
public function testReadsBodiesFromMockedRequests()
{
$p = new MockPlugin(array(new Response(200)));
$p->readBodies(true);
$client = new Client('http://localhost:123/');
$client->getEventDispatcher()->addSubscriber($p, 9999);
$body = EntityBody::factory('foo');
$request = $client->put();
$request->setBody($body);
$request->send();
$this->assertEquals(3, $body->ftell());
}
}
| {
"pile_set_name": "Github"
} |
$NetBSD: patch-ak,v 1.3 2010/02/22 21:58:47 wiz Exp $
--- linuxdoom-1.10/info.h.orig Mon Dec 22 20:11:18 1997
+++ linuxdoom-1.10/info.h Thu Feb 3 01:33:51 2000
@@ -1156,7 +1156,8 @@
} state_t;
extern state_t states[NUMSTATES];
-extern char *sprnames[NUMSPRITES];
+/* R_InitSpriteDefs insists on a NULL terminated list, add one for NULL. (jfw) */
+extern char *sprnames[NUMSPRITES+1];
| {
"pile_set_name": "Github"
} |
workspace(name = "com_google_dimsum")
http_archive(
name = "com_google_googletest",
urls = ["https://github.com/google/googletest/archive/master.zip"],
strip_prefix = "googletest-master",
)
| {
"pile_set_name": "Github"
} |
var convert = require('./convert'),
func = convert('forInRight', require('../forInRight'));
func.placeholder = require('./placeholder');
module.exports = func;
| {
"pile_set_name": "Github"
} |
using System;
using NetOffice;
using NetOffice.Attributes;
namespace NetOffice.OutlookApi.Enums
{
/// <summary>
/// SupportByVersion Outlook 12, 14, 15, 16
/// </summary>
///<remarks> MSDN Online Documentation: http://msdn.microsoft.com/en-us/en-us/library/office/ff867485.aspx </remarks>
[SupportByVersion("Outlook", 12,14,15,16)]
[EntityType(EntityType.IsEnum)]
public enum OlAccountType
{
/// <summary>
/// SupportByVersion Outlook 12, 14, 15, 16
/// </summary>
/// <remarks>0</remarks>
[SupportByVersion("Outlook", 12,14,15,16)]
olExchange = 0,
/// <summary>
/// SupportByVersion Outlook 12, 14, 15, 16
/// </summary>
/// <remarks>1</remarks>
[SupportByVersion("Outlook", 12,14,15,16)]
olImap = 1,
/// <summary>
/// SupportByVersion Outlook 12, 14, 15, 16
/// </summary>
/// <remarks>2</remarks>
[SupportByVersion("Outlook", 12,14,15,16)]
olPop3 = 2,
/// <summary>
/// SupportByVersion Outlook 12, 14, 15, 16
/// </summary>
/// <remarks>3</remarks>
[SupportByVersion("Outlook", 12,14,15,16)]
olHttp = 3,
/// <summary>
/// SupportByVersion Outlook 12, 14, 15, 16
/// </summary>
/// <remarks>5</remarks>
[SupportByVersion("Outlook", 12,14,15,16)]
olOtherAccount = 5,
/// <summary>
/// SupportByVersion Outlook 15,16
/// </summary>
/// <remarks>4</remarks>
[SupportByVersion("Outlook", 15, 16)]
olEas = 4
}
} | {
"pile_set_name": "Github"
} |
/*
* Copyright (C) Lightbend Inc. <https://www.lightbend.com>
*/
package play.core.server.ssl
import sun.security.x509._
import java.security.cert._
import java.security._
import java.math.BigInteger
import java.util.Date
import sun.security.util.ObjectIdentifier
import java.time.Duration
import java.time.Instant
/**
* Used for testing only. This relies on internal sun.security packages, so cannot be used in OpenJDK.
*/
object CertificateGenerator {
// http://docs.oracle.com/javase/8/docs/technotes/guides/security/StandardNames.html#KeyPairGenerator
// http://www.keylength.com/en/4/
/**
* Generates a certificate using RSA (which is available in 1.6).
*/
def generateRSAWithSHA256(
keySize: Int = 2048,
from: Instant = Instant.now,
duration: Duration = Duration.ofDays(365)
): X509Certificate = {
val dn = "CN=localhost, OU=Unit Testing, O=Mavericks, L=Play Base 1, ST=Cyberspace, C=CY"
val to = from.plus(duration)
val keyGen = KeyPairGenerator.getInstance("RSA")
keyGen.initialize(keySize, new SecureRandom())
val pair = keyGen.generateKeyPair()
generateCertificate(
dn,
pair,
Date.from(from),
Date.from(to),
"SHA256withRSA",
AlgorithmId.sha256WithRSAEncryption_oid
)
}
def generateRSAWithSHA1(
keySize: Int = 2048,
from: Instant = Instant.now,
duration: Duration = Duration.ofDays(365)
): X509Certificate = {
val dn = "CN=localhost, OU=Unit Testing, O=Mavericks, L=Play Base 1, ST=Cyberspace, C=CY"
val to = from.plus(duration)
val keyGen = KeyPairGenerator.getInstance("RSA")
keyGen.initialize(keySize, new SecureRandom())
val pair = keyGen.generateKeyPair()
generateCertificate(
dn,
pair,
Date.from(from),
Date.from(to),
"SHA1withRSA",
AlgorithmId.sha256WithRSAEncryption_oid
)
}
def toPEM(certificate: X509Certificate) = {
val encoder = java.util.Base64.getMimeEncoder(64, Array('\r', '\n'))
val certBegin = "-----BEGIN CERTIFICATE-----\n"
val certEnd = "-----END CERTIFICATE-----"
val derCert = certificate.getEncoded()
val pemCertPre = new String(encoder.encode(derCert), "UTF-8")
val pemCert = certBegin + pemCertPre + certEnd
pemCert
}
def generateRSAWithMD5(
keySize: Int = 2048,
from: Instant = Instant.now,
duration: Duration = Duration.ofDays(365)
): X509Certificate = {
val dn = "CN=localhost, OU=Unit Testing, O=Mavericks, L=Play Base 1, ST=Cyberspace, C=CY"
val to = from.plus(duration)
val keyGen = KeyPairGenerator.getInstance("RSA")
keyGen.initialize(keySize, new SecureRandom())
val pair = keyGen.generateKeyPair()
generateCertificate(dn, pair, Date.from(from), Date.from(to), "MD5WithRSA", AlgorithmId.md5WithRSAEncryption_oid)
}
private[play] def generateCertificate(
dn: String,
pair: KeyPair,
from: Date,
to: Date,
algorithm: String,
oid: ObjectIdentifier
): X509Certificate = {
val info: X509CertInfo = new X509CertInfo
val interval: CertificateValidity = new CertificateValidity(from, to)
// I have no idea why 64 bits specifically are used for the certificate serial number.
val sn: BigInteger = new BigInteger(64, new SecureRandom)
val owner: X500Name = new X500Name(dn)
info.set(X509CertInfo.VALIDITY, interval)
info.set(X509CertInfo.SERIAL_NUMBER, new CertificateSerialNumber(sn))
info.set(X509CertInfo.SUBJECT, owner)
info.set(X509CertInfo.ISSUER, owner)
info.set(X509CertInfo.KEY, new CertificateX509Key(pair.getPublic))
info.set(X509CertInfo.VERSION, new CertificateVersion(CertificateVersion.V3))
var algo: AlgorithmId = new AlgorithmId(oid)
info.set(X509CertInfo.ALGORITHM_ID, new CertificateAlgorithmId(algo))
var cert: X509CertImpl = new X509CertImpl(info)
val privkey: PrivateKey = pair.getPrivate
cert.sign(privkey, algorithm)
algo = cert.get(X509CertImpl.SIG_ALG).asInstanceOf[AlgorithmId]
info.set(CertificateAlgorithmId.NAME + "." + CertificateAlgorithmId.ALGORITHM, algo)
cert = new X509CertImpl(info)
cert.sign(privkey, algorithm)
cert
}
}
| {
"pile_set_name": "Github"
} |
CSSStyleDeclaration
===================
CSSStyleDeclaration is a work-a-like to the CSSStyleDeclaration class in Nikita Vasilyev's [CSSOM](https://github.com/NV/CSSOM). I made it so that when using [jQuery in node](https://github.com/tmtk75/node-jquery) setting css attributes via $.fn.css() would work. node-jquery uses [jsdom](https://github.com/tmpvar/jsdom) to create a DOM to use in node. jsdom uses CSSOM for styling, and CSSOM's implementation of the [CSSStyleDeclaration](http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-CSSStyleDeclaration) doesn't support [CSS2Properties](http://www.w3.org/TR/DOM-Level-2-Style/css.html#CSS-CSS2Properties), which is how jQuery's [$.fn.css()](http://api.jquery.com/css/) operates.
Why not just issue a pull request?
----
Well, NV wants to keep CSSOM fast (which I can appreciate) and CSS2Properties aren't required by the standard (though every browser has the interface). So I figured the path of least resistence would be to just modify this one class, publish it as a node module (that requires CSSOM) and then make a pull request of jsdom to use it.
How do I test this code?
---
`npm test` should do the trick, assuming you have the dev dependencies installed:
> ```
> $ npm test
>
> tests
> ✔ Verify Has Properties
> ✔ Verify Has Functions
> ✔ Verify Has Special Properties
> ✔ Test From Style String
> ✔ Test From Properties
> ✔ Test Shorthand Properties
> ✔ Test width and height Properties and null and empty strings
> ✔ Test Implicit Properties
> ```
| {
"pile_set_name": "Github"
} |
<?php
namespace Illuminate\Contracts\Validation;
use Illuminate\Contracts\Support\MessageProvider;
interface Validator extends MessageProvider
{
/**
* Run the validator's rules against its data.
*
* @return array
*/
public function validate();
/**
* Get the attributes and values that were validated.
*
* @return array
*/
public function validated();
/**
* Determine if the data fails the validation rules.
*
* @return bool
*/
public function fails();
/**
* Get the failed validation rules.
*
* @return array
*/
public function failed();
/**
* Add conditions to a given field based on a Closure.
*
* @param string|array $attribute
* @param string|array $rules
* @param callable $callback
* @return $this
*/
public function sometimes($attribute, $rules, callable $callback);
/**
* Add an after validation callback.
*
* @param callable|string $callback
* @return $this
*/
public function after($callback);
/**
* Get all of the validation error messages.
*
* @return \Illuminate\Support\MessageBag
*/
public function errors();
}
| {
"pile_set_name": "Github"
} |
package net.minecraft.server;
public class BlockLever extends Block {
protected BlockLever() {
super(Material.ORIENTABLE);
this.a(CreativeModeTab.d);
}
public AxisAlignedBB a(World world, int i, int j, int k) {
return null;
}
public boolean c() {
return false;
}
public boolean d() {
return false;
}
public int b() {
return 12;
}
public boolean canPlace(World world, int i, int j, int k, int l) {
return l == 0 && world.getType(i, j + 1, k).r() ? true : (l == 1 && World.a((IBlockAccess) world, i, j - 1, k) ? true : (l == 2 && world.getType(i, j, k + 1).r() ? true : (l == 3 && world.getType(i, j, k - 1).r() ? true : (l == 4 && world.getType(i + 1, j, k).r() ? true : l == 5 && world.getType(i - 1, j, k).r()))));
}
public boolean canPlace(World world, int i, int j, int k) {
return world.getType(i - 1, j, k).r() ? true : (world.getType(i + 1, j, k).r() ? true : (world.getType(i, j, k - 1).r() ? true : (world.getType(i, j, k + 1).r() ? true : (World.a((IBlockAccess) world, i, j - 1, k) ? true : world.getType(i, j + 1, k).r()))));
}
public int getPlacedData(World world, int i, int j, int k, int l, float f, float f1, float f2, int i1) {
int j1 = i1 & 8;
int k1 = i1 & 7;
byte b0 = -1;
if (l == 0 && world.getType(i, j + 1, k).r()) {
b0 = 0;
}
if (l == 1 && World.a((IBlockAccess) world, i, j - 1, k)) {
b0 = 5;
}
if (l == 2 && world.getType(i, j, k + 1).r()) {
b0 = 4;
}
if (l == 3 && world.getType(i, j, k - 1).r()) {
b0 = 3;
}
if (l == 4 && world.getType(i + 1, j, k).r()) {
b0 = 2;
}
if (l == 5 && world.getType(i - 1, j, k).r()) {
b0 = 1;
}
return b0 + j1;
}
public void postPlace(World world, int i, int j, int k, EntityLiving entityliving, ItemStack itemstack) {
int l = world.getData(i, j, k);
int i1 = l & 7;
int j1 = l & 8;
if (i1 == b(1)) {
if ((MathHelper.floor((double) (entityliving.yaw * 4.0F / 360.0F) + 0.5D) & 1) == 0) {
world.setData(i, j, k, 5 | j1, 2);
} else {
world.setData(i, j, k, 6 | j1, 2);
}
} else if (i1 == b(0)) {
if ((MathHelper.floor((double) (entityliving.yaw * 4.0F / 360.0F) + 0.5D) & 1) == 0) {
world.setData(i, j, k, 7 | j1, 2);
} else {
world.setData(i, j, k, 0 | j1, 2);
}
}
}
public static int b(int i) {
switch (i) {
case 0:
return 0;
case 1:
return 5;
case 2:
return 4;
case 3:
return 3;
case 4:
return 2;
case 5:
return 1;
default:
return -1;
}
}
public void doPhysics(World world, int i, int j, int k, Block block) {
if (this.e(world, i, j, k)) {
int l = world.getData(i, j, k) & 7;
boolean flag = false;
if (!world.getType(i - 1, j, k).r() && l == 1) {
flag = true;
}
if (!world.getType(i + 1, j, k).r() && l == 2) {
flag = true;
}
if (!world.getType(i, j, k - 1).r() && l == 3) {
flag = true;
}
if (!world.getType(i, j, k + 1).r() && l == 4) {
flag = true;
}
if (!World.a((IBlockAccess) world, i, j - 1, k) && l == 5) {
flag = true;
}
if (!World.a((IBlockAccess) world, i, j - 1, k) && l == 6) {
flag = true;
}
if (!world.getType(i, j + 1, k).r() && l == 0) {
flag = true;
}
if (!world.getType(i, j + 1, k).r() && l == 7) {
flag = true;
}
if (flag) {
this.b(world, i, j, k, world.getData(i, j, k), 0);
world.setAir(i, j, k);
}
}
}
private boolean e(World world, int i, int j, int k) {
if (!this.canPlace(world, i, j, k)) {
this.b(world, i, j, k, world.getData(i, j, k), 0);
world.setAir(i, j, k);
return false;
} else {
return true;
}
}
public void updateShape(IBlockAccess iblockaccess, int i, int j, int k) {
int l = iblockaccess.getData(i, j, k) & 7;
float f = 0.1875F;
if (l == 1) {
this.a(0.0F, 0.2F, 0.5F - f, f * 2.0F, 0.8F, 0.5F + f);
} else if (l == 2) {
this.a(1.0F - f * 2.0F, 0.2F, 0.5F - f, 1.0F, 0.8F, 0.5F + f);
} else if (l == 3) {
this.a(0.5F - f, 0.2F, 0.0F, 0.5F + f, 0.8F, f * 2.0F);
} else if (l == 4) {
this.a(0.5F - f, 0.2F, 1.0F - f * 2.0F, 0.5F + f, 0.8F, 1.0F);
} else if (l != 5 && l != 6) {
if (l == 0 || l == 7) {
f = 0.25F;
this.a(0.5F - f, 0.4F, 0.5F - f, 0.5F + f, 1.0F, 0.5F + f);
}
} else {
f = 0.25F;
this.a(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, 0.6F, 0.5F + f);
}
}
public boolean interact(World world, int i, int j, int k, EntityHuman entityhuman, int l, float f, float f1, float f2) {
if (world.isStatic) {
return true;
} else {
int i1 = world.getData(i, j, k);
int j1 = i1 & 7;
int k1 = 8 - (i1 & 8);
world.setData(i, j, k, j1 + k1, 3);
world.makeSound((double) i + 0.5D, (double) j + 0.5D, (double) k + 0.5D, "random.click", 0.3F, k1 > 0 ? 0.6F : 0.5F);
world.applyPhysics(i, j, k, this);
if (j1 == 1) {
world.applyPhysics(i - 1, j, k, this);
} else if (j1 == 2) {
world.applyPhysics(i + 1, j, k, this);
} else if (j1 == 3) {
world.applyPhysics(i, j, k - 1, this);
} else if (j1 == 4) {
world.applyPhysics(i, j, k + 1, this);
} else if (j1 != 5 && j1 != 6) {
if (j1 == 0 || j1 == 7) {
world.applyPhysics(i, j + 1, k, this);
}
} else {
world.applyPhysics(i, j - 1, k, this);
}
return true;
}
}
public void remove(World world, int i, int j, int k, Block block, int l) {
if ((l & 8) > 0) {
world.applyPhysics(i, j, k, this);
int i1 = l & 7;
if (i1 == 1) {
world.applyPhysics(i - 1, j, k, this);
} else if (i1 == 2) {
world.applyPhysics(i + 1, j, k, this);
} else if (i1 == 3) {
world.applyPhysics(i, j, k - 1, this);
} else if (i1 == 4) {
world.applyPhysics(i, j, k + 1, this);
} else if (i1 != 5 && i1 != 6) {
if (i1 == 0 || i1 == 7) {
world.applyPhysics(i, j + 1, k, this);
}
} else {
world.applyPhysics(i, j - 1, k, this);
}
}
super.remove(world, i, j, k, block, l);
}
public int b(IBlockAccess iblockaccess, int i, int j, int k, int l) {
return (iblockaccess.getData(i, j, k) & 8) > 0 ? 15 : 0;
}
public int c(IBlockAccess iblockaccess, int i, int j, int k, int l) {
int i1 = iblockaccess.getData(i, j, k);
if ((i1 & 8) == 0) {
return 0;
} else {
int j1 = i1 & 7;
return j1 == 0 && l == 0 ? 15 : (j1 == 7 && l == 0 ? 15 : (j1 == 6 && l == 1 ? 15 : (j1 == 5 && l == 1 ? 15 : (j1 == 4 && l == 2 ? 15 : (j1 == 3 && l == 3 ? 15 : (j1 == 2 && l == 4 ? 15 : (j1 == 1 && l == 5 ? 15 : 0)))))));
}
}
public boolean isPowerSource() {
return true;
}
}
| {
"pile_set_name": "Github"
} |
---
date: 2019-04-08
title: S02E04 CSS layout
participants:
- bloodyowl
- DaPo
- zoontek
- MoOx
slug: s02e04-css-layout
soundcloudTrackId: "629607747"
---
Un épisode avec :
- Maxime (https://twitter.com/MoOx)
- Mathieu (https://twitter.com/Zoontek)
- Cyril (https://twitter.com/IAmNotCyril)
- Matthias (https://twitter.com/bloodyowl)
Liens:
- Flexbox: https://css-tricks.com/snippets/css/a-guide-to-flexbox/
- Grid: https://css-tricks.com/snippets/css/complete-guide-grid/
| {
"pile_set_name": "Github"
} |
/**
*
*/
package com.u8.server.sdk.jinli.jinli;
/*
* Copyright (C) 2010 The Android Open Source Project
*
* 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.
*/
import java.io.UnsupportedEncodingException;
/**
* Utilities for encoding and decoding the Base64 representation of binary data. See RFCs <a href="http://www.ietf.org/rfc/rfc2045.txt">2045</a> and
* <a href="http://www.ietf.org/rfc/rfc3548.txt">3548</a>.
*/
public class JinLiBase64 {
/**
* Default values for encoder/decoder flags.
*/
public static final int DEFAULT = 0;
/**
* Encoder flag bit to omit the padding '=' characters at the end of the output (if any).
*/
public static final int NO_PADDING = 1;
/**
* Encoder flag bit to omit all line terminators (i.e., the output will be on one long line).
*/
public static final int NO_WRAP = 2;
/**
* Encoder flag bit to indicate lines should be terminated with a CRLF pair instead of just an LF. Has no effect if {@code NO_WRAP} is specified
* as well.
*/
public static final int CRLF = 4;
/**
* Encoder/decoder flag bit to indicate using the "URL and filename safe" variant of Base64 (see RFC 3548 section 4) where {@code -} and {@code _}
* are used in place of {@code +} and {@code /}.
*/
public static final int URL_SAFE = 8;
/**
* Flag to pass to {@link Base64OutputStream} to indicate that it should not close the output stream it is wrapping when it itself is closed.
*/
public static final int NO_CLOSE = 16;
// --------------------------------------------------------
// shared code
// --------------------------------------------------------
/* package */static abstract class Coder {
public byte[] output;
public int op;
/**
* Encode/decode another block of input data. this.output is provided by the caller, and must be big enough to hold all the coded data. On
* exit, this.opwill be set to the length of the coded data.
*
* @param finish
* true if this is the final call to process for this object. Will finalize the coder state and include any final bytes in the
* output.
*
* @return true if the input so far is good; false if some error has been detected in the input stream..
*/
public abstract boolean process(byte[] input, int offset, int len, boolean finish);
/**
* @return the maximum number of bytes a call to process() could produce for the given number of input bytes. This may be an overestimate.
*/
public abstract int maxOutputSize(int len);
}
// --------------------------------------------------------
// decoding
// --------------------------------------------------------
/**
* Decode the Base64-encoded data in input and return the data in a new byte array.
*
* <p>
* The padding '=' characters at the end are considered optional, but if any are present, there must be the correct number of them.
*
* @param str
* the input String to decode, which is converted to bytes using the default charset
* @param flags
* controls certain features of the decoded output. Pass {@code DEFAULT} to decode standard Base64.
*
* @throws IllegalArgumentException
* if the input contains incorrect padding
*/
public static byte[] decode(String str, int flags) {
return decode(str.getBytes(), flags);
}
/**
* Decode the Base64-encoded data in input and return the data in a new byte array.
*
* <p>
* The padding '=' characters at the end are considered optional, but if any are present, there must be the correct number of them.
*
* @param input
* the input array to decode
* @param flags
* controls certain features of the decoded output. Pass {@code DEFAULT} to decode standard Base64.
*
* @throws IllegalArgumentException
* if the input contains incorrect padding
*/
public static byte[] decode(byte[] input, int flags) {
return decode(input, 0, input.length, flags);
}
/**
* Decode the Base64-encoded data in input and return the data in a new byte array.
*
* <p>
* The padding '=' characters at the end are considered optional, but if any are present, there must be the correct number of them.
*
* @param input
* the data to decode
* @param offset
* the position within the input array at which to start
* @param len
* the number of bytes of input to decode
* @param flags
* controls certain features of the decoded output. Pass {@code DEFAULT} to decode standard Base64.
*
* @throws IllegalArgumentException
* if the input contains incorrect padding
*/
public static byte[] decode(byte[] input, int offset, int len, int flags) {
// Allocate space for the most data the input could represent.
// (It could contain less if it contains whitespace, etc.)
Decoder decoder = new Decoder(flags, new byte[len * 3 / 4]);
if (!decoder.process(input, offset, len, true)) {
throw new IllegalArgumentException("bad base-64");
}
// Maybe we got lucky and allocated exactly enough output space.
if (decoder.op == decoder.output.length) {
return decoder.output;
}
// Need to shorten the array, so allocate a new one of the
// right size and copy.
byte[] temp = new byte[decoder.op];
System.arraycopy(decoder.output, 0, temp, 0, decoder.op);
return temp;
}
/* package */static class Decoder extends Coder {
/**
* Lookup table for turning bytes into their position in the Base64 alphabet.
*/
private static final int DECODE[] = { -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, 62, -1, -1, -1, 63, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -1,
-1, -1, -2, -1, -1, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1,
-1, -1, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, -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, -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, -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,};
/**
* Decode lookup table for the "web safe" variant (RFC 3548 sec. 4) where - and _ replace + and /.
*/
private static final int DECODE_WEBSAFE[] = { -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, 62, -1, -1, 52, 53, 54, 55, 56, 57, 58, 59, 60,
61, -1, -1, -1, -2, -1, -1, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1,
-1, -1, 63, -1, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, -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, -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, -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,};
/** Non-data values in the DECODE arrays. */
private static final int SKIP = -1;
private static final int EQUALS = -2;
/**
* States 0-3 are reading through the next input tuple. State 4 is having read one '=' and expecting exactly one more. State 5 is expecting no
* more data or padding characters in the input. State 6 is the error state; an error has been detected in the input and no future input can
* "fix" it.
*/
private int state; // state number (0 to 6)
private int value;
final private int[] alphabet;
public Decoder(int flags, byte[] output) {
this.output = output;
alphabet = ((flags & URL_SAFE) == 0) ? DECODE : DECODE_WEBSAFE;
state = 0;
value = 0;
}
/**
* @return an overestimate for the number of bytes {@code len} bytes could decode to.
*/
public int maxOutputSize(int len) {
return len * 3 / 4 + 10;
}
/**
* Decode another block of input data.
*
* @return true if the state machine is still healthy. false if bad base-64 data has been detected in the input stream.
*/
public boolean process(byte[] input, int offset, int len, boolean finish) {
if (this.state == 6)
return false;
int p = offset;
len += offset;
// Using local variables makes the decoder about 12%
// faster than if we manipulate the member variables in
// the loop. (Even alphabet makes a measurable
// difference, which is somewhat surprising to me since
// the member variable is final.)
int state = this.state;
int value = this.value;
int op = 0;
final byte[] output = this.output;
final int[] alphabet = this.alphabet;
while (p < len) {
// Try the fast path: we're starting a new tuple and the
// next four bytes of the input stream are all data
// bytes. This corresponds to going through states
// 0-1-2-3-0. We expect to use this method for most of
// the data.
//
// If any of the next four bytes of input are non-data
// (whitespace, etc.), value will end up negative. (All
// the non-data values in decode are small negative
// numbers, so shifting any of them up and or'ing them
// together will result in a value with its top bit set.)
//
// You can remove this whole block and the output should
// be the same, just slower.
if (state == 0) {
while (p + 4 <= len
&& (value = ((alphabet[input[p] & 0xff] << 18) | (alphabet[input[p + 1] & 0xff] << 12)
| (alphabet[input[p + 2] & 0xff] << 6) | (alphabet[input[p + 3] & 0xff]))) >= 0) {
output[op + 2] = (byte) value;
output[op + 1] = (byte) (value >> 8);
output[op] = (byte) (value >> 16);
op += 3;
p += 4;
}
if (p >= len)
break;
}
// The fast path isn't available -- either we've read a
// partial tuple, or the next four input bytes aren't all
// data, or whatever. Fall back to the slower state
// machine implementation.
int d = alphabet[input[p++] & 0xff];
switch (state) {
case 0:
if (d >= 0) {
value = d;
++state;
} else if (d != SKIP) {
this.state = 6;
return false;
}
break;
case 1:
if (d >= 0) {
value = (value << 6) | d;
++state;
} else if (d != SKIP) {
this.state = 6;
return false;
}
break;
case 2:
if (d >= 0) {
value = (value << 6) | d;
++state;
} else if (d == EQUALS) {
// Emit the last (partial) output tuple;
// expect exactly one more padding character.
output[op++] = (byte) (value >> 4);
state = 4;
} else if (d != SKIP) {
this.state = 6;
return false;
}
break;
case 3:
if (d >= 0) {
// Emit the output triple and return to state 0.
value = (value << 6) | d;
output[op + 2] = (byte) value;
output[op + 1] = (byte) (value >> 8);
output[op] = (byte) (value >> 16);
op += 3;
state = 0;
} else if (d == EQUALS) {
// Emit the last (partial) output tuple;
// expect no further data or padding characters.
output[op + 1] = (byte) (value >> 2);
output[op] = (byte) (value >> 10);
op += 2;
state = 5;
} else if (d != SKIP) {
this.state = 6;
return false;
}
break;
case 4:
if (d == EQUALS) {
++state;
} else if (d != SKIP) {
this.state = 6;
return false;
}
break;
case 5:
if (d != SKIP) {
this.state = 6;
return false;
}
break;
}
}
if (!finish) {
// We're out of input, but a future call could provide
// more.
this.state = state;
this.value = value;
this.op = op;
return true;
}
// Done reading input. Now figure out where we are left in
// the state machine and finish up.
switch (state) {
case 0:
// Output length is a multiple of three. Fine.
break;
case 1:
// Read one extra input byte, which isn't enough to
// make another output byte. Illegal.
this.state = 6;
return false;
case 2:
// Read two extra input bytes, enough to emit 1 more
// output byte. Fine.
output[op++] = (byte) (value >> 4);
break;
case 3:
// Read three extra input bytes, enough to emit 2 more
// output bytes. Fine.
output[op++] = (byte) (value >> 10);
output[op++] = (byte) (value >> 2);
break;
case 4:
// Read one padding '=' when we expected 2. Illegal.
this.state = 6;
return false;
case 5:
// Read all the padding '='s we expected and no more.
// Fine.
break;
}
this.state = state;
this.op = op;
return true;
}
}
// --------------------------------------------------------
// encoding
// --------------------------------------------------------
/**
* Base64-encode the given data and return a newly allocated String with the result.
*
* @param input
* the data to encode
* @param flags
* controls certain features of the encoded output. Passing {@code DEFAULT} results in output that adheres to RFC 2045.
*/
public static String encodeToString(byte[] input, int flags) {
try {
return new String(encode(input, flags), "US-ASCII");
} catch (UnsupportedEncodingException e) {
// US-ASCII is guaranteed to be available.
throw new AssertionError(e);
}
}
/**
* Base64-encode the given data and return a newly allocated String with the result.
*
* @param input
* the data to encode
* @param offset
* the position within the input array at which to start
* @param len
* the number of bytes of input to encode
* @param flags
* controls certain features of the encoded output. Passing {@code DEFAULT} results in output that adheres to RFC 2045.
*/
public static String encodeToString(byte[] input, int offset, int len, int flags) {
try {
return new String(encode(input, offset, len, flags), "US-ASCII");
} catch (UnsupportedEncodingException e) {
// US-ASCII is guaranteed to be available.
throw new AssertionError(e);
}
}
/**
* Base64-encode the given data and return a newly allocated byte[] with the result.
*
* @param input
* the data to encode
* @param flags
* controls certain features of the encoded output. Passing {@code DEFAULT} results in output that adheres to RFC 2045.
*/
public static byte[] encode(byte[] input, int flags) {
return encode(input, 0, input.length, flags);
}
/**
* Base64-encode the given data and return a newly allocated byte[] with the result.
*
* @param input
* the data to encode
* @param offset
* the position within the input array at which to start
* @param len
* the number of bytes of input to encode
* @param flags
* controls certain features of the encoded output. Passing {@code DEFAULT} results in output that adheres to RFC 2045.
*/
public static byte[] encode(byte[] input, int offset, int len, int flags) {
Encoder encoder = new Encoder(flags, null);
// Compute the exact length of the array we will produce.
int output_len = len / 3 * 4;
// Account for the tail of the data and the padding bytes, if any.
if (encoder.do_padding) {
if (len % 3 > 0) {
output_len += 4;
}
} else {
switch (len % 3) {
case 0:
break;
case 1:
output_len += 2;
break;
case 2:
output_len += 3;
break;
}
}
// Account for the newlines, if any.
if (encoder.do_newline && len > 0) {
output_len += (((len - 1) / (3 * Encoder.LINE_GROUPS)) + 1) * (encoder.do_cr ? 2 : 1);
}
encoder.output = new byte[output_len];
encoder.process(input, offset, len, true);
assert encoder.op == output_len;
return encoder.output;
}
/* package */static class Encoder extends Coder {
/**
* Emit a new line every this many output tuples. Corresponds to a 76-character line length (the maximum allowable according to <a
* href="http://www.ietf.org/rfc/rfc2045.txt">RFC 2045</a>).
*/
public static final int LINE_GROUPS = 19;
/**
* Lookup table for turning Base64 alphabet positions (6 bits) into output bytes.
*/
private static final byte ENCODE[] = { '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', '+', '/',};
/**
* Lookup table for turning Base64 alphabet positions (6 bits) into output bytes.
*/
private static final byte ENCODE_WEBSAFE[] = { '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', '-', '_',};
final private byte[] tail;
/* package */int tailLen;
private int count;
final public boolean do_padding;
final public boolean do_newline;
final public boolean do_cr;
final private byte[] alphabet;
public Encoder(int flags, byte[] output) {
this.output = output;
do_padding = (flags & NO_PADDING) == 0;
do_newline = (flags & NO_WRAP) == 0;
do_cr = (flags & CRLF) != 0;
alphabet = ((flags & URL_SAFE) == 0) ? ENCODE : ENCODE_WEBSAFE;
tail = new byte[2];
tailLen = 0;
count = do_newline ? LINE_GROUPS : -1;
}
/**
* @return an overestimate for the number of bytes {@code len} bytes could encode to.
*/
public int maxOutputSize(int len) {
return len * 8 / 5 + 10;
}
public boolean process(byte[] input, int offset, int len, boolean finish) {
// Using local variables makes the encoder about 9% faster.
final byte[] alphabet = this.alphabet;
final byte[] output = this.output;
int op = 0;
int count = this.count;
int p = offset;
len += offset;
int v = -1;
// First we need to concatenate the tail of the previous call
// with any input bytes available now and see if we can empty
// the tail.
switch (tailLen) {
case 0:
// There was no tail.
break;
case 1:
if (p + 2 <= len) {
// A 1-byte tail with at least 2 bytes of
// input available now.
v = ((tail[0] & 0xff) << 16) | ((input[p++] & 0xff) << 8) | (input[p++] & 0xff);
tailLen = 0;
}
;
break;
case 2:
if (p + 1 <= len) {
// A 2-byte tail with at least 1 byte of input.
v = ((tail[0] & 0xff) << 16) | ((tail[1] & 0xff) << 8) | (input[p++] & 0xff);
tailLen = 0;
}
break;
}
if (v != -1) {
output[op++] = alphabet[(v >> 18) & 0x3f];
output[op++] = alphabet[(v >> 12) & 0x3f];
output[op++] = alphabet[(v >> 6) & 0x3f];
output[op++] = alphabet[v & 0x3f];
if (--count == 0) {
if (do_cr)
output[op++] = '\r';
output[op++] = '\n';
count = LINE_GROUPS;
}
}
// At this point either there is no tail, or there are fewer
// than 3 bytes of input available.
// The main loop, turning 3 input bytes into 4 output bytes on
// each iteration.
while (p + 3 <= len) {
v = ((input[p] & 0xff) << 16) | ((input[p + 1] & 0xff) << 8) | (input[p + 2] & 0xff);
output[op] = alphabet[(v >> 18) & 0x3f];
output[op + 1] = alphabet[(v >> 12) & 0x3f];
output[op + 2] = alphabet[(v >> 6) & 0x3f];
output[op + 3] = alphabet[v & 0x3f];
p += 3;
op += 4;
if (--count == 0) {
if (do_cr)
output[op++] = '\r';
output[op++] = '\n';
count = LINE_GROUPS;
}
}
if (finish) {
// Finish up the tail of the input. Note that we need to
// consume any bytes in tail before any bytes
// remaining in input; there should be at most two bytes
// total.
if (p - tailLen == len - 1) {
int t = 0;
v = ((tailLen > 0 ? tail[t++] : input[p++]) & 0xff) << 4;
tailLen -= t;
output[op++] = alphabet[(v >> 6) & 0x3f];
output[op++] = alphabet[v & 0x3f];
if (do_padding) {
output[op++] = '=';
output[op++] = '=';
}
if (do_newline) {
if (do_cr)
output[op++] = '\r';
output[op++] = '\n';
}
} else if (p - tailLen == len - 2) {
int t = 0;
v = (((tailLen > 1 ? tail[t++] : input[p++]) & 0xff) << 10) | (((tailLen > 0 ? tail[t++] : input[p++]) & 0xff) << 2);
tailLen -= t;
output[op++] = alphabet[(v >> 12) & 0x3f];
output[op++] = alphabet[(v >> 6) & 0x3f];
output[op++] = alphabet[v & 0x3f];
if (do_padding) {
output[op++] = '=';
}
if (do_newline) {
if (do_cr)
output[op++] = '\r';
output[op++] = '\n';
}
} else if (do_newline && op > 0 && count != LINE_GROUPS) {
if (do_cr)
output[op++] = '\r';
output[op++] = '\n';
}
assert tailLen == 0;
assert p == len;
} else {
// Save the leftovers in tail to be consumed on the next
// call to encodeInternal.
if (p == len - 1) {
tail[tailLen++] = input[p];
} else if (p == len - 2) {
tail[tailLen++] = input[p];
tail[tailLen++] = input[p + 1];
}
}
this.op = op;
this.count = count;
return true;
}
}
private JinLiBase64() {
} // don't instantiate
public static String encodeString(String s) {
return new String(encode(s.getBytes(), DEFAULT));
}
public static String encodeLines(byte[] in) {
return new String(encode(in, DEFAULT));
}
public static byte[] decodeLines(String s) {
return decode(s, DEFAULT);
}
public static String decodeString(String s) {
return new String(decode(s, DEFAULT));
}
}
| {
"pile_set_name": "Github"
} |
/*
* Copyright © 2013 Intel Corporation
*
* 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 (including the next
* paragraph) 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.
*
* Authors:
* Shobhit Kumar <[email protected]>
* Yogesh Mohan Marimuthu <[email protected]>
*/
#include <linux/kernel.h>
#include "intel_drv.h"
#include "i915_drv.h"
#include "intel_dsi.h"
static const u16 lfsr_converts[] = {
426, 469, 234, 373, 442, 221, 110, 311, 411, /* 62 - 70 */
461, 486, 243, 377, 188, 350, 175, 343, 427, 213, /* 71 - 80 */
106, 53, 282, 397, 454, 227, 113, 56, 284, 142, /* 81 - 90 */
71, 35, 273, 136, 324, 418, 465, 488, 500, 506 /* 91 - 100 */
};
/* Get DSI clock from pixel clock */
static u32 dsi_clk_from_pclk(u32 pclk, enum mipi_dsi_pixel_format fmt,
int lane_count)
{
u32 dsi_clk_khz;
u32 bpp = mipi_dsi_pixel_format_to_bpp(fmt);
/* DSI data rate = pixel clock * bits per pixel / lane count
pixel clock is converted from KHz to Hz */
dsi_clk_khz = DIV_ROUND_CLOSEST(pclk * bpp, lane_count);
return dsi_clk_khz;
}
static int dsi_calc_mnp(struct drm_i915_private *dev_priv,
struct intel_crtc_state *config,
int target_dsi_clk)
{
unsigned int m_min, m_max, p_min = 2, p_max = 6;
unsigned int m, n, p;
unsigned int calc_m, calc_p;
int delta, ref_clk;
/* target_dsi_clk is expected in kHz */
if (target_dsi_clk < 300000 || target_dsi_clk > 1150000) {
DRM_ERROR("DSI CLK Out of Range\n");
return -ECHRNG;
}
if (IS_CHERRYVIEW(dev_priv)) {
ref_clk = 100000;
n = 4;
m_min = 70;
m_max = 96;
} else {
ref_clk = 25000;
n = 1;
m_min = 62;
m_max = 92;
}
calc_p = p_min;
calc_m = m_min;
delta = abs(target_dsi_clk - (m_min * ref_clk) / (p_min * n));
for (m = m_min; m <= m_max && delta; m++) {
for (p = p_min; p <= p_max && delta; p++) {
/*
* Find the optimal m and p divisors with minimal delta
* +/- the required clock
*/
int calc_dsi_clk = (m * ref_clk) / (p * n);
int d = abs(target_dsi_clk - calc_dsi_clk);
if (d < delta) {
delta = d;
calc_m = m;
calc_p = p;
}
}
}
/* register has log2(N1), this works fine for powers of two */
config->dsi_pll.ctrl = 1 << (DSI_PLL_P1_POST_DIV_SHIFT + calc_p - 2);
config->dsi_pll.div =
(ffs(n) - 1) << DSI_PLL_N1_DIV_SHIFT |
(u32)lfsr_converts[calc_m - 62] << DSI_PLL_M1_DIV_SHIFT;
return 0;
}
/*
* XXX: The muxing and gating is hard coded for now. Need to add support for
* sharing PLLs with two DSI outputs.
*/
static int vlv_compute_dsi_pll(struct intel_encoder *encoder,
struct intel_crtc_state *config)
{
struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
struct intel_dsi *intel_dsi = enc_to_intel_dsi(&encoder->base);
int ret;
u32 dsi_clk;
dsi_clk = dsi_clk_from_pclk(intel_dsi->pclk, intel_dsi->pixel_format,
intel_dsi->lane_count);
ret = dsi_calc_mnp(dev_priv, config, dsi_clk);
if (ret) {
DRM_DEBUG_KMS("dsi_calc_mnp failed\n");
return ret;
}
if (intel_dsi->ports & (1 << PORT_A))
config->dsi_pll.ctrl |= DSI_PLL_CLK_GATE_DSI0_DSIPLL;
if (intel_dsi->ports & (1 << PORT_C))
config->dsi_pll.ctrl |= DSI_PLL_CLK_GATE_DSI1_DSIPLL;
config->dsi_pll.ctrl |= DSI_PLL_VCO_EN;
DRM_DEBUG_KMS("dsi pll div %08x, ctrl %08x\n",
config->dsi_pll.div, config->dsi_pll.ctrl);
return 0;
}
static void vlv_enable_dsi_pll(struct intel_encoder *encoder,
const struct intel_crtc_state *config)
{
struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
DRM_DEBUG_KMS("\n");
mutex_lock(&dev_priv->sb_lock);
vlv_cck_write(dev_priv, CCK_REG_DSI_PLL_CONTROL, 0);
vlv_cck_write(dev_priv, CCK_REG_DSI_PLL_DIVIDER, config->dsi_pll.div);
vlv_cck_write(dev_priv, CCK_REG_DSI_PLL_CONTROL,
config->dsi_pll.ctrl & ~DSI_PLL_VCO_EN);
/* wait at least 0.5 us after ungating before enabling VCO,
* allow hrtimer subsystem optimization by relaxing timing
*/
usleep_range(10, 50);
vlv_cck_write(dev_priv, CCK_REG_DSI_PLL_CONTROL, config->dsi_pll.ctrl);
if (wait_for(vlv_cck_read(dev_priv, CCK_REG_DSI_PLL_CONTROL) &
DSI_PLL_LOCK, 20)) {
mutex_unlock(&dev_priv->sb_lock);
DRM_ERROR("DSI PLL lock failed\n");
return;
}
mutex_unlock(&dev_priv->sb_lock);
DRM_DEBUG_KMS("DSI PLL locked\n");
}
static void vlv_disable_dsi_pll(struct intel_encoder *encoder)
{
struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
u32 tmp;
DRM_DEBUG_KMS("\n");
mutex_lock(&dev_priv->sb_lock);
tmp = vlv_cck_read(dev_priv, CCK_REG_DSI_PLL_CONTROL);
tmp &= ~DSI_PLL_VCO_EN;
tmp |= DSI_PLL_LDO_GATE;
vlv_cck_write(dev_priv, CCK_REG_DSI_PLL_CONTROL, tmp);
mutex_unlock(&dev_priv->sb_lock);
}
static bool bxt_dsi_pll_is_enabled(struct drm_i915_private *dev_priv)
{
bool enabled;
u32 val;
u32 mask;
mask = BXT_DSI_PLL_DO_ENABLE | BXT_DSI_PLL_LOCKED;
val = I915_READ(BXT_DSI_PLL_ENABLE);
enabled = (val & mask) == mask;
if (!enabled)
return false;
/*
* Dividers must be programmed with valid values. As per BSEPC, for
* GEMINLAKE only PORT A divider values are checked while for BXT
* both divider values are validated. Check this here for
* paranoia, since BIOS is known to misconfigure PLLs in this way at
* times, and since accessing DSI registers with invalid dividers
* causes a system hang.
*/
val = I915_READ(BXT_DSI_PLL_CTL);
if (IS_GEMINILAKE(dev_priv)) {
if (!(val & BXT_DSIA_16X_MASK)) {
DRM_DEBUG_DRIVER("Invalid PLL divider (%08x)\n", val);
enabled = false;
}
} else {
if (!(val & BXT_DSIA_16X_MASK) || !(val & BXT_DSIC_16X_MASK)) {
DRM_DEBUG_DRIVER("Invalid PLL divider (%08x)\n", val);
enabled = false;
}
}
return enabled;
}
static void bxt_disable_dsi_pll(struct intel_encoder *encoder)
{
struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
u32 val;
DRM_DEBUG_KMS("\n");
val = I915_READ(BXT_DSI_PLL_ENABLE);
val &= ~BXT_DSI_PLL_DO_ENABLE;
I915_WRITE(BXT_DSI_PLL_ENABLE, val);
/*
* PLL lock should deassert within 200us.
* Wait up to 1ms before timing out.
*/
if (intel_wait_for_register(dev_priv,
BXT_DSI_PLL_ENABLE,
BXT_DSI_PLL_LOCKED,
0,
1))
DRM_ERROR("Timeout waiting for PLL lock deassertion\n");
}
static void assert_bpp_mismatch(enum mipi_dsi_pixel_format fmt, int pipe_bpp)
{
int bpp = mipi_dsi_pixel_format_to_bpp(fmt);
WARN(bpp != pipe_bpp,
"bpp match assertion failure (expected %d, current %d)\n",
bpp, pipe_bpp);
}
static u32 vlv_dsi_get_pclk(struct intel_encoder *encoder, int pipe_bpp,
struct intel_crtc_state *config)
{
struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
struct intel_dsi *intel_dsi = enc_to_intel_dsi(&encoder->base);
u32 dsi_clock, pclk;
u32 pll_ctl, pll_div;
u32 m = 0, p = 0, n;
int refclk = IS_CHERRYVIEW(dev_priv) ? 100000 : 25000;
int i;
DRM_DEBUG_KMS("\n");
mutex_lock(&dev_priv->sb_lock);
pll_ctl = vlv_cck_read(dev_priv, CCK_REG_DSI_PLL_CONTROL);
pll_div = vlv_cck_read(dev_priv, CCK_REG_DSI_PLL_DIVIDER);
mutex_unlock(&dev_priv->sb_lock);
config->dsi_pll.ctrl = pll_ctl & ~DSI_PLL_LOCK;
config->dsi_pll.div = pll_div;
/* mask out other bits and extract the P1 divisor */
pll_ctl &= DSI_PLL_P1_POST_DIV_MASK;
pll_ctl = pll_ctl >> (DSI_PLL_P1_POST_DIV_SHIFT - 2);
/* N1 divisor */
n = (pll_div & DSI_PLL_N1_DIV_MASK) >> DSI_PLL_N1_DIV_SHIFT;
n = 1 << n; /* register has log2(N1) */
/* mask out the other bits and extract the M1 divisor */
pll_div &= DSI_PLL_M1_DIV_MASK;
pll_div = pll_div >> DSI_PLL_M1_DIV_SHIFT;
while (pll_ctl) {
pll_ctl = pll_ctl >> 1;
p++;
}
p--;
if (!p) {
DRM_ERROR("wrong P1 divisor\n");
return 0;
}
for (i = 0; i < ARRAY_SIZE(lfsr_converts); i++) {
if (lfsr_converts[i] == pll_div)
break;
}
if (i == ARRAY_SIZE(lfsr_converts)) {
DRM_ERROR("wrong m_seed programmed\n");
return 0;
}
m = i + 62;
dsi_clock = (m * refclk) / (p * n);
/* pixel_format and pipe_bpp should agree */
assert_bpp_mismatch(intel_dsi->pixel_format, pipe_bpp);
pclk = DIV_ROUND_CLOSEST(dsi_clock * intel_dsi->lane_count, pipe_bpp);
return pclk;
}
static u32 bxt_dsi_get_pclk(struct intel_encoder *encoder, int pipe_bpp,
struct intel_crtc_state *config)
{
u32 pclk;
u32 dsi_clk;
u32 dsi_ratio;
struct intel_dsi *intel_dsi = enc_to_intel_dsi(&encoder->base);
struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
/* Divide by zero */
if (!pipe_bpp) {
DRM_ERROR("Invalid BPP(0)\n");
return 0;
}
config->dsi_pll.ctrl = I915_READ(BXT_DSI_PLL_CTL);
dsi_ratio = config->dsi_pll.ctrl & BXT_DSI_PLL_RATIO_MASK;
dsi_clk = (dsi_ratio * BXT_REF_CLOCK_KHZ) / 2;
/* pixel_format and pipe_bpp should agree */
assert_bpp_mismatch(intel_dsi->pixel_format, pipe_bpp);
pclk = DIV_ROUND_CLOSEST(dsi_clk * intel_dsi->lane_count, pipe_bpp);
DRM_DEBUG_DRIVER("Calculated pclk=%u\n", pclk);
return pclk;
}
u32 intel_dsi_get_pclk(struct intel_encoder *encoder, int pipe_bpp,
struct intel_crtc_state *config)
{
if (IS_GEN9_LP(to_i915(encoder->base.dev)))
return bxt_dsi_get_pclk(encoder, pipe_bpp, config);
else
return vlv_dsi_get_pclk(encoder, pipe_bpp, config);
}
static void vlv_dsi_reset_clocks(struct intel_encoder *encoder, enum port port)
{
u32 temp;
struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
struct intel_dsi *intel_dsi = enc_to_intel_dsi(&encoder->base);
temp = I915_READ(MIPI_CTRL(port));
temp &= ~ESCAPE_CLOCK_DIVIDER_MASK;
I915_WRITE(MIPI_CTRL(port), temp |
intel_dsi->escape_clk_div <<
ESCAPE_CLOCK_DIVIDER_SHIFT);
}
static void glk_dsi_program_esc_clock(struct drm_device *dev,
const struct intel_crtc_state *config)
{
struct drm_i915_private *dev_priv = to_i915(dev);
u32 dsi_rate = 0;
u32 pll_ratio = 0;
u32 ddr_clk = 0;
u32 div1_value = 0;
u32 div2_value = 0;
u32 txesc1_div = 0;
u32 txesc2_div = 0;
pll_ratio = config->dsi_pll.ctrl & BXT_DSI_PLL_RATIO_MASK;
dsi_rate = (BXT_REF_CLOCK_KHZ * pll_ratio) / 2;
ddr_clk = dsi_rate / 2;
/* Variable divider value */
div1_value = DIV_ROUND_CLOSEST(ddr_clk, 20000);
/* Calculate TXESC1 divider */
if (div1_value <= 10)
txesc1_div = div1_value;
else if ((div1_value > 10) && (div1_value <= 20))
txesc1_div = DIV_ROUND_UP(div1_value, 2);
else if ((div1_value > 20) && (div1_value <= 30))
txesc1_div = DIV_ROUND_UP(div1_value, 4);
else if ((div1_value > 30) && (div1_value <= 40))
txesc1_div = DIV_ROUND_UP(div1_value, 6);
else if ((div1_value > 40) && (div1_value <= 50))
txesc1_div = DIV_ROUND_UP(div1_value, 8);
else
txesc1_div = 10;
/* Calculate TXESC2 divider */
div2_value = DIV_ROUND_UP(div1_value, txesc1_div);
if (div2_value < 10)
txesc2_div = div2_value;
else
txesc2_div = 10;
I915_WRITE(MIPIO_TXESC_CLK_DIV1, txesc1_div & GLK_TX_ESC_CLK_DIV1_MASK);
I915_WRITE(MIPIO_TXESC_CLK_DIV2, txesc2_div & GLK_TX_ESC_CLK_DIV2_MASK);
}
/* Program BXT Mipi clocks and dividers */
static void bxt_dsi_program_clocks(struct drm_device *dev, enum port port,
const struct intel_crtc_state *config)
{
struct drm_i915_private *dev_priv = to_i915(dev);
u32 tmp;
u32 dsi_rate = 0;
u32 pll_ratio = 0;
u32 rx_div;
u32 tx_div;
u32 rx_div_upper;
u32 rx_div_lower;
u32 mipi_8by3_divider;
/* Clear old configurations */
tmp = I915_READ(BXT_MIPI_CLOCK_CTL);
tmp &= ~(BXT_MIPI_TX_ESCLK_FIXDIV_MASK(port));
tmp &= ~(BXT_MIPI_RX_ESCLK_UPPER_FIXDIV_MASK(port));
tmp &= ~(BXT_MIPI_8X_BY3_DIVIDER_MASK(port));
tmp &= ~(BXT_MIPI_RX_ESCLK_LOWER_FIXDIV_MASK(port));
/* Get the current DSI rate(actual) */
pll_ratio = config->dsi_pll.ctrl & BXT_DSI_PLL_RATIO_MASK;
dsi_rate = (BXT_REF_CLOCK_KHZ * pll_ratio) / 2;
/*
* tx clock should be <= 20MHz and the div value must be
* subtracted by 1 as per bspec
*/
tx_div = DIV_ROUND_UP(dsi_rate, 20000) - 1;
/*
* rx clock should be <= 150MHz and the div value must be
* subtracted by 1 as per bspec
*/
rx_div = DIV_ROUND_UP(dsi_rate, 150000) - 1;
/*
* rx divider value needs to be updated in the
* two differnt bit fields in the register hence splitting the
* rx divider value accordingly
*/
rx_div_lower = rx_div & RX_DIVIDER_BIT_1_2;
rx_div_upper = (rx_div & RX_DIVIDER_BIT_3_4) >> 2;
mipi_8by3_divider = 0x2;
tmp |= BXT_MIPI_8X_BY3_DIVIDER(port, mipi_8by3_divider);
tmp |= BXT_MIPI_TX_ESCLK_DIVIDER(port, tx_div);
tmp |= BXT_MIPI_RX_ESCLK_LOWER_DIVIDER(port, rx_div_lower);
tmp |= BXT_MIPI_RX_ESCLK_UPPER_DIVIDER(port, rx_div_upper);
I915_WRITE(BXT_MIPI_CLOCK_CTL, tmp);
}
static int gen9lp_compute_dsi_pll(struct intel_encoder *encoder,
struct intel_crtc_state *config)
{
struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
struct intel_dsi *intel_dsi = enc_to_intel_dsi(&encoder->base);
u8 dsi_ratio, dsi_ratio_min, dsi_ratio_max;
u32 dsi_clk;
dsi_clk = dsi_clk_from_pclk(intel_dsi->pclk, intel_dsi->pixel_format,
intel_dsi->lane_count);
/*
* From clock diagram, to get PLL ratio divider, divide double of DSI
* link rate (i.e., 2*8x=16x frequency value) by ref clock. Make sure to
* round 'up' the result
*/
dsi_ratio = DIV_ROUND_UP(dsi_clk * 2, BXT_REF_CLOCK_KHZ);
if (IS_BROXTON(dev_priv)) {
dsi_ratio_min = BXT_DSI_PLL_RATIO_MIN;
dsi_ratio_max = BXT_DSI_PLL_RATIO_MAX;
} else {
dsi_ratio_min = GLK_DSI_PLL_RATIO_MIN;
dsi_ratio_max = GLK_DSI_PLL_RATIO_MAX;
}
if (dsi_ratio < dsi_ratio_min || dsi_ratio > dsi_ratio_max) {
DRM_ERROR("Cant get a suitable ratio from DSI PLL ratios\n");
return -ECHRNG;
} else
DRM_DEBUG_KMS("DSI PLL calculation is Done!!\n");
/*
* Program DSI ratio and Select MIPIC and MIPIA PLL output as 8x
* Spec says both have to be programmed, even if one is not getting
* used. Configure MIPI_CLOCK_CTL dividers in modeset
*/
config->dsi_pll.ctrl = dsi_ratio | BXT_DSIA_16X_BY2 | BXT_DSIC_16X_BY2;
/* As per recommendation from hardware team,
* Prog PVD ratio =1 if dsi ratio <= 50
*/
if (IS_BROXTON(dev_priv) && dsi_ratio <= 50)
config->dsi_pll.ctrl |= BXT_DSI_PLL_PVD_RATIO_1;
return 0;
}
static void gen9lp_enable_dsi_pll(struct intel_encoder *encoder,
const struct intel_crtc_state *config)
{
struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
struct intel_dsi *intel_dsi = enc_to_intel_dsi(&encoder->base);
enum port port;
u32 val;
DRM_DEBUG_KMS("\n");
/* Configure PLL vales */
I915_WRITE(BXT_DSI_PLL_CTL, config->dsi_pll.ctrl);
POSTING_READ(BXT_DSI_PLL_CTL);
/* Program TX, RX, Dphy clocks */
if (IS_BROXTON(dev_priv)) {
for_each_dsi_port(port, intel_dsi->ports)
bxt_dsi_program_clocks(encoder->base.dev, port, config);
} else {
glk_dsi_program_esc_clock(encoder->base.dev, config);
}
/* Enable DSI PLL */
val = I915_READ(BXT_DSI_PLL_ENABLE);
val |= BXT_DSI_PLL_DO_ENABLE;
I915_WRITE(BXT_DSI_PLL_ENABLE, val);
/* Timeout and fail if PLL not locked */
if (intel_wait_for_register(dev_priv,
BXT_DSI_PLL_ENABLE,
BXT_DSI_PLL_LOCKED,
BXT_DSI_PLL_LOCKED,
1)) {
DRM_ERROR("Timed out waiting for DSI PLL to lock\n");
return;
}
DRM_DEBUG_KMS("DSI PLL locked\n");
}
bool intel_dsi_pll_is_enabled(struct drm_i915_private *dev_priv)
{
if (IS_GEN9_LP(dev_priv))
return bxt_dsi_pll_is_enabled(dev_priv);
MISSING_CASE(INTEL_DEVID(dev_priv));
return false;
}
int intel_compute_dsi_pll(struct intel_encoder *encoder,
struct intel_crtc_state *config)
{
struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
if (IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv))
return vlv_compute_dsi_pll(encoder, config);
else if (IS_GEN9_LP(dev_priv))
return gen9lp_compute_dsi_pll(encoder, config);
return -ENODEV;
}
void intel_enable_dsi_pll(struct intel_encoder *encoder,
const struct intel_crtc_state *config)
{
struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
if (IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv))
vlv_enable_dsi_pll(encoder, config);
else if (IS_GEN9_LP(dev_priv))
gen9lp_enable_dsi_pll(encoder, config);
}
void intel_disable_dsi_pll(struct intel_encoder *encoder)
{
struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
if (IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv))
vlv_disable_dsi_pll(encoder);
else if (IS_GEN9_LP(dev_priv))
bxt_disable_dsi_pll(encoder);
}
static void gen9lp_dsi_reset_clocks(struct intel_encoder *encoder,
enum port port)
{
u32 tmp;
struct drm_device *dev = encoder->base.dev;
struct drm_i915_private *dev_priv = to_i915(dev);
/* Clear old configurations */
if (IS_BROXTON(dev_priv)) {
tmp = I915_READ(BXT_MIPI_CLOCK_CTL);
tmp &= ~(BXT_MIPI_TX_ESCLK_FIXDIV_MASK(port));
tmp &= ~(BXT_MIPI_RX_ESCLK_UPPER_FIXDIV_MASK(port));
tmp &= ~(BXT_MIPI_8X_BY3_DIVIDER_MASK(port));
tmp &= ~(BXT_MIPI_RX_ESCLK_LOWER_FIXDIV_MASK(port));
I915_WRITE(BXT_MIPI_CLOCK_CTL, tmp);
} else {
tmp = I915_READ(MIPIO_TXESC_CLK_DIV1);
tmp &= ~GLK_TX_ESC_CLK_DIV1_MASK;
I915_WRITE(MIPIO_TXESC_CLK_DIV1, tmp);
tmp = I915_READ(MIPIO_TXESC_CLK_DIV2);
tmp &= ~GLK_TX_ESC_CLK_DIV2_MASK;
I915_WRITE(MIPIO_TXESC_CLK_DIV2, tmp);
}
I915_WRITE(MIPI_EOT_DISABLE(port), CLOCKSTOP);
}
void intel_dsi_reset_clocks(struct intel_encoder *encoder, enum port port)
{
struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
if (IS_GEN9_LP(dev_priv))
gen9lp_dsi_reset_clocks(encoder, port);
else if (IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv))
vlv_dsi_reset_clocks(encoder, port);
}
| {
"pile_set_name": "Github"
} |
Parameters:
TagValueParam:
Type: String
Default: value
Resources:
MyApiWithStageTags:
Type: "AWS::Serverless::Api"
Properties:
StageName: Prod
Tags:
TagKey1: TagValue1
TagKey2: ""
TagKey3:
Ref: TagValueParam
TagKey4: "123"
| {
"pile_set_name": "Github"
} |
function pass = test_gmres(pref)
% Test the Chebfun implementation of GMRES for solving Lu = f, where L is an
% operator, and both f and u are chebfuns
% Sheehan Olver
if ( nargin == 0 )
pref = chebfunpref();
end
tol = pref.chebfuneps;
d = [-1 1];
x = chebfun('x', d, pref);
f = chebfun('exp(x)', d, pref);
w = 100;
L = @(u) diff(u) + 1i*w*u;
[u, flag] = gmres(L, f);
pass(1) = ~flag;
err = abs(sum(f.*exp(1i.*w.*x)) - (u(1).*exp(1i.*w) - u(-1).*exp(-1i.*w)));
pass(2) = err < 100*tol;
end
| {
"pile_set_name": "Github"
} |
/* This file is part of VoltDB.
* Copyright (C) 2008-2020 VoltDB Inc.
*
* 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 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.
*/
/*
* Stored procedure for Kafka import
*
* If incoming data is in the mirror table, delete that row.
*
* Else add to import table as a record of rows that didn't get
* into the mirror table, a major error!
*/
package kafkaimporter.db.procedures;
import java.math.BigDecimal;
import org.voltdb.SQLStmt;
import org.voltdb.VoltProcedure;
import org.voltdb.VoltTable;
import org.voltdb.VoltType;
import org.voltdb.types.TimestampType;
public class InsertImport2 extends VoltProcedure {
public final SQLStmt selectCounts = new SQLStmt("SELECT key FROM importcounts ORDER BY key LIMIT 1");
public final SQLStmt insertCounts = new SQLStmt("INSERT INTO importcounts(KEY, TOTAL_ROWS_DELETED) VALUES (?, ?)");
public final SQLStmt updateCounts = new SQLStmt("UPDATE importcounts SET total_rows_deleted=total_rows_deleted+? where key = ?");
public final SQLStmt updateMismatch = new SQLStmt("INSERT INTO importcounts VALUES(?, ?, ?)");
public final SQLStmt selectMirrorRow = new SQLStmt("SELECT * FROM kafkamirrortable2 WHERE key = ? AND value = ? LIMIT 1");
public final String sqlSuffix =
"(key, value, rowid_group, type_null_tinyint, type_not_null_tinyint, " +
"type_null_smallint, type_not_null_smallint, type_null_integer, " +
"type_not_null_integer, type_null_bigint, type_not_null_bigint, " +
"type_null_timestamp, type_not_null_timestamp, type_null_float, " +
"type_not_null_float, type_null_decimal, type_not_null_decimal, " +
"type_null_varchar25, type_not_null_varchar25, type_null_varchar128, " +
"type_not_null_varchar128, type_null_varchar1024, type_not_null_varchar1024)" +
"VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
public final SQLStmt importInsert = new SQLStmt("INSERT INTO kafkaImportTable2 " + sqlSuffix);
public final SQLStmt deleteMirrorRow = new SQLStmt(
"DELETE FROM kafkaMirrorTable2 WHERE key = ? AND value = ?"
);
public long run(
long key, long value, byte rowid_group,
byte type_null_tinyint, byte type_not_null_tinyint,
short type_null_smallint, short type_not_null_smallint,
int type_null_integer, int type_not_null_integer,
long type_null_bigint, long type_not_null_bigint,
TimestampType type_null_timestamp, TimestampType type_not_null_timestamp,
double type_null_float, double type_not_null_float,
BigDecimal type_null_decimal, BigDecimal type_not_null_decimal,
String type_null_varchar25, String type_not_null_varchar25,
String type_null_varchar128, String type_not_null_varchar128,
String type_null_varchar1024, String type_not_null_varchar1024) {
// column positions, used in "get" calls below
final int TYPE_NULL_TINYINT = 3;
final int TYPE_NOT_NULL_TINYINT = 4;
final int TYPE_NULL_SMALLINT = 5;
final int TYPE_NOT_NULL_SMALLINT = 6;
final int TYPE_NULL_INTEGER = 7;
final int TYPE_NOT_NULL_INTEGER = 8;
final int TYPE_NULL_BIGINT = 9;
final int TYPE_NOT_NULL_BIGINT = 10;
final int TYPE_NULL_TIMESTAMP = 11;
final int TYPE_NOT_NULL_TIMESTAMP = 12;
final int TYPE_NULL_FLOAT = 13;
final int TYPE_NOT_NULL_FLOAT = 14;
final int TYPE_NULL_DECIMAL = 15;
final int TYPE_NOT_NULL_DECIMAL = 16;
final int TYPE_NULL_VARCHAR25 = 17;
final int TYPE_NOT_NULL_VARCHAR25 = 18;
final int TYPE_NULL_VARCHAR128 = 19;
final int TYPE_NOT_NULL_VARCHAR128 = 20;
final int TYPE_NULL_VARCHAR1024 = 21;
final int TYPE_NOT_NULL_VARCHAR1024 = 22;
// find mirror row that matches import
voltQueueSQL(selectMirrorRow, key, value);
VoltTable[] mirrorResults = voltExecuteSQL();
VoltTable rowData = mirrorResults[0];
long deletedCount = 0;
boolean rowCheckOk = true;
if (rowData.getRowCount() == 1) {
// we already checked key and value via SELECT; now work through the rest of the types
// not_null rows are simple compares. nullable types need to check for null as well
byte ntiVal = (byte) rowData.fetchRow(0).get(TYPE_NULL_TINYINT, VoltType.TINYINT);
if (ntiVal != type_null_tinyint) {
rowCheckOk = reportMismatch("type_null_tinyint", String.valueOf(type_null_tinyint), String.valueOf(ntiVal));
}
byte tiVal = (byte) rowData.fetchRow(0).get(TYPE_NOT_NULL_TINYINT, VoltType.TINYINT);
if (tiVal != type_not_null_tinyint) {
rowCheckOk = reportMismatch("type_not_null_tinyint", String.valueOf(type_not_null_tinyint), String.valueOf(tiVal));
}
short nsiVal = (short) rowData.fetchRow(0).get(TYPE_NULL_SMALLINT, VoltType.SMALLINT);
if (nsiVal != type_null_smallint) {
rowCheckOk = reportMismatch("type_null_smallint", String.valueOf(type_null_smallint), String.valueOf(nsiVal));
}
short siVal = (short) rowData.fetchRow(0).get(TYPE_NOT_NULL_SMALLINT, VoltType.SMALLINT);
if (siVal != type_not_null_smallint ) {
rowCheckOk = reportMismatch("type_not_null_smallint", String.valueOf(type_not_null_smallint), String.valueOf(siVal));
}
int nintVal = (int) rowData.fetchRow(0).get(TYPE_NULL_INTEGER, VoltType.INTEGER);
if (nintVal != type_null_integer ) {
rowCheckOk = reportMismatch("type_null_integer", String.valueOf(type_null_integer), String.valueOf(nintVal));
}
int intVal = (int) rowData.fetchRow(0).get(TYPE_NOT_NULL_INTEGER, VoltType.INTEGER);
if (intVal != type_not_null_integer ) {
rowCheckOk = reportMismatch("type_not_null_integer", String.valueOf(type_not_null_integer), String.valueOf(intVal));
}
long nbigVal = (long) rowData.fetchRow(0).get(TYPE_NULL_BIGINT, VoltType.BIGINT);
if (nbigVal != type_null_bigint ) {
rowCheckOk = reportMismatch("type_null_bigint", String.valueOf(type_null_bigint), String.valueOf(nbigVal));
}
long bigVal = (long) rowData.fetchRow(0).get(TYPE_NOT_NULL_BIGINT, VoltType.BIGINT);
if (bigVal != type_not_null_bigint ) {
rowCheckOk = reportMismatch("type_not_null_bigint", String.valueOf(type_not_null_bigint), String.valueOf(bigVal));
}
TimestampType ntsVal = (TimestampType) rowData.fetchRow(0).get(TYPE_NULL_TIMESTAMP, VoltType.TIMESTAMP);
if (!(ntsVal == null && type_null_timestamp == null) && !ntsVal.equals(type_null_timestamp)) {
rowCheckOk = reportMismatch("type_null_timestamp", type_null_timestamp.toString(), ntsVal.toString());
}
TimestampType tsVal = (TimestampType) rowData.fetchRow(0).get(TYPE_NOT_NULL_TIMESTAMP, VoltType.TIMESTAMP);
if (!tsVal.equals(type_not_null_timestamp)) {
rowCheckOk = reportMismatch("type_not_null_timestamp", type_not_null_timestamp.toString(), tsVal.toString());
}
double nfloatVal = (double) rowData.fetchRow(0).get(TYPE_NULL_FLOAT, VoltType.FLOAT);
if (nfloatVal != type_null_float) {
rowCheckOk = reportMismatch("type_null_float", String.valueOf(type_null_float), String.valueOf(nfloatVal));
}
double floatVal = (double) rowData.fetchRow(0).get(TYPE_NOT_NULL_FLOAT, VoltType.FLOAT);
if (floatVal != type_not_null_float ) {
rowCheckOk = reportMismatch("type_not_null_float", String.valueOf(type_not_null_float), String.valueOf(floatVal));
}
BigDecimal ndecimalVal = (BigDecimal) rowData.fetchRow(0).get(TYPE_NULL_DECIMAL, VoltType.DECIMAL);
if (!(ndecimalVal == null && type_null_decimal == null) && !ndecimalVal.equals(type_null_decimal)) {
rowCheckOk = reportMismatch("type_null_decimal", type_null_decimal.toString(), ndecimalVal.toString());
}
BigDecimal decimalVal = (BigDecimal) rowData.fetchRow(0).get(TYPE_NOT_NULL_DECIMAL, VoltType.DECIMAL);
if (!decimalVal.equals(type_not_null_decimal)) {
rowCheckOk = reportMismatch("type_not_null_decimal", type_not_null_decimal.toString(), decimalVal.toString());
}
String nstring25Val = (String) rowData.fetchRow(0).get(TYPE_NULL_VARCHAR25, VoltType.STRING);
if (!(nstring25Val == null && type_null_varchar25 == null) && !nstring25Val.equals(type_null_varchar25)) {
rowCheckOk = reportMismatch("type_null_varchar25", type_null_varchar25, nstring25Val);
}
String string25Val = (String) rowData.fetchRow(0).get(TYPE_NOT_NULL_VARCHAR25, VoltType.STRING);
if (!string25Val.equals(type_not_null_varchar25)) {
rowCheckOk = reportMismatch("type_not_null_varchar25", type_not_null_varchar25, string25Val);
}
String nstring128Val = (String) rowData.fetchRow(0).get(TYPE_NULL_VARCHAR128, VoltType.STRING);
if (!(nstring128Val == null && type_null_varchar128 == null) && ! nstring128Val.equals(type_null_varchar128)) {
rowCheckOk = reportMismatch("type_null_varchar128", type_null_varchar128, nstring128Val);
}
String string128Val = (String) rowData.fetchRow(0).get(TYPE_NOT_NULL_VARCHAR128, VoltType.STRING);
if (!string128Val.equals(type_not_null_varchar128)) {
rowCheckOk = reportMismatch("type_not_null_varchar128", type_not_null_varchar128, string128Val);
}
String nstring1024Val = (String) rowData.fetchRow(0).get(TYPE_NULL_VARCHAR1024, VoltType.STRING);
if (!(nstring1024Val == null && type_null_varchar1024 == null) && !nstring1024Val.equals(type_null_varchar1024)) {
rowCheckOk = reportMismatch("type_null_varchar1024", type_null_varchar1024, nstring1024Val);
}
String string1024Val = (String) rowData.fetchRow(0).get(TYPE_NOT_NULL_VARCHAR1024, VoltType.STRING);
if (!string1024Val.equals(type_not_null_varchar1024)) {
rowCheckOk = reportMismatch("type_not_null_varchar1024", type_not_null_varchar1024, string1024Val);
}
if (rowCheckOk) { // delete the row
voltQueueSQL(deleteMirrorRow, EXPECT_SCALAR_LONG, key, value);
deletedCount = voltExecuteSQL()[0].asScalarLong();
} else { // there was a data mismatch; set VALUE_MISMATCH, which will be noticed by client
voltQueueSQL(updateMismatch, key, value, 1);
voltExecuteSQL();
return 0;
}
if (deletedCount != 1) {
System.out.println("Rows deleted: " + deletedCount + ", key: " + key + ", value: " + value);
}
} else { // add to import table as indicator of dupe or mismatch
voltQueueSQL(importInsert,
key, value, rowid_group,
type_null_tinyint, type_not_null_tinyint,
type_null_smallint, type_not_null_smallint,
type_null_integer, type_not_null_integer,
type_null_bigint, type_not_null_bigint,
type_null_timestamp, type_not_null_timestamp,
type_null_float, type_not_null_float,
type_null_decimal, type_not_null_decimal,
type_null_varchar25, type_not_null_varchar25,
type_null_varchar128, type_not_null_varchar128,
type_null_varchar1024, type_not_null_varchar1024);
voltExecuteSQL();
}
// update the counts tables so we can track progress and results
// since the SP can't return results to the client
voltQueueSQL(selectCounts);
VoltTable[] result = voltExecuteSQL();
VoltTable data = result[0];
long nrows = data.getRowCount();
if (nrows > 0) {
long ck = data.fetchRow(0).getLong(0);
voltQueueSQL(updateCounts, deletedCount, ck);
voltExecuteSQL(true);
} else {
voltQueueSQL(insertCounts, key, deletedCount);
voltExecuteSQL(true);
}
return 0;
}
private boolean reportMismatch(String typeName, String mirrorVal, String importVal) {
System.out.println("Mirror " + typeName + " not equal to import " + typeName + ":" + mirrorVal + " != " + importVal);
return false;
}
}
| {
"pile_set_name": "Github"
} |
<?xml version="1.0" encoding="utf-8"?>
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" version="1.2">
<file source-language="en" target-language="no" datatype="plaintext" original="file.ext">
<body>
<trans-unit id="0" resname="label_previous">
<source>label_previous</source>
<target>Forrige</target>
</trans-unit>
<trans-unit id="1" resname="label_next">
<source>label_next</source>
<target>Neste</target>
</trans-unit>
<trans-unit id="2" resname="filter_searchword">
<source>filter_searchword</source>
<target>Søk...</target>
</trans-unit>
</body>
</file>
</xliff>
| {
"pile_set_name": "Github"
} |
comment "armadillo needs a toolchain w/ C++, largefile"
depends on !BR2_INSTALL_LIBSTDCPP || !BR2_LARGEFILE
depends on !(BR2_mips || BR2_mipsel || BR2_mips64 || BR2_mips64el) # clapack
depends on !(BR2_powerpc && BR2_TOOLCHAIN_USES_UCLIBC) # clapack
depends on !BR2_bfin # clapack
config BR2_PACKAGE_ARMADILLO
bool "armadillo"
depends on BR2_INSTALL_LIBSTDCPP
depends on BR2_LARGEFILE # clapack
depends on !(BR2_mips || BR2_mipsel || BR2_mips64 || BR2_mips64el) # clapack
depends on !(BR2_powerpc && BR2_TOOLCHAIN_USES_UCLIBC) # clapack
depends on !BR2_bfin # clapack
select BR2_PACKAGE_CLAPACK
help
Armadillo: An Open Source C++ Linear Algebra Library for
Fast Prototyping and Computationally Intensive Experiments.
http://arma.sourceforge.net/
| {
"pile_set_name": "Github"
} |
--
-- Copyright (C) 2016, AdaCore
--
-- This spec has been automatically generated from STM32F429x.svd
pragma Ada_2012;
with System;
-- STM32F429x
package Interfaces.STM32 is
pragma Preelaborate;
pragma No_Elaboration_Code_All;
--------------------
-- Base addresses --
--------------------
RNG_Base : constant System.Address :=
System'To_Address (16#50060800#);
DCMI_Base : constant System.Address :=
System'To_Address (16#50050000#);
FMC_Base : constant System.Address :=
System'To_Address (16#A0000000#);
DBG_Base : constant System.Address :=
System'To_Address (16#E0042000#);
DMA2_Base : constant System.Address :=
System'To_Address (16#40026400#);
DMA1_Base : constant System.Address :=
System'To_Address (16#40026000#);
RCC_Base : constant System.Address :=
System'To_Address (16#40023800#);
GPIOK_Base : constant System.Address :=
System'To_Address (16#40022800#);
GPIOJ_Base : constant System.Address :=
System'To_Address (16#40022400#);
GPIOI_Base : constant System.Address :=
System'To_Address (16#40022000#);
GPIOH_Base : constant System.Address :=
System'To_Address (16#40021C00#);
GPIOG_Base : constant System.Address :=
System'To_Address (16#40021800#);
GPIOF_Base : constant System.Address :=
System'To_Address (16#40021400#);
GPIOE_Base : constant System.Address :=
System'To_Address (16#40021000#);
GPIOD_Base : constant System.Address :=
System'To_Address (16#40020C00#);
GPIOC_Base : constant System.Address :=
System'To_Address (16#40020800#);
GPIOB_Base : constant System.Address :=
System'To_Address (16#40020400#);
GPIOA_Base : constant System.Address :=
System'To_Address (16#40020000#);
SYSCFG_Base : constant System.Address :=
System'To_Address (16#40013800#);
SPI1_Base : constant System.Address :=
System'To_Address (16#40013000#);
SPI2_Base : constant System.Address :=
System'To_Address (16#40003800#);
SPI3_Base : constant System.Address :=
System'To_Address (16#40003C00#);
I2S2ext_Base : constant System.Address :=
System'To_Address (16#40003400#);
I2S3ext_Base : constant System.Address :=
System'To_Address (16#40004000#);
SPI4_Base : constant System.Address :=
System'To_Address (16#40013400#);
SPI5_Base : constant System.Address :=
System'To_Address (16#40015000#);
SPI6_Base : constant System.Address :=
System'To_Address (16#40015400#);
SDIO_Base : constant System.Address :=
System'To_Address (16#40012C00#);
ADC1_Base : constant System.Address :=
System'To_Address (16#40012000#);
ADC2_Base : constant System.Address :=
System'To_Address (16#40012100#);
ADC3_Base : constant System.Address :=
System'To_Address (16#40012200#);
USART6_Base : constant System.Address :=
System'To_Address (16#40011400#);
USART1_Base : constant System.Address :=
System'To_Address (16#40011000#);
USART2_Base : constant System.Address :=
System'To_Address (16#40004400#);
USART3_Base : constant System.Address :=
System'To_Address (16#40004800#);
UART7_Base : constant System.Address :=
System'To_Address (16#40007800#);
UART8_Base : constant System.Address :=
System'To_Address (16#40007C00#);
DAC_Base : constant System.Address :=
System'To_Address (16#40007400#);
PWR_Base : constant System.Address :=
System'To_Address (16#40007000#);
I2C3_Base : constant System.Address :=
System'To_Address (16#40005C00#);
I2C2_Base : constant System.Address :=
System'To_Address (16#40005800#);
I2C1_Base : constant System.Address :=
System'To_Address (16#40005400#);
IWDG_Base : constant System.Address :=
System'To_Address (16#40003000#);
WWDG_Base : constant System.Address :=
System'To_Address (16#40002C00#);
RTC_Base : constant System.Address :=
System'To_Address (16#40002800#);
UART4_Base : constant System.Address :=
System'To_Address (16#40004C00#);
UART5_Base : constant System.Address :=
System'To_Address (16#40005000#);
C_ADC_Base : constant System.Address :=
System'To_Address (16#40012300#);
TIM1_Base : constant System.Address :=
System'To_Address (16#40010000#);
TIM8_Base : constant System.Address :=
System'To_Address (16#40010400#);
TIM2_Base : constant System.Address :=
System'To_Address (16#40000000#);
TIM3_Base : constant System.Address :=
System'To_Address (16#40000400#);
TIM4_Base : constant System.Address :=
System'To_Address (16#40000800#);
TIM5_Base : constant System.Address :=
System'To_Address (16#40000C00#);
TIM9_Base : constant System.Address :=
System'To_Address (16#40014000#);
TIM12_Base : constant System.Address :=
System'To_Address (16#40001800#);
TIM10_Base : constant System.Address :=
System'To_Address (16#40014400#);
TIM13_Base : constant System.Address :=
System'To_Address (16#40001C00#);
TIM14_Base : constant System.Address :=
System'To_Address (16#40002000#);
TIM11_Base : constant System.Address :=
System'To_Address (16#40014800#);
TIM6_Base : constant System.Address :=
System'To_Address (16#40001000#);
TIM7_Base : constant System.Address :=
System'To_Address (16#40001400#);
Ethernet_MAC_Base : constant System.Address :=
System'To_Address (16#40028000#);
Ethernet_MMC_Base : constant System.Address :=
System'To_Address (16#40028100#);
Ethernet_PTP_Base : constant System.Address :=
System'To_Address (16#40028700#);
Ethernet_DMA_Base : constant System.Address :=
System'To_Address (16#40029000#);
CRC_Base : constant System.Address :=
System'To_Address (16#40023000#);
OTG_FS_GLOBAL_Base : constant System.Address :=
System'To_Address (16#50000000#);
OTG_FS_HOST_Base : constant System.Address :=
System'To_Address (16#50000400#);
OTG_FS_DEVICE_Base : constant System.Address :=
System'To_Address (16#50000800#);
OTG_FS_PWRCLK_Base : constant System.Address :=
System'To_Address (16#50000E00#);
CAN1_Base : constant System.Address :=
System'To_Address (16#40006400#);
CAN2_Base : constant System.Address :=
System'To_Address (16#40006800#);
NVIC_Base : constant System.Address :=
System'To_Address (16#E000E000#);
FLASH_Base : constant System.Address :=
System'To_Address (16#40023C00#);
EXTI_Base : constant System.Address :=
System'To_Address (16#40013C00#);
OTG_HS_GLOBAL_Base : constant System.Address :=
System'To_Address (16#40040000#);
OTG_HS_HOST_Base : constant System.Address :=
System'To_Address (16#40040400#);
OTG_HS_DEVICE_Base : constant System.Address :=
System'To_Address (16#40040800#);
OTG_HS_PWRCLK_Base : constant System.Address :=
System'To_Address (16#40040E00#);
LTDC_Base : constant System.Address :=
System'To_Address (16#40016800#);
SAI_Base : constant System.Address :=
System'To_Address (16#40015800#);
DMA2D_Base : constant System.Address :=
System'To_Address (16#4002B000#);
end Interfaces.STM32;
| {
"pile_set_name": "Github"
} |
<?php
namespace wcf\system\database\table;
/**
* PHP representation of layout changes to an existing database table.
*
* Trying to create a table represented by this class causes an exception.
*
* @author Matthias Schmidt
* @copyright 2001-2019 WoltLab GmbH
* @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
* @package WoltLabSuite\Core\System\Database\Table
* @since 5.2
*/
class PartialDatabaseTable extends DatabaseTable {}
| {
"pile_set_name": "Github"
} |
<?php
namespace Faker\Provider\da_DK;
/**
* @link http://www.danskernesnavne.navneforskning.ku.dk/Personnavne.asp
*
* @author Antoine Corcy <[email protected]>
*/
class Person extends \Faker\Provider\Person
{
/**
* @var array Danish person name formats.
*/
protected static $maleNameFormats = array(
'{{firstNameMale}} {{lastName}}',
'{{firstNameMale}} {{lastName}}',
'{{firstNameMale}} {{lastName}}',
'{{firstNameMale}} {{middleName}} {{lastName}}',
'{{firstNameMale}} {{middleName}} {{lastName}}',
'{{firstNameMale}} {{middleName}}-{{middleName}} {{lastName}}',
'{{firstNameMale}} {{middleName}} {{middleName}}-{{lastName}}',
);
protected static $femaleNameFormats = array(
'{{firstNameFemale}} {{lastName}}',
'{{firstNameFemale}} {{lastName}}',
'{{firstNameFemale}} {{lastName}}',
'{{firstNameFemale}} {{middleName}} {{lastName}}',
'{{firstNameFemale}} {{middleName}} {{lastName}}',
'{{firstNameFemale}} {{middleName}}-{{middleName}} {{lastName}}',
'{{firstNameFemale}} {{middleName}} {{middleName}}-{{lastName}}',
);
/**
* @var array Danish first names.
*/
protected static $firstNameMale = array(
'Aage', 'Adam', 'Adolf', 'Ahmad', 'Ahmed', 'Aksel', 'Albert', 'Alex', 'Alexander', 'Alf', 'Alfred', 'Ali', 'Allan',
'Anders', 'Andreas', 'Anker', 'Anton', 'Arne', 'Arnold', 'Arthur', 'Asbjørn', 'Asger', 'August', 'Axel', 'Benjamin',
'Benny', 'Bent', 'Bernhard', 'Birger', 'Bjarne', 'Bjørn', 'Bo', 'Brian', 'Bruno', 'Børge', 'Carl', 'Carlo',
'Carsten', 'Casper', 'Charles', 'Chris', 'Christian', 'Christoffer', 'Christopher', 'Claus', 'Dan', 'Daniel', 'David', 'Dennis',
'Ebbe', 'Edmund', 'Edvard', 'Egon', 'Einar', 'Ejvind', 'Elias', 'Emanuel', 'Emil', 'Erik', 'Erland', 'Erling',
'Ernst', 'Esben', 'Ferdinand', 'Finn', 'Flemming', 'Frank', 'Freddy', 'Frederik', 'Frits', 'Fritz', 'Frode', 'Georg',
'Gerhard', 'Gert', 'Gunnar', 'Gustav', 'Hans', 'Harald', 'Harry', 'Hassan', 'Heine', 'Heinrich', 'Helge', 'Helmer',
'Helmuth', 'Henning', 'Henrik', 'Henry', 'Herman', 'Hermann', 'Holger', 'Hugo', 'Ib', 'Ibrahim', 'Ivan', 'Jack',
'Jacob', 'Jakob', 'Jan', 'Janne', 'Jens', 'Jeppe', 'Jesper', 'Jimmi', 'Jimmy', 'Joachim', 'Johan', 'Johannes',
'John', 'Johnny', 'Jon', 'Jonas', 'Jonathan', 'Josef', 'Jul', 'Julius', 'Jørgen', 'Jørn', 'Kai', 'Kaj',
'Karl', 'Karlo', 'Karsten', 'Kasper', 'Kenneth', 'Kent', 'Kevin', 'Kjeld', 'Klaus', 'Knud', 'Kristian', 'Kristoffer',
'Kurt', 'Lars', 'Lasse', 'Leif', 'Lennart', 'Leo', 'Leon', 'Louis', 'Lucas', 'Lukas', 'Mads', 'Magnus',
'Malthe', 'Marc', 'Marcus', 'Marinus', 'Marius', 'Mark', 'Markus', 'Martin', 'Martinus', 'Mathias', 'Max', 'Michael',
'Mikael', 'Mike', 'Mikkel', 'Mogens', 'Mohamad', 'Mohamed', 'Mohammad', 'Morten', 'Nick', 'Nicklas', 'Nicolai', 'Nicolaj',
'Niels', 'Niklas', 'Nikolaj', 'Nils', 'Olaf', 'Olav', 'Ole', 'Oliver', 'Oscar', 'Oskar', 'Otto', 'Ove',
'Palle', 'Patrick', 'Paul', 'Peder', 'Per', 'Peter', 'Philip', 'Poul', 'Preben', 'Rasmus', 'Rene', 'René',
'Richard', 'Robert', 'Rolf', 'Rudolf', 'Rune', 'Sebastian', 'Sigurd', 'Simon', 'Simone', 'Steen', 'Stefan', 'Steffen',
'Sten', 'Stig', 'Sune', 'Sven', 'Svend', 'Søren', 'Tage', 'Theodor', 'Thomas', 'Thor', 'Thorvald', 'Tim',
'Tobias', 'Tom', 'Tommy', 'Tonny', 'Torben', 'Troels', 'Uffe', 'Ulrik', 'Vagn', 'Vagner', 'Valdemar', 'Vang',
'Verner', 'Victor', 'Viktor', 'Villy', 'Walther', 'Werner', 'Wilhelm', 'William', 'Willy', 'Åge', 'Bendt', 'Bjarke',
'Chr', 'Eigil', 'Ejgil', 'Ejler', 'Ejnar', 'Ejner', 'Evald', 'Folmer', 'Gunner', 'Gurli', 'Hartvig', 'Herluf', 'Hjalmar',
'Ingemann', 'Ingolf', 'Ingvard', 'Keld', 'Kresten', 'Laurids', 'Laurits', 'Lauritz', 'Ludvig', 'Lynge', 'Oluf', 'Osvald',
'Povl', 'Richardt', 'Sigfred', 'Sofus', 'Thorkild', 'Viggo', 'Vilhelm', 'Villiam',
);
protected static $firstNameFemale = array(
'Aase', 'Agathe', 'Agnes', 'Alberte', 'Alexandra', 'Alice', 'Alma', 'Amalie', 'Amanda', 'Andrea', 'Ane', 'Anette', 'Anita',
'Anja', 'Ann', 'Anna', 'Annalise', 'Anne', 'Anne-Lise', 'Anne-Marie', 'Anne-Mette', 'Annelise', 'Annette', 'Anni', 'Annie',
'Annika', 'Anny', 'Asta', 'Astrid', 'Augusta', 'Benedikte', 'Bente', 'Berit', 'Bertha', 'Betina', 'Bettina', 'Betty',
'Birgit', 'Birgitte', 'Birte', 'Birthe', 'Bitten', 'Bodil', 'Britt', 'Britta', 'Camilla', 'Carina', 'Carla', 'Caroline',
'Cathrine', 'Cecilie', 'Charlotte', 'Christa', 'Christen', 'Christiane', 'Christina', 'Christine', 'Clara', 'Conni', 'Connie', 'Conny',
'Dagmar', 'Dagny', 'Diana', 'Ditte', 'Dora', 'Doris', 'Dorte', 'Dorthe', 'Ebba', 'Edel', 'Edith', 'Eleonora',
'Eli', 'Elin', 'Eline', 'Elinor', 'Elisa', 'Elisabeth', 'Elise', 'Ella', 'Ellen', 'Ellinor', 'Elly', 'Elna',
'Elsa', 'Else', 'Elsebeth', 'Elvira', 'Emilie', 'Emma', 'Emmy', 'Erna', 'Ester', 'Esther', 'Eva', 'Evelyn',
'Frede', 'Frederikke', 'Freja', 'Frida', 'Gerda', 'Gertrud', 'Gitte', 'Grete', 'Grethe', 'Gudrun', 'Hanna', 'Hanne',
'Hardy', 'Harriet', 'Hedvig', 'Heidi', 'Helen', 'Helena', 'Helene', 'Helga', 'Helle', 'Henny', 'Henriette', 'Herdis',
'Hilda', 'Iben', 'Ida', 'Ilse', 'Ina', 'Inga', 'Inge', 'Ingeborg', 'Ingelise', 'Inger', 'Ingrid', 'Irene',
'Iris', 'Irma', 'Isabella', 'Jane', 'Janni', 'Jannie', 'Jeanette', 'Jeanne', 'Jenny', 'Jes', 'Jette', 'Joan',
'Johanna', 'Johanne', 'Jonna', 'Josefine', 'Josephine', 'Juliane', 'Julie', 'Jytte', 'Kaja', 'Kamilla', 'Karen', 'Karin',
'Karina', 'Karla', 'Karoline', 'Kate', 'Kathrine', 'Katja', 'Katrine', 'Ketty', 'Kim', 'Kirsten', 'Kirstine', 'Klara',
'Krista', 'Kristen', 'Kristina', 'Kristine', 'Laila', 'Laura', 'Laurine', 'Lea', 'Lena', 'Lene', 'Lilian', 'Lilli',
'Lillian', 'Lilly', 'Linda', 'Line', 'Lis', 'Lisa', 'Lisbet', 'Lisbeth', 'Lise', 'Liselotte', 'Lissi', 'Lissy',
'Liv', 'Lizzie', 'Lone', 'Lotte', 'Louise', 'Lydia', 'Lykke', 'Lærke', 'Magda', 'Magdalene', 'Mai', 'Maiken',
'Maj', 'Maja', 'Majbritt', 'Malene', 'Maren', 'Margit', 'Margrethe', 'Maria', 'Mariane', 'Marianne', 'Marie', 'Marlene',
'Martha', 'Martine', 'Mary', 'Mathilde', 'Matilde', 'Merete', 'Merethe', 'Meta', 'Mette', 'Mia', 'Michelle', 'Mie',
'Mille', 'Minna', 'Mona', 'Monica', 'Nadia', 'Nancy', 'Nanna', 'Nicoline', 'Nikoline', 'Nina', 'Ninna', 'Oda',
'Olga', 'Olivia', 'Orla', 'Paula', 'Pauline', 'Pernille', 'Petra', 'Pia', 'Poula', 'Ragnhild', 'Randi', 'Rasmine',
'Rebecca', 'Rebekka', 'Rigmor', 'Rikke', 'Rita', 'Rosa', 'Rose', 'Ruth', 'Sabrina', 'Sandra', 'Sanne', 'Sara',
'Sarah', 'Selma', 'Severin', 'Sidsel', 'Signe', 'Sigrid', 'Sine', 'Sofia', 'Sofie', 'Solveig', 'Solvejg', 'Sonja',
'Sophie', 'Stephanie', 'Stine', 'Susan', 'Susanne', 'Tanja', 'Thea', 'Theodora', 'Therese', 'Thi', 'Thyra', 'Tina',
'Tine', 'Tove', 'Trine', 'Ulla', 'Vera', 'Vibeke', 'Victoria', 'Viktoria', 'Viola', 'Vita', 'Vivi', 'Vivian',
'Winnie', 'Yrsa', 'Yvonne', 'Agnete', 'Agnethe', 'Alfrida', 'Alvilda', 'Anine', 'Bolette', 'Dorthea', 'Gunhild',
'Hansine', 'Inge-Lise', 'Jensine', 'Juel', 'Jørgine', 'Kamma', 'Kristiane', 'Maj-Britt', 'Margrete', 'Metha', 'Nielsine',
'Oline', 'Petrea', 'Petrine', 'Pouline', 'Ragna', 'Sørine', 'Thora', 'Valborg', 'Vilhelmine',
);
/**
* @var array Danish middle names.
*/
protected static $middleName = array(
'Møller', 'Lund', 'Holm', 'Jensen', 'Juul', 'Nielsen', 'Kjær', 'Hansen', 'Skov', 'Østergaard', 'Vestergaard',
'Nørgaard', 'Dahl', 'Bach', 'Friis', 'Søndergaard', 'Andersen', 'Bech', 'Pedersen', 'Bruun', 'Nygaard', 'Winther',
'Bang', 'Krogh', 'Schmidt', 'Christensen', 'Hedegaard', 'Toft', 'Damgaard', 'Holst', 'Sørensen', 'Juhl', 'Munk',
'Skovgaard', 'Søgaard', 'Aagaard', 'Berg', 'Dam', 'Petersen', 'Lind', 'Overgaard', 'Brandt', 'Larsen', 'Bak', 'Schou',
'Vinther', 'Bjerregaard', 'Riis', 'Bundgaard', 'Kruse', 'Mølgaard', 'Hjorth', 'Ravn', 'Madsen', 'Rasmussen',
'Jørgensen', 'Kristensen', 'Bonde', 'Bay', 'Hougaard', 'Dalsgaard', 'Kjærgaard', 'Haugaard', 'Munch', 'Bjerre', 'Due',
'Sloth', 'Leth', 'Kofoed', 'Thomsen', 'Kragh', 'Højgaard', 'Dalgaard', 'Hjort', 'Kirkegaard', 'Bøgh', 'Beck', 'Nissen',
'Rask', 'Høj', 'Brix', 'Storm', 'Buch', 'Bisgaard', 'Birch', 'Gade', 'Kjærsgaard', 'Hald', 'Lindberg', 'Høgh', 'Falk',
'Koch', 'Thorup', 'Borup', 'Knudsen', 'Vedel', 'Poulsen', 'Bøgelund', 'Juel', 'Frost', 'Hvid', 'Bjerg', 'Bæk', 'Elkjær',
'Hartmann', 'Kirk', 'Sand', 'Sommer', 'Skou', 'Nedergaard', 'Meldgaard', 'Brink', 'Lindegaard', 'Fischer', 'Rye',
'Hoffmann', 'Daugaard', 'Gram', 'Johansen', 'Meyer', 'Schultz', 'Fogh', 'Bloch', 'Lundgaard', 'Brøndum', 'Jessen',
'Busk', 'Holmgaard', 'Lindholm', 'Krog', 'Egelund', 'Engelbrecht', 'Buus', 'Korsgaard', 'Ellegaard', 'Tang', 'Steen',
'Kvist', 'Olsen', 'Nørregaard', 'Fuglsang', 'Wulff', 'Damsgaard', 'Hauge', 'Sonne', 'Skytte', 'Brun', 'Kronborg',
'Abildgaard', 'Fabricius', 'Bille', 'Skaarup', 'Rahbek', 'Borg', 'Torp', 'Klitgaard', 'Nørskov', 'Greve', 'Hviid',
'Mørch', 'Buhl', 'Rohde', 'Mørk', 'Vendelbo', 'Bjørn', 'Laursen', 'Egede', 'Rytter', 'Lehmann', 'Guldberg', 'Rosendahl',
'Krarup', 'Krogsgaard', 'Westergaard', 'Rosendal', 'Fisker', 'Højer', 'Rosenberg', 'Svane', 'Storgaard', 'Pihl',
'Mohamed', 'Bülow', 'Birk', 'Hammer', 'Bro', 'Kaas', 'Clausen', 'Nymann', 'Egholm', 'Ingemann', 'Haahr', 'Olesen',
'Nøhr', 'Brinch', 'Bjerring', 'Christiansen', 'Schrøder', 'Guldager', 'Skjødt', 'Højlund', 'Ørum', 'Weber',
'Bødker', 'Bruhn', 'Stampe', 'Astrup', 'Schack', 'Mikkelsen', 'Høyer', 'Husted', 'Skriver', 'Lindgaard', 'Yde',
'Sylvest', 'Lykkegaard', 'Ploug', 'Gammelgaard', 'Pilgaard', 'Brogaard', 'Degn', 'Kaae', 'Kofod', 'Grønbæk',
'Lundsgaard', 'Bagge', 'Lyng', 'Rømer', 'Kjeldgaard', 'Hovgaard', 'Groth', 'Hyldgaard', 'Ladefoged', 'Jacobsen',
'Linde', 'Lange', 'Stokholm', 'Bredahl', 'Hein', 'Mose', 'Bækgaard', 'Sandberg', 'Klarskov', 'Kamp', 'Green',
'Iversen', 'Riber', 'Smedegaard', 'Nyholm', 'Vad', 'Balle', 'Kjeldsen', 'Strøm', 'Borch', 'Lerche', 'Grønlund',
'Vestergård', 'Østergård', 'Nyborg', 'Qvist', 'Damkjær', 'Kold', 'Sønderskov', 'Bank',
);
/**
* @var array Danish last names.
*/
protected static $lastName = array(
'Jensen', 'Nielsen', 'Hansen', 'Pedersen', 'Andersen', 'Christensen', 'Larsen', 'Sørensen', 'Rasmussen', 'Petersen',
'Jørgensen', 'Madsen', 'Kristensen', 'Olsen', 'Christiansen', 'Thomsen', 'Poulsen', 'Johansen', 'Knudsen', 'Mortensen',
'Møller', 'Jacobsen', 'Jakobsen', 'Olesen', 'Frederiksen', 'Mikkelsen', 'Henriksen', 'Laursen', 'Lund', 'Schmidt',
'Eriksen', 'Holm', 'Kristiansen', 'Clausen', 'Simonsen', 'Svendsen', 'Andreasen', 'Iversen', 'Jeppesen', 'Mogensen',
'Jespersen', 'Nissen', 'Lauridsen', 'Frandsen', 'Østergaard', 'Jepsen', 'Kjær', 'Carlsen', 'Vestergaard', 'Jessen',
'Nørgaard', 'Dahl', 'Christoffersen', 'Skov', 'Søndergaard', 'Bertelsen', 'Bruun', 'Lassen', 'Bach', 'Gregersen',
'Friis', 'Johnsen', 'Steffensen', 'Kjeldsen', 'Bech', 'Krogh', 'Lauritsen', 'Danielsen', 'Mathiesen', 'Andresen',
'Brandt', 'Winther', 'Toft', 'Ravn', 'Mathiasen', 'Dam', 'Holst', 'Nilsson', 'Lind', 'Berg', 'Schou', 'Overgaard',
'Kristoffersen', 'Schultz', 'Klausen', 'Karlsen', 'Paulsen', 'Hermansen', 'Thorsen', 'Koch', 'Thygesen', 'Bak', 'Kruse',
'Bang', 'Juhl', 'Davidsen', 'Berthelsen', 'Nygaard', 'Lorentzen', 'Villadsen', 'Lorenzen', 'Damgaard', 'Bjerregaard',
'Lange', 'Hedegaard', 'Bendtsen', 'Lauritzen', 'Svensson', 'Justesen', 'Juul', 'Hald', 'Beck', 'Kofoed', 'Søgaard',
'Meyer', 'Kjærgaard', 'Riis', 'Johannsen', 'Carstensen', 'Bonde', 'Ibsen', 'Fischer', 'Andersson', 'Bundgaard',
'Johannesen', 'Eskildsen', 'Hemmingsen', 'Andreassen', 'Thomassen', 'Schrøder', 'Persson', 'Hjorth', 'Enevoldsen',
'Nguyen', 'Henningsen', 'Jønsson', 'Olsson', 'Asmussen', 'Michelsen', 'Vinther', 'Markussen', 'Kragh', 'Thøgersen',
'Johansson', 'Dalsgaard', 'Gade', 'Bjerre', 'Ali', 'Laustsen', 'Buch', 'Ludvigsen', 'Hougaard', 'Kirkegaard', 'Marcussen',
'Mølgaard', 'Ipsen', 'Sommer', 'Ottosen', 'Müller', 'Krog', 'Hoffmann', 'Clemmensen', 'Nikolajsen', 'Brodersen',
'Therkildsen', 'Leth', 'Michaelsen', 'Graversen', 'Frost', 'Dalgaard', 'Albertsen', 'Laugesen', 'Due', 'Ebbesen',
'Munch', 'Svenningsen', 'Ottesen', 'Fisker', 'Albrechtsen', 'Axelsen', 'Erichsen', 'Sloth', 'Bentsen', 'Westergaard',
'Bisgaard', 'Nicolaisen', 'Magnussen', 'Thuesen', 'Povlsen', 'Thorup', 'Høj', 'Bentzen', 'Johannessen', 'Vilhelmsen',
'Isaksen', 'Bendixen', 'Ovesen', 'Villumsen', 'Lindberg', 'Thomasen', 'Kjærsgaard', 'Buhl', 'Kofod', 'Ahmed', 'Smith',
'Storm', 'Christophersen', 'Bruhn', 'Matthiesen', 'Wagner', 'Bjerg', 'Gram', 'Nedergaard', 'Dinesen', 'Mouritsen',
'Boesen', 'Borup', 'Abrahamsen', 'Wulff', 'Gravesen', 'Rask', 'Pallesen', 'Greve', 'Korsgaard', 'Haugaard', 'Josefsen',
'Bæk', 'Espersen', 'Thrane', 'Mørch', 'Frank', 'Lynge', 'Rohde', 'Larsson', 'Hammer', 'Torp', 'Sonne', 'Boysen', 'Bay',
'Pihl', 'Fabricius', 'Høyer', 'Birch', 'Skou', 'Kirk', 'Antonsen', 'Høgh', 'Damsgaard', 'Dall', 'Truelsen', 'Daugaard',
'Fuglsang', 'Martinsen', 'Therkelsen', 'Jansen', 'Karlsson', 'Caspersen', 'Steen', 'Callesen', 'Balle', 'Bloch', 'Smidt',
'Rahbek', 'Hjort', 'Bjørn', 'Skaarup', 'Sand', 'Storgaard', 'Willumsen', 'Busk', 'Hartmann', 'Ladefoged', 'Skovgaard',
'Philipsen', 'Damm', 'Haagensen', 'Hviid', 'Duus', 'Kvist', 'Adamsen', 'Mathiassen', 'Degn', 'Borg', 'Brix', 'Troelsen',
'Ditlevsen', 'Brøndum', 'Svane', 'Mohamed', 'Birk', 'Brink', 'Hassan', 'Vester', 'Elkjær', 'Lykke', 'Nørregaard',
'Meldgaard', 'Mørk', 'Hvid', 'Abildgaard', 'Nicolajsen', 'Bengtsson', 'Stokholm', 'Ahmad', 'Wind', 'Rømer', 'Gundersen',
'Carlsson', 'Grøn', 'Khan', 'Skytte', 'Bagger', 'Hendriksen', 'Rosenberg', 'Jonassen', 'Severinsen', 'Jürgensen',
'Boisen', 'Groth', 'Bager', 'Fogh', 'Hussain', 'Samuelsen', 'Pilgaard', 'Bødker', 'Dideriksen', 'Brogaard', 'Lundberg',
'Hansson', 'Schwartz', 'Tran', 'Skriver', 'Klitgaard', 'Hauge', 'Højgaard', 'Qvist', 'Voss', 'Strøm', 'Wolff', 'Krarup',
'Green', 'Odgaard', 'Tønnesen', 'Blom', 'Gammelgaard', 'Jæger', 'Kramer', 'Astrup', 'Würtz', 'Lehmann', 'Koefoed',
'Skøtt', 'Lundsgaard', 'Bøgh', 'Vang', 'Martinussen', 'Sandberg', 'Weber', 'Holmgaard', 'Bidstrup', 'Meier', 'Drejer',
'Schneider', 'Joensen', 'Dupont', 'Lorentsen', 'Bro', 'Bagge', 'Terkelsen', 'Kaspersen', 'Keller', 'Eliasen', 'Lyberth',
'Husted', 'Mouritzen', 'Krag', 'Kragelund', 'Nørskov', 'Vad', 'Jochumsen', 'Hein', 'Krogsgaard', 'Kaas', 'Tolstrup',
'Ernst', 'Hermann', 'Børgesen', 'Skjødt', 'Holt', 'Buus', 'Gotfredsen', 'Kjeldgaard', 'Broberg', 'Roed', 'Sivertsen',
'Bergmann', 'Bjerrum', 'Petersson', 'Smed', 'Jeremiassen', 'Nyborg', 'Borch', 'Foged', 'Terp', 'Mark', 'Busch',
'Lundgaard', 'Boye', 'Yde', 'Hinrichsen', 'Matzen', 'Esbensen', 'Hertz', 'Westh', 'Holmberg', 'Geertsen', 'Raun',
'Aagaard', 'Kock', 'Falk', 'Munk',
);
/**
* Randomly return a danish name.
*
* @return string
*/
public static function middleName()
{
return static::randomElement(static::$middleName);
}
/**
* Randomly return a danish CPR number (Personnal identification number) format.
*
* @link http://cpr.dk/cpr/site.aspx?p=16
* @link http://en.wikipedia.org/wiki/Personal_identification_number_%28Denmark%29
*
* @return string
*/
public static function cpr()
{
$birthdate = new \DateTime('@' . mt_rand(0, time()));
return sprintf('%s-%s', $birthdate->format('dmy'), static::numerify('%###'));
}
}
| {
"pile_set_name": "Github"
} |
Windows Registry Editor Version 5.00
ഀഀ
[-HKEY_CLASSES_ROOT\.themepack]
ഀഀ
[HKEY_CLASSES_ROOT\.themepack]
䀀㴀∀琀栀攀洀攀瀀愀挀欀昀椀氀攀∀ഀഀ
ഀഀ
[-HKEY_CLASSES_ROOT\themepackfile]
ഀഀ
[HKEY_CLASSES_ROOT\themepackfile]
䀀㴀∀圀椀渀搀漀眀猀 吀栀攀洀攀 倀愀挀欀∀ഀഀ
"FriendlyTypeName"="@themeui.dll,-2685"
ഀഀ
[HKEY_CLASSES_ROOT\themepackfile\DefaultIcon]
䀀㴀栀攀砀⠀㈀⤀㨀㈀㔀Ⰰ Ⰰ㔀㌀Ⰰ Ⰰ㜀㤀Ⰰ Ⰰ㜀㌀Ⰰ Ⰰ㜀㐀Ⰰ Ⰰ㘀㔀Ⰰ Ⰰ㘀搀Ⰰ Ⰰ㔀㈀Ⰰ Ⰰ㘀昀Ⰰ Ⰰ㘀昀Ⰰ Ⰰ㜀㐀Ⰰ Ⰰ㈀㔀Ⰰ尀ഀഀ
00,5c,00,73,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,74,00,68,00,\
㘀㔀Ⰰ Ⰰ㘀搀Ⰰ Ⰰ㘀㔀Ⰰ Ⰰ㜀㔀Ⰰ Ⰰ㘀㤀Ⰰ Ⰰ㈀攀Ⰰ Ⰰ㘀㐀Ⰰ Ⰰ㘀挀Ⰰ Ⰰ㘀挀Ⰰ Ⰰ㈀挀Ⰰ Ⰰ㈀搀Ⰰ Ⰰ㌀㜀Ⰰ Ⰰ㌀ Ⰰ尀ഀഀ
00,34,00,00,00
ഀഀ
[HKEY_CLASSES_ROOT\themepackfile\shell]
ഀഀ
[HKEY_CLASSES_ROOT\themepackfile\shell\open]
ഀഀ
[HKEY_CLASSES_ROOT\themepackfile\shell\open\command]
䀀㴀栀攀砀⠀㈀⤀㨀㈀㔀Ⰰ Ⰰ㔀㌀Ⰰ Ⰰ㜀㤀Ⰰ Ⰰ㜀㌀Ⰰ Ⰰ㜀㐀Ⰰ Ⰰ㘀㔀Ⰰ Ⰰ㘀搀Ⰰ Ⰰ㔀㈀Ⰰ Ⰰ㘀昀Ⰰ Ⰰ㘀昀Ⰰ Ⰰ㜀㐀Ⰰ Ⰰ㈀㔀Ⰰ尀ഀഀ
00,5c,00,73,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,72,00,75,00,\
㘀攀Ⰰ Ⰰ㘀㐀Ⰰ Ⰰ㘀挀Ⰰ Ⰰ㘀挀Ⰰ Ⰰ㌀㌀Ⰰ Ⰰ㌀㈀Ⰰ Ⰰ㈀攀Ⰰ Ⰰ㘀㔀Ⰰ Ⰰ㜀㠀Ⰰ Ⰰ㘀㔀Ⰰ Ⰰ㈀ Ⰰ Ⰰ㈀㔀Ⰰ Ⰰ㔀㌀Ⰰ尀ഀഀ
00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,6f,00,74,00,25,00,5c,00,73,00,\
㜀㤀Ⰰ Ⰰ㜀㌀Ⰰ Ⰰ㜀㐀Ⰰ Ⰰ㘀㔀Ⰰ Ⰰ㘀搀Ⰰ Ⰰ㌀㌀Ⰰ Ⰰ㌀㈀Ⰰ Ⰰ㔀挀Ⰰ Ⰰ㜀㌀Ⰰ Ⰰ㘀㠀Ⰰ Ⰰ㘀㔀Ⰰ Ⰰ㘀挀Ⰰ Ⰰ㘀挀Ⰰ尀ഀഀ
00,33,00,32,00,2e,00,64,00,6c,00,6c,00,2c,00,43,00,6f,00,6e,00,74,00,72,00,\
㘀昀Ⰰ Ⰰ㘀挀Ⰰ Ⰰ㔀昀Ⰰ Ⰰ㔀㈀Ⰰ Ⰰ㜀㔀Ⰰ Ⰰ㘀攀Ⰰ Ⰰ㐀㐀Ⰰ Ⰰ㐀挀Ⰰ Ⰰ㐀挀Ⰰ Ⰰ㈀ Ⰰ Ⰰ㈀㔀Ⰰ Ⰰ㔀㌀Ⰰ Ⰰ㜀㤀Ⰰ尀ഀഀ
00,73,00,74,00,65,00,6d,00,52,00,6f,00,6f,00,74,00,25,00,5c,00,73,00,79,00,\
㜀㌀Ⰰ Ⰰ㜀㐀Ⰰ Ⰰ㘀㔀Ⰰ Ⰰ㘀搀Ⰰ Ⰰ㌀㌀Ⰰ Ⰰ㌀㈀Ⰰ Ⰰ㔀挀Ⰰ Ⰰ㘀㐀Ⰰ Ⰰ㘀㔀Ⰰ Ⰰ㜀㌀Ⰰ Ⰰ㘀戀Ⰰ Ⰰ㈀攀Ⰰ Ⰰ㘀㌀Ⰰ尀ഀഀ
00,70,00,6c,00,20,00,64,00,65,00,73,00,6b,00,2c,00,40,00,54,00,68,00,65,00,\
㘀搀Ⰰ Ⰰ㘀㔀Ⰰ Ⰰ㜀㌀Ⰰ Ⰰ㈀ Ⰰ Ⰰ㈀昀Ⰰ Ⰰ㐀Ⰰ Ⰰ㘀㌀Ⰰ Ⰰ㜀㐀Ⰰ Ⰰ㘀㤀Ⰰ Ⰰ㘀昀Ⰰ Ⰰ㘀攀Ⰰ Ⰰ㌀愀Ⰰ Ⰰ㐀昀Ⰰ尀ഀഀ
00,70,00,65,00,6e,00,54,00,68,00,65,00,6d,00,65,00,20,00,2f,00,66,00,69,00,\
㘀挀Ⰰ Ⰰ㘀㔀Ⰰ Ⰰ㌀愀Ⰰ Ⰰ㈀㈀Ⰰ Ⰰ㈀㔀Ⰰ Ⰰ㌀Ⰰ Ⰰ㈀㈀Ⰰ Ⰰ Ⰰ ഀഀ
ഀഀ
[-HKEY_CLASSES_ROOT\SystemFileAssociations\.themepack]
ഀഀ
嬀ⴀ䠀䬀䔀夀开䌀唀刀刀䔀一吀开唀匀䔀刀尀匀漀昀琀眀愀爀攀尀䴀椀挀爀漀猀漀昀琀尀圀椀渀搀漀眀猀尀䌀甀爀爀攀渀琀嘀攀爀猀椀漀渀尀䔀砀瀀氀漀爀攀爀尀䘀椀氀攀䔀砀琀猀尀⸀琀栀攀洀攀瀀愀挀欀崀ഀഀ
嬀䠀䬀䔀夀开䌀唀刀刀䔀一吀开唀匀䔀刀尀匀漀昀琀眀愀爀攀尀䴀椀挀爀漀猀漀昀琀尀圀椀渀搀漀眀猀尀䌀甀爀爀攀渀琀嘀攀爀猀椀漀渀尀䔀砀瀀氀漀爀攀爀尀䘀椀氀攀䔀砀琀猀尀⸀琀栀攀洀攀瀀愀挀欀尀伀瀀攀渀圀椀琀栀䰀椀猀琀崀ഀഀ
嬀䠀䬀䔀夀开䌀唀刀刀䔀一吀开唀匀䔀刀尀匀漀昀琀眀愀爀攀尀䴀椀挀爀漀猀漀昀琀尀圀椀渀搀漀眀猀尀䌀甀爀爀攀渀琀嘀攀爀猀椀漀渀尀䔀砀瀀氀漀爀攀爀尀䘀椀氀攀䔀砀琀猀尀⸀琀栀攀洀攀瀀愀挀欀尀伀瀀攀渀圀椀琀栀倀爀漀最椀搀猀崀ഀഀ
"themepackfile"=hex(0):
ഀഀ
ഀഀ
| {
"pile_set_name": "Github"
} |
/*
* Copyright (C) 2018 Alexander Borisov
*
* Author: Alexander Borisov <[email protected]>
*/
#ifndef LEXBOR_HTML_FORM_ELEMENT_H
#define LEXBOR_HTML_FORM_ELEMENT_H
#ifdef __cplusplus
extern "C" {
#endif
#include "lexbor/html/interface.h"
#include "lexbor/html/interfaces/element.h"
struct lxb_html_form_element {
lxb_html_element_t element;
};
LXB_API lxb_html_form_element_t *
lxb_html_form_element_interface_create(lxb_html_document_t *document);
LXB_API lxb_html_form_element_t *
lxb_html_form_element_interface_destroy(lxb_html_form_element_t *form_element);
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* LEXBOR_HTML_FORM_ELEMENT_H */
| {
"pile_set_name": "Github"
} |
/**
* This file is part of LIBCUTIL.
*
* LIBCUTIL is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* LIBCUTIL is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with LIBCUTIL. If not, see <http://www.gnu.org/licenses/>.
*
* Copyright 2007-2011 J. A.
*/
#ifndef _CUTIL_H
#define _CUTIL_H
#include "mxml.hpp"
#include "slots.hpp"
#include <string>
#include <stdint.h>
#include <vector>
#ifdef BLACKFIN
#define __func__ ""
#define nullptr 0
#endif
/** @brief Portable miscellaneous functions */
namespace utils
{
/** @cond not-documented */
template <class T>
class refcnt
{
public:
T *ptr;
int count;
};
/** @endcond */
/** @brief Reference counting shared pointer (until std::shared_ptr supported natively by visual dsp)
*
* TODO: remove and replace by std::shared_ptr (NOT UNTIL VISUAL DSP COMPILER SUPPORT C++11).
* */
template <typename T>
class refptr
{
public:
explicit refptr(T *p)
{
reference = new refcnt<T>();
reference->ptr = p;
reference->count = 1;
}
explicit refptr(const T& t)
{
reference = new refcnt<T>();
reference->ptr = new T(t);
reference->count = 1;
}
/*explicit refptr(T *p, void (T:: *tell_container)(refcnt<T> *ptr))
{
reference = new refcnt<T>();
reference->ptr = p;
reference->count = 1;
// Tell the contained class its unique container.
if(tell_container != 0)
{
p->tell_container(reference);
}
}*/
refptr()
{
reference = nullptr;
}
bool is_nullptr() const
{
return reference == nullptr;
}
bool operator ==(const refptr &r) const
{
return reference == r.reference;
}
refptr &operator =(const refptr &r)
{
if(r.reference != nullptr)
r.reference->count++;
if((reference != nullptr) && (r.reference != reference))
{
reference->count--;
if(reference->count <= 0)
{
delete reference->ptr;
delete reference;
reference = nullptr;
}
}
reference = r.reference;
return *this;
}
refptr(const refptr &r)
{
reference = nullptr;
*(this) = r;
}
T *get_reference()
{
if(reference == nullptr)
return nullptr;
return reference->ptr;
}
~refptr()
{
if(reference != nullptr)
{
reference->count--;
if(reference->count == 0)
{
if(reference->ptr != nullptr)
{
delete reference->ptr;
reference->ptr = nullptr;
}
delete reference;
reference = nullptr;
}
}
}
T &operator*()
{
return *(reference->ptr);
}
const T &operator*() const
{
return *(reference->ptr);
}
T *operator->()
{
return reference->ptr;
}
const T *operator->() const
{
return reference->ptr;
}
//private: // (to uncomment)
refcnt<T> *reference;
explicit refptr(refcnt<T> *rcnt)
{
reference = rcnt;
if(reference != nullptr)
reference->count++;
}
};
template <typename T>
class uptr
{
public:
explicit uptr(T *p)
{
ptr = p;
}
explicit uptr(const T &p)
{
ptr = new T(p);
}
/*explicit refptr(T *p, void (T:: *tell_container)(refcnt<T> *ptr))
{
reference = new refcnt<T>();
reference->ptr = p;
reference->count = 1;
// Tell the contained class its unique container.
if(tell_container != 0)
{
p->tell_container(reference);
}
}*/
uptr()
{
ptr = nullptr;
}
bool is_nullptr() const
{
return ptr == nullptr;
}
bool operator ==(const uptr &r) const
{
return *(r.ptr) == *ptr;
}
uptr &operator =(const uptr &r)
{
if(r.ptr != nullptr)
ptr = new T(*(r.ptr));
else
ptr = nullptr;
return *this;
}
uptr(const uptr &r)
{
ptr = nullptr;
*(this) = r;
}
T *get_reference()
{
if(ptr == nullptr)
return nullptr;
return ptr;
}
~uptr()
{
if(ptr != nullptr)
{
delete ptr;
ptr = nullptr;
}
}
T &operator*()
{
return *ptr;
}
const T &operator*() const
{
return *ptr;
}
T *operator->()
{
return ptr;
}
const T *operator->() const
{
return ptr;
}
private:
T *ptr;
explicit uptr(uptr<T> *rcnt)
{
ptr = new T(*(rcnt->ptr));
}
};
/** @cond not-documented */
template <class T>
class arraycnt
{
public:
T *ptr;
int count;
};
/** @endcond */
/** @brief Reference counting shared pointer (until std::shared_ptr supported natively by visual dsp)
*
* TODO: remove and replace by std::shared_ptr (NOT UNTIL VISUAL DSP COMPILER SUPPORT C++11).
* */
template <typename T>
class arrayptr
{
public:
explicit arrayptr(T *p)
{
reference = new arraycnt<T>();
reference->ptr = p;
reference->count = 1;
}
/*explicit refptr(T *p, void (T:: *tell_container)(refcnt<T> *ptr))
{
reference = new refcnt<T>();
reference->ptr = p;
reference->count = 1;
// Tell the contained class its unique container.
if(tell_container != 0)
{
p->tell_container(reference);
}
}*/
arrayptr()
{
reference = nullptr;
}
bool is_nullptr() const
{
return reference == nullptr;
}
bool operator ==(const arrayptr &r) const
{
return reference == r.reference;
}
arrayptr &operator =(const arrayptr &r)
{
if(r.reference != nullptr)
r.reference->count++;
if((reference != nullptr) && (r.reference != reference))
{
reference->count--;
if(reference->count <= 0)
{
delete [] reference->ptr;
reference->ptr = nullptr;
delete reference;
reference = nullptr;
}
}
reference = r.reference;
return *this;
}
arrayptr(const arrayptr &r)
{
reference = nullptr;
*(this) = r;
}
T *get_reference()
{
if(reference == nullptr)
return nullptr;
return reference->ptr;
}
~arrayptr()
{
if(reference != nullptr)
{
reference->count--;
if(reference->count == 0)
{
if(reference->ptr != nullptr)
{
delete [] reference->ptr;
reference->ptr = nullptr;
}
delete reference;
reference = nullptr;
}
}
}
T &operator*()
{
return *(reference->ptr);
}
T *operator->()
{
return reference->ptr;
}
const T *operator->() const
{
return reference->ptr;
}
//private: // (to uncomment)
arraycnt<T> *reference;
explicit arrayptr(arraycnt<T> *rcnt)
{
reference = rcnt;
if(reference != nullptr)
reference->count++;
}
};
namespace model
{
/** @brief A localized string, in UTF 8. */
class Localized
{
public:
/** Different languages */
typedef enum LanguageEnum
{
/** Unlocalized identifier, used for identification in the code */
LANG_ID = 0,
/** Currently configured language */
LANG_CURRENT = 1,
/** French */
LANG_FR = 2,
/** English */
LANG_EN = 3,
/** German */
LANG_DE = 4,
/** Russian */
LANG_RU = 5,
LANG_ES = 6,
/** Unspecified language */
LANG_UNKNOWN = 255
} Language;
static Language current_language;
Localized();
Localized(const Localized &l);
Localized(const utils::model::MXml &mx);
void operator =(const Localized &l);
void set_value(Language lg, std::string value);
void set_description(Language lg, std::string desc);
/** @brief Get the value in the specified language (by default "ID language") */
std::string get_value(Language lg = LANG_ID) const;
/** @brief Equivalent to get_value(LANG_CURRENT) */
std::string get_localized() const;
/** @brief Equivalent to get_value(LANG_ID) */
inline std::string get_id() const {return id;}
/** @brief Get the HTML description in the specified language */
std::string get_description(Language lg = LANG_CURRENT) const;
bool has_description() const;
/** @brief Parse language string ("fr" -> LANG_FR, "en" -> LANG_EN, ...) */
static Language parse_language(std::string id);
static std::string language_id(Language l);
static std::vector<Language> language_list();
std::string to_string() const;
private:
/** @brief The different values in different languages, in UTF8 format. */
std::vector<std::pair<Language, std::string> > items;
/** @brief The different descriptions in different languages, in UTF8 format. */
std::vector<std::pair<Language, std::string> > descriptions;
std::string id;
};
}
/** @brief Command line argument parsing */
class CmdeLine
{
public:
CmdeLine(const std::string args);
CmdeLine(int argc, const char **argv);
CmdeLine(int argc, char **argv);
CmdeLine();
void operator =(const CmdeLine &cmdeline);
bool has_option(const std::string &name) const;
std::string get_option(const std::string &name,
const std::string &default_value = "") const;
int get_int_option(const std::string &name,
int default_value) const;
void set_option(const std::string &name, const std::string &value);
private:
void init(std::vector<std::string> &lst);
void init(int argc, const char **argv);
class CmdeLinePrm
{
public:
std::string option;
std::string value;
};
std::deque<CmdeLinePrm> prms;
public:
//int argc;
std::string argv0;
};
/** @brief Initialise paths and analyse standard command line options.
* Options managed:
* - [-v] : enable debug infos on stdout
* - [-L fr|en|de] : specify current language
* - [-q] : disable log files.
*
* @param cmdeline Command line arguments.
* @param projet Name of the project (used to define the application data folders).
* @param app Name of the application */
extern void init(CmdeLine &cmde_line,
const std::string &projet,
const std::string &app = "",
unsigned int vmaj = 0,
unsigned int vmin = 0,
unsigned int vpatch = 0);
extern void init(int argc, const char **argv,
const std::string &projet,
const std::string &app = "",
unsigned int vmaj = 0,
unsigned int vmin = 0,
unsigned int vpatch = 0);
/** @brief Read an environment variable */
extern std::string get_env_variable(const std::string &name, const std::string &default_value = "");
/** @brief Path to fixed data (same as exec path for windows, /usr/share/appname for linux) */
extern std::string get_fixed_data_path();
/** @brief Get the path to the current user parameters directory (e.g. C:\\Doc and Settings\\CURRENT_USER\\AppData\\AppName) */
extern std::string get_current_user_path();
/** @brief Get the path to the current user document directory (e.g. C:\\Doc and Settings\\CURRENT_USER\\AppName) */
extern std::string get_current_user_doc_path();
/** @brief Get the path to path the all user parameters directory (e.g. C:\\Doc and Settings\\All Users\\AppData\\AppName) */
extern std::string get_all_user_path();
/** @brief Path to local images (returns img sub-folder of fixed data path. */
extern std::string get_img_path();
/** @brief Return the path containing the currently executed module . */
extern std::string get_execution_path();
extern std::string get_current_date_time();
/** Execute a system command, block until it is finished. */
extern int proceed_syscmde(std::string cmde, ...);
/** Execute a system command, returns immediatly. */
extern int proceed_syscmde_bg(std::string cmde, ...);
/** @brief Static utilities functions */
class Util
{
public:
#ifndef TESTCLI
static void show_error(std::string title, std::string content);
static void show_warning(std::string title, std::string content);
#endif
static uint32_t extract_bits(uint8_t *buffer, uint32_t offset_in_bits, uint32_t nbits);
};
namespace str
{
std::string to_latex(const std::string s);
std::string str_to_cst(std::string name);
std::string str_to_var(std::string name);
std::string str_to_class(std::string name);
std::string str_to_file(std::string name);
/** Returns an abbridged version of the specified file path (for display purpose) */
std::string get_filename_resume(const std::string &filename, unsigned int max_chars = 30);
bool is_deci(char c);
bool is_hexa(char c);
/** @brief Convert an integer to "x bytes", "x kbi", "x mbi", "y gbi" */
std::string int2str_capacity(uint64_t val, bool truncate = false);
std::string int2str(int i);
std::string int2str(int i, int nb_digits);
std::string int2strhexa(int i);
std::string int2strhexa(int i, int nbits);
std::string uint2strhexa(int i);
std::string int2strasm(int i);
std::string xmlAtt(std::string name, std::string val);
std::string xmlAtt(std::string name, int val);
std::string xmlAtt(std::string name, bool val);
std::string latin_to_utf8(std::string s_);
std::string utf8_to_latin(std::string s);
std::string lowercase(std::string s);
int parse_int_list(const std::string s, std::vector<int> &res);
int parse_string_list(const std::string s, std::vector<std::string> &res, char separator);
int parse_hexa_list(const std::string s, std::vector<unsigned char> &res);
void encode_str(std::string str, std::vector<unsigned char> vec);
void encode_byte_array_deci(std::string str, std::vector<unsigned char> vec);
void encode_byte_array_hexa(std::string str, std::vector<unsigned char> vec);
std::string unix_path_to_win_path(std::string s_);
}
namespace files
{
bool file_exists(std::string name);
bool dir_exists(std::string name);
int copy_file(std::string target, std::string source);
int creation_dossier(std::string path);
int explore_dossier(std::string chemin, std::vector<std::string> &fichiers);
//int liste_dossier(const std::string &path, std::vector<std::string> &res);
/** @brief If the directory does not exist, try to create it. */
int check_and_build_directory(std::string path);
void split_path_and_filename(const std::string complete_filename, std::string &path, std::string &filename);
std::string get_path_separator();
std::string correct_path_separators(std::string s);
std::string build_absolute_path(const std::string absolute_origin, const std::string relative_path);
void delete_file(std::string name);
int save_txt_file(std::string filename, std::string content);
/** @brief Retrieve file extension from a file path
* Example: from "a.jpg", returns "jpg". */
std::string get_extension(const std::string &filepath);
std::string remove_extension(const std::string &filepath);
int parse_filepath(const std::string &path,
std::vector<std::string> &items);
int abs2rel(const std::string &ref,
const std::string &abs,
std::string &result);
int rel2abs(const std::string &ref,
const std::string &rel,
std::string &result);
void remplacement_motif(std::string &chemin);
}
class TextAlign
{
public:
TextAlign();
void add(std::string comment);
void add(std::string s1, std::string s2);
void add(std::string s1, std::string s2, std::string s3);
std::string get_result();
private:
std::vector<std::string > alst1;
std::vector<std::string > alst2;
std::vector<std::string > alst3;
std::vector<std::string > comments;
std::vector<unsigned int> comments_pos;
};
class TextMatrix
{
public:
TextMatrix(uint32_t ncols);
void add(std::string s);
void add_unformatted_line(std::string s);
void next_line();
std::string get_result();
void reset(uint32_t ncols);
private:
uint32_t ncols;
std::vector<std::string> current_row;
std::vector<std::vector<std::string> > lst;
std::vector<bool> unformatted;
};
// TODO: rename
class Section
{
public:
Section();
Section(const Section &c);
~Section();
void operator =(const Section &c);
bool has_item(const std::string &name) const;
std::string get_item(const std::string &name) const;
const utils::model::Localized &get_localized(const std::string &name) const;
Section &get_section(const std::string &name);
const Section &get_section(const std::string &name) const;
void load();
void load(std::string filename);
void load(const utils::model::MXml &data);
private:
Section(const utils::model::MXml &data);
std::vector<utils::model::Localized> elmts;
std::vector<utils::refptr<Section>> subs;
std::string nom;
};
class Test
{
public:
virtual int proceed() = 0;
};
/** @brief Test framework */
class TestUtil
{
public:
TestUtil(const utils::CmdeLine &cmdeline);
TestUtil(const std::string &module, const std::string &prg, int argc, const char **argv);
int add_test(const std::string &name, int (*test_routine)());
int add_test(const std::string &name, Test *test);
int proceed();
/** @param precision: relative precision, in percent. */
static int check_value(float v, float ref, float precision = 0.0, const std::string &refname = "");
private:
class TestUnit
{
public:
std::string name;
int (*test_routine)();
Test *test;
};
std::vector<TestUnit> units;
utils::CmdeLine cmdeline;
};
/** @brief Command line, as defined by the application */
class CmdeLineDefinition
{
public:
/** @brief Load the command line definition from an XML string.
*
*
* // PB: temps de chargement std-schema...
* <schema name="cmdeline-spec" root="cmdeline-spec">
* <node name="cmdeline-spec">
* <sub-node name="arg" inherits="attribute"/>
* </node>
* </schema>
*
*
* Example:
* <cmdeline>
* <arg name="i" mandatory="true" fr="Fichier d'entrée">
* <description lang="fr">Chemin complet du fichier d'entrée</description>
* </arg>
* </cmdeline>
*/
int from_xml(const std::string &xml_definition);
/** @brief Display usage info on the specified output stream */
void usage(std::ostream &out) const;
/** @returns 0 if cmdeline is valid, otherwise display an error message.
* also, recognize and manage --help and --usage commands, and in this case,
* exits silently. */
int check_cmdeline(const CmdeLine &cmdeline) const;
/** exit(-1) if cmdeline is not valid. */
void check_cmdeline_and_fail(const CmdeLine &cmdeline) const;
private:
class Prm
{
public:
model::Localized name;
enum type
{
TP_FILE = 0, // file path
TP_EXFILE = 1, // existing file path
TP_INT = 2, // integer
TP_STRING = 3 // string
};
bool mandatory;
bool has_default;
std::string default_value;
std::string value;
};
std::vector<Prm> prms;
};
template<class VT, class T>
bool contains(const VT &container, const T &t)
{
for(const T &t2: container)
{
if(t2 == t)
return true;
}
return false;
}
#ifdef LINUX
# define PATH_SEP "/"
#else
# define PATH_SEP "\\"
#endif
# ifdef SAFE_MODE
# define assert_safe(EE) assert((EE))
# else
# define assert_safe(EE)
# endif
extern Section langue;
}
#include "templates/cutil-private.hpp"
#endif /* _CUTIL_H */
| {
"pile_set_name": "Github"
} |
---
title: Moving ACE3 frameworks to CBA
description: We are moving ACE3 functionality to CBA. Everyone can use those functions now without needing a dependency on ACE
parent: posts
image: /img/news/160601_cbaPost.jpg
author: Glowbal
layout: post
---
The upcoming release of ACE3 is going to be version 3.6.0. This release consists of bug fixes, improvements upon existing functionality and moving large parts of our internal frameworks to [CBA A3](https://github.com/CBATeam/CBA_A3){:target="_blank"}. This post is all about that last part. So what does this mean?
<!--more-->
## Motivation behind moving this functionality
Within ACE3 we have built some awesome and useful frameworks that have helped us develop consistent and high quality sqf components. The ACE3 and CBA teams both believe that such frameworks can benefit the Arma community as a whole. Putting such frameworks in CBA means that other mods will have access to the same internal functionality that ACE3 does, without having to depend upon ACE3 itself, but just CBA.
## For regular users
If you are a regular user this only means that you will need to update your CBA installation to the latest version (Beginning from [CBA 2.4.0](https://github.com/CBATeam/CBA_A3/releases/tag/v2.4.0.160530){:target="_blank"}). This is something we recommend doing on every CBA and or ACE3 release. And that's it. You as an user should see no difference. Feel free to continue reading the rest of this post, though it is meant for developers.
## For developers
If you are a developer, this change will have a more significant impact. A lot of our framework functions are now wrappers around CBA functionality and should no longer be used in any existing modifications or scripts. These changes will be part of [CBA 2.4.0](https://github.com/CBATeam/CBA_A3/releases/tag/v2.4.0.160530){:target="_blank"} and upwards. In accordance with our deprecation policy, all of those wrappers are going to be removed in 2 minor (not hotfixes) updates from 3.6.0, which will be version 3.8.0. This means that from version 3.8.0 all the wrappers won't be usable anymore thus leading to script errors and broken mods/missions.
So which frameworks are being moved? They are the core parts that are used within our entire project:
**Events Framework:**
|ACE function name | CBA function name|
|------------ | -------------|
|ace_common_fnc_addEventHandler | CBA_fnc_addEventHandler|
|ace_common_fnc_removeEventHandler | CBA_fnc_removeEventHandler|
|ace_common_fnc_globalEvent | CBA_fnc_globalEvent|
|ace_common_fnc_localEvent | CBA_fnc_localEvent|
|ace_common_fnc_serverEvent | CBA_fnc_serverEvent|
|ace_common_fnc_targetEvent | CBA_fnc_targetEvent|
|ace_common_fnc_objectEvent | CBA_fnc_targetEvent (includes functionality from objectEvent)|
|ace_common_fnc_removeAllEventHandlers| *removed* |
**Functionality we build on top of the CBA PerFrameHandler:**
|ACE function name | CBA function name|
|------------ | -------------|
|ace_common_fnc_waitAndExecute | CBA_fnc_waitAndExecute|
|ace_common_fnc_waitUntilAndExecute | CBA_fnc_waitUntilAndExecute|
|ace_common_fnc_execNextFrame | CBA_fnc_execNextFrame|
**Config functions:**
*(note: CBA functions return type config in comparison to ACE3's return type string)*
|ACE function name | CBA function name|
|------------ | -------------|
|ace_common_fnc_getConfigType | CBA_fnc_getItemConfig|
|ace_common_fnc_getConfigTypeObject | CBA_fnc_getObjectConfig|
**Binocular Magazines functions:**
|ACE function name | CBA function name|
|------------ | -------------|
|ace_common_fnc_binocularMagazine | CBA_fnc_binocularMagazine|
|ace_common_fnc_removeBinocularMagazine | CBA_fnc_removeBinocularMagazine|
This update does not mean that if your mod depends on any of this functionality it is going to break right away. We are exposing the functions in a similar fashion as we have previously. Any usage of any function that is deprecated, will result in a warning message being printed in the RPT log file. This message shows what function was used, what it was replaced by and when the used function is no longer going to be available.
### Replacing deprecated functionality
It is recommended to replace any functionality that is deprecated with its replacement as soon as possible. If you are in need of any help with moving from deprecated ACE3 functionality to it's replacement, please visit our [Public Slack team at https://slackin.ace3mod.com](https://slackin.ace3mod.com){:target="_blank"}.
## ACE3 Events
As part of moving the events framework to CBA, events added in ACE3 are being renamed to avoid conflict with other addons using CBA's events framework - it also provides us an opportunity to standardise our event naming convention.
Any code currently using the old ACE3 event functions will still function correctly as the wrappers include code to update old event names to new event names (using entries found in config class ACE_newEvents). However, when you are transfering code over to the CBA system remember to update the event names if you are making use of our events.
---
We hope you like the new frameworks made publicly available in CBA A3 and without needing a dependency on ACE3. Feel free to leave your feedback either on the [CBA BI forum thread](https://forums.bistudio.com/topic/168277-cba-community-base-addons-arma-3/){:target="_blank"}, the [ACE3 BI forum thread](https://forums.bistudio.com/topic/181341-ace3-a-collaborative-merger-between-agm-cse-and-ace/){:target="_blank"} or in our [public chat](https://slackin.ace3mod.com){:target="_blank"}.
| {
"pile_set_name": "Github"
} |
/*
* Copyright (C) 2007, Robin Rosenberg <[email protected]>
* Copyright (C) 2008, Shawn O. Pearce <[email protected]>
* Copyright (C) 2008, Kevin Thompson <[email protected]>
* Copyright (C) 2009, Henon <[email protected]>
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or
* without modification, are permitted provided that the following
* conditions are met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
*
* - Neither the name of the Git Development Community nor the
* names of its contributors may be used to endorse or promote
* products derived from this software without specific prior
* written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using System.IO;
namespace GitSharp.Core
{
public class FileMode : IEquatable<FileMode>
{
// [henon] c# does not support octal literals, so every number starting with 0 in java code had to be converted to decimal!
// Here are the octal literals used by jgit and their decimal counterparts:
// decimal ... octal
// 33188 ... 0100644
// 33261 ... 0100755
// 61440 ... 0170000
// 16384 ... 0040000
// 32768 ... 0100000
// 40960 ... 0120000
// 57344 ... 0160000
// 73 ... 0111
public delegate bool EqualsDelegate(int bits);
public const int OCTAL_0100644 = 33188;
public const int OCTAL_0100755 = 33261;
public const int OCTAL_0111 = 73;
/// <summary> Bit pattern for <see cref="TYPE_MASK"/> matching <see cref="RegularFile"/>.</summary>
public const int TYPE_FILE = 32768;
/// <summary> Bit pattern for <see cref="TYPE_MASK"/> matching <see cref="GitLink"/>. </summary>
public const int TYPE_GITLINK = 57344;
/// <summary>
/// Mask to apply to a file mode to obtain its type bits.
/// <para/>
/// <see cref="TYPE_TREE"/>
/// <see cref="TYPE_SYMLINK"/>
/// <see cref="TYPE_FILE"/>
/// <see cref="TYPE_GITLINK"/>
/// <see cref="TYPE_MISSING"/>
/// </summary>
public const int TYPE_MASK = 61440;
/// <summary> Bit pattern for <see cref="TYPE_MASK"/> matching <see cref="Missing"/>. </summary>
public const int TYPE_MISSING = 0;
public const int TYPE_SYMLINK = 40960;
public const int TYPE_TREE = 16384;
public static readonly FileMode ExecutableFile =
new FileMode(OCTAL_0100755, ObjectType.Blob,
modeBits => (modeBits & TYPE_MASK) == TYPE_FILE && (modeBits & OCTAL_0111) != 0);
public static readonly FileMode GitLink =
new FileMode(TYPE_GITLINK, ObjectType.Commit,
modeBits => (modeBits & TYPE_MASK) == TYPE_GITLINK);
public static readonly FileMode Missing =
new FileMode(0, ObjectType.Bad, modeBits => modeBits == 0);
public static readonly FileMode RegularFile =
new FileMode(OCTAL_0100644, ObjectType.Blob,
modeBits => (modeBits & TYPE_MASK) == TYPE_FILE && (modeBits & OCTAL_0111) == 0);
public static readonly FileMode Symlink =
new FileMode(TYPE_SYMLINK, ObjectType.Blob,
modeBits => (modeBits & TYPE_MASK) == TYPE_SYMLINK);
[field: NonSerialized]
public static readonly FileMode Tree =
new FileMode(TYPE_TREE, ObjectType.Tree,
modeBits => (modeBits & TYPE_MASK) == TYPE_TREE);
public static FileMode FromBits(int bits)
{
switch (bits & TYPE_MASK) // octal 0170000
{
case 0:
if (bits == 0)
{
return Missing;
}
break;
case TYPE_TREE: // octal 0040000
return Tree;
case TYPE_FILE: // octal 0100000
return (bits & OCTAL_0111) != 0 ? ExecutableFile : RegularFile;
case TYPE_SYMLINK: // octal 0120000
return Symlink;
case TYPE_GITLINK: // octal 0160000
return GitLink;
}
return new FileMode(bits, ObjectType.Bad, a => bits == a);
}
private readonly byte[] _octalBytes;
private FileMode(int mode, ObjectType type, Func<int, bool> equalityFunction)
{
if (equalityFunction == null)
{
throw new ArgumentNullException("equalityFunction");
}
EqualityFunction = equalityFunction;
Bits = mode;
ObjectType = type;
if (mode != 0)
{
var tmp = new byte[10];
int p = tmp.Length;
while (mode != 0)
{
tmp[--p] = (byte)((byte)'0' + (mode & 07));
mode >>= 3;
}
_octalBytes = new byte[tmp.Length - p];
for (int k = 0; k < _octalBytes.Length; k++)
{
_octalBytes[k] = tmp[p + k];
}
}
else
{
_octalBytes = new[] { (byte)'0' };
}
}
public Func<int, bool> EqualityFunction { get; private set; }
public int Bits { get; private set; }
public ObjectType ObjectType { get; private set; }
public void CopyTo(Stream stream)
{
new BinaryWriter(stream).Write(_octalBytes);
}
/// <returns>Returns the number of bytes written by <see cref="CopyTo(Stream)"/></returns>
public int copyToLength()
{
return _octalBytes.Length;
}
public bool Equals(FileMode other)
{
if (ReferenceEquals(null, other)) return false;
if (ReferenceEquals(this, other)) return true;
return EqualityFunction(other.Bits);
}
public override bool Equals(object obj)
{
if (ReferenceEquals(null, obj)) return false;
if (ReferenceEquals(this, obj)) return true;
if (obj.GetType() == typeof(int)) return Equals(FromBits((int)obj));
if (obj.GetType() != typeof(FileMode)) return false;
return Equals((FileMode)obj);
}
public override int GetHashCode()
{
unchecked
{
return (EqualityFunction.GetHashCode() * 397) ^ ObjectType.GetHashCode();
}
}
public static bool operator ==(FileMode left, FileMode right)
{
return Equals(left, right);
}
public static bool operator !=(FileMode left, FileMode right)
{
return !Equals(left, right);
}
}
} | {
"pile_set_name": "Github"
} |
<?php
namespace Drupal\config_translation;
use Drupal\Core\Config\ConfigFactoryInterface;
use Drupal\Core\Config\Entity\ConfigEntityInterface;
use Drupal\Core\Config\TypedConfigManagerInterface;
use Drupal\Core\DependencyInjection\DeprecatedServicePropertyTrait;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Language\LanguageManagerInterface;
use Drupal\Core\Routing\RouteMatchInterface;
use Drupal\Core\Routing\RouteProviderInterface;
use Drupal\Core\StringTranslation\TranslationInterface;
use Drupal\Core\Url;
use Drupal\locale\LocaleConfigManager;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\Routing\Route;
/**
* Configuration mapper for configuration entities.
*/
class ConfigEntityMapper extends ConfigNamesMapper {
use DeprecatedServicePropertyTrait;
/**
* {@inheritdoc}
*/
protected $deprecatedProperties = [
'entityManager' => 'entity.manager',
];
/**
* The entity manager.
*
* @var \Drupal\Core\Entity\EntityTypeManagerInterface
*/
protected $entityTypeManager;
/**
* Configuration entity type name.
*
* @var string
*/
protected $entityType;
/**
* Loaded entity instance to help produce the translation interface.
*
* @var \Drupal\Core\Config\Entity\ConfigEntityInterface
*/
protected $entity;
/**
* The label for the entity type.
*
* @var string
*/
protected $typeLabel;
/**
* Constructs a ConfigEntityMapper.
*
* @param string $plugin_id
* The config mapper plugin ID.
* @param mixed $plugin_definition
* An array of plugin information as documented in
* ConfigNamesMapper::__construct() with the following additional keys:
* - entity_type: The name of the entity type this mapper belongs to.
* @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
* The configuration factory.
* @param \Drupal\Core\Config\TypedConfigManagerInterface $typed_config
* The typed configuration manager.
* @param \Drupal\locale\LocaleConfigManager $locale_config_manager
* The locale configuration manager.
* @param \Drupal\config_translation\ConfigMapperManagerInterface $config_mapper_manager
* The mapper plugin discovery service.
* @param \Drupal\Core\Routing\RouteProviderInterface $route_provider
* The route provider.
* @param \Drupal\Core\StringTranslation\TranslationInterface $translation_manager
* The string translation manager.
* @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
* The entity manager.
* @param \Drupal\Core\Language\LanguageManagerInterface $language_manager
* The language manager.
* @param \Symfony\Component\EventDispatcher\EventDispatcherInterface $event_dispatcher
* The event dispatcher.
*/
public function __construct($plugin_id, $plugin_definition, ConfigFactoryInterface $config_factory, TypedConfigManagerInterface $typed_config, LocaleConfigManager $locale_config_manager, ConfigMapperManagerInterface $config_mapper_manager, RouteProviderInterface $route_provider, TranslationInterface $translation_manager, EntityTypeManagerInterface $entity_type_manager, LanguageManagerInterface $language_manager, EventDispatcherInterface $event_dispatcher = NULL) {
parent::__construct($plugin_id, $plugin_definition, $config_factory, $typed_config, $locale_config_manager, $config_mapper_manager, $route_provider, $translation_manager, $language_manager, $event_dispatcher);
$this->setType($plugin_definition['entity_type']);
$this->entityTypeManager = $entity_type_manager;
}
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
// Note that we ignore the plugin $configuration because mappers have
// nothing to configure in themselves.
return new static(
$plugin_id,
$plugin_definition,
$container->get('config.factory'),
$container->get('config.typed'),
$container->get('locale.config_manager'),
$container->get('plugin.manager.config_translation.mapper'),
$container->get('router.route_provider'),
$container->get('string_translation'),
$container->get('entity_type.manager'),
$container->get('language_manager'),
$container->get('event_dispatcher')
);
}
/**
* {@inheritdoc}
*/
public function populateFromRouteMatch(RouteMatchInterface $route_match) {
$entity = $route_match->getParameter($this->entityType);
$this->setEntity($entity);
parent::populateFromRouteMatch($route_match);
}
/**
* Gets the entity instance for this mapper.
*
* @return \Drupal\Core\Config\Entity\ConfigEntityInterface
* The configuration entity.
*/
public function getEntity() {
return $this->entity;
}
/**
* Sets the entity instance for this mapper.
*
* This method can only be invoked when the concrete entity is known, that is
* in a request for an entity translation path. After this method is called,
* the mapper is fully populated with the proper display title and
* configuration names to use to check permissions or display a translation
* screen.
*
* @param \Drupal\Core\Config\Entity\ConfigEntityInterface $entity
* The configuration entity to set.
*
* @return bool
* TRUE, if the entity was set successfully; FALSE otherwise.
*/
public function setEntity(ConfigEntityInterface $entity) {
if (isset($this->entity)) {
return FALSE;
}
$this->entity = $entity;
// Add the list of configuration IDs belonging to this entity. We add on a
// possibly existing list of names. This allows modules to alter the entity
// page with more names if form altering added more configuration to an
// entity. This is not a Drupal 8 best practice (ideally the configuration
// would have pluggable components), but this may happen as well.
/** @var \Drupal\Core\Config\Entity\ConfigEntityTypeInterface $entity_type_info */
$entity_type_info = $this->entityTypeManager->getDefinition($this->entityType);
$this->addConfigName($entity_type_info->getConfigPrefix() . '.' . $entity->id());
return TRUE;
}
/**
* {@inheritdoc}
*/
public function getTitle() {
return $this->entity->label() . ' ' . $this->pluginDefinition['title'];
}
/**
* {@inheritdoc}
*/
public function getBaseRouteParameters() {
return [$this->entityType => $this->entity->id()];
}
/**
* Set entity type for this mapper.
*
* This should be set in initialization. A mapper that knows its type but
* not yet its names is still useful for router item and tab generation. The
* concrete entity only turns out later with actual controller invocations,
* when the setEntity() method is invoked before the rest of the methods are
* used.
*
* @param string $entity_type
* The entity type to set.
*
* @return bool
* TRUE if the entity type was set correctly; FALSE otherwise.
*/
public function setType($entity_type) {
if (isset($this->entityType)) {
return FALSE;
}
$this->entityType = $entity_type;
return TRUE;
}
/**
* Gets the entity type from this mapper.
*
* @return string
*/
public function getType() {
return $this->entityType;
}
/**
* {@inheritdoc}
*/
public function getTypeName() {
$entity_type_info = $this->entityTypeManager->getDefinition($this->entityType);
return $entity_type_info->getLabel();
}
/**
* {@inheritdoc}
*/
public function getTypeLabel() {
$entityType = $this->entityTypeManager->getDefinition($this->entityType);
return $entityType->getLabel();
}
/**
* {@inheritdoc}
*/
public function getOperations() {
return [
'list' => [
'title' => $this->t('List'),
'url' => Url::fromRoute('config_translation.entity_list', [
'mapper_id' => $this->getPluginId(),
]),
],
];
}
/**
* {@inheritdoc}
*/
public function getContextualLinkGroup() {
// @todo Contextual groups do not map to entity types in a predictable
// way. See https://www.drupal.org/node/2134841 to make them predictable.
switch ($this->entityType) {
case 'menu':
case 'block':
return $this->entityType;
case 'view':
return 'entity.view.edit_form';
default:
return NULL;
}
}
/**
* {@inheritdoc}
*/
public function getOverviewRouteName() {
return 'entity.' . $this->entityType . '.config_translation_overview';
}
/**
* {@inheritdoc}
*/
protected function processRoute(Route $route) {
// Add entity upcasting information.
$parameters = $route->getOption('parameters') ?: [];
$parameters += [
$this->entityType => [
'type' => 'entity:' . $this->entityType,
],
];
$route->setOption('parameters', $parameters);
}
}
| {
"pile_set_name": "Github"
} |
// Copyright The OpenTelemetry Authors
//
// 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.
package metrics
import (
"testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"go.opentelemetry.io/collector/consumer/pdata"
"go.opentelemetry.io/collector/internal/goldendataset"
)
func TestSameMetrics(t *testing.T) {
expected := goldendataset.DefaultMetricData()
actual := goldendataset.DefaultMetricData()
diffs := diffMetricData(expected, actual)
assert.Nil(t, diffs)
}
func diffMetricData(expected pdata.Metrics, actual pdata.Metrics) []*MetricDiff {
expectedRMSlice := expected.ResourceMetrics()
actualRMSlice := actual.ResourceMetrics()
return diffRMSlices(toSlice(expectedRMSlice), toSlice(actualRMSlice))
}
func toSlice(s pdata.ResourceMetricsSlice) (out []pdata.ResourceMetrics) {
for i := 0; i < s.Len(); i++ {
out = append(out, s.At(i))
}
return out
}
func TestDifferentValues(t *testing.T) {
expected := goldendataset.DefaultMetricData()
cfg := goldendataset.DefaultCfg()
cfg.PtVal = 2
actual := goldendataset.MetricDataFromCfg(cfg)
diffs := diffMetricData(expected, actual)
assert.Len(t, diffs, 1)
}
func TestDifferentNumPts(t *testing.T) {
expected := goldendataset.DefaultMetricData()
cfg := goldendataset.DefaultCfg()
cfg.NumPtsPerMetric = 2
actual := goldendataset.MetricDataFromCfg(cfg)
diffs := diffMetricData(expected, actual)
assert.Len(t, diffs, 1)
}
func TestDifferentPtTypes(t *testing.T) {
expected := goldendataset.DefaultMetricData()
cfg := goldendataset.DefaultCfg()
cfg.MetricDescriptorType = pdata.MetricDataTypeDoubleGauge
actual := goldendataset.MetricDataFromCfg(cfg)
diffs := diffMetricData(expected, actual)
assert.Len(t, diffs, 1)
}
func TestDoubleHistogram(t *testing.T) {
cfg1 := goldendataset.DefaultCfg()
cfg1.MetricDescriptorType = pdata.MetricDataTypeDoubleHistogram
expected := goldendataset.MetricDataFromCfg(cfg1)
cfg2 := goldendataset.DefaultCfg()
cfg2.MetricDescriptorType = pdata.MetricDataTypeDoubleHistogram
cfg2.PtVal = 2
actual := goldendataset.MetricDataFromCfg(cfg2)
diffs := diffMetricData(expected, actual)
assert.Len(t, diffs, 3)
}
func TestIntHistogram(t *testing.T) {
cfg1 := goldendataset.DefaultCfg()
cfg1.MetricDescriptorType = pdata.MetricDataTypeIntHistogram
expected := goldendataset.MetricDataFromCfg(cfg1)
cfg2 := goldendataset.DefaultCfg()
cfg2.MetricDescriptorType = pdata.MetricDataTypeIntHistogram
cfg2.PtVal = 2
actual := goldendataset.MetricDataFromCfg(cfg2)
diffs := diffMetricData(expected, actual)
assert.Len(t, diffs, 3)
}
func TestPDMToPDRM(t *testing.T) {
md := pdata.NewMetrics()
md.ResourceMetrics().Resize(2)
rms := pdmToPDRM([]pdata.Metrics{md})
require.Len(t, rms, 2)
}
| {
"pile_set_name": "Github"
} |
//
// WKAlertAction.h
// WatchKit
//
// Copyright (c) 2015 Apple Inc. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <WatchKit/WKDefines.h>
NS_ASSUME_NONNULL_BEGIN
typedef NS_ENUM(NSInteger, WKAlertActionStyle) {
WKAlertActionStyleDefault = 0,
WKAlertActionStyleCancel,
WKAlertActionStyleDestructive
} WK_AVAILABLE_WATCHOS_ONLY(2.0);
typedef void (^WKAlertActionHandler)(void) WK_AVAILABLE_WATCHOS_ONLY(2.0);
WK_AVAILABLE_WATCHOS_ONLY(2.0)
@interface WKAlertAction : NSObject
+ (instancetype)actionWithTitle:(NSString *)title style:(WKAlertActionStyle)style handler:(WKAlertActionHandler)handler;
- (instancetype)init NS_UNAVAILABLE;
@end
NS_ASSUME_NONNULL_END
| {
"pile_set_name": "Github"
} |
package digest
import (
"hash"
"io"
)
// Verifier presents a general verification interface to be used with message
// digests and other byte stream verifications. Users instantiate a Verifier
// from one of the various methods, write the data under test to it then check
// the result with the Verified method.
type Verifier interface {
io.Writer
// Verified will return true if the content written to Verifier matches
// the digest.
Verified() bool
}
// NewDigestVerifier returns a verifier that compares the written bytes
// against a passed in digest.
func NewDigestVerifier(d Digest) (Verifier, error) {
if err := d.Validate(); err != nil {
return nil, err
}
return hashVerifier{
hash: d.Algorithm().Hash(),
digest: d,
}, nil
}
type hashVerifier struct {
digest Digest
hash hash.Hash
}
func (hv hashVerifier) Write(p []byte) (n int, err error) {
return hv.hash.Write(p)
}
func (hv hashVerifier) Verified() bool {
return hv.digest == NewDigest(hv.digest.Algorithm(), hv.hash)
}
| {
"pile_set_name": "Github"
} |
//*****************************************************************************
//
// aes_ccm_decrypt.c - Simple AES128 and AES256 CCM decryption demo.
//
// Copyright (c) 2013-2014 Texas Instruments Incorporated. All rights reserved.
// Software License Agreement
//
// Texas Instruments (TI) is supplying this software for use solely and
// exclusively on TI's microcontroller products. The software is owned by
// TI and/or its suppliers, and is protected under applicable copyright
// laws. You may not combine this software with "viral" open-source
// software in order to form a larger program.
//
// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS.
// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT
// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY
// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL
// DAMAGES, FOR ANY REASON WHATSOEVER.
//
// This is part of revision 2.1.0.12573 of the DK-TM4C129X Firmware Package.
//
//*****************************************************************************
#include <stdbool.h>
#include <stdint.h>
#include "inc/hw_aes.h"
#include "inc/hw_ints.h"
#include "inc/hw_memmap.h"
#include "driverlib/aes.h"
#include "driverlib/debug.h"
#include "driverlib/fpu.h"
#include "driverlib/gpio.h"
#include "driverlib/interrupt.h"
#include "driverlib/pin_map.h"
#include "driverlib/rom.h"
#include "driverlib/rom_map.h"
#include "driverlib/sysctl.h"
#include "driverlib/uart.h"
#include "driverlib/udma.h"
#include "grlib/grlib.h"
#include "drivers/frame.h"
#include "drivers/kentec320x240x16_ssd2119.h"
#include "drivers/pinout.h"
#include "utils/uartstdio.h"
//*****************************************************************************
//
//! \addtogroup example_list
//! <h1>AES128 and AES256 CCM Decryption Demo (aes_ccm_decrypt)</h1>
//!
//! Simple demo showing an decryption operation using the AES128 and AES256
//! modules in CCM mode. A set of test cases are decrypted.
//!
//! Please note that the use of interrupts and uDMA is not required for the
//! operation of the module. It is only done for demonstration purposes.
//
//*****************************************************************************
//*****************************************************************************
//
// Configuration defines.
//
//*****************************************************************************
#define CCM_LOOP_TIMEOUT 500000
//*****************************************************************************
//
// The DMA control structure table.
//
//*****************************************************************************
#if defined(ewarm)
#pragma data_alignment=1024
tDMAControlTable g_psDMAControlTable[64];
#elif defined(ccs)
#pragma DATA_ALIGN(g_psDMAControlTable, 1024)
tDMAControlTable g_psDMAControlTable[64];
#else
tDMAControlTable g_psDMAControlTable[64] __attribute__((aligned(1024)));
#endif
//*****************************************************************************
//
// Test cases from the NIST SP 800-38C document and proposals for IEEE P1619.1
// Test Vectors
//
//*****************************************************************************
typedef struct AESTestVectorStruct
{
uint32_t ui32KeySize;
uint32_t pui32Key[8];
uint32_t ui32NonceLength;
uint32_t pui32Nonce[4];
uint32_t ui32PayloadLength;
uint32_t pui32Payload[16];
uint32_t ui32AuthDataLength;
uint32_t pui32AuthData[16];
uint32_t pui32CipherText[16];
uint32_t ui32TagLength;
uint32_t pui32Tag[4];
}
tAESCCMTestVector;
tAESCCMTestVector g_psAESCCMTestVectors[] =
{
//
// Test Case #1
// The data in these test cases have been modified to be in big endian
// format as required by the AES module. This was done to simplify writes
// and comparisons.
// Also, The test vector is formatted in the document in a way that the
// ciphertext is the concatenation of the ciphertext and the MAC. they
// have been separated to match the operation of the AES module.
//
{
AES_CFG_KEY_SIZE_128BIT,
{ 0x43424140, 0x47464544, 0x4b4a4948, 0x4f4e4d4c }, // Key
7, // Nonce Length
{ 0x13121110, 0x00161514, 0x00000000, 0x00000000 }, // Nonce
4, // Payload Length
{ 0x23222120, 0x00000000, 0x00000000, 0x00000000 }, // Payload
8, // Auth Data Length
{ 0x03020100, 0x07060504, 0x00000000, 0x00000000 }, // Auth Data
{ 0x5b016271, 0x00000000, 0x00000000, 0x00000000 }, // CipherText
4, // Tag Length
{ 0x5d25ac4d, 0x00000000, 0x00000000, 0x00000000 } // Tag
},
//
// Test Case #2
//
{
AES_CFG_KEY_SIZE_128BIT,
{ 0x43424140, 0x47464544, 0x4b4a4948, 0x4f4e4d4c }, // Key
8, // Nonce Length
{ 0x13121110, 0x17161514, 0x00000000, 0x00000000 }, // Nonce
16, // Payload Length
{ 0x23222120, 0x27262524, 0x2b2a2928, 0x2f2e2d2c }, // Payload
16, // Auth Data Length
{ 0x03020100, 0x07060504, 0x0b0a0908, 0x0f0e0d0c }, // Auth Data
{ 0xe0f0a1d2, 0x625fea51, 0x92771a08, 0x3d593d07 }, // CipherText
6, // Tag Length
{ 0xbf4fc61f, 0x0000cdac, 0x00000000, 0x00000000 } // Tag
},
//
// Test Case #3
//
{
AES_CFG_KEY_SIZE_128BIT,
{ 0x43424140, 0x47464544, 0x4b4a4948, 0x4f4e4d4c }, // Key
12, // Nonce Length
{ 0x13121110, 0x17161514, 0x1b1a1918, 0x00000000 }, // Nonce
24, // Payload Length
{ 0x23222120, 0x27262524, 0x2b2a2928, 0x2f2e2d2c, // Payload
0x33323130, 0x37363534, 0x00000000, 0x00000000 },
20, // Auth Data Length
{ 0x03020100, 0x07060504, 0x0b0a0908, 0x0f0e0d0c, // Auth Data
0x13121110, 0x00000000, 0x00000000, 0x00000000 },
{ 0xa901b2e3, 0x7a1ab7f5, 0xecea1c9b, 0x0be797cd, // CipherText
0xd9aa7661, 0xa58a42a4, 0x00000000, 0x00000000 },
8, // Tag Length
{ 0xfb924348, 0x5199b0c1, 0x00000000, 0x00000000 } // Tag
},
//
// The following test cases use 256bit key, and they are taken from
// proposals for IEEE P1619.1 Test Vectors.
//
// Test Case #4
//
{
AES_CFG_KEY_SIZE_256BIT,
{ 0xb21576fb, 0x1d89803d, 0x0b9870d4, 0xc88495c7, // Key
0xce64fbb2, 0x4d8f9760, 0x5ae4fc17, 0xb730e849 },
12, // Nonce Length
{ 0x63a3d1db, 0xb4b72460, 0x6f7dda02, 0x00000000 }, // Nonce
16, // Payload Length
{ 0x8e3445a8, 0xf1b5c5c8, 0x760ef526, 0x1e1bfdfe, // Payload
0x00000000, 0x00000000, 0x00000000, 0x00000000 },
0, // Auth Data Length
{ 0x00000000, 0x00000000, 0x00000000, 0x00000000, // Auth Data
0x00000000, 0x00000000, 0x00000000, 0x00000000 },
{ 0x611288cc, 0x72faa7c6, 0x39176ab9, 0x7f276b17, // CipherText
0x00000000, 0x00000000, 0x00000000, 0x00000000 },
16, // Tag Length
{ 0x14e17234, 0xbe0c2c5f, 0x06496314, 0x23e4f02c } // Tag
},
//
// Test Case #5
//
{
AES_CFG_KEY_SIZE_256BIT,
{ 0x43424140, 0x47464544, 0x4b4a4948, 0x4f4e4d4c, // Key
0x53525150, 0x57565554, 0x5b5a5958, 0x5f5e5d5c },
12, // Nonce Length
{ 0x13121110, 0x17161514, 0x1b1a1918, 0x00000000 }, // Nonce
24, // Payload Length
{ 0x23222120, 0x27262524, 0x2b2a2928, 0x2f2e2d2c, // Payload
0x33323130, 0x37363534, 0x00000000, 0x00000000 },
20, // Auth Data Length
{ 0x03020100, 0x07060504, 0x0b0a0908, 0x0f0e0d0c, // Auth Data
0x13121110, 0x00000000, 0x00000000, 0x00000000 },
{ 0xae83f804, 0x3007bdb3, 0xb60bf5ea, 0x21a24fde, // CipherText
0xe4e43420, 0xe5750e1b, 0x00000000, 0x00000000 },
16, // Tag Length
{ 0x3a3fba9b, 0x39327f10, 0x299063bd, 0x7103f823 } // Tag
}
};
//*****************************************************************************
//
// The error routine that is called if the driver library encounters an error.
//
//*****************************************************************************
#ifdef DEBUG
void
__error__(char *pcFilename, uint32_t ui32Line)
{
}
#endif
//*****************************************************************************
//
// Round up length to nearest 16 byte boundary. This is needed because all
// four data registers must be written at once. This is handled in the AES
// driver, but if using uDMA, the length must rounded up.
//
//*****************************************************************************
uint32_t
LengthRoundUp(uint32_t ui32Length)
{
uint32_t ui32Remainder;
ui32Remainder = ui32Length % 16;
if(ui32Remainder == 0)
{
return(ui32Length);
}
else
{
return(ui32Length + (16 - ui32Remainder));
}
}
//*****************************************************************************
//
// The AES interrupt handler and interrupt flags.
//
//*****************************************************************************
static volatile bool g_bContextInIntFlag;
static volatile bool g_bDataInIntFlag;
static volatile bool g_bContextOutIntFlag;
static volatile bool g_bDataOutIntFlag;
static volatile bool g_bContextInDMADoneIntFlag;
static volatile bool g_bDataInDMADoneIntFlag;
static volatile bool g_bContextOutDMADoneIntFlag;
static volatile bool g_bDataOutDMADoneIntFlag;
void
AESIntHandler(void)
{
uint32_t ui32IntStatus;
//
// Read the AES masked interrupt status.
//
ui32IntStatus = ROM_AESIntStatus(AES_BASE, true);
//
// Print a different message depending on the interrupt source.
//
if(ui32IntStatus & AES_INT_CONTEXT_IN)
{
ROM_AESIntDisable(AES_BASE, AES_INT_CONTEXT_IN);
g_bContextInIntFlag = true;
UARTprintf(" Context input registers are ready.\n");
}
if(ui32IntStatus & AES_INT_DATA_IN)
{
ROM_AESIntDisable(AES_BASE, AES_INT_DATA_IN);
g_bDataInIntFlag = true;
UARTprintf(" Data FIFO is ready to receive data.\n");
}
if(ui32IntStatus & AES_INT_CONTEXT_OUT)
{
ROM_AESIntDisable(AES_BASE, AES_INT_CONTEXT_OUT);
g_bContextOutIntFlag = true;
UARTprintf(" Context output registers are ready.\n");
}
if(ui32IntStatus & AES_INT_DATA_OUT)
{
ROM_AESIntDisable(AES_BASE, AES_INT_DATA_OUT);
g_bDataOutIntFlag = true;
UARTprintf(" Data FIFO is ready to provide data.\n");
}
if(ui32IntStatus & AES_INT_DMA_CONTEXT_IN)
{
ROM_AESIntClear(AES_BASE, AES_INT_DMA_CONTEXT_IN);
g_bContextInDMADoneIntFlag = true;
UARTprintf(" DMA completed a context write to the internal\n");
UARTprintf(" registers.\n");
}
if(ui32IntStatus & AES_INT_DMA_DATA_IN)
{
ROM_AESIntClear(AES_BASE, AES_INT_DMA_DATA_IN);
g_bDataInDMADoneIntFlag = true;
UARTprintf(" DMA has written the last word of input data to\n");
UARTprintf(" the internal FIFO of the engine.\n");
}
if(ui32IntStatus & AES_INT_DMA_CONTEXT_OUT)
{
ROM_AESIntClear(AES_BASE, AES_INT_DMA_CONTEXT_OUT);
g_bContextOutDMADoneIntFlag = true;
UARTprintf(" DMA completed the output context movement from\n");
UARTprintf(" the internal registers.\n");
}
if(ui32IntStatus & AES_INT_DMA_DATA_OUT)
{
ROM_AESIntClear(AES_BASE, AES_INT_DMA_DATA_OUT);
g_bDataOutDMADoneIntFlag = true;
UARTprintf(" DMA has written the last word of process result.\n");
}
}
//*****************************************************************************
//
// Perform an CCM decryption operation.
//
//*****************************************************************************
bool
AESCCMDecrypt(uint32_t ui32Keysize, uint32_t *pui32Key,
uint32_t *pui32Src, uint32_t *pui32Dst,
uint32_t ui32DataLength, uint32_t *pui32Nonce,
uint32_t ui32NonceLength, uint32_t *pui32AuthData,
uint32_t ui32AuthDataLength, uint32_t *pui32Tag,
uint32_t ui32TagLength, bool bUseDMA)
{
uint32_t pui32IV[4], ui32Idx;
uint32_t ui32M, ui32L;
uint8_t *pui8Nonce, *pui8IV;
//
// Determine the value of M. It is determined using
// the tag length.
//
if(ui32TagLength == 4)
{
ui32M = AES_CFG_CCM_M_4;
}
else if(ui32TagLength == 6)
{
ui32M = AES_CFG_CCM_M_6;
}
else if(ui32TagLength == 8)
{
ui32M = AES_CFG_CCM_M_8;
}
else if(ui32TagLength == 10)
{
ui32M = AES_CFG_CCM_M_10;
}
else if(ui32TagLength == 12)
{
ui32M = AES_CFG_CCM_M_12;
}
else if(ui32TagLength == 14)
{
ui32M = AES_CFG_CCM_M_14;
}
else if(ui32TagLength == 16)
{
ui32M = AES_CFG_CCM_M_16;
}
else
{
UARTprintf("Unexpected tag length.\n");
return(false);
}
//
// Determine the value of L. This is determined by using
// the value of q from the NIST document: n + q = 15
//
if(ui32NonceLength == 7)
{
ui32L = AES_CFG_CCM_L_8;
}
else if(ui32NonceLength == 8)
{
ui32L = AES_CFG_CCM_L_7;
}
else if(ui32NonceLength == 9)
{
ui32L = AES_CFG_CCM_L_6;
}
else if(ui32NonceLength == 10)
{
ui32L = AES_CFG_CCM_L_5;
}
else if(ui32NonceLength == 11)
{
ui32L = AES_CFG_CCM_L_4;
}
else if(ui32NonceLength == 12)
{
ui32L = AES_CFG_CCM_L_3;
}
else if(ui32NonceLength == 13)
{
ui32L = AES_CFG_CCM_L_2;
}
else if(ui32NonceLength == 14)
{
ui32L = AES_CFG_CCM_L_1;
}
else
{
UARTprintf("Unexpected nonce length.\n");
return(false);
}
//
// Perform a soft reset.
//
ROM_AESReset(AES_BASE);
//
// Clear the interrupt flags.
//
g_bContextInIntFlag = false;
g_bDataInIntFlag = false;
g_bContextOutIntFlag = false;
g_bDataOutIntFlag = false;
g_bContextInDMADoneIntFlag = false;
g_bDataInDMADoneIntFlag = false;
g_bContextOutDMADoneIntFlag = false;
g_bDataOutDMADoneIntFlag = false;
//
// Enable all interrupts.
//
ROM_AESIntEnable(AES_BASE, (AES_INT_CONTEXT_IN | AES_INT_CONTEXT_OUT |
AES_INT_DATA_IN | AES_INT_DATA_OUT));
//
// Configure the AES module.
//
ROM_AESConfigSet(AES_BASE, (ui32Keysize | AES_CFG_DIR_DECRYPT |
AES_CFG_CTR_WIDTH_128 |
AES_CFG_MODE_CCM | ui32L | ui32M));
//
// Determine the value to be written in the initial value registers. It is
// the concatenation of 5 bits of zero, 3 bits of L, nonce, and the counter
// value. First, clear the contents of the IV.
//
for(ui32Idx = 0; ui32Idx < 4; ui32Idx++)
{
pui32IV[ui32Idx] = 0;
}
//
// Now find the binary value of L.
//
if(ui32L == AES_CFG_CCM_L_8)
{
pui32IV[0] = 0x7;
}
else if(ui32L == AES_CFG_CCM_L_7)
{
pui32IV[0] = 0x6;
}
else if(ui32L == AES_CFG_CCM_L_6)
{
pui32IV[0] = 0x5;
}
else if(ui32L == AES_CFG_CCM_L_5)
{
pui32IV[0] = 0x4;
}
else if(ui32L == AES_CFG_CCM_L_4)
{
pui32IV[0] = 0x3;
}
else if(ui32L == AES_CFG_CCM_L_3)
{
pui32IV[0] = 0x2;
}
else if(ui32L == AES_CFG_CCM_L_2)
{
pui32IV[0] = 0x1;
}
//
// Finally copy the contents of the nonce into the IV. Convert
// the pointers to simplify the copying.
//
pui8Nonce = (uint8_t *)pui32Nonce;
pui8IV = (uint8_t *)pui32IV;
for(ui32Idx = 0; ui32Idx < ui32NonceLength; ui32Idx++)
{
pui8IV[ui32Idx + 1] = pui8Nonce[ui32Idx];
}
//
// Write the initial value.
//
ROM_AESIVSet(AES_BASE, pui32IV);
//
// Write the key.
//
ROM_AESKey1Set(AES_BASE, pui32Key, ui32Keysize);
//
// Depending on the argument, perform the decryption
// with or without uDMA.
//
if(bUseDMA)
{
//
// Enable DMA interrupts.
//
ROM_AESIntEnable(AES_BASE, (AES_INT_DMA_CONTEXT_IN |
AES_INT_DMA_DATA_IN |
AES_INT_DMA_CONTEXT_OUT |
AES_INT_DMA_DATA_OUT));
//
// Setup the DMA module to copy auth data in.
//
ROM_uDMAChannelAssign(UDMA_CH14_AES0DIN);
ROM_uDMAChannelAttributeDisable(UDMA_CH14_AES0DIN,
UDMA_ATTR_ALTSELECT |
UDMA_ATTR_USEBURST |
UDMA_ATTR_HIGH_PRIORITY |
UDMA_ATTR_REQMASK);
ROM_uDMAChannelControlSet(UDMA_CH14_AES0DIN | UDMA_PRI_SELECT,
UDMA_SIZE_32 | UDMA_SRC_INC_32 |
UDMA_DST_INC_NONE | UDMA_ARB_4 |
UDMA_DST_PROT_PRIV);
if(ui32AuthDataLength)
{
ROM_uDMAChannelTransferSet(UDMA_CH14_AES0DIN | UDMA_PRI_SELECT,
UDMA_MODE_BASIC, (void *)pui32AuthData,
(void *)(AES_BASE + AES_O_DATA_IN_0),
LengthRoundUp(ui32AuthDataLength) / 4);
}
UARTprintf("Data in DMA request enabled.\n");
//
// Setup the DMA module to copy the data out.
//
ROM_uDMAChannelAssign(UDMA_CH15_AES0DOUT);
ROM_uDMAChannelAttributeDisable(UDMA_CH15_AES0DOUT,
UDMA_ATTR_ALTSELECT |
UDMA_ATTR_USEBURST |
UDMA_ATTR_HIGH_PRIORITY |
UDMA_ATTR_REQMASK);
ROM_uDMAChannelControlSet(UDMA_CH15_AES0DOUT | UDMA_PRI_SELECT,
UDMA_SIZE_32 | UDMA_SRC_INC_NONE |
UDMA_DST_INC_32 | UDMA_ARB_4 |
UDMA_SRC_PROT_PRIV);
ROM_uDMAChannelTransferSet(UDMA_CH15_AES0DOUT | UDMA_PRI_SELECT,
UDMA_MODE_BASIC,
(void *)(AES_BASE + AES_O_DATA_IN_0),
(void *)pui32Dst,
LengthRoundUp(ui32DataLength) / 4);
UARTprintf("Data out DMA request enabled.\n");
//
// Write the length registers.
//
ROM_AESLengthSet(AES_BASE, (uint64_t)ui32DataLength);
//
// Write the auth length registers to start the process.
//
ROM_AESAuthLengthSet(AES_BASE, ui32AuthDataLength);
//
// Enable the DMA channels to start the transfers. This must be done after
// writing the length to prevent data from copying before the context is
// truly ready.
//
ROM_uDMAChannelEnable(UDMA_CH14_AES0DIN);
ROM_uDMAChannelEnable(UDMA_CH15_AES0DOUT);
//
// Enable DMA requests.
//
ROM_AESDMAEnable(AES_BASE, AES_DMA_DATA_IN | AES_DMA_DATA_OUT);
//
// Wait for the data in DMA done interrupt.
//
while(!g_bDataInDMADoneIntFlag)
{
}
//
// Setup the uDMA to copy the plaintext data.
//
ROM_uDMAChannelAssign(UDMA_CH14_AES0DIN);
ROM_uDMAChannelAttributeDisable(UDMA_CH14_AES0DIN,
UDMA_ATTR_ALTSELECT |
UDMA_ATTR_USEBURST |
UDMA_ATTR_HIGH_PRIORITY |
UDMA_ATTR_REQMASK);
ROM_uDMAChannelControlSet(UDMA_CH14_AES0DIN | UDMA_PRI_SELECT,
UDMA_SIZE_32 | UDMA_SRC_INC_32 |
UDMA_DST_INC_NONE | UDMA_ARB_4 |
UDMA_DST_PROT_PRIV);
ROM_uDMAChannelTransferSet(UDMA_CH14_AES0DIN | UDMA_PRI_SELECT,
UDMA_MODE_BASIC, (void *)pui32Src,
(void *)(AES_BASE + AES_O_DATA_IN_0),
LengthRoundUp(ui32DataLength) / 4);
ROM_uDMAChannelEnable(UDMA_CH14_AES0DIN);
UARTprintf("Data in DMA request enabled.\n");
//
// Wait for the data out DMA done interrupt.
//
while(!g_bDataOutDMADoneIntFlag)
{
}
//
// Read the tag out.
//
ROM_AESTagRead(AES_BASE, pui32Tag);
}
else
{
//
// Perform the decryption.
//
ROM_AESDataProcessAuth(AES_BASE, pui32Src, pui32Dst, ui32DataLength,
pui32AuthData, ui32AuthDataLength, pui32Tag);
}
return(true);
}
//*****************************************************************************
//
// Initialize the AES and CCM modules.
//
//*****************************************************************************
bool
AESInit(void)
{
uint32_t ui32Loop;
//
// Check that the CCM peripheral is present.
//
if(!ROM_SysCtlPeripheralPresent(SYSCTL_PERIPH_CCM0))
{
UARTprintf("No CCM peripheral found!\n");
//
// Return failure.
//
return(false);
}
//
// The hardware is available, enable it.
//
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_CCM0);
//
// Wait for the peripheral to be ready.
//
ui32Loop = 0;
while(!ROM_SysCtlPeripheralReady(SYSCTL_PERIPH_CCM0))
{
//
// Increment our poll counter.
//
ui32Loop++;
if(ui32Loop > CCM_LOOP_TIMEOUT)
{
//
// Timed out, notify and spin.
//
UARTprintf("Time out on CCM ready after enable.\n");
//
// Return failure.
//
return(false);
}
}
//
// Reset the peripheral to ensure we are starting from a known condition.
//
ROM_SysCtlPeripheralReset(SYSCTL_PERIPH_CCM0);
//
// Wait for the peripheral to be ready again.
//
ui32Loop = 0;
while(!ROM_SysCtlPeripheralReady(SYSCTL_PERIPH_CCM0))
{
//
// Increment our poll counter.
//
ui32Loop++;
if(ui32Loop > CCM_LOOP_TIMEOUT)
{
//
// Timed out, spin.
//
UARTprintf("Time out on CCM ready after reset.\n");
//
// Return failure.
//
return(false);
}
}
//
// Return initialization success.
//
return(true);
}
//*****************************************************************************
//
// Configure the UART and its pins. This must be called before UARTprintf().
//
//*****************************************************************************
void
ConfigureUART(void)
{
//
// Enable the GPIO Peripheral used by the UART.
//
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
//
// Enable UART0
//
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0);
//
// Configure GPIO Pins for UART mode.
//
ROM_GPIOPinConfigure(GPIO_PA0_U0RX);
ROM_GPIOPinConfigure(GPIO_PA1_U0TX);
ROM_GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1);
//
// Use the internal 16MHz oscillator as the UART clock source.
//
ROM_UARTClockSourceSet(UART0_BASE, UART_CLOCK_PIOSC);
//
// Initialize the UART for console I/O.
//
UARTStdioConfig(0, 115200, 16000000);
}
//*****************************************************************************
//
// This example decrypts a block of payload using AES128 in CCM mode. It
// does the decryption first without uDMA and then with uDMA. The results
// are checked after each operation.
//
//*****************************************************************************
int
main(void)
{
uint32_t pui32Payload[16], pui32Tag[4], ui32Errors, ui32Idx;
uint32_t ui32PayloadLength, ui32TagLength;
uint32_t ui32NonceLength, ui32AuthDataLength;
uint32_t *pui32Nonce, *pui32AuthData, ui32SysClock;
uint32_t *pui32Key, *pui32ExpPayload, *pui32CipherText;
uint32_t ui32Keysize;
uint8_t ui8Vector;
uint8_t *pui8ExpTag, *pui8Tag;
tContext sContext;
//
// Run from the PLL at 120 MHz.
//
ui32SysClock = MAP_SysCtlClockFreqSet((SYSCTL_XTAL_25MHZ |
SYSCTL_OSC_MAIN |
SYSCTL_USE_PLL |
SYSCTL_CFG_VCO_480), 120000000);
//
// Configure the device pins.
//
PinoutSet();
//
// Initialize the display driver.
//
Kentec320x240x16_SSD2119Init(ui32SysClock);
//
// Initialize the graphics context.
//
GrContextInit(&sContext, &g_sKentec320x240x16_SSD2119);
//
// Draw the application frame.
//
FrameDraw(&sContext, "aes-ccm-decrypt");
//
// Show some instructions on the display
//
GrContextFontSet(&sContext, g_psFontCm20);
GrContextForegroundSet(&sContext, ClrWhite);
GrStringDrawCentered(&sContext, "Connect a terminal to", -1,
GrContextDpyWidthGet(&sContext) / 2, 60, false);
GrStringDrawCentered(&sContext, "UART0 (115200,N,8,1)", -1,
GrContextDpyWidthGet(&sContext) / 2, 80, false);
GrStringDrawCentered(&sContext, "for more information.", -1,
GrContextDpyWidthGet(&sContext) / 2, 100, false);
//
// Initialize local variables.
//
ui32Errors = 0;
pui8Tag = (uint8_t *)pui32Tag;
//
// Enable stacking for interrupt handlers. This allows floating-point
// instructions to be used within interrupt handlers, but at the expense of
// extra stack usage.
//
ROM_FPUStackingEnable();
//
// Configure the system clock to run off the internal 16MHz oscillator.
//
MAP_SysCtlClockFreqSet(SYSCTL_OSC_INT | SYSCTL_USE_OSC, 16000000);
//
// Enable AES interrupts.
//
ROM_IntEnable(INT_AES0);
//
// Enable debug output on UART0 and print a welcome message.
//
ConfigureUART();
UARTprintf("Starting AES CCM decryption demo.\n");
GrStringDrawCentered(&sContext, "Starting demo...", -1,
GrContextDpyWidthGet(&sContext) / 2, 140, false);
//
// Enable the uDMA module.
//
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_UDMA);
//
// Setup the control table.
//
ROM_uDMAEnable();
ROM_uDMAControlBaseSet(g_psDMAControlTable);
//
// Initialize the CCM and AES modules.
//
if(!AESInit())
{
UARTprintf("Initialization of the AES module failed.\n");
ui32Errors |= 0x00000001;
}
//
// Clear the array containing the ciphertext.
//
for(ui32Idx = 0; ui32Idx < 16; ui32Idx++)
{
pui32Payload[ui32Idx] = 0;
}
for(ui32Idx = 0; ui32Idx < 4; ui32Idx++)
{
pui32Tag[ui32Idx] = 0;
}
//
// Loop through all the given vectors.
//
for(ui8Vector = 0;
(ui8Vector <
(sizeof(g_psAESCCMTestVectors) / sizeof(g_psAESCCMTestVectors[0]))) &&
(ui32Errors == 0);
ui8Vector++)
{
UARTprintf("Starting vector #%d\n", ui8Vector);
//
// Get the current vector's data members.
//
ui32Keysize = g_psAESCCMTestVectors[ui8Vector].ui32KeySize;
pui32Key = g_psAESCCMTestVectors[ui8Vector].pui32Key;
pui32ExpPayload = g_psAESCCMTestVectors[ui8Vector].pui32Payload;
ui32PayloadLength =
g_psAESCCMTestVectors[ui8Vector].ui32PayloadLength;
pui32AuthData = g_psAESCCMTestVectors[ui8Vector].pui32AuthData;
ui32AuthDataLength =
g_psAESCCMTestVectors[ui8Vector].ui32AuthDataLength;
pui32CipherText =
g_psAESCCMTestVectors[ui8Vector].pui32CipherText;
pui8ExpTag = (uint8_t *)g_psAESCCMTestVectors[ui8Vector].pui32Tag;
ui32TagLength = g_psAESCCMTestVectors[ui8Vector].ui32TagLength;
pui32Nonce = g_psAESCCMTestVectors[ui8Vector].pui32Nonce;
ui32NonceLength =
g_psAESCCMTestVectors[ui8Vector].ui32NonceLength;
//
// Perform the decryption without uDMA.
//
UARTprintf("Performing decryption without uDMA.\n");
AESCCMDecrypt(ui32Keysize, pui32Key, pui32CipherText,
pui32Payload, ui32PayloadLength, pui32Nonce,
ui32NonceLength, pui32AuthData, ui32AuthDataLength,
pui32Tag, ui32TagLength, false);
//
// Check the result.
//
for(ui32Idx = 0; ui32Idx < (ui32PayloadLength / 4); ui32Idx++)
{
if(pui32Payload[ui32Idx] != pui32ExpPayload[ui32Idx])
{
UARTprintf("Payload mismatch on word %d. Exp: 0x%x, Act: "
"0x%x\n", ui32Idx, pui32ExpPayload[ui32Idx],
pui32Payload[ui32Idx]);
ui32Errors |= (ui32Idx << 16) | 0x00000002;
}
}
for(ui32Idx = 0; ui32Idx < ui32TagLength; ui32Idx++)
{
if(pui8Tag[ui32Idx] != pui8ExpTag[ui32Idx])
{
UARTprintf("Tag mismatch on byte %d. Exp: 0x%x, Act: "
"0x%x\n", ui32Idx, pui8ExpTag[ui32Idx],
pui8Tag[ui32Idx]);
ui32Errors |= (ui32Idx << 16) | 0x00000004;
}
}
//
// Clear the array containing the ciphertext.
//
for(ui32Idx = 0; ui32Idx < 16; ui32Idx++)
{
pui32Payload[ui32Idx] = 0;
}
for(ui32Idx = 0; ui32Idx < 4; ui32Idx++)
{
pui32Tag[ui32Idx] = 0;
}
//
// Perform the decryption with uDMA.
//
UARTprintf("Performing decryption with uDMA.\n");
AESCCMDecrypt(ui32Keysize, pui32Key, pui32CipherText,
pui32Payload, ui32PayloadLength, pui32Nonce,
ui32NonceLength, pui32AuthData, ui32AuthDataLength,
pui32Tag, ui32TagLength, true);
//
// Check the result.
//
for(ui32Idx = 0; ui32Idx < (ui32PayloadLength / 4); ui32Idx++)
{
if(pui32Payload[ui32Idx] != pui32ExpPayload[ui32Idx])
{
UARTprintf("Payload mismatch on word %d. Exp: 0x%x, Act: "
"0x%x\n", ui32Idx, pui32ExpPayload[ui32Idx],
pui32Payload[ui32Idx]);
ui32Errors |= (ui32Idx << 16) | 0x00000002;
}
}
for(ui32Idx = 0; ui32Idx < ui32TagLength; ui32Idx++)
{
if(pui8Tag[ui32Idx] != pui8ExpTag[ui32Idx])
{
UARTprintf("Tag mismatch on byte %d. Exp: 0x%x, Act: "
"0x%x\n", ui32Idx, pui8ExpTag[ui32Idx],
pui8Tag[ui32Idx]);
ui32Errors |= (ui32Idx << 16) | 0x00000004;
}
}
//
// Clear the array containing the ciphertext.
//
for(ui32Idx = 0; ui32Idx < 16; ui32Idx++)
{
pui32Payload[ui32Idx] = 0;
}
for(ui32Idx = 0; ui32Idx < 4; ui32Idx++)
{
pui32Tag[ui32Idx] = 0;
}
}
//
// Finished.
//
if(ui32Errors)
{
UARTprintf("Demo failed with error code 0x%x.\n", ui32Errors);
GrStringDrawCentered(&sContext, "Demo failed.", -1,
GrContextDpyWidthGet(&sContext) / 2, 180, false);
}
else
{
UARTprintf("Demo completed successfully.\n");
GrStringDrawCentered(&sContext, "Demo passed.", -1,
GrContextDpyWidthGet(&sContext) / 2, 180, false);
}
while(1)
{
}
}
| {
"pile_set_name": "Github"
} |
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<!DOCTYPE html>
<html>
<head>
<title>tall background-size: auto 32px; for nonpercent-width-nonpercent-height.svg</title>
<link rel="author" title="Jeff Walden" href="http://whereswalden.com/" />
<link rel="help" href="http://www.w3.org/TR/css3-background/#the-background-size" />
<link rel="help" href="http://www.w3.org/TR/SVG/coords.html#IntrinsicSizing" />
<link rel="help" href="http://www.w3.org/TR/SVG/coords.html#PreserveAspectRatioAttribute" />
<meta name="flags" content="svg" />
<style type="text/css">
div
{
width: 256px; height: 768px;
}
#outer
{
border: 1px solid black;
}
#inner
{
background-image: url(nonpercent-width-nonpercent-height.svg);
background-repeat: no-repeat;
background-size: auto 32px;
}
</style>
</head>
<body>
<div id="outer"><div id="inner"></div></div>
</body>
</html>
| {
"pile_set_name": "Github"
} |
//******************************************************************************
// SCICHART® Copyright SciChart Ltd. 2011-2019. All rights reserved.
//
// Web: http://www.scichart.com
// Support: [email protected]
// Sales: [email protected]
//
// SyncMultipleChartsView.h is part of the SCICHART® Examples. Permission is hereby granted
// to modify, create derivative works, distribute and publish any part of this source
// code whether for commercial, private or personal use.
//
// The SCICHART® examples are distributed in the hope that they will be useful, but
// without any warranty. It is provided "AS IS" without warranty of any kind, either
// expressed or implied.
//******************************************************************************
#import "SCDTwoChartsViewController.h"
@interface SyncMultipleChartsView : SCDTwoChartsViewController<SCIChartSurface *>
@end
| {
"pile_set_name": "Github"
} |
package com.sohu.tv.jedis.stat.utils;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
/**
* 简易DateUtils
* @author leifu
* @Date 2015年1月15日
* @Time 上午11:43:31
*/
public class DateUtils {
public static String formatDate(Date date, String format) {
SimpleDateFormat sdf = new SimpleDateFormat(format);
return sdf.format(date);
}
public static Date add(Date date, int calendarField, int amount) {
if (date == null) {
throw new IllegalArgumentException("The date must not be null");
}
Calendar c = Calendar.getInstance();
c.setTime(date);
c.add(calendarField, amount);
return c.getTime();
}
public static Date addMinutes(Date date, int amount) {
return add(date, Calendar.MINUTE, amount);
}
}
| {
"pile_set_name": "Github"
} |
var searchData=
[
['bandgap_208',['BANDGAP',['../namespace_a_d_c__settings.html#a8c2a64f3fca3ac6b82e8df8cf44f6ca2aec822af60bc7412ff73aecb3edffa55c',1,'ADC_settings']]]
];
| {
"pile_set_name": "Github"
} |
using System.Reflection;
using System.Runtime.CompilerServices;
using Android.App;
// Information about this assembly is defined by the following attributes.
// Change them to the values specific to your project.
[assembly: AssemblyTitle ("PermissionRequest")]
[assembly: AssemblyDescription ("")]
[assembly: AssemblyConfiguration ("")]
[assembly: AssemblyCompany ("Xamarin")]
[assembly: AssemblyProduct ("")]
[assembly: AssemblyCopyright ("Dylan Kelly")]
[assembly: AssemblyTrademark ("")]
[assembly: AssemblyCulture ("")]
// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
// and "{Major}.{Minor}.{Build}.*" will update just the revision.
[assembly: AssemblyVersion ("1.0.0")]
// The following attributes are used to specify the signing key for the assembly,
// if desired. See the Mono documentation for more information about signing.
//[assembly: AssemblyDelaySign(false)]
//[assembly: AssemblyKeyFile("")]
| {
"pile_set_name": "Github"
} |
git https://github.com/hyotang666/jingoh.git
| {
"pile_set_name": "Github"
} |
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
.keybindings-editor {
padding: 11px 0px 0px 27px;
}
/* header styling */
.keybindings-editor > .keybindings-header {
padding: 0px 10px 11px 0;
}
.keybindings-editor > .keybindings-header > .search-container {
position: relative;
}
.keybindings-editor > .keybindings-header > .search-container > .keybindings-search-actions-container {
position: absolute;
top: 0;
right: 10px;
margin-top: 5px;
display: flex;
}
.keybindings-editor > .keybindings-header > .search-container > .keybindings-search-actions-container > .recording-badge {
margin-right: 8px;
padding: 0px 8px;
border-radius: 2px;
}
.keybindings-editor > .keybindings-header.small > .search-container > .keybindings-search-actions-container > .recording-badge,
.keybindings-editor > .keybindings-header > .search-container > .keybindings-search-actions-container > .recording-badge.disabled {
display: none;
}
.keybindings-editor > .keybindings-header > .search-container > .keybindings-search-actions-container > .monaco-action-bar .action-item > .icon {
width:16px;
height: 18px;
}
.keybindings-editor > .keybindings-header > .search-container > .keybindings-search-actions-container > .monaco-action-bar .action-item {
margin-right: 4px;
}
.keybindings-editor > .keybindings-header > .search-container > .keybindings-search-actions-container > .monaco-action-bar .action-item > .sort-by-precedence {
background: url('sort_precedence.svg') center center no-repeat;
}
.hc-black .keybindings-editor > .keybindings-header > .search-container > .keybindings-search-actions-container > .monaco-action-bar .action-item > .sort-by-precedence,
.vs-dark .keybindings-editor > .keybindings-header > .search-container > .keybindings-search-actions-container > .monaco-action-bar .action-item > .sort-by-precedence {
background: url('sort_precedence_inverse.svg') center center no-repeat;
}
.keybindings-editor > .keybindings-header > .search-container > .keybindings-search-actions-container > .monaco-action-bar .action-item > .record-keys {
background: url('record-keys.svg') center center no-repeat;
}
.hc-black .keybindings-editor > .keybindings-header > .search-container > .keybindings-search-actions-container > .monaco-action-bar .action-item > .record-keys,
.vs-dark .keybindings-editor > .keybindings-header > .search-container > .keybindings-search-actions-container > .monaco-action-bar .action-item > .record-keys {
background: url('record-keys-inverse.svg') center center no-repeat;
}
.keybindings-editor > .keybindings-header > .search-container > .keybindings-search-actions-container > .monaco-action-bar .action-item > .clear-input {
background: url('clear.svg') center center no-repeat;
}
.hc-black .keybindings-editor > .keybindings-header > .search-container > .keybindings-search-actions-container > .monaco-action-bar .action-item > .clear-input,
.vs-dark .keybindings-editor > .keybindings-header > .search-container > .keybindings-search-actions-container > .monaco-action-bar .action-item > .clear-input {
background: url('clear-inverse.svg') center center no-repeat;
}
.keybindings-editor > .keybindings-header .open-keybindings-container {
margin-top: 10px;
display: flex;
}
.keybindings-editor > .keybindings-header .open-keybindings-container > div {
opacity: 0.7;
}
.keybindings-editor > .keybindings-header .open-keybindings-container > .file-name {
text-decoration: underline;
cursor: pointer;
margin-left: 4px;
}
.keybindings-editor > .keybindings-header .open-keybindings-container > .file-name:focus {
opacity: 1;
}
/** List based styling **/
.keybindings-editor > .keybindings-body .keybindings-list-container {
width: 100%;
border-spacing: 0;
border-collapse: separate;
}
.keybindings-editor > .keybindings-body > .keybindings-list-container .monaco-list-row {
cursor: default;
display: flex;
}
.keybindings-editor > .keybindings-body > .keybindings-list-container .monaco-list-row.odd:not(.focused):not(.selected):not(:hover),
.keybindings-editor > .keybindings-body > .keybindings-list-container .monaco-list:not(:focus) .monaco-list-row.focused.odd:not(.selected):not(:hover),
.keybindings-editor > .keybindings-body > .keybindings-list-container .monaco-list:not(.focused) .monaco-list-row.focused.odd:not(.selected):not(:hover) {
background-color: rgba(130, 130, 130, 0.04);
}
.keybindings-editor > .keybindings-body .keybindings-list-container .monaco-list-row > .header {
text-align: left;
font-weight: bold;
}
.keybindings-editor > .keybindings-body > .keybindings-list-container .monaco-list-row .header,
.keybindings-editor > .keybindings-body > .keybindings-list-container .monaco-list-row .column {
align-items: center;
display: flex;
overflow: hidden;
margin-right: 6px;
}
.keybindings-editor > .keybindings-body > .keybindings-list-container .monaco-list-row .actions {
width: 24px;
padding-right: 2px;
}
.keybindings-editor > .keybindings-body > .keybindings-list-container .monaco-list-row .command {
flex: 0.75;
}
.keybindings-editor > .keybindings-body > .keybindings-list-container .monaco-list-row .command.vertical-align-column {
flex-direction: column;
align-items: flex-start;
justify-content: center;
}
.keybindings-editor > .keybindings-body > .keybindings-list-container .monaco-list-row .command .command-default-label {
opacity: 0.8;
margin-top: 2px;
}
.keybindings-editor > .keybindings-body > .keybindings-list-container .monaco-list-row .keybinding {
flex: 0.5;
}
.keybindings-editor > .keybindings-body > .keybindings-list-container .monaco-list-row .keybinding .monaco-highlighted-label {
padding-left: 10px;
}
.keybindings-editor > .keybindings-body > .keybindings-list-container .monaco-list-row .source {
flex: 0 0 100px;
}
.keybindings-editor > .keybindings-body > .keybindings-list-container .monaco-list-row .when {
flex: 1;
}
.keybindings-editor > .keybindings-body > .keybindings-list-container .monaco-list-row > .when .empty {
padding-left: 4px;
}
.keybindings-editor > .keybindings-body > .keybindings-list-container .monaco-list-row .command .monaco-highlighted-label,
.keybindings-editor > .keybindings-body > .keybindings-list-container .monaco-list-row .source .monaco-highlighted-label,
.keybindings-editor > .keybindings-body > .keybindings-list-container .monaco-list-row .when .monaco-highlighted-label {
overflow: hidden;
text-overflow: ellipsis;
}
.keybindings-editor > .keybindings-body > .keybindings-list-container .monaco-list-row > .column > .code {
font-family: Monaco, Menlo, Consolas, "Droid Sans Mono", "Inconsolata", "Courier New", monospace, "Droid Sans Fallback";
font-size: 90%;
opacity: 0.8;
display: flex;
overflow: hidden;
}
.keybindings-editor > .keybindings-body > .keybindings-list-container .monaco-list-row > .column > .code.strong {
padding: 1px 4px;
background-color: rgba(128, 128, 128, 0.17);
border-radius: 4px;
}
.keybindings-editor > .keybindings-body > .keybindings-list-container .monaco-list-row > .column .highlight {
font-weight: bold;
}
.keybindings-editor > .keybindings-body > .keybindings-list-container .monaco-list:focus .monaco-list-row.selected > .column .highlight,
.keybindings-editor > .keybindings-body > .keybindings-list-container .monaco-list:focus .monaco-list-row.selected.focused > .column .highlight {
color: inherit;
}
.keybindings-editor > .keybindings-body > .keybindings-list-container .monaco-list-row > .column .monaco-action-bar {
display: none;
flex: 1;
}
.keybindings-editor > .keybindings-body > .keybindings-list-container .monaco-list-row.selected > .column.actions .monaco-action-bar,
.keybindings-editor > .keybindings-body > .keybindings-list-container .monaco-list.focused .monaco-list-row.focused > .column.actions .monaco-action-bar,
.keybindings-editor > .keybindings-body > .keybindings-list-container .monaco-list-row:hover > .column.actions .monaco-action-bar {
display: flex;
}
.keybindings-editor > .keybindings-body > .keybindings-list-container .monaco-list-row > .column .monaco-action-bar .action-item > .icon {
width:16px;
height: 16px;
cursor: pointer;
margin-top: 3px;
}
.keybindings-editor > .keybindings-body > .keybindings-list-container .monaco-list-row > .column .monaco-action-bar .action-item > .icon.edit {
background: url('edit.svg') center center no-repeat;
transform: rotate(-90deg);
}
.hc-black .keybindings-editor > .keybindings-body > .keybindings-list-container .monaco-list-row > .column .monaco-action-bar .action-item > .icon.edit,
.vs-dark .keybindings-editor > .keybindings-body > .keybindings-list-container .monaco-list-row > .column .monaco-action-bar .action-item > .icon.edit {
background: url('edit_inverse.svg') center center no-repeat;
}
.keybindings-editor > .keybindings-body > .keybindings-list-container .monaco-list-row > .column .monaco-action-bar .action-item > .icon.add {
background: url('add.svg') center center no-repeat;
}
.hc-black .keybindings-editor > .keybindings-body > .keybindings-list-container .monaco-list-row > .column .monaco-action-bar .action-item > .icon.add,
.vs-dark .keybindings-editor > .keybindings-body > .keybindings-list-container .monaco-list-row > .column .monaco-action-bar .action-item > .icon.add {
background: url('add_inverse.svg') center center no-repeat;
}
| {
"pile_set_name": "Github"
} |
{
"images" : [
{
"idiom" : "universal",
"filename" : "PullToRefresh_012.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "[email protected]",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
} | {
"pile_set_name": "Github"
} |
/*
** $Id: lvm.c,v 2.268.1.1 2017/04/19 17:39:34 roberto Exp $
** Lua virtual machine
** See Copyright Notice in lua.h
*/
#define lvm_c
#define LUA_CORE
#if defined(ARDUPILOT_BUILD)
#pragma GCC diagnostic ignored "-Wfloat-equal"
#endif
#include "lprefix.h"
#include <float.h>
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "lua.h"
#include "ldebug.h"
#include "ldo.h"
#include "lfunc.h"
#include "lgc.h"
#include "lobject.h"
#include "lopcodes.h"
#include "lstate.h"
#include "lstring.h"
#include "ltable.h"
#include "ltm.h"
#include "lvm.h"
/* limit for table tag-method chains (to avoid loops) */
#define MAXTAGLOOP 2000
/*
** 'l_intfitsf' checks whether a given integer can be converted to a
** float without rounding. Used in comparisons. Left undefined if
** all integers fit in a float precisely.
*/
#if !defined(l_intfitsf)
/* number of bits in the mantissa of a float */
#define NBM (l_mathlim(MANT_DIG))
/*
** Check whether some integers may not fit in a float, that is, whether
** (maxinteger >> NBM) > 0 (that implies (1 << NBM) <= maxinteger).
** (The shifts are done in parts to avoid shifting by more than the size
** of an integer. In a worst case, NBM == 113 for long double and
** sizeof(integer) == 32.)
*/
#if ((((LUA_MAXINTEGER >> (NBM / 4)) >> (NBM / 4)) >> (NBM / 4)) \
>> (NBM - (3 * (NBM / 4)))) > 0
#define l_intfitsf(i) \
(-((lua_Integer)1 << NBM) <= (i) && (i) <= ((lua_Integer)1 << NBM))
#endif
#endif
/*
** Try to convert a value to a float. The float case is already handled
** by the macro 'tonumber'.
*/
int luaV_tonumber_ (const TValue *obj, lua_Number *n) {
TValue v;
if (ttisinteger(obj)) {
*n = cast_num(ivalue(obj));
return 1;
}
else if (cvt2num(obj) && /* string convertible to number? */
luaO_str2num(svalue(obj), &v) == vslen(obj) + 1) {
*n = nvalue(&v); /* convert result of 'luaO_str2num' to a float */
return 1;
}
else
return 0; /* conversion failed */
}
/*
** try to convert a value to an integer, rounding according to 'mode':
** mode == 0: accepts only integral values
** mode == 1: takes the floor of the number
** mode == 2: takes the ceil of the number
*/
int luaV_tointeger (const TValue *obj, lua_Integer *p, int mode) {
TValue v;
again:
if (ttisfloat(obj)) {
lua_Number n = fltvalue(obj);
lua_Number f = l_floor(n);
if (n != f) { /* not an integral value? */
if (mode == 0) return 0; /* fails if mode demands integral value */
else if (mode > 1) /* needs ceil? */
f += 1; /* convert floor to ceil (remember: n != f) */
}
return lua_numbertointeger(f, p);
}
else if (ttisinteger(obj)) {
*p = ivalue(obj);
return 1;
}
else if (cvt2num(obj) &&
luaO_str2num(svalue(obj), &v) == vslen(obj) + 1) {
obj = &v;
goto again; /* convert result from 'luaO_str2num' to an integer */
}
return 0; /* conversion failed */
}
/*
** Try to convert a 'for' limit to an integer, preserving the
** semantics of the loop.
** (The following explanation assumes a non-negative step; it is valid
** for negative steps mutatis mutandis.)
** If the limit can be converted to an integer, rounding down, that is
** it.
** Otherwise, check whether the limit can be converted to a number. If
** the number is too large, it is OK to set the limit as LUA_MAXINTEGER,
** which means no limit. If the number is too negative, the loop
** should not run, because any initial integer value is larger than the
** limit. So, it sets the limit to LUA_MININTEGER. 'stopnow' corrects
** the extreme case when the initial value is LUA_MININTEGER, in which
** case the LUA_MININTEGER limit would still run the loop once.
*/
static int forlimit (const TValue *obj, lua_Integer *p, lua_Integer step,
int *stopnow) {
*stopnow = 0; /* usually, let loops run */
if (!luaV_tointeger(obj, p, (step < 0 ? 2 : 1))) { /* not fit in integer? */
lua_Number n; /* try to convert to float */
if (!tonumber(obj, &n)) /* cannot convert to float? */
return 0; /* not a number */
if (luai_numlt(0, n)) { /* if true, float is larger than max integer */
*p = LUA_MAXINTEGER;
if (step < 0) *stopnow = 1;
}
else { /* float is smaller than min integer */
*p = LUA_MININTEGER;
if (step >= 0) *stopnow = 1;
}
}
return 1;
}
/*
** Finish the table access 'val = t[key]'.
** if 'slot' is NULL, 't' is not a table; otherwise, 'slot' points to
** t[k] entry (which must be nil).
*/
void luaV_finishget (lua_State *L, const TValue *t, TValue *key, StkId val,
const TValue *slot) {
int loop; /* counter to avoid infinite loops */
const TValue *tm; /* metamethod */
for (loop = 0; loop < MAXTAGLOOP; loop++) {
if (slot == NULL) { /* 't' is not a table? */
lua_assert(!ttistable(t));
tm = luaT_gettmbyobj(L, t, TM_INDEX);
if (ttisnil(tm))
luaG_typeerror(L, t, "index"); /* no metamethod */
/* else will try the metamethod */
}
else { /* 't' is a table */
lua_assert(ttisnil(slot));
tm = fasttm(L, hvalue(t)->metatable, TM_INDEX); /* table's metamethod */
if (tm == NULL) { /* no metamethod? */
setnilvalue(val); /* result is nil */
return;
}
/* else will try the metamethod */
}
if (ttisfunction(tm)) { /* is metamethod a function? */
luaT_callTM(L, tm, t, key, val, 1); /* call it */
return;
}
t = tm; /* else try to access 'tm[key]' */
if (luaV_fastget(L,t,key,slot,luaH_get)) { /* fast track? */
setobj2s(L, val, slot); /* done */
return;
}
/* else repeat (tail call 'luaV_finishget') */
}
luaG_runerror(L, "'__index' chain too long; possible loop");
}
/*
** Finish a table assignment 't[key] = val'.
** If 'slot' is NULL, 't' is not a table. Otherwise, 'slot' points
** to the entry 't[key]', or to 'luaO_nilobject' if there is no such
** entry. (The value at 'slot' must be nil, otherwise 'luaV_fastset'
** would have done the job.)
*/
void luaV_finishset (lua_State *L, const TValue *t, TValue *key,
StkId val, const TValue *slot) {
int loop; /* counter to avoid infinite loops */
for (loop = 0; loop < MAXTAGLOOP; loop++) {
const TValue *tm; /* '__newindex' metamethod */
if (slot != NULL) { /* is 't' a table? */
Table *h = hvalue(t); /* save 't' table */
lua_assert(ttisnil(slot)); /* old value must be nil */
tm = fasttm(L, h->metatable, TM_NEWINDEX); /* get metamethod */
if (tm == NULL) { /* no metamethod? */
if (slot == luaO_nilobject) /* no previous entry? */
slot = luaH_newkey(L, h, key); /* create one */
/* no metamethod and (now) there is an entry with given key */
setobj2t(L, cast(TValue *, slot), val); /* set its new value */
invalidateTMcache(h);
luaC_barrierback(L, h, val);
return;
}
/* else will try the metamethod */
}
else { /* not a table; check metamethod */
if (ttisnil(tm = luaT_gettmbyobj(L, t, TM_NEWINDEX)))
luaG_typeerror(L, t, "index");
}
/* try the metamethod */
if (ttisfunction(tm)) {
luaT_callTM(L, tm, t, key, val, 0);
return;
}
t = tm; /* else repeat assignment over 'tm' */
if (luaV_fastset(L, t, key, slot, luaH_get, val))
return; /* done */
/* else loop */
}
luaG_runerror(L, "'__newindex' chain too long; possible loop");
}
/*
** Compare two strings 'ls' x 'rs', returning an integer smaller-equal-
** -larger than zero if 'ls' is smaller-equal-larger than 'rs'.
** The code is a little tricky because it allows '\0' in the strings
** and it uses 'strcoll' (to respect locales) for each segments
** of the strings.
*/
static int l_strcmp (const TString *ls, const TString *rs) {
const char *l = getstr(ls);
size_t ll = tsslen(ls);
const char *r = getstr(rs);
size_t lr = tsslen(rs);
for (;;) { /* for each segment */
int temp = strcoll(l, r);
if (temp != 0) /* not equal? */
return temp; /* done */
else { /* strings are equal up to a '\0' */
size_t len = strlen(l); /* index of first '\0' in both strings */
if (len == lr) /* 'rs' is finished? */
return (len == ll) ? 0 : 1; /* check 'ls' */
else if (len == ll) /* 'ls' is finished? */
return -1; /* 'ls' is smaller than 'rs' ('rs' is not finished) */
/* both strings longer than 'len'; go on comparing after the '\0' */
len++;
l += len; ll -= len; r += len; lr -= len;
}
}
}
/*
** Check whether integer 'i' is less than float 'f'. If 'i' has an
** exact representation as a float ('l_intfitsf'), compare numbers as
** floats. Otherwise, if 'f' is outside the range for integers, result
** is trivial. Otherwise, compare them as integers. (When 'i' has no
** float representation, either 'f' is "far away" from 'i' or 'f' has
** no precision left for a fractional part; either way, how 'f' is
** truncated is irrelevant.) When 'f' is NaN, comparisons must result
** in false.
*/
static int LTintfloat (lua_Integer i, lua_Number f) {
#if defined(l_intfitsf)
if (!l_intfitsf(i)) {
if (f >= -cast_num(LUA_MININTEGER)) /* -minint == maxint + 1 */
return 1; /* f >= maxint + 1 > i */
else if (f > cast_num(LUA_MININTEGER)) /* minint < f <= maxint ? */
return (i < cast(lua_Integer, f)); /* compare them as integers */
else /* f <= minint <= i (or 'f' is NaN) --> not(i < f) */
return 0;
}
#endif
return luai_numlt(cast_num(i), f); /* compare them as floats */
}
/*
** Check whether integer 'i' is less than or equal to float 'f'.
** See comments on previous function.
*/
static int LEintfloat (lua_Integer i, lua_Number f) {
#if defined(l_intfitsf)
if (!l_intfitsf(i)) {
if (f >= -cast_num(LUA_MININTEGER)) /* -minint == maxint + 1 */
return 1; /* f >= maxint + 1 > i */
else if (f >= cast_num(LUA_MININTEGER)) /* minint <= f <= maxint ? */
return (i <= cast(lua_Integer, f)); /* compare them as integers */
else /* f < minint <= i (or 'f' is NaN) --> not(i <= f) */
return 0;
}
#endif
return luai_numle(cast_num(i), f); /* compare them as floats */
}
/*
** Return 'l < r', for numbers.
*/
static int LTnum (const TValue *l, const TValue *r) {
if (ttisinteger(l)) {
lua_Integer li = ivalue(l);
if (ttisinteger(r))
return li < ivalue(r); /* both are integers */
else /* 'l' is int and 'r' is float */
return LTintfloat(li, fltvalue(r)); /* l < r ? */
}
else {
lua_Number lf = fltvalue(l); /* 'l' must be float */
if (ttisfloat(r))
return luai_numlt(lf, fltvalue(r)); /* both are float */
else if (luai_numisnan(lf)) /* 'r' is int and 'l' is float */
return 0; /* NaN < i is always false */
else /* without NaN, (l < r) <--> not(r <= l) */
return !LEintfloat(ivalue(r), lf); /* not (r <= l) ? */
}
}
/*
** Return 'l <= r', for numbers.
*/
static int LEnum (const TValue *l, const TValue *r) {
if (ttisinteger(l)) {
lua_Integer li = ivalue(l);
if (ttisinteger(r))
return li <= ivalue(r); /* both are integers */
else /* 'l' is int and 'r' is float */
return LEintfloat(li, fltvalue(r)); /* l <= r ? */
}
else {
lua_Number lf = fltvalue(l); /* 'l' must be float */
if (ttisfloat(r))
return luai_numle(lf, fltvalue(r)); /* both are float */
else if (luai_numisnan(lf)) /* 'r' is int and 'l' is float */
return 0; /* NaN <= i is always false */
else /* without NaN, (l <= r) <--> not(r < l) */
return !LTintfloat(ivalue(r), lf); /* not (r < l) ? */
}
}
/*
** Main operation less than; return 'l < r'.
*/
int luaV_lessthan (lua_State *L, const TValue *l, const TValue *r) {
int res;
if (ttisnumber(l) && ttisnumber(r)) /* both operands are numbers? */
return LTnum(l, r);
else if (ttisstring(l) && ttisstring(r)) /* both are strings? */
return l_strcmp(tsvalue(l), tsvalue(r)) < 0;
else if ((res = luaT_callorderTM(L, l, r, TM_LT)) < 0) /* no metamethod? */
luaG_ordererror(L, l, r); /* error */
return res;
}
/*
** Main operation less than or equal to; return 'l <= r'. If it needs
** a metamethod and there is no '__le', try '__lt', based on
** l <= r iff !(r < l) (assuming a total order). If the metamethod
** yields during this substitution, the continuation has to know
** about it (to negate the result of r<l); bit CIST_LEQ in the call
** status keeps that information.
*/
int luaV_lessequal (lua_State *L, const TValue *l, const TValue *r) {
int res;
if (ttisnumber(l) && ttisnumber(r)) /* both operands are numbers? */
return LEnum(l, r);
else if (ttisstring(l) && ttisstring(r)) /* both are strings? */
return l_strcmp(tsvalue(l), tsvalue(r)) <= 0;
else if ((res = luaT_callorderTM(L, l, r, TM_LE)) >= 0) /* try 'le' */
return res;
else { /* try 'lt': */
L->ci->callstatus |= CIST_LEQ; /* mark it is doing 'lt' for 'le' */
res = luaT_callorderTM(L, r, l, TM_LT);
L->ci->callstatus ^= CIST_LEQ; /* clear mark */
if (res < 0)
luaG_ordererror(L, l, r);
return !res; /* result is negated */
}
}
/*
** Main operation for equality of Lua values; return 't1 == t2'.
** L == NULL means raw equality (no metamethods)
*/
int luaV_equalobj (lua_State *L, const TValue *t1, const TValue *t2) {
const TValue *tm;
if (ttype(t1) != ttype(t2)) { /* not the same variant? */
if (ttnov(t1) != ttnov(t2) || ttnov(t1) != LUA_TNUMBER)
return 0; /* only numbers can be equal with different variants */
else { /* two numbers with different variants */
lua_Integer i1, i2; /* compare them as integers */
return (tointeger(t1, &i1) && tointeger(t2, &i2) && i1 == i2);
}
}
/* values have same type and same variant */
switch (ttype(t1)) {
case LUA_TNIL: return 1;
case LUA_TNUMINT: return (ivalue(t1) == ivalue(t2));
case LUA_TNUMFLT: return luai_numeq(fltvalue(t1), fltvalue(t2));
case LUA_TBOOLEAN: return bvalue(t1) == bvalue(t2); /* true must be 1 !! */
case LUA_TLIGHTUSERDATA: return pvalue(t1) == pvalue(t2);
case LUA_TLCF: return fvalue(t1) == fvalue(t2);
case LUA_TSHRSTR: return eqshrstr(tsvalue(t1), tsvalue(t2));
case LUA_TLNGSTR: return luaS_eqlngstr(tsvalue(t1), tsvalue(t2));
case LUA_TUSERDATA: {
if (uvalue(t1) == uvalue(t2)) return 1;
else if (L == NULL) return 0;
tm = fasttm(L, uvalue(t1)->metatable, TM_EQ);
if (tm == NULL)
tm = fasttm(L, uvalue(t2)->metatable, TM_EQ);
break; /* will try TM */
}
case LUA_TTABLE: {
if (hvalue(t1) == hvalue(t2)) return 1;
else if (L == NULL) return 0;
tm = fasttm(L, hvalue(t1)->metatable, TM_EQ);
if (tm == NULL)
tm = fasttm(L, hvalue(t2)->metatable, TM_EQ);
break; /* will try TM */
}
default:
return gcvalue(t1) == gcvalue(t2);
}
if (tm == NULL) /* no TM? */
return 0; /* objects are different */
luaT_callTM(L, tm, t1, t2, L->top, 1); /* call TM */
return !l_isfalse(L->top);
}
/* macro used by 'luaV_concat' to ensure that element at 'o' is a string */
#define tostring(L,o) \
(ttisstring(o) || (cvt2str(o) && (luaO_tostring(L, o), 1)))
#define isemptystr(o) (ttisshrstring(o) && tsvalue(o)->shrlen == 0)
/* copy strings in stack from top - n up to top - 1 to buffer */
static void copy2buff (StkId top, int n, char *buff) {
size_t tl = 0; /* size already copied */
do {
size_t l = vslen(top - n); /* length of string being copied */
memcpy(buff + tl, svalue(top - n), l * sizeof(char));
tl += l;
} while (--n > 0);
}
/*
** Main operation for concatenation: concat 'total' values in the stack,
** from 'L->top - total' up to 'L->top - 1'.
*/
void luaV_concat (lua_State *L, int total) {
lua_assert(total >= 2);
do {
StkId top = L->top;
int n = 2; /* number of elements handled in this pass (at least 2) */
if (!(ttisstring(top-2) || cvt2str(top-2)) || !tostring(L, top-1))
luaT_trybinTM(L, top-2, top-1, top-2, TM_CONCAT);
else if (isemptystr(top - 1)) /* second operand is empty? */
cast_void(tostring(L, top - 2)); /* result is first operand */
else if (isemptystr(top - 2)) { /* first operand is an empty string? */
setobjs2s(L, top - 2, top - 1); /* result is second op. */
}
else {
/* at least two non-empty string values; get as many as possible */
size_t tl = vslen(top - 1);
TString *ts;
/* collect total length and number of strings */
for (n = 1; n < total && tostring(L, top - n - 1); n++) {
size_t l = vslen(top - n - 1);
if (l >= (MAX_SIZE/sizeof(char)) - tl)
luaG_runerror(L, "string length overflow");
tl += l;
}
if (tl <= LUAI_MAXSHORTLEN) { /* is result a short string? */
char buff[LUAI_MAXSHORTLEN];
copy2buff(top, n, buff); /* copy strings to buffer */
ts = luaS_newlstr(L, buff, tl);
}
else { /* long string; copy strings directly to final result */
ts = luaS_createlngstrobj(L, tl);
copy2buff(top, n, getstr(ts));
}
setsvalue2s(L, top - n, ts); /* create result */
}
total -= n-1; /* got 'n' strings to create 1 new */
L->top -= n-1; /* popped 'n' strings and pushed one */
} while (total > 1); /* repeat until only 1 result left */
}
/*
** Main operation 'ra' = #rb'.
*/
void luaV_objlen (lua_State *L, StkId ra, const TValue *rb) {
const TValue *tm;
switch (ttype(rb)) {
case LUA_TTABLE: {
Table *h = hvalue(rb);
tm = fasttm(L, h->metatable, TM_LEN);
if (tm) break; /* metamethod? break switch to call it */
setivalue(ra, luaH_getn(h)); /* else primitive len */
return;
}
case LUA_TSHRSTR: {
setivalue(ra, tsvalue(rb)->shrlen);
return;
}
case LUA_TLNGSTR: {
setivalue(ra, tsvalue(rb)->u.lnglen);
return;
}
default: { /* try metamethod */
tm = luaT_gettmbyobj(L, rb, TM_LEN);
if (ttisnil(tm)) /* no metamethod? */
luaG_typeerror(L, rb, "get length of");
break;
}
}
luaT_callTM(L, tm, rb, rb, ra, 1);
}
/*
** Integer division; return 'm // n', that is, floor(m/n).
** C division truncates its result (rounds towards zero).
** 'floor(q) == trunc(q)' when 'q >= 0' or when 'q' is integer,
** otherwise 'floor(q) == trunc(q) - 1'.
*/
lua_Integer luaV_div (lua_State *L, lua_Integer m, lua_Integer n) {
if (l_castS2U(n) + 1u <= 1u) { /* special cases: -1 or 0 */
if (n == 0)
luaG_runerror(L, "attempt to divide by zero");
return intop(-, 0, m); /* n==-1; avoid overflow with 0x80000...//-1 */
}
else {
lua_Integer q = m / n; /* perform C division */
if ((m ^ n) < 0 && m % n != 0) /* 'm/n' would be negative non-integer? */
q -= 1; /* correct result for different rounding */
return q;
}
}
/*
** Integer modulus; return 'm % n'. (Assume that C '%' with
** negative operands follows C99 behavior. See previous comment
** about luaV_div.)
*/
lua_Integer luaV_mod (lua_State *L, lua_Integer m, lua_Integer n) {
if (l_castS2U(n) + 1u <= 1u) { /* special cases: -1 or 0 */
if (n == 0)
luaG_runerror(L, "attempt to perform 'n%%0'");
return 0; /* m % -1 == 0; avoid overflow with 0x80000...%-1 */
}
else {
lua_Integer r = m % n;
if (r != 0 && (m ^ n) < 0) /* 'm/n' would be non-integer negative? */
r += n; /* correct result for different rounding */
return r;
}
}
/* number of bits in an integer */
#define NBITS cast_int(sizeof(lua_Integer) * CHAR_BIT)
/*
** Shift left operation. (Shift right just negates 'y'.)
*/
lua_Integer luaV_shiftl (lua_Integer x, lua_Integer y) {
if (y < 0) { /* shift right? */
if (y <= -NBITS) return 0;
else return intop(>>, x, -y);
}
else { /* shift left */
if (y >= NBITS) return 0;
else return intop(<<, x, y);
}
}
/*
** check whether cached closure in prototype 'p' may be reused, that is,
** whether there is a cached closure with the same upvalues needed by
** new closure to be created.
*/
static LClosure *getcached (Proto *p, UpVal **encup, StkId base) {
LClosure *c = p->cache;
if (c != NULL) { /* is there a cached closure? */
int nup = p->sizeupvalues;
Upvaldesc *uv = p->upvalues;
int i;
for (i = 0; i < nup; i++) { /* check whether it has right upvalues */
TValue *v = uv[i].instack ? base + uv[i].idx : encup[uv[i].idx]->v;
if (c->upvals[i]->v != v)
return NULL; /* wrong upvalue; cannot reuse closure */
}
}
return c; /* return cached closure (or NULL if no cached closure) */
}
/*
** create a new Lua closure, push it in the stack, and initialize
** its upvalues. Note that the closure is not cached if prototype is
** already black (which means that 'cache' was already cleared by the
** GC).
*/
static void pushclosure (lua_State *L, Proto *p, UpVal **encup, StkId base,
StkId ra) {
int nup = p->sizeupvalues;
Upvaldesc *uv = p->upvalues;
int i;
LClosure *ncl = luaF_newLclosure(L, nup);
ncl->p = p;
setclLvalue(L, ra, ncl); /* anchor new closure in stack */
for (i = 0; i < nup; i++) { /* fill in its upvalues */
if (uv[i].instack) /* upvalue refers to local variable? */
ncl->upvals[i] = luaF_findupval(L, base + uv[i].idx);
else /* get upvalue from enclosing function */
ncl->upvals[i] = encup[uv[i].idx];
ncl->upvals[i]->refcount++;
/* new closure is white, so we do not need a barrier here */
}
if (!isblack(p)) /* cache will not break GC invariant? */
p->cache = ncl; /* save it on cache for reuse */
}
/*
** finish execution of an opcode interrupted by an yield
*/
void luaV_finishOp (lua_State *L) {
CallInfo *ci = L->ci;
StkId base = ci->u.l.base;
Instruction inst = *(ci->u.l.savedpc - 1); /* interrupted instruction */
OpCode op = GET_OPCODE(inst);
switch (op) { /* finish its execution */
case OP_ADD: case OP_SUB: case OP_MUL: case OP_DIV: case OP_IDIV:
case OP_BAND: case OP_BOR: case OP_BXOR: case OP_SHL: case OP_SHR:
case OP_MOD: case OP_POW:
case OP_UNM: case OP_BNOT: case OP_LEN:
case OP_GETTABUP: case OP_GETTABLE: case OP_SELF: {
setobjs2s(L, base + GETARG_A(inst), --L->top);
break;
}
case OP_LE: case OP_LT: case OP_EQ: {
int res = !l_isfalse(L->top - 1);
L->top--;
if (ci->callstatus & CIST_LEQ) { /* "<=" using "<" instead? */
lua_assert(op == OP_LE);
ci->callstatus ^= CIST_LEQ; /* clear mark */
res = !res; /* negate result */
}
lua_assert(GET_OPCODE(*ci->u.l.savedpc) == OP_JMP);
if (res != GETARG_A(inst)) /* condition failed? */
ci->u.l.savedpc++; /* skip jump instruction */
break;
}
case OP_CONCAT: {
StkId top = L->top - 1; /* top when 'luaT_trybinTM' was called */
int b = GETARG_B(inst); /* first element to concatenate */
int total = cast_int(top - 1 - (base + b)); /* yet to concatenate */
setobj2s(L, top - 2, top); /* put TM result in proper position */
if (total > 1) { /* are there elements to concat? */
L->top = top - 1; /* top is one after last element (at top-2) */
luaV_concat(L, total); /* concat them (may yield again) */
}
/* move final result to final position */
setobj2s(L, ci->u.l.base + GETARG_A(inst), L->top - 1);
L->top = ci->top; /* restore top */
break;
}
case OP_TFORCALL: {
lua_assert(GET_OPCODE(*ci->u.l.savedpc) == OP_TFORLOOP);
L->top = ci->top; /* correct top */
break;
}
case OP_CALL: {
if (GETARG_C(inst) - 1 >= 0) /* nresults >= 0? */
L->top = ci->top; /* adjust results */
break;
}
case OP_TAILCALL: case OP_SETTABUP: case OP_SETTABLE:
break;
default: lua_assert(0);
}
}
/*
** {==================================================================
** Function 'luaV_execute': main interpreter loop
** ===================================================================
*/
/*
** some macros for common tasks in 'luaV_execute'
*/
#define RA(i) (base+GETARG_A(i))
#define RB(i) check_exp(getBMode(GET_OPCODE(i)) == OpArgR, base+GETARG_B(i))
#define RC(i) check_exp(getCMode(GET_OPCODE(i)) == OpArgR, base+GETARG_C(i))
#define RKB(i) check_exp(getBMode(GET_OPCODE(i)) == OpArgK, \
ISK(GETARG_B(i)) ? k+INDEXK(GETARG_B(i)) : base+GETARG_B(i))
#define RKC(i) check_exp(getCMode(GET_OPCODE(i)) == OpArgK, \
ISK(GETARG_C(i)) ? k+INDEXK(GETARG_C(i)) : base+GETARG_C(i))
/* execute a jump instruction */
#define dojump(ci,i,e) \
{ int a = GETARG_A(i); \
if (a != 0) luaF_close(L, ci->u.l.base + a - 1); \
ci->u.l.savedpc += GETARG_sBx(i) + e; }
/* for test instructions, execute the jump instruction that follows it */
#define donextjump(ci) { i = *ci->u.l.savedpc; dojump(ci, i, 1); }
#define Protect(x) { {x;}; base = ci->u.l.base; }
#define checkGC(L,c) \
{ luaC_condGC(L, L->top = (c), /* limit of live values */ \
Protect(L->top = ci->top)); /* restore top */ \
luai_threadyield(L); }
/* fetch an instruction and prepare its execution */
#define vmfetch() { \
i = *(ci->u.l.savedpc++); \
if (L->hookmask & (LUA_MASKLINE | LUA_MASKCOUNT)) \
Protect(luaG_traceexec(L)); \
ra = RA(i); /* WARNING: any stack reallocation invalidates 'ra' */ \
lua_assert(base == ci->u.l.base); \
lua_assert(base <= L->top && L->top < L->stack + L->stacksize); \
}
#define vmdispatch(o) switch(o)
#define vmcase(l) case l:
#define vmbreak break
/*
** copy of 'luaV_gettable', but protecting the call to potential
** metamethod (which can reallocate the stack)
*/
#define gettableProtected(L,t,k,v) { const TValue *slot; \
if (luaV_fastget(L,t,k,slot,luaH_get)) { setobj2s(L, v, slot); } \
else Protect(luaV_finishget(L,t,k,v,slot)); }
/* same for 'luaV_settable' */
#define settableProtected(L,t,k,v) { const TValue *slot; \
if (!luaV_fastset(L,t,k,slot,luaH_get,v)) \
Protect(luaV_finishset(L,t,k,v,slot)); }
void luaV_execute (lua_State *L) {
CallInfo *ci = L->ci;
LClosure *cl;
TValue *k;
StkId base;
ci->callstatus |= CIST_FRESH; /* fresh invocation of 'luaV_execute" */
newframe: /* reentry point when frame changes (call/return) */
lua_assert(ci == L->ci);
cl = clLvalue(ci->func); /* local reference to function's closure */
k = cl->p->k; /* local reference to function's constant table */
base = ci->u.l.base; /* local copy of function's base */
/* main loop of interpreter */
for (;;) {
Instruction i;
StkId ra;
vmfetch();
vmdispatch (GET_OPCODE(i)) {
vmcase(OP_MOVE) {
setobjs2s(L, ra, RB(i));
vmbreak;
}
vmcase(OP_LOADK) {
TValue *rb = k + GETARG_Bx(i);
setobj2s(L, ra, rb);
vmbreak;
}
vmcase(OP_LOADKX) {
TValue *rb;
lua_assert(GET_OPCODE(*ci->u.l.savedpc) == OP_EXTRAARG);
rb = k + GETARG_Ax(*ci->u.l.savedpc++);
setobj2s(L, ra, rb);
vmbreak;
}
vmcase(OP_LOADBOOL) {
setbvalue(ra, GETARG_B(i));
if (GETARG_C(i)) ci->u.l.savedpc++; /* skip next instruction (if C) */
vmbreak;
}
vmcase(OP_LOADNIL) {
int b = GETARG_B(i);
do {
setnilvalue(ra++);
} while (b--);
vmbreak;
}
vmcase(OP_GETUPVAL) {
int b = GETARG_B(i);
setobj2s(L, ra, cl->upvals[b]->v);
vmbreak;
}
vmcase(OP_GETTABUP) {
TValue *upval = cl->upvals[GETARG_B(i)]->v;
TValue *rc = RKC(i);
gettableProtected(L, upval, rc, ra);
vmbreak;
}
vmcase(OP_GETTABLE) {
StkId rb = RB(i);
TValue *rc = RKC(i);
gettableProtected(L, rb, rc, ra);
vmbreak;
}
vmcase(OP_SETTABUP) {
TValue *upval = cl->upvals[GETARG_A(i)]->v;
TValue *rb = RKB(i);
TValue *rc = RKC(i);
settableProtected(L, upval, rb, rc);
vmbreak;
}
vmcase(OP_SETUPVAL) {
UpVal *uv = cl->upvals[GETARG_B(i)];
setobj(L, uv->v, ra);
luaC_upvalbarrier(L, uv);
vmbreak;
}
vmcase(OP_SETTABLE) {
TValue *rb = RKB(i);
TValue *rc = RKC(i);
settableProtected(L, ra, rb, rc);
vmbreak;
}
vmcase(OP_NEWTABLE) {
int b = GETARG_B(i);
int c = GETARG_C(i);
Table *t = luaH_new(L);
sethvalue(L, ra, t);
if (b != 0 || c != 0)
luaH_resize(L, t, luaO_fb2int(b), luaO_fb2int(c));
checkGC(L, ra + 1);
vmbreak;
}
vmcase(OP_SELF) {
const TValue *aux;
StkId rb = RB(i);
TValue *rc = RKC(i);
TString *key = tsvalue(rc); /* key must be a string */
setobjs2s(L, ra + 1, rb);
if (luaV_fastget(L, rb, key, aux, luaH_getstr)) {
setobj2s(L, ra, aux);
}
else Protect(luaV_finishget(L, rb, rc, ra, aux));
vmbreak;
}
vmcase(OP_ADD) {
TValue *rb = RKB(i);
TValue *rc = RKC(i);
lua_Number nb; lua_Number nc;
if (ttisinteger(rb) && ttisinteger(rc)) {
lua_Integer ib = ivalue(rb); lua_Integer ic = ivalue(rc);
setivalue(ra, intop(+, ib, ic));
}
else if (tonumber(rb, &nb) && tonumber(rc, &nc)) {
setfltvalue(ra, luai_numadd(L, nb, nc));
}
else { Protect(luaT_trybinTM(L, rb, rc, ra, TM_ADD)); }
vmbreak;
}
vmcase(OP_SUB) {
TValue *rb = RKB(i);
TValue *rc = RKC(i);
lua_Number nb; lua_Number nc;
if (ttisinteger(rb) && ttisinteger(rc)) {
lua_Integer ib = ivalue(rb); lua_Integer ic = ivalue(rc);
setivalue(ra, intop(-, ib, ic));
}
else if (tonumber(rb, &nb) && tonumber(rc, &nc)) {
setfltvalue(ra, luai_numsub(L, nb, nc));
}
else { Protect(luaT_trybinTM(L, rb, rc, ra, TM_SUB)); }
vmbreak;
}
vmcase(OP_MUL) {
TValue *rb = RKB(i);
TValue *rc = RKC(i);
lua_Number nb; lua_Number nc;
if (ttisinteger(rb) && ttisinteger(rc)) {
lua_Integer ib = ivalue(rb); lua_Integer ic = ivalue(rc);
setivalue(ra, intop(*, ib, ic));
}
else if (tonumber(rb, &nb) && tonumber(rc, &nc)) {
setfltvalue(ra, luai_nummul(L, nb, nc));
}
else { Protect(luaT_trybinTM(L, rb, rc, ra, TM_MUL)); }
vmbreak;
}
vmcase(OP_DIV) { /* float division (always with floats) */
TValue *rb = RKB(i);
TValue *rc = RKC(i);
lua_Number nb; lua_Number nc;
if (tonumber(rb, &nb) && tonumber(rc, &nc)) {
setfltvalue(ra, luai_numdiv(L, nb, nc));
}
else { Protect(luaT_trybinTM(L, rb, rc, ra, TM_DIV)); }
vmbreak;
}
vmcase(OP_BAND) {
TValue *rb = RKB(i);
TValue *rc = RKC(i);
lua_Integer ib; lua_Integer ic;
if (tointeger(rb, &ib) && tointeger(rc, &ic)) {
setivalue(ra, intop(&, ib, ic));
}
else { Protect(luaT_trybinTM(L, rb, rc, ra, TM_BAND)); }
vmbreak;
}
vmcase(OP_BOR) {
TValue *rb = RKB(i);
TValue *rc = RKC(i);
lua_Integer ib; lua_Integer ic;
if (tointeger(rb, &ib) && tointeger(rc, &ic)) {
setivalue(ra, intop(|, ib, ic));
}
else { Protect(luaT_trybinTM(L, rb, rc, ra, TM_BOR)); }
vmbreak;
}
vmcase(OP_BXOR) {
TValue *rb = RKB(i);
TValue *rc = RKC(i);
lua_Integer ib; lua_Integer ic;
if (tointeger(rb, &ib) && tointeger(rc, &ic)) {
setivalue(ra, intop(^, ib, ic));
}
else { Protect(luaT_trybinTM(L, rb, rc, ra, TM_BXOR)); }
vmbreak;
}
vmcase(OP_SHL) {
TValue *rb = RKB(i);
TValue *rc = RKC(i);
lua_Integer ib; lua_Integer ic;
if (tointeger(rb, &ib) && tointeger(rc, &ic)) {
setivalue(ra, luaV_shiftl(ib, ic));
}
else { Protect(luaT_trybinTM(L, rb, rc, ra, TM_SHL)); }
vmbreak;
}
vmcase(OP_SHR) {
TValue *rb = RKB(i);
TValue *rc = RKC(i);
lua_Integer ib; lua_Integer ic;
if (tointeger(rb, &ib) && tointeger(rc, &ic)) {
setivalue(ra, luaV_shiftl(ib, -ic));
}
else { Protect(luaT_trybinTM(L, rb, rc, ra, TM_SHR)); }
vmbreak;
}
vmcase(OP_MOD) {
TValue *rb = RKB(i);
TValue *rc = RKC(i);
lua_Number nb; lua_Number nc;
if (ttisinteger(rb) && ttisinteger(rc)) {
lua_Integer ib = ivalue(rb); lua_Integer ic = ivalue(rc);
setivalue(ra, luaV_mod(L, ib, ic));
}
else if (tonumber(rb, &nb) && tonumber(rc, &nc)) {
lua_Number m;
luai_nummod(L, nb, nc, m);
setfltvalue(ra, m);
}
else { Protect(luaT_trybinTM(L, rb, rc, ra, TM_MOD)); }
vmbreak;
}
vmcase(OP_IDIV) { /* floor division */
TValue *rb = RKB(i);
TValue *rc = RKC(i);
lua_Number nb; lua_Number nc;
if (ttisinteger(rb) && ttisinteger(rc)) {
lua_Integer ib = ivalue(rb); lua_Integer ic = ivalue(rc);
setivalue(ra, luaV_div(L, ib, ic));
}
else if (tonumber(rb, &nb) && tonumber(rc, &nc)) {
setfltvalue(ra, luai_numidiv(L, nb, nc));
}
else { Protect(luaT_trybinTM(L, rb, rc, ra, TM_IDIV)); }
vmbreak;
}
vmcase(OP_POW) {
TValue *rb = RKB(i);
TValue *rc = RKC(i);
lua_Number nb; lua_Number nc;
if (tonumber(rb, &nb) && tonumber(rc, &nc)) {
setfltvalue(ra, luai_numpow(L, nb, nc));
}
else { Protect(luaT_trybinTM(L, rb, rc, ra, TM_POW)); }
vmbreak;
}
vmcase(OP_UNM) {
TValue *rb = RB(i);
lua_Number nb;
if (ttisinteger(rb)) {
lua_Integer ib = ivalue(rb);
setivalue(ra, intop(-, 0, ib));
}
else if (tonumber(rb, &nb)) {
setfltvalue(ra, luai_numunm(L, nb));
}
else {
Protect(luaT_trybinTM(L, rb, rb, ra, TM_UNM));
}
vmbreak;
}
vmcase(OP_BNOT) {
TValue *rb = RB(i);
lua_Integer ib;
if (tointeger(rb, &ib)) {
setivalue(ra, intop(^, ~l_castS2U(0), ib));
}
else {
Protect(luaT_trybinTM(L, rb, rb, ra, TM_BNOT));
}
vmbreak;
}
vmcase(OP_NOT) {
TValue *rb = RB(i);
int res = l_isfalse(rb); /* next assignment may change this value */
setbvalue(ra, res);
vmbreak;
}
vmcase(OP_LEN) {
Protect(luaV_objlen(L, ra, RB(i)));
vmbreak;
}
vmcase(OP_CONCAT) {
int b = GETARG_B(i);
int c = GETARG_C(i);
StkId rb;
L->top = base + c + 1; /* mark the end of concat operands */
Protect(luaV_concat(L, c - b + 1));
ra = RA(i); /* 'luaV_concat' may invoke TMs and move the stack */
rb = base + b;
setobjs2s(L, ra, rb);
checkGC(L, (ra >= rb ? ra + 1 : rb));
L->top = ci->top; /* restore top */
vmbreak;
}
vmcase(OP_JMP) {
dojump(ci, i, 0);
vmbreak;
}
vmcase(OP_EQ) {
TValue *rb = RKB(i);
TValue *rc = RKC(i);
Protect(
if (luaV_equalobj(L, rb, rc) != GETARG_A(i))
ci->u.l.savedpc++;
else
donextjump(ci);
)
vmbreak;
}
vmcase(OP_LT) {
Protect(
if (luaV_lessthan(L, RKB(i), RKC(i)) != GETARG_A(i))
ci->u.l.savedpc++;
else
donextjump(ci);
)
vmbreak;
}
vmcase(OP_LE) {
Protect(
if (luaV_lessequal(L, RKB(i), RKC(i)) != GETARG_A(i))
ci->u.l.savedpc++;
else
donextjump(ci);
)
vmbreak;
}
vmcase(OP_TEST) {
if (GETARG_C(i) ? l_isfalse(ra) : !l_isfalse(ra))
ci->u.l.savedpc++;
else
donextjump(ci);
vmbreak;
}
vmcase(OP_TESTSET) {
TValue *rb = RB(i);
if (GETARG_C(i) ? l_isfalse(rb) : !l_isfalse(rb))
ci->u.l.savedpc++;
else {
setobjs2s(L, ra, rb);
donextjump(ci);
}
vmbreak;
}
vmcase(OP_CALL) {
int b = GETARG_B(i);
int nresults = GETARG_C(i) - 1;
if (b != 0) L->top = ra+b; /* else previous instruction set top */
if (luaD_precall(L, ra, nresults)) { /* C function? */
if (nresults >= 0)
L->top = ci->top; /* adjust results */
Protect((void)0); /* update 'base' */
}
else { /* Lua function */
ci = L->ci;
goto newframe; /* restart luaV_execute over new Lua function */
}
vmbreak;
}
vmcase(OP_TAILCALL) {
int b = GETARG_B(i);
if (b != 0) L->top = ra+b; /* else previous instruction set top */
lua_assert(GETARG_C(i) - 1 == LUA_MULTRET);
if (luaD_precall(L, ra, LUA_MULTRET)) { /* C function? */
Protect((void)0); /* update 'base' */
}
else {
/* tail call: put called frame (n) in place of caller one (o) */
CallInfo *nci = L->ci; /* called frame */
CallInfo *oci = nci->previous; /* caller frame */
StkId nfunc = nci->func; /* called function */
StkId ofunc = oci->func; /* caller function */
/* last stack slot filled by 'precall' */
StkId lim = nci->u.l.base + getproto(nfunc)->numparams;
int aux;
/* close all upvalues from previous call */
if (cl->p->sizep > 0) luaF_close(L, oci->u.l.base);
/* move new frame into old one */
for (aux = 0; nfunc + aux < lim; aux++)
setobjs2s(L, ofunc + aux, nfunc + aux);
oci->u.l.base = ofunc + (nci->u.l.base - nfunc); /* correct base */
oci->top = L->top = ofunc + (L->top - nfunc); /* correct top */
oci->u.l.savedpc = nci->u.l.savedpc;
oci->callstatus |= CIST_TAIL; /* function was tail called */
ci = L->ci = oci; /* remove new frame */
lua_assert(L->top == oci->u.l.base + getproto(ofunc)->maxstacksize);
goto newframe; /* restart luaV_execute over new Lua function */
}
vmbreak;
}
vmcase(OP_RETURN) {
int b = GETARG_B(i);
if (cl->p->sizep > 0) luaF_close(L, base);
b = luaD_poscall(L, ci, ra, (b != 0 ? b - 1 : cast_int(L->top - ra)));
if (ci->callstatus & CIST_FRESH) /* local 'ci' still from callee */
return; /* external invocation: return */
else { /* invocation via reentry: continue execution */
ci = L->ci;
if (b) L->top = ci->top;
lua_assert(isLua(ci));
lua_assert(GET_OPCODE(*((ci)->u.l.savedpc - 1)) == OP_CALL);
goto newframe; /* restart luaV_execute over new Lua function */
}
}
vmcase(OP_FORLOOP) {
if (ttisinteger(ra)) { /* integer loop? */
lua_Integer step = ivalue(ra + 2);
lua_Integer idx = intop(+, ivalue(ra), step); /* increment index */
lua_Integer limit = ivalue(ra + 1);
if ((0 < step) ? (idx <= limit) : (limit <= idx)) {
ci->u.l.savedpc += GETARG_sBx(i); /* jump back */
chgivalue(ra, idx); /* update internal index... */
setivalue(ra + 3, idx); /* ...and external index */
}
}
else { /* floating loop */
lua_Number step = fltvalue(ra + 2);
lua_Number idx = luai_numadd(L, fltvalue(ra), step); /* inc. index */
lua_Number limit = fltvalue(ra + 1);
if (luai_numlt(0, step) ? luai_numle(idx, limit)
: luai_numle(limit, idx)) {
ci->u.l.savedpc += GETARG_sBx(i); /* jump back */
chgfltvalue(ra, idx); /* update internal index... */
setfltvalue(ra + 3, idx); /* ...and external index */
}
}
vmbreak;
}
vmcase(OP_FORPREP) {
TValue *init = ra;
TValue *plimit = ra + 1;
TValue *pstep = ra + 2;
lua_Integer ilimit;
int stopnow;
if (ttisinteger(init) && ttisinteger(pstep) &&
forlimit(plimit, &ilimit, ivalue(pstep), &stopnow)) {
/* all values are integer */
lua_Integer initv = (stopnow ? 0 : ivalue(init));
setivalue(plimit, ilimit);
setivalue(init, intop(-, initv, ivalue(pstep)));
}
else { /* try making all values floats */
lua_Number ninit; lua_Number nlimit; lua_Number nstep;
if (!tonumber(plimit, &nlimit))
luaG_runerror(L, "'for' limit must be a number");
setfltvalue(plimit, nlimit);
if (!tonumber(pstep, &nstep))
luaG_runerror(L, "'for' step must be a number");
setfltvalue(pstep, nstep);
if (!tonumber(init, &ninit))
luaG_runerror(L, "'for' initial value must be a number");
setfltvalue(init, luai_numsub(L, ninit, nstep));
}
ci->u.l.savedpc += GETARG_sBx(i);
vmbreak;
}
vmcase(OP_TFORCALL) {
StkId cb = ra + 3; /* call base */
setobjs2s(L, cb+2, ra+2);
setobjs2s(L, cb+1, ra+1);
setobjs2s(L, cb, ra);
L->top = cb + 3; /* func. + 2 args (state and index) */
Protect(luaD_call(L, cb, GETARG_C(i)));
L->top = ci->top;
i = *(ci->u.l.savedpc++); /* go to next instruction */
ra = RA(i);
lua_assert(GET_OPCODE(i) == OP_TFORLOOP);
goto l_tforloop;
}
vmcase(OP_TFORLOOP) {
l_tforloop:
if (!ttisnil(ra + 1)) { /* continue loop? */
setobjs2s(L, ra, ra + 1); /* save control variable */
ci->u.l.savedpc += GETARG_sBx(i); /* jump back */
}
vmbreak;
}
vmcase(OP_SETLIST) {
int n = GETARG_B(i);
int c = GETARG_C(i);
unsigned int last;
Table *h;
if (n == 0) n = cast_int(L->top - ra) - 1;
if (c == 0) {
lua_assert(GET_OPCODE(*ci->u.l.savedpc) == OP_EXTRAARG);
c = GETARG_Ax(*ci->u.l.savedpc++);
}
h = hvalue(ra);
last = ((c-1)*LFIELDS_PER_FLUSH) + n;
if (last > h->sizearray) /* needs more space? */
luaH_resizearray(L, h, last); /* preallocate it at once */
for (; n > 0; n--) {
TValue *val = ra+n;
luaH_setint(L, h, last--, val);
luaC_barrierback(L, h, val);
}
L->top = ci->top; /* correct top (in case of previous open call) */
vmbreak;
}
vmcase(OP_CLOSURE) {
Proto *p = cl->p->p[GETARG_Bx(i)];
LClosure *ncl = getcached(p, cl->upvals, base); /* cached closure */
if (ncl == NULL) /* no match? */
pushclosure(L, p, cl->upvals, base, ra); /* create a new one */
else
setclLvalue(L, ra, ncl); /* push cashed closure */
checkGC(L, ra + 1);
vmbreak;
}
vmcase(OP_VARARG) {
int b = GETARG_B(i) - 1; /* required results */
int j;
int n = cast_int(base - ci->func) - cl->p->numparams - 1;
if (n < 0) /* less arguments than parameters? */
n = 0; /* no vararg arguments */
if (b < 0) { /* B == 0? */
b = n; /* get all var. arguments */
Protect(luaD_checkstack(L, n));
ra = RA(i); /* previous call may change the stack */
L->top = ra + n;
}
for (j = 0; j < b && j < n; j++)
setobjs2s(L, ra + j, base - n + j);
for (; j < b; j++) /* complete required results with nil */
setnilvalue(ra + j);
vmbreak;
}
vmcase(OP_EXTRAARG) {
lua_assert(0);
vmbreak;
}
}
}
}
/* }================================================================== */
| {
"pile_set_name": "Github"
} |
//===----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
// <utility>
// template <class T>
// typename conditional
// <
// !is_nothrow_move_constructible<T>::value && is_copy_constructible<T>::value,
// const T&,
// T&&
// >::type
// move_if_noexcept(T& x);
#include <utility>
#include "test_macros.h"
class A
{
A(const A&);
A& operator=(const A&);
public:
A() {}
A(A&&) {}
};
struct legacy
{
legacy() {}
legacy(const legacy&);
};
int main(int, char**)
{
int i = 0;
const int ci = 0;
legacy l;
A a;
const A ca;
#if TEST_STD_VER >= 11
static_assert((std::is_same<decltype(std::move_if_noexcept(i)), int&&>::value), "");
static_assert((std::is_same<decltype(std::move_if_noexcept(ci)), const int&&>::value), "");
static_assert((std::is_same<decltype(std::move_if_noexcept(a)), A&&>::value), "");
static_assert((std::is_same<decltype(std::move_if_noexcept(ca)), const A&&>::value), "");
static_assert((std::is_same<decltype(std::move_if_noexcept(l)), const legacy&>::value), "");
#else // C++ < 11
// In C++03 we don't have noexcept so we can never move :-(
static_assert((std::is_same<decltype(std::move_if_noexcept(i)), const int&>::value), "");
static_assert((std::is_same<decltype(std::move_if_noexcept(ci)), const int&>::value), "");
static_assert((std::is_same<decltype(std::move_if_noexcept(a)), const A&>::value), "");
static_assert((std::is_same<decltype(std::move_if_noexcept(ca)), const A&>::value), "");
static_assert((std::is_same<decltype(std::move_if_noexcept(l)), const legacy&>::value), "");
#endif
#if TEST_STD_VER > 11
constexpr int i1 = 23;
constexpr int i2 = std::move_if_noexcept(i1);
static_assert(i2 == 23, "" );
#endif
return 0;
}
| {
"pile_set_name": "Github"
} |
<?php
namespace Oro\Bundle\TagBundle\Tests\Unit\Entity;
use Oro\Bundle\TagBundle\Entity\Tagging;
class TaggingTest extends \PHPUnit\Framework\TestCase
{
/**
* @var Tagging
*/
protected $tagging;
protected function setUp(): void
{
$this->tagging = new Tagging();
}
public function testSetGetUserMethods()
{
$user = $this->createMock('Oro\Bundle\UserBundle\Entity\User');
$this->tagging->setOwner($user);
$this->assertEquals($user, $this->tagging->getOwner());
}
public function testSetGetTagMethods()
{
$tag = $this->createMock('Oro\Bundle\TagBundle\Entity\Tag');
$this->tagging->setTag($tag);
$this->assertEquals($tag, $this->tagging->getTag());
// test pass tag through constructor
$tagging = new Tagging($tag);
$this->assertEquals($tag, $tagging->getTag());
}
public function testSetGetResourceMethods()
{
$resource = $this->getMockForAbstractClass('Oro\Bundle\TagBundle\Entity\Taggable');
$resource->expects($this->exactly(2))
->method('getTaggableId')
->will($this->returnValue(1));
$this->tagging->setResource($resource);
$this->assertEquals(1, $this->tagging->getRecordId());
$this->assertEquals(get_class($resource), $this->tagging->getEntityName());
// test pass resource through constructor
$tagging = new Tagging(null, $resource);
$this->assertEquals(1, $tagging->getRecordId());
$this->assertEquals(get_class($resource), $tagging->getEntityName());
}
public function testDateTimeMethods()
{
$timeCreated = new \DateTime('now');
$this->tagging->setCreated($timeCreated);
$this->assertEquals($timeCreated, $this->tagging->getCreated());
}
}
| {
"pile_set_name": "Github"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.