text
stringlengths 2
100k
| meta
dict |
---|---|
function popup(url) {
newwindow=window.open(url,'name','height=400,width=600');
if (window.focus) newwindow.focus();
return false;
}
function collapse(id) { jQuery('#'+id).slideToggle(); }
function fade(id,value) { if(value>0) jQuery('#'+id).hide().fadeIn('slow'); else jQuery('#'+id).show().fadeOut('slow'); }
function ajax(u,s,t) {
query = '';
if (typeof s == "string") {
d = jQuery(s).serialize();
if(d){ query = d; }
} else {
pcs = [];
for(i=0; i<s.length; i++) {
q = jQuery("[name="+s[i]+"]").serialize();
if(q){pcs.push(q);}
}
if (pcs.length>0){query = pcs.join("&");}
}
jQuery.ajax({type: "POST", url: u, data: query, success: function(msg) { if(t) { if(t==':eval') eval(msg); else jQuery("#" + t).html(msg); } } });
}
String.prototype.reverse = function () { return this.split('').reverse().join('');};
function web2py_ajax_init() {
jQuery('.hidden').hide();
jQuery('.error').hide().slideDown('slow');
jQuery('.flash').click(function(e) { jQuery(this).fadeOut('slow'); e.preventDefault(); });
// jQuery('input[type=submit]').click(function(){var t=jQuery(this);t.hide();t.after('<input class="submit_disabled" disabled="disabled" type="submit" name="'+t.attr("name")+'_dummy" value="'+t.val()+'">')});
jQuery('input.integer').live('keyup', function(){this.value=this.value.reverse().replace(/[^0-9\-]|\-(?=.)/g,'').reverse();});
jQuery('input.double,input.decimal').live('keyup', function(){this.value=this.value.reverse().replace(/[^0-9\-\.,]|[\-](?=.)|[\.,](?=[0-9]*[\.,])/g,'').reverse();});
var confirm_message = (typeof w2p_ajax_confirm_message != 'undefined') ? w2p_ajax_confirm_message : "Are you sure you want to delete this object?";
jQuery("input[type='checkbox'].delete").live('click', function(){ if(this.checked) if(!confirm(confirm_message)) this.checked=false; });
var date_format = (typeof w2p_ajax_date_format != 'undefined') ? w2p_ajax_date_format : "%Y-%m-%d";
var datetime_format = (typeof w2p_ajax_datetime_format != 'undefined') ? w2p_ajax_datetime_format : "%Y-%m-%d %H:%M:%S";
try {
jQuery("input.datetime").AnyTime_picker({
format: datetime_format.replace('%M','%i')});
jQuery("input.date").AnyTime_picker({
format: date_format.replace('%M','%i')});
jQuery("input.time").AnyTime_picker({
format: "%H:%i:%S"});
} catch(e) {};
};
jQuery(function() {
var flash = jQuery('.flash');
flash.hide();
if(flash.html()) flash.slideDown();
web2py_ajax_init();
});
function web2py_trap_form(action,target) {
jQuery('#'+target+' form').each(function(i){
var form=jQuery(this);
if(!form.hasClass('no_trap'))
form.submit(function(e){
jQuery('.flash').hide().html('');
web2py_ajax_page('post',action,form.serialize(),target);
e.preventDefault();
});
});
}
function web2py_ajax_page(method,action,data,target) {
jQuery.ajax({'type':method,'url':action,'data':data,
'beforeSend':function(xhr) {
xhr.setRequestHeader('web2py-component-location',document.location);
xhr.setRequestHeader('web2py-component-element',target);},
'complete':function(xhr,text){
var html=xhr.responseText;
var content=xhr.getResponseHeader('web2py-component-content');
var command=xhr.getResponseHeader('web2py-component-command');
var flash=xhr.getResponseHeader('web2py-component-flash');
var t = jQuery('#'+target);
if(content=='prepend') t.prepend(html);
else if(content=='append') t.append(html);
else if(content!='hide') t.html(html);
web2py_trap_form(action,target);
web2py_ajax_init();
if(command) eval(command);
if(flash) jQuery('.flash').html(flash).slideDown();
}
});
}
function web2py_component(action,target) {
jQuery(function(){ web2py_ajax_page('get',action,null,target); });
}
function web2py_comet(url,onmessage,onopen,onclose) {
if ("WebSocket" in window) {
var ws = new WebSocket(url);
ws.onopen = onopen?onopen:(function(){});
ws.onmessage = onmessage;
ws.onclose = onclose?onclose:(function(){});
return true; // supported
} else return false; // not supported
}
| {
"pile_set_name": "Github"
} |
/*
* Copyright (C) 2019 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.
*/
package com.android.systemui.qs.tileimpl
import android.testing.AndroidTestingRunner
import androidx.test.filters.SmallTest
import com.android.systemui.SysuiTestCase
import org.junit.Assert.assertEquals
import org.junit.Test
import org.junit.runner.RunWith
@RunWith(AndroidTestingRunner::class)
@SmallTest
class ResourceIconTest : SysuiTestCase() {
val resIds = (1..1000).toList()
@Test
fun testMultipleThreadedPut() {
resIds.parallelStream().forEach {
QSTileImpl.ResourceIcon.get(it)
}
resIds.forEach {
assertEquals(it, (QSTileImpl.ResourceIcon.get(it) as QSTileImpl.ResourceIcon).mResId)
}
}
}
| {
"pile_set_name": "Github"
} |
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="" xml:lang="">
<head>
<title>Page 63</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<style type="text/css">
<!--
p {margin: 0; padding: 0;} .ft00{font-size:9px;font-family:Times;color:#000000;}
.ft01{font-size:11px;font-family:Times;color:#0860a8;}
.ft02{font-size:16px;font-family:Times;color:#0860a8;}
.ft03{font-size:11px;font-family:Times;color:#000000;}
.ft04{font-size:18px;font-family:Times;color:#000000;}
.ft05{font-size:11px;font-family:Times;color:#000000;}
.ft06{font-size:11px;font-family:Times;color:#000000;}
.ft07{font-size:11px;line-height:16px;font-family:Times;color:#000000;}
.ft08{font-size:11px;line-height:20px;font-family:Times;color:#000000;}
.ft09{font-size:11px;line-height:21px;font-family:Times;color:#000000;}
-->
</style>
</head>
<body bgcolor="#A0A0A0" vlink="blue" link="blue">
<div id="page63-div" style="position:relative;width:918px;height:1188px;">
<img width="918" height="1188" src="o_b5573232dd8f1481063.png" alt="background image"/>
<p style="position:absolute;top:1103px;left:774px;white-space:nowrap" class="ft00">Vol. 2A 2-3</p>
<p style="position:absolute;top:47px;left:706px;white-space:nowrap" class="ft01">INSTRUCTION FORMAT</p>
<p style="position:absolute;top:98px;left:69px;white-space:nowrap" class="ft02">2.1.2 Opcodes</p>
<p style="position:absolute;top:126px;left:69px;white-space:nowrap" class="ft08">A primary opcode can be 1, 2, or 3 bytes in length. An additional 3-bit opcode field is sometimes encoded in the <br/>ModR/M byte. Smaller fields can be defined within the primary opcode. Such fields define the direction of opera-<br/>tion, size of displacements, register encoding, condition codes, or sign extension. Encoding fields used by an <br/>opcode vary depending on the class of operation.<br/>Two-byte opcode formats for general-purpose and SIMD instructions consist of one of the following: </p>
<p style="position:absolute;top:218px;left:69px;white-space:nowrap" class="ft04">•</p>
<p style="position:absolute;top:219px;left:95px;white-space:nowrap" class="ft03">An escape opcode byte 0FH as the primary opcode and a second opcode byte.</p>
<p style="position:absolute;top:241px;left:69px;white-space:nowrap" class="ft04">•</p>
<p style="position:absolute;top:241px;left:95px;white-space:nowrap" class="ft07">A mandatory prefix (66H, F2H, or F3H), an escape opcode byte, and a second opcode byte (same as previous <br/>bullet).</p>
<p style="position:absolute;top:279px;left:69px;white-space:nowrap" class="ft09">For example, CVTDQ2PD consists of the following sequence: F3 0F E6. The first byte is a mandatory prefix (it is not <br/>considered as a repeat prefix). <br/>Three-byte opcode formats for general-purpose and SIMD instructions consist of one of the following: </p>
<p style="position:absolute;top:338px;left:69px;white-space:nowrap" class="ft04">•</p>
<p style="position:absolute;top:339px;left:95px;white-space:nowrap" class="ft03">An escape opcode byte 0FH as the primary opcode, plus two additional opcode bytes.</p>
<p style="position:absolute;top:361px;left:69px;white-space:nowrap" class="ft04">•</p>
<p style="position:absolute;top:361px;left:95px;white-space:nowrap" class="ft07">A mandatory prefix (66H, F2H, or F3H), an escape opcode byte, plus two additional opcode bytes (same as <br/>previous bullet).</p>
<p style="position:absolute;top:399px;left:69px;white-space:nowrap" class="ft08">For example, PHADDW for XMM registers consists of the following sequence: 66 0F 38 01. The first byte is the <br/>mandatory prefix.<br/>Valid opcode expressions are defined in Appendix A and Appendix B.</p>
<p style="position:absolute;top:487px;left:69px;white-space:nowrap" class="ft02">2.1.3 </p>
<p style="position:absolute;top:487px;left:149px;white-space:nowrap" class="ft02">ModR/M and SIB Bytes</p>
<p style="position:absolute;top:514px;left:69px;white-space:nowrap" class="ft07">Many instructions that refer to an operand in memory have an addressing-form specifier byte (called the ModR/M <br/>byte) following the primary opcode. The ModR/M byte contains three fields of information:</p>
<p style="position:absolute;top:553px;left:69px;white-space:nowrap" class="ft04">•</p>
<p style="position:absolute;top:553px;left:95px;white-space:nowrap" class="ft03">The <i>mod</i> field combines with the r/m field to form 32 possible values: eight registers and 24 addressing modes.</p>
<p style="position:absolute;top:575px;left:69px;white-space:nowrap" class="ft04">•</p>
<p style="position:absolute;top:576px;left:95px;white-space:nowrap" class="ft07">The <i>reg/opcode</i> field specifies either a register number or three more bits of opcode information. The purpose <br/>of the reg/opcode field is specified in the primary opcode.</p>
<p style="position:absolute;top:614px;left:69px;white-space:nowrap" class="ft04">•</p>
<p style="position:absolute;top:615px;left:95px;white-space:nowrap" class="ft07">The <i>r/m</i> field can specify a register as an operand or it can be combined with the mod field to encode an <br/>addressing mode. Sometimes, certain combinations of the <i>mod</i> field and the <i>r/m</i> field are used to express <br/>opcode information for some instructions.</p>
<p style="position:absolute;top:669px;left:69px;white-space:nowrap" class="ft07">Certain encodings of the ModR/M byte require a second addressing byte (the SIB byte). The base-plus-index and <br/>scale-plus-index forms of 32-bit addressing require the SIB byte. The SIB byte includes the following fields:</p>
<p style="position:absolute;top:707px;left:69px;white-space:nowrap" class="ft04">•</p>
<p style="position:absolute;top:708px;left:95px;white-space:nowrap" class="ft03">The <i>scale</i><b> </b>field specifies the scale factor.</p>
<p style="position:absolute;top:730px;left:69px;white-space:nowrap" class="ft04">•</p>
<p style="position:absolute;top:730px;left:95px;white-space:nowrap" class="ft03">The <i>index</i> field specifies the register number of the index register.</p>
<p style="position:absolute;top:752px;left:69px;white-space:nowrap" class="ft04">•</p>
<p style="position:absolute;top:753px;left:95px;white-space:nowrap" class="ft03">The <i>base</i> field specifies the register number of the base register.</p>
<p style="position:absolute;top:774px;left:69px;white-space:nowrap" class="ft03">Se<a href="o_b5573232dd8f1481-64.html">e Section 2.1.5 </a>for the encodings of the ModR/M and SIB bytes.</p>
<p style="position:absolute;top:824px;left:69px;white-space:nowrap" class="ft02">2.1.4 </p>
<p style="position:absolute;top:824px;left:150px;white-space:nowrap" class="ft02">Displacement and Immediate Bytes</p>
<p style="position:absolute;top:852px;left:69px;white-space:nowrap" class="ft07">Some addressing forms include a displacement immediately following the ModR/M byte (or the SIB byte if one is <br/>present). If a displacement is required, it can be 1, 2, or 4 bytes.<br/>If an instruction specifies an immediate operand, the operand always follows any displacement bytes. An imme-<br/>diate operand can be 1, 2 or 4 bytes.</p>
</div>
</body>
</html>
| {
"pile_set_name": "Github"
} |
#!/bin/sh
# Title: install script
# Description: the install script is responsible for installing the Web
# application, which includes exploding the WAR file in the correct directory,
# creating the photos directory if it does not exists, the putting the
# archived photos back into the directory.
#
echo "Starting install script..."
echo "Ending install script."
# exit with a successful exit code
exit 0
| {
"pile_set_name": "Github"
} |
//===-- llvm/Target/TargetOpcodes.h - Target Indep Opcodes ------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file defines the target independent instruction opcodes.
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_TARGET_TARGETOPCODES_H
#define LLVM_TARGET_TARGETOPCODES_H
namespace llvm {
/// Invariant opcodes: All instruction sets have these as their low opcodes.
///
/// Every instruction defined here must also appear in Target.td and the order
/// must be the same as in CodeGenTarget.cpp.
///
namespace TargetOpcode {
enum {
PHI = 0,
INLINEASM = 1,
CFI_INSTRUCTION = 2,
EH_LABEL = 3,
GC_LABEL = 4,
/// KILL - This instruction is a noop that is used only to adjust the
/// liveness of registers. This can be useful when dealing with
/// sub-registers.
KILL = 5,
/// EXTRACT_SUBREG - This instruction takes two operands: a register
/// that has subregisters, and a subregister index. It returns the
/// extracted subregister value. This is commonly used to implement
/// truncation operations on target architectures which support it.
EXTRACT_SUBREG = 6,
/// INSERT_SUBREG - This instruction takes three operands: a register that
/// has subregisters, a register providing an insert value, and a
/// subregister index. It returns the value of the first register with the
/// value of the second register inserted. The first register is often
/// defined by an IMPLICIT_DEF, because it is commonly used to implement
/// anyext operations on target architectures which support it.
INSERT_SUBREG = 7,
/// IMPLICIT_DEF - This is the MachineInstr-level equivalent of undef.
IMPLICIT_DEF = 8,
/// SUBREG_TO_REG - This instruction is similar to INSERT_SUBREG except that
/// the first operand is an immediate integer constant. This constant is
/// often zero, because it is commonly used to assert that the instruction
/// defining the register implicitly clears the high bits.
SUBREG_TO_REG = 9,
/// COPY_TO_REGCLASS - This instruction is a placeholder for a plain
/// register-to-register copy into a specific register class. This is only
/// used between instruction selection and MachineInstr creation, before
/// virtual registers have been created for all the instructions, and it's
/// only needed in cases where the register classes implied by the
/// instructions are insufficient. It is emitted as a COPY MachineInstr.
COPY_TO_REGCLASS = 10,
/// DBG_VALUE - a mapping of the llvm.dbg.value intrinsic
DBG_VALUE = 11,
/// REG_SEQUENCE - This variadic instruction is used to form a register that
/// represents a consecutive sequence of sub-registers. It's used as a
/// register coalescing / allocation aid and must be eliminated before code
/// emission.
// In SDNode form, the first operand encodes the register class created by
// the REG_SEQUENCE, while each subsequent pair names a vreg + subreg index
// pair. Once it has been lowered to a MachineInstr, the regclass operand
// is no longer present.
/// e.g. v1027 = REG_SEQUENCE v1024, 3, v1025, 4, v1026, 5
/// After register coalescing references of v1024 should be replace with
/// v1027:3, v1025 with v1027:4, etc.
REG_SEQUENCE = 12,
/// COPY - Target-independent register copy. This instruction can also be
/// used to copy between subregisters of virtual registers.
COPY = 13,
/// BUNDLE - This instruction represents an instruction bundle. Instructions
/// which immediately follow a BUNDLE instruction which are marked with
/// 'InsideBundle' flag are inside the bundle.
BUNDLE = 14,
/// Lifetime markers.
LIFETIME_START = 15,
LIFETIME_END = 16,
/// A Stackmap instruction captures the location of live variables at its
/// position in the instruction stream. It is followed by a shadow of bytes
/// that must lie within the function and not contain another stackmap.
STACKMAP = 17,
/// Patchable call instruction - this instruction represents a call to a
/// constant address, followed by a series of NOPs. It is intended to
/// support optimizations for dynamic languages (such as javascript) that
/// rewrite calls to runtimes with more efficient code sequences.
/// This also implies a stack map.
PATCHPOINT = 18
};
} // end namespace TargetOpcode
} // end namespace llvm
#endif
| {
"pile_set_name": "Github"
} |
/*
* Copyright (c) 2014, Peter Thorson. 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 WebSocket++ Project 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 PETER THORSON 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.
*
*/
#ifndef WEBSOCKETPP_RANDOM_NONE_HPP
#define WEBSOCKETPP_RANDOM_NONE_HPP
namespace websocketpp {
/// Random number generation policies
namespace random {
/// Stub RNG policy that always returns 0
namespace none {
/// Thread safe stub "random" integer generator.
/**
* This template class provides a random integer stub. The interface mimics the
* WebSocket++ RNG generator classes but the generater function always returns
* zero. This can be used to stub out the RNG for unit and performance testing.
*
* Call operator() to generate the next number
*/
template <typename int_type>
class int_generator {
public:
int_generator() {}
/// advances the engine's state and returns the generated value
int_type operator()() {
return 0;
}
};
} // namespace none
} // namespace random
} // namespace websocketpp
#endif //WEBSOCKETPP_RANDOM_NONE_HPP
| {
"pile_set_name": "Github"
} |
# Generated by devtools/yamaker.
PROGRAM()
PEERDIR(
contrib/restricted/libffi
)
NO_COMPILER_WARNINGS()
NO_RUNTIME()
SRCDIR(contrib/restricted/libffi/testsuite/libffi.complex)
SRCS(
return_complex2_float.c
)
END()
| {
"pile_set_name": "Github"
} |
{
"_from": "[email protected]",
"_id": "[email protected]",
"_inBundle": false,
"_integrity": "sha512-d7jU5ZcMiTfBqTUJVZ3xid44fE5ERBm9vBnmhp2ECD2Ls+FNXWxHSkO7gtvrnbLO78gwPdNPz1HpsF3W4rjkBQ==",
"_location": "/libnpm",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "[email protected]",
"name": "libnpm",
"escapedName": "libnpm",
"rawSpec": "3.0.1",
"saveSpec": null,
"fetchSpec": "3.0.1"
},
"_requiredBy": [
"#USER",
"/"
],
"_resolved": "https://registry.npmjs.org/libnpm/-/libnpm-3.0.1.tgz",
"_shasum": "0be11b4c9dd4d1ffd7d95c786e92e55d65be77a2",
"_spec": "[email protected]",
"_where": "/Users/isaacs/dev/npm/cli",
"author": {
"name": "Kat Marchán",
"email": "[email protected]"
},
"bugs": {
"url": "https://github.com/npm/libnpm/issues"
},
"bundleDependencies": false,
"dependencies": {
"bin-links": "^1.1.2",
"bluebird": "^3.5.3",
"find-npm-prefix": "^1.0.2",
"libnpmaccess": "^3.0.2",
"libnpmconfig": "^1.2.1",
"libnpmhook": "^5.0.3",
"libnpmorg": "^1.0.1",
"libnpmpublish": "^1.1.2",
"libnpmsearch": "^2.0.2",
"libnpmteam": "^1.0.2",
"lock-verify": "^2.0.2",
"npm-lifecycle": "^3.0.0",
"npm-logical-tree": "^1.2.1",
"npm-package-arg": "^6.1.0",
"npm-profile": "^4.0.2",
"npm-registry-fetch": "^4.0.0",
"npmlog": "^4.1.2",
"pacote": "^9.5.3",
"read-package-json": "^2.0.13",
"stringify-package": "^1.0.0"
},
"deprecated": false,
"description": "Collection of programmatic APIs for the npm CLI",
"devDependencies": {
"nock": "^9.2.3",
"standard": "^11.0.1",
"standard-version": "^4.3.0",
"tap": "^12.0.1",
"weallbehave": "^1.2.0",
"weallcontribute": "^1.0.8"
},
"files": [
"*.js",
"lib"
],
"homepage": "https://github.com/npm/libnpm#readme",
"keywords": [
"npm",
"api",
"package manager",
"lib"
],
"license": "ISC",
"main": "index.js",
"name": "libnpm",
"repository": {
"type": "git",
"url": "git+https://github.com/npm/libnpm.git"
},
"scripts": {
"postrelease": "npm publish && git push --follow-tags",
"prerelease": "npm t",
"pretest": "standard",
"release": "standard-version -s",
"test": "tap -J --coverage test/*.js",
"update-coc": "weallbehave -o . && git add CODE_OF_CONDUCT.md && git commit -m 'docs(coc): updated CODE_OF_CONDUCT.md'",
"update-contrib": "weallcontribute -o . && git add CONTRIBUTING.md && git commit -m 'docs(contributing): updated CONTRIBUTING.md'"
},
"version": "3.0.1"
}
| {
"pile_set_name": "Github"
} |
#p-resources {
margin-bottom: 100px;
}
| {
"pile_set_name": "Github"
} |
// 3D code partially grabbed from http://dev.opera.com/articles/view/porting-3d-graphics-to-the-web-webgl-intro-part-2/
// Cribbed from three.js's class of the same name and updated to use pointer
// lock.
OrbitControls = function(object, domElement) {
THREE.EventTarget.call(this);
this.object = object;
this.domElement = domElement;
// API
this.center = new THREE.Vector3();
this.userZoom = true;
this.userZoomSpeed = 1.0;
this.userRotate = true;
this.userRotateSpeed = 1.0;
this.autoRotate = false;
this.autoRotateSpeed = 2.0; // 30 seconds per round when fps is 60
// internals
var scope = this;
var EPS = 0.000001;
var PIXELS_PER_ROUND = 1800;
var rotateStart = new THREE.Vector2();
var rotateEnd = new THREE.Vector2();
var rotateDelta = new THREE.Vector2();
var zoomStart = new THREE.Vector2();
var zoomEnd = new THREE.Vector2();
var zoomDelta = new THREE.Vector2();
var phiDelta = 0;
var thetaDelta = 0;
var scale = 1;
var lastPosition = new THREE.Vector3();
var STATE = { NONE : -1, ROTATE : 0, ZOOM : 1 };
var state = STATE.NONE;
// events
var changeEvent = { type: 'change' };
this.rotateLeft = function(angle) {
if (angle === undefined) {
angle = getAutoRotationAngle();
}
thetaDelta -= angle;
};
this.rotateRight = function(angle) {
if (angle === undefined) {
angle = getAutoRotationAngle();
}
thetaDelta += angle;
};
this.rotateUp = function(angle) {
if (angle === undefined) {
angle = getAutoRotationAngle();
}
phiDelta -= angle;
};
this.rotateDown = function(angle) {
if (angle === undefined) {
angle = getAutoRotationAngle();
}
phiDelta += angle;
};
this.zoomIn = function(zoomScale) {
if (zoomScale === undefined) {
zoomScale = getZoomScale();
}
scale /= zoomScale;
};
this.zoomOut = function(zoomScale) {
if (zoomScale === undefined) {
zoomScale = getZoomScale();
}
scale *= zoomScale;
};
this.update = function() {
var position = this.object.position;
var offset = position.clone().subSelf(this.center)
// angle from z-axis around y-axis
var theta = Math.atan2(offset.x, offset.z);
// angle from y-axis
var phi = Math.atan2(Math.sqrt(offset.x * offset.x + offset.z * offset.z), offset.y);
if (this.autoRotate) {
this.rotateLeft(getAutoRotationAngle());
}
theta += thetaDelta;
phi += phiDelta;
// restrict phi to be betwee EPS and PI-EPS
phi = Math.max(EPS, Math.min(Math.PI - EPS, phi));
var radius = offset.length();
offset.x = radius * Math.sin(phi) * Math.sin(theta);
offset.y = radius * Math.cos(phi);
offset.z = radius * Math.sin(phi) * Math.cos(theta);
offset.multiplyScalar(scale);
position.copy(this.center).addSelf(offset);
this.object.lookAt(this.center);
thetaDelta = 0;
phiDelta = 0;
scale = 1;
if (lastPosition.distanceTo(this.object.position) > 0) {
this.dispatchEvent(changeEvent);
lastPosition.copy(this.object.position);
}
};
function getAutoRotationAngle() {
return 2 * Math.PI / 60 / 60 * scope.autoRotateSpeed;
}
function getZoomScale() {
return Math.pow(0.95, scope.userZoomSpeed);
}
function onMouseDown(event) {
if (!scope.userRotate) return;
event.preventDefault();
if (event.button === 0 || event.button === 2) {
state = STATE.ROTATE;
rotateStart.set(event.clientX, event.clientY);
rotateEnd.set(event.clientX, event.clientY);
} else if (event.button === 1) {
state = STATE.ZOOM;
zoomStart.set(event.clientX, event.clientY);
zoomEnd.set(event.clientX, event.clientY);
}
scope.domElement.requestPointerLock =
scope.domElement.requestPointerLock ||
scope.domElement.mozRequestPointerLock ||
scope.domElement.webkitRequestPointerLock;
scope.domElement.requestPointerLock();
document.addEventListener('mousemove', onMouseMove, false);
document.addEventListener('mouseup', onMouseUp, false);
}
function onMouseMove(event) {
event.preventDefault();
if (state === STATE.ROTATE) {
rotateEnd.addSelf({
x: event.movementX || event.webkitMovementX || 0,
y: event.movementY || event.webkitMovementY || 0
});
rotateDelta.sub(rotateEnd, rotateStart);
scope.rotateLeft(2 * Math.PI * rotateDelta.x / PIXELS_PER_ROUND * scope.userRotateSpeed);
scope.rotateUp(2 * Math.PI * rotateDelta.y / PIXELS_PER_ROUND * scope.userRotateSpeed);
rotateStart.copy(rotateEnd);
} else if (state === STATE.ZOOM) {
zoomEnd.addSelf({
x: event.movementX || event.webkitMovementX || 0,
y: event.movementY || event.webkitMovementY || 0
});
zoomDelta.sub(zoomEnd, zoomStart);
if (zoomDelta.y > 0) {
scope.zoomIn();
} else {
scope.zoomOut();
}
zoomStart.copy(zoomEnd);
}
}
function onMouseUp(event) {
if (!scope.userRotate) return;
document.removeEventListener('mousemove', onMouseMove, false);
document.removeEventListener('mouseup', onMouseUp, false);
state = STATE.NONE;
document.exitPointerLock =
document.exitPointerLock ||
document.mozExitPointerLock ||
document.webkitExitPointerLock;
document.exitPointerLock();
}
function onMouseWheel(event) {
if (!scope.userZoom) return;
if (event.wheelDelta > 0) {
scope.zoomOut();
} else {
scope.zoomIn();
}
}
this.domElement.addEventListener('contextmenu', function(event) { event.preventDefault(); }, false);
this.domElement.addEventListener('mousedown', onMouseDown, false);
this.domElement.addEventListener('mousewheel', onMouseWheel, false);
};
document.addEventListener('DOMContentLoaded', function() {
if (!Detector.webgl) Detector.addGetWebGLMessage();
var SCREEN_WIDTH = window.innerWidth;
var SCREEN_HEIGHT = window.innerHeight;
var FLOOR = 0;
var container;
//var camera, scene, controls;
var webglRenderer;
var zmesh, geometry;
var mouseX = 0, mouseY = 0;
var windowHalfX = window.innerWidth / 2;
var windowHalfY = window.innerHeight / 2;
init();
animate();
function init() {
var closeEl=document.querySelector(".close");
console.log(closeEl);
if (closeEl) {
closeEl.addEventListener('click', function() {
window.close();
});
closeEl.addEventListener('mousedown', function(e) {
e.stopPropagation();
});
};
container = document.createElement('div');
document.body.appendChild(container);
// camera
camera = new THREE.PerspectiveCamera(75, SCREEN_WIDTH / SCREEN_HEIGHT, 1, 100000);
camera.position.z = 75;
//scene
scene = new THREE.Scene();
// lights
var ambient = new THREE.AmbientLight(0xffffff);
scene.add(ambient);
// more lights
var directionalLight = new THREE.DirectionalLight(0xffeedd);
directionalLight.position.set(0, -70, 100).normalize();
scene.add(directionalLight);
// renderer
webglRenderer = new THREE.WebGLRenderer();
webglRenderer.setSize(SCREEN_WIDTH, SCREEN_HEIGHT);
webglRenderer.domElement.style.position = "relative";
container.appendChild(webglRenderer.domElement);
// load ascii model
var jsonLoader = new THREE.JSONLoader();
jsonLoader.load("obj/html5rocks.js", function(geometry) { createScene(geometry) });
controls = new OrbitControls(camera, container);
controls.autoRotate = true;
}
function createScene(geometry) {
zmesh = new THREE.Mesh(geometry, new THREE.MeshFaceMaterial());
zmesh.position.set(-10, -10, 0);
zmesh.scale.set(1, 1, 1);
scene.add(zmesh);
}
function onDocumentMouseDown(event) {
if (event.button !== 0)
return;
document.body.requestPointerLock =
document.body.requestPointerLock ||
document.body.mozRequestPointerLock ||
document.body.webkitRequestPointerLock;
document.body.requestPointerLock();
}
function onDocumentMouseUp(event) {
document.exitPointerLock =
document.exitPointerLock ||
document.mozExitPointerLock ||
document.webkitExitPointerLock;
document.exitPointerLock();
}
function onDocumentMouseWheel(event) {
camera.position.z -= event.wheelDelta/120*3;
}
function onDocumentMouseMove(event) {
if (!event.which) return;
document.pointerLockElement =
document.pointerLockElement ||
document.mozPointerLockElement ||
document.webkitPointerLockElement;
if (document.pointerLockElement) {
mouseX += event.movementX || event.mozMovementX || event.webkitMovementX || 0;
mouseY += event.movementY || event.mozMovementY || event.webkitMovementY || 0;
}
}
function animate() {
requestAnimationFrame(animate);
render();
}
function render() {
controls.update();
webglRenderer.render(scene, camera);
}
});
| {
"pile_set_name": "Github"
} |
/**
* (c) 2009-2020 Highsoft AS
*
* License: www.highcharts.com/license
* For commercial usage, a valid license is required. To purchase a license for Highcharts iOS, please see our website: https://shop.highsoft.com/
* In case of questions, please contact [email protected]
*/
#import "HISeries.h"
#import "HILevelSize.h"
#import "HITraverseUpButton.h"
#import "HILevels.h"
#import "HIColor.h"
/**
A `sunburst` series. If the `type` option is not specified, it is inherited from `chart.type`.
Configuration options for the series are given in three levels:
1. Options for all series in a chart are defined in the `plotOptions.series` object.
2. Options for all `sunburst` series are defined in `plotOptions.sunburst`.
3. Options for one single series are given in `the series instance array`.
<pre>
Highcharts.chart('container', {
plotOptions: {
series: {
// general options for all series
},
sunburst: {
// shared options for all sunburst series
}
},
series: [{
// specific options for this series instance
type: 'sunburst'
}]
});
<pre>
*/
@interface HISunburst: HISeries
@property(nonatomic, readwrite) NSNumber /* Bool */ *colorByPoint;
/**
Which point to use as a root in the visualization.
*/
@property(nonatomic, readwrite) NSString *rootId;
/**
Determines the width of the ring per level.
**Try it**
* [Sunburst with various sizes per level](https://jsfiddle.net/gh/get/library/pure/highcharts/highcharts/tree/master/samples/highcharts/plotoptions/sunburst-levelsize/)
*/
@property(nonatomic, readwrite) HILevelSize *levelSize;
/**
The center of the sunburst chart relative to the plot area. Can be percentages or pixel values.
**Defaults to** `["50%", "50%"]`.
**Try it**
* [Centered at 100, 100](https://jsfiddle.net/gh/get/library/pure/highcharts/highcharts/tree/master/samples/highcharts/plotoptions/pie-center/)
*/
@property(nonatomic, readwrite) NSArray /* <NSNumber, NSString> */ *center;
/**
Options for the button appearing when traversing down in a treemap.
*/
@property(nonatomic, readwrite) HITraverseUpButton *traverseUpButton;
/**
If a point is sliced, moved out from the center, how many pixels should it be moved?.
**Try it**
* [Sliced sunburst](https://jsfiddle.net/gh/get/library/pure/highcharts/highcharts/tree/master/samples/highcharts/plotoptions/sunburst-sliced)
*/
@property(nonatomic, readwrite) NSNumber *slicedOffset;
/**
Set options on specific levels. Takes precedence over series options, but not point options.
**Try it**
* [Sunburst chart](https://jsfiddle.net/gh/get/library/pure/highcharts/highcharts/tree/master/samples/highcharts/demo/sunburst)
*/
@property(nonatomic, readwrite) NSArray <HILevels *> *levels;
/**
Used together with the levels and `allowDrillToNode` options. When set to false the first level visible when drilling is considered to be level one. Otherwise the level will be the same as the tree structure.
*/
@property(nonatomic, readwrite) NSNumber /* Bool */ *levelIsConstant;
/**
When enabled the user can click on a point which is a parent and zoom in on its children.
**Defaults to** `false`.
*/
@property(nonatomic, readwrite) NSNumber /* Bool */ *allowTraversingTree;
/**
A series specific or series type specific color set to use instead of the global `colors`.
**Try it**
* [Set default colors for all pies](https://jsfiddle.net/gh/get/library/pure/highcharts/highcharts/tree/master/samples/highcharts/demo/pie-monochrome/)
*/
@property(nonatomic, readwrite) NSArray<HIColor *> *colors;
/**
The diameter of the pie relative to the plot area. Can be a percentage or pixel value. Pixel values are given as integers. The default behaviour (as of 3.0) is to scale to the plot area and give room for data labels within the plot area. `slicedOffset` is also included in the default size calculation. As a consequence, the size of the pie may vary when points are updated and data labels more around. In that case it is best to set a fixed value, for example `"75%"`.
**Try it**
* [Smaller pie](https://jsfiddle.net/gh/get/library/pure/highcharts/highcharts/tree/master/samples/highcharts/plotoptions/pie-size/)
*/
@property(nonatomic, readwrite) id /* NSNumber, NSString */ size;
/**
The color of the border surrounding each slice. When `null`, the border takes the same color as the slice fill. This can be used together with a `borderWidth` to fill drawing gaps created by antialiazing artefacts in borderless pies. In styled mode, the border stroke is given in the `.highcharts-point` class.
**Defaults to** `#ffffff`.
**Try it**
* [Black border](https://jsfiddle.net/gh/get/library/pure/highcharts/highcharts/tree/master/samples/highcharts/plotoptions/pie-bordercolor-black/)
*/
@property(nonatomic, readwrite) HIColor *borderColor;
/**
If the total sum of the pie's values is 0, the series is represented as an empty circle . The `fillColor` option defines the color of that circle. Use `pie.borderWidth` to set the border thickness.
**Try it**
* [Empty pie series](https://jsfiddle.net/gh/get/library/pure/highcharts/highcharts/tree/master/samples/highcharts/plotoptions/pie-emptyseries/)
*/
@property(nonatomic, readwrite) HIColor *fillColor;
/**
The start angle of the pie slices in degrees where 0 is top and 90 right.
**Defaults to** `0`.
**Try it**
* [Start from right](https://jsfiddle.net/gh/get/library/pure/highcharts/highcharts/tree/master/samples/highcharts/plotoptions/pie-startangle-90/)
*/
@property(nonatomic, readwrite) NSNumber *startAngle;
/**
The width of the border surrounding each slice. When setting the border width to 0, there may be small gaps between the slices due to SVG antialiasing artefacts. To work around this, keep the border width at 0.5 or 1, but set the `borderColor` to `null` instead. In styled mode, the border stroke width is given in the `.highcharts-point` class.
**Try it**
* [3px border](https://jsfiddle.net/gh/get/library/pure/highcharts/highcharts/tree/master/samples/highcharts/plotoptions/pie-borderwidth/)
*/
@property(nonatomic, readwrite) NSNumber *borderWidth;
-(NSDictionary *)getParams;
@end
| {
"pile_set_name": "Github"
} |
define([
'angular',
'lodash'
],
function (angular) {
'use strict';
var module = angular.module('grafana.controllers');
module.controller('JsonEditorCtrl', function ($scope) {
$scope.json = angular.toJson($scope.object, true);
$scope.canUpdate = $scope.updateHandler !== void 0;
$scope.update = function () {
var newObject = angular.fromJson($scope.json);
$scope.updateHandler(newObject, $scope.object);
};
});
});
| {
"pile_set_name": "Github"
} |
#!/usr/bin/env python
"""
Copyright (c) 2006-2014 sqlmap developers (http://sqlmap.org/)
See the file 'doc/COPYING' for copying permission
"""
import re
from lib.core.enums import HTTP_HEADER
from lib.core.settings import WAF_ATTACK_VECTORS
__product__ = "Cisco ACE XML Gateway (Cisco Systems)"
def detect(get_page):
retval = False
for vector in WAF_ATTACK_VECTORS:
page, headers, code = get_page(get=vector)
retval = re.search(r"ACE XML Gateway", headers.get(HTTP_HEADER.SERVER, ""), re.I) is not None
if retval:
break
return retval
| {
"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.camel.component.twilio.internal;
/**
* Constants for Twilio component.
*/
public interface TwilioConstants {
/**
* Suffix for parameters when passed as exchange header properties
*/
String PROPERTY_PREFIX = "CamelTwilio.";
/**
* Thread profile name for this component
*/
String THREAD_PROFILE_NAME = "CamelTwilio";
}
| {
"pile_set_name": "Github"
} |
/**
* The contents of this file are subject to the license and copyright
* detailed in the LICENSE and NOTICE files at the root of the source
* tree and available online at
*
* http://www.dspace.org/license/
*/
package org.dspace.checker;
import java.sql.SQLException;
import java.util.List;
import org.dspace.checker.dao.ChecksumResultDAO;
import org.dspace.checker.service.ChecksumResultService;
import org.dspace.core.Context;
import org.springframework.beans.factory.annotation.Autowired;
/**
* Service implementation for the ChecksumResult object.
* This class is responsible for all business logic calls for the ChecksumResult object and is autowired by spring.
* This class should never be accessed directly.
*
* @author kevinvandevelde at atmire.com
*/
public class ChecksumResultServiceImpl implements ChecksumResultService {
@Autowired(required = true)
private ChecksumResultDAO checksumResultDAO;
protected ChecksumResultServiceImpl() {
}
/**
* Get the result description for the given result code
*
* @param context Context
* @param code to get the description for.
* @return the found description.
* @throws SQLException if database error
*/
@Override
public ChecksumResult findByCode(Context context, ChecksumResultCode code) throws SQLException {
return checksumResultDAO.findByCode(context, code);
}
/**
* Get a list of all the possible result codes.
*
* @param context Context
* @return a list of all the result codes
* @throws SQLException if database error
*/
@Override
public List<ChecksumResult> findAll(Context context) throws SQLException {
return checksumResultDAO.findAll(context, ChecksumResult.class);
}
}
| {
"pile_set_name": "Github"
} |
use std::sync::mpsc;
use std::thread;
fn main() {
let (tx, rx) = mpsc::channel();
thread::spawn(move || {
let val = String::from("hi");
tx.send(val).unwrap();
});
}
| {
"pile_set_name": "Github"
} |
package com.mccorby.photolabeller
import android.app.Application
import android.content.Context
import com.mccorby.photolabeller.di.*
import space.traversal.kapsule.transitive
class AndroidClientApplication : Application() {
companion object {
fun appModule(context: Context) = (context.applicationContext as AndroidClientApplication).module
}
private lateinit var module: Modules
override fun onCreate() {
super.onCreate()
module = createDIModule()
}
private fun createDIModule() = Modules(
android = MainAppModule(this, MainNetworkModule()),
labelling = MainLabellingModule(),
training = MainTrainingModule(),
network = MainNetworkModule())
.transitive()
} | {
"pile_set_name": "Github"
} |
// This optional code is used to register a service worker.
// register() is not called by default.
// This lets the app load faster on subsequent visits in production, and gives
// it offline capabilities. However, it also means that developers (and users)
// will only see deployed updates on subsequent visits to a page, after all the
// existing tabs open on the page have been closed, since previously cached
// resources are updated in the background.
// To learn more about the benefits of this model and instructions on how to
// opt-in, read https://bit.ly/CRA-PWA
const isLocalhost = Boolean(
window.location.hostname === 'localhost' ||
// [::1] is the IPv6 localhost address.
window.location.hostname === '[::1]' ||
// 127.0.0.1/8 is considered localhost for IPv4.
window.location.hostname.match(
/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/
)
);
export function register(config) {
if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) {
// The URL constructor is available in all browsers that support SW.
const publicUrl = new URL(process.env.PUBLIC_URL, window.location.href);
if (publicUrl.origin !== window.location.origin) {
// Our service worker won't work if PUBLIC_URL is on a different origin
// from what our page is served on. This might happen if a CDN is used to
// serve assets; see https://github.com/facebook/create-react-app/issues/2374
return;
}
window.addEventListener('load', () => {
const swUrl = `${process.env.PUBLIC_URL}/service-worker.js`;
if (isLocalhost) {
// This is running on localhost. Let's check if a service worker still exists or not.
checkValidServiceWorker(swUrl, config);
// Add some additional logging to localhost, pointing developers to the
// service worker/PWA documentation.
navigator.serviceWorker.ready.then(() => {
console.log(
'This web app is being served cache-first by a service ' +
'worker. To learn more, visit https://bit.ly/CRA-PWA'
);
});
} else {
// Is not localhost. Just register service worker
registerValidSW(swUrl, config);
}
});
}
}
function registerValidSW(swUrl, config) {
navigator.serviceWorker
.register(swUrl)
.then(registration => {
registration.onupdatefound = () => {
const installingWorker = registration.installing;
if (installingWorker == null) {
return;
}
installingWorker.onstatechange = () => {
if (installingWorker.state === 'installed') {
if (navigator.serviceWorker.controller) {
// At this point, the updated precached content has been fetched,
// but the previous service worker will still serve the older
// content until all client tabs are closed.
console.log(
'New content is available and will be used when all ' +
'tabs for this page are closed. See https://bit.ly/CRA-PWA.'
);
// Execute callback
if (config && config.onUpdate) {
config.onUpdate(registration);
}
} else {
// At this point, everything has been precached.
// It's the perfect time to display a
// "Content is cached for offline use." message.
console.log('Content is cached for offline use.');
// Execute callback
if (config && config.onSuccess) {
config.onSuccess(registration);
}
}
}
};
};
})
.catch(error => {
console.error('Error during service worker registration:', error);
});
}
function checkValidServiceWorker(swUrl, config) {
// Check if the service worker can be found. If it can't reload the page.
fetch(swUrl)
.then(response => {
// Ensure service worker exists, and that we really are getting a JS file.
const contentType = response.headers.get('content-type');
if (
response.status === 404 ||
(contentType != null && contentType.indexOf('javascript') === -1)
) {
// No service worker found. Probably a different app. Reload the page.
navigator.serviceWorker.ready.then(registration => {
registration.unregister().then(() => {
window.location.reload();
});
});
} else {
// Service worker found. Proceed as normal.
registerValidSW(swUrl, config);
}
})
.catch(() => {
console.log(
'No internet connection found. App is running in offline mode.'
);
});
}
export function unregister() {
if ('serviceWorker' in navigator) {
navigator.serviceWorker.ready.then(registration => {
registration.unregister();
});
}
}
| {
"pile_set_name": "Github"
} |
/*
*
* Copyright (c) 1998-2002
* John Maddock
*
* Use, modification and distribution are subject to 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)
*
*/
/*
* LOCATION: see http://www.boost.org for most recent version.
* FILE regex_search.hpp
* VERSION see <boost/version.hpp>
* DESCRIPTION: Provides regex_search implementation.
*/
#ifndef BOOST_REGEX_V4_REGEX_SEARCH_HPP
#define BOOST_REGEX_V4_REGEX_SEARCH_HPP
namespace boost{
#ifdef BOOST_MSVC
#pragma warning(push)
#pragma warning(disable: 4103)
#endif
#ifdef BOOST_HAS_ABI_HEADERS
# include BOOST_ABI_PREFIX
#endif
#ifdef BOOST_MSVC
#pragma warning(pop)
#endif
template <class BidiIterator, class Allocator, class charT, class traits>
bool regex_search(BidiIterator first, BidiIterator last,
match_results<BidiIterator, Allocator>& m,
const basic_regex<charT, traits>& e,
match_flag_type flags = match_default)
{
return regex_search(first, last, m, e, flags, first);
}
template <class BidiIterator, class Allocator, class charT, class traits>
bool regex_search(BidiIterator first, BidiIterator last,
match_results<BidiIterator, Allocator>& m,
const basic_regex<charT, traits>& e,
match_flag_type flags,
BidiIterator base)
{
if(e.flags() & regex_constants::failbit)
return false;
re_detail::perl_matcher<BidiIterator, Allocator, traits> matcher(first, last, m, e, flags, base);
return matcher.find();
}
//
// regex_search convenience interfaces:
#ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
//
// this isn't really a partial specialisation, but template function
// overloading - if the compiler doesn't support partial specialisation
// then it really won't support this either:
template <class charT, class Allocator, class traits>
inline bool regex_search(const charT* str,
match_results<const charT*, Allocator>& m,
const basic_regex<charT, traits>& e,
match_flag_type flags = match_default)
{
return regex_search(str, str + traits::length(str), m, e, flags);
}
template <class ST, class SA, class Allocator, class charT, class traits>
inline bool regex_search(const std::basic_string<charT, ST, SA>& s,
match_results<typename std::basic_string<charT, ST, SA>::const_iterator, Allocator>& m,
const basic_regex<charT, traits>& e,
match_flag_type flags = match_default)
{
return regex_search(s.begin(), s.end(), m, e, flags);
}
#else // partial overloads:
inline bool regex_search(const char* str,
cmatch& m,
const regex& e,
match_flag_type flags = match_default)
{
return regex_search(str, str + regex::traits_type::length(str), m, e, flags);
}
inline bool regex_search(const char* first, const char* last,
const regex& e,
match_flag_type flags = match_default)
{
cmatch m;
return regex_search(first, last, m, e, flags | regex_constants::match_any);
}
#ifndef BOOST_NO_WREGEX
inline bool regex_search(const wchar_t* str,
wcmatch& m,
const wregex& e,
match_flag_type flags = match_default)
{
return regex_search(str, str + wregex::traits_type::length(str), m, e, flags);
}
inline bool regex_search(const wchar_t* first, const wchar_t* last,
const wregex& e,
match_flag_type flags = match_default)
{
wcmatch m;
return regex_search(first, last, m, e, flags | regex_constants::match_any);
}
#endif
inline bool regex_search(const std::string& s,
smatch& m,
const regex& e,
match_flag_type flags = match_default)
{
return regex_search(s.begin(), s.end(), m, e, flags);
}
#if !defined(BOOST_NO_WREGEX)
inline bool regex_search(const std::basic_string<wchar_t>& s,
wsmatch& m,
const wregex& e,
match_flag_type flags = match_default)
{
return regex_search(s.begin(), s.end(), m, e, flags);
}
#endif
#endif
template <class BidiIterator, class charT, class traits>
bool regex_search(BidiIterator first, BidiIterator last,
const basic_regex<charT, traits>& e,
match_flag_type flags = match_default)
{
if(e.flags() & regex_constants::failbit)
return false;
match_results<BidiIterator> m;
typedef typename match_results<BidiIterator>::allocator_type match_alloc_type;
re_detail::perl_matcher<BidiIterator, match_alloc_type, traits> matcher(first, last, m, e, flags | regex_constants::match_any, first);
return matcher.find();
}
#ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
template <class charT, class traits>
inline bool regex_search(const charT* str,
const basic_regex<charT, traits>& e,
match_flag_type flags = match_default)
{
return regex_search(str, str + traits::length(str), e, flags);
}
template <class ST, class SA, class charT, class traits>
inline bool regex_search(const std::basic_string<charT, ST, SA>& s,
const basic_regex<charT, traits>& e,
match_flag_type flags = match_default)
{
return regex_search(s.begin(), s.end(), e, flags);
}
#else // non-template function overloads
inline bool regex_search(const char* str,
const regex& e,
match_flag_type flags = match_default)
{
cmatch m;
return regex_search(str, str + regex::traits_type::length(str), m, e, flags | regex_constants::match_any);
}
#ifndef BOOST_NO_WREGEX
inline bool regex_search(const wchar_t* str,
const wregex& e,
match_flag_type flags = match_default)
{
wcmatch m;
return regex_search(str, str + wregex::traits_type::length(str), m, e, flags | regex_constants::match_any);
}
#endif
inline bool regex_search(const std::string& s,
const regex& e,
match_flag_type flags = match_default)
{
smatch m;
return regex_search(s.begin(), s.end(), m, e, flags | regex_constants::match_any);
}
#if !defined(BOOST_NO_WREGEX)
inline bool regex_search(const std::basic_string<wchar_t>& s,
const wregex& e,
match_flag_type flags = match_default)
{
wsmatch m;
return regex_search(s.begin(), s.end(), m, e, flags | regex_constants::match_any);
}
#endif // BOOST_NO_WREGEX
#endif // partial overload
#ifdef BOOST_MSVC
#pragma warning(push)
#pragma warning(disable: 4103)
#endif
#ifdef BOOST_HAS_ABI_HEADERS
# include BOOST_ABI_SUFFIX
#endif
#ifdef BOOST_MSVC
#pragma warning(pop)
#endif
} // namespace boost
#endif // BOOST_REGEX_V4_REGEX_SEARCH_HPP
| {
"pile_set_name": "Github"
} |
/* x509v3.h */
/*
* Written by Dr Stephen N Henson ([email protected]) for the OpenSSL project
* 1999.
*/
/* ====================================================================
* Copyright (c) 1999-2004 The OpenSSL Project. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. 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.
*
* 3. All advertising materials mentioning features or use of this
* software must display the following acknowledgment:
* "This product includes software developed by the OpenSSL Project
* for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
*
* 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
* endorse or promote products derived from this software without
* prior written permission. For written permission, please contact
* [email protected].
*
* 5. Products derived from this software may not be called "OpenSSL"
* nor may "OpenSSL" appear in their names without prior written
* permission of the OpenSSL Project.
*
* 6. Redistributions of any form whatsoever must retain the following
* acknowledgment:
* "This product includes software developed by the OpenSSL Project
* for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
*
* THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
* EXPRESSED 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 OpenSSL PROJECT OR
* ITS 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.
* ====================================================================
*
* This product includes cryptographic software written by Eric Young
* ([email protected]). This product includes software written by Tim
* Hudson ([email protected]).
*
*/
#ifndef HEADER_X509V3_H
# define HEADER_X509V3_H
# include <openssl/bio.h>
# include <openssl/x509.h>
# include <openssl/conf.h>
#ifdef __cplusplus
extern "C" {
#endif
# ifdef OPENSSL_SYS_WIN32
/* Under Win32 these are defined in wincrypt.h */
# undef X509_NAME
# undef X509_CERT_PAIR
# undef X509_EXTENSIONS
# endif
/* Forward reference */
struct v3_ext_method;
struct v3_ext_ctx;
/* Useful typedefs */
typedef void *(*X509V3_EXT_NEW)(void);
typedef void (*X509V3_EXT_FREE) (void *);
typedef void *(*X509V3_EXT_D2I)(void *, const unsigned char **, long);
typedef int (*X509V3_EXT_I2D) (void *, unsigned char **);
typedef STACK_OF(CONF_VALUE) *
(*X509V3_EXT_I2V) (const struct v3_ext_method *method, void *ext,
STACK_OF(CONF_VALUE) *extlist);
typedef void *(*X509V3_EXT_V2I)(const struct v3_ext_method *method,
struct v3_ext_ctx *ctx,
STACK_OF(CONF_VALUE) *values);
typedef char *(*X509V3_EXT_I2S)(const struct v3_ext_method *method,
void *ext);
typedef void *(*X509V3_EXT_S2I)(const struct v3_ext_method *method,
struct v3_ext_ctx *ctx, const char *str);
typedef int (*X509V3_EXT_I2R) (const struct v3_ext_method *method, void *ext,
BIO *out, int indent);
typedef void *(*X509V3_EXT_R2I)(const struct v3_ext_method *method,
struct v3_ext_ctx *ctx, const char *str);
/* V3 extension structure */
struct v3_ext_method {
int ext_nid;
int ext_flags;
/* If this is set the following four fields are ignored */
ASN1_ITEM_EXP *it;
/* Old style ASN1 calls */
X509V3_EXT_NEW ext_new;
X509V3_EXT_FREE ext_free;
X509V3_EXT_D2I d2i;
X509V3_EXT_I2D i2d;
/* The following pair is used for string extensions */
X509V3_EXT_I2S i2s;
X509V3_EXT_S2I s2i;
/* The following pair is used for multi-valued extensions */
X509V3_EXT_I2V i2v;
X509V3_EXT_V2I v2i;
/* The following are used for raw extensions */
X509V3_EXT_I2R i2r;
X509V3_EXT_R2I r2i;
void *usr_data; /* Any extension specific data */
};
typedef struct X509V3_CONF_METHOD_st {
char *(*get_string) (void *db, char *section, char *value);
STACK_OF(CONF_VALUE) *(*get_section) (void *db, char *section);
void (*free_string) (void *db, char *string);
void (*free_section) (void *db, STACK_OF(CONF_VALUE) *section);
} X509V3_CONF_METHOD;
/* Context specific info */
struct v3_ext_ctx {
# define CTX_TEST 0x1
int flags;
X509 *issuer_cert;
X509 *subject_cert;
X509_REQ *subject_req;
X509_CRL *crl;
X509V3_CONF_METHOD *db_meth;
void *db;
/* Maybe more here */
};
typedef struct v3_ext_method X509V3_EXT_METHOD;
DECLARE_STACK_OF(X509V3_EXT_METHOD)
/* ext_flags values */
# define X509V3_EXT_DYNAMIC 0x1
# define X509V3_EXT_CTX_DEP 0x2
# define X509V3_EXT_MULTILINE 0x4
typedef BIT_STRING_BITNAME ENUMERATED_NAMES;
typedef struct BASIC_CONSTRAINTS_st {
int ca;
ASN1_INTEGER *pathlen;
} BASIC_CONSTRAINTS;
typedef struct PKEY_USAGE_PERIOD_st {
ASN1_GENERALIZEDTIME *notBefore;
ASN1_GENERALIZEDTIME *notAfter;
} PKEY_USAGE_PERIOD;
typedef struct otherName_st {
ASN1_OBJECT *type_id;
ASN1_TYPE *value;
} OTHERNAME;
typedef struct EDIPartyName_st {
ASN1_STRING *nameAssigner;
ASN1_STRING *partyName;
} EDIPARTYNAME;
typedef struct GENERAL_NAME_st {
# define GEN_OTHERNAME 0
# define GEN_EMAIL 1
# define GEN_DNS 2
# define GEN_X400 3
# define GEN_DIRNAME 4
# define GEN_EDIPARTY 5
# define GEN_URI 6
# define GEN_IPADD 7
# define GEN_RID 8
int type;
union {
char *ptr;
OTHERNAME *otherName; /* otherName */
ASN1_IA5STRING *rfc822Name;
ASN1_IA5STRING *dNSName;
ASN1_TYPE *x400Address;
X509_NAME *directoryName;
EDIPARTYNAME *ediPartyName;
ASN1_IA5STRING *uniformResourceIdentifier;
ASN1_OCTET_STRING *iPAddress;
ASN1_OBJECT *registeredID;
/* Old names */
ASN1_OCTET_STRING *ip; /* iPAddress */
X509_NAME *dirn; /* dirn */
ASN1_IA5STRING *ia5; /* rfc822Name, dNSName,
* uniformResourceIdentifier */
ASN1_OBJECT *rid; /* registeredID */
ASN1_TYPE *other; /* x400Address */
} d;
} GENERAL_NAME;
typedef STACK_OF(GENERAL_NAME) GENERAL_NAMES;
typedef struct ACCESS_DESCRIPTION_st {
ASN1_OBJECT *method;
GENERAL_NAME *location;
} ACCESS_DESCRIPTION;
typedef STACK_OF(ACCESS_DESCRIPTION) AUTHORITY_INFO_ACCESS;
typedef STACK_OF(ASN1_OBJECT) EXTENDED_KEY_USAGE;
DECLARE_STACK_OF(GENERAL_NAME)
DECLARE_ASN1_SET_OF(GENERAL_NAME)
DECLARE_STACK_OF(ACCESS_DESCRIPTION)
DECLARE_ASN1_SET_OF(ACCESS_DESCRIPTION)
typedef struct DIST_POINT_NAME_st {
int type;
union {
GENERAL_NAMES *fullname;
STACK_OF(X509_NAME_ENTRY) *relativename;
} name;
/* If relativename then this contains the full distribution point name */
X509_NAME *dpname;
} DIST_POINT_NAME;
/* All existing reasons */
# define CRLDP_ALL_REASONS 0x807f
# define CRL_REASON_NONE -1
# define CRL_REASON_UNSPECIFIED 0
# define CRL_REASON_KEY_COMPROMISE 1
# define CRL_REASON_CA_COMPROMISE 2
# define CRL_REASON_AFFILIATION_CHANGED 3
# define CRL_REASON_SUPERSEDED 4
# define CRL_REASON_CESSATION_OF_OPERATION 5
# define CRL_REASON_CERTIFICATE_HOLD 6
# define CRL_REASON_REMOVE_FROM_CRL 8
# define CRL_REASON_PRIVILEGE_WITHDRAWN 9
# define CRL_REASON_AA_COMPROMISE 10
struct DIST_POINT_st {
DIST_POINT_NAME *distpoint;
ASN1_BIT_STRING *reasons;
GENERAL_NAMES *CRLissuer;
int dp_reasons;
};
typedef STACK_OF(DIST_POINT) CRL_DIST_POINTS;
DECLARE_STACK_OF(DIST_POINT)
DECLARE_ASN1_SET_OF(DIST_POINT)
struct AUTHORITY_KEYID_st {
ASN1_OCTET_STRING *keyid;
GENERAL_NAMES *issuer;
ASN1_INTEGER *serial;
};
/* Strong extranet structures */
typedef struct SXNET_ID_st {
ASN1_INTEGER *zone;
ASN1_OCTET_STRING *user;
} SXNETID;
DECLARE_STACK_OF(SXNETID)
DECLARE_ASN1_SET_OF(SXNETID)
typedef struct SXNET_st {
ASN1_INTEGER *version;
STACK_OF(SXNETID) *ids;
} SXNET;
typedef struct NOTICEREF_st {
ASN1_STRING *organization;
STACK_OF(ASN1_INTEGER) *noticenos;
} NOTICEREF;
typedef struct USERNOTICE_st {
NOTICEREF *noticeref;
ASN1_STRING *exptext;
} USERNOTICE;
typedef struct POLICYQUALINFO_st {
ASN1_OBJECT *pqualid;
union {
ASN1_IA5STRING *cpsuri;
USERNOTICE *usernotice;
ASN1_TYPE *other;
} d;
} POLICYQUALINFO;
DECLARE_STACK_OF(POLICYQUALINFO)
DECLARE_ASN1_SET_OF(POLICYQUALINFO)
typedef struct POLICYINFO_st {
ASN1_OBJECT *policyid;
STACK_OF(POLICYQUALINFO) *qualifiers;
} POLICYINFO;
typedef STACK_OF(POLICYINFO) CERTIFICATEPOLICIES;
DECLARE_STACK_OF(POLICYINFO)
DECLARE_ASN1_SET_OF(POLICYINFO)
typedef struct POLICY_MAPPING_st {
ASN1_OBJECT *issuerDomainPolicy;
ASN1_OBJECT *subjectDomainPolicy;
} POLICY_MAPPING;
DECLARE_STACK_OF(POLICY_MAPPING)
typedef STACK_OF(POLICY_MAPPING) POLICY_MAPPINGS;
typedef struct GENERAL_SUBTREE_st {
GENERAL_NAME *base;
ASN1_INTEGER *minimum;
ASN1_INTEGER *maximum;
} GENERAL_SUBTREE;
DECLARE_STACK_OF(GENERAL_SUBTREE)
struct NAME_CONSTRAINTS_st {
STACK_OF(GENERAL_SUBTREE) *permittedSubtrees;
STACK_OF(GENERAL_SUBTREE) *excludedSubtrees;
};
typedef struct POLICY_CONSTRAINTS_st {
ASN1_INTEGER *requireExplicitPolicy;
ASN1_INTEGER *inhibitPolicyMapping;
} POLICY_CONSTRAINTS;
/* Proxy certificate structures, see RFC 3820 */
typedef struct PROXY_POLICY_st {
ASN1_OBJECT *policyLanguage;
ASN1_OCTET_STRING *policy;
} PROXY_POLICY;
typedef struct PROXY_CERT_INFO_EXTENSION_st {
ASN1_INTEGER *pcPathLengthConstraint;
PROXY_POLICY *proxyPolicy;
} PROXY_CERT_INFO_EXTENSION;
DECLARE_ASN1_FUNCTIONS(PROXY_POLICY)
DECLARE_ASN1_FUNCTIONS(PROXY_CERT_INFO_EXTENSION)
struct ISSUING_DIST_POINT_st {
DIST_POINT_NAME *distpoint;
int onlyuser;
int onlyCA;
ASN1_BIT_STRING *onlysomereasons;
int indirectCRL;
int onlyattr;
};
/* Values in idp_flags field */
/* IDP present */
# define IDP_PRESENT 0x1
/* IDP values inconsistent */
# define IDP_INVALID 0x2
/* onlyuser true */
# define IDP_ONLYUSER 0x4
/* onlyCA true */
# define IDP_ONLYCA 0x8
/* onlyattr true */
# define IDP_ONLYATTR 0x10
/* indirectCRL true */
# define IDP_INDIRECT 0x20
/* onlysomereasons present */
# define IDP_REASONS 0x40
# define X509V3_conf_err(val) ERR_add_error_data(6, "section:", val->section, \
",name:", val->name, ",value:", val->value);
# define X509V3_set_ctx_test(ctx) \
X509V3_set_ctx(ctx, NULL, NULL, NULL, NULL, CTX_TEST)
# define X509V3_set_ctx_nodb(ctx) (ctx)->db = NULL;
# define EXT_BITSTRING(nid, table) { nid, 0, ASN1_ITEM_ref(ASN1_BIT_STRING), \
0,0,0,0, \
0,0, \
(X509V3_EXT_I2V)i2v_ASN1_BIT_STRING, \
(X509V3_EXT_V2I)v2i_ASN1_BIT_STRING, \
NULL, NULL, \
table}
# define EXT_IA5STRING(nid) { nid, 0, ASN1_ITEM_ref(ASN1_IA5STRING), \
0,0,0,0, \
(X509V3_EXT_I2S)i2s_ASN1_IA5STRING, \
(X509V3_EXT_S2I)s2i_ASN1_IA5STRING, \
0,0,0,0, \
NULL}
# define EXT_END { -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
/* X509_PURPOSE stuff */
# define EXFLAG_BCONS 0x1
# define EXFLAG_KUSAGE 0x2
# define EXFLAG_XKUSAGE 0x4
# define EXFLAG_NSCERT 0x8
# define EXFLAG_CA 0x10
/* Really self issued not necessarily self signed */
# define EXFLAG_SI 0x20
# define EXFLAG_V1 0x40
# define EXFLAG_INVALID 0x80
# define EXFLAG_SET 0x100
# define EXFLAG_CRITICAL 0x200
# define EXFLAG_PROXY 0x400
# define EXFLAG_INVALID_POLICY 0x800
# define EXFLAG_FRESHEST 0x1000
/* Self signed */
# define EXFLAG_SS 0x2000
# define KU_DIGITAL_SIGNATURE 0x0080
# define KU_NON_REPUDIATION 0x0040
# define KU_KEY_ENCIPHERMENT 0x0020
# define KU_DATA_ENCIPHERMENT 0x0010
# define KU_KEY_AGREEMENT 0x0008
# define KU_KEY_CERT_SIGN 0x0004
# define KU_CRL_SIGN 0x0002
# define KU_ENCIPHER_ONLY 0x0001
# define KU_DECIPHER_ONLY 0x8000
# define NS_SSL_CLIENT 0x80
# define NS_SSL_SERVER 0x40
# define NS_SMIME 0x20
# define NS_OBJSIGN 0x10
# define NS_SSL_CA 0x04
# define NS_SMIME_CA 0x02
# define NS_OBJSIGN_CA 0x01
# define NS_ANY_CA (NS_SSL_CA|NS_SMIME_CA|NS_OBJSIGN_CA)
# define XKU_SSL_SERVER 0x1
# define XKU_SSL_CLIENT 0x2
# define XKU_SMIME 0x4
# define XKU_CODE_SIGN 0x8
# define XKU_SGC 0x10
# define XKU_OCSP_SIGN 0x20
# define XKU_TIMESTAMP 0x40
# define XKU_DVCS 0x80
# define XKU_ANYEKU 0x100
# define X509_PURPOSE_DYNAMIC 0x1
# define X509_PURPOSE_DYNAMIC_NAME 0x2
typedef struct x509_purpose_st {
int purpose;
int trust; /* Default trust ID */
int flags;
int (*check_purpose) (const struct x509_purpose_st *, const X509 *, int);
char *name;
char *sname;
void *usr_data;
} X509_PURPOSE;
# define X509_PURPOSE_SSL_CLIENT 1
# define X509_PURPOSE_SSL_SERVER 2
# define X509_PURPOSE_NS_SSL_SERVER 3
# define X509_PURPOSE_SMIME_SIGN 4
# define X509_PURPOSE_SMIME_ENCRYPT 5
# define X509_PURPOSE_CRL_SIGN 6
# define X509_PURPOSE_ANY 7
# define X509_PURPOSE_OCSP_HELPER 8
# define X509_PURPOSE_TIMESTAMP_SIGN 9
# define X509_PURPOSE_MIN 1
# define X509_PURPOSE_MAX 9
/* Flags for X509V3_EXT_print() */
# define X509V3_EXT_UNKNOWN_MASK (0xfL << 16)
/* Return error for unknown extensions */
# define X509V3_EXT_DEFAULT 0
/* Print error for unknown extensions */
# define X509V3_EXT_ERROR_UNKNOWN (1L << 16)
/* ASN1 parse unknown extensions */
# define X509V3_EXT_PARSE_UNKNOWN (2L << 16)
/* BIO_dump unknown extensions */
# define X509V3_EXT_DUMP_UNKNOWN (3L << 16)
/* Flags for X509V3_add1_i2d */
# define X509V3_ADD_OP_MASK 0xfL
# define X509V3_ADD_DEFAULT 0L
# define X509V3_ADD_APPEND 1L
# define X509V3_ADD_REPLACE 2L
# define X509V3_ADD_REPLACE_EXISTING 3L
# define X509V3_ADD_KEEP_EXISTING 4L
# define X509V3_ADD_DELETE 5L
# define X509V3_ADD_SILENT 0x10
DECLARE_STACK_OF(X509_PURPOSE)
DECLARE_ASN1_FUNCTIONS(BASIC_CONSTRAINTS)
DECLARE_ASN1_FUNCTIONS(SXNET)
DECLARE_ASN1_FUNCTIONS(SXNETID)
int SXNET_add_id_asc(SXNET **psx, char *zone, char *user, int userlen);
int SXNET_add_id_ulong(SXNET **psx, unsigned long lzone, char *user,
int userlen);
int SXNET_add_id_INTEGER(SXNET **psx, ASN1_INTEGER *izone, char *user,
int userlen);
ASN1_OCTET_STRING *SXNET_get_id_asc(SXNET *sx, char *zone);
ASN1_OCTET_STRING *SXNET_get_id_ulong(SXNET *sx, unsigned long lzone);
ASN1_OCTET_STRING *SXNET_get_id_INTEGER(SXNET *sx, ASN1_INTEGER *zone);
DECLARE_ASN1_FUNCTIONS(AUTHORITY_KEYID)
DECLARE_ASN1_FUNCTIONS(PKEY_USAGE_PERIOD)
DECLARE_ASN1_FUNCTIONS(GENERAL_NAME)
GENERAL_NAME *GENERAL_NAME_dup(GENERAL_NAME *a);
int GENERAL_NAME_cmp(GENERAL_NAME *a, GENERAL_NAME *b);
ASN1_BIT_STRING *v2i_ASN1_BIT_STRING(X509V3_EXT_METHOD *method,
X509V3_CTX *ctx,
STACK_OF(CONF_VALUE) *nval);
STACK_OF(CONF_VALUE) *i2v_ASN1_BIT_STRING(X509V3_EXT_METHOD *method,
ASN1_BIT_STRING *bits,
STACK_OF(CONF_VALUE) *extlist);
STACK_OF(CONF_VALUE) *i2v_GENERAL_NAME(X509V3_EXT_METHOD *method,
GENERAL_NAME *gen,
STACK_OF(CONF_VALUE) *ret);
int GENERAL_NAME_print(BIO *out, GENERAL_NAME *gen);
DECLARE_ASN1_FUNCTIONS(GENERAL_NAMES)
STACK_OF(CONF_VALUE) *i2v_GENERAL_NAMES(X509V3_EXT_METHOD *method,
GENERAL_NAMES *gen,
STACK_OF(CONF_VALUE) *extlist);
GENERAL_NAMES *v2i_GENERAL_NAMES(const X509V3_EXT_METHOD *method,
X509V3_CTX *ctx, STACK_OF(CONF_VALUE) *nval);
DECLARE_ASN1_FUNCTIONS(OTHERNAME)
DECLARE_ASN1_FUNCTIONS(EDIPARTYNAME)
int OTHERNAME_cmp(OTHERNAME *a, OTHERNAME *b);
void GENERAL_NAME_set0_value(GENERAL_NAME *a, int type, void *value);
void *GENERAL_NAME_get0_value(GENERAL_NAME *a, int *ptype);
int GENERAL_NAME_set0_othername(GENERAL_NAME *gen,
ASN1_OBJECT *oid, ASN1_TYPE *value);
int GENERAL_NAME_get0_otherName(GENERAL_NAME *gen,
ASN1_OBJECT **poid, ASN1_TYPE **pvalue);
char *i2s_ASN1_OCTET_STRING(X509V3_EXT_METHOD *method,
ASN1_OCTET_STRING *ia5);
ASN1_OCTET_STRING *s2i_ASN1_OCTET_STRING(X509V3_EXT_METHOD *method,
X509V3_CTX *ctx, char *str);
DECLARE_ASN1_FUNCTIONS(EXTENDED_KEY_USAGE)
int i2a_ACCESS_DESCRIPTION(BIO *bp, ACCESS_DESCRIPTION *a);
DECLARE_ASN1_FUNCTIONS(CERTIFICATEPOLICIES)
DECLARE_ASN1_FUNCTIONS(POLICYINFO)
DECLARE_ASN1_FUNCTIONS(POLICYQUALINFO)
DECLARE_ASN1_FUNCTIONS(USERNOTICE)
DECLARE_ASN1_FUNCTIONS(NOTICEREF)
DECLARE_ASN1_FUNCTIONS(CRL_DIST_POINTS)
DECLARE_ASN1_FUNCTIONS(DIST_POINT)
DECLARE_ASN1_FUNCTIONS(DIST_POINT_NAME)
DECLARE_ASN1_FUNCTIONS(ISSUING_DIST_POINT)
int DIST_POINT_set_dpname(DIST_POINT_NAME *dpn, X509_NAME *iname);
int NAME_CONSTRAINTS_check(X509 *x, NAME_CONSTRAINTS *nc);
DECLARE_ASN1_FUNCTIONS(ACCESS_DESCRIPTION)
DECLARE_ASN1_FUNCTIONS(AUTHORITY_INFO_ACCESS)
DECLARE_ASN1_ITEM(POLICY_MAPPING)
DECLARE_ASN1_ALLOC_FUNCTIONS(POLICY_MAPPING)
DECLARE_ASN1_ITEM(POLICY_MAPPINGS)
DECLARE_ASN1_ITEM(GENERAL_SUBTREE)
DECLARE_ASN1_ALLOC_FUNCTIONS(GENERAL_SUBTREE)
DECLARE_ASN1_ITEM(NAME_CONSTRAINTS)
DECLARE_ASN1_ALLOC_FUNCTIONS(NAME_CONSTRAINTS)
DECLARE_ASN1_ALLOC_FUNCTIONS(POLICY_CONSTRAINTS)
DECLARE_ASN1_ITEM(POLICY_CONSTRAINTS)
GENERAL_NAME *a2i_GENERAL_NAME(GENERAL_NAME *out,
const X509V3_EXT_METHOD *method,
X509V3_CTX *ctx, int gen_type, char *value,
int is_nc);
# ifdef HEADER_CONF_H
GENERAL_NAME *v2i_GENERAL_NAME(const X509V3_EXT_METHOD *method,
X509V3_CTX *ctx, CONF_VALUE *cnf);
GENERAL_NAME *v2i_GENERAL_NAME_ex(GENERAL_NAME *out,
const X509V3_EXT_METHOD *method,
X509V3_CTX *ctx, CONF_VALUE *cnf,
int is_nc);
void X509V3_conf_free(CONF_VALUE *val);
X509_EXTENSION *X509V3_EXT_nconf_nid(CONF *conf, X509V3_CTX *ctx, int ext_nid,
char *value);
X509_EXTENSION *X509V3_EXT_nconf(CONF *conf, X509V3_CTX *ctx, char *name,
char *value);
int X509V3_EXT_add_nconf_sk(CONF *conf, X509V3_CTX *ctx, char *section,
STACK_OF(X509_EXTENSION) **sk);
int X509V3_EXT_add_nconf(CONF *conf, X509V3_CTX *ctx, char *section,
X509 *cert);
int X509V3_EXT_REQ_add_nconf(CONF *conf, X509V3_CTX *ctx, char *section,
X509_REQ *req);
int X509V3_EXT_CRL_add_nconf(CONF *conf, X509V3_CTX *ctx, char *section,
X509_CRL *crl);
X509_EXTENSION *X509V3_EXT_conf_nid(LHASH_OF(CONF_VALUE) *conf,
X509V3_CTX *ctx, int ext_nid,
char *value);
X509_EXTENSION *X509V3_EXT_conf(LHASH_OF(CONF_VALUE) *conf, X509V3_CTX *ctx,
char *name, char *value);
int X509V3_EXT_add_conf(LHASH_OF(CONF_VALUE) *conf, X509V3_CTX *ctx,
char *section, X509 *cert);
int X509V3_EXT_REQ_add_conf(LHASH_OF(CONF_VALUE) *conf, X509V3_CTX *ctx,
char *section, X509_REQ *req);
int X509V3_EXT_CRL_add_conf(LHASH_OF(CONF_VALUE) *conf, X509V3_CTX *ctx,
char *section, X509_CRL *crl);
int X509V3_add_value_bool_nf(char *name, int asn1_bool,
STACK_OF(CONF_VALUE) **extlist);
int X509V3_get_value_bool(CONF_VALUE *value, int *asn1_bool);
int X509V3_get_value_int(CONF_VALUE *value, ASN1_INTEGER **aint);
void X509V3_set_nconf(X509V3_CTX *ctx, CONF *conf);
void X509V3_set_conf_lhash(X509V3_CTX *ctx, LHASH_OF(CONF_VALUE) *lhash);
# endif
char *X509V3_get_string(X509V3_CTX *ctx, char *name, char *section);
STACK_OF(CONF_VALUE) *X509V3_get_section(X509V3_CTX *ctx, char *section);
void X509V3_string_free(X509V3_CTX *ctx, char *str);
void X509V3_section_free(X509V3_CTX *ctx, STACK_OF(CONF_VALUE) *section);
void X509V3_set_ctx(X509V3_CTX *ctx, X509 *issuer, X509 *subject,
X509_REQ *req, X509_CRL *crl, int flags);
int X509V3_add_value(const char *name, const char *value,
STACK_OF(CONF_VALUE) **extlist);
int X509V3_add_value_uchar(const char *name, const unsigned char *value,
STACK_OF(CONF_VALUE) **extlist);
int X509V3_add_value_bool(const char *name, int asn1_bool,
STACK_OF(CONF_VALUE) **extlist);
int X509V3_add_value_int(const char *name, ASN1_INTEGER *aint,
STACK_OF(CONF_VALUE) **extlist);
char *i2s_ASN1_INTEGER(X509V3_EXT_METHOD *meth, ASN1_INTEGER *aint);
ASN1_INTEGER *s2i_ASN1_INTEGER(X509V3_EXT_METHOD *meth, char *value);
char *i2s_ASN1_ENUMERATED(X509V3_EXT_METHOD *meth, ASN1_ENUMERATED *aint);
char *i2s_ASN1_ENUMERATED_TABLE(X509V3_EXT_METHOD *meth,
ASN1_ENUMERATED *aint);
int X509V3_EXT_add(X509V3_EXT_METHOD *ext);
int X509V3_EXT_add_list(X509V3_EXT_METHOD *extlist);
int X509V3_EXT_add_alias(int nid_to, int nid_from);
void X509V3_EXT_cleanup(void);
const X509V3_EXT_METHOD *X509V3_EXT_get(X509_EXTENSION *ext);
const X509V3_EXT_METHOD *X509V3_EXT_get_nid(int nid);
int X509V3_add_standard_extensions(void);
STACK_OF(CONF_VALUE) *X509V3_parse_list(const char *line);
void *X509V3_EXT_d2i(X509_EXTENSION *ext);
void *X509V3_get_d2i(STACK_OF(X509_EXTENSION) *x, int nid, int *crit,
int *idx);
int X509V3_EXT_free(int nid, void *ext_data);
X509_EXTENSION *X509V3_EXT_i2d(int ext_nid, int crit, void *ext_struc);
int X509V3_add1_i2d(STACK_OF(X509_EXTENSION) **x, int nid, void *value,
int crit, unsigned long flags);
char *hex_to_string(const unsigned char *buffer, long len);
unsigned char *string_to_hex(const char *str, long *len);
int name_cmp(const char *name, const char *cmp);
void X509V3_EXT_val_prn(BIO *out, STACK_OF(CONF_VALUE) *val, int indent,
int ml);
int X509V3_EXT_print(BIO *out, X509_EXTENSION *ext, unsigned long flag,
int indent);
int X509V3_EXT_print_fp(FILE *out, X509_EXTENSION *ext, int flag, int indent);
int X509V3_extensions_print(BIO *out, char *title,
STACK_OF(X509_EXTENSION) *exts,
unsigned long flag, int indent);
int X509_check_ca(X509 *x);
int X509_check_purpose(X509 *x, int id, int ca);
int X509_supported_extension(X509_EXTENSION *ex);
int X509_PURPOSE_set(int *p, int purpose);
int X509_check_issued(X509 *issuer, X509 *subject);
int X509_check_akid(X509 *issuer, AUTHORITY_KEYID *akid);
int X509_PURPOSE_get_count(void);
X509_PURPOSE *X509_PURPOSE_get0(int idx);
int X509_PURPOSE_get_by_sname(char *sname);
int X509_PURPOSE_get_by_id(int id);
int X509_PURPOSE_add(int id, int trust, int flags,
int (*ck) (const X509_PURPOSE *, const X509 *, int),
char *name, char *sname, void *arg);
char *X509_PURPOSE_get0_name(X509_PURPOSE *xp);
char *X509_PURPOSE_get0_sname(X509_PURPOSE *xp);
int X509_PURPOSE_get_trust(X509_PURPOSE *xp);
void X509_PURPOSE_cleanup(void);
int X509_PURPOSE_get_id(X509_PURPOSE *);
STACK_OF(OPENSSL_STRING) *X509_get1_email(X509 *x);
STACK_OF(OPENSSL_STRING) *X509_REQ_get1_email(X509_REQ *x);
void X509_email_free(STACK_OF(OPENSSL_STRING) *sk);
STACK_OF(OPENSSL_STRING) *X509_get1_ocsp(X509 *x);
/* Flags for X509_check_* functions */
/*
* Always check subject name for host match even if subject alt names present
*/
# define X509_CHECK_FLAG_ALWAYS_CHECK_SUBJECT 0x1
/* Disable wildcard matching for dnsName fields and common name. */
# define X509_CHECK_FLAG_NO_WILDCARDS 0x2
/* Wildcards must not match a partial label. */
# define X509_CHECK_FLAG_NO_PARTIAL_WILDCARDS 0x4
/* Allow (non-partial) wildcards to match multiple labels. */
# define X509_CHECK_FLAG_MULTI_LABEL_WILDCARDS 0x8
/* Constraint verifier subdomain patterns to match a single labels. */
# define X509_CHECK_FLAG_SINGLE_LABEL_SUBDOMAINS 0x10
/*
* Match reference identifiers starting with "." to any sub-domain.
* This is a non-public flag, turned on implicitly when the subject
* reference identity is a DNS name.
*/
# define _X509_CHECK_FLAG_DOT_SUBDOMAINS 0x8000
int X509_check_host(X509 *x, const char *chk, size_t chklen,
unsigned int flags, char **peername);
int X509_check_email(X509 *x, const char *chk, size_t chklen,
unsigned int flags);
int X509_check_ip(X509 *x, const unsigned char *chk, size_t chklen,
unsigned int flags);
int X509_check_ip_asc(X509 *x, const char *ipasc, unsigned int flags);
ASN1_OCTET_STRING *a2i_IPADDRESS(const char *ipasc);
ASN1_OCTET_STRING *a2i_IPADDRESS_NC(const char *ipasc);
int a2i_ipadd(unsigned char *ipout, const char *ipasc);
int X509V3_NAME_from_section(X509_NAME *nm, STACK_OF(CONF_VALUE) *dn_sk,
unsigned long chtype);
void X509_POLICY_NODE_print(BIO *out, X509_POLICY_NODE *node, int indent);
DECLARE_STACK_OF(X509_POLICY_NODE)
# ifndef OPENSSL_NO_RFC3779
typedef struct ASRange_st {
ASN1_INTEGER *min, *max;
} ASRange;
# define ASIdOrRange_id 0
# define ASIdOrRange_range 1
typedef struct ASIdOrRange_st {
int type;
union {
ASN1_INTEGER *id;
ASRange *range;
} u;
} ASIdOrRange;
typedef STACK_OF(ASIdOrRange) ASIdOrRanges;
DECLARE_STACK_OF(ASIdOrRange)
# define ASIdentifierChoice_inherit 0
# define ASIdentifierChoice_asIdsOrRanges 1
typedef struct ASIdentifierChoice_st {
int type;
union {
ASN1_NULL *inherit;
ASIdOrRanges *asIdsOrRanges;
} u;
} ASIdentifierChoice;
typedef struct ASIdentifiers_st {
ASIdentifierChoice *asnum, *rdi;
} ASIdentifiers;
DECLARE_ASN1_FUNCTIONS(ASRange)
DECLARE_ASN1_FUNCTIONS(ASIdOrRange)
DECLARE_ASN1_FUNCTIONS(ASIdentifierChoice)
DECLARE_ASN1_FUNCTIONS(ASIdentifiers)
typedef struct IPAddressRange_st {
ASN1_BIT_STRING *min, *max;
} IPAddressRange;
# define IPAddressOrRange_addressPrefix 0
# define IPAddressOrRange_addressRange 1
typedef struct IPAddressOrRange_st {
int type;
union {
ASN1_BIT_STRING *addressPrefix;
IPAddressRange *addressRange;
} u;
} IPAddressOrRange;
typedef STACK_OF(IPAddressOrRange) IPAddressOrRanges;
DECLARE_STACK_OF(IPAddressOrRange)
# define IPAddressChoice_inherit 0
# define IPAddressChoice_addressesOrRanges 1
typedef struct IPAddressChoice_st {
int type;
union {
ASN1_NULL *inherit;
IPAddressOrRanges *addressesOrRanges;
} u;
} IPAddressChoice;
typedef struct IPAddressFamily_st {
ASN1_OCTET_STRING *addressFamily;
IPAddressChoice *ipAddressChoice;
} IPAddressFamily;
typedef STACK_OF(IPAddressFamily) IPAddrBlocks;
DECLARE_STACK_OF(IPAddressFamily)
DECLARE_ASN1_FUNCTIONS(IPAddressRange)
DECLARE_ASN1_FUNCTIONS(IPAddressOrRange)
DECLARE_ASN1_FUNCTIONS(IPAddressChoice)
DECLARE_ASN1_FUNCTIONS(IPAddressFamily)
/*
* API tag for elements of the ASIdentifer SEQUENCE.
*/
# define V3_ASID_ASNUM 0
# define V3_ASID_RDI 1
/*
* AFI values, assigned by IANA. It'd be nice to make the AFI
* handling code totally generic, but there are too many little things
* that would need to be defined for other address families for it to
* be worth the trouble.
*/
# define IANA_AFI_IPV4 1
# define IANA_AFI_IPV6 2
/*
* Utilities to construct and extract values from RFC3779 extensions,
* since some of the encodings (particularly for IP address prefixes
* and ranges) are a bit tedious to work with directly.
*/
int v3_asid_add_inherit(ASIdentifiers *asid, int which);
int v3_asid_add_id_or_range(ASIdentifiers *asid, int which,
ASN1_INTEGER *min, ASN1_INTEGER *max);
int v3_addr_add_inherit(IPAddrBlocks *addr,
const unsigned afi, const unsigned *safi);
int v3_addr_add_prefix(IPAddrBlocks *addr,
const unsigned afi, const unsigned *safi,
unsigned char *a, const int prefixlen);
int v3_addr_add_range(IPAddrBlocks *addr,
const unsigned afi, const unsigned *safi,
unsigned char *min, unsigned char *max);
unsigned v3_addr_get_afi(const IPAddressFamily *f);
int v3_addr_get_range(IPAddressOrRange *aor, const unsigned afi,
unsigned char *min, unsigned char *max,
const int length);
/*
* Canonical forms.
*/
int v3_asid_is_canonical(ASIdentifiers *asid);
int v3_addr_is_canonical(IPAddrBlocks *addr);
int v3_asid_canonize(ASIdentifiers *asid);
int v3_addr_canonize(IPAddrBlocks *addr);
/*
* Tests for inheritance and containment.
*/
int v3_asid_inherits(ASIdentifiers *asid);
int v3_addr_inherits(IPAddrBlocks *addr);
int v3_asid_subset(ASIdentifiers *a, ASIdentifiers *b);
int v3_addr_subset(IPAddrBlocks *a, IPAddrBlocks *b);
/*
* Check whether RFC 3779 extensions nest properly in chains.
*/
int v3_asid_validate_path(X509_STORE_CTX *);
int v3_addr_validate_path(X509_STORE_CTX *);
int v3_asid_validate_resource_set(STACK_OF(X509) *chain,
ASIdentifiers *ext, int allow_inheritance);
int v3_addr_validate_resource_set(STACK_OF(X509) *chain,
IPAddrBlocks *ext, int allow_inheritance);
# endif /* OPENSSL_NO_RFC3779 */
/* BEGIN ERROR CODES */
/*
* The following lines are auto generated by the script mkerr.pl. Any changes
* made after this point may be overwritten when the script is next run.
*/
void ERR_load_X509V3_strings(void);
/* Error codes for the X509V3 functions. */
/* Function codes. */
# define X509V3_F_A2I_GENERAL_NAME 164
# define X509V3_F_ASIDENTIFIERCHOICE_CANONIZE 161
# define X509V3_F_ASIDENTIFIERCHOICE_IS_CANONICAL 162
# define X509V3_F_COPY_EMAIL 122
# define X509V3_F_COPY_ISSUER 123
# define X509V3_F_DO_DIRNAME 144
# define X509V3_F_DO_EXT_CONF 124
# define X509V3_F_DO_EXT_I2D 135
# define X509V3_F_DO_EXT_NCONF 151
# define X509V3_F_DO_I2V_NAME_CONSTRAINTS 148
# define X509V3_F_GNAMES_FROM_SECTNAME 156
# define X509V3_F_HEX_TO_STRING 111
# define X509V3_F_I2S_ASN1_ENUMERATED 121
# define X509V3_F_I2S_ASN1_IA5STRING 149
# define X509V3_F_I2S_ASN1_INTEGER 120
# define X509V3_F_I2V_AUTHORITY_INFO_ACCESS 138
# define X509V3_F_NOTICE_SECTION 132
# define X509V3_F_NREF_NOS 133
# define X509V3_F_POLICY_SECTION 131
# define X509V3_F_PROCESS_PCI_VALUE 150
# define X509V3_F_R2I_CERTPOL 130
# define X509V3_F_R2I_PCI 155
# define X509V3_F_S2I_ASN1_IA5STRING 100
# define X509V3_F_S2I_ASN1_INTEGER 108
# define X509V3_F_S2I_ASN1_OCTET_STRING 112
# define X509V3_F_S2I_ASN1_SKEY_ID 114
# define X509V3_F_S2I_SKEY_ID 115
# define X509V3_F_SET_DIST_POINT_NAME 158
# define X509V3_F_STRING_TO_HEX 113
# define X509V3_F_SXNET_ADD_ID_ASC 125
# define X509V3_F_SXNET_ADD_ID_INTEGER 126
# define X509V3_F_SXNET_ADD_ID_ULONG 127
# define X509V3_F_SXNET_GET_ID_ASC 128
# define X509V3_F_SXNET_GET_ID_ULONG 129
# define X509V3_F_V2I_ASIDENTIFIERS 163
# define X509V3_F_V2I_ASN1_BIT_STRING 101
# define X509V3_F_V2I_AUTHORITY_INFO_ACCESS 139
# define X509V3_F_V2I_AUTHORITY_KEYID 119
# define X509V3_F_V2I_BASIC_CONSTRAINTS 102
# define X509V3_F_V2I_CRLD 134
# define X509V3_F_V2I_EXTENDED_KEY_USAGE 103
# define X509V3_F_V2I_GENERAL_NAMES 118
# define X509V3_F_V2I_GENERAL_NAME_EX 117
# define X509V3_F_V2I_IDP 157
# define X509V3_F_V2I_IPADDRBLOCKS 159
# define X509V3_F_V2I_ISSUER_ALT 153
# define X509V3_F_V2I_NAME_CONSTRAINTS 147
# define X509V3_F_V2I_POLICY_CONSTRAINTS 146
# define X509V3_F_V2I_POLICY_MAPPINGS 145
# define X509V3_F_V2I_SUBJECT_ALT 154
# define X509V3_F_V3_ADDR_VALIDATE_PATH_INTERNAL 160
# define X509V3_F_V3_GENERIC_EXTENSION 116
# define X509V3_F_X509V3_ADD1_I2D 140
# define X509V3_F_X509V3_ADD_VALUE 105
# define X509V3_F_X509V3_EXT_ADD 104
# define X509V3_F_X509V3_EXT_ADD_ALIAS 106
# define X509V3_F_X509V3_EXT_CONF 107
# define X509V3_F_X509V3_EXT_FREE 165
# define X509V3_F_X509V3_EXT_I2D 136
# define X509V3_F_X509V3_EXT_NCONF 152
# define X509V3_F_X509V3_GET_SECTION 142
# define X509V3_F_X509V3_GET_STRING 143
# define X509V3_F_X509V3_GET_VALUE_BOOL 110
# define X509V3_F_X509V3_PARSE_LIST 109
# define X509V3_F_X509_PURPOSE_ADD 137
# define X509V3_F_X509_PURPOSE_SET 141
/* Reason codes. */
# define X509V3_R_BAD_IP_ADDRESS 118
# define X509V3_R_BAD_OBJECT 119
# define X509V3_R_BN_DEC2BN_ERROR 100
# define X509V3_R_BN_TO_ASN1_INTEGER_ERROR 101
# define X509V3_R_CANNOT_FIND_FREE_FUNCTION 168
# define X509V3_R_DIRNAME_ERROR 149
# define X509V3_R_DISTPOINT_ALREADY_SET 160
# define X509V3_R_DUPLICATE_ZONE_ID 133
# define X509V3_R_ERROR_CONVERTING_ZONE 131
# define X509V3_R_ERROR_CREATING_EXTENSION 144
# define X509V3_R_ERROR_IN_EXTENSION 128
# define X509V3_R_EXPECTED_A_SECTION_NAME 137
# define X509V3_R_EXTENSION_EXISTS 145
# define X509V3_R_EXTENSION_NAME_ERROR 115
# define X509V3_R_EXTENSION_NOT_FOUND 102
# define X509V3_R_EXTENSION_SETTING_NOT_SUPPORTED 103
# define X509V3_R_EXTENSION_VALUE_ERROR 116
# define X509V3_R_ILLEGAL_EMPTY_EXTENSION 151
# define X509V3_R_ILLEGAL_HEX_DIGIT 113
# define X509V3_R_INCORRECT_POLICY_SYNTAX_TAG 152
# define X509V3_R_INVALID_ASNUMBER 162
# define X509V3_R_INVALID_ASRANGE 163
# define X509V3_R_INVALID_BOOLEAN_STRING 104
# define X509V3_R_INVALID_EXTENSION_STRING 105
# define X509V3_R_INVALID_INHERITANCE 165
# define X509V3_R_INVALID_IPADDRESS 166
# define X509V3_R_INVALID_MULTIPLE_RDNS 161
# define X509V3_R_INVALID_NAME 106
# define X509V3_R_INVALID_NULL_ARGUMENT 107
# define X509V3_R_INVALID_NULL_NAME 108
# define X509V3_R_INVALID_NULL_VALUE 109
# define X509V3_R_INVALID_NUMBER 140
# define X509V3_R_INVALID_NUMBERS 141
# define X509V3_R_INVALID_OBJECT_IDENTIFIER 110
# define X509V3_R_INVALID_OPTION 138
# define X509V3_R_INVALID_POLICY_IDENTIFIER 134
# define X509V3_R_INVALID_PROXY_POLICY_SETTING 153
# define X509V3_R_INVALID_PURPOSE 146
# define X509V3_R_INVALID_SAFI 164
# define X509V3_R_INVALID_SECTION 135
# define X509V3_R_INVALID_SYNTAX 143
# define X509V3_R_ISSUER_DECODE_ERROR 126
# define X509V3_R_MISSING_VALUE 124
# define X509V3_R_NEED_ORGANIZATION_AND_NUMBERS 142
# define X509V3_R_NO_CONFIG_DATABASE 136
# define X509V3_R_NO_ISSUER_CERTIFICATE 121
# define X509V3_R_NO_ISSUER_DETAILS 127
# define X509V3_R_NO_POLICY_IDENTIFIER 139
# define X509V3_R_NO_PROXY_CERT_POLICY_LANGUAGE_DEFINED 154
# define X509V3_R_NO_PUBLIC_KEY 114
# define X509V3_R_NO_SUBJECT_DETAILS 125
# define X509V3_R_ODD_NUMBER_OF_DIGITS 112
# define X509V3_R_OPERATION_NOT_DEFINED 148
# define X509V3_R_OTHERNAME_ERROR 147
# define X509V3_R_POLICY_LANGUAGE_ALREADY_DEFINED 155
# define X509V3_R_POLICY_PATH_LENGTH 156
# define X509V3_R_POLICY_PATH_LENGTH_ALREADY_DEFINED 157
# define X509V3_R_POLICY_SYNTAX_NOT_CURRENTLY_SUPPORTED 158
# define X509V3_R_POLICY_WHEN_PROXY_LANGUAGE_REQUIRES_NO_POLICY 159
# define X509V3_R_SECTION_NOT_FOUND 150
# define X509V3_R_UNABLE_TO_GET_ISSUER_DETAILS 122
# define X509V3_R_UNABLE_TO_GET_ISSUER_KEYID 123
# define X509V3_R_UNKNOWN_BIT_STRING_ARGUMENT 111
# define X509V3_R_UNKNOWN_EXTENSION 129
# define X509V3_R_UNKNOWN_EXTENSION_NAME 130
# define X509V3_R_UNKNOWN_OPTION 120
# define X509V3_R_UNSUPPORTED_OPTION 117
# define X509V3_R_UNSUPPORTED_TYPE 167
# define X509V3_R_USER_TOO_LONG 132
#ifdef __cplusplus
}
#endif
#endif
| {
"pile_set_name": "Github"
} |
{
"name": "semver",
"version": "5.7.0",
"description": "The semantic version parser used by npm.",
"main": "semver.js",
"scripts": {
"test": "tap",
"preversion": "npm test",
"postversion": "npm publish",
"postpublish": "git push origin --all; git push origin --tags"
},
"devDependencies": {
"tap": "^13.0.0-rc.18"
},
"license": "ISC",
"repository": "https://github.com/npm/node-semver",
"bin": {
"semver": "./bin/semver"
},
"files": [
"bin",
"range.bnf",
"semver.js"
],
"tap": {
"check-coverage": true
}
}
| {
"pile_set_name": "Github"
} |
package(default_visibility = ["//visibility:public"])
load(
"@io_bazel_rules_go//go:def.bzl",
"go_library",
)
go_library(
name = "go_default_library",
srcs = [
"doc.go",
"generated.pb.go",
"register.go",
"types.go",
"types_swagger_doc_generated.go",
"zz_generated.deepcopy.go",
],
importmap = "k8s.io/kubernetes/vendor/k8s.io/api/scheduling/v1alpha1",
importpath = "k8s.io/api/scheduling/v1alpha1",
deps = [
"//staging/src/k8s.io/api/core/v1:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/runtime:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/runtime/schema:go_default_library",
"//vendor/github.com/gogo/protobuf/proto:go_default_library",
],
)
filegroup(
name = "package-srcs",
srcs = glob(["**"]),
tags = ["automanaged"],
visibility = ["//visibility:private"],
)
filegroup(
name = "all-srcs",
srcs = [":package-srcs"],
tags = ["automanaged"],
)
| {
"pile_set_name": "Github"
} |
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "testing/gtest/include/gtest/gtest.h"
#include "base/bind.h"
#include "gpu/vulkan/tests/basic_vulkan_test.h"
#include "gpu/vulkan/vulkan_device_queue.h"
#include "gpu/vulkan/vulkan_fence_helper.h"
#include "gpu/vulkan/vulkan_function_pointers.h"
#include "gpu/vulkan/vulkan_util.h"
namespace gpu {
using VulkanFenceHelperTest = BasicVulkanTest;
TEST_F(VulkanFenceHelperTest, BasicFenceUsage) {
VulkanFenceHelper* fence_helper = GetDeviceQueue()->GetFenceHelper();
VkFence fence = VK_NULL_HANDLE;
ASSERT_TRUE(VK_SUCCESS == fence_helper->GetFence(&fence));
ASSERT_TRUE(fence != VK_NULL_HANDLE);
ASSERT_TRUE(VK_SUCCESS == vkQueueSubmit(GetDeviceQueue()->GetVulkanQueue(), 0,
nullptr, fence));
VulkanFenceHelper::FenceHandle fence_handle =
fence_helper->EnqueueFence(fence);
EXPECT_TRUE(fence_helper->Wait(fence_handle, UINT64_MAX));
EXPECT_TRUE(fence_helper->HasPassed(fence_handle));
}
TEST_F(VulkanFenceHelperTest, TestBasicCallback) {
VulkanFenceHelper* fence_helper = GetDeviceQueue()->GetFenceHelper();
bool cleanup_run = false;
fence_helper->EnqueueCleanupTaskForSubmittedWork(
base::BindOnce([](bool* cleanup_run, VulkanDeviceQueue* device_queue,
bool is_lost) { *cleanup_run = true; },
&cleanup_run));
VulkanFenceHelper::FenceHandle fence_handle =
fence_helper->GenerateCleanupFence();
EXPECT_TRUE(fence_handle.is_valid());
fence_helper->Wait(fence_handle, UINT64_MAX);
EXPECT_TRUE(cleanup_run);
}
TEST_F(VulkanFenceHelperTest, TestBasicCallbackExternalSubmission) {
VulkanFenceHelper* fence_helper = GetDeviceQueue()->GetFenceHelper();
bool cleanup_run = false;
fence_helper->EnqueueCleanupTaskForSubmittedWork(
base::BindOnce([](bool* cleanup_run, VulkanDeviceQueue* device_queue,
bool is_lost) { *cleanup_run = true; },
&cleanup_run));
VkFence fence = VK_NULL_HANDLE;
ASSERT_TRUE(VK_SUCCESS == fence_helper->GetFence(&fence));
ASSERT_TRUE(fence != VK_NULL_HANDLE);
ASSERT_TRUE(VK_SUCCESS == vkQueueSubmit(GetDeviceQueue()->GetVulkanQueue(), 0,
nullptr, fence));
VulkanFenceHelper::FenceHandle fence_handle =
fence_helper->EnqueueFence(fence);
EXPECT_TRUE(fence_handle.is_valid());
fence_helper->Wait(fence_handle, UINT64_MAX);
EXPECT_TRUE(cleanup_run);
}
TEST_F(VulkanFenceHelperTest, TestMultipleCallbacks) {
VulkanFenceHelper* fence_helper = GetDeviceQueue()->GetFenceHelper();
uint32_t cleanups_run = 0;
auto increment_cleanups_callback =
[](uint32_t expected_index, uint32_t* cleanups_run,
VulkanDeviceQueue* device_queue, bool is_lost) {
EXPECT_EQ(expected_index, *cleanups_run);
*cleanups_run = *cleanups_run + 1;
};
// Enqueue 5 callbacks.
for (int i = 0; i < 5; i++) {
fence_helper->EnqueueCleanupTaskForSubmittedWork(
base::BindOnce(increment_cleanups_callback, i, &cleanups_run));
}
// Generate a cleanup fence for the first 5 callbacks.
VulkanFenceHelper::FenceHandle fence_handle =
fence_helper->GenerateCleanupFence();
// Enqueue 5 more callbacks.
for (int i = 5; i < 10; i++) {
fence_helper->EnqueueCleanupTaskForSubmittedWork(
base::BindOnce(increment_cleanups_callback, i, &cleanups_run));
}
// Generate a cleanup fence for the next 5 callbacks.
fence_handle = fence_helper->GenerateCleanupFence();
EXPECT_TRUE(fence_handle.is_valid());
fence_helper->Wait(fence_handle, UINT64_MAX);
EXPECT_EQ(10u, cleanups_run);
}
TEST_F(VulkanFenceHelperTest, TestSkiaCallback) {
VulkanFenceHelper* fence_helper = GetDeviceQueue()->GetFenceHelper();
bool cleanup_run = false;
fence_helper->EnqueueCleanupTaskForSubmittedWork(
base::BindOnce([](bool* cleanup_run, VulkanDeviceQueue* device_queue,
bool is_lost) { *cleanup_run = true; },
&cleanup_run));
auto cleanup_closure = fence_helper->CreateExternalCallback();
EXPECT_FALSE(cleanup_run);
std::move(cleanup_closure).Run();
EXPECT_TRUE(cleanup_run);
}
TEST_F(VulkanFenceHelperTest, SkiaCallbackBeforeFences) {
VulkanFenceHelper* fence_helper = GetDeviceQueue()->GetFenceHelper();
uint32_t cleanups_run = 0;
auto increment_cleanups_callback =
[](uint32_t expected_index, uint32_t* cleanups_run,
VulkanDeviceQueue* device_queue, bool is_lost) {
EXPECT_EQ(expected_index, *cleanups_run);
*cleanups_run = *cleanups_run + 1;
};
// Enqueue 5 callbacks.
for (int i = 0; i < 5; i++) {
fence_helper->EnqueueCleanupTaskForSubmittedWork(
base::BindOnce(increment_cleanups_callback, i, &cleanups_run));
}
// The first 5 callbacks use a callback to trigger.
auto cleanup_closure = fence_helper->CreateExternalCallback();
// Enqueue 5 more callbacks.
for (int i = 5; i < 10; i++) {
fence_helper->EnqueueCleanupTaskForSubmittedWork(
base::BindOnce(increment_cleanups_callback, i, &cleanups_run));
}
// Generate a cleanup fence for the next 5 callbacks.
VulkanFenceHelper::FenceHandle fence_handle =
fence_helper->GenerateCleanupFence();
EXPECT_TRUE(fence_handle.is_valid());
// After waiting for the second fence, all callbacks should have run, Skia
// callbacks can be delayed, so we check future fences as well.
EXPECT_TRUE(fence_helper->Wait(fence_handle, UINT64_MAX));
EXPECT_EQ(10u, cleanups_run);
// Running the callback now should be a no-op.
std::move(cleanup_closure).Run();
EXPECT_EQ(10u, cleanups_run);
}
TEST_F(VulkanFenceHelperTest, SkiaCallbackAfterFences) {
VulkanFenceHelper* fence_helper = GetDeviceQueue()->GetFenceHelper();
uint32_t cleanups_run = 0;
auto increment_cleanups_callback =
[](uint32_t expected_index, uint32_t* cleanups_run,
VulkanDeviceQueue* device_queue, bool is_lost) {
EXPECT_EQ(expected_index, *cleanups_run);
*cleanups_run = *cleanups_run + 1;
};
// Enqueue 5 callbacks.
for (int i = 0; i < 5; i++) {
fence_helper->EnqueueCleanupTaskForSubmittedWork(
base::BindOnce(increment_cleanups_callback, i, &cleanups_run));
}
// The first 5 callbacks use a fence to trigger.
VulkanFenceHelper::FenceHandle fence_handle =
fence_helper->GenerateCleanupFence();
EXPECT_TRUE(fence_handle.is_valid());
// Call vkQueueWaitIdle() to make sure the |fence_handle| is passed.
vkQueueWaitIdle(queue());
// Enqueue 5 more callbacks.
for (int i = 5; i < 10; i++) {
fence_helper->EnqueueCleanupTaskForSubmittedWork(
base::BindOnce(increment_cleanups_callback, i, &cleanups_run));
}
// The next 5 callbacks use a callback to trigger.
auto cleanup_closure = fence_helper->CreateExternalCallback();
// Call the cleanup closure, all callbacks should run.
// Generate a cleanup fence for the next 5 callbacks.
std::move(cleanup_closure).Run();
EXPECT_EQ(10u, cleanups_run);
}
} // namespace gpu
| {
"pile_set_name": "Github"
} |
/*
* Copyright (C) Narf Industries <[email protected]>
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <libcgc.h>
#include <stdint.h>
#include "order.h"
Order *pop_order_from_list(Order **o_list) {
if (NULL == *o_list) return NULL;
Order *o = *o_list;
*o_list = (Order *)o->next;
return o;
}
void append_order_to_list(Order **o_list, Order *o) {
Order *cur = *o_list;
o->next = NULL;
if (NULL == cur) {
*o_list = o;
} else {
for (; NULL != cur->next; cur=(Order *)cur->next);
cur->next = o;
}
}
unsigned char get_order_list_size(Order *o_list) {
Order *cur = o_list;
unsigned char count = 0;
while (NULL != cur) {
cur=(Order *)cur->next;
count++;
}
return count;
}
| {
"pile_set_name": "Github"
} |
Title: Creating Scatterplots with Seaborn
Slug: seaborn_scatterplot
Summary: Creating Scatterplots with Seaborn
Date: 2016-05-01 12:00
Category: Python
Tags: Data Visualization
Authors: Chris Albon
## Preliminaries
```python
import pandas as pd
%matplotlib inline
import random
import matplotlib.pyplot as plt
import seaborn as sns
```
## Create data
```python
# Create empty dataframe
df = pd.DataFrame()
# Add columns
df['x'] = random.sample(range(1, 1000), 5)
df['y'] = random.sample(range(1, 1000), 5)
df['z'] = [1,0,0,1,0]
df['k'] = ['male','male','male','female','female']
```
```python
# View first few rows of data
df.head()
```
<div>
<style>
.dataframe thead tr:only-child th {
text-align: right;
}
.dataframe thead th {
text-align: left;
}
.dataframe tbody tr th {
vertical-align: top;
}
</style>
<table border="1" class="dataframe">
<thead>
<tr style="text-align: right;">
<th></th>
<th>x</th>
<th>y</th>
<th>z</th>
<th>k</th>
</tr>
</thead>
<tbody>
<tr>
<th>0</th>
<td>466</td>
<td>948</td>
<td>1</td>
<td>male</td>
</tr>
<tr>
<th>1</th>
<td>832</td>
<td>481</td>
<td>0</td>
<td>male</td>
</tr>
<tr>
<th>2</th>
<td>978</td>
<td>465</td>
<td>0</td>
<td>male</td>
</tr>
<tr>
<th>3</th>
<td>510</td>
<td>206</td>
<td>1</td>
<td>female</td>
</tr>
<tr>
<th>4</th>
<td>848</td>
<td>357</td>
<td>0</td>
<td>female</td>
</tr>
</tbody>
</table>
</div>
## Scatterplot
```python
# Set style of scatterplot
sns.set_context("notebook", font_scale=1.1)
sns.set_style("ticks")
# Create scatterplot of dataframe
sns.lmplot('x', # Horizontal axis
'y', # Vertical axis
data=df, # Data source
fit_reg=False, # Don't fix a regression line
hue="z", # Set color
scatter_kws={"marker": "D", # Set marker style
"s": 100}) # S marker size
# Set title
plt.title('Histogram of IQ')
# Set x-axis label
plt.xlabel('Time')
# Set y-axis label
plt.ylabel('Deaths')
```
<matplotlib.text.Text at 0x112b7bb70>

| {
"pile_set_name": "Github"
} |
using UnityEngine;
using UnityEditor.Collaboration;
using UnityEditor.Web;
using UnityEditor.Connect;
namespace UnityEditor
{
[InitializeOnLoad]
internal class WebViewStatic : ScriptableSingleton<WebViewStatic>
{
[SerializeField]
WebView m_WebView;
static public WebView GetWebView()
{
return instance.m_WebView;
}
static public void SetWebView(WebView webView)
{
instance.m_WebView = webView;
}
}
[InitializeOnLoad]
internal class CollabToolbarWindow : WebViewEditorStaticWindow, IHasCustomMenu
{
internal override WebView webView
{
get {return WebViewStatic.GetWebView(); }
set {WebViewStatic.SetWebView(value); }
}
private const string kWindowName = "Unity Collab Toolbar";
private static long s_LastClosedTime;
private static CollabToolbarWindow s_CollabToolbarWindow;
public static bool s_ToolbarIsVisible = false;
const int kWindowWidth = 320;
const int kWindowHeight = 350;
public static void CloseToolbar()
{
foreach (CollabToolbarWindow window in Resources.FindObjectsOfTypeAll<CollabToolbarWindow>())
window.Close();
}
[MenuItem("Window/Asset Management/Collab Toolbar", false /*IsValidateFunction*/, 2, true /* IsInternalMenu */)]
public static CollabToolbarWindow ShowToolbarWindow()
{
//Create a new window if it does not exist
if (s_CollabToolbarWindow == null)
{
s_CollabToolbarWindow = GetWindow<CollabToolbarWindow>(false, kWindowName) as CollabToolbarWindow;
}
return s_CollabToolbarWindow;
}
[MenuItem("Window/Asset Management/Collab Toolbar", true /*IsValidateFunction*/)]
public static bool ValidateShowToolbarWindow()
{
return true;
}
public static bool IsVisible()
{
return s_ToolbarIsVisible;
}
public static bool ShowCenteredAtPosition(Rect buttonRect)
{
buttonRect.x -= kWindowWidth / 2;
// We could not use realtimeSinceStartUp since it is set to 0 when entering/exitting playmode, we assume an increasing time when comparing time.
long nowMilliSeconds = System.DateTime.Now.Ticks / System.TimeSpan.TicksPerMillisecond;
bool justClosed = nowMilliSeconds < s_LastClosedTime + 50;
if (!justClosed)
{
// Method may have been triggered programmatically, without a user event to consume.
if (Event.current.type != EventType.Layout)
{
Event.current.Use();
}
if (s_CollabToolbarWindow == null)
s_CollabToolbarWindow = CreateInstance<CollabToolbarWindow>() as CollabToolbarWindow;
var windowSize = new Vector2(kWindowWidth, kWindowHeight);
s_CollabToolbarWindow.initialOpenUrl = "file:///" + EditorApplication.userJavascriptPackagesPath + "unityeditor-collab-toolbar/dist/index.html";
s_CollabToolbarWindow.Init();
s_CollabToolbarWindow.ShowAsDropDown(buttonRect, windowSize);
s_CollabToolbarWindow.OnFocus();
return true;
}
return false;
}
// Receives HTML title
public void OnReceiveTitle(string title)
{
titleContent.text = title;
}
public new void OnInitScripting()
{
base.OnInitScripting();
}
public override void OnEnable()
{
minSize = new Vector2(kWindowWidth, kWindowHeight);
maxSize = new Vector2(kWindowWidth, kWindowHeight);
initialOpenUrl = "file:///" + EditorApplication.userJavascriptPackagesPath + "unityeditor-collab-toolbar/dist/index.html";
base.OnEnable();
s_ToolbarIsVisible = true;
}
internal new void OnDisable()
{
s_LastClosedTime = System.DateTime.Now.Ticks / System.TimeSpan.TicksPerMillisecond;
if (s_CollabToolbarWindow)
{
s_ToolbarIsVisible = false;
NotifyVisibility(s_ToolbarIsVisible);
}
s_CollabToolbarWindow = null;
base.OnDisable();
}
public new void OnDestroy()
{
OnLostFocus();
base.OnDestroy();
}
}
}
| {
"pile_set_name": "Github"
} |
0 1 foo 1 0
| {
"pile_set_name": "Github"
} |
package org.zstack.header.vm
import org.zstack.header.errorcode.ErrorCode
doc {
title "云主机控制台地址"
ref {
name "error"
path "org.zstack.header.vm.APIGetVmConsoleAddressReply.error"
desc "错误码,若不为null,则表示操作失败, 操作成功时该字段为null", false
type "ErrorCode"
since "0.6"
clz ErrorCode.class
}
field {
name "hostIp"
desc "云主机运行物理机IP"
type "String"
since "0.6"
}
field {
name "port"
desc "云主机控制台端口"
type "int"
since "0.6"
}
field {
name "protocol"
desc "云主机控制台协议,vnc或spice或vncAndSpice"
type "String"
since "0.6"
}
ref {
name "vdiPortInfo"
path "org.zstack.header.vm.APIGetVmConsoleAddressReply.vdiPortInfo"
desc "vdi端口号信息"
type "VdiPortInfo"
since "3.7"
clz VdiPortInfo.class
}
field {
name "success"
desc "操作是否成功"
type "boolean"
since "0.6"
}
}
| {
"pile_set_name": "Github"
} |
/*
* Copyright 2018 Google LLC
*
* 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.
*/
// included by json_value.cpp
// everything is within Json namespace
// //////////////////////////////////////////////////////////////////
// //////////////////////////////////////////////////////////////////
// //////////////////////////////////////////////////////////////////
// class ValueIteratorBase
// //////////////////////////////////////////////////////////////////
// //////////////////////////////////////////////////////////////////
// //////////////////////////////////////////////////////////////////
ValueIteratorBase::ValueIteratorBase()
#ifndef JSON_VALUE_USE_INTERNAL_MAP
: current_()
, isNull_( true )
{
}
#else
: isArray_( true )
, isNull_( true )
{
iterator_.array_ = ValueInternalArray::IteratorState();
}
#endif
#ifndef JSON_VALUE_USE_INTERNAL_MAP
ValueIteratorBase::ValueIteratorBase( const Value::ObjectValues::iterator ¤t )
: current_( current )
, isNull_( false )
{
}
#else
ValueIteratorBase::ValueIteratorBase( const ValueInternalArray::IteratorState &state )
: isArray_( true )
{
iterator_.array_ = state;
}
ValueIteratorBase::ValueIteratorBase( const ValueInternalMap::IteratorState &state )
: isArray_( false )
{
iterator_.map_ = state;
}
#endif
Value &
ValueIteratorBase::deref() const
{
#ifndef JSON_VALUE_USE_INTERNAL_MAP
return current_->second;
#else
if ( isArray_ )
return ValueInternalArray::dereference( iterator_.array_ );
return ValueInternalMap::value( iterator_.map_ );
#endif
}
void
ValueIteratorBase::increment()
{
#ifndef JSON_VALUE_USE_INTERNAL_MAP
++current_;
#else
if ( isArray_ )
ValueInternalArray::increment( iterator_.array_ );
ValueInternalMap::increment( iterator_.map_ );
#endif
}
void
ValueIteratorBase::decrement()
{
#ifndef JSON_VALUE_USE_INTERNAL_MAP
--current_;
#else
if ( isArray_ )
ValueInternalArray::decrement( iterator_.array_ );
ValueInternalMap::decrement( iterator_.map_ );
#endif
}
ValueIteratorBase::difference_type
ValueIteratorBase::computeDistance( const SelfType &other ) const
{
#ifndef JSON_VALUE_USE_INTERNAL_MAP
# ifdef JSON_USE_CPPTL_SMALLMAP
return current_ - other.current_;
# else
// Iterator for null value are initialized using the default
// constructor, which initialize current_ to the default
// std::map::iterator. As begin() and end() are two instance
// of the default std::map::iterator, they can not be compared.
// To allow this, we handle this comparison specifically.
if ( isNull_ && other.isNull_ )
{
return 0;
}
// Usage of std::distance is not portable (does not compile with Sun Studio 12 RogueWave STL,
// which is the one used by default).
// Using a portable hand-made version for non random iterator instead:
// return difference_type( std::distance( current_, other.current_ ) );
difference_type myDistance = 0;
for ( Value::ObjectValues::iterator it = current_; it != other.current_; ++it )
{
++myDistance;
}
return myDistance;
# endif
#else
if ( isArray_ )
return ValueInternalArray::distance( iterator_.array_, other.iterator_.array_ );
return ValueInternalMap::distance( iterator_.map_, other.iterator_.map_ );
#endif
}
bool
ValueIteratorBase::isEqual( const SelfType &other ) const
{
#ifndef JSON_VALUE_USE_INTERNAL_MAP
if ( isNull_ )
{
return other.isNull_;
}
return current_ == other.current_;
#else
if ( isArray_ )
return ValueInternalArray::equals( iterator_.array_, other.iterator_.array_ );
return ValueInternalMap::equals( iterator_.map_, other.iterator_.map_ );
#endif
}
void
ValueIteratorBase::copy( const SelfType &other )
{
#ifndef JSON_VALUE_USE_INTERNAL_MAP
current_ = other.current_;
#else
if ( isArray_ )
iterator_.array_ = other.iterator_.array_;
iterator_.map_ = other.iterator_.map_;
#endif
}
Value
ValueIteratorBase::key() const
{
#ifndef JSON_VALUE_USE_INTERNAL_MAP
const Value::CZString czstring = (*current_).first;
if ( czstring.c_str() )
{
if ( czstring.isStaticString() )
return Value( StaticString( czstring.c_str() ) );
return Value( czstring.c_str() );
}
return Value( czstring.index() );
#else
if ( isArray_ )
return Value( ValueInternalArray::indexOf( iterator_.array_ ) );
bool isStatic;
const char *memberName = ValueInternalMap::key( iterator_.map_, isStatic );
if ( isStatic )
return Value( StaticString( memberName ) );
return Value( memberName );
#endif
}
UInt
ValueIteratorBase::index() const
{
#ifndef JSON_VALUE_USE_INTERNAL_MAP
const Value::CZString czstring = (*current_).first;
if ( !czstring.c_str() )
return czstring.index();
return Value::UInt( -1 );
#else
if ( isArray_ )
return Value::UInt( ValueInternalArray::indexOf( iterator_.array_ ) );
return Value::UInt( -1 );
#endif
}
const char *
ValueIteratorBase::memberName() const
{
#ifndef JSON_VALUE_USE_INTERNAL_MAP
const char *name = (*current_).first.c_str();
return name ? name : "";
#else
if ( !isArray_ )
return ValueInternalMap::key( iterator_.map_ );
return "";
#endif
}
// //////////////////////////////////////////////////////////////////
// //////////////////////////////////////////////////////////////////
// //////////////////////////////////////////////////////////////////
// class ValueConstIterator
// //////////////////////////////////////////////////////////////////
// //////////////////////////////////////////////////////////////////
// //////////////////////////////////////////////////////////////////
ValueConstIterator::ValueConstIterator()
{
}
#ifndef JSON_VALUE_USE_INTERNAL_MAP
ValueConstIterator::ValueConstIterator( const Value::ObjectValues::iterator ¤t )
: ValueIteratorBase( current )
{
}
#else
ValueConstIterator::ValueConstIterator( const ValueInternalArray::IteratorState &state )
: ValueIteratorBase( state )
{
}
ValueConstIterator::ValueConstIterator( const ValueInternalMap::IteratorState &state )
: ValueIteratorBase( state )
{
}
#endif
ValueConstIterator &
ValueConstIterator::operator =( const ValueIteratorBase &other )
{
copy( other );
return *this;
}
// //////////////////////////////////////////////////////////////////
// //////////////////////////////////////////////////////////////////
// //////////////////////////////////////////////////////////////////
// class ValueIterator
// //////////////////////////////////////////////////////////////////
// //////////////////////////////////////////////////////////////////
// //////////////////////////////////////////////////////////////////
ValueIterator::ValueIterator()
{
}
#ifndef JSON_VALUE_USE_INTERNAL_MAP
ValueIterator::ValueIterator( const Value::ObjectValues::iterator ¤t )
: ValueIteratorBase( current )
{
}
#else
ValueIterator::ValueIterator( const ValueInternalArray::IteratorState &state )
: ValueIteratorBase( state )
{
}
ValueIterator::ValueIterator( const ValueInternalMap::IteratorState &state )
: ValueIteratorBase( state )
{
}
#endif
ValueIterator::ValueIterator( const ValueConstIterator &other )
: ValueIteratorBase( other )
{
}
ValueIterator::ValueIterator( const ValueIterator &other )
: ValueIteratorBase( other )
{
}
ValueIterator &
ValueIterator::operator =( const SelfType &other )
{
copy( other );
return *this;
}
| {
"pile_set_name": "Github"
} |
/* Portuguese initialisation for the jQuery UI date picker plugin. */
jQuery(function($){
$.datepicker.regional['pt'] = {
closeText: 'Fechar',
prevText: '<Anterior',
nextText: 'Seguinte',
currentText: 'Hoje',
monthNames: ['Janeiro','Fevereiro','Março','Abril','Maio','Junho',
'Julho','Agosto','Setembro','Outubro','Novembro','Dezembro'],
monthNamesShort: ['Jan','Fev','Mar','Abr','Mai','Jun',
'Jul','Ago','Set','Out','Nov','Dez'],
dayNames: ['Domingo','Segunda-feira','Terça-feira','Quarta-feira','Quinta-feira','Sexta-feira','Sábado'],
dayNamesShort: ['Dom','Seg','Ter','Qua','Qui','Sex','Sáb'],
dayNamesMin: ['Dom','Seg','Ter','Qua','Qui','Sex','Sáb'],
weekHeader: 'Sem',
dateFormat: 'dd/mm/yy',
firstDay: 0,
isRTL: false,
showMonthAfterYear: false,
yearSuffix: ''};
$.datepicker.setDefaults($.datepicker.regional['pt']);
});
| {
"pile_set_name": "Github"
} |
# https://deeplearningcourses.com/c/deep-learning-recurrent-neural-networks-in-python
# https://udemy.com/deep-learning-recurrent-neural-networks-in-python
from __future__ import print_function, division
from future.utils import iteritems
from builtins import range
# Note: you may need to update your version of future
# sudo pip install -U future
import tensorflow as tf
import numpy as np
import matplotlib.pyplot as plt
from sklearn.utils import shuffle
from util import init_weight, get_robert_frost, get_wikipedia_data
class SimpleRNN:
def __init__(self, D, M, V, f, session):
self.D = D # dimensionality of word embedding
self.M = M # hidden layer size
self.V = V # vocabulary size
self.f = f
self.session = session
def set_session(self, session):
self.session = session
def build(self, We, Wx, Wh, bh, h0, Wo, bo):
# make them tf Variables
self.We = tf.Variable(We)
self.Wx = tf.Variable(Wx)
self.Wh = tf.Variable(Wh)
self.bh = tf.Variable(bh)
self.h0 = tf.Variable(h0)
self.Wo = tf.Variable(Wo)
self.bo = tf.Variable(bo)
self.params = [self.We, self.Wx, self.Wh, self.bh, self.h0, self.Wo, self.bo]
# for easy access
V = self.V
D = self.D
M = self.M
# placeholders
self.tfX = tf.placeholder(tf.int32, shape=(None,), name='X')
self.tfY = tf.placeholder(tf.int32, shape=(None,), name='Y')
# convert word indexes to word vectors
# this would be equivalent to doing
# We[tfX] in Numpy / Theano
# or:
# X_one_hot = one_hot_encode(X)
# X_one_hot.dot(We)
XW = tf.nn.embedding_lookup(We, self.tfX)
# multiply it by input->hidden so we don't have to do
# it inside recurrence
XW_Wx = tf.matmul(XW, self.Wx)
def recurrence(h_t1, XW_Wx_t):
# returns h(t), y(t)
h_t1 = tf.reshape(h_t1, (1, M))
h_t = self.f(XW_Wx_t + tf.matmul(h_t1, self.Wh) + self.bh)
h_t = tf.reshape(h_t, (M,))
return h_t
h = tf.scan(
fn=recurrence,
elems=XW_Wx,
initializer=self.h0,
)
# output
logits = tf.matmul(h, self.Wo) + self.bo
prediction = tf.argmax(logits, 1)
self.output_probs = tf.nn.softmax(logits)
nce_weights = tf.transpose(self.Wo, [1,0]) # needs to be VxD, not DxV
nce_biases = self.bo
h = tf.reshape(h, (-1, M))
labels = tf.reshape(self.tfY, (-1, 1))
self.cost = tf.reduce_mean(
tf.nn.sampled_softmax_loss(
weights=nce_weights,
biases=nce_biases,
labels=labels,
inputs=h,
num_sampled=50, # number of negative samples
num_classes=V
)
)
self.predict_op = prediction
self.train_op = tf.train.AdamOptimizer(1e-2).minimize(self.cost)
# self.train_op = tf.train.MomentumOptimizer(1e-3, 0.9).minimize(self.cost)
# init all variables
init = tf.global_variables_initializer()
self.session.run(init)
def fit(self, X, epochs=500, show_fig=False):
N = len(X)
D = self.D
M = self.M
V = self.V
# initial weights
We = init_weight(V, D).astype(np.float32)
Wx = init_weight(D, M).astype(np.float32)
Wh = init_weight(M, M).astype(np.float32)
bh = np.zeros(M).astype(np.float32)
h0 = np.zeros(M).astype(np.float32)
Wo = init_weight(M, V).astype(np.float32)
bo = np.zeros(V).astype(np.float32)
# build tensorflow functions
self.build(We, Wx, Wh, bh, h0, Wo, bo)
# sentence input:
# [START, w1, w2, ..., wn]
# sentence target:
# [w1, w2, w3, ..., END]
costs = []
n_total = sum((len(sentence)+1) for sentence in X)
for i in range(epochs):
X = shuffle(X)
n_correct = 0
cost = 0
for j in range(N):
# problem! many words --> END token are overrepresented
# result: generated lines will be very short
# we will try to fix in a later iteration
# BAD! magic numbers 0 and 1...
input_sequence = [0] + X[j]
output_sequence = X[j] + [1]
# we set 0 to start and 1 to end
_, c, p = self.session.run(
(self.train_op, self.cost, self.predict_op),
feed_dict={self.tfX: input_sequence, self.tfY: output_sequence}
)
# print "p:", p
cost += c
# print "j:", j, "c:", c/len(X[j]+1)
for pj, xj in zip(p, output_sequence):
if pj == xj:
n_correct += 1
print("i:", i, "cost:", cost, "correct rate:", (float(n_correct)/n_total))
costs.append(cost)
if show_fig:
plt.plot(costs)
plt.show()
def predict(self, prev_words):
# don't use argmax, so that we can sample
# from this probability distribution
return self.session.run(
self.output_probs,
feed_dict={self.tfX: prev_words}
)
def save(self, filename):
actual_params = self.session.run(self.params)
np.savez(filename, *[p for p in actual_params])
@staticmethod
def load(filename, activation, session):
# TODO: would prefer to save activation to file too
npz = np.load(filename)
We = npz['arr_0']
Wx = npz['arr_1']
Wh = npz['arr_2']
bh = npz['arr_3']
h0 = npz['arr_4']
Wo = npz['arr_5']
bo = npz['arr_6']
V, D = We.shape
_, M = Wx.shape
rnn = SimpleRNN(D, M, V, activation, session)
rnn.build(We, Wx, Wh, bh, h0, Wo, bo)
return rnn
def generate(self, pi, word2idx):
# convert word2idx -> idx2word
idx2word = {v:k for k,v in iteritems(word2idx)}
V = len(pi)
# generate 4 lines at a time
n_lines = 0
# why? because using the START symbol will always yield the same first word!
X = [ np.random.choice(V, p=pi) ]
print(idx2word[X[0]], end=" ")
while n_lines < 4:
probs = self.predict(X)[-1]
word_idx = np.random.choice(V, p=probs)
X.append(word_idx)
if word_idx > 1:
# it's a real word, not start/end token
word = idx2word[word_idx]
print(word, end=" ")
elif word_idx == 1:
# end token
n_lines += 1
print('')
if n_lines < 4:
X = [ np.random.choice(V, p=pi) ] # reset to start of line
print(idx2word[X[0]], end=" ")
def train_poetry(session, dims, savefile):
sentences, word2idx = get_robert_frost()
rnn = SimpleRNN(dims, dims, len(word2idx), tf.nn.relu, session)
rnn.fit(sentences, epochs=17, show_fig=True)
rnn.save(savefile)
def generate_poetry(session, savefile):
sentences, word2idx = get_robert_frost()
rnn = SimpleRNN.load(savefile, tf.nn.relu, session)
# determine initial state distribution for starting sentences
V = len(word2idx)
pi = np.zeros(V)
for sentence in sentences:
pi[sentence[0]] += 1
pi /= pi.sum()
rnn.generate(pi, word2idx)
if __name__ == '__main__':
dims = 50
savefile = 'RNN_D50_M50_tf.npz'
session = tf.InteractiveSession()
train_poetry(session, dims, savefile)
generate_poetry(session, savefile)
| {
"pile_set_name": "Github"
} |
//
// Demonstrate using the Fl_Progress widget in an application - erco 05/02/2005
//
// Copyright 2005,2012 Greg Ercolano.
// Copyright 1998-2017 by Bill Spitzak and others.
//
// This library is free software. Distribution and use rights are outlined in
// the file "COPYING" which should have been included with this file. If this
// file is missing or damaged, see the license at:
//
// https://www.fltk.org/COPYING.php
//
// Please see the following page on how to report bugs and issues:
//
// https://www.fltk.org/bugs.php
//
#include <stdio.h>
#include <FL/Fl.H>
#include <FL/Fl_Window.H>
#include <FL/Fl_Button.H>
#include <FL/Fl_Progress.H>
#ifdef _WIN32
// WINDOWS
#include <windows.h>
#define usleep(v) Sleep(v/1000)
#else /* _WIN32 */
// UNIX
#include <unistd.h> // usleep
#endif /* _WIN32 */
// Button callback
void butt_cb(Fl_Widget *butt, void *data) {
// Deactivate the button
butt->deactivate(); // prevent button from being pressed again
Fl::check(); // give fltk some cpu to gray out button
// Make the progress bar
Fl_Window *w = (Fl_Window*)data; // access parent window
w->begin(); // add progress bar to it..
Fl_Progress *progress = new Fl_Progress(10,50,200,30);
progress->minimum(0); // set progress range to be 0.0 ~ 1.0
progress->maximum(1);
progress->color(0x88888800); // background color
progress->selection_color(0x4444ff00); // progress bar color
progress->labelcolor(FL_WHITE); // percent text color
w->end(); // end adding to window
// Computation loop..
for ( int t=1; t<=500; t++ ) {
progress->value(t/500.0); // update progress bar with 0.0 ~ 1.0 value
char percent[10];
sprintf(percent, "%d%%", int((t/500.0)*100.0));
progress->label(percent); // update progress bar's label
Fl::check(); // give fltk some cpu to update the screen
usleep(1000); // 'your stuff' that's compute intensive
}
// Cleanup
w->remove(progress); // remove progress bar from window
delete(progress); // deallocate it
butt->activate(); // reactivate button
w->redraw(); // tell window to redraw now that progress removed
}
// Main
int main() {
Fl_Window win(220,90);
Fl_Button butt(10,10,100,25,"Press");
butt.callback(butt_cb, &win);
win.resizable(win);
win.show();
return(Fl::run());
}
| {
"pile_set_name": "Github"
} |
# Copyright 2017 The TensorFlow Authors. 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.
# ==============================================================================
"""Defines the CycleGAN generator and discriminator networks."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import google3
import numpy as np
import tensorflow as tf
layers = tf.contrib.layers
def cyclegan_arg_scope(instance_norm_center=True,
instance_norm_scale=True,
instance_norm_epsilon=0.001,
weights_init_stddev=0.02,
weight_decay=0.0):
"""Returns a default argument scope for all generators and discriminators.
Args:
instance_norm_center: Whether instance normalization applies centering.
instance_norm_scale: Whether instance normalization applies scaling.
instance_norm_epsilon: Small float added to the variance in the instance
normalization to avoid dividing by zero.
weights_init_stddev: Standard deviation of the random values to initialize
the convolution kernels with.
weight_decay: Magnitude of weight decay applied to all convolution kernel
variables of the generator.
Returns:
An arg-scope.
"""
instance_norm_params = {
'center': instance_norm_center,
'scale': instance_norm_scale,
'epsilon': instance_norm_epsilon,
}
weights_regularizer = None
if weight_decay and weight_decay > 0.0:
weights_regularizer = layers.l2_regularizer(weight_decay)
with tf.contrib.framework.arg_scope(
[layers.conv2d],
normalizer_fn=layers.instance_norm,
normalizer_params=instance_norm_params,
weights_initializer=tf.random_normal_initializer(0, weights_init_stddev),
weights_regularizer=weights_regularizer) as sc:
return sc
def cyclegan_upsample(net, num_outputs, stride, method='conv2d_transpose'):
"""Upsamples the given inputs.
Args:
net: A Tensor of size [batch_size, height, width, filters].
num_outputs: The number of output filters.
stride: A list of 2 scalars or a 1x2 Tensor indicating the scale,
relative to the inputs, of the output dimensions. For example, if kernel
size is [2, 3], then the output height and width will be twice and three
times the input size.
method: The upsampling method: 'nn_upsample_conv', 'bilinear_upsample_conv',
or 'conv2d_transpose'.
Returns:
A Tensor which was upsampled using the specified method.
Raises:
ValueError: if `method` is not recognized.
"""
with tf.variable_scope('upconv'):
net_shape = tf.shape(net)
height = net_shape[1]
width = net_shape[2]
# Reflection pad by 1 in spatial dimensions (axes 1, 2 = h, w) to make a 3x3
# 'valid' convolution produce an output with the same dimension as the
# input.
spatial_pad_1 = np.array([[0, 0], [1, 1], [1, 1], [0, 0]])
if method == 'nn_upsample_conv':
net = tf.image.resize_nearest_neighbor(
net, [stride[0] * height, stride[1] * width])
net = tf.pad(net, spatial_pad_1, 'REFLECT')
net = layers.conv2d(net, num_outputs, kernel_size=[3, 3], padding='valid')
if method == 'bilinear_upsample_conv':
net = tf.image.resize_bilinear(
net, [stride[0] * height, stride[1] * width])
net = tf.pad(net, spatial_pad_1, 'REFLECT')
net = layers.conv2d(net, num_outputs, kernel_size=[3, 3], padding='valid')
elif method == 'conv2d_transpose':
net = layers.conv2d_transpose(
net, num_outputs, kernel_size=[3, 3], stride=stride, padding='same')
else:
raise ValueError('Unknown method: [%s]', method)
return net
def _dynamic_or_static_shape(tensor):
shape = tf.shape(tensor)
static_shape = tf.contrib.util.constant_value(shape)
return static_shape if static_shape is not None else shape
def cyclegan_generator_resnet(images,
arg_scope_fn=cyclegan_arg_scope,
num_resnet_blocks=6,
num_filters=64,
upsample_fn=cyclegan_upsample,
kernel_size=3,
num_outputs=3,
tanh_linear_slope=0.0,
is_training=False):
"""Defines the cyclegan resnet network architecture.
As closely as possible following
https://github.com/junyanz/CycleGAN/blob/master/models/architectures.lua#L232
FYI: This network requires input height and width to be divisible by 4 in
order to generate an output with shape equal to input shape. Assertions will
catch this if input dimensions are known at graph construction time, but
there's no protection if unknown at graph construction time (you'll see an
error).
Args:
images: Input image tensor of shape [batch_size, h, w, 3].
arg_scope_fn: Function to create the global arg_scope for the network.
num_resnet_blocks: Number of ResNet blocks in the middle of the generator.
num_filters: Number of filters of the first hidden layer.
upsample_fn: Upsampling function for the decoder part of the generator.
kernel_size: Size w or list/tuple [h, w] of the filter kernels for all inner
layers.
num_outputs: Number of output layers. Defaults to 3 for RGB.
tanh_linear_slope: Slope of the linear function to add to the tanh over the
logits.
is_training: Whether the network is created in training mode or inference
only mode. Not actually needed, just for compliance with other generator
network functions.
Returns:
A `Tensor` representing the model output and a dictionary of model end
points.
Raises:
ValueError: If the input height or width is known at graph construction time
and not a multiple of 4.
"""
# Neither dropout nor batch norm -> dont need is_training
del is_training
end_points = {}
input_size = images.shape.as_list()
height, width = input_size[1], input_size[2]
if height and height % 4 != 0:
raise ValueError('The input height must be a multiple of 4.')
if width and width % 4 != 0:
raise ValueError('The input width must be a multiple of 4.')
if not isinstance(kernel_size, (list, tuple)):
kernel_size = [kernel_size, kernel_size]
kernel_height = kernel_size[0]
kernel_width = kernel_size[1]
pad_top = (kernel_height - 1) // 2
pad_bottom = kernel_height // 2
pad_left = (kernel_width - 1) // 2
pad_right = kernel_width // 2
paddings = np.array(
[[0, 0], [pad_top, pad_bottom], [pad_left, pad_right], [0, 0]],
dtype=np.int32)
spatial_pad_3 = np.array([[0, 0], [3, 3], [3, 3], [0, 0]])
with tf.contrib.framework.arg_scope(arg_scope_fn()):
###########
# Encoder #
###########
with tf.variable_scope('input'):
# 7x7 input stage
net = tf.pad(images, spatial_pad_3, 'REFLECT')
net = layers.conv2d(net, num_filters, kernel_size=[7, 7], padding='VALID')
end_points['encoder_0'] = net
with tf.variable_scope('encoder'):
with tf.contrib.framework.arg_scope(
[layers.conv2d],
kernel_size=kernel_size,
stride=2,
activation_fn=tf.nn.relu,
padding='VALID'):
net = tf.pad(net, paddings, 'REFLECT')
net = layers.conv2d(net, num_filters * 2)
end_points['encoder_1'] = net
net = tf.pad(net, paddings, 'REFLECT')
net = layers.conv2d(net, num_filters * 4)
end_points['encoder_2'] = net
###################
# Residual Blocks #
###################
with tf.variable_scope('residual_blocks'):
with tf.contrib.framework.arg_scope(
[layers.conv2d],
kernel_size=kernel_size,
stride=1,
activation_fn=tf.nn.relu,
padding='VALID'):
for block_id in xrange(num_resnet_blocks):
with tf.variable_scope('block_{}'.format(block_id)):
res_net = tf.pad(net, paddings, 'REFLECT')
res_net = layers.conv2d(res_net, num_filters * 4)
res_net = tf.pad(res_net, paddings, 'REFLECT')
res_net = layers.conv2d(res_net, num_filters * 4,
activation_fn=None)
net += res_net
end_points['resnet_block_%d' % block_id] = net
###########
# Decoder #
###########
with tf.variable_scope('decoder'):
with tf.contrib.framework.arg_scope(
[layers.conv2d],
kernel_size=kernel_size,
stride=1,
activation_fn=tf.nn.relu):
with tf.variable_scope('decoder1'):
net = upsample_fn(net, num_outputs=num_filters * 2, stride=[2, 2])
end_points['decoder1'] = net
with tf.variable_scope('decoder2'):
net = upsample_fn(net, num_outputs=num_filters, stride=[2, 2])
end_points['decoder2'] = net
with tf.variable_scope('output'):
net = tf.pad(net, spatial_pad_3, 'REFLECT')
logits = layers.conv2d(
net,
num_outputs, [7, 7],
activation_fn=None,
normalizer_fn=None,
padding='valid')
logits = tf.reshape(logits, _dynamic_or_static_shape(images))
end_points['logits'] = logits
end_points['predictions'] = tf.tanh(logits) + logits * tanh_linear_slope
return end_points['predictions'], end_points
| {
"pile_set_name": "Github"
} |
//
// DisjunctiveFacetingsTests.swift
// InstantSearchCore
//
// Created by Vladislav Fitc on 26/06/2019.
// Copyright © 2019 Algolia. All rights reserved.
//
import Foundation
import XCTest
@testable import InstantSearchCore
import AlgoliaSearchClient
class DisjunctiveFacetingTests: XCTestCase {
class TestDelegate: DisjunctiveFacetingDelegate {
let disjunctiveFacetsAttributes: Set<Attribute>
let filterGroups: [FilterGroupType]
init(disjunctiveFacetsAttributes: Set<Attribute>, filterGroups: [FilterGroupType]) {
self.disjunctiveFacetsAttributes = disjunctiveFacetsAttributes
self.filterGroups = filterGroups
}
func toFilterGroups() -> [FilterGroupType] {
return filterGroups
}
}
func testMergeResults() {
let query = Query()
let queryBuilder = QueryBuilder(query: query, filterGroups: [
FilterGroup.Or(filters: [Filter.Facet(attribute: "price", floatValue: 100)], name: "price"),
FilterGroup.Or(filters: [Filter.Facet(attribute: "pubYear", floatValue: 2000)], name: "pubYear")
])
let res1 = try! SearchResponse(jsonFilename: "DisjFacetingResult1.json")
let res2 = try! SearchResponse(jsonFilename: "DisjFacetingResult2.json")
let res3 = try! SearchResponse(jsonFilename: "DisjFacetingResult3.json")
do {
let output = try queryBuilder.aggregate([res1, res2, res3])
XCTAssertEqual(output.facetStats?.count, 2)
XCTAssertEqual(output.disjunctiveFacets?.count, 2)
XCTAssertEqual(output.disjunctiveFacets?.map { $0.key }.contains("price"), true)
XCTAssertEqual(output.disjunctiveFacets?.map { $0.key }.contains("pubYear"), true)
} catch let error {
XCTFail("\(error)")
}
}
func testMultipleDisjunctiveGroupsOfSameType() {
let query = Query()
let colorGroup = FilterGroup.Or<Filter.Facet>(filters: [.init(attribute: "color", stringValue: "red"), .init(attribute: "color", stringValue: "green")], name: "color")
let sizeGroup = FilterGroup.Or<Filter.Facet>(filters: [.init(attribute: "size", stringValue: "m"), .init(attribute: "size", stringValue: "s")], name: "size")
let filterGroups: [FilterGroupType] = [colorGroup, sizeGroup]
let queryBuilder = QueryBuilder(query: query, filterGroups: filterGroups)
let queries = queryBuilder.build()
let andQuery = queries.first!
XCTAssertNil(andQuery.facets)
XCTAssertEqual(andQuery.filters, """
( "color":"red" OR "color":"green" ) AND ( "size":"m" OR "size":"s" )
""")
for query in queries[1...] {
switch query.facets {
case ["size"]:
XCTAssertEqual(query.filters, """
( "color":"red" OR "color":"green" )
""")
case ["color"]:
XCTAssertEqual(query.filters, """
( "size":"m" OR "size":"s" )
""")
default:
XCTFail("Unexpected case")
}
}
}
func testBuildHierarchicalQueries() {
let query = Query()
let colorGroup = FilterGroup.And(filters: [Filter.Facet(attribute: "color", stringValue: "red")], name: "color")
let hierarchicalGroup = FilterGroup.And(filters: [Filter.Facet(attribute: "category.lvl2", stringValue: "a > b > c")], name: "h")
let filterGroups: [FilterGroupType] = [colorGroup, hierarchicalGroup]
let hierarchicalAttributes = (0...3)
.map { "category.lvl\($0)" }
.map(Attribute.init(rawValue:))
let hierarchicalFilters: [Filter.Facet] = [
.init(attribute: "category.lvl0", stringValue: "a"),
.init(attribute: "category.lvl1", stringValue: "a > b"),
.init(attribute: "category.lvl2", stringValue: "a > b > c")
]
let queryBuilder = QueryBuilder(query: query, filterGroups: filterGroups, hierarchicalAttributes: hierarchicalAttributes, hierachicalFilters: hierarchicalFilters)
let queries = queryBuilder.build()
XCTAssertEqual(queries.count, hierarchicalAttributes.count + 1)
XCTAssertEqual(queries[1].filters, "( \"color\":\"red\" )")
XCTAssertEqual(queries[1].facets, ["category.lvl0"])
XCTAssertEqual(queries[2].filters, "( \"color\":\"red\" ) AND ( \"category.lvl0\":\"a\" )")
XCTAssertEqual(queries[2].facets, ["category.lvl1"])
XCTAssertEqual(queries[3].filters, "( \"color\":\"red\" ) AND ( \"category.lvl1\":\"a > b\" )")
XCTAssertEqual(queries[3].facets, ["category.lvl2"])
XCTAssertEqual(queries[4].filters, "( \"color\":\"red\" ) AND ( \"category.lvl2\":\"a > b > c\" )")
XCTAssertEqual(queries[4].facets, ["category.lvl3"])
}
}
| {
"pile_set_name": "Github"
} |
import { TypeStatOptions } from "../options/types";
import { createLanguageServices } from "../services/language";
export const createFileNamesAndServices = (options: TypeStatOptions) => {
const services = createLanguageServices(options);
const fileNames =
options.fileNames === undefined
? services.parsedConfiguration.fileNames.filter((fileName) => !fileName.endsWith(".d.ts"))
: options.fileNames;
return { fileNames, services };
};
| {
"pile_set_name": "Github"
} |
#StarCraftⅡ-cn,星际争霸2国服,0,0,1,0,1,0,By-normanbb
12.129.202.0/24
12.129.206.0/24
12.129.210.0/24
12.129.222.0/24
12.129.242.0/24
12.130.193.0/24
14.215.228.0/24
36.25.240.0/24
39.129.16.0/24
42.186.64.0/24
42.186.64.174/32
42.186.64.175/32
42.186.64.176/32
42.186.64.177/32
42.186.64.178/32
42.186.64.179/32
42.186.64.180/32
42.186.64.181/32
58.51.151.0/24
58.87.72.0/24
58.216.109.0/24
58.220.6.0/24
58.222.42.0/24
58.222.46.0/24
59.34.43.0/24
59.111.134.0/24
59.111.134.238/32
59.111.135.0/24
59.111.135.231/32
59.111.135.238/32
59.111.135.240/32
60.220.196.0/24
61.147.112.0/24
61.147.228.0/24
61.163.111.0/24
103.215.141.0/24
106.57.180.0/24
106.60.70.0/24
111.41.53.0/24
112.17.2.0/24
112.29.186.0/24
112.29.203.0/24
112.113.248.0/24
113.106.27.0/24
113.142.80.0/24
113.142.88.0/24
114.113.217.0/24
114.113.217.193/32
114.236.88.0/24
114.236.140.0/24
115.153.176.0/24
115.223.16.0/24
115.223.26.0/24
115.238.0.0/16
115.238.1.0/24
115.238.2.0/24
115.238.3.0/24
115.238.5.0/24
115.238.9.0/24
115.238.11.0/24
115.238.13.0/24
115.238.15.0/24
115.238.112.0/24
116.242.0.0/16
117.23.54.0/24
117.161.5.0/24
117.169.93.0/24
119.52.121.0/24
120.209.141.0/24
121.17.125.0/24
121.254.164.0/24
121.254.166.0/24
121.254.168.0/24
121.254.200.0/24
122.198.64.0/24
122.198.65.0/24
122.198.66.0/24
122.198.67.0/24
122.225.38.0/24
123.58.183.0/24
123.58.183.130/32
123.58.183.131/32
123.58.183.132/32
123.58.183.133/32
123.58.183.134/32
123.58.183.135/32
123.58.183.136/32
123.58.183.137/32
123.58.183.138/32
123.58.183.139/32
123.58.183.140/32
123.58.183.141/32
123.58.183.142/32
123.58.183.143/32
123.58.183.144/32
124.225.98.0/24
124.225.168.0/24
124.225.183.0/24
180.88.61.0/24
180.97.244.0/24
180.101.30.0/24
182.140.211.0/24
182.140.211.3/32
182.140.211.4/32
182.140.211.5/32
182.140.211.6/32
182.140.211.7/32
182.140.211.8/32
182.140.211.9/32
182.140.211.10/32
182.140.211.11/32
182.140.211.12/32
182.140.211.13/32
182.140.211.14/32
182.140.211.15/32
182.140.211.16/32
182.140.211.17/32
182.140.211.18/32
182.140.211.19/32
182.140.211.20/32
182.140.211.21/32
182.140.211.22/32
182.140.211.23/32
182.140.211.24/32
182.140.211.25/32
182.140.211.26/32
182.140.211.27/32
182.140.211.45/32
182.140.211.46/32
182.140.211.47/32
182.140.211.48/32
182.140.211.49/32
183.60.151.0/24
183.131.111.0/24
183.216.174.0/24
195.12.229.0/24
202.114.91.0/24
202.150.17.0/24
208.111.144.0/24
208.111.145.0/24
213.248.127.0/24
218.75.225.0/24
218.77.18.0/24
218.164.96.0/24
218.241.152.0/24
219.139.240.0/24
219.145.171.0/24
220.164.146.0/24
220.181.102.0/24
220.181.102.66/32
220.181.102.67/32
220.181.102.68/32
220.181.102.69/32
220.181.102.70/32
220.181.102.71/32
220.181.102.72/32
220.181.102.75/32
220.181.102.76/32
220.181.102.77/32
220.181.102.194/32
220.181.102.195/32
220.181.102.196/32
220.181.102.197/32
220.181.102.198/32
220.181.102.199/32
222.20.147.0/24
222.186.145.0/24
222.231.21.0/24
222.231.22.0/24
222.231.23.0/24
222.231.24.0/24
223.111.13.0/24
223.111.17.0/24
223.111.18.0/24
223.111.19.0/24
223.111.188.0/24
223.111.192.0/24
223.111.204.0/24
223.252.230.0/24
223.252.231.0/24
223.252.234.0/24
223.252.242.0/24
223.252.243.0/24
223.252.245.0/24
| {
"pile_set_name": "Github"
} |
// UpdateUiBaseViewModel.cs, 10.06.2019
// Copyright (C) Dominic Beger 17.06.2019
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Windows.Media.Imaging;
using nUpdate.Updating;
// ReSharper disable once CheckNamespace
namespace nUpdate.WPFUserInterface.ViewModel
{
public class UpdateUiBaseViewModel : ViewModelBase
{
internal UpdateManager UpdateManager { get; set; }
public BitmapImage WindowIcon { get; set; }
internal BitmapImage GetIcon(Icon icon)
{
using (var memory = new MemoryStream())
{
var bitmap = icon.ToBitmap();
bitmap.Save(memory, ImageFormat.Png);
memory.Position = 0;
var bitmapImage = new BitmapImage();
bitmapImage.BeginInit();
bitmapImage.StreamSource = memory;
bitmapImage.CacheOption = BitmapCacheOption.OnLoad;
bitmapImage.EndInit();
return bitmapImage;
}
}
}
} | {
"pile_set_name": "Github"
} |
StartChar: less.subs
Encoding: 1114227 -1 1226
GlifName: less.subs
Width: 354
VWidth: 0
Flags: HMW
LayerCount: 3
Fore
SplineSet
87 138 m 2
314 43 l 10
327 37 330 15 330 10 c 0
330 7 326 -5 322 -3 c 2
42 117 l 2
30 122 15 130 15 134 c 0
15 139 24 156 36 161 c 2
322 281 l 2
326 283 330 270 329 266 c 8
326 252 322 241 309 235 c 18
86 141 l 2
84 140 85 139 87 138 c 2
EndSplineSet
Validated: 1
EndChar
| {
"pile_set_name": "Github"
} |
/*
File: main.m
Abstract: n/a
Version: 1.1
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
Inc. ("Apple") in consideration of your agreement to the following
terms, and your use, installation, modification or redistribution of
this Apple software constitutes acceptance of these terms. If you do
not agree with these terms, please do not use, install, modify or
redistribute this Apple software.
In consideration of your agreement to abide by the following terms, and
subject to these terms, Apple grants you a personal, non-exclusive
license, under Apple's copyrights in this original Apple software (the
"Apple Software"), to use, reproduce, modify and redistribute the Apple
Software, with or without modifications, in source and/or binary forms;
provided that if you redistribute the Apple Software in its entirety and
without modifications, you must retain this notice and the following
text and disclaimers in all such redistributions of the Apple Software.
Neither the name, trademarks, service marks or logos of Apple Inc. may
be used to endorse or promote products derived from the Apple Software
without specific prior written permission from Apple. Except as
expressly stated in this notice, no other rights or licenses, express or
implied, are granted by Apple herein, including but not limited to any
patent rights that may be infringed by your derivative works or by other
works in which the Apple Software may be incorporated.
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION,
MODIFICATION AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
Copyright (C) 2010 Apple Inc. All Rights Reserved.
*/
#import <UIKit/UIKit.h>
int main(int argc, char *argv[]) {
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
int retVal = UIApplicationMain(argc, argv, nil, nil);
[pool release];
return retVal;
}
| {
"pile_set_name": "Github"
} |
/*
* Copyright (c) Mirth Corporation. All rights reserved.
*
* http://www.mirthcorp.com
*
* The software in this package is published under the terms of the MPL license a copy of which has
* been included with this distribution in the LICENSE.txt file.
*/
package com.mirth.connect.server.api.providers;
import java.io.IOException;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.ext.Provider;
import org.apache.commons.configuration.PropertiesConfiguration;
import org.apache.commons.lang3.BooleanUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.math.NumberUtils;
@Provider
public class ApiOriginFilter implements Filter {
private String allowOrigin;
private String allowCredentials;
private String allowMethods;
private String allowHeaders;
private String exposeHeaders;
private String maxAge;
public ApiOriginFilter(PropertiesConfiguration mirthProperties) {
allowOrigin = mirthProperties.getString("server.api.accesscontrolalloworigin");
allowCredentials = mirthProperties.getString("server.api.accesscontrolallowcredentials");
allowMethods = mirthProperties.getString("server.api.accesscontrolallowmethods");
allowHeaders = mirthProperties.getString("server.api.accesscontrolallowheaders");
exposeHeaders = mirthProperties.getString("server.api.accesscontrolexposeheaders");
maxAge = mirthProperties.getString("server.api.accesscontrolmaxage");
}
@Override
public void init(FilterConfig filterConfig) throws ServletException {}
@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
HttpServletResponse res = (HttpServletResponse) response;
if (StringUtils.isNotBlank(allowOrigin)) {
res.addHeader("Access-Control-Allow-Origin", allowOrigin);
}
if (StringUtils.isNotBlank(allowCredentials)) {
res.addHeader("Access-Control-Allow-Credentials", Boolean.toString(BooleanUtils.toBoolean(allowCredentials)));
}
if (StringUtils.isNotBlank(allowMethods)) {
res.addHeader("Access-Control-Allow-Methods", allowMethods);
}
if (StringUtils.isNotBlank(allowHeaders)) {
res.addHeader("Access-Control-Allow-Headers", allowHeaders);
}
if (StringUtils.isNotBlank(exposeHeaders)) {
res.addHeader("Access-Control-Expose-Headers", exposeHeaders);
}
if (StringUtils.isNotBlank(maxAge)) {
res.addHeader("Access-Control-Max-Age", Long.toString(NumberUtils.toLong(maxAge, 300L)));
}
chain.doFilter(request, response);
}
@Override
public void destroy() {}
} | {
"pile_set_name": "Github"
} |
"""!
@brief Oscillatory Neural Network based on Hodgkin-Huxley Neuron Model
@details Implementation based on paper @cite article::nnet::hnn::1.
@authors Andrei Novikov ([email protected])
@date 2014-2020
@copyright GNU Public License
@cond GNU_PUBLIC_LICENSE
PyClustering is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
PyClustering 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
@endcond
"""
from scipy.integrate import odeint
from pyclustering.core.wrapper import ccore_library
import pyclustering.core.hhn_wrapper as wrapper
from pyclustering.nnet import *
from pyclustering.utils import allocate_sync_ensembles
import numpy
import random
class hhn_parameters:
"""!
@brief Describes parameters of Hodgkin-Huxley Oscillatory Network.
@see hhn_network
"""
def __init__(self):
"""!
@brief Default constructor of parameters for Hodgkin-Huxley Oscillatory Network.
@details Constructor initializes parameters by default non-zero values that can be
used for simple simulation.
"""
## Intrinsic noise.
self.nu = random.random() * 2.0 - 1.0
## Maximal conductivity for sodium current.
self.gNa = 120.0 * (1 + 0.02 * self.nu)
## Maximal conductivity for potassium current.
self.gK = 36.0 * (1 + 0.02 * self.nu)
## Maximal conductivity for leakage current.
self.gL = 0.3 * (1 + 0.02 * self.nu)
## Reverse potential of sodium current [mV].
self.vNa = 50.0
## Reverse potential of potassium current [mV].
self.vK = -77.0
## Reverse potential of leakage current [mV].
self.vL = -54.4
## Rest potential [mV].
self.vRest = -65.0
## External current [mV] for central element 1.
self.Icn1 = 5.0
## External current [mV] for central element 2.
self.Icn2 = 30.0
## Synaptic reversal potential [mV] for inhibitory effects.
self.Vsyninh = -80.0
## Synaptic reversal potential [mV] for exciting effects.
self.Vsynexc = 0.0
## Alfa-parameter for alfa-function for inhibitory effect.
self.alfa_inhibitory = 6.0
## Betta-parameter for alfa-function for inhibitory effect.
self.betta_inhibitory = 0.3
## Alfa-parameter for alfa-function for excitatory effect.
self.alfa_excitatory = 40.0
## Betta-parameter for alfa-function for excitatory effect.
self.betta_excitatory = 2.0
## Strength of the synaptic connection from PN to CN1.
self.w1 = 0.1
## Strength of the synaptic connection from CN1 to PN.
self.w2 = 9.0
## Strength of the synaptic connection from CN2 to PN.
self.w3 = 5.0
## Period of time [ms] when high strength value of synaptic connection exists from CN2 to PN.
self.deltah = 650.0
## Threshold of the membrane potential that should exceeded by oscillator to be considered as an active.
self.threshold = -10
## Affects pulse counter.
self.eps = 0.16
class central_element:
"""!
@brief Central element consist of two central neurons that are described by a little bit different dynamic than peripheral.
@see hhn_network
"""
def __init__(self):
"""!
@brief Constructor of central element.
"""
## Membrane potential of cenral neuron (V).
self.membrane_potential = 0.0
## Activation conductance of the sodium channel (m).
self.active_cond_sodium = 0.0
## Inactivaton conductance of the sodium channel (h).
self.inactive_cond_sodium = 0.0
## Activaton conductance of the sodium channel (h).
self.active_cond_potassium = 0.0
## Spike generation of central neuron.
self.pulse_generation = False
## Timestamps of generated pulses.
self.pulse_generation_time = []
def __repr__(self):
"""!
@brief Returns string that represents central element.
"""
return "%s, %s" % (self.membrane_potential, self.pulse_generation_time)
class hhn_network(network):
"""!
@brief Oscillatory Neural Network with central element based on Hodgkin-Huxley neuron model.
@details Interaction between oscillators is performed via central element (no connection between oscillators that
are called as peripheral). Peripheral oscillators receive external stimulus. Central element consist of
two oscillators: the first is used for synchronization some ensemble of oscillators and the second
controls synchronization of the first central oscillator with various ensembles.
Usage example where oscillatory network with 6 oscillators is used for simulation. The first two oscillators
have the same stimulus, as well as the third and fourth oscillators and the last two. Thus three synchronous
ensembles are expected after simulation.
@code
from pyclustering.nnet.hhn import hhn_network, hhn_parameters
from pyclustering.nnet.dynamic_visualizer import dynamic_visualizer
# Change period of time when high strength value of synaptic connection exists from CN2 to PN.
params = hhn_parameters()
params.deltah = 400
# Create Hodgkin-Huxley oscillatory network with stimulus.
net = hhn_network(6, [0, 0, 25, 25, 47, 47], params)
# Simulate network.
(t, dyn_peripheral, dyn_central) = net.simulate(2400, 600)
# Visualize network's output (membrane potential of peripheral and central neurons).
amount_canvases = 6 + 2 # 6 peripheral oscillator + 2 central elements
visualizer = dynamic_visualizer(amount_canvases, x_title="Time", y_title="V", y_labels=False)
visualizer.append_dynamics(t, dyn_peripheral, 0, True)
visualizer.append_dynamics(t, dyn_central, amount_canvases - 2, True)
visualizer.show()
@endcode
There is visualized result of simulation where three synchronous ensembles of oscillators can be observed. The
first and the second oscillators form the first ensemble, the third and the fourth form the second ensemble and
the last two oscillators form the third ensemble.
@image html hhn_three_ensembles.png
"""
def __init__(self, num_osc, stimulus = None, parameters = None, type_conn = None, type_conn_represent = conn_represent.MATRIX, ccore = True):
"""!
@brief Constructor of oscillatory network based on Hodgkin-Huxley neuron model.
@param[in] num_osc (uint): Number of peripheral oscillators in the network.
@param[in] stimulus (list): List of stimulus for oscillators, number of stimulus should be equal to number of peripheral oscillators.
@param[in] parameters (hhn_parameters): Parameters of the network.
@param[in] type_conn (conn_type): Type of connections between oscillators in the network (ignored for this type of network).
@param[in] type_conn_represent (conn_represent): Internal representation of connection in the network: matrix or list.
@param[in] ccore (bool): If 'True' then CCORE is used (C/C++ implementation of the model).
"""
super().__init__(num_osc, conn_type.NONE, type_conn_represent)
if stimulus is None:
self._stimulus = [0.0] * num_osc
else:
self._stimulus = stimulus
if parameters is not None:
self._params = parameters
else:
self._params = hhn_parameters()
self.__ccore_hhn_pointer = None
self.__ccore_hhn_dynamic_pointer = None
if (ccore is True) and ccore_library.workable():
self.__ccore_hhn_pointer = wrapper.hhn_create(num_osc, self._params)
else:
self._membrane_dynamic_pointer = None # final result is stored here.
self._membrane_potential = [0.0] * self._num_osc
self._active_cond_sodium = [0.0] * self._num_osc
self._inactive_cond_sodium = [0.0] * self._num_osc
self._active_cond_potassium = [0.0] * self._num_osc
self._link_activation_time = [0.0] * self._num_osc
self._link_pulse_counter = [0.0] * self._num_osc
self._link_weight3 = [0.0] * self._num_osc
self._pulse_generation_time = [[] for i in range(self._num_osc)]
self._pulse_generation = [False] * self._num_osc
self._noise = [random.random() * 2.0 - 1.0 for i in range(self._num_osc)]
self._central_element = [central_element(), central_element()]
def __del__(self):
"""!
@brief Destroy dynamically allocated oscillatory network instance in case of CCORE usage.
"""
if self.__ccore_hhn_pointer:
wrapper.hhn_destroy(self.__ccore_hhn_pointer)
def simulate(self, steps, time, solution = solve_type.RK4):
"""!
@brief Performs static simulation of oscillatory network based on Hodgkin-Huxley neuron model.
@details Output dynamic is sensible to amount of steps of simulation and solver of differential equation.
Python implementation uses 'odeint' from 'scipy', CCORE uses classical RK4 and RFK45 methods,
therefore in case of CCORE HHN (Hodgkin-Huxley network) amount of steps should be greater than in
case of Python HHN.
@param[in] steps (uint): Number steps of simulations during simulation.
@param[in] time (double): Time of simulation.
@param[in] solution (solve_type): Type of solver for differential equations.
@return (tuple) Dynamic of oscillatory network represented by (time, peripheral neurons dynamic, central elements
dynamic), where types are (list, list, list).
"""
return self.simulate_static(steps, time, solution)
def simulate_static(self, steps, time, solution = solve_type.RK4):
"""!
@brief Performs static simulation of oscillatory network based on Hodgkin-Huxley neuron model.
@details Output dynamic is sensible to amount of steps of simulation and solver of differential equation.
Python implementation uses 'odeint' from 'scipy', CCORE uses classical RK4 and RFK45 methods,
therefore in case of CCORE HHN (Hodgkin-Huxley network) amount of steps should be greater than in
case of Python HHN.
@param[in] steps (uint): Number steps of simulations during simulation.
@param[in] time (double): Time of simulation.
@param[in] solution (solve_type): Type of solver for differential equations.
@return (tuple) Dynamic of oscillatory network represented by (time, peripheral neurons dynamic, central elements
dynamic), where types are (list, list, list).
"""
# Check solver before simulation
if solution == solve_type.FAST:
raise NameError("Solver FAST is not support due to low accuracy that leads to huge error.")
self._membrane_dynamic_pointer = None
if self.__ccore_hhn_pointer is not None:
self.__ccore_hhn_dynamic_pointer = wrapper.hhn_dynamic_create(True, False, False, False)
wrapper.hhn_simulate(self.__ccore_hhn_pointer, steps, time, solution, self._stimulus, self.__ccore_hhn_dynamic_pointer)
peripheral_membrane_potential = wrapper.hhn_dynamic_get_peripheral_evolution(self.__ccore_hhn_dynamic_pointer, 0)
central_membrane_potential = wrapper.hhn_dynamic_get_central_evolution(self.__ccore_hhn_dynamic_pointer, 0)
dynamic_time = wrapper.hhn_dynamic_get_time(self.__ccore_hhn_dynamic_pointer)
self._membrane_dynamic_pointer = peripheral_membrane_potential
wrapper.hhn_dynamic_destroy(self.__ccore_hhn_dynamic_pointer)
return dynamic_time, peripheral_membrane_potential, central_membrane_potential
if solution == solve_type.RKF45:
raise NameError("Solver RKF45 is not support in python version.")
dyn_peripheral = [self._membrane_potential[:]]
dyn_central = [[0.0, 0.0]]
dyn_time = [0.0]
step = time / steps
int_step = step / 10.0
for t in numpy.arange(step, time + step, step):
# update states of oscillators
(memb_peripheral, memb_central) = self._calculate_states(solution, t, step, int_step)
# update states of oscillators
dyn_peripheral.append(memb_peripheral)
dyn_central.append(memb_central)
dyn_time.append(t)
self._membrane_dynamic_pointer = dyn_peripheral
return dyn_time, dyn_peripheral, dyn_central
def _calculate_states(self, solution, t, step, int_step):
"""!
@brief Calculates new state of each oscillator in the network. Returns only excitatory state of oscillators.
@param[in] solution (solve_type): Type solver of the differential equations.
@param[in] t (double): Current time of simulation.
@param[in] step (uint): Step of solution at the end of which states of oscillators should be calculated.
@param[in] int_step (double): Differentiation step that is used for solving differential equation.
@return (list) New states of membrane potentials for peripheral oscillators and for cental elements as a list where
the last two values correspond to central element 1 and 2.
"""
next_membrane = [0.0] * self._num_osc
next_active_sodium = [0.0] * self._num_osc
next_inactive_sodium = [0.0] * self._num_osc
next_active_potassium = [0.0] * self._num_osc
# Update states of oscillators
for index in range(0, self._num_osc, 1):
result = odeint(self.hnn_state,
[self._membrane_potential[index], self._active_cond_sodium[index], self._inactive_cond_sodium[index], self._active_cond_potassium[index]],
numpy.arange(t - step, t, int_step),
(index, ))
[ next_membrane[index], next_active_sodium[index], next_inactive_sodium[index], next_active_potassium[index] ] = result[len(result) - 1][0:4]
next_cn_membrane = [0.0, 0.0]
next_cn_active_sodium = [0.0, 0.0]
next_cn_inactive_sodium = [0.0, 0.0]
next_cn_active_potassium = [0.0, 0.0]
# Update states of central elements
for index in range(0, len(self._central_element)):
result = odeint(self.hnn_state,
[self._central_element[index].membrane_potential, self._central_element[index].active_cond_sodium, self._central_element[index].inactive_cond_sodium, self._central_element[index].active_cond_potassium],
numpy.arange(t - step, t, int_step),
(self._num_osc + index, ))
[ next_cn_membrane[index], next_cn_active_sodium[index], next_cn_inactive_sodium[index], next_cn_active_potassium[index] ] = result[len(result) - 1][0:4]
# Noise generation
self._noise = [ 1.0 + 0.01 * (random.random() * 2.0 - 1.0) for i in range(self._num_osc)]
# Updating states of PNs
self.__update_peripheral_neurons(t, step, next_membrane, next_active_sodium, next_inactive_sodium, next_active_potassium)
# Updation states of CN
self.__update_central_neurons(t, next_cn_membrane, next_cn_active_sodium, next_cn_inactive_sodium, next_cn_active_potassium)
return (next_membrane, next_cn_membrane)
def __update_peripheral_neurons(self, t, step, next_membrane, next_active_sodium, next_inactive_sodium, next_active_potassium):
"""!
@brief Update peripheral neurons in line with new values of current in channels.
@param[in] t (doubles): Current time of simulation.
@param[in] step (uint): Step (time duration) during simulation when states of oscillators should be calculated.
@param[in] next_membrane (list): New values of membrane potentials for peripheral neurons.
@Param[in] next_active_sodium (list): New values of activation conductances of the sodium channels for peripheral neurons.
@param[in] next_inactive_sodium (list): New values of inactivaton conductances of the sodium channels for peripheral neurons.
@param[in] next_active_potassium (list): New values of activation conductances of the potassium channel for peripheral neurons.
"""
self._membrane_potential = next_membrane[:]
self._active_cond_sodium = next_active_sodium[:]
self._inactive_cond_sodium = next_inactive_sodium[:]
self._active_cond_potassium = next_active_potassium[:]
for index in range(0, self._num_osc):
if self._pulse_generation[index] is False:
if self._membrane_potential[index] >= 0.0:
self._pulse_generation[index] = True
self._pulse_generation_time[index].append(t)
elif self._membrane_potential[index] < 0.0:
self._pulse_generation[index] = False
# Update connection from CN2 to PN
if self._link_weight3[index] == 0.0:
if self._membrane_potential[index] > self._params.threshold:
self._link_pulse_counter[index] += step
if self._link_pulse_counter[index] >= 1 / self._params.eps:
self._link_weight3[index] = self._params.w3
self._link_activation_time[index] = t
elif not ((self._link_activation_time[index] < t) and (t < self._link_activation_time[index] + self._params.deltah)):
self._link_weight3[index] = 0.0
self._link_pulse_counter[index] = 0.0
def __update_central_neurons(self, t, next_cn_membrane, next_cn_active_sodium, next_cn_inactive_sodium, next_cn_active_potassium):
"""!
@brief Update of central neurons in line with new values of current in channels.
@param[in] t (doubles): Current time of simulation.
@param[in] next_membrane (list): New values of membrane potentials for central neurons.
@Param[in] next_active_sodium (list): New values of activation conductances of the sodium channels for central neurons.
@param[in] next_inactive_sodium (list): New values of inactivaton conductances of the sodium channels for central neurons.
@param[in] next_active_potassium (list): New values of activation conductances of the potassium channel for central neurons.
"""
for index in range(0, len(self._central_element)):
self._central_element[index].membrane_potential = next_cn_membrane[index]
self._central_element[index].active_cond_sodium = next_cn_active_sodium[index]
self._central_element[index].inactive_cond_sodium = next_cn_inactive_sodium[index]
self._central_element[index].active_cond_potassium = next_cn_active_potassium[index]
if self._central_element[index].pulse_generation is False:
if self._central_element[index].membrane_potential >= 0.0:
self._central_element[index].pulse_generation = True
self._central_element[index].pulse_generation_time.append(t)
elif self._central_element[index].membrane_potential < 0.0:
self._central_element[index].pulse_generation = False
def hnn_state(self, inputs, t, argv):
"""!
@brief Returns new values of excitatory and inhibitory parts of oscillator and potential of oscillator.
@param[in] inputs (list): States of oscillator for integration [v, m, h, n] (see description below).
@param[in] t (double): Current time of simulation.
@param[in] argv (tuple): Extra arguments that are not used for integration - index of oscillator.
@return (list) new values of oscillator [v, m, h, n], where:
v - membrane potantial of oscillator,
m - activation conductance of the sodium channel,
h - inactication conductance of the sodium channel,
n - activation conductance of the potassium channel.
"""
index = argv
v = inputs[0] # membrane potential (v).
m = inputs[1] # activation conductance of the sodium channel (m).
h = inputs[2] # inactivaton conductance of the sodium channel (h).
n = inputs[3] # activation conductance of the potassium channel (n).
# Calculate ion current
# gNa * m[i]^3 * h * (v[i] - vNa) + gK * n[i]^4 * (v[i] - vK) + gL (v[i] - vL)
active_sodium_part = self._params.gNa * (m ** 3) * h * (v - self._params.vNa)
inactive_sodium_part = self._params.gK * (n ** 4) * (v - self._params.vK)
active_potassium_part = self._params.gL * (v - self._params.vL)
Iion = active_sodium_part + inactive_sodium_part + active_potassium_part
Iext = 0.0
Isyn = 0.0
if index < self._num_osc:
# PN - peripheral neuron - calculation of external current and synaptic current.
Iext = self._stimulus[index] * self._noise[index] # probably noise can be pre-defined for reducting compexity
memory_impact1 = 0.0
for i in range(0, len(self._central_element[0].pulse_generation_time)):
memory_impact1 += self.__alfa_function(t - self._central_element[0].pulse_generation_time[i], self._params.alfa_inhibitory, self._params.betta_inhibitory);
memory_impact2 = 0.0
for i in range(0, len(self._central_element[1].pulse_generation_time)):
memory_impact2 += self.__alfa_function(t - self._central_element[1].pulse_generation_time[i], self._params.alfa_inhibitory, self._params.betta_inhibitory);
Isyn = self._params.w2 * (v - self._params.Vsyninh) * memory_impact1 + self._link_weight3[index] * (v - self._params.Vsyninh) * memory_impact2;
else:
# CN - central element.
central_index = index - self._num_osc
if central_index == 0:
Iext = self._params.Icn1 # CN1
memory_impact = 0.0
for index_oscillator in range(0, self._num_osc):
for index_generation in range(0, len(self._pulse_generation_time[index_oscillator])):
memory_impact += self.__alfa_function(t - self._pulse_generation_time[index_oscillator][index_generation], self._params.alfa_excitatory, self._params.betta_excitatory);
Isyn = self._params.w1 * (v - self._params.Vsynexc) * memory_impact
elif central_index == 1:
Iext = self._params.Icn2 # CN2
Isyn = 0.0
else:
assert 0;
# Membrane potential
dv = -Iion + Iext - Isyn
# Calculate variables
potential = v - self._params.vRest
am = (2.5 - 0.1 * potential) / (math.exp(2.5 - 0.1 * potential) - 1.0)
ah = 0.07 * math.exp(-potential / 20.0)
an = (0.1 - 0.01 * potential) / (math.exp(1.0 - 0.1 * potential) - 1.0)
bm = 4.0 * math.exp(-potential / 18.0)
bh = 1.0 / (math.exp(3.0 - 0.1 * potential) + 1.0)
bn = 0.125 * math.exp(-potential / 80.0)
dm = am * (1.0 - m) - bm * m
dh = ah * (1.0 - h) - bh * h
dn = an * (1.0 - n) - bn * n
return [dv, dm, dh, dn]
def allocate_sync_ensembles(self, tolerance = 0.1):
"""!
@brief Allocates clusters in line with ensembles of synchronous oscillators where each. Synchronous ensemble corresponds to only one cluster.
@param[in] tolerance (double): maximum error for allocation of synchronous ensemble oscillators.
@return (list) Grours (lists) of indexes of synchronous oscillators. For example [ [index_osc1, index_osc3], [index_osc2], [index_osc4, index_osc5] ].
"""
return allocate_sync_ensembles(self._membrane_dynamic_pointer, tolerance, 20.0, None)
def __alfa_function(self, time, alfa, betta):
"""!
@brief Calculates value of alfa-function for difference between spike generation time and current simulation time.
@param[in] time (double): Difference between last spike generation time and current time.
@param[in] alfa (double): Alfa parameter for alfa-function.
@param[in] betta (double): Betta parameter for alfa-function.
@return (double) Value of alfa-function.
"""
return alfa * time * math.exp(-betta * time)
| {
"pile_set_name": "Github"
} |
/*
* SPDX-License-Identifier: Apache-2.0
*
* Copyright 2016-2020 Gerrit Grunwald.
*
* 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
*
* https://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 eu.hansolo.tilesfx.skins;
import eu.hansolo.tilesfx.Tile;
import eu.hansolo.tilesfx.events.SwitchEvent;
import eu.hansolo.tilesfx.fonts.Fonts;
import eu.hansolo.tilesfx.tools.Helper;
import javafx.animation.KeyFrame;
import javafx.animation.KeyValue;
import javafx.animation.Timeline;
import javafx.beans.InvalidationListener;
import javafx.event.EventHandler;
import javafx.event.EventType;
import javafx.scene.control.Label;
import javafx.scene.input.MouseEvent;
import javafx.scene.shape.Circle;
import javafx.scene.shape.Rectangle;
import javafx.scene.text.Font;
import javafx.scene.text.Text;
import javafx.util.Duration;
/**
* Created by hansolo on 19.12.16.
*/
public class SwitchTileSkin extends TileSkin {
private static final SwitchEvent SWITCH_PRESSED = new SwitchEvent(SwitchEvent.SWITCH_PRESSED);
private static final SwitchEvent SWITCH_RELEASED = new SwitchEvent(SwitchEvent.SWITCH_RELEASED);
private Text titleText;
private Text text;
private Label description;
private Rectangle switchBorder;
private Rectangle switchBackground;
private Circle thumb;
private Timeline timeline;
private EventHandler<MouseEvent> mouseEventHandler;
private InvalidationListener selectedListener;
// ******************** Constructors **************************************
public SwitchTileSkin(final Tile TILE) {
super(TILE);
}
// ******************** Initialization ************************************
@Override protected void initGraphics() {
super.initGraphics();
mouseEventHandler = e -> {
if (!tile.isInteractive()) { return; }
final EventType TYPE = e.getEventType();
if (MouseEvent.MOUSE_PRESSED == TYPE) {
tile.setActive(!tile.isActive());
tile.fireEvent(SWITCH_PRESSED);
} else if(MouseEvent.MOUSE_RELEASED == TYPE) {
tile.fireEvent(SWITCH_RELEASED);
}
};
selectedListener = o -> moveThumb();
timeline = new Timeline();
titleText = new Text();
titleText.setFill(tile.getTitleColor());
Helper.enableNode(titleText, !tile.getTitle().isEmpty());
text = new Text(tile.getText());
text.setFill(tile.getUnitColor());
Helper.enableNode(text, tile.isTextVisible());
description = new Label(tile.getDescription());
description.setAlignment(tile.getDescriptionAlignment());
description.setWrapText(true);
description.setTextFill(tile.getTextColor());
Helper.enableNode(description, !tile.getDescription().isEmpty());
switchBorder = new Rectangle();
switchBackground = new Rectangle();
switchBackground.setMouseTransparent(true);
switchBackground.setFill(tile.isActive() ? tile.getActiveColor() : tile.getBackgroundColor());
thumb = new Circle();
thumb.setMouseTransparent(true);
thumb.setEffect(shadow);
getPane().getChildren().addAll(titleText, text, description, switchBorder, switchBackground, thumb);
}
@Override protected void registerListeners() {
super.registerListeners();
switchBorder.addEventHandler(MouseEvent.MOUSE_PRESSED, mouseEventHandler);
switchBorder.addEventHandler(MouseEvent.MOUSE_RELEASED, mouseEventHandler);
tile.activeProperty().addListener(selectedListener);
}
// ******************** Methods *******************************************
@Override protected void handleEvents(final String EVENT_TYPE) {
super.handleEvents(EVENT_TYPE);
if ("VISIBILITY".equals(EVENT_TYPE)) {
Helper.enableNode(titleText, !tile.getTitle().isEmpty());
Helper.enableNode(text, tile.isTextVisible());
Helper.enableNode(description, !tile.getDescription().isEmpty());
}
}
private void moveThumb() {
KeyValue thumbLeftX = new KeyValue(thumb.centerXProperty(), switchBackground.getLayoutX() + size * 0.1);
KeyValue thumbRightX = new KeyValue(thumb.centerXProperty(), switchBackground.getLayoutX() + switchBackground.getWidth() - size * 0.1);
KeyValue switchBackgroundLeftColor = new KeyValue(switchBackground.fillProperty(), tile.getBackgroundColor());
KeyValue switchBackgroundRightColor = new KeyValue(switchBackground.fillProperty(), tile.getActiveColor());
if (tile.isActive()) {
// move thumb from left to the right
KeyFrame kf0 = new KeyFrame(Duration.ZERO, thumbLeftX, switchBackgroundLeftColor);
KeyFrame kf1 = new KeyFrame(Duration.millis(200), thumbRightX, switchBackgroundRightColor);
timeline.getKeyFrames().setAll(kf0, kf1);
} else {
// move thumb from right to the left
KeyFrame kf0 = new KeyFrame(Duration.ZERO, thumbRightX, switchBackgroundRightColor);
KeyFrame kf1 = new KeyFrame(Duration.millis(200), thumbLeftX, switchBackgroundLeftColor);
timeline.getKeyFrames().setAll(kf0, kf1);
}
timeline.play();
}
@Override public void dispose() {
switchBorder.removeEventHandler(MouseEvent.MOUSE_PRESSED, mouseEventHandler);
switchBorder.removeEventHandler(MouseEvent.MOUSE_RELEASED, mouseEventHandler);
tile.activeProperty().removeListener(selectedListener);
super.dispose();
}
// ******************** Resizing ******************************************
@Override protected void resizeStaticText() {
double maxWidth = width - size * 0.1;
double fontSize = size * textSize.factor;
boolean customFontEnabled = tile.isCustomFontEnabled();
Font customFont = tile.getCustomFont();
Font font = (customFontEnabled && customFont != null) ? Font.font(customFont.getFamily(), fontSize) : Fonts.latoRegular(fontSize);
titleText.setFont(font);
if (titleText.getLayoutBounds().getWidth() > maxWidth) { Helper.adjustTextSize(titleText, maxWidth, fontSize); }
switch(tile.getTitleAlignment()) {
default :
case LEFT : titleText.relocate(size * 0.05, size * 0.05); break;
case CENTER: titleText.relocate((width - titleText.getLayoutBounds().getWidth()) * 0.5, size * 0.05); break;
case RIGHT : titleText.relocate(width - (size * 0.05) - titleText.getLayoutBounds().getWidth(), size * 0.05); break;
}
text.setText(tile.getText());
text.setFont(font);
if (text.getLayoutBounds().getWidth() > maxWidth) { Helper.adjustTextSize(text, maxWidth, fontSize); }
switch(tile.getTextAlignment()) {
default :
case LEFT : text.setX(size * 0.05); break;
case CENTER: text.setX((width - text.getLayoutBounds().getWidth()) * 0.5); break;
case RIGHT : text.setX(width - (size * 0.05) - text.getLayoutBounds().getWidth()); break;
}
text.setY(height - size * 0.05);
fontSize = size * 0.1;
description.setFont(Fonts.latoRegular(fontSize));
}
@Override protected void resize() {
super.resize();
description.setPrefSize(contentBounds.getWidth(), size * 0.43);
description.relocate(contentBounds.getX(), height * 0.42);
switchBorder.setWidth(size * 0.445);
switchBorder.setHeight(size * 0.22);
switchBorder.setArcWidth(size * 0.22);
switchBorder.setArcHeight(size * 0.22);
switchBorder.relocate((width - switchBorder.getWidth()) * 0.5, tile.getDescription().isEmpty() ? (height - switchBorder.getHeight()) * 0.5 : height - size * 0.40);
switchBackground.setWidth(size * 0.425);
switchBackground.setHeight(size * 0.2);
switchBackground.setArcWidth(size * 0.2);
switchBackground.setArcHeight(size * 0.2);
switchBackground.relocate((width - switchBackground.getWidth()) * 0.5, tile.getDescription().isEmpty() ? (height - switchBackground.getHeight()) * 0.5 : height - size * 0.39);
thumb.setRadius(size * 0.09);
//thumb.setCenterX(tile.isActive() ? width * 0.6125 : width * 0.3875);
thumb.setCenterX(tile.isActive() ? switchBackground.getLayoutX() + switchBackground.getWidth() - size * 0.1 : switchBackground.getLayoutX() + size * 0.1);
thumb.setCenterY(tile.getDescription().isEmpty() ? height * 0.5 : height - size * 0.29);
}
@Override protected void redraw() {
super.redraw();
titleText.setText(tile.getTitle());
text.setText(tile.getText());
description.setText(tile.getDescription());
description.setAlignment(tile.getDescriptionAlignment());
resizeStaticText();
titleText.setFill(tile.getTitleColor());
text.setFill(tile.getTextColor());
description.setTextFill(tile.getDescriptionColor());
switchBorder.setFill(tile.getForegroundColor());
thumb.setFill(tile.getForegroundColor());
}
}
| {
"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.
*/
/*!
* Copyright (c) 2016 by Contributors
* \file cudnn_spatial_transformer-inl.h
* \brief
* \author Wei Wu
*/
#ifndef MXNET_OPERATOR_CUDNN_SPATIAL_TRANSFORMER_INL_H_
#define MXNET_OPERATOR_CUDNN_SPATIAL_TRANSFORMER_INL_H_
#include <algorithm>
#include <vector>
#include "./spatial_transformer-inl.h"
namespace mxnet {
namespace op {
#if defined(__CUDACC__) && MXNET_USE_CUDNN == 1 && CUDNN_MAJOR >= 5
template<typename DType>
class CuDNNSpatialTransformerOp : public Operator {
public:
explicit CuDNNSpatialTransformerOp(SpatialTransformerParam param) {
this->param_ = param;
init_cudnn_ = false;
dtype_ = mshadow::DataType<DType>::kCudnnFlag;
if (param_.sampler_type == st::kBilinear) {
sampler_ = CUDNN_SAMPLER_BILINEAR;
}
}
~CuDNNSpatialTransformerOp() {
if (init_cudnn_) {
CUDNN_CALL(cudnnDestroySpatialTransformerDescriptor(st_desc_));
CUDNN_CALL(cudnnDestroyTensorDescriptor(in_desc_));
CUDNN_CALL(cudnnDestroyTensorDescriptor(out_desc_));
}
}
virtual void Forward(const OpContext &ctx,
const std::vector<TBlob> &in_data,
const std::vector<OpReqType> &req,
const std::vector<TBlob> &out_data,
const std::vector<TBlob> &aux_args) {
using namespace mshadow;
CHECK_EQ(in_data.size(), 2U);
CHECK_EQ(out_data.size(), 3U);
Stream<gpu> *s = ctx.get_stream<gpu>();
Tensor<gpu, 4, DType> data = in_data[st::kData].get<gpu, 4, DType>(s);
Tensor<gpu, 4, DType> out = out_data[st::kOut].get<gpu, 4, DType>(s);
Shape<3> loc_shape = Shape3(data.size(0), 2, 3);
Shape<4> grid_shape = Shape4(out.size(0), out.size(2), out.size(3), 2);
Tensor<gpu, 3, DType> loc = in_data[st::kLoc].get_with_shape<gpu, 3, DType>(loc_shape, s);
Tensor<gpu, 4, DType> grid = out_data[st::kGridSrc]
.get_with_shape<gpu, 4, DType>(grid_shape, s);
if (!init_cudnn_) {
Init(s, in_data, out_data);
}
CHECK_EQ(data.CheckContiguous(), true);
CHECK_EQ(out.CheckContiguous(), true);
typename DataType<DType>::ScaleType alpha = 1.0f;
typename DataType<DType>::ScaleType beta = 0.0f;
if (param_.transform_type == st::kAffine) {
CUDNN_CALL(cudnnSpatialTfGridGeneratorForward(s->dnn_handle_,
st_desc_,
loc.dptr_,
grid.dptr_));
}
CUDNN_CALL(cudnnSpatialTfSamplerForward(s->dnn_handle_,
st_desc_,
&alpha,
in_desc_,
data.dptr_,
grid.dptr_,
&beta,
out_desc_,
out.dptr_));
}
virtual void Backward(const OpContext &ctx,
const std::vector<TBlob> &out_grad,
const std::vector<TBlob> &in_data,
const std::vector<TBlob> &out_data,
const std::vector<OpReqType> &req,
const std::vector<TBlob> &in_grad,
const std::vector<TBlob> &aux_args) {
using namespace mshadow;
CHECK_EQ(in_data.size(), 2U);
CHECK_EQ(out_data.size(), 3U);
CHECK_EQ(out_grad.size(), 1U);
Stream<gpu> *s = ctx.get_stream<gpu>();
Tensor<gpu, 4, DType> data = in_data[st::kData].get<gpu, 4, DType>(s);
Tensor<gpu, 4, DType> grad = out_grad[st::kOut].get<gpu, 4, DType>(s);
Tensor<gpu, 4, DType> ddata = in_grad[st::kData].get<gpu, 4, DType>(s);
Shape<3> loc_shape = Shape3(data.size(0), 2, 3);
Shape<4> grid_shape = Shape4(grad.size(0), grad.size(2), grad.size(3), 2);
Tensor<gpu, 3, DType> dloc = in_grad[st::kLoc].get_with_shape<gpu, 3, DType>(loc_shape, s);
Tensor<gpu, 4, DType> grid = out_data[st::kGridSrc]
.get_with_shape<gpu, 4, DType>(grid_shape, s);
// do not use out_grad[st::kGridSrc], because dgrid is a intermediate tensor, and not include in
// DeclareBackwardDependency, another, we can we reuse grid for inplace operator
typename DataType<DType>::ScaleType alpha = 1.0f;
typename DataType<DType>::ScaleType beta = 0.0f;
typename DataType<DType>::ScaleType alpha_dgrid = 1.0f;
typename DataType<DType>::ScaleType beta_dgrid = 0.0f;
CUDNN_CALL(cudnnSpatialTfSamplerBackward(s->dnn_handle_,
st_desc_,
&alpha,
in_desc_,
data.dptr_,
&beta,
in_desc_/*reuse in_desc_*/,
ddata.dptr_/*output*/,
&alpha_dgrid,
out_desc_/*reuse out_desc_*/,
grad.dptr_,
grid.dptr_,
&beta_dgrid,
grid.dptr_));
if (param_.transform_type == st::kAffine) {
CUDNN_CALL(cudnnSpatialTfGridGeneratorBackward(s->dnn_handle_,
st_desc_,
grid.dptr_,
dloc.dptr_/*out*/));
}
}
private:
inline void Init(mshadow::Stream<gpu> *s,
const std::vector<TBlob> &in_data,
const std::vector<TBlob> &out_data) {
using namespace mshadow;
#if CUDNN_MAJOR >= 5
format_ = CUDNN_TENSOR_NCHW;
#endif
CHECK_EQ(in_data.size(), 2U);
CHECK_EQ(out_data.size(), 3U);
if (!init_cudnn_) {
init_cudnn_ = true;
Tensor<gpu, 4, DType> data = in_data[st::kData].get<gpu, 4, DType>(s);
Tensor<gpu, 4, DType> out = out_data[st::kOut].get<gpu, 4, DType>(s);
CUDNN_CALL(cudnnCreateSpatialTransformerDescriptor(&st_desc_));
CUDNN_CALL(cudnnCreateTensorDescriptor(&in_desc_));
CUDNN_CALL(cudnnCreateTensorDescriptor(&out_desc_));
CUDNN_CALL(cudnnSetTensor4dDescriptor(in_desc_,
format_,
dtype_,
data.size(0),
data.size(1),
data.size(2),
data.size(3)));
CUDNN_CALL(cudnnSetTensor4dDescriptor(out_desc_,
format_,
dtype_,
out.size(0),
out.size(1),
out.size(2),
out.size(3)));
if (param_.sampler_type == st::kBilinear) {
int dim[] = {static_cast<int>(out.size(0)), static_cast<int>(out.size(1)),
static_cast<int>(out.size(2)), static_cast<int>(out.size(3))};
CUDNN_CALL(cudnnSetSpatialTransformerNdDescriptor(st_desc_,
sampler_,
dtype_,
4,
dim));
}
}
}
bool init_cudnn_;
cudnnDataType_t dtype_;
cudnnSpatialTransformerDescriptor_t st_desc_;
cudnnTensorDescriptor_t in_desc_;
cudnnTensorDescriptor_t out_desc_;
cudnnSamplerType_t sampler_;
#if CUDNN_MAJOR >= 5
cudnnTensorFormat_t format_;
#endif
SpatialTransformerParam param_;
};
#endif // __CUDACC__ && CUDNN
} // namespace op
} // namespace mxnet
#endif // MXNET_OPERATOR_CUDNN_SPATIAL_TRANSFORMER_INL_H_
| {
"pile_set_name": "Github"
} |
/*******************************************************************************
* Copyright (c) 2019, 2020 Eurotech and/or its affiliates and others
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Eurotech - initial API and implementation
*******************************************************************************/
package org.eclipse.kapua.service.device.management.packages.model;
import org.eclipse.kapua.service.device.management.registry.operation.DeviceManagementOperation;
/**
* {@link DevicePackageOptions} definition.
*
* @since 1.1.0
*/
public interface DevicePackageOptions {
/**
* The {@link DeviceManagementOperation} timeout.
*
* @return The {@link DeviceManagementOperation} timeout.
* @since 1.1.0
*/
Long getTimeout();
/**
* Sets the {@link DeviceManagementOperation} timeout.
*
* @param timeout The {@link DeviceManagementOperation} timeout.
* @since 1.1.0
*/
void setTimeout(Long timeout);
}
| {
"pile_set_name": "Github"
} |
<?php
/**
* This file is part of Railt package.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
declare(strict_types=1);
namespace Railt\Contracts\Pipeline;
/**
* Interface DestinationInterface
*/
interface DestinationInterface
{
}
| {
"pile_set_name": "Github"
} |
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/ModernWpf;component/DesignTime/DesignTimeResources.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary> | {
"pile_set_name": "Github"
} |
////////////////////////////////////////////////////////////////////////////////////////////////////
// Copyright (c) 2009, Daniel Kollmann
// 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 Daniel Kollmann 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.
////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// The above software in this distribution may have been modified by THL A29 Limited ("Tencent Modifications").
//
// All Tencent Modifications are Copyright (C) 2015-2017 THL A29 Limited.
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using Behaviac.Design.Properties;
namespace Behaviac.Design.Nodes
{
/// <summary>
/// This node represents a condition which can be attached to the behaviour tree.
/// </summary>
public class ConditionConnectors : Condition
{
protected ConnectorSingle _isTrue;
protected ConnectorSingle _isFalse;
public ConditionConnectors(string label, string description)
: base(label, description)
{
_isTrue = new ConnectorSingle(_children, Resources.ConditionConnectorsTrue, "ConditionTrue");
_isFalse = new ConnectorSingle(_children, Resources.ConditionConnectorsFalse, "ConditionFalse");
}
}
}
| {
"pile_set_name": "Github"
} |
fileFormatVersion: 2
guid: 67f0a968d25514ddaba302d886a02ee7
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
| {
"pile_set_name": "Github"
} |
/* global NexT: true */
NexT.utils = NexT.$u = {
/**
* Wrap images with fancybox support.
*/
wrapImageWithFancyBox: function () {
$('.content img')
.not('[hidden]')
.not('.group-picture img, .post-gallery img')
.each(function () {
var $image = $(this);
var imageTitle = $image.attr('title');
var $imageWrapLink = $image.parent('a');
if ($imageWrapLink.size() < 1) {
var imageLink = ($image.attr('data-original')) ? this.getAttribute('data-original') : this.getAttribute('src');
$imageWrapLink = $image.wrap('<a href="' + imageLink + '"></a>').parent('a');
}
$imageWrapLink.addClass('fancybox fancybox.image');
$imageWrapLink.attr('rel', 'group');
if (imageTitle) {
$imageWrapLink.append('<p class="image-caption">' + imageTitle + '</p>');
//make sure img title tag will show correctly in fancybox
$imageWrapLink.attr('title', imageTitle);
}
});
$('.fancybox').fancybox({
helpers: {
overlay: {
locked: false
}
}
});
},
lazyLoadPostsImages: function () {
$('#posts').find('img').lazyload({
//placeholder: '/images/loading.gif',
effect: 'fadeIn',
threshold : 0
});
},
/**
* Tabs tag listener (without twitter bootstrap).
*/
registerTabsTag: function () {
var tNav = '.tabs ul.nav-tabs ';
// Binding `nav-tabs` & `tab-content` by real time permalink changing.
$(function() {
$(window).bind('hashchange', function() {
var tHash = location.hash;
if (tHash !== '') {
$(tNav + 'li:has(a[href="' + tHash + '"])').addClass('active').siblings().removeClass('active');
$(tHash).addClass('active').siblings().removeClass('active');
}
}).trigger('hashchange');
});
$(tNav + '.tab').on('click', function (href) {
href.preventDefault();
// Prevent selected tab to select again.
if(!$(this).hasClass('active')){
// Add & Remove active class on `nav-tabs` & `tab-content`.
$(this).addClass('active').siblings().removeClass('active');
var tActive = $(this).find('a').attr('href');
$(tActive).addClass('active').siblings().removeClass('active');
// Clear location hash in browser if #permalink exists.
if (location.hash !== '') {
history.pushState('', document.title, window.location.pathname + window.location.search);
}
}
});
},
registerESCKeyEvent: function () {
$(document).on('keyup', function (event) {
var shouldDismissSearchPopup = event.which === 27 &&
$('.search-popup').is(':visible');
if (shouldDismissSearchPopup) {
$('.search-popup').hide();
$('.search-popup-overlay').remove();
$('body').css('overflow', '');
}
});
},
registerBackToTop: function () {
var THRESHOLD = 50;
var $top = $('.back-to-top');
$(window).on('scroll', function () {
$top.toggleClass('back-to-top-on', window.pageYOffset > THRESHOLD);
var scrollTop = $(window).scrollTop();
var contentVisibilityHeight = NexT.utils.getContentVisibilityHeight();
var scrollPercent = (scrollTop) / (contentVisibilityHeight);
var scrollPercentRounded = Math.round(scrollPercent*100);
var scrollPercentMaxed = (scrollPercentRounded > 100) ? 100 : scrollPercentRounded;
$('#scrollpercent>span').html(scrollPercentMaxed);
});
$top.on('click', function () {
$('body').velocity('scroll');
});
},
/**
* Transform embedded video to support responsive layout.
* @see http://toddmotto.com/fluid-and-responsive-youtube-and-vimeo-videos-with-fluidvids-js/
*/
embeddedVideoTransformer: function () {
var $iframes = $('iframe');
// Supported Players. Extend this if you need more players.
var SUPPORTED_PLAYERS = [
'www.youtube.com',
'player.vimeo.com',
'player.youku.com',
'music.163.com',
'www.tudou.com'
];
var pattern = new RegExp( SUPPORTED_PLAYERS.join('|') );
$iframes.each(function () {
var iframe = this;
var $iframe = $(this);
var oldDimension = getDimension($iframe);
var newDimension;
if (this.src.search(pattern) > 0) {
// Calculate the video ratio based on the iframe's w/h dimensions
var videoRatio = getAspectRadio(oldDimension.width, oldDimension.height);
// Replace the iframe's dimensions and position the iframe absolute
// This is the trick to emulate the video ratio
$iframe.width('100%').height('100%')
.css({
position: 'absolute',
top: '0',
left: '0'
});
// Wrap the iframe in a new <div> which uses a dynamically fetched padding-top property
// based on the video's w/h dimensions
var wrap = document.createElement('div');
wrap.className = 'fluid-vids';
wrap.style.position = 'relative';
wrap.style.marginBottom = '20px';
wrap.style.width = '100%';
wrap.style.paddingTop = videoRatio + '%';
// Fix for appear inside tabs tag.
(wrap.style.paddingTop === '') && (wrap.style.paddingTop = '50%');
// Add the iframe inside our newly created <div>
var iframeParent = iframe.parentNode;
iframeParent.insertBefore(wrap, iframe);
wrap.appendChild(iframe);
// Additional adjustments for 163 Music
if (this.src.search('music.163.com') > 0) {
newDimension = getDimension($iframe);
var shouldRecalculateAspect = newDimension.width > oldDimension.width ||
newDimension.height < oldDimension.height;
// 163 Music Player has a fixed height, so we need to reset the aspect radio
if (shouldRecalculateAspect) {
wrap.style.paddingTop = getAspectRadio(newDimension.width, oldDimension.height) + '%';
}
}
}
});
function getDimension($element) {
return {
width: $element.width(),
height: $element.height()
};
}
function getAspectRadio(width, height) {
return height / width * 100;
}
},
/**
* Add `menu-item-active` class name to menu item
* via comparing location.path with menu item's href.
*/
addActiveClassToMenuItem: function () {
var path = window.location.pathname;
path = path === '/' ? path : path.substring(0, path.length - 1);
$('.menu-item a[href^="' + path + '"]:first').parent().addClass('menu-item-active');
},
hasMobileUA: function () {
var nav = window.navigator;
var ua = nav.userAgent;
var pa = /iPad|iPhone|Android|Opera Mini|BlackBerry|webOS|UCWEB|Blazer|PSP|IEMobile|Symbian/g;
return pa.test(ua);
},
isTablet: function () {
return window.screen.width < 992 && window.screen.width > 767 && this.hasMobileUA();
},
isMobile: function () {
return window.screen.width < 767 && this.hasMobileUA();
},
isDesktop: function () {
return !this.isTablet() && !this.isMobile();
},
/**
* Escape meta symbols in jQuery selectors.
*
* @param selector
* @returns {string|void|XML|*}
*/
escapeSelector: function (selector) {
return selector.replace(/[!"$%&'()*+,.\/:;<=>?@[\\\]^`{|}~]/g, '\\$&');
},
displaySidebar: function () {
if (!this.isDesktop() || this.isPisces() || this.isGemini()) {
return;
}
$('.sidebar-toggle').trigger('click');
},
isMist: function () {
return CONFIG.scheme === 'Mist';
},
isPisces: function () {
return CONFIG.scheme === 'Pisces';
},
isGemini: function () {
return CONFIG.scheme === 'Gemini';
},
getScrollbarWidth: function () {
var $div = $('<div />').addClass('scrollbar-measure').prependTo('body');
var div = $div[0];
var scrollbarWidth = div.offsetWidth - div.clientWidth;
$div.remove();
return scrollbarWidth;
},
getContentVisibilityHeight: function () {
var docHeight = $('#content').height(),
winHeight = $(window).height(),
contentVisibilityHeight = (docHeight > winHeight) ? (docHeight - winHeight) : ($(document).height() - winHeight);
return contentVisibilityHeight;
},
getSidebarb2tHeight: function () {
//var sidebarb2tHeight = (CONFIG.sidebar.b2t) ? document.getElementsByClassName('back-to-top')[0].clientHeight : 0;
var sidebarb2tHeight = (CONFIG.sidebar.b2t) ? $('.back-to-top').height() : 0;
//var sidebarb2tHeight = (CONFIG.sidebar.b2t) ? 24 : 0;
return sidebarb2tHeight;
},
getSidebarSchemePadding: function () {
var sidebarNavHeight = ($('.sidebar-nav').css('display') == 'block') ? $('.sidebar-nav').outerHeight(true) : 0,
sidebarInner = $('.sidebar-inner'),
sidebarPadding = sidebarInner.innerWidth() - sidebarInner.width(),
sidebarSchemePadding = this.isPisces() || this.isGemini() ?
((sidebarPadding * 2) + sidebarNavHeight + (CONFIG.sidebar.offset * 2) + this.getSidebarb2tHeight()) :
((sidebarPadding * 2) + (sidebarNavHeight / 2));
return sidebarSchemePadding;
}
/**
* Affix behaviour for Sidebar.
*
* @returns {Boolean}
*/
// needAffix: function () {
// return this.isPisces() || this.isGemini();
// }
};
$(document).ready(function () {
initSidebarDimension();
/**
* Init Sidebar & TOC inner dimensions on all pages and for all schemes.
* Need for Sidebar/TOC inner scrolling if content taller then viewport.
*/
function initSidebarDimension () {
var updateSidebarHeightTimer;
$(window).on('resize', function () {
updateSidebarHeightTimer && clearTimeout(updateSidebarHeightTimer);
updateSidebarHeightTimer = setTimeout(function () {
var sidebarWrapperHeight = document.body.clientHeight - NexT.utils.getSidebarSchemePadding();
updateSidebarHeight(sidebarWrapperHeight);
}, 0);
});
// Initialize Sidebar & TOC Width.
var scrollbarWidth = NexT.utils.getScrollbarWidth();
if ($('.site-overview-wrap').height() > (document.body.clientHeight - NexT.utils.getSidebarSchemePadding())) {
$('.site-overview').css('width', 'calc(100% + ' + scrollbarWidth + 'px)');
}
if ($('.post-toc-wrap').height() > (document.body.clientHeight - NexT.utils.getSidebarSchemePadding())) {
$('.post-toc').css('width', 'calc(100% + ' + scrollbarWidth + 'px)');
}
// Initialize Sidebar & TOC Height.
updateSidebarHeight(document.body.clientHeight - NexT.utils.getSidebarSchemePadding());
}
function updateSidebarHeight (height) {
height = height || 'auto';
$('.site-overview, .post-toc').css('max-height', height);
}
});
| {
"pile_set_name": "Github"
} |
-----BEGIN PRIVATE KEY-----
MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQguZyCKd02IZziRkK1
tsxzcCG6RW78M3ZBgZzR/OVuJbahRANCAARt9nY0uDB6MrEAfJPfBpOuvG/hqTMQ
+yzLCufg/BAkgFyuGY/29IRp39ivwnVud4ZXMgO30mn7SQXmdJlNMlZ5
-----END PRIVATE KEY-----
| {
"pile_set_name": "Github"
} |
#include <vector>
#include "caffe/filler.hpp"
#include "caffe/layer.hpp"
#include "caffe/vision_layers.hpp"
namespace caffe {
template <typename Dtype>
void DummyDataLayer<Dtype>::LayerSetUp(const vector<Blob<Dtype>*>& bottom,
const vector<Blob<Dtype>*>& top) {
const int num_top = top.size();
const DummyDataParameter& param = this->layer_param_.dummy_data_param();
const int num_data_filler = param.data_filler_size();
CHECK(num_data_filler == 0 || num_data_filler == 1 ||
num_data_filler == num_top)
<< "Number of data fillers must be 0, 1 or equal to the number of tops: "
<< num_top << "; you specified " << num_data_filler << " data fillers.";
const bool legacy_dims = param.num_size() || param.channels_size() ||
param.height_size() || param.width_size();
if (legacy_dims) {
CHECK_EQ(0, param.shape_size())
<< "Both shape and legacy fields were specified";
// Using deprecated 4D output dim specifiers.
CHECK(param.num_size() == 1 || param.num_size() == num_top)
<< "Must specify 'num' once, or once per top blob "
<< "(" << num_top << "); specified " << param.num_size() << ".";
CHECK(param.channels_size() == 1 || param.channels_size() == num_top)
<< "Must specify 'channels' once, or once per top blob "
<< "(" << num_top << "); specified " << param.channels_size() << ".";
CHECK(param.height_size() == 1 || param.height_size() == num_top)
<< "Must specify 'height' once, or once per top blob "
<< "(" << num_top << "); specified " << param.height_size() << ".";
CHECK(param.width_size() == 1 || param.width_size() == num_top)
<< "Must specify 'width' once, or once per top blob "
<< "(" << num_top << "); specified " << param.width_size() << ".";
} else {
CHECK(param.shape_size() == 1 || param.shape_size() == num_top)
<< "Must specify 'shape' once, or once per top blob "
<< "(" << num_top << "); specified " << param.shape_size() << ".";
}
// refill_[i] tells Forward i whether or not to actually refill top Blob i.
// If refill_[i] is false, Forward does nothing for Blob i. We use this to
// avoid wastefully refilling "constant" Blobs in every forward pass.
// We first fill refill_ in with the INVERSE of its final values.
// The first time we run Forward from the LayerSetUp method, we'll fill only
// Blobs for which refill_ is normally false. These Blobs will never be
// filled again.
refill_.clear();
fillers_.clear();
if (num_data_filler <= 1) {
FillerParameter filler_param;
if (num_data_filler == 0) {
filler_param.set_type("constant");
filler_param.set_value(0);
} else {
filler_param.CopyFrom(param.data_filler(0));
}
// Refill on each iteration iff not using a constant filler,
// but use the inverse of this rule for the first run.
refill_.resize(1);
refill_[0] = (strcmp(filler_param.type().c_str(), "constant") == 0);
fillers_.resize(1);
fillers_[0].reset(GetFiller<Dtype>(filler_param));
} else {
refill_.resize(num_top);
fillers_.resize(num_top);
for (int i = 0; i < num_top; ++i) {
fillers_[i].reset(GetFiller<Dtype>(param.data_filler(i)));
// Refill on each iteration iff not using a constant filler,
// but use the inverse of this rule for the first run.
refill_[i] =
(strcmp(param.data_filler(i).type().c_str(), "constant") == 0);
}
}
for (int i = 0; i < num_top; ++i) {
if (legacy_dims) {
const int num = (param.num_size() == 1) ? param.num(0) : param.num(i);
const int channels =
(param.channels_size() == 1) ? param.channels(0) : param.channels(i);
const int height =
(param.height_size() == 1) ? param.height(0) : param.height(i);
const int width =
(param.width_size() == 1) ? param.width(0) : param.width(i);
top[i]->Reshape(num, channels, height, width);
} else {
const int shape_index = (param.shape_size() == 1) ? 0 : i;
top[i]->Reshape(param.shape(shape_index));
}
}
// Run Forward once, with refill_ inverted, to fill the constant Blobs.
this->Forward(bottom, top);
// Invert the inverted refill_ values to refill the desired (non-constant)
// Blobs in every usual forward pass.
for (int i = 0; i < refill_.size(); ++i) {
refill_[i] = !refill_[i];
}
}
template <typename Dtype>
void DummyDataLayer<Dtype>::Forward_cpu(const vector<Blob<Dtype>*>& bottom,
const vector<Blob<Dtype>*>& top) {
for (int i = 0; i < top.size(); ++i) {
const int filler_id = (fillers_.size() > 1) ? i : 0;
if (refill_[filler_id]) {
fillers_[filler_id]->Fill(top[i]);
}
}
}
INSTANTIATE_CLASS(DummyDataLayer);
REGISTER_LAYER_CLASS(DummyData);
} // namespace caffe
| {
"pile_set_name": "Github"
} |
// Copyright (C) 2004, 2006 International Business Machines and others.
// All Rights Reserved.
// This code is published under the Eclipse Public License.
//
// Authors: Andreas Waechter IBM 2004-11-12
#ifndef __IPQUALITYFUNCTIONMUORACLE_HPP__
#define __IPQUALITYFUNCTIONMUORACLE_HPP__
#include "IpMuOracle.hpp"
#include "IpPDSystemSolver.hpp"
#include "IpIpoptCalculatedQuantities.hpp"
namespace Ipopt
{
/** Implementation of the probing strategy for computing the
* barrier parameter.
*/
class QualityFunctionMuOracle: public MuOracle
{
public:
/**@name Constructors/Destructors */
//@{
/** Constructor */
QualityFunctionMuOracle(
const SmartPtr<PDSystemSolver>& pd_solver
);
/** Destructor */
virtual ~QualityFunctionMuOracle();
//@}
virtual bool InitializeImpl(
const OptionsList& options,
const std::string& prefix
);
/** Method for computing the value of the barrier parameter that
* could be used in the current iteration (using the LOQO formula).
*/
virtual bool CalculateMu(
Number mu_min,
Number mu_max,
Number& new_mu
);
static void RegisterOptions(
SmartPtr<RegisteredOptions> roptions
);
/** @name Public enums.
* Some of those are also used for the quality function.
*/
//@{
/** enum for norm type */
enum NormEnum
{
NM_NORM_1 = 0,
NM_NORM_2_SQUARED,
NM_NORM_MAX,
NM_NORM_2
};
/** enum for centrality type */
enum CentralityEnum
{
CEN_NONE = 0,
CEN_LOG,
CEN_RECIPROCAL,
CEN_CUBED_RECIPROCAL
};
/** enum for the quality function balancing term type */
enum BalancingTermEnum
{
BT_NONE = 0,
BT_CUBIC
};
//@}
private:
/**@name Default Compiler Generated Methods
* (Hidden to avoid implicit creation/calling).
*
* These methods are not implemented and
* we do not want the compiler to implement
* them for us, so we declare them private
* and do not define them. This ensures that
* they will not be implicitly created/called.
*/
//@{
/** Default Constructor */
QualityFunctionMuOracle();
/** Copy Constructor */
QualityFunctionMuOracle(
const QualityFunctionMuOracle&
);
/** Default Assignment Operator */
void operator=(
const QualityFunctionMuOracle&
);
//@}
/** Pointer to the object that should be used to solve the
* primal-dual system.
*/
SmartPtr<PDSystemSolver> pd_solver_;
/** Auxiliary function for computing the average complementarity
* at a point, given step sizes and step.
*/
// ToDo Replace pointers by references
Number CalculateQualityFunction(
Number sigma,
const Vector& step_aff_x_L,
const Vector& step_aff_x_U,
const Vector& step_aff_s_L,
const Vector& step_aff_s_U,
const Vector& step_aff_y_c,
const Vector& step_aff_y_d,
const Vector& step_aff_z_L,
const Vector& step_aff_z_U,
const Vector& step_aff_v_L,
const Vector& step_aff_v_U,
const Vector& step_cen_x_L,
const Vector& step_cen_x_U,
const Vector& step_cen_s_L,
const Vector& step_cen_s_U,
const Vector& step_cen_y_c,
const Vector& step_cen_y_d,
const Vector& step_cen_z_L,
const Vector& step_cen_z_U,
const Vector& step_cen_v_L,
const Vector& step_cen_v_U
);
/** Auxiliary function performing the golden section */
Number PerformGoldenSection(
Number sigma_up,
Number q_up,
Number sigma_lo,
Number q_lo,
Number sigma_tol,
Number qf_tol,
const Vector& step_aff_x_L,
const Vector& step_aff_x_U,
const Vector& step_aff_s_L,
const Vector& step_aff_s_U,
const Vector& step_aff_y_c,
const Vector& step_aff_y_d,
const Vector& step_aff_z_L,
const Vector& step_aff_z_U,
const Vector& step_aff_v_L,
const Vector& step_aff_v_U,
const Vector& step_cen_x_L,
const Vector& step_cen_x_U,
const Vector& step_cen_s_L,
const Vector& step_cen_s_U,
const Vector& step_cen_y_c,
const Vector& step_cen_y_d,
const Vector& step_cen_z_L,
const Vector& step_cen_z_U,
const Vector& step_cen_v_L,
const Vector& step_cen_v_U
);
/** Auxiliary functions for scaling the sigma axis in the golden
* section procedure
*/
//@{
Number ScaleSigma(
Number sigma
);
Number UnscaleSigma(
Number scaled_sigma
);
//@}
/** Auxiliary function performing the golden section in the
* logarithmic scale
*/
/* This doesn't seem to work well, so I took it out for now (AW)
Number PerformGoldenSectionLog(Number sigma_up,
Number sigma_lo,
Number tol,
const Vector& step_aff_x_L,
const Vector& step_aff_x_U,
const Vector& step_aff_s_L,
const Vector& step_aff_s_U,
const Vector& step_aff_y_c,
const Vector& step_aff_y_d,
const Vector& step_aff_z_L,
const Vector& step_aff_z_U,
const Vector& step_aff_v_L,
const Vector& step_aff_v_U,
const Vector& step_cen_x_L,
const Vector& step_cen_x_U,
const Vector& step_cen_s_L,
const Vector& step_cen_s_U,
const Vector& step_cen_y_c,
const Vector& step_cen_y_d,
const Vector& step_cen_z_L,
const Vector& step_cen_z_U,
const Vector& step_cen_v_L,
const Vector& step_cen_v_U);
*/
/** @name Algorithmic parameters */
//@{
/** Upper bound on centering parameter sigma */
Number sigma_max_;
/** Lower bound on centering parameter sigma */
Number sigma_min_;
/** Norm to be used for the quality function. */
NormEnum quality_function_norm_;
/** Flag indicating how centrality should be involved in the
* quality function
*/
CentralityEnum quality_function_centrality_;
/** Flag indicating whether we use a balancing term in the quality
* function.
*/
BalancingTermEnum quality_function_balancing_term_;
/** Relative tolerance for golden bi-section algorithm in sigma
* space.
*/
Number quality_function_section_sigma_tol_;
/** Relative tolerance for golden bi-section algorithm in function
* value space.
*/
Number quality_function_section_qf_tol_;
/** Maximal number of bi-section steps in the golden section
* search for sigma.
*/
Index quality_function_max_section_steps_;
//@}
/** @name Temporary work space vectors.
*
* We use those to avoid repeated reallocation in CalculateQualityFunction.
*/
//@{
SmartPtr<Vector> tmp_step_x_L_;
SmartPtr<Vector> tmp_step_x_U_;
SmartPtr<Vector> tmp_step_s_L_;
SmartPtr<Vector> tmp_step_s_U_;
SmartPtr<Vector> tmp_step_z_L_;
SmartPtr<Vector> tmp_step_z_U_;
SmartPtr<Vector> tmp_step_v_L_;
SmartPtr<Vector> tmp_step_v_U_;
SmartPtr<Vector> tmp_slack_x_L_;
SmartPtr<Vector> tmp_slack_x_U_;
SmartPtr<Vector> tmp_slack_s_L_;
SmartPtr<Vector> tmp_slack_s_U_;
SmartPtr<Vector> tmp_z_L_;
SmartPtr<Vector> tmp_z_U_;
SmartPtr<Vector> tmp_v_L_;
SmartPtr<Vector> tmp_v_U_;
//@}
/* Counter for the qualify function evaluations */
Index count_qf_evals_;
/**@name Quantities used many times in CalculateQualityFunction,
* which we store here instead of retrieving them from cache every time.
*
* I (AW) don't know if that really makes a difference, but
* some of those things showed up in gprof.
*/
//@{
bool initialized_;
Index n_dual_;
Index n_pri_;
Index n_comp_;
SmartPtr<const Vector> curr_slack_x_L_;
SmartPtr<const Vector> curr_slack_x_U_;
SmartPtr<const Vector> curr_slack_s_L_;
SmartPtr<const Vector> curr_slack_s_U_;
SmartPtr<const Vector> curr_z_L_;
SmartPtr<const Vector> curr_z_U_;
SmartPtr<const Vector> curr_v_L_;
SmartPtr<const Vector> curr_v_U_;
Number curr_grad_lag_x_asum_;
Number curr_grad_lag_s_asum_;
Number curr_c_asum_;
Number curr_d_minus_s_asum_;
Number curr_grad_lag_x_nrm2_;
Number curr_grad_lag_s_nrm2_;
Number curr_c_nrm2_;
Number curr_d_minus_s_nrm2_;
Number curr_grad_lag_x_amax_;
Number curr_grad_lag_s_amax_;
Number curr_c_amax_;
Number curr_d_minus_s_amax_;
//@}
};
} // namespace Ipopt
#endif
| {
"pile_set_name": "Github"
} |
--no-step-log -v -b 0 --net-file=net.net.xml --routes=input_routes.rou.xml --scale 0.33
| {
"pile_set_name": "Github"
} |
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="?attr/colorControlNormal"
android:pathData="M10 20v-6h4v6h5v-8h3L12 3 2 12h3v8h5z" />
</vector>
| {
"pile_set_name": "Github"
} |
112 113 113.326
112 114 89.5415
112 115 93.412
112 116 102.398
112 117 104.287
112 118 105.091
112 119 103.521
112 120 104.721
112 121 96.3426
112 122 103.729
112 123 98.5156
112 124 101.983
112 125 105.289
112 126 115.472
112 127 94.0867
112 128 102.678
112 129 103.004
112 130 94.5449
112 131 103.539
112 132 102.438
112 133 101.539
112 134 96.498
112 135 97.6059
112 136 103.636
112 137 100.367
112 138 98.8608
112 139 102.43
112 140 938.629
112 168 917.143
112 196 930.278
112 224 959.289
112 252 906.23
112 280 913.65
112 308 906.118
112 336 17.7912
112 364 935.711
112 392 927.61
112 420 949.759
112 113 101.384
112 114 91.0018
112 115 94.302
112 116 103.136
112 117 102.739
112 118 102.956
112 119 111.163
112 120 112.858
112 121 94.1129
112 122 99.946
112 123 94.9447
112 124 102.217
112 125 103.517
112 126 103.146
112 127 103.232
112 128 93.5771
112 129 107.177
112 130 107.765
112 131 97.925
112 132 103.163
112 133 87.7864
112 134 97.2705
112 135 97.7274
112 136 96.869
112 137 103.18
112 138 102.535
112 139 102.413
112 140 928.346
112 168 936.931
112 196 910.645
112 224 931.482
112 252 952.816
112 280 911.809
112 308 900.791
112 336 17.0324
112 364 927.711
112 392 951.935
112 420 929.142
112 113 110.956
112 114 102.299
112 115 98.6238
112 116 103.865
112 117 102.525
112 118 102.606
112 119 102.251
112 120 102.542
112 121 102.627
112 122 99.9668
112 123 108.696
112 124 99.9461
112 125 102.84
112 126 110.565
112 127 90.3176
112 128 99.3975
112 129 97.9521
112 130 99.9139
112 131 118.377
112 132 101.545
112 133 115.316
112 134 107.905
112 135 100.41
112 136 109.748
112 137 105.397
112 138 103.302
112 139 102.928
112 140 917.525
112 168 926.255
112 196 923.346
112 224 937.277
112 252 905.721
112 280 913.66
112 308 900.093
112 336 17.1025
112 364 941.153
112 392 918.054
112 420 922.531
112 113 103.001
112 114 89.0778
112 115 107.503
112 116 105.504
112 117 102.186
112 118 104.225
112 119 90.884
112 120 102.335
112 121 102.977
112 122 93.5263
112 123 98.3726
112 124 105.537
112 125 102.974
112 126 117.197
112 127 104.11
112 128 99.9333
112 129 98.6497
112 130 99.7106
112 131 103.151
112 132 107.15
112 133 105.014
112 134 102.355
112 135 103.396
112 136 108.248
112 137 105.73
112 138 102.217
112 139 103.007
112 140 948.163
112 168 953.286
112 196 951.847
112 224 951.717
112 252 827.994
112 280 901.811
112 308 921.493
112 336 17.5782
112 364 929.66
112 392 916.302
112 420 937.489
112 113 111.137
112 114 102.449
112 115 92.3647
112 116 102.463
112 117 109.016
112 118 97.9222
112 119 103.263
112 120 110.049
112 121 102.591
112 122 103.148
112 123 98.4017
112 124 100.311
112 125 102.93
112 126 113.663
112 127 95.7719
112 128 95.3279
112 129 95.5616
112 130 106.632
112 131 102.996
112 132 102.251
112 133 104.07
112 134 103.479
112 135 95.7107
112 136 100.26
112 137 104.213
112 138 103.103
112 139 103.33
112 140 929.979
112 168 962.103
112 196 929.462
112 224 985.998
112 252 923.137
112 280 897.462
112 308 828.123
112 336 16.8741
112 364 920.355
112 392 948.846
112 420 953.611
112 113 93.9297
112 114 88.8704
112 115 103.305
112 116 101.27
112 117 102.352
112 118 107.429
112 119 101.948
112 120 94.0476
112 121 103.698
112 122 93.3537
112 123 95.3699
112 124 99.9205
112 125 103.023
112 126 106.727
112 127 90.4052
112 128 109.59
112 129 95.5038
112 130 102.979
112 131 103.121
112 132 105.68
112 133 102.809
112 134 92.7403
112 135 94.4788
112 136 102.707
112 137 103.108
112 138 102.412
112 139 103.068
112 140 937.53
112 168 962.358
112 196 933.595
112 224 983.306
112 252 948.991
112 280 982.154
112 308 836.086
112 336 17.0112
112 364 910.981
112 392 924.737
112 420 947.278
112 113 96.9435
112 114 95.9704
112 115 91.242
112 116 98.4202
112 117 96.6596
112 118 94.7225
112 119 85.9654
112 120 102.708
112 121 100.686
112 122 97.0932
112 123 102.755
112 124 102.433
112 125 102.632
112 126 102.385
112 127 94.0991
112 128 102.848
112 129 111.894
112 130 103.878
112 131 103.013
112 132 103.752
112 133 90.0147
112 134 112.51
112 135 105.873
112 136 98.6915
112 137 96.07
112 138 103.853
112 139 103.432
112 140 933.75
112 168 937.706
112 196 928.937
112 224 911.147
112 252 907.703
112 280 952.504
112 308 908.499
112 336 17.2692
112 364 923
112 392 927.599
112 420 924.012
112 113 105.402
112 114 91.527
112 115 98.1719
112 116 102.58
112 117 103.801
112 118 102.82
112 119 87.7233
112 120 92.2302
112 121 91.5571
112 122 102.249
112 123 103.247
112 124 102.127
112 125 102.558
112 126 112.776
112 127 102.828
112 128 93.1629
112 129 94.5306
112 130 102.686
112 131 103.303
112 132 103.286
112 133 103.62
112 134 103.541
112 135 97.3869
112 136 95.0045
112 137 102.95
112 138 103.015
112 139 103.069
112 140 958.554
112 168 936.058
112 196 945.866
112 224 975.736
112 252 974.363
112 280 938.715
112 308 923.989
112 336 17.9809
112 364 921.161
112 392 925.556
112 420 943.973
112 113 106.213
112 114 103.301
112 115 94.8563
112 116 97.5805
112 117 103.511
112 118 102.498
112 119 91.083
112 120 112.164
112 121 90.7901
112 122 102.389
112 123 102.653
112 124 102.386
112 125 99.4221
112 126 90.7906
112 127 102.837
112 128 110.904
112 129 98.1071
112 130 105.349
112 131 103.135
112 132 102.718
112 133 90.0272
112 134 111.238
112 135 97.0009
112 136 103.087
112 137 103.061
112 138 104.268
112 139 103.111
112 140 963.797
112 168 936.252
112 196 961.926
112 224 958.128
112 252 991.011
112 280 987.321
112 308 939.434
112 336 17.5097
112 364 931.791
112 392 927.801
112 420 923.214
112 113 92.172
112 114 100.723
112 115 99.2284
112 116 102.339
112 117 102.204
112 118 102.822
112 119 121.597
112 120 93.3991
112 121 105.168
112 122 101.304
112 123 103.941
112 124 103.662
112 125 100.007
112 126 103.141
112 127 103.192
112 128 105.413
112 129 102.613
112 130 96.004
112 131 103.795
112 132 102.941
112 133 103.394
112 134 110.277
112 135 95.9959
112 136 93.6871
112 137 100.064
112 138 102.017
112 139 103.155
112 140 954.73
112 168 937.132
112 196 933
112 224 964.767
112 252 924.925
112 280 902.555
112 308 897.445
112 336 17.2667
112 364 946.421
112 392 951.471
112 420 924.309
112 113 90.1667
112 114 113.605
112 115 95.095
112 116 106.219
112 117 97.2194
112 118 102.375
112 119 110.126
112 120 88.8311
112 121 101.587
112 122 96.2889
112 123 106.663
112 124 100.377
112 125 103.18
112 126 102.924
112 127 103.19
112 128 102.983
112 129 94.636
112 130 103.268
112 131 104.532
112 132 103.168
112 133 90.8707
112 134 104.061
112 135 102.305
112 136 100.732
112 137 100.732
112 138 103.723
112 139 103.023
112 140 925.837
112 168 969.927
112 196 951.223
112 224 994.439
112 252 954.075
112 280 955.924
112 308 823.26
112 336 17.0976
112 364 927.557
112 392 925.395
112 420 923.597
112 113 102.205
112 114 112.527
112 115 102.269
112 116 97.4757
112 117 102.214
112 118 105.946
112 119 88.2965
112 120 110.944
112 121 102.487
112 122 93.6099
112 123 95.159
112 124 102.904
112 125 102.622
112 126 92.4296
112 127 102.892
112 128 99.0643
112 129 100.239
112 130 97.7665
112 131 99.835
112 132 102.922
112 133 95.1617
112 134 101.929
112 135 112.897
112 136 103.413
112 137 99.4849
112 138 103.297
112 139 104.071
112 140 954.284
112 168 934.566
112 196 933.427
112 224 968.574
112 252 913.305
112 280 957.845
112 308 923.106
112 336 16.9442
112 364 917.538
112 392 949.88
112 420 934.76
112 113 89.5327
112 114 102.376
112 115 94.4147
112 116 105.162
112 117 102.2
112 118 102.995
112 119 90.8313
112 120 112.373
112 121 94.5759
112 122 102.377
112 123 98.562
112 124 101.992
112 125 102.828
112 126 113.872
112 127 110.357
112 128 100.216
112 129 95.6109
112 130 99.1419
112 131 103.633
112 132 103.611
112 133 105.261
112 134 103.821
112 135 113.437
112 136 96.8948
112 137 103.904
112 138 100.64
112 139 102.734
112 140 940.176
112 168 945.12
112 196 924.993
112 224 939.645
112 252 802.971
112 280 918.745
112 308 896.137
112 336 16.845
112 364 921.723
112 392 940.112
112 420 934.419
112 113 102.2
112 114 90.0592
112 115 98.6946
112 116 102.414
112 117 98.5549
112 118 96.8981
112 119 102.174
112 120 102.817
112 121 100.008
112 122 102.495
112 123 95.6553
112 124 103.37
112 125 104.243
112 126 105.915
112 127 102.313
112 128 105.421
112 129 106.764
112 130 102.765
112 131 108.522
112 132 103.627
112 133 112.963
112 134 96.3391
112 135 93.6512
112 136 95.4887
112 137 106.368
112 138 98.4633
112 139 102.596
112 140 917.91
112 168 943.899
112 196 928.242
112 224 980.546
112 252 890.502
112 280 941.979
112 308 825.367
112 336 16.8197
112 364 934.322
112 392 924.293
112 420 940.828
112 113 113.064
112 114 101.265
112 115 107.097
112 116 95.1477
112 117 99.5806
112 118 100.009
112 119 113.245
112 120 106.777
112 121 94.1605
112 122 111.224
112 123 100.594
112 124 103.26
112 125 100.629
112 126 115.948
112 127 103.712
112 128 115.539
112 129 103.123
112 130 103.049
112 131 103.833
112 132 102.752
112 133 98.2114
112 134 89.4868
112 135 107.517
112 136 93.2871
112 137 97.2748
112 138 102.227
112 139 101.116
112 140 924.77
112 168 939.84
112 196 945.224
112 224 902.178
112 252 893.816
112 280 961.04
112 308 808.068
112 336 16.9513
112 364 918.493
112 392 932.484
112 420 928.371
112 113 104.864
112 114 102.978
112 115 109.815
112 116 102.396
112 117 100.011
112 118 105.167
112 119 92.4348
112 120 103.626
112 121 102.829
112 122 103.263
112 123 97.957
112 124 102.181
112 125 103.118
112 126 114.652
112 127 104.783
112 128 103.177
112 129 94.4616
112 130 96.7458
112 131 102.821
112 132 104.251
112 133 103.34
112 134 102.361
112 135 93.1999
112 136 95.8828
112 137 94.3667
112 138 102.275
112 139 101.914
112 140 912.177
112 168 929.336
112 196 947.94
112 224 899.842
112 252 925.051
112 280 933.129
112 308 822.964
112 336 16.9397
112 364 956.267
112 392 925.803
112 420 942.165
112 113 116.399
112 114 92.7384
112 115 98.2242
112 116 95.0179
112 117 98.8942
112 118 104.313
112 119 92.2991
112 120 88.8676
112 121 98.1814
112 122 104.139
112 123 101.104
112 124 102.983
112 125 103.373
112 126 104.248
112 127 97.8721
112 128 100.498
112 129 93.3479
112 130 101.835
112 131 101.981
112 132 102.632
112 133 101.387
112 134 114.179
112 135 92.2637
112 136 98.421
112 137 105.797
112 138 99.5265
112 139 102.687
112 140 937.304
112 168 925.121
112 196 922.934
112 224 977.048
112 252 918.565
112 280 977.265
112 308 912.575
112 336 17.1204
112 364 928.899
112 392 918.042
112 420 925.816
112 113 102.938
112 114 91.4711
112 115 107.941
112 116 95.4124
112 117 99.5231
112 118 102.03
112 119 104.941
112 120 113.318
112 121 100.66
112 122 103.452
112 123 103.238
112 124 104.192
112 125 102.194
112 126 98.6361
112 127 102.075
112 128 93.7222
112 129 98.689
112 130 94.1919
112 131 99.2896
112 132 102.797
112 133 101.371
112 134 102.252
112 135 92.4732
112 136 102.356
112 137 102.766
112 138 98.9514
112 139 99.8641
112 140 928.353
112 168 946.662
112 196 932.33
112 224 916.445
112 252 824.076
112 280 850.759
112 308 929.153
112 336 17.1629
112 364 944.328
112 392 946.773
112 420 932.421
112 113 112.878
112 114 93.2419
112 115 95.8458
112 116 109.218
112 117 101.607
112 118 103.045
112 119 103.09
112 120 89.3328
112 121 94.7248
112 122 94.0197
112 123 98.6028
112 124 99.9596
112 125 102.94
112 126 97.8994
112 127 109.936
112 128 104.432
112 129 92.8248
112 130 98.4372
112 131 108.654
112 132 102.291
112 133 111.563
112 134 102.573
112 135 99.9215
112 136 96.6908
112 137 102.689
112 138 102.309
112 139 102.561
112 140 928.621
112 168 927.151
112 196 910.644
112 224 916.238
112 252 987.963
112 280 926.627
112 308 829.783
112 336 17.7903
112 364 924.155
112 392 928.577
112 420 923.208
112 113 100.608
112 114 92.6119
112 115 109.196
112 116 96.2649
112 117 103.098
112 118 107.067
112 119 103.022
112 120 116.047
112 121 99.2436
112 122 101.096
112 123 101.385
112 124 103.341
112 125 103.013
112 126 87.792
112 127 102.728
112 128 102.633
112 129 95.4643
112 130 102.882
112 131 102.894
112 132 102.814
112 133 110.737
112 134 89.5876
112 135 94.849
112 136 93.2581
112 137 96.655
112 138 98.3664
112 139 102.311
112 140 924.287
112 168 926.159
112 196 951.455
112 224 983.979
112 252 902.237
112 280 977.868
112 308 924.822
112 336 17.5372
112 364 925.429
112 392 920.369
112 420 938.318
112 113 103.147
112 114 102.233
112 115 106.608
112 116 102.918
112 117 100.394
112 118 105.121
112 119 98.4907
112 120 90.2665
112 121 96.8621
112 122 107.869
112 123 108.864
112 124 103.079
112 125 103.05
112 126 109.764
112 127 109.758
112 128 104.39
112 129 97.8254
112 130 101.672
112 131 102.479
112 132 113.756
112 133 102.516
112 134 95.1759
112 135 108.224
112 136 97.0765
112 137 102.42
112 138 102.466
112 139 102.429
112 140 929.97
112 168 930.685
112 196 933.041
112 224 908.4
112 252 916.269
112 280 899.035
112 308 829.468
112 336 18.2011
112 364 935.488
112 392 934.665
112 420 932.347
112 113 104.901
112 114 92.3356
112 115 95.8352
112 116 96.796
112 117 103.656
112 118 106.713
112 119 111.62
112 120 93.1591
112 121 95.8145
112 122 98.0092
112 123 100.622
112 124 102.882
112 125 104.373
112 126 108.87
112 127 92.8503
112 128 96.7263
112 129 96.02
112 130 95.0423
112 131 102.543
112 132 99.3341
112 133 114.484
112 134 89.8749
112 135 98.3682
112 136 96.5473
112 137 96.5434
112 138 102.819
112 139 102.356
112 140 939.531
112 168 955.656
112 196 948.806
112 224 936.186
112 252 923.803
112 280 931.418
112 308 899.792
112 336 17.6922
112 364 929.109
112 392 958.191
112 420 929.086
112 113 104.475
112 114 103.041
112 115 110.655
112 116 103.041
112 117 103.793
112 118 99.8891
112 119 113.549
112 120 92.3679
112 121 92.6813
112 122 94.3707
112 123 103.851
112 124 109.272
112 125 101.115
112 126 103.046
112 127 102.813
112 128 93.8298
112 129 108.339
112 130 94.532
112 131 102.439
112 132 102.571
112 133 91.8632
112 134 112.684
112 135 99.8813
112 136 97.0579
112 137 99.7427
112 138 102.38
112 139 102.446
112 140 927.005
112 168 933.564
112 196 912.434
112 224 902.141
112 252 947.588
112 280 905.236
112 308 821.982
112 336 17.3682
112 364 932.866
112 392 961.483
112 420 939.689
112 113 94.7442
112 114 111.686
112 115 99.9443
112 116 101.539
112 117 103.269
112 118 103.102
112 119 114.654
112 120 112.014
112 121 104.1
112 122 101.193
112 123 97.775
112 124 103.561
112 125 101.354
112 126 114.789
112 127 93.0177
112 128 105.883
112 129 111.152
112 130 107.58
112 131 102.494
112 132 102.386
112 133 86.4248
112 134 113.234
112 135 111.83
112 136 98.3314
112 137 102.42
112 138 100.38
112 139 102.236
112 140 931.256
112 168 937.605
112 196 921.998
112 224 985.185
112 252 926.044
112 280 837.9
112 308 908.817
112 336 17.2819
112 364 934.218
112 392 959.217
112 420 924.596
112 113 111.942
112 114 103.017
112 115 94.7954
112 116 103.964
112 117 103.777
112 118 114.168
112 119 113.257
112 120 113.731
112 121 114.639
112 122 94.959
112 123 98.2079
112 124 103.073
112 125 103.092
112 126 102.831
112 127 91.1799
112 128 97.6203
112 129 110.453
112 130 95.493
112 131 102.582
112 132 102.33
112 133 107.923
112 134 94.6021
112 135 94.4432
112 136 93.5094
112 137 97.3862
112 138 103.395
112 139 102.137
112 140 922.545
112 168 924.836
112 196 929.13
112 224 946.085
112 252 923.054
112 280 945.981
112 308 840.814
112 336 18.2931
112 364 918.767
112 392 941.677
112 420 943.346
112 113 118.945
112 114 92.0043
112 115 97.0105
112 116 106.86
112 117 99.6809
112 118 105.158
112 119 103.471
112 120 108.289
112 121 113.852
112 122 103.675
112 123 97.8241
112 124 103.271
112 125 102.597
112 126 102.773
112 127 99.4309
112 128 100.055
112 129 102.479
112 130 93.8981
112 131 100.334
112 132 96.9484
112 133 86.4948
112 134 102.162
112 135 102.276
112 136 100.633
112 137 102.292
112 138 102.36
112 139 102.471
112 140 929.376
112 168 947.87
112 196 923.59
112 224 986.131
112 252 924.922
112 280 950.349
112 308 903.166
112 336 18.236
112 364 953.535
112 392 939.467
112 420 957.323
112 113 94.6665
112 114 118.7
112 115 102.947
112 116 107.351
112 117 98.7087
112 118 105.992
112 119 115.099
112 120 107.197
112 121 111.468
112 122 97.4238
112 123 97.7159
112 124 99.4087
112 125 98.7568
112 126 90.9554
112 127 100.845
112 128 112.046
112 129 96.7647
112 130 96.3679
112 131 102.373
112 132 105.039
112 133 102.294
112 134 95.322
112 135 94.1027
112 136 99.9159
112 137 104.955
112 138 102.703
112 139 102.588
112 140 927.377
112 168 951.146
112 196 925.872
112 224 950.549
112 252 926.442
112 280 906.93
112 308 819.618
112 336 18.4234
112 364 934.883
112 392 941.924
112 420 954.563
112 113 92.9806
112 114 90.4974
112 115 97.9328
112 116 95.3724
112 117 107.779
112 118 102.97
112 119 91.1228
112 120 103.09
112 121 109.03
112 122 102.469
112 123 103.613
112 124 102.728
112 125 102.874
112 126 102.832
112 127 89.7163
112 128 105.504
112 129 97.3113
112 130 101.773
112 131 102.834
112 132 101.392
112 133 113.873
112 134 112.883
112 135 92.1301
112 136 100.881
112 137 99.9022
112 138 99.4775
112 139 102.87
112 140 928.593
112 168 913.885
112 196 920.158
112 224 985.161
112 252 899.948
112 280 968.167
112 308 834.331
112 336 17.3459
112 364 927.163
112 392 925.396
112 420 953.279
112 113 95.6425
112 114 111.757
112 115 95.0458
112 116 102.991
112 117 100.291
112 118 103.221
112 119 102.915
112 120 110.912
112 121 92.7378
112 122 97.9445
112 123 98.4072
112 124 102.853
112 125 101.075
112 126 114.393
112 127 94.4313
112 128 94.0864
112 129 103.194
112 130 101.271
112 131 102.236
112 132 101.785
112 133 115.737
112 134 102.521
112 135 93.1992
112 136 94.0459
112 137 102.636
112 138 98.807
112 139 102.33
112 140 938.521
112 168 928.457
112 196 929.57
112 224 944.899
112 252 849.412
112 280 939.361
112 308 912.872
112 336 17.4694
112 364 924.39
112 392 940.09
112 420 931.497
| {
"pile_set_name": "Github"
} |
// (C) Copyright Jim Douglas 2005.
// Use, modification and distribution are subject to 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)
// See http://www.boost.org for most recent version.
// QNX specific config options:
#define BOOST_PLATFORM "QNX"
#define BOOST_HAS_UNISTD_H
#include <boost/config/detail/posix_features.hpp>
// QNX claims XOpen version 5 compatibility, but doesn't have an nl_types.h
// or log1p and expm1:
#undef BOOST_HAS_NL_TYPES_H
#undef BOOST_HAS_LOG1P
#undef BOOST_HAS_EXPM1
#define BOOST_HAS_PTHREADS
#define BOOST_HAS_PTHREAD_MUTEXATTR_SETTYPE
#define BOOST_HAS_GETTIMEOFDAY
#define BOOST_HAS_CLOCK_GETTIME
#define BOOST_HAS_NANOSLEEP
| {
"pile_set_name": "Github"
} |
/*
* Copyright (C) 2012 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.
*/
package com.android.camera;
import android.graphics.drawable.Drawable;
import android.util.Log;
import com.android.camera.CameraPreference.OnPreferenceChangedListener;
import com.android.camera.drawable.TextDrawable;
import com.android.camera.ui.PieItem;
import com.android.camera.ui.PieItem.OnClickListener;
import com.android.camera.ui.PieRenderer;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class PieController {
private static String TAG = "CAM_piecontrol";
protected static final int MODE_PHOTO = 0;
protected static final int MODE_VIDEO = 1;
protected CameraActivity mActivity;
protected PreferenceGroup mPreferenceGroup;
protected OnPreferenceChangedListener mListener;
protected PieRenderer mRenderer;
private List<IconListPreference> mPreferences;
private Map<IconListPreference, PieItem> mPreferenceMap;
private Map<IconListPreference, String> mOverrides;
public void setListener(OnPreferenceChangedListener listener) {
mListener = listener;
}
public PieController(CameraActivity activity, PieRenderer pie) {
mActivity = activity;
mRenderer = pie;
mPreferences = new ArrayList<IconListPreference>();
mPreferenceMap = new HashMap<IconListPreference, PieItem>();
mOverrides = new HashMap<IconListPreference, String>();
}
public void initialize(PreferenceGroup group) {
mRenderer.clearItems();
setPreferenceGroup(group);
}
public void onSettingChanged(ListPreference pref) {
if (mListener != null) {
mListener.onSharedPreferenceChanged();
}
}
protected void setCameraId(int cameraId) {
ListPreference pref = mPreferenceGroup.findPreference(CameraSettings.KEY_CAMERA_ID);
pref.setValue("" + cameraId);
}
protected PieItem makeItem(int resId) {
// We need a mutable version as we change the alpha
Drawable d = mActivity.getResources().getDrawable(resId).mutate();
return new PieItem(d, 0);
}
protected PieItem makeItem(CharSequence value) {
TextDrawable drawable = new TextDrawable(mActivity.getResources(), value);
return new PieItem(drawable, 0);
}
public void addItem(String prefKey, float center, float sweep) {
final IconListPreference pref =
(IconListPreference) mPreferenceGroup.findPreference(prefKey);
if (pref == null) return;
int[] iconIds = pref.getLargeIconIds();
int resid = -1;
if (!pref.getUseSingleIcon() && iconIds != null) {
// Each entry has a corresponding icon.
int index = pref.findIndexOfValue(pref.getValue());
resid = iconIds[index];
} else {
// The preference only has a single icon to represent it.
resid = pref.getSingleIcon();
}
PieItem item = makeItem(resid);
// use center and sweep to determine layout
item.setFixedSlice(center, sweep);
mRenderer.addItem(item);
mPreferences.add(pref);
mPreferenceMap.put(pref, item);
int nOfEntries = pref.getEntries().length;
if (nOfEntries > 1) {
for (int i = 0; i < nOfEntries; i++) {
PieItem inner = null;
if (iconIds != null) {
inner = makeItem(iconIds[i]);
} else {
inner = makeItem(pref.getEntries()[i]);
}
item.addItem(inner);
final int index = i;
inner.setOnClickListener(new OnClickListener() {
@Override
public void onClick(PieItem item) {
pref.setValueIndex(index);
reloadPreference(pref);
onSettingChanged(pref);
}
});
}
}
}
public void setPreferenceGroup(PreferenceGroup group) {
mPreferenceGroup = group;
}
public void reloadPreferences() {
mPreferenceGroup.reloadValue();
for (IconListPreference pref : mPreferenceMap.keySet()) {
reloadPreference(pref);
}
}
private void reloadPreference(IconListPreference pref) {
if (pref.getUseSingleIcon()) return;
PieItem item = mPreferenceMap.get(pref);
String overrideValue = mOverrides.get(pref);
int[] iconIds = pref.getLargeIconIds();
if (iconIds != null) {
// Each entry has a corresponding icon.
int index;
if (overrideValue == null) {
index = pref.findIndexOfValue(pref.getValue());
} else {
index = pref.findIndexOfValue(overrideValue);
if (index == -1) {
// Avoid the crash if camera driver has bugs.
Log.e(TAG, "Fail to find override value=" + overrideValue);
pref.print();
return;
}
}
item.setImageResource(mActivity, iconIds[index]);
} else {
// The preference only has a single icon to represent it.
item.setImageResource(mActivity, pref.getSingleIcon());
}
}
// Scene mode may override other camera settings (ex: flash mode).
public void overrideSettings(final String ... keyvalues) {
if (keyvalues.length % 2 != 0) {
throw new IllegalArgumentException();
}
for (IconListPreference pref : mPreferenceMap.keySet()) {
override(pref, keyvalues);
}
}
private void override(IconListPreference pref, final String ... keyvalues) {
mOverrides.remove(pref);
for (int i = 0; i < keyvalues.length; i += 2) {
String key = keyvalues[i];
String value = keyvalues[i + 1];
if (key.equals(pref.getKey())) {
mOverrides.put(pref, value);
PieItem item = mPreferenceMap.get(pref);
item.setEnabled(value == null);
break;
}
}
reloadPreference(pref);
}
}
| {
"pile_set_name": "Github"
} |
//
// SHKEmbossColor.swift
// OctopusKit
//
// Created by [email protected] on 2020/05/12.
// ORIGINAL: SOURCE: https://github.com/twostraws/ShaderKit
// ORIGINAL: CREDIT: Copyright © 2017 Paul Hudson. Licensed under MIT License (see the original header in the shader source string below)
// UPDATES: Copyright © 2020 Invading Octopus. Licensed under Apache License v2.0 (see LICENSE.txt)
//
import SpriteKit
public final class EmbossColorShader: SKShader {
public init(strength: Float = 1) {
let uniforms: [SKUniform] = [
SKUniform(name: "u_strength", float: strength)
]
super.init(source: SHKEmbossColorShaderSource, uniforms: uniforms)
self.attributes = [SKAttribute(name: "a_size", type: .vectorFloat2)]
}
public required init?(coder aDecoder: NSCoder) { fatalError("init(coder:) has not been implemented") }
}
fileprivate let SHKEmbossColorShaderSource = """
//
// Creates a color emboss effect for the node.
// Attribute: a_size, the size of the node.
// Uniform: u_strength, how much embossing to apply (ranges from 0 to 1 work best)
//
// This works in several steps. First, we need to find the size of one pixel in the image,
// so we are able to read other nearby pixels.
//
// Second, we create our base new color using the pixel's existing color
//
// Third, we read values diagonally up and to the right, then down and to the left, to see
// what's nearby, and add or subtract them from our color. How far we move diagonally
// depends on the strength the user provided.
//
// If you're not sure how this works, imagine a pixel on the top edge of a sprite. Above it has nothing,
// so nothing gets added to the base color. Below it has a pixel of the same color, so that color
// gets subtracted from the base color to make it black. The same is true in reverse of pixels on
// the bottom edge: they have nothing below so nothing is subtracted, but they have a pixel above so
// that gets added, making it a bright color.
//
// As for pixels in the middle, they'll get embossed based on the pixels either side of them. If a red pixel
// is surrounded by a sea of other red pixels, then red will get added from above then subtracted in equal
// measure from below, so the final color will be the original.
//
// MIT License
//
// Copyright (c) 2017 Paul Hudson
// https://www.github.com/twostraws/ShaderKit
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
//
void main() {
// find the current pixel color
vec4 current_color = SKDefaultShading();
// if it's not transparent
if (current_color.a > 0.0) {
// find the size of one pixel by reading the input size
vec2 pixel_size = 1.0 / a_size;
// copy our current color so we can modify it
vec4 new_color = current_color;
// move up one pixel diagonally and read the current color, multiply it by the input strength, then add it to our pixel color
new_color += texture2D(u_texture, v_tex_coord + pixel_size) * u_strength;
// move down one pixel diagonally and read the current color, multiply it by the input strength, then subtract it to our pixel color
new_color -= texture2D(u_texture, v_tex_coord - pixel_size) * u_strength;
// use that new color, with an alpha of 1, for our pixel color, multiplying by this pixel's alpha
// (to avoid a hard edge) and also multiplying by the alpha for this node
gl_FragColor = vec4(new_color.rgb, 1) * current_color.a * v_color_mix.a;
} else {
// use the current (transparent) color
gl_FragColor = current_color;
}
}
"""
| {
"pile_set_name": "Github"
} |
#
# Recommended minimum configuration:
#
acl manager proto cache_object
acl localhost src 127.0.0.1/32 ::1
acl to_localhost dst 127.0.0.0/8 0.0.0.0/32 ::1
# Example rule allowing access from your local networks.
# Adapt to list your (internal) IP networks from where browsing
# should be allowed
acl localnet src 10.0.0.0/8 # RFC1918 possible internal network
acl localnet src 172.16.0.0/12 # RFC1918 possible internal network
acl localnet src 192.168.0.0/16 # RFC1918 possible internal network
acl localnet src fc00::/7 # RFC 4193 local private network range
acl localnet src fe80::/10 # RFC 4291 link-local (directly plugged) machines
acl SSL_ports port 443
acl Safe_ports port 80 # http
acl Safe_ports port 21 # ftp
acl Safe_ports port 443 # https
acl Safe_ports port 70 # gopher
acl Safe_ports port 210 # wais
acl Safe_ports port 1025-65535 # unregistered ports
acl Safe_ports port 280 # http-mgmt
acl Safe_ports port 488 # gss-http
acl Safe_ports port 591 # filemaker
acl Safe_ports port 777 # multiling http
acl CONNECT method CONNECT
#
# Recommended minimum Access Permission configuration:
#
# Only allow cachemgr access from localhost
http_access allow manager localhost
http_access deny manager
# Deny requests to certain unsafe ports
http_access deny !Safe_ports
# Deny CONNECT to other than secure SSL ports
#http_access deny CONNECT !SSL_ports
# We strongly recommend the following be uncommented to protect innocent
# web applications running on the proxy server who think the only
# one who can access services on "localhost" is a local user
#http_access deny to_localhost
#
# INSERT YOUR OWN RULE(S) HERE TO ALLOW ACCESS FROM YOUR CLIENTS
#
# Example rule allowing access from your local networks.
# Adapt localnet in the ACL section to list your (internal) IP networks
# from where browsing should be allowed
http_access allow localnet
http_access allow localhost
# And finally deny all other access to this proxy
http_access deny all
# Squid normally listens to port 3128
http_port 3128
# We recommend you to use at least the following line.
hierarchy_stoplist cgi-bin ?
# Uncomment and adjust the following to add a disk cache directory.
#cache_dir ufs /usr/local/var/cache 100 16 256
# Leave coredumps in the first cache dir
coredump_dir /usr/local/var/cache
# Add any of your own refresh_pattern entries above these.
refresh_pattern ^ftp: 1440 20% 10080
refresh_pattern ^gopher: 1440 0% 1440
refresh_pattern -i (/cgi-bin/|\?) 0 0% 0
refresh_pattern . 0 20% 4320
| {
"pile_set_name": "Github"
} |
LIBRARY "dinput8.dll"
EXPORTS
DirectInput8Create @1
DllCanUnloadNow PRIVATE
DllGetClassObject PRIVATE
DllRegisterServer PRIVATE
DllUnregisterServer PRIVATE
| {
"pile_set_name": "Github"
} |
/*
* Copyright (C) 2013 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. 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.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS 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 APPLE INC. OR ITS 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.
*/
WebInspector.EventListenerSectionGroup = function(eventListener, nodeId)
{
this._eventListener = eventListener;
this._nodeId = nodeId;
var rows = [];
rows.push(new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Node"), this._nodeTextOrLink()));
rows.push(new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Function"), this._functionTextOrLink()));
rows.push(new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString("Type"), this._type()));
WebInspector.DetailsSectionGroup.call(this, rows);
}
WebInspector.EventListenerSectionGroup.prototype = {
constructor: WebInspector.EventListenerSectionGroup,
_nodeTextOrLink: function()
{
var node = this._eventListener.node;
if (!node)
return;
if (node.nodeType() === Node.DOCUMENT_NODE)
return "document";
return WebInspector.linkifyNodeReference(node);
},
_type: function()
{
if (this._eventListener.useCapture)
return WebInspector.UIString("Capturing");
if (this._eventListener.isAttribute)
return WebInspector.UIString("Attribute");
return WebInspector.UIString("Bubbling");
},
_functionTextOrLink: function()
{
var match = this._eventListener.handlerBody.match(/function ([^\(]+?)\(/);
if (match) {
var anonymous = false;
var functionName = match[1];
} else {
var anonymous = true;
var functionName = WebInspector.UIString("(anonymous function)");
}
if (!this._eventListener.location)
return functionName;
// COMPATIBILITY (iOS 6): In the past scriptId could be a URL. Now it is always a script identifier.
// So try looking up the resource by URL if a script can't be found directly.
var scriptIdentifierOrURL = this._eventListener.location.scriptId;
var sourceCode = WebInspector.debuggerManager.scriptForIdentifier(scriptIdentifierOrURL);
if (!sourceCode)
sourceCode = WebInspector.frameResourceManager.resourceForURL(scriptIdentifierOrURL);
if (!sourceCode)
return functionName;
var sourceCodeLocation = sourceCode.createSourceCodeLocation(this._eventListener.location.lineNumber, this._eventListener.location.columnNumber || 0);
var linkElement = WebInspector.createSourceCodeLocationLink(sourceCodeLocation, anonymous);
if (anonymous)
return linkElement;
var fragment = document.createDocumentFragment();
fragment.appendChild(linkElement);
fragment.appendChild(document.createTextNode(functionName));
return fragment;
}
}
WebInspector.EventListenerSectionGroup.prototype.__proto__ = WebInspector.DetailsSectionGroup.prototype;
| {
"pile_set_name": "Github"
} |
<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2014 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Alchemy\Phrasea\Feed\Formatter;
use Alchemy\Phrasea\Application;
use Alchemy\Phrasea\Feed\FeedInterface;
use Alchemy\Phrasea\Model\Entities\User;
use Symfony\Component\HttpFoundation\Response;
interface FeedFormatterInterface
{
/**
* Returns a string representation of the feed.
*
* @param FeedInterface $feed
* @param int $page
* @param User $user
* @param string $generator
* @param Application $app
*
* @return string
*/
public function format(FeedInterface $feed, $page, User $user = null, $generator = 'Phraseanet', Application $app);
/**
* Returns an HTTP Response containing a string representation of the feed.
*
* @param FeedInterface $feed
* @param int $page
* @param User $user
* @param string $generator
* @param Application $app
*
* @return Response
*/
public function createResponse(Application $app, FeedInterface $feed, $page, User $user = null, $generator = 'Phraseanet');
}
| {
"pile_set_name": "Github"
} |
// Package sockets provides helper functions to create and configure Unix or TCP sockets.
package sockets
import (
"crypto/tls"
"net"
)
// NewTCPSocket creates a TCP socket listener with the specified address and
// the specified tls configuration. If TLSConfig is set, will encapsulate the
// TCP listener inside a TLS one.
func NewTCPSocket(addr string, tlsConfig *tls.Config) (net.Listener, error) {
l, err := net.Listen("tcp", addr)
if err != nil {
return nil, err
}
if tlsConfig != nil {
tlsConfig.NextProtos = []string{"http/1.1"}
l = tls.NewListener(l, tlsConfig)
}
return l, nil
}
| {
"pile_set_name": "Github"
} |
let timeString = String(format: "The current time is %02d:%02d", 10, 4)
| {
"pile_set_name": "Github"
} |
<?php
namespace oasis\names\specification\ubl\schema\xsd\CommonAggregateComponents_2;
/**
* @xmlNamespace urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2
* @xmlType
* @xmlName AddressLineType
* @var oasis\names\specification\ubl\schema\xsd\CommonAggregateComponents_2\AddressLineType
* @xmlComponentType ABIE
* @xmlDictionaryEntryName Address Line. Details
* @xmlDefinition Information about a line of address expressed as unstructured text.
* @xmlObjectClass Address Line
*/
class AddressLineType
{
/**
* @ComponentType BBIE
* @DictionaryEntryName Address Line. Line. Text
* @Definition A line of address expressed as unstructured text.
* @Cardinality 1
* @ObjectClass Address Line
* @PropertyTerm Line
* @RepresentationTerm Text
* @DataType Text. Type
* @Examples "123 Standard Chartered Tower"
* @xmlType element
* @xmlNamespace urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2
* @xmlMinOccurs 1
* @xmlMaxOccurs 1
* @xmlName Line
* @var oasis\names\specification\ubl\schema\xsd\CommonBasicComponents_2\Line
*/
public $Line;
} // end class AddressLineType
| {
"pile_set_name": "Github"
} |
; RUN: llc -mtriple=arm-eabi -mattr=+vfp2 %s -o - | FileCheck %s -check-prefix=VFP2
; RUN: llc -mtriple=arm-eabi -mattr=+neon %s -o - | FileCheck %s -check-prefix=NFP0
; RUN: llc -mtriple=arm-eabi -mcpu=cortex-a8 %s -o - | FileCheck %s -check-prefix=CORTEXA8
; RUN: llc -mtriple=arm-eabi -mcpu=cortex-a9 %s -o - | FileCheck %s -check-prefix=CORTEXA9
define float @test(float %a, float %b) {
entry:
%0 = fdiv float %a, %b
ret float %0
}
; VFP2-LABEL: test:
; VFP2: vdiv.f32 s{{.}}, s{{.}}, s{{.}}
; NFP1-LABEL: test:
; NFP1: vdiv.f32 s{{.}}, s{{.}}, s{{.}}
; NFP0-LABEL: test:
; NFP0: vdiv.f32 s{{.}}, s{{.}}, s{{.}}
; CORTEXA8-LABEL: test:
; CORTEXA8: vdiv.f32 s{{.}}, s{{.}}, s{{.}}
; CORTEXA9-LABEL: test:
; CORTEXA9: vdiv.f32 s{{.}}, s{{.}}, s{{.}}
| {
"pile_set_name": "Github"
} |
{
"images": [
{
"filename": "ic_unfold_less_18pt.png",
"idiom": "universal",
"scale": "1x"
},
{
"filename": "ic_unfold_less_18pt_2x.png",
"idiom": "universal",
"scale": "2x"
},
{
"filename": "ic_unfold_less_18pt_3x.png",
"idiom": "universal",
"scale": "3x"
}
],
"info": {
"author": "xcode",
"version": 1
}
}
| {
"pile_set_name": "Github"
} |
# /*******************************************************************
# Part of the Fritzing project - http://fritzing.org
# Copyright (c) 2007-08 Fritzing
# Fritzing is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# Fritzing 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 General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with Fritzing. If not, see <http://www.gnu.org/licenses/>.
# ********************************************************************/
HEADERS += \
src/commands.h \
src/debugdialog.h \
src/fapplication.h \
src/fsplashscreen.h \
src/fsvgrenderer.h \
src/installedfonts.h \
src/itemdrag.h \
src/layerattributes.h \
src/processeventblocker.h \
src/routingstatus.h \
src/sketchtoolbutton.h \
src/viewgeometry.h \
src/viewlayer.h \
src/waitpushundostack.h
SOURCES += \
src/commands.cpp \
src/debugdialog.cpp \
src/fapplication.cpp \
src/fsplashscreen.cpp \
src/fsvgrenderer.cpp \
src/itemdrag.cpp \
src/layerattributes.cpp \
src/main.cpp \
src/processeventblocker.cpp \
src/sketchtoolbutton.cpp \
src/viewgeometry.cpp \
src/viewlayer.cpp \
src/waitpushundostack.cpp
| {
"pile_set_name": "Github"
} |
require 'spec_helper'
describe AudienceController do
include SocialStream::TestHelpers
include SocialStream::TestHelpers::Controllers
render_views
context "with activity" do
before :all do
@activity = Factory(:activity)
end
it "should not be redered to public" do
get :index, :activity_id => @activity.id, :format => :js
response.should redirect_to(:new_user_session)
end
it "should not be rendered to anyone" do
sign_in Factory(:user)
begin
get :index, :activity_id => @activity.id, :format => :js
assert false
rescue CanCan::AccessDenied
assert true
end
end
it "should not be rendered to author" do
sign_in @activity.author_subject
get :index, :activity_id => @activity.id, :format => :js
response.should be_success
end
end
end
| {
"pile_set_name": "Github"
} |
import dialogViewModelBase = require("viewmodels/dialogViewModelBase");
import setupEncryptionKey = require("viewmodels/resources/setupEncryptionKey");
import distributeSecretCommand = require("commands/database/secrets/distributeSecretCommand");
import clusterTopologyManager = require("common/shell/clusterTopologyManager");
import addNodeToDatabaseGroupCommand = require("commands/database/dbGroup/addNodeToDatabaseGroupCommand");
import databaseGroupNode = require("models/resources/info/databaseGroupNode");
class addNewNodeToDatabaseGroup extends dialogViewModelBase {
private isEncrypted: boolean;
nodeTag = ko.observable<string>();
mentorNode = ko.observable<string>();
manualChooseMentor = ko.observable<boolean>(false);
key = ko.observable<string>();
confirmation = ko.observable<boolean>(false);
databaseName: string;
nodes: databaseGroupNode[];
encryptionSection = ko.observable<setupEncryptionKey>();
validationGroup: KnockoutValidationGroup;
nodesCanBeAdded: KnockoutComputed<string[]>;
possibleMentors: KnockoutComputed<string[]>;
spinners = {
addNode: ko.observable<boolean>(false)
};
constructor(databaseName: string, nodes: databaseGroupNode[], isEncrypted: boolean) {
super();
this.databaseName = databaseName;
this.isEncrypted = isEncrypted;
this.nodes = nodes;
if (isEncrypted) {
this.encryptionSection(setupEncryptionKey.forDatabase(this.key, this.confirmation, ko.observable(databaseName)));
}
this.bindToCurrentInstance("selectedClusterNode", "selectedMentor");
this.initObservables();
this.initValidation();
}
private initObservables() {
this.nodesCanBeAdded = ko.pureComputed<string[]>(() => {
const tags = clusterTopologyManager.default.topology().nodes().map(x => x.tag());
const existingTags = this.nodes.map(x => x.tag());
return _.without(tags, ...existingTags);
});
this.possibleMentors = ko.pureComputed<string[]>(() => {
return this.nodes
.filter(x => x.type() === "Member")
.map(x => x.tag());
});
}
private initValidation() {
this.nodeTag.extend({
required: true
});
this.mentorNode.extend({
required: {
onlyIf: () => this.manualChooseMentor()
}
});
if (this.isEncrypted) {
setupEncryptionKey.setupKeyValidation(this.key);
setupEncryptionKey.setupConfirmationValidation(this.confirmation);
}
this.validationGroup = ko.validatedObservable({
key: this.key,
confirmation: this.confirmation,
nodeTag: this.nodeTag,
mentorNode: this.mentorNode
});
}
activate() {
if (this.isEncrypted) {
return this.encryptionSection().generateEncryptionKey();
}
return true;
}
compositionComplete() {
super.compositionComplete();
$('.add-new-node-to-db-group [data-toggle="tooltip"]').tooltip();
if (this.isEncrypted) {
this.encryptionSection().syncQrCode();
this.setupDisableReasons("#savingKeyData");
this.key.subscribe(() => {
this.encryptionSection().syncQrCode();
// reset confirmation
this.confirmation(false);
});
}
}
addNode() {
if (this.isValid(this.validationGroup)) {
this.spinners.addNode(true);
this.distributeSecretIfNeeded()
.done(() => {
new addNodeToDatabaseGroupCommand(this.databaseName, this.nodeTag(), this.manualChooseMentor() ? this.mentorNode() : undefined)
.execute()
.done(() => {
this.close();
})
.always(() => this.spinners.addNode(false));
})
.fail(() => this.spinners.addNode(false));
}
}
private distributeSecretIfNeeded(): JQueryPromise<void> {
if (this.isEncrypted) {
return new distributeSecretCommand(this.databaseName, this.key(), [this.nodeTag()])
.execute();
}
return $.Deferred<void>().resolve();
}
selectedClusterNode(node: string) {
this.nodeTag(node);
}
selectedMentor(tag: string) {
this.mentorNode(tag);
}
}
export = addNewNodeToDatabaseGroup;
| {
"pile_set_name": "Github"
} |
" Copyright 2011 The Go Authors. All rights reserved.
" Use of this source code is governed by a BSD-style
" license that can be found in the LICENSE file.
"
" indent/go.vim: Vim indent file for Go.
"
" TODO:
" - function invocations split across lines
" - general line splits (line ends in an operator)
if exists("b:did_indent")
finish
endif
let b:did_indent = 1
" C indentation is too far off useful, mainly due to Go's := operator.
" Let's just define our own.
setlocal nolisp
setlocal autoindent
setlocal indentexpr=GoIndent(v:lnum)
setlocal indentkeys+=<:>,0=},0=)
if exists("*GoIndent")
finish
endif
function! GoIndent(lnum)
let prevlnum = prevnonblank(a:lnum-1)
if prevlnum == 0
" top of file
return 0
endif
" grab the previous and current line, stripping comments.
let prevl = substitute(getline(prevlnum), '//.*$', '', '')
let thisl = substitute(getline(a:lnum), '//.*$', '', '')
let previ = indent(prevlnum)
let ind = previ
if prevl =~ '[({]\s*$'
" previous line opened a block
let ind += &sw
endif
if prevl =~# '^\s*\(case .*\|default\):$'
" previous line is part of a switch statement
let ind += &sw
endif
" TODO: handle if the previous line is a label.
if thisl =~ '^\s*[)}]'
" this line closed a block
let ind -= &sw
endif
" Colons are tricky.
" We want to outdent if it's part of a switch ("case foo:" or "default:").
" We ignore trying to deal with jump labels because (a) they're rare, and
" (b) they're hard to disambiguate from a composite literal key.
if thisl =~# '^\s*\(case .*\|default\):$'
let ind -= &sw
endif
return ind
endfunction
| {
"pile_set_name": "Github"
} |
package br.padroes.bridge;
public class Cliente {
public static void main(String[] args) {
JanelaAbstrata janela = new JanelaDialogo(new JanelaLinux());
janela.desenhar();
janela = new JanelaAviso(new JanelaLinux());
janela.desenhar();
janela = new JanelaDialogo(new JanelaWindows());
janela.desenhar();
}
}
| {
"pile_set_name": "Github"
} |
import { RDS } from "../RDS";
import { RDSClient } from "../RDSClient";
import {
DescribeDBInstanceAutomatedBackupsCommand,
DescribeDBInstanceAutomatedBackupsCommandInput,
DescribeDBInstanceAutomatedBackupsCommandOutput,
} from "../commands/DescribeDBInstanceAutomatedBackupsCommand";
import { RDSPaginationConfiguration } from "./Interfaces";
import { Paginator } from "@aws-sdk/types";
const makePagedClientRequest = async (
client: RDSClient,
input: DescribeDBInstanceAutomatedBackupsCommandInput,
...args: any
): Promise<DescribeDBInstanceAutomatedBackupsCommandOutput> => {
// @ts-ignore
return await client.send(new DescribeDBInstanceAutomatedBackupsCommand(input, ...args));
};
const makePagedRequest = async (
client: RDS,
input: DescribeDBInstanceAutomatedBackupsCommandInput,
...args: any
): Promise<DescribeDBInstanceAutomatedBackupsCommandOutput> => {
// @ts-ignore
return await client.describeDBInstanceAutomatedBackups(input, ...args);
};
export async function* describeDBInstanceAutomatedBackupsPaginate(
config: RDSPaginationConfiguration,
input: DescribeDBInstanceAutomatedBackupsCommandInput,
...additionalArguments: any
): Paginator<DescribeDBInstanceAutomatedBackupsCommandOutput> {
let token: string | undefined = config.startingToken || "";
let hasNext = true;
let page: DescribeDBInstanceAutomatedBackupsCommandOutput;
while (hasNext) {
input["Marker"] = token;
input["MaxRecords"] = config.pageSize;
if (config.client instanceof RDS) {
page = await makePagedRequest(config.client, input, ...additionalArguments);
} else if (config.client instanceof RDSClient) {
page = await makePagedClientRequest(config.client, input, ...additionalArguments);
} else {
throw new Error("Invalid client, expected RDS | RDSClient");
}
yield page;
token = page["Marker"];
hasNext = !!token;
}
// @ts-ignore
return undefined;
}
| {
"pile_set_name": "Github"
} |
#define CS4245_CHIP_ID 0x01
#define CS4245_POWER_CTRL 0x02
#define CS4245_DAC_CTRL_1 0x03
#define CS4245_ADC_CTRL 0x04
#define CS4245_MCLK_FREQ 0x05
#define CS4245_SIGNAL_SEL 0x06
#define CS4245_PGA_B_CTRL 0x07
#define CS4245_PGA_A_CTRL 0x08
#define CS4245_ANALOG_IN 0x09
#define CS4245_DAC_A_CTRL 0x0a
#define CS4245_DAC_B_CTRL 0x0b
#define CS4245_DAC_CTRL_2 0x0c
#define CS4245_INT_STATUS 0x0d
#define CS4245_INT_MASK 0x0e
#define CS4245_INT_MODE_MSB 0x0f
#define CS4245_INT_MODE_LSB 0x10
/* Chip ID */
#define CS4245_CHIP_PART_MASK 0xf0
#define CS4245_CHIP_REV_MASK 0x0f
/* Power Control */
#define CS4245_FREEZE 0x80
#define CS4245_PDN_MIC 0x08
#define CS4245_PDN_ADC 0x04
#define CS4245_PDN_DAC 0x02
#define CS4245_PDN 0x01
/* DAC Control */
#define CS4245_DAC_FM_MASK 0xc0
#define CS4245_DAC_FM_SINGLE 0x00
#define CS4245_DAC_FM_DOUBLE 0x40
#define CS4245_DAC_FM_QUAD 0x80
#define CS4245_DAC_DIF_MASK 0x30
#define CS4245_DAC_DIF_LJUST 0x00
#define CS4245_DAC_DIF_I2S 0x10
#define CS4245_DAC_DIF_RJUST_16 0x20
#define CS4245_DAC_DIF_RJUST_24 0x30
#define CS4245_RESERVED_1 0x08
#define CS4245_MUTE_DAC 0x04
#define CS4245_DEEMPH 0x02
#define CS4245_DAC_MASTER 0x01
/* ADC Control */
#define CS4245_ADC_FM_MASK 0xc0
#define CS4245_ADC_FM_SINGLE 0x00
#define CS4245_ADC_FM_DOUBLE 0x40
#define CS4245_ADC_FM_QUAD 0x80
#define CS4245_ADC_DIF_MASK 0x10
#define CS4245_ADC_DIF_LJUST 0x00
#define CS4245_ADC_DIF_I2S 0x10
#define CS4245_MUTE_ADC 0x04
#define CS4245_HPF_FREEZE 0x02
#define CS4245_ADC_MASTER 0x01
/* MCLK Frequency */
#define CS4245_MCLK1_MASK 0x70
#define CS4245_MCLK1_SHIFT 4
#define CS4245_MCLK2_MASK 0x07
#define CS4245_MCLK2_SHIFT 0
#define CS4245_MCLK_1 0
#define CS4245_MCLK_1_5 1
#define CS4245_MCLK_2 2
#define CS4245_MCLK_3 3
#define CS4245_MCLK_4 4
/* Signal Selection */
#define CS4245_A_OUT_SEL_MASK 0x60
#define CS4245_A_OUT_SEL_HIZ 0x00
#define CS4245_A_OUT_SEL_DAC 0x20
#define CS4245_A_OUT_SEL_PGA 0x40
#define CS4245_LOOP 0x02
#define CS4245_ASYNCH 0x01
/* Channel B/A PGA Control */
#define CS4245_PGA_GAIN_MASK 0x3f
/* ADC Input Control */
#define CS4245_PGA_SOFT 0x10
#define CS4245_PGA_ZERO 0x08
#define CS4245_SEL_MASK 0x07
#define CS4245_SEL_MIC 0x00
#define CS4245_SEL_INPUT_1 0x01
#define CS4245_SEL_INPUT_2 0x02
#define CS4245_SEL_INPUT_3 0x03
#define CS4245_SEL_INPUT_4 0x04
#define CS4245_SEL_INPUT_5 0x05
#define CS4245_SEL_INPUT_6 0x06
/* DAC Channel A/B Volume Control */
#define CS4245_VOL_MASK 0xff
/* DAC Control 2 */
#define CS4245_DAC_SOFT 0x80
#define CS4245_DAC_ZERO 0x40
#define CS4245_INVERT_DAC 0x20
#define CS4245_INT_ACTIVE_HIGH 0x01
/* Interrupt Status/Mask/Mode */
#define CS4245_ADC_CLK_ERR 0x08
#define CS4245_DAC_CLK_ERR 0x04
#define CS4245_ADC_OVFL 0x02
#define CS4245_ADC_UNDRFL 0x01
#define CS4245_SPI_ADDRESS_S (0x9e << 16)
#define CS4245_SPI_WRITE_S (0 << 16)
#define CS4245_SPI_ADDRESS 0x9e
#define CS4245_SPI_WRITE 0
#define CS4245_SPI_READ 1
| {
"pile_set_name": "Github"
} |
using System;
namespace SharpShell.Interop
{
/// <summary>
/// Flags for IShellFolder::GetAttributesOf.
/// </summary>
[Flags]
public enum SFGAO : uint
{
/// <summary>
/// Objects can be copied (DROPEFFECT_COPY)
/// </summary>
SFGAO_CANCOPY = 0x1,
/// <summary>
/// Objects can be moved (DROPEFFECT_MOVE)
/// </summary>
SFGAO_CANMOVE = 0x2,
/// <summary>
/// Objects can be linked (DROPEFFECT_LINK)
/// </summary>
SFGAO_CANLINK = 0x4,
/// <summary>
/// Supports BindToObject(IID_IStorage)
/// </summary>
SFGAO_STORAGE = 0x00000008,
/// <summary>
/// Objects can be renamed
/// </summary>
SFGAO_CANRENAME = 0x00000010,
/// <summary>
/// Objects can be deleted
/// </summary>
SFGAO_CANDELETE = 0x00000020,
/// <summary>
/// Objects have property sheets
/// </summary>
SFGAO_HASPROPSHEET = 0x00000040,
/// <summary>
/// Objects are drop target
/// </summary>
SFGAO_DROPTARGET = 0x00000100,
/// <summary>
/// Mask for capabilities.
/// </summary>
SFGAO_CAPABILITYMASK = 0x00000177,
/// <summary>
/// Object is encrypted (use alt color)
/// </summary>
SFGAO_ENCRYPTED = 0x00002000,
/// <summary>
/// 'Slow' object
/// </summary>
SFGAO_ISSLOW = 0x00004000,
/// <summary>
/// Ghosted icon
/// </summary>
SFGAO_GHOSTED = 0x00008000,
/// <summary>
/// Shortcut (link)
/// </summary>
SFGAO_LINK = 0x00010000,
/// <summary>
/// Shared
/// </summary>
SFGAO_SHARE = 0x00020000,
/// <summary>
/// Read-only
/// </summary>
SFGAO_READONLY = 0x00040000,
/// <summary>
/// Hidden object
/// </summary>
SFGAO_HIDDEN = 0x00080000,
/// <summary>
/// Display attribute mask.
/// </summary>
SFGAO_DISPLAYATTRMASK = 0x000FC000,
/// <summary>
/// May contain children with SFGAO_FILESYSTEM
/// </summary>
SFGAO_FILESYSANCESTOR = 0x10000000,
/// <summary>
/// Support BindToObject(IID_IShellFolder)
/// </summary>
SFGAO_FOLDER = 0x20000000,
/// <summary>
/// Is a win32 file system object (file/folder/root)
/// </summary>
SFGAO_FILESYSTEM = 0x40000000,
/// <summary>
/// May contain children with SFGAO_FOLDER
/// </summary>
SFGAO_HASSUBFOLDER = 0x80000000,
/// <summary>
/// Contents mask.
/// </summary>
SFGAO_CONTENTSMASK = 0x80000000,
/// <summary>
/// Invalidate cached information
/// </summary>
SFGAO_VALIDATE = 0x01000000,
/// <summary>
/// Is this removeable media?
/// </summary>
SFGAO_REMOVABLE = 0x02000000,
/// <summary>
/// Object is compressed (use alt color)
/// </summary>
SFGAO_COMPRESSED = 0x04000000,
/// <summary>
/// Supports IShellFolder, but only implements CreateViewObject() (non-folder view)
/// </summary>
SFGAO_BROWSABLE = 0x08000000,
/// <summary>
/// Is a non-enumerated object
/// </summary>
SFGAO_NONENUMERATED = 0x00100000,
/// <summary>
/// Should show bold in explorer tree
/// </summary>
SFGAO_NEWCONTENT = 0x00200000,
/// <summary>
/// Defunct
/// </summary>
SFGAO_CANMONIKER = 0x00400000,
/// <summary>
/// Defunct
/// </summary>
SFGAO_HASSTORAGE = 0x00400000,
/// <summary>
/// Supports BindToObject(IID_IStream)
/// </summary>
SFGAO_STREAM = 0x00400000,
/// <summary>
/// May contain children with SFGAO_STORAGE or SFGAO_STREAM
/// </summary>
SFGAO_STORAGEANCESTOR = 0x00800000,
/// <summary>
/// For determining storage capabilities, ie for open/save semantics
/// </summary>
SFGAO_STORAGECAPMASK = 0x70C50008
}
} | {
"pile_set_name": "Github"
} |
/* 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/. */
import * as queue from "./queue";
import path from 'path'
import fs from 'fs'
import intersect from "intersect";
import parse_args from "minimist";
import util from "util";
import child_process from 'child_process';
let execFile = util.promisify(child_process.execFile);
function parseOptions(opts) {
opts = parse_args(opts.split(/\s+/), {
default: {build: "do", platform: "all", unittests: "none", tools: "none"},
alias: {b: "build", p: "platform", u: "unittests", t: "tools", e: "extra-builds"},
string: ["build", "platform", "unittests", "tools", "extra-builds"]
});
// Parse build types (d=debug, o=opt).
let builds = intersect(opts.build.split(""), ["d", "o"]);
// If the given value is nonsense default to debug and opt builds.
if (builds.length == 0) {
builds = ["d", "o"];
}
// Parse platforms.
let allPlatforms = ["linux", "linux64", "linux64-asan", "linux64-fips",
"win", "win64", "win-make", "win64-make",
"linux64-make", "linux-make", "linux-fuzz",
"linux64-fuzz", "aarch64", "mac"];
let platforms = intersect(opts.platform.split(/\s*,\s*/), allPlatforms);
// If the given value is nonsense or "none" default to all platforms.
if (platforms.length == 0 && opts.platform != "none") {
platforms = allPlatforms;
}
// Parse unit tests.
let aliases = {"gtests": "gtest"};
let allUnitTests = ["bogo", "crmf", "chains", "cipher", "db", "ec", "fips",
"gtest", "interop", "lowhash", "merge", "sdr", "smime", "tools",
"ssl", "mpi", "scert", "spki", "policy", "tlsfuzzer"];
let unittests = intersect(opts.unittests.split(/\s*,\s*/).map(t => {
return aliases[t] || t;
}), allUnitTests);
// If the given value is "all" run all tests.
// If it's nonsense then don't run any tests.
if (opts.unittests == "all") {
unittests = allUnitTests;
} else if (unittests.length == 0) {
unittests = [];
}
// Parse tools.
let allTools = ["clang-format", "scan-build", "coverity", "hacl", "saw", "abi", "coverage"];
let tools = intersect(opts.tools.split(/\s*,\s*/), allTools);
// If the given value is "all" run all tools.
// If it's nonsense then don't run any tools.
if (opts.tools == "all") {
tools = allTools;
} else if (tools.length == 0) {
tools = [];
}
return {
builds: builds,
platforms: platforms,
unittests: unittests,
extra: (opts.e == "all"),
tools: tools
};
}
function filter(opts) {
return function (task) {
// Filter tools. We can immediately return here as those
// are not affected by platform or build type selectors.
if (task.platform == "nss-tools") {
return opts.tools.some(tool => {
return task.symbol.toLowerCase().startsWith(tool) ||
(task.group && task.group.toLowerCase().startsWith(tool));
});
}
// Filter unit tests.
if (task.tests) {
let found = opts.unittests.some(test => {
if (task.group && task.group.toLowerCase() == "ssl" && test == "ssl") {
return true;
}
if (task.group && task.group.toLowerCase() == "cipher" && test == "cipher") {
return true;
}
return task.symbol.toLowerCase().startsWith(test);
});
if (!found) {
return false;
}
}
// Filter extra builds.
if (task.group == "Builds" && !opts.extra) {
return false;
}
let coll = name => name == (task.collection || "opt");
// Filter by platform.
let found = opts.platforms.some(platform => {
let aliases = {
"linux": "linux32",
"linux-fuzz": "linux32",
"linux64-asan": "linux64",
"linux64-fips": "linux64",
"linux64-fuzz": "linux64",
"linux64-make": "linux64",
"linux-make": "linux32",
"win64-make": "windows2012-64",
"win-make": "windows2012-32",
"win64": "windows2012-64",
"win": "windows2012-32"
};
// Check the platform name.
let keep = (task.platform == (aliases[platform] || platform));
// Additional checks.
if (platform == "linux64-asan") {
keep &= coll("asan");
} else if (platform == "linux64-fips") {
keep &= coll("fips");
} else if (platform == "linux64-make" || platform == "linux-make" ||
platform == "win64-make" || platform == "win-make") {
keep &= coll("make");
} else if (platform == "linux64-fuzz" || platform == "linux-fuzz") {
keep &= coll("fuzz");
} else {
keep &= coll("opt") || coll("debug");
}
return keep;
});
if (!found) {
return false;
}
// Finally, filter by build type.
let isDebug = coll("debug") || coll("asan") || coll("make") ||
coll("fuzz");
return (isDebug && opts.builds.includes("d")) ||
(!isDebug && opts.builds.includes("o"));
}
}
async function getCommitComment() {
const res = await execFile('hg', ['log', '-r', '.', '-T', '{desc}']);
return res.stdout;
};
export async function initFilter() {
let comment = await getCommitComment();
// Load try_task_config.json
// Add parameters to queue for created tasks
let config_path = path.normalize(path.join(__dirname, '../../../../try_task_config.json'))
if (fs.existsSync(config_path)) {
var payload = JSON.parse(fs.readFileSync(config_path));
if (payload['version'] == 2) {
queue.addParameters(payload['parameters']);
}
}
// Check for try syntax in changeset comment.
let match = comment.match(/\btry:\s*(.*)\s*$/m);
// Add try syntax filter.
if (match) {
let match1 = match[1];
queue.filter(filter(parseOptions(match1)));
if (match1.includes("--nspr-patch")) {
queue.map(task => {
if (!task.env) {
task.env = {};
}
task.env.ALLOW_NSPR_PATCH = "1";
return task;
});
}
}
}
| {
"pile_set_name": "Github"
} |
use Dancer ':tests';
use Test::More;
use Dancer::Test;
my $views = path(dirname(__FILE__), 'views');
set views => $views;
my $time = time();
set show_errors => 1;
my @tests = (
{ path => '/',
expected => "in view index.tt: number=\"\"\n" },
{ path => '/number/42',
expected => "in view index.tt: number=\"42\"\n" },
{ path => '/clock',
expected => "$time\n"},
{ path => '/request',
expected => "/request\n" },
{ path => '/vars',
expected => "bar\n" },
);
plan tests => 2 + scalar(@tests);
# 1. Check setting variables
{
is setting("views") => $views, "Views setting was correctly set";
ok !defined(setting("layout")), 'layout is not defined';
}
# 2. Check views
# test simple rendering
get '/' => sub {
template 'index';
};
get '/with_fh' => sub {
my $fh;
die "TODO";
};
# test params.foo in view
get '/number/:number' => sub {
template 'index'
};
# test token interpolation
get '/clock' => sub {
template clock => { time => $time };
};
# test request.foo in view
get '/request' => sub {
template 'request';
};
# test vars in view
get '/vars' => sub {
var foo => 'bar';
template 'vars';
};
foreach my $test (@tests) {
my $path = $test->{path};
my $expected = $test->{expected};
response_content_is [GET => $path] => $expected;
}
| {
"pile_set_name": "Github"
} |
/**
* @Returns the implicit role for an aside tag.
*/
function getImplicitRoleForAside(): string {
return 'complementary';
}
export { getImplicitRoleForAside as aside };
| {
"pile_set_name": "Github"
} |
---
tags: training, collection, offensive
name: Pentest with Hak5
short_description: Part instructor-led training. Part simulated pentest. Like no other InfoSec training. In Pentest with Hak5 you aren’t just a student – you join Hak5 on a simulated Red Team engagement.
target: https://www.hak5.org/training
author: N/A
contributor: gradiuscypher
last_updated: 2020-01-14
render: true
---
Part instructor-led training. Part simulated pentest. Like no other InfoSec training. In Pentest with Hak5 you aren’t just a student – you join Hak5 on a simulated Red Team engagement. Uncover the tricks of the trade in a practical, story driven environment closely matching the real world. You’ll work directly with the instructors and your peers to complete the objectives. | {
"pile_set_name": "Github"
} |
#region License
// Copyright 2015-2020 John Källén
//
// 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.
#endregion
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Pytocs.Core.CodeModel
{
public class CodeCommentStatement :CodeStatement
{
public CodeCommentStatement(string comment)
{
this.Comment = comment;
}
public string Comment { get; set; }
public override T Accept<T>(ICodeStatementVisitor<T> visitor)
{
return visitor.VisitComment(this);
}
}
}
| {
"pile_set_name": "Github"
} |
import Ember from 'ember';
import Application from '../../app';
import config from '../../config/environment';
export default function startApp(attrs) {
let application;
// use defaults, but you can override
let attributes = Ember.assign({}, config.APP, attrs);
Ember.run(() => {
application = Application.create(attributes);
application.setupForTesting();
application.injectTestHelpers();
});
return application;
}
| {
"pile_set_name": "Github"
} |
/*****************************************************************************
* EditActions.swift
*
* Copyright © 2019 VLC authors and VideoLAN
*
* Authors: Edgar Fouillet <vlc # edgar.fouillet.eu>
*
* Refer to the COPYING file of the official project for license.
*****************************************************************************/
enum completionState {
case inProgress
case success
case fail
}
class EditActions {
private let rootViewController: UIViewController
private let model: MediaLibraryBaseModel
private let mediaLibraryService: MediaLibraryService
private var completion: ((completionState) -> Void)?
var objects = [VLCMLObject]()
private lazy var addToCollectionViewController: AddToCollectionViewController = {
var addToCollectionViewController = AddToCollectionViewController()
addToCollectionViewController.delegate = self
return addToCollectionViewController
}()
init(model: MediaLibraryBaseModel, mediaLibraryService: MediaLibraryService) {
self.rootViewController = UIApplication.shared.keyWindow!.rootViewController!
self.model = model
self.mediaLibraryService = mediaLibraryService
}
}
// MARK: - Main edit actions
extension EditActions {
private func addToCollection(_ collection: [MediaCollectionModel], for type: MediaCollectionModel.Type) {
addToCollectionViewController.mlCollection = collection
addToCollectionViewController.updateInterface(for: type)
let navigationController = UINavigationController(rootViewController: addToCollectionViewController)
rootViewController.present(navigationController, animated: true, completion: nil)
}
private func createMediaGroup(from mediaGroupIds: [VLCMLIdentifier],
_ completion: ((completionState) -> Void)? = nil) {
let alertInfo = TextFieldAlertInfo(alertTitle: NSLocalizedString("MEDIA_GROUPS", comment: ""),
placeHolder: NSLocalizedString("MEDIA_GROUPS_PLACEHOLDER",
comment: ""))
presentTextFieldAlert(with: alertInfo) {
[unowned self] text -> Void in
guard text != "" else {
DispatchQueue.main.async {
VLCAlertViewController.alertViewManager(title: NSLocalizedString("ERROR_EMPTY_NAME",
comment: ""),
viewController: self.rootViewController)
completion?(.fail)
}
return
}
self.createMediaGroup(with: text)
}
}
func addToPlaylist(_ completion: ((completionState) -> Void)? = nil) {
self.completion = completion
if !mediaLibraryService.playlists().isEmpty {
addToCollection(mediaLibraryService.playlists(), for: VLCMLPlaylist.self)
} else {
addToNewPlaylist()
}
}
func addToMediaGroup(_ completion: ((completionState) -> Void)? = nil) {
self.completion = completion
var mediaGroupIds = [VLCMLIdentifier]()
objects.forEach() { mediaGroupIds.append($0.identifier()) }
guard var mediaGroups = mediaLibraryService.medialib.mediaGroups() else {
assertionFailure("EditActions: addToMediaGroup: Failed to retrieve mediaGroups.")
completion?(.fail)
return
}
// Filter out visible groups and action originated source media groups
mediaGroups = mediaGroups.filter() {
if mediaGroupIds.contains($0.identifier()) {
// Do not include the current selection
return false
} else if $0.nbMedia() == 1 && !$0.userInteracted() {
// Do not include elements shown as a media
return false
}
return true
}
addToCollection(mediaGroups, for: VLCMLMediaGroup.self)
}
func removeFromMediaGroup(_ completion: ((completionState) -> Void)? = nil) {
self.completion = completion
guard !objects.isEmpty else {
completion?(.fail)
return
}
guard let media = objects as? [VLCMLMedia] else {
assertionFailure("EditActions: removeFromMediaGroup: Unknown type inside media group.")
completion?(.fail)
return
}
guard let collectionModel = model as? CollectionModel else {
assertionFailure("EditActions: removeFromMediaGroup: Unknown model type for media groups.")
completion?(.fail)
return
}
if let mediaGroup = collectionModel.mediaCollection as? VLCMLMediaGroup,
mediaGroup.nbMedia() == media.count {
guard mediaGroup.destroy() else {
assertionFailure("EditActions: removeFromMediaGroup: Failed to destroy mediaGroup.")
completion?(.fail)
return
}
} else {
media.forEach() { $0.removeFromGroup() }
}
collectionModel.filterFilesFromDeletion(of: media)
completion?(.success)
}
func rename(_ completion: ((completionState) -> Void)? = nil) {
self.completion = completion
if !objects.isEmpty {
let mlObject = objects.first
var mlObjectName = ""
if let media = mlObject as? VLCMLMedia {
mlObjectName = media.title
} else if let playlist = mlObject as? VLCMLPlaylist {
mlObjectName = playlist.name
} else if let mediaGroup = mlObject as? VLCMLMediaGroup {
if mediaGroup.nbMedia() == 1 && !mediaGroup.userInteracted() {
guard let media = mediaGroup.media(of: .video)?.first else {
assertionFailure("EditActions: rename: Failed to retrieve media.")
VLCAlertViewController.alertViewManager(title: NSLocalizedString("ERROR_RENAME_FAILED", comment: ""),
errorMessage: NSLocalizedString("ERROR_RENAME_FAILED", comment: ""),
viewController: self.rootViewController)
self.completion?(.fail)
return
}
mlObjectName = media.title
}
else {
mlObjectName = mediaGroup.name()
}
} else {
assertionFailure("EditActions: Rename called with wrong model.")
}
// Not using VLCAlertViewController to have more customization in text fields
let alertInfo = TextFieldAlertInfo(alertTitle: String(format: NSLocalizedString("RENAME_MEDIA_TO", comment: ""), mlObjectName),
textfieldText: mlObjectName,
confirmActionTitle: NSLocalizedString("BUTTON_RENAME", comment: ""))
presentTextFieldAlert(with: alertInfo, completionHandler: {
[unowned self] text -> Void in
guard text != "" else {
VLCAlertViewController.alertViewManager(title: NSLocalizedString("ERROR_RENAME_FAILED", comment: ""),
errorMessage: NSLocalizedString("ERROR_EMPTY_NAME", comment: ""),
viewController: self.rootViewController)
self.completion?(.fail)
return
}
if let media = mlObject as? VLCMLMedia {
media.updateTitle(text)
} else if let playlist = mlObject as? VLCMLPlaylist {
playlist.updateName(text)
} else if let mediaGroup = mlObject as? VLCMLMediaGroup,
let mediaGroupViewModel = self.model as? MediaGroupViewModel {
mediaGroupViewModel.rename(mediaGroup, to: text)
}
self.objects.removeFirst()
self.completion?(.inProgress)
self.rename(completion)
})
} else {
self.completion?(.success)
}
}
func delete(_ completion: ((completionState) -> Void)? = nil) {
self.completion = completion
var message = NSLocalizedString("DELETE_MESSAGE", comment: "")
if model is PlaylistModel {
message = NSLocalizedString("DELETE_MESSAGE_PLAYLIST", comment: "")
} else if (model as? CollectionModel)?.mediaCollection is VLCMLPlaylist {
message = NSLocalizedString("DELETE_MESSAGE_PLAYLIST_CONTENT", comment: "")
}
let cancelButton = VLCAlertButton(title: NSLocalizedString("BUTTON_CANCEL", comment: ""),
style: .cancel)
let deleteButton = VLCAlertButton(title: NSLocalizedString("BUTTON_DELETE", comment: ""),
style: .destructive,
action: {
[unowned self] action in
self.model.anyDelete(self.objects)
self.objects.removeAll()
self.completion?(.success)
})
VLCAlertViewController.alertViewManager(title: NSLocalizedString("DELETE_TITLE", comment: ""),
errorMessage: message,
viewController: rootViewController,
buttonsAction: [cancelButton,
deleteButton])
}
func share(origin: UIView, _ completion: ((completionState) -> Void)? = nil) {
self.completion = completion
UIApplication.shared.beginIgnoringInteractionEvents()
guard let controller = VLCActivityViewControllerVendor.activityViewController(forFiles: URLs(),
presenting: nil,
presenting: rootViewController,
completionHandler: {
[unowned self] _ in
self.completion?(.success)
}
) else {
UIApplication.shared.endIgnoringInteractionEvents()
self.completion?(.fail)
return
}
controller.popoverPresentationController?.sourceView = origin
controller.popoverPresentationController?.permittedArrowDirections = .any
controller.popoverPresentationController?.sourceRect = origin.bounds
rootViewController.present(controller, animated: true) {
UIApplication.shared.endIgnoringInteractionEvents()
}
}
}
// MARK: - Private helpers
private extension EditActions {
private struct TextFieldAlertInfo {
var alertTitle: String
var alertDescription: String
var placeHolder: String
var textfieldText: String
var confirmActionTitle: String
init(alertTitle: String = "",
alertDescription: String = "",
placeHolder: String = "",
textfieldText: String = "",
confirmActionTitle: String = NSLocalizedString("BUTTON_DONE", comment: "")) {
self.alertTitle = alertTitle
self.alertDescription = alertDescription
self.placeHolder = placeHolder
self.textfieldText = textfieldText
self.confirmActionTitle = confirmActionTitle
}
}
private func presentTextFieldAlert(with info: TextFieldAlertInfo,
completionHandler: @escaping (String) -> Void) {
let alertController = UIAlertController(title: info.alertTitle,
message: info.alertDescription,
preferredStyle: .alert)
alertController.addTextField(configurationHandler: {
textField in
textField.text = info.textfieldText
textField.placeholder = info.placeHolder
})
let cancelButton = UIAlertAction(title: NSLocalizedString("BUTTON_CANCEL", comment: ""),
style: .cancel)
let confirmAction = UIAlertAction(title: info.confirmActionTitle, style: .default) {
[weak alertController] _ in
guard let alertController = alertController,
let textField = alertController.textFields?.first else { return }
completionHandler(textField.text ?? "")
}
alertController.addAction(cancelButton)
alertController.addAction(confirmAction)
rootViewController.present(alertController, animated: true, completion: nil)
}
private func URLs() -> [URL] {
var fileURLs = [URL]()
for object in objects {
if let media = object as? VLCMLMedia {
if let file = media.mainFile() {
fileURLs.append(file.mrl)
}
} else if let mediaCollection = object as? MediaCollectionModel {
if let files = mediaCollection.files() {
for media in files {
if let file = media.mainFile() {
fileURLs.append(file.mrl)
}
}
}
}
}
return fileURLs
}
// MARK: Media Groups
private func createMediaGroup(with name: String) {
var media = [VLCMLMedia]()
var mediaGroupIds = [VLCMLIdentifier]()
objects.forEach() {
if let mediaGroup = $0 as? VLCMLMediaGroup {
media += mediaGroup.media(of: .video) ?? []
mediaGroupIds.append(mediaGroup.identifier())
} else if let medium = $0 as? VLCMLMedia {
media.append(medium)
} else {
assertionFailure("EditActions: createMediaGroup: Unknown type.")
}
}
if let mediaGroupModel = model as? MediaGroupViewModel {
if !mediaGroupModel.create(with: name, from: mediaGroupIds, content: media) {
completion?(.fail)
return
}
}
completion?(.success)
}
// MARK: Playlist
private func addToNewPlaylist() {
let alertInfo = TextFieldAlertInfo(alertTitle: NSLocalizedString("PLAYLISTS", comment: ""),
placeHolder: NSLocalizedString("PLAYLIST_PLACEHOLDER",
comment: ""))
presentTextFieldAlert(with: alertInfo) {
[unowned self] text -> Void in
guard text != "" else {
DispatchQueue.main.async {
VLCAlertViewController.alertViewManager(title: NSLocalizedString("ERROR_EMPTY_NAME",
comment: ""),
viewController: self.rootViewController)
}
return
}
self.createPlaylist(text)
}
}
private func createPlaylist(_ name: String) {
guard let playlist = mediaLibraryService.createPlaylist(with: name) else {
assertionFailure("EditActions: createPlaylist: Failed to create a playlist.")
DispatchQueue.main.async {
VLCAlertViewController.alertViewManager(title: NSLocalizedString("ERROR_PLAYLIST_CREATION",
comment: ""),
viewController: self.rootViewController)
}
completion?(.fail)
return
}
for media in objects {
if !playlist.appendMedia(withIdentifier: media.identifier()) {
assertionFailure("EditActions: createPlaylist: Failed to add item.")
}
}
completion?(.success)
}
}
// MARK: - AddToCollectionViewControllerDelegate
extension EditActions: AddToCollectionViewControllerDelegate {
func addToCollectionViewController(_ addToCollectionViewController: AddToCollectionViewController,
didSelectCollection collection: MediaCollectionModel) {
var tmpMedia = [VLCMLMedia]()
if let mediaGroups = objects as? [VLCMLMediaGroup] {
mediaGroups.forEach() { tmpMedia += $0.media(of: .video) ?? [] }
} else if let media = objects as? [VLCMLMedia] {
tmpMedia = media
} else {
assertionFailure("EditActions: AddToCollectionViewControllerDelegate: Failed to retrieve type.")
completion?(.fail)
return
}
if let mediaGroup = collection as? VLCMLMediaGroup,
let mediaGroupModel = self.model as? MediaGroupViewModel {
mediaGroupModel.append(tmpMedia, to: mediaGroup)
} else if let playlist = collection as? VLCMLPlaylist {
for medium in tmpMedia {
if !playlist.appendMedia(withIdentifier: medium.identifier()) {
assertionFailure("EditActions: AddToPlaylistViewControllerDelegate: Failed to add item.")
completion?(.fail)
}
}
}
addToCollectionViewController.dismiss(animated: true, completion: nil)
completion?(.success)
}
func addToCollectionViewController(_ addToCollectionViewController: AddToCollectionViewController,
newCollectionName name: String,
from mlType: MediaCollectionModel.Type) {
if mlType is VLCMLPlaylist.Type {
createPlaylist(name)
} else if mlType is VLCMLMediaGroup.Type {
createMediaGroup(with: name)
}
addToCollectionViewController.dismiss(animated: true, completion: nil)
}
func addToCollectionViewControllerMoveCollections(_
addToCollectionViewController: AddToCollectionViewController) {
guard let mediaGroups = objects as? [VLCMLMediaGroup] else {
assertionFailure("EditActions: Cannot move out if not VLCMLMediaGroups.")
completion?(.fail)
return
}
guard let mediaGroupViewModel = model as? MediaGroupViewModel else {
assertionFailure("EditActions: Cannot move out if not MediaGroupViewModel.")
completion?(.fail)
return
}
var mediaGroupsIds = [VLCMLIdentifier]()
mediaGroups.forEach() {
// Skip mediaGroups that are shown as media
if $0.userInteracted() || $0.nbMedia() > 1 {
mediaGroupsIds.append($0.identifier())
$0.destroy()
}
}
mediaGroupViewModel.filterFilesFromDeletion(of: mediaGroupsIds)
addToCollectionViewController.dismiss(animated: true, completion: nil)
completion?(.success)
}
}
| {
"pile_set_name": "Github"
} |
// Copyright (c) 2013-2014 The btcsuite developers
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.
// +build !appengine
package btcutil
import (
"net"
)
// interfaceAddrs returns a list of the system's network interface addresses.
// It is wrapped here so that we can substitute it for other functions when
// building for systems that do not allow access to net.InterfaceAddrs().
func interfaceAddrs() ([]net.Addr, error) {
return net.InterfaceAddrs()
}
| {
"pile_set_name": "Github"
} |
////////////////////////////////////////////////////
// wordWindow object
////////////////////////////////////////////////////
function wordWindow() {
// private properties
this._forms = [];
// private methods
this._getWordObject = _getWordObject;
//this._getSpellerObject = _getSpellerObject;
this._wordInputStr = _wordInputStr;
this._adjustIndexes = _adjustIndexes;
this._isWordChar = _isWordChar;
this._lastPos = _lastPos;
// public properties
this.wordChar = /[a-zA-Z]/;
this.windowType = "wordWindow";
this.originalSpellings = new Array();
this.suggestions = new Array();
this.checkWordBgColor = "pink";
this.normWordBgColor = "white";
this.text = "";
this.textInputs = new Array();
this.indexes = new Array();
//this.speller = this._getSpellerObject();
// public methods
this.resetForm = resetForm;
this.totalMisspellings = totalMisspellings;
this.totalWords = totalWords;
this.totalPreviousWords = totalPreviousWords;
//this.getTextObjectArray = getTextObjectArray;
this.getTextVal = getTextVal;
this.setFocus = setFocus;
this.removeFocus = removeFocus;
this.setText = setText;
//this.getTotalWords = getTotalWords;
this.writeBody = writeBody;
this.printForHtml = printForHtml;
}
function resetForm() {
if( this._forms ) {
for( var i = 0; i < this._forms.length; i++ ) {
this._forms[i].reset();
}
}
return true;
}
function totalMisspellings() {
var total_words = 0;
for( var i = 0; i < this.textInputs.length; i++ ) {
total_words += this.totalWords( i );
}
return total_words;
}
function totalWords( textIndex ) {
return this.originalSpellings[textIndex].length;
}
function totalPreviousWords( textIndex, wordIndex ) {
var total_words = 0;
for( var i = 0; i <= textIndex; i++ ) {
for( var j = 0; j < this.totalWords( i ); j++ ) {
if( i == textIndex && j == wordIndex ) {
break;
} else {
total_words++;
}
}
}
return total_words;
}
//function getTextObjectArray() {
// return this._form.elements;
//}
function getTextVal( textIndex, wordIndex ) {
var word = this._getWordObject( textIndex, wordIndex );
if( word ) {
return word.value;
}
}
function setFocus( textIndex, wordIndex ) {
var word = this._getWordObject( textIndex, wordIndex );
if( word ) {
if( word.type == "text" ) {
word.focus();
word.style.backgroundColor = this.checkWordBgColor;
}
}
}
function removeFocus( textIndex, wordIndex ) {
var word = this._getWordObject( textIndex, wordIndex );
if( word ) {
if( word.type == "text" ) {
word.blur();
word.style.backgroundColor = this.normWordBgColor;
}
}
}
function setText( textIndex, wordIndex, newText ) {
var word = this._getWordObject( textIndex, wordIndex );
var beginStr;
var endStr;
if( word ) {
var pos = this.indexes[textIndex][wordIndex];
var oldText = word.value;
// update the text given the index of the string
beginStr = this.textInputs[textIndex].substring( 0, pos );
endStr = this.textInputs[textIndex].substring(
pos + oldText.length,
this.textInputs[textIndex].length
);
this.textInputs[textIndex] = beginStr + newText + endStr;
// adjust the indexes on the stack given the differences in
// length between the new word and old word.
var lengthDiff = newText.length - oldText.length;
this._adjustIndexes( textIndex, wordIndex, lengthDiff );
word.size = newText.length;
word.value = newText;
this.removeFocus( textIndex, wordIndex );
}
}
function writeBody() {
var d = window.document;
var is_html = false;
d.open();
// iterate through each text input.
for( var txtid = 0; txtid < this.textInputs.length; txtid++ ) {
var end_idx = 0;
var begin_idx = 0;
d.writeln( '<form name="textInput'+txtid+'">' );
var wordtxt = this.textInputs[txtid];
this.indexes[txtid] = [];
if( wordtxt ) {
var orig = this.originalSpellings[txtid];
if( !orig ) break;
//!!! plain text, or HTML mode?
d.writeln( '<div class="plainText">' );
// iterate through each occurrence of a misspelled word.
for( var i = 0; i < orig.length; i++ ) {
// find the position of the current misspelled word,
// starting at the last misspelled word.
// and keep looking if it's a substring of another word
do {
begin_idx = wordtxt.indexOf( orig[i], end_idx );
end_idx = begin_idx + orig[i].length;
// word not found? messed up!
if( begin_idx == -1 ) break;
// look at the characters immediately before and after
// the word. If they are word characters we'll keep looking.
var before_char = wordtxt.charAt( begin_idx - 1 );
var after_char = wordtxt.charAt( end_idx );
} while (
this._isWordChar( before_char )
|| this._isWordChar( after_char )
);
// keep track of its position in the original text.
this.indexes[txtid][i] = begin_idx;
// write out the characters before the current misspelled word
for( var j = this._lastPos( txtid, i ); j < begin_idx; j++ ) {
// !!! html mode? make it html compatible
d.write( this.printForHtml( wordtxt.charAt( j )));
}
// write out the misspelled word.
d.write( this._wordInputStr( orig[i] ));
// if it's the last word, write out the rest of the text
if( i == orig.length-1 ){
d.write( printForHtml( wordtxt.substr( end_idx )));
}
}
d.writeln( '</div>' );
}
d.writeln( '</form>' );
}
//for ( var j = 0; j < d.forms.length; j++ ) {
// alert( d.forms[j].name );
// for( var k = 0; k < d.forms[j].elements.length; k++ ) {
// alert( d.forms[j].elements[k].name + ": " + d.forms[j].elements[k].value );
// }
//}
// set the _forms property
this._forms = d.forms;
d.close();
}
// return the character index in the full text after the last word we evaluated
function _lastPos( txtid, idx ) {
if( idx > 0 )
return this.indexes[txtid][idx-1] + this.originalSpellings[txtid][idx-1].length;
else
return 0;
}
function printForHtml( n ) {
return n ; // by FredCK
/*
var htmlstr = n;
if( htmlstr.length == 1 ) {
// do simple case statement if it's just one character
switch ( n ) {
case "\n":
htmlstr = '<br/>';
break;
case "<":
htmlstr = '<';
break;
case ">":
htmlstr = '>';
break;
}
return htmlstr;
} else {
htmlstr = htmlstr.replace( /</g, '<' );
htmlstr = htmlstr.replace( />/g, '>' );
htmlstr = htmlstr.replace( /\n/g, '<br/>' );
return htmlstr;
}
*/
}
function _isWordChar( letter ) {
if( letter.search( this.wordChar ) == -1 ) {
return false;
} else {
return true;
}
}
function _getWordObject( textIndex, wordIndex ) {
if( this._forms[textIndex] ) {
if( this._forms[textIndex].elements[wordIndex] ) {
return this._forms[textIndex].elements[wordIndex];
}
}
return null;
}
function _wordInputStr( word ) {
var str = '<input readonly ';
str += 'class="blend" type="text" value="' + word + '" size="' + word.length + '">';
return str;
}
function _adjustIndexes( textIndex, wordIndex, lengthDiff ) {
for( var i = wordIndex + 1; i < this.originalSpellings[textIndex].length; i++ ) {
this.indexes[textIndex][i] = this.indexes[textIndex][i] + lengthDiff;
}
}
| {
"pile_set_name": "Github"
} |
% Copyright 2007 by Till Tantau
%
% This file may be distributed and/or modified
%
% 1. under the LaTeX Project Public License and/or
% 2. under the GNU Public License.
%
% See the file doc/licenses/LICENSE for more details.
\DeclareOptionBeamer{height}{\PassOptionsToPackage{height=#1}{beamerouterthemesidebar}}
\ProcessOptionsBeamer
\mode<presentation>
\useoutertheme[width=0pt]{sidebar}
\useinnertheme{rectangles}
\usecolortheme{whale}
\usecolortheme{orchid}
\setbeamercolor*{frametitle}{parent=palette primary}
\setbeamerfont{block title}{size={}}
\mode
<all>
| {
"pile_set_name": "Github"
} |
{
"include": [
"src/**/*"
],
"exclude": [
"src/**/*.spec.*"
],
"compilerOptions": {
"target": "es5",
"declaration": true,
"sourceMap": false,
"outDir": "dist",
"lib": [
"es6",
"es2016.array.include"
]
}
} | {
"pile_set_name": "Github"
} |
/* Copyright 2016 The TensorFlow Authors. 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.
==============================================================================*/
#if GOOGLE_CUDA
#define EIGEN_USE_GPU
#include "tensorflow/core/kernels/mirror_pad_op.h"
#include "tensorflow/core/framework/register_types.h"
namespace tensorflow {
using GpuDevice = Eigen::GpuDevice;
#define DEFINE_GPU_SPECS(T) \
template struct functor::MirrorPad<GpuDevice, T, 1>; \
template struct functor::MirrorPad<GpuDevice, T, 2>; \
template struct functor::MirrorPad<GpuDevice, T, 3>; \
template struct functor::MirrorPad<GpuDevice, T, 4>; \
template struct functor::MirrorPad<GpuDevice, T, 5>; \
template struct functor::MirrorPadGrad<GpuDevice, T, 1>; \
template struct functor::MirrorPadGrad<GpuDevice, T, 2>; \
template struct functor::MirrorPadGrad<GpuDevice, T, 3>; \
template struct functor::MirrorPadGrad<GpuDevice, T, 4>; \
template struct functor::MirrorPadGrad<GpuDevice, T, 5>;
TF_CALL_GPU_NUMBER_TYPES(DEFINE_GPU_SPECS);
#undef DEFINE_GPU_SPECS
} // namespace tensorflow
#endif // GOOGLE_CUDA
| {
"pile_set_name": "Github"
} |
package com.sdust.im.view;
import android.graphics.Camera;
import android.graphics.Matrix;
import android.view.animation.Animation;
import android.view.animation.Transformation;
public class RotateAnimation extends Animation {
private Camera mCamera;
private float mCenterX;
private float mCenterY;
private Mode mMode;
public RotateAnimation(float centerX, float centerY, Mode mode) {
mCenterX = centerX;
mCenterY = centerY;
mMode = mode;
}
@Override
public void initialize(int width, int height, int parentWidth,
int parentHeight) {
super.initialize(width, height, parentWidth, parentHeight);
mCamera = new Camera();
}
@Override
protected void applyTransformation(float interpolatedTime, Transformation t) {
float deg = 0.0F + 360.0F * interpolatedTime;
Matrix matrix = t.getMatrix();
mCamera.save();
if (mMode == Mode.X)
mCamera.rotateX(deg);
if (mMode == Mode.Y)
mCamera.rotateY(deg);
if (mMode == Mode.Z)
mCamera.rotateZ(deg);
mCamera.getMatrix(matrix);
mCamera.restore();
matrix.preTranslate(-mCenterX, -mCenterY);
matrix.postTranslate(mCenterX, mCenterY);
}
public enum Mode {
X, Y, Z;
}
}
| {
"pile_set_name": "Github"
} |
/*
* Copyright (c) 2018 Goldman Sachs and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* and Eclipse Distribution License v. 1.0 which accompany this distribution.
* The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
* and the Eclipse Distribution License is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*/
package org.eclipse.collections.test.map.immutable.strategy;
import java.util.Random;
import org.eclipse.collections.api.map.ImmutableMap;
import org.eclipse.collections.api.map.MutableMap;
import org.eclipse.collections.impl.block.factory.HashingStrategies;
import org.eclipse.collections.impl.map.strategy.mutable.UnifiedMapWithHashingStrategy;
import org.eclipse.collections.impl.test.junit.Java8Runner;
import org.eclipse.collections.test.map.immutable.ImmutableMapTestCase;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.eclipse.collections.test.IterableTestCase.assertEquals;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.fail;
@RunWith(Java8Runner.class)
public class ImmutableUnifiedMapWithHashingStrategyTest implements ImmutableMapTestCase
{
private static final long CURRENT_TIME_MILLIS = System.currentTimeMillis();
@Override
public final <T> ImmutableMap<Object, T> newWith(T... elements)
{
Random random = new Random(CURRENT_TIME_MILLIS);
MutableMap<Object, T> result = new UnifiedMapWithHashingStrategy<>(HashingStrategies.defaultStrategy());
for (T each : elements)
{
assertNull(result.put(random.nextDouble(), each));
}
return result.toImmutable();
}
@Override
public <K, V> ImmutableMap<K, V> newWithKeysValues(Object... elements)
{
if (elements.length % 2 != 0)
{
fail(String.valueOf(elements.length));
}
MutableMap<K, V> result = new UnifiedMapWithHashingStrategy<>(HashingStrategies.defaultStrategy());
for (int i = 0; i < elements.length; i += 2)
{
assertNull(result.put((K) elements[i], (V) elements[i + 1]));
}
return result.toImmutable();
}
@Override
public boolean supportsNullKeys()
{
// TODO: UnifiedMapWithHashingStrategy does support null, but we're using a hashing strategy in this test which does not.
return false;
}
@Test
public void sanity()
{
assertEquals("ImmutableUnifiedMapWithHashingStrategy", this.newWith(1, 2, 3, 4, 5).getClass().getSimpleName());
}
}
| {
"pile_set_name": "Github"
} |
__all__ = ['Composer', 'ComposerError']
from error import MarkedYAMLError
from events import *
from nodes import *
class ComposerError(MarkedYAMLError):
pass
class Composer(object):
def __init__(self):
self.anchors = {}
def check_node(self):
# Drop the STREAM-START event.
if self.check_event(StreamStartEvent):
self.get_event()
# If there are more documents available?
return not self.check_event(StreamEndEvent)
def get_node(self):
# Get the root node of the next document.
if not self.check_event(StreamEndEvent):
return self.compose_document()
def get_single_node(self):
# Drop the STREAM-START event.
self.get_event()
# Compose a document if the stream is not empty.
document = None
if not self.check_event(StreamEndEvent):
document = self.compose_document()
# Ensure that the stream contains no more documents.
if not self.check_event(StreamEndEvent):
event = self.get_event()
raise ComposerError("expected a single document in the stream",
document.start_mark, "but found another document",
event.start_mark)
# Drop the STREAM-END event.
self.get_event()
return document
def compose_document(self):
# Drop the DOCUMENT-START event.
self.get_event()
# Compose the root node.
node = self.compose_node(None, None)
# Drop the DOCUMENT-END event.
self.get_event()
self.anchors = {}
return node
def compose_node(self, parent, index):
if self.check_event(AliasEvent):
event = self.get_event()
anchor = event.anchor
if anchor not in self.anchors:
raise ComposerError(None, None, "found undefined alias %r"
% anchor.encode('utf-8'), event.start_mark)
return self.anchors[anchor]
event = self.peek_event()
anchor = event.anchor
if anchor is not None:
if anchor in self.anchors:
raise ComposerError("found duplicate anchor %r; first occurence"
% anchor.encode('utf-8'), self.anchors[anchor].start_mark,
"second occurence", event.start_mark)
self.descend_resolver(parent, index)
if self.check_event(ScalarEvent):
node = self.compose_scalar_node(anchor)
elif self.check_event(SequenceStartEvent):
node = self.compose_sequence_node(anchor)
elif self.check_event(MappingStartEvent):
node = self.compose_mapping_node(anchor)
self.ascend_resolver()
return node
def compose_scalar_node(self, anchor):
event = self.get_event()
tag = event.tag
if tag is None or tag == u'!':
tag = self.resolve(ScalarNode, event.value, event.implicit)
node = ScalarNode(tag, event.value,
event.start_mark, event.end_mark, style=event.style)
if anchor is not None:
self.anchors[anchor] = node
return node
def compose_sequence_node(self, anchor):
start_event = self.get_event()
tag = start_event.tag
if tag is None or tag == u'!':
tag = self.resolve(SequenceNode, None, start_event.implicit)
node = SequenceNode(tag, [],
start_event.start_mark, None,
flow_style=start_event.flow_style)
if anchor is not None:
self.anchors[anchor] = node
index = 0
while not self.check_event(SequenceEndEvent):
node.value.append(self.compose_node(node, index))
index += 1
end_event = self.get_event()
node.end_mark = end_event.end_mark
return node
def compose_mapping_node(self, anchor):
start_event = self.get_event()
tag = start_event.tag
if tag is None or tag == u'!':
tag = self.resolve(MappingNode, None, start_event.implicit)
node = MappingNode(tag, [],
start_event.start_mark, None,
flow_style=start_event.flow_style)
if anchor is not None:
self.anchors[anchor] = node
while not self.check_event(MappingEndEvent):
#key_event = self.peek_event()
item_key = self.compose_node(node, None)
#if item_key in node.value:
# raise ComposerError("while composing a mapping", start_event.start_mark,
# "found duplicate key", key_event.start_mark)
item_value = self.compose_node(node, item_key)
#node.value[item_key] = item_value
node.value.append((item_key, item_value))
end_event = self.get_event()
node.end_mark = end_event.end_mark
return node
| {
"pile_set_name": "Github"
} |
/*******************************************************************************
* Copyright (c) 2007 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
******************************************************************************/
package org.eclipse.ui.ide.markers.compatibility.internal;
import java.util.HashMap;
import java.util.Map;
import org.eclipse.core.resources.IMarker;
import org.eclipse.ui.ide.markers.compatibility.api.MarkerItem;
/**
* The MarkerMap is a helper class that manages the mapping between a set of
* {@link IMarker} and thier {@link MarkerEntry} wrappers.
*
* @since 3.4
*
*/
class MarkerMap {
static final MarkerMap EMPTY_MAP = new MarkerMap();
private MarkerEntry[] markers;
// markerToEntryMap is a lazily created map from the markers to thier
// corresponding entry
private Map markerToEntryMap = null;
/**
* Creates an initially empty marker map
*/
public MarkerMap() {
this(new MarkerEntry[0]);
}
/**
* Create an instance of the receiver from markers.
*
* @param markers
*/
public MarkerMap(MarkerEntry[] markers) {
this.markers = markers;
}
/**
* Get the size of the entries
*
* @return int
*/
public int getSize() {
return markers.length;
}
/**
* Return the entries as an array.
*
* @return MarkerEntry[]
*/
public MarkerEntry[] toArray() {
return markers;
}
/**
* Return the entry at index
*
* @param index
* @return MarkerEntry
*/
public MarkerEntry elementAt(int index) {
return markers[index];
}
/**
* Return the {@link MarkerItem} that maps to marker.
*
* @param marker
* @return {@link MarkerItem}
*/
public MarkerItem getMarkerItem(IMarker marker) {
if (markerToEntryMap == null) {
markerToEntryMap = new HashMap();
for (int i = 0; i < markers.length; i++) {
IMarker nextMarker = markers[i].getMarker();
if (nextMarker != null)
markerToEntryMap.put(nextMarker, markers[i]);
}
}
if (markerToEntryMap.containsKey(marker))
return (MarkerItem) markerToEntryMap.get(marker);
return null;
}
}
| {
"pile_set_name": "Github"
} |
// { dg-do compile { target c++11 } }
// { dg-require-cmath "" }
// Copyright (C) 2011-2020 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
//
// This library 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 General Public License for more details.
//
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
#include <cmath>
// libstdc++/48933
struct Foo { };
template Foo std::atan2<Foo, Foo>(Foo, Foo); // { dg-error "not match" }
template Foo std::acosh<Foo>(Foo); // { dg-error "not match" }
template Foo std::asinh<Foo>(Foo); // { dg-error "not match" }
template Foo std::atanh<Foo>(Foo); // { dg-error "not match" }
template Foo std::cbrt<Foo>(Foo); // { dg-error "not match" }
template Foo std::copysign<Foo, Foo>(Foo, Foo); // { dg-error "not match" }
template Foo std::erf<Foo>(Foo); // { dg-error "not match" }
template Foo std::erfc<Foo>(Foo); // { dg-error "not match" }
template Foo std::exp2<Foo>(Foo); // { dg-error "not match" }
template Foo std::expm1<Foo>(Foo); // { dg-error "not match" }
template Foo std::fdim<Foo, Foo>(Foo, Foo); // { dg-error "not match" }
template Foo std::fma<Foo, Foo, Foo>(Foo(), Foo(), Foo()); // { dg-error "not match" }
template Foo std::fmax<Foo, Foo>(Foo, Foo); // { dg-error "not match" }
template Foo std::fmin<Foo, Foo>(Foo, Foo); // { dg-error "not match" }
template Foo std::hypot<Foo, Foo>(Foo, Foo); // { dg-error "not match" }
template int std::ilogb<Foo>(Foo); // { dg-error "not match" }
template Foo std::lgamma<Foo>(Foo); // { dg-error "not match" }
template long long std::llrint<Foo>(Foo); // { dg-error "not match" }
template long long std::llround<Foo>(Foo); // { dg-error "not match" }
template Foo std::log1p<Foo>(Foo); // { dg-error "not match" }
template Foo std::log2<Foo>(Foo); // { dg-error "not match" }
template Foo std::logb<Foo>(Foo); // { dg-error "not match" }
template long std::lrint<Foo>(Foo); // { dg-error "not match" }
template long std::lround<Foo>(Foo); // { dg-error "not match" }
template Foo std::nearbyint<Foo>(Foo); // { dg-error "not match" }
template Foo std::nextafter<Foo>(Foo, Foo); // { dg-error "not match" }
template Foo std::nexttoward<Foo>(Foo, long double); // { dg-error "not match" }
template Foo std::remainder<Foo, Foo>(Foo, Foo); // { dg-error "not match" }
template Foo std::remquo<Foo>(Foo, Foo, int*); // { dg-error "not match" }
template Foo std::rint<Foo>(Foo); // { dg-error "not match" }
template Foo std::round<Foo>(Foo); // { dg-error "not match" }
template Foo std::scalbln<Foo>(Foo, long); // { dg-error "not match" }
template Foo std::scalbn<Foo>(Foo, int); // { dg-error "not match" }
template Foo std::tgamma<Foo>(Foo); // { dg-error "not match" }
template Foo std::trunc<Foo>(Foo); // { dg-error "not match" }
| {
"pile_set_name": "Github"
} |
/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */
/* lib/crypto/dk/dk_cmac.c - Derived-key enctype functions using CMAC */
/*
* Copyright 2008, 2009, 2010 by the Massachusetts Institute of Technology.
* All Rights Reserved.
*
* Export of this software from the United States of America may
* require a specific license from the United States Government.
* It is the responsibility of any person or organization contemplating
* export to obtain such a license before exporting.
*
* WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
* distribute this software and its documentation for any purpose and
* without fee is hereby granted, provided that the above copyright
* notice appear in all copies and that both that copyright notice and
* this permission notice appear in supporting documentation, and that
* the name of M.I.T. not be used in advertising or publicity pertaining
* to distribution of the software without specific, written prior
* permission. Furthermore if you modify this software you must label
* your software as modified software and not distribute it in such a
* fashion that it might be confused with the original M.I.T. software.
* M.I.T. makes no representations about the suitability of
* this software for any purpose. It is provided "as is" without express
* or implied warranty.
*/
#include "k5-int.h"
#include "dk.h"
#include "aead.h"
#ifdef CAMELLIA
#define K5CLENGTH 5 /* 32 bit net byte order integer + one byte seed */
/* AEAD */
unsigned int
krb5int_camellia_crypto_length(const struct krb5_keytypes *ktp,
krb5_cryptotype type)
{
switch (type) {
case KRB5_CRYPTO_TYPE_HEADER:
return ktp->enc->block_size;
case KRB5_CRYPTO_TYPE_PADDING:
return 0;
case KRB5_CRYPTO_TYPE_TRAILER:
case KRB5_CRYPTO_TYPE_CHECKSUM:
return ktp->enc->block_size;
default:
assert(0 && "bad type passed to krb5int_camellia_crypto_length");
return 0;
}
}
/* Derive encryption and integrity keys for CMAC-using enctypes. */
static krb5_error_code
derive_keys(const struct krb5_enc_provider *enc, krb5_key key,
krb5_keyusage usage, krb5_key *ke_out, krb5_key *ki_out)
{
krb5_error_code ret;
unsigned char buf[K5CLENGTH];
krb5_data constant = make_data(buf, K5CLENGTH);
krb5_key ke, ki;
*ke_out = *ki_out = NULL;
/* Derive the encryption key. */
store_32_be(usage, buf);
buf[4] = 0xAA;
ret = krb5int_derive_key(enc, key, &ke, &constant, DERIVE_SP800_108_CMAC);
if (ret != 0)
return ret;
/* Derive the integrity key. */
buf[4] = 0x55;
ret = krb5int_derive_key(enc, key, &ki, &constant, DERIVE_SP800_108_CMAC);
if (ret != 0) {
krb5_k_free_key(NULL, ke);
return ret;
}
*ke_out = ke;
*ki_out = ki;
return 0;
}
krb5_error_code
krb5int_dk_cmac_encrypt(const struct krb5_keytypes *ktp, krb5_key key,
krb5_keyusage usage, const krb5_data *ivec,
krb5_crypto_iov *data, size_t num_data)
{
const struct krb5_enc_provider *enc = ktp->enc;
krb5_error_code ret;
krb5_crypto_iov *header, *trailer, *padding;
krb5_data cksum = empty_data();
krb5_key ke = NULL, ki = NULL;
/* E(Confounder | Plaintext | Pad) | Checksum */
/* Validate header and trailer lengths, and zero out padding length. */
header = krb5int_c_locate_iov(data, num_data, KRB5_CRYPTO_TYPE_HEADER);
if (header == NULL || header->data.length < enc->block_size)
return KRB5_BAD_MSIZE;
trailer = krb5int_c_locate_iov(data, num_data, KRB5_CRYPTO_TYPE_TRAILER);
if (trailer == NULL || trailer->data.length < enc->block_size)
return KRB5_BAD_MSIZE;
padding = krb5int_c_locate_iov(data, num_data, KRB5_CRYPTO_TYPE_PADDING);
if (padding != NULL)
padding->data.length = 0;
/* Derive the encryption and integrity keys. */
ret = derive_keys(enc, key, usage, &ke, &ki);
if (ret != 0)
goto cleanup;
/* Generate confounder. */
header->data.length = enc->block_size;
ret = krb5_c_random_make_octets(NULL, &header->data);
if (ret != 0)
goto cleanup;
/* Checksum the plaintext. */
ret = krb5int_cmac_checksum(enc, ki, data, num_data, &trailer->data);
if (ret != 0)
goto cleanup;
/* Encrypt the plaintext (header | data | padding) */
ret = enc->encrypt(ke, ivec, data, num_data);
if (ret != 0)
goto cleanup;
cleanup:
krb5_k_free_key(NULL, ke);
krb5_k_free_key(NULL, ki);
zapfree(cksum.data, cksum.length);
return ret;
}
krb5_error_code
krb5int_dk_cmac_decrypt(const struct krb5_keytypes *ktp, krb5_key key,
krb5_keyusage usage, const krb5_data *ivec,
krb5_crypto_iov *data, size_t num_data)
{
const struct krb5_enc_provider *enc = ktp->enc;
krb5_error_code ret;
krb5_crypto_iov *header, *trailer;
krb5_data cksum;
krb5_key ke = NULL, ki = NULL;
/* E(Confounder | Plaintext | Pad) | Checksum */
/* Validate header and trailer lengths. */
header = krb5int_c_locate_iov(data, num_data, KRB5_CRYPTO_TYPE_HEADER);
if (header == NULL || header->data.length != enc->block_size)
return KRB5_BAD_MSIZE;
trailer = krb5int_c_locate_iov(data, num_data, KRB5_CRYPTO_TYPE_TRAILER);
if (trailer == NULL || trailer->data.length != enc->block_size)
return KRB5_BAD_MSIZE;
/* Derive the encryption and integrity keys. */
ret = derive_keys(enc, key, usage, &ke, &ki);
if (ret != 0)
goto cleanup;
/* Decrypt the plaintext (header | data | padding). */
ret = enc->decrypt(ke, ivec, data, num_data);
if (ret != 0)
goto cleanup;
/* Verify the hash. */
ret = alloc_data(&cksum, enc->block_size);
if (ret != 0)
goto cleanup;
ret = krb5int_cmac_checksum(enc, ki, data, num_data, &cksum);
if (ret != 0)
goto cleanup;
if (!data_eq(cksum, trailer->data))
ret = KRB5KRB_AP_ERR_BAD_INTEGRITY;
cleanup:
krb5_k_free_key(NULL, ke);
krb5_k_free_key(NULL, ki);
zapfree(cksum.data, cksum.length);
return ret;
}
#endif /* CAMELLIA */
| {
"pile_set_name": "Github"
} |
#include <tommath.h>
#ifdef BN_REVERSE_C
/* LibTomMath, multiple-precision integer library -- Tom St Denis
*
* LibTomMath is a library that provides multiple-precision
* integer arithmetic as well as number theoretic functionality.
*
* The library was designed directly after the MPI library by
* Michael Fromberger but has been written from scratch with
* additional optimizations in place.
*
* The library is free for all purposes without any express
* guarantee it works.
*
* Tom St Denis, [email protected], http://libtom.org
*/
/* reverse an array, used for radix code */
void
bn_reverse (unsigned char *s, int len)
{
int ix, iy;
unsigned char t;
ix = 0;
iy = len - 1;
while (ix < iy) {
t = s[ix];
s[ix] = s[iy];
s[iy] = t;
++ix;
--iy;
}
}
#endif
/* $Source: /cvs/libtom/libtommath/bn_reverse.c,v $ */
/* $Revision: 1.4 $ */
/* $Date: 2006/12/28 01:25:13 $ */
| {
"pile_set_name": "Github"
} |
// Copyright 2016 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build amd64,linux
// +build !gccgo
package unix
import "syscall"
//go:noescape
func gettimeofday(tv *Timeval) (err syscall.Errno)
| {
"pile_set_name": "Github"
} |
#Requires -Modules VagrantMessages
param(
[Parameter(Mandatory=$true)]
[string]$VmId
)
# Make sure the exception type is loaded
try
{
# Microsoft.HyperV.PowerShell is present on all versions of Windows with HyperV
[void][System.Reflection.Assembly]::LoadWithPartialName('Microsoft.HyperV.PowerShell, Culture=neutral, PublicKeyToken=31bf3856ad364e35')
# Microsoft.HyperV.PowerShell.Objects is only present on Windows >= 10.0, so this will fail, and we ignore it since the needed exception
# type was loaded in Microsoft.HyperV.PowerShell
[void][System.Reflection.Assembly]::LoadWithPartialName('Microsoft.HyperV.PowerShell.Objects, Culture=neutral, PublicKeyToken=31bf3856ad364e35')
} catch {
# Empty catch ok, since if we didn't load the types, we will fail in the next block
}
$VmmsPath = if ([environment]::Is64BitProcess) { "$($env:SystemRoot)\System32\vmms.exe" } else { "$($env:SystemRoot)\Sysnative\vmms.exe" }
$HyperVVersion = [version](Get-Item $VmmsPath).VersionInfo.ProductVersion
if($HyperVVersion -lt ([version]'10.0')) {
$ExceptionType = [Microsoft.HyperV.PowerShell.VirtualizationOperationFailedException]
} else {
$ExceptionType = [Microsoft.HyperV.PowerShell.VirtualizationException]
}
try {
$VM = Hyper-V\Get-VM -Id $VmId -ErrorAction "Stop"
$State = $VM.state
$Status = $VM.status
} catch [Exception] {
if($_.Exception.GetType() -eq $ExceptionType)
{
$State = "not_created"
$Status = $State
}
else
{
throw;
}
}
$resultHash = @{
state = "$State"
status = "$Status"
}
$result = ConvertTo-Json $resultHash
Write-OutputMessage $result
| {
"pile_set_name": "Github"
} |
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Bundle\SecurityBundle\Tests\Functional\Bundle\AuthenticatorBundle;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
class ProfileController extends AbstractController
{
public function __invoke()
{
$this->denyAccessUnlessGranted('ROLE_USER');
return $this->json(['email' => $this->getUser()->getUsername()]);
}
}
| {
"pile_set_name": "Github"
} |
/*
* Copyright (c) 2018 Deven.
* 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.devs.readmoreoption;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.devs.readmoreoption.test", appContext.getPackageName());
}
}
| {
"pile_set_name": "Github"
} |
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright (C) 2012 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
-->
<resources xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<string name="applicationLabel" msgid="7762561155467201526">"Sími"</string>
<string name="launcherActivityLabel" msgid="1129729740601172692">"Sími"</string>
<string name="launcherDialpadActivityLabel" msgid="3959809805046059167">"Takkaborð síma"</string>
<string name="dialerIconLabel" msgid="6500826552823403796">"Sími"</string>
<string name="callHistoryIconLabel" msgid="3734413397291301223">"Símtalaferill"</string>
<string name="action_report_number" msgid="4635403959812186162">"Tilkynna rangt númer"</string>
<string name="action_copy_number_text" msgid="588249522108594155">"Afrita númer"</string>
<string name="copy_transcript_text" msgid="5652787482893879382">"Afrita umritun"</string>
<string name="action_block_number" msgid="1482657602262262134">"Setja númer á bannlista"</string>
<string name="snackbar_number_blocked" msgid="939830142765936021">"Lokað fyrir <xliff:g id="NUMBER">%1$s</xliff:g>"</string>
<string name="action_unblock_number" msgid="3043777622269776127">"Taka númer af bannlista"</string>
<string name="snackbar_number_unblocked" msgid="4854738171099045912">"<xliff:g id="NUMBER">%1$s</xliff:g> tekið af bannlista"</string>
<string name="block_number_undo" msgid="591338370336724156">"AFTURKALLA"</string>
<string name="call_details_delete" msgid="1833359621896346955">"Eyða"</string>
<string name="action_edit_number_before_call" msgid="3100221149873436485">"Breyta númeri áður en hringt er"</string>
<string name="call_log_delete_all" msgid="4677609108288680411">"Hreinsa símtalaferil"</string>
<string name="call_log_trash_voicemail" msgid="1283948488625129019">"Eyða talhólfsskilaboðum"</string>
<string name="call_log_archive_voicemail" msgid="9072936797223284265">"Setja talhólfsskilaboð í geymslu"</string>
<string name="call_log_share_voicemail" msgid="7272635349055945546">"Deila talhólfsskilaboðum"</string>
<string name="snackbar_voicemail_deleted" msgid="5098542835986188582">"Talhólfi eytt"</string>
<string name="snackbar_voicemail_archived" msgid="7442340403660554373">"Talhólfsskilaboð sett í geymslu"</string>
<string name="snackbar_voicemail_deleted_undo" msgid="3741811385891289167">"AFTURKALLA"</string>
<string name="snackbar_voicemail_archived_goto" msgid="9186182602955185448">"FARA Í GEYMSLU"</string>
<string name="clearCallLogConfirmation_title" msgid="801753155679372984">"Hreinsa símtalaferil?"</string>
<string name="clearCallLogConfirmation" msgid="7899552396101432827">"Þetta eyðir öllum símtölum af ferlinum"</string>
<string name="clearCallLogProgress_title" msgid="3372471156216306132">"Hreinsar símtalaferil…"</string>
<string name="userCallActivityLabel" product="default" msgid="6652512551977445095">"Sími"</string>
<string name="notification_missedCallTitle" msgid="2078223183024451723">"Ósvarað símtal"</string>
<string name="notification_missedWorkCallTitle" msgid="8418335304394771688">"Ósvarað vinnusímtal"</string>
<string name="notification_missedCallsTitle" msgid="4948840634672742797">"Ósvöruð símtöl"</string>
<string name="notification_missedCallsMsg" msgid="158790423221579961">"<xliff:g id="NUM_MISSED_CALLS">%s</xliff:g> ósvöruð símtöl"</string>
<string name="notification_missedCall_call_back" msgid="1991552423738343203">"Hringja til baka"</string>
<string name="notification_missedCall_message" msgid="3042123733754151052">"Skilaboð"</string>
<plurals name="notification_voicemail_title" formatted="false" msgid="9088953961148324851">
<item quantity="one"> <xliff:g id="COUNT">%1$d</xliff:g> talhólfsskilaboð </item>
<item quantity="other"> <xliff:g id="COUNT">%1$d</xliff:g> talhólfsskilaboð </item>
</plurals>
<string name="notification_action_voicemail_play" msgid="6113133136977996863">"Spila"</string>
<string name="notification_voicemail_callers_list" msgid="1153954809339404149">"<xliff:g id="NEWER_CALLERS">%1$s</xliff:g>, <xliff:g id="OLDER_CALLER">%2$s</xliff:g>"</string>
<string name="notification_new_voicemail_ticker" msgid="895342132049452081">"Ný talhólfsskilaboð frá <xliff:g id="CALLER">%1$s</xliff:g>"</string>
<string name="voicemail_playback_error" msgid="3356071912353297599">"Ekki tókst að spila talhólfsskilaboð"</string>
<string name="voicemail_fetching_content" msgid="1287895365599580842">"Hleður talhólfsskilaboð…"</string>
<string name="voicemail_archiving_content" msgid="722322091690281157">"Setur talhólfsskilaboð í geymslu..."</string>
<string name="voicemail_fetching_timout" msgid="3959428065511972176">"Ekki tókst að hlaða talhólfsskilaboð"</string>
<string name="call_log_voicemail_header" msgid="3945407886667089173">"Símtöl með talhólfi eingöngu"</string>
<string name="call_log_incoming_header" msgid="2787722299753674684">"Móttekin símtöl eingöngu"</string>
<string name="call_log_outgoing_header" msgid="761009180766735769">"Hringd símtöl eingöngu"</string>
<string name="call_log_missed_header" msgid="8017148056610855956">"Ósvöruð símtöl eingöngu"</string>
<string name="visual_voicemail_title" msgid="4574199312906348905">"Myndrænt talhólf"</string>
<string name="visual_voicemail_text" msgid="164967285234132509">"Skoðaðu og hlustaðu á talhólfið þitt án þess að þurfa að hringja. Getur haft gagnakostnað í för með sér."</string>
<string name="visual_voicemail_settings" msgid="8090338793118794741">"Stillingar"</string>
<string name="voicemail_status_voicemail_not_available" msgid="5222480147701456390">"Talhólfsuppfærslur ekki í boði"</string>
<string name="voicemail_status_messages_waiting" msgid="6329544650250068650">"Ný talhólfsskilaboð bíða. Ekki er hægt að hlaða þau eins og er."</string>
<string name="voicemail_status_configure_voicemail" msgid="8300808991932816153">"Settu upp talhólfið þitt"</string>
<string name="voicemail_status_audio_not_available" msgid="2449801102560158082">"Hljóð er ekki í boði"</string>
<string name="voicemail_status_action_configure" msgid="8671796489912239589">"Uppsetning"</string>
<string name="voicemail_status_action_call_server" msgid="1824816252288551794">"Hringja í talhólf"</string>
<string name="call_log_item_count_and_date" msgid="7641933305703520787">"(<xliff:g id="COUNT">%1$d</xliff:g>) <xliff:g id="DATE">%2$s</xliff:g>"</string>
<string name="sms_disambig_title" msgid="5846266399240630846">"Veldu símanúmer"</string>
<string name="call_disambig_title" msgid="4392886850104795739">"Veldu símanúmer"</string>
<string name="make_primary" msgid="5829291915305113983">"Muna þetta val"</string>
<string name="description_search_button" msgid="3660807558587384889">"leita"</string>
<string name="description_dial_button" msgid="1274091017188142646">"hringja"</string>
<string name="description_digits_edittext" msgid="8760207516497016437">"númer til að hringja í"</string>
<string name="description_playback_start_stop" msgid="5060732345522492292">"Hefja eða stöðva spilun"</string>
<string name="description_playback_speakerphone" msgid="6008323900245707504">"Kveikja eða slökkva á hátalara"</string>
<string name="description_playback_seek" msgid="4509404274968530055">"Breyta spilunarstöðu"</string>
<string name="description_rate_decrease" msgid="3161652589401708284">"Draga úr spilunarhraða"</string>
<string name="description_rate_increase" msgid="6324606574127052385">"Auka spilunarhraða"</string>
<string name="action_menu_call_history_description" msgid="9018442816219748968">"Símtalaferill"</string>
<string name="action_menu_overflow_description" msgid="2303272250613084574">"Fleiri valkostir"</string>
<string name="action_menu_dialpad_button" msgid="1425910318049008136">"takkaborð"</string>
<string name="menu_show_outgoing_only" msgid="1965570298133301970">"Sýna hringd símtöl eingöngu"</string>
<string name="menu_show_incoming_only" msgid="7534206815238877417">"Sýnir móttekin símtöl eingöngu"</string>
<string name="menu_show_missed_only" msgid="154473166059743996">"Sýna ósvöruð símtöl eingöngu"</string>
<string name="menu_show_voicemails_only" msgid="1898421289561435703">"Sýna talhólfsskilaboð eingöngu"</string>
<string name="menu_show_all_calls" msgid="7560347482073345885">"Sýna öll símtöl"</string>
<string name="add_2sec_pause" msgid="9214012315201040129">"Bæta við 2 sekúndna töf"</string>
<string name="add_wait" msgid="3360818652790319634">"Bæta töf við"</string>
<string name="dialer_settings_label" msgid="4305043242594150479">"Stillingar"</string>
<string name="menu_newContact" msgid="1209922412763274638">"Nýr tengiliður"</string>
<string name="menu_allContacts" msgid="6948308384034051670">"Allir tengiliðir"</string>
<string name="callDetailTitle" msgid="5340227785196217938">"Símtalsupplýsingar"</string>
<string name="toast_call_detail_error" msgid="6947041258280380832">"Upplýsingar ekki í boði"</string>
<string name="dialer_useDtmfDialpad" msgid="1707548397435075040">"Nota snertitónatakkaborð"</string>
<string name="dialer_returnToInCallScreen" msgid="3719386377550913067">"Fara aftur í símtal í gangi"</string>
<string name="dialer_addAnotherCall" msgid="4205688819890074468">"Bæta við símtali"</string>
<string name="type_incoming" msgid="6502076603836088532">"Móttekið símtal"</string>
<string name="type_outgoing" msgid="343108709599392641">"Hringt símtal"</string>
<string name="type_missed" msgid="2720502601640509542">"Ósvarað símtal"</string>
<string name="type_incoming_video" msgid="82323391702796181">"Myndsímtal berst"</string>
<string name="type_outgoing_video" msgid="2858140021680755266">"Myndsímtal hringt"</string>
<string name="type_missed_video" msgid="954396897034220545">"Ósvarað myndsímtal"</string>
<string name="type_voicemail" msgid="5153139450668549908">"Talhólfsskilaboð"</string>
<string name="type_rejected" msgid="7783201828312472691">"Símtali hafnað"</string>
<string name="type_blocked" msgid="3521686227115330015">"Símtal á bannlista"</string>
<string name="actionIncomingCall" msgid="6028930669817038600">"Móttekin símtöl"</string>
<string name="description_call_log_play_button" msgid="651182125650429846">"Spila talhólfsskilaboð"</string>
<string name="description_view_contact" msgid="5205669345700598415">"Skoða tengiliðinn <xliff:g id="NAME">%1$s</xliff:g>"</string>
<string name="description_call" msgid="3443678121983852666">"Hringja í <xliff:g id="NAME">%1$s</xliff:g>"</string>
<string name="description_contact_details" msgid="51229793651342809">"Tengiliðaupplýsingar um <xliff:g id="NAMEORNUMBER">%1$s</xliff:g>"</string>
<string name="description_num_calls" msgid="1601505153694540074">"<xliff:g id="NUMBEROFCALLS">%1$s</xliff:g> símtöl."</string>
<string name="description_video_call" msgid="2933838090743214204">"Myndsímtal"</string>
<string name="description_send_text_message" msgid="3118485319691414221">"Senda SMS til <xliff:g id="NAME">%1$s</xliff:g>"</string>
<string name="description_call_log_unheard_voicemail" msgid="118101684236996786">"Óspiluð talhólfsskilaboð"</string>
<string name="description_start_voice_search" msgid="520539488194946012">"Hefja raddleit"</string>
<string name="menu_callNumber" msgid="997146291983360266">"Hringja í <xliff:g id="NUMBER">%s</xliff:g>"</string>
<string name="unknown" msgid="740067747858270469">"Óþekkt"</string>
<string name="voicemail" msgid="3851469869202611441">"Talhólf"</string>
<string name="private_num" msgid="6374339738119166953">"Leyninúmer"</string>
<string name="payphone" msgid="7726415831153618726">"Símasjálfsali"</string>
<string name="callDetailsShortDurationFormat" msgid="3988146235579303592">"<xliff:g id="SECONDS">%s</xliff:g> sek."</string>
<string name="callDetailsDurationFormat" msgid="6061406028764382234">"<xliff:g id="MINUTES">%s</xliff:g> mín. og <xliff:g id="SECONDS">%s</xliff:g> sek."</string>
<!-- no translation found for voicemailCallLogToday (682363079840402849) -->
<skip />
<string name="voicemailCallLogDateTimeFormat" msgid="4388070029056487713">"<xliff:g id="DATE">%1$s</xliff:g> kl. <xliff:g id="TIME">%2$s</xliff:g>"</string>
<string name="voicemailDurationFormat" msgid="228211252076289564">"<xliff:g id="MINUTES">%1$02d</xliff:g>:<xliff:g id="SECONDS">%2$02d</xliff:g>"</string>
<string name="voicemailCallLogDateTimeFormatWithDuration" msgid="5118563814451588397">"<xliff:g id="DATEANDTIME">%1$s</xliff:g> • <xliff:g id="DURATION">%2$s</xliff:g>"</string>
<string name="dialog_phone_call_prohibited_message" msgid="5730565540182492608">"Ekki er hægt að hringja í þetta númer"</string>
<string name="dialog_voicemail_not_ready_message" msgid="4384716252789515378">"Til að setja upp talhólf þarftu að opna valmyndina og velja Stillingar."</string>
<string name="dialog_voicemail_airplane_mode_message" msgid="530922773669546093">"Til að hringja í talhólfið þarftu fyrst að slökkva á flugstillingu."</string>
<string name="contact_list_loading" msgid="5488620820563977329">"Hleður…"</string>
<string name="imei" msgid="3045126336951684285">"IMEI"</string>
<string name="meid" msgid="6210568493746275750">"MEID"</string>
<string name="simContacts_emptyLoading" msgid="6700035985448642408">"Hleður af SIM-kortinu…"</string>
<string name="simContacts_title" msgid="27341688347689769">"Tengiliðir á SIM-korti"</string>
<string name="add_contact_not_available" msgid="5547311613368004859">"Ekkert tengiliðaforrit í boði"</string>
<string name="voice_search_not_available" msgid="2977719040254285301">"Raddleit er ekki í boði"</string>
<string name="call_not_available" msgid="8941576511946492225">"Ekki er hægt að hringja vegna þess að forritið Sími hefur verið gert óvirkt."</string>
<string name="activity_not_available" msgid="2287665636817987623">"Ekkert forrit fyrir þetta er í tækinu"</string>
<string name="dialer_hint_find_contact" msgid="3574350254520035364">"Leita að tengiliðum"</string>
<string name="block_number_search_hint" msgid="5409571607043872758">"Bættu við númeri eða tengilið"</string>
<string name="call_log_all_empty" msgid="8357417710416340920">"Símtalaferillinn er auður"</string>
<string name="call_log_all_empty_action" msgid="9093210119068366147">"Hringja"</string>
<string name="call_log_missed_empty" msgid="3927274175205520135">"Þú ert ekki með nein ósvöruð símtöl."</string>
<string name="call_log_voicemail_empty" msgid="8383585074222277550">"Talhólfið þitt er tómt."</string>
<string name="voicemail_archive_empty" msgid="1087408796679056787">"Talhólfsskilaboðageymslan er tóm."</string>
<string name="show_favorites_only" msgid="5520072531022614595">"Sýna aðeins uppáhaldstengiliði"</string>
<string name="call_log_activity_title" msgid="7949633151371183580">"Símtalaferill"</string>
<string name="voicemail_archive_activity_title" msgid="2638669189424535229">"Geymsla talhólfsskilaboða"</string>
<string name="call_log_all_title" msgid="3566738938889333307">"Allt"</string>
<string name="call_log_missed_title" msgid="4541142293870638971">"Ósvöruð"</string>
<string name="call_log_voicemail_title" msgid="940422274047025948">"Talhólf"</string>
<string name="migrate_blocked_numbers_dialog_title" msgid="2039363199438872626">"Nýr, einfaldari bannlisti"</string>
<string name="migrate_blocked_numbers_dialog_message" msgid="5598530398682662860">"Til að vernda þig enn betur þarf símaforritið að breyta því hvernig farið er með bannlista. Séu númer á bannlista verður bæði lokað fyrir símtöl og skilaboð frá þeim og hugsanlega verður þeim deilt með öðrum forritum."</string>
<string name="migrate_blocked_numbers_dialog_allow_button" msgid="3116140286537760629">"Leyfa"</string>
<string name="block_number_confirmation_title" msgid="6862219558186931304">"Setja <xliff:g id="NUMBER">%1$s</xliff:g> á bannlista?"</string>
<string name="block_number_confirmation_message_vvm" msgid="5655646611437082611">"Lokað verður fyrir símtöl frá þessu númeri og talhólfsskilaboðum sjálfkrafa eytt."</string>
<string name="block_number_confirmation_message_no_vvm" msgid="4511900601491718173">"Lokað verður fyrir símtöl frá þessu númeri. Hugsanlegt er að sá sem hringir geti engu að síður sent þér talhólfsskilaboð."</string>
<string name="block_number_confirmation_message_new_filtering" msgid="4524854769790960179">"Þú munt ekki lengur fá símtöl eða textaskilaboð úr þessu númeri."</string>
<string name="block_number_ok" msgid="770551992296781873">"SETJA Á BANNLISTA"</string>
<string name="unblock_number_confirmation_title" msgid="252824779504084354">"Taka <xliff:g id="NUMBER">%1$s</xliff:g> af bannlista?"</string>
<string name="unblock_number_ok" msgid="6449899182699684786">"TAKA AF BANNLISTA"</string>
<string name="tab_speed_dial" msgid="7552166276545648893">"Hraðval"</string>
<string name="tab_history" msgid="2563144697322434940">"Símtalaferill"</string>
<string name="tab_all_contacts" msgid="1410922767166533690">"Tengiliðir"</string>
<string name="tab_voicemail" msgid="155024725947496746">"Talhólf"</string>
<string name="favorite_hidden" msgid="5011234945140912047">"Fjarlægður úr uppáhaldi"</string>
<string name="favorite_hidden_undo" msgid="2508998611039406474">"Afturkalla"</string>
<string name="search_shortcut_call_number" msgid="7277194656832895870">"Hringja í <xliff:g id="NUMBER">%s</xliff:g>"</string>
<string name="search_shortcut_create_new_contact" msgid="1679917465521554093">"Búa til nýjan tengilið"</string>
<string name="search_shortcut_add_to_contact" msgid="4327842393369915751">"Bæta við tengilið"</string>
<string name="search_shortcut_send_sms_message" msgid="2569304043345025525">"Senda SMS-skilaboð"</string>
<string name="search_shortcut_make_video_call" msgid="1265971685034465166">"Hringja myndsímtal"</string>
<string name="search_shortcut_block_number" msgid="4787156645163436072">"Setja númer á bannlista"</string>
<string name="num_missed_calls" msgid="8081736535604293886">"<xliff:g id="NUMBER">%s</xliff:g> ný ósvöruð símtöl"</string>
<string name="speed_dial_empty" msgid="8838921693673366129">"Þú ert ekki með neinn í hraðvali enn sem komið er"</string>
<string name="speed_dial_empty_add_favorite_action" msgid="7944893641496695770">"Bæta uppáhaldi við"</string>
<string name="all_contacts_empty" msgid="471370638298229686">"Þú ert ekki með neina tengiliði enn sem komið er"</string>
<string name="all_contacts_empty_add_contact_action" msgid="1515782853819374618">"Bæta tengilið við"</string>
<string name="contact_tooltip" msgid="2019777545923635266">"Snertu myndina til að sjá öll númer eða haltu henni inni til að endurraða"</string>
<string name="remove_contact" msgid="1080555335283662961">"Fjarlægja"</string>
<string name="call_log_action_video_call" msgid="7724301709041128296">"Myndsímtal"</string>
<string name="call_log_action_send_message" msgid="5679719296905285131">"Senda skilaboð"</string>
<string name="call_log_action_details" msgid="701345508704970622">"Símtalsupplýsingar"</string>
<string name="call_log_action_call" msgid="463690849042459842">"Hringja í <xliff:g id="NAMEORNUMBER">^1</xliff:g>"</string>
<string name="description_incoming_missed_call" msgid="2381085098795943627">"Ósvarað símtal frá <xliff:g id="NAMEORNUMBER">^1</xliff:g>, <xliff:g id="TYPEORLOCATION">^2</xliff:g>, <xliff:g id="TIMEOFCALL">^3</xliff:g>, <xliff:g id="PHONEACCOUNT">^4</xliff:g>."</string>
<string name="description_incoming_answered_call" msgid="7117665748428816544">"Svarað símtal frá <xliff:g id="NAMEORNUMBER">^1</xliff:g>, <xliff:g id="TYPEORLOCATION">^2</xliff:g>, <xliff:g id="TIMEOFCALL">^3</xliff:g>, <xliff:g id="PHONEACCOUNT">^4</xliff:g>."</string>
<string name="description_unread_voicemail" msgid="5826351827625665597">"Ólesin talhólfsskilaboð frá <xliff:g id="NAMEORNUMBER">^1</xliff:g>, <xliff:g id="TYPEORLOCATION">^2</xliff:g>, <xliff:g id="TIMEOFCALL">^3</xliff:g>, <xliff:g id="PHONEACCOUNT">^4</xliff:g>."</string>
<string name="description_read_voicemail" msgid="133974208364152610">"Talhólfsskilaboð frá <xliff:g id="NAMEORNUMBER">^1</xliff:g>, <xliff:g id="TYPEORLOCATION">^2</xliff:g>, <xliff:g id="TIMEOFCALL">^3</xliff:g>, <xliff:g id="PHONEACCOUNT">^4</xliff:g>."</string>
<string name="description_outgoing_call" msgid="6386364390619734734">"Símtal til <xliff:g id="NAMEORNUMBER">^1</xliff:g>, <xliff:g id="TYPEORLOCATION">^2</xliff:g>, <xliff:g id="TIMEOFCALL">^3</xliff:g>, <xliff:g id="PHONEACCOUNT">^4</xliff:g>."</string>
<string name="description_phone_account" msgid="1767072759541443861">"í gegnum <xliff:g id="PHONEACCOUNT">^1</xliff:g>"</string>
<string name="description_via_number" msgid="3503311803959108316">"í gegnum <xliff:g id="NUMBER">%1$s</xliff:g>"</string>
<string name="call_log_via_number" msgid="8373282986443543296">"í gegnum <xliff:g id="NUMBER">%1$s</xliff:g>"</string>
<string name="description_via_number_phone_account" msgid="5426866894799626474">"á <xliff:g id="PHONEACCOUNT">%1$s</xliff:g>, í gegnum <xliff:g id="NUMBER">%2$s</xliff:g>"</string>
<string name="call_log_via_number_phone_account" msgid="4394943791173578941">"<xliff:g id="PHONEACCOUNT">%1$s</xliff:g> í gegnum <xliff:g id="NUMBER">%2$s</xliff:g>"</string>
<string name="description_call_log_call_action" msgid="3682561657090693134">"Hringja"</string>
<string name="description_call_action" msgid="4000549004089776147">"Hringja í <xliff:g id="NAMEORNUMBER">^1</xliff:g>"</string>
<string name="description_video_call_action" msgid="7386922428155062213">"Hringja myndsímtal í <xliff:g id="NAMEORNUMBER">^1</xliff:g>."</string>
<string name="description_voicemail_action" msgid="8054891873788903063">"Hlusta á talhólfsskilaboð frá <xliff:g id="NAMEORNUMBER">^1</xliff:g>"</string>
<string name="description_voicemail_play" msgid="2689369874037785439">"Spila talhólfsskilaboð sem <xliff:g id="NAMEORNUMBER">^1</xliff:g> sendi"</string>
<string name="description_voicemail_pause" msgid="3905259748756919693">"Gera hlé á talhólfsskilaboðum sem <xliff:g id="NAMEORNUMBER">^1</xliff:g> sendi"</string>
<string name="description_voicemail_delete" msgid="2025472770630153436">"Eyða talhólfsskilaboðum sem <xliff:g id="NAMEORNUMBER">^1</xliff:g> sendi"</string>
<plurals name="description_voicemail_unread" formatted="false" msgid="8708346053055570332">
<item quantity="one"><xliff:g id="COUNT_1">%d</xliff:g> ný talhólfsskilaboð</item>
<item quantity="other"><xliff:g id="COUNT_1">%d</xliff:g> ný talhólfsskilaboð</item>
</plurals>
<string name="description_create_new_contact_action" msgid="818755978791008167">"Búa til tengilið fyrir <xliff:g id="NAMEORNUMBER">^1</xliff:g>"</string>
<string name="description_add_to_existing_contact_action" msgid="6081200053494414351">"Bæta <xliff:g id="NAMEORNUMBER">^1</xliff:g> við fyrirliggjandi tengilið"</string>
<string name="description_details_action" msgid="2433827152749491785">"Símtalsupplýsingar fyrir <xliff:g id="NAMEORNUMBER">^1</xliff:g>"</string>
<string name="toast_entry_removed" msgid="8010830299576311534">"Eytt af símtalaferli"</string>
<string name="call_log_header_today" msgid="3225248682434212981">"Í dag"</string>
<string name="call_log_header_yesterday" msgid="9139172458834033092">"Í gær"</string>
<string name="call_log_header_other" msgid="5769921959940709084">"Eldra"</string>
<string name="call_detail_list_header" msgid="3752717059699600861">"Símtalalisti"</string>
<string name="voicemail_speaker_on" msgid="209154030283487068">"Kveikja á hátalara."</string>
<string name="voicemail_speaker_off" msgid="7390530056413093958">"Slökkva á hátalara."</string>
<string name="voicemail_play_faster" msgid="3444751008615323006">"Spila hraðar."</string>
<string name="voicemail_play_slower" msgid="4544796503902818832">"Spila hægar."</string>
<string name="voicemail_play_start_pause" msgid="3687447935787768983">"Hefja eða gera hlé á spilun."</string>
<string name="list_delimeter" msgid="4571593167738725100">", "</string>
<string name="display_options_title" msgid="7812852361055667468">"Birtingarvalkostir"</string>
<string name="sounds_and_vibration_title" msgid="1692290115642160845">"Hljóð og titringur"</string>
<string name="accessibility_settings_title" msgid="6068141142874046249">"Aðgengi"</string>
<string name="ringtone_title" msgid="760362035635084653">"Hringitónn síma"</string>
<string name="vibrate_on_ring_title" msgid="3362916460327555241">"Titra líka fyrir símtöl"</string>
<string name="dtmf_tone_enable_title" msgid="6571449695997521615">"Tónar takkaborðs"</string>
<string name="dtmf_tone_length_title" msgid="8581125689808919460">"Lengd takkatóns"</string>
<string-array name="dtmf_tone_length_entries">
<item msgid="1036113889050195575">"Venjulegur"</item>
<item msgid="6177579030803486015">"Langur"</item>
</string-array>
<string name="respond_via_sms_setting_title" msgid="1318281521087951580">"Snarsvör"</string>
<string name="call_settings_label" msgid="313434211353070209">"Símtöl"</string>
<string name="manage_blocked_numbers_label" msgid="5959801428936629196">"Lokað fyrir símtöl"</string>
<string name="blocked_numbers_disabled_emergency_header_label" msgid="7870947220238070418">"Tímabundið slökkt á lokun fyrir símtöl"</string>
<string name="blocked_numbers_disabled_emergency_desc" msgid="7755803249073401381">"Lokun fyrir símtöl hefur verið gerð óvirk vegna þess að þú hafðir samband við neyðarþjónustu úr þessum síma á undanförnum tveimur sólarhringum. Lokunin verður aftur virk að þessum tveimur sólarhringum liðnum."</string>
<string name="import_send_to_voicemail_numbers_label" msgid="1606601823746799926">"Flytja inn númer"</string>
<string name="blocked_call_settings_import_description" msgid="8640906226815125906">"Þú merktir áður nokkra hringjendur þannig að þeir verði sjálfkrafa sendir í talhólfið í gegnum önnur forrit."</string>
<string name="blocked_call_settings_view_numbers_button" msgid="6698986720875955935">"Skoða tölur"</string>
<string name="blocked_call_settings_import_button" msgid="178821255125295473">"Flytja inn"</string>
<string name="send_to_voicemail_import_failed" msgid="5547202002133560069">"Innflutningur mistókst"</string>
<string name="voicemail_archive_failed" msgid="6263467962738772223">"Ekki tókst að setja talhólfsskilaboð í geymslu."</string>
<string name="description_blocked_number_list_delete" msgid="3240093199107796792">"Taka númer af bannlista"</string>
<string name="addBlockedNumber" msgid="6064812257482886526">"Bæta númeri við"</string>
<string name="block_number_footer_message_vvm" msgid="5387302253765439712">"Lokað verður fyrir símtöl frá þessum númerum og talhólfsskilaboðum sjálfkrafa eytt."</string>
<string name="block_number_footer_message_no_vvm" msgid="223238617533822381">"Lokað verður fyrir símtöl frá þessum númerum. Hugsanlegt er að þeir sem hringja geti engu að síður sent þér talhólfsskilaboð."</string>
<string name="block_list" msgid="7760188925338078011">"Númer á bannlista"</string>
<string name="invalidNumber" msgid="619058581062192851">"<xliff:g id="NUMBER">%1$s</xliff:g> er ógilt."</string>
<string name="alreadyBlocked" msgid="282340105563646876">"<xliff:g id="NUMBER">%1$s</xliff:g> er nú þegar á bannlista."</string>
<string name="call_blocking_disabled_notification_title" msgid="8185193413377920194">"Slökkt á lokun símtala í 48 klukkustundir"</string>
<string name="call_blocking_disabled_notification_text" msgid="5330772013626378526">"Óvirkt vegna þess að neyðarsímtal var hringt."</string>
<string name="phone_account_settings_label" msgid="5864322009841175294">"Símtalareikningar"</string>
<string name="permission_single_turn_on" msgid="1543391076065465464">"Kveikja"</string>
<string name="permission_multiple_turn_on" msgid="2426278457455950554">"Stilla heimildir"</string>
<string name="permission_no_speeddial" msgid="6882563445996184051">"Kveiktu á tengiliðaheimildinni til að gera hraðval virkt."</string>
<string name="permission_no_calllog" msgid="555711464287041043">"Kveiktu á heimild símaforritsins til að sjá símtalaskrána þína."</string>
<string name="permission_no_contacts" msgid="6237980143178936279">"Kveiktu á tengiliðaheimildinni til að sjá tengiliðina þína."</string>
<string name="permission_no_voicemail" msgid="8306280257799917574">"Kveiktu á heimild símaforritsins til að fá aðgang að talhólfinu þínu."</string>
<string name="permission_no_search" msgid="84152933267902056">"Kveiktu á heimildunum fyrir tengiliði til að leita að tengiliðum."</string>
<string name="permission_place_call" msgid="2101287782615887547">"Kveiktu á heimild símaforritsins til að hringja símtal."</string>
<string name="toast_cannot_write_system_settings" msgid="5614246168296606709">"Símaforritið hefur ekki heimild til að breyta kerfisstillingum."</string>
<string name="blocked_number_call_log_label" msgid="8912042441473014712">"Á bannlista"</string>
<string name="accessibility_call_is_active" msgid="2297282583928508760">"Símtal við <xliff:g id="NAMEORNUMBER">^1</xliff:g> er í gangi"</string>
</resources>
| {
"pile_set_name": "Github"
} |
! des_enc.m4
! des_enc.S (generated from des_enc.m4)
!
! UltraSPARC assembler version of the LibDES/SSLeay/OpenSSL des_enc.c file.
!
! Version 1.0. 32-bit version.
!
! June 8, 2000.
!
! Version 2.0. 32/64-bit, PIC-ification, blended CPU adaptation
! by Andy Polyakov.
!
! January 1, 2003.
!
! Assembler version: Copyright Svend Olaf Mikkelsen.
!
! Original C code: Copyright Eric A. Young.
!
! This code can be freely used by LibDES/SSLeay/OpenSSL users.
!
! The LibDES/SSLeay/OpenSSL copyright notices must be respected.
!
! This version can be redistributed.
!
! To expand the m4 macros: m4 -B 8192 des_enc.m4 > des_enc.S
!
! Global registers 1 to 5 are used. This is the same as done by the
! cc compiler. The UltraSPARC load/store little endian feature is used.
!
! Instruction grouping often refers to one CPU cycle.
!
! Assemble through gcc: gcc -c -mcpu=ultrasparc -o des_enc.o des_enc.S
!
! Assemble through cc: cc -c -xarch=v8plusa -o des_enc.o des_enc.S
!
! Performance improvement according to './apps/openssl speed des'
!
! 32-bit build:
! 23% faster than cc-5.2 -xarch=v8plus -xO5
! 115% faster than gcc-3.2.1 -m32 -mcpu=ultrasparc -O5
! 64-bit build:
! 50% faster than cc-5.2 -xarch=v9 -xO5
! 100% faster than gcc-3.2.1 -m64 -mcpu=ultrasparc -O5
!
.ident "des_enc.m4 2.1"
.file "des_enc-sparc.S"
#if defined(__SUNPRO_C) && defined(__sparcv9)
# define ABI64 /* They've said -xarch=v9 at command line */
#elif defined(__GNUC__) && defined(__arch64__)
# define ABI64 /* They've said -m64 at command line */
#endif
#ifdef ABI64
.register %g2,#scratch
.register %g3,#scratch
# define FRAME -192
# define BIAS 2047
# define LDPTR ldx
# define STPTR stx
# define ARG0 128
# define ARGSZ 8
# ifndef OPENSSL_SYSNAME_ULTRASPARC
# define OPENSSL_SYSNAME_ULTRASPARC
# endif
#else
# define FRAME -96
# define BIAS 0
# define LDPTR ld
# define STPTR st
# define ARG0 68
# define ARGSZ 4
#endif
#define LOOPS 7
#define global0 %g0
#define global1 %g1
#define global2 %g2
#define global3 %g3
#define global4 %g4
#define global5 %g5
#define local0 %l0
#define local1 %l1
#define local2 %l2
#define local3 %l3
#define local4 %l4
#define local5 %l5
#define local7 %l6
#define local6 %l7
#define in0 %i0
#define in1 %i1
#define in2 %i2
#define in3 %i3
#define in4 %i4
#define in5 %i5
#define in6 %i6
#define in7 %i7
#define out0 %o0
#define out1 %o1
#define out2 %o2
#define out3 %o3
#define out4 %o4
#define out5 %o5
#define out6 %o6
#define out7 %o7
#define stub stb
changequote({,})
! Macro definitions:
! {ip_macro}
!
! The logic used in initial and final permutations is the same as in
! the C code. The permutations are done with a clever shift, xor, and
! technique.
!
! The macro also loads address sbox 1 to 5 to global 1 to 5, address
! sbox 6 to local6, and addres sbox 8 to out3.
!
! Rotates the halfs 3 left to bring the sbox bits in convenient positions.
!
! Loads key first round from address in parameter 5 to out0, out1.
!
! After the the original LibDES initial permutation, the resulting left
! is in the variable initially used for right and vice versa. The macro
! implements the possibility to keep the halfs in the original registers.
!
! parameter 1 left
! parameter 2 right
! parameter 3 result left (modify in first round)
! parameter 4 result right (use in first round)
! parameter 5 key address
! parameter 6 1/2 for include encryption/decryption
! parameter 7 1 for move in1 to in3
! parameter 8 1 for move in3 to in4, 2 for move in4 to in3
! parameter 9 1 for load ks3 and ks2 to in4 and in3
define(ip_macro, {
! {ip_macro}
! $1 $2 $4 $3 $5 $6 $7 $8 $9
ld [out2+256], local1
srl $2, 4, local4
xor local4, $1, local4
ifelse($7,1,{mov in1, in3},{nop})
ld [out2+260], local2
and local4, local1, local4
ifelse($8,1,{mov in3, in4},{})
ifelse($8,2,{mov in4, in3},{})
ld [out2+280], out4 ! loop counter
sll local4, 4, local1
xor $1, local4, $1
ld [out2+264], local3
srl $1, 16, local4
xor $2, local1, $2
ifelse($9,1,{LDPTR KS3, in4},{})
xor local4, $2, local4
nop !sethi %hi(DES_SPtrans), global1 ! sbox addr
ifelse($9,1,{LDPTR KS2, in3},{})
and local4, local2, local4
nop !or global1, %lo(DES_SPtrans), global1 ! sbox addr
sll local4, 16, local1
xor $2, local4, $2
srl $2, 2, local4
xor $1, local1, $1
sethi %hi(16711680), local5
xor local4, $1, local4
and local4, local3, local4
or local5, 255, local5
sll local4, 2, local2
xor $1, local4, $1
srl $1, 8, local4
xor $2, local2, $2
xor local4, $2, local4
add global1, 768, global4
and local4, local5, local4
add global1, 1024, global5
ld [out2+272], local7
sll local4, 8, local1
xor $2, local4, $2
srl $2, 1, local4
xor $1, local1, $1
ld [$5], out0 ! key 7531
xor local4, $1, local4
add global1, 256, global2
ld [$5+4], out1 ! key 8642
and local4, local7, local4
add global1, 512, global3
sll local4, 1, local1
xor $1, local4, $1
sll $1, 3, local3
xor $2, local1, $2
sll $2, 3, local2
add global1, 1280, local6 ! address sbox 8
srl $1, 29, local4
add global1, 1792, out3 ! address sbox 8
srl $2, 29, local1
or local4, local3, $4
or local2, local1, $3
ifelse($6, 1, {
ld [out2+284], local5 ! 0x0000FC00 used in the rounds
or local2, local1, $3
xor $4, out0, local1
call .des_enc.1
and local1, 252, local1
},{})
ifelse($6, 2, {
ld [out2+284], local5 ! 0x0000FC00 used in the rounds
or local2, local1, $3
xor $4, out0, local1
call .des_dec.1
and local1, 252, local1
},{})
})
! {rounds_macro}
!
! The logic used in the DES rounds is the same as in the C code,
! except that calculations for sbox 1 and sbox 5 begin before
! the previous round is finished.
!
! In each round one half (work) is modified based on key and the
! other half (use).
!
! In this version we do two rounds in a loop repeated 7 times
! and two rounds seperately.
!
! One half has the bits for the sboxes in the following positions:
!
! 777777xx555555xx333333xx111111xx
!
! 88xx666666xx444444xx222222xx8888
!
! The bits for each sbox are xor-ed with the key bits for that box.
! The above xx bits are cleared, and the result used for lookup in
! the sbox table. Each sbox entry contains the 4 output bits permuted
! into 32 bits according to the P permutation.
!
! In the description of DES, left and right are switched after
! each round, except after last round. In this code the original
! left and right are kept in the same register in all rounds, meaning
! that after the 16 rounds the result for right is in the register
! originally used for left.
!
! parameter 1 first work (left in first round)
! parameter 2 first use (right in first round)
! parameter 3 enc/dec 1/-1
! parameter 4 loop label
! parameter 5 key address register
! parameter 6 optional address for key next encryption/decryption
! parameter 7 not empty for include retl
!
! also compares in2 to 8
define(rounds_macro, {
! {rounds_macro}
! $1 $2 $3 $4 $5 $6 $7 $8 $9
xor $2, out0, local1
ld [out2+284], local5 ! 0x0000FC00
ba $4
and local1, 252, local1
.align 32
$4:
! local6 is address sbox 6
! out3 is address sbox 8
! out4 is loop counter
ld [global1+local1], local1
xor $2, out1, out1 ! 8642
xor $2, out0, out0 ! 7531
! fmovs %f0, %f0 ! fxor used for alignment
srl out1, 4, local0 ! rotate 4 right
and out0, local5, local3 ! 3
! fmovs %f0, %f0
ld [$5+$3*8], local7 ! key 7531 next round
srl local3, 8, local3 ! 3
and local0, 252, local2 ! 2
! fmovs %f0, %f0
ld [global3+local3],local3 ! 3
sll out1, 28, out1 ! rotate
xor $1, local1, $1 ! 1 finished, local1 now sbox 7
ld [global2+local2], local2 ! 2
srl out0, 24, local1 ! 7
or out1, local0, out1 ! rotate
ldub [out2+local1], local1 ! 7 (and 0xFC)
srl out1, 24, local0 ! 8
and out1, local5, local4 ! 4
ldub [out2+local0], local0 ! 8 (and 0xFC)
srl local4, 8, local4 ! 4
xor $1, local2, $1 ! 2 finished local2 now sbox 6
ld [global4+local4],local4 ! 4
srl out1, 16, local2 ! 6
xor $1, local3, $1 ! 3 finished local3 now sbox 5
ld [out3+local0],local0 ! 8
and local2, 252, local2 ! 6
add global1, 1536, local5 ! address sbox 7
ld [local6+local2], local2 ! 6
srl out0, 16, local3 ! 5
xor $1, local4, $1 ! 4 finished
ld [local5+local1],local1 ! 7
and local3, 252, local3 ! 5
xor $1, local0, $1 ! 8 finished
ld [global5+local3],local3 ! 5
xor $1, local2, $1 ! 6 finished
subcc out4, 1, out4
ld [$5+$3*8+4], out0 ! key 8642 next round
xor $1, local7, local2 ! sbox 5 next round
xor $1, local1, $1 ! 7 finished
srl local2, 16, local2 ! sbox 5 next round
xor $1, local3, $1 ! 5 finished
ld [$5+$3*16+4], out1 ! key 8642 next round again
and local2, 252, local2 ! sbox5 next round
! next round
xor $1, local7, local7 ! 7531
ld [global5+local2], local2 ! 5
srl local7, 24, local3 ! 7
xor $1, out0, out0 ! 8642
ldub [out2+local3], local3 ! 7 (and 0xFC)
srl out0, 4, local0 ! rotate 4 right
and local7, 252, local1 ! 1
sll out0, 28, out0 ! rotate
xor $2, local2, $2 ! 5 finished local2 used
srl local0, 8, local4 ! 4
and local0, 252, local2 ! 2
ld [local5+local3], local3 ! 7
srl local0, 16, local5 ! 6
or out0, local0, out0 ! rotate
ld [global2+local2], local2 ! 2
srl out0, 24, local0
ld [$5+$3*16], out0 ! key 7531 next round
and local4, 252, local4 ! 4
and local5, 252, local5 ! 6
ld [global4+local4], local4 ! 4
xor $2, local3, $2 ! 7 finished local3 used
and local0, 252, local0 ! 8
ld [local6+local5], local5 ! 6
xor $2, local2, $2 ! 2 finished local2 now sbox 3
srl local7, 8, local2 ! 3 start
ld [out3+local0], local0 ! 8
xor $2, local4, $2 ! 4 finished
and local2, 252, local2 ! 3
ld [global1+local1], local1 ! 1
xor $2, local5, $2 ! 6 finished local5 used
ld [global3+local2], local2 ! 3
xor $2, local0, $2 ! 8 finished
add $5, $3*16, $5 ! enc add 8, dec add -8 to key pointer
ld [out2+284], local5 ! 0x0000FC00
xor $2, out0, local4 ! sbox 1 next round
xor $2, local1, $2 ! 1 finished
xor $2, local2, $2 ! 3 finished
#ifdef OPENSSL_SYSNAME_ULTRASPARC
bne,pt %icc, $4
#else
bne $4
#endif
and local4, 252, local1 ! sbox 1 next round
! two rounds more:
ld [global1+local1], local1
xor $2, out1, out1
xor $2, out0, out0
srl out1, 4, local0 ! rotate
and out0, local5, local3
ld [$5+$3*8], local7 ! key 7531
srl local3, 8, local3
and local0, 252, local2
ld [global3+local3],local3
sll out1, 28, out1 ! rotate
xor $1, local1, $1 ! 1 finished, local1 now sbox 7
ld [global2+local2], local2
srl out0, 24, local1
or out1, local0, out1 ! rotate
ldub [out2+local1], local1
srl out1, 24, local0
and out1, local5, local4
ldub [out2+local0], local0
srl local4, 8, local4
xor $1, local2, $1 ! 2 finished local2 now sbox 6
ld [global4+local4],local4
srl out1, 16, local2
xor $1, local3, $1 ! 3 finished local3 now sbox 5
ld [out3+local0],local0
and local2, 252, local2
add global1, 1536, local5 ! address sbox 7
ld [local6+local2], local2
srl out0, 16, local3
xor $1, local4, $1 ! 4 finished
ld [local5+local1],local1
and local3, 252, local3
xor $1, local0, $1
ld [global5+local3],local3
xor $1, local2, $1 ! 6 finished
cmp in2, 8
ifelse($6,{}, {}, {ld [out2+280], out4}) ! loop counter
xor $1, local7, local2 ! sbox 5 next round
xor $1, local1, $1 ! 7 finished
ld [$5+$3*8+4], out0
srl local2, 16, local2 ! sbox 5 next round
xor $1, local3, $1 ! 5 finished
and local2, 252, local2
! next round (two rounds more)
xor $1, local7, local7 ! 7531
ld [global5+local2], local2
srl local7, 24, local3
xor $1, out0, out0 ! 8642
ldub [out2+local3], local3
srl out0, 4, local0 ! rotate
and local7, 252, local1
sll out0, 28, out0 ! rotate
xor $2, local2, $2 ! 5 finished local2 used
srl local0, 8, local4
and local0, 252, local2
ld [local5+local3], local3
srl local0, 16, local5
or out0, local0, out0 ! rotate
ld [global2+local2], local2
srl out0, 24, local0
ifelse($6,{}, {}, {ld [$6], out0}) ! key next encryption/decryption
and local4, 252, local4
and local5, 252, local5
ld [global4+local4], local4
xor $2, local3, $2 ! 7 finished local3 used
and local0, 252, local0
ld [local6+local5], local5
xor $2, local2, $2 ! 2 finished local2 now sbox 3
srl local7, 8, local2 ! 3 start
ld [out3+local0], local0
xor $2, local4, $2
and local2, 252, local2
ld [global1+local1], local1
xor $2, local5, $2 ! 6 finished local5 used
ld [global3+local2], local2
srl $1, 3, local3
xor $2, local0, $2
ifelse($6,{}, {}, {ld [$6+4], out1}) ! key next encryption/decryption
sll $1, 29, local4
xor $2, local1, $2
ifelse($7,{}, {}, {retl})
xor $2, local2, $2
})
! {fp_macro}
!
! parameter 1 right (original left)
! parameter 2 left (original right)
! parameter 3 1 for optional store to [in0]
! parameter 4 1 for load input/output address to local5/7
!
! The final permutation logic switches the halfes, meaning that
! left and right ends up the the registers originally used.
define(fp_macro, {
! {fp_macro}
! $1 $2 $3 $4 $5 $6 $7 $8 $9
! initially undo the rotate 3 left done after initial permutation
! original left is received shifted 3 right and 29 left in local3/4
sll $2, 29, local1
or local3, local4, $1
srl $2, 3, $2
sethi %hi(0x55555555), local2
or $2, local1, $2
or local2, %lo(0x55555555), local2
srl $2, 1, local3
sethi %hi(0x00ff00ff), local1
xor local3, $1, local3
or local1, %lo(0x00ff00ff), local1
and local3, local2, local3
sethi %hi(0x33333333), local4
sll local3, 1, local2
xor $1, local3, $1
srl $1, 8, local3
xor $2, local2, $2
xor local3, $2, local3
or local4, %lo(0x33333333), local4
and local3, local1, local3
sethi %hi(0x0000ffff), local1
sll local3, 8, local2
xor $2, local3, $2
srl $2, 2, local3
xor $1, local2, $1
xor local3, $1, local3
or local1, %lo(0x0000ffff), local1
and local3, local4, local3
sethi %hi(0x0f0f0f0f), local4
sll local3, 2, local2
ifelse($4,1, {LDPTR INPUT, local5})
xor $1, local3, $1
ifelse($4,1, {LDPTR OUTPUT, local7})
srl $1, 16, local3
xor $2, local2, $2
xor local3, $2, local3
or local4, %lo(0x0f0f0f0f), local4
and local3, local1, local3
sll local3, 16, local2
xor $2, local3, local1
srl local1, 4, local3
xor $1, local2, $1
xor local3, $1, local3
and local3, local4, local3
sll local3, 4, local2
xor $1, local3, $1
! optional store:
ifelse($3,1, {st $1, [in0]})
xor local1, local2, $2
ifelse($3,1, {st $2, [in0+4]})
})
! {fp_ip_macro}
!
! Does initial permutation for next block mixed with
! final permutation for current block.
!
! parameter 1 original left
! parameter 2 original right
! parameter 3 left ip
! parameter 4 right ip
! parameter 5 1: load ks1/ks2 to in3/in4, add 120 to in4
! 2: mov in4 to in3
!
! also adds -8 to length in2 and loads loop counter to out4
define(fp_ip_macro, {
! {fp_ip_macro}
! $1 $2 $3 $4 $5 $6 $7 $8 $9
define({temp1},{out4})
define({temp2},{local3})
define({ip1},{local1})
define({ip2},{local2})
define({ip4},{local4})
define({ip5},{local5})
! $1 in local3, local4
ld [out2+256], ip1
sll out5, 29, temp1
or local3, local4, $1
srl out5, 3, $2
ifelse($5,2,{mov in4, in3})
ld [out2+272], ip5
srl $4, 4, local0
or $2, temp1, $2
srl $2, 1, temp1
xor temp1, $1, temp1
and temp1, ip5, temp1
xor local0, $3, local0
sll temp1, 1, temp2
xor $1, temp1, $1
and local0, ip1, local0
add in2, -8, in2
sll local0, 4, local7
xor $3, local0, $3
ld [out2+268], ip4
srl $1, 8, temp1
xor $2, temp2, $2
ld [out2+260], ip2
srl $3, 16, local0
xor $4, local7, $4
xor temp1, $2, temp1
xor local0, $4, local0
and temp1, ip4, temp1
and local0, ip2, local0
sll temp1, 8, temp2
xor $2, temp1, $2
sll local0, 16, local7
xor $4, local0, $4
srl $2, 2, temp1
xor $1, temp2, $1
ld [out2+264], temp2 ! ip3
srl $4, 2, local0
xor $3, local7, $3
xor temp1, $1, temp1
xor local0, $3, local0
and temp1, temp2, temp1
and local0, temp2, local0
sll temp1, 2, temp2
xor $1, temp1, $1
sll local0, 2, local7
xor $3, local0, $3
srl $1, 16, temp1
xor $2, temp2, $2
srl $3, 8, local0
xor $4, local7, $4
xor temp1, $2, temp1
xor local0, $4, local0
and temp1, ip2, temp1
and local0, ip4, local0
sll temp1, 16, temp2
xor $2, temp1, local4
sll local0, 8, local7
xor $4, local0, $4
srl $4, 1, local0
xor $3, local7, $3
srl local4, 4, temp1
xor local0, $3, local0
xor $1, temp2, $1
and local0, ip5, local0
sll local0, 1, local7
xor temp1, $1, temp1
xor $3, local0, $3
xor $4, local7, $4
sll $3, 3, local5
and temp1, ip1, temp1
sll temp1, 4, temp2
xor $1, temp1, $1
ifelse($5,1,{LDPTR KS2, in4})
sll $4, 3, local2
xor local4, temp2, $2
! reload since used as temporar:
ld [out2+280], out4 ! loop counter
srl $3, 29, local0
ifelse($5,1,{add in4, 120, in4})
ifelse($5,1,{LDPTR KS1, in3})
srl $4, 29, local7
or local0, local5, $4
or local2, local7, $3
})
! {load_little_endian}
!
! parameter 1 address
! parameter 2 destination left
! parameter 3 destination right
! parameter 4 temporar
! parameter 5 label
define(load_little_endian, {
! {load_little_endian}
! $1 $2 $3 $4 $5 $6 $7 $8 $9
! first in memory to rightmost in register
#ifdef OPENSSL_SYSNAME_ULTRASPARC
andcc $1, 3, global0
bne,pn %icc, $5
nop
lda [$1] 0x88, $2
add $1, 4, $4
ba,pt %icc, $5a
lda [$4] 0x88, $3
#endif
$5:
ldub [$1+3], $2
ldub [$1+2], $4
sll $2, 8, $2
or $2, $4, $2
ldub [$1+1], $4
sll $2, 8, $2
or $2, $4, $2
ldub [$1+0], $4
sll $2, 8, $2
or $2, $4, $2
ldub [$1+3+4], $3
ldub [$1+2+4], $4
sll $3, 8, $3
or $3, $4, $3
ldub [$1+1+4], $4
sll $3, 8, $3
or $3, $4, $3
ldub [$1+0+4], $4
sll $3, 8, $3
or $3, $4, $3
$5a:
})
! {load_little_endian_inc}
!
! parameter 1 address
! parameter 2 destination left
! parameter 3 destination right
! parameter 4 temporar
! parameter 4 label
!
! adds 8 to address
define(load_little_endian_inc, {
! {load_little_endian_inc}
! $1 $2 $3 $4 $5 $6 $7 $8 $9
! first in memory to rightmost in register
#ifdef OPENSSL_SYSNAME_ULTRASPARC
andcc $1, 3, global0
bne,pn %icc, $5
nop
lda [$1] 0x88, $2
add $1, 4, $1
lda [$1] 0x88, $3
ba,pt %icc, $5a
add $1, 4, $1
#endif
$5:
ldub [$1+3], $2
ldub [$1+2], $4
sll $2, 8, $2
or $2, $4, $2
ldub [$1+1], $4
sll $2, 8, $2
or $2, $4, $2
ldub [$1+0], $4
sll $2, 8, $2
or $2, $4, $2
ldub [$1+3+4], $3
add $1, 8, $1
ldub [$1+2+4-8], $4
sll $3, 8, $3
or $3, $4, $3
ldub [$1+1+4-8], $4
sll $3, 8, $3
or $3, $4, $3
ldub [$1+0+4-8], $4
sll $3, 8, $3
or $3, $4, $3
$5a:
})
! {load_n_bytes}
!
! Loads 1 to 7 bytes little endian
! Remaining bytes are zeroed.
!
! parameter 1 address
! parameter 2 length
! parameter 3 destination register left
! parameter 4 destination register right
! parameter 5 temp
! parameter 6 temp2
! parameter 7 label
! parameter 8 return label
define(load_n_bytes, {
! {load_n_bytes}
! $1 $2 $5 $6 $7 $8 $7 $8 $9
$7.0: call .+8
sll $2, 2, $6
add %o7,$7.jmp.table-$7.0,$5
add $5, $6, $5
mov 0, $4
ld [$5], $5
jmp %o7+$5
mov 0, $3
$7.7:
ldub [$1+6], $5
sll $5, 16, $5
or $3, $5, $3
$7.6:
ldub [$1+5], $5
sll $5, 8, $5
or $3, $5, $3
$7.5:
ldub [$1+4], $5
or $3, $5, $3
$7.4:
ldub [$1+3], $5
sll $5, 24, $5
or $4, $5, $4
$7.3:
ldub [$1+2], $5
sll $5, 16, $5
or $4, $5, $4
$7.2:
ldub [$1+1], $5
sll $5, 8, $5
or $4, $5, $4
$7.1:
ldub [$1+0], $5
ba $8
or $4, $5, $4
.align 4
$7.jmp.table:
.word 0
.word $7.1-$7.0
.word $7.2-$7.0
.word $7.3-$7.0
.word $7.4-$7.0
.word $7.5-$7.0
.word $7.6-$7.0
.word $7.7-$7.0
})
! {store_little_endian}
!
! parameter 1 address
! parameter 2 source left
! parameter 3 source right
! parameter 4 temporar
define(store_little_endian, {
! {store_little_endian}
! $1 $2 $3 $4 $5 $6 $7 $8 $9
! rightmost in register to first in memory
#ifdef OPENSSL_SYSNAME_ULTRASPARC
andcc $1, 3, global0
bne,pn %icc, $5
nop
sta $2, [$1] 0x88
add $1, 4, $4
ba,pt %icc, $5a
sta $3, [$4] 0x88
#endif
$5:
and $2, 255, $4
stub $4, [$1+0]
srl $2, 8, $4
and $4, 255, $4
stub $4, [$1+1]
srl $2, 16, $4
and $4, 255, $4
stub $4, [$1+2]
srl $2, 24, $4
stub $4, [$1+3]
and $3, 255, $4
stub $4, [$1+0+4]
srl $3, 8, $4
and $4, 255, $4
stub $4, [$1+1+4]
srl $3, 16, $4
and $4, 255, $4
stub $4, [$1+2+4]
srl $3, 24, $4
stub $4, [$1+3+4]
$5a:
})
! {store_n_bytes}
!
! Stores 1 to 7 bytes little endian
!
! parameter 1 address
! parameter 2 length
! parameter 3 source register left
! parameter 4 source register right
! parameter 5 temp
! parameter 6 temp2
! parameter 7 label
! parameter 8 return label
define(store_n_bytes, {
! {store_n_bytes}
! $1 $2 $5 $6 $7 $8 $7 $8 $9
$7.0: call .+8
sll $2, 2, $6
add %o7,$7.jmp.table-$7.0,$5
add $5, $6, $5
ld [$5], $5
jmp %o7+$5
nop
$7.7:
srl $3, 16, $5
and $5, 0xff, $5
stub $5, [$1+6]
$7.6:
srl $3, 8, $5
and $5, 0xff, $5
stub $5, [$1+5]
$7.5:
and $3, 0xff, $5
stub $5, [$1+4]
$7.4:
srl $4, 24, $5
stub $5, [$1+3]
$7.3:
srl $4, 16, $5
and $5, 0xff, $5
stub $5, [$1+2]
$7.2:
srl $4, 8, $5
and $5, 0xff, $5
stub $5, [$1+1]
$7.1:
and $4, 0xff, $5
ba $8
stub $5, [$1]
.align 4
$7.jmp.table:
.word 0
.word $7.1-$7.0
.word $7.2-$7.0
.word $7.3-$7.0
.word $7.4-$7.0
.word $7.5-$7.0
.word $7.6-$7.0
.word $7.7-$7.0
})
define(testvalue,{1})
define(register_init, {
! For test purposes:
sethi %hi(testvalue), local0
or local0, %lo(testvalue), local0
ifelse($1,{},{}, {mov local0, $1})
ifelse($2,{},{}, {mov local0, $2})
ifelse($3,{},{}, {mov local0, $3})
ifelse($4,{},{}, {mov local0, $4})
ifelse($5,{},{}, {mov local0, $5})
ifelse($6,{},{}, {mov local0, $6})
ifelse($7,{},{}, {mov local0, $7})
ifelse($8,{},{}, {mov local0, $8})
mov local0, local1
mov local0, local2
mov local0, local3
mov local0, local4
mov local0, local5
mov local0, local7
mov local0, local6
mov local0, out0
mov local0, out1
mov local0, out2
mov local0, out3
mov local0, out4
mov local0, out5
mov local0, global1
mov local0, global2
mov local0, global3
mov local0, global4
mov local0, global5
})
.section ".text"
.align 32
.des_enc:
! key address in3
! loads key next encryption/decryption first round from [in4]
rounds_macro(in5, out5, 1, .des_enc.1, in3, in4, retl)
.align 32
.des_dec:
! implemented with out5 as first parameter to avoid
! register exchange in ede modes
! key address in4
! loads key next encryption/decryption first round from [in3]
rounds_macro(out5, in5, -1, .des_dec.1, in4, in3, retl)
! void DES_encrypt1(data, ks, enc)
! *******************************
.align 32
.global DES_encrypt1
.type DES_encrypt1,#function
DES_encrypt1:
save %sp, FRAME, %sp
sethi %hi(.PIC.DES_SPtrans-1f),global1
or global1,%lo(.PIC.DES_SPtrans-1f),global1
1: call .+8
add %o7,global1,global1
sub global1,.PIC.DES_SPtrans-.des_and,out2
ld [in0], in5 ! left
cmp in2, 0 ! enc
#ifdef OPENSSL_SYSNAME_ULTRASPARC
be,pn %icc, .encrypt.dec ! enc/dec
#else
be .encrypt.dec
#endif
ld [in0+4], out5 ! right
! parameter 6 1/2 for include encryption/decryption
! parameter 7 1 for move in1 to in3
! parameter 8 1 for move in3 to in4, 2 for move in4 to in3
ip_macro(in5, out5, in5, out5, in3, 0, 1, 1)
rounds_macro(in5, out5, 1, .des_encrypt1.1, in3, in4) ! in4 not used
fp_macro(in5, out5, 1) ! 1 for store to [in0]
ret
restore
.encrypt.dec:
add in1, 120, in3 ! use last subkey for first round
! parameter 6 1/2 for include encryption/decryption
! parameter 7 1 for move in1 to in3
! parameter 8 1 for move in3 to in4, 2 for move in4 to in3
ip_macro(in5, out5, out5, in5, in4, 2, 0, 1) ! include dec, ks in4
fp_macro(out5, in5, 1) ! 1 for store to [in0]
ret
restore
.DES_encrypt1.end:
.size DES_encrypt1,.DES_encrypt1.end-DES_encrypt1
! void DES_encrypt2(data, ks, enc)
!*********************************
! encrypts/decrypts without initial/final permutation
.align 32
.global DES_encrypt2
.type DES_encrypt2,#function
DES_encrypt2:
save %sp, FRAME, %sp
sethi %hi(.PIC.DES_SPtrans-1f),global1
or global1,%lo(.PIC.DES_SPtrans-1f),global1
1: call .+8
add %o7,global1,global1
sub global1,.PIC.DES_SPtrans-.des_and,out2
! Set sbox address 1 to 6 and rotate halfs 3 left
! Errors caught by destest? Yes. Still? *NO*
!sethi %hi(DES_SPtrans), global1 ! address sbox 1
!or global1, %lo(DES_SPtrans), global1 ! sbox 1
add global1, 256, global2 ! sbox 2
add global1, 512, global3 ! sbox 3
ld [in0], out5 ! right
add global1, 768, global4 ! sbox 4
add global1, 1024, global5 ! sbox 5
ld [in0+4], in5 ! left
add global1, 1280, local6 ! sbox 6
add global1, 1792, out3 ! sbox 8
! rotate
sll in5, 3, local5
mov in1, in3 ! key address to in3
sll out5, 3, local7
srl in5, 29, in5
srl out5, 29, out5
add in5, local5, in5
add out5, local7, out5
cmp in2, 0
! we use our own stackframe
#ifdef OPENSSL_SYSNAME_ULTRASPARC
be,pn %icc, .encrypt2.dec ! decryption
#else
be .encrypt2.dec
#endif
STPTR in0, [%sp+BIAS+ARG0+0*ARGSZ]
ld [in3], out0 ! key 7531 first round
mov LOOPS, out4 ! loop counter
ld [in3+4], out1 ! key 8642 first round
sethi %hi(0x0000FC00), local5
call .des_enc
mov in3, in4
! rotate
sll in5, 29, in0
srl in5, 3, in5
sll out5, 29, in1
add in5, in0, in5
srl out5, 3, out5
LDPTR [%sp+BIAS+ARG0+0*ARGSZ], in0
add out5, in1, out5
st in5, [in0]
st out5, [in0+4]
ret
restore
.encrypt2.dec:
add in3, 120, in4
ld [in4], out0 ! key 7531 first round
mov LOOPS, out4 ! loop counter
ld [in4+4], out1 ! key 8642 first round
sethi %hi(0x0000FC00), local5
mov in5, local1 ! left expected in out5
mov out5, in5
call .des_dec
mov local1, out5
.encrypt2.finish:
! rotate
sll in5, 29, in0
srl in5, 3, in5
sll out5, 29, in1
add in5, in0, in5
srl out5, 3, out5
LDPTR [%sp+BIAS+ARG0+0*ARGSZ], in0
add out5, in1, out5
st out5, [in0]
st in5, [in0+4]
ret
restore
.DES_encrypt2.end:
.size DES_encrypt2, .DES_encrypt2.end-DES_encrypt2
! void DES_encrypt3(data, ks1, ks2, ks3)
! **************************************
.align 32
.global DES_encrypt3
.type DES_encrypt3,#function
DES_encrypt3:
save %sp, FRAME, %sp
sethi %hi(.PIC.DES_SPtrans-1f),global1
or global1,%lo(.PIC.DES_SPtrans-1f),global1
1: call .+8
add %o7,global1,global1
sub global1,.PIC.DES_SPtrans-.des_and,out2
ld [in0], in5 ! left
add in2, 120, in4 ! ks2
ld [in0+4], out5 ! right
mov in3, in2 ! save ks3
! parameter 6 1/2 for include encryption/decryption
! parameter 7 1 for mov in1 to in3
! parameter 8 1 for mov in3 to in4
! parameter 9 1 for load ks3 and ks2 to in4 and in3
ip_macro(in5, out5, in5, out5, in3, 1, 1, 0, 0)
call .des_dec
mov in2, in3 ! preload ks3
call .des_enc
nop
fp_macro(in5, out5, 1)
ret
restore
.DES_encrypt3.end:
.size DES_encrypt3,.DES_encrypt3.end-DES_encrypt3
! void DES_decrypt3(data, ks1, ks2, ks3)
! **************************************
.align 32
.global DES_decrypt3
.type DES_decrypt3,#function
DES_decrypt3:
save %sp, FRAME, %sp
sethi %hi(.PIC.DES_SPtrans-1f),global1
or global1,%lo(.PIC.DES_SPtrans-1f),global1
1: call .+8
add %o7,global1,global1
sub global1,.PIC.DES_SPtrans-.des_and,out2
ld [in0], in5 ! left
add in3, 120, in4 ! ks3
ld [in0+4], out5 ! right
mov in2, in3 ! ks2
! parameter 6 1/2 for include encryption/decryption
! parameter 7 1 for mov in1 to in3
! parameter 8 1 for mov in3 to in4
! parameter 9 1 for load ks3 and ks2 to in4 and in3
ip_macro(in5, out5, out5, in5, in4, 2, 0, 0, 0)
call .des_enc
add in1, 120, in4 ! preload ks1
call .des_dec
nop
fp_macro(out5, in5, 1)
ret
restore
.DES_decrypt3.end:
.size DES_decrypt3,.DES_decrypt3.end-DES_decrypt3
! void DES_ncbc_encrypt(input, output, length, schedule, ivec, enc)
! *****************************************************************
.align 32
.global DES_ncbc_encrypt
.type DES_ncbc_encrypt,#function
DES_ncbc_encrypt:
save %sp, FRAME, %sp
define({INPUT}, { [%sp+BIAS+ARG0+0*ARGSZ] })
define({OUTPUT}, { [%sp+BIAS+ARG0+1*ARGSZ] })
define({IVEC}, { [%sp+BIAS+ARG0+4*ARGSZ] })
sethi %hi(.PIC.DES_SPtrans-1f),global1
or global1,%lo(.PIC.DES_SPtrans-1f),global1
1: call .+8
add %o7,global1,global1
sub global1,.PIC.DES_SPtrans-.des_and,out2
cmp in5, 0 ! enc
#ifdef OPENSSL_SYSNAME_ULTRASPARC
be,pn %icc, .ncbc.dec
#else
be .ncbc.dec
#endif
STPTR in4, IVEC
! addr left right temp label
load_little_endian(in4, in5, out5, local3, .LLE1) ! iv
addcc in2, -8, in2 ! bytes missing when first block done
#ifdef OPENSSL_SYSNAME_ULTRASPARC
bl,pn %icc, .ncbc.enc.seven.or.less
#else
bl .ncbc.enc.seven.or.less
#endif
mov in3, in4 ! schedule
.ncbc.enc.next.block:
load_little_endian(in0, out4, global4, local3, .LLE2) ! block
.ncbc.enc.next.block_1:
xor in5, out4, in5 ! iv xor
xor out5, global4, out5 ! iv xor
! parameter 8 1 for move in3 to in4, 2 for move in4 to in3
ip_macro(in5, out5, in5, out5, in3, 0, 0, 2)
.ncbc.enc.next.block_2:
!// call .des_enc ! compares in2 to 8
! rounds inlined for alignment purposes
add global1, 768, global4 ! address sbox 4 since register used below
rounds_macro(in5, out5, 1, .ncbc.enc.1, in3, in4) ! include encryption ks in3
#ifdef OPENSSL_SYSNAME_ULTRASPARC
bl,pn %icc, .ncbc.enc.next.block_fp
#else
bl .ncbc.enc.next.block_fp
#endif
add in0, 8, in0 ! input address
! If 8 or more bytes are to be encrypted after this block,
! we combine final permutation for this block with initial
! permutation for next block. Load next block:
load_little_endian(in0, global3, global4, local5, .LLE12)
! parameter 1 original left
! parameter 2 original right
! parameter 3 left ip
! parameter 4 right ip
! parameter 5 1: load ks1/ks2 to in3/in4, add 120 to in4
! 2: mov in4 to in3
!
! also adds -8 to length in2 and loads loop counter to out4
fp_ip_macro(out0, out1, global3, global4, 2)
store_little_endian(in1, out0, out1, local3, .SLE10) ! block
ld [in3], out0 ! key 7531 first round next block
mov in5, local1
xor global3, out5, in5 ! iv xor next block
ld [in3+4], out1 ! key 8642
add global1, 512, global3 ! address sbox 3 since register used
xor global4, local1, out5 ! iv xor next block
ba .ncbc.enc.next.block_2
add in1, 8, in1 ! output adress
.ncbc.enc.next.block_fp:
fp_macro(in5, out5)
store_little_endian(in1, in5, out5, local3, .SLE1) ! block
addcc in2, -8, in2 ! bytes missing when next block done
#ifdef OPENSSL_SYSNAME_ULTRASPARC
bpos,pt %icc, .ncbc.enc.next.block ! also jumps if 0
#else
bpos .ncbc.enc.next.block
#endif
add in1, 8, in1
.ncbc.enc.seven.or.less:
cmp in2, -8
#ifdef OPENSSL_SYSNAME_ULTRASPARC
ble,pt %icc, .ncbc.enc.finish
#else
ble .ncbc.enc.finish
#endif
nop
add in2, 8, local1 ! bytes to load
! addr, length, dest left, dest right, temp, temp2, label, ret label
load_n_bytes(in0, local1, global4, out4, local2, local3, .LNB1, .ncbc.enc.next.block_1)
! Loads 1 to 7 bytes little endian to global4, out4
.ncbc.enc.finish:
LDPTR IVEC, local4
store_little_endian(local4, in5, out5, local5, .SLE2) ! ivec
ret
restore
.ncbc.dec:
STPTR in0, INPUT
cmp in2, 0 ! length
add in3, 120, in3
LDPTR IVEC, local7 ! ivec
#ifdef OPENSSL_SYSNAME_ULTRASPARC
ble,pn %icc, .ncbc.dec.finish
#else
ble .ncbc.dec.finish
#endif
mov in3, in4 ! schedule
STPTR in1, OUTPUT
mov in0, local5 ! input
load_little_endian(local7, in0, in1, local3, .LLE3) ! ivec
.ncbc.dec.next.block:
load_little_endian(local5, in5, out5, local3, .LLE4) ! block
! parameter 6 1/2 for include encryption/decryption
! parameter 7 1 for mov in1 to in3
! parameter 8 1 for mov in3 to in4
ip_macro(in5, out5, out5, in5, in4, 2, 0, 1) ! include decryprion ks in4
fp_macro(out5, in5, 0, 1) ! 1 for input and output address to local5/7
! in2 is bytes left to be stored
! in2 is compared to 8 in the rounds
xor out5, in0, out4 ! iv xor
#ifdef OPENSSL_SYSNAME_ULTRASPARC
bl,pn %icc, .ncbc.dec.seven.or.less
#else
bl .ncbc.dec.seven.or.less
#endif
xor in5, in1, global4 ! iv xor
! Load ivec next block now, since input and output address might be the same.
load_little_endian_inc(local5, in0, in1, local3, .LLE5) ! iv
store_little_endian(local7, out4, global4, local3, .SLE3)
STPTR local5, INPUT
add local7, 8, local7
addcc in2, -8, in2
#ifdef OPENSSL_SYSNAME_ULTRASPARC
bg,pt %icc, .ncbc.dec.next.block
#else
bg .ncbc.dec.next.block
#endif
STPTR local7, OUTPUT
.ncbc.dec.store.iv:
LDPTR IVEC, local4 ! ivec
store_little_endian(local4, in0, in1, local5, .SLE4)
.ncbc.dec.finish:
ret
restore
.ncbc.dec.seven.or.less:
load_little_endian_inc(local5, in0, in1, local3, .LLE13) ! ivec
store_n_bytes(local7, in2, global4, out4, local3, local4, .SNB1, .ncbc.dec.store.iv)
.DES_ncbc_encrypt.end:
.size DES_ncbc_encrypt, .DES_ncbc_encrypt.end-DES_ncbc_encrypt
! void DES_ede3_cbc_encrypt(input, output, lenght, ks1, ks2, ks3, ivec, enc)
! **************************************************************************
.align 32
.global DES_ede3_cbc_encrypt
.type DES_ede3_cbc_encrypt,#function
DES_ede3_cbc_encrypt:
save %sp, FRAME, %sp
define({KS1}, { [%sp+BIAS+ARG0+3*ARGSZ] })
define({KS2}, { [%sp+BIAS+ARG0+4*ARGSZ] })
define({KS3}, { [%sp+BIAS+ARG0+5*ARGSZ] })
sethi %hi(.PIC.DES_SPtrans-1f),global1
or global1,%lo(.PIC.DES_SPtrans-1f),global1
1: call .+8
add %o7,global1,global1
sub global1,.PIC.DES_SPtrans-.des_and,out2
LDPTR [%fp+BIAS+ARG0+7*ARGSZ], local3 ! enc
LDPTR [%fp+BIAS+ARG0+6*ARGSZ], local4 ! ivec
cmp local3, 0 ! enc
#ifdef OPENSSL_SYSNAME_ULTRASPARC
be,pn %icc, .ede3.dec
#else
be .ede3.dec
#endif
STPTR in4, KS2
STPTR in5, KS3
load_little_endian(local4, in5, out5, local3, .LLE6) ! ivec
addcc in2, -8, in2 ! bytes missing after next block
#ifdef OPENSSL_SYSNAME_ULTRASPARC
bl,pn %icc, .ede3.enc.seven.or.less
#else
bl .ede3.enc.seven.or.less
#endif
STPTR in3, KS1
.ede3.enc.next.block:
load_little_endian(in0, out4, global4, local3, .LLE7)
.ede3.enc.next.block_1:
LDPTR KS2, in4
xor in5, out4, in5 ! iv xor
xor out5, global4, out5 ! iv xor
LDPTR KS1, in3
add in4, 120, in4 ! for decryption we use last subkey first
nop
ip_macro(in5, out5, in5, out5, in3)
.ede3.enc.next.block_2:
call .des_enc ! ks1 in3
nop
call .des_dec ! ks2 in4
LDPTR KS3, in3
call .des_enc ! ks3 in3 compares in2 to 8
nop
#ifdef OPENSSL_SYSNAME_ULTRASPARC
bl,pn %icc, .ede3.enc.next.block_fp
#else
bl .ede3.enc.next.block_fp
#endif
add in0, 8, in0
! If 8 or more bytes are to be encrypted after this block,
! we combine final permutation for this block with initial
! permutation for next block. Load next block:
load_little_endian(in0, global3, global4, local5, .LLE11)
! parameter 1 original left
! parameter 2 original right
! parameter 3 left ip
! parameter 4 right ip
! parameter 5 1: load ks1/ks2 to in3/in4, add 120 to in4
! 2: mov in4 to in3
!
! also adds -8 to length in2 and loads loop counter to out4
fp_ip_macro(out0, out1, global3, global4, 1)
store_little_endian(in1, out0, out1, local3, .SLE9) ! block
mov in5, local1
xor global3, out5, in5 ! iv xor next block
ld [in3], out0 ! key 7531
add global1, 512, global3 ! address sbox 3
xor global4, local1, out5 ! iv xor next block
ld [in3+4], out1 ! key 8642
add global1, 768, global4 ! address sbox 4
ba .ede3.enc.next.block_2
add in1, 8, in1
.ede3.enc.next.block_fp:
fp_macro(in5, out5)
store_little_endian(in1, in5, out5, local3, .SLE5) ! block
addcc in2, -8, in2 ! bytes missing when next block done
#ifdef OPENSSL_SYSNAME_ULTRASPARC
bpos,pt %icc, .ede3.enc.next.block
#else
bpos .ede3.enc.next.block
#endif
add in1, 8, in1
.ede3.enc.seven.or.less:
cmp in2, -8
#ifdef OPENSSL_SYSNAME_ULTRASPARC
ble,pt %icc, .ede3.enc.finish
#else
ble .ede3.enc.finish
#endif
nop
add in2, 8, local1 ! bytes to load
! addr, length, dest left, dest right, temp, temp2, label, ret label
load_n_bytes(in0, local1, global4, out4, local2, local3, .LNB2, .ede3.enc.next.block_1)
.ede3.enc.finish:
LDPTR [%fp+BIAS+ARG0+6*ARGSZ], local4 ! ivec
store_little_endian(local4, in5, out5, local5, .SLE6) ! ivec
ret
restore
.ede3.dec:
STPTR in0, INPUT
add in5, 120, in5
STPTR in1, OUTPUT
mov in0, local5
add in3, 120, in3
STPTR in3, KS1
cmp in2, 0
#ifdef OPENSSL_SYSNAME_ULTRASPARC
ble %icc, .ede3.dec.finish
#else
ble .ede3.dec.finish
#endif
STPTR in5, KS3
LDPTR [%fp+BIAS+ARG0+6*ARGSZ], local7 ! iv
load_little_endian(local7, in0, in1, local3, .LLE8)
.ede3.dec.next.block:
load_little_endian(local5, in5, out5, local3, .LLE9)
! parameter 6 1/2 for include encryption/decryption
! parameter 7 1 for mov in1 to in3
! parameter 8 1 for mov in3 to in4
! parameter 9 1 for load ks3 and ks2 to in4 and in3
ip_macro(in5, out5, out5, in5, in4, 2, 0, 0, 1) ! inc .des_dec ks3 in4
call .des_enc ! ks2 in3
LDPTR KS1, in4
call .des_dec ! ks1 in4
nop
fp_macro(out5, in5, 0, 1) ! 1 for input and output address local5/7
! in2 is bytes left to be stored
! in2 is compared to 8 in the rounds
xor out5, in0, out4
#ifdef OPENSSL_SYSNAME_ULTRASPARC
bl,pn %icc, .ede3.dec.seven.or.less
#else
bl .ede3.dec.seven.or.less
#endif
xor in5, in1, global4
load_little_endian_inc(local5, in0, in1, local3, .LLE10) ! iv next block
store_little_endian(local7, out4, global4, local3, .SLE7) ! block
STPTR local5, INPUT
addcc in2, -8, in2
add local7, 8, local7
#ifdef OPENSSL_SYSNAME_ULTRASPARC
bg,pt %icc, .ede3.dec.next.block
#else
bg .ede3.dec.next.block
#endif
STPTR local7, OUTPUT
.ede3.dec.store.iv:
LDPTR [%fp+BIAS+ARG0+6*ARGSZ], local4 ! ivec
store_little_endian(local4, in0, in1, local5, .SLE8) ! ivec
.ede3.dec.finish:
ret
restore
.ede3.dec.seven.or.less:
load_little_endian_inc(local5, in0, in1, local3, .LLE14) ! iv
store_n_bytes(local7, in2, global4, out4, local3, local4, .SNB2, .ede3.dec.store.iv)
.DES_ede3_cbc_encrypt.end:
.size DES_ede3_cbc_encrypt,.DES_ede3_cbc_encrypt.end-DES_ede3_cbc_encrypt
.align 256
.type .des_and,#object
.size .des_and,284
.des_and:
! This table is used for AND 0xFC when it is known that register
! bits 8-31 are zero. Makes it possible to do three arithmetic
! operations in one cycle.
.byte 0, 0, 0, 0, 4, 4, 4, 4
.byte 8, 8, 8, 8, 12, 12, 12, 12
.byte 16, 16, 16, 16, 20, 20, 20, 20
.byte 24, 24, 24, 24, 28, 28, 28, 28
.byte 32, 32, 32, 32, 36, 36, 36, 36
.byte 40, 40, 40, 40, 44, 44, 44, 44
.byte 48, 48, 48, 48, 52, 52, 52, 52
.byte 56, 56, 56, 56, 60, 60, 60, 60
.byte 64, 64, 64, 64, 68, 68, 68, 68
.byte 72, 72, 72, 72, 76, 76, 76, 76
.byte 80, 80, 80, 80, 84, 84, 84, 84
.byte 88, 88, 88, 88, 92, 92, 92, 92
.byte 96, 96, 96, 96, 100, 100, 100, 100
.byte 104, 104, 104, 104, 108, 108, 108, 108
.byte 112, 112, 112, 112, 116, 116, 116, 116
.byte 120, 120, 120, 120, 124, 124, 124, 124
.byte 128, 128, 128, 128, 132, 132, 132, 132
.byte 136, 136, 136, 136, 140, 140, 140, 140
.byte 144, 144, 144, 144, 148, 148, 148, 148
.byte 152, 152, 152, 152, 156, 156, 156, 156
.byte 160, 160, 160, 160, 164, 164, 164, 164
.byte 168, 168, 168, 168, 172, 172, 172, 172
.byte 176, 176, 176, 176, 180, 180, 180, 180
.byte 184, 184, 184, 184, 188, 188, 188, 188
.byte 192, 192, 192, 192, 196, 196, 196, 196
.byte 200, 200, 200, 200, 204, 204, 204, 204
.byte 208, 208, 208, 208, 212, 212, 212, 212
.byte 216, 216, 216, 216, 220, 220, 220, 220
.byte 224, 224, 224, 224, 228, 228, 228, 228
.byte 232, 232, 232, 232, 236, 236, 236, 236
.byte 240, 240, 240, 240, 244, 244, 244, 244
.byte 248, 248, 248, 248, 252, 252, 252, 252
! 5 numbers for initil/final permutation
.word 0x0f0f0f0f ! offset 256
.word 0x0000ffff ! 260
.word 0x33333333 ! 264
.word 0x00ff00ff ! 268
.word 0x55555555 ! 272
.word 0 ! 276
.word LOOPS ! 280
.word 0x0000FC00 ! 284
.type .PIC.DES_SPtrans,#object
.size .PIC.DES_SPtrans,2048
.align 64
.PIC.DES_SPtrans:
! nibble 0
.word 0x02080800, 0x00080000, 0x02000002, 0x02080802
.word 0x02000000, 0x00080802, 0x00080002, 0x02000002
.word 0x00080802, 0x02080800, 0x02080000, 0x00000802
.word 0x02000802, 0x02000000, 0x00000000, 0x00080002
.word 0x00080000, 0x00000002, 0x02000800, 0x00080800
.word 0x02080802, 0x02080000, 0x00000802, 0x02000800
.word 0x00000002, 0x00000800, 0x00080800, 0x02080002
.word 0x00000800, 0x02000802, 0x02080002, 0x00000000
.word 0x00000000, 0x02080802, 0x02000800, 0x00080002
.word 0x02080800, 0x00080000, 0x00000802, 0x02000800
.word 0x02080002, 0x00000800, 0x00080800, 0x02000002
.word 0x00080802, 0x00000002, 0x02000002, 0x02080000
.word 0x02080802, 0x00080800, 0x02080000, 0x02000802
.word 0x02000000, 0x00000802, 0x00080002, 0x00000000
.word 0x00080000, 0x02000000, 0x02000802, 0x02080800
.word 0x00000002, 0x02080002, 0x00000800, 0x00080802
! nibble 1
.word 0x40108010, 0x00000000, 0x00108000, 0x40100000
.word 0x40000010, 0x00008010, 0x40008000, 0x00108000
.word 0x00008000, 0x40100010, 0x00000010, 0x40008000
.word 0x00100010, 0x40108000, 0x40100000, 0x00000010
.word 0x00100000, 0x40008010, 0x40100010, 0x00008000
.word 0x00108010, 0x40000000, 0x00000000, 0x00100010
.word 0x40008010, 0x00108010, 0x40108000, 0x40000010
.word 0x40000000, 0x00100000, 0x00008010, 0x40108010
.word 0x00100010, 0x40108000, 0x40008000, 0x00108010
.word 0x40108010, 0x00100010, 0x40000010, 0x00000000
.word 0x40000000, 0x00008010, 0x00100000, 0x40100010
.word 0x00008000, 0x40000000, 0x00108010, 0x40008010
.word 0x40108000, 0x00008000, 0x00000000, 0x40000010
.word 0x00000010, 0x40108010, 0x00108000, 0x40100000
.word 0x40100010, 0x00100000, 0x00008010, 0x40008000
.word 0x40008010, 0x00000010, 0x40100000, 0x00108000
! nibble 2
.word 0x04000001, 0x04040100, 0x00000100, 0x04000101
.word 0x00040001, 0x04000000, 0x04000101, 0x00040100
.word 0x04000100, 0x00040000, 0x04040000, 0x00000001
.word 0x04040101, 0x00000101, 0x00000001, 0x04040001
.word 0x00000000, 0x00040001, 0x04040100, 0x00000100
.word 0x00000101, 0x04040101, 0x00040000, 0x04000001
.word 0x04040001, 0x04000100, 0x00040101, 0x04040000
.word 0x00040100, 0x00000000, 0x04000000, 0x00040101
.word 0x04040100, 0x00000100, 0x00000001, 0x00040000
.word 0x00000101, 0x00040001, 0x04040000, 0x04000101
.word 0x00000000, 0x04040100, 0x00040100, 0x04040001
.word 0x00040001, 0x04000000, 0x04040101, 0x00000001
.word 0x00040101, 0x04000001, 0x04000000, 0x04040101
.word 0x00040000, 0x04000100, 0x04000101, 0x00040100
.word 0x04000100, 0x00000000, 0x04040001, 0x00000101
.word 0x04000001, 0x00040101, 0x00000100, 0x04040000
! nibble 3
.word 0x00401008, 0x10001000, 0x00000008, 0x10401008
.word 0x00000000, 0x10400000, 0x10001008, 0x00400008
.word 0x10401000, 0x10000008, 0x10000000, 0x00001008
.word 0x10000008, 0x00401008, 0x00400000, 0x10000000
.word 0x10400008, 0x00401000, 0x00001000, 0x00000008
.word 0x00401000, 0x10001008, 0x10400000, 0x00001000
.word 0x00001008, 0x00000000, 0x00400008, 0x10401000
.word 0x10001000, 0x10400008, 0x10401008, 0x00400000
.word 0x10400008, 0x00001008, 0x00400000, 0x10000008
.word 0x00401000, 0x10001000, 0x00000008, 0x10400000
.word 0x10001008, 0x00000000, 0x00001000, 0x00400008
.word 0x00000000, 0x10400008, 0x10401000, 0x00001000
.word 0x10000000, 0x10401008, 0x00401008, 0x00400000
.word 0x10401008, 0x00000008, 0x10001000, 0x00401008
.word 0x00400008, 0x00401000, 0x10400000, 0x10001008
.word 0x00001008, 0x10000000, 0x10000008, 0x10401000
! nibble 4
.word 0x08000000, 0x00010000, 0x00000400, 0x08010420
.word 0x08010020, 0x08000400, 0x00010420, 0x08010000
.word 0x00010000, 0x00000020, 0x08000020, 0x00010400
.word 0x08000420, 0x08010020, 0x08010400, 0x00000000
.word 0x00010400, 0x08000000, 0x00010020, 0x00000420
.word 0x08000400, 0x00010420, 0x00000000, 0x08000020
.word 0x00000020, 0x08000420, 0x08010420, 0x00010020
.word 0x08010000, 0x00000400, 0x00000420, 0x08010400
.word 0x08010400, 0x08000420, 0x00010020, 0x08010000
.word 0x00010000, 0x00000020, 0x08000020, 0x08000400
.word 0x08000000, 0x00010400, 0x08010420, 0x00000000
.word 0x00010420, 0x08000000, 0x00000400, 0x00010020
.word 0x08000420, 0x00000400, 0x00000000, 0x08010420
.word 0x08010020, 0x08010400, 0x00000420, 0x00010000
.word 0x00010400, 0x08010020, 0x08000400, 0x00000420
.word 0x00000020, 0x00010420, 0x08010000, 0x08000020
! nibble 5
.word 0x80000040, 0x00200040, 0x00000000, 0x80202000
.word 0x00200040, 0x00002000, 0x80002040, 0x00200000
.word 0x00002040, 0x80202040, 0x00202000, 0x80000000
.word 0x80002000, 0x80000040, 0x80200000, 0x00202040
.word 0x00200000, 0x80002040, 0x80200040, 0x00000000
.word 0x00002000, 0x00000040, 0x80202000, 0x80200040
.word 0x80202040, 0x80200000, 0x80000000, 0x00002040
.word 0x00000040, 0x00202000, 0x00202040, 0x80002000
.word 0x00002040, 0x80000000, 0x80002000, 0x00202040
.word 0x80202000, 0x00200040, 0x00000000, 0x80002000
.word 0x80000000, 0x00002000, 0x80200040, 0x00200000
.word 0x00200040, 0x80202040, 0x00202000, 0x00000040
.word 0x80202040, 0x00202000, 0x00200000, 0x80002040
.word 0x80000040, 0x80200000, 0x00202040, 0x00000000
.word 0x00002000, 0x80000040, 0x80002040, 0x80202000
.word 0x80200000, 0x00002040, 0x00000040, 0x80200040
! nibble 6
.word 0x00004000, 0x00000200, 0x01000200, 0x01000004
.word 0x01004204, 0x00004004, 0x00004200, 0x00000000
.word 0x01000000, 0x01000204, 0x00000204, 0x01004000
.word 0x00000004, 0x01004200, 0x01004000, 0x00000204
.word 0x01000204, 0x00004000, 0x00004004, 0x01004204
.word 0x00000000, 0x01000200, 0x01000004, 0x00004200
.word 0x01004004, 0x00004204, 0x01004200, 0x00000004
.word 0x00004204, 0x01004004, 0x00000200, 0x01000000
.word 0x00004204, 0x01004000, 0x01004004, 0x00000204
.word 0x00004000, 0x00000200, 0x01000000, 0x01004004
.word 0x01000204, 0x00004204, 0x00004200, 0x00000000
.word 0x00000200, 0x01000004, 0x00000004, 0x01000200
.word 0x00000000, 0x01000204, 0x01000200, 0x00004200
.word 0x00000204, 0x00004000, 0x01004204, 0x01000000
.word 0x01004200, 0x00000004, 0x00004004, 0x01004204
.word 0x01000004, 0x01004200, 0x01004000, 0x00004004
! nibble 7
.word 0x20800080, 0x20820000, 0x00020080, 0x00000000
.word 0x20020000, 0x00800080, 0x20800000, 0x20820080
.word 0x00000080, 0x20000000, 0x00820000, 0x00020080
.word 0x00820080, 0x20020080, 0x20000080, 0x20800000
.word 0x00020000, 0x00820080, 0x00800080, 0x20020000
.word 0x20820080, 0x20000080, 0x00000000, 0x00820000
.word 0x20000000, 0x00800000, 0x20020080, 0x20800080
.word 0x00800000, 0x00020000, 0x20820000, 0x00000080
.word 0x00800000, 0x00020000, 0x20000080, 0x20820080
.word 0x00020080, 0x20000000, 0x00000000, 0x00820000
.word 0x20800080, 0x20020080, 0x20020000, 0x00800080
.word 0x20820000, 0x00000080, 0x00800080, 0x20020000
.word 0x20820080, 0x00800000, 0x20800000, 0x20000080
.word 0x00820000, 0x00020080, 0x20020080, 0x20800000
.word 0x00000080, 0x20820000, 0x00820080, 0x00000000
.word 0x20000000, 0x20800080, 0x00020000, 0x00820080
| {
"pile_set_name": "Github"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.